@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,345 @@
|
|
|
1
|
+
import { Select as BaseSelect } from '@base-ui/react/select';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type SelectSize = "sm" | "md" | "lg";
|
|
4
|
+
export type SelectVariant = "outline" | "soft" | "ghost";
|
|
5
|
+
/**
|
|
6
|
+
* Props for {@link SelectRoot}. A re-export of Base UI's own root props, kept
|
|
7
|
+
* generic so `<Select.Root<Theme>>` still infers the value type of
|
|
8
|
+
* `onValueChange`, `defaultValue` and `<Select.Value>`'s render function.
|
|
9
|
+
*/
|
|
10
|
+
export type SelectRootProps<Value, Multiple extends boolean | undefined = false> = BaseSelect.Root.Props<Value, Multiple>;
|
|
11
|
+
/**
|
|
12
|
+
* Groups every part of the select and owns its value and open state. Renders
|
|
13
|
+
* no DOM element of its own, so it accepts neither `className` nor `ref`.
|
|
14
|
+
*
|
|
15
|
+
* Both generics are forwarded rather than widened to `any`: `Value` is the
|
|
16
|
+
* type of a single item, and `Multiple` flips the value between `Value` and
|
|
17
|
+
* `Value[]`. Passing `multiple` alone is enough for `Multiple` to infer.
|
|
18
|
+
*/
|
|
19
|
+
export declare function SelectRoot<Value, Multiple extends boolean | undefined = false>(props: SelectRootProps<Value, Multiple>): React.JSX.Element;
|
|
20
|
+
type BaseLabelProps = React.ComponentPropsWithoutRef<typeof BaseSelect.Label>;
|
|
21
|
+
export interface SelectLabelProps extends Omit<BaseLabelProps, "className"> {
|
|
22
|
+
/**
|
|
23
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
24
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
25
|
+
*/
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A visible label wired to the trigger. This is the preferred way to give a
|
|
30
|
+
* select its accessible name — Base UI renders a `<div>` and associates it
|
|
31
|
+
* with `aria-labelledby`, so clicking it focuses the trigger without opening
|
|
32
|
+
* the popup. When no visible label is rendered, put `aria-label` on
|
|
33
|
+
* `<Select.Trigger>` instead.
|
|
34
|
+
*/
|
|
35
|
+
export declare const SelectLabel: React.ForwardRefExoticComponent<SelectLabelProps & React.RefAttributes<HTMLDivElement>>;
|
|
36
|
+
type BaseTriggerProps = React.ComponentPropsWithoutRef<typeof BaseSelect.Trigger>;
|
|
37
|
+
export interface SelectTriggerProps extends Omit<BaseTriggerProps, "className"> {
|
|
38
|
+
/**
|
|
39
|
+
* How much visual weight the trigger carries. `outline` reads as a form
|
|
40
|
+
* control, `soft` as a filled field, `ghost` as an inline affordance.
|
|
41
|
+
* @default "outline"
|
|
42
|
+
*/
|
|
43
|
+
variant?: SelectVariant;
|
|
44
|
+
/**
|
|
45
|
+
* Size of the trigger. Actual dimensions also follow the ambient
|
|
46
|
+
* `data-forte-density` setting.
|
|
47
|
+
* @default "md"
|
|
48
|
+
*/
|
|
49
|
+
size?: SelectSize;
|
|
50
|
+
/**
|
|
51
|
+
* Stretch the trigger to fill the width of its container.
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
fullWidth?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
57
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
58
|
+
*/
|
|
59
|
+
className?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The button that opens the popup. Renders a native `<button>`.
|
|
63
|
+
*
|
|
64
|
+
* Give it `<Select.Value>` and `<Select.Icon>` as children. It must have an
|
|
65
|
+
* accessible name: render a `<Select.Label>` inside the same `<Select.Root>`,
|
|
66
|
+
* a `<Field.Label nativeLabel={false}>` in the same `<Field.Root>`, or pass
|
|
67
|
+
* `aria-label` here. In development the trigger warns once if it ends up with
|
|
68
|
+
* none of them.
|
|
69
|
+
*/
|
|
70
|
+
export declare const SelectTrigger: React.ForwardRefExoticComponent<SelectTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
71
|
+
type BaseValueProps = React.ComponentPropsWithoutRef<typeof BaseSelect.Value>;
|
|
72
|
+
export interface SelectValueProps extends Omit<BaseValueProps, "className"> {
|
|
73
|
+
/**
|
|
74
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
75
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
76
|
+
*/
|
|
77
|
+
className?: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The selected item's label inside the trigger. Renders a `<span>`.
|
|
81
|
+
*
|
|
82
|
+
* By default this renders the raw `value`. Pass `items` to `<Select.Root>` to
|
|
83
|
+
* render the matching label instead, or pass a function as `children` to
|
|
84
|
+
* format it yourself.
|
|
85
|
+
*
|
|
86
|
+
* A `placeholder` cannot be cleared by the user once a value is chosen. If the
|
|
87
|
+
* selection has to be clearable from the popup, render an item whose value is
|
|
88
|
+
* `null` instead of using `placeholder`.
|
|
89
|
+
*/
|
|
90
|
+
export declare const SelectValue: React.ForwardRefExoticComponent<SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
91
|
+
type BaseIconProps = React.ComponentPropsWithoutRef<typeof BaseSelect.Icon>;
|
|
92
|
+
export interface SelectIconProps extends Omit<BaseIconProps, "className"> {
|
|
93
|
+
/**
|
|
94
|
+
* Icon to render. Defaults to a caret pair, which stays correct whichever
|
|
95
|
+
* side the popup ends up on — including `alignItemWithTrigger` mode, where
|
|
96
|
+
* it opens over the trigger and has no side at all.
|
|
97
|
+
* @default <CaretUpDownIcon />
|
|
98
|
+
*/
|
|
99
|
+
children?: React.ReactNode;
|
|
100
|
+
/**
|
|
101
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
102
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
103
|
+
*/
|
|
104
|
+
className?: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The affordance that marks the trigger as a select. Renders a `<span>`, and
|
|
108
|
+
* carries `data-popup-open` so it can react to the popup's state.
|
|
109
|
+
*
|
|
110
|
+
* Purely decorative — the trigger's own role and `aria-expanded` are what
|
|
111
|
+
* reach assistive technology.
|
|
112
|
+
*/
|
|
113
|
+
export declare const SelectIcon: React.ForwardRefExoticComponent<SelectIconProps & React.RefAttributes<HTMLSpanElement>>;
|
|
114
|
+
type BasePopupProps = React.ComponentPropsWithoutRef<typeof BaseSelect.Popup>;
|
|
115
|
+
type BasePositionerProps = React.ComponentPropsWithoutRef<typeof BaseSelect.Positioner>;
|
|
116
|
+
type BasePortalProps = React.ComponentPropsWithoutRef<typeof BaseSelect.Portal>;
|
|
117
|
+
export interface SelectPopupProps extends Omit<BasePopupProps, "className"> {
|
|
118
|
+
/**
|
|
119
|
+
* The items, separators and groups to render. They are placed inside
|
|
120
|
+
* `<Select.List>`, which is the element that actually scrolls.
|
|
121
|
+
*/
|
|
122
|
+
children?: React.ReactNode;
|
|
123
|
+
/**
|
|
124
|
+
* Whether the popup overlaps the trigger so the selected item's text lines
|
|
125
|
+
* up with the trigger's value text. While this is active `data-side` is
|
|
126
|
+
* `"none"` on both the positioner and the popup, `side`/`align`/`sideOffset`
|
|
127
|
+
* are ignored, and the enter/exit transition is suppressed. Base UI also
|
|
128
|
+
* disables it automatically for touch input and when the viewport is too
|
|
129
|
+
* tight, in which case ordinary side placement takes over.
|
|
130
|
+
* @default true
|
|
131
|
+
*/
|
|
132
|
+
alignItemWithTrigger?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Which side of the trigger the popup opens on. Ignored while
|
|
135
|
+
* `alignItemWithTrigger` is in effect.
|
|
136
|
+
* @default "bottom"
|
|
137
|
+
*/
|
|
138
|
+
side?: BasePositionerProps["side"];
|
|
139
|
+
/**
|
|
140
|
+
* How the popup aligns along the chosen side. Ignored while
|
|
141
|
+
* `alignItemWithTrigger` is in effect.
|
|
142
|
+
* @default "center"
|
|
143
|
+
*/
|
|
144
|
+
align?: BasePositionerProps["align"];
|
|
145
|
+
/**
|
|
146
|
+
* Gap in pixels between the trigger and the popup. Ignored while
|
|
147
|
+
* `alignItemWithTrigger` is in effect.
|
|
148
|
+
* @default 4
|
|
149
|
+
*/
|
|
150
|
+
sideOffset?: BasePositionerProps["sideOffset"];
|
|
151
|
+
/**
|
|
152
|
+
* Extra offset in pixels along the alignment axis. Ignored while
|
|
153
|
+
* `alignItemWithTrigger` is in effect.
|
|
154
|
+
* @default 0
|
|
155
|
+
*/
|
|
156
|
+
alignOffset?: BasePositionerProps["alignOffset"];
|
|
157
|
+
/**
|
|
158
|
+
* Space to keep between the popup and the edge of its collision boundary.
|
|
159
|
+
* @default 5
|
|
160
|
+
*/
|
|
161
|
+
collisionPadding?: BasePositionerProps["collisionPadding"];
|
|
162
|
+
/**
|
|
163
|
+
* Render the popup into a different container instead of `<body>`.
|
|
164
|
+
*/
|
|
165
|
+
container?: BasePortalProps["container"];
|
|
166
|
+
/**
|
|
167
|
+
* Render a dimming layer behind the popup. Off by default — a select is a
|
|
168
|
+
* menu, not a dialog — but useful on small screens where the popup covers
|
|
169
|
+
* most of the page.
|
|
170
|
+
* @default false
|
|
171
|
+
*/
|
|
172
|
+
backdrop?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Render the hover-to-scroll arrows at the top and bottom of the list. They
|
|
175
|
+
* are a pointer convenience only: Base UI does not render them for touch
|
|
176
|
+
* input, and the list scrolls by wheel, drag, keyboard and typeahead
|
|
177
|
+
* regardless, so no item is ever reachable only through them.
|
|
178
|
+
* @default true
|
|
179
|
+
*/
|
|
180
|
+
scrollArrows?: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Where focus goes when the popup closes. There is no `initialFocus`
|
|
183
|
+
* counterpart on a select popup — Base UI always moves focus to the
|
|
184
|
+
* highlighted item on open.
|
|
185
|
+
* @default the trigger
|
|
186
|
+
*/
|
|
187
|
+
finalFocus?: BasePopupProps["finalFocus"];
|
|
188
|
+
/**
|
|
189
|
+
* Additional class name(s) for the popup surface. Applied after the
|
|
190
|
+
* internal styles so consumer utilities win without needing `!important`.
|
|
191
|
+
*/
|
|
192
|
+
className?: string;
|
|
193
|
+
/**
|
|
194
|
+
* Additional class name(s) for the positioner — the absolutely positioned
|
|
195
|
+
* wrapper around the popup. Use this for `z-index` or a `min-height` that
|
|
196
|
+
* tunes how often `alignItemWithTrigger` falls back.
|
|
197
|
+
*/
|
|
198
|
+
positionerClassName?: string;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* The floating surface holding the list of items.
|
|
202
|
+
*
|
|
203
|
+
* This one part renders the whole floating half of Base UI's anatomy —
|
|
204
|
+
* `Portal` → (`Backdrop`) → `Positioner` → `Popup` → `ScrollUpArrow` +
|
|
205
|
+
* `List` + `ScrollDownArrow` — because those elements are meaningless apart
|
|
206
|
+
* and each one has a job the styles depend on: the positioner owns
|
|
207
|
+
* `--anchor-width` and `--available-height`, the popup owns the surface, and
|
|
208
|
+
* the list owns scrolling (which is what the scroll arrows measure).
|
|
209
|
+
*/
|
|
210
|
+
export declare const SelectPopup: React.ForwardRefExoticComponent<SelectPopupProps & React.RefAttributes<HTMLDivElement>>;
|
|
211
|
+
type BaseItemProps = React.ComponentPropsWithoutRef<typeof BaseSelect.Item>;
|
|
212
|
+
export interface SelectItemProps extends Omit<BaseItemProps, "className"> {
|
|
213
|
+
/**
|
|
214
|
+
* The item's label. Rendered inside `<Select.ItemText>`, which is what
|
|
215
|
+
* `<Select.Value>` mirrors in the trigger and what typeahead matches on.
|
|
216
|
+
*/
|
|
217
|
+
children?: React.ReactNode;
|
|
218
|
+
/**
|
|
219
|
+
* The value this item selects. `null` is a legitimate value and is how you
|
|
220
|
+
* offer a "clear the selection" row inside the list.
|
|
221
|
+
* @default null
|
|
222
|
+
*/
|
|
223
|
+
value?: unknown;
|
|
224
|
+
/**
|
|
225
|
+
* Plain-text label used for typeahead when `children` is not a string.
|
|
226
|
+
*/
|
|
227
|
+
label?: string;
|
|
228
|
+
/**
|
|
229
|
+
* Whether the item ignores user interaction. Disabled items stay in the
|
|
230
|
+
* list and stay announced; typeahead skips them.
|
|
231
|
+
* @default false
|
|
232
|
+
*/
|
|
233
|
+
disabled?: boolean;
|
|
234
|
+
/**
|
|
235
|
+
* What marks the item as selected. Rendered inside
|
|
236
|
+
* `<Select.ItemIndicator>`, which only mounts while the item is selected.
|
|
237
|
+
* @default <CheckIcon />
|
|
238
|
+
*/
|
|
239
|
+
indicator?: React.ReactNode;
|
|
240
|
+
/**
|
|
241
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
242
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
243
|
+
*/
|
|
244
|
+
className?: string;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* One option in the popup. Renders a `<div>` with `role="option"`.
|
|
248
|
+
*
|
|
249
|
+
* `data-highlighted` is the focus analogue here: Base UI moves real DOM focus
|
|
250
|
+
* between items with a roving tabindex, and (with `highlightItemOnHover`,
|
|
251
|
+
* which is on by default) pointer hover sets the same attribute. Because the
|
|
252
|
+
* list is a clipping scroll container, the focus ring is applied inset via
|
|
253
|
+
* `data-focus-inset` so `overflow` cannot crop it.
|
|
254
|
+
*/
|
|
255
|
+
export declare const SelectItem: React.ForwardRefExoticComponent<SelectItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
256
|
+
type BaseGroupProps = React.ComponentPropsWithoutRef<typeof BaseSelect.Group>;
|
|
257
|
+
export interface SelectGroupProps extends Omit<BaseGroupProps, "className"> {
|
|
258
|
+
/**
|
|
259
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
260
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
261
|
+
*/
|
|
262
|
+
className?: string;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Groups related items under a heading. Renders a `<div>` with
|
|
266
|
+
* `role="group"`; Base UI associates it with the `<Select.GroupLabel>` inside
|
|
267
|
+
* it automatically, so the heading is announced with its members.
|
|
268
|
+
*/
|
|
269
|
+
export declare const SelectGroup: React.ForwardRefExoticComponent<SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
270
|
+
type BaseGroupLabelProps = React.ComponentPropsWithoutRef<typeof BaseSelect.GroupLabel>;
|
|
271
|
+
export interface SelectGroupLabelProps extends Omit<BaseGroupLabelProps, "className"> {
|
|
272
|
+
/**
|
|
273
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
274
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
275
|
+
*/
|
|
276
|
+
className?: string;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* The heading for a `<Select.Group>`. Renders a `<div>`, indented past the
|
|
280
|
+
* indicator column so its text lines up with the item text rather than with
|
|
281
|
+
* the check marks.
|
|
282
|
+
*/
|
|
283
|
+
export declare const SelectGroupLabel: React.ForwardRefExoticComponent<SelectGroupLabelProps & React.RefAttributes<HTMLDivElement>>;
|
|
284
|
+
type BaseSeparatorProps = React.ComponentPropsWithoutRef<typeof BaseSelect.Separator>;
|
|
285
|
+
export interface SelectSeparatorProps extends Omit<BaseSeparatorProps, "className"> {
|
|
286
|
+
/**
|
|
287
|
+
* Orientation of the rule. A select list is vertical, so the separator
|
|
288
|
+
* between two groups runs horizontally.
|
|
289
|
+
* @default "horizontal"
|
|
290
|
+
*/
|
|
291
|
+
orientation?: BaseSeparatorProps["orientation"];
|
|
292
|
+
/**
|
|
293
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
294
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
295
|
+
*/
|
|
296
|
+
className?: string;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* A divider between groups of items. Renders a `<div>` with
|
|
300
|
+
* `role="separator"`, so it is exposed to assistive technology rather than
|
|
301
|
+
* being a purely visual line.
|
|
302
|
+
*/
|
|
303
|
+
export declare const SelectSeparator: React.ForwardRefExoticComponent<SelectSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
304
|
+
/**
|
|
305
|
+
* A select built on Base UI's unstyled `Select` primitives.
|
|
306
|
+
*
|
|
307
|
+
* ```tsx
|
|
308
|
+
* <Select.Root<Theme> items={themes} defaultValue="system">
|
|
309
|
+
* <Select.Label>Theme</Select.Label>
|
|
310
|
+
* <Select.Trigger>
|
|
311
|
+
* <Select.Value />
|
|
312
|
+
* <Select.Icon />
|
|
313
|
+
* </Select.Trigger>
|
|
314
|
+
* <Select.Popup>
|
|
315
|
+
* <Select.Item value="system">System</Select.Item>
|
|
316
|
+
* <Select.Item value="light">Light</Select.Item>
|
|
317
|
+
* </Select.Popup>
|
|
318
|
+
* </Select.Root>
|
|
319
|
+
* ```
|
|
320
|
+
*
|
|
321
|
+
* Styling is driven entirely by `data-*` attributes and `--forte-select-*`
|
|
322
|
+
* custom properties, so it can be re-skinned from plain CSS or targeted with
|
|
323
|
+
* Tailwind arbitrary variants (`data-[highlighted]:...`) without wrapping.
|
|
324
|
+
* Each part declares its own knobs, so an ancestor's value is only inherited
|
|
325
|
+
* and loses — set them on the part itself via `className`. The popup is also
|
|
326
|
+
* portalled to `<body>`, so an ancestor of the trigger could not reach it in
|
|
327
|
+
* any case. `positionerClassName` reaches `--forte-select-z-index` and
|
|
328
|
+
* `--forte-select-positioner-min-height`, the only two declared on the
|
|
329
|
+
* positioner. The global `--forte-color-*` / `--forte-control-*` / `--forte-radius-*`
|
|
330
|
+
* / `--forte-space-*` tokens these resolve to ARE inherited, so re-pointing
|
|
331
|
+
* those from `:root` or a theme scope moves every select at once.
|
|
332
|
+
*/
|
|
333
|
+
export declare const Select: {
|
|
334
|
+
Root: typeof SelectRoot;
|
|
335
|
+
Label: React.ForwardRefExoticComponent<SelectLabelProps & React.RefAttributes<HTMLDivElement>>;
|
|
336
|
+
Trigger: React.ForwardRefExoticComponent<SelectTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
337
|
+
Value: React.ForwardRefExoticComponent<SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
338
|
+
Icon: React.ForwardRefExoticComponent<SelectIconProps & React.RefAttributes<HTMLSpanElement>>;
|
|
339
|
+
Popup: React.ForwardRefExoticComponent<SelectPopupProps & React.RefAttributes<HTMLDivElement>>;
|
|
340
|
+
Item: React.ForwardRefExoticComponent<SelectItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
341
|
+
Group: React.ForwardRefExoticComponent<SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
342
|
+
GroupLabel: React.ForwardRefExoticComponent<SelectGroupLabelProps & React.RefAttributes<HTMLDivElement>>;
|
|
343
|
+
Separator: React.ForwardRefExoticComponent<SelectSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
344
|
+
};
|
|
345
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "../../Select-BP-zvdXm.js";
|
|
3
|
+
export { l as Select, a as SelectGroup, s as SelectGroupLabel, r as SelectIcon, e as SelectItem, o as SelectLabel, c as SelectPopup, t as SelectRoot, i as SelectSeparator, u as SelectTrigger, n as SelectValue };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { Select, SelectRoot, SelectLabel, SelectTrigger, SelectValue, SelectIcon, SelectPopup, SelectItem, SelectGroup, SelectGroupLabel, SelectSeparator, } from './Select';
|
|
2
|
+
export type { SelectRootProps, SelectLabelProps, SelectTriggerProps, SelectValueProps, SelectIconProps, SelectPopupProps, SelectItemProps, SelectGroupProps, SelectGroupLabelProps, SelectSeparatorProps, SelectSize, SelectVariant, } from './Select';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "../../Select-BP-zvdXm.js";
|
|
2
|
+
export { l as Select, a as SelectGroup, s as SelectGroupLabel, r as SelectIcon, e as SelectItem, o as SelectLabel, c as SelectPopup, t as SelectRoot, i as SelectSeparator, u as SelectTrigger, n as SelectValue };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Separator as BaseSeparator } from '@base-ui/react/separator';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type SeparatorOrientation = "horizontal" | "vertical";
|
|
4
|
+
export type SeparatorVariant = "solid" | "dashed" | "dotted";
|
|
5
|
+
type BaseSeparatorProps = React.ComponentPropsWithoutRef<typeof BaseSeparator>;
|
|
6
|
+
export interface SeparatorProps extends Omit<BaseSeparatorProps, "className"> {
|
|
7
|
+
/**
|
|
8
|
+
* Which way the rule runs — and therefore which axis it separates. A
|
|
9
|
+
* `horizontal` rule is a line across the inline axis dividing stacked
|
|
10
|
+
* content; a `vertical` one is a line down the block axis dividing content
|
|
11
|
+
* in a row.
|
|
12
|
+
*
|
|
13
|
+
* It is also what Base UI reports as `aria-orientation`, so it is a
|
|
14
|
+
* semantic choice, not only a visual one.
|
|
15
|
+
* @default "horizontal"
|
|
16
|
+
*/
|
|
17
|
+
orientation?: SeparatorOrientation;
|
|
18
|
+
/**
|
|
19
|
+
* The line style. A rule has exactly one visual dimension, so this is the
|
|
20
|
+
* whole of it: `solid` for structural divisions, `dashed` or `dotted` for
|
|
21
|
+
* softer, more provisional ones (a drop zone's edge, an optional section).
|
|
22
|
+
* @default "solid"
|
|
23
|
+
*/
|
|
24
|
+
variant?: SeparatorVariant;
|
|
25
|
+
/**
|
|
26
|
+
* Drops `role="separator"`, leaving the line visible but absent from the
|
|
27
|
+
* accessibility tree.
|
|
28
|
+
*
|
|
29
|
+
* Use it when the grouping is already conveyed some other way — a heading,
|
|
30
|
+
* a landmark, a list — and the rule is only reinforcing it visually.
|
|
31
|
+
* Announcing a boundary that the structure already communicates makes a
|
|
32
|
+
* screen reader read the page's decoration out loud.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
decorative?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
38
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
39
|
+
*/
|
|
40
|
+
className?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A rule between things, built on Base UI's `Separator` primitive.
|
|
44
|
+
*
|
|
45
|
+
* ```tsx
|
|
46
|
+
* <Separator />
|
|
47
|
+
* <Separator orientation="vertical" />
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* A vertical separator has no length of its own — it is an empty box. Inside a
|
|
51
|
+
* flex row it stretches to the tallest sibling; anywhere else it falls back to
|
|
52
|
+
* one line's height, which `--forte-separator-min-length` controls. That is the
|
|
53
|
+
* one thing worth knowing before reaching for it:
|
|
54
|
+
*
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <div style={{ display: "flex", alignItems: "center", gap: "var(--forte-space-3)" }}>
|
|
57
|
+
* <span>Draft</span>
|
|
58
|
+
* <Separator orientation="vertical" />
|
|
59
|
+
* <span>Edited 3m ago</span>
|
|
60
|
+
* </div>
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* In prose, swap the element for the one HTML already has for this:
|
|
64
|
+
*
|
|
65
|
+
* ```tsx
|
|
66
|
+
* <Separator render={<hr />} />
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* Every visual decision is a `--forte-separator-*` custom property, and the
|
|
70
|
+
* orientation is on `data-orientation`, so it can be re-skinned from plain CSS
|
|
71
|
+
* or targeted with Tailwind arbitrary variants
|
|
72
|
+
* (`data-[orientation=vertical]:...`) without wrapping.
|
|
73
|
+
*/
|
|
74
|
+
export declare const Separator: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type SkeletonVariant = "rect" | "text" | "circle";
|
|
3
|
+
export type SkeletonAnimation = "pulse" | "shimmer" | "none";
|
|
4
|
+
/**
|
|
5
|
+
* A CSS length. A bare number is pixels, which is the one place in this
|
|
6
|
+
* library a raw pixel value is reasonable: it is the consumer's measurement of
|
|
7
|
+
* their own content, not a design decision baked into the component.
|
|
8
|
+
*/
|
|
9
|
+
type SkeletonLength = string | number;
|
|
10
|
+
export interface SkeletonRootProps extends Omit<React.ComponentPropsWithoutRef<"span">, "className"> {
|
|
11
|
+
/**
|
|
12
|
+
* The silhouette. `rect` is a block — a thumbnail, a card, a button.
|
|
13
|
+
* `circle` is an avatar or a status dot, and stays round under
|
|
14
|
+
* `data-forte-radius="none"`.
|
|
15
|
+
*
|
|
16
|
+
* `text` is a thin bar the height of the ink a line of text actually puts
|
|
17
|
+
* down, and it is `inline-block`, so it can sit inside a real sentence —
|
|
18
|
+
* "posted by ▓▓▓▓ an hour ago". Note that it paints the ink and nothing
|
|
19
|
+
* else: standing on its own in a column it is SHORTER than the line it
|
|
20
|
+
* replaces, because the leading is missing. Reach for `Skeleton.Text` there,
|
|
21
|
+
* `lines={1}` included — reserving the whole line box is exactly what it is
|
|
22
|
+
* for.
|
|
23
|
+
* @default "rect"
|
|
24
|
+
*/
|
|
25
|
+
variant?: SkeletonVariant;
|
|
26
|
+
/**
|
|
27
|
+
* How the placeholder signals that it is a placeholder.
|
|
28
|
+
*
|
|
29
|
+
* `pulse` is a shallow opacity breathe — quiet, and identical whichever way
|
|
30
|
+
* it is laid out. `shimmer` sends a band of light across the fill, which
|
|
31
|
+
* reads as faster and suits a screenful of placeholders; it follows the
|
|
32
|
+
* reading direction, and degrades into `pulse` under reduced motion.
|
|
33
|
+
* `none` is a static fill, for a screenshot test or a page where something
|
|
34
|
+
* else already owns the movement.
|
|
35
|
+
*
|
|
36
|
+
* Falls back to the enclosing `Skeleton.Group`, then to `pulse`.
|
|
37
|
+
* @default "pulse"
|
|
38
|
+
*/
|
|
39
|
+
animation?: SkeletonAnimation;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the placeholder is showing. When it flips to `false` the skeleton
|
|
42
|
+
* renders `children` — with no wrapper of its own, so nothing of the
|
|
43
|
+
* placeholder is left in the DOM or in the layout.
|
|
44
|
+
*
|
|
45
|
+
* Falls back to the enclosing `Skeleton.Group`, then to `true`.
|
|
46
|
+
* @default true
|
|
47
|
+
*/
|
|
48
|
+
loading?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Width of the placeholder. A number is pixels; a string is any CSS length,
|
|
51
|
+
* including a percentage.
|
|
52
|
+
*
|
|
53
|
+
* Optional in every sense — `className="w-24"` does the same job and wins
|
|
54
|
+
* over this, and with `children` present the content decides.
|
|
55
|
+
*/
|
|
56
|
+
width?: SkeletonLength;
|
|
57
|
+
/**
|
|
58
|
+
* Height of the placeholder. A number is pixels; a string is any CSS length.
|
|
59
|
+
*
|
|
60
|
+
* The default is one line box at the inherited font size, so a skeleton
|
|
61
|
+
* standing in for a line of text needs no measurement at all.
|
|
62
|
+
*/
|
|
63
|
+
height?: SkeletonLength;
|
|
64
|
+
/**
|
|
65
|
+
* The real content, used only to SIZE the placeholder.
|
|
66
|
+
*
|
|
67
|
+
* While loading it is laid out and then hidden with `visibility`, so the
|
|
68
|
+
* skeleton is exactly the box the content will occupy and nothing shifts
|
|
69
|
+
* when it arrives. Note that this renders the content — pass a string or a
|
|
70
|
+
* cheap node, not a subtree you would rather not mount twice.
|
|
71
|
+
*/
|
|
72
|
+
children?: React.ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
75
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
76
|
+
*/
|
|
77
|
+
className?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface SkeletonTextProps extends Omit<React.ComponentPropsWithoutRef<"span">, "className" | "children"> {
|
|
80
|
+
/**
|
|
81
|
+
* How many lines to draw. The block is exactly as tall as that many lines of
|
|
82
|
+
* real text at the inherited font size, so swapping it for the paragraph
|
|
83
|
+
* moves nothing below it.
|
|
84
|
+
* @default 3
|
|
85
|
+
*/
|
|
86
|
+
lines?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Width of the last line. Real paragraphs end mid-line, and a block of
|
|
89
|
+
* equal-length bars reads as a table rather than as prose. Any CSS length; a
|
|
90
|
+
* number is pixels.
|
|
91
|
+
* @default "60%"
|
|
92
|
+
*/
|
|
93
|
+
lastLineWidth?: SkeletonLength;
|
|
94
|
+
/** See `Skeleton.Root`. Falls back to the enclosing group, then `pulse`. */
|
|
95
|
+
animation?: SkeletonAnimation;
|
|
96
|
+
/** See `Skeleton.Root`. Falls back to the enclosing group, then `true`. */
|
|
97
|
+
loading?: boolean;
|
|
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 SkeletonGroupProps extends Omit<React.ComponentPropsWithoutRef<"div">, "className"> {
|
|
105
|
+
/**
|
|
106
|
+
* Whether the region is still loading. Sets `aria-busy`, swaps the announced
|
|
107
|
+
* message, and becomes the default for every skeleton inside.
|
|
108
|
+
* @default true
|
|
109
|
+
*/
|
|
110
|
+
loading?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* What is being waited for. This is the only thing a screen reader gets —
|
|
113
|
+
* the placeholders themselves are `aria-hidden`, because a picture of
|
|
114
|
+
* absence is not information.
|
|
115
|
+
*
|
|
116
|
+
* Say what is coming rather than that something is: "Loading invoices" tells
|
|
117
|
+
* someone whether the wait concerns them; "Loading" makes them guess.
|
|
118
|
+
* @default "Loading"
|
|
119
|
+
*/
|
|
120
|
+
label?: string;
|
|
121
|
+
/**
|
|
122
|
+
* What to announce once `loading` turns false. Left unset, the region simply
|
|
123
|
+
* goes quiet — which is the right default when the content that arrives is
|
|
124
|
+
* itself obvious, and the wrong one when the user is waiting on a background
|
|
125
|
+
* refresh they cannot see.
|
|
126
|
+
*/
|
|
127
|
+
doneLabel?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Default animation for every skeleton in the group. A skeleton that sets
|
|
130
|
+
* its own still wins.
|
|
131
|
+
* @default "pulse"
|
|
132
|
+
*/
|
|
133
|
+
animation?: SkeletonAnimation;
|
|
134
|
+
/**
|
|
135
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
136
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
137
|
+
*/
|
|
138
|
+
className?: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* A placeholder that occupies exactly the space the real thing will.
|
|
142
|
+
*
|
|
143
|
+
* Base UI has no skeleton primitive — there is no interaction to model and no
|
|
144
|
+
* state machine to get right — so this is one of the few components in the
|
|
145
|
+
* library not built on one. What is left is the part that is usually got
|
|
146
|
+
* wrong: metrics that actually match the content, so the page does not jump
|
|
147
|
+
* when the data lands; one announcement for one wait; and an animation that
|
|
148
|
+
* stays a "this is coming" cue when the user has asked for less motion,
|
|
149
|
+
* instead of freezing into something that reads as content that failed.
|
|
150
|
+
*
|
|
151
|
+
* ```tsx
|
|
152
|
+
* <Skeleton.Group loading={pending} label="Loading profile">
|
|
153
|
+
* <div className="flex items-center gap-3">
|
|
154
|
+
* <Skeleton.Root variant="circle" width="2.5rem" />
|
|
155
|
+
* <Skeleton.Text lines={2} className="w-48" />
|
|
156
|
+
* </div>
|
|
157
|
+
* </Skeleton.Group>
|
|
158
|
+
* ```
|
|
159
|
+
*
|
|
160
|
+
* Styling is driven by `data-*` attributes and `--forte-skeleton-*` custom
|
|
161
|
+
* properties, so it can be re-skinned from plain CSS or targeted with Tailwind
|
|
162
|
+
* arbitrary variants (`data-[variant=circle]:...`) without wrapping.
|
|
163
|
+
*/
|
|
164
|
+
export declare const Skeleton: {
|
|
165
|
+
Root: React.ForwardRefExoticComponent<SkeletonRootProps & React.RefAttributes<HTMLSpanElement>>;
|
|
166
|
+
Text: React.ForwardRefExoticComponent<SkeletonTextProps & React.RefAttributes<HTMLSpanElement>>;
|
|
167
|
+
Group: React.ForwardRefExoticComponent<SkeletonGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
168
|
+
};
|
|
169
|
+
export {};
|