@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,444 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { useDirection } from "@base-ui/react/direction-provider";
|
|
5
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
6
|
+
import { Button } from "../../components/Button/Button.js";
|
|
7
|
+
import { cn } from "../../utils/cn.js";
|
|
8
|
+
import { clampPickerParts, currentParts, dayLabel, isDayAllowed, joinPickerValue, monthNames, monthOf, monthTitle, monthWeeks, nearestAllowedDay, readPickerValue, roundTime, shiftDay, shiftDayByMonths, shiftMonth, timeOrNow, weekEdge, weekdayNames, yearOf } from "./picker-values.js";
|
|
9
|
+
import { TimeSliders } from "./TimeSliders.js";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
// src/patterns/DateTimePicker/DateTimePanel.tsx
|
|
12
|
+
/** A day of the calendar (Figma draws none): a teal border and wash on hover, solid teal when chosen, faded when it cannot be picked. */
|
|
13
|
+
var DAY_BUTTON = cn("flex h-6 w-full cursor-pointer items-center justify-center rounded-check border border-transparent text-body-sm font-normal text-fg outline-none transition-colors", "hover:border-primary hover:bg-primary-light focus-visible:ring-2 focus-visible:ring-focus", "aria-disabled:cursor-not-allowed aria-disabled:opacity-25 aria-disabled:hover:border-transparent aria-disabled:hover:bg-transparent", "data-today:font-semibold data-today:text-primary-text", "data-selected:bg-primary data-selected:font-normal data-selected:text-on-primary data-selected:hover:border-primary data-selected:hover:bg-primary");
|
|
14
|
+
/**
|
|
15
|
+
* The panel a picker opens: a month with arrows, the days from the locale's first day of the
|
|
16
|
+
* week, the hour, minute and second sliders, and Today or Now, Clear and Done. The keyboard
|
|
17
|
+
* moves through the days, and the month's name opens a month and year list so a date years
|
|
18
|
+
* away is not months of clicking. Every change is sent as it is made; Done only closes. It is
|
|
19
|
+
* mounted when the picker opens, so what it starts from is the value then.
|
|
20
|
+
*/
|
|
21
|
+
var DateTimePanel = (t0) => {
|
|
22
|
+
const $ = c(66);
|
|
23
|
+
const { value, kind, withSeconds, bounds, labels, locale, defaultTime, clearable, showNow, onChange, onDone } = t0;
|
|
24
|
+
const direction = useDirection();
|
|
25
|
+
const parts = readPickerValue(value, kind);
|
|
26
|
+
const [opened] = useState(_temp);
|
|
27
|
+
const today = opened.day ?? "";
|
|
28
|
+
let t1;
|
|
29
|
+
if ($[0] !== defaultTime || $[1] !== withSeconds) {
|
|
30
|
+
t1 = () => roundTime(timeOrNow(defaultTime), withSeconds);
|
|
31
|
+
$[0] = defaultTime;
|
|
32
|
+
$[1] = withSeconds;
|
|
33
|
+
$[2] = t1;
|
|
34
|
+
} else t1 = $[2];
|
|
35
|
+
const [fallbackTime] = useState(t1);
|
|
36
|
+
const startDay = nearestAllowedDay(parts?.day ?? today, bounds);
|
|
37
|
+
const [viewMonth, setViewMonth] = useState(() => monthOf(startDay));
|
|
38
|
+
const [focusDay, setFocusDay] = useState(startDay);
|
|
39
|
+
const [view, setView] = useState("days");
|
|
40
|
+
const gridRef = useRef(null);
|
|
41
|
+
const monthListRef = useRef(null);
|
|
42
|
+
const focusNext = useRef(null);
|
|
43
|
+
let t2;
|
|
44
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
45
|
+
t2 = () => {
|
|
46
|
+
const target = focusNext.current;
|
|
47
|
+
if (target === null) return;
|
|
48
|
+
focusNext.current = null;
|
|
49
|
+
(target === "day" ? gridRef.current : monthListRef.current)?.querySelector("[data-focus-target]")?.focus();
|
|
50
|
+
};
|
|
51
|
+
$[3] = t2;
|
|
52
|
+
} else t2 = $[3];
|
|
53
|
+
useEffect(t2);
|
|
54
|
+
let t3;
|
|
55
|
+
if ($[4] !== bounds || $[5] !== kind || $[6] !== onChange || $[7] !== withSeconds) {
|
|
56
|
+
t3 = (next) => {
|
|
57
|
+
onChange(joinPickerValue(clampPickerParts(next, kind, bounds), kind, withSeconds));
|
|
58
|
+
};
|
|
59
|
+
$[4] = bounds;
|
|
60
|
+
$[5] = kind;
|
|
61
|
+
$[6] = onChange;
|
|
62
|
+
$[7] = withSeconds;
|
|
63
|
+
$[8] = t3;
|
|
64
|
+
} else t3 = $[8];
|
|
65
|
+
const send = t3;
|
|
66
|
+
const pickDay = (day) => {
|
|
67
|
+
setFocusDay(day);
|
|
68
|
+
if (!isDayAllowed(day, bounds)) return;
|
|
69
|
+
send({
|
|
70
|
+
day,
|
|
71
|
+
time: kind === "date" ? null : parts?.time ?? fallbackTime
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
const setTime = (time) => {
|
|
75
|
+
if (kind === "time") send({
|
|
76
|
+
day: null,
|
|
77
|
+
time
|
|
78
|
+
});
|
|
79
|
+
else if (parts?.day) send({
|
|
80
|
+
day: parts.day,
|
|
81
|
+
time
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
let t4;
|
|
85
|
+
if ($[9] !== bounds || $[10] !== kind || $[11] !== today) {
|
|
86
|
+
t4 = kind === "time" || isDayAllowed(today, bounds);
|
|
87
|
+
$[9] = bounds;
|
|
88
|
+
$[10] = kind;
|
|
89
|
+
$[11] = today;
|
|
90
|
+
$[12] = t4;
|
|
91
|
+
} else t4 = $[12];
|
|
92
|
+
const isNowAllowed = t4;
|
|
93
|
+
let t5;
|
|
94
|
+
if ($[13] !== kind || $[14] !== onDone || $[15] !== send || $[16] !== withSeconds) {
|
|
95
|
+
t5 = () => {
|
|
96
|
+
const now = currentParts();
|
|
97
|
+
const time_0 = roundTime(now.time ?? "00:00:00", withSeconds);
|
|
98
|
+
send(kind === "date" ? {
|
|
99
|
+
day: now.day,
|
|
100
|
+
time: null
|
|
101
|
+
} : kind === "time" ? {
|
|
102
|
+
day: null,
|
|
103
|
+
time: time_0
|
|
104
|
+
} : {
|
|
105
|
+
day: now.day,
|
|
106
|
+
time: time_0
|
|
107
|
+
});
|
|
108
|
+
onDone();
|
|
109
|
+
};
|
|
110
|
+
$[13] = kind;
|
|
111
|
+
$[14] = onDone;
|
|
112
|
+
$[15] = send;
|
|
113
|
+
$[16] = withSeconds;
|
|
114
|
+
$[17] = t5;
|
|
115
|
+
} else t5 = $[17];
|
|
116
|
+
const pickNow = t5;
|
|
117
|
+
let t6;
|
|
118
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
119
|
+
t6 = (by) => {
|
|
120
|
+
setViewMonth((month) => shiftMonth(month, by));
|
|
121
|
+
};
|
|
122
|
+
$[18] = t6;
|
|
123
|
+
} else t6 = $[18];
|
|
124
|
+
const goToMonth = t6;
|
|
125
|
+
let t7;
|
|
126
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
127
|
+
t7 = (day_0) => {
|
|
128
|
+
focusNext.current = "day";
|
|
129
|
+
setFocusDay(day_0);
|
|
130
|
+
setViewMonth(monthOf(day_0));
|
|
131
|
+
};
|
|
132
|
+
$[19] = t7;
|
|
133
|
+
} else t7 = $[19];
|
|
134
|
+
const moveFocus = t7;
|
|
135
|
+
let t8;
|
|
136
|
+
if ($[20] !== direction || $[21] !== locale) {
|
|
137
|
+
t8 = (event) => {
|
|
138
|
+
const target_0 = event.target;
|
|
139
|
+
const day_1 = target_0 instanceof HTMLElement ? target_0.closest("[data-day]")?.dataset.day : void 0;
|
|
140
|
+
if (day_1 === void 0) return;
|
|
141
|
+
const forward = direction === "rtl" ? -1 : 1;
|
|
142
|
+
const jump = event.shiftKey ? 12 : 1;
|
|
143
|
+
const moves = {
|
|
144
|
+
ArrowRight: shiftDay(day_1, forward),
|
|
145
|
+
ArrowLeft: shiftDay(day_1, -forward),
|
|
146
|
+
ArrowDown: shiftDay(day_1, 7),
|
|
147
|
+
ArrowUp: shiftDay(day_1, -7),
|
|
148
|
+
Home: weekEdge(day_1, "start", locale),
|
|
149
|
+
End: weekEdge(day_1, "end", locale),
|
|
150
|
+
PageDown: shiftDayByMonths(day_1, jump),
|
|
151
|
+
PageUp: shiftDayByMonths(day_1, -jump)
|
|
152
|
+
};
|
|
153
|
+
const next_0 = Object.hasOwn(moves, event.key) ? moves[event.key] : void 0;
|
|
154
|
+
if (next_0 === void 0) return;
|
|
155
|
+
event.preventDefault();
|
|
156
|
+
moveFocus(next_0);
|
|
157
|
+
};
|
|
158
|
+
$[20] = direction;
|
|
159
|
+
$[21] = locale;
|
|
160
|
+
$[22] = t8;
|
|
161
|
+
} else t8 = $[22];
|
|
162
|
+
const handleGridKeyDown = t8;
|
|
163
|
+
const hasCalendar = kind !== "time";
|
|
164
|
+
let t9;
|
|
165
|
+
if ($[23] !== focusDay || $[24] !== viewMonth) {
|
|
166
|
+
t9 = monthOf(focusDay) === viewMonth ? focusDay : `${viewMonth}-01`;
|
|
167
|
+
$[23] = focusDay;
|
|
168
|
+
$[24] = viewMonth;
|
|
169
|
+
$[25] = t9;
|
|
170
|
+
} else t9 = $[25];
|
|
171
|
+
const focusTarget = t9;
|
|
172
|
+
const isEmpty = parts === null;
|
|
173
|
+
let t10;
|
|
174
|
+
if ($[26] !== fallbackTime || $[27] !== isEmpty || $[28] !== kind || $[29] !== onDone || $[30] !== send) {
|
|
175
|
+
t10 = () => {
|
|
176
|
+
if (kind === "time" && isEmpty) send({
|
|
177
|
+
day: null,
|
|
178
|
+
time: fallbackTime
|
|
179
|
+
});
|
|
180
|
+
onDone();
|
|
181
|
+
};
|
|
182
|
+
$[26] = fallbackTime;
|
|
183
|
+
$[27] = isEmpty;
|
|
184
|
+
$[28] = kind;
|
|
185
|
+
$[29] = onDone;
|
|
186
|
+
$[30] = send;
|
|
187
|
+
$[31] = t10;
|
|
188
|
+
} else t10 = $[31];
|
|
189
|
+
const finish = t10;
|
|
190
|
+
const t11 = "w-64 text-body-sm text-fg";
|
|
191
|
+
const t12 = hasCalendar && view === "days" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
|
|
192
|
+
className: "flex h-10 items-center justify-between px-2",
|
|
193
|
+
children: [
|
|
194
|
+
/* @__PURE__ */ jsx(Button, {
|
|
195
|
+
variant: "subtle",
|
|
196
|
+
size: "small",
|
|
197
|
+
className: "text-fg",
|
|
198
|
+
"aria-label": labels.previousMonth,
|
|
199
|
+
icon: /* @__PURE__ */ jsx(ChevronLeft, { className: "rtl:rotate-180" }),
|
|
200
|
+
onClick: () => {
|
|
201
|
+
goToMonth(-1);
|
|
202
|
+
}
|
|
203
|
+
}),
|
|
204
|
+
/* @__PURE__ */ jsx("button", {
|
|
205
|
+
type: "button",
|
|
206
|
+
"aria-label": `${monthTitle(viewMonth, locale)}. ${labels.chooseMonth}`,
|
|
207
|
+
className: "cursor-pointer rounded-sm px-2 py-1 text-body-lg font-semibold text-fg outline-none hover:bg-subtle focus-visible:ring-2 focus-visible:ring-focus",
|
|
208
|
+
onClick: () => {
|
|
209
|
+
focusNext.current = "month";
|
|
210
|
+
setView("months");
|
|
211
|
+
},
|
|
212
|
+
children: monthTitle(viewMonth, locale)
|
|
213
|
+
}),
|
|
214
|
+
/* @__PURE__ */ jsx(Button, {
|
|
215
|
+
variant: "subtle",
|
|
216
|
+
size: "small",
|
|
217
|
+
className: "text-fg",
|
|
218
|
+
"aria-label": labels.nextMonth,
|
|
219
|
+
icon: /* @__PURE__ */ jsx(ChevronRight, { className: "rtl:rotate-180" }),
|
|
220
|
+
onClick: () => {
|
|
221
|
+
goToMonth(1);
|
|
222
|
+
}
|
|
223
|
+
})
|
|
224
|
+
]
|
|
225
|
+
}), /* @__PURE__ */ jsxs("table", {
|
|
226
|
+
ref: gridRef,
|
|
227
|
+
role: "grid",
|
|
228
|
+
"aria-label": monthTitle(viewMonth, locale),
|
|
229
|
+
className: "mx-1 w-[calc(100%-0.5rem)] border-collapse",
|
|
230
|
+
onKeyDown: handleGridKeyDown,
|
|
231
|
+
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: weekdayNames(locale).map(_temp2) }) }), /* @__PURE__ */ jsx("tbody", { children: monthWeeks(viewMonth, locale).map((week) => /* @__PURE__ */ jsx("tr", { children: week.map((cell) => {
|
|
232
|
+
if (!cell.inMonth) return /* @__PURE__ */ jsx("td", {
|
|
233
|
+
"aria-hidden": "true",
|
|
234
|
+
className: "p-0"
|
|
235
|
+
}, cell.day);
|
|
236
|
+
const isSelected = parts?.day === cell.day;
|
|
237
|
+
const isFocusTarget = cell.day === focusTarget;
|
|
238
|
+
return /* @__PURE__ */ jsx("td", {
|
|
239
|
+
"aria-selected": isSelected,
|
|
240
|
+
className: "p-0 text-center",
|
|
241
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
242
|
+
type: "button",
|
|
243
|
+
"aria-label": dayLabel(cell.day, locale),
|
|
244
|
+
"aria-disabled": !isDayAllowed(cell.day, bounds),
|
|
245
|
+
tabIndex: isFocusTarget ? 0 : -1,
|
|
246
|
+
"data-day": cell.day,
|
|
247
|
+
className: DAY_BUTTON,
|
|
248
|
+
...isSelected ? { "data-selected": "" } : {},
|
|
249
|
+
...cell.day === today ? {
|
|
250
|
+
"data-today": "",
|
|
251
|
+
"aria-current": "date"
|
|
252
|
+
} : {},
|
|
253
|
+
...isFocusTarget ? {
|
|
254
|
+
"data-focus-target": "",
|
|
255
|
+
"data-initial-focus": ""
|
|
256
|
+
} : {},
|
|
257
|
+
onClick: () => {
|
|
258
|
+
pickDay(cell.day);
|
|
259
|
+
},
|
|
260
|
+
children: cell.date
|
|
261
|
+
})
|
|
262
|
+
}, cell.day);
|
|
263
|
+
}) }, week[0]?.day)) })]
|
|
264
|
+
})] }) : null;
|
|
265
|
+
const t13 = hasCalendar && view === "months" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
|
|
266
|
+
className: "flex h-10 items-center justify-between px-2",
|
|
267
|
+
children: [
|
|
268
|
+
/* @__PURE__ */ jsx(Button, {
|
|
269
|
+
variant: "subtle",
|
|
270
|
+
size: "small",
|
|
271
|
+
className: "text-fg",
|
|
272
|
+
"aria-label": labels.previousYear,
|
|
273
|
+
icon: /* @__PURE__ */ jsx(ChevronLeft, { className: "rtl:rotate-180" }),
|
|
274
|
+
onClick: () => {
|
|
275
|
+
goToMonth(-12);
|
|
276
|
+
}
|
|
277
|
+
}),
|
|
278
|
+
/* @__PURE__ */ jsx("button", {
|
|
279
|
+
type: "button",
|
|
280
|
+
"aria-label": `${yearOf(viewMonth)}. ${labels.backToCalendar}`,
|
|
281
|
+
className: "cursor-pointer rounded-sm px-2 py-1 text-body-lg font-semibold text-fg outline-none hover:bg-subtle focus-visible:ring-2 focus-visible:ring-focus",
|
|
282
|
+
onClick: () => {
|
|
283
|
+
focusNext.current = "day";
|
|
284
|
+
setView("days");
|
|
285
|
+
},
|
|
286
|
+
children: yearOf(viewMonth)
|
|
287
|
+
}),
|
|
288
|
+
/* @__PURE__ */ jsx(Button, {
|
|
289
|
+
variant: "subtle",
|
|
290
|
+
size: "small",
|
|
291
|
+
className: "text-fg",
|
|
292
|
+
"aria-label": labels.nextYear,
|
|
293
|
+
icon: /* @__PURE__ */ jsx(ChevronRight, { className: "rtl:rotate-180" }),
|
|
294
|
+
onClick: () => {
|
|
295
|
+
goToMonth(12);
|
|
296
|
+
}
|
|
297
|
+
})
|
|
298
|
+
]
|
|
299
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
300
|
+
ref: monthListRef,
|
|
301
|
+
className: "grid grid-cols-3 gap-1 px-3 pb-3 pt-1",
|
|
302
|
+
children: monthNames(locale).map((name_0, index) => {
|
|
303
|
+
const month_0 = shiftMonth(`${yearOf(viewMonth)}-01`, index);
|
|
304
|
+
return /* @__PURE__ */ jsx("button", {
|
|
305
|
+
type: "button",
|
|
306
|
+
"aria-label": name_0.long,
|
|
307
|
+
className: cn(DAY_BUTTON, "h-9"),
|
|
308
|
+
...parts?.day && monthOf(parts.day) === month_0 ? { "data-selected": "" } : {},
|
|
309
|
+
...monthOf(today) === month_0 ? {
|
|
310
|
+
"data-today": "",
|
|
311
|
+
"aria-current": "date"
|
|
312
|
+
} : {},
|
|
313
|
+
...month_0 === viewMonth ? { "data-focus-target": "" } : {},
|
|
314
|
+
onClick: () => {
|
|
315
|
+
focusNext.current = "day";
|
|
316
|
+
setViewMonth(month_0);
|
|
317
|
+
setFocusDay(`${month_0}-01`);
|
|
318
|
+
setView("days");
|
|
319
|
+
},
|
|
320
|
+
children: name_0.short
|
|
321
|
+
}, month_0);
|
|
322
|
+
})
|
|
323
|
+
})] }) : null;
|
|
324
|
+
let t14;
|
|
325
|
+
if ($[32] !== fallbackTime || $[33] !== kind || $[34] !== labels || $[35] !== parts || $[36] !== setTime || $[37] !== withSeconds) {
|
|
326
|
+
t14 = kind !== "date" ? /* @__PURE__ */ jsx(TimeSliders, {
|
|
327
|
+
time: parts?.time ?? fallbackTime,
|
|
328
|
+
withSeconds,
|
|
329
|
+
labels,
|
|
330
|
+
disabled: kind === "datetime" && parts === null,
|
|
331
|
+
focusFirst: kind === "time",
|
|
332
|
+
onChange: setTime
|
|
333
|
+
}) : null;
|
|
334
|
+
$[32] = fallbackTime;
|
|
335
|
+
$[33] = kind;
|
|
336
|
+
$[34] = labels;
|
|
337
|
+
$[35] = parts;
|
|
338
|
+
$[36] = setTime;
|
|
339
|
+
$[37] = withSeconds;
|
|
340
|
+
$[38] = t14;
|
|
341
|
+
} else t14 = $[38];
|
|
342
|
+
let t15;
|
|
343
|
+
if ($[39] !== isNowAllowed || $[40] !== kind || $[41] !== labels.now || $[42] !== labels.today || $[43] !== pickNow || $[44] !== showNow) {
|
|
344
|
+
t15 = showNow ? /* @__PURE__ */ jsx(Button, {
|
|
345
|
+
variant: "primary",
|
|
346
|
+
size: "small",
|
|
347
|
+
className: "shadow-none",
|
|
348
|
+
disabled: !isNowAllowed,
|
|
349
|
+
onClick: pickNow,
|
|
350
|
+
children: kind === "date" ? labels.today : labels.now
|
|
351
|
+
}) : null;
|
|
352
|
+
$[39] = isNowAllowed;
|
|
353
|
+
$[40] = kind;
|
|
354
|
+
$[41] = labels.now;
|
|
355
|
+
$[42] = labels.today;
|
|
356
|
+
$[43] = pickNow;
|
|
357
|
+
$[44] = showNow;
|
|
358
|
+
$[45] = t15;
|
|
359
|
+
} else t15 = $[45];
|
|
360
|
+
let t16;
|
|
361
|
+
if ($[46] !== clearable || $[47] !== isEmpty || $[48] !== labels.clear || $[49] !== onChange) {
|
|
362
|
+
t16 = clearable ? /* @__PURE__ */ jsx(Button, {
|
|
363
|
+
variant: "primary",
|
|
364
|
+
size: "small",
|
|
365
|
+
className: "shadow-none",
|
|
366
|
+
disabled: isEmpty,
|
|
367
|
+
onClick: () => {
|
|
368
|
+
onChange("");
|
|
369
|
+
},
|
|
370
|
+
children: labels.clear
|
|
371
|
+
}) : null;
|
|
372
|
+
$[46] = clearable;
|
|
373
|
+
$[47] = isEmpty;
|
|
374
|
+
$[48] = labels.clear;
|
|
375
|
+
$[49] = onChange;
|
|
376
|
+
$[50] = t16;
|
|
377
|
+
} else t16 = $[50];
|
|
378
|
+
let t17;
|
|
379
|
+
if ($[51] !== t15 || $[52] !== t16) {
|
|
380
|
+
t17 = /* @__PURE__ */ jsxs("span", {
|
|
381
|
+
className: "flex items-center gap-2",
|
|
382
|
+
children: [t15, t16]
|
|
383
|
+
});
|
|
384
|
+
$[51] = t15;
|
|
385
|
+
$[52] = t16;
|
|
386
|
+
$[53] = t17;
|
|
387
|
+
} else t17 = $[53];
|
|
388
|
+
const t18 = isEmpty && kind !== "time";
|
|
389
|
+
let t19;
|
|
390
|
+
if ($[54] !== finish || $[55] !== labels.done || $[56] !== t18) {
|
|
391
|
+
t19 = /* @__PURE__ */ jsx(Button, {
|
|
392
|
+
variant: "primary",
|
|
393
|
+
size: "small",
|
|
394
|
+
className: "shadow-none",
|
|
395
|
+
disabled: t18,
|
|
396
|
+
onClick: finish,
|
|
397
|
+
children: labels.done
|
|
398
|
+
});
|
|
399
|
+
$[54] = finish;
|
|
400
|
+
$[55] = labels.done;
|
|
401
|
+
$[56] = t18;
|
|
402
|
+
$[57] = t19;
|
|
403
|
+
} else t19 = $[57];
|
|
404
|
+
let t20;
|
|
405
|
+
if ($[58] !== t17 || $[59] !== t19) {
|
|
406
|
+
t20 = /* @__PURE__ */ jsxs("div", {
|
|
407
|
+
className: "flex items-center justify-between gap-2 px-3 pb-3 pt-2",
|
|
408
|
+
children: [t17, t19]
|
|
409
|
+
});
|
|
410
|
+
$[58] = t17;
|
|
411
|
+
$[59] = t19;
|
|
412
|
+
$[60] = t20;
|
|
413
|
+
} else t20 = $[60];
|
|
414
|
+
let t21;
|
|
415
|
+
if ($[61] !== t12 || $[62] !== t13 || $[63] !== t14 || $[64] !== t20) {
|
|
416
|
+
t21 = /* @__PURE__ */ jsxs("div", {
|
|
417
|
+
className: t11,
|
|
418
|
+
children: [
|
|
419
|
+
t12,
|
|
420
|
+
t13,
|
|
421
|
+
t14,
|
|
422
|
+
t20
|
|
423
|
+
]
|
|
424
|
+
});
|
|
425
|
+
$[61] = t12;
|
|
426
|
+
$[62] = t13;
|
|
427
|
+
$[63] = t14;
|
|
428
|
+
$[64] = t20;
|
|
429
|
+
$[65] = t21;
|
|
430
|
+
} else t21 = $[65];
|
|
431
|
+
return t21;
|
|
432
|
+
};
|
|
433
|
+
function _temp() {
|
|
434
|
+
return currentParts();
|
|
435
|
+
}
|
|
436
|
+
function _temp2(name) {
|
|
437
|
+
return /* @__PURE__ */ jsx("th", {
|
|
438
|
+
scope: "col",
|
|
439
|
+
abbr: name.long,
|
|
440
|
+
className: "h-8 text-center text-body-sm font-normal tracking-[0.1rem] text-fg",
|
|
441
|
+
children: name.narrow
|
|
442
|
+
}, name.long);
|
|
443
|
+
}
|
|
444
|
+
export { DateTimePanel };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type ReactNode, type Ref } from "react";
|
|
2
|
+
import type { Locale } from "date-fns";
|
|
3
|
+
import type { FieldSize } from "../FormField/field-types.js";
|
|
4
|
+
import { type DateTimePickerLabels } from "./picker-labels.js";
|
|
5
|
+
import { type PickerKind } from "./picker-values.js";
|
|
6
|
+
export interface DateTimePickerProps {
|
|
7
|
+
/**
|
|
8
|
+
* The value as the matching native input holds it, with no time zone: "2026-10-24" for a
|
|
9
|
+
* date, "2026-10-24T14:05" for a date and time, "14:05" for a time. Empty for none. Turning
|
|
10
|
+
* it into a moment and back is the caller's.
|
|
11
|
+
*/
|
|
12
|
+
value: string;
|
|
13
|
+
/** Called with the new value as the person picks, and with "" when they clear it. */
|
|
14
|
+
onValueChange: (value: string) => void;
|
|
15
|
+
/** A day (default), a day and a time, or a time of day. */
|
|
16
|
+
mode?: PickerKind | undefined;
|
|
17
|
+
/** Show and set the seconds as well: "14:05:09". For a date and time or a time. */
|
|
18
|
+
showSeconds?: boolean | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* The earliest and latest value, written as the value is ("2026-10-24"; a date and time may
|
|
21
|
+
* be a day alone, which is that day's first or last moment). Days outside are greyed out and
|
|
22
|
+
* cannot be picked, and a time outside becomes the nearer limit.
|
|
23
|
+
*/
|
|
24
|
+
min?: string | undefined;
|
|
25
|
+
max?: string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The time a day gets when it is picked and the value has none: "00:00" for the start of a
|
|
28
|
+
* range, "23:59" for its end. The time now if omitted. Seconds are dropped unless `showSeconds`.
|
|
29
|
+
*/
|
|
30
|
+
defaultTime?: string | undefined;
|
|
31
|
+
/** Offer Clear, which empties the value. */
|
|
32
|
+
clearable?: boolean | undefined;
|
|
33
|
+
/** Offer Today (a date) or Now. Default true. */
|
|
34
|
+
showNow?: boolean | undefined;
|
|
35
|
+
/** "dayMonth" shows a date as "24 October", for a date whose year does not matter (a season's first day). */
|
|
36
|
+
display?: "full" | "dayMonth" | undefined;
|
|
37
|
+
/** Shown while there is no value. `labels.select` if omitted. */
|
|
38
|
+
placeholder?: string | undefined;
|
|
39
|
+
/** The texts of the field and its panel, in the user's language. English if omitted. */
|
|
40
|
+
labels?: DateTimePickerLabels | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* date-fns' locale for the names of months and days and the first day of the week (Monday for `de`), such as
|
|
43
|
+
* `he` from "date-fns/locale/he". English, with weeks from Sunday, if omitted. Dates are always written day first
|
|
44
|
+
* and times in 24 hours, whatever the locale.
|
|
45
|
+
*/
|
|
46
|
+
locale?: Locale | undefined;
|
|
47
|
+
disabled?: boolean | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Draws the red border. A button cannot carry aria-invalid, so the field is announced as invalid through its
|
|
50
|
+
* message, which `aria-describedby` ties to it.
|
|
51
|
+
*/
|
|
52
|
+
invalid?: boolean | undefined;
|
|
53
|
+
size?: FieldSize | undefined;
|
|
54
|
+
/** Replaces the calendar (or, for a time, clock) glyph at the end of the field. */
|
|
55
|
+
icon?: ReactNode | undefined;
|
|
56
|
+
id?: string | undefined;
|
|
57
|
+
/** What names the field when there is no visible label. */
|
|
58
|
+
"aria-label"?: string | undefined;
|
|
59
|
+
/** The id of the element that is the field's label; the chosen value is added to the name. */
|
|
60
|
+
"aria-labelledby"?: string | undefined;
|
|
61
|
+
/** The ids of the field's message and hint, read after the name. */
|
|
62
|
+
"aria-describedby"?: string | undefined;
|
|
63
|
+
triggerRef?: Ref<HTMLButtonElement> | undefined;
|
|
64
|
+
/** The picker was left: the panel closed, or focus moved off it while closed. */
|
|
65
|
+
onBlur?: (() => void) | undefined;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A date and time picker: a read-only field with a calendar glyph that
|
|
69
|
+
* opens a panel with the month, the days, the time sliders and Today or Now, Clear and Done.
|
|
70
|
+
* It is a button, so the value is picked and never typed, and it holds its value as the plain
|
|
71
|
+
* text a native `<input type="date">` holds (see `value`), so a form's schema and the code
|
|
72
|
+
* that turns the text into a request need nothing picker-specific. For a field with a label
|
|
73
|
+
* bound to react-hook-form use FormDateTimeField.
|
|
74
|
+
*/
|
|
75
|
+
export declare const DateTimePicker: ({ value, onValueChange: onChange, mode, showSeconds, min, max, defaultTime, clearable, showNow, display, placeholder, labels, locale, disabled, invalid, size, icon, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, triggerRef, onBlur, }: DateTimePickerProps) => import("react").JSX.Element;
|