@webiny/admin-ui 0.0.0-unstable.7be00a75a9 → 0.0.0-unstable.7c2def32a7
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/Accordion/Accordion.d.ts +7 -6
- package/Accordion/Accordion.stories.d.ts +1 -1
- package/Accordion/Accordion.stories.js.map +1 -1
- package/Accordion/components/AccordionContent.js +4 -1
- package/Accordion/components/AccordionContent.js.map +1 -1
- package/Accordion/components/AccordionItem.d.ts +8 -6
- package/Accordion/components/AccordionItem.js.map +1 -1
- package/Accordion/components/AccordionItemAction.d.ts +7 -6
- package/Accordion/components/AccordionItemDragHandle.d.ts +2 -1
- package/Accordion/components/AccordionItemDragHandle.js +2 -1
- package/Accordion/components/AccordionItemDragHandle.js.map +1 -1
- package/Accordion/components/AccordionItemIcon.d.ts +7 -6
- package/Accordion/components/AccordionItemSeparator.d.ts +7 -6
- package/Accordion/components/AccordionTrigger.js +4 -2
- package/Accordion/components/AccordionTrigger.js.map +1 -1
- package/Alert/Alert.d.ts +21 -19
- package/Alert/Alert.stories.d.ts +1 -1
- package/Alert/Alert.stories.js.map +1 -1
- package/AutoComplete/AutoComplete.d.ts +7 -6
- package/AutoComplete/AutoComplete.stories.d.ts +1 -1
- package/AutoComplete/AutoComplete.stories.js.map +1 -1
- package/AutoComplete/primitives/AutoCompletePrimitive.d.ts +13 -6
- package/AutoComplete/primitives/AutoCompletePrimitive.js +1 -0
- package/AutoComplete/primitives/AutoCompletePrimitive.js.map +1 -1
- package/AutoComplete/primitives/AutoCompletePrimitive.stories.d.ts +1 -1
- package/AutoComplete/primitives/AutoCompletePrimitive.stories.js.map +1 -1
- package/Avatar/Avatar.d.ts +9 -8
- package/Avatar/Avatar.stories.d.ts +1 -1
- package/Avatar/Avatar.stories.js.map +1 -1
- package/Avatar/components/AvatarFallback.d.ts +7 -6
- package/Avatar/components/AvatarImage.d.ts +7 -6
- package/BetaBadge/BetaBadge.d.ts +6 -0
- package/BetaBadge/BetaBadge.js +7 -0
- package/BetaBadge/BetaBadge.js.map +1 -0
- package/Breadcrumbs/Breadcrumbs.d.ts +54 -0
- package/Breadcrumbs/Breadcrumbs.js +66 -0
- package/Breadcrumbs/Breadcrumbs.js.map +1 -0
- package/Breadcrumbs/Breadcrumbs.stories.d.ts +9 -0
- package/Breadcrumbs/Breadcrumbs.stories.js +71 -0
- package/Breadcrumbs/Breadcrumbs.stories.js.map +1 -0
- package/Breadcrumbs/index.d.ts +1 -0
- package/Breadcrumbs/index.js +1 -0
- package/Button/Button.d.ts +10 -9
- package/Button/Button.js +7 -0
- package/Button/Button.js.map +1 -1
- package/Button/Button.mdx +13 -0
- package/Button/Button.stories.d.ts +2 -1
- package/Button/Button.stories.js +9 -2
- package/Button/Button.stories.js.map +1 -1
- package/Button/CopyButton.d.ts +7 -6
- package/Button/IconButton.d.ts +10 -9
- package/Button/IconButton.stories.d.ts +1 -1
- package/Button/IconButton.stories.js.map +1 -1
- package/Calendar/Calendar.d.ts +7 -6
- package/Calendar/calendarClassNames.js +1 -1
- package/Calendar/calendarClassNames.js.map +1 -1
- package/Card/Card.d.ts +8 -22
- package/Card/Card.stories.d.ts +1 -1
- package/Card/Card.stories.js.map +1 -1
- package/Card/components/CancelAction.d.ts +8 -6
- package/Card/components/CardContent.d.ts +6 -6
- package/Card/components/CardTitle.d.ts +2 -2
- package/Card/components/ConfirmAction.d.ts +8 -6
- package/Card/components/Icon.d.ts +7 -6
- package/Checkbox/Checkbox.d.ts +7 -6
- package/Checkbox/Checkbox.stories.d.ts +1 -1
- package/Checkbox/Checkbox.stories.js.map +1 -1
- package/Checkbox/primitives/CheckboxPrimitive.d.ts +17 -12
- package/Checkbox/primitives/CheckboxPrimitive.stories.d.ts +1 -1
- package/Checkbox/primitives/CheckboxPrimitive.stories.js.map +1 -1
- package/CheckboxGroup/CheckboxGroup.d.ts +7 -6
- package/CheckboxGroup/CheckboxGroup.stories.d.ts +1 -1
- package/CheckboxGroup/CheckboxGroup.stories.js.map +1 -1
- package/CheckboxGroup/primitives/CheckboxGroupPrimitive.d.ts +20 -12
- package/CheckboxGroup/primitives/CheckboxGroupPrimitive.stories.d.ts +1 -1
- package/CheckboxGroup/primitives/CheckboxGroupPrimitive.stories.js.map +1 -1
- package/CodeEditor/CodeEditor.d.ts +7 -6
- package/CodeEditor/CodeEditor.stories.d.ts +1 -1
- package/CodeEditor/CodeEditor.stories.js.map +1 -1
- package/CodeEditor/CodeEditorPrimitive.d.ts +7 -6
- package/CodeEditor/CodeEditorPrimitive.js +3 -1
- package/CodeEditor/CodeEditorPrimitive.js.map +1 -1
- package/CodeEditor/CodeEditorPrimitive.stories.d.ts +1 -1
- package/CodeEditor/CodeEditorPrimitive.stories.js.map +1 -1
- package/ColorPicker/ColorPicker.d.ts +7 -6
- package/ColorPicker/ColorPicker.stories.d.ts +1 -1
- package/ColorPicker/ColorPicker.stories.js.map +1 -1
- package/ColorPicker/primitives/ColorPickerPrimitive.d.ts +7 -6
- package/ColorPicker/primitives/ColorPickerPrimitive.stories.d.ts +1 -1
- package/ColorPicker/primitives/ColorPickerPrimitive.stories.js.map +1 -1
- package/Command/Command.d.ts +10 -8
- package/Command/components/List.d.ts +1 -1
- package/Command/components/List.js +9 -5
- package/Command/components/List.js.map +1 -1
- package/DataList/DataListModal.d.ts +6 -3
- package/DataTable/DataTable.d.ts +23 -12
- package/DataTable/DataTable.js +18 -7
- package/DataTable/DataTable.js.map +1 -1
- package/DataTable/DataTable.stories.d.ts +1 -1
- package/DataTable/DataTable.stories.js.map +1 -1
- package/DataTable/components/ColumnsVisibility.d.ts +5 -4
- package/DataTable/components/ColumnsVisibility.js +7 -3
- package/DataTable/components/ColumnsVisibility.js.map +1 -1
- package/DatePicker/DatePicker.d.ts +11 -7
- package/DatePicker/DatePicker.js +10 -2
- package/DatePicker/DatePicker.js.map +1 -1
- package/DatePicker/DatePicker.stories.d.ts +11 -1
- package/DatePicker/DatePicker.stories.js +44 -1
- package/DatePicker/DatePicker.stories.js.map +1 -1
- package/DatePicker/primitives/BirthdayPicker.d.ts +13 -0
- package/DatePicker/primitives/BirthdayPicker.js +355 -0
- package/DatePicker/primitives/BirthdayPicker.js.map +1 -0
- package/DatePicker/primitives/BirthdayPickerCell.d.ts +14 -0
- package/DatePicker/primitives/BirthdayPickerCell.js +19 -0
- package/DatePicker/primitives/BirthdayPickerCell.js.map +1 -0
- package/DatePicker/primitives/BirthdayPickerSegments.d.ts +9 -0
- package/DatePicker/primitives/BirthdayPickerSegments.js +43 -0
- package/DatePicker/primitives/BirthdayPickerSegments.js.map +1 -0
- package/DatePicker/primitives/DateOnlyPicker.js +2 -2
- package/DatePicker/primitives/DateOnlyPicker.js.map +1 -1
- package/DatePicker/primitives/DatePickerPrimitive.d.ts +7 -6
- package/DatePicker/primitives/DatePickerPrimitive.js +3 -0
- package/DatePicker/primitives/DatePickerPrimitive.js.map +1 -1
- package/DatePicker/primitives/DateRangePicker.js +3 -3
- package/DatePicker/primitives/DateRangePicker.js.map +1 -1
- package/DatePicker/primitives/DateTimePicker.d.ts +1 -1
- package/DatePicker/primitives/DateTimePicker.js +26 -18
- package/DatePicker/primitives/DateTimePicker.js.map +1 -1
- package/DatePicker/primitives/MultipleDatesPicker.js +3 -3
- package/DatePicker/primitives/MultipleDatesPicker.js.map +1 -1
- package/DatePicker/primitives/components/DatePickerTrigger.js +2 -2
- package/DatePicker/primitives/components/DatePickerTrigger.js.map +1 -1
- package/DatePicker/utils/birthdayHelpers.d.ts +77 -0
- package/DatePicker/utils/birthdayHelpers.js +145 -0
- package/DatePicker/utils/birthdayHelpers.js.map +1 -0
- package/DatePicker/utils/birthdayHelpers.test.d.ts +1 -0
- package/DatePicker/utils/birthdayHelpers.test.js +394 -0
- package/DatePicker/utils/birthdayHelpers.test.js.map +1 -0
- package/DatePicker/utils/dateHelpers.d.ts +6 -1
- package/DatePicker/utils/dateHelpers.js +13 -5
- package/DatePicker/utils/dateHelpers.js.map +1 -1
- package/DatePicker/utils/dateHelpers.test.d.ts +1 -0
- package/DatePicker/utils/dateHelpers.test.js +32 -0
- package/DatePicker/utils/dateHelpers.test.js.map +1 -0
- package/DatePicker/utils/index.d.ts +1 -0
- package/DatePicker/utils/index.js +1 -0
- package/DatePicker/utils/timezoneHelpers.d.ts +3 -0
- package/DatePicker/utils/timezoneHelpers.js +32 -0
- package/DatePicker/utils/timezoneHelpers.js.map +1 -0
- package/DatePicker/utils/types.d.ts +15 -2
- package/Dialog/Dialog.d.ts +8 -22
- package/Dialog/Dialog.stories.d.ts +1 -1
- package/Dialog/Dialog.stories.js.map +1 -1
- package/Dialog/components/CancelAction.d.ts +8 -6
- package/Dialog/components/ConfirmAction.d.ts +8 -6
- package/Dialog/components/DialogContent.d.ts +1 -1
- package/Dialog/components/DialogFooter.d.ts +1 -1
- package/Dialog/components/DialogTitle.d.ts +1 -1
- package/Dialog/components/Icon.d.ts +7 -6
- package/DragCursor/DragCursor.d.ts +7 -0
- package/DragCursor/DragCursor.js +21 -0
- package/DragCursor/DragCursor.js.map +1 -0
- package/DragCursor/DragCursor.stories.d.ts +10 -0
- package/DragCursor/DragCursor.stories.js +97 -0
- package/DragCursor/DragCursor.stories.js.map +1 -0
- package/DragCursor/index.d.ts +1 -0
- package/DragCursor/index.js +1 -0
- package/Drawer/Drawer.d.ts +18 -28
- package/Drawer/Drawer.js +2 -1
- package/Drawer/Drawer.js.map +1 -1
- package/Drawer/Drawer.stories.d.ts +2 -1
- package/Drawer/Drawer.stories.js +21 -2
- package/Drawer/Drawer.stories.js.map +1 -1
- package/Drawer/components/CancelButton.d.ts +8 -6
- package/Drawer/components/ConfirmButton.d.ts +8 -6
- package/Drawer/components/DrawerContent.d.ts +1 -1
- package/Drawer/components/DrawerHeader.d.ts +2 -2
- package/Drawer/components/DrawerHeader.js +11 -8
- package/Drawer/components/DrawerHeader.js.map +1 -1
- package/Drawer/components/Icon.d.ts +7 -6
- package/Drawer/components/Icon.js +3 -4
- package/Drawer/components/Icon.js.map +1 -1
- package/DropdownMenu/DropdownMenu.stories.d.ts +1 -1
- package/DropdownMenu/DropdownMenu.stories.js.map +1 -1
- package/DropdownMenu/components/DropdownMenuItem.d.ts +8 -2
- package/DropdownMenu/components/DropdownMenuItem.js +11 -3
- package/DropdownMenu/components/DropdownMenuItem.js.map +1 -1
- package/DropdownMenu/components/DropdownMenuLink.d.ts +9 -8
- package/DropdownMenu/components/DropdownMenuSeparator.d.ts +7 -6
- package/EditableTitle/EditableTitle.d.ts +67 -0
- package/EditableTitle/EditableTitle.js +73 -0
- package/EditableTitle/EditableTitle.js.map +1 -0
- package/EditableTitle/index.d.ts +1 -0
- package/EditableTitle/index.js +1 -0
- package/EmptyState/EmptyState.d.ts +43 -0
- package/EmptyState/EmptyState.js +93 -0
- package/EmptyState/EmptyState.js.map +1 -0
- package/EmptyState/EmptyState.stories.d.ts +13 -0
- package/EmptyState/EmptyState.stories.js +136 -0
- package/EmptyState/EmptyState.stories.js.map +1 -0
- package/EmptyState/illustrations/ContentIllustration.d.ts +2 -0
- package/EmptyState/illustrations/ContentIllustration.js +100 -0
- package/EmptyState/illustrations/ContentIllustration.js.map +1 -0
- package/EmptyState/illustrations/LayoutIllustration.d.ts +2 -0
- package/EmptyState/illustrations/LayoutIllustration.js +93 -0
- package/EmptyState/illustrations/LayoutIllustration.js.map +1 -0
- package/EmptyState/illustrations/ListingIllustration.d.ts +2 -0
- package/EmptyState/illustrations/ListingIllustration.js +92 -0
- package/EmptyState/illustrations/ListingIllustration.js.map +1 -0
- package/EmptyState/illustrations/SelectIllustration.d.ts +2 -0
- package/EmptyState/illustrations/SelectIllustration.js +100 -0
- package/EmptyState/illustrations/SelectIllustration.js.map +1 -0
- package/EmptyState/illustrations/TableIllustration.d.ts +2 -0
- package/EmptyState/illustrations/TableIllustration.js +233 -0
- package/EmptyState/illustrations/TableIllustration.js.map +1 -0
- package/EmptyState/illustrations/UploadIllustration.d.ts +2 -0
- package/EmptyState/illustrations/UploadIllustration.js +77 -0
- package/EmptyState/illustrations/UploadIllustration.js.map +1 -0
- package/EmptyState/illustrations/index.d.ts +6 -0
- package/EmptyState/illustrations/index.js +6 -0
- package/EmptyState/index.d.ts +1 -0
- package/EmptyState/index.js +1 -0
- package/FilePicker/FilePicker.d.ts +19 -18
- package/FilePicker/FilePicker.stories.d.ts +7 -1
- package/FilePicker/FilePicker.stories.js +24 -1
- package/FilePicker/FilePicker.stories.js.map +1 -1
- package/FilePicker/primitives/FilePickerPrimitive.d.ts +20 -19
- package/FilePicker/primitives/FilePickerPrimitive.stories.d.ts +1 -1
- package/FilePicker/primitives/FilePickerPrimitive.stories.js.map +1 -1
- package/FilePicker/primitives/components/Trigger.d.ts +1 -1
- package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.d.ts +19 -7
- package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.js +15 -6
- package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.js.map +1 -1
- package/FilePicker/primitives/components/previews/ItemActions.js +1 -1
- package/FilePicker/primitives/components/previews/ItemActions.js.map +1 -1
- package/FilePicker/primitives/components/previews/ItemDescription.js +1 -1
- package/FilePicker/primitives/components/previews/ItemDescription.js.map +1 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/FileType.d.ts +5 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js +45 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js.map +1 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.d.ts +5 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js +14 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js.map +1 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.d.ts +12 -6
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js +54 -12
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js.map +1 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.d.ts +11 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js +8 -61
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js.map +1 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.d.ts +11 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js +24 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js.map +1 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.d.ts +10 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js +46 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js.map +1 -0
- package/FilePicker/primitives/components/previews/TextOnlyPreview/TextOnlyPreview.d.ts +7 -6
- package/FilePicker/primitives/components/previews/TruncatedFileName.d.ts +7 -0
- package/FilePicker/primitives/components/previews/TruncatedFileName.js +20 -0
- package/FilePicker/primitives/components/previews/TruncatedFileName.js.map +1 -0
- package/FilePicker/primitives/components/previews/fileName.d.ts +4 -0
- package/FilePicker/primitives/components/previews/fileName.js +26 -0
- package/FilePicker/primitives/components/previews/fileName.js.map +1 -0
- package/FilePicker/primitives/components/previews/index.d.ts +1 -0
- package/FilePicker/primitives/components/previews/index.js +1 -0
- package/FilePicker/primitives/components/previews/variants.d.ts +1 -1
- package/FillViewport/FillViewport.d.ts +63 -0
- package/FillViewport/FillViewport.js +67 -0
- package/FillViewport/FillViewport.js.map +1 -0
- package/FillViewport/index.d.ts +1 -0
- package/FillViewport/index.js +1 -0
- package/FormComponent/Description.d.ts +7 -6
- package/FormComponent/ErrorMessage.d.ts +7 -6
- package/FormComponent/Label.d.ts +7 -6
- package/FormComponent/Note.d.ts +7 -6
- package/Grid/Grid.d.ts +25 -23
- package/Grid/Grid.js.map +1 -1
- package/Grid/Grid.stories.d.ts +1 -1
- package/Grid/Grid.stories.js.map +1 -1
- package/HeaderBar/HeaderBar.d.ts +7 -6
- package/HeaderBar/HeaderBar.stories.d.ts +1 -1
- package/HeaderBar/HeaderBar.stories.js.map +1 -1
- package/Heading/Heading.d.ts +8 -7
- package/Heading/Heading.stories.d.ts +1 -1
- package/Heading/Heading.stories.js.map +1 -1
- package/Icon/Icon.d.ts +9 -8
- package/Icon/Icon.stories.d.ts +1 -1
- package/Icon/Icon.stories.js.map +1 -1
- package/IconPicker/IconPicker.d.ts +7 -6
- package/IconPicker/IconPicker.stories.d.ts +1 -1
- package/IconPicker/IconPicker.stories.js.map +1 -1
- package/IconPicker/primitives/IconPickerPrimitive.d.ts +1 -1
- package/IconPicker/primitives/IconPickerPrimitive.js +1 -2
- package/IconPicker/primitives/IconPickerPrimitive.js.map +1 -1
- package/IconPicker/primitives/IconPickerPrimitive.stories.d.ts +1 -1
- package/IconPicker/primitives/IconPickerPrimitive.stories.js.map +1 -1
- package/IconPicker/primitives/components/IconPickerTrigger.d.ts +1 -1
- package/ImageEditor/AspectRatioPreview.d.ts +16 -0
- package/ImageEditor/AspectRatioPreview.js +26 -0
- package/ImageEditor/AspectRatioPreview.js.map +1 -0
- package/ImageEditor/CropHotspotEditor.d.ts +22 -0
- package/ImageEditor/CropHotspotEditor.js +402 -0
- package/ImageEditor/CropHotspotEditor.js.map +1 -0
- package/ImageEditor/ImageEditor.d.ts +18 -0
- package/ImageEditor/ImageEditor.js +151 -0
- package/ImageEditor/ImageEditor.js.map +1 -0
- package/ImageEditor/ImageEditor.stories.d.ts +6 -0
- package/ImageEditor/ImageEditor.stories.js +42 -0
- package/ImageEditor/ImageEditor.stories.js.map +1 -0
- package/ImageEditor/MetaFields.d.ts +12 -0
- package/ImageEditor/MetaFields.js +20 -0
- package/ImageEditor/MetaFields.js.map +1 -0
- package/ImageEditor/SectionLabel.d.ts +8 -0
- package/ImageEditor/SectionLabel.js +7 -0
- package/ImageEditor/SectionLabel.js.map +1 -0
- package/ImageEditor/geometry.d.ts +46 -0
- package/ImageEditor/geometry.js +126 -0
- package/ImageEditor/geometry.js.map +1 -0
- package/ImageEditor/index.d.ts +3 -0
- package/ImageEditor/index.js +3 -0
- package/ImageEditor/types.d.ts +52 -0
- package/ImageEditor/types.js +35 -0
- package/ImageEditor/types.js.map +1 -0
- package/Input/Input.d.ts +7 -6
- package/Input/Input.stories.d.ts +1 -1
- package/Input/Input.stories.js.map +1 -1
- package/Input/InputPrimitive.d.ts +9 -8
- package/Input/InputPrimitive.stories.d.ts +1 -1
- package/Input/InputPrimitive.stories.js.map +1 -1
- package/Label/Label.d.ts +8 -7
- package/Label/Label.stories.d.ts +1 -1
- package/Label/Label.stories.js.map +1 -1
- package/Label/components/LabelValue.d.ts +1 -1
- package/Link/Link.d.ts +3 -3
- package/Link/Link.js +1 -1
- package/Link/Link.js.map +1 -1
- package/Link/Link.stories.d.ts +1 -1
- package/Link/Link.stories.js.map +1 -1
- package/List/List.d.ts +8 -7
- package/List/List.stories.d.ts +1 -1
- package/List/List.stories.js.map +1 -1
- package/List/components/ListItem.d.ts +7 -6
- package/List/components/ListItemAction.d.ts +7 -6
- package/List/components/ListItemHandle.d.ts +7 -6
- package/List/components/ListItemIcon.d.ts +7 -6
- package/List/components/ListItemSeparator.d.ts +7 -6
- package/Loader/Loader.d.ts +9 -8
- package/Loader/Loader.stories.d.ts +1 -1
- package/Loader/Loader.stories.js.map +1 -1
- package/Loader/OverlayLoader.d.ts +7 -6
- package/Loader/OverlayLoader.stories.d.ts +1 -1
- package/Loader/OverlayLoader.stories.js.map +1 -1
- package/Markdown/Markdown.d.ts +47 -0
- package/Markdown/Markdown.js +17 -0
- package/Markdown/Markdown.js.map +1 -0
- package/Markdown/index.d.ts +1 -0
- package/Markdown/index.js +1 -0
- package/MultiAutoComplete/MultiAutoComplete.d.ts +7 -6
- package/MultiAutoComplete/MultiAutoComplete.stories.d.ts +1 -1
- package/MultiAutoComplete/MultiAutoComplete.stories.js.map +1 -1
- package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.d.ts +13 -6
- package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js +1 -0
- package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js.map +1 -1
- package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.stories.d.ts +1 -1
- package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.stories.js.map +1 -1
- package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenterWithFreeInput.d.ts +3 -3
- package/MultiAutoComplete/primitives/useMultiAutoComplete.d.ts +3 -3
- package/MultiFilePicker/MultiFilePicker.d.ts +19 -18
- package/MultiFilePicker/MultiFilePicker.stories.d.ts +1 -1
- package/MultiFilePicker/MultiFilePicker.stories.js.map +1 -1
- package/MultiFilePicker/primitives/MultiFilePickerPrimitive.d.ts +19 -18
- package/MultiFilePicker/primitives/MultiFilePickerPrimitive.stories.d.ts +1 -1
- package/MultiFilePicker/primitives/MultiFilePickerPrimitive.stories.js.map +1 -1
- package/MultiSelect/MultiSelect.d.ts +7 -6
- package/MultiSelect/MultiSelect.stories.d.ts +1 -1
- package/MultiSelect/MultiSelect.stories.js.map +1 -1
- package/MultiSelect/primitives/MultiSelectPrimitive.d.ts +10 -6
- package/MultiSelect/primitives/MultiSelectPrimitive.js +12 -5
- package/MultiSelect/primitives/MultiSelectPrimitive.js.map +1 -1
- package/Popover/Popover.d.ts +7 -6
- package/Popover/Popover.stories.d.ts +8 -1
- package/Popover/Popover.stories.js +24 -1
- package/Popover/Popover.stories.js.map +1 -1
- package/Popover/primitives/PopoverPrimitive.d.ts +7 -7
- package/Popover/primitives/components/PopoverContent.js +6 -1
- package/Popover/primitives/components/PopoverContent.js.map +1 -1
- package/ProgressBar/ProgressBar.d.ts +7 -6
- package/ProgressBar/ProgressBar.stories.d.ts +1 -1
- package/ProgressBar/ProgressBar.stories.js.map +1 -1
- package/RadioGroup/RadioGroup.d.ts +7 -6
- package/RadioGroup/RadioGroup.stories.d.ts +1 -1
- package/RadioGroup/RadioGroup.stories.js.map +1 -1
- package/RadioGroup/primitives/Radio.d.ts +7 -6
- package/RadioGroup/primitives/RadioGroupPrimitive.d.ts +5 -1
- package/RadioGroup/primitives/RadioGroupPrimitive.stories.d.ts +1 -1
- package/RadioGroup/primitives/RadioGroupPrimitive.stories.js.map +1 -1
- package/RangeSlider/RangeSlider.d.ts +7 -6
- package/RangeSlider/RangeSlider.stories.d.ts +1 -1
- package/RangeSlider/RangeSlider.stories.js.map +1 -1
- package/RangeSlider/primitives/RangeSliderPrimitive.stories.d.ts +1 -1
- package/RangeSlider/primitives/RangeSliderPrimitive.stories.js.map +1 -1
- package/ScrollArea/ScrollArea.d.ts +16 -2
- package/ScrollArea/ScrollArea.js +25 -11
- package/ScrollArea/ScrollArea.js.map +1 -1
- package/ScrollArea/ScrollArea.stories.d.ts +1 -1
- package/ScrollArea/ScrollArea.stories.js.map +1 -1
- package/SegmentedControl/SegmentedControl.d.ts +11 -6
- package/SegmentedControl/SegmentedControl.js +6 -2
- package/SegmentedControl/SegmentedControl.js.map +1 -1
- package/SegmentedControl/SegmentedControl.stories.d.ts +5 -1
- package/SegmentedControl/SegmentedControl.stories.js +100 -2
- package/SegmentedControl/SegmentedControl.stories.js.map +1 -1
- package/SegmentedControl/SegmentedControlTab.d.ts +10 -0
- package/SegmentedControl/SegmentedControlTab.js +21 -0
- package/SegmentedControl/SegmentedControlTab.js.map +1 -0
- package/SegmentedControl/SegmentedControlTabs.d.ts +14 -0
- package/SegmentedControl/SegmentedControlTabs.js +71 -0
- package/SegmentedControl/SegmentedControlTabs.js.map +1 -0
- package/SegmentedControl/SegmentedControlTabsContext.d.ts +19 -0
- package/SegmentedControl/SegmentedControlTabsContext.js +11 -0
- package/SegmentedControl/SegmentedControlTabsContext.js.map +1 -0
- package/SegmentedControl/index.d.ts +2 -0
- package/SegmentedControl/index.js +2 -0
- package/SegmentedControl/primitives/SegmentedControlPrimitive.d.ts +6 -2
- package/SegmentedControl/primitives/SegmentedControlPrimitive.js +4 -3
- package/SegmentedControl/primitives/SegmentedControlPrimitive.js.map +1 -1
- package/SegmentedControl/primitives/SegmentedControlPrimitive.stories.d.ts +2 -1
- package/SegmentedControl/primitives/SegmentedControlPrimitive.stories.js +8 -1
- package/SegmentedControl/primitives/SegmentedControlPrimitive.stories.js.map +1 -1
- package/Select/Select.d.ts +7 -6
- package/Select/Select.stories.d.ts +1 -1
- package/Select/Select.stories.js.map +1 -1
- package/Select/primitives/SelectPrimitive.stories.d.ts +1 -1
- package/Select/primitives/SelectPrimitive.stories.js.map +1 -1
- package/Select/primitives/components/SelectContent.js +4 -6
- package/Select/primitives/components/SelectContent.js.map +1 -1
- package/Select/primitives/components/SelectTrigger.d.ts +2 -2
- package/Separator/Separator.d.ts +9 -8
- package/Separator/Separator.stories.d.ts +1 -1
- package/Separator/Separator.stories.js.map +1 -1
- package/Sidebar/Sidebar.d.ts +9 -6
- package/Sidebar/Sidebar.stories.d.ts +1 -1
- package/Sidebar/Sidebar.stories.js.map +1 -1
- package/Sidebar/components/SidebarContent.js +1 -1
- package/Sidebar/components/SidebarContent.js.map +1 -1
- package/Sidebar/components/SidebarIcon.d.ts +7 -6
- package/Sidebar/components/SidebarProvider.d.ts +4 -4
- package/Sidebar/components/SidebarRoot.js +1 -1
- package/Sidebar/components/SidebarRoot.js.map +1 -1
- package/Sidebar/components/items/SidebarMenuGroup.d.ts +9 -8
- package/Sidebar/components/items/SidebarMenuItem.d.ts +13 -9
- package/Sidebar/components/items/SidebarMenuItem.js +3 -1
- package/Sidebar/components/items/SidebarMenuItem.js.map +1 -1
- package/Sidebar/components/items/SidebarMenuItemBadge.d.ts +6 -0
- package/Sidebar/components/items/SidebarMenuItemBadge.js +7 -0
- package/Sidebar/components/items/SidebarMenuItemBadge.js.map +1 -0
- package/Sidebar/components/items/SidebarMenuItemIcon.d.ts +7 -6
- package/Sidebar/components/items/SidebarMenuLink.d.ts +12 -9
- package/Sidebar/components/items/SidebarMenuLink.js +3 -1
- package/Sidebar/components/items/SidebarMenuLink.js.map +1 -1
- package/Sidebar/components/items/SidebarMenuProvider.d.ts +4 -4
- package/Sidebar/components/items/SidebarMenuRootButton.d.ts +1 -1
- package/Sidebar/components/items/SidebarMenuRootButton.js +8 -3
- package/Sidebar/components/items/SidebarMenuRootButton.js.map +1 -1
- package/Sidebar/components/items/SidebarMenuRootItem.d.ts +9 -7
- package/Sidebar/components/items/SidebarMenuSubButton.d.ts +1 -1
- package/Sidebar/components/items/SidebarMenuSubButton.js +14 -6
- package/Sidebar/components/items/SidebarMenuSubButton.js.map +1 -1
- package/Sidebar/components/items/SidebarMenuSubItem.js +3 -3
- package/Sidebar/components/items/SidebarMenuSubItem.js.map +1 -1
- package/Sidebar/components/items/SidebarMenuSubItemIndentation.js +2 -1
- package/Sidebar/components/items/SidebarMenuSubItemIndentation.js.map +1 -1
- package/Skeleton/Skeleton.d.ts +9 -7
- package/Skeleton/Skeleton.js +10 -4
- package/Skeleton/Skeleton.js.map +1 -1
- package/Skeleton/Skeleton.stories.d.ts +3 -1
- package/Skeleton/Skeleton.stories.js +28 -2
- package/Skeleton/Skeleton.stories.js.map +1 -1
- package/Slider/Slider.d.ts +7 -6
- package/Slider/Slider.stories.d.ts +1 -1
- package/Slider/Slider.stories.js.map +1 -1
- package/Slider/primitives/SliderPrimitive.stories.d.ts +1 -1
- package/Slider/primitives/SliderPrimitive.stories.js.map +1 -1
- package/SteppedProgress/SteppedProgress.d.ts +7 -6
- package/SteppedProgress/SteppedProgress.stories.d.ts +1 -1
- package/SteppedProgress/SteppedProgress.stories.js.map +1 -1
- package/SteppedProgress/SteppedProgressItem.d.ts +7 -6
- package/Switch/Switch.d.ts +10 -9
- package/Switch/Switch.js +21 -7
- package/Switch/Switch.js.map +1 -1
- package/Switch/Switch.stories.d.ts +1 -1
- package/Switch/Switch.stories.js.map +1 -1
- package/Switch/domains/SwitchItemDto.d.ts +1 -1
- package/Switch/primitives/SwitchPrimitive.d.ts +10 -6
- package/Switch/primitives/SwitchPrimitive.js +4 -3
- package/Switch/primitives/SwitchPrimitive.js.map +1 -1
- package/Switch/primitives/SwitchPrimitive.stories.d.ts +1 -1
- package/Switch/primitives/SwitchPrimitive.stories.js.map +1 -1
- package/Table/Table.d.ts +12 -10
- package/Table/components/Direction.d.ts +1 -1
- package/Tabs/Tabs.d.ts +14 -7
- package/Tabs/Tabs.js +32 -11
- package/Tabs/Tabs.js.map +1 -1
- package/Tabs/Tabs.mdx +27 -0
- package/Tabs/Tabs.stories.d.ts +2 -1
- package/Tabs/Tabs.stories.js +19 -1
- package/Tabs/Tabs.stories.js.map +1 -1
- package/Tabs/components/Content.d.ts +1 -1
- package/Tabs/components/List.d.ts +2 -2
- package/Tabs/components/Tab.d.ts +7 -6
- package/Tabs/components/Trigger.d.ts +3 -2
- package/Tabs/components/Trigger.js +8 -3
- package/Tabs/components/Trigger.js.map +1 -1
- package/Tag/Tag.d.ts +8 -7
- package/Tag/Tag.stories.d.ts +1 -1
- package/Tag/Tag.stories.js.map +1 -1
- package/Tags/Tags.d.ts +7 -6
- package/Tags/Tags.stories.d.ts +1 -1
- package/Tags/Tags.stories.js.map +1 -1
- package/Tags/primitives/TagsPrimitive.d.ts +7 -6
- package/Tags/primitives/TagsPrimitive.stories.d.ts +1 -1
- package/Tags/primitives/TagsPrimitive.stories.js.map +1 -1
- package/Text/Text.d.ts +8 -7
- package/Text/Text.stories.d.ts +1 -1
- package/Text/Text.stories.js.map +1 -1
- package/Textarea/Textarea.d.ts +7 -6
- package/Textarea/Textarea.stories.d.ts +1 -1
- package/Textarea/Textarea.stories.js.map +1 -1
- package/Textarea/TextareaPrimitive.d.ts +9 -8
- package/Textarea/TextareaPrimitive.stories.d.ts +1 -1
- package/Textarea/TextareaPrimitive.stories.js.map +1 -1
- package/TimeAgo/TimeAgo.stories.d.ts +1 -1
- package/TimeAgo/TimeAgo.stories.js.map +1 -1
- package/TimeAgo/getElapsedSeconds.js +3 -3
- package/TimeAgo/getElapsedSeconds.js.map +1 -1
- package/Toast/Toast.d.ts +7 -6
- package/Toast/components/ToastActions.d.ts +7 -6
- package/Toast/components/ToastDescription.d.ts +7 -6
- package/Toast/components/ToastTitle.d.ts +7 -6
- package/Toast/useToast.stories.d.ts +1 -1
- package/Toast/useToast.stories.js.map +1 -1
- package/Toggle/Toggle.d.ts +7 -6
- package/Toggle/Toggle.stories.d.ts +1 -1
- package/Toggle/Toggle.stories.js.map +1 -1
- package/Toggle/primitives/TogglePrimitive.d.ts +13 -9
- package/Toggle/primitives/TogglePrimitive.stories.d.ts +1 -1
- package/Toggle/primitives/TogglePrimitive.stories.js.map +1 -1
- package/ToggleGroup/ToggleGroup.d.ts +7 -6
- package/ToggleGroup/ToggleGroup.stories.d.ts +1 -1
- package/ToggleGroup/ToggleGroup.stories.js.map +1 -1
- package/ToggleGroup/domains/ToggleGroupItem.d.ts +3 -0
- package/ToggleGroup/domains/ToggleGroupItem.js +6 -1
- package/ToggleGroup/domains/ToggleGroupItem.js.map +1 -1
- package/ToggleGroup/domains/ToggleGroupItemFormatted.d.ts +1 -0
- package/ToggleGroup/domains/ToggleGroupItemFormatter.js +2 -1
- package/ToggleGroup/domains/ToggleGroupItemFormatter.js.map +1 -1
- package/ToggleGroup/domains/ToggleGroupItemParams.d.ts +1 -0
- package/ToggleGroup/primitives/ToggleGroupPrimitive.d.ts +13 -9
- package/ToggleGroup/primitives/ToggleGroupPrimitive.js +12 -3
- package/ToggleGroup/primitives/ToggleGroupPrimitive.js.map +1 -1
- package/ToggleGroup/primitives/ToggleGroupPrimitive.stories.d.ts +1 -1
- package/ToggleGroup/primitives/ToggleGroupPrimitive.stories.js.map +1 -1
- package/Tooltip/Tooltip.d.ts +7 -6
- package/Tooltip/Tooltip.stories.d.ts +1 -1
- package/Tooltip/Tooltip.stories.js.map +1 -1
- package/Tree/Tree.d.ts +7 -6
- package/Tree/Tree.stories.d.ts +1 -1
- package/Tree/Tree.stories.js.map +1 -1
- package/Tree/components/Item.d.ts +7 -6
- package/Tree/components/ItemCollapseTrigger.d.ts +7 -6
- package/Tree/components/ItemContent.d.ts +8 -6
- package/Tree/components/ItemDragHandle.d.ts +7 -6
- package/Tree/components/ItemIcon.d.ts +7 -6
- package/Tree/components/ItemPlaceholder.d.ts +7 -6
- package/Tree/components/ItemSubIndentation.d.ts +7 -6
- package/Tree/useTree.js +6 -2
- package/Tree/useTree.js.map +1 -1
- package/Widget/Widget.d.ts +8 -22
- package/Widget/Widget.stories.d.ts +1 -1
- package/Widget/Widget.stories.js.map +1 -1
- package/Widget/components/Icon.d.ts +7 -6
- package/Widget/components/WidgetAction.d.ts +8 -6
- package/Widget/components/WidgetContent.d.ts +5 -5
- package/exports/admin/ui.d.ts +3 -0
- package/exports/admin/ui.js +3 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +1 -0
- package/hooks/useEscapeScrollLock.d.ts +13 -0
- package/hooks/useEscapeScrollLock.js +21 -0
- package/hooks/useEscapeScrollLock.js.map +1 -0
- package/index.d.ts +8 -0
- package/index.js +8 -0
- package/package.json +33 -35
- package/theme.css +52 -0
- package/utils.js +53 -34
- package/utils.js.map +1 -1
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
const DEFAULT_BIRTHDAY_YEARS_BACK = 120;
|
|
2
|
+
const ALL_MONTHS = Array.from({
|
|
3
|
+
length: 12
|
|
4
|
+
}, (_, index)=>index + 1);
|
|
5
|
+
function parseBirthdayValue(value) {
|
|
6
|
+
if (!value) return {};
|
|
7
|
+
const match = String(value).match(/^(\d{4})-(\d{2})-(\d{2})/);
|
|
8
|
+
if (!match) return {};
|
|
9
|
+
const year = Number(match[1]);
|
|
10
|
+
const month = Number(match[2]);
|
|
11
|
+
const day = Number(match[3]);
|
|
12
|
+
if (month < 1 || month > 12 || day < 1 || day > daysInMonth(month, year)) return {};
|
|
13
|
+
return {
|
|
14
|
+
day,
|
|
15
|
+
month,
|
|
16
|
+
year
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function formatBirthdayValue(parts) {
|
|
20
|
+
const { day, month, year } = parts;
|
|
21
|
+
if (void 0 === day || void 0 === month || void 0 === year) return;
|
|
22
|
+
return `${String(year).padStart(4, "0")}-${pad(month)}-${pad(day)}`;
|
|
23
|
+
}
|
|
24
|
+
function pad(value) {
|
|
25
|
+
return String(value).padStart(2, "0");
|
|
26
|
+
}
|
|
27
|
+
function isLeapYear(year) {
|
|
28
|
+
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
|
29
|
+
}
|
|
30
|
+
function daysInMonth(month, year) {
|
|
31
|
+
if (2 === month) return void 0 === year || isLeapYear(year) ? 29 : 28;
|
|
32
|
+
return [
|
|
33
|
+
4,
|
|
34
|
+
6,
|
|
35
|
+
9,
|
|
36
|
+
11
|
|
37
|
+
].includes(month) ? 30 : 31;
|
|
38
|
+
}
|
|
39
|
+
function dateKey(year, month, day) {
|
|
40
|
+
return 10000 * year + 100 * month + day;
|
|
41
|
+
}
|
|
42
|
+
function limitKey(date, open) {
|
|
43
|
+
if (!date || isNaN(date.getTime())) return open;
|
|
44
|
+
return dateKey(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
45
|
+
}
|
|
46
|
+
function limitYear(date) {
|
|
47
|
+
return date && !isNaN(date.getTime()) ? date.getFullYear() : void 0;
|
|
48
|
+
}
|
|
49
|
+
function isInBirthdayRange(parts, range) {
|
|
50
|
+
const min = limitKey(range.minDate, -1 / 0);
|
|
51
|
+
const max = limitKey(range.maxDate, 1 / 0);
|
|
52
|
+
const years = void 0 !== parts.year ? [
|
|
53
|
+
parts.year
|
|
54
|
+
] : range.years;
|
|
55
|
+
const months = void 0 !== parts.month ? [
|
|
56
|
+
parts.month
|
|
57
|
+
] : ALL_MONTHS;
|
|
58
|
+
for (const year of years)if (!(dateKey(year, 12, 31) < min || dateKey(year, 1, 1) > max)) for (const month of months){
|
|
59
|
+
const last = daysInMonth(month, year);
|
|
60
|
+
const first = parts.day ?? 1;
|
|
61
|
+
const final = parts.day ?? last;
|
|
62
|
+
if (!(final > last)) {
|
|
63
|
+
if (dateKey(year, month, final) >= min && dateKey(year, month, first) <= max) return true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
function isDayDisabled(day, range) {
|
|
69
|
+
return void 0 !== range && !isInBirthdayRange({
|
|
70
|
+
day
|
|
71
|
+
}, range);
|
|
72
|
+
}
|
|
73
|
+
function isMonthDisabled(month, parts, range) {
|
|
74
|
+
if (void 0 !== parts.day && parts.day > daysInMonth(month)) return true;
|
|
75
|
+
return void 0 !== range && !isInBirthdayRange({
|
|
76
|
+
day: parts.day,
|
|
77
|
+
month
|
|
78
|
+
}, range);
|
|
79
|
+
}
|
|
80
|
+
function isYearDisabled(year, parts, range) {
|
|
81
|
+
if (void 0 !== parts.day && void 0 !== parts.month && parts.day > daysInMonth(parts.month, year)) return true;
|
|
82
|
+
return void 0 !== range && !isInBirthdayRange({
|
|
83
|
+
day: parts.day,
|
|
84
|
+
month: parts.month,
|
|
85
|
+
year
|
|
86
|
+
}, range);
|
|
87
|
+
}
|
|
88
|
+
function pickDay(parts, day, range) {
|
|
89
|
+
const next = {
|
|
90
|
+
...parts,
|
|
91
|
+
day
|
|
92
|
+
};
|
|
93
|
+
if (void 0 !== next.month && isMonthDisabled(next.month, next, range)) next.month = void 0;
|
|
94
|
+
if (void 0 !== next.year && isYearDisabled(next.year, next, range)) next.year = void 0;
|
|
95
|
+
return next;
|
|
96
|
+
}
|
|
97
|
+
function pickMonth(parts, month, range) {
|
|
98
|
+
const next = {
|
|
99
|
+
...parts,
|
|
100
|
+
month
|
|
101
|
+
};
|
|
102
|
+
if (void 0 !== next.year && isYearDisabled(next.year, next, range)) next.year = void 0;
|
|
103
|
+
return next;
|
|
104
|
+
}
|
|
105
|
+
function pickYear(parts, year) {
|
|
106
|
+
return {
|
|
107
|
+
...parts,
|
|
108
|
+
year
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
const BIRTHDAY_STEPS = [
|
|
112
|
+
"day",
|
|
113
|
+
"month",
|
|
114
|
+
"year"
|
|
115
|
+
];
|
|
116
|
+
function nextBirthdayStep(parts, current, picked) {
|
|
117
|
+
const missing = BIRTHDAY_STEPS.find((step)=>void 0 === parts[step]);
|
|
118
|
+
if (missing) return missing;
|
|
119
|
+
return BIRTHDAY_STEPS.slice(BIRTHDAY_STEPS.indexOf(current) + 1).find((step)=>!picked.has(step));
|
|
120
|
+
}
|
|
121
|
+
function birthdayYears(yearRange, includeYear, limits) {
|
|
122
|
+
const [from, to] = yearRange ?? defaultBirthdayYearRange(limits);
|
|
123
|
+
let start = Math.min(from, to);
|
|
124
|
+
let end = Math.max(from, to);
|
|
125
|
+
if (void 0 !== includeYear) {
|
|
126
|
+
start = Math.min(start, includeYear);
|
|
127
|
+
end = Math.max(end, includeYear);
|
|
128
|
+
}
|
|
129
|
+
const years = [];
|
|
130
|
+
for(let year = end; year >= start; year--)years.push(year);
|
|
131
|
+
return years;
|
|
132
|
+
}
|
|
133
|
+
function defaultBirthdayYearRange(limits) {
|
|
134
|
+
const minYear = limitYear(limits?.minDate);
|
|
135
|
+
const maxYear = limitYear(limits?.maxDate);
|
|
136
|
+
const to = maxYear ?? Math.max(new Date().getFullYear(), minYear ?? -1 / 0);
|
|
137
|
+
const from = minYear ?? to - DEFAULT_BIRTHDAY_YEARS_BACK;
|
|
138
|
+
return [
|
|
139
|
+
from,
|
|
140
|
+
to
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
export { DEFAULT_BIRTHDAY_YEARS_BACK, birthdayYears, daysInMonth, formatBirthdayValue, isDayDisabled, isInBirthdayRange, isLeapYear, isMonthDisabled, isYearDisabled, nextBirthdayStep, pad, parseBirthdayValue, pickDay, pickMonth, pickYear };
|
|
144
|
+
|
|
145
|
+
//# sourceMappingURL=birthdayHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker/utils/birthdayHelpers.js","sources":["../../../src/DatePicker/utils/birthdayHelpers.ts"],"sourcesContent":["/**\n * Logic for the step-by-step birthday picker: the date is picked as day, then month, then year.\n * Months are 1-based throughout (1 = January).\n */\n\nexport interface BirthdayParts {\n day?: number;\n month?: number;\n year?: number;\n}\n\nexport type BirthdayStep = \"day\" | \"month\" | \"year\";\n\nexport const DEFAULT_BIRTHDAY_YEARS_BACK = 120;\n\n/** The first and last date the picker may produce. Either may be left open. */\nexport interface BirthdayLimits {\n minDate?: Date;\n maxDate?: Date;\n}\n\n/** The dates the picker may produce: one of the offered years, within the limits. */\nexport interface BirthdayRange extends BirthdayLimits {\n years: number[];\n}\n\nconst ALL_MONTHS = Array.from({ length: 12 }, (_, index) => index + 1);\n\n/**\n * Reads the day, month and year from a `YYYY-MM-DD` value. A value that carries a time\n * (`2026-05-01T00:00:00.000Z`) still yields its date part. Anything else yields no parts.\n */\nexport function parseBirthdayValue(value: string | undefined | null): BirthdayParts {\n if (!value) {\n return {};\n }\n const match = String(value).match(/^(\\d{4})-(\\d{2})-(\\d{2})/);\n if (!match) {\n return {};\n }\n const year = Number(match[1]);\n const month = Number(match[2]);\n const day = Number(match[3]);\n if (month < 1 || month > 12 || day < 1 || day > daysInMonth(month, year)) {\n return {};\n }\n return { day, month, year };\n}\n\n/**\n * Returns the `YYYY-MM-DD` value, or `undefined` while any part is still missing.\n */\nexport function formatBirthdayValue(parts: BirthdayParts): string | undefined {\n const { day, month, year } = parts;\n if (day === undefined || month === undefined || year === undefined) {\n return undefined;\n }\n return `${String(year).padStart(4, \"0\")}-${pad(month)}-${pad(day)}`;\n}\n\nexport function pad(value: number): string {\n return String(value).padStart(2, \"0\");\n}\n\nexport function isLeapYear(year: number): boolean {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n}\n\n/**\n * Days in a month. Without a year, February counts 29 days, because the year is picked\n * after the month and a leap year may still be chosen.\n */\nexport function daysInMonth(month: number, year?: number): number {\n if (month === 2) {\n return year === undefined || isLeapYear(year) ? 29 : 28;\n }\n return [4, 6, 9, 11].includes(month) ? 30 : 31;\n}\n\nfunction dateKey(year: number, month: number, day: number): number {\n return year * 10000 + month * 100 + day;\n}\n\n/** The calendar day of a limit, in local time, the same day the calendar picker compares. */\nfunction limitKey(date: Date | undefined, open: number): number {\n if (!date || isNaN(date.getTime())) {\n return open;\n }\n return dateKey(date.getFullYear(), date.getMonth() + 1, date.getDate());\n}\n\nfunction limitYear(date: Date | undefined): number | undefined {\n return date && !isNaN(date.getTime()) ? date.getFullYear() : undefined;\n}\n\n/**\n * Whether the range holds a date with every part set in `parts`. An unset year is looked\n * for among the offered years; an unset month or day can be any.\n */\nexport function isInBirthdayRange(parts: BirthdayParts, range: BirthdayRange): boolean {\n const min = limitKey(range.minDate, -Infinity);\n const max = limitKey(range.maxDate, Infinity);\n const years = parts.year !== undefined ? [parts.year] : range.years;\n const months = parts.month !== undefined ? [parts.month] : ALL_MONTHS;\n for (const year of years) {\n if (dateKey(year, 12, 31) < min || dateKey(year, 1, 1) > max) {\n continue;\n }\n for (const month of months) {\n const last = daysInMonth(month, year);\n const first = parts.day ?? 1;\n const final = parts.day ?? last;\n if (final > last) {\n continue;\n }\n if (dateKey(year, month, final) >= min && dateKey(year, month, first) <= max) {\n return true;\n }\n }\n }\n return false;\n}\n\n/** A day is unavailable when no date in the range falls on it. */\nexport function isDayDisabled(day: number, range?: BirthdayRange): boolean {\n return range !== undefined && !isInBirthdayRange({ day }, range);\n}\n\n/**\n * A month is unavailable when it can't hold the chosen day (31 rules out the 30-day months\n * and February), or when no date in the range has the chosen day in that month.\n */\nexport function isMonthDisabled(\n month: number,\n parts: BirthdayParts,\n range?: BirthdayRange\n): boolean {\n if (parts.day !== undefined && parts.day > daysInMonth(month)) {\n return true;\n }\n return range !== undefined && !isInBirthdayRange({ day: parts.day, month }, range);\n}\n\n/**\n * A year is unavailable when it can't hold the chosen day and month (29 February in a\n * non-leap year), or when the date it makes falls outside the range.\n */\nexport function isYearDisabled(year: number, parts: BirthdayParts, range?: BirthdayRange): boolean {\n if (\n parts.day !== undefined &&\n parts.month !== undefined &&\n parts.day > daysInMonth(parts.month, year)\n ) {\n return true;\n }\n return (\n range !== undefined &&\n !isInBirthdayRange({ day: parts.day, month: parts.month, year }, range)\n );\n}\n\n/**\n * Picking a day clears whatever comes after it that can no longer hold it: the month when\n * the month is too short or the range has no such date, otherwise the year when only the\n * year is the problem (29 February, or a date past a limit).\n */\nexport function pickDay(parts: BirthdayParts, day: number, range?: BirthdayRange): BirthdayParts {\n const next: BirthdayParts = { ...parts, day };\n if (next.month !== undefined && isMonthDisabled(next.month, next, range)) {\n next.month = undefined;\n }\n if (next.year !== undefined && isYearDisabled(next.year, next, range)) {\n next.year = undefined;\n }\n return next;\n}\n\n/**\n * Picking a month keeps the day (only months that hold it can be picked) and clears the\n * year when that year can't hold the date.\n */\nexport function pickMonth(\n parts: BirthdayParts,\n month: number,\n range?: BirthdayRange\n): BirthdayParts {\n const next: BirthdayParts = { ...parts, month };\n if (next.year !== undefined && isYearDisabled(next.year, next, range)) {\n next.year = undefined;\n }\n return next;\n}\n\nexport function pickYear(parts: BirthdayParts, year: number): BirthdayParts {\n return { ...parts, year };\n}\n\nconst BIRTHDAY_STEPS: BirthdayStep[] = [\"day\", \"month\", \"year\"];\n\n/**\n * The step to show after a pick, or `undefined` when the picker should close. A missing part\n * comes first. Once the date is complete, the picker walks on to the steps after `current`\n * that weren't picked while it was open, so editing a saved date still goes day, month, year.\n */\nexport function nextBirthdayStep(\n parts: BirthdayParts,\n current: BirthdayStep,\n picked: ReadonlySet<BirthdayStep>\n): BirthdayStep | undefined {\n const missing = BIRTHDAY_STEPS.find(step => parts[step] === undefined);\n if (missing) {\n return missing;\n }\n return BIRTHDAY_STEPS.slice(BIRTHDAY_STEPS.indexOf(current) + 1).find(\n step => !picked.has(step)\n );\n}\n\n/**\n * The years to offer, newest first. The default runs from this year back\n * `DEFAULT_BIRTHDAY_YEARS_BACK` years, moved and cut to fit the limits. A year already set\n * outside the range is added, so an existing value is never hidden.\n */\nexport function birthdayYears(\n yearRange?: [number, number],\n includeYear?: number,\n limits?: BirthdayLimits\n): number[] {\n const [from, to] = yearRange ?? defaultBirthdayYearRange(limits);\n let start = Math.min(from, to);\n let end = Math.max(from, to);\n if (includeYear !== undefined) {\n start = Math.min(start, includeYear);\n end = Math.max(end, includeYear);\n }\n const years: number[] = [];\n for (let year = end; year >= start; year--) {\n years.push(year);\n }\n return years;\n}\n\n/**\n * From the latest allowed year down to the earliest. Without an upper limit the list starts at\n * this year (or the lower limit's year, if that's later); without a lower limit it ends\n * `DEFAULT_BIRTHDAY_YEARS_BACK` years before its start.\n */\nfunction defaultBirthdayYearRange(limits?: BirthdayLimits): [number, number] {\n const minYear = limitYear(limits?.minDate);\n const maxYear = limitYear(limits?.maxDate);\n const to = maxYear ?? Math.max(new Date().getFullYear(), minYear ?? -Infinity);\n const from = minYear ?? to - DEFAULT_BIRTHDAY_YEARS_BACK;\n return [from, to];\n}\n"],"names":["DEFAULT_BIRTHDAY_YEARS_BACK","ALL_MONTHS","Array","_","index","parseBirthdayValue","value","match","String","year","Number","month","day","daysInMonth","formatBirthdayValue","parts","undefined","pad","isLeapYear","dateKey","limitKey","date","open","isNaN","limitYear","isInBirthdayRange","range","min","max","Infinity","years","months","last","first","final","isDayDisabled","isMonthDisabled","isYearDisabled","pickDay","next","pickMonth","pickYear","BIRTHDAY_STEPS","nextBirthdayStep","current","picked","missing","step","birthdayYears","yearRange","includeYear","limits","from","to","defaultBirthdayYearRange","start","Math","end","minYear","maxYear","Date"],"mappings":"AAaO,MAAMA,8BAA8B;AAa3C,MAAMC,aAAaC,MAAM,IAAI,CAAC;IAAE,QAAQ;AAAG,GAAG,CAACC,GAAGC,QAAUA,QAAQ;AAM7D,SAASC,mBAAmBC,KAAgC;IAC/D,IAAI,CAACA,OACD,OAAO,CAAC;IAEZ,MAAMC,QAAQC,OAAOF,OAAO,KAAK,CAAC;IAClC,IAAI,CAACC,OACD,OAAO,CAAC;IAEZ,MAAME,OAAOC,OAAOH,KAAK,CAAC,EAAE;IAC5B,MAAMI,QAAQD,OAAOH,KAAK,CAAC,EAAE;IAC7B,MAAMK,MAAMF,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,CAACF,OAAO,GAAG,CAACE;AAE5B;AAOO,SAASC,cACZC,SAA4B,EAC5BC,WAAoB,EACpBC,MAAuB;IAEvB,MAAM,CAACC,MAAMC,GAAG,GAAGJ,aAAaK,yBAAyBH;IACzD,IAAII,QAAQC,KAAK,GAAG,CAACJ,MAAMC;IAC3B,IAAII,MAAMD,KAAK,GAAG,CAACJ,MAAMC;IACzB,IAAIH,AAAgBlC,WAAhBkC,aAA2B;QAC3BK,QAAQC,KAAK,GAAG,CAACD,OAAOL;QACxBO,MAAMD,KAAK,GAAG,CAACC,KAAKP;IACxB;IACA,MAAMpB,QAAkB,EAAE;IAC1B,IAAK,IAAIrB,OAAOgD,KAAKhD,QAAQ8C,OAAO9C,OAChCqB,MAAM,IAAI,CAACrB;IAEf,OAAOqB;AACX;AAOA,SAASwB,yBAAyBH,MAAuB;IACrD,MAAMO,UAAUlC,UAAU2B,QAAQ;IAClC,MAAMQ,UAAUnC,UAAU2B,QAAQ;IAClC,MAAME,KAAKM,WAAWH,KAAK,GAAG,CAAC,IAAII,OAAO,WAAW,IAAIF,WAAW,MAAS;IAC7E,MAAMN,OAAOM,WAAWL,KAAKrD;IAC7B,OAAO;QAACoD;QAAMC;KAAG;AACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { birthdayYears, daysInMonth, formatBirthdayValue, isDayDisabled, isMonthDisabled, isYearDisabled, nextBirthdayStep, parseBirthdayValue, pickDay, pickMonth, pickYear } from "./birthdayHelpers.js";
|
|
3
|
+
describe("birthdayHelpers", ()=>{
|
|
4
|
+
it("should read the parts of a date-only value", ()=>{
|
|
5
|
+
expect(parseBirthdayValue("1990-02-09")).toEqual({
|
|
6
|
+
day: 9,
|
|
7
|
+
month: 2,
|
|
8
|
+
year: 1990
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
it("should read the date part of a value that carries a time", ()=>{
|
|
12
|
+
expect(parseBirthdayValue("1990-02-09T00:00:00.000Z")).toEqual({
|
|
13
|
+
day: 9,
|
|
14
|
+
month: 2,
|
|
15
|
+
year: 1990
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
it("should read no parts from an empty or impossible value", ()=>{
|
|
19
|
+
expect(parseBirthdayValue(void 0)).toEqual({});
|
|
20
|
+
expect(parseBirthdayValue("")).toEqual({});
|
|
21
|
+
expect(parseBirthdayValue("not a date")).toEqual({});
|
|
22
|
+
expect(parseBirthdayValue("1990-02-30")).toEqual({});
|
|
23
|
+
});
|
|
24
|
+
it("should write a value only once every part is set", ()=>{
|
|
25
|
+
expect(formatBirthdayValue({
|
|
26
|
+
day: 9,
|
|
27
|
+
month: 2,
|
|
28
|
+
year: 1990
|
|
29
|
+
})).toBe("1990-02-09");
|
|
30
|
+
expect(formatBirthdayValue({
|
|
31
|
+
day: 9,
|
|
32
|
+
month: 2
|
|
33
|
+
})).toBeUndefined();
|
|
34
|
+
});
|
|
35
|
+
it("should give February 29 days until a non-leap year is known", ()=>{
|
|
36
|
+
expect(daysInMonth(2)).toBe(29);
|
|
37
|
+
expect(daysInMonth(2, 2000)).toBe(29);
|
|
38
|
+
expect(daysInMonth(2, 1900)).toBe(28);
|
|
39
|
+
expect(daysInMonth(2, 1990)).toBe(28);
|
|
40
|
+
});
|
|
41
|
+
it("should dim the months that can't hold the 31st", ()=>{
|
|
42
|
+
const dimmed = Array.from({
|
|
43
|
+
length: 12
|
|
44
|
+
}, (_, i)=>i + 1).filter((month)=>isMonthDisabled(month, {
|
|
45
|
+
day: 31
|
|
46
|
+
}));
|
|
47
|
+
expect(dimmed).toEqual([
|
|
48
|
+
2,
|
|
49
|
+
4,
|
|
50
|
+
6,
|
|
51
|
+
9,
|
|
52
|
+
11
|
|
53
|
+
]);
|
|
54
|
+
});
|
|
55
|
+
it("should dim no month before a day is picked", ()=>{
|
|
56
|
+
expect(isMonthDisabled(2, {})).toBe(false);
|
|
57
|
+
});
|
|
58
|
+
it("should clear a month that can't hold the newly picked day and keep the year", ()=>{
|
|
59
|
+
expect(pickDay({
|
|
60
|
+
day: 9,
|
|
61
|
+
month: 2,
|
|
62
|
+
year: 1990
|
|
63
|
+
}, 31)).toEqual({
|
|
64
|
+
day: 31,
|
|
65
|
+
month: void 0,
|
|
66
|
+
year: 1990
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
it("should keep a month that holds the newly picked day", ()=>{
|
|
70
|
+
expect(pickDay({
|
|
71
|
+
day: 9,
|
|
72
|
+
month: 8,
|
|
73
|
+
year: 1990
|
|
74
|
+
}, 31)).toEqual({
|
|
75
|
+
day: 31,
|
|
76
|
+
month: 8,
|
|
77
|
+
year: 1990
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
it("should clear a non-leap year when 29 February is picked", ()=>{
|
|
81
|
+
expect(pickDay({
|
|
82
|
+
day: 9,
|
|
83
|
+
month: 2,
|
|
84
|
+
year: 1990
|
|
85
|
+
}, 29)).toEqual({
|
|
86
|
+
day: 29,
|
|
87
|
+
month: 2,
|
|
88
|
+
year: void 0
|
|
89
|
+
});
|
|
90
|
+
expect(pickMonth({
|
|
91
|
+
day: 29,
|
|
92
|
+
month: 1,
|
|
93
|
+
year: 1990
|
|
94
|
+
}, 2)).toEqual({
|
|
95
|
+
day: 29,
|
|
96
|
+
month: 2,
|
|
97
|
+
year: void 0
|
|
98
|
+
});
|
|
99
|
+
expect(pickMonth({
|
|
100
|
+
day: 29,
|
|
101
|
+
month: 1,
|
|
102
|
+
year: 1992
|
|
103
|
+
}, 2)).toEqual({
|
|
104
|
+
day: 29,
|
|
105
|
+
month: 2,
|
|
106
|
+
year: 1992
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
it("should dim non-leap years for 29 February only", ()=>{
|
|
110
|
+
expect(isYearDisabled(1990, {
|
|
111
|
+
day: 29,
|
|
112
|
+
month: 2
|
|
113
|
+
})).toBe(true);
|
|
114
|
+
expect(isYearDisabled(1992, {
|
|
115
|
+
day: 29,
|
|
116
|
+
month: 2
|
|
117
|
+
})).toBe(false);
|
|
118
|
+
expect(isYearDisabled(1990, {
|
|
119
|
+
day: 28,
|
|
120
|
+
month: 2
|
|
121
|
+
})).toBe(false);
|
|
122
|
+
expect(isYearDisabled(1990, {
|
|
123
|
+
day: 29
|
|
124
|
+
})).toBe(false);
|
|
125
|
+
});
|
|
126
|
+
it("should set the year", ()=>{
|
|
127
|
+
expect(pickYear({
|
|
128
|
+
day: 31,
|
|
129
|
+
month: 8
|
|
130
|
+
}, 1990)).toEqual({
|
|
131
|
+
day: 31,
|
|
132
|
+
month: 8,
|
|
133
|
+
year: 1990
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
it("should list years newest first", ()=>{
|
|
137
|
+
expect(birthdayYears([
|
|
138
|
+
1985,
|
|
139
|
+
1990
|
|
140
|
+
])).toEqual([
|
|
141
|
+
1990,
|
|
142
|
+
1989,
|
|
143
|
+
1988,
|
|
144
|
+
1987,
|
|
145
|
+
1986,
|
|
146
|
+
1985
|
|
147
|
+
]);
|
|
148
|
+
expect(birthdayYears([
|
|
149
|
+
1990,
|
|
150
|
+
1985
|
|
151
|
+
])).toEqual([
|
|
152
|
+
1990,
|
|
153
|
+
1989,
|
|
154
|
+
1988,
|
|
155
|
+
1987,
|
|
156
|
+
1986,
|
|
157
|
+
1985
|
|
158
|
+
]);
|
|
159
|
+
});
|
|
160
|
+
it("should default to this year back 120 years", ()=>{
|
|
161
|
+
const currentYear = new Date().getFullYear();
|
|
162
|
+
const years = birthdayYears();
|
|
163
|
+
expect(years[0]).toBe(currentYear);
|
|
164
|
+
expect(years[years.length - 1]).toBe(currentYear - 120);
|
|
165
|
+
});
|
|
166
|
+
it("should include a set year that falls outside the range", ()=>{
|
|
167
|
+
expect(birthdayYears([
|
|
168
|
+
1985,
|
|
169
|
+
1987
|
|
170
|
+
], 1980)).toEqual([
|
|
171
|
+
1987,
|
|
172
|
+
1986,
|
|
173
|
+
1985,
|
|
174
|
+
1984,
|
|
175
|
+
1983,
|
|
176
|
+
1982,
|
|
177
|
+
1981,
|
|
178
|
+
1980
|
|
179
|
+
]);
|
|
180
|
+
});
|
|
181
|
+
describe("within minDate and maxDate", ()=>{
|
|
182
|
+
const range = {
|
|
183
|
+
years: birthdayYears([
|
|
184
|
+
2000,
|
|
185
|
+
2026
|
|
186
|
+
]),
|
|
187
|
+
minDate: new Date(2000, 2, 10),
|
|
188
|
+
maxDate: new Date(2026, 9, 15)
|
|
189
|
+
};
|
|
190
|
+
it("should dim the years outside the limits", ()=>{
|
|
191
|
+
const wide = {
|
|
192
|
+
...range,
|
|
193
|
+
years: birthdayYears([
|
|
194
|
+
1995,
|
|
195
|
+
2030
|
|
196
|
+
])
|
|
197
|
+
};
|
|
198
|
+
expect(isYearDisabled(1999, {}, wide)).toBe(true);
|
|
199
|
+
expect(isYearDisabled(2000, {}, wide)).toBe(false);
|
|
200
|
+
expect(isYearDisabled(2026, {}, wide)).toBe(false);
|
|
201
|
+
expect(isYearDisabled(2027, {}, wide)).toBe(true);
|
|
202
|
+
});
|
|
203
|
+
it("should dim the last year when the picked day and month fall after maxDate", ()=>{
|
|
204
|
+
expect(isYearDisabled(2026, {
|
|
205
|
+
day: 16,
|
|
206
|
+
month: 10
|
|
207
|
+
}, range)).toBe(true);
|
|
208
|
+
expect(isYearDisabled(2026, {
|
|
209
|
+
day: 15,
|
|
210
|
+
month: 10
|
|
211
|
+
}, range)).toBe(false);
|
|
212
|
+
expect(isYearDisabled(2026, {
|
|
213
|
+
day: 1,
|
|
214
|
+
month: 11
|
|
215
|
+
}, range)).toBe(true);
|
|
216
|
+
expect(isYearDisabled(2025, {
|
|
217
|
+
day: 1,
|
|
218
|
+
month: 11
|
|
219
|
+
}, range)).toBe(false);
|
|
220
|
+
});
|
|
221
|
+
it("should dim the first year when the picked day and month fall before minDate", ()=>{
|
|
222
|
+
expect(isYearDisabled(2000, {
|
|
223
|
+
day: 9,
|
|
224
|
+
month: 3
|
|
225
|
+
}, range)).toBe(true);
|
|
226
|
+
expect(isYearDisabled(2000, {
|
|
227
|
+
day: 10,
|
|
228
|
+
month: 3
|
|
229
|
+
}, range)).toBe(false);
|
|
230
|
+
});
|
|
231
|
+
it("should dim the months and days that no date in range has", ()=>{
|
|
232
|
+
const oneYear = {
|
|
233
|
+
...range,
|
|
234
|
+
years: [
|
|
235
|
+
2026
|
|
236
|
+
]
|
|
237
|
+
};
|
|
238
|
+
expect(isMonthDisabled(10, {}, oneYear)).toBe(false);
|
|
239
|
+
expect(isMonthDisabled(11, {}, oneYear)).toBe(true);
|
|
240
|
+
expect(isMonthDisabled(10, {
|
|
241
|
+
day: 16
|
|
242
|
+
}, oneYear)).toBe(true);
|
|
243
|
+
const oneMonth = {
|
|
244
|
+
years: [
|
|
245
|
+
2026
|
|
246
|
+
],
|
|
247
|
+
minDate: new Date(2026, 9, 1),
|
|
248
|
+
maxDate: new Date(2026, 9, 15)
|
|
249
|
+
};
|
|
250
|
+
expect(isDayDisabled(15, oneMonth)).toBe(false);
|
|
251
|
+
expect(isDayDisabled(16, oneMonth)).toBe(true);
|
|
252
|
+
expect(isDayDisabled(16, range)).toBe(false);
|
|
253
|
+
});
|
|
254
|
+
it("should keep 29 February when the range offers a leap year", ()=>{
|
|
255
|
+
expect(isMonthDisabled(2, {
|
|
256
|
+
day: 29
|
|
257
|
+
}, range)).toBe(false);
|
|
258
|
+
expect(isMonthDisabled(2, {
|
|
259
|
+
day: 29
|
|
260
|
+
}, {
|
|
261
|
+
...range,
|
|
262
|
+
years: [
|
|
263
|
+
2025
|
|
264
|
+
]
|
|
265
|
+
})).toBe(true);
|
|
266
|
+
});
|
|
267
|
+
it("should clear a year the newly picked part puts past a limit", ()=>{
|
|
268
|
+
expect(pickDay({
|
|
269
|
+
day: 1,
|
|
270
|
+
month: 10,
|
|
271
|
+
year: 2026
|
|
272
|
+
}, 20, range)).toEqual({
|
|
273
|
+
day: 20,
|
|
274
|
+
month: 10,
|
|
275
|
+
year: void 0
|
|
276
|
+
});
|
|
277
|
+
expect(pickMonth({
|
|
278
|
+
day: 1,
|
|
279
|
+
month: 10,
|
|
280
|
+
year: 2026
|
|
281
|
+
}, 12, range)).toEqual({
|
|
282
|
+
day: 1,
|
|
283
|
+
month: 12,
|
|
284
|
+
year: void 0
|
|
285
|
+
});
|
|
286
|
+
expect(pickDay({
|
|
287
|
+
day: 1,
|
|
288
|
+
month: 10,
|
|
289
|
+
year: 2026
|
|
290
|
+
}, 15, range)).toEqual({
|
|
291
|
+
day: 15,
|
|
292
|
+
month: 10,
|
|
293
|
+
year: 2026
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
it("should end the default years at maxDate and start them at minDate", ()=>{
|
|
297
|
+
const years = birthdayYears(void 0, void 0, {
|
|
298
|
+
maxDate: new Date(2000, 0, 1)
|
|
299
|
+
});
|
|
300
|
+
expect(years[0]).toBe(2000);
|
|
301
|
+
expect(years[years.length - 1]).toBe(1880);
|
|
302
|
+
expect(birthdayYears(void 0, void 0, {
|
|
303
|
+
minDate: new Date(1990, 0, 1),
|
|
304
|
+
maxDate: new Date(1995, 0, 1)
|
|
305
|
+
})).toEqual([
|
|
306
|
+
1995,
|
|
307
|
+
1994,
|
|
308
|
+
1993,
|
|
309
|
+
1992,
|
|
310
|
+
1991,
|
|
311
|
+
1990
|
|
312
|
+
]);
|
|
313
|
+
});
|
|
314
|
+
it("should start the default years at a maxDate in the future", ()=>{
|
|
315
|
+
const currentYear = new Date().getFullYear();
|
|
316
|
+
const years = birthdayYears(void 0, void 0, {
|
|
317
|
+
maxDate: new Date(currentYear + 2, 0, 1)
|
|
318
|
+
});
|
|
319
|
+
expect(years[0]).toBe(currentYear + 2);
|
|
320
|
+
expect(years[years.length - 1]).toBe(currentYear + 2 - 120);
|
|
321
|
+
});
|
|
322
|
+
it("should run the default years from this year down to an old minDate", ()=>{
|
|
323
|
+
const currentYear = new Date().getFullYear();
|
|
324
|
+
const years = birthdayYears(void 0, void 0, {
|
|
325
|
+
minDate: new Date(1850, 0, 1)
|
|
326
|
+
});
|
|
327
|
+
expect(years[0]).toBe(currentYear);
|
|
328
|
+
expect(years[years.length - 1]).toBe(1850);
|
|
329
|
+
});
|
|
330
|
+
it("should start the default years at a minDate in the future", ()=>{
|
|
331
|
+
const currentYear = new Date().getFullYear();
|
|
332
|
+
const years = birthdayYears(void 0, void 0, {
|
|
333
|
+
minDate: new Date(currentYear + 3, 0, 1)
|
|
334
|
+
});
|
|
335
|
+
expect(years).toEqual([
|
|
336
|
+
currentYear + 3
|
|
337
|
+
]);
|
|
338
|
+
});
|
|
339
|
+
it("should ignore an invalid limit", ()=>{
|
|
340
|
+
expect(isYearDisabled(2026, {}, {
|
|
341
|
+
years: [
|
|
342
|
+
2026
|
|
343
|
+
],
|
|
344
|
+
maxDate: new Date("nope")
|
|
345
|
+
})).toBe(false);
|
|
346
|
+
});
|
|
347
|
+
});
|
|
348
|
+
it("should go to the next missing part after a pick", ()=>{
|
|
349
|
+
expect(nextBirthdayStep({
|
|
350
|
+
day: 9
|
|
351
|
+
}, "day", new Set([
|
|
352
|
+
"day"
|
|
353
|
+
]))).toBe("month");
|
|
354
|
+
expect(nextBirthdayStep({
|
|
355
|
+
month: 2,
|
|
356
|
+
year: 1990
|
|
357
|
+
}, "year", new Set([
|
|
358
|
+
"year"
|
|
359
|
+
]))).toBe("day");
|
|
360
|
+
});
|
|
361
|
+
it("should close once a pick out of order completes the date", ()=>{
|
|
362
|
+
const picked = new Set([
|
|
363
|
+
"year",
|
|
364
|
+
"day",
|
|
365
|
+
"month"
|
|
366
|
+
]);
|
|
367
|
+
expect(nextBirthdayStep({
|
|
368
|
+
day: 9,
|
|
369
|
+
month: 2,
|
|
370
|
+
year: 1990
|
|
371
|
+
}, "month", picked)).toBe(void 0);
|
|
372
|
+
});
|
|
373
|
+
it("should walk on through the later steps when editing a saved date", ()=>{
|
|
374
|
+
const date = {
|
|
375
|
+
day: 9,
|
|
376
|
+
month: 2,
|
|
377
|
+
year: 1990
|
|
378
|
+
};
|
|
379
|
+
expect(nextBirthdayStep(date, "day", new Set([
|
|
380
|
+
"day"
|
|
381
|
+
]))).toBe("month");
|
|
382
|
+
expect(nextBirthdayStep(date, "month", new Set([
|
|
383
|
+
"day",
|
|
384
|
+
"month"
|
|
385
|
+
]))).toBe("year");
|
|
386
|
+
expect(nextBirthdayStep(date, "year", new Set([
|
|
387
|
+
"day",
|
|
388
|
+
"month",
|
|
389
|
+
"year"
|
|
390
|
+
]))).toBe(void 0);
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
//# sourceMappingURL=birthdayHelpers.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker/utils/birthdayHelpers.test.js","sources":["../../../src/DatePicker/utils/birthdayHelpers.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport {\n birthdayYears,\n daysInMonth,\n formatBirthdayValue,\n isDayDisabled,\n isMonthDisabled,\n isYearDisabled,\n nextBirthdayStep,\n parseBirthdayValue,\n pickDay,\n pickMonth,\n pickYear\n} from \"./birthdayHelpers.js\";\n\ndescribe(\"birthdayHelpers\", () => {\n it(\"should read the parts of a date-only value\", () => {\n expect(parseBirthdayValue(\"1990-02-09\")).toEqual({ day: 9, month: 2, year: 1990 });\n });\n\n it(\"should read the date part of a value that carries a time\", () => {\n expect(parseBirthdayValue(\"1990-02-09T00:00:00.000Z\")).toEqual({\n day: 9,\n month: 2,\n year: 1990\n });\n });\n\n it(\"should read no parts from an empty or impossible value\", () => {\n expect(parseBirthdayValue(undefined)).toEqual({});\n expect(parseBirthdayValue(\"\")).toEqual({});\n expect(parseBirthdayValue(\"not a date\")).toEqual({});\n expect(parseBirthdayValue(\"1990-02-30\")).toEqual({});\n });\n\n it(\"should write a value only once every part is set\", () => {\n expect(formatBirthdayValue({ day: 9, month: 2, year: 1990 })).toBe(\"1990-02-09\");\n expect(formatBirthdayValue({ day: 9, month: 2 })).toBeUndefined();\n });\n\n it(\"should give February 29 days until a non-leap year is known\", () => {\n expect(daysInMonth(2)).toBe(29);\n expect(daysInMonth(2, 2000)).toBe(29);\n expect(daysInMonth(2, 1900)).toBe(28);\n expect(daysInMonth(2, 1990)).toBe(28);\n });\n\n it(\"should dim the months that can't hold the 31st\", () => {\n const dimmed = Array.from({ length: 12 }, (_, i) => i + 1).filter(month =>\n isMonthDisabled(month, { day: 31 })\n );\n expect(dimmed).toEqual([2, 4, 6, 9, 11]);\n });\n\n it(\"should dim no month before a day is picked\", () => {\n expect(isMonthDisabled(2, {})).toBe(false);\n });\n\n it(\"should clear a month that can't hold the newly picked day and keep the year\", () => {\n expect(pickDay({ day: 9, month: 2, year: 1990 }, 31)).toEqual({\n day: 31,\n month: undefined,\n year: 1990\n });\n });\n\n it(\"should keep a month that holds the newly picked day\", () => {\n expect(pickDay({ day: 9, month: 8, year: 1990 }, 31)).toEqual({\n day: 31,\n month: 8,\n year: 1990\n });\n });\n\n it(\"should clear a non-leap year when 29 February is picked\", () => {\n expect(pickDay({ day: 9, month: 2, year: 1990 }, 29)).toEqual({\n day: 29,\n month: 2,\n year: undefined\n });\n expect(pickMonth({ day: 29, month: 1, year: 1990 }, 2)).toEqual({\n day: 29,\n month: 2,\n year: undefined\n });\n expect(pickMonth({ day: 29, month: 1, year: 1992 }, 2)).toEqual({\n day: 29,\n month: 2,\n year: 1992\n });\n });\n\n it(\"should dim non-leap years for 29 February only\", () => {\n expect(isYearDisabled(1990, { day: 29, month: 2 })).toBe(true);\n expect(isYearDisabled(1992, { day: 29, month: 2 })).toBe(false);\n expect(isYearDisabled(1990, { day: 28, month: 2 })).toBe(false);\n expect(isYearDisabled(1990, { day: 29 })).toBe(false);\n });\n\n it(\"should set the year\", () => {\n expect(pickYear({ day: 31, month: 8 }, 1990)).toEqual({ day: 31, month: 8, year: 1990 });\n });\n\n it(\"should list years newest first\", () => {\n expect(birthdayYears([1985, 1990])).toEqual([1990, 1989, 1988, 1987, 1986, 1985]);\n expect(birthdayYears([1990, 1985])).toEqual([1990, 1989, 1988, 1987, 1986, 1985]);\n });\n\n it(\"should default to this year back 120 years\", () => {\n const currentYear = new Date().getFullYear();\n const years = birthdayYears();\n expect(years[0]).toBe(currentYear);\n expect(years[years.length - 1]).toBe(currentYear - 120);\n });\n\n it(\"should include a set year that falls outside the range\", () => {\n expect(birthdayYears([1985, 1987], 1980)).toEqual([\n 1987, 1986, 1985, 1984, 1983, 1982, 1981, 1980\n ]);\n });\n\n describe(\"within minDate and maxDate\", () => {\n const range = {\n years: birthdayYears([2000, 2026]),\n minDate: new Date(2000, 2, 10),\n maxDate: new Date(2026, 9, 15)\n };\n\n it(\"should dim the years outside the limits\", () => {\n const wide = { ...range, years: birthdayYears([1995, 2030]) };\n expect(isYearDisabled(1999, {}, wide)).toBe(true);\n expect(isYearDisabled(2000, {}, wide)).toBe(false);\n expect(isYearDisabled(2026, {}, wide)).toBe(false);\n expect(isYearDisabled(2027, {}, wide)).toBe(true);\n });\n\n it(\"should dim the last year when the picked day and month fall after maxDate\", () => {\n expect(isYearDisabled(2026, { day: 16, month: 10 }, range)).toBe(true);\n expect(isYearDisabled(2026, { day: 15, month: 10 }, range)).toBe(false);\n expect(isYearDisabled(2026, { day: 1, month: 11 }, range)).toBe(true);\n expect(isYearDisabled(2025, { day: 1, month: 11 }, range)).toBe(false);\n });\n\n it(\"should dim the first year when the picked day and month fall before minDate\", () => {\n expect(isYearDisabled(2000, { day: 9, month: 3 }, range)).toBe(true);\n expect(isYearDisabled(2000, { day: 10, month: 3 }, range)).toBe(false);\n });\n\n it(\"should dim the months and days that no date in range has\", () => {\n const oneYear = { ...range, years: [2026] };\n expect(isMonthDisabled(10, {}, oneYear)).toBe(false);\n expect(isMonthDisabled(11, {}, oneYear)).toBe(true);\n expect(isMonthDisabled(10, { day: 16 }, oneYear)).toBe(true);\n\n const oneMonth = {\n years: [2026],\n minDate: new Date(2026, 9, 1),\n maxDate: new Date(2026, 9, 15)\n };\n expect(isDayDisabled(15, oneMonth)).toBe(false);\n expect(isDayDisabled(16, oneMonth)).toBe(true);\n expect(isDayDisabled(16, range)).toBe(false);\n });\n\n it(\"should keep 29 February when the range offers a leap year\", () => {\n expect(isMonthDisabled(2, { day: 29 }, range)).toBe(false);\n expect(isMonthDisabled(2, { day: 29 }, { ...range, years: [2025] })).toBe(true);\n });\n\n it(\"should clear a year the newly picked part puts past a limit\", () => {\n expect(pickDay({ day: 1, month: 10, year: 2026 }, 20, range)).toEqual({\n day: 20,\n month: 10,\n year: undefined\n });\n expect(pickMonth({ day: 1, month: 10, year: 2026 }, 12, range)).toEqual({\n day: 1,\n month: 12,\n year: undefined\n });\n expect(pickDay({ day: 1, month: 10, year: 2026 }, 15, range)).toEqual({\n day: 15,\n month: 10,\n year: 2026\n });\n });\n\n it(\"should end the default years at maxDate and start them at minDate\", () => {\n const years = birthdayYears(undefined, undefined, { maxDate: new Date(2000, 0, 1) });\n expect(years[0]).toBe(2000);\n expect(years[years.length - 1]).toBe(1880);\n expect(\n birthdayYears(undefined, undefined, {\n minDate: new Date(1990, 0, 1),\n maxDate: new Date(1995, 0, 1)\n })\n ).toEqual([1995, 1994, 1993, 1992, 1991, 1990]);\n });\n\n it(\"should start the default years at a maxDate in the future\", () => {\n const currentYear = new Date().getFullYear();\n const years = birthdayYears(undefined, undefined, {\n maxDate: new Date(currentYear + 2, 0, 1)\n });\n expect(years[0]).toBe(currentYear + 2);\n expect(years[years.length - 1]).toBe(currentYear + 2 - 120);\n });\n\n it(\"should run the default years from this year down to an old minDate\", () => {\n const currentYear = new Date().getFullYear();\n const years = birthdayYears(undefined, undefined, { minDate: new Date(1850, 0, 1) });\n expect(years[0]).toBe(currentYear);\n expect(years[years.length - 1]).toBe(1850);\n });\n\n it(\"should start the default years at a minDate in the future\", () => {\n const currentYear = new Date().getFullYear();\n const years = birthdayYears(undefined, undefined, {\n minDate: new Date(currentYear + 3, 0, 1)\n });\n expect(years).toEqual([currentYear + 3]);\n });\n\n it(\"should ignore an invalid limit\", () => {\n expect(isYearDisabled(2026, {}, { years: [2026], maxDate: new Date(\"nope\") })).toBe(\n false\n );\n });\n });\n\n it(\"should go to the next missing part after a pick\", () => {\n expect(nextBirthdayStep({ day: 9 }, \"day\", new Set([\"day\"]))).toBe(\"month\");\n expect(nextBirthdayStep({ month: 2, year: 1990 }, \"year\", new Set([\"year\"]))).toBe(\"day\");\n });\n\n it(\"should close once a pick out of order completes the date\", () => {\n const picked = new Set([\"year\", \"day\", \"month\"] as const);\n expect(nextBirthdayStep({ day: 9, month: 2, year: 1990 }, \"month\", picked)).toBe(undefined);\n });\n\n it(\"should walk on through the later steps when editing a saved date\", () => {\n const date = { day: 9, month: 2, year: 1990 };\n expect(nextBirthdayStep(date, \"day\", new Set([\"day\"]))).toBe(\"month\");\n expect(nextBirthdayStep(date, \"month\", new Set([\"day\", \"month\"]))).toBe(\"year\");\n expect(nextBirthdayStep(date, \"year\", new Set([\"day\", \"month\", \"year\"]))).toBe(undefined);\n });\n});\n"],"names":["describe","it","expect","parseBirthdayValue","undefined","formatBirthdayValue","daysInMonth","dimmed","Array","_","i","month","isMonthDisabled","pickDay","pickMonth","isYearDisabled","pickYear","birthdayYears","currentYear","Date","years","range","wide","oneYear","oneMonth","isDayDisabled","nextBirthdayStep","Set","picked","date"],"mappings":";;AAeAA,SAAS,mBAAmB;IACxBC,GAAG,8CAA8C;QAC7CC,OAAOC,mBAAmB,eAAe,OAAO,CAAC;YAAE,KAAK;YAAG,OAAO;YAAG,MAAM;QAAK;IACpF;IAEAF,GAAG,4DAA4D;QAC3DC,OAAOC,mBAAmB,6BAA6B,OAAO,CAAC;YAC3D,KAAK;YACL,OAAO;YACP,MAAM;QACV;IACJ;IAEAF,GAAG,0DAA0D;QACzDC,OAAOC,mBAAmBC,SAAY,OAAO,CAAC,CAAC;QAC/CF,OAAOC,mBAAmB,KAAK,OAAO,CAAC,CAAC;QACxCD,OAAOC,mBAAmB,eAAe,OAAO,CAAC,CAA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,GAAG,kCAAkC;YACjCC,OAAOa,eAAe,MAAM,CAAC,GAAG;gBAAE,OAAO;oBAAC;iBAAK;gBAAE,SAAS,IAAII,KAAK;YAAQ,IAAI,IAAI,CAC/E;QAER;IACJ;IAEAlB,GAAG,mDAAmD;QAClDC,OAAOwB,iBAAiB;YAAE,KAAK;QAAE,GAAG,OAAO,IAAIC,IAAI;YAAC;SAAM,IAAI,IAAI,CAAC;QACnEzB,OAAOwB,iBAAiB;YAAE,OAAO;YAAG,MAAM;QAAK,GAAG,QAAQ,IAAIC,IAAI;YAAC;SAAO,IAAI,IAAI,CAAC;IACvF;IAEA1B,GAAG,4DAA4D;QAC3D,MAAM2B,SAAS,IAAID,IAAI;YAAC;YAAQ;YAAO;SAAQ;QAC/CzB,OAAOwB,iBAAiB;YAAE,KAAK;YAAG,OAAO;YAAG,MAAM;QAAK,GAAG,SAASE,SAAS,IAAI,CAACxB;IACrF;IAEAH,GAAG,oEAAoE;QACnE,MAAM4B,OAAO;YAAE,KAAK;YAAG,OAAO;YAAG,MAAM;QAAK;QAC5C3B,OAAOwB,iBAAiBG,MAAM,OAAO,IAAIF,IAAI;YAAC;SAAM,IAAI,IAAI,CAAC;QAC7DzB,OAAOwB,iBAAiBG,MAAM,SAAS,IAAIF,IAAI;YAAC;YAAO;SAAQ,IAAI,IAAI,CAAC;QACxEzB,OAAOwB,iBAAiBG,MAAM,QAAQ,IAAIF,IAAI;YAAC;YAAO;YAAS;SAAO,IAAI,IAAI,CAACvB;IACnF;AACJ"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `new Date("2026-10-10")` is UTC midnight, which is the previous day west of UTC.
|
|
3
|
+
* Bare dates are calendar days, so build them at local midnight instead.
|
|
4
|
+
*/
|
|
5
|
+
export declare function parseDateValue(value: string | Date | number): Date;
|
|
1
6
|
export declare function formatDateForDisplay(value: Date | string | number | {
|
|
2
7
|
from?: string;
|
|
3
8
|
to?: string;
|
|
@@ -15,7 +20,7 @@ export declare function parseTimeValue(time: string): {
|
|
|
15
20
|
} | undefined;
|
|
16
21
|
export declare function toIsoWithTz(date: Date, timezone?: string): string;
|
|
17
22
|
export declare function getLocalTimezone(): string;
|
|
18
|
-
export declare function extractTimezone(isoString: string): string | undefined;
|
|
23
|
+
export declare function extractTimezone(isoString: string | Date | unknown): string | undefined;
|
|
19
24
|
export declare function toLocalNaive(isoString: string): Date;
|
|
20
25
|
export declare function formatWeekValue(date: Date): string;
|
|
21
26
|
export declare function parseWeekValue(value: string): {
|