@forte-ui/react 1.0.0-alpha.1
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/README.md +240 -0
- package/dist/Accordion-9JunkjgY.js +111 -0
- package/dist/Alert-Cn_WUF3L.js +183 -0
- package/dist/AspectRatio-gSjpTVk-.js +39 -0
- package/dist/Avatar-BuitDluH.js +87 -0
- package/dist/Badge-sArNWMre.js +33 -0
- package/dist/Breadcrumb-Cq7tFtMX.js +170 -0
- package/dist/Button-AiyKnx5I.js +42 -0
- package/dist/ButtonGroup-C-CrwPXP.js +54 -0
- package/dist/Calendar-D7Q-QJ_e.js +503 -0
- package/dist/Checkbox-DfNbmOed.js +56 -0
- package/dist/Collapsible-D8UKiGip.js +86 -0
- package/dist/ColorPicker-B-eCI31W.js +612 -0
- package/dist/Combobox-D-BN-Tvp.js +302 -0
- package/dist/ContextMenu-D81uDaMG.js +44 -0
- package/dist/DatePicker-CfkMsaI-.js +192 -0
- package/dist/Dialog-_n8FpFs5.js +432 -0
- package/dist/Drawer-DKQF3OO7.js +158 -0
- package/dist/Field-FLFEO70D.js +58 -0
- package/dist/Fieldset-CYhh71Qt.js +28 -0
- package/dist/Form-DVPmW9XV.js +17 -0
- package/dist/Input-BgGWhO2q.js +18 -0
- package/dist/InputGroup-DsZyDXNn.js +89 -0
- package/dist/Menu-CKu9xE2h.js +261 -0
- package/dist/Menubar-Dax027Db.js +19 -0
- package/dist/NavList-DGvcIoJm.js +176 -0
- package/dist/NavigationMenu-BayQkUUb.js +209 -0
- package/dist/NumberField-P55SA8T7.js +191 -0
- package/dist/OTPField-CjHvBNSN.js +55 -0
- package/dist/Popover-BXhn2Wwt.js +142 -0
- package/dist/PreviewCard-Dnitrky0.js +99 -0
- package/dist/Progress-BlomDp-X.js +81 -0
- package/dist/ProgressCircle-j6XBl0fk.js +112 -0
- package/dist/Radio-BIcX4INJ.js +37 -0
- package/dist/Resizable-7nJJM97e.js +609 -0
- package/dist/ScrollArea-CBMGJ6hh.js +83 -0
- package/dist/Select-BP-zvdXm.js +237 -0
- package/dist/Separator-DewJBzaJ.js +21 -0
- package/dist/Skeleton-zr6ObCCq.js +79 -0
- package/dist/Slider-Bh8_cti1.js +104 -0
- package/dist/Spinner-BF0uD4hR.js +53 -0
- package/dist/Switch-OBewMMvM.js +39 -0
- package/dist/Tabs-LgkSbPSF.js +132 -0
- package/dist/Textarea-CqZJL41e.js +51 -0
- package/dist/Toast-BWayxAcd.js +304 -0
- package/dist/Toggle-BrhMnkF5.js +45 -0
- package/dist/Toolbar-OmOVCk3i.js +88 -0
- package/dist/Tooltip-CI4chsRw.js +101 -0
- package/dist/clsx-By2n9mTe.js +16 -0
- package/dist/cn.d.ts +8 -0
- package/dist/cn.js +11 -0
- package/dist/components/accordion/Accordion.d.ts +117 -0
- package/dist/components/accordion/Accordion.js +3 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/accordion/index.js +2 -0
- package/dist/components/alert/Alert.d.ts +167 -0
- package/dist/components/alert/Alert.js +3 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +2 -0
- package/dist/components/aspect-ratio/AspectRatio.d.ts +128 -0
- package/dist/components/aspect-ratio/AspectRatio.js +3 -0
- package/dist/components/aspect-ratio/index.d.ts +2 -0
- package/dist/components/aspect-ratio/index.js +2 -0
- package/dist/components/avatar/Avatar.d.ts +176 -0
- package/dist/components/avatar/Avatar.js +3 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +2 -0
- package/dist/components/badge/Badge.d.ts +117 -0
- package/dist/components/badge/Badge.js +3 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +2 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +244 -0
- package/dist/components/breadcrumb/Breadcrumb.js +3 -0
- package/dist/components/breadcrumb/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.js +2 -0
- package/dist/components/button/Button.d.ts +73 -0
- package/dist/components/button/Button.js +3 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +2 -0
- package/dist/components/button-group/ButtonGroup.d.ts +113 -0
- package/dist/components/button-group/ButtonGroup.js +3 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/button-group/index.js +2 -0
- package/dist/components/calendar/Calendar.d.ts +201 -0
- package/dist/components/calendar/Calendar.js +3 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +2 -0
- package/dist/components/checkbox/Checkbox.d.ts +130 -0
- package/dist/components/checkbox/Checkbox.js +3 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +2 -0
- package/dist/components/collapsible/Collapsible.d.ts +91 -0
- package/dist/components/collapsible/Collapsible.js +3 -0
- package/dist/components/collapsible/index.d.ts +2 -0
- package/dist/components/collapsible/index.js +2 -0
- package/dist/components/color-picker/ColorPicker.d.ts +553 -0
- package/dist/components/color-picker/ColorPicker.js +4 -0
- package/dist/components/color-picker/color.d.ts +102 -0
- package/dist/components/color-picker/color.js +249 -0
- package/dist/components/color-picker/index.d.ts +2 -0
- package/dist/components/color-picker/index.js +3 -0
- package/dist/components/combobox/Combobox.d.ts +553 -0
- package/dist/components/combobox/Combobox.js +3 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/combobox/index.js +2 -0
- package/dist/components/context-menu/ContextMenu.d.ts +103 -0
- package/dist/components/context-menu/ContextMenu.js +3 -0
- package/dist/components/context-menu/index.d.ts +3 -0
- package/dist/components/context-menu/index.js +2 -0
- package/dist/components/date-picker/DatePicker.d.ts +268 -0
- package/dist/components/date-picker/DatePicker.js +3 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +2 -0
- package/dist/components/dialog/Dialog.d.ts +567 -0
- package/dist/components/dialog/Dialog.js +3 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/index.js +2 -0
- package/dist/components/drawer/Drawer.d.ts +351 -0
- package/dist/components/drawer/Drawer.js +3 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/drawer/index.js +2 -0
- package/dist/components/field/Field.d.ts +170 -0
- package/dist/components/field/Field.js +3 -0
- package/dist/components/field/index.d.ts +2 -0
- package/dist/components/field/index.js +2 -0
- package/dist/components/fieldset/Fieldset.d.ts +60 -0
- package/dist/components/fieldset/Fieldset.js +3 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/fieldset/index.js +2 -0
- package/dist/components/form/Form.d.ts +76 -0
- package/dist/components/form/Form.js +3 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +2 -0
- package/dist/components/input/Input.d.ts +67 -0
- package/dist/components/input/Input.js +3 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +2 -0
- package/dist/components/input-group/InputGroup.d.ts +214 -0
- package/dist/components/input-group/InputGroup.js +3 -0
- package/dist/components/input-group/index.d.ts +2 -0
- package/dist/components/input-group/index.js +2 -0
- package/dist/components/menu/Menu.d.ts +587 -0
- package/dist/components/menu/Menu.js +3 -0
- package/dist/components/menu/index.d.ts +2 -0
- package/dist/components/menu/index.js +2 -0
- package/dist/components/menubar/Menubar.d.ts +104 -0
- package/dist/components/menubar/Menubar.js +3 -0
- package/dist/components/menubar/index.d.ts +2 -0
- package/dist/components/menubar/index.js +2 -0
- package/dist/components/nav-list/NavList.d.ts +290 -0
- package/dist/components/nav-list/NavList.js +3 -0
- package/dist/components/nav-list/index.d.ts +2 -0
- package/dist/components/nav-list/index.js +2 -0
- package/dist/components/navigation-menu/NavigationMenu.d.ts +483 -0
- package/dist/components/navigation-menu/NavigationMenu.js +3 -0
- package/dist/components/navigation-menu/index.d.ts +2 -0
- package/dist/components/navigation-menu/index.js +2 -0
- package/dist/components/number-field/NumberField.d.ts +303 -0
- package/dist/components/number-field/NumberField.js +3 -0
- package/dist/components/number-field/index.d.ts +2 -0
- package/dist/components/number-field/index.js +2 -0
- package/dist/components/otp-field/OTPField.d.ts +206 -0
- package/dist/components/otp-field/OTPField.js +3 -0
- package/dist/components/otp-field/index.d.ts +2 -0
- package/dist/components/otp-field/index.js +2 -0
- package/dist/components/popover/Popover.d.ts +394 -0
- package/dist/components/popover/Popover.js +3 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.js +2 -0
- package/dist/components/preview-card/PreviewCard.d.ts +307 -0
- package/dist/components/preview-card/PreviewCard.js +3 -0
- package/dist/components/preview-card/index.d.ts +2 -0
- package/dist/components/preview-card/index.js +2 -0
- package/dist/components/progress/Progress.d.ts +156 -0
- package/dist/components/progress/Progress.js +3 -0
- package/dist/components/progress/ProgressCircle.d.ts +166 -0
- package/dist/components/progress/ProgressCircle.js +3 -0
- package/dist/components/progress/index.d.ts +4 -0
- package/dist/components/progress/index.js +3 -0
- package/dist/components/radio/Radio.d.ts +144 -0
- package/dist/components/radio/Radio.js +3 -0
- package/dist/components/radio/index.d.ts +2 -0
- package/dist/components/radio/index.js +2 -0
- package/dist/components/resizable/Resizable.d.ts +211 -0
- package/dist/components/resizable/Resizable.js +3 -0
- package/dist/components/resizable/index.d.ts +2 -0
- package/dist/components/resizable/index.js +2 -0
- package/dist/components/scroll-area/ScrollArea.d.ts +113 -0
- package/dist/components/scroll-area/ScrollArea.js +3 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.js +2 -0
- package/dist/components/select/Select.d.ts +345 -0
- package/dist/components/select/Select.js +3 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +2 -0
- package/dist/components/separator/Separator.d.ts +75 -0
- package/dist/components/separator/Separator.js +3 -0
- package/dist/components/separator/index.d.ts +2 -0
- package/dist/components/separator/index.js +2 -0
- package/dist/components/skeleton/Skeleton.d.ts +169 -0
- package/dist/components/skeleton/Skeleton.js +3 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +2 -0
- package/dist/components/slider/Slider.d.ts +208 -0
- package/dist/components/slider/Slider.js +3 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +2 -0
- package/dist/components/spinner/Spinner.d.ts +92 -0
- package/dist/components/spinner/Spinner.js +3 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/index.js +2 -0
- package/dist/components/switch/Switch.d.ts +80 -0
- package/dist/components/switch/Switch.js +3 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +2 -0
- package/dist/components/tabs/Tabs.d.ts +125 -0
- package/dist/components/tabs/Tabs.js +3 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.js +2 -0
- package/dist/components/textarea/Textarea.d.ts +119 -0
- package/dist/components/textarea/Textarea.js +3 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/index.js +2 -0
- package/dist/components/toast/Toast.d.ts +517 -0
- package/dist/components/toast/Toast.js +3 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/toast/index.js +2 -0
- package/dist/components/toggle/Toggle.d.ts +171 -0
- package/dist/components/toggle/Toggle.js +3 -0
- package/dist/components/toggle/index.d.ts +2 -0
- package/dist/components/toggle/index.js +2 -0
- package/dist/components/toolbar/Toolbar.d.ts +318 -0
- package/dist/components/toolbar/Toolbar.js +3 -0
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/toolbar/index.js +2 -0
- package/dist/components/tooltip/Tooltip.d.ts +361 -0
- package/dist/components/tooltip/Tooltip.js +3 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +2 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.js +86 -0
- package/dist/styles/Accordion.css +1 -0
- package/dist/styles/Alert.css +1 -0
- package/dist/styles/AspectRatio.css +1 -0
- package/dist/styles/Avatar.css +1 -0
- package/dist/styles/Badge.css +1 -0
- package/dist/styles/Breadcrumb.css +1 -0
- package/dist/styles/Button.css +1 -0
- package/dist/styles/ButtonGroup.css +1 -0
- package/dist/styles/Calendar.css +1 -0
- package/dist/styles/Checkbox.css +1 -0
- package/dist/styles/Collapsible.css +1 -0
- package/dist/styles/ColorPicker.css +1 -0
- package/dist/styles/Combobox.css +1 -0
- package/dist/styles/ContextMenu.css +1 -0
- package/dist/styles/DatePicker.css +1 -0
- package/dist/styles/Dialog.css +1 -0
- package/dist/styles/Drawer.css +1 -0
- package/dist/styles/Field.css +1 -0
- package/dist/styles/Fieldset.css +1 -0
- package/dist/styles/Form.css +1 -0
- package/dist/styles/Input.css +1 -0
- package/dist/styles/InputGroup.css +1 -0
- package/dist/styles/Menu.css +1 -0
- package/dist/styles/Menubar.css +1 -0
- package/dist/styles/NavList.css +1 -0
- package/dist/styles/NavigationMenu.css +1 -0
- package/dist/styles/NumberField.css +1 -0
- package/dist/styles/OTPField.css +1 -0
- package/dist/styles/Popover.css +1 -0
- package/dist/styles/PreviewCard.css +1 -0
- package/dist/styles/Progress.css +1 -0
- package/dist/styles/ProgressCircle.css +1 -0
- package/dist/styles/Radio.css +1 -0
- package/dist/styles/Resizable.css +1 -0
- package/dist/styles/ScrollArea.css +1 -0
- package/dist/styles/Select.css +1 -0
- package/dist/styles/Separator.css +1 -0
- package/dist/styles/Skeleton.css +1 -0
- package/dist/styles/Slider.css +1 -0
- package/dist/styles/Spinner.css +1 -0
- package/dist/styles/Switch.css +1 -0
- package/dist/styles/Tabs.css +1 -0
- package/dist/styles/Textarea.css +1 -0
- package/dist/styles/Toast.css +1 -0
- package/dist/styles/Toggle.css +1 -0
- package/dist/styles/Toolbar.css +1 -0
- package/dist/styles/Tooltip.css +1 -0
- package/dist/styles/a11y.css +119 -0
- package/dist/styles/layers.css +39 -0
- package/dist/styles/motion.css +194 -0
- package/dist/styles/patterns.css +236 -0
- package/dist/styles/properties.css +62 -0
- package/dist/styles/reset.css +11 -0
- package/dist/styles/tailwind.css +281 -0
- package/dist/styles/theme.css +57 -0
- package/dist/styles/tokens.color.css +223 -0
- package/dist/styles/tokens.css +460 -0
- package/dist/tailwind-merge.d.ts +52 -0
- package/dist/tailwind-merge.js +52 -0
- package/docs-data/props.json +8047 -0
- package/docs-data/theming.json +9600 -0
- package/docs-data/tokens.json +4070 -0
- package/package.json +78 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Accordion as BaseAccordion } from '@base-ui/react/accordion';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type AccordionVariant = "divided" | "contained";
|
|
4
|
+
type BaseRootProps<Value> = BaseAccordion.Root.Props<Value>;
|
|
5
|
+
type BaseItemProps = React.ComponentPropsWithoutRef<typeof BaseAccordion.Item>;
|
|
6
|
+
type BaseHeaderProps = React.ComponentPropsWithoutRef<typeof BaseAccordion.Header>;
|
|
7
|
+
type BaseTriggerProps = React.ComponentPropsWithoutRef<typeof BaseAccordion.Trigger>;
|
|
8
|
+
type BasePanelProps = React.ComponentPropsWithoutRef<typeof BaseAccordion.Panel>;
|
|
9
|
+
export interface AccordionRootProps<Value = any> extends Omit<BaseRootProps<Value>, "className" | "orientation" | "loopFocus"> {
|
|
10
|
+
/**
|
|
11
|
+
* How much visual weight the set carries. `"divided"` is a flat list with a
|
|
12
|
+
* hairline between rows; `"contained"` turns every item into a separated
|
|
13
|
+
* card. Both are the same parts with different knobs — nothing moves.
|
|
14
|
+
* @default "divided"
|
|
15
|
+
*/
|
|
16
|
+
variant?: AccordionVariant;
|
|
17
|
+
/**
|
|
18
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
19
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
20
|
+
*/
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Groups the items and owns which of them are open.
|
|
25
|
+
*
|
|
26
|
+
* `value` and `defaultValue` are **arrays**, even with `multiple` left off —
|
|
27
|
+
* a single-open accordion is the array-of-one case, and `[]` is the legal
|
|
28
|
+
* "everything closed" value. Items with no `value` of their own are given a
|
|
29
|
+
* generated one, so pass `value` on the items you intend to address.
|
|
30
|
+
*
|
|
31
|
+
* Base UI's deprecated `orientation` and `loopFocus` props are not forwarded.
|
|
32
|
+
* The APG dropped roving focus for accordions, so neither one affects
|
|
33
|
+
* anything any more, and this component styles the vertical stack only.
|
|
34
|
+
*
|
|
35
|
+
* The `Value` generic is what an item's `value` is, defaulting to `any` as it
|
|
36
|
+
* does in Base UI — items accept anything hashable, and most sets mix nothing.
|
|
37
|
+
* Name it (`<Accordion.Root<string> …>`) to have `value`, `defaultValue` and
|
|
38
|
+
* `onValueChange` checked against one type.
|
|
39
|
+
*/
|
|
40
|
+
declare function AccordionRoot<Value = any>({ variant, className, dir, children, ...props }: AccordionRootProps<Value>): React.JSX.Element;
|
|
41
|
+
export interface AccordionItemProps extends Omit<BaseItemProps, "className"> {
|
|
42
|
+
/**
|
|
43
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
44
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
45
|
+
*/
|
|
46
|
+
className?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface AccordionHeaderProps extends Omit<BaseHeaderProps, "className"> {
|
|
49
|
+
/**
|
|
50
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
51
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
52
|
+
*/
|
|
53
|
+
className?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface AccordionTriggerProps extends Omit<BaseTriggerProps, "className"> {
|
|
56
|
+
/**
|
|
57
|
+
* The affordance at the inline-end of the row. Defaults to a chevron that
|
|
58
|
+
* rotates when the panel opens. Pass your own node to replace it — it is
|
|
59
|
+
* wrapped in the same rotating, `aria-hidden` box, so a plus or a caret
|
|
60
|
+
* needs no extra wiring — or `null` to drop it entirely.
|
|
61
|
+
* @default a chevron
|
|
62
|
+
*/
|
|
63
|
+
icon?: React.ReactNode;
|
|
64
|
+
/**
|
|
65
|
+
* Additional class name(s) for the label box that wraps `children`.
|
|
66
|
+
* Applied after the internal styles.
|
|
67
|
+
*/
|
|
68
|
+
labelClassName?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
71
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
72
|
+
*/
|
|
73
|
+
className?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface AccordionPanelProps extends Omit<BasePanelProps, "className"> {
|
|
76
|
+
/**
|
|
77
|
+
* Additional class name(s) for the inner element that holds the padding and
|
|
78
|
+
* the content. Applied after the internal styles.
|
|
79
|
+
*/
|
|
80
|
+
contentClassName?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
83
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
84
|
+
*/
|
|
85
|
+
className?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* An accordion built on Base UI's unstyled `Accordion` primitive.
|
|
89
|
+
*
|
|
90
|
+
* ```tsx
|
|
91
|
+
* <Accordion.Root defaultValue={["shipping"]}>
|
|
92
|
+
* <Accordion.Item value="shipping">
|
|
93
|
+
* <Accordion.Header>
|
|
94
|
+
* <Accordion.Trigger>When will it ship?</Accordion.Trigger>
|
|
95
|
+
* </Accordion.Header>
|
|
96
|
+
* <Accordion.Panel>Within two business days.</Accordion.Panel>
|
|
97
|
+
* </Accordion.Item>
|
|
98
|
+
* </Accordion.Root>
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* One panel opens at a time unless `multiple` is set. Every trigger is an
|
|
102
|
+
* ordinary tab stop — the APG dropped roving focus for accordions, so there
|
|
103
|
+
* are no arrow-key semantics to learn or to get wrong.
|
|
104
|
+
*
|
|
105
|
+
* Styling is driven entirely by `data-*` attributes and `--forte-accordion-*`
|
|
106
|
+
* custom properties, so it can be re-skinned from plain CSS or targeted with
|
|
107
|
+
* Tailwind arbitrary variants (`data-[variant=contained]:...`) without
|
|
108
|
+
* wrapping.
|
|
109
|
+
*/
|
|
110
|
+
export declare const Accordion: {
|
|
111
|
+
Root: typeof AccordionRoot;
|
|
112
|
+
Item: React.ForwardRefExoticComponent<AccordionItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
113
|
+
Header: React.ForwardRefExoticComponent<AccordionHeaderProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
114
|
+
Trigger: React.ForwardRefExoticComponent<AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
115
|
+
Panel: React.ForwardRefExoticComponent<AccordionPanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
116
|
+
};
|
|
117
|
+
export {};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type AlertVariant = "soft" | "outline";
|
|
3
|
+
export type AlertTone = "neutral" | "primary" | "secondary" | "success" | "warning" | "danger" | "info";
|
|
4
|
+
export type AlertLive = "off" | "polite" | "assertive";
|
|
5
|
+
export interface AlertRootProps extends Omit<React.ComponentPropsWithoutRef<"div">, "className"> {
|
|
6
|
+
/**
|
|
7
|
+
* How loud the card is. `soft` tints the whole surface in the tone and
|
|
8
|
+
* paints the message in it; `outline` is a neutral panel with a hairline,
|
|
9
|
+
* where the tone survives only in the glyph.
|
|
10
|
+
*
|
|
11
|
+
* Reach for `outline` when several alerts share a screen, or when the alert
|
|
12
|
+
* sits inside a form beside other bordered controls — a page of tinted
|
|
13
|
+
* fields has nothing left to emphasise with.
|
|
14
|
+
* @default "soft"
|
|
15
|
+
*/
|
|
16
|
+
variant?: AlertVariant;
|
|
17
|
+
/**
|
|
18
|
+
* Which semantic colour set the alert draws from, and which glyph
|
|
19
|
+
* `Alert.Icon` picks when you do not give it one.
|
|
20
|
+
*
|
|
21
|
+
* The four status tones are the ones with a glyph — `success`, `warning`,
|
|
22
|
+
* `danger`, `info`. `neutral`, `primary` and `secondary` are emphasis
|
|
23
|
+
* rather than status and deliberately have none.
|
|
24
|
+
* @default "neutral"
|
|
25
|
+
*/
|
|
26
|
+
tone?: AlertTone;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the alert announces itself when it appears, and how urgently.
|
|
29
|
+
*
|
|
30
|
+
* `off` is the default because most alerts are in the page from the start,
|
|
31
|
+
* and a live region only announces a CHANGE — so a server-rendered
|
|
32
|
+
* `role="alert"` announces nothing while still adding a role to every
|
|
33
|
+
* screen-reader element list. Set it when the alert is inserted in response
|
|
34
|
+
* to something the user did.
|
|
35
|
+
*
|
|
36
|
+
* `polite` (`role="status"`) waits for a pause and is right for almost
|
|
37
|
+
* everything — a saved confirmation, a background result. `assertive`
|
|
38
|
+
* (`role="alert"`) interrupts whatever is being read, so keep it for
|
|
39
|
+
* failures the user has to act on: a payment that did not go through, work
|
|
40
|
+
* that is about to be lost.
|
|
41
|
+
* @default "off"
|
|
42
|
+
*/
|
|
43
|
+
live?: AlertLive;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the alert is in the page. Pass it to take control of dismissal —
|
|
46
|
+
* `Alert.Close` then reports through `onOpenChange` instead of closing the
|
|
47
|
+
* card itself.
|
|
48
|
+
*
|
|
49
|
+
* Setting it to `false` does not unmount immediately: the card runs its exit
|
|
50
|
+
* transition first and removes itself when that finishes. Rendering the
|
|
51
|
+
* alert conditionally — `{open && <Alert.Root>}` — skips the transition
|
|
52
|
+
* entirely, because React takes the element out of the DOM before any of it
|
|
53
|
+
* can run. That is the reason this prop exists.
|
|
54
|
+
*/
|
|
55
|
+
open?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the alert starts in the page, when it is uncontrolled.
|
|
58
|
+
* @default true
|
|
59
|
+
*/
|
|
60
|
+
defaultOpen?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Called when `Alert.Close` is pressed, with `false`.
|
|
63
|
+
*
|
|
64
|
+
* It fires at the START of the exit, not the end — it is a request, and the
|
|
65
|
+
* card is still on screen when you hear about it. Use `onExitComplete` for
|
|
66
|
+
* the moment it is actually gone.
|
|
67
|
+
*/
|
|
68
|
+
onOpenChange?: (open: boolean) => void;
|
|
69
|
+
/**
|
|
70
|
+
* Called once the exit transition has finished and the card has removed
|
|
71
|
+
* itself from the DOM.
|
|
72
|
+
*
|
|
73
|
+
* This is where an alert that lives in a list gets spliced out of it.
|
|
74
|
+
* Removing it in `onOpenChange` instead unmounts the element mid-transition,
|
|
75
|
+
* which is the bug the two callbacks exist to keep apart.
|
|
76
|
+
*/
|
|
77
|
+
onExitComplete?: () => void;
|
|
78
|
+
/**
|
|
79
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
80
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
81
|
+
*/
|
|
82
|
+
className?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface AlertIconProps extends Omit<React.ComponentPropsWithoutRef<"span">, "className"> {
|
|
85
|
+
/**
|
|
86
|
+
* The glyph to draw. Defaults to the standard one for the root's `tone`,
|
|
87
|
+
* and any `svg` passed here is sized to `--forte-alert-icon-size` without
|
|
88
|
+
* needing a size prop of its own.
|
|
89
|
+
*/
|
|
90
|
+
children?: React.ReactNode;
|
|
91
|
+
/**
|
|
92
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
93
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
94
|
+
*/
|
|
95
|
+
className?: string;
|
|
96
|
+
}
|
|
97
|
+
export interface AlertTitleProps extends Omit<React.ComponentPropsWithoutRef<"div">, "className"> {
|
|
98
|
+
/**
|
|
99
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
100
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
101
|
+
*/
|
|
102
|
+
className?: string;
|
|
103
|
+
}
|
|
104
|
+
export interface AlertDescriptionProps extends Omit<React.ComponentPropsWithoutRef<"div">, "className"> {
|
|
105
|
+
/**
|
|
106
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
107
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
108
|
+
*/
|
|
109
|
+
className?: string;
|
|
110
|
+
}
|
|
111
|
+
export interface AlertActionProps extends Omit<React.ComponentPropsWithoutRef<"div">, "className"> {
|
|
112
|
+
/**
|
|
113
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
114
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
115
|
+
*/
|
|
116
|
+
className?: string;
|
|
117
|
+
}
|
|
118
|
+
export interface AlertCloseProps extends Omit<React.ComponentPropsWithoutRef<"button">, "className"> {
|
|
119
|
+
/**
|
|
120
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
121
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
122
|
+
*/
|
|
123
|
+
className?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* A message about the state of the page, sitting in the page rather than over
|
|
127
|
+
* it — the persistent counterpart to `Toast`.
|
|
128
|
+
*
|
|
129
|
+
* ```tsx
|
|
130
|
+
* <Alert.Root tone="danger" live="assertive">
|
|
131
|
+
* <Alert.Icon />
|
|
132
|
+
* <Alert.Title>Payment failed</Alert.Title>
|
|
133
|
+
* <Alert.Description>
|
|
134
|
+
* Your card was declined. Check the details and try again.
|
|
135
|
+
* </Alert.Description>
|
|
136
|
+
* <Alert.Action>
|
|
137
|
+
* <Button size="sm" variant="outline" tone="danger">Retry</Button>
|
|
138
|
+
* </Alert.Action>
|
|
139
|
+
* <Alert.Close />
|
|
140
|
+
* </Alert.Root>
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* `Alert.Close` dismisses the card itself, with a transition, needing no state
|
|
144
|
+
* of yours. Pass `open` and `onOpenChange` to take that over — and note that
|
|
145
|
+
* a conditional, `{open && <Alert.Root>}`, has no exit at all, because React
|
|
146
|
+
* removes the element before the transition can start.
|
|
147
|
+
*
|
|
148
|
+
* There is no Base UI primitive under it, because there is almost no state to
|
|
149
|
+
* model — no focus to manage, nothing to position. What it does have is a
|
|
150
|
+
* layout that has to survive any subset of its five parts, a pair of colour
|
|
151
|
+
* axes, a live-region decision that is easy to get wrong, and exactly one bit
|
|
152
|
+
* of state: whether it is still in the page. That last one is owned here only
|
|
153
|
+
* because React unmounts an element the frame it stops being rendered, so an
|
|
154
|
+
* alert dismissed by a plain conditional can never animate out.
|
|
155
|
+
*
|
|
156
|
+
* Styling is driven by `data-*` attributes and `--forte-alert-*` custom
|
|
157
|
+
* properties, so it can be re-skinned from plain CSS or targeted with Tailwind
|
|
158
|
+
* arbitrary variants (`data-[tone=danger]:...`) without wrapping.
|
|
159
|
+
*/
|
|
160
|
+
export declare const Alert: {
|
|
161
|
+
Root: React.ForwardRefExoticComponent<AlertRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
162
|
+
Icon: React.ForwardRefExoticComponent<AlertIconProps & React.RefAttributes<HTMLSpanElement>>;
|
|
163
|
+
Title: React.ForwardRefExoticComponent<AlertTitleProps & React.RefAttributes<HTMLDivElement>>;
|
|
164
|
+
Description: React.ForwardRefExoticComponent<AlertDescriptionProps & React.RefAttributes<HTMLDivElement>>;
|
|
165
|
+
Action: React.ForwardRefExoticComponent<AlertActionProps & React.RefAttributes<HTMLDivElement>>;
|
|
166
|
+
Close: React.ForwardRefExoticComponent<AlertCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
167
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type AspectRatioPreset = "square" | "video" | "wide" | "photo" | "portrait" | "story" | "golden";
|
|
4
|
+
export type AspectRatioFit = "cover" | "contain" | "fill" | "scale-down" | "none";
|
|
5
|
+
/**
|
|
6
|
+
* Everything `ratio` accepts.
|
|
7
|
+
*
|
|
8
|
+
* The `(string & {})` arm is what keeps the seven names as autocomplete
|
|
9
|
+
* suggestions while still allowing any CSS ratio: a bare `string` in the union
|
|
10
|
+
* would absorb the literals and the editor would offer nothing.
|
|
11
|
+
*/
|
|
12
|
+
export type AspectRatioValue = number | AspectRatioPreset | (string & {});
|
|
13
|
+
export type AspectRatioVariant = "plain" | "outlined" | "filled";
|
|
14
|
+
export type AspectRatioBasis = "inline" | "block";
|
|
15
|
+
export interface AspectRatioProps extends Omit<React.ComponentPropsWithoutRef<"div">, "className"> {
|
|
16
|
+
/**
|
|
17
|
+
* The shape to hold. Takes a number (`16 / 9`), a CSS ratio string
|
|
18
|
+
* (`"16 / 9"`), the spoken form (`"16:9"`), or one of seven names:
|
|
19
|
+
* `square`, `video` (16:9), `wide` (21:9), `photo` (4:3), `portrait` (3:4),
|
|
20
|
+
* `story` (9:16), `golden` (1.618:1).
|
|
21
|
+
*
|
|
22
|
+
* Prefer the name where one fits — it says what the box is for, where
|
|
23
|
+
* `0.5625` says only what it measures.
|
|
24
|
+
* @default 1
|
|
25
|
+
*/
|
|
26
|
+
ratio?: AspectRatioValue;
|
|
27
|
+
/**
|
|
28
|
+
* How direct media children — `img`, `video`, `canvas`, `iframe`, `embed`,
|
|
29
|
+
* `object`, and the `img` inside a `picture` — fill the box. It is an
|
|
30
|
+
* `object-fit` value, applied for you: media is stretched to the frame on
|
|
31
|
+
* both axes first, so without it an image is either letterboxed or
|
|
32
|
+
* overflowing, and every caller ends up writing the same three declarations
|
|
33
|
+
* on the child by hand.
|
|
34
|
+
*
|
|
35
|
+
* `cover` crops to fill and is what a media slot almost always wants;
|
|
36
|
+
* `contain` fits the whole image inside and leaves bars, which is right when
|
|
37
|
+
* the subject must not be cut — a logo, a diagram, a product shot on white.
|
|
38
|
+
*
|
|
39
|
+
* To keep an image from being cropped in the wrong place, set
|
|
40
|
+
* `--forte-aspect-position`.
|
|
41
|
+
* @default "cover"
|
|
42
|
+
*/
|
|
43
|
+
fit?: AspectRatioFit;
|
|
44
|
+
/**
|
|
45
|
+
* How much chrome the box carries. `plain` is a pure layout box: no
|
|
46
|
+
* background, no border, no radius. `outlined` adds a hairline frame and a
|
|
47
|
+
* surface radius, which gives light-on-light media an edge. `filled` adds a
|
|
48
|
+
* recessed panel instead — and because that panel is visible while the box
|
|
49
|
+
* is still empty, it doubles as the loading placeholder for the image that
|
|
50
|
+
* is about to arrive.
|
|
51
|
+
* @default "plain"
|
|
52
|
+
*/
|
|
53
|
+
variant?: AspectRatioVariant;
|
|
54
|
+
/**
|
|
55
|
+
* Which axis the box measures itself on. `inline` takes the container's
|
|
56
|
+
* width and derives the height — the usual case, and the only one the
|
|
57
|
+
* padding-bottom technique can express. `block` does the reverse: it takes a
|
|
58
|
+
* definite height and derives the width, which is what a media tile in a
|
|
59
|
+
* fixed-height row or a full-bleed hero needs.
|
|
60
|
+
*
|
|
61
|
+
* `block` requires the parent to actually supply a height — a grid row, a
|
|
62
|
+
* stretched flex cross size, an explicit `height`. Given an indefinite one,
|
|
63
|
+
* `100%` has nothing to resolve against and the box falls back to sizing
|
|
64
|
+
* from its content.
|
|
65
|
+
* @default "inline"
|
|
66
|
+
*/
|
|
67
|
+
basis?: AspectRatioBasis;
|
|
68
|
+
/**
|
|
69
|
+
* Clips content to the box, and to its corner radius.
|
|
70
|
+
*
|
|
71
|
+
* On by default, because media that overflows its own frame is a bug rather
|
|
72
|
+
* than a feature. Turn it off for the overlay that is *meant* to break out —
|
|
73
|
+
* a badge hanging off a corner, a focus ring on a child, a tooltip anchored
|
|
74
|
+
* inside.
|
|
75
|
+
* @default true
|
|
76
|
+
*/
|
|
77
|
+
clip?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Replaces the rendered `<div>` with another element or component. This is
|
|
80
|
+
* how the box becomes a `<figure>` around a caption, or the `<a>` that wraps
|
|
81
|
+
* a whole thumbnail.
|
|
82
|
+
*/
|
|
83
|
+
render?: useRender.RenderProp;
|
|
84
|
+
/**
|
|
85
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
86
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
87
|
+
*/
|
|
88
|
+
className?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A box that holds its shape, whatever goes in it.
|
|
92
|
+
*
|
|
93
|
+
* ```tsx
|
|
94
|
+
* <AspectRatio ratio="video">
|
|
95
|
+
* <img src="/cover.jpg" alt="" />
|
|
96
|
+
* </AspectRatio>
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* The reason to reach for it is layout shift: the box occupies its final size
|
|
100
|
+
* from the first paint, so an image that arrives half a second later drops
|
|
101
|
+
* into space that was already reserved instead of shoving the page down.
|
|
102
|
+
*
|
|
103
|
+
* Base UI has no aspect-ratio primitive — there is no interaction to model —
|
|
104
|
+
* so this is built on the CSS property directly rather than on the
|
|
105
|
+
* `padding-bottom: 56.25%` trick the property replaced. Two things follow from
|
|
106
|
+
* that, and both are the point:
|
|
107
|
+
*
|
|
108
|
+
* - **Children stack.** The box is a one-cell grid and every direct child is
|
|
109
|
+
* placed in that cell, in source order, without leaving flow. A caption over
|
|
110
|
+
* a photo is two elements and no `position: absolute`:
|
|
111
|
+
*
|
|
112
|
+
* ```tsx
|
|
113
|
+
* <AspectRatio ratio="photo" variant="filled">
|
|
114
|
+
* <img src="/cover.jpg" alt="" />
|
|
115
|
+
* <figcaption style={{ placeSelf: "end start" }}>Lisbon, 2019</figcaption>
|
|
116
|
+
* </AspectRatio>
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
119
|
+
* - **Either axis can be the measured one.** `basis="block"` takes a definite
|
|
120
|
+
* height and derives the width, which a percentage padding cannot do at all.
|
|
121
|
+
*
|
|
122
|
+
* Media children are sized and `object-fit` for you — see `fit`. Everything
|
|
123
|
+
* visual is a `--forte-aspect-*` custom property, and the state is on
|
|
124
|
+
* `data-variant`, `data-fit` and `data-basis`, so a box can be re-skinned from
|
|
125
|
+
* plain CSS or targeted with Tailwind arbitrary variants
|
|
126
|
+
* (`data-[variant=filled]:...`) without wrapping it.
|
|
127
|
+
*/
|
|
128
|
+
export declare const AspectRatio: React.ForwardRefExoticComponent<AspectRatioProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { Avatar as BaseAvatar } from '@base-ui/react/avatar';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type AvatarSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
4
|
+
export type AvatarShape = "circle" | "rounded" | "square";
|
|
5
|
+
export type AvatarVariant = "soft" | "solid" | "outline";
|
|
6
|
+
export type AvatarTone = "neutral" | "primary" | "secondary" | "danger";
|
|
7
|
+
export type AvatarBadgeTone = AvatarTone | "success" | "warning";
|
|
8
|
+
export type AvatarBadgePlacement = "bottom-end" | "bottom-start" | "top-end" | "top-start";
|
|
9
|
+
type BaseRootProps = React.ComponentPropsWithoutRef<typeof BaseAvatar.Root>;
|
|
10
|
+
type BaseImageProps = React.ComponentPropsWithoutRef<typeof BaseAvatar.Image>;
|
|
11
|
+
type BaseFallbackProps = React.ComponentPropsWithoutRef<typeof BaseAvatar.Fallback>;
|
|
12
|
+
export interface AvatarRootProps extends Omit<BaseRootProps, "className"> {
|
|
13
|
+
/**
|
|
14
|
+
* Diameter of the avatar — `1.5rem` through `4rem`. Everything inside is a
|
|
15
|
+
* fraction of it, so the initials, the icon and the corner radius all follow
|
|
16
|
+
* without a second prop.
|
|
17
|
+
* @default "md"
|
|
18
|
+
*/
|
|
19
|
+
size?: AvatarSize;
|
|
20
|
+
/**
|
|
21
|
+
* The silhouette. `circle` is the convention for people; `rounded` and
|
|
22
|
+
* `square` read as an object — a workspace, a repository, a bot.
|
|
23
|
+
*
|
|
24
|
+
* `circle` stays a circle under `data-forte-radius="none"`, because you asked
|
|
25
|
+
* for one. Only `rounded` follows the radius preset.
|
|
26
|
+
* @default "circle"
|
|
27
|
+
*/
|
|
28
|
+
shape?: AvatarShape;
|
|
29
|
+
/**
|
|
30
|
+
* How loud the fallback is. `soft` is a tinted disc with tone-coloured
|
|
31
|
+
* initials, `solid` fills with the tone itself, `outline` is a ring around
|
|
32
|
+
* nothing.
|
|
33
|
+
*
|
|
34
|
+
* This only decides what shows while there is no image — a loaded image
|
|
35
|
+
* covers the fill entirely. `outline` is the exception: its border sits
|
|
36
|
+
* outside the picture and stays visible either way.
|
|
37
|
+
* @default "soft"
|
|
38
|
+
*/
|
|
39
|
+
variant?: AvatarVariant;
|
|
40
|
+
/**
|
|
41
|
+
* Which semantic colour set the fallback draws from. Rotating the tone
|
|
42
|
+
* across a list is the cheapest way to make initials tell people apart —
|
|
43
|
+
* but colour is never the only cue, since the initials themselves differ.
|
|
44
|
+
* @default "neutral"
|
|
45
|
+
*/
|
|
46
|
+
tone?: AvatarTone;
|
|
47
|
+
/**
|
|
48
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
49
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
50
|
+
*/
|
|
51
|
+
className?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface AvatarImageProps extends Omit<BaseImageProps, "className"> {
|
|
54
|
+
/**
|
|
55
|
+
* What the picture shows. Required, because there is no sensible guess: the
|
|
56
|
+
* fallback's initials are gone the moment the image loads, so an avatar with
|
|
57
|
+
* no alt text and no adjacent name leaves the person unidentifiable.
|
|
58
|
+
*
|
|
59
|
+
* Pass the person's name when the avatar is the only thing naming them, and
|
|
60
|
+
* `""` when their name is already written beside it — a photo repeated as
|
|
61
|
+
* "Jane Doe Jane Doe" is worse than no alt at all.
|
|
62
|
+
*/
|
|
63
|
+
alt: string;
|
|
64
|
+
/**
|
|
65
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
66
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
67
|
+
*/
|
|
68
|
+
className?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface AvatarFallbackProps extends Omit<BaseFallbackProps, "className"> {
|
|
71
|
+
/**
|
|
72
|
+
* How long to wait before showing the fallback, in milliseconds.
|
|
73
|
+
*
|
|
74
|
+
* Left at Base UI's `0`, which is right whenever the fallback IS the avatar:
|
|
75
|
+
* a non-zero delay withholds it during server rendering too, so an
|
|
76
|
+
* initials-only avatar would ship as an empty disc and pop in a tenth of a
|
|
77
|
+
* second later.
|
|
78
|
+
*
|
|
79
|
+
* Set it to ~100–150ms when there is an `Avatar.Image` beside it. A cached
|
|
80
|
+
* image is not decoded until after hydration, so at `0` the initials paint
|
|
81
|
+
* and are replaced on every load; a short wait swallows that flash, at the
|
|
82
|
+
* cost of an empty disc for the same span on a slow connection.
|
|
83
|
+
* @default 0
|
|
84
|
+
*/
|
|
85
|
+
delay?: number;
|
|
86
|
+
/**
|
|
87
|
+
* The person or thing this avatar stands for, for assistive technology only.
|
|
88
|
+
*
|
|
89
|
+
* Initials are a visual shorthand and read as noise — "J D" — so passing a
|
|
90
|
+
* label hides the children from the accessibility tree and announces this
|
|
91
|
+
* instead. Leave it unset when the name is already written next to the
|
|
92
|
+
* avatar, or when the fallback is a decorative icon.
|
|
93
|
+
*/
|
|
94
|
+
label?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
97
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
98
|
+
*/
|
|
99
|
+
className?: string;
|
|
100
|
+
}
|
|
101
|
+
export interface AvatarBadgeProps extends Omit<React.ComponentPropsWithoutRef<"span">, "className"> {
|
|
102
|
+
/**
|
|
103
|
+
* Which semantic colour set the badge draws from. `success`, `warning` and
|
|
104
|
+
* `danger` are the presence set — online, away, do-not-disturb — and the
|
|
105
|
+
* brand tones suit a count or a verification tick.
|
|
106
|
+
*
|
|
107
|
+
* Colour is never the only cue: pass `label`, or write the status out beside
|
|
108
|
+
* the avatar, so the badge is repeating something rather than saying it.
|
|
109
|
+
* @default "neutral"
|
|
110
|
+
*/
|
|
111
|
+
tone?: AvatarBadgeTone;
|
|
112
|
+
/**
|
|
113
|
+
* Which corner it sits on.
|
|
114
|
+
*
|
|
115
|
+
* `bottom-end` is the convention, and it is also the corner a group covers:
|
|
116
|
+
* avatars in an `Avatar.Group` overlap toward the inline-start, so every
|
|
117
|
+
* avatar but the last has its inline-end corner painted over by the next
|
|
118
|
+
* one. Use `bottom-start` there, or badge only the last avatar.
|
|
119
|
+
* @default "bottom-end"
|
|
120
|
+
*/
|
|
121
|
+
placement?: AvatarBadgePlacement;
|
|
122
|
+
/**
|
|
123
|
+
* What the badge means, for assistive technology.
|
|
124
|
+
*
|
|
125
|
+
* A bare dot is decoration and is hidden from the accessibility tree unless
|
|
126
|
+
* you pass this. A badge with visible content stays in the tree either way —
|
|
127
|
+
* `label` then replaces what is announced, the way it does on
|
|
128
|
+
* `Avatar.Fallback`, so `4` can read as "4 unread messages".
|
|
129
|
+
*
|
|
130
|
+
* Leave it unset when the status is already written next to the avatar.
|
|
131
|
+
*/
|
|
132
|
+
label?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
135
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
136
|
+
*/
|
|
137
|
+
className?: string;
|
|
138
|
+
}
|
|
139
|
+
export interface AvatarGroupProps extends Omit<React.ComponentPropsWithoutRef<"span">, "className"> {
|
|
140
|
+
/**
|
|
141
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
142
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
143
|
+
*/
|
|
144
|
+
className?: string;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* An avatar built on Base UI's unstyled `Avatar` primitive: a picture of a
|
|
148
|
+
* person or a thing, with something sensible to show when the picture is
|
|
149
|
+
* missing, slow or broken.
|
|
150
|
+
*
|
|
151
|
+
* ```tsx
|
|
152
|
+
* <Avatar.Root size="lg">
|
|
153
|
+
* <Avatar.Image src={user.photo} alt={user.name} />
|
|
154
|
+
* <Avatar.Fallback label={user.name}>{initials}</Avatar.Fallback>
|
|
155
|
+
* <Avatar.Badge tone="success" label="Online" />
|
|
156
|
+
* </Avatar.Root>
|
|
157
|
+
*
|
|
158
|
+
* <Avatar.Group>
|
|
159
|
+
* <Avatar.Root>…</Avatar.Root>
|
|
160
|
+
* <Avatar.Root>…</Avatar.Root>
|
|
161
|
+
* <Avatar.Root tone="primary"><Avatar.Fallback label="3 more">+3</Avatar.Fallback></Avatar.Root>
|
|
162
|
+
* </Avatar.Group>
|
|
163
|
+
* ```
|
|
164
|
+
*
|
|
165
|
+
* Styling is driven by `data-*` attributes and `--forte-avatar-*` custom
|
|
166
|
+
* properties, so it can be re-skinned from plain CSS or targeted with Tailwind
|
|
167
|
+
* arbitrary variants (`data-[shape=square]:...`) without wrapping.
|
|
168
|
+
*/
|
|
169
|
+
export declare const Avatar: {
|
|
170
|
+
Root: React.ForwardRefExoticComponent<AvatarRootProps & React.RefAttributes<HTMLSpanElement>>;
|
|
171
|
+
Image: React.ForwardRefExoticComponent<AvatarImageProps & React.RefAttributes<HTMLImageElement>>;
|
|
172
|
+
Fallback: React.ForwardRefExoticComponent<AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>>;
|
|
173
|
+
Badge: React.ForwardRefExoticComponent<AvatarBadgeProps & React.RefAttributes<HTMLSpanElement>>;
|
|
174
|
+
Group: React.ForwardRefExoticComponent<AvatarGroupProps & React.RefAttributes<HTMLSpanElement>>;
|
|
175
|
+
};
|
|
176
|
+
export {};
|