@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,351 @@
|
|
|
1
|
+
import { Drawer as BaseDrawer, DrawerRootProps as BaseDrawerRootProps, DrawerTriggerProps as BaseDrawerTriggerProps, DrawerPopupProps as BaseDrawerPopupProps, DrawerPortalProps as BaseDrawerPortalProps, DrawerContentProps as BaseDrawerContentProps, DrawerTitleProps as BaseDrawerTitleProps, DrawerDescriptionProps as BaseDrawerDescriptionProps, DrawerCloseProps as BaseDrawerCloseProps, DrawerSwipeAreaProps as BaseDrawerSwipeAreaProps, DrawerVirtualKeyboardProviderProps as BaseDrawerVirtualKeyboardProviderProps } from '@base-ui/react/drawer';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type DrawerSide = "top" | "right" | "bottom" | "left";
|
|
4
|
+
export type DrawerSize = "sm" | "md" | "lg" | "full";
|
|
5
|
+
export type DrawerVariant = "edge" | "floating";
|
|
6
|
+
export type DrawerFooterAlign = "start" | "center" | "end" | "between";
|
|
7
|
+
/**
|
|
8
|
+
* One height a `top`/`bottom` drawer can settle at — a fraction of the
|
|
9
|
+
* viewport (0 to 1), a pixel count (above 1), or a string carrying its own
|
|
10
|
+
* `px`/`rem` unit.
|
|
11
|
+
*
|
|
12
|
+
* Derived from Base UI's own prop rather than restated, so a change there
|
|
13
|
+
* surfaces here as a type error instead of as a runtime surprise.
|
|
14
|
+
*/
|
|
15
|
+
export type DrawerSnapPoint = NonNullable<BaseDrawerRootProps["snapPoints"]>[number];
|
|
16
|
+
export interface DrawerRootProps<Payload = unknown> extends Omit<BaseDrawerRootProps<Payload>, "swipeDirection"> {
|
|
17
|
+
/**
|
|
18
|
+
* Which edge of the viewport the drawer slides in from. It also decides the
|
|
19
|
+
* direction of the dismiss gesture, which is why it lives on `Root` rather
|
|
20
|
+
* than on `Popup`.
|
|
21
|
+
*
|
|
22
|
+
* Physical, not logical: `translate` has no logical form, and Base UI's
|
|
23
|
+
* swipe direction is physical too. An RTL layout that wants its navigation
|
|
24
|
+
* on the leading edge should say `side="right"` for that layout.
|
|
25
|
+
* @default "right"
|
|
26
|
+
*/
|
|
27
|
+
side?: DrawerSide;
|
|
28
|
+
/**
|
|
29
|
+
* Allow dragging the drawer to dismiss it. Turning it off keeps the drawer
|
|
30
|
+
* fully usable — trigger, Escape, outside press and `Drawer.Close` all still
|
|
31
|
+
* work — and only removes the gesture.
|
|
32
|
+
*
|
|
33
|
+
* Leave it on for anything that reaches a touch screen: a drag toward the
|
|
34
|
+
* edge is how a drawer is expected to close there, and on a large phone it
|
|
35
|
+
* is the only dismissal within reach of one thumb.
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
swipe?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Heights a `side="top"` or `side="bottom"` drawer settles at. Numbers
|
|
41
|
+
* between 0 and 1 are fractions of the viewport, numbers above 1 are pixels,
|
|
42
|
+
* and strings carry their own `px`/`rem` unit — `["148px", 1]` is the usual
|
|
43
|
+
* peek-then-full pair.
|
|
44
|
+
*
|
|
45
|
+
* Ignored for `side="left"` and `side="right"`, which have no snap axis.
|
|
46
|
+
*/
|
|
47
|
+
snapPoints?: BaseDrawerRootProps<Payload>["snapPoints"];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Groups all parts of a drawer and owns its open state.
|
|
51
|
+
*
|
|
52
|
+
* Renders no DOM element, so it takes no `className`, `style` or `ref` —
|
|
53
|
+
* style `Drawer.Popup` instead. Every Base UI `Drawer.Root` prop is forwarded
|
|
54
|
+
* unchanged (`open`, `defaultOpen`, `onOpenChange`, `onOpenChangeComplete`,
|
|
55
|
+
* `modal`, `disablePointerDismissal`, `actionsRef`, `handle`, `triggerId`,
|
|
56
|
+
* `defaultTriggerId`, `snapPoints`, `snapPoint`, `onSnapPointChange`,
|
|
57
|
+
* `snapToSequentialPoints`) except `swipeDirection`, which `side` replaces.
|
|
58
|
+
*/
|
|
59
|
+
export declare function DrawerRoot<Payload>({ side, swipe, snapPoints, modal, ...props }: DrawerRootProps<Payload>): React.JSX.Element;
|
|
60
|
+
export interface DrawerTriggerProps<Payload = unknown> extends Omit<BaseDrawerTriggerProps<Payload>, "className"> {
|
|
61
|
+
/**
|
|
62
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
63
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
64
|
+
*/
|
|
65
|
+
className?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* `React.forwardRef` erases generics, so the exported value is re-typed with
|
|
69
|
+
* a generic call signature — the same shape Base UI itself exports — to keep
|
|
70
|
+
* `payload` and `handle` inferring together.
|
|
71
|
+
*/
|
|
72
|
+
interface DrawerTriggerComponent {
|
|
73
|
+
<Payload>(props: DrawerTriggerProps<Payload>): React.JSX.Element;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A button that opens the drawer.
|
|
77
|
+
*
|
|
78
|
+
* Renders a `<button>`. Pass `render={<Button />}` to compose it with a
|
|
79
|
+
* styled button — the trigger's own neutral styling steps aside when `render`
|
|
80
|
+
* is present, so the two never fight over the cascade.
|
|
81
|
+
*/
|
|
82
|
+
export declare const DrawerTrigger: DrawerTriggerComponent;
|
|
83
|
+
export interface DrawerPopupProps extends Omit<BaseDrawerPopupProps, "className"> {
|
|
84
|
+
/**
|
|
85
|
+
* How far the drawer extends along its own axis — width for `left`/`right`,
|
|
86
|
+
* height for `top`/`bottom`. `"full"` covers the whole viewport.
|
|
87
|
+
*
|
|
88
|
+
* On `top`/`bottom` this is a *maximum*: a short sheet is only as tall as
|
|
89
|
+
* its content, which is what a bottom sheet should do.
|
|
90
|
+
* @default "md"
|
|
91
|
+
*/
|
|
92
|
+
size?: DrawerSize;
|
|
93
|
+
/**
|
|
94
|
+
* `"edge"` sits flush against the side of the screen and rounds only its
|
|
95
|
+
* two inner corners. `"floating"` insets the whole surface by
|
|
96
|
+
* `--forte-drawer-inset` and rounds all four, so the page shows through
|
|
97
|
+
* around it.
|
|
98
|
+
* @default "edge"
|
|
99
|
+
*/
|
|
100
|
+
variant?: DrawerVariant;
|
|
101
|
+
/**
|
|
102
|
+
* Keep the portal — and therefore the popup — in the DOM while the drawer
|
|
103
|
+
* is closed. Needed when something inside must stay mounted (an iframe, a
|
|
104
|
+
* media element, uncommitted form state).
|
|
105
|
+
* @default false
|
|
106
|
+
*/
|
|
107
|
+
keepMounted?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Element the portal renders into. Defaults to `document.body`; set it when
|
|
110
|
+
* the drawer must live inside a specific stacking or shadow root.
|
|
111
|
+
*/
|
|
112
|
+
container?: BaseDrawerPortalProps["container"];
|
|
113
|
+
/**
|
|
114
|
+
* Render the scrim behind the drawer. Turn it off for a non-modal drawer
|
|
115
|
+
* that should leave the page visibly usable.
|
|
116
|
+
* @default true
|
|
117
|
+
*/
|
|
118
|
+
backdrop?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Render the backdrop even when this drawer is nested inside another one.
|
|
121
|
+
* Base UI suppresses nested backdrops by default — the parent recedes and
|
|
122
|
+
* dims itself instead — so only set this when a nested drawer genuinely
|
|
123
|
+
* needs its own scrim.
|
|
124
|
+
* @default false
|
|
125
|
+
*/
|
|
126
|
+
forceBackdrop?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Additional class name(s) for the backdrop element. The popup's own
|
|
129
|
+
* `className` cannot reach it, since the backdrop is a sibling rendered
|
|
130
|
+
* inside this component.
|
|
131
|
+
*/
|
|
132
|
+
backdropClassName?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Additional class name(s) for the fixed container the popup is placed in.
|
|
135
|
+
* It owns `--forte-drawer-z-index` and `--forte-drawer-inset` — the popup reads
|
|
136
|
+
* the inset from here by inheritance, so setting it once on the viewport
|
|
137
|
+
* keeps the surface and the gap around it in agreement.
|
|
138
|
+
*/
|
|
139
|
+
viewportClassName?: string;
|
|
140
|
+
/**
|
|
141
|
+
* Additional class name(s) for the popup itself. Applied after the internal
|
|
142
|
+
* styles so consumer utilities (e.g. Tailwind) win without needing
|
|
143
|
+
* `!important`.
|
|
144
|
+
*/
|
|
145
|
+
className?: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The drawer surface, together with the three wrappers it always needs:
|
|
149
|
+
* `Portal` → `Backdrop` + `Viewport` → `Popup`. Collapsing them into one
|
|
150
|
+
* component keeps the common case to a single element while leaving every
|
|
151
|
+
* Base UI `Popup` prop (`initialFocus`, `finalFocus`, `render`, …) available.
|
|
152
|
+
*
|
|
153
|
+
* `Title`, `Description` and `Close` must be rendered *inside* this
|
|
154
|
+
* component: that is what auto-wires `aria-labelledby` / `aria-describedby`,
|
|
155
|
+
* and a close button outside the popup is unreachable to touch screen-reader
|
|
156
|
+
* users.
|
|
157
|
+
*
|
|
158
|
+
* Scrolling belongs to `Drawer.Content`, not to this element; the popup keeps
|
|
159
|
+
* only a fallback `overflow` for drawers built without one. Base UI takes the
|
|
160
|
+
* first scrollable ancestor of wherever the gesture started, so a swipe still
|
|
161
|
+
* waits for that scroll to reach its end.
|
|
162
|
+
*/
|
|
163
|
+
export declare const DrawerPopup: React.ForwardRefExoticComponent<Omit<DrawerPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
164
|
+
export interface DrawerHandleProps extends Omit<React.ComponentPropsWithoutRef<"div">, "className"> {
|
|
165
|
+
/**
|
|
166
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
167
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
168
|
+
*/
|
|
169
|
+
className?: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The grab bar that advertises the drag gesture.
|
|
173
|
+
*
|
|
174
|
+
* A decorative `<div>`, hidden from assistive technology: it is a picture of
|
|
175
|
+
* an affordance, not a control, and the gesture it describes is never the
|
|
176
|
+
* only way out of a drawer. Give the drawer a `Drawer.Close` as well.
|
|
177
|
+
*
|
|
178
|
+
* Keep it *outside* `Drawer.Content`. Content deliberately swallows mouse
|
|
179
|
+
* drags so text stays selectable, so a handle placed inside it could not be
|
|
180
|
+
* dragged with a mouse — which is the one input that has no other way to
|
|
181
|
+
* start the gesture.
|
|
182
|
+
*/
|
|
183
|
+
export declare const DrawerHandle: React.ForwardRefExoticComponent<DrawerHandleProps & React.RefAttributes<HTMLDivElement>>;
|
|
184
|
+
export interface DrawerContentProps extends Omit<BaseDrawerContentProps, "className"> {
|
|
185
|
+
/**
|
|
186
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
187
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
188
|
+
*/
|
|
189
|
+
className?: string;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* The drawer's body.
|
|
193
|
+
*
|
|
194
|
+
* Renders a `<div>` that Base UI marks as content, which exempts it from
|
|
195
|
+
* *mouse* dragging — a press-and-drag over this region selects text instead
|
|
196
|
+
* of pulling the drawer. Touch dragging is unaffected, so the gesture still
|
|
197
|
+
* works where it matters.
|
|
198
|
+
*
|
|
199
|
+
* It is also the drawer's scroll container, which is what keeps a
|
|
200
|
+
* `Drawer.Handle` from scrolling away and lets a `Drawer.Footer` placed
|
|
201
|
+
* *outside* it pin to the bottom of the drawer.
|
|
202
|
+
*
|
|
203
|
+
* On a `top`/`bottom` drawer it caps and centres its own width through
|
|
204
|
+
* `--forte-drawer-content-max-inline-size`, which is what keeps a full-width
|
|
205
|
+
* bottom sheet from running its text to both edges of a wide screen.
|
|
206
|
+
*/
|
|
207
|
+
export declare const DrawerContent: React.ForwardRefExoticComponent<Omit<DrawerContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
208
|
+
export interface DrawerTitleProps extends Omit<BaseDrawerTitleProps, "className"> {
|
|
209
|
+
/**
|
|
210
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
211
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
212
|
+
*/
|
|
213
|
+
className?: string;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* The drawer's accessible name.
|
|
217
|
+
*
|
|
218
|
+
* Renders an `<h2>`. Inside `Drawer.Popup` it is wired up as the popup's
|
|
219
|
+
* `aria-labelledby` automatically; every drawer should have one.
|
|
220
|
+
*/
|
|
221
|
+
export declare const DrawerTitle: React.ForwardRefExoticComponent<Omit<DrawerTitleProps, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
222
|
+
export interface DrawerDescriptionProps extends Omit<BaseDrawerDescriptionProps, "className"> {
|
|
223
|
+
/**
|
|
224
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
225
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
226
|
+
*/
|
|
227
|
+
className?: string;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* A short explanation of what the drawer is for.
|
|
231
|
+
*
|
|
232
|
+
* Renders a `<p>`. Inside `Drawer.Popup` it becomes the popup's
|
|
233
|
+
* `aria-describedby`, so it is announced after the title.
|
|
234
|
+
*/
|
|
235
|
+
export declare const DrawerDescription: React.ForwardRefExoticComponent<Omit<DrawerDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
236
|
+
export interface DrawerCloseProps extends Omit<BaseDrawerCloseProps, "className"> {
|
|
237
|
+
/**
|
|
238
|
+
* Render as a square button sized for a single icon — the corner "×"
|
|
239
|
+
* treatment. Enforces the 24px minimum hit target from WCAG SC 2.5.8.
|
|
240
|
+
* Always pair with `aria-label`, since there is no text to announce.
|
|
241
|
+
* @default false
|
|
242
|
+
*/
|
|
243
|
+
iconOnly?: boolean;
|
|
244
|
+
/**
|
|
245
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
246
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
247
|
+
*/
|
|
248
|
+
className?: string;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* A button that closes the drawer.
|
|
252
|
+
*
|
|
253
|
+
* Renders a `<button>`. Keep it inside `Drawer.Popup`: in a modal drawer the
|
|
254
|
+
* rest of the page is inert, and a touch screen-reader user has no other way
|
|
255
|
+
* out — the swipe gesture is not available to them. Pass `render={<Button />}`
|
|
256
|
+
* to compose it with a styled button.
|
|
257
|
+
*/
|
|
258
|
+
export declare const DrawerClose: React.ForwardRefExoticComponent<Omit<DrawerCloseProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
259
|
+
export interface DrawerFooterProps extends Omit<React.ComponentPropsWithoutRef<"div">, "className"> {
|
|
260
|
+
/**
|
|
261
|
+
* How the actions are distributed along the footer. `"between"` is the
|
|
262
|
+
* pattern for a destructive action pushed away from the safe one.
|
|
263
|
+
* @default "end"
|
|
264
|
+
*/
|
|
265
|
+
align?: DrawerFooterAlign;
|
|
266
|
+
/**
|
|
267
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
268
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
269
|
+
*/
|
|
270
|
+
className?: string;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* The action row at the bottom of a drawer.
|
|
274
|
+
*
|
|
275
|
+
* A plain `<div>` — not a Base UI part — that supplies the standard spacing
|
|
276
|
+
* and alignment for the confirm/cancel buttons.
|
|
277
|
+
*/
|
|
278
|
+
export declare const DrawerFooter: React.ForwardRefExoticComponent<DrawerFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
279
|
+
export interface DrawerSwipeAreaProps extends Omit<BaseDrawerSwipeAreaProps, "className"> {
|
|
280
|
+
/**
|
|
281
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
282
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
283
|
+
*/
|
|
284
|
+
className?: string;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* An invisible strip along the drawer's own edge that opens it when swiped
|
|
288
|
+
* inward.
|
|
289
|
+
*
|
|
290
|
+
* Renders a `<div>`, pinned with `position: fixed` and sized by
|
|
291
|
+
* `--forte-drawer-swipe-area-size`. It sits *outside* the portal — it has to
|
|
292
|
+
* exist while the drawer is closed — so it is the one part that lives beside
|
|
293
|
+
* `Drawer.Trigger` rather than inside `Drawer.Popup`.
|
|
294
|
+
*
|
|
295
|
+
* It covers that strip of the page for pointer purposes, so anything the app
|
|
296
|
+
* puts hard against that edge becomes unreachable. Pair it with a real
|
|
297
|
+
* trigger; a gesture with no visible control is undiscoverable, and it is not
|
|
298
|
+
* available to a keyboard or screen-reader user at all.
|
|
299
|
+
*/
|
|
300
|
+
export declare const DrawerSwipeArea: React.ForwardRefExoticComponent<Omit<DrawerSwipeAreaProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
301
|
+
export type DrawerVirtualKeyboardProviderProps = BaseDrawerVirtualKeyboardProviderProps;
|
|
302
|
+
/**
|
|
303
|
+
* Makes a drawer aware of the software keyboard.
|
|
304
|
+
*
|
|
305
|
+
* Renders no DOM element. Wrap a `top`/`bottom` drawer that contains text
|
|
306
|
+
* fields in it: the viewport then publishes `--drawer-keyboard-inset`, which
|
|
307
|
+
* this component's stylesheet adds to the viewport's bottom padding, so the
|
|
308
|
+
* sheet rides above the keyboard instead of behind it. Drawers without it are
|
|
309
|
+
* unaffected.
|
|
310
|
+
*/
|
|
311
|
+
export declare function DrawerVirtualKeyboardProvider(props: DrawerVirtualKeyboardProviderProps): React.JSX.Element;
|
|
312
|
+
/**
|
|
313
|
+
* A panel that slides in from an edge of the screen, built on Base UI's
|
|
314
|
+
* `Drawer`.
|
|
315
|
+
*
|
|
316
|
+
* ```tsx
|
|
317
|
+
* <Drawer.Root side="right">
|
|
318
|
+
* <Drawer.Trigger render={<Button />}>Filters</Drawer.Trigger>
|
|
319
|
+
* <Drawer.Popup>
|
|
320
|
+
* <Drawer.Content>
|
|
321
|
+
* <Drawer.Title>Filters</Drawer.Title>
|
|
322
|
+
* <Drawer.Description>Narrow the result list.</Drawer.Description>
|
|
323
|
+
* <Drawer.Footer>
|
|
324
|
+
* <Drawer.Close render={<Button />}>Apply</Drawer.Close>
|
|
325
|
+
* </Drawer.Footer>
|
|
326
|
+
* </Drawer.Content>
|
|
327
|
+
* </Drawer.Popup>
|
|
328
|
+
* </Drawer.Root>
|
|
329
|
+
* ```
|
|
330
|
+
*
|
|
331
|
+
* Use it for content that belongs beside the page rather than on top of it —
|
|
332
|
+
* navigation, filters, a detail panel, a mobile action sheet. When the task
|
|
333
|
+
* needs the user's whole attention and has no relationship to a screen edge,
|
|
334
|
+
* reach for `Dialog`.
|
|
335
|
+
*/
|
|
336
|
+
export declare const Drawer: {
|
|
337
|
+
Root: typeof DrawerRoot;
|
|
338
|
+
Trigger: DrawerTriggerComponent;
|
|
339
|
+
Popup: React.ForwardRefExoticComponent<Omit<DrawerPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
340
|
+
Handle: React.ForwardRefExoticComponent<DrawerHandleProps & React.RefAttributes<HTMLDivElement>>;
|
|
341
|
+
Content: React.ForwardRefExoticComponent<Omit<DrawerContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
342
|
+
Title: React.ForwardRefExoticComponent<Omit<DrawerTitleProps, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
343
|
+
Description: React.ForwardRefExoticComponent<Omit<DrawerDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
344
|
+
Close: React.ForwardRefExoticComponent<Omit<DrawerCloseProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
345
|
+
Footer: React.ForwardRefExoticComponent<DrawerFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
346
|
+
SwipeArea: React.ForwardRefExoticComponent<Omit<DrawerSwipeAreaProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
347
|
+
VirtualKeyboardProvider: typeof DrawerVirtualKeyboardProvider;
|
|
348
|
+
/** Creates a handle that connects a `Drawer.Root` to detached triggers. */
|
|
349
|
+
createHandle: typeof BaseDrawer.createHandle;
|
|
350
|
+
};
|
|
351
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "../../Drawer-DKQF3OO7.js";
|
|
3
|
+
export { u as Drawer, o as DrawerClose, c as DrawerContent, i as DrawerDescription, e as DrawerFooter, s as DrawerHandle, l as DrawerPopup, t as DrawerRoot, a as DrawerSwipeArea, d as DrawerTitle, n as DrawerTrigger, r as DrawerVirtualKeyboardProvider };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { Drawer } from './Drawer';
|
|
2
|
+
export type { DrawerSide, DrawerSize, DrawerVariant, DrawerSnapPoint, DrawerFooterAlign, DrawerRootProps, DrawerTriggerProps, DrawerPopupProps, DrawerHandleProps, DrawerContentProps, DrawerTitleProps, DrawerDescriptionProps, DrawerCloseProps, DrawerFooterProps, DrawerSwipeAreaProps, DrawerVirtualKeyboardProviderProps, } from './Drawer';
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { Field as BaseField } from '@base-ui/react/field';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type BaseRootProps = React.ComponentPropsWithoutRef<typeof BaseField.Root>;
|
|
4
|
+
export interface FieldRootProps extends Omit<BaseRootProps, "className"> {
|
|
5
|
+
/**
|
|
6
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
7
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
8
|
+
*/
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Groups one control with its label, description and error message, and owns
|
|
13
|
+
* the validation state they all read. Renders a `<div>` laid out as a column.
|
|
14
|
+
*
|
|
15
|
+
* The control is any Base UI form component — `Input`, `Checkbox`, `Switch`,
|
|
16
|
+
* `Select` — and none of them need wiring: the field supplies the id the label
|
|
17
|
+
* points at, the `aria-describedby` linking description and error, and the
|
|
18
|
+
* `name` used on submit. Give `name` to the field rather than to the control,
|
|
19
|
+
* so `<Form onFormSubmit>` and server-returned `errors` can find it.
|
|
20
|
+
*
|
|
21
|
+
* The column stretches its children, which is why an `Input` inside a field is
|
|
22
|
+
* full width without `fullWidth`.
|
|
23
|
+
*/
|
|
24
|
+
export declare const FieldRoot: React.ForwardRefExoticComponent<FieldRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
type BaseLabelProps = React.ComponentPropsWithoutRef<typeof BaseField.Label>;
|
|
26
|
+
export interface FieldLabelProps extends Omit<BaseLabelProps, "className"> {
|
|
27
|
+
/**
|
|
28
|
+
* Whether the rendered element is a native `<label>`.
|
|
29
|
+
*
|
|
30
|
+
* Leave it `true` for `Input`, `Checkbox` and `Switch`. Set it to `false`
|
|
31
|
+
* for a control that is a `<button>` — `Select.Trigger` is the one in this
|
|
32
|
+
* library — where native label behaviour is actively wrong: the button would
|
|
33
|
+
* pick up `:hover` from the label, and clicking the label would fire a click
|
|
34
|
+
* on the trigger and open the popup. With `false` the association is made
|
|
35
|
+
* with `aria-labelledby` instead, and the element rendered defaults to a
|
|
36
|
+
* `<div>` so the pair stays consistent (Base UI logs an error in development
|
|
37
|
+
* if a `<label>` is rendered with `nativeLabel={false}`, or vice versa).
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
nativeLabel?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
43
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
44
|
+
*/
|
|
45
|
+
className?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The field's visible label, associated with the control automatically.
|
|
49
|
+
* Renders a `<label>` — or a `<div>` when `nativeLabel` is `false`.
|
|
50
|
+
*
|
|
51
|
+
* Both labelling shapes work, and the difference is only where the control
|
|
52
|
+
* sits:
|
|
53
|
+
*
|
|
54
|
+
* ```tsx
|
|
55
|
+
* // Sibling: the label points at the control with htmlFor.
|
|
56
|
+
* <Field.Label>Email</Field.Label>
|
|
57
|
+
* <Input type="email" />
|
|
58
|
+
*
|
|
59
|
+
* // Wrapping: the label contains the control. Preferred for a Checkbox or a
|
|
60
|
+
* // Switch, which have no text of their own.
|
|
61
|
+
* <Field.Label><Checkbox /> Email me about releases</Field.Label>
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* A wrapping label lays itself out as a row and takes a `pointer` cursor,
|
|
65
|
+
* because clicking it toggles the control; a sibling label is chrome and keeps
|
|
66
|
+
* the default arrow.
|
|
67
|
+
*/
|
|
68
|
+
export declare const FieldLabel: React.ForwardRefExoticComponent<FieldLabelProps & React.RefAttributes<HTMLElement>>;
|
|
69
|
+
type BaseDescriptionProps = React.ComponentPropsWithoutRef<typeof BaseField.Description>;
|
|
70
|
+
export interface FieldDescriptionProps extends Omit<BaseDescriptionProps, "className"> {
|
|
71
|
+
/**
|
|
72
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
73
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
74
|
+
*/
|
|
75
|
+
className?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Supporting text for the field. Renders a `<p>` wired into the control's
|
|
79
|
+
* `aria-describedby`, so it is announced with the control rather than being
|
|
80
|
+
* stray text next to it.
|
|
81
|
+
*
|
|
82
|
+
* Put the format hint here, not in the placeholder — a placeholder disappears
|
|
83
|
+
* the moment the user starts typing, which is exactly when the hint is needed.
|
|
84
|
+
*/
|
|
85
|
+
export declare const FieldDescription: React.ForwardRefExoticComponent<FieldDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
86
|
+
type BaseErrorProps = React.ComponentPropsWithoutRef<typeof BaseField.Error>;
|
|
87
|
+
export interface FieldErrorProps extends Omit<BaseErrorProps, "className"> {
|
|
88
|
+
/**
|
|
89
|
+
* Which failure to render for. Omit it to show whatever message the field
|
|
90
|
+
* currently has — the browser's own text for a native constraint, the string
|
|
91
|
+
* returned by `validate`, or the entry `<Form errors>` holds for this
|
|
92
|
+
* field's `name`. Pass a `ValidityState` key (`"valueMissing"`,
|
|
93
|
+
* `"typeMismatch"`, `"patternMismatch"`, …) to render only for that one
|
|
94
|
+
* failure, which is how you replace a browser message with your own wording.
|
|
95
|
+
* Pass `true` to always render, when an external form library owns
|
|
96
|
+
* visibility.
|
|
97
|
+
*/
|
|
98
|
+
match?: BaseErrorProps["match"];
|
|
99
|
+
/**
|
|
100
|
+
* The message. Omit it and the field supplies the text itself; several
|
|
101
|
+
* failures at once arrive as a `<ul>`.
|
|
102
|
+
*/
|
|
103
|
+
children?: React.ReactNode;
|
|
104
|
+
/**
|
|
105
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
106
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
107
|
+
*/
|
|
108
|
+
className?: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The validation message. Renders a `<div>`, and only while the field is
|
|
112
|
+
* actually failing — it is unmounted otherwise, so nothing reserves space for
|
|
113
|
+
* it.
|
|
114
|
+
*
|
|
115
|
+
* Base UI keeps the outgoing element mounted until its exit transition
|
|
116
|
+
* finishes, so the message fades out with its own text rather than snapping to
|
|
117
|
+
* the next one.
|
|
118
|
+
*/
|
|
119
|
+
export declare const FieldError: React.ForwardRefExoticComponent<FieldErrorProps & React.RefAttributes<HTMLDivElement>>;
|
|
120
|
+
type BaseItemProps = React.ComponentPropsWithoutRef<typeof BaseField.Item>;
|
|
121
|
+
export interface FieldItemProps extends Omit<BaseItemProps, "className"> {
|
|
122
|
+
/**
|
|
123
|
+
* Whether this one item ignores user interaction. `disabled` on the
|
|
124
|
+
* surrounding `Field.Root` takes precedence.
|
|
125
|
+
* @default false
|
|
126
|
+
*/
|
|
127
|
+
disabled?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
130
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
131
|
+
*/
|
|
132
|
+
className?: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* One row inside a `CheckboxGroup` or radio group: a control, its own label,
|
|
136
|
+
* and optionally its own description. Renders a `<div>`.
|
|
137
|
+
*
|
|
138
|
+
* A `Field.Root` names the group as a whole; a `Field.Item` gives each member
|
|
139
|
+
* a label of its own without opening a second field.
|
|
140
|
+
*/
|
|
141
|
+
export declare const FieldItem: React.ForwardRefExoticComponent<FieldItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
142
|
+
/**
|
|
143
|
+
* A field built on Base UI's `Field` primitives.
|
|
144
|
+
*
|
|
145
|
+
* ```tsx
|
|
146
|
+
* <Field.Root name="email" validationMode="onBlur">
|
|
147
|
+
* <Field.Label>Email</Field.Label>
|
|
148
|
+
* <Input type="email" required />
|
|
149
|
+
* <Field.Description>We only use this for receipts.</Field.Description>
|
|
150
|
+
* <Field.Error match="valueMissing">An email address is required.</Field.Error>
|
|
151
|
+
* <Field.Error match="typeMismatch">That does not look like an email address.</Field.Error>
|
|
152
|
+
* </Field.Root>
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* There is no `Field.Control` here on purpose: Base UI's `Input` *is*
|
|
156
|
+
* `Field.Control`, so `<Input>` is the styled control, and `Checkbox`,
|
|
157
|
+
* `Switch` and `Select` slot in the same way with no extra part.
|
|
158
|
+
*
|
|
159
|
+
* `Field.Validity` is re-exported from Base UI unchanged — it renders no DOM
|
|
160
|
+
* of its own, it hands the raw `ValidityState` to a render function.
|
|
161
|
+
*/
|
|
162
|
+
export declare const Field: {
|
|
163
|
+
Root: React.ForwardRefExoticComponent<FieldRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
164
|
+
Label: React.ForwardRefExoticComponent<FieldLabelProps & React.RefAttributes<HTMLElement>>;
|
|
165
|
+
Description: React.ForwardRefExoticComponent<FieldDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
166
|
+
Error: React.ForwardRefExoticComponent<FieldErrorProps & React.RefAttributes<HTMLDivElement>>;
|
|
167
|
+
Item: React.ForwardRefExoticComponent<FieldItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
168
|
+
Validity: React.FC<import('@base-ui/react').FieldValidityProps>;
|
|
169
|
+
};
|
|
170
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Fieldset as BaseFieldset } from '@base-ui/react/fieldset';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type BaseRootProps = React.ComponentPropsWithoutRef<typeof BaseFieldset.Root>;
|
|
4
|
+
export interface FieldsetRootProps extends Omit<BaseRootProps, "className"> {
|
|
5
|
+
/**
|
|
6
|
+
* Disables every control inside the fieldset. This is the native
|
|
7
|
+
* `<fieldset disabled>` behaviour, so it reaches controls the library knows
|
|
8
|
+
* nothing about too.
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
14
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Groups related fields under one heading. Renders a `<fieldset>` laid out as
|
|
20
|
+
* a column, with the browser's border, padding and margins removed.
|
|
21
|
+
*
|
|
22
|
+
* Use it for a set of fields that belong together — a billing address, a group
|
|
23
|
+
* of checkboxes — not for every field. A `Field.Root` already names a single
|
|
24
|
+
* control; wrapping one in a fieldset gives it two names.
|
|
25
|
+
*/
|
|
26
|
+
export declare const FieldsetRoot: React.ForwardRefExoticComponent<FieldsetRootProps & React.RefAttributes<HTMLFieldSetElement>>;
|
|
27
|
+
type BaseLegendProps = React.ComponentPropsWithoutRef<typeof BaseFieldset.Legend>;
|
|
28
|
+
export interface FieldsetLegendProps extends Omit<BaseLegendProps, "className"> {
|
|
29
|
+
/**
|
|
30
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
31
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
32
|
+
*/
|
|
33
|
+
className?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The heading that names the fieldset. Renders a `<div>`, not a `<legend>` —
|
|
37
|
+
* Base UI associates it with `aria-labelledby` instead, which announces the
|
|
38
|
+
* same way and lays out like ordinary text.
|
|
39
|
+
*
|
|
40
|
+
* That matters: a real `<legend>` sits *in* the fieldset's border, cannot be
|
|
41
|
+
* positioned like a normal block, and drags along UA styles that differ
|
|
42
|
+
* between browsers.
|
|
43
|
+
*/
|
|
44
|
+
export declare const FieldsetLegend: React.ForwardRefExoticComponent<FieldsetLegendProps & React.RefAttributes<HTMLDivElement>>;
|
|
45
|
+
/**
|
|
46
|
+
* A fieldset built on Base UI's `Fieldset` primitives.
|
|
47
|
+
*
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <Fieldset.Root>
|
|
50
|
+
* <Fieldset.Legend>Shipping address</Fieldset.Legend>
|
|
51
|
+
* <Field.Root name="street">…</Field.Root>
|
|
52
|
+
* <Field.Root name="city">…</Field.Root>
|
|
53
|
+
* </Fieldset.Root>
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare const Fieldset: {
|
|
57
|
+
Root: React.ForwardRefExoticComponent<FieldsetRootProps & React.RefAttributes<HTMLFieldSetElement>>;
|
|
58
|
+
Legend: React.ForwardRefExoticComponent<FieldsetLegendProps & React.RefAttributes<HTMLDivElement>>;
|
|
59
|
+
};
|
|
60
|
+
export {};
|