@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,76 @@
|
|
|
1
|
+
import { FormProps as BaseFormProps } from '@base-ui/react/form';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type FormValidationMode = "onSubmit" | "onBlur" | "onChange";
|
|
4
|
+
export interface FormProps<FormValues extends Record<string, unknown> = Record<string, unknown>> extends Omit<BaseFormProps<FormValues>, "className"> {
|
|
5
|
+
/**
|
|
6
|
+
* When the fields inside are validated. `validationMode` on an individual
|
|
7
|
+
* `Field.Root` takes precedence over this.
|
|
8
|
+
*
|
|
9
|
+
* - `onSubmit` — validate on submit, then re-validate on change. The default,
|
|
10
|
+
* and the right one for most forms: it does not tell someone their email
|
|
11
|
+
* is invalid while they are still on the third character of it.
|
|
12
|
+
* - `onBlur` — validate a field when it loses focus.
|
|
13
|
+
* - `onChange` — validate on every keystroke. Pair it with
|
|
14
|
+
* `validationDebounceTime` on the field if `validate` is expensive.
|
|
15
|
+
* @default "onSubmit"
|
|
16
|
+
*/
|
|
17
|
+
validationMode?: FormValidationMode;
|
|
18
|
+
/**
|
|
19
|
+
* Errors that came from somewhere other than the browser — a server
|
|
20
|
+
* response, a form action, a schema parse. Keys are the `name` of a
|
|
21
|
+
* `Field.Root`; values are a message or an array of messages, which the
|
|
22
|
+
* matching `Field.Error` then renders.
|
|
23
|
+
*/
|
|
24
|
+
errors?: BaseFormProps<FormValues>["errors"];
|
|
25
|
+
/**
|
|
26
|
+
* Called on submit once every field passes validation, with the form's
|
|
27
|
+
* values collected by `name`. Base UI calls `preventDefault()` on the native
|
|
28
|
+
* event for you, so this replaces `onSubmit` rather than sitting beside it.
|
|
29
|
+
*/
|
|
30
|
+
onFormSubmit?: BaseFormProps<FormValues>["onFormSubmit"];
|
|
31
|
+
/**
|
|
32
|
+
* A ref to imperative actions. `validate()` runs every field; pass a field
|
|
33
|
+
* name to run just one.
|
|
34
|
+
*/
|
|
35
|
+
actionsRef?: BaseFormProps<FormValues>["actionsRef"];
|
|
36
|
+
/**
|
|
37
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
38
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
39
|
+
*/
|
|
40
|
+
className?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Ref to the underlying `<form>` element. Declared explicitly rather than
|
|
43
|
+
* through `forwardRef` because the component is generic — a `forwardRef`
|
|
44
|
+
* wrapper would erase `FormValues` and with it the typing of
|
|
45
|
+
* `onFormSubmit`.
|
|
46
|
+
*/
|
|
47
|
+
ref?: React.Ref<HTMLFormElement>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A `<form>` that collects the validation state of every `Field` inside it,
|
|
51
|
+
* built on Base UI's `Form` primitive.
|
|
52
|
+
*
|
|
53
|
+
* ```tsx
|
|
54
|
+
* <Form
|
|
55
|
+
* onFormSubmit={async (values) => {
|
|
56
|
+
* const result = await save(values);
|
|
57
|
+
* if (!result.ok) setErrors(result.errors); // keys match Field.Root name
|
|
58
|
+
* }}
|
|
59
|
+
* errors={errors}
|
|
60
|
+
* >
|
|
61
|
+
* <Field.Root name="email">…</Field.Root>
|
|
62
|
+
* <Button type="submit">Save</Button>
|
|
63
|
+
* </Form>
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* Two things it does that a bare `<form>` does not: it blocks submission while
|
|
67
|
+
* any field is invalid and moves focus to the first one that failed, and it
|
|
68
|
+
* routes the `errors` object back to the right `Field.Error` by `name` — which
|
|
69
|
+
* is why the `name` belongs on `Field.Root` rather than on the control.
|
|
70
|
+
*
|
|
71
|
+
* It lays out as a column with `--forte-form-gap` between children, since a form
|
|
72
|
+
* is nearly always a stack of fields. Set `display` through `className` for
|
|
73
|
+
* anything else; the gap is a knob rather than a hardcoded rule for exactly
|
|
74
|
+
* that reason.
|
|
75
|
+
*/
|
|
76
|
+
export declare function Form<FormValues extends Record<string, unknown> = Record<string, unknown>>({ className, ...props }: FormProps<FormValues>): React.JSX.Element;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Input as BaseInput } from '@base-ui/react/input';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type InputSize = "sm" | "md" | "lg";
|
|
4
|
+
export type InputVariant = "outline" | "soft" | "ghost";
|
|
5
|
+
type BaseInputProps = React.ComponentPropsWithoutRef<typeof BaseInput>;
|
|
6
|
+
export interface InputProps extends Omit<BaseInputProps, "className" | "size"> {
|
|
7
|
+
/**
|
|
8
|
+
* Size of the control. Height, inline padding and font size all move
|
|
9
|
+
* together, and the actual numbers follow the ambient `data-forte-density`
|
|
10
|
+
* setting. Matches `Select.Trigger`'s scale, so an input and a select on the
|
|
11
|
+
* same row line up.
|
|
12
|
+
*
|
|
13
|
+
* This shadows the native `size` attribute (which sets a width in
|
|
14
|
+
* characters). Reach for `fullWidth`, a CSS `inline-size`, or
|
|
15
|
+
* `render={<input size={10} />}` if you need that instead.
|
|
16
|
+
* @default "md"
|
|
17
|
+
*/
|
|
18
|
+
size?: InputSize;
|
|
19
|
+
/**
|
|
20
|
+
* How much visual weight the control carries. `outline` reads as a form
|
|
21
|
+
* control, `soft` as a filled field, `ghost` as an inline affordance.
|
|
22
|
+
* @default "outline"
|
|
23
|
+
*/
|
|
24
|
+
variant?: InputVariant;
|
|
25
|
+
/**
|
|
26
|
+
* Stretch the input to fill the width of its container. Only needed outside
|
|
27
|
+
* a `Field.Root` — a field is a flex column, so an input inside one already
|
|
28
|
+
* stretches.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
fullWidth?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
34
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
35
|
+
*/
|
|
36
|
+
className?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A text input built on Base UI's `Input` primitive.
|
|
40
|
+
*
|
|
41
|
+
* Base UI's `Input` *is* `Field.Control` — the same component under a friendlier
|
|
42
|
+
* name — so this needs no wiring to participate in a `Field`: put one inside a
|
|
43
|
+
* `Field.Root` and it picks up the label, the description, the error message,
|
|
44
|
+
* `name`, `disabled` and the validity attributes automatically. Outside a field
|
|
45
|
+
* it is an ordinary `<input>`, so `type`, `placeholder`, `required`, `pattern`
|
|
46
|
+
* and the rest all pass straight through.
|
|
47
|
+
*
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <Field.Root name="email">
|
|
50
|
+
* <Field.Label>Email</Field.Label>
|
|
51
|
+
* <Input type="email" required placeholder="you@example.com" />
|
|
52
|
+
* <Field.Error />
|
|
53
|
+
* </Field.Root>
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* For a multi-line control reach for `Textarea`, which is the same
|
|
57
|
+
* `Field.Control` rendered as a `<textarea>` and adds the things a paragraph of
|
|
58
|
+
* text needs — row-based sizing, a growth ceiling, and `autoResize`.
|
|
59
|
+
*
|
|
60
|
+
* State is exposed on `data-*` (`data-disabled`, `data-invalid`, `data-valid`,
|
|
61
|
+
* `data-dirty`, `data-touched`, `data-filled`, `data-focused`) and every visual
|
|
62
|
+
* decision is a `--forte-input-*` custom property, so it can be re-skinned from
|
|
63
|
+
* plain CSS or targeted with Tailwind arbitrary variants
|
|
64
|
+
* (`data-[invalid]:...`) without wrapping.
|
|
65
|
+
*/
|
|
66
|
+
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLElement>>;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { Input as BaseInput } from '@base-ui/react/input';
|
|
2
|
+
import { Field as BaseField } from '@base-ui/react/field';
|
|
3
|
+
import { ButtonProps } from '../button';
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
export type InputGroupSize = "sm" | "md" | "lg";
|
|
6
|
+
export type InputGroupVariant = "outline" | "soft" | "ghost";
|
|
7
|
+
export type InputGroupAddonAlign = "inline-start" | "inline-end" | "block-start" | "block-end";
|
|
8
|
+
export interface InputGroupRootProps extends Omit<React.ComponentPropsWithoutRef<"div">, "className"> {
|
|
9
|
+
/**
|
|
10
|
+
* Size of the group. Height, inline padding and font size move together for
|
|
11
|
+
* the control and every addon at once, and the numbers come from the same
|
|
12
|
+
* `--forte-control-*` tokens `Input` and `Select.Trigger` read — so a group
|
|
13
|
+
* and a plain input on one row are the same height at every
|
|
14
|
+
* `data-forte-density` setting.
|
|
15
|
+
* @default "md"
|
|
16
|
+
*/
|
|
17
|
+
size?: InputGroupSize;
|
|
18
|
+
/**
|
|
19
|
+
* How much visual weight the group carries. `outline` reads as a form
|
|
20
|
+
* control, `soft` as a filled field, `ghost` as an inline affordance — the
|
|
21
|
+
* same three `Input` has, because to a reader the group *is* the input.
|
|
22
|
+
* @default "outline"
|
|
23
|
+
*/
|
|
24
|
+
variant?: InputGroupVariant;
|
|
25
|
+
/**
|
|
26
|
+
* Stretch the group to fill the width of its container. Only needed outside
|
|
27
|
+
* a `Field.Root` — a field is a flex column, so a group inside one already
|
|
28
|
+
* stretches.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
fullWidth?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
34
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
35
|
+
*/
|
|
36
|
+
className?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The field shell: a `<div>` that draws one control boundary — border,
|
|
40
|
+
* background, radius, sizes, variants — around a bare `<InputGroup.Input>` or
|
|
41
|
+
* `<InputGroup.Textarea>` and any number of `<InputGroup.Addon>`s, so icons,
|
|
42
|
+
* prefixes and buttons sit *inside* the field instead of bolted onto it.
|
|
43
|
+
*
|
|
44
|
+
* Focus lives on the control; the group rings for it via
|
|
45
|
+
* `.forte-focus-ring-within`, so the whole field lights up the way a plain
|
|
46
|
+
* `Input` does. Buttons inside addons ring themselves, and the group stands
|
|
47
|
+
* down while they do.
|
|
48
|
+
*
|
|
49
|
+
* The group is a caret region, not a button: clicking anywhere in it —
|
|
50
|
+
* a prefix, an icon, the padding — focuses the control, exactly as clicking
|
|
51
|
+
* the empty end of a plain input places the caret. Interactive children keep
|
|
52
|
+
* the gesture for themselves.
|
|
53
|
+
*
|
|
54
|
+
* There is no `disabled` prop here on purpose. Disabled, read-only and
|
|
55
|
+
* invalid all belong to the control (or the `Field.Root` above it), and the
|
|
56
|
+
* group watches them through `:has()` — one source of truth, no way for the
|
|
57
|
+
* shell and the control to disagree.
|
|
58
|
+
*/
|
|
59
|
+
export declare const InputGroupRoot: React.ForwardRefExoticComponent<InputGroupRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
60
|
+
type BaseInputProps = React.ComponentPropsWithoutRef<typeof BaseInput>;
|
|
61
|
+
export interface InputGroupInputProps extends Omit<BaseInputProps, "className"> {
|
|
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 text control, rendered bare: the group owns the border, the background
|
|
70
|
+
* and the height, so this element is transparent and stretches to fill
|
|
71
|
+
* whatever the addons leave.
|
|
72
|
+
*
|
|
73
|
+
* Like `Input`, this is Base UI's `Input` — which *is* `Field.Control` — so a
|
|
74
|
+
* group inside a `Field.Root` picks up the label, the description, the error
|
|
75
|
+
* message, `name` and the validity attributes with no wiring, and the group's
|
|
76
|
+
* boundary recolours from the `data-invalid` this element carries.
|
|
77
|
+
*/
|
|
78
|
+
export declare const InputGroupInput: React.ForwardRefExoticComponent<InputGroupInputProps & React.RefAttributes<HTMLElement>>;
|
|
79
|
+
type BaseControlProps = React.ComponentPropsWithoutRef<typeof BaseField.Control>;
|
|
80
|
+
type TextareaElementProps = Omit<React.ComponentPropsWithoutRef<"textarea">, "className">;
|
|
81
|
+
export interface InputGroupTextareaProps extends TextareaElementProps {
|
|
82
|
+
/**
|
|
83
|
+
* The number of rows the box is at its shortest. Sets the native `rows`
|
|
84
|
+
* attribute and the floor the control can never shrink below — including
|
|
85
|
+
* under `autoResize`.
|
|
86
|
+
* @default 3
|
|
87
|
+
*/
|
|
88
|
+
rows?: number;
|
|
89
|
+
/**
|
|
90
|
+
* The number of rows the box may grow to before it starts scrolling
|
|
91
|
+
* instead. Only a ceiling: a textarea shorter than this is unaffected.
|
|
92
|
+
* Unset means no ceiling.
|
|
93
|
+
*/
|
|
94
|
+
maxRows?: number;
|
|
95
|
+
/**
|
|
96
|
+
* Grow with the content as the user types, between `rows` and `maxRows` —
|
|
97
|
+
* the same behaviour, and the same `field-sizing` implementation with the
|
|
98
|
+
* same fallback, as `Textarea`'s `autoResize`.
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
autoResize?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
104
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
105
|
+
*/
|
|
106
|
+
className?: string;
|
|
107
|
+
/** Replace the rendered element. Defaults to a `<textarea>`. */
|
|
108
|
+
render?: BaseControlProps["render"];
|
|
109
|
+
/** Callback fired when the value changes. Use when controlled. */
|
|
110
|
+
onValueChange?: BaseControlProps["onValueChange"];
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The multi-line control, rendered bare the way `InputGroup.Input` is — the
|
|
114
|
+
* group draws the box. Height is counted in rows, exactly as `Textarea`
|
|
115
|
+
* counts it, and pairs naturally with `align="block-start"` /
|
|
116
|
+
* `align="block-end"` addons for a header row of actions or a footer row
|
|
117
|
+
* with a character count.
|
|
118
|
+
*
|
|
119
|
+
* There is no `resize` prop: the group's boundary is not this element's, so a
|
|
120
|
+
* native resize handle would sit visibly inside the field and drag a corner
|
|
121
|
+
* that is not the corner of anything. `autoResize` is the way a composer
|
|
122
|
+
* grows here.
|
|
123
|
+
*/
|
|
124
|
+
export declare const InputGroupTextarea: React.ForwardRefExoticComponent<InputGroupTextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
125
|
+
export interface InputGroupAddonProps extends Omit<React.ComponentPropsWithoutRef<"div">, "className"> {
|
|
126
|
+
/**
|
|
127
|
+
* Which edge of the control the addon sits against. The `inline` pair
|
|
128
|
+
* shares the control's row; the `block` pair takes a full-width row of its
|
|
129
|
+
* own, above or below — the shape a textarea's toolbar or footer wants.
|
|
130
|
+
*
|
|
131
|
+
* Alignment is logical, so `inline-start` is the left edge in LTR and the
|
|
132
|
+
* right edge in RTL with no extra work.
|
|
133
|
+
* @default "inline-start"
|
|
134
|
+
*/
|
|
135
|
+
align?: InputGroupAddonAlign;
|
|
136
|
+
/**
|
|
137
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
138
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
139
|
+
*/
|
|
140
|
+
className?: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* A slot inside the field for everything that is not the value: icons,
|
|
144
|
+
* prefixes and suffixes (wrap words in `<InputGroup.Text>`), buttons
|
|
145
|
+
* (`<InputGroup.Button>`), a `Spinner`, a keyboard hint.
|
|
146
|
+
*
|
|
147
|
+
* Placement is visual, driven by CSS `order`, so DOM order is free to follow
|
|
148
|
+
* focus order: put an addon that holds a button *after* the control in the
|
|
149
|
+
* source and the Tab sequence reads control-then-button even while the button
|
|
150
|
+
* draws at the start edge.
|
|
151
|
+
*
|
|
152
|
+
* Purely decorative content — icons above all — still needs
|
|
153
|
+
* `aria-hidden="true"`: the group cannot know which children carry meaning.
|
|
154
|
+
* Text that names or explains the control belongs to the field
|
|
155
|
+
* (`Field.Label`, `Field.Description`), not in here; a sighted-only prefix
|
|
156
|
+
* like a currency sign should be restated where assistive technology will
|
|
157
|
+
* meet it.
|
|
158
|
+
*/
|
|
159
|
+
export declare const InputGroupAddon: React.ForwardRefExoticComponent<InputGroupAddonProps & React.RefAttributes<HTMLDivElement>>;
|
|
160
|
+
export interface InputGroupTextProps extends Omit<React.ComponentPropsWithoutRef<"span">, "className"> {
|
|
161
|
+
/**
|
|
162
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
163
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
164
|
+
*/
|
|
165
|
+
className?: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Words inside an addon — a protocol, a unit, a domain, a count. A styled
|
|
169
|
+
* `<span>`: muted, unwrappable, sized by the group. Give it an `id` and point
|
|
170
|
+
* the control's `aria-describedby` at it when the text is information rather
|
|
171
|
+
* than decoration.
|
|
172
|
+
*/
|
|
173
|
+
export declare const InputGroupText: React.ForwardRefExoticComponent<InputGroupTextProps & React.RefAttributes<HTMLSpanElement>>;
|
|
174
|
+
export interface InputGroupButtonProps extends ButtonProps {
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* A `Button` preset for life inside an addon: `ghost` + `neutral` so it reads
|
|
178
|
+
* as part of the field rather than a call to action, and sized by the group —
|
|
179
|
+
* the CSS caps it to the field's inner height, so at `sm` the visual box can
|
|
180
|
+
* dip below 24px. That is why this wrapper exists instead of a line of docs:
|
|
181
|
+
* it adds `.forte-target`, which floors the *hit* area at 24×24 without
|
|
182
|
+
* touching the visual one.
|
|
183
|
+
*
|
|
184
|
+
* It is otherwise exactly `Button` — every prop passes through, so
|
|
185
|
+
* `variant="solid"` turns the end addon into a primary action when the design
|
|
186
|
+
* calls for one. `iconOnly` still needs its `aria-label`.
|
|
187
|
+
*/
|
|
188
|
+
export declare const InputGroupButton: React.ForwardRefExoticComponent<InputGroupButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
189
|
+
/**
|
|
190
|
+
* A single field boundary around a text control and its trimmings.
|
|
191
|
+
*
|
|
192
|
+
* ```tsx
|
|
193
|
+
* <InputGroup.Root>
|
|
194
|
+
* <InputGroup.Addon>
|
|
195
|
+
* <SearchIcon aria-hidden="true" />
|
|
196
|
+
* </InputGroup.Addon>
|
|
197
|
+
* <InputGroup.Input placeholder="Search…" />
|
|
198
|
+
* <InputGroup.Addon align="inline-end">
|
|
199
|
+
* <InputGroup.Button iconOnly aria-label="Clear">
|
|
200
|
+
* <XIcon aria-hidden="true" />
|
|
201
|
+
* </InputGroup.Button>
|
|
202
|
+
* </InputGroup.Addon>
|
|
203
|
+
* </InputGroup.Root>
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
export declare const InputGroup: {
|
|
207
|
+
Root: React.ForwardRefExoticComponent<InputGroupRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
208
|
+
Input: React.ForwardRefExoticComponent<InputGroupInputProps & React.RefAttributes<HTMLElement>>;
|
|
209
|
+
Textarea: React.ForwardRefExoticComponent<InputGroupTextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
210
|
+
Addon: React.ForwardRefExoticComponent<InputGroupAddonProps & React.RefAttributes<HTMLDivElement>>;
|
|
211
|
+
Text: React.ForwardRefExoticComponent<InputGroupTextProps & React.RefAttributes<HTMLSpanElement>>;
|
|
212
|
+
Button: React.ForwardRefExoticComponent<InputGroupButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
213
|
+
};
|
|
214
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "../../InputGroup-DsZyDXNn.js";
|
|
3
|
+
export { o as InputGroup, n as InputGroupAddon, i as InputGroupButton, t as InputGroupInput, e as InputGroupRoot, r as InputGroupText, a as InputGroupTextarea };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { InputGroup, InputGroupRoot, InputGroupInput, InputGroupTextarea, InputGroupAddon, InputGroupText, InputGroupButton, } from './InputGroup';
|
|
2
|
+
export type { InputGroupSize, InputGroupVariant, InputGroupAddonAlign, InputGroupRootProps, InputGroupInputProps, InputGroupTextareaProps, InputGroupAddonProps, InputGroupTextProps, InputGroupButtonProps, } from './InputGroup';
|