@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,58 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react';
|
|
2
|
+
import { useControlValueState } from './useControlValueState.js';
|
|
3
|
+
|
|
4
|
+
const equalityFn = (a, b) => a === b;
|
|
5
|
+
function useAutoCompleteValueControl(props) {
|
|
6
|
+
const { defaultValue = '', disabledOptionsFilter, onChange, onClear: onClearProp, onClose, options: optionsProp, value: valueProp, } = props;
|
|
7
|
+
const [value, setValue] = useControlValueState({
|
|
8
|
+
defaultValue,
|
|
9
|
+
equalityFn,
|
|
10
|
+
value: valueProp,
|
|
11
|
+
});
|
|
12
|
+
const [searchText, setSearchText] = useState('');
|
|
13
|
+
const [focused, setFocused] = useState(false);
|
|
14
|
+
const onFocus = useCallback((focus) => {
|
|
15
|
+
setFocused(focus);
|
|
16
|
+
/** sync current value */
|
|
17
|
+
if (!focus) {
|
|
18
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
19
|
+
}
|
|
20
|
+
}, [
|
|
21
|
+
value,
|
|
22
|
+
onChange,
|
|
23
|
+
]);
|
|
24
|
+
const getCurrentInputValue = () => (value ? [{
|
|
25
|
+
id: value,
|
|
26
|
+
name: value,
|
|
27
|
+
}] : []);
|
|
28
|
+
const options = disabledOptionsFilter
|
|
29
|
+
? optionsProp
|
|
30
|
+
: optionsProp.filter((option) => ~option.search(searchText));
|
|
31
|
+
return {
|
|
32
|
+
focused,
|
|
33
|
+
onChange: (chooseOption) => {
|
|
34
|
+
if (!chooseOption)
|
|
35
|
+
return [];
|
|
36
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
37
|
+
setValue(chooseOption.name);
|
|
38
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(chooseOption.name);
|
|
39
|
+
return [chooseOption];
|
|
40
|
+
},
|
|
41
|
+
onClear: (e) => {
|
|
42
|
+
e.stopPropagation();
|
|
43
|
+
setValue('');
|
|
44
|
+
setSearchText('');
|
|
45
|
+
if (typeof onClearProp === 'function') {
|
|
46
|
+
onClearProp(e);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
onFocus,
|
|
50
|
+
options,
|
|
51
|
+
searchText,
|
|
52
|
+
setSearchText,
|
|
53
|
+
setValue,
|
|
54
|
+
value: getCurrentInputValue(),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { useAutoCompleteValueControl };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChangeEventHandler } from 'react';
|
|
2
|
+
import { UseSwitchControlValueProps } from './useSwitchControlValue';
|
|
3
|
+
export interface CheckboxGroupControlContextValue {
|
|
4
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
5
|
+
value?: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface UseCheckboxControlValueProps extends UseSwitchControlValueProps {
|
|
8
|
+
checkboxGroup?: CheckboxGroupControlContextValue;
|
|
9
|
+
value?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function useCheckboxControlValue(props: UseCheckboxControlValueProps): readonly [boolean, (event: import("react").ChangeEvent<HTMLInputElement>) => void];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useSwitchControlValue } from './useSwitchControlValue.js';
|
|
2
|
+
|
|
3
|
+
function useCheckboxControlValue(props) {
|
|
4
|
+
const { checkboxGroup, checked: checkedProp, defaultChecked, onChange: onChangeProp, value, } = props;
|
|
5
|
+
const { onChange: onChangeFromGroup } = checkboxGroup || {};
|
|
6
|
+
const [checked, setChecked] = useSwitchControlValue({
|
|
7
|
+
/**
|
|
8
|
+
* To ensure checkbox inside checkbox group, not use destructure here
|
|
9
|
+
*/
|
|
10
|
+
// eslint-disable-next-line no-nested-ternary
|
|
11
|
+
checked: checkboxGroup
|
|
12
|
+
? checkboxGroup.value && value != null
|
|
13
|
+
? checkboxGroup.value.includes(value)
|
|
14
|
+
: false
|
|
15
|
+
: checkedProp,
|
|
16
|
+
defaultChecked,
|
|
17
|
+
onChange: (event) => {
|
|
18
|
+
if (onChangeProp) {
|
|
19
|
+
onChangeProp(event);
|
|
20
|
+
}
|
|
21
|
+
if (onChangeFromGroup) {
|
|
22
|
+
onChangeFromGroup(event);
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
return [checked, setChecked];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { useCheckboxControlValue };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface UseControlValueStateProps<V> {
|
|
3
|
+
defaultValue: V;
|
|
4
|
+
equalityFn?: (a: V, b: V) => boolean;
|
|
5
|
+
value?: V;
|
|
6
|
+
}
|
|
7
|
+
export declare function useControlValueState<V>(props: UseControlValueStateProps<V>): readonly [V, import("react").Dispatch<import("react").SetStateAction<V>>, (a: V, b: V) => boolean];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
function useControlValueState(props) {
|
|
4
|
+
const { defaultValue, equalityFn = (a, b) => a === b, value: valueProp, } = props;
|
|
5
|
+
const [value, setValue] = useState(() => (typeof valueProp !== 'undefined' ? valueProp : defaultValue));
|
|
6
|
+
/**
|
|
7
|
+
* To sync value while changed from uncontrolled to controlled.
|
|
8
|
+
*/
|
|
9
|
+
if (typeof valueProp !== 'undefined' && !equalityFn(valueProp, value)) {
|
|
10
|
+
setValue(valueProp);
|
|
11
|
+
}
|
|
12
|
+
return [value, setValue, equalityFn];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { useControlValueState };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { UseControlValueStateProps } from './useControlValueState';
|
|
2
|
+
export interface UseCustomControlValueProps<V> extends UseControlValueStateProps<V> {
|
|
3
|
+
onChange?: (value: V) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare function useCustomControlValue<V>(props: UseCustomControlValueProps<V>): readonly [V, (nextValue: V) => void, (a: V, b: V) => boolean];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useLastCallback } from '../hooks/useLastCallback.js';
|
|
2
|
+
import { useControlValueState } from './useControlValueState.js';
|
|
3
|
+
|
|
4
|
+
function useCustomControlValue(props) {
|
|
5
|
+
const { onChange: onChangeProp } = props;
|
|
6
|
+
const [value, setValue, equalityFn] = useControlValueState(props);
|
|
7
|
+
const onChange = useLastCallback((nextValue) => {
|
|
8
|
+
if (!equalityFn(value, nextValue)) {
|
|
9
|
+
setValue(nextValue);
|
|
10
|
+
if (onChangeProp) {
|
|
11
|
+
onChangeProp(nextValue);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return [value, onChange, equalityFn];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { useCustomControlValue };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChangeEventHandler } from 'react';
|
|
2
|
+
import { UseControlValueStateProps } from './useControlValueState';
|
|
3
|
+
export interface UseInputControlValueProps<E extends HTMLInputElement | HTMLTextAreaElement> extends Omit<UseControlValueStateProps<string>, 'defaultValue' | 'equalityFn'> {
|
|
4
|
+
defaultValue?: string;
|
|
5
|
+
onChange?: ChangeEventHandler<E>;
|
|
6
|
+
}
|
|
7
|
+
export declare function useInputControlValue<E extends HTMLInputElement | HTMLTextAreaElement>(props: UseInputControlValueProps<E>): readonly [string, (event: import("react").ChangeEvent<E>) => void];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useLastCallback } from '../hooks/useLastCallback.js';
|
|
2
|
+
import { useControlValueState } from './useControlValueState.js';
|
|
3
|
+
|
|
4
|
+
const equalityFn = (a, b) => a === b;
|
|
5
|
+
function useInputControlValue(props) {
|
|
6
|
+
const { defaultValue = '', onChange: onChangeProp, value: valueProp, } = props;
|
|
7
|
+
const [value, setValue] = useControlValueState({
|
|
8
|
+
defaultValue,
|
|
9
|
+
equalityFn,
|
|
10
|
+
value: valueProp,
|
|
11
|
+
});
|
|
12
|
+
const onChange = useLastCallback((event) => {
|
|
13
|
+
const nextValue = event.target.value;
|
|
14
|
+
if (!equalityFn(value, nextValue)) {
|
|
15
|
+
setValue(nextValue);
|
|
16
|
+
if (onChangeProp) {
|
|
17
|
+
onChangeProp(event);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return [value, onChange];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { useInputControlValue };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ChangeEvent, MouseEvent, RefObject } from 'react';
|
|
2
|
+
import { UseInputControlValueProps } from './useInputControlValue';
|
|
3
|
+
export interface UseInputWithClearControlValueProps<E extends HTMLInputElement | HTMLTextAreaElement> extends UseInputControlValueProps<E> {
|
|
4
|
+
ref: RefObject<E>;
|
|
5
|
+
}
|
|
6
|
+
export declare function useInputWithClearControlValue<E extends HTMLInputElement | HTMLTextAreaElement>(props: UseInputWithClearControlValueProps<E>): readonly [string, (event: ChangeEvent<E>) => void, (event: MouseEvent) => void];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useInputControlValue } from './useInputControlValue.js';
|
|
2
|
+
|
|
3
|
+
function useInputWithClearControlValue(props) {
|
|
4
|
+
const { defaultValue, onChange: onChangeProp, ref, value: valueProp, } = props;
|
|
5
|
+
const [value, onChange] = useInputControlValue({
|
|
6
|
+
defaultValue,
|
|
7
|
+
onChange: onChangeProp,
|
|
8
|
+
value: valueProp,
|
|
9
|
+
});
|
|
10
|
+
const onClear = (event) => {
|
|
11
|
+
const target = ref.current;
|
|
12
|
+
if (target) {
|
|
13
|
+
const changeEvent = Object.create(event);
|
|
14
|
+
const originalValue = target.value;
|
|
15
|
+
changeEvent.target = target;
|
|
16
|
+
changeEvent.currentTarget = target;
|
|
17
|
+
/**
|
|
18
|
+
* Change target ref value cause e.target.value should be '' when clear input
|
|
19
|
+
* And then reset ref value
|
|
20
|
+
*/
|
|
21
|
+
target.value = '';
|
|
22
|
+
onChange(changeEvent);
|
|
23
|
+
target.value = originalValue;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return [
|
|
27
|
+
value,
|
|
28
|
+
onChange,
|
|
29
|
+
onClear,
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { useInputWithClearControlValue };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChangeEventHandler } from 'react';
|
|
2
|
+
import { UseSwitchControlValueProps } from './useSwitchControlValue';
|
|
3
|
+
export interface RadioGroupControlContextValue {
|
|
4
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
5
|
+
value?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface UseRadioControlValueProps extends UseSwitchControlValueProps {
|
|
8
|
+
radioGroup?: RadioGroupControlContextValue;
|
|
9
|
+
value?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function useRadioControlValue(props: UseRadioControlValueProps): readonly [boolean, (event: import("react").ChangeEvent<HTMLInputElement>) => void];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useSwitchControlValue } from './useSwitchControlValue.js';
|
|
2
|
+
|
|
3
|
+
function useRadioControlValue(props) {
|
|
4
|
+
const { checked: checkedProp, defaultChecked, onChange: onChangeProp, radioGroup, value, } = props;
|
|
5
|
+
const { onChange: onChangeFromGroup } = radioGroup || {};
|
|
6
|
+
const [checked, setChecked] = useSwitchControlValue({
|
|
7
|
+
/**
|
|
8
|
+
* To ensure radio inside radio group, not use destructure here
|
|
9
|
+
*/
|
|
10
|
+
checked: radioGroup ? radioGroup.value === value : checkedProp,
|
|
11
|
+
defaultChecked,
|
|
12
|
+
onChange: (event) => {
|
|
13
|
+
if (onChangeProp) {
|
|
14
|
+
onChangeProp(event);
|
|
15
|
+
}
|
|
16
|
+
if (onChangeFromGroup) {
|
|
17
|
+
onChangeFromGroup(event);
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
return [checked, setChecked];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { useRadioControlValue };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
|
+
import { SelectValue } from '../Select/typings';
|
|
3
|
+
export interface UseSelectValueControl {
|
|
4
|
+
defaultValue?: SelectValue[];
|
|
5
|
+
mode: string;
|
|
6
|
+
onChange?(newOptions: SelectValue[]): any;
|
|
7
|
+
onClear?(e: MouseEvent<Element>): void;
|
|
8
|
+
onClose?(): void;
|
|
9
|
+
value?: SelectValue[];
|
|
10
|
+
}
|
|
11
|
+
export interface SelectValueControl {
|
|
12
|
+
onChange: (v: SelectValue | null) => SelectValue[];
|
|
13
|
+
onClear(e: MouseEvent<Element>): void;
|
|
14
|
+
value: SelectValue[];
|
|
15
|
+
}
|
|
16
|
+
export declare function useSelectValueControl(props: UseSelectValueControl): SelectValueControl;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import intersectionBy from 'lodash/intersectionBy';
|
|
2
|
+
import { useControlValueState } from './useControlValueState.js';
|
|
3
|
+
|
|
4
|
+
const equalityFn = (a, b) => (a.length === b.length && intersectionBy(a, b, 'id').length === a.length);
|
|
5
|
+
function useSelectValueControl(props) {
|
|
6
|
+
const { defaultValue, mode, onChange, onClear: onClearProp, onClose, value: valueProp, } = props;
|
|
7
|
+
const [value, setValue] = useControlValueState({
|
|
8
|
+
defaultValue: defaultValue || [],
|
|
9
|
+
equalityFn,
|
|
10
|
+
value: valueProp,
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
value,
|
|
14
|
+
onChange: (chooseOption) => {
|
|
15
|
+
if (!chooseOption)
|
|
16
|
+
return [];
|
|
17
|
+
let newValue = [];
|
|
18
|
+
switch (mode) {
|
|
19
|
+
case 'single': {
|
|
20
|
+
newValue = [chooseOption];
|
|
21
|
+
if (typeof onClose === 'function') {
|
|
22
|
+
/** single selection should close modal when clicked */
|
|
23
|
+
onClose();
|
|
24
|
+
}
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
case 'multiple': {
|
|
28
|
+
const existedValueIdx = (value !== null && value !== void 0 ? value : []).findIndex((v) => v.id === chooseOption.id);
|
|
29
|
+
if (~existedValueIdx) {
|
|
30
|
+
newValue = [
|
|
31
|
+
...value.slice(0, existedValueIdx),
|
|
32
|
+
...value.slice(existedValueIdx + 1),
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
newValue = [
|
|
37
|
+
...value,
|
|
38
|
+
chooseOption,
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
setValue(newValue);
|
|
45
|
+
if (typeof onChange === 'function')
|
|
46
|
+
onChange(newValue);
|
|
47
|
+
return newValue;
|
|
48
|
+
},
|
|
49
|
+
onClear: (e) => {
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
setValue([]);
|
|
52
|
+
if (typeof onClearProp === 'function') {
|
|
53
|
+
onClearProp(e);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { useSelectValueControl };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChangeEventHandler } from 'react';
|
|
2
|
+
export interface UseSwitchControlValueProps {
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
defaultChecked?: boolean;
|
|
5
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
6
|
+
}
|
|
7
|
+
export declare function useSwitchControlValue(props: UseSwitchControlValueProps): readonly [boolean, (event: import("react").ChangeEvent<HTMLInputElement>) => void];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useLastCallback } from '../hooks/useLastCallback.js';
|
|
2
|
+
import { useControlValueState } from './useControlValueState.js';
|
|
3
|
+
|
|
4
|
+
const equalityFn = (a, b) => a === b;
|
|
5
|
+
function useSwitchControlValue(props) {
|
|
6
|
+
const { checked: checkedProp, defaultChecked = false, onChange: onChangeProp, } = props;
|
|
7
|
+
const [checked, setChecked] = useControlValueState({
|
|
8
|
+
defaultValue: defaultChecked,
|
|
9
|
+
equalityFn,
|
|
10
|
+
value: checkedProp,
|
|
11
|
+
});
|
|
12
|
+
const onChange = useLastCallback((event) => {
|
|
13
|
+
const nextChecked = event.target.checked;
|
|
14
|
+
if (!equalityFn(checked, nextChecked)) {
|
|
15
|
+
setChecked(nextChecked);
|
|
16
|
+
if (onChangeProp) {
|
|
17
|
+
onChangeProp(event);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return [checked, onChange];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { useSwitchControlValue };
|
package/Icon/Icon.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IconDefinition } from '@mezzanine-ui/icons';
|
|
3
|
+
import { IconColor } from '@mezzanine-ui/core/icon';
|
|
4
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
5
|
+
export interface IconProps extends NativeElementPropsWithoutKeyAndRef<'i'> {
|
|
6
|
+
/**
|
|
7
|
+
* Color name provided by palette.
|
|
8
|
+
*/
|
|
9
|
+
color?: IconColor;
|
|
10
|
+
/**
|
|
11
|
+
* The icon provided by `@mezzanine-ui/icons` package.
|
|
12
|
+
*/
|
|
13
|
+
icon: IconDefinition;
|
|
14
|
+
/**
|
|
15
|
+
* Whether to spin the icon or not.
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
spin?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The react component for `mezzanine` icon.
|
|
22
|
+
*/
|
|
23
|
+
declare const Icon: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<HTMLElement>>;
|
|
24
|
+
export default Icon;
|
package/Icon/Icon.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { toIconCssVars, iconClasses } from '@mezzanine-ui/core/icon';
|
|
4
|
+
import cx from 'clsx';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The react component for `mezzanine` icon.
|
|
8
|
+
*/
|
|
9
|
+
const Icon = forwardRef(function Icon(props, ref) {
|
|
10
|
+
const { className, color, icon, spin = false, style: styleProp, ...rest } = props;
|
|
11
|
+
const { definition } = icon;
|
|
12
|
+
const cssVars = toIconCssVars({ color });
|
|
13
|
+
const style = {
|
|
14
|
+
...cssVars,
|
|
15
|
+
...styleProp,
|
|
16
|
+
};
|
|
17
|
+
return (jsx("i", Object.assign({}, rest, { ref: ref, "aria-hidden": true, className: cx(iconClasses.host, {
|
|
18
|
+
[iconClasses.color]: color,
|
|
19
|
+
[iconClasses.spin]: spin,
|
|
20
|
+
}, className), "data-icon-name": icon.name, style: style }, { children: jsx("svg", Object.assign({}, definition.svg, { focusable: false }, { children: jsx("path", Object.assign({}, definition.path), void 0) }), void 0) }), void 0));
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export default Icon;
|
package/Icon/index.d.ts
ADDED
package/Icon/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Icon.js';
|
package/Input/Input.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Ref, ChangeEventHandler } from 'react';
|
|
2
|
+
import { InputSize } from '@mezzanine-ui/core/input';
|
|
3
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
|
+
import { TextFieldProps } from '../TextField';
|
|
5
|
+
export interface InputProps extends Omit<TextFieldProps, 'active' | 'children' | 'onClear' | 'onKeyDown'> {
|
|
6
|
+
/**
|
|
7
|
+
* The default value of input.
|
|
8
|
+
*/
|
|
9
|
+
defaultValue?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The react ref passed to input element.
|
|
12
|
+
*/
|
|
13
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
14
|
+
/**
|
|
15
|
+
* The other native props for input element.
|
|
16
|
+
*/
|
|
17
|
+
inputProps?: Omit<NativeElementPropsWithoutKeyAndRef<'input'>, 'defaultValue' | 'disabled' | 'onChange' | 'placeholder' | 'readOnly' | 'required' | 'value' | `aria-${'disabled' | 'multiline' | 'readonly' | 'required'}`>;
|
|
18
|
+
/**
|
|
19
|
+
* The change event handler of input element.
|
|
20
|
+
*/
|
|
21
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
22
|
+
/**
|
|
23
|
+
* The placeholder of input.
|
|
24
|
+
*/
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the input is readonly.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
readOnly?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the input is required.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
required?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The size of input.
|
|
38
|
+
* @default 'medium'
|
|
39
|
+
*/
|
|
40
|
+
size?: InputSize;
|
|
41
|
+
/**
|
|
42
|
+
* The value of input.
|
|
43
|
+
*/
|
|
44
|
+
value?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The react component for `mezzanine` input.
|
|
48
|
+
*/
|
|
49
|
+
declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
50
|
+
export default Input;
|
package/Input/Input.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext, useRef } from 'react';
|
|
3
|
+
import { inputClasses } from '@mezzanine-ui/core/input';
|
|
4
|
+
import { useComposeRefs } from '../hooks/useComposeRefs.js';
|
|
5
|
+
import { useInputWithClearControlValue } from '../Form/useInputWithClearControlValue.js';
|
|
6
|
+
import { FormControlContext } from '../Form/FormControlContext.js';
|
|
7
|
+
import TextField from '../TextField/TextField.js';
|
|
8
|
+
import cx from 'clsx';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The react component for `mezzanine` input.
|
|
12
|
+
*/
|
|
13
|
+
const Input = forwardRef(function Input(props, ref) {
|
|
14
|
+
const { disabled: disabledFromFormControl, fullWidth: fullWidthFromFormControl, required: requiredFromFormControl, severity, } = useContext(FormControlContext) || {};
|
|
15
|
+
const { className, clearable = false, defaultValue, disabled = disabledFromFormControl || false, error = severity === 'error' || false, fullWidth = fullWidthFromFormControl || false, inputRef: inputRefProp, inputProps, onChange: onChangeProp, placeholder, prefix, readOnly = false, required = requiredFromFormControl || false, size = 'medium', suffix, value: valueProp, } = props;
|
|
16
|
+
const inputRef = useRef(null);
|
|
17
|
+
const [value, onChange, onClear,] = useInputWithClearControlValue({
|
|
18
|
+
defaultValue,
|
|
19
|
+
onChange: onChangeProp,
|
|
20
|
+
ref: inputRef,
|
|
21
|
+
value: valueProp,
|
|
22
|
+
});
|
|
23
|
+
const composedInputRef = useComposeRefs([inputRefProp, inputRef]);
|
|
24
|
+
const active = !!value;
|
|
25
|
+
return (jsx(TextField, Object.assign({ ref: ref, active: active, className: cx(inputClasses.host, className), clearable: clearable, disabled: disabled, error: error, fullWidth: fullWidth, onClear: onClear, prefix: prefix, size: size, suffix: suffix }, { children: jsx("input", Object.assign({}, inputProps, { ref: composedInputRef, "aria-disabled": disabled, "aria-multiline": false, "aria-readonly": readOnly, "aria-required": required, disabled: disabled, onChange: onChange, placeholder: placeholder, readOnly: readOnly, required: required, value: value }), void 0) }), void 0));
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export default Input;
|
package/Input/index.d.ts
ADDED
package/Input/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Input.js';
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Mezzanine-UI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IconProps } from '../Icon';
|
|
3
|
+
import { OverlayProps } from '../Overlay';
|
|
4
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
5
|
+
export interface LoadingProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
6
|
+
/**
|
|
7
|
+
* When set stretch=true, host container will stretch to width & height 100%
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
|
+
stretch?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Custom icon props
|
|
13
|
+
*/
|
|
14
|
+
iconProps?: Omit<IconProps, 'icon' | 'spin'>;
|
|
15
|
+
/**
|
|
16
|
+
* Whether Loading is loading.
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Custom overlay props (only display when nested children)
|
|
22
|
+
*/
|
|
23
|
+
overlayProps?: Omit<OverlayProps, 'container' | 'open'>;
|
|
24
|
+
/**
|
|
25
|
+
* Customize description content
|
|
26
|
+
*/
|
|
27
|
+
tip?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Customize description content className
|
|
30
|
+
*/
|
|
31
|
+
tipClassName?: string;
|
|
32
|
+
}
|
|
33
|
+
declare const Loading: import("react").ForwardRefExoticComponent<LoadingProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
34
|
+
export default Loading;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useRef } from 'react';
|
|
3
|
+
import { SpinnerIcon } from '@mezzanine-ui/icons';
|
|
4
|
+
import { iconClasses } from '@mezzanine-ui/core/loading';
|
|
5
|
+
import { useComposeRefs } from '../hooks/useComposeRefs.js';
|
|
6
|
+
import Icon from '../Icon/Icon.js';
|
|
7
|
+
import Overlay from '../Overlay/Overlay.js';
|
|
8
|
+
import cx from 'clsx';
|
|
9
|
+
|
|
10
|
+
const Loading = forwardRef(function Loading(props, ref) {
|
|
11
|
+
const hostRef = useRef(null);
|
|
12
|
+
const { children, className, stretch = false, iconProps = {}, loading = false, overlayProps = {}, tip, tipClassName, } = props;
|
|
13
|
+
const { className: iconClassName, color: iconColor, ...iconPropsRest } = iconProps;
|
|
14
|
+
const isNestedPattern = typeof children !== 'undefined';
|
|
15
|
+
const composedHostRef = useComposeRefs([ref, hostRef]);
|
|
16
|
+
const spinElement = loading ? (jsxs("div", Object.assign({ ref: isNestedPattern ? null : ref, className: cx(iconClasses.spin, {
|
|
17
|
+
[iconClasses.stretch]: stretch,
|
|
18
|
+
}) }, { children: [jsx(Icon, Object.assign({}, iconPropsRest, { className: cx(iconClasses.icon, iconClassName), color: iconColor || 'primary', icon: SpinnerIcon, spin: true }), void 0),
|
|
19
|
+
tip ? (jsx("span", Object.assign({ className: cx(iconClasses.tip, tipClassName) }, { children: tip }), void 0)) : null] }), void 0)) : null;
|
|
20
|
+
if (isNestedPattern) {
|
|
21
|
+
return (jsxs("div", Object.assign({ ref: composedHostRef, className: cx(iconClasses.host, {
|
|
22
|
+
[iconClasses.stretch]: stretch,
|
|
23
|
+
}, className) }, { children: [jsx(Overlay, Object.assign({}, overlayProps, { container: hostRef, onSurface: true, open: loading }, { children: spinElement }), void 0), children] }), void 0));
|
|
24
|
+
}
|
|
25
|
+
return spinElement;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export default Loading;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LoadingProps, default, } from './Loading';
|
package/Loading/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Loading.js';
|
package/Menu/Menu.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MenuSize } from '@mezzanine-ui/core/menu';
|
|
3
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
|
+
export interface MenuProps extends NativeElementPropsWithoutKeyAndRef<'ul'> {
|
|
5
|
+
/**
|
|
6
|
+
* The minimum items count in scroll container.
|
|
7
|
+
* @default 4;
|
|
8
|
+
*/
|
|
9
|
+
itemsInView?: number;
|
|
10
|
+
/**
|
|
11
|
+
* The custom menu max height.
|
|
12
|
+
*/
|
|
13
|
+
maxHeight?: number;
|
|
14
|
+
/**
|
|
15
|
+
* The role of menu.
|
|
16
|
+
* @default 'menu'
|
|
17
|
+
*/
|
|
18
|
+
role?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The size of menu.
|
|
21
|
+
* @default 'medium'
|
|
22
|
+
*/
|
|
23
|
+
size?: MenuSize;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The react component for `mezzanine` menu.
|
|
27
|
+
*/
|
|
28
|
+
declare const Menu: import("react").ForwardRefExoticComponent<MenuProps & import("react").RefAttributes<HTMLUListElement>>;
|
|
29
|
+
export default Menu;
|