@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,144 @@
|
|
|
1
|
+
import { Radio as BaseRadio } from '@base-ui/react/radio';
|
|
2
|
+
import { RadioGroup as BaseRadioGroup } from '@base-ui/react/radio-group';
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export type RadioSize = "sm" | "md" | "lg";
|
|
5
|
+
export type RadioTone = "primary" | "secondary" | "danger" | "neutral";
|
|
6
|
+
export type RadioGroupOrientation = "vertical" | "horizontal";
|
|
7
|
+
export interface RadioProps<Value = unknown> extends Omit<BaseRadio.Root.Props<Value>, "className" | "children"> {
|
|
8
|
+
/**
|
|
9
|
+
* The value this radio submits when it is the one selected. Matched against
|
|
10
|
+
* the group's `value`, so it has to be unique within the group. Required —
|
|
11
|
+
* a radio with no value cannot be selected.
|
|
12
|
+
*/
|
|
13
|
+
value: Value;
|
|
14
|
+
/**
|
|
15
|
+
* Size of the painted circle. The dot is derived from it rather than fixed,
|
|
16
|
+
* so it keeps its proportion at every size and when a consumer overrides
|
|
17
|
+
* `--forte-radio-size` to something off the scale.
|
|
18
|
+
* @default "md"
|
|
19
|
+
*/
|
|
20
|
+
size?: RadioSize;
|
|
21
|
+
/**
|
|
22
|
+
* Which semantic colour set the selected fill draws from. Inside a
|
|
23
|
+
* `Field.Root` an invalid field overrides this with the danger palette, so
|
|
24
|
+
* a validation error always reads as an error.
|
|
25
|
+
* @default "primary"
|
|
26
|
+
*/
|
|
27
|
+
tone?: RadioTone;
|
|
28
|
+
/**
|
|
29
|
+
* Set to `true` when `render` replaces the root with a real `<button>`.
|
|
30
|
+
* The root is a `<span>` by default so that an enclosing `<label>` stays
|
|
31
|
+
* valid HTML; for the sibling-label pattern (`<label htmlFor>` + `id`) pass
|
|
32
|
+
* `nativeButton render={<button />}` instead. With `nativeButton`, `id`
|
|
33
|
+
* lands on the root element rather than on the hidden input.
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
nativeButton?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Additional class name(s) for the indicator — the dot inside the circle.
|
|
39
|
+
* Applied after the internal styles.
|
|
40
|
+
*/
|
|
41
|
+
indicatorClassName?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
44
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
45
|
+
*/
|
|
46
|
+
className?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Ref to the root element. Declared as a prop rather than through
|
|
49
|
+
* `forwardRef` because the component is generic — a `forwardRef` wrapper
|
|
50
|
+
* would erase `Value` and with it the inference on `value`.
|
|
51
|
+
*/
|
|
52
|
+
ref?: React.Ref<HTMLElement>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* One option in a `RadioGroup`, built on Base UI's unstyled `Radio` primitive.
|
|
56
|
+
*
|
|
57
|
+
* The root renders a `<span>` plus a hidden `<input>` beside it, so it carries
|
|
58
|
+
* no accessible name of its own — wrap it in a `<label>`, pair it with a
|
|
59
|
+
* `<label htmlFor>` (see `nativeButton`), or put it inside a `Field.Item`.
|
|
60
|
+
*
|
|
61
|
+
* A radio only means anything inside a `RadioGroup`: the group owns the value,
|
|
62
|
+
* and it is what makes the set one tab stop with the arrow keys moving between
|
|
63
|
+
* options. A lone `<Radio />` renders, but nothing can ever select it.
|
|
64
|
+
*
|
|
65
|
+
* State is exposed on `data-*` attributes (`data-checked`, `data-unchecked`,
|
|
66
|
+
* `data-disabled`, `data-readonly`, and the `Field` validity attributes) on
|
|
67
|
+
* both the root and the indicator, and every visual decision is a
|
|
68
|
+
* `--forte-radio-*` custom property, so it can be re-skinned from plain CSS or
|
|
69
|
+
* targeted with Tailwind arbitrary variants (`data-[checked]:...`) without
|
|
70
|
+
* wrapping.
|
|
71
|
+
*/
|
|
72
|
+
export declare function Radio<Value = unknown>({ size, tone, indicatorClassName, className, ...props }: RadioProps<Value>): React.JSX.Element;
|
|
73
|
+
export interface RadioGroupProps<Value = unknown> extends Omit<BaseRadioGroup.Props<Value>, "className"> {
|
|
74
|
+
/**
|
|
75
|
+
* Direction the options are laid out in. Horizontal groups wrap.
|
|
76
|
+
*
|
|
77
|
+
* Layout only — it does not change the keyboard model. Base UI drives the
|
|
78
|
+
* group with all four arrow keys whichever way it is laid out, so a
|
|
79
|
+
* horizontal group still answers to Up and Down.
|
|
80
|
+
* @default "vertical"
|
|
81
|
+
*/
|
|
82
|
+
orientation?: RadioGroupOrientation;
|
|
83
|
+
/**
|
|
84
|
+
* The selected value. Pairs with `onValueChange` for a controlled group;
|
|
85
|
+
* use `defaultValue` for an uncontrolled one.
|
|
86
|
+
* @default undefined
|
|
87
|
+
*/
|
|
88
|
+
value?: Value;
|
|
89
|
+
/**
|
|
90
|
+
* The value selected on mount when uncontrolled. Leave it out for a group
|
|
91
|
+
* that starts with nothing selected — but prefer a default where one is
|
|
92
|
+
* defensible, because an empty group has no focusable option to arrow into
|
|
93
|
+
* until something is picked.
|
|
94
|
+
* @default undefined
|
|
95
|
+
*/
|
|
96
|
+
defaultValue?: Value;
|
|
97
|
+
/**
|
|
98
|
+
* Disables every radio in the group.
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
disabled?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Shows the current value but refuses to change it. Unlike `disabled` the
|
|
104
|
+
* options stay focusable and announce `aria-readonly`.
|
|
105
|
+
* @default false
|
|
106
|
+
*/
|
|
107
|
+
readOnly?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Requires a selection before the surrounding form will submit.
|
|
110
|
+
* @default false
|
|
111
|
+
*/
|
|
112
|
+
required?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Identifies the group in form submission. Inside a `Field.Root` the field's
|
|
115
|
+
* `name` is used instead, so this is only needed outside one.
|
|
116
|
+
*/
|
|
117
|
+
name?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
120
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
121
|
+
*/
|
|
122
|
+
className?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Ref to the group element. Declared as a prop rather than through
|
|
125
|
+
* `forwardRef` because the component is generic — a `forwardRef` wrapper
|
|
126
|
+
* would erase `Value` and with it the typing of `onValueChange`.
|
|
127
|
+
*/
|
|
128
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Shared state for a series of `Radio`s, built on Base UI's `RadioGroup`
|
|
132
|
+
* primitive. Renders a `<div role="radiogroup">`.
|
|
133
|
+
*
|
|
134
|
+
* Unlike `CheckboxGroup`, this is a keyboard mode as well as a state
|
|
135
|
+
* container: the whole group is a single tab stop, and the arrow keys move
|
|
136
|
+
* between options — selecting as they go, which is the native radio
|
|
137
|
+
* behaviour and the reason a radio group must never be used for choices that
|
|
138
|
+
* trigger an expensive side effect on selection.
|
|
139
|
+
*
|
|
140
|
+
* The group has no implicit accessible name — give it `aria-labelledby`
|
|
141
|
+
* pointing at a heading, name it with a `Field.Label nativeLabel={false}`, or
|
|
142
|
+
* render it inside a `Fieldset.Root` with a `Fieldset.Legend`.
|
|
143
|
+
*/
|
|
144
|
+
export declare function RadioGroup<Value = unknown>({ orientation, className, ...props }: RadioGroupProps<Value>): React.JSX.Element;
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/** Which way the panels are laid out. */
|
|
4
|
+
export type ResizableOrientation = "horizontal" | "vertical";
|
|
5
|
+
/**
|
|
6
|
+
* A size constraint: a bare number or a `"…%"` string is a percentage of the
|
|
7
|
+
* group; a `"…px"` string is an absolute length, resolved against the group's
|
|
8
|
+
* measured size whenever it is read.
|
|
9
|
+
*/
|
|
10
|
+
export type ResizableLength = number | `${number}%` | `${number}px`;
|
|
11
|
+
/** Storage for `autoSaveId`. `localStorage` and `sessionStorage` both fit. */
|
|
12
|
+
export interface ResizableStorage {
|
|
13
|
+
getItem(key: string): string | null;
|
|
14
|
+
setItem(key: string, value: string): void;
|
|
15
|
+
}
|
|
16
|
+
export interface ResizableGroupProps extends Omit<React.ComponentPropsWithoutRef<"div">, "className" | "onChange"> {
|
|
17
|
+
/**
|
|
18
|
+
* Which way the panels run. `"horizontal"` lays them out side by side with
|
|
19
|
+
* vertical handles between them; `"vertical"` stacks them.
|
|
20
|
+
* @default "horizontal"
|
|
21
|
+
*/
|
|
22
|
+
orientation?: ResizableOrientation;
|
|
23
|
+
/**
|
|
24
|
+
* How far one arrow-key press moves a handle, in percent of the group.
|
|
25
|
+
* @default 5
|
|
26
|
+
*/
|
|
27
|
+
step?: number;
|
|
28
|
+
/**
|
|
29
|
+
* How far <kbd>Page Up</kbd> / <kbd>Page Down</kbd> moves a handle, in
|
|
30
|
+
* percent of the group.
|
|
31
|
+
* @default 20
|
|
32
|
+
*/
|
|
33
|
+
largeStep?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Remember the layout under this key and restore it on the next visit.
|
|
36
|
+
* Sizes are stored positionally, so the saved layout is discarded if the
|
|
37
|
+
* number of panels has changed since.
|
|
38
|
+
*
|
|
39
|
+
* Restoration happens after mount — the server has no access to the store —
|
|
40
|
+
* so give the panels sensible `defaultSize`s as well, or the first paint is
|
|
41
|
+
* the default layout rather than the saved one.
|
|
42
|
+
*/
|
|
43
|
+
autoSaveId?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Where `autoSaveId` writes. Defaults to `localStorage`; pass
|
|
46
|
+
* `sessionStorage`, or your own two-method object, to change that.
|
|
47
|
+
* @default localStorage
|
|
48
|
+
*/
|
|
49
|
+
storage?: ResizableStorage;
|
|
50
|
+
/**
|
|
51
|
+
* Called with every panel's size, in percent and in DOM order, whenever the
|
|
52
|
+
* layout changes — including the first time it settles.
|
|
53
|
+
*/
|
|
54
|
+
onLayout?: (sizes: number[]) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Replaces the rendered `<div>` with another element or component.
|
|
57
|
+
*/
|
|
58
|
+
render?: useRender.RenderProp;
|
|
59
|
+
/**
|
|
60
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
61
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
62
|
+
*/
|
|
63
|
+
className?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The container. Owns the layout: every panel's size lives here, because
|
|
67
|
+
* resizing is a transfer between panels and only the group can see both sides.
|
|
68
|
+
*
|
|
69
|
+
* ```tsx
|
|
70
|
+
* <Resizable.Group orientation="horizontal">
|
|
71
|
+
* <Resizable.Panel defaultSize={30} minSize="200px">…</Resizable.Panel>
|
|
72
|
+
* <Resizable.Handle />
|
|
73
|
+
* <Resizable.Panel>…</Resizable.Panel>
|
|
74
|
+
* </Resizable.Group>
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* The group has no intrinsic size — it fills what it is given, so give it one
|
|
78
|
+
* (a height for a horizontal group, a height for a vertical one too).
|
|
79
|
+
*/
|
|
80
|
+
export declare const ResizableGroup: React.ForwardRefExoticComponent<ResizableGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
81
|
+
export interface ResizablePanelProps extends Omit<React.ComponentPropsWithoutRef<"div">, "className"> {
|
|
82
|
+
/**
|
|
83
|
+
* Size before anyone drags anything, as a percentage of the group or a
|
|
84
|
+
* `px` string. Panels without one split whatever the sized panels leave.
|
|
85
|
+
*/
|
|
86
|
+
defaultSize?: ResizableLength;
|
|
87
|
+
/**
|
|
88
|
+
* Smallest the panel may be dragged to. A `px` string is honoured at every
|
|
89
|
+
* container width — `minSize="240px"` is the constraint a sidebar actually
|
|
90
|
+
* has, and the one a percentage cannot express.
|
|
91
|
+
* @default 0
|
|
92
|
+
*/
|
|
93
|
+
minSize?: ResizableLength;
|
|
94
|
+
/**
|
|
95
|
+
* Largest the panel may be dragged to.
|
|
96
|
+
* @default 100
|
|
97
|
+
*/
|
|
98
|
+
maxSize?: ResizableLength;
|
|
99
|
+
/**
|
|
100
|
+
* Whether dragging past `minSize` snaps the panel shut instead of stopping.
|
|
101
|
+
* A collapsed panel publishes `data-collapsed`, and the handle beside it
|
|
102
|
+
* toggles it with <kbd>Enter</kbd>.
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
collapsible?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Size when collapsed. `0` hides the panel; a small `px` value leaves an
|
|
108
|
+
* icon rail behind.
|
|
109
|
+
* @default 0
|
|
110
|
+
*/
|
|
111
|
+
collapsedSize?: ResizableLength;
|
|
112
|
+
/**
|
|
113
|
+
* How far down the gap between `collapsedSize` and `minSize` the snap point
|
|
114
|
+
* sits, as a fraction. `0.5` is the midpoint: drag past halfway and the
|
|
115
|
+
* panel shuts, let go before it and it springs back to `minSize`.
|
|
116
|
+
* @default 0.5
|
|
117
|
+
*/
|
|
118
|
+
collapseThreshold?: number;
|
|
119
|
+
/**
|
|
120
|
+
* Controls the collapsed state. Pass it with `onCollapsedChange` to drive a
|
|
121
|
+
* panel from your own button — a sidebar toggle needs no imperative handle,
|
|
122
|
+
* just this pair.
|
|
123
|
+
*/
|
|
124
|
+
collapsed?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Called when the panel collapses or expands, whichever caused it — a drag
|
|
127
|
+
* past the snap point, <kbd>Enter</kbd> on the handle, or your own state.
|
|
128
|
+
*/
|
|
129
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
130
|
+
/**
|
|
131
|
+
* Replaces the rendered `<div>` with another element or component.
|
|
132
|
+
*/
|
|
133
|
+
render?: useRender.RenderProp;
|
|
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
|
+
* One resizable region. Sized by the group, so it takes constraints rather
|
|
142
|
+
* than a size: `defaultSize` is a starting point, `minSize` and `maxSize` are
|
|
143
|
+
* the bounds a drag is clamped to.
|
|
144
|
+
*
|
|
145
|
+
* It is `overflow: hidden` and `min-inline-size: 0`, which is what keeps a
|
|
146
|
+
* long, unbreakable child — a code line, a wide table — from propping the
|
|
147
|
+
* panel open past the size the group asked for. Put a scroll container inside
|
|
148
|
+
* if the content needs to scroll.
|
|
149
|
+
*/
|
|
150
|
+
export declare const ResizablePanel: React.ForwardRefExoticComponent<ResizablePanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
151
|
+
export interface ResizableHandleProps extends Omit<React.ComponentPropsWithoutRef<"div">, "className"> {
|
|
152
|
+
/**
|
|
153
|
+
* Draws a grip in the middle of the divider — the visible affordance for a
|
|
154
|
+
* control that is otherwise a hairline.
|
|
155
|
+
* @default false
|
|
156
|
+
*/
|
|
157
|
+
grip?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Makes the divider inert: not focusable, not draggable, and drawn without
|
|
160
|
+
* a hover cue.
|
|
161
|
+
* @default false
|
|
162
|
+
*/
|
|
163
|
+
disabled?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Whether a double-click resets the group to its default layout. On by
|
|
166
|
+
* default: it costs nothing, it is what every splitter does, and it is the
|
|
167
|
+
* only way back from a layout dragged into a corner without a reload.
|
|
168
|
+
* @default true
|
|
169
|
+
*/
|
|
170
|
+
resetOnDoubleClick?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
173
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
174
|
+
*/
|
|
175
|
+
className?: string;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The divider between two panels — draggable, focusable, and a real
|
|
179
|
+
* `role="separator"` with the window-splitter keyboard interface: arrows to
|
|
180
|
+
* move it, <kbd>Page Up</kbd>/<kbd>Page Down</kbd> for a bigger step,
|
|
181
|
+
* <kbd>Home</kbd>/<kbd>End</kbd> for the extremes, and <kbd>Enter</kbd> to
|
|
182
|
+
* collapse or expand a collapsible neighbour.
|
|
183
|
+
*
|
|
184
|
+
* Its hit area is expanded to the 24px minimum (SC 2.5.8) without changing
|
|
185
|
+
* the hairline it draws, so it can be grabbed by a shaky hand or a thumb
|
|
186
|
+
* without becoming a visible gutter.
|
|
187
|
+
*/
|
|
188
|
+
export declare const ResizableHandle: React.ForwardRefExoticComponent<ResizableHandleProps & React.RefAttributes<HTMLDivElement>>;
|
|
189
|
+
/**
|
|
190
|
+
* A splitter: two or more panels the reader can re-proportion by dragging the
|
|
191
|
+
* divider between them, with the keyboard, or from your own toggle button.
|
|
192
|
+
*
|
|
193
|
+
* ```tsx
|
|
194
|
+
* <Resizable.Group orientation="horizontal" className="h-72">
|
|
195
|
+
* <Resizable.Panel defaultSize={25} minSize="180px" collapsible>
|
|
196
|
+
* Sidebar
|
|
197
|
+
* </Resizable.Panel>
|
|
198
|
+
* <Resizable.Handle grip />
|
|
199
|
+
* <Resizable.Panel>Content</Resizable.Panel>
|
|
200
|
+
* </Resizable.Group>
|
|
201
|
+
* ```
|
|
202
|
+
*
|
|
203
|
+
* Groups nest: put a group inside a panel and the inner panels register with
|
|
204
|
+
* the inner group, so a three-pane editor layout is two groups and no
|
|
205
|
+
* coordination between them.
|
|
206
|
+
*/
|
|
207
|
+
export declare const Resizable: {
|
|
208
|
+
Group: React.ForwardRefExoticComponent<ResizableGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
209
|
+
Panel: React.ForwardRefExoticComponent<ResizablePanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
210
|
+
Handle: React.ForwardRefExoticComponent<ResizableHandleProps & React.RefAttributes<HTMLDivElement>>;
|
|
211
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { ScrollArea as BaseScrollArea } from '@base-ui/react/scroll-area';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type ScrollAreaScrollbarVisibility = "auto" | "always";
|
|
4
|
+
type BaseRootProps = React.ComponentPropsWithoutRef<typeof BaseScrollArea.Root>;
|
|
5
|
+
type BaseViewportProps = React.ComponentPropsWithoutRef<typeof BaseScrollArea.Viewport>;
|
|
6
|
+
type BaseContentProps = React.ComponentPropsWithoutRef<typeof BaseScrollArea.Content>;
|
|
7
|
+
type BaseScrollbarProps = React.ComponentPropsWithoutRef<typeof BaseScrollArea.Scrollbar>;
|
|
8
|
+
type BaseThumbProps = React.ComponentPropsWithoutRef<typeof BaseScrollArea.Thumb>;
|
|
9
|
+
type BaseCornerProps = React.ComponentPropsWithoutRef<typeof BaseScrollArea.Corner>;
|
|
10
|
+
export interface ScrollAreaRootProps extends Omit<BaseRootProps, "className"> {
|
|
11
|
+
/**
|
|
12
|
+
* Whether the content fades out towards any edge it can still be scrolled
|
|
13
|
+
* past. The fade is a mask, so it works on any background, and its size
|
|
14
|
+
* tracks the remaining scroll distance — it opens as you scroll away from an
|
|
15
|
+
* edge and is absent while you are resting against one. Dropped
|
|
16
|
+
* automatically under `forced-colors`, `prefers-contrast: more` and
|
|
17
|
+
* `prefers-reduced-transparency`, where the scrollbars carry the cue
|
|
18
|
+
* instead.
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
fade?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* When the scrollbars are shown. `"auto"` overlays them and reveals them
|
|
24
|
+
* while the pointer is anywhere over the scroll area, while it is being
|
|
25
|
+
* scrolled, or while something inside it has keyboard focus; `"always"`
|
|
26
|
+
* leaves them painted. Either way a scrollbar for an axis that does not
|
|
27
|
+
* overflow is not rendered at all.
|
|
28
|
+
* @default "auto"
|
|
29
|
+
*/
|
|
30
|
+
scrollbarVisibility?: ScrollAreaScrollbarVisibility;
|
|
31
|
+
/**
|
|
32
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
33
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
34
|
+
*/
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface ScrollAreaViewportProps extends Omit<BaseViewportProps, "className"> {
|
|
38
|
+
/**
|
|
39
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
40
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
41
|
+
*/
|
|
42
|
+
className?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface ScrollAreaContentProps extends Omit<BaseContentProps, "className"> {
|
|
45
|
+
/**
|
|
46
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
47
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
48
|
+
*/
|
|
49
|
+
className?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface ScrollAreaScrollbarProps extends Omit<BaseScrollbarProps, "className"> {
|
|
52
|
+
/**
|
|
53
|
+
* Which axis this scrollbar controls. Render one for each axis that can
|
|
54
|
+
* overflow; render both, plus `ScrollArea.Corner`, when either might.
|
|
55
|
+
* @default "vertical"
|
|
56
|
+
*/
|
|
57
|
+
orientation?: "vertical" | "horizontal";
|
|
58
|
+
/**
|
|
59
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
60
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
61
|
+
*/
|
|
62
|
+
className?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface ScrollAreaThumbProps extends Omit<BaseThumbProps, "className"> {
|
|
65
|
+
/**
|
|
66
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
67
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
68
|
+
*/
|
|
69
|
+
className?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface ScrollAreaCornerProps extends Omit<BaseCornerProps, "className"> {
|
|
72
|
+
/**
|
|
73
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
74
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
75
|
+
*/
|
|
76
|
+
className?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A scroll container with overlay scrollbars and a gradient edge fade, built
|
|
80
|
+
* on Base UI's unstyled `ScrollArea` primitive.
|
|
81
|
+
*
|
|
82
|
+
* ```tsx
|
|
83
|
+
* <ScrollArea.Root style={{ maxHeight: "16rem" }}>
|
|
84
|
+
* <ScrollArea.Viewport aria-label="Release notes">
|
|
85
|
+
* <ScrollArea.Content>…</ScrollArea.Content>
|
|
86
|
+
* </ScrollArea.Viewport>
|
|
87
|
+
* <ScrollArea.Scrollbar orientation="vertical">
|
|
88
|
+
* <ScrollArea.Thumb />
|
|
89
|
+
* </ScrollArea.Scrollbar>
|
|
90
|
+
* <ScrollArea.Scrollbar orientation="horizontal">
|
|
91
|
+
* <ScrollArea.Thumb />
|
|
92
|
+
* </ScrollArea.Scrollbar>
|
|
93
|
+
* <ScrollArea.Corner />
|
|
94
|
+
* </ScrollArea.Root>
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* The native scrollbars are hidden and replaced, so they look the same on
|
|
98
|
+
* every platform; the viewport still scrolls with the wheel, touch, and the
|
|
99
|
+
* keyboard, because it is still a real scroll container.
|
|
100
|
+
*
|
|
101
|
+
* The fade is pure CSS: Base UI publishes the distance from each edge on the
|
|
102
|
+
* viewport as a custom property, and the stylesheet turns those into a mask.
|
|
103
|
+
* Nothing runs per frame and no animation library is involved.
|
|
104
|
+
*/
|
|
105
|
+
export declare const ScrollArea: {
|
|
106
|
+
Root: React.ForwardRefExoticComponent<ScrollAreaRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
107
|
+
Viewport: React.ForwardRefExoticComponent<ScrollAreaViewportProps & React.RefAttributes<HTMLDivElement>>;
|
|
108
|
+
Content: React.ForwardRefExoticComponent<ScrollAreaContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
109
|
+
Scrollbar: React.ForwardRefExoticComponent<ScrollAreaScrollbarProps & React.RefAttributes<HTMLDivElement>>;
|
|
110
|
+
Thumb: React.ForwardRefExoticComponent<ScrollAreaThumbProps & React.RefAttributes<HTMLDivElement>>;
|
|
111
|
+
Corner: React.ForwardRefExoticComponent<ScrollAreaCornerProps & React.RefAttributes<HTMLDivElement>>;
|
|
112
|
+
};
|
|
113
|
+
export {};
|