@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,171 @@
|
|
|
1
|
+
import { Toggle as BaseToggle } from '@base-ui/react/toggle';
|
|
2
|
+
import { ToggleGroup as BaseToggleGroup } from '@base-ui/react/toggle-group';
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export type ToggleVariant = "solid" | "soft" | "outline";
|
|
5
|
+
export type ToggleTone = "primary" | "secondary" | "danger" | "neutral";
|
|
6
|
+
export type ToggleSize = "sm" | "md" | "lg";
|
|
7
|
+
export type ToggleGroupOrientation = "horizontal" | "vertical";
|
|
8
|
+
export interface ToggleProps<Value extends string = string> extends Omit<BaseToggle.Props<Value>, "className"> {
|
|
9
|
+
/**
|
|
10
|
+
* How loud the *pressed* state is. Unpressed is quiet in every variant —
|
|
11
|
+
* that is what makes a toggle read as off — so the variant only decides what
|
|
12
|
+
* "on" looks like: `solid` fills with the tone, `soft` tints with it,
|
|
13
|
+
* `outline` tints and keeps a border that is also drawn while unpressed.
|
|
14
|
+
*
|
|
15
|
+
* There is deliberately no `ghost`: every variant is already chromeless at
|
|
16
|
+
* rest, so a ghost toggle would differ from `soft` in nothing but its
|
|
17
|
+
* pressed fill — and dropping that fill would leave hue as the only cue
|
|
18
|
+
* separating on from off.
|
|
19
|
+
*
|
|
20
|
+
* Inherited from an enclosing `ToggleGroup` when left unset.
|
|
21
|
+
* @default "soft"
|
|
22
|
+
*/
|
|
23
|
+
variant?: ToggleVariant;
|
|
24
|
+
/**
|
|
25
|
+
* Which semantic colour set the pressed state draws from. Combines freely
|
|
26
|
+
* with `variant`. Inherited from an enclosing `ToggleGroup` when left unset.
|
|
27
|
+
* @default "primary"
|
|
28
|
+
*/
|
|
29
|
+
tone?: ToggleTone;
|
|
30
|
+
/**
|
|
31
|
+
* Size of the button. Matches `Button` step for step so the two line up in
|
|
32
|
+
* one toolbar. Inherited from an enclosing `ToggleGroup` when left unset.
|
|
33
|
+
* @default "md"
|
|
34
|
+
*/
|
|
35
|
+
size?: ToggleSize;
|
|
36
|
+
/**
|
|
37
|
+
* Render as a square button sized for a single icon, holding the 24×24
|
|
38
|
+
* minimum hit target from WCAG SC 2.5.8. Always pair with `aria-label` —
|
|
39
|
+
* an icon is not an accessible name.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
iconOnly?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* A unique string identifying this toggle within a `ToggleGroup`. Required
|
|
45
|
+
* inside a group — the group's value is the list of pressed toggles' values,
|
|
46
|
+
* so a toggle without one can never appear in it. Ignored outside a group,
|
|
47
|
+
* where `pressed` / `defaultPressed` carry the state instead.
|
|
48
|
+
*/
|
|
49
|
+
value?: Value;
|
|
50
|
+
/**
|
|
51
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
52
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
53
|
+
*/
|
|
54
|
+
className?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Ref to the button element. Declared as a prop rather than through
|
|
57
|
+
* `forwardRef` because the component is generic — a `forwardRef` wrapper
|
|
58
|
+
* would erase `Value` and with it the inference on `value`.
|
|
59
|
+
*/
|
|
60
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A two-state button that is either on or off, built on Base UI's unstyled
|
|
64
|
+
* `Toggle` primitive. Renders a `<button>` with `aria-pressed`.
|
|
65
|
+
*
|
|
66
|
+
* Reach for it when the button *is* the state — bold, mute, pin, favourite —
|
|
67
|
+
* and the effect is immediate and local. If the state is a setting the user
|
|
68
|
+
* confirms later, use [`Switch`](/components/switch) or
|
|
69
|
+
* [`Checkbox`](/components/checkbox), which carry a label and a form value; a
|
|
70
|
+
* toggle button has neither.
|
|
71
|
+
*
|
|
72
|
+
* State is exposed on `data-*` attributes (`data-pressed`, `data-disabled`)
|
|
73
|
+
* and every visual decision is a `--forte-toggle-*` custom property, so it can
|
|
74
|
+
* be re-skinned from plain CSS or targeted with Tailwind arbitrary variants
|
|
75
|
+
* (`data-[pressed]:...`) without wrapping.
|
|
76
|
+
*/
|
|
77
|
+
export declare function Toggle<Value extends string = string>({ variant, tone, size, iconOnly, className, ...props }: ToggleProps<Value>): React.JSX.Element;
|
|
78
|
+
export interface ToggleGroupProps<Value extends string = string> extends Omit<BaseToggleGroup.Props<Value>, "className"> {
|
|
79
|
+
/**
|
|
80
|
+
* Default `variant` for every `Toggle` inside the group. A toggle's own
|
|
81
|
+
* `variant` still wins.
|
|
82
|
+
* @default "soft"
|
|
83
|
+
*/
|
|
84
|
+
variant?: ToggleVariant;
|
|
85
|
+
/**
|
|
86
|
+
* Default `tone` for every `Toggle` inside the group. A toggle's own `tone`
|
|
87
|
+
* still wins.
|
|
88
|
+
* @default "primary"
|
|
89
|
+
*/
|
|
90
|
+
tone?: ToggleTone;
|
|
91
|
+
/**
|
|
92
|
+
* Default `size` for every `Toggle` inside the group. A toggle's own `size`
|
|
93
|
+
* still wins.
|
|
94
|
+
* @default "md"
|
|
95
|
+
*/
|
|
96
|
+
size?: ToggleSize;
|
|
97
|
+
/**
|
|
98
|
+
* Draw the group as a segmented control: one padded panel behind the whole
|
|
99
|
+
* set, with the toggles closed up inside it. Off, the group is just a row of
|
|
100
|
+
* separate buttons — right for a toolbar, where the toggles are neighbours
|
|
101
|
+
* rather than alternatives.
|
|
102
|
+
*
|
|
103
|
+
* Pair it with `variant="solid"` for the classic filled segmented control.
|
|
104
|
+
* @default false
|
|
105
|
+
*/
|
|
106
|
+
segmented?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Stretch the group to fill its container and share the space equally
|
|
109
|
+
* between the toggles. Mostly useful with `segmented`, where an evenly
|
|
110
|
+
* divided strip is the expected shape.
|
|
111
|
+
* @default false
|
|
112
|
+
*/
|
|
113
|
+
fullWidth?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Direction the toggles are laid out in, and the axis the arrow keys move
|
|
116
|
+
* along. Unlike `RadioGroup`'s, this is not layout-only: Base UI binds the
|
|
117
|
+
* arrows to the named axis, so a vertical group answers to Up and Down and
|
|
118
|
+
* leaves Left and Right to the page.
|
|
119
|
+
* @default "horizontal"
|
|
120
|
+
*/
|
|
121
|
+
orientation?: ToggleGroupOrientation;
|
|
122
|
+
/**
|
|
123
|
+
* The values of every pressed toggle. Pairs with `onValueChange` for a
|
|
124
|
+
* controlled group; use `defaultValue` for an uncontrolled one. Always an
|
|
125
|
+
* array, including when `multiple` is false — it is then empty or holds one
|
|
126
|
+
* value.
|
|
127
|
+
*/
|
|
128
|
+
value?: readonly Value[];
|
|
129
|
+
/**
|
|
130
|
+
* The values pressed on mount when uncontrolled.
|
|
131
|
+
*/
|
|
132
|
+
defaultValue?: readonly Value[];
|
|
133
|
+
/**
|
|
134
|
+
* Allow several toggles to be pressed at once. With it off, pressing one
|
|
135
|
+
* unpresses the rest — but pressing the pressed one still turns it off, so
|
|
136
|
+
* "nothing selected" stays reachable in a way a radio group never allows.
|
|
137
|
+
* @default false
|
|
138
|
+
*/
|
|
139
|
+
multiple?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Disable every toggle in the group.
|
|
142
|
+
* @default false
|
|
143
|
+
*/
|
|
144
|
+
disabled?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
147
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
148
|
+
*/
|
|
149
|
+
className?: string;
|
|
150
|
+
/**
|
|
151
|
+
* Ref to the group element. Declared as a prop rather than through
|
|
152
|
+
* `forwardRef` because the component is generic — a `forwardRef` wrapper
|
|
153
|
+
* would erase `Value` and with it the typing of `onValueChange`.
|
|
154
|
+
*/
|
|
155
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Shared state for a series of `Toggle`s, built on Base UI's `ToggleGroup`
|
|
159
|
+
* primitive. Renders a `<div role="group">`.
|
|
160
|
+
*
|
|
161
|
+
* Like `RadioGroup` this is a keyboard mode as well as a state container: the
|
|
162
|
+
* whole group is one tab stop and the arrow keys move between toggles. Unlike
|
|
163
|
+
* a radio group, moving does **not** select — arrowing past a toggle leaves it
|
|
164
|
+
* untouched, and Space or Enter is what presses it. That makes a toggle group
|
|
165
|
+
* safe for choices a radio group is not, including ones that fire a request.
|
|
166
|
+
*
|
|
167
|
+
* The group has no implicit accessible name. `role="group"` is not a labelable
|
|
168
|
+
* element, so give it `aria-label` or point `aria-labelledby` at your own
|
|
169
|
+
* heading.
|
|
170
|
+
*/
|
|
171
|
+
export declare function ToggleGroup<Value extends string = string>({ variant, tone, size, segmented, fullWidth, className, ...props }: ToggleGroupProps<Value>): React.JSX.Element;
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { Toolbar as BaseToolbar } from '@base-ui/react/toolbar';
|
|
2
|
+
import { ButtonSize, ButtonTone, ButtonVariant } from '../button';
|
|
3
|
+
import { InputVariant } from '../input';
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
export type ToolbarOrientation = "horizontal" | "vertical";
|
|
6
|
+
export type ToolbarVariant = "plain" | "panel" | "outline";
|
|
7
|
+
export type ToolbarSize = "sm" | "md" | "lg";
|
|
8
|
+
export interface ToolbarRootProps extends Omit<BaseToolbar.Root.Props, "className"> {
|
|
9
|
+
/**
|
|
10
|
+
* How much chrome the bar itself carries. `plain` is a bare row with no
|
|
11
|
+
* surface — right when the toolbar sits on a panel that already has one.
|
|
12
|
+
* `panel` fills; `outline` draws a border on the page background.
|
|
13
|
+
*
|
|
14
|
+
* It says nothing about the controls inside: a `plain` bar can still hold
|
|
15
|
+
* solid buttons, and a `panel` bar quiet ones.
|
|
16
|
+
* @default "panel"
|
|
17
|
+
*/
|
|
18
|
+
variant?: ToolbarVariant;
|
|
19
|
+
/**
|
|
20
|
+
* Size of the bar, and the default size of every `Toolbar.Button`,
|
|
21
|
+
* `Toolbar.Input` and `Toolbar.Link` inside it. An item's own `size` still
|
|
22
|
+
* wins.
|
|
23
|
+
* @default "md"
|
|
24
|
+
*/
|
|
25
|
+
size?: ToolbarSize;
|
|
26
|
+
/**
|
|
27
|
+
* Direction the items are laid out in, and the axis the arrow keys move
|
|
28
|
+
* along. This is not layout only: Base UI binds the arrows to the named
|
|
29
|
+
* axis, so a vertical toolbar answers to Up and Down and leaves Left and
|
|
30
|
+
* Right to the page — and to any text input inside it.
|
|
31
|
+
* @default "horizontal"
|
|
32
|
+
*/
|
|
33
|
+
orientation?: ToolbarOrientation;
|
|
34
|
+
/**
|
|
35
|
+
* Let the items wrap onto more than one line when the bar runs out of room,
|
|
36
|
+
* instead of overflowing it. Roving focus follows DOM order either way, so
|
|
37
|
+
* wrapping costs the keyboard nothing.
|
|
38
|
+
*
|
|
39
|
+
* Ignored while `orientation="vertical"`.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
wrap?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Disable every item in the toolbar. Items stay focusable — see the note on
|
|
45
|
+
* `Toolbar.Button`'s `focusableWhenDisabled`.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
51
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
52
|
+
*/
|
|
53
|
+
className?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A strip of related controls that behaves as one tab stop, built on Base UI's
|
|
57
|
+
* `Toolbar` primitive. Renders a `<div role="toolbar">`.
|
|
58
|
+
*
|
|
59
|
+
* ```tsx
|
|
60
|
+
* <Toolbar.Root aria-label="Formatting">
|
|
61
|
+
* <Toolbar.Button iconOnly aria-label="Undo">…</Toolbar.Button>
|
|
62
|
+
* <Toolbar.Separator />
|
|
63
|
+
* <Toolbar.Button>Publish</Toolbar.Button>
|
|
64
|
+
* </Toolbar.Root>
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* The point of the component is the keyboard contract, not the row: Tab moves
|
|
68
|
+
* *past* the whole bar in one press and the arrow keys move between its
|
|
69
|
+
* controls. That is what stops a nine-button formatting bar from costing nine
|
|
70
|
+
* presses to skip.
|
|
71
|
+
*
|
|
72
|
+
* The bar has no accessible name of its own — `role="toolbar"` is not a
|
|
73
|
+
* labelable element — so give it `aria-label`, or point `aria-labelledby` at
|
|
74
|
+
* your own heading.
|
|
75
|
+
*/
|
|
76
|
+
export declare const ToolbarRoot: React.ForwardRefExoticComponent<Omit<ToolbarRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
77
|
+
export interface ToolbarGroupProps extends Omit<BaseToolbar.Group.Props, "className"> {
|
|
78
|
+
/**
|
|
79
|
+
* Disable every item in the group. Composes with the root's `disabled` —
|
|
80
|
+
* either one being true disables the item.
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
disabled?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
86
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
87
|
+
*/
|
|
88
|
+
className?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A cluster of related items inside a toolbar. Renders a `<div role="group">`.
|
|
92
|
+
*
|
|
93
|
+
* It is a *visual and semantic* grouping, not a keyboard one: the arrow keys
|
|
94
|
+
* still run the length of the whole bar, and a group is what tells a reader
|
|
95
|
+
* (and a screen reader) that these three buttons answer the same question. The
|
|
96
|
+
* gap inside a group is tighter than the gap between them, which is the whole
|
|
97
|
+
* of the visual difference.
|
|
98
|
+
*
|
|
99
|
+
* Like the root it takes no implicit name — give it `aria-label` when the
|
|
100
|
+
* grouping is not obvious from the items themselves.
|
|
101
|
+
*/
|
|
102
|
+
export declare const ToolbarGroup: React.ForwardRefExoticComponent<Omit<ToolbarGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
103
|
+
export interface ToolbarButtonProps extends Omit<BaseToolbar.Button.Props, "className" | "render"> {
|
|
104
|
+
/**
|
|
105
|
+
* How much visual weight the button carries. Defaults to `ghost` rather than
|
|
106
|
+
* `Button`'s `solid`: a toolbar is a strip of peers, and a row of solid
|
|
107
|
+
* buttons has no hierarchy left to spend on the one that matters. Give the
|
|
108
|
+
* primary action `variant="solid"` explicitly.
|
|
109
|
+
*
|
|
110
|
+
* Ignored when `render` is set — the rendered component brings its own
|
|
111
|
+
* styling.
|
|
112
|
+
* @default "ghost"
|
|
113
|
+
*/
|
|
114
|
+
variant?: ButtonVariant;
|
|
115
|
+
/**
|
|
116
|
+
* Which semantic colour set the button draws from. `neutral` by default, for
|
|
117
|
+
* the same reason `variant` is `ghost`.
|
|
118
|
+
*
|
|
119
|
+
* Ignored when `render` is set.
|
|
120
|
+
* @default "neutral"
|
|
121
|
+
*/
|
|
122
|
+
tone?: ButtonTone;
|
|
123
|
+
/**
|
|
124
|
+
* Size of the button. Inherited from `Toolbar.Root` when left unset.
|
|
125
|
+
*
|
|
126
|
+
* Ignored when `render` is set.
|
|
127
|
+
* @default the root's `size`
|
|
128
|
+
*/
|
|
129
|
+
size?: ButtonSize;
|
|
130
|
+
/**
|
|
131
|
+
* Render as a square button sized for a single icon, holding the 24×24
|
|
132
|
+
* minimum hit target from WCAG SC 2.5.8. Always pair with `aria-label` —
|
|
133
|
+
* an icon is not an accessible name.
|
|
134
|
+
*
|
|
135
|
+
* Ignored when `render` is set.
|
|
136
|
+
* @default false
|
|
137
|
+
*/
|
|
138
|
+
iconOnly?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Show a busy indicator and block interaction.
|
|
141
|
+
*
|
|
142
|
+
* Ignored when `render` is set.
|
|
143
|
+
* @default false
|
|
144
|
+
*/
|
|
145
|
+
loading?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Announced to assistive technology while `loading` is true.
|
|
148
|
+
*
|
|
149
|
+
* Ignored when `render` is set.
|
|
150
|
+
* @default "Loading"
|
|
151
|
+
*/
|
|
152
|
+
loadingLabel?: string;
|
|
153
|
+
/**
|
|
154
|
+
* Keep the item focusable while it is disabled, rather than removing it from
|
|
155
|
+
* the bar's roving focus.
|
|
156
|
+
*
|
|
157
|
+
* `true` by default, and that default is the ARIA authoring practice for a
|
|
158
|
+
* toolbar rather than a stylistic choice: a disabled control that vanishes
|
|
159
|
+
* from the arrow-key order silently changes what every other key press does,
|
|
160
|
+
* and the user has no way to find out *why* an action they expected is
|
|
161
|
+
* missing. Focusable-and-disabled keeps it announced, with its disabled
|
|
162
|
+
* state, in the position they expect it.
|
|
163
|
+
* @default true
|
|
164
|
+
*/
|
|
165
|
+
focusableWhenDisabled?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Replaces the rendered button with another element or component. This is
|
|
168
|
+
* how a menu, a select, a dialog or a toggle joins the bar's keyboard
|
|
169
|
+
* order — `render={<Toggle iconOnly />}`,
|
|
170
|
+
* `render={<Select.Trigger />}`.
|
|
171
|
+
*
|
|
172
|
+
* The default `Button` styling steps aside when this is present, so the two
|
|
173
|
+
* never fight over the cascade; the rendered component keeps its own look.
|
|
174
|
+
*/
|
|
175
|
+
render?: BaseToolbar.Button.Props["render"];
|
|
176
|
+
/**
|
|
177
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
178
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
179
|
+
*/
|
|
180
|
+
className?: string;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* A button that is part of the toolbar's roving focus. Renders a `<button>`.
|
|
184
|
+
*
|
|
185
|
+
* Left alone it is a [`Button`](/components/button) — every variant, tone and
|
|
186
|
+
* size, and the same `iconOnly` and `loading` behaviour — that happens to be
|
|
187
|
+
* reachable with the arrow keys. Given `render`, it is whatever you passed,
|
|
188
|
+
* still reachable with the arrow keys and nothing else changed.
|
|
189
|
+
*/
|
|
190
|
+
export declare const ToolbarButton: React.ForwardRefExoticComponent<Omit<ToolbarButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
191
|
+
export interface ToolbarLinkProps extends Omit<BaseToolbar.Link.Props, "className"> {
|
|
192
|
+
/**
|
|
193
|
+
* Size of the link, matching the controls beside it. Inherited from
|
|
194
|
+
* `Toolbar.Root` when left unset.
|
|
195
|
+
* @default the root's `size`
|
|
196
|
+
*/
|
|
197
|
+
size?: ToolbarSize;
|
|
198
|
+
/**
|
|
199
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
200
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
201
|
+
*/
|
|
202
|
+
className?: string;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* A link that is part of the toolbar's roving focus. Renders an `<a>`.
|
|
206
|
+
*
|
|
207
|
+
* It is drawn as a link and not as a button on purpose: it navigates, and the
|
|
208
|
+
* underline is the only cue that says so before it is clicked. A link cannot
|
|
209
|
+
* be disabled — HTML has no such state for `<a>` — so it always holds its
|
|
210
|
+
* place in the arrow-key order, even inside a `disabled` toolbar.
|
|
211
|
+
*
|
|
212
|
+
* Use `render` for a router link: `render={<Link href="/docs" />}`.
|
|
213
|
+
*/
|
|
214
|
+
export declare const ToolbarLink: React.ForwardRefExoticComponent<Omit<ToolbarLinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
215
|
+
export interface ToolbarInputProps extends Omit<BaseToolbar.Input.Props, "className" | "render" | "size"> {
|
|
216
|
+
/**
|
|
217
|
+
* Size of the control. Inherited from `Toolbar.Root` when left unset.
|
|
218
|
+
*
|
|
219
|
+
* This shadows the native `size` attribute, exactly as `Input`'s does.
|
|
220
|
+
*
|
|
221
|
+
* Ignored when `render` is set.
|
|
222
|
+
* @default the root's `size`
|
|
223
|
+
*/
|
|
224
|
+
size?: ToolbarSize;
|
|
225
|
+
/**
|
|
226
|
+
* How much visual weight the control carries.
|
|
227
|
+
*
|
|
228
|
+
* Ignored when `render` is set.
|
|
229
|
+
* @default "outline"
|
|
230
|
+
*/
|
|
231
|
+
variant?: InputVariant;
|
|
232
|
+
/**
|
|
233
|
+
* Stretch the input to fill the space left over in the bar.
|
|
234
|
+
*
|
|
235
|
+
* Ignored when `render` is set.
|
|
236
|
+
* @default false
|
|
237
|
+
*/
|
|
238
|
+
fullWidth?: boolean;
|
|
239
|
+
/**
|
|
240
|
+
* Replaces the rendered input with another element or component. The default
|
|
241
|
+
* `Input` styling steps aside when this is present.
|
|
242
|
+
*/
|
|
243
|
+
render?: BaseToolbar.Input.Props["render"];
|
|
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 text input that is part of the toolbar's roving focus. Renders an
|
|
252
|
+
* `<input>`.
|
|
253
|
+
*
|
|
254
|
+
* The arrow keys do the right thing without configuration: while the caret has
|
|
255
|
+
* somewhere left to go inside the field, Left and Right move the caret; at
|
|
256
|
+
* either end they hand the key back to the toolbar and focus moves on. Home
|
|
257
|
+
* and End are never taken — a toolbar does not bind them — so they jump the
|
|
258
|
+
* caret as they would in any field. That is Base UI's own handling, and it is
|
|
259
|
+
* the reason to reach for this rather than dropping a bare `Input` into the
|
|
260
|
+
* bar — a bare one is not in the roving order at all, so Tab is the only way
|
|
261
|
+
* past it.
|
|
262
|
+
*/
|
|
263
|
+
export declare const ToolbarInput: React.ForwardRefExoticComponent<Omit<ToolbarInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
264
|
+
export interface ToolbarSeparatorProps extends Omit<BaseToolbar.Separator.Props, "className"> {
|
|
265
|
+
/**
|
|
266
|
+
* Which way the rule runs. Defaults to the *opposite* of the toolbar's
|
|
267
|
+
* orientation — a horizontal bar gets vertical rules — which is almost
|
|
268
|
+
* always what you want, so leave it unset.
|
|
269
|
+
*/
|
|
270
|
+
orientation?: ToolbarOrientation;
|
|
271
|
+
/**
|
|
272
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
273
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
274
|
+
*/
|
|
275
|
+
className?: string;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* A rule between two clusters of toolbar items. Renders a
|
|
279
|
+
* `<div role="separator">`.
|
|
280
|
+
*
|
|
281
|
+
* It is a divider, not a stop: the arrow keys pass straight over it, since it
|
|
282
|
+
* is not a composite item. Reach for it between groups that answer different
|
|
283
|
+
* questions — formatting and alignment, say — and let the group gap carry the
|
|
284
|
+
* rest.
|
|
285
|
+
*
|
|
286
|
+
* This is a separate part from [`Separator`](/components/separator) rather than
|
|
287
|
+
* a use of it, for two reasons: Base UI derives the orientation from the
|
|
288
|
+
* toolbar's own, and a rule inside a bar insets from the bar's padding instead
|
|
289
|
+
* of spanning it edge to edge.
|
|
290
|
+
*/
|
|
291
|
+
export declare const ToolbarSeparator: React.ForwardRefExoticComponent<Omit<ToolbarSeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
292
|
+
/**
|
|
293
|
+
* A strip of related controls that behaves as one tab stop, built on Base UI's
|
|
294
|
+
* `Toolbar` primitive.
|
|
295
|
+
*
|
|
296
|
+
* ```tsx
|
|
297
|
+
* <Toolbar.Root aria-label="Formatting">
|
|
298
|
+
* <ToggleGroup aria-label="Style">
|
|
299
|
+
* <Toggle iconOnly value="bold" aria-label="Bold">…</Toggle>
|
|
300
|
+
* </ToggleGroup>
|
|
301
|
+
* <Toolbar.Separator />
|
|
302
|
+
* <Toolbar.Button>Publish</Toolbar.Button>
|
|
303
|
+
* </Toolbar.Root>
|
|
304
|
+
* ```
|
|
305
|
+
*
|
|
306
|
+
* Tab moves past the whole bar in one press; the arrow keys move between its
|
|
307
|
+
* controls. Styling is driven by `data-*` attributes and `--forte-toolbar-*`
|
|
308
|
+
* custom properties, so it can be re-skinned from plain CSS or targeted with
|
|
309
|
+
* Tailwind arbitrary variants (`data-[variant=outline]:...`) without wrapping.
|
|
310
|
+
*/
|
|
311
|
+
export declare const Toolbar: {
|
|
312
|
+
Root: React.ForwardRefExoticComponent<Omit<ToolbarRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
313
|
+
Group: React.ForwardRefExoticComponent<Omit<ToolbarGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
314
|
+
Button: React.ForwardRefExoticComponent<Omit<ToolbarButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
315
|
+
Link: React.ForwardRefExoticComponent<Omit<ToolbarLinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
316
|
+
Input: React.ForwardRefExoticComponent<Omit<ToolbarInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
317
|
+
Separator: React.ForwardRefExoticComponent<Omit<ToolbarSeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
318
|
+
};
|