@megafon/ui-core 9.0.0-alpha.2 → 9.0.0-alpha.21
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/dist/es/components/Accordion/Accordion.css +1 -1
- package/dist/es/components/Accordion/Accordion.d.ts +3 -1
- package/dist/es/components/Accordion/Accordion.js +3 -3
- package/dist/es/components/Avatar/Avatar.css +1 -1
- package/dist/es/components/Avatar/Avatar.d.ts +1 -1
- package/dist/es/components/Badges/CounterBadge/CounterBadge.js +1 -2
- package/dist/es/components/Badges/InfoBadge/InfoBadge.css +1 -0
- package/dist/es/components/Badges/InfoBadge/InfoBadge.d.ts +52 -0
- package/dist/es/components/Badges/InfoBadge/InfoBadge.js +226 -0
- package/dist/es/components/Badges/PriceBadge/PriceBadge.d.ts +1 -0
- package/dist/es/components/Badges/PriceBadge/PriceBadge.js +53 -13
- package/dist/es/components/Badges/PromoBadge/PromoBadge.css +1 -1
- package/dist/es/components/Badges/PromoBadge/PromoBadge.d.ts +1 -11
- package/dist/es/components/Badges/PromoBadge/PromoBadge.js +6 -16
- package/dist/es/components/Badges/StatusBadge/StatusBadge.css +1 -1
- package/dist/es/components/Badges/StatusBadge/StatusBadge.js +16 -7
- package/dist/es/components/Badges/TimerBadge/TimerBadge.d.ts +2 -0
- package/dist/es/components/Badges/TimerBadge/TimerBadge.js +6 -2
- package/dist/es/components/Buttons/Button/Button.css +1 -0
- package/dist/es/components/{Button → Buttons/Button}/Button.d.ts +5 -0
- package/dist/es/components/{Button → Buttons/Button}/Button.js +38 -12
- package/dist/es/components/Buttons/ButtonClose/ButtonClose.css +1 -0
- package/dist/es/components/Buttons/ButtonClose/ButtonClose.d.ts +34 -0
- package/dist/es/components/Buttons/ButtonClose/ButtonClose.js +69 -0
- package/dist/es/components/Calendar/components/_Month/Month.js +2 -6
- package/dist/es/components/Carousel/Carousel.css +1 -1
- package/dist/es/components/Carousel/Carousel.d.ts +9 -0
- package/dist/es/components/Carousel/Carousel.js +14 -2
- package/dist/es/components/Checkbox/Checkbox.css +1 -1
- package/dist/es/components/Checkbox/Checkbox.js +3 -2
- package/dist/es/components/Chips/Chips/Chip.css +1 -1
- package/dist/es/components/Chips/Chips/Chip.d.ts +9 -1
- package/dist/es/components/Chips/Chips/Chip.js +12 -7
- package/dist/es/components/Chips/Chips/Chips.d.ts +16 -1
- package/dist/es/components/Chips/Chips/Chips.js +28 -6
- package/dist/es/components/Chips/Chips/components/ChipsDropdown/ChipsDropdown.css +1 -1
- package/dist/es/components/Chips/Chips/components/ChipsDropdown/ChipsDropdown.d.ts +12 -4
- package/dist/es/components/Chips/Chips/components/ChipsDropdown/ChipsDropdown.js +55 -47
- package/dist/es/components/Chips/Chips/components/ChipsScrollPanel/ChipsScrollPanel.d.ts +10 -1
- package/dist/es/components/Chips/Chips/components/ChipsScrollPanel/ChipsScrollPanel.js +12 -7
- package/dist/es/components/Chips/ChipsSuggest/ChipSuggest.css +1 -1
- package/dist/es/components/Chips/ChipsSuggest/ChipSuggest.d.ts +7 -0
- package/dist/es/components/Chips/ChipsSuggest/ChipSuggest.js +7 -0
- package/dist/es/components/Chips/ChipsSuggest/ChipsSuggest.d.ts +4 -2
- package/dist/es/components/Chips/ChipsSuggest/ChipsSuggest.js +3 -0
- package/dist/es/components/ContentArea/ContentArea.css +1 -1
- package/dist/es/components/ContentArea/ContentArea.d.ts +3 -2
- package/dist/es/components/ContentArea/ContentArea.js +5 -0
- package/dist/es/components/ContentView/ContentView.css +1 -1
- package/dist/es/components/ContentView/ContentView.d.ts +15 -4
- package/dist/es/components/ContentView/ContentView.js +17 -4
- package/dist/es/components/Counter/Counter.css +1 -1
- package/dist/es/components/Counter/Counter.d.ts +2 -0
- package/dist/es/components/Counter/Counter.js +6 -3
- package/dist/es/components/Dropdown/Dropdown.css +1 -1
- package/dist/es/components/Dropdown/Dropdown.d.ts +6 -2
- package/dist/es/components/Dropdown/Dropdown.js +31 -22
- package/dist/es/components/ErrorLoad/ErrorLoad.css +1 -1
- package/dist/es/components/ErrorLoad/ErrorLoad.d.ts +1 -1
- package/dist/es/components/ErrorLoad/ErrorLoad.js +2 -4
- package/dist/es/components/Link/Link.css +1 -0
- package/dist/es/components/Link/Link.d.ts +1 -0
- package/dist/es/components/Link/Link.js +4 -2
- package/dist/es/components/ListData/ListData.css +1 -1
- package/dist/es/components/ListData/ListData.d.ts +9 -1
- package/dist/es/components/ListData/ListData.js +20 -14
- package/dist/es/components/ListData/components/ListDataSortable.css +1 -1
- package/dist/es/components/ListData/components/ListDataSortable.js +1 -3
- package/dist/es/components/Modal/Modal.css +1 -1
- package/dist/es/components/Modal/Modal.d.ts +23 -9
- package/dist/es/components/Modal/Modal.js +34 -23
- package/dist/es/components/Modal/_ModalContent/ModalContent.css +1 -1
- package/dist/es/components/Modal/_ModalContent/ModalContent.js +37 -39
- package/dist/es/components/Modal/_ModalDesktop/ModalDesktop.css +1 -1
- package/dist/es/components/Modal/_ModalMobile/ModalMobile.css +1 -0
- package/dist/es/components/Modal/{_ModalMobileBottom/ModalMobileBottom.d.ts → _ModalMobile/ModalMobile.d.ts} +6 -5
- package/dist/es/components/Modal/{_ModalMobileBottom/ModalMobileBottom.js → _ModalMobile/ModalMobile.js} +35 -26
- package/dist/es/components/Modal/mocks.js +0 -1
- package/dist/es/components/Modal/types.d.ts +1 -2
- package/dist/es/components/NavArrow/NavArrow.css +1 -1
- package/dist/es/components/NavArrow/NavArrow.js +4 -4
- package/dist/es/components/Notification/Notification.css +1 -1
- package/dist/es/components/Notification/Notification.d.ts +0 -11
- package/dist/es/components/Notification/Notification.js +19 -38
- package/dist/es/components/Pagination/Pagination.css +1 -1
- package/dist/es/components/Pagination/Pagination.d.ts +1 -3
- package/dist/es/components/Pagination/Pagination.js +4 -13
- package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.css +1 -1
- package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.d.ts +1 -2
- package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.js +0 -2
- package/dist/es/components/Pagination/components/PaginationButtons/PaginationButtons.css +1 -1
- package/dist/es/components/Pagination/components/PaginationButtons/PaginationButtons.d.ts +1 -3
- package/dist/es/components/Pagination/components/PaginationButtons/PaginationButtons.js +5 -16
- package/dist/es/components/Pagination/components/PaginationNavigation/PaginationNavigation.d.ts +1 -2
- package/dist/es/components/Pagination/components/PaginationNavigation/PaginationNavigation.js +4 -4
- package/dist/es/components/Pagination/types.d.ts +1 -11
- package/dist/es/components/Pagination/types.js +1 -4
- package/dist/es/components/Pagination/usePagination.d.ts +2 -2
- package/dist/es/components/Pagination/usePagination.js +11 -29
- package/dist/es/components/Parameter/Parameter.d.ts +0 -3
- package/dist/es/components/Parameter/Parameter.js +3 -4
- package/dist/es/components/RadioButton/RadioButton.css +1 -1
- package/dist/es/components/Row/Row.css +1 -1
- package/dist/es/components/Row/Row.js +6 -4
- package/dist/es/components/ScrollBar/ScrollBar.d.ts +2 -0
- package/dist/es/components/ScrollBar/ScrollBar.js +6 -1
- package/dist/es/components/Search/Search.css +1 -1
- package/dist/es/components/Search/Search.d.ts +2 -2
- package/dist/es/components/Search/Search.js +72 -68
- package/dist/es/components/Select/Select.css +1 -1
- package/dist/es/components/Select/Select.d.ts +11 -20
- package/dist/es/components/Select/Select.js +40 -88
- package/dist/es/components/Select/reducer/selectReducer.js +1 -1
- package/dist/es/components/Selector/Selector.css +1 -1
- package/dist/es/components/Sliders/Slider/Slider.css +1 -1
- package/dist/es/components/Sliders/Slider/Slider.d.ts +12 -0
- package/dist/es/components/Sliders/Slider/Slider.js +26 -7
- package/dist/es/components/Sliders/SliderRange/SliderRange.css +1 -1
- package/dist/es/components/Sliders/SliderRange/SliderRange.d.ts +3 -0
- package/dist/es/components/Sliders/SliderRange/SliderRange.js +4 -1
- package/dist/es/components/Sliders/SliderRatio/SliderRatio.css +1 -1
- package/dist/es/components/Sliders/components/SliderScale/SliderScale.css +1 -1
- package/dist/es/components/Sliders/components/SliderScale/SliderScale.d.ts +6 -0
- package/dist/es/components/Sliders/components/SliderScale/SliderScale.js +8 -1
- package/dist/es/components/Sliders/helpers.d.ts +1 -0
- package/dist/es/components/Sliders/helpers.js +7 -0
- package/dist/es/components/Snackbar/Snackbar.css +1 -1
- package/dist/es/components/Snackbar/Snackbar.js +20 -21
- package/dist/es/components/Stepper/Stepper.css +1 -0
- package/dist/es/components/Stepper/Stepper.d.ts +52 -0
- package/dist/es/components/Stepper/Stepper.js +159 -0
- package/dist/es/components/Stepper/StepperItem.css +1 -0
- package/dist/es/components/Stepper/StepperItem.d.ts +57 -0
- package/dist/es/components/Stepper/StepperItem.js +101 -0
- package/dist/es/components/Stepper/img/separator-mobile.png +0 -0
- package/dist/es/components/Stepper/img/separator-vertical.png +0 -0
- package/dist/es/components/Stepper/img/separator.png +0 -0
- package/dist/es/components/Switcher/Switcher.css +1 -1
- package/dist/es/components/Switcher/Switcher.d.ts +5 -0
- package/dist/es/components/Switcher/Switcher.js +22 -10
- package/dist/es/components/Tabs/Tabs.css +1 -1
- package/dist/es/components/Tabs/Tabs.d.ts +2 -0
- package/dist/es/components/Tabs/Tabs.js +64 -55
- package/dist/es/components/TextField/TextField.css +1 -1
- package/dist/es/components/TextField/TextField.d.ts +2 -2
- package/dist/es/components/TextField/TextField.js +16 -9
- package/dist/es/components/Tooltip/Tooltip.css +1 -1
- package/dist/es/components/Tooltip/Tooltip.d.ts +9 -0
- package/dist/es/components/Tooltip/Tooltip.js +22 -17
- package/dist/es/components/UploadForm/UploadField/UploadField.css +1 -1
- package/dist/es/components/UploadForm/UploadField/UploadField.d.ts +4 -1
- package/dist/es/components/UploadForm/UploadField/UploadField.js +8 -2
- package/dist/es/components/UploadForm/UploadField/components/_UploadFieldDropArea/UploadFieldDropArea.css +1 -1
- package/dist/es/components/UploadForm/UploadField/components/_UploadFieldDropArea/UploadFieldDropArea.d.ts +3 -1
- package/dist/es/components/UploadForm/UploadField/components/_UploadFieldDropArea/UploadFieldDropArea.js +30 -5
- package/dist/es/components/UploadForm/UploadFileItem/UploadFileItem.css +1 -1
- package/dist/es/components/UploadForm/UploadFileItem/UploadFileItem.d.ts +3 -1
- package/dist/es/components/UploadForm/UploadFileItem/UploadFileItem.js +9 -6
- package/dist/es/components/UploadForm/UploadFileItem/components/_UploadFileItemIcon/UploadFileItemIcon.js +6 -0
- package/dist/es/hooks/useResolution.js +15 -23
- package/dist/es/index.d.ts +6 -3
- package/dist/es/index.js +6 -3
- package/dist/lib/components/Accordion/Accordion.css +1 -1
- package/dist/lib/components/Accordion/Accordion.d.ts +3 -1
- package/dist/lib/components/Accordion/Accordion.js +3 -3
- package/dist/lib/components/Avatar/Avatar.css +1 -1
- package/dist/lib/components/Avatar/Avatar.d.ts +1 -1
- package/dist/lib/components/Badges/CounterBadge/CounterBadge.js +1 -2
- package/dist/lib/components/Badges/InfoBadge/InfoBadge.css +1 -0
- package/dist/lib/components/Badges/InfoBadge/InfoBadge.d.ts +52 -0
- package/dist/lib/components/Badges/InfoBadge/InfoBadge.js +235 -0
- package/dist/lib/components/Badges/PriceBadge/PriceBadge.d.ts +1 -0
- package/dist/lib/components/Badges/PriceBadge/PriceBadge.js +54 -13
- package/dist/lib/components/Badges/PromoBadge/PromoBadge.css +1 -1
- package/dist/lib/components/Badges/PromoBadge/PromoBadge.d.ts +1 -11
- package/dist/lib/components/Badges/PromoBadge/PromoBadge.js +7 -17
- package/dist/lib/components/Badges/StatusBadge/StatusBadge.css +1 -1
- package/dist/lib/components/Badges/StatusBadge/StatusBadge.js +16 -7
- package/dist/lib/components/Badges/TimerBadge/TimerBadge.d.ts +2 -0
- package/dist/lib/components/Badges/TimerBadge/TimerBadge.js +6 -2
- package/dist/lib/components/Buttons/Button/Button.css +1 -0
- package/dist/lib/components/{Button → Buttons/Button}/Button.d.ts +5 -0
- package/dist/lib/components/{Button → Buttons/Button}/Button.js +38 -12
- package/dist/lib/components/Buttons/ButtonClose/ButtonClose.css +1 -0
- package/dist/lib/components/Buttons/ButtonClose/ButtonClose.d.ts +34 -0
- package/dist/lib/components/Buttons/ButtonClose/ButtonClose.js +78 -0
- package/dist/lib/components/Calendar/components/_Month/Month.js +2 -6
- package/dist/lib/components/Carousel/Carousel.css +1 -1
- package/dist/lib/components/Carousel/Carousel.d.ts +9 -0
- package/dist/lib/components/Carousel/Carousel.js +15 -3
- package/dist/lib/components/Checkbox/Checkbox.css +1 -1
- package/dist/lib/components/Checkbox/Checkbox.js +3 -2
- package/dist/lib/components/Chips/Chips/Chip.css +1 -1
- package/dist/lib/components/Chips/Chips/Chip.d.ts +9 -1
- package/dist/lib/components/Chips/Chips/Chip.js +13 -8
- package/dist/lib/components/Chips/Chips/Chips.d.ts +16 -1
- package/dist/lib/components/Chips/Chips/Chips.js +28 -6
- package/dist/lib/components/Chips/Chips/components/ChipsDropdown/ChipsDropdown.css +1 -1
- package/dist/lib/components/Chips/Chips/components/ChipsDropdown/ChipsDropdown.d.ts +12 -4
- package/dist/lib/components/Chips/Chips/components/ChipsDropdown/ChipsDropdown.js +55 -47
- package/dist/lib/components/Chips/Chips/components/ChipsScrollPanel/ChipsScrollPanel.d.ts +10 -1
- package/dist/lib/components/Chips/Chips/components/ChipsScrollPanel/ChipsScrollPanel.js +11 -6
- package/dist/lib/components/Chips/ChipsSuggest/ChipSuggest.css +1 -1
- package/dist/lib/components/Chips/ChipsSuggest/ChipSuggest.d.ts +7 -0
- package/dist/lib/components/Chips/ChipsSuggest/ChipSuggest.js +8 -1
- package/dist/lib/components/Chips/ChipsSuggest/ChipsSuggest.d.ts +4 -2
- package/dist/lib/components/Chips/ChipsSuggest/ChipsSuggest.js +3 -0
- package/dist/lib/components/ContentArea/ContentArea.css +1 -1
- package/dist/lib/components/ContentArea/ContentArea.d.ts +3 -2
- package/dist/lib/components/ContentArea/ContentArea.js +5 -0
- package/dist/lib/components/ContentView/ContentView.css +1 -1
- package/dist/lib/components/ContentView/ContentView.d.ts +15 -4
- package/dist/lib/components/ContentView/ContentView.js +17 -4
- package/dist/lib/components/Counter/Counter.css +1 -1
- package/dist/lib/components/Counter/Counter.d.ts +2 -0
- package/dist/lib/components/Counter/Counter.js +6 -3
- package/dist/lib/components/Dropdown/Dropdown.css +1 -1
- package/dist/lib/components/Dropdown/Dropdown.d.ts +6 -2
- package/dist/lib/components/Dropdown/Dropdown.js +31 -22
- package/dist/lib/components/ErrorLoad/ErrorLoad.css +1 -1
- package/dist/lib/components/ErrorLoad/ErrorLoad.d.ts +1 -1
- package/dist/lib/components/ErrorLoad/ErrorLoad.js +2 -4
- package/dist/lib/components/Link/Link.css +1 -0
- package/dist/lib/components/Link/Link.d.ts +1 -0
- package/dist/lib/components/Link/Link.js +2 -1
- package/dist/lib/components/ListData/ListData.css +1 -1
- package/dist/lib/components/ListData/ListData.d.ts +9 -1
- package/dist/lib/components/ListData/ListData.js +20 -14
- package/dist/lib/components/ListData/components/ListDataSortable.css +1 -1
- package/dist/lib/components/ListData/components/ListDataSortable.js +1 -3
- package/dist/lib/components/Modal/Modal.css +1 -1
- package/dist/lib/components/Modal/Modal.d.ts +23 -9
- package/dist/lib/components/Modal/Modal.js +35 -24
- package/dist/lib/components/Modal/_ModalContent/ModalContent.css +1 -1
- package/dist/lib/components/Modal/_ModalContent/ModalContent.js +37 -39
- package/dist/lib/components/Modal/_ModalDesktop/ModalDesktop.css +1 -1
- package/dist/lib/components/Modal/_ModalMobile/ModalMobile.css +1 -0
- package/dist/lib/components/Modal/{_ModalMobileBottom/ModalMobileBottom.d.ts → _ModalMobile/ModalMobile.d.ts} +6 -5
- package/dist/lib/components/Modal/{_ModalMobileBottom/ModalMobileBottom.js → _ModalMobile/ModalMobile.js} +34 -25
- package/dist/lib/components/Modal/mocks.js +0 -1
- package/dist/lib/components/Modal/types.d.ts +1 -2
- package/dist/lib/components/NavArrow/NavArrow.css +1 -1
- package/dist/lib/components/NavArrow/NavArrow.js +4 -4
- package/dist/lib/components/Notification/Notification.css +1 -1
- package/dist/lib/components/Notification/Notification.d.ts +0 -11
- package/dist/lib/components/Notification/Notification.js +18 -37
- package/dist/lib/components/Pagination/Pagination.css +1 -1
- package/dist/lib/components/Pagination/Pagination.d.ts +1 -3
- package/dist/lib/components/Pagination/Pagination.js +4 -13
- package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.css +1 -1
- package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.d.ts +1 -2
- package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.js +0 -2
- package/dist/lib/components/Pagination/components/PaginationButtons/PaginationButtons.css +1 -1
- package/dist/lib/components/Pagination/components/PaginationButtons/PaginationButtons.d.ts +1 -3
- package/dist/lib/components/Pagination/components/PaginationButtons/PaginationButtons.js +5 -16
- package/dist/lib/components/Pagination/components/PaginationNavigation/PaginationNavigation.d.ts +1 -2
- package/dist/lib/components/Pagination/components/PaginationNavigation/PaginationNavigation.js +4 -4
- package/dist/lib/components/Pagination/types.d.ts +1 -11
- package/dist/lib/components/Pagination/types.js +1 -6
- package/dist/lib/components/Pagination/usePagination.d.ts +2 -2
- package/dist/lib/components/Pagination/usePagination.js +11 -29
- package/dist/lib/components/Parameter/Parameter.d.ts +0 -3
- package/dist/lib/components/Parameter/Parameter.js +3 -4
- package/dist/lib/components/RadioButton/RadioButton.css +1 -1
- package/dist/lib/components/Row/Row.css +1 -1
- package/dist/lib/components/Row/Row.js +5 -3
- package/dist/lib/components/ScrollBar/ScrollBar.d.ts +2 -0
- package/dist/lib/components/ScrollBar/ScrollBar.js +6 -1
- package/dist/lib/components/Search/Search.css +1 -1
- package/dist/lib/components/Search/Search.d.ts +2 -2
- package/dist/lib/components/Search/Search.js +72 -68
- package/dist/lib/components/Select/Select.css +1 -1
- package/dist/lib/components/Select/Select.d.ts +11 -20
- package/dist/lib/components/Select/Select.js +40 -88
- package/dist/lib/components/Select/reducer/selectReducer.js +1 -1
- package/dist/lib/components/Selector/Selector.css +1 -1
- package/dist/lib/components/Sliders/Slider/Slider.css +1 -1
- package/dist/lib/components/Sliders/Slider/Slider.d.ts +12 -0
- package/dist/lib/components/Sliders/Slider/Slider.js +25 -6
- package/dist/lib/components/Sliders/SliderRange/SliderRange.css +1 -1
- package/dist/lib/components/Sliders/SliderRange/SliderRange.d.ts +3 -0
- package/dist/lib/components/Sliders/SliderRange/SliderRange.js +4 -1
- package/dist/lib/components/Sliders/SliderRatio/SliderRatio.css +1 -1
- package/dist/lib/components/Sliders/components/SliderScale/SliderScale.css +1 -1
- package/dist/lib/components/Sliders/components/SliderScale/SliderScale.d.ts +6 -0
- package/dist/lib/components/Sliders/components/SliderScale/SliderScale.js +9 -2
- package/dist/lib/components/Sliders/helpers.d.ts +1 -0
- package/dist/lib/components/Sliders/helpers.js +8 -1
- package/dist/lib/components/Snackbar/Snackbar.css +1 -1
- package/dist/lib/components/Snackbar/Snackbar.js +20 -21
- package/dist/lib/components/Stepper/Stepper.css +1 -0
- package/dist/lib/components/Stepper/Stepper.d.ts +52 -0
- package/dist/lib/components/Stepper/Stepper.js +168 -0
- package/dist/lib/components/Stepper/StepperItem.css +1 -0
- package/dist/lib/components/Stepper/StepperItem.d.ts +57 -0
- package/dist/lib/components/Stepper/StepperItem.js +110 -0
- package/dist/lib/components/Stepper/img/separator-mobile.png +0 -0
- package/dist/lib/components/Stepper/img/separator-vertical.png +0 -0
- package/dist/lib/components/Stepper/img/separator.png +0 -0
- package/dist/lib/components/Switcher/Switcher.css +1 -1
- package/dist/lib/components/Switcher/Switcher.d.ts +5 -0
- package/dist/lib/components/Switcher/Switcher.js +21 -9
- package/dist/lib/components/Tabs/Tabs.css +1 -1
- package/dist/lib/components/Tabs/Tabs.d.ts +2 -0
- package/dist/lib/components/Tabs/Tabs.js +64 -55
- package/dist/lib/components/TextField/TextField.css +1 -1
- package/dist/lib/components/TextField/TextField.d.ts +2 -2
- package/dist/lib/components/TextField/TextField.js +16 -9
- package/dist/lib/components/Tooltip/Tooltip.css +1 -1
- package/dist/lib/components/Tooltip/Tooltip.d.ts +9 -0
- package/dist/lib/components/Tooltip/Tooltip.js +23 -18
- package/dist/lib/components/UploadForm/UploadField/UploadField.css +1 -1
- package/dist/lib/components/UploadForm/UploadField/UploadField.d.ts +4 -1
- package/dist/lib/components/UploadForm/UploadField/UploadField.js +8 -2
- package/dist/lib/components/UploadForm/UploadField/components/_UploadFieldDropArea/UploadFieldDropArea.css +1 -1
- package/dist/lib/components/UploadForm/UploadField/components/_UploadFieldDropArea/UploadFieldDropArea.d.ts +3 -1
- package/dist/lib/components/UploadForm/UploadField/components/_UploadFieldDropArea/UploadFieldDropArea.js +30 -5
- package/dist/lib/components/UploadForm/UploadFileItem/UploadFileItem.css +1 -1
- package/dist/lib/components/UploadForm/UploadFileItem/UploadFileItem.d.ts +3 -1
- package/dist/lib/components/UploadForm/UploadFileItem/UploadFileItem.js +9 -6
- package/dist/lib/components/UploadForm/UploadFileItem/components/_UploadFileItemIcon/UploadFileItemIcon.js +6 -0
- package/dist/lib/hooks/useResolution.js +15 -23
- package/dist/lib/index.d.ts +6 -3
- package/dist/lib/index.js +32 -11
- package/package.json +5 -5
- package/styles/base.scss +54 -0
- package/styles/colors.css +14 -0
- package/dist/es/components/Button/Button.css +0 -1
- package/dist/es/components/Modal/_ModalMobileBottom/ModalMobileBottom.css +0 -1
- package/dist/es/components/Modal/_ModalMobileFullScreen/ModalMobileFullScreen.css +0 -1
- package/dist/es/components/Modal/_ModalMobileFullScreen/ModalMobileFullScreen.d.ts +0 -8
- package/dist/es/components/Modal/_ModalMobileFullScreen/ModalMobileFullScreen.js +0 -56
- package/dist/lib/components/Button/Button.css +0 -1
- package/dist/lib/components/Modal/_ModalMobileBottom/ModalMobileBottom.css +0 -1
- package/dist/lib/components/Modal/_ModalMobileFullScreen/ModalMobileFullScreen.css +0 -1
- package/dist/lib/components/Modal/_ModalMobileFullScreen/ModalMobileFullScreen.d.ts +0 -8
- package/dist/lib/components/Modal/_ModalMobileFullScreen/ModalMobileFullScreen.js +0 -65
|
@@ -4,8 +4,10 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
import "core-js/modules/web.timers.js";
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
7
|
+
import useResolution from "../../hooks/useResolution";
|
|
7
8
|
import useSwipe, { TransitionSteps } from "../../hooks/useSwipe";
|
|
8
|
-
import Button from "../Button/Button";
|
|
9
|
+
import Button from "../Buttons/Button/Button";
|
|
10
|
+
import ButtonClose from "../Buttons/ButtonClose/ButtonClose";
|
|
9
11
|
import Caption from "../Caption/Caption";
|
|
10
12
|
import Header from "../Header/Header";
|
|
11
13
|
import Tile from "../Tile/Tile";
|
|
@@ -15,49 +17,46 @@ var HeartIcon16 = function HeartIcon16(props) {
|
|
|
15
17
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
16
18
|
viewBox: "0 0 20 20"
|
|
17
19
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
18
|
-
d: "M13.
|
|
20
|
+
d: "M13.463 2.75c.603 0 1.2.122 1.752.359a4.363 4.363 0 011.456 1.017A4.841 4.841 0 0118 7.45c0 1.433-.65 2.621-1.586 3.59l.003.004-5.694 5.9a1.004 1.004 0 01-1.443 0l-5.95-6.166A4.84 4.84 0 012 7.454 4.84 4.84 0 013.33 4.13c.408-.434.903-.78 1.455-1.017a4.445 4.445 0 013.503 0A4.364 4.364 0 019.745 4.13l.253.263.257-.267a4.37 4.37 0 011.457-1.017 4.443 4.443 0 011.75-.359z"
|
|
19
21
|
}));
|
|
20
22
|
};
|
|
21
23
|
var HeartIcon24 = function HeartIcon24(props) {
|
|
22
24
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
23
25
|
viewBox: "0 0 32 32"
|
|
24
26
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
25
|
-
d: "
|
|
27
|
+
d: "M21.195 7c.904 0 1.798.18 2.626.526a6.55 6.55 0 012.186 1.487C27.288 10.336 28 12.071 28 13.873c0 2.094-.975 3.831-2.379 5.249l.005.005-8.197 8.28a2.01 2.01 0 01-2.853 0l-8.583-8.67A6.978 6.978 0 014 13.879c0-1.801.712-3.536 1.993-4.859A6.55 6.55 0 018.18 7.531a6.814 6.814 0 015.253 0 6.55 6.55 0 012.185 1.488l.38.383.386-.389a6.55 6.55 0 012.185-1.487A6.813 6.813 0 0121.195 7z"
|
|
26
28
|
}));
|
|
27
29
|
};
|
|
28
30
|
var AttentionIcon16 = function AttentionIcon16(props) {
|
|
29
31
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
30
32
|
viewBox: "0 0 20 20"
|
|
31
33
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
32
|
-
|
|
34
|
+
fillRule: "evenodd",
|
|
35
|
+
clipRule: "evenodd",
|
|
36
|
+
d: "M8.249 3.014a1.96 1.96 0 013.45-.006l6.045 10.973c.739 1.342-.213 2.999-1.724 2.999H3.979c-1.508 0-2.46-1.651-1.727-2.993L8.25 3.014zM9.999 13a1 1 0 100 2 1 1 0 000-2zm0-7a1 1 0 00-1 1v4a1 1 0 002 0V7a1 1 0 00-1-1z"
|
|
33
37
|
}));
|
|
34
38
|
};
|
|
35
39
|
var CheckedIcon16 = function CheckedIcon16(props) {
|
|
36
40
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
37
41
|
viewBox: "0 0 20 20"
|
|
38
42
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
39
|
-
d: "
|
|
43
|
+
d: "M6.805 9.324l2.26 2.26 4.383-4.334a.935.935 0 011.323-.01.936.936 0 01-.025 1.323L9.693 13.56a.936.936 0 01-1.319.013l-2.908-2.909a.935.935 0 01.017-1.322.935.935 0 011.322-.017z"
|
|
40
44
|
}));
|
|
41
45
|
};
|
|
42
46
|
var AttentionIcon24 = function AttentionIcon24(props) {
|
|
43
47
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
44
48
|
viewBox: "0 0 32 32"
|
|
45
49
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
46
|
-
|
|
50
|
+
fillRule: "evenodd",
|
|
51
|
+
clipRule: "evenodd",
|
|
52
|
+
d: "M13.373 6.516c1.128-2.018 4.041-2.023 5.176-.008l9.067 16.094C28.725 24.571 27.296 27 25.03 27H6.97c-2.263 0-3.691-2.42-2.591-4.389l8.994-16.095zM16 21.163c-.829 0-1.5.657-1.5 1.467s.671 1.466 1.5 1.466c.828 0 1.5-.656 1.5-1.466 0-.81-.672-1.467-1.5-1.467zm0-10.3a1.5 1.5 0 00-1.5 1.5v5.867a1.5 1.5 0 003 0v-5.867a1.5 1.5 0 00-1.5-1.5z"
|
|
47
53
|
}));
|
|
48
54
|
};
|
|
49
55
|
var CheckedIcon24 = function CheckedIcon24(props) {
|
|
50
56
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
51
57
|
viewBox: "0 0 32 32"
|
|
52
58
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
53
|
-
d: "
|
|
54
|
-
}));
|
|
55
|
-
};
|
|
56
|
-
var CancelIcon = function CancelIcon(props) {
|
|
57
|
-
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
58
|
-
viewBox: "0 0 40 40"
|
|
59
|
-
}, props), /*#__PURE__*/React.createElement("path", {
|
|
60
|
-
d: "M20 18.586l6.364-6.364 1.414 1.414L21.414 20l6.364 6.364-1.414 1.414L20 21.414l-6.364 6.364-1.414-1.414L18.586 20l-6.364-6.364 1.414-1.414L20 18.586z"
|
|
59
|
+
d: "M11.033 15.1l3.39 3.39 6.817-6.742c.578-.572 1.483-.595 2.02-.051.538.544.504 1.449-.075 2.021l-7.858 7.773c-.576.57-1.476.595-2.015.056L8.95 17.185c-.54-.541-.512-1.446.063-2.021.576-.576 1.48-.604 2.021-.063z"
|
|
61
60
|
}));
|
|
62
61
|
};
|
|
63
62
|
var DEFAULT_MAX_TIMER_SECONDS = 4;
|
|
@@ -110,6 +109,8 @@ var Snackbar = function Snackbar(_ref) {
|
|
|
110
109
|
dataAttrs = _ref.dataAttrs,
|
|
111
110
|
onClose = _ref.onClose,
|
|
112
111
|
onButtonClick = _ref.onButtonClick;
|
|
112
|
+
var _useResolution = useResolution(),
|
|
113
|
+
isMobile = _useResolution.isMobile;
|
|
113
114
|
var _React$useState = React.useState(true),
|
|
114
115
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
115
116
|
isOpened = _React$useState2[0],
|
|
@@ -221,13 +222,11 @@ var Snackbar = function Snackbar(_ref) {
|
|
|
221
222
|
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.textButton
|
|
222
223
|
},
|
|
223
224
|
onClick: handleTextButtonClick
|
|
224
|
-
}, currentButtonText), /*#__PURE__*/React.createElement(
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
}, currentButtonText), !isMobile && /*#__PURE__*/React.createElement(ButtonClose, _extends({
|
|
226
|
+
className: cn('close-button'),
|
|
227
|
+
size: "medium",
|
|
228
|
+
theme: "black",
|
|
228
229
|
onClick: handleClose
|
|
229
|
-
}
|
|
230
|
-
className: cn('close-button-icon')
|
|
231
|
-
}))));
|
|
230
|
+
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.closeButton)))));
|
|
232
231
|
};
|
|
233
232
|
export default Snackbar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
h1,h2,h3,h4,h5{margin:0}.mfui-9-stepper{gap:16px}.mfui-9-stepper,.mfui-9-stepper__items-wrap{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.mfui-9-stepper__items-wrap{gap:12px;overflow-x:auto}.mfui-9-stepper::-webkit-scrollbar{height:8px}.mfui-9-stepper::-webkit-scrollbar-thumb{background-color:var(--spbSky2);border-radius:8px}.mfui-9-stepper_is-horizontal .mfui-9-stepper__items-wrap{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { IStepperItemProps } from './StepperItem';
|
|
3
|
+
import './Stepper.scss';
|
|
4
|
+
export type StepperItemType = Pick<IStepperItemProps, 'title' | 'text' | 'icon' | 'linkText' | 'linkUrl'>;
|
|
5
|
+
export interface IStepperProps {
|
|
6
|
+
/** Дополнительный класс корневого элемента */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Дополнительные классы элементов */
|
|
9
|
+
classes?: {
|
|
10
|
+
root?: string;
|
|
11
|
+
itemsWrap?: string;
|
|
12
|
+
item?: string;
|
|
13
|
+
itemIconButton?: string;
|
|
14
|
+
itemTitle?: string;
|
|
15
|
+
itemText?: string;
|
|
16
|
+
itemLink?: string;
|
|
17
|
+
};
|
|
18
|
+
/** Ссылка на корневой элемент */
|
|
19
|
+
rootRef?: React.Ref<HTMLDivElement>;
|
|
20
|
+
/** Индекс активного шага */
|
|
21
|
+
activeStep?: number;
|
|
22
|
+
/** Количество шагов */
|
|
23
|
+
stepCount?: number;
|
|
24
|
+
/** Шаги */
|
|
25
|
+
items?: StepperItemType[];
|
|
26
|
+
/** Направление */
|
|
27
|
+
isHorizontal?: boolean;
|
|
28
|
+
/** Цифры вместо галочек */
|
|
29
|
+
isNumeric?: boolean;
|
|
30
|
+
/** Отключение кнопок */
|
|
31
|
+
isDisabled?: boolean;
|
|
32
|
+
/** Все шаги пройдены */
|
|
33
|
+
isAllChecked?: boolean;
|
|
34
|
+
/** Отображение контента только активного шага */
|
|
35
|
+
showActiveStepContent?: boolean;
|
|
36
|
+
/** Выравнивание */
|
|
37
|
+
align?: 'center' | 'left';
|
|
38
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
39
|
+
dataAttrs?: {
|
|
40
|
+
root?: Record<string, string>;
|
|
41
|
+
itemsWrap?: Record<string, string>;
|
|
42
|
+
item?: Record<string, string>;
|
|
43
|
+
itemIconButton?: Record<string, string>;
|
|
44
|
+
itemTitle?: Record<string, string>;
|
|
45
|
+
itemText?: Record<string, string>;
|
|
46
|
+
itemLink?: Record<string, string>;
|
|
47
|
+
};
|
|
48
|
+
/** Обработчик события смены шага */
|
|
49
|
+
onChange?: (index: number) => void;
|
|
50
|
+
}
|
|
51
|
+
declare const Stepper: React.FC<IStepperProps>;
|
|
52
|
+
export default Stepper;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "core-js/modules/es.array.from.js";
|
|
4
|
+
import "core-js/modules/es.array.map.js";
|
|
5
|
+
import "core-js/modules/es.string.iterator.js";
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
8
|
+
import StepperItem, { STEPPER_ITEM_THEME_ENUM, STEPPER_ITEM_VIEW_ENUM } from "./StepperItem";
|
|
9
|
+
import "./Stepper.css";
|
|
10
|
+
var CheckedIcon = function CheckedIcon(props) {
|
|
11
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
12
|
+
viewBox: "0 0 20 20"
|
|
13
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
14
|
+
d: "M6.805 9.324l2.26 2.26 4.383-4.334a.935.935 0 011.323-.01.936.936 0 01-.025 1.323L9.693 13.56a.936.936 0 01-1.319.013l-2.908-2.909a.935.935 0 01.017-1.322.935.935 0 011.322-.017z"
|
|
15
|
+
}));
|
|
16
|
+
};
|
|
17
|
+
var cn = cnCreate('mfui-9-stepper');
|
|
18
|
+
var Stepper = function Stepper(_ref) {
|
|
19
|
+
var className = _ref.className,
|
|
20
|
+
_ref$classes = _ref.classes,
|
|
21
|
+
_ref$classes2 = _ref$classes === void 0 ? {} : _ref$classes,
|
|
22
|
+
rootClassName = _ref$classes2.root,
|
|
23
|
+
itemsWrapClassName = _ref$classes2.itemsWrap,
|
|
24
|
+
itemClassName = _ref$classes2.item,
|
|
25
|
+
itemIconButtonClassName = _ref$classes2.itemIconButton,
|
|
26
|
+
itemTitleClassName = _ref$classes2.itemTitle,
|
|
27
|
+
itemTextClassname = _ref$classes2.itemText,
|
|
28
|
+
itemLinkClassName = _ref$classes2.itemLink,
|
|
29
|
+
rootRef = _ref.rootRef,
|
|
30
|
+
_ref$activeStep = _ref.activeStep,
|
|
31
|
+
activeStep = _ref$activeStep === void 0 ? 0 : _ref$activeStep,
|
|
32
|
+
_ref$stepCount = _ref.stepCount,
|
|
33
|
+
stepCount = _ref$stepCount === void 0 ? 2 : _ref$stepCount,
|
|
34
|
+
_ref$items = _ref.items,
|
|
35
|
+
items = _ref$items === void 0 ? [] : _ref$items,
|
|
36
|
+
_ref$isHorizontal = _ref.isHorizontal,
|
|
37
|
+
isHorizontal = _ref$isHorizontal === void 0 ? true : _ref$isHorizontal,
|
|
38
|
+
isNumeric = _ref.isNumeric,
|
|
39
|
+
isDisabled = _ref.isDisabled,
|
|
40
|
+
isAllChecked = _ref.isAllChecked,
|
|
41
|
+
_ref$showActiveStepCo = _ref.showActiveStepContent,
|
|
42
|
+
showActiveStepContent = _ref$showActiveStepCo === void 0 ? false : _ref$showActiveStepCo,
|
|
43
|
+
_ref$align = _ref.align,
|
|
44
|
+
align = _ref$align === void 0 ? 'center' : _ref$align,
|
|
45
|
+
_ref$dataAttrs = _ref.dataAttrs,
|
|
46
|
+
_ref$dataAttrs2 = _ref$dataAttrs === void 0 ? {} : _ref$dataAttrs,
|
|
47
|
+
rootAttrs = _ref$dataAttrs2.root,
|
|
48
|
+
itemsWrapAttrs = _ref$dataAttrs2.itemsWrap,
|
|
49
|
+
itemAttrs = _ref$dataAttrs2.item,
|
|
50
|
+
itemIconButtonAttrs = _ref$dataAttrs2.itemIconButton,
|
|
51
|
+
itemTitleAttrs = _ref$dataAttrs2.itemTitle,
|
|
52
|
+
itemTextAttrs = _ref$dataAttrs2.itemText,
|
|
53
|
+
itemLinkAttrs = _ref$dataAttrs2.itemLink,
|
|
54
|
+
_ref$onChange = _ref.onChange,
|
|
55
|
+
onChange = _ref$onChange === void 0 ? function () {
|
|
56
|
+
return null;
|
|
57
|
+
} : _ref$onChange;
|
|
58
|
+
var _React$useState = React.useState(activeStep),
|
|
59
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
60
|
+
currentIndex = _React$useState2[0],
|
|
61
|
+
setCurrentIndex = _React$useState2[1];
|
|
62
|
+
var hasCustomItems = !!items.length;
|
|
63
|
+
var isHorizontalContent = isHorizontal || showActiveStepContent;
|
|
64
|
+
var currentItems = hasCustomItems ? items : Array.from({
|
|
65
|
+
length: stepCount
|
|
66
|
+
});
|
|
67
|
+
var isCorrectDisabled = React.useMemo(function () {
|
|
68
|
+
return !!isAllChecked || !!isDisabled;
|
|
69
|
+
}, [isAllChecked, isDisabled]);
|
|
70
|
+
var defineItemTheme = React.useCallback(function (index) {
|
|
71
|
+
switch (true) {
|
|
72
|
+
case isAllChecked:
|
|
73
|
+
case index < currentIndex:
|
|
74
|
+
{
|
|
75
|
+
return STEPPER_ITEM_THEME_ENUM.CHECKED;
|
|
76
|
+
}
|
|
77
|
+
case index === currentIndex:
|
|
78
|
+
{
|
|
79
|
+
return STEPPER_ITEM_THEME_ENUM.ACTIVE;
|
|
80
|
+
}
|
|
81
|
+
default:
|
|
82
|
+
{
|
|
83
|
+
return STEPPER_ITEM_THEME_ENUM.DEFAULT;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, [currentIndex, isAllChecked]);
|
|
87
|
+
var handleClickItem = React.useCallback(function (index) {
|
|
88
|
+
return function () {
|
|
89
|
+
if (isCorrectDisabled) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
setCurrentIndex(index);
|
|
93
|
+
onChange(index);
|
|
94
|
+
};
|
|
95
|
+
}, [isCorrectDisabled, onChange]);
|
|
96
|
+
React.useEffect(function () {
|
|
97
|
+
if (activeStep === undefined) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
setCurrentIndex(activeStep);
|
|
101
|
+
}, [activeStep]);
|
|
102
|
+
var renderIcon = React.useCallback(function (index, theme) {
|
|
103
|
+
var isChecked = theme === STEPPER_ITEM_THEME_ENUM.CHECKED;
|
|
104
|
+
if (isNumeric || !isChecked) {
|
|
105
|
+
return index + 1;
|
|
106
|
+
}
|
|
107
|
+
return /*#__PURE__*/React.createElement(CheckedIcon, null);
|
|
108
|
+
}, [isNumeric]);
|
|
109
|
+
var renderItem = React.useCallback(function (props, index) {
|
|
110
|
+
return /*#__PURE__*/React.createElement(StepperItem, _extends({}, props, {
|
|
111
|
+
key: index,
|
|
112
|
+
className: itemClassName,
|
|
113
|
+
classes: {
|
|
114
|
+
iconButton: itemIconButtonClassName,
|
|
115
|
+
title: itemTitleClassName,
|
|
116
|
+
text: itemTextClassname,
|
|
117
|
+
link: itemLinkClassName
|
|
118
|
+
},
|
|
119
|
+
dataAttrs: {
|
|
120
|
+
root: itemAttrs,
|
|
121
|
+
iconButton: itemIconButtonAttrs,
|
|
122
|
+
title: itemTitleAttrs,
|
|
123
|
+
text: itemTextAttrs,
|
|
124
|
+
link: itemLinkAttrs
|
|
125
|
+
}
|
|
126
|
+
}));
|
|
127
|
+
}, [itemAttrs, itemIconButtonAttrs, itemIconButtonClassName, itemClassName, itemLinkAttrs, itemLinkClassName, itemTextAttrs, itemTextClassname, itemTitleAttrs, itemTitleClassName]);
|
|
128
|
+
var renderItems = React.useMemo(function () {
|
|
129
|
+
return currentItems.map(function (elem, i) {
|
|
130
|
+
var item = elem || {};
|
|
131
|
+
var itemTheme = defineItemTheme(i);
|
|
132
|
+
var itemIcon = item.icon || renderIcon(i, itemTheme);
|
|
133
|
+
return renderItem(_extends(_extends({}, item), {
|
|
134
|
+
icon: itemIcon,
|
|
135
|
+
hasSeparator: i < currentItems.length - 1,
|
|
136
|
+
isHorizontal: isHorizontalContent,
|
|
137
|
+
isDisabled: isCorrectDisabled,
|
|
138
|
+
align: align,
|
|
139
|
+
theme: itemTheme,
|
|
140
|
+
view: showActiveStepContent ? STEPPER_ITEM_VIEW_ENUM.ICON : STEPPER_ITEM_VIEW_ENUM.DEFAULT,
|
|
141
|
+
onClick: handleClickItem(i)
|
|
142
|
+
}), i);
|
|
143
|
+
});
|
|
144
|
+
}, [align, currentItems, isCorrectDisabled, showActiveStepContent, isHorizontalContent, defineItemTheme, handleClickItem, renderIcon, renderItem]);
|
|
145
|
+
var renderSingleItem = renderItem(_extends(_extends({}, currentItems[currentIndex]), {
|
|
146
|
+
isDisabled: isCorrectDisabled,
|
|
147
|
+
align: align,
|
|
148
|
+
view: STEPPER_ITEM_VIEW_ENUM.CONTENT
|
|
149
|
+
}));
|
|
150
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(rootAttrs), {
|
|
151
|
+
className: cn([className, rootClassName], {
|
|
152
|
+
'is-horizontal': isHorizontalContent
|
|
153
|
+
}),
|
|
154
|
+
ref: rootRef
|
|
155
|
+
}), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(itemsWrapAttrs), {
|
|
156
|
+
className: cn('items-wrap', [itemsWrapClassName])
|
|
157
|
+
}), renderItems), showActiveStepContent && renderSingleItem);
|
|
158
|
+
};
|
|
159
|
+
export default Stepper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
h1,h2,h3,h4,h5{margin:0}.mfui-9-stepper-item{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;gap:16px}.mfui-9-stepper-item_is-horizontal{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.mfui-9-stepper-item_is-horizontal .mfui-9-stepper-item__separator{-o-border-image:url(img/separator-mobile.png) 2 round;border-image:url(img/separator-mobile.png) 2 round;border-left:none;border-radius:100px;border-top:2px solid transparent;height:2px;left:calc(50% + 22px);min-height:2px;position:absolute;top:19px;width:calc(100% - 32px)}@media screen and (min-width:768px){.mfui-9-stepper-item_is-horizontal .mfui-9-stepper-item__separator{-o-border-image:url(img/separator.png) 2 repeat;border-image:url(img/separator.png) 2 repeat}}@media screen and (min-width:1024px){.mfui-9-stepper-item_is-horizontal .mfui-9-stepper-item__separator{left:calc(50% + 32px);width:calc(100% - 52px)}}.mfui-9-stepper-item_theme_active .mfui-9-stepper-item__icon-button{background-color:var(--night20)}.mfui-9-stepper-item_theme_active .mfui-9-stepper-item__icon{background-color:var(--night)}.mfui-9-stepper-item_theme_checked .mfui-9-stepper-item__icon-button{background-color:var(--brandGreen20)}.mfui-9-stepper-item_theme_checked .mfui-9-stepper-item__icon{background-color:var(--brandGreen)}.mfui-9-stepper-item_theme_checked .mfui-9-stepper-item__separator{border-color:var(--brandGreen);-o-border-image:none;border-image:none}.mfui-9-stepper-item_align_left{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.mfui-9-stepper-item_align_left .mfui-9-stepper-item__separator{left:42px;right:0}@media screen and (min-width:1024px){.mfui-9-stepper-item_align_left .mfui-9-stepper-item__separator{left:auto}}.mfui-9-stepper-item_align_left .mfui-9-stepper-item__content,.mfui-9-stepper-item_align_left .mfui-9-stepper-item__icon-button-area{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.mfui-9-stepper-item__icon-button-area{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:12px;-ms-flex-align:center;-ms-flex-item-align:stretch;align-self:stretch}.mfui-9-stepper-item__icon-button,.mfui-9-stepper-item__icon-button-area{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;align-items:center}.mfui-9-stepper-item__icon-button{-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;-ms-flex-align:center;-webkit-box-pack:center;-ms-flex-pack:center;background-color:var(--spbSky0);border:none;border-radius:100%;-webkit-box-sizing:border-box;box-sizing:border-box;cursor:pointer;height:40px;justify-content:center;outline:none;-webkit-transition:background-color .25s ease-out;transition:background-color .25s ease-out;width:40px}.mfui-9-stepper-item__icon-button:disabled{cursor:default}.mfui-9-stepper-item__icon{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;background-color:var(--spbSky2);border-radius:100%;color:var(--stcWhite);font-weight:500;height:24px;justify-content:center;-webkit-transition:background-color .25s ease-out;transition:background-color .25s ease-out;width:24px}.mfui-9-stepper-item__icon svg{height:20px;width:20px;fill:var(--stcWhite)}.mfui-9-stepper-item__separator{-o-border-image:url(img/separator-vertical.png) 2 repeat;border-image:url(img/separator-vertical.png) 2 repeat;border-left:2px solid transparent;border-top:none;height:100%;min-height:20px;position:static;-webkit-transition:border-color .25s ease-out;transition:border-color .25s ease-out;width:2px}.mfui-9-stepper-item__content{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:4px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;min-width:160px;padding-bottom:20px}.mfui-9-stepper-item__link{margin-top:13px}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './StepperItem.scss';
|
|
3
|
+
export declare enum STEPPER_ITEM_THEME_ENUM {
|
|
4
|
+
CHECKED = "checked",
|
|
5
|
+
ACTIVE = "active",
|
|
6
|
+
DEFAULT = "default"
|
|
7
|
+
}
|
|
8
|
+
export declare enum STEPPER_ITEM_VIEW_ENUM {
|
|
9
|
+
ICON = "icon",
|
|
10
|
+
CONTENT = "content",
|
|
11
|
+
DEFAULT = "default"
|
|
12
|
+
}
|
|
13
|
+
export interface IStepperItemProps {
|
|
14
|
+
/** Дополнительный класс корневого элемента */
|
|
15
|
+
className?: string;
|
|
16
|
+
/** Дополнительные классы элементов */
|
|
17
|
+
classes?: {
|
|
18
|
+
iconButton?: string;
|
|
19
|
+
title?: string;
|
|
20
|
+
text?: string;
|
|
21
|
+
link?: string;
|
|
22
|
+
};
|
|
23
|
+
/** Тема */
|
|
24
|
+
theme?: STEPPER_ITEM_THEME_ENUM;
|
|
25
|
+
/** Заголовок */
|
|
26
|
+
title?: string;
|
|
27
|
+
/** Текст */
|
|
28
|
+
text?: string;
|
|
29
|
+
/** Текст ссылки */
|
|
30
|
+
linkText?: string;
|
|
31
|
+
/** Адрес ссылки */
|
|
32
|
+
linkUrl?: string;
|
|
33
|
+
/** Иконка */
|
|
34
|
+
icon?: string | number | JSX.Element;
|
|
35
|
+
/** Наличие разделителя */
|
|
36
|
+
hasSeparator?: boolean;
|
|
37
|
+
/** Направление */
|
|
38
|
+
isHorizontal?: boolean;
|
|
39
|
+
/** Отключение */
|
|
40
|
+
isDisabled?: boolean;
|
|
41
|
+
/** Выравнивание */
|
|
42
|
+
align?: 'center' | 'left';
|
|
43
|
+
/** Варианты отображения */
|
|
44
|
+
view?: STEPPER_ITEM_VIEW_ENUM;
|
|
45
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
46
|
+
dataAttrs?: {
|
|
47
|
+
root?: Record<string, string>;
|
|
48
|
+
iconButton?: Record<string, string>;
|
|
49
|
+
title?: Record<string, string>;
|
|
50
|
+
text?: Record<string, string>;
|
|
51
|
+
link?: Record<string, string>;
|
|
52
|
+
};
|
|
53
|
+
/** Обработчик события клика */
|
|
54
|
+
onClick?: () => void;
|
|
55
|
+
}
|
|
56
|
+
declare const StepperItem: React.FC<IStepperItemProps>;
|
|
57
|
+
export default StepperItem;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import "core-js/modules/es.string.link.js";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
5
|
+
import Button from "../Buttons/Button/Button";
|
|
6
|
+
import Header from "../Header/Header";
|
|
7
|
+
import Paragraph from "../Paragraph/Paragraph";
|
|
8
|
+
import "./StepperItem.css";
|
|
9
|
+
export var STEPPER_ITEM_THEME_ENUM;
|
|
10
|
+
(function (STEPPER_ITEM_THEME_ENUM) {
|
|
11
|
+
STEPPER_ITEM_THEME_ENUM["CHECKED"] = "checked";
|
|
12
|
+
STEPPER_ITEM_THEME_ENUM["ACTIVE"] = "active";
|
|
13
|
+
STEPPER_ITEM_THEME_ENUM["DEFAULT"] = "default";
|
|
14
|
+
})(STEPPER_ITEM_THEME_ENUM || (STEPPER_ITEM_THEME_ENUM = {}));
|
|
15
|
+
export var STEPPER_ITEM_VIEW_ENUM;
|
|
16
|
+
(function (STEPPER_ITEM_VIEW_ENUM) {
|
|
17
|
+
STEPPER_ITEM_VIEW_ENUM["ICON"] = "icon";
|
|
18
|
+
STEPPER_ITEM_VIEW_ENUM["CONTENT"] = "content";
|
|
19
|
+
STEPPER_ITEM_VIEW_ENUM["DEFAULT"] = "default";
|
|
20
|
+
})(STEPPER_ITEM_VIEW_ENUM || (STEPPER_ITEM_VIEW_ENUM = {}));
|
|
21
|
+
var cn = cnCreate('mfui-9-stepper-item');
|
|
22
|
+
var StepperItem = function StepperItem(_ref) {
|
|
23
|
+
var className = _ref.className,
|
|
24
|
+
_ref$classes = _ref.classes,
|
|
25
|
+
_ref$classes2 = _ref$classes === void 0 ? {} : _ref$classes,
|
|
26
|
+
iconButtonClassName = _ref$classes2.iconButton,
|
|
27
|
+
titleClassName = _ref$classes2.title,
|
|
28
|
+
textClassName = _ref$classes2.text,
|
|
29
|
+
linkClassName = _ref$classes2.link,
|
|
30
|
+
_ref$theme = _ref.theme,
|
|
31
|
+
theme = _ref$theme === void 0 ? STEPPER_ITEM_THEME_ENUM.DEFAULT : _ref$theme,
|
|
32
|
+
title = _ref.title,
|
|
33
|
+
text = _ref.text,
|
|
34
|
+
linkText = _ref.linkText,
|
|
35
|
+
linkUrl = _ref.linkUrl,
|
|
36
|
+
icon = _ref.icon,
|
|
37
|
+
hasSeparator = _ref.hasSeparator,
|
|
38
|
+
_ref$isHorizontal = _ref.isHorizontal,
|
|
39
|
+
isHorizontal = _ref$isHorizontal === void 0 ? true : _ref$isHorizontal,
|
|
40
|
+
isDisabled = _ref.isDisabled,
|
|
41
|
+
_ref$align = _ref.align,
|
|
42
|
+
align = _ref$align === void 0 ? 'center' : _ref$align,
|
|
43
|
+
_ref$view = _ref.view,
|
|
44
|
+
view = _ref$view === void 0 ? STEPPER_ITEM_VIEW_ENUM.DEFAULT : _ref$view,
|
|
45
|
+
_ref$dataAttrs = _ref.dataAttrs,
|
|
46
|
+
_ref$dataAttrs2 = _ref$dataAttrs === void 0 ? {} : _ref$dataAttrs,
|
|
47
|
+
rootAttrs = _ref$dataAttrs2.root,
|
|
48
|
+
iconButtonAttrs = _ref$dataAttrs2.iconButton,
|
|
49
|
+
titleAttrs = _ref$dataAttrs2.title,
|
|
50
|
+
textAttrs = _ref$dataAttrs2.text,
|
|
51
|
+
linkAttrs = _ref$dataAttrs2.link,
|
|
52
|
+
onClick = _ref.onClick;
|
|
53
|
+
var hasLink = !!linkText && !!linkUrl;
|
|
54
|
+
var hasContent = !!title || !!text || hasLink;
|
|
55
|
+
var showContent = view !== STEPPER_ITEM_VIEW_ENUM.ICON && hasContent;
|
|
56
|
+
var showIcon = view !== STEPPER_ITEM_VIEW_ENUM.CONTENT;
|
|
57
|
+
var renderContent = /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: cn('content')
|
|
59
|
+
}, title && /*#__PURE__*/React.createElement(Header, {
|
|
60
|
+
className: cn([titleClassName]),
|
|
61
|
+
dataAttrs: {
|
|
62
|
+
root: titleAttrs
|
|
63
|
+
},
|
|
64
|
+
as: "h5",
|
|
65
|
+
align: align
|
|
66
|
+
}, title), text && /*#__PURE__*/React.createElement(Paragraph, {
|
|
67
|
+
className: cn([textClassName]),
|
|
68
|
+
dataAttrs: {
|
|
69
|
+
root: textAttrs
|
|
70
|
+
},
|
|
71
|
+
hasMargin: false,
|
|
72
|
+
align: align
|
|
73
|
+
}, text), hasLink && /*#__PURE__*/React.createElement(Button, {
|
|
74
|
+
className: cn('link', [linkClassName]),
|
|
75
|
+
dataAttrs: {
|
|
76
|
+
root: linkAttrs
|
|
77
|
+
},
|
|
78
|
+
href: linkUrl,
|
|
79
|
+
type: "text",
|
|
80
|
+
sizeAll: "extra-small"
|
|
81
|
+
}, linkText));
|
|
82
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(rootAttrs), {
|
|
83
|
+
className: cn([className], {
|
|
84
|
+
theme: theme,
|
|
85
|
+
align: align,
|
|
86
|
+
'is-horizontal': isHorizontal
|
|
87
|
+
})
|
|
88
|
+
}), showIcon && /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
className: cn('icon-button-area')
|
|
90
|
+
}, /*#__PURE__*/React.createElement("button", _extends({}, filterDataAttrs(iconButtonAttrs), {
|
|
91
|
+
className: cn('icon-button', [iconButtonClassName]),
|
|
92
|
+
type: "button",
|
|
93
|
+
disabled: isDisabled,
|
|
94
|
+
onClick: onClick
|
|
95
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
96
|
+
className: cn('icon')
|
|
97
|
+
}, icon)), hasSeparator && /*#__PURE__*/React.createElement("span", {
|
|
98
|
+
className: cn('separator')
|
|
99
|
+
})), showContent && renderContent);
|
|
100
|
+
};
|
|
101
|
+
export default StepperItem;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
h1,h2,h3,h4,h5{margin:0}.mfui-9-switcher{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-tap-highlight-color:transparent}.mfui-9-switcher__content{font-size:15px;font-weight:400;line-height:24px;-ms-flex-item-align:center;align-self:center;margin-left:12px}.mfui-9-switcher__content_size_small{font-size:12px;line-height:18px}.mfui-9-switcher__content_left{margin-left:0;margin-right:12px}.mfui-9-switcher__content_left+.mfui-9-switcher__input{margin-left:auto}.mfui-9-switcher__pointer{background-color:var(--stcWhite);border-radius:50%;height:24px;left:2px;position:relative;top:2px;-webkit-transition:all .3s;transition:all .3s;width:24px}.mfui-9-switcher__loader{bottom:0;left:0;overflow:hidden;position:absolute;right:0;top:0}.mfui-9-switcher__loader:before{-webkit-animation:shining .8s linear infinite;animation:shining .8s linear infinite;background:-webkit-gradient(linear,left top,right top,from(var(--spbSky1)),color-stop(16%,var(--spbSky2)),color-stop(33%,var(--spbSky1)),color-stop(50%,var(--spbSky2)),color-stop(66%,var(--spbSky1)),color-stop(82%,var(--spbSky2)),to(var(--spbSky1)));background:linear-gradient(90deg,var(--spbSky1) 0,var(--spbSky2) 16%,var(--spbSky1) 33%,var(--spbSky2) 50%,var(--spbSky1) 66%,var(--spbSky2) 82%,var(--spbSky1) 100%);bottom:0;content:"";height:100%;left:0;position:absolute;top:0;width:300%}@-webkit-keyframes shining{0%{-webkit-transform:translateX(-33%);transform:translateX(-33%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes shining{0%{-webkit-transform:translateX(-33%);transform:translateX(-33%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}.mfui-9-switcher__timer{background:var(--base);border-radius:50%}.mfui-9-switcher__timer,.mfui-9-switcher__timer-icon{height:20px;left:50%;position:absolute;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);width:20px}.mfui-9-switcher__timer-icon{fill:var(--spbSky2)}.mfui-9-switcher__input{position:relative;-ms-flex-item-align:start;align-self:flex-start;border-radius:15.5px;cursor:pointer;height:28px;min-width:48px;outline:none;overflow:hidden;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-transition:background-color .3s;transition:background-color .3s;width:48px}.mfui-9-switcher__input,.mfui-9-switcher__input_disabled{background-color:var(--spbSky1)}.mfui-9-switcher__input_disabled,.mfui-9-switcher__input_loaded,.mfui-9-switcher__input_waiting{cursor:default}.mfui-9-switcher__input:hover:not(.mfui-9-switcher__input_disabled){background-color:var(--spbSky2)}.mfui-9-switcher__input_checked:not(.mfui-9-switcher__input_disabled){background-color:var(--brandGreen);border-color:var(--brandGreen)}.mfui-9-switcher__input_checked:hover:not(.mfui-9-switcher__input_disabled){background-color:var(--buttonHoverGreen);border-color:var(--buttonHoverGreen)}.mfui-9-switcher__input_disabled .mfui-9-switcher__pointer{background-color:var(--spbSky2)}.mfui-9-switcher__input_checked .mfui-9-switcher__pointer{left:22px}.mfui-9-switcher__input_checked .mfui-9-switcher__loader:before{background:-webkit-gradient(linear,left top,right top,from(var(--brandGreen)),color-stop(16%,var(--buttonHoverGreen)),color-stop(33%,var(--brandGreen)),color-stop(50%,var(--buttonHoverGreen)),color-stop(66%,var(--brandGreen)),color-stop(82%,var(--buttonHoverGreen)),to(var(--brandGreen)));background:linear-gradient(90deg,var(--brandGreen) 0,var(--buttonHoverGreen) 16%,var(--brandGreen) 33%,var(--buttonHoverGreen) 50%,var(--brandGreen) 66%,var(--buttonHoverGreen) 82%,var(--brandGreen) 100%)}.mfui-9-switcher_disabled .mfui-9-switcher__content{color:var(--spbSky3)}.mfui-9-switcher_theme_on-gray .mfui-9-switcher__input:not(.mfui-9-switcher__input_checked),.mfui-9-switcher_theme_on-gray .mfui-9-switcher__input_disabled{background-color:var(--spbSky2)}.mfui-9-switcher_theme_on-gray .mfui-9-switcher__input:not(.mfui-9-switcher__input_checked):not(.mfui-9-switcher__input_disabled):hover,.mfui-9-switcher_theme_on-gray .mfui-9-switcher__input_disabled .mfui-9-switcher__pointer{background-color:var(--spbSky3)}.mfui-9-switcher_theme_on-gray .mfui-9-switcher__timer-icon{fill:var(--spbSky3)}
|
|
1
|
+
h1,h2,h3,h4,h5{margin:0}.mfui-9-switcher{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-tap-highlight-color:transparent}.mfui-9-switcher__content{font-size:15px;font-weight:400;line-height:24px;-ms-flex-item-align:center;align-self:center;margin-left:12px}.mfui-9-switcher__content_size_small{font-size:12px;line-height:18px}.mfui-9-switcher__content_left{margin-left:0;margin-right:12px}.mfui-9-switcher__content_left+.mfui-9-switcher__input{margin-left:auto}.mfui-9-switcher__pointer{background-color:var(--stcWhite);border-radius:50%;height:24px;left:2px;position:relative;top:2px;-webkit-transition:all .3s;transition:all .3s;width:24px}.mfui-9-switcher__loader{bottom:0;left:0;overflow:hidden;position:absolute;right:0;top:0}.mfui-9-switcher__loader:before{-webkit-animation:shining .8s linear infinite;animation:shining .8s linear infinite;background:-webkit-gradient(linear,left top,right top,from(var(--spbSky1)),color-stop(16%,var(--spbSky2)),color-stop(33%,var(--spbSky1)),color-stop(50%,var(--spbSky2)),color-stop(66%,var(--spbSky1)),color-stop(82%,var(--spbSky2)),to(var(--spbSky1)));background:linear-gradient(90deg,var(--spbSky1) 0,var(--spbSky2) 16%,var(--spbSky1) 33%,var(--spbSky2) 50%,var(--spbSky1) 66%,var(--spbSky2) 82%,var(--spbSky1) 100%);bottom:0;content:"";height:100%;left:0;position:absolute;top:0;width:300%}@-webkit-keyframes shining{0%{-webkit-transform:translateX(-33%);transform:translateX(-33%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes shining{0%{-webkit-transform:translateX(-33%);transform:translateX(-33%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}.mfui-9-switcher__timer{background:var(--base);border-radius:50%}.mfui-9-switcher__timer,.mfui-9-switcher__timer-icon{height:20px;left:50%;position:absolute;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);width:20px}.mfui-9-switcher__timer-icon{fill:var(--spbSky2)}.mfui-9-switcher__input{position:relative;-ms-flex-item-align:start;align-self:flex-start;border-radius:15.5px;cursor:pointer;height:28px;min-width:48px;outline:none;overflow:hidden;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-transition:background-color .3s;transition:background-color .3s;width:48px}.mfui-9-switcher__input,.mfui-9-switcher__input_disabled{background-color:var(--spbSky1)}.mfui-9-switcher__input_disabled,.mfui-9-switcher__input_loaded,.mfui-9-switcher__input_waiting{cursor:default}.mfui-9-switcher__input:hover:not(.mfui-9-switcher__input_disabled){background-color:var(--spbSky2)}.mfui-9-switcher__input_checked:not(.mfui-9-switcher__input_disabled){background-color:var(--brandGreen);border-color:var(--brandGreen)}.mfui-9-switcher__input_checked:hover:not(.mfui-9-switcher__input_disabled){background-color:var(--buttonHoverGreen);border-color:var(--buttonHoverGreen)}.mfui-9-switcher__input_disabled .mfui-9-switcher__pointer{background-color:var(--spbSky2)}.mfui-9-switcher__input_checked .mfui-9-switcher__pointer{left:22px}.mfui-9-switcher__input_checked .mfui-9-switcher__loader:before{background:-webkit-gradient(linear,left top,right top,from(var(--brandGreen)),color-stop(16%,var(--buttonHoverGreen)),color-stop(33%,var(--brandGreen)),color-stop(50%,var(--buttonHoverGreen)),color-stop(66%,var(--brandGreen)),color-stop(82%,var(--buttonHoverGreen)),to(var(--brandGreen)));background:linear-gradient(90deg,var(--brandGreen) 0,var(--buttonHoverGreen) 16%,var(--brandGreen) 33%,var(--buttonHoverGreen) 50%,var(--brandGreen) 66%,var(--buttonHoverGreen) 82%,var(--brandGreen) 100%)}.mfui-9-switcher__label{position:relative}.mfui-9-switcher__hidden-input{height:0;left:0;opacity:0;position:absolute;top:0;width:0;z-index:-1}.mfui-9-switcher__hidden-input:focus-visible+.mfui-9-switcher__input{-webkit-animation:focus-outline-shrink .3s linear forwards;animation:focus-outline-shrink .3s linear forwards;outline-offset:2px}@-webkit-keyframes focus-outline-shrink{0%{outline:0 solid var(--137C)}to{outline:4px solid var(--137C)}}@keyframes focus-outline-shrink{0%{outline:0 solid var(--137C)}to{outline:4px solid var(--137C)}}.mfui-9-switcher_disabled .mfui-9-switcher__content{color:var(--spbSky3)}.mfui-9-switcher_theme_on-gray .mfui-9-switcher__input:not(.mfui-9-switcher__input_checked),.mfui-9-switcher_theme_on-gray .mfui-9-switcher__input_disabled{background-color:var(--spbSky2)}.mfui-9-switcher_theme_on-gray .mfui-9-switcher__input:not(.mfui-9-switcher__input_checked):not(.mfui-9-switcher__input_disabled):hover,.mfui-9-switcher_theme_on-gray .mfui-9-switcher__input_disabled .mfui-9-switcher__pointer{background-color:var(--spbSky3)}.mfui-9-switcher_theme_on-gray .mfui-9-switcher__timer-icon{fill:var(--spbSky3)}
|
|
@@ -9,6 +9,7 @@ export interface ISwitcherProps {
|
|
|
9
9
|
loader?: Record<string, string>;
|
|
10
10
|
pointer?: Record<string, string>;
|
|
11
11
|
timer?: Record<string, string>;
|
|
12
|
+
hiddenInput?: Record<string, string>;
|
|
12
13
|
};
|
|
13
14
|
/** Дополнительный класс корневого элемента */
|
|
14
15
|
className?: string;
|
|
@@ -26,6 +27,10 @@ export interface ISwitcherProps {
|
|
|
26
27
|
textSize?: 'small' | 'medium';
|
|
27
28
|
/** Позиция лейбла относительно свитчера */
|
|
28
29
|
textPosition?: 'left' | 'right';
|
|
30
|
+
/** Имя компонента в DOM */
|
|
31
|
+
name?: string;
|
|
32
|
+
/** Значение свитчера */
|
|
33
|
+
value?: string;
|
|
29
34
|
/** Обработчик изменения элемента */
|
|
30
35
|
onChange?: (e: AccessibilityEventType) => void;
|
|
31
36
|
children?: React.ReactNode;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import "core-js/modules/es.function.name.js";
|
|
2
3
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
4
|
+
import { cnCreate, detectTouch, filterDataAttrs } from '@megafon/ui-helpers';
|
|
4
5
|
import "./Switcher.css";
|
|
5
6
|
var WaitingIcon = function WaitingIcon(props) {
|
|
6
7
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
@@ -8,7 +9,9 @@ var WaitingIcon = function WaitingIcon(props) {
|
|
|
8
9
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
9
10
|
fillRule: "evenodd",
|
|
10
11
|
clipRule: "evenodd",
|
|
11
|
-
d: "M10
|
|
12
|
+
d: "M10.006 3.998c3.857 0 7 3.127 7 6.985 0 3.857-3.143 6.984-7 6.984s-7-3.127-7.001-6.984c0-3.858 3.143-6.985 7-6.985zM10 7.004a.5.5 0 00-.5.5v3.501H7a.5.5 0 000 1h3a.5.5 0 00.5-.5v-4a.5.5 0 00-.5-.5z"
|
|
13
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
14
|
+
d: "M14.594 3.124a.514.514 0 01.715 0l2.15 2.105a.487.487 0 010 .7.515.515 0 01-.714 0l-2.15-2.105a.487.487 0 010-.7zM4.92 3.109a.515.515 0 01.716.005.487.487 0 01-.005.698l-2.165 2.09a.514.514 0 01-.715-.004.487.487 0 01.005-.7l2.164-2.09z"
|
|
12
15
|
}));
|
|
13
16
|
};
|
|
14
17
|
var cn = cnCreate('mfui-9-switcher');
|
|
@@ -30,7 +33,9 @@ var Switcher = function Switcher(_ref) {
|
|
|
30
33
|
textSize = _ref$textSize === void 0 ? 'medium' : _ref$textSize,
|
|
31
34
|
_ref$textPosition = _ref.textPosition,
|
|
32
35
|
textPosition = _ref$textPosition === void 0 ? 'right' : _ref$textPosition,
|
|
33
|
-
onChange = _ref.onChange
|
|
36
|
+
onChange = _ref.onChange,
|
|
37
|
+
name = _ref.name,
|
|
38
|
+
value = _ref.value;
|
|
34
39
|
var isTouch = detectTouch();
|
|
35
40
|
var isLeftContent = !!children && textPosition === 'left';
|
|
36
41
|
var isRightContent = !!children && textPosition === 'right';
|
|
@@ -38,7 +43,7 @@ var Switcher = function Switcher(_ref) {
|
|
|
38
43
|
var isInteractiveDisabled = showLoader || isNoProcesses;
|
|
39
44
|
var isLoaderDisplayed = showLoader && !isNoProcesses;
|
|
40
45
|
var handleChange = React.useCallback(function (e) {
|
|
41
|
-
if (isInteractiveDisabled
|
|
46
|
+
if (isInteractiveDisabled) {
|
|
42
47
|
return;
|
|
43
48
|
}
|
|
44
49
|
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
@@ -53,16 +58,23 @@ var Switcher = function Switcher(_ref) {
|
|
|
53
58
|
size: textSize,
|
|
54
59
|
left: true
|
|
55
60
|
})
|
|
56
|
-
}, children), /*#__PURE__*/React.createElement("
|
|
61
|
+
}, children), /*#__PURE__*/React.createElement("label", {
|
|
62
|
+
className: cn('label')
|
|
63
|
+
}, /*#__PURE__*/React.createElement("input", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.hiddenInput), {
|
|
64
|
+
className: cn('hidden-input'),
|
|
65
|
+
type: "checkbox",
|
|
66
|
+
checked: checked,
|
|
67
|
+
onChange: handleChange,
|
|
68
|
+
disabled: disabled,
|
|
69
|
+
name: name,
|
|
70
|
+
value: value
|
|
71
|
+
})), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.input), {
|
|
57
72
|
className: cn('input', {
|
|
58
73
|
checked: checked && !waiting,
|
|
59
74
|
disabled: isNoProcesses,
|
|
60
75
|
loaded: showLoader && !waiting,
|
|
61
76
|
'no-touch': !isTouch
|
|
62
|
-
})
|
|
63
|
-
onClick: handleChange,
|
|
64
|
-
onKeyDown: handleChange,
|
|
65
|
-
tabIndex: isInteractiveDisabled ? undefined : 0
|
|
77
|
+
})
|
|
66
78
|
}), isLoaderDisplayed && /*#__PURE__*/React.createElement("div", _extends({
|
|
67
79
|
className: cn('loader')
|
|
68
80
|
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.loader))), waiting ? /*#__PURE__*/React.createElement("div", _extends({
|
|
@@ -71,7 +83,7 @@ var Switcher = function Switcher(_ref) {
|
|
|
71
83
|
className: cn('timer-icon')
|
|
72
84
|
})) : /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.pointer), {
|
|
73
85
|
className: cn('pointer')
|
|
74
|
-
}))), isRightContent && /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
})))), isRightContent && /*#__PURE__*/React.createElement("div", {
|
|
75
87
|
className: cn('content', {
|
|
76
88
|
size: textSize
|
|
77
89
|
})
|