@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,48 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, Children, cloneElement } from 'react';
|
|
3
|
+
import { navigationClasses } from '@mezzanine-ui/core/navigation';
|
|
4
|
+
import NavigationItem from './NavigationItem.js';
|
|
5
|
+
import NavigationSubMenu from './NavigationSubMenu.js';
|
|
6
|
+
import { NavigationContext } from './NavigationContext.js';
|
|
7
|
+
import cx from 'clsx';
|
|
8
|
+
|
|
9
|
+
const Navigation = forwardRef((props, ref) => {
|
|
10
|
+
const { activeKey, children = [], className, onClick, orientation = 'horizontal', ...rest } = props;
|
|
11
|
+
const ItemChildren = Children.map(children, (child) => {
|
|
12
|
+
switch (child.type) {
|
|
13
|
+
case NavigationItem: {
|
|
14
|
+
const itemChild = child;
|
|
15
|
+
return cloneElement(itemChild, {
|
|
16
|
+
active: itemChild.props.active || activeKey === itemChild.key,
|
|
17
|
+
eventKey: itemChild.key,
|
|
18
|
+
onClick: itemChild.props.onClick || onClick,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
case NavigationSubMenu: {
|
|
22
|
+
const subMenuChild = child;
|
|
23
|
+
const subMenuChildren = child.props.children;
|
|
24
|
+
let subMenuActive = false;
|
|
25
|
+
const groupChildren = Children
|
|
26
|
+
.map(subMenuChildren, (groupChild) => {
|
|
27
|
+
const active = activeKey === groupChild.key || groupChild.props.active;
|
|
28
|
+
if (active) {
|
|
29
|
+
subMenuActive = true;
|
|
30
|
+
}
|
|
31
|
+
return cloneElement(groupChild, {
|
|
32
|
+
active,
|
|
33
|
+
eventKey: groupChild.key,
|
|
34
|
+
onClick: groupChild.props.onClick || onClick,
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
return cloneElement(subMenuChild, {
|
|
38
|
+
active: subMenuChild.props.active || subMenuActive,
|
|
39
|
+
}, groupChildren);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return (jsx("ul", Object.assign({}, rest, { ref: ref, className: cx(navigationClasses.host, navigationClasses[orientation], className) }, { children: jsx(NavigationContext.Provider, Object.assign({ value: {
|
|
44
|
+
orientation,
|
|
45
|
+
} }, { children: ItemChildren }), void 0) }), void 0));
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export default Navigation;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NavigationOrientation } from '@mezzanine-ui/core/navigation';
|
|
3
|
+
export interface NavigationContextValue {
|
|
4
|
+
orientation: NavigationOrientation;
|
|
5
|
+
}
|
|
6
|
+
export declare const NavigationContext: import("react").Context<NavigationContextValue>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Key, ReactNode } from 'react';
|
|
2
|
+
import { IconDefinition } from '@mezzanine-ui/icons';
|
|
3
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
|
+
export interface NavigationItemProps extends Omit<NativeElementPropsWithoutKeyAndRef<'li'>, 'onClick'> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the item is active.
|
|
7
|
+
*/
|
|
8
|
+
active?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Item display content.
|
|
11
|
+
*/
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Unique ID of the item.
|
|
15
|
+
*/
|
|
16
|
+
key?: Key | null;
|
|
17
|
+
/**
|
|
18
|
+
* @ignore
|
|
19
|
+
*/
|
|
20
|
+
eventKey?: Key | null;
|
|
21
|
+
/**
|
|
22
|
+
* Icon of the item.
|
|
23
|
+
*/
|
|
24
|
+
icon?: IconDefinition;
|
|
25
|
+
/**
|
|
26
|
+
* Called when item is clicked.
|
|
27
|
+
*/
|
|
28
|
+
onClick?: (key?: Key | string | null) => void;
|
|
29
|
+
}
|
|
30
|
+
declare const NavigationItem: import("react").ForwardRefExoticComponent<NavigationItemProps & import("react").RefAttributes<HTMLLIElement>>;
|
|
31
|
+
export default NavigationItem;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext, useCallback } from 'react';
|
|
3
|
+
import { navigationItemClasses } from '@mezzanine-ui/core/navigation';
|
|
4
|
+
import { NavigationContext } from './NavigationContext.js';
|
|
5
|
+
import Icon from '../Icon/Icon.js';
|
|
6
|
+
import cx from 'clsx';
|
|
7
|
+
|
|
8
|
+
const NavigationItem = forwardRef((props, ref) => {
|
|
9
|
+
const { active, children, className, eventKey, icon, onClick, ...rest } = props;
|
|
10
|
+
const { orientation, } = useContext(NavigationContext);
|
|
11
|
+
const handleClick = useCallback((event) => {
|
|
12
|
+
if (orientation === 'vertical') {
|
|
13
|
+
event.stopPropagation();
|
|
14
|
+
}
|
|
15
|
+
if (onClick) {
|
|
16
|
+
onClick(eventKey);
|
|
17
|
+
}
|
|
18
|
+
}, [eventKey, onClick, orientation]);
|
|
19
|
+
return (jsxs("li", Object.assign({}, rest, { ref: ref, className: cx(navigationItemClasses.host, active && navigationItemClasses.active, className), role: "menuitem", onClick: handleClick, onKeyDown: () => { } }, { children: [icon && (jsx(Icon, { className: navigationItemClasses.icon, icon: icon }, void 0)), children] }), void 0));
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export default NavigationItem;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { NavigationItemProps } from './NavigationItem';
|
|
3
|
+
export declare type NavigationSubMenuChild = ReactElement<NavigationItemProps>;
|
|
4
|
+
export declare type NavigationSubMenuChildren = NavigationSubMenuChild | NavigationSubMenuChild[];
|
|
5
|
+
export interface NavigationSubMenuProps extends Omit<NavigationItemProps, 'onClick' | 'eventKey' | 'key'> {
|
|
6
|
+
/**
|
|
7
|
+
* Strict children with `NavigationItem`.
|
|
8
|
+
* @default []
|
|
9
|
+
*/
|
|
10
|
+
children?: NavigationSubMenuChildren;
|
|
11
|
+
/**
|
|
12
|
+
* Set display title for sub-menu item.
|
|
13
|
+
*/
|
|
14
|
+
title?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const NavigationSubMenu: import("react").ForwardRefExoticComponent<NavigationSubMenuProps & import("react").RefAttributes<HTMLLIElement>>;
|
|
17
|
+
export default NavigationSubMenu;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useState, useRef, useContext } from 'react';
|
|
3
|
+
import { navigationSubMenuClasses } from '@mezzanine-ui/core/navigation';
|
|
4
|
+
import { ChevronUpIcon, ChevronDownIcon } from '@mezzanine-ui/icons';
|
|
5
|
+
import { useClickAway } from '../hooks/useClickAway.js';
|
|
6
|
+
import { useComposeRefs } from '../hooks/useComposeRefs.js';
|
|
7
|
+
import NavigationItem from './NavigationItem.js';
|
|
8
|
+
import { NavigationContext } from './NavigationContext.js';
|
|
9
|
+
import Icon from '../Icon/Icon.js';
|
|
10
|
+
import Popper from '../Popper/Popper.js';
|
|
11
|
+
import Collapse from '../Transition/Collapse.js';
|
|
12
|
+
import cx from 'clsx';
|
|
13
|
+
|
|
14
|
+
/* istanbul ignore next */
|
|
15
|
+
const popperOptions = {
|
|
16
|
+
modifiers: [
|
|
17
|
+
{
|
|
18
|
+
name: 'offset',
|
|
19
|
+
options: {
|
|
20
|
+
offset: [0, 0],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'sameWidth',
|
|
25
|
+
enabled: true,
|
|
26
|
+
phase: 'beforeWrite',
|
|
27
|
+
requires: ['computeStyles'],
|
|
28
|
+
fn: ({ state }) => {
|
|
29
|
+
const reassignState = state;
|
|
30
|
+
reassignState.styles.popper.width = `${state.rects.reference.width}px`;
|
|
31
|
+
},
|
|
32
|
+
effect: ({ state }) => {
|
|
33
|
+
const reassignState = state;
|
|
34
|
+
reassignState.elements.popper.style.width = `${state.elements.reference.getBoundingClientRect().width}px`;
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
const NavigationSubMenu = forwardRef((props, ref) => {
|
|
40
|
+
const { className, children = [], active, icon, title, ...rest } = props;
|
|
41
|
+
const [open, setOpen] = useState(false);
|
|
42
|
+
const nodeRef = useRef(null);
|
|
43
|
+
const composedNodeRef = useComposeRefs([ref, nodeRef]);
|
|
44
|
+
const { orientation, } = useContext(NavigationContext);
|
|
45
|
+
const GroupToggleIcon = open ? ChevronUpIcon : ChevronDownIcon;
|
|
46
|
+
useClickAway(() => {
|
|
47
|
+
if (!open || orientation === 'vertical') {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
return () => {
|
|
51
|
+
setOpen(!open);
|
|
52
|
+
};
|
|
53
|
+
}, nodeRef, [
|
|
54
|
+
open,
|
|
55
|
+
orientation,
|
|
56
|
+
]);
|
|
57
|
+
const WrapChildren = (jsx("ul", Object.assign({ className: navigationSubMenuClasses.group }, { children: children }), void 0));
|
|
58
|
+
return (jsxs(NavigationItem, Object.assign({}, rest, { ref: composedNodeRef, className: cx(navigationSubMenuClasses.host, active && navigationSubMenuClasses.active, open && navigationSubMenuClasses.open, (icon && orientation === 'vertical') && navigationSubMenuClasses.indent, className), onClick: () => setOpen(!open) }, { children: [jsxs("div", Object.assign({ className: navigationSubMenuClasses.title }, { children: [icon && (jsx(Icon, { className: navigationSubMenuClasses.icon, icon: icon }, void 0)), title, jsx(Icon, { className: navigationSubMenuClasses.toggleIcon, icon: GroupToggleIcon }, void 0)] }), void 0),
|
|
59
|
+
orientation === 'horizontal' && (jsx(Popper, Object.assign({ anchor: nodeRef, disablePortal: true, open: !!open, options: popperOptions }, { children: WrapChildren }), void 0)),
|
|
60
|
+
orientation === 'vertical' && (jsx(Collapse, Object.assign({ style: {
|
|
61
|
+
width: '100%',
|
|
62
|
+
}, in: !!open }, { children: WrapChildren }), void 0))] }), void 0));
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export default NavigationSubMenu;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { NavigationProps, NavigationChild, NavigationChildren, default, } from './Navigation';
|
|
2
|
+
export { NavigationSubMenuProps, NavigationSubMenuChild, NavigationSubMenuChildren, default as NavigationSubMenu, } from './NavigationSubMenu';
|
|
3
|
+
export { NavigationItemProps, default as NavigationItem, } from './NavigationItem';
|
|
4
|
+
export { NavigationContext, NavigationContextValue, } from './NavigationContext';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { NotificationSeverity } from '@mezzanine-ui/core/notification';
|
|
2
|
+
import { FC, Key, ReactNode } from 'react';
|
|
3
|
+
import { NotifierData, Notifier, NotifierConfig } from '../Notifier';
|
|
4
|
+
import { SlideFadeProps } from '../Transition';
|
|
5
|
+
export interface NotificationConfigProps extends Pick<NotifierConfig, 'duration'>, Pick<SlideFadeProps, 'onEnter' | 'onEntering' | 'onEntered' | 'onExit' | 'onExiting' | 'onExited' | 'easing' | 'direction'> {
|
|
6
|
+
}
|
|
7
|
+
export interface NotificationData extends NotifierData, NotificationConfigProps {
|
|
8
|
+
/**
|
|
9
|
+
* Cancel button text;
|
|
10
|
+
*/
|
|
11
|
+
cancelText?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Confirm button text;
|
|
14
|
+
*/
|
|
15
|
+
confirmText?: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Cancel button click event handler. <br />
|
|
18
|
+
* If not provided, the event handler will fallback to a close function using `Notification.remove`.
|
|
19
|
+
*/
|
|
20
|
+
onCancel?: VoidFunction;
|
|
21
|
+
/**
|
|
22
|
+
* Confirm button click event handler. <br />
|
|
23
|
+
* If given, will render action button group.
|
|
24
|
+
*/
|
|
25
|
+
onConfirm?: VoidFunction;
|
|
26
|
+
/**
|
|
27
|
+
* If given, the message will be closed after the amount of time.
|
|
28
|
+
* You can use `Message.config` to overwrite.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* The identifier of the notification.
|
|
33
|
+
*/
|
|
34
|
+
reference?: Key;
|
|
35
|
+
/**
|
|
36
|
+
* The severity of the message.
|
|
37
|
+
* @default info
|
|
38
|
+
*/
|
|
39
|
+
severity?: NotificationSeverity;
|
|
40
|
+
/**
|
|
41
|
+
* The title of notification.
|
|
42
|
+
*/
|
|
43
|
+
title?: ReactNode;
|
|
44
|
+
}
|
|
45
|
+
export interface Notification extends FC<NotificationData>, Notifier<NotificationData, NotificationConfigProps>, Record<NotificationSeverity, (props?: Omit<NotificationData, 'severity'>) => Key> {
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The react component for `mezzanine` notification.
|
|
49
|
+
*
|
|
50
|
+
* Use the API from the Notification instance such as `Notification.success` and `Notification.error`
|
|
51
|
+
* to display a notification globally.
|
|
52
|
+
*/
|
|
53
|
+
declare const Notification: Notification;
|
|
54
|
+
export default Notification;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { notificationIcons, notificationClasses } from '@mezzanine-ui/core/notification';
|
|
3
|
+
import { TimesIcon } from '@mezzanine-ui/icons';
|
|
4
|
+
import { useState, useEffect } from 'react';
|
|
5
|
+
import Button from '../Button/Button.js';
|
|
6
|
+
import ButtonGroup from '../Button/ButtonGroup.js';
|
|
7
|
+
import SlideFade from '../Transition/SlideFade.js';
|
|
8
|
+
import Icon from '../Icon/Icon.js';
|
|
9
|
+
import { createNotifier } from '../Notifier/createNotifier.js';
|
|
10
|
+
import cx from 'clsx';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The react component for `mezzanine` notification.
|
|
14
|
+
*
|
|
15
|
+
* Use the API from the Notification instance such as `Notification.success` and `Notification.error`
|
|
16
|
+
* to display a notification globally.
|
|
17
|
+
*/
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
19
|
+
const Notification = ((props) => {
|
|
20
|
+
const { cancelText, children, confirmText, direction = 'left', duration, onCancel: onCancelProp, onClose: onCloseProp, onConfirm: onConfirmProp, onExited: onExitedProp, reference, severity, title, ...restTransitionProps } = props;
|
|
21
|
+
const targetIcon = severity ? notificationIcons[severity] : severity;
|
|
22
|
+
const [open, setOpen] = useState(true);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (open && duration) {
|
|
25
|
+
const timer = window.setTimeout(() => {
|
|
26
|
+
setOpen(false);
|
|
27
|
+
}, duration);
|
|
28
|
+
return () => {
|
|
29
|
+
window.clearTimeout(timer);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}, [open, duration]);
|
|
33
|
+
const onClose = () => {
|
|
34
|
+
setOpen(false);
|
|
35
|
+
if (onCloseProp) {
|
|
36
|
+
onCloseProp(reference);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const onConfirm = onConfirmProp ? () => {
|
|
40
|
+
setOpen(false);
|
|
41
|
+
onConfirmProp();
|
|
42
|
+
} : undefined;
|
|
43
|
+
const onCancel = onCancelProp ? () => {
|
|
44
|
+
setOpen(false);
|
|
45
|
+
onCancelProp();
|
|
46
|
+
} : undefined;
|
|
47
|
+
const onExited = (node) => {
|
|
48
|
+
if (onExitedProp) {
|
|
49
|
+
onExitedProp(node);
|
|
50
|
+
}
|
|
51
|
+
Notification.remove(reference);
|
|
52
|
+
};
|
|
53
|
+
return (jsx(SlideFade, Object.assign({ in: open, appear: true, onExited: onExited, direction: direction }, restTransitionProps, { children: jsxs("div", Object.assign({ className: cx(notificationClasses.host, severity ? notificationClasses.severity(severity) : undefined) }, { children: [targetIcon ? (jsx("div", Object.assign({ className: notificationClasses.iconContainer }, { children: jsx(Icon, { icon: targetIcon, className: notificationClasses.severityIcon }, void 0) }), void 0)) : null,
|
|
54
|
+
jsxs("div", Object.assign({ className: notificationClasses.body }, { children: [jsx("h4", Object.assign({ className: notificationClasses.title }, { children: title }), void 0),
|
|
55
|
+
jsx("div", Object.assign({ className: notificationClasses.content }, { children: children }), void 0),
|
|
56
|
+
onConfirm && !severity ? (jsxs(ButtonGroup, Object.assign({ className: notificationClasses.action }, { children: [jsx(Button, Object.assign({ variant: "contained", onClick: onConfirm }, { children: confirmText }), void 0),
|
|
57
|
+
jsx(Button, Object.assign({ variant: "outlined", onClick: onCancel || onClose }, { children: cancelText }), void 0)] }), void 0)) : null] }), void 0),
|
|
58
|
+
jsx(Icon, { icon: TimesIcon, className: notificationClasses.closeIcon, onClick: onClose }, void 0)] }), void 0) }), void 0));
|
|
59
|
+
});
|
|
60
|
+
const { add, config, destroy, remove, } = createNotifier({
|
|
61
|
+
duration: false,
|
|
62
|
+
render: (notif) => jsx(Notification, Object.assign({}, notif), void 0),
|
|
63
|
+
setRoot: (root) => {
|
|
64
|
+
root.setAttribute('class', notificationClasses.root);
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
Notification.add = add;
|
|
68
|
+
Notification.config = config;
|
|
69
|
+
Notification.destroy = destroy;
|
|
70
|
+
Notification.remove = remove;
|
|
71
|
+
['success', 'warning', 'error', 'info'].forEach((severity) => {
|
|
72
|
+
Notification[severity] = (props) => Notification.add({
|
|
73
|
+
...props,
|
|
74
|
+
severity,
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export default Notification;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Notification.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Key, RefObject } from 'react';
|
|
2
|
+
import { NotifierData, NotifierConfig, RenderNotifier } from './typings';
|
|
3
|
+
export interface NotifierController<N extends NotifierData> {
|
|
4
|
+
add: (notifier: N & {
|
|
5
|
+
key: Key;
|
|
6
|
+
}) => void;
|
|
7
|
+
remove: (key: Key) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface NotifierManagerProps<N extends NotifierData> extends Pick<NotifierConfig, 'maxCount'> {
|
|
10
|
+
controllerRef: RefObject<NotifierController<N>>;
|
|
11
|
+
defaultNotifiers?: (N & {
|
|
12
|
+
key: Key;
|
|
13
|
+
})[];
|
|
14
|
+
render: RenderNotifier<N>;
|
|
15
|
+
}
|
|
16
|
+
declare function NotifierManager<N extends NotifierData>(props: NotifierManagerProps<N>): JSX.Element;
|
|
17
|
+
export default NotifierManager;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useMemo, useImperativeHandle, Fragment as Fragment$1 } from 'react';
|
|
3
|
+
|
|
4
|
+
function NotifierManager(props) {
|
|
5
|
+
const { controllerRef, defaultNotifiers = [], maxCount, render, } = props;
|
|
6
|
+
const [notifiers, setNotifiers] = useState(defaultNotifiers);
|
|
7
|
+
const notifiersShouldRendered = typeof maxCount === 'number' && notifiers.length > maxCount
|
|
8
|
+
? notifiers.slice(0, maxCount)
|
|
9
|
+
: notifiers;
|
|
10
|
+
const controller = useMemo(() => ({
|
|
11
|
+
add(notifier) {
|
|
12
|
+
setNotifiers((prev) => {
|
|
13
|
+
const notifierIndex = prev.findIndex(({ key }) => key === notifier.key);
|
|
14
|
+
return ~notifierIndex
|
|
15
|
+
? [
|
|
16
|
+
...prev.slice(0, notifierIndex),
|
|
17
|
+
notifier,
|
|
18
|
+
...prev.slice(notifierIndex + 1, prev.length),
|
|
19
|
+
]
|
|
20
|
+
: [...prev, notifier];
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
remove(key) {
|
|
24
|
+
setNotifiers((prev) => prev.filter((m) => m.key !== key));
|
|
25
|
+
},
|
|
26
|
+
}), []);
|
|
27
|
+
useImperativeHandle(controllerRef, () => controller, [controller]);
|
|
28
|
+
return (jsx(Fragment, { children: notifiersShouldRendered.map((notifier) => (jsx(Fragment$1, { children: render(notifier) }, notifier.key))) }, void 0));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default NotifierManager;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Notifier, NotifierConfig, NotifierData, RenderNotifier } from './typings';
|
|
2
|
+
export interface CreateNotifierProps<N extends NotifierData, C extends NotifierConfig> extends NotifierConfig {
|
|
3
|
+
/**
|
|
4
|
+
* Customizable config for notifier. The given values should be retrivable from your notification carrier.
|
|
5
|
+
*/
|
|
6
|
+
config?: C;
|
|
7
|
+
/**
|
|
8
|
+
* The render props for notification carrier(UI component).
|
|
9
|
+
*/
|
|
10
|
+
render: RenderNotifier<N>;
|
|
11
|
+
/**
|
|
12
|
+
* The method to set attributes or listeners to root.
|
|
13
|
+
*/
|
|
14
|
+
setRoot?: (root: HTMLDivElement) => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The utility factory for `mezzanine` to create a notifier.
|
|
18
|
+
*
|
|
19
|
+
* When APIs are called, Notifier will dynamically render a new react instance by `ReactDOM.render` method.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createNotifier<N extends NotifierData, C extends NotifierConfig = NotifierConfig>(props: CreateNotifierProps<N, C>): Notifier<N, C>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { createRef } from 'react';
|
|
3
|
+
import { render, unmountComponentAtNode } from 'react-dom';
|
|
4
|
+
import NotifierManager from './NotifierManager.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The utility factory for `mezzanine` to create a notifier.
|
|
8
|
+
*
|
|
9
|
+
* When APIs are called, Notifier will dynamically render a new react instance by `ReactDOM.render` method.
|
|
10
|
+
*/
|
|
11
|
+
function createNotifier(props) {
|
|
12
|
+
const { config: configProp, render: renderNotifier, setRoot, duration, maxCount, ...restNotifierProps } = props;
|
|
13
|
+
const root = document.createElement('div');
|
|
14
|
+
const controllerRef = createRef();
|
|
15
|
+
let currentConfig = {
|
|
16
|
+
duration,
|
|
17
|
+
maxCount,
|
|
18
|
+
...configProp,
|
|
19
|
+
};
|
|
20
|
+
if (setRoot) {
|
|
21
|
+
setRoot(root);
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
add(notifier) {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
document.body.appendChild(root);
|
|
27
|
+
const key = (_a = notifier.key) !== null && _a !== void 0 ? _a : Date.now();
|
|
28
|
+
const resolvedNotifier = {
|
|
29
|
+
...restNotifierProps,
|
|
30
|
+
...notifier,
|
|
31
|
+
...currentConfig,
|
|
32
|
+
duration: (_b = notifier.duration) !== null && _b !== void 0 ? _b : currentConfig.duration,
|
|
33
|
+
key,
|
|
34
|
+
instanceKey: key,
|
|
35
|
+
};
|
|
36
|
+
if (controllerRef.current) {
|
|
37
|
+
controllerRef.current.add(resolvedNotifier);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
render((jsx(NotifierManager, { controllerRef: controllerRef, defaultNotifiers: [resolvedNotifier], maxCount: currentConfig.maxCount, render: renderNotifier }, void 0)), root);
|
|
41
|
+
}
|
|
42
|
+
return resolvedNotifier.key;
|
|
43
|
+
},
|
|
44
|
+
remove(key) {
|
|
45
|
+
if (controllerRef.current) {
|
|
46
|
+
controllerRef.current.remove(key);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
destroy() {
|
|
50
|
+
unmountComponentAtNode(root);
|
|
51
|
+
if (root.parentNode) {
|
|
52
|
+
root.parentNode.removeChild(root);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
config(config) {
|
|
56
|
+
currentConfig = {
|
|
57
|
+
...currentConfig,
|
|
58
|
+
...config,
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
getConfig() {
|
|
62
|
+
return currentConfig;
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export { createNotifier };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createNotifier } from './createNotifier.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Key, ReactNode } from 'react';
|
|
2
|
+
export interface NotifierConfig {
|
|
3
|
+
/**
|
|
4
|
+
* If passed as number, the notification will be closed after the amount of time.
|
|
5
|
+
*/
|
|
6
|
+
duration?: number | false;
|
|
7
|
+
maxCount?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface NotifierData extends Pick<NotifierConfig, 'duration'> {
|
|
10
|
+
/**
|
|
11
|
+
* The notification content.
|
|
12
|
+
*/
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Close Handler
|
|
16
|
+
*/
|
|
17
|
+
onClose?: (key: Key) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare type RenderNotifier<N extends NotifierData> = (notifier: N) => ReactNode;
|
|
20
|
+
export interface Notifier<N extends NotifierData, C extends NotifierConfig = NotifierConfig> {
|
|
21
|
+
add: (notifier: N & {
|
|
22
|
+
key?: Key;
|
|
23
|
+
}) => Key;
|
|
24
|
+
config: (configs: C) => void;
|
|
25
|
+
destroy: VoidFunction;
|
|
26
|
+
remove: (key: Key) => void;
|
|
27
|
+
getConfig: () => C;
|
|
28
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { MouseEventHandler } from 'react';
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
+
import { PortalProps } from '../Portal';
|
|
4
|
+
export interface OverlayProps extends Pick<PortalProps, 'children' | 'container' | 'disablePortal'>, NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* Controls whether to disable closing element while backdrop clicked.
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
disableCloseOnBackdropClick?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether to hide backdrop.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
hideBackdrop?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether to set backdrop invisible
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
invisibleBackdrop?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Click handler for backdrop.
|
|
22
|
+
*/
|
|
23
|
+
onBackdropClick?: MouseEventHandler;
|
|
24
|
+
/**
|
|
25
|
+
* Callback fired while the element will be closed.
|
|
26
|
+
*/
|
|
27
|
+
onClose?: VoidFunction;
|
|
28
|
+
/**
|
|
29
|
+
* Overlay is use on top of a component(surface)
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
onSurface?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Controls whether to show the element.
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
open?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The react component for `mezzanine` overlay.
|
|
41
|
+
*/
|
|
42
|
+
declare const Overlay: import("react").ForwardRefExoticComponent<OverlayProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
43
|
+
export default Overlay;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { overlayClasses } from '@mezzanine-ui/core/overlay';
|
|
4
|
+
import Portal from '../Portal/Portal.js';
|
|
5
|
+
import Fade from '../Transition/Fade.js';
|
|
6
|
+
import cx from 'clsx';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The react component for `mezzanine` overlay.
|
|
10
|
+
*/
|
|
11
|
+
const Overlay = forwardRef(function Overlay(props, ref) {
|
|
12
|
+
const { children, className, container, disableCloseOnBackdropClick = false, disablePortal, hideBackdrop = false, invisibleBackdrop = false, onBackdropClick, onClose, onSurface, open = false, ...rest } = props;
|
|
13
|
+
const fixedAtBody = Boolean(!container);
|
|
14
|
+
return (jsx(Portal, Object.assign({ container: container, disablePortal: disablePortal }, { children: jsxs("div", Object.assign({}, rest, { ref: ref, className: cx(overlayClasses.host, {
|
|
15
|
+
[overlayClasses.hostFixed]: fixedAtBody,
|
|
16
|
+
[overlayClasses.hostOpen]: open,
|
|
17
|
+
}, className) }, { children: [hideBackdrop ? null : (jsx(Fade, Object.assign({ in: open }, { children: jsx("div", { "aria-hidden": true, className: cx(overlayClasses.backdrop, {
|
|
18
|
+
[overlayClasses.backdropFixed]: fixedAtBody,
|
|
19
|
+
[overlayClasses.invisible]: invisibleBackdrop,
|
|
20
|
+
[overlayClasses.backdropOnSurface]: onSurface,
|
|
21
|
+
}), onClick: (event) => {
|
|
22
|
+
if (!disableCloseOnBackdropClick && onClose) {
|
|
23
|
+
onClose();
|
|
24
|
+
}
|
|
25
|
+
if (onBackdropClick) {
|
|
26
|
+
onBackdropClick(event);
|
|
27
|
+
}
|
|
28
|
+
} }, void 0) }), void 0)), children] }), void 0) }), void 0));
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export default Overlay;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { OverlayProps, default, } from './Overlay';
|
package/Overlay/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Overlay.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ConfirmActionsProps } from '../ConfirmActions';
|
|
3
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
|
+
export interface PageFooterProps extends NativeElementPropsWithoutKeyAndRef<'footer'>, Pick<ConfirmActionsProps, 'cancelButtonProps' | 'cancelText' | 'confirmButtonProps' | 'confirmText' | 'danger' | 'loading' | 'hideCancelButton' | 'hideConfirmButton' | 'onCancel' | 'onConfirm'> {
|
|
5
|
+
/**
|
|
6
|
+
* The className of action wrapper.
|
|
7
|
+
*/
|
|
8
|
+
actionClassName?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The action element in the left.
|
|
11
|
+
*/
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
declare const PageFooter: import("react").ForwardRefExoticComponent<PageFooterProps & import("react").RefAttributes<HTMLElement>>;
|
|
15
|
+
export default PageFooter;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { pageFooterClasses } from '@mezzanine-ui/core/page-footer';
|
|
4
|
+
import ConfirmActions from '../ConfirmActions/ConfirmActions.js';
|
|
5
|
+
import cx from 'clsx';
|
|
6
|
+
|
|
7
|
+
const PageFooter = forwardRef(function PageFooter(props, ref) {
|
|
8
|
+
const { className, actionClassName, cancelButtonProps, cancelText, children, danger, loading, confirmButtonProps, confirmText, hideCancelButton, hideConfirmButton, onCancel, onConfirm, ...rest } = props;
|
|
9
|
+
return (jsxs("footer", Object.assign({ ref: ref }, rest, { className: cx(pageFooterClasses.host, className) }, { children: [jsx("div", Object.assign({ className: actionClassName }, { children: children }), void 0),
|
|
10
|
+
jsx(ConfirmActions, { cancelText: cancelText, confirmText: confirmText, cancelButtonProps: cancelButtonProps, confirmButtonProps: confirmButtonProps, danger: danger, hideCancelButton: hideCancelButton, hideConfirmButton: hideConfirmButton, loading: loading, onCancel: onCancel, onConfirm: onConfirm }, void 0)] }), void 0));
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export default PageFooter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PageFooterProps, default } from './PageFooter';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './PageFooter.js';
|