@povio/ui 2.1.14 → 2.1.16
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 +80 -0
- package/dist/AclGuard.js +12 -0
- package/dist/ActionModal.js +51 -0
- package/dist/Alert.js +46 -0
- package/dist/AlignCenter.js +13 -0
- package/dist/AlignLeft.js +13 -0
- package/dist/AlignLeftRight.js +13 -0
- package/dist/AlignRight.js +13 -0
- package/dist/ArrowDropDown.js +13 -0
- package/dist/ArrowDropUp.js +13 -0
- package/dist/ArrowLeft.js +13 -0
- package/dist/ArrowRight.js +13 -0
- package/dist/AuthGuard.js +22 -0
- package/dist/Autocomplete.js +28 -0
- package/dist/Bold.js +13 -0
- package/dist/BottomSheet.js +191 -0
- package/dist/BulletedList.js +13 -0
- package/dist/Button.js +54 -0
- package/dist/ButtonContent.js +28 -0
- package/dist/Calendar.js +15 -0
- package/dist/Calendar2.js +54 -0
- package/dist/CalendarCell.js +130 -0
- package/dist/CalendarGrid.js +50 -0
- package/dist/CalendarHeader.js +75 -0
- package/dist/CalendarSelectHeader.js +170 -0
- package/dist/Can.js +13 -0
- package/dist/CellText.js +13 -0
- package/dist/Check.js +15 -0
- package/dist/CheckCircle.js +13 -0
- package/dist/CheckContent.js +16 -0
- package/dist/Checkbox.js +61 -0
- package/dist/CheckboxCheckmark.js +16 -0
- package/dist/CheckboxCheckmark2.js +25 -0
- package/dist/CheckboxIndeterminate.js +16 -0
- package/dist/ChevronDown.js +15 -0
- package/dist/ChevronLeft.js +15 -0
- package/dist/ChevronRight.js +15 -0
- package/dist/ChevronUp.js +15 -0
- package/dist/ChevronsLeft.js +15 -0
- package/dist/ChevronsRight.js +15 -0
- package/dist/Clock.js +13 -0
- package/dist/Close.js +13 -0
- package/dist/ColorPicker.js +16 -0
- package/dist/ColorPickerDropdown.js +51 -0
- package/dist/ColumnConfig.js +81 -0
- package/dist/DateField.js +89 -0
- package/dist/DatePicker.js +197 -0
- package/dist/DatePickerInput.js +158 -0
- package/dist/DateRangePicker.js +601 -0
- package/dist/DateSegmentItem.js +29 -0
- package/dist/DateTime.js +18 -0
- package/dist/DateTimeDialog.js +49 -0
- package/dist/DateTimeDialogFooter.js +25 -0
- package/dist/DateTimePicker.js +209 -0
- package/dist/Drag.js +13 -0
- package/dist/Drawer.js +43 -0
- package/dist/File.js +15 -0
- package/dist/FileCard.js +50 -0
- package/dist/FileCardList.js +17 -0
- package/dist/FileUpload.js +189 -0
- package/dist/FileUploadContainer.js +12 -0
- package/dist/FileUploadContent.js +61 -0
- package/dist/FileUploadContentEmpty.js +54 -0
- package/dist/FileUploadContentError.js +109 -0
- package/dist/FileUploadContentFilled.js +112 -0
- package/dist/FileUploadContentLoading.js +76 -0
- package/dist/Form.js +42 -0
- package/dist/FormField.js +35 -0
- package/dist/FormFieldError.js +11 -0
- package/dist/FormFieldHeader.js +36 -0
- package/dist/FormFieldHeaderClose.js +15 -0
- package/dist/FormFieldLabel.js +32 -0
- package/dist/HeaderText.js +10 -0
- package/dist/Highlight.js +13 -0
- package/dist/HighlightOn.js +19 -0
- package/dist/HyperlinkAction.js +70 -0
- package/dist/IconButton.js +12 -0
- package/dist/InfiniteTable.js +31 -0
- package/dist/Info.js +18 -0
- package/dist/InlineIconButton.js +13 -0
- package/dist/InputClear.js +19 -0
- package/dist/InputContent.js +94 -0
- package/dist/InputItem.js +54 -0
- package/dist/InputUpload.js +111 -0
- package/dist/InputUploadContent.js +52 -0
- package/dist/InputUploadFilled.js +26 -0
- package/dist/Inputs.js +15 -0
- package/dist/Italic.js +13 -0
- package/dist/Link.js +13 -0
- package/dist/Link2.js +19 -0
- package/dist/Loader.js +32 -0
- package/dist/Menu.js +13 -0
- package/dist/Menu2.js +9 -0
- package/dist/MenuDesktop.js +53 -0
- package/dist/MenuItem.js +21 -0
- package/dist/MenuMobile.js +64 -0
- package/dist/MenuPopover.js +30 -0
- package/dist/Modal.js +49 -0
- package/dist/MonthPicker.js +56 -0
- package/dist/NumberInput.js +132 -0
- package/dist/NumberedList.js +13 -0
- package/dist/PaginatedTable.js +26 -0
- package/dist/Pagination.js +43 -0
- package/dist/PaginationList.js +105 -0
- package/dist/PasswordInput.js +21 -0
- package/dist/PillButton.js +37 -0
- package/dist/PointerHorizontal.js +13 -0
- package/dist/PointerVertical.js +13 -0
- package/dist/ProgressBar.js +25 -0
- package/dist/QueryAutocomplete.js +18 -0
- package/dist/RadioGroup.js +81 -0
- package/dist/RangeCalendar.js +96 -0
- package/dist/ResponsivePopover.js +41 -0
- package/dist/Segment.js +82 -0
- package/dist/SegmentItem.js +23 -0
- package/dist/Select.js +24 -0
- package/dist/SelectBase.js +28 -0
- package/dist/SelectDesktop.js +147 -0
- package/dist/SelectInput.js +159 -0
- package/dist/SelectInputTags.js +29 -0
- package/dist/SelectListBox.js +73 -0
- package/dist/SelectListBoxItem.js +48 -0
- package/dist/SelectListBoxItemSelectAll.js +31 -0
- package/dist/SelectListBoxLoadingItem.js +41 -0
- package/dist/SelectListBoxSelectionBar.js +25 -0
- package/dist/SelectMobile.js +111 -0
- package/dist/Send.js +15 -0
- package/dist/Slider.js +93 -0
- package/dist/SplitButton.js +36 -0
- package/dist/Strikethrough.js +13 -0
- package/dist/Table.js +248 -0
- package/dist/Tag.js +42 -0
- package/dist/TextAlignSelect.js +44 -0
- package/dist/TextArea.js +120 -0
- package/dist/TextButton.js +13 -0
- package/dist/TextColor.js +16 -0
- package/dist/TextColorSelect.js +22 -0
- package/dist/TextEditor.js +143 -0
- package/dist/TextEditorToolbar.js +30 -0
- package/dist/TextHighlightSelect.js +24 -0
- package/dist/TextInput.js +125 -0
- package/dist/TextListActions.js +42 -0
- package/dist/TextMarksActions.js +67 -0
- package/dist/TextStyleSelect.js +52 -0
- package/dist/TimeField.js +17 -0
- package/dist/TimePicker.js +158 -0
- package/dist/TimePickerForm.js +158 -0
- package/dist/TimePickerInput.js +92 -0
- package/dist/Toast.js +58 -0
- package/dist/Today.js +13 -0
- package/dist/Toggle.js +60 -0
- package/dist/ToggleButton.js +13 -0
- package/dist/Tooltip.js +49 -0
- package/dist/TooltipEllipsis.js +18 -0
- package/dist/TooltipWrapper.js +19 -0
- package/dist/Typography.js +14 -0
- package/dist/Underlined.js +15 -0
- package/dist/Upload.js +16 -0
- package/dist/View.js +13 -0
- package/dist/ViewOff.js +13 -0
- package/dist/WarningFilled.js +15 -0
- package/dist/YearPicker.js +64 -0
- package/dist/ability.context.js +35 -0
- package/dist/alert.cva.js +62 -0
- package/dist/array.utils.js +8 -0
- package/dist/auth.context.js +37 -0
- package/dist/auth.js +6 -12
- package/dist/button.cva.js +656 -0
- package/dist/buttonContent.cva.js +10 -0
- package/dist/checkbox.cva.js +47 -0
- package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.d.ts +2 -2
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +5 -0
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +3 -1
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +3 -1
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +3 -1
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/shared/DateField.d.ts +1 -0
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +8 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +2 -1
- package/dist/components/inputs/File/fileUpload.types.d.ts +1 -0
- package/dist/components/inputs/FormField/FormField.d.ts +4 -1
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +4 -2
- package/dist/components/inputs/Input/TextArea/TextArea.d.ts +1 -0
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +2 -1
- package/dist/components/inputs/Input/shared/InputContent.d.ts +4 -3
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +3 -0
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -0
- package/dist/components/inputs/Toggle/Toggle.d.ts +2 -0
- package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
- package/dist/compoundMapper.js +11 -0
- package/dist/config/uiStyle.context.d.ts +2 -1
- package/dist/confirmation.context.js +78 -0
- package/dist/date-time.utils.js +50 -0
- package/dist/date.utils.js +17 -0
- package/dist/dom.utils.js +17 -0
- package/dist/dynamicColumns.js +272 -0
- package/dist/dynamicInputs.js +186 -0
- package/dist/error-handling.js +87 -0
- package/dist/file.utils.js +43 -0
- package/dist/fileUpload.cva.js +49 -0
- package/dist/i18n.js +8 -0
- package/dist/index.js +136 -278
- package/dist/input.cva.js +210 -0
- package/dist/inputUploadButton.cva.js +27 -0
- package/dist/isEqual.js +57 -0
- package/dist/label.cva.js +104 -0
- package/dist/link.context.js +17 -0
- package/dist/link.cva.js +7 -0
- package/dist/loader.cva.js +16 -0
- package/dist/logger.js +17 -0
- package/dist/menu.cva.js +27 -0
- package/dist/minWidth.cva.js +9 -0
- package/dist/modal.cva.js +31 -0
- package/dist/object.utils.js +36 -0
- package/dist/outline.clsx.js +4 -0
- package/dist/pillButton.cva.js +254 -0
- package/dist/queries.utils.js +7 -0
- package/dist/radio.cva.js +42 -0
- package/dist/react.js +6 -0
- package/dist/rest-interceptor.js +22 -0
- package/dist/rest.utils.js +31 -0
- package/dist/rolldown_runtime.js +16 -0
- package/dist/router.context.js +37 -0
- package/dist/routing.utils.js +9 -0
- package/dist/segment.cva.js +25 -0
- package/dist/select.context.js +190 -0
- package/dist/status.cva.js +57 -0
- package/dist/string.utils.js +10 -0
- package/dist/table.cva.js +35 -0
- package/dist/tag.cva.js +50 -0
- package/dist/text-editor.js +2 -4
- package/dist/textEditor.types.js +38 -0
- package/dist/theme.context.js +65 -0
- package/dist/toast.cva.js +158 -0
- package/dist/toggle.cva.js +27 -0
- package/dist/tooltip.cva.js +30 -0
- package/dist/translation.js +147 -0
- package/dist/translation2.js +145 -0
- package/dist/typography.cva.js +124 -0
- package/dist/uiConfig.context.js +58 -0
- package/dist/uiStyle.context.js +16 -0
- package/dist/useAutosave.js +62 -0
- package/dist/useBreakpoint.js +28 -0
- package/dist/useDebounceCallback.js +23 -0
- package/dist/useDeepCompare.js +21 -0
- package/dist/useFilters.js +121 -0
- package/dist/useForm.js +12 -0
- package/dist/useFormAutosave.js +52 -0
- package/dist/useIntersectionObserver.js +23 -0
- package/dist/useLocalStorage.js +35 -0
- package/dist/useLongPressRepeat.js +27 -0
- package/dist/usePagination.js +26 -0
- package/dist/useScrollableListBox.js +24 -0
- package/dist/useSelectItems.js +82 -0
- package/dist/useSorting.js +34 -0
- package/dist/useStateAndRef.js +15 -0
- package/dist/useTableColumnConfig.js +38 -0
- package/dist/useTableNav.js +279 -0
- package/dist/useToast.js +63 -0
- package/dist/useTranslationMemo.js +10 -0
- package/dist/zod.utils.js +17 -0
- package/package.json +14 -14
- package/dist/assets/icons/AlignCenter.js +0 -21
- package/dist/assets/icons/AlignLeft.js +0 -21
- package/dist/assets/icons/AlignLeftRight.js +0 -21
- package/dist/assets/icons/AlignRight.js +0 -21
- package/dist/assets/icons/ArrowDropDown.js +0 -21
- package/dist/assets/icons/ArrowDropUp.js +0 -21
- package/dist/assets/icons/ArrowLeft.js +0 -21
- package/dist/assets/icons/ArrowRight.js +0 -21
- package/dist/assets/icons/Bold.js +0 -21
- package/dist/assets/icons/BulletedList.js +0 -21
- package/dist/assets/icons/Calendar.js +0 -23
- package/dist/assets/icons/Check.js +0 -23
- package/dist/assets/icons/CheckCircle.js +0 -21
- package/dist/assets/icons/CheckboxCheckmark.js +0 -24
- package/dist/assets/icons/CheckboxIndeterminate.js +0 -24
- package/dist/assets/icons/ChevronDown.js +0 -23
- package/dist/assets/icons/ChevronLeft.js +0 -23
- package/dist/assets/icons/ChevronRight.js +0 -23
- package/dist/assets/icons/ChevronUp.js +0 -23
- package/dist/assets/icons/ChevronsLeft.js +0 -23
- package/dist/assets/icons/ChevronsRight.js +0 -23
- package/dist/assets/icons/Clock.js +0 -21
- package/dist/assets/icons/Close.js +0 -21
- package/dist/assets/icons/DateTime.js +0 -32
- package/dist/assets/icons/Drag.js +0 -21
- package/dist/assets/icons/File.js +0 -23
- package/dist/assets/icons/Highlight.js +0 -21
- package/dist/assets/icons/HighlightOn.js +0 -30
- package/dist/assets/icons/Info.js +0 -32
- package/dist/assets/icons/Italic.js +0 -21
- package/dist/assets/icons/Link.js +0 -21
- package/dist/assets/icons/Menu.js +0 -21
- package/dist/assets/icons/NumberedList.js +0 -21
- package/dist/assets/icons/PointerHorizontal.js +0 -21
- package/dist/assets/icons/PointerVertical.js +0 -21
- package/dist/assets/icons/Send.js +0 -23
- package/dist/assets/icons/Strikethrough.js +0 -21
- package/dist/assets/icons/TextColor.js +0 -30
- package/dist/assets/icons/Today.js +0 -21
- package/dist/assets/icons/Underlined.js +0 -23
- package/dist/assets/icons/Upload.js +0 -30
- package/dist/assets/icons/View.js +0 -18
- package/dist/assets/icons/ViewOff.js +0 -18
- package/dist/assets/icons/WarningFilled.js +0 -23
- package/dist/assets/locales/en/translation.json.js +0 -14
- package/dist/assets/locales/sl/translation.json.js +0 -14
- package/dist/components/Menu/Menu.js +0 -14
- package/dist/components/Menu/MenuDesktop.js +0 -74
- package/dist/components/Menu/MenuItem.js +0 -27
- package/dist/components/Menu/MenuMobile.js +0 -83
- package/dist/components/Menu/MenuPopover.js +0 -43
- package/dist/components/Menu/menu.cva.js +0 -45
- package/dist/components/buttons/Button/Button.js +0 -73
- package/dist/components/buttons/Button/button.cva.js +0 -666
- package/dist/components/buttons/IconButton/IconButton.js +0 -17
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +0 -18
- package/dist/components/buttons/PillButton/PillButton.js +0 -44
- package/dist/components/buttons/PillButton/pillButton.cva.js +0 -268
- package/dist/components/buttons/SplitButton/SplitButton.js +0 -65
- package/dist/components/buttons/TextButton/TextButton.js +0 -18
- package/dist/components/buttons/ToggleButton/ToggleButton.js +0 -21
- package/dist/components/buttons/shared/ButtonContent.js +0 -53
- package/dist/components/buttons/shared/buttonContent.cva.js +0 -16
- package/dist/components/inputs/Checkbox/Checkbox.js +0 -81
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +0 -32
- package/dist/components/inputs/Checkbox/checkbox.cva.js +0 -51
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +0 -251
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +0 -689
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +0 -265
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +0 -217
- package/dist/components/inputs/DateTime/shared/Calendar.js +0 -85
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +0 -160
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +0 -67
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +0 -89
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +0 -203
- package/dist/components/inputs/DateTime/shared/DateField.js +0 -77
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +0 -206
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +0 -55
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +0 -76
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +0 -47
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +0 -82
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +0 -133
- package/dist/components/inputs/DateTime/shared/TimeField.js +0 -26
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +0 -186
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +0 -125
- package/dist/components/inputs/DateTime/shared/YearPicker.js +0 -89
- package/dist/components/inputs/File/FileUpload.js +0 -257
- package/dist/components/inputs/File/FileUploadContainer.js +0 -17
- package/dist/components/inputs/File/InputUpload.js +0 -174
- package/dist/components/inputs/File/shared/FileCard.js +0 -67
- package/dist/components/inputs/File/shared/FileCardList.js +0 -20
- package/dist/components/inputs/File/shared/FileUploadContent.js +0 -92
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +0 -92
- package/dist/components/inputs/File/shared/FileUploadContentError.js +0 -167
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +0 -173
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +0 -128
- package/dist/components/inputs/File/shared/InputUploadContent.js +0 -73
- package/dist/components/inputs/File/shared/InputUploadFilled.js +0 -45
- package/dist/components/inputs/File/shared/ProgressBar.js +0 -42
- package/dist/components/inputs/File/shared/fileUpload.cva.js +0 -58
- package/dist/components/inputs/File/shared/inputUploadButton.cva.js +0 -49
- package/dist/components/inputs/FormField/FormField.js +0 -54
- package/dist/components/inputs/FormField/FormFieldError.js +0 -16
- package/dist/components/inputs/FormField/FormFieldHeader.js +0 -57
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +0 -20
- package/dist/components/inputs/FormField/FormFieldLabel.js +0 -37
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +0 -166
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +0 -26
- package/dist/components/inputs/Input/TextArea/TextArea.js +0 -155
- package/dist/components/inputs/Input/TextInput/TextInput.js +0 -162
- package/dist/components/inputs/Input/shared/InputContent.js +0 -114
- package/dist/components/inputs/Inputs/Form.js +0 -68
- package/dist/components/inputs/Inputs/InputItem.js +0 -61
- package/dist/components/inputs/Inputs/Inputs.js +0 -32
- package/dist/components/inputs/RadioGroup/RadioGroup.js +0 -103
- package/dist/components/inputs/RadioGroup/radio.cva.js +0 -57
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +0 -39
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +0 -25
- package/dist/components/inputs/Selection/Select/Select.js +0 -32
- package/dist/components/inputs/Selection/shared/SelectBase.js +0 -27
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +0 -223
- package/dist/components/inputs/Selection/shared/SelectInput.js +0 -234
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +0 -49
- package/dist/components/inputs/Selection/shared/SelectListBox.js +0 -127
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +0 -78
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +0 -45
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +0 -47
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +0 -42
- package/dist/components/inputs/Selection/shared/SelectMobile.js +0 -165
- package/dist/components/inputs/Selection/shared/select.context.js +0 -244
- package/dist/components/inputs/Selection/shared/useSelectItems.js +0 -94
- package/dist/components/inputs/Slider/Slider.js +0 -137
- package/dist/components/inputs/TextEditor/TextEditor.js +0 -223
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +0 -34
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +0 -80
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +0 -92
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +0 -56
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +0 -33
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +0 -31
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +0 -37
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +0 -51
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +0 -73
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +0 -61
- package/dist/components/inputs/TextEditor/textEditor.types.js +0 -40
- package/dist/components/inputs/Toggle/Toggle.js +0 -65
- package/dist/components/inputs/Toggle/toggle.cva.js +0 -44
- package/dist/components/inputs/shared/CheckContent.js +0 -22
- package/dist/components/inputs/shared/InputClear.js +0 -27
- package/dist/components/inputs/shared/TooltipWrapper.js +0 -23
- package/dist/components/inputs/shared/input.cva.js +0 -174
- package/dist/components/inputs/shared/label.cva.js +0 -128
- package/dist/components/outline.clsx.js +0 -11
- package/dist/components/overlays/ActionModal/ActionModal.js +0 -80
- package/dist/components/overlays/BottomSheet/BottomSheet.js +0 -261
- package/dist/components/overlays/Drawer/Drawer.js +0 -84
- package/dist/components/overlays/Modal/Modal.js +0 -64
- package/dist/components/overlays/Modal/modal.cva.js +0 -53
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +0 -71
- package/dist/components/overlays/Tooltip/Tooltip.js +0 -92
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +0 -27
- package/dist/components/overlays/Tooltip/tooltip.cva.js +0 -60
- package/dist/components/segment/Segment.js +0 -118
- package/dist/components/segment/SegmentItem.js +0 -35
- package/dist/components/segment/segment.cva.js +0 -35
- package/dist/components/shared/pagination/Pagination.js +0 -75
- package/dist/components/shared/pagination/PaginationList.js +0 -145
- package/dist/components/shared/pagination/minWidth.cva.js +0 -15
- package/dist/components/status/Alert/Alert.js +0 -41
- package/dist/components/status/Alert/alert.cva.js +0 -64
- package/dist/components/status/Loader/Loader.js +0 -37
- package/dist/components/status/Loader/loader.cva.js +0 -27
- package/dist/components/status/Toast/Toast.js +0 -65
- package/dist/components/status/Toast/toast.cva.js +0 -150
- package/dist/components/status/Toast/useToast.js +0 -94
- package/dist/components/status/shared/status.cva.js +0 -62
- package/dist/components/table/CellText.js +0 -18
- package/dist/components/table/ColumnConfig.js +0 -124
- package/dist/components/table/HeaderText.js +0 -15
- package/dist/components/table/InfiniteTable.js +0 -40
- package/dist/components/table/PaginatedTable.js +0 -33
- package/dist/components/table/Table.js +0 -370
- package/dist/components/table/table.cva.js +0 -63
- package/dist/components/text/Link/Link.js +0 -24
- package/dist/components/text/Link/link.cva.js +0 -18
- package/dist/components/text/Tag/Tag.js +0 -49
- package/dist/components/text/Tag/tag.cva.js +0 -59
- package/dist/components/text/Typography/Typography.js +0 -22
- package/dist/components/text/Typography/typography.cva.js +0 -100
- package/dist/config/confirmation.context.js +0 -107
- package/dist/config/i18n.js +0 -15
- package/dist/config/link.context.js +0 -19
- package/dist/config/router.context.js +0 -39
- package/dist/config/theme.context.js +0 -73
- package/dist/config/uiConfig.context.js +0 -69
- package/dist/config/uiStyle.context.js +0 -16
- package/dist/helpers/dynamicColumns.js +0 -359
- package/dist/helpers/dynamicInputs.js +0 -212
- package/dist/hooks/useAutosave.js +0 -83
- package/dist/hooks/useBreakpoint.js +0 -33
- package/dist/hooks/useDebounceCallback.js +0 -29
- package/dist/hooks/useDeepCompare.js +0 -25
- package/dist/hooks/useFilters.js +0 -160
- package/dist/hooks/useForm.js +0 -22
- package/dist/hooks/useFormAutosave.js +0 -67
- package/dist/hooks/useIntersectionObserver.js +0 -27
- package/dist/hooks/useLocalStorage.js +0 -54
- package/dist/hooks/useLongPressRepeat.js +0 -33
- package/dist/hooks/usePagination.js +0 -35
- package/dist/hooks/useScrollableListBox.js +0 -30
- package/dist/hooks/useSorting.js +0 -32
- package/dist/hooks/useStateAndRef.js +0 -17
- package/dist/hooks/useTableColumnConfig.js +0 -63
- package/dist/hooks/useTableNav.js +0 -394
- package/dist/hooks/useTranslationMemo.js +0 -14
- package/dist/utils/array.utils.js +0 -12
- package/dist/utils/compoundMapper.js +0 -14
- package/dist/utils/date-time.utils.js +0 -77
- package/dist/utils/date.utils.js +0 -23
- package/dist/utils/dom.utils.js +0 -13
- package/dist/utils/file.utils.js +0 -63
- package/dist/utils/isEqual.js +0 -95
- package/dist/utils/logger.js +0 -19
- package/dist/utils/object.utils.js +0 -53
- package/dist/utils/queries.utils.js +0 -9
- package/dist/utils/rest.utils.js +0 -51
- package/dist/utils/routing.utils.js +0 -15
- package/dist/utils/string.utils.js +0 -12
- package/dist/utils/vendor/acl/AclGuard.js +0 -14
- package/dist/utils/vendor/acl/Can.js +0 -18
- package/dist/utils/vendor/acl/ability.context.js +0 -37
- package/dist/utils/vendor/auth/AuthGuard.js +0 -26
- package/dist/utils/vendor/auth/auth.context.js +0 -41
- package/dist/utils/vendor/error-handling.js +0 -119
- package/dist/utils/vendor/rest-interceptor.js +0 -21
- package/dist/utils/zod.utils.js +0 -21
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
import { Typography } from "./Typography.js";
|
|
2
|
+
import { UIConfig } from "./uiConfig.context.js";
|
|
3
|
+
import { ns } from "./i18n.js";
|
|
4
|
+
import { DatePickerInput } from "./DatePickerInput.js";
|
|
5
|
+
import { DateTimeDialog } from "./DateTimeDialog.js";
|
|
6
|
+
import { DateTimeDialogFooter } from "./DateTimeDialogFooter.js";
|
|
7
|
+
import { FormField } from "./FormField.js";
|
|
8
|
+
import { TooltipWrapper } from "./TooltipWrapper.js";
|
|
9
|
+
import { DateTimeUtils } from "./date-time.utils.js";
|
|
10
|
+
import { RangeCalendar } from "./RangeCalendar.js";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { clsx } from "clsx";
|
|
13
|
+
import { Button } from "react-aria-components";
|
|
14
|
+
import { useCallback, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
15
|
+
import { useDateRangePicker, useLocale as useLocale$1 } from "react-aria";
|
|
16
|
+
import { mergeRefs } from "@react-aria/utils";
|
|
17
|
+
import { Controller } from "react-hook-form";
|
|
18
|
+
import { CalendarDate, createCalendar, endOfMonth, endOfWeek, endOfYear, getLocalTimeZone, startOfMonth, startOfWeek, startOfYear, toCalendarDate, today } from "@internationalized/date";
|
|
19
|
+
import { DateTime } from "luxon";
|
|
20
|
+
import { useDateRangePickerState, useRangeCalendarState } from "react-stately";
|
|
21
|
+
import { useTranslation } from "react-i18next";
|
|
22
|
+
var PLACEHOLDER_VALUE = new CalendarDate(2024, 1, 1);
|
|
23
|
+
var DateRangePickerBase = (props) => {
|
|
24
|
+
const ui = UIConfig.useConfig();
|
|
25
|
+
const { t } = useTranslation();
|
|
26
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, value, disableDropdown, className, hideSidebar, placeholder, hideLabel = ui.input.hideLabel, variant = ui.input.variant, as = ui.input.as, size = ui.input.size, isClearable = ui.input.isClearable, todayIcon = ui.dateInput.todayIcon, shouldForceLeadingZeros = ui.dateInput.shouldForceLeadingZeros, disableManualEntry = ui.dateInput.disableManualEntry,...rest } = props;
|
|
27
|
+
const [validationRangeError, setValidationRangeError] = useState();
|
|
28
|
+
const datePickerInputRef = useRef(null);
|
|
29
|
+
const dateRangePickerRef = useMemo(() => ({ get current() {
|
|
30
|
+
return datePickerInputRef.current?.getContainer?.() || null;
|
|
31
|
+
} }), []);
|
|
32
|
+
const dialogState = useDateRangePickerState({
|
|
33
|
+
...rest,
|
|
34
|
+
value,
|
|
35
|
+
shouldCloseOnSelect: false,
|
|
36
|
+
shouldForceLeadingZeros
|
|
37
|
+
});
|
|
38
|
+
const state = useDateRangePickerState({
|
|
39
|
+
...rest,
|
|
40
|
+
shouldForceLeadingZeros,
|
|
41
|
+
value,
|
|
42
|
+
onChange: (newValue) => {
|
|
43
|
+
if (isValidRange(newValue)) return;
|
|
44
|
+
onChange?.(newValue);
|
|
45
|
+
handleCalendarStatesChange(newValue);
|
|
46
|
+
},
|
|
47
|
+
shouldCloseOnSelect: false
|
|
48
|
+
});
|
|
49
|
+
const { groupProps, labelProps, startFieldProps, endFieldProps, buttonProps, dialogProps } = useDateRangePicker({
|
|
50
|
+
...rest,
|
|
51
|
+
label,
|
|
52
|
+
shouldForceLeadingZeros
|
|
53
|
+
}, state, dateRangePickerRef);
|
|
54
|
+
const { calendarProps } = useDateRangePicker({
|
|
55
|
+
...rest,
|
|
56
|
+
label,
|
|
57
|
+
shouldForceLeadingZeros
|
|
58
|
+
}, dialogState, dateRangePickerRef);
|
|
59
|
+
const { locale } = useLocale$1();
|
|
60
|
+
useImperativeHandle(ref, () => ({ clear: () => {
|
|
61
|
+
datePickerInputRef.current?.clear();
|
|
62
|
+
} }));
|
|
63
|
+
const formFieldProps = {
|
|
64
|
+
error: error || validationRangeError,
|
|
65
|
+
label,
|
|
66
|
+
tooltipText,
|
|
67
|
+
helperText,
|
|
68
|
+
isRequired,
|
|
69
|
+
rightContent,
|
|
70
|
+
isHeaderHidden: isHeaderHidden || as === "inline" || as === "filter" || as === "floating",
|
|
71
|
+
hideLabel,
|
|
72
|
+
isDisabled,
|
|
73
|
+
headerClassName,
|
|
74
|
+
errorClassName
|
|
75
|
+
};
|
|
76
|
+
const leftCalendarState = useRangeCalendarState({
|
|
77
|
+
...calendarProps,
|
|
78
|
+
locale,
|
|
79
|
+
createCalendar,
|
|
80
|
+
pageBehavior: "single",
|
|
81
|
+
visibleDuration: { months: 1 },
|
|
82
|
+
minValue: void 0,
|
|
83
|
+
maxValue: void 0
|
|
84
|
+
});
|
|
85
|
+
const rightCalendarState = useRangeCalendarState({
|
|
86
|
+
...calendarProps,
|
|
87
|
+
locale,
|
|
88
|
+
createCalendar,
|
|
89
|
+
pageBehavior: "single",
|
|
90
|
+
visibleDuration: { months: 1 },
|
|
91
|
+
defaultFocusedValue: today(getLocalTimeZone()).add({ months: 1 }),
|
|
92
|
+
minValue: void 0,
|
|
93
|
+
maxValue: void 0
|
|
94
|
+
});
|
|
95
|
+
const [activePreset, setActivePreset] = useState(null);
|
|
96
|
+
const [rangeSelection, setRangeSelection] = useState({
|
|
97
|
+
start: value?.start || null,
|
|
98
|
+
end: value?.end || null,
|
|
99
|
+
isSelecting: false
|
|
100
|
+
});
|
|
101
|
+
const [hoverDate, setHoverDate] = useState(null);
|
|
102
|
+
const headerProps = {
|
|
103
|
+
label,
|
|
104
|
+
tooltipText,
|
|
105
|
+
helperText,
|
|
106
|
+
isRequired,
|
|
107
|
+
rightContent,
|
|
108
|
+
isHeaderHidden: hideLabel || isHeaderHidden,
|
|
109
|
+
isDisabled,
|
|
110
|
+
className: headerClassName,
|
|
111
|
+
labelProps
|
|
112
|
+
};
|
|
113
|
+
const isValidRange = useCallback((newValue) => {
|
|
114
|
+
if (newValue?.start && newValue?.end) {
|
|
115
|
+
const startDate = newValue.start;
|
|
116
|
+
if (newValue.end.compare(startDate) < 0) {
|
|
117
|
+
setValidationRangeError(t(($) => $.ui.datePicker.errors.endDateBeforeStart, { ns: "ui" }));
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
setValidationRangeError(void 0);
|
|
121
|
+
} else setValidationRangeError(void 0);
|
|
122
|
+
return false;
|
|
123
|
+
}, [t]);
|
|
124
|
+
const handleCalendarStatesChange = (newValue) => {
|
|
125
|
+
if (newValue) {
|
|
126
|
+
if (isValidRange(newValue)) return;
|
|
127
|
+
dialogState.setValue(newValue);
|
|
128
|
+
const startDate = newValue.start;
|
|
129
|
+
const endDate = newValue.end;
|
|
130
|
+
leftCalendarState.setFocusedDate(startDate);
|
|
131
|
+
if (startDate.year === endDate.year && startDate.month === endDate.month) rightCalendarState.setFocusedDate(startDate.add({ months: 1 }));
|
|
132
|
+
else rightCalendarState.setFocusedDate(endDate);
|
|
133
|
+
leftCalendarState.setValue(newValue);
|
|
134
|
+
rightCalendarState.setValue(newValue);
|
|
135
|
+
setRangeSelection({
|
|
136
|
+
start: newValue.start,
|
|
137
|
+
end: newValue.end,
|
|
138
|
+
isSelecting: false
|
|
139
|
+
});
|
|
140
|
+
setHoverDate(null);
|
|
141
|
+
setActivePreset(null);
|
|
142
|
+
} else {
|
|
143
|
+
setValidationRangeError(void 0);
|
|
144
|
+
dialogState.setValue(null);
|
|
145
|
+
leftCalendarState.setValue(null);
|
|
146
|
+
rightCalendarState.setValue(null);
|
|
147
|
+
setRangeSelection({
|
|
148
|
+
start: null,
|
|
149
|
+
end: null,
|
|
150
|
+
isSelecting: false
|
|
151
|
+
});
|
|
152
|
+
setHoverDate(null);
|
|
153
|
+
setActivePreset(null);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const throttledSetHoverDate = useCallback((date) => {
|
|
157
|
+
requestAnimationFrame(() => {
|
|
158
|
+
setHoverDate(date);
|
|
159
|
+
});
|
|
160
|
+
}, []);
|
|
161
|
+
const handleDateHover = useCallback((date) => {
|
|
162
|
+
if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(date);
|
|
163
|
+
}, [
|
|
164
|
+
rangeSelection.isSelecting,
|
|
165
|
+
rangeSelection.start,
|
|
166
|
+
throttledSetHoverDate
|
|
167
|
+
]);
|
|
168
|
+
const handleDateSelection = useCallback((date, calendarSide) => {
|
|
169
|
+
if (calendarSide) {
|
|
170
|
+
const currentVisibleMonth = (calendarSide === "left" ? leftCalendarState : rightCalendarState).visibleRange.start;
|
|
171
|
+
if (date.month !== currentVisibleMonth.month || date.year !== currentVisibleMonth.year) if (calendarSide === "left") {
|
|
172
|
+
leftCalendarState.setFocusedDate(date);
|
|
173
|
+
rightCalendarState.setFocusedDate(date.add({ months: 1 }));
|
|
174
|
+
} else {
|
|
175
|
+
rightCalendarState.setFocusedDate(date);
|
|
176
|
+
leftCalendarState.setFocusedDate(date.subtract({ months: 1 }));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (!rangeSelection.isSelecting || !rangeSelection.start) {
|
|
180
|
+
setRangeSelection({
|
|
181
|
+
start: date,
|
|
182
|
+
end: null,
|
|
183
|
+
isSelecting: true
|
|
184
|
+
});
|
|
185
|
+
setHoverDate(null);
|
|
186
|
+
leftCalendarState.setValue(null);
|
|
187
|
+
rightCalendarState.setValue(null);
|
|
188
|
+
} else {
|
|
189
|
+
const { start } = rangeSelection;
|
|
190
|
+
const end = date;
|
|
191
|
+
const finalStart = start.compare(end) <= 0 ? start : end;
|
|
192
|
+
const finalEnd = start.compare(end) <= 0 ? end : start;
|
|
193
|
+
const newRange = {
|
|
194
|
+
start: finalStart,
|
|
195
|
+
end: finalEnd
|
|
196
|
+
};
|
|
197
|
+
leftCalendarState.setValue(newRange);
|
|
198
|
+
rightCalendarState.setValue(newRange);
|
|
199
|
+
dialogState.setValue(newRange);
|
|
200
|
+
setRangeSelection({
|
|
201
|
+
start: finalStart,
|
|
202
|
+
end: finalEnd,
|
|
203
|
+
isSelecting: false
|
|
204
|
+
});
|
|
205
|
+
setHoverDate(null);
|
|
206
|
+
setActivePreset(null);
|
|
207
|
+
}
|
|
208
|
+
}, [
|
|
209
|
+
rangeSelection,
|
|
210
|
+
leftCalendarState,
|
|
211
|
+
rightCalendarState,
|
|
212
|
+
dialogState
|
|
213
|
+
]);
|
|
214
|
+
const handleKeyboardNavigation = useCallback((event, date, calendarSide) => {
|
|
215
|
+
const currentState = calendarSide === "left" ? leftCalendarState : rightCalendarState;
|
|
216
|
+
const otherState = calendarSide === "left" ? rightCalendarState : leftCalendarState;
|
|
217
|
+
let shouldPreventDefault = false;
|
|
218
|
+
switch (event.key) {
|
|
219
|
+
case "ArrowRight": {
|
|
220
|
+
const nextDate = date.add({ days: 1 });
|
|
221
|
+
const currentMonth = currentState.visibleRange.start;
|
|
222
|
+
const otherMonth = otherState.visibleRange.start;
|
|
223
|
+
if (calendarSide === "left" && nextDate.month !== currentMonth.month) if (nextDate.year === otherMonth.year && nextDate.month === otherMonth.month) {
|
|
224
|
+
otherState.setFocusedDate(nextDate);
|
|
225
|
+
shouldPreventDefault = true;
|
|
226
|
+
} else {
|
|
227
|
+
rightCalendarState.setFocusedDate(nextDate);
|
|
228
|
+
shouldPreventDefault = true;
|
|
229
|
+
}
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
case "ArrowLeft": {
|
|
233
|
+
const prevDate = date.subtract({ days: 1 });
|
|
234
|
+
const currentMonth = currentState.visibleRange.start;
|
|
235
|
+
const otherMonth = otherState.visibleRange.start;
|
|
236
|
+
if (calendarSide === "right" && prevDate.month !== currentMonth.month) if (prevDate.year === otherMonth.year && prevDate.month === otherMonth.month) {
|
|
237
|
+
otherState.setFocusedDate(prevDate);
|
|
238
|
+
shouldPreventDefault = true;
|
|
239
|
+
} else {
|
|
240
|
+
leftCalendarState.setFocusedDate(prevDate);
|
|
241
|
+
shouldPreventDefault = true;
|
|
242
|
+
}
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
case "ArrowDown": {
|
|
246
|
+
const nextWeekDate = date.add({ weeks: 1 });
|
|
247
|
+
const currentMonth = currentState.visibleRange.start;
|
|
248
|
+
const otherMonth = otherState.visibleRange.start;
|
|
249
|
+
if (calendarSide === "left" && nextWeekDate.month !== currentMonth.month) if (nextWeekDate.year === otherMonth.year && nextWeekDate.month === otherMonth.month) {
|
|
250
|
+
otherState.setFocusedDate(nextWeekDate);
|
|
251
|
+
shouldPreventDefault = true;
|
|
252
|
+
} else {
|
|
253
|
+
rightCalendarState.setFocusedDate(nextWeekDate);
|
|
254
|
+
shouldPreventDefault = true;
|
|
255
|
+
}
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
case "ArrowUp": {
|
|
259
|
+
const prevWeekDate = date.subtract({ weeks: 1 });
|
|
260
|
+
const currentMonth = currentState.visibleRange.start;
|
|
261
|
+
const otherMonth = otherState.visibleRange.start;
|
|
262
|
+
if (calendarSide === "right" && prevWeekDate.month !== currentMonth.month) if (prevWeekDate.year === otherMonth.year && prevWeekDate.month === otherMonth.month) {
|
|
263
|
+
otherState.setFocusedDate(prevWeekDate);
|
|
264
|
+
shouldPreventDefault = true;
|
|
265
|
+
} else {
|
|
266
|
+
leftCalendarState.setFocusedDate(prevWeekDate);
|
|
267
|
+
shouldPreventDefault = true;
|
|
268
|
+
}
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
case "Enter":
|
|
272
|
+
case " ":
|
|
273
|
+
handleDateSelection(date);
|
|
274
|
+
shouldPreventDefault = true;
|
|
275
|
+
break;
|
|
276
|
+
case "Escape":
|
|
277
|
+
setRangeSelection({
|
|
278
|
+
start: null,
|
|
279
|
+
end: null,
|
|
280
|
+
isSelecting: false
|
|
281
|
+
});
|
|
282
|
+
setHoverDate(null);
|
|
283
|
+
shouldPreventDefault = true;
|
|
284
|
+
break;
|
|
285
|
+
default: break;
|
|
286
|
+
}
|
|
287
|
+
if (shouldPreventDefault) {
|
|
288
|
+
event.preventDefault();
|
|
289
|
+
event.stopPropagation();
|
|
290
|
+
}
|
|
291
|
+
return shouldPreventDefault;
|
|
292
|
+
}, [
|
|
293
|
+
leftCalendarState,
|
|
294
|
+
rightCalendarState,
|
|
295
|
+
handleDateSelection
|
|
296
|
+
]);
|
|
297
|
+
const syncCalendarStates = useCallback((newValue) => {
|
|
298
|
+
if (isValidRange(newValue)) return;
|
|
299
|
+
leftCalendarState.setValue(newValue);
|
|
300
|
+
rightCalendarState.setValue(newValue);
|
|
301
|
+
dialogState.setValue(newValue);
|
|
302
|
+
if (newValue) setRangeSelection({
|
|
303
|
+
start: newValue.start,
|
|
304
|
+
end: newValue.end,
|
|
305
|
+
isSelecting: false
|
|
306
|
+
});
|
|
307
|
+
else setRangeSelection({
|
|
308
|
+
start: null,
|
|
309
|
+
end: null,
|
|
310
|
+
isSelecting: false
|
|
311
|
+
});
|
|
312
|
+
setHoverDate(null);
|
|
313
|
+
}, [
|
|
314
|
+
isValidRange,
|
|
315
|
+
leftCalendarState,
|
|
316
|
+
rightCalendarState,
|
|
317
|
+
dialogState
|
|
318
|
+
]);
|
|
319
|
+
const onApply = () => {
|
|
320
|
+
const valueToApply = rangeSelection.start && rangeSelection.end ? {
|
|
321
|
+
start: rangeSelection.start,
|
|
322
|
+
end: rangeSelection.end
|
|
323
|
+
} : dialogState.value;
|
|
324
|
+
if (valueToApply) state.setValue(valueToApply);
|
|
325
|
+
state.toggle();
|
|
326
|
+
};
|
|
327
|
+
const onTodayPress = () => {
|
|
328
|
+
const todayDate$1 = today(getLocalTimeZone());
|
|
329
|
+
leftCalendarState.setFocusedDate(todayDate$1);
|
|
330
|
+
rightCalendarState.setFocusedDate(todayDate$1.add({ months: 1 }));
|
|
331
|
+
syncCalendarStates({
|
|
332
|
+
start: todayDate$1,
|
|
333
|
+
end: todayDate$1
|
|
334
|
+
});
|
|
335
|
+
};
|
|
336
|
+
const onOpenChange = (isOpen) => {
|
|
337
|
+
state.toggle();
|
|
338
|
+
if (!isOpen) {
|
|
339
|
+
if (state.value) {
|
|
340
|
+
dialogState.setValue(state.value);
|
|
341
|
+
leftCalendarState.setValue(state.value);
|
|
342
|
+
rightCalendarState.setValue(state.value);
|
|
343
|
+
const startDate = state.value.start || today(getLocalTimeZone());
|
|
344
|
+
const endDate = state.value.end || today(getLocalTimeZone()).add({ months: 1 });
|
|
345
|
+
leftCalendarState.setFocusedDate(startDate);
|
|
346
|
+
if (startDate.year === endDate.year && startDate.month === endDate.month) rightCalendarState.setFocusedDate(startDate.add({ months: 1 }));
|
|
347
|
+
else rightCalendarState.setFocusedDate(endDate);
|
|
348
|
+
setRangeSelection({
|
|
349
|
+
start: state.value.start,
|
|
350
|
+
end: state.value.end,
|
|
351
|
+
isSelecting: false
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
const todayDate = today(getLocalTimeZone());
|
|
357
|
+
const getThisWeekRange = () => {
|
|
358
|
+
return {
|
|
359
|
+
start: startOfWeek(todayDate, locale),
|
|
360
|
+
end: endOfWeek(todayDate, locale)
|
|
361
|
+
};
|
|
362
|
+
};
|
|
363
|
+
const getLastWeekRange = () => {
|
|
364
|
+
const thisWeekStart = startOfWeek(todayDate, locale);
|
|
365
|
+
return {
|
|
366
|
+
start: thisWeekStart.subtract({ weeks: 1 }),
|
|
367
|
+
end: thisWeekStart.subtract({ days: 1 })
|
|
368
|
+
};
|
|
369
|
+
};
|
|
370
|
+
const getThisAndLastWeekRange = () => {
|
|
371
|
+
const thisWeekEnd = endOfWeek(todayDate, locale);
|
|
372
|
+
return {
|
|
373
|
+
start: startOfWeek(todayDate, locale).subtract({ weeks: 1 }),
|
|
374
|
+
end: thisWeekEnd
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
const getThisMonthRange = () => {
|
|
378
|
+
return {
|
|
379
|
+
start: startOfMonth(todayDate),
|
|
380
|
+
end: endOfMonth(todayDate)
|
|
381
|
+
};
|
|
382
|
+
};
|
|
383
|
+
const getThisAndLastMonthRange = () => {
|
|
384
|
+
const thisMonthEnd = endOfMonth(todayDate);
|
|
385
|
+
return {
|
|
386
|
+
start: startOfMonth(todayDate).subtract({ months: 1 }),
|
|
387
|
+
end: thisMonthEnd
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
const presets = [
|
|
391
|
+
{
|
|
392
|
+
label: t(($) => $.ui.datePicker.presets.thisWeek, { ns: "ui" }),
|
|
393
|
+
getValue: getThisWeekRange
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
label: t(($) => $.ui.datePicker.presets.lastWeek, { ns: "ui" }),
|
|
397
|
+
getValue: getLastWeekRange
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
label: t(($) => $.ui.datePicker.presets.thisAndLastWeek, { ns: "ui" }),
|
|
401
|
+
getValue: getThisAndLastWeekRange
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
label: t(($) => $.ui.datePicker.presets.thisMonth, { ns: "ui" }),
|
|
405
|
+
getValue: getThisMonthRange
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
label: t(($) => $.ui.datePicker.presets.thisAndLastMonth, { ns: "ui" }),
|
|
409
|
+
getValue: getThisAndLastMonthRange
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
label: t(($) => $.ui.datePicker.presets.thisYear, { ns: "ui" }),
|
|
413
|
+
getValue: () => ({
|
|
414
|
+
start: startOfYear(todayDate),
|
|
415
|
+
end: todayDate
|
|
416
|
+
})
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
label: t(($) => $.ui.datePicker.presets.lastYear, { ns: "ui" }),
|
|
420
|
+
getValue: () => ({
|
|
421
|
+
start: startOfYear(todayDate.subtract({ years: 1 })),
|
|
422
|
+
end: endOfYear(todayDate.subtract({ years: 1 }))
|
|
423
|
+
})
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
label: t(($) => $.ui.datePicker.presets.thisAndLastYear, { ns: "ui" }),
|
|
427
|
+
getValue: () => ({
|
|
428
|
+
start: startOfYear(todayDate.subtract({ years: 1 })),
|
|
429
|
+
end: todayDate
|
|
430
|
+
})
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
label: t(($) => $.ui.datePicker.presets.soFar, { ns: "ui" }),
|
|
434
|
+
getValue: () => ({
|
|
435
|
+
start: startOfYear(todayDate),
|
|
436
|
+
end: todayDate
|
|
437
|
+
})
|
|
438
|
+
}
|
|
439
|
+
];
|
|
440
|
+
const selectPreset = (preset) => {
|
|
441
|
+
setActivePreset(preset.label);
|
|
442
|
+
const presetValue = preset.getValue();
|
|
443
|
+
syncCalendarStates(presetValue);
|
|
444
|
+
const startDate = presetValue.start;
|
|
445
|
+
leftCalendarState.setFocusedDate(startDate);
|
|
446
|
+
const endDate = presetValue.end;
|
|
447
|
+
if ((endDate.year - startDate.year) * 12 + (endDate.month - startDate.month) > 2) rightCalendarState.setFocusedDate(endDate);
|
|
448
|
+
else {
|
|
449
|
+
const rightCalendarMonth = startDate.add({ months: 1 });
|
|
450
|
+
rightCalendarState.setFocusedDate(rightCalendarMonth);
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
return /* @__PURE__ */ jsx(TooltipWrapper, {
|
|
454
|
+
as,
|
|
455
|
+
error,
|
|
456
|
+
triggerTabIndex: as === "inline" ? -1 : void 0,
|
|
457
|
+
children: /* @__PURE__ */ jsxs(FormField, {
|
|
458
|
+
...formFieldProps,
|
|
459
|
+
as,
|
|
460
|
+
labelProps,
|
|
461
|
+
className: clsx("relative inline-flex w-full flex-col text-left", className),
|
|
462
|
+
tabIndex: as === "inline" ? -1 : void 0,
|
|
463
|
+
children: [/* @__PURE__ */ jsx(DatePickerInput, {
|
|
464
|
+
ref: mergeRefs(ref, datePickerInputRef),
|
|
465
|
+
as,
|
|
466
|
+
groupProps,
|
|
467
|
+
fieldProps: {
|
|
468
|
+
...startFieldProps,
|
|
469
|
+
placeholderValue: PLACEHOLDER_VALUE
|
|
470
|
+
},
|
|
471
|
+
endFieldProps: {
|
|
472
|
+
...endFieldProps,
|
|
473
|
+
placeholderValue: PLACEHOLDER_VALUE
|
|
474
|
+
},
|
|
475
|
+
buttonProps,
|
|
476
|
+
isDisabled,
|
|
477
|
+
isInvalid: !!error,
|
|
478
|
+
disableDropdown,
|
|
479
|
+
variant,
|
|
480
|
+
size,
|
|
481
|
+
isClearable,
|
|
482
|
+
headerProps,
|
|
483
|
+
todayIcon,
|
|
484
|
+
isDirty,
|
|
485
|
+
disableManualEntry,
|
|
486
|
+
placeholder,
|
|
487
|
+
onOpenDropdown: () => state.toggle()
|
|
488
|
+
}), /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
489
|
+
hideSidebar,
|
|
490
|
+
sidebar: /* @__PURE__ */ jsx("div", {
|
|
491
|
+
className: "flex w-full flex-row overflow-auto border-elevation-outline-default-1 border-solid [-ms-overflow-style:none] [scrollbar-width:none] md:w-[156px] md:flex-col md:border-r [&::-webkit-scrollbar]:hidden",
|
|
492
|
+
children: presets.map((preset) => /* @__PURE__ */ jsx(Button, {
|
|
493
|
+
onClick: () => selectPreset(preset),
|
|
494
|
+
className: clsx("w-full px-2 py-1 text-left md:px-list-side-item md:py-list-height-item", activePreset !== preset.label && "text-interactive-text-secondary-idle hover:text-interactive-text-secondary-hover", activePreset === preset.label && "bg-interactive-contained-primary-idle text-interactive-text-secondary-idle-inverted"),
|
|
495
|
+
children: /* @__PURE__ */ jsx(Typography, {
|
|
496
|
+
size: "label-2",
|
|
497
|
+
sizeMobile: "label-3",
|
|
498
|
+
as: "span",
|
|
499
|
+
className: "whitespace-nowrap",
|
|
500
|
+
children: preset.label
|
|
501
|
+
})
|
|
502
|
+
}, preset.label))
|
|
503
|
+
}),
|
|
504
|
+
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
505
|
+
isDisabled,
|
|
506
|
+
isValid: !dialogState.isInvalid && !!dialogState.value,
|
|
507
|
+
onTodayPress,
|
|
508
|
+
onApply
|
|
509
|
+
}),
|
|
510
|
+
label,
|
|
511
|
+
triggerRef: dateRangePickerRef,
|
|
512
|
+
dialogProps,
|
|
513
|
+
isOpen: state.isOpen,
|
|
514
|
+
onOpenChange,
|
|
515
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
516
|
+
className: "mb-4 flex max-w-[804px] md:mb-0",
|
|
517
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
518
|
+
className: "flex flex-1 justify-center",
|
|
519
|
+
children: /* @__PURE__ */ jsx(RangeCalendar, {
|
|
520
|
+
leftCalendarState,
|
|
521
|
+
rightCalendarState,
|
|
522
|
+
calendarProps,
|
|
523
|
+
onApply,
|
|
524
|
+
onRangeChange: syncCalendarStates,
|
|
525
|
+
onDateSelection: handleDateSelection,
|
|
526
|
+
onDateHover: handleDateHover,
|
|
527
|
+
rangeSelection,
|
|
528
|
+
hoverDate,
|
|
529
|
+
onKeyboardNavigation: handleKeyboardNavigation
|
|
530
|
+
})
|
|
531
|
+
})
|
|
532
|
+
})
|
|
533
|
+
})]
|
|
534
|
+
})
|
|
535
|
+
});
|
|
536
|
+
};
|
|
537
|
+
const DateRangePicker = ({ fullIso = true, minValue, maxValue,...props }) => {
|
|
538
|
+
const formatDateRange = (range) => {
|
|
539
|
+
if (!range?.start || !range?.end) return null;
|
|
540
|
+
if (fullIso) return {
|
|
541
|
+
start: DateTimeUtils.fromCalendarDateToUTCISO(range.start),
|
|
542
|
+
end: DateTimeUtils.fromCalendarDateToUTCISO(range.end, { endOfDay: true })
|
|
543
|
+
};
|
|
544
|
+
const startDate = DateTimeUtils.fromDateValueToLocal(range.start);
|
|
545
|
+
const endDate = DateTimeUtils.fromDateValueToLocal(range.end);
|
|
546
|
+
return {
|
|
547
|
+
start: DateTime.fromJSDate(startDate).toISODate(),
|
|
548
|
+
end: DateTime.fromJSDate(endDate).toISODate()
|
|
549
|
+
};
|
|
550
|
+
};
|
|
551
|
+
const parseDateRange = (formattedRange) => {
|
|
552
|
+
if (!formattedRange?.start || !formattedRange?.end) return formattedRange;
|
|
553
|
+
if (fullIso) return {
|
|
554
|
+
start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
|
|
555
|
+
end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
|
|
556
|
+
};
|
|
557
|
+
const startDate = DateTime.fromISO(formattedRange.start).toJSDate();
|
|
558
|
+
const endDate = DateTime.fromISO(formattedRange.end).toJSDate();
|
|
559
|
+
const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate);
|
|
560
|
+
const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate);
|
|
561
|
+
return {
|
|
562
|
+
start: toCalendarDate(startZonedDateTime),
|
|
563
|
+
end: toCalendarDate(endZonedDateTime)
|
|
564
|
+
};
|
|
565
|
+
};
|
|
566
|
+
const parseCalendarDate = (formattedDate) => {
|
|
567
|
+
if (formattedDate == null) return formattedDate;
|
|
568
|
+
if (fullIso) return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
|
|
569
|
+
const date = DateTime.fromISO(formattedDate).toJSDate();
|
|
570
|
+
return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date));
|
|
571
|
+
};
|
|
572
|
+
const dateLimits = {
|
|
573
|
+
minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
|
|
574
|
+
maxValue: typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue
|
|
575
|
+
};
|
|
576
|
+
if ("formControl" in props && props.formControl) {
|
|
577
|
+
const { formControl, ref,...innerProps } = props;
|
|
578
|
+
return /* @__PURE__ */ jsx(Controller, {
|
|
579
|
+
control: formControl.control,
|
|
580
|
+
name: formControl.name,
|
|
581
|
+
render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DateRangePickerBase, {
|
|
582
|
+
...innerProps,
|
|
583
|
+
...dateLimits,
|
|
584
|
+
ref: mergeRefs(ref, field.ref),
|
|
585
|
+
value: parseDateRange(field.value),
|
|
586
|
+
onChange: (value) => field.onChange(formatDateRange(value)),
|
|
587
|
+
onBlur: field.onBlur,
|
|
588
|
+
isDirty,
|
|
589
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
590
|
+
error: props.error ?? error?.message
|
|
591
|
+
})
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
return /* @__PURE__ */ jsx(DateRangePickerBase, {
|
|
595
|
+
...props,
|
|
596
|
+
...dateLimits,
|
|
597
|
+
value: parseDateRange(props.value),
|
|
598
|
+
onChange: (value) => props.onChange?.(formatDateRange(value))
|
|
599
|
+
});
|
|
600
|
+
};
|
|
601
|
+
export { DateRangePicker };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { useRef } from "react";
|
|
4
|
+
import { useDateSegment } from "react-aria";
|
|
5
|
+
const getPlaceholder = (segment) => {
|
|
6
|
+
if (!segment.isPlaceholder) return null;
|
|
7
|
+
switch (segment.type) {
|
|
8
|
+
case "hour": return "hh";
|
|
9
|
+
case "minute": return "mm";
|
|
10
|
+
case "second": return "ss";
|
|
11
|
+
default: return segment.placeholder;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const DateSegmentItem = ({ segment, state, isDisabled, timePickerOnly, hidePlaceholder }) => {
|
|
15
|
+
const ref = useRef(null);
|
|
16
|
+
const { segmentProps } = useDateSegment(segment, state, ref);
|
|
17
|
+
const isInputEmpty = !state.value;
|
|
18
|
+
return /* @__PURE__ */ jsx("div", {
|
|
19
|
+
...segmentProps,
|
|
20
|
+
ref,
|
|
21
|
+
className: clsx("box-content rounded-input-rounding-default", isDisabled && "text-interactive-text-secondary-disabled", !isDisabled && isInputEmpty && "text-text-default-3 group-focus-within:text-text-default-1", !isDisabled && !isInputEmpty && "text-text-default-1", "focus-within:outline-1 focus-within:outline-interactive-contained-primary-idle focus-within:outline-offset-1", ["hour", "dayPeriod"].includes(segment.type) && !timePickerOnly && "ml-1", hidePlaceholder && "opacity-0"),
|
|
22
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [segment.isPlaceholder && /* @__PURE__ */ jsx("span", {
|
|
23
|
+
"aria-hidden": "true",
|
|
24
|
+
className: "pointer-events-none",
|
|
25
|
+
children: getPlaceholder(segment)
|
|
26
|
+
}), segment.isPlaceholder ? "" : segment.text] })
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
export { DateSegmentItem, getPlaceholder };
|
package/dist/DateTime.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
const DateTimeIcon = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
3
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4
|
+
fill: "none",
|
|
5
|
+
viewBox: "0 0 24 24",
|
|
6
|
+
className: "fill-current",
|
|
7
|
+
...props,
|
|
8
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
9
|
+
fill: "currentColor",
|
|
10
|
+
d: "m18.37 18.852.573-.573-1.534-1.533v-2.291h-.818v2.618zM17.02 21q-1.718 0-2.914-1.186-1.197-1.187-1.197-2.905t1.197-2.904 2.914-1.187q1.699 0 2.884 1.197 1.187 1.196 1.187 2.894t-1.187 2.894T17.02 21"
|
|
11
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
12
|
+
fill: "currentColor",
|
|
13
|
+
fillRule: "evenodd",
|
|
14
|
+
d: "M14.218 3a.74.74 0 0 1 .736.744v.744h1.473c1.22 0 2.21.999 2.21 2.231v4.7a5.7 5.7 0 0 0-1.473-.235v-.746H5.382v6.694c0 .411.33.744.736.744h5.236c.089.523.25 1.023.47 1.488H6.118a2.22 2.22 0 0 1-2.209-2.232V6.72a2.22 2.22 0 0 1 2.21-2.231H7.59v-.744c0-.411.33-.744.736-.744a.74.74 0 0 1 .737.744v.744h4.418v-.744c0-.411.33-.744.736-.744m2.946 3.719V8.95H5.382V6.72c0-.41.33-.744.736-.744h1.473v.744c0 .41.33.744.736.744a.74.74 0 0 0 .737-.744v-.744h4.418v.744c0 .41.33.744.736.744a.74.74 0 0 0 .736-.744v-.744h1.473a.74.74 0 0 1 .737.744",
|
|
15
|
+
clipRule: "evenodd"
|
|
16
|
+
})]
|
|
17
|
+
});
|
|
18
|
+
export { DateTimeIcon };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BottomSheet } from "./BottomSheet.js";
|
|
2
|
+
import { useBreakpoint } from "./useBreakpoint.js";
|
|
3
|
+
import { FormFieldHeader } from "./FormFieldHeader.js";
|
|
4
|
+
import { FormFieldHeaderClose } from "./FormFieldHeaderClose.js";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Dialog, Popover } from "react-aria-components";
|
|
7
|
+
const DateTimeDialog = ({ hideSidebar, children, footer, sidebar, label, isOpen, triggerRef, dialogProps, onOpenChange }) => {
|
|
8
|
+
if (useBreakpoint("md")) {
|
|
9
|
+
if (!isOpen) return null;
|
|
10
|
+
return /* @__PURE__ */ jsx(Popover, {
|
|
11
|
+
triggerRef,
|
|
12
|
+
isOpen,
|
|
13
|
+
placement: "bottom start",
|
|
14
|
+
onOpenChange,
|
|
15
|
+
children: /* @__PURE__ */ jsx(Dialog, {
|
|
16
|
+
...dialogProps,
|
|
17
|
+
className: "outline-none!",
|
|
18
|
+
"aria-label": label,
|
|
19
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
20
|
+
className: "flex overflow-hidden rounded-input-rounding-default border border-elevation-outline-default-1 border-solid bg-elevation-fill-default-1 shadow-5",
|
|
21
|
+
children: [!hideSidebar && sidebar, /* @__PURE__ */ jsxs("div", {
|
|
22
|
+
className: "flex flex-1 flex-col justify-between",
|
|
23
|
+
children: [children, footer]
|
|
24
|
+
})]
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return /* @__PURE__ */ jsx(BottomSheet, {
|
|
30
|
+
label,
|
|
31
|
+
footer,
|
|
32
|
+
isOpen,
|
|
33
|
+
onOpenChange,
|
|
34
|
+
sheetMarginBottom: 0,
|
|
35
|
+
isScrollable: false,
|
|
36
|
+
height: "auto",
|
|
37
|
+
isDismissable: true,
|
|
38
|
+
children: (close) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
39
|
+
/* @__PURE__ */ jsx(FormFieldHeader, {
|
|
40
|
+
label,
|
|
41
|
+
className: "mb-8! shrink-0 px-4 pt-3",
|
|
42
|
+
rightContent: /* @__PURE__ */ jsx(FormFieldHeaderClose, { onClose: close })
|
|
43
|
+
}),
|
|
44
|
+
children,
|
|
45
|
+
!hideSidebar && sidebar
|
|
46
|
+
] })
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
export { DateTimeDialog };
|