@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,117 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { Controller } from "react-hook-form";
|
|
4
|
+
import { toErrorText } from "../FormField/error-message.js";
|
|
5
|
+
import { FieldFrame } from "../FormField/FieldFrame.js";
|
|
6
|
+
import { useFieldIds } from "../FormField/use-field-ids.js";
|
|
7
|
+
import { TransferList } from "./TransferList.js";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
// src/patterns/TransferList/FormTransferListField.tsx
|
|
10
|
+
/** A TransferList in a field, bound to a react-hook-form field holding an array of the `id`s of the chosen items. */
|
|
11
|
+
var FormTransferListField = (t0) => {
|
|
12
|
+
const $ = c(29);
|
|
13
|
+
let control;
|
|
14
|
+
let formatError;
|
|
15
|
+
let hint;
|
|
16
|
+
let label;
|
|
17
|
+
let name;
|
|
18
|
+
let orientation;
|
|
19
|
+
let required;
|
|
20
|
+
let rules;
|
|
21
|
+
let t1;
|
|
22
|
+
let transferProps;
|
|
23
|
+
if ($[0] !== t0) {
|
|
24
|
+
({control, name, label, hint, required, orientation, rules, formatError, disabled: t1, ...transferProps} = t0);
|
|
25
|
+
$[0] = t0;
|
|
26
|
+
$[1] = control;
|
|
27
|
+
$[2] = formatError;
|
|
28
|
+
$[3] = hint;
|
|
29
|
+
$[4] = label;
|
|
30
|
+
$[5] = name;
|
|
31
|
+
$[6] = orientation;
|
|
32
|
+
$[7] = required;
|
|
33
|
+
$[8] = rules;
|
|
34
|
+
$[9] = t1;
|
|
35
|
+
$[10] = transferProps;
|
|
36
|
+
} else {
|
|
37
|
+
control = $[1];
|
|
38
|
+
formatError = $[2];
|
|
39
|
+
hint = $[3];
|
|
40
|
+
label = $[4];
|
|
41
|
+
name = $[5];
|
|
42
|
+
orientation = $[6];
|
|
43
|
+
required = $[7];
|
|
44
|
+
rules = $[8];
|
|
45
|
+
t1 = $[9];
|
|
46
|
+
transferProps = $[10];
|
|
47
|
+
}
|
|
48
|
+
const disabled = t1 === void 0 ? false : t1;
|
|
49
|
+
const { labelId, messageIds, describe } = useFieldIds();
|
|
50
|
+
let t2;
|
|
51
|
+
if ($[11] !== rules) {
|
|
52
|
+
t2 = rules ? { rules } : {};
|
|
53
|
+
$[11] = rules;
|
|
54
|
+
$[12] = t2;
|
|
55
|
+
} else t2 = $[12];
|
|
56
|
+
let t3;
|
|
57
|
+
if ($[13] !== describe || $[14] !== disabled || $[15] !== formatError || $[16] !== hint || $[17] !== label || $[18] !== labelId || $[19] !== messageIds || $[20] !== orientation || $[21] !== required || $[22] !== transferProps) {
|
|
58
|
+
t3 = (t4) => {
|
|
59
|
+
const { field, fieldState } = t4;
|
|
60
|
+
const errorMessage = toErrorText(fieldState.error?.message, formatError);
|
|
61
|
+
const describedBy = describe(errorMessage, hint);
|
|
62
|
+
return /* @__PURE__ */ jsx(FieldFrame, {
|
|
63
|
+
name: field.name,
|
|
64
|
+
label,
|
|
65
|
+
labelId,
|
|
66
|
+
triggerLabel: true,
|
|
67
|
+
messageIds,
|
|
68
|
+
disabled,
|
|
69
|
+
invalid: fieldState.invalid,
|
|
70
|
+
touched: fieldState.isTouched,
|
|
71
|
+
dirty: fieldState.isDirty,
|
|
72
|
+
...hint ? { hint } : {},
|
|
73
|
+
...required ? { required } : {},
|
|
74
|
+
...orientation ? { orientation } : {},
|
|
75
|
+
...errorMessage === void 0 ? {} : { errorMessage },
|
|
76
|
+
children: /* @__PURE__ */ jsx(TransferList, {
|
|
77
|
+
...transferProps,
|
|
78
|
+
"aria-labelledby": labelId,
|
|
79
|
+
...describedBy ? { "aria-describedby": describedBy } : {},
|
|
80
|
+
value: Array.isArray(field.value) ? field.value : [],
|
|
81
|
+
onValueChange: (next) => {
|
|
82
|
+
field.onChange(next);
|
|
83
|
+
field.onBlur();
|
|
84
|
+
},
|
|
85
|
+
disabled
|
|
86
|
+
})
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
$[13] = describe;
|
|
90
|
+
$[14] = disabled;
|
|
91
|
+
$[15] = formatError;
|
|
92
|
+
$[16] = hint;
|
|
93
|
+
$[17] = label;
|
|
94
|
+
$[18] = labelId;
|
|
95
|
+
$[19] = messageIds;
|
|
96
|
+
$[20] = orientation;
|
|
97
|
+
$[21] = required;
|
|
98
|
+
$[22] = transferProps;
|
|
99
|
+
$[23] = t3;
|
|
100
|
+
} else t3 = $[23];
|
|
101
|
+
let t4;
|
|
102
|
+
if ($[24] !== control || $[25] !== name || $[26] !== t2 || $[27] !== t3) {
|
|
103
|
+
t4 = /* @__PURE__ */ jsx(Controller, {
|
|
104
|
+
control,
|
|
105
|
+
name,
|
|
106
|
+
...t2,
|
|
107
|
+
render: t3
|
|
108
|
+
});
|
|
109
|
+
$[24] = control;
|
|
110
|
+
$[25] = name;
|
|
111
|
+
$[26] = t2;
|
|
112
|
+
$[27] = t3;
|
|
113
|
+
$[28] = t4;
|
|
114
|
+
} else t4 = $[28];
|
|
115
|
+
return t4;
|
|
116
|
+
};
|
|
117
|
+
export { FormTransferListField };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export interface TransferListItem {
|
|
2
|
+
/** Identifies the item: `value` holds the `id`s of the items in the second list. */
|
|
3
|
+
id: string;
|
|
4
|
+
/** The item's name, in the user's language. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** The item stays in the list it is in: it cannot be ticked or moved. */
|
|
7
|
+
disabled?: boolean | undefined;
|
|
8
|
+
}
|
|
9
|
+
/** The texts of the transfer list. The design system has no i18n, so the caller supplies them. */
|
|
10
|
+
export interface TransferListLabels {
|
|
11
|
+
/** The first list's heading, e.g. "Available". */
|
|
12
|
+
available: string;
|
|
13
|
+
/** The second list's heading, e.g. "Selected". */
|
|
14
|
+
chosen: string;
|
|
15
|
+
/** Accessible name of the button that moves the ticked items to the second list, e.g. "Add selected". */
|
|
16
|
+
moveToChosen: string;
|
|
17
|
+
/** Accessible name of the button that moves the ticked items back, e.g. "Remove selected". */
|
|
18
|
+
moveToAvailable: string;
|
|
19
|
+
/** Accessible name of the button that moves every item to the second list, e.g. "Add all". */
|
|
20
|
+
moveAllToChosen: string;
|
|
21
|
+
/** Accessible name of the button that moves every item back, e.g. "Remove all". */
|
|
22
|
+
moveAllToAvailable: string;
|
|
23
|
+
/** Written beside a list's heading: `(ticked, total) => `${ticked} of ${total} selected``. */
|
|
24
|
+
count: (ticked: number, total: number) => string;
|
|
25
|
+
}
|
|
26
|
+
export interface TransferListProps {
|
|
27
|
+
/** Every item, in either list. Each item is in the second list when its `id` is in `value`, else in the first. */
|
|
28
|
+
items: readonly TransferListItem[];
|
|
29
|
+
/** The `id`s of the items in the second list, in the order they were added. */
|
|
30
|
+
value: readonly string[];
|
|
31
|
+
/** Called with the `id`s of the items in the second list. */
|
|
32
|
+
onValueChange: (value: string[]) => void;
|
|
33
|
+
/** The headings, the buttons' names and the count. */
|
|
34
|
+
labels: TransferListLabels;
|
|
35
|
+
/** Accessible name of the whole control, e.g. "Permissions". */
|
|
36
|
+
"aria-label"?: string | undefined;
|
|
37
|
+
/** The id of the element that names the control, such as a field's label. */
|
|
38
|
+
"aria-labelledby"?: string | undefined;
|
|
39
|
+
/** The ids of the field's message and hint, read after the name. */
|
|
40
|
+
"aria-describedby"?: string | undefined;
|
|
41
|
+
/** Turns off every box and button. */
|
|
42
|
+
disabled?: boolean | undefined;
|
|
43
|
+
/** The height of each list in pixels; a longer list scrolls. Default 240. */
|
|
44
|
+
listHeight?: number | undefined;
|
|
45
|
+
/** Extra classes for the control. Merged last. */
|
|
46
|
+
className?: string | undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Two lists with the items between them moved by buttons: pick from what is available into what is chosen. Tick
|
|
50
|
+
* items in either list and press the arrow; the double arrows move every item that can move. For a few options,
|
|
51
|
+
* a MultiSelect is quicker; this is for long lists where seeing both sides matters.
|
|
52
|
+
*/
|
|
53
|
+
export declare const TransferList: ({ items, value, onValueChange, labels, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, disabled, listHeight, className, }: TransferListProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useId, useState } from "react";
|
|
4
|
+
import { ChevronRight, ChevronsRight } from "lucide-react";
|
|
5
|
+
import { cn } from "../../utils/cn.js";
|
|
6
|
+
import { Button } from "../../components/Button/Button.js";
|
|
7
|
+
import { CheckboxBox } from "../../components/Checkbox/CheckboxBox.js";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
// src/patterns/TransferList/TransferList.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Two lists with the items between them moved by buttons: pick from what is available into what is chosen. Tick
|
|
12
|
+
* items in either list and press the arrow; the double arrows move every item that can move. For a few options,
|
|
13
|
+
* a MultiSelect is quicker; this is for long lists where seeing both sides matters.
|
|
14
|
+
*/
|
|
15
|
+
var TransferList = (t0) => {
|
|
16
|
+
const $ = c(132);
|
|
17
|
+
const { items, value, onValueChange, labels, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, disabled: t1, listHeight: t2, className } = t0;
|
|
18
|
+
const disabled = t1 === void 0 ? false : t1;
|
|
19
|
+
const listHeight = t2 === void 0 ? 240 : t2;
|
|
20
|
+
let t3;
|
|
21
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
22
|
+
t3 = [];
|
|
23
|
+
$[0] = t3;
|
|
24
|
+
} else t3 = $[0];
|
|
25
|
+
const [ticked, setTicked] = useState(t3);
|
|
26
|
+
const idPrefix = useId();
|
|
27
|
+
let t4;
|
|
28
|
+
if ($[1] !== value) {
|
|
29
|
+
t4 = new Set(value);
|
|
30
|
+
$[1] = value;
|
|
31
|
+
$[2] = t4;
|
|
32
|
+
} else t4 = $[2];
|
|
33
|
+
const chosenSet = t4;
|
|
34
|
+
let T0;
|
|
35
|
+
let chosen;
|
|
36
|
+
let list_1;
|
|
37
|
+
let movable;
|
|
38
|
+
let remove;
|
|
39
|
+
let t10;
|
|
40
|
+
let t11;
|
|
41
|
+
let t12;
|
|
42
|
+
let t13;
|
|
43
|
+
let t14;
|
|
44
|
+
let t15;
|
|
45
|
+
let t16;
|
|
46
|
+
let t17;
|
|
47
|
+
let t5;
|
|
48
|
+
let t6;
|
|
49
|
+
let t7;
|
|
50
|
+
let t8;
|
|
51
|
+
let t9;
|
|
52
|
+
let tickedIn;
|
|
53
|
+
if ($[3] !== ariaDescribedBy || $[4] !== ariaLabel || $[5] !== ariaLabelledBy || $[6] !== chosenSet || $[7] !== className || $[8] !== disabled || $[9] !== idPrefix || $[10] !== items || $[11] !== labels || $[12] !== listHeight || $[13] !== onValueChange || $[14] !== ticked || $[15] !== value) {
|
|
54
|
+
let t18;
|
|
55
|
+
if ($[35] !== chosenSet) {
|
|
56
|
+
t18 = (item) => !chosenSet.has(item.id);
|
|
57
|
+
$[35] = chosenSet;
|
|
58
|
+
$[36] = t18;
|
|
59
|
+
} else t18 = $[36];
|
|
60
|
+
const available = items.filter(t18);
|
|
61
|
+
let t19;
|
|
62
|
+
if ($[37] !== items) {
|
|
63
|
+
t19 = (id) => items.filter((item_0) => item_0.id === id);
|
|
64
|
+
$[37] = items;
|
|
65
|
+
$[38] = t19;
|
|
66
|
+
} else t19 = $[38];
|
|
67
|
+
chosen = value.flatMap(t19);
|
|
68
|
+
let t20;
|
|
69
|
+
if ($[39] !== ticked) {
|
|
70
|
+
t20 = (list) => list.filter((item_1) => ticked.includes(item_1.id) && !item_1.disabled);
|
|
71
|
+
$[39] = ticked;
|
|
72
|
+
$[40] = t20;
|
|
73
|
+
} else t20 = $[40];
|
|
74
|
+
tickedIn = t20;
|
|
75
|
+
movable = _temp2;
|
|
76
|
+
let t21;
|
|
77
|
+
if ($[41] !== ticked) {
|
|
78
|
+
t21 = (id_0, on) => {
|
|
79
|
+
setTicked(on ? [...ticked, id_0] : ticked.filter((other) => other !== id_0));
|
|
80
|
+
};
|
|
81
|
+
$[41] = ticked;
|
|
82
|
+
$[42] = t21;
|
|
83
|
+
} else t21 = $[42];
|
|
84
|
+
const toggle = t21;
|
|
85
|
+
let t22;
|
|
86
|
+
if ($[43] !== onValueChange || $[44] !== ticked || $[45] !== value) {
|
|
87
|
+
t22 = (moving) => {
|
|
88
|
+
onValueChange([...value, ...moving.map(_temp3)]);
|
|
89
|
+
setTicked(ticked.filter((id_1) => !moving.some((item_4) => item_4.id === id_1)));
|
|
90
|
+
};
|
|
91
|
+
$[43] = onValueChange;
|
|
92
|
+
$[44] = ticked;
|
|
93
|
+
$[45] = value;
|
|
94
|
+
$[46] = t22;
|
|
95
|
+
} else t22 = $[46];
|
|
96
|
+
const add = t22;
|
|
97
|
+
let t23;
|
|
98
|
+
if ($[47] !== onValueChange || $[48] !== ticked || $[49] !== value) {
|
|
99
|
+
t23 = (moving_0) => {
|
|
100
|
+
onValueChange(value.filter((id_2) => !moving_0.some((item_5) => item_5.id === id_2)));
|
|
101
|
+
setTicked(ticked.filter((id_3) => !moving_0.some((item_6) => item_6.id === id_3)));
|
|
102
|
+
};
|
|
103
|
+
$[47] = onValueChange;
|
|
104
|
+
$[48] = ticked;
|
|
105
|
+
$[49] = value;
|
|
106
|
+
$[50] = t23;
|
|
107
|
+
} else t23 = $[50];
|
|
108
|
+
remove = t23;
|
|
109
|
+
let t24;
|
|
110
|
+
if ($[51] !== disabled || $[52] !== idPrefix || $[53] !== labels || $[54] !== listHeight || $[55] !== ticked || $[56] !== tickedIn || $[57] !== toggle) {
|
|
111
|
+
t24 = (side, heading, rows) => /* @__PURE__ */ jsxs("fieldset", {
|
|
112
|
+
className: "m-0 flex min-w-0 flex-1 flex-col rounded-md border border-line bg-surface p-0",
|
|
113
|
+
children: [
|
|
114
|
+
/* @__PURE__ */ jsx("legend", {
|
|
115
|
+
className: "sr-only",
|
|
116
|
+
children: heading
|
|
117
|
+
}),
|
|
118
|
+
/* @__PURE__ */ jsxs("div", {
|
|
119
|
+
"aria-hidden": "true",
|
|
120
|
+
className: "flex items-baseline justify-between gap-2 border-b border-line px-3 py-2",
|
|
121
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
122
|
+
className: "text-body-sm font-semibold text-fg",
|
|
123
|
+
children: heading
|
|
124
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
125
|
+
className: "text-caption text-fg-secondary",
|
|
126
|
+
children: labels.count(tickedIn(rows).length, rows.length)
|
|
127
|
+
})]
|
|
128
|
+
}),
|
|
129
|
+
/* @__PURE__ */ jsx("ul", {
|
|
130
|
+
className: "m-0 flex list-none flex-col overflow-y-auto p-0",
|
|
131
|
+
style: { height: listHeight },
|
|
132
|
+
children: rows.map((item_7, index) => {
|
|
133
|
+
const labelId = `${idPrefix}-${side}-${String(index)}`;
|
|
134
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("label", {
|
|
135
|
+
className: cn("flex cursor-pointer items-center gap-2.5 px-3 py-2 text-body-sm text-fg hover:bg-subtle", (item_7.disabled || disabled) && "cursor-not-allowed opacity-48"),
|
|
136
|
+
children: [/* @__PURE__ */ jsx(CheckboxBox, {
|
|
137
|
+
checked: ticked.includes(item_7.id),
|
|
138
|
+
disabled: (item_7.disabled ?? false) || disabled,
|
|
139
|
+
"aria-labelledby": labelId,
|
|
140
|
+
onCheckedChange: (on_0) => {
|
|
141
|
+
toggle(item_7.id, on_0);
|
|
142
|
+
}
|
|
143
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
144
|
+
id: labelId,
|
|
145
|
+
children: item_7.label
|
|
146
|
+
})]
|
|
147
|
+
}) }, item_7.id);
|
|
148
|
+
})
|
|
149
|
+
})
|
|
150
|
+
]
|
|
151
|
+
});
|
|
152
|
+
$[51] = disabled;
|
|
153
|
+
$[52] = idPrefix;
|
|
154
|
+
$[53] = labels;
|
|
155
|
+
$[54] = listHeight;
|
|
156
|
+
$[55] = ticked;
|
|
157
|
+
$[56] = tickedIn;
|
|
158
|
+
$[57] = toggle;
|
|
159
|
+
$[58] = t24;
|
|
160
|
+
} else t24 = $[58];
|
|
161
|
+
list_1 = t24;
|
|
162
|
+
t12 = "group";
|
|
163
|
+
if ($[59] !== ariaLabel) {
|
|
164
|
+
t13 = ariaLabel ? { "aria-label": ariaLabel } : {};
|
|
165
|
+
$[59] = ariaLabel;
|
|
166
|
+
$[60] = t13;
|
|
167
|
+
} else t13 = $[60];
|
|
168
|
+
if ($[61] !== ariaLabelledBy) {
|
|
169
|
+
t14 = ariaLabelledBy ? { "aria-labelledby": ariaLabelledBy } : {};
|
|
170
|
+
$[61] = ariaLabelledBy;
|
|
171
|
+
$[62] = t14;
|
|
172
|
+
} else t14 = $[62];
|
|
173
|
+
if ($[63] !== ariaDescribedBy) {
|
|
174
|
+
t15 = ariaDescribedBy ? { "aria-describedby": ariaDescribedBy } : {};
|
|
175
|
+
$[63] = ariaDescribedBy;
|
|
176
|
+
$[64] = t15;
|
|
177
|
+
} else t15 = $[64];
|
|
178
|
+
if ($[65] !== className) {
|
|
179
|
+
t16 = cn("flex items-stretch gap-3", className);
|
|
180
|
+
$[65] = className;
|
|
181
|
+
$[66] = t16;
|
|
182
|
+
} else t16 = $[66];
|
|
183
|
+
t17 = list_1("available", labels.available, available);
|
|
184
|
+
t9 = "flex shrink-0 flex-col justify-center gap-1.5";
|
|
185
|
+
const t25 = disabled || movable(available).length === 0;
|
|
186
|
+
let t26;
|
|
187
|
+
if ($[67] === Symbol.for("react.memo_cache_sentinel")) {
|
|
188
|
+
t26 = /* @__PURE__ */ jsx(ChevronsRight, { className: "rtl:rotate-180" });
|
|
189
|
+
$[67] = t26;
|
|
190
|
+
} else t26 = $[67];
|
|
191
|
+
let t27;
|
|
192
|
+
if ($[68] !== add || $[69] !== available) {
|
|
193
|
+
t27 = () => {
|
|
194
|
+
add(movable(available));
|
|
195
|
+
};
|
|
196
|
+
$[68] = add;
|
|
197
|
+
$[69] = available;
|
|
198
|
+
$[70] = t27;
|
|
199
|
+
} else t27 = $[70];
|
|
200
|
+
if ($[71] !== labels.moveAllToChosen || $[72] !== t25 || $[73] !== t27) {
|
|
201
|
+
t10 = /* @__PURE__ */ jsx(Button, {
|
|
202
|
+
variant: "secondary",
|
|
203
|
+
size: "small",
|
|
204
|
+
"aria-label": labels.moveAllToChosen,
|
|
205
|
+
disabled: t25,
|
|
206
|
+
icon: t26,
|
|
207
|
+
onClick: t27
|
|
208
|
+
});
|
|
209
|
+
$[71] = labels.moveAllToChosen;
|
|
210
|
+
$[72] = t25;
|
|
211
|
+
$[73] = t27;
|
|
212
|
+
$[74] = t10;
|
|
213
|
+
} else t10 = $[74];
|
|
214
|
+
let t28;
|
|
215
|
+
if ($[75] !== available || $[76] !== disabled || $[77] !== tickedIn) {
|
|
216
|
+
t28 = disabled || tickedIn(available).length === 0;
|
|
217
|
+
$[75] = available;
|
|
218
|
+
$[76] = disabled;
|
|
219
|
+
$[77] = tickedIn;
|
|
220
|
+
$[78] = t28;
|
|
221
|
+
} else t28 = $[78];
|
|
222
|
+
let t29;
|
|
223
|
+
if ($[79] === Symbol.for("react.memo_cache_sentinel")) {
|
|
224
|
+
t29 = /* @__PURE__ */ jsx(ChevronRight, { className: "rtl:rotate-180" });
|
|
225
|
+
$[79] = t29;
|
|
226
|
+
} else t29 = $[79];
|
|
227
|
+
let t30;
|
|
228
|
+
if ($[80] !== add || $[81] !== available || $[82] !== tickedIn) {
|
|
229
|
+
t30 = () => {
|
|
230
|
+
add(tickedIn(available));
|
|
231
|
+
};
|
|
232
|
+
$[80] = add;
|
|
233
|
+
$[81] = available;
|
|
234
|
+
$[82] = tickedIn;
|
|
235
|
+
$[83] = t30;
|
|
236
|
+
} else t30 = $[83];
|
|
237
|
+
if ($[84] !== labels.moveToChosen || $[85] !== t28 || $[86] !== t30) {
|
|
238
|
+
t11 = /* @__PURE__ */ jsx(Button, {
|
|
239
|
+
variant: "secondary",
|
|
240
|
+
size: "small",
|
|
241
|
+
"aria-label": labels.moveToChosen,
|
|
242
|
+
disabled: t28,
|
|
243
|
+
icon: t29,
|
|
244
|
+
onClick: t30
|
|
245
|
+
});
|
|
246
|
+
$[84] = labels.moveToChosen;
|
|
247
|
+
$[85] = t28;
|
|
248
|
+
$[86] = t30;
|
|
249
|
+
$[87] = t11;
|
|
250
|
+
} else t11 = $[87];
|
|
251
|
+
T0 = Button;
|
|
252
|
+
t5 = "secondary";
|
|
253
|
+
t6 = "small";
|
|
254
|
+
t7 = labels.moveToAvailable;
|
|
255
|
+
t8 = disabled || tickedIn(chosen).length === 0;
|
|
256
|
+
$[3] = ariaDescribedBy;
|
|
257
|
+
$[4] = ariaLabel;
|
|
258
|
+
$[5] = ariaLabelledBy;
|
|
259
|
+
$[6] = chosenSet;
|
|
260
|
+
$[7] = className;
|
|
261
|
+
$[8] = disabled;
|
|
262
|
+
$[9] = idPrefix;
|
|
263
|
+
$[10] = items;
|
|
264
|
+
$[11] = labels;
|
|
265
|
+
$[12] = listHeight;
|
|
266
|
+
$[13] = onValueChange;
|
|
267
|
+
$[14] = ticked;
|
|
268
|
+
$[15] = value;
|
|
269
|
+
$[16] = T0;
|
|
270
|
+
$[17] = chosen;
|
|
271
|
+
$[18] = list_1;
|
|
272
|
+
$[19] = movable;
|
|
273
|
+
$[20] = remove;
|
|
274
|
+
$[21] = t10;
|
|
275
|
+
$[22] = t11;
|
|
276
|
+
$[23] = t12;
|
|
277
|
+
$[24] = t13;
|
|
278
|
+
$[25] = t14;
|
|
279
|
+
$[26] = t15;
|
|
280
|
+
$[27] = t16;
|
|
281
|
+
$[28] = t17;
|
|
282
|
+
$[29] = t5;
|
|
283
|
+
$[30] = t6;
|
|
284
|
+
$[31] = t7;
|
|
285
|
+
$[32] = t8;
|
|
286
|
+
$[33] = t9;
|
|
287
|
+
$[34] = tickedIn;
|
|
288
|
+
} else {
|
|
289
|
+
T0 = $[16];
|
|
290
|
+
chosen = $[17];
|
|
291
|
+
list_1 = $[18];
|
|
292
|
+
movable = $[19];
|
|
293
|
+
remove = $[20];
|
|
294
|
+
t10 = $[21];
|
|
295
|
+
t11 = $[22];
|
|
296
|
+
t12 = $[23];
|
|
297
|
+
t13 = $[24];
|
|
298
|
+
t14 = $[25];
|
|
299
|
+
t15 = $[26];
|
|
300
|
+
t16 = $[27];
|
|
301
|
+
t17 = $[28];
|
|
302
|
+
t5 = $[29];
|
|
303
|
+
t6 = $[30];
|
|
304
|
+
t7 = $[31];
|
|
305
|
+
t8 = $[32];
|
|
306
|
+
t9 = $[33];
|
|
307
|
+
tickedIn = $[34];
|
|
308
|
+
}
|
|
309
|
+
let t18;
|
|
310
|
+
if ($[88] === Symbol.for("react.memo_cache_sentinel")) {
|
|
311
|
+
t18 = /* @__PURE__ */ jsx(ChevronRight, { className: "rotate-180 rtl:rotate-0" });
|
|
312
|
+
$[88] = t18;
|
|
313
|
+
} else t18 = $[88];
|
|
314
|
+
let t19;
|
|
315
|
+
if ($[89] !== chosen || $[90] !== remove || $[91] !== tickedIn) {
|
|
316
|
+
t19 = () => {
|
|
317
|
+
remove(tickedIn(chosen));
|
|
318
|
+
};
|
|
319
|
+
$[89] = chosen;
|
|
320
|
+
$[90] = remove;
|
|
321
|
+
$[91] = tickedIn;
|
|
322
|
+
$[92] = t19;
|
|
323
|
+
} else t19 = $[92];
|
|
324
|
+
let t20;
|
|
325
|
+
if ($[93] !== T0 || $[94] !== t19 || $[95] !== t5 || $[96] !== t6 || $[97] !== t7 || $[98] !== t8) {
|
|
326
|
+
t20 = /* @__PURE__ */ jsx(T0, {
|
|
327
|
+
variant: t5,
|
|
328
|
+
size: t6,
|
|
329
|
+
"aria-label": t7,
|
|
330
|
+
disabled: t8,
|
|
331
|
+
icon: t18,
|
|
332
|
+
onClick: t19
|
|
333
|
+
});
|
|
334
|
+
$[93] = T0;
|
|
335
|
+
$[94] = t19;
|
|
336
|
+
$[95] = t5;
|
|
337
|
+
$[96] = t6;
|
|
338
|
+
$[97] = t7;
|
|
339
|
+
$[98] = t8;
|
|
340
|
+
$[99] = t20;
|
|
341
|
+
} else t20 = $[99];
|
|
342
|
+
let t21;
|
|
343
|
+
if ($[100] !== chosen || $[101] !== disabled || $[102] !== movable) {
|
|
344
|
+
t21 = disabled || movable(chosen).length === 0;
|
|
345
|
+
$[100] = chosen;
|
|
346
|
+
$[101] = disabled;
|
|
347
|
+
$[102] = movable;
|
|
348
|
+
$[103] = t21;
|
|
349
|
+
} else t21 = $[103];
|
|
350
|
+
let t22;
|
|
351
|
+
if ($[104] === Symbol.for("react.memo_cache_sentinel")) {
|
|
352
|
+
t22 = /* @__PURE__ */ jsx(ChevronsRight, { className: "rotate-180 rtl:rotate-0" });
|
|
353
|
+
$[104] = t22;
|
|
354
|
+
} else t22 = $[104];
|
|
355
|
+
let t23;
|
|
356
|
+
if ($[105] !== chosen || $[106] !== movable || $[107] !== remove) {
|
|
357
|
+
t23 = () => {
|
|
358
|
+
remove(movable(chosen));
|
|
359
|
+
};
|
|
360
|
+
$[105] = chosen;
|
|
361
|
+
$[106] = movable;
|
|
362
|
+
$[107] = remove;
|
|
363
|
+
$[108] = t23;
|
|
364
|
+
} else t23 = $[108];
|
|
365
|
+
let t24;
|
|
366
|
+
if ($[109] !== labels.moveAllToAvailable || $[110] !== t21 || $[111] !== t23) {
|
|
367
|
+
t24 = /* @__PURE__ */ jsx(Button, {
|
|
368
|
+
variant: "secondary",
|
|
369
|
+
size: "small",
|
|
370
|
+
"aria-label": labels.moveAllToAvailable,
|
|
371
|
+
disabled: t21,
|
|
372
|
+
icon: t22,
|
|
373
|
+
onClick: t23
|
|
374
|
+
});
|
|
375
|
+
$[109] = labels.moveAllToAvailable;
|
|
376
|
+
$[110] = t21;
|
|
377
|
+
$[111] = t23;
|
|
378
|
+
$[112] = t24;
|
|
379
|
+
} else t24 = $[112];
|
|
380
|
+
let t25;
|
|
381
|
+
if ($[113] !== t10 || $[114] !== t11 || $[115] !== t20 || $[116] !== t24 || $[117] !== t9) {
|
|
382
|
+
t25 = /* @__PURE__ */ jsxs("div", {
|
|
383
|
+
className: t9,
|
|
384
|
+
children: [
|
|
385
|
+
t10,
|
|
386
|
+
t11,
|
|
387
|
+
t20,
|
|
388
|
+
t24
|
|
389
|
+
]
|
|
390
|
+
});
|
|
391
|
+
$[113] = t10;
|
|
392
|
+
$[114] = t11;
|
|
393
|
+
$[115] = t20;
|
|
394
|
+
$[116] = t24;
|
|
395
|
+
$[117] = t9;
|
|
396
|
+
$[118] = t25;
|
|
397
|
+
} else t25 = $[118];
|
|
398
|
+
let t26;
|
|
399
|
+
if ($[119] !== chosen || $[120] !== labels.chosen || $[121] !== list_1) {
|
|
400
|
+
t26 = list_1("chosen", labels.chosen, chosen);
|
|
401
|
+
$[119] = chosen;
|
|
402
|
+
$[120] = labels.chosen;
|
|
403
|
+
$[121] = list_1;
|
|
404
|
+
$[122] = t26;
|
|
405
|
+
} else t26 = $[122];
|
|
406
|
+
let t27;
|
|
407
|
+
if ($[123] !== t12 || $[124] !== t13 || $[125] !== t14 || $[126] !== t15 || $[127] !== t16 || $[128] !== t17 || $[129] !== t25 || $[130] !== t26) {
|
|
408
|
+
t27 = /* @__PURE__ */ jsxs("div", {
|
|
409
|
+
role: t12,
|
|
410
|
+
...t13,
|
|
411
|
+
...t14,
|
|
412
|
+
...t15,
|
|
413
|
+
className: t16,
|
|
414
|
+
children: [
|
|
415
|
+
t17,
|
|
416
|
+
t25,
|
|
417
|
+
t26
|
|
418
|
+
]
|
|
419
|
+
});
|
|
420
|
+
$[123] = t12;
|
|
421
|
+
$[124] = t13;
|
|
422
|
+
$[125] = t14;
|
|
423
|
+
$[126] = t15;
|
|
424
|
+
$[127] = t16;
|
|
425
|
+
$[128] = t17;
|
|
426
|
+
$[129] = t25;
|
|
427
|
+
$[130] = t26;
|
|
428
|
+
$[131] = t27;
|
|
429
|
+
} else t27 = $[131];
|
|
430
|
+
return t27;
|
|
431
|
+
};
|
|
432
|
+
function _temp(item_2) {
|
|
433
|
+
return !item_2.disabled;
|
|
434
|
+
}
|
|
435
|
+
function _temp2(list_0) {
|
|
436
|
+
return list_0.filter(_temp);
|
|
437
|
+
}
|
|
438
|
+
function _temp3(item_3) {
|
|
439
|
+
return item_3.id;
|
|
440
|
+
}
|
|
441
|
+
export { TransferList };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type Control, type ControllerProps, type FieldPath, type FieldValues } from "react-hook-form";
|
|
3
|
+
import type { FieldOrientation, FieldSize } from "../FormField/field-types.js";
|
|
4
|
+
import { type TreeSelectOption } from "./TreeSelect.js";
|
|
5
|
+
export interface FormTreeSelectFieldProps<TValues extends FieldValues> {
|
|
6
|
+
control: Control<TValues>;
|
|
7
|
+
name: FieldPath<TValues>;
|
|
8
|
+
label: string;
|
|
9
|
+
options: readonly TreeSelectOption[];
|
|
10
|
+
noMatchesLabel: string;
|
|
11
|
+
/** The number of options listed for the typed text, as a screen reader announces it. Nothing is announced if omitted. */
|
|
12
|
+
resultsLabel?: ((count: number) => string) | undefined;
|
|
13
|
+
placeholder?: string | undefined;
|
|
14
|
+
required?: boolean | undefined;
|
|
15
|
+
disabled?: boolean | undefined;
|
|
16
|
+
/** "small" is the compact density. */
|
|
17
|
+
size?: FieldSize | undefined;
|
|
18
|
+
/** Label above the control (default) or in a column beside it. */
|
|
19
|
+
orientation?: FieldOrientation | undefined;
|
|
20
|
+
/** A decorative icon at the start of the box. */
|
|
21
|
+
contentBefore?: ReactNode | undefined;
|
|
22
|
+
/** react-hook-form validation rules, for forms that do not use a schema resolver. */
|
|
23
|
+
rules?: ControllerProps<TValues, FieldPath<TValues>>["rules"] | undefined;
|
|
24
|
+
/** Turns a stored schema message (an i18n key) into display text. */
|
|
25
|
+
formatError?: ((message: string) => string) | undefined;
|
|
26
|
+
}
|
|
27
|
+
/** A TreeSelect in a field, bound to a react-hook-form field holding the chosen option's id (or null). */
|
|
28
|
+
export declare const FormTreeSelectField: <TValues extends FieldValues>({ control, name, label, options, noMatchesLabel, resultsLabel, placeholder, required, disabled, size, orientation, contentBefore, rules, formatError, }: FormTreeSelectFieldProps<TValues>) => import("react").JSX.Element;
|