@primecoderin/fast-ui-react 0.0.0-stage → 1.0.0
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/CHANGELOG.md +106 -0
- package/LICENSE +21 -0
- package/README.md +180 -3
- package/dist/_virtual/_rolldown/runtime.js +12 -0
- package/dist/charts.d.ts +7 -0
- package/dist/charts.js +7 -0
- package/dist/components/Avatar/Avatar.d.ts +12 -0
- package/dist/components/Avatar/Avatar.js +92 -0
- package/dist/components/Button/Button.d.ts +44 -0
- package/dist/components/Button/Button.js +221 -0
- package/dist/components/Checkbox/CheckboxBox.d.ts +33 -0
- package/dist/components/Checkbox/CheckboxBox.js +148 -0
- package/dist/components/CodeSnippet/CodeSnippet.d.ts +26 -0
- package/dist/components/CodeSnippet/CodeSnippet.js +153 -0
- package/dist/components/Collapsible/Collapsible.d.ts +20 -0
- package/dist/components/Collapsible/Collapsible.js +97 -0
- package/dist/components/Container/Container.d.ts +301 -0
- package/dist/components/Container/Container.js +20 -0
- package/dist/components/FloatingActionButton/FloatingActionButton.d.ts +22 -0
- package/dist/components/FloatingActionButton/FloatingActionButton.js +141 -0
- package/dist/components/Grid/Grid.d.ts +311 -0
- package/dist/components/Grid/Grid.js +30 -0
- package/dist/components/IconTile/IconTile.d.ts +12 -0
- package/dist/components/IconTile/IconTile.js +70 -0
- package/dist/components/InlineError/InlineError.d.ts +9 -0
- package/dist/components/InlineError/InlineError.js +62 -0
- package/dist/components/Kbd/Kbd.d.ts +11 -0
- package/dist/components/Kbd/Kbd.js +31 -0
- package/dist/components/Link/Link.d.ts +18 -0
- package/dist/components/Link/Link.js +68 -0
- package/dist/components/Menu/ContextMenu.d.ts +18 -0
- package/dist/components/Menu/ContextMenu.js +68 -0
- package/dist/components/Menu/Menu.d.ts +86 -0
- package/dist/components/Menu/Menu.js +394 -0
- package/dist/components/OtpInput/OtpInput.d.ts +32 -0
- package/dist/components/OtpInput/OtpInput.js +177 -0
- package/dist/components/Popover/HoverPopover.d.ts +22 -0
- package/dist/components/Popover/HoverPopover.js +74 -0
- package/dist/components/Popover/Popover.d.ts +21 -0
- package/dist/components/Popover/Popover.js +64 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +17 -0
- package/dist/components/ProgressBar/ProgressBar.js +44 -0
- package/dist/components/Rating/Rating.d.ts +49 -0
- package/dist/components/Rating/Rating.js +241 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts +23 -0
- package/dist/components/ScrollArea/ScrollArea.js +90 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +29 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +99 -0
- package/dist/components/Separator/Separator.d.ts +9 -0
- package/dist/components/Separator/Separator.js +34 -0
- package/dist/components/Skeleton/Skeleton.d.ts +31 -0
- package/dist/components/Skeleton/Skeleton.js +152 -0
- package/dist/components/Slider/Slider.d.ts +54 -0
- package/dist/components/Slider/Slider.js +178 -0
- package/dist/components/Spinner/Spinner.d.ts +17 -0
- package/dist/components/Spinner/Spinner.js +118 -0
- package/dist/components/Stack/Stack.d.ts +302 -0
- package/dist/components/Stack/Stack.js +14 -0
- package/dist/components/StateIcon/StateIcon.d.ts +11 -0
- package/dist/components/StateIcon/StateIcon.js +65 -0
- package/dist/components/StatusBadge/StatusBadge.d.ts +19 -0
- package/dist/components/StatusBadge/StatusBadge.js +82 -0
- package/dist/components/Tabs/Tabs.d.ts +28 -0
- package/dist/components/Tabs/Tabs.js +109 -0
- package/dist/components/Tag/Tag.d.ts +11 -0
- package/dist/components/Tag/Tag.js +66 -0
- package/dist/components/Toast/AppToaster.d.ts +8 -0
- package/dist/components/Toast/AppToaster.js +135 -0
- package/dist/components/Toast/toast-manager.d.ts +28 -0
- package/dist/components/Toast/toast-manager.js +47 -0
- package/dist/components/ToggleButton/ToggleButton.d.ts +26 -0
- package/dist/components/ToggleButton/ToggleButton.js +106 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +32 -0
- package/dist/components/ToggleGroup/ToggleGroup.js +79 -0
- package/dist/components/Tooltip/Tooltip.d.ts +16 -0
- package/dist/components/Tooltip/Tooltip.js +58 -0
- package/dist/components/Tooltip/TooltipGroup.d.ts +22 -0
- package/dist/components/Tooltip/TooltipGroup.js +65 -0
- package/dist/components/Typography/Typography.d.ts +17 -0
- package/dist/components/Typography/Typography.js +100 -0
- package/dist/editor-forms.d.ts +1 -0
- package/dist/editor-forms.js +1 -0
- package/dist/editor.d.ts +1 -0
- package/dist/editor.js +1 -0
- package/dist/fonts/LICENSE +93 -0
- package/dist/fonts/inter-cyrillic-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-wght-normal.woff2 +0 -0
- package/dist/fonts.css +69 -0
- package/dist/forms.d.ts +22 -0
- package/dist/forms.js +23 -0
- package/dist/foundation.css +23 -0
- package/dist/global.css +116 -0
- package/dist/hooks/useAppToast.d.ts +12 -0
- package/dist/hooks/useAppToast.js +29 -0
- package/dist/icons/icons.d.ts +43 -0
- package/dist/icons/icons.js +44 -0
- package/dist/index.d.ts +106 -0
- package/dist/index.js +101 -0
- package/dist/patterns/Accordion/Accordion.d.ts +35 -0
- package/dist/patterns/Accordion/Accordion.js +139 -0
- package/dist/patterns/Alert/Alert.d.ts +38 -0
- package/dist/patterns/Alert/Alert.js +151 -0
- package/dist/patterns/AppShell/AppShell.d.ts +39 -0
- package/dist/patterns/AppShell/AppShell.js +218 -0
- package/dist/patterns/Breadcrumbs/Breadcrumbs.d.ts +21 -0
- package/dist/patterns/Breadcrumbs/Breadcrumbs.js +73 -0
- package/dist/patterns/Calendar/Calendar.d.ts +59 -0
- package/dist/patterns/Calendar/Calendar.js +283 -0
- package/dist/patterns/Calendar/DateRangePicker.d.ts +53 -0
- package/dist/patterns/Calendar/DateRangePicker.js +266 -0
- package/dist/patterns/Calendar/FormDateRangeField.d.ts +24 -0
- package/dist/patterns/Calendar/FormDateRangeField.js +138 -0
- package/dist/patterns/Card/Card.d.ts +26 -0
- package/dist/patterns/Card/Card.js +125 -0
- package/dist/patterns/Carousel/Carousel.d.ts +33 -0
- package/dist/patterns/Carousel/Carousel.js +127 -0
- package/dist/patterns/Cascader/Cascader.d.ts +53 -0
- package/dist/patterns/Cascader/Cascader.js +371 -0
- package/dist/patterns/Cascader/FormCascaderField.d.ts +21 -0
- package/dist/patterns/Cascader/FormCascaderField.js +130 -0
- package/dist/patterns/Charts/AreaChart.d.ts +13 -0
- package/dist/patterns/Charts/AreaChart.js +220 -0
- package/dist/patterns/Charts/BarChart.d.ts +11 -0
- package/dist/patterns/Charts/BarChart.js +220 -0
- package/dist/patterns/Charts/DonutChart.d.ts +37 -0
- package/dist/patterns/Charts/DonutChart.js +215 -0
- package/dist/patterns/Charts/GaugeChart.d.ts +44 -0
- package/dist/patterns/Charts/GaugeChart.js +210 -0
- package/dist/patterns/Charts/LineChart.d.ts +14 -0
- package/dist/patterns/Charts/LineChart.js +222 -0
- package/dist/patterns/Charts/Sparkline.d.ts +24 -0
- package/dist/patterns/Charts/Sparkline.js +81 -0
- package/dist/patterns/Charts/chart-parts.d.ts +139 -0
- package/dist/patterns/Charts/chart-parts.js +385 -0
- package/dist/patterns/Charts/gauge-math.d.ts +20 -0
- package/dist/patterns/Charts/gauge-math.js +21 -0
- package/dist/patterns/Charts/sparkline-path.d.ts +11 -0
- package/dist/patterns/Charts/sparkline-path.js +24 -0
- package/dist/patterns/ColorPicker/ColorPicker.d.ts +50 -0
- package/dist/patterns/ColorPicker/ColorPicker.js +590 -0
- package/dist/patterns/ColorPicker/FormColorField.d.ts +21 -0
- package/dist/patterns/ColorPicker/FormColorField.js +130 -0
- package/dist/patterns/ColorPicker/color-value.d.ts +19 -0
- package/dist/patterns/ColorPicker/color-value.js +72 -0
- package/dist/patterns/Combobox/Autocomplete.d.ts +48 -0
- package/dist/patterns/Combobox/Autocomplete.js +158 -0
- package/dist/patterns/Combobox/Combobox.d.ts +52 -0
- package/dist/patterns/Combobox/Combobox.js +195 -0
- package/dist/patterns/Combobox/ComboboxPopup.d.ts +24 -0
- package/dist/patterns/Combobox/ComboboxPopup.js +107 -0
- package/dist/patterns/Combobox/FormAutocompleteField.d.ts +17 -0
- package/dist/patterns/Combobox/FormAutocompleteField.js +119 -0
- package/dist/patterns/Combobox/FormComboboxField.d.ts +18 -0
- package/dist/patterns/Combobox/FormComboboxField.js +119 -0
- package/dist/patterns/Combobox/FormMultiSelectField.d.ts +18 -0
- package/dist/patterns/Combobox/FormMultiSelectField.js +119 -0
- package/dist/patterns/Combobox/MultiSelect.d.ts +54 -0
- package/dist/patterns/Combobox/MultiSelect.js +175 -0
- package/dist/patterns/CommandPalette/CommandPalette.d.ts +50 -0
- package/dist/patterns/CommandPalette/CommandPalette.js +193 -0
- package/dist/patterns/DataTable/DataTable.d.ts +107 -0
- package/dist/patterns/DataTable/DataTable.js +364 -0
- package/dist/patterns/DateTimePicker/DateTimePanel.d.ts +28 -0
- package/dist/patterns/DateTimePicker/DateTimePanel.js +444 -0
- package/dist/patterns/DateTimePicker/DateTimePicker.d.ts +75 -0
- package/dist/patterns/DateTimePicker/DateTimePicker.js +271 -0
- package/dist/patterns/DateTimePicker/FormDateTimeField.d.ts +32 -0
- package/dist/patterns/DateTimePicker/FormDateTimeField.js +148 -0
- package/dist/patterns/DateTimePicker/TimeSliders.d.ts +14 -0
- package/dist/patterns/DateTimePicker/TimeSliders.js +206 -0
- package/dist/patterns/DateTimePicker/picker-labels.d.ts +30 -0
- package/dist/patterns/DateTimePicker/picker-labels.js +23 -0
- package/dist/patterns/DateTimePicker/picker-values.d.ts +98 -0
- package/dist/patterns/DateTimePicker/picker-values.js +194 -0
- package/dist/patterns/DescriptionList/DescriptionList.d.ts +20 -0
- package/dist/patterns/DescriptionList/DescriptionList.js +57 -0
- package/dist/patterns/Dialog/Dialog.d.ts +26 -0
- package/dist/patterns/Dialog/Dialog.js +212 -0
- package/dist/patterns/Drawer/Drawer.d.ts +33 -0
- package/dist/patterns/Drawer/Drawer.js +153 -0
- package/dist/patterns/EmptyState/EmptyState.d.ts +35 -0
- package/dist/patterns/EmptyState/EmptyState.js +44 -0
- package/dist/patterns/FileUpload/FileUpload.d.ts +87 -0
- package/dist/patterns/FileUpload/FileUpload.js +417 -0
- package/dist/patterns/FileUpload/FormFileUploadField.d.ts +19 -0
- package/dist/patterns/FileUpload/FormFileUploadField.js +117 -0
- package/dist/patterns/FileUpload/add-files.d.ts +26 -0
- package/dist/patterns/FileUpload/add-files.js +35 -0
- package/dist/patterns/FileUpload/file-size.d.ts +14 -0
- package/dist/patterns/FileUpload/file-size.js +44 -0
- package/dist/patterns/FormField/CheckboxField.d.ts +26 -0
- package/dist/patterns/FormField/CheckboxField.js +97 -0
- package/dist/patterns/FormField/FieldFrame.d.ts +85 -0
- package/dist/patterns/FormField/FieldFrame.js +257 -0
- package/dist/patterns/FormField/FormCheckboxField.d.ts +17 -0
- package/dist/patterns/FormField/FormCheckboxField.js +92 -0
- package/dist/patterns/FormField/FormRadioGroupField.d.ts +16 -0
- package/dist/patterns/FormField/FormRadioGroupField.js +97 -0
- package/dist/patterns/FormField/FormRatingField.d.ts +19 -0
- package/dist/patterns/FormField/FormRatingField.js +119 -0
- package/dist/patterns/FormField/FormSelectField.d.ts +16 -0
- package/dist/patterns/FormField/FormSelectField.js +91 -0
- package/dist/patterns/FormField/FormSliderField.d.ts +22 -0
- package/dist/patterns/FormField/FormSliderField.js +128 -0
- package/dist/patterns/FormField/FormSwitchField.d.ts +19 -0
- package/dist/patterns/FormField/FormSwitchField.js +88 -0
- package/dist/patterns/FormField/FormTextAreaField.d.ts +12 -0
- package/dist/patterns/FormField/FormTextAreaField.js +91 -0
- package/dist/patterns/FormField/FormTextField.d.ts +23 -0
- package/dist/patterns/FormField/FormTextField.js +103 -0
- package/dist/patterns/FormField/RadioGroupField.d.ts +38 -0
- package/dist/patterns/FormField/RadioGroupField.js +201 -0
- package/dist/patterns/FormField/SelectField.d.ts +43 -0
- package/dist/patterns/FormField/SelectField.js +211 -0
- package/dist/patterns/FormField/SwitchField.d.ts +27 -0
- package/dist/patterns/FormField/SwitchField.js +105 -0
- package/dist/patterns/FormField/TextAreaField.d.ts +37 -0
- package/dist/patterns/FormField/TextAreaField.js +134 -0
- package/dist/patterns/FormField/TextField.d.ts +51 -0
- package/dist/patterns/FormField/TextField.js +256 -0
- package/dist/patterns/FormField/error-message.d.ts +6 -0
- package/dist/patterns/FormField/error-message.js +8 -0
- package/dist/patterns/FormField/field-styles.d.ts +44 -0
- package/dist/patterns/FormField/field-styles.js +89 -0
- package/dist/patterns/FormField/field-types.d.ts +4 -0
- package/dist/patterns/FormField/use-field-ids.d.ts +18 -0
- package/dist/patterns/FormField/use-field-ids.js +53 -0
- package/dist/patterns/List/List.d.ts +38 -0
- package/dist/patterns/List/List.js +174 -0
- package/dist/patterns/MentionsInput/FormMentionsField.d.ts +18 -0
- package/dist/patterns/MentionsInput/FormMentionsField.js +124 -0
- package/dist/patterns/MentionsInput/MentionsInput.d.ts +57 -0
- package/dist/patterns/MentionsInput/MentionsInput.js +133 -0
- package/dist/patterns/MentionsInput/mention-text.d.ts +24 -0
- package/dist/patterns/MentionsInput/mention-text.js +31 -0
- package/dist/patterns/Menubar/Menubar.d.ts +22 -0
- package/dist/patterns/Menubar/Menubar.js +79 -0
- package/dist/patterns/NavigationMenu/NavigationMenu.d.ts +27 -0
- package/dist/patterns/NavigationMenu/NavigationMenu.js +104 -0
- package/dist/patterns/NumberField/FormNumberField.d.ts +18 -0
- package/dist/patterns/NumberField/FormNumberField.js +119 -0
- package/dist/patterns/NumberField/NumberField.d.ts +57 -0
- package/dist/patterns/NumberField/NumberField.js +242 -0
- package/dist/patterns/Pagination/Pagination.d.ts +31 -0
- package/dist/patterns/Pagination/Pagination.js +275 -0
- package/dist/patterns/Pagination/page-items.d.ts +18 -0
- package/dist/patterns/Pagination/page-items.js +40 -0
- package/dist/patterns/PhoneField/FormPhoneField.d.ts +22 -0
- package/dist/patterns/PhoneField/FormPhoneField.js +97 -0
- package/dist/patterns/PhoneField/PhoneField.d.ts +60 -0
- package/dist/patterns/PhoneField/PhoneField.js +448 -0
- package/dist/patterns/PhoneField/phone-value.d.ts +26 -0
- package/dist/patterns/PhoneField/phone-value.js +38 -0
- package/dist/patterns/QRCode/QRCode.d.ts +37 -0
- package/dist/patterns/QRCode/QRCode.js +120 -0
- package/dist/patterns/QRCode/qr-path.d.ts +7 -0
- package/dist/patterns/QRCode/qr-path.js +25 -0
- package/dist/patterns/ResizablePanels/ResizablePanels.d.ts +34 -0
- package/dist/patterns/ResizablePanels/ResizablePanels.js +175 -0
- package/dist/patterns/ResizablePanels/panel-sizes.d.ts +31 -0
- package/dist/patterns/ResizablePanels/panel-sizes.js +54 -0
- package/dist/patterns/RichTextEditor/FormRichTextField.d.ts +18 -0
- package/dist/patterns/RichTextEditor/FormRichTextField.js +118 -0
- package/dist/patterns/RichTextEditor/RichTextEditor.d.ts +71 -0
- package/dist/patterns/RichTextEditor/RichTextEditor.js +453 -0
- package/dist/patterns/SearchInput/SearchInput.d.ts +26 -0
- package/dist/patterns/SearchInput/SearchInput.js +98 -0
- package/dist/patterns/SideNav/SideNav.d.ts +50 -0
- package/dist/patterns/SideNav/SideNav.js +269 -0
- package/dist/patterns/Stat/Stat.d.ts +51 -0
- package/dist/patterns/Stat/Stat.js +292 -0
- package/dist/patterns/Stepper/Stepper.d.ts +35 -0
- package/dist/patterns/Stepper/Stepper.js +110 -0
- package/dist/patterns/TagGroup/TagGroup.d.ts +44 -0
- package/dist/patterns/TagGroup/TagGroup.js +151 -0
- package/dist/patterns/TagsInput/FormTagsInputField.d.ts +18 -0
- package/dist/patterns/TagsInput/FormTagsInputField.js +124 -0
- package/dist/patterns/TagsInput/TagsInput.d.ts +51 -0
- package/dist/patterns/TagsInput/TagsInput.js +97 -0
- package/dist/patterns/Timeline/Timeline.d.ts +29 -0
- package/dist/patterns/Timeline/Timeline.js +85 -0
- package/dist/patterns/Toolbar/Toolbar.d.ts +31 -0
- package/dist/patterns/Toolbar/Toolbar.js +105 -0
- package/dist/patterns/Tour/Tour.d.ts +38 -0
- package/dist/patterns/Tour/Tour.js +333 -0
- package/dist/patterns/TransferList/FormTransferListField.d.ts +19 -0
- package/dist/patterns/TransferList/FormTransferListField.js +117 -0
- package/dist/patterns/TransferList/TransferList.d.ts +53 -0
- package/dist/patterns/TransferList/TransferList.js +441 -0
- package/dist/patterns/TreeSelect/FormTreeSelectField.d.ts +28 -0
- package/dist/patterns/TreeSelect/FormTreeSelectField.js +88 -0
- package/dist/patterns/TreeSelect/TreeSelect.d.ts +49 -0
- package/dist/patterns/TreeSelect/TreeSelect.js +375 -0
- package/dist/patterns/TreeView/TreeView.d.ts +40 -0
- package/dist/patterns/TreeView/TreeView.js +296 -0
- package/dist/provider/DesignSystemProvider.d.ts +54 -0
- package/dist/provider/DesignSystemProvider.js +270 -0
- package/dist/provider/nonce.d.ts +7 -0
- package/dist/provider/nonce.js +13 -0
- package/dist/styles.css +2 -0
- package/dist/theme/chart-palette.d.ts +51 -0
- package/dist/theme/chart-palette.js +112 -0
- package/dist/theme/create-theme.d.ts +52 -0
- package/dist/theme/create-theme.js +75 -0
- package/dist/theme/style-element.d.ts +28 -0
- package/dist/theme/style-element.js +79 -0
- package/dist/theme/tenant-branding.d.ts +48 -0
- package/dist/theme/tenant-branding.js +65 -0
- package/dist/theme/theme-switch.d.ts +25 -0
- package/dist/theme/theme-switch.js +90 -0
- package/dist/theme/token-names.d.ts +3 -0
- package/dist/theme/token-names.js +166 -0
- package/dist/theme.css +241 -0
- package/dist/tokens.css +383 -0
- package/dist/types/direction.d.ts +4 -0
- package/dist/types/tone.d.ts +7 -0
- package/dist/utils/cn.d.ts +7 -0
- package/dist/utils/cn.js +50 -0
- package/dist/utils/first-field.d.ts +8 -0
- package/dist/utils/first-field.js +10 -0
- package/dist/utils/layout.d.ts +33 -0
- package/dist/utils/layout.js +30 -0
- package/dist/utils/popup.d.ts +12 -0
- package/dist/utils/popup.js +27 -0
- package/docs/accessibility.md +61 -0
- package/docs/advanced-components.md +38 -0
- package/docs/ai-assistants.md +44 -0
- package/docs/architecture.md +65 -0
- package/docs/browser-support.md +30 -0
- package/docs/charts.md +56 -0
- package/docs/components.md +2928 -0
- package/docs/conventions.md +19 -0
- package/docs/customization.md +79 -0
- package/docs/dates-files-data.md +48 -0
- package/docs/design-principles.md +50 -0
- package/docs/faq.md +68 -0
- package/docs/forms.md +114 -0
- package/docs/getting-started.md +64 -0
- package/docs/icons.md +48 -0
- package/docs/internationalization.md +64 -0
- package/docs/layout-and-navigation.md +51 -0
- package/docs/nextjs.md +69 -0
- package/docs/releasing.md +40 -0
- package/docs/testing.md +242 -0
- package/docs/theming.md +118 -0
- package/docs/typescript.md +62 -0
- package/llms-full.txt +4573 -0
- package/llms.txt +52 -0
- package/package.json +193 -6
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { Controller } from "react-hook-form";
|
|
4
|
+
import { toErrorText } from "./error-message.js";
|
|
5
|
+
import { TextField } from "./TextField.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
// src/patterns/FormField/FormTextField.tsx
|
|
8
|
+
/** A TextField bound to react-hook-form, with consistent error display. */
|
|
9
|
+
var FormTextField = (t0) => {
|
|
10
|
+
const $ = c(26);
|
|
11
|
+
let control;
|
|
12
|
+
let formatError;
|
|
13
|
+
let name;
|
|
14
|
+
let rules;
|
|
15
|
+
let successMessage;
|
|
16
|
+
let t1;
|
|
17
|
+
let t2;
|
|
18
|
+
let t3;
|
|
19
|
+
let t4;
|
|
20
|
+
let textFieldProps;
|
|
21
|
+
if ($[0] !== t0) {
|
|
22
|
+
({control, name, rules, formatError, successMessage, hideLabel: t1, size: t2, type: t3, disabled: t4, ...textFieldProps} = t0);
|
|
23
|
+
$[0] = t0;
|
|
24
|
+
$[1] = control;
|
|
25
|
+
$[2] = formatError;
|
|
26
|
+
$[3] = name;
|
|
27
|
+
$[4] = rules;
|
|
28
|
+
$[5] = successMessage;
|
|
29
|
+
$[6] = t1;
|
|
30
|
+
$[7] = t2;
|
|
31
|
+
$[8] = t3;
|
|
32
|
+
$[9] = t4;
|
|
33
|
+
$[10] = textFieldProps;
|
|
34
|
+
} else {
|
|
35
|
+
control = $[1];
|
|
36
|
+
formatError = $[2];
|
|
37
|
+
name = $[3];
|
|
38
|
+
rules = $[4];
|
|
39
|
+
successMessage = $[5];
|
|
40
|
+
t1 = $[6];
|
|
41
|
+
t2 = $[7];
|
|
42
|
+
t3 = $[8];
|
|
43
|
+
t4 = $[9];
|
|
44
|
+
textFieldProps = $[10];
|
|
45
|
+
}
|
|
46
|
+
const hideLabel = t1 === void 0 ? false : t1;
|
|
47
|
+
const size = t2 === void 0 ? "medium" : t2;
|
|
48
|
+
const type = t3 === void 0 ? "text" : t3;
|
|
49
|
+
const disabled = t4 === void 0 ? false : t4;
|
|
50
|
+
let t5;
|
|
51
|
+
if ($[11] !== rules) {
|
|
52
|
+
t5 = rules ? { rules } : {};
|
|
53
|
+
$[11] = rules;
|
|
54
|
+
$[12] = t5;
|
|
55
|
+
} else t5 = $[12];
|
|
56
|
+
let t6;
|
|
57
|
+
if ($[13] !== disabled || $[14] !== formatError || $[15] !== hideLabel || $[16] !== size || $[17] !== successMessage || $[18] !== textFieldProps || $[19] !== type) {
|
|
58
|
+
t6 = (t7) => {
|
|
59
|
+
const { field, fieldState } = t7;
|
|
60
|
+
const errorMessage = toErrorText(fieldState.error?.message, formatError);
|
|
61
|
+
const isConfirmed = errorMessage === void 0 && successMessage !== void 0 && fieldState.isTouched && typeof field.value === "string" && field.value !== "";
|
|
62
|
+
return /* @__PURE__ */ jsx(TextField, {
|
|
63
|
+
...textFieldProps,
|
|
64
|
+
hideLabel,
|
|
65
|
+
size,
|
|
66
|
+
type,
|
|
67
|
+
disabled,
|
|
68
|
+
name: field.name,
|
|
69
|
+
inputRef: field.ref,
|
|
70
|
+
value: field.value == null ? "" : String(field.value),
|
|
71
|
+
onValueChange: field.onChange,
|
|
72
|
+
onBlur: field.onBlur,
|
|
73
|
+
invalid: fieldState.invalid,
|
|
74
|
+
...errorMessage === void 0 ? {} : { errorMessage },
|
|
75
|
+
...isConfirmed ? { successMessage } : {}
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
$[13] = disabled;
|
|
79
|
+
$[14] = formatError;
|
|
80
|
+
$[15] = hideLabel;
|
|
81
|
+
$[16] = size;
|
|
82
|
+
$[17] = successMessage;
|
|
83
|
+
$[18] = textFieldProps;
|
|
84
|
+
$[19] = type;
|
|
85
|
+
$[20] = t6;
|
|
86
|
+
} else t6 = $[20];
|
|
87
|
+
let t7;
|
|
88
|
+
if ($[21] !== control || $[22] !== name || $[23] !== t5 || $[24] !== t6) {
|
|
89
|
+
t7 = /* @__PURE__ */ jsx(Controller, {
|
|
90
|
+
control,
|
|
91
|
+
name,
|
|
92
|
+
...t5,
|
|
93
|
+
render: t6
|
|
94
|
+
});
|
|
95
|
+
$[21] = control;
|
|
96
|
+
$[22] = name;
|
|
97
|
+
$[23] = t5;
|
|
98
|
+
$[24] = t6;
|
|
99
|
+
$[25] = t7;
|
|
100
|
+
} else t7 = $[25];
|
|
101
|
+
return t7;
|
|
102
|
+
};
|
|
103
|
+
export { FormTextField };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Ref } from "react";
|
|
2
|
+
import type { FieldOrientation } from "./field-types.js";
|
|
3
|
+
export interface RadioOption {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
disabled?: boolean | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface RadioGroupFieldProps {
|
|
9
|
+
label: string;
|
|
10
|
+
options: readonly RadioOption[];
|
|
11
|
+
/** The chosen option's `value`; an empty string for none. */
|
|
12
|
+
value: string;
|
|
13
|
+
/** Called with the chosen option's `value`. */
|
|
14
|
+
onValueChange: (value: string) => void;
|
|
15
|
+
/** The field's name in a submitted form. */
|
|
16
|
+
name?: string | undefined;
|
|
17
|
+
hint?: string | undefined;
|
|
18
|
+
/** The validation message, in the user's language: shown in red under the group, which it marks invalid. */
|
|
19
|
+
errorMessage?: string | undefined;
|
|
20
|
+
/** Marks the group invalid without a message to show. */
|
|
21
|
+
invalid?: boolean | undefined;
|
|
22
|
+
required?: boolean | undefined;
|
|
23
|
+
disabled?: boolean | undefined;
|
|
24
|
+
/** Label above the group (default) or in a column beside it. */
|
|
25
|
+
orientation?: FieldOrientation | undefined;
|
|
26
|
+
/** Lay the options out in a column (default) or a row. */
|
|
27
|
+
layout?: "vertical" | "horizontal" | undefined;
|
|
28
|
+
/** An option was left. */
|
|
29
|
+
onBlur?: (() => void) | undefined;
|
|
30
|
+
/** The group's hidden input, e.g. for a form library to focus the first invalid field. */
|
|
31
|
+
inputRef?: Ref<HTMLInputElement> | undefined;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A labelled radio group with the design system's hint and error. It is controlled: it checks the option whose
|
|
35
|
+
* `value` is `value` and reports a choice through `onValueChange`. Bound to react-hook-form, it is
|
|
36
|
+
* FormRadioGroupField.
|
|
37
|
+
*/
|
|
38
|
+
export declare const RadioGroupField: ({ label, options, value, onValueChange, name, hint, errorMessage, onBlur, inputRef, invalid, required, disabled, orientation, layout, }: RadioGroupFieldProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { Field } from "@base-ui/react/field";
|
|
4
|
+
import { Fieldset } from "@base-ui/react/fieldset";
|
|
5
|
+
import { Radio } from "@base-ui/react/radio";
|
|
6
|
+
import { RadioGroup } from "@base-ui/react/radio-group";
|
|
7
|
+
import { cn } from "../../utils/cn.js";
|
|
8
|
+
import { FieldMessages } from "./FieldFrame.js";
|
|
9
|
+
import { fieldChoice, fieldLabel, fieldRoot } from "./field-styles.js";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
// src/patterns/FormField/RadioGroupField.tsx
|
|
12
|
+
/** Figma: a 16px circle with a 2px border, and an 8px dot in the brand teal when chosen. */
|
|
13
|
+
var RADIO = [
|
|
14
|
+
"group/radio box-border inline-flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-full border-2 border-line-strong bg-surface p-0 outline-none",
|
|
15
|
+
"transition-colors duration-150 ease-standard",
|
|
16
|
+
"not-data-disabled:not-data-checked:hover:border-fg-secondary",
|
|
17
|
+
"not-data-disabled:data-checked:border-primary",
|
|
18
|
+
"not-data-disabled:data-invalid:not-data-checked:border-error-solid",
|
|
19
|
+
"focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2 focus-visible:ring-offset-page",
|
|
20
|
+
"data-disabled:cursor-not-allowed data-disabled:border-line data-disabled:bg-subtle"
|
|
21
|
+
].join(" ");
|
|
22
|
+
var RADIO_DOT = "size-2 rounded-full bg-primary group-data-disabled/radio:bg-fg-disabled";
|
|
23
|
+
/**
|
|
24
|
+
* A labelled radio group with the design system's hint and error. It is controlled: it checks the option whose
|
|
25
|
+
* `value` is `value` and reports a choice through `onValueChange`. Bound to react-hook-form, it is
|
|
26
|
+
* FormRadioGroupField.
|
|
27
|
+
*/
|
|
28
|
+
var RadioGroupField = (t0) => {
|
|
29
|
+
const $ = c(49);
|
|
30
|
+
const { label, options, value, onValueChange, name, hint, errorMessage, onBlur, inputRef, invalid: t1, required: t2, disabled: t3, orientation: t4, layout: t5 } = t0;
|
|
31
|
+
const invalid = t1 === void 0 ? false : t1;
|
|
32
|
+
const required = t2 === void 0 ? false : t2;
|
|
33
|
+
const disabled = t3 === void 0 ? false : t3;
|
|
34
|
+
const orientation = t4 === void 0 ? "vertical" : t4;
|
|
35
|
+
const layout = t5 === void 0 ? "vertical" : t5;
|
|
36
|
+
const isInvalid = invalid || errorMessage !== void 0;
|
|
37
|
+
let t6;
|
|
38
|
+
if ($[0] !== name) {
|
|
39
|
+
t6 = name ? { name } : {};
|
|
40
|
+
$[0] = name;
|
|
41
|
+
$[1] = t6;
|
|
42
|
+
} else t6 = $[1];
|
|
43
|
+
let t7;
|
|
44
|
+
if ($[2] !== orientation) {
|
|
45
|
+
t7 = cn(fieldRoot({ orientation }), "m-0 border-0 p-0");
|
|
46
|
+
$[2] = orientation;
|
|
47
|
+
$[3] = t7;
|
|
48
|
+
} else t7 = $[3];
|
|
49
|
+
let t8;
|
|
50
|
+
if ($[4] !== onValueChange) {
|
|
51
|
+
t8 = (next) => {
|
|
52
|
+
onValueChange(String(next));
|
|
53
|
+
};
|
|
54
|
+
$[4] = onValueChange;
|
|
55
|
+
$[5] = t8;
|
|
56
|
+
} else t8 = $[5];
|
|
57
|
+
const t9 = required || void 0;
|
|
58
|
+
let t10;
|
|
59
|
+
if ($[6] !== inputRef || $[7] !== t8 || $[8] !== t9 || $[9] !== value) {
|
|
60
|
+
t10 = /* @__PURE__ */ jsx(RadioGroup, {
|
|
61
|
+
value,
|
|
62
|
+
onValueChange: t8,
|
|
63
|
+
inputRef,
|
|
64
|
+
"aria-required": t9
|
|
65
|
+
});
|
|
66
|
+
$[6] = inputRef;
|
|
67
|
+
$[7] = t8;
|
|
68
|
+
$[8] = t9;
|
|
69
|
+
$[9] = value;
|
|
70
|
+
$[10] = t10;
|
|
71
|
+
} else t10 = $[10];
|
|
72
|
+
let t11;
|
|
73
|
+
if ($[11] !== orientation) {
|
|
74
|
+
t11 = fieldLabel({ orientation });
|
|
75
|
+
$[11] = orientation;
|
|
76
|
+
$[12] = t11;
|
|
77
|
+
} else t11 = $[12];
|
|
78
|
+
const t12 = isInvalid || void 0;
|
|
79
|
+
let t13;
|
|
80
|
+
if ($[13] !== required) {
|
|
81
|
+
t13 = required ? /* @__PURE__ */ jsx("span", {
|
|
82
|
+
"aria-hidden": "true",
|
|
83
|
+
className: "ms-0.5 text-error-text",
|
|
84
|
+
children: "*"
|
|
85
|
+
}) : null;
|
|
86
|
+
$[13] = required;
|
|
87
|
+
$[14] = t13;
|
|
88
|
+
} else t13 = $[14];
|
|
89
|
+
let t14;
|
|
90
|
+
if ($[15] !== label || $[16] !== t11 || $[17] !== t12 || $[18] !== t13) {
|
|
91
|
+
t14 = /* @__PURE__ */ jsxs(Fieldset.Legend, {
|
|
92
|
+
className: t11,
|
|
93
|
+
"data-invalid": t12,
|
|
94
|
+
children: [label, t13]
|
|
95
|
+
});
|
|
96
|
+
$[15] = label;
|
|
97
|
+
$[16] = t11;
|
|
98
|
+
$[17] = t12;
|
|
99
|
+
$[18] = t13;
|
|
100
|
+
$[19] = t14;
|
|
101
|
+
} else t14 = $[19];
|
|
102
|
+
const t15 = layout === "horizontal" ? "flex-row flex-wrap gap-x-4" : "flex-col";
|
|
103
|
+
let t16;
|
|
104
|
+
if ($[20] !== t15) {
|
|
105
|
+
t16 = cn("flex gap-2", t15);
|
|
106
|
+
$[20] = t15;
|
|
107
|
+
$[21] = t16;
|
|
108
|
+
} else t16 = $[21];
|
|
109
|
+
let t17;
|
|
110
|
+
if ($[22] !== onBlur || $[23] !== options) {
|
|
111
|
+
let t18;
|
|
112
|
+
if ($[25] !== onBlur) {
|
|
113
|
+
t18 = (option) => /* @__PURE__ */ jsx(Field.Item, {
|
|
114
|
+
disabled: option.disabled,
|
|
115
|
+
children: /* @__PURE__ */ jsxs(Field.Label, {
|
|
116
|
+
className: fieldChoice,
|
|
117
|
+
children: [/* @__PURE__ */ jsx(Radio.Root, {
|
|
118
|
+
value: option.value,
|
|
119
|
+
className: RADIO,
|
|
120
|
+
onBlur,
|
|
121
|
+
children: /* @__PURE__ */ jsx(Radio.Indicator, { className: RADIO_DOT })
|
|
122
|
+
}), option.label]
|
|
123
|
+
})
|
|
124
|
+
}, option.value);
|
|
125
|
+
$[25] = onBlur;
|
|
126
|
+
$[26] = t18;
|
|
127
|
+
} else t18 = $[26];
|
|
128
|
+
t17 = options.map(t18);
|
|
129
|
+
$[22] = onBlur;
|
|
130
|
+
$[23] = options;
|
|
131
|
+
$[24] = t17;
|
|
132
|
+
} else t17 = $[24];
|
|
133
|
+
let t18;
|
|
134
|
+
if ($[27] !== t16 || $[28] !== t17) {
|
|
135
|
+
t18 = /* @__PURE__ */ jsx("div", {
|
|
136
|
+
className: t16,
|
|
137
|
+
children: t17
|
|
138
|
+
});
|
|
139
|
+
$[27] = t16;
|
|
140
|
+
$[28] = t17;
|
|
141
|
+
$[29] = t18;
|
|
142
|
+
} else t18 = $[29];
|
|
143
|
+
let t19;
|
|
144
|
+
if ($[30] !== errorMessage) {
|
|
145
|
+
t19 = errorMessage === void 0 ? {} : { errorMessage };
|
|
146
|
+
$[30] = errorMessage;
|
|
147
|
+
$[31] = t19;
|
|
148
|
+
} else t19 = $[31];
|
|
149
|
+
let t20;
|
|
150
|
+
if ($[32] !== hint) {
|
|
151
|
+
t20 = hint ? { hint } : {};
|
|
152
|
+
$[32] = hint;
|
|
153
|
+
$[33] = t20;
|
|
154
|
+
} else t20 = $[33];
|
|
155
|
+
let t21;
|
|
156
|
+
if ($[34] !== t19 || $[35] !== t20) {
|
|
157
|
+
t21 = /* @__PURE__ */ jsx(FieldMessages, {
|
|
158
|
+
...t19,
|
|
159
|
+
...t20
|
|
160
|
+
});
|
|
161
|
+
$[34] = t19;
|
|
162
|
+
$[35] = t20;
|
|
163
|
+
$[36] = t21;
|
|
164
|
+
} else t21 = $[36];
|
|
165
|
+
let t22;
|
|
166
|
+
if ($[37] !== orientation || $[38] !== t10 || $[39] !== t14 || $[40] !== t18 || $[41] !== t21 || $[42] !== t7) {
|
|
167
|
+
t22 = /* @__PURE__ */ jsxs(Fieldset.Root, {
|
|
168
|
+
className: t7,
|
|
169
|
+
"data-orientation": orientation,
|
|
170
|
+
render: t10,
|
|
171
|
+
children: [
|
|
172
|
+
t14,
|
|
173
|
+
t18,
|
|
174
|
+
t21
|
|
175
|
+
]
|
|
176
|
+
});
|
|
177
|
+
$[37] = orientation;
|
|
178
|
+
$[38] = t10;
|
|
179
|
+
$[39] = t14;
|
|
180
|
+
$[40] = t18;
|
|
181
|
+
$[41] = t21;
|
|
182
|
+
$[42] = t7;
|
|
183
|
+
$[43] = t22;
|
|
184
|
+
} else t22 = $[43];
|
|
185
|
+
let t23;
|
|
186
|
+
if ($[44] !== disabled || $[45] !== isInvalid || $[46] !== t22 || $[47] !== t6) {
|
|
187
|
+
t23 = /* @__PURE__ */ jsx(Field.Root, {
|
|
188
|
+
...t6,
|
|
189
|
+
invalid: isInvalid,
|
|
190
|
+
disabled,
|
|
191
|
+
children: t22
|
|
192
|
+
});
|
|
193
|
+
$[44] = disabled;
|
|
194
|
+
$[45] = isInvalid;
|
|
195
|
+
$[46] = t22;
|
|
196
|
+
$[47] = t6;
|
|
197
|
+
$[48] = t23;
|
|
198
|
+
} else t23 = $[48];
|
|
199
|
+
return t23;
|
|
200
|
+
};
|
|
201
|
+
export { RadioGroupField };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ReactNode, type Ref } from "react";
|
|
2
|
+
import type { FieldOrientation, FieldSize } from "./field-types.js";
|
|
3
|
+
export interface SelectOption {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
disabled?: boolean | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface SelectFieldProps {
|
|
9
|
+
label: string;
|
|
10
|
+
options: readonly SelectOption[];
|
|
11
|
+
/** The chosen option's `value`; an empty string for none, which shows the placeholder. */
|
|
12
|
+
value: string;
|
|
13
|
+
/** Called with the chosen option's `value`. */
|
|
14
|
+
onValueChange: (value: string) => void;
|
|
15
|
+
/** The field's name in a submitted form. */
|
|
16
|
+
name?: string | undefined;
|
|
17
|
+
placeholder?: string | undefined;
|
|
18
|
+
hint?: string | undefined;
|
|
19
|
+
/** The validation message, in the user's language: shown in red under the field, which it marks invalid. */
|
|
20
|
+
errorMessage?: string | undefined;
|
|
21
|
+
/** Marks the field invalid without a message to show. */
|
|
22
|
+
invalid?: boolean | undefined;
|
|
23
|
+
required?: boolean | undefined;
|
|
24
|
+
disabled?: boolean | undefined;
|
|
25
|
+
/** "small" is the compact density. */
|
|
26
|
+
size?: FieldSize | undefined;
|
|
27
|
+
/** Label above the control (default) or in a column beside it. */
|
|
28
|
+
orientation?: FieldOrientation | undefined;
|
|
29
|
+
/** Keep the label for assistive technology only, e.g. a select in a table row. */
|
|
30
|
+
hideLabel?: boolean | undefined;
|
|
31
|
+
/** A decorative icon at the start of the box. */
|
|
32
|
+
contentBefore?: ReactNode | undefined;
|
|
33
|
+
/** The select was left. */
|
|
34
|
+
onBlur?: (() => void) | undefined;
|
|
35
|
+
/** The select's hidden input, e.g. for a form library to focus the first invalid field. */
|
|
36
|
+
inputRef?: Ref<HTMLInputElement> | undefined;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A labelled select with the design system's hint and error. It is controlled: it shows the option whose
|
|
40
|
+
* `value` is `value` and reports a choice through `onValueChange`. Bound to react-hook-form, it is
|
|
41
|
+
* FormSelectField.
|
|
42
|
+
*/
|
|
43
|
+
export declare const SelectField: ({ label, options, value, onValueChange, name, placeholder, hint, errorMessage, invalid, required, orientation, contentBefore, onBlur, inputRef, disabled, size, hideLabel, }: SelectFieldProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { Select } from "@base-ui/react/select";
|
|
5
|
+
import { Check, ChevronDown } from "lucide-react";
|
|
6
|
+
import { cn } from "../../utils/cn.js";
|
|
7
|
+
import { indicator, item, popup, positioner } from "../../utils/popup.js";
|
|
8
|
+
import { FieldFrame } from "./FieldFrame.js";
|
|
9
|
+
import { fieldControl } from "./field-styles.js";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
// src/patterns/FormField/SelectField.tsx
|
|
12
|
+
/**
|
|
13
|
+
* A labelled select with the design system's hint and error. It is controlled: it shows the option whose
|
|
14
|
+
* `value` is `value` and reports a choice through `onValueChange`. Bound to react-hook-form, it is
|
|
15
|
+
* FormSelectField.
|
|
16
|
+
*/
|
|
17
|
+
var SelectField = (t0) => {
|
|
18
|
+
const $ = c(54);
|
|
19
|
+
const { label, options, value, onValueChange, name, placeholder, hint, errorMessage, invalid: t1, required, orientation, contentBefore, onBlur, inputRef, disabled: t2, size: t3, hideLabel: t4 } = t0;
|
|
20
|
+
const invalid = t1 === void 0 ? false : t1;
|
|
21
|
+
const disabled = t2 === void 0 ? false : t2;
|
|
22
|
+
const size = t3 === void 0 ? "medium" : t3;
|
|
23
|
+
const hideLabel = t4 === void 0 ? false : t4;
|
|
24
|
+
const labelId = useId();
|
|
25
|
+
const isInvalid = invalid || errorMessage !== void 0;
|
|
26
|
+
let t5;
|
|
27
|
+
if ($[0] !== name) {
|
|
28
|
+
t5 = name ? { name } : {};
|
|
29
|
+
$[0] = name;
|
|
30
|
+
$[1] = t5;
|
|
31
|
+
} else t5 = $[1];
|
|
32
|
+
let t6;
|
|
33
|
+
if ($[2] !== hint) {
|
|
34
|
+
t6 = hint ? { hint } : {};
|
|
35
|
+
$[2] = hint;
|
|
36
|
+
$[3] = t6;
|
|
37
|
+
} else t6 = $[3];
|
|
38
|
+
let t7;
|
|
39
|
+
if ($[4] !== required) {
|
|
40
|
+
t7 = required ? { required } : {};
|
|
41
|
+
$[4] = required;
|
|
42
|
+
$[5] = t7;
|
|
43
|
+
} else t7 = $[5];
|
|
44
|
+
let t8;
|
|
45
|
+
if ($[6] !== orientation) {
|
|
46
|
+
t8 = orientation ? { orientation } : {};
|
|
47
|
+
$[6] = orientation;
|
|
48
|
+
$[7] = t8;
|
|
49
|
+
} else t8 = $[7];
|
|
50
|
+
let t9;
|
|
51
|
+
if ($[8] !== errorMessage) {
|
|
52
|
+
t9 = errorMessage === void 0 ? {} : { errorMessage };
|
|
53
|
+
$[8] = errorMessage;
|
|
54
|
+
$[9] = t9;
|
|
55
|
+
} else t9 = $[9];
|
|
56
|
+
const t10 = value === "" ? null : value;
|
|
57
|
+
let t11;
|
|
58
|
+
if ($[10] !== onValueChange) {
|
|
59
|
+
t11 = (next) => {
|
|
60
|
+
onValueChange(next ?? "");
|
|
61
|
+
};
|
|
62
|
+
$[10] = onValueChange;
|
|
63
|
+
$[11] = t11;
|
|
64
|
+
} else t11 = $[11];
|
|
65
|
+
let t12;
|
|
66
|
+
if ($[12] !== name) {
|
|
67
|
+
t12 = name ? { name } : {};
|
|
68
|
+
$[12] = name;
|
|
69
|
+
$[13] = t12;
|
|
70
|
+
} else t12 = $[13];
|
|
71
|
+
let t13;
|
|
72
|
+
if ($[14] !== size) {
|
|
73
|
+
t13 = cn(fieldControl({ size }), "cursor-pointer justify-between data-popup-open:border-primary-active");
|
|
74
|
+
$[14] = size;
|
|
75
|
+
$[15] = t13;
|
|
76
|
+
} else t13 = $[15];
|
|
77
|
+
const t14 = isInvalid || void 0;
|
|
78
|
+
const t15 = required || void 0;
|
|
79
|
+
let t16;
|
|
80
|
+
if ($[16] !== placeholder) {
|
|
81
|
+
t16 = /* @__PURE__ */ jsx(Select.Value, {
|
|
82
|
+
className: "min-w-0 flex-1 truncate text-start data-placeholder:text-fg-tertiary",
|
|
83
|
+
placeholder
|
|
84
|
+
});
|
|
85
|
+
$[16] = placeholder;
|
|
86
|
+
$[17] = t16;
|
|
87
|
+
} else t16 = $[17];
|
|
88
|
+
let t17;
|
|
89
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
90
|
+
t17 = /* @__PURE__ */ jsx(Select.Icon, {
|
|
91
|
+
className: "flex shrink-0 text-fg-secondary [&_svg]:size-3.5",
|
|
92
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": "true" })
|
|
93
|
+
});
|
|
94
|
+
$[18] = t17;
|
|
95
|
+
} else t17 = $[18];
|
|
96
|
+
let t18;
|
|
97
|
+
if ($[19] !== contentBefore || $[20] !== onBlur || $[21] !== t13 || $[22] !== t14 || $[23] !== t15 || $[24] !== t16) {
|
|
98
|
+
t18 = /* @__PURE__ */ jsxs(Select.Trigger, {
|
|
99
|
+
className: t13,
|
|
100
|
+
"data-invalid": t14,
|
|
101
|
+
"aria-required": t15,
|
|
102
|
+
onBlur,
|
|
103
|
+
children: [
|
|
104
|
+
contentBefore,
|
|
105
|
+
t16,
|
|
106
|
+
t17
|
|
107
|
+
]
|
|
108
|
+
});
|
|
109
|
+
$[19] = contentBefore;
|
|
110
|
+
$[20] = onBlur;
|
|
111
|
+
$[21] = t13;
|
|
112
|
+
$[22] = t14;
|
|
113
|
+
$[23] = t15;
|
|
114
|
+
$[24] = t16;
|
|
115
|
+
$[25] = t18;
|
|
116
|
+
} else t18 = $[25];
|
|
117
|
+
let t19;
|
|
118
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
119
|
+
t19 = cn(popup, "min-w-(--anchor-width)");
|
|
120
|
+
$[26] = t19;
|
|
121
|
+
} else t19 = $[26];
|
|
122
|
+
let t20;
|
|
123
|
+
if ($[27] !== options) {
|
|
124
|
+
t20 = options.map(_temp);
|
|
125
|
+
$[27] = options;
|
|
126
|
+
$[28] = t20;
|
|
127
|
+
} else t20 = $[28];
|
|
128
|
+
let t21;
|
|
129
|
+
if ($[29] !== labelId || $[30] !== t20) {
|
|
130
|
+
t21 = /* @__PURE__ */ jsx(Select.Portal, { children: /* @__PURE__ */ jsx(Select.Positioner, {
|
|
131
|
+
className: positioner,
|
|
132
|
+
sideOffset: 4,
|
|
133
|
+
alignItemWithTrigger: false,
|
|
134
|
+
children: /* @__PURE__ */ jsx(Select.Popup, {
|
|
135
|
+
className: t19,
|
|
136
|
+
children: /* @__PURE__ */ jsx(Select.List, {
|
|
137
|
+
"aria-labelledby": labelId,
|
|
138
|
+
children: t20
|
|
139
|
+
})
|
|
140
|
+
})
|
|
141
|
+
}) });
|
|
142
|
+
$[29] = labelId;
|
|
143
|
+
$[30] = t20;
|
|
144
|
+
$[31] = t21;
|
|
145
|
+
} else t21 = $[31];
|
|
146
|
+
let t22;
|
|
147
|
+
if ($[32] !== disabled || $[33] !== inputRef || $[34] !== options || $[35] !== t10 || $[36] !== t11 || $[37] !== t12 || $[38] !== t18 || $[39] !== t21) {
|
|
148
|
+
t22 = /* @__PURE__ */ jsxs(Select.Root, {
|
|
149
|
+
items: options,
|
|
150
|
+
value: t10,
|
|
151
|
+
onValueChange: t11,
|
|
152
|
+
...t12,
|
|
153
|
+
inputRef,
|
|
154
|
+
disabled,
|
|
155
|
+
children: [t18, t21]
|
|
156
|
+
});
|
|
157
|
+
$[32] = disabled;
|
|
158
|
+
$[33] = inputRef;
|
|
159
|
+
$[34] = options;
|
|
160
|
+
$[35] = t10;
|
|
161
|
+
$[36] = t11;
|
|
162
|
+
$[37] = t12;
|
|
163
|
+
$[38] = t18;
|
|
164
|
+
$[39] = t21;
|
|
165
|
+
$[40] = t22;
|
|
166
|
+
} else t22 = $[40];
|
|
167
|
+
let t23;
|
|
168
|
+
if ($[41] !== disabled || $[42] !== hideLabel || $[43] !== isInvalid || $[44] !== label || $[45] !== labelId || $[46] !== size || $[47] !== t22 || $[48] !== t5 || $[49] !== t6 || $[50] !== t7 || $[51] !== t8 || $[52] !== t9) {
|
|
169
|
+
t23 = /* @__PURE__ */ jsx(FieldFrame, {
|
|
170
|
+
label,
|
|
171
|
+
hideLabel,
|
|
172
|
+
disabled,
|
|
173
|
+
invalid: isInvalid,
|
|
174
|
+
size,
|
|
175
|
+
triggerLabel: true,
|
|
176
|
+
labelId,
|
|
177
|
+
...t5,
|
|
178
|
+
...t6,
|
|
179
|
+
...t7,
|
|
180
|
+
...t8,
|
|
181
|
+
...t9,
|
|
182
|
+
children: t22
|
|
183
|
+
});
|
|
184
|
+
$[41] = disabled;
|
|
185
|
+
$[42] = hideLabel;
|
|
186
|
+
$[43] = isInvalid;
|
|
187
|
+
$[44] = label;
|
|
188
|
+
$[45] = labelId;
|
|
189
|
+
$[46] = size;
|
|
190
|
+
$[47] = t22;
|
|
191
|
+
$[48] = t5;
|
|
192
|
+
$[49] = t6;
|
|
193
|
+
$[50] = t7;
|
|
194
|
+
$[51] = t8;
|
|
195
|
+
$[52] = t9;
|
|
196
|
+
$[53] = t23;
|
|
197
|
+
} else t23 = $[53];
|
|
198
|
+
return t23;
|
|
199
|
+
};
|
|
200
|
+
function _temp(option) {
|
|
201
|
+
return /* @__PURE__ */ jsxs(Select.Item, {
|
|
202
|
+
value: option.value,
|
|
203
|
+
disabled: option.disabled,
|
|
204
|
+
className: item,
|
|
205
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
206
|
+
className: indicator,
|
|
207
|
+
children: /* @__PURE__ */ jsx(Select.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { "aria-hidden": "true" }) })
|
|
208
|
+
}), /* @__PURE__ */ jsx(Select.ItemText, { children: option.label })]
|
|
209
|
+
}, option.value);
|
|
210
|
+
}
|
|
211
|
+
export { SelectField };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Ref } from "react";
|
|
2
|
+
export interface SwitchFieldProps {
|
|
3
|
+
label: string;
|
|
4
|
+
checked: boolean;
|
|
5
|
+
/** Called with the new state when the person flips the switch. */
|
|
6
|
+
onCheckedChange: (checked: boolean) => void;
|
|
7
|
+
/** The field's name in a submitted form. */
|
|
8
|
+
name?: string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Show the switch alone, with the label kept for assistive technology. For a
|
|
11
|
+
* layout that draws the label itself, e.g. in a label column.
|
|
12
|
+
*/
|
|
13
|
+
hideLabel?: boolean | undefined;
|
|
14
|
+
disabled?: boolean | undefined;
|
|
15
|
+
/** Marks the switch invalid for assistive technology. */
|
|
16
|
+
invalid?: boolean | undefined;
|
|
17
|
+
/** The switch was left. */
|
|
18
|
+
onBlur?: (() => void) | undefined;
|
|
19
|
+
/** The switch's hidden input, e.g. for a form library to focus the first invalid field. */
|
|
20
|
+
inputRef?: Ref<HTMLInputElement> | undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A switch with its label: a settings row, the label at the start and the switch at the far end. It is
|
|
24
|
+
* controlled: it shows `checked` and reports a change through `onCheckedChange`. Bound to react-hook-form, it is
|
|
25
|
+
* FormSwitchField.
|
|
26
|
+
*/
|
|
27
|
+
export declare const SwitchField: ({ label, checked, onCheckedChange, name, onBlur, inputRef, invalid, hideLabel, disabled, }: SwitchFieldProps) => import("react").JSX.Element;
|