rsuite 5.73.1 → 5.74.0
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/AutoComplete/styles/index.css +1 -0
- package/CHANGELOG.md +14 -0
- package/CascadeTree/styles/index.css +1 -0
- package/CascadeTree/styles/index.less +2 -0
- package/Cascader/styles/index.css +2 -0
- package/CheckPicker/styles/index.css +1 -0
- package/CheckTree/styles/index.css +1 -0
- package/CheckTreePicker/styles/index.css +1 -0
- package/DatePicker/styles/index.css +1 -0
- package/DateRangePicker/styles/index.css +1 -0
- package/InputNumber/styles/index.css +8 -0
- package/InputNumber/styles/mixin.less +1 -0
- package/InputPicker/styles/index.css +1 -0
- package/MultiCascadeTree/styles/index.css +2 -0
- package/MultiCascader/styles/index.css +2 -0
- package/Pagination/styles/index.css +1 -0
- package/SelectPicker/styles/index.css +1 -0
- package/TagInput/styles/index.css +1 -0
- package/TagPicker/styles/index.css +1 -0
- package/TimePicker/styles/index.css +1 -0
- package/TimeRangePicker/styles/index.css +1 -0
- package/cjs/Accordion/Accordion.js +4 -1
- package/cjs/Affix/Affix.js +15 -12
- package/cjs/Animation/Bounce.js +4 -1
- package/cjs/Animation/Collapse.js +20 -17
- package/cjs/Animation/Fade.js +4 -1
- package/cjs/Animation/Slide.js +4 -1
- package/cjs/AutoComplete/AutoComplete.d.ts +1 -2
- package/cjs/AutoComplete/AutoComplete.js +38 -35
- package/cjs/Avatar/Avatar.js +23 -21
- package/cjs/AvatarGroup/AvatarGroup.js +14 -11
- package/cjs/Badge/Badge.js +14 -11
- package/cjs/Breadcrumb/Breadcrumb.js +21 -20
- package/cjs/Button/Button.js +23 -20
- package/cjs/ButtonGroup/ButtonGroup.js +16 -13
- package/cjs/ButtonToolbar/ButtonToolbar.js +11 -8
- package/cjs/Calendar/Calendar.js +25 -25
- package/cjs/Calendar/CalendarBody.d.ts +1 -1
- package/cjs/Calendar/CalendarBody.js +5 -3
- package/cjs/Calendar/CalendarContainer.d.ts +1 -1
- package/cjs/Calendar/CalendarProvider.d.ts +1 -1
- package/cjs/Calendar/Grid/GridCell.js +8 -4
- package/cjs/Calendar/MonthDropdown/MonthDropdown.js +1 -1
- package/cjs/Calendar/MonthDropdown/MonthDropdownItem.d.ts +1 -1
- package/cjs/Calendar/MonthDropdown/MonthDropdownItem.js +7 -4
- package/cjs/Carousel/Carousel.js +24 -22
- package/cjs/CascadeTree/CascadeTree.d.ts +1 -1
- package/cjs/CascadeTree/CascadeTree.js +33 -30
- package/cjs/CascadeTree/SearchView.js +10 -6
- package/cjs/CascadeTree/TreeView.d.ts +2 -2
- package/cjs/CascadeTree/TreeView.js +8 -7
- package/cjs/CascadeTree/types.d.ts +1 -1
- package/cjs/Cascader/Cascader.js +59 -57
- package/cjs/CheckPicker/CheckPicker.d.ts +1 -1
- package/cjs/CheckPicker/CheckPicker.js +59 -58
- package/cjs/CheckTree/CheckTree.js +28 -25
- package/cjs/CheckTree/CheckTreeNode.js +4 -3
- package/cjs/CheckTree/CheckTreeView.js +15 -11
- package/cjs/CheckTreePicker/CheckTreePicker.js +82 -81
- package/cjs/Checkbox/Checkbox.js +38 -35
- package/cjs/CheckboxGroup/CheckboxGroup.js +19 -16
- package/cjs/Col/Col.js +9 -6
- package/cjs/Container/Container.js +10 -7
- package/cjs/CustomProvider/CustomProvider.d.ts +69 -64
- package/cjs/CustomProvider/CustomProvider.js +9 -7
- package/cjs/CustomProvider/FormattedDate.js +2 -2
- package/cjs/CustomProvider/index.d.ts +2 -0
- package/cjs/CustomProvider/index.js +3 -1
- package/cjs/CustomProvider/types.d.ts +212 -0
- package/cjs/CustomProvider/types.js +4 -0
- package/cjs/CustomProvider/useCustom.d.ts +21 -0
- package/cjs/CustomProvider/useCustom.js +115 -0
- package/cjs/DateInput/DateInput.js +19 -15
- package/cjs/DateInput/hooks/useDateInputState.js +3 -3
- package/cjs/DatePicker/DatePicker.js +73 -72
- package/cjs/DatePicker/PredefinedRanges.d.ts +1 -1
- package/cjs/DatePicker/hooks/useFocus.js +7 -3
- package/cjs/DateRangeInput/DateRangeInput.js +25 -21
- package/cjs/DateRangePicker/Calendar.d.ts +2 -2
- package/cjs/DateRangePicker/DateRangePicker.js +77 -76
- package/cjs/Divider/Divider.js +11 -8
- package/cjs/Drawer/Drawer.js +13 -10
- package/cjs/Dropdown/Dropdown.js +33 -32
- package/cjs/Dropdown/DropdownMenu.d.ts +2 -2
- package/cjs/Dropdown/DropdownMenu.js +21 -20
- package/cjs/FlexboxGrid/FlexboxGrid.js +14 -11
- package/cjs/Form/Form.js +33 -30
- package/cjs/FormControl/FormControl.js +33 -30
- package/cjs/FormControlLabel/FormControlLabel.js +13 -10
- package/cjs/FormErrorMessage/FormErrorMessage.js +12 -9
- package/cjs/FormGroup/FormGroup.js +10 -7
- package/cjs/FormHelpText/FormHelpText.js +14 -11
- package/cjs/Grid/Grid.js +10 -7
- package/cjs/Heading/Heading.js +10 -7
- package/cjs/Highlight/Highlight.js +13 -10
- package/cjs/IconButton/IconButton.d.ts +1 -1
- package/cjs/IconButton/IconButton.js +13 -10
- package/cjs/InlineEdit/InlineEdit.js +18 -15
- package/cjs/Input/Input.js +26 -23
- package/cjs/InputGroup/InputGroup.js +13 -10
- package/cjs/InputNumber/InputNumber.js +35 -32
- package/cjs/InputPicker/InputPicker.js +72 -71
- package/cjs/List/List.d.ts +1 -1
- package/cjs/List/List.js +27 -24
- package/cjs/Loader/Loader.js +17 -14
- package/cjs/MaskedInput/MaskedInput.d.ts +1 -1
- package/cjs/MaskedInput/MaskedInput.js +6 -3
- package/cjs/Message/Message.js +23 -20
- package/cjs/Modal/Modal.js +42 -39
- package/cjs/MultiCascadeTree/MultiCascadeTree.js +37 -34
- package/cjs/MultiCascadeTree/SearchView.d.ts +1 -1
- package/cjs/MultiCascadeTree/SearchView.js +9 -5
- package/cjs/MultiCascadeTree/TreeView.d.ts +1 -1
- package/cjs/MultiCascadeTree/TreeView.js +6 -5
- package/cjs/MultiCascadeTree/types.d.ts +1 -1
- package/cjs/MultiCascader/MultiCascader.d.ts +1 -1
- package/cjs/MultiCascader/MultiCascader.js +64 -63
- package/cjs/Nav/Nav.d.ts +1 -1
- package/cjs/Nav/Nav.js +24 -21
- package/cjs/Nav/NavDropdownMenu.js +5 -4
- package/cjs/Navbar/Navbar.js +11 -8
- package/cjs/Navbar/NavbarDropdownMenu.js +4 -3
- package/cjs/Notification/Notification.js +18 -15
- package/cjs/Pagination/Pagination.d.ts +2 -2
- package/cjs/Pagination/Pagination.js +27 -26
- package/cjs/Pagination/PaginationGroup.d.ts +1 -1
- package/cjs/Pagination/PaginationGroup.js +5 -3
- package/cjs/Panel/AccordionButton.js +2 -2
- package/cjs/Panel/Panel.d.ts +1 -1
- package/cjs/Panel/Panel.js +35 -32
- package/cjs/PanelGroup/PanelGroup.d.ts +1 -1
- package/cjs/PanelGroup/PanelGroup.js +15 -12
- package/cjs/Placeholder/PlaceholderGraph.d.ts +1 -1
- package/cjs/Placeholder/PlaceholderGraph.js +14 -11
- package/cjs/Placeholder/PlaceholderGrid.d.ts +1 -1
- package/cjs/Placeholder/PlaceholderGrid.js +20 -17
- package/cjs/Placeholder/PlaceholderParagraph.d.ts +1 -1
- package/cjs/Placeholder/PlaceholderParagraph.js +19 -16
- package/cjs/Popover/Popover.d.ts +1 -1
- package/cjs/Popover/Popover.js +17 -14
- package/cjs/Progress/ProgressCircle.d.ts +1 -1
- package/cjs/Progress/ProgressCircle.js +27 -24
- package/cjs/Progress/ProgressLine.d.ts +1 -1
- package/cjs/Progress/ProgressLine.js +19 -16
- package/cjs/Radio/Radio.d.ts +1 -1
- package/cjs/Radio/Radio.js +31 -28
- package/cjs/RadioGroup/RadioGroup.d.ts +2 -2
- package/cjs/RadioGroup/RadioGroup.js +21 -18
- package/cjs/RadioTile/RadioTile.d.ts +1 -1
- package/cjs/RadioTile/RadioTile.js +22 -19
- package/cjs/RadioTileGroup/RadioTileGroup.d.ts +2 -2
- package/cjs/RadioTileGroup/RadioTileGroup.js +17 -14
- package/cjs/RangeSlider/RangeSlider.js +43 -40
- package/cjs/Rate/Rate.d.ts +1 -1
- package/cjs/Rate/Rate.js +33 -30
- package/cjs/Row/Row.d.ts +1 -1
- package/cjs/Row/Row.js +12 -9
- package/cjs/SafeAnchor/SafeAnchor.d.ts +1 -1
- package/cjs/SafeAnchor/SafeAnchor.js +9 -6
- package/cjs/SelectPicker/SelectPicker.d.ts +3 -3
- package/cjs/SelectPicker/SelectPicker.js +56 -55
- package/cjs/Sidebar/Sidebar.d.ts +1 -1
- package/cjs/Sidebar/Sidebar.js +13 -10
- package/cjs/Sidenav/ExpandedSidenavDropdownMenu.js +8 -7
- package/cjs/Sidenav/Sidenav.d.ts +1 -1
- package/cjs/Sidenav/Sidenav.js +19 -16
- package/cjs/Sidenav/SidenavDropdownMenu.d.ts +2 -2
- package/cjs/Sidenav/SidenavDropdownMenu.js +7 -6
- package/cjs/Slider/Slider.d.ts +1 -1
- package/cjs/Slider/Slider.js +42 -39
- package/cjs/Stack/Stack.d.ts +1 -1
- package/cjs/Stack/Stack.js +21 -19
- package/cjs/Steps/Steps.d.ts +1 -1
- package/cjs/Steps/Steps.js +17 -14
- package/cjs/Table/Table.d.ts +1 -1
- package/cjs/Table/Table.js +8 -8
- package/cjs/Table/index.d.ts +3 -1
- package/cjs/Tabs/Tabs.d.ts +1 -1
- package/cjs/Tabs/Tabs.js +21 -19
- package/cjs/Tag/Tag.d.ts +4 -1
- package/cjs/Tag/Tag.js +23 -18
- package/cjs/TagInput/index.js +11 -8
- package/cjs/TagPicker/index.js +10 -7
- package/cjs/Text/Text.d.ts +1 -1
- package/cjs/Text/Text.js +17 -14
- package/cjs/TimePicker/TimePicker.js +8 -6
- package/cjs/TimeRangePicker/TimeRangePicker.js +8 -5
- package/cjs/Timeline/Timeline.d.ts +1 -1
- package/cjs/Timeline/Timeline.js +15 -12
- package/cjs/Toggle/Toggle.d.ts +2 -2
- package/cjs/Toggle/Toggle.js +26 -25
- package/cjs/Tooltip/Tooltip.d.ts +1 -1
- package/cjs/Tooltip/Tooltip.js +14 -11
- package/cjs/Tree/Tree.d.ts +1 -1
- package/cjs/Tree/Tree.js +28 -25
- package/cjs/Tree/TreeNode.js +3 -2
- package/cjs/Tree/TreeNodeToggle.js +3 -2
- package/cjs/Tree/TreeView.js +14 -10
- package/cjs/Tree/hooks/useFocusTree.js +3 -2
- package/cjs/TreePicker/TreePicker.d.ts +1 -1
- package/cjs/TreePicker/TreePicker.js +89 -88
- package/cjs/Uploader/UploadFileItem.d.ts +3 -3
- package/cjs/Uploader/UploadFileItem.js +2 -2
- package/cjs/Uploader/UploadTrigger.d.ts +1 -1
- package/cjs/Uploader/UploadTrigger.js +1 -1
- package/cjs/Uploader/Uploader.d.ts +3 -3
- package/cjs/Uploader/Uploader.js +60 -59
- package/cjs/Whisper/Whisper.js +13 -13
- package/cjs/internals/CloseButton/CloseButton.js +6 -3
- package/cjs/internals/Menu/Menu.js +3 -2
- package/cjs/internals/Menu/Menubar.js +3 -3
- package/cjs/internals/Overlay/OverlayTrigger.d.ts +2 -2
- package/cjs/internals/Overlay/OverlayTrigger.js +4 -4
- package/cjs/internals/Picker/PickerIndicator.js +9 -5
- package/cjs/internals/Picker/PickerToggleTrigger.d.ts +1 -1
- package/cjs/internals/Picker/PickerToggleTrigger.js +2 -1
- package/cjs/internals/Picker/SelectedElement.d.ts +1 -1
- package/cjs/internals/Plaintext/Plaintext.js +4 -3
- package/cjs/internals/Ripple/Ripple.d.ts +1 -1
- package/cjs/internals/Ripple/Ripple.js +3 -2
- package/cjs/internals/Windowing/List.d.ts +1 -1
- package/cjs/internals/Windowing/List.js +3 -3
- package/cjs/internals/hooks/index.d.ts +0 -1
- package/cjs/internals/hooks/index.js +1 -3
- package/cjs/internals/hooks/useToggleCaret.js +10 -10
- package/cjs/internals/utils/createComponent.js +10 -7
- package/cjs/internals/utils/date/types.d.ts +53 -0
- package/cjs/locales/ar_EG.d.ts +34 -1
- package/cjs/locales/ar_EG.js +16 -12
- package/cjs/locales/ca_ES.d.ts +38 -1
- package/cjs/locales/ca_ES.js +16 -12
- package/cjs/locales/cs_CZ.d.ts +38 -1
- package/cjs/locales/cs_CZ.js +16 -12
- package/cjs/locales/da_DK.d.ts +38 -1
- package/cjs/locales/da_DK.js +16 -12
- package/cjs/locales/de_DE.d.ts +38 -1
- package/cjs/locales/de_DE.js +16 -12
- package/cjs/locales/en_GB.d.ts +38 -1
- package/cjs/locales/en_GB.js +16 -12
- package/cjs/locales/en_US.d.ts +34 -1
- package/cjs/locales/en_US.js +16 -12
- package/cjs/locales/es_AR.d.ts +38 -1
- package/cjs/locales/es_AR.js +16 -12
- package/cjs/locales/es_ES.d.ts +38 -1
- package/cjs/locales/es_ES.js +16 -12
- package/cjs/locales/fa_IR.d.ts +34 -1
- package/cjs/locales/fa_IR.js +16 -12
- package/cjs/locales/fi_FI.d.ts +38 -5
- package/cjs/locales/fi_FI.js +16 -16
- package/cjs/locales/fr_FR.d.ts +34 -1
- package/cjs/locales/fr_FR.js +16 -12
- package/cjs/locales/hu_HU.d.ts +38 -1
- package/cjs/locales/hu_HU.js +16 -12
- package/cjs/locales/index.d.ts +1 -1
- package/cjs/locales/it_IT.d.ts +38 -1
- package/cjs/locales/it_IT.js +16 -12
- package/cjs/locales/ja_JP.d.ts +38 -1
- package/cjs/locales/ja_JP.js +16 -12
- package/cjs/locales/kk_KZ.d.ts +34 -1
- package/cjs/locales/kk_KZ.js +16 -12
- package/cjs/locales/ko_KR.d.ts +38 -1
- package/cjs/locales/ko_KR.js +16 -12
- package/cjs/locales/ne_NP.d.ts +38 -1
- package/cjs/locales/ne_NP.js +16 -12
- package/cjs/locales/nl_NL.d.ts +34 -1
- package/cjs/locales/nl_NL.js +16 -12
- package/cjs/locales/pt_BR.d.ts +34 -1
- package/cjs/locales/pt_BR.js +16 -12
- package/cjs/locales/ru_RU.d.ts +34 -1
- package/cjs/locales/ru_RU.js +16 -12
- package/cjs/locales/sv_SE.d.ts +38 -1
- package/cjs/locales/sv_SE.js +16 -12
- package/cjs/locales/tr_TR.d.ts +34 -1
- package/cjs/locales/tr_TR.js +16 -12
- package/cjs/locales/zh_CN.d.ts +34 -1
- package/cjs/locales/zh_CN.js +16 -12
- package/cjs/locales/zh_TW.d.ts +34 -1
- package/cjs/locales/zh_TW.js +16 -12
- package/cjs/useToaster/useToaster.js +3 -3
- package/dist/rsuite-no-reset-rtl.css +10 -0
- package/dist/rsuite-no-reset-rtl.min.css +1 -1
- package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
- package/dist/rsuite-no-reset.css +10 -0
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +10 -0
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +10 -0
- package/dist/rsuite.js +492 -526
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/Accordion/Accordion.js +4 -1
- package/esm/Affix/Affix.js +15 -12
- package/esm/Animation/Bounce.js +4 -1
- package/esm/Animation/Collapse.js +20 -17
- package/esm/Animation/Fade.js +4 -1
- package/esm/Animation/Slide.js +4 -1
- package/esm/AutoComplete/AutoComplete.d.ts +1 -2
- package/esm/AutoComplete/AutoComplete.js +38 -35
- package/esm/Avatar/Avatar.js +24 -22
- package/esm/AvatarGroup/AvatarGroup.js +14 -11
- package/esm/Badge/Badge.js +14 -11
- package/esm/Breadcrumb/Breadcrumb.js +22 -21
- package/esm/Button/Button.js +23 -20
- package/esm/ButtonGroup/ButtonGroup.js +16 -13
- package/esm/ButtonToolbar/ButtonToolbar.js +11 -8
- package/esm/Calendar/Calendar.js +27 -26
- package/esm/Calendar/CalendarBody.d.ts +1 -1
- package/esm/Calendar/CalendarBody.js +6 -4
- package/esm/Calendar/CalendarContainer.d.ts +1 -1
- package/esm/Calendar/CalendarProvider.d.ts +1 -1
- package/esm/Calendar/Grid/GridCell.js +9 -5
- package/esm/Calendar/MonthDropdown/MonthDropdown.js +1 -1
- package/esm/Calendar/MonthDropdown/MonthDropdownItem.d.ts +1 -1
- package/esm/Calendar/MonthDropdown/MonthDropdownItem.js +7 -4
- package/esm/Carousel/Carousel.js +25 -23
- package/esm/CascadeTree/CascadeTree.d.ts +1 -1
- package/esm/CascadeTree/CascadeTree.js +33 -30
- package/esm/CascadeTree/SearchView.js +10 -6
- package/esm/CascadeTree/TreeView.d.ts +2 -2
- package/esm/CascadeTree/TreeView.js +8 -7
- package/esm/CascadeTree/types.d.ts +1 -1
- package/esm/Cascader/Cascader.js +60 -58
- package/esm/CheckPicker/CheckPicker.d.ts +1 -1
- package/esm/CheckPicker/CheckPicker.js +60 -59
- package/esm/CheckTree/CheckTree.js +28 -25
- package/esm/CheckTree/CheckTreeNode.js +4 -3
- package/esm/CheckTree/CheckTreeView.js +15 -11
- package/esm/CheckTreePicker/CheckTreePicker.js +83 -82
- package/esm/Checkbox/Checkbox.js +38 -35
- package/esm/CheckboxGroup/CheckboxGroup.js +19 -16
- package/esm/Col/Col.js +9 -6
- package/esm/Container/Container.js +10 -7
- package/esm/CustomProvider/CustomProvider.d.ts +69 -64
- package/esm/CustomProvider/CustomProvider.js +8 -8
- package/esm/CustomProvider/FormattedDate.js +1 -1
- package/esm/CustomProvider/index.d.ts +2 -0
- package/esm/CustomProvider/index.js +1 -0
- package/esm/CustomProvider/types.d.ts +212 -0
- package/esm/CustomProvider/types.js +2 -0
- package/esm/CustomProvider/useCustom.d.ts +21 -0
- package/esm/CustomProvider/useCustom.js +109 -0
- package/esm/DateInput/DateInput.js +20 -16
- package/esm/DateInput/hooks/useDateInputState.js +2 -2
- package/esm/DatePicker/DatePicker.js +74 -73
- package/esm/DatePicker/PredefinedRanges.d.ts +1 -1
- package/esm/DatePicker/hooks/useFocus.js +8 -4
- package/esm/DateRangeInput/DateRangeInput.js +26 -22
- package/esm/DateRangePicker/Calendar.d.ts +2 -2
- package/esm/DateRangePicker/DateRangePicker.js +77 -76
- package/esm/Divider/Divider.js +11 -8
- package/esm/Drawer/Drawer.js +13 -10
- package/esm/Dropdown/Dropdown.js +33 -32
- package/esm/Dropdown/DropdownMenu.d.ts +2 -2
- package/esm/Dropdown/DropdownMenu.js +6 -5
- package/esm/FlexboxGrid/FlexboxGrid.js +14 -11
- package/esm/Form/Form.js +33 -30
- package/esm/FormControl/FormControl.js +34 -31
- package/esm/FormControlLabel/FormControlLabel.js +13 -10
- package/esm/FormErrorMessage/FormErrorMessage.js +12 -9
- package/esm/FormGroup/FormGroup.js +10 -7
- package/esm/FormHelpText/FormHelpText.js +14 -11
- package/esm/Grid/Grid.js +10 -7
- package/esm/Heading/Heading.js +10 -7
- package/esm/Highlight/Highlight.js +13 -10
- package/esm/IconButton/IconButton.d.ts +1 -1
- package/esm/IconButton/IconButton.js +13 -10
- package/esm/InlineEdit/InlineEdit.js +18 -15
- package/esm/Input/Input.js +26 -23
- package/esm/InputGroup/InputGroup.js +13 -10
- package/esm/InputNumber/InputNumber.js +35 -32
- package/esm/InputPicker/InputPicker.js +73 -72
- package/esm/List/List.d.ts +1 -1
- package/esm/List/List.js +27 -24
- package/esm/Loader/Loader.js +17 -14
- package/esm/MaskedInput/MaskedInput.d.ts +1 -1
- package/esm/MaskedInput/MaskedInput.js +6 -3
- package/esm/Message/Message.js +23 -20
- package/esm/Modal/Modal.js +42 -39
- package/esm/MultiCascadeTree/MultiCascadeTree.js +37 -34
- package/esm/MultiCascadeTree/SearchView.d.ts +1 -1
- package/esm/MultiCascadeTree/SearchView.js +9 -5
- package/esm/MultiCascadeTree/TreeView.d.ts +1 -1
- package/esm/MultiCascadeTree/TreeView.js +6 -5
- package/esm/MultiCascadeTree/types.d.ts +1 -1
- package/esm/MultiCascader/MultiCascader.d.ts +1 -1
- package/esm/MultiCascader/MultiCascader.js +66 -65
- package/esm/Nav/Nav.d.ts +1 -1
- package/esm/Nav/Nav.js +24 -21
- package/esm/Nav/NavDropdownMenu.js +5 -4
- package/esm/Navbar/Navbar.js +11 -8
- package/esm/Navbar/NavbarDropdownMenu.js +5 -4
- package/esm/Notification/Notification.js +18 -15
- package/esm/Pagination/Pagination.d.ts +2 -2
- package/esm/Pagination/Pagination.js +28 -27
- package/esm/Pagination/PaginationGroup.d.ts +1 -1
- package/esm/Pagination/PaginationGroup.js +6 -4
- package/esm/Panel/AccordionButton.js +2 -2
- package/esm/Panel/Panel.d.ts +1 -1
- package/esm/Panel/Panel.js +35 -32
- package/esm/PanelGroup/PanelGroup.d.ts +1 -1
- package/esm/PanelGroup/PanelGroup.js +15 -12
- package/esm/Placeholder/PlaceholderGraph.d.ts +1 -1
- package/esm/Placeholder/PlaceholderGraph.js +14 -11
- package/esm/Placeholder/PlaceholderGrid.d.ts +1 -1
- package/esm/Placeholder/PlaceholderGrid.js +20 -17
- package/esm/Placeholder/PlaceholderParagraph.d.ts +1 -1
- package/esm/Placeholder/PlaceholderParagraph.js +19 -16
- package/esm/Popover/Popover.d.ts +1 -1
- package/esm/Popover/Popover.js +17 -14
- package/esm/Progress/ProgressCircle.d.ts +1 -1
- package/esm/Progress/ProgressCircle.js +27 -24
- package/esm/Progress/ProgressLine.d.ts +1 -1
- package/esm/Progress/ProgressLine.js +19 -16
- package/esm/Radio/Radio.d.ts +1 -1
- package/esm/Radio/Radio.js +31 -28
- package/esm/RadioGroup/RadioGroup.d.ts +2 -2
- package/esm/RadioGroup/RadioGroup.js +21 -18
- package/esm/RadioTile/RadioTile.d.ts +1 -1
- package/esm/RadioTile/RadioTile.js +22 -19
- package/esm/RadioTileGroup/RadioTileGroup.d.ts +2 -2
- package/esm/RadioTileGroup/RadioTileGroup.js +17 -14
- package/esm/RangeSlider/RangeSlider.js +43 -40
- package/esm/Rate/Rate.d.ts +1 -1
- package/esm/Rate/Rate.js +33 -30
- package/esm/Row/Row.d.ts +1 -1
- package/esm/Row/Row.js +12 -9
- package/esm/SafeAnchor/SafeAnchor.d.ts +1 -1
- package/esm/SafeAnchor/SafeAnchor.js +9 -6
- package/esm/SelectPicker/SelectPicker.d.ts +3 -3
- package/esm/SelectPicker/SelectPicker.js +57 -56
- package/esm/Sidebar/Sidebar.d.ts +1 -1
- package/esm/Sidebar/Sidebar.js +13 -10
- package/esm/Sidenav/ExpandedSidenavDropdownMenu.js +8 -7
- package/esm/Sidenav/Sidenav.d.ts +1 -1
- package/esm/Sidenav/Sidenav.js +19 -16
- package/esm/Sidenav/SidenavDropdownMenu.d.ts +2 -2
- package/esm/Sidenav/SidenavDropdownMenu.js +7 -6
- package/esm/Slider/Slider.d.ts +1 -1
- package/esm/Slider/Slider.js +43 -40
- package/esm/Stack/Stack.d.ts +1 -1
- package/esm/Stack/Stack.js +22 -20
- package/esm/Steps/Steps.d.ts +1 -1
- package/esm/Steps/Steps.js +17 -14
- package/esm/Table/Table.d.ts +1 -1
- package/esm/Table/Table.js +8 -8
- package/esm/Table/index.d.ts +3 -1
- package/esm/Tabs/Tabs.d.ts +1 -1
- package/esm/Tabs/Tabs.js +21 -19
- package/esm/Tag/Tag.d.ts +4 -1
- package/esm/Tag/Tag.js +23 -18
- package/esm/TagInput/index.js +11 -8
- package/esm/TagPicker/index.js +10 -7
- package/esm/Text/Text.d.ts +1 -1
- package/esm/Text/Text.js +17 -14
- package/esm/TimePicker/TimePicker.js +8 -6
- package/esm/TimeRangePicker/TimeRangePicker.js +8 -5
- package/esm/Timeline/Timeline.d.ts +1 -1
- package/esm/Timeline/Timeline.js +15 -12
- package/esm/Toggle/Toggle.d.ts +2 -2
- package/esm/Toggle/Toggle.js +27 -26
- package/esm/Tooltip/Tooltip.d.ts +1 -1
- package/esm/Tooltip/Tooltip.js +14 -11
- package/esm/Tree/Tree.d.ts +1 -1
- package/esm/Tree/Tree.js +28 -25
- package/esm/Tree/TreeNode.js +3 -2
- package/esm/Tree/TreeNodeToggle.js +3 -2
- package/esm/Tree/TreeView.js +14 -10
- package/esm/Tree/hooks/useFocusTree.js +3 -2
- package/esm/TreePicker/TreePicker.d.ts +1 -1
- package/esm/TreePicker/TreePicker.js +89 -88
- package/esm/Uploader/UploadFileItem.d.ts +3 -3
- package/esm/Uploader/UploadFileItem.js +2 -2
- package/esm/Uploader/UploadTrigger.d.ts +1 -1
- package/esm/Uploader/UploadTrigger.js +1 -1
- package/esm/Uploader/Uploader.d.ts +3 -3
- package/esm/Uploader/Uploader.js +61 -60
- package/esm/Whisper/Whisper.js +14 -12
- package/esm/internals/CloseButton/CloseButton.js +7 -4
- package/esm/internals/Menu/Menu.js +4 -3
- package/esm/internals/Menu/Menubar.js +3 -3
- package/esm/internals/Overlay/OverlayTrigger.d.ts +2 -2
- package/esm/internals/Overlay/OverlayTrigger.js +4 -4
- package/esm/internals/Picker/PickerIndicator.js +8 -4
- package/esm/internals/Picker/PickerToggleTrigger.d.ts +1 -1
- package/esm/internals/Picker/PickerToggleTrigger.js +2 -1
- package/esm/internals/Picker/SelectedElement.d.ts +1 -1
- package/esm/internals/Plaintext/Plaintext.js +5 -4
- package/esm/internals/Ripple/Ripple.d.ts +1 -1
- package/esm/internals/Ripple/Ripple.js +2 -1
- package/esm/internals/Windowing/List.d.ts +1 -1
- package/esm/internals/Windowing/List.js +2 -2
- package/esm/internals/hooks/index.d.ts +0 -1
- package/esm/internals/hooks/index.js +0 -1
- package/esm/internals/hooks/useToggleCaret.js +10 -10
- package/esm/internals/utils/createComponent.js +10 -7
- package/esm/internals/utils/date/types.d.ts +53 -0
- package/esm/locales/ar_EG.d.ts +34 -1
- package/esm/locales/ar_EG.js +16 -12
- package/esm/locales/ca_ES.d.ts +38 -1
- package/esm/locales/ca_ES.js +16 -12
- package/esm/locales/cs_CZ.d.ts +38 -1
- package/esm/locales/cs_CZ.js +16 -12
- package/esm/locales/da_DK.d.ts +38 -1
- package/esm/locales/da_DK.js +16 -12
- package/esm/locales/de_DE.d.ts +38 -1
- package/esm/locales/de_DE.js +16 -12
- package/esm/locales/en_GB.d.ts +38 -1
- package/esm/locales/en_GB.js +16 -12
- package/esm/locales/en_US.d.ts +34 -1
- package/esm/locales/en_US.js +16 -12
- package/esm/locales/es_AR.d.ts +38 -1
- package/esm/locales/es_AR.js +16 -12
- package/esm/locales/es_ES.d.ts +38 -1
- package/esm/locales/es_ES.js +16 -12
- package/esm/locales/fa_IR.d.ts +34 -1
- package/esm/locales/fa_IR.js +16 -12
- package/esm/locales/fi_FI.d.ts +38 -5
- package/esm/locales/fi_FI.js +16 -16
- package/esm/locales/fr_FR.d.ts +34 -1
- package/esm/locales/fr_FR.js +16 -12
- package/esm/locales/hu_HU.d.ts +38 -1
- package/esm/locales/hu_HU.js +16 -12
- package/esm/locales/index.d.ts +1 -1
- package/esm/locales/it_IT.d.ts +38 -1
- package/esm/locales/it_IT.js +16 -12
- package/esm/locales/ja_JP.d.ts +38 -1
- package/esm/locales/ja_JP.js +16 -12
- package/esm/locales/kk_KZ.d.ts +34 -1
- package/esm/locales/kk_KZ.js +16 -12
- package/esm/locales/ko_KR.d.ts +38 -1
- package/esm/locales/ko_KR.js +16 -12
- package/esm/locales/ne_NP.d.ts +38 -1
- package/esm/locales/ne_NP.js +16 -12
- package/esm/locales/nl_NL.d.ts +34 -1
- package/esm/locales/nl_NL.js +16 -12
- package/esm/locales/pt_BR.d.ts +34 -1
- package/esm/locales/pt_BR.js +16 -12
- package/esm/locales/ru_RU.d.ts +34 -1
- package/esm/locales/ru_RU.js +16 -12
- package/esm/locales/sv_SE.d.ts +38 -1
- package/esm/locales/sv_SE.js +16 -12
- package/esm/locales/tr_TR.d.ts +34 -1
- package/esm/locales/tr_TR.js +16 -12
- package/esm/locales/zh_CN.d.ts +34 -1
- package/esm/locales/zh_CN.js +16 -12
- package/esm/locales/zh_TW.d.ts +34 -1
- package/esm/locales/zh_TW.js +16 -12
- package/esm/useToaster/useToaster.js +4 -4
- package/internals/Picker/styles/index.less +1 -0
- package/package.json +3 -2
- package/cjs/internals/hooks/useCustom.d.ts +0 -7
- package/cjs/internals/hooks/useCustom.js +0 -80
- package/esm/internals/hooks/useCustom.d.ts +0 -7
- package/esm/internals/hooks/useCustom.js +0 -74
|
@@ -1,60 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Locale } from '../locales';
|
|
3
3
|
import { ToastContainerInstance } from '../toaster/ToastContainer';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
export interface
|
|
7
|
-
/**
|
|
8
|
-
* The locale object that contains the language and formatting rules for the date.
|
|
9
|
-
*/
|
|
10
|
-
locale?: DateFnsLocale;
|
|
11
|
-
/**
|
|
12
|
-
* Defines which day of the week should be considered the start of the week.
|
|
13
|
-
*
|
|
14
|
-
* The value should be an integer from 0 to 6, where:
|
|
15
|
-
* - `0` represents Sunday,
|
|
16
|
-
* - `1` represents Monday,
|
|
17
|
-
* - `2` represents Tuesday,
|
|
18
|
-
* - `3` represents Wednesday,
|
|
19
|
-
* - `4` represents Thursday,
|
|
20
|
-
* - `5` represents Friday,
|
|
21
|
-
* - `6` represents Saturday.
|
|
22
|
-
*
|
|
23
|
-
* This option is important for functions that operate on weeks, such as calculating
|
|
24
|
-
* the start or end of a week, determining which week a date falls in, or generating
|
|
25
|
-
* calendar views. The default value varies depending on the locale, with Monday (`1`)
|
|
26
|
-
* being the default in most regions following ISO 8601, while Sunday (`0`) is often
|
|
27
|
-
* the default in regions like the United States.
|
|
28
|
-
*/
|
|
29
|
-
weekStartsOn?: DateFns.Day;
|
|
30
|
-
/**
|
|
31
|
-
* `firstWeekContainsDate` is used to determine which week is considered the first week of the year.
|
|
32
|
-
*
|
|
33
|
-
* This option specifies the minimum day of January that must be included in the first week.
|
|
34
|
-
*
|
|
35
|
-
* The value can be set to:
|
|
36
|
-
* - `1`: The first week of the year must include January 1st.
|
|
37
|
-
* - `4`: The first week of the year must include January 4th, which is the default according to ISO 8601.
|
|
38
|
-
*
|
|
39
|
-
* The choice between `1` and `4` typically depends on the regional or business conventions for week numbering.
|
|
40
|
-
*
|
|
41
|
-
* Please note that this option only accepts `1` (Sunday) or `4` (Thursday), aligning with common international standards.
|
|
42
|
-
*
|
|
43
|
-
* For more detailed information, please refer to https://en.wikipedia.org/wiki/Week#Week_numbering.
|
|
44
|
-
*/
|
|
45
|
-
firstWeekContainsDate?: DateFns.FirstWeekContainsDate;
|
|
46
|
-
/**
|
|
47
|
-
* If true, allows usage of the week-numbering year tokens `YY` and `YYYY`.
|
|
48
|
-
* See: https://date-fns.org/docs/Unicode-Tokens
|
|
49
|
-
**/
|
|
50
|
-
useAdditionalWeekYearTokens?: boolean;
|
|
4
|
+
import type { FormatDateOptions } from '../internals/utils/date/types';
|
|
5
|
+
import type { ReactSuiteComponents } from './types';
|
|
6
|
+
export interface CustomValue<T = Locale> {
|
|
51
7
|
/**
|
|
52
|
-
*
|
|
53
|
-
* See: https://date-fns.org/docs/Unicode-Tokens
|
|
8
|
+
* The prefix of the component CSS class
|
|
54
9
|
*/
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
export interface CustomValue<T = Locale> {
|
|
10
|
+
classPrefix?: string;
|
|
58
11
|
/**
|
|
59
12
|
* The locale object that contains the language and formatting rules for the date.
|
|
60
13
|
*/
|
|
@@ -106,10 +59,6 @@ export interface CustomProviderProps<T = Locale> extends Partial<CustomValue<T>>
|
|
|
106
59
|
* Supported themes
|
|
107
60
|
*/
|
|
108
61
|
theme?: 'light' | 'dark' | 'high-contrast';
|
|
109
|
-
/**
|
|
110
|
-
* The prefix of the component CSS class
|
|
111
|
-
*/
|
|
112
|
-
classPrefix?: string;
|
|
113
62
|
/**
|
|
114
63
|
* The prefix of the icon CSS class
|
|
115
64
|
*/
|
|
@@ -134,8 +83,25 @@ export interface CustomProviderProps<T = Locale> extends Partial<CustomValue<T>>
|
|
|
134
83
|
* @default false
|
|
135
84
|
*/
|
|
136
85
|
disableInlineStyles?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* components allows setting default props for specific components globally.
|
|
88
|
+
* It accepts an object where each key represents a component name (e.g., 'Button', 'Input'),
|
|
89
|
+
* and the corresponding value is an object containing the `defaultProps` object.
|
|
90
|
+
* The `defaultProps` object defines the default props for that component.
|
|
91
|
+
* These props will be automatically applied to the component unless overridden by specific props
|
|
92
|
+
* passed in an individual component instance.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```js
|
|
96
|
+
* components={{
|
|
97
|
+
* Button: { defaultProps: { appearance: 'primary', size: 'lg' } },
|
|
98
|
+
* Input: { defaultProps: { placeholder: 'Enter text', size: 'lg' } }
|
|
99
|
+
* }}
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
components?: Partial<ReactSuiteComponents>;
|
|
137
103
|
}
|
|
138
|
-
declare const CustomContext: React.Context<CustomProviderProps<{
|
|
104
|
+
export declare const CustomContext: React.Context<CustomProviderProps<{
|
|
139
105
|
code?: string | undefined;
|
|
140
106
|
common?: {
|
|
141
107
|
loading: string;
|
|
@@ -158,6 +124,29 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
158
124
|
total: string;
|
|
159
125
|
skip: string;
|
|
160
126
|
} | undefined;
|
|
127
|
+
DateTimeFormats?: {
|
|
128
|
+
sunday: string;
|
|
129
|
+
monday: string;
|
|
130
|
+
tuesday: string;
|
|
131
|
+
wednesday: string;
|
|
132
|
+
thursday: string;
|
|
133
|
+
friday: string;
|
|
134
|
+
saturday: string;
|
|
135
|
+
ok: string;
|
|
136
|
+
today: string;
|
|
137
|
+
yesterday: string;
|
|
138
|
+
now: string;
|
|
139
|
+
hours: string;
|
|
140
|
+
minutes: string;
|
|
141
|
+
seconds: string;
|
|
142
|
+
formattedMonthPattern: string;
|
|
143
|
+
formattedDayPattern: string;
|
|
144
|
+
shortDateFormat: string;
|
|
145
|
+
shortTimeFormat: string; /**
|
|
146
|
+
* The prefix of the component CSS class
|
|
147
|
+
*/
|
|
148
|
+
dateLocale: any;
|
|
149
|
+
} | undefined;
|
|
161
150
|
Calendar?: {
|
|
162
151
|
sunday: string;
|
|
163
152
|
monday: string;
|
|
@@ -176,7 +165,9 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
176
165
|
formattedMonthPattern: string;
|
|
177
166
|
formattedDayPattern: string;
|
|
178
167
|
shortDateFormat: string;
|
|
179
|
-
shortTimeFormat: string;
|
|
168
|
+
shortTimeFormat: string; /**
|
|
169
|
+
* The prefix of the component CSS class
|
|
170
|
+
*/
|
|
180
171
|
dateLocale: any;
|
|
181
172
|
} | undefined;
|
|
182
173
|
DatePicker?: {
|
|
@@ -197,7 +188,9 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
197
188
|
formattedMonthPattern: string;
|
|
198
189
|
formattedDayPattern: string;
|
|
199
190
|
shortDateFormat: string;
|
|
200
|
-
shortTimeFormat: string;
|
|
191
|
+
shortTimeFormat: string; /**
|
|
192
|
+
* The prefix of the component CSS class
|
|
193
|
+
*/
|
|
201
194
|
dateLocale: any;
|
|
202
195
|
} | undefined;
|
|
203
196
|
DateRangePicker?: {
|
|
@@ -219,10 +212,12 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
219
212
|
formattedMonthPattern: string;
|
|
220
213
|
formattedDayPattern: string;
|
|
221
214
|
shortDateFormat: string;
|
|
222
|
-
shortTimeFormat: string;
|
|
215
|
+
shortTimeFormat: string; /**
|
|
216
|
+
* The prefix of the component CSS class
|
|
217
|
+
*/
|
|
223
218
|
dateLocale: any;
|
|
224
219
|
} | undefined;
|
|
225
|
-
|
|
220
|
+
Combobox?: {
|
|
226
221
|
noResultsText: string;
|
|
227
222
|
placeholder: string;
|
|
228
223
|
searchPlaceholder: string;
|
|
@@ -231,6 +226,18 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
231
226
|
InputPicker?: {
|
|
232
227
|
newItem: string;
|
|
233
228
|
createOption: string;
|
|
229
|
+
noResultsText: string;
|
|
230
|
+
placeholder: string;
|
|
231
|
+
searchPlaceholder: string;
|
|
232
|
+
checkAll: string;
|
|
233
|
+
} | undefined;
|
|
234
|
+
TagPicker?: {
|
|
235
|
+
newItem: string;
|
|
236
|
+
createOption: string;
|
|
237
|
+
noResultsText: string;
|
|
238
|
+
placeholder: string;
|
|
239
|
+
searchPlaceholder: string;
|
|
240
|
+
checkAll: string;
|
|
234
241
|
} | undefined;
|
|
235
242
|
Uploader?: {
|
|
236
243
|
inited: string;
|
|
@@ -257,6 +264,4 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
257
264
|
*
|
|
258
265
|
* @see https://rsuitejs.com/components/custom-provider
|
|
259
266
|
*/
|
|
260
|
-
|
|
261
|
-
export { CustomContext };
|
|
262
|
-
export default CustomProvider;
|
|
267
|
+
export default function CustomProvider(props: Omit<CustomProviderProps, 'toasters'>): React.JSX.Element;
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
5
|
exports.__esModule = true;
|
|
6
|
-
exports.
|
|
6
|
+
exports.CustomContext = void 0;
|
|
7
|
+
exports.default = CustomProvider;
|
|
7
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
9
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -12,7 +13,7 @@ var _hooks = require("../internals/hooks");
|
|
|
12
13
|
var _prefix = require("../internals/utils/prefix");
|
|
13
14
|
var _DOMHelper = require("../DOMHelper");
|
|
14
15
|
var _ToastContainer = _interopRequireWildcard(require("../toaster/ToastContainer"));
|
|
15
|
-
var _excluded = ["children", "classPrefix", "iconClassPrefix", "theme", "toastContainer", "disableRipple", "csp", "disableInlineStyles"];
|
|
16
|
+
var _excluded = ["children", "classPrefix", "components", "iconClassPrefix", "theme", "toastContainer", "disableRipple", "csp", "disableInlineStyles"];
|
|
16
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
19
|
var CustomContext = exports.CustomContext = /*#__PURE__*/_react.default.createContext({});
|
|
@@ -23,10 +24,11 @@ var themes = ['light', 'dark', 'high-contrast'];
|
|
|
23
24
|
*
|
|
24
25
|
* @see https://rsuitejs.com/components/custom-provider
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
+
function CustomProvider(props) {
|
|
27
28
|
var children = props.children,
|
|
28
29
|
_props$classPrefix = props.classPrefix,
|
|
29
30
|
classPrefix = _props$classPrefix === void 0 ? (0, _prefix.getClassNamePrefix)() : _props$classPrefix,
|
|
31
|
+
components = props.components,
|
|
30
32
|
_props$iconClassPrefi = props.iconClassPrefix,
|
|
31
33
|
iconClassPrefix = _props$iconClassPrefi === void 0 ? classPrefix : _props$iconClassPrefi,
|
|
32
34
|
theme = props.theme,
|
|
@@ -46,9 +48,10 @@ var CustomProvider = function CustomProvider(props) {
|
|
|
46
48
|
classPrefix: classPrefix,
|
|
47
49
|
theme: theme,
|
|
48
50
|
toasters: toasters,
|
|
49
|
-
disableRipple: disableRipple
|
|
51
|
+
disableRipple: disableRipple,
|
|
52
|
+
components: components
|
|
50
53
|
}, rest);
|
|
51
|
-
}, [classPrefix, theme, disableRipple, rest]);
|
|
54
|
+
}, [classPrefix, theme, disableRipple, components, rest]);
|
|
52
55
|
var iconContext = (0, _react.useMemo)(function () {
|
|
53
56
|
return {
|
|
54
57
|
classPrefix: iconClassPrefix,
|
|
@@ -83,5 +86,4 @@ var CustomProvider = function CustomProvider(props) {
|
|
|
83
86
|
}
|
|
84
87
|
});
|
|
85
88
|
})))));
|
|
86
|
-
}
|
|
87
|
-
var _default = exports.default = CustomProvider;
|
|
89
|
+
}
|
|
@@ -5,11 +5,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
exports.__esModule = true;
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var
|
|
8
|
+
var _useCustom2 = require("./useCustom");
|
|
9
9
|
function FormattedDate(_ref) {
|
|
10
10
|
var date = _ref.date,
|
|
11
11
|
formatStr = _ref.formatStr;
|
|
12
|
-
var _useCustom = (0,
|
|
12
|
+
var _useCustom = (0, _useCustom2.useCustom)('Calendar'),
|
|
13
13
|
formatDate = _useCustom.formatDate;
|
|
14
14
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, formatDate(date, formatStr));
|
|
15
15
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import CustomProvider, { CustomContext } from './CustomProvider';
|
|
2
2
|
import FormattedDate from './FormattedDate';
|
|
3
3
|
export { CustomContext, FormattedDate };
|
|
4
|
+
export { useCustom } from './useCustom';
|
|
4
5
|
export type { CustomProviderProps } from './CustomProvider';
|
|
6
|
+
export type { ReactSuiteComponents } from './types';
|
|
5
7
|
export default CustomProvider;
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
5
|
exports.__esModule = true;
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.useCustom = exports.default = void 0;
|
|
7
7
|
var _CustomProvider = _interopRequireWildcard(require("./CustomProvider"));
|
|
8
8
|
exports.CustomContext = _CustomProvider.CustomContext;
|
|
9
9
|
var _FormattedDate = _interopRequireDefault(require("./FormattedDate"));
|
|
10
10
|
exports.FormattedDate = _FormattedDate.default;
|
|
11
|
+
var _useCustom = require("./useCustom");
|
|
12
|
+
exports.useCustom = _useCustom.useCustom;
|
|
11
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
12
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
15
|
var _default = exports.default = _CustomProvider.default;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import type { AccordionProps } from '../Accordion';
|
|
2
|
+
import type { AffixProps } from '../Affix';
|
|
3
|
+
import type { BounceProps } from '../Animation/Bounce';
|
|
4
|
+
import type { CollapseProps } from '../Animation/Collapse';
|
|
5
|
+
import type { FadeProps } from '../Animation/Fade';
|
|
6
|
+
import type { SlideProps } from '../Animation/Slide';
|
|
7
|
+
import type { TransitionProps } from '../Animation/Transition';
|
|
8
|
+
import type { AutoCompleteProps } from '../AutoComplete';
|
|
9
|
+
import type { AvatarProps } from '../Avatar';
|
|
10
|
+
import type { AvatarGroupProps } from '../AvatarGroup';
|
|
11
|
+
import type { BadgeProps } from '../Badge';
|
|
12
|
+
import type { BreadcrumbProps } from '../Breadcrumb';
|
|
13
|
+
import type { ButtonProps } from '../Button';
|
|
14
|
+
import type { ButtonGroupProps } from '../ButtonGroup';
|
|
15
|
+
import type { ButtonToolbarProps } from '../ButtonToolbar';
|
|
16
|
+
import type { CalendarProps } from '../Calendar';
|
|
17
|
+
import type { CarouselProps } from '../Carousel';
|
|
18
|
+
import type { CascadeTreeProps } from '../CascadeTree';
|
|
19
|
+
import type { CascaderProps } from '../Cascader';
|
|
20
|
+
import type { CheckPickerProps } from '../CheckPicker';
|
|
21
|
+
import type { CheckTreeProps } from '../CheckTree';
|
|
22
|
+
import type { CheckTreePickerProps } from '../CheckTreePicker';
|
|
23
|
+
import type { CheckboxProps } from '../Checkbox';
|
|
24
|
+
import type { CheckboxGroupProps } from '../CheckboxGroup';
|
|
25
|
+
import type { ColProps } from '../Col';
|
|
26
|
+
import type { ContainerProps } from '../Container';
|
|
27
|
+
import type { ContentProps } from '../Content';
|
|
28
|
+
import type { DateInputProps } from '../DateInput';
|
|
29
|
+
import type { DatePickerProps } from '../DatePicker';
|
|
30
|
+
import type { DateRangeInputProps } from '../DateRangeInput';
|
|
31
|
+
import type { DateRangePickerProps } from '../DateRangePicker';
|
|
32
|
+
import type { DividerProps } from '../Divider';
|
|
33
|
+
import type { DrawerProps } from '../Drawer';
|
|
34
|
+
import type { DropdownProps } from '../Dropdown';
|
|
35
|
+
import type { FlexboxGridProps } from '../FlexboxGrid';
|
|
36
|
+
import type { FooterProps } from '../Footer';
|
|
37
|
+
import type { FormProps } from '../Form';
|
|
38
|
+
import type { FormControlProps } from '../FormControl';
|
|
39
|
+
import type { FormControlLabelProps } from '../FormControlLabel';
|
|
40
|
+
import type { FormErrorMessageProps } from '../FormErrorMessage';
|
|
41
|
+
import type { FormGroupProps } from '../FormGroup';
|
|
42
|
+
import type { FormHelpTextProps } from '../FormHelpText';
|
|
43
|
+
import type { GridProps } from '../Grid';
|
|
44
|
+
import type { HeaderProps } from '../Header';
|
|
45
|
+
import type { HeadingProps } from '../Heading';
|
|
46
|
+
import type { HeadingGroupProps } from '../HeadingGroup';
|
|
47
|
+
import type { HighlightProps } from '../Highlight';
|
|
48
|
+
import type { IconButtonProps } from '../IconButton';
|
|
49
|
+
import type { InlineEditProps } from '../InlineEdit';
|
|
50
|
+
import type { InputProps } from '../Input';
|
|
51
|
+
import type { InputGroupProps } from '../InputGroup';
|
|
52
|
+
import type { InputNumberProps } from '../InputNumber';
|
|
53
|
+
import type { InputPickerProps } from '../InputPicker';
|
|
54
|
+
import type { ListProps } from '../List';
|
|
55
|
+
import type { LoaderProps } from '../Loader';
|
|
56
|
+
import type { MaskedInputProps } from '../MaskedInput';
|
|
57
|
+
import type { MessageProps } from '../Message';
|
|
58
|
+
import type { ModalProps } from '../Modal';
|
|
59
|
+
import type { MultiCascadeTreeProps } from '../MultiCascadeTree';
|
|
60
|
+
import type { MultiCascaderProps } from '../MultiCascader';
|
|
61
|
+
import type { NavProps } from '../Nav';
|
|
62
|
+
import type { NavbarProps } from '../Navbar';
|
|
63
|
+
import type { NotificationProps } from '../Notification';
|
|
64
|
+
import type { PaginationProps } from '../Pagination';
|
|
65
|
+
import type { PanelProps } from '../Panel';
|
|
66
|
+
import type { PanelGroupProps } from '../PanelGroup';
|
|
67
|
+
import type { PlaceholderGraphProps } from '../Placeholder/PlaceholderGraph';
|
|
68
|
+
import type { PlaceholderGridProps } from '../Placeholder/PlaceholderGrid';
|
|
69
|
+
import type { PlaceholderParagraphProps } from '../Placeholder/PlaceholderParagraph';
|
|
70
|
+
import type { PopoverProps } from '../Popover';
|
|
71
|
+
import type { ProgressCircleProps } from '../Progress/ProgressCircle';
|
|
72
|
+
import type { ProgressLineProps } from '../Progress/ProgressLine';
|
|
73
|
+
import type { RadioProps } from '../Radio';
|
|
74
|
+
import type { RadioGroupProps } from '../RadioGroup';
|
|
75
|
+
import type { RadioTileProps } from '../RadioTile';
|
|
76
|
+
import type { RadioTileGroupProps } from '../RadioTileGroup';
|
|
77
|
+
import type { RangeSliderProps } from '../RangeSlider';
|
|
78
|
+
import type { RateProps } from '../Rate';
|
|
79
|
+
import type { RowProps } from '../Row';
|
|
80
|
+
import type { SafeAnchorProps } from '../SafeAnchor';
|
|
81
|
+
import type { SelectPickerProps } from '../SelectPicker';
|
|
82
|
+
import type { SidebarProps } from '../Sidebar';
|
|
83
|
+
import type { SidenavProps } from '../Sidenav';
|
|
84
|
+
import type { SliderProps } from '../Slider';
|
|
85
|
+
import type { StackProps } from '../Stack';
|
|
86
|
+
import type { StepsProps } from '../Steps';
|
|
87
|
+
import type { TableProps } from '../Table';
|
|
88
|
+
import type { TabsProps } from '../Tabs';
|
|
89
|
+
import type { TagProps } from '../Tag';
|
|
90
|
+
import type { TagGroupProps } from '../TagGroup';
|
|
91
|
+
import type { TagInputProps } from '../TagInput';
|
|
92
|
+
import type { TagPickerProps } from '../TagPicker';
|
|
93
|
+
import type { TextProps } from '../Text';
|
|
94
|
+
import type { TimePickerProps } from '../TimePicker';
|
|
95
|
+
import type { TimeRangePickerProps } from '../TimeRangePicker';
|
|
96
|
+
import type { TimelineProps } from '../Timeline';
|
|
97
|
+
import type { ToggleProps } from '../Toggle';
|
|
98
|
+
import type { TooltipProps } from '../Tooltip';
|
|
99
|
+
import type { TreeProps } from '../Tree';
|
|
100
|
+
import type { TreePickerProps } from '../TreePicker';
|
|
101
|
+
import type { UploaderProps } from '../Uploader';
|
|
102
|
+
import type { VisuallyHiddenProps } from '../VisuallyHidden';
|
|
103
|
+
import type { WhisperProps } from '../Whisper';
|
|
104
|
+
interface ComponentProps<T> {
|
|
105
|
+
defaultProps: Partial<T>;
|
|
106
|
+
}
|
|
107
|
+
export interface ReactSuiteComponents {
|
|
108
|
+
Accordion: ComponentProps<AccordionProps>;
|
|
109
|
+
Affix: ComponentProps<AffixProps>;
|
|
110
|
+
Bounce: ComponentProps<BounceProps>;
|
|
111
|
+
Collapse: ComponentProps<CollapseProps>;
|
|
112
|
+
Fade: ComponentProps<FadeProps>;
|
|
113
|
+
Slide: ComponentProps<SlideProps>;
|
|
114
|
+
Transition: ComponentProps<TransitionProps>;
|
|
115
|
+
AutoComplete: ComponentProps<AutoCompleteProps>;
|
|
116
|
+
Avatar: ComponentProps<AvatarProps>;
|
|
117
|
+
AvatarGroup: ComponentProps<AvatarGroupProps>;
|
|
118
|
+
Badge: ComponentProps<BadgeProps>;
|
|
119
|
+
Breadcrumb: ComponentProps<BreadcrumbProps>;
|
|
120
|
+
Button: ComponentProps<ButtonProps>;
|
|
121
|
+
ButtonGroup: ComponentProps<ButtonGroupProps>;
|
|
122
|
+
ButtonToolbar: ComponentProps<ButtonToolbarProps>;
|
|
123
|
+
Calendar: ComponentProps<CalendarProps>;
|
|
124
|
+
Carousel: ComponentProps<CarouselProps>;
|
|
125
|
+
CascadeTree: ComponentProps<CascadeTreeProps>;
|
|
126
|
+
Cascader: ComponentProps<CascaderProps>;
|
|
127
|
+
CheckPicker: ComponentProps<CheckPickerProps>;
|
|
128
|
+
CheckTree: ComponentProps<CheckTreeProps>;
|
|
129
|
+
CheckTreePicker: ComponentProps<CheckTreePickerProps>;
|
|
130
|
+
Checkbox: ComponentProps<CheckboxProps>;
|
|
131
|
+
CheckboxGroup: ComponentProps<CheckboxGroupProps>;
|
|
132
|
+
Col: ComponentProps<ColProps>;
|
|
133
|
+
Container: ComponentProps<ContainerProps>;
|
|
134
|
+
Content: ComponentProps<ContentProps>;
|
|
135
|
+
DateInput: ComponentProps<DateInputProps>;
|
|
136
|
+
DatePicker: ComponentProps<DatePickerProps>;
|
|
137
|
+
DateRangeInput: ComponentProps<DateRangeInputProps>;
|
|
138
|
+
DateRangePicker: ComponentProps<DateRangePickerProps>;
|
|
139
|
+
Divider: ComponentProps<DividerProps>;
|
|
140
|
+
Drawer: ComponentProps<DrawerProps>;
|
|
141
|
+
Dropdown: ComponentProps<DropdownProps>;
|
|
142
|
+
FlexboxGrid: ComponentProps<FlexboxGridProps>;
|
|
143
|
+
Footer: ComponentProps<FooterProps>;
|
|
144
|
+
Form: ComponentProps<FormProps>;
|
|
145
|
+
FormControl: ComponentProps<FormControlProps>;
|
|
146
|
+
FormControlLabel: ComponentProps<FormControlLabelProps>;
|
|
147
|
+
FormErrorMessage: ComponentProps<FormErrorMessageProps>;
|
|
148
|
+
FormGroup: ComponentProps<FormGroupProps>;
|
|
149
|
+
FormHelpText: ComponentProps<FormHelpTextProps>;
|
|
150
|
+
Grid: ComponentProps<GridProps>;
|
|
151
|
+
Header: ComponentProps<HeaderProps>;
|
|
152
|
+
Heading: ComponentProps<HeadingProps>;
|
|
153
|
+
HeadingGroup: ComponentProps<HeadingGroupProps>;
|
|
154
|
+
Highlight: ComponentProps<HighlightProps>;
|
|
155
|
+
IconButton: ComponentProps<IconButtonProps>;
|
|
156
|
+
InlineEdit: ComponentProps<InlineEditProps>;
|
|
157
|
+
Input: ComponentProps<InputProps>;
|
|
158
|
+
InputGroup: ComponentProps<InputGroupProps>;
|
|
159
|
+
InputNumber: ComponentProps<InputNumberProps>;
|
|
160
|
+
InputPicker: ComponentProps<InputPickerProps>;
|
|
161
|
+
List: ComponentProps<ListProps>;
|
|
162
|
+
Loader: ComponentProps<LoaderProps>;
|
|
163
|
+
MaskedInput: ComponentProps<MaskedInputProps>;
|
|
164
|
+
Message: ComponentProps<MessageProps>;
|
|
165
|
+
Modal: ComponentProps<ModalProps>;
|
|
166
|
+
MultiCascadeTree: ComponentProps<MultiCascadeTreeProps>;
|
|
167
|
+
MultiCascader: ComponentProps<MultiCascaderProps>;
|
|
168
|
+
Nav: ComponentProps<NavProps>;
|
|
169
|
+
Navbar: ComponentProps<NavbarProps>;
|
|
170
|
+
Notification: ComponentProps<NotificationProps>;
|
|
171
|
+
Pagination: ComponentProps<PaginationProps>;
|
|
172
|
+
Panel: ComponentProps<PanelProps>;
|
|
173
|
+
PanelGroup: ComponentProps<PanelGroupProps>;
|
|
174
|
+
PlaceholderGraph: ComponentProps<PlaceholderGraphProps>;
|
|
175
|
+
PlaceholderGrid: ComponentProps<PlaceholderGridProps>;
|
|
176
|
+
PlaceholderParagraph: ComponentProps<PlaceholderParagraphProps>;
|
|
177
|
+
Popover: ComponentProps<PopoverProps>;
|
|
178
|
+
ProgressCircle: ComponentProps<ProgressCircleProps>;
|
|
179
|
+
ProgressLine: ComponentProps<ProgressLineProps>;
|
|
180
|
+
Radio: ComponentProps<RadioProps>;
|
|
181
|
+
RadioGroup: ComponentProps<RadioGroupProps>;
|
|
182
|
+
RadioTile: ComponentProps<RadioTileProps>;
|
|
183
|
+
RadioTileGroup: ComponentProps<RadioTileGroupProps>;
|
|
184
|
+
RangeSlider: ComponentProps<RangeSliderProps>;
|
|
185
|
+
Rate: ComponentProps<RateProps>;
|
|
186
|
+
Row: ComponentProps<RowProps>;
|
|
187
|
+
SafeAnchor: ComponentProps<SafeAnchorProps>;
|
|
188
|
+
SelectPicker: ComponentProps<SelectPickerProps>;
|
|
189
|
+
Sidebar: ComponentProps<SidebarProps>;
|
|
190
|
+
Sidenav: ComponentProps<SidenavProps>;
|
|
191
|
+
Slider: ComponentProps<SliderProps>;
|
|
192
|
+
Stack: ComponentProps<StackProps>;
|
|
193
|
+
Steps: ComponentProps<StepsProps>;
|
|
194
|
+
Table: ComponentProps<TableProps>;
|
|
195
|
+
Tabs: ComponentProps<TabsProps>;
|
|
196
|
+
Tag: ComponentProps<TagProps>;
|
|
197
|
+
TagGroup: ComponentProps<TagGroupProps>;
|
|
198
|
+
TagInput: ComponentProps<TagInputProps>;
|
|
199
|
+
TagPicker: ComponentProps<TagPickerProps>;
|
|
200
|
+
Text: ComponentProps<TextProps>;
|
|
201
|
+
TimePicker: ComponentProps<TimePickerProps>;
|
|
202
|
+
TimeRangePicker: ComponentProps<TimeRangePickerProps>;
|
|
203
|
+
Timeline: ComponentProps<TimelineProps>;
|
|
204
|
+
Toggle: ComponentProps<ToggleProps>;
|
|
205
|
+
Tooltip: ComponentProps<TooltipProps>;
|
|
206
|
+
Tree: ComponentProps<TreeProps>;
|
|
207
|
+
TreePicker: ComponentProps<TreePickerProps>;
|
|
208
|
+
Uploader: ComponentProps<UploaderProps>;
|
|
209
|
+
VisuallyHidden: ComponentProps<VisuallyHiddenProps>;
|
|
210
|
+
Whisper: ComponentProps<WhisperProps>;
|
|
211
|
+
}
|
|
212
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import enGB from '../locales/en_GB';
|
|
3
|
+
import type { FormatDateOptions } from '../internals/utils/date/types';
|
|
4
|
+
import type { ReactSuiteComponents } from './types';
|
|
5
|
+
type LocaleKey = keyof typeof enGB;
|
|
6
|
+
/**
|
|
7
|
+
* A hook to get custom configuration of `<CustomProvider>`
|
|
8
|
+
* @param componentName - The name of the component
|
|
9
|
+
* @param componentProps - The props of the component
|
|
10
|
+
*/
|
|
11
|
+
export declare function useCustom<P = any>(componentName?: keyof ReactSuiteComponents, componentProps?: P): {
|
|
12
|
+
rtl: boolean;
|
|
13
|
+
toasters: import("react").MutableRefObject<Map<string, import("../toaster/ToastContainer").ToastContainerInstance>> | undefined;
|
|
14
|
+
disableRipple: boolean | undefined;
|
|
15
|
+
classPrefix: string | undefined;
|
|
16
|
+
propsWithDefaults: P;
|
|
17
|
+
getLocale: (key: LocaleKey | LocaleKey[], overrideLocale?: Record<string, any>) => any;
|
|
18
|
+
formatDate: (date: number | Date, formatStr: string, options?: FormatDateOptions) => string;
|
|
19
|
+
parseDate: (dateString: string, formatString: string, referenceDate?: Date | number, options?: any) => Date;
|
|
20
|
+
};
|
|
21
|
+
export default useCustom;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
exports.useCustom = useCustom;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var _assign = _interopRequireDefault(require("lodash/assign"));
|
|
12
|
+
var _en_GB = _interopRequireDefault(require("../locales/en_GB"));
|
|
13
|
+
var _date = require("../internals/utils/date");
|
|
14
|
+
var _CustomProvider = require("./CustomProvider");
|
|
15
|
+
var _excluded = ["locale"];
|
|
16
|
+
function getDefaultRTL() {
|
|
17
|
+
return typeof document !== 'undefined' && (document.body.getAttribute('dir') || document.dir) === 'rtl';
|
|
18
|
+
}
|
|
19
|
+
function toLocaleKey(componentName) {
|
|
20
|
+
var Picker = ['Cascader', 'CheckTreePicker', 'MultiCascader', 'SelectPicker', 'TreePicker', 'CheckPicker', 'CheckTreePicker'];
|
|
21
|
+
if (Picker.includes(componentName)) {
|
|
22
|
+
return 'Combobox';
|
|
23
|
+
}
|
|
24
|
+
return componentName;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A hook to get custom configuration of `<CustomProvider>`
|
|
29
|
+
* @param componentName - The name of the component
|
|
30
|
+
* @param componentProps - The props of the component
|
|
31
|
+
*/
|
|
32
|
+
function useCustom(componentName, componentProps) {
|
|
33
|
+
var _globalLocale$DateTim;
|
|
34
|
+
var _useContext = (0, _react.useContext)(_CustomProvider.CustomContext),
|
|
35
|
+
_useContext$component = _useContext.components,
|
|
36
|
+
components = _useContext$component === void 0 ? {} : _useContext$component,
|
|
37
|
+
_useContext$locale = _useContext.locale,
|
|
38
|
+
globalLocale = _useContext$locale === void 0 ? _en_GB.default : _useContext$locale,
|
|
39
|
+
_useContext$rtl = _useContext.rtl,
|
|
40
|
+
rtl = _useContext$rtl === void 0 ? getDefaultRTL() : _useContext$rtl,
|
|
41
|
+
formatDate = _useContext.formatDate,
|
|
42
|
+
parseDate = _useContext.parseDate,
|
|
43
|
+
classPrefix = _useContext.classPrefix,
|
|
44
|
+
toasters = _useContext.toasters,
|
|
45
|
+
disableRipple = _useContext.disableRipple;
|
|
46
|
+
var _ref = componentProps || {},
|
|
47
|
+
componentLocale = _ref.locale,
|
|
48
|
+
restProps = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
49
|
+
var dateLocale = globalLocale === null || globalLocale === void 0 ? void 0 : (_globalLocale$DateTim = globalLocale.DateTimeFormats) === null || _globalLocale$DateTim === void 0 ? void 0 : _globalLocale$DateTim.dateLocale;
|
|
50
|
+
var getLocale = (0, _react.useCallback)(function (key, overrideLocale) {
|
|
51
|
+
// Initialize with common locale
|
|
52
|
+
var publicLocale = (globalLocale === null || globalLocale === void 0 ? void 0 : globalLocale.common) || {};
|
|
53
|
+
|
|
54
|
+
// Merge component-specific locale(s) based on key type
|
|
55
|
+
var specificLocale = typeof key === 'string' ? globalLocale === null || globalLocale === void 0 ? void 0 : globalLocale[key] : Array.isArray(key) ? _assign.default.apply(void 0, [{}].concat(key.map(function (k) {
|
|
56
|
+
return globalLocale === null || globalLocale === void 0 ? void 0 : globalLocale[k];
|
|
57
|
+
}))) : {};
|
|
58
|
+
|
|
59
|
+
// Merge all parts: public locale, specific locale, custom component locale
|
|
60
|
+
return (0, _assign.default)({}, publicLocale, specificLocale, componentLocale, overrideLocale);
|
|
61
|
+
}, [globalLocale, componentLocale]);
|
|
62
|
+
var propsWithDefaults = (0, _react.useMemo)(function () {
|
|
63
|
+
var _components$component;
|
|
64
|
+
if (!componentName) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
//Memoize the global default props based on component name
|
|
69
|
+
var globalDefaultProps = ((_components$component = components[componentName]) === null || _components$component === void 0 ? void 0 : _components$component.defaultProps) || {};
|
|
70
|
+
var mergedProps = (0, _assign.default)({}, globalDefaultProps, restProps);
|
|
71
|
+
var localeKey = toLocaleKey(componentName);
|
|
72
|
+
|
|
73
|
+
// If the default locale has the component name, then merge the locale.
|
|
74
|
+
if (Object.keys(_en_GB.default).includes(localeKey)) {
|
|
75
|
+
return (0, _extends2.default)({}, mergedProps, {
|
|
76
|
+
locale: getLocale(localeKey)
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return mergedProps;
|
|
80
|
+
}, [componentName, components, getLocale, restProps]);
|
|
81
|
+
var _formatDate = (0, _react.useCallback)(function (date, formatStr, options) {
|
|
82
|
+
try {
|
|
83
|
+
if (formatDate) {
|
|
84
|
+
return formatDate(date, formatStr, options);
|
|
85
|
+
}
|
|
86
|
+
return (0, _date.format)((0, _date.isValid)(date) ? date : new Date(), formatStr, (0, _extends2.default)({
|
|
87
|
+
locale: dateLocale
|
|
88
|
+
}, options));
|
|
89
|
+
} catch (error) {
|
|
90
|
+
if (process.env.NODE_ENV === 'development') {
|
|
91
|
+
console.error('Error: Invalid date format', error);
|
|
92
|
+
}
|
|
93
|
+
return 'Error: Invalid date format';
|
|
94
|
+
}
|
|
95
|
+
}, [dateLocale, formatDate]);
|
|
96
|
+
var _parseDate = (0, _react.useCallback)(function (dateString, formatString, referenceDate, options) {
|
|
97
|
+
if (parseDate) {
|
|
98
|
+
return parseDate(dateString, formatString, referenceDate, options);
|
|
99
|
+
}
|
|
100
|
+
return (0, _date.parse)(dateString, formatString, referenceDate || new Date(), (0, _extends2.default)({
|
|
101
|
+
locale: dateLocale
|
|
102
|
+
}, options));
|
|
103
|
+
}, [parseDate, dateLocale]);
|
|
104
|
+
return {
|
|
105
|
+
rtl: rtl,
|
|
106
|
+
toasters: toasters,
|
|
107
|
+
disableRipple: disableRipple,
|
|
108
|
+
classPrefix: classPrefix,
|
|
109
|
+
propsWithDefaults: propsWithDefaults,
|
|
110
|
+
getLocale: getLocale,
|
|
111
|
+
formatDate: _formatDate,
|
|
112
|
+
parseDate: _parseDate
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
var _default = exports.default = useCustom;
|