@salutejs/plasma-new-hope 0.77.0-canary.1185.8720575745.0 → 0.77.0-canary.1195.8808345201.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/cjs/components/Avatar/Avatar.js +28 -3
- package/cjs/components/Avatar/Avatar.js.map +1 -1
- package/cjs/components/Calendar/CalendarBase/CalendarBase.js +1 -1
- package/cjs/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
- package/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
- package/cjs/components/Calendar/CalendarDouble/CalendarDouble.js.map +1 -1
- package/cjs/components/Calendar/hoc/withRange.js +1 -1
- package/cjs/components/Calendar/hoc/withRange.js.map +1 -1
- package/cjs/components/Calendar/hooks/useKeyNavigation.js +19 -19
- package/cjs/components/Calendar/hooks/useKeyNavigation.js.map +1 -1
- package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
- package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
- package/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
- package/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js.map +1 -1
- package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
- package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
- package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
- package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
- package/cjs/components/Chip/Chip.js +2 -2
- package/cjs/components/Chip/Chip.js.map +1 -1
- package/cjs/components/Combobox/Combobox.css +2 -2
- package/cjs/components/Combobox/Combobox.js +5 -5
- package/cjs/components/Combobox/Combobox.js.map +1 -1
- package/cjs/components/Combobox/hooks/useFocusController.js +9 -9
- package/cjs/components/Combobox/hooks/useFocusController.js.map +1 -1
- package/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
- package/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js.map +1 -1
- package/cjs/components/Combobox/ui/ComboboxDivider/ComboboxDivider.css +2 -2
- package/cjs/components/Combobox/ui/ComboboxDivider/ComboboxDivider.js +1 -1
- package/cjs/components/Combobox/ui/ComboboxFooter/ComboboxFooter.css +2 -2
- package/cjs/components/Combobox/ui/ComboboxFooter/ComboboxFooter.js +1 -1
- package/cjs/components/Combobox/ui/ComboboxGroup/ComboboxGroup.css +2 -2
- package/cjs/components/Combobox/ui/ComboboxGroup/ComboboxGroup.js +1 -1
- package/cjs/components/Combobox/ui/ComboboxHeader/ComboboxHeader.css +2 -2
- package/cjs/components/Combobox/ui/ComboboxHeader/ComboboxHeader.js +1 -1
- package/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.css +2 -2
- package/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.js +1 -1
- package/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.styles.js +1 -1
- package/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
- package/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js.map +1 -1
- package/cjs/components/Drawer/DrawerContext.js +1 -1
- package/cjs/components/Drawer/DrawerContext.js.map +1 -1
- package/cjs/components/Dropdown/Dropdown.css +2 -2
- package/cjs/components/Dropdown/Dropdown.js +4 -27
- package/cjs/components/Dropdown/Dropdown.js.map +1 -1
- package/cjs/components/Dropdown/Dropdown.styles.js +1 -1
- package/cjs/components/Dropdown/Dropdown.styles.js.map +1 -1
- package/cjs/components/Dropdown/{Dropdown.styles_13400l5.css → Dropdown.styles_1daxhqh.css} +1 -1
- package/cjs/components/Dropdown/Dropdown.tokens.js +0 -1
- package/cjs/components/Dropdown/Dropdown.tokens.js.map +1 -1
- package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js +5 -7
- package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
- package/cjs/components/Dropdown/utils/index.js +0 -43
- package/cjs/components/Dropdown/utils/index.js.map +1 -1
- package/cjs/components/IconButton/IconButton.css +27 -0
- package/cjs/components/IconButton/IconButton.js +84 -0
- package/cjs/components/IconButton/IconButton.js.map +1 -0
- package/cjs/components/IconButton/IconButton.styles.js +27 -0
- package/cjs/components/IconButton/IconButton.styles.js.map +1 -0
- package/cjs/components/IconButton/IconButton.styles_gh8fim.css +4 -0
- package/cjs/components/IconButton/IconButton.tokens.js +36 -0
- package/cjs/components/IconButton/IconButton.tokens.js.map +1 -0
- package/cjs/components/IconButton/variations/_disabled/base.js +9 -0
- package/cjs/components/IconButton/variations/_disabled/base.js.map +1 -0
- package/cjs/components/IconButton/variations/_disabled/base_x642ct.css +1 -0
- package/cjs/components/IconButton/variations/_focused/base.js +9 -0
- package/cjs/components/IconButton/variations/_focused/base.js.map +1 -0
- package/cjs/components/IconButton/variations/_focused/base_x642ct.css +1 -0
- package/cjs/components/IconButton/variations/_size/base.js +9 -0
- package/cjs/components/IconButton/variations/_size/base.js.map +1 -0
- package/cjs/components/IconButton/variations/_size/base_x642ct.css +1 -0
- package/cjs/components/IconButton/variations/_view/base.js +9 -0
- package/cjs/components/IconButton/variations/_view/base.js.map +1 -0
- package/cjs/components/IconButton/variations/_view/base_x642ct.css +1 -0
- package/cjs/components/Modal/ModalContext.js +1 -1
- package/cjs/components/Modal/ModalContext.js.map +1 -1
- package/cjs/components/Overlay/Overlay.js +1 -1
- package/cjs/components/Overlay/Overlay.js.map +1 -1
- package/cjs/components/Pagination/Pagination.css +2 -2
- package/cjs/components/Pagination/Pagination.js +2 -2
- package/cjs/components/Pagination/Pagination.js.map +1 -1
- package/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
- package/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js.map +1 -1
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +2 -2
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.js +1 -1
- package/cjs/components/Popover/Popover.js +7 -7
- package/cjs/components/Popover/Popover.js.map +1 -1
- package/cjs/components/Popup/Popup.js +1 -1
- package/cjs/components/Popup/Popup.js.map +1 -1
- package/cjs/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
- package/cjs/components/Segment/ui/SegmentItem/SegmentItem.js.map +1 -1
- package/cjs/components/Select/Select.css +2 -2
- package/cjs/components/Select/Select.js +5 -5
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Select/hooks/useKeyNavigation.js +12 -12
- package/cjs/components/Select/hooks/useKeyNavigation.js.map +1 -1
- package/cjs/components/Select/ui/SelectChip/SelectChip.js +1 -1
- package/cjs/components/Select/ui/SelectChip/SelectChip.js.map +1 -1
- package/cjs/components/Select/ui/SelectDivider/SelectDivider.css +2 -2
- package/cjs/components/Select/ui/SelectDivider/SelectDivider.js +1 -1
- package/cjs/components/Select/ui/SelectFooter/SelectFooter.css +2 -2
- package/cjs/components/Select/ui/SelectFooter/SelectFooter.js +1 -1
- package/cjs/components/Select/ui/SelectGroup/SelectGroup.css +2 -2
- package/cjs/components/Select/ui/SelectGroup/SelectGroup.js +1 -1
- package/cjs/components/Select/ui/SelectHeader/SelectHeader.css +2 -2
- package/cjs/components/Select/ui/SelectHeader/SelectHeader.js +1 -1
- package/cjs/components/Select/ui/SelectItem/SelectItem.css +2 -2
- package/cjs/components/Select/ui/SelectItem/SelectItem.js +1 -1
- package/cjs/components/Select/ui/SelectItem/SelectItem.styles.js +1 -1
- package/cjs/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
- package/cjs/components/Select/ui/SelectTarget/SelectTarget.js.map +1 -1
- package/cjs/components/Select/utils/index.js +2 -2
- package/cjs/components/Select/utils/index.js.map +1 -1
- package/cjs/components/Tabs/TabsContext.js +1 -2
- package/cjs/components/Tabs/TabsContext.js.map +1 -1
- package/cjs/components/Tabs/ui/TabItem/TabItem.js +1 -1
- package/cjs/components/Tabs/ui/TabItem/TabItem.js.map +1 -1
- package/cjs/components/Tabs/ui/Tabs/Tabs.js +2 -2
- package/cjs/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
- package/cjs/components/TextArea/TextArea.js +1 -1
- package/cjs/components/TextArea/TextArea.js.map +1 -1
- package/cjs/components/TextField/TextField.js +2 -2
- package/cjs/components/TextField/TextField.js.map +1 -1
- package/cjs/components/TextField/hooks/useKeyNavigation.js +9 -9
- package/cjs/components/TextField/hooks/useKeyNavigation.js.map +1 -1
- package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
- package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
- package/cjs/components/Toast/ToastProvider/ToastProvider.js +2 -2
- package/cjs/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
- package/cjs/components/Tooltip/Tooltip.js +1 -1
- package/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/cjs/index.css +7 -2
- package/cjs/index.js +6 -2
- package/cjs/index.js.map +1 -1
- package/es/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/es/components/Avatar/Avatar.js +29 -4
- package/es/components/Avatar/Avatar.js.map +1 -1
- package/es/components/Calendar/CalendarBase/CalendarBase.js +1 -1
- package/es/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
- package/es/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
- package/es/components/Calendar/CalendarDouble/CalendarDouble.js.map +1 -1
- package/es/components/Calendar/hoc/withRange.js +1 -1
- package/es/components/Calendar/hoc/withRange.js.map +1 -1
- package/es/components/Calendar/hooks/useKeyNavigation.js +19 -19
- package/es/components/Calendar/hooks/useKeyNavigation.js.map +1 -1
- package/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
- package/es/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
- package/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
- package/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js.map +1 -1
- package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
- package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
- package/es/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
- package/es/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
- package/es/components/Chip/Chip.js +2 -2
- package/es/components/Chip/Chip.js.map +1 -1
- package/es/components/Combobox/Combobox.css +2 -2
- package/es/components/Combobox/Combobox.js +5 -5
- package/es/components/Combobox/Combobox.js.map +1 -1
- package/es/components/Combobox/hooks/useFocusController.js +9 -9
- package/es/components/Combobox/hooks/useFocusController.js.map +1 -1
- package/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
- package/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js.map +1 -1
- package/es/components/Combobox/ui/ComboboxDivider/ComboboxDivider.css +2 -2
- package/es/components/Combobox/ui/ComboboxDivider/ComboboxDivider.js +1 -1
- package/es/components/Combobox/ui/ComboboxFooter/ComboboxFooter.css +2 -2
- package/es/components/Combobox/ui/ComboboxFooter/ComboboxFooter.js +1 -1
- package/es/components/Combobox/ui/ComboboxGroup/ComboboxGroup.css +2 -2
- package/es/components/Combobox/ui/ComboboxGroup/ComboboxGroup.js +1 -1
- package/es/components/Combobox/ui/ComboboxHeader/ComboboxHeader.css +2 -2
- package/es/components/Combobox/ui/ComboboxHeader/ComboboxHeader.js +1 -1
- package/es/components/Combobox/ui/ComboboxItem/ComboboxItem.css +2 -2
- package/es/components/Combobox/ui/ComboboxItem/ComboboxItem.js +1 -1
- package/es/components/Combobox/ui/ComboboxItem/ComboboxItem.styles.js +1 -1
- package/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
- package/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js.map +1 -1
- package/es/components/Drawer/DrawerContext.js +1 -1
- package/es/components/Drawer/DrawerContext.js.map +1 -1
- package/es/components/Dropdown/Dropdown.css +2 -2
- package/es/components/Dropdown/Dropdown.js +6 -29
- package/es/components/Dropdown/Dropdown.js.map +1 -1
- package/es/components/Dropdown/Dropdown.styles.js +1 -1
- package/es/components/Dropdown/Dropdown.styles.js.map +1 -1
- package/es/components/Dropdown/{Dropdown.styles_13400l5.css → Dropdown.styles_1daxhqh.css} +1 -1
- package/es/components/Dropdown/Dropdown.tokens.js +0 -1
- package/es/components/Dropdown/Dropdown.tokens.js.map +1 -1
- package/es/components/Dropdown/ui/DropdownItem/DropdownItem.js +5 -7
- package/es/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
- package/es/components/Dropdown/utils/index.js +3 -45
- package/es/components/Dropdown/utils/index.js.map +1 -1
- package/es/components/IconButton/IconButton.css +27 -0
- package/es/components/IconButton/IconButton.js +79 -0
- package/es/components/IconButton/IconButton.js.map +1 -0
- package/es/components/IconButton/IconButton.styles.js +22 -0
- package/es/components/IconButton/IconButton.styles.js.map +1 -0
- package/es/components/IconButton/IconButton.styles_gh8fim.css +4 -0
- package/es/components/IconButton/IconButton.tokens.js +31 -0
- package/es/components/IconButton/IconButton.tokens.js.map +1 -0
- package/es/components/IconButton/variations/_disabled/base.js +5 -0
- package/es/components/IconButton/variations/_disabled/base.js.map +1 -0
- package/es/components/IconButton/variations/_disabled/base_x642ct.css +1 -0
- package/es/components/IconButton/variations/_focused/base.js +5 -0
- package/es/components/IconButton/variations/_focused/base.js.map +1 -0
- package/es/components/IconButton/variations/_focused/base_x642ct.css +1 -0
- package/es/components/IconButton/variations/_size/base.js +5 -0
- package/es/components/IconButton/variations/_size/base.js.map +1 -0
- package/es/components/IconButton/variations/_size/base_x642ct.css +1 -0
- package/es/components/IconButton/variations/_view/base.js +5 -0
- package/es/components/IconButton/variations/_view/base.js.map +1 -0
- package/es/components/IconButton/variations/_view/base_x642ct.css +1 -0
- package/es/components/Modal/ModalContext.js +1 -1
- package/es/components/Modal/ModalContext.js.map +1 -1
- package/es/components/Overlay/Overlay.js +1 -1
- package/es/components/Overlay/Overlay.js.map +1 -1
- package/es/components/Pagination/Pagination.css +2 -2
- package/es/components/Pagination/Pagination.js +2 -2
- package/es/components/Pagination/Pagination.js.map +1 -1
- package/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
- package/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js.map +1 -1
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +2 -2
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.js +1 -1
- package/es/components/Popover/Popover.js +7 -7
- package/es/components/Popover/Popover.js.map +1 -1
- package/es/components/Popup/Popup.js +1 -1
- package/es/components/Popup/Popup.js.map +1 -1
- package/es/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
- package/es/components/Segment/ui/SegmentItem/SegmentItem.js.map +1 -1
- package/es/components/Select/Select.css +2 -2
- package/es/components/Select/Select.js +5 -5
- package/es/components/Select/Select.js.map +1 -1
- package/es/components/Select/hooks/useKeyNavigation.js +12 -12
- package/es/components/Select/hooks/useKeyNavigation.js.map +1 -1
- package/es/components/Select/ui/SelectChip/SelectChip.js +1 -1
- package/es/components/Select/ui/SelectChip/SelectChip.js.map +1 -1
- package/es/components/Select/ui/SelectDivider/SelectDivider.css +2 -2
- package/es/components/Select/ui/SelectDivider/SelectDivider.js +1 -1
- package/es/components/Select/ui/SelectFooter/SelectFooter.css +2 -2
- package/es/components/Select/ui/SelectFooter/SelectFooter.js +1 -1
- package/es/components/Select/ui/SelectGroup/SelectGroup.css +2 -2
- package/es/components/Select/ui/SelectGroup/SelectGroup.js +1 -1
- package/es/components/Select/ui/SelectHeader/SelectHeader.css +2 -2
- package/es/components/Select/ui/SelectHeader/SelectHeader.js +1 -1
- package/es/components/Select/ui/SelectItem/SelectItem.css +2 -2
- package/es/components/Select/ui/SelectItem/SelectItem.js +1 -1
- package/es/components/Select/ui/SelectItem/SelectItem.styles.js +1 -1
- package/es/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
- package/es/components/Select/ui/SelectTarget/SelectTarget.js.map +1 -1
- package/es/components/Select/utils/index.js +2 -2
- package/es/components/Select/utils/index.js.map +1 -1
- package/es/components/Tabs/TabsContext.js +1 -2
- package/es/components/Tabs/TabsContext.js.map +1 -1
- package/es/components/Tabs/ui/TabItem/TabItem.js +1 -1
- package/es/components/Tabs/ui/TabItem/TabItem.js.map +1 -1
- package/es/components/Tabs/ui/Tabs/Tabs.js +2 -2
- package/es/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
- package/es/components/TextArea/TextArea.js +1 -1
- package/es/components/TextArea/TextArea.js.map +1 -1
- package/es/components/TextField/TextField.js +2 -2
- package/es/components/TextField/TextField.js.map +1 -1
- package/es/components/TextField/hooks/useKeyNavigation.js +9 -9
- package/es/components/TextField/hooks/useKeyNavigation.js.map +1 -1
- package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
- package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
- package/es/components/Toast/ToastProvider/ToastProvider.js +2 -2
- package/es/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
- package/es/components/Tooltip/Tooltip.js +1 -1
- package/es/components/Tooltip/Tooltip.js.map +1 -1
- package/es/index.css +7 -2
- package/es/index.js +2 -1
- package/es/index.js.map +1 -1
- package/package.json +12 -12
- package/styled-components/cjs/components/Avatar/Avatar.js +34 -4
- package/styled-components/cjs/components/Avatar/Avatar.styles.js +1 -1
- package/styled-components/cjs/components/Avatar/Avatar.template-doc.mdx +52 -2
- package/styled-components/cjs/components/AvatarGroup/AvatarGroup.js +1 -1
- package/styled-components/cjs/components/Badge/Badge.js +1 -1
- package/styled-components/cjs/components/Badge/Badge.styles.js +1 -1
- package/styled-components/cjs/components/Button/Button.js +2 -2
- package/styled-components/cjs/components/Button/Button.styles.js +1 -1
- package/styled-components/cjs/components/ButtonGroup/ButtonGroup.js +1 -1
- package/styled-components/cjs/components/Calendar/CalendarBase/CalendarBase.js +2 -2
- package/styled-components/cjs/components/Calendar/CalendarBase/CalendarBase.styles.js +1 -1
- package/styled-components/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +2 -2
- package/styled-components/cjs/components/Calendar/CalendarDouble/CalendarDouble.styles.js +1 -1
- package/styled-components/cjs/components/Calendar/hoc/withRange.js +2 -2
- package/styled-components/cjs/components/Calendar/hooks/useKeyNavigation.js +20 -20
- package/styled-components/cjs/components/Calendar/store/reducer.js +1 -1
- package/styled-components/cjs/components/Calendar/ui/CalendarDayItem/CalendarDayItem.js +1 -1
- package/styled-components/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +4 -4
- package/styled-components/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js +3 -3
- package/styled-components/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +2 -2
- package/styled-components/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +2 -2
- package/styled-components/cjs/components/Cell/Cell.js +1 -1
- package/styled-components/cjs/components/Cell/Cell.styles.js +1 -1
- package/styled-components/cjs/components/Checkbox/Checkbox.js +1 -1
- package/styled-components/cjs/components/Chip/Chip.js +3 -3
- package/styled-components/cjs/components/Chip/Chip.styles.js +1 -1
- package/styled-components/cjs/components/Combobox/Combobox.js +6 -6
- package/styled-components/cjs/components/Combobox/hooks/useFocusController.js +9 -9
- package/styled-components/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js +2 -2
- package/styled-components/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +7 -7
- package/styled-components/cjs/components/Counter/Counter.js +1 -1
- package/styled-components/cjs/components/Divider/Divider.js +2 -2
- package/styled-components/cjs/components/Drawer/Drawer.js +1 -1
- package/styled-components/cjs/components/Drawer/DrawerContext.js +1 -1
- package/styled-components/cjs/components/Drawer/hooks/useDrawer.js +1 -1
- package/styled-components/cjs/components/Drawer/ui/DrawerContent/DrawerContent.js +1 -1
- package/styled-components/cjs/components/Drawer/ui/DrawerFooter/DrawerFooter.js +1 -1
- package/styled-components/cjs/components/Drawer/ui/DrawerHeader/DrawerHeader.js +1 -1
- package/styled-components/cjs/components/Dropdown/Dropdown.js +7 -29
- package/styled-components/cjs/components/Dropdown/Dropdown.styles.js +1 -1
- package/styled-components/cjs/components/Dropdown/Dropdown.tokens.js +0 -1
- package/styled-components/cjs/components/Dropdown/index.js +1 -9
- package/styled-components/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +1 -1
- package/styled-components/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +1 -1
- package/styled-components/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +1 -1
- package/styled-components/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +1 -1
- package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js +7 -9
- package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +1 -1
- package/styled-components/cjs/components/Dropdown/utils/index.js +2 -49
- package/styled-components/cjs/components/Grid/Grid.js +2 -2
- package/styled-components/cjs/components/Grid/ui/Col/Col.js +2 -2
- package/styled-components/cjs/components/Grid/ui/Row/Row.js +1 -1
- package/styled-components/cjs/components/Grid/utils/index.js +1 -1
- package/styled-components/cjs/components/Header/HeaderRoot/HeaderRoot.js +1 -1
- package/styled-components/cjs/components/Header/ui/HeaderArrow/HeaderArrow.js +1 -1
- package/styled-components/cjs/components/Header/ui/HeaderLogo/HeaderLogo.js +1 -1
- package/styled-components/cjs/components/Header/ui/HeaderTitleWrapper/HeaderTitleWrapper.js +1 -1
- package/styled-components/cjs/components/IconButton/IconButton.js +86 -0
- package/styled-components/cjs/components/IconButton/IconButton.styles.js +29 -0
- package/styled-components/cjs/components/IconButton/IconButton.tokens.js +34 -0
- package/styled-components/cjs/components/IconButton/IconButton.types.js +5 -0
- package/styled-components/cjs/components/IconButton/index.js +31 -0
- package/styled-components/cjs/components/IconButton/variations/_disabled/base.js +8 -0
- package/styled-components/cjs/components/IconButton/variations/_disabled/tokens.json +1 -0
- package/styled-components/cjs/components/IconButton/variations/_focused/base.js +8 -0
- package/styled-components/cjs/components/IconButton/variations/_focused/tokens.json +1 -0
- package/styled-components/cjs/components/IconButton/variations/_size/base.js +8 -0
- package/styled-components/cjs/components/IconButton/variations/_size/tokens.json +1 -0
- package/styled-components/cjs/components/IconButton/variations/_view/base.js +8 -0
- package/styled-components/cjs/components/IconButton/variations/_view/tokens.json +1 -0
- package/styled-components/cjs/components/Image/Image.js +2 -2
- package/styled-components/cjs/components/Image/Image.styles.js +1 -1
- package/styled-components/cjs/components/Indicator/Indicator.js +1 -1
- package/styled-components/cjs/components/Link/Link.js +1 -1
- package/styled-components/cjs/components/Modal/Modal.js +1 -1
- package/styled-components/cjs/components/Modal/ModalContext.js +1 -1
- package/styled-components/cjs/components/Modal/hooks/useModal.js +1 -1
- package/styled-components/cjs/components/Notification/Notification.js +1 -1
- package/styled-components/cjs/components/Notification/Notification.styles.js +1 -1
- package/styled-components/cjs/components/Notification/NotificationsPortal.js +1 -1
- package/styled-components/cjs/components/Notification/NotificationsStore.js +1 -1
- package/styled-components/cjs/components/Overlay/Overlay.js +2 -2
- package/styled-components/cjs/components/Pagination/Pagination.js +3 -3
- package/styled-components/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +2 -2
- package/styled-components/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/styled-components/cjs/components/Panel/Panel.js +2 -2
- package/styled-components/cjs/components/Panel/ui/PanelContent/PanelContent.js +1 -1
- package/styled-components/cjs/components/Panel/ui/PanelFooter/PanelFooter.js +1 -1
- package/styled-components/cjs/components/Panel/ui/PanelHeader/PanelHeader.js +1 -1
- package/styled-components/cjs/components/Popover/Popover.js +9 -9
- package/styled-components/cjs/components/Popup/Popup.js +2 -2
- package/styled-components/cjs/components/Popup/PopupContext.js +1 -1
- package/styled-components/cjs/components/Popup/PopupRoot.js +1 -1
- package/styled-components/cjs/components/Popup/hooks/usePopup.js +1 -1
- package/styled-components/cjs/components/Progress/Progress.js +1 -1
- package/styled-components/cjs/components/Progress/Progress.styles.js +1 -1
- package/styled-components/cjs/components/Radiobox/Radiobox.js +1 -1
- package/styled-components/cjs/components/SSRProvider/SSRProvider.js +1 -1
- package/styled-components/cjs/components/Segment/SegmentProvider/SegmentProvider.js +1 -1
- package/styled-components/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.js +1 -1
- package/styled-components/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.styles.js +1 -1
- package/styled-components/cjs/components/Segment/ui/SegmentItem/SegmentItem.js +3 -3
- package/styled-components/cjs/components/Segment/ui/SegmentItem/SegmentItem.styles.js +1 -1
- package/styled-components/cjs/components/Select/Select.js +6 -6
- package/styled-components/cjs/components/Select/hooks/useKeyNavigation.js +12 -12
- package/styled-components/cjs/components/Select/ui/SelectChip/SelectChip.js +2 -2
- package/styled-components/cjs/components/Select/ui/SelectTarget/SelectTarget.js +3 -3
- package/styled-components/cjs/components/Select/utils/index.js +3 -3
- package/styled-components/cjs/components/Skeleton/LineSkeleton/LineSkeleton.js +1 -1
- package/styled-components/cjs/components/Skeleton/LineSkeleton/LineSkeleton.styles.js +1 -1
- package/styled-components/cjs/components/Skeleton/RectSkeleton/RectSkeleton.js +1 -1
- package/styled-components/cjs/components/Skeleton/TextSkeleton/TextSkeleton.js +2 -2
- package/styled-components/cjs/components/Skeleton/hoc/withSkeleton.js +1 -1
- package/styled-components/cjs/components/Spinner/Spinner.js +1 -1
- package/styled-components/cjs/components/Spinner/Spinner.styles.js +1 -1
- package/styled-components/cjs/components/Spinner/utils/index.js +1 -1
- package/styled-components/cjs/components/Switch/Switch.js +1 -1
- package/styled-components/cjs/components/Tabs/TabsContext.js +2 -3
- package/styled-components/cjs/components/Tabs/createTabsController.js +1 -1
- package/styled-components/cjs/components/Tabs/ui/TabItem/TabItem.js +2 -2
- package/styled-components/cjs/components/Tabs/ui/TabItem/TabItem.styles.js +1 -1
- package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.js +3 -3
- package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.styles.js +1 -1
- package/styled-components/cjs/components/TextArea/TextArea.js +2 -2
- package/styled-components/cjs/components/TextField/TextField.js +3 -3
- package/styled-components/cjs/components/TextField/hooks/useKeyNavigation.js +9 -9
- package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +2 -2
- package/styled-components/cjs/components/Toast/Toast.js +2 -2
- package/styled-components/cjs/components/Toast/Toast.styles.js +1 -1
- package/styled-components/cjs/components/Toast/ToastController.js +2 -2
- package/styled-components/cjs/components/Toast/ToastProvider/ToastProvider.js +3 -3
- package/styled-components/cjs/components/Toolbar/Toolbar.js +1 -1
- package/styled-components/cjs/components/Toolbar/ui/ToolbarDivider/ToolbarDivider.js +1 -1
- package/styled-components/cjs/components/Tooltip/Tooltip.js +2 -2
- package/styled-components/cjs/components/Typography/Old/Subtitle/Subtitle.js +2 -2
- package/styled-components/cjs/components/Typography/Old/TypographyOld.js +2 -2
- package/styled-components/cjs/components/Typography/Typography.js +2 -2
- package/styled-components/cjs/engines/common.js +1 -1
- package/styled-components/cjs/engines/styled-components.js +1 -1
- package/styled-components/cjs/examples/_helpers.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Avatar/Avatar.stories.tsx +26 -1
- package/styled-components/cjs/examples/plasma_b2c/components/AvatarGroup/AvatarGroup.stories.tsx +36 -18
- package/styled-components/cjs/examples/plasma_b2c/components/Button/Button.stories.tsx +27 -11
- package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.stories.tsx +7 -27
- package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.stories.tsx +8 -27
- package/styled-components/cjs/examples/plasma_b2c/components/Grid/Grid.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/IconButton/IconButton.config.js +45 -0
- package/styled-components/cjs/examples/plasma_b2c/components/IconButton/IconButton.js +11 -0
- package/styled-components/cjs/examples/plasma_b2c/components/IconButton/IconButton.stories.tsx +65 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Radiobox/Radiobox.stories.tsx +37 -43
- package/styled-components/cjs/examples/plasma_web/components/Avatar/Avatar.stories.tsx +26 -1
- package/styled-components/cjs/examples/plasma_web/components/Dropdown/Normal/Dropdown.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Dropdown/Normal/Dropdown.stories.tsx +8 -27
- package/styled-components/cjs/examples/plasma_web/components/Dropdown/Tight/Dropdown.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Dropdown/Tight/Dropdown.stories.tsx +8 -27
- package/styled-components/cjs/examples/plasma_web/components/Grid/Grid.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/IconButton/IconButton.config.js +45 -0
- package/styled-components/cjs/examples/plasma_web/components/IconButton/IconButton.js +11 -0
- package/styled-components/cjs/examples/plasma_web/components/IconButton/IconButton.stories.tsx +65 -0
- package/styled-components/cjs/examples/plasma_web/components/Radiobox/Radiobox.stories.tsx +37 -43
- package/styled-components/cjs/examples/sds_engineer/components/Avatar/Avatar.stories.tsx +27 -1
- package/styled-components/cjs/examples/sds_engineer/components/Grid/Grid.config.js +1 -1
- package/styled-components/cjs/index.js +11 -0
- package/styled-components/cjs/mixins/applySpacing.js +1 -1
- package/styled-components/cjs/mixins/typography.js +1 -1
- package/styled-components/es/components/Avatar/Avatar.js +34 -3
- package/styled-components/es/components/Avatar/Avatar.template-doc.mdx +52 -2
- package/styled-components/es/components/Button/Button.js +1 -1
- package/styled-components/es/components/Calendar/CalendarBase/CalendarBase.js +1 -1
- package/styled-components/es/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
- package/styled-components/es/components/Calendar/hoc/withRange.js +1 -1
- package/styled-components/es/components/Calendar/hooks/useKeyNavigation.js +20 -20
- package/styled-components/es/components/Calendar/store/reducer.js +1 -1
- package/styled-components/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
- package/styled-components/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
- package/styled-components/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
- package/styled-components/es/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
- package/styled-components/es/components/Chip/Chip.js +2 -2
- package/styled-components/es/components/Combobox/Combobox.js +5 -5
- package/styled-components/es/components/Combobox/hooks/useFocusController.js +9 -9
- package/styled-components/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
- package/styled-components/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
- package/styled-components/es/components/Divider/Divider.js +1 -1
- package/styled-components/es/components/Drawer/DrawerContext.js +1 -1
- package/styled-components/es/components/Drawer/hooks/useDrawer.js +1 -1
- package/styled-components/es/components/Drawer/ui/DrawerContent/DrawerContent.js +1 -1
- package/styled-components/es/components/Drawer/ui/DrawerFooter/DrawerFooter.js +1 -1
- package/styled-components/es/components/Drawer/ui/DrawerHeader/DrawerHeader.js +1 -1
- package/styled-components/es/components/Dropdown/Dropdown.js +6 -29
- package/styled-components/es/components/Dropdown/Dropdown.styles.js +1 -1
- package/styled-components/es/components/Dropdown/Dropdown.tokens.js +0 -1
- package/styled-components/es/components/Dropdown/index.js +0 -1
- package/styled-components/es/components/Dropdown/ui/DropdownItem/DropdownItem.js +6 -8
- package/styled-components/es/components/Dropdown/utils/index.js +1 -48
- package/styled-components/es/components/Grid/Grid.js +1 -1
- package/styled-components/es/components/Grid/ui/Col/Col.js +1 -1
- package/styled-components/es/components/Grid/utils/index.js +1 -1
- package/styled-components/es/components/IconButton/IconButton.js +77 -0
- package/styled-components/es/components/IconButton/IconButton.styles.js +22 -0
- package/styled-components/es/components/IconButton/IconButton.tokens.js +28 -0
- package/styled-components/es/components/IconButton/IconButton.types.js +1 -0
- package/styled-components/es/components/IconButton/index.js +2 -0
- package/styled-components/es/components/IconButton/variations/_disabled/base.js +2 -0
- package/styled-components/es/components/IconButton/variations/_disabled/tokens.json +1 -0
- package/styled-components/es/components/IconButton/variations/_focused/base.js +2 -0
- package/styled-components/es/components/IconButton/variations/_focused/tokens.json +1 -0
- package/styled-components/es/components/IconButton/variations/_size/base.js +2 -0
- package/styled-components/es/components/IconButton/variations/_size/tokens.json +1 -0
- package/styled-components/es/components/IconButton/variations/_view/base.js +2 -0
- package/styled-components/es/components/IconButton/variations/_view/tokens.json +1 -0
- package/styled-components/es/components/Image/Image.js +1 -1
- package/styled-components/es/components/Modal/ModalContext.js +1 -1
- package/styled-components/es/components/Modal/hooks/useModal.js +1 -1
- package/styled-components/es/components/Notification/NotificationsStore.js +1 -1
- package/styled-components/es/components/Overlay/Overlay.js +1 -1
- package/styled-components/es/components/Pagination/Pagination.js +2 -2
- package/styled-components/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
- package/styled-components/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
- package/styled-components/es/components/Panel/Panel.js +1 -1
- package/styled-components/es/components/Popover/Popover.js +8 -8
- package/styled-components/es/components/Popup/Popup.js +1 -1
- package/styled-components/es/components/Popup/hooks/usePopup.js +1 -1
- package/styled-components/es/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
- package/styled-components/es/components/Select/Select.js +5 -5
- package/styled-components/es/components/Select/hooks/useKeyNavigation.js +12 -12
- package/styled-components/es/components/Select/ui/SelectChip/SelectChip.js +1 -1
- package/styled-components/es/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
- package/styled-components/es/components/Select/utils/index.js +3 -3
- package/styled-components/es/components/Skeleton/TextSkeleton/TextSkeleton.js +1 -1
- package/styled-components/es/components/Skeleton/hoc/withSkeleton.js +1 -1
- package/styled-components/es/components/Spinner/utils/index.js +1 -1
- package/styled-components/es/components/Tabs/TabsContext.js +2 -3
- package/styled-components/es/components/Tabs/ui/TabItem/TabItem.js +1 -1
- package/styled-components/es/components/Tabs/ui/Tabs/Tabs.js +2 -2
- package/styled-components/es/components/TextArea/TextArea.js +1 -1
- package/styled-components/es/components/TextField/TextField.js +2 -2
- package/styled-components/es/components/TextField/hooks/useKeyNavigation.js +9 -9
- package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
- package/styled-components/es/components/Toast/Toast.js +1 -1
- package/styled-components/es/components/Toast/ToastController.js +1 -1
- package/styled-components/es/components/Toast/ToastProvider/ToastProvider.js +2 -2
- package/styled-components/es/components/Toolbar/ui/ToolbarDivider/ToolbarDivider.js +1 -1
- package/styled-components/es/components/Tooltip/Tooltip.js +1 -1
- package/styled-components/es/components/Typography/Old/Subtitle/Subtitle.js +1 -1
- package/styled-components/es/components/Typography/Old/TypographyOld.js +1 -1
- package/styled-components/es/components/Typography/Typography.js +1 -1
- package/styled-components/es/engines/common.js +1 -1
- package/styled-components/es/examples/_helpers.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Avatar/Avatar.stories.tsx +26 -1
- package/styled-components/es/examples/plasma_b2c/components/AvatarGroup/AvatarGroup.stories.tsx +36 -18
- package/styled-components/es/examples/plasma_b2c/components/Button/Button.stories.tsx +27 -11
- package/styled-components/es/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.stories.tsx +7 -27
- package/styled-components/es/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.stories.tsx +8 -27
- package/styled-components/es/examples/plasma_b2c/components/Grid/Grid.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/IconButton/IconButton.config.js +39 -0
- package/styled-components/es/examples/plasma_b2c/components/IconButton/IconButton.js +5 -0
- package/styled-components/es/examples/plasma_b2c/components/IconButton/IconButton.stories.tsx +65 -0
- package/styled-components/es/examples/plasma_b2c/components/Radiobox/Radiobox.stories.tsx +37 -43
- package/styled-components/es/examples/plasma_web/components/Avatar/Avatar.stories.tsx +26 -1
- package/styled-components/es/examples/plasma_web/components/Dropdown/Normal/Dropdown.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Dropdown/Normal/Dropdown.stories.tsx +8 -27
- package/styled-components/es/examples/plasma_web/components/Dropdown/Tight/Dropdown.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Dropdown/Tight/Dropdown.stories.tsx +8 -27
- package/styled-components/es/examples/plasma_web/components/Grid/Grid.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/IconButton/IconButton.config.js +39 -0
- package/styled-components/es/examples/plasma_web/components/IconButton/IconButton.js +5 -0
- package/styled-components/es/examples/plasma_web/components/IconButton/IconButton.stories.tsx +65 -0
- package/styled-components/es/examples/plasma_web/components/Radiobox/Radiobox.stories.tsx +37 -43
- package/styled-components/es/examples/sds_engineer/components/Avatar/Avatar.stories.tsx +27 -1
- package/styled-components/es/examples/sds_engineer/components/Grid/Grid.config.js +1 -1
- package/styled-components/es/index.js +1 -0
- package/styled-components/es/mixins/applySpacing.js +1 -1
- package/styled-components/es/mixins/typography.js +1 -1
- package/types/components/Avatar/Avatar.d.ts +3 -1
- package/types/components/Avatar/Avatar.d.ts.map +1 -1
- package/types/components/Avatar/Avatar.types.d.ts +7 -0
- package/types/components/Avatar/Avatar.types.d.ts.map +1 -1
- package/types/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/types/components/Dropdown/Dropdown.tokens.d.ts +0 -1
- package/types/components/Dropdown/Dropdown.tokens.d.ts.map +1 -1
- package/types/components/Dropdown/Dropdown.types.d.ts +2 -7
- package/types/components/Dropdown/Dropdown.types.d.ts.map +1 -1
- package/types/components/Dropdown/index.d.ts +0 -1
- package/types/components/Dropdown/index.d.ts.map +1 -1
- package/types/components/Dropdown/ui/DropdownItem/DropdownItem.d.ts.map +1 -1
- package/types/components/Dropdown/utils/index.d.ts +2 -5
- package/types/components/Dropdown/utils/index.d.ts.map +1 -1
- package/types/components/IconButton/IconButton.d.ts +30 -0
- package/types/components/IconButton/IconButton.d.ts.map +1 -0
- package/types/components/IconButton/IconButton.styles.d.ts +21 -0
- package/types/components/IconButton/IconButton.styles.d.ts.map +1 -0
- package/types/components/IconButton/IconButton.tokens.d.ts +29 -0
- package/types/components/IconButton/IconButton.tokens.d.ts.map +1 -0
- package/types/components/IconButton/IconButton.types.d.ts +13 -0
- package/types/components/IconButton/IconButton.types.d.ts.map +1 -0
- package/types/components/IconButton/index.d.ts +4 -0
- package/types/components/IconButton/index.d.ts.map +1 -0
- package/types/components/IconButton/variations/_disabled/base.d.ts +2 -0
- package/types/components/IconButton/variations/_disabled/base.d.ts.map +1 -0
- package/types/components/IconButton/variations/_focused/base.d.ts +2 -0
- package/types/components/IconButton/variations/_focused/base.d.ts.map +1 -0
- package/types/components/IconButton/variations/_size/base.d.ts +2 -0
- package/types/components/IconButton/variations/_size/base.d.ts.map +1 -0
- package/types/components/IconButton/variations/_view/base.d.ts +2 -0
- package/types/components/IconButton/variations/_view/base.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Avatar/Avatar.d.ts +2 -0
- package/types/examples/plasma_b2c/components/Avatar/Avatar.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/IconButton/IconButton.config.d.ts +38 -0
- package/types/examples/plasma_b2c/components/IconButton/IconButton.config.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/IconButton/IconButton.d.ts +32 -0
- package/types/examples/plasma_b2c/components/IconButton/IconButton.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Avatar/Avatar.d.ts +2 -0
- package/types/examples/plasma_web/components/Avatar/Avatar.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Dropdown/Normal/Dropdown.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Dropdown/Tight/Dropdown.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/IconButton/IconButton.config.d.ts +38 -0
- package/types/examples/plasma_web/components/IconButton/IconButton.config.d.ts.map +1 -0
- package/types/examples/plasma_web/components/IconButton/IconButton.d.ts +32 -0
- package/types/examples/plasma_web/components/IconButton/IconButton.d.ts.map +1 -0
- package/types/examples/sds_engineer/components/Avatar/Avatar.d.ts +1 -0
- package/types/examples/sds_engineer/components/Avatar/Avatar.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/cjs/components/Dropdown/hooks/useKeyboardNavigation.js +0 -81
- package/cjs/components/Dropdown/hooks/useKeyboardNavigation.js.map +0 -1
- package/es/components/Dropdown/hooks/useKeyboardNavigation.js +0 -76
- package/es/components/Dropdown/hooks/useKeyboardNavigation.js.map +0 -1
- package/styled-components/cjs/components/Dropdown/hooks/useKeyboardNavigation.js +0 -83
- package/styled-components/es/components/Dropdown/hooks/useKeyboardNavigation.js +0 -77
- package/types/components/Dropdown/hooks/useKeyboardNavigation.d.ts +0 -13
- package/types/components/Dropdown/hooks/useKeyboardNavigation.d.ts.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useKeyNavigation.js","sources":["../../../../src/components/Select/hooks/useKeyNavigation.ts"],"sourcesContent":["import { KeyboardEvent, useCallback, useEffect, useState } from 'react';\n\nimport type { UseKeyNavigationProps } from '../Select.types';\n\nexport const Keys = {\n Enter: 'Enter',\n Space: 'Space',\n Tab: 'Tab',\n Escape: 'Escape',\n ArrowLeft: 'ArrowLeft',\n ArrowRight: 'ArrowRight',\n ArrowUp: 'ArrowUp',\n ArrowDown: 'ArrowDown',\n Backspace: 'Backspace',\n ShiftLeft: 'ShiftLeft',\n ShiftRight: 'ShiftRight',\n};\n\nexport const useKeyNavigation = ({\n controlledRefs: { targetRef, chipsRefs, selectRef, itemsRefs, inputRef },\n opened,\n enumerationType,\n valueType,\n componentType = 'select',\n value,\n search,\n updateValue,\n updateOpened,\n}: UseKeyNavigationProps) => {\n const [selectItemIndex, setSelectItemIndex] = useState(-1);\n const [selectChipIndex, setSelectChipIndex] = useState(-1);\n\n useEffect(() => {\n if (!opened) {\n setSelectItemIndex(-1);\n setSelectChipIndex(-1);\n\n return;\n }\n\n itemsRefs?.current?.[selectItemIndex]?.focus();\n }, [opened]);\n\n useEffect(() => {\n itemsRefs?.current?.[selectItemIndex]?.focus();\n }, [value, search]);\n\n const onKeyDownTarget = useCallback(\n (event: KeyboardEvent<HTMLButtonElement | HTMLInputElement>) => {\n const { code } = event;\n\n const chipsRefsCount = chipsRefs.current.length;\n let scrollIntoView = false;\n let newOpened = opened;\n let newSelectItemIndex = selectItemIndex;\n let newSelectChipIndex = selectChipIndex;\n let focusedItem: HTMLElement | HTMLInputElement | null = null;\n\n if (code === Keys.Enter || (code === Keys.Space && componentType !== 'combobox')) {\n event.preventDefault();\n }\n\n if (code === Keys.Escape) {\n newOpened = false;\n newSelectItemIndex = -1;\n newSelectChipIndex = -1;\n focusedItem = targetRef.current;\n }\n\n if (code === Keys.ArrowLeft && valueType === 'multiple' && enumerationType === 'chip') {\n const index = selectChipIndex - 1 <= 0 ? 0 : selectChipIndex - 1;\n\n newSelectChipIndex = document.activeElement === targetRef.current ? 0 : index;\n newSelectChipIndex =\n document.activeElement === inputRef?.current ? chipsRefsCount - 1 : newSelectChipIndex;\n\n focusedItem = chipsRefs.current?.[newSelectChipIndex];\n\n scrollIntoView = true;\n }\n\n if (code === Keys.ArrowRight && valueType === 'multiple' && enumerationType === 'chip') {\n const index = selectChipIndex + 1 === chipsRefsCount ? selectChipIndex : selectChipIndex + 1;\n\n newSelectChipIndex = document.activeElement === targetRef.current ? 0 : index;\n focusedItem =\n index === selectChipIndex\n ? (inputRef?.current as HTMLInputElement)\n : chipsRefs.current?.[newSelectChipIndex];\n\n scrollIntoView = true;\n }\n\n if (code === Keys.Backspace && document.activeElement !== inputRef?.current) {\n const index = selectChipIndex - 1 <= 0 ? 0 : selectChipIndex - 1;\n\n newSelectChipIndex = chipsRefsCount === 0 ? -1 : index;\n focusedItem = chipsRefsCount === 0 ? (inputRef || targetRef)?.current : chipsRefs?.current?.[index];\n\n scrollIntoView = true;\n }\n\n if (\n code === Keys.ArrowUp ||\n code === Keys.ArrowDown ||\n (code === Keys.Enter && componentType !== 'combobox') ||\n (code === Keys.Space && componentType !== 'combobox')\n ) {\n newOpened = true;\n newSelectItemIndex = selectItemIndex === -1 ? 0 : selectItemIndex;\n focusedItem = itemsRefs.current?.[newSelectItemIndex];\n }\n\n // INFO: Для кейсов, когда поведение закрытия может контролироваться снаружи\n if (code !== Keys.Enter || componentType !== 'combobox') {\n updateOpened(newOpened, event);\n }\n\n setSelectItemIndex(newSelectItemIndex);\n setSelectChipIndex(newSelectChipIndex);\n\n focusedItem?.focus();\n\n if (scrollIntoView) {\n focusedItem?.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n }\n },\n [opened, selectItemIndex, selectChipIndex, valueType, enumerationType, componentType, updateOpened],\n );\n\n const onKeyDownSelect = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n const { code, shiftKey } = event;\n\n const itemsRefsCount = itemsRefs.current.length;\n const chipsRefsCount = chipsRefs.current.length;\n let scrollIntoView = false;\n let newOpened = opened;\n let newSelectItemIndex = selectItemIndex;\n let newSelectChipIndex = selectChipIndex;\n let focusedItem: HTMLElement | HTMLInputElement | null = null;\n\n if (code === Keys.Enter || code === Keys.Tab) {\n event.preventDefault();\n }\n\n if (code === Keys.Escape) {\n newOpened = false;\n newSelectItemIndex = -1;\n newSelectChipIndex = -1;\n focusedItem = (inputRef || targetRef).current;\n }\n\n if (code === Keys.Tab) {\n newOpened = false;\n newSelectItemIndex = -1;\n newSelectChipIndex = -1;\n focusedItem = (shiftKey\n ? selectRef.current?.previousSibling\n : selectRef.current?.nextSibling) as HTMLElement;\n }\n\n if (code === Keys.ArrowUp) {\n newSelectItemIndex = newSelectItemIndex - 1 === -1 ? itemsRefsCount - 1 : newSelectItemIndex - 1;\n focusedItem = itemsRefs?.current?.[newSelectItemIndex];\n }\n\n if (code === Keys.ArrowDown) {\n newSelectItemIndex = newSelectItemIndex + 1 === itemsRefsCount ? 0 : newSelectItemIndex + 1;\n focusedItem = itemsRefs?.current?.[newSelectItemIndex];\n }\n\n if (\n (code === Keys.ArrowRight || code === Keys.ArrowLeft) &&\n valueType === 'multiple' &&\n enumerationType === 'chip' &&\n chipsRefsCount\n ) {\n newSelectChipIndex = chipsRefsCount - 1;\n newSelectItemIndex = -1;\n focusedItem = chipsRefs?.current?.[newSelectChipIndex];\n\n scrollIntoView = true;\n }\n\n if (code === Keys.Enter || (code === Keys.Space && componentType !== 'combobox')) {\n const item = itemsRefs.current[newSelectItemIndex] as HTMLElement;\n\n // TODO: #1016\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (item.ariaDisabled) {\n return;\n }\n\n updateValue(item, event);\n\n newOpened = valueType === 'single' ? false : opened;\n focusedItem = valueType === 'single' ? targetRef.current : focusedItem;\n }\n\n const isValidKeyCode = [\n Keys.ShiftLeft,\n Keys.ShiftRight,\n Keys.ArrowDown,\n Keys.ArrowLeft,\n Keys.ArrowRight,\n Keys.ArrowUp,\n Keys.Enter,\n Keys.Escape,\n Keys.Tab,\n ].includes(code);\n\n if (componentType === 'combobox' && !isValidKeyCode) {\n event.stopPropagation();\n\n focusedItem = inputRef?.current as HTMLInputElement;\n newSelectItemIndex = -1;\n newSelectChipIndex = -1;\n }\n\n updateOpened(newOpened, event);\n setSelectItemIndex(newSelectItemIndex);\n setSelectChipIndex(newSelectChipIndex);\n\n focusedItem?.focus();\n\n if (scrollIntoView) {\n focusedItem?.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n }\n },\n [\n opened,\n selectItemIndex,\n selectChipIndex,\n valueType,\n enumerationType,\n componentType,\n updateOpened,\n updateValue,\n ],\n );\n\n return { onKeyDownTarget, onKeyDownSelect } as const;\n};\n"],"names":["Keys","Enter","Space","Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","ShiftLeft","ShiftRight","useKeyNavigation","_ref","_ref$controlledRefs","controlledRefs","targetRef","chipsRefs","selectRef","itemsRefs","inputRef","opened","enumerationType","valueType","_ref$componentType","componentType","value","search","updateValue","updateOpened","_useState","useState","_useState2","_slicedToArray","selectItemIndex","setSelectItemIndex","_useState3","_useState4","selectChipIndex","setSelectChipIndex","useEffect","_itemsRefs$current","_itemsRefs$current$se","current","focus","_itemsRefs$current2","_itemsRefs$current2$s","onKeyDownTarget","useCallback","event","_focusedItem","code","chipsRefsCount","length","scrollIntoView","newOpened","newSelectItemIndex","newSelectChipIndex","focusedItem","preventDefault","_chipsRefs$current","index","document","activeElement","_chipsRefs$current2","_ref2","_chipsRefs$current3","_itemsRefs$current3","_focusedItem2","behavior","block","inline","onKeyDownSelect","_focusedItem3","shiftKey","itemsRefsCount","_selectRef$current","_selectRef$current2","previousSibling","nextSibling","_itemsRefs$current4","_itemsRefs$current5","_chipsRefs$current4","item","ariaDisabled","isValidKeyCode","includes","stopPropagation","_focusedItem4"],"mappings":";;;;;;;AAIO,IAAMA,IAAI,GAAG;AAChBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,SA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AA,GAAAA,KAAAA,CAAAA,GAAAA,QAAQ,CAAEuB,OAA2B,CAAA;MACnDa,kBAAkB,GAAG,CAAC,CAAC,CAAA;MACvBC,kBAAkB,GAAG,CAAC,CAAC,CAAA;AAC3B,KAAA;AAEA5B,IAAAA,YAAY,CAAC0B,SAAS,EAAEN,KAAK,CAAC,CAAA;IAC9Bd,kBAAkB,CAACqB,kBAAkB,CAAC,CAAA;IACtCjB,kBAAkB,CAACkB,kBAAkB,CAAC,CAAA;IAEtC,CAAAgB,aAAA,GAAAf,WAAW,MAAAe,IAAAA,IAAAA,aAAA,uBAAXA,aAAA,CAAa7B,KAAK,EAAE,CAAA;AAEpB,IAAA,IAAIU,cAAc,EAAE;AAAA,MAAA,IAAAkC,aAAA,CAAA;MAChB,CAAAA,aAAA,GAAA9B,WAAW,MAAA,IAAA,IAAA8B,aAAA,KAAXA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,aAAA,CAAalC,cAAc,CAAC;AACxBe,QAAAA,QAAQ,EAAE,QAAQ;AAClBC,QAAAA,KAAK,EAAE,QAAQ;AACfC,QAAAA,MAAM,EAAE,QAAA;AACZ,OAAC,CAAC,CAAA;AACN,KAAA;AACJ,GAAC,EACD,CACIlD,MAAM,EACNa,eAAe,EACfI,eAAe,EACff,SAAS,EACTD,eAAe,EACfG,aAAa,EACbI,YAAY,EACZD,WAAW,CAEnB,CAAC,CAAA;EAED,OAAO;AAAEmB,IAAAA,eAAe,EAAfA,eAAe;AAAEyB,IAAAA,eAAe,EAAfA,eAAAA;GAAiB,CAAA;AAC/C;;;;;"}
|
1
|
+
{"version":3,"file":"useKeyNavigation.js","sources":["../../../../src/components/Select/hooks/useKeyNavigation.ts"],"sourcesContent":["import { KeyboardEvent, useCallback, useEffect, useState } from 'react';\n\nimport type { UseKeyNavigationProps } from '../Select.types';\n\nexport const Keys = {\n Enter: 'Enter',\n Space: 'Space',\n Tab: 'Tab',\n Escape: 'Escape',\n ArrowLeft: 'ArrowLeft',\n ArrowRight: 'ArrowRight',\n ArrowUp: 'ArrowUp',\n ArrowDown: 'ArrowDown',\n Backspace: 'Backspace',\n ShiftLeft: 'ShiftLeft',\n ShiftRight: 'ShiftRight',\n};\n\nexport const useKeyNavigation = ({\n controlledRefs: { targetRef, chipsRefs, selectRef, itemsRefs, inputRef },\n opened,\n enumerationType,\n valueType,\n componentType = 'select',\n value,\n search,\n updateValue,\n updateOpened,\n}: UseKeyNavigationProps) => {\n const [selectItemIndex, setSelectItemIndex] = useState(-1);\n const [selectChipIndex, setSelectChipIndex] = useState(-1);\n\n useEffect(() => {\n if (!opened) {\n setSelectItemIndex(-1);\n setSelectChipIndex(-1);\n\n return;\n }\n\n itemsRefs?.current?.[selectItemIndex]?.focus();\n }, [opened]);\n\n useEffect(() => {\n itemsRefs?.current?.[selectItemIndex]?.focus();\n }, [value, search]);\n\n const onKeyDownTarget = useCallback(\n (event: KeyboardEvent<HTMLButtonElement | HTMLInputElement>) => {\n const { code } = event;\n\n const chipsRefsCount = chipsRefs.current.length;\n let scrollIntoView = false;\n let newOpened = opened;\n let newSelectItemIndex = selectItemIndex;\n let newSelectChipIndex = selectChipIndex;\n let focusedItem: HTMLElement | HTMLInputElement | null = null;\n\n if (code === Keys.Enter || (code === Keys.Space && componentType !== 'combobox')) {\n event.preventDefault();\n }\n\n if (code === Keys.Escape) {\n newOpened = false;\n newSelectItemIndex = -1;\n newSelectChipIndex = -1;\n focusedItem = targetRef.current;\n }\n\n if (code === Keys.ArrowLeft && valueType === 'multiple' && enumerationType === 'chip') {\n const index = selectChipIndex - 1 <= 0 ? 0 : selectChipIndex - 1;\n\n newSelectChipIndex = document.activeElement === targetRef.current ? 0 : index;\n newSelectChipIndex =\n document.activeElement === inputRef?.current ? chipsRefsCount - 1 : newSelectChipIndex;\n\n focusedItem = chipsRefs.current?.[newSelectChipIndex];\n\n scrollIntoView = true;\n }\n\n if (code === Keys.ArrowRight && valueType === 'multiple' && enumerationType === 'chip') {\n const index = selectChipIndex + 1 === chipsRefsCount ? selectChipIndex : selectChipIndex + 1;\n\n newSelectChipIndex = document.activeElement === targetRef.current ? 0 : index;\n focusedItem =\n index === selectChipIndex\n ? (inputRef?.current as HTMLInputElement)\n : chipsRefs.current?.[newSelectChipIndex];\n\n scrollIntoView = true;\n }\n\n if (code === Keys.Backspace && document.activeElement !== inputRef?.current) {\n const index = selectChipIndex - 1 <= 0 ? 0 : selectChipIndex - 1;\n\n newSelectChipIndex = chipsRefsCount === 0 ? -1 : index;\n focusedItem = chipsRefsCount === 0 ? (inputRef || targetRef)?.current : chipsRefs?.current?.[index];\n\n scrollIntoView = true;\n }\n\n if (\n code === Keys.ArrowUp ||\n code === Keys.ArrowDown ||\n (code === Keys.Enter && componentType !== 'combobox') ||\n (code === Keys.Space && componentType !== 'combobox')\n ) {\n newOpened = true;\n newSelectItemIndex = selectItemIndex === -1 ? 0 : selectItemIndex;\n focusedItem = itemsRefs.current?.[newSelectItemIndex];\n }\n\n // INFO: Для кейсов, когда поведение закрытия может контролироваться снаружи\n if (code !== Keys.Enter || componentType !== 'combobox') {\n updateOpened(newOpened, event);\n }\n\n setSelectItemIndex(newSelectItemIndex);\n setSelectChipIndex(newSelectChipIndex);\n\n focusedItem?.focus();\n\n if (scrollIntoView) {\n focusedItem?.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n }\n },\n [opened, selectItemIndex, selectChipIndex, valueType, enumerationType, componentType, updateOpened],\n );\n\n const onKeyDownSelect = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n const { code, shiftKey } = event;\n\n const itemsRefsCount = itemsRefs.current.length;\n const chipsRefsCount = chipsRefs.current.length;\n let scrollIntoView = false;\n let newOpened = opened;\n let newSelectItemIndex = selectItemIndex;\n let newSelectChipIndex = selectChipIndex;\n let focusedItem: HTMLElement | HTMLInputElement | null = null;\n\n if (code === Keys.Enter || code === Keys.Tab) {\n event.preventDefault();\n }\n\n if (code === Keys.Escape) {\n newOpened = false;\n newSelectItemIndex = -1;\n newSelectChipIndex = -1;\n focusedItem = (inputRef || targetRef).current;\n }\n\n if (code === Keys.Tab) {\n newOpened = false;\n newSelectItemIndex = -1;\n newSelectChipIndex = -1;\n focusedItem = (shiftKey\n ? selectRef.current?.previousSibling\n : selectRef.current?.nextSibling) as HTMLElement;\n }\n\n if (code === Keys.ArrowUp) {\n newSelectItemIndex = newSelectItemIndex - 1 === -1 ? itemsRefsCount - 1 : newSelectItemIndex - 1;\n focusedItem = itemsRefs?.current?.[newSelectItemIndex];\n }\n\n if (code === Keys.ArrowDown) {\n newSelectItemIndex = newSelectItemIndex + 1 === itemsRefsCount ? 0 : newSelectItemIndex + 1;\n focusedItem = itemsRefs?.current?.[newSelectItemIndex];\n }\n\n if (\n (code === Keys.ArrowRight || code === Keys.ArrowLeft) &&\n valueType === 'multiple' &&\n enumerationType === 'chip' &&\n chipsRefsCount\n ) {\n newSelectChipIndex = chipsRefsCount - 1;\n newSelectItemIndex = -1;\n focusedItem = chipsRefs?.current?.[newSelectChipIndex];\n\n scrollIntoView = true;\n }\n\n if (code === Keys.Enter || (code === Keys.Space && componentType !== 'combobox')) {\n const item = itemsRefs.current[newSelectItemIndex] as HTMLElement;\n\n // TODO: #1016\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (item.ariaDisabled) {\n return;\n }\n\n updateValue(item, event);\n\n newOpened = valueType === 'single' ? false : opened;\n focusedItem = valueType === 'single' ? targetRef.current : focusedItem;\n }\n\n const isValidKeyCode = [\n Keys.ShiftLeft,\n Keys.ShiftRight,\n Keys.ArrowDown,\n Keys.ArrowLeft,\n Keys.ArrowRight,\n Keys.ArrowUp,\n Keys.Enter,\n Keys.Escape,\n Keys.Tab,\n ].includes(code);\n\n if (componentType === 'combobox' && !isValidKeyCode) {\n event.stopPropagation();\n\n focusedItem = inputRef?.current as HTMLInputElement;\n newSelectItemIndex = -1;\n newSelectChipIndex = -1;\n }\n\n updateOpened(newOpened, event);\n setSelectItemIndex(newSelectItemIndex);\n setSelectChipIndex(newSelectChipIndex);\n\n focusedItem?.focus();\n\n if (scrollIntoView) {\n focusedItem?.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n }\n },\n [\n opened,\n selectItemIndex,\n selectChipIndex,\n valueType,\n enumerationType,\n componentType,\n updateOpened,\n updateValue,\n ],\n );\n\n return { onKeyDownTarget, onKeyDownSelect } as const;\n};\n"],"names":["Keys","Enter","Space","Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","ShiftLeft","ShiftRight","useKeyNavigation","_ref","_ref$controlledRefs","controlledRefs","targetRef","chipsRefs","selectRef","itemsRefs","inputRef","opened","enumerationType","valueType","_ref$componentType","componentType","value","search","updateValue","updateOpened","_useState","useState","_useState2","_slicedToArray","selectItemIndex","setSelectItemIndex","_useState3","_useState4","selectChipIndex","setSelectChipIndex","useEffect","_itemsRefs$current","current","focus","_itemsRefs$current2","onKeyDownTarget","useCallback","event","_focusedItem","code","chipsRefsCount","length","scrollIntoView","newOpened","newSelectItemIndex","newSelectChipIndex","focusedItem","preventDefault","_chipsRefs$current","index","document","activeElement","_chipsRefs$current2","_ref2","_chipsRefs$current3","_itemsRefs$current3","_focusedItem2","behavior","block","inline","onKeyDownSelect","_focusedItem3","shiftKey","itemsRefsCount","_selectRef$current","_selectRef$current2","previousSibling","nextSibling","_itemsRefs$current4","_itemsRefs$current5","_chipsRefs$current4","item","ariaDisabled","isValidKeyCode","includes","stopPropagation","_focusedItem4"],"mappings":";;;;;;;AAIO,IAAMA,IAAI,GAAG;AAChBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,SAAS,EAA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A;IAC9BZ,kBAAkB,CAACmB,kBAAkB,CAAC,CAAA;IACtCf,kBAAkB,CAACgB,kBAAkB,CAAC,CAAA;IAEtC,CAAAgB,aAAA,GAAAf,WAAW,MAAAe,IAAAA,IAAAA,aAAA,eAAXA,aAAA,CAAa5B,KAAK,EAAE,CAAA;AAEpB,IAAA,IAAIS,cAAc,EAAE;AAAA,MAAA,IAAAkC,aAAA,CAAA;MAChB,CAAAA,aAAA,GAAA9B,WAAW,MAAA,IAAA,IAAA8B,aAAA,KAAXA,KAAAA,CAAAA,IAAAA,aAAA,CAAalC,cAAc,CAAC;AACxBe,QAAAA,QAAQ,EAAE,QAAQ;AAClBC,QAAAA,KAAK,EAAE,QAAQ;AACfC,QAAAA,MAAM,EAAE,QAAA;AACZ,OAAC,CAAC,CAAA;AACN,KAAA;AACJ,GAAC,EACD,CACIhD,MAAM,EACNa,eAAe,EACfI,eAAe,EACff,SAAS,EACTD,eAAe,EACfG,aAAa,EACbI,YAAY,EACZD,WAAW,CAEnB,CAAC,CAAA;EAED,OAAO;AAAEiB,IAAAA,eAAe,EAAfA,eAAe;AAAEyB,IAAAA,eAAe,EAAfA,eAAAA;GAAiB,CAAA;AAC/C;;;;;"}
|
@@ -21,7 +21,7 @@ var SelectChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
21
21
|
onClear(value, text);
|
22
22
|
}, [onClear, value, text]);
|
23
23
|
var onKeyDownHandle = React.useCallback(function (event) {
|
24
|
-
onKeyDown === null || onKeyDown === void 0
|
24
|
+
onKeyDown === null || onKeyDown === void 0 || onKeyDown(value, text, index, event);
|
25
25
|
}, [onKeyDown]);
|
26
26
|
return /*#__PURE__*/React.createElement(SelectChip_styles.StyledChip, {
|
27
27
|
ref: ref,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SelectChip.js","sources":["../../../../../src/components/Select/ui/SelectChip/SelectChip.tsx"],"sourcesContent":["import React, { forwardRef, useCallback } from 'react';\n\nimport { StyledChip } from './SelectChip.styles';\nimport type { SelectChipProps } from './SelectChip.types';\n\n/**\n * Чип, отображающий выбранный элемент\n */\nexport const SelectChip = forwardRef<HTMLButtonElement, SelectChipProps>(\n ({ value, text, index, disabled, readOnly, onClick, onClear, onKeyDown }, ref) => {\n const onClearHandle = useCallback(() => {\n onClear(value, text);\n }, [onClear, value, text]);\n\n const onKeyDownHandle = useCallback(\n (event: React.KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(value, text, index, event);\n },\n [onKeyDown],\n );\n\n return (\n <StyledChip\n ref={ref}\n tabIndex={-1}\n disabled={disabled}\n readOnly={readOnly}\n onClick={onClick}\n onClear={onClearHandle}\n onKeyDown={onKeyDownHandle}\n text={`${text}`}\n />\n );\n },\n);\n"],"names":["SelectChip","forwardRef","_ref","ref","value","text","index","disabled","readOnly","onClick","onClear","onKeyDown","onClearHandle","useCallback","onKeyDownHandle","event","React","createElement","StyledChip","tabIndex","concat"],"mappings":";;;;;;;AAKA;AACA;AACA;AACO,IAAMA,UAAU,gBAAGC,gBAAU,CAChC,UAAAC,IAAA,EAA0EC,GAAG,EAAK;AAAA,EAAA,IAA/EC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IAAEC,KAAK,GAAAJ,IAAA,CAALI,KAAK;IAAEC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IAAEC,QAAQ,GAAAN,IAAA,CAARM,QAAQ;IAAEC,OAAO,GAAAP,IAAA,CAAPO,OAAO;IAAEC,OAAO,GAAAR,IAAA,CAAPQ,OAAO;IAAEC,SAAS,GAAAT,IAAA,CAATS,SAAS,CAAA;AAClE,EAAA,IAAMC,aAAa,GAAGC,iBAAW,CAAC,YAAM;AACpCH,IAAAA,OAAO,CAACN,KAAK,EAAEC,IAAI,CAAC,CAAA;GACvB,EAAE,CAACK,OAAO,EAAEN,KAAK,EAAEC,IAAI,CAAC,CAAC,CAAA;AAE1B,EAAA,IAAMS,eAAe,GAAGD,iBAAW,CAC/B,UAACE,KAA6C,EAAK;AAC/CJ,IAAAA,SAAS,KAATA,IAAAA,IAAAA,SAAS,KAATA,KAAAA,CAAAA,
|
1
|
+
{"version":3,"file":"SelectChip.js","sources":["../../../../../src/components/Select/ui/SelectChip/SelectChip.tsx"],"sourcesContent":["import React, { forwardRef, useCallback } from 'react';\n\nimport { StyledChip } from './SelectChip.styles';\nimport type { SelectChipProps } from './SelectChip.types';\n\n/**\n * Чип, отображающий выбранный элемент\n */\nexport const SelectChip = forwardRef<HTMLButtonElement, SelectChipProps>(\n ({ value, text, index, disabled, readOnly, onClick, onClear, onKeyDown }, ref) => {\n const onClearHandle = useCallback(() => {\n onClear(value, text);\n }, [onClear, value, text]);\n\n const onKeyDownHandle = useCallback(\n (event: React.KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(value, text, index, event);\n },\n [onKeyDown],\n );\n\n return (\n <StyledChip\n ref={ref}\n tabIndex={-1}\n disabled={disabled}\n readOnly={readOnly}\n onClick={onClick}\n onClear={onClearHandle}\n onKeyDown={onKeyDownHandle}\n text={`${text}`}\n />\n );\n },\n);\n"],"names":["SelectChip","forwardRef","_ref","ref","value","text","index","disabled","readOnly","onClick","onClear","onKeyDown","onClearHandle","useCallback","onKeyDownHandle","event","React","createElement","StyledChip","tabIndex","concat"],"mappings":";;;;;;;AAKA;AACA;AACA;AACO,IAAMA,UAAU,gBAAGC,gBAAU,CAChC,UAAAC,IAAA,EAA0EC,GAAG,EAAK;AAAA,EAAA,IAA/EC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IAAEC,KAAK,GAAAJ,IAAA,CAALI,KAAK;IAAEC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IAAEC,QAAQ,GAAAN,IAAA,CAARM,QAAQ;IAAEC,OAAO,GAAAP,IAAA,CAAPO,OAAO;IAAEC,OAAO,GAAAR,IAAA,CAAPQ,OAAO;IAAEC,SAAS,GAAAT,IAAA,CAATS,SAAS,CAAA;AAClE,EAAA,IAAMC,aAAa,GAAGC,iBAAW,CAAC,YAAM;AACpCH,IAAAA,OAAO,CAACN,KAAK,EAAEC,IAAI,CAAC,CAAA;GACvB,EAAE,CAACK,OAAO,EAAEN,KAAK,EAAEC,IAAI,CAAC,CAAC,CAAA;AAE1B,EAAA,IAAMS,eAAe,GAAGD,iBAAW,CAC/B,UAACE,KAA6C,EAAK;AAC/CJ,IAAAA,SAAS,KAATA,IAAAA,IAAAA,SAAS,KAATA,KAAAA,CAAAA,IAAAA,SAAS,CAAGP,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAES,KAAK,CAAC,CAAA;AAC1C,GAAC,EACD,CAACJ,SAAS,CACd,CAAC,CAAA;AAED,EAAA,oBACIK,KAAA,CAAAC,aAAA,CAACC,4BAAU,EAAA;AACPf,IAAAA,GAAG,EAAEA,GAAI;IACTgB,QAAQ,EAAE,CAAC,CAAE;AACbZ,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,OAAO,EAAEE,aAAc;AACvBD,IAAAA,SAAS,EAAEG,eAAgB;IAC3BT,IAAI,EAAA,EAAA,CAAAe,MAAA,CAAKf,IAAI,CAAA;AAAG,GACnB,CAAC,CAAA;AAEV,CACJ;;;;"}
|
@@ -3,8 +3,8 @@
|
|
3
3
|
.Popover_styles_rmr9za_s1pd4d8a__0bafa6fb{width:var(--plasma-popover-arrow-mask-width);height:var(--plasma-popover-arrow-mask-height);}.Popover_styles_rmr9za_s1pd4d8a__0bafa6fb::before{position:absolute;width:var(--plasma-popover-arrow-mask-width);height:var(--plasma-popover-arrow-mask-height);-webkit-mask-image:var(--plasma-popover-arrow-mask-image);mask-image:var(--plasma-popover-arrow-mask-image);background:var(--plasma-popover-arrow-background);content:'';-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}
|
4
4
|
.Popover_styles_rmr9za_s16xlixz__0bafa6fb{position:absolute;z-index:var(--s16xlixz-0);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{right:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{left:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));left:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));left:unset !important;right:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));left:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));left:unset !important;right:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb,.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb,.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:unset !important;bottom:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}
|
5
5
|
|
6
|
-
.
|
7
|
-
.
|
6
|
+
.Dropdown_styles_1daxhqh_sn7uamp__488e0a19 .Dropdown_styles_1daxhqh_popoverTarget__488e0a19{display:block;}
|
7
|
+
.Dropdown_styles_1daxhqh_sjr7fmv__488e0a19{box-sizing:border-box;background:var(--plasma-dropdown-background);box-shadow:var(--plasma-dropdown-box-shadow);border-radius:var(--plasma-dropdown-border-radius);width:var(--plasma-dropdown-width);height:var(--plasma-dropdown-height);padding:var(--plasma-dropdown-padding-top) var(--plasma-dropdown-padding-right) var(--plasma-dropdown-padding-bottom) var(--plasma-dropdown-padding-left);}
|
8
8
|
|
9
9
|
.DropdownDivider_styles_v3xor1_s1brpi5d__3a791565{background:var(--plasma-dropdown-divider-color);width:var(--plasma-dropdown-divider-width);height:var(--plasma-dropdown-divider-height);margin:var(--plasma-dropdown-divider-margin-top) var(--plasma-dropdown-divider-margin-right) var(--plasma-dropdown-divider-margin-bottom) var(--plasma-dropdown-divider-margin-left);}
|
10
10
|
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
require('react');
|
6
6
|
require('@salutejs/plasma-core');
|
7
|
-
require('../../../../utils/react.js');
|
8
7
|
require('@linaria/react');
|
9
8
|
require('@linaria/core');
|
10
9
|
require('focus-visible');
|
11
10
|
require('react-dom');
|
12
11
|
require('react-popper');
|
12
|
+
require('../../../../utils/react.js');
|
13
13
|
var DropdownDivider = require('../../../Dropdown/ui/DropdownDivider/DropdownDivider.js');
|
14
14
|
var base = require('./variations/_view/base.js');
|
15
15
|
var base$1 = require('./variations/_size/base.js');
|
@@ -3,8 +3,8 @@
|
|
3
3
|
.Popover_styles_rmr9za_s1pd4d8a__0bafa6fb{width:var(--plasma-popover-arrow-mask-width);height:var(--plasma-popover-arrow-mask-height);}.Popover_styles_rmr9za_s1pd4d8a__0bafa6fb::before{position:absolute;width:var(--plasma-popover-arrow-mask-width);height:var(--plasma-popover-arrow-mask-height);-webkit-mask-image:var(--plasma-popover-arrow-mask-image);mask-image:var(--plasma-popover-arrow-mask-image);background:var(--plasma-popover-arrow-background);content:'';-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}
|
4
4
|
.Popover_styles_rmr9za_s16xlixz__0bafa6fb{position:absolute;z-index:var(--s16xlixz-0);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{right:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{left:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));left:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));left:unset !important;right:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));left:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));left:unset !important;right:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb,.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb,.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:unset !important;bottom:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}
|
5
5
|
|
6
|
-
.
|
7
|
-
.
|
6
|
+
.Dropdown_styles_1daxhqh_sn7uamp__488e0a19 .Dropdown_styles_1daxhqh_popoverTarget__488e0a19{display:block;}
|
7
|
+
.Dropdown_styles_1daxhqh_sjr7fmv__488e0a19{box-sizing:border-box;background:var(--plasma-dropdown-background);box-shadow:var(--plasma-dropdown-box-shadow);border-radius:var(--plasma-dropdown-border-radius);width:var(--plasma-dropdown-width);height:var(--plasma-dropdown-height);padding:var(--plasma-dropdown-padding-top) var(--plasma-dropdown-padding-right) var(--plasma-dropdown-padding-bottom) var(--plasma-dropdown-padding-left);}
|
8
8
|
|
9
9
|
.DropdownDivider_styles_v3xor1_s1brpi5d__3a791565{background:var(--plasma-dropdown-divider-color);width:var(--plasma-dropdown-divider-width);height:var(--plasma-dropdown-divider-height);margin:var(--plasma-dropdown-divider-margin-top) var(--plasma-dropdown-divider-margin-right) var(--plasma-dropdown-divider-margin-bottom) var(--plasma-dropdown-divider-margin-left);}
|
10
10
|
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
require('react');
|
6
6
|
require('@salutejs/plasma-core');
|
7
|
-
require('../../../../utils/react.js');
|
8
7
|
require('@linaria/react');
|
9
8
|
require('@linaria/core');
|
10
9
|
require('focus-visible');
|
11
10
|
require('react-dom');
|
12
11
|
require('react-popper');
|
12
|
+
require('../../../../utils/react.js');
|
13
13
|
var DropdownFooter = require('../../../Dropdown/ui/DropdownFooter/DropdownFooter.js');
|
14
14
|
var base = require('./variations/_view/base.js');
|
15
15
|
var base$1 = require('./variations/_size/base.js');
|
@@ -3,8 +3,8 @@
|
|
3
3
|
.Popover_styles_rmr9za_s1pd4d8a__0bafa6fb{width:var(--plasma-popover-arrow-mask-width);height:var(--plasma-popover-arrow-mask-height);}.Popover_styles_rmr9za_s1pd4d8a__0bafa6fb::before{position:absolute;width:var(--plasma-popover-arrow-mask-width);height:var(--plasma-popover-arrow-mask-height);-webkit-mask-image:var(--plasma-popover-arrow-mask-image);mask-image:var(--plasma-popover-arrow-mask-image);background:var(--plasma-popover-arrow-background);content:'';-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}
|
4
4
|
.Popover_styles_rmr9za_s16xlixz__0bafa6fb{position:absolute;z-index:var(--s16xlixz-0);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{right:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{left:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));left:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));left:unset !important;right:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));left:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));left:unset !important;right:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb,.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb,.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:unset !important;bottom:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}
|
5
5
|
|
6
|
-
.
|
7
|
-
.
|
6
|
+
.Dropdown_styles_1daxhqh_sn7uamp__488e0a19 .Dropdown_styles_1daxhqh_popoverTarget__488e0a19{display:block;}
|
7
|
+
.Dropdown_styles_1daxhqh_sjr7fmv__488e0a19{box-sizing:border-box;background:var(--plasma-dropdown-background);box-shadow:var(--plasma-dropdown-box-shadow);border-radius:var(--plasma-dropdown-border-radius);width:var(--plasma-dropdown-width);height:var(--plasma-dropdown-height);padding:var(--plasma-dropdown-padding-top) var(--plasma-dropdown-padding-right) var(--plasma-dropdown-padding-bottom) var(--plasma-dropdown-padding-left);}
|
8
8
|
|
9
9
|
.DropdownDivider_styles_v3xor1_s1brpi5d__3a791565{background:var(--plasma-dropdown-divider-color);width:var(--plasma-dropdown-divider-width);height:var(--plasma-dropdown-divider-height);margin:var(--plasma-dropdown-divider-margin-top) var(--plasma-dropdown-divider-margin-right) var(--plasma-dropdown-divider-margin-bottom) var(--plasma-dropdown-divider-margin-left);}
|
10
10
|
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
require('react');
|
6
6
|
require('@salutejs/plasma-core');
|
7
|
-
require('../../../../utils/react.js');
|
8
7
|
require('@linaria/react');
|
9
8
|
require('@linaria/core');
|
10
9
|
require('focus-visible');
|
11
10
|
require('react-dom');
|
12
11
|
require('react-popper');
|
12
|
+
require('../../../../utils/react.js');
|
13
13
|
var DropdownGroup = require('../../../Dropdown/ui/DropdownGroup/DropdownGroup.js');
|
14
14
|
var base = require('./variations/_view/base.js');
|
15
15
|
var base$1 = require('./variations/_size/base.js');
|
@@ -3,8 +3,8 @@
|
|
3
3
|
.Popover_styles_rmr9za_s1pd4d8a__0bafa6fb{width:var(--plasma-popover-arrow-mask-width);height:var(--plasma-popover-arrow-mask-height);}.Popover_styles_rmr9za_s1pd4d8a__0bafa6fb::before{position:absolute;width:var(--plasma-popover-arrow-mask-width);height:var(--plasma-popover-arrow-mask-height);-webkit-mask-image:var(--plasma-popover-arrow-mask-image);mask-image:var(--plasma-popover-arrow-mask-image);background:var(--plasma-popover-arrow-background);content:'';-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}
|
4
4
|
.Popover_styles_rmr9za_s16xlixz__0bafa6fb{position:absolute;z-index:var(--s16xlixz-0);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{right:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{left:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));left:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));left:unset !important;right:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));left:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));left:unset !important;right:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb,.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb,.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:unset !important;bottom:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}
|
5
5
|
|
6
|
-
.
|
7
|
-
.
|
6
|
+
.Dropdown_styles_1daxhqh_sn7uamp__488e0a19 .Dropdown_styles_1daxhqh_popoverTarget__488e0a19{display:block;}
|
7
|
+
.Dropdown_styles_1daxhqh_sjr7fmv__488e0a19{box-sizing:border-box;background:var(--plasma-dropdown-background);box-shadow:var(--plasma-dropdown-box-shadow);border-radius:var(--plasma-dropdown-border-radius);width:var(--plasma-dropdown-width);height:var(--plasma-dropdown-height);padding:var(--plasma-dropdown-padding-top) var(--plasma-dropdown-padding-right) var(--plasma-dropdown-padding-bottom) var(--plasma-dropdown-padding-left);}
|
8
8
|
|
9
9
|
.DropdownDivider_styles_v3xor1_s1brpi5d__3a791565{background:var(--plasma-dropdown-divider-color);width:var(--plasma-dropdown-divider-width);height:var(--plasma-dropdown-divider-height);margin:var(--plasma-dropdown-divider-margin-top) var(--plasma-dropdown-divider-margin-right) var(--plasma-dropdown-divider-margin-bottom) var(--plasma-dropdown-divider-margin-left);}
|
10
10
|
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
require('react');
|
6
6
|
require('@salutejs/plasma-core');
|
7
|
-
require('../../../../utils/react.js');
|
8
7
|
require('@linaria/react');
|
9
8
|
require('@linaria/core');
|
10
9
|
require('focus-visible');
|
11
10
|
require('react-dom');
|
12
11
|
require('react-popper');
|
12
|
+
require('../../../../utils/react.js');
|
13
13
|
var DropdownHeader = require('../../../Dropdown/ui/DropdownHeader/DropdownHeader.js');
|
14
14
|
var base = require('./variations/_view/base.js');
|
15
15
|
var base$1 = require('./variations/_size/base.js');
|
@@ -3,8 +3,8 @@
|
|
3
3
|
.Popover_styles_rmr9za_s1pd4d8a__0bafa6fb{width:var(--plasma-popover-arrow-mask-width);height:var(--plasma-popover-arrow-mask-height);}.Popover_styles_rmr9za_s1pd4d8a__0bafa6fb::before{position:absolute;width:var(--plasma-popover-arrow-mask-width);height:var(--plasma-popover-arrow-mask-height);-webkit-mask-image:var(--plasma-popover-arrow-mask-image);mask-image:var(--plasma-popover-arrow-mask-image);background:var(--plasma-popover-arrow-background);content:'';-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}
|
4
4
|
.Popover_styles_rmr9za_s16xlixz__0bafa6fb{position:absolute;z-index:var(--s16xlixz-0);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{right:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{left:calc(0px - var(--plasma-popover-arrow-height));}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));left:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='top-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{bottom:calc(0px - var(--plasma-popover-arrow-height));left:unset !important;right:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));left:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:calc(0px - var(--plasma-popover-arrow-height));left:unset !important;right:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='bottom-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb,.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right-start'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='left-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb,.Popover_styles_rmr9za_s16xlixz__0bafa6fb[data-popper-placement^='right-end'] > .Popover_styles_rmr9za_popoverArrow__0bafa6fb{top:unset !important;bottom:var(--plasma-popover-arrow-edge-margin) !important;-webkit-transform:unset !important;-ms-transform:unset !important;transform:unset !important;}
|
5
5
|
|
6
|
-
.
|
7
|
-
.
|
6
|
+
.Dropdown_styles_1daxhqh_sn7uamp__488e0a19 .Dropdown_styles_1daxhqh_popoverTarget__488e0a19{display:block;}
|
7
|
+
.Dropdown_styles_1daxhqh_sjr7fmv__488e0a19{box-sizing:border-box;background:var(--plasma-dropdown-background);box-shadow:var(--plasma-dropdown-box-shadow);border-radius:var(--plasma-dropdown-border-radius);width:var(--plasma-dropdown-width);height:var(--plasma-dropdown-height);padding:var(--plasma-dropdown-padding-top) var(--plasma-dropdown-padding-right) var(--plasma-dropdown-padding-bottom) var(--plasma-dropdown-padding-left);}
|
8
8
|
|
9
9
|
.DropdownDivider_styles_v3xor1_s1brpi5d__3a791565{background:var(--plasma-dropdown-divider-color);width:var(--plasma-dropdown-divider-width);height:var(--plasma-dropdown-divider-height);margin:var(--plasma-dropdown-divider-margin-top) var(--plasma-dropdown-divider-margin-right) var(--plasma-dropdown-divider-margin-bottom) var(--plasma-dropdown-divider-margin-left);}
|
10
10
|
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
require('react');
|
6
6
|
require('@salutejs/plasma-core');
|
7
|
-
require('../../../../utils/react.js');
|
8
7
|
require('@linaria/react');
|
9
8
|
require('@linaria/core');
|
10
9
|
require('focus-visible');
|
11
10
|
require('react-dom');
|
12
11
|
require('react-popper');
|
12
|
+
require('../../../../utils/react.js');
|
13
13
|
var DropdownItem = require('../../../Dropdown/ui/DropdownItem/DropdownItem.js');
|
14
14
|
var base = require('./variations/_view/base.js');
|
15
15
|
var base$1 = require('./variations/_size/base.js');
|
@@ -5,12 +5,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
6
6
|
require('react');
|
7
7
|
require('@salutejs/plasma-core');
|
8
|
-
require('../../../../utils/react.js');
|
9
8
|
require('@linaria/react');
|
10
9
|
require('@linaria/core');
|
11
10
|
require('focus-visible');
|
12
11
|
require('react-dom');
|
13
12
|
require('react-popper');
|
13
|
+
require('../../../../utils/react.js');
|
14
14
|
|
15
15
|
var base = "bhy25de";
|
16
16
|
|
@@ -69,8 +69,8 @@ var SelectTarget = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
69
69
|
itemValue = _ref9[0];
|
70
70
|
return itemValue;
|
71
71
|
});
|
72
|
-
chipsRefs === null || chipsRefs === void 0
|
73
|
-
onChange === null || onChange === void 0
|
72
|
+
chipsRefs === null || chipsRefs === void 0 || chipsRefs.current.splice(index, 1);
|
73
|
+
onChange === null || onChange === void 0 || onChange(newValue);
|
74
74
|
}, [values, onChange]);
|
75
75
|
var onChipKeyDown = React.useCallback(function (value, text, index, event) {
|
76
76
|
var code = event.code,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SelectTarget.js","sources":["../../../../../src/components/Select/ui/SelectTarget/SelectTarget.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useRef } from 'react';\n\nimport { classes } from '../../Select.tokens';\nimport { cx } from '../../../../utils';\nimport { SelectChip } from '../SelectChip/SelectChip';\nimport type { SelectPrimitiveValue } from '../../Select.types';\nimport { Keys } from '../../hooks/useKeyNavigation';\n\nimport {\n StyledArrow,\n StyledChips,\n StyledChipsWrapper,\n StyledLabel,\n StyledSelectTarget,\n StyledText,\n} from './SelectTarget.styles';\nimport type { SelectTargetProps } from './SelectTarget.types';\n\nconst {\n hasNoFocus,\n hasChips,\n innerLabelUp,\n arrowInverse,\n selectTarget,\n selectTargetArrow,\n selectTargeText,\n selectTargetLabel,\n} = classes;\n\n/**\n * Элемент для выпадающего списка\n */\nexport const SelectTarget = forwardRef<HTMLButtonElement, SelectTargetProps>(\n (\n {\n values,\n target = 'textField-like',\n label,\n opened,\n readOnly,\n disabled,\n enumerationType,\n size,\n id,\n chipsRefs,\n onChange,\n onKeyDown,\n ...rest\n },\n ref,\n ) => {\n const hasText = Boolean(values?.some(([value]) => value));\n\n const hasLabel = label && size !== 'xs' && target === 'textField-like';\n const textContent = values?.map(([, text]) => text).join(', ');\n const contentRef = useRef<HTMLDivElement>(null);\n\n const withArrowInverse = opened ? arrowInverse : undefined;\n const withInnerLabelUp = hasLabel && hasText ? innerLabelUp : undefined;\n const withHasChips =\n hasText && enumerationType === 'chip' && target === 'textField-like' ? hasChips : undefined;\n\n const withNoFocus = target === 'textField-like' ? hasNoFocus : undefined;\n\n const isLabelVisible = !hasText || (hasLabel && enumerationType === 'comma');\n\n const onChipClick = useCallback((event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n }, []);\n\n const onChipClear = useCallback(\n (value: SelectPrimitiveValue, text: SelectPrimitiveValue, index: number) => {\n const newValue = values\n ?.filter(([itemValue, itemText]) => !(itemValue === value && itemText === text))\n .map(([itemValue]) => itemValue);\n\n chipsRefs?.current.splice(index, 1);\n onChange?.(newValue);\n },\n [values, onChange],\n );\n\n const onChipKeyDown = useCallback(\n (\n value: SelectPrimitiveValue,\n text: SelectPrimitiveValue,\n index: number,\n event: React.KeyboardEvent<HTMLButtonElement>,\n ) => {\n const { code, shiftKey } = event;\n\n if (code === Keys.Tab || (code === Keys.Tab && shiftKey)) {\n event.preventDefault();\n }\n\n if (code === Keys.Backspace) {\n onChipClear(value, text, index);\n }\n },\n [onChipClear],\n );\n\n const onWheel = useCallback((event: React.WheelEvent<HTMLButtonElement>) => {\n const { deltaY } = event;\n\n if (contentRef.current) {\n contentRef.current.scrollLeft += Math.round(deltaY);\n }\n }, []);\n\n const getRef = useCallback((element: HTMLButtonElement | null, index: number) => {\n if (element && chipsRefs && chipsRefs.current) {\n chipsRefs.current[index] = element;\n }\n }, []);\n\n // INFO: Нужно очищать на каждый ререндер компонента для актуализации состояния рефов\n if (chipsRefs) {\n chipsRefs.current = [];\n }\n\n return (\n <StyledSelectTarget\n {...rest}\n ref={ref}\n opened={opened}\n target={target}\n readOnly={readOnly}\n disabled={disabled}\n title={textContent}\n aria-label={label}\n className={cx(withInnerLabelUp, withHasChips, withNoFocus, selectTarget)}\n onWheel={onWheel}\n onKeyDown={onKeyDown}\n stretching=\"filled\"\n >\n {hasText &&\n (enumerationType === 'comma' || target === 'button-like' ? (\n <StyledText className={selectTargeText}>{textContent}</StyledText>\n ) : (\n <StyledChipsWrapper ref={contentRef}>\n <StyledChips>\n {values?.map(([value, text], index) => (\n <SelectChip\n index={index}\n ref={(element) => getRef(element, index)}\n key={`${value}_${text}`}\n disabled={disabled}\n readOnly={readOnly}\n value={value}\n text={text}\n onClear={(v, t) => onChipClear(v, t, index)}\n onClick={onChipClick}\n onKeyDown={onChipKeyDown}\n />\n ))}\n </StyledChips>\n </StyledChipsWrapper>\n ))}\n {isLabelVisible && (\n <StyledLabel className={selectTargetLabel} htmlFor={id}>\n {label}\n </StyledLabel>\n )}\n <StyledArrow size=\"s\" color=\"inherit\" className={cx(selectTargetArrow, withArrowInverse)} />\n </StyledSelectTarget>\n );\n },\n);\n"],"names":["hasNoFocus","classes","hasChips","innerLabelUp","arrowInverse","selectTarget","selectTargetArrow","selectTargeText","selectTargetLabel","SelectTarget","forwardRef","_ref","ref","values","_ref$target","target","label","opened","readOnly","disabled","enumerationType","size","id","chipsRefs","onChange","onKeyDown","rest","_objectWithoutProperties","_excluded","hasText","Boolean","some","_ref2","_ref3","_slicedToArray","value","hasLabel","textContent","map","_ref4","_ref5","text","join","contentRef","useRef","withArrowInverse","undefined","withInnerLabelUp","withHasChips","withNoFocus","isLabelVisible","onChipClick","useCallback","event","stopPropagation","onChipClear","index","newValue","filter","_ref6","_ref7","itemValue","itemText","_ref8","_ref9","current","splice","onChipKeyDown","code","shiftKey","Keys","Tab","preventDefault","Backspace","onWheel","deltaY","scrollLeft","Math","round","getRef","element","React","createElement","StyledSelectTarget","_extends","title","className","cx","stretching","StyledText","StyledChipsWrapper","StyledChips","_ref10","_ref11","SelectChip","key","concat","onClear","v","t","onClick","StyledLabel","htmlFor","StyledArrow","color"],"mappings":";;;;;;;;;;;;;AAkBA,IACIA,UAAU,GAQVC,qBAAO,CARPD,UAAU;EACVE,QAAQ,GAORD,qBAAO,CAPPC,QAAQ;EACRC,YAAY,GAMZF,qBAAO,CANPE,YAAY;EACZC,YAAY,GAKZH,qBAAO,CALPG,YAAY;EACZC,YAAY,GAIZJ,qBAAO,CAJPI,YAAY;EACZC,iBAAiB,GAGjBL,qBAAO,CAHPK,iBAAiB;EACjBC,eAAe,GAEfN,qBAAO,CAFPM,eAAe;EACfC,iBAAiB,GACjBP,qBAAO,CADPO,iBAAiB,CAAA;;AAGrB;AACA;AACA;AACO,IA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AACC,CAAAA,CAAC,EAAEC,CAAC,EAAA;AAAA,QAAA,OAAK5C,WAAW,CAAC2C,CAAC,EAAEC,CAAC,EAAE3C,KAAK,CAAC,CAAA;OAAC;AAC5C4C,MAAAA,OAAO,EAAEjD,WAAY;AACrB1B,MAAAA,SAAS,EAAE0C,aAAAA;AAAc,KAC5B,CAAC,CAAA;GACL,CACQ,CACG,CACvB,CAAC,EACLjB,cAAc,iBACX+B,KAAA,CAAAC,aAAA,CAACmB,+BAAW,EAAA;AAACf,IAAAA,SAAS,EAAE9E,iBAAkB;AAAC8F,IAAAA,OAAO,EAAEhF,EAAAA;AAAG,GAAA,EAClDN,KACQ,CAChB,eACDiE,KAAA,CAAAC,aAAA,CAACqB,+BAAW,EAAA;AAAClF,IAAAA,IAAI,EAAC,GAAG;AAACmF,IAAAA,KAAK,EAAC,SAAS;AAAClB,IAAAA,SAAS,EAAEC,QAAE,CAACjF,iBAAiB,EAAEuC,gBAAgB,CAAA;AAAE,GAAE,CAC3E,CAAC,CAAA;AAE7B,CACJ;;;;"}
|
1
|
+
{"version":3,"file":"SelectTarget.js","sources":["../../../../../src/components/Select/ui/SelectTarget/SelectTarget.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useRef } from 'react';\n\nimport { classes } from '../../Select.tokens';\nimport { cx } from '../../../../utils';\nimport { SelectChip } from '../SelectChip/SelectChip';\nimport type { SelectPrimitiveValue } from '../../Select.types';\nimport { Keys } from '../../hooks/useKeyNavigation';\n\nimport {\n StyledArrow,\n StyledChips,\n StyledChipsWrapper,\n StyledLabel,\n StyledSelectTarget,\n StyledText,\n} from './SelectTarget.styles';\nimport type { SelectTargetProps } from './SelectTarget.types';\n\nconst {\n hasNoFocus,\n hasChips,\n innerLabelUp,\n arrowInverse,\n selectTarget,\n selectTargetArrow,\n selectTargeText,\n selectTargetLabel,\n} = classes;\n\n/**\n * Элемент для выпадающего списка\n */\nexport const SelectTarget = forwardRef<HTMLButtonElement, SelectTargetProps>(\n (\n {\n values,\n target = 'textField-like',\n label,\n opened,\n readOnly,\n disabled,\n enumerationType,\n size,\n id,\n chipsRefs,\n onChange,\n onKeyDown,\n ...rest\n },\n ref,\n ) => {\n const hasText = Boolean(values?.some(([value]) => value));\n\n const hasLabel = label && size !== 'xs' && target === 'textField-like';\n const textContent = values?.map(([, text]) => text).join(', ');\n const contentRef = useRef<HTMLDivElement>(null);\n\n const withArrowInverse = opened ? arrowInverse : undefined;\n const withInnerLabelUp = hasLabel && hasText ? innerLabelUp : undefined;\n const withHasChips =\n hasText && enumerationType === 'chip' && target === 'textField-like' ? hasChips : undefined;\n\n const withNoFocus = target === 'textField-like' ? hasNoFocus : undefined;\n\n const isLabelVisible = !hasText || (hasLabel && enumerationType === 'comma');\n\n const onChipClick = useCallback((event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n }, []);\n\n const onChipClear = useCallback(\n (value: SelectPrimitiveValue, text: SelectPrimitiveValue, index: number) => {\n const newValue = values\n ?.filter(([itemValue, itemText]) => !(itemValue === value && itemText === text))\n .map(([itemValue]) => itemValue);\n\n chipsRefs?.current.splice(index, 1);\n onChange?.(newValue);\n },\n [values, onChange],\n );\n\n const onChipKeyDown = useCallback(\n (\n value: SelectPrimitiveValue,\n text: SelectPrimitiveValue,\n index: number,\n event: React.KeyboardEvent<HTMLButtonElement>,\n ) => {\n const { code, shiftKey } = event;\n\n if (code === Keys.Tab || (code === Keys.Tab && shiftKey)) {\n event.preventDefault();\n }\n\n if (code === Keys.Backspace) {\n onChipClear(value, text, index);\n }\n },\n [onChipClear],\n );\n\n const onWheel = useCallback((event: React.WheelEvent<HTMLButtonElement>) => {\n const { deltaY } = event;\n\n if (contentRef.current) {\n contentRef.current.scrollLeft += Math.round(deltaY);\n }\n }, []);\n\n const getRef = useCallback((element: HTMLButtonElement | null, index: number) => {\n if (element && chipsRefs && chipsRefs.current) {\n chipsRefs.current[index] = element;\n }\n }, []);\n\n // INFO: Нужно очищать на каждый ререндер компонента для актуализации состояния рефов\n if (chipsRefs) {\n chipsRefs.current = [];\n }\n\n return (\n <StyledSelectTarget\n {...rest}\n ref={ref}\n opened={opened}\n target={target}\n readOnly={readOnly}\n disabled={disabled}\n title={textContent}\n aria-label={label}\n className={cx(withInnerLabelUp, withHasChips, withNoFocus, selectTarget)}\n onWheel={onWheel}\n onKeyDown={onKeyDown}\n stretching=\"filled\"\n >\n {hasText &&\n (enumerationType === 'comma' || target === 'button-like' ? (\n <StyledText className={selectTargeText}>{textContent}</StyledText>\n ) : (\n <StyledChipsWrapper ref={contentRef}>\n <StyledChips>\n {values?.map(([value, text], index) => (\n <SelectChip\n index={index}\n ref={(element) => getRef(element, index)}\n key={`${value}_${text}`}\n disabled={disabled}\n readOnly={readOnly}\n value={value}\n text={text}\n onClear={(v, t) => onChipClear(v, t, index)}\n onClick={onChipClick}\n onKeyDown={onChipKeyDown}\n />\n ))}\n </StyledChips>\n </StyledChipsWrapper>\n ))}\n {isLabelVisible && (\n <StyledLabel className={selectTargetLabel} htmlFor={id}>\n {label}\n </StyledLabel>\n )}\n <StyledArrow size=\"s\" color=\"inherit\" className={cx(selectTargetArrow, withArrowInverse)} />\n </StyledSelectTarget>\n );\n },\n);\n"],"names":["hasNoFocus","classes","hasChips","innerLabelUp","arrowInverse","selectTarget","selectTargetArrow","selectTargeText","selectTargetLabel","SelectTarget","forwardRef","_ref","ref","values","_ref$target","target","label","opened","readOnly","disabled","enumerationType","size","id","chipsRefs","onChange","onKeyDown","rest","_objectWithoutProperties","_excluded","hasText","Boolean","some","_ref2","_ref3","_slicedToArray","value","hasLabel","textContent","map","_ref4","_ref5","text","join","contentRef","useRef","withArrowInverse","undefined","withInnerLabelUp","withHasChips","withNoFocus","isLabelVisible","onChipClick","useCallback","event","stopPropagation","onChipClear","index","newValue","filter","_ref6","_ref7","itemValue","itemText","_ref8","_ref9","current","splice","onChipKeyDown","code","shiftKey","Keys","Tab","preventDefault","Backspace","onWheel","deltaY","scrollLeft","Math","round","getRef","element","React","createElement","StyledSelectTarget","_extends","title","className","cx","stretching","StyledText","StyledChipsWrapper","StyledChips","_ref10","_ref11","SelectChip","key","concat","onClear","v","t","onClick","StyledLabel","htmlFor","StyledArrow","color"],"mappings":";;;;;;;;;;;;;AAkBA,IACIA,UAAU,GAQVC,qBAAO,CARPD,UAAU;EACVE,QAAQ,GAORD,qBAAO,CAPPC,QAAQ;EACRC,YAAY,GAMZF,qBAAO,CANPE,YAAY;EACZC,YAAY,GAKZH,qBAAO,CALPG,YAAY;EACZC,YAAY,GAIZJ,qBAAO,CAJPI,YAAY;EACZC,iBAAiB,GAGjBL,qBAAO,CAHPK,iBAAiB;EACjBC,eAAe,GAEfN,qBAAO,CAFPM,eAAe;EACfC,iBAAiB,GACjBP,qBAAO,CADPO,iBAAiB,CAAA;;AAGrB;AACA;AACA;AACO,IAAMC,YAAY,gBAAGC,gBAAU,CAClC,UAAAC,IAAA,EAgBIC,GAAG,EACF;AAAA,EAAA,IAfGC,MAAM,GAAAF,IAAA,CAANE,MAAM;IAAAC,WAAA,GAAAH,IAAA,CACNI,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,gBAAgB,GAAAA,WAAA;IACzBE,KAAK,GAAAL,IAAA,CAALK,KAAK;IACLC,MAAM,GAAAN,IAAA,CAANM,MAAM;IACNC,QAAQ,GAAAP,IAAA,CAARO,QAAQ;IACRC,QAAQ,GAAAR,IAAA,CAARQ,QAAQ;IACRC,eAAe,GAAAT,IAAA,CAAfS,eAAe;IACfC,IAAI,GAAAV,IAAA,CAAJU,IAAI;IACJC,EAAE,GAAAX,IAAA,CAAFW,EAAE;IACFC,SAAS,GAAAZ,IAAA,CAATY,SAAS;IACTC,QAAQ,GAAAb,IAAA,CAARa,QAAQ;IACRC,SAAS,GAAAd,IAAA,CAATc,SAAS;AACNC,IAAAA,IAAI,GAAAC,iDAAA,CAAAhB,IAAA,EAAAiB,SAAA,CAAA,CAAA;AAIX,EAAA,IAAMC,OAAO,GAA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AA,oBACtBZ,KAAA,CAAAC,aAAA,CAACY,qBAAU,EAAA;AACPtC,MAAAA,KAAK,EAAEA,KAAM;MACb5C,GAAG,EAAE,SAAAA,GAAAA,CAACoE,OAAO,EAAA;AAAA,QAAA,OAAKD,MAAM,CAACC,OAAO,EAAExB,KAAK,CAAC,CAAA;OAAC;MACzCuC,GAAG,EAAA,EAAA,CAAAC,MAAA,CAAK7D,KAAK,OAAA6D,MAAA,CAAIvD,IAAI,CAAG;AACxBtB,MAAAA,QAAQ,EAAEA,QAAS;AACnBD,MAAAA,QAAQ,EAAEA,QAAS;AACnBiB,MAAAA,KAAK,EAAEA,KAAM;AACbM,MAAAA,IAAI,EAAEA,IAAK;AACXwD,MAAAA,OAAO,EAAE,SAAAA,OAACC,CAAAA,CAAC,EAAEC,CAAC,EAAA;AAAA,QAAA,OAAK5C,WAAW,CAAC2C,CAAC,EAAEC,CAAC,EAAE3C,KAAK,CAAC,CAAA;OAAC;AAC5C4C,MAAAA,OAAO,EAAEjD,WAAY;AACrB1B,MAAAA,SAAS,EAAE0C,aAAAA;AAAc,KAC5B,CAAC,CAAA;GACL,CACQ,CACG,CACvB,CAAC,EACLjB,cAAc,iBACX+B,KAAA,CAAAC,aAAA,CAACmB,+BAAW,EAAA;AAACf,IAAAA,SAAS,EAAE9E,iBAAkB;AAAC8F,IAAAA,OAAO,EAAEhF,EAAAA;AAAG,GAAA,EAClDN,KACQ,CAChB,eACDiE,KAAA,CAAAC,aAAA,CAACqB,+BAAW,EAAA;AAAClF,IAAAA,IAAI,EAAC,GAAG;AAACmF,IAAAA,KAAK,EAAC,SAAS;AAAClB,IAAAA,SAAS,EAAEC,QAAE,CAACjF,iBAAiB,EAAEuC,gBAAgB,CAAA;AAAE,GAAE,CAC3E,CAAC,CAAA;AAE7B,CACJ;;;;"}
|
@@ -80,8 +80,8 @@ var updatePropsRecursively = function updatePropsRecursively(children, externalP
|
|
80
80
|
},
|
81
81
|
onClick: function onClick(event) {
|
82
82
|
var _child$props$onClick, _child$props, _externalProps$onClic;
|
83
|
-
(_child$props$onClick = (_child$props = child.props).onClick) === null || _child$props$onClick === void 0
|
84
|
-
externalProps === null || externalProps === void 0
|
83
|
+
(_child$props$onClick = (_child$props = child.props).onClick) === null || _child$props$onClick === void 0 || _child$props$onClick.call(_child$props, event);
|
84
|
+
externalProps === null || externalProps === void 0 || (_externalProps$onClic = externalProps.onClick) === null || _externalProps$onClic === void 0 || _externalProps$onClic.call(externalProps, event);
|
85
85
|
}
|
86
86
|
});
|
87
87
|
var updatedChild = updatePropsRecursively(child.props.children, externalProps, value, search, filterFunction);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Select/utils/index.ts"],"sourcesContent":["import { Children, MouseEvent, ReactElement, ReactNode, cloneElement, isValidElement } from 'react';\n\nimport { SelectPrimitiveValue, ValueType, SelectValue } from '../Select.types';\nimport { SelectItemProps } from '../ui/SelectItem/SelectItem.type';\n\ntype NewSelectedFunc = {\n (selected?: undefined | null, newValue?: undefined | null, type?: undefined | null): undefined;\n (selected?: SelectPrimitiveValue, newValue?: SelectPrimitiveValue, type?: ValueType): SelectPrimitiveValue;\n (selected?: Array<SelectPrimitiveValue>, newValue?: SelectPrimitiveValue, type?: ValueType): Array<\n SelectPrimitiveValue\n >;\n};\n\nexport const getNewSelected: NewSelectedFunc = (selected: any, newValue: any, type: any) => {\n if (newValue === undefined || newValue === null) {\n return newValue;\n }\n\n if (\n (type === 'single' || type === 'native') &&\n (typeof newValue === 'string' || typeof newValue === 'number' || typeof newValue === 'boolean')\n ) {\n return newValue;\n }\n\n const newSelected = selected || [];\n\n const set = new Set(newSelected);\n\n if (set.has(newValue)) {\n set.delete(newValue);\n } else {\n set.add(newValue);\n }\n\n return Array.from(set);\n};\n\nconst getChildrenInnerText = (children: ReactElement): string => {\n if (!children || typeof children === 'string') {\n return children;\n }\n\n return getChildrenInnerText(children.props.children);\n};\n\nexport const getValues = (items: ReactElement[], value?: SelectValue, result: Array<Array<string>> = []) => {\n items.forEach((item) => {\n if (item.props === undefined) {\n return result;\n }\n\n const { value: newValue } = item.props;\n\n if (item.props.children && Array.isArray(item.props.children)) {\n return getValues(item.props.children, value, result);\n }\n\n if (\n (!Array.isArray(value) && newValue === value) ||\n (Array.isArray(value) && value?.find((v) => newValue === v))\n ) {\n const index = (Array.isArray(value) && value?.findIndex((v) => newValue === v)) || 0;\n\n if (item.props.text) {\n const { text: newText } = item.props;\n result[index] = [newValue, newText];\n\n return;\n }\n\n const newText = getChildrenInnerText(item.props.children);\n result[index] = [newValue, newText];\n }\n\n return result;\n });\n\n return result;\n};\n\nconst getChildrenItemChecked = (value?: SelectValue, child?: ReactElement<SelectItemProps>) =>\n (!Array.isArray(value) && child?.props.value === value) ||\n (Array.isArray(value) && Boolean(value?.find((v) => child?.props.value === v)));\n\n// INFO: Функция для рекурсивного обновления пропсов\nexport const updatePropsRecursively = (\n children?: ReactElement<SelectItemProps>[],\n externalProps?: Record<string, any>,\n value?: SelectValue,\n search?: string,\n filterFunction?: (childText: string, filterValue?: string) => boolean,\n): ReactNode[] =>\n Children.map(children || [], (child) => {\n if (!isValidElement(child)) {\n return child;\n }\n\n const hasValue = 'value' in child?.props;\n\n const props = {\n key: `${value}$`,\n checked: getChildrenItemChecked(value, child),\n ...(hasValue && {\n ref: (element: HTMLDivElement) => {\n if (externalProps?.childrenRefs?.current && element) {\n externalProps.childrenRefs.current.push(element);\n }\n },\n onClick: (event: MouseEvent<HTMLDivElement>) => {\n child.props.onClick?.(event);\n externalProps?.onClick?.(event);\n },\n }),\n };\n\n const updatedChild = updatePropsRecursively(\n child.props.children as ReactElement<SelectItemProps>[],\n externalProps,\n value,\n search,\n filterFunction,\n );\n\n if (filterFunction) {\n const text = child.props?.text || '';\n\n return filterFunction(text, search) ? cloneElement(child, props, updatedChild) : null;\n }\n\n return cloneElement(child, props, updatedChild);\n });\n\nconst defaultFilterFunction = (text: string, filterValue = '') => text.includes(filterValue);\n\nexport const getChildren = (\n children: ReactElement<SelectItemProps>[],\n externalProps: Record<string, any>,\n value?: SelectValue,\n search?: string,\n filterFunction = defaultFilterFunction,\n) => {\n if (externalProps.childrenRefs) {\n externalProps.childrenRefs.current = [];\n }\n\n return updatePropsRecursively(children, externalProps, value, search, filterFunction);\n};\n"],"names":["getNewSelected","selected","newValue","type","undefined","newSelected","set","Set","has","add","Array","from","getChildrenInnerText","children","props","getValues","items","value","result","arguments","length","forEach","item","isArray","find","v","index","findIndex","text","newText","getChildrenItemChecked","child","Boolean","updatePropsRecursively","externalProps","search","filterFunction","Children","map","isValidElement","hasValue","_objectSpread","key","concat","checked","ref","element","_externalProps$childr","childrenRefs","current","push","onClick","event","_child$props$onClick","_child$props","_externalProps$onClic","call","updatedChild","_child$props2","cloneElement","defaultFilterFunction","filterValue","includes","getChildren"],"mappings":";;;;;;;AAaO,IAAMA,cAA+B,GAAG,SAAlCA,cAA+BA,CAAIC,QAAa,EAAEC,QAAa,EAAEC,IAAS,EAAK;AACxF,EAAA,IAAID,QAAQ,KAAKE,SAAS,IAAIF,QAAQ,KAAK,IAAI,EAAE;AAC7C,IAAA,OAAOA,QAAQ,CAAA;AACnB,GAAA;EAEA,IACI,CAACC,IAAI,KAAK,QAAQ,IAAIA,IAAI,KAAK,QAAQ,MACtC,OAAOD,QAAQ,KAAK,QAAQ,IAAI,OAAOA,QAAQ,KAAK,QAAQ,IAAI,OAAOA,QAAQ,KAAK,SAAS,CAAC,EACjG;AACE,IAAA,OAAOA,QAAQ,CAAA;AACnB,GAAA;AAEA,EAAA,IAAMG,WAAW,GAAGJ,QAAQ,IAAI,EAAE,CAAA;AAElC,EAAA,IAAMK,GAAG,GAAG,IAAIC,GAAG,CAACF,WAAW,CAAC,CAAA;AAEhC,EAAA,IAAIC,GAAG,CAACE,GAAG,CAACN,QAAQ,CAAC,EAAE;IACnBI,GAAG,CAAA,QAAA,CAAO,CAACJ,QAAQ,CAAC,CAAA;AACxB,GAAC,MAAM;AACHI,IAAAA,G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9B,IAAI,KAAI,EAAE,CAAA;AAEpC,MAAA,OAAOQ,cAAc,CAACR,IAAI,EAAEO,MAAM,CAAC,gBAAGwB,kBAAY,CAAC5B,KAAK,EAAEjB,KAAK,EAAE2C,YAAY,CAAC,GAAG,IAAI,CAAA;AACzF,KAAA;AAEA,IAAA,oBAAOE,kBAAY,CAAC5B,KAAK,EAAEjB,KAAK,EAAE2C,YAAY,CAAC,CAAA;AACnD,GAAC,CAAC,CAAA;AAAA,EAAA;AAEN,IAAMG,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIhC,IAAY,EAAA;AAAA,EAAA,IAAEiC,WAAW,GAAA1C,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAf,SAAA,GAAAe,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE,CAAA;AAAA,EAAA,OAAKS,IAAI,CAACkC,QAAQ,CAACD,WAAW,CAAC,CAAA;AAAA,CAAA,CAAA;AAE/EE,IAAAA,WAAW,GAAG,SAAdA,WAAWA,CACpBlD,QAAyC,EACzCqB,aAAkC,EAClCjB,KAAmB,EACnBkB,MAAe,EAEd;AAAA,EAAA,IADDC,cAAc,GAAAjB,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAf,SAAA,GAAAe,SAAA,CAAA,CAAA,CAAA,GAAGyC,qBAAqB,CAAA;EAEtC,IAAI1B,aAAa,CAACc,YAAY,EAAE;AAC5Bd,IAAAA,aAAa,CAACc,YAAY,CAACC,OAAO,GAAG,EAAE,CAAA;AAC3C,GAAA;EAEA,OAAOhB,sBAAsB,CAACpB,QAAQ,EAAEqB,aAAa,EAAEjB,KAAK,EAAEkB,MAAM,EAAEC,cAAc,CAAC,CAAA;AACzF;;;;;;;"}
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Select/utils/index.ts"],"sourcesContent":["import { Children, MouseEvent, ReactElement, ReactNode, cloneElement, isValidElement } from 'react';\n\nimport { SelectPrimitiveValue, ValueType, SelectValue } from '../Select.types';\nimport { SelectItemProps } from '../ui/SelectItem/SelectItem.type';\n\ntype NewSelectedFunc = {\n (selected?: undefined | null, newValue?: undefined | null, type?: undefined | null): undefined;\n (selected?: SelectPrimitiveValue, newValue?: SelectPrimitiveValue, type?: ValueType): SelectPrimitiveValue;\n (selected?: Array<SelectPrimitiveValue>, newValue?: SelectPrimitiveValue, type?: ValueType): Array<\n SelectPrimitiveValue\n >;\n};\n\nexport const getNewSelected: NewSelectedFunc = (selected: any, newValue: any, type: any) => {\n if (newValue === undefined || newValue === null) {\n return newValue;\n }\n\n if (\n (type === 'single' || type === 'native') &&\n (typeof newValue === 'string' || typeof newValue === 'number' || typeof newValue === 'boolean')\n ) {\n return newValue;\n }\n\n const newSelected = selected || [];\n\n const set = new Set(newSelected);\n\n if (set.has(newValue)) {\n set.delete(newValue);\n } else {\n set.add(newValue);\n }\n\n return Array.from(set);\n};\n\nconst getChildrenInnerText = (children: ReactElement): string => {\n if (!children || typeof children === 'string') {\n return children;\n }\n\n return getChildrenInnerText(children.props.children);\n};\n\nexport const getValues = (items: ReactElement[], value?: SelectValue, result: Array<Array<string>> = []) => {\n items.forEach((item) => {\n if (item.props === undefined) {\n return result;\n }\n\n const { value: newValue } = item.props;\n\n if (item.props.children && Array.isArray(item.props.children)) {\n return getValues(item.props.children, value, result);\n }\n\n if (\n (!Array.isArray(value) && newValue === value) ||\n (Array.isArray(value) && value?.find((v) => newValue === v))\n ) {\n const index = (Array.isArray(value) && value?.findIndex((v) => newValue === v)) || 0;\n\n if (item.props.text) {\n const { text: newText } = item.props;\n result[index] = [newValue, newText];\n\n return;\n }\n\n const newText = getChildrenInnerText(item.props.children);\n result[index] = [newValue, newText];\n }\n\n return result;\n });\n\n return result;\n};\n\nconst getChildrenItemChecked = (value?: SelectValue, child?: ReactElement<SelectItemProps>) =>\n (!Array.isArray(value) && child?.props.value === value) ||\n (Array.isArray(value) && Boolean(value?.find((v) => child?.props.value === v)));\n\n// INFO: Функция для рекурсивного обновления пропсов\nexport const updatePropsRecursively = (\n children?: ReactElement<SelectItemProps>[],\n externalProps?: Record<string, any>,\n value?: SelectValue,\n search?: string,\n filterFunction?: (childText: string, filterValue?: string) => boolean,\n): ReactNode[] =>\n Children.map(children || [], (child) => {\n if (!isValidElement(child)) {\n return child;\n }\n\n const hasValue = 'value' in child?.props;\n\n const props = {\n key: `${value}$`,\n checked: getChildrenItemChecked(value, child),\n ...(hasValue && {\n ref: (element: HTMLDivElement) => {\n if (externalProps?.childrenRefs?.current && element) {\n externalProps.childrenRefs.current.push(element);\n }\n },\n onClick: (event: MouseEvent<HTMLDivElement>) => {\n child.props.onClick?.(event);\n externalProps?.onClick?.(event);\n },\n }),\n };\n\n const updatedChild = updatePropsRecursively(\n child.props.children as ReactElement<SelectItemProps>[],\n externalProps,\n value,\n search,\n filterFunction,\n );\n\n if (filterFunction) {\n const text = child.props?.text || '';\n\n return filterFunction(text, search) ? cloneElement(child, props, updatedChild) : null;\n }\n\n return cloneElement(child, props, updatedChild);\n });\n\nconst defaultFilterFunction = (text: string, filterValue = '') => text.includes(filterValue);\n\nexport const getChildren = (\n children: ReactElement<SelectItemProps>[],\n externalProps: Record<string, any>,\n value?: SelectValue,\n search?: string,\n filterFunction = defaultFilterFunction,\n) => {\n if (externalProps.childrenRefs) {\n externalProps.childrenRefs.current = [];\n }\n\n return updatePropsRecursively(children, externalProps, value, search, filterFunction);\n};\n"],"names":["getNewSelected","selected","newValue","type","undefined","newSelected","set","Set","has","add","Array","from","getChildrenInnerText","children","props","getValues","items","value","result","arguments","length","forEach","item","isArray","find","v","index","findIndex","text","newText","getChildrenItemChecked","child","Boolean","updatePropsRecursively","externalProps","search","filterFunction","Children","map","isValidElement","hasValue","_objectSpread","key","concat","checked","ref","element","_externalProps$childr","childrenRefs","current","push","onClick","event","_child$props$onClick","_child$props","_externalProps$onClic","call","updatedChild","_child$props2","cloneElement","defaultFilterFunction","filterValue","includes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C,QAAQ,CAACD,WAAW,CAAC,CAAA;AAAA,CAAA,CAAA;AAE/EE,IAAAA,WAAW,GAAG,SAAdA,WAAWA,CACpBlD,QAAyC,EACzCqB,aAAkC,EAClCjB,KAAmB,EACnBkB,MAAe,EAEd;AAAA,EAAA,IADDC,cAAc,GAAAjB,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAf,SAAA,GAAAe,SAAA,CAAA,CAAA,CAAA,GAAGyC,qBAAqB,CAAA;EAEtC,IAAI1B,aAAa,CAACc,YAAY,EAAE;AAC5Bd,IAAAA,aAAa,CAACc,YAAY,CAACC,OAAO,GAAG,EAAE,CAAA;AAC3C,GAAA;EAEA,OAAOhB,sBAAsB,CAACpB,QAAQ,EAAEqB,aAAa,EAAEjB,KAAK,EAAEkB,MAAM,EAAEC,cAAc,CAAC,CAAA;AACzF;;;;;;;"}
|
@@ -12,7 +12,7 @@ var TabItemRefs = /*#__PURE__*/function () {
|
|
12
12
|
_rollupPluginBabelHelpers.defineProperty(this, "current", 0);
|
13
13
|
this.current = value || 0;
|
14
14
|
}
|
15
|
-
_rollupPluginBabelHelpers.createClass(TabItemRefs, [{
|
15
|
+
return _rollupPluginBabelHelpers.createClass(TabItemRefs, [{
|
16
16
|
key: "register",
|
17
17
|
value: function register(ref) {
|
18
18
|
this.items.push(ref);
|
@@ -29,7 +29,6 @@ var TabItemRefs = /*#__PURE__*/function () {
|
|
29
29
|
this.current = value;
|
30
30
|
}
|
31
31
|
}]);
|
32
|
-
return TabItemRefs;
|
33
32
|
}();
|
34
33
|
var TabsContext = /*#__PURE__*/React.createContext(null);
|
35
34
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TabsContext.js","sources":["../../../src/components/Tabs/TabsContext.tsx"],"sourcesContent":["import { MutableRefObject, createContext } from 'react';\n\nexport class TabItemRefs {\n public items: MutableRefObject<HTMLElement | null>[] = [];\n\n public current = 0;\n\n constructor(value?: number) {\n this.current = value || 0;\n }\n\n public register(ref: MutableRefObject<HTMLElement | null>): number {\n this.items.push(ref);\n return this.items.length - 1;\n }\n\n public unregister(ref: MutableRefObject<HTMLElement | null>) {\n this.items.splice(this.items.indexOf(ref), 1);\n }\n\n public setCurrent(value: number) {\n this.current = value;\n }\n}\n\nexport const TabsContext = createContext<TabItemRefs | null>(null);\n"],"names":["TabItemRefs","value","_classCallCheck","_defineProperty","current","_createClass","key","register","ref","items","push","length","unregister","splice","indexOf","setCurrent","TabsContext","createContext"],"mappings":";;;;;;;AAEA,IAAaA,WAAW,gBAAA,YAAA;EAKpB,SAAAA,WAAAA,CAAYC,KAAc,EAAE;AAAAC,IAAAA,wCAAA,OAAAF,WAAA,CAAA,CAAA;AAAAG,IAAAA,wCAAA,gBAJ2B,EAAE,CAAA,CAAA;AAAAA,IAAAA,wCAAA,kBAExC,CAAC,CAAA,CAAA;AAGd,IAAA,IAAI,CAACC,OAAO,GAAGH,KAAK,IAAI,CAAC,CAAA;AAC7B,GAAA;
|
1
|
+
{"version":3,"file":"TabsContext.js","sources":["../../../src/components/Tabs/TabsContext.tsx"],"sourcesContent":["import { MutableRefObject, createContext } from 'react';\n\nexport class TabItemRefs {\n public items: MutableRefObject<HTMLElement | null>[] = [];\n\n public current = 0;\n\n constructor(value?: number) {\n this.current = value || 0;\n }\n\n public register(ref: MutableRefObject<HTMLElement | null>): number {\n this.items.push(ref);\n return this.items.length - 1;\n }\n\n public unregister(ref: MutableRefObject<HTMLElement | null>) {\n this.items.splice(this.items.indexOf(ref), 1);\n }\n\n public setCurrent(value: number) {\n this.current = value;\n }\n}\n\nexport const TabsContext = createContext<TabItemRefs | null>(null);\n"],"names":["TabItemRefs","value","_classCallCheck","_defineProperty","current","_createClass","key","register","ref","items","push","length","unregister","splice","indexOf","setCurrent","TabsContext","createContext"],"mappings":";;;;;;;AAEA,IAAaA,WAAW,gBAAA,YAAA;EAKpB,SAAAA,WAAAA,CAAYC,KAAc,EAAE;AAAAC,IAAAA,wCAAA,OAAAF,WAAA,CAAA,CAAA;AAAAG,IAAAA,wCAAA,gBAJ2B,EAAE,CAAA,CAAA;AAAAA,IAAAA,wCAAA,kBAExC,CAAC,CAAA,CAAA;AAGd,IAAA,IAAI,CAACC,OAAO,GAAGH,KAAK,IAAI,CAAC,CAAA;AAC7B,GAAA;EAAC,OAAAI,qCAAA,CAAAL,WAAA,EAAA,CAAA;IAAAM,GAAA,EAAA,UAAA;AAAAL,IAAAA,KAAA,EAED,SAAAM,QAAgBC,CAAAA,GAAyC,EAAU;AAC/D,MAAA,IAAI,CAACC,KAAK,CAACC,IAAI,CAACF,GAAG,CAAC,CAAA;AACpB,MAAA,OAAO,IAAI,CAACC,KAAK,CAACE,MAAM,GAAG,CAAC,CAAA;AAChC,KAAA;AAAC,GAAA,EAAA;IAAAL,GAAA,EAAA,YAAA;AAAAL,IAAAA,KAAA,EAED,SAAAW,UAAkBJ,CAAAA,GAAyC,EAAE;AACzD,MAAA,IAAI,CAACC,KAAK,CAACI,MAAM,CAAC,IAAI,CAACJ,KAAK,CAACK,OAAO,CAACN,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;AACjD,KAAA;AAAC,GAAA,EAAA;IAAAF,GAAA,EAAA,YAAA;AAAAL,IAAAA,KAAA,EAED,SAAAc,UAAkBd,CAAAA,KAAa,EAAE;MAC7B,IAAI,CAACG,OAAO,GAAGH,KAAK,CAAA;AACxB,KAAA;AAAC,GAAA,CAAA,CAAA,CAAA;AAAA,CAAA,GAAA;IAGQe,WAAW,gBAAGC,mBAAa,CAAqB,IAAI;;;;;"}
|
@@ -71,7 +71,7 @@ var tabItemRoot = function tabItemRoot(Root) {
|
|
71
71
|
if (focusIndex === refs.current) {
|
72
72
|
return;
|
73
73
|
}
|
74
|
-
onIndexChange === null || onIndexChange === void 0
|
74
|
+
onIndexChange === null || onIndexChange === void 0 || onIndexChange(focusIndex);
|
75
75
|
refs.setCurrent(focusIndex);
|
76
76
|
}, [refs, innerRef, onIndexChange, disabled]);
|
77
77
|
return /*#__PURE__*/React.createElement(Root, _rollupPluginBabelHelpers.extends({
|