@mezzanine-ui/react 0.16.0 → 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion/AccordionControlContext.js +1 -0
- package/Accordion/AccordionDetails.js +1 -0
- package/Accordion/AccordionSummary.js +10 -10
- package/Accordion/index.d.ts +6 -3
- package/Alert/index.d.ts +3 -2
- package/AlertBanner/AlertBanner.d.ts +93 -0
- package/AlertBanner/AlertBanner.js +154 -0
- package/AlertBanner/index.d.ts +2 -0
- package/AlertBanner/index.js +1 -0
- package/Anchor/Anchor.js +1 -1
- package/Anchor/index.d.ts +2 -1
- package/AppBar/index.d.ts +8 -4
- package/{Overlay/Overlay.d.ts → Backdrop/Backdrop.d.ts} +12 -16
- package/Backdrop/Backdrop.js +40 -0
- package/Backdrop/index.d.ts +2 -0
- package/Backdrop/index.js +1 -0
- package/Badge/Badge.d.ts +20 -14
- package/Badge/Badge.js +14 -16
- package/Badge/BadgeContainer.d.ts +1 -1
- package/Badge/BadgeContainer.js +1 -1
- package/Badge/index.d.ts +3 -2
- package/Badge/typings.d.ts +48 -0
- package/Breadcrumb/Breadcrumb.d.ts +6 -0
- package/Breadcrumb/Breadcrumb.js +25 -0
- package/Breadcrumb/BreadcrumbItem.d.ts +4 -0
- package/Breadcrumb/BreadcrumbItem.js +45 -0
- package/Breadcrumb/index.d.ts +2 -0
- package/Breadcrumb/index.js +1 -0
- package/Breadcrumb/typings.d.ts +70 -0
- package/Button/Button.js +24 -19
- package/Button/ButtonGroup.d.ts +6 -28
- package/Button/ButtonGroup.js +7 -16
- package/Button/index.d.ts +4 -10
- package/Button/index.js +2 -3
- package/Button/typings.d.ts +11 -26
- package/Calendar/Calendar.d.ts +31 -2
- package/Calendar/Calendar.js +74 -19
- package/Calendar/CalendarCell.d.ts +4 -0
- package/Calendar/CalendarCell.js +3 -3
- package/Calendar/CalendarConfigProviderDayjs.d.ts +21 -0
- package/Calendar/CalendarConfigProviderDayjs.js +15 -0
- package/Calendar/CalendarConfigProviderLuxon.d.ts +21 -0
- package/Calendar/CalendarConfigProviderLuxon.js +15 -0
- package/Calendar/CalendarConfigProviderMoment.d.ts +21 -0
- package/Calendar/CalendarConfigProviderMoment.js +15 -0
- package/Calendar/CalendarContext.d.ts +14 -7
- package/Calendar/CalendarContext.js +8 -13
- package/Calendar/CalendarControls.d.ts +16 -0
- package/Calendar/CalendarControls.js +3 -7
- package/Calendar/CalendarDayOfWeek.js +4 -3
- package/Calendar/CalendarDays.d.ts +9 -1
- package/Calendar/CalendarDays.js +63 -38
- package/Calendar/CalendarFooterActions.d.ts +13 -0
- package/Calendar/CalendarFooterActions.js +14 -0
- package/Calendar/CalendarFooterControl.d.ts +16 -0
- package/Calendar/CalendarFooterControl.js +14 -0
- package/Calendar/CalendarHalfYears.d.ts +39 -0
- package/Calendar/CalendarHalfYears.js +62 -0
- package/Calendar/CalendarMonths.js +16 -4
- package/Calendar/CalendarQuarters.d.ts +37 -0
- package/Calendar/CalendarQuarters.js +64 -0
- package/Calendar/CalendarQuickSelect.d.ts +21 -0
- package/Calendar/CalendarQuickSelect.js +15 -0
- package/Calendar/CalendarWeeks.d.ts +1 -1
- package/Calendar/CalendarWeeks.js +89 -44
- package/Calendar/CalendarYears.js +13 -3
- package/Calendar/RangeCalendar.d.ts +59 -0
- package/Calendar/RangeCalendar.js +232 -0
- package/Calendar/index.d.ts +33 -10
- package/Calendar/index.js +7 -0
- package/Calendar/useCalendarControlModifiers.d.ts +4 -4
- package/Calendar/useCalendarControlModifiers.js +40 -8
- package/Calendar/useCalendarControls.d.ts +2 -0
- package/Calendar/useCalendarControls.js +19 -2
- package/Calendar/useCalendarModeStack.js +1 -0
- package/Calendar/useRangeCalendarControls.d.ts +18 -0
- package/Calendar/useRangeCalendarControls.js +115 -0
- package/Card/CardActions.js +1 -1
- package/Card/index.d.ts +4 -2
- package/Checkbox/CheckAll.d.ts +16 -6
- package/Checkbox/CheckAll.js +40 -26
- package/Checkbox/Checkbox.d.ts +100 -22
- package/Checkbox/Checkbox.js +73 -16
- package/Checkbox/CheckboxGroup.d.ts +100 -18
- package/Checkbox/CheckboxGroup.js +169 -24
- package/Checkbox/CheckboxGroupContext.d.ts +0 -2
- package/Checkbox/CheckboxGroupContext.js +1 -0
- package/Checkbox/index.d.ts +16 -4
- package/Checkbox/index.js +6 -2
- package/Checkbox/typings.d.ts +37 -0
- package/ClearActions/ClearActions.d.ts +41 -0
- package/ClearActions/ClearActions.js +23 -0
- package/ClearActions/index.d.ts +3 -0
- package/ClearActions/index.js +5 -0
- package/ConfirmActions/ConfirmActions.d.ts +2 -1
- package/ConfirmActions/index.d.ts +2 -1
- package/DatePicker/DatePicker.d.ts +12 -1
- package/DatePicker/DatePicker.js +41 -9
- package/DatePicker/DatePickerCalendar.d.ts +2 -5
- package/DatePicker/DatePickerCalendar.js +37 -37
- package/DatePicker/index.d.ts +4 -2
- package/DateRangePicker/DateRangePicker.d.ts +18 -2
- package/DateRangePicker/DateRangePicker.js +143 -100
- package/DateRangePicker/DateRangePickerCalendar.d.ts +13 -9
- package/DateRangePicker/DateRangePickerCalendar.js +7 -94
- package/DateRangePicker/index.d.ts +6 -3
- package/DateRangePicker/useDateRangeCalendarControls.js +11 -6
- package/DateRangePicker/useDateRangePickerValue.d.ts +38 -15
- package/DateRangePicker/useDateRangePickerValue.js +142 -63
- package/DateTimePicker/DateTimePicker.d.ts +31 -10
- package/DateTimePicker/DateTimePicker.js +179 -94
- package/DateTimePicker/index.d.ts +2 -2
- package/DateTimePicker/index.js +0 -1
- package/Drawer/Drawer.js +2 -2
- package/Drawer/index.d.ts +2 -1
- package/Dropdown/Dropdown.js +12 -22
- package/Dropdown/index.d.ts +2 -1
- package/Empty/Empty.d.ts +1 -16
- package/Empty/Empty.js +36 -7
- package/Empty/icons/EmptyMainInitialDataIcon.d.ts +4 -0
- package/Empty/icons/EmptyMainInitialDataIcon.js +9 -0
- package/Empty/icons/EmptyMainResultIcon.d.ts +4 -0
- package/Empty/icons/EmptyMainResultIcon.js +9 -0
- package/Empty/icons/EmptyMainSystemIcon.d.ts +4 -0
- package/Empty/icons/EmptyMainSystemIcon.js +9 -0
- package/Empty/index.d.ts +2 -1
- package/Empty/typings.d.ts +52 -0
- package/Form/FormControlContext.js +1 -0
- package/Form/FormHintText.d.ts +18 -0
- package/Form/FormHintText.js +17 -0
- package/Form/FormLabel.js +1 -0
- package/Form/index.d.ts +9 -5
- package/Form/index.js +1 -1
- package/Form/useAutoCompleteValueControl.js +2 -0
- package/Form/useCheckboxControlValue.js +0 -1
- package/Form/useSelectValueControl.js +2 -0
- package/InlineMessage/InlineMessage.d.ts +33 -0
- package/InlineMessage/InlineMessage.js +42 -0
- package/InlineMessage/InlineMessageGroup.d.ts +24 -0
- package/InlineMessage/InlineMessageGroup.js +21 -0
- package/InlineMessage/index.d.ts +4 -0
- package/InlineMessage/index.js +2 -0
- package/Input/ActionButton/ActionButton.d.ts +26 -0
- package/Input/ActionButton/ActionButton.js +14 -0
- package/Input/ActionButton/index.d.ts +2 -0
- package/Input/ActionButton/index.js +1 -0
- package/Input/Input.d.ts +147 -42
- package/Input/Input.js +195 -27
- package/Input/PasswordStrengthIndicator/PasswordStrengthIndicator.d.ts +31 -0
- package/Input/PasswordStrengthIndicator/PasswordStrengthIndicator.js +18 -0
- package/Input/PasswordStrengthIndicator/index.d.ts +2 -0
- package/Input/PasswordStrengthIndicator/index.js +1 -0
- package/Input/SelectButton/SelectButton.d.ts +20 -0
- package/Input/SelectButton/SelectButton.js +21 -0
- package/Input/SelectButton/index.d.ts +2 -0
- package/Input/SelectButton/index.js +1 -0
- package/Input/SpinnerButton/SpinnerButton.d.ts +19 -0
- package/Input/SpinnerButton/SpinnerButton.js +14 -0
- package/Input/SpinnerButton/index.d.ts +2 -0
- package/Input/SpinnerButton/index.js +1 -0
- package/Input/index.d.ts +3 -2
- package/Menu/Menu.js +1 -0
- package/Menu/index.d.ts +8 -4
- package/Message/Message.d.ts +6 -4
- package/Message/Message.js +86 -9
- package/Message/MessageTimerController.d.ts +14 -0
- package/Message/MessageTimerController.js +27 -0
- package/Message/index.d.ts +3 -2
- package/Modal/Modal.js +2 -2
- package/Modal/ModalActions.js +1 -0
- package/Modal/ModalControl.js +1 -0
- package/Modal/ModalHeader.js +1 -0
- package/Modal/index.d.ts +10 -5
- package/Modal/useModalContainer.d.ts +1 -1
- package/Modal/useModalContainer.js +2 -4
- package/Navigation/Navigation.js +37 -34
- package/Navigation/NavigationContext.js +1 -0
- package/Navigation/NavigationItem.js +1 -0
- package/Navigation/NavigationSubMenu.js +16 -26
- package/Navigation/index.d.ts +8 -4
- package/Notification/Notification.js +0 -1
- package/Notification/index.d.ts +3 -2
- package/Notifier/NotifierManager.d.ts +15 -2
- package/Notifier/NotifierManager.js +60 -18
- package/Notifier/createNotifier.d.ts +9 -0
- package/Notifier/createNotifier.js +3 -2
- package/Notifier/typings.d.ts +3 -1
- package/OverflowTooltip/OverflowCounterTag.d.ts +12 -0
- package/OverflowTooltip/OverflowCounterTag.js +48 -0
- package/OverflowTooltip/OverflowTooltip.d.ts +34 -0
- package/OverflowTooltip/OverflowTooltip.js +53 -0
- package/OverflowTooltip/index.d.ts +2 -0
- package/OverflowTooltip/index.js +2 -0
- package/PageFooter/PageFooter.d.ts +73 -8
- package/PageFooter/PageFooter.js +34 -3
- package/PageFooter/index.d.ts +2 -1
- package/PageHeader/PageHeader.d.ts +36 -0
- package/PageHeader/PageHeader.js +65 -0
- package/PageHeader/index.d.ts +2 -0
- package/PageHeader/index.js +1 -0
- package/PageToolbar/PageToolbar.d.ts +67 -0
- package/PageToolbar/PageToolbar.js +114 -0
- package/PageToolbar/index.d.ts +2 -0
- package/PageToolbar/index.js +1 -0
- package/Pagination/Pagination.d.ts +23 -29
- package/Pagination/Pagination.js +3 -4
- package/Pagination/PaginationItem.d.ts +1 -1
- package/Pagination/PaginationItem.js +6 -3
- package/Pagination/PaginationJumper.d.ts +7 -9
- package/Pagination/PaginationJumper.js +3 -5
- package/Pagination/PaginationPageSize.d.ts +8 -11
- package/Pagination/PaginationPageSize.js +5 -4
- package/Pagination/index.d.ts +8 -4
- package/Pagination/usePagination.d.ts +3 -1
- package/Pagination/usePagination.js +30 -21
- package/Picker/FormattedInput.d.ts +17 -0
- package/Picker/FormattedInput.js +74 -0
- package/Picker/MaskFormat.d.ts +39 -0
- package/Picker/MaskFormat.js +94 -0
- package/Picker/PickerTrigger.d.ts +13 -3
- package/Picker/PickerTrigger.js +17 -2
- package/Picker/PickerTriggerWithSeparator.d.ts +124 -0
- package/Picker/PickerTriggerWithSeparator.js +80 -0
- package/Picker/RangePickerTrigger.d.ts +55 -4
- package/Picker/RangePickerTrigger.js +65 -7
- package/Picker/formatUtils.d.ts +34 -0
- package/Picker/formatUtils.js +124 -0
- package/Picker/index.d.ts +17 -6
- package/Picker/index.js +4 -1
- package/Picker/useDateInputFormatter.d.ts +52 -0
- package/Picker/useDateInputFormatter.js +382 -0
- package/Picker/usePickerValue.d.ts +1 -2
- package/Picker/usePickerValue.js +8 -13
- package/Popconfirm/Popconfirm.js +1 -1
- package/Popconfirm/index.d.ts +2 -1
- package/Popover/Popover.js +4 -8
- package/Popover/index.d.ts +2 -1
- package/Popper/Popper.d.ts +15 -10
- package/Popper/Popper.js +88 -17
- package/Popper/index.d.ts +2 -1
- package/Portal/Portal.d.ts +13 -5
- package/Portal/Portal.js +25 -10
- package/Portal/index.d.ts +4 -1
- package/Portal/index.js +1 -0
- package/Portal/portalRegistry.d.ts +17 -0
- package/Portal/portalRegistry.js +92 -0
- package/Progress/Progress.d.ts +23 -30
- package/Progress/Progress.js +71 -21
- package/Progress/index.d.ts +3 -2
- package/Provider/ConfigProvider.d.ts +1 -0
- package/Provider/ConfigProvider.js +1 -0
- package/Provider/context.js +1 -0
- package/Radio/Radio.d.ts +1 -1
- package/Radio/Radio.js +2 -1
- package/Radio/RadioGroup.d.ts +1 -1
- package/Radio/RadioGroup.js +1 -1
- package/Radio/RadioGroupContext.js +1 -0
- package/Radio/index.d.ts +4 -2
- package/ResultState/ResultState.d.ts +52 -0
- package/ResultState/ResultState.js +24 -0
- package/ResultState/index.d.ts +2 -0
- package/ResultState/index.js +1 -0
- package/Select/AutoComplete.d.ts +1 -1
- package/Select/AutoComplete.js +2 -1
- package/Select/Option.js +1 -0
- package/Select/Select.d.ts +1 -1
- package/Select/Select.js +2 -1
- package/Select/SelectControlContext.js +1 -0
- package/Select/SelectTrigger.d.ts +1 -87
- package/Select/SelectTrigger.js +26 -21
- package/Select/SelectTriggerTags.d.ts +1 -1
- package/Select/SelectTriggerTags.js +47 -18
- package/Select/TreeSelect.d.ts +1 -1
- package/Select/TreeSelect.js +2 -1
- package/Select/index.d.ts +14 -7
- package/Select/typings.d.ts +99 -0
- package/Select/useSelectTriggerTags.d.ts +15 -8
- package/Select/useSelectTriggerTags.js +83 -44
- package/Selection/Selection.d.ts +98 -0
- package/Selection/Selection.js +46 -0
- package/Selection/index.d.ts +12 -0
- package/Selection/index.js +5 -0
- package/Skeleton/Skeleton.d.ts +10 -3
- package/Skeleton/Skeleton.js +12 -4
- package/Skeleton/index.d.ts +2 -1
- package/Slider/Slider.d.ts +44 -7
- package/Slider/Slider.js +17 -13
- package/Slider/index.d.ts +5 -3
- package/Spin/Spin.d.ts +39 -0
- package/{Loading/Loading.js → Spin/Spin.js} +9 -9
- package/Spin/index.d.ts +2 -0
- package/Spin/index.js +1 -0
- package/Stepper/Step.d.ts +1 -35
- package/Stepper/Step.js +43 -8
- package/Stepper/Stepper.d.ts +1 -14
- package/Stepper/Stepper.js +49 -15
- package/Stepper/index.d.ts +5 -2
- package/Stepper/index.js +1 -0
- package/Stepper/typings.d.ts +77 -0
- package/Stepper/useStepDistance.d.ts +10 -0
- package/Stepper/useStepDistance.js +81 -0
- package/Stepper/useStepper.d.ts +21 -0
- package/Stepper/useStepper.js +26 -0
- package/Table/Table.js +2 -2
- package/Table/TableBody.js +3 -2
- package/Table/TableBodyRow.js +1 -0
- package/Table/TableContext.js +1 -0
- package/Table/TableExpandedTable.js +1 -0
- package/Table/TableHeader.js +1 -0
- package/Table/editable/TableEditRenderWrapper.js +1 -0
- package/Table/expandable/TableExpandable.js +1 -1
- package/Table/index.d.ts +7 -4
- package/Table/pagination/TablePagination.js +1 -0
- package/Table/pagination/useTablePagination.js +1 -0
- package/Table/refresh/TableRefresh.js +3 -1
- package/Table/rowSelection/TableRowSelection.js +3 -2
- package/Table/sorting/TableSortingIcon.js +2 -1
- package/Table/sorting/useTableSorting.js +1 -0
- package/Table/useTableFetchMore.js +1 -1
- package/Table/useTableScroll.d.ts +4 -8
- package/Table/useTableScroll.js +9 -7
- package/Tabs/TabPane.js +1 -0
- package/Tabs/Tabs.js +9 -4
- package/Tabs/index.d.ts +6 -3
- package/Tabs/useTabsOverflow.js +4 -3
- package/Tag/Tag.d.ts +2 -25
- package/Tag/Tag.js +23 -13
- package/Tag/TagGroup.d.ts +12 -0
- package/Tag/TagGroup.js +41 -0
- package/Tag/index.d.ts +2 -1
- package/Tag/typings.d.ts +78 -0
- package/TextField/TextField.d.ts +78 -19
- package/TextField/TextField.js +58 -22
- package/TextField/index.d.ts +2 -1
- package/Textarea/Textarea.d.ts +19 -51
- package/Textarea/Textarea.js +13 -19
- package/Textarea/index.d.ts +2 -2
- package/TimePanel/TimePanel.d.ts +1 -22
- package/TimePanel/TimePanel.js +31 -26
- package/TimePanel/TimePanelAction.d.ts +2 -8
- package/TimePanel/TimePanelAction.js +2 -2
- package/TimePanel/TimePanelColumn.d.ts +0 -13
- package/TimePanel/TimePanelColumn.js +9 -11
- package/TimePanel/index.d.ts +6 -3
- package/TimePicker/TimePicker.d.ts +10 -1
- package/TimePicker/TimePicker.js +86 -35
- package/TimePicker/TimePickerPanel.d.ts +1 -2
- package/TimePicker/TimePickerPanel.js +2 -2
- package/TimePicker/index.d.ts +4 -2
- package/Toggle/Toggle.d.ts +46 -0
- package/Toggle/Toggle.js +29 -0
- package/Toggle/index.d.ts +3 -0
- package/Toggle/index.js +1 -0
- package/Tooltip/Tooltip.d.ts +13 -2
- package/Tooltip/Tooltip.js +56 -10
- package/Tooltip/index.d.ts +2 -1
- package/Tooltip/useDelayMouseEnterLeave.d.ts +1 -2
- package/Tooltip/useDelayMouseEnterLeave.js +10 -13
- package/Transition/Collapse.d.ts +2 -0
- package/Transition/Collapse.js +5 -6
- package/Transition/Fade.js +4 -4
- package/Transition/Rotate.d.ts +42 -0
- package/Transition/Rotate.js +30 -0
- package/Transition/Scale.d.ts +13 -0
- package/Transition/{Grow.js → Scale.js} +19 -16
- package/Transition/Slide.d.ts +7 -0
- package/Transition/{Zoom.js → Slide.js} +14 -12
- package/Transition/SlideFade.d.ts +3 -0
- package/Transition/SlideFade.js +5 -4
- package/Transition/Transition.d.ts +2 -2
- package/Transition/Translate.d.ts +14 -0
- package/Transition/Translate.js +94 -0
- package/Transition/index.d.ts +16 -6
- package/Transition/index.js +4 -2
- package/Transition/useAutoTransitionDuration.d.ts +1 -1
- package/Transition/useAutoTransitionDuration.js +3 -3
- package/Transition/useSetNodeTransition.js +0 -2
- package/Tree/TreeNode.js +7 -6
- package/Tree/index.d.ts +10 -5
- package/Typography/Typography.d.ts +6 -9
- package/Typography/Typography.js +7 -9
- package/Typography/index.d.ts +2 -5
- package/Upload/Upload.d.ts +175 -0
- package/Upload/Upload.js +279 -0
- package/Upload/UploadItem.d.ts +82 -0
- package/Upload/UploadItem.js +118 -0
- package/Upload/UploadPictureCard.d.ts +110 -0
- package/Upload/UploadPictureCard.js +101 -0
- package/Upload/Uploader.d.ts +161 -0
- package/Upload/Uploader.js +120 -0
- package/Upload/index.d.ts +8 -6
- package/Upload/index.js +4 -5
- package/Upload/upload-utils.d.ts +41 -0
- package/Upload/upload-utils.js +65 -0
- package/_internal/InputCheck/index.d.ts +4 -2
- package/_internal/InputTriggerPopper/InputTriggerPopper.js +15 -25
- package/_internal/InputTriggerPopper/index.d.ts +2 -1
- package/_internal/SlideFadeOverlay/SlideFadeOverlay.d.ts +2 -2
- package/_internal/SlideFadeOverlay/SlideFadeOverlay.js +4 -27
- package/_internal/SlideFadeOverlay/index.d.ts +2 -1
- package/_internal/SlideFadeOverlay/useTopStack.js +1 -0
- package/dayjs.d.ts +21 -0
- package/dayjs.js +2 -0
- package/hooks/useComposeRefs.js +1 -1
- package/hooks/useLastCallback.js +3 -1
- package/hooks/useScrollLock.d.ts +28 -0
- package/hooks/useScrollLock.js +134 -0
- package/index.d.ts +126 -58
- package/index.js +93 -80
- package/luxon.d.ts +21 -0
- package/luxon.js +2 -0
- package/moment.d.ts +21 -0
- package/moment.js +2 -0
- package/package.json +13 -17
- package/utils/composeRefs.js +0 -1
- package/utils/get-css-variable-value.d.ts +1 -0
- package/utils/get-css-variable-value.js +9 -0
- package/Button/IconButton.d.ts +0 -21
- package/Button/IconButton.js +0 -13
- package/DateTimePicker/DateTimePickerPanel.d.ts +0 -28
- package/DateTimePicker/DateTimePickerPanel.js +0 -49
- package/Form/FormMessage.d.ts +0 -7
- package/Form/FormMessage.js +0 -18
- package/Form/useInputWithTagsModeValue.js +0 -86
- package/Loading/Loading.d.ts +0 -33
- package/Loading/index.d.ts +0 -1
- package/Loading/index.js +0 -1
- package/Overlay/Overlay.js +0 -31
- package/Overlay/index.d.ts +0 -1
- package/Overlay/index.js +0 -1
- package/Picker/useRangePickerValue.d.ts +0 -23
- package/Picker/useRangePickerValue.js +0 -99
- package/Switch/Switch.d.ts +0 -43
- package/Switch/Switch.js +0 -28
- package/Switch/index.d.ts +0 -2
- package/Switch/index.js +0 -1
- package/Transition/Grow.d.ts +0 -12
- package/Transition/Zoom.d.ts +0 -7
- package/Upload/UploadButton.d.ts +0 -9
- package/Upload/UploadButton.js +0 -23
- package/Upload/UploadInput.d.ts +0 -20
- package/Upload/UploadInput.js +0 -24
- package/Upload/UploadPicture.d.ts +0 -49
- package/Upload/UploadPicture.js +0 -51
- package/Upload/UploadPictureBlock.d.ts +0 -20
- package/Upload/UploadPictureBlock.js +0 -81
- package/Upload/UploadPictureWall.d.ts +0 -81
- package/Upload/UploadPictureWall.js +0 -168
- package/Upload/UploadPictureWallItem.d.ts +0 -15
- package/Upload/UploadPictureWallItem.js +0 -18
- package/Upload/UploadResult.d.ts +0 -35
- package/Upload/UploadResult.js +0 -29
- package/utils/scroll-lock.d.ts +0 -2
- package/utils/scroll-lock.js +0 -24
|
@@ -5,31 +5,29 @@ export interface PaginationJumperProps extends Omit<DetailedHTMLProps<HTMLAttrib
|
|
|
5
5
|
*/
|
|
6
6
|
buttonText?: string;
|
|
7
7
|
/**
|
|
8
|
-
* If `true`, the pagination jumper fields
|
|
9
|
-
* @default false
|
|
8
|
+
* If `true`, the pagination jumper fields are disabled.
|
|
10
9
|
*/
|
|
11
|
-
disabled?:
|
|
10
|
+
disabled?: true;
|
|
12
11
|
/**
|
|
13
|
-
* The hint text displayed in front of
|
|
12
|
+
* The hint text displayed in front of input.
|
|
14
13
|
*/
|
|
15
14
|
hintText?: string;
|
|
16
15
|
/**
|
|
17
|
-
* The
|
|
16
|
+
* The placeholder displayed in the input before the user enters a value.
|
|
18
17
|
*/
|
|
19
18
|
inputPlaceholder?: string;
|
|
20
19
|
/**
|
|
21
20
|
* Callback fired when the page is changed.
|
|
22
|
-
*
|
|
23
|
-
* @param {number} page The page active.
|
|
21
|
+
* @param {number} page The active page number.
|
|
24
22
|
*/
|
|
25
23
|
onChange?: (page: number) => void;
|
|
26
24
|
/**
|
|
27
|
-
* Number of
|
|
25
|
+
* Number of items per page.
|
|
28
26
|
* @default 5
|
|
29
27
|
*/
|
|
30
28
|
pageSize?: number;
|
|
31
29
|
/**
|
|
32
|
-
*
|
|
30
|
+
* Total number of items.
|
|
33
31
|
* @default 0
|
|
34
32
|
*/
|
|
35
33
|
total?: number;
|
|
@@ -7,7 +7,7 @@ import Input from '../Input/Input.js';
|
|
|
7
7
|
import cx from 'clsx';
|
|
8
8
|
|
|
9
9
|
const PaginationJumper = forwardRef((props, ref) => {
|
|
10
|
-
const { buttonText, className, disabled
|
|
10
|
+
const { buttonText, className, disabled, hintText, inputPlaceholder, onChange: handleChange, pageSize = 5, total = 0, ...rest } = props;
|
|
11
11
|
const [value, setValue] = useState('');
|
|
12
12
|
const [error, setError] = useState(false);
|
|
13
13
|
const totalPages = total ? Math.ceil(total / pageSize) : 1;
|
|
@@ -38,13 +38,11 @@ const PaginationJumper = forwardRef((props, ref) => {
|
|
|
38
38
|
handleClick();
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
return (jsxs("div", { ...rest, ref: ref, className: cx(paginationJumperClasses.host, className), children: [jsx(Typography, {
|
|
41
|
+
return (jsxs("div", { ...rest, ref: ref, className: cx(paginationJumperClasses.host, className), children: [jsx(Typography, { component: "div", ellipsis: true, variant: "label-primary", children: hintText }), jsx(Input, { size: "sub", disabled: disabled, error: error, variant: "number", className: paginationJumperClasses.input, onChange: (e) => {
|
|
42
42
|
setValue(e.target.value);
|
|
43
43
|
}, placeholder: inputPlaceholder, inputProps: {
|
|
44
|
-
type: 'number',
|
|
45
|
-
className: paginationJumperClasses.input,
|
|
46
44
|
onKeyDown: handleKeyDown,
|
|
47
|
-
}, value: value }), jsx(Button, { disabled: disabled, onClick: handleClick, children: buttonText })] }));
|
|
45
|
+
}, value: value }), jsx(Button, { size: "sub", disabled: disabled, onClick: handleClick, children: buttonText })] }));
|
|
48
46
|
});
|
|
49
47
|
|
|
50
48
|
export { PaginationJumper as default };
|
|
@@ -1,36 +1,33 @@
|
|
|
1
1
|
import { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
2
2
|
export interface PaginationPageSizeProps extends Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'onChange'> {
|
|
3
3
|
/**
|
|
4
|
-
* If `true`, the pagination page size fields
|
|
4
|
+
* If `true`, the pagination page size fields are disabled.
|
|
5
5
|
* @default false
|
|
6
6
|
*/
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
/**
|
|
9
|
-
* Label
|
|
9
|
+
* Label displayed before select.
|
|
10
10
|
*/
|
|
11
11
|
label?: string;
|
|
12
12
|
/**
|
|
13
13
|
* Callback fired when the page size is changed.
|
|
14
|
-
*
|
|
15
|
-
* @param {number} pageSize The page active.
|
|
14
|
+
* @param {number} pageSize The new page size.
|
|
16
15
|
*/
|
|
17
16
|
onChange?: (pageSize: number) => void;
|
|
18
17
|
/**
|
|
19
|
-
*
|
|
18
|
+
* Options for select component.
|
|
20
19
|
* @default [10, 20, 50, 100]
|
|
21
20
|
*/
|
|
22
21
|
options?: number[];
|
|
23
22
|
/**
|
|
24
|
-
* Callback to custom
|
|
23
|
+
* Callback to render custom option name.
|
|
24
|
+
* @param {number} pageSize The page size value.
|
|
25
|
+
* @returns {string}
|
|
25
26
|
* @default (p) => `${p}`
|
|
26
27
|
*/
|
|
27
28
|
renderOptionName?: (pageSize: number) => string;
|
|
28
29
|
/**
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
unit?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Current page size value
|
|
30
|
+
* Current page size value.
|
|
34
31
|
*/
|
|
35
32
|
value?: number;
|
|
36
33
|
}
|
|
@@ -2,19 +2,20 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { forwardRef, useMemo } from 'react';
|
|
3
3
|
import { paginationPageSizeClasses } from '@mezzanine-ui/core/pagination';
|
|
4
4
|
import Typography from '../Typography/Typography.js';
|
|
5
|
-
import
|
|
6
|
-
import Option from '../Select/Option.js';
|
|
5
|
+
import SelectTrigger from '../Select/SelectTrigger.js';
|
|
7
6
|
import cx from 'clsx';
|
|
8
7
|
|
|
9
8
|
const PaginationPageSize = forwardRef((props, ref) => {
|
|
10
|
-
const { className, disabled = false, label,
|
|
9
|
+
const { className, disabled = false, label,
|
|
10
|
+
/* TODO: waiting Select onChange, Dropdown Menu options */
|
|
11
|
+
onChange, options = [10, 20, 50, 100], renderOptionName = (p) => `${p}`, value, ...rest } = props;
|
|
11
12
|
const currentValue = useMemo(() => value
|
|
12
13
|
? {
|
|
13
14
|
id: `${value}`,
|
|
14
15
|
name: renderOptionName(value),
|
|
15
16
|
}
|
|
16
17
|
: undefined, [value, renderOptionName]);
|
|
17
|
-
return (jsxs("div", { ...rest, ref: ref, className: cx(paginationPageSizeClasses.host, className), children: [label ? (jsx(Typography, {
|
|
18
|
+
return (jsxs("div", { ...rest, ref: ref, className: cx(paginationPageSizeClasses.host, className), children: [label ? (jsx(Typography, { component: "div", ellipsis: true, variant: "label-primary", children: label })) : null, jsx(SelectTrigger, { className: paginationPageSizeClasses.select, disabled: disabled, size: "sub", value: currentValue })] }));
|
|
18
19
|
});
|
|
19
20
|
|
|
20
21
|
export { PaginationPageSize as default };
|
package/Pagination/index.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export type { PaginationItemType } from '@mezzanine-ui/core/pagination';
|
|
2
|
-
export { PaginationProps
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
2
|
+
export type { PaginationProps } from './Pagination';
|
|
3
|
+
export { default } from './Pagination';
|
|
4
|
+
export { default as PaginationItem } from './PaginationItem';
|
|
5
|
+
export type { PaginationItemProps } from './PaginationItem';
|
|
6
|
+
export { default as PaginationJumper } from './PaginationJumper';
|
|
7
|
+
export type { PaginationJumperProps } from './PaginationJumper';
|
|
8
|
+
export { default as PaginationPageSize } from './PaginationPageSize';
|
|
9
|
+
export type { PaginationPageSizeProps } from './PaginationPageSize';
|
|
6
10
|
export { usePagination } from './usePagination';
|
|
@@ -3,10 +3,12 @@ export interface UsePaginationParams {
|
|
|
3
3
|
boundaryCount?: number;
|
|
4
4
|
current?: number;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
+
hideFirstButton?: boolean;
|
|
7
|
+
hideLastButton?: boolean;
|
|
6
8
|
hideNextButton?: boolean;
|
|
7
9
|
hidePreviousButton?: boolean;
|
|
8
|
-
pageSize?: number;
|
|
9
10
|
onChange?: (page: number) => void;
|
|
11
|
+
pageSize?: number;
|
|
10
12
|
siblingCount?: number;
|
|
11
13
|
total?: number;
|
|
12
14
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
1
|
+
import { useMemo, useCallback } from 'react';
|
|
2
2
|
|
|
3
3
|
const range = (start, end) => {
|
|
4
4
|
const length = end - start + 1;
|
|
5
5
|
return Array.from({ length }, (_, i) => start + i);
|
|
6
6
|
};
|
|
7
7
|
function usePagination(props = {}) {
|
|
8
|
-
const { boundaryCount = 1, current = 1, disabled = false,
|
|
8
|
+
const { boundaryCount = 1, current = 1, disabled = false, onChange: handleChange, pageSize = 10, siblingCount = 1, total = 0, } = props;
|
|
9
9
|
const totalPages = total ? Math.ceil(total / pageSize) : 1;
|
|
10
10
|
const itemList = useMemo(() => {
|
|
11
11
|
const startPages = range(1, Math.min(boundaryCount, totalPages));
|
|
@@ -13,37 +13,30 @@ function usePagination(props = {}) {
|
|
|
13
13
|
const siblingsStart = Math.max(Math.min(current - siblingCount, totalPages - boundaryCount - siblingCount * 2 - 1), boundaryCount + 2);
|
|
14
14
|
const siblingsEnd = Math.min(Math.max(current + siblingCount, boundaryCount + siblingCount * 2 + 2), endPages.length > 0 ? endPages[0] - 2 : totalPages - 1);
|
|
15
15
|
return [
|
|
16
|
-
|
|
16
|
+
'first',
|
|
17
|
+
'previous',
|
|
17
18
|
...startPages,
|
|
18
|
-
// eslint-disable-next-line no-nested-ternary
|
|
19
19
|
...(siblingsStart > boundaryCount + 2
|
|
20
20
|
? ['ellipsis']
|
|
21
21
|
: boundaryCount + 1 < totalPages - boundaryCount
|
|
22
22
|
? [boundaryCount + 1]
|
|
23
23
|
: []),
|
|
24
24
|
...range(siblingsStart, siblingsEnd),
|
|
25
|
-
// eslint-disable-next-line no-nested-ternary
|
|
26
25
|
...(siblingsEnd < totalPages - boundaryCount - 1
|
|
27
26
|
? ['ellipsis']
|
|
28
27
|
: totalPages - boundaryCount > boundaryCount
|
|
29
28
|
? [totalPages - boundaryCount]
|
|
30
29
|
: []),
|
|
31
30
|
...endPages,
|
|
32
|
-
|
|
31
|
+
'next',
|
|
32
|
+
'last',
|
|
33
33
|
];
|
|
34
|
-
}, [
|
|
35
|
-
|
|
36
|
-
current,
|
|
37
|
-
hideNextButton,
|
|
38
|
-
hidePreviousButton,
|
|
39
|
-
siblingCount,
|
|
40
|
-
totalPages,
|
|
41
|
-
]);
|
|
42
|
-
const handleClick = (page) => {
|
|
34
|
+
}, [boundaryCount, current, siblingCount, totalPages]);
|
|
35
|
+
const handleClick = useCallback((page) => {
|
|
43
36
|
if (handleChange) {
|
|
44
37
|
handleChange(page);
|
|
45
38
|
}
|
|
46
|
-
};
|
|
39
|
+
}, [handleChange]);
|
|
47
40
|
const items = useMemo(() => itemList.map((item) => {
|
|
48
41
|
if (typeof item === 'number') {
|
|
49
42
|
return {
|
|
@@ -61,28 +54,44 @@ function usePagination(props = {}) {
|
|
|
61
54
|
}
|
|
62
55
|
const restItemProps = {
|
|
63
56
|
previous: {
|
|
64
|
-
'aria-label': 'Go to previous
|
|
65
|
-
disabled: disabled || current
|
|
57
|
+
'aria-label': 'Go to previous page',
|
|
58
|
+
disabled: disabled || current === 1,
|
|
66
59
|
onClick: () => {
|
|
67
60
|
handleClick(current - 1);
|
|
68
61
|
},
|
|
69
62
|
type: item,
|
|
70
63
|
},
|
|
71
64
|
next: {
|
|
72
|
-
'aria-label': 'Go to next
|
|
73
|
-
disabled: disabled || current
|
|
65
|
+
'aria-label': 'Go to next page',
|
|
66
|
+
disabled: disabled || current === totalPages,
|
|
74
67
|
onClick: () => {
|
|
75
68
|
handleClick(current + 1);
|
|
76
69
|
},
|
|
77
70
|
type: item,
|
|
78
71
|
},
|
|
72
|
+
first: {
|
|
73
|
+
'aria-label': 'Go to first page',
|
|
74
|
+
disabled: disabled || current === 1,
|
|
75
|
+
onClick: () => {
|
|
76
|
+
handleClick(1);
|
|
77
|
+
},
|
|
78
|
+
type: item,
|
|
79
|
+
},
|
|
80
|
+
last: {
|
|
81
|
+
'aria-label': 'Go to last page',
|
|
82
|
+
disabled: disabled || current === totalPages,
|
|
83
|
+
onClick: () => {
|
|
84
|
+
handleClick(totalPages);
|
|
85
|
+
},
|
|
86
|
+
type: item,
|
|
87
|
+
},
|
|
79
88
|
ellipsis: {
|
|
80
89
|
disabled,
|
|
81
90
|
type: item,
|
|
82
91
|
},
|
|
83
92
|
};
|
|
84
93
|
return restItemProps[item] || { type: item };
|
|
85
|
-
}), [current, disabled, itemList, totalPages]);
|
|
94
|
+
}), [current, disabled, itemList, totalPages, handleClick]);
|
|
86
95
|
return {
|
|
87
96
|
items,
|
|
88
97
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'react';
|
|
2
|
+
import { type UseDateInputFormatterProps } from './useDateInputFormatter';
|
|
3
|
+
export interface FormattedInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value'>, Pick<UseDateInputFormatterProps, 'errorMessages' | 'validate' | 'format' | 'onChange'> {
|
|
4
|
+
/**
|
|
5
|
+
* Placeholder to show when not focused and value is empty
|
|
6
|
+
*/
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The current value
|
|
10
|
+
*/
|
|
11
|
+
value?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Formatted input component with mixed-color placeholder
|
|
15
|
+
*/
|
|
16
|
+
declare const FormattedInput: import("react").ForwardRefExoticComponent<FormattedInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
17
|
+
export default FormattedInput;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useRef } from 'react';
|
|
3
|
+
import { pickerClasses } from '@mezzanine-ui/core/picker';
|
|
4
|
+
import { useDateInputFormatter } from './useDateInputFormatter.js';
|
|
5
|
+
import { useComposeRefs } from '../hooks/useComposeRefs.js';
|
|
6
|
+
import { parseFormatSegments, getTemplateWithoutBrackets, findPreviousMaskSegment, isMaskSegmentFilled } from './formatUtils.js';
|
|
7
|
+
import cx from 'clsx';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Formatted input component with mixed-color placeholder
|
|
11
|
+
*/
|
|
12
|
+
const FormattedInput = forwardRef(function FormattedInput(props, ref) {
|
|
13
|
+
const { className, disabled, errorMessages = {
|
|
14
|
+
enabled: true,
|
|
15
|
+
invalidInput: 'Input value is not valid.',
|
|
16
|
+
invalidPaste: 'Pasted content is not valid.',
|
|
17
|
+
}, format, placeholder, validate, value: externalValue, onChange, onFocus, onBlur, ...inputProps } = props;
|
|
18
|
+
const internalInputRef = useRef(null);
|
|
19
|
+
const composedRef = useComposeRefs([ref, internalInputRef]);
|
|
20
|
+
const { value, focused, handleKeyDown, handleFocus, handleBlur, handlePaste, } = useDateInputFormatter({
|
|
21
|
+
errorMessages,
|
|
22
|
+
format,
|
|
23
|
+
value: externalValue,
|
|
24
|
+
onChange,
|
|
25
|
+
inputRef: internalInputRef,
|
|
26
|
+
onFocus,
|
|
27
|
+
onBlur,
|
|
28
|
+
validate,
|
|
29
|
+
});
|
|
30
|
+
const segments = useRef(parseFormatSegments(format)).current;
|
|
31
|
+
const renderMixedColorDisplay = () => {
|
|
32
|
+
const currentValue = value || '';
|
|
33
|
+
// Show placeholder when no value
|
|
34
|
+
if (currentValue === getTemplateWithoutBrackets(format) && placeholder) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
// Show format mask when focused or has value
|
|
38
|
+
const displaySegments = [];
|
|
39
|
+
for (const segment of segments) {
|
|
40
|
+
if (segment.type === 'mask') {
|
|
41
|
+
// Render each character of the mask segment
|
|
42
|
+
for (let i = segment.start; i < segment.end; i++) {
|
|
43
|
+
displaySegments.push({
|
|
44
|
+
text: currentValue[i] || segment.text[i - segment.start],
|
|
45
|
+
filled: /\d/.test(currentValue[i]),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
// Separator or literal - show as filled if previous mask segment is filled
|
|
51
|
+
const prevMask = findPreviousMaskSegment(segments, segment.start);
|
|
52
|
+
const isFilled = prevMask
|
|
53
|
+
? isMaskSegmentFilled(currentValue, prevMask)
|
|
54
|
+
: false;
|
|
55
|
+
displaySegments.push({
|
|
56
|
+
text: segment.text,
|
|
57
|
+
filled: isFilled,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return (jsx("div", { "aria-hidden": "true", className: pickerClasses.formattedInputDisplay, children: displaySegments.map((segment, index) => (jsx("span", { className: cx(pickerClasses.formattedInputSegment, segment.filled && pickerClasses.formattedInputSegmentFilled, disabled && pickerClasses.formattedInputSegmentDisabled), children: segment.text }, index))) }));
|
|
62
|
+
};
|
|
63
|
+
const renderPlaceholder = () => {
|
|
64
|
+
if (value === getTemplateWithoutBrackets(format)) {
|
|
65
|
+
if (focused)
|
|
66
|
+
return getTemplateWithoutBrackets(format);
|
|
67
|
+
return placeholder;
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
70
|
+
};
|
|
71
|
+
return (jsxs("div", { className: pickerClasses.formattedInput, children: [jsx("input", { ...inputProps, ref: composedRef, className: cx(pickerClasses.inputMono, pickerClasses.formattedInputHidden, className), disabled: disabled, type: "text", value: value === getTemplateWithoutBrackets(format) ? '' : value, placeholder: renderPlaceholder(), onChange: () => { }, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, onPaste: handlePaste }), renderMixedColorDisplay()] }));
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export { FormattedInput as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format keys that can be used in mask format
|
|
3
|
+
*/
|
|
4
|
+
export declare const FORMAT_KEYS: string[];
|
|
5
|
+
/**
|
|
6
|
+
* Cell represents a single mask field or separator in the format
|
|
7
|
+
*/
|
|
8
|
+
export interface Cell {
|
|
9
|
+
/** Text content of this cell */
|
|
10
|
+
text: string;
|
|
11
|
+
/** Mask key if this is an editable field (e.g., 'YYYY', 'MM'), undefined for separators */
|
|
12
|
+
mask?: string;
|
|
13
|
+
/** Start position in the format string */
|
|
14
|
+
start: number;
|
|
15
|
+
/** End position in the format string */
|
|
16
|
+
end: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get valid range for a mask field
|
|
20
|
+
* @param key Mask key (e.g., 'YYYY', 'MM', 'DD')
|
|
21
|
+
* @returns [min, max] tuple
|
|
22
|
+
*/
|
|
23
|
+
export declare function getMaskRange(key: string): [number, number];
|
|
24
|
+
/**
|
|
25
|
+
* MaskFormat class parses format string into cells for mask input
|
|
26
|
+
*/
|
|
27
|
+
export default class MaskFormat {
|
|
28
|
+
/** All cells including separators */
|
|
29
|
+
cells: Cell[];
|
|
30
|
+
/** Only editable mask cells (excludes separators) */
|
|
31
|
+
maskCells: Cell[];
|
|
32
|
+
constructor(format: string);
|
|
33
|
+
/**
|
|
34
|
+
* Check if text matches this format
|
|
35
|
+
* @param text Input text to validate
|
|
36
|
+
* @returns true if text structure matches format
|
|
37
|
+
*/
|
|
38
|
+
match(text: string): boolean;
|
|
39
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { parseFormatSegments } from './formatUtils.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Get valid range for a mask field
|
|
5
|
+
* @param key Mask key (e.g., 'YYYY', 'MM', 'DD')
|
|
6
|
+
* @returns [min, max] tuple
|
|
7
|
+
*/
|
|
8
|
+
function getMaskRange(key) {
|
|
9
|
+
switch (key) {
|
|
10
|
+
case 'YYYY':
|
|
11
|
+
case 'gggg':
|
|
12
|
+
case 'GGGG':
|
|
13
|
+
return [1000, 9999];
|
|
14
|
+
case 'WW':
|
|
15
|
+
case 'ww':
|
|
16
|
+
return [1, 53];
|
|
17
|
+
case 'MM':
|
|
18
|
+
return [1, 12];
|
|
19
|
+
case 'DD':
|
|
20
|
+
return [1, 31];
|
|
21
|
+
case 'HH':
|
|
22
|
+
return [0, 23];
|
|
23
|
+
case 'n':
|
|
24
|
+
return [1, 2]; // Half-year number: 1 or 2
|
|
25
|
+
case 'mm':
|
|
26
|
+
case 'ss':
|
|
27
|
+
return [0, 59];
|
|
28
|
+
case 'SSS':
|
|
29
|
+
return [0, 999];
|
|
30
|
+
case 'Q':
|
|
31
|
+
return [1, 4];
|
|
32
|
+
default:
|
|
33
|
+
return [0, 99];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* MaskFormat class parses format string into cells for mask input
|
|
38
|
+
*/
|
|
39
|
+
class MaskFormat {
|
|
40
|
+
constructor(format) {
|
|
41
|
+
this.cells = [];
|
|
42
|
+
this.maskCells = [];
|
|
43
|
+
const segments = parseFormatSegments(format);
|
|
44
|
+
for (const segment of segments) {
|
|
45
|
+
let cell;
|
|
46
|
+
if (segment.type === 'mask') {
|
|
47
|
+
cell = {
|
|
48
|
+
text: segment.text,
|
|
49
|
+
mask: segment.text,
|
|
50
|
+
start: segment.start,
|
|
51
|
+
end: segment.end,
|
|
52
|
+
};
|
|
53
|
+
this.maskCells.push(cell);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
cell = {
|
|
57
|
+
text: segment.text,
|
|
58
|
+
start: segment.start,
|
|
59
|
+
end: segment.end,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
this.cells.push(cell);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Check if text matches this format
|
|
67
|
+
* @param text Input text to validate
|
|
68
|
+
* @returns true if text structure matches format
|
|
69
|
+
*/
|
|
70
|
+
match(text) {
|
|
71
|
+
var _a;
|
|
72
|
+
if (text.length !== ((_a = this.cells[this.cells.length - 1]) === null || _a === void 0 ? void 0 : _a.end)) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
for (const cell of this.cells) {
|
|
76
|
+
const cellText = text.slice(cell.start, cell.end);
|
|
77
|
+
if (cell.mask) {
|
|
78
|
+
// Editable field should be all digits
|
|
79
|
+
if (!/^\d+$/.test(cellText)) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// Separator should match exactly
|
|
85
|
+
if (cellText !== cell.text) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export { MaskFormat as default, getMaskRange };
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { ChangeEventHandler, RefObject } from 'react';
|
|
1
|
+
import { ChangeEventHandler, ReactNode, RefObject } from 'react';
|
|
2
2
|
import { TextFieldProps } from '../TextField';
|
|
3
3
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
|
-
|
|
4
|
+
import { FormattedInputProps } from './FormattedInput';
|
|
5
|
+
export interface PickerTriggerProps extends Omit<TextFieldProps, 'active' | 'children' | 'defaultChecked' | 'disabled' | 'readonly' | 'typing'>, Pick<FormattedInputProps, 'errorMessages' | 'validate' | 'format'> {
|
|
6
|
+
/**
|
|
7
|
+
* Whether the input is disabled.
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
|
+
disabled?: boolean;
|
|
5
11
|
/**
|
|
6
12
|
* React ref for the input element.
|
|
7
13
|
*/
|
|
@@ -9,7 +15,7 @@ export interface PickerTriggerProps extends Omit<TextFieldProps, 'active' | 'chi
|
|
|
9
15
|
/**
|
|
10
16
|
* Change handler for the input element.
|
|
11
17
|
*/
|
|
12
|
-
onChange?: ChangeEventHandler
|
|
18
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
13
19
|
/**
|
|
14
20
|
* Placeholder for the input element.
|
|
15
21
|
*/
|
|
@@ -24,6 +30,10 @@ export interface PickerTriggerProps extends Omit<TextFieldProps, 'active' | 'chi
|
|
|
24
30
|
* @default false
|
|
25
31
|
*/
|
|
26
32
|
required?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Custom suffix element. If not provided, defaults to CalendarIcon.
|
|
35
|
+
*/
|
|
36
|
+
suffix?: ReactNode;
|
|
27
37
|
/**
|
|
28
38
|
* The value of the input element.
|
|
29
39
|
*/
|
package/Picker/PickerTrigger.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { pickerClasses } from '@mezzanine-ui/core/picker';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
+
import FormattedInput from './FormattedInput.js';
|
|
4
5
|
import TextField from '../TextField/TextField.js';
|
|
5
6
|
import cx from 'clsx';
|
|
6
7
|
|
|
@@ -8,8 +9,22 @@ import cx from 'clsx';
|
|
|
8
9
|
* The react component for `mezzanine` picker trigger.
|
|
9
10
|
*/
|
|
10
11
|
const PickerTrigger = forwardRef(function PickerTrigger(props, ref) {
|
|
11
|
-
const { className, clearable, disabled, inputProps, inputRef, onChange, placeholder, readOnly, required, value, ...restTextFieldProps } = props;
|
|
12
|
-
|
|
12
|
+
const { className, clearable = true, disabled, errorMessages, format, inputProps, inputRef, onChange, placeholder, readOnly, required, suffix, validate, value, ...restTextFieldProps } = props;
|
|
13
|
+
// TextField requires disabled and readonly to be mutually exclusive
|
|
14
|
+
let defaultTextFieldProps = {};
|
|
15
|
+
if (disabled) {
|
|
16
|
+
defaultTextFieldProps = { disabled: true };
|
|
17
|
+
}
|
|
18
|
+
else if (readOnly) {
|
|
19
|
+
defaultTextFieldProps = { readonly: true };
|
|
20
|
+
}
|
|
21
|
+
return (jsx(TextField, { ...restTextFieldProps, ...defaultTextFieldProps, ref: ref, className: cx(pickerClasses.host, className), clearable: !readOnly && clearable, suffix: suffix, children: jsx(FormattedInput, { ...inputProps, ref: inputRef, "aria-disabled": disabled, "aria-multiline": false, "aria-readonly": readOnly, "aria-required": required, disabled: disabled, errorMessages: errorMessages, format: format, onChange: (formatted, _rawDigits) => {
|
|
22
|
+
if (onChange) {
|
|
23
|
+
onChange({
|
|
24
|
+
target: { value: formatted },
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}, placeholder: placeholder, readOnly: readOnly, required: required, validate: validate, value: value }) }));
|
|
13
28
|
});
|
|
14
29
|
|
|
15
30
|
export { PickerTrigger as default };
|