@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,303 @@
|
|
|
1
|
+
import { NumberField as BaseNumberField } from '@base-ui/react/number-field';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type NumberFieldSize = "sm" | "md" | "lg";
|
|
4
|
+
export type NumberFieldVariant = "outline" | "soft" | "ghost";
|
|
5
|
+
export type NumberFieldScrubDirection = "horizontal" | "vertical";
|
|
6
|
+
type BaseRootProps = React.ComponentPropsWithoutRef<typeof BaseNumberField.Root>;
|
|
7
|
+
export interface NumberFieldRootProps extends Omit<BaseRootProps, "className"> {
|
|
8
|
+
/**
|
|
9
|
+
* Size of the control. Height, inline padding, stepper width and font size
|
|
10
|
+
* all move together, and the numbers come from the same `--forte-control-*`
|
|
11
|
+
* tokens `Input` and `Select.Trigger` read — so the three line up on one row
|
|
12
|
+
* at every `data-forte-density` setting.
|
|
13
|
+
* @default "md"
|
|
14
|
+
*/
|
|
15
|
+
size?: NumberFieldSize;
|
|
16
|
+
/**
|
|
17
|
+
* How much visual weight the control carries. `outline` reads as a form
|
|
18
|
+
* control, `soft` as a filled field, `ghost` as an inline affordance — the
|
|
19
|
+
* same three `Input` has.
|
|
20
|
+
* @default "outline"
|
|
21
|
+
*/
|
|
22
|
+
variant?: NumberFieldVariant;
|
|
23
|
+
/**
|
|
24
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
25
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
26
|
+
*/
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Groups every part of the number field and owns its value. Renders a `<div>`
|
|
31
|
+
* laid out as a column, so a `ScrubArea` wrapping the label sits above the
|
|
32
|
+
* `Group`.
|
|
33
|
+
*
|
|
34
|
+
* The value is a `number | null`, never a string: `null` is the empty field,
|
|
35
|
+
* which is what makes "cleared" distinguishable from zero. `format` takes
|
|
36
|
+
* `Intl.NumberFormatOptions`, so currency, percent and unit displays are a prop
|
|
37
|
+
* rather than a wrapper.
|
|
38
|
+
*
|
|
39
|
+
* ```tsx
|
|
40
|
+
* <NumberField.Root defaultValue={100} min={0} max={999}>
|
|
41
|
+
* <NumberField.ScrubArea>
|
|
42
|
+
* <Field.Label>Width</Field.Label>
|
|
43
|
+
* </NumberField.ScrubArea>
|
|
44
|
+
* <NumberField.Group>
|
|
45
|
+
* <NumberField.Decrement />
|
|
46
|
+
* <NumberField.Input />
|
|
47
|
+
* <NumberField.Increment />
|
|
48
|
+
* </NumberField.Group>
|
|
49
|
+
* </NumberField.Root>
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare const NumberFieldRoot: React.ForwardRefExoticComponent<NumberFieldRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
53
|
+
type BaseGroupProps = React.ComponentPropsWithoutRef<typeof BaseNumberField.Group>;
|
|
54
|
+
export interface NumberFieldGroupProps extends Omit<BaseGroupProps, "className"> {
|
|
55
|
+
/**
|
|
56
|
+
* Stretch the group to fill the width of its container. Only needed outside
|
|
57
|
+
* a `Field.Root` — a field is a flex column, so a group inside one already
|
|
58
|
+
* stretches.
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
fullWidth?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
64
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
65
|
+
*/
|
|
66
|
+
className?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The bordered shell holding the steppers and the input. Renders a `<div>`, and
|
|
70
|
+
* it — not the input — is the element that looks like the control: the input
|
|
71
|
+
* inside it is borderless and transparent, so the three segments read as one
|
|
72
|
+
* box.
|
|
73
|
+
*
|
|
74
|
+
* Which is why the group carries `.forte-focus-ring-within` rather than the input
|
|
75
|
+
* carrying `.forte-focus-ring`. Focusing the text field rings the whole control,
|
|
76
|
+
* the way focusing an `Input` rings the whole input — and since the steppers are
|
|
77
|
+
* not tab stops, that is the only ring anyone sees by default. An app that puts
|
|
78
|
+
* them back in the tab order gets an inset ring on the button instead; the
|
|
79
|
+
* stylesheet suppresses the group's ring in that case so the two never stack.
|
|
80
|
+
*
|
|
81
|
+
* The one thing that DOES stack is an app-level global `:focus-visible` rule.
|
|
82
|
+
* It outranks every `forte-ui` layer by design, so it re-rings the input this
|
|
83
|
+
* component deliberately left unringed, and the control wears two rings — a
|
|
84
|
+
* rounded one around the group and a square-cornered one around the middle
|
|
85
|
+
* segment. Scope such a rule away from parts a component already rings:
|
|
86
|
+
* `:focus-visible:not(:where(.forte-focus-ring-within *))`.
|
|
87
|
+
*
|
|
88
|
+
* `data-scrubbing` lands here while a `ScrubArea` drag is running, which is
|
|
89
|
+
* what ties the drag happening on the label back to the value it is changing.
|
|
90
|
+
*/
|
|
91
|
+
export declare const NumberFieldGroup: React.ForwardRefExoticComponent<NumberFieldGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
92
|
+
type BaseInputProps = React.ComponentPropsWithoutRef<typeof BaseNumberField.Input>;
|
|
93
|
+
export interface NumberFieldInputProps extends Omit<BaseInputProps, "className"> {
|
|
94
|
+
/**
|
|
95
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
96
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
97
|
+
*/
|
|
98
|
+
className?: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The text field itself. Renders an `<input>` that is borderless and
|
|
102
|
+
* transparent — `Group` draws the box around it.
|
|
103
|
+
*
|
|
104
|
+
* The digits are set in `tabular-nums`. That is not typographic polish: during
|
|
105
|
+
* a scrub the value changes every few pixels of pointer movement, and
|
|
106
|
+
* proportional figures make the number visibly breathe as the digits change
|
|
107
|
+
* width. Tabular figures hold still.
|
|
108
|
+
*
|
|
109
|
+
* Base UI gives it `aria-roledescription="Number field"` and wires it to a
|
|
110
|
+
* `Field.Label` above; the label names it, the role description explains it.
|
|
111
|
+
*/
|
|
112
|
+
export declare const NumberFieldInput: React.ForwardRefExoticComponent<NumberFieldInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
113
|
+
type BaseIncrementProps = React.ComponentPropsWithoutRef<typeof BaseNumberField.Increment>;
|
|
114
|
+
export interface NumberFieldIncrementProps extends Omit<BaseIncrementProps, "className"> {
|
|
115
|
+
/**
|
|
116
|
+
* Glyph to render. Defaults to a plus sign.
|
|
117
|
+
* @default <PlusIcon />
|
|
118
|
+
*/
|
|
119
|
+
children?: React.ReactNode;
|
|
120
|
+
/**
|
|
121
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
122
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
123
|
+
*/
|
|
124
|
+
className?: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The stepper that increases the value. Renders a `<button>`.
|
|
128
|
+
*
|
|
129
|
+
* Base UI gives it `aria-label="Increase"` and `aria-controls` pointing at the
|
|
130
|
+
* input, so the default glyph needs no label of its own — and `tabIndex={-1}`,
|
|
131
|
+
* so it is a pointer affordance rather than a tab stop. That is the right shape
|
|
132
|
+
* for a spin button: the arrow keys already step the value from the field
|
|
133
|
+
* itself, and two extra stops per field would cost keyboard users presses
|
|
134
|
+
* without adding a capability.
|
|
135
|
+
*
|
|
136
|
+
* Holding it repeats, and the modifier keys apply to a press as well —
|
|
137
|
+
* <kbd>Alt</kbd> steps by `smallStep`, <kbd>Shift</kbd> by `largeStep`.
|
|
138
|
+
*/
|
|
139
|
+
export declare const NumberFieldIncrement: React.ForwardRefExoticComponent<NumberFieldIncrementProps & React.RefAttributes<HTMLButtonElement>>;
|
|
140
|
+
type BaseDecrementProps = React.ComponentPropsWithoutRef<typeof BaseNumberField.Decrement>;
|
|
141
|
+
export interface NumberFieldDecrementProps extends Omit<BaseDecrementProps, "className"> {
|
|
142
|
+
/**
|
|
143
|
+
* Glyph to render. Defaults to a minus sign.
|
|
144
|
+
* @default <MinusIcon />
|
|
145
|
+
*/
|
|
146
|
+
children?: React.ReactNode;
|
|
147
|
+
/**
|
|
148
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
149
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
150
|
+
*/
|
|
151
|
+
className?: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* The stepper that decreases the value. Renders a `<button>`, labelled
|
|
155
|
+
* "Decrease" by Base UI and outside the tab order for the same reason
|
|
156
|
+
* `Increment` is.
|
|
157
|
+
*
|
|
158
|
+
* Put it before `Input` in the markup. The order is physical, not logical: it
|
|
159
|
+
* is what makes the minus land on the start edge, and it flips with `dir="rtl"`
|
|
160
|
+
* on its own because the group is a flex row and its corner radii are logical.
|
|
161
|
+
*/
|
|
162
|
+
export declare const NumberFieldDecrement: React.ForwardRefExoticComponent<NumberFieldDecrementProps & React.RefAttributes<HTMLButtonElement>>;
|
|
163
|
+
type BaseScrubAreaProps = React.ComponentPropsWithoutRef<typeof BaseNumberField.ScrubArea>;
|
|
164
|
+
export interface NumberFieldScrubAreaProps extends Omit<BaseScrubAreaProps, "className"> {
|
|
165
|
+
/**
|
|
166
|
+
* Axis the pointer has to travel along. Also picks the resize cursor and the
|
|
167
|
+
* rotation of both scrub glyphs.
|
|
168
|
+
* @default "horizontal"
|
|
169
|
+
*/
|
|
170
|
+
direction?: NumberFieldScrubDirection;
|
|
171
|
+
/**
|
|
172
|
+
* Render the double-headed arrow after the children.
|
|
173
|
+
*
|
|
174
|
+
* This is the whole reason a scrub area is discoverable: nothing else about a
|
|
175
|
+
* label suggests it can be dragged, and a cursor change only arrives once the
|
|
176
|
+
* pointer is already on it. Turn it off when the surrounding design carries
|
|
177
|
+
* the affordance some other way — never just to tidy the layout.
|
|
178
|
+
* @default true
|
|
179
|
+
*/
|
|
180
|
+
grip?: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Render a `ScrubAreaCursor` with the default glyph.
|
|
183
|
+
*
|
|
184
|
+
* Scrubbing takes a pointer lock, and a locked pointer is an INVISIBLE one —
|
|
185
|
+
* without a stand-in the user drags with no cursor at all. That is why this
|
|
186
|
+
* defaults to on. Set it to `false` when you want to supply your own, and
|
|
187
|
+
* render `<NumberField.ScrubAreaCursor>` inside the scrub area yourself.
|
|
188
|
+
* @default true
|
|
189
|
+
*/
|
|
190
|
+
cursor?: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
193
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
194
|
+
*/
|
|
195
|
+
className?: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* The click-and-drag surface. Renders a `<span>`, and is normally wrapped
|
|
199
|
+
* around the field's label — dragging sideways over the word "Width" changes
|
|
200
|
+
* the width, which is the interaction Figma and Blender taught everyone.
|
|
201
|
+
*
|
|
202
|
+
* Scrubbing is invisible unless the component says so, so three cues ship by
|
|
203
|
+
* default and they cover three different moments:
|
|
204
|
+
*
|
|
205
|
+
* 1. **At rest** — the `grip`, a double-headed arrow after the label. This is
|
|
206
|
+
* the only cue present before the user has done anything, and the only one a
|
|
207
|
+
* touch user ever sees, so it is on by default.
|
|
208
|
+
* 2. **On hover** — a resize cursor (`ew-resize` / `ns-resize`, per
|
|
209
|
+
* `direction`) and a panel wash behind the label.
|
|
210
|
+
* 3. **During the drag** — `data-scrubbing` tints this area and the `Group`'s
|
|
211
|
+
* border, and the `cursor` stands in for the pointer the lock has hidden.
|
|
212
|
+
*
|
|
213
|
+
* The resize cursor is a deliberate exception to the library's pointer rule.
|
|
214
|
+
* `cursor: pointer` promises "click me and something happens", and clicking a
|
|
215
|
+
* scrub area does nothing at all — the value only moves once the pointer does.
|
|
216
|
+
* The resize cursor is the one the platform already uses for exactly this
|
|
217
|
+
* gesture.
|
|
218
|
+
*
|
|
219
|
+
* ```tsx
|
|
220
|
+
* <NumberField.ScrubArea direction="vertical" pixelSensitivity={3}>
|
|
221
|
+
* <Field.Label>Opacity</Field.Label>
|
|
222
|
+
* </NumberField.ScrubArea>
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
export declare const NumberFieldScrubArea: React.ForwardRefExoticComponent<NumberFieldScrubAreaProps & React.RefAttributes<HTMLSpanElement>>;
|
|
226
|
+
type BaseScrubAreaCursorProps = React.ComponentPropsWithoutRef<typeof BaseNumberField.ScrubAreaCursor>;
|
|
227
|
+
export interface NumberFieldScrubAreaCursorProps extends Omit<BaseScrubAreaCursorProps, "className"> {
|
|
228
|
+
/**
|
|
229
|
+
* Glyph to render. Defaults to a haloed double-headed arrow, rotated to match
|
|
230
|
+
* the scrub area's `direction`.
|
|
231
|
+
* @default <ScrubCursorIcon />
|
|
232
|
+
*/
|
|
233
|
+
children?: React.ReactNode;
|
|
234
|
+
/**
|
|
235
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
236
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
237
|
+
*/
|
|
238
|
+
className?: string;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* The stand-in for the mouse pointer while a scrub is running. Renders a
|
|
242
|
+
* `<span>` portalled to `<body>` and positioned by Base UI, only while the drag
|
|
243
|
+
* is live.
|
|
244
|
+
*
|
|
245
|
+
* `ScrubArea` renders one for you; reach for this directly only to supply a
|
|
246
|
+
* different glyph, and pass `cursor={false}` to the scrub area when you do.
|
|
247
|
+
*
|
|
248
|
+
* Two consequences of the portal are worth knowing. It does not inherit a
|
|
249
|
+
* `.forte-theme` scope, so it paints from whatever the document root resolves —
|
|
250
|
+
* the same trade every portalled surface in this library makes. And Base UI
|
|
251
|
+
* writes `transform` on it on every pointer move, so nothing here may animate
|
|
252
|
+
* or set that property.
|
|
253
|
+
*
|
|
254
|
+
* It does not render at all in Safari (which shifts the layout when a pointer
|
|
255
|
+
* lock is taken) or after a denied lock; the native cursor stays visible in
|
|
256
|
+
* both cases, so the drag still works — it just looks ordinary.
|
|
257
|
+
*/
|
|
258
|
+
export declare const NumberFieldScrubAreaCursor: React.ForwardRefExoticComponent<NumberFieldScrubAreaCursorProps & React.RefAttributes<HTMLSpanElement>>;
|
|
259
|
+
/**
|
|
260
|
+
* A number field built on Base UI's `NumberField` primitive.
|
|
261
|
+
*
|
|
262
|
+
* It is a text input that knows it holds a number: it parses and formats with
|
|
263
|
+
* `Intl.NumberFormat`, steps with the arrow keys and the two stepper buttons,
|
|
264
|
+
* clamps to `min`/`max`, and hands a form a real `number | null` rather than a
|
|
265
|
+
* string that happens to look numeric.
|
|
266
|
+
*
|
|
267
|
+
* ```tsx
|
|
268
|
+
* <Field.Root name="quantity">
|
|
269
|
+
* <NumberField.Root defaultValue={1} min={1} max={99}>
|
|
270
|
+
* <NumberField.ScrubArea>
|
|
271
|
+
* <Field.Label>Quantity</Field.Label>
|
|
272
|
+
* </NumberField.ScrubArea>
|
|
273
|
+
* <NumberField.Group>
|
|
274
|
+
* <NumberField.Decrement />
|
|
275
|
+
* <NumberField.Input />
|
|
276
|
+
* <NumberField.Increment />
|
|
277
|
+
* </NumberField.Group>
|
|
278
|
+
* </NumberField.Root>
|
|
279
|
+
* </Field.Root>
|
|
280
|
+
* ```
|
|
281
|
+
*
|
|
282
|
+
* The `ScrubArea` is the part worth knowing about: wrap it around the label and
|
|
283
|
+
* the label becomes a drag handle. It ships its own affordances — a grip glyph
|
|
284
|
+
* at rest, a resize cursor on hover, a tint plus a stand-in pointer during the
|
|
285
|
+
* drag — because a draggable label that looks like a label is a feature nobody
|
|
286
|
+
* discovers. See `NumberField.ScrubArea` for the three cues and how to replace
|
|
287
|
+
* them.
|
|
288
|
+
*
|
|
289
|
+
* Motion — the steppers snap in on `--forte-duration-instant` and spring back
|
|
290
|
+
* out, the way `Button` does. Nothing animates the value itself: it changes
|
|
291
|
+
* every few pixels of a scrub, so a transition on the digits would spend the
|
|
292
|
+
* whole gesture interpolating toward a number that has already moved.
|
|
293
|
+
*/
|
|
294
|
+
export declare const NumberField: {
|
|
295
|
+
Root: React.ForwardRefExoticComponent<NumberFieldRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
296
|
+
Group: React.ForwardRefExoticComponent<NumberFieldGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
297
|
+
Input: React.ForwardRefExoticComponent<NumberFieldInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
298
|
+
Increment: React.ForwardRefExoticComponent<NumberFieldIncrementProps & React.RefAttributes<HTMLButtonElement>>;
|
|
299
|
+
Decrement: React.ForwardRefExoticComponent<NumberFieldDecrementProps & React.RefAttributes<HTMLButtonElement>>;
|
|
300
|
+
ScrubArea: React.ForwardRefExoticComponent<NumberFieldScrubAreaProps & React.RefAttributes<HTMLSpanElement>>;
|
|
301
|
+
ScrubAreaCursor: React.ForwardRefExoticComponent<NumberFieldScrubAreaCursorProps & React.RefAttributes<HTMLSpanElement>>;
|
|
302
|
+
};
|
|
303
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "../../NumberField-P55SA8T7.js";
|
|
3
|
+
export { s as NumberField, r as NumberFieldDecrement, a as NumberFieldGroup, n as NumberFieldIncrement, e as NumberFieldInput, i as NumberFieldRoot, o as NumberFieldScrubArea, t as NumberFieldScrubAreaCursor };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { NumberField, NumberFieldRoot, NumberFieldGroup, NumberFieldInput, NumberFieldIncrement, NumberFieldDecrement, NumberFieldScrubArea, NumberFieldScrubAreaCursor, } from './NumberField';
|
|
2
|
+
export type { NumberFieldSize, NumberFieldVariant, NumberFieldScrubDirection, NumberFieldRootProps, NumberFieldGroupProps, NumberFieldInputProps, NumberFieldIncrementProps, NumberFieldDecrementProps, NumberFieldScrubAreaProps, NumberFieldScrubAreaCursorProps, } from './NumberField';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "../../NumberField-P55SA8T7.js";
|
|
2
|
+
export { s as NumberField, r as NumberFieldDecrement, a as NumberFieldGroup, n as NumberFieldIncrement, e as NumberFieldInput, i as NumberFieldRoot, o as NumberFieldScrubArea, t as NumberFieldScrubAreaCursor };
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { OTPField as BaseOTPField } from '@base-ui/react/otp-field';
|
|
2
|
+
import { SeparatorProps } from '../separator';
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export type OTPFieldSize = "sm" | "md" | "lg";
|
|
5
|
+
export type OTPFieldVariant = "outline" | "soft" | "underline";
|
|
6
|
+
type BaseRootProps = React.ComponentPropsWithoutRef<typeof BaseOTPField.Root>;
|
|
7
|
+
type BaseInputProps = React.ComponentPropsWithoutRef<typeof BaseOTPField.Input>;
|
|
8
|
+
/**
|
|
9
|
+
* `numeric` (the default), `alpha`, `alphanumeric`, or `none` to accept
|
|
10
|
+
* anything. Derived from Base UI rather than restated, so a value it adds
|
|
11
|
+
* arrives here without an edit.
|
|
12
|
+
*/
|
|
13
|
+
export type OTPFieldValidationType = NonNullable<BaseRootProps["validationType"]>;
|
|
14
|
+
export interface OTPFieldRootProps extends Omit<BaseRootProps, "className" | "children" | "length" | "mask" | "validationType" | "autoSubmit"> {
|
|
15
|
+
/**
|
|
16
|
+
* How many characters the code has, and therefore how many slots the field
|
|
17
|
+
* renders. Required: the root clamps the value, decides when it is complete
|
|
18
|
+
* and writes the hidden input's `pattern` from it, all of which have to be
|
|
19
|
+
* right on the server render, before a single slot has mounted.
|
|
20
|
+
*
|
|
21
|
+
* When you pass your own children, the number of `<OTPField.Input>`s has to
|
|
22
|
+
* match — Base UI warns in development when it does not.
|
|
23
|
+
*/
|
|
24
|
+
length: BaseRootProps["length"];
|
|
25
|
+
/**
|
|
26
|
+
* Replace each character with a dot, the way a password field does.
|
|
27
|
+
*
|
|
28
|
+
* Off by default, and worth leaving off. A code that is read off a phone and
|
|
29
|
+
* typed once has nothing to shoulder-surf that the SMS did not already
|
|
30
|
+
* expose, and hiding it takes away the user's only way to check what they
|
|
31
|
+
* typed.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
mask?: BaseRootProps["mask"];
|
|
35
|
+
/**
|
|
36
|
+
* Which characters the field accepts. Anything else is dropped as it is
|
|
37
|
+
* typed or pasted and reported through `onValueInvalid`, so a code copied
|
|
38
|
+
* with a stray space or a dash still lands correctly.
|
|
39
|
+
*
|
|
40
|
+
* It also picks the virtual keyboard: `numeric` asks for the digit pad,
|
|
41
|
+
* which is most of why a phone is bearable to type a code on. Override
|
|
42
|
+
* `inputMode` if you need a different one.
|
|
43
|
+
* @default "numeric"
|
|
44
|
+
*/
|
|
45
|
+
validationType?: OTPFieldValidationType;
|
|
46
|
+
/**
|
|
47
|
+
* Submit the owning form as soon as the last slot is filled.
|
|
48
|
+
*
|
|
49
|
+
* The reason to want it is that the code is the whole form — there is
|
|
50
|
+
* nothing left to review, and a Verify button is a step whose only content
|
|
51
|
+
* is "yes, I meant the six digits I just typed". `onValueComplete` runs
|
|
52
|
+
* immediately before the submit, so you can still stop it.
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
autoSubmit?: BaseRootProps["autoSubmit"];
|
|
56
|
+
/**
|
|
57
|
+
* Size of the slots. Sets their square side and the character's font size
|
|
58
|
+
* together, and the side comes from the same `--forte-control-*` tokens
|
|
59
|
+
* `Input` and `Select.Trigger` read — so a code field lines up with the rest
|
|
60
|
+
* of a form at every `data-forte-density` setting.
|
|
61
|
+
* @default "md"
|
|
62
|
+
*/
|
|
63
|
+
size?: OTPFieldSize;
|
|
64
|
+
/**
|
|
65
|
+
* How much visual weight each slot carries. `outline` reads as a form
|
|
66
|
+
* control, `soft` as a filled field, `underline` as a row of rules.
|
|
67
|
+
*
|
|
68
|
+
* There is no `ghost`, unlike `Input`: a slot with no boundary leaves
|
|
69
|
+
* nothing to count, and how many characters the code has is the one thing
|
|
70
|
+
* the field has to say before anything is typed.
|
|
71
|
+
* @default "outline"
|
|
72
|
+
*/
|
|
73
|
+
variant?: OTPFieldVariant;
|
|
74
|
+
/**
|
|
75
|
+
* The slots, and anything between them. Leave it out and the root renders
|
|
76
|
+
* `length` plain `<OTPField.Input>`s for you — the common case, and the one
|
|
77
|
+
* where Base UI otherwise warns at runtime if the count and `length`
|
|
78
|
+
* disagree.
|
|
79
|
+
*
|
|
80
|
+
* Pass children when the row is not uniform: groups split by an
|
|
81
|
+
* `<OTPField.Separator />`, or a slot with its own `aria-label`. The count
|
|
82
|
+
* still has to equal `length`.
|
|
83
|
+
*/
|
|
84
|
+
children?: React.ReactNode;
|
|
85
|
+
/**
|
|
86
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
87
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
88
|
+
*/
|
|
89
|
+
className?: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Groups every slot of a one-time-code field and owns the value. Renders a
|
|
93
|
+
* `<div role="group">` laid out as a wrapping flex row, plus a visually hidden
|
|
94
|
+
* `<input>` beside it that carries the whole code into form submission and
|
|
95
|
+
* constraint validation.
|
|
96
|
+
*
|
|
97
|
+
* ```tsx
|
|
98
|
+
* <Field.Root name="code">
|
|
99
|
+
* <Field.Label>Verification code</Field.Label>
|
|
100
|
+
* <OTPField.Root length={6} />
|
|
101
|
+
* </Field.Root>
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* The value is one string, not one per slot: `value`, `defaultValue`,
|
|
105
|
+
* `onValueChange` and `onValueComplete` all speak in `"123456"`. Typing
|
|
106
|
+
* advances, Backspace retreats, and a paste fills from the slot it lands on —
|
|
107
|
+
* Base UI owns all of that, including clamping to `length` and filtering by
|
|
108
|
+
* `validationType`.
|
|
109
|
+
*
|
|
110
|
+
* `autoComplete` defaults to `"one-time-code"`, which is what lets iOS and
|
|
111
|
+
* Android offer a code straight from the SMS that just arrived. Do not
|
|
112
|
+
* override it without a reason.
|
|
113
|
+
*
|
|
114
|
+
* State is exposed on `data-*` (`data-complete`, `data-filled`,
|
|
115
|
+
* `data-disabled`, `data-readonly`, plus `data-invalid`, `data-valid`,
|
|
116
|
+
* `data-dirty`, `data-touched` and `data-focused` inside a `Field.Root`) and
|
|
117
|
+
* every visual decision is a `--forte-otp-field-*` custom property, so it can be
|
|
118
|
+
* re-skinned from plain CSS or targeted with Tailwind arbitrary variants
|
|
119
|
+
* (`data-[complete]:...`) without wrapping.
|
|
120
|
+
*/
|
|
121
|
+
export declare const OTPFieldRoot: React.ForwardRefExoticComponent<OTPFieldRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
122
|
+
export interface OTPFieldInputProps extends Omit<BaseInputProps, "className"> {
|
|
123
|
+
/**
|
|
124
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
125
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
126
|
+
*/
|
|
127
|
+
className?: string;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* One character of the code. Renders an `<input>`.
|
|
131
|
+
*
|
|
132
|
+
* Slots take their index from the order they are rendered in, so there is no
|
|
133
|
+
* `index` prop to keep in step — but the number of them must equal the root's
|
|
134
|
+
* `length`, and Base UI warns in development when it does not. Render them
|
|
135
|
+
* yourself only when the row needs something a bare list cannot express;
|
|
136
|
+
* otherwise let `OTPField.Root` produce them.
|
|
137
|
+
*
|
|
138
|
+
* Exactly one slot is in the tab order at a time, which is what makes the
|
|
139
|
+
* whole field a single tab stop rather than six. Focusing one selects its
|
|
140
|
+
* character, so the next keypress replaces it instead of being rejected by a
|
|
141
|
+
* full slot.
|
|
142
|
+
*
|
|
143
|
+
* `aria-label` on the FIRST slot is ignored — Base UI warns about it — because
|
|
144
|
+
* the name belongs to the group, not to a character of it. Name the field with
|
|
145
|
+
* a `<Field.Label>` or a `<label>` instead.
|
|
146
|
+
*/
|
|
147
|
+
export declare const OTPFieldInput: React.ForwardRefExoticComponent<OTPFieldInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
148
|
+
export interface OTPFieldSeparatorProps extends SeparatorProps {
|
|
149
|
+
/**
|
|
150
|
+
* Drops `role="separator"`, leaving the dash visible but absent from the
|
|
151
|
+
* accessibility tree.
|
|
152
|
+
*
|
|
153
|
+
* Defaults to `true` here, which is the opposite of a standalone
|
|
154
|
+
* `Separator`: the slots either side of it are one value and one control,
|
|
155
|
+
* so the grouping is a reading aid for the eye only. Announcing a boundary
|
|
156
|
+
* in the middle of a six-digit code describes the layout, not the field.
|
|
157
|
+
* @default true
|
|
158
|
+
*/
|
|
159
|
+
decorative?: boolean;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The dash between two groups of slots — the `123 – 456` shape a six-digit
|
|
163
|
+
* code is usually printed in. Renders the library's `Separator`, so it carries
|
|
164
|
+
* `data-forte="separator"` rather than a marker of its own; scope to it with
|
|
165
|
+
* `[data-forte="otp-field"] [data-forte="separator"]`.
|
|
166
|
+
*
|
|
167
|
+
* It is a **horizontal** rule sized to `--forte-otp-field-separator-length`,
|
|
168
|
+
* not a vertical bar, and it counts against nothing: `length` is the number of
|
|
169
|
+
* `Input`s, so a separator can go anywhere between them.
|
|
170
|
+
*
|
|
171
|
+
* ```tsx
|
|
172
|
+
* <OTPField.Root length={6}>
|
|
173
|
+
* <OTPField.Input />
|
|
174
|
+
* <OTPField.Input />
|
|
175
|
+
* <OTPField.Input />
|
|
176
|
+
* <OTPField.Separator />
|
|
177
|
+
* <OTPField.Input />
|
|
178
|
+
* <OTPField.Input />
|
|
179
|
+
* <OTPField.Input />
|
|
180
|
+
* </OTPField.Root>
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
export declare const OTPFieldSeparator: React.ForwardRefExoticComponent<OTPFieldSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
184
|
+
/**
|
|
185
|
+
* A one-time-code field built on Base UI's `OTPField` primitive.
|
|
186
|
+
*
|
|
187
|
+
* ```tsx
|
|
188
|
+
* <OTPField.Root
|
|
189
|
+
* length={6}
|
|
190
|
+
* onValueComplete={(code) => verify(code)}
|
|
191
|
+
* />
|
|
192
|
+
* ```
|
|
193
|
+
*
|
|
194
|
+
* Motion — there is none, and that is a decision rather than an omission. The
|
|
195
|
+
* only thing that changes as the user types is which slot holds a character,
|
|
196
|
+
* and a slot that grew, bounced or flashed on fill would do it up to six times
|
|
197
|
+
* in the two seconds it takes to enter a code, next to the caret the user is
|
|
198
|
+
* watching. What does transition is colour: the boundary on hover, on
|
|
199
|
+
* completion and on failure, each of which has a start and an end.
|
|
200
|
+
*/
|
|
201
|
+
export declare const OTPField: {
|
|
202
|
+
Root: React.ForwardRefExoticComponent<OTPFieldRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
203
|
+
Input: React.ForwardRefExoticComponent<OTPFieldInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
204
|
+
Separator: React.ForwardRefExoticComponent<OTPFieldSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
205
|
+
};
|
|
206
|
+
export {};
|