@salutejs/plasma-new-hope 0.76.3-dev.0 → 0.76.4-canary.1085.8735373257.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/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.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/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/ui/DropdownItem/DropdownItem.js +2 -2
- package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
- 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.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.js +1 -1
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +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.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/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/es/_virtual/_rollupPluginBabelHelpers.js +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.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/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/ui/DropdownItem/DropdownItem.js +2 -2
- package/es/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
- 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.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.js +1 -1
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +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.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/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/package.json +13 -13
- package/styled-components/cjs/components/Avatar/Avatar.js +1 -1
- package/styled-components/cjs/components/Avatar/Avatar.styles.js +1 -1
- 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 +1 -1
- 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 +4 -4
- package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +1 -1
- package/styled-components/cjs/components/Dropdown/utils/index.js +1 -1
- 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/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/Grid/Grid.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Grid/Grid.config.js +1 -1
- package/styled-components/cjs/examples/sds_engineer/components/Grid/Grid.config.js +1 -1
- package/styled-components/cjs/mixins/applySpacing.js +1 -1
- package/styled-components/cjs/mixins/typography.js +1 -1
- 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/ui/DropdownItem/DropdownItem.js +3 -3
- 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/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/Grid/Grid.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Grid/Grid.config.js +1 -1
- package/styled-components/es/examples/sds_engineer/components/Grid/Grid.config.js +1 -1
- package/styled-components/es/mixins/applySpacing.js +1 -1
- package/styled-components/es/mixins/typography.js +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Combobox.js","sources":["../../../src/components/Combobox/Combobox.tsx"],"sourcesContent":["import React, { Children, forwardRef, useEffect, useRef, useState } from 'react';\nimport { safeUseId, useForkRef } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../engines';\nimport { cx } from '../../utils';\nimport { getPlacements } from '../Dropdown/utils';\nimport { getChildren, getNewSelected, getValues } from '../Select/utils';\nimport { useKeyNavigation } from '../Select/hooks';\nimport { useDidMountEffect, useForceUpdate } from '../../hooks';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { ComboboxTarget } from './ui';\nimport { ComboboxItemNotFound, StyledPopover, StyledRoot, StyledCombobox, StyledNativeSelect } from './Combobox.styles';\nimport type { ComboboxPrimitiveValue, ComboboxProps } from './Combobox.types';\n\n/**\n * Выпадающий список без внешнего контроля видимости.\n */\nexport const comboboxRoot = (Root: RootProps<HTMLInputElement, ComboboxProps>) =>\n forwardRef<HTMLInputElement, ComboboxProps>(\n (\n {\n name,\n form,\n readOnly,\n disabled,\n label,\n placeholder,\n id,\n children,\n role,\n view,\n size,\n frame,\n usePortal,\n negativeResultContent = 'Элементы не найдены',\n enumerationType = 'comma',\n opened = false,\n placement = 'bottom',\n onToggle,\n onKeyDown,\n filterFunction,\n ...rest\n },\n outerRootRef,\n ) => {\n const forceUpdate = useForceUpdate();\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n const { valueType = 'single', value } = rest;\n const offset = [0, 4] as [number, number];\n\n const [ref, setRef] = useState<HTMLInputElement | null>(null);\n\n const targetRef = useRef<HTMLInputElement>(null);\n const chipsRefs = useRef<Array<HTMLButtonElement>>([]);\n const comboboxRef = useRef<HTMLDivElement>(null);\n const itemsRefs = useRef<Array<HTMLDivElement>>([]);\n const inputRef = useRef<HTMLInputElement>(null);\n const handleRef = useForkRef<HTMLInputElement>(targetRef, outerRootRef);\n const controlledRefs = { targetRef, chipsRefs, selectRef: comboboxRef, itemsRefs, inputRef };\n\n const [innerOpened, setInnerOpened] = useState(opened);\n const [search, setSearch] = useState<string | undefined>('');\n const [filterValue, setFilterValue] = useState(search);\n\n // INFO: нужно высчитывать для корректной работы портала\n const dynamicTargetWidth = targetRef.current?.offsetWidth;\n\n // INFO: Из-за того, что классы передаются через ref,\n // состояние пропсов после изменения view, size\n // всегда предыдущее, поэтому нужно делать форс-ререндер\n useDidMountEffect(() => {\n forceUpdate();\n }, [view, size]);\n\n useEffect(() => {\n if (disabled || readOnly) {\n return;\n }\n\n setInnerOpened(opened);\n }, [opened, disabled, readOnly]);\n\n useEffect(() => {\n // INFO: Для кейсов, когда значение выбрано и нужно вывести весь список\n if (opened) {\n setFilterValue('');\n }\n }, []);\n\n const onInnerToggle = (openValue: boolean, event: React.SyntheticEvent | Event) => {\n if (disabled || readOnly) {\n return;\n }\n\n // INFO: Для кейсов, когда значение выбрано и нужно вывести весь список\n if (!innerOpened) {\n setFilterValue('');\n }\n\n if (onToggle) {\n onToggle(openValue, event);\n\n return;\n }\n\n setInnerOpened(openValue);\n };\n\n const closedWithoutChanges = useRef(true);\n\n const updateValue = (item: HTMLElement, event: React.SyntheticEvent | Event) => {\n const {\n dataset: { value: newValue },\n } = item;\n\n if (rest.valueType === 'multiple') {\n const newSelected = getNewSelected(rest.value, newValue, rest.valueType);\n rest.onChangeValue?.(newSelected);\n\n return;\n }\n\n const newSelected = getNewSelected(rest.value, newValue, 'single');\n\n rest.onChangeValue?.(newSelected);\n\n onInnerToggle?.(false, event);\n\n closedWithoutChanges.current = false;\n };\n\n const onClickChildrenItem = (event: React.MouseEvent<HTMLDivElement>) => {\n // INFO: Для корректной работы компонента Popper\n event.stopPropagation();\n\n const item = event.currentTarget as HTMLElement;\n\n updateValue(item, event);\n };\n\n const onChangeChipValue = (newValue?: Array<ComboboxPrimitiveValue>) => {\n if (rest.valueType !== 'multiple') {\n return;\n }\n\n rest.onChangeValue?.(newValue);\n };\n\n const { onKeyDownTarget, onKeyDownSelect } = useKeyNavigation({\n controlledRefs,\n opened: innerOpened,\n enumerationType,\n valueType,\n componentType: 'combobox',\n value,\n search: filterValue,\n updateOpened: onInnerToggle,\n updateValue,\n });\n\n const childrenArray = Children.toArray(children) as React.ReactElement[];\n\n const childrenMemo = getChildren(\n childrenArray,\n { onClick: onClickChildrenItem, childrenRefs: itemsRefs },\n value,\n filterValue,\n filterFunction,\n ).filter(Boolean);\n\n const values = getValues(childrenArray, value);\n\n const onSearch = (newSearch?: string, newOpened?: boolean) => {\n setSearch(newSearch);\n setFilterValue(newSearch);\n setInnerOpened(newOpened ?? true);\n };\n\n const onKeyDownHandle = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n onKeyDownTarget(event);\n };\n\n return (\n <StyledRoot ref={comboboxRef}>\n <StyledNativeSelect\n aria-invalid=\"false\"\n aria-hidden=\"true\"\n aria-readonly={readOnly}\n tabIndex={-1}\n form={form}\n name={name}\n value={`${value}`}\n disabled={disabled || readOnly}\n />\n <StyledPopover\n role={role}\n isOpen={innerOpened}\n onToggle={onInnerToggle}\n target={\n <ComboboxTarget\n opened={innerOpened}\n values={values}\n label={label}\n placeholder={placeholder}\n search={search}\n enumerationType={enumerationType}\n valueType={valueType}\n readOnly={readOnly}\n disabled={disabled}\n size={size}\n closedWithoutChanges={closedWithoutChanges}\n ref={handleRef}\n chipsRefs={chipsRefs}\n inputRef={inputRef}\n id={innerId}\n onChange={onChangeChipValue}\n onSearch={onSearch}\n onKeyDown={onKeyDownHandle}\n {...rest}\n />\n }\n className={cx(ref?.classList.toString())} // INFO: Прокидываем стили для Popover\n id={innerId}\n offset={offset}\n placement={getPlacements(placement)}\n usePortal={usePortal}\n selectWidth={dynamicTargetWidth}\n frame={frame}\n trigger=\"click\"\n isFocusTrapped={false}\n preventOverflow={false}\n closeOnEsc={false}\n closeOnOverlayClick\n >\n <Root ref={setRef} view={view} size={size}>\n <StyledCombobox onKeyDown={onKeyDownSelect}>\n {childrenMemo.length ? (\n childrenMemo\n ) : (\n <ComboboxItemNotFound>{negativeResultContent}</ComboboxItemNotFound>\n )}\n </StyledCombobox>\n </Root>\n </StyledPopover>\n </StyledRoot>\n );\n },\n );\n\nexport const comboboxConfig = {\n name: 'Combobox',\n tag: 'div',\n layout: comboboxRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'default',\n size: 'm',\n },\n};\n"],"names":["comboboxRoot","Root","forwardRef","_ref","outerRootRef","_targetRef$current","name","form","readOnly","disabled","label","placeholder","id","children","role","view","size","frame","usePortal","_ref$negativeResultCo","negativeResultContent","_ref$enumerationType","enumerationType","_ref$opened","opened","_ref$placement","placement","onToggle","onKeyDown","filterFunction","rest","_objectWithoutProperties","_excluded","forceUpdate","useForceUpdate","uniqId","safeUseId","innerId","_rest$valueType","valueType","value","offset","_useState","useState","_useState2","_slicedToArray","ref","setRef","targetRef","useRef","chipsRefs","comboboxRef","itemsRefs","inputRef","handleRef","useForkRef","controlledRefs","selectRef","_useState3","_useState4","innerOpened","setInnerOpened","_useState5","_useState6","search","setSearch","_useState7","_useState8","filterValue","setFilterValue","dynamicTargetWidth","current","offsetWidth","useDidMountEffect","useEffect","onInnerToggle","openValue","event","closedWithoutChanges","updateValue","item","_rest$onChangeValue2","newValue","dataset","_rest$onChangeValue","newSelected","getNewSelected","onChangeValue","call","onClickChildrenItem","stopPropagation","currentTarget","onChangeChipValue","_rest$onChangeValue3","_useKeyNavigation","useKeyNavigation","componentType","updateOpened","onKeyDownTarget","onKeyDownSelect","childrenArray","Children","toArray","childrenMemo","getChildren","onClick","childrenRefs","filter","Boolean","values","getValues","onSearch","newSearch","newOpened","onKeyDownHandle","React","createElement","StyledRoot","StyledNativeSelect","tabIndex","concat","StyledPopover","isOpen","target","ComboboxTarget","_extends","onChange","className","cx","classList","toString","getPlacements","selectWidth","trigger","isFocusTrapped","preventOverflow","closeOnEsc","closeOnOverlayClick","StyledCombobox","length","ComboboxItemNotFound","comboboxConfig","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgBA;AACA;AACA;IACaA,YAAY,GAAG,SAAfA,YAAYA,CAAIC,IAAgD,EAAA;AAAA,EAAA,oBACzEC,UAAU,CACN,UAAAC,IAAA,EAwBIC,YAAY,EACX;AAAA,IAAA,IAAAC,kBAAA,CAAA;AAAA,IAAA,IAvBGC,IAAI,GAAAH,IAAA,CAAJG,IAAI;MACJC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;MACJC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;MACR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I,EAAE;AACFmI,MAAAA,GAAG,EAAEC,IAAAA;KACR;AACDnI,IAAAA,IAAI,EAAE;AACFkI,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNtI,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
1
|
+
{"version":3,"file":"Combobox.js","sources":["../../../src/components/Combobox/Combobox.tsx"],"sourcesContent":["import React, { Children, forwardRef, useEffect, useRef, useState } from 'react';\nimport { safeUseId, useForkRef } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../engines';\nimport { cx } from '../../utils';\nimport { getPlacements } from '../Dropdown/utils';\nimport { getChildren, getNewSelected, getValues } from '../Select/utils';\nimport { useKeyNavigation } from '../Select/hooks';\nimport { useDidMountEffect, useForceUpdate } from '../../hooks';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { ComboboxTarget } from './ui';\nimport { ComboboxItemNotFound, StyledPopover, StyledRoot, StyledCombobox, StyledNativeSelect } from './Combobox.styles';\nimport type { ComboboxPrimitiveValue, ComboboxProps } from './Combobox.types';\n\n/**\n * Выпадающий список без внешнего контроля видимости.\n */\nexport const comboboxRoot = (Root: RootProps<HTMLInputElement, ComboboxProps>) =>\n forwardRef<HTMLInputElement, ComboboxProps>(\n (\n {\n name,\n form,\n readOnly,\n disabled,\n label,\n placeholder,\n id,\n children,\n role,\n view,\n size,\n frame,\n usePortal,\n negativeResultContent = 'Элементы не найдены',\n enumerationType = 'comma',\n opened = false,\n placement = 'bottom',\n onToggle,\n onKeyDown,\n filterFunction,\n ...rest\n },\n outerRootRef,\n ) => {\n const forceUpdate = useForceUpdate();\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n const { valueType = 'single', value } = rest;\n const offset = [0, 4] as [number, number];\n\n const [ref, setRef] = useState<HTMLInputElement | null>(null);\n\n const targetRef = useRef<HTMLInputElement>(null);\n const chipsRefs = useRef<Array<HTMLButtonElement>>([]);\n const comboboxRef = useRef<HTMLDivElement>(null);\n const itemsRefs = useRef<Array<HTMLDivElement>>([]);\n const inputRef = useRef<HTMLInputElement>(null);\n const handleRef = useForkRef<HTMLInputElement>(targetRef, outerRootRef);\n const controlledRefs = { targetRef, chipsRefs, selectRef: comboboxRef, itemsRefs, inputRef };\n\n const [innerOpened, setInnerOpened] = useState(opened);\n const [search, setSearch] = useState<string | undefined>('');\n const [filterValue, setFilterValue] = useState(search);\n\n // INFO: нужно высчитывать для корректной работы портала\n const dynamicTargetWidth = targetRef.current?.offsetWidth;\n\n // INFO: Из-за того, что классы передаются через ref,\n // состояние пропсов после изменения view, size\n // всегда предыдущее, поэтому нужно делать форс-ререндер\n useDidMountEffect(() => {\n forceUpdate();\n }, [view, size]);\n\n useEffect(() => {\n if (disabled || readOnly) {\n return;\n }\n\n setInnerOpened(opened);\n }, [opened, disabled, readOnly]);\n\n useEffect(() => {\n // INFO: Для кейсов, когда значение выбрано и нужно вывести весь список\n if (opened) {\n setFilterValue('');\n }\n }, []);\n\n const onInnerToggle = (openValue: boolean, event: React.SyntheticEvent | Event) => {\n if (disabled || readOnly) {\n return;\n }\n\n // INFO: Для кейсов, когда значение выбрано и нужно вывести весь список\n if (!innerOpened) {\n setFilterValue('');\n }\n\n if (onToggle) {\n onToggle(openValue, event);\n\n return;\n }\n\n setInnerOpened(openValue);\n };\n\n const closedWithoutChanges = useRef(true);\n\n const updateValue = (item: HTMLElement, event: React.SyntheticEvent | Event) => {\n const {\n dataset: { value: newValue },\n } = item;\n\n if (rest.valueType === 'multiple') {\n const newSelected = getNewSelected(rest.value, newValue, rest.valueType);\n rest.onChangeValue?.(newSelected);\n\n return;\n }\n\n const newSelected = getNewSelected(rest.value, newValue, 'single');\n\n rest.onChangeValue?.(newSelected);\n\n onInnerToggle?.(false, event);\n\n closedWithoutChanges.current = false;\n };\n\n const onClickChildrenItem = (event: React.MouseEvent<HTMLDivElement>) => {\n // INFO: Для корректной работы компонента Popper\n event.stopPropagation();\n\n const item = event.currentTarget as HTMLElement;\n\n updateValue(item, event);\n };\n\n const onChangeChipValue = (newValue?: Array<ComboboxPrimitiveValue>) => {\n if (rest.valueType !== 'multiple') {\n return;\n }\n\n rest.onChangeValue?.(newValue);\n };\n\n const { onKeyDownTarget, onKeyDownSelect } = useKeyNavigation({\n controlledRefs,\n opened: innerOpened,\n enumerationType,\n valueType,\n componentType: 'combobox',\n value,\n search: filterValue,\n updateOpened: onInnerToggle,\n updateValue,\n });\n\n const childrenArray = Children.toArray(children) as React.ReactElement[];\n\n const childrenMemo = getChildren(\n childrenArray,\n { onClick: onClickChildrenItem, childrenRefs: itemsRefs },\n value,\n filterValue,\n filterFunction,\n ).filter(Boolean);\n\n const values = getValues(childrenArray, value);\n\n const onSearch = (newSearch?: string, newOpened?: boolean) => {\n setSearch(newSearch);\n setFilterValue(newSearch);\n setInnerOpened(newOpened ?? true);\n };\n\n const onKeyDownHandle = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n onKeyDownTarget(event);\n };\n\n return (\n <StyledRoot ref={comboboxRef}>\n <StyledNativeSelect\n aria-invalid=\"false\"\n aria-hidden=\"true\"\n aria-readonly={readOnly}\n tabIndex={-1}\n form={form}\n name={name}\n value={`${value}`}\n disabled={disabled || readOnly}\n />\n <StyledPopover\n role={role}\n isOpen={innerOpened}\n onToggle={onInnerToggle}\n target={\n <ComboboxTarget\n opened={innerOpened}\n values={values}\n label={label}\n placeholder={placeholder}\n search={search}\n enumerationType={enumerationType}\n valueType={valueType}\n readOnly={readOnly}\n disabled={disabled}\n size={size}\n closedWithoutChanges={closedWithoutChanges}\n ref={handleRef}\n chipsRefs={chipsRefs}\n inputRef={inputRef}\n id={innerId}\n onChange={onChangeChipValue}\n onSearch={onSearch}\n onKeyDown={onKeyDownHandle}\n {...rest}\n />\n }\n className={cx(ref?.classList.toString())} // INFO: Прокидываем стили для Popover\n id={innerId}\n offset={offset}\n placement={getPlacements(placement)}\n usePortal={usePortal}\n selectWidth={dynamicTargetWidth}\n frame={frame}\n trigger=\"click\"\n isFocusTrapped={false}\n preventOverflow={false}\n closeOnEsc={false}\n closeOnOverlayClick\n >\n <Root ref={setRef} view={view} size={size}>\n <StyledCombobox onKeyDown={onKeyDownSelect}>\n {childrenMemo.length ? (\n childrenMemo\n ) : (\n <ComboboxItemNotFound>{negativeResultContent}</ComboboxItemNotFound>\n )}\n </StyledCombobox>\n </Root>\n </StyledPopover>\n </StyledRoot>\n );\n },\n );\n\nexport const comboboxConfig = {\n name: 'Combobox',\n tag: 'div',\n layout: comboboxRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'default',\n size: 'm',\n },\n};\n"],"names":["comboboxRoot","Root","forwardRef","_ref","outerRootRef","_targetRef$current","name","form","readOnly","disabled","label","placeholder","id","children","role","view","size","frame","usePortal","_ref$negativeResultCo","negativeResultContent","_ref$enumerationType","enumerationType","_ref$opened","opened","_ref$placement","placement","onToggle","onKeyDown","filterFunction","rest","_objectWithoutProperties","_excluded","forceUpdate","useForceUpdate","uniqId","safeUseId","innerId","_rest$valueType","valueType","value","offset","_useState","useState","_useState2","_slicedToArray","ref","setRef","targetRef","useRef","chipsRefs","comboboxRef","itemsRefs","inputRef","handleRef","useForkRef","controlledRefs","selectRef","_useState3","_useState4","innerOpened","setInnerOpened","_useState5","_useState6","search","setSearch","_useState7","_useState8","filterValue","setFilterValue","dynamicTargetWidth","current","offsetWidth","useDidMountEffect","useEffect","onInnerToggle","openValue","event","closedWithoutChanges","updateValue","item","_rest$onChangeValue2","newValue","dataset","_rest$onChangeValue","newSelected","getNewSelected","onChangeValue","call","onClickChildrenItem","stopPropagation","currentTarget","onChangeChipValue","_rest$onChangeValue3","_useKeyNavigation","useKeyNavigation","componentType","updateOpened","onKeyDownTarget","onKeyDownSelect","childrenArray","Children","toArray","childrenMemo","getChildren","onClick","childrenRefs","filter","Boolean","values","getValues","onSearch","newSearch","newOpened","onKeyDownHandle","React","createElement","StyledRoot","StyledNativeSelect","tabIndex","concat","StyledPopover","isOpen","target","ComboboxTarget","_extends","onChange","className","cx","classList","toString","getPlacements","selectWidth","trigger","isFocusTrapped","preventOverflow","closeOnEsc","closeOnOverlayClick","StyledCombobox","length","ComboboxItemNotFound","comboboxConfig","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgBA;AACA;AACA;IACaA,YAAY,GAAG,SAAfA,YAAYA,CAAIC,IAAgD,EAAA;AAAA,EAAA,oBACzEC,UAAU,CACN,UAAAC,IAAA,EAwBIC,YAAY,EACX;AAAA,IAAA,IAAAC,kBAAA,CAAA;AAAA,IAAA,IAvBGC,IAAI,GAAAH,IAAA,CAAJG,IAAI;MACJC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;MACJC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;MACRC,QAAQ,GAAAN,IAAA,CAARM,QAAQ;MACRC,KAAK,GAAAP,IAAA,CAALO,KAAK;MACLC,WAAW,GAAAR,IAAA,CAAXQ,WAAW;MACXC,EAAE,GAAAT,IAAA,CAAFS,EAAE;MACFC,QAAQ,GAAAV,IAAA,CAARU,QAAQ;MACRC,IAAI,GAAAX,IAAA,CAAJW,IAAI;MACJC,IAAI,GAAAZ,IAAA,CAAJY,IAAI;MACJC,IAAI,GAAAb,IAAA,CAAJa,IAAI;MACJC,KAAK,GAAAd,IAAA,CAALc,KAAK;MACLC,SAAS,GAAAf,IAAA,CAATe,SAAS;MAAAC,qBAAA,GAAAhB,IAAA,CACTiB,qBAAqB;AAArBA,MAAAA,qBAAqB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,qBAAqB,GAAAA,qBAAA;MAAAE,oBAAA,GAAAlB,IAAA,CAC7CmB,eAAe;AAAfA,MAAAA,eAAe,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA,O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EA,IAAAA;AAAK,KAAA,eACtCmG,KAAA,CAAAC,aAAA,CAACsB,cAAc,EAAA;AAAC9G,MAAAA,SAAS,EAAEuE,eAAAA;AAAgB,KAAA,EACtCI,YAAY,CAACoC,MAAM,GAChBpC,YAAY,gBAEZY,KAAA,CAAAC,aAAA,CAACwB,oBAAoB,EAAExH,IAAAA,EAAAA,qBAA4C,CAE3D,CACd,CACK,CACP,CAAC,CAAA;AAErB,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMyH,cAAc,GAAG;AAC1BvI,EAAAA,IAAI,EAAE,UAAU;AAChBwI,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE/I,YAAY;AACpBgJ,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,UAAU,EAAE;AACRlI,IAAAA,IAAI,EAAE;AACFmI,MAAAA,GAAG,EAAEC,IAAAA;KACR;AACDnI,IAAAA,IAAI,EAAE;AACFkI,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNtI,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
@@ -25,14 +25,14 @@ var useFocusController = function useFocusController(_ref) {
|
|
25
25
|
if (!opened) {
|
26
26
|
var _contentRef$current;
|
27
27
|
updateFocused(false);
|
28
|
-
(_contentRef$current = contentRef.current) === null || _contentRef$current === void 0
|
28
|
+
(_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 || _contentRef$current.scrollTo({
|
29
29
|
left: 0
|
30
30
|
});
|
31
31
|
}
|
32
32
|
var hasFocusAfterClose = prevOpened !== undefined && !opened && !(closedWithoutChanges !== null && closedWithoutChanges !== void 0 && closedWithoutChanges.current);
|
33
33
|
if (opened || hasFocusAfterClose) {
|
34
34
|
var _inputRef$current;
|
35
|
-
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0
|
35
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
36
36
|
}
|
37
37
|
|
38
38
|
// INFO: Помогает определить, произошло ли закрытие выпадающего меню при выборе значения.
|
@@ -47,7 +47,7 @@ var useFocusController = function useFocusController(_ref) {
|
|
47
47
|
var valuesCount = (values === null || values === void 0 ? void 0 : values.length) || 0;
|
48
48
|
if ((opened || prevOpened) && prevValuesCount < valuesCount) {
|
49
49
|
var _inputRef$current2;
|
50
|
-
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0
|
50
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.focus();
|
51
51
|
}
|
52
52
|
}, [values, readOnly]);
|
53
53
|
useDidMountEffect(function () {
|
@@ -83,16 +83,16 @@ var useFocusController = function useFocusController(_ref) {
|
|
83
83
|
return;
|
84
84
|
}
|
85
85
|
if (valueType === 'single') {
|
86
|
-
updateSearch === null || updateSearch === void 0
|
86
|
+
updateSearch === null || updateSearch === void 0 || updateSearch(newSearch, false);
|
87
87
|
}
|
88
88
|
if (valueType === 'multiple') {
|
89
|
-
updateSearch === null || updateSearch === void 0
|
89
|
+
updateSearch === null || updateSearch === void 0 || updateSearch('', false);
|
90
90
|
}
|
91
91
|
}, [updateSearch, values, opened, hasValue, textContent, valueType]);
|
92
92
|
var onClickText = function onClickText(event) {
|
93
93
|
var _inputRef$current3;
|
94
|
-
onChipClick === null || onChipClick === void 0
|
95
|
-
(_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0
|
94
|
+
onChipClick === null || onChipClick === void 0 || onChipClick(event);
|
95
|
+
(_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 || _inputRef$current3.focus();
|
96
96
|
};
|
97
97
|
var onFocusInput = function onFocusInput() {
|
98
98
|
var _contentRef$current2, _contentRef$current3;
|
@@ -106,10 +106,10 @@ var useFocusController = function useFocusController(_ref) {
|
|
106
106
|
if (valueType === 'single') {
|
107
107
|
setTimeout(function () {
|
108
108
|
var _inputRef$current4;
|
109
|
-
(_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0
|
109
|
+
(_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 || _inputRef$current4.select();
|
110
110
|
});
|
111
111
|
}
|
112
|
-
(_contentRef$current2 = contentRef.current) === null || _contentRef$current2 === void 0
|
112
|
+
(_contentRef$current2 = contentRef.current) === null || _contentRef$current2 === void 0 || _contentRef$current2.scrollTo({
|
113
113
|
left: (_contentRef$current3 = contentRef.current) === null || _contentRef$current3 === void 0 ? void 0 : _contentRef$current3.scrollWidth
|
114
114
|
});
|
115
115
|
updateFocused(true);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useFocusController.js","sources":["../../../../src/components/Combobox/hooks/useFocusController.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nimport { useDidMountEffect, usePreviousValue } from '../../../hooks';\nimport type { UseFocusControllerProps } from '../Combobox.types';\n\nexport const useFocusController = ({\n controlledRefs: { contentRef, inputHelperRef, inputRef },\n opened,\n hasValue,\n textContent,\n search,\n values,\n readOnly,\n valueType,\n closedWithoutChanges,\n updateSearch,\n updateFocused,\n onChipClick,\n}: UseFocusControllerProps) => {\n const prevSearch = usePreviousValue(search);\n const prevValues = usePreviousValue(values);\n const prevOpened = usePreviousValue(opened);\n\n useDidMountEffect(() => {\n if (!opened) {\n updateFocused(false);\n contentRef.current?.scrollTo({ left: 0 });\n }\n\n const hasFocusAfterClose = prevOpened !== undefined && !opened && !closedWithoutChanges?.current;\n\n if (opened || hasFocusAfterClose) {\n inputRef.current?.focus();\n }\n\n // INFO: Помогает определить, произошло ли закрытие выпадающего меню при выборе значения.\n // Нужно для того, чтобы не фокусироваться на инпуте\n // ОЧЕНЬ не нравится это решение, но оно работает\n if (closedWithoutChanges?.current === false) {\n closedWithoutChanges.current = true;\n }\n }, [opened]);\n\n useDidMountEffect(() => {\n const prevValuesCount = prevValues?.length || 0;\n const valuesCount = values?.length || 0;\n\n if ((opened || prevOpened) && prevValuesCount < valuesCount) {\n inputRef.current?.focus();\n }\n }, [values, readOnly]);\n\n useDidMountEffect(() => {\n if (!inputRef.current) {\n return;\n }\n\n // INFO: Для multiple\n if (search === '') {\n inputRef.current.style.flex = '1';\n }\n\n // INFO: Для single\n if (!opened && prevSearch !== search) {\n inputRef.current.style.flex = '1';\n }\n\n // INFO: Для кейсов, когда значение вырезано\n if (!inputRef.current.value.length) {\n inputRef.current.style.flex = '1';\n return;\n }\n\n if (valueType === 'multiple' && inputHelperRef.current) {\n const { clientWidth } = inputHelperRef.current;\n inputRef.current.style.flex = `1 0 ${clientWidth}px`;\n }\n }, [readOnly, search, valueType]);\n\n useEffect(() => {\n const newSearch = hasValue ? textContent : '';\n\n // INFO: Заполнить поле input при первой инициализации\n if (prevOpened !== undefined && opened) {\n return;\n }\n\n if (valueType === 'single') {\n updateSearch?.(newSearch, false);\n }\n\n if (valueType === 'multiple') {\n updateSearch?.('', false);\n }\n }, [updateSearch, values, opened, hasValue, textContent, valueType]);\n\n const onClickText = (event: React.MouseEvent<HTMLButtonElement>) => {\n onChipClick?.(event);\n inputRef.current?.focus();\n };\n\n const onFocusInput = () => {\n if (readOnly) {\n return;\n }\n\n // INFO: Жёсткий хак, нужный для корректного выделения всей строки после выбора значения.\n // Проблема возникает из-за очередности срабатывания useEffect, который сначала вызывает фокус\n // на элемент, а потом обновляет состояние inputRef\n if (valueType === 'single') {\n setTimeout(() => {\n inputRef.current?.select();\n });\n }\n\n contentRef.current?.scrollTo({ left: contentRef.current?.scrollWidth });\n\n updateFocused(true);\n };\n\n const onBlurInput = () => {\n if (!opened) {\n updateFocused(false);\n }\n };\n\n return { onClickText, onFocusInput, onBlurInput } as const;\n};\n"],"names":["useFocusController","_ref","_ref$controlledRefs","controlledRefs","contentRef","inputHelperRef","inputRef","opened","hasValue","textContent","search","values","readOnly","valueType","closedWithoutChanges","updateSearch","updateFocused","onChipClick","prevSearch","usePreviousValue","prevValues","prevOpened","useDidMountEffect","_contentRef$current","current","scrollTo","left","hasFocusAfterClose","undefined","_inputRef$current","focus","prevValuesCount","length","valuesCount","_inputRef$current2","style","flex","value","clientWidth","concat","useEffect","newSearch","onClickText","event","_inputRef$current3","onFocusInput","_contentRef$current2","_contentRef$current3","setTimeout","_inputRef$current4","select","scrollWidth","onBlurInput"],"mappings":";;;;IAKaA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAaA;AAAA,EAAA,IAAAC,mBAAA,GAAAD,IAAA,CAZ3BE,cAAc;IAAIC,UAAU,GAAAF,mBAAA,CAAVE,UAAU;IAAEC,cAAc,GAAAH,mBAAA,CAAdG,cAAc;IAAEC,QAAQ,GAAAJ,mBAAA,CAARI,QAAQ;IACtDC,MAAM,GAAAN,IAAA,CAANM,MAAM;IACNC,QAAQ,GAAAP,IAAA,CAARO,QAAQ;IACRC,WAAW,GAAAR,IAAA,CAAXQ,WAAW;IACXC,MAAM,GAAAT,IAAA,CAANS,MAAM;IACNC,MAAM,GAAAV,IAAA,CAANU,MAAM;IACNC,QAAQ,GAAAX,IAAA,CAARW,QAAQ;IACRC,SAAS,GAAAZ,IAAA,CAATY,SAAS;IACTC,oBAAoB,GAAAb,IAAA,CAApBa,oBAAoB;IACpBC,YAAY,GAAAd,IAAA,CAAZc,YAAY;IACZC,aAAa,GAAAf,IAAA,CAAbe,aAAa;IACbC,WAAW,GAAAhB,IAAA,CAAXgB,WAAW,CAAA;AAEX,EAAA,IAAMC,UAAU,GAAGC,gBAAgB,CAACT,MAAM,CAAC,CAAA;AAC3C,EAAA,IAAMU,UAAU,GAAGD,gBAAgB,CAACR,MAAM,CAAC,CAAA;AAC3C,EAAA,IAAMU,UAAU,GAAGF,gBAAgB,CAACZ,MAAM,CAAC,CAAA;AAE3Ce,EAAAA,iBAAiB,CAAC,YAAM;IACpB,IAAI,CAACf,MAAM,EAAE;AAAA,MAAA,IAAAgB,mBAAA,CAAA;MACTP,aAAa,CAAC,KAAK,CAAC,CAAA;MACpB,CAAAO,mBAAA,GAAAnB,UAAU,CAACoB,OAAO,MAAAD,IAAAA,IAAAA,mBAAA,KAAlBA,KAAAA,CAAAA,
|
1
|
+
{"version":3,"file":"useFocusController.js","sources":["../../../../src/components/Combobox/hooks/useFocusController.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nimport { useDidMountEffect, usePreviousValue } from '../../../hooks';\nimport type { UseFocusControllerProps } from '../Combobox.types';\n\nexport const useFocusController = ({\n controlledRefs: { contentRef, inputHelperRef, inputRef },\n opened,\n hasValue,\n textContent,\n search,\n values,\n readOnly,\n valueType,\n closedWithoutChanges,\n updateSearch,\n updateFocused,\n onChipClick,\n}: UseFocusControllerProps) => {\n const prevSearch = usePreviousValue(search);\n const prevValues = usePreviousValue(values);\n const prevOpened = usePreviousValue(opened);\n\n useDidMountEffect(() => {\n if (!opened) {\n updateFocused(false);\n contentRef.current?.scrollTo({ left: 0 });\n }\n\n const hasFocusAfterClose = prevOpened !== undefined && !opened && !closedWithoutChanges?.current;\n\n if (opened || hasFocusAfterClose) {\n inputRef.current?.focus();\n }\n\n // INFO: Помогает определить, произошло ли закрытие выпадающего меню при выборе значения.\n // Нужно для того, чтобы не фокусироваться на инпуте\n // ОЧЕНЬ не нравится это решение, но оно работает\n if (closedWithoutChanges?.current === false) {\n closedWithoutChanges.current = true;\n }\n }, [opened]);\n\n useDidMountEffect(() => {\n const prevValuesCount = prevValues?.length || 0;\n const valuesCount = values?.length || 0;\n\n if ((opened || prevOpened) && prevValuesCount < valuesCount) {\n inputRef.current?.focus();\n }\n }, [values, readOnly]);\n\n useDidMountEffect(() => {\n if (!inputRef.current) {\n return;\n }\n\n // INFO: Для multiple\n if (search === '') {\n inputRef.current.style.flex = '1';\n }\n\n // INFO: Для single\n if (!opened && prevSearch !== search) {\n inputRef.current.style.flex = '1';\n }\n\n // INFO: Для кейсов, когда значение вырезано\n if (!inputRef.current.value.length) {\n inputRef.current.style.flex = '1';\n return;\n }\n\n if (valueType === 'multiple' && inputHelperRef.current) {\n const { clientWidth } = inputHelperRef.current;\n inputRef.current.style.flex = `1 0 ${clientWidth}px`;\n }\n }, [readOnly, search, valueType]);\n\n useEffect(() => {\n const newSearch = hasValue ? textContent : '';\n\n // INFO: Заполнить поле input при первой инициализации\n if (prevOpened !== undefined && opened) {\n return;\n }\n\n if (valueType === 'single') {\n updateSearch?.(newSearch, false);\n }\n\n if (valueType === 'multiple') {\n updateSearch?.('', false);\n }\n }, [updateSearch, values, opened, hasValue, textContent, valueType]);\n\n const onClickText = (event: React.MouseEvent<HTMLButtonElement>) => {\n onChipClick?.(event);\n inputRef.current?.focus();\n };\n\n const onFocusInput = () => {\n if (readOnly) {\n return;\n }\n\n // INFO: Жёсткий хак, нужный для корректного выделения всей строки после выбора значения.\n // Проблема возникает из-за очередности срабатывания useEffect, который сначала вызывает фокус\n // на элемент, а потом обновляет состояние inputRef\n if (valueType === 'single') {\n setTimeout(() => {\n inputRef.current?.select();\n });\n }\n\n contentRef.current?.scrollTo({ left: contentRef.current?.scrollWidth });\n\n updateFocused(true);\n };\n\n const onBlurInput = () => {\n if (!opened) {\n updateFocused(false);\n }\n };\n\n return { onClickText, onFocusInput, onBlurInput } as const;\n};\n"],"names":["useFocusController","_ref","_ref$controlledRefs","controlledRefs","contentRef","inputHelperRef","inputRef","opened","hasValue","textContent","search","values","readOnly","valueType","closedWithoutChanges","updateSearch","updateFocused","onChipClick","prevSearch","usePreviousValue","prevValues","prevOpened","useDidMountEffect","_contentRef$current","current","scrollTo","left","hasFocusAfterClose","undefined","_inputRef$current","focus","prevValuesCount","length","valuesCount","_inputRef$current2","style","flex","value","clientWidth","concat","useEffect","newSearch","onClickText","event","_inputRef$current3","onFocusInput","_contentRef$current2","_contentRef$current3","setTimeout","_inputRef$current4","select","scrollWidth","onBlurInput"],"mappings":";;;;IAKaA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAaA;AAAA,EAAA,IAAAC,mBAAA,GAAAD,IAAA,CAZ3BE,cAAc;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IAAAA,oBAAA,CAAoBrB,QAAQ,CAAC;MAAEC,IAAI,EAAA,CAAAqB,oBAAA,GAAE3C,UAAU,CAACoB,OAAO,MAAAuB,IAAAA,IAAAA,oBAAA,KAAlBA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,oBAAA,CAAoBI,WAAAA;AAAY,KAAC,CAAC,CAAA;IAEvEnC,aAAa,CAAC,IAAI,CAAC,CAAA;GACtB,CAAA;AAED,EAAA,IAAMoC,WAAW,GAAG,SAAdA,WAAWA,GAAS;IACtB,IAAI,CAAC7C,MAAM,EAAE;MACTS,aAAa,CAAC,KAAK,CAAC,CAAA;AACxB,KAAA;GACH,CAAA;EAED,OAAO;AAAE0B,IAAAA,WAAW,EAAXA,WAAW;AAAEG,IAAAA,YAAY,EAAZA,YAAY;AAAEO,IAAAA,WAAW,EAAXA,WAAAA;GAAa,CAAA;AACrD;;;;"}
|
@@ -17,7 +17,7 @@ var ComboboxChip = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
17
17
|
return onClear(value, text);
|
18
18
|
};
|
19
19
|
var onKeyDownHandle = function onKeyDownHandle(event) {
|
20
|
-
onKeyDown === null || onKeyDown === void 0
|
20
|
+
onKeyDown === null || onKeyDown === void 0 || onKeyDown(value, text, index, event);
|
21
21
|
};
|
22
22
|
return /*#__PURE__*/React.createElement(StyledChip, {
|
23
23
|
ref: ref,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ComboboxChip.js","sources":["../../../../../src/components/Combobox/ui/ComboboxChip/ComboboxChip.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { StyledChip } from './ComboboxChip.styles';\nimport type { ComboboxChipProps } from './ComboboxChip.types';\n\n/**\n * Чип, отображающий выбранный элемент\n */\nexport const ComboboxChip = forwardRef<HTMLButtonElement, ComboboxChipProps>(\n ({ value, text, index, disabled, readOnly, onClick, onClear, onKeyDown }, ref) => {\n const onClearHandle = () => onClear(value, text);\n\n const onKeyDownHandle = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(value, text, index, event);\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":["ComboboxChip","forwardRef","_ref","ref","value","text","index","disabled","readOnly","onClick","onClear","onKeyDown","onClearHandle","onKeyDownHandle","event","React","createElement","StyledChip","tabIndex","concat"],"mappings":";;;AAKA;AACA;AACA;AACO,IAAMA,YAAY,gBAAGC,UAAU,CAClC,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,GAAG,SAAhBA,aAAaA,GAAA;AAAA,IAAA,OAASF,OAAO,CAACN,KAAK,EAAEC,IAAI,CAAC,CAAA;AAAA,GAAA,CAAA;AAEhD,EAAA,IAAMQ,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,KAA6C,EAAK;AACvEH,IAAAA,SAAS,KAATA,IAAAA,IAAAA,SAAS,KAATA,KAAAA,CAAAA,
|
1
|
+
{"version":3,"file":"ComboboxChip.js","sources":["../../../../../src/components/Combobox/ui/ComboboxChip/ComboboxChip.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { StyledChip } from './ComboboxChip.styles';\nimport type { ComboboxChipProps } from './ComboboxChip.types';\n\n/**\n * Чип, отображающий выбранный элемент\n */\nexport const ComboboxChip = forwardRef<HTMLButtonElement, ComboboxChipProps>(\n ({ value, text, index, disabled, readOnly, onClick, onClear, onKeyDown }, ref) => {\n const onClearHandle = () => onClear(value, text);\n\n const onKeyDownHandle = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(value, text, index, event);\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":["ComboboxChip","forwardRef","_ref","ref","value","text","index","disabled","readOnly","onClick","onClear","onKeyDown","onClearHandle","onKeyDownHandle","event","React","createElement","StyledChip","tabIndex","concat"],"mappings":";;;AAKA;AACA;AACA;AACO,IAAMA,YAAY,gBAAGC,UAAU,CAClC,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,GAAG,SAAhBA,aAAaA,GAAA;AAAA,IAAA,OAASF,OAAO,CAACN,KAAK,EAAEC,IAAI,CAAC,CAAA;AAAA,GAAA,CAAA;AAEhD,EAAA,IAAMQ,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,KAA6C,EAAK;AACvEH,IAAAA,SAAS,KAATA,IAAAA,IAAAA,SAAS,KAATA,KAAAA,CAAAA,IAAAA,SAAS,CAAGP,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAEQ,KAAK,CAAC,CAAA;GACzC,CAAA;AAED,EAAA,oBACIC,KAAA,CAAAC,aAAA,CAACC,UAAU,EAAA;AACPd,IAAAA,GAAG,EAAEA,GAAI;IACTe,QAAQ,EAAE,CAAC,CAAE;AACbX,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,OAAO,EAAEE,aAAc;AACvBD,IAAAA,SAAS,EAAEE,eAAgB;IAC3BR,IAAI,EAAA,EAAA,CAAAc,MAAA,CAAKd,IAAI,CAAA;AAAG,GACnB,CAAC,CAAA;AAEV,CACJ;;;;"}
|
@@ -103,8 +103,8 @@ var ComboboxTarget = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
103
103
|
itemValue = _ref9[0];
|
104
104
|
return itemValue;
|
105
105
|
});
|
106
|
-
chipsRefs === null || chipsRefs === void 0
|
107
|
-
onChange === null || onChange === void 0
|
106
|
+
chipsRefs === null || chipsRefs === void 0 || chipsRefs.current.splice(index, 1);
|
107
|
+
onChange === null || onChange === void 0 || onChange(newValue);
|
108
108
|
};
|
109
109
|
var onChipKeyDown = function onChipKeyDown(value, text, index, event) {
|
110
110
|
var code = event.code;
|
@@ -127,13 +127,13 @@ var ComboboxTarget = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
127
127
|
itemValue = _ref11[0];
|
128
128
|
return itemValue;
|
129
129
|
});
|
130
|
-
newValue === null || newValue === void 0
|
131
|
-
chipsRefs === null || chipsRefs === void 0
|
132
|
-
onChange === null || onChange === void 0
|
130
|
+
newValue === null || newValue === void 0 || newValue.pop();
|
131
|
+
chipsRefs === null || chipsRefs === void 0 || chipsRefs.current.pop();
|
132
|
+
onChange === null || onChange === void 0 || onChange(newValue);
|
133
133
|
}
|
134
134
|
};
|
135
135
|
var onChangeInput = function onChangeInput(event) {
|
136
|
-
onSearch === null || onSearch === void 0
|
136
|
+
onSearch === null || onSearch === void 0 || onSearch(event.currentTarget.value);
|
137
137
|
};
|
138
138
|
var onWheel = function onWheel(event) {
|
139
139
|
var deltaY = event.deltaY;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ComboboxTarget.js","sources":["../../../../../src/components/Combobox/ui/ComboboxTarget/ComboboxTarget.tsx"],"sourcesContent":["import React, { forwardRef, useRef, useState } from 'react';\n\nimport { classes } from '../../Combobox.tokens';\nimport { cx } from '../../../../utils';\nimport { ComboboxChip } from '../ComboboxChip/ComboboxChip';\nimport type { ComboboxPrimitiveValue } from '../../Combobox.types';\nimport { useFocusController } from '../../hooks';\nimport { Keys } from '../../../Select/hooks/useKeyNavigation';\n\nimport {\n StyledArrow,\n StyledChips,\n StyledContent,\n StyledLabel,\n StyledComboboxInput,\n StyledComboboxInputHelper,\n StyledComboboxTarget,\n StyledText,\n} from './ComboboxTarget.styles';\nimport type { ComboboxTargetProps } from './ComboboxTarget.types';\n\nconst {\n hasChips,\n innerLabelUp,\n arrowInverse,\n comboboxTargetArrow,\n comboboxTargeText,\n comboboxTargetInput,\n comboboxTargetLabel,\n} = classes;\n\n/**\n * Элемент для выпадающего списка\n */\nexport const ComboboxTarget = forwardRef<HTMLInputElement, ComboboxTargetProps>(\n (\n {\n values,\n search,\n label,\n placeholder,\n opened,\n readOnly,\n disabled,\n enumerationType,\n valueType,\n size,\n closedWithoutChanges,\n id,\n chipsRefs,\n inputRef,\n onChange,\n onSearch,\n onKeyDown,\n ...rest\n },\n ref,\n ) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const inputHelperRef = useRef<HTMLDivElement>(null);\n const [focused, setFocused] = useState(false);\n\n const controlledRefs = { contentRef, inputHelperRef, inputRef };\n const textContent = values?.map(([, text]) => text).join(', ');\n const hasValue = values?.some(([value]) => value);\n\n const isEnumerationComma = enumerationType === 'comma';\n const isExtraSmall = size === 'xs';\n const isInputNotEmpty = hasValue || search;\n const isInputActive = !hasValue && (opened || (focused && !readOnly));\n const hasLabel = label && !isExtraSmall && isEnumerationComma;\n const hasOnlyLabel = !placeholder || label;\n const hasNoAnyTip = !placeholder && !label;\n const placeholderValue = (!label && !hasValue) || isExtraSmall ? placeholder : undefined;\n\n const withInnerLabelUp =\n !isExtraSmall && !hasNoAnyTip && hasOnlyLabel && (isInputActive || (hasLabel && isInputNotEmpty))\n ? innerLabelUp\n : undefined;\n const withArrowInverse = opened ? arrowInverse : undefined;\n const withHasChips = hasValue && enumerationType === 'chip' ? hasChips : undefined;\n\n const isLabelVisible = (!hasValue && !isExtraSmall) || hasLabel;\n const isEnumerationVisible = hasValue && valueType !== 'single';\n\n const onChipClick = (event: React.MouseEvent<HTMLButtonElement>) => event.stopPropagation();\n\n const { onClickText, onFocusInput, onBlurInput } = useFocusController({\n controlledRefs,\n opened,\n hasValue,\n textContent,\n search,\n values,\n valueType,\n readOnly,\n closedWithoutChanges,\n updateFocused: setFocused,\n updateSearch: onSearch,\n onChipClick,\n });\n\n const onChipClear = (value: ComboboxPrimitiveValue, text: ComboboxPrimitiveValue, 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\n const onChipKeyDown = (\n value: ComboboxPrimitiveValue,\n text: ComboboxPrimitiveValue,\n index: number,\n event: React.KeyboardEvent<HTMLButtonElement>,\n ) => {\n const { code } = event;\n\n if (code === Keys.Tab) {\n event.preventDefault();\n }\n\n if (code === Keys.Backspace) {\n onChipClear(value, text, index);\n }\n };\n\n const onKeyDownInput = (event: React.KeyboardEvent<HTMLInputElement>) => {\n const { code } = event;\n\n if (opened && code === Keys.Tab) {\n event.preventDefault();\n }\n\n if (code === Keys.Backspace && !event.currentTarget?.value.length) {\n const newValue = values?.map(([itemValue]) => itemValue);\n newValue?.pop();\n chipsRefs?.current.pop();\n\n onChange?.(newValue);\n }\n };\n\n const onChangeInput = (event: React.ChangeEvent<HTMLInputElement>) => {\n onSearch?.(event.currentTarget.value);\n };\n\n const onWheel = (event: React.WheelEvent<HTMLDivElement>) => {\n const { deltaY } = event;\n\n if (contentRef.current) {\n contentRef.current.scrollLeft += Math.round(deltaY);\n }\n };\n\n const getRef = (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 <StyledComboboxTarget\n ref={ref}\n opened={opened}\n readOnly={readOnly}\n disabled={disabled}\n title={textContent}\n aria-label={label}\n className={cx(withInnerLabelUp, withHasChips)}\n onWheel={onWheel}\n onKeyDown={onKeyDown}\n {...rest}\n >\n <StyledContent tabIndex={-1} ref={contentRef} className={withHasChips}>\n {isEnumerationVisible &&\n (isEnumerationComma ? (\n <StyledText className={comboboxTargeText} onClick={onClickText}>\n {textContent}\n </StyledText>\n ) : (\n <StyledChips>\n {values?.map(([value, text], index) => (\n <ComboboxChip\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 ))}\n <StyledComboboxInput\n ref={inputRef}\n role=\"textbox\"\n className={comboboxTargetInput}\n value={search}\n placeholder={placeholderValue}\n disabled={disabled}\n readOnly={readOnly}\n onFocus={onFocusInput}\n onBlur={onBlurInput}\n onChange={onChangeInput}\n onKeyDown={onKeyDownInput}\n />\n {valueType === 'multiple' && (\n <StyledComboboxInputHelper ref={inputHelperRef}>{search}</StyledComboboxInputHelper>\n )}\n </StyledContent>\n {isLabelVisible && (\n <StyledLabel className={comboboxTargetLabel} htmlFor={id}>\n {label}\n </StyledLabel>\n )}\n <StyledArrow size=\"s\" className={cx(comboboxTargetArrow, withArrowInverse)} />\n </StyledComboboxTarget>\n );\n },\n);\n"],"names":["hasChips","classes","innerLabelUp","arrowInverse","comboboxTargetArrow","comboboxTargeText","comboboxTargetInput","comboboxTargetLabel","ComboboxTarget","forwardRef","_ref","ref","values","search","label","placeholder","opened","readOnly","disabled","enumerationType","valueType","size","closedWithoutChanges","id","chipsRefs","inputRef","onChange","onSearch","onKeyDown","rest","_objectWithoutProperties","_excluded","contentRef","useRef","inputHelperRef","_useState","useState","_useState2","_slicedToArray","focused","setFocused","controlledRefs","textContent","map","_ref2","_ref3","text","join","hasValue","some","_ref4","_ref5","value","isEnumerationComma","isExtraSmall","isInputNotEmpty","isInputActive","hasLabel","hasOnlyLabel","hasNoAnyTip","placeholderValue","undefined","withInnerLabelUp","withArrowInverse","withHasChips","isLabelVisible","isEnumerationVisible","onChipClick","event","stopPropagation","_useFocusController","useFocusController","updateFocused","updateSearch","onClickText","onFocusInput","onBlurInput","onChipClear","index","newValue","filter","_ref6","_ref7","itemValue","itemText","_ref8","_ref9","current","splice","onChipKeyDown","code","Keys","Tab","preventDefault","Backspace","onKeyDownInput","_event$currentTarget","currentTarget","length","_ref10","_ref11","pop","onChangeInput","onWheel","deltaY","scrollLeft","Math","round","getRef","element","React","createElement","StyledComboboxTarget","_extends","title","className","cx","StyledContent","tabIndex","StyledText","onClick","StyledChips","_ref12","_ref13","ComboboxChip","key","concat","onClear","v","t","StyledComboboxInput","role","onFocus","onBlur","StyledComboboxInputHelper","StyledLabel","htmlFor","StyledArrow"],"mappings":";;;;;;;;;;AAqBA,IACIA,QAAQ,GAORC,OAAO,CAPPD,QAAQ;EACRE,YAAY,GAMZD,OAAO,CANPC,YAAY;EACZC,YAAY,GAKZF,OAAO,CALPE,YAAY;EACZC,mBAAmB,GAInBH,OAAO,CAJPG,mBAAmB;EACnBC,iBAAiB,GAGjBJ,OAAO,CAHPI,iBAAiB;EACjBC,mBAAmB,GAEnBL,OAAO,CAFPK,mBAAmB;EACnBC,mBAAmB,GACnBN,OAAO,CADPM,mBAAmB,CAAA;;A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C3H,IAAAA,GAAG,EAAEuB,cAAAA;GAAiBrB,EAAAA,MAAkC,CAE5E,CAAC,EACfoD,cAAc,iBACX6C,KAAA,CAAAC,aAAA,CAACwB,WAAW,EAAA;AAACpB,IAAAA,SAAS,EAAE5G,mBAAoB;AAACiI,IAAAA,OAAO,EAAEjH,EAAAA;AAAG,GAAA,EACpDT,KACQ,CAChB,eACDgG,KAAA,CAAAC,aAAA,CAAC0B,WAAW,EAAA;AAACpH,IAAAA,IAAI,EAAC,GAAG;AAAC8F,IAAAA,SAAS,EAAEC,EAAE,CAAChH,mBAAmB,EAAE2D,gBAAgB,CAAA;AAAE,GAAE,CAC3D,CAAC,CAAA;AAE/B,CACJ;;;;"}
|
1
|
+
{"version":3,"file":"ComboboxTarget.js","sources":["../../../../../src/components/Combobox/ui/ComboboxTarget/ComboboxTarget.tsx"],"sourcesContent":["import React, { forwardRef, useRef, useState } from 'react';\n\nimport { classes } from '../../Combobox.tokens';\nimport { cx } from '../../../../utils';\nimport { ComboboxChip } from '../ComboboxChip/ComboboxChip';\nimport type { ComboboxPrimitiveValue } from '../../Combobox.types';\nimport { useFocusController } from '../../hooks';\nimport { Keys } from '../../../Select/hooks/useKeyNavigation';\n\nimport {\n StyledArrow,\n StyledChips,\n StyledContent,\n StyledLabel,\n StyledComboboxInput,\n StyledComboboxInputHelper,\n StyledComboboxTarget,\n StyledText,\n} from './ComboboxTarget.styles';\nimport type { ComboboxTargetProps } from './ComboboxTarget.types';\n\nconst {\n hasChips,\n innerLabelUp,\n arrowInverse,\n comboboxTargetArrow,\n comboboxTargeText,\n comboboxTargetInput,\n comboboxTargetLabel,\n} = classes;\n\n/**\n * Элемент для выпадающего списка\n */\nexport const ComboboxTarget = forwardRef<HTMLInputElement, ComboboxTargetProps>(\n (\n {\n values,\n search,\n label,\n placeholder,\n opened,\n readOnly,\n disabled,\n enumerationType,\n valueType,\n size,\n closedWithoutChanges,\n id,\n chipsRefs,\n inputRef,\n onChange,\n onSearch,\n onKeyDown,\n ...rest\n },\n ref,\n ) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const inputHelperRef = useRef<HTMLDivElement>(null);\n const [focused, setFocused] = useState(false);\n\n const controlledRefs = { contentRef, inputHelperRef, inputRef };\n const textContent = values?.map(([, text]) => text).join(', ');\n const hasValue = values?.some(([value]) => value);\n\n const isEnumerationComma = enumerationType === 'comma';\n const isExtraSmall = size === 'xs';\n const isInputNotEmpty = hasValue || search;\n const isInputActive = !hasValue && (opened || (focused && !readOnly));\n const hasLabel = label && !isExtraSmall && isEnumerationComma;\n const hasOnlyLabel = !placeholder || label;\n const hasNoAnyTip = !placeholder && !label;\n const placeholderValue = (!label && !hasValue) || isExtraSmall ? placeholder : undefined;\n\n const withInnerLabelUp =\n !isExtraSmall && !hasNoAnyTip && hasOnlyLabel && (isInputActive || (hasLabel && isInputNotEmpty))\n ? innerLabelUp\n : undefined;\n const withArrowInverse = opened ? arrowInverse : undefined;\n const withHasChips = hasValue && enumerationType === 'chip' ? hasChips : undefined;\n\n const isLabelVisible = (!hasValue && !isExtraSmall) || hasLabel;\n const isEnumerationVisible = hasValue && valueType !== 'single';\n\n const onChipClick = (event: React.MouseEvent<HTMLButtonElement>) => event.stopPropagation();\n\n const { onClickText, onFocusInput, onBlurInput } = useFocusController({\n controlledRefs,\n opened,\n hasValue,\n textContent,\n search,\n values,\n valueType,\n readOnly,\n closedWithoutChanges,\n updateFocused: setFocused,\n updateSearch: onSearch,\n onChipClick,\n });\n\n const onChipClear = (value: ComboboxPrimitiveValue, text: ComboboxPrimitiveValue, 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\n const onChipKeyDown = (\n value: ComboboxPrimitiveValue,\n text: ComboboxPrimitiveValue,\n index: number,\n event: React.KeyboardEvent<HTMLButtonElement>,\n ) => {\n const { code } = event;\n\n if (code === Keys.Tab) {\n event.preventDefault();\n }\n\n if (code === Keys.Backspace) {\n onChipClear(value, text, index);\n }\n };\n\n const onKeyDownInput = (event: React.KeyboardEvent<HTMLInputElement>) => {\n const { code } = event;\n\n if (opened && code === Keys.Tab) {\n event.preventDefault();\n }\n\n if (code === Keys.Backspace && !event.currentTarget?.value.length) {\n const newValue = values?.map(([itemValue]) => itemValue);\n newValue?.pop();\n chipsRefs?.current.pop();\n\n onChange?.(newValue);\n }\n };\n\n const onChangeInput = (event: React.ChangeEvent<HTMLInputElement>) => {\n onSearch?.(event.currentTarget.value);\n };\n\n const onWheel = (event: React.WheelEvent<HTMLDivElement>) => {\n const { deltaY } = event;\n\n if (contentRef.current) {\n contentRef.current.scrollLeft += Math.round(deltaY);\n }\n };\n\n const getRef = (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 <StyledComboboxTarget\n ref={ref}\n opened={opened}\n readOnly={readOnly}\n disabled={disabled}\n title={textContent}\n aria-label={label}\n className={cx(withInnerLabelUp, withHasChips)}\n onWheel={onWheel}\n onKeyDown={onKeyDown}\n {...rest}\n >\n <StyledContent tabIndex={-1} ref={contentRef} className={withHasChips}>\n {isEnumerationVisible &&\n (isEnumerationComma ? (\n <StyledText className={comboboxTargeText} onClick={onClickText}>\n {textContent}\n </StyledText>\n ) : (\n <StyledChips>\n {values?.map(([value, text], index) => (\n <ComboboxChip\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 ))}\n <StyledComboboxInput\n ref={inputRef}\n role=\"textbox\"\n className={comboboxTargetInput}\n value={search}\n placeholder={placeholderValue}\n disabled={disabled}\n readOnly={readOnly}\n onFocus={onFocusInput}\n onBlur={onBlurInput}\n onChange={onChangeInput}\n onKeyDown={onKeyDownInput}\n />\n {valueType === 'multiple' && (\n <StyledComboboxInputHelper ref={inputHelperRef}>{search}</StyledComboboxInputHelper>\n )}\n </StyledContent>\n {isLabelVisible && (\n <StyledLabel className={comboboxTargetLabel} htmlFor={id}>\n {label}\n </StyledLabel>\n )}\n <StyledArrow size=\"s\" className={cx(comboboxTargetArrow, withArrowInverse)} />\n </StyledComboboxTarget>\n );\n },\n);\n"],"names":["hasChips","classes","innerLabelUp","arrowInverse","comboboxTargetArrow","comboboxTargeText","comboboxTargetInput","comboboxTargetLabel","ComboboxTarget","forwardRef","_ref","ref","values","search","label","placeholder","opened","readOnly","disabled","enumerationType","valueType","size","closedWithoutChanges","id","chipsRefs","inputRef","onChange","onSearch","onKeyDown","rest","_objectWithoutProperties","_excluded","contentRef","useRef","inputHelperRef","_useState","useState","_useState2","_slicedToArray","focused","setFocused","controlledRefs","textContent","map","_ref2","_ref3","text","join","hasValue","some","_ref4","_ref5","value","isEnumerationComma","isExtraSmall","isInputNotEmpty","isInputActive","hasLabel","hasOnlyLabel","hasNoAnyTip","placeholderValue","undefined","withInnerLabelUp","withArrowInverse","withHasChips","isLabelVisible","isEnumerationVisible","onChipClick","event","stopPropagation","_useFocusController","useFocusController","updateFocused","updateSearch","onClickText","onFocusInput","onBlurInput","onChipClear","index","newValue","filter","_ref6","_ref7","itemValue","itemText","_ref8","_ref9","current","splice","onChipKeyDown","code","Keys","Tab","preventDefault","Backspace","onKeyDownInput","_event$currentTarget","currentTarget","length","_ref10","_ref11","pop","onChangeInput","onWheel","deltaY","scrollLeft","Math","round","getRef","element","React","createElement","StyledComboboxTarget","_extends","title","className","cx","StyledContent","tabIndex","StyledText","onClick","StyledChips","_ref12","_ref13","ComboboxChip","key","concat","onClear","v","t","StyledComboboxInput","role","onFocus","onBlur","StyledComboboxInputHelper","StyledLabel","htmlFor","StyledArrow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AAEzD,YAAa;AACtB0D,IAAAA,MAAM,EAAEzD,WAAY;AACpBlD,IAAAA,QAAQ,EAAE4E,aAAc;AACxB1E,IAAAA,SAAS,EAAEmE,cAAAA;GACd,CAAC,EACD3E,SAAS,KAAK,UAAU,iBACrB0F,KAAA,CAAAC,aAAA,CAACuB,yBAAyB,EAAA;AAAC3H,IAAAA,GAAG,EAAEuB,cAAAA;GAAiBrB,EAAAA,MAAkC,CAE5E,CAAC,EACfoD,cAAc,iBACX6C,KAAA,CAAAC,aAAA,CAACwB,WAAW,EAAA;AAACpB,IAAAA,SAAS,EAAE5G,mBAAoB;AAACiI,IAAAA,OAAO,EAAEjH,EAAAA;AAAG,GAAA,EACpDT,KACQ,CAChB,eACDgG,KAAA,CAAAC,aAAA,CAAC0B,WAAW,EAAA;AAACpH,IAAAA,IAAI,EAAC,GAAG;AAAC8F,IAAAA,SAAS,EAAEC,EAAE,CAAChH,mBAAmB,EAAE2D,gBAAgB,CAAA;AAAE,GAAE,CAC3D,CAAC,CAAA;AAE/B,CACJ;;;;"}
|
@@ -4,7 +4,7 @@
|
|
4
4
|
var getDrawers = function getDrawers(items) {
|
5
5
|
return items.filter(function (item) {
|
6
6
|
var _item$info;
|
7
|
-
return item === null || item === void 0
|
7
|
+
return item === null || item === void 0 || (_item$info = item.info) === null || _item$info === void 0 ? void 0 : _item$info.isDrawer;
|
8
8
|
});
|
9
9
|
};
|
10
10
|
var hasDrawers = function hasDrawers(items) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DrawerContext.js","sources":["../../../src/components/Drawer/DrawerContext.tsx"],"sourcesContent":["import { PopupInfo } from '../Popup/Popup.types';\n\nexport interface DrawerInfo extends PopupInfo {\n id: string;\n info?: {\n isDrawer?: true;\n };\n}\n\n/**\n * Взаимодействие с Drawer оконами.\n */\nconst getDrawers = (items: DrawerInfo[]): DrawerInfo[] => {\n return items.filter((item: DrawerInfo) => item?.info?.isDrawer);\n};\n\nexport const hasDrawers = (items: DrawerInfo[]): boolean => {\n return getDrawers(items).length > 0;\n};\n\nexport const getIdLastDrawer = (items: DrawerInfo[]): string | undefined => {\n const drawers = getDrawers(items);\n if (!drawers.length) {\n return;\n }\n return drawers[drawers.length - 1].id;\n};\n\nexport const getIdFirstDrawer = (items: DrawerInfo[]): string | undefined => {\n const drawers = getDrawers(items);\n if (!drawers.length) {\n return;\n }\n return drawers[0].id;\n};\n"],"names":["getDrawers","items","filter","item","_item$info","info","isDrawer","hasDrawers","length","getIdLastDrawer","drawers","id"],"mappings":"AASA;AACA;AACA;AACA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,KAAmB,EAAmB;AACtD,EAAA,OAAOA,KAAK,CAACC,MAAM,CAAC,UAACC,IAAgB,EAAA;AAAA,IAAA,IAAAC,UAAA,CAAA;AAAA,IAAA,OAAKD,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,KAAA,CAAA,
|
1
|
+
{"version":3,"file":"DrawerContext.js","sources":["../../../src/components/Drawer/DrawerContext.tsx"],"sourcesContent":["import { PopupInfo } from '../Popup/Popup.types';\n\nexport interface DrawerInfo extends PopupInfo {\n id: string;\n info?: {\n isDrawer?: true;\n };\n}\n\n/**\n * Взаимодействие с Drawer оконами.\n */\nconst getDrawers = (items: DrawerInfo[]): DrawerInfo[] => {\n return items.filter((item: DrawerInfo) => item?.info?.isDrawer);\n};\n\nexport const hasDrawers = (items: DrawerInfo[]): boolean => {\n return getDrawers(items).length > 0;\n};\n\nexport const getIdLastDrawer = (items: DrawerInfo[]): string | undefined => {\n const drawers = getDrawers(items);\n if (!drawers.length) {\n return;\n }\n return drawers[drawers.length - 1].id;\n};\n\nexport const getIdFirstDrawer = (items: DrawerInfo[]): string | undefined => {\n const drawers = getDrawers(items);\n if (!drawers.length) {\n return;\n }\n return drawers[0].id;\n};\n"],"names":["getDrawers","items","filter","item","_item$info","info","isDrawer","hasDrawers","length","getIdLastDrawer","drawers","id"],"mappings":"AASA;AACA;AACA;AACA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,KAAmB,EAAmB;AACtD,EAAA,OAAOA,KAAK,CAACC,MAAM,CAAC,UAACC,IAAgB,EAAA;AAAA,IAAA,IAAAC,UAAA,CAAA;AAAA,IAAA,OAAKD,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,KAAA,CAAA,IAAA,CAAAC,UAAA,GAAJD,IAAI,CAAEE,IAAI,MAAAD,IAAAA,IAAAA,UAAA,KAAVA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,UAAA,CAAYE,QAAQ,CAAA;GAAC,CAAA,CAAA;AACnE,CAAC,CAAA;IAEYC,UAAU,GAAG,SAAbA,UAAUA,CAAIN,KAAmB,EAAc;AACxD,EAAA,OAAOD,UAAU,CAACC,KAAK,CAAC,CAACO,MAAM,GAAG,CAAC,CAAA;AACvC,EAAC;IAEYC,eAAe,GAAG,SAAlBA,eAAeA,CAAIR,KAAmB,EAAyB;AACxE,EAAA,IAAMS,OAAO,GAAGV,UAAU,CAACC,KAAK,CAAC,CAAA;AACjC,EAAA,IAAI,CAACS,OAAO,CAACF,MAAM,EAAE;AACjB,IAAA,OAAA;AACJ,GAAA;EACA,OAAOE,OAAO,CAACA,OAAO,CAACF,MAAM,GAAG,CAAC,CAAC,CAACG,EAAE,CAAA;AACzC;;;;"}
|
@@ -40,7 +40,7 @@ var dropdownItemRoot = function dropdownItemRoot(Root) {
|
|
40
40
|
if (disabled) {
|
41
41
|
return;
|
42
42
|
}
|
43
|
-
onClick === null || onClick === void 0
|
43
|
+
onClick === null || onClick === void 0 || onClick(event);
|
44
44
|
if (onSelect && !ContentLeftComponent) {
|
45
45
|
onSelect(value, text);
|
46
46
|
}
|
@@ -49,7 +49,7 @@ var dropdownItemRoot = function dropdownItemRoot(Root) {
|
|
49
49
|
if (disabled) {
|
50
50
|
return;
|
51
51
|
}
|
52
|
-
onChange === null || onChange === void 0
|
52
|
+
onChange === null || onChange === void 0 || onChange(event);
|
53
53
|
if (onSelect && ContentLeftComponent) {
|
54
54
|
onSelect(value, text);
|
55
55
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DropdownItem.js","sources":["../../../../../src/components/Dropdown/ui/DropdownItem/DropdownItem.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from 'react';\nimport { safeUseId } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../../../engines';\nimport { classes } from '../../Dropdown.tokens';\nimport { cx } from '../../../../utils';\nimport { getValidComponent } from '../../utils';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { StyledContentLeft, StyledContentRight, StyledText, base } from './DropdownItem.styles';\nimport type { DropdownItemProps } from './DropdownItem.type';\n\n/**\n * Элемент выпадающего списка\n */\nexport const dropdownItemRoot = (Root: RootProps<HTMLDivElement, DropdownItemProps>) =>\n forwardRef<HTMLDivElement, DropdownItemProps>(\n (\n {\n id,\n className,\n children,\n text,\n isSelected,\n name,\n checked,\n value,\n role,\n view,\n size,\n disabled,\n contentLeft: ContentLeftComponent,\n contentRight: ContentRightComponent,\n onSelect,\n onClick,\n onChange,\n ...rest\n },\n outerRootRef,\n ) => {\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n\n const withDropdownItemIsSelected = checked || isSelected ? classes.dropdownItemIsSelected : undefined;\n const withDropdownItemIsDisabled = disabled ? classes.dropdownItemIsDisabled : undefined;\n\n const handleOnClick = useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n if (disabled) {\n return;\n }\n\n onClick?.(event);\n\n if (onSelect && !ContentLeftComponent) {\n onSelect(value, text);\n }\n },\n [onSelect, disabled],\n );\n\n const handleOnChange = useCallback(\n (event: React.MouseEvent<HTMLInputElement>) => {\n if (disabled) {\n return;\n }\n\n onChange?.(event);\n\n if (onSelect && ContentLeftComponent) {\n onSelect(value, text);\n }\n },\n [onSelect, disabled],\n );\n\n const contentProps = {\n name,\n value,\n checked: checked || isSelected,\n disabled,\n tabIndex: 0,\n ...(!disabled && { onChange: handleOnChange }),\n };\n\n const ContentLeft = useMemo(() => getValidComponent(ContentLeftComponent, contentProps), [\n ContentRightComponent,\n contentProps,\n ]);\n\n const ContentRight = useMemo(() => getValidComponent(ContentRightComponent, contentProps), [\n ContentRightComponent,\n contentProps,\n ]);\n\n return (\n <Root\n className={cx(withDropdownItemIsSelected, withDropdownItemIsDisabled, className)}\n view={view}\n size={size}\n id={innerId}\n isSelected={isSelected}\n role={role}\n ref={outerRootRef}\n tabIndex={0}\n aria-disabled={disabled}\n onClick={handleOnClick}\n data-value={value}\n {...rest}\n >\n {text ? (\n <>\n <StyledContentLeft>{ContentLeftComponent && ContentLeft}</StyledContentLeft>\n <StyledText>{text}</StyledText>\n <StyledContentRight>{ContentRightComponent && ContentRight}</StyledContentRight>\n </>\n ) : (\n children\n )}\n </Root>\n );\n },\n );\n\nexport const dropdownItemConfig = {\n name: 'DropdownItem',\n tag: 'div',\n layout: dropdownItemRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["dropdownItemRoot","Root","forwardRef","_ref","outerRootRef","id","className","children","text","isSelected","name","checked","value","role","view","size","disabled","ContentLeftComponent","contentLeft","ContentRightComponent","contentRight","onSelect","onClick","onChange","rest","_objectWithoutProperties","_excluded","uniqId","safeUseId","innerId","withDropdownItemIsSelected","classes","dropdownItemIsSelected","undefined","withDropdownItemIsDisabled","dropdownItemIsDisabled","handleOnClick","useCallback","event","handleOnChange","contentProps","_objectSpread","tabIndex","ContentLeft","useMemo","getValidComponent","ContentRight","React","createElement","_extends","cx","ref","Fragment","StyledContentLeft","StyledText","StyledContentRight","dropdownItemConfig","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;AAaA;AACA;AACA;IACaA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,IAAkD,EAAA;AAAA,EAAA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,OAAA;AAEAM,MAAAA,OAAO,aAAPA,OAAO,KAAA,KAAA,CAAA,
|
1
|
+
{"version":3,"file":"DropdownItem.js","sources":["../../../../../src/components/Dropdown/ui/DropdownItem/DropdownItem.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from 'react';\nimport { safeUseId } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../../../engines';\nimport { classes } from '../../Dropdown.tokens';\nimport { cx } from '../../../../utils';\nimport { getValidComponent } from '../../utils';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { StyledContentLeft, StyledContentRight, StyledText, base } from './DropdownItem.styles';\nimport type { DropdownItemProps } from './DropdownItem.type';\n\n/**\n * Элемент выпадающего списка\n */\nexport const dropdownItemRoot = (Root: RootProps<HTMLDivElement, DropdownItemProps>) =>\n forwardRef<HTMLDivElement, DropdownItemProps>(\n (\n {\n id,\n className,\n children,\n text,\n isSelected,\n name,\n checked,\n value,\n role,\n view,\n size,\n disabled,\n contentLeft: ContentLeftComponent,\n contentRight: ContentRightComponent,\n onSelect,\n onClick,\n onChange,\n ...rest\n },\n outerRootRef,\n ) => {\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n\n const withDropdownItemIsSelected = checked || isSelected ? classes.dropdownItemIsSelected : undefined;\n const withDropdownItemIsDisabled = disabled ? classes.dropdownItemIsDisabled : undefined;\n\n const handleOnClick = useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n if (disabled) {\n return;\n }\n\n onClick?.(event);\n\n if (onSelect && !ContentLeftComponent) {\n onSelect(value, text);\n }\n },\n [onSelect, disabled],\n );\n\n const handleOnChange = useCallback(\n (event: React.MouseEvent<HTMLInputElement>) => {\n if (disabled) {\n return;\n }\n\n onChange?.(event);\n\n if (onSelect && ContentLeftComponent) {\n onSelect(value, text);\n }\n },\n [onSelect, disabled],\n );\n\n const contentProps = {\n name,\n value,\n checked: checked || isSelected,\n disabled,\n tabIndex: 0,\n ...(!disabled && { onChange: handleOnChange }),\n };\n\n const ContentLeft = useMemo(() => getValidComponent(ContentLeftComponent, contentProps), [\n ContentRightComponent,\n contentProps,\n ]);\n\n const ContentRight = useMemo(() => getValidComponent(ContentRightComponent, contentProps), [\n ContentRightComponent,\n contentProps,\n ]);\n\n return (\n <Root\n className={cx(withDropdownItemIsSelected, withDropdownItemIsDisabled, className)}\n view={view}\n size={size}\n id={innerId}\n isSelected={isSelected}\n role={role}\n ref={outerRootRef}\n tabIndex={0}\n aria-disabled={disabled}\n onClick={handleOnClick}\n data-value={value}\n {...rest}\n >\n {text ? (\n <>\n <StyledContentLeft>{ContentLeftComponent && ContentLeft}</StyledContentLeft>\n <StyledText>{text}</StyledText>\n <StyledContentRight>{ContentRightComponent && ContentRight}</StyledContentRight>\n </>\n ) : (\n children\n )}\n </Root>\n );\n },\n );\n\nexport const dropdownItemConfig = {\n name: 'DropdownItem',\n tag: 'div',\n layout: dropdownItemRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["dropdownItemRoot","Root","forwardRef","_ref","outerRootRef","id","className","children","text","isSelected","name","checked","value","role","view","size","disabled","ContentLeftComponent","contentLeft","ContentRightComponent","contentRight","onSelect","onClick","onChange","rest","_objectWithoutProperties","_excluded","uniqId","safeUseId","innerId","withDropdownItemIsSelected","classes","dropdownItemIsSelected","undefined","withDropdownItemIsDisabled","dropdownItemIsDisabled","handleOnClick","useCallback","event","handleOnChange","contentProps","_objectSpread","tabIndex","ContentLeft","useMemo","getValidComponent","ContentRight","React","createElement","_extends","cx","ref","Fragment","StyledContentLeft","StyledText","StyledContentRight","dropdownItemConfig","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;AAaA;AACA;AACA;IACaA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,IAAkD,EAAA;AAAA,EAAA,oBAC/EC,UAA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MAAAA,GAAG,EAAEC,MAAAA;KACR;AACD/C,IAAAA,IAAI,EAAE;AACF8C,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNlD,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
@@ -4,7 +4,7 @@
|
|
4
4
|
var getModals = function getModals(items) {
|
5
5
|
return items.filter(function (item) {
|
6
6
|
var _item$info;
|
7
|
-
return item === null || item === void 0
|
7
|
+
return item === null || item === void 0 || (_item$info = item.info) === null || _item$info === void 0 ? void 0 : _item$info.isModal;
|
8
8
|
});
|
9
9
|
};
|
10
10
|
var hasModals = function hasModals(items) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ModalContext.js","sources":["../../../src/components/Modal/ModalContext.tsx"],"sourcesContent":["import { PopupInfo } from '../Popup/Popup.types';\n\nexport interface ModalInfo extends PopupInfo {\n id: string;\n info?: {\n isModal?: true;\n };\n}\n\n/**\n * Взаимодействие с модальными оконами.\n */\nconst getModals = (items: ModalInfo[]) => {\n return items.filter((item: ModalInfo) => item?.info?.isModal);\n};\n\nexport const hasModals = (items: ModalInfo[]) => {\n return getModals(items).length > 0;\n};\n\nexport const getIdLastModal = (items: ModalInfo[]) => {\n const modals = getModals(items);\n if (!modals.length) {\n return;\n }\n return modals[modals.length - 1].id;\n};\n\nexport const getIdFirstModal = (items: ModalInfo[]) => {\n const modals = getModals(items);\n if (!modals.length) {\n return;\n }\n return modals[0].id;\n};\n"],"names":["getModals","items","filter","item","_item$info","info","isModal","hasModals","length","getIdLastModal","modals","id"],"mappings":"AASA;AACA;AACA;AACA,IAAMA,SAAS,GAAG,SAAZA,SAASA,CAAIC,KAAkB,EAAK;AACtC,EAAA,OAAOA,KAAK,CAACC,MAAM,CAAC,UAACC,IAAe,EAAA;AAAA,IAAA,IAAAC,UAAA,CAAA;AAAA,IAAA,OAAKD,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,KAAA,CAAA,
|
1
|
+
{"version":3,"file":"ModalContext.js","sources":["../../../src/components/Modal/ModalContext.tsx"],"sourcesContent":["import { PopupInfo } from '../Popup/Popup.types';\n\nexport interface ModalInfo extends PopupInfo {\n id: string;\n info?: {\n isModal?: true;\n };\n}\n\n/**\n * Взаимодействие с модальными оконами.\n */\nconst getModals = (items: ModalInfo[]) => {\n return items.filter((item: ModalInfo) => item?.info?.isModal);\n};\n\nexport const hasModals = (items: ModalInfo[]) => {\n return getModals(items).length > 0;\n};\n\nexport const getIdLastModal = (items: ModalInfo[]) => {\n const modals = getModals(items);\n if (!modals.length) {\n return;\n }\n return modals[modals.length - 1].id;\n};\n\nexport const getIdFirstModal = (items: ModalInfo[]) => {\n const modals = getModals(items);\n if (!modals.length) {\n return;\n }\n return modals[0].id;\n};\n"],"names":["getModals","items","filter","item","_item$info","info","isModal","hasModals","length","getIdLastModal","modals","id"],"mappings":"AASA;AACA;AACA;AACA,IAAMA,SAAS,GAAG,SAAZA,SAASA,CAAIC,KAAkB,EAAK;AACtC,EAAA,OAAOA,KAAK,CAACC,MAAM,CAAC,UAACC,IAAe,EAAA;AAAA,IAAA,IAAAC,UAAA,CAAA;AAAA,IAAA,OAAKD,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,KAAA,CAAA,IAAA,CAAAC,UAAA,GAAJD,IAAI,CAAEE,IAAI,MAAAD,IAAAA,IAAAA,UAAA,KAAVA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,UAAA,CAAYE,OAAO,CAAA;GAAC,CAAA,CAAA;AACjE,CAAC,CAAA;IAEYC,SAAS,GAAG,SAAZA,SAASA,CAAIN,KAAkB,EAAK;AAC7C,EAAA,OAAOD,SAAS,CAACC,KAAK,CAAC,CAACO,MAAM,GAAG,CAAC,CAAA;AACtC,EAAC;IAEYC,cAAc,GAAG,SAAjBA,cAAcA,CAAIR,KAAkB,EAAK;AAClD,EAAA,IAAMS,MAAM,GAAGV,SAAS,CAACC,KAAK,CAAC,CAAA;AAC/B,EAAA,IAAI,CAACS,MAAM,CAACF,MAAM,EAAE;AAChB,IAAA,OAAA;AACJ,GAAA;EACA,OAAOE,MAAM,CAACA,MAAM,CAACF,MAAM,GAAG,CAAC,CAAC,CAACG,EAAE,CAAA;AACvC;;;;"}
|
@@ -21,7 +21,7 @@ var Overlay = function Overlay(_ref) {
|
|
21
21
|
if (!isClickable) {
|
22
22
|
return;
|
23
23
|
}
|
24
|
-
onOverlayClick === null || onOverlayClick === void 0
|
24
|
+
onOverlayClick === null || onOverlayClick === void 0 || onOverlayClick(event);
|
25
25
|
}, [isClickable, onOverlayClick]);
|
26
26
|
return /*#__PURE__*/React.createElement(StyledOverlay, _extends({
|
27
27
|
className: className,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Overlay.js","sources":["../../../src/components/Overlay/Overlay.tsx"],"sourcesContent":["import React, { useCallback } from 'react';\nimport type { FC, MouseEvent } from 'react';\n\nimport type { OverlayProps } from './Overlay.types';\nimport { StyledOverlay } from './Overlay.styles';\n\n/**\n * Overlay - подложка для всплывающих компонент (Modal, Toast и т.д.).\n */\nexport const Overlay: FC<OverlayProps> = ({\n withBlur,\n className,\n backgroundColorProperty,\n onOverlayClick,\n zIndex,\n transparent,\n isClickable = true,\n ...rest\n}) => {\n const handleOverlayClick = useCallback(\n (event: MouseEvent<HTMLDivElement>) => {\n if (!isClickable) {\n return;\n }\n\n onOverlayClick?.(event);\n },\n [isClickable, onOverlayClick],\n );\n\n return (\n <StyledOverlay\n className={className}\n backgroundColorToken={backgroundColorProperty}\n transparent={transparent}\n clickable={isClickable}\n onClick={handleOverlayClick}\n zIndex={zIndex}\n withBlur={withBlur}\n {...rest}\n />\n );\n};\n"],"names":["Overlay","_ref","withBlur","className","backgroundColorProperty","onOverlayClick","zIndex","transparent","_ref$isClickable","isClickable","rest","_objectWithoutProperties","_excluded","handleOverlayClick","useCallback","event","React","createElement","StyledOverlay","_extends","backgroundColorToken","clickable","onClick"],"mappings":";;;;;;AAMA;AACA;AACA;IACaA,OAAyB,GAAG,SAA5BA,OAAyBA,CAAAC,IAAA,EAShC;AAAA,EAAA,IARFC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,uBAAuB,GAAAH,IAAA,CAAvBG,uBAAuB;IACvBC,cAAc,GAAAJ,IAAA,CAAdI,cAAc;IACdC,MAAM,GAAAL,IAAA,CAANK,MAAM;IACNC,WAAW,GAAAN,IAAA,CAAXM,WAAW;IAAAC,gBAAA,GAAAP,IAAA,CACXQ,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,gBAAA;AACfE,IAAAA,IAAI,GAAAC,wBAAA,CAAAV,IAAA,EAAAW,SAAA,CAAA,CAAA;AAEP,EAAA,IAAMC,kBAAkB,GAAGC,WAAW,CAClC,UAACC,KAAiC,EAAK;IACnC,IAAI,CAACN,WAAW,EAAE;AACd,MAAA,OAAA;AACJ,KAAA;AAEAJ,IAAAA,cAAc,aAAdA,cAAc,KAAA,KAAA,CAAA,
|
1
|
+
{"version":3,"file":"Overlay.js","sources":["../../../src/components/Overlay/Overlay.tsx"],"sourcesContent":["import React, { useCallback } from 'react';\nimport type { FC, MouseEvent } from 'react';\n\nimport type { OverlayProps } from './Overlay.types';\nimport { StyledOverlay } from './Overlay.styles';\n\n/**\n * Overlay - подложка для всплывающих компонент (Modal, Toast и т.д.).\n */\nexport const Overlay: FC<OverlayProps> = ({\n withBlur,\n className,\n backgroundColorProperty,\n onOverlayClick,\n zIndex,\n transparent,\n isClickable = true,\n ...rest\n}) => {\n const handleOverlayClick = useCallback(\n (event: MouseEvent<HTMLDivElement>) => {\n if (!isClickable) {\n return;\n }\n\n onOverlayClick?.(event);\n },\n [isClickable, onOverlayClick],\n );\n\n return (\n <StyledOverlay\n className={className}\n backgroundColorToken={backgroundColorProperty}\n transparent={transparent}\n clickable={isClickable}\n onClick={handleOverlayClick}\n zIndex={zIndex}\n withBlur={withBlur}\n {...rest}\n />\n );\n};\n"],"names":["Overlay","_ref","withBlur","className","backgroundColorProperty","onOverlayClick","zIndex","transparent","_ref$isClickable","isClickable","rest","_objectWithoutProperties","_excluded","handleOverlayClick","useCallback","event","React","createElement","StyledOverlay","_extends","backgroundColorToken","clickable","onClick"],"mappings":";;;;;;AAMA;AACA;AACA;IACaA,OAAyB,GAAG,SAA5BA,OAAyBA,CAAAC,IAAA,EAShC;AAAA,EAAA,IARFC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,uBAAuB,GAAAH,IAAA,CAAvBG,uBAAuB;IACvBC,cAAc,GAAAJ,IAAA,CAAdI,cAAc;IACdC,MAAM,GAAAL,IAAA,CAANK,MAAM;IACNC,WAAW,GAAAN,IAAA,CAAXM,WAAW;IAAAC,gBAAA,GAAAP,IAAA,CACXQ,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,gBAAA;AACfE,IAAAA,IAAI,GAAAC,wBAAA,CAAAV,IAAA,EAAAW,SAAA,CAAA,CAAA;AAEP,EAAA,IAAMC,kBAAkB,GAAGC,WAAW,CAClC,UAACC,KAAiC,EAAK;IACnC,IAAI,CAACN,WAAW,EAAE;AACd,MAAA,OAAA;AACJ,KAAA;AAEAJ,IAAAA,cAAc,aAAdA,cAAc,KAAA,KAAA,CAAA,IAAdA,cAAc,CAAGU,KAAK,CAAC,CAAA;AAC3B,GAAC,EACD,CAACN,WAAW,EAAEJ,cAAc,CAChC,CAAC,CAAA;AAED,EAAA,oBACIW,KAAA,CAAAC,aAAA,CAACC,aAAa,EAAAC,QAAA,CAAA;AACVhB,IAAAA,SAAS,EAAEA,SAAU;AACrBiB,IAAAA,oBAAoB,EAAEhB,uBAAwB;AAC9CG,IAAAA,WAAW,EAAEA,WAAY;AACzBc,IAAAA,SAAS,EAAEZ,WAAY;AACvBa,IAAAA,OAAO,EAAET,kBAAmB;AAC5BP,IAAAA,MAAM,EAAEA,MAAO;AACfJ,IAAAA,QAAQ,EAAEA,QAAAA;GACNQ,EAAAA,IAAI,CACX,CAAC,CAAA;AAEV;;;;"}
|
@@ -90,12 +90,12 @@ var paginationRoot = function paginationRoot(Root) {
|
|
90
90
|
return;
|
91
91
|
}
|
92
92
|
setPageValue(pageValue);
|
93
|
-
onChangePageValue === null || onChangePageValue === void 0
|
93
|
+
onChangePageValue === null || onChangePageValue === void 0 || onChangePageValue(pageValue);
|
94
94
|
};
|
95
95
|
var handlerSetPerPage = function handlerSetPerPage(newPerPageValue) {
|
96
96
|
handlerSetPage(1);
|
97
97
|
setPerPageValue(newPerPageValue);
|
98
|
-
onChangePerPageValue === null || onChangePerPageValue === void 0
|
98
|
+
onChangePerPageValue === null || onChangePerPageValue === void 0 || onChangePerPageValue(newPerPageValue);
|
99
99
|
handlerSetPages(newPerPageValue);
|
100
100
|
};
|
101
101
|
var isActiveButton = function isActiveButton(checkPage) {
|