anvilui 0.1.0 → 0.3.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 +60 -40
- 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 +48 -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 +39 -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 +14 -1
- package/dist/components/Input/Input.d.ts +14 -3
- 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 +33 -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 +12 -2
- package/dist/components/RadioGroup/RadioGroup.d.ts +14 -2
- package/dist/components/Search/Search.d.ts +55 -0
- package/dist/components/Select/Select.d.ts +21 -4
- package/dist/components/Skeleton/Skeleton.d.ts +20 -0
- package/dist/components/Slider/Slider.d.ts +7 -1
- package/dist/components/Snackbar/Snackbar.d.ts +7 -2
- package/dist/components/SplitButton/SplitButton.d.ts +13 -0
- package/dist/components/SquigglyWave/SquigglyWave.d.ts +26 -4
- 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 +14 -3
- package/dist/components/TimePicker/TimePicker.d.ts +47 -0
- package/dist/components/Toggle/Toggle.d.ts +42 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +16 -4
- 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 +3365 -654
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1443 -367
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +50 -4
- package/dist/index.js +3362 -667
- 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 +13 -8
- package/dist/tokens/baseTokens.d.ts +4 -0
- package/dist/tokens/types.d.ts +34 -0
- package/dist/utils.d.ts +4 -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 +73 -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 +42 -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 +55 -0
- package/docs/icons.md +38 -0
- package/docs/input.md +51 -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 +54 -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 +64 -0
- package/docs/search.md +77 -0
- package/docs/select.md +65 -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 +183 -0
- package/docs/time-picker.md +39 -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
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
import { OTPField as BaseOTPField } from '@base-ui/react/otp-field';
|
|
3
|
+
import './pin-input.css';
|
|
4
|
+
export type PinInputProps = Omit<BaseOTPField.Root.Props, 'className' | 'style' | 'children' | 'size'> & {
|
|
5
|
+
/** Applied to the outer wrapper, with `className`. */
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
/** `filled` gives each box a tinted background and a bottom line instead of a full border. @default 'outlined' */
|
|
8
|
+
fillType?: 'filled' | 'outlined';
|
|
9
|
+
/** Boxes are 40px tall instead of 56px. @default 'normal' */
|
|
10
|
+
size?: 'small' | 'normal';
|
|
11
|
+
/** Screen reader name of each box after the first. @default (index, length) => `Character ${index + 1} of ${length}` */
|
|
12
|
+
slotLabel?: (index: number, length: number) => string;
|
|
13
|
+
/** Applied to the outer wrapper, so width and margins work as expected. */
|
|
14
|
+
className?: string;
|
|
15
|
+
} & ({
|
|
16
|
+
/** Visible label above the boxes. */
|
|
17
|
+
label: ReactNode;
|
|
18
|
+
'aria-label'?: never;
|
|
19
|
+
} | {
|
|
20
|
+
label?: undefined;
|
|
21
|
+
/** Without a visible `label`, the field needs a name for screen readers. */
|
|
22
|
+
'aria-label': string;
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* One box per character, for verification codes and PINs. Typing, paste,
|
|
26
|
+
* backspace and arrow keys move between boxes. Digits only by default; set
|
|
27
|
+
* `validationType` for letters. `mask` hides what's typed. `length` is
|
|
28
|
+
* required.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* <PinInput label="Verification code" length={6} onValueChange={setCode} />
|
|
32
|
+
*/
|
|
33
|
+
export declare function PinInput({ label, 'aria-label': ariaLabel, fillType, size, slotLabel, className, style, id, length, ...props }: PinInputProps): import("react").JSX.Element;
|
|
@@ -8,14 +8,42 @@ export type PopoverProps = BasePopover.Root.Props & {
|
|
|
8
8
|
*/
|
|
9
9
|
morph?: boolean;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* A floating panel anchored to its trigger, for content users interact with
|
|
13
|
+
* (forms, details). Holds the open state: `open` / `defaultOpen` /
|
|
14
|
+
* `onOpenChange`. Parts: `PopoverTrigger`, `PopoverPopup` (includes portal
|
|
15
|
+
* and positioner; takes `side` / `align`), `PopoverTitle`,
|
|
16
|
+
* `PopoverDescription`, `PopoverClose`.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <Popover>
|
|
20
|
+
* <PopoverTrigger render={<IconButton icon="info" aria-label="Details" />} />
|
|
21
|
+
* <PopoverPopup side="bottom" align="start">
|
|
22
|
+
* <PopoverTitle>Details</PopoverTitle>
|
|
23
|
+
* <PopoverDescription>Last edited today.</PopoverDescription>
|
|
24
|
+
* </PopoverPopup>
|
|
25
|
+
* </Popover>
|
|
26
|
+
*/
|
|
11
27
|
export declare function Popover({ morph, defaultOpen, ...props }: PopoverProps): import("react").JSX.Element;
|
|
12
28
|
export type PopoverTriggerProps = BasePopover.Trigger.Props;
|
|
29
|
+
/** Opens the popover. Renders a bare `<button>`; pass `render={<Button />}` to use the library's. */
|
|
13
30
|
export declare function PopoverTrigger({ className, ref, ...props }: PopoverTriggerProps): import("react").JSX.Element;
|
|
14
|
-
|
|
15
|
-
export
|
|
31
|
+
/** The panel. Also renders the portal and positioner, so it takes their placement props. */
|
|
32
|
+
export type PopoverPopupProps = BasePopover.Popup.Props & Pick<BasePopover.Positioner.Props, 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'>;
|
|
33
|
+
/** The panel. Takes `side`, `align`, `sideOffset`, `alignOffset` and `anchor`. */
|
|
34
|
+
export declare function PopoverPopup({ anchor, side, align, sideOffset, alignOffset, className, ref, ...props }: PopoverPopupProps): import("react").JSX.Element;
|
|
16
35
|
export type PopoverTitleProps = BasePopover.Title.Props;
|
|
36
|
+
/**
|
|
37
|
+
* Names the popup for screen readers. Renders an `<h2>`; pass
|
|
38
|
+
* `render={<h3 />}` (or another level) to fit the page's headings.
|
|
39
|
+
*/
|
|
17
40
|
export declare function PopoverTitle({ className, ...props }: PopoverTitleProps): import("react").JSX.Element;
|
|
18
41
|
export type PopoverDescriptionProps = BasePopover.Description.Props;
|
|
42
|
+
/** Supporting text in the popover. */
|
|
19
43
|
export declare function PopoverDescription({ className, ...props }: PopoverDescriptionProps): import("react").JSX.Element;
|
|
20
44
|
export type PopoverCloseProps = BasePopover.Close.Props;
|
|
45
|
+
/**
|
|
46
|
+
* Closes the popover. Renders a bare `<button>`; pass `render={<Button />}`
|
|
47
|
+
* or `render={<IconButton ... />}` to use the library's.
|
|
48
|
+
*/
|
|
21
49
|
export declare function PopoverClose({ className, ...props }: PopoverCloseProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PreviewCard as BasePreviewCard } from '@base-ui/react/preview-card';
|
|
2
|
+
import '../Menu/menu.css';
|
|
3
|
+
import '../Popover/popover.css';
|
|
4
|
+
import './preview-card.css';
|
|
5
|
+
/**
|
|
6
|
+
* A card that appears while hovering or focusing a link, showing a preview of
|
|
7
|
+
* where it goes. Put a `PreviewCardTrigger` and a `PreviewCardPopup` inside.
|
|
8
|
+
* Hover-only, so the popup must not hold anything a user needs to reach;
|
|
9
|
+
* use `Popover` for that.
|
|
10
|
+
*/
|
|
11
|
+
export type PreviewCardProps = BasePreviewCard.Root.Props;
|
|
12
|
+
/**
|
|
13
|
+
* A card shown while hovering or focusing a link. Use `Popover` if the
|
|
14
|
+
* content has anything to click.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <PreviewCard>
|
|
18
|
+
* <PreviewCardTrigger href="/users/ada">@ada</PreviewCardTrigger>
|
|
19
|
+
* <PreviewCardPopup>Ada Lovelace, 12 posts</PreviewCardPopup>
|
|
20
|
+
* </PreviewCard>
|
|
21
|
+
*/
|
|
22
|
+
export declare function PreviewCard(props: PreviewCardProps): import("react").JSX.Element;
|
|
23
|
+
export type PreviewCardTriggerProps = BasePreviewCard.Trigger.Props;
|
|
24
|
+
/**
|
|
25
|
+
* The link. Renders an `<a>`, so give it `href`; pass `render={<Link />}`
|
|
26
|
+
* for a router link. `delay` / `closeDelay` set the hover timing.
|
|
27
|
+
*/
|
|
28
|
+
export declare function PreviewCardTrigger({ className, ...props }: PreviewCardTriggerProps): import("react").JSX.Element;
|
|
29
|
+
export type PreviewCardPopupProps = BasePreviewCard.Popup.Props & Pick<BasePreviewCard.Positioner.Props, 'side' | 'align' | 'sideOffset' | 'alignOffset'>;
|
|
30
|
+
/** The card. Also renders the portal and positioner; takes `side` / `align`. */
|
|
31
|
+
export declare function PreviewCardPopup({ side, align, sideOffset, alignOffset, className, ...props }: PreviewCardPopupProps): import("react").JSX.Element;
|
|
@@ -7,7 +7,10 @@ export type ProgressProps = BaseProgress.Root.Props & {
|
|
|
7
7
|
* place inside a line of text. @default 'linear'
|
|
8
8
|
*/
|
|
9
9
|
type?: 'linear' | 'circular' | 'inline';
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Draw the filled part of a linear bar as a moving wave. Changing it
|
|
12
|
+
* animates between the wave and the plain bar. @default false
|
|
13
|
+
*/
|
|
11
14
|
squiggly?: boolean;
|
|
12
15
|
} & ({
|
|
13
16
|
/** Visible label above the indicator. */
|
|
@@ -18,5 +21,12 @@ export type ProgressProps = BaseProgress.Root.Props & {
|
|
|
18
21
|
/** Accessible name, when there's no visible `label`. */
|
|
19
22
|
'aria-label': string;
|
|
20
23
|
});
|
|
21
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Shows how far along a task is: `value` from 0 to 100 (or `min`/`max`).
|
|
26
|
+
* Pass `value={null}` while the amount of work is unknown.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* <Progress label="Uploading" value={progress} />
|
|
30
|
+
* <Progress type="circular" aria-label="Loading" value={null} />
|
|
31
|
+
*/
|
|
22
32
|
export declare function Progress({ type, squiggly, label, className, style, children, ...props }: ProgressProps): import("react").JSX.Element;
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { Radio as BaseRadio } from '@base-ui/react/radio';
|
|
2
2
|
import { RadioGroup as BaseRadioGroup } from '@base-ui/react/radio-group';
|
|
3
3
|
import './radio-group.css';
|
|
4
|
-
export type RadioGroupProps<Value =
|
|
4
|
+
export type RadioGroupProps<Value = unknown> = BaseRadioGroup.Props<Value>;
|
|
5
|
+
/**
|
|
6
|
+
* A group of `Radio`s where exactly one is picked. State: `value` /
|
|
7
|
+
* `defaultValue` / `onValueChange` on the group; each `Radio` has a `value`.
|
|
8
|
+
* Give the group an `aria-label` or `aria-labelledby`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <RadioGroup aria-label="Plan" defaultValue="free">
|
|
12
|
+
* <label><Radio value="free" /> Free</label>
|
|
13
|
+
* <label><Radio value="pro" /> Pro</label>
|
|
14
|
+
* </RadioGroup>
|
|
15
|
+
*/
|
|
5
16
|
export declare function RadioGroup<Value>({ className, ...props }: RadioGroupProps<Value>): import("react").JSX.Element;
|
|
6
|
-
export type RadioProps<Value =
|
|
17
|
+
export type RadioProps<Value = unknown> = BaseRadio.Root.Props<Value>;
|
|
18
|
+
/** One option in a `RadioGroup`. Needs a `value`. Wrap it in a `<label>` with its text. */
|
|
7
19
|
export declare function Radio<Value>({ className, ...props }: RadioProps<Value>): import("react").JSX.Element;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode, type Ref } from 'react';
|
|
2
|
+
import { Autocomplete as BaseAutocomplete } from '@base-ui/react/autocomplete';
|
|
3
|
+
import type { MaterialSymbol } from 'material-symbols';
|
|
4
|
+
import '../Menu/menu.css';
|
|
5
|
+
import './search.css';
|
|
6
|
+
export type SearchProps<Item> = Omit<BaseAutocomplete.Root.Props<Item>, 'children' | 'items'> & {
|
|
7
|
+
/** The suggestions. Filtered against what's typed. */
|
|
8
|
+
items?: readonly Item[];
|
|
9
|
+
/**
|
|
10
|
+
* Renders each suggestion, e.g. `(item) => <SearchItem key={item} value={item}>{item}</SearchItem>`.
|
|
11
|
+
* Leave it out for a plain search bar with no suggestion list.
|
|
12
|
+
*/
|
|
13
|
+
children?: (item: Item, index: number) => ReactNode;
|
|
14
|
+
/** Hint text inside the bar, e.g. "Search mail". */
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/** There's no visible label, so the input needs a name for screen readers. */
|
|
17
|
+
'aria-label': string;
|
|
18
|
+
/** Shown in the popup when nothing matches. Without it, the popup hides. */
|
|
19
|
+
empty?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* The bar's background. Use `'container'` when the bar sits on a
|
|
22
|
+
* `surface` panel, like a navigation drawer, so it doesn't blend in.
|
|
23
|
+
* @default 'surface'
|
|
24
|
+
*/
|
|
25
|
+
color?: 'surface' | 'container';
|
|
26
|
+
/** Accessible name of the clear button. @default 'Clear' */
|
|
27
|
+
clearLabel?: string;
|
|
28
|
+
/** Applied to the bar, so width and margins work as expected. */
|
|
29
|
+
className?: string;
|
|
30
|
+
/** Applied to the bar, with `className`. */
|
|
31
|
+
style?: CSSProperties;
|
|
32
|
+
/** The text `<input>`. */
|
|
33
|
+
ref?: Ref<HTMLInputElement>;
|
|
34
|
+
/** The text `<input>`'s id. */
|
|
35
|
+
id?: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Material 3 search bar with a list of suggestions under it. Pass `items`
|
|
39
|
+
* and it filters them as you type. The typed text is `value` /
|
|
40
|
+
* `defaultValue` / `onValueChange`. Children are a function that renders one
|
|
41
|
+
* suggestion; without them it's a plain search bar that never opens a list.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* <Search aria-label="Filter people" value={query} onValueChange={setQuery} />
|
|
45
|
+
* <Search aria-label="Search mail" placeholder="Search mail" items={recent} value={query} onValueChange={setQuery}>
|
|
46
|
+
* {(item: string) => <SearchItem key={item} value={item} startIcon="history">{item}</SearchItem>}
|
|
47
|
+
* </Search>
|
|
48
|
+
*/
|
|
49
|
+
export declare function Search<Item>({ children, placeholder, 'aria-label': ariaLabel, empty, color, clearLabel, className, style, ref, id, ...allProps }: SearchProps<Item>): import("react").JSX.Element;
|
|
50
|
+
export type SearchItemProps = BaseAutocomplete.Item.Props & {
|
|
51
|
+
/** Material Symbol before the text, e.g. `history` for a recent search. */
|
|
52
|
+
startIcon?: MaterialSymbol;
|
|
53
|
+
};
|
|
54
|
+
/** One suggestion in a `Search`. Needs a `value`. Picking it fills the bar with its text. */
|
|
55
|
+
export declare function SearchItem({ startIcon, className, children, ...props }: SearchItemProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
1
|
+
import { type CSSProperties, type ReactNode, type Ref } from 'react';
|
|
2
2
|
import { Select as BaseSelect } from '@base-ui/react/select';
|
|
3
3
|
import '../Input/input.css';
|
|
4
4
|
import '../Menu/menu.css';
|
|
@@ -15,11 +15,28 @@ export type SelectProps<Value, Multiple extends boolean | undefined = false> = B
|
|
|
15
15
|
size?: 'small' | 'normal';
|
|
16
16
|
/** Applied to the outer wrapper, so width and margins work as expected. */
|
|
17
17
|
className?: string;
|
|
18
|
+
/** Applied to the outer wrapper, with `className`. */
|
|
19
|
+
style?: CSSProperties;
|
|
20
|
+
/** The field's button (the part that opens the list). */
|
|
21
|
+
ref?: Ref<HTMLButtonElement>;
|
|
18
22
|
};
|
|
19
23
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
24
|
+
* A dropdown to pick one option (or several, with `multiple`). Put
|
|
25
|
+
* `SelectItem`s inside. Pass `items` (value → label) so the field shows the
|
|
26
|
+
* selected item's label rather than its raw value. `onValueChange` gets the
|
|
27
|
+
* value, not an event. Other props go to Base UI's `Select.Root`, which
|
|
28
|
+
* renders no element: use `className` for styling the field.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* const fruits = { apple: 'Apple', banana: 'Banana' }
|
|
32
|
+
*
|
|
33
|
+
* <Select label="Fruit" items={fruits} value={fruit} onValueChange={setFruit}>
|
|
34
|
+
* {Object.entries(fruits).map(([value, label]) => (
|
|
35
|
+
* <SelectItem key={value} value={value}>{label}</SelectItem>
|
|
36
|
+
* ))}
|
|
37
|
+
* </Select>
|
|
22
38
|
*/
|
|
23
|
-
export declare function Select<Value, Multiple extends boolean | undefined = false>({ label, placeholder, size, className, children, ...
|
|
39
|
+
export declare function Select<Value, Multiple extends boolean | undefined = false>({ label, placeholder, size, className, style, ref, children, ...allProps }: SelectProps<Value, Multiple>): import("react").JSX.Element;
|
|
24
40
|
export type SelectItemProps = BaseSelect.Item.Props;
|
|
41
|
+
/** One option in a `Select`. Needs a `value`; children are its label. */
|
|
25
42
|
export declare function SelectItem({ className, children, ...props }: SelectItemProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import './skeleton.css';
|
|
2
|
+
export type SkeletonProps = React.ComponentProps<'span'> & {
|
|
3
|
+
/**
|
|
4
|
+
* Shape of the placeholder: a line of text, a circle (avatars, icons) or
|
|
5
|
+
* a rounded box (images, cards). Set the size with `style`.
|
|
6
|
+
* @default 'text'
|
|
7
|
+
*/
|
|
8
|
+
variant?: 'text' | 'circular' | 'rectangular';
|
|
9
|
+
/** Fades in and out while loading. @default 'pulse' */
|
|
10
|
+
animation?: 'pulse' | 'none';
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A placeholder shown while content loads. It's hidden from screen readers:
|
|
14
|
+
* put `aria-busy` on the region that's loading.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <Skeleton variant="circular" style={{ width: 40, height: 40 }} />
|
|
18
|
+
* <Skeleton style={{ width: '60%' }} />
|
|
19
|
+
*/
|
|
20
|
+
export declare function Skeleton({ variant, animation, className, ...props }: SkeletonProps): import("react").JSX.Element;
|
|
@@ -7,7 +7,8 @@ export type SliderProps<Value extends number | readonly number[] = number | read
|
|
|
7
7
|
showValue?: boolean;
|
|
8
8
|
/**
|
|
9
9
|
* Thin track with the selected part drawn as a moving wave, like a
|
|
10
|
-
* squiggly `Progress`. Horizontal only.
|
|
10
|
+
* squiggly `Progress`. Horizontal only. Changing it animates between the
|
|
11
|
+
* wave and the plain track, e.g. `squiggly={playing}`. @default false
|
|
11
12
|
*/
|
|
12
13
|
squiggly?: boolean;
|
|
13
14
|
} & ({
|
|
@@ -22,5 +23,10 @@ export type SliderProps<Value extends number | readonly number[] = number | read
|
|
|
22
23
|
/**
|
|
23
24
|
* Pass an array as `value` / `defaultValue` for a range with several handles.
|
|
24
25
|
* `orientation="vertical"` is 160px tall by default; set a height via `className`.
|
|
26
|
+
* `onValueChange` gets a number (or an array for a range), not an event.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* <Slider label="Volume" defaultValue={50} />
|
|
30
|
+
* <Slider aria-label="Price" value={range} onValueChange={setRange} min={0} max={500} />
|
|
25
31
|
*/
|
|
26
32
|
export declare function Slider<Value extends number | readonly number[]>({ label, 'aria-label': ariaLabel, showValue, squiggly, className, ...props }: SliderProps<Value>): import("react").JSX.Element;
|
|
@@ -18,8 +18,13 @@ export type SnackbarOptions = {
|
|
|
18
18
|
onClose?: () => void;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
|
-
* Shows snackbars
|
|
22
|
-
*
|
|
21
|
+
* Shows snackbars (toasts). There is no Snackbar or Toast component to
|
|
22
|
+
* render: AnvilRoot already renders the viewport. Works anywhere inside
|
|
23
|
+
* `AnvilRoot`.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const snackbar = useSnackbar()
|
|
27
|
+
* snackbar.show({ message: 'Deleted', action: { label: 'Undo', onClick: undo } })
|
|
23
28
|
*/
|
|
24
29
|
export declare function useSnackbar(): {
|
|
25
30
|
/** Shows a snackbar at the bottom; open ones move up. Returns its id. */
|
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
import './split-button.css';
|
|
2
2
|
export type SplitButtonProps = React.ComponentProps<'div'>;
|
|
3
|
+
/**
|
|
4
|
+
* Joins `Button`s (and `IconButton`s) into one segmented group with shared
|
|
5
|
+
* rounded ends. Style each button yourself; the group only lays them out.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <SplitButton>
|
|
9
|
+
* <Button>Save</Button>
|
|
10
|
+
* <Menu>
|
|
11
|
+
* <MenuTrigger render={<IconButton icon="arrow_drop_down" aria-label="More save options" />} />
|
|
12
|
+
* <MenuPopup>...</MenuPopup>
|
|
13
|
+
* </Menu>
|
|
14
|
+
* </SplitButton>
|
|
15
|
+
*/
|
|
3
16
|
export declare function SplitButton({ className, ...props }: SplitButtonProps): import("react").JSX.Element;
|
|
@@ -8,8 +8,6 @@ export type WaveSpan = {
|
|
|
8
8
|
rest?: [number, number][];
|
|
9
9
|
/** Draw the `rest` pieces as waves in step with the main one, not flat. */
|
|
10
10
|
restWave?: boolean;
|
|
11
|
-
/** Draw the stop dot at the far end. */
|
|
12
|
-
dot?: boolean;
|
|
13
11
|
/** Jump straight to `from`/`to` instead of easing toward them. */
|
|
14
12
|
snap?: boolean;
|
|
15
13
|
};
|
|
@@ -27,10 +25,34 @@ export type SquigglyWaveProps = {
|
|
|
27
25
|
still?: boolean;
|
|
28
26
|
/** Run top to bottom instead of left to right. @default false */
|
|
29
27
|
vertical?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Ease into a straight line as thick as `--avl-wave-flat-stroke`, ready
|
|
30
|
+
* to be swapped for the plain track. Needs `still` off. @default false
|
|
31
|
+
*/
|
|
32
|
+
flat?: boolean;
|
|
33
|
+
/** Start out flat, to ease into a wave from the plain track. */
|
|
34
|
+
startFlat?: boolean;
|
|
35
|
+
/** Called once the wave has gone fully flat. */
|
|
36
|
+
onFlat?: () => void;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Keeps a squiggly part's wave mounted while it flattens out, so turning
|
|
40
|
+
* `squiggly` off eases into the plain track instead of jumping, and turning
|
|
41
|
+
* it on eases out of it. Spread `wave` onto SquigglyWave, and draw the plain
|
|
42
|
+
* track when `show` is false.
|
|
43
|
+
*/
|
|
44
|
+
export declare function useWaveMorph(squiggly: boolean): {
|
|
45
|
+
show: boolean;
|
|
46
|
+
wave: {
|
|
47
|
+
flat: boolean;
|
|
48
|
+
startFlat: boolean;
|
|
49
|
+
onFlat: () => void;
|
|
50
|
+
};
|
|
30
51
|
};
|
|
31
52
|
/**
|
|
32
53
|
* One continuous wave drawn to an exact length, so it has no seams and gets
|
|
33
|
-
* round ends. Redrawn every frame to ripple
|
|
34
|
-
* with reduced motion it holds still and
|
|
54
|
+
* round ends. Redrawn every frame to ripple, to ease toward its new span and
|
|
55
|
+
* to flatten out or back (`flat`); with reduced motion it holds still and
|
|
56
|
+
* jumps.
|
|
35
57
|
*/
|
|
36
58
|
export declare function SquigglyWave(props: SquigglyWaveProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import type { MaterialSymbol } from 'material-symbols';
|
|
3
|
+
import { type ComponentColor } from '../../colors/colors';
|
|
4
|
+
import './sticker.css';
|
|
5
|
+
export type StickerProps = ComponentProps<'span'> & {
|
|
6
|
+
/** Color role from the theme. @default 'primary' */
|
|
7
|
+
color?: ComponentColor;
|
|
8
|
+
/** Material Symbol before the text. */
|
|
9
|
+
startIcon?: MaterialSymbol;
|
|
10
|
+
/** How far it's tilted, in degrees. Negative leans left. @default -4 */
|
|
11
|
+
tilt?: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A small tilted label that looks like a die-cut sticker ("NEW", "BETA",
|
|
15
|
+
* "50% off"). Straightens up on hover. Purely visual: its text is read
|
|
16
|
+
* like any other text.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <Sticker color="warning" startIcon="bolt">NEW</Sticker>
|
|
20
|
+
*/
|
|
21
|
+
export declare function Sticker({ color, startIcon, tilt, className, style, children, ...props }: StickerProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { Switch as BaseSwitch } from '@base-ui/react/switch';
|
|
2
2
|
import './switch.css';
|
|
3
3
|
export type SwitchProps = BaseSwitch.Root.Props;
|
|
4
|
+
/**
|
|
5
|
+
* An on/off switch. State: `checked` / `defaultChecked` / `onCheckedChange`.
|
|
6
|
+
* It has no `label` prop: wrap it in a `<label>`, or put it in a `ListItem`'s
|
|
7
|
+
* `end` with `render={<label />}`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <label style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
|
|
11
|
+
* <Switch checked={wifi} onCheckedChange={setWifi} />
|
|
12
|
+
* Wi-Fi
|
|
13
|
+
* </label>
|
|
14
|
+
*/
|
|
4
15
|
export declare function Switch({ className, ...props }: SwitchProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import './table.css';
|
|
2
|
+
export type TableProps = React.ComponentProps<'table'>;
|
|
3
|
+
/**
|
|
4
|
+
* A styled HTML table. Each part renders its native element (`TableHead` is
|
|
5
|
+
* `<thead>`, `TableHeaderCell` is `<th>`), so it has no sorting or paging.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <Table>
|
|
9
|
+
* <TableCaption>Invoices</TableCaption>
|
|
10
|
+
* <TableHead>
|
|
11
|
+
* <TableRow><TableHeaderCell>Number</TableHeaderCell><TableHeaderCell>Total</TableHeaderCell></TableRow>
|
|
12
|
+
* </TableHead>
|
|
13
|
+
* <TableBody>
|
|
14
|
+
* <TableRow><TableCell>#1001</TableCell><TableCell>$40</TableCell></TableRow>
|
|
15
|
+
* </TableBody>
|
|
16
|
+
* </Table>
|
|
17
|
+
*/
|
|
18
|
+
export declare function Table({ className, ...props }: TableProps): import("react").JSX.Element;
|
|
19
|
+
export type TableCaptionProps = React.ComponentProps<'caption'>;
|
|
20
|
+
/** The table's accessible name. Without one, give `Table` an `aria-label`. */
|
|
21
|
+
export declare function TableCaption({ className, ...props }: TableCaptionProps): import("react").JSX.Element;
|
|
22
|
+
export type TableHeadProps = React.ComponentProps<'thead'>;
|
|
23
|
+
/** `<thead>`: the header rows. */
|
|
24
|
+
export declare function TableHead({ className, ...props }: TableHeadProps): import("react").JSX.Element;
|
|
25
|
+
export type TableBodyProps = React.ComponentProps<'tbody'>;
|
|
26
|
+
/** `<tbody>`: the data rows. */
|
|
27
|
+
export declare function TableBody({ className, ...props }: TableBodyProps): import("react").JSX.Element;
|
|
28
|
+
export type TableRowProps = React.ComponentProps<'tr'>;
|
|
29
|
+
/** `<tr>`. */
|
|
30
|
+
export declare function TableRow({ className, ...props }: TableRowProps): import("react").JSX.Element;
|
|
31
|
+
export type TableHeaderCellProps = React.ComponentProps<'th'>;
|
|
32
|
+
/** `<th>`, with `scope="col"` by default; pass `scope="row"` for a header at the start of a row. */
|
|
33
|
+
export declare function TableHeaderCell({ scope, className, ...props }: TableHeaderCellProps): import("react").JSX.Element;
|
|
34
|
+
export type TableCellProps = React.ComponentProps<'td'>;
|
|
35
|
+
/** `<td>`. */
|
|
36
|
+
export declare function TableCell({ className, ...props }: TableCellProps): import("react").JSX.Element;
|
|
@@ -3,13 +3,30 @@ import type { MaterialSymbol } from 'material-symbols';
|
|
|
3
3
|
import './tabs.css';
|
|
4
4
|
/** Holds the selected tab: `value` / `defaultValue` / `onValueChange`. Horizontal only. */
|
|
5
5
|
export type TabsProps = Omit<BaseTabs.Root.Props, 'orientation'>;
|
|
6
|
+
/**
|
|
7
|
+
* Tabs. Put a `TabsList` of `TabsTab`s, then one `TabsPanel` per tab with
|
|
8
|
+
* the same `value`. There is no TabsTrigger or TabsContent.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <Tabs defaultValue="account">
|
|
12
|
+
* <TabsList>
|
|
13
|
+
* <TabsTab value="account">Account</TabsTab>
|
|
14
|
+
* <TabsTab value="billing">Billing</TabsTab>
|
|
15
|
+
* </TabsList>
|
|
16
|
+
* <TabsPanel value="account">...</TabsPanel>
|
|
17
|
+
* <TabsPanel value="billing">...</TabsPanel>
|
|
18
|
+
* </Tabs>
|
|
19
|
+
*/
|
|
6
20
|
export declare function Tabs({ className, ...props }: TabsProps): import("react").JSX.Element;
|
|
7
21
|
export type TabsListProps = BaseTabs.List.Props;
|
|
22
|
+
/** The row of tabs. Draws the sliding underline under the selected one. */
|
|
8
23
|
export declare function TabsList({ className, children, ...props }: TabsListProps): import("react").JSX.Element;
|
|
9
24
|
export type TabsTabProps = BaseTabs.Tab.Props & {
|
|
10
25
|
/** Material Symbol shown above the label. */
|
|
11
26
|
icon?: MaterialSymbol;
|
|
12
27
|
};
|
|
28
|
+
/** One tab button. Give it a `value` matching its `TabsPanel`. */
|
|
13
29
|
export declare function TabsTab({ icon, className, children, ...props }: TabsTabProps): import("react").JSX.Element;
|
|
14
30
|
export type TabsPanelProps = BaseTabs.Panel.Props;
|
|
31
|
+
/** Content for one tab: give it the same `value` as its `TabsTab`. */
|
|
15
32
|
export declare function TabsPanel({ className, ...props }: TabsPanelProps): import("react").JSX.Element;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { ComponentProps, ReactNode } from 'react';
|
|
1
|
+
import type { ComponentProps, CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { Input as BaseInput } from '@base-ui/react/input';
|
|
3
3
|
import '../Input/input.css';
|
|
4
4
|
import './textarea.css';
|
|
5
|
-
export type TextareaProps = Omit<ComponentProps<'textarea'>, 'className'
|
|
5
|
+
export type TextareaProps = Omit<ComponentProps<'textarea'>, 'className' | 'style'> & {
|
|
6
|
+
/** Applied to the outer wrapper, with `className`. */
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
} & Pick<BaseInput.Props, 'onValueChange'> & {
|
|
6
9
|
/** Floating label. Sits on the first line and moves onto the border once it has focus or a value. */
|
|
7
10
|
label?: ReactNode;
|
|
8
11
|
/**
|
|
@@ -13,4 +16,12 @@ export type TextareaProps = Omit<ComponentProps<'textarea'>, 'className'> & Pick
|
|
|
13
16
|
/** Applied to the outer wrapper, so width and margins work as expected. */
|
|
14
17
|
className?: string;
|
|
15
18
|
};
|
|
16
|
-
|
|
19
|
+
/**
|
|
20
|
+
* A multi-line text field with a floating label. Same API as `Input`:
|
|
21
|
+
* `onChange` (event) or `onValueChange` (string); `className` goes on the
|
|
22
|
+
* wrapper, other props on the `<textarea>`.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* <Textarea label="Bio" rows={4} defaultValue="" />
|
|
26
|
+
*/
|
|
27
|
+
export declare function Textarea({ label, size, className, style, placeholder, ...props }: TextareaProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type ReactNode, type Ref } from 'react';
|
|
2
|
+
import { type PopoverProps } from '../Popover/Popover';
|
|
3
|
+
import '../Input/input.css';
|
|
4
|
+
import '../Select/select.css';
|
|
5
|
+
import './time-picker.css';
|
|
6
|
+
export type TimePickerProps = Omit<React.ComponentProps<'div'>, 'children' | 'defaultValue' | 'ref'> & Pick<PopoverProps, 'open' | 'defaultOpen' | 'onOpenChange'> & {
|
|
7
|
+
/**
|
|
8
|
+
* `dial`: tap or drag a clock face, hour then minute.
|
|
9
|
+
* `input`: type into the hour and minute boxes. @default 'dial'
|
|
10
|
+
*/
|
|
11
|
+
type?: 'dial' | 'input';
|
|
12
|
+
/** The time as 24-hour `"HH:mm"` (like `<input type="time">`), or `null` for none. */
|
|
13
|
+
value?: string | null;
|
|
14
|
+
/** Starting time when `value` isn't controlled. @default null */
|
|
15
|
+
defaultValue?: string | null;
|
|
16
|
+
/** Called with the new `"HH:mm"` on every change, or `null` once it's cleared. */
|
|
17
|
+
onValueChange?: (value: string | null) => void;
|
|
18
|
+
/** 12 shows AM/PM. @default the user's locale */
|
|
19
|
+
hourCycle?: 12 | 24;
|
|
20
|
+
/** @default false */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* `small` is shorter, and its label works like a placeholder: it hides
|
|
24
|
+
* once a time is picked. @default 'normal'
|
|
25
|
+
*/
|
|
26
|
+
size?: 'small' | 'normal';
|
|
27
|
+
/** Submits the value with a form, as `"HH:mm"`. */
|
|
28
|
+
name?: string;
|
|
29
|
+
/** The field's button (the part that opens the picker). */
|
|
30
|
+
ref?: Ref<HTMLButtonElement>;
|
|
31
|
+
} & ({
|
|
32
|
+
/** Floating label, like Input's. */
|
|
33
|
+
label: ReactNode;
|
|
34
|
+
'aria-label'?: never;
|
|
35
|
+
} | {
|
|
36
|
+
label?: undefined;
|
|
37
|
+
/** Without a visible `label`, the field needs a name for screen readers. */
|
|
38
|
+
'aria-label': string;
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* A field that opens a Material 3 time picker. The value is a 24-hour
|
|
42
|
+
* `"HH:mm"` string, the same format as `<input type="time">`.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* <TimePicker label="Alarm" defaultValue="07:30" onValueChange={setTime} />
|
|
46
|
+
*/
|
|
47
|
+
export declare function TimePicker({ type, value: valueProp, defaultValue, onValueChange, hourCycle, label, 'aria-label': ariaLabel, disabled, size, name, open, defaultOpen, onOpenChange, className, ref, id, ...allProps }: TimePickerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Toggle as BaseToggle } from '@base-ui/react/toggle';
|
|
3
|
+
import type { MaterialSymbol } from 'material-symbols';
|
|
4
|
+
import { type ColorProps } from '../../colors/colors';
|
|
5
|
+
import '../Button/button.css';
|
|
6
|
+
import '../IconButton/icon-button.css';
|
|
7
|
+
import './toggle.css';
|
|
8
|
+
export type ToggleProps = Omit<BaseToggle.Props, 'children'> & ColorProps & {
|
|
9
|
+
/**
|
|
10
|
+
* Off, it's neutral in this fill type; on, it fills with `color`.
|
|
11
|
+
* @default 'filled'
|
|
12
|
+
*/
|
|
13
|
+
fillType?: ColorProps['fillType'];
|
|
14
|
+
} & ({
|
|
15
|
+
/** The visible label. */
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
/** Material Symbol before the label. */
|
|
18
|
+
startIcon?: MaterialSymbol;
|
|
19
|
+
/** Material Symbol after the label. */
|
|
20
|
+
endIcon?: MaterialSymbol;
|
|
21
|
+
/** Same heights as `Button`. @default 'normal' */
|
|
22
|
+
size?: 'small' | 'normal' | 'big';
|
|
23
|
+
icon?: never;
|
|
24
|
+
} | {
|
|
25
|
+
/** Material Symbol to show: makes it an icon toggle. Filled while on. */
|
|
26
|
+
icon: MaterialSymbol;
|
|
27
|
+
'aria-label': string;
|
|
28
|
+
children?: never;
|
|
29
|
+
startIcon?: never;
|
|
30
|
+
endIcon?: never;
|
|
31
|
+
/** 32px, 40px or 48px, like `IconButton`. @default 'normal' */
|
|
32
|
+
size?: 'small' | 'normal' | 'big';
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* A button that stays on or off, like Bold or Favorite. Holds its state
|
|
36
|
+
* (`pressed` / `defaultPressed` / `onPressedChange`) and sets aria-pressed.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* <Toggle startIcon="format_bold" defaultPressed>Bold</Toggle>
|
|
40
|
+
* <Toggle icon="favorite" aria-label="Favorite" pressed={fav} onPressedChange={setFav} />
|
|
41
|
+
*/
|
|
42
|
+
export declare function Toggle({ icon, startIcon, endIcon, size, color, fillType, children, className, ...props }: ToggleProps): import("react").JSX.Element;
|