@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/Button/Button.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { SpinnerIcon } from '@mezzanine-ui/icons';
|
|
4
|
+
import { buttonClasses } from '@mezzanine-ui/core/button';
|
|
5
|
+
import Icon from '../Icon/Icon.js';
|
|
6
|
+
import cx from 'clsx';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The react component for `mezzanine` button.
|
|
10
|
+
*/
|
|
11
|
+
const Button = forwardRef(function Button(props, ref) {
|
|
12
|
+
const { children, className, color = 'primary', component: Component = 'button', danger = false, disabled = false, loading = false, onClick, prefix: prefixProp, size = 'medium', suffix: suffixProp, variant = 'text', ...rest } = props;
|
|
13
|
+
let prefix = prefixProp;
|
|
14
|
+
let suffix = suffixProp;
|
|
15
|
+
if (loading) {
|
|
16
|
+
const loadingIcon = jsx(Icon, { icon: SpinnerIcon, spin: true }, void 0);
|
|
17
|
+
if (suffix && !prefix) {
|
|
18
|
+
suffix = loadingIcon;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
prefix = loadingIcon;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const asIconBtn = children == null && !!(prefix || suffix);
|
|
25
|
+
return (jsxs(Component, Object.assign({}, rest, { ref: ref, "aria-disabled": disabled, className: cx(buttonClasses.host, buttonClasses.variant(variant), buttonClasses.color(color), buttonClasses.size(size), {
|
|
26
|
+
[buttonClasses.danger]: danger,
|
|
27
|
+
[buttonClasses.disabled]: disabled,
|
|
28
|
+
[buttonClasses.icon]: asIconBtn,
|
|
29
|
+
[buttonClasses.loading]: loading,
|
|
30
|
+
}, className), disabled: disabled, onClick: (event) => {
|
|
31
|
+
if (!disabled && !loading && onClick) {
|
|
32
|
+
onClick(event);
|
|
33
|
+
}
|
|
34
|
+
} }, { children: [prefix, children && jsx("span", Object.assign({ className: buttonClasses.label }, { children: children }), void 0), suffix] }), void 0));
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export default Button;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ButtonColor, ButtonGroupOrientation, ButtonGroupSpacing, ButtonSize, ButtonVariant } from '@mezzanine-ui/core/button';
|
|
3
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
|
+
import { ButtonProps } from './Button';
|
|
5
|
+
import { IconButtonProps } from './IconButton';
|
|
6
|
+
export declare type ButtonGroupChild = ReactElement<ButtonProps | IconButtonProps> | null | undefined | false;
|
|
7
|
+
export interface ButtonGroupProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
8
|
+
/**
|
|
9
|
+
* If `true`, all buttons will not have spacing between each others.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
attached?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Only accept button elements or icon button elements.
|
|
15
|
+
*/
|
|
16
|
+
children: ButtonGroupChild | ButtonGroupChild[];
|
|
17
|
+
/**
|
|
18
|
+
* If the `color` of a button inside group not provided, the `color` of group will override it.
|
|
19
|
+
* @default 'primary'
|
|
20
|
+
*/
|
|
21
|
+
color?: ButtonColor;
|
|
22
|
+
/**
|
|
23
|
+
* If the `danger` of a button inside group not provided, the `danger` of group will override it.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
danger?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* If the `disabled` of a button inside group not provided, the `disabled` of group will override it.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* If `true`, set width: 100%.
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
fullWidth?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The orientation of button group.
|
|
39
|
+
* @default horizontal
|
|
40
|
+
*/
|
|
41
|
+
orientation?: ButtonGroupOrientation;
|
|
42
|
+
/**
|
|
43
|
+
* If the `size` of a button inside group not provided, the `size` of group will override it.
|
|
44
|
+
* @default 'medium'
|
|
45
|
+
*/
|
|
46
|
+
size?: ButtonSize;
|
|
47
|
+
/**
|
|
48
|
+
* The spacing level of button gap between each buttons.
|
|
49
|
+
* Will be added on if `attached`=false.
|
|
50
|
+
* @default small:3,others:4
|
|
51
|
+
*/
|
|
52
|
+
spacing?: ButtonGroupSpacing;
|
|
53
|
+
/**
|
|
54
|
+
* If the `variant` of a button inside group not provided, the `variant` of group will override it.
|
|
55
|
+
* @default 'text'
|
|
56
|
+
*/
|
|
57
|
+
variant?: ButtonVariant;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The react component for `mezzanine` button group.
|
|
61
|
+
*/
|
|
62
|
+
declare const ButtonGroup: import("react").ForwardRefExoticComponent<ButtonGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
63
|
+
export default ButtonGroup;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, Children, cloneElement } from 'react';
|
|
3
|
+
import { toButtonGroupCssVars, buttonGroupClasses } from '@mezzanine-ui/core/button';
|
|
4
|
+
import cx from 'clsx';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The react component for `mezzanine` button group.
|
|
8
|
+
*/
|
|
9
|
+
const ButtonGroup = forwardRef(function ButtonGroup(props, ref) {
|
|
10
|
+
const { attached = false, children, className, color = 'primary', danger = false, disabled = false, fullWidth = false, orientation = 'horizontal', role = 'group', size = 'medium', spacing, style: styleProp, variant = 'text', ...rest } = props;
|
|
11
|
+
const cssVars = toButtonGroupCssVars({ size, spacing });
|
|
12
|
+
const style = {
|
|
13
|
+
...styleProp,
|
|
14
|
+
...cssVars,
|
|
15
|
+
};
|
|
16
|
+
return (jsx("div", Object.assign({ ref: ref }, rest, { "aria-orientation": orientation, className: cx(buttonGroupClasses.host, buttonGroupClasses.orientation(orientation), {
|
|
17
|
+
[buttonGroupClasses.fullWidth]: fullWidth,
|
|
18
|
+
[buttonGroupClasses.attached]: attached,
|
|
19
|
+
}, className), role: role, style: style }, { children: Children.map(children, (unknownChild) => {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
const child = unknownChild;
|
|
22
|
+
if (!child) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return cloneElement(child, {
|
|
26
|
+
color: child.props.color || color,
|
|
27
|
+
danger: (_a = child.props.danger) !== null && _a !== void 0 ? _a : danger,
|
|
28
|
+
disabled: (_b = child.props.disabled) !== null && _b !== void 0 ? _b : disabled,
|
|
29
|
+
size: child.props.size || size,
|
|
30
|
+
variant: child.props.variant || variant,
|
|
31
|
+
});
|
|
32
|
+
}) }), void 0));
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export default ButtonGroup;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ComponentOverridableForwardRefComponentPropsFactory } from '../utils/jsx-types';
|
|
3
|
+
import { ButtonComponent, ButtonPropsBase } from './typings';
|
|
4
|
+
export declare type IconButtonProps<C extends ButtonComponent = 'button'> = ComponentOverridableForwardRefComponentPropsFactory<ButtonComponent, C, Omit<ButtonPropsBase, 'prefix' | 'suffix'> & {
|
|
5
|
+
/**
|
|
6
|
+
* The icon element.
|
|
7
|
+
*/
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* The react component for `mezzanine` button only has icon.
|
|
12
|
+
*/
|
|
13
|
+
declare const IconButton: import("react").ForwardRefExoticComponent<Pick<Pick<Pick<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "prefix" | "color" | "disabled" | "key" | "form" | "slot" | "style" | "title" | "children" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "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" | "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">, "prefix" | "color" | "disabled" | "form" | "slot" | "style" | "title" | "children" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "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" | "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">, "prefix" | "form" | "slot" | "style" | "title" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "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" | "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"> & Pick<ButtonPropsBase, "color" | "danger" | "disabled" | "loading" | "size" | "variant"> & {
|
|
14
|
+
/**
|
|
15
|
+
* The icon element.
|
|
16
|
+
*/
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
}, "prefix" | "color" | "danger" | "disabled" | "loading" | "size" | "variant" | "form" | "slot" | "style" | "title" | "children" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "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" | "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"> & {
|
|
19
|
+
component?: "button" | "a" | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>) | undefined;
|
|
20
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
21
|
+
export default IconButton;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import Button from './Button.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The react component for `mezzanine` button only has icon.
|
|
7
|
+
*/
|
|
8
|
+
const IconButton = forwardRef(function IconButton(props, ref) {
|
|
9
|
+
const { children, ...rest } = props;
|
|
10
|
+
return (jsx(Button, Object.assign({}, rest, { ref: ref, prefix: children }), void 0));
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export default IconButton;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ElementRef, PropsWithoutRef, ReactElement, RefAttributes } from 'react';
|
|
2
|
+
import { ButtonComponent, ButtonPropsBase } from './typings';
|
|
3
|
+
import { ButtonProps } from './Button';
|
|
4
|
+
import { IconButtonProps } from './IconButton';
|
|
5
|
+
export type { ButtonColor, ButtonGroupOrientation, ButtonGroupSpacing, ButtonSize, ButtonVariant, } from '@mezzanine-ui/core/button';
|
|
6
|
+
export { ButtonGroupChild, ButtonGroupProps, default as ButtonGroup } from './ButtonGroup';
|
|
7
|
+
export type { ButtonComponent, ButtonProps, ButtonPropsBase, IconButtonProps, };
|
|
8
|
+
/**
|
|
9
|
+
* @remark
|
|
10
|
+
* Add type alias here for parsable to react docgen typescript.
|
|
11
|
+
*/
|
|
12
|
+
declare type GenericIconButton = <C extends ButtonComponent = 'button'>(props: PropsWithoutRef<IconButtonProps<C>> & RefAttributes<ElementRef<C>>) => ReactElement;
|
|
13
|
+
export declare const IconButton: GenericIconButton;
|
|
14
|
+
/**
|
|
15
|
+
* @remark
|
|
16
|
+
* Add type alias here for parsable to react docgen typescript.
|
|
17
|
+
*/
|
|
18
|
+
declare type GenericButton = <C extends ButtonComponent = 'button'>(props: PropsWithoutRef<ButtonProps<C>> & RefAttributes<ElementRef<C>>) => ReactElement;
|
|
19
|
+
declare const _default: GenericButton;
|
|
20
|
+
export default _default;
|
package/Button/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { JSXElementConstructor, ReactNode } from 'react';
|
|
2
|
+
import { ButtonColor, ButtonSize, ButtonVariant } from '@mezzanine-ui/core/button';
|
|
3
|
+
export declare type ButtonComponent = 'button' | 'a' | JSXElementConstructor<any>;
|
|
4
|
+
export interface ButtonPropsBase {
|
|
5
|
+
/**
|
|
6
|
+
* The color name provided by palette.
|
|
7
|
+
* @default 'primary'
|
|
8
|
+
*/
|
|
9
|
+
color?: ButtonColor;
|
|
10
|
+
/**
|
|
11
|
+
* If true, will use error color instead of color from props.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
danger?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* If true, button will be disabled
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* If true, replace the original icon.
|
|
22
|
+
* Replace suffix if only suffix provided, or prefix.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
loading?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The element placed on the start of button.
|
|
28
|
+
*/
|
|
29
|
+
prefix?: ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* The size of button.
|
|
32
|
+
* @default 'medium'
|
|
33
|
+
*/
|
|
34
|
+
size?: ButtonSize;
|
|
35
|
+
/**
|
|
36
|
+
* The element placed on the end of button.
|
|
37
|
+
*/
|
|
38
|
+
suffix?: ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* The variant of button.
|
|
41
|
+
* @default 'text'
|
|
42
|
+
*/
|
|
43
|
+
variant?: ButtonVariant;
|
|
44
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CalendarMode, DateType } from '@mezzanine-ui/core/calendar';
|
|
3
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
|
+
import { CalendarControlsProps } from './CalendarControls';
|
|
5
|
+
import { CalendarDaysProps } from './CalendarDays';
|
|
6
|
+
import { CalendarMonthsProps } from './CalendarMonths';
|
|
7
|
+
import { CalendarWeeksProps } from './CalendarWeeks';
|
|
8
|
+
import { CalendarYearsProps } from './CalendarYears';
|
|
9
|
+
export interface CalendarProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'onChange' | 'children'>, Pick<CalendarDaysProps, 'isDateDisabled' | 'isDateInRange' | 'onDateHover' | 'displayWeekDayLocale'>, Pick<CalendarMonthsProps, 'isMonthDisabled' | 'isMonthInRange' | 'onMonthHover' | 'displayMonthLocale'>, Pick<CalendarWeeksProps, 'isWeekDisabled' | 'isWeekInRange' | 'onWeekHover'>, Pick<CalendarYearsProps, 'isYearDisabled' | 'isYearInRange' | 'onYearHover'>, Pick<CalendarControlsProps, 'disableOnNext' | 'disableOnPrev'> {
|
|
10
|
+
/**
|
|
11
|
+
* Other props you may provide to `CalendarDays`
|
|
12
|
+
*/
|
|
13
|
+
calendarDaysProps?: Omit<CalendarDaysProps, 'onClick' | 'referenceDate' | 'value' | 'displayWeekDayLocale' | 'isDateDisabled' | 'isDateInRange' | 'onDateHover' | 'updateReferenceDate'>;
|
|
14
|
+
/**
|
|
15
|
+
* Other props you may provide to `CalendarMonths`
|
|
16
|
+
*/
|
|
17
|
+
calendarMonthsProps?: Omit<CalendarMonthsProps, 'onClick' | 'referenceDate' | 'value' | 'isMonthDisabled' | 'isMonthInRange' | 'onMonthHover' | 'displayMonthLocale'>;
|
|
18
|
+
/**
|
|
19
|
+
* Other props you may provide to `CalendarWeeks`
|
|
20
|
+
*/
|
|
21
|
+
calendarWeeksProps?: Omit<CalendarWeeksProps, 'onClick' | 'referenceDate' | 'value' | 'displayWeekDayLocale' | 'isWeekDisabled' | 'isWeekInRange' | 'onWeekHover'>;
|
|
22
|
+
/**
|
|
23
|
+
* Other props you may provide to `CalendarYears`
|
|
24
|
+
*/
|
|
25
|
+
calendarYearsProps?: Omit<CalendarYearsProps, 'onClick' | 'referenceDate' | 'value' | 'isYearDisabled' | 'isYearInRange' | 'onYearHover'>;
|
|
26
|
+
/**
|
|
27
|
+
* Use this prop to switch calendars.
|
|
28
|
+
* @default 'day'
|
|
29
|
+
*/
|
|
30
|
+
mode?: CalendarMode;
|
|
31
|
+
/**
|
|
32
|
+
* Click handler for every cell on calendars.
|
|
33
|
+
*/
|
|
34
|
+
onChange?: (target: DateType) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Click handler for control button of month.
|
|
37
|
+
*/
|
|
38
|
+
onMonthControlClick?: VoidFunction;
|
|
39
|
+
/**
|
|
40
|
+
* Click handler for control button of next.
|
|
41
|
+
*/
|
|
42
|
+
onNext?: (currentMode: CalendarMode) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Click handler for control button of prev.
|
|
45
|
+
*/
|
|
46
|
+
onPrev?: (currentMode: CalendarMode) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Click handler for control button of year.
|
|
49
|
+
*/
|
|
50
|
+
onYearControlClick?: VoidFunction;
|
|
51
|
+
/**
|
|
52
|
+
* The refernce date for getting the calendar.
|
|
53
|
+
* **The type of `referenceDate` should be the same as your declared `DateType`.**
|
|
54
|
+
*/
|
|
55
|
+
referenceDate: DateType;
|
|
56
|
+
/**
|
|
57
|
+
* The displaying cells will be marked as active
|
|
58
|
+
* if the single value of it matches any date object in the array. <br />
|
|
59
|
+
* **The type of `value` should be the same as your declared `DateType`.**
|
|
60
|
+
*/
|
|
61
|
+
value?: DateType | DateType[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The react component for `mezzanine` calendar. <br />
|
|
65
|
+
* Notice that any component related to calendar should be used along with `CalendarContext`. <br />
|
|
66
|
+
* You may use the handlers provided by `useCalendarControls` hook or your own customizd methods.
|
|
67
|
+
*/
|
|
68
|
+
declare const Calendar: import("react").ForwardRefExoticComponent<CalendarProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
69
|
+
export default Calendar;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { getYearRange, calendarYearModuler, calendarClasses } from '@mezzanine-ui/core/calendar';
|
|
3
|
+
import castArray from 'lodash/castArray';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { useCalendarContext } from './CalendarContext.js';
|
|
6
|
+
import CalendarControls from './CalendarControls.js';
|
|
7
|
+
import CalendarDays from './CalendarDays.js';
|
|
8
|
+
import CalendarMonths from './CalendarMonths.js';
|
|
9
|
+
import CalendarWeeks from './CalendarWeeks.js';
|
|
10
|
+
import CalendarYears from './CalendarYears.js';
|
|
11
|
+
import cx from 'clsx';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The react component for `mezzanine` calendar. <br />
|
|
15
|
+
* Notice that any component related to calendar should be used along with `CalendarContext`. <br />
|
|
16
|
+
* You may use the handlers provided by `useCalendarControls` hook or your own customizd methods.
|
|
17
|
+
*/
|
|
18
|
+
const Calendar = forwardRef(function Calendar(props, ref) {
|
|
19
|
+
const { displayMonthLocale: displayMonthLocaleFromConfig, getMonth, getMonthShortName, getYear, } = useCalendarContext();
|
|
20
|
+
const { calendarDaysProps, calendarMonthsProps, calendarWeeksProps, calendarYearsProps, className, disableOnNext, disableOnPrev, displayMonthLocale = displayMonthLocaleFromConfig, displayWeekDayLocale, isDateDisabled, isDateInRange, isMonthDisabled, isMonthInRange, isWeekDisabled, isWeekInRange, isYearDisabled, isYearInRange, mode = 'day', onChange, onDateHover, onMonthControlClick, onMonthHover, onNext, onPrev, onWeekHover, onYearControlClick, onYearHover, referenceDate, value: valueProp, ...restCalendarProps } = props;
|
|
21
|
+
const value = valueProp && castArray(valueProp);
|
|
22
|
+
/** Compute which calendar to use */
|
|
23
|
+
let displayCalendar;
|
|
24
|
+
if (mode === 'day') {
|
|
25
|
+
displayCalendar = (jsx(CalendarDays, Object.assign({}, calendarDaysProps, { isDateDisabled: isDateDisabled, isDateInRange: isDateInRange, onClick: onChange, onDateHover: onDateHover, referenceDate: referenceDate, displayWeekDayLocale: displayWeekDayLocale, value: value }), void 0));
|
|
26
|
+
}
|
|
27
|
+
else if (mode === 'week') {
|
|
28
|
+
displayCalendar = (jsx(CalendarWeeks, Object.assign({}, calendarWeeksProps, { isWeekDisabled: isWeekDisabled, isWeekInRange: isWeekInRange, onClick: onChange, onWeekHover: onWeekHover, referenceDate: referenceDate, displayWeekDayLocale: displayWeekDayLocale, value: value }), void 0));
|
|
29
|
+
}
|
|
30
|
+
else if (mode === 'month') {
|
|
31
|
+
displayCalendar = (jsx(CalendarMonths, Object.assign({}, calendarMonthsProps, { isMonthDisabled: isMonthDisabled, isMonthInRange: isMonthInRange, onClick: onChange, onMonthHover: onMonthHover, referenceDate: referenceDate, value: value }), void 0));
|
|
32
|
+
}
|
|
33
|
+
else if (mode === 'year') {
|
|
34
|
+
displayCalendar = (jsx(CalendarYears, Object.assign({}, calendarYearsProps, { isYearDisabled: isYearDisabled, isYearInRange: isYearInRange, onClick: onChange, onYearHover: onYearHover, referenceDate: referenceDate, value: value }), void 0));
|
|
35
|
+
}
|
|
36
|
+
/** Compute controls outcome */
|
|
37
|
+
const [start, end] = getYearRange(getYear(referenceDate), calendarYearModuler);
|
|
38
|
+
const displayYearRange = `${start} - ${end}`;
|
|
39
|
+
let controls;
|
|
40
|
+
if (mode === 'day' || mode === 'week') {
|
|
41
|
+
controls = (jsxs(Fragment, { children: [jsx("button", Object.assign({ type: "button", className: cx(calendarClasses.button, calendarClasses.controlsButton), onClick: onMonthControlClick }, { children: getMonthShortName(getMonth(referenceDate), displayMonthLocale) }), void 0),
|
|
42
|
+
jsx("button", Object.assign({ type: "button", className: cx(calendarClasses.button, calendarClasses.controlsButton), onClick: onYearControlClick }, { children: getYear(referenceDate) }), void 0)] }, void 0));
|
|
43
|
+
}
|
|
44
|
+
else if (mode === 'month') {
|
|
45
|
+
controls = (jsx("button", Object.assign({ type: "button", className: cx(calendarClasses.button, calendarClasses.controlsButton), onClick: onYearControlClick }, { children: getYear(referenceDate) }), void 0));
|
|
46
|
+
}
|
|
47
|
+
else if (mode === 'year') {
|
|
48
|
+
controls = (jsx("button", Object.assign({ type: "button", className: cx(calendarClasses.button, calendarClasses.controlsButton, calendarClasses.buttonDisabled), disabled: true, "aria-disabled": true }, { children: displayYearRange }), void 0));
|
|
49
|
+
}
|
|
50
|
+
return (jsxs("div", Object.assign({}, restCalendarProps, { ref: ref, className: cx(calendarClasses.host, className) }, { children: [jsx(CalendarControls, Object.assign({ disableOnNext: disableOnNext, disableOnPrev: disableOnPrev, onNext: onNext ? () => { onNext(mode); } : undefined, onPrev: onPrev ? () => { onPrev(mode); } : undefined }, { children: controls }), void 0), displayCalendar] }), void 0));
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export default Calendar;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
+
export interface CalendarCellProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
4
|
+
/**
|
|
5
|
+
* Apply active styles if true.
|
|
6
|
+
*/
|
|
7
|
+
active?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Apply disabled styles if true.
|
|
10
|
+
*/
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Apply today styles if true.
|
|
14
|
+
*/
|
|
15
|
+
today?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The react component for `mezzanine` calendar cell.
|
|
19
|
+
* You may use it to compose your own calendar.
|
|
20
|
+
*/
|
|
21
|
+
declare function CalendarCell(props: CalendarCellProps): JSX.Element;
|
|
22
|
+
export default CalendarCell;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { calendarClasses } from '@mezzanine-ui/core/calendar';
|
|
3
|
+
import cx from 'clsx';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The react component for `mezzanine` calendar cell.
|
|
7
|
+
* You may use it to compose your own calendar.
|
|
8
|
+
*/
|
|
9
|
+
function CalendarCell(props) {
|
|
10
|
+
const { active, children, className, disabled, onClick, today, ...restCalendarCellProps } = props;
|
|
11
|
+
return (jsx("div", Object.assign({ className: cx(calendarClasses.cell, {
|
|
12
|
+
[calendarClasses.cellActive]: active,
|
|
13
|
+
[calendarClasses.cellDisabled]: disabled,
|
|
14
|
+
[calendarClasses.cellToday]: today,
|
|
15
|
+
}, className) }, restCalendarCellProps, { children: jsx("span", Object.assign({ className: calendarClasses.cellInner }, { children: children }), void 0) }), void 0));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default CalendarCell;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CalendarMethods, DateType } from '@mezzanine-ui/core/calendar';
|
|
3
|
+
export interface CalendarConfigs extends CalendarMethods<DateType> {
|
|
4
|
+
defaultDateFormat: string;
|
|
5
|
+
defaultTimeFormat: string;
|
|
6
|
+
displayMonthLocale: string;
|
|
7
|
+
displayWeekDayLocale: string;
|
|
8
|
+
valueLocale: string;
|
|
9
|
+
}
|
|
10
|
+
export declare type CalendarConfigProviderProps = {
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
defaultDateFormat?: string;
|
|
13
|
+
defaultTimeFormat?: string;
|
|
14
|
+
displayMonthLocale?: string;
|
|
15
|
+
displayWeekDayLocale?: string;
|
|
16
|
+
methods: CalendarMethods<DateType>;
|
|
17
|
+
valueLocale?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const CalendarContext: import("react").Context<CalendarConfigs | undefined>;
|
|
20
|
+
export declare function useCalendarContext(): CalendarConfigs;
|
|
21
|
+
declare function CalendarConfigProvider(props: CalendarConfigProviderProps): JSX.Element;
|
|
22
|
+
export default CalendarConfigProvider;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { createContext, useContext } from 'react';
|
|
3
|
+
|
|
4
|
+
const CalendarContext = createContext(undefined);
|
|
5
|
+
function useCalendarContext() {
|
|
6
|
+
const configs = useContext(CalendarContext);
|
|
7
|
+
if (!configs) {
|
|
8
|
+
throw new Error('Cannot find values in your context. ' +
|
|
9
|
+
'Make sure you use `CalendarConfigProvider` in your app ' +
|
|
10
|
+
'and pass in one of the following as methods: `CalendarMethodsMoment`.');
|
|
11
|
+
}
|
|
12
|
+
return configs;
|
|
13
|
+
}
|
|
14
|
+
function CalendarConfigProvider(props) {
|
|
15
|
+
const { children, defaultDateFormat = 'YYYY-MM-DD', defaultTimeFormat = 'HH:mm:ss', displayMonthLocale = 'en-us', displayWeekDayLocale = 'en-us', methods, valueLocale = 'en-us', } = props;
|
|
16
|
+
return (jsx(CalendarContext.Provider, Object.assign({ value: {
|
|
17
|
+
...methods,
|
|
18
|
+
defaultDateFormat,
|
|
19
|
+
defaultTimeFormat,
|
|
20
|
+
displayMonthLocale,
|
|
21
|
+
displayWeekDayLocale,
|
|
22
|
+
valueLocale,
|
|
23
|
+
} }, { children: children }), void 0));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default CalendarConfigProvider;
|
|
27
|
+
export { CalendarContext, useCalendarContext };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
+
export interface CalendarControlsProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'onClick'> {
|
|
4
|
+
/**
|
|
5
|
+
* Disable the next controller if true.
|
|
6
|
+
*/
|
|
7
|
+
disableOnNext?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Disable the prev controller if true.
|
|
10
|
+
*/
|
|
11
|
+
disableOnPrev?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Click handler for next controller.
|
|
14
|
+
*/
|
|
15
|
+
onNext?: VoidFunction;
|
|
16
|
+
/**
|
|
17
|
+
* Click handler for prev controller.
|
|
18
|
+
*/
|
|
19
|
+
onPrev?: VoidFunction;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The react component for `mezzanine` calendar controls.
|
|
23
|
+
* You may use it to compose your own calendar.
|
|
24
|
+
*/
|
|
25
|
+
declare function CalendarControls(props: CalendarControlsProps): JSX.Element;
|
|
26
|
+
export default CalendarControls;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { calendarClasses } from '@mezzanine-ui/core/calendar';
|
|
3
|
+
import { ChevronLeftIcon, ChevronRightIcon } from '@mezzanine-ui/icons';
|
|
4
|
+
import Icon from '../Icon/Icon.js';
|
|
5
|
+
import cx from 'clsx';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The react component for `mezzanine` calendar controls.
|
|
9
|
+
* You may use it to compose your own calendar.
|
|
10
|
+
*/
|
|
11
|
+
function CalendarControls(props) {
|
|
12
|
+
const { children, className, disableOnNext, disableOnPrev, onNext, onPrev, ...restElementProps } = props;
|
|
13
|
+
return (jsxs("div", Object.assign({}, restElementProps, { className: cx(calendarClasses.controls, className) }, { children: [onPrev && (jsx("button", Object.assign({ type: "button", "aria-disabled": disableOnPrev, disabled: disableOnPrev, onClick: onPrev, className: cx(calendarClasses.button, calendarClasses.controlsIconButton, calendarClasses.controlsPrev, {
|
|
14
|
+
[calendarClasses.buttonDisabled]: disableOnPrev,
|
|
15
|
+
}) }, { children: jsx(Icon, { icon: ChevronLeftIcon }, void 0) }), void 0)), children, onNext && (jsx("button", Object.assign({ type: "button", "aria-disabled": disableOnNext, disabled: disableOnNext, onClick: onNext, className: cx(calendarClasses.button, calendarClasses.controlsIconButton, calendarClasses.controlsNext, {
|
|
16
|
+
[calendarClasses.buttonDisabled]: disableOnNext,
|
|
17
|
+
}) }, { children: jsx(Icon, { icon: ChevronRightIcon }, void 0) }), void 0))] }), void 0));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default CalendarControls;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
+
export interface CalendarDayOfWeekProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'onClick' | 'children'> {
|
|
4
|
+
/**
|
|
5
|
+
* The locale you want to use when rendering the name of week day.
|
|
6
|
+
* If none provided, it will use the `displayWeekDayLocale` from calendar context.
|
|
7
|
+
*/
|
|
8
|
+
displayWeekDayLocale?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The react component for `mezzanine` calendar day of week.
|
|
12
|
+
* You may use it to compose your own calendar.
|
|
13
|
+
*/
|
|
14
|
+
declare function CalendarDayOfWeek(props: CalendarDayOfWeekProps): JSX.Element;
|
|
15
|
+
export default CalendarDayOfWeek;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { calendarClasses } from '@mezzanine-ui/core/calendar';
|
|
3
|
+
import CalendarCell from './CalendarCell.js';
|
|
4
|
+
import { useCalendarContext } from './CalendarContext.js';
|
|
5
|
+
import cx from 'clsx';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The react component for `mezzanine` calendar day of week.
|
|
9
|
+
* You may use it to compose your own calendar.
|
|
10
|
+
*/
|
|
11
|
+
function CalendarDayOfWeek(props) {
|
|
12
|
+
const { getWeekDayNames, displayWeekDayLocale: displayWeekDayLocaleFromConfig, } = useCalendarContext();
|
|
13
|
+
const { displayWeekDayLocale = displayWeekDayLocaleFromConfig, className, ...restRowProps } = props;
|
|
14
|
+
const weekDayNames = getWeekDayNames(displayWeekDayLocale);
|
|
15
|
+
return (jsx("div", Object.assign({ className: cx(calendarClasses.row, className) }, restRowProps, { children: weekDayNames.map((name) => (jsx(CalendarCell, { children: name }, `CALENDAR_DAY_OF_WEEK/${name}`))) }), void 0));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default CalendarDayOfWeek;
|