@mezzanine-ui/react 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion/Accordion.d.ts +24 -0
- package/Accordion/Accordion.js +32 -0
- package/Accordion/AccordionControlContext.d.ts +9 -0
- package/Accordion/AccordionControlContext.js +5 -0
- package/Accordion/AccordionDetails.d.ts +10 -0
- package/Accordion/AccordionDetails.js +25 -0
- package/Accordion/AccordionSummary.d.ts +19 -0
- package/Accordion/AccordionSummary.js +50 -0
- package/Accordion/index.d.ts +3 -0
- package/Accordion/index.js +3 -0
- package/Alert/Alert.d.ts +20 -0
- package/Alert/Alert.js +20 -0
- package/Alert/index.d.ts +2 -0
- package/Alert/index.js +1 -0
- package/AppBar/AppBar.d.ts +14 -0
- package/AppBar/AppBar.js +35 -0
- package/AppBar/AppBarBrand.d.ts +5 -0
- package/AppBar/AppBarBrand.js +11 -0
- package/AppBar/AppBarMain.d.ts +5 -0
- package/AppBar/AppBarMain.js +11 -0
- package/AppBar/AppBarSupport.d.ts +5 -0
- package/AppBar/AppBarSupport.js +11 -0
- package/AppBar/index.d.ts +4 -0
- package/AppBar/index.js +4 -0
- package/Badge/Badge.d.ts +19 -0
- package/Badge/Badge.js +27 -0
- package/Badge/BadgeContainer.d.ts +8 -0
- package/Badge/BadgeContainer.js +14 -0
- package/Badge/index.d.ts +2 -0
- package/Badge/index.js +2 -0
- package/Button/Button.d.ts +11 -0
- package/Button/Button.js +37 -0
- package/Button/ButtonGroup.d.ts +63 -0
- package/Button/ButtonGroup.js +35 -0
- package/Button/IconButton.d.ts +21 -0
- package/Button/IconButton.js +13 -0
- package/Button/index.d.ts +20 -0
- package/Button/index.js +8 -0
- package/Button/typings.d.ts +44 -0
- package/Calendar/Calendar.d.ts +69 -0
- package/Calendar/Calendar.js +53 -0
- package/Calendar/CalendarCell.d.ts +22 -0
- package/Calendar/CalendarCell.js +18 -0
- package/Calendar/CalendarContext.d.ts +22 -0
- package/Calendar/CalendarContext.js +27 -0
- package/Calendar/CalendarControls.d.ts +26 -0
- package/Calendar/CalendarControls.js +20 -0
- package/Calendar/CalendarDayOfWeek.d.ts +15 -0
- package/Calendar/CalendarDayOfWeek.js +18 -0
- package/Calendar/CalendarDays.d.ts +38 -0
- package/Calendar/CalendarDays.js +48 -0
- package/Calendar/CalendarMonths.d.ts +42 -0
- package/Calendar/CalendarMonths.js +30 -0
- package/Calendar/CalendarWeeks.d.ts +41 -0
- package/Calendar/CalendarWeeks.js +54 -0
- package/Calendar/CalendarYears.d.ts +40 -0
- package/Calendar/CalendarYears.js +34 -0
- package/Calendar/index.d.ts +12 -0
- package/Calendar/index.js +12 -0
- package/Calendar/useCalendarControlModifiers.d.ts +7 -0
- package/Calendar/useCalendarControlModifiers.js +26 -0
- package/Calendar/useCalendarControls.d.ts +13 -0
- package/Calendar/useCalendarControls.js +34 -0
- package/Calendar/useCalendarModeStack.d.ts +6 -0
- package/Calendar/useCalendarModeStack.js +15 -0
- package/Card/Card.d.ts +51 -0
- package/Card/Card.js +20 -0
- package/Card/CardActions.d.ts +34 -0
- package/Card/CardActions.js +16 -0
- package/Card/index.d.ts +2 -0
- package/Card/index.js +2 -0
- package/Checkbox/CheckAll.d.ts +13 -0
- package/Checkbox/CheckAll.js +36 -0
- package/Checkbox/Checkbox.d.ts +46 -0
- package/Checkbox/Checkbox.js +33 -0
- package/Checkbox/CheckboxGroup.d.ts +47 -0
- package/Checkbox/CheckboxGroup.js +36 -0
- package/Checkbox/CheckboxGroupContext.d.ts +9 -0
- package/Checkbox/CheckboxGroupContext.js +5 -0
- package/Checkbox/index.d.ts +4 -0
- package/Checkbox/index.js +3 -0
- package/ConfirmActions/ConfirmActions.d.ts +45 -0
- package/ConfirmActions/ConfirmActions.js +16 -0
- package/ConfirmActions/index.d.ts +1 -0
- package/ConfirmActions/index.js +1 -0
- package/DatePicker/DatePicker.d.ts +32 -0
- package/DatePicker/DatePicker.js +135 -0
- package/DatePicker/DatePickerCalendar.d.ts +32 -0
- package/DatePicker/DatePickerCalendar.js +61 -0
- package/DatePicker/index.d.ts +2 -0
- package/DatePicker/index.js +2 -0
- package/DateRangePicker/DateRangePicker.d.ts +38 -0
- package/DateRangePicker/DateRangePicker.js +187 -0
- package/DateRangePicker/DateRangePickerCalendar.d.ts +26 -0
- package/DateRangePicker/DateRangePickerCalendar.js +98 -0
- package/DateRangePicker/index.d.ts +4 -0
- package/DateRangePicker/index.js +4 -0
- package/DateRangePicker/useDateRangeCalendarControls.d.ts +15 -0
- package/DateRangePicker/useDateRangeCalendarControls.js +93 -0
- package/DateRangePicker/useDateRangePickerValue.d.ts +23 -0
- package/DateRangePicker/useDateRangePickerValue.js +87 -0
- package/DateTimePicker/DateTimePicker.d.ts +28 -0
- package/DateTimePicker/DateTimePicker.js +122 -0
- package/DateTimePicker/DateTimePickerPanel.d.ts +29 -0
- package/DateTimePicker/DateTimePickerPanel.js +51 -0
- package/DateTimePicker/index.d.ts +2 -0
- package/DateTimePicker/index.js +2 -0
- package/Drawer/Drawer.d.ts +18 -0
- package/Drawer/Drawer.js +34 -0
- package/Drawer/index.d.ts +2 -0
- package/Drawer/index.js +1 -0
- package/Dropdown/Dropdown.d.ts +25 -0
- package/Dropdown/Dropdown.js +60 -0
- package/Dropdown/index.d.ts +1 -0
- package/Dropdown/index.js +1 -0
- package/Empty/Empty.d.ts +18 -0
- package/Empty/Empty.js +16 -0
- package/Empty/index.d.ts +1 -0
- package/Empty/index.js +1 -0
- package/Form/FormControlContext.d.ts +9 -0
- package/Form/FormControlContext.js +5 -0
- package/Form/FormField.d.ts +27 -0
- package/Form/FormField.js +24 -0
- package/Form/FormLabel.d.ts +11 -0
- package/Form/FormLabel.js +17 -0
- package/Form/FormMessage.d.ts +8 -0
- package/Form/FormMessage.js +18 -0
- package/Form/index.d.ts +5 -0
- package/Form/index.js +4 -0
- package/Form/typings.d.ts +4 -0
- package/Form/useAutoCompleteValueControl.d.ts +23 -0
- package/Form/useAutoCompleteValueControl.js +58 -0
- package/Form/useCheckboxControlValue.d.ts +11 -0
- package/Form/useCheckboxControlValue.js +29 -0
- package/Form/useControlValueState.d.ts +7 -0
- package/Form/useControlValueState.js +15 -0
- package/Form/useCustomControlValue.d.ts +5 -0
- package/Form/useCustomControlValue.js +18 -0
- package/Form/useInputControlValue.d.ts +7 -0
- package/Form/useInputControlValue.js +24 -0
- package/Form/useInputWithClearControlValue.d.ts +6 -0
- package/Form/useInputWithClearControlValue.js +33 -0
- package/Form/useRadioControlValue.d.ts +11 -0
- package/Form/useRadioControlValue.js +24 -0
- package/Form/useSelectValueControl.d.ts +16 -0
- package/Form/useSelectValueControl.js +59 -0
- package/Form/useSwitchControlValue.d.ts +7 -0
- package/Form/useSwitchControlValue.js +24 -0
- package/Icon/Icon.d.ts +24 -0
- package/Icon/Icon.js +23 -0
- package/Icon/index.d.ts +3 -0
- package/Icon/index.js +1 -0
- package/Input/Input.d.ts +50 -0
- package/Input/Input.js +28 -0
- package/Input/index.d.ts +2 -0
- package/Input/index.js +1 -0
- package/LICENSE +21 -0
- package/Loading/Loading.d.ts +34 -0
- package/Loading/Loading.js +28 -0
- package/Loading/index.d.ts +1 -0
- package/Loading/index.js +1 -0
- package/Menu/Menu.d.ts +29 -0
- package/Menu/Menu.js +22 -0
- package/Menu/MenuDivider.d.ts +8 -0
- package/Menu/MenuDivider.js +14 -0
- package/Menu/MenuItem.d.ts +24 -0
- package/Menu/MenuItem.js +26 -0
- package/Menu/MenuItemGroup.d.ts +13 -0
- package/Menu/MenuItemGroup.js +15 -0
- package/Menu/index.d.ts +5 -0
- package/Menu/index.js +4 -0
- package/Message/Message.d.ts +33 -0
- package/Message/Message.js +59 -0
- package/Message/index.d.ts +2 -0
- package/Message/index.js +1 -0
- package/Modal/Modal.d.ts +42 -0
- package/Modal/Modal.js +75 -0
- package/Modal/ModalActions.d.ts +10 -0
- package/Modal/ModalActions.js +18 -0
- package/Modal/ModalBody.d.ts +8 -0
- package/Modal/ModalBody.js +14 -0
- package/Modal/ModalControl.d.ts +7 -0
- package/Modal/ModalControl.js +8 -0
- package/Modal/ModalFooter.d.ts +8 -0
- package/Modal/ModalFooter.js +14 -0
- package/Modal/ModalHeader.d.ts +20 -0
- package/Modal/ModalHeader.js +20 -0
- package/Modal/index.d.ts +6 -0
- package/Modal/index.js +5 -0
- package/Modal/useIsTopModal.d.ts +1 -0
- package/Modal/useIsTopModal.js +22 -0
- package/Navigation/Navigation.d.ts +29 -0
- package/Navigation/Navigation.js +48 -0
- package/Navigation/NavigationContext.d.ts +6 -0
- package/Navigation/NavigationContext.js +7 -0
- package/Navigation/NavigationItem.d.ts +31 -0
- package/Navigation/NavigationItem.js +22 -0
- package/Navigation/NavigationSubMenu.d.ts +17 -0
- package/Navigation/NavigationSubMenu.js +65 -0
- package/Navigation/index.d.ts +4 -0
- package/Navigation/index.js +4 -0
- package/Notification/Notification.d.ts +54 -0
- package/Notification/Notification.js +78 -0
- package/Notification/index.d.ts +2 -0
- package/Notification/index.js +1 -0
- package/Notifier/NotifierManager.d.ts +17 -0
- package/Notifier/NotifierManager.js +31 -0
- package/Notifier/createNotifier.d.ts +21 -0
- package/Notifier/createNotifier.js +67 -0
- package/Notifier/index.d.ts +2 -0
- package/Notifier/index.js +1 -0
- package/Notifier/typings.d.ts +28 -0
- package/Overlay/Overlay.d.ts +43 -0
- package/Overlay/Overlay.js +31 -0
- package/Overlay/index.d.ts +1 -0
- package/Overlay/index.js +1 -0
- package/PageFooter/PageFooter.d.ts +15 -0
- package/PageFooter/PageFooter.js +13 -0
- package/PageFooter/index.d.ts +1 -0
- package/PageFooter/index.js +1 -0
- package/Pagination/Pagination.d.ts +78 -0
- package/Pagination/Pagination.js +29 -0
- package/Pagination/PaginationItem.d.ts +27 -0
- package/Pagination/PaginationItem.js +25 -0
- package/Pagination/PaginationJumper.d.ts +38 -0
- package/Pagination/PaginationJumper.js +52 -0
- package/Pagination/index.d.ts +5 -0
- package/Pagination/index.js +4 -0
- package/Pagination/usePagination.d.ts +16 -0
- package/Pagination/usePagination.js +78 -0
- package/Picker/PickerTrigger.d.ts +40 -0
- package/Picker/PickerTrigger.js +15 -0
- package/Picker/RangePickerTrigger.d.ts +64 -0
- package/Picker/RangePickerTrigger.js +19 -0
- package/Picker/index.d.ts +7 -0
- package/Picker/index.js +7 -0
- package/Picker/usePickerDocumentEventClose.d.ts +10 -0
- package/Picker/usePickerDocumentEventClose.js +27 -0
- package/Picker/usePickerInputValue.d.ts +12 -0
- package/Picker/usePickerInputValue.js +24 -0
- package/Picker/usePickerValue.d.ts +21 -0
- package/Picker/usePickerValue.js +58 -0
- package/Picker/useRangePickerValue.d.ts +21 -0
- package/Picker/useRangePickerValue.js +94 -0
- package/Picker/useTabKeyClose.d.ts +2 -0
- package/Picker/useTabKeyClose.js +12 -0
- package/Popconfirm/Popconfirm.d.ts +16 -0
- package/Popconfirm/Popconfirm.js +15 -0
- package/Popconfirm/index.d.ts +1 -0
- package/Popconfirm/index.js +1 -0
- package/Popover/Popover.d.ts +23 -0
- package/Popover/Popover.js +45 -0
- package/Popover/index.d.ts +1 -0
- package/Popover/index.js +1 -0
- package/Popper/Popper.d.ts +32 -0
- package/Popper/Popper.js +30 -0
- package/Popper/index.d.ts +1 -0
- package/Popper/index.js +1 -0
- package/Portal/Portal.d.ts +20 -0
- package/Portal/Portal.js +22 -0
- package/Portal/index.d.ts +1 -0
- package/Portal/index.js +1 -0
- package/Progress/Progress.d.ts +59 -0
- package/Progress/Progress.js +32 -0
- package/Progress/index.d.ts +2 -0
- package/Progress/index.js +1 -0
- package/README.md +1 -0
- package/Radio/Radio.d.ts +41 -0
- package/Radio/Radio.js +31 -0
- package/Radio/RadioGroup.d.ts +47 -0
- package/Radio/RadioGroup.js +29 -0
- package/Radio/RadioGroupContext.d.ts +9 -0
- package/Radio/RadioGroupContext.js +5 -0
- package/Radio/index.d.ts +3 -0
- package/Radio/index.js +2 -0
- package/Select/AutoComplete.d.ts +75 -0
- package/Select/AutoComplete.js +108 -0
- package/Select/Option.d.ts +19 -0
- package/Select/Option.js +32 -0
- package/Select/Select.d.ts +57 -0
- package/Select/Select.js +145 -0
- package/Select/SelectControlContext.d.ts +3 -0
- package/Select/SelectControlContext.js +5 -0
- package/Select/SelectTrigger.d.ts +54 -0
- package/Select/SelectTrigger.js +27 -0
- package/Select/TreeSelect.d.ts +68 -0
- package/Select/TreeSelect.js +198 -0
- package/Select/index.d.ts +8 -0
- package/Select/index.js +7 -0
- package/Select/typings.d.ts +11 -0
- package/Skeleton/Skeleton.d.ts +22 -0
- package/Skeleton/Skeleton.js +14 -0
- package/Skeleton/index.d.ts +1 -0
- package/Skeleton/index.js +1 -0
- package/Slider/Slider.d.ts +51 -0
- package/Slider/Slider.js +172 -0
- package/Slider/index.d.ts +3 -0
- package/Slider/index.js +2 -0
- package/Slider/useSlider.d.ts +31 -0
- package/Slider/useSlider.js +104 -0
- package/Stepper/Step.d.ts +41 -0
- package/Stepper/Step.js +19 -0
- package/Stepper/Stepper.d.ts +19 -0
- package/Stepper/Stepper.js +33 -0
- package/Stepper/index.d.ts +2 -0
- package/Stepper/index.js +2 -0
- package/Switch/Switch.d.ts +43 -0
- package/Switch/Switch.js +29 -0
- package/Switch/index.d.ts +2 -0
- package/Switch/index.js +1 -0
- package/Table/Table.d.ts +79 -0
- package/Table/Table.js +111 -0
- package/Table/TableBody.d.ts +10 -0
- package/Table/TableBody.js +31 -0
- package/Table/TableBodyRow.d.ts +11 -0
- package/Table/TableBodyRow.js +63 -0
- package/Table/TableCell.d.ts +20 -0
- package/Table/TableCell.js +23 -0
- package/Table/TableContext.d.ts +46 -0
- package/Table/TableContext.js +7 -0
- package/Table/TableHeader.d.ts +3 -0
- package/Table/TableHeader.js +47 -0
- package/Table/editable/TableEditRenderWrapper.d.ts +8 -0
- package/Table/editable/TableEditRenderWrapper.js +15 -0
- package/Table/expandable/TableExpandable.d.ts +24 -0
- package/Table/expandable/TableExpandable.js +15 -0
- package/Table/index.d.ts +4 -0
- package/Table/index.js +3 -0
- package/Table/pagination/TablePagination.d.ts +10 -0
- package/Table/pagination/TablePagination.js +27 -0
- package/Table/pagination/useTablePagination.d.ts +16 -0
- package/Table/pagination/useTablePagination.js +49 -0
- package/Table/refresh/TableRefresh.d.ts +10 -0
- package/Table/refresh/TableRefresh.js +23 -0
- package/Table/rowSelection/TableRowSelection.d.ts +19 -0
- package/Table/rowSelection/TableRowSelection.js +86 -0
- package/Table/rowSelection/useTableRowSelection.d.ts +6 -0
- package/Table/rowSelection/useTableRowSelection.js +53 -0
- package/Table/sorting/TableSortingIcon.d.ts +11 -0
- package/Table/sorting/TableSortingIcon.js +28 -0
- package/Table/sorting/useTableSorting.d.ts +10 -0
- package/Table/sorting/useTableSorting.js +90 -0
- package/Table/useTableFetchMore.d.ts +10 -0
- package/Table/useTableFetchMore.js +50 -0
- package/Table/useTableLoading.d.ts +5 -0
- package/Table/useTableLoading.js +19 -0
- package/Table/useTableScroll.d.ts +272 -0
- package/Table/useTableScroll.js +170 -0
- package/Tabs/Tab.d.ts +19 -0
- package/Tabs/Tab.js +16 -0
- package/Tabs/TabPane.d.ts +14 -0
- package/Tabs/TabPane.js +18 -0
- package/Tabs/Tabs.d.ts +39 -0
- package/Tabs/Tabs.js +49 -0
- package/Tabs/index.d.ts +3 -0
- package/Tabs/index.js +3 -0
- package/Tabs/useTabsOverflow.d.ts +8 -0
- package/Tabs/useTabsOverflow.js +58 -0
- package/Tag/Tag.d.ts +29 -0
- package/Tag/Tag.js +23 -0
- package/Tag/index.d.ts +2 -0
- package/Tag/index.js +1 -0
- package/TextField/TextField.d.ts +54 -0
- package/TextField/TextField.js +39 -0
- package/TextField/index.d.ts +2 -0
- package/TextField/index.js +1 -0
- package/TextField/useTextFieldControl.d.ts +10 -0
- package/TextField/useTextFieldControl.js +15 -0
- package/Textarea/Textarea.d.ts +58 -0
- package/Textarea/Textarea.js +33 -0
- package/Textarea/index.d.ts +2 -0
- package/Textarea/index.js +1 -0
- package/TimePanel/TimePanel.d.ts +66 -0
- package/TimePanel/TimePanel.js +67 -0
- package/TimePanel/TimePanelAction.d.ts +18 -0
- package/TimePanel/TimePanelAction.js +15 -0
- package/TimePanel/TimePanelColumn.d.ts +37 -0
- package/TimePanel/TimePanelColumn.js +39 -0
- package/TimePanel/index.d.ts +3 -0
- package/TimePanel/index.js +3 -0
- package/TimePicker/TimePicker.d.ts +24 -0
- package/TimePicker/TimePicker.js +114 -0
- package/TimePicker/TimePickerPanel.d.ts +24 -0
- package/TimePicker/TimePickerPanel.js +14 -0
- package/TimePicker/index.d.ts +2 -0
- package/TimePicker/index.js +2 -0
- package/Tooltip/Tooltip.d.ts +25 -0
- package/Tooltip/Tooltip.js +37 -0
- package/Tooltip/index.d.ts +1 -0
- package/Tooltip/index.js +1 -0
- package/Tooltip/useDelayMouseEnterLeave.d.ts +12 -0
- package/Tooltip/useDelayMouseEnterLeave.js +41 -0
- package/Transition/Collapse.d.ts +15 -0
- package/Transition/Collapse.js +107 -0
- package/Transition/Fade.d.ts +8 -0
- package/Transition/Fade.js +84 -0
- package/Transition/Grow.d.ts +13 -0
- package/Transition/Grow.js +112 -0
- package/Transition/SlideFade.d.ts +15 -0
- package/Transition/SlideFade.js +93 -0
- package/Transition/Transition.d.ts +98 -0
- package/Transition/Transition.js +27 -0
- package/Transition/Zoom.d.ts +8 -0
- package/Transition/Zoom.js +84 -0
- package/Transition/getAutoSizeDuration.d.ts +1 -0
- package/Transition/getAutoSizeDuration.js +10 -0
- package/Transition/getTransitionStyleProps.d.ts +16 -0
- package/Transition/getTransitionStyleProps.js +25 -0
- package/Transition/index.d.ts +6 -0
- package/Transition/index.js +6 -0
- package/Transition/reflow.d.ts +4 -0
- package/Transition/reflow.js +9 -0
- package/Transition/useAutoTransitionDuration.d.ts +6 -0
- package/Transition/useAutoTransitionDuration.js +15 -0
- package/Transition/useSetNodeTransition.d.ts +7 -0
- package/Transition/useSetNodeTransition.js +35 -0
- package/Tree/Tree.d.ts +70 -0
- package/Tree/Tree.js +131 -0
- package/Tree/TreeNode.d.ts +41 -0
- package/Tree/TreeNode.js +41 -0
- package/Tree/TreeNodeList.d.ts +25 -0
- package/Tree/TreeNodeList.js +29 -0
- package/Tree/getTreeNodeEntities.d.ts +11 -0
- package/Tree/getTreeNodeEntities.js +86 -0
- package/Tree/index.d.ts +8 -0
- package/Tree/index.js +7 -0
- package/Tree/toggleValue.d.ts +4 -0
- package/Tree/toggleValue.js +19 -0
- package/Tree/traverseTree.d.ts +2 -0
- package/Tree/traverseTree.js +11 -0
- package/Tree/typings.d.ts +16 -0
- package/Tree/useTreeExpandedValue.d.ts +15 -0
- package/Tree/useTreeExpandedValue.js +32 -0
- package/Typography/Typography.d.ts +43 -0
- package/Typography/Typography.js +38 -0
- package/Typography/index.d.ts +11 -0
- package/Typography/index.js +2 -0
- package/Upload/UploadButton.d.ts +10 -0
- package/Upload/UploadButton.js +23 -0
- package/Upload/UploadInput.d.ts +21 -0
- package/Upload/UploadInput.js +22 -0
- package/Upload/UploadResult.d.ts +16 -0
- package/Upload/UploadResult.js +30 -0
- package/Upload/index.d.ts +3 -0
- package/Upload/index.js +2 -0
- package/_internal/InputCheck/InputCheck.d.ts +33 -0
- package/_internal/InputCheck/InputCheck.js +19 -0
- package/_internal/InputCheck/InputCheckGroup.d.ts +18 -0
- package/_internal/InputCheck/InputCheckGroup.js +14 -0
- package/_internal/InputCheck/index.d.ts +3 -0
- package/_internal/InputCheck/index.js +2 -0
- package/_internal/InputTriggerPopper/InputTriggerPopper.d.ts +18 -0
- package/_internal/InputTriggerPopper/InputTriggerPopper.js +44 -0
- package/_internal/InputTriggerPopper/index.d.ts +1 -0
- package/_internal/InputTriggerPopper/index.js +1 -0
- package/hooks/useClickAway.d.ts +5 -0
- package/hooks/useClickAway.js +23 -0
- package/hooks/useComposeRefs.d.ts +2 -0
- package/hooks/useComposeRefs.js +8 -0
- package/hooks/useDocumentEscapeKeyDown.d.ts +3 -0
- package/hooks/useDocumentEscapeKeyDown.js +20 -0
- package/hooks/useDocumentEvents.d.ts +5 -0
- package/hooks/useDocumentEvents.js +21 -0
- package/hooks/useDocumentTabKeyDown.d.ts +3 -0
- package/hooks/useDocumentTabKeyDown.js +19 -0
- package/hooks/useIsomorphicLayoutEffect.d.ts +2 -0
- package/hooks/useIsomorphicLayoutEffect.js +7 -0
- package/hooks/useLastCallback.d.ts +1 -0
- package/hooks/useLastCallback.js +11 -0
- package/hooks/useLastValue.d.ts +3 -0
- package/hooks/useLastValue.js +9 -0
- package/hooks/usePreviousValue.d.ts +1 -0
- package/hooks/usePreviousValue.js +11 -0
- package/hooks/useWindowWidth.d.ts +1 -0
- package/hooks/useWindowWidth.js +15 -0
- package/index.d.ts +100 -0
- package/index.js +148 -0
- package/package.json +61 -0
- package/utils/composeRefs.d.ts +21 -0
- package/utils/composeRefs.js +32 -0
- package/utils/cx.d.ts +1 -0
- package/utils/getElement.d.ts +3 -0
- package/utils/getElement.js +14 -0
- package/utils/jsx-types.d.ts +11 -0
- package/utils/rename-types.d.ts +5 -0
- package/utils/scroll-lock.d.ts +2 -0
- package/utils/scroll-lock.js +18 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="moment" />
|
|
2
|
+
import { DateType } from '@mezzanine-ui/core/calendar';
|
|
3
|
+
import { RefObject } from 'react';
|
|
4
|
+
export declare type UsePickerValueProps = {
|
|
5
|
+
defaultValue?: DateType;
|
|
6
|
+
format: string;
|
|
7
|
+
formats: string[];
|
|
8
|
+
inputRef: RefObject<HTMLInputElement>;
|
|
9
|
+
value?: DateType;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* This hook keep tracks of an internal value.
|
|
13
|
+
*/
|
|
14
|
+
export declare function usePickerValue({ defaultValue, format, formats, inputRef, value: valueProp, }: UsePickerValueProps): {
|
|
15
|
+
inputValue: string;
|
|
16
|
+
onBlur: (event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
17
|
+
onChange: (val?: import("moment").Moment | undefined) => void;
|
|
18
|
+
onInputChange: (event: import("react").ChangeEvent<HTMLInputElement>) => void;
|
|
19
|
+
onKeyDown: (event: import("react").KeyboardEvent<HTMLInputElement>) => void;
|
|
20
|
+
value: import("moment").Moment | undefined;
|
|
21
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { useCalendarContext } from '../Calendar/CalendarContext.js';
|
|
3
|
+
import { usePickerInputValue } from './usePickerInputValue.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This hook keep tracks of an internal value.
|
|
7
|
+
*/
|
|
8
|
+
function usePickerValue({ defaultValue, format, formats, inputRef, value: valueProp, }) {
|
|
9
|
+
const { formatToString, parse, valueLocale, } = useCalendarContext();
|
|
10
|
+
const inputDefaultValue = defaultValue ? formatToString(valueLocale, defaultValue, format) : '';
|
|
11
|
+
const [value, setValue] = useState(valueProp);
|
|
12
|
+
const onChange = (val) => {
|
|
13
|
+
setValue(val);
|
|
14
|
+
};
|
|
15
|
+
const onInputChange = (val) => {
|
|
16
|
+
const valDateType = parse(valueLocale, val, formats);
|
|
17
|
+
onChange(valDateType);
|
|
18
|
+
};
|
|
19
|
+
const { inputChangeHandler, inputValue, onChange: setInputValue, } = usePickerInputValue({
|
|
20
|
+
defaultValue: inputDefaultValue,
|
|
21
|
+
onChange: onInputChange,
|
|
22
|
+
});
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const valString = valueProp ? formatToString(valueLocale, valueProp, format) : '';
|
|
25
|
+
setInputValue(valString);
|
|
26
|
+
onChange(valueProp);
|
|
27
|
+
}, [valueProp]);
|
|
28
|
+
const onSyncInputAndStateChange = (val) => {
|
|
29
|
+
const valueString = val ? formatToString(valueLocale, val, format) : '';
|
|
30
|
+
setInputValue(valueString);
|
|
31
|
+
setValue(val);
|
|
32
|
+
};
|
|
33
|
+
const guardValidDateTypeOnEvents = () => {
|
|
34
|
+
if (!value) {
|
|
35
|
+
onSyncInputAndStateChange(valueProp);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const guardValidDateTypeOnKeyDown = (event) => {
|
|
39
|
+
var _a;
|
|
40
|
+
if (event.key === 'Enter' || event.key === 'Escape') {
|
|
41
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
42
|
+
guardValidDateTypeOnEvents();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const onBlur = () => {
|
|
46
|
+
guardValidDateTypeOnEvents();
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
inputValue,
|
|
50
|
+
onBlur,
|
|
51
|
+
onChange: onSyncInputAndStateChange,
|
|
52
|
+
onInputChange: inputChangeHandler,
|
|
53
|
+
onKeyDown: guardValidDateTypeOnKeyDown,
|
|
54
|
+
value,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { usePickerValue };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="moment" />
|
|
2
|
+
import { RangePickerPickingValue, RangePickerValue } from '@mezzanine-ui/core/picker';
|
|
3
|
+
import { RefObject } from 'react';
|
|
4
|
+
import { UsePickerValueProps } from './usePickerValue';
|
|
5
|
+
export interface UseRangePickerValueProps extends Pick<UsePickerValueProps, 'format' | 'formats'> {
|
|
6
|
+
inputFromRef: RefObject<HTMLInputElement>;
|
|
7
|
+
inputToRef: RefObject<HTMLInputElement>;
|
|
8
|
+
value?: RangePickerValue;
|
|
9
|
+
}
|
|
10
|
+
export declare function useRangePickerValue({ format, formats, inputFromRef, inputToRef, value: valueProp, }: UseRangePickerValueProps): {
|
|
11
|
+
inputFromValue: string;
|
|
12
|
+
inputToValue: string;
|
|
13
|
+
onChange: (target?: undefined[] | [import("moment").Moment, import("moment").Moment] | [import("moment").Moment] | [undefined, import("moment").Moment] | [import("moment").Moment, undefined] | undefined) => RangePickerPickingValue | undefined;
|
|
14
|
+
onFromBlur: (event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
15
|
+
onFromKeyDown: (event: import("react").KeyboardEvent<HTMLInputElement>) => void;
|
|
16
|
+
onInputFromChange: (event: import("react").ChangeEvent<HTMLInputElement>) => void;
|
|
17
|
+
onInputToChange: (event: import("react").ChangeEvent<HTMLInputElement>) => void;
|
|
18
|
+
onToBlur: (event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
19
|
+
onToKeyDown: (event: import("react").KeyboardEvent<HTMLInputElement>) => void;
|
|
20
|
+
value: RangePickerPickingValue;
|
|
21
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { usePickerValue } from './usePickerValue.js';
|
|
2
|
+
import { useCalendarContext } from '../Calendar/CalendarContext.js';
|
|
3
|
+
|
|
4
|
+
function useRangePickerValue({ format, formats, inputFromRef, inputToRef, value: valueProp, }) {
|
|
5
|
+
const { parse: parseFromConfig, valueLocale, isBefore, } = useCalendarContext();
|
|
6
|
+
function parse(val) {
|
|
7
|
+
return parseFromConfig(valueLocale, val, formats);
|
|
8
|
+
}
|
|
9
|
+
function sortValues(valueToSort) {
|
|
10
|
+
const [v1, v2] = valueToSort;
|
|
11
|
+
return isBefore(v1, v2) ? [v1, v2] : [v2, v1];
|
|
12
|
+
}
|
|
13
|
+
const { inputValue: inputFromValue, onBlur: onFromBlur, onChange: onFromChange, onInputChange: onInputFromChange, onKeyDown: onFromKeyDown, value: from, } = usePickerValue({
|
|
14
|
+
format,
|
|
15
|
+
formats,
|
|
16
|
+
value: valueProp === null || valueProp === void 0 ? void 0 : valueProp[0],
|
|
17
|
+
inputRef: inputFromRef,
|
|
18
|
+
});
|
|
19
|
+
const { inputValue: inputToValue, onBlur: onToBlur, onChange: onToChange, onInputChange: onInputToChange, onKeyDown: onToKeyDown, value: to, } = usePickerValue({
|
|
20
|
+
format,
|
|
21
|
+
formats,
|
|
22
|
+
value: valueProp === null || valueProp === void 0 ? void 0 : valueProp[1],
|
|
23
|
+
inputRef: inputToRef,
|
|
24
|
+
});
|
|
25
|
+
const value = [from, to];
|
|
26
|
+
const onChange = (target) => {
|
|
27
|
+
const [newFrom, newTo] = target || [];
|
|
28
|
+
if (newFrom && newTo) {
|
|
29
|
+
const sortedVal = sortValues([newFrom, newTo]);
|
|
30
|
+
onFromChange(sortedVal[0]);
|
|
31
|
+
onToChange(sortedVal[1]);
|
|
32
|
+
return sortedVal;
|
|
33
|
+
}
|
|
34
|
+
onFromChange(target === null || target === void 0 ? void 0 : target[0]);
|
|
35
|
+
onToChange(target === null || target === void 0 ? void 0 : target[1]);
|
|
36
|
+
return target;
|
|
37
|
+
};
|
|
38
|
+
const onOrderGuardedInputFromChange = (event) => {
|
|
39
|
+
onInputFromChange(event);
|
|
40
|
+
const currentVal = parse(event.target.value);
|
|
41
|
+
if (currentVal && to) {
|
|
42
|
+
if (isBefore(to, currentVal)) {
|
|
43
|
+
onToChange(undefined);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const onOrderGuardedInputToChange = (event) => {
|
|
48
|
+
onInputToChange(event);
|
|
49
|
+
const currentVal = parse(event.target.value);
|
|
50
|
+
if (currentVal && from) {
|
|
51
|
+
if (isBefore(currentVal, from)) {
|
|
52
|
+
onFromChange(undefined);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const guardValidValueOnFromKeyDown = (event) => {
|
|
57
|
+
var _a, _b;
|
|
58
|
+
onFromKeyDown(event);
|
|
59
|
+
if (event.key === 'Enter') {
|
|
60
|
+
if (from && !to) {
|
|
61
|
+
(_a = inputToRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
62
|
+
}
|
|
63
|
+
else if (to && !from) {
|
|
64
|
+
(_b = inputFromRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const guardValidValueOnToKeyDown = (event) => {
|
|
69
|
+
var _a, _b;
|
|
70
|
+
onToKeyDown(event);
|
|
71
|
+
if (event.key === 'Enter') {
|
|
72
|
+
if (from && !to) {
|
|
73
|
+
(_a = inputToRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
74
|
+
}
|
|
75
|
+
else if (to && !from) {
|
|
76
|
+
(_b = inputFromRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
return {
|
|
81
|
+
inputFromValue,
|
|
82
|
+
inputToValue,
|
|
83
|
+
onChange,
|
|
84
|
+
onFromBlur,
|
|
85
|
+
onFromKeyDown: guardValidValueOnFromKeyDown,
|
|
86
|
+
onInputFromChange: onOrderGuardedInputFromChange,
|
|
87
|
+
onInputToChange: onOrderGuardedInputToChange,
|
|
88
|
+
onToBlur,
|
|
89
|
+
onToKeyDown: guardValidValueOnToKeyDown,
|
|
90
|
+
value,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export { useRangePickerValue };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useDocumentTabKeyDown } from '../hooks/useDocumentTabKeyDown.js';
|
|
2
|
+
|
|
3
|
+
function useTabKeyClose(onClose, lastElementRefInFlow, deps) {
|
|
4
|
+
useDocumentTabKeyDown(() => () => {
|
|
5
|
+
const { activeElement } = document;
|
|
6
|
+
if (activeElement === lastElementRefInFlow.current) {
|
|
7
|
+
onClose();
|
|
8
|
+
}
|
|
9
|
+
}, deps);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { useTabKeyClose };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { IconDefinition } from '@mezzanine-ui/icons';
|
|
3
|
+
import { PopoverProps } from '../Popover';
|
|
4
|
+
import { ConfirmActionsProps } from '../ConfirmActions';
|
|
5
|
+
export interface PopconfirmProps extends PopoverProps, Pick<ConfirmActionsProps, 'cancelButtonProps' | 'cancelText' | 'confirmButtonProps' | 'confirmText' | 'onCancel' | 'onConfirm'> {
|
|
6
|
+
/**
|
|
7
|
+
* Customize the icon on the popconfirm
|
|
8
|
+
*/
|
|
9
|
+
icon?: IconDefinition;
|
|
10
|
+
/**
|
|
11
|
+
* the title of the confirmation box
|
|
12
|
+
*/
|
|
13
|
+
title?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
declare const Popconfirm: import("react").ForwardRefExoticComponent<PopconfirmProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export default Popconfirm;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { ExclamationCircleFilledIcon } from '@mezzanine-ui/icons';
|
|
4
|
+
import { popConfirmClasses } from '@mezzanine-ui/core/popconfirm';
|
|
5
|
+
import Popover from '../Popover/Popover.js';
|
|
6
|
+
import Icon from '../Icon/Icon.js';
|
|
7
|
+
import ConfirmActions from '../ConfirmActions/ConfirmActions.js';
|
|
8
|
+
import cx from 'clsx';
|
|
9
|
+
|
|
10
|
+
const Popconfirm = forwardRef(function Popconfirm(props, ref) {
|
|
11
|
+
const { className, container, cancelButtonProps, cancelText, confirmButtonProps, confirmText, icon = ExclamationCircleFilledIcon, onCancel, onConfirm, title, ...rest } = props;
|
|
12
|
+
return (jsx(Popover, Object.assign({}, rest, { ref: ref, className: cx(popConfirmClasses.host, className), title: (jsxs(Fragment, { children: [jsx(Icon, { className: popConfirmClasses.icon, icon: icon }, void 0), title] }, void 0)) }, { children: jsx(ConfirmActions, { cancelButtonProps: cancelButtonProps, cancelText: cancelText, confirmButtonProps: confirmButtonProps, confirmText: confirmText, onCancel: onCancel, onConfirm: onConfirm, size: "small" }, void 0) }), void 0));
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export default Popconfirm;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PopconfirmProps, default, } from './Popconfirm';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Popconfirm.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { PopperProps } from '../Popper';
|
|
3
|
+
import { ClickAwayEvent } from '../hooks/useClickAway';
|
|
4
|
+
export interface PopoverProps extends Omit<PopperProps, 'title'> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether to disable triggering onClose while clicked away.
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
disableClickAway?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The handler fired while clicked away.
|
|
12
|
+
*/
|
|
13
|
+
onClose?: (event: ClickAwayEvent) => void;
|
|
14
|
+
/**
|
|
15
|
+
* the title of popover
|
|
16
|
+
*/
|
|
17
|
+
title?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The react component for `mezzanine` popover.
|
|
21
|
+
*/
|
|
22
|
+
declare const Popover: import("react").ForwardRefExoticComponent<PopoverProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
23
|
+
export default Popover;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useRef } from 'react';
|
|
3
|
+
import { popoverClasses } from '@mezzanine-ui/core/popover';
|
|
4
|
+
import { useClickAway } from '../hooks/useClickAway.js';
|
|
5
|
+
import { useComposeRefs } from '../hooks/useComposeRefs.js';
|
|
6
|
+
import Popper from '../Popper/Popper.js';
|
|
7
|
+
import cx from 'clsx';
|
|
8
|
+
|
|
9
|
+
const offsetModifier = {
|
|
10
|
+
name: 'offset',
|
|
11
|
+
options: {
|
|
12
|
+
offset: [0, 8],
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The react component for `mezzanine` popover.
|
|
17
|
+
*/
|
|
18
|
+
const Popover = forwardRef(function Popover(props, ref) {
|
|
19
|
+
const { children, className, disableClickAway = false, onClose, open, options = {}, title, ...rest } = props;
|
|
20
|
+
const { modifiers = [] } = options;
|
|
21
|
+
const popoverRef = useRef(null);
|
|
22
|
+
const composedRef = useComposeRefs([ref, popoverRef]);
|
|
23
|
+
useClickAway(() => {
|
|
24
|
+
if (!open || disableClickAway || !onClose) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
return (event) => {
|
|
28
|
+
if (onClose) {
|
|
29
|
+
onClose(event);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}, popoverRef, [
|
|
33
|
+
open,
|
|
34
|
+
disableClickAway,
|
|
35
|
+
onClose,
|
|
36
|
+
popoverRef,
|
|
37
|
+
]);
|
|
38
|
+
return (jsxs(Popper, Object.assign({}, rest, { ref: composedRef, className: cx(popoverClasses.host, className), open: open, options: {
|
|
39
|
+
...options,
|
|
40
|
+
modifiers: [offsetModifier, ...modifiers],
|
|
41
|
+
} }, { children: [title && jsx("div", Object.assign({ className: popoverClasses.title }, { children: title }), void 0),
|
|
42
|
+
children && jsx("div", Object.assign({ className: popoverClasses.content }, { children: children }), void 0)] }), void 0));
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export default Popover;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PopoverProps, default, } from './Popover';
|
package/Popover/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Popover.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Options as _PopperOptions } from '@popperjs/core';
|
|
2
|
+
import { Ref } from 'react';
|
|
3
|
+
import { Modifier, usePopper } from 'react-popper';
|
|
4
|
+
import { ElementGetter } from '../utils/getElement';
|
|
5
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
6
|
+
import { PortalProps } from '../Portal';
|
|
7
|
+
export type { Placement as PopperPlacement, PositioningStrategy as PopperPositionStrategy, } from '@popperjs/core';
|
|
8
|
+
export declare type PopperOptions<Modifiers> = Omit<Partial<_PopperOptions>, 'modifiers'> & {
|
|
9
|
+
modifiers?: ReadonlyArray<Modifier<Modifiers>>;
|
|
10
|
+
};
|
|
11
|
+
export declare type PopperController = ReturnType<typeof usePopper>;
|
|
12
|
+
export interface PopperProps extends Pick<PortalProps, 'container' | 'disablePortal'>, NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
13
|
+
/**
|
|
14
|
+
* The ref of trigger Element.
|
|
15
|
+
*/
|
|
16
|
+
anchor?: ElementGetter;
|
|
17
|
+
/**
|
|
18
|
+
* Provide `controllerRef` if you need access to `usePopper` results.
|
|
19
|
+
*/
|
|
20
|
+
controllerRef?: Ref<PopperController>;
|
|
21
|
+
/**
|
|
22
|
+
* The portal element will show if open=true
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
open?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The options of usePopper hook of react-popper.
|
|
28
|
+
*/
|
|
29
|
+
options?: PopperOptions<any>;
|
|
30
|
+
}
|
|
31
|
+
declare const Popper: import("react").ForwardRefExoticComponent<PopperProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
32
|
+
export default Popper;
|
package/Popper/Popper.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useState, useImperativeHandle } from 'react';
|
|
3
|
+
import { usePopper } from 'react-popper';
|
|
4
|
+
import { getElement } from '../utils/getElement.js';
|
|
5
|
+
import { useComposeRefs } from '../hooks/useComposeRefs.js';
|
|
6
|
+
import Portal from '../Portal/Portal.js';
|
|
7
|
+
|
|
8
|
+
const Popper = forwardRef(function Popper(props, ref) {
|
|
9
|
+
const { anchor, children, container, controllerRef, disablePortal, open = false, options, style, ...rest } = props;
|
|
10
|
+
const [popperEl, setPopperEl] = useState(null);
|
|
11
|
+
const composedRef = useComposeRefs([ref, setPopperEl]);
|
|
12
|
+
const anchorEl = getElement(anchor);
|
|
13
|
+
const { attributes, forceUpdate, state, styles, update, } = usePopper(anchorEl, popperEl, options);
|
|
14
|
+
useImperativeHandle(controllerRef, () => ({
|
|
15
|
+
attributes,
|
|
16
|
+
forceUpdate,
|
|
17
|
+
state,
|
|
18
|
+
styles,
|
|
19
|
+
update,
|
|
20
|
+
}));
|
|
21
|
+
if (!open) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return (jsx(Portal, Object.assign({ container: container, disablePortal: disablePortal }, { children: jsx("div", Object.assign({}, rest, { ref: composedRef, style: {
|
|
25
|
+
...style,
|
|
26
|
+
...styles.popper,
|
|
27
|
+
} }, attributes.popper, { children: children }), void 0) }), void 0));
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export default Popper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PopperPlacement, PopperPositionStrategy, PopperOptions, PopperController, PopperProps, default, } from './Popper';
|
package/Popper/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Popper.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { ElementGetter } from '../utils/getElement';
|
|
3
|
+
export interface PortalProps {
|
|
4
|
+
/**
|
|
5
|
+
* The element you want to portal.
|
|
6
|
+
*/
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* The destination where to portal.
|
|
10
|
+
*/
|
|
11
|
+
container?: ElementGetter;
|
|
12
|
+
/**
|
|
13
|
+
* Whether to disable portal.
|
|
14
|
+
* If true, it will be a normal component.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
disablePortal?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare const Portal: FC<PortalProps>;
|
|
20
|
+
export default Portal;
|
package/Portal/Portal.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import { getElement } from '../utils/getElement.js';
|
|
5
|
+
|
|
6
|
+
const Portal = (props) => {
|
|
7
|
+
const { children, container, disablePortal = false, } = props;
|
|
8
|
+
const [portalElement, setPortalElement] = useState(() => (disablePortal
|
|
9
|
+
? null
|
|
10
|
+
: getElement(container) || document.body));
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (!disablePortal) {
|
|
13
|
+
setPortalElement(getElement(container) || document.body);
|
|
14
|
+
}
|
|
15
|
+
}, [container, disablePortal]);
|
|
16
|
+
if (disablePortal || !portalElement) {
|
|
17
|
+
return jsx(Fragment, { children: children }, void 0);
|
|
18
|
+
}
|
|
19
|
+
return createPortal(children, portalElement);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default Portal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PortalProps, default, } from './Portal';
|
package/Portal/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Portal.js';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ProgressType, ProgressStatus } from '@mezzanine-ui/core/progress';
|
|
3
|
+
import { Size } from '@mezzanine-ui/system/size';
|
|
4
|
+
import { TypographyProps } from '../Typography';
|
|
5
|
+
import { IconProps } from '../Icon';
|
|
6
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
7
|
+
export interface ProgressProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'title' | 'children'> {
|
|
8
|
+
/**
|
|
9
|
+
* Customize circle.
|
|
10
|
+
* circle radius = (size - strokeWidth) / 2
|
|
11
|
+
* @default size=80,strokeWidth=8
|
|
12
|
+
*/
|
|
13
|
+
circleProps?: {
|
|
14
|
+
size: number;
|
|
15
|
+
strokeWidth: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Icon props when status is 'error'.
|
|
19
|
+
*/
|
|
20
|
+
errorIconProps?: Omit<IconProps, 'className'>;
|
|
21
|
+
/**
|
|
22
|
+
* The progress percent(0~100).
|
|
23
|
+
* @default 0
|
|
24
|
+
*/
|
|
25
|
+
percent?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Percent text props when status is 'normal'.
|
|
28
|
+
*/
|
|
29
|
+
percentProps?: Omit<TypographyProps, 'className' | 'children'>;
|
|
30
|
+
/**
|
|
31
|
+
* Force mark the progress status. automatically set if not defined.
|
|
32
|
+
* (normal(0~99) or success(100) depending on percent)
|
|
33
|
+
*/
|
|
34
|
+
status?: ProgressStatus;
|
|
35
|
+
/**
|
|
36
|
+
* The size of line type progress.
|
|
37
|
+
* @default 'medium'
|
|
38
|
+
*/
|
|
39
|
+
size?: Size;
|
|
40
|
+
/**
|
|
41
|
+
* Display the progress info(percent and icon) or not.
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
44
|
+
showInfo?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Icon props when status is 'success'.
|
|
47
|
+
*/
|
|
48
|
+
successIconProps?: Omit<IconProps, 'className'>;
|
|
49
|
+
/**
|
|
50
|
+
* The type of progress.
|
|
51
|
+
* @default 'line'
|
|
52
|
+
*/
|
|
53
|
+
type?: ProgressType;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The react component for `mezzanine` progress.
|
|
57
|
+
*/
|
|
58
|
+
declare const Progress: import("react").ForwardRefExoticComponent<ProgressProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
59
|
+
export default Progress;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { ProgressStatuses, ProgressTypes, progressClasses } from '@mezzanine-ui/core/progress';
|
|
4
|
+
import { CheckCircleFilledIcon, CheckIcon, TimesCircleFilledIcon, TimesIcon } from '@mezzanine-ui/icons';
|
|
5
|
+
import Typography from '../Typography/Typography.js';
|
|
6
|
+
import Icon from '../Icon/Icon.js';
|
|
7
|
+
import cx from 'clsx';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The react component for `mezzanine` progress.
|
|
11
|
+
*/
|
|
12
|
+
const Progress = forwardRef(function Progress(props, ref) {
|
|
13
|
+
const { circleProps, className, errorIconProps, percent = 0, percentProps, showInfo = true, size = 'medium', status = percent < 100 ? ProgressStatuses.normal : ProgressStatuses.success, successIconProps, type = ProgressTypes.line, ...rest } = props;
|
|
14
|
+
const percentLimited = Math.max(0, Math.min(100, percent));
|
|
15
|
+
const defaultSuccessIcon = type === ProgressTypes.line ? CheckCircleFilledIcon : CheckIcon;
|
|
16
|
+
const defaultErrorIcon = type === ProgressTypes.line ? TimesCircleFilledIcon : TimesIcon;
|
|
17
|
+
const renderInfo = (variant) => (jsx("div", Object.assign({ className: progressClasses.info }, { children: status === ProgressStatuses.normal
|
|
18
|
+
? /** percent text */ (jsx(Typography, Object.assign({ className: progressClasses.infoPercent, variant: variant }, percentProps, { children: `${percentLimited}%` }), void 0)) : (jsxs(Fragment, { children: [status === ProgressStatuses.success && (jsx(Icon, Object.assign({ className: progressClasses.infoIcon, icon: defaultSuccessIcon }, successIconProps), void 0)),
|
|
19
|
+
status === ProgressStatuses.error && (jsx(Icon, Object.assign({ className: progressClasses.infoIcon, icon: defaultErrorIcon }, errorIconProps), void 0))] }, void 0)) }), void 0));
|
|
20
|
+
const renderLine = () => (jsxs(Fragment, { children: [jsx("div", Object.assign({ className: progressClasses.lineBg }, { children: jsx("div", { style: { width: `${percentLimited}%` } }, void 0) }), void 0), showInfo && renderInfo('input3')] }, void 0));
|
|
21
|
+
const renderCircle = () => {
|
|
22
|
+
const { size: circleSize = 80, strokeWidth = 8, } = circleProps || {};
|
|
23
|
+
const radius = (circleSize - strokeWidth) / 2;
|
|
24
|
+
const progressLength = percent > 0 ? percent * radius * Math.PI * 0.02 : 0.00001;
|
|
25
|
+
const circleXY = circleSize / 2;
|
|
26
|
+
return (jsxs(Fragment, { children: [jsxs("svg", Object.assign({ style: { boxSizing: 'border-box' }, height: circleSize, width: circleSize }, { children: [jsx("circle", { className: progressClasses.circleBg, cx: circleXY, cy: circleXY, r: radius, strokeWidth: strokeWidth }, void 0),
|
|
27
|
+
jsx("circle", { className: progressClasses.circleFiller, cx: circleXY, cy: circleXY, r: radius, strokeWidth: strokeWidth, strokeDasharray: `${progressLength.toString()} 999` }, void 0)] }), void 0), showInfo && renderInfo('button3')] }, void 0));
|
|
28
|
+
};
|
|
29
|
+
return (jsxs("div", Object.assign({ ref: ref, className: cx(progressClasses.host, className, status === ProgressStatuses.success && progressClasses.success, status === ProgressStatuses.error && progressClasses.error, type === ProgressTypes.line && progressClasses.lineVariant, type === ProgressTypes.circle && progressClasses.circleVariant, progressClasses.size(size)) }, rest, { children: [type === ProgressTypes.line && renderLine(), type === ProgressTypes.circle && renderCircle()] }), void 0));
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export default Progress;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Progress.js';
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @mezzanine-ui/react
|
package/Radio/Radio.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ChangeEventHandler } from 'react';
|
|
2
|
+
import { RadioSize } from '@mezzanine-ui/core/radio';
|
|
3
|
+
import { InputCheckProps } from '../_internal/InputCheck';
|
|
4
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
5
|
+
export interface RadioProps extends Omit<InputCheckProps, 'control' | 'htmlFor'> {
|
|
6
|
+
/**
|
|
7
|
+
* Whether the radio is checked.
|
|
8
|
+
*/
|
|
9
|
+
checked?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the radio is checked by default.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
defaultChecked?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Since at Mezzanine we use a host element to wrap our input, most derived props will be passed to the host element.
|
|
17
|
+
* If you need direct control to the input element, use this prop to provide to it.
|
|
18
|
+
*
|
|
19
|
+
* Noticed that if you pass an id within this prop,
|
|
20
|
+
* the rendered label element will have `htmlFor` sync with passed in id.
|
|
21
|
+
*/
|
|
22
|
+
inputProps?: Omit<NativeElementPropsWithoutKeyAndRef<'input'>, 'checked' | 'defaultChecked' | 'disabled' | 'onChange' | 'placeholder' | 'readOnly' | 'required' | 'type' | 'value' | `aria-${'disabled' | 'checked'}`>;
|
|
23
|
+
/**
|
|
24
|
+
* The change event handler of input in radio.
|
|
25
|
+
*/
|
|
26
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
27
|
+
/**
|
|
28
|
+
* The size of radio.
|
|
29
|
+
* @default 'medium'
|
|
30
|
+
*/
|
|
31
|
+
size?: RadioSize;
|
|
32
|
+
/**
|
|
33
|
+
* The value of input in radio.
|
|
34
|
+
*/
|
|
35
|
+
value?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The react component for `mezzanine` radio.
|
|
39
|
+
*/
|
|
40
|
+
declare const Radio: import("react").ForwardRefExoticComponent<RadioProps & import("react").RefAttributes<HTMLLabelElement>>;
|
|
41
|
+
export default Radio;
|
package/Radio/Radio.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext } from 'react';
|
|
3
|
+
import { radioClasses } from '@mezzanine-ui/core/radio';
|
|
4
|
+
import { useRadioControlValue } from '../Form/useRadioControlValue.js';
|
|
5
|
+
import { RadioGroupContext } from './RadioGroupContext.js';
|
|
6
|
+
import { FormControlContext } from '../Form/FormControlContext.js';
|
|
7
|
+
import InputCheck from '../_internal/InputCheck/InputCheck.js';
|
|
8
|
+
import cx from 'clsx';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The react component for `mezzanine` radio.
|
|
12
|
+
*/
|
|
13
|
+
const Radio = forwardRef(function Radio(props, ref) {
|
|
14
|
+
const { disabled: disabledFromFormControl, severity, } = useContext(FormControlContext) || {};
|
|
15
|
+
const radioGroup = useContext(RadioGroupContext);
|
|
16
|
+
const { disabled: disabledFromGroup, name: nameFromGroup, size: sizeFromGroup, } = radioGroup || {};
|
|
17
|
+
const { checked: checkedProp, children, defaultChecked, disabled = (disabledFromGroup !== null && disabledFromGroup !== void 0 ? disabledFromGroup : disabledFromFormControl) || false, error = severity === 'error' || false, inputProps, onChange: onChangeProp, size = sizeFromGroup || 'medium', value, ...rest } = props;
|
|
18
|
+
const { id: inputId, name = nameFromGroup, ...restInputProps } = inputProps || {};
|
|
19
|
+
const [checked, onChange] = useRadioControlValue({
|
|
20
|
+
checked: checkedProp,
|
|
21
|
+
defaultChecked,
|
|
22
|
+
onChange: onChangeProp,
|
|
23
|
+
radioGroup,
|
|
24
|
+
value,
|
|
25
|
+
});
|
|
26
|
+
return (jsx(InputCheck, Object.assign({}, rest, { ref: ref, control: (jsx("span", Object.assign({ className: cx(radioClasses.host, {
|
|
27
|
+
[radioClasses.checked]: checked,
|
|
28
|
+
}) }, { children: jsx("input", Object.assign({}, restInputProps, { "aria-checked": checked, "aria-disabled": disabled, checked: checked, disabled: disabled, id: inputId, onChange: onChange, name: name, type: "radio", value: value }), void 0) }), void 0)), disabled: disabled, error: error, htmlFor: inputId, size: size }, { children: children }), void 0));
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export default Radio;
|