@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
package/Tabs/Tab.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { tabsClasses } from '@mezzanine-ui/core/tabs';
|
|
4
|
+
import cx from 'clsx';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The react component for `mezzanine` tab.
|
|
8
|
+
*/
|
|
9
|
+
const Tab = forwardRef(function Tab(props, ref) {
|
|
10
|
+
const { active, children, className, disabled, ...rest } = props;
|
|
11
|
+
return (jsx("button", Object.assign({}, rest, { ref: ref, type: "button", "aria-disabled": disabled, className: cx(tabsClasses.tab, {
|
|
12
|
+
[tabsClasses.tabActive]: active,
|
|
13
|
+
}, className), disabled: disabled }, { children: children }), void 0));
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export default Tab;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
+
import { TabProps } from './Tab';
|
|
4
|
+
export interface TabPaneProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* Only for tabs to control the tab pane.
|
|
7
|
+
*/
|
|
8
|
+
tab: ReactElement<TabProps>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The react component for `mezzanine` tab pane.
|
|
12
|
+
*/
|
|
13
|
+
declare const TabPane: import("react").ForwardRefExoticComponent<TabPaneProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export default TabPane;
|
package/Tabs/TabPane.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { tabsClasses } from '@mezzanine-ui/core/tabs';
|
|
4
|
+
import cx from 'clsx';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The react component for `mezzanine` tab pane.
|
|
8
|
+
*/
|
|
9
|
+
const TabPane = forwardRef(function TabPane(props, ref) {
|
|
10
|
+
const { children, className,
|
|
11
|
+
/**
|
|
12
|
+
* Ignore it
|
|
13
|
+
*/
|
|
14
|
+
tab, ...rest } = props;
|
|
15
|
+
return (jsx("div", Object.assign({}, rest, { ref: ref, className: cx(tabsClasses.pane, className) }, { children: children }), void 0));
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export default TabPane;
|
package/Tabs/Tabs.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Key, MouseEvent, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
+
import { TabPaneProps } from './TabPane';
|
|
4
|
+
export declare type TabsChild = ReactElement<TabPaneProps>;
|
|
5
|
+
export interface TabsProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'onChange' | 'children'> {
|
|
6
|
+
/**
|
|
7
|
+
* Current TabPane's index
|
|
8
|
+
*/
|
|
9
|
+
activeKey?: Key;
|
|
10
|
+
/**
|
|
11
|
+
* Actions on the right side of tabBar
|
|
12
|
+
*/
|
|
13
|
+
actions?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* The tab panes in tabs
|
|
16
|
+
*/
|
|
17
|
+
children: TabsChild | TabsChild[];
|
|
18
|
+
/**
|
|
19
|
+
* Initial active TabPane's key, if activeKey is not set.
|
|
20
|
+
*/
|
|
21
|
+
defaultActiveKey?: Key;
|
|
22
|
+
/**
|
|
23
|
+
* The change event handler of Tabs
|
|
24
|
+
*/
|
|
25
|
+
onChange?: (activeKey: Key) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Callback executed when tab is clicked
|
|
28
|
+
*/
|
|
29
|
+
onTabClick?: (key: Key, event: MouseEvent) => void;
|
|
30
|
+
/**
|
|
31
|
+
* The className of tabBar
|
|
32
|
+
*/
|
|
33
|
+
tabBarClassName?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The react component for `mezzanine` tabs.
|
|
37
|
+
*/
|
|
38
|
+
declare const Tabs: import("react").ForwardRefExoticComponent<TabsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
39
|
+
export default Tabs;
|
package/Tabs/Tabs.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useRef, Children, cloneElement } from 'react';
|
|
3
|
+
import { tabsClasses } from '@mezzanine-ui/core/tabs';
|
|
4
|
+
import { ChevronLeftIcon, ChevronRightIcon } from '@mezzanine-ui/icons';
|
|
5
|
+
import { useCustomControlValue } from '../Form/useCustomControlValue.js';
|
|
6
|
+
import useTabsOverflow from './useTabsOverflow.js';
|
|
7
|
+
import Icon from '../Icon/Icon.js';
|
|
8
|
+
import cx from 'clsx';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The react component for `mezzanine` tabs.
|
|
12
|
+
*/
|
|
13
|
+
const Tabs = forwardRef(function Tabs(props, ref) {
|
|
14
|
+
const { activeKey: activeKeyProp, actions, children, className, defaultActiveKey = 0, onChange, onTabClick, tabBarClassName, ...rest } = props;
|
|
15
|
+
const tabsRef = useRef(null);
|
|
16
|
+
const [activeKey, setActiveKey] = useCustomControlValue({
|
|
17
|
+
defaultValue: defaultActiveKey,
|
|
18
|
+
onChange,
|
|
19
|
+
value: activeKeyProp,
|
|
20
|
+
});
|
|
21
|
+
let pane;
|
|
22
|
+
const tabs = Children.map(children, (tabPane, index) => {
|
|
23
|
+
var _a;
|
|
24
|
+
const key = (_a = tabPane.key) !== null && _a !== void 0 ? _a : index;
|
|
25
|
+
const { tab } = tabPane.props;
|
|
26
|
+
const active = activeKey.toString() === key.toString();
|
|
27
|
+
if (active) {
|
|
28
|
+
pane = tabPane;
|
|
29
|
+
}
|
|
30
|
+
return cloneElement(tab, {
|
|
31
|
+
key,
|
|
32
|
+
active,
|
|
33
|
+
onClick: (event) => {
|
|
34
|
+
if (!active) {
|
|
35
|
+
setActiveKey(key);
|
|
36
|
+
}
|
|
37
|
+
if (onTabClick) {
|
|
38
|
+
onTabClick(key, event);
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
const { isOverflowing, isScrollToBegin, isScrollToEnd, scrollToLeft, scrollToRight, } = useTabsOverflow(tabsRef);
|
|
44
|
+
return (jsxs("div", Object.assign({}, rest, { ref: ref, className: cx(tabsClasses.host, className) }, { children: [jsxs("div", Object.assign({ className: cx(tabsClasses.tabBar, tabBarClassName) }, { children: [jsxs("div", Object.assign({ className: tabsClasses.overflow }, { children: [isOverflowing && !isScrollToBegin && (jsx("button", Object.assign({ "aria-label": "scrollToLeft", className: tabsClasses.scrollBtn, onClick: () => scrollToLeft(), type: "button" }, { children: jsx(Icon, { icon: ChevronLeftIcon }, void 0) }), void 0)),
|
|
45
|
+
jsx("div", Object.assign({ ref: tabsRef, className: tabsClasses.tabs }, { children: tabs }), void 0),
|
|
46
|
+
isOverflowing && !isScrollToEnd && (jsx("button", Object.assign({ "aria-label": "scrollToRight", className: tabsClasses.scrollBtn, onClick: () => scrollToRight(), type: "button" }, { children: jsx(Icon, { icon: ChevronRightIcon }, void 0) }), void 0))] }), void 0), actions] }), void 0), pane] }), void 0));
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export default Tabs;
|
package/Tabs/index.d.ts
ADDED
package/Tabs/index.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { useWindowWidth } from '../hooks/useWindowWidth.js';
|
|
3
|
+
|
|
4
|
+
function useTabsOverflow(tabsRef) {
|
|
5
|
+
const [isOverflowing, setIsOverflowing] = useState(false);
|
|
6
|
+
const [scrollState, setScrollState] = useState('begin');
|
|
7
|
+
const isScrollToBegin = scrollState === 'begin';
|
|
8
|
+
const isScrollToEnd = scrollState === 'end';
|
|
9
|
+
const windowWidth = useWindowWidth();
|
|
10
|
+
function handleScrollState() {
|
|
11
|
+
if (tabsRef.current) {
|
|
12
|
+
const offsetRight = tabsRef.current.scrollWidth - tabsRef.current.clientWidth;
|
|
13
|
+
if (tabsRef.current.scrollLeft === 0) {
|
|
14
|
+
setScrollState('begin');
|
|
15
|
+
}
|
|
16
|
+
else if (tabsRef.current.scrollLeft >= offsetRight) {
|
|
17
|
+
setScrollState('end');
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
setScrollState('middle');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function scrollToLeft() {
|
|
25
|
+
if (tabsRef.current) {
|
|
26
|
+
tabsRef.current.scrollTo(0, 0);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function scrollToRight() {
|
|
30
|
+
if (tabsRef.current) {
|
|
31
|
+
const offsetRight = tabsRef.current.scrollWidth - tabsRef.current.clientWidth;
|
|
32
|
+
tabsRef.current.scrollTo(offsetRight, 0);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (tabsRef.current) {
|
|
37
|
+
const isXOverflowing = tabsRef.current.scrollWidth > tabsRef.current.clientWidth;
|
|
38
|
+
if (isOverflowing !== isXOverflowing) {
|
|
39
|
+
setIsOverflowing(isXOverflowing);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}, [isOverflowing, windowWidth]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (tabsRef.current) {
|
|
45
|
+
tabsRef.current.addEventListener('scroll', handleScrollState);
|
|
46
|
+
return () => { var _a; return (_a = tabsRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', handleScrollState); };
|
|
47
|
+
}
|
|
48
|
+
}, [tabsRef.current]);
|
|
49
|
+
return {
|
|
50
|
+
isOverflowing,
|
|
51
|
+
isScrollToBegin,
|
|
52
|
+
isScrollToEnd,
|
|
53
|
+
scrollToLeft,
|
|
54
|
+
scrollToRight,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default useTabsOverflow;
|
package/Tag/Tag.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MouseEventHandler } from 'react';
|
|
2
|
+
import { TagSize } from '@mezzanine-ui/core/tag';
|
|
3
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
|
+
export interface TagProps extends NativeElementPropsWithoutKeyAndRef<'span'> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the tag can be closed.
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
closable?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the tag disabled.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Callback executed while tag closed.
|
|
17
|
+
*/
|
|
18
|
+
onClose?: MouseEventHandler;
|
|
19
|
+
/**
|
|
20
|
+
* The size of the tag.
|
|
21
|
+
* @default 'medium'
|
|
22
|
+
*/
|
|
23
|
+
size?: TagSize;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The react component for `mezzanine` tag.
|
|
27
|
+
*/
|
|
28
|
+
declare const Tag: import("react").ForwardRefExoticComponent<TagProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
29
|
+
export default Tag;
|
package/Tag/Tag.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { tagClasses } from '@mezzanine-ui/core/tag';
|
|
4
|
+
import { TimesIcon } from '@mezzanine-ui/icons';
|
|
5
|
+
import Icon from '../Icon/Icon.js';
|
|
6
|
+
import cx from 'clsx';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The react component for `mezzanine` tag.
|
|
10
|
+
*/
|
|
11
|
+
const Tag = forwardRef(function Tag(props, ref) {
|
|
12
|
+
const { children, className, closable = false, disabled = false, onClose, size = 'medium', ...rest } = props;
|
|
13
|
+
return (jsxs("span", Object.assign({}, rest, { ref: ref, "aria-disabled": disabled, className: cx(tagClasses.host, tagClasses.size(size), {
|
|
14
|
+
[tagClasses.disabled]: disabled,
|
|
15
|
+
}, className) }, { children: [jsx("span", Object.assign({ className: tagClasses.label }, { children: children }), void 0),
|
|
16
|
+
closable && (jsx(Icon, { className: tagClasses.closeIcon, icon: TimesIcon, onClick: (event) => {
|
|
17
|
+
if (!disabled && onClose) {
|
|
18
|
+
onClose(event);
|
|
19
|
+
}
|
|
20
|
+
}, tabIndex: -1 }, void 0))] }), void 0));
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export default Tag;
|
package/Tag/index.d.ts
ADDED
package/Tag/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Tag.js';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { MouseEventHandler, ReactNode, ReactElement } from 'react';
|
|
2
|
+
import { TextFieldSize } from '@mezzanine-ui/core/text-field';
|
|
3
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
|
+
export interface TextFieldProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'defaultValue' | 'onChange' | 'prefix'> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the field is active.
|
|
7
|
+
*/
|
|
8
|
+
active?: boolean;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Whether to show the clear button.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
clearable?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the field is disabled.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the field is error.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
error?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* If `true`, set width: 100%.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
fullWidth?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* The callback will be fired after clear icon clicked.
|
|
33
|
+
*/
|
|
34
|
+
onClear?: MouseEventHandler;
|
|
35
|
+
/**
|
|
36
|
+
* The prefix addon of the field.
|
|
37
|
+
*/
|
|
38
|
+
prefix?: ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* The size of field.
|
|
41
|
+
* @default 'medium'
|
|
42
|
+
*/
|
|
43
|
+
size?: TextFieldSize;
|
|
44
|
+
/**
|
|
45
|
+
* The suffix addon of the field.
|
|
46
|
+
*/
|
|
47
|
+
suffix?: ReactNode;
|
|
48
|
+
suffixActionIcon?: ReactElement;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The react component for `mezzanine` input.
|
|
52
|
+
*/
|
|
53
|
+
declare const TextField: import("react").ForwardRefExoticComponent<TextFieldProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
54
|
+
export default TextField;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, cloneElement } from 'react';
|
|
3
|
+
import { TimesIcon } from '@mezzanine-ui/icons';
|
|
4
|
+
import { textFieldClasses } from '@mezzanine-ui/core/text-field';
|
|
5
|
+
import { useTextFieldControl } from './useTextFieldControl.js';
|
|
6
|
+
import Icon from '../Icon/Icon.js';
|
|
7
|
+
import cx from 'clsx';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The react component for `mezzanine` input.
|
|
11
|
+
*/
|
|
12
|
+
const TextField = forwardRef(function TextField(props, ref) {
|
|
13
|
+
const { active = false, children, className, clearable = false, disabled = false, error = false, fullWidth, onClear, onClick: onClickProps, onKeyDown: onKeyDownProps, prefix, role: roleProp, size = 'medium', suffix, suffixActionIcon, ...rest } = props;
|
|
14
|
+
const { role, onClick, onKeyDown, } = useTextFieldControl({
|
|
15
|
+
onClick: onClickProps,
|
|
16
|
+
onKeyDown: onKeyDownProps,
|
|
17
|
+
});
|
|
18
|
+
return (
|
|
19
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
20
|
+
jsxs("div", Object.assign({}, rest, { ref: ref, role: roleProp || role, onClick: onClick, onKeyDown: onKeyDown, className: cx(textFieldClasses.host, textFieldClasses.size(size), {
|
|
21
|
+
[textFieldClasses.active]: active,
|
|
22
|
+
[textFieldClasses.clearable]: clearable,
|
|
23
|
+
[textFieldClasses.disabled]: disabled,
|
|
24
|
+
[textFieldClasses.error]: error,
|
|
25
|
+
[textFieldClasses.fullWidth]: fullWidth,
|
|
26
|
+
[textFieldClasses.withPrefix]: prefix,
|
|
27
|
+
[textFieldClasses.withSuffix]: suffix || suffixActionIcon,
|
|
28
|
+
}, className) }, { children: [prefix && jsx("div", Object.assign({ className: textFieldClasses.prefix }, { children: prefix }), void 0), children, suffix && jsx("div", Object.assign({ className: textFieldClasses.suffix }, { children: suffix }), void 0), suffixActionIcon && cloneElement(suffixActionIcon, {
|
|
29
|
+
className: cx(textFieldClasses.actionIcon, suffixActionIcon.props.className),
|
|
30
|
+
role: 'button',
|
|
31
|
+
tabIndex: -1,
|
|
32
|
+
}), clearable && (jsx(Icon, { className: textFieldClasses.clearIcon, icon: TimesIcon, onClick: (event) => {
|
|
33
|
+
if (!disabled && onClear) {
|
|
34
|
+
onClear(event);
|
|
35
|
+
}
|
|
36
|
+
}, onMouseDown: (event) => event.preventDefault(), role: "button", tabIndex: -1 }, void 0))] }), void 0));
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export default TextField;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TextField.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MouseEventHandler, KeyboardEventHandler } from 'react';
|
|
2
|
+
export interface UseTextFieldControlProps {
|
|
3
|
+
onClick?: MouseEventHandler;
|
|
4
|
+
onKeyDown?: KeyboardEventHandler;
|
|
5
|
+
}
|
|
6
|
+
export declare function useTextFieldControl(props: UseTextFieldControlProps): {
|
|
7
|
+
role: string;
|
|
8
|
+
onClick: ((event: import("react").MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
9
|
+
onKeyDown: ((event: import("react").KeyboardEvent<Element>) => void) | undefined;
|
|
10
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function useTextFieldControl(props) {
|
|
2
|
+
const { onClick = undefined, onKeyDown = undefined, } = props || {};
|
|
3
|
+
const getRole = () => {
|
|
4
|
+
if (typeof onClick !== 'undefined')
|
|
5
|
+
return 'button';
|
|
6
|
+
return 'textbox';
|
|
7
|
+
};
|
|
8
|
+
return {
|
|
9
|
+
role: getRole(),
|
|
10
|
+
onClick,
|
|
11
|
+
onKeyDown,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { useTextFieldControl };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Ref, ChangeEventHandler } from 'react';
|
|
2
|
+
import { TextareaSize } from '@mezzanine-ui/core/textarea';
|
|
3
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
|
+
import { TextFieldProps } from '../TextField';
|
|
5
|
+
export interface TextareaProps extends Omit<TextFieldProps, 'active' | 'children' | 'onClear' | 'prefix' | 'suffix'> {
|
|
6
|
+
/**
|
|
7
|
+
* The default value of textarea.
|
|
8
|
+
*/
|
|
9
|
+
defaultValue?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The max length of textarea.
|
|
12
|
+
*/
|
|
13
|
+
maxLength?: number;
|
|
14
|
+
/**
|
|
15
|
+
* The change event handler of textarea element.
|
|
16
|
+
*/
|
|
17
|
+
onChange?: ChangeEventHandler<HTMLTextAreaElement>;
|
|
18
|
+
/**
|
|
19
|
+
* The placeholder of textarea.
|
|
20
|
+
*/
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the textarea is readonly.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
readOnly?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the input is required.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
required?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The rows of textarea.
|
|
34
|
+
*/
|
|
35
|
+
rows?: number;
|
|
36
|
+
/**
|
|
37
|
+
* The size of textarea.
|
|
38
|
+
* @default 'medium'
|
|
39
|
+
*/
|
|
40
|
+
size?: TextareaSize;
|
|
41
|
+
/**
|
|
42
|
+
* The react ref passed to textarea element.
|
|
43
|
+
*/
|
|
44
|
+
textareaRef?: Ref<HTMLTextAreaElement>;
|
|
45
|
+
/**
|
|
46
|
+
* The other native props for textarea element.
|
|
47
|
+
*/
|
|
48
|
+
textareaProps?: Omit<NativeElementPropsWithoutKeyAndRef<'textarea'>, 'defaultValue' | 'disabled' | 'maxLength' | 'onChange' | 'placeholder' | 'readOnly' | 'required' | 'rows' | 'value' | `aria-${'disabled' | 'multiline' | 'readonly' | 'required'}`>;
|
|
49
|
+
/**
|
|
50
|
+
* The value of textarea.
|
|
51
|
+
*/
|
|
52
|
+
value?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The react component for `mezzanine` textarea.
|
|
56
|
+
*/
|
|
57
|
+
declare const Textarea: import("react").ForwardRefExoticComponent<TextareaProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
58
|
+
export default Textarea;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext, useRef } from 'react';
|
|
3
|
+
import { textareaClasses } from '@mezzanine-ui/core/textarea';
|
|
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` textarea.
|
|
12
|
+
*/
|
|
13
|
+
const Textarea = forwardRef(function Textarea(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, maxLength, onChange: onChangeProp, placeholder, readOnly = false, required = requiredFromFormControl || false, rows, size = 'medium', textareaRef: textareaRefProp, textareaProps, value: valueProp, } = props;
|
|
16
|
+
const textareaRef = useRef(null);
|
|
17
|
+
const [value, onChange, onClear,] = useInputWithClearControlValue({
|
|
18
|
+
defaultValue,
|
|
19
|
+
onChange: onChangeProp,
|
|
20
|
+
ref: textareaRef,
|
|
21
|
+
value: valueProp,
|
|
22
|
+
});
|
|
23
|
+
const composedTextareaRef = useComposeRefs([textareaRefProp, textareaRef]);
|
|
24
|
+
const active = !!value;
|
|
25
|
+
const currentLength = value.length;
|
|
26
|
+
const upperLimit = typeof maxLength === 'number' && currentLength >= maxLength;
|
|
27
|
+
return (jsxs(TextField, Object.assign({ ref: ref, active: active, className: cx(textareaClasses.host, {
|
|
28
|
+
[textareaClasses.upperLimit]: upperLimit,
|
|
29
|
+
}, className), clearable: clearable, disabled: disabled, error: error, fullWidth: fullWidth, onClear: onClear, size: size }, { children: [jsx("textarea", Object.assign({}, textareaProps, { ref: composedTextareaRef, "aria-disabled": disabled, "aria-multiline": true, "aria-readonly": readOnly, "aria-required": required, disabled: disabled, maxLength: maxLength, onChange: onChange, placeholder: placeholder, readOnly: readOnly, required: required, rows: rows, value: value }), void 0),
|
|
30
|
+
typeof maxLength === 'number' && (jsxs("span", Object.assign({ className: textareaClasses.count }, { children: [value.length, "/", maxLength] }), void 0))] }), void 0));
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export default Textarea;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Textarea.js';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DateType } from '@mezzanine-ui/core/calendar';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
|
+
import { TimePanelActionProps } from './TimePanelAction';
|
|
5
|
+
export interface TimePanelProps extends Pick<TimePanelActionProps, 'confirmText' | 'onConfirm'>, Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'value' | 'onChange' | 'children'> {
|
|
6
|
+
/**
|
|
7
|
+
* Controls whether or not to hide hours column.
|
|
8
|
+
*/
|
|
9
|
+
hideHour?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Controls whether or not to hide minutes column.
|
|
12
|
+
*/
|
|
13
|
+
hideMinute?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Controls whether or not to hide seconds column.
|
|
16
|
+
*/
|
|
17
|
+
hideSecond?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The hours column prefix.
|
|
20
|
+
* @default 'Hrs''
|
|
21
|
+
*/
|
|
22
|
+
hourPrefix?: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* The steps of hour.
|
|
25
|
+
* @default 1
|
|
26
|
+
*/
|
|
27
|
+
hourStep?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The minutes column prefix.
|
|
30
|
+
* @default 'Min''
|
|
31
|
+
*/
|
|
32
|
+
minutePrefix?: ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* The steps of minute.
|
|
35
|
+
* @default 1
|
|
36
|
+
*/
|
|
37
|
+
minuteStep?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Change handler. Takes `DateType` as its argument.
|
|
40
|
+
*/
|
|
41
|
+
onChange?: (target: DateType) => void;
|
|
42
|
+
/**
|
|
43
|
+
* The seconds column prefix.
|
|
44
|
+
* @default 'Sec''
|
|
45
|
+
*/
|
|
46
|
+
secondPrefix?: ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* The steps of second.
|
|
49
|
+
* @default 1
|
|
50
|
+
*/
|
|
51
|
+
secondStep?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Display value of the panel
|
|
54
|
+
*/
|
|
55
|
+
value?: DateType;
|
|
56
|
+
/**
|
|
57
|
+
* Controls whether or not to show actions.
|
|
58
|
+
*/
|
|
59
|
+
withoutAction?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The react component for `mezzanine` time panel.
|
|
63
|
+
* Notice that any component related to time-panel should be used along with `CalendarContext`.
|
|
64
|
+
*/
|
|
65
|
+
declare const TimePanel: import("react").ForwardRefExoticComponent<TimePanelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
66
|
+
export default TimePanel;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { getUnits, timePanelClasses } from '@mezzanine-ui/core/time-panel';
|
|
3
|
+
import { forwardRef, useMemo } from 'react';
|
|
4
|
+
import TimePanelAction from './TimePanelAction.js';
|
|
5
|
+
import TimePanelColumn from './TimePanelColumn.js';
|
|
6
|
+
import { useCalendarContext } from '../Calendar/CalendarContext.js';
|
|
7
|
+
import cx from 'clsx';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The react component for `mezzanine` time panel.
|
|
11
|
+
* Notice that any component related to time-panel should be used along with `CalendarContext`.
|
|
12
|
+
*/
|
|
13
|
+
const TimePanel = forwardRef(function TimePanel(props, ref) {
|
|
14
|
+
const { getHour, getMinute, getSecond, setHour, setMinute, setSecond, startOf, getNow, } = useCalendarContext();
|
|
15
|
+
const { className, confirmText, hideHour = false, hideMinute = false, hideSecond = false, hourPrefix = 'Hrs', hourStep = 1, minutePrefix = 'Min', minuteStep = 1, onChange, onConfirm, secondPrefix = 'Sec', secondStep = 1, value, withoutAction = false, ...restHostProps } = props;
|
|
16
|
+
const setters = {
|
|
17
|
+
hour: setHour,
|
|
18
|
+
minute: setMinute,
|
|
19
|
+
second: setSecond,
|
|
20
|
+
};
|
|
21
|
+
const getters = {
|
|
22
|
+
hour: getHour,
|
|
23
|
+
minute: getMinute,
|
|
24
|
+
second: getSecond,
|
|
25
|
+
};
|
|
26
|
+
const hourUnits = useMemo(() => (hideHour ? undefined : getUnits(0, 23, hourStep)), [hideHour, hourStep]);
|
|
27
|
+
const minuteUnits = useMemo(() => (hideMinute ? undefined : getUnits(0, 59, minuteStep)), [hideMinute, minuteStep]);
|
|
28
|
+
const secondUnits = useMemo(() => (hideSecond ? undefined : getUnits(0, 59, secondStep)), [hideSecond, secondStep]);
|
|
29
|
+
const activeHour = value ? getHour(value) : undefined;
|
|
30
|
+
const activeMinute = value ? getMinute(value) : undefined;
|
|
31
|
+
const activeSecond = value ? getSecond(value) : undefined;
|
|
32
|
+
function getControlHandle(granularity, units, steps) {
|
|
33
|
+
if (!onChange || !units)
|
|
34
|
+
return undefined;
|
|
35
|
+
const getter = getters[granularity];
|
|
36
|
+
const setter = setters[granularity];
|
|
37
|
+
return () => {
|
|
38
|
+
if (!value) {
|
|
39
|
+
const target = startOf(getNow(), 'day');
|
|
40
|
+
onChange(target);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const nextIndex = (getter(value) + steps) / Math.abs(steps);
|
|
44
|
+
const guardedNextIndex = nextIndex >= 0 ? nextIndex : units.length + nextIndex;
|
|
45
|
+
const newUnitIndex = guardedNextIndex % units.length;
|
|
46
|
+
const newUnit = units[newUnitIndex].value;
|
|
47
|
+
const target = setter(value, newUnit);
|
|
48
|
+
onChange(target);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function getChangeHandle(granularity) {
|
|
52
|
+
if (!onChange)
|
|
53
|
+
return undefined;
|
|
54
|
+
const setter = setters[granularity];
|
|
55
|
+
const currentValue = value || startOf(getNow(), 'day');
|
|
56
|
+
return (target) => {
|
|
57
|
+
const result = setter(currentValue, target.value);
|
|
58
|
+
onChange(result);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return (jsxs("div", Object.assign({}, restHostProps, { ref: ref, className: cx(timePanelClasses.host, className) }, { children: [jsxs("div", Object.assign({ className: timePanelClasses.columns }, { children: [!hideHour && hourUnits && (jsx(TimePanelColumn, { prefix: hourPrefix, units: hourUnits, activeUnit: activeHour, onChange: getChangeHandle('hour'), onNext: getControlHandle('hour', hourUnits, hourStep), onPrev: getControlHandle('hour', hourUnits, -hourStep) }, void 0)),
|
|
62
|
+
!hideMinute && minuteUnits && (jsx(TimePanelColumn, { prefix: minutePrefix, units: minuteUnits, activeUnit: activeMinute, onChange: getChangeHandle('minute'), onNext: getControlHandle('minute', minuteUnits, minuteStep), onPrev: getControlHandle('minute', minuteUnits, -minuteStep) }, void 0)),
|
|
63
|
+
!hideSecond && secondUnits && (jsx(TimePanelColumn, { prefix: secondPrefix, units: secondUnits, activeUnit: activeSecond, onChange: getChangeHandle('second'), onNext: getControlHandle('second', secondUnits, secondStep), onPrev: getControlHandle('second', secondUnits, -secondStep) }, void 0))] }), void 0),
|
|
64
|
+
!withoutAction && (jsx(TimePanelAction, { onConfirm: onConfirm, confirmText: confirmText }, void 0))] }), void 0));
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export default TimePanel;
|