@povio/ui 3.4.0-rc.15 → 3.4.0-rc.17
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/README.md +1 -1
- package/dist/assets/locales/en/{translation.json.js → translation.js} +1 -0
- package/dist/assets/locales/sl/{translation.json.js → translation.js} +1 -0
- package/dist/components/Breadcrumbs/breadcrumbs.cva.d.ts +39 -40
- package/dist/components/Breadcrumbs/breadcrumbs.cva.js +5 -5
- package/dist/components/Menu/MenuDesktop.js +2 -2
- package/dist/components/Menu/MenuItem.d.ts +6 -3
- package/dist/components/Menu/MenuItem.js +2 -2
- package/dist/components/Menu/MenuMobile.js +3 -3
- package/dist/components/Menu/MenuPopover.d.ts +7 -5
- package/dist/components/Menu/MenuPopover.js +2 -2
- package/dist/components/Menu/menu.cva.d.ts +35 -35
- package/dist/components/Menu/menu.cva.js +4 -4
- package/dist/components/accordion.d.ts +5 -0
- package/dist/components/accordion.js +81 -0
- package/dist/components/action-modal.d.ts +26 -0
- package/dist/components/action-modal.js +188 -0
- package/dist/components/alert.d.ts +14 -0
- package/dist/components/alert.js +114 -0
- package/dist/components/autocomplete.d.ts +16 -0
- package/dist/components/{inputs/Selection/Autocomplete/Autocomplete.js → autocomplete.js} +34 -64
- package/dist/components/bottom-sheet.d.ts +34 -0
- package/dist/components/{overlays/BottomSheet/BottomSheet.js → bottom-sheet.js} +17 -14
- package/dist/components/breadcrumbs.d.ts +19 -0
- package/dist/components/breadcrumbs.js +263 -0
- package/dist/components/button.d.ts +3 -0
- package/dist/components/button.js +2 -0
- package/dist/components/buttons/Button/Button.d.ts +25 -23
- package/dist/components/buttons/Button/Button.js +1 -1
- package/dist/components/buttons/Button/button.cva.d.ts +89 -95
- package/dist/components/buttons/Button/button.cva.js +8 -44
- package/dist/components/buttons/PillButton/pillButton.cva.d.ts +33 -38
- package/dist/components/buttons/PillButton/pillButton.cva.js +5 -5
- package/dist/components/buttons/shared/ButtonContent.js +81 -23
- package/dist/components/buttons/shared/buttonContent.cva.d.ts +6 -8
- package/dist/components/buttons/shared/buttonContent.cva.js +1 -1
- package/dist/components/checkbox-group.d.ts +28 -0
- package/dist/components/checkbox-group.js +163 -0
- package/dist/components/checkbox.d.ts +24 -0
- package/dist/components/checkbox.js +80 -0
- package/dist/components/date-picker.d.ts +2 -0
- package/dist/components/date-picker.js +2 -0
- package/dist/components/date-range-picker.d.ts +2 -0
- package/dist/components/date-range-picker.js +2 -0
- package/dist/components/date-time-picker.d.ts +2 -0
- package/dist/components/date-time-picker.js +2 -0
- package/dist/components/drawer.d.ts +18 -0
- package/dist/components/{overlays/Drawer/Drawer.js → drawer.js} +4 -4
- package/dist/components/file-upload-container.d.ts +5 -0
- package/dist/components/file-upload-container.js +15 -0
- package/dist/components/file-upload.d.ts +7 -0
- package/dist/components/{inputs/File/FileUpload.js → file-upload.js} +59 -98
- package/dist/components/form-field.d.ts +24 -0
- package/dist/components/form-field.js +47 -0
- package/dist/components/icon-button.d.ts +14 -0
- package/dist/components/{buttons/IconButton/IconButton.js → icon-button.js} +3 -3
- package/dist/components/inline-icon-button.d.ts +16 -0
- package/dist/components/inline-icon-button.js +40 -0
- package/dist/components/input-upload.d.ts +7 -0
- package/dist/components/input-upload.js +118 -0
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +1 -1
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +73 -89
- package/dist/components/inputs/Checkbox/checkbox.cva.js +8 -8
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +40 -37
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +44 -36
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +46 -43
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +174 -170
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +41 -38
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +21 -20
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +29 -26
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +166 -542
- package/dist/components/inputs/DateTime/shared/Calendar.js +17 -14
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +18 -18
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +6 -5
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +9 -8
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +45 -45
- package/dist/components/inputs/DateTime/shared/DateField.js +19 -20
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +11 -45
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +3 -3
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +26 -102
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +29 -84
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +3 -3
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +59 -104
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +82 -193
- package/dist/components/inputs/DateTime/shared/TimeField.js +8 -27
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +113 -283
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +73 -216
- package/dist/components/inputs/DateTime/shared/YearPicker.js +69 -120
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +8 -5
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +16 -15
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +1 -1
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +13 -52
- package/dist/components/inputs/DateTime/shared/datePickerValue.utils.js +1 -1
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +13 -12
- package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.js +12 -26
- package/dist/components/inputs/File/fileUpload.types.d.ts +87 -84
- package/dist/components/inputs/File/inputUpload.types.d.ts +34 -32
- package/dist/components/inputs/File/inputUpload.types.js +1 -1
- package/dist/components/inputs/File/shared/FileCard.js +47 -110
- package/dist/components/inputs/File/shared/FileCardList.js +16 -54
- package/dist/components/inputs/File/shared/FileUploadContent.js +47 -188
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +3 -3
- package/dist/components/inputs/File/shared/FileUploadContentError.js +6 -6
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +6 -6
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +3 -3
- package/dist/components/inputs/File/shared/InputUploadContent.js +38 -151
- package/dist/components/inputs/File/shared/InputUploadFilled.js +10 -50
- package/dist/components/inputs/File/shared/ProgressBar.d.ts +6 -4
- package/dist/components/inputs/File/shared/ProgressBar.js +2 -2
- package/dist/components/inputs/File/shared/fileUpload.cva.d.ts +17 -16
- package/dist/components/inputs/File/shared/fileUpload.cva.js +1 -1
- package/dist/components/inputs/File/shared/inputUploadButton.cva.d.ts +24 -25
- package/dist/components/inputs/File/shared/inputUploadButton.cva.js +5 -5
- package/dist/components/inputs/File/shared/progressBar.cva.d.ts +34 -33
- package/dist/components/inputs/File/shared/progressBar.cva.js +5 -5
- package/dist/components/inputs/FormField/FormFieldError.d.ts +9 -6
- package/dist/components/inputs/FormField/FormFieldError.js +6 -24
- package/dist/components/inputs/FormField/FormFieldHeader.d.ts +15 -13
- package/dist/components/inputs/FormField/FormFieldHeader.js +24 -80
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +7 -31
- package/dist/components/inputs/FormField/FormFieldHelper.js +7 -25
- package/dist/components/inputs/FormField/FormFieldLabel.js +9 -40
- package/dist/components/inputs/FormField/formFieldError.cva.d.ts +13 -12
- package/dist/components/inputs/FormField/formFieldError.cva.js +1 -1
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +13 -12
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +1 -1
- package/dist/components/inputs/FormField/formFieldHelper.cva.d.ts +13 -12
- package/dist/components/inputs/FormField/formFieldHelper.cva.js +1 -1
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +11 -45
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +121 -554
- package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +8 -7
- package/dist/components/inputs/Input/TextArea/TextArea.cva.js +1 -1
- package/dist/components/inputs/Input/shared/InputContent.d.ts +25 -27
- package/dist/components/inputs/Input/shared/InputContent.js +61 -195
- package/dist/components/inputs/Input/shared/numberStatic.utils.js +1 -1
- package/dist/components/inputs/Inputs/Form.d.ts +19 -19
- package/dist/components/inputs/Inputs/Form.js +23 -51
- package/dist/components/inputs/Inputs/InputItem.d.ts +77 -58
- package/dist/components/inputs/Inputs/InputItem.js +29 -78
- package/dist/components/inputs/Inputs/Inputs.d.ts +12 -9
- package/dist/components/inputs/Inputs/Inputs.js +11 -37
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +49 -59
- package/dist/components/inputs/RadioGroup/radio.cva.js +6 -6
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +25 -38
- package/dist/components/inputs/Selection/Select/Select.d.ts +15 -11
- package/dist/components/inputs/Selection/Select/Select.js +36 -112
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +39 -37
- package/dist/components/inputs/Selection/shared/SelectBase.js +26 -70
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +145 -393
- package/dist/components/inputs/Selection/shared/SelectInput.js +162 -429
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +27 -101
- package/dist/components/inputs/Selection/shared/SelectListBox.js +1 -1
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +35 -85
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +16 -69
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +24 -72
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +10 -59
- package/dist/components/inputs/Selection/shared/SelectMobile.js +4 -4
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +14 -39
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +8 -15
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +6 -6
- package/dist/components/inputs/Selection/shared/select.context.js +52 -52
- package/dist/components/inputs/Selection/shared/select.types.d.ts +60 -62
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +8 -5
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +1 -1
- package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +12 -11
- package/dist/components/inputs/Selection/shared/selectInput.cva.js +1 -1
- package/dist/components/inputs/Selection/shared/selectItem.cva.d.ts +16 -15
- package/dist/components/inputs/Selection/shared/selectItem.cva.js +1 -1
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +3 -3
- package/dist/components/inputs/Selection/shared/useSelectItems.js +12 -12
- package/dist/components/inputs/Skeleton/InputFrame.js +30 -30
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +24 -20
- package/dist/components/inputs/TextEditor/TextEditor.js +22 -63
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +11 -37
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +31 -103
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +48 -197
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +28 -88
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +14 -48
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +19 -66
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +15 -49
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +33 -93
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +55 -127
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +39 -142
- package/dist/components/inputs/TextEditor/textEditor.types.js +1 -1
- package/dist/components/inputs/Toggle/toggle.cva.d.ts +15 -18
- package/dist/components/inputs/Toggle/toggle.cva.js +3 -3
- package/dist/components/inputs/shared/CheckContent.js +11 -21
- package/dist/components/inputs/shared/InputClear.js +31 -103
- package/dist/components/inputs/shared/TooltipWrapper.js +14 -49
- package/dist/components/inputs/shared/form.binding.d.ts +7 -27
- package/dist/components/inputs/shared/form.binding.js +8 -37
- package/dist/components/inputs/shared/form.types.d.ts +11 -11
- package/dist/components/inputs/shared/form.types.js +1 -1
- package/dist/components/inputs/shared/input.cva.d.ts +76 -85
- package/dist/components/inputs/shared/input.cva.js +9 -19
- package/dist/components/inputs/shared/label.cva.d.ts +18 -18
- package/dist/components/inputs/shared/label.cva.js +2 -2
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +10 -7
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +1 -1
- package/dist/components/inputs/shared/useFieldAccessibility.js +19 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.js +50 -105
- package/dist/components/link.d.ts +11 -0
- package/dist/components/{text/Link/Link.js → link.js} +7 -7
- package/dist/components/loader.d.ts +7 -0
- package/dist/components/{status/Loader/Loader.js → loader.js} +2 -2
- package/dist/components/menu.d.ts +23 -0
- package/dist/components/{Menu/Menu.js → menu.js} +4 -4
- package/dist/components/modal.d.ts +2 -0
- package/dist/components/modal.js +2 -0
- package/dist/components/navigation/Accordion/AccordionItem.js +87 -42
- package/dist/components/navigation/Accordion/accordion.cva.d.ts +76 -100
- package/dist/components/navigation/Accordion/accordion.cva.js +10 -10
- package/dist/components/navigation/Accordion/accordion.types.d.ts +52 -49
- package/dist/components/navigation/Stepper/StepperItem.js +3 -3
- package/dist/components/navigation/Stepper/StepperSeparator.js +1 -1
- package/dist/components/navigation/Stepper/stepper.cva.d.ts +73 -86
- package/dist/components/navigation/Stepper/stepper.cva.js +7 -7
- package/dist/components/navigation/Stepper/stepper.types.d.ts +29 -37
- package/dist/components/number-input.d.ts +27 -0
- package/dist/components/number-input.js +245 -0
- package/dist/components/number-range-input.d.ts +39 -0
- package/dist/components/number-range-input.js +267 -0
- package/dist/components/outline.clsx.d.ts +4 -2
- package/dist/components/outline.clsx.js +2 -2
- package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +3 -3
- package/dist/components/overlays/Modal/Modal.d.ts +18 -14
- package/dist/components/overlays/Modal/Modal.js +4 -2
- package/dist/components/overlays/Modal/modal.cva.d.ts +34 -34
- package/dist/components/overlays/Modal/modal.cva.js +4 -4
- package/dist/components/overlays/Tooltip/tooltip.cva.d.ts +39 -45
- package/dist/components/overlays/Tooltip/tooltip.cva.js +4 -4
- package/dist/components/pagination.d.ts +12 -0
- package/dist/components/pagination.js +131 -0
- package/dist/components/password-input.d.ts +10 -0
- package/dist/components/password-input.js +23 -0
- package/dist/components/pill-button.d.ts +15 -0
- package/dist/components/{buttons/PillButton/PillButton.js → pill-button.js} +5 -5
- package/dist/components/pill.d.ts +18 -0
- package/dist/components/{text/Pill/Pill.js → pill.js} +6 -6
- package/dist/components/query-autocomplete.d.ts +8 -0
- package/dist/components/query-autocomplete.js +105 -0
- package/dist/components/query-select.d.ts +19 -0
- package/dist/components/query-select.js +115 -0
- package/dist/components/radio-group.d.ts +24 -0
- package/dist/components/radio-group.js +165 -0
- package/dist/components/responsive-popover.d.ts +19 -0
- package/dist/components/responsive-popover.js +126 -0
- package/dist/components/segment/SegmentItem.js +3 -3
- package/dist/components/segment/segment.cva.d.ts +20 -18
- package/dist/components/segment/segment.cva.js +2 -2
- package/dist/components/segment/segment.types.d.ts +33 -30
- package/dist/components/segment.d.ts +7 -0
- package/dist/components/{segment/Segment.js → segment.js} +8 -8
- package/dist/components/select.d.ts +4 -0
- package/dist/components/select.js +2 -0
- package/dist/components/shared/pagination/PaginationList.d.ts +17 -14
- package/dist/components/shared/pagination/PaginationList.js +2 -2
- package/dist/components/shared/pagination/minWidth.cva.js +1 -1
- package/dist/components/shared/popover.cva.d.ts +8 -7
- package/dist/components/shared/popover.cva.js +1 -1
- package/dist/components/slider.d.ts +22 -0
- package/dist/components/slider.js +103 -0
- package/dist/components/split-button.d.ts +15 -0
- package/dist/components/{buttons/SplitButton/SplitButton.js → split-button.js} +5 -5
- package/dist/components/status/Alert/alert.cva.d.ts +21 -18
- package/dist/components/status/Alert/alert.cva.js +1 -1
- package/dist/components/status/Loader/loader.cva.d.ts +23 -26
- package/dist/components/status/Loader/loader.cva.js +4 -4
- package/dist/components/status/Toast/toast.cva.d.ts +58 -77
- package/dist/components/status/Toast/toast.cva.js +6 -6
- package/dist/components/status/Toast/useToast.d.ts +14 -11
- package/dist/components/status/Toast/useToast.js +2 -2
- package/dist/components/status/shared/status.cva.d.ts +32 -28
- package/dist/components/status/shared/status.cva.js +2 -2
- package/dist/components/stepper.d.ts +5 -0
- package/dist/components/stepper.js +79 -0
- package/dist/components/table/CellText.d.ts +10 -7
- package/dist/components/table/CellText.js +4 -3
- package/dist/components/table/ColumnConfig.d.ts +12 -9
- package/dist/components/table/ColumnConfig.js +8 -7
- package/dist/components/table/HeaderText.d.ts +10 -7
- package/dist/components/table/HeaderText.js +4 -3
- package/dist/components/table/InfiniteTable.d.ts +10 -8
- package/dist/components/table/InfiniteTable.js +68 -17
- package/dist/components/table/PaginatedTable.d.ts +12 -10
- package/dist/components/table/PaginatedTable.js +2 -2
- package/dist/components/table/Table.d.ts +34 -35
- package/dist/components/table/Table.js +19 -17
- package/dist/components/table/table.cva.d.ts +40 -59
- package/dist/components/table/table.cva.js +7 -7
- package/dist/components/tag.d.ts +18 -0
- package/dist/components/{text/Tag/Tag.js → tag.js} +6 -6
- package/dist/components/text/Link/link.cva.d.ts +14 -11
- package/dist/components/text/Link/link.cva.js +1 -1
- package/dist/components/text/Tag/tag.cva.d.ts +18 -15
- package/dist/components/text/Tag/tag.cva.js +1 -1
- package/dist/components/text/Typography/typography.cva.d.ts +51 -48
- package/dist/components/text/Typography/typography.cva.js +1 -1
- package/dist/components/text-area.d.ts +21 -0
- package/dist/components/text-area.js +138 -0
- package/dist/components/text-button.d.ts +15 -0
- package/dist/components/{buttons/TextButton/TextButton.js → text-button.js} +2 -2
- package/dist/components/text-input.d.ts +27 -0
- package/dist/components/text-input.js +241 -0
- package/dist/components/time-picker.d.ts +2 -0
- package/dist/components/time-picker.js +2 -0
- package/dist/components/toast.d.ts +17 -0
- package/dist/components/{status/Toast/Toast.js → toast.js} +11 -11
- package/dist/components/toggle-button.d.ts +12 -0
- package/dist/components/{buttons/ToggleButton/ToggleButton.js → toggle-button.js} +2 -2
- package/dist/components/toggle.d.ts +19 -0
- package/dist/components/toggle.js +74 -0
- package/dist/components/tooltip-ellipsis.d.ts +11 -0
- package/dist/components/{overlays/Tooltip/TooltipEllipsis.js → tooltip-ellipsis.js} +3 -3
- package/dist/components/tooltip.d.ts +16 -0
- package/dist/components/{overlays/Tooltip/Tooltip.js → tooltip.js} +9 -9
- package/dist/components/typography.d.ts +12 -0
- package/dist/components/typography.js +31 -0
- package/dist/config/confirmation.context.d.ts +22 -19
- package/dist/config/confirmation.context.js +3 -3
- package/dist/config/i18n.d.ts +311 -308
- package/dist/config/i18n.js +4 -4
- package/dist/config/link.context.d.ts +9 -7
- package/dist/config/link.context.js +2 -2
- package/dist/config/router.context.d.ts +11 -9
- package/dist/config/router.context.js +2 -2
- package/dist/config/theme.context.d.ts +19 -16
- package/dist/config/theme.context.js +99 -46
- package/dist/config/uiConfig.context.d.ts +80 -75
- package/dist/config/uiConfig.context.js +46 -9
- package/dist/config/uiOverrides.context.d.ts +205 -204
- package/dist/config/uiOverrides.context.js +2 -2
- package/dist/helpers/dynamicColumns.d.ts +27 -28
- package/dist/helpers/dynamicColumns.js +32 -31
- package/dist/helpers/dynamicInputs.d.ts +66 -74
- package/dist/helpers/dynamicInputs.js +21 -20
- package/dist/hooks/useAutosave.d.ts +12 -9
- package/dist/hooks/useAutosave.js +1 -1
- package/dist/hooks/useBreakpoint.d.ts +4 -2
- package/dist/hooks/useBreakpoint.js +37 -10
- package/dist/hooks/useDebounceCallback.d.ts +7 -4
- package/dist/hooks/useDebounceCallback.js +51 -17
- package/dist/hooks/useDeepCompare.d.ts +7 -4
- package/dist/hooks/useDeepCompare.js +4 -4
- package/dist/hooks/useFilters.d.ts +10 -7
- package/dist/hooks/useFilters.js +8 -6
- package/dist/hooks/useForm.d.ts +35 -35
- package/dist/hooks/useForm.js +6 -6
- package/dist/hooks/useFormAutosave.d.ts +16 -13
- package/dist/hooks/useFormAutosave.js +18 -17
- package/dist/hooks/useIntersectionObserver.d.ts +7 -5
- package/dist/hooks/useIntersectionObserver.js +2 -2
- package/dist/hooks/useKeyInteractions.d.ts +19 -16
- package/dist/hooks/useKeyInteractions.js +5 -5
- package/dist/hooks/useLocalStorage.d.ts +10 -8
- package/dist/hooks/useLocalStorage.js +3 -3
- package/dist/hooks/useLongPressRepeat.d.ts +10 -7
- package/dist/hooks/useLongPressRepeat.js +55 -20
- package/dist/hooks/usePagination.d.ts +9 -6
- package/dist/hooks/usePagination.js +2 -2
- package/dist/hooks/useQueryAutocomplete.js +2 -2
- package/dist/hooks/useScrollableListBox.d.ts +5 -2
- package/dist/hooks/useScrollableListBox.js +1 -1
- package/dist/hooks/useSorting.d.ts +8 -5
- package/dist/hooks/useSorting.js +1 -1
- package/dist/hooks/useStateAndRef.d.ts +5 -3
- package/dist/hooks/useStateAndRef.js +2 -2
- package/dist/hooks/useTableColumnConfig.d.ts +15 -13
- package/dist/hooks/useTableColumnConfig.js +1 -1
- package/dist/hooks/useTableNav.d.ts +79 -77
- package/dist/hooks/useTableNav.js +19 -37
- package/dist/hooks/useTranslationMemo.d.ts +5 -3
- package/dist/index.d.ts +145 -1
- package/dist/index.js +29 -29
- package/dist/rhf/Inputs.d.ts +55 -54
- package/dist/rhf/Inputs.js +62 -17
- package/dist/rhf/autocomplete.d.ts +3 -0
- package/dist/rhf/autocomplete.js +2 -0
- package/dist/rhf/checkbox-group.d.ts +3 -0
- package/dist/rhf/checkbox-group.js +2 -0
- package/dist/rhf/checkbox.d.ts +3 -0
- package/dist/rhf/checkbox.js +2 -0
- package/dist/rhf/components.d.ts +77 -75
- package/dist/rhf/components.js +43 -43
- package/dist/rhf/date-picker.d.ts +3 -0
- package/dist/rhf/date-picker.js +2 -0
- package/dist/rhf/date-range-picker.d.ts +3 -0
- package/dist/rhf/date-range-picker.js +2 -0
- package/dist/rhf/date-time-picker.d.ts +3 -0
- package/dist/rhf/date-time-picker.js +2 -0
- package/dist/rhf/dynamicInputs.d.ts +16 -14
- package/dist/rhf/dynamicInputs.js +1 -1
- package/dist/rhf/entry.utils.js +5 -0
- package/dist/rhf/fieldAdapter.d.ts +8 -6
- package/dist/rhf/form.types.d.ts +11 -10
- package/dist/rhf/number-input.d.ts +8 -0
- package/dist/rhf/number-input.js +7 -0
- package/dist/rhf/number-range-input.d.ts +8 -0
- package/dist/rhf/number-range-input.js +7 -0
- package/dist/rhf/password-input.d.ts +8 -0
- package/dist/rhf/password-input.js +7 -0
- package/dist/rhf/query-autocomplete.d.ts +2 -0
- package/dist/rhf/query-autocomplete.js +2 -0
- package/dist/rhf/query-select.d.ts +2 -0
- package/dist/rhf/query-select.js +2 -0
- package/dist/rhf/radio-group.d.ts +3 -0
- package/dist/rhf/radio-group.js +2 -0
- package/dist/rhf/segment.d.ts +3 -0
- package/dist/rhf/segment.js +2 -0
- package/dist/rhf/select.d.ts +3 -0
- package/dist/rhf/select.js +2 -0
- package/dist/rhf/slider.d.ts +3 -0
- package/dist/rhf/slider.js +2 -0
- package/dist/rhf/text-area.d.ts +8 -0
- package/dist/rhf/text-area.js +7 -0
- package/dist/rhf/text-input.d.ts +8 -0
- package/dist/rhf/text-input.js +7 -0
- package/dist/rhf/time-picker.d.ts +3 -0
- package/dist/rhf/time-picker.js +2 -0
- package/dist/rhf/toggle.d.ts +3 -0
- package/dist/rhf/toggle.js +2 -0
- package/dist/rhf/useAutosave.d.ts +12 -9
- package/dist/rhf/useForm.d.ts +13 -13
- package/dist/rhf/useFormAutosave.d.ts +17 -14
- package/dist/rhf/useFormAutosave.js +121 -34
- package/dist/rhf.d.ts +146 -225
- package/dist/rhf.js +120 -0
- package/dist/tanstack/autocomplete.d.ts +2 -0
- package/dist/tanstack/autocomplete.js +2 -0
- package/dist/tanstack/checkbox-group.d.ts +2 -0
- package/dist/tanstack/checkbox-group.js +2 -0
- package/dist/tanstack/checkbox.d.ts +2 -0
- package/dist/tanstack/checkbox.js +2 -0
- package/dist/tanstack/date-picker.d.ts +2 -0
- package/dist/tanstack/date-picker.js +2 -0
- package/dist/tanstack/date-range-picker.d.ts +2 -0
- package/dist/tanstack/date-range-picker.js +2 -0
- package/dist/tanstack/date-time-picker.d.ts +2 -0
- package/dist/tanstack/date-time-picker.js +2 -0
- package/dist/tanstack/form.d.ts +3 -0
- package/dist/tanstack/form.js +3 -0
- package/dist/tanstack/number-input.d.ts +2 -0
- package/dist/tanstack/number-input.js +2 -0
- package/dist/tanstack/number-range-input.d.ts +3 -0
- package/dist/tanstack/number-range-input.js +2 -0
- package/dist/tanstack/password-input.d.ts +2 -0
- package/dist/tanstack/password-input.js +2 -0
- package/dist/tanstack/query-autocomplete.d.ts +2 -0
- package/dist/tanstack/query-autocomplete.js +2 -0
- package/dist/tanstack/query-select.d.ts +2 -0
- package/dist/tanstack/query-select.js +2 -0
- package/dist/tanstack/radio-group.d.ts +2 -0
- package/dist/tanstack/radio-group.js +2 -0
- package/dist/tanstack/segment.d.ts +3 -0
- package/dist/tanstack/segment.js +2 -0
- package/dist/tanstack/select.d.ts +2 -0
- package/dist/tanstack/select.js +2 -0
- package/dist/tanstack/slider.d.ts +2 -0
- package/dist/tanstack/slider.js +2 -0
- package/dist/tanstack/table.d.ts +12 -0
- package/dist/tanstack/table.js +11 -0
- package/dist/tanstack/text-area.d.ts +2 -0
- package/dist/tanstack/text-area.js +2 -0
- package/dist/tanstack/text-input.d.ts +2 -0
- package/dist/tanstack/text-input.js +2 -0
- package/dist/tanstack/time-picker.d.ts +2 -0
- package/dist/tanstack/time-picker.js +2 -0
- package/dist/tanstack/toggle.d.ts +2 -0
- package/dist/tanstack/toggle.js +2 -0
- package/dist/tanstack.d.ts +151 -224
- package/dist/tanstack.js +45 -45
- package/dist/text-editor.d.ts +2 -2
- package/dist/tw-ui-plugin.d.ts +4 -2
- package/dist/tw-ui-plugin.js +1 -1
- package/dist/types/common.d.ts +11 -12
- package/dist/types/error-handling.d.ts +8 -5
- package/dist/utils/array.utils.d.ts +5 -2
- package/dist/utils/array.utils.js +1 -1
- package/dist/utils/compoundMapper.d.ts +12 -14
- package/dist/utils/compoundMapper.js +1 -1
- package/dist/utils/date-time.utils.d.ts +44 -41
- package/dist/utils/date-time.utils.js +7 -9
- package/dist/utils/date.utils.d.ts +6 -4
- package/dist/utils/date.utils.js +29 -6
- package/dist/utils/dom.utils.d.ts +7 -4
- package/dist/utils/dom.utils.js +2 -2
- package/dist/utils/file.utils.d.ts +20 -12
- package/dist/utils/file.utils.js +19 -8
- package/dist/utils/intl.utils.d.ts +7 -5
- package/dist/utils/intl.utils.js +2 -2
- package/dist/utils/isEqual.d.ts +4 -1
- package/dist/utils/isEqual.js +3 -3
- package/dist/utils/logger.d.ts +9 -6
- package/dist/utils/logger.js +1 -1
- package/dist/utils/object.utils.d.ts +12 -9
- package/dist/utils/object.utils.js +1 -1
- package/dist/utils/queries.utils.d.ts +6 -3
- package/dist/utils/queries.utils.js +1 -1
- package/dist/utils/query.utils.js +1 -1
- package/dist/utils/routing.utils.d.ts +6 -3
- package/dist/utils/routing.utils.js +1 -1
- package/dist/utils/string.utils.d.ts +6 -3
- package/dist/utils/string.utils.js +1 -1
- package/dist/utils/style-merge.util.d.ts +38 -41
- package/dist/utils/style-merge.util.js +7 -4
- package/dist/utils/zod.utils.d.ts +22 -19
- package/dist/utils/zod.utils.js +1 -1
- package/package.json +475 -8
- package/dist/assets/locales/en/translation.json.d.ts +0 -158
- package/dist/assets/locales/sl/translation.json.d.ts +0 -154
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +0 -16
- package/dist/components/Breadcrumbs/Breadcrumbs.js +0 -112
- package/dist/components/Menu/Menu.d.ts +0 -21
- package/dist/components/Menu/MenuDesktop.d.ts +0 -2
- package/dist/components/Menu/MenuMobile.d.ts +0 -2
- package/dist/components/buttons/IconButton/IconButton.d.ts +0 -11
- package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +0 -13
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +0 -15
- package/dist/components/buttons/PillButton/PillButton.d.ts +0 -12
- package/dist/components/buttons/SplitButton/SplitButton.d.ts +0 -12
- package/dist/components/buttons/TextButton/TextButton.d.ts +0 -12
- package/dist/components/buttons/ToggleButton/ToggleButton.d.ts +0 -9
- package/dist/components/buttons/shared/ButtonContent.d.ts +0 -14
- package/dist/components/inputs/Checkbox/Checkbox.d.ts +0 -20
- package/dist/components/inputs/Checkbox/Checkbox.js +0 -236
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.d.ts +0 -9
- package/dist/components/inputs/Checkbox/CheckboxGroup.d.ts +0 -26
- package/dist/components/inputs/Checkbox/CheckboxGroup.js +0 -392
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +0 -29
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +0 -22
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +0 -27
- package/dist/components/inputs/DateTime/shared/CalendarHeader.d.ts +0 -18
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.d.ts +0 -17
- package/dist/components/inputs/DateTime/shared/DateField.d.ts +0 -21
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +0 -28
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.d.ts +0 -18
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.d.ts +0 -8
- package/dist/components/inputs/DateTime/shared/MonthPicker.d.ts +0 -11
- package/dist/components/inputs/DateTime/shared/RangeCalendar.d.ts +0 -26
- package/dist/components/inputs/DateTime/shared/TimeField.d.ts +0 -12
- package/dist/components/inputs/DateTime/shared/TimePickerForm.d.ts +0 -10
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +0 -25
- package/dist/components/inputs/DateTime/shared/YearPicker.d.ts +0 -12
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +0 -15
- package/dist/components/inputs/DateTime/shared/datePickerValue.utils.d.ts +0 -1
- package/dist/components/inputs/DateTime/shared/datePickerValue.utils.spec.d.ts +0 -1
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +0 -2
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +0 -1
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +0 -41
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +0 -1
- package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.d.ts +0 -2
- package/dist/components/inputs/File/FileUpload.d.ts +0 -4
- package/dist/components/inputs/File/FileUploadContainer.d.ts +0 -3
- package/dist/components/inputs/File/FileUploadContainer.js +0 -22
- package/dist/components/inputs/File/InputUpload.d.ts +0 -4
- package/dist/components/inputs/File/InputUpload.js +0 -157
- package/dist/components/inputs/File/index.d.ts +0 -9
- package/dist/components/inputs/File/shared/FileCard.d.ts +0 -9
- package/dist/components/inputs/File/shared/FileCardList.d.ts +0 -9
- package/dist/components/inputs/File/shared/FileUploadContent.d.ts +0 -10
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.d.ts +0 -9
- package/dist/components/inputs/File/shared/FileUploadContentError.d.ts +0 -11
- package/dist/components/inputs/File/shared/FileUploadContentFilled.d.ts +0 -11
- package/dist/components/inputs/File/shared/FileUploadContentLoading.d.ts +0 -9
- package/dist/components/inputs/File/shared/InputUploadContent.d.ts +0 -9
- package/dist/components/inputs/File/shared/InputUploadFilled.d.ts +0 -8
- package/dist/components/inputs/FormField/FormField.d.ts +0 -20
- package/dist/components/inputs/FormField/FormField.js +0 -127
- package/dist/components/inputs/FormField/FormFieldHeaderClose.d.ts +0 -5
- package/dist/components/inputs/FormField/FormFieldHelper.d.ts +0 -8
- package/dist/components/inputs/FormField/FormFieldLabel.d.ts +0 -13
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +0 -23
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +0 -494
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +0 -36
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +0 -338
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.d.ts +0 -7
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +0 -61
- package/dist/components/inputs/Input/TextArea/TextArea.d.ts +0 -19
- package/dist/components/inputs/Input/TextArea/TextArea.js +0 -346
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +0 -23
- package/dist/components/inputs/Input/TextInput/TextInput.js +0 -470
- package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +0 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +0 -22
- package/dist/components/inputs/RadioGroup/RadioGroup.js +0 -371
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +0 -12
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +0 -4
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +0 -176
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +0 -15
- package/dist/components/inputs/Selection/Select/QuerySelect.js +0 -172
- package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +0 -5
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +0 -15
- package/dist/components/inputs/Selection/shared/SelectInputTags.d.ts +0 -12
- package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +0 -9
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.d.ts +0 -7
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.d.ts +0 -4
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.d.ts +0 -6
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.d.ts +0 -5
- package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +0 -5
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +0 -9
- package/dist/components/inputs/Selection/shared/select.context.d.ts +0 -32
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +0 -23
- package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +0 -1
- package/dist/components/inputs/Selection/shared/useSelectItems.d.ts +0 -23
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +0 -84
- package/dist/components/inputs/Slider/Slider.d.ts +0 -19
- package/dist/components/inputs/Slider/Slider.js +0 -285
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.d.ts +0 -7
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.d.ts +0 -10
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.d.ts +0 -2
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.d.ts +0 -2
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.d.ts +0 -2
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.d.ts +0 -6
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.d.ts +0 -2
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.d.ts +0 -2
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.d.ts +0 -2
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.d.ts +0 -2
- package/dist/components/inputs/TextEditor/textEditor.types.d.ts +0 -5
- package/dist/components/inputs/Toggle/Toggle.d.ts +0 -16
- package/dist/components/inputs/Toggle/Toggle.js +0 -234
- package/dist/components/inputs/shared/CheckContent.d.ts +0 -9
- package/dist/components/inputs/shared/InputClear.d.ts +0 -10
- package/dist/components/inputs/shared/TooltipWrapper.d.ts +0 -10
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +0 -15
- package/dist/components/navigation/Accordion/Accordion.d.ts +0 -3
- package/dist/components/navigation/Accordion/Accordion.js +0 -34
- package/dist/components/navigation/Accordion/AccordionItem.d.ts +0 -2
- package/dist/components/navigation/Stepper/Stepper.d.ts +0 -2
- package/dist/components/navigation/Stepper/Stepper.js +0 -34
- package/dist/components/navigation/Stepper/StepperItem.d.ts +0 -2
- package/dist/components/navigation/Stepper/StepperSeparator.d.ts +0 -5
- package/dist/components/overlays/ActionModal/ActionModal.d.ts +0 -24
- package/dist/components/overlays/ActionModal/ActionModal.js +0 -54
- package/dist/components/overlays/BottomSheet/BottomSheet.d.ts +0 -32
- package/dist/components/overlays/BottomSheet/BottomSheetHeader.d.ts +0 -13
- package/dist/components/overlays/Drawer/Drawer.d.ts +0 -15
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.d.ts +0 -17
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +0 -45
- package/dist/components/overlays/Tooltip/Tooltip.d.ts +0 -13
- package/dist/components/overlays/Tooltip/TooltipEllipsis.d.ts +0 -8
- package/dist/components/segment/Segment.d.ts +0 -4
- package/dist/components/segment/SegmentItem.d.ts +0 -2
- package/dist/components/shared/pagination/Pagination.d.ts +0 -9
- package/dist/components/shared/pagination/Pagination.js +0 -45
- package/dist/components/shared/pagination/minWidth.cva.d.ts +0 -3
- package/dist/components/status/Alert/Alert.d.ts +0 -11
- package/dist/components/status/Alert/Alert.js +0 -47
- package/dist/components/status/Loader/Loader.d.ts +0 -5
- package/dist/components/status/Toast/Toast.d.ts +0 -14
- package/dist/components/text/Link/Link.d.ts +0 -9
- package/dist/components/text/Pill/Pill.d.ts +0 -15
- package/dist/components/text/Tag/Tag.d.ts +0 -15
- package/dist/components/text/Typography/Typography.d.ts +0 -11
- package/dist/components/text/Typography/Typography.js +0 -16
- package/dist/hooks/useFormAutosave.spec.d.ts +0 -1
- package/dist/hooks/useKeyInteractions.spec.d.ts +0 -1
- package/dist/hooks/useQueryAutocomplete.d.ts +0 -13
- package/dist/rhf/entrypoints.type-test.d.ts +0 -1
- package/dist/types/react-query.d.ts +0 -6
- package/dist/utils/array.utils.spec.d.ts +0 -1
- package/dist/utils/compoundMapper.spec.d.ts +0 -1
- package/dist/utils/date-time.utils.spec.d.ts +0 -1
- package/dist/utils/date.utils.spec.d.ts +0 -1
- package/dist/utils/intl.utils.spec.d.ts +0 -1
- package/dist/utils/query.utils.d.ts +0 -4
- package/dist/utils/rest.utils.d.ts +0 -10
- package/dist/utils/rest.utils.js +0 -33
- package/dist/utils/style-merge.util.spec.d.ts +0 -1
|
@@ -4,11 +4,11 @@ import { MonthPicker } from "./MonthPicker.js";
|
|
|
4
4
|
import { TimePickerForm } from "./TimePickerForm.js";
|
|
5
5
|
import { YearPicker } from "./YearPicker.js";
|
|
6
6
|
import { clsx } from "clsx";
|
|
7
|
-
import { useCallback, useEffect, useState } from "react";
|
|
7
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { useCalendar } from "@react-aria/calendar";
|
|
10
10
|
//#region src/components/inputs/DateTime/shared/Calendar.tsx
|
|
11
|
-
|
|
11
|
+
const Calendar = ({ className, includesTime, datePickerState, hourCycle, isTimeOptional, onApply, onMonthYearChange, onMonthYearCommit, selectedDate, granularity = "day", setDateValueOnDateSelection = false, onDateSelectionChange, ...props }) => {
|
|
12
12
|
const [toggleState, setToggleState] = useState(() => {
|
|
13
13
|
if (granularity === "year") return "year";
|
|
14
14
|
if (granularity === "month") return "month";
|
|
@@ -52,30 +52,33 @@ var Calendar = ({ className, includesTime, datePickerState, hourCycle, isTimeOpt
|
|
|
52
52
|
}
|
|
53
53
|
setToggleState("year");
|
|
54
54
|
};
|
|
55
|
-
const handleHeaderMonthNavigation = (months) => {
|
|
56
|
-
if (toggleState) return;
|
|
57
|
-
if (!onMonthYearChange) return;
|
|
55
|
+
const handleHeaderMonthNavigation = useCallback((months) => {
|
|
56
|
+
if (toggleState || !onMonthYearChange) return;
|
|
58
57
|
const focusedDate = props.state.focusedDate;
|
|
59
58
|
if (months === -1) {
|
|
60
59
|
onMonthYearChange(focusedDate.subtract({ months: 1 }));
|
|
61
60
|
return;
|
|
62
61
|
}
|
|
63
62
|
onMonthYearChange(focusedDate.add({ months: 1 }));
|
|
64
|
-
}
|
|
65
|
-
|
|
63
|
+
}, [
|
|
64
|
+
toggleState,
|
|
65
|
+
onMonthYearChange,
|
|
66
|
+
props.state.focusedDate
|
|
67
|
+
]);
|
|
68
|
+
const headerPrevButtonProps = useMemo(() => ({
|
|
66
69
|
...prevButtonProps,
|
|
67
70
|
onPress: (event) => {
|
|
68
71
|
prevButtonProps.onPress?.(event);
|
|
69
72
|
handleHeaderMonthNavigation(-1);
|
|
70
73
|
}
|
|
71
|
-
};
|
|
72
|
-
const headerNextButtonProps = {
|
|
74
|
+
}), [prevButtonProps, handleHeaderMonthNavigation]);
|
|
75
|
+
const headerNextButtonProps = useMemo(() => ({
|
|
73
76
|
...nextButtonProps,
|
|
74
|
-
onPress: (
|
|
75
|
-
nextButtonProps.onPress?.(
|
|
77
|
+
onPress: (event) => {
|
|
78
|
+
nextButtonProps.onPress?.(event);
|
|
76
79
|
handleHeaderMonthNavigation(1);
|
|
77
80
|
}
|
|
78
|
-
};
|
|
81
|
+
}), [nextButtonProps, handleHeaderMonthNavigation]);
|
|
79
82
|
const onDateSelection = useCallback((date) => {
|
|
80
83
|
if (!includesTime || !setDateValueOnDateSelection) return;
|
|
81
84
|
datePickerState.setDateValue(date);
|
|
@@ -84,8 +87,8 @@ var Calendar = ({ className, includesTime, datePickerState, hourCycle, isTimeOpt
|
|
|
84
87
|
datePickerState,
|
|
85
88
|
setDateValueOnDateSelection
|
|
86
89
|
]);
|
|
87
|
-
const handleDateChange = (
|
|
88
|
-
const resolvedDate =
|
|
90
|
+
const handleDateChange = (selectedDate) => {
|
|
91
|
+
const resolvedDate = selectedDate ?? props.state.focusedDate;
|
|
89
92
|
if (includesTime && resolvedDate && setDateValueOnDateSelection) {
|
|
90
93
|
datePickerState.setDateValue(resolvedDate);
|
|
91
94
|
onDateSelectionChange?.(resolvedDate);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Typography } from "../../../
|
|
1
|
+
import { Typography } from "../../../typography.js";
|
|
2
2
|
import { clsx } from "clsx";
|
|
3
3
|
import { useCallback, useMemo, useRef } from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -7,10 +7,10 @@ import { isSameDay } from "@internationalized/date";
|
|
|
7
7
|
import { useCalendarCell } from "@react-aria/calendar";
|
|
8
8
|
import { useFocusRing } from "@react-aria/focus";
|
|
9
9
|
//#region src/components/inputs/DateTime/shared/CalendarCell.tsx
|
|
10
|
-
|
|
10
|
+
const isRange = (state) => {
|
|
11
11
|
return "highlightedRange" in state;
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
const CalendarCell = ({ state, onApply, onDoubleClickApply, shouldApplyOnDateSelection = true, shouldCloseOnSelect = true, onDateSelection, onDateHover, rangeSelection, hoverDate, onKeyboardNavigation, ...props }) => {
|
|
14
14
|
const ref = useRef(null);
|
|
15
15
|
const { cellProps, buttonProps, formattedDate, isSelected, isDisabled, isOutsideVisibleRange, isFocused } = useCalendarCell(props, state, ref);
|
|
16
16
|
const { focusProps } = useFocusRing();
|
|
@@ -28,9 +28,9 @@ var CalendarCell = ({ state, onApply, onDoubleClickApply, shouldApplyOnDateSelec
|
|
|
28
28
|
shouldCloseOnSelect,
|
|
29
29
|
onApply
|
|
30
30
|
]);
|
|
31
|
-
const onDoubleClick = useCallback((
|
|
31
|
+
const onDoubleClick = useCallback((event) => {
|
|
32
32
|
if (isDisabled) return;
|
|
33
|
-
|
|
33
|
+
event.preventDefault();
|
|
34
34
|
onDoubleClickApply?.(props.date);
|
|
35
35
|
}, [
|
|
36
36
|
isDisabled,
|
|
@@ -56,14 +56,14 @@ var CalendarCell = ({ state, onApply, onDoubleClickApply, shouldApplyOnDateSelec
|
|
|
56
56
|
isInRange = isAfterStart && isBeforeEnd;
|
|
57
57
|
}
|
|
58
58
|
if (rangeSelection.isSelecting && rangeSelection.start && hoverDate && !rangeSelection.end) {
|
|
59
|
-
const
|
|
59
|
+
const dateValue = props.date;
|
|
60
60
|
const { start } = rangeSelection;
|
|
61
61
|
const end = hoverDate;
|
|
62
62
|
const earlierDate = start.compare(end) <= 0 ? start : end;
|
|
63
63
|
const laterDate = start.compare(end) <= 0 ? end : start;
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
isHoverRange =
|
|
64
|
+
const isAfterStart = dateValue.compare(earlierDate) > 0;
|
|
65
|
+
const isBeforeEnd = dateValue.compare(laterDate) < 0;
|
|
66
|
+
isHoverRange = isAfterStart && isBeforeEnd;
|
|
67
67
|
}
|
|
68
68
|
} else {
|
|
69
69
|
isSelectionStart = isRange(state) && state.highlightedRange ? isSameDay(props.date, state.highlightedRange.start) : isSelected;
|
|
@@ -71,10 +71,10 @@ var CalendarCell = ({ state, onApply, onDoubleClickApply, shouldApplyOnDateSelec
|
|
|
71
71
|
isSelectedCell = isSelectionStart || isSelectionEnd || !isRange(state) && isSelected;
|
|
72
72
|
isInRange = isRange(state) && isSelected && !isSelectionStart && !isSelectionEnd;
|
|
73
73
|
if (isRange(state) && state.highlightedRange && !isSelected) {
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
isHoverRange =
|
|
74
|
+
const dateValue = props.date;
|
|
75
|
+
const isAfterStart = dateValue.compare(state.highlightedRange.start) > 0;
|
|
76
|
+
const isBeforeEnd = dateValue.compare(state.highlightedRange.end) < 0;
|
|
77
|
+
isHoverRange = isAfterStart && isBeforeEnd;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
return {
|
|
@@ -92,12 +92,12 @@ var CalendarCell = ({ state, onApply, onDoubleClickApply, shouldApplyOnDateSelec
|
|
|
92
92
|
isSelected,
|
|
93
93
|
hoverDate
|
|
94
94
|
]);
|
|
95
|
-
const handleEvent = (
|
|
95
|
+
const handleEvent = (event, eventHandler) => {
|
|
96
96
|
if (isOutsideVisibleRange) {
|
|
97
97
|
state.selectDate(props.date);
|
|
98
98
|
state.setFocusedDate(props.date);
|
|
99
99
|
}
|
|
100
|
-
eventHandler?.(
|
|
100
|
+
eventHandler?.(event);
|
|
101
101
|
if (isSelected && shouldCloseOnSelect) onApply?.(props.date);
|
|
102
102
|
};
|
|
103
103
|
const onMouseEnter = useCallback(() => {
|
|
@@ -111,8 +111,8 @@ var CalendarCell = ({ state, onApply, onDoubleClickApply, shouldApplyOnDateSelec
|
|
|
111
111
|
if (onDateHover && selectionState.isSelectingMode) onDateHover(null);
|
|
112
112
|
}, [onDateHover, selectionState.isSelectingMode]);
|
|
113
113
|
const cellClassName = useMemo(() => {
|
|
114
|
-
const { isSelectedCell
|
|
115
|
-
return clsx("mx-auto flex h-10 w-full max-w-10 items-center justify-center rounded-button-rounding-m p-2", "focus:outline-none focus-visible:outline-1 focus-visible:outline-interactive-contained-primary-focus focus-visible:outline-offset-1", "border border-transparent border-solid", !
|
|
114
|
+
const { isSelectedCell, isInRange, isHoverRange, isSelectingMode, isSelectionStart, isSelectionEnd } = selectionState;
|
|
115
|
+
return clsx("mx-auto flex h-10 w-full max-w-10 items-center justify-center rounded-button-rounding-m p-2", "focus:outline-none focus-visible:outline-1 focus-visible:outline-interactive-contained-primary-focus focus-visible:outline-offset-1", "border border-transparent border-solid", !isSelectedCell && !isOutsideVisibleRange && "bg-elevation-fill-default-1 text-interactive-text-secondary-idle", !isSelectedCell && isOutsideVisibleRange && "bg-elevation-fill-default-1 text-interactive-text-secondary-disabled", isSelectedCell && !isOutsideVisibleRange && "bg-interactive-contained-primary-idle text-interactive-contained-primary-on-idle", isSelectedCell && !isOutsideVisibleRange && rangeSelection && !rangeSelection.isSelecting && isSelectionStart && !isSelectionEnd && "rounded-r-none", isSelectedCell && !isOutsideVisibleRange && rangeSelection && !rangeSelection.isSelecting && isSelectionEnd && !isSelectionStart && "rounded-l-none", isDisabled && !isOutsideVisibleRange && "cursor-default", isDisabled && "opacity-20", !isSelectedCell && !isInRange && !isHoverRange && !isSelectingMode && !isDisabled && !isOutsideVisibleRange && "[@media(pointer:fine)]:hover:border-elevation-outline-default-1 [@media(pointer:fine)]:hover:text-interactive-text-secondary-hover", isInRange && !isOutsideVisibleRange && "!rounded-none !bg-elevation-fill-default-2 text-interactive-text-secondary-hover", isHoverRange && !isOutsideVisibleRange && "!rounded-none !bg-elevation-fill-default-2 text-interactive-text-secondary-hover", !isInRange && !isSelectedCell && isSelectingMode && "hover:bg-interactive-contained-primary-idle hover:text-interactive-text-primary-idle-inverted", isSelectingMode && !isSelectedCell && !isInRange && !isHoverRange && !isDisabled && !isOutsideVisibleRange && "transition-all duration-75 hover:border-elevation-outline-default-1", isFocused && !isSelectedCell && !isDisabled && !isOutsideVisibleRange && "ring-2 ring-inset ring-interactive-contained-primary-focus");
|
|
116
116
|
}, [
|
|
117
117
|
selectionState,
|
|
118
118
|
isOutsideVisibleRange,
|
|
@@ -131,7 +131,7 @@ var CalendarCell = ({ state, onApply, onDoubleClickApply, shouldApplyOnDateSelec
|
|
|
131
131
|
className: cellClassName,
|
|
132
132
|
onClick: (e) => handleEvent(e, onClick),
|
|
133
133
|
onDoubleClick,
|
|
134
|
-
onKeyDown: (
|
|
134
|
+
onKeyDown: (e) => handleEvent(e, () => onKeyboardNavigation?.(e, props.date)),
|
|
135
135
|
children: /* @__PURE__ */ jsx(Typography, {
|
|
136
136
|
as: "span",
|
|
137
137
|
size: "label-2",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Typography } from "../../../
|
|
1
|
+
import { Typography } from "../../../typography.js";
|
|
2
2
|
import { CalendarCell } from "./CalendarCell.js";
|
|
3
3
|
import { clsx } from "clsx";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useCalendarGrid } from "@react-aria/calendar";
|
|
6
6
|
//#region src/components/inputs/DateTime/shared/CalendarGrid.tsx
|
|
7
|
-
|
|
7
|
+
const WEEK_INDICES = [
|
|
8
8
|
0,
|
|
9
9
|
1,
|
|
10
10
|
2,
|
|
@@ -12,7 +12,8 @@ var WEEK_INDICES = [
|
|
|
12
12
|
4,
|
|
13
13
|
5
|
|
14
14
|
];
|
|
15
|
-
|
|
15
|
+
const NO_CALENDAR_OFFSET = {};
|
|
16
|
+
const CalendarGrid = ({ state, onApply, onDoubleClickApply, shouldApplyOnDateSelection, shouldCloseOnSelect, offset = NO_CALENDAR_OFFSET, onDateSelection, onDateHover, rangeSelection, hoverDate, onKeyboardNavigation, className, calendarSide, ...props }) => {
|
|
16
17
|
const { gridProps, headerProps, weekDays } = useCalendarGrid({
|
|
17
18
|
...props,
|
|
18
19
|
weekdayStyle: "short"
|
|
@@ -34,9 +35,9 @@ var CalendarGrid = ({ state, onApply, onDoubleClickApply, shouldApplyOnDateSelec
|
|
|
34
35
|
className: "bg-elevation-fill-default-1 py-2 text-interactive-text-secondary-idle",
|
|
35
36
|
children: day.substring(0, 2)
|
|
36
37
|
}) }, day)) })
|
|
37
|
-
}), /* @__PURE__ */ jsx("tbody", { children: WEEK_INDICES.map((weekIndex) => /* @__PURE__ */ jsx("tr", { children: state.getDatesInWeek(weekIndex, startDate).map((
|
|
38
|
+
}), /* @__PURE__ */ jsx("tbody", { children: WEEK_INDICES.map((weekIndex) => /* @__PURE__ */ jsx("tr", { children: state.getDatesInWeek(weekIndex, startDate).map((date, i) => date ? /* @__PURE__ */ jsx(CalendarCell, {
|
|
38
39
|
state,
|
|
39
|
-
date
|
|
40
|
+
date,
|
|
40
41
|
onApply,
|
|
41
42
|
onDoubleClickApply,
|
|
42
43
|
shouldApplyOnDateSelection,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PillButton } from "../../../
|
|
1
|
+
import { PillButton } from "../../../pill-button.js";
|
|
2
2
|
import { ChevronDown, ChevronLeft, ChevronRight, ChevronUp } from "lucide-react";
|
|
3
3
|
import { clsx } from "clsx";
|
|
4
4
|
import { Button, ToggleButtonGroup } from "react-aria-components";
|
|
@@ -6,14 +6,14 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
import { CalendarDateTime, Time } from "@internationalized/date";
|
|
7
7
|
import { useDateFormatter } from "@react-aria/i18n";
|
|
8
8
|
//#region src/components/inputs/DateTime/shared/CalendarHeader.tsx
|
|
9
|
-
|
|
9
|
+
const HourCycle = {
|
|
10
10
|
12: "h12",
|
|
11
11
|
24: "h23"
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
const getTimeFormatterDate = (timeValue, timeZone) => {
|
|
14
14
|
return new CalendarDateTime(2e3, 1, 1, timeValue.hour, timeValue.minute).toDate(timeZone);
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
const CalendarHeader = ({ calendarState, datePickerState, prevButtonProps, nextButtonProps, includesTime, isTimeOptional, hourCycle, granularity = "day", toggleState, setToggleState }) => {
|
|
17
17
|
const formatter = useDateFormatter({
|
|
18
18
|
month: "long",
|
|
19
19
|
timeZone: calendarState.timeZone
|
|
@@ -28,7 +28,8 @@ var CalendarHeader = ({ calendarState, datePickerState, prevButtonProps, nextBut
|
|
|
28
28
|
const hasTimeValue = !!datePickerState?.timeValue;
|
|
29
29
|
let timeLabel = "--:--";
|
|
30
30
|
if (isTimeOptional || hasTimeValue) {
|
|
31
|
-
const
|
|
31
|
+
const timeValue = datePickerState?.timeValue || new Time(0, 0);
|
|
32
|
+
const date = getTimeFormatterDate(timeValue, calendarState.timeZone);
|
|
32
33
|
timeLabel = timeFormatter.format(date);
|
|
33
34
|
}
|
|
34
35
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -73,8 +74,8 @@ var CalendarHeader = ({ calendarState, datePickerState, prevButtonProps, nextBut
|
|
|
73
74
|
icon: toggleState === "year" ? ChevronUp : ChevronDown,
|
|
74
75
|
toggle: true,
|
|
75
76
|
isSelected: toggleState === "year",
|
|
76
|
-
onChange: (
|
|
77
|
-
if (
|
|
77
|
+
onChange: (isSelected) => {
|
|
78
|
+
if (isSelected) {
|
|
78
79
|
setToggleState("year");
|
|
79
80
|
return;
|
|
80
81
|
}
|
|
@@ -97,7 +98,7 @@ var CalendarHeader = ({ calendarState, datePickerState, prevButtonProps, nextBut
|
|
|
97
98
|
icon: toggleState === "time" ? ChevronUp : ChevronDown,
|
|
98
99
|
toggle: true,
|
|
99
100
|
isSelected: toggleState === "time",
|
|
100
|
-
onChange: (
|
|
101
|
+
onChange: (isSelected) => setToggleState(isSelected ? "time" : null),
|
|
101
102
|
children: timeLabel
|
|
102
103
|
})
|
|
103
104
|
]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InlineIconButton } from "../../../
|
|
2
|
-
import { PillButton } from "../../../
|
|
1
|
+
import { InlineIconButton } from "../../../inline-icon-button.js";
|
|
2
|
+
import { PillButton } from "../../../pill-button.js";
|
|
3
3
|
import "../../../../config/i18n.js";
|
|
4
4
|
import { Select } from "../../Selection/Select/Select.js";
|
|
5
5
|
import { ChevronDown, ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from "lucide-react";
|
|
@@ -8,7 +8,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
import { useTranslation } from "react-i18next";
|
|
9
9
|
import { useDateFormatter } from "@react-aria/i18n";
|
|
10
10
|
//#region src/components/inputs/DateTime/shared/CalendarSelectHeader.tsx
|
|
11
|
-
|
|
11
|
+
const CalendarSelectHeader = ({ state, isPrevMonthDisabled, isPrevYearDisabled, isNextMonthDisabled, isNextYearDisabled, offset = { months: 0 }, onNavigate, maxDate, minDate }) => {
|
|
12
12
|
const { t } = useTranslation("ui");
|
|
13
13
|
const displayDate = state.visibleRange.start.add(offset);
|
|
14
14
|
const currentMonth = displayDate.month - 1;
|
|
@@ -31,28 +31,28 @@ var CalendarSelectHeader = ({ state, isPrevMonthDisabled, isPrevYearDisabled, is
|
|
|
31
31
|
state.focusedDate,
|
|
32
32
|
state.timeZone
|
|
33
33
|
]);
|
|
34
|
-
const years = Array.from({ length: 201 }, (_,
|
|
34
|
+
const years = Array.from({ length: 201 }, (_, i) => currentYear - 100 + i);
|
|
35
35
|
const getAvailableMonths = () => {
|
|
36
|
-
return MONTHS.map((month,
|
|
37
|
-
const monthDate = displayDate.set({ month:
|
|
36
|
+
return MONTHS.map((month, i) => {
|
|
37
|
+
const monthDate = displayDate.set({ month: i + 1 });
|
|
38
38
|
let isDisabled = false;
|
|
39
39
|
if (maxDate) isDisabled = monthDate.year > maxDate.year || monthDate.year === maxDate.year && monthDate.month >= maxDate.month;
|
|
40
40
|
if (minDate) isDisabled = monthDate.year < minDate.year || monthDate.year === minDate.year && monthDate.month <= minDate.month;
|
|
41
41
|
return {
|
|
42
42
|
month,
|
|
43
|
-
value:
|
|
43
|
+
value: i,
|
|
44
44
|
isDisabled
|
|
45
45
|
};
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
48
|
const getAvailableYears = () => {
|
|
49
49
|
return years.map((year) => {
|
|
50
|
-
let
|
|
51
|
-
if (maxDate)
|
|
52
|
-
if (minDate && !
|
|
50
|
+
let isDisabled = false;
|
|
51
|
+
if (maxDate) isDisabled = year > maxDate.year || year === maxDate.year && displayDate.month >= maxDate.month;
|
|
52
|
+
if (minDate && !isDisabled) isDisabled = year < minDate.year || year === minDate.year && displayDate.month <= minDate.month;
|
|
53
53
|
return {
|
|
54
54
|
year,
|
|
55
|
-
isDisabled
|
|
55
|
+
isDisabled
|
|
56
56
|
};
|
|
57
57
|
});
|
|
58
58
|
};
|
|
@@ -63,34 +63,34 @@ var CalendarSelectHeader = ({ state, isPrevMonthDisabled, isPrevYearDisabled, is
|
|
|
63
63
|
const newDate = displayDate.set({ month: value + 1 });
|
|
64
64
|
onNavigate?.(newDate);
|
|
65
65
|
};
|
|
66
|
-
const handleYearChange = (
|
|
67
|
-
if (
|
|
68
|
-
const
|
|
69
|
-
onNavigate?.(
|
|
66
|
+
const handleYearChange = (value) => {
|
|
67
|
+
if (value === null) return;
|
|
68
|
+
const newDate = displayDate.set({ year: value });
|
|
69
|
+
onNavigate?.(newDate);
|
|
70
70
|
};
|
|
71
71
|
const handlePrevMonth = (e) => {
|
|
72
72
|
e.preventDefault();
|
|
73
73
|
e.stopPropagation();
|
|
74
|
-
const
|
|
75
|
-
onNavigate?.(
|
|
74
|
+
const newDate = displayDate.subtract({ months: 1 });
|
|
75
|
+
onNavigate?.(newDate);
|
|
76
76
|
};
|
|
77
|
-
const handleNextMonth = (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
onNavigate?.(
|
|
77
|
+
const handleNextMonth = (e) => {
|
|
78
|
+
e.preventDefault();
|
|
79
|
+
e.stopPropagation();
|
|
80
|
+
const newDate = displayDate.add({ months: 1 });
|
|
81
|
+
onNavigate?.(newDate);
|
|
82
82
|
};
|
|
83
|
-
const handlePrevYear = (
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
onNavigate?.(
|
|
83
|
+
const handlePrevYear = (e) => {
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
e.stopPropagation();
|
|
86
|
+
const newDate = displayDate.subtract({ years: 1 });
|
|
87
|
+
onNavigate?.(newDate);
|
|
88
88
|
};
|
|
89
|
-
const handleNextYear = (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
onNavigate?.(
|
|
89
|
+
const handleNextYear = (e) => {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
e.stopPropagation();
|
|
92
|
+
const newDate = displayDate.add({ years: 1 });
|
|
93
|
+
onNavigate?.(newDate);
|
|
94
94
|
};
|
|
95
95
|
return /* @__PURE__ */ jsxs("div", {
|
|
96
96
|
className: "flex w-full items-center justify-between gap-3 border-elevation-outline-default-1 border-b border-solid px-3 py-2-5",
|
|
@@ -108,7 +108,7 @@ var CalendarSelectHeader = ({ state, isPrevMonthDisabled, isPrevYearDisabled, is
|
|
|
108
108
|
isDisabled: isPrevMonthDisabled,
|
|
109
109
|
onClick: handlePrevMonth,
|
|
110
110
|
icon: ChevronLeft,
|
|
111
|
-
label: t(($
|
|
111
|
+
label: t(($) => $.ui.datePicker.navigation.previousMonth)
|
|
112
112
|
})]
|
|
113
113
|
}),
|
|
114
114
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -124,11 +124,11 @@ var CalendarSelectHeader = ({ state, isPrevMonthDisabled, isPrevYearDisabled, is
|
|
|
124
124
|
children: MONTHS[currentMonth].slice(0, 3)
|
|
125
125
|
}),
|
|
126
126
|
ignoreTriggerWidth: true,
|
|
127
|
-
items: availableMonths.map(({ month
|
|
128
|
-
label:
|
|
129
|
-
id:
|
|
130
|
-
isDisabled
|
|
131
|
-
})).filter(({ isDisabled
|
|
127
|
+
items: availableMonths.map(({ month, value, isDisabled }) => ({
|
|
128
|
+
label: month,
|
|
129
|
+
id: value,
|
|
130
|
+
isDisabled
|
|
131
|
+
})).filter(({ isDisabled }) => !isDisabled),
|
|
132
132
|
value: currentMonth,
|
|
133
133
|
onChange: handleMonthChange
|
|
134
134
|
}), /* @__PURE__ */ jsx(Select, {
|
|
@@ -141,11 +141,11 @@ var CalendarSelectHeader = ({ state, isPrevMonthDisabled, isPrevYearDisabled, is
|
|
|
141
141
|
icon: ChevronDown,
|
|
142
142
|
children: currentYear.toString()
|
|
143
143
|
}),
|
|
144
|
-
items: availableYears.map(({ year
|
|
145
|
-
label:
|
|
146
|
-
id:
|
|
147
|
-
isDisabled
|
|
148
|
-
})).filter(({ isDisabled
|
|
144
|
+
items: availableYears.map(({ year, isDisabled }) => ({
|
|
145
|
+
label: year.toString(),
|
|
146
|
+
id: year,
|
|
147
|
+
isDisabled
|
|
148
|
+
})).filter(({ isDisabled }) => !isDisabled),
|
|
149
149
|
value: currentYear,
|
|
150
150
|
onChange: handleYearChange
|
|
151
151
|
})]
|
|
@@ -157,13 +157,13 @@ var CalendarSelectHeader = ({ state, isPrevMonthDisabled, isPrevYearDisabled, is
|
|
|
157
157
|
isDisabled: isNextMonthDisabled,
|
|
158
158
|
onClick: handleNextMonth,
|
|
159
159
|
icon: ChevronRight,
|
|
160
|
-
label: t(($
|
|
160
|
+
label: t(($) => $.ui.datePicker.navigation.nextMonth)
|
|
161
161
|
}), /* @__PURE__ */ jsx(InlineIconButton, {
|
|
162
162
|
color: "secondary",
|
|
163
163
|
isDisabled: isNextYearDisabled,
|
|
164
164
|
onClick: handleNextYear,
|
|
165
165
|
icon: ChevronsRight,
|
|
166
|
-
label: t(($
|
|
166
|
+
label: t(($) => $.ui.datePicker.navigation.nextYear)
|
|
167
167
|
})]
|
|
168
168
|
})
|
|
169
169
|
]
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { DateSegmentItem } from "./DateSegmentItem.js";
|
|
2
2
|
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
3
|
+
import { DateUtils } from "../../../../utils/date.utils.js";
|
|
3
4
|
import { clsx } from "clsx";
|
|
4
5
|
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef } from "react";
|
|
5
6
|
import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
|
|
6
7
|
import { useDateField, useLocale } from "react-aria";
|
|
7
8
|
import { CalendarDate, CalendarDateTime, createCalendar } from "@internationalized/date";
|
|
8
|
-
import { DateTime } from "luxon";
|
|
9
9
|
import { useDateFieldState } from "react-stately";
|
|
10
10
|
//#region src/components/inputs/DateTime/shared/DateField.tsx
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const omitNullValue = ({ value: _value, ...props }) => props;
|
|
12
|
+
const DateField = ({ ref, onClearChange, hidePlaceholder, isDisabled, disableManualEntry, dateGranularity = "day", isTimeOptional = false, format, timeZone, segmentGroup, shouldAutoFixYear = false, preserveNullValue = false, ...props }) => {
|
|
13
13
|
const { locale } = useLocale();
|
|
14
14
|
const previousValueRef = useRef(props.value);
|
|
15
15
|
const dateFieldProps = props.value == null && !preserveNullValue ? omitNullValue(props) : props;
|
|
@@ -40,18 +40,18 @@ var DateField = ({ ref, onClearChange, hidePlaceholder, isDisabled, disableManua
|
|
|
40
40
|
return segments;
|
|
41
41
|
}, [state.segments, isSegmentVisible]);
|
|
42
42
|
const segmentsToRender = useMemo(() => getSegmentsToRender(), [getSegmentsToRender]);
|
|
43
|
-
const getSegmentNumber = (
|
|
44
|
-
if (!
|
|
45
|
-
if (typeof
|
|
46
|
-
const parsedValue = parseInt(
|
|
43
|
+
const getSegmentNumber = (segment) => {
|
|
44
|
+
if (!segment) return null;
|
|
45
|
+
if (typeof segment.value === "number" && !Number.isNaN(segment.value)) return segment.value;
|
|
46
|
+
const parsedValue = parseInt(segment.text ?? "");
|
|
47
47
|
return Number.isNaN(parsedValue) ? null : parsedValue;
|
|
48
48
|
};
|
|
49
49
|
const autoFixYear = () => {
|
|
50
|
-
const monthSegment = state.segments.find((
|
|
51
|
-
const daySegment = state.segments.find((
|
|
52
|
-
const yearSegment = state.segments.find((
|
|
53
|
-
const hourSegment = state.segments.find((
|
|
54
|
-
const minuteSegment = state.segments.find((
|
|
50
|
+
const monthSegment = state.segments.find((segment) => segment.type === "month");
|
|
51
|
+
const daySegment = state.segments.find((segment) => segment.type === "day");
|
|
52
|
+
const yearSegment = state.segments.find((segment) => segment.type === "year");
|
|
53
|
+
const hourSegment = state.segments.find((segment) => segment.type === "hour");
|
|
54
|
+
const minuteSegment = state.segments.find((segment) => segment.type === "minute");
|
|
55
55
|
const isMonthFilled = monthSegment && !monthSegment.isPlaceholder;
|
|
56
56
|
const isDayFilled = daySegment && !daySegment.isPlaceholder;
|
|
57
57
|
const isYearFilled = yearSegment && !yearSegment.isPlaceholder && yearSegment.text?.length > 0;
|
|
@@ -95,8 +95,8 @@ var DateField = ({ ref, onClearChange, hidePlaceholder, isDisabled, disableManua
|
|
|
95
95
|
if (!valueToCorrect) return;
|
|
96
96
|
const { year } = valueToCorrect;
|
|
97
97
|
if (shouldAutoFixYear && year >= 0 && year <= 99) {
|
|
98
|
-
const
|
|
99
|
-
correctedValue = valueToCorrect.set({ year:
|
|
98
|
+
const correctedYear = year <= 50 ? 2e3 + year : 1900 + year;
|
|
99
|
+
correctedValue = valueToCorrect.set({ year: correctedYear });
|
|
100
100
|
}
|
|
101
101
|
if (correctedValue) {
|
|
102
102
|
state.setValue(correctedValue);
|
|
@@ -118,20 +118,19 @@ var DateField = ({ ref, onClearChange, hidePlaceholder, isDisabled, disableManua
|
|
|
118
118
|
previousValueRef.current = props.value;
|
|
119
119
|
}, [props.value, state]);
|
|
120
120
|
useEffect(() => {
|
|
121
|
-
onClearChange?.(state.segments.some((
|
|
121
|
+
onClearChange?.(state.segments.some((segment) => segment.type !== "literal" && segment.isPlaceholder === false));
|
|
122
122
|
}, [state.segments, onClearChange]);
|
|
123
123
|
const getFormattedDisplayValue = () => {
|
|
124
124
|
if (!disableManualEntry) return null;
|
|
125
125
|
if (!format) return null;
|
|
126
126
|
if (!state.value) return null;
|
|
127
127
|
const jsDate = DateTimeUtils.fromDateValueToLocal(state.value, timeZone);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return formattedDate.toFormat(format);
|
|
128
|
+
if (Number.isNaN(jsDate.getTime())) return null;
|
|
129
|
+
return DateUtils.formatDate(jsDate, format);
|
|
131
130
|
};
|
|
132
131
|
const formattedDisplayValue = getFormattedDisplayValue();
|
|
133
|
-
let fieldContent = /* @__PURE__ */ jsx(Fragment$1, { children: segmentsToRender.map((
|
|
134
|
-
segment
|
|
132
|
+
let fieldContent = /* @__PURE__ */ jsx(Fragment$1, { children: segmentsToRender.map((segment, i) => /* @__PURE__ */ jsx(DateSegmentItem, {
|
|
133
|
+
segment,
|
|
135
134
|
segmentGroup,
|
|
136
135
|
state,
|
|
137
136
|
isDisabled,
|
|
@@ -1,46 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import "../../FormField/FormFieldHeader.js";
|
|
2
|
+
import "../../shared/input.cva.js";
|
|
3
|
+
import "./datePicker.types.js";
|
|
4
|
+
import { Ref } from "react";
|
|
5
|
+
import "react-aria";
|
|
6
|
+
//#region src/components/inputs/DateTime/shared/DatePickerInput.d.ts
|
|
7
|
+
interface DatePickerInputHandle {
|
|
8
|
+
clear: () => void;
|
|
9
|
+
getContainer?: () => HTMLDivElement | null;
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
groupProps: DatePickerAria["groupProps"];
|
|
13
|
-
fieldProps: DatePickerAria["fieldProps"];
|
|
14
|
-
endFieldProps?: DatePickerAria["fieldProps"];
|
|
15
|
-
fieldValue?: DatePickerAria["fieldProps"]["value"];
|
|
16
|
-
endFieldValue?: DatePickerAria["fieldProps"]["value"];
|
|
17
|
-
isValueControlled?: boolean;
|
|
18
|
-
hasValue?: boolean;
|
|
19
|
-
buttonProps: DatePickerAria["buttonProps"];
|
|
20
|
-
isDisabled?: boolean;
|
|
21
|
-
isInvalid?: boolean;
|
|
22
|
-
disableDropdown?: boolean;
|
|
23
|
-
isDateTime?: boolean;
|
|
24
|
-
shouldShrinkInput?: boolean;
|
|
25
|
-
isClearable?: boolean;
|
|
26
|
-
isClearableIfDisabled?: boolean;
|
|
27
|
-
headerProps?: FormFieldHeaderProps;
|
|
28
|
-
todayIcon?: DatePickerTodayIcon;
|
|
29
|
-
todayIconButtonSize?: DatePickerTodayIconButtonSize;
|
|
30
|
-
todayIconButtonComponent?: DatePickerTodayIconButtonComponent;
|
|
31
|
-
todayIconPlacement?: DatePickerTodayIconPlacement;
|
|
32
|
-
isDirty?: boolean;
|
|
33
|
-
isRequired?: boolean;
|
|
34
|
-
disableManualEntry?: boolean;
|
|
35
|
-
autoFixYear?: boolean;
|
|
36
|
-
placeholder?: string;
|
|
37
|
-
className?: string;
|
|
38
|
-
onOpenDropdown?: () => void;
|
|
39
|
-
dateGranularity?: "day" | "month" | "year";
|
|
40
|
-
timeZone?: string;
|
|
41
|
-
isTimeOptional?: boolean;
|
|
42
|
-
format?: string;
|
|
43
|
-
onClear?: () => void;
|
|
44
|
-
}
|
|
45
|
-
export declare const DatePickerInput: ({ ref, as, groupProps, fieldProps, endFieldProps, fieldValue, endFieldValue, isValueControlled, hasValue, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, shouldShrinkInput, isClearable, isClearableIfDisabled, headerProps, todayIcon, todayIconButtonSize, todayIconButtonComponent, todayIconPlacement, isDirty, isRequired, disableManualEntry, autoFixYear, placeholder, className, onOpenDropdown, dateGranularity, timeZone: timeZoneProp, isTimeOptional, format, onClear: onClearProp, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
46
|
-
export {};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { DatePickerInputHandle };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UIOverrides } from "../../../../config/uiOverrides.context.js";
|
|
2
|
-
import { Typography } from "../../../
|
|
2
|
+
import { Typography } from "../../../typography.js";
|
|
3
3
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
4
|
-
import { InlineIconButton } from "../../../
|
|
4
|
+
import { InlineIconButton } from "../../../inline-icon-button.js";
|
|
5
5
|
import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
|
|
6
6
|
import { inputBaseDefinition, inputSizeDefinition } from "../../shared/input.cva.js";
|
|
7
7
|
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
@@ -17,7 +17,7 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
17
17
|
import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
|
|
18
18
|
import { getLocalTimeZone, today } from "@internationalized/date";
|
|
19
19
|
//#region src/components/inputs/DateTime/shared/DatePickerInput.tsx
|
|
20
|
-
|
|
20
|
+
const DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, fieldValue, endFieldValue, isValueControlled, hasValue, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, shouldShrinkInput, isClearable, isClearableIfDisabled, headerProps, todayIcon, todayIconButtonSize = "none", todayIconButtonComponent, todayIconPlacement = "content", isDirty, isRequired, disableManualEntry, autoFixYear = false, placeholder, className, onOpenDropdown, dateGranularity = "day", timeZone: timeZoneProp, isTimeOptional = false, format, onClear: onClearProp, ...props }) => {
|
|
21
21
|
const uiConfig = UIConfig.useConfig();
|
|
22
22
|
const timeZone = timeZoneProp ?? uiConfig.dateInput.timeZone;
|
|
23
23
|
let effectiveTimeZone = getLocalTimeZone();
|