@skbkontur/react-ui 4.2.2 → 4.4.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/CHANGELOG.md +41 -0
- package/cjs/components/Autocomplete/Autocomplete.d.ts +9 -17
- package/cjs/components/Autocomplete/Autocomplete.js +13 -7
- package/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
- package/cjs/components/Button/Button.d.ts +4 -5
- package/cjs/components/Button/Button.js +8 -3
- package/cjs/components/Button/Button.js.map +1 -1
- package/cjs/components/Button/Button.mixins.js +1 -1
- package/cjs/components/Button/Button.mixins.js.map +1 -1
- package/cjs/components/Button/Button.styles.js +18 -18
- package/cjs/components/Button/Button.styles.js.map +1 -1
- package/cjs/components/Center/Center.d.ts +4 -3
- package/cjs/components/Center/Center.js +9 -3
- package/cjs/components/Center/Center.js.map +1 -1
- package/cjs/components/Checkbox/Checkbox.js +4 -2
- package/cjs/components/Checkbox/Checkbox.js.map +1 -1
- package/cjs/components/Checkbox/Checkbox.styles.d.ts +1 -1
- package/cjs/components/Checkbox/Checkbox.styles.js +1 -1
- package/cjs/components/Checkbox/Checkbox.styles.js.map +1 -1
- package/cjs/components/ComboBox/ComboBox.d.ts +8 -13
- package/cjs/components/ComboBox/ComboBox.js +12 -2
- package/cjs/components/ComboBox/ComboBox.js.map +1 -1
- package/cjs/components/CurrencyInput/CurrencyInput.d.ts +6 -9
- package/cjs/components/CurrencyInput/CurrencyInput.js +25 -10
- package/cjs/components/CurrencyInput/CurrencyInput.js.map +1 -1
- package/cjs/components/CurrencyInput/CurrencyInputKeyboardActions.d.ts +3 -1
- package/cjs/components/CurrencyInput/CurrencyInputKeyboardActions.js +14 -2
- package/cjs/components/CurrencyInput/CurrencyInputKeyboardActions.js.map +1 -1
- package/cjs/components/CurrencyLabel/CurrencyLabel.d.ts +3 -9
- package/cjs/components/CurrencyLabel/CurrencyLabel.js +15 -15
- package/cjs/components/CurrencyLabel/CurrencyLabel.js.map +1 -1
- package/cjs/components/DateInput/DateFragmentsView.d.ts +1 -1
- package/cjs/components/DateInput/DateFragmentsView.js +10 -1
- package/cjs/components/DateInput/DateFragmentsView.js.map +1 -1
- package/cjs/components/DateInput/DateInput.d.ts +9 -12
- package/cjs/components/DateInput/DateInput.js +11 -3
- package/cjs/components/DateInput/DateInput.js.map +1 -1
- package/cjs/components/DateInput/helpers/DateInputKeyboardActions.js +1 -2
- package/cjs/components/DateInput/helpers/DateInputKeyboardActions.js.map +1 -1
- package/cjs/components/DateInput/helpers/SelectionHelpers.js +2 -2
- package/cjs/components/DateInput/helpers/SelectionHelpers.js.map +1 -1
- package/cjs/components/DatePicker/DatePicker.d.ts +7 -9
- package/cjs/components/DatePicker/DatePicker.js +23 -9
- package/cjs/components/DatePicker/DatePicker.js.map +1 -1
- package/cjs/components/DatePicker/Picker.js +5 -1
- package/cjs/components/DatePicker/Picker.js.map +1 -1
- package/cjs/components/DropdownMenu/DropdownMenu.d.ts +5 -5
- package/cjs/components/DropdownMenu/DropdownMenu.js +9 -3
- package/cjs/components/DropdownMenu/DropdownMenu.js.map +1 -1
- package/cjs/components/FileUploader/FileUploader.js +2 -2
- package/cjs/components/FileUploader/FileUploader.js.map +1 -1
- package/cjs/components/FileUploader/FileUploader.md +8 -1
- package/cjs/components/FxInput/FxInput.d.ts +6 -6
- package/cjs/components/FxInput/FxInput.js +16 -11
- package/cjs/components/FxInput/FxInput.js.map +1 -1
- package/cjs/components/Gapped/Gapped.d.ts +7 -8
- package/cjs/components/Gapped/Gapped.js +12 -6
- package/cjs/components/Gapped/Gapped.js.map +1 -1
- package/cjs/components/GlobalLoader/GlobalLoader.d.ts +7 -14
- package/cjs/components/GlobalLoader/GlobalLoader.js +13 -9
- package/cjs/components/GlobalLoader/GlobalLoader.js.map +1 -1
- package/cjs/components/GlobalLoader/GlobalLoaderView.d.ts +2 -2
- package/cjs/components/GlobalLoader/GlobalLoaderView.js.map +1 -1
- package/cjs/components/Hint/Hint.d.ts +8 -12
- package/cjs/components/Hint/Hint.js +15 -5
- package/cjs/components/Hint/Hint.js.map +1 -1
- package/cjs/components/Hint/Hint.md +14 -0
- package/cjs/components/Input/Input.d.ts +4 -3
- package/cjs/components/Input/Input.js +10 -5
- package/cjs/components/Input/Input.js.map +1 -1
- package/cjs/components/Input/Input.md +5 -1
- package/cjs/components/Kebab/Kebab.d.ts +8 -15
- package/cjs/components/Kebab/Kebab.js +14 -5
- package/cjs/components/Kebab/Kebab.js.map +1 -1
- package/cjs/components/Link/Link.d.ts +5 -7
- package/cjs/components/Link/Link.js +12 -5
- package/cjs/components/Link/Link.js.map +1 -1
- package/cjs/components/Loader/Loader.d.ts +9 -5
- package/cjs/components/Loader/Loader.js +15 -4
- package/cjs/components/Loader/Loader.js.map +1 -1
- package/cjs/components/Loader/__stories__/LoaderAndButton.js +6 -0
- package/cjs/components/Loader/__stories__/LoaderAndButton.js.map +1 -1
- package/cjs/components/MenuItem/MenuItem.js +3 -1
- package/cjs/components/MenuItem/MenuItem.js.map +1 -1
- package/cjs/components/Modal/Modal.d.ts +4 -3
- package/cjs/components/Modal/Modal.js +9 -4
- package/cjs/components/Modal/Modal.js.map +1 -1
- package/cjs/components/Modal/Modal.styles.d.ts +2 -2
- package/cjs/components/Modal/Modal.styles.js +2 -2
- package/cjs/components/Modal/Modal.styles.js.map +1 -1
- package/cjs/components/Modal/ModalBody.js +2 -2
- package/cjs/components/Modal/ModalBody.js.map +1 -1
- package/cjs/components/Paging/Paging.d.ts +7 -10
- package/cjs/components/Paging/Paging.js +16 -6
- package/cjs/components/Paging/Paging.js.map +1 -1
- package/cjs/components/Paging/PagingDefaultComponent.d.ts +3 -3
- package/cjs/components/Paging/PagingDefaultComponent.js.map +1 -1
- package/cjs/components/PasswordInput/PasswordInput.d.ts +4 -3
- package/cjs/components/PasswordInput/PasswordInput.js +14 -7
- package/cjs/components/PasswordInput/PasswordInput.js.map +1 -1
- package/cjs/components/Radio/Radio.d.ts +4 -3
- package/cjs/components/Radio/Radio.js +11 -4
- package/cjs/components/Radio/Radio.js.map +1 -1
- package/cjs/components/RadioGroup/RadioGroup.d.ts +2 -4
- package/cjs/components/RadioGroup/RadioGroup.js +4 -2
- package/cjs/components/RadioGroup/RadioGroup.js.map +1 -1
- package/cjs/components/ResponsiveLayout/ResponsiveLayoutEvents.js +2 -2
- package/cjs/components/ResponsiveLayout/ResponsiveLayoutEvents.js.map +1 -1
- package/cjs/components/ScrollContainer/ScrollContainer.d.ts +7 -8
- package/cjs/components/ScrollContainer/ScrollContainer.helpers.js +4 -4
- package/cjs/components/ScrollContainer/ScrollContainer.helpers.js.map +1 -1
- package/cjs/components/ScrollContainer/ScrollContainer.js +12 -6
- package/cjs/components/ScrollContainer/ScrollContainer.js.map +1 -1
- package/cjs/components/Select/Item.d.ts +4 -2
- package/cjs/components/Select/Item.js +3 -0
- package/cjs/components/Select/Item.js.map +1 -1
- package/cjs/components/Select/Select.d.ts +3 -12
- package/cjs/components/Select/Select.js +8 -1
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Select/Select.styles.js +4 -4
- package/cjs/components/Select/Select.styles.js.map +1 -1
- package/cjs/components/SidePage/SidePage.d.ts +5 -6
- package/cjs/components/SidePage/SidePage.js +8 -1
- package/cjs/components/SidePage/SidePage.js.map +1 -1
- package/cjs/components/SidePage/SidePageFooter.d.ts +6 -4
- package/cjs/components/SidePage/SidePageFooter.js +4 -0
- package/cjs/components/SidePage/SidePageFooter.js.map +1 -1
- package/cjs/components/Spinner/Spinner.d.ts +4 -2
- package/cjs/components/Spinner/Spinner.js +10 -4
- package/cjs/components/Spinner/Spinner.js.map +1 -1
- package/cjs/components/Spinner/Spinner.styles.d.ts +1 -1
- package/cjs/components/Spinner/Spinner.styles.js +7 -7
- package/cjs/components/Spinner/Spinner.styles.js.map +1 -1
- package/cjs/components/Sticky/Sticky.d.ts +5 -4
- package/cjs/components/Sticky/Sticky.js +9 -2
- package/cjs/components/Sticky/Sticky.js.map +1 -1
- package/cjs/components/Tabs/Indicator.d.ts +1 -1
- package/cjs/components/Tabs/Indicator.js +1 -1
- package/cjs/components/Tabs/Indicator.js.map +1 -1
- package/cjs/components/Tabs/Tab.d.ts +4 -4
- package/cjs/components/Tabs/Tab.js +11 -13
- package/cjs/components/Tabs/Tab.js.map +1 -1
- package/cjs/components/Tabs/Tabs.d.ts +4 -4
- package/cjs/components/Tabs/Tabs.js +12 -3
- package/cjs/components/Tabs/Tabs.js.map +1 -1
- package/cjs/components/Textarea/Textarea.d.ts +8 -10
- package/cjs/components/Textarea/Textarea.js +13 -7
- package/cjs/components/Textarea/Textarea.js.map +1 -1
- package/cjs/components/Textarea/TextareaCounter.d.ts +2 -2
- package/cjs/components/Textarea/TextareaCounter.js.map +1 -1
- package/cjs/components/Toast/Toast.js +1 -1
- package/cjs/components/Toast/Toast.js.map +1 -1
- package/cjs/components/Toggle/Toggle.d.ts +5 -6
- package/cjs/components/Toggle/Toggle.js +10 -4
- package/cjs/components/Toggle/Toggle.js.map +1 -1
- package/cjs/components/TokenInput/TokenInput.d.ts +19 -16
- package/cjs/components/TokenInput/TokenInput.js +76 -59
- package/cjs/components/TokenInput/TokenInput.js.map +1 -1
- package/cjs/components/TokenInput/TokenInputMenu.d.ts +2 -1
- package/cjs/components/TokenInput/TokenInputMenu.js +1 -1
- package/cjs/components/TokenInput/TokenInputMenu.js.map +1 -1
- package/cjs/components/Tooltip/Tooltip.d.ts +12 -16
- package/cjs/components/Tooltip/Tooltip.js +25 -14
- package/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/cjs/components/TooltipMenu/TooltipMenu.d.ts +6 -5
- package/cjs/components/TooltipMenu/TooltipMenu.js +11 -5
- package/cjs/components/TooltipMenu/TooltipMenu.js.map +1 -1
- package/cjs/hooks/useEffectWithoutInitCall.d.ts +2 -2
- package/cjs/hooks/useEffectWithoutInitCall.js +2 -2
- package/cjs/hooks/useEffectWithoutInitCall.js.map +1 -1
- package/cjs/hooks/useMemoObject.d.ts +2 -1
- package/cjs/hooks/useMemoObject.js +2 -0
- package/cjs/hooks/useMemoObject.js.map +1 -1
- package/cjs/internal/BGRuler.d.ts +13 -15
- package/cjs/internal/BGRuler.js +16 -8
- package/cjs/internal/BGRuler.js.map +1 -1
- package/cjs/internal/Calendar/Calendar.d.ts +4 -13
- package/cjs/internal/Calendar/Calendar.js +10 -5
- package/cjs/internal/Calendar/Calendar.js.map +1 -1
- package/cjs/internal/Calendar/DayCellView.styles.js +1 -1
- package/cjs/internal/Calendar/DayCellView.styles.js.map +1 -1
- package/cjs/internal/Calendar/Month.js +16 -11
- package/cjs/internal/Calendar/Month.js.map +1 -1
- package/cjs/internal/Calendar/MonthViewModel.d.ts +1 -1
- package/cjs/internal/Calendar/config.d.ts +1 -8
- package/cjs/internal/CommonWrapper/CommonWrapper.d.ts +1 -1
- package/cjs/internal/CommonWrapper/CommonWrapper.js +5 -4
- package/cjs/internal/CommonWrapper/CommonWrapper.js.map +1 -1
- package/cjs/internal/ComponentCombinator.d.ts +6 -8
- package/cjs/internal/ComponentCombinator.js +6 -2
- package/cjs/internal/ComponentCombinator.js.map +1 -1
- package/cjs/internal/ComponentTable.d.ts +7 -8
- package/cjs/internal/ComponentTable.js +14 -3
- package/cjs/internal/ComponentTable.js.map +1 -1
- package/cjs/internal/CustomComboBox/ComboBoxMenu.d.ts +6 -6
- package/cjs/internal/CustomComboBox/ComboBoxMenu.js +14 -8
- package/cjs/internal/CustomComboBox/ComboBoxMenu.js.map +1 -1
- package/cjs/internal/CustomComboBox/ComboBoxView.d.ts +4 -12
- package/cjs/internal/CustomComboBox/ComboBoxView.js +18 -10
- package/cjs/internal/CustomComboBox/ComboBoxView.js.map +1 -1
- package/cjs/internal/CustomComboBox/CustomComboBoxReducer.js +4 -5
- package/cjs/internal/CustomComboBox/CustomComboBoxReducer.js.map +1 -1
- package/cjs/internal/DataTids/DataTids.d.ts +5 -5
- package/cjs/internal/DataTids/DataTids.js +4 -0
- package/cjs/internal/DataTids/DataTids.js.map +1 -1
- package/cjs/internal/DateSelect/DateSelect.d.ts +4 -6
- package/cjs/internal/DateSelect/DateSelect.js +16 -10
- package/cjs/internal/DateSelect/DateSelect.js.map +1 -1
- package/cjs/internal/DropdownContainer/DropdownContainer.d.ts +4 -7
- package/cjs/internal/DropdownContainer/DropdownContainer.js +8 -5
- package/cjs/internal/DropdownContainer/DropdownContainer.js.map +1 -1
- package/cjs/internal/FileUploaderControl/withFileUploaderControlProvider.d.ts +1 -1
- package/cjs/internal/FileUploaderControl/withFileUploaderControlProvider.js.map +1 -1
- package/cjs/internal/HideBodyVerticalScroll/HideBodyVerticalScroll.js +2 -1
- package/cjs/internal/HideBodyVerticalScroll/HideBodyVerticalScroll.js.map +1 -1
- package/cjs/internal/InputLikeText/InputLikeText.d.ts +4 -3
- package/cjs/internal/InputLikeText/InputLikeText.js +11 -4
- package/cjs/internal/InputLikeText/InputLikeText.js.map +1 -1
- package/cjs/internal/InternalMenu/InternalMenu.d.ts +3 -9
- package/cjs/internal/InternalMenu/InternalMenu.js +36 -14
- package/cjs/internal/InternalMenu/InternalMenu.js.map +1 -1
- package/cjs/internal/MaskedInput/MaskedInput.d.ts +5 -2
- package/cjs/internal/MaskedInput/MaskedInput.js +20 -7
- package/cjs/internal/MaskedInput/MaskedInput.js.map +1 -1
- package/cjs/internal/Menu/Menu.d.ts +4 -7
- package/cjs/internal/Menu/Menu.js +14 -4
- package/cjs/internal/Menu/Menu.js.map +1 -1
- package/cjs/internal/MobilePopup/MobilePopup.js +1 -1
- package/cjs/internal/MobilePopup/MobilePopup.js.map +1 -1
- package/cjs/internal/MobilePopup/MobilePopupHeader/MobilePopupHeader.js +1 -1
- package/cjs/internal/MobilePopup/MobilePopupHeader/MobilePopupHeader.js.map +1 -1
- package/cjs/internal/PerformanceMetrics/PerformanceMetrics.js.map +1 -1
- package/cjs/internal/Popup/Popup.d.ts +11 -17
- package/cjs/internal/Popup/Popup.js +38 -19
- package/cjs/internal/Popup/Popup.js.map +1 -1
- package/cjs/internal/Popup/PopupHelper.d.ts +1 -1
- package/cjs/internal/Popup/PopupHelper.js.map +1 -1
- package/cjs/internal/Popup/PopupPin.d.ts +1 -1
- package/cjs/internal/Popup/PopupPin.js.map +1 -1
- package/cjs/internal/PopupMenu/PopupMenu.d.ts +8 -11
- package/cjs/internal/PopupMenu/PopupMenu.js +8 -1
- package/cjs/internal/PopupMenu/PopupMenu.js.map +1 -1
- package/cjs/internal/RenderLayer/RenderLayer.d.ts +5 -4
- package/cjs/internal/RenderLayer/RenderLayer.js +8 -2
- package/cjs/internal/RenderLayer/RenderLayer.js.map +1 -1
- package/cjs/internal/ThemePlayground/AnotherInputsPlayground.d.ts +11 -6
- package/cjs/internal/ThemePlayground/AnotherInputsPlayground.js +7 -0
- package/cjs/internal/ThemePlayground/AnotherInputsPlayground.js.map +1 -1
- package/cjs/internal/ThemePlayground/CurrencyInputPlayground.d.ts +7 -6
- package/cjs/internal/ThemePlayground/CurrencyInputPlayground.js +2 -3
- package/cjs/internal/ThemePlayground/CurrencyInputPlayground.js.map +1 -1
- package/cjs/internal/ThemePlayground/FxInputPlayground.d.ts +6 -4
- package/cjs/internal/ThemePlayground/FxInputPlayground.js +5 -5
- package/cjs/internal/ThemePlayground/FxInputPlayground.js.map +1 -1
- package/cjs/internal/ThemePlayground/HintPlayground.d.ts +1 -1
- package/cjs/internal/ThemePlayground/HintPlayground.js.map +1 -1
- package/cjs/internal/ThemePlayground/PagingPlayground.d.ts +6 -6
- package/cjs/internal/ThemePlayground/PagingPlayground.js +5 -2
- package/cjs/internal/ThemePlayground/PagingPlayground.js.map +1 -1
- package/cjs/internal/ThemePlayground/Playground.d.ts +1 -1
- package/cjs/internal/ThemePlayground/Playground.js.map +1 -1
- package/cjs/internal/ThemePlayground/SelectPlayground.d.ts +9 -6
- package/cjs/internal/ThemePlayground/SelectPlayground.js +6 -0
- package/cjs/internal/ThemePlayground/SelectPlayground.js.map +1 -1
- package/cjs/internal/ThemePlayground/SizesGroup.d.ts +2 -2
- package/cjs/internal/ThemePlayground/SizesGroup.js +2 -0
- package/cjs/internal/ThemePlayground/SizesGroup.js.map +1 -1
- package/cjs/internal/ThemePlayground/SwitcherPlayground.d.ts +9 -8
- package/cjs/internal/ThemePlayground/SwitcherPlayground.js +6 -1
- package/cjs/internal/ThemePlayground/SwitcherPlayground.js.map +1 -1
- package/cjs/internal/ThemePlayground/ThemeContextPlayground.js +14 -4
- package/cjs/internal/ThemePlayground/ThemeContextPlayground.js.map +1 -1
- package/cjs/internal/ThemePlayground/ThemeEditor.d.ts +1 -4
- package/cjs/internal/ThemePlayground/ThemeEditor.js.map +1 -1
- package/cjs/internal/ThemePlayground/TogglePlayground.d.ts +2 -7
- package/cjs/internal/ThemePlayground/TogglePlayground.js +4 -10
- package/cjs/internal/ThemePlayground/TogglePlayground.js.map +1 -1
- package/cjs/internal/ThemePlayground/TokenInputPlayground.d.ts +6 -4
- package/cjs/internal/ThemePlayground/TokenInputPlayground.js +3 -0
- package/cjs/internal/ThemePlayground/TokenInputPlayground.js.map +1 -1
- package/cjs/internal/ThemePlayground/VariableValue.d.ts +6 -8
- package/cjs/internal/ThemePlayground/VariableValue.js +6 -1
- package/cjs/internal/ThemePlayground/VariableValue.js.map +1 -1
- package/cjs/internal/ThemePlayground/helpers.d.ts +1 -1
- package/cjs/internal/ThemePlayground/helpers.js +4 -2
- package/cjs/internal/ThemePlayground/helpers.js.map +1 -1
- package/cjs/internal/ThemeShowcase/ThemeShowcase.js.map +1 -1
- package/cjs/internal/ZIndex/ZIndex.d.ts +7 -11
- package/cjs/internal/ZIndex/ZIndex.js +7 -7
- package/cjs/internal/ZIndex/ZIndex.js.map +1 -1
- package/cjs/internal/themes/DefaultTheme.js +1 -1
- package/cjs/internal/themes/DefaultTheme.js.map +1 -1
- package/cjs/lib/ConditionalHandler.js.map +1 -1
- package/cjs/lib/InstanceWithAnchorElement.d.ts +1 -1
- package/cjs/lib/InstanceWithAnchorElement.js.map +1 -1
- package/cjs/lib/ModalStack.js +2 -2
- package/cjs/lib/ModalStack.js.map +1 -1
- package/cjs/lib/SSRSafe.d.ts +2 -1
- package/cjs/lib/SSRSafe.js +9 -1
- package/cjs/lib/SSRSafe.js.map +1 -1
- package/cjs/lib/animation/index.js +1 -0
- package/cjs/lib/animation/index.js.map +1 -1
- package/cjs/lib/callChildRef/callChildRef.js +1 -1
- package/cjs/lib/callChildRef/callChildRef.js.map +1 -1
- package/cjs/lib/createPropsGetter.d.ts +2 -1
- package/cjs/lib/createPropsGetter.js +3 -0
- package/cjs/lib/createPropsGetter.js.map +1 -1
- package/cjs/lib/date/InternalDateCalculator.d.ts +1 -1
- package/cjs/lib/date/InternalDateCalculator.js +1 -1
- package/cjs/lib/date/InternalDateCalculator.js.map +1 -1
- package/cjs/lib/date/InternalDateValidator.d.ts +1 -1
- package/cjs/lib/date/InternalDateValidator.js +9 -2
- package/cjs/lib/date/InternalDateValidator.js.map +1 -1
- package/cjs/lib/extractKeyboardAction.d.ts +1 -1
- package/cjs/lib/extractKeyboardAction.js.map +1 -1
- package/cjs/lib/filterProps.js +0 -1
- package/cjs/lib/filterProps.js.map +1 -1
- package/cjs/lib/listenFocusOutside.d.ts +1 -1
- package/cjs/lib/listenFocusOutside.js.map +1 -1
- package/cjs/lib/locale/useLocaleForControl.d.ts +1 -1
- package/cjs/lib/locale/useLocaleForControl.js.map +1 -1
- package/cjs/lib/memo.d.ts +3 -1
- package/cjs/lib/memo.js +3 -3
- package/cjs/lib/memo.js.map +1 -1
- package/cjs/lib/net/fetch.js +2 -2
- package/cjs/lib/net/fetch.js.map +1 -1
- package/cjs/lib/reactGetTextContent.js +0 -1
- package/cjs/lib/reactGetTextContent.js.map +1 -1
- package/cjs/lib/rootNode/getRootNode.d.ts +3 -3
- package/cjs/lib/rootNode/getRootNode.js +7 -7
- package/cjs/lib/rootNode/getRootNode.js.map +1 -1
- package/cjs/lib/rootNode/rootNodeDecorator.d.ts +9 -9
- package/cjs/lib/rootNode/rootNodeDecorator.js.map +1 -1
- package/cjs/lib/styles/ColorFactory.js +2 -2
- package/cjs/lib/styles/ColorFactory.js.map +1 -1
- package/cjs/lib/styles/ColorFunctions.js.map +1 -1
- package/cjs/lib/theming/AnimationKeyframes.d.ts +3 -5
- package/cjs/lib/theming/AnimationKeyframes.js +8 -22
- package/cjs/lib/theming/AnimationKeyframes.js.map +1 -1
- package/cjs/lib/theming/Emotion.js +1 -0
- package/cjs/lib/theming/Emotion.js.map +1 -1
- package/cjs/lib/theming/ThemeFactory.d.ts +1 -1
- package/cjs/lib/theming/ThemeFactory.js +3 -1
- package/cjs/lib/theming/ThemeFactory.js.map +1 -1
- package/cjs/lib/theming/ThemeHelpers.d.ts +2 -2
- package/cjs/lib/theming/ThemeHelpers.js +1 -1
- package/cjs/lib/theming/ThemeHelpers.js.map +1 -1
- package/cjs/lib/utils.d.ts +3 -1
- package/cjs/lib/utils.js +5 -2
- package/cjs/lib/utils.js.map +1 -1
- package/cjs/lib/withClassWrapper.js +1 -4
- package/cjs/lib/withClassWrapper.js.map +1 -1
- package/cjs/typings/event-types.d.ts +2 -2
- package/components/Autocomplete/Autocomplete/Autocomplete.js +26 -13
- package/components/Autocomplete/Autocomplete/Autocomplete.js.map +1 -1
- package/components/Autocomplete/Autocomplete.d.ts +9 -17
- package/components/Button/Button/Button.js +11 -5
- package/components/Button/Button/Button.js.map +1 -1
- package/components/Button/Button.d.ts +4 -5
- package/components/Button/Button.mixins/Button.mixins.js +1 -1
- package/components/Button/Button.mixins/Button.mixins.js.map +1 -1
- package/components/Button/Button.styles/Button.styles.js +18 -18
- package/components/Button/Button.styles/Button.styles.js.map +1 -1
- package/components/Center/Center/Center.js +7 -5
- package/components/Center/Center/Center.js.map +1 -1
- package/components/Center/Center.d.ts +4 -3
- package/components/Checkbox/Checkbox/Checkbox.js +5 -2
- package/components/Checkbox/Checkbox/Checkbox.js.map +1 -1
- package/components/Checkbox/Checkbox.styles/Checkbox.styles.js +1 -1
- package/components/Checkbox/Checkbox.styles/Checkbox.styles.js.map +1 -1
- package/components/Checkbox/Checkbox.styles.d.ts +1 -1
- package/components/ComboBox/ComboBox/ComboBox.js +3 -1
- package/components/ComboBox/ComboBox/ComboBox.js.map +1 -1
- package/components/ComboBox/ComboBox.d.ts +8 -13
- package/components/CurrencyInput/CurrencyInput/CurrencyInput.js +36 -21
- package/components/CurrencyInput/CurrencyInput/CurrencyInput.js.map +1 -1
- package/components/CurrencyInput/CurrencyInput.d.ts +6 -9
- package/components/CurrencyInput/CurrencyInputKeyboardActions/CurrencyInputKeyboardActions.js +4 -2
- package/components/CurrencyInput/CurrencyInputKeyboardActions/CurrencyInputKeyboardActions.js.map +1 -1
- package/components/CurrencyInput/CurrencyInputKeyboardActions.d.ts +3 -1
- package/components/CurrencyLabel/CurrencyLabel/CurrencyLabel.js +21 -15
- package/components/CurrencyLabel/CurrencyLabel/CurrencyLabel.js.map +1 -1
- package/components/CurrencyLabel/CurrencyLabel.d.ts +3 -9
- package/components/DateInput/DateFragmentsView/DateFragmentsView.js +11 -1
- package/components/DateInput/DateFragmentsView/DateFragmentsView.js.map +1 -1
- package/components/DateInput/DateFragmentsView.d.ts +1 -1
- package/components/DateInput/DateInput/DateInput.js +18 -5
- package/components/DateInput/DateInput/DateInput.js.map +1 -1
- package/components/DateInput/DateInput.d.ts +9 -12
- package/components/DateInput/helpers/DateInputKeyboardActions/DateInputKeyboardActions.js +0 -1
- package/components/DateInput/helpers/DateInputKeyboardActions/DateInputKeyboardActions.js.map +1 -1
- package/components/DateInput/helpers/SelectionHelpers/SelectionHelpers.js +2 -2
- package/components/DateInput/helpers/SelectionHelpers/SelectionHelpers.js.map +1 -1
- package/components/DatePicker/DatePicker/DatePicker.js +25 -21
- package/components/DatePicker/DatePicker/DatePicker.js.map +1 -1
- package/components/DatePicker/DatePicker.d.ts +7 -9
- package/components/DatePicker/Picker/Picker.js +5 -1
- package/components/DatePicker/Picker/Picker.js.map +1 -1
- package/components/DropdownMenu/DropdownMenu/DropdownMenu.js +8 -2
- package/components/DropdownMenu/DropdownMenu/DropdownMenu.js.map +1 -1
- package/components/DropdownMenu/DropdownMenu.d.ts +5 -5
- package/components/FileUploader/FileUploader/FileUploader.js +2 -2
- package/components/FileUploader/FileUploader/FileUploader.js.map +1 -1
- package/components/FileUploader/FileUploader.md +8 -1
- package/components/FxInput/FxInput/FxInput.js +15 -10
- package/components/FxInput/FxInput/FxInput.js.map +1 -1
- package/components/FxInput/FxInput.d.ts +6 -6
- package/components/Gapped/Gapped/Gapped.js +17 -8
- package/components/Gapped/Gapped/Gapped.js.map +1 -1
- package/components/Gapped/Gapped.d.ts +7 -8
- package/components/GlobalLoader/GlobalLoader/GlobalLoader.js +35 -16
- package/components/GlobalLoader/GlobalLoader/GlobalLoader.js.map +1 -1
- package/components/GlobalLoader/GlobalLoader.d.ts +7 -14
- package/components/GlobalLoader/GlobalLoaderView/GlobalLoaderView.js.map +1 -1
- package/components/GlobalLoader/GlobalLoaderView.d.ts +2 -2
- package/components/Hint/Hint/Hint.js +30 -18
- package/components/Hint/Hint/Hint.js.map +1 -1
- package/components/Hint/Hint.d.ts +8 -12
- package/components/Hint/Hint.md +14 -0
- package/components/Input/Input/Input.js +13 -8
- package/components/Input/Input/Input.js.map +1 -1
- package/components/Input/Input.d.ts +4 -3
- package/components/Input/Input.md +5 -1
- package/components/Kebab/Kebab/Kebab.js +19 -8
- package/components/Kebab/Kebab/Kebab.js.map +1 -1
- package/components/Kebab/Kebab.d.ts +8 -15
- package/components/Link/Link/Link.js +10 -7
- package/components/Link/Link/Link.js.map +1 -1
- package/components/Link/Link.d.ts +5 -7
- package/components/Loader/Loader/Loader.js +22 -17
- package/components/Loader/Loader/Loader.js.map +1 -1
- package/components/Loader/Loader.d.ts +9 -5
- package/components/Loader/__stories__/LoaderAndButton/LoaderAndButton.js.map +1 -1
- package/components/MenuItem/MenuItem/MenuItem.js +4 -1
- package/components/MenuItem/MenuItem/MenuItem.js.map +1 -1
- package/components/Modal/Modal/Modal.js +5 -3
- package/components/Modal/Modal/Modal.js.map +1 -1
- package/components/Modal/Modal.d.ts +4 -3
- package/components/Modal/Modal.styles/Modal.styles.js +2 -2
- package/components/Modal/Modal.styles/Modal.styles.js.map +1 -1
- package/components/Modal/Modal.styles.d.ts +2 -2
- package/components/Modal/ModalBody/ModalBody.js +2 -2
- package/components/Modal/ModalBody/ModalBody.js.map +1 -1
- package/components/Paging/Paging/Paging.js +25 -15
- package/components/Paging/Paging/Paging.js.map +1 -1
- package/components/Paging/Paging.d.ts +7 -10
- package/components/Paging/PagingDefaultComponent/PagingDefaultComponent.js.map +1 -1
- package/components/Paging/PagingDefaultComponent.d.ts +3 -3
- package/components/PasswordInput/PasswordInput/PasswordInput.js +14 -13
- package/components/PasswordInput/PasswordInput/PasswordInput.js.map +1 -1
- package/components/PasswordInput/PasswordInput.d.ts +4 -3
- package/components/Radio/Radio/Radio.js +11 -6
- package/components/Radio/Radio/Radio.js.map +1 -1
- package/components/Radio/Radio.d.ts +4 -3
- package/components/RadioGroup/RadioGroup/RadioGroup.js +10 -10
- package/components/RadioGroup/RadioGroup/RadioGroup.js.map +1 -1
- package/components/RadioGroup/RadioGroup.d.ts +2 -4
- package/components/ResponsiveLayout/ResponsiveLayoutEvents/ResponsiveLayoutEvents.js +3 -1
- package/components/ResponsiveLayout/ResponsiveLayoutEvents/ResponsiveLayoutEvents.js.map +1 -1
- package/components/ScrollContainer/ScrollContainer/ScrollContainer.js +11 -7
- package/components/ScrollContainer/ScrollContainer/ScrollContainer.js.map +1 -1
- package/components/ScrollContainer/ScrollContainer.d.ts +7 -8
- package/components/ScrollContainer/ScrollContainer.helpers/ScrollContainer.helpers.js +4 -4
- package/components/ScrollContainer/ScrollContainer.helpers/ScrollContainer.helpers.js.map +1 -1
- package/components/Select/Item/Item.js.map +1 -1
- package/components/Select/Item.d.ts +4 -2
- package/components/Select/Select/Select.js +4 -3
- package/components/Select/Select/Select.js.map +1 -1
- package/components/Select/Select.d.ts +3 -12
- package/components/Select/Select.styles/Select.styles.js +4 -4
- package/components/Select/Select.styles/Select.styles.js.map +1 -1
- package/components/SidePage/SidePage/SidePage.js +14 -9
- package/components/SidePage/SidePage/SidePage.js.map +1 -1
- package/components/SidePage/SidePage.d.ts +5 -6
- package/components/SidePage/SidePageFooter/SidePageFooter.js.map +1 -1
- package/components/SidePage/SidePageFooter.d.ts +6 -4
- package/components/Spinner/Spinner/Spinner.js +8 -6
- package/components/Spinner/Spinner/Spinner.js.map +1 -1
- package/components/Spinner/Spinner.d.ts +4 -2
- package/components/Spinner/Spinner.styles/Spinner.styles.js +3 -3
- package/components/Spinner/Spinner.styles/Spinner.styles.js.map +1 -1
- package/components/Spinner/Spinner.styles.d.ts +1 -1
- package/components/Sticky/Sticky/Sticky.js +7 -4
- package/components/Sticky/Sticky/Sticky.js.map +1 -1
- package/components/Sticky/Sticky.d.ts +5 -4
- package/components/Tabs/Indicator/Indicator.js +1 -1
- package/components/Tabs/Indicator/Indicator.js.map +1 -1
- package/components/Tabs/Indicator.d.ts +1 -1
- package/components/Tabs/Tab/Tab.js +15 -7
- package/components/Tabs/Tab/Tab.js.map +1 -1
- package/components/Tabs/Tab.d.ts +4 -4
- package/components/Tabs/Tabs/Tabs.js +10 -8
- package/components/Tabs/Tabs/Tabs.js.map +1 -1
- package/components/Tabs/Tabs.d.ts +4 -4
- package/components/Textarea/Textarea/Textarea.js +23 -15
- package/components/Textarea/Textarea/Textarea.js.map +1 -1
- package/components/Textarea/Textarea.d.ts +8 -10
- package/components/Textarea/TextareaCounter/TextareaCounter.js.map +1 -1
- package/components/Textarea/TextareaCounter.d.ts +2 -2
- package/components/Toast/Toast/Toast.js +1 -1
- package/components/Toast/Toast/Toast.js.map +1 -1
- package/components/Toggle/Toggle/Toggle.js +12 -7
- package/components/Toggle/Toggle/Toggle.js.map +1 -1
- package/components/Toggle/Toggle.d.ts +5 -6
- package/components/TokenInput/TokenInput/TokenInput.js +107 -77
- package/components/TokenInput/TokenInput/TokenInput.js.map +1 -1
- package/components/TokenInput/TokenInput.d.ts +19 -16
- package/components/TokenInput/TokenInputMenu/TokenInputMenu.js +1 -1
- package/components/TokenInput/TokenInputMenu/TokenInputMenu.js.map +1 -1
- package/components/TokenInput/TokenInputMenu.d.ts +2 -1
- package/components/Tooltip/Tooltip/Tooltip.js +53 -32
- package/components/Tooltip/Tooltip/Tooltip.js.map +1 -1
- package/components/Tooltip/Tooltip.d.ts +12 -16
- package/components/TooltipMenu/TooltipMenu/TooltipMenu.js +15 -13
- package/components/TooltipMenu/TooltipMenu/TooltipMenu.js.map +1 -1
- package/components/TooltipMenu/TooltipMenu.d.ts +6 -5
- package/hooks/useEffectWithoutInitCall/useEffectWithoutInitCall.js +2 -2
- package/hooks/useEffectWithoutInitCall/useEffectWithoutInitCall.js.map +1 -1
- package/hooks/useEffectWithoutInitCall.d.ts +2 -2
- package/hooks/useMemoObject/useMemoObject.js.map +1 -1
- package/hooks/useMemoObject.d.ts +2 -1
- package/internal/BGRuler/BGRuler.js +11 -6
- package/internal/BGRuler/BGRuler.js.map +1 -1
- package/internal/BGRuler.d.ts +13 -15
- package/internal/Calendar/Calendar/Calendar.js +11 -5
- package/internal/Calendar/Calendar/Calendar.js.map +1 -1
- package/internal/Calendar/Calendar.d.ts +4 -13
- package/internal/Calendar/DayCellView.styles/DayCellView.styles.js +1 -1
- package/internal/Calendar/DayCellView.styles/DayCellView.styles.js.map +1 -1
- package/internal/Calendar/Month/Month.js +20 -11
- package/internal/Calendar/Month/Month.js.map +1 -1
- package/internal/Calendar/MonthViewModel.d.ts +1 -1
- package/internal/Calendar/config.d.ts +1 -8
- package/internal/CommonWrapper/CommonWrapper/CommonWrapper.js +3 -2
- package/internal/CommonWrapper/CommonWrapper/CommonWrapper.js.map +1 -1
- package/internal/CommonWrapper/CommonWrapper.d.ts +1 -1
- package/internal/ComponentCombinator/ComponentCombinator.js +8 -5
- package/internal/ComponentCombinator/ComponentCombinator.js.map +1 -1
- package/internal/ComponentCombinator.d.ts +6 -8
- package/internal/ComponentTable/ComponentTable.js +16 -4
- package/internal/ComponentTable/ComponentTable.js.map +1 -1
- package/internal/ComponentTable.d.ts +7 -8
- package/internal/CustomComboBox/ComboBoxMenu/ComboBoxMenu.js +18 -19
- package/internal/CustomComboBox/ComboBoxMenu/ComboBoxMenu.js.map +1 -1
- package/internal/CustomComboBox/ComboBoxMenu.d.ts +6 -6
- package/internal/CustomComboBox/ComboBoxView/ComboBoxView.js +21 -10
- package/internal/CustomComboBox/ComboBoxView/ComboBoxView.js.map +1 -1
- package/internal/CustomComboBox/ComboBoxView.d.ts +4 -12
- package/internal/CustomComboBox/CustomComboBoxReducer/CustomComboBoxReducer.js +4 -5
- package/internal/CustomComboBox/CustomComboBoxReducer/CustomComboBoxReducer.js.map +1 -1
- package/internal/DataTids/DataTids/DataTids.js.map +1 -1
- package/internal/DataTids/DataTids.d.ts +5 -5
- package/internal/DateSelect/DateSelect/DateSelect.js +15 -12
- package/internal/DateSelect/DateSelect/DateSelect.js.map +1 -1
- package/internal/DateSelect/DateSelect.d.ts +4 -6
- package/internal/DropdownContainer/DropdownContainer/DropdownContainer.js +6 -10
- package/internal/DropdownContainer/DropdownContainer/DropdownContainer.js.map +1 -1
- package/internal/DropdownContainer/DropdownContainer.d.ts +4 -7
- package/internal/FileUploaderControl/withFileUploaderControlProvider/withFileUploaderControlProvider.js.map +1 -1
- package/internal/FileUploaderControl/withFileUploaderControlProvider.d.ts +1 -1
- package/internal/HideBodyVerticalScroll/HideBodyVerticalScroll/HideBodyVerticalScroll.js +2 -1
- package/internal/HideBodyVerticalScroll/HideBodyVerticalScroll/HideBodyVerticalScroll.js.map +1 -1
- package/internal/InputLikeText/InputLikeText/InputLikeText.js +9 -4
- package/internal/InputLikeText/InputLikeText/InputLikeText.js.map +1 -1
- package/internal/InputLikeText/InputLikeText.d.ts +4 -3
- package/internal/InternalMenu/InternalMenu/InternalMenu.js +38 -17
- package/internal/InternalMenu/InternalMenu/InternalMenu.js.map +1 -1
- package/internal/InternalMenu/InternalMenu.d.ts +3 -9
- package/internal/MaskedInput/MaskedInput/MaskedInput.js +16 -7
- package/internal/MaskedInput/MaskedInput/MaskedInput.js.map +1 -1
- package/internal/MaskedInput/MaskedInput.d.ts +5 -2
- package/internal/Menu/Menu/Menu.js +16 -4
- package/internal/Menu/Menu/Menu.js.map +1 -1
- package/internal/Menu/Menu.d.ts +4 -7
- package/internal/MobilePopup/MobilePopup/MobilePopup.js +1 -1
- package/internal/MobilePopup/MobilePopup/MobilePopup.js.map +1 -1
- package/internal/MobilePopup/MobilePopupHeader/MobilePopupHeader/MobilePopupHeader.js +1 -1
- package/internal/MobilePopup/MobilePopupHeader/MobilePopupHeader/MobilePopupHeader.js.map +1 -1
- package/internal/PerformanceMetrics/PerformanceMetrics/PerformanceMetrics.js.map +1 -1
- package/internal/Popup/Popup/Popup.js +52 -35
- package/internal/Popup/Popup/Popup.js.map +1 -1
- package/internal/Popup/Popup.d.ts +11 -17
- package/internal/Popup/PopupHelper/PopupHelper.js.map +1 -1
- package/internal/Popup/PopupHelper.d.ts +1 -1
- package/internal/Popup/PopupPin/PopupPin.js.map +1 -1
- package/internal/Popup/PopupPin.d.ts +1 -1
- package/internal/PopupMenu/PopupMenu/PopupMenu.js +12 -4
- package/internal/PopupMenu/PopupMenu/PopupMenu.js.map +1 -1
- package/internal/PopupMenu/PopupMenu.d.ts +8 -11
- package/internal/RenderLayer/RenderLayer/RenderLayer.js +8 -4
- package/internal/RenderLayer/RenderLayer/RenderLayer.js.map +1 -1
- package/internal/RenderLayer/RenderLayer.d.ts +5 -4
- package/internal/ThemePlayground/AnotherInputsPlayground/AnotherInputsPlayground.js.map +1 -1
- package/internal/ThemePlayground/AnotherInputsPlayground.d.ts +11 -6
- package/internal/ThemePlayground/CurrencyInputPlayground/CurrencyInputPlayground.js.map +1 -1
- package/internal/ThemePlayground/CurrencyInputPlayground.d.ts +7 -6
- package/internal/ThemePlayground/FxInputPlayground/FxInputPlayground.js +10 -6
- package/internal/ThemePlayground/FxInputPlayground/FxInputPlayground.js.map +1 -1
- package/internal/ThemePlayground/FxInputPlayground.d.ts +6 -4
- package/internal/ThemePlayground/HintPlayground/HintPlayground.js.map +1 -1
- package/internal/ThemePlayground/HintPlayground.d.ts +1 -1
- package/internal/ThemePlayground/PagingPlayground/PagingPlayground.js +2 -2
- package/internal/ThemePlayground/PagingPlayground/PagingPlayground.js.map +1 -1
- package/internal/ThemePlayground/PagingPlayground.d.ts +6 -6
- package/internal/ThemePlayground/Playground/Playground.js.map +1 -1
- package/internal/ThemePlayground/Playground.d.ts +1 -1
- package/internal/ThemePlayground/SelectPlayground/SelectPlayground.js.map +1 -1
- package/internal/ThemePlayground/SelectPlayground.d.ts +9 -6
- package/internal/ThemePlayground/SizesGroup/SizesGroup.js.map +1 -1
- package/internal/ThemePlayground/SizesGroup.d.ts +2 -2
- package/internal/ThemePlayground/SwitcherPlayground/SwitcherPlayground.js.map +1 -1
- package/internal/ThemePlayground/SwitcherPlayground.d.ts +9 -8
- package/internal/ThemePlayground/ThemeContextPlayground/ThemeContextPlayground.js +13 -3
- package/internal/ThemePlayground/ThemeContextPlayground/ThemeContextPlayground.js.map +1 -1
- package/internal/ThemePlayground/ThemeEditor/ThemeEditor.js.map +1 -1
- package/internal/ThemePlayground/ThemeEditor.d.ts +1 -4
- package/internal/ThemePlayground/TogglePlayground/TogglePlayground.js +5 -17
- package/internal/ThemePlayground/TogglePlayground/TogglePlayground.js.map +1 -1
- package/internal/ThemePlayground/TogglePlayground.d.ts +2 -7
- package/internal/ThemePlayground/TokenInputPlayground/TokenInputPlayground.js.map +1 -1
- package/internal/ThemePlayground/TokenInputPlayground.d.ts +6 -4
- package/internal/ThemePlayground/VariableValue/VariableValue.js +4 -2
- package/internal/ThemePlayground/VariableValue/VariableValue.js.map +1 -1
- package/internal/ThemePlayground/VariableValue.d.ts +6 -8
- package/internal/ThemePlayground/helpers/helpers.js +0 -1
- package/internal/ThemePlayground/helpers/helpers.js.map +1 -1
- package/internal/ThemePlayground/helpers.d.ts +1 -1
- package/internal/ThemeShowcase/ThemeShowcase/ThemeShowcase.js.map +1 -1
- package/internal/ZIndex/ZIndex/ZIndex.js +21 -16
- package/internal/ZIndex/ZIndex/ZIndex.js.map +1 -1
- package/internal/ZIndex/ZIndex.d.ts +7 -11
- package/internal/themes/DefaultTheme/DefaultTheme.js +6 -6
- package/internal/themes/DefaultTheme/DefaultTheme.js.map +1 -1
- package/lib/ConditionalHandler/ConditionalHandler.js.map +1 -1
- package/lib/InstanceWithAnchorElement/InstanceWithAnchorElement.js.map +1 -1
- package/lib/InstanceWithAnchorElement.d.ts +1 -1
- package/lib/ModalStack/ModalStack.js +2 -2
- package/lib/ModalStack/ModalStack.js.map +1 -1
- package/lib/SSRSafe/SSRSafe.js +7 -0
- package/lib/SSRSafe/SSRSafe.js.map +1 -1
- package/lib/SSRSafe.d.ts +2 -1
- package/lib/animation/index/index.js +1 -1
- package/lib/animation/index/index.js.map +1 -1
- package/lib/callChildRef/callChildRef/callChildRef.js +1 -1
- package/lib/callChildRef/callChildRef/callChildRef.js.map +1 -1
- package/lib/createPropsGetter/createPropsGetter.js +1 -0
- package/lib/createPropsGetter/createPropsGetter.js.map +1 -1
- package/lib/createPropsGetter.d.ts +2 -1
- package/lib/date/InternalDateCalculator/InternalDateCalculator.js +1 -2
- package/lib/date/InternalDateCalculator/InternalDateCalculator.js.map +1 -1
- package/lib/date/InternalDateCalculator.d.ts +1 -1
- package/lib/date/InternalDateValidator/InternalDateValidator.js +8 -2
- package/lib/date/InternalDateValidator/InternalDateValidator.js.map +1 -1
- package/lib/date/InternalDateValidator.d.ts +1 -1
- package/lib/extractKeyboardAction/extractKeyboardAction.js.map +1 -1
- package/lib/extractKeyboardAction.d.ts +1 -1
- package/lib/filterProps/filterProps.js +0 -1
- package/lib/filterProps/filterProps.js.map +1 -1
- package/lib/listenFocusOutside/listenFocusOutside.js.map +1 -1
- package/lib/listenFocusOutside.d.ts +1 -1
- package/lib/locale/useLocaleForControl/useLocaleForControl.js.map +1 -1
- package/lib/locale/useLocaleForControl.d.ts +1 -1
- package/lib/memo/memo.js +2 -4
- package/lib/memo/memo.js.map +1 -1
- package/lib/memo.d.ts +3 -1
- package/lib/net/fetch/fetch.js +2 -2
- package/lib/net/fetch/fetch.js.map +1 -1
- package/lib/reactGetTextContent/reactGetTextContent.js +0 -1
- package/lib/reactGetTextContent/reactGetTextContent.js.map +1 -1
- package/lib/rootNode/getRootNode/getRootNode.js +8 -8
- package/lib/rootNode/getRootNode/getRootNode.js.map +1 -1
- package/lib/rootNode/getRootNode.d.ts +3 -3
- package/lib/rootNode/rootNodeDecorator/rootNodeDecorator.js.map +1 -1
- package/lib/rootNode/rootNodeDecorator.d.ts +9 -9
- package/lib/styles/ColorFactory/ColorFactory.js +3 -1
- package/lib/styles/ColorFactory/ColorFactory.js.map +1 -1
- package/lib/styles/ColorFunctions/ColorFunctions.js.map +1 -1
- package/lib/theming/AnimationKeyframes/AnimationKeyframes.js +8 -14
- package/lib/theming/AnimationKeyframes/AnimationKeyframes.js.map +1 -1
- package/lib/theming/AnimationKeyframes.d.ts +3 -5
- package/lib/theming/Emotion/Emotion.js.map +1 -1
- package/lib/theming/ThemeFactory/ThemeFactory.js +4 -1
- package/lib/theming/ThemeFactory/ThemeFactory.js.map +1 -1
- package/lib/theming/ThemeFactory.d.ts +1 -1
- package/lib/theming/ThemeHelpers/ThemeHelpers.js +1 -1
- package/lib/theming/ThemeHelpers/ThemeHelpers.js.map +1 -1
- package/lib/theming/ThemeHelpers.d.ts +2 -2
- package/lib/utils/utils.js +2 -2
- package/lib/utils/utils.js.map +1 -1
- package/lib/utils.d.ts +3 -1
- package/lib/withClassWrapper/withClassWrapper.js +1 -4
- package/lib/withClassWrapper/withClassWrapper.js.map +1 -1
- package/package.json +4 -4
- package/typings/event-types.d.ts +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.InternalMenuDataTids = exports.InternalMenu = void 0;var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _react = _interopRequireDefault(require("react"));
|
|
2
2
|
|
|
3
|
+
var _SSRSafe = require("../../lib/SSRSafe");
|
|
3
4
|
var _utils = require("../../lib/utils");
|
|
4
5
|
var _identifiers = require("../../lib/events/keyboard/identifiers");
|
|
5
6
|
var _ScrollContainer = require("../../components/ScrollContainer");
|
|
@@ -9,7 +10,7 @@ var _createPropsGetter = require("../../lib/createPropsGetter");
|
|
|
9
10
|
var _ThemeContext = require("../../lib/theming/ThemeContext");
|
|
10
11
|
|
|
11
12
|
var _Emotion = require("../../lib/theming/Emotion");
|
|
12
|
-
var
|
|
13
|
+
var _rootNode2 = require("../../lib/rootNode");
|
|
13
14
|
var _getDOMRect = require("../../lib/dom/getDOMRect");
|
|
14
15
|
|
|
15
16
|
var _InternalMenu = require("./InternalMenu.styles");
|
|
@@ -49,7 +50,6 @@ var InternalMenuDataTids = {
|
|
|
49
50
|
|
|
50
51
|
|
|
51
52
|
|
|
52
|
-
InternalMenu = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/function (_React$PureComponent) {(0, _inheritsLoose2.default)(InternalMenu, _React$PureComponent);function InternalMenu() {var _this;for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}_this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;_this.
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
|
|
@@ -57,13 +57,23 @@ InternalMenu = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/
|
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
|
|
60
|
+
InternalMenu = (0, _rootNode2.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/function (_React$PureComponent) {(0, _inheritsLoose2.default)(InternalMenu, _React$PureComponent);function InternalMenu() {var _this;for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}_this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;_this.
|
|
60
61
|
|
|
61
62
|
|
|
62
63
|
|
|
63
64
|
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
getProps = (0, _createPropsGetter.createPropsGetter)(InternalMenu.defaultProps);_this.
|
|
73
|
+
|
|
64
74
|
state = {
|
|
65
75
|
highlightedIndex: -1,
|
|
66
|
-
maxHeight: _this.
|
|
76
|
+
maxHeight: _this.getProps().maxHeight || 'none',
|
|
67
77
|
scrollState: 'top' };_this.
|
|
68
78
|
|
|
69
79
|
|
|
@@ -73,7 +83,7 @@ InternalMenu = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/
|
|
|
73
83
|
|
|
74
84
|
|
|
75
85
|
|
|
76
|
-
|
|
86
|
+
|
|
77
87
|
|
|
78
88
|
|
|
79
89
|
|
|
@@ -212,12 +222,16 @@ InternalMenu = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/
|
|
|
212
222
|
|
|
213
223
|
};_this.
|
|
214
224
|
|
|
215
|
-
focusOnRootElement = function () {
|
|
216
|
-
|
|
225
|
+
focusOnRootElement = function () {
|
|
226
|
+
var rootNode = (0, _rootNode2.getRootNode)((0, _assertThisInitialized2.default)(_this));
|
|
227
|
+
if ((0, _SSRSafe.isHTMLElement)(rootNode)) {
|
|
228
|
+
rootNode == null ? void 0 : rootNode.focus();
|
|
229
|
+
}
|
|
217
230
|
};_this.
|
|
218
231
|
|
|
219
232
|
shouldRecalculateMaxHeight = function (prevProps) {
|
|
220
|
-
var _this$props = _this.props,
|
|
233
|
+
var _this$props = _this.props,header = _this$props.header,footer = _this$props.footer,children = _this$props.children;
|
|
234
|
+
var maxHeight = _this.getProps().maxHeight;
|
|
221
235
|
var prevMaxHeight = prevProps.maxHeight;
|
|
222
236
|
var prevHeader = prevProps.header;
|
|
223
237
|
var prevFooter = prevProps.footer;
|
|
@@ -232,9 +246,9 @@ InternalMenu = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/
|
|
|
232
246
|
};_this.
|
|
233
247
|
|
|
234
248
|
calculateMaxHeight = function () {
|
|
235
|
-
var maxHeight = _this.
|
|
249
|
+
var maxHeight = _this.getProps().maxHeight;
|
|
236
250
|
var parsedMaxHeight = maxHeight;
|
|
237
|
-
var rootNode = (0,
|
|
251
|
+
var rootNode = (0, _rootNode2.getRootNode)((0, _assertThisInitialized2.default)(_this));
|
|
238
252
|
|
|
239
253
|
if (typeof maxHeight === 'string' && typeof window !== 'undefined' && rootNode) {
|
|
240
254
|
var rootElementMaxHeight = window.getComputedStyle(rootNode).maxHeight;
|
|
@@ -286,7 +300,11 @@ InternalMenu = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/
|
|
|
286
300
|
|
|
287
301
|
scrollToSelected = function () {
|
|
288
302
|
if (_this.scrollContainer && _this.highlighted) {
|
|
289
|
-
|
|
303
|
+
var _rootNode = (0, _rootNode2.getRootNode)(_this.highlighted);
|
|
304
|
+
// TODO: Remove this check once IF-647 is resolved
|
|
305
|
+
if (_rootNode instanceof HTMLElement) {
|
|
306
|
+
_this.scrollContainer.scrollTo(_rootNode);
|
|
307
|
+
}
|
|
290
308
|
}
|
|
291
309
|
};_this.
|
|
292
310
|
|
|
@@ -312,9 +330,13 @@ InternalMenu = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/
|
|
|
312
330
|
|
|
313
331
|
|
|
314
332
|
|
|
315
|
-
highlightItem = function (index) {
|
|
333
|
+
highlightItem = function (index) {
|
|
316
334
|
_this.setState({ highlightedIndex: index });
|
|
317
|
-
|
|
335
|
+
|
|
336
|
+
var rootNode = (0, _rootNode2.getRootNode)((0, _assertThisInitialized2.default)(_this));
|
|
337
|
+
if ((0, _SSRSafe.isHTMLElement)(rootNode)) {
|
|
338
|
+
rootNode == null ? void 0 : rootNode.focus();
|
|
339
|
+
}
|
|
318
340
|
};_this.
|
|
319
341
|
|
|
320
342
|
unhighlight = function () {
|
|
@@ -388,8 +410,8 @@ InternalMenu = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/
|
|
|
388
410
|
if (_this.state.scrollState !== scrollState) {
|
|
389
411
|
_this.setState({ scrollState: scrollState });
|
|
390
412
|
}
|
|
391
|
-
};return _this;}var _proto = InternalMenu.prototype;_proto.componentDidMount = function componentDidMount() {this.setInitialSelection();this.calculateMaxHeight();};_proto.componentDidUpdate = function componentDidUpdate(prevProps) {if (this.shouldRecalculateMaxHeight(prevProps)) {this.calculateMaxHeight();}if (prevProps.maxHeight !== this.
|
|
392
|
-
originalRef.current = menuItem;}};_proto.select = function select(index, shouldHandleHref, event) {var item = childrenToArray(this.props.children)[index];if ((0, _isActiveElement.isActiveElement)(item)) {if (shouldHandleHref && item.props.href) {if (item.props.target) {window.open(item.props.href, item.props.target);} else {location.href = item.props.href;}}if (item.props.onClick) {item.props.onClick(event);}if (this.props.onItemClick) {this.props.onItemClick(event);}return true;}return false;};_proto.move = function move(step) {this.setState(function (state, props) {var children = childrenToArray(props.children);if (!children.some(_isActiveElement.isActiveElement)) {return null;}var index = state.highlightedIndex;do {index += step;if (!
|
|
413
|
+
};return _this;}var _proto = InternalMenu.prototype;_proto.componentDidMount = function componentDidMount() {this.setInitialSelection();this.calculateMaxHeight();};_proto.componentDidUpdate = function componentDidUpdate(prevProps) {if (this.shouldRecalculateMaxHeight(prevProps)) {this.calculateMaxHeight();}if (prevProps.maxHeight !== this.getProps().maxHeight) {this.setState({ maxHeight: this.props.maxHeight || 'none' });}};_proto.focus = function focus() {this.focusOnRootElement();};_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = theme;return _this2.renderMain();});};_proto.renderMain = function renderMain() {var _cx3,_this3 = this;var enableIconPadding = _react.default.Children.toArray(this.props.children).some(function (x) {return /*#__PURE__*/_react.default.isValidElement(x) && x.props.icon;});if (this.isEmpty()) {return null;}var _this$getProps = this.getProps(),hasShadow = _this$getProps.hasShadow,width = _this$getProps.width,maxHeight = _this$getProps.maxHeight,preventWindowScroll = _this$getProps.preventWindowScroll;return /*#__PURE__*/_react.default.createElement("div", { "data-tid": InternalMenuDataTids.root, className: (0, _Emotion.cx)((_cx3 = {}, _cx3[_InternalMenu.styles.root(this.theme)] = true, _cx3[_InternalMenu.styles.shadow(this.theme)] = hasShadow, _cx3)), style: { width: width, maxHeight: this.state.maxHeight }, onKeyDown: this.handleKeyDown, ref: this.setRootNode, tabIndex: 0 }, this.props.header ? this.renderHeader() : null, /*#__PURE__*/_react.default.createElement(_ScrollContainer.ScrollContainer, { ref: this.refScrollContainer, maxHeight: maxHeight, preventWindowScroll: preventWindowScroll, onScrollStateChange: this.handleScrollStateChange }, _react.default.Children.map(this.props.children, function (child, index) {if (typeof child === 'string' || typeof child === 'number' || (0, _utils.isNullable)(child)) {return child;}if ( /*#__PURE__*/_react.default.isValidElement(child) && typeof child.type === 'string') {return child;}var modifiedChild = (0, _addIconPaddingIfPartOfMenu.addIconPaddingIfPartOfMenu)(child, enableIconPadding);if ((0, _isActiveElement.isActiveElement)(modifiedChild)) {var highlight = _this3.state.highlightedIndex === index;var ref = modifiedChild.ref;var originalRef = ref;if (highlight) {ref = function ref(menuItem) {return _this3.refHighlighted(originalRef, menuItem);};}return /*#__PURE__*/_react.default.cloneElement(modifiedChild, { ref: ref, state: highlight ? 'hover' : modifiedChild.props.state, onClick: _this3.select.bind(_this3, index, false), onMouseEnter: function onMouseEnter(event) {_this3.highlightItem(index);if ((0, _MenuItem.isMenuItem)(modifiedChild) && modifiedChild.props.onMouseEnter) {modifiedChild.props.onMouseEnter(event);}}, onMouseLeave: function onMouseLeave(event) {_this3.unhighlight();if ((0, _MenuItem.isMenuItem)(modifiedChild) && modifiedChild.props.onMouseLeave) {modifiedChild.props.onMouseLeave(event);}} });}return modifiedChild;})), this.props.footer ? this.renderFooter() : null);};_proto.refHighlighted = function refHighlighted(originalRef, menuItem) {this.highlighted = menuItem;if (!originalRef || typeof originalRef === 'string') {return;}if (typeof originalRef === 'function') {originalRef(menuItem);} else if (typeof originalRef === 'object') {// @ts-expect-error: See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31065.
|
|
414
|
+
originalRef.current = menuItem;}};_proto.select = function select(index, shouldHandleHref, event) {var item = childrenToArray(this.props.children)[index];if ((0, _isActiveElement.isActiveElement)(item)) {if (shouldHandleHref && item.props.href) {if (item.props.target) {window.open(item.props.href, item.props.target);} else {location.href = item.props.href;}}if (item.props.onClick) {item.props.onClick(event);}if (this.props.onItemClick) {this.props.onItemClick(event);}return true;}return false;};_proto.move = function move(step) {var _this4 = this;this.setState(function (state, props) {var children = childrenToArray(props.children);if (!children.some(_isActiveElement.isActiveElement)) {return null;}var index = state.highlightedIndex;do {index += step;if (!_this4.getProps().cyclicSelection && (index < 0 || index > children.length)) {return null;}if (index < 0) {index = children.length - 1;} else if (index > children.length) {index = 0;}var child = children[index];if ((0, _isActiveElement.isActiveElement)(child)) {return { highlightedIndex: index };}} while (index !== state.highlightedIndex);return null;}, this.scrollToSelected);};_proto.isEmpty = function isEmpty() {var children = this.props.children;return !children || !childrenToArray(children).filter(_utils.isNonNullable).length;};return InternalMenu;}(_react.default.PureComponent), _class2.__KONTUR_REACT_UI__ = 'InternalMenu', _class2.defaultProps = { width: 'auto', maxHeight: 300, hasShadow: true, preventWindowScroll: true, cyclicSelection: true, initialSelectedItemIndex: -1 }, _temp)) || _class;exports.InternalMenu = InternalMenu;
|
|
393
415
|
|
|
394
416
|
function childrenToArray(children) {
|
|
395
417
|
var ret = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["InternalMenu.tsx"],"names":["InternalMenuDataTids","root","InternalMenu","rootNode","state","highlightedIndex","maxHeight","props","scrollState","getProps","defaultProps","renderHeader","el","header","styles","fixedHeader","renderFooter","footer","fixedFooter","focusOnRootElement","focus","shouldRecalculateMaxHeight","prevProps","children","prevMaxHeight","prevHeader","prevFooter","prevChildrenCount","React","Children","count","calculateMaxHeight","parsedMaxHeight","window","rootElementMaxHeight","getComputedStyle","parseFloat","calculatedMaxHeight","height","setState","setInitialSelection","i","initialSelectedItemIndex","moveDown","refScrollContainer","scrollContainer","scrollToSelected","highlighted","scrollTo","highlightItem","index","unhighlight","moveUp","move","handleKeyDown","e","onKeyDown","defaultPrevented","preventDefault","onClick","handleScrollStateChange","componentDidMount","componentDidUpdate","render","theme","renderMain","enableIconPadding","toArray","some","x","isValidElement","icon","isEmpty","shadow","hasShadow","width","setRootNode","preventWindowScroll","map","child","type","modifiedChild","highlight","ref","originalRef","menuItem","refHighlighted","cloneElement","select","bind","onMouseEnter","event","onMouseLeave","current","shouldHandleHref","item","childrenToArray","href","target","open","location","onItemClick","step","isActiveElement","cyclicSelection","length","filter","isNonNullable","PureComponent","__KONTUR_REACT_UI__","ret","forEach","push"],"mappings":"qYAAA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,0E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BO,IAAMA,oBAAoB,GAAG;AAClCC,EAAAA,IAAI,EAAE,oBAD4B,EAA7B,C;;;;AAKMC,Y,OADZC,kB;;;;;;;;;;;;AAaQC,IAAAA,K,GAAmB;AACxBC,MAAAA,gBAAgB,EAAE,CAAC,CADK;AAExBC,MAAAA,SAAS,EAAE,MAAKC,KAAL,CAAWD,SAAX,IAAwB,MAFX;AAGxBE,MAAAA,WAAW,EAAE,KAHW,E;;;;;;;;;AAYlBC,IAAAA,Q,GAAW,0CAAkBP,YAAY,CAACQ,YAA/B,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AACwD,KAAD,EAAW;AAC1C+B,IAAAA,GAAG,CAACE,IAAJ,CAASjC,KAAT;AACD,GAFD;AAGA,SAAO+B,GAAP;AACD","sourcesContent":["import React from 'react';\n\nimport { isNonNullable, isNullable } from '../../lib/utils';\nimport { isKeyArrowDown, isKeyArrowUp, isKeyEnter } from '../../lib/events/keyboard/identifiers';\nimport { ScrollContainer, ScrollContainerScrollState } from '../../components/ScrollContainer';\nimport { isMenuItem, MenuItem, MenuItemProps } from '../../components/MenuItem';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\nimport { Nullable } from '../../typings/utility-types';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { cx } from '../../lib/theming/Emotion';\nimport { getRootNode, rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { getDOMRect } from '../../lib/dom/getDOMRect';\n\nimport { styles } from './InternalMenu.styles';\nimport { isActiveElement } from './isActiveElement';\nimport { addIconPaddingIfPartOfMenu } from './addIconPaddingIfPartOfMenu';\n\ninterface MenuProps {\n children?: React.ReactNode;\n hasShadow?: boolean;\n /**\n * Максимальная высота применяется только для скролл контейнера\n *\n * Высота `header` и `footer` в нее не включены\n */\n maxHeight?: number | string;\n onItemClick?: (event: React.SyntheticEvent<HTMLElement>) => void;\n width?: number | string;\n preventWindowScroll?: boolean;\n onKeyDown?: (event: React.KeyboardEvent<HTMLElement>) => void;\n\n header?: React.ReactNode;\n footer?: React.ReactNode;\n\n // Циклический перебор айтемов меню (по-дефолтну включен)\n cyclicSelection?: boolean;\n initialSelectedItemIndex?: number;\n}\n\ninterface MenuState {\n highlightedIndex: number;\n maxHeight: number | string;\n scrollState: ScrollContainerScrollState;\n}\n\nexport const InternalMenuDataTids = {\n root: 'InternalMenu__root',\n} as const;\n\n@rootNode\nexport class InternalMenu extends React.PureComponent<MenuProps, MenuState> {\n public static __KONTUR_REACT_UI__ = 'InternalMenu';\n\n public static defaultProps = {\n width: 'auto',\n maxHeight: 300,\n hasShadow: true,\n preventWindowScroll: true,\n cyclicSelection: true,\n initialSelectedItemIndex: -1,\n };\n\n public state: MenuState = {\n highlightedIndex: -1,\n maxHeight: this.props.maxHeight || 'none',\n scrollState: 'top',\n };\n\n private theme!: Theme;\n private scrollContainer: Nullable<ScrollContainer>;\n private highlighted: Nullable<MenuItem>;\n private setRootNode!: TSetRootNode;\n private header: Nullable<HTMLDivElement>;\n private footer: Nullable<HTMLDivElement>;\n private getProps = createPropsGetter(InternalMenu.defaultProps);\n\n public componentDidMount() {\n this.setInitialSelection();\n this.calculateMaxHeight();\n }\n\n public componentDidUpdate(prevProps: MenuProps) {\n if (this.shouldRecalculateMaxHeight(prevProps)) {\n this.calculateMaxHeight();\n }\n\n if (prevProps.maxHeight !== this.props.maxHeight) {\n this.setState({\n maxHeight: this.props.maxHeight || 'none',\n });\n }\n }\n\n public focus() {\n this.focusOnRootElement();\n }\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private renderMain() {\n const enableIconPadding = React.Children.toArray(this.props.children).some(\n (x) => React.isValidElement(x) && x.props.icon,\n );\n\n if (this.isEmpty()) {\n return null;\n }\n\n return (\n <div\n data-tid={InternalMenuDataTids.root}\n className={cx({\n [styles.root(this.theme)]: true,\n [styles.shadow(this.theme)]: this.props.hasShadow,\n })}\n style={{\n width: this.props.width,\n maxHeight: this.state.maxHeight,\n }}\n onKeyDown={this.handleKeyDown}\n ref={this.setRootNode}\n tabIndex={0}\n >\n {this.props.header ? this.renderHeader() : null}\n <ScrollContainer\n ref={this.refScrollContainer}\n maxHeight={this.props.maxHeight}\n preventWindowScroll={this.props.preventWindowScroll}\n onScrollStateChange={this.handleScrollStateChange}\n >\n {React.Children.map(this.props.children, (child, index) => {\n if (typeof child === 'string' || typeof child === 'number' || isNullable(child)) {\n return child;\n }\n if (React.isValidElement(child) && typeof child.type === 'string') {\n return child;\n }\n\n const modifiedChild = addIconPaddingIfPartOfMenu(child, enableIconPadding);\n\n if (isActiveElement(modifiedChild)) {\n const highlight = this.state.highlightedIndex === index;\n\n let ref = modifiedChild.ref;\n const originalRef = ref;\n if (highlight) {\n ref = (menuItem) => this.refHighlighted(originalRef, menuItem);\n }\n\n return React.cloneElement<MenuItemProps, MenuItem>(modifiedChild, {\n ref,\n state: highlight ? 'hover' : modifiedChild.props.state,\n onClick: this.select.bind(this, index, false),\n onMouseEnter: (event) => {\n this.highlightItem(index);\n if (isMenuItem(modifiedChild) && modifiedChild.props.onMouseEnter) {\n modifiedChild.props.onMouseEnter(event);\n }\n },\n onMouseLeave: (event) => {\n this.unhighlight();\n if (isMenuItem(modifiedChild) && modifiedChild.props.onMouseLeave) {\n modifiedChild.props.onMouseLeave(event);\n }\n },\n });\n }\n\n return modifiedChild;\n })}\n </ScrollContainer>\n {this.props.footer ? this.renderFooter() : null}\n </div>\n );\n }\n\n private renderHeader = () => {\n return (\n <div\n ref={(el) => (this.header = el)}\n className={cx({\n [styles.header()]: true,\n [styles.fixedHeader()]: this.state.scrollState !== 'top',\n })}\n >\n {this.props.header}\n </div>\n );\n };\n\n private renderFooter = () => {\n return (\n <div\n ref={(el) => (this.footer = el)}\n className={cx({\n [styles.footer()]: true,\n [styles.fixedFooter()]: this.state.scrollState !== 'bottom',\n })}\n >\n {this.props.footer}\n </div>\n );\n };\n\n private focusOnRootElement = (): void => {\n getRootNode(this)?.focus();\n };\n\n private shouldRecalculateMaxHeight = (prevProps: MenuProps): boolean => {\n const { maxHeight, header, footer, children } = this.props;\n const prevMaxHeight = prevProps.maxHeight;\n const prevHeader = prevProps.header;\n const prevFooter = prevProps.footer;\n const prevChildrenCount = React.Children.count(prevProps.children);\n\n return (\n maxHeight !== prevMaxHeight ||\n footer !== prevFooter ||\n header !== prevHeader ||\n React.Children.count(children) !== prevChildrenCount\n );\n };\n\n private calculateMaxHeight = () => {\n const { maxHeight } = this.props;\n let parsedMaxHeight = maxHeight;\n const rootNode = getRootNode(this);\n\n if (typeof maxHeight === 'string' && typeof window !== 'undefined' && rootNode) {\n const rootElementMaxHeight = window.getComputedStyle(rootNode).maxHeight;\n\n if (rootElementMaxHeight) {\n parsedMaxHeight = parseFloat(rootElementMaxHeight);\n }\n }\n\n const calculatedMaxHeight =\n typeof parsedMaxHeight === 'number'\n ? parsedMaxHeight +\n ((this.header && getDOMRect(this.header).height) || 0) +\n ((this.footer && getDOMRect(this.footer).height) || 0)\n : maxHeight;\n\n this.setState({\n maxHeight: calculatedMaxHeight || 'none',\n });\n };\n\n private setInitialSelection = () => {\n for (let i = this.getProps().initialSelectedItemIndex; i > -1; i--) {\n this.moveDown();\n }\n };\n\n private refScrollContainer = (scrollContainer: Nullable<ScrollContainer>) => {\n this.scrollContainer = scrollContainer;\n };\n\n private refHighlighted(\n originalRef: string | ((instance: MenuItem | null) => void) | React.RefObject<MenuItem> | null | undefined,\n menuItem: MenuItem | null,\n ) {\n this.highlighted = menuItem;\n\n if (!originalRef || typeof originalRef === 'string') {\n return;\n }\n\n if (typeof originalRef === 'function') {\n originalRef(menuItem);\n } else if (typeof originalRef === 'object') {\n // @ts-ignore see issue https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31065\n originalRef.current = menuItem;\n }\n }\n\n private scrollToSelected = () => {\n if (this.scrollContainer && this.highlighted) {\n this.scrollContainer.scrollTo(getRootNode(this.highlighted));\n }\n };\n\n private select(index: number, shouldHandleHref: boolean, event: React.SyntheticEvent<HTMLElement>): boolean {\n const item = childrenToArray(this.props.children)[index];\n\n if (isActiveElement(item)) {\n if (shouldHandleHref && item.props.href) {\n if (item.props.target) {\n window.open(item.props.href, item.props.target);\n } else {\n location.href = item.props.href;\n }\n }\n if (item.props.onClick) {\n item.props.onClick(event as React.MouseEvent<HTMLElement>);\n }\n if (this.props.onItemClick) {\n this.props.onItemClick(event);\n }\n return true;\n }\n return false;\n }\n\n private highlightItem = (index: number): void => {\n this.setState({ highlightedIndex: index });\n getRootNode(this)?.focus();\n };\n\n private unhighlight = () => {\n this.setState({ highlightedIndex: -1 });\n };\n\n private move(step: number) {\n this.setState((state, props) => {\n const children = childrenToArray(props.children);\n if (!children.some(isActiveElement)) {\n return null;\n }\n let index = state.highlightedIndex;\n do {\n index += step;\n if (!props.cyclicSelection && (index < 0 || index > children.length)) {\n return null;\n }\n\n if (index < 0) {\n index = children.length - 1;\n } else if (index > children.length) {\n index = 0;\n }\n\n const child = children[index];\n if (isActiveElement(child)) {\n return { highlightedIndex: index };\n }\n } while (index !== state.highlightedIndex);\n return null;\n }, this.scrollToSelected);\n }\n\n private moveUp = () => {\n this.move(-1);\n };\n\n private moveDown = () => {\n this.move(1);\n };\n\n private isEmpty() {\n const { children } = this.props;\n return !children || !childrenToArray(children).filter(isNonNullable).length;\n }\n\n private handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>): void => {\n if (typeof this.props.onKeyDown === 'function') {\n this.props.onKeyDown(e);\n }\n\n if (e.defaultPrevented) {\n return;\n }\n\n if (isKeyArrowUp(e)) {\n e.preventDefault();\n this.moveUp();\n } else if (isKeyArrowDown(e)) {\n e.preventDefault();\n this.moveDown();\n } else if (isKeyEnter(e)) {\n if (this.highlighted && this.highlighted.props.onClick) {\n this.highlighted.props.onClick(e);\n }\n }\n };\n\n private handleScrollStateChange = (scrollState: ScrollContainerScrollState) => {\n if (this.state.scrollState !== scrollState) {\n this.setState({ scrollState });\n }\n };\n}\n\nfunction childrenToArray(children: React.ReactNode): React.ReactNode[] {\n const ret: React.ReactNode[] = [];\n // Use forEach instead of map to avoid cloning for key unifying.\n React.Children.forEach(children, (child) => {\n ret.push(child);\n });\n return ret;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["InternalMenu.tsx"],"names":["InternalMenuDataTids","root","InternalMenu","rootNode","getProps","defaultProps","state","highlightedIndex","maxHeight","scrollState","renderHeader","el","header","styles","fixedHeader","props","renderFooter","footer","fixedFooter","focusOnRootElement","focus","shouldRecalculateMaxHeight","prevProps","children","prevMaxHeight","prevHeader","prevFooter","prevChildrenCount","React","Children","count","calculateMaxHeight","parsedMaxHeight","window","rootElementMaxHeight","getComputedStyle","parseFloat","calculatedMaxHeight","height","setState","setInitialSelection","i","initialSelectedItemIndex","moveDown","refScrollContainer","scrollContainer","scrollToSelected","highlighted","HTMLElement","scrollTo","highlightItem","index","unhighlight","moveUp","move","handleKeyDown","e","onKeyDown","defaultPrevented","preventDefault","onClick","handleScrollStateChange","componentDidMount","componentDidUpdate","render","theme","renderMain","enableIconPadding","toArray","some","x","isValidElement","icon","isEmpty","hasShadow","width","preventWindowScroll","shadow","setRootNode","map","child","type","modifiedChild","highlight","ref","originalRef","menuItem","refHighlighted","cloneElement","select","bind","onMouseEnter","event","onMouseLeave","current","shouldHandleHref","item","childrenToArray","href","target","open","location","onItemClick","step","isActiveElement","cyclicSelection","length","filter","isNonNullable","PureComponent","__KONTUR_REACT_UI__","ret","forEach","push"],"mappings":"qYAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,0E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BO,IAAMA,oBAAoB,GAAG;AAClCC,EAAAA,IAAI,EAAE,oBAD4B,EAA7B,C;;;;;;;;;;;AAYMC,Y,OADZC,mB;;;;;;;;;;;;AAaSC,IAAAA,Q,GAAW,0CAAkBF,YAAY,CAACG,YAA/B,C;;AAEZC,IAAAA,K,GAAmB;AACxBC,MAAAA,gBAAgB,EAAE,CAAC,CADK;AAExBC,MAAAA,SAAS,EAAE,MAAKJ,QAAL,GAAgBI,SAAhB,IAA6B,MAFhB;AAGxBC,MAAAA,WAAW,EAAE,KAHW,E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2HlBC,IAAAA,Y,GAAe,YAAM;AAC3B;AACE;A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sB,c,UAEtBzG,Y,GAA6B,EACzCsE,KAAK,EAAE,MADkC,EAEzCnE,SAAS,EAAE,GAF8B,EAGzCkE,SAAS,EAAE,IAH8B,EAIzCE,mBAAmB,EAAE,IAJoB,EAKzC6B,eAAe,EAAE,IALwB,EAMzC/D,wBAAwB,EAAE,CAAC,CANc,E;;AAiW7C,SAASuD,eAAT,CAAyB1E,QAAzB,EAAuE;AACrE,MAAMwF,GAAsB,GAAG,EAA/B;AACA;AACAnF,iBAAMC,QAAN,CAAemF,OAAf,CAAuBzF,QAAvB,EAAiC,UAACyD,KAAD,EAAW;AAC1C+B,IAAAA,GAAG,CAACE,IAAJ,CAASjC,KAAT;AACD,GAFD;AAGA,SAAO+B,GAAP;AACD","sourcesContent":["import React from 'react';\n\nimport { isHTMLElement } from '../../lib/SSRSafe';\nimport { isNonNullable, isNullable } from '../../lib/utils';\nimport { isKeyArrowDown, isKeyArrowUp, isKeyEnter } from '../../lib/events/keyboard/identifiers';\nimport { ScrollContainer, ScrollContainerScrollState } from '../../components/ScrollContainer';\nimport { isMenuItem, MenuItem, MenuItemProps } from '../../components/MenuItem';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\nimport { Nullable } from '../../typings/utility-types';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { cx } from '../../lib/theming/Emotion';\nimport { getRootNode, rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { getDOMRect } from '../../lib/dom/getDOMRect';\n\nimport { styles } from './InternalMenu.styles';\nimport { isActiveElement } from './isActiveElement';\nimport { addIconPaddingIfPartOfMenu } from './addIconPaddingIfPartOfMenu';\n\ninterface MenuProps {\n children?: React.ReactNode;\n hasShadow?: boolean;\n /**\n * Максимальная высота применяется только для скролл контейнера\n *\n * Высота `header` и `footer` в нее не включены\n */\n maxHeight?: number | string;\n onItemClick?: (event: React.SyntheticEvent<HTMLElement>) => void;\n width?: number | string;\n preventWindowScroll?: boolean;\n onKeyDown?: (event: React.KeyboardEvent<HTMLElement>) => void;\n\n header?: React.ReactNode;\n footer?: React.ReactNode;\n\n // Циклический перебор айтемов меню (по-дефолтну включен)\n cyclicSelection?: boolean;\n initialSelectedItemIndex?: number;\n}\n\ninterface MenuState {\n highlightedIndex: number;\n maxHeight: number | string;\n scrollState: ScrollContainerScrollState;\n}\n\nexport const InternalMenuDataTids = {\n root: 'InternalMenu__root',\n} as const;\n\ntype DefaultProps = Required<\n Pick<\n MenuProps,\n 'width' | 'maxHeight' | 'hasShadow' | 'preventWindowScroll' | 'cyclicSelection' | 'initialSelectedItemIndex'\n >\n>;\n\n@rootNode\nexport class InternalMenu extends React.PureComponent<MenuProps, MenuState> {\n public static __KONTUR_REACT_UI__ = 'InternalMenu';\n\n public static defaultProps: DefaultProps = {\n width: 'auto',\n maxHeight: 300,\n hasShadow: true,\n preventWindowScroll: true,\n cyclicSelection: true,\n initialSelectedItemIndex: -1,\n };\n\n private getProps = createPropsGetter(InternalMenu.defaultProps);\n\n public state: MenuState = {\n highlightedIndex: -1,\n maxHeight: this.getProps().maxHeight || 'none',\n scrollState: 'top',\n };\n\n private theme!: Theme;\n private scrollContainer: Nullable<ScrollContainer>;\n private highlighted: Nullable<MenuItem>;\n private setRootNode!: TSetRootNode;\n private header: Nullable<HTMLDivElement>;\n private footer: Nullable<HTMLDivElement>;\n\n public componentDidMount() {\n this.setInitialSelection();\n this.calculateMaxHeight();\n }\n\n public componentDidUpdate(prevProps: MenuProps) {\n if (this.shouldRecalculateMaxHeight(prevProps)) {\n this.calculateMaxHeight();\n }\n\n if (prevProps.maxHeight !== this.getProps().maxHeight) {\n this.setState({\n maxHeight: this.props.maxHeight || 'none',\n });\n }\n }\n\n public focus() {\n this.focusOnRootElement();\n }\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private renderMain() {\n const enableIconPadding = React.Children.toArray(this.props.children).some(\n (x) => React.isValidElement(x) && x.props.icon,\n );\n\n if (this.isEmpty()) {\n return null;\n }\n const { hasShadow, width, maxHeight, preventWindowScroll } = this.getProps();\n\n return (\n <div\n data-tid={InternalMenuDataTids.root}\n className={cx({\n [styles.root(this.theme)]: true,\n [styles.shadow(this.theme)]: hasShadow,\n })}\n style={{\n width,\n maxHeight: this.state.maxHeight,\n }}\n onKeyDown={this.handleKeyDown}\n ref={this.setRootNode}\n tabIndex={0}\n >\n {this.props.header ? this.renderHeader() : null}\n <ScrollContainer\n ref={this.refScrollContainer}\n maxHeight={maxHeight}\n preventWindowScroll={preventWindowScroll}\n onScrollStateChange={this.handleScrollStateChange}\n >\n {React.Children.map(this.props.children, (child, index) => {\n if (typeof child === 'string' || typeof child === 'number' || isNullable(child)) {\n return child;\n }\n if (React.isValidElement(child) && typeof child.type === 'string') {\n return child;\n }\n\n const modifiedChild = addIconPaddingIfPartOfMenu(child, enableIconPadding);\n\n if (isActiveElement(modifiedChild)) {\n const highlight = this.state.highlightedIndex === index;\n\n let ref = modifiedChild.ref;\n const originalRef = ref;\n if (highlight) {\n ref = (menuItem) => this.refHighlighted(originalRef, menuItem);\n }\n\n return React.cloneElement<MenuItemProps, MenuItem>(modifiedChild, {\n ref,\n state: highlight ? 'hover' : modifiedChild.props.state,\n onClick: this.select.bind(this, index, false),\n onMouseEnter: (event) => {\n this.highlightItem(index);\n if (isMenuItem(modifiedChild) && modifiedChild.props.onMouseEnter) {\n modifiedChild.props.onMouseEnter(event);\n }\n },\n onMouseLeave: (event) => {\n this.unhighlight();\n if (isMenuItem(modifiedChild) && modifiedChild.props.onMouseLeave) {\n modifiedChild.props.onMouseLeave(event);\n }\n },\n });\n }\n\n return modifiedChild;\n })}\n </ScrollContainer>\n {this.props.footer ? this.renderFooter() : null}\n </div>\n );\n }\n\n private renderHeader = () => {\n return (\n <div\n ref={(el) => (this.header = el)}\n className={cx({\n [styles.header()]: true,\n [styles.fixedHeader()]: this.state.scrollState !== 'top',\n })}\n >\n {this.props.header}\n </div>\n );\n };\n\n private renderFooter = () => {\n return (\n <div\n ref={(el) => (this.footer = el)}\n className={cx({\n [styles.footer()]: true,\n [styles.fixedFooter()]: this.state.scrollState !== 'bottom',\n })}\n >\n {this.props.footer}\n </div>\n );\n };\n\n private focusOnRootElement = (): void => {\n const rootNode = getRootNode(this);\n if (isHTMLElement(rootNode)) {\n rootNode?.focus();\n }\n };\n\n private shouldRecalculateMaxHeight = (prevProps: MenuProps): boolean => {\n const { header, footer, children } = this.props;\n const maxHeight = this.getProps().maxHeight;\n const prevMaxHeight = prevProps.maxHeight;\n const prevHeader = prevProps.header;\n const prevFooter = prevProps.footer;\n const prevChildrenCount = React.Children.count(prevProps.children);\n\n return (\n maxHeight !== prevMaxHeight ||\n footer !== prevFooter ||\n header !== prevHeader ||\n React.Children.count(children) !== prevChildrenCount\n );\n };\n\n private calculateMaxHeight = () => {\n const maxHeight = this.getProps().maxHeight;\n let parsedMaxHeight = maxHeight;\n const rootNode = getRootNode(this);\n\n if (typeof maxHeight === 'string' && typeof window !== 'undefined' && rootNode) {\n const rootElementMaxHeight = window.getComputedStyle(rootNode).maxHeight;\n\n if (rootElementMaxHeight) {\n parsedMaxHeight = parseFloat(rootElementMaxHeight);\n }\n }\n\n const calculatedMaxHeight =\n typeof parsedMaxHeight === 'number'\n ? parsedMaxHeight +\n ((this.header && getDOMRect(this.header).height) || 0) +\n ((this.footer && getDOMRect(this.footer).height) || 0)\n : maxHeight;\n\n this.setState({\n maxHeight: calculatedMaxHeight || 'none',\n });\n };\n\n private setInitialSelection = () => {\n for (let i = this.getProps().initialSelectedItemIndex; i > -1; i--) {\n this.moveDown();\n }\n };\n\n private refScrollContainer = (scrollContainer: Nullable<ScrollContainer>) => {\n this.scrollContainer = scrollContainer;\n };\n\n private refHighlighted(\n originalRef: string | ((instance: MenuItem | null) => void) | React.RefObject<MenuItem> | null | undefined,\n menuItem: MenuItem | null,\n ) {\n this.highlighted = menuItem;\n\n if (!originalRef || typeof originalRef === 'string') {\n return;\n }\n\n if (typeof originalRef === 'function') {\n originalRef(menuItem);\n } else if (typeof originalRef === 'object') {\n // @ts-expect-error: See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31065.\n originalRef.current = menuItem;\n }\n }\n\n private scrollToSelected = () => {\n if (this.scrollContainer && this.highlighted) {\n const rootNode = getRootNode(this.highlighted);\n // TODO: Remove this check once IF-647 is resolved\n if (rootNode instanceof HTMLElement) {\n this.scrollContainer.scrollTo(rootNode);\n }\n }\n };\n\n private select(index: number, shouldHandleHref: boolean, event: React.SyntheticEvent<HTMLElement>): boolean {\n const item = childrenToArray(this.props.children)[index];\n\n if (isActiveElement(item)) {\n if (shouldHandleHref && item.props.href) {\n if (item.props.target) {\n window.open(item.props.href, item.props.target);\n } else {\n location.href = item.props.href;\n }\n }\n if (item.props.onClick) {\n item.props.onClick(event as React.MouseEvent<HTMLElement>);\n }\n if (this.props.onItemClick) {\n this.props.onItemClick(event);\n }\n return true;\n }\n return false;\n }\n\n private highlightItem = (index: number): void => {\n this.setState({ highlightedIndex: index });\n\n const rootNode = getRootNode(this);\n if (isHTMLElement(rootNode)) {\n rootNode?.focus();\n }\n };\n\n private unhighlight = () => {\n this.setState({ highlightedIndex: -1 });\n };\n\n private move(step: number) {\n this.setState((state, props) => {\n const children = childrenToArray(props.children);\n if (!children.some(isActiveElement)) {\n return null;\n }\n let index = state.highlightedIndex;\n do {\n index += step;\n if (!this.getProps().cyclicSelection && (index < 0 || index > children.length)) {\n return null;\n }\n\n if (index < 0) {\n index = children.length - 1;\n } else if (index > children.length) {\n index = 0;\n }\n\n const child = children[index];\n if (isActiveElement(child)) {\n return { highlightedIndex: index };\n }\n } while (index !== state.highlightedIndex);\n return null;\n }, this.scrollToSelected);\n }\n\n private moveUp = () => {\n this.move(-1);\n };\n\n private moveDown = () => {\n this.move(1);\n };\n\n private isEmpty() {\n const { children } = this.props;\n return !children || !childrenToArray(children).filter(isNonNullable).length;\n }\n\n private handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>): void => {\n if (typeof this.props.onKeyDown === 'function') {\n this.props.onKeyDown(e);\n }\n\n if (e.defaultPrevented) {\n return;\n }\n\n if (isKeyArrowUp(e)) {\n e.preventDefault();\n this.moveUp();\n } else if (isKeyArrowDown(e)) {\n e.preventDefault();\n this.moveDown();\n } else if (isKeyEnter(e)) {\n if (this.highlighted && this.highlighted.props.onClick) {\n this.highlighted.props.onClick(e);\n }\n }\n };\n\n private handleScrollStateChange = (scrollState: ScrollContainerScrollState) => {\n if (this.state.scrollState !== scrollState) {\n this.setState({ scrollState });\n }\n };\n}\n\nfunction childrenToArray(children: React.ReactNode): React.ReactNode[] {\n const ret: React.ReactNode[] = [];\n // Use forEach instead of map to avoid cloning for key unifying.\n React.Children.forEach(children, (child) => {\n ret.push(child);\n });\n return ret;\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface MaskedInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
3
3
|
mask: string;
|
|
4
|
-
maskChar
|
|
4
|
+
maskChar?: string | null;
|
|
5
5
|
formatChars?: {
|
|
6
6
|
[key: string]: string;
|
|
7
7
|
};
|
|
@@ -13,15 +13,18 @@ export interface MaskedInputProps extends React.InputHTMLAttributes<HTMLInputEle
|
|
|
13
13
|
}
|
|
14
14
|
interface MaskedInputState {
|
|
15
15
|
value: string;
|
|
16
|
+
originValue: string;
|
|
16
17
|
emptyValue: string;
|
|
17
18
|
focused: boolean;
|
|
18
19
|
}
|
|
20
|
+
declare type DefaultProps = Required<Pick<MaskedInputProps, 'maskChar'>>;
|
|
19
21
|
export declare const MaskedInputDataTids: {
|
|
20
22
|
readonly root: "MaskedInput__root";
|
|
21
23
|
};
|
|
22
24
|
export declare class MaskedInput extends React.PureComponent<MaskedInputProps, MaskedInputState> {
|
|
23
25
|
static __KONTUR_REACT_UI__: string;
|
|
24
|
-
static defaultProps:
|
|
26
|
+
static defaultProps: DefaultProps;
|
|
27
|
+
private getProps;
|
|
25
28
|
input: HTMLInputElement | null;
|
|
26
29
|
private theme;
|
|
27
30
|
private reactInputMask;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.MaskedInputDataTids = exports.MaskedInput = void 0;var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.MaskedInputDataTids = exports.MaskedInput = void 0;var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
2
|
+
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
2
4
|
var _reactInputMask = _interopRequireDefault(require("react-input-mask"));
|
|
3
5
|
|
|
4
6
|
var _utils = require("../../lib/utils");
|
|
@@ -6,6 +8,7 @@ var _ThemeContext = require("../../lib/theming/ThemeContext");
|
|
|
6
8
|
|
|
7
9
|
var _MaskCharLowLine = require("../MaskCharLowLine");
|
|
8
10
|
var _Emotion = require("../../lib/theming/Emotion");
|
|
11
|
+
var _createPropsGetter = require("../../lib/createPropsGetter");
|
|
9
12
|
|
|
10
13
|
var _MaskedInput = require("./MaskedInput.styles");var _excluded = ["maskChar", "alwaysShowMask", "hasLeftIcon", "hasRightIcon", "maxLength", "onValueChange", "onUnexpectedInput", "defaultValue", "style"];
|
|
11
14
|
|
|
@@ -22,6 +25,12 @@ var _MaskedInput = require("./MaskedInput.styles");var _excluded = ["maskChar",
|
|
|
22
25
|
|
|
23
26
|
|
|
24
27
|
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
25
34
|
|
|
26
35
|
|
|
27
36
|
|
|
@@ -41,8 +50,11 @@ MaskedInput = /*#__PURE__*/function (_React$PureComponent) {(0, _inheritsLoose2.
|
|
|
41
50
|
|
|
42
51
|
|
|
43
52
|
|
|
53
|
+
|
|
54
|
+
|
|
44
55
|
function MaskedInput(_props) {var _this;
|
|
45
|
-
_this = _React$PureComponent.call(this, _props) || this;_this.input = null;_this.reactInputMask = null;_this.
|
|
56
|
+
_this = _React$PureComponent.call(this, _props) || this;_this.getProps = (0, _createPropsGetter.createPropsGetter)(MaskedInput.defaultProps);_this.input = null;_this.reactInputMask = null;_this.
|
|
57
|
+
|
|
46
58
|
|
|
47
59
|
|
|
48
60
|
|
|
@@ -151,7 +163,7 @@ MaskedInput = /*#__PURE__*/function (_React$PureComponent) {(0, _inheritsLoose2.
|
|
|
151
163
|
if (event.target.value === _this.state.value) {
|
|
152
164
|
_this.handleUnexpectedInput();
|
|
153
165
|
} else {
|
|
154
|
-
_this.setState({ value: event.target.value });
|
|
166
|
+
_this.setState({ value: event.target.value, originValue: event.target.value });
|
|
155
167
|
if (_this.props.onValueChange) {
|
|
156
168
|
_this.props.onValueChange(event.target.value);
|
|
157
169
|
}
|
|
@@ -183,11 +195,12 @@ MaskedInput = /*#__PURE__*/function (_React$PureComponent) {(0, _inheritsLoose2.
|
|
|
183
195
|
userInput,
|
|
184
196
|
options)
|
|
185
197
|
{
|
|
186
|
-
var visibleMaskChars = new Array(options.mask.length).fill(_this.
|
|
198
|
+
var visibleMaskChars = new Array(options.mask.length).fill(_this.getProps().maskChar);
|
|
187
199
|
|
|
188
200
|
if (newState.value !== oldState.value && userInput === null) {
|
|
189
201
|
_this.setState({
|
|
190
|
-
value: newState.value
|
|
202
|
+
value: newState.value,
|
|
203
|
+
originValue: newState.value });
|
|
191
204
|
|
|
192
205
|
}
|
|
193
206
|
|
|
@@ -218,5 +231,5 @@ MaskedInput = /*#__PURE__*/function (_React$PureComponent) {(0, _inheritsLoose2.
|
|
|
218
231
|
if (_this.props.onUnexpectedInput) {
|
|
219
232
|
_this.props.onUnexpectedInput(_this.state.value);
|
|
220
233
|
}
|
|
221
|
-
};_this.state = { value: _this.getValue(_props), emptyValue: '', focused: false };return _this;}var _proto = MaskedInput.prototype;_proto.componentDidMount = function componentDidMount() {if (this.reactInputMask) {// FIXME: принудительно вызываем beforeMaskedValueChange, чтобы получить emptyValue
|
|
222
|
-
this.reactInputMask.forceUpdate();}};_proto.componentDidUpdate = function componentDidUpdate(prevProps) {if (this.props.value !== prevProps.value) {this.setState({ value: this.props.value ? this.props.value.toString() : '' });}};_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = theme;return _this2.renderMain();});};_proto.renderMain = function renderMain() {var _this$props = this.props,maskChar = _this$props.maskChar,alwaysShowMask = _this$props.alwaysShowMask,hasLeftIcon = _this$props.hasLeftIcon,hasRightIcon = _this$props.hasRightIcon,maxLength = _this$props.maxLength,onValueChange = _this$props.onValueChange,onUnexpectedInput = _this$props.onUnexpectedInput,defaultValue = _this$props.defaultValue,style = _this$props.style,inputProps = (0, _objectWithoutPropertiesLoose2.default)(_this$props, _excluded);var _this$state = this.state,emptyValue = _this$state.emptyValue,value = _this$state.value;var leftHelper = (style == null ? void 0 : style.textAlign) !== 'right' && /*#__PURE__*/_react.default.createElement("span", { style: { color: 'transparent' } }, emptyValue.slice(0,
|
|
234
|
+
};_this.state = { value: _this.getValue(_props), originValue: _this.getValue(_props), emptyValue: '', focused: false };return _this;}var _proto = MaskedInput.prototype;_proto.componentDidMount = function componentDidMount() {if (this.reactInputMask) {// FIXME: принудительно вызываем beforeMaskedValueChange, чтобы получить emptyValue
|
|
235
|
+
this.reactInputMask.forceUpdate();}};_proto.componentDidUpdate = function componentDidUpdate(prevProps) {if (this.props.value !== prevProps.value) {this.setState({ value: this.props.value ? this.props.value.toString() : '' });}};_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = theme;return _this2.renderMain();});};_proto.renderMain = function renderMain() {var _this$props = this.props,maskChar = _this$props.maskChar,alwaysShowMask = _this$props.alwaysShowMask,hasLeftIcon = _this$props.hasLeftIcon,hasRightIcon = _this$props.hasRightIcon,maxLength = _this$props.maxLength,onValueChange = _this$props.onValueChange,onUnexpectedInput = _this$props.onUnexpectedInput,defaultValue = _this$props.defaultValue,style = _this$props.style,inputProps = (0, _objectWithoutPropertiesLoose2.default)(_this$props, _excluded);var _this$state = this.state,emptyValue = _this$state.emptyValue,value = _this$state.value,originValue = _this$state.originValue;var leftHelper = (style == null ? void 0 : style.textAlign) !== 'right' && /*#__PURE__*/_react.default.createElement("span", { style: { color: 'transparent' } }, emptyValue.slice(0, originValue.length));var leftClass = (style == null ? void 0 : style.textAlign) !== 'right' && _MaskedInput.styles.inputMaskLeft();var rightHelper = emptyValue.slice(originValue.length).split('').map(function (_char, i) {return _char === '_' ? /*#__PURE__*/_react.default.createElement(_MaskCharLowLine.MaskCharLowLine, { key: i }) : _char;});return /*#__PURE__*/_react.default.createElement("span", { "data-tid": MaskedInputDataTids.root, className: _MaskedInput.styles.container(), "x-ms-format-detection": "none" }, /*#__PURE__*/_react.default.createElement(_reactInputMask.default, (0, _extends2.default)({}, inputProps, { maskChar: null, beforeMaskedValueChange: this.preprocess, alwaysShowMask: false, onChange: this.handleChange, onFocus: this.handleFocus, onBlur: this.handleBlur, value: value, inputRef: this.refInput, ref: this.refMaskedInput, style: (0, _extends2.default)({}, style) })), this.isMaskVisible() && /*#__PURE__*/_react.default.createElement("span", { className: (0, _Emotion.cx)(_MaskedInput.styles.inputMask(this.theme), leftClass) }, leftHelper, rightHelper));};return MaskedInput;}(_react.default.PureComponent);exports.MaskedInput = MaskedInput;MaskedInput.__KONTUR_REACT_UI__ = 'MaskedInput';MaskedInput.defaultProps = { maskChar: '_' };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["MaskedInput.tsx"],"names":["MaskedInputDataTids","root","MaskedInput","props","input","reactInputMask","getValue","value","toString","defaultValue","refInput","refMaskedInput","handleChange","event","target","state","handleUnexpectedInput","setState","onValueChange","onChange","handleFocus","focused","onFocus","handleBlur","onBlur","preprocess","newState","oldState","userInput","options","visibleMaskChars","Array","mask","length","fill","maskChar","split","forEach","char","index","permanents","includes","emptyValue","join","isMaskVisible","alwaysShowMask","onUnexpectedInput","componentDidMount","forceUpdate","componentDidUpdate","prevProps","render","theme","renderMain","hasLeftIcon","hasRightIcon","maxLength","style","inputProps","leftHelper","textAlign","color","slice","leftClass","styles","inputMaskLeft","rightHelper","map","_char","i","container","inputMask","React","PureComponent","__KONTUR_REACT_UI__","defaultProps"],"mappings":"meAAA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,mD;;;;;;;;;;;;;;;;;;;AAmBO,IAAMA,mBAAmB,GAAG;AACjCC,EAAAA,IAAI,EAAE,mBAD2B,EAA5B,C;;;AAIMC,W;;;;;;;;;;;AAWX,uBAAmBC,MAAnB,EAA4C;AAC1C,4CAAMA,MAAN,UAD0C,MAJrCC,KAIqC,GAJJ,IAII,OAFpCC,cAEoC,GAFI,IAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFpCC,IAAAA,QAtFoC,GAsFzB,UAACH,KAAD,EAAqC;AACtD,UAAI,0BAAcA,KAAK,CAACI,KAApB,CAAJ,EAAgC;AAC9B,eAAOJ,KAAK,CAACI,KAAN,CAAYC,QAAZ,EAAP;AACD;;AAED,UAAI,0BAAcL,KAAK,CAACM,YAApB,CAAJ,EAAuC;AACrC,eAAON,KAAK,CAACM,YAAN,CAAmBD,QAAnB,EAAP;AACD;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ACGJ,UADH,EAEGO,WAFH,CAfJ,CADF,CAuBD,C,sBA/F8BM,eAAMC,a,oCAA1BvE,W,CACGwE,mB,GAAsB,a,CADzBxE,W,CAGGyE,Y,GAA0C,EACtDxC,QAAQ,EAAE,GAD4C,E","sourcesContent":["import React from 'react';\nimport ReactInputMask, { InputState, MaskOptions } from 'react-input-mask';\n\nimport { isNonNullable } from '../../lib/utils';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { MaskCharLowLine } from '../MaskCharLowLine';\nimport { cx } from '../../lib/theming/Emotion';\n\nimport { styles } from './MaskedInput.styles';\n\nexport interface MaskedInputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n mask: string;\n maskChar: string | null;\n formatChars?: { [key: string]: string };\n alwaysShowMask?: boolean;\n hasLeftIcon?: boolean;\n hasRightIcon?: boolean;\n onUnexpectedInput?: (value: string) => void;\n onValueChange?: (value: string) => void;\n}\n\ninterface MaskedInputState {\n value: string;\n emptyValue: string;\n focused: boolean;\n}\n\nexport const MaskedInputDataTids = {\n root: 'MaskedInput__root',\n} as const;\n\nexport class MaskedInput extends React.PureComponent<MaskedInputProps, MaskedInputState> {\n public static __KONTUR_REACT_UI__ = 'MaskedInput';\n\n public static defaultProps: Partial<MaskedInputProps> = {\n maskChar: '_',\n };\n\n public input: HTMLInputElement | null = null;\n private theme!: Theme;\n private reactInputMask: ReactInputMask | null = null;\n\n public constructor(props: MaskedInputProps) {\n super(props);\n\n this.state = {\n value: this.getValue(props),\n emptyValue: '',\n focused: false,\n };\n }\n\n public componentDidMount() {\n if (this.reactInputMask) {\n // FIXME: принудительно вызываем beforeMaskedValueChange, чтобы получить emptyValue\n this.reactInputMask.forceUpdate();\n }\n }\n\n public componentDidUpdate(prevProps: MaskedInputProps) {\n if (this.props.value !== prevProps.value) {\n this.setState({\n value: this.props.value ? this.props.value.toString() : '',\n });\n }\n }\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private renderMain() {\n const {\n maskChar,\n alwaysShowMask,\n hasLeftIcon,\n hasRightIcon,\n maxLength,\n onValueChange,\n onUnexpectedInput,\n defaultValue,\n style,\n ...inputProps\n } = this.props;\n const { emptyValue, value } = this.state;\n\n const leftHelper = style?.textAlign !== 'right' && (\n <span style={{ color: 'transparent' }}>{emptyValue.slice(0, value.length)}</span>\n );\n const leftClass = style?.textAlign !== 'right' && styles.inputMaskLeft();\n\n const rightHelper = emptyValue\n .slice(value.length)\n .split('')\n .map((_char, i) => (_char === '_' ? <MaskCharLowLine key={i} /> : _char));\n\n return (\n <span data-tid={MaskedInputDataTids.root} className={styles.container()} x-ms-format-detection=\"none\">\n <ReactInputMask\n {...inputProps}\n maskChar={null}\n beforeMaskedValueChange={this.preprocess}\n alwaysShowMask={false}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n value={value}\n inputRef={this.refInput}\n ref={this.refMaskedInput}\n style={{ ...style }}\n />\n {this.isMaskVisible() && (\n <span className={cx(styles.inputMask(this.theme), leftClass)}>\n {leftHelper}\n {rightHelper}\n </span>\n )}\n </span>\n );\n }\n\n private getValue = (props: MaskedInputProps): string => {\n if (isNonNullable(props.value)) {\n return props.value.toString();\n }\n\n if (isNonNullable(props.defaultValue)) {\n return props.defaultValue.toString();\n }\n\n return '';\n };\n\n private refInput = (input: HTMLInputElement | null) => {\n this.input = input;\n };\n\n private refMaskedInput = (reactInputMask: ReactInputMask) => {\n this.reactInputMask = reactInputMask;\n };\n\n private handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (event.target.value === this.state.value) {\n this.handleUnexpectedInput();\n } else {\n this.setState({ value: event.target.value });\n if (this.props.onValueChange) {\n this.props.onValueChange(event.target.value);\n }\n if (this.props.onChange) {\n this.props.onChange(event);\n }\n }\n };\n\n private handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n this.setState({ focused: true });\n\n if (this.props.onFocus) {\n this.props.onFocus(event);\n }\n };\n\n private handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n this.setState({ focused: false });\n\n if (this.props.onBlur) {\n this.props.onBlur(event);\n }\n };\n\n private preprocess = (\n newState: InputState,\n oldState: InputState,\n userInput: string,\n options: MaskOptions & Pick<MaskedInputProps, 'mask'>,\n ) => {\n const visibleMaskChars = new Array(options.mask.length).fill(this.props.maskChar);\n\n if (newState.value !== oldState.value && userInput === null) {\n this.setState({\n value: newState.value,\n });\n }\n\n options.mask.split('').forEach((char: string, index: number) => {\n if (options.permanents.includes(index)) {\n visibleMaskChars[index] = char;\n }\n\n if (newState.value[index]) {\n visibleMaskChars[index] = newState.value[index];\n }\n });\n\n const emptyValue = visibleMaskChars.join('');\n\n if (this.state.emptyValue !== emptyValue) {\n this.setState({\n emptyValue,\n });\n }\n\n return newState;\n };\n\n private isMaskVisible = () => this.props.alwaysShowMask || this.state.focused;\n\n private handleUnexpectedInput = () => {\n if (this.props.onUnexpectedInput) {\n this.props.onUnexpectedInput(this.state.value);\n }\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["MaskedInput.tsx"],"names":["MaskedInputDataTids","root","MaskedInput","props","getProps","defaultProps","input","reactInputMask","getValue","value","toString","defaultValue","refInput","refMaskedInput","handleChange","event","target","state","handleUnexpectedInput","setState","originValue","onValueChange","onChange","handleFocus","focused","onFocus","handleBlur","onBlur","preprocess","newState","oldState","userInput","options","visibleMaskChars","Array","mask","length","fill","maskChar","split","forEach","char","index","permanents","includes","emptyValue","join","isMaskVisible","alwaysShowMask","onUnexpectedInput","componentDidMount","forceUpdate","componentDidUpdate","prevProps","render","theme","renderMain","hasLeftIcon","hasRightIcon","maxLength","style","inputProps","leftHelper","textAlign","color","slice","leftClass","styles","inputMaskLeft","rightHelper","map","_char","i","container","inputMask","React","PureComponent","__KONTUR_REACT_UI__"],"mappings":";;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;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B,OAArB,IAAgCI,oBAAOC,aAAP,EAAlD,CAEA,IAAMC,WAAW,GAAGxB,UAAU,CAC3BoB,KADiB,CACX7C,WAAW,CAACgB,MADD,EAEjBG,KAFiB,CAEX,EAFW,EAGjB+B,GAHiB,CAGb,UAACC,KAAD,EAAQC,CAAR,UAAeD,KAAK,KAAK,GAAV,gBAAgB,6BAAC,gCAAD,IAAiB,GAAG,EAAEC,CAAtB,GAAhB,GAA8CD,KAA7D,EAHa,CAApB,CAKA,oBACE,uCAAM,YAAUvE,mBAAmB,CAACC,IAApC,EAA0C,SAAS,EAAEkE,oBAAOM,SAAP,EAArD,EAAyE,yBAAsB,MAA/F,iBACE,6BAAC,uBAAD,6BACMZ,UADN,IAEE,QAAQ,EAAE,IAFZ,EAGE,uBAAuB,EAAE,KAAKjC,UAHhC,EAIE,cAAc,EAAE,KAJlB,EAKE,QAAQ,EAAE,KAAKd,YALjB,EAME,OAAO,EAAE,KAAKS,WANhB,EAOE,MAAM,EAAE,KAAKG,UAPf,EAQE,KAAK,EAAEjB,KART,EASE,QAAQ,EAAE,KAAKG,QATjB,EAUE,GAAG,EAAE,KAAKC,cAVZ,EAWE,KAAK,6BAAO+C,KAAP,CAXP,IADF,EAcG,KAAKb,aAAL,mBACC,uCAAM,SAAS,EAAE,iBAAGoB,oBAAOO,SAAP,CAAiB,KAAKnB,KAAtB,CAAH,EAAiCW,SAAjC,CAAjB,IACGJ,UADH,EAEGO,WAFH,CAfJ,CADF,CAuBD,C,sBAlG8BM,eAAMC,a,oCAA1B1E,W,CACG2E,mB,GAAsB,a,CADzB3E,W,CAGGG,Y,GAA6B,EACzCiC,QAAQ,EAAE,GAD+B,E","sourcesContent":["// TODO: Enable this rule in functional components.\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport React from 'react';\nimport ReactInputMask, { InputState, MaskOptions } from 'react-input-mask';\n\nimport { isNonNullable } from '../../lib/utils';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { MaskCharLowLine } from '../MaskCharLowLine';\nimport { cx } from '../../lib/theming/Emotion';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\n\nimport { styles } from './MaskedInput.styles';\n\nexport interface MaskedInputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n mask: string;\n maskChar?: string | null;\n formatChars?: { [key: string]: string };\n alwaysShowMask?: boolean;\n hasLeftIcon?: boolean;\n hasRightIcon?: boolean;\n onUnexpectedInput?: (value: string) => void;\n onValueChange?: (value: string) => void;\n}\n\ninterface MaskedInputState {\n value: string;\n\n // Users can unmask value themselves. In these cases we take origin value length\n originValue: string;\n\n emptyValue: string;\n focused: boolean;\n}\n\ntype DefaultProps = Required<Pick<MaskedInputProps, 'maskChar'>>;\n\nexport const MaskedInputDataTids = {\n root: 'MaskedInput__root',\n} as const;\n\nexport class MaskedInput extends React.PureComponent<MaskedInputProps, MaskedInputState> {\n public static __KONTUR_REACT_UI__ = 'MaskedInput';\n\n public static defaultProps: DefaultProps = {\n maskChar: '_',\n };\n\n private getProps = createPropsGetter(MaskedInput.defaultProps);\n\n public input: HTMLInputElement | null = null;\n private theme!: Theme;\n private reactInputMask: ReactInputMask | null = null;\n\n public constructor(props: MaskedInputProps) {\n super(props);\n\n this.state = {\n value: this.getValue(props),\n originValue: this.getValue(props),\n emptyValue: '',\n focused: false,\n };\n }\n\n public componentDidMount() {\n if (this.reactInputMask) {\n // FIXME: принудительно вызываем beforeMaskedValueChange, чтобы получить emptyValue\n this.reactInputMask.forceUpdate();\n }\n }\n\n public componentDidUpdate(prevProps: MaskedInputProps) {\n if (this.props.value !== prevProps.value) {\n this.setState({\n value: this.props.value ? this.props.value.toString() : '',\n });\n }\n }\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private renderMain() {\n const {\n maskChar,\n alwaysShowMask,\n hasLeftIcon,\n hasRightIcon,\n maxLength,\n onValueChange,\n onUnexpectedInput,\n defaultValue,\n style,\n ...inputProps\n } = this.props;\n const { emptyValue, value, originValue } = this.state;\n\n const leftHelper = style?.textAlign !== 'right' && (\n <span style={{ color: 'transparent' }}>{emptyValue.slice(0, originValue.length)}</span>\n );\n const leftClass = style?.textAlign !== 'right' && styles.inputMaskLeft();\n\n const rightHelper = emptyValue\n .slice(originValue.length)\n .split('')\n .map((_char, i) => (_char === '_' ? <MaskCharLowLine key={i} /> : _char));\n\n return (\n <span data-tid={MaskedInputDataTids.root} className={styles.container()} x-ms-format-detection=\"none\">\n <ReactInputMask\n {...inputProps}\n maskChar={null}\n beforeMaskedValueChange={this.preprocess}\n alwaysShowMask={false}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n value={value}\n inputRef={this.refInput}\n ref={this.refMaskedInput}\n style={{ ...style }}\n />\n {this.isMaskVisible() && (\n <span className={cx(styles.inputMask(this.theme), leftClass)}>\n {leftHelper}\n {rightHelper}\n </span>\n )}\n </span>\n );\n }\n\n private getValue = (props: MaskedInputProps): string => {\n if (isNonNullable(props.value)) {\n return props.value.toString();\n }\n\n if (isNonNullable(props.defaultValue)) {\n return props.defaultValue.toString();\n }\n\n return '';\n };\n\n private refInput = (input: HTMLInputElement | null) => {\n this.input = input;\n };\n\n private refMaskedInput = (reactInputMask: ReactInputMask) => {\n this.reactInputMask = reactInputMask;\n };\n\n private handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (event.target.value === this.state.value) {\n this.handleUnexpectedInput();\n } else {\n this.setState({ value: event.target.value, originValue: event.target.value });\n if (this.props.onValueChange) {\n this.props.onValueChange(event.target.value);\n }\n if (this.props.onChange) {\n this.props.onChange(event);\n }\n }\n };\n\n private handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n this.setState({ focused: true });\n\n if (this.props.onFocus) {\n this.props.onFocus(event);\n }\n };\n\n private handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n this.setState({ focused: false });\n\n if (this.props.onBlur) {\n this.props.onBlur(event);\n }\n };\n\n private preprocess = (\n newState: InputState,\n oldState: InputState,\n userInput: string,\n options: MaskOptions & Pick<MaskedInputProps, 'mask'>,\n ) => {\n const visibleMaskChars = new Array(options.mask.length).fill(this.getProps().maskChar);\n\n if (newState.value !== oldState.value && userInput === null) {\n this.setState({\n value: newState.value,\n originValue: newState.value,\n });\n }\n\n options.mask.split('').forEach((char: string, index: number) => {\n if (options.permanents.includes(index)) {\n visibleMaskChars[index] = char;\n }\n\n if (newState.value[index]) {\n visibleMaskChars[index] = newState.value[index];\n }\n });\n\n const emptyValue = visibleMaskChars.join('');\n\n if (this.state.emptyValue !== emptyValue) {\n this.setState({\n emptyValue,\n });\n }\n\n return newState;\n };\n\n private isMaskVisible = () => this.props.alwaysShowMask || this.state.focused;\n\n private handleUnexpectedInput = () => {\n if (this.props.onUnexpectedInput) {\n this.props.onUnexpectedInput(this.state.value);\n }\n };\n}\n"]}
|
|
@@ -18,15 +18,11 @@ export interface MenuState {
|
|
|
18
18
|
export declare const MenuDataTids: {
|
|
19
19
|
readonly root: "Menu__root";
|
|
20
20
|
};
|
|
21
|
+
declare type DefaultProps = Required<Pick<MenuProps, 'align' | 'width' | 'maxHeight' | 'hasShadow' | 'preventWindowScroll'>>;
|
|
21
22
|
export declare class Menu extends React.Component<MenuProps, MenuState> {
|
|
22
23
|
static __KONTUR_REACT_UI__: string;
|
|
23
|
-
static defaultProps:
|
|
24
|
-
|
|
25
|
-
width: string;
|
|
26
|
-
maxHeight: number;
|
|
27
|
-
hasShadow: boolean;
|
|
28
|
-
preventWindowScroll: boolean;
|
|
29
|
-
};
|
|
24
|
+
static defaultProps: DefaultProps;
|
|
25
|
+
private getProps;
|
|
30
26
|
state: {
|
|
31
27
|
highlightedIndex: number;
|
|
32
28
|
};
|
|
@@ -71,3 +67,4 @@ export declare class Menu extends React.Component<MenuProps, MenuState> {
|
|
|
71
67
|
private move;
|
|
72
68
|
private isEmpty;
|
|
73
69
|
}
|
|
70
|
+
export {};
|
|
@@ -7,9 +7,10 @@ var _ScrollContainer = require("../../components/ScrollContainer");
|
|
|
7
7
|
var _ThemeContext = require("../../lib/theming/ThemeContext");
|
|
8
8
|
|
|
9
9
|
var _Emotion = require("../../lib/theming/Emotion");
|
|
10
|
-
var
|
|
10
|
+
var _rootNode2 = require("../../lib/rootNode");
|
|
11
11
|
var _addIconPaddingIfPartOfMenu = require("../InternalMenu/addIconPaddingIfPartOfMenu");
|
|
12
12
|
var _client = require("../../lib/client");
|
|
13
|
+
var _createPropsGetter = require("../../lib/createPropsGetter");
|
|
13
14
|
|
|
14
15
|
var _Menu = require("./Menu.styles");
|
|
15
16
|
var _isActiveElement = require("./isActiveElement");var _class, _class2, _temp;
|
|
@@ -37,9 +38,9 @@ var MenuDataTids = {
|
|
|
37
38
|
|
|
38
39
|
|
|
39
40
|
|
|
40
|
-
Menu = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/function (_React$Component) {(0, _inheritsLoose2.default)(Menu, _React$Component);function Menu() {var _this;for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;_this.
|
|
41
41
|
|
|
42
42
|
|
|
43
|
+
Menu = (0, _rootNode2.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/function (_React$Component) {(0, _inheritsLoose2.default)(Menu, _React$Component);function Menu() {var _this;for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;_this.
|
|
43
44
|
|
|
44
45
|
|
|
45
46
|
|
|
@@ -48,6 +49,10 @@ Menu = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/function
|
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
getProps = (0, _createPropsGetter.createPropsGetter)(Menu.defaultProps);_this.
|
|
55
|
+
|
|
51
56
|
state = {
|
|
52
57
|
highlightedIndex: -1 };_this.
|
|
53
58
|
|
|
@@ -137,6 +142,7 @@ Menu = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/function
|
|
|
137
142
|
|
|
138
143
|
|
|
139
144
|
|
|
145
|
+
|
|
140
146
|
|
|
141
147
|
|
|
142
148
|
getChildList = function () {
|
|
@@ -193,7 +199,11 @@ Menu = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/function
|
|
|
193
199
|
|
|
194
200
|
scrollToSelected = function () {
|
|
195
201
|
if (_this.scrollContainer && _this.highlighted) {
|
|
196
|
-
|
|
202
|
+
var _rootNode = (0, _rootNode2.getRootNode)(_this.highlighted);
|
|
203
|
+
// TODO: Remove this check once IF-647 is resolved
|
|
204
|
+
if (_rootNode instanceof HTMLElement) {
|
|
205
|
+
_this.scrollContainer.scrollTo(_rootNode);
|
|
206
|
+
}
|
|
197
207
|
}
|
|
198
208
|
};_this.
|
|
199
209
|
|
|
@@ -246,7 +256,7 @@ Menu = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/function
|
|
|
246
256
|
* @public
|
|
247
257
|
*/;_proto.reset = function reset() {this.setState({ highlightedIndex: -1 });} /**
|
|
248
258
|
* @public
|
|
249
|
-
*/;_proto.hasHighlightedItem = function hasHighlightedItem() {return this.state.highlightedIndex !== -1;};_proto.highlightItem = function highlightItem(index) {this.highlight(index);};_proto.renderMain = function renderMain() {var _cx;if (this.isEmpty()) {return null;}return /*#__PURE__*/_react.default.createElement("div", { "data-tid": MenuDataTids.root, className: (0, _Emotion.cx)(getAlignRightClass(this.props), (_cx = {}, _cx[_Menu.styles.root(this.theme)] = true, _cx[_Menu.styles.shadow(this.theme)] =
|
|
259
|
+
*/;_proto.hasHighlightedItem = function hasHighlightedItem() {return this.state.highlightedIndex !== -1;};_proto.highlightItem = function highlightItem(index) {this.highlight(index);};_proto.renderMain = function renderMain() {var _cx;if (this.isEmpty()) {return null;}var _this$getProps = this.getProps(),hasShadow = _this$getProps.hasShadow,maxHeight = _this$getProps.maxHeight,preventWindowScroll = _this$getProps.preventWindowScroll;return /*#__PURE__*/_react.default.createElement("div", { "data-tid": MenuDataTids.root, className: (0, _Emotion.cx)(getAlignRightClass(this.props), (_cx = {}, _cx[_Menu.styles.root(this.theme)] = true, _cx[_Menu.styles.shadow(this.theme)] = hasShadow, _cx)), style: getStyle(this.props), ref: this.setRootNode }, /*#__PURE__*/_react.default.createElement(_ScrollContainer.ScrollContainer, { ref: this.refScrollContainer, maxHeight: maxHeight, preventWindowScroll: preventWindowScroll, disabled: this.props.disableScrollContainer }, /*#__PURE__*/_react.default.createElement("div", { className: _Menu.styles.scrollContainer(this.theme) }, this.getChildList())));};_proto.refHighlighted = function refHighlighted(originalRef, menuItem) {this.highlighted = menuItem;if (typeof originalRef === 'function') {originalRef(menuItem);}};_proto.select = function select(index, shouldHandleHref, event) {var item = childrenToArray(this.props.children)[index];if ((0, _isActiveElement.isActiveElement)(item)) {if (shouldHandleHref && item.props.href) {if (item.props.target) {window.open(item.props.href, item.props.target);} else {location.href = item.props.href;}}if (item.props.onClick) {item.props.onClick(event);}if (this.props.onItemClick) {this.props.onItemClick();}return true;}return false;};_proto.move = function move(step) {var _this3 = this;if (this.unmounted) {// NOTE workaround, because `ComboBox` call `process.nextTick` in reducer
|
|
250
260
|
return;}var children = childrenToArray(this.props.children);var activeElements = children.filter(_isActiveElement.isActiveElement);if (!activeElements.length) {return;
|
|
251
261
|
}
|
|
252
262
|
var index = this.state.highlightedIndex;var _loop = function _loop() {
|