@primecoderin/fast-ui-react 0.0.0-stage → 0.1.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 +90 -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 +41 -0
- package/docs/testing.md +242 -0
- package/docs/theming.md +118 -0
- package/docs/typescript.md +62 -0
- package/llms-full.txt +4574 -0
- package/llms.txt +52 -0
- package/package.json +166 -6
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { Controller } from "react-hook-form";
|
|
5
|
+
import { toErrorText } from "../FormField/error-message.js";
|
|
6
|
+
import { FieldFrame } from "../FormField/FieldFrame.js";
|
|
7
|
+
import { TreeSelect } from "./TreeSelect.js";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
// src/patterns/TreeSelect/FormTreeSelectField.tsx
|
|
10
|
+
/** A TreeSelect in a field, bound to a react-hook-form field holding the chosen option's id (or null). */
|
|
11
|
+
var FormTreeSelectField = (t0) => {
|
|
12
|
+
const $ = c(20);
|
|
13
|
+
const { control, name, label, options, noMatchesLabel, resultsLabel, placeholder, required, disabled: t1, size: t2, orientation, contentBefore, rules, formatError } = t0;
|
|
14
|
+
const disabled = t1 === void 0 ? false : t1;
|
|
15
|
+
const size = t2 === void 0 ? "medium" : t2;
|
|
16
|
+
const labelId = useId();
|
|
17
|
+
let t3;
|
|
18
|
+
if ($[0] !== rules) {
|
|
19
|
+
t3 = rules ? { rules } : {};
|
|
20
|
+
$[0] = rules;
|
|
21
|
+
$[1] = t3;
|
|
22
|
+
} else t3 = $[1];
|
|
23
|
+
let t4;
|
|
24
|
+
if ($[2] !== contentBefore || $[3] !== disabled || $[4] !== formatError || $[5] !== label || $[6] !== labelId || $[7] !== noMatchesLabel || $[8] !== options || $[9] !== orientation || $[10] !== placeholder || $[11] !== required || $[12] !== resultsLabel || $[13] !== size) {
|
|
25
|
+
t4 = (t5) => {
|
|
26
|
+
const { field, fieldState } = t5;
|
|
27
|
+
const errorMessage = toErrorText(fieldState.error?.message, formatError);
|
|
28
|
+
return /* @__PURE__ */ jsx(FieldFrame, {
|
|
29
|
+
name: field.name,
|
|
30
|
+
label,
|
|
31
|
+
labelId,
|
|
32
|
+
disabled,
|
|
33
|
+
invalid: fieldState.invalid,
|
|
34
|
+
touched: fieldState.isTouched,
|
|
35
|
+
dirty: fieldState.isDirty,
|
|
36
|
+
size,
|
|
37
|
+
...required ? { required } : {},
|
|
38
|
+
...orientation ? { orientation } : {},
|
|
39
|
+
...errorMessage === void 0 ? {} : { errorMessage },
|
|
40
|
+
children: /* @__PURE__ */ jsx(TreeSelect, {
|
|
41
|
+
ref: field.ref,
|
|
42
|
+
"aria-labelledby": labelId,
|
|
43
|
+
options,
|
|
44
|
+
value: typeof field.value === "string" && field.value !== "" ? field.value : null,
|
|
45
|
+
onValueChange: field.onChange,
|
|
46
|
+
onBlur: field.onBlur,
|
|
47
|
+
invalid: fieldState.invalid,
|
|
48
|
+
required: required ?? false,
|
|
49
|
+
disabled,
|
|
50
|
+
noMatchesLabel,
|
|
51
|
+
resultsLabel,
|
|
52
|
+
size,
|
|
53
|
+
...contentBefore ? { contentBefore } : {},
|
|
54
|
+
...placeholder ? { placeholder } : {}
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
$[2] = contentBefore;
|
|
59
|
+
$[3] = disabled;
|
|
60
|
+
$[4] = formatError;
|
|
61
|
+
$[5] = label;
|
|
62
|
+
$[6] = labelId;
|
|
63
|
+
$[7] = noMatchesLabel;
|
|
64
|
+
$[8] = options;
|
|
65
|
+
$[9] = orientation;
|
|
66
|
+
$[10] = placeholder;
|
|
67
|
+
$[11] = required;
|
|
68
|
+
$[12] = resultsLabel;
|
|
69
|
+
$[13] = size;
|
|
70
|
+
$[14] = t4;
|
|
71
|
+
} else t4 = $[14];
|
|
72
|
+
let t5;
|
|
73
|
+
if ($[15] !== control || $[16] !== name || $[17] !== t3 || $[18] !== t4) {
|
|
74
|
+
t5 = /* @__PURE__ */ jsx(Controller, {
|
|
75
|
+
control,
|
|
76
|
+
name,
|
|
77
|
+
...t3,
|
|
78
|
+
render: t4
|
|
79
|
+
});
|
|
80
|
+
$[15] = control;
|
|
81
|
+
$[16] = name;
|
|
82
|
+
$[17] = t3;
|
|
83
|
+
$[18] = t4;
|
|
84
|
+
$[19] = t5;
|
|
85
|
+
} else t5 = $[19];
|
|
86
|
+
return t5;
|
|
87
|
+
};
|
|
88
|
+
export { FormTreeSelectField };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { FieldSize } from "../FormField/field-types.js";
|
|
3
|
+
export interface TreeSelectOption {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
/** Falsy for a root. A parent that is not in `options` makes its children roots too. */
|
|
7
|
+
parentId?: string | null | undefined;
|
|
8
|
+
}
|
|
9
|
+
export interface TreeSelectProps {
|
|
10
|
+
options: readonly TreeSelectOption[];
|
|
11
|
+
value: string | null;
|
|
12
|
+
onValueChange: (id: string) => void;
|
|
13
|
+
onBlur?: (() => void) | undefined;
|
|
14
|
+
placeholder?: string | undefined;
|
|
15
|
+
disabled?: boolean | undefined;
|
|
16
|
+
/** Draws the box red and marks the input invalid for assistive technology. */
|
|
17
|
+
invalid?: boolean | undefined;
|
|
18
|
+
/** Marks the input required for assistive technology; the label shows the asterisk. */
|
|
19
|
+
required?: boolean | undefined;
|
|
20
|
+
/** Shown when the typed text matches nothing. */
|
|
21
|
+
noMatchesLabel: string;
|
|
22
|
+
/**
|
|
23
|
+
* The number of options listed for the typed text, parents kept for a matching child included, as a screen reader
|
|
24
|
+
* announces it (politely, as it changes): `(count) => `${count} results``. Nothing is announced if omitted.
|
|
25
|
+
*/
|
|
26
|
+
resultsLabel?: ((count: number) => string) | undefined;
|
|
27
|
+
/** "small" is the compact density. */
|
|
28
|
+
size?: FieldSize | undefined;
|
|
29
|
+
/** A decorative icon at the start of the box. */
|
|
30
|
+
contentBefore?: ReactNode | undefined;
|
|
31
|
+
/** For a `<label htmlFor>` that names the input. */
|
|
32
|
+
id?: string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* The accessible name of the input and of its list of options, for a combobox with no label element of its
|
|
35
|
+
* own. Give this or `aria-labelledby`: a `<label htmlFor>` alone names the input but not the list.
|
|
36
|
+
*/
|
|
37
|
+
"aria-label"?: string | undefined;
|
|
38
|
+
/** The id of the element that names the input and its list of options, such as a field's label. */
|
|
39
|
+
"aria-labelledby"?: string | undefined;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A searchable single-select for two-level lists such as an organization and
|
|
43
|
+
* its departments. Children are listed indented beneath their parent, and each
|
|
44
|
+
* child's option is described by its parent's name, so a screen reader that
|
|
45
|
+
* reads the options one by one says which parent a child is under. Typing
|
|
46
|
+
* keeps a parent that matches itself or through any child, and shows all of a
|
|
47
|
+
* matching parent's children, or only the matching children otherwise.
|
|
48
|
+
*/
|
|
49
|
+
export declare const TreeSelect: import("react").ForwardRefExoticComponent<TreeSelectProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { forwardRef, useId, useState } from "react";
|
|
4
|
+
import { Combobox } from "@base-ui/react/combobox";
|
|
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 { fieldControl, fieldInput } from "../FormField/field-styles.js";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
// src/patterns/TreeSelect/TreeSelect.tsx
|
|
11
|
+
/**
|
|
12
|
+
* A searchable single-select for two-level lists such as an organization and
|
|
13
|
+
* its departments. Children are listed indented beneath their parent, and each
|
|
14
|
+
* child's option is described by its parent's name, so a screen reader that
|
|
15
|
+
* reads the options one by one says which parent a child is under. Typing
|
|
16
|
+
* keeps a parent that matches itself or through any child, and shows all of a
|
|
17
|
+
* matching parent's children, or only the matching children otherwise.
|
|
18
|
+
*/
|
|
19
|
+
var TreeSelect = forwardRef((t0, ref) => {
|
|
20
|
+
const $ = c(82);
|
|
21
|
+
const { options, value, onValueChange: onChange, onBlur, placeholder, disabled: t1, invalid: t2, required: t3, noMatchesLabel, resultsLabel, size: t4, contentBefore, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy } = t0;
|
|
22
|
+
const disabled = t1 === void 0 ? false : t1;
|
|
23
|
+
const invalid = t2 === void 0 ? false : t2;
|
|
24
|
+
const required = t3 === void 0 ? false : t3;
|
|
25
|
+
const size = t4 === void 0 ? "medium" : t4;
|
|
26
|
+
const [typed, setTyped] = useState(null);
|
|
27
|
+
const baseId = useId();
|
|
28
|
+
let t5;
|
|
29
|
+
if ($[0] !== options) {
|
|
30
|
+
t5 = new Map(options.map(_temp));
|
|
31
|
+
$[0] = options;
|
|
32
|
+
$[1] = t5;
|
|
33
|
+
} else t5 = $[1];
|
|
34
|
+
const positions = t5;
|
|
35
|
+
let t6;
|
|
36
|
+
if ($[2] !== baseId || $[3] !== positions) {
|
|
37
|
+
t6 = (optionId) => `${baseId}-${String(positions.get(optionId) ?? -1)}`;
|
|
38
|
+
$[2] = baseId;
|
|
39
|
+
$[3] = positions;
|
|
40
|
+
$[4] = t6;
|
|
41
|
+
} else t6 = $[4];
|
|
42
|
+
const labelIdOf = t6;
|
|
43
|
+
let t7;
|
|
44
|
+
if ($[5] !== options) {
|
|
45
|
+
t7 = new Set(options.map(_temp2));
|
|
46
|
+
$[5] = options;
|
|
47
|
+
$[6] = t7;
|
|
48
|
+
} else t7 = $[6];
|
|
49
|
+
const ids = t7;
|
|
50
|
+
let t8;
|
|
51
|
+
if ($[7] !== ids) {
|
|
52
|
+
t8 = (option_1) => !option_1.parentId || !ids.has(option_1.parentId);
|
|
53
|
+
$[7] = ids;
|
|
54
|
+
$[8] = t8;
|
|
55
|
+
} else t8 = $[8];
|
|
56
|
+
const hasNoParent = t8;
|
|
57
|
+
let t9;
|
|
58
|
+
if ($[9] !== hasNoParent || $[10] !== options) {
|
|
59
|
+
t9 = new Set(options.filter(hasNoParent).map(_temp3));
|
|
60
|
+
$[9] = hasNoParent;
|
|
61
|
+
$[10] = options;
|
|
62
|
+
$[11] = t9;
|
|
63
|
+
} else t9 = $[11];
|
|
64
|
+
const topIds = t9;
|
|
65
|
+
let t10;
|
|
66
|
+
if ($[12] !== hasNoParent || $[13] !== options || $[14] !== topIds || $[15] !== typed) {
|
|
67
|
+
const childrenByParent = /* @__PURE__ */ new Map();
|
|
68
|
+
const roots = [];
|
|
69
|
+
for (const option_3 of options) if (option_3.parentId && !hasNoParent(option_3) && topIds.has(option_3.parentId) && option_3.parentId !== option_3.id) {
|
|
70
|
+
const siblings = childrenByParent.get(option_3.parentId);
|
|
71
|
+
if (siblings) siblings.push(option_3);
|
|
72
|
+
else childrenByParent.set(option_3.parentId, [option_3]);
|
|
73
|
+
} else roots.push(option_3);
|
|
74
|
+
const query = (typed ?? "").trim().toLowerCase();
|
|
75
|
+
const matches = (option_4) => option_4.label.toLowerCase().includes(query);
|
|
76
|
+
t10 = roots.flatMap((root) => {
|
|
77
|
+
const children = childrenByParent.get(root.id) ?? [];
|
|
78
|
+
if (!query) return [{
|
|
79
|
+
option: root,
|
|
80
|
+
isChild: false
|
|
81
|
+
}, ...children.map(_temp4)];
|
|
82
|
+
const rootMatches = matches(root);
|
|
83
|
+
const shownChildren = rootMatches ? children : children.filter(matches);
|
|
84
|
+
if (!rootMatches && shownChildren.length === 0) return [];
|
|
85
|
+
return [{
|
|
86
|
+
option: root,
|
|
87
|
+
isChild: false
|
|
88
|
+
}, ...shownChildren.map(_temp5)];
|
|
89
|
+
});
|
|
90
|
+
$[12] = hasNoParent;
|
|
91
|
+
$[13] = options;
|
|
92
|
+
$[14] = topIds;
|
|
93
|
+
$[15] = typed;
|
|
94
|
+
$[16] = t10;
|
|
95
|
+
} else t10 = $[16];
|
|
96
|
+
const visible = t10;
|
|
97
|
+
let t11;
|
|
98
|
+
if ($[17] !== visible) {
|
|
99
|
+
t11 = visible.map(_temp6);
|
|
100
|
+
$[17] = visible;
|
|
101
|
+
$[18] = t11;
|
|
102
|
+
} else t11 = $[18];
|
|
103
|
+
const visibleOptions = t11;
|
|
104
|
+
let t12;
|
|
105
|
+
if ($[19] !== visible) {
|
|
106
|
+
t12 = new Set(visible.filter(_temp7).map(_temp8));
|
|
107
|
+
$[19] = visible;
|
|
108
|
+
$[20] = t12;
|
|
109
|
+
} else t12 = $[20];
|
|
110
|
+
const childIds = t12;
|
|
111
|
+
let t13;
|
|
112
|
+
if ($[21] !== options || $[22] !== value) {
|
|
113
|
+
t13 = options.find((option_7) => option_7.id === value) ?? null;
|
|
114
|
+
$[21] = options;
|
|
115
|
+
$[22] = value;
|
|
116
|
+
$[23] = t13;
|
|
117
|
+
} else t13 = $[23];
|
|
118
|
+
const selected = t13;
|
|
119
|
+
let t14;
|
|
120
|
+
if ($[24] !== onChange) {
|
|
121
|
+
t14 = (next) => {
|
|
122
|
+
if (next) onChange(next.id);
|
|
123
|
+
};
|
|
124
|
+
$[24] = onChange;
|
|
125
|
+
$[25] = t14;
|
|
126
|
+
} else t14 = $[25];
|
|
127
|
+
const t15 = typed ?? selected?.label ?? "";
|
|
128
|
+
let t16;
|
|
129
|
+
let t17;
|
|
130
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
131
|
+
t16 = (next_0, details) => {
|
|
132
|
+
if (details.reason === "input-change") setTyped(next_0);
|
|
133
|
+
};
|
|
134
|
+
t17 = (open) => {
|
|
135
|
+
if (!open) setTyped(null);
|
|
136
|
+
};
|
|
137
|
+
$[26] = t16;
|
|
138
|
+
$[27] = t17;
|
|
139
|
+
} else {
|
|
140
|
+
t16 = $[26];
|
|
141
|
+
t17 = $[27];
|
|
142
|
+
}
|
|
143
|
+
let t18;
|
|
144
|
+
if ($[28] !== size) {
|
|
145
|
+
t18 = fieldControl({ size });
|
|
146
|
+
$[28] = size;
|
|
147
|
+
$[29] = t18;
|
|
148
|
+
} else t18 = $[29];
|
|
149
|
+
const t19 = invalid || void 0;
|
|
150
|
+
const t20 = disabled || void 0;
|
|
151
|
+
let t21;
|
|
152
|
+
if ($[30] !== ariaLabel) {
|
|
153
|
+
t21 = ariaLabel ? { "aria-label": ariaLabel } : {};
|
|
154
|
+
$[30] = ariaLabel;
|
|
155
|
+
$[31] = t21;
|
|
156
|
+
} else t21 = $[31];
|
|
157
|
+
let t22;
|
|
158
|
+
if ($[32] !== ariaLabelledBy) {
|
|
159
|
+
t22 = ariaLabelledBy ? { "aria-labelledby": ariaLabelledBy } : {};
|
|
160
|
+
$[32] = ariaLabelledBy;
|
|
161
|
+
$[33] = t22;
|
|
162
|
+
} else t22 = $[33];
|
|
163
|
+
let t23;
|
|
164
|
+
if ($[34] !== invalid) {
|
|
165
|
+
t23 = invalid ? { "aria-invalid": true } : {};
|
|
166
|
+
$[34] = invalid;
|
|
167
|
+
$[35] = t23;
|
|
168
|
+
} else t23 = $[35];
|
|
169
|
+
const t24 = required || void 0;
|
|
170
|
+
let t25;
|
|
171
|
+
if ($[36] !== id || $[37] !== onBlur || $[38] !== placeholder || $[39] !== ref || $[40] !== t21 || $[41] !== t22 || $[42] !== t23 || $[43] !== t24) {
|
|
172
|
+
t25 = /* @__PURE__ */ jsx(Combobox.Input, {
|
|
173
|
+
ref,
|
|
174
|
+
id,
|
|
175
|
+
...t21,
|
|
176
|
+
...t22,
|
|
177
|
+
...t23,
|
|
178
|
+
"aria-required": t24,
|
|
179
|
+
className: fieldInput,
|
|
180
|
+
placeholder,
|
|
181
|
+
onFocus: _temp1,
|
|
182
|
+
onBlur
|
|
183
|
+
});
|
|
184
|
+
$[36] = id;
|
|
185
|
+
$[37] = onBlur;
|
|
186
|
+
$[38] = placeholder;
|
|
187
|
+
$[39] = ref;
|
|
188
|
+
$[40] = t21;
|
|
189
|
+
$[41] = t22;
|
|
190
|
+
$[42] = t23;
|
|
191
|
+
$[43] = t24;
|
|
192
|
+
$[44] = t25;
|
|
193
|
+
} else t25 = $[44];
|
|
194
|
+
let t26;
|
|
195
|
+
if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
|
|
196
|
+
t26 = /* @__PURE__ */ jsx(Combobox.Trigger, {
|
|
197
|
+
className: "-me-1 inline-flex w-6 shrink-0 cursor-pointer items-center justify-center self-stretch border-0 bg-transparent p-0 text-fg-secondary outline-none disabled:cursor-not-allowed [&_svg]:size-3.5",
|
|
198
|
+
"aria-hidden": "true",
|
|
199
|
+
tabIndex: -1,
|
|
200
|
+
children: /* @__PURE__ */ jsx(ChevronDown, {})
|
|
201
|
+
});
|
|
202
|
+
$[45] = t26;
|
|
203
|
+
} else t26 = $[45];
|
|
204
|
+
let t27;
|
|
205
|
+
if ($[46] !== contentBefore || $[47] !== t18 || $[48] !== t19 || $[49] !== t20 || $[50] !== t25) {
|
|
206
|
+
t27 = /* @__PURE__ */ jsxs(Combobox.InputGroup, {
|
|
207
|
+
className: t18,
|
|
208
|
+
"data-invalid": t19,
|
|
209
|
+
"data-disabled": t20,
|
|
210
|
+
children: [
|
|
211
|
+
contentBefore,
|
|
212
|
+
t25,
|
|
213
|
+
t26
|
|
214
|
+
]
|
|
215
|
+
});
|
|
216
|
+
$[46] = contentBefore;
|
|
217
|
+
$[47] = t18;
|
|
218
|
+
$[48] = t19;
|
|
219
|
+
$[49] = t20;
|
|
220
|
+
$[50] = t25;
|
|
221
|
+
$[51] = t27;
|
|
222
|
+
} else t27 = $[51];
|
|
223
|
+
let t28;
|
|
224
|
+
if ($[52] === Symbol.for("react.memo_cache_sentinel")) {
|
|
225
|
+
t28 = cn(popup, "min-w-(--anchor-width)");
|
|
226
|
+
$[52] = t28;
|
|
227
|
+
} else t28 = $[52];
|
|
228
|
+
let t29;
|
|
229
|
+
if ($[53] !== resultsLabel || $[54] !== visibleOptions) {
|
|
230
|
+
t29 = resultsLabel === void 0 ? null : /* @__PURE__ */ jsx(Combobox.Status, {
|
|
231
|
+
className: "sr-only",
|
|
232
|
+
children: resultsLabel(visibleOptions.length)
|
|
233
|
+
});
|
|
234
|
+
$[53] = resultsLabel;
|
|
235
|
+
$[54] = visibleOptions;
|
|
236
|
+
$[55] = t29;
|
|
237
|
+
} else t29 = $[55];
|
|
238
|
+
let t30;
|
|
239
|
+
if ($[56] !== noMatchesLabel) {
|
|
240
|
+
t30 = /* @__PURE__ */ jsx(Combobox.Empty, {
|
|
241
|
+
className: "px-2 py-1.5 text-body-sm text-fg-secondary empty:hidden",
|
|
242
|
+
children: noMatchesLabel
|
|
243
|
+
});
|
|
244
|
+
$[56] = noMatchesLabel;
|
|
245
|
+
$[57] = t30;
|
|
246
|
+
} else t30 = $[57];
|
|
247
|
+
let t31;
|
|
248
|
+
if ($[58] !== ariaLabelledBy) {
|
|
249
|
+
t31 = ariaLabelledBy ? { "aria-labelledby": ariaLabelledBy } : {};
|
|
250
|
+
$[58] = ariaLabelledBy;
|
|
251
|
+
$[59] = t31;
|
|
252
|
+
} else t31 = $[59];
|
|
253
|
+
let t32;
|
|
254
|
+
if ($[60] !== ariaLabel || $[61] !== ariaLabelledBy) {
|
|
255
|
+
t32 = ariaLabel && !ariaLabelledBy ? { "aria-label": ariaLabel } : {};
|
|
256
|
+
$[60] = ariaLabel;
|
|
257
|
+
$[61] = ariaLabelledBy;
|
|
258
|
+
$[62] = t32;
|
|
259
|
+
} else t32 = $[62];
|
|
260
|
+
let t33;
|
|
261
|
+
if ($[63] !== childIds || $[64] !== labelIdOf) {
|
|
262
|
+
t33 = (option_9) => /* @__PURE__ */ jsxs(Combobox.Item, {
|
|
263
|
+
value: option_9,
|
|
264
|
+
className: cn(item, childIds.has(option_9.id) && "ps-6"),
|
|
265
|
+
...childIds.has(option_9.id) && option_9.parentId ? { "aria-describedby": labelIdOf(option_9.parentId) } : {},
|
|
266
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
267
|
+
className: indicator,
|
|
268
|
+
children: /* @__PURE__ */ jsx(Combobox.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { "aria-hidden": "true" }) })
|
|
269
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
270
|
+
id: labelIdOf(option_9.id),
|
|
271
|
+
children: option_9.label
|
|
272
|
+
})]
|
|
273
|
+
}, option_9.id);
|
|
274
|
+
$[63] = childIds;
|
|
275
|
+
$[64] = labelIdOf;
|
|
276
|
+
$[65] = t33;
|
|
277
|
+
} else t33 = $[65];
|
|
278
|
+
let t34;
|
|
279
|
+
if ($[66] !== t31 || $[67] !== t32 || $[68] !== t33) {
|
|
280
|
+
t34 = /* @__PURE__ */ jsx(Combobox.List, {
|
|
281
|
+
...t31,
|
|
282
|
+
...t32,
|
|
283
|
+
children: t33
|
|
284
|
+
});
|
|
285
|
+
$[66] = t31;
|
|
286
|
+
$[67] = t32;
|
|
287
|
+
$[68] = t33;
|
|
288
|
+
$[69] = t34;
|
|
289
|
+
} else t34 = $[69];
|
|
290
|
+
let t35;
|
|
291
|
+
if ($[70] !== t29 || $[71] !== t30 || $[72] !== t34) {
|
|
292
|
+
t35 = /* @__PURE__ */ jsx(Combobox.Portal, { children: /* @__PURE__ */ jsx(Combobox.Positioner, {
|
|
293
|
+
className: positioner,
|
|
294
|
+
sideOffset: 4,
|
|
295
|
+
children: /* @__PURE__ */ jsxs(Combobox.Popup, {
|
|
296
|
+
className: t28,
|
|
297
|
+
children: [
|
|
298
|
+
t29,
|
|
299
|
+
t30,
|
|
300
|
+
t34
|
|
301
|
+
]
|
|
302
|
+
})
|
|
303
|
+
}) });
|
|
304
|
+
$[70] = t29;
|
|
305
|
+
$[71] = t30;
|
|
306
|
+
$[72] = t34;
|
|
307
|
+
$[73] = t35;
|
|
308
|
+
} else t35 = $[73];
|
|
309
|
+
let t36;
|
|
310
|
+
if ($[74] !== disabled || $[75] !== selected || $[76] !== t14 || $[77] !== t15 || $[78] !== t27 || $[79] !== t35 || $[80] !== visibleOptions) {
|
|
311
|
+
t36 = /* @__PURE__ */ jsxs(Combobox.Root, {
|
|
312
|
+
items: visibleOptions,
|
|
313
|
+
filter: null,
|
|
314
|
+
value: selected,
|
|
315
|
+
onValueChange: t14,
|
|
316
|
+
inputValue: t15,
|
|
317
|
+
onInputValueChange: t16,
|
|
318
|
+
onOpenChange: t17,
|
|
319
|
+
itemToStringLabel: _temp9,
|
|
320
|
+
isItemEqualToValue: _temp0,
|
|
321
|
+
disabled,
|
|
322
|
+
children: [t27, t35]
|
|
323
|
+
});
|
|
324
|
+
$[74] = disabled;
|
|
325
|
+
$[75] = selected;
|
|
326
|
+
$[76] = t14;
|
|
327
|
+
$[77] = t15;
|
|
328
|
+
$[78] = t27;
|
|
329
|
+
$[79] = t35;
|
|
330
|
+
$[80] = visibleOptions;
|
|
331
|
+
$[81] = t36;
|
|
332
|
+
} else t36 = $[81];
|
|
333
|
+
return t36;
|
|
334
|
+
});
|
|
335
|
+
TreeSelect.displayName = "TreeSelect";
|
|
336
|
+
function _temp(option, at) {
|
|
337
|
+
return [option.id, at];
|
|
338
|
+
}
|
|
339
|
+
function _temp2(option_0) {
|
|
340
|
+
return option_0.id;
|
|
341
|
+
}
|
|
342
|
+
function _temp3(option_2) {
|
|
343
|
+
return option_2.id;
|
|
344
|
+
}
|
|
345
|
+
function _temp4(option_5) {
|
|
346
|
+
return {
|
|
347
|
+
option: option_5,
|
|
348
|
+
isChild: true
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
function _temp5(option_6) {
|
|
352
|
+
return {
|
|
353
|
+
option: option_6,
|
|
354
|
+
isChild: true
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
function _temp6(entry) {
|
|
358
|
+
return entry.option;
|
|
359
|
+
}
|
|
360
|
+
function _temp7(entry_0) {
|
|
361
|
+
return entry_0.isChild;
|
|
362
|
+
}
|
|
363
|
+
function _temp8(entry_1) {
|
|
364
|
+
return entry_1.option.id;
|
|
365
|
+
}
|
|
366
|
+
function _temp9(option_8) {
|
|
367
|
+
return option_8.label;
|
|
368
|
+
}
|
|
369
|
+
function _temp0(a, b) {
|
|
370
|
+
return a.id === b.id;
|
|
371
|
+
}
|
|
372
|
+
function _temp1(event) {
|
|
373
|
+
event.currentTarget.select();
|
|
374
|
+
}
|
|
375
|
+
export { TreeSelect };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface TreeViewItem {
|
|
3
|
+
/** Identifies the item in `selected` and `expanded`. Unique in the whole tree. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** The item's name, in the user's language. Typing its first letters goes to it. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** A glyph before the label. */
|
|
8
|
+
icon?: ReactNode | undefined;
|
|
9
|
+
/** Makes the item a branch that opens to show these. */
|
|
10
|
+
children?: readonly TreeViewItem[] | undefined;
|
|
11
|
+
/** The item can be reached with the keys but not chosen; a disabled branch does not open or close. */
|
|
12
|
+
disabled?: boolean | undefined;
|
|
13
|
+
}
|
|
14
|
+
export interface TreeViewProps {
|
|
15
|
+
/** The items at the top level, each with its own `children`. */
|
|
16
|
+
items: readonly TreeViewItem[];
|
|
17
|
+
/** The `id` of the chosen item, or null for none. */
|
|
18
|
+
selected?: string | null | undefined;
|
|
19
|
+
/** Called with the `id` of the item the person chooses. */
|
|
20
|
+
onSelectedChange?: ((id: string) => void) | undefined;
|
|
21
|
+
/** The `id`s of the open branches. Leave it out to let the tree keep its own. */
|
|
22
|
+
expanded?: readonly string[] | undefined;
|
|
23
|
+
/** The `id`s of the branches that start open, when the tree keeps its own. */
|
|
24
|
+
defaultExpanded?: readonly string[] | undefined;
|
|
25
|
+
/** Called with the `id`s of the open branches. */
|
|
26
|
+
onExpandedChange?: ((expanded: string[]) => void) | undefined;
|
|
27
|
+
/** Accessible name of the tree, e.g. "Files". */
|
|
28
|
+
"aria-label": string;
|
|
29
|
+
/** Extra classes for the tree. Merged last. */
|
|
30
|
+
className?: string | undefined;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A tree of items that open and close: folders and files, a hierarchy of categories. A tree is one stop in the Tab
|
|
34
|
+
* order; the arrow keys do the rest: Up and Down move through what is showing, the key toward the end edge opens a
|
|
35
|
+
* branch (and, on an open one, goes to its first child), the key toward the start edge closes it (and, on a
|
|
36
|
+
* closed one, goes to its parent), Home and End go to the first and last, Enter or Space chooses, and typing the
|
|
37
|
+
* start of a label goes to the next item that has it. A click chooses an item and opens or closes a branch; a
|
|
38
|
+
* disabled item can be reached but not chosen, opened or closed. For picking one value from a list, see TreeSelect.
|
|
39
|
+
*/
|
|
40
|
+
export declare const TreeView: ({ items, selected, onSelectedChange, expanded, defaultExpanded, onExpandedChange, "aria-label": ariaLabel, className, }: TreeViewProps) => import("react").JSX.Element;
|