@povio/ui 0.0.8 → 0.0.9
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/dist/assets/icons/AlignCenter.js +21 -0
- package/dist/assets/icons/AlignLeft.js +21 -0
- package/dist/assets/icons/AlignLeftRight.js +21 -0
- package/dist/assets/icons/AlignRight.js +21 -0
- package/dist/assets/icons/ArrowDropDown.js +21 -0
- package/dist/assets/icons/ArrowDropUp.js +21 -0
- package/dist/assets/icons/ArrowLeft.js +21 -0
- package/dist/assets/icons/ArrowRight.js +21 -0
- package/dist/assets/icons/Bold.js +21 -0
- package/dist/assets/icons/BulletedList.js +21 -0
- package/dist/assets/icons/Calendar.js +23 -0
- package/dist/assets/icons/Check.js +23 -0
- package/dist/assets/icons/CheckCircle.js +21 -0
- package/dist/assets/icons/CheckboxCheckmark.js +24 -0
- package/dist/assets/icons/CheckboxIndeterminate.js +24 -0
- package/dist/assets/icons/ChevronDown.js +23 -0
- package/dist/assets/icons/ChevronLeft.js +23 -0
- package/dist/assets/icons/ChevronRight.js +23 -0
- package/dist/assets/icons/ChevronUp.js +23 -0
- package/dist/assets/icons/ChevronsLeft.js +23 -0
- package/dist/assets/icons/ChevronsRight.js +23 -0
- package/dist/assets/icons/Clock.js +21 -0
- package/dist/assets/icons/Close.js +21 -0
- package/dist/assets/icons/DateTime.js +32 -0
- package/dist/assets/icons/Drag.js +21 -0
- package/dist/assets/icons/File.js +23 -0
- package/dist/assets/icons/Highlight.js +21 -0
- package/dist/assets/icons/HighlightOn.js +30 -0
- package/dist/assets/icons/Info.js +32 -0
- package/dist/assets/icons/Italic.js +21 -0
- package/dist/assets/icons/Link.js +21 -0
- package/dist/assets/icons/Menu.js +21 -0
- package/dist/assets/icons/NumberedList.js +21 -0
- package/dist/assets/icons/PointerHorizontal.js +21 -0
- package/dist/assets/icons/PointerVertical.js +21 -0
- package/dist/assets/icons/Send.js +23 -0
- package/dist/assets/icons/Strikethrough.js +21 -0
- package/dist/assets/icons/TextColor.js +30 -0
- package/dist/assets/icons/Today.js +21 -0
- package/dist/assets/icons/Underlined.js +23 -0
- package/dist/assets/icons/Upload.js +30 -0
- package/dist/assets/icons/View.js +18 -0
- package/dist/assets/icons/ViewOff.js +18 -0
- package/dist/assets/icons/WarningFilled.js +23 -0
- package/dist/assets/locales/en/translation.json.js +14 -0
- package/dist/assets/locales/sl/translation.json.js +14 -0
- package/dist/components/Menu/Menu.js +14 -0
- package/{src → dist}/components/Menu/MenuDesktop.d.ts +1 -1
- package/dist/components/Menu/MenuDesktop.js +68 -0
- package/{src → dist}/components/Menu/MenuItem.d.ts +1 -1
- package/dist/components/Menu/MenuItem.js +33 -0
- package/{src → dist}/components/Menu/MenuMobile.d.ts +1 -1
- package/dist/components/Menu/MenuMobile.js +78 -0
- package/{src → dist}/components/Menu/MenuPopover.d.ts +1 -1
- package/dist/components/Menu/MenuPopover.js +38 -0
- package/{src → dist}/components/buttons/Button/Button.d.ts +1 -1
- package/dist/components/buttons/Button/Button.js +68 -0
- package/{src → dist}/components/buttons/Button/button.cva.d.ts +1 -1
- package/dist/components/buttons/Button/button.cva.js +672 -0
- package/{src → dist}/components/buttons/IconButton/IconButton.d.ts +1 -1
- package/dist/components/buttons/IconButton/IconButton.js +17 -0
- package/{src → dist}/components/buttons/InlineIconButton/InlineIconButton.d.ts +1 -1
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +18 -0
- package/{src → dist}/components/buttons/PillButton/PillButton.d.ts +2 -2
- package/dist/components/buttons/PillButton/PillButton.js +44 -0
- package/{src → dist}/components/buttons/PillButton/pillButton.cva.d.ts +1 -1
- package/dist/components/buttons/PillButton/pillButton.cva.js +86 -0
- package/{src → dist}/components/buttons/SplitButton/SplitButton.d.ts +2 -2
- package/dist/components/buttons/SplitButton/SplitButton.js +62 -0
- package/{src → dist}/components/buttons/TextButton/TextButton.d.ts +3 -3
- package/dist/components/buttons/TextButton/TextButton.js +18 -0
- package/{src → dist}/components/buttons/ToggleButton/ToggleButton.d.ts +3 -3
- package/dist/components/buttons/ToggleButton/ToggleButton.js +21 -0
- package/{src → dist}/components/buttons/shared/ButtonContent.d.ts +3 -3
- package/dist/components/buttons/shared/ButtonContent.js +53 -0
- package/dist/components/buttons/shared/buttonContent.cva.js +16 -0
- package/{src → dist}/components/inputs/Checkbox/Checkbox.d.ts +3 -3
- package/dist/components/inputs/Checkbox/Checkbox.js +81 -0
- package/{src → dist}/components/inputs/Checkbox/CheckboxCheckmark.d.ts +1 -1
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +49 -0
- package/{src → dist}/components/inputs/Checkbox/checkbox.cva.d.ts +1 -1
- package/dist/components/inputs/Checkbox/checkbox.cva.js +47 -0
- package/{src → dist}/components/inputs/DateTime/DatePicker/DatePicker.d.ts +3 -3
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +237 -0
- package/{src → dist}/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +3 -3
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +674 -0
- package/{src → dist}/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +3 -3
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +251 -0
- package/{src → dist}/components/inputs/DateTime/TimePicker/TimePicker.d.ts +3 -3
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +224 -0
- package/dist/components/inputs/DateTime/shared/Calendar.js +85 -0
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +160 -0
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +67 -0
- package/{src → dist}/components/inputs/DateTime/shared/CalendarHeader.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +89 -0
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +203 -0
- package/dist/components/inputs/DateTime/shared/DateField.js +62 -0
- package/{src → dist}/components/inputs/DateTime/shared/DatePickerInput.d.ts +2 -2
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +174 -0
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +55 -0
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +76 -0
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +41 -0
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +82 -0
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +131 -0
- package/dist/components/inputs/DateTime/shared/TimeField.js +26 -0
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +186 -0
- package/{src → dist}/components/inputs/DateTime/shared/TimePickerInput.d.ts +2 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +114 -0
- package/dist/components/inputs/DateTime/shared/YearPicker.js +89 -0
- package/dist/components/inputs/File/FileUpload.js +254 -0
- package/dist/components/inputs/File/FileUploadContainer.js +17 -0
- package/dist/components/inputs/File/InputUpload.js +176 -0
- package/{src → dist}/components/inputs/File/fileUpload.types.d.ts +3 -3
- package/{src → dist}/components/inputs/File/inputUpload.types.d.ts +2 -2
- package/{src → dist}/components/inputs/File/shared/FileCard.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileCard.js +67 -0
- package/{src → dist}/components/inputs/File/shared/FileCardList.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileCardList.js +20 -0
- package/dist/components/inputs/File/shared/FileProgressBar.js +32 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContent.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContent.js +92 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContentEmpty.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +92 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContentError.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentError.js +167 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContentFilled.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +176 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContentLoading.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +128 -0
- package/{src → dist}/components/inputs/File/shared/InputUploadContent.d.ts +1 -1
- package/dist/components/inputs/File/shared/InputUploadContent.js +74 -0
- package/dist/components/inputs/File/shared/InputUploadFilled.js +45 -0
- package/dist/components/inputs/File/shared/fileUpload.cva.js +58 -0
- package/dist/components/inputs/File/shared/inputUploadButton.cva.js +49 -0
- package/{src → dist}/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormField.js +54 -0
- package/dist/components/inputs/FormField/FormFieldError.js +16 -0
- package/dist/components/inputs/FormField/FormFieldHeader.js +57 -0
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +20 -0
- package/{src → dist}/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldLabel.js +37 -0
- package/{src → dist}/components/inputs/Input/NumberInput/NumberInput.d.ts +4 -4
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +157 -0
- package/{src → dist}/components/inputs/Input/PasswordInput/PasswordInput.d.ts +2 -2
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +26 -0
- package/{src → dist}/components/inputs/Input/TextArea/TextArea.d.ts +3 -3
- package/dist/components/inputs/Input/TextArea/TextArea.js +146 -0
- package/{src → dist}/components/inputs/Input/TextInput/TextInput.d.ts +4 -4
- package/dist/components/inputs/Input/TextInput/TextInput.js +170 -0
- package/{src → dist}/components/inputs/Input/shared/InputContent.d.ts +3 -3
- package/dist/components/inputs/Input/shared/InputContent.js +114 -0
- package/{src → dist}/components/inputs/Inputs/Form.d.ts +2 -2
- package/dist/components/inputs/Inputs/Form.js +68 -0
- package/{src → dist}/components/inputs/Inputs/InputItem.d.ts +16 -16
- package/dist/components/inputs/Inputs/InputItem.js +63 -0
- package/dist/components/inputs/Inputs/Inputs.js +32 -0
- package/{src → dist}/components/inputs/RadioGroup/RadioGroup.d.ts +3 -3
- package/dist/components/inputs/RadioGroup/RadioGroup.js +113 -0
- package/{src → dist}/components/inputs/RadioGroup/radio.cva.d.ts +1 -1
- package/dist/components/inputs/RadioGroup/radio.cva.js +47 -0
- package/{src → dist}/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +3 -3
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +39 -0
- package/{src → dist}/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +3 -3
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +25 -0
- package/{src → dist}/components/inputs/Selection/Select/Select.d.ts +3 -3
- package/dist/components/inputs/Selection/Select/Select.js +32 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectBase.d.ts +3 -3
- package/dist/components/inputs/Selection/shared/SelectBase.js +25 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +211 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectInput.d.ts +4 -4
- package/dist/components/inputs/Selection/shared/SelectInput.js +231 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectInputTags.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +22 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +108 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectListBoxItem.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +78 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectListBoxItemSelectAll.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +45 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectListBoxLoadingItem.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +47 -0
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +42 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +161 -0
- package/{src → dist}/components/inputs/Selection/shared/select.context.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/select.context.js +244 -0
- package/{src → dist}/components/inputs/Selection/shared/select.types.d.ts +1 -1
- package/{src → dist}/components/inputs/Selection/shared/useSelectItems.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/useSelectItems.js +94 -0
- package/{src → dist}/components/inputs/Slider/Slider.d.ts +2 -2
- package/dist/components/inputs/Slider/Slider.js +137 -0
- package/{src → dist}/components/inputs/TextEditor/TextEditor.d.ts +2 -2
- package/dist/components/inputs/TextEditor/TextEditor.js +223 -0
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +34 -0
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +80 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/HyperlinkAction.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +92 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextAlignSelect.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +56 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextColorSelect.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +33 -0
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +31 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextHighlightSelect.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +37 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextListActions.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +51 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextMarksActions.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +73 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextStyleSelect.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +61 -0
- package/dist/components/inputs/TextEditor/textEditor.types.js +40 -0
- package/{src → dist}/components/inputs/Toggle/Toggle.d.ts +3 -3
- package/dist/components/inputs/Toggle/Toggle.js +65 -0
- package/{src → dist}/components/inputs/Toggle/toggle.cva.d.ts +1 -1
- package/dist/components/inputs/Toggle/toggle.cva.js +44 -0
- package/{src → dist}/components/inputs/shared/CheckContent.d.ts +1 -1
- package/dist/components/inputs/shared/CheckContent.js +22 -0
- package/dist/components/inputs/shared/InputClear.js +27 -0
- package/dist/components/inputs/shared/input.cva.js +168 -0
- package/{src → dist}/components/inputs/shared/label.cva.d.ts +1 -1
- package/dist/components/inputs/shared/label.cva.js +133 -0
- package/dist/components/outline.clsx.js +11 -0
- package/{src → dist}/components/overlays/ActionModal/ActionModal.d.ts +2 -2
- package/dist/components/overlays/ActionModal/ActionModal.js +80 -0
- package/dist/components/overlays/BottomSheet/BottomSheet.js +261 -0
- package/dist/components/overlays/Drawer/Drawer.js +84 -0
- package/{src → dist}/components/overlays/Modal/Modal.d.ts +1 -1
- package/dist/components/overlays/Modal/Modal.js +53 -0
- package/dist/components/overlays/Modal/modal.cva.js +53 -0
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +71 -0
- package/{src → dist}/components/overlays/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/overlays/Tooltip/Tooltip.js +70 -0
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +27 -0
- package/dist/components/overlays/Tooltip/tooltip.cva.js +60 -0
- package/dist/components/segment/Segment.js +119 -0
- package/dist/components/segment/SegmentItem.js +43 -0
- package/{src → dist}/components/segment/segment.types.d.ts +1 -1
- package/dist/components/shared/pagination/Pagination.js +75 -0
- package/{src → dist}/components/shared/pagination/PaginationList.d.ts +1 -1
- package/dist/components/shared/pagination/PaginationList.js +145 -0
- package/dist/components/shared/pagination/minWidth.cva.js +15 -0
- package/{src → dist}/components/status/Alert/Alert.d.ts +1 -1
- package/dist/components/status/Alert/Alert.js +41 -0
- package/dist/components/status/Alert/alert.cva.js +64 -0
- package/{src → dist}/components/status/Loader/Loader.d.ts +1 -1
- package/dist/components/status/Loader/Loader.js +37 -0
- package/dist/components/status/Loader/loader.cva.js +27 -0
- package/{src → dist}/components/status/Toast/Toast.d.ts +1 -1
- package/dist/components/status/Toast/Toast.js +64 -0
- package/{src → dist}/components/status/Toast/toast.cva.d.ts +1 -1
- package/dist/components/status/Toast/toast.cva.js +150 -0
- package/dist/components/status/Toast/useToast.js +83 -0
- package/dist/components/status/shared/status.cva.js +62 -0
- package/dist/components/table/CellText.js +18 -0
- package/dist/components/table/ColumnConfig.js +124 -0
- package/dist/components/table/HeaderText.js +15 -0
- package/dist/components/table/InfiniteTable.js +40 -0
- package/dist/components/table/PaginatedTable.js +33 -0
- package/dist/components/table/Table.js +370 -0
- package/dist/components/table/table.cva.js +63 -0
- package/{src → dist}/components/text/Link/Link.d.ts +1 -1
- package/dist/components/text/Link/Link.js +18 -0
- package/dist/components/text/Link/link.cva.js +18 -0
- package/{src → dist}/components/text/Tag/Tag.d.ts +1 -1
- package/dist/components/text/Tag/Tag.js +49 -0
- package/dist/components/text/Tag/tag.cva.js +59 -0
- package/{src → dist}/components/text/Typography/Typography.d.ts +1 -1
- package/dist/components/text/Typography/Typography.js +22 -0
- package/dist/components/text/Typography/typography.cva.js +100 -0
- package/{src → dist}/config/confirmation.context.d.ts +1 -1
- package/dist/config/confirmation.context.js +107 -0
- package/dist/config/i18n.js +15 -0
- package/dist/config/router.context.js +43 -0
- package/{src → dist}/config/uiConfig.context.d.ts +8 -8
- package/dist/config/uiConfig.context.js +67 -0
- package/{src → dist}/config/uiStyle.context.d.ts +14 -14
- package/dist/config/uiStyle.context.js +16 -0
- package/dist/helpers/dynamicColumns.js +359 -0
- package/{src → dist}/helpers/dynamicInputs.d.ts +2 -2
- package/dist/helpers/dynamicInputs.js +216 -0
- package/dist/hooks/useAutosave.js +83 -0
- package/dist/hooks/useBreakpoint.js +20 -0
- package/dist/hooks/useDebounceCallback.js +29 -0
- package/dist/hooks/useDeepCompare.js +25 -0
- package/dist/hooks/useFilters.js +120 -0
- package/dist/hooks/useForm.js +22 -0
- package/{src → dist}/hooks/useFormAutosave.d.ts +2 -2
- package/dist/hooks/useFormAutosave.js +67 -0
- package/dist/hooks/useIntersectionObserver.js +27 -0
- package/dist/hooks/useLocalStorage.js +63 -0
- package/dist/hooks/useLongPressRepeat.js +33 -0
- package/dist/hooks/usePagination.js +35 -0
- package/dist/hooks/useScrollableListBox.js +30 -0
- package/dist/hooks/useSorting.js +30 -0
- package/dist/hooks/useStateAndRef.js +17 -0
- package/dist/hooks/useTableColumnConfig.js +63 -0
- package/dist/hooks/useTableNav.js +409 -0
- package/dist/hooks/useTranslationMemo.js +14 -0
- package/dist/index.js +284 -0
- package/{src → dist}/types/react-query.d.ts +1 -1
- package/dist/utils/array.utils.js +12 -0
- package/dist/utils/compoundMapper.js +14 -0
- package/dist/utils/date-time.utils.js +77 -0
- package/dist/utils/date.utils.js +12 -0
- package/dist/utils/dom.utils.js +13 -0
- package/dist/utils/file.utils.js +63 -0
- package/dist/utils/isEqual.js +95 -0
- package/dist/utils/logger.js +19 -0
- package/dist/utils/object.utils.js +53 -0
- package/dist/utils/queries.utils.js +9 -0
- package/dist/utils/rest.utils.js +51 -0
- package/dist/utils/routing.utils.js +15 -0
- package/dist/utils/string.utils.js +12 -0
- package/{src → dist}/utils/vendor/acl/AclGuard.d.ts +1 -1
- package/dist/utils/vendor/acl/AclGuard.js +15 -0
- package/dist/utils/vendor/acl/Can.js +18 -0
- package/dist/utils/vendor/acl/ability.context.js +37 -0
- package/dist/utils/vendor/auth/AuthGuard.js +26 -0
- package/dist/utils/vendor/auth/auth.context.js +36 -0
- package/{src → dist}/utils/vendor/auth/withPrivateAuthGuard.d.ts +1 -1
- package/dist/utils/vendor/auth/withPrivateAuthGuard.js +17 -0
- package/dist/utils/vendor/error-handling.js +119 -0
- package/dist/utils/vendor/rest-interceptor.js +21 -0
- package/dist/utils/zod.utils.js +25 -0
- package/package.json +57 -5
- package/index.js +0 -62585
- package/povio-ui-0.0.8.tgz +0 -0
- package/vite.config.d.ts +0 -2
- /package/{src → dist}/assets/icons/AlignCenter.d.ts +0 -0
- /package/{src → dist}/assets/icons/AlignLeft.d.ts +0 -0
- /package/{src → dist}/assets/icons/AlignLeftRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/AlignRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/ArrowDropDown.d.ts +0 -0
- /package/{src → dist}/assets/icons/ArrowDropUp.d.ts +0 -0
- /package/{src → dist}/assets/icons/ArrowLeft.d.ts +0 -0
- /package/{src → dist}/assets/icons/ArrowRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/Bold.d.ts +0 -0
- /package/{src → dist}/assets/icons/BulletedList.d.ts +0 -0
- /package/{src → dist}/assets/icons/Calendar.d.ts +0 -0
- /package/{src → dist}/assets/icons/Check.d.ts +0 -0
- /package/{src → dist}/assets/icons/CheckCircle.d.ts +0 -0
- /package/{src → dist}/assets/icons/CheckboxCheckmark.d.ts +0 -0
- /package/{src → dist}/assets/icons/CheckboxIndeterminate.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronDown.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronLeft.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronUp.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronsLeft.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronsRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/Clock.d.ts +0 -0
- /package/{src → dist}/assets/icons/Close.d.ts +0 -0
- /package/{src → dist}/assets/icons/DateTime.d.ts +0 -0
- /package/{src → dist}/assets/icons/Drag.d.ts +0 -0
- /package/{src → dist}/assets/icons/File.d.ts +0 -0
- /package/{src → dist}/assets/icons/Highlight.d.ts +0 -0
- /package/{src → dist}/assets/icons/HighlightOn.d.ts +0 -0
- /package/{src → dist}/assets/icons/Info.d.ts +0 -0
- /package/{src → dist}/assets/icons/Italic.d.ts +0 -0
- /package/{src → dist}/assets/icons/Link.d.ts +0 -0
- /package/{src → dist}/assets/icons/Menu.d.ts +0 -0
- /package/{src → dist}/assets/icons/NumberedList.d.ts +0 -0
- /package/{src → dist}/assets/icons/PointerHorizontal.d.ts +0 -0
- /package/{src → dist}/assets/icons/PointerVertical.d.ts +0 -0
- /package/{src → dist}/assets/icons/Send.d.ts +0 -0
- /package/{src → dist}/assets/icons/Strikethrough.d.ts +0 -0
- /package/{src → dist}/assets/icons/TextColor.d.ts +0 -0
- /package/{src → dist}/assets/icons/Today.d.ts +0 -0
- /package/{src → dist}/assets/icons/Underlined.d.ts +0 -0
- /package/{src → dist}/assets/icons/Upload.d.ts +0 -0
- /package/{src → dist}/assets/icons/View.d.ts +0 -0
- /package/{src → dist}/assets/icons/ViewOff.d.ts +0 -0
- /package/{src → dist}/assets/icons/WarningFilled.d.ts +0 -0
- /package/{src → dist}/components/Menu/Menu.d.ts +0 -0
- /package/{src → dist}/components/buttons/shared/buttonContent.cva.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/Calendar.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/CalendarCell.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/CalendarGrid.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/CalendarSelectHeader.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/DateField.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/DateSegmentItem.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/DateTimeDialog.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/DateTimeDialogFooter.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/MonthPicker.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/RangeCalendar.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/TimeField.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/TimePickerForm.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/YearPicker.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/FileUpload.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/FileUploadContainer.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/InputUpload.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/index.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/shared/FileProgressBar.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/shared/InputUploadFilled.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/shared/fileUpload.cva.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/shared/inputUploadButton.cva.d.ts +0 -0
- /package/{src → dist}/components/inputs/FormField/FormFieldError.d.ts +0 -0
- /package/{src → dist}/components/inputs/FormField/FormFieldHeader.d.ts +0 -0
- /package/{src → dist}/components/inputs/FormField/FormFieldHeaderClose.d.ts +0 -0
- /package/{src → dist}/components/inputs/Inputs/Inputs.d.ts +0 -0
- /package/{src → dist}/components/inputs/Selection/shared/SelectListBoxSelectionBar.d.ts +0 -0
- /package/{src → dist}/components/inputs/TextEditor/Toolbar/ColorPicker.d.ts +0 -0
- /package/{src → dist}/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.d.ts +0 -0
- /package/{src → dist}/components/inputs/TextEditor/Toolbar/TextEditorToolbar.d.ts +0 -0
- /package/{src → dist}/components/inputs/TextEditor/textEditor.types.d.ts +0 -0
- /package/{src → dist}/components/inputs/shared/InputClear.d.ts +0 -0
- /package/{src → dist}/components/inputs/shared/form.types.d.ts +0 -0
- /package/{src → dist}/components/inputs/shared/input.cva.d.ts +0 -0
- /package/{src → dist}/components/outline.clsx.d.ts +0 -0
- /package/{src → dist}/components/overlays/BottomSheet/BottomSheet.d.ts +0 -0
- /package/{src → dist}/components/overlays/Drawer/Drawer.d.ts +0 -0
- /package/{src → dist}/components/overlays/Modal/modal.cva.d.ts +0 -0
- /package/{src → dist}/components/overlays/ResponsivePopover/ResponsivePopover.d.ts +0 -0
- /package/{src → dist}/components/overlays/Tooltip/TooltipEllipsis.d.ts +0 -0
- /package/{src → dist}/components/overlays/Tooltip/tooltip.cva.d.ts +0 -0
- /package/{src → dist}/components/segment/Segment.d.ts +0 -0
- /package/{src → dist}/components/segment/SegmentItem.d.ts +0 -0
- /package/{src → dist}/components/shared/pagination/Pagination.d.ts +0 -0
- /package/{src → dist}/components/shared/pagination/minWidth.cva.d.ts +0 -0
- /package/{src → dist}/components/status/Alert/alert.cva.d.ts +0 -0
- /package/{src → dist}/components/status/Loader/loader.cva.d.ts +0 -0
- /package/{src → dist}/components/status/Toast/useToast.d.ts +0 -0
- /package/{src → dist}/components/status/shared/status.cva.d.ts +0 -0
- /package/{src → dist}/components/table/CellText.d.ts +0 -0
- /package/{src → dist}/components/table/ColumnConfig.d.ts +0 -0
- /package/{src → dist}/components/table/HeaderText.d.ts +0 -0
- /package/{src → dist}/components/table/InfiniteTable.d.ts +0 -0
- /package/{src → dist}/components/table/PaginatedTable.d.ts +0 -0
- /package/{src → dist}/components/table/Table.d.ts +0 -0
- /package/{src → dist}/components/table/table.cva.d.ts +0 -0
- /package/{src → dist}/components/text/Link/link.cva.d.ts +0 -0
- /package/{src → dist}/components/text/Tag/tag.cva.d.ts +0 -0
- /package/{src → dist}/components/text/Typography/typography.cva.d.ts +0 -0
- /package/{src → dist}/config/i18n.d.ts +0 -0
- /package/{src → dist}/config/router.context.d.ts +0 -0
- /package/{src → dist}/helpers/dynamicColumns.d.ts +0 -0
- /package/{src → dist}/hooks/useAutosave.d.ts +0 -0
- /package/{src → dist}/hooks/useBreakpoint.d.ts +0 -0
- /package/{src → dist}/hooks/useDebounceCallback.d.ts +0 -0
- /package/{src → dist}/hooks/useDeepCompare.d.ts +0 -0
- /package/{src → dist}/hooks/useFilters.d.ts +0 -0
- /package/{src → dist}/hooks/useForm.d.ts +0 -0
- /package/{src → dist}/hooks/useIntersectionObserver.d.ts +0 -0
- /package/{src → dist}/hooks/useLocalStorage.d.ts +0 -0
- /package/{src → dist}/hooks/useLongPressRepeat.d.ts +0 -0
- /package/{src → dist}/hooks/usePagination.d.ts +0 -0
- /package/{src → dist}/hooks/useScrollableListBox.d.ts +0 -0
- /package/{src → dist}/hooks/useSorting.d.ts +0 -0
- /package/{src → dist}/hooks/useStateAndRef.d.ts +0 -0
- /package/{src → dist}/hooks/useTableColumnConfig.d.ts +0 -0
- /package/{src → dist}/hooks/useTableNav.d.ts +0 -0
- /package/{src → dist}/hooks/useTranslationMemo.d.ts +0 -0
- /package/{src → dist}/index.d.ts +0 -0
- /package/{styles → dist/styles}/editor.css +0 -0
- /package/{styles → dist/styles}/index.css +0 -0
- /package/{src → dist}/types/common.d.ts +0 -0
- /package/{src → dist}/utils/array.utils.d.ts +0 -0
- /package/{src → dist}/utils/array.utils.spec.d.ts +0 -0
- /package/{src → dist}/utils/compoundMapper.d.ts +0 -0
- /package/{src → dist}/utils/compoundMapper.spec.d.ts +0 -0
- /package/{src → dist}/utils/date-time.utils.d.ts +0 -0
- /package/{src → dist}/utils/date-time.utils.spec.d.ts +0 -0
- /package/{src → dist}/utils/date.utils.d.ts +0 -0
- /package/{src → dist}/utils/date.utils.spec.d.ts +0 -0
- /package/{src → dist}/utils/dom.utils.d.ts +0 -0
- /package/{src → dist}/utils/file.utils.d.ts +0 -0
- /package/{src → dist}/utils/isEqual.d.ts +0 -0
- /package/{src → dist}/utils/logger.d.ts +0 -0
- /package/{src → dist}/utils/object.utils.d.ts +0 -0
- /package/{src → dist}/utils/queries.utils.d.ts +0 -0
- /package/{src → dist}/utils/rest.utils.d.ts +0 -0
- /package/{src → dist}/utils/routing.utils.d.ts +0 -0
- /package/{src → dist}/utils/string.utils.d.ts +0 -0
- /package/{src → dist}/utils/vendor/acl/Can.d.ts +0 -0
- /package/{src → dist}/utils/vendor/acl/ability.context.d.ts +0 -0
- /package/{src → dist}/utils/vendor/acl/appAbility.types.d.ts +0 -0
- /package/{src → dist}/utils/vendor/auth/AuthGuard.d.ts +0 -0
- /package/{src → dist}/utils/vendor/auth/auth.context.d.ts +0 -0
- /package/{src → dist}/utils/vendor/error-handling.d.ts +0 -0
- /package/{src → dist}/utils/vendor/rest-client.types.d.ts +0 -0
- /package/{src → dist}/utils/vendor/rest-interceptor.d.ts +0 -0
- /package/{src → dist}/utils/zod.utils.d.ts +0 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { isSameDay } from "@internationalized/date";
|
|
3
|
+
import { useCalendarCell } from "@react-aria/calendar";
|
|
4
|
+
import { useFocusRing } from "@react-aria/focus";
|
|
5
|
+
import { mergeProps } from "@react-aria/utils";
|
|
6
|
+
import { clsx } from "clsx";
|
|
7
|
+
import { useRef, useCallback, useMemo } from "react";
|
|
8
|
+
import { Typography } from "../../../text/Typography/Typography.js";
|
|
9
|
+
const isRange = (state) => {
|
|
10
|
+
return "highlightedRange" in state;
|
|
11
|
+
};
|
|
12
|
+
const CalendarCell = ({
|
|
13
|
+
state,
|
|
14
|
+
onApply,
|
|
15
|
+
shouldCloseOnSelect = true,
|
|
16
|
+
onDateSelection,
|
|
17
|
+
onDateHover,
|
|
18
|
+
rangeSelection,
|
|
19
|
+
hoverDate,
|
|
20
|
+
onKeyboardNavigation,
|
|
21
|
+
...props
|
|
22
|
+
}) => {
|
|
23
|
+
const ref = useRef(null);
|
|
24
|
+
const { cellProps, buttonProps, formattedDate, isSelected, isDisabled, isOutsideVisibleRange } = useCalendarCell(
|
|
25
|
+
props,
|
|
26
|
+
state,
|
|
27
|
+
ref
|
|
28
|
+
);
|
|
29
|
+
const { focusProps } = useFocusRing();
|
|
30
|
+
const onClick = useCallback(
|
|
31
|
+
(event) => {
|
|
32
|
+
buttonProps.onClick?.(event);
|
|
33
|
+
if (onDateSelection) {
|
|
34
|
+
onDateSelection(props.date);
|
|
35
|
+
}
|
|
36
|
+
if (isSelected && shouldCloseOnSelect) {
|
|
37
|
+
onApply?.();
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
[buttonProps, onDateSelection, props.date, isSelected, shouldCloseOnSelect, onApply]
|
|
41
|
+
);
|
|
42
|
+
const selectionState = useMemo(() => {
|
|
43
|
+
let isSelectionStart = false;
|
|
44
|
+
let isSelectionEnd = false;
|
|
45
|
+
let isSelectedCell = false;
|
|
46
|
+
let isInRange = false;
|
|
47
|
+
let isHoverRange = false;
|
|
48
|
+
let isSelectingMode = false;
|
|
49
|
+
if (rangeSelection?.start) {
|
|
50
|
+
isSelectionStart = isSameDay(props.date, rangeSelection.start);
|
|
51
|
+
isSelectionEnd = rangeSelection.end ? isSameDay(props.date, rangeSelection.end) : false;
|
|
52
|
+
isSelectedCell = isSelectionStart || isSelectionEnd;
|
|
53
|
+
isSelectingMode = rangeSelection.isSelecting && !rangeSelection.end;
|
|
54
|
+
if (rangeSelection.start && rangeSelection.end) {
|
|
55
|
+
const dateValue = props.date;
|
|
56
|
+
const isAfterStart = dateValue.compare(rangeSelection.start) > 0;
|
|
57
|
+
const isBeforeEnd = dateValue.compare(rangeSelection.end) < 0;
|
|
58
|
+
isInRange = isAfterStart && isBeforeEnd;
|
|
59
|
+
}
|
|
60
|
+
if (rangeSelection.isSelecting && rangeSelection.start && hoverDate && !rangeSelection.end) {
|
|
61
|
+
const dateValue = props.date;
|
|
62
|
+
const { start } = rangeSelection;
|
|
63
|
+
const end = hoverDate;
|
|
64
|
+
const earlierDate = start.compare(end) <= 0 ? start : end;
|
|
65
|
+
const laterDate = start.compare(end) <= 0 ? end : start;
|
|
66
|
+
const isAfterStart = dateValue.compare(earlierDate) > 0;
|
|
67
|
+
const isBeforeEnd = dateValue.compare(laterDate) < 0;
|
|
68
|
+
isHoverRange = isAfterStart && isBeforeEnd;
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
isSelectionStart = isRange(state) && state.highlightedRange ? isSameDay(props.date, state.highlightedRange.start) : isSelected;
|
|
72
|
+
isSelectionEnd = isRange(state) && state.highlightedRange ? isSameDay(props.date, state.highlightedRange.end) : isSelected;
|
|
73
|
+
isSelectedCell = isSelectionStart || isSelectionEnd || !isRange(state) && isSelected;
|
|
74
|
+
isInRange = isRange(state) && isSelected && !isSelectionStart && !isSelectionEnd;
|
|
75
|
+
if (isRange(state) && state.highlightedRange && !isSelected) {
|
|
76
|
+
const dateValue = props.date;
|
|
77
|
+
const isAfterStart = dateValue.compare(state.highlightedRange.start) > 0;
|
|
78
|
+
const isBeforeEnd = dateValue.compare(state.highlightedRange.end) < 0;
|
|
79
|
+
isHoverRange = isAfterStart && isBeforeEnd;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return { isSelectionStart, isSelectionEnd, isSelectedCell, isInRange, isHoverRange, isSelectingMode };
|
|
83
|
+
}, [props.date, rangeSelection, state, isSelected, hoverDate]);
|
|
84
|
+
const handleEvent = (event, eventHandler) => {
|
|
85
|
+
if (isOutsideVisibleRange) {
|
|
86
|
+
state.selectDate(props.date);
|
|
87
|
+
state.setFocusedDate(props.date);
|
|
88
|
+
}
|
|
89
|
+
eventHandler?.(event);
|
|
90
|
+
if (isSelected && shouldCloseOnSelect) {
|
|
91
|
+
onApply?.();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const onMouseEnter = useCallback(() => {
|
|
95
|
+
if (onDateHover && selectionState.isSelectingMode) {
|
|
96
|
+
onDateHover(props.date);
|
|
97
|
+
}
|
|
98
|
+
}, [onDateHover, selectionState.isSelectingMode, props.date]);
|
|
99
|
+
const onMouseLeave = useCallback(() => {
|
|
100
|
+
if (onDateHover && selectionState.isSelectingMode) {
|
|
101
|
+
onDateHover(null);
|
|
102
|
+
}
|
|
103
|
+
}, [onDateHover, selectionState.isSelectingMode]);
|
|
104
|
+
const cellClassName = useMemo(() => {
|
|
105
|
+
const { isSelectedCell, isInRange, isHoverRange, isSelectingMode, isSelectionStart, isSelectionEnd } = selectionState;
|
|
106
|
+
return clsx(
|
|
107
|
+
"mx-auto flex h-10 w-full max-w-10 items-center justify-center rounded-button-rounding-m p-2",
|
|
108
|
+
"focus:outline-none focus-visible:outline-1 focus-visible:outline-interactive-contained-primary-focus focus-visible:outline-offset-1",
|
|
109
|
+
"border border-transparent border-solid",
|
|
110
|
+
// Base text colors
|
|
111
|
+
!isSelectedCell && !isOutsideVisibleRange && "bg-elevation-fill-default-1 text-interactive-text-secondary-idle",
|
|
112
|
+
!isSelectedCell && isOutsideVisibleRange && "bg-elevation-fill-default-1 text-interactive-text-primary-disabled",
|
|
113
|
+
// Selected cell styling
|
|
114
|
+
isSelectedCell && !isOutsideVisibleRange && "bg-interactive-contained-primary-idle text-interactive-text-primary-idle-inverted",
|
|
115
|
+
// Selection start cell styling
|
|
116
|
+
isSelectedCell && !isOutsideVisibleRange && rangeSelection && !rangeSelection.isSelecting && isSelectionStart && !isSelectionEnd && "rounded-r-none",
|
|
117
|
+
// Selection end cell styling
|
|
118
|
+
isSelectedCell && !isOutsideVisibleRange && rangeSelection && !rangeSelection.isSelecting && isSelectionEnd && !isSelectionStart && "rounded-l-none",
|
|
119
|
+
// Disabled state
|
|
120
|
+
isDisabled && !isOutsideVisibleRange && "cursor-default",
|
|
121
|
+
// Disabled cell styling
|
|
122
|
+
isDisabled && "opacity-20",
|
|
123
|
+
// Regular hover state - only for non-selected, non-disabled, visible cells when not in selecting mode
|
|
124
|
+
!isSelectedCell && !isInRange && !isHoverRange && !isSelectingMode && !(isDisabled && !isOutsideVisibleRange) && "[@media(pointer:fine)]:hover:border-elevation-outline-default-1",
|
|
125
|
+
// Range styling - for dates between start and end
|
|
126
|
+
isInRange && !isOutsideVisibleRange && "!rounded-none !bg-elevation-fill-default-2 text-interactive-text-secondary-hover",
|
|
127
|
+
// Hover range styling - for potential range during hover
|
|
128
|
+
isHoverRange && !isOutsideVisibleRange && "!rounded-none !bg-elevation-fill-default-2 text-interactive-text-secondary-hover",
|
|
129
|
+
// Hover state for selecting mode
|
|
130
|
+
!isInRange && !isSelectedCell && isSelectingMode && "hover:bg-interactive-contained-primary-idle hover:text-interactive-text-primary-idle-inverted",
|
|
131
|
+
// css only hover effect during selection mode for better performance
|
|
132
|
+
isSelectingMode && !isSelectedCell && !isInRange && !isHoverRange && !isDisabled && !isOutsideVisibleRange && "transition-all duration-75 hover:border-elevation-outline-default-1"
|
|
133
|
+
);
|
|
134
|
+
}, [selectionState, isOutsideVisibleRange, rangeSelection, isDisabled]);
|
|
135
|
+
return /* @__PURE__ */ jsx("td", { ...cellProps, children: /* @__PURE__ */ jsx(
|
|
136
|
+
"div",
|
|
137
|
+
{
|
|
138
|
+
ref,
|
|
139
|
+
...mergeProps(buttonProps, focusProps),
|
|
140
|
+
"aria-disabled": void 0,
|
|
141
|
+
onMouseEnter,
|
|
142
|
+
onMouseLeave,
|
|
143
|
+
className: cellClassName,
|
|
144
|
+
onClick: (e) => handleEvent(e, onClick),
|
|
145
|
+
onKeyDown: (e) => handleEvent(e, () => onKeyboardNavigation?.(e, props.date)),
|
|
146
|
+
children: /* @__PURE__ */ jsx(
|
|
147
|
+
Typography,
|
|
148
|
+
{
|
|
149
|
+
as: "span",
|
|
150
|
+
size: "label-2",
|
|
151
|
+
className: "block w-6 overflow-hidden text-ellipsis text-center",
|
|
152
|
+
children: formattedDate
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
) });
|
|
157
|
+
};
|
|
158
|
+
export {
|
|
159
|
+
CalendarCell
|
|
160
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCalendarGrid } from "@react-aria/calendar";
|
|
3
|
+
import { clsx } from "clsx";
|
|
4
|
+
import { CalendarCell } from "./CalendarCell.js";
|
|
5
|
+
import { Typography } from "../../../text/Typography/Typography.js";
|
|
6
|
+
const WEEK_INDICES = [0, 1, 2, 3, 4, 5];
|
|
7
|
+
const CalendarGrid = ({
|
|
8
|
+
state,
|
|
9
|
+
onApply,
|
|
10
|
+
shouldCloseOnSelect,
|
|
11
|
+
offset = {},
|
|
12
|
+
onDateSelection,
|
|
13
|
+
onDateHover,
|
|
14
|
+
rangeSelection,
|
|
15
|
+
hoverDate,
|
|
16
|
+
onKeyboardNavigation,
|
|
17
|
+
className,
|
|
18
|
+
calendarSide,
|
|
19
|
+
...props
|
|
20
|
+
}) => {
|
|
21
|
+
const { gridProps, headerProps, weekDays } = useCalendarGrid({ ...props, weekdayStyle: "short" }, state);
|
|
22
|
+
const startDate = state.visibleRange.start.add(offset);
|
|
23
|
+
const handleDateSelection = (date) => {
|
|
24
|
+
onDateSelection?.(date, calendarSide);
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ jsx("div", { className: clsx("h-72 w-full px-3 py-1 md:w-80", className), children: /* @__PURE__ */ jsxs(
|
|
27
|
+
"table",
|
|
28
|
+
{
|
|
29
|
+
...gridProps,
|
|
30
|
+
cellPadding: "0",
|
|
31
|
+
className: "w-full",
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsx("thead", { ...headerProps, children: /* @__PURE__ */ jsx("tr", { children: weekDays.map((day) => /* @__PURE__ */ jsx("th", { children: /* @__PURE__ */ jsx(
|
|
34
|
+
Typography,
|
|
35
|
+
{
|
|
36
|
+
size: "label-2",
|
|
37
|
+
className: "bg-elevation-fill-default-1 py-2 text-interactive-text-secondary-idle",
|
|
38
|
+
children: day.substring(0, 2)
|
|
39
|
+
}
|
|
40
|
+
) }, day)) }) }),
|
|
41
|
+
/* @__PURE__ */ jsx("tbody", { children: WEEK_INDICES.map((weekIndex) => /* @__PURE__ */ jsx("tr", { children: state.getDatesInWeek(weekIndex, startDate).map(
|
|
42
|
+
(date, i) => date ? /* @__PURE__ */ jsx(
|
|
43
|
+
CalendarCell,
|
|
44
|
+
{
|
|
45
|
+
state,
|
|
46
|
+
date,
|
|
47
|
+
onApply,
|
|
48
|
+
shouldCloseOnSelect,
|
|
49
|
+
onDateSelection: handleDateSelection,
|
|
50
|
+
onDateHover,
|
|
51
|
+
rangeSelection,
|
|
52
|
+
hoverDate,
|
|
53
|
+
onKeyboardNavigation
|
|
54
|
+
},
|
|
55
|
+
i
|
|
56
|
+
) : (
|
|
57
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
58
|
+
/* @__PURE__ */ jsx("td", {}, i)
|
|
59
|
+
)
|
|
60
|
+
) }, weekIndex)) })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
) });
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
CalendarGrid
|
|
67
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AriaButtonProps } from '@react-aria/button';
|
|
2
2
|
import { CalendarState } from '@react-stately/calendar';
|
|
3
3
|
import { DatePickerState } from 'react-stately';
|
|
4
|
-
import { ToggleState } from '
|
|
4
|
+
import { ToggleState } from './Calendar';
|
|
5
5
|
interface CalendarProps {
|
|
6
6
|
calendarState: CalendarState;
|
|
7
7
|
datePickerState?: DatePickerState;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Time } from "@internationalized/date";
|
|
3
|
+
import { useDateFormatter } from "@react-aria/i18n";
|
|
4
|
+
import { Button, ToggleButtonGroup } from "react-aria-components";
|
|
5
|
+
import { ChevronLeftIcon } from "../../../../assets/icons/ChevronLeft.js";
|
|
6
|
+
import { ChevronRightIcon } from "../../../../assets/icons/ChevronRight.js";
|
|
7
|
+
import { PillButton } from "../../../buttons/PillButton/PillButton.js";
|
|
8
|
+
const HourCycle = {
|
|
9
|
+
12: "h12",
|
|
10
|
+
24: "h23"
|
|
11
|
+
};
|
|
12
|
+
const CalendarHeader = ({
|
|
13
|
+
calendarState,
|
|
14
|
+
datePickerState,
|
|
15
|
+
prevButtonProps,
|
|
16
|
+
nextButtonProps,
|
|
17
|
+
includesTime,
|
|
18
|
+
hourCycle,
|
|
19
|
+
toggleState,
|
|
20
|
+
setToggleState
|
|
21
|
+
}) => {
|
|
22
|
+
const formatter = useDateFormatter({
|
|
23
|
+
month: "long",
|
|
24
|
+
timeZone: calendarState.timeZone
|
|
25
|
+
});
|
|
26
|
+
const timeFormatter = useDateFormatter({
|
|
27
|
+
timeStyle: "short",
|
|
28
|
+
timeZone: calendarState.timeZone,
|
|
29
|
+
hourCycle: hourCycle ? HourCycle[hourCycle] : void 0
|
|
30
|
+
});
|
|
31
|
+
const year = calendarState.focusedDate.year.toString();
|
|
32
|
+
const month = formatter.format(calendarState.focusedDate.toDate(calendarState.timeZone));
|
|
33
|
+
const timeValue = datePickerState?.timeValue || new Time();
|
|
34
|
+
const date = /* @__PURE__ */ new Date();
|
|
35
|
+
date.setHours(timeValue.hour, timeValue.minute);
|
|
36
|
+
return /* @__PURE__ */ jsxs("div", { className: "inline-flex w-full items-center justify-between border-elevation-outline-default-1 border-b border-solid px-1", children: [
|
|
37
|
+
/* @__PURE__ */ jsx("div", { className: "inline-flex h-12 items-center p-3", children: !toggleState && /* @__PURE__ */ jsx(
|
|
38
|
+
Button,
|
|
39
|
+
{
|
|
40
|
+
...prevButtonProps,
|
|
41
|
+
className: "shrink-0 focus-visible:outline-interactive-contained-secondary-focus",
|
|
42
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "size-6 text-interactive-text-secondary-idle" })
|
|
43
|
+
}
|
|
44
|
+
) }),
|
|
45
|
+
/* @__PURE__ */ jsxs(ToggleButtonGroup, { className: "flex gap-2", children: [
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
PillButton,
|
|
48
|
+
{
|
|
49
|
+
color: "secondary",
|
|
50
|
+
toggle: true,
|
|
51
|
+
isSelected: toggleState === "month",
|
|
52
|
+
onChange: (isSelected) => setToggleState(isSelected ? "month" : null),
|
|
53
|
+
children: month
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
PillButton,
|
|
58
|
+
{
|
|
59
|
+
color: "secondary",
|
|
60
|
+
toggle: true,
|
|
61
|
+
isSelected: toggleState === "year",
|
|
62
|
+
onChange: (isSelected) => setToggleState(isSelected ? "year" : null),
|
|
63
|
+
children: year
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
includesTime && /* @__PURE__ */ jsx(
|
|
67
|
+
PillButton,
|
|
68
|
+
{
|
|
69
|
+
color: "secondary",
|
|
70
|
+
toggle: true,
|
|
71
|
+
isSelected: toggleState === "time",
|
|
72
|
+
onChange: (isSelected) => setToggleState(isSelected ? "time" : null),
|
|
73
|
+
children: timeFormatter.format(date)
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
] }),
|
|
77
|
+
/* @__PURE__ */ jsx("div", { className: "inline-flex h-12 items-center p-3", children: !toggleState && /* @__PURE__ */ jsx(
|
|
78
|
+
Button,
|
|
79
|
+
{
|
|
80
|
+
...nextButtonProps,
|
|
81
|
+
className: "shrink-0 focus-visible:outline-interactive-contained-secondary-focus",
|
|
82
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "size-6 text-interactive-text-secondary-idle" })
|
|
83
|
+
}
|
|
84
|
+
) })
|
|
85
|
+
] });
|
|
86
|
+
};
|
|
87
|
+
export {
|
|
88
|
+
CalendarHeader
|
|
89
|
+
};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useDateFormatter } from "@react-aria/i18n";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { ArrowDropDownIcon } from "../../../../assets/icons/ArrowDropDown.js";
|
|
5
|
+
import { ChevronLeftIcon } from "../../../../assets/icons/ChevronLeft.js";
|
|
6
|
+
import { ChevronRightIcon } from "../../../../assets/icons/ChevronRight.js";
|
|
7
|
+
import { ChevronsLeftIcon } from "../../../../assets/icons/ChevronsLeft.js";
|
|
8
|
+
import { ChevronsRightIcon } from "../../../../assets/icons/ChevronsRight.js";
|
|
9
|
+
import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconButton.js";
|
|
10
|
+
import { PillButton } from "../../../buttons/PillButton/PillButton.js";
|
|
11
|
+
import { Select } from "../../Selection/Select/Select.js";
|
|
12
|
+
const CalendarSelectHeader = ({
|
|
13
|
+
state,
|
|
14
|
+
isPrevMonthDisabled,
|
|
15
|
+
isPrevYearDisabled,
|
|
16
|
+
isNextMonthDisabled,
|
|
17
|
+
isNextYearDisabled,
|
|
18
|
+
offset = { months: 0 },
|
|
19
|
+
onNavigate,
|
|
20
|
+
maxDate,
|
|
21
|
+
minDate
|
|
22
|
+
}) => {
|
|
23
|
+
const displayDate = state.visibleRange.start.add(offset);
|
|
24
|
+
const currentMonth = displayDate.month - 1;
|
|
25
|
+
const currentYear = displayDate.year;
|
|
26
|
+
const formatter = useDateFormatter({
|
|
27
|
+
month: "long",
|
|
28
|
+
timeZone: state.timeZone
|
|
29
|
+
});
|
|
30
|
+
const numMonths = state.focusedDate.calendar.getMonthsInYear(state.focusedDate);
|
|
31
|
+
const MONTHS = useMemo(() => {
|
|
32
|
+
const months = [];
|
|
33
|
+
for (let i = 1; i <= numMonths; i++) {
|
|
34
|
+
const date = state.focusedDate.set({ month: i });
|
|
35
|
+
months.push(formatter.format(date.toDate(state.timeZone)));
|
|
36
|
+
}
|
|
37
|
+
return months;
|
|
38
|
+
}, [formatter, numMonths, state.focusedDate, state.timeZone]);
|
|
39
|
+
const years = Array.from({ length: 201 }, (_, i) => currentYear - 100 + i);
|
|
40
|
+
const getAvailableMonths = () => {
|
|
41
|
+
return MONTHS.map((month, i) => {
|
|
42
|
+
const monthDate = displayDate.set({ month: i + 1 });
|
|
43
|
+
let isDisabled = false;
|
|
44
|
+
if (maxDate) {
|
|
45
|
+
isDisabled = monthDate.year > maxDate.year || monthDate.year === maxDate.year && monthDate.month >= maxDate.month;
|
|
46
|
+
}
|
|
47
|
+
if (minDate) {
|
|
48
|
+
isDisabled = monthDate.year < minDate.year || monthDate.year === minDate.year && monthDate.month <= minDate.month;
|
|
49
|
+
}
|
|
50
|
+
return { month, value: i, isDisabled };
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
const getAvailableYears = () => {
|
|
54
|
+
return years.map((year) => {
|
|
55
|
+
let isDisabled = false;
|
|
56
|
+
if (maxDate) {
|
|
57
|
+
isDisabled = year > maxDate.year || year === maxDate.year && displayDate.month >= maxDate.month;
|
|
58
|
+
}
|
|
59
|
+
if (minDate && !isDisabled) {
|
|
60
|
+
isDisabled = year < minDate.year || year === minDate.year && displayDate.month <= minDate.month;
|
|
61
|
+
}
|
|
62
|
+
return { year, isDisabled };
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
const availableMonths = getAvailableMonths();
|
|
66
|
+
const availableYears = getAvailableYears();
|
|
67
|
+
const handleMonthChange = (value) => {
|
|
68
|
+
if (value === null) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const newDate = displayDate.set({ month: value + 1 });
|
|
72
|
+
onNavigate?.(newDate);
|
|
73
|
+
};
|
|
74
|
+
const handleYearChange = (value) => {
|
|
75
|
+
if (value === null) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const newDate = displayDate.set({ year: value });
|
|
79
|
+
onNavigate?.(newDate);
|
|
80
|
+
};
|
|
81
|
+
const handlePrevMonth = (e) => {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
e.stopPropagation();
|
|
84
|
+
const newDate = displayDate.subtract({ months: 1 });
|
|
85
|
+
onNavigate?.(newDate);
|
|
86
|
+
};
|
|
87
|
+
const handleNextMonth = (e) => {
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
e.stopPropagation();
|
|
90
|
+
const newDate = displayDate.add({ months: 1 });
|
|
91
|
+
onNavigate?.(newDate);
|
|
92
|
+
};
|
|
93
|
+
const handlePrevYear = (e) => {
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
e.stopPropagation();
|
|
96
|
+
const newDate = displayDate.subtract({ years: 1 });
|
|
97
|
+
onNavigate?.(newDate);
|
|
98
|
+
};
|
|
99
|
+
const handleNextYear = (e) => {
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
e.stopPropagation();
|
|
102
|
+
const newDate = displayDate.add({ years: 1 });
|
|
103
|
+
onNavigate?.(newDate);
|
|
104
|
+
};
|
|
105
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-3 border-elevation-outline-default-1 border-b border-solid px-3 py-2-5", children: [
|
|
106
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
InlineIconButton,
|
|
109
|
+
{
|
|
110
|
+
color: "secondary",
|
|
111
|
+
isDisabled: isPrevYearDisabled,
|
|
112
|
+
onClick: handlePrevYear,
|
|
113
|
+
icon: ChevronsLeftIcon,
|
|
114
|
+
label: "Previous year"
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
/* @__PURE__ */ jsx(
|
|
118
|
+
InlineIconButton,
|
|
119
|
+
{
|
|
120
|
+
color: "secondary",
|
|
121
|
+
isDisabled: isPrevMonthDisabled,
|
|
122
|
+
onClick: handlePrevMonth,
|
|
123
|
+
icon: ChevronLeftIcon,
|
|
124
|
+
label: "Previous month"
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
] }),
|
|
128
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
129
|
+
/* @__PURE__ */ jsx(
|
|
130
|
+
Select,
|
|
131
|
+
{
|
|
132
|
+
label: "Month",
|
|
133
|
+
hideLabel: true,
|
|
134
|
+
customTrigger: /* @__PURE__ */ jsx(
|
|
135
|
+
PillButton,
|
|
136
|
+
{
|
|
137
|
+
color: "secondary",
|
|
138
|
+
iconPosition: "right",
|
|
139
|
+
icon: ArrowDropDownIcon,
|
|
140
|
+
children: MONTHS[currentMonth]
|
|
141
|
+
}
|
|
142
|
+
),
|
|
143
|
+
ignoreTriggerWidth: true,
|
|
144
|
+
items: availableMonths.map(({ month, value, isDisabled }) => ({
|
|
145
|
+
label: month,
|
|
146
|
+
id: value,
|
|
147
|
+
isDisabled
|
|
148
|
+
})).filter(({ isDisabled }) => !isDisabled),
|
|
149
|
+
value: currentMonth,
|
|
150
|
+
onChange: handleMonthChange
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ jsx(
|
|
154
|
+
Select,
|
|
155
|
+
{
|
|
156
|
+
label: "Year",
|
|
157
|
+
hideLabel: true,
|
|
158
|
+
customTrigger: /* @__PURE__ */ jsx(
|
|
159
|
+
PillButton,
|
|
160
|
+
{
|
|
161
|
+
color: "secondary",
|
|
162
|
+
iconPosition: "right",
|
|
163
|
+
icon: ArrowDropDownIcon,
|
|
164
|
+
children: currentYear.toString()
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
items: availableYears.map(({ year, isDisabled }) => ({
|
|
168
|
+
label: year.toString(),
|
|
169
|
+
id: year,
|
|
170
|
+
isDisabled
|
|
171
|
+
})).filter(({ isDisabled }) => !isDisabled),
|
|
172
|
+
value: currentYear,
|
|
173
|
+
onChange: handleYearChange
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
] }),
|
|
177
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
178
|
+
/* @__PURE__ */ jsx(
|
|
179
|
+
InlineIconButton,
|
|
180
|
+
{
|
|
181
|
+
color: "secondary",
|
|
182
|
+
isDisabled: isNextMonthDisabled,
|
|
183
|
+
onClick: handleNextMonth,
|
|
184
|
+
icon: ChevronRightIcon,
|
|
185
|
+
label: "Next month"
|
|
186
|
+
}
|
|
187
|
+
),
|
|
188
|
+
/* @__PURE__ */ jsx(
|
|
189
|
+
InlineIconButton,
|
|
190
|
+
{
|
|
191
|
+
color: "secondary",
|
|
192
|
+
isDisabled: isNextYearDisabled,
|
|
193
|
+
onClick: handleNextYear,
|
|
194
|
+
icon: ChevronsRightIcon,
|
|
195
|
+
label: "Next year"
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
] })
|
|
199
|
+
] });
|
|
200
|
+
};
|
|
201
|
+
export {
|
|
202
|
+
CalendarSelectHeader
|
|
203
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createCalendar } from "@internationalized/date";
|
|
3
|
+
import { useRef, useImperativeHandle, useEffect } from "react";
|
|
4
|
+
import { useLocale, useDateField } from "react-aria";
|
|
5
|
+
import { useDateFieldState } from "react-stately";
|
|
6
|
+
import { DateSegmentItem } from "./DateSegmentItem.js";
|
|
7
|
+
const DateField = ({ ref, onClearChange, hidePlaceholder, ...props }) => {
|
|
8
|
+
const { locale } = useLocale();
|
|
9
|
+
const state = useDateFieldState({
|
|
10
|
+
...props,
|
|
11
|
+
locale,
|
|
12
|
+
createCalendar
|
|
13
|
+
});
|
|
14
|
+
const dataFieldRef = useRef(null);
|
|
15
|
+
const { fieldProps } = useDateField(props, state, dataFieldRef);
|
|
16
|
+
const handleBlur = (e) => {
|
|
17
|
+
fieldProps.onBlur?.(e);
|
|
18
|
+
if (!state.value) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const currentValue = state.value;
|
|
22
|
+
const { year } = currentValue;
|
|
23
|
+
if (year >= 0 && year <= 99) {
|
|
24
|
+
const correctedYear = year <= 50 ? 2e3 + year : 1900 + year;
|
|
25
|
+
const correctedDate = currentValue.set({ year: correctedYear });
|
|
26
|
+
if (correctedDate) {
|
|
27
|
+
state.setValue(correctedDate);
|
|
28
|
+
props.onChange?.(correctedDate);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
useImperativeHandle(ref, () => ({
|
|
33
|
+
clearField: () => {
|
|
34
|
+
state.setValue(null);
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
onClearChange?.(state.segments.some((segment) => segment.type !== "literal" && segment.isPlaceholder === false));
|
|
39
|
+
}, [state.segments, onClearChange]);
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
...fieldProps,
|
|
44
|
+
ref: dataFieldRef,
|
|
45
|
+
onBlur: handleBlur,
|
|
46
|
+
className: "relative w-full",
|
|
47
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex", children: state.segments.map((segment, i) => /* @__PURE__ */ jsx(
|
|
48
|
+
DateSegmentItem,
|
|
49
|
+
{
|
|
50
|
+
segment,
|
|
51
|
+
state,
|
|
52
|
+
isDisabled: props.isDisabled,
|
|
53
|
+
hidePlaceholder
|
|
54
|
+
},
|
|
55
|
+
i
|
|
56
|
+
)) })
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
DateField
|
|
62
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ref } from 'react';
|
|
2
2
|
import { DatePickerAria } from 'react-aria';
|
|
3
|
-
import { FormFieldHeaderProps } from '
|
|
4
|
-
import { InputVariantProps } from '
|
|
3
|
+
import { FormFieldHeaderProps } from '../../FormField/FormFieldHeader';
|
|
4
|
+
import { InputVariantProps } from '../../shared/input.cva';
|
|
5
5
|
interface DatePickerInputProps extends InputVariantProps {
|
|
6
6
|
ref?: Ref<HTMLDivElement>;
|
|
7
7
|
groupProps: DatePickerAria["groupProps"];
|