@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,138 @@
|
|
|
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 { DateRangePicker } from "./DateRangePicker.js";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
// src/patterns/Calendar/FormDateRangeField.tsx
|
|
10
|
+
var EMPTY = {
|
|
11
|
+
start: "",
|
|
12
|
+
end: ""
|
|
13
|
+
};
|
|
14
|
+
/** A DateRangePicker in a field, bound to a react-hook-form field holding `{ start, end }`, "yyyy-MM-dd" each. */
|
|
15
|
+
var FormDateRangeField = (t0) => {
|
|
16
|
+
const $ = c(33);
|
|
17
|
+
let control;
|
|
18
|
+
let formatError;
|
|
19
|
+
let hint;
|
|
20
|
+
let label;
|
|
21
|
+
let name;
|
|
22
|
+
let orientation;
|
|
23
|
+
let pickerProps;
|
|
24
|
+
let required;
|
|
25
|
+
let rules;
|
|
26
|
+
let t1;
|
|
27
|
+
let t2;
|
|
28
|
+
let t3;
|
|
29
|
+
if ($[0] !== t0) {
|
|
30
|
+
({control, name, label, hint, required, orientation, hideLabel: t1, rules, formatError, disabled: t2, size: t3, ...pickerProps} = t0);
|
|
31
|
+
$[0] = t0;
|
|
32
|
+
$[1] = control;
|
|
33
|
+
$[2] = formatError;
|
|
34
|
+
$[3] = hint;
|
|
35
|
+
$[4] = label;
|
|
36
|
+
$[5] = name;
|
|
37
|
+
$[6] = orientation;
|
|
38
|
+
$[7] = pickerProps;
|
|
39
|
+
$[8] = required;
|
|
40
|
+
$[9] = rules;
|
|
41
|
+
$[10] = t1;
|
|
42
|
+
$[11] = t2;
|
|
43
|
+
$[12] = t3;
|
|
44
|
+
} else {
|
|
45
|
+
control = $[1];
|
|
46
|
+
formatError = $[2];
|
|
47
|
+
hint = $[3];
|
|
48
|
+
label = $[4];
|
|
49
|
+
name = $[5];
|
|
50
|
+
orientation = $[6];
|
|
51
|
+
pickerProps = $[7];
|
|
52
|
+
required = $[8];
|
|
53
|
+
rules = $[9];
|
|
54
|
+
t1 = $[10];
|
|
55
|
+
t2 = $[11];
|
|
56
|
+
t3 = $[12];
|
|
57
|
+
}
|
|
58
|
+
const hideLabel = t1 === void 0 ? false : t1;
|
|
59
|
+
const disabled = t2 === void 0 ? false : t2;
|
|
60
|
+
const size = t3 === void 0 ? "medium" : t3;
|
|
61
|
+
const { labelId, messageIds, describe } = useFieldIds();
|
|
62
|
+
let t4;
|
|
63
|
+
if ($[13] !== rules) {
|
|
64
|
+
t4 = rules ? { rules } : {};
|
|
65
|
+
$[13] = rules;
|
|
66
|
+
$[14] = t4;
|
|
67
|
+
} else t4 = $[14];
|
|
68
|
+
let t5;
|
|
69
|
+
if ($[15] !== describe || $[16] !== disabled || $[17] !== formatError || $[18] !== hideLabel || $[19] !== hint || $[20] !== label || $[21] !== labelId || $[22] !== messageIds || $[23] !== orientation || $[24] !== pickerProps || $[25] !== required || $[26] !== size) {
|
|
70
|
+
t5 = (t6) => {
|
|
71
|
+
const { field, fieldState } = t6;
|
|
72
|
+
const errorMessage = toErrorText(fieldState.error?.message, formatError);
|
|
73
|
+
const describedBy = describe(errorMessage, hint);
|
|
74
|
+
const value = field.value;
|
|
75
|
+
return /* @__PURE__ */ jsx(FieldFrame, {
|
|
76
|
+
name: field.name,
|
|
77
|
+
label,
|
|
78
|
+
hideLabel,
|
|
79
|
+
disabled,
|
|
80
|
+
invalid: fieldState.invalid,
|
|
81
|
+
touched: fieldState.isTouched,
|
|
82
|
+
dirty: fieldState.isDirty,
|
|
83
|
+
size,
|
|
84
|
+
triggerLabel: true,
|
|
85
|
+
labelId,
|
|
86
|
+
messageIds,
|
|
87
|
+
...hint ? { hint } : {},
|
|
88
|
+
...required ? { required } : {},
|
|
89
|
+
...orientation ? { orientation } : {},
|
|
90
|
+
...errorMessage === void 0 ? {} : { errorMessage },
|
|
91
|
+
children: /* @__PURE__ */ jsx(DateRangePicker, {
|
|
92
|
+
...pickerProps,
|
|
93
|
+
value: {
|
|
94
|
+
...EMPTY,
|
|
95
|
+
...value
|
|
96
|
+
},
|
|
97
|
+
onValueChange: field.onChange,
|
|
98
|
+
onBlur: field.onBlur,
|
|
99
|
+
triggerRef: field.ref,
|
|
100
|
+
"aria-labelledby": labelId,
|
|
101
|
+
...describedBy ? { "aria-describedby": describedBy } : {},
|
|
102
|
+
invalid: fieldState.invalid,
|
|
103
|
+
disabled,
|
|
104
|
+
size
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
$[15] = describe;
|
|
109
|
+
$[16] = disabled;
|
|
110
|
+
$[17] = formatError;
|
|
111
|
+
$[18] = hideLabel;
|
|
112
|
+
$[19] = hint;
|
|
113
|
+
$[20] = label;
|
|
114
|
+
$[21] = labelId;
|
|
115
|
+
$[22] = messageIds;
|
|
116
|
+
$[23] = orientation;
|
|
117
|
+
$[24] = pickerProps;
|
|
118
|
+
$[25] = required;
|
|
119
|
+
$[26] = size;
|
|
120
|
+
$[27] = t5;
|
|
121
|
+
} else t5 = $[27];
|
|
122
|
+
let t6;
|
|
123
|
+
if ($[28] !== control || $[29] !== name || $[30] !== t4 || $[31] !== t5) {
|
|
124
|
+
t6 = /* @__PURE__ */ jsx(Controller, {
|
|
125
|
+
control,
|
|
126
|
+
name,
|
|
127
|
+
...t4,
|
|
128
|
+
render: t5
|
|
129
|
+
});
|
|
130
|
+
$[28] = control;
|
|
131
|
+
$[29] = name;
|
|
132
|
+
$[30] = t4;
|
|
133
|
+
$[31] = t5;
|
|
134
|
+
$[32] = t6;
|
|
135
|
+
} else t6 = $[32];
|
|
136
|
+
return t6;
|
|
137
|
+
};
|
|
138
|
+
export { FormDateRangeField };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* standard white surface, light border: the default
|
|
4
|
+
* info the pale brand tint, for a notice that belongs to the page
|
|
5
|
+
* action the brand fill, for the one card that invites a click
|
|
6
|
+
*/
|
|
7
|
+
export type CardVariant = "standard" | "info" | "action";
|
|
8
|
+
/**
|
|
9
|
+
* medium 20px, the default
|
|
10
|
+
* large 24px, for a card that holds a whole form or section
|
|
11
|
+
* none for content that runs edge to edge, such as a table; it brings its own padding
|
|
12
|
+
*/
|
|
13
|
+
export type CardPadding = "none" | "medium" | "large";
|
|
14
|
+
export interface CardProps extends ComponentPropsWithoutRef<"div"> {
|
|
15
|
+
variant?: CardVariant | undefined;
|
|
16
|
+
padding?: CardPadding | undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A surface that groups related content. Pass `onClick` to make the whole card
|
|
20
|
+
* a button: it becomes focusable, Enter and Space click it, and it lifts on
|
|
21
|
+
* hover. A button's content is read as one name, so a clickable card holds
|
|
22
|
+
* plain text: a heading inside it is not announced as a heading, and a control
|
|
23
|
+
* inside it is a control within a button. For a card with headings or its own
|
|
24
|
+
* controls, put a button or link inside the card instead.
|
|
25
|
+
*/
|
|
26
|
+
export declare const Card: ({ variant, padding, className, onClick, onKeyDown, ...rest }: CardProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../../utils/cn.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
// src/patterns/Card/Card.tsx
|
|
7
|
+
/** The foundation's cards rest on a border; elevation appears on hover. */
|
|
8
|
+
var cardVariants = cva("flex flex-col gap-3 rounded-lg border transition-shadow duration-150 ease-standard", {
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
standard: "border-line bg-surface text-fg",
|
|
12
|
+
info: "border-primary-light bg-primary-pale text-primary-text",
|
|
13
|
+
action: "border-transparent bg-primary text-on-primary hover:shadow-action"
|
|
14
|
+
},
|
|
15
|
+
padding: {
|
|
16
|
+
medium: "p-5",
|
|
17
|
+
large: "p-6",
|
|
18
|
+
none: "gap-0 overflow-hidden p-0"
|
|
19
|
+
},
|
|
20
|
+
interactive: {
|
|
21
|
+
true: "cursor-pointer",
|
|
22
|
+
false: ""
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
compoundVariants: [{
|
|
26
|
+
variant: ["standard", "info"],
|
|
27
|
+
interactive: true,
|
|
28
|
+
className: "hover:shadow-md"
|
|
29
|
+
}],
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
variant: "standard",
|
|
32
|
+
padding: "medium",
|
|
33
|
+
interactive: false
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* A surface that groups related content. Pass `onClick` to make the whole card
|
|
38
|
+
* a button: it becomes focusable, Enter and Space click it, and it lifts on
|
|
39
|
+
* hover. A button's content is read as one name, so a clickable card holds
|
|
40
|
+
* plain text: a heading inside it is not announced as a heading, and a control
|
|
41
|
+
* inside it is a control within a button. For a card with headings or its own
|
|
42
|
+
* controls, put a button or link inside the card instead.
|
|
43
|
+
*/
|
|
44
|
+
var Card = (t0) => {
|
|
45
|
+
const $ = c(23);
|
|
46
|
+
let className;
|
|
47
|
+
let onClick;
|
|
48
|
+
let onKeyDown;
|
|
49
|
+
let rest;
|
|
50
|
+
let t1;
|
|
51
|
+
let t2;
|
|
52
|
+
if ($[0] !== t0) {
|
|
53
|
+
({variant: t1, padding: t2, className, onClick, onKeyDown, ...rest} = t0);
|
|
54
|
+
$[0] = t0;
|
|
55
|
+
$[1] = className;
|
|
56
|
+
$[2] = onClick;
|
|
57
|
+
$[3] = onKeyDown;
|
|
58
|
+
$[4] = rest;
|
|
59
|
+
$[5] = t1;
|
|
60
|
+
$[6] = t2;
|
|
61
|
+
} else {
|
|
62
|
+
className = $[1];
|
|
63
|
+
onClick = $[2];
|
|
64
|
+
onKeyDown = $[3];
|
|
65
|
+
rest = $[4];
|
|
66
|
+
t1 = $[5];
|
|
67
|
+
t2 = $[6];
|
|
68
|
+
}
|
|
69
|
+
const variant = t1 === void 0 ? "standard" : t1;
|
|
70
|
+
const padding = t2 === void 0 ? "medium" : t2;
|
|
71
|
+
let t3;
|
|
72
|
+
if ($[7] !== onClick || $[8] !== onKeyDown) {
|
|
73
|
+
t3 = (event) => {
|
|
74
|
+
onKeyDown?.(event);
|
|
75
|
+
if (!onClick || event.defaultPrevented || event.target !== event.currentTarget) return;
|
|
76
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
event.currentTarget.click();
|
|
79
|
+
};
|
|
80
|
+
$[7] = onClick;
|
|
81
|
+
$[8] = onKeyDown;
|
|
82
|
+
$[9] = t3;
|
|
83
|
+
} else t3 = $[9];
|
|
84
|
+
const handleKeyDown = t3;
|
|
85
|
+
let t4;
|
|
86
|
+
if ($[10] !== handleKeyDown || $[11] !== onClick || $[12] !== onKeyDown) {
|
|
87
|
+
t4 = onClick ? {
|
|
88
|
+
onClick,
|
|
89
|
+
onKeyDown: handleKeyDown,
|
|
90
|
+
role: "button",
|
|
91
|
+
tabIndex: 0
|
|
92
|
+
} : { onKeyDown };
|
|
93
|
+
$[10] = handleKeyDown;
|
|
94
|
+
$[11] = onClick;
|
|
95
|
+
$[12] = onKeyDown;
|
|
96
|
+
$[13] = t4;
|
|
97
|
+
} else t4 = $[13];
|
|
98
|
+
let t5;
|
|
99
|
+
if ($[14] !== className || $[15] !== onClick || $[16] !== padding || $[17] !== variant) {
|
|
100
|
+
t5 = cn(cardVariants({
|
|
101
|
+
variant,
|
|
102
|
+
padding,
|
|
103
|
+
interactive: Boolean(onClick)
|
|
104
|
+
}), className);
|
|
105
|
+
$[14] = className;
|
|
106
|
+
$[15] = onClick;
|
|
107
|
+
$[16] = padding;
|
|
108
|
+
$[17] = variant;
|
|
109
|
+
$[18] = t5;
|
|
110
|
+
} else t5 = $[18];
|
|
111
|
+
let t6;
|
|
112
|
+
if ($[19] !== rest || $[20] !== t4 || $[21] !== t5) {
|
|
113
|
+
t6 = /* @__PURE__ */ jsx("div", {
|
|
114
|
+
...rest,
|
|
115
|
+
...t4,
|
|
116
|
+
className: t5
|
|
117
|
+
});
|
|
118
|
+
$[19] = rest;
|
|
119
|
+
$[20] = t4;
|
|
120
|
+
$[21] = t5;
|
|
121
|
+
$[22] = t6;
|
|
122
|
+
} else t6 = $[22];
|
|
123
|
+
return t6;
|
|
124
|
+
};
|
|
125
|
+
export { Card };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/** The texts of the carousel. The design system has no i18n, so the caller supplies them. */
|
|
3
|
+
export interface CarouselLabels {
|
|
4
|
+
/** Accessible name of the button that goes back, e.g. "Previous slide". */
|
|
5
|
+
previous: string;
|
|
6
|
+
/** Accessible name of the button that goes on, e.g. "Next slide". */
|
|
7
|
+
next: string;
|
|
8
|
+
/** Names a slide for a screen reader: `(n, total) => `${n} of ${total}``. */
|
|
9
|
+
slide: (index: number, total: number) => string;
|
|
10
|
+
/** Names the dot that goes to a slide: `(n) => `Go to slide ${n}``. */
|
|
11
|
+
goToSlide: (index: number) => string;
|
|
12
|
+
}
|
|
13
|
+
export interface CarouselProps {
|
|
14
|
+
/** The slides: one child each. */
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
labels: CarouselLabels;
|
|
17
|
+
/** Accessible name of the carousel, e.g. "Featured products". */
|
|
18
|
+
"aria-label": string;
|
|
19
|
+
/** How many slides show at once. Default 1. */
|
|
20
|
+
slidesPerView?: 1 | 2 | 3 | undefined;
|
|
21
|
+
/** Hide the dots under the slides. Default shows them. */
|
|
22
|
+
hideIndicators?: boolean | undefined;
|
|
23
|
+
/** Called with the index of the first slide in view, as the carousel moves. */
|
|
24
|
+
onIndexChange?: ((index: number) => void) | undefined;
|
|
25
|
+
className?: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Slides in a row that scroll sideways and snap into place: swipe or scroll on a touch screen, the buttons and dots
|
|
29
|
+
* elsewhere. It is a native scroll area, so it needs no script to move and works with the arrow keys once focused.
|
|
30
|
+
* Every slide is in the page for a screen reader. Nothing moves by itself: there is no autoplay. The slides run
|
|
31
|
+
* the way the page reads.
|
|
32
|
+
*/
|
|
33
|
+
export declare const Carousel: ({ children, labels, "aria-label": ariaLabel, slidesPerView, hideIndicators, onIndexChange, className }: CarouselProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Children, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
4
|
+
import { cn } from "../../utils/cn.js";
|
|
5
|
+
import { Button } from "../../components/Button/Button.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/patterns/Carousel/Carousel.tsx
|
|
8
|
+
var BASIS = {
|
|
9
|
+
1: "basis-full",
|
|
10
|
+
2: "basis-1/2",
|
|
11
|
+
3: "basis-1/3"
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Slides in a row that scroll sideways and snap into place: swipe or scroll on a touch screen, the buttons and dots
|
|
15
|
+
* elsewhere. It is a native scroll area, so it needs no script to move and works with the arrow keys once focused.
|
|
16
|
+
* Every slide is in the page for a screen reader. Nothing moves by itself: there is no autoplay. The slides run
|
|
17
|
+
* the way the page reads.
|
|
18
|
+
*/
|
|
19
|
+
var Carousel = ({ children, labels, "aria-label": ariaLabel, slidesPerView = 1, hideIndicators = false, onIndexChange, className }) => {
|
|
20
|
+
const slides = Children.toArray(children);
|
|
21
|
+
const track = useRef(null);
|
|
22
|
+
const [index, setIndex] = useState(0);
|
|
23
|
+
const frame = useRef(0);
|
|
24
|
+
const last = Math.max(0, slides.length - slidesPerView);
|
|
25
|
+
/** The slide whose start edge is nearest the track's start edge: the first one in view. */
|
|
26
|
+
const nearest = () => {
|
|
27
|
+
const element = track.current;
|
|
28
|
+
if (!element) return 0;
|
|
29
|
+
const isRtl = getComputedStyle(element).direction === "rtl";
|
|
30
|
+
const box = element.getBoundingClientRect();
|
|
31
|
+
let best = 0;
|
|
32
|
+
let distance = 1e400;
|
|
33
|
+
[...element.children].forEach((child, at) => {
|
|
34
|
+
const rect = child.getBoundingClientRect();
|
|
35
|
+
const gap = Math.abs(isRtl ? rect.right - box.right : rect.left - box.left);
|
|
36
|
+
if (gap < distance) {
|
|
37
|
+
distance = gap;
|
|
38
|
+
best = at;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return Math.min(best, last);
|
|
42
|
+
};
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
onIndexChange?.(index);
|
|
45
|
+
}, [index]);
|
|
46
|
+
useEffect(() => () => {
|
|
47
|
+
cancelAnimationFrame(frame.current);
|
|
48
|
+
}, []);
|
|
49
|
+
const goTo = (to) => {
|
|
50
|
+
const target = track.current?.children[Math.min(Math.max(to, 0), last)];
|
|
51
|
+
if (!(target instanceof HTMLElement)) return;
|
|
52
|
+
const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
53
|
+
target.scrollIntoView({
|
|
54
|
+
behavior: reduce ? "auto" : "smooth",
|
|
55
|
+
inline: "start",
|
|
56
|
+
block: "nearest"
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
60
|
+
role: "region",
|
|
61
|
+
"aria-roledescription": "carousel",
|
|
62
|
+
"aria-label": ariaLabel,
|
|
63
|
+
className: cn("flex min-w-0 flex-col gap-3", className),
|
|
64
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
65
|
+
className: "relative",
|
|
66
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
67
|
+
ref: track,
|
|
68
|
+
tabIndex: 0,
|
|
69
|
+
className: "flex snap-x snap-mandatory overflow-x-auto overscroll-x-contain rounded-md outline-none [scrollbar-width:none] focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2 focus-visible:ring-offset-page [&::-webkit-scrollbar]:hidden",
|
|
70
|
+
onScroll: () => {
|
|
71
|
+
cancelAnimationFrame(frame.current);
|
|
72
|
+
frame.current = requestAnimationFrame(() => {
|
|
73
|
+
setIndex(nearest());
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
children: slides.map((slide, at) => /* @__PURE__ */ jsx("div", {
|
|
77
|
+
role: "group",
|
|
78
|
+
"aria-roledescription": "slide",
|
|
79
|
+
"aria-label": labels.slide(at + 1, slides.length),
|
|
80
|
+
className: cn("min-w-0 shrink-0 snap-start", BASIS[slidesPerView]),
|
|
81
|
+
children: slide
|
|
82
|
+
}, at))
|
|
83
|
+
})
|
|
84
|
+
}), slides.length > slidesPerView ? /* @__PURE__ */ jsxs("div", {
|
|
85
|
+
className: "flex items-center justify-center gap-3",
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsx(Button, {
|
|
88
|
+
variant: "subtle",
|
|
89
|
+
size: "small",
|
|
90
|
+
"aria-label": labels.previous,
|
|
91
|
+
disabledFocusable: index <= 0,
|
|
92
|
+
icon: /* @__PURE__ */ jsx(ChevronLeft, { className: "rtl:rotate-180" }),
|
|
93
|
+
onClick: () => {
|
|
94
|
+
goTo(index - 1);
|
|
95
|
+
}
|
|
96
|
+
}),
|
|
97
|
+
hideIndicators ? null : /* @__PURE__ */ jsx("div", {
|
|
98
|
+
className: "flex items-center",
|
|
99
|
+
children: Array.from({ length: last + 1 }, (_, at) => /* @__PURE__ */ jsx("button", {
|
|
100
|
+
type: "button",
|
|
101
|
+
"aria-label": labels.goToSlide(at + 1),
|
|
102
|
+
"aria-current": at === index ? "true" : void 0,
|
|
103
|
+
className: "group/dot inline-flex size-6 cursor-pointer items-center justify-center rounded-full border-0 bg-transparent p-0 outline-none focus-visible:ring-2 focus-visible:ring-focus",
|
|
104
|
+
onClick: () => {
|
|
105
|
+
goTo(at);
|
|
106
|
+
},
|
|
107
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
108
|
+
"aria-hidden": "true",
|
|
109
|
+
className: "size-2 rounded-full bg-line-strong transition-colors group-aria-current/dot:bg-primary"
|
|
110
|
+
})
|
|
111
|
+
}, at))
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ jsx(Button, {
|
|
114
|
+
variant: "subtle",
|
|
115
|
+
size: "small",
|
|
116
|
+
"aria-label": labels.next,
|
|
117
|
+
disabledFocusable: index >= last,
|
|
118
|
+
icon: /* @__PURE__ */ jsx(ChevronRight, { className: "rtl:rotate-180" }),
|
|
119
|
+
onClick: () => {
|
|
120
|
+
goTo(index + 1);
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
]
|
|
124
|
+
}) : null]
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
export { Carousel };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type Ref } from "react";
|
|
2
|
+
import type { FieldSize } from "../FormField/field-types.js";
|
|
3
|
+
export interface CascaderOption {
|
|
4
|
+
/** Identifies the option among its neighbours: `value` is the path of these. */
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
/** Makes the option a step on the way: choosing it opens a column of these. */
|
|
8
|
+
children?: readonly CascaderOption[] | undefined;
|
|
9
|
+
disabled?: boolean | undefined;
|
|
10
|
+
}
|
|
11
|
+
/** The texts of the cascader. The design system has no i18n, so the caller supplies them. */
|
|
12
|
+
export interface CascaderLabels {
|
|
13
|
+
/** The button's accessible name and the panel's, e.g. "Choose a location". */
|
|
14
|
+
choose: string;
|
|
15
|
+
/** Names the column of a level, from 1: `(n) => `Level ${n}``. */
|
|
16
|
+
column: (level: number) => string;
|
|
17
|
+
}
|
|
18
|
+
export interface CascaderProps {
|
|
19
|
+
options: readonly CascaderOption[];
|
|
20
|
+
/** The path to the chosen option: the `value` of each step, from the first column to the last. Empty for none. */
|
|
21
|
+
value: readonly string[];
|
|
22
|
+
/** Called with the path when a last step (an option with no children) is chosen. */
|
|
23
|
+
onValueChange: (value: string[]) => void;
|
|
24
|
+
labels: CascaderLabels;
|
|
25
|
+
/** Shown on the button while nothing is chosen. `labels.choose` if omitted. */
|
|
26
|
+
placeholder?: string | undefined;
|
|
27
|
+
/** Written between the labels of the path on the button. Default " / ". */
|
|
28
|
+
separator?: string | undefined;
|
|
29
|
+
disabled?: boolean | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Draws the red border. A button cannot carry aria-invalid, so the field is announced as invalid through its
|
|
32
|
+
* message, which `aria-describedby` ties to it.
|
|
33
|
+
*/
|
|
34
|
+
invalid?: boolean | undefined;
|
|
35
|
+
size?: FieldSize | undefined;
|
|
36
|
+
id?: string | undefined;
|
|
37
|
+
/** What names the field when there is no visible label. */
|
|
38
|
+
"aria-label"?: string | undefined;
|
|
39
|
+
/** The id of the element that is the field's label; the chosen path is added to the name. */
|
|
40
|
+
"aria-labelledby"?: string | undefined;
|
|
41
|
+
/** The ids of the field's message and hint, read after the name. */
|
|
42
|
+
"aria-describedby"?: string | undefined;
|
|
43
|
+
triggerRef?: Ref<HTMLButtonElement> | undefined;
|
|
44
|
+
/** The cascader was left: the panel closed, or focus moved off the button while closed. */
|
|
45
|
+
onBlur?: (() => void) | undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Choosing through levels: a country, then a region, then a city. A button shows the chosen path and opens columns,
|
|
49
|
+
* one for each level; choosing a step opens its children beside it, and choosing a last step ends the choice. In
|
|
50
|
+
* the columns the up and down keys move, the key toward the end edge opens a step and goes in, the key toward the
|
|
51
|
+
* start edge goes back out, and Enter chooses. For a list of one level, see Combobox.
|
|
52
|
+
*/
|
|
53
|
+
export declare const Cascader: ({ options, value, onValueChange, labels, placeholder, separator, disabled, invalid, size, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, triggerRef, onBlur, }: CascaderProps) => import("react").JSX.Element;
|