@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,371 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
4
|
+
import { useDirection } from "@base-ui/react/direction-provider";
|
|
5
|
+
import { Popover } from "@base-ui/react/popover";
|
|
6
|
+
import { ChevronDown, ChevronRight } from "lucide-react";
|
|
7
|
+
import { cn } from "../../utils/cn.js";
|
|
8
|
+
import { item, popup, positioner } from "../../utils/popup.js";
|
|
9
|
+
import { fieldControl } from "../FormField/field-styles.js";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
// src/patterns/Cascader/Cascader.tsx
|
|
12
|
+
/** The options of each column of the open path: the first column, then the children of each step taken. */
|
|
13
|
+
var columnsOf = (options, path) => {
|
|
14
|
+
const columns = [options];
|
|
15
|
+
let level = options;
|
|
16
|
+
for (const step of path) {
|
|
17
|
+
const found = level.find((option) => option.value === step);
|
|
18
|
+
if (!found?.children) break;
|
|
19
|
+
columns.push(found.children);
|
|
20
|
+
level = found.children;
|
|
21
|
+
}
|
|
22
|
+
return columns;
|
|
23
|
+
};
|
|
24
|
+
/** The labels along a path, as far as it exists in the options. */
|
|
25
|
+
var labelsOf = (options, path) => {
|
|
26
|
+
const labels = [];
|
|
27
|
+
let level = options;
|
|
28
|
+
for (const step of path) {
|
|
29
|
+
const found = level?.find((option) => option.value === step);
|
|
30
|
+
if (!found) break;
|
|
31
|
+
labels.push(found.label);
|
|
32
|
+
level = found.children;
|
|
33
|
+
}
|
|
34
|
+
return labels;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Choosing through levels: a country, then a region, then a city. A button shows the chosen path and opens columns,
|
|
38
|
+
* one for each level; choosing a step opens its children beside it, and choosing a last step ends the choice. In
|
|
39
|
+
* the columns the up and down keys move, the key toward the end edge opens a step and goes in, the key toward the
|
|
40
|
+
* start edge goes back out, and Enter chooses. For a list of one level, see Combobox.
|
|
41
|
+
*/
|
|
42
|
+
var Cascader = (t0) => {
|
|
43
|
+
const $ = c(56);
|
|
44
|
+
const { options, value, onValueChange, labels, placeholder, separator: t1, disabled: t2, invalid: t3, size: t4, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, triggerRef, onBlur } = t0;
|
|
45
|
+
const separator = t1 === void 0 ? " / " : t1;
|
|
46
|
+
const disabled = t2 === void 0 ? false : t2;
|
|
47
|
+
const invalid = t3 === void 0 ? false : t3;
|
|
48
|
+
const size = t4 === void 0 ? "medium" : t4;
|
|
49
|
+
const [open, setOpen] = useState(false);
|
|
50
|
+
const valueId = useId();
|
|
51
|
+
const isOpen = open && !disabled;
|
|
52
|
+
let t5;
|
|
53
|
+
if ($[0] !== options || $[1] !== separator || $[2] !== value) {
|
|
54
|
+
t5 = labelsOf(options, value).join(separator);
|
|
55
|
+
$[0] = options;
|
|
56
|
+
$[1] = separator;
|
|
57
|
+
$[2] = value;
|
|
58
|
+
$[3] = t5;
|
|
59
|
+
} else t5 = $[3];
|
|
60
|
+
const text = t5;
|
|
61
|
+
const shown = text === "" ? placeholder ?? labels.choose : text;
|
|
62
|
+
let t6;
|
|
63
|
+
if ($[4] !== ariaLabel || $[5] !== ariaLabelledBy || $[6] !== labels.choose || $[7] !== shown || $[8] !== valueId) {
|
|
64
|
+
t6 = ariaLabelledBy ? { "aria-labelledby": `${ariaLabelledBy} ${valueId}` } : { "aria-label": `${ariaLabel ?? labels.choose}: ${shown}` };
|
|
65
|
+
$[4] = ariaLabel;
|
|
66
|
+
$[5] = ariaLabelledBy;
|
|
67
|
+
$[6] = labels.choose;
|
|
68
|
+
$[7] = shown;
|
|
69
|
+
$[8] = valueId;
|
|
70
|
+
$[9] = t6;
|
|
71
|
+
} else t6 = $[9];
|
|
72
|
+
const nameProps = t6;
|
|
73
|
+
let t7;
|
|
74
|
+
if ($[10] !== onBlur) {
|
|
75
|
+
t7 = (next) => {
|
|
76
|
+
setOpen(next);
|
|
77
|
+
if (!next) onBlur?.();
|
|
78
|
+
};
|
|
79
|
+
$[10] = onBlur;
|
|
80
|
+
$[11] = t7;
|
|
81
|
+
} else t7 = $[11];
|
|
82
|
+
let t8;
|
|
83
|
+
if ($[12] !== id) {
|
|
84
|
+
t8 = id ? { id } : {};
|
|
85
|
+
$[12] = id;
|
|
86
|
+
$[13] = t8;
|
|
87
|
+
} else t8 = $[13];
|
|
88
|
+
let t9;
|
|
89
|
+
if ($[14] !== ariaDescribedBy) {
|
|
90
|
+
t9 = ariaDescribedBy ? { "aria-describedby": ariaDescribedBy } : {};
|
|
91
|
+
$[14] = ariaDescribedBy;
|
|
92
|
+
$[15] = t9;
|
|
93
|
+
} else t9 = $[15];
|
|
94
|
+
let t10;
|
|
95
|
+
if ($[16] !== size) {
|
|
96
|
+
t10 = cn(fieldControl({ size }), "cursor-pointer justify-between data-popup-open:border-primary-active");
|
|
97
|
+
$[16] = size;
|
|
98
|
+
$[17] = t10;
|
|
99
|
+
} else t10 = $[17];
|
|
100
|
+
const t11 = invalid || void 0;
|
|
101
|
+
const t12 = disabled || void 0;
|
|
102
|
+
let t13;
|
|
103
|
+
if ($[18] !== isOpen || $[19] !== onBlur) {
|
|
104
|
+
t13 = () => {
|
|
105
|
+
if (!isOpen) onBlur?.();
|
|
106
|
+
};
|
|
107
|
+
$[18] = isOpen;
|
|
108
|
+
$[19] = onBlur;
|
|
109
|
+
$[20] = t13;
|
|
110
|
+
} else t13 = $[20];
|
|
111
|
+
const t14 = text === "" && "text-fg-tertiary";
|
|
112
|
+
let t15;
|
|
113
|
+
if ($[21] !== t14) {
|
|
114
|
+
t15 = cn("min-w-0 flex-1 truncate text-start", t14);
|
|
115
|
+
$[21] = t14;
|
|
116
|
+
$[22] = t15;
|
|
117
|
+
} else t15 = $[22];
|
|
118
|
+
let t16;
|
|
119
|
+
if ($[23] !== shown || $[24] !== t15 || $[25] !== valueId) {
|
|
120
|
+
t16 = /* @__PURE__ */ jsx("span", {
|
|
121
|
+
id: valueId,
|
|
122
|
+
className: t15,
|
|
123
|
+
children: shown
|
|
124
|
+
});
|
|
125
|
+
$[23] = shown;
|
|
126
|
+
$[24] = t15;
|
|
127
|
+
$[25] = valueId;
|
|
128
|
+
$[26] = t16;
|
|
129
|
+
} else t16 = $[26];
|
|
130
|
+
let t17;
|
|
131
|
+
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
132
|
+
t17 = /* @__PURE__ */ jsx(ChevronDown, {
|
|
133
|
+
"aria-hidden": "true",
|
|
134
|
+
className: "size-3.5 shrink-0 text-fg-secondary"
|
|
135
|
+
});
|
|
136
|
+
$[27] = t17;
|
|
137
|
+
} else t17 = $[27];
|
|
138
|
+
let t18;
|
|
139
|
+
if ($[28] !== disabled || $[29] !== nameProps || $[30] !== t10 || $[31] !== t11 || $[32] !== t12 || $[33] !== t13 || $[34] !== t16 || $[35] !== t8 || $[36] !== t9 || $[37] !== triggerRef) {
|
|
140
|
+
t18 = /* @__PURE__ */ jsxs(Popover.Trigger, {
|
|
141
|
+
ref: triggerRef,
|
|
142
|
+
...t8,
|
|
143
|
+
disabled,
|
|
144
|
+
...nameProps,
|
|
145
|
+
...t9,
|
|
146
|
+
className: t10,
|
|
147
|
+
"data-invalid": t11,
|
|
148
|
+
"data-disabled": t12,
|
|
149
|
+
onBlur: t13,
|
|
150
|
+
children: [t16, t17]
|
|
151
|
+
});
|
|
152
|
+
$[28] = disabled;
|
|
153
|
+
$[29] = nameProps;
|
|
154
|
+
$[30] = t10;
|
|
155
|
+
$[31] = t11;
|
|
156
|
+
$[32] = t12;
|
|
157
|
+
$[33] = t13;
|
|
158
|
+
$[34] = t16;
|
|
159
|
+
$[35] = t8;
|
|
160
|
+
$[36] = t9;
|
|
161
|
+
$[37] = triggerRef;
|
|
162
|
+
$[38] = t18;
|
|
163
|
+
} else t18 = $[38];
|
|
164
|
+
const t19 = labels.choose;
|
|
165
|
+
let t20;
|
|
166
|
+
if ($[39] === Symbol.for("react.memo_cache_sentinel")) {
|
|
167
|
+
t20 = cn(popup, "p-0");
|
|
168
|
+
$[39] = t20;
|
|
169
|
+
} else t20 = $[39];
|
|
170
|
+
let t21;
|
|
171
|
+
if ($[40] !== onBlur || $[41] !== onValueChange) {
|
|
172
|
+
t21 = (path) => {
|
|
173
|
+
onValueChange(path);
|
|
174
|
+
setOpen(false);
|
|
175
|
+
onBlur?.();
|
|
176
|
+
};
|
|
177
|
+
$[40] = onBlur;
|
|
178
|
+
$[41] = onValueChange;
|
|
179
|
+
$[42] = t21;
|
|
180
|
+
} else t21 = $[42];
|
|
181
|
+
let t22;
|
|
182
|
+
if ($[43] !== labels || $[44] !== options || $[45] !== t21 || $[46] !== value) {
|
|
183
|
+
t22 = /* @__PURE__ */ jsx(Columns, {
|
|
184
|
+
options,
|
|
185
|
+
value,
|
|
186
|
+
labels,
|
|
187
|
+
onChoose: t21
|
|
188
|
+
});
|
|
189
|
+
$[43] = labels;
|
|
190
|
+
$[44] = options;
|
|
191
|
+
$[45] = t21;
|
|
192
|
+
$[46] = value;
|
|
193
|
+
$[47] = t22;
|
|
194
|
+
} else t22 = $[47];
|
|
195
|
+
let t23;
|
|
196
|
+
if ($[48] !== labels.choose || $[49] !== t22) {
|
|
197
|
+
t23 = /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(Popover.Positioner, {
|
|
198
|
+
className: positioner,
|
|
199
|
+
align: "start",
|
|
200
|
+
sideOffset: 4,
|
|
201
|
+
collisionPadding: 8,
|
|
202
|
+
children: /* @__PURE__ */ jsx(Popover.Popup, {
|
|
203
|
+
"aria-label": t19,
|
|
204
|
+
className: t20,
|
|
205
|
+
children: t22
|
|
206
|
+
})
|
|
207
|
+
}) });
|
|
208
|
+
$[48] = labels.choose;
|
|
209
|
+
$[49] = t22;
|
|
210
|
+
$[50] = t23;
|
|
211
|
+
} else t23 = $[50];
|
|
212
|
+
let t24;
|
|
213
|
+
if ($[51] !== isOpen || $[52] !== t18 || $[53] !== t23 || $[54] !== t7) {
|
|
214
|
+
t24 = /* @__PURE__ */ jsxs(Popover.Root, {
|
|
215
|
+
open: isOpen,
|
|
216
|
+
onOpenChange: t7,
|
|
217
|
+
children: [t18, t23]
|
|
218
|
+
});
|
|
219
|
+
$[51] = isOpen;
|
|
220
|
+
$[52] = t18;
|
|
221
|
+
$[53] = t23;
|
|
222
|
+
$[54] = t7;
|
|
223
|
+
$[55] = t24;
|
|
224
|
+
} else t24 = $[55];
|
|
225
|
+
return t24;
|
|
226
|
+
};
|
|
227
|
+
/** The columns of an open cascader. Mounted when it opens, so it starts from the chosen path. */
|
|
228
|
+
var Columns = (t0) => {
|
|
229
|
+
const $ = c(6);
|
|
230
|
+
const { options, value, labels, onChoose } = t0;
|
|
231
|
+
const direction = useDirection();
|
|
232
|
+
const [path, setPath] = useState(value);
|
|
233
|
+
const [focus, setFocus] = useState(null);
|
|
234
|
+
const root = useRef(null);
|
|
235
|
+
const shouldFocus = useRef(false);
|
|
236
|
+
const columns = columnsOf(options, path);
|
|
237
|
+
const tabLevel = focus?.level ?? columns.length - 1;
|
|
238
|
+
const tabValue = focus?.value ?? path[tabLevel] ?? columns[tabLevel]?.find(_temp)?.value;
|
|
239
|
+
let t1;
|
|
240
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
241
|
+
t1 = () => {
|
|
242
|
+
if (!shouldFocus.current) return;
|
|
243
|
+
shouldFocus.current = false;
|
|
244
|
+
root.current?.querySelector("[data-tab-stop]")?.focus();
|
|
245
|
+
};
|
|
246
|
+
$[0] = t1;
|
|
247
|
+
} else t1 = $[0];
|
|
248
|
+
useEffect(t1);
|
|
249
|
+
let t2;
|
|
250
|
+
let t3;
|
|
251
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
252
|
+
t2 = () => {
|
|
253
|
+
root.current?.querySelector("[data-tab-stop]")?.focus();
|
|
254
|
+
};
|
|
255
|
+
t3 = [];
|
|
256
|
+
$[1] = t2;
|
|
257
|
+
$[2] = t3;
|
|
258
|
+
} else {
|
|
259
|
+
t2 = $[1];
|
|
260
|
+
t3 = $[2];
|
|
261
|
+
}
|
|
262
|
+
useEffect(t2, t3);
|
|
263
|
+
const reach = (level, to) => {
|
|
264
|
+
shouldFocus.current = true;
|
|
265
|
+
setFocus({
|
|
266
|
+
level,
|
|
267
|
+
value: to
|
|
268
|
+
});
|
|
269
|
+
};
|
|
270
|
+
const choose = (level_0, option_0) => {
|
|
271
|
+
if (option_0.disabled) return;
|
|
272
|
+
const next = [...path.slice(0, level_0), option_0.value];
|
|
273
|
+
if (option_0.children) {
|
|
274
|
+
setPath(next);
|
|
275
|
+
reach(level_0, option_0.value);
|
|
276
|
+
} else onChoose(next);
|
|
277
|
+
};
|
|
278
|
+
const onKeyDown = (event) => {
|
|
279
|
+
const target = event.target.closest("[data-level]");
|
|
280
|
+
const level_1 = Number(target?.dataset.level);
|
|
281
|
+
const at = target?.dataset.optionValue;
|
|
282
|
+
const column = columns[level_1];
|
|
283
|
+
const option_1 = column?.find((candidate) => candidate.value === at);
|
|
284
|
+
if (!column || !option_1) return;
|
|
285
|
+
const enabled = column.filter(_temp2);
|
|
286
|
+
const index = enabled.findIndex((candidate_1) => candidate_1.value === option_1.value);
|
|
287
|
+
const end = direction === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
288
|
+
const start = direction === "rtl" ? "ArrowRight" : "ArrowLeft";
|
|
289
|
+
if (event.key === "ArrowDown") {
|
|
290
|
+
const next_0 = enabled[index + 1];
|
|
291
|
+
if (next_0) reach(level_1, next_0.value);
|
|
292
|
+
} else if (event.key === "ArrowUp") {
|
|
293
|
+
const previous = enabled[index - 1];
|
|
294
|
+
if (previous) reach(level_1, previous.value);
|
|
295
|
+
} else if (event.key === "Home") {
|
|
296
|
+
const first = enabled[0];
|
|
297
|
+
if (first) reach(level_1, first.value);
|
|
298
|
+
} else if (event.key === "End") {
|
|
299
|
+
const last = enabled[enabled.length - 1];
|
|
300
|
+
if (last) reach(level_1, last.value);
|
|
301
|
+
} else if (event.key === end) {
|
|
302
|
+
if (!option_1.children || option_1.disabled) return;
|
|
303
|
+
const next_1 = [...path.slice(0, level_1), option_1.value];
|
|
304
|
+
setPath(next_1);
|
|
305
|
+
const first_0 = option_1.children.find(_temp3);
|
|
306
|
+
if (first_0) reach(level_1 + 1, first_0.value);
|
|
307
|
+
} else if (event.key === start) {
|
|
308
|
+
if (level_1 === 0) return;
|
|
309
|
+
const parent = path[level_1 - 1];
|
|
310
|
+
if (parent === void 0) return;
|
|
311
|
+
setPath(path.slice(0, level_1));
|
|
312
|
+
reach(level_1 - 1, parent);
|
|
313
|
+
} else if (event.key === "Enter" || event.key === " ") choose(level_1, option_1);
|
|
314
|
+
else return;
|
|
315
|
+
event.preventDefault();
|
|
316
|
+
};
|
|
317
|
+
const t4 = "flex divide-x divide-line";
|
|
318
|
+
const t5 = columns.map((column_0, level_2) => /* @__PURE__ */ jsx("ul", {
|
|
319
|
+
role: "listbox",
|
|
320
|
+
"aria-label": labels.column(level_2 + 1),
|
|
321
|
+
className: "m-0 max-h-64 min-w-44 list-none overflow-y-auto p-1.5",
|
|
322
|
+
children: column_0.map((option_2) => {
|
|
323
|
+
const inPath = path[level_2] === option_2.value;
|
|
324
|
+
const isTab = level_2 === tabLevel && option_2.value === tabValue;
|
|
325
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
326
|
+
role: "option",
|
|
327
|
+
"aria-selected": inPath,
|
|
328
|
+
"aria-disabled": option_2.disabled || void 0,
|
|
329
|
+
"data-level": level_2,
|
|
330
|
+
"data-option-value": option_2.value,
|
|
331
|
+
tabIndex: isTab ? 0 : -1,
|
|
332
|
+
...isTab ? { "data-tab-stop": "" } : {},
|
|
333
|
+
...inPath ? { "data-highlighted": "" } : {},
|
|
334
|
+
className: cn(item, "cursor-pointer justify-between", inPath && "font-medium", option_2.disabled && "cursor-not-allowed opacity-48"),
|
|
335
|
+
onClick: () => {
|
|
336
|
+
choose(level_2, option_2);
|
|
337
|
+
},
|
|
338
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
339
|
+
className: "min-w-0 truncate",
|
|
340
|
+
children: option_2.label
|
|
341
|
+
}), option_2.children ? /* @__PURE__ */ jsx(ChevronRight, {
|
|
342
|
+
"aria-hidden": "true",
|
|
343
|
+
className: "size-3.5 shrink-0 text-fg-secondary rtl:rotate-180"
|
|
344
|
+
}) : null]
|
|
345
|
+
}, option_2.value);
|
|
346
|
+
})
|
|
347
|
+
}, level_2));
|
|
348
|
+
let t6;
|
|
349
|
+
if ($[3] !== onKeyDown || $[4] !== t5) {
|
|
350
|
+
t6 = /* @__PURE__ */ jsx("div", {
|
|
351
|
+
ref: root,
|
|
352
|
+
className: t4,
|
|
353
|
+
onKeyDown,
|
|
354
|
+
children: t5
|
|
355
|
+
});
|
|
356
|
+
$[3] = onKeyDown;
|
|
357
|
+
$[4] = t5;
|
|
358
|
+
$[5] = t6;
|
|
359
|
+
} else t6 = $[5];
|
|
360
|
+
return t6;
|
|
361
|
+
};
|
|
362
|
+
function _temp(option) {
|
|
363
|
+
return !option.disabled;
|
|
364
|
+
}
|
|
365
|
+
function _temp2(candidate_0) {
|
|
366
|
+
return !candidate_0.disabled;
|
|
367
|
+
}
|
|
368
|
+
function _temp3(candidate_2) {
|
|
369
|
+
return !candidate_2.disabled;
|
|
370
|
+
}
|
|
371
|
+
export { Cascader };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Control, type ControllerProps, type FieldPath, type FieldValues } from "react-hook-form";
|
|
2
|
+
import type { FieldOrientation } from "../FormField/field-types.js";
|
|
3
|
+
import { type CascaderProps } from "./Cascader.js";
|
|
4
|
+
export type { CascaderLabels, CascaderOption } from "./Cascader.js";
|
|
5
|
+
export interface FormCascaderFieldProps<TValues extends FieldValues> extends Omit<CascaderProps, "value" | "onValueChange" | "onBlur" | "invalid" | "triggerRef" | "id" | "aria-label" | "aria-labelledby" | "aria-describedby"> {
|
|
6
|
+
control: Control<TValues>;
|
|
7
|
+
name: FieldPath<TValues>;
|
|
8
|
+
label: string;
|
|
9
|
+
hint?: string | undefined;
|
|
10
|
+
required?: boolean | undefined;
|
|
11
|
+
/** Label above the control (default) or in a column beside it. */
|
|
12
|
+
orientation?: FieldOrientation | undefined;
|
|
13
|
+
/** Keep the label for assistive technology only. */
|
|
14
|
+
hideLabel?: boolean | undefined;
|
|
15
|
+
/** react-hook-form validation rules, for forms that do not use a schema resolver. */
|
|
16
|
+
rules?: ControllerProps<TValues, FieldPath<TValues>>["rules"] | undefined;
|
|
17
|
+
/** Turns a stored schema message (an i18n key) into display text. */
|
|
18
|
+
formatError?: ((message: string) => string) | undefined;
|
|
19
|
+
}
|
|
20
|
+
/** A Cascader in a field, bound to a react-hook-form field holding the path: an array of the `value` of each step. */
|
|
21
|
+
export declare const FormCascaderField: <TValues extends FieldValues>({ control, name, label, hint, required, orientation, hideLabel, rules, formatError, disabled, size, ...cascaderProps }: FormCascaderFieldProps<TValues>) => import("react").JSX.Element;
|
|
@@ -0,0 +1,130 @@
|
|
|
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 { Cascader } from "./Cascader.js";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
// src/patterns/Cascader/FormCascaderField.tsx
|
|
10
|
+
/** A Cascader in a field, bound to a react-hook-form field holding the path: an array of the `value` of each step. */
|
|
11
|
+
var FormCascaderField = (t0) => {
|
|
12
|
+
const $ = c(33);
|
|
13
|
+
let cascaderProps;
|
|
14
|
+
let control;
|
|
15
|
+
let formatError;
|
|
16
|
+
let hint;
|
|
17
|
+
let label;
|
|
18
|
+
let name;
|
|
19
|
+
let orientation;
|
|
20
|
+
let required;
|
|
21
|
+
let rules;
|
|
22
|
+
let t1;
|
|
23
|
+
let t2;
|
|
24
|
+
let t3;
|
|
25
|
+
if ($[0] !== t0) {
|
|
26
|
+
({control, name, label, hint, required, orientation, hideLabel: t1, rules, formatError, disabled: t2, size: t3, ...cascaderProps} = t0);
|
|
27
|
+
$[0] = t0;
|
|
28
|
+
$[1] = cascaderProps;
|
|
29
|
+
$[2] = control;
|
|
30
|
+
$[3] = formatError;
|
|
31
|
+
$[4] = hint;
|
|
32
|
+
$[5] = label;
|
|
33
|
+
$[6] = name;
|
|
34
|
+
$[7] = orientation;
|
|
35
|
+
$[8] = required;
|
|
36
|
+
$[9] = rules;
|
|
37
|
+
$[10] = t1;
|
|
38
|
+
$[11] = t2;
|
|
39
|
+
$[12] = t3;
|
|
40
|
+
} else {
|
|
41
|
+
cascaderProps = $[1];
|
|
42
|
+
control = $[2];
|
|
43
|
+
formatError = $[3];
|
|
44
|
+
hint = $[4];
|
|
45
|
+
label = $[5];
|
|
46
|
+
name = $[6];
|
|
47
|
+
orientation = $[7];
|
|
48
|
+
required = $[8];
|
|
49
|
+
rules = $[9];
|
|
50
|
+
t1 = $[10];
|
|
51
|
+
t2 = $[11];
|
|
52
|
+
t3 = $[12];
|
|
53
|
+
}
|
|
54
|
+
const hideLabel = t1 === void 0 ? false : t1;
|
|
55
|
+
const disabled = t2 === void 0 ? false : t2;
|
|
56
|
+
const size = t3 === void 0 ? "medium" : t3;
|
|
57
|
+
const { labelId, messageIds, describe } = useFieldIds();
|
|
58
|
+
let t4;
|
|
59
|
+
if ($[13] !== rules) {
|
|
60
|
+
t4 = rules ? { rules } : {};
|
|
61
|
+
$[13] = rules;
|
|
62
|
+
$[14] = t4;
|
|
63
|
+
} else t4 = $[14];
|
|
64
|
+
let t5;
|
|
65
|
+
if ($[15] !== cascaderProps || $[16] !== describe || $[17] !== disabled || $[18] !== formatError || $[19] !== hideLabel || $[20] !== hint || $[21] !== label || $[22] !== labelId || $[23] !== messageIds || $[24] !== orientation || $[25] !== required || $[26] !== size) {
|
|
66
|
+
t5 = (t6) => {
|
|
67
|
+
const { field, fieldState } = t6;
|
|
68
|
+
const errorMessage = toErrorText(fieldState.error?.message, formatError);
|
|
69
|
+
const describedBy = describe(errorMessage, hint);
|
|
70
|
+
return /* @__PURE__ */ jsx(FieldFrame, {
|
|
71
|
+
name: field.name,
|
|
72
|
+
label,
|
|
73
|
+
hideLabel,
|
|
74
|
+
disabled,
|
|
75
|
+
invalid: fieldState.invalid,
|
|
76
|
+
touched: fieldState.isTouched,
|
|
77
|
+
dirty: fieldState.isDirty,
|
|
78
|
+
size,
|
|
79
|
+
triggerLabel: true,
|
|
80
|
+
labelId,
|
|
81
|
+
messageIds,
|
|
82
|
+
...hint ? { hint } : {},
|
|
83
|
+
...required ? { required } : {},
|
|
84
|
+
...orientation ? { orientation } : {},
|
|
85
|
+
...errorMessage === void 0 ? {} : { errorMessage },
|
|
86
|
+
children: /* @__PURE__ */ jsx(Cascader, {
|
|
87
|
+
...cascaderProps,
|
|
88
|
+
value: Array.isArray(field.value) ? field.value : [],
|
|
89
|
+
onValueChange: field.onChange,
|
|
90
|
+
onBlur: field.onBlur,
|
|
91
|
+
triggerRef: field.ref,
|
|
92
|
+
"aria-labelledby": labelId,
|
|
93
|
+
...describedBy ? { "aria-describedby": describedBy } : {},
|
|
94
|
+
invalid: fieldState.invalid,
|
|
95
|
+
disabled,
|
|
96
|
+
size
|
|
97
|
+
})
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
$[15] = cascaderProps;
|
|
101
|
+
$[16] = describe;
|
|
102
|
+
$[17] = disabled;
|
|
103
|
+
$[18] = formatError;
|
|
104
|
+
$[19] = hideLabel;
|
|
105
|
+
$[20] = hint;
|
|
106
|
+
$[21] = label;
|
|
107
|
+
$[22] = labelId;
|
|
108
|
+
$[23] = messageIds;
|
|
109
|
+
$[24] = orientation;
|
|
110
|
+
$[25] = required;
|
|
111
|
+
$[26] = size;
|
|
112
|
+
$[27] = t5;
|
|
113
|
+
} else t5 = $[27];
|
|
114
|
+
let t6;
|
|
115
|
+
if ($[28] !== control || $[29] !== name || $[30] !== t4 || $[31] !== t5) {
|
|
116
|
+
t6 = /* @__PURE__ */ jsx(Controller, {
|
|
117
|
+
control,
|
|
118
|
+
name,
|
|
119
|
+
...t4,
|
|
120
|
+
render: t5
|
|
121
|
+
});
|
|
122
|
+
$[28] = control;
|
|
123
|
+
$[29] = name;
|
|
124
|
+
$[30] = t4;
|
|
125
|
+
$[31] = t5;
|
|
126
|
+
$[32] = t6;
|
|
127
|
+
} else t6 = $[32];
|
|
128
|
+
return t6;
|
|
129
|
+
};
|
|
130
|
+
export { FormCascaderField };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type CartesianChartProps } from "./chart-parts.js";
|
|
2
|
+
export interface AreaChartProps extends CartesianChartProps {
|
|
3
|
+
/** Stack the series on top of each other, so the top edge is their total. Otherwise each is drawn from the axis. */
|
|
4
|
+
stacked?: boolean | undefined;
|
|
5
|
+
/** How the edge runs between points: straight, smoothed (`monotone`, default) or in steps. */
|
|
6
|
+
curve?: "linear" | "monotone" | "step" | undefined;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Filled areas over a shared x axis: a volume over time, or with `stacked` how a total divides into parts. The
|
|
10
|
+
* colours are the chart tokens, and the top edge of each area after the first is dashed or dotted in its own way (the
|
|
11
|
+
* legend shows the same). The data is also given to a screen reader as a table.
|
|
12
|
+
*/
|
|
13
|
+
export declare const AreaChart: ({ data, xKey, xLabel, series, "aria-label": ariaLabel, height, formatX, formatValue, hideLegend, hideGrid, stacked, curve, className, }: AreaChartProps) => import("react").JSX.Element;
|