@mezzanine-ui/react 0.13.10 → 0.13.12
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 -24
- package/Accordion/Accordion.js +25 -25
- package/Accordion/AccordionControlContext.d.ts +9 -9
- package/Accordion/AccordionDetails.d.ts +10 -10
- package/Accordion/AccordionDetails.js +16 -16
- package/Accordion/AccordionSummary.d.ts +18 -18
- package/Accordion/AccordionSummary.js +39 -39
- package/Accordion/index.d.ts +3 -3
- package/Alert/Alert.d.ts +20 -20
- package/Alert/Alert.js +9 -9
- package/Alert/index.d.ts +2 -2
- package/AppBar/AppBar.d.ts +14 -14
- package/AppBar/AppBar.js +25 -25
- package/AppBar/AppBarBrand.d.ts +5 -5
- package/AppBar/AppBarBrand.js +4 -4
- package/AppBar/AppBarMain.d.ts +5 -5
- package/AppBar/AppBarMain.js +4 -4
- package/AppBar/AppBarSupport.d.ts +5 -5
- package/AppBar/AppBarSupport.js +4 -4
- package/AppBar/index.d.ts +4 -4
- package/Badge/Badge.d.ts +19 -19
- package/Badge/Badge.js +20 -20
- package/Badge/BadgeContainer.d.ts +8 -8
- package/Badge/BadgeContainer.js +7 -7
- package/Badge/index.d.ts +2 -2
- package/Button/Button.d.ts +11 -11
- package/Button/Button.js +29 -29
- package/Button/ButtonGroup.d.ts +63 -63
- package/Button/ButtonGroup.js +29 -29
- package/Button/IconButton.d.ts +21 -21
- package/Button/IconButton.js +7 -7
- package/Button/index.d.ts +20 -20
- package/Button/index.js +1 -2
- package/Button/typings.d.ts +44 -44
- package/Calendar/Calendar.d.ts +69 -69
- package/Calendar/Calendar.js +38 -38
- package/Calendar/CalendarCell.d.ts +22 -22
- package/Calendar/CalendarCell.js +11 -11
- package/Calendar/CalendarContext.d.ts +22 -22
- package/Calendar/CalendarContext.js +28 -28
- package/Calendar/CalendarControls.d.ts +26 -26
- package/Calendar/CalendarControls.js +11 -11
- package/Calendar/CalendarDayOfWeek.d.ts +15 -15
- package/Calendar/CalendarDayOfWeek.js +9 -9
- package/Calendar/CalendarDays.d.ts +38 -38
- package/Calendar/CalendarDays.js +36 -36
- package/Calendar/CalendarMonths.d.ts +42 -42
- package/Calendar/CalendarMonths.js +22 -22
- package/Calendar/CalendarWeeks.d.ts +41 -41
- package/Calendar/CalendarWeeks.js +42 -42
- package/Calendar/CalendarYears.d.ts +40 -40
- package/Calendar/CalendarYears.js +25 -25
- package/Calendar/index.d.ts +12 -12
- package/Calendar/useCalendarControlModifiers.d.ts +7 -7
- package/Calendar/useCalendarControlModifiers.js +20 -20
- package/Calendar/useCalendarControls.d.ts +12 -12
- package/Calendar/useCalendarControls.js +27 -27
- package/Calendar/useCalendarModeStack.d.ts +6 -6
- package/Calendar/useCalendarModeStack.js +10 -10
- package/Card/Card.d.ts +51 -51
- package/Card/Card.js +12 -12
- package/Card/CardActions.d.ts +34 -34
- package/Card/CardActions.js +7 -7
- package/Card/index.d.ts +2 -2
- package/Checkbox/CheckAll.d.ts +13 -13
- package/Checkbox/CheckAll.js +28 -28
- package/Checkbox/Checkbox.d.ts +46 -46
- package/Checkbox/Checkbox.js +23 -23
- package/Checkbox/CheckboxGroup.d.ts +47 -47
- package/Checkbox/CheckboxGroup.js +27 -27
- package/Checkbox/CheckboxGroupContext.d.ts +9 -9
- package/Checkbox/index.d.ts +4 -4
- package/ConfirmActions/ConfirmActions.d.ts +45 -45
- package/ConfirmActions/ConfirmActions.js +8 -8
- package/ConfirmActions/index.d.ts +1 -1
- package/DatePicker/DatePicker.d.ts +32 -32
- package/DatePicker/DatePicker.js +119 -119
- package/DatePicker/DatePickerCalendar.d.ts +32 -32
- package/DatePicker/DatePickerCalendar.js +52 -52
- package/DatePicker/index.d.ts +2 -2
- package/DateRangePicker/DateRangePicker.d.ts +38 -38
- package/DateRangePicker/DateRangePicker.js +173 -173
- package/DateRangePicker/DateRangePickerCalendar.d.ts +26 -26
- package/DateRangePicker/DateRangePickerCalendar.js +86 -86
- package/DateRangePicker/index.d.ts +4 -4
- package/DateRangePicker/useDateRangeCalendarControls.d.ts +14 -14
- package/DateRangePicker/useDateRangeCalendarControls.js +84 -84
- package/DateRangePicker/useDateRangePickerValue.d.ts +23 -23
- package/DateRangePicker/useDateRangePickerValue.js +81 -81
- package/DateTimePicker/DateTimePicker.d.ts +28 -28
- package/DateTimePicker/DateTimePicker.js +107 -107
- package/DateTimePicker/DateTimePickerPanel.d.ts +29 -29
- package/DateTimePicker/DateTimePickerPanel.js +36 -36
- package/DateTimePicker/index.d.ts +2 -2
- package/Drawer/Drawer.d.ts +13 -13
- package/Drawer/Drawer.js +10 -10
- package/Drawer/index.d.ts +2 -2
- package/Dropdown/Dropdown.d.ts +25 -25
- package/Dropdown/Dropdown.js +52 -52
- package/Dropdown/index.d.ts +1 -1
- package/Empty/Empty.d.ts +18 -18
- package/Empty/Empty.js +6 -6
- package/Empty/index.d.ts +1 -1
- package/Form/FormControlContext.d.ts +9 -9
- package/Form/FormField.d.ts +27 -27
- package/Form/FormField.js +16 -16
- package/Form/FormLabel.d.ts +11 -11
- package/Form/FormLabel.js +8 -8
- package/Form/FormMessage.d.ts +8 -8
- package/Form/FormMessage.js +9 -9
- package/Form/index.d.ts +5 -5
- package/Form/typings.d.ts +4 -4
- package/Form/useAutoCompleteValueControl.d.ts +42 -42
- package/Form/useAutoCompleteValueControl.js +97 -94
- package/Form/useCheckboxControlValue.d.ts +11 -11
- package/Form/useCheckboxControlValue.js +24 -24
- package/Form/useControlValueState.d.ts +7 -7
- package/Form/useControlValueState.js +10 -10
- package/Form/useCustomControlValue.d.ts +5 -5
- package/Form/useCustomControlValue.js +12 -12
- package/Form/useInputControlValue.d.ts +7 -7
- package/Form/useInputControlValue.js +18 -18
- package/Form/useInputWithClearControlValue.d.ts +6 -6
- package/Form/useInputWithClearControlValue.js +28 -28
- package/Form/useInputWithTagsModeValue.d.ts +37 -37
- package/Form/useInputWithTagsModeValue.js +83 -83
- package/Form/useRadioControlValue.d.ts +11 -11
- package/Form/useRadioControlValue.js +19 -19
- package/Form/useSelectValueControl.d.ts +33 -33
- package/Form/useSelectValueControl.js +71 -71
- package/Form/useSwitchControlValue.d.ts +7 -7
- package/Form/useSwitchControlValue.js +18 -18
- package/Icon/Icon.d.ts +32 -32
- package/Icon/Icon.js +18 -18
- package/Icon/index.d.ts +3 -3
- package/Input/Input.d.ts +78 -78
- package/Input/Input.js +34 -34
- package/Input/index.d.ts +2 -2
- package/Loading/Loading.d.ts +34 -34
- package/Loading/Loading.js +19 -19
- package/Loading/index.d.ts +1 -1
- package/Menu/Menu.d.ts +29 -29
- package/Menu/Menu.js +16 -16
- package/Menu/MenuDivider.d.ts +8 -8
- package/Menu/MenuDivider.js +7 -7
- package/Menu/MenuItem.d.ts +24 -24
- package/Menu/MenuItem.js +16 -16
- package/Menu/MenuItemGroup.d.ts +13 -13
- package/Menu/MenuItemGroup.js +7 -7
- package/Menu/index.d.ts +5 -5
- package/Message/Message.d.ts +36 -36
- package/Message/Message.js +63 -63
- package/Message/index.d.ts +2 -2
- package/Modal/Modal.d.ts +37 -37
- package/Modal/Modal.js +15 -15
- package/Modal/ModalActions.d.ts +10 -10
- package/Modal/ModalActions.js +10 -10
- package/Modal/ModalBody.d.ts +8 -8
- package/Modal/ModalBody.js +7 -7
- package/Modal/ModalControl.d.ts +7 -7
- package/Modal/ModalControl.js +3 -3
- package/Modal/ModalFooter.d.ts +8 -8
- package/Modal/ModalFooter.js +7 -7
- package/Modal/ModalHeader.d.ts +20 -20
- package/Modal/ModalHeader.js +10 -10
- package/Modal/index.d.ts +7 -7
- package/Modal/useModalContainer.d.ts +6 -6
- package/Modal/useModalContainer.js +19 -19
- package/Navigation/Navigation.d.ts +29 -29
- package/Navigation/Navigation.js +45 -45
- package/Navigation/NavigationContext.d.ts +6 -6
- package/Navigation/NavigationContext.js +2 -2
- package/Navigation/NavigationItem.d.ts +31 -31
- package/Navigation/NavigationItem.js +13 -13
- package/Navigation/NavigationSubMenu.d.ts +22 -22
- package/Navigation/NavigationSubMenu.js +48 -48
- package/Navigation/index.d.ts +4 -4
- package/Notification/Notification.d.ts +54 -54
- package/Notification/Notification.js +60 -60
- package/Notification/index.d.ts +2 -2
- package/Notifier/NotifierManager.d.ts +17 -17
- package/Notifier/NotifierManager.js +25 -25
- package/Notifier/createNotifier.d.ts +21 -21
- package/Notifier/createNotifier.js +65 -65
- package/Notifier/index.d.ts +2 -2
- package/Notifier/typings.d.ts +28 -28
- package/Overlay/Overlay.d.ts +43 -43
- package/Overlay/Overlay.js +22 -22
- package/Overlay/index.d.ts +1 -1
- package/PageFooter/PageFooter.d.ts +15 -15
- package/PageFooter/PageFooter.js +4 -4
- package/PageFooter/index.d.ts +1 -1
- package/Pagination/Pagination.d.ts +105 -105
- package/Pagination/Pagination.js +18 -18
- package/Pagination/PaginationItem.d.ts +27 -27
- package/Pagination/PaginationItem.js +16 -16
- package/Pagination/PaginationJumper.d.ts +38 -38
- package/Pagination/PaginationJumper.js +40 -40
- package/Pagination/PaginationPageSize.d.ts +38 -38
- package/Pagination/PaginationPageSize.js +8 -8
- package/Pagination/index.d.ts +6 -6
- package/Pagination/usePagination.d.ts +16 -16
- package/Pagination/usePagination.js +73 -73
- package/Picker/PickerTrigger.d.ts +40 -40
- package/Picker/PickerTrigger.js +7 -7
- package/Picker/RangePickerTrigger.d.ts +64 -64
- package/Picker/RangePickerTrigger.js +7 -7
- package/Picker/index.d.ts +7 -7
- package/Picker/usePickerDocumentEventClose.d.ts +10 -10
- package/Picker/usePickerDocumentEventClose.js +20 -20
- package/Picker/usePickerInputValue.d.ts +12 -12
- package/Picker/usePickerInputValue.js +18 -18
- package/Picker/usePickerValue.d.ts +20 -20
- package/Picker/usePickerValue.js +51 -51
- package/Picker/useRangePickerValue.d.ts +20 -20
- package/Picker/useRangePickerValue.js +88 -88
- package/Picker/useTabKeyClose.d.ts +2 -2
- package/Picker/useTabKeyClose.js +7 -7
- package/Popconfirm/Popconfirm.d.ts +16 -16
- package/Popconfirm/Popconfirm.js +4 -4
- package/Popconfirm/index.d.ts +1 -1
- package/Popover/Popover.d.ts +23 -23
- package/Popover/Popover.js +34 -34
- package/Popover/index.d.ts +1 -1
- package/Popper/Popper.d.ts +32 -32
- package/Popper/Popper.js +21 -21
- package/Popper/index.d.ts +1 -1
- package/Portal/Portal.d.ts +20 -20
- package/Portal/Portal.js +15 -15
- package/Portal/index.d.ts +1 -1
- package/Progress/Progress.d.ts +59 -59
- package/Progress/Progress.js +21 -21
- package/Progress/index.d.ts +2 -2
- package/Provider/ConfigProvider.d.ts +8 -8
- package/Provider/ConfigProvider.js +6 -6
- package/Provider/context.d.ts +6 -6
- package/Provider/context.js +2 -2
- package/Provider/index.d.ts +4 -4
- package/Radio/Radio.d.ts +41 -41
- package/Radio/Radio.js +21 -21
- package/Radio/RadioGroup.d.ts +47 -47
- package/Radio/RadioGroup.js +20 -20
- package/Radio/RadioGroupContext.d.ts +9 -9
- package/Radio/index.d.ts +3 -3
- package/Select/AutoComplete.d.ts +101 -101
- package/Select/AutoComplete.js +101 -101
- package/Select/Option.d.ts +19 -19
- package/Select/Option.js +37 -37
- package/Select/Select.d.ts +94 -94
- package/Select/Select.js +111 -111
- package/Select/SelectControlContext.d.ts +3 -3
- package/Select/SelectTrigger.d.ts +89 -89
- package/Select/SelectTrigger.js +44 -44
- package/Select/SelectTriggerTags.d.ts +19 -19
- package/Select/SelectTriggerTags.js +21 -21
- package/Select/TreeSelect.d.ts +68 -68
- package/Select/TreeSelect.js +183 -183
- package/Select/index.d.ts +9 -9
- package/Select/typings.d.ts +12 -12
- package/Select/useSelectTriggerTags.d.ts +19 -19
- package/Select/useSelectTriggerTags.js +53 -53
- package/Skeleton/Skeleton.d.ts +22 -22
- package/Skeleton/Skeleton.js +7 -7
- package/Skeleton/index.d.ts +1 -1
- package/Slider/Slider.d.ts +51 -51
- package/Slider/Slider.js +174 -174
- package/Slider/index.d.ts +3 -3
- package/Slider/useSlider.d.ts +31 -31
- package/Slider/useSlider.js +99 -99
- package/Stepper/Step.d.ts +41 -41
- package/Stepper/Step.js +9 -9
- package/Stepper/Stepper.d.ts +19 -19
- package/Stepper/Stepper.js +26 -26
- package/Stepper/index.d.ts +2 -2
- package/Switch/Switch.d.ts +43 -43
- package/Switch/Switch.js +18 -18
- package/Switch/index.d.ts +2 -2
- package/Table/Table.d.ts +110 -110
- package/Table/Table.js +146 -146
- package/Table/TableBody.d.ts +10 -10
- package/Table/TableBody.js +13 -13
- package/Table/TableBodyRow.d.ts +12 -12
- package/Table/TableBodyRow.js +45 -45
- package/Table/TableCell.d.ts +20 -20
- package/Table/TableCell.js +15 -15
- package/Table/TableContext.d.ts +52 -52
- package/Table/TableContext.js +2 -2
- package/Table/TableExpandedTable.d.ts +12 -12
- package/Table/TableExpandedTable.js +14 -14
- package/Table/TableHeader.d.ts +4 -4
- package/Table/TableHeader.js +20 -20
- package/Table/draggable/useTableDraggable.d.ts +14 -14
- package/Table/draggable/useTableDraggable.js +54 -54
- package/Table/editable/TableEditRenderWrapper.d.ts +8 -8
- package/Table/editable/TableEditRenderWrapper.js +8 -8
- package/Table/expandable/TableExpandable.d.ts +28 -28
- package/Table/expandable/TableExpandable.js +15 -15
- package/Table/index.d.ts +6 -6
- package/Table/pagination/TablePagination.d.ts +10 -10
- package/Table/pagination/TablePagination.js +15 -15
- package/Table/pagination/useTablePagination.d.ts +8 -8
- package/Table/pagination/useTablePagination.js +21 -21
- package/Table/refresh/TableRefresh.d.ts +10 -10
- package/Table/refresh/TableRefresh.js +13 -13
- package/Table/rowSelection/TableRowSelection.d.ts +19 -19
- package/Table/rowSelection/TableRowSelection.js +70 -70
- package/Table/rowSelection/useTableRowSelection.d.ts +6 -6
- package/Table/rowSelection/useTableRowSelection.js +47 -47
- package/Table/sorting/TableSortingIcon.d.ts +11 -11
- package/Table/sorting/TableSortingIcon.js +18 -18
- package/Table/sorting/useTableSorting.d.ts +12 -12
- package/Table/sorting/useTableSorting.js +103 -103
- package/Table/useTableFetchMore.d.ts +10 -10
- package/Table/useTableFetchMore.js +42 -42
- package/Table/useTableLoading.d.ts +5 -5
- package/Table/useTableLoading.js +13 -13
- package/Table/useTableScroll.d.ts +550 -550
- package/Table/useTableScroll.js +275 -275
- package/Tabs/Tab.d.ts +19 -19
- package/Tabs/Tab.js +9 -9
- package/Tabs/TabPane.d.ts +14 -14
- package/Tabs/TabPane.js +11 -11
- package/Tabs/Tabs.d.ts +39 -39
- package/Tabs/Tabs.js +36 -36
- package/Tabs/index.d.ts +3 -3
- package/Tabs/useTabsOverflow.d.ts +8 -8
- package/Tabs/useTabsOverflow.js +56 -56
- package/Tag/Tag.d.ts +29 -29
- package/Tag/Tag.js +14 -14
- package/Tag/index.d.ts +2 -2
- package/TextField/TextField.d.ts +54 -54
- package/TextField/TextField.js +33 -33
- package/TextField/index.d.ts +2 -2
- package/TextField/useTextFieldControl.d.ts +10 -10
- package/TextField/useTextFieldControl.js +12 -12
- package/Textarea/Textarea.d.ts +58 -58
- package/Textarea/Textarea.js +22 -22
- package/Textarea/index.d.ts +2 -2
- package/TimePanel/TimePanel.d.ts +66 -66
- package/TimePanel/TimePanel.js +54 -54
- package/TimePanel/TimePanelAction.d.ts +18 -18
- package/TimePanel/TimePanelAction.js +7 -7
- package/TimePanel/TimePanelColumn.d.ts +37 -37
- package/TimePanel/TimePanelColumn.js +28 -28
- package/TimePanel/index.d.ts +3 -3
- package/TimePicker/TimePicker.d.ts +24 -24
- package/TimePicker/TimePicker.js +99 -99
- package/TimePicker/TimePickerPanel.d.ts +24 -24
- package/TimePicker/TimePickerPanel.js +7 -7
- package/TimePicker/index.d.ts +2 -2
- package/Tooltip/Tooltip.d.ts +25 -25
- package/Tooltip/Tooltip.js +27 -27
- package/Tooltip/index.d.ts +1 -1
- package/Tooltip/useDelayMouseEnterLeave.d.ts +12 -12
- package/Tooltip/useDelayMouseEnterLeave.js +36 -36
- package/Transition/Collapse.d.ts +15 -15
- package/Transition/Collapse.js +96 -96
- package/Transition/Fade.d.ts +8 -8
- package/Transition/Fade.js +74 -74
- package/Transition/Grow.d.ts +13 -13
- package/Transition/Grow.js +101 -101
- package/Transition/SlideFade.d.ts +15 -15
- package/Transition/SlideFade.js +83 -83
- package/Transition/Transition.d.ts +98 -98
- package/Transition/Transition.js +21 -21
- package/Transition/Zoom.d.ts +8 -8
- package/Transition/Zoom.js +74 -74
- package/Transition/getAutoSizeDuration.d.ts +1 -1
- package/Transition/getAutoSizeDuration.js +7 -7
- package/Transition/getTransitionStyleProps.d.ts +16 -16
- package/Transition/getTransitionStyleProps.js +22 -22
- package/Transition/index.d.ts +6 -6
- package/Transition/reflow.d.ts +4 -4
- package/Transition/reflow.js +6 -6
- package/Transition/useAutoTransitionDuration.d.ts +6 -6
- package/Transition/useAutoTransitionDuration.js +10 -10
- package/Transition/useSetNodeTransition.d.ts +7 -7
- package/Transition/useSetNodeTransition.js +30 -30
- package/Tree/Tree.d.ts +70 -70
- package/Tree/Tree.js +116 -116
- package/Tree/TreeNode.d.ts +41 -41
- package/Tree/TreeNode.js +29 -29
- package/Tree/TreeNodeList.d.ts +25 -25
- package/Tree/TreeNodeList.js +22 -22
- package/Tree/getTreeNodeEntities.d.ts +11 -11
- package/Tree/getTreeNodeEntities.js +84 -84
- package/Tree/index.d.ts +8 -8
- package/Tree/toggleValue.d.ts +4 -4
- package/Tree/toggleValue.js +13 -13
- package/Tree/traverseTree.d.ts +2 -2
- package/Tree/traverseTree.js +8 -8
- package/Tree/typings.d.ts +16 -16
- package/Tree/useTreeExpandedValue.d.ts +15 -15
- package/Tree/useTreeExpandedValue.js +26 -26
- package/Typography/Typography.d.ts +43 -43
- package/Typography/Typography.js +31 -31
- package/Typography/index.d.ts +11 -11
- package/Typography/index.js +4 -1
- package/Upload/UploadButton.d.ts +10 -10
- package/Upload/UploadButton.js +14 -14
- package/Upload/UploadInput.d.ts +21 -21
- package/Upload/UploadInput.js +18 -18
- package/Upload/UploadPicture.d.ts +49 -49
- package/Upload/UploadPicture.js +43 -43
- package/Upload/UploadPictureBlock.d.ts +20 -20
- package/Upload/UploadPictureBlock.js +70 -70
- package/Upload/UploadPictureWall.d.ts +81 -81
- package/Upload/UploadPictureWall.js +144 -144
- package/Upload/UploadPictureWallItem.d.ts +15 -15
- package/Upload/UploadPictureWallItem.js +10 -10
- package/Upload/UploadResult.d.ts +35 -35
- package/Upload/UploadResult.js +19 -19
- package/Upload/index.d.ts +6 -6
- package/_internal/InputCheck/InputCheck.d.ts +33 -33
- package/_internal/InputCheck/InputCheck.js +11 -11
- package/_internal/InputCheck/InputCheckGroup.d.ts +18 -18
- package/_internal/InputCheck/InputCheckGroup.js +7 -7
- package/_internal/InputCheck/index.d.ts +3 -3
- package/_internal/InputTriggerPopper/InputTriggerPopper.d.ts +18 -18
- package/_internal/InputTriggerPopper/InputTriggerPopper.js +35 -35
- package/_internal/InputTriggerPopper/index.d.ts +1 -1
- package/_internal/SlideFadeOverlay/SlideFadeOverlay.d.ts +21 -21
- package/_internal/SlideFadeOverlay/SlideFadeOverlay.js +53 -53
- package/_internal/SlideFadeOverlay/index.d.ts +1 -1
- package/_internal/SlideFadeOverlay/useTopStack.d.ts +1 -1
- package/_internal/SlideFadeOverlay/useTopStack.js +17 -17
- package/hooks/useClickAway.d.ts +5 -5
- package/hooks/useClickAway.js +18 -18
- package/hooks/useComposeRefs.d.ts +2 -2
- package/hooks/useComposeRefs.js +2 -2
- package/hooks/useDocumentEscapeKeyDown.d.ts +3 -3
- package/hooks/useDocumentEscapeKeyDown.js +15 -15
- package/hooks/useDocumentEvents.d.ts +5 -5
- package/hooks/useDocumentEvents.js +16 -16
- package/hooks/useDocumentTabKeyDown.d.ts +3 -3
- package/hooks/useDocumentTabKeyDown.js +14 -14
- package/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
- package/hooks/useIsomorphicLayoutEffect.js +2 -2
- package/hooks/useLastCallback.d.ts +1 -1
- package/hooks/useLastCallback.js +5 -5
- package/hooks/useLastValue.d.ts +3 -3
- package/hooks/useLastValue.js +4 -4
- package/hooks/usePreviousValue.d.ts +1 -1
- package/hooks/usePreviousValue.js +6 -6
- package/hooks/useWindowWidth.d.ts +1 -1
- package/hooks/useWindowWidth.js +10 -10
- package/index.d.ts +102 -102
- package/package.json +6 -20
- package/utils/array-move.d.ts +1 -1
- package/utils/array-move.js +10 -10
- package/utils/composeRefs.d.ts +21 -21
- package/utils/composeRefs.js +29 -29
- package/utils/cx.d.ts +1 -1
- package/utils/general.d.ts +8 -8
- package/utils/getElement.d.ts +3 -3
- package/utils/getElement.js +11 -11
- package/utils/jsx-types.d.ts +11 -11
- package/utils/scroll-lock.d.ts +2 -2
- package/utils/scroll-lock.js +17 -17
|
@@ -1,89 +1,89 @@
|
|
|
1
1
|
import { useRef, useState, useCallback } from 'react';
|
|
2
2
|
import { useInputControlValue } from './useInputControlValue.js';
|
|
3
3
|
|
|
4
|
-
function useInputWithTagsModeValue(props) {
|
|
5
|
-
var _a;
|
|
6
|
-
const { defaultValue, initialTagsValue = [], maxTagsLength, onTagsChange: onChangeProp, ref, skip = false, tagValueMaxLength = 8, } = props;
|
|
7
|
-
const canActive = !skip;
|
|
8
|
-
const activeMaxTagsLength = maxTagsLength || Math.max(3, initialTagsValue.length);
|
|
9
|
-
const tagsSetRef = useRef(new Set(initialTagsValue.map((initialTag) => initialTag.trim())));
|
|
10
|
-
const inputTypeIsNumber = useRef(((_a = ref.current) === null || _a === void 0 ? void 0 : _a.type) === 'number');
|
|
11
|
-
const tagValueTransform = (tag) => (tag.slice(0, tagValueMaxLength).trim());
|
|
12
|
-
const transformNumberTags = (tags) => (tags.map((tag) => Number(tag)));
|
|
13
|
-
const generateUniqueTags = () => (Array
|
|
14
|
-
.from(tagsSetRef.current.values())
|
|
15
|
-
.map((initialTag) => tagValueTransform(initialTag)));
|
|
16
|
-
const [value, setValue] = useInputControlValue({
|
|
17
|
-
defaultValue: canActive ? defaultValue : undefined,
|
|
18
|
-
});
|
|
19
|
-
const [tags, setTags] = useState(generateUniqueTags()
|
|
20
|
-
.slice(0, activeMaxTagsLength));
|
|
21
|
-
const tagsWillOverflow = useCallback(() => (tagsSetRef.current.size === activeMaxTagsLength), []);
|
|
22
|
-
const clearTypingFieldValue = () => {
|
|
23
|
-
if (!canActive)
|
|
24
|
-
return;
|
|
25
|
-
const target = ref.current;
|
|
26
|
-
if (target) {
|
|
27
|
-
const changeEvent = Object.create({});
|
|
28
|
-
changeEvent.target = target;
|
|
29
|
-
changeEvent.currentTarget = target;
|
|
30
|
-
target.value = '';
|
|
31
|
-
setValue(changeEvent);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
const onClear = () => {
|
|
35
|
-
if (!canActive)
|
|
36
|
-
return;
|
|
37
|
-
clearTypingFieldValue();
|
|
38
|
-
tagsSetRef.current.clear();
|
|
39
|
-
setTags([]);
|
|
40
|
-
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp([]);
|
|
41
|
-
};
|
|
42
|
-
const onChange = (event) => {
|
|
43
|
-
if (canActive && event) {
|
|
44
|
-
setValue(event);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const onRemove = (tag) => {
|
|
48
|
-
tagsSetRef.current.delete(tag);
|
|
49
|
-
const numberTag = inputTypeIsNumber.current;
|
|
50
|
-
const newTags = generateUniqueTags();
|
|
51
|
-
setTags(newTags);
|
|
52
|
-
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(numberTag ? transformNumberTags(newTags) : newTags);
|
|
53
|
-
};
|
|
54
|
-
const onKeyDown = useCallback((e) => {
|
|
55
|
-
var _a;
|
|
56
|
-
if (!canActive)
|
|
57
|
-
return;
|
|
58
|
-
const element = ref.current;
|
|
59
|
-
if (element &&
|
|
60
|
-
(element === null || element === void 0 ? void 0 : element.value) &&
|
|
61
|
-
(e.key === 'Enter' || e.code === 'Enter') &&
|
|
62
|
-
!e.nativeEvent.isComposing &&
|
|
63
|
-
!tagsWillOverflow()) {
|
|
64
|
-
e.preventDefault();
|
|
65
|
-
inputTypeIsNumber.current = ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.type) === 'number';
|
|
66
|
-
const tagsSet = tagsSetRef.current;
|
|
67
|
-
const isNumber = inputTypeIsNumber.current;
|
|
68
|
-
const newTagValue = tagValueTransform(element.value);
|
|
69
|
-
tagsSet.add(newTagValue);
|
|
70
|
-
const newTags = generateUniqueTags();
|
|
71
|
-
setTags(newTags);
|
|
72
|
-
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(isNumber ? transformNumberTags(newTags) : newTags);
|
|
73
|
-
clearTypingFieldValue();
|
|
74
|
-
}
|
|
75
|
-
}, [tagsWillOverflow]);
|
|
76
|
-
return [
|
|
77
|
-
{
|
|
78
|
-
tags,
|
|
79
|
-
typingValue: value,
|
|
80
|
-
tagsReachedMax: tagsWillOverflow(),
|
|
81
|
-
},
|
|
82
|
-
onChange,
|
|
83
|
-
onClear,
|
|
84
|
-
onRemove,
|
|
85
|
-
onKeyDown,
|
|
86
|
-
];
|
|
4
|
+
function useInputWithTagsModeValue(props) {
|
|
5
|
+
var _a;
|
|
6
|
+
const { defaultValue, initialTagsValue = [], maxTagsLength, onTagsChange: onChangeProp, ref, skip = false, tagValueMaxLength = 8, } = props;
|
|
7
|
+
const canActive = !skip;
|
|
8
|
+
const activeMaxTagsLength = maxTagsLength || Math.max(3, initialTagsValue.length);
|
|
9
|
+
const tagsSetRef = useRef(new Set(initialTagsValue.map((initialTag) => initialTag.trim())));
|
|
10
|
+
const inputTypeIsNumber = useRef(((_a = ref.current) === null || _a === void 0 ? void 0 : _a.type) === 'number');
|
|
11
|
+
const tagValueTransform = (tag) => (tag.slice(0, tagValueMaxLength).trim());
|
|
12
|
+
const transformNumberTags = (tags) => (tags.map((tag) => Number(tag)));
|
|
13
|
+
const generateUniqueTags = () => (Array
|
|
14
|
+
.from(tagsSetRef.current.values())
|
|
15
|
+
.map((initialTag) => tagValueTransform(initialTag)));
|
|
16
|
+
const [value, setValue] = useInputControlValue({
|
|
17
|
+
defaultValue: canActive ? defaultValue : undefined,
|
|
18
|
+
});
|
|
19
|
+
const [tags, setTags] = useState(generateUniqueTags()
|
|
20
|
+
.slice(0, activeMaxTagsLength));
|
|
21
|
+
const tagsWillOverflow = useCallback(() => (tagsSetRef.current.size === activeMaxTagsLength), []);
|
|
22
|
+
const clearTypingFieldValue = () => {
|
|
23
|
+
if (!canActive)
|
|
24
|
+
return;
|
|
25
|
+
const target = ref.current;
|
|
26
|
+
if (target) {
|
|
27
|
+
const changeEvent = Object.create({});
|
|
28
|
+
changeEvent.target = target;
|
|
29
|
+
changeEvent.currentTarget = target;
|
|
30
|
+
target.value = '';
|
|
31
|
+
setValue(changeEvent);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const onClear = () => {
|
|
35
|
+
if (!canActive)
|
|
36
|
+
return;
|
|
37
|
+
clearTypingFieldValue();
|
|
38
|
+
tagsSetRef.current.clear();
|
|
39
|
+
setTags([]);
|
|
40
|
+
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp([]);
|
|
41
|
+
};
|
|
42
|
+
const onChange = (event) => {
|
|
43
|
+
if (canActive && event) {
|
|
44
|
+
setValue(event);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const onRemove = (tag) => {
|
|
48
|
+
tagsSetRef.current.delete(tag);
|
|
49
|
+
const numberTag = inputTypeIsNumber.current;
|
|
50
|
+
const newTags = generateUniqueTags();
|
|
51
|
+
setTags(newTags);
|
|
52
|
+
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(numberTag ? transformNumberTags(newTags) : newTags);
|
|
53
|
+
};
|
|
54
|
+
const onKeyDown = useCallback((e) => {
|
|
55
|
+
var _a;
|
|
56
|
+
if (!canActive)
|
|
57
|
+
return;
|
|
58
|
+
const element = ref.current;
|
|
59
|
+
if (element &&
|
|
60
|
+
(element === null || element === void 0 ? void 0 : element.value) &&
|
|
61
|
+
(e.key === 'Enter' || e.code === 'Enter') &&
|
|
62
|
+
!e.nativeEvent.isComposing &&
|
|
63
|
+
!tagsWillOverflow()) {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
inputTypeIsNumber.current = ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.type) === 'number';
|
|
66
|
+
const tagsSet = tagsSetRef.current;
|
|
67
|
+
const isNumber = inputTypeIsNumber.current;
|
|
68
|
+
const newTagValue = tagValueTransform(element.value);
|
|
69
|
+
tagsSet.add(newTagValue);
|
|
70
|
+
const newTags = generateUniqueTags();
|
|
71
|
+
setTags(newTags);
|
|
72
|
+
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(isNumber ? transformNumberTags(newTags) : newTags);
|
|
73
|
+
clearTypingFieldValue();
|
|
74
|
+
}
|
|
75
|
+
}, [tagsWillOverflow]);
|
|
76
|
+
return [
|
|
77
|
+
{
|
|
78
|
+
tags,
|
|
79
|
+
typingValue: value,
|
|
80
|
+
tagsReachedMax: tagsWillOverflow(),
|
|
81
|
+
},
|
|
82
|
+
onChange,
|
|
83
|
+
onClear,
|
|
84
|
+
onRemove,
|
|
85
|
+
onKeyDown,
|
|
86
|
+
];
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export { useInputWithTagsModeValue };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ChangeEventHandler } from 'react';
|
|
2
|
-
import { UseSwitchControlValueProps } from './useSwitchControlValue';
|
|
3
|
-
export interface RadioGroupControlContextValue {
|
|
4
|
-
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
5
|
-
value?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface UseRadioControlValueProps extends UseSwitchControlValueProps {
|
|
8
|
-
radioGroup?: RadioGroupControlContextValue;
|
|
9
|
-
value?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function useRadioControlValue(props: UseRadioControlValueProps): readonly [boolean, (event: import("react").ChangeEvent<HTMLInputElement>) => void];
|
|
1
|
+
import { ChangeEventHandler } from 'react';
|
|
2
|
+
import { UseSwitchControlValueProps } from './useSwitchControlValue';
|
|
3
|
+
export interface RadioGroupControlContextValue {
|
|
4
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
5
|
+
value?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface UseRadioControlValueProps extends UseSwitchControlValueProps {
|
|
8
|
+
radioGroup?: RadioGroupControlContextValue;
|
|
9
|
+
value?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function useRadioControlValue(props: UseRadioControlValueProps): readonly [boolean, (event: import("react").ChangeEvent<HTMLInputElement>) => void];
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { useSwitchControlValue } from './useSwitchControlValue.js';
|
|
2
2
|
|
|
3
|
-
function useRadioControlValue(props) {
|
|
4
|
-
const { checked: checkedProp, defaultChecked, onChange: onChangeProp, radioGroup, value, } = props;
|
|
5
|
-
const { onChange: onChangeFromGroup } = radioGroup || {};
|
|
6
|
-
const [checked, setChecked] = useSwitchControlValue({
|
|
7
|
-
/**
|
|
8
|
-
* To ensure radio inside radio group, not use destructure here
|
|
9
|
-
*/
|
|
10
|
-
checked: radioGroup ? radioGroup.value === value : checkedProp,
|
|
11
|
-
defaultChecked,
|
|
12
|
-
onChange: (event) => {
|
|
13
|
-
if (onChangeProp) {
|
|
14
|
-
onChangeProp(event);
|
|
15
|
-
}
|
|
16
|
-
if (onChangeFromGroup) {
|
|
17
|
-
onChangeFromGroup(event);
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
return [checked, setChecked];
|
|
3
|
+
function useRadioControlValue(props) {
|
|
4
|
+
const { checked: checkedProp, defaultChecked, onChange: onChangeProp, radioGroup, value, } = props;
|
|
5
|
+
const { onChange: onChangeFromGroup } = radioGroup || {};
|
|
6
|
+
const [checked, setChecked] = useSwitchControlValue({
|
|
7
|
+
/**
|
|
8
|
+
* To ensure radio inside radio group, not use destructure here
|
|
9
|
+
*/
|
|
10
|
+
checked: radioGroup ? radioGroup.value === value : checkedProp,
|
|
11
|
+
defaultChecked,
|
|
12
|
+
onChange: (event) => {
|
|
13
|
+
if (onChangeProp) {
|
|
14
|
+
onChangeProp(event);
|
|
15
|
+
}
|
|
16
|
+
if (onChangeFromGroup) {
|
|
17
|
+
onChangeFromGroup(event);
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
return [checked, setChecked];
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export { useRadioControlValue };
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { MouseEvent } from 'react';
|
|
2
|
-
import { SelectValue } from '../Select/typings';
|
|
3
|
-
export interface UseSelectBaseValueControl {
|
|
4
|
-
onClear?(e: MouseEvent<Element>): void;
|
|
5
|
-
onChange?(newOptions: SelectValue[] | SelectValue): any;
|
|
6
|
-
onClose?(): void;
|
|
7
|
-
}
|
|
8
|
-
export
|
|
9
|
-
defaultValue?: SelectValue[];
|
|
10
|
-
mode: 'multiple';
|
|
11
|
-
onChange?(newOptions: SelectValue[]): any;
|
|
12
|
-
value?: SelectValue[];
|
|
13
|
-
};
|
|
14
|
-
export
|
|
15
|
-
defaultValue?: SelectValue;
|
|
16
|
-
mode: 'single';
|
|
17
|
-
onChange?(newOption: SelectValue): any;
|
|
18
|
-
value?: SelectValue | null;
|
|
19
|
-
};
|
|
20
|
-
export
|
|
21
|
-
export interface SelectBaseValueControl {
|
|
22
|
-
onClear(e: MouseEvent<Element>): void;
|
|
23
|
-
}
|
|
24
|
-
export
|
|
25
|
-
onChange: (v: SelectValue | null) => SelectValue[];
|
|
26
|
-
value: SelectValue[];
|
|
27
|
-
};
|
|
28
|
-
export
|
|
29
|
-
onChange: (v: SelectValue | null) => SelectValue | null;
|
|
30
|
-
value: SelectValue | null;
|
|
31
|
-
};
|
|
32
|
-
export
|
|
33
|
-
export declare const useSelectValueControl: (props: UseSelectValueControl) => SelectMultipleValueControl | SelectSingleValueControl;
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
|
+
import { SelectValue } from '../Select/typings';
|
|
3
|
+
export interface UseSelectBaseValueControl {
|
|
4
|
+
onClear?(e: MouseEvent<Element>): void;
|
|
5
|
+
onChange?(newOptions: SelectValue[] | SelectValue): any;
|
|
6
|
+
onClose?(): void;
|
|
7
|
+
}
|
|
8
|
+
export type UseSelectMultipleValueControl = UseSelectBaseValueControl & {
|
|
9
|
+
defaultValue?: SelectValue[];
|
|
10
|
+
mode: 'multiple';
|
|
11
|
+
onChange?(newOptions: SelectValue[]): any;
|
|
12
|
+
value?: SelectValue[];
|
|
13
|
+
};
|
|
14
|
+
export type UseSelectSingleValueControl = UseSelectBaseValueControl & {
|
|
15
|
+
defaultValue?: SelectValue;
|
|
16
|
+
mode: 'single';
|
|
17
|
+
onChange?(newOption: SelectValue): any;
|
|
18
|
+
value?: SelectValue | null;
|
|
19
|
+
};
|
|
20
|
+
export type UseSelectValueControl = UseSelectMultipleValueControl | UseSelectSingleValueControl;
|
|
21
|
+
export interface SelectBaseValueControl {
|
|
22
|
+
onClear(e: MouseEvent<Element>): void;
|
|
23
|
+
}
|
|
24
|
+
export type SelectMultipleValueControl = SelectBaseValueControl & {
|
|
25
|
+
onChange: (v: SelectValue | null) => SelectValue[];
|
|
26
|
+
value: SelectValue[];
|
|
27
|
+
};
|
|
28
|
+
export type SelectSingleValueControl = SelectBaseValueControl & {
|
|
29
|
+
onChange: (v: SelectValue | null) => SelectValue | null;
|
|
30
|
+
value: SelectValue | null;
|
|
31
|
+
};
|
|
32
|
+
export type SelectValueControl = SelectMultipleValueControl | SelectSingleValueControl;
|
|
33
|
+
export declare const useSelectValueControl: (props: UseSelectValueControl) => SelectMultipleValueControl | SelectSingleValueControl;
|
|
@@ -1,77 +1,77 @@
|
|
|
1
1
|
import isEqual from 'lodash/isEqual';
|
|
2
2
|
import { useControlValueState } from './useControlValueState.js';
|
|
3
3
|
|
|
4
|
-
const equalityFn = (a, b) => isEqual(a, b);
|
|
5
|
-
function useSelectBaseValueControl(props) {
|
|
6
|
-
const { defaultValue, mode, onChange, onClear: onClearProp, onClose, value: valueProp, } = props;
|
|
7
|
-
const [value, setValue] = useControlValueState({
|
|
8
|
-
defaultValue: defaultValue || (mode === 'multiple' ? [] : null),
|
|
9
|
-
equalityFn,
|
|
10
|
-
value: valueProp,
|
|
11
|
-
});
|
|
12
|
-
return {
|
|
13
|
-
value,
|
|
14
|
-
onChange: (chooseOption) => {
|
|
15
|
-
var _a;
|
|
16
|
-
if (!chooseOption) {
|
|
17
|
-
if (mode === 'multiple') {
|
|
18
|
-
return [];
|
|
19
|
-
}
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
let newValue = mode === 'multiple' ? [] : null;
|
|
23
|
-
switch (mode) {
|
|
24
|
-
case 'multiple': {
|
|
25
|
-
const existedValueIdx = ((_a = value) !== null && _a !== void 0 ? _a : []).findIndex((v) => v.id === chooseOption.id);
|
|
26
|
-
if (~existedValueIdx) {
|
|
27
|
-
newValue = [
|
|
28
|
-
...value.slice(0, existedValueIdx),
|
|
29
|
-
...value.slice(existedValueIdx + 1),
|
|
30
|
-
];
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
newValue = [
|
|
34
|
-
...value,
|
|
35
|
-
chooseOption,
|
|
36
|
-
];
|
|
37
|
-
}
|
|
38
|
-
if (typeof onChange === 'function')
|
|
39
|
-
onChange(newValue);
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
default: {
|
|
43
|
-
newValue = chooseOption;
|
|
44
|
-
if (typeof onClose === 'function') {
|
|
45
|
-
/** single selection should close modal when clicked */
|
|
46
|
-
onClose();
|
|
47
|
-
}
|
|
48
|
-
if (typeof onChange === 'function')
|
|
49
|
-
onChange(newValue);
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
setValue(newValue);
|
|
54
|
-
return newValue;
|
|
55
|
-
},
|
|
56
|
-
onClear: (e) => {
|
|
57
|
-
e.stopPropagation();
|
|
58
|
-
if (mode === 'multiple') {
|
|
59
|
-
setValue([]);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
setValue(null);
|
|
63
|
-
}
|
|
64
|
-
if (typeof onClearProp === 'function') {
|
|
65
|
-
onClearProp(e);
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
const useSelectValueControl = (props) => {
|
|
71
|
-
if (props.mode === 'multiple') {
|
|
72
|
-
return useSelectBaseValueControl(props);
|
|
73
|
-
}
|
|
74
|
-
return useSelectBaseValueControl(props);
|
|
4
|
+
const equalityFn = (a, b) => isEqual(a, b);
|
|
5
|
+
function useSelectBaseValueControl(props) {
|
|
6
|
+
const { defaultValue, mode, onChange, onClear: onClearProp, onClose, value: valueProp, } = props;
|
|
7
|
+
const [value, setValue] = useControlValueState({
|
|
8
|
+
defaultValue: defaultValue || (mode === 'multiple' ? [] : null),
|
|
9
|
+
equalityFn,
|
|
10
|
+
value: valueProp,
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
value,
|
|
14
|
+
onChange: (chooseOption) => {
|
|
15
|
+
var _a;
|
|
16
|
+
if (!chooseOption) {
|
|
17
|
+
if (mode === 'multiple') {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
let newValue = mode === 'multiple' ? [] : null;
|
|
23
|
+
switch (mode) {
|
|
24
|
+
case 'multiple': {
|
|
25
|
+
const existedValueIdx = ((_a = value) !== null && _a !== void 0 ? _a : []).findIndex((v) => v.id === chooseOption.id);
|
|
26
|
+
if (~existedValueIdx) {
|
|
27
|
+
newValue = [
|
|
28
|
+
...value.slice(0, existedValueIdx),
|
|
29
|
+
...value.slice(existedValueIdx + 1),
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
newValue = [
|
|
34
|
+
...value,
|
|
35
|
+
chooseOption,
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
if (typeof onChange === 'function')
|
|
39
|
+
onChange(newValue);
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
default: {
|
|
43
|
+
newValue = chooseOption;
|
|
44
|
+
if (typeof onClose === 'function') {
|
|
45
|
+
/** single selection should close modal when clicked */
|
|
46
|
+
onClose();
|
|
47
|
+
}
|
|
48
|
+
if (typeof onChange === 'function')
|
|
49
|
+
onChange(newValue);
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
setValue(newValue);
|
|
54
|
+
return newValue;
|
|
55
|
+
},
|
|
56
|
+
onClear: (e) => {
|
|
57
|
+
e.stopPropagation();
|
|
58
|
+
if (mode === 'multiple') {
|
|
59
|
+
setValue([]);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
setValue(null);
|
|
63
|
+
}
|
|
64
|
+
if (typeof onClearProp === 'function') {
|
|
65
|
+
onClearProp(e);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const useSelectValueControl = (props) => {
|
|
71
|
+
if (props.mode === 'multiple') {
|
|
72
|
+
return useSelectBaseValueControl(props);
|
|
73
|
+
}
|
|
74
|
+
return useSelectBaseValueControl(props);
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
export { useSelectValueControl };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ChangeEventHandler } from 'react';
|
|
2
|
-
export interface UseSwitchControlValueProps {
|
|
3
|
-
checked?: boolean;
|
|
4
|
-
defaultChecked?: boolean;
|
|
5
|
-
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
6
|
-
}
|
|
7
|
-
export declare function useSwitchControlValue(props: UseSwitchControlValueProps): readonly [boolean, (event: import("react").ChangeEvent<HTMLInputElement>) => void];
|
|
1
|
+
import { ChangeEventHandler } from 'react';
|
|
2
|
+
export interface UseSwitchControlValueProps {
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
defaultChecked?: boolean;
|
|
5
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
6
|
+
}
|
|
7
|
+
export declare function useSwitchControlValue(props: UseSwitchControlValueProps): readonly [boolean, (event: import("react").ChangeEvent<HTMLInputElement>) => void];
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { useLastCallback } from '../hooks/useLastCallback.js';
|
|
2
2
|
import { useControlValueState } from './useControlValueState.js';
|
|
3
3
|
|
|
4
|
-
const equalityFn = (a, b) => a === b;
|
|
5
|
-
function useSwitchControlValue(props) {
|
|
6
|
-
const { checked: checkedProp, defaultChecked = false, onChange: onChangeProp, } = props;
|
|
7
|
-
const [checked, setChecked] = useControlValueState({
|
|
8
|
-
defaultValue: defaultChecked,
|
|
9
|
-
equalityFn,
|
|
10
|
-
value: checkedProp,
|
|
11
|
-
});
|
|
12
|
-
const onChange = useLastCallback((event) => {
|
|
13
|
-
const nextChecked = event.target.checked;
|
|
14
|
-
if (!equalityFn(checked, nextChecked)) {
|
|
15
|
-
setChecked(nextChecked);
|
|
16
|
-
if (onChangeProp) {
|
|
17
|
-
onChangeProp(event);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
return [checked, onChange];
|
|
4
|
+
const equalityFn = (a, b) => a === b;
|
|
5
|
+
function useSwitchControlValue(props) {
|
|
6
|
+
const { checked: checkedProp, defaultChecked = false, onChange: onChangeProp, } = props;
|
|
7
|
+
const [checked, setChecked] = useControlValueState({
|
|
8
|
+
defaultValue: defaultChecked,
|
|
9
|
+
equalityFn,
|
|
10
|
+
value: checkedProp,
|
|
11
|
+
});
|
|
12
|
+
const onChange = useLastCallback((event) => {
|
|
13
|
+
const nextChecked = event.target.checked;
|
|
14
|
+
if (!equalityFn(checked, nextChecked)) {
|
|
15
|
+
setChecked(nextChecked);
|
|
16
|
+
if (onChangeProp) {
|
|
17
|
+
onChangeProp(event);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return [checked, onChange];
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export { useSwitchControlValue };
|
package/Icon/Icon.d.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { IconDefinition } from '@mezzanine-ui/icons';
|
|
3
|
-
import { IconColor } from '@mezzanine-ui/core/icon';
|
|
4
|
-
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
5
|
-
export interface IconProps extends NativeElementPropsWithoutKeyAndRef<'i'> {
|
|
6
|
-
/**
|
|
7
|
-
* Color name provided by palette.
|
|
8
|
-
*/
|
|
9
|
-
color?: IconColor;
|
|
10
|
-
/**
|
|
11
|
-
* The icon provided by `@mezzanine-ui/icons` package.
|
|
12
|
-
*/
|
|
13
|
-
icon: IconDefinition;
|
|
14
|
-
/**
|
|
15
|
-
* Icon size in px
|
|
16
|
-
*/
|
|
17
|
-
size?: number;
|
|
18
|
-
/**
|
|
19
|
-
* Whether to spin the icon or not.
|
|
20
|
-
* @default false
|
|
21
|
-
*/
|
|
22
|
-
spin?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Icon accessible title
|
|
25
|
-
*/
|
|
26
|
-
title?: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* The react component for `mezzanine` icon.
|
|
30
|
-
*/
|
|
31
|
-
declare const Icon: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<HTMLElement>>;
|
|
32
|
-
export default Icon;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IconDefinition } from '@mezzanine-ui/icons';
|
|
3
|
+
import { IconColor } from '@mezzanine-ui/core/icon';
|
|
4
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
5
|
+
export interface IconProps extends NativeElementPropsWithoutKeyAndRef<'i'> {
|
|
6
|
+
/**
|
|
7
|
+
* Color name provided by palette.
|
|
8
|
+
*/
|
|
9
|
+
color?: IconColor;
|
|
10
|
+
/**
|
|
11
|
+
* The icon provided by `@mezzanine-ui/icons` package.
|
|
12
|
+
*/
|
|
13
|
+
icon: IconDefinition;
|
|
14
|
+
/**
|
|
15
|
+
* Icon size in px
|
|
16
|
+
*/
|
|
17
|
+
size?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Whether to spin the icon or not.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
spin?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Icon accessible title
|
|
25
|
+
*/
|
|
26
|
+
title?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The react component for `mezzanine` icon.
|
|
30
|
+
*/
|
|
31
|
+
declare const Icon: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<HTMLElement>>;
|
|
32
|
+
export default Icon;
|
package/Icon/Icon.js
CHANGED
|
@@ -3,24 +3,24 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import { toIconCssVars, iconClasses } from '@mezzanine-ui/core/icon';
|
|
4
4
|
import cx from 'clsx';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* The react component for `mezzanine` icon.
|
|
8
|
-
*/
|
|
9
|
-
const Icon = forwardRef(function Icon(props, ref) {
|
|
10
|
-
const { className, color, icon, size, spin = false, style: styleProp, title, ...rest } = props;
|
|
11
|
-
const { definition } = icon;
|
|
12
|
-
const cssVars = toIconCssVars({ color, size });
|
|
13
|
-
const style = {
|
|
14
|
-
'--mzn-icon-cursor': props.onClick || props.onMouseOver ? 'pointer' : 'inherit',
|
|
15
|
-
...cssVars,
|
|
16
|
-
...styleProp,
|
|
17
|
-
};
|
|
18
|
-
return (jsx("i", { ...rest, ref: ref, className: cx(iconClasses.host, {
|
|
19
|
-
[iconClasses.color]: color,
|
|
20
|
-
[iconClasses.spin]: spin,
|
|
21
|
-
[iconClasses.size]: size,
|
|
22
|
-
}, className), "data-icon-name": icon.name, style: style, children: jsxs("svg", { ...definition.svg, focusable: false, children: [title || definition.title ? (jsx("title", { children: title || definition.title })) : null, jsx("path", { ...definition.path })] }) }));
|
|
23
|
-
});
|
|
6
|
+
/**
|
|
7
|
+
* The react component for `mezzanine` icon.
|
|
8
|
+
*/
|
|
9
|
+
const Icon = forwardRef(function Icon(props, ref) {
|
|
10
|
+
const { className, color, icon, size, spin = false, style: styleProp, title, ...rest } = props;
|
|
11
|
+
const { definition } = icon;
|
|
12
|
+
const cssVars = toIconCssVars({ color, size });
|
|
13
|
+
const style = {
|
|
14
|
+
'--mzn-icon-cursor': props.onClick || props.onMouseOver ? 'pointer' : 'inherit',
|
|
15
|
+
...cssVars,
|
|
16
|
+
...styleProp,
|
|
17
|
+
};
|
|
18
|
+
return (jsx("i", { ...rest, ref: ref, className: cx(iconClasses.host, {
|
|
19
|
+
[iconClasses.color]: color,
|
|
20
|
+
[iconClasses.spin]: spin,
|
|
21
|
+
[iconClasses.size]: size,
|
|
22
|
+
}, className), "data-icon-name": icon.name, style: style, children: jsxs("svg", { ...definition.svg, focusable: false, children: [title || definition.title ? (jsx("title", { children: title || definition.title })) : null, jsx("path", { ...definition.path })] }) }));
|
|
23
|
+
});
|
|
24
24
|
var Icon$1 = Icon;
|
|
25
25
|
|
|
26
26
|
export { Icon$1 as default };
|
package/Icon/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { IconColor, } from '@mezzanine-ui/core/icon';
|
|
2
|
-
export type { IconProps } from './Icon';
|
|
3
|
-
export { default } from './Icon';
|
|
1
|
+
export type { IconColor, } from '@mezzanine-ui/core/icon';
|
|
2
|
+
export type { IconProps } from './Icon';
|
|
3
|
+
export { default } from './Icon';
|