@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,122 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { ClockIcon } from '@mezzanine-ui/icons';
|
|
3
|
+
import { forwardRef, useContext, useMemo, useState, useCallback, useRef, useEffect } from 'react';
|
|
4
|
+
import { useComposeRefs } from '../hooks/useComposeRefs.js';
|
|
5
|
+
import DateTimePickerPanel from './DateTimePickerPanel.js';
|
|
6
|
+
import { FormControlContext } from '../Form/FormControlContext.js';
|
|
7
|
+
import { useCalendarContext } from '../Calendar/CalendarContext.js';
|
|
8
|
+
import { usePickerValue } from '../Picker/usePickerValue.js';
|
|
9
|
+
import { usePickerDocumentEventClose } from '../Picker/usePickerDocumentEventClose.js';
|
|
10
|
+
import Icon from '../Icon/Icon.js';
|
|
11
|
+
import PickerTrigger from '../Picker/PickerTrigger.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The react component for `mezzanine` time picker.
|
|
15
|
+
* Notice that any component related to time-picker should be used along with `CalendarContext`.
|
|
16
|
+
*/
|
|
17
|
+
const DateTimePicker = forwardRef(function DateTimePicker(props, ref) {
|
|
18
|
+
const { disabled: disabledFromFormControl, fullWidth: fullWidthFromFormControl, required: requiredFromFormControl, severity, } = useContext(FormControlContext) || {};
|
|
19
|
+
const { defaultDateFormat, defaultTimeFormat, getNow, startOf, } = useCalendarContext();
|
|
20
|
+
const defaultFormat = `${defaultDateFormat} ${defaultTimeFormat}`;
|
|
21
|
+
const { calendarProps, className, clearable, confirmText, defaultValue, disableOnNext, disableOnPrev, disabled = disabledFromFormControl, displayMonthLocale, error = severity === 'error' || false, fadeProps, format = defaultFormat, fullWidth = fullWidthFromFormControl, hideHour, hideMinute, hideSecond, hourPrefix, hourStep, inputProps, isDateDisabled, isMonthDisabled, isYearDisabled, minutePrefix, minuteStep, onChange: onChangeProp, onPanelToggle: onPanelToggleProp, placeholder, popperProps, prefix, readOnly, referenceDate: referenceDateProp, required = requiredFromFormControl, secondPrefix, secondStep, size: sizeProp, value: valueProp, } = props;
|
|
22
|
+
const { onBlur: onBlurProp, onKeyDown: onKeyDownProp, onFocus: onFocusProp, size: inputSize = format.length + 2, ...restInputProp } = inputProps || {};
|
|
23
|
+
const formats = useMemo(() => [format, defaultFormat], [defaultFormat, format]);
|
|
24
|
+
/** Panel open control */
|
|
25
|
+
const [open, setOpen] = useState(false);
|
|
26
|
+
const preventOpen = readOnly;
|
|
27
|
+
const onPanelToggle = useCallback((nextOpen) => {
|
|
28
|
+
if (!preventOpen) {
|
|
29
|
+
setOpen(nextOpen);
|
|
30
|
+
if (onPanelToggleProp) {
|
|
31
|
+
onPanelToggleProp(nextOpen);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}, [onPanelToggleProp, preventOpen]);
|
|
35
|
+
const onFocus = useCallback((event) => {
|
|
36
|
+
if (onFocusProp) {
|
|
37
|
+
onFocusProp(event);
|
|
38
|
+
}
|
|
39
|
+
onPanelToggle(true);
|
|
40
|
+
}, [onFocusProp, onPanelToggle]);
|
|
41
|
+
/** Controlling input value and bind change handler */
|
|
42
|
+
const inputRef = useRef(null);
|
|
43
|
+
const { inputValue, onBlur, onChange, onInputChange, onKeyDown, value: internalValue, } = usePickerValue({
|
|
44
|
+
defaultValue,
|
|
45
|
+
format,
|
|
46
|
+
formats,
|
|
47
|
+
inputRef,
|
|
48
|
+
value: valueProp,
|
|
49
|
+
});
|
|
50
|
+
/** Panel confirm handler */
|
|
51
|
+
const onConfirm = useCallback(() => {
|
|
52
|
+
if (onChangeProp) {
|
|
53
|
+
onChangeProp(internalValue);
|
|
54
|
+
}
|
|
55
|
+
onPanelToggle(false);
|
|
56
|
+
}, [internalValue, onChangeProp, onPanelToggle]);
|
|
57
|
+
/** using internal reference date */
|
|
58
|
+
const [referenceDate, setReferenceDate] = useState(startOf(referenceDateProp || defaultValue || getNow(), 'hour'));
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (internalValue) {
|
|
61
|
+
setReferenceDate(internalValue);
|
|
62
|
+
}
|
|
63
|
+
}, [internalValue]);
|
|
64
|
+
/** Bind input props */
|
|
65
|
+
const onResolvedKeyDown = useCallback((event) => {
|
|
66
|
+
if (onKeyDownProp) {
|
|
67
|
+
onKeyDownProp(event);
|
|
68
|
+
}
|
|
69
|
+
onKeyDown(event);
|
|
70
|
+
if (event.key === 'Enter') {
|
|
71
|
+
onConfirm();
|
|
72
|
+
}
|
|
73
|
+
}, [onConfirm, onKeyDown, onKeyDownProp]);
|
|
74
|
+
const onResolvedBlur = useCallback((event) => {
|
|
75
|
+
if (onBlurProp) {
|
|
76
|
+
onBlurProp(event);
|
|
77
|
+
}
|
|
78
|
+
onBlur(event);
|
|
79
|
+
}, [onBlur, onBlurProp]);
|
|
80
|
+
const resolvedInputProps = {
|
|
81
|
+
...restInputProp,
|
|
82
|
+
size: inputSize,
|
|
83
|
+
onFocus,
|
|
84
|
+
onKeyDown: onResolvedKeyDown,
|
|
85
|
+
onBlur: onResolvedBlur,
|
|
86
|
+
};
|
|
87
|
+
/** Popper positioning */
|
|
88
|
+
const anchorRef = useRef(null);
|
|
89
|
+
const panelRef = useRef(null);
|
|
90
|
+
const triggerComposedRef = useComposeRefs([anchorRef, ref]);
|
|
91
|
+
/** Blur, click away and key down close */
|
|
92
|
+
const onClose = useCallback(() => {
|
|
93
|
+
onChange(valueProp);
|
|
94
|
+
onPanelToggle(false);
|
|
95
|
+
}, [onChange, onPanelToggle, valueProp]);
|
|
96
|
+
usePickerDocumentEventClose({
|
|
97
|
+
open,
|
|
98
|
+
anchorRef,
|
|
99
|
+
popperRef: panelRef,
|
|
100
|
+
lastElementRefInFlow: inputRef,
|
|
101
|
+
onClose,
|
|
102
|
+
onChangeClose: onClose,
|
|
103
|
+
});
|
|
104
|
+
/** Bind on change to on clear */
|
|
105
|
+
const onClear = () => {
|
|
106
|
+
onChange(undefined);
|
|
107
|
+
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(undefined);
|
|
108
|
+
};
|
|
109
|
+
/** Icon */
|
|
110
|
+
const onIconClick = (e) => {
|
|
111
|
+
e.stopPropagation();
|
|
112
|
+
if (open) {
|
|
113
|
+
onChange(valueProp);
|
|
114
|
+
}
|
|
115
|
+
onPanelToggle(!open);
|
|
116
|
+
};
|
|
117
|
+
const suffixActionIcon = (jsx(Icon, { icon: ClockIcon, onClick: onIconClick }, void 0));
|
|
118
|
+
return (jsxs(Fragment, { children: [jsx(PickerTrigger, { ref: triggerComposedRef, className: className, clearable: clearable, disabled: disabled, error: error, fullWidth: fullWidth, inputProps: resolvedInputProps, inputRef: inputRef, onChange: onInputChange, onClear: onClear, placeholder: placeholder, prefix: prefix, readOnly: readOnly, required: required, size: sizeProp, suffixActionIcon: suffixActionIcon, value: inputValue }, void 0),
|
|
119
|
+
jsx(DateTimePickerPanel, { ref: panelRef, anchor: anchorRef, calendarProps: calendarProps, confirmText: confirmText, disableOnNext: disableOnNext, disableOnPrev: disableOnPrev, displayMonthLocale: displayMonthLocale, fadeProps: fadeProps, hideHour: hideHour, hideMinute: hideMinute, hideSecond: hideSecond, hourPrefix: hourPrefix, hourStep: hourStep, isDateDisabled: isDateDisabled, isMonthDisabled: isMonthDisabled, isYearDisabled: isYearDisabled, minutePrefix: minutePrefix, minuteStep: minuteStep, onChange: onChange, onConfirm: onConfirm, open: open, popperProps: popperProps, referenceDate: referenceDate, secondPrefix: secondPrefix, secondStep: secondStep, value: internalValue }, void 0)] }, void 0));
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
export default DateTimePicker;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DateType } from '@mezzanine-ui/core/calendar';
|
|
3
|
+
import { TimePanelProps } from '../TimePanel';
|
|
4
|
+
import { CalendarProps } from '../Calendar';
|
|
5
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
6
|
+
import { InputTriggerPopperProps } from '../_internal/InputTriggerPopper';
|
|
7
|
+
export interface DateTimePickerPanelProps extends Omit<TimePanelProps, Exclude<keyof NativeElementPropsWithoutKeyAndRef<'div'>, 'className' | 'style' | 'id'> | 'withoutAction' | 'onChange' | 'value' | 'withoutAction'>, Pick<InputTriggerPopperProps, 'anchor' | 'fadeProps' | 'open'>, Pick<CalendarProps, 'disableOnNext' | 'disableOnPrev' | 'displayMonthLocale' | 'isDateDisabled' | 'isMonthDisabled' | 'isYearDisabled' | 'onChange' | 'referenceDate'> {
|
|
8
|
+
/**
|
|
9
|
+
* Other calendar props you may provide to `Calendar`.
|
|
10
|
+
*/
|
|
11
|
+
calendarProps?: Omit<CalendarProps, 'disableOnNext' | 'disableOnPrev' | 'displayMonthLocale' | 'isDateDisabled' | 'isMonthDisabled' | 'isYearDisabled' | 'locale' | 'mode' | 'onChange' | 'onMonthControlClick' | 'onNext' | 'onPrev' | 'onYearControlClick' | 'referenceDate' | 'updateReferenceDate' | 'value'>;
|
|
12
|
+
/**
|
|
13
|
+
* Change Handler. Receive `DateType` as props.
|
|
14
|
+
*/
|
|
15
|
+
onChange?: (value?: DateType) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Other props you may provide to `Popper` component
|
|
18
|
+
*/
|
|
19
|
+
popperProps?: Omit<InputTriggerPopperProps, 'anchor' | 'children' | 'fadeProps' | 'open'>;
|
|
20
|
+
/**
|
|
21
|
+
* Display value of the panel.
|
|
22
|
+
*/
|
|
23
|
+
value?: DateType;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The react component for `mezzanine` time picker panel.
|
|
27
|
+
*/
|
|
28
|
+
declare const DateTimePickerPanel: import("react").ForwardRefExoticComponent<DateTimePickerPanelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
29
|
+
export default DateTimePickerPanel;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { dateTimePickerClasses } from '@mezzanine-ui/core/date-time-picker';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { useCalendarContext } from '../Calendar/CalendarContext.js';
|
|
5
|
+
import { useCalendarControls } from '../Calendar/useCalendarControls.js';
|
|
6
|
+
import InputTriggerPopper from '../_internal/InputTriggerPopper/InputTriggerPopper.js';
|
|
7
|
+
import Calendar from '../Calendar/Calendar.js';
|
|
8
|
+
import TimePanel from '../TimePanel/TimePanel.js';
|
|
9
|
+
import TimePanelAction from '../TimePanel/TimePanelAction.js';
|
|
10
|
+
import cx from 'clsx';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The react component for `mezzanine` time picker panel.
|
|
14
|
+
*/
|
|
15
|
+
const DateTimePickerPanel = forwardRef(function TimePickerPanel(props, ref) {
|
|
16
|
+
const { displayMonthLocale: displayMonthLocaleFromConfig, getMonth, getYear, setMonth, setYear, setHour, setMinute, setSecond, getHour, getMinute, getSecond, } = useCalendarContext();
|
|
17
|
+
const { anchor, calendarProps, className, confirmText, disableOnNext, disableOnPrev, displayMonthLocale = displayMonthLocaleFromConfig, fadeProps, hideHour, hideMinute, hideSecond, hourPrefix, hourStep, isDateDisabled, isMonthDisabled, isYearDisabled, minutePrefix, minuteStep, onChange: onChangeProp, onConfirm, open, popperProps, referenceDate: referenceDateProp, secondPrefix, secondStep, value, ...restHostProps } = props;
|
|
18
|
+
const mode = 'day';
|
|
19
|
+
const { currentMode, onMonthControlClick, onNext, onPrev, onYearControlClick, popModeStack, referenceDate, updateReferenceDate, } = useCalendarControls(referenceDateProp, mode);
|
|
20
|
+
const onCalendarChange = (target) => {
|
|
21
|
+
if (currentMode === 'day' || currentMode === 'week') {
|
|
22
|
+
updateReferenceDate(target);
|
|
23
|
+
popModeStack();
|
|
24
|
+
if (currentMode === mode && onChangeProp) {
|
|
25
|
+
onChangeProp(target);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (currentMode === 'month') {
|
|
29
|
+
const result = setMonth(referenceDate, getMonth(target));
|
|
30
|
+
updateReferenceDate(result);
|
|
31
|
+
popModeStack();
|
|
32
|
+
}
|
|
33
|
+
if (currentMode === 'year') {
|
|
34
|
+
const result = setYear(referenceDate, getYear(target));
|
|
35
|
+
updateReferenceDate(result);
|
|
36
|
+
popModeStack();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const onTimePanelChange = (target) => {
|
|
40
|
+
const result = setHour(setMinute(setSecond(referenceDate, getSecond(target)), getMinute(target)), getHour(target));
|
|
41
|
+
updateReferenceDate(result);
|
|
42
|
+
if (currentMode === mode && onChangeProp) {
|
|
43
|
+
onChangeProp(result);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return (jsx(InputTriggerPopper, Object.assign({}, popperProps, { ref: ref, anchor: anchor, open: open, fadeProps: fadeProps }, { children: jsxs("div", Object.assign({}, restHostProps, { className: cx(dateTimePickerClasses.panel, className) }, { children: [jsxs("div", Object.assign({ className: dateTimePickerClasses.panelSelectors }, { children: [jsx(Calendar, Object.assign({}, calendarProps, { disableOnNext: disableOnNext, disableOnPrev: disableOnPrev, displayMonthLocale: displayMonthLocale, isDateDisabled: isDateDisabled, isMonthDisabled: isMonthDisabled, isYearDisabled: isYearDisabled, mode: currentMode, onChange: onCalendarChange, onMonthControlClick: onMonthControlClick, onNext: onNext, onPrev: onPrev, onYearControlClick: onYearControlClick, referenceDate: referenceDate, value: value, className: dateTimePickerClasses.panelCalendar }), void 0),
|
|
47
|
+
jsx(TimePanel, { hideHour: hideHour, hourStep: hourStep, hideMinute: hideMinute, minuteStep: minuteStep, hideSecond: hideSecond, secondStep: secondStep, hourPrefix: hourPrefix, minutePrefix: minutePrefix, secondPrefix: secondPrefix, onChange: onTimePanelChange, value: value, withoutAction: true }, void 0)] }), void 0),
|
|
48
|
+
jsx(TimePanelAction, { onConfirm: onConfirm, confirmText: confirmText }, void 0)] }), void 0) }), void 0));
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export default DateTimePickerPanel;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DrawerPlacement } from '@mezzanine-ui/core/drawer';
|
|
3
|
+
import { OverlayProps } from '../Overlay';
|
|
4
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
5
|
+
export interface DrawerProps extends NativeElementPropsWithoutKeyAndRef<'div'>, Pick<OverlayProps, 'container' | 'disableCloseOnBackdropClick' | 'disablePortal' | 'hideBackdrop' | 'invisibleBackdrop' | 'onBackdropClick' | 'onClose' | 'open'> {
|
|
6
|
+
/**
|
|
7
|
+
* Controls whether to disable closing drawer while escape key down.
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
|
+
disableCloseOnEscapeKeyDown?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the drawer placement.
|
|
13
|
+
* @default 'left'
|
|
14
|
+
*/
|
|
15
|
+
placement?: DrawerPlacement;
|
|
16
|
+
}
|
|
17
|
+
declare const Drawer: import("react").ForwardRefExoticComponent<DrawerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export default Drawer;
|
package/Drawer/Drawer.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useState } from 'react';
|
|
3
|
+
import { drawerClasses } from '@mezzanine-ui/core/drawer';
|
|
4
|
+
import { useDocumentEscapeKeyDown } from '../hooks/useDocumentEscapeKeyDown.js';
|
|
5
|
+
import Overlay from '../Overlay/Overlay.js';
|
|
6
|
+
import SlideFade from '../Transition/SlideFade.js';
|
|
7
|
+
import cx from 'clsx';
|
|
8
|
+
|
|
9
|
+
const Drawer = forwardRef((props, ref) => {
|
|
10
|
+
const { className, children, container, disableCloseOnBackdropClick = false, disableCloseOnEscapeKeyDown = false, disablePortal, hideBackdrop, invisibleBackdrop, onBackdropClick, onClose, open, placement = 'left', ...rest } = props;
|
|
11
|
+
const [exited, setExited] = useState(true);
|
|
12
|
+
useDocumentEscapeKeyDown(() => {
|
|
13
|
+
if (!open || disableCloseOnEscapeKeyDown || !onClose) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
return onClose;
|
|
17
|
+
}, [
|
|
18
|
+
disableCloseOnEscapeKeyDown,
|
|
19
|
+
open,
|
|
20
|
+
onClose,
|
|
21
|
+
]);
|
|
22
|
+
if (!open && exited) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const slideFadeDirection = {
|
|
26
|
+
top: 'down',
|
|
27
|
+
left: 'right',
|
|
28
|
+
right: 'left',
|
|
29
|
+
bottom: 'up',
|
|
30
|
+
};
|
|
31
|
+
return (jsx(Overlay, Object.assign({ className: drawerClasses.overlay, container: container, disableCloseOnBackdropClick: disableCloseOnBackdropClick, disablePortal: disablePortal, hideBackdrop: hideBackdrop, invisibleBackdrop: invisibleBackdrop, onBackdropClick: onBackdropClick, onClose: onClose, open: open, role: "presentation" }, { children: jsx(SlideFade, Object.assign({ ref: ref, direction: slideFadeDirection[placement], in: open, onEntered: () => setExited(false), onExited: () => setExited(true) }, { children: jsx("div", Object.assign({}, rest, { className: cx(drawerClasses.host, drawerClasses[placement], className) }, { children: children }), void 0) }), void 0) }), void 0));
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export default Drawer;
|
package/Drawer/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Drawer.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DetailedHTMLProps, HTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
|
+
import { PopperProps } from '../Popper';
|
|
3
|
+
import { ClickAwayEvent } from '../hooks/useClickAway';
|
|
4
|
+
export interface DropdownProps extends Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'ref' | 'children'> {
|
|
5
|
+
children: (ref: Ref<HTMLElement>) => ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* Whether to disable triggering onClose while clicked away.
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
|
+
disableClickAway?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The dropdown menu
|
|
13
|
+
*/
|
|
14
|
+
menu?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* The handler fired while clicked away.
|
|
17
|
+
*/
|
|
18
|
+
onClose?: (event: ClickAwayEvent) => void;
|
|
19
|
+
/**
|
|
20
|
+
* the props of popper
|
|
21
|
+
*/
|
|
22
|
+
popperProps?: PopperProps;
|
|
23
|
+
}
|
|
24
|
+
declare const Dropdown: import("react").ForwardRefExoticComponent<DropdownProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
25
|
+
export default Dropdown;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useRef } from 'react';
|
|
3
|
+
import { useClickAway } from '../hooks/useClickAway.js';
|
|
4
|
+
import { useComposeRefs } from '../hooks/useComposeRefs.js';
|
|
5
|
+
import Popper from '../Popper/Popper.js';
|
|
6
|
+
|
|
7
|
+
const popperOptions = {
|
|
8
|
+
modifiers: [
|
|
9
|
+
{
|
|
10
|
+
name: 'sameWidth',
|
|
11
|
+
enabled: true,
|
|
12
|
+
phase: 'beforeWrite',
|
|
13
|
+
requires: ['computeStyles'],
|
|
14
|
+
fn: ({ state }) => {
|
|
15
|
+
const reassignState = state;
|
|
16
|
+
reassignState.styles.popper.width = 'auto';
|
|
17
|
+
reassignState.styles.popper.minWidth = `${state.rects.reference.width}px`;
|
|
18
|
+
},
|
|
19
|
+
effect: ({ state }) => {
|
|
20
|
+
const reassignState = state;
|
|
21
|
+
reassignState.elements.popper.style.width = 'auto';
|
|
22
|
+
reassignState.elements.popper.style.minWidth = `${state.elements.reference.getBoundingClientRect().width}px`;
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
const Dropdown = forwardRef(function Dropdown(props, ref) {
|
|
28
|
+
var _a;
|
|
29
|
+
const { children, disableClickAway = false, menu, onClose, popperProps, ...rest } = props;
|
|
30
|
+
const anchor = useRef(null);
|
|
31
|
+
const popperRef = useRef(null);
|
|
32
|
+
const composedRef = useComposeRefs([ref, popperRef]);
|
|
33
|
+
const open = popperProps === null || popperProps === void 0 ? void 0 : popperProps.open;
|
|
34
|
+
const modifiers = ((_a = popperProps === null || popperProps === void 0 ? void 0 : popperProps.options) === null || _a === void 0 ? void 0 : _a.modifiers) || [];
|
|
35
|
+
useClickAway(() => {
|
|
36
|
+
if (!open || disableClickAway || !onClose) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
return (event) => {
|
|
40
|
+
if (onClose) {
|
|
41
|
+
onClose(event);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}, popperRef, [
|
|
45
|
+
disableClickAway,
|
|
46
|
+
onClose,
|
|
47
|
+
open,
|
|
48
|
+
popperRef,
|
|
49
|
+
]);
|
|
50
|
+
return (jsxs(Fragment, { children: [children(anchor), jsx(Popper, Object.assign({}, popperProps, { ref: composedRef }, rest, { anchor: anchor, options: {
|
|
51
|
+
placement: 'top-start',
|
|
52
|
+
...popperProps === null || popperProps === void 0 ? void 0 : popperProps.options,
|
|
53
|
+
modifiers: [
|
|
54
|
+
...(popperOptions.modifiers || []),
|
|
55
|
+
...modifiers,
|
|
56
|
+
],
|
|
57
|
+
} }, { children: menu }), void 0)] }, void 0));
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export default Dropdown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DropdownProps, default, } from './Dropdown';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Dropdown.js';
|
package/Empty/Empty.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
+
export interface EmptyProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'title'> {
|
|
4
|
+
/**
|
|
5
|
+
* if true, the empty component will be 100% height of it's parent
|
|
6
|
+
*/
|
|
7
|
+
fullHeight?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Override default icon.
|
|
10
|
+
*/
|
|
11
|
+
image?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Optionally given a title. If not required, simply use react children to display description.
|
|
14
|
+
*/
|
|
15
|
+
title?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
declare const Empty: import("react").ForwardRefExoticComponent<EmptyProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export default Empty;
|
package/Empty/Empty.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { emptyClasses } from '@mezzanine-ui/core/empty';
|
|
4
|
+
import { FolderOpenIcon } from '@mezzanine-ui/icons';
|
|
5
|
+
import Icon from '../Icon/Icon.js';
|
|
6
|
+
import cx from 'clsx';
|
|
7
|
+
|
|
8
|
+
const Empty = forwardRef(function Empty(props, ref) {
|
|
9
|
+
const { children, className, fullHeight, image = jsx(Icon, { className: emptyClasses.icon, icon: FolderOpenIcon }, void 0), title, ...rest } = props;
|
|
10
|
+
return (jsxs("div", Object.assign({ ref: ref }, rest, { className: cx(emptyClasses.host, {
|
|
11
|
+
[emptyClasses.fullHeight]: fullHeight,
|
|
12
|
+
}, className) }, { children: [image, title && jsx("div", Object.assign({ className: emptyClasses.title }, { children: title }), void 0),
|
|
13
|
+
children && jsx("div", Object.assign({ className: emptyClasses.description }, { children: children }), void 0)] }), void 0));
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export default Empty;
|
package/Empty/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EmptyProps, default, } from './Empty';
|
package/Empty/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Empty.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Severity } from '@mezzanine-ui/system/severity';
|
|
3
|
+
export interface FormControl {
|
|
4
|
+
disabled: boolean;
|
|
5
|
+
fullWidth: boolean;
|
|
6
|
+
required: boolean;
|
|
7
|
+
severity?: Severity;
|
|
8
|
+
}
|
|
9
|
+
export declare const FormControlContext: import("react").Context<FormControl | undefined>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Severity } from '@mezzanine-ui/system/severity';
|
|
3
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
|
+
export interface FormFieldProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* To control the field passed from children whether should be disabled.
|
|
7
|
+
* The form message won't appear if disabled.
|
|
8
|
+
*/
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* To control the field passed from children whether should be fullWidth.
|
|
12
|
+
*/
|
|
13
|
+
fullWidth?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* To control the field passed from children whether should be required.
|
|
16
|
+
*/
|
|
17
|
+
required?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* To control the severity of field passed from children and form message.
|
|
20
|
+
*/
|
|
21
|
+
severity?: Severity;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The react component for `mezzanine` form field.
|
|
25
|
+
*/
|
|
26
|
+
declare const FormField: import("react").ForwardRefExoticComponent<FormFieldProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
27
|
+
export default FormField;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { formFieldClasses } from '@mezzanine-ui/core/form';
|
|
4
|
+
import { FormControlContext } from './FormControlContext.js';
|
|
5
|
+
import cx from 'clsx';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The react component for `mezzanine` form field.
|
|
9
|
+
*/
|
|
10
|
+
const FormField = forwardRef(function FormField(props, ref) {
|
|
11
|
+
const { children, className, disabled = false, fullWidth = false, required = false, severity, ...rest } = props;
|
|
12
|
+
const formControl = {
|
|
13
|
+
disabled,
|
|
14
|
+
fullWidth,
|
|
15
|
+
required,
|
|
16
|
+
severity,
|
|
17
|
+
};
|
|
18
|
+
return (jsx("div", Object.assign({}, rest, { ref: ref, className: cx(formFieldClasses.host, severity && formFieldClasses.severity(severity), {
|
|
19
|
+
[formFieldClasses.disabled]: disabled,
|
|
20
|
+
[formFieldClasses.fullWidth]: fullWidth,
|
|
21
|
+
}, className) }, { children: jsx(FormControlContext.Provider, Object.assign({ value: formControl }, { children: children }), void 0) }), void 0));
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export default FormField;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
+
export interface FormLabelProps extends NativeElementPropsWithoutKeyAndRef<'label'> {
|
|
4
|
+
remark?: ReactNode;
|
|
5
|
+
remarkIcon?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The react component for `mezzanine` form label.
|
|
9
|
+
*/
|
|
10
|
+
declare const FormLabel: import("react").ForwardRefExoticComponent<FormLabelProps & import("react").RefAttributes<HTMLLabelElement>>;
|
|
11
|
+
export default FormLabel;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext } from 'react';
|
|
3
|
+
import { formFieldClasses } from '@mezzanine-ui/core/form';
|
|
4
|
+
import { FormControlContext } from './FormControlContext.js';
|
|
5
|
+
import cx from 'clsx';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The react component for `mezzanine` form label.
|
|
9
|
+
*/
|
|
10
|
+
const FormLabel = forwardRef(function FormLabel(props, ref) {
|
|
11
|
+
const { children, className, htmlFor, remark, remarkIcon, ...rest } = props;
|
|
12
|
+
const { required } = useContext(FormControlContext) || {};
|
|
13
|
+
return (jsxs("label", Object.assign({}, rest, { ref: ref, className: cx(formFieldClasses.label, className), htmlFor: htmlFor }, { children: [jsxs("span", { children: [children, required && jsx("span", Object.assign({ className: formFieldClasses.asterisk }, { children: "*" }), void 0)] }, void 0),
|
|
14
|
+
(remark || remarkIcon) && (jsxs("span", Object.assign({ className: formFieldClasses.remark }, { children: [jsx("span", { children: remark }, void 0), remarkIcon] }), void 0))] }), void 0));
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export default FormLabel;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
+
export declare type FormMessageProps = NativeElementPropsWithoutKeyAndRef<'span'>;
|
|
4
|
+
/**
|
|
5
|
+
* The react component for `mezzanine` form message.
|
|
6
|
+
*/
|
|
7
|
+
declare const FormMessage: import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
8
|
+
export default FormMessage;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext } from 'react';
|
|
3
|
+
import { formMessageIcons, formFieldClasses } from '@mezzanine-ui/core/form';
|
|
4
|
+
import { FormControlContext } from './FormControlContext.js';
|
|
5
|
+
import Icon from '../Icon/Icon.js';
|
|
6
|
+
import cx from 'clsx';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The react component for `mezzanine` form message.
|
|
10
|
+
*/
|
|
11
|
+
const FormMessage = forwardRef(function FormMessage(props, ref) {
|
|
12
|
+
const { children, className, ...rest } = props;
|
|
13
|
+
const { severity } = useContext(FormControlContext) || {};
|
|
14
|
+
const icon = severity ? formMessageIcons[severity] : null;
|
|
15
|
+
return (jsxs("span", Object.assign({}, rest, { ref: ref, className: cx(formFieldClasses.message, className) }, { children: [icon && (jsx(Icon, { className: formFieldClasses.severityIcon, icon: icon }, void 0)), children] }), void 0));
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export default FormMessage;
|
package/Form/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './typings';
|
|
2
|
+
export * from './FormControlContext';
|
|
3
|
+
export { FormFieldProps, default as FormField } from './FormField';
|
|
4
|
+
export { FormLabelProps, default as FormLabel } from './FormLabel';
|
|
5
|
+
export { FormMessageProps, default as FormMessage } from './FormMessage';
|
package/Form/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Dispatch, MouseEvent, SetStateAction } from 'react';
|
|
2
|
+
import { SelectValue } from '../Select/typings';
|
|
3
|
+
export interface UseAutoCompleteValueControl {
|
|
4
|
+
defaultValue?: string;
|
|
5
|
+
disabledOptionsFilter: boolean;
|
|
6
|
+
onChange?(newOption: string): any;
|
|
7
|
+
onClear?(e: MouseEvent<Element>): void;
|
|
8
|
+
onClose?(): void;
|
|
9
|
+
options: string[];
|
|
10
|
+
value?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface AutoCompleteValueControl {
|
|
13
|
+
focused: boolean;
|
|
14
|
+
onChange: (v: SelectValue | null) => SelectValue[];
|
|
15
|
+
onClear(e: MouseEvent<Element>): void;
|
|
16
|
+
onFocus: (f: boolean) => void;
|
|
17
|
+
options: string[];
|
|
18
|
+
searchText: string;
|
|
19
|
+
setSearchText: Dispatch<SetStateAction<string>>;
|
|
20
|
+
setValue: Dispatch<SetStateAction<string>>;
|
|
21
|
+
value: SelectValue[];
|
|
22
|
+
}
|
|
23
|
+
export declare function useAutoCompleteValueControl(props: UseAutoCompleteValueControl): AutoCompleteValueControl;
|