@mezzanine-ui/react 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion/Accordion.d.ts +24 -0
- package/Accordion/Accordion.js +32 -0
- package/Accordion/AccordionControlContext.d.ts +9 -0
- package/Accordion/AccordionControlContext.js +5 -0
- package/Accordion/AccordionDetails.d.ts +10 -0
- package/Accordion/AccordionDetails.js +25 -0
- package/Accordion/AccordionSummary.d.ts +19 -0
- package/Accordion/AccordionSummary.js +50 -0
- package/Accordion/index.d.ts +3 -0
- package/Accordion/index.js +3 -0
- package/Alert/Alert.d.ts +20 -0
- package/Alert/Alert.js +20 -0
- package/Alert/index.d.ts +2 -0
- package/Alert/index.js +1 -0
- package/AppBar/AppBar.d.ts +14 -0
- package/AppBar/AppBar.js +35 -0
- package/AppBar/AppBarBrand.d.ts +5 -0
- package/AppBar/AppBarBrand.js +11 -0
- package/AppBar/AppBarMain.d.ts +5 -0
- package/AppBar/AppBarMain.js +11 -0
- package/AppBar/AppBarSupport.d.ts +5 -0
- package/AppBar/AppBarSupport.js +11 -0
- package/AppBar/index.d.ts +4 -0
- package/AppBar/index.js +4 -0
- package/Badge/Badge.d.ts +19 -0
- package/Badge/Badge.js +27 -0
- package/Badge/BadgeContainer.d.ts +8 -0
- package/Badge/BadgeContainer.js +14 -0
- package/Badge/index.d.ts +2 -0
- package/Badge/index.js +2 -0
- package/Button/Button.d.ts +11 -0
- package/Button/Button.js +37 -0
- package/Button/ButtonGroup.d.ts +63 -0
- package/Button/ButtonGroup.js +35 -0
- package/Button/IconButton.d.ts +21 -0
- package/Button/IconButton.js +13 -0
- package/Button/index.d.ts +20 -0
- package/Button/index.js +8 -0
- package/Button/typings.d.ts +44 -0
- package/Calendar/Calendar.d.ts +69 -0
- package/Calendar/Calendar.js +53 -0
- package/Calendar/CalendarCell.d.ts +22 -0
- package/Calendar/CalendarCell.js +18 -0
- package/Calendar/CalendarContext.d.ts +22 -0
- package/Calendar/CalendarContext.js +27 -0
- package/Calendar/CalendarControls.d.ts +26 -0
- package/Calendar/CalendarControls.js +20 -0
- package/Calendar/CalendarDayOfWeek.d.ts +15 -0
- package/Calendar/CalendarDayOfWeek.js +18 -0
- package/Calendar/CalendarDays.d.ts +38 -0
- package/Calendar/CalendarDays.js +48 -0
- package/Calendar/CalendarMonths.d.ts +42 -0
- package/Calendar/CalendarMonths.js +30 -0
- package/Calendar/CalendarWeeks.d.ts +41 -0
- package/Calendar/CalendarWeeks.js +54 -0
- package/Calendar/CalendarYears.d.ts +40 -0
- package/Calendar/CalendarYears.js +34 -0
- package/Calendar/index.d.ts +12 -0
- package/Calendar/index.js +12 -0
- package/Calendar/useCalendarControlModifiers.d.ts +7 -0
- package/Calendar/useCalendarControlModifiers.js +26 -0
- package/Calendar/useCalendarControls.d.ts +13 -0
- package/Calendar/useCalendarControls.js +34 -0
- package/Calendar/useCalendarModeStack.d.ts +6 -0
- package/Calendar/useCalendarModeStack.js +15 -0
- package/Card/Card.d.ts +51 -0
- package/Card/Card.js +20 -0
- package/Card/CardActions.d.ts +34 -0
- package/Card/CardActions.js +16 -0
- package/Card/index.d.ts +2 -0
- package/Card/index.js +2 -0
- package/Checkbox/CheckAll.d.ts +13 -0
- package/Checkbox/CheckAll.js +36 -0
- package/Checkbox/Checkbox.d.ts +46 -0
- package/Checkbox/Checkbox.js +33 -0
- package/Checkbox/CheckboxGroup.d.ts +47 -0
- package/Checkbox/CheckboxGroup.js +36 -0
- package/Checkbox/CheckboxGroupContext.d.ts +9 -0
- package/Checkbox/CheckboxGroupContext.js +5 -0
- package/Checkbox/index.d.ts +4 -0
- package/Checkbox/index.js +3 -0
- package/ConfirmActions/ConfirmActions.d.ts +45 -0
- package/ConfirmActions/ConfirmActions.js +16 -0
- package/ConfirmActions/index.d.ts +1 -0
- package/ConfirmActions/index.js +1 -0
- package/DatePicker/DatePicker.d.ts +32 -0
- package/DatePicker/DatePicker.js +135 -0
- package/DatePicker/DatePickerCalendar.d.ts +32 -0
- package/DatePicker/DatePickerCalendar.js +61 -0
- package/DatePicker/index.d.ts +2 -0
- package/DatePicker/index.js +2 -0
- package/DateRangePicker/DateRangePicker.d.ts +38 -0
- package/DateRangePicker/DateRangePicker.js +187 -0
- package/DateRangePicker/DateRangePickerCalendar.d.ts +26 -0
- package/DateRangePicker/DateRangePickerCalendar.js +98 -0
- package/DateRangePicker/index.d.ts +4 -0
- package/DateRangePicker/index.js +4 -0
- package/DateRangePicker/useDateRangeCalendarControls.d.ts +15 -0
- package/DateRangePicker/useDateRangeCalendarControls.js +93 -0
- package/DateRangePicker/useDateRangePickerValue.d.ts +23 -0
- package/DateRangePicker/useDateRangePickerValue.js +87 -0
- package/DateTimePicker/DateTimePicker.d.ts +28 -0
- package/DateTimePicker/DateTimePicker.js +122 -0
- package/DateTimePicker/DateTimePickerPanel.d.ts +29 -0
- package/DateTimePicker/DateTimePickerPanel.js +51 -0
- package/DateTimePicker/index.d.ts +2 -0
- package/DateTimePicker/index.js +2 -0
- package/Drawer/Drawer.d.ts +18 -0
- package/Drawer/Drawer.js +34 -0
- package/Drawer/index.d.ts +2 -0
- package/Drawer/index.js +1 -0
- package/Dropdown/Dropdown.d.ts +25 -0
- package/Dropdown/Dropdown.js +60 -0
- package/Dropdown/index.d.ts +1 -0
- package/Dropdown/index.js +1 -0
- package/Empty/Empty.d.ts +18 -0
- package/Empty/Empty.js +16 -0
- package/Empty/index.d.ts +1 -0
- package/Empty/index.js +1 -0
- package/Form/FormControlContext.d.ts +9 -0
- package/Form/FormControlContext.js +5 -0
- package/Form/FormField.d.ts +27 -0
- package/Form/FormField.js +24 -0
- package/Form/FormLabel.d.ts +11 -0
- package/Form/FormLabel.js +17 -0
- package/Form/FormMessage.d.ts +8 -0
- package/Form/FormMessage.js +18 -0
- package/Form/index.d.ts +5 -0
- package/Form/index.js +4 -0
- package/Form/typings.d.ts +4 -0
- package/Form/useAutoCompleteValueControl.d.ts +23 -0
- package/Form/useAutoCompleteValueControl.js +58 -0
- package/Form/useCheckboxControlValue.d.ts +11 -0
- package/Form/useCheckboxControlValue.js +29 -0
- package/Form/useControlValueState.d.ts +7 -0
- package/Form/useControlValueState.js +15 -0
- package/Form/useCustomControlValue.d.ts +5 -0
- package/Form/useCustomControlValue.js +18 -0
- package/Form/useInputControlValue.d.ts +7 -0
- package/Form/useInputControlValue.js +24 -0
- package/Form/useInputWithClearControlValue.d.ts +6 -0
- package/Form/useInputWithClearControlValue.js +33 -0
- package/Form/useRadioControlValue.d.ts +11 -0
- package/Form/useRadioControlValue.js +24 -0
- package/Form/useSelectValueControl.d.ts +16 -0
- package/Form/useSelectValueControl.js +59 -0
- package/Form/useSwitchControlValue.d.ts +7 -0
- package/Form/useSwitchControlValue.js +24 -0
- package/Icon/Icon.d.ts +24 -0
- package/Icon/Icon.js +23 -0
- package/Icon/index.d.ts +3 -0
- package/Icon/index.js +1 -0
- package/Input/Input.d.ts +50 -0
- package/Input/Input.js +28 -0
- package/Input/index.d.ts +2 -0
- package/Input/index.js +1 -0
- package/LICENSE +21 -0
- package/Loading/Loading.d.ts +34 -0
- package/Loading/Loading.js +28 -0
- package/Loading/index.d.ts +1 -0
- package/Loading/index.js +1 -0
- package/Menu/Menu.d.ts +29 -0
- package/Menu/Menu.js +22 -0
- package/Menu/MenuDivider.d.ts +8 -0
- package/Menu/MenuDivider.js +14 -0
- package/Menu/MenuItem.d.ts +24 -0
- package/Menu/MenuItem.js +26 -0
- package/Menu/MenuItemGroup.d.ts +13 -0
- package/Menu/MenuItemGroup.js +15 -0
- package/Menu/index.d.ts +5 -0
- package/Menu/index.js +4 -0
- package/Message/Message.d.ts +33 -0
- package/Message/Message.js +59 -0
- package/Message/index.d.ts +2 -0
- package/Message/index.js +1 -0
- package/Modal/Modal.d.ts +42 -0
- package/Modal/Modal.js +75 -0
- package/Modal/ModalActions.d.ts +10 -0
- package/Modal/ModalActions.js +18 -0
- package/Modal/ModalBody.d.ts +8 -0
- package/Modal/ModalBody.js +14 -0
- package/Modal/ModalControl.d.ts +7 -0
- package/Modal/ModalControl.js +8 -0
- package/Modal/ModalFooter.d.ts +8 -0
- package/Modal/ModalFooter.js +14 -0
- package/Modal/ModalHeader.d.ts +20 -0
- package/Modal/ModalHeader.js +20 -0
- package/Modal/index.d.ts +6 -0
- package/Modal/index.js +5 -0
- package/Modal/useIsTopModal.d.ts +1 -0
- package/Modal/useIsTopModal.js +22 -0
- package/Navigation/Navigation.d.ts +29 -0
- package/Navigation/Navigation.js +48 -0
- package/Navigation/NavigationContext.d.ts +6 -0
- package/Navigation/NavigationContext.js +7 -0
- package/Navigation/NavigationItem.d.ts +31 -0
- package/Navigation/NavigationItem.js +22 -0
- package/Navigation/NavigationSubMenu.d.ts +17 -0
- package/Navigation/NavigationSubMenu.js +65 -0
- package/Navigation/index.d.ts +4 -0
- package/Navigation/index.js +4 -0
- package/Notification/Notification.d.ts +54 -0
- package/Notification/Notification.js +78 -0
- package/Notification/index.d.ts +2 -0
- package/Notification/index.js +1 -0
- package/Notifier/NotifierManager.d.ts +17 -0
- package/Notifier/NotifierManager.js +31 -0
- package/Notifier/createNotifier.d.ts +21 -0
- package/Notifier/createNotifier.js +67 -0
- package/Notifier/index.d.ts +2 -0
- package/Notifier/index.js +1 -0
- package/Notifier/typings.d.ts +28 -0
- package/Overlay/Overlay.d.ts +43 -0
- package/Overlay/Overlay.js +31 -0
- package/Overlay/index.d.ts +1 -0
- package/Overlay/index.js +1 -0
- package/PageFooter/PageFooter.d.ts +15 -0
- package/PageFooter/PageFooter.js +13 -0
- package/PageFooter/index.d.ts +1 -0
- package/PageFooter/index.js +1 -0
- package/Pagination/Pagination.d.ts +78 -0
- package/Pagination/Pagination.js +29 -0
- package/Pagination/PaginationItem.d.ts +27 -0
- package/Pagination/PaginationItem.js +25 -0
- package/Pagination/PaginationJumper.d.ts +38 -0
- package/Pagination/PaginationJumper.js +52 -0
- package/Pagination/index.d.ts +5 -0
- package/Pagination/index.js +4 -0
- package/Pagination/usePagination.d.ts +16 -0
- package/Pagination/usePagination.js +78 -0
- package/Picker/PickerTrigger.d.ts +40 -0
- package/Picker/PickerTrigger.js +15 -0
- package/Picker/RangePickerTrigger.d.ts +64 -0
- package/Picker/RangePickerTrigger.js +19 -0
- package/Picker/index.d.ts +7 -0
- package/Picker/index.js +7 -0
- package/Picker/usePickerDocumentEventClose.d.ts +10 -0
- package/Picker/usePickerDocumentEventClose.js +27 -0
- package/Picker/usePickerInputValue.d.ts +12 -0
- package/Picker/usePickerInputValue.js +24 -0
- package/Picker/usePickerValue.d.ts +21 -0
- package/Picker/usePickerValue.js +58 -0
- package/Picker/useRangePickerValue.d.ts +21 -0
- package/Picker/useRangePickerValue.js +94 -0
- package/Picker/useTabKeyClose.d.ts +2 -0
- package/Picker/useTabKeyClose.js +12 -0
- package/Popconfirm/Popconfirm.d.ts +16 -0
- package/Popconfirm/Popconfirm.js +15 -0
- package/Popconfirm/index.d.ts +1 -0
- package/Popconfirm/index.js +1 -0
- package/Popover/Popover.d.ts +23 -0
- package/Popover/Popover.js +45 -0
- package/Popover/index.d.ts +1 -0
- package/Popover/index.js +1 -0
- package/Popper/Popper.d.ts +32 -0
- package/Popper/Popper.js +30 -0
- package/Popper/index.d.ts +1 -0
- package/Popper/index.js +1 -0
- package/Portal/Portal.d.ts +20 -0
- package/Portal/Portal.js +22 -0
- package/Portal/index.d.ts +1 -0
- package/Portal/index.js +1 -0
- package/Progress/Progress.d.ts +59 -0
- package/Progress/Progress.js +32 -0
- package/Progress/index.d.ts +2 -0
- package/Progress/index.js +1 -0
- package/README.md +1 -0
- package/Radio/Radio.d.ts +41 -0
- package/Radio/Radio.js +31 -0
- package/Radio/RadioGroup.d.ts +47 -0
- package/Radio/RadioGroup.js +29 -0
- package/Radio/RadioGroupContext.d.ts +9 -0
- package/Radio/RadioGroupContext.js +5 -0
- package/Radio/index.d.ts +3 -0
- package/Radio/index.js +2 -0
- package/Select/AutoComplete.d.ts +75 -0
- package/Select/AutoComplete.js +108 -0
- package/Select/Option.d.ts +19 -0
- package/Select/Option.js +32 -0
- package/Select/Select.d.ts +57 -0
- package/Select/Select.js +145 -0
- package/Select/SelectControlContext.d.ts +3 -0
- package/Select/SelectControlContext.js +5 -0
- package/Select/SelectTrigger.d.ts +54 -0
- package/Select/SelectTrigger.js +27 -0
- package/Select/TreeSelect.d.ts +68 -0
- package/Select/TreeSelect.js +198 -0
- package/Select/index.d.ts +8 -0
- package/Select/index.js +7 -0
- package/Select/typings.d.ts +11 -0
- package/Skeleton/Skeleton.d.ts +22 -0
- package/Skeleton/Skeleton.js +14 -0
- package/Skeleton/index.d.ts +1 -0
- package/Skeleton/index.js +1 -0
- package/Slider/Slider.d.ts +51 -0
- package/Slider/Slider.js +172 -0
- package/Slider/index.d.ts +3 -0
- package/Slider/index.js +2 -0
- package/Slider/useSlider.d.ts +31 -0
- package/Slider/useSlider.js +104 -0
- package/Stepper/Step.d.ts +41 -0
- package/Stepper/Step.js +19 -0
- package/Stepper/Stepper.d.ts +19 -0
- package/Stepper/Stepper.js +33 -0
- package/Stepper/index.d.ts +2 -0
- package/Stepper/index.js +2 -0
- package/Switch/Switch.d.ts +43 -0
- package/Switch/Switch.js +29 -0
- package/Switch/index.d.ts +2 -0
- package/Switch/index.js +1 -0
- package/Table/Table.d.ts +79 -0
- package/Table/Table.js +111 -0
- package/Table/TableBody.d.ts +10 -0
- package/Table/TableBody.js +31 -0
- package/Table/TableBodyRow.d.ts +11 -0
- package/Table/TableBodyRow.js +63 -0
- package/Table/TableCell.d.ts +20 -0
- package/Table/TableCell.js +23 -0
- package/Table/TableContext.d.ts +46 -0
- package/Table/TableContext.js +7 -0
- package/Table/TableHeader.d.ts +3 -0
- package/Table/TableHeader.js +47 -0
- package/Table/editable/TableEditRenderWrapper.d.ts +8 -0
- package/Table/editable/TableEditRenderWrapper.js +15 -0
- package/Table/expandable/TableExpandable.d.ts +24 -0
- package/Table/expandable/TableExpandable.js +15 -0
- package/Table/index.d.ts +4 -0
- package/Table/index.js +3 -0
- package/Table/pagination/TablePagination.d.ts +10 -0
- package/Table/pagination/TablePagination.js +27 -0
- package/Table/pagination/useTablePagination.d.ts +16 -0
- package/Table/pagination/useTablePagination.js +49 -0
- package/Table/refresh/TableRefresh.d.ts +10 -0
- package/Table/refresh/TableRefresh.js +23 -0
- package/Table/rowSelection/TableRowSelection.d.ts +19 -0
- package/Table/rowSelection/TableRowSelection.js +86 -0
- package/Table/rowSelection/useTableRowSelection.d.ts +6 -0
- package/Table/rowSelection/useTableRowSelection.js +53 -0
- package/Table/sorting/TableSortingIcon.d.ts +11 -0
- package/Table/sorting/TableSortingIcon.js +28 -0
- package/Table/sorting/useTableSorting.d.ts +10 -0
- package/Table/sorting/useTableSorting.js +90 -0
- package/Table/useTableFetchMore.d.ts +10 -0
- package/Table/useTableFetchMore.js +50 -0
- package/Table/useTableLoading.d.ts +5 -0
- package/Table/useTableLoading.js +19 -0
- package/Table/useTableScroll.d.ts +272 -0
- package/Table/useTableScroll.js +170 -0
- package/Tabs/Tab.d.ts +19 -0
- package/Tabs/Tab.js +16 -0
- package/Tabs/TabPane.d.ts +14 -0
- package/Tabs/TabPane.js +18 -0
- package/Tabs/Tabs.d.ts +39 -0
- package/Tabs/Tabs.js +49 -0
- package/Tabs/index.d.ts +3 -0
- package/Tabs/index.js +3 -0
- package/Tabs/useTabsOverflow.d.ts +8 -0
- package/Tabs/useTabsOverflow.js +58 -0
- package/Tag/Tag.d.ts +29 -0
- package/Tag/Tag.js +23 -0
- package/Tag/index.d.ts +2 -0
- package/Tag/index.js +1 -0
- package/TextField/TextField.d.ts +54 -0
- package/TextField/TextField.js +39 -0
- package/TextField/index.d.ts +2 -0
- package/TextField/index.js +1 -0
- package/TextField/useTextFieldControl.d.ts +10 -0
- package/TextField/useTextFieldControl.js +15 -0
- package/Textarea/Textarea.d.ts +58 -0
- package/Textarea/Textarea.js +33 -0
- package/Textarea/index.d.ts +2 -0
- package/Textarea/index.js +1 -0
- package/TimePanel/TimePanel.d.ts +66 -0
- package/TimePanel/TimePanel.js +67 -0
- package/TimePanel/TimePanelAction.d.ts +18 -0
- package/TimePanel/TimePanelAction.js +15 -0
- package/TimePanel/TimePanelColumn.d.ts +37 -0
- package/TimePanel/TimePanelColumn.js +39 -0
- package/TimePanel/index.d.ts +3 -0
- package/TimePanel/index.js +3 -0
- package/TimePicker/TimePicker.d.ts +24 -0
- package/TimePicker/TimePicker.js +114 -0
- package/TimePicker/TimePickerPanel.d.ts +24 -0
- package/TimePicker/TimePickerPanel.js +14 -0
- package/TimePicker/index.d.ts +2 -0
- package/TimePicker/index.js +2 -0
- package/Tooltip/Tooltip.d.ts +25 -0
- package/Tooltip/Tooltip.js +37 -0
- package/Tooltip/index.d.ts +1 -0
- package/Tooltip/index.js +1 -0
- package/Tooltip/useDelayMouseEnterLeave.d.ts +12 -0
- package/Tooltip/useDelayMouseEnterLeave.js +41 -0
- package/Transition/Collapse.d.ts +15 -0
- package/Transition/Collapse.js +107 -0
- package/Transition/Fade.d.ts +8 -0
- package/Transition/Fade.js +84 -0
- package/Transition/Grow.d.ts +13 -0
- package/Transition/Grow.js +112 -0
- package/Transition/SlideFade.d.ts +15 -0
- package/Transition/SlideFade.js +93 -0
- package/Transition/Transition.d.ts +98 -0
- package/Transition/Transition.js +27 -0
- package/Transition/Zoom.d.ts +8 -0
- package/Transition/Zoom.js +84 -0
- package/Transition/getAutoSizeDuration.d.ts +1 -0
- package/Transition/getAutoSizeDuration.js +10 -0
- package/Transition/getTransitionStyleProps.d.ts +16 -0
- package/Transition/getTransitionStyleProps.js +25 -0
- package/Transition/index.d.ts +6 -0
- package/Transition/index.js +6 -0
- package/Transition/reflow.d.ts +4 -0
- package/Transition/reflow.js +9 -0
- package/Transition/useAutoTransitionDuration.d.ts +6 -0
- package/Transition/useAutoTransitionDuration.js +15 -0
- package/Transition/useSetNodeTransition.d.ts +7 -0
- package/Transition/useSetNodeTransition.js +35 -0
- package/Tree/Tree.d.ts +70 -0
- package/Tree/Tree.js +131 -0
- package/Tree/TreeNode.d.ts +41 -0
- package/Tree/TreeNode.js +41 -0
- package/Tree/TreeNodeList.d.ts +25 -0
- package/Tree/TreeNodeList.js +29 -0
- package/Tree/getTreeNodeEntities.d.ts +11 -0
- package/Tree/getTreeNodeEntities.js +86 -0
- package/Tree/index.d.ts +8 -0
- package/Tree/index.js +7 -0
- package/Tree/toggleValue.d.ts +4 -0
- package/Tree/toggleValue.js +19 -0
- package/Tree/traverseTree.d.ts +2 -0
- package/Tree/traverseTree.js +11 -0
- package/Tree/typings.d.ts +16 -0
- package/Tree/useTreeExpandedValue.d.ts +15 -0
- package/Tree/useTreeExpandedValue.js +32 -0
- package/Typography/Typography.d.ts +43 -0
- package/Typography/Typography.js +38 -0
- package/Typography/index.d.ts +11 -0
- package/Typography/index.js +2 -0
- package/Upload/UploadButton.d.ts +10 -0
- package/Upload/UploadButton.js +23 -0
- package/Upload/UploadInput.d.ts +21 -0
- package/Upload/UploadInput.js +22 -0
- package/Upload/UploadResult.d.ts +16 -0
- package/Upload/UploadResult.js +30 -0
- package/Upload/index.d.ts +3 -0
- package/Upload/index.js +2 -0
- package/_internal/InputCheck/InputCheck.d.ts +33 -0
- package/_internal/InputCheck/InputCheck.js +19 -0
- package/_internal/InputCheck/InputCheckGroup.d.ts +18 -0
- package/_internal/InputCheck/InputCheckGroup.js +14 -0
- package/_internal/InputCheck/index.d.ts +3 -0
- package/_internal/InputCheck/index.js +2 -0
- package/_internal/InputTriggerPopper/InputTriggerPopper.d.ts +18 -0
- package/_internal/InputTriggerPopper/InputTriggerPopper.js +44 -0
- package/_internal/InputTriggerPopper/index.d.ts +1 -0
- package/_internal/InputTriggerPopper/index.js +1 -0
- package/hooks/useClickAway.d.ts +5 -0
- package/hooks/useClickAway.js +23 -0
- package/hooks/useComposeRefs.d.ts +2 -0
- package/hooks/useComposeRefs.js +8 -0
- package/hooks/useDocumentEscapeKeyDown.d.ts +3 -0
- package/hooks/useDocumentEscapeKeyDown.js +20 -0
- package/hooks/useDocumentEvents.d.ts +5 -0
- package/hooks/useDocumentEvents.js +21 -0
- package/hooks/useDocumentTabKeyDown.d.ts +3 -0
- package/hooks/useDocumentTabKeyDown.js +19 -0
- package/hooks/useIsomorphicLayoutEffect.d.ts +2 -0
- package/hooks/useIsomorphicLayoutEffect.js +7 -0
- package/hooks/useLastCallback.d.ts +1 -0
- package/hooks/useLastCallback.js +11 -0
- package/hooks/useLastValue.d.ts +3 -0
- package/hooks/useLastValue.js +9 -0
- package/hooks/usePreviousValue.d.ts +1 -0
- package/hooks/usePreviousValue.js +11 -0
- package/hooks/useWindowWidth.d.ts +1 -0
- package/hooks/useWindowWidth.js +15 -0
- package/index.d.ts +100 -0
- package/index.js +148 -0
- package/package.json +61 -0
- package/utils/composeRefs.d.ts +21 -0
- package/utils/composeRefs.js +32 -0
- package/utils/cx.d.ts +1 -0
- package/utils/getElement.d.ts +3 -0
- package/utils/getElement.js +14 -0
- package/utils/jsx-types.d.ts +11 -0
- package/utils/rename-types.d.ts +5 -0
- package/utils/scroll-lock.d.ts +2 -0
- package/utils/scroll-lock.js +18 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, Children, useMemo } from 'react';
|
|
3
|
+
import { checkboxClasses } from '@mezzanine-ui/core/checkbox';
|
|
4
|
+
import Checkbox from './Checkbox.js';
|
|
5
|
+
import cx from 'clsx';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The react component for `mezzanine` check all.
|
|
9
|
+
* Only support controlled.
|
|
10
|
+
*/
|
|
11
|
+
const CheckAll = forwardRef(function CheckAll(props, ref) {
|
|
12
|
+
const { children, className, label, ...rest } = props;
|
|
13
|
+
const checkboxGroup = children && Children.only(children);
|
|
14
|
+
const { disabled, name, onChange, options, size, value, } = (checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.props) || {};
|
|
15
|
+
const enabledOptions = useMemo(() => options === null || options === void 0 ? void 0 : options.filter((option) => !option.disabled), [options]);
|
|
16
|
+
let allChecked = false;
|
|
17
|
+
let indeterminate = false;
|
|
18
|
+
if (enabledOptions && value) {
|
|
19
|
+
allChecked = enabledOptions.length === value.length;
|
|
20
|
+
indeterminate = enabledOptions.length > value.length && value.length > 0;
|
|
21
|
+
}
|
|
22
|
+
return (jsxs("div", Object.assign({}, rest, { ref: ref, className: cx(checkboxClasses.all, className) }, { children: [jsx("div", { children: jsx(Checkbox, Object.assign({ checked: allChecked, disabled: disabled, indeterminate: indeterminate, inputProps: {
|
|
23
|
+
name,
|
|
24
|
+
}, onChange: (event) => {
|
|
25
|
+
if (onChange) {
|
|
26
|
+
if (!event.target.checked) {
|
|
27
|
+
onChange([], event);
|
|
28
|
+
}
|
|
29
|
+
else if (enabledOptions) {
|
|
30
|
+
onChange(enabledOptions.map((option) => option.value), event);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, size: size }, { children: label }), void 0) }, void 0), children] }), void 0));
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export default CheckAll;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ChangeEventHandler } from 'react';
|
|
2
|
+
import { CheckboxSize } from '@mezzanine-ui/core/checkbox';
|
|
3
|
+
import { InputCheckProps } from '../_internal/InputCheck';
|
|
4
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
5
|
+
export interface CheckboxProps extends Omit<InputCheckProps, 'control' | 'htmlFor'> {
|
|
6
|
+
/**
|
|
7
|
+
* Whether the checkbox is checked.
|
|
8
|
+
*/
|
|
9
|
+
checked?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the checkbox is checked by default.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
defaultChecked?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* If true, it means its children checkboxes have at least one unchecked.
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
indeterminate?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Since at Mezzanine we use a host element to wrap our input, most derived props will be passed to the host element.
|
|
22
|
+
* If you need direct control to the input element, use this prop to provide to it.
|
|
23
|
+
*
|
|
24
|
+
* Noticed that if you pass in an id within this prop,
|
|
25
|
+
* the rendered label element will have `htmlFor` sync with passed in id.
|
|
26
|
+
*/
|
|
27
|
+
inputProps?: Omit<NativeElementPropsWithoutKeyAndRef<'input'>, 'checked' | 'defaultChecked' | 'disabled' | 'onChange' | 'placeholder' | 'readOnly' | 'required' | 'type' | 'value' | `aria-${'disabled' | 'checked'}`>;
|
|
28
|
+
/**
|
|
29
|
+
* The change event handler of input in checkbox.
|
|
30
|
+
*/
|
|
31
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
32
|
+
/**
|
|
33
|
+
* The size of checkbox.
|
|
34
|
+
* @default 'medium'
|
|
35
|
+
*/
|
|
36
|
+
size?: CheckboxSize;
|
|
37
|
+
/**
|
|
38
|
+
* The value of input in checkbox.
|
|
39
|
+
*/
|
|
40
|
+
value?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The react component for `mezzanine` checkbox.
|
|
44
|
+
*/
|
|
45
|
+
declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HTMLLabelElement>>;
|
|
46
|
+
export default Checkbox;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext } from 'react';
|
|
3
|
+
import { checkboxClasses } from '@mezzanine-ui/core/checkbox';
|
|
4
|
+
import { useCheckboxControlValue } from '../Form/useCheckboxControlValue.js';
|
|
5
|
+
import { CheckboxGroupContext } from './CheckboxGroupContext.js';
|
|
6
|
+
import { FormControlContext } from '../Form/FormControlContext.js';
|
|
7
|
+
import InputCheck from '../_internal/InputCheck/InputCheck.js';
|
|
8
|
+
import cx from 'clsx';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The react component for `mezzanine` checkbox.
|
|
12
|
+
*/
|
|
13
|
+
const Checkbox = forwardRef(function Checkbox(props, ref) {
|
|
14
|
+
const { disabled: disabledFromFormControl, severity, } = useContext(FormControlContext) || {};
|
|
15
|
+
const checkboxGroup = useContext(CheckboxGroupContext);
|
|
16
|
+
const { disabled: disabledFromGroup, name: nameFromGroup, size: sizeFromGroup, } = checkboxGroup || {};
|
|
17
|
+
const { checked: checkedProp, children, defaultChecked, disabled = (disabledFromGroup !== null && disabledFromGroup !== void 0 ? disabledFromGroup : disabledFromFormControl) || false, error = severity === 'error' || false, indeterminate: indeterminateProp = false, onChange: onChangeProp, size = sizeFromGroup || 'medium', value, inputProps, ...rest } = props;
|
|
18
|
+
const { id: inputId, name = nameFromGroup, ...restInputProps } = inputProps || {};
|
|
19
|
+
const [checked, onChange] = useCheckboxControlValue({
|
|
20
|
+
checkboxGroup,
|
|
21
|
+
checked: checkedProp,
|
|
22
|
+
defaultChecked,
|
|
23
|
+
onChange: onChangeProp,
|
|
24
|
+
value,
|
|
25
|
+
});
|
|
26
|
+
const indeterminate = !checked && indeterminateProp;
|
|
27
|
+
return (jsx(InputCheck, Object.assign({}, rest, { ref: ref, control: (jsx("span", Object.assign({ className: cx(checkboxClasses.host, {
|
|
28
|
+
[checkboxClasses.checked]: checked,
|
|
29
|
+
[checkboxClasses.indeterminate]: indeterminate,
|
|
30
|
+
}) }, { children: jsx("input", Object.assign({}, restInputProps, { "aria-checked": indeterminate ? 'mixed' : checked, "aria-disabled": disabled, checked: checked, disabled: disabled, id: inputId, onChange: onChange, name: name, type: "checkbox", value: value }), void 0) }), void 0)), disabled: disabled, error: error, htmlFor: inputId, size: size }, { children: children }), void 0));
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export default Checkbox;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CheckboxGroupOption, CheckboxSize } from '@mezzanine-ui/core/checkbox';
|
|
2
|
+
import { ChangeEvent, ReactNode } from 'react';
|
|
3
|
+
import { InputCheckGroupProps } from '../_internal/InputCheck';
|
|
4
|
+
export interface CheckboxGroupProps extends Omit<InputCheckGroupProps, 'defaultValue' | 'onChange'> {
|
|
5
|
+
/**
|
|
6
|
+
* The checkboxes in radio group.
|
|
7
|
+
*/
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* The default value of checkbox group.
|
|
11
|
+
*/
|
|
12
|
+
defaultValue?: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Whether the checkbox group is disabled.
|
|
15
|
+
* Control the disabled of checkboxes in group if disabled not passed to checkbox.
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The name of checkbox group.
|
|
20
|
+
* Control the name of checkboxes in group if name not passed to checkbox.
|
|
21
|
+
*/
|
|
22
|
+
name?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The onChange of checkbox group.
|
|
25
|
+
* Will be passed to each checkboxes but composing both instead of overriding.
|
|
26
|
+
*/
|
|
27
|
+
onChange?: (value: string[], event: ChangeEvent<HTMLInputElement>) => void;
|
|
28
|
+
/**
|
|
29
|
+
* The options of checkbox group.
|
|
30
|
+
* Will be ignored if children passed.
|
|
31
|
+
*/
|
|
32
|
+
options?: CheckboxGroupOption[];
|
|
33
|
+
/**
|
|
34
|
+
* The size of checkbox group.
|
|
35
|
+
* Control the size of checkboxes in group if size not passed to checkbox.
|
|
36
|
+
*/
|
|
37
|
+
size?: CheckboxSize;
|
|
38
|
+
/**
|
|
39
|
+
* The value of checkbox group.
|
|
40
|
+
*/
|
|
41
|
+
value?: string[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The react component for `mezzanine` checkbox group.
|
|
45
|
+
*/
|
|
46
|
+
declare const CheckboxGroup: import("react").ForwardRefExoticComponent<CheckboxGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
47
|
+
export default CheckboxGroup;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, createElement } from 'react';
|
|
3
|
+
import { useControlValueState } from '../Form/useControlValueState.js';
|
|
4
|
+
import { CheckboxGroupContext } from './CheckboxGroupContext.js';
|
|
5
|
+
import Checkbox from './Checkbox.js';
|
|
6
|
+
import InputCheckGroup from '../_internal/InputCheck/InputCheckGroup.js';
|
|
7
|
+
|
|
8
|
+
const renderOption = ({ label: children, ...option }) => (createElement(Checkbox, Object.assign({}, option, { key: option.value }), children));
|
|
9
|
+
/**
|
|
10
|
+
* The react component for `mezzanine` checkbox group.
|
|
11
|
+
*/
|
|
12
|
+
const CheckboxGroup = forwardRef(function CheckboxGroup(props, ref) {
|
|
13
|
+
const { children: childrenProp, defaultValue = [], disabled, name, options = [], onChange, size, value: valueProp, ...rest } = props;
|
|
14
|
+
const [value, setValue] = useControlValueState({
|
|
15
|
+
defaultValue,
|
|
16
|
+
value: valueProp,
|
|
17
|
+
});
|
|
18
|
+
const context = {
|
|
19
|
+
disabled,
|
|
20
|
+
name,
|
|
21
|
+
onChange(event) {
|
|
22
|
+
const { checked, value: targetValue } = event.target;
|
|
23
|
+
const newValue = checked ? [...value, targetValue] : value.filter((v) => v !== targetValue);
|
|
24
|
+
setValue(newValue);
|
|
25
|
+
if (onChange) {
|
|
26
|
+
onChange(newValue, event);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
size,
|
|
30
|
+
value,
|
|
31
|
+
};
|
|
32
|
+
const children = childrenProp || options.map(renderOption);
|
|
33
|
+
return (jsx(CheckboxGroupContext.Provider, Object.assign({ value: context }, { children: jsx(InputCheckGroup, Object.assign({}, rest, { ref: ref }, { children: children }), void 0) }), void 0));
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export default CheckboxGroup;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CheckboxSize } from '@mezzanine-ui/core/checkbox';
|
|
3
|
+
import { CheckboxGroupControlContextValue } from '../Form/useCheckboxControlValue';
|
|
4
|
+
export interface CheckboxGroupContextValue extends CheckboxGroupControlContextValue {
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
name?: string;
|
|
7
|
+
size?: CheckboxSize;
|
|
8
|
+
}
|
|
9
|
+
export declare const CheckboxGroupContext: import("react").Context<CheckboxGroupContextValue | undefined>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { CheckboxSize, CheckboxGroupOrientation, CheckboxGroupOption, } from '@mezzanine-ui/core/checkbox';
|
|
2
|
+
export { CheckboxProps, default, } from './Checkbox';
|
|
3
|
+
export { CheckboxGroupProps, default as CheckboxGroup, } from './CheckboxGroup';
|
|
4
|
+
export { CheckAllProps, default as CheckAll, } from './CheckAll';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ButtonGroupProps, ButtonProps } from '../Button';
|
|
3
|
+
export interface ConfirmActionsProps extends Omit<ButtonGroupProps, 'children'> {
|
|
4
|
+
/**
|
|
5
|
+
* Other props of cancel button.
|
|
6
|
+
*/
|
|
7
|
+
cancelButtonProps?: ButtonProps;
|
|
8
|
+
/**
|
|
9
|
+
* Content of cancel button.
|
|
10
|
+
*/
|
|
11
|
+
cancelText?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Other props of confirm button.
|
|
14
|
+
*/
|
|
15
|
+
confirmButtonProps?: ButtonProps;
|
|
16
|
+
/**
|
|
17
|
+
* Content of confirm button.
|
|
18
|
+
*/
|
|
19
|
+
confirmText?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to hide cancel button.
|
|
22
|
+
*/
|
|
23
|
+
hideCancelButton?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether to hide confirm button.
|
|
26
|
+
*/
|
|
27
|
+
hideConfirmButton?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Indicate whether confirm button loading and cancel button disabled.
|
|
30
|
+
*/
|
|
31
|
+
loading?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Click handler for cancel button.
|
|
34
|
+
*/
|
|
35
|
+
onCancel?: ButtonProps['onClick'];
|
|
36
|
+
/**
|
|
37
|
+
* Click handler for confirm button.
|
|
38
|
+
*/
|
|
39
|
+
onConfirm?: ButtonProps['onClick'];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The react component for `mezzanine` confirm actions.
|
|
43
|
+
*/
|
|
44
|
+
declare const ConfirmActions: import("react").ForwardRefExoticComponent<ConfirmActionsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
45
|
+
export default ConfirmActions;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import Button from '../Button/Button.js';
|
|
4
|
+
import ButtonGroup from '../Button/ButtonGroup.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The react component for `mezzanine` confirm actions.
|
|
8
|
+
*/
|
|
9
|
+
const ConfirmActions = forwardRef(function ConfirmActions(props, ref) {
|
|
10
|
+
const { cancelButtonProps, cancelText, confirmButtonProps, confirmText, hideCancelButton, hideConfirmButton, loading, onCancel, onConfirm, ...rest } = props;
|
|
11
|
+
const { disabled: cancelButtonDisabled = loading, } = cancelButtonProps || {};
|
|
12
|
+
return (jsxs(ButtonGroup, Object.assign({}, rest, { ref: ref }, { children: [!hideCancelButton && (jsx(Button, Object.assign({ variant: "outlined" }, cancelButtonProps, { disabled: cancelButtonDisabled, onClick: onCancel }, { children: cancelText }), void 0)),
|
|
13
|
+
!hideConfirmButton && (jsx(Button, Object.assign({ variant: "contained" }, confirmButtonProps, { loading: loading, onClick: onConfirm }, { children: confirmText }), void 0))] }), void 0));
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export default ConfirmActions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ConfirmActionsProps, default, } from './ConfirmActions';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ConfirmActions.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DateType } from '@mezzanine-ui/core/calendar';
|
|
3
|
+
import { DatePickerCalendarProps } from './DatePickerCalendar';
|
|
4
|
+
import { PickerTriggerProps } from '../Picker';
|
|
5
|
+
export interface DatePickerProps extends Omit<DatePickerCalendarProps, 'anchor' | 'calendarRef' | 'onChange' | 'open' | 'referenceDate' | 'updateReferenceDate'>, Omit<PickerTriggerProps, 'defaultValue' | 'inputRef' | 'onChange' | 'onClear' | 'onClick' | 'onIconClick' | 'onKeyDown' | 'suffixActionIcon' | 'value'> {
|
|
6
|
+
/**
|
|
7
|
+
* Default value for date picker.
|
|
8
|
+
*/
|
|
9
|
+
defaultValue?: DateType;
|
|
10
|
+
/**
|
|
11
|
+
* The format for displaying date.
|
|
12
|
+
*/
|
|
13
|
+
format?: string;
|
|
14
|
+
/**
|
|
15
|
+
* A function that fires when calendar toggle. Receive open status in boolean format as props.
|
|
16
|
+
*/
|
|
17
|
+
onCalendarToggle?: (open: boolean) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Change handler. Takes your declared `DateType` as argument.
|
|
20
|
+
*/
|
|
21
|
+
onChange?: (target?: DateType) => void;
|
|
22
|
+
/**
|
|
23
|
+
* The reference date for getting calendars. Default to current time.
|
|
24
|
+
*/
|
|
25
|
+
referenceDate?: DateType;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The react component for `mezzanine` date picker.
|
|
29
|
+
* Notice that any component related to date-picker should be used along with `CalendarContext`. <br />
|
|
30
|
+
*/
|
|
31
|
+
declare const DatePicker: import("react").ForwardRefExoticComponent<DatePickerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
32
|
+
export default DatePicker;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext, useMemo, useState, useCallback, useRef, useEffect } from 'react';
|
|
3
|
+
import { getDefaultModeFormat } from '@mezzanine-ui/core/calendar';
|
|
4
|
+
import { CalendarIcon } from '@mezzanine-ui/icons';
|
|
5
|
+
import DatePickerCalendar from './DatePickerCalendar.js';
|
|
6
|
+
import { useComposeRefs } from '../hooks/useComposeRefs.js';
|
|
7
|
+
import { FormControlContext } from '../Form/FormControlContext.js';
|
|
8
|
+
import { useCalendarContext } from '../Calendar/CalendarContext.js';
|
|
9
|
+
import { usePickerValue } from '../Picker/usePickerValue.js';
|
|
10
|
+
import { usePickerDocumentEventClose } from '../Picker/usePickerDocumentEventClose.js';
|
|
11
|
+
import Icon from '../Icon/Icon.js';
|
|
12
|
+
import PickerTrigger from '../Picker/PickerTrigger.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The react component for `mezzanine` date picker.
|
|
16
|
+
* Notice that any component related to date-picker should be used along with `CalendarContext`. <br />
|
|
17
|
+
*/
|
|
18
|
+
const DatePicker = forwardRef(function DatePicker(props, ref) {
|
|
19
|
+
const { disabled: disabledFromFormControl, fullWidth: fullWidthFromFormControl, required: requiredFromFormControl, severity, } = useContext(FormControlContext) || {};
|
|
20
|
+
const { defaultDateFormat, getNow, } = useCalendarContext();
|
|
21
|
+
const { calendarProps, className, clearable, defaultValue, disableOnNext, disableOnPrev, disabled = disabledFromFormControl || false, displayMonthLocale, error = severity === 'error' || false, fadeProps, format = defaultDateFormat, fullWidth = fullWidthFromFormControl || false, inputProps, isDateDisabled, isMonthDisabled, isYearDisabled, mode = 'day', onCalendarToggle: onCalendarToggleProp, onChange: onChangeProp, placeholder, popperProps, prefix, readOnly, referenceDate: referenceDateProp, required = requiredFromFormControl || false, size, value: valueProp, ...restTriggerProps } = props;
|
|
22
|
+
const { onBlur: onBlurProp, onKeyDown: onKeyDownProp, onFocus: onFocusProp, size: inputSize = format.length + 2, ...restInputProp } = inputProps || {};
|
|
23
|
+
const formats = useMemo(() => [
|
|
24
|
+
format,
|
|
25
|
+
defaultDateFormat,
|
|
26
|
+
getDefaultModeFormat(mode),
|
|
27
|
+
], [defaultDateFormat, format, mode]);
|
|
28
|
+
/** Calender display control */
|
|
29
|
+
const [open, setOpen] = useState(false);
|
|
30
|
+
const preventOpen = readOnly;
|
|
31
|
+
const onCalendarToggle = useCallback((currentOpen) => {
|
|
32
|
+
if (!preventOpen) {
|
|
33
|
+
if (onCalendarToggleProp) {
|
|
34
|
+
onCalendarToggleProp(currentOpen);
|
|
35
|
+
}
|
|
36
|
+
setOpen(currentOpen);
|
|
37
|
+
}
|
|
38
|
+
}, [onCalendarToggleProp, preventOpen]);
|
|
39
|
+
const onFocus = useMemo(() => {
|
|
40
|
+
if (readOnly) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
return (event) => {
|
|
44
|
+
if (onFocusProp) {
|
|
45
|
+
onFocusProp(event);
|
|
46
|
+
}
|
|
47
|
+
onCalendarToggle(true);
|
|
48
|
+
};
|
|
49
|
+
}, [onCalendarToggle, onFocusProp, readOnly]);
|
|
50
|
+
/** Value and change handlers */
|
|
51
|
+
const inputRef = useRef(null);
|
|
52
|
+
const { inputValue, onBlur, onChange, onInputChange, onKeyDown, value: internalValue, } = usePickerValue({
|
|
53
|
+
defaultValue,
|
|
54
|
+
format,
|
|
55
|
+
formats,
|
|
56
|
+
inputRef,
|
|
57
|
+
value: valueProp,
|
|
58
|
+
});
|
|
59
|
+
/** Bind close control to handlers */
|
|
60
|
+
const onCalendarChange = (val) => {
|
|
61
|
+
onChange(val);
|
|
62
|
+
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(val);
|
|
63
|
+
onCalendarToggle(false);
|
|
64
|
+
};
|
|
65
|
+
const onKeyDownWithCloseControl = useCallback((event) => {
|
|
66
|
+
onKeyDown(event);
|
|
67
|
+
if (onKeyDownProp) {
|
|
68
|
+
onKeyDownProp(event);
|
|
69
|
+
}
|
|
70
|
+
if (event.key === 'Enter') {
|
|
71
|
+
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(internalValue);
|
|
72
|
+
onCalendarToggle(false);
|
|
73
|
+
}
|
|
74
|
+
}, [internalValue, onCalendarToggle, onChangeProp, onKeyDown, onKeyDownProp]);
|
|
75
|
+
/** using internal reference date */
|
|
76
|
+
const [referenceDate, setReferenceDate] = useState(referenceDateProp || defaultValue || getNow());
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (internalValue) {
|
|
79
|
+
setReferenceDate(internalValue);
|
|
80
|
+
}
|
|
81
|
+
}, [internalValue]);
|
|
82
|
+
/** Resolve input props */
|
|
83
|
+
const onResolvedBlur = useCallback((event) => {
|
|
84
|
+
if (onBlurProp) {
|
|
85
|
+
onBlurProp(event);
|
|
86
|
+
}
|
|
87
|
+
onBlur(event);
|
|
88
|
+
}, [onBlur, onBlurProp]);
|
|
89
|
+
const resolvedInputProps = {
|
|
90
|
+
...restInputProp,
|
|
91
|
+
size: inputSize,
|
|
92
|
+
onFocus,
|
|
93
|
+
onKeyDown: onKeyDownWithCloseControl,
|
|
94
|
+
onBlur: onResolvedBlur,
|
|
95
|
+
};
|
|
96
|
+
/** Popper positioning */
|
|
97
|
+
const anchorRef = useRef(null);
|
|
98
|
+
const triggerComposedRef = useComposeRefs([ref, anchorRef]);
|
|
99
|
+
const calendarRef = useRef(null);
|
|
100
|
+
/** Clear handler */
|
|
101
|
+
const onClear = useCallback(() => {
|
|
102
|
+
onChange(undefined);
|
|
103
|
+
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(undefined);
|
|
104
|
+
}, [onChange, onChangeProp]);
|
|
105
|
+
/** Blur, click away and key down close */
|
|
106
|
+
const onClose = () => {
|
|
107
|
+
onChange(valueProp);
|
|
108
|
+
onCalendarToggle(false);
|
|
109
|
+
};
|
|
110
|
+
const onChangeClose = () => {
|
|
111
|
+
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(internalValue);
|
|
112
|
+
onCalendarToggle(false);
|
|
113
|
+
};
|
|
114
|
+
usePickerDocumentEventClose({
|
|
115
|
+
open,
|
|
116
|
+
anchorRef,
|
|
117
|
+
popperRef: calendarRef,
|
|
118
|
+
lastElementRefInFlow: inputRef,
|
|
119
|
+
onClose,
|
|
120
|
+
onChangeClose,
|
|
121
|
+
});
|
|
122
|
+
/** Icon */
|
|
123
|
+
const onIconClick = (e) => {
|
|
124
|
+
e.stopPropagation();
|
|
125
|
+
if (open) {
|
|
126
|
+
onChange(valueProp);
|
|
127
|
+
}
|
|
128
|
+
onCalendarToggle(!open);
|
|
129
|
+
};
|
|
130
|
+
const suffixActionIcon = (jsx(Icon, { icon: CalendarIcon, onClick: onIconClick }, void 0));
|
|
131
|
+
return (jsxs(Fragment, { children: [jsx(PickerTrigger, Object.assign({}, restTriggerProps, { ref: triggerComposedRef, className: className, clearable: clearable, disabled: disabled, error: error, fullWidth: fullWidth, inputProps: resolvedInputProps, inputRef: inputRef, onChange: onInputChange, onClear: onClear, placeholder: placeholder, prefix: prefix, readOnly: readOnly, required: required, size: size, suffixActionIcon: suffixActionIcon, value: inputValue }), void 0),
|
|
132
|
+
jsx(DatePickerCalendar, { ref: calendarRef, anchor: anchorRef, calendarProps: calendarProps, disableOnNext: disableOnNext, disableOnPrev: disableOnPrev, displayMonthLocale: displayMonthLocale, fadeProps: fadeProps, isDateDisabled: isDateDisabled, isMonthDisabled: isMonthDisabled, isYearDisabled: isYearDisabled, mode: mode, onChange: onCalendarChange, open: open, popperProps: popperProps, referenceDate: referenceDate, value: internalValue }, void 0)] }, void 0));
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
export default DatePicker;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CalendarMode, DateType } from '@mezzanine-ui/core/calendar';
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
|
+
import { CalendarProps } from '../Calendar';
|
|
4
|
+
import { InputTriggerPopperProps } from '../_internal/InputTriggerPopper';
|
|
5
|
+
export interface DatePickerCalendarProps extends Pick<InputTriggerPopperProps, 'anchor' | 'fadeProps' | 'open'>, Pick<CalendarProps, 'disableOnNext' | 'disableOnPrev' | 'displayMonthLocale' | 'isDateDisabled' | 'isMonthDisabled' | 'isYearDisabled' | 'onChange' | 'referenceDate'> {
|
|
6
|
+
/**
|
|
7
|
+
* Other calendar props you may provide to `Calendar`.
|
|
8
|
+
*/
|
|
9
|
+
calendarProps?: Omit<CalendarProps, 'disableOnNext' | 'disableOnPrev' | 'displayMonthLocale' | 'isDateDisabled' | 'isMonthDisabled' | 'isYearDisabled' | 'locale' | 'mode' | 'onChange' | 'onMonthControlClick' | 'onNext' | 'onPrev' | 'onYearControlClick' | 'referenceDate' | 'updateReferenceDate' | 'value'>;
|
|
10
|
+
/**
|
|
11
|
+
* React ref for calendar component.
|
|
12
|
+
*/
|
|
13
|
+
calendarRef?: RefObject<HTMLDivElement>;
|
|
14
|
+
/**
|
|
15
|
+
* The desired mode of calendar.<br />
|
|
16
|
+
* The `onChange` function will only fired if the calendar mode meets this prop.
|
|
17
|
+
*/
|
|
18
|
+
mode?: CalendarMode;
|
|
19
|
+
/**
|
|
20
|
+
* Other props you may provide to `Popper` component
|
|
21
|
+
*/
|
|
22
|
+
popperProps?: Omit<InputTriggerPopperProps, 'anchor' | 'children' | 'fadeProps' | 'open'>;
|
|
23
|
+
/**
|
|
24
|
+
* The calendar cell will be marked as active if it matches the same date of given value.
|
|
25
|
+
*/
|
|
26
|
+
value?: DateType;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The react component for `mezzanine` date picker calendar.
|
|
30
|
+
*/
|
|
31
|
+
declare const DatePickerCalendar: import("react").ForwardRefExoticComponent<DatePickerCalendarProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
32
|
+
export default DatePickerCalendar;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useMemo } from 'react';
|
|
3
|
+
import { useCalendarContext } from '../Calendar/CalendarContext.js';
|
|
4
|
+
import { useCalendarControls } from '../Calendar/useCalendarControls.js';
|
|
5
|
+
import InputTriggerPopper from '../_internal/InputTriggerPopper/InputTriggerPopper.js';
|
|
6
|
+
import Calendar from '../Calendar/Calendar.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The react component for `mezzanine` date picker calendar.
|
|
10
|
+
*/
|
|
11
|
+
const DatePickerCalendar = forwardRef(function DatePickerCalendar(props, ref) {
|
|
12
|
+
const { displayMonthLocale: displayMonthLocaleFromConfig, getMonth, getYear, setMonth, setYear, } = useCalendarContext();
|
|
13
|
+
const { anchor, calendarProps, calendarRef, disableOnNext, disableOnPrev, displayMonthLocale = displayMonthLocaleFromConfig, fadeProps, isDateDisabled, isMonthDisabled, isYearDisabled, mode = 'day', onChange: onChangeProp, open, popperProps, referenceDate: referenceDateProp, value, } = props;
|
|
14
|
+
const { className: calendarClassName, ...restCalendarProps } = calendarProps || {};
|
|
15
|
+
const { currentMode, onMonthControlClick, onNext, onPrev, onYearControlClick, popModeStack, referenceDate, updateReferenceDate, } = useCalendarControls(referenceDateProp, mode);
|
|
16
|
+
const onChange = useMemo(() => {
|
|
17
|
+
if (currentMode === 'day' || currentMode === 'week') {
|
|
18
|
+
return (target) => {
|
|
19
|
+
updateReferenceDate(target);
|
|
20
|
+
popModeStack();
|
|
21
|
+
if (onChangeProp) {
|
|
22
|
+
onChangeProp(target);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
if (currentMode === 'month') {
|
|
27
|
+
return (target) => {
|
|
28
|
+
const result = currentMode === mode ? target : setMonth(referenceDate, getMonth(target));
|
|
29
|
+
updateReferenceDate(result);
|
|
30
|
+
popModeStack();
|
|
31
|
+
if (currentMode === mode && onChangeProp) {
|
|
32
|
+
onChangeProp(result);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (currentMode === 'year') {
|
|
37
|
+
return (target) => {
|
|
38
|
+
const result = currentMode === mode ? target : setYear(referenceDate, getYear(target));
|
|
39
|
+
updateReferenceDate(result);
|
|
40
|
+
popModeStack();
|
|
41
|
+
if (currentMode === mode && onChangeProp) {
|
|
42
|
+
onChangeProp(result);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}, [
|
|
47
|
+
currentMode,
|
|
48
|
+
referenceDate,
|
|
49
|
+
updateReferenceDate,
|
|
50
|
+
popModeStack,
|
|
51
|
+
mode,
|
|
52
|
+
onChangeProp,
|
|
53
|
+
setMonth,
|
|
54
|
+
getMonth,
|
|
55
|
+
setYear,
|
|
56
|
+
getYear,
|
|
57
|
+
]);
|
|
58
|
+
return (jsx(InputTriggerPopper, Object.assign({}, popperProps, { ref: ref, anchor: anchor, open: open, fadeProps: fadeProps }, { children: jsx(Calendar, Object.assign({}, restCalendarProps, { ref: calendarRef, className: calendarClassName, disableOnNext: disableOnNext, disableOnPrev: disableOnPrev, displayMonthLocale: displayMonthLocale, isDateDisabled: isDateDisabled, isMonthDisabled: isMonthDisabled, isYearDisabled: isYearDisabled, mode: currentMode, onChange: onChange, onMonthControlClick: onMonthControlClick, onNext: onNext, onPrev: onPrev, onYearControlClick: onYearControlClick, referenceDate: referenceDate, value: value }), void 0) }), void 0));
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export default DatePickerCalendar;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DateType } from '@mezzanine-ui/core/calendar';
|
|
3
|
+
import { RangePickerValue } from '@mezzanine-ui/core/picker';
|
|
4
|
+
import { DateRangePickerCalendarProps } from './DateRangePickerCalendar';
|
|
5
|
+
import { RangePickerTriggerProps } from '../Picker';
|
|
6
|
+
export interface DateRangePickerProps extends Pick<DateRangePickerCalendarProps, 'calendarProps' | 'displayMonthLocale' | 'fadeProps' | 'mode' | 'popperProps' | 'isDateDisabled' | 'isMonthDisabled' | 'isYearDisabled'>, Pick<RangePickerTriggerProps, 'className' | 'clearable' | 'disabled' | 'error' | 'fullWidth' | 'inputFromPlaceholder' | 'inputFromProps' | 'inputToPlaceholder' | 'inputToProps' | 'prefix' | 'readOnly' | 'required' | 'size'> {
|
|
7
|
+
/**
|
|
8
|
+
* Default value for date range picker.
|
|
9
|
+
*/
|
|
10
|
+
defaultValue?: [DateType, DateType];
|
|
11
|
+
/**
|
|
12
|
+
* The format for displaying date.
|
|
13
|
+
*/
|
|
14
|
+
format?: string;
|
|
15
|
+
/**
|
|
16
|
+
* A function that fires when calendar toggle. Receive open status in boolean format as props.
|
|
17
|
+
*/
|
|
18
|
+
onCalendarToggle?: (open: boolean) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Change handler. Takes an array of your declared `DateType` which represents from and to in order.
|
|
21
|
+
*/
|
|
22
|
+
onChange?: (target?: RangePickerValue) => void;
|
|
23
|
+
/**
|
|
24
|
+
* The reference date for getting calendars. Default to current time.
|
|
25
|
+
*/
|
|
26
|
+
referenceDate?: DateRangePickerCalendarProps['referenceDate'];
|
|
27
|
+
/**
|
|
28
|
+
* Value of the range picker.
|
|
29
|
+
* It is an array of your declared `DateType` which represents from and to in order.
|
|
30
|
+
*/
|
|
31
|
+
value?: RangePickerValue;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The react component for `mezzanine` date range picker.
|
|
35
|
+
* Notice that any component related to date-range-picker should be used along with `CalendarContext`. <br />
|
|
36
|
+
*/
|
|
37
|
+
declare const DateRangePicker: import("react").ForwardRefExoticComponent<DateRangePickerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
38
|
+
export default DateRangePicker;
|