@povio/ui 0.0.2 → 0.0.4
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/package.json +70 -9
- package/src/assets/icons/AlignCenter.tsx +16 -0
- package/src/assets/icons/AlignLeft.tsx +16 -0
- package/src/assets/icons/AlignLeftRight.tsx +16 -0
- package/src/assets/icons/AlignRight.tsx +16 -0
- package/src/assets/icons/ArrowDropDown.tsx +16 -0
- package/src/assets/icons/ArrowDropUp.tsx +16 -0
- package/src/assets/icons/ArrowLeft.tsx +16 -0
- package/src/assets/icons/ArrowRight.tsx +16 -0
- package/src/assets/icons/Bold.tsx +16 -0
- package/src/assets/icons/BulletedList.tsx +16 -0
- package/src/assets/icons/Calendar.tsx +18 -0
- package/src/assets/icons/Check.tsx +18 -0
- package/src/assets/icons/CheckCircle.tsx +16 -0
- package/src/assets/icons/CheckboxCheckmark.tsx +19 -0
- package/src/assets/icons/CheckboxIndeterminate.tsx +19 -0
- package/src/assets/icons/ChevronDown.tsx +18 -0
- package/src/assets/icons/ChevronLeft.tsx +18 -0
- package/src/assets/icons/ChevronRight.tsx +18 -0
- package/src/assets/icons/ChevronUp.tsx +18 -0
- package/src/assets/icons/ChevronsLeft.tsx +24 -0
- package/src/assets/icons/ChevronsRight.tsx +24 -0
- package/src/assets/icons/Clock.tsx +16 -0
- package/src/assets/icons/Close.tsx +16 -0
- package/src/assets/icons/DateTime.tsx +20 -0
- package/src/assets/icons/Drag.tsx +16 -0
- package/src/assets/icons/File.tsx +18 -0
- package/src/assets/icons/Highlight.tsx +16 -0
- package/src/assets/icons/HighlightOn.tsx +26 -0
- package/src/assets/icons/Info.tsx +24 -0
- package/src/assets/icons/Italic.tsx +16 -0
- package/src/assets/icons/Link.tsx +16 -0
- package/src/assets/icons/Menu.tsx +18 -0
- package/src/assets/icons/NumberedList.tsx +16 -0
- package/src/assets/icons/PointerHorizontal.tsx +16 -0
- package/src/assets/icons/PointerVertical.tsx +16 -0
- package/src/assets/icons/Send.tsx +18 -0
- package/src/assets/icons/Strikethrough.tsx +16 -0
- package/src/assets/icons/TextColor.tsx +24 -0
- package/src/assets/icons/Today.tsx +16 -0
- package/src/assets/icons/Underlined.tsx +18 -0
- package/src/assets/icons/Upload.tsx +20 -0
- package/src/assets/icons/View.tsx +16 -0
- package/src/assets/icons/ViewOff.tsx +16 -0
- package/src/assets/icons/Warningfilled.tsx +18 -0
- package/src/assets/locales/en/translation.json +156 -0
- package/src/assets/locales/sl/translation.json +152 -0
- package/src/components/Menu/Menu.tsx +29 -0
- package/src/components/Menu/MenuDesktop.tsx +68 -0
- package/src/components/Menu/MenuItem.tsx +33 -0
- package/src/components/Menu/MenuMobile.tsx +81 -0
- package/src/components/Menu/MenuPopover.tsx +45 -0
- package/src/components/buttons/Button/Button.tsx +108 -0
- package/src/components/buttons/Button/button.cva.ts +678 -0
- package/src/components/buttons/IconButton/IconButton.tsx +25 -0
- package/src/components/buttons/InlineIconButton/InlineIconButton.tsx +27 -0
- package/src/components/buttons/PillButton/PillButton.tsx +70 -0
- package/src/components/buttons/PillButton/pillButton.cva.ts +88 -0
- package/src/components/buttons/SplitButton/SplitButton.tsx +61 -0
- package/src/components/buttons/TextButton/TextButton.tsx +29 -0
- package/src/components/buttons/ToggleButton/ToggleButton.tsx +28 -0
- package/src/components/buttons/shared/ButtonContent.tsx +61 -0
- package/src/components/buttons/shared/buttonContent.cva.ts +18 -0
- package/src/components/inputs/Checkbox/Checkbox.tsx +101 -0
- package/src/components/inputs/Checkbox/CheckboxCheckmark.tsx +47 -0
- package/src/components/inputs/Checkbox/checkbox.cva.ts +51 -0
- package/src/components/inputs/DateTime/DatePicker/DatePicker.tsx +269 -0
- package/src/components/inputs/DateTime/DateRangePicker/DateRangePicker.tsx +808 -0
- package/src/components/inputs/DateTime/DateTimePicker/DateTimePicker.tsx +291 -0
- package/src/components/inputs/DateTime/TimePicker/TimePicker.tsx +255 -0
- package/src/components/inputs/DateTime/shared/Calendar.tsx +104 -0
- package/src/components/inputs/DateTime/shared/CalendarCell.tsx +247 -0
- package/src/components/inputs/DateTime/shared/CalendarGrid.tsx +102 -0
- package/src/components/inputs/DateTime/shared/CalendarHeader.tsx +110 -0
- package/src/components/inputs/DateTime/shared/CalendarSelectHeader.tsx +228 -0
- package/src/components/inputs/DateTime/shared/DateField.tsx +83 -0
- package/src/components/inputs/DateTime/shared/DatePickerInput.tsx +170 -0
- package/src/components/inputs/DateTime/shared/DateSegmentItem.tsx +65 -0
- package/src/components/inputs/DateTime/shared/DateTimeDialog.tsx +87 -0
- package/src/components/inputs/DateTime/shared/DateTimeDialogFooter.tsx +42 -0
- package/src/components/inputs/DateTime/shared/MonthPicker.tsx +91 -0
- package/src/components/inputs/DateTime/shared/RangeCalendar.tsx +160 -0
- package/src/components/inputs/DateTime/shared/TimeField.tsx +36 -0
- package/src/components/inputs/DateTime/shared/TimePickerForm.tsx +222 -0
- package/src/components/inputs/DateTime/shared/TimePickerInput.tsx +114 -0
- package/src/components/inputs/DateTime/shared/YearPicker.tsx +100 -0
- package/src/components/inputs/File/FileUpload.tsx +285 -0
- package/src/components/inputs/File/FileUploadContainer.tsx +16 -0
- package/src/components/inputs/File/InputUpload.tsx +196 -0
- package/src/components/inputs/File/fileUpload.types.ts +100 -0
- package/src/components/inputs/File/index.ts +15 -0
- package/src/components/inputs/File/inputUpload.types.ts +41 -0
- package/src/components/inputs/File/shared/FileCard.tsx +72 -0
- package/src/components/inputs/File/shared/FileCardList.tsx +30 -0
- package/src/components/inputs/File/shared/FileProgressBar.tsx +25 -0
- package/src/components/inputs/File/shared/FileUploadContent.tsx +99 -0
- package/src/components/inputs/File/shared/FileUploadContentEmpty.tsx +94 -0
- package/src/components/inputs/File/shared/FileUploadContentError.tsx +170 -0
- package/src/components/inputs/File/shared/FileUploadContentFilled.tsx +179 -0
- package/src/components/inputs/File/shared/FileUploadContentLoading.tsx +115 -0
- package/src/components/inputs/File/shared/InputUploadContent.tsx +68 -0
- package/src/components/inputs/File/shared/InputUploadFilled.tsx +32 -0
- package/src/components/inputs/File/shared/fileUpload.cva.ts +59 -0
- package/src/components/inputs/File/shared/inputUploadButton.cva.ts +48 -0
- package/src/components/inputs/FormField/FormField.tsx +69 -0
- package/src/components/inputs/FormField/FormFieldError.tsx +21 -0
- package/src/components/inputs/FormField/FormFieldHeader.tsx +75 -0
- package/src/components/inputs/FormField/FormFieldHeaderClose.tsx +23 -0
- package/src/components/inputs/FormField/FormFieldLabel.tsx +41 -0
- package/src/components/inputs/Input/NumberInput/NumberInput.tsx +180 -0
- package/src/components/inputs/Input/PasswordInput/PasswordInput.tsx +34 -0
- package/src/components/inputs/Input/TextArea/TextArea.tsx +166 -0
- package/src/components/inputs/Input/TextInput/TextInput.tsx +181 -0
- package/src/components/inputs/Input/shared/InputContent.tsx +154 -0
- package/src/components/inputs/Inputs/Form.tsx +129 -0
- package/src/components/inputs/Inputs/InputItem.tsx +127 -0
- package/src/components/inputs/Inputs/Inputs.tsx +43 -0
- package/src/components/inputs/RadioGroup/RadioGroup.tsx +139 -0
- package/src/components/inputs/RadioGroup/radio.cva.ts +51 -0
- package/src/components/inputs/Selection/Autocomplete/Autocomplete.tsx +61 -0
- package/src/components/inputs/Selection/Autocomplete/QueryAutocomplete.tsx +58 -0
- package/src/components/inputs/Selection/Select/Select.tsx +59 -0
- package/src/components/inputs/Selection/shared/SelectBase.tsx +69 -0
- package/src/components/inputs/Selection/shared/SelectDesktop.tsx +236 -0
- package/src/components/inputs/Selection/shared/SelectInput.tsx +278 -0
- package/src/components/inputs/Selection/shared/SelectListBox.tsx +121 -0
- package/src/components/inputs/Selection/shared/SelectListBoxItem.tsx +79 -0
- package/src/components/inputs/Selection/shared/SelectListBoxItemSelectAll.tsx +40 -0
- package/src/components/inputs/Selection/shared/SelectListBoxLoadingItem.tsx +52 -0
- package/src/components/inputs/Selection/shared/SelectListBoxSelectionBar.tsx +39 -0
- package/src/components/inputs/Selection/shared/SelectMobile.tsx +169 -0
- package/src/components/inputs/Selection/shared/select.context.tsx +316 -0
- package/src/components/inputs/Selection/shared/select.types.ts +75 -0
- package/src/components/inputs/Selection/shared/useSelectItems.tsx +127 -0
- package/src/components/inputs/Slider/Slider.tsx +174 -0
- package/src/components/inputs/TextEditor/TextEditor.tsx +239 -0
- package/src/components/inputs/TextEditor/Toolbar/ColorPicker.tsx +34 -0
- package/src/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.tsx +74 -0
- package/src/components/inputs/TextEditor/Toolbar/HyperlinkAction.tsx +87 -0
- package/src/components/inputs/TextEditor/Toolbar/TextAlignSelect.tsx +64 -0
- package/src/components/inputs/TextEditor/Toolbar/TextColorSelect.tsx +30 -0
- package/src/components/inputs/TextEditor/Toolbar/TextEditorToolbar.tsx +40 -0
- package/src/components/inputs/TextEditor/Toolbar/TextHighlightSelect.tsx +39 -0
- package/src/components/inputs/TextEditor/Toolbar/TextListActions.tsx +57 -0
- package/src/components/inputs/TextEditor/Toolbar/TextMarksActions.tsx +79 -0
- package/src/components/inputs/TextEditor/Toolbar/TextStyleSelect.tsx +73 -0
- package/src/components/inputs/TextEditor/textEditor.types.ts +43 -0
- package/src/components/inputs/Toggle/Toggle.tsx +80 -0
- package/src/components/inputs/Toggle/toggle.cva.ts +48 -0
- package/src/components/inputs/shared/CheckContent.tsx +26 -0
- package/src/components/inputs/shared/InputClear.tsx +29 -0
- package/src/components/inputs/shared/form.types.ts +28 -0
- package/src/components/inputs/shared/input.cva.ts +182 -0
- package/src/components/inputs/shared/label.cva.ts +146 -0
- package/src/components/outline.clsx.ts +9 -0
- package/src/components/overlays/ActionModal/ActionModal.tsx +93 -0
- package/src/components/overlays/BottomSheet/BottomSheet.tsx +270 -0
- package/src/components/overlays/Drawer/Drawer.tsx +93 -0
- package/src/components/overlays/Modal/Modal.tsx +63 -0
- package/src/components/overlays/Modal/modal.cva.ts +55 -0
- package/src/components/overlays/ResponsivePopover/ResponsivePopover.tsx +77 -0
- package/src/components/overlays/Tooltip/Tooltip.tsx +47 -0
- package/src/components/overlays/Tooltip/TooltipEllipsis.tsx +35 -0
- package/src/components/segment/Segment.tsx +121 -0
- package/src/components/segment/SegmentItem.tsx +41 -0
- package/src/components/segment/segment.types.ts +44 -0
- package/src/components/shared/pagination/Pagination.tsx +75 -0
- package/src/components/shared/pagination/PaginationList.tsx +174 -0
- package/src/components/shared/pagination/minWidth.cva.ts +13 -0
- package/src/components/status/Alert/Alert.tsx +58 -0
- package/src/components/status/Alert/alert.cva.ts +66 -0
- package/src/components/status/Loader/Loader.tsx +32 -0
- package/src/components/status/Loader/loader.cva.ts +29 -0
- package/src/components/status/Toast/Toast.tsx +86 -0
- package/src/components/status/Toast/toast.cva.ts +154 -0
- package/src/components/status/Toast/useToast.tsx +77 -0
- package/src/components/status/shared/status.cva.ts +60 -0
- package/src/components/table/CellText.tsx +23 -0
- package/src/components/table/ColumnConfig.tsx +145 -0
- package/src/components/table/HeaderText.tsx +18 -0
- package/src/components/table/InfiniteTable.tsx +51 -0
- package/src/components/table/PaginatedTable.tsx +38 -0
- package/src/components/table/Table.tsx +456 -0
- package/src/components/table/table.cva.ts +47 -0
- package/src/components/text/Link/Link.tsx +21 -0
- package/src/components/text/Link/link.cva.ts +21 -0
- package/src/components/text/Tag/Tag.tsx +59 -0
- package/src/components/text/Tag/tag.cva.ts +62 -0
- package/src/components/text/Typography/Typography.tsx +33 -0
- package/src/components/text/Typography/typography.cva.ts +102 -0
- package/src/config/confirmation.context.tsx +133 -0
- package/src/config/i18n.ts +12 -0
- package/src/config/router.context.tsx +66 -0
- package/src/config/uiConfig.context.tsx +89 -0
- package/src/config/uiStyle.context.tsx +100 -0
- package/src/helpers/dynamicColumns.ts +567 -0
- package/src/helpers/dynamicInputs.ts +392 -0
- package/src/hooks/useAutosave.ts +109 -0
- package/src/hooks/useBreakpoint.ts +26 -0
- package/src/hooks/useDebounceCallback.ts +35 -0
- package/src/hooks/useDeepCompare.ts +27 -0
- package/src/hooks/useFilters.ts +154 -0
- package/src/hooks/useForm.ts +54 -0
- package/src/hooks/useFormAutosave.ts +100 -0
- package/src/hooks/useIntersectionObserver.ts +33 -0
- package/src/hooks/useLocalStorage.ts +81 -0
- package/src/hooks/useLongPressRepeat.ts +40 -0
- package/src/hooks/usePagination.ts +41 -0
- package/src/hooks/useScrollableListBox.ts +35 -0
- package/src/hooks/useSingletonMutation.ts +30 -0
- package/src/hooks/useSorting.ts +39 -0
- package/src/hooks/useStateAndRef.ts +20 -0
- package/src/hooks/useTableColumnConfig.ts +86 -0
- package/src/hooks/useTableNav.ts +615 -0
- package/src/hooks/useTranslationMemo.ts +17 -0
- package/src/index.ts +252 -0
- package/src/types/{common.d.ts → common.ts} +15 -4
- package/src/types/i18next.d.ts +11 -0
- package/src/types/react-query.ts +48 -0
- package/src/types/table.d.ts +17 -0
- package/src/utils/array.utils.spec.ts +16 -0
- package/src/utils/array.utils.ts +9 -0
- package/src/utils/compoundMapper.spec.ts +91 -0
- package/src/utils/compoundMapper.ts +42 -0
- package/src/utils/date-time.utils.spec.ts +48 -0
- package/src/utils/date-time.utils.ts +85 -0
- package/src/utils/date.utils.spec.ts +12 -0
- package/src/utils/date.utils.ts +9 -0
- package/src/utils/dom.utils.ts +16 -0
- package/src/utils/file.utils.ts +73 -0
- package/src/utils/isEqual.ts +153 -0
- package/src/utils/logger.ts +19 -0
- package/src/utils/object.utils.ts +62 -0
- package/src/utils/queries.utils.ts +10 -0
- package/src/utils/rest/interceptors/logging.interceptor.ts +16 -0
- package/src/utils/rest/interceptors/response.interceptor.ts +27 -0
- package/src/utils/rest/interceptors/rest-interceptor.ts +22 -0
- package/src/utils/rest/rest-client.ts +125 -0
- package/src/utils/rest/rest.utils.ts +65 -0
- package/src/utils/routing.utils.ts +12 -0
- package/src/utils/string.utils.ts +9 -0
- package/src/utils/vendor/error-handling.ts +170 -0
- package/src/utils/zod.utils.ts +95 -0
- package/index.js +0 -61206
- package/povio-ui-0.0.2.tgz +0 -0
- package/src/assets/icons/AlignCenter.d.ts +0 -2
- package/src/assets/icons/AlignLeft.d.ts +0 -2
- package/src/assets/icons/AlignLeftRight.d.ts +0 -2
- package/src/assets/icons/AlignRight.d.ts +0 -2
- package/src/assets/icons/ArrowDropDown.d.ts +0 -2
- package/src/assets/icons/ArrowDropUp.d.ts +0 -2
- package/src/assets/icons/ArrowLeft.d.ts +0 -2
- package/src/assets/icons/ArrowRight.d.ts +0 -2
- package/src/assets/icons/Bold.d.ts +0 -2
- package/src/assets/icons/BulletedList.d.ts +0 -2
- package/src/assets/icons/Calendar.d.ts +0 -2
- package/src/assets/icons/Check.d.ts +0 -2
- package/src/assets/icons/CheckCircle.d.ts +0 -2
- package/src/assets/icons/CheckboxCheckmark.d.ts +0 -2
- package/src/assets/icons/CheckboxIndeterminate.d.ts +0 -2
- package/src/assets/icons/ChevronDown.d.ts +0 -2
- package/src/assets/icons/ChevronLeft.d.ts +0 -2
- package/src/assets/icons/ChevronRight.d.ts +0 -2
- package/src/assets/icons/ChevronUp.d.ts +0 -2
- package/src/assets/icons/ChevronsLeft.d.ts +0 -2
- package/src/assets/icons/ChevronsRight.d.ts +0 -2
- package/src/assets/icons/Clock.d.ts +0 -2
- package/src/assets/icons/Close.d.ts +0 -2
- package/src/assets/icons/DateTime.d.ts +0 -2
- package/src/assets/icons/Drag.d.ts +0 -2
- package/src/assets/icons/File.d.ts +0 -2
- package/src/assets/icons/Highlight.d.ts +0 -2
- package/src/assets/icons/HighlightOn.d.ts +0 -6
- package/src/assets/icons/Info.d.ts +0 -2
- package/src/assets/icons/Italic.d.ts +0 -2
- package/src/assets/icons/Link.d.ts +0 -2
- package/src/assets/icons/Menu.d.ts +0 -2
- package/src/assets/icons/NumberedList.d.ts +0 -2
- package/src/assets/icons/PointerHorizontal.d.ts +0 -2
- package/src/assets/icons/PointerVertical.d.ts +0 -2
- package/src/assets/icons/Send.d.ts +0 -2
- package/src/assets/icons/Strikethrough.d.ts +0 -2
- package/src/assets/icons/TextColor.d.ts +0 -6
- package/src/assets/icons/Today.d.ts +0 -2
- package/src/assets/icons/Underlined.d.ts +0 -2
- package/src/assets/icons/Upload.d.ts +0 -2
- package/src/assets/icons/View.d.ts +0 -2
- package/src/assets/icons/ViewOff.d.ts +0 -2
- package/src/assets/icons/Warningfilled.d.ts +0 -2
- package/src/components/Menu/Menu.d.ts +0 -14
- package/src/components/Menu/MenuDesktop.d.ts +0 -2
- package/src/components/Menu/MenuItem.d.ts +0 -5
- package/src/components/Menu/MenuMobile.d.ts +0 -2
- package/src/components/Menu/MenuPopover.d.ts +0 -5
- package/src/components/buttons/Button/Button.d.ts +0 -27
- package/src/components/buttons/Button/button.cva.d.ts +0 -30
- package/src/components/buttons/IconButton/IconButton.d.ts +0 -10
- package/src/components/buttons/InlineIconButton/InlineIconButton.d.ts +0 -11
- package/src/components/buttons/PillButton/PillButton.d.ts +0 -11
- package/src/components/buttons/PillButton/pillButton.cva.d.ts +0 -14
- package/src/components/buttons/SplitButton/SplitButton.d.ts +0 -10
- package/src/components/buttons/TextButton/TextButton.d.ts +0 -11
- package/src/components/buttons/ToggleButton/ToggleButton.d.ts +0 -9
- package/src/components/buttons/shared/ButtonContent.d.ts +0 -16
- package/src/components/buttons/shared/buttonContent.cva.d.ts +0 -6
- package/src/components/inputs/Checkbox/Checkbox.d.ts +0 -17
- package/src/components/inputs/Checkbox/CheckboxCheckmark.d.ts +0 -9
- package/src/components/inputs/Checkbox/checkbox.cva.d.ts +0 -11
- package/src/components/inputs/DateTime/DatePicker/DatePicker.d.ts +0 -24
- package/src/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +0 -32
- package/src/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +0 -22
- package/src/components/inputs/DateTime/TimePicker/TimePicker.d.ts +0 -20
- package/src/components/inputs/DateTime/shared/Calendar.d.ts +0 -20
- package/src/components/inputs/DateTime/shared/CalendarCell.d.ts +0 -20
- package/src/components/inputs/DateTime/shared/CalendarGrid.d.ts +0 -25
- package/src/components/inputs/DateTime/shared/CalendarHeader.d.ts +0 -16
- package/src/components/inputs/DateTime/shared/CalendarSelectHeader.d.ts +0 -17
- package/src/components/inputs/DateTime/shared/DateField.d.ts +0 -12
- package/src/components/inputs/DateTime/shared/DatePickerInput.d.ts +0 -20
- package/src/components/inputs/DateTime/shared/DateSegmentItem.d.ts +0 -11
- package/src/components/inputs/DateTime/shared/DateTimeDialog.d.ts +0 -15
- package/src/components/inputs/DateTime/shared/DateTimeDialogFooter.d.ts +0 -7
- package/src/components/inputs/DateTime/shared/MonthPicker.d.ts +0 -7
- package/src/components/inputs/DateTime/shared/RangeCalendar.d.ts +0 -26
- package/src/components/inputs/DateTime/shared/TimeField.d.ts +0 -12
- package/src/components/inputs/DateTime/shared/TimePickerForm.d.ts +0 -10
- package/src/components/inputs/DateTime/shared/TimePickerInput.d.ts +0 -18
- package/src/components/inputs/DateTime/shared/YearPicker.d.ts +0 -8
- package/src/components/inputs/File/FileUpload.d.ts +0 -4
- package/src/components/inputs/File/FileUploadContainer.d.ts +0 -3
- package/src/components/inputs/File/InputUpload.d.ts +0 -4
- package/src/components/inputs/File/fileUpload.types.d.ts +0 -79
- package/src/components/inputs/File/index.d.ts +0 -9
- package/src/components/inputs/File/inputUpload.types.d.ts +0 -30
- package/src/components/inputs/File/shared/FileCard.d.ts +0 -9
- package/src/components/inputs/File/shared/FileCardList.d.ts +0 -9
- package/src/components/inputs/File/shared/FileProgressBar.d.ts +0 -3
- package/src/components/inputs/File/shared/FileUploadContent.d.ts +0 -10
- package/src/components/inputs/File/shared/FileUploadContentEmpty.d.ts +0 -9
- package/src/components/inputs/File/shared/FileUploadContentError.d.ts +0 -11
- package/src/components/inputs/File/shared/FileUploadContentFilled.d.ts +0 -11
- package/src/components/inputs/File/shared/FileUploadContentLoading.d.ts +0 -9
- package/src/components/inputs/File/shared/InputUploadContent.d.ts +0 -8
- package/src/components/inputs/File/shared/InputUploadFilled.d.ts +0 -7
- package/src/components/inputs/File/shared/fileUpload.cva.d.ts +0 -11
- package/src/components/inputs/File/shared/inputUploadButton.cva.d.ts +0 -10
- package/src/components/inputs/FormField/FormField.d.ts +0 -17
- package/src/components/inputs/FormField/FormFieldError.d.ts +0 -7
- package/src/components/inputs/FormField/FormFieldHeader.d.ts +0 -14
- package/src/components/inputs/FormField/FormFieldHeaderClose.d.ts +0 -5
- package/src/components/inputs/FormField/FormFieldLabel.d.ts +0 -11
- package/src/components/inputs/Input/NumberInput/NumberInput.d.ts +0 -18
- package/src/components/inputs/Input/PasswordInput/PasswordInput.d.ts +0 -7
- package/src/components/inputs/Input/TextArea/TextArea.d.ts +0 -17
- package/src/components/inputs/Input/TextInput/TextInput.d.ts +0 -19
- package/src/components/inputs/Input/shared/InputContent.d.ts +0 -27
- package/src/components/inputs/Inputs/Form.d.ts +0 -26
- package/src/components/inputs/Inputs/InputItem.d.ts +0 -73
- package/src/components/inputs/Inputs/Inputs.d.ts +0 -10
- package/src/components/inputs/RadioGroup/RadioGroup.d.ts +0 -18
- package/src/components/inputs/RadioGroup/radio.cva.d.ts +0 -11
- package/src/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +0 -8
- package/src/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +0 -19
- package/src/components/inputs/Selection/Select/Select.d.ts +0 -8
- package/src/components/inputs/Selection/shared/SelectBase.d.ts +0 -24
- package/src/components/inputs/Selection/shared/SelectDesktop.d.ts +0 -5
- package/src/components/inputs/Selection/shared/SelectInput.d.ts +0 -15
- package/src/components/inputs/Selection/shared/SelectListBox.d.ts +0 -9
- package/src/components/inputs/Selection/shared/SelectListBoxItem.d.ts +0 -8
- package/src/components/inputs/Selection/shared/SelectListBoxItemSelectAll.d.ts +0 -4
- package/src/components/inputs/Selection/shared/SelectListBoxLoadingItem.d.ts +0 -6
- package/src/components/inputs/Selection/shared/SelectListBoxSelectionBar.d.ts +0 -5
- package/src/components/inputs/Selection/shared/SelectMobile.d.ts +0 -5
- package/src/components/inputs/Selection/shared/select.context.d.ts +0 -30
- package/src/components/inputs/Selection/shared/select.types.d.ts +0 -55
- package/src/components/inputs/Selection/shared/useSelectItems.d.ts +0 -23
- package/src/components/inputs/Slider/Slider.d.ts +0 -18
- package/src/components/inputs/TextEditor/TextEditor.d.ts +0 -20
- package/src/components/inputs/TextEditor/Toolbar/ColorPicker.d.ts +0 -7
- package/src/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.d.ts +0 -10
- package/src/components/inputs/TextEditor/Toolbar/HyperlinkAction.d.ts +0 -2
- package/src/components/inputs/TextEditor/Toolbar/TextAlignSelect.d.ts +0 -2
- package/src/components/inputs/TextEditor/Toolbar/TextColorSelect.d.ts +0 -2
- package/src/components/inputs/TextEditor/Toolbar/TextEditorToolbar.d.ts +0 -6
- package/src/components/inputs/TextEditor/Toolbar/TextHighlightSelect.d.ts +0 -2
- package/src/components/inputs/TextEditor/Toolbar/TextListActions.d.ts +0 -2
- package/src/components/inputs/TextEditor/Toolbar/TextMarksActions.d.ts +0 -2
- package/src/components/inputs/TextEditor/Toolbar/TextStyleSelect.d.ts +0 -2
- package/src/components/inputs/TextEditor/textEditor.types.d.ts +0 -5
- package/src/components/inputs/Toggle/Toggle.d.ts +0 -14
- package/src/components/inputs/Toggle/toggle.cva.d.ts +0 -10
- package/src/components/inputs/shared/CheckContent.d.ts +0 -7
- package/src/components/inputs/shared/InputClear.d.ts +0 -6
- package/src/components/inputs/shared/form.types.d.ts +0 -12
- package/src/components/inputs/shared/input.cva.d.ts +0 -22
- package/src/components/inputs/shared/label.cva.d.ts +0 -10
- package/src/components/outline.clsx.d.ts +0 -2
- package/src/components/overlays/ActionModal/ActionModal.d.ts +0 -19
- package/src/components/overlays/BottomSheet/BottomSheet.d.ts +0 -21
- package/src/components/overlays/Drawer/Drawer.d.ts +0 -13
- package/src/components/overlays/Modal/Modal.d.ts +0 -11
- package/src/components/overlays/Modal/modal.cva.d.ts +0 -12
- package/src/components/overlays/ResponsivePopover/ResponsivePopover.d.ts +0 -10
- package/src/components/overlays/Tooltip/Tooltip.d.ts +0 -9
- package/src/components/overlays/Tooltip/TooltipEllipsis.d.ts +0 -7
- package/src/components/segment/Segment.d.ts +0 -4
- package/src/components/segment/SegmentItem.d.ts +0 -2
- package/src/components/segment/segment.types.d.ts +0 -34
- package/src/components/shared/pagination/Pagination.d.ts +0 -9
- package/src/components/shared/pagination/PaginationList.d.ts +0 -15
- package/src/components/shared/pagination/minWidth.cva.d.ts +0 -3
- package/src/components/status/Alert/Alert.d.ts +0 -11
- package/src/components/status/Alert/alert.cva.d.ts +0 -7
- package/src/components/status/Loader/Loader.d.ts +0 -5
- package/src/components/status/Loader/loader.cva.d.ts +0 -9
- package/src/components/status/Toast/Toast.d.ts +0 -14
- package/src/components/status/Toast/toast.cva.d.ts +0 -18
- package/src/components/status/Toast/useToast.d.ts +0 -12
- package/src/components/status/shared/status.cva.d.ts +0 -8
- package/src/components/table/CellText.d.ts +0 -7
- package/src/components/table/ColumnConfig.d.ts +0 -10
- package/src/components/table/HeaderText.d.ts +0 -5
- package/src/components/table/InfiniteTable.d.ts +0 -9
- package/src/components/table/PaginatedTable.d.ts +0 -11
- package/src/components/table/Table.d.ts +0 -37
- package/src/components/table/table.cva.d.ts +0 -15
- package/src/components/text/Link/Link.d.ts +0 -7
- package/src/components/text/Link/link.cva.d.ts +0 -6
- package/src/components/text/Tag/Tag.d.ts +0 -10
- package/src/components/text/Tag/tag.cva.d.ts +0 -6
- package/src/components/text/Typography/Typography.d.ts +0 -11
- package/src/components/text/Typography/typography.cva.d.ts +0 -8
- package/src/config/confirmation.context.d.ts +0 -20
- package/src/config/i18n.d.ts +0 -315
- package/src/config/router.context.d.ts +0 -20
- package/src/config/uiConfig.context.d.ts +0 -28
- package/src/config/uiStyle.context.d.ts +0 -84
- package/src/helpers/dynamicColumns.d.ts +0 -44
- package/src/helpers/dynamicInputs.d.ts +0 -83
- package/src/hooks/useAutosave.d.ts +0 -9
- package/src/hooks/useBreakpoint.d.ts +0 -3
- package/src/hooks/useDebounceCallback.d.ts +0 -6
- package/src/hooks/useDeepCompare.d.ts +0 -4
- package/src/hooks/useFilters.d.ts +0 -7
- package/src/hooks/useForm.d.ts +0 -18
- package/src/hooks/useFormAutosave.d.ts +0 -13
- package/src/hooks/useIntersectionObserver.d.ts +0 -7
- package/src/hooks/useLocalStorage.d.ts +0 -13
- package/src/hooks/useLongPressRepeat.d.ts +0 -9
- package/src/hooks/usePagination.d.ts +0 -7
- package/src/hooks/useScrollableListBox.d.ts +0 -3
- package/src/hooks/useSingletonMutation.d.ts +0 -2
- package/src/hooks/useSorting.d.ts +0 -6
- package/src/hooks/useStateAndRef.d.ts +0 -4
- package/src/hooks/useTableColumnConfig.d.ts +0 -16
- package/src/hooks/useTableNav.d.ts +0 -84
- package/src/hooks/useTranslationMemo.d.ts +0 -4
- package/src/index.d.ts +0 -205
- package/src/types/react-query.d.ts +0 -6
- package/src/utils/array.utils.d.ts +0 -3
- package/src/utils/array.utils.spec.d.ts +0 -1
- package/src/utils/compoundMapper.d.ts +0 -19
- package/src/utils/compoundMapper.spec.d.ts +0 -1
- package/src/utils/date-time.utils.d.ts +0 -14
- package/src/utils/date-time.utils.spec.d.ts +0 -1
- package/src/utils/date.utils.d.ts +0 -3
- package/src/utils/date.utils.spec.d.ts +0 -1
- package/src/utils/dom.utils.d.ts +0 -5
- package/src/utils/file.utils.d.ts +0 -9
- package/src/utils/isEqual.d.ts +0 -1
- package/src/utils/logger.d.ts +0 -7
- package/src/utils/object.utils.d.ts +0 -10
- package/src/utils/queries.utils.d.ts +0 -4
- package/src/utils/rest/interceptors/logging.interceptor.d.ts +0 -2
- package/src/utils/rest/interceptors/response.interceptor.d.ts +0 -2
- package/src/utils/rest/interceptors/rest-interceptor.d.ts +0 -8
- package/src/utils/rest/rest-client.d.ts +0 -29
- package/src/utils/rest/rest.utils.d.ts +0 -10
- package/src/utils/routing.utils.d.ts +0 -3
- package/src/utils/string.utils.d.ts +0 -4
- package/src/utils/vendor/error-handling.d.ts +0 -21
- package/src/utils/zod.utils.d.ts +0 -19
- package/vite.config.d.ts +0 -2
- /package/{styles → src/styles}/editor.css +0 -0
- /package/{styles → src/styles}/index.css +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type CalendarDate, createCalendar } from "@internationalized/date";
|
|
2
|
+
import type { DateFieldStateOptions } from "@react-stately/datepicker";
|
|
3
|
+
import { type FocusEvent, type Ref, useEffect, useImperativeHandle, useRef } from "react";
|
|
4
|
+
import { useDateField, useLocale } from "react-aria";
|
|
5
|
+
import { useDateFieldState } from "react-stately";
|
|
6
|
+
|
|
7
|
+
import { DateSegmentItem } from "#ui/components/inputs/DateTime/shared/DateSegmentItem";
|
|
8
|
+
|
|
9
|
+
export interface DateFieldHandle {
|
|
10
|
+
clearField: () => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface DateFieldProps extends Omit<DateFieldStateOptions, "locale" | "createCalendar"> {
|
|
14
|
+
ref?: Ref<DateFieldHandle>;
|
|
15
|
+
onClearChange?: (canClear: boolean) => void;
|
|
16
|
+
hidePlaceholder?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const DateField = ({ ref, onClearChange, hidePlaceholder, ...props }: DateFieldProps) => {
|
|
20
|
+
const { locale } = useLocale();
|
|
21
|
+
const state = useDateFieldState({
|
|
22
|
+
...props,
|
|
23
|
+
locale,
|
|
24
|
+
createCalendar,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const dataFieldRef = useRef<HTMLDivElement>(null);
|
|
28
|
+
const { fieldProps } = useDateField(props, state, dataFieldRef);
|
|
29
|
+
|
|
30
|
+
const handleBlur = (e: FocusEvent<HTMLDivElement>) => {
|
|
31
|
+
fieldProps.onBlur?.(e);
|
|
32
|
+
|
|
33
|
+
if (!state.value) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const currentValue = state.value as CalendarDate;
|
|
38
|
+
const { year } = currentValue;
|
|
39
|
+
|
|
40
|
+
if (year >= 0 && year <= 99) {
|
|
41
|
+
const correctedYear = year <= 50 ? 2000 + year : 1900 + year;
|
|
42
|
+
|
|
43
|
+
const correctedDate = currentValue.set({ year: correctedYear });
|
|
44
|
+
|
|
45
|
+
if (correctedDate) {
|
|
46
|
+
state.setValue(correctedDate);
|
|
47
|
+
props.onChange?.(correctedDate);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
useImperativeHandle(ref, () => ({
|
|
53
|
+
clearField: () => {
|
|
54
|
+
state.setValue(null);
|
|
55
|
+
},
|
|
56
|
+
}));
|
|
57
|
+
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
onClearChange?.(state.segments.some((segment) => segment.type !== "literal" && segment.isPlaceholder === false));
|
|
60
|
+
}, [state.segments, onClearChange]);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div
|
|
64
|
+
{...fieldProps}
|
|
65
|
+
ref={dataFieldRef}
|
|
66
|
+
onBlur={handleBlur}
|
|
67
|
+
className="relative w-full"
|
|
68
|
+
>
|
|
69
|
+
<div className="flex">
|
|
70
|
+
{state.segments.map((segment, i) => (
|
|
71
|
+
<DateSegmentItem
|
|
72
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
73
|
+
key={i}
|
|
74
|
+
segment={segment}
|
|
75
|
+
state={state}
|
|
76
|
+
isDisabled={props.isDisabled}
|
|
77
|
+
hidePlaceholder={hidePlaceholder}
|
|
78
|
+
/>
|
|
79
|
+
))}
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { getLocalTimeZone, now, today } from "@internationalized/date";
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { type Ref, useCallback, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { type DatePickerAria, useFocusVisible, useFocusWithin, useHover } from "react-aria";
|
|
5
|
+
import useMeasure from "react-use-measure";
|
|
6
|
+
|
|
7
|
+
import { CalendarIcon } from "#ui/assets/icons/Calendar";
|
|
8
|
+
import { DateTimeIcon } from "#ui/assets/icons/DateTime";
|
|
9
|
+
import { TodayIcon } from "#ui/assets/icons/Today";
|
|
10
|
+
import { IconButton } from "#ui/components/buttons/IconButton/IconButton";
|
|
11
|
+
import { InlineIconButton } from "#ui/components/buttons/InlineIconButton/InlineIconButton";
|
|
12
|
+
import { DateField, type DateFieldHandle } from "#ui/components/inputs/DateTime/shared/DateField";
|
|
13
|
+
import type { FormFieldHeaderProps } from "#ui/components/inputs/FormField/FormFieldHeader";
|
|
14
|
+
import { FormFieldLabel } from "#ui/components/inputs/FormField/FormFieldLabel";
|
|
15
|
+
import { InputClear } from "#ui/components/inputs/shared/InputClear";
|
|
16
|
+
import { type InputVariantProps, useInputCva } from "#ui/components/inputs/shared/input.cva";
|
|
17
|
+
|
|
18
|
+
interface DatePickerInputProps extends InputVariantProps {
|
|
19
|
+
ref?: Ref<HTMLDivElement>;
|
|
20
|
+
groupProps: DatePickerAria["groupProps"];
|
|
21
|
+
fieldProps: DatePickerAria["fieldProps"];
|
|
22
|
+
endFieldProps?: DatePickerAria["fieldProps"];
|
|
23
|
+
buttonProps: DatePickerAria["buttonProps"];
|
|
24
|
+
isDisabled?: boolean;
|
|
25
|
+
isInvalid?: boolean;
|
|
26
|
+
disableDropdown?: boolean;
|
|
27
|
+
isDateTime?: boolean;
|
|
28
|
+
isClearable?: boolean;
|
|
29
|
+
headerProps?: FormFieldHeaderProps;
|
|
30
|
+
todayIcon?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const DatePickerInput = ({
|
|
34
|
+
ref,
|
|
35
|
+
as,
|
|
36
|
+
groupProps,
|
|
37
|
+
fieldProps,
|
|
38
|
+
endFieldProps,
|
|
39
|
+
buttonProps,
|
|
40
|
+
isDisabled,
|
|
41
|
+
isInvalid,
|
|
42
|
+
disableDropdown,
|
|
43
|
+
variant,
|
|
44
|
+
size,
|
|
45
|
+
isDateTime,
|
|
46
|
+
isClearable,
|
|
47
|
+
headerProps,
|
|
48
|
+
todayIcon,
|
|
49
|
+
...props
|
|
50
|
+
}: DatePickerInputProps) => {
|
|
51
|
+
const inputCva = useInputCva();
|
|
52
|
+
const [canClear, setCanClear] = useState(false);
|
|
53
|
+
const { hoverProps, isHovered } = useHover({ isDisabled });
|
|
54
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
55
|
+
const { focusWithinProps } = useFocusWithin({ onFocusWithinChange: setIsFocused });
|
|
56
|
+
const { isFocusVisible } = useFocusVisible();
|
|
57
|
+
const dateFieldRef = useRef<DateFieldHandle>(null);
|
|
58
|
+
const endDateFieldRef = useRef<DateFieldHandle>(null);
|
|
59
|
+
const [labelContentRef, { width: labelWidth }] = useMeasure();
|
|
60
|
+
|
|
61
|
+
const onClearChange = useCallback((canClearInput: boolean) => {
|
|
62
|
+
setCanClear(canClearInput);
|
|
63
|
+
}, []);
|
|
64
|
+
|
|
65
|
+
const onClear = () => {
|
|
66
|
+
dateFieldRef.current?.clearField();
|
|
67
|
+
fieldProps.onChange?.(null);
|
|
68
|
+
const timeout = setTimeout(() => {
|
|
69
|
+
endDateFieldRef.current?.clearField();
|
|
70
|
+
clearTimeout(timeout);
|
|
71
|
+
}, 0);
|
|
72
|
+
setCanClear(false);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const onToday = () => {
|
|
76
|
+
if (isDateTime) {
|
|
77
|
+
fieldProps.onChange?.(now(getLocalTimeZone()));
|
|
78
|
+
} else {
|
|
79
|
+
fieldProps.onChange?.(today(getLocalTimeZone()));
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const hidePlaceholder = as === "floating" && !fieldProps.value && !isFocused;
|
|
84
|
+
|
|
85
|
+
const style = useMemo(() => {
|
|
86
|
+
const leftPadding = as === "filter" ? `var(--spacing-input-side-default) + ${labelWidth}` : "0";
|
|
87
|
+
return {
|
|
88
|
+
paddingLeft: `calc(${leftPadding}px)`,
|
|
89
|
+
};
|
|
90
|
+
}, [labelWidth, as]);
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<div
|
|
94
|
+
ref={ref}
|
|
95
|
+
className={inputCva({
|
|
96
|
+
variant,
|
|
97
|
+
as,
|
|
98
|
+
size,
|
|
99
|
+
...props,
|
|
100
|
+
className: clsx("group/date-picker-content relative flex items-center justify-between gap-2"),
|
|
101
|
+
})}
|
|
102
|
+
data-rac=""
|
|
103
|
+
data-hovered={isHovered || undefined}
|
|
104
|
+
data-disabled={isDisabled || undefined}
|
|
105
|
+
data-invalid={isInvalid || undefined}
|
|
106
|
+
data-focus-within={isFocused || undefined}
|
|
107
|
+
data-focus-visible={(isFocused && isFocusVisible) || undefined}
|
|
108
|
+
data-has-selection={fieldProps.value !== null || undefined}
|
|
109
|
+
{...groupProps}
|
|
110
|
+
{...focusWithinProps}
|
|
111
|
+
{...hoverProps}
|
|
112
|
+
>
|
|
113
|
+
<div>
|
|
114
|
+
{as && ["filter", "floating"].includes(as) && headerProps && (
|
|
115
|
+
<FormFieldLabel
|
|
116
|
+
ref={labelContentRef}
|
|
117
|
+
as={as}
|
|
118
|
+
{...headerProps}
|
|
119
|
+
/>
|
|
120
|
+
)}
|
|
121
|
+
<div
|
|
122
|
+
className="flex items-center gap-2"
|
|
123
|
+
style={style}
|
|
124
|
+
>
|
|
125
|
+
{todayIcon && (
|
|
126
|
+
<IconButton
|
|
127
|
+
label=""
|
|
128
|
+
icon={TodayIcon}
|
|
129
|
+
size="xxs"
|
|
130
|
+
onPress={onToday}
|
|
131
|
+
/>
|
|
132
|
+
)}
|
|
133
|
+
<DateField
|
|
134
|
+
ref={dateFieldRef}
|
|
135
|
+
{...fieldProps}
|
|
136
|
+
isDisabled={isDisabled}
|
|
137
|
+
isInvalid={isInvalid}
|
|
138
|
+
onClearChange={onClearChange}
|
|
139
|
+
hidePlaceholder={hidePlaceholder}
|
|
140
|
+
/>
|
|
141
|
+
{endFieldProps && (
|
|
142
|
+
<>
|
|
143
|
+
{!((as === "floating" || as === "filter") && hidePlaceholder) && <span className="select-none">–</span>}
|
|
144
|
+
<DateField
|
|
145
|
+
ref={endDateFieldRef}
|
|
146
|
+
{...endFieldProps}
|
|
147
|
+
isDisabled={isDisabled}
|
|
148
|
+
isInvalid={isInvalid}
|
|
149
|
+
onClearChange={onClearChange}
|
|
150
|
+
hidePlaceholder={hidePlaceholder}
|
|
151
|
+
/>
|
|
152
|
+
</>
|
|
153
|
+
)}
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
<div className={clsx("flex items-center gap-2", as === "floating" && "-mt-4")}>
|
|
157
|
+
{isClearable && canClear && <InputClear onClear={onClear} />}
|
|
158
|
+
{!disableDropdown && (
|
|
159
|
+
<InlineIconButton
|
|
160
|
+
label=""
|
|
161
|
+
color="secondary"
|
|
162
|
+
{...buttonProps}
|
|
163
|
+
icon={isDateTime ? DateTimeIcon : CalendarIcon}
|
|
164
|
+
isDisabled={isDisabled}
|
|
165
|
+
/>
|
|
166
|
+
)}
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
);
|
|
170
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { DateFieldState, DateSegment } from "@react-stately/datepicker";
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { useRef } from "react";
|
|
4
|
+
import { useDateSegment } from "react-aria";
|
|
5
|
+
|
|
6
|
+
interface DateSegmentProps {
|
|
7
|
+
state: DateFieldState;
|
|
8
|
+
segment: DateSegment;
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
timePickerOnly?: boolean;
|
|
11
|
+
hidePlaceholder?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const getPlaceholder = (segment: DateSegment): string | null => {
|
|
15
|
+
if (!segment.isPlaceholder) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
switch (segment.type) {
|
|
20
|
+
case "hour":
|
|
21
|
+
return "hh";
|
|
22
|
+
case "minute":
|
|
23
|
+
return "mm";
|
|
24
|
+
case "second":
|
|
25
|
+
return "ss";
|
|
26
|
+
default:
|
|
27
|
+
return segment.placeholder;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const DateSegmentItem = ({ segment, state, isDisabled, timePickerOnly, hidePlaceholder }: DateSegmentProps) => {
|
|
32
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
33
|
+
const { segmentProps } = useDateSegment(segment, state, ref);
|
|
34
|
+
|
|
35
|
+
const isInputEmpty = !state.value;
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
{...segmentProps}
|
|
40
|
+
ref={ref}
|
|
41
|
+
className={clsx(
|
|
42
|
+
"box-content rounded-input-rounding-default",
|
|
43
|
+
isDisabled && "text-interactive-text-secondary-disabled",
|
|
44
|
+
!isDisabled && isInputEmpty && "text-text-default-3 group-focus-within:text-text-default-1",
|
|
45
|
+
!isDisabled && !isInputEmpty && "text-text-default-1",
|
|
46
|
+
"focus-within:outline-1 focus-within:outline-interactive-contained-primary-idle focus-within:outline-offset-1",
|
|
47
|
+
["hour", "dayPeriod"].includes(segment.type) && !timePickerOnly && "ml-1",
|
|
48
|
+
)}
|
|
49
|
+
>
|
|
50
|
+
{!hidePlaceholder && (
|
|
51
|
+
<>
|
|
52
|
+
{segment.isPlaceholder && (
|
|
53
|
+
<span
|
|
54
|
+
aria-hidden="true"
|
|
55
|
+
className="pointer-events-none"
|
|
56
|
+
>
|
|
57
|
+
{getPlaceholder(segment)}
|
|
58
|
+
</span>
|
|
59
|
+
)}
|
|
60
|
+
{segment.isPlaceholder ? "" : segment.text}
|
|
61
|
+
</>
|
|
62
|
+
)}
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { ReactNode, RefObject } from "react";
|
|
2
|
+
import type { AriaDialogProps } from "react-aria";
|
|
3
|
+
import { Dialog as AriaDialog, Popover as AriaPopover } from "react-aria-components";
|
|
4
|
+
|
|
5
|
+
import { FormFieldHeader } from "#ui/components/inputs/FormField/FormFieldHeader";
|
|
6
|
+
import { FormFieldHeaderClose } from "#ui/components/inputs/FormField/FormFieldHeaderClose";
|
|
7
|
+
import { BottomSheet } from "#ui/components/overlays/BottomSheet/BottomSheet";
|
|
8
|
+
import { useBreakpoint } from "#ui/hooks/useBreakpoint";
|
|
9
|
+
|
|
10
|
+
interface DateTimeDialogProps {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
footer: ReactNode;
|
|
13
|
+
sidebar?: ReactNode;
|
|
14
|
+
hideSidebar?: boolean;
|
|
15
|
+
label: string;
|
|
16
|
+
isOpen: boolean;
|
|
17
|
+
triggerRef?: RefObject<HTMLElement | null>;
|
|
18
|
+
dialogProps?: AriaDialogProps;
|
|
19
|
+
onOpenChange: (open: boolean) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const DateTimeDialog = ({
|
|
23
|
+
hideSidebar,
|
|
24
|
+
children,
|
|
25
|
+
footer,
|
|
26
|
+
sidebar,
|
|
27
|
+
label,
|
|
28
|
+
isOpen,
|
|
29
|
+
triggerRef,
|
|
30
|
+
dialogProps,
|
|
31
|
+
onOpenChange,
|
|
32
|
+
}: DateTimeDialogProps) => {
|
|
33
|
+
const isDesktop = useBreakpoint("md");
|
|
34
|
+
|
|
35
|
+
if (isDesktop) {
|
|
36
|
+
if (!isOpen) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return (
|
|
40
|
+
<AriaPopover
|
|
41
|
+
triggerRef={triggerRef}
|
|
42
|
+
isOpen={isOpen}
|
|
43
|
+
placement="bottom start"
|
|
44
|
+
onOpenChange={onOpenChange}
|
|
45
|
+
>
|
|
46
|
+
<AriaDialog
|
|
47
|
+
{...dialogProps}
|
|
48
|
+
className="!outline-none"
|
|
49
|
+
aria-label={label}
|
|
50
|
+
>
|
|
51
|
+
<div className="flex overflow-hidden rounded-input-rounding-default border border-elevation-outline-default-1 border-solid bg-elevation-fill-default-1 shadow-5">
|
|
52
|
+
{!hideSidebar && sidebar}
|
|
53
|
+
<div className="flex flex-1 flex-col justify-between">
|
|
54
|
+
{children}
|
|
55
|
+
{footer}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</AriaDialog>
|
|
59
|
+
</AriaPopover>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<BottomSheet
|
|
65
|
+
label={label}
|
|
66
|
+
footer={footer}
|
|
67
|
+
isOpen={isOpen}
|
|
68
|
+
onOpenChange={onOpenChange}
|
|
69
|
+
sheetMarginBottom={0}
|
|
70
|
+
isScrollable={false}
|
|
71
|
+
height="auto"
|
|
72
|
+
isDismissable
|
|
73
|
+
>
|
|
74
|
+
{(close) => (
|
|
75
|
+
<>
|
|
76
|
+
<FormFieldHeader
|
|
77
|
+
label={label}
|
|
78
|
+
className="!mb-8 shrink-0 px-4 pt-3"
|
|
79
|
+
rightContent={<FormFieldHeaderClose onClose={close} />}
|
|
80
|
+
/>
|
|
81
|
+
{children}
|
|
82
|
+
{!hideSidebar && sidebar}
|
|
83
|
+
</>
|
|
84
|
+
)}
|
|
85
|
+
</BottomSheet>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
import { TextButton } from "#ui/components/buttons/TextButton/TextButton";
|
|
5
|
+
import { ns } from "#ui/config/i18n";
|
|
6
|
+
|
|
7
|
+
interface DatePickerFooterProps {
|
|
8
|
+
isValid?: boolean;
|
|
9
|
+
onTodayPress?: () => void;
|
|
10
|
+
onApply: () => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const DateTimeDialogFooter = ({ isValid = true, onTodayPress, onApply }: DatePickerFooterProps) => {
|
|
14
|
+
const { t } = useTranslation(ns);
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<footer
|
|
18
|
+
className={clsx(
|
|
19
|
+
"flex shrink-0 items-center gap-2 bg-elevation-fill-default-2 px-4 py-3 md:border-elevation-outline-default-1 md:border-t md:bg-elevation-fill-default-1 md:py-1-5",
|
|
20
|
+
onTodayPress ? "justify-between" : "justify-end",
|
|
21
|
+
)}
|
|
22
|
+
>
|
|
23
|
+
{onTodayPress && (
|
|
24
|
+
<TextButton
|
|
25
|
+
type="button"
|
|
26
|
+
color="primary"
|
|
27
|
+
onPress={onTodayPress}
|
|
28
|
+
>
|
|
29
|
+
{t(($) => $.ui.datePicker.today)}
|
|
30
|
+
</TextButton>
|
|
31
|
+
)}
|
|
32
|
+
<TextButton
|
|
33
|
+
type="button"
|
|
34
|
+
color="secondary"
|
|
35
|
+
onPress={onApply}
|
|
36
|
+
isDisabled={!isValid}
|
|
37
|
+
>
|
|
38
|
+
{t(($) => $.ui.datePicker.save)}
|
|
39
|
+
</TextButton>
|
|
40
|
+
</footer>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { useDateFormatter } from "@react-aria/i18n";
|
|
2
|
+
import type { CalendarState, RangeCalendarState } from "@react-stately/calendar";
|
|
3
|
+
import { clsx } from "clsx";
|
|
4
|
+
import { type Key, ListBox, ListBoxItem } from "react-aria-components";
|
|
5
|
+
|
|
6
|
+
import { Typography } from "#ui/components/text/Typography/Typography";
|
|
7
|
+
|
|
8
|
+
export interface MonthPickerProps {
|
|
9
|
+
state: CalendarState | RangeCalendarState;
|
|
10
|
+
onSelectionChange: (key: Set<Key>) => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const MonthPicker = ({ state, onSelectionChange }: MonthPickerProps) => {
|
|
14
|
+
const formatter = useDateFormatter({
|
|
15
|
+
month: "long",
|
|
16
|
+
timeZone: state.timeZone,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const numMonths = state.focusedDate.calendar.getMonthsInYear(state.focusedDate);
|
|
20
|
+
|
|
21
|
+
const getMonths = () => {
|
|
22
|
+
const months: string[] = [];
|
|
23
|
+
for (let i = 1; i <= numMonths; i++) {
|
|
24
|
+
const date = state.focusedDate.set({ month: i });
|
|
25
|
+
months.push(formatter.format(date.toDate(state.timeZone)));
|
|
26
|
+
}
|
|
27
|
+
return months;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const isMonthDisabled = (month: number) => {
|
|
31
|
+
if (state.minValue && state.focusedDate.set({ month }) < state.minValue) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
if (state.maxValue && state.focusedDate.set({ month }) > state.maxValue) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<ListBox
|
|
42
|
+
autoFocus
|
|
43
|
+
aria-label="Month"
|
|
44
|
+
selectionMode="single"
|
|
45
|
+
layout="grid"
|
|
46
|
+
selectedKeys={[state.focusedDate.month]}
|
|
47
|
+
onSelectionChange={(key) => {
|
|
48
|
+
if (key === "all") {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const index = [...key][0];
|
|
53
|
+
|
|
54
|
+
if (typeof index === "number") {
|
|
55
|
+
const date = state.focusedDate.set({ month: [...key][0] as number });
|
|
56
|
+
state.setFocusedDate(date);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
onSelectionChange(key);
|
|
60
|
+
}}
|
|
61
|
+
className="grid size-full min-h-72 grid-cols-3 grid-rows-4 gap-2 p-3 md:w-80"
|
|
62
|
+
>
|
|
63
|
+
{getMonths().map((month, index) => {
|
|
64
|
+
const isDisabled = isMonthDisabled(index + 1);
|
|
65
|
+
return (
|
|
66
|
+
<ListBoxItem
|
|
67
|
+
key={month}
|
|
68
|
+
id={index + 1}
|
|
69
|
+
textValue={month}
|
|
70
|
+
isDisabled={isDisabled}
|
|
71
|
+
className={clsx(
|
|
72
|
+
"flex items-center justify-center text-interactive-text-secondary-idle",
|
|
73
|
+
"rounded-button-rounding-m border border-elevation-outline-default-1 border-solid bg-elevation-fill-default-1",
|
|
74
|
+
"hover:text-interactive-text-secondary-hover",
|
|
75
|
+
"selected:border-interactive-contained-primary-idle selected:bg-interactive-contained-primary-idle selected:text-interactive-text-secondary-idle-inverted",
|
|
76
|
+
"focus:outline-none focus-visible:outline-1 focus-visible:outline-interactive-contained-primary-focus focus-visible:outline-offset-1",
|
|
77
|
+
isDisabled ? "cursor-default opacity-50" : "cursor-pointer",
|
|
78
|
+
)}
|
|
79
|
+
>
|
|
80
|
+
<Typography
|
|
81
|
+
as="span"
|
|
82
|
+
size="label-2"
|
|
83
|
+
>
|
|
84
|
+
{month}
|
|
85
|
+
</Typography>
|
|
86
|
+
</ListBoxItem>
|
|
87
|
+
);
|
|
88
|
+
})}
|
|
89
|
+
</ListBox>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import type { CalendarDate } from "@internationalized/date";
|
|
2
|
+
import { useRangeCalendar } from "@react-aria/calendar";
|
|
3
|
+
import type { RangeCalendarState, RangeCalendarStateOptions } from "@react-stately/calendar";
|
|
4
|
+
import { clsx } from "clsx";
|
|
5
|
+
import { type KeyboardEvent, useMemo, useRef } from "react";
|
|
6
|
+
import type { DateValue } from "react-aria";
|
|
7
|
+
|
|
8
|
+
import { CalendarGrid } from "#ui/components/inputs/DateTime/shared/CalendarGrid";
|
|
9
|
+
import { CalendarSelectHeader } from "#ui/components/inputs/DateTime/shared/CalendarSelectHeader";
|
|
10
|
+
|
|
11
|
+
interface DateRange {
|
|
12
|
+
start: DateValue;
|
|
13
|
+
end: DateValue;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface CalendarProps {
|
|
17
|
+
className?: string;
|
|
18
|
+
leftCalendarState: RangeCalendarState;
|
|
19
|
+
rightCalendarState: RangeCalendarState;
|
|
20
|
+
calendarProps: Omit<RangeCalendarStateOptions, "locale" | "createCalendar">;
|
|
21
|
+
onApply: () => void;
|
|
22
|
+
onRangeChange?: (value: DateRange | null) => void;
|
|
23
|
+
onDateSelection?: (date: DateValue, calendarSide?: "left" | "right") => void;
|
|
24
|
+
onDateHover?: (date: DateValue | null) => void;
|
|
25
|
+
rangeSelection?: {
|
|
26
|
+
start: DateValue | null;
|
|
27
|
+
end: DateValue | null;
|
|
28
|
+
isSelecting: boolean;
|
|
29
|
+
};
|
|
30
|
+
hoverDate?: DateValue | null;
|
|
31
|
+
onKeyboardNavigation?: (event: KeyboardEvent, date: DateValue, calendarSide: "left" | "right") => boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const RangeCalendar = ({
|
|
35
|
+
className,
|
|
36
|
+
leftCalendarState,
|
|
37
|
+
rightCalendarState,
|
|
38
|
+
calendarProps,
|
|
39
|
+
onApply,
|
|
40
|
+
onRangeChange: _onRangeChange,
|
|
41
|
+
onDateSelection,
|
|
42
|
+
onDateHover,
|
|
43
|
+
rangeSelection,
|
|
44
|
+
hoverDate,
|
|
45
|
+
onKeyboardNavigation,
|
|
46
|
+
}: CalendarProps) => {
|
|
47
|
+
const leftRef = useRef<HTMLDivElement | null>(null);
|
|
48
|
+
const rightRef = useRef<HTMLDivElement | null>(null);
|
|
49
|
+
|
|
50
|
+
const { calendarProps: leftCalendarAriaProps } = useRangeCalendar(calendarProps, leftCalendarState, leftRef);
|
|
51
|
+
const { calendarProps: rightCalendarAriaProps } = useRangeCalendar(calendarProps, rightCalendarState, rightRef);
|
|
52
|
+
|
|
53
|
+
const leftDate = leftCalendarState.visibleRange.start;
|
|
54
|
+
const rightDate = rightCalendarState.visibleRange.start;
|
|
55
|
+
|
|
56
|
+
const handleLeftKeyboardNavigation = (event: KeyboardEvent, date: DateValue) => {
|
|
57
|
+
return onKeyboardNavigation?.(event, date, "left") ?? false;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const handleRightKeyboardNavigation = (event: KeyboardEvent, date: DateValue) => {
|
|
61
|
+
return onKeyboardNavigation?.(event, date, "right") ?? false;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const handleLeftNavigate = (newDate: CalendarDate) => {
|
|
65
|
+
const rightCurrentDate = rightCalendarState.visibleRange.start;
|
|
66
|
+
if (
|
|
67
|
+
newDate.year < rightCurrentDate.year ||
|
|
68
|
+
(newDate.year === rightCurrentDate.year && newDate.month < rightCurrentDate.month)
|
|
69
|
+
) {
|
|
70
|
+
leftCalendarState.setFocusedDate(newDate);
|
|
71
|
+
} else {
|
|
72
|
+
const closestValidDate = rightCurrentDate.subtract({ months: 1 });
|
|
73
|
+
leftCalendarState.setFocusedDate(closestValidDate);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const handleRightNavigate = (newDate: CalendarDate) => {
|
|
78
|
+
const leftCurrentDate = leftCalendarState.visibleRange.start;
|
|
79
|
+
if (
|
|
80
|
+
newDate.year > leftCurrentDate.year ||
|
|
81
|
+
(newDate.year === leftCurrentDate.year && newDate.month > leftCurrentDate.month)
|
|
82
|
+
) {
|
|
83
|
+
rightCalendarState.setFocusedDate(newDate);
|
|
84
|
+
} else {
|
|
85
|
+
const closestValidDate = leftCurrentDate.add({ months: 1 });
|
|
86
|
+
rightCalendarState.setFocusedDate(closestValidDate);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const isNextDisabled = useMemo(() => {
|
|
91
|
+
return (
|
|
92
|
+
leftDate.year > rightDate.year ||
|
|
93
|
+
(leftDate.year === rightDate.year && leftDate.add({ months: 1 }).month === rightDate.month)
|
|
94
|
+
);
|
|
95
|
+
}, [leftDate, rightDate]);
|
|
96
|
+
|
|
97
|
+
const isPrevDisabled = useMemo(() => {
|
|
98
|
+
return (
|
|
99
|
+
rightDate.year < leftDate.year ||
|
|
100
|
+
(rightDate.year === leftDate.year && rightDate.subtract({ months: 1 }).month === leftDate.month)
|
|
101
|
+
);
|
|
102
|
+
}, [leftDate, rightDate]);
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<div className={clsx("flex w-fit flex-col items-center bg-elevation-fill-default-1", className)}>
|
|
106
|
+
<div className="flex">
|
|
107
|
+
<div
|
|
108
|
+
{...leftCalendarAriaProps}
|
|
109
|
+
ref={leftRef}
|
|
110
|
+
className="flex flex-col items-center"
|
|
111
|
+
>
|
|
112
|
+
<CalendarSelectHeader
|
|
113
|
+
state={leftCalendarState}
|
|
114
|
+
isNextMonthDisabled={isNextDisabled}
|
|
115
|
+
isNextYearDisabled={isNextDisabled}
|
|
116
|
+
onNavigate={handleLeftNavigate}
|
|
117
|
+
maxDate={rightDate}
|
|
118
|
+
/>
|
|
119
|
+
<CalendarGrid
|
|
120
|
+
state={leftCalendarState}
|
|
121
|
+
onApply={onApply}
|
|
122
|
+
shouldCloseOnSelect={false}
|
|
123
|
+
onDateSelection={onDateSelection}
|
|
124
|
+
rangeSelection={rangeSelection}
|
|
125
|
+
onDateHover={onDateHover}
|
|
126
|
+
hoverDate={hoverDate}
|
|
127
|
+
onKeyboardNavigation={handleLeftKeyboardNavigation}
|
|
128
|
+
className="!w-[304px] h-64"
|
|
129
|
+
calendarSide="left"
|
|
130
|
+
/>
|
|
131
|
+
</div>
|
|
132
|
+
<div
|
|
133
|
+
{...rightCalendarAriaProps}
|
|
134
|
+
ref={rightRef}
|
|
135
|
+
className="hidden flex-col items-center md:flex"
|
|
136
|
+
>
|
|
137
|
+
<CalendarSelectHeader
|
|
138
|
+
state={rightCalendarState}
|
|
139
|
+
isPrevMonthDisabled={isPrevDisabled}
|
|
140
|
+
isPrevYearDisabled={isPrevDisabled}
|
|
141
|
+
onNavigate={handleRightNavigate}
|
|
142
|
+
minDate={leftDate}
|
|
143
|
+
/>
|
|
144
|
+
<CalendarGrid
|
|
145
|
+
state={rightCalendarState}
|
|
146
|
+
onApply={onApply}
|
|
147
|
+
shouldCloseOnSelect={false}
|
|
148
|
+
onDateSelection={onDateSelection}
|
|
149
|
+
rangeSelection={rangeSelection}
|
|
150
|
+
onDateHover={onDateHover}
|
|
151
|
+
hoverDate={hoverDate}
|
|
152
|
+
onKeyboardNavigation={handleRightKeyboardNavigation}
|
|
153
|
+
className="!w-[304px] h-64"
|
|
154
|
+
calendarSide="right"
|
|
155
|
+
/>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
};
|