Visible content
12 |
29 | A simple play icon, with an embed title element for a11y.
30 |
{content};
27 | }
28 | );
29 |
--------------------------------------------------------------------------------
/packages/svg-parser/examples/custom-props.tsx:
--------------------------------------------------------------------------------
1 | import { parser } from '@bento/svg-parser';
2 |
3 | /**
4 | * Custom Props Transformation Example
5 | *
6 | * This example demonstrates how to transform SVG attributes using custom prop transformations.
7 | * It shows how to:
8 | * - Convert 'class' to 'className'
9 | * - Convert 'stroke-width' to 'strokeWidth'
10 | */
11 | const svgWithCustomProps = `
12 |
15 | `;
16 |
17 | export function CustomPropsExample() {
18 | const parsedSvg = parser(svgWithCustomProps, {
19 | props: {
20 | // Transform 'class' attribute to 'className'
21 | class: (node) => ['className', node.getAttribute('class')!],
22 | // Transform 'stroke-width' to 'strokeWidth'
23 | 'stroke-width': (node) => ['strokeWidth', node.getAttribute('stroke-width')!]
24 | }
25 | });
26 | return parsedSvg;
27 | }
28 |
--------------------------------------------------------------------------------
/packages/container/examples/empty.tsx:
--------------------------------------------------------------------------------
1 | import { Container, type ContainerProps } from '@bento/container';
2 | /* v8 ignore next */
3 | import React from 'react';
4 |
5 | export function EmptyExample(args: ContainerProps) {
6 | return (
7 | {JSON.stringify(data, null, 2)};
30 | });
31 |
--------------------------------------------------------------------------------
/packages/overlay/overlay.stories.tsx:
--------------------------------------------------------------------------------
1 | import { getMeta, getComponentDocs, getStory } from '@bento/storybook-addon-helpers';
2 | import { Overlay as OverlayComponent } from './src/index.tsx';
3 | import { Basic as BasicExample } from './examples/basic.tsx';
4 | import { Modal as ModalExample } from './examples/modal.tsx';
5 | import { Drawer as DrawerExample } from './examples/drawer.tsx';
6 | import { UncontrolledWithTrigger as UncontrolledExample } from './examples/uncontrolled.tsx';
7 | import { Popover as PopoverExample } from './examples/popover.tsx';
8 |
9 | export default getMeta({
10 | title: 'components/Overlay'
11 | });
12 |
13 | export const Props = getComponentDocs(OverlayComponent);
14 |
15 | export const Basic = getStory(BasicExample);
16 |
17 | export const Modal = getStory(ModalExample);
18 |
19 | export const Drawer = getStory(DrawerExample);
20 |
21 | export const Uncontrolled = getStory(UncontrolledExample);
22 |
23 | export const Popover = getStory(PopoverExample);
24 |
--------------------------------------------------------------------------------
/.grit/no_anonymous_function_expressions.grit:
--------------------------------------------------------------------------------
1 | // Detect anonymous function expressions (function() {} and function(params) {})
2 | // Uses 'as $funcSig' to capture function signature for better span highlighting
3 | or {
4 | // Pattern for anonymous function with no parameters
5 | `function() { $body }` as $funcSig where {
6 | register_diagnostic(
7 | span = $funcSig,
8 | message = "Anonymous function expressions should be assigned to a named variable or converted to named functions for better debugging",
9 | severity = "error"
10 | )
11 | },
12 | // Pattern for anonymous function with parameters
13 | `function($params) { $body }` as $funcSig where {
14 | register_diagnostic(
15 | span = $funcSig,
16 | message = "Anonymous function expressions should be assigned to a named variable or converted to named functions for better debugging",
17 | severity = "error"
18 | )
19 | }
20 | }
--------------------------------------------------------------------------------
/packages/environment/environment.stories.tsx:
--------------------------------------------------------------------------------
1 | import { getMeta, getComponentDocs, getStory } from '@bento/storybook-addon-helpers';
2 | import { Environment } from './src/index.tsx';
3 | import { ComponentLevelExample } from './examples/component-level.tsx';
4 | import { CustomButtonExample } from './examples/custom-button.tsx';
5 | import { IframeRenderingExample } from './examples/iframe-rendering.tsx';
6 | import { OverrideProps } from './examples/override-props.tsx';
7 | import { Override } from './examples/override.tsx';
8 |
9 | export default getMeta({
10 | title: 'components/Environment'
11 | });
12 |
13 | export const API = getComponentDocs(Environment);
14 |
15 | export const Demo = getStory(Override);
16 |
17 | export const OverridePropsDemo = getStory(OverrideProps);
18 |
19 | export const ComponentLevelOverride = getStory(ComponentLevelExample);
20 |
21 | export const IframeRendering = getStory(IframeRenderingExample);
22 |
23 | export const Experimentation = getStory(CustomButtonExample);
24 |
--------------------------------------------------------------------------------
/packages/listbox/examples/sections.tsx:
--------------------------------------------------------------------------------
1 | /* v8 ignore next */
2 | import React from 'react';
3 | import { ListBox, ListBoxItem, ListBoxSection, Header } from '@bento/listbox';
4 | import style from './listbox.module.css';
5 |
6 | /**
7 | * Example component demonstrating ListBox with static sections.
8 | *
9 | * @param {any} args - The component props.
10 | * @returns {JSX.Element} The rendered ListBox with sectioned items.
11 | * @public
12 | */
13 | export function SectionsExample(args: any) {
14 | return (
15 | {props.externalProp}
11 | {props.optionalProp && {props.optionalProp}} 12 |Enabled: {props.config.enabled.toString()}
23 |Timeout: {props.config.settings.timeout}
24 |{props.externalProp}
41 |Local: {props.localProp.toString()}
42 |