@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,18 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
+
export interface TimePanelActionProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'children'> {
|
|
4
|
+
/**
|
|
5
|
+
* Display name of the confirm button.
|
|
6
|
+
* @default 'OK'
|
|
7
|
+
*/
|
|
8
|
+
confirmText?: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Click handler for the confirm button.
|
|
11
|
+
*/
|
|
12
|
+
onConfirm?: VoidFunction;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The react component for `mezzanine` time panel action.
|
|
16
|
+
*/
|
|
17
|
+
declare const TimePanelAction: import("react").ForwardRefExoticComponent<TimePanelActionProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export default TimePanelAction;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { timePanelClasses } from '@mezzanine-ui/core/time-panel';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import Button from '../Button/Button.js';
|
|
5
|
+
import cx from 'clsx';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The react component for `mezzanine` time panel action.
|
|
9
|
+
*/
|
|
10
|
+
const TimePanelAction = forwardRef(function TimePanelAction(props, ref) {
|
|
11
|
+
const { className, confirmText = 'OK', onConfirm, ...rest } = props;
|
|
12
|
+
return (jsx("div", Object.assign({}, rest, { ref: ref, className: cx(timePanelClasses.action, className) }, { children: jsx(Button, Object.assign({ variant: "contained", size: "small", onClick: onConfirm }, { children: confirmText }), void 0) }), void 0));
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export default TimePanelAction;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { TimePanelUnit } from '@mezzanine-ui/core/time-panel';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface TimePanelColumnProps {
|
|
4
|
+
/**
|
|
5
|
+
* The active unit of time.
|
|
6
|
+
*/
|
|
7
|
+
activeUnit?: TimePanelUnit['value'];
|
|
8
|
+
/**
|
|
9
|
+
* `cellHeight` controls the scroll positioning. This should meet the value of the computed cell height.
|
|
10
|
+
*/
|
|
11
|
+
cellHeight?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Change handler. Takes `TimePanelUnit` as its argument.
|
|
14
|
+
*/
|
|
15
|
+
onChange?: (unit: TimePanelUnit) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Click handler for the next button.
|
|
18
|
+
*/
|
|
19
|
+
onNext?: VoidFunction;
|
|
20
|
+
/**
|
|
21
|
+
* Click handler for the prev button.
|
|
22
|
+
*/
|
|
23
|
+
onPrev?: VoidFunction;
|
|
24
|
+
/**
|
|
25
|
+
* The prefix of the column.
|
|
26
|
+
*/
|
|
27
|
+
prefix?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Display units inside the column.
|
|
30
|
+
*/
|
|
31
|
+
units: TimePanelUnit[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The react component for `mezzanine` time panel column.
|
|
35
|
+
*/
|
|
36
|
+
declare const TimePanelColumn: import("react").ForwardRefExoticComponent<TimePanelColumnProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
37
|
+
export default TimePanelColumn;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { timePanelClasses } from '@mezzanine-ui/core/time-panel';
|
|
3
|
+
import { ChevronUpIcon, ChevronDownIcon } from '@mezzanine-ui/icons';
|
|
4
|
+
import { forwardRef, useRef, useEffect } from 'react';
|
|
5
|
+
import Icon from '../Icon/Icon.js';
|
|
6
|
+
import cx from 'clsx';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The react component for `mezzanine` time panel column.
|
|
10
|
+
*/
|
|
11
|
+
const TimePanelColumn = forwardRef(function TimePanelColumn(props, ref) {
|
|
12
|
+
const { activeUnit, cellHeight = 32, onChange, onNext, onPrev, prefix, units, } = props;
|
|
13
|
+
const cellsRef = useRef(null);
|
|
14
|
+
const getChangeHandler = (unit) => {
|
|
15
|
+
if (!onChange)
|
|
16
|
+
return undefined;
|
|
17
|
+
return () => {
|
|
18
|
+
onChange(unit);
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
const prevetSmoothScrollTo = useRef(true);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
var _a;
|
|
24
|
+
const activeIndex = units.findIndex(({ value }) => value === activeUnit);
|
|
25
|
+
(_a = cellsRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
26
|
+
top: activeIndex * cellHeight,
|
|
27
|
+
behavior: prevetSmoothScrollTo.current ? 'auto' : 'smooth',
|
|
28
|
+
});
|
|
29
|
+
prevetSmoothScrollTo.current = false;
|
|
30
|
+
}, [activeUnit, cellHeight, units]);
|
|
31
|
+
return (jsxs("div", Object.assign({ ref: ref, className: timePanelClasses.column }, { children: [prefix && jsx("div", Object.assign({ className: timePanelClasses.columnPrefix }, { children: prefix }), void 0),
|
|
32
|
+
jsx("button", Object.assign({ type: "button", className: cx(timePanelClasses.button, timePanelClasses.columnControlButton), onClick: onPrev }, { children: jsx(Icon, { icon: ChevronUpIcon }, void 0) }), void 0),
|
|
33
|
+
jsx("div", Object.assign({ ref: cellsRef, className: timePanelClasses.columnCells }, { children: units.map((unit) => (jsx("button", Object.assign({ type: "button", className: cx(timePanelClasses.button, timePanelClasses.columnButton, {
|
|
34
|
+
[timePanelClasses.buttonActive]: unit.value === activeUnit,
|
|
35
|
+
}), onClick: getChangeHandler(unit) }, { children: unit.label }), unit.value))) }), void 0),
|
|
36
|
+
jsx("button", Object.assign({ type: "button", className: cx(timePanelClasses.button, timePanelClasses.columnControlButton), onClick: onNext }, { children: jsx(Icon, { icon: ChevronDownIcon }, void 0) }), void 0)] }), void 0));
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export default TimePanelColumn;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DateType } from '@mezzanine-ui/core/calendar';
|
|
3
|
+
import { PickerTriggerProps } from '../Picker';
|
|
4
|
+
import { TimePickerPanelProps } from './TimePickerPanel';
|
|
5
|
+
export interface TimePickerProps extends Omit<TimePickerPanelProps, 'onConfirm'>, Omit<PickerTriggerProps, 'anchor' | 'defaultValue' | 'inputRef' | 'onChange' | 'onClear' | 'onClick' | 'onIconClick' | 'onKeyDown' | 'open' | 'suffixActionIcon' | 'value'> {
|
|
6
|
+
/**
|
|
7
|
+
* Default value for time picker.
|
|
8
|
+
*/
|
|
9
|
+
defaultValue?: DateType;
|
|
10
|
+
/**
|
|
11
|
+
* The format for displaying time.
|
|
12
|
+
*/
|
|
13
|
+
format?: string;
|
|
14
|
+
/**
|
|
15
|
+
* A function that fires when panel toggled. Receive open status in boolean format as props.
|
|
16
|
+
*/
|
|
17
|
+
onPanelToggle?: (open: boolean) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The react component for `mezzanine` time picker.
|
|
21
|
+
* Notice that any component related to time-picker should be used along with `CalendarContext`.
|
|
22
|
+
*/
|
|
23
|
+
declare const TimePicker: import("react").ForwardRefExoticComponent<TimePickerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
24
|
+
export default TimePicker;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { ClockIcon } from '@mezzanine-ui/icons';
|
|
3
|
+
import { forwardRef, useContext, useMemo, useState, useCallback, useRef } from 'react';
|
|
4
|
+
import { useComposeRefs } from '../hooks/useComposeRefs.js';
|
|
5
|
+
import TimePickerPanel from './TimePickerPanel.js';
|
|
6
|
+
import { FormControlContext } from '../Form/FormControlContext.js';
|
|
7
|
+
import { useCalendarContext } from '../Calendar/CalendarContext.js';
|
|
8
|
+
import { usePickerValue } from '../Picker/usePickerValue.js';
|
|
9
|
+
import { usePickerDocumentEventClose } from '../Picker/usePickerDocumentEventClose.js';
|
|
10
|
+
import Icon from '../Icon/Icon.js';
|
|
11
|
+
import PickerTrigger from '../Picker/PickerTrigger.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The react component for `mezzanine` time picker.
|
|
15
|
+
* Notice that any component related to time-picker should be used along with `CalendarContext`.
|
|
16
|
+
*/
|
|
17
|
+
const TimePicker = forwardRef(function TimePicker(props, ref) {
|
|
18
|
+
const { disabled: disabledFromFormControl, fullWidth: fullWidthFromFormControl, required: requiredFromFormControl, severity, } = useContext(FormControlContext) || {};
|
|
19
|
+
const { defaultTimeFormat, } = useCalendarContext();
|
|
20
|
+
const { className, clearable, confirmText, defaultValue, disabled = disabledFromFormControl, error = severity === 'error' || false, format = defaultTimeFormat, fullWidth = fullWidthFromFormControl, hideHour, hideMinute, hideSecond, hourPrefix, hourStep, inputProps, minutePrefix, minuteStep, onChange: onChangeProp, onPanelToggle: onPanelToggleProp, placeholder, popperProps, prefix, readOnly, required = requiredFromFormControl, secondPrefix, secondStep, size: sizeProp, value: valueProp, } = props;
|
|
21
|
+
const { onBlur: onBlurProp, onKeyDown: onKeyDownProp, onFocus: onFocusProp, size: inputSize = format.length + 2, ...restInputProp } = inputProps || {};
|
|
22
|
+
const formats = useMemo(() => [format], [format]);
|
|
23
|
+
/** Panel open control */
|
|
24
|
+
const [open, setOpen] = useState(false);
|
|
25
|
+
const preventOpen = readOnly;
|
|
26
|
+
const onPanelToggle = useCallback((nextOpen) => {
|
|
27
|
+
if (!preventOpen) {
|
|
28
|
+
setOpen(nextOpen);
|
|
29
|
+
if (onPanelToggleProp) {
|
|
30
|
+
onPanelToggleProp(nextOpen);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, [onPanelToggleProp, preventOpen]);
|
|
34
|
+
const onFocus = useCallback((event) => {
|
|
35
|
+
if (onFocusProp) {
|
|
36
|
+
onFocusProp(event);
|
|
37
|
+
}
|
|
38
|
+
onPanelToggle(true);
|
|
39
|
+
}, [onFocusProp, onPanelToggle]);
|
|
40
|
+
/** Controlling input value and bind change handler */
|
|
41
|
+
const inputRef = useRef(null);
|
|
42
|
+
const { inputValue, onBlur, onChange, onInputChange, onKeyDown, value: internalValue, } = usePickerValue({
|
|
43
|
+
defaultValue,
|
|
44
|
+
format,
|
|
45
|
+
formats,
|
|
46
|
+
inputRef,
|
|
47
|
+
value: valueProp,
|
|
48
|
+
});
|
|
49
|
+
/** Panel confirm handler */
|
|
50
|
+
const onConfirm = useCallback(() => {
|
|
51
|
+
if (onChangeProp) {
|
|
52
|
+
onChangeProp(internalValue);
|
|
53
|
+
}
|
|
54
|
+
onPanelToggle(false);
|
|
55
|
+
}, [internalValue, onChangeProp, onPanelToggle]);
|
|
56
|
+
/** Bind input props */
|
|
57
|
+
const onResolvedKeyDown = useCallback((event) => {
|
|
58
|
+
if (onKeyDownProp) {
|
|
59
|
+
onKeyDownProp(event);
|
|
60
|
+
}
|
|
61
|
+
onKeyDown(event);
|
|
62
|
+
if (event.key === 'Enter') {
|
|
63
|
+
onConfirm();
|
|
64
|
+
}
|
|
65
|
+
}, [onConfirm, onKeyDown, onKeyDownProp]);
|
|
66
|
+
const onResolvedBlur = useCallback((event) => {
|
|
67
|
+
if (onBlurProp) {
|
|
68
|
+
onBlurProp(event);
|
|
69
|
+
}
|
|
70
|
+
onBlur(event);
|
|
71
|
+
}, [onBlur, onBlurProp]);
|
|
72
|
+
const resolvedInputProps = {
|
|
73
|
+
...restInputProp,
|
|
74
|
+
size: inputSize,
|
|
75
|
+
onFocus,
|
|
76
|
+
onKeyDown: onResolvedKeyDown,
|
|
77
|
+
onBlur: onResolvedBlur,
|
|
78
|
+
};
|
|
79
|
+
/** Popper positioning */
|
|
80
|
+
const anchorRef = useRef(null);
|
|
81
|
+
const panelRef = useRef(null);
|
|
82
|
+
const triggerComposedRef = useComposeRefs([anchorRef, ref]);
|
|
83
|
+
/** Blur, click away and key down close */
|
|
84
|
+
const onClose = () => {
|
|
85
|
+
onChange(valueProp);
|
|
86
|
+
onPanelToggle(false);
|
|
87
|
+
};
|
|
88
|
+
usePickerDocumentEventClose({
|
|
89
|
+
open,
|
|
90
|
+
anchorRef,
|
|
91
|
+
popperRef: panelRef,
|
|
92
|
+
lastElementRefInFlow: inputRef,
|
|
93
|
+
onClose,
|
|
94
|
+
onChangeClose: onClose,
|
|
95
|
+
});
|
|
96
|
+
/** Bind on change to on clear */
|
|
97
|
+
const onClear = () => {
|
|
98
|
+
onChange(undefined);
|
|
99
|
+
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(undefined);
|
|
100
|
+
};
|
|
101
|
+
/** Icon */
|
|
102
|
+
const onIconClick = (e) => {
|
|
103
|
+
e.stopPropagation();
|
|
104
|
+
if (open) {
|
|
105
|
+
onChange(valueProp);
|
|
106
|
+
}
|
|
107
|
+
onPanelToggle(!open);
|
|
108
|
+
};
|
|
109
|
+
const suffixActionIcon = (jsx(Icon, { icon: ClockIcon, onClick: onIconClick }, void 0));
|
|
110
|
+
return (jsxs(Fragment, { children: [jsx(PickerTrigger, { 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: sizeProp, suffixActionIcon: suffixActionIcon, value: inputValue }, void 0),
|
|
111
|
+
jsx(TimePickerPanel, { ref: panelRef, anchor: anchorRef, confirmText: confirmText, hideHour: hideHour, hideMinute: hideMinute, hideSecond: hideSecond, hourPrefix: hourPrefix, hourStep: hourStep, minutePrefix: minutePrefix, minuteStep: minuteStep, onChange: onChange, onConfirm: onConfirm, open: open, popperProps: popperProps, secondPrefix: secondPrefix, secondStep: secondStep, value: internalValue }, void 0)] }, void 0));
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
export default TimePicker;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DateType } from '@mezzanine-ui/core/calendar';
|
|
3
|
+
import { TimePanelProps } from '../TimePanel';
|
|
4
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
5
|
+
import { InputTriggerPopperProps } from '../_internal/InputTriggerPopper';
|
|
6
|
+
export interface TimePickerPanelProps extends Omit<TimePanelProps, Exclude<keyof NativeElementPropsWithoutKeyAndRef<'div'>, 'className' | 'style' | 'id'> | 'withoutAction' | 'onChange' | 'value'>, Pick<InputTriggerPopperProps, 'anchor' | 'fadeProps' | 'open'> {
|
|
7
|
+
/**
|
|
8
|
+
* Change Handler. Receive `DateType` as props.
|
|
9
|
+
*/
|
|
10
|
+
onChange?: (value?: DateType) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Other props you may provide to `Popper` component
|
|
13
|
+
*/
|
|
14
|
+
popperProps?: Omit<InputTriggerPopperProps, 'anchor' | 'children' | 'fadeProps' | 'open'>;
|
|
15
|
+
/**
|
|
16
|
+
* Display value of the panel.
|
|
17
|
+
*/
|
|
18
|
+
value?: DateType;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The react component for `mezzanine` time picker panel.
|
|
22
|
+
*/
|
|
23
|
+
declare const TimePickerPanel: import("react").ForwardRefExoticComponent<TimePickerPanelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
24
|
+
export default TimePickerPanel;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import InputTriggerPopper from '../_internal/InputTriggerPopper/InputTriggerPopper.js';
|
|
4
|
+
import TimePanel from '../TimePanel/TimePanel.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The react component for `mezzanine` time picker panel.
|
|
8
|
+
*/
|
|
9
|
+
const TimePickerPanel = forwardRef(function TimePickerPanel(props, ref) {
|
|
10
|
+
const { anchor, confirmText, fadeProps, hideHour, hideMinute, hideSecond, hourPrefix, hourStep, minutePrefix, minuteStep, onChange, onConfirm, open, popperProps, secondPrefix, secondStep, value, ...restHostProps } = props;
|
|
11
|
+
return (jsx(InputTriggerPopper, Object.assign({}, popperProps, { ref: ref, anchor: anchor, open: open, fadeProps: fadeProps }, { children: jsx(TimePanel, Object.assign({}, restHostProps, { hideHour: hideHour, hourStep: hourStep, hideMinute: hideMinute, minuteStep: minuteStep, hideSecond: hideSecond, secondStep: secondStep, hourPrefix: hourPrefix, minutePrefix: minutePrefix, secondPrefix: secondPrefix, onChange: onChange, value: value, onConfirm: onConfirm, confirmText: confirmText }), void 0) }), void 0));
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export default TimePickerPanel;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactElement, MouseEventHandler } from 'react';
|
|
2
|
+
import { PopperProps } from '../Popper';
|
|
3
|
+
export interface TooltipProps extends PopperProps {
|
|
4
|
+
/**
|
|
5
|
+
* child function that can receive events
|
|
6
|
+
*/
|
|
7
|
+
children(opt: {
|
|
8
|
+
onMouseEnter: MouseEventHandler;
|
|
9
|
+
onMouseLeave: MouseEventHandler;
|
|
10
|
+
}): ReactElement;
|
|
11
|
+
/**
|
|
12
|
+
* delay time to hide when mouse leave. unit: s.
|
|
13
|
+
* @default 0.1
|
|
14
|
+
*/
|
|
15
|
+
mouseLeaveDelay?: number;
|
|
16
|
+
/**
|
|
17
|
+
* title of tooltip
|
|
18
|
+
*/
|
|
19
|
+
title?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The react component for `mezzanine` tooltip.
|
|
23
|
+
*/
|
|
24
|
+
declare const Tooltip: import("react").ForwardRefExoticComponent<TooltipProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
25
|
+
export default Tooltip;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useRef } from 'react';
|
|
3
|
+
import { tooltipClasses } from '@mezzanine-ui/core/tooltip';
|
|
4
|
+
import { useComposeRefs } from '../hooks/useComposeRefs.js';
|
|
5
|
+
import { useDelayMouseEnterLeave } from './useDelayMouseEnterLeave.js';
|
|
6
|
+
import Popper from '../Popper/Popper.js';
|
|
7
|
+
import cx from 'clsx';
|
|
8
|
+
|
|
9
|
+
const offsetModifier = {
|
|
10
|
+
name: 'offset',
|
|
11
|
+
options: {
|
|
12
|
+
offset: [0, 8],
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The react component for `mezzanine` tooltip.
|
|
17
|
+
*/
|
|
18
|
+
const Tooltip = forwardRef(function Tooltip(props, ref) {
|
|
19
|
+
const { anchor: anchorProp, children, className, mouseLeaveDelay = 0.1, open = false, options = {}, title, ...rest } = props;
|
|
20
|
+
const { modifiers = [] } = options;
|
|
21
|
+
const tooltipRef = useRef(null);
|
|
22
|
+
const composedRef = useComposeRefs([ref, tooltipRef]);
|
|
23
|
+
const { anchor, onLeave, onPopperEnter, onTargetEnter, visible, } = useDelayMouseEnterLeave({
|
|
24
|
+
mouseLeaveDelay,
|
|
25
|
+
});
|
|
26
|
+
/** tooltip shown only when title existed && visible is true */
|
|
27
|
+
const isTooltipVisible = open || (visible && Boolean(title));
|
|
28
|
+
return (jsxs(Fragment, { children: [jsx(Popper, Object.assign({}, rest, { ref: composedRef, anchor: anchorProp || anchor, className: cx(tooltipClasses.host, className), onMouseEnter: onPopperEnter, onMouseLeave: onLeave, open: isTooltipVisible, options: {
|
|
29
|
+
...options,
|
|
30
|
+
modifiers: [...modifiers, offsetModifier],
|
|
31
|
+
} }, { children: title }), void 0), typeof children === 'function' && children({
|
|
32
|
+
onMouseEnter: onTargetEnter,
|
|
33
|
+
onMouseLeave: onLeave,
|
|
34
|
+
})] }, void 0));
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export default Tooltip;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, TooltipProps, } from './Tooltip';
|
package/Tooltip/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Tooltip.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface UseDelayMouseEnterLeave {
|
|
3
|
+
mouseLeaveDelay?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface DelayMouseEnterLeave {
|
|
6
|
+
anchor: HTMLButtonElement | null;
|
|
7
|
+
onLeave(v: any): void;
|
|
8
|
+
onPopperEnter(v: any): void;
|
|
9
|
+
onTargetEnter(v: React.MouseEvent<HTMLButtonElement, MouseEvent>): void;
|
|
10
|
+
visible: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function useDelayMouseEnterLeave(opt: UseDelayMouseEnterLeave): DelayMouseEnterLeave;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
function useDelayMouseEnterLeave(opt) {
|
|
4
|
+
const { mouseLeaveDelay = 0.1, } = opt || {};
|
|
5
|
+
/** state that control tooltip visible/invisible */
|
|
6
|
+
const [visible, setVisible] = useState(false);
|
|
7
|
+
/** tooltip reference anchor */
|
|
8
|
+
const [anchor, setAnchor] = useState(null);
|
|
9
|
+
/** timer for mouse leaving delay */
|
|
10
|
+
let timer;
|
|
11
|
+
const clearVisibilityDelayTimeout = useCallback(() => {
|
|
12
|
+
if (timer) {
|
|
13
|
+
clearTimeout(timer);
|
|
14
|
+
}
|
|
15
|
+
}, []);
|
|
16
|
+
const onLeave = useCallback(() => {
|
|
17
|
+
timer = setTimeout(() => {
|
|
18
|
+
setVisible(false);
|
|
19
|
+
clearVisibilityDelayTimeout();
|
|
20
|
+
}, mouseLeaveDelay * 1000);
|
|
21
|
+
}, [mouseLeaveDelay]);
|
|
22
|
+
const onPopperEnter = useCallback(() => {
|
|
23
|
+
clearVisibilityDelayTimeout();
|
|
24
|
+
setVisible(true);
|
|
25
|
+
}, []);
|
|
26
|
+
const onTargetEnter = useCallback((event) => {
|
|
27
|
+
event.stopPropagation();
|
|
28
|
+
setAnchor(event.currentTarget);
|
|
29
|
+
clearVisibilityDelayTimeout();
|
|
30
|
+
setVisible(true);
|
|
31
|
+
}, []);
|
|
32
|
+
return {
|
|
33
|
+
anchor,
|
|
34
|
+
onLeave,
|
|
35
|
+
onPopperEnter,
|
|
36
|
+
onTargetEnter,
|
|
37
|
+
visible,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { useDelayMouseEnterLeave };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
+
import { TransitionImplementationProps } from './Transition';
|
|
4
|
+
export interface CollapseProps extends TransitionImplementationProps, Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'children'> {
|
|
5
|
+
/**
|
|
6
|
+
* The height of the container while collapsed.
|
|
7
|
+
* @default 0
|
|
8
|
+
*/
|
|
9
|
+
collapsedHeight?: string | number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The react component for `mezzanine` transition collapse.
|
|
13
|
+
*/
|
|
14
|
+
declare const Collapse: import("react").ForwardRefExoticComponent<CollapseProps & import("react").RefAttributes<HTMLElement>>;
|
|
15
|
+
export default Collapse;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useRef } from 'react';
|
|
3
|
+
import { MOTION_EASING } from '@mezzanine-ui/system/motion';
|
|
4
|
+
import { useComposeRefs } from '../hooks/useComposeRefs.js';
|
|
5
|
+
import Transition from './Transition.js';
|
|
6
|
+
import { getAutoSizeDuration } from './getAutoSizeDuration.js';
|
|
7
|
+
import { reflow } from './reflow.js';
|
|
8
|
+
import { useAutoTransitionDuration } from './useAutoTransitionDuration.js';
|
|
9
|
+
import { useSetNodeTransition } from './useSetNodeTransition.js';
|
|
10
|
+
|
|
11
|
+
function getStyle(state, inProp, collapsedHeight) {
|
|
12
|
+
const style = {
|
|
13
|
+
minHeight: collapsedHeight,
|
|
14
|
+
overflow: 'hidden',
|
|
15
|
+
};
|
|
16
|
+
if (state === 'entered') {
|
|
17
|
+
style.overflow = 'visible';
|
|
18
|
+
}
|
|
19
|
+
else if (state === 'exited' && !inProp && collapsedHeight === '0px') {
|
|
20
|
+
style.visibility = 'hidden';
|
|
21
|
+
}
|
|
22
|
+
return style;
|
|
23
|
+
}
|
|
24
|
+
const defaultEasing = {
|
|
25
|
+
enter: MOTION_EASING.decelerated,
|
|
26
|
+
exit: MOTION_EASING.accelerated,
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The react component for `mezzanine` transition collapse.
|
|
30
|
+
*/
|
|
31
|
+
const Collapse = forwardRef(function Collapse(props, ref) {
|
|
32
|
+
const { appear, children, collapsedHeight: collapsedHeightProp = 0, delay = 0, duration = 'auto', easing = defaultEasing, in: inProp = false, lazyMount, keepMount, onEnter, onEntered, onEntering, onExit, onExiting, onExited, style, ...rest } = props;
|
|
33
|
+
const { autoTransitionDuration, addEndListener } = useAutoTransitionDuration(duration);
|
|
34
|
+
const nodeRef = useRef(null);
|
|
35
|
+
const wrapperRef = useRef(null);
|
|
36
|
+
const collapsedHeight = typeof collapsedHeightProp === 'number' ? `${collapsedHeightProp}px` : collapsedHeightProp;
|
|
37
|
+
const getWrapperHeight = () => { var _a; return ((_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight) || 0; };
|
|
38
|
+
const [setNodeTransition, resetNodeTransition] = useSetNodeTransition({
|
|
39
|
+
delay,
|
|
40
|
+
duration,
|
|
41
|
+
easing,
|
|
42
|
+
properties: ['height'],
|
|
43
|
+
resolveAutoDuration: () => {
|
|
44
|
+
const autoSizeDuration = getAutoSizeDuration(getWrapperHeight());
|
|
45
|
+
autoTransitionDuration.current = autoSizeDuration;
|
|
46
|
+
return autoSizeDuration;
|
|
47
|
+
},
|
|
48
|
+
}, style);
|
|
49
|
+
const composedNodeRef = useComposeRefs([ref, nodeRef]);
|
|
50
|
+
const transitionProps = {
|
|
51
|
+
addEndListener,
|
|
52
|
+
appear,
|
|
53
|
+
duration,
|
|
54
|
+
in: inProp,
|
|
55
|
+
lazyMount,
|
|
56
|
+
keepMount: collapsedHeight !== '0px' ? true : keepMount,
|
|
57
|
+
nodeRef,
|
|
58
|
+
/* eslint-disable no-param-reassign */
|
|
59
|
+
onEnter(node, isAppearing) {
|
|
60
|
+
node.style.height = collapsedHeight;
|
|
61
|
+
reflow(node);
|
|
62
|
+
if (onEnter) {
|
|
63
|
+
onEnter(node, isAppearing);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
onEntering(node, isAppearing) {
|
|
67
|
+
setNodeTransition(node, 'enter');
|
|
68
|
+
node.style.height = `${getWrapperHeight()}px`;
|
|
69
|
+
if (onEntering) {
|
|
70
|
+
onEntering(node, isAppearing);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
onEntered(node, isAppearing) {
|
|
74
|
+
node.style.height = 'auto';
|
|
75
|
+
resetNodeTransition(node);
|
|
76
|
+
if (onEntered) {
|
|
77
|
+
onEntered(node, isAppearing);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
onExit(node) {
|
|
81
|
+
node.style.height = `${getWrapperHeight()}px`;
|
|
82
|
+
reflow(node);
|
|
83
|
+
if (onExit) {
|
|
84
|
+
onExit(node);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
onExiting(node) {
|
|
88
|
+
setNodeTransition(node, 'exit');
|
|
89
|
+
node.style.height = collapsedHeight;
|
|
90
|
+
if (onExiting) {
|
|
91
|
+
onExiting(node);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
onExited(node) {
|
|
95
|
+
resetNodeTransition(node);
|
|
96
|
+
if (onExited) {
|
|
97
|
+
onExited(node);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
return (jsx(Transition, Object.assign({}, transitionProps, { children: (state) => (jsx("div", Object.assign({}, rest, { ref: composedNodeRef, style: {
|
|
102
|
+
...getStyle(state, inProp, collapsedHeight),
|
|
103
|
+
...style,
|
|
104
|
+
} }, { children: jsx("div", Object.assign({ ref: wrapperRef, style: { display: 'flex', width: '100%' } }, { children: jsx("div", Object.assign({ style: { width: '100%' } }, { children: children }), void 0) }), void 0) }), void 0)) }), void 0));
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export default Collapse;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TransitionImplementationProps } from './Transition';
|
|
3
|
+
export declare type FadeProps = TransitionImplementationProps;
|
|
4
|
+
/**
|
|
5
|
+
* The react component for `mezzanine` transition fade.
|
|
6
|
+
*/
|
|
7
|
+
declare const Fade: import("react").ForwardRefExoticComponent<TransitionImplementationProps & import("react").RefAttributes<HTMLElement>>;
|
|
8
|
+
export default Fade;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { MOTION_DURATION, MOTION_EASING } from '@mezzanine-ui/system/motion';
|
|
3
|
+
import { forwardRef, useRef, cloneElement } from 'react';
|
|
4
|
+
import { useComposeRefs } from '../hooks/useComposeRefs.js';
|
|
5
|
+
import Transition from './Transition.js';
|
|
6
|
+
import { reflow } from './reflow.js';
|
|
7
|
+
import { useSetNodeTransition } from './useSetNodeTransition.js';
|
|
8
|
+
|
|
9
|
+
function getStyle(state, inProp) {
|
|
10
|
+
const style = {
|
|
11
|
+
opacity: 0,
|
|
12
|
+
};
|
|
13
|
+
if (state === 'entering' || state === 'entered') {
|
|
14
|
+
style.opacity = 1;
|
|
15
|
+
}
|
|
16
|
+
else if (state === 'exited' && !inProp) {
|
|
17
|
+
style.visibility = 'hidden';
|
|
18
|
+
}
|
|
19
|
+
return style;
|
|
20
|
+
}
|
|
21
|
+
const defaultDuration = {
|
|
22
|
+
enter: MOTION_DURATION.short,
|
|
23
|
+
exit: MOTION_DURATION.shorter,
|
|
24
|
+
};
|
|
25
|
+
const defaultEasing = {
|
|
26
|
+
enter: MOTION_EASING.decelerated,
|
|
27
|
+
exit: MOTION_EASING.accelerated,
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The react component for `mezzanine` transition fade.
|
|
31
|
+
*/
|
|
32
|
+
const Fade = forwardRef(function Fade(props, ref) {
|
|
33
|
+
const { children, in: inProp = false, delay = 0, duration: durationProp = defaultDuration, easing = defaultEasing, onEnter, onEntered, onExit, onExited, ...rest } = props;
|
|
34
|
+
const duration = durationProp === 'auto' ? defaultDuration : durationProp;
|
|
35
|
+
const nodeRef = useRef(null);
|
|
36
|
+
const composedNodeRef = useComposeRefs([ref, nodeRef]);
|
|
37
|
+
const [setNodeTransition, resetNodeTransition] = useSetNodeTransition({
|
|
38
|
+
delay,
|
|
39
|
+
duration,
|
|
40
|
+
easing,
|
|
41
|
+
properties: ['opacity'],
|
|
42
|
+
}, children === null || children === void 0 ? void 0 : children.props.style);
|
|
43
|
+
const transitionProps = {
|
|
44
|
+
...rest,
|
|
45
|
+
duration,
|
|
46
|
+
in: inProp,
|
|
47
|
+
nodeRef,
|
|
48
|
+
onEnter(node, isAppearing) {
|
|
49
|
+
setNodeTransition(node, 'enter');
|
|
50
|
+
reflow(node);
|
|
51
|
+
if (onEnter) {
|
|
52
|
+
onEnter(node, isAppearing);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
onEntered(node, isAppearing) {
|
|
56
|
+
resetNodeTransition(node);
|
|
57
|
+
if (onEntered) {
|
|
58
|
+
onEntered(node, isAppearing);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
onExit(node) {
|
|
62
|
+
setNodeTransition(node, 'exit');
|
|
63
|
+
if (onExit) {
|
|
64
|
+
onExit(node);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
onExited(node) {
|
|
68
|
+
resetNodeTransition(node);
|
|
69
|
+
if (onExited) {
|
|
70
|
+
onExited(node);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
return (jsx(Transition, Object.assign({}, transitionProps, { children: children && ((state) => cloneElement(children, {
|
|
75
|
+
...children.props,
|
|
76
|
+
ref: composedNodeRef,
|
|
77
|
+
style: {
|
|
78
|
+
...getStyle(state, inProp),
|
|
79
|
+
...children.props.style,
|
|
80
|
+
},
|
|
81
|
+
})) }), void 0));
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export default Fade;
|