@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,104 @@
|
|
|
1
|
+
import { toSliderCssVars, getPercentage, isRangeSlider, sortSliderValue, findClosetValueIndex, getSliderRect, getValueFromClientX, roundToStep } from '@mezzanine-ui/core/slider';
|
|
2
|
+
import { useRef, useState } from 'react';
|
|
3
|
+
import { useDocumentEvents } from '../hooks/useDocumentEvents.js';
|
|
4
|
+
|
|
5
|
+
function useSlider(props) {
|
|
6
|
+
const { max, min, onChange, step, value, } = props;
|
|
7
|
+
const railRef = useRef(null);
|
|
8
|
+
const [anchorValue, setAnchorValue] = useState(undefined);
|
|
9
|
+
const [dragging, setDragging] = useState(false);
|
|
10
|
+
function getActiveIndex() {
|
|
11
|
+
if (typeof anchorValue !== 'number') {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
return isRangeSlider(value) ? Math.abs(1 - value.indexOf(anchorValue)) : undefined;
|
|
15
|
+
}
|
|
16
|
+
const cssVars = toSliderCssVars({
|
|
17
|
+
trackWidth: getPercentage(isRangeSlider(value) ? Math.abs(value[0] - value[1]) : value, min, max),
|
|
18
|
+
trackPosition: getPercentage(isRangeSlider(value) ? Math.abs(Math.min(...value) - min) : 0, min, max),
|
|
19
|
+
handlerPosition: getPercentage(isRangeSlider(value) ? 0 : value, min, max),
|
|
20
|
+
handlerStartPosition: getPercentage(isRangeSlider(value) ? Math.abs(Math.min(...value) - min) : value, min, max),
|
|
21
|
+
handlerEndPosition: getPercentage(isRangeSlider(value) ? Math.abs(Math.max(...value) - min) : value, min, max),
|
|
22
|
+
});
|
|
23
|
+
const getRoundedNewValue = (e, railElement) => {
|
|
24
|
+
const clientX = e.type === 'touchmove' ? e.changedTouches[0].clientX : e.clientX;
|
|
25
|
+
const trackDims = getSliderRect(railElement);
|
|
26
|
+
const newValue = getValueFromClientX(clientX, trackDims, min, max);
|
|
27
|
+
const roundedNewValue = roundToStep(newValue, step, min, max);
|
|
28
|
+
return roundedNewValue;
|
|
29
|
+
};
|
|
30
|
+
const handlePress = (e, index) => {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
setDragging(true);
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
34
|
+
setAnchorValue(isRangeSlider(value) ? value[Math.abs(1 - index)] : value);
|
|
35
|
+
};
|
|
36
|
+
const handleDrag = onChange ? (e) => {
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
const { current: railElement } = railRef;
|
|
39
|
+
if (!railElement)
|
|
40
|
+
return;
|
|
41
|
+
const roundedNewValue = getRoundedNewValue(e, railElement);
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
43
|
+
const activeIndex = getActiveIndex();
|
|
44
|
+
if (isRangeSlider(value)) {
|
|
45
|
+
const newValue = [
|
|
46
|
+
...value.slice(0, activeIndex),
|
|
47
|
+
roundedNewValue,
|
|
48
|
+
...value.slice(activeIndex + 1),
|
|
49
|
+
];
|
|
50
|
+
onChange(sortSliderValue(newValue));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
onChange(roundedNewValue);
|
|
54
|
+
} : undefined;
|
|
55
|
+
const handleDragEnd = (e) => {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
setDragging(false);
|
|
58
|
+
setAnchorValue(undefined);
|
|
59
|
+
};
|
|
60
|
+
const handleClickTrackOrRail = onChange ? (e) => {
|
|
61
|
+
setDragging(true);
|
|
62
|
+
const { current: railElement } = railRef;
|
|
63
|
+
if (!railElement)
|
|
64
|
+
return;
|
|
65
|
+
const roundedNewValue = getRoundedNewValue(e, railElement);
|
|
66
|
+
const closetHandlerIndex = findClosetValueIndex(value, roundedNewValue);
|
|
67
|
+
if (isRangeSlider(value)) {
|
|
68
|
+
setAnchorValue(value[Math.abs(1 - closetHandlerIndex)]);
|
|
69
|
+
const newValue = [
|
|
70
|
+
...value.slice(0, closetHandlerIndex),
|
|
71
|
+
roundedNewValue,
|
|
72
|
+
...value.slice(closetHandlerIndex + 1),
|
|
73
|
+
];
|
|
74
|
+
onChange(sortSliderValue(newValue));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
onChange(roundedNewValue);
|
|
78
|
+
} : undefined;
|
|
79
|
+
useDocumentEvents(() => (dragging
|
|
80
|
+
? {
|
|
81
|
+
mousemove: handleDrag,
|
|
82
|
+
touchmove: handleDrag,
|
|
83
|
+
mouseleave: handleDragEnd,
|
|
84
|
+
mouseup: handleDragEnd,
|
|
85
|
+
touchend: handleDragEnd,
|
|
86
|
+
touchcancel: handleDragEnd,
|
|
87
|
+
}
|
|
88
|
+
: undefined), [
|
|
89
|
+
dragging,
|
|
90
|
+
min,
|
|
91
|
+
max,
|
|
92
|
+
step,
|
|
93
|
+
onChange,
|
|
94
|
+
]);
|
|
95
|
+
return {
|
|
96
|
+
activeHandleIndex: getActiveIndex(),
|
|
97
|
+
cssVars,
|
|
98
|
+
handleClickTrackOrRail,
|
|
99
|
+
handlePress,
|
|
100
|
+
railRef,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { useSlider };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IconProps } from '../Icon';
|
|
3
|
+
import { TypographyProps } from '../Typography';
|
|
4
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
5
|
+
export interface StepProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'title'> {
|
|
6
|
+
/**
|
|
7
|
+
* Mark the step as active. automatically set by `activeStep` of `Stepper`.
|
|
8
|
+
*/
|
|
9
|
+
active?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Mark the step as completed. automatically set by `activeStep` of `Stepper`.
|
|
12
|
+
*/
|
|
13
|
+
completed?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Step icon props. effective only when the step is completed.
|
|
16
|
+
* @default 'icon: CheckIcon'
|
|
17
|
+
*/
|
|
18
|
+
completedIconProps?: IconProps;
|
|
19
|
+
/**
|
|
20
|
+
* Mark the step as disabled. automatically set by `activeStep` of `Stepper`.
|
|
21
|
+
*/
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Step index. automatically set by the parent <Stepper />.
|
|
25
|
+
*/
|
|
26
|
+
index?: number;
|
|
27
|
+
/**
|
|
28
|
+
* The step label on the right side of the icon, visible if value is not empty.
|
|
29
|
+
*/
|
|
30
|
+
title?: string;
|
|
31
|
+
/**
|
|
32
|
+
* title typography props.
|
|
33
|
+
* @default 'variant: button2'
|
|
34
|
+
*/
|
|
35
|
+
titleProps?: Omit<TypographyProps, 'children'>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The react component for `mezzanine` step.
|
|
39
|
+
*/
|
|
40
|
+
declare const Step: import("react").ForwardRefExoticComponent<StepProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
41
|
+
export default Step;
|
package/Stepper/Step.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { stepClasses } from '@mezzanine-ui/core/stepper';
|
|
4
|
+
import { CheckIcon } from '@mezzanine-ui/icons';
|
|
5
|
+
import Typography from '../Typography/Typography.js';
|
|
6
|
+
import Icon from '../Icon/Icon.js';
|
|
7
|
+
import cx from 'clsx';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The react component for `mezzanine` step.
|
|
11
|
+
*/
|
|
12
|
+
const Step = forwardRef(function Step(props, ref) {
|
|
13
|
+
const { active, children, className, completed, completedIconProps, disabled, index = -1, title, titleProps, ...rest } = props;
|
|
14
|
+
/** icon and step number */
|
|
15
|
+
const iconRender = (jsx(Typography, Object.assign({ className: stepClasses.iconBackground, variant: "button3" }, { children: completed ? (jsx(Icon, Object.assign({ className: stepClasses.completedIcon, icon: CheckIcon }, completedIconProps), void 0)) : index + 1 }), void 0));
|
|
16
|
+
return (jsxs("div", Object.assign({ className: cx(stepClasses.host, disabled && stepClasses.disabled, className), ref: ref }, rest, { children: [iconRender, /** title (optional) */ title && (jsx(Typography, Object.assign({ className: stepClasses.title, variant: "button2" }, titleProps, { children: title }), void 0)), children] }), void 0));
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export default Step;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
+
export interface StepperProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
4
|
+
/**
|
|
5
|
+
* Set the active step (zero based index) and set other `<Step />` to completed or disabled depending on index.
|
|
6
|
+
* Set to -1 to disable all the steps.
|
|
7
|
+
* @default -1
|
|
8
|
+
*/
|
|
9
|
+
activeStep?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Two or more `<Step />` components.
|
|
12
|
+
*/
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The react component for `mezzanine` stepper.
|
|
17
|
+
*/
|
|
18
|
+
declare const Stepper: import("react").ForwardRefExoticComponent<StepperProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export default Stepper;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, Children, cloneElement } from 'react';
|
|
3
|
+
import { stepperClasses } from '@mezzanine-ui/core/stepper';
|
|
4
|
+
import cx from 'clsx';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The react component for `mezzanine` stepper.
|
|
8
|
+
*/
|
|
9
|
+
const Stepper = forwardRef(function Stepper(props, ref) {
|
|
10
|
+
const { activeStep = -1, children, className, ...rest } = props;
|
|
11
|
+
const childrenArray = Children.toArray(children);
|
|
12
|
+
const stepsWithState = childrenArray.map((element, index) => {
|
|
13
|
+
const step = element;
|
|
14
|
+
const state = {
|
|
15
|
+
index,
|
|
16
|
+
active: activeStep === index,
|
|
17
|
+
completed: activeStep > index,
|
|
18
|
+
disabled: activeStep < index,
|
|
19
|
+
};
|
|
20
|
+
if (step.props.active || step.props.disabled || step.props.completed) {
|
|
21
|
+
state.active = false;
|
|
22
|
+
state.completed = false;
|
|
23
|
+
state.disabled = false;
|
|
24
|
+
}
|
|
25
|
+
return cloneElement(step, {
|
|
26
|
+
...state,
|
|
27
|
+
...step.props,
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
return (jsx("div", Object.assign({ className: cx(stepperClasses.host, className), ref: ref }, rest, { children: stepsWithState }), void 0));
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export default Stepper;
|
package/Stepper/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ChangeEventHandler } from 'react';
|
|
2
|
+
import { SwitchSize } from '@mezzanine-ui/core/switch';
|
|
3
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
|
+
export interface SwitchProps extends Omit<NativeElementPropsWithoutKeyAndRef<'span'>, 'onChange'> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the switch is checked.
|
|
7
|
+
*/
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the switch is checked by default.
|
|
11
|
+
* Only used for uncontrolled.
|
|
12
|
+
*/
|
|
13
|
+
defaultChecked?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the switch is disabled.
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Since at Mezzanine we use a host element to wrap our input, most derived props will be passed to the host element.
|
|
21
|
+
* If you need direct control to the input element, use this prop to provide to it.
|
|
22
|
+
*/
|
|
23
|
+
inputProps?: Omit<NativeElementPropsWithoutKeyAndRef<'input'>, 'checked' | 'defaultChecked' | 'disabled' | 'onChange' | 'placeholder' | 'type' | 'value' | `aria-${'disabled' | 'checked'}`>;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the switch is loading.
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
loading?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Invoked by input change event.
|
|
31
|
+
*/
|
|
32
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
33
|
+
/**
|
|
34
|
+
* The size of switch.
|
|
35
|
+
* @default 'medium'
|
|
36
|
+
*/
|
|
37
|
+
size?: SwitchSize;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The react component for `mezzanine` switch.
|
|
41
|
+
*/
|
|
42
|
+
declare const Switch: import("react").ForwardRefExoticComponent<SwitchProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
43
|
+
export default Switch;
|
package/Switch/Switch.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext } from 'react';
|
|
3
|
+
import { switchClasses, SwitchSpinnerIcon } from '@mezzanine-ui/core/switch';
|
|
4
|
+
import { useSwitchControlValue } from '../Form/useSwitchControlValue.js';
|
|
5
|
+
import { FormControlContext } from '../Form/FormControlContext.js';
|
|
6
|
+
import Icon from '../Icon/Icon.js';
|
|
7
|
+
import cx from 'clsx';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The react component for `mezzanine` switch.
|
|
11
|
+
*/
|
|
12
|
+
const Switch = forwardRef(function Switch(props, ref) {
|
|
13
|
+
const { disabled: disabledFromFormControl, } = useContext(FormControlContext) || {};
|
|
14
|
+
const { checked: checkedProp, className, defaultChecked, disabled: disabledProp = disabledFromFormControl, inputProps, loading = false, onChange: onChangeProp, size = 'medium', ...rest } = props;
|
|
15
|
+
const [checked, onChange] = useSwitchControlValue({
|
|
16
|
+
checked: checkedProp,
|
|
17
|
+
defaultChecked,
|
|
18
|
+
onChange: onChangeProp,
|
|
19
|
+
});
|
|
20
|
+
const disabled = loading || disabledProp;
|
|
21
|
+
return (jsxs("span", Object.assign({ ref: ref }, rest, { className: cx(switchClasses.host, {
|
|
22
|
+
[switchClasses.checked]: checked,
|
|
23
|
+
[switchClasses.disabled]: disabled,
|
|
24
|
+
[switchClasses.large]: size === 'large',
|
|
25
|
+
}, className) }, { children: [jsx("span", Object.assign({ className: switchClasses.control }, { children: loading && jsx(Icon, { icon: SwitchSpinnerIcon, spin: true }, void 0) }), void 0),
|
|
26
|
+
jsx("input", Object.assign({}, inputProps, { "aria-checked": checked, "aria-disabled": disabled, checked: checked, className: switchClasses.input, disabled: disabled, onChange: onChange, type: "checkbox" }), void 0)] }), void 0));
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export default Switch;
|
package/Switch/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Switch.js';
|
package/Table/Table.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TableColumn, TableComponents, TableDataSource, TableRowSelection, TableExpandable, TableFetchMore, TablePagination as TablePaginationType, TableRefresh as TableRefreshType } from '@mezzanine-ui/core/table';
|
|
3
|
+
import { EmptyProps } from '../Empty';
|
|
4
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
5
|
+
export interface TableProps<T> extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'role'> {
|
|
6
|
+
/**
|
|
7
|
+
* customized body className
|
|
8
|
+
*/
|
|
9
|
+
bodyClassName?: string;
|
|
10
|
+
/**
|
|
11
|
+
* customized body row className
|
|
12
|
+
*/
|
|
13
|
+
bodyRowClassName?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Columns of table <br />
|
|
16
|
+
* `column.render` allowed customizing the column body cell rendering. <br />
|
|
17
|
+
* `column.renderTitle` allowed customizing the column header cell rendering. <br />
|
|
18
|
+
* `column.sorter` is the sorting method that you want to apply to your column. <br />
|
|
19
|
+
* `column.onSorted` is the callback triggered whenever sort icon clicked.
|
|
20
|
+
*/
|
|
21
|
+
columns: TableColumn<T>[];
|
|
22
|
+
/**
|
|
23
|
+
* Custom table components <br />
|
|
24
|
+
*/
|
|
25
|
+
components?: TableComponents;
|
|
26
|
+
/**
|
|
27
|
+
* Data record array to be displayed. <br />
|
|
28
|
+
* Notice that each source should contain `key` or `id` prop as data primary key.
|
|
29
|
+
*/
|
|
30
|
+
dataSource: TableDataSource[];
|
|
31
|
+
/**
|
|
32
|
+
* props exported from `<Empty />` component.
|
|
33
|
+
*/
|
|
34
|
+
emptyProps?: EmptyProps;
|
|
35
|
+
/**
|
|
36
|
+
* When `expandable.rowExpandable` is given, it will control whether row data is expandable or not
|
|
37
|
+
* `expandable.expandedRowRender` is a callback to helps you decides what data should be rendered.
|
|
38
|
+
*/
|
|
39
|
+
expandable?: TableExpandable<T>;
|
|
40
|
+
/**
|
|
41
|
+
* If `fetchMore.callback` is given, table will automatically trigger it when scrolling position reach end. <br />
|
|
42
|
+
* If `fetchMore.isReachEnd` is true, table will stop triggering callback. <br />
|
|
43
|
+
* If `fetchMore.isFetching` is true, a loading spinner will display at the end of table and stop triggering callback.
|
|
44
|
+
* <br />
|
|
45
|
+
* Notice that when `fetchMore.isFetching` is `undefined`, table will take control of it when source length changed.
|
|
46
|
+
*/
|
|
47
|
+
fetchMore?: TableFetchMore;
|
|
48
|
+
/**
|
|
49
|
+
* customized header className
|
|
50
|
+
*/
|
|
51
|
+
headerClassName?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Whether table is loading or not
|
|
54
|
+
*/
|
|
55
|
+
loading?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* `pagination.show` controls pagination display. <br />
|
|
58
|
+
* `pagination.current` is the current page number. <br />
|
|
59
|
+
* `pagination.onChange` is the callback when page number changed. <br />
|
|
60
|
+
* `pagination.total` is the total amount of your data. <br />
|
|
61
|
+
* `pagination.options` is the <Pagination /> component props. <br />
|
|
62
|
+
* Notice that if `pagination` object is given, table will disable fetchMore and use pagination instead.
|
|
63
|
+
*/
|
|
64
|
+
pagination?: TablePaginationType;
|
|
65
|
+
/**
|
|
66
|
+
* `refresh.show` is true, refresh button will display at the top-start of table. <br />
|
|
67
|
+
* `refresh.onClick` is the callback of the refresh button.
|
|
68
|
+
*/
|
|
69
|
+
refresh?: TableRefreshType;
|
|
70
|
+
/**
|
|
71
|
+
* Enable row selection feature <br />
|
|
72
|
+
* `rowSelection.selectedRowKey` is the dataSource keys that are currently selected. <br />
|
|
73
|
+
* `rowSelection.onChange` is the callback when selection changed. <br />
|
|
74
|
+
* `rowSelection.actions` are the actions that you want to do for selected data.
|
|
75
|
+
*/
|
|
76
|
+
rowSelection?: TableRowSelection;
|
|
77
|
+
}
|
|
78
|
+
declare const Table: import("react").ForwardRefExoticComponent<TableProps<Record<string, unknown>> & import("react").RefAttributes<HTMLDivElement>>;
|
|
79
|
+
export default Table;
|
package/Table/Table.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useRef, useMemo } from 'react';
|
|
3
|
+
import { tableClasses } from '@mezzanine-ui/core/table';
|
|
4
|
+
import { TableContext, TableDataContext, TableComponentContext } from './TableContext.js';
|
|
5
|
+
import TableHeader from './TableHeader.js';
|
|
6
|
+
import TableBody from './TableBody.js';
|
|
7
|
+
import TablePagination from './pagination/TablePagination.js';
|
|
8
|
+
import TableRefresh from './refresh/TableRefresh.js';
|
|
9
|
+
import { useTableRowSelection } from './rowSelection/useTableRowSelection.js';
|
|
10
|
+
import { useTableSorting } from './sorting/useTableSorting.js';
|
|
11
|
+
import { useTableLoading } from './useTableLoading.js';
|
|
12
|
+
import { useTableFetchMore } from './useTableFetchMore.js';
|
|
13
|
+
import Loading from '../Loading/Loading.js';
|
|
14
|
+
import cx from 'clsx';
|
|
15
|
+
|
|
16
|
+
const Table = forwardRef(function Table(props, ref) {
|
|
17
|
+
var _a;
|
|
18
|
+
const { bodyClassName, bodyRowClassName, className, columns, components, dataSource: dataSourceProp, emptyProps, expandable: expandableProp, fetchMore: fetchMoreProp, headerClassName, loading: loadingProp, pagination: paginationProp, refresh: refreshProp, rowSelection: rowSelectionProp, ...rest } = props;
|
|
19
|
+
const bodyRef = useRef(null);
|
|
20
|
+
/** Feature rowSelection */
|
|
21
|
+
const [selectedRowKeys, setSelectedRowKey] = useTableRowSelection({
|
|
22
|
+
selectedRowKey: rowSelectionProp === null || rowSelectionProp === void 0 ? void 0 : rowSelectionProp.selectedRowKey,
|
|
23
|
+
onChange: rowSelectionProp === null || rowSelectionProp === void 0 ? void 0 : rowSelectionProp.onChange,
|
|
24
|
+
dataSource: dataSourceProp,
|
|
25
|
+
});
|
|
26
|
+
const rowSelection = useMemo(() => (rowSelectionProp ? {
|
|
27
|
+
selectedRowKeys,
|
|
28
|
+
onChange: setSelectedRowKey,
|
|
29
|
+
actions: rowSelectionProp.actions,
|
|
30
|
+
} : undefined), [
|
|
31
|
+
rowSelectionProp,
|
|
32
|
+
selectedRowKeys,
|
|
33
|
+
setSelectedRowKey,
|
|
34
|
+
]);
|
|
35
|
+
/** Feature sorting */
|
|
36
|
+
const [dataSource, onSort, { sortedOn, sortedType, onResetAll }] = useTableSorting({
|
|
37
|
+
dataSource: dataSourceProp,
|
|
38
|
+
});
|
|
39
|
+
/** Feature loading */
|
|
40
|
+
const [loading, setLoading] = useTableLoading({
|
|
41
|
+
loading: loadingProp,
|
|
42
|
+
});
|
|
43
|
+
/** Feature fetchMore */
|
|
44
|
+
const { fetchMore: onFetchMore, isFetching, isReachEnd, } = useTableFetchMore({
|
|
45
|
+
callback: fetchMoreProp === null || fetchMoreProp === void 0 ? void 0 : fetchMoreProp.callback,
|
|
46
|
+
dataSource,
|
|
47
|
+
/** when pagination is given, fetchMore feature should be disabled */
|
|
48
|
+
disabled: !!paginationProp,
|
|
49
|
+
isReachEnd: fetchMoreProp === null || fetchMoreProp === void 0 ? void 0 : fetchMoreProp.isReachEnd,
|
|
50
|
+
isFetching: fetchMoreProp === null || fetchMoreProp === void 0 ? void 0 : fetchMoreProp.isFetching,
|
|
51
|
+
});
|
|
52
|
+
/** Feature refresh */
|
|
53
|
+
const isRefreshShow = useMemo(() => {
|
|
54
|
+
var _a;
|
|
55
|
+
return ((_a =
|
|
56
|
+
/** @default false */
|
|
57
|
+
refreshProp === null ||
|
|
58
|
+
/** @default false */
|
|
59
|
+
refreshProp === void 0 ? void 0 :
|
|
60
|
+
/** @default false */
|
|
61
|
+
refreshProp.show) !== null && _a !== void 0 ? _a : false);
|
|
62
|
+
}, [refreshProp === null || refreshProp === void 0 ? void 0 : refreshProp.show]);
|
|
63
|
+
/** context */
|
|
64
|
+
const tableContextValue = useMemo(() => ({
|
|
65
|
+
scrollBarSize: 4,
|
|
66
|
+
emptyProps,
|
|
67
|
+
rowSelection,
|
|
68
|
+
sorting: {
|
|
69
|
+
onSort,
|
|
70
|
+
onResetAll,
|
|
71
|
+
sortedOn,
|
|
72
|
+
sortedType,
|
|
73
|
+
},
|
|
74
|
+
loading,
|
|
75
|
+
setLoading,
|
|
76
|
+
expanding: expandableProp,
|
|
77
|
+
fetchMore: onFetchMore ? {
|
|
78
|
+
onFetchMore,
|
|
79
|
+
isFetching,
|
|
80
|
+
isReachEnd,
|
|
81
|
+
} : undefined,
|
|
82
|
+
pagination: paginationProp,
|
|
83
|
+
}), [
|
|
84
|
+
emptyProps,
|
|
85
|
+
expandableProp,
|
|
86
|
+
rowSelection,
|
|
87
|
+
onSort,
|
|
88
|
+
onResetAll,
|
|
89
|
+
sortedOn,
|
|
90
|
+
sortedType,
|
|
91
|
+
loading,
|
|
92
|
+
setLoading,
|
|
93
|
+
onFetchMore,
|
|
94
|
+
isFetching,
|
|
95
|
+
isReachEnd,
|
|
96
|
+
paginationProp,
|
|
97
|
+
]);
|
|
98
|
+
const tableDataContextValue = {
|
|
99
|
+
columns,
|
|
100
|
+
dataSource,
|
|
101
|
+
};
|
|
102
|
+
const tableComponentContextValue = {
|
|
103
|
+
bodyCell: (_a = components === null || components === void 0 ? void 0 : components.body) === null || _a === void 0 ? void 0 : _a.cell,
|
|
104
|
+
};
|
|
105
|
+
return (jsx(Loading, Object.assign({ loading: loading, stretch: true, tip: "\u8CC7\u6599\u8F09\u5165\u4E2D..." }, { children: jsx("div", Object.assign({ ref: ref }, rest, { className: cx(tableClasses.host, className), role: "grid" }, { children: jsx(TableContext.Provider, Object.assign({ value: tableContextValue }, { children: jsx(TableDataContext.Provider, Object.assign({ value: tableDataContextValue }, { children: jsxs(TableComponentContext.Provider, Object.assign({ value: tableComponentContextValue }, { children: [isRefreshShow ? (jsx(TableRefresh, { onClick: refreshProp.onClick }, void 0)) : null,
|
|
106
|
+
jsx(TableHeader, { className: headerClassName }, void 0),
|
|
107
|
+
jsx(TableBody, { ref: bodyRef, className: bodyClassName, rowClassName: bodyRowClassName }, void 0),
|
|
108
|
+
(paginationProp === null || paginationProp === void 0 ? void 0 : paginationProp.show) ? (jsx(TablePagination, { bodyRef: bodyRef }, void 0)) : null] }), void 0) }), void 0) }), void 0) }), void 0) }), void 0));
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
export default Table;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
+
export interface TableBodyProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
4
|
+
/**
|
|
5
|
+
* customize row className
|
|
6
|
+
*/
|
|
7
|
+
rowClassName?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const TableBody: import("react").ForwardRefExoticComponent<TableBodyProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export default TableBody;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext } from 'react';
|
|
3
|
+
import { tableClasses } from '@mezzanine-ui/core/table';
|
|
4
|
+
import { useComposeRefs } from '../hooks/useComposeRefs.js';
|
|
5
|
+
import useTableScroll from './useTableScroll.js';
|
|
6
|
+
import { TableDataContext, TableContext } from './TableContext.js';
|
|
7
|
+
import TableBodyRow from './TableBodyRow.js';
|
|
8
|
+
import Loading from '../Loading/Loading.js';
|
|
9
|
+
import Empty from '../Empty/Empty.js';
|
|
10
|
+
import cx from 'clsx';
|
|
11
|
+
|
|
12
|
+
const TableBody = forwardRef(function TableBody(props, ref) {
|
|
13
|
+
const { className, rowClassName, ...rest } = props;
|
|
14
|
+
const { dataSource = [], } = useContext(TableDataContext) || {};
|
|
15
|
+
const { emptyProps, scrollBarSize, fetchMore, } = useContext(TableContext) || {};
|
|
16
|
+
const [tableBody, scrollElement] = useTableScroll();
|
|
17
|
+
const composedRefs = useComposeRefs([ref, tableBody.ref]);
|
|
18
|
+
/** customizing empty */
|
|
19
|
+
const { className: emptyComponentClassName = '', children: emptyComponentChildren = '查無資料', fullHeight: emptyComponentFullHeight = true, ...restEmptyProps } = emptyProps || {};
|
|
20
|
+
return (jsxs("div", Object.assign({}, rest, { ref: composedRefs, className: cx(tableClasses.body, className), onScroll: tableBody.onScroll, role: "rowgroup" }, { children: [dataSource.length ? dataSource.map((rowData) => (jsx(TableBodyRow, { className: rowClassName, rowData: rowData }, (rowData.key || rowData.id)))) : (jsx(Empty, Object.assign({}, restEmptyProps, { className: cx(tableClasses.bodyEmpty, emptyComponentClassName), fullHeight: emptyComponentFullHeight }, { children: emptyComponentChildren }), void 0)),
|
|
21
|
+
(fetchMore === null || fetchMore === void 0 ? void 0 : fetchMore.isFetching) ? (jsx("div", Object.assign({ className: tableClasses.bodyFetchMore }, { children: jsx(Loading, { loading: true }, void 0) }), void 0)) : null,
|
|
22
|
+
jsx("div", Object.assign({ ref: scrollElement.ref, onMouseDown: scrollElement.onMouseDown, onMouseUp: scrollElement.onMouseUp, onMouseEnter: scrollElement.onMouseEnter, onMouseLeave: scrollElement.onMouseLeave, role: "button", style: scrollElement.style, tabIndex: -1 }, { children: jsx("div", { style: {
|
|
23
|
+
width: `${scrollBarSize}px`,
|
|
24
|
+
height: '100%',
|
|
25
|
+
borderRadius: '10px',
|
|
26
|
+
backgroundColor: '#7d7d7d',
|
|
27
|
+
transition: '0.1s',
|
|
28
|
+
} }, void 0) }), void 0)] }), void 0));
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export default TableBody;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TableDataSource } from '@mezzanine-ui/core/table';
|
|
3
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
|
+
export interface TableBodyRowProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* table body row dataSource
|
|
7
|
+
*/
|
|
8
|
+
rowData: TableDataSource;
|
|
9
|
+
}
|
|
10
|
+
declare const TableBodyRow: import("react").ForwardRefExoticComponent<TableBodyRowProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export default TableBodyRow;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext, useState, useMemo, useCallback, Fragment } from 'react';
|
|
3
|
+
import { tableClasses } from '@mezzanine-ui/core/table';
|
|
4
|
+
import { TableContext, TableDataContext } from './TableContext.js';
|
|
5
|
+
import TableCell from './TableCell.js';
|
|
6
|
+
import TableRowSelection from './rowSelection/TableRowSelection.js';
|
|
7
|
+
import TableExpandable from './expandable/TableExpandable.js';
|
|
8
|
+
import TableEditRenderWrapper from './editable/TableEditRenderWrapper.js';
|
|
9
|
+
import AccordionDetails from '../Accordion/AccordionDetails.js';
|
|
10
|
+
import cx from 'clsx';
|
|
11
|
+
|
|
12
|
+
const TableBodyRow = forwardRef(function TableBodyRow(props, ref) {
|
|
13
|
+
const { className, rowData, ...rest } = props;
|
|
14
|
+
const { rowSelection, expanding, } = useContext(TableContext) || {};
|
|
15
|
+
const { columns, } = useContext(TableDataContext) || {};
|
|
16
|
+
/** Feature rowSelection */
|
|
17
|
+
const [selected, setSelected] = useState(false);
|
|
18
|
+
/** Feature expandable */
|
|
19
|
+
const [expanded, setExpanded] = useState(false);
|
|
20
|
+
const isExpandable = useMemo(() => {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
return ((_b = (_a = expanding === null || expanding === void 0 ? void 0 : expanding.rowExpandable) === null || _a === void 0 ? void 0 : _a.call(expanding, rowData)) !== null && _b !== void 0 ? _b : false);
|
|
23
|
+
}, [expanding, rowData]);
|
|
24
|
+
const renderedExpandedContent = useMemo(() => {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
return ((_b = (_a = expanding === null || expanding === void 0 ? void 0 : expanding.expandedRowRender) === null || _a === void 0 ? void 0 : _a.call(expanding, rowData)) !== null && _b !== void 0 ? _b : null);
|
|
27
|
+
}, [expanding, rowData]);
|
|
28
|
+
/** styling */
|
|
29
|
+
const getColumnStyle = useCallback((column) => {
|
|
30
|
+
let style = {};
|
|
31
|
+
if (column.width) {
|
|
32
|
+
style = {
|
|
33
|
+
...style,
|
|
34
|
+
width: column.width,
|
|
35
|
+
maxWidth: column.width,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return style;
|
|
39
|
+
}, []);
|
|
40
|
+
const getCellStyle = useCallback((column) => {
|
|
41
|
+
let style = {};
|
|
42
|
+
if (column.align) {
|
|
43
|
+
style = {
|
|
44
|
+
...style,
|
|
45
|
+
justifyContent: column.align === 'center' ? column.align : `flex-${column.align}`,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return style;
|
|
49
|
+
}, []);
|
|
50
|
+
return (jsxs(Fragment, { children: [jsxs("div", Object.assign({}, rest, { ref: ref, className: cx(tableClasses.bodyRow, {
|
|
51
|
+
[tableClasses.bodyRowHighlight]: selected || expanded,
|
|
52
|
+
}, className), role: "row" }, { children: [rowSelection ? (jsx(TableRowSelection, { role: "gridcell", rowKey: (rowData.key || rowData.id), setChecked: (status) => setSelected(status), showDropdownIcon: false }, void 0)) : null,
|
|
53
|
+
expanding ? (jsx(TableExpandable, { expandable: isExpandable, expanded: expanded, role: "gridcell", setExpanded: setExpanded }, void 0)) : null,
|
|
54
|
+
(columns !== null && columns !== void 0 ? columns : []).map((column, index) => {
|
|
55
|
+
var _a, _b, _c, _d;
|
|
56
|
+
const ellipsis = !!(rowData[column.dataIndex]) && ((_a = column.ellipsis) !== null && _a !== void 0 ? _a : true);
|
|
57
|
+
const tooltipTitle = ((_c = (_b = column.renderTooltipTitle) === null || _b === void 0 ? void 0 : _b.call(column, rowData)) !== null && _c !== void 0 ? _c : rowData[column.dataIndex]);
|
|
58
|
+
return (jsx("div", Object.assign({ className: cx(tableClasses.bodyRowCellWrapper, column.bodyClassName), style: getColumnStyle(column) }, { children: jsx(TableEditRenderWrapper, Object.assign({}, column, { rowData: rowData }, { children: jsx(TableCell, Object.assign({ ellipsis: ellipsis, forceShownTooltipWhenHovered: column.forceShownTooltipWhenHovered, style: getCellStyle(column), tooltipTitle: tooltipTitle }, { children: ((_d = column.render) === null || _d === void 0 ? void 0 : _d.call(column, column, rowData, index)) || rowData[column.dataIndex] }), void 0) }), void 0) }), `${column.dataIndex}-${column.title}`));
|
|
59
|
+
})] }), void 0),
|
|
60
|
+
renderedExpandedContent ? (jsx(AccordionDetails, Object.assign({ className: expanding.className, expanded: expanded }, { children: renderedExpandedContent }), void 0)) : null] }, void 0));
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export default TableBodyRow;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
+
export interface TableCellProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
4
|
+
/**
|
|
5
|
+
* whether cell content should be ellipsis
|
|
6
|
+
* @default true
|
|
7
|
+
*/
|
|
8
|
+
ellipsis?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* whether tooltip is force to shown when hovered
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
forceShownTooltipWhenHovered?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* tooltip title that you want to display
|
|
16
|
+
*/
|
|
17
|
+
tooltipTitle?: string | number;
|
|
18
|
+
}
|
|
19
|
+
declare const TableCell: import("react").ForwardRefExoticComponent<TableCellProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
20
|
+
export default TableCell;
|