anvilui 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +483 -0
- package/README.md +70 -3
- package/bin/anvilui.mjs +83 -0
- package/dist/colors/colors.d.ts +10 -2
- package/dist/components/Accordion/Accordion.d.ts +36 -0
- package/dist/components/AnimatedNumber/AnimatedNumber.d.ts +17 -0
- package/dist/components/AnvilRoot/AnvilContext.d.ts +22 -2
- package/dist/components/AnvilRoot/AnvilRoot.d.ts +44 -6
- package/dist/components/AppBar/AppBar.d.ts +13 -2
- package/dist/components/Avatar/Avatar.d.ts +6 -2
- package/dist/components/Avatar/AvatarGroupContext.d.ts +1 -0
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +25 -0
- package/dist/components/Badge/Badge.d.ts +4 -0
- package/dist/components/BottomSheet/BottomSheet.d.ts +22 -0
- package/dist/components/Button/Button.d.ts +17 -0
- package/dist/components/Calendar/Calendar.d.ts +19 -0
- package/dist/components/Card/Card.d.ts +36 -0
- package/dist/components/Carousel/Carousel.d.ts +21 -0
- package/dist/components/Checkbox/Checkbox.d.ts +10 -0
- package/dist/components/Chip/Chip.d.ts +25 -2
- package/dist/components/Combobox/Combobox.d.ts +42 -0
- package/dist/components/Confetti/Confetti.d.ts +31 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +24 -0
- package/dist/components/DateInput/DateInput.d.ts +37 -0
- package/dist/components/Dialog/Dialog.d.ts +32 -0
- package/dist/components/Divider/Divider.d.ts +8 -0
- package/dist/components/FAB/FAB.d.ts +4 -0
- package/dist/components/FAB/magnet.d.ts +2 -0
- package/dist/components/FABMenu/FABMenu.d.ts +55 -0
- package/dist/components/Field/Field.d.ts +20 -0
- package/dist/components/FloatingToolbar/FloatingToolbar.d.ts +15 -0
- package/dist/components/HoldButton/HoldButton.d.ts +4 -1
- package/dist/components/Icon/Icon.d.ts +14 -0
- package/dist/components/IconButton/IconButton.d.ts +11 -0
- package/dist/components/Input/Input.d.ts +9 -0
- package/dist/components/Kbd/Kbd.d.ts +21 -0
- package/dist/components/List/List.d.ts +10 -1
- package/dist/components/Menu/Menu.d.ts +32 -0
- package/dist/components/Menubar/Menubar.d.ts +17 -0
- package/dist/components/NavigationBar/NavigationBar.d.ts +10 -0
- package/dist/components/NavigationDrawer/NavigationDrawer.d.ts +22 -0
- package/dist/components/NavigationList/NavigationList.d.ts +27 -0
- package/dist/components/NavigationRail/NavigationRail.d.ts +25 -9
- package/dist/components/PinInput/PinInput.d.ts +31 -0
- package/dist/components/Popover/Popover.d.ts +30 -2
- package/dist/components/PreviewCard/PreviewCard.d.ts +31 -0
- package/dist/components/Progress/Progress.d.ts +8 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +12 -0
- package/dist/components/Search/Search.d.ts +39 -0
- package/dist/components/Select/Select.d.ts +15 -2
- package/dist/components/Skeleton/Skeleton.d.ts +20 -0
- package/dist/components/Slider/Slider.d.ts +5 -0
- package/dist/components/Snackbar/Snackbar.d.ts +7 -2
- package/dist/components/SplitButton/SplitButton.d.ts +13 -0
- package/dist/components/Sticker/Sticker.d.ts +21 -0
- package/dist/components/Switch/Switch.d.ts +11 -0
- package/dist/components/Table/Table.d.ts +36 -0
- package/dist/components/Tabs/Tabs.d.ts +17 -0
- package/dist/components/Textarea/Textarea.d.ts +8 -0
- package/dist/components/TimePicker/TimePicker.d.ts +45 -0
- package/dist/components/Toggle/Toggle.d.ts +41 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +14 -2
- package/dist/components/Tooltip/Tooltip.d.ts +10 -1
- package/dist/components/Typography/Typography.d.ts +13 -1
- package/dist/datetime.d.ts +12 -0
- package/dist/dev.d.ts +15 -0
- package/dist/index.cjs +3105 -634
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1417 -364
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +50 -4
- package/dist/index.js +3038 -591
- package/dist/index.js.map +1 -1
- package/dist/themes/baseTheme.d.ts +2 -0
- package/dist/themes/createTheme.d.ts +22 -0
- package/dist/themes/monochromeTheme.d.ts +2 -0
- package/dist/themes/types.d.ts +15 -6
- package/dist/tokens/baseTokens.d.ts +4 -0
- package/dist/tokens/types.d.ts +34 -0
- package/docs/accordion.md +47 -0
- package/docs/animated-number.md +31 -0
- package/docs/app-bar.md +53 -0
- package/docs/avatar-group.md +35 -0
- package/docs/avatar.md +34 -0
- package/docs/badge.md +41 -0
- package/docs/bottom-sheet.md +65 -0
- package/docs/button.md +63 -0
- package/docs/calendar.md +26 -0
- package/docs/card.md +71 -0
- package/docs/carousel.md +43 -0
- package/docs/checkbox.md +37 -0
- package/docs/chip.md +48 -0
- package/docs/combobox.md +72 -0
- package/docs/composition.md +80 -0
- package/docs/confetti.md +30 -0
- package/docs/context-menu.md +42 -0
- package/docs/date-input.md +41 -0
- package/docs/dialog.md +106 -0
- package/docs/divider.md +31 -0
- package/docs/fab-menu.md +55 -0
- package/docs/fab.md +43 -0
- package/docs/field.md +59 -0
- package/docs/floating-toolbar.md +48 -0
- package/docs/forms.md +81 -0
- package/docs/hold-button.md +32 -0
- package/docs/icon-button.md +54 -0
- package/docs/icons.md +38 -0
- package/docs/input.md +50 -0
- package/docs/kbd.md +25 -0
- package/docs/list.md +65 -0
- package/docs/llms-index.md +82 -0
- package/docs/menu.md +88 -0
- package/docs/menubar.md +34 -0
- package/docs/morph.md +51 -0
- package/docs/navigation-bar.md +48 -0
- package/docs/navigation-drawer.md +72 -0
- package/docs/navigation-list.md +40 -0
- package/docs/navigation-rail.md +53 -0
- package/docs/pin-input.md +38 -0
- package/docs/popover.md +78 -0
- package/docs/preview-card.md +40 -0
- package/docs/progress.md +37 -0
- package/docs/radio-group.md +47 -0
- package/docs/search.md +77 -0
- package/docs/select.md +64 -0
- package/docs/setup.md +106 -0
- package/docs/skeleton.md +33 -0
- package/docs/slider.md +49 -0
- package/docs/snackbar.md +50 -0
- package/docs/split-button.md +44 -0
- package/docs/sticker.md +27 -0
- package/docs/switch.md +44 -0
- package/docs/table.md +66 -0
- package/docs/tabs.md +51 -0
- package/docs/textarea.md +23 -0
- package/docs/theming.md +182 -0
- package/docs/time-picker.md +38 -0
- package/docs/toggle-group.md +70 -0
- package/docs/toggle.md +49 -0
- package/docs/tooltip.md +42 -0
- package/docs/typography.md +41 -0
- package/package.json +25 -5
package/bin/anvilui.mjs
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// `npx anvilui setup-agents`: tells the project's AI coding agents to read
|
|
3
|
+
// the docs that ship in node_modules/anvilui. Only runs when called.
|
|
4
|
+
import fs from 'node:fs'
|
|
5
|
+
import path from 'node:path'
|
|
6
|
+
|
|
7
|
+
const MARKER = '<!-- anvilui-agent-docs -->'
|
|
8
|
+
const SNIPPET = `${MARKER}
|
|
9
|
+
## AnvilUI
|
|
10
|
+
|
|
11
|
+
This project uses the \`anvilui\` React component library. Its API differs from shadcn/ui, Radix and MUI, so don't guess it. Before writing or changing UI code that uses it, read \`node_modules/anvilui/AGENTS.md\`, then the page for each component you use in \`node_modules/anvilui/docs/\` (index: \`node_modules/anvilui/docs/llms-index.md\`). These docs match the installed version; prefer them over memory.
|
|
12
|
+
`
|
|
13
|
+
|
|
14
|
+
// Instruction files agents read, in the order we look for them
|
|
15
|
+
const KNOWN = [
|
|
16
|
+
'AGENTS.md',
|
|
17
|
+
'CLAUDE.md',
|
|
18
|
+
'.cursorrules',
|
|
19
|
+
'.github/copilot-instructions.md',
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
const HELP = `Usage: npx anvilui setup-agents [--file <path>]...
|
|
23
|
+
|
|
24
|
+
Adds a short note to your AI agent instruction files telling agents to read
|
|
25
|
+
node_modules/anvilui/AGENTS.md before writing code with AnvilUI.
|
|
26
|
+
|
|
27
|
+
With no --file, updates every one of ${KNOWN.join(', ')}
|
|
28
|
+
that exists in the current folder, or creates AGENTS.md if none do.
|
|
29
|
+
Files that already have the note are left alone.
|
|
30
|
+
|
|
31
|
+
--file <path> Update (or create) this file instead. Repeatable.
|
|
32
|
+
`
|
|
33
|
+
|
|
34
|
+
const [command, ...args] = process.argv.slice(2)
|
|
35
|
+
|
|
36
|
+
if (command !== 'setup-agents') {
|
|
37
|
+
process.stdout.write(HELP)
|
|
38
|
+
process.exit(
|
|
39
|
+
command === undefined || command === '--help' || command === '-h'
|
|
40
|
+
? 0
|
|
41
|
+
: 1
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const files = []
|
|
46
|
+
for (let i = 0; i < args.length; i++) {
|
|
47
|
+
if (args[i] === '--file' && args[i + 1]) files.push(args[++i])
|
|
48
|
+
else if (args[i] === '--help' || args[i] === '-h') {
|
|
49
|
+
process.stdout.write(HELP)
|
|
50
|
+
process.exit(0)
|
|
51
|
+
} else {
|
|
52
|
+
process.stderr.write(`Unknown option: ${args[i]}\n\n${HELP}`)
|
|
53
|
+
process.exit(1)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const cwd = process.cwd()
|
|
58
|
+
if (files.length === 0) {
|
|
59
|
+
files.push(...KNOWN.filter((f) => fs.existsSync(path.join(cwd, f))))
|
|
60
|
+
if (files.length === 0) files.push('AGENTS.md')
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
for (const file of files) {
|
|
64
|
+
const full = path.resolve(cwd, file)
|
|
65
|
+
const existing = fs.existsSync(full) ? fs.readFileSync(full, 'utf8') : null
|
|
66
|
+
if (existing?.includes(MARKER)) {
|
|
67
|
+
console.log(`unchanged ${file} (already has the AnvilUI note)`)
|
|
68
|
+
continue
|
|
69
|
+
}
|
|
70
|
+
fs.mkdirSync(path.dirname(full), { recursive: true })
|
|
71
|
+
if (existing === null) {
|
|
72
|
+
fs.writeFileSync(full, SNIPPET)
|
|
73
|
+
console.log(`created ${file}`)
|
|
74
|
+
} else {
|
|
75
|
+
const gap = existing.endsWith('\n\n')
|
|
76
|
+
? ''
|
|
77
|
+
: existing.endsWith('\n')
|
|
78
|
+
? '\n'
|
|
79
|
+
: '\n\n'
|
|
80
|
+
fs.appendFileSync(full, gap + SNIPPET)
|
|
81
|
+
console.log(`updated ${file}`)
|
|
82
|
+
}
|
|
83
|
+
}
|
package/dist/colors/colors.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
/** A color role from the theme. `container` is the neutral one. */
|
|
2
|
-
export type ComponentColor = 'primary' | 'tonal' | 'success' | 'warning' | 'error' | 'container';
|
|
3
1
|
/**
|
|
2
|
+
* A color role from the theme. `primary` is the brand color, `tonal` a
|
|
3
|
+
* softer accent for selected and secondary actions, `container` the neutral
|
|
4
|
+
* one (use it for "secondary" or "default" buttons), and `surface` the
|
|
5
|
+
* background of navigation and popups. There is no `secondary`, `danger` or
|
|
6
|
+
* `destructive`: use `tonal` or `container`, and `error`.
|
|
7
|
+
*/
|
|
8
|
+
export type ComponentColor = 'primary' | 'tonal' | 'success' | 'warning' | 'error' | 'container' | 'surface';
|
|
9
|
+
/**
|
|
10
|
+
* How a color is applied. Takes the place of the `variant` prop other
|
|
11
|
+
* libraries use.
|
|
4
12
|
* - `filled`: solid background in the color
|
|
5
13
|
* - `outlined`: transparent with a border, text in the color
|
|
6
14
|
* - `text`: transparent, no border, text in the color
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Accordion as BaseAccordion } from '@base-ui/react/accordion';
|
|
2
|
+
import './accordion.css';
|
|
3
|
+
/**
|
|
4
|
+
* A stack of sections that each expand to show their content. Fill it with
|
|
5
|
+
* `AccordionItem`s. Holds which are open (`value` / `defaultValue` /
|
|
6
|
+
* `onValueChange`); pass `multiple` to allow more than one at a time.
|
|
7
|
+
*/
|
|
8
|
+
export type AccordionProps = BaseAccordion.Root.Props;
|
|
9
|
+
/**
|
|
10
|
+
* A stack of expandable sections. `value` is an array of open item values
|
|
11
|
+
* (even when only one can be open). Pass `multiple` to allow several.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <Accordion defaultValue={['shipping']}>
|
|
15
|
+
* <AccordionItem value="shipping">
|
|
16
|
+
* <AccordionTrigger>Shipping</AccordionTrigger>
|
|
17
|
+
* <AccordionPanel>Ships in 2 days.</AccordionPanel>
|
|
18
|
+
* </AccordionItem>
|
|
19
|
+
* </Accordion>
|
|
20
|
+
*/
|
|
21
|
+
export declare function Accordion({ className, ...props }: AccordionProps): import("react").JSX.Element;
|
|
22
|
+
export type AccordionItemProps = BaseAccordion.Item.Props;
|
|
23
|
+
/**
|
|
24
|
+
* One section: an `AccordionTrigger`, then an `AccordionPanel`. Give it a
|
|
25
|
+
* `value` to control it from the Accordion.
|
|
26
|
+
*/
|
|
27
|
+
export declare function AccordionItem({ className, ...props }: AccordionItemProps): import("react").JSX.Element;
|
|
28
|
+
export type AccordionTriggerProps = BaseAccordion.Trigger.Props & {
|
|
29
|
+
/** The heading level that wraps the button, to fit the page's outline. @default 'h3' */
|
|
30
|
+
as?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
31
|
+
};
|
|
32
|
+
/** The section's title row. Renders a button inside an `<h3>` (change with `as`). */
|
|
33
|
+
export declare function AccordionTrigger({ as: Heading, className, children, ...props }: AccordionTriggerProps): import("react").JSX.Element;
|
|
34
|
+
export type AccordionPanelProps = BaseAccordion.Panel.Props;
|
|
35
|
+
/** The section's content, shown while it's open. */
|
|
36
|
+
export declare function AccordionPanel({ className, children, ...props }: AccordionPanelProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import './animated-number.css';
|
|
2
|
+
export type AnimatedNumberProps = Omit<React.ComponentProps<'span'>, 'children'> & {
|
|
3
|
+
/** The number to show. Digits roll to the new value when it changes. */
|
|
4
|
+
value: number;
|
|
5
|
+
/** How to format the number: decimals, currency, percent, compact, ... */
|
|
6
|
+
format?: Intl.NumberFormatOptions;
|
|
7
|
+
/** Locale for formatting. @default the browser's */
|
|
8
|
+
locales?: Intl.LocalesArgument;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A number whose digits roll like an odometer when `value` changes.
|
|
12
|
+
* Screen readers hear the formatted number, not the individual digits.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <AnimatedNumber value={price} format={{ style: 'currency', currency: 'USD' }} />
|
|
16
|
+
*/
|
|
17
|
+
export declare function AnimatedNumber({ value, format, locales, className, ...props }: AnimatedNumberProps): import("react").JSX.Element;
|
|
@@ -1,14 +1,34 @@
|
|
|
1
1
|
import { Dispatch, RefObject, SetStateAction } from 'react';
|
|
2
2
|
import { Theme } from '../../themes/types';
|
|
3
3
|
import { DesignTokens } from '../../tokens/types';
|
|
4
|
+
/** The mode actually shown. */
|
|
4
5
|
export type ColorType = 'light' | 'dark';
|
|
6
|
+
/** What the user picked; `'system'` follows the OS setting live. */
|
|
7
|
+
export type ColorModeSetting = ColorType | 'system';
|
|
5
8
|
type AnvilContextValues = {
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
/** The mode being shown, with `'system'` already resolved. */
|
|
10
|
+
colorMode: ColorType;
|
|
11
|
+
/** What was picked, which may be `'system'`. */
|
|
12
|
+
colorModeSetting: ColorModeSetting;
|
|
13
|
+
/** Changes the color mode, like a `useState` setter. Saved under `storageKey` if set. */
|
|
14
|
+
setColorMode: Dispatch<SetStateAction<ColorModeSetting>>;
|
|
15
|
+
/** The theme used in dark mode. */
|
|
8
16
|
darkTheme: Theme;
|
|
17
|
+
/** The theme used in light mode. */
|
|
9
18
|
lightTheme: Theme;
|
|
19
|
+
/** The design tokens in use, defaults filled in. */
|
|
10
20
|
tokens: DesignTokens;
|
|
11
21
|
rootRef: RefObject<HTMLDivElement | null>;
|
|
12
22
|
};
|
|
23
|
+
/** The raw context behind `useAnvil()`: `null` outside AnvilRoot. Prefer `useAnvil()`. */
|
|
13
24
|
export declare const AnvilContext: import("react").Context<AnvilContextValues | null>;
|
|
25
|
+
/**
|
|
26
|
+
* The current color mode, its setter, themes and tokens. Must be used inside
|
|
27
|
+
* `AnvilRoot`.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const { colorMode, setColorMode } = useAnvil()
|
|
31
|
+
* <Switch checked={colorMode === 'dark'} onCheckedChange={(dark) => setColorMode(dark ? 'dark' : 'light')} />
|
|
32
|
+
*/
|
|
33
|
+
export declare function useAnvil(): AnvilContextValues;
|
|
14
34
|
export {};
|
|
@@ -1,18 +1,56 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ColorModeSetting } from './AnvilContext';
|
|
3
3
|
import { Theme } from '../../themes/types';
|
|
4
4
|
import { DesignTokens } from '../../tokens/types';
|
|
5
5
|
import '../../colors/colors.css';
|
|
6
6
|
import './global.css';
|
|
7
7
|
export type AnvilRootProps = {
|
|
8
|
+
/** Your app. Every AnvilUI component must be somewhere inside. */
|
|
8
9
|
children: ReactNode;
|
|
10
|
+
/** Extra classes for the root element, e.g. to make it fill the viewport. */
|
|
11
|
+
className?: string;
|
|
9
12
|
/** Controlled color mode. Pair with `onColorModeChange`. */
|
|
10
|
-
colorMode?:
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
colorMode?: ColorModeSetting;
|
|
14
|
+
/**
|
|
15
|
+
* Starting color mode when `colorMode` isn't controlled and nothing is
|
|
16
|
+
* saved under `storageKey`. `'system'` follows the OS setting live.
|
|
17
|
+
* @default 'system'
|
|
18
|
+
*/
|
|
19
|
+
defaultColorMode?: ColorModeSetting;
|
|
20
|
+
/** Called whenever the color mode is changed. */
|
|
21
|
+
onColorModeChange?: (colorMode: ColorModeSetting) => void;
|
|
22
|
+
/**
|
|
23
|
+
* When set, the color mode is saved in `localStorage` under this key and
|
|
24
|
+
* restored on the next visit. With server rendering, a small inline script
|
|
25
|
+
* applies it before the first paint, so there's no flash (a strict CSP
|
|
26
|
+
* must allow inline scripts for that).
|
|
27
|
+
*/
|
|
28
|
+
storageKey?: string;
|
|
29
|
+
/** Colors used in light mode. @default baseLightTheme */
|
|
14
30
|
lightTheme?: Theme;
|
|
31
|
+
/** Colors used in dark mode. @default baseDarkTheme */
|
|
15
32
|
darkTheme?: Theme;
|
|
16
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Spacing, radius, font, motion and shadow tokens. Categories you pass
|
|
35
|
+
* replace the base ones; the rest keep their defaults.
|
|
36
|
+
* @default baseDesignTokens
|
|
37
|
+
*/
|
|
38
|
+
tokens?: Partial<DesignTokens>;
|
|
17
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Required at the top of the app. Provides the theme, color mode, tooltip
|
|
42
|
+
* and snackbar providers, and the element that menus, dialogs and other
|
|
43
|
+
* popups portal into. Also import `'anvilui/styles.css'` once.
|
|
44
|
+
*
|
|
45
|
+
* Only the root's own box is themed; to color the whole page, make it fill
|
|
46
|
+
* the viewport via `className`.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* import { AnvilRoot } from 'anvilui'
|
|
50
|
+
* import 'anvilui/styles.css'
|
|
51
|
+
*
|
|
52
|
+
* <AnvilRoot defaultColorMode="system" storageKey="color-mode">
|
|
53
|
+
* <App />
|
|
54
|
+
* </AnvilRoot>
|
|
55
|
+
*/
|
|
18
56
|
export declare function AnvilRoot(props: AnvilRootProps): import("react").JSX.Element;
|
|
@@ -20,7 +20,7 @@ export type AppBarProps = ComponentProps<'header'> & {
|
|
|
20
20
|
centered?: boolean;
|
|
21
21
|
/**
|
|
22
22
|
* Color role from the theme. The default `container` gives the bar the
|
|
23
|
-
* navigation color (the theme's `
|
|
23
|
+
* navigation color (the theme's `surface`), so it matches a
|
|
24
24
|
* NavigationRail or NavigationDrawer beside it. @default 'container'
|
|
25
25
|
*/
|
|
26
26
|
color?: ComponentColor;
|
|
@@ -30,5 +30,16 @@ export type AppBarProps = ComponentProps<'header'> & {
|
|
|
30
30
|
*/
|
|
31
31
|
fillType?: ComponentFillType;
|
|
32
32
|
};
|
|
33
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* The bar across the top of a page or screen: title, navigation and actions.
|
|
35
|
+
* The title is the `label` prop, not children.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* <AppBar
|
|
39
|
+
* label="Inbox"
|
|
40
|
+
* labelAs="h1"
|
|
41
|
+
* start={<IconButton icon="menu" aria-label="Menu" fillType="text" color="container" />}
|
|
42
|
+
* end={<IconButton icon="search" aria-label="Search" fillType="text" color="container" />}
|
|
43
|
+
* />
|
|
44
|
+
*/
|
|
34
45
|
export declare function AppBar({ label, labelAs, start, end, size, centered, color, fillType, className, ...props }: AppBarProps): import("react").JSX.Element;
|
|
@@ -13,11 +13,15 @@ export type AvatarProps = BaseAvatar.Root.Props & ColorProps & {
|
|
|
13
13
|
name?: string;
|
|
14
14
|
/** Fallback icon when there's no `name`. @default 'person' */
|
|
15
15
|
icon?: MaterialSymbol;
|
|
16
|
-
/** 32px, 40px or 56px. @default 'normal' */
|
|
16
|
+
/** 32px, 40px or 56px. @default 'normal', or the AvatarGroup's size */
|
|
17
17
|
size?: 'small' | 'normal' | 'big';
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* A picture, initials or an icon that stands for a person or thing.
|
|
21
21
|
* `children` replaces the initials/icon fallback.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* <Avatar name="Ada Lovelace" src="/ada.jpg" />
|
|
25
|
+
* <Avatar name="Ada Lovelace" color="tonal" size="big" />
|
|
22
26
|
*/
|
|
23
|
-
export declare function Avatar({ src, name, icon, size, color, fillType, className, children, ...props }: AvatarProps): import("react").JSX.Element;
|
|
27
|
+
export declare function Avatar({ src, name, icon, size: sizeProp, color, fillType, className, children, ...props }: AvatarProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AvatarGroupContext: import("react").Context<"big" | "normal" | "small" | null | undefined>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
|
+
import { type AvatarProps } from '../Avatar/Avatar';
|
|
3
|
+
import './avatar-group.css';
|
|
4
|
+
export type AvatarGroupProps = ComponentProps<'div'> & {
|
|
5
|
+
/**
|
|
6
|
+
* Most avatars to show. Past it, the last spot becomes a "+N" counter,
|
|
7
|
+
* so the group never takes more than `max` spots. @default no limit
|
|
8
|
+
*/
|
|
9
|
+
max?: number;
|
|
10
|
+
/** Size of every avatar inside, unless one sets its own. @default 'normal' */
|
|
11
|
+
size?: AvatarProps['size'];
|
|
12
|
+
/** Spread the avatars apart on hover and keyboard focus. @default true */
|
|
13
|
+
fan?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A row of overlapping `Avatar`s that fans out on hover. Give it an
|
|
17
|
+
* `aria-label` ("Project members") so screen readers know what the
|
|
18
|
+
* avatars are.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* <AvatarGroup max={4} aria-label="Project members">
|
|
22
|
+
* {people.map((p) => <Avatar key={p.id} name={p.name} src={p.photo} />)}
|
|
23
|
+
* </AvatarGroup>
|
|
24
|
+
*/
|
|
25
|
+
export declare function AvatarGroup({ max, size, fan, className, children, ...props }: AvatarGroupProps): import("react").JSX.Element;
|
|
@@ -15,5 +15,9 @@ export type BadgeProps = ComponentProps<'span'> & {
|
|
|
15
15
|
*
|
|
16
16
|
* It's hidden from screen readers: put the count in the wrapped element's
|
|
17
17
|
* name too, e.g. `aria-label="Inbox, 3 unread"`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <Badge count={3}><IconButton icon="mail" aria-label="Inbox, 3 unread" /></Badge>
|
|
21
|
+
* <Badge><Icon name="notifications" /></Badge> // a dot
|
|
18
22
|
*/
|
|
19
23
|
export declare function Badge({ count, max, color, className, children, ...props }: BadgeProps): import("react").JSX.Element | null;
|
|
@@ -6,14 +6,36 @@ import './bottom-sheet.css';
|
|
|
6
6
|
* Pass `snapPoints` (e.g. `[0.5, 1]`) for a sheet that can stop part way.
|
|
7
7
|
*/
|
|
8
8
|
export type BottomSheetProps = Omit<Drawer.Root.Props, 'swipeDirection'>;
|
|
9
|
+
/**
|
|
10
|
+
* A panel that slides up from the bottom. Parts: `BottomSheetTrigger`,
|
|
11
|
+
* `BottomSheetPopup` (includes portal, backdrop and drag handle),
|
|
12
|
+
* `BottomSheetTitle`, `BottomSheetDescription`, `BottomSheetClose`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <BottomSheet>
|
|
16
|
+
* <BottomSheetTrigger render={<Button />}>Share</BottomSheetTrigger>
|
|
17
|
+
* <BottomSheetPopup>
|
|
18
|
+
* <BottomSheetTitle>Share</BottomSheetTitle>
|
|
19
|
+
* <List>...</List>
|
|
20
|
+
* </BottomSheetPopup>
|
|
21
|
+
* </BottomSheet>
|
|
22
|
+
*/
|
|
9
23
|
export declare function BottomSheet(props: BottomSheetProps): import("react").JSX.Element;
|
|
10
24
|
export type BottomSheetTriggerProps = Drawer.Trigger.Props;
|
|
25
|
+
/** Opens the sheet. Renders a bare `<button>`; pass `render={<Button />}` to use the library's. */
|
|
11
26
|
export declare function BottomSheetTrigger({ className, ...props }: BottomSheetTriggerProps): import("react").JSX.Element;
|
|
12
27
|
export type BottomSheetPopupProps = Drawer.Popup.Props;
|
|
28
|
+
/**
|
|
29
|
+
* The sheet. Also renders the portal, the dimmed backdrop and the drag
|
|
30
|
+
* handle. Its children scroll when the sheet is taller than the screen allows.
|
|
31
|
+
*/
|
|
13
32
|
export declare function BottomSheetPopup({ className, children, ...props }: BottomSheetPopupProps): import("react").JSX.Element;
|
|
14
33
|
export type BottomSheetTitleProps = Drawer.Title.Props;
|
|
34
|
+
/** Names the sheet for screen readers. Renders an `<h2>`. */
|
|
15
35
|
export declare function BottomSheetTitle({ className, ...props }: BottomSheetTitleProps): import("react").JSX.Element;
|
|
16
36
|
export type BottomSheetDescriptionProps = Drawer.Description.Props;
|
|
37
|
+
/** Supporting text under the title. */
|
|
17
38
|
export declare function BottomSheetDescription({ className, ...props }: BottomSheetDescriptionProps): import("react").JSX.Element;
|
|
18
39
|
export type BottomSheetCloseProps = Drawer.Close.Props;
|
|
40
|
+
/** Closes the sheet. Renders a bare `<button>`; pass `render={<Button />}` to use the library's. */
|
|
19
41
|
export declare function BottomSheetClose({ className, ...props }: BottomSheetCloseProps): import("react").JSX.Element;
|
|
@@ -3,10 +3,18 @@ import type { MaterialSymbol } from 'material-symbols';
|
|
|
3
3
|
import { ComponentColor, ComponentFillType } from '../../colors/colors';
|
|
4
4
|
import './button.css';
|
|
5
5
|
export type ButtonProps = BaseButtonProps & {
|
|
6
|
+
/** Height and text size: 32px, 40px or 48px tall. @default 'normal' */
|
|
6
7
|
size?: 'small' | 'normal' | 'big';
|
|
8
|
+
/**
|
|
9
|
+
* How the color is applied: solid, bordered, or text only. This is the
|
|
10
|
+
* prop other libraries call `variant`. @default 'filled'
|
|
11
|
+
*/
|
|
7
12
|
fillType?: ComponentFillType;
|
|
13
|
+
/** Color role from the theme. @default 'primary' */
|
|
8
14
|
color?: ComponentColor;
|
|
15
|
+
/** Material Symbol name shown before the label, e.g. `'add'`. */
|
|
9
16
|
startIcon?: MaterialSymbol;
|
|
17
|
+
/** Material Symbol name shown after the label, e.g. `'arrow_forward'`. */
|
|
10
18
|
endIcon?: MaterialSymbol;
|
|
11
19
|
/**
|
|
12
20
|
* Shows a spinner in place of `startIcon` and ignores clicks. Pass the
|
|
@@ -15,4 +23,13 @@ export type ButtonProps = BaseButtonProps & {
|
|
|
15
23
|
*/
|
|
16
24
|
loading?: boolean;
|
|
17
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* A button with a text label and optional icons. Renders a `<button>`; for a
|
|
28
|
+
* link, pass `render={<a href="/x" />}` and `nativeButton={false}`.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* <Button startIcon="add" onClick={create}>New</Button>
|
|
32
|
+
* <Button fillType="outlined" color="error">Delete</Button>
|
|
33
|
+
* <Button loading={saving}>{saving ? 'Saving' : 'Save'}</Button>
|
|
34
|
+
*/
|
|
18
35
|
export declare function Button({ size, fillType, color, startIcon, endIcon, loading, disabled, children, className, ref, ...props }: ButtonProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import './calendar.css';
|
|
2
|
+
export type CalendarProps = Omit<React.ComponentProps<'div'>, 'defaultValue' | 'onChange'> & {
|
|
3
|
+
/** The picked date as `"YYYY-MM-DD"` (like `<input type="date">`), or `null` for none. */
|
|
4
|
+
value?: string | null;
|
|
5
|
+
/** Starting date when `value` isn't controlled. @default null */
|
|
6
|
+
defaultValue?: string | null;
|
|
7
|
+
/** Called with the picked `"YYYY-MM-DD"`. */
|
|
8
|
+
onValueChange?: (value: string) => void;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A month grid to pick a date from. Arrow keys move by day and week, Page
|
|
12
|
+
* Up/Down by month (with Shift, by year), Home/End to the ends of the week.
|
|
13
|
+
* The first weekday and all names follow the user's locale. Values are
|
|
14
|
+
* `"YYYY-MM-DD"` strings, not `Date` objects.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <Calendar value={date} onValueChange={setDate} />
|
|
18
|
+
*/
|
|
19
|
+
export declare function Calendar({ value: valueProp, defaultValue, onValueChange, className, ...props }: CalendarProps): import("react").JSX.Element;
|
|
@@ -3,19 +3,55 @@ import { ComponentColor, ComponentFillType } from '../../colors/colors';
|
|
|
3
3
|
import { TypographyProps } from '../Typography/Typography';
|
|
4
4
|
import './card.css';
|
|
5
5
|
type CardStyleProps = {
|
|
6
|
+
/** How the color is applied. @default 'filled' */
|
|
6
7
|
fillType?: ComponentFillType;
|
|
8
|
+
/**
|
|
9
|
+
* Color role from the theme. Neutral by default, so primary buttons
|
|
10
|
+
* inside still stand out. @default 'container'
|
|
11
|
+
*/
|
|
7
12
|
color?: ComponentColor;
|
|
8
13
|
};
|
|
9
14
|
export type CardProps = (Omit<React.ComponentProps<'div'>, 'color'> & CardStyleProps & {
|
|
15
|
+
/**
|
|
16
|
+
* Make the whole card one button (or a link, with
|
|
17
|
+
* `render={<a href="..." />}`). Buttons and links inside still
|
|
18
|
+
* work on their own. @default false
|
|
19
|
+
*/
|
|
10
20
|
clickable?: false;
|
|
11
21
|
}) | (Omit<BaseButtonProps, 'color'> & CardStyleProps & {
|
|
22
|
+
/**
|
|
23
|
+
* Make the whole card one button (or a link, with
|
|
24
|
+
* `render={<a href="..." />}`). Buttons and links inside still
|
|
25
|
+
* work on their own. @default false
|
|
26
|
+
*/
|
|
12
27
|
clickable: true;
|
|
13
28
|
});
|
|
29
|
+
/**
|
|
30
|
+
* A rounded surface that groups related content. Compose it from
|
|
31
|
+
* `CardTitle`, `CardContent` and `CardActions` (there is no CardHeader or
|
|
32
|
+
* CardFooter). Neutral `container` color by default.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* <Card>
|
|
36
|
+
* <CardTitle as="h2">Storage</CardTitle>
|
|
37
|
+
* <CardContent>You've used 80% of your space.</CardContent>
|
|
38
|
+
* <CardActions>
|
|
39
|
+
* <Button fillType="text">Dismiss</Button>
|
|
40
|
+
* <Button>Upgrade</Button>
|
|
41
|
+
* </CardActions>
|
|
42
|
+
* </Card>
|
|
43
|
+
*/
|
|
14
44
|
export declare function Card(props: CardProps): import("react").JSX.Element;
|
|
15
45
|
export type CardTitleProps = TypographyProps;
|
|
46
|
+
/**
|
|
47
|
+
* The card's title. Looks like an h6 but renders a `<div>`: pass `as="h2"`
|
|
48
|
+
* (or the level that fits the page) to make it a heading.
|
|
49
|
+
*/
|
|
16
50
|
export declare function CardTitle({ type, as, className, ...props }: CardTitleProps): import("react").JSX.Element;
|
|
17
51
|
export type CardContentProps = React.ComponentProps<'div'>;
|
|
52
|
+
/** The card's body, with padding. */
|
|
18
53
|
export declare function CardContent({ className, ...props }: CardContentProps): import("react").JSX.Element;
|
|
19
54
|
export type CardActionsProps = React.ComponentProps<'div'>;
|
|
55
|
+
/** A row of buttons at the bottom of the card, aligned to the end. */
|
|
20
56
|
export declare function CardActions({ className, ...props }: CardActionsProps): import("react").JSX.Element;
|
|
21
57
|
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import './carousel.css';
|
|
2
|
+
export type CarouselProps = React.ComponentProps<'div'> & {
|
|
3
|
+
/** What the carousel shows, for screen readers ("Featured albums"). */
|
|
4
|
+
'aria-label': string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* A horizontally scrolling row of `CarouselItem`s.
|
|
8
|
+
* Items running off an edge are masked with rounded corners instead of being
|
|
9
|
+
* cut off flat, and their content slides to stay centered in what's visible
|
|
10
|
+
* (in browsers with scroll-driven animations; Firefox cuts them off flat).
|
|
11
|
+
* With a mouse, it can be dragged and thrown like on a touch screen.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <Carousel aria-label="Featured albums">
|
|
15
|
+
* {albums.map((a) => <CarouselItem key={a.id}><img src={a.cover} alt={a.title} /></CarouselItem>)}
|
|
16
|
+
* </Carousel>
|
|
17
|
+
*/
|
|
18
|
+
export declare function Carousel({ className, ref, children, ...props }: CarouselProps): import("react").JSX.Element;
|
|
19
|
+
export type CarouselItemProps = React.ComponentProps<'div'>;
|
|
20
|
+
/** One item in a `Carousel`. Set its width with CSS; 240px by default. */
|
|
21
|
+
export declare function CarouselItem({ className, children, ...props }: CarouselItemProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { Checkbox as BaseCheckbox } from '@base-ui/react/checkbox';
|
|
2
2
|
import './checkbox.css';
|
|
3
3
|
export type CheckboxProps = BaseCheckbox.Root.Props;
|
|
4
|
+
/**
|
|
5
|
+
* A checkbox. State: `checked` / `defaultChecked` / `onCheckedChange`, plus
|
|
6
|
+
* `indeterminate`. It has no `label` prop: wrap it in a `<label>` with the text.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <label style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
|
|
10
|
+
* <Checkbox checked={agreed} onCheckedChange={setAgreed} />
|
|
11
|
+
* I agree to the terms
|
|
12
|
+
* </label>
|
|
13
|
+
*/
|
|
4
14
|
export declare function Checkbox({ className, ...props }: CheckboxProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
2
|
import { type ButtonProps as BaseButtonProps } from '@base-ui/react/button';
|
|
3
3
|
import { Toggle } from '@base-ui/react/toggle';
|
|
4
4
|
import type { MaterialSymbol } from 'material-symbols';
|
|
@@ -7,8 +7,22 @@ export type ChipProps = BaseButtonProps & {
|
|
|
7
7
|
/** Material Symbol before the label. */
|
|
8
8
|
startIcon?: MaterialSymbol;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* A compact button for suggestions and quick actions. For on/off filters
|
|
12
|
+
* use `FilterChip`; for removable values (tags) use `InputChip`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <Chip startIcon="event" onClick={addToCalendar}>Add to calendar</Chip>
|
|
16
|
+
*/
|
|
10
17
|
export declare function Chip({ startIcon, className, children, ...props }: ChipProps): import("react").JSX.Element;
|
|
11
18
|
export type FilterChipProps = Toggle.Props;
|
|
19
|
+
/**
|
|
20
|
+
* A chip that toggles on and off, showing a checkmark while on. State:
|
|
21
|
+
* `pressed` / `defaultPressed` / `onPressedChange`.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* <FilterChip pressed={vegan} onPressedChange={setVegan}>Vegan</FilterChip>
|
|
25
|
+
*/
|
|
12
26
|
export declare function FilterChip({ className, children, ...props }: FilterChipProps): import("react").JSX.Element;
|
|
13
27
|
export type InputChipProps = ComponentProps<'span'> & {
|
|
14
28
|
/** Called when the remove (×) button is clicked. */
|
|
@@ -20,4 +34,13 @@ export type InputChipProps = ComponentProps<'span'> & {
|
|
|
20
34
|
/** Disables the remove button and dims the chip. */
|
|
21
35
|
disabled?: boolean;
|
|
22
36
|
};
|
|
23
|
-
|
|
37
|
+
/**
|
|
38
|
+
* A removable value, like a tag or recipient. Plays an exit animation, then
|
|
39
|
+
* calls `onRemove`: remove it from your list there.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* {tags.map((t) => (
|
|
43
|
+
* <InputChip key={t} removeLabel={`Remove ${t}`} onRemove={() => setTags(tags.filter((x) => x !== t))}>{t}</InputChip>
|
|
44
|
+
* ))}
|
|
45
|
+
*/
|
|
46
|
+
export declare function InputChip({ onRemove, removeLabel, startIcon, disabled, className, ref, children, ...props }: InputChipProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { Combobox as BaseCombobox } from '@base-ui/react/combobox';
|
|
3
|
+
import '../Input/input.css';
|
|
4
|
+
import '../Menu/menu.css';
|
|
5
|
+
import '../Select/select.css';
|
|
6
|
+
import './combobox.css';
|
|
7
|
+
export type ComboboxProps<Item> = Omit<BaseCombobox.Root.Props<Item>, 'children' | 'items'> & {
|
|
8
|
+
/** The options. Filtered against what's typed. */
|
|
9
|
+
items?: readonly Item[];
|
|
10
|
+
/** Renders each option, e.g. `(item) => <ComboboxItem key={item} value={item}>{item}</ComboboxItem>`. */
|
|
11
|
+
children: (item: Item, index: number) => ReactNode;
|
|
12
|
+
/** Floating label. Sits inside the field and moves onto the border once it has focus or a value. */
|
|
13
|
+
label?: ReactNode;
|
|
14
|
+
/** Hint text inside the field. With a `label`, only once the label has moved up. */
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/** Shown in the popup when nothing matches. Without it, the popup hides. */
|
|
17
|
+
empty?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* `small` is shorter, and its label works like a placeholder: it hides
|
|
20
|
+
* once there's text instead of moving onto the border. @default 'normal'
|
|
21
|
+
*/
|
|
22
|
+
size?: 'small' | 'normal';
|
|
23
|
+
/** Applied to the outer wrapper, so width and margins work as expected. */
|
|
24
|
+
className?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A text field that filters a list of options as you type, and picks one.
|
|
28
|
+
* The picked option is `value` / `defaultValue` / `onValueChange`. For
|
|
29
|
+
* object items, pass `itemToStringLabel` so the field shows a readable label.
|
|
30
|
+
* Children must be a function that renders one item.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* <Combobox label="Country" items={countries} empty="No matches">
|
|
34
|
+
* {(country: string) => (
|
|
35
|
+
* <ComboboxItem key={country} value={country}>{country}</ComboboxItem>
|
|
36
|
+
* )}
|
|
37
|
+
* </Combobox>
|
|
38
|
+
*/
|
|
39
|
+
export declare function Combobox<Item>({ children, label, placeholder, empty, size, className, ...props }: ComboboxProps<Item>): import("react").JSX.Element;
|
|
40
|
+
export type ComboboxItemProps = BaseCombobox.Item.Props;
|
|
41
|
+
/** One option in a `Combobox`. Needs a `value` (the item); children are its label. */
|
|
42
|
+
export declare function ComboboxItem({ className, children, ...props }: ComboboxItemProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ComponentColor } from '../../colors/colors';
|
|
2
|
+
import './confetti.css';
|
|
3
|
+
export type ConfettiOptions = {
|
|
4
|
+
/** How many pieces to throw. @default 80 */
|
|
5
|
+
count?: number;
|
|
6
|
+
/** Direction of the burst in degrees, 0 is straight up. @default 0 */
|
|
7
|
+
angle?: number;
|
|
8
|
+
/** How wide the burst fans out, in degrees. @default 70 */
|
|
9
|
+
spread?: number;
|
|
10
|
+
/** How hard the pieces are thrown. @default 1 */
|
|
11
|
+
power?: number;
|
|
12
|
+
/** Theme color roles the pieces are picked from. @default ['primary', 'tonal', 'success', 'warning', 'error'] */
|
|
13
|
+
colors?: ComponentColor[];
|
|
14
|
+
};
|
|
15
|
+
/** Where the burst starts: an element's center, or a point in the viewport. */
|
|
16
|
+
export type ConfettiOrigin = Element | {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Returns a function that fires a burst of confetti in the theme's colors.
|
|
22
|
+
* Pass the element that triggered it (a button, say) to burst from there.
|
|
23
|
+
* The pieces are decorative: hidden from screen readers, they don't catch
|
|
24
|
+
* the pointer, and nothing fires when the user prefers reduced motion.
|
|
25
|
+
*
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const fire = useConfetti()
|
|
28
|
+
* <Button onClick={(e) => fire(e.currentTarget)}>Celebrate</Button>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function useConfetti(): (origin?: ConfettiOrigin, options?: ConfettiOptions) => void;
|