@salutejs/plasma-new-hope 0.76.2-canary.1183.8704434655.0 → 0.76.2-canary.1184.8705168480.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 +10 -10
- 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/Button/Button.stories.tsx +11 -27
- 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/Button/Button.stories.tsx +11 -27
- 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":"Pagination.js","sources":["../../../src/components/Pagination/Pagination.tsx"],"sourcesContent":["import React, { useEffect, useState, forwardRef } from 'react';\n\nimport { cx, isNumber } from '../../utils';\nimport { RootProps } from '../../engines';\n\nimport {\n PaginationPages,\n PaginationActions,\n PaginationButton,\n PaginationSection,\n PaginationButtonGroup,\n PaginationRoot,\n PaginationShorter,\n} from './Pagination.styles';\nimport type { PaginationProps } from './Pagination.types';\nimport { getSections, defaultValues } from './utils';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as typeCSS } from './variations/_type/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { classes } from './Pagination.tokens';\nimport { PaginationQuickJumpToPage } from './ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage';\nimport { PaginationSelectPerPage } from './ui/PaginationSelectPerPage/PaginationSelectPerPage';\n\nexport const paginationRoot = (Root: RootProps<HTMLDivElement, PaginationProps>) =>\n forwardRef<HTMLDivElement, PaginationProps>(\n (\n {\n value = defaultValues.value,\n perPage,\n slots = defaultValues.slots,\n\n view,\n viewCurrentPage,\n type = defaultValues.type,\n size,\n pilled = defaultValues.pilled,\n square = defaultValues.square,\n disabledPages = defaultValues.disabledPages,\n\n count = defaultValues.value,\n\n hasQuickJump = defaultValues.hasQuickJump,\n hasPerPage = defaultValues.hasPerPage,\n perPageList = defaultValues.perPageList,\n isCommonButtonStyles = defaultValues.isCommonButtonStyles,\n\n placeholderQuickJump = defaultValues.placeholderQuickJump,\n textQuickJump = defaultValues.textQuickJump,\n textPerPage = defaultValues.textPerPage,\n\n leftContent,\n rightContent,\n\n onChangePageValue,\n onChangePerPageValue,\n ...rest\n },\n ref,\n ) => {\n const [page, setPageValue] = useState<number>(1);\n const [perPageValue, setPerPageValue] = useState(perPage);\n const [pages, setPagesValue] = useState<number>(value);\n const [sections, setSections] = useState<number[][] | null>(null);\n\n const typeClass = classes[`${type}Type` as keyof typeof classes];\n const roundedClass = pilled ? 'circle-circle' : 'square-square';\n\n const withHasPerPageSelect = hasPerPage ? classes.withHasPerPageSelect : undefined;\n const withHasQuickJump = hasQuickJump ? classes.withHasQuickJump : undefined;\n\n const disabled = disabledPages.map((el) => (isNumber(el) ? Number(el) : null));\n\n const handlerSetPages = (newPerPage?: number) => {\n setPagesValue(Math.ceil(count / (newPerPage || (hasPerPage ? defaultValues.perPage : 1))));\n };\n\n const handlerSetPage = (newPageValue?: number) => {\n let pageValue = newPageValue ?? defaultValues.value;\n if (pageValue > pages) {\n pageValue = pages;\n }\n if (pageValue < 1) {\n pageValue = 1;\n }\n if (disabled.includes(pageValue)) {\n return;\n }\n setPageValue(pageValue);\n onChangePageValue?.(pageValue);\n };\n\n const handlerSetPerPage = (newPerPageValue?: number) => {\n handlerSetPage(1);\n setPerPageValue(newPerPageValue);\n onChangePerPageValue?.(newPerPageValue);\n\n handlerSetPages(newPerPageValue);\n };\n\n const isActiveButton = (checkPage: number) => {\n return page === checkPage ? classes.paginationPageButtonActive : '';\n };\n\n useEffect(() => {\n handlerSetPages(perPage);\n }, [perPage, count, handlerSetPages]);\n\n useEffect(() => {\n handlerSetPage(value);\n }, [value]);\n\n useEffect(() => {\n setSections(getSections(page, pages, slots));\n }, [page, slots, pages, setSections, getSections]);\n\n return (\n <Root\n size={size}\n view={view}\n viewCurrentPage={viewCurrentPage}\n className={cx(classes.wrapper, typeClass)}\n ref={ref}\n {...rest}\n >\n <PaginationRoot className={typeClass}>\n <PaginationPages>\n {leftContent && (\n <PaginationButtonGroup isCommonButtonStyles={isCommonButtonStyles}>\n {leftContent}\n </PaginationButtonGroup>\n )}\n {sections &&\n sections.map((section, indexSection) => (\n <>\n {indexSection !== 0 && (\n <PaginationShorter stretching=\"fixed\" disabled>\n ...\n </PaginationShorter>\n )}\n <PaginationSection key={indexSection}>\n {section.map((pageValue) => (\n <PaginationButton\n square={square}\n pin={roundedClass}\n key={pageValue}\n onClick={() => handlerSetPage(pageValue)}\n disabled={disabled.includes(pageValue)}\n className={cx(\n classes.paginationPageButton,\n isActiveButton(pageValue),\n )}\n >\n {pageValue}\n </PaginationButton>\n ))}\n </PaginationSection>\n </>\n ))}\n {rightContent && (\n <PaginationButtonGroup isCommonButtonStyles={isCommonButtonStyles}>\n {rightContent}\n </PaginationButtonGroup>\n )}\n </PaginationPages>\n <PaginationActions\n className={cx(classes.actions, typeClass, withHasPerPageSelect, withHasQuickJump)}\n >\n {hasQuickJump && (\n <PaginationQuickJumpToPage\n placeholderQuickJump={placeholderQuickJump}\n textQuickJump={textQuickJump}\n onChangeValue={handlerSetPage}\n />\n )}\n {hasPerPage && (\n <PaginationSelectPerPage\n textPerPage={textPerPage}\n value={perPageValue}\n valuesList={perPageList}\n onChangeValue={handlerSetPerPage}\n />\n )}\n </PaginationActions>\n </PaginationRoot>\n </Root>\n );\n },\n );\n\nexport const paginationConfig = {\n name: 'Pagination',\n tag: 'div',\n layout: paginationRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n type: {\n css: typeCSS,\n },\n },\n defaults: {\n view: 'clear',\n size: 'm',\n },\n};\n"],"names":["paginationRoot","Root","forwardRef","_ref","ref","_ref$value","value","defaultValues","perPage","_ref$slots","slots","view","viewCurrentPage","_ref$type","type","size","_ref$pilled","pilled","_ref$square","square","_ref$disabledPages","disabledPages","_ref$count","count","_ref$hasQuickJump","hasQuickJump","_ref$hasPerPage","hasPerPage","_ref$perPageList","perPageList","_ref$isCommonButtonSt","isCommonButtonStyles","_ref$placeholderQuick","placeholderQuickJump","_ref$textQuickJump","textQuickJump","_ref$textPerPage","textPerPage","leftContent","rightContent","onChangePageValue","onChangePerPageValue","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","page","setPageValue","_useState3","_useState4","perPageValue","setPerPageValue","_useState5","_useState6","pages","setPagesValue","_useState7","_useState8","sections","setSections","typeClass","classes","concat","roundedClass","withHasPerPageSelect","undefined","withHasQuickJump","disabled","map","el","isNumber","Number","handlerSetPages","newPerPage","Math","ceil","handlerSetPage","newPageValue","pageValue","includes","handlerSetPerPage","newPerPageValue","isActiveButton","checkPage","paginationPageButtonActive","useEffect","getSections","React","createElement","_extends","className","cx","wrapper","PaginationRoot","PaginationPages","PaginationButtonGroup","section","indexSection","Fragment","_PaginationShorter","PaginationShorter","stretching","PaginationSection","key","PaginationButton","pin","onClick","paginationPageButton","PaginationActions","actions","PaginationQuickJumpToPage","onChangeValue","PaginationSelectPerPage","valuesList","paginationConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","typeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;IAuBaA,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,IAAgD,EAAA;AAAA,EAAA,oBAC3EC,UAAU,CACN,UAAAC,IAAA,EAgCIC,GAAG,EACF;AAAA,IAAA,IAAAC,UAAA,GAAAF,IAAA,CA/BGG,KAAK;AAALA,MAAAA,KAAK,GAAAD,UAAA,KAAA,KAAA,CAAA,GAAGE,aAAa,CAACD,KAAK,GAAAD,UAAA;MAC3BG,OAAO,GAAAL,IAAA,CAAPK,OAAO;MAAAC,UAAA,GAAAN,IAAA,CACPO,KAAK;AAALA,MAAAA,KAAK,GAAAD,UAAA,KAAA,KAAA,CAAA,GAAGF,aAAa,CAACG,KAAK,GAAAD,UAAA;MAE3BE,IAAI,GAAAR,IAAA,CAAJQ,IAAI;MACJC,eAAe,GAAAT,IAAA,CAAfS,eAAe;MAAAC,SAAA,GAAAV,IAAA,CACfW,IAAI;AAAJA,MAAAA,IAAI,GAAAD,SAAA,KAAA,KAAA,CAAA,GAAGN,aAAa,CAACO,IAAI,GAAAD,SAAA;MACzBE,IAAI,GAAAZ,IAAA,CAAJY,IAAI;MAAAC,WAAA,GAAAb,IAAA,CACJc,MAAM;AAANA,MAAAA,MAAM,GAAAD,WAAA,KAAA,KAAA,CAAA,GAAGT,aAAa,CAACU,MAAM,GAAAD,WAAA;MAAAE,WAAA,GAAAf,IAAA,CAC7BgB,MAAM;AAANA,MAAAA,MAAM,GAAAD,WAAA,KAAA,KAAA,CAAA,GAAGX,aAAa,CAACY,MAAM,GAAAD,WAAA;MAAAE,kBAAA,GAAAjB,IAAA,CAC7BkB,aAAa;AAAbA,MAAAA,aAAa,GAAAD,kBAAA,KAAA,KAAA,CAAA,GAAGb,aAAa,CAACc,aAAa,GAAAD,kBAAA;MAAAE,UAAA,GAAAnB,IAAA,CAE3CoB,KAAK;AAALA,MAAAA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AACbI,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
1
|
+
{"version":3,"file":"Pagination.js","sources":["../../../src/components/Pagination/Pagination.tsx"],"sourcesContent":["import React, { useEffect, useState, forwardRef } from 'react';\n\nimport { cx, isNumber } from '../../utils';\nimport { RootProps } from '../../engines';\n\nimport {\n PaginationPages,\n PaginationActions,\n PaginationButton,\n PaginationSection,\n PaginationButtonGroup,\n PaginationRoot,\n PaginationShorter,\n} from './Pagination.styles';\nimport type { PaginationProps } from './Pagination.types';\nimport { getSections, defaultValues } from './utils';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as typeCSS } from './variations/_type/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { classes } from './Pagination.tokens';\nimport { PaginationQuickJumpToPage } from './ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage';\nimport { PaginationSelectPerPage } from './ui/PaginationSelectPerPage/PaginationSelectPerPage';\n\nexport const paginationRoot = (Root: RootProps<HTMLDivElement, PaginationProps>) =>\n forwardRef<HTMLDivElement, PaginationProps>(\n (\n {\n value = defaultValues.value,\n perPage,\n slots = defaultValues.slots,\n\n view,\n viewCurrentPage,\n type = defaultValues.type,\n size,\n pilled = defaultValues.pilled,\n square = defaultValues.square,\n disabledPages = defaultValues.disabledPages,\n\n count = defaultValues.value,\n\n hasQuickJump = defaultValues.hasQuickJump,\n hasPerPage = defaultValues.hasPerPage,\n perPageList = defaultValues.perPageList,\n isCommonButtonStyles = defaultValues.isCommonButtonStyles,\n\n placeholderQuickJump = defaultValues.placeholderQuickJump,\n textQuickJump = defaultValues.textQuickJump,\n textPerPage = defaultValues.textPerPage,\n\n leftContent,\n rightContent,\n\n onChangePageValue,\n onChangePerPageValue,\n ...rest\n },\n ref,\n ) => {\n const [page, setPageValue] = useState<number>(1);\n const [perPageValue, setPerPageValue] = useState(perPage);\n const [pages, setPagesValue] = useState<number>(value);\n const [sections, setSections] = useState<number[][] | null>(null);\n\n const typeClass = classes[`${type}Type` as keyof typeof classes];\n const roundedClass = pilled ? 'circle-circle' : 'square-square';\n\n const withHasPerPageSelect = hasPerPage ? classes.withHasPerPageSelect : undefined;\n const withHasQuickJump = hasQuickJump ? classes.withHasQuickJump : undefined;\n\n const disabled = disabledPages.map((el) => (isNumber(el) ? Number(el) : null));\n\n const handlerSetPages = (newPerPage?: number) => {\n setPagesValue(Math.ceil(count / (newPerPage || (hasPerPage ? defaultValues.perPage : 1))));\n };\n\n const handlerSetPage = (newPageValue?: number) => {\n let pageValue = newPageValue ?? defaultValues.value;\n if (pageValue > pages) {\n pageValue = pages;\n }\n if (pageValue < 1) {\n pageValue = 1;\n }\n if (disabled.includes(pageValue)) {\n return;\n }\n setPageValue(pageValue);\n onChangePageValue?.(pageValue);\n };\n\n const handlerSetPerPage = (newPerPageValue?: number) => {\n handlerSetPage(1);\n setPerPageValue(newPerPageValue);\n onChangePerPageValue?.(newPerPageValue);\n\n handlerSetPages(newPerPageValue);\n };\n\n const isActiveButton = (checkPage: number) => {\n return page === checkPage ? classes.paginationPageButtonActive : '';\n };\n\n useEffect(() => {\n handlerSetPages(perPage);\n }, [perPage, count, handlerSetPages]);\n\n useEffect(() => {\n handlerSetPage(value);\n }, [value]);\n\n useEffect(() => {\n setSections(getSections(page, pages, slots));\n }, [page, slots, pages, setSections, getSections]);\n\n return (\n <Root\n size={size}\n view={view}\n viewCurrentPage={viewCurrentPage}\n className={cx(classes.wrapper, typeClass)}\n ref={ref}\n {...rest}\n >\n <PaginationRoot className={typeClass}>\n <PaginationPages>\n {leftContent && (\n <PaginationButtonGroup isCommonButtonStyles={isCommonButtonStyles}>\n {leftContent}\n </PaginationButtonGroup>\n )}\n {sections &&\n sections.map((section, indexSection) => (\n <>\n {indexSection !== 0 && (\n <PaginationShorter stretching=\"fixed\" disabled>\n ...\n </PaginationShorter>\n )}\n <PaginationSection key={indexSection}>\n {section.map((pageValue) => (\n <PaginationButton\n square={square}\n pin={roundedClass}\n key={pageValue}\n onClick={() => handlerSetPage(pageValue)}\n disabled={disabled.includes(pageValue)}\n className={cx(\n classes.paginationPageButton,\n isActiveButton(pageValue),\n )}\n >\n {pageValue}\n </PaginationButton>\n ))}\n </PaginationSection>\n </>\n ))}\n {rightContent && (\n <PaginationButtonGroup isCommonButtonStyles={isCommonButtonStyles}>\n {rightContent}\n </PaginationButtonGroup>\n )}\n </PaginationPages>\n <PaginationActions\n className={cx(classes.actions, typeClass, withHasPerPageSelect, withHasQuickJump)}\n >\n {hasQuickJump && (\n <PaginationQuickJumpToPage\n placeholderQuickJump={placeholderQuickJump}\n textQuickJump={textQuickJump}\n onChangeValue={handlerSetPage}\n />\n )}\n {hasPerPage && (\n <PaginationSelectPerPage\n textPerPage={textPerPage}\n value={perPageValue}\n valuesList={perPageList}\n onChangeValue={handlerSetPerPage}\n />\n )}\n </PaginationActions>\n </PaginationRoot>\n </Root>\n );\n },\n );\n\nexport const paginationConfig = {\n name: 'Pagination',\n tag: 'div',\n layout: paginationRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n type: {\n css: typeCSS,\n },\n },\n defaults: {\n view: 'clear',\n size: 'm',\n },\n};\n"],"names":["paginationRoot","Root","forwardRef","_ref","ref","_ref$value","value","defaultValues","perPage","_ref$slots","slots","view","viewCurrentPage","_ref$type","type","size","_ref$pilled","pilled","_ref$square","square","_ref$disabledPages","disabledPages","_ref$count","count","_ref$hasQuickJump","hasQuickJump","_ref$hasPerPage","hasPerPage","_ref$perPageList","perPageList","_ref$isCommonButtonSt","isCommonButtonStyles","_ref$placeholderQuick","placeholderQuickJump","_ref$textQuickJump","textQuickJump","_ref$textPerPage","textPerPage","leftContent","rightContent","onChangePageValue","onChangePerPageValue","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","page","setPageValue","_useState3","_useState4","perPageValue","setPerPageValue","_useState5","_useState6","pages","setPagesValue","_useState7","_useState8","sections","setSections","typeClass","classes","concat","roundedClass","withHasPerPageSelect","undefined","withHasQuickJump","disabled","map","el","isNumber","Number","handlerSetPages","newPerPage","Math","ceil","handlerSetPage","newPageValue","pageValue","includes","handlerSetPerPage","newPerPageValue","isActiveButton","checkPage","paginationPageButtonActive","useEffect","getSections","React","createElement","_extends","className","cx","wrapper","PaginationRoot","PaginationPages","PaginationButtonGroup","section","indexSection","Fragment","_PaginationShorter","PaginationShorter","stretching","PaginationSection","key","PaginationButton","pin","onClick","paginationPageButton","PaginationActions","actions","PaginationQuickJumpToPage","onChangeValue","PaginationSelectPerPage","valuesList","paginationConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","typeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;IAuBaA,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,IAAgD,EAAA;AAAA,EAAA,oBAC3EC,UAAU,CACN,UAAAC,IAAA,EAgCIC,GAAG,EACF;AAAA,IAAA,IAAAC,UAAA,GAAAF,IAAA,CA/BGG,KAAK;AAALA,MAAAA,KAAK,GAAAD,UAAA,KAAA,KAAA,CAAA,GAAGE,aAAa,CAACD,KAAK,GAAAD,UAAA;MAC3BG,OAAO,GAAAL,IAAA,CAAPK,OAAO;MAAAC,UAAA,GAAAN,IAAA,CACPO,KAAK;AAALA,MAAAA,KAAK,GAAAD,UAAA,KAAA,KAAA,CAAA,GAAGF,aAAa,CAACG,KAAK,GAAAD,UAAA;MAE3BE,IAAI,GAAAR,IAAA,CAAJQ,IAAI;MACJC,eAAe,GAAAT,IAAA,CAAfS,eAAe;MAAAC,SAAA,GAAAV,IAAA,CACfW,IAAI;AAAJA,MAAAA,IAAI,GAAAD,SAAA,KAAA,KAAA,CAAA,GAAGN,aAAa,CAACO,IAAI,GAAAD,SAAA;MACzBE,IAAI,GAAAZ,IAAA,CAAJY,IAAI;MAAAC,WAAA,GAAAb,IAAA,CACJc,MAAM;AAANA,MAAAA,MAAM,GAAAD,WAAA,KAAA,KAAA,CAAA,GAAGT,aAAa,CAACU,MAAM,GAAAD,WAAA;MA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AAA,UAAU,EAAE;AACR/G,IAAAA,IAAI,EAAE;AACFgH,MAAAA,GAAG,EAAEC,IAAAA;KACR;AACD7G,IAAAA,IAAI,EAAE;AACF4G,MAAAA,GAAG,EAAEE,MAAAA;KACR;AACD/G,IAAAA,IAAI,EAAE;AACF6G,MAAAA,GAAG,EAAEG,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNpH,IAAAA,IAAI,EAAE,OAAO;AACbI,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
@@ -17,7 +17,7 @@ var PaginationQuickJumpToPage = function PaginationQuickJumpToPage(_ref) {
|
|
17
17
|
setPageValue = _useState2[1];
|
18
18
|
var handleKeyPress = function handleKeyPress(event) {
|
19
19
|
if (event.key === 'Enter') {
|
20
|
-
onChangeValue === null || onChangeValue === void 0
|
20
|
+
onChangeValue === null || onChangeValue === void 0 || onChangeValue(Number(pageValue));
|
21
21
|
setPageValue('');
|
22
22
|
}
|
23
23
|
};
|
package/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PaginationQuickJumpToPage.js","sources":["../../../../../src/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { defaultValues } from '../../utils';\n\nimport type { PaginationQuickJumpToPageProps } from './PaginationQuickJumpToPage.types';\nimport {\n QuickJumpToPageRoot,\n QuickJumpToPageTypography,\n QuickJumpToPageInput,\n} from './PaginationQuickJumpToPage.styles';\n\nexport const PaginationQuickJumpToPage: React.FC<PaginationQuickJumpToPageProps> = ({\n placeholderQuickJump = defaultValues.placeholderQuickJump,\n textQuickJump = defaultValues.textQuickJump,\n onChangeValue,\n ...rest\n}) => {\n const [pageValue, setPageValue] = useState<number | string | undefined>();\n\n const handleKeyPress = (event: React.KeyboardEvent<HTMLElement>) => {\n if (event.key === 'Enter') {\n onChangeValue?.(Number(pageValue));\n setPageValue('');\n }\n };\n\n const handleChangeInput = (event: React.FormEvent<HTMLInputElement>) => {\n const result = event.currentTarget.value.replace(/\\D/g, '');\n if (result === '') return setPageValue('');\n setPageValue(Number(result));\n };\n\n return (\n <QuickJumpToPageRoot {...rest}>\n <QuickJumpToPageTypography>{textQuickJump}</QuickJumpToPageTypography>\n <QuickJumpToPageInput\n value={pageValue}\n placeholder={placeholderQuickJump}\n onKeyUp={handleKeyPress}\n onChange={handleChangeInput}\n />\n </QuickJumpToPageRoot>\n );\n};\n"],"names":["PaginationQuickJumpToPage","_ref","_ref$placeholderQuick","placeholderQuickJump","defaultValues","_ref$textQuickJump","textQuickJump","onChangeValue","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","pageValue","setPageValue","handleKeyPress","event","key","Number","handleChangeInput","result","currentTarget","value","replace","React","createElement","QuickJumpToPageRoot","QuickJumpToPageTypography","QuickJumpToPageInput","placeholder","onKeyUp","onChange"],"mappings":";;;;;;IAWaA,yBAAmE,GAAG,SAAtEA,yBAAmEA,CAAAC,IAAA,EAK1E;AAAA,EAAA,IAAAC,qBAAA,GAAAD,IAAA,CAJFE,oBAAoB;AAApBA,IAAAA,oBAAoB,GAAAD,qBAAA,KAAA,KAAA,CAAA,GAAGE,aAAa,CAACD,oBAAoB,GAAAD,qBAAA;IAAAG,kBAAA,GAAAJ,IAAA,CACzDK,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAA,KAAA,CAAA,GAAGD,aAAa,CAACE,aAAa,GAAAD,kBAAA;IAC3CE,aAAa,GAAAN,IAAA,CAAbM,aAAa;AACVC,IAAAA,IAAI,GAAAC,wBAAA,CAAAR,IAAA,EAAAS,SAAA,CAAA,CAAA;AAEP,EAAA,IAAAC,SAAA,GAAkCC,QAAQ,EAA+B;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAlEI,IAAAA,SAAS,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,YAAY,GAAAH,UAAA,CAAA,CAAA,CAAA,CAAA;AAE9B,EAAA,IAAMI,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,KAAuC,EAAK;AAChE,IAAA,IAAIA,KAAK,CAACC,GAAG,KAAK,OAAO,EAAE;MACvBZ,aAAa,KAAA,IAAA,IAAbA,aAAa,KAAbA,KAAAA,CAAAA,
|
1
|
+
{"version":3,"file":"PaginationQuickJumpToPage.js","sources":["../../../../../src/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { defaultValues } from '../../utils';\n\nimport type { PaginationQuickJumpToPageProps } from './PaginationQuickJumpToPage.types';\nimport {\n QuickJumpToPageRoot,\n QuickJumpToPageTypography,\n QuickJumpToPageInput,\n} from './PaginationQuickJumpToPage.styles';\n\nexport const PaginationQuickJumpToPage: React.FC<PaginationQuickJumpToPageProps> = ({\n placeholderQuickJump = defaultValues.placeholderQuickJump,\n textQuickJump = defaultValues.textQuickJump,\n onChangeValue,\n ...rest\n}) => {\n const [pageValue, setPageValue] = useState<number | string | undefined>();\n\n const handleKeyPress = (event: React.KeyboardEvent<HTMLElement>) => {\n if (event.key === 'Enter') {\n onChangeValue?.(Number(pageValue));\n setPageValue('');\n }\n };\n\n const handleChangeInput = (event: React.FormEvent<HTMLInputElement>) => {\n const result = event.currentTarget.value.replace(/\\D/g, '');\n if (result === '') return setPageValue('');\n setPageValue(Number(result));\n };\n\n return (\n <QuickJumpToPageRoot {...rest}>\n <QuickJumpToPageTypography>{textQuickJump}</QuickJumpToPageTypography>\n <QuickJumpToPageInput\n value={pageValue}\n placeholder={placeholderQuickJump}\n onKeyUp={handleKeyPress}\n onChange={handleChangeInput}\n />\n </QuickJumpToPageRoot>\n );\n};\n"],"names":["PaginationQuickJumpToPage","_ref","_ref$placeholderQuick","placeholderQuickJump","defaultValues","_ref$textQuickJump","textQuickJump","onChangeValue","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","pageValue","setPageValue","handleKeyPress","event","key","Number","handleChangeInput","result","currentTarget","value","replace","React","createElement","QuickJumpToPageRoot","QuickJumpToPageTypography","QuickJumpToPageInput","placeholder","onKeyUp","onChange"],"mappings":";;;;;;IAWaA,yBAAmE,GAAG,SAAtEA,yBAAmEA,CAAAC,IAAA,EAK1E;AAAA,EAAA,IAAAC,qBAAA,GAAAD,IAAA,CAJFE,oBAAoB;AAApBA,IAAAA,oBAAoB,GAAAD,qBAAA,KAAA,KAAA,CAAA,GAAGE,aAAa,CAACD,oBAAoB,GAAAD,qBAAA;IAAAG,kBAAA,GAAAJ,IAAA,CACzDK,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAA,KAAA,CAAA,GAAGD,aAAa,CAACE,aAAa,GAAAD,kBAAA;IAC3CE,aAAa,GAAAN,IAAA,CAAbM,aAAa;AACVC,IAAAA,IAAI,GAAAC,wBAAA,CAAAR,IAAA,EAAAS,SAAA,CAAA,CAAA;AAEP,EAAA,IAAAC,SAAA,GAAkCC,QAAQ,EAA+B;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAlEI,IAAAA,SAAS,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,YAAY,GAAAH,UAAA,CAAA,CAAA,CAAA,CAAA;AAE9B,EAAA,IAAMI,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,KAAuC,EAAK;AAChE,IAAA,IAAIA,KAAK,CAACC,GAAG,KAAK,OAAO,EAAE;MACvBZ,aAAa,KAAA,IAAA,IAAbA,aAAa,KAAbA,KAAAA,CAAAA,IAAAA,aAAa,CAAGa,MAAM,CAACL,SAAS,CAAC,CAAC,CAAA;MAClCC,YAAY,CAAC,EAAE,CAAC,CAAA;AACpB,KAAA;GACH,CAAA;AAED,EAAA,IAAMK,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIH,KAAwC,EAAK;AACpE,IAAA,IAAMI,MAAM,GAAGJ,KAAK,CAACK,aAAa,CAACC,KAAK,CAACC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IAC3D,IAAIH,MAAM,KAAK,EAAE,EAAE,OAAON,YAAY,CAAC,EAAE,CAAC,CAAA;AAC1CA,IAAAA,YAAY,CAACI,MAAM,CAACE,MAAM,CAAC,CAAC,CAAA;GAC/B,CAAA;EAED,oBACII,KAAA,CAAAC,aAAA,CAACC,mBAAmB,EAAKpB,IAAI,eACzBkB,KAAA,CAAAC,aAAA,CAACE,yBAAyB,QAAEvB,aAAyC,CAAC,eACtEoB,KAAA,CAAAC,aAAA,CAACG,oBAAoB,EAAA;AACjBN,IAAAA,KAAK,EAAET,SAAU;AACjBgB,IAAAA,WAAW,EAAE5B,oBAAqB;AAClC6B,IAAAA,OAAO,EAAEf,cAAe;AACxBgB,IAAAA,QAAQ,EAAEZ,iBAAAA;AAAkB,GAC/B,CACgB,CAAC,CAAA;AAE9B;;;;"}
|
@@ -24,7 +24,7 @@ var PaginationSelectPerPage = function PaginationSelectPerPage(_ref) {
|
|
24
24
|
var handleSelectChange = function handleSelectChange(newValue) {
|
25
25
|
if (newValue) {
|
26
26
|
setSelectedValue(Number(newValue));
|
27
|
-
onChangeValue === null || onChangeValue === void 0
|
27
|
+
onChangeValue === null || onChangeValue === void 0 || onChangeValue(Number(newValue));
|
28
28
|
}
|
29
29
|
};
|
30
30
|
return /*#__PURE__*/React.createElement(SelectPerPageRoot, rest, /*#__PURE__*/React.createElement(SelectPerPageTypography, null, textPerPage), /*#__PURE__*/React.createElement(SelectPerPageSelect, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PaginationSelectPerPage.js","sources":["../../../../../src/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { IconDone } from '../../../../components/_Icon';\nimport { SelectPrimitiveValue } from '../../../Select';\nimport { defaultValues } from '../../utils';\nimport { classes } from '../../Pagination.tokens';\n\nimport type { PaginationSelectPerPageProps } from './PaginationSelectPerPage.types';\nimport {\n SelectPerPageRoot,\n SelectPerPageTypography,\n SelectPerPageSelect,\n SelectPerPageSelectItem,\n} from './PaginationSelectPerPage.styles';\n\nexport const PaginationSelectPerPage: React.FC<PaginationSelectPerPageProps> = ({\n value = defaultValues.perPage,\n valuesList = defaultValues.perPageList,\n textPerPage = defaultValues.textPerPage,\n onChangeValue,\n ...rest\n}) => {\n const [selectedValue, setSelectedValue] = useState(value);\n\n const handleSelectChange = (newValue?: SelectPrimitiveValue) => {\n if (newValue) {\n setSelectedValue(Number(newValue));\n onChangeValue?.(Number(newValue));\n }\n };\n\n return (\n <SelectPerPageRoot {...rest}>\n <SelectPerPageTypography>{textPerPage}</SelectPerPageTypography>\n <SelectPerPageSelect\n className={classes.selectWrapper}\n value={selectedValue}\n onChangeValue={handleSelectChange}\n >\n {valuesList?.map((item) => (\n <SelectPerPageSelectItem\n contentLeft={item === selectedValue ? <IconDone size=\"xs\" color=\"inherit\" /> : undefined}\n key={item}\n value={item}\n text={String(item)}\n />\n ))}\n </SelectPerPageSelect>\n </SelectPerPageRoot>\n );\n};\n"],"names":["PaginationSelectPerPage","_ref","_ref$value","value","defaultValues","perPage","_ref$valuesList","valuesList","perPageList","_ref$textPerPage","textPerPage","onChangeValue","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","selectedValue","setSelectedValue","handleSelectChange","newValue","Number","React","createElement","SelectPerPageRoot","SelectPerPageTypography","SelectPerPageSelect","className","classes","selectWrapper","map","item","SelectPerPageSelectItem","contentLeft","_IconDone","IconDone","size","color","undefined","key","text","String"],"mappings":";;;;;;;;;;IAeaA,uBAA+D,GAAG,SAAlEA,uBAA+DA,CAAAC,IAAA,EAMtE;AAAA,EAAA,IAAAC,UAAA,GAAAD,IAAA,CALFE,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,KAAA,CAAA,GAAGE,aAAa,CAACC,OAAO,GAAAH,UAAA;IAAAI,eAAA,GAAAL,IAAA,CAC7BM,UAAU;AAAVA,IAAAA,UAAU,GAAAD,eAAA,KAAA,KAAA,CAAA,GAAGF,aAAa,CAACI,WAAW,GAAAF,eAAA;IAAAG,gBAAA,GAAAR,IAAA,CACtCS,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAA,KAAA,CAAA,GAAGL,aAAa,CAACM,WAAW,GAAAD,gBAAA;IACvCE,aAAa,GAAAV,IAAA,CAAbU,aAAa;AACVC,IAAAA,IAAI,GAAAC,wBAAA,CAAAZ,IAAA,EAAAa,SAAA,CAAA,CAAA;AAEP,EAAA,IAAAC,SAAA,GAA0CC,QAAQ,CAACb,KAAK,CAAC;IAAAc,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAlDI,IAAAA,aAAa,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,gBAAgB,GAAAH,UAAA,CAAA,CAAA,CAAA,CAAA;AAEtC,EAAA,IAAMI,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,QAA+B,EAAK;AAC5D,IAAA,IAAIA,QAAQ,EAAE;AACVF,MAAAA,gBAAgB,CAACG,MAAM,CAACD,QAAQ,CAAC,CAAC,CAAA;MAClCX,aAAa,KAAA,IAAA,IAAbA,aAAa,KAAbA,KAAAA,CAAAA,
|
1
|
+
{"version":3,"file":"PaginationSelectPerPage.js","sources":["../../../../../src/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { IconDone } from '../../../../components/_Icon';\nimport { SelectPrimitiveValue } from '../../../Select';\nimport { defaultValues } from '../../utils';\nimport { classes } from '../../Pagination.tokens';\n\nimport type { PaginationSelectPerPageProps } from './PaginationSelectPerPage.types';\nimport {\n SelectPerPageRoot,\n SelectPerPageTypography,\n SelectPerPageSelect,\n SelectPerPageSelectItem,\n} from './PaginationSelectPerPage.styles';\n\nexport const PaginationSelectPerPage: React.FC<PaginationSelectPerPageProps> = ({\n value = defaultValues.perPage,\n valuesList = defaultValues.perPageList,\n textPerPage = defaultValues.textPerPage,\n onChangeValue,\n ...rest\n}) => {\n const [selectedValue, setSelectedValue] = useState(value);\n\n const handleSelectChange = (newValue?: SelectPrimitiveValue) => {\n if (newValue) {\n setSelectedValue(Number(newValue));\n onChangeValue?.(Number(newValue));\n }\n };\n\n return (\n <SelectPerPageRoot {...rest}>\n <SelectPerPageTypography>{textPerPage}</SelectPerPageTypography>\n <SelectPerPageSelect\n className={classes.selectWrapper}\n value={selectedValue}\n onChangeValue={handleSelectChange}\n >\n {valuesList?.map((item) => (\n <SelectPerPageSelectItem\n contentLeft={item === selectedValue ? <IconDone size=\"xs\" color=\"inherit\" /> : undefined}\n key={item}\n value={item}\n text={String(item)}\n />\n ))}\n </SelectPerPageSelect>\n </SelectPerPageRoot>\n );\n};\n"],"names":["PaginationSelectPerPage","_ref","_ref$value","value","defaultValues","perPage","_ref$valuesList","valuesList","perPageList","_ref$textPerPage","textPerPage","onChangeValue","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","selectedValue","setSelectedValue","handleSelectChange","newValue","Number","React","createElement","SelectPerPageRoot","SelectPerPageTypography","SelectPerPageSelect","className","classes","selectWrapper","map","item","SelectPerPageSelectItem","contentLeft","_IconDone","IconDone","size","color","undefined","key","text","String"],"mappings":";;;;;;;;;;IAeaA,uBAA+D,GAAG,SAAlEA,uBAA+DA,CAAAC,IAAA,EAMtE;AAAA,EAAA,IAAAC,UAAA,GAAAD,IAAA,CALFE,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,KAAA,CAAA,GAAGE,aAAa,CAACC,OAAO,GAAAH,UAAA;IAAAI,eAAA,GAAAL,IAAA,CAC7BM,UAAU;AAAVA,IAAAA,UAAU,GAAAD,eAAA,KAAA,KAAA,CAAA,GAAGF,aAAa,CAACI,W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,CAAAC,aAAA,CAACS,uBAAuB,EAAA;AACpBC,MAAAA,WAAW,EAAEF,IAAI,KAAKd,aAAa,GAAAiB,SAAA,KAAAA,SAAA,gBAAGZ,KAAA,CAAAC,aAAA,CAACY,QAAQ,EAAA;AAACC,QAAAA,IAAI,EAAC,IAAI;AAACC,QAAAA,KAAK,EAAC,SAAA;OAAW,CAAC,IAAGC,SAAU;AACzFC,MAAAA,GAAG,EAAER,IAAK;AACV9B,MAAAA,KAAK,EAAE8B,IAAK;MACZS,IAAI,EAAEC,MAAM,CAACV,IAAI,CAAA;AAAE,KACtB,CAAC,CAAA;GACL,CACgB,CACN,CAAC,CAAA;AAE5B;;;;"}
|
@@ -96,7 +96,7 @@ var popoverRoot = function popoverRoot(Root) {
|
|
96
96
|
forceUpdate = _usePopper.forceUpdate;
|
97
97
|
var onEscape = useCallback(function (event) {
|
98
98
|
if (isOpen && closeOnEsc && event.keyCode === ESCAPE_KEYCODE) {
|
99
|
-
onToggle === null || onToggle === void 0
|
99
|
+
onToggle === null || onToggle === void 0 || onToggle(false, event);
|
100
100
|
}
|
101
101
|
}, [closeOnEsc, isOpen, onToggle]);
|
102
102
|
var onDocumentClick = useCallback(function (event) {
|
@@ -115,28 +115,28 @@ var popoverRoot = function popoverRoot(Root) {
|
|
115
115
|
var targetIsPopover = event.target === popoverRef.current;
|
116
116
|
var rootHasTarget = (_popoverRef$current = popoverRef.current) === null || _popoverRef$current === void 0 ? void 0 : _popoverRef$current.contains(event.target);
|
117
117
|
if (!targetIsPopover && !rootHasTarget) {
|
118
|
-
onToggle === null || onToggle === void 0
|
118
|
+
onToggle === null || onToggle === void 0 || onToggle(!isOpen, event);
|
119
119
|
}
|
120
120
|
}
|
121
121
|
}, [trigger, isOpen, onToggle]);
|
122
122
|
var onMouseEnter = useCallback(function (event) {
|
123
123
|
if (trigger === 'hover') {
|
124
|
-
onToggle === null || onToggle === void 0
|
124
|
+
onToggle === null || onToggle === void 0 || onToggle(true, event);
|
125
125
|
}
|
126
126
|
}, [trigger, onToggle]);
|
127
127
|
var onMouseLeave = useCallback(function (event) {
|
128
128
|
if (trigger === 'hover') {
|
129
|
-
onToggle === null || onToggle === void 0
|
129
|
+
onToggle === null || onToggle === void 0 || onToggle(false, event);
|
130
130
|
}
|
131
131
|
}, [trigger, onToggle]);
|
132
132
|
var onFocus = useCallback(function (event) {
|
133
133
|
if (trigger === 'hover') {
|
134
|
-
onToggle === null || onToggle === void 0
|
134
|
+
onToggle === null || onToggle === void 0 || onToggle(true, event);
|
135
135
|
}
|
136
136
|
}, [trigger, onToggle]);
|
137
137
|
var onBlur = useCallback(function (event) {
|
138
138
|
if (trigger === 'hover') {
|
139
|
-
onToggle === null || onToggle === void 0
|
139
|
+
onToggle === null || onToggle === void 0 || onToggle(false, event);
|
140
140
|
}
|
141
141
|
}, [trigger, onToggle]);
|
142
142
|
useEffect(function () {
|
@@ -164,7 +164,7 @@ var popoverRoot = function popoverRoot(Root) {
|
|
164
164
|
portal.setAttribute('id', POPOVER_PORTAL_ID);
|
165
165
|
if (typeof frame === 'string' && frame !== 'document') {
|
166
166
|
var _document$getElementB;
|
167
|
-
(_document$getElementB = document.getElementById(frame)) === null || _document$getElementB === void 0
|
167
|
+
(_document$getElementB = document.getElementById(frame)) === null || _document$getElementB === void 0 || _document$getElementB.appendChild(portal);
|
168
168
|
} else {
|
169
169
|
document.body.appendChild(portal);
|
170
170
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Popover.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import React, { useRef, useCallback, useEffect, useState, forwardRef } from 'react';\nimport type { CSSProperties } from 'react';\nimport ReactDOM from 'react-dom';\nimport { usePopper } from 'react-popper';\nimport { useFocusTrap, useForkRef } from '@salutejs/plasma-core';\n\nimport type { RootProps } from '../../engines/types';\nimport { cx } from '../../utils';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport type { PopoverPlacement, PopoverProps } from './Popover.types';\nimport { StyledArrow, StyledPopover, StyledRoot, StyledWrapper } from './Popover.styles';\nimport { classes } from './Popover.tokens';\n\nexport const ESCAPE_KEYCODE = 27;\nexport const POPOVER_PORTAL_ID = 'plasma-popover-root';\n\n/**\n * Всплывающее окно с возможностью позиционирования\n * и вызова по клику либо ховеру.\n */\nexport const popoverRoot = (Root: RootProps<HTMLDivElement, PopoverProps>) =>\n forwardRef<HTMLDivElement, PopoverProps>(\n (\n {\n target,\n children,\n isOpen,\n trigger = 'click',\n hasArrow,\n frame = 'document',\n className,\n placement = 'auto',\n offset = [0, 0],\n zIndex,\n isFocusTrapped = true,\n closeOnEsc = true,\n preventOverflow = true,\n usePortal = false,\n view,\n onToggle,\n closeOnOverlayClick,\n ...rest\n },\n outerRootRef,\n ) => {\n const rootRef = useRef<HTMLDivElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const handleRef = useForkRef<HTMLDivElement>(rootRef, outerRootRef);\n const portalRef = useRef<HTMLElement | null>(null);\n\n const trapRef = useFocusTrap(isOpen && isFocusTrapped);\n\n const popoverForkRef = useForkRef<HTMLDivElement>(popoverRef, trapRef);\n\n const [arrowElement, setArrowElement] = useState<HTMLSpanElement | null>(null);\n\n const [, forceRender] = useState(false);\n\n const isAutoArray = Array.isArray(placement);\n const isAuto = isAutoArray || (placement as PopoverPlacement).startsWith('auto');\n\n const initialStyles = {\n visibility: isOpen ? 'visible' : 'hidden',\n opacity: isOpen ? 1 : 0,\n } as CSSProperties;\n\n const { styles, attributes, forceUpdate } = usePopper(rootRef.current, popoverRef.current, {\n // TODO: #1121\n // eslint-disable-next-line no-nested-ternary\n placement: isAutoArray\n ? placement[0]?.endsWith('start')\n ? 'auto-start'\n : 'auto'\n : (placement as PopoverPlacement),\n modifiers: [\n {\n name: 'preventOverflow',\n options: {\n mainAxis: preventOverflow,\n },\n },\n { name: 'offset', options: { offset: [offset[0], offset[1]] } },\n {\n name: 'flip',\n enabled: isAuto,\n options: {\n allowedAutoPlacements: isAutoArray ? (placement as PopoverPlacement[]) : [],\n },\n },\n {\n name: 'arrow',\n options: {\n element: arrowElement,\n },\n },\n ],\n });\n\n const onEscape = useCallback(\n (event: KeyboardEvent) => {\n if (isOpen && closeOnEsc && event.keyCode === ESCAPE_KEYCODE) {\n onToggle?.(false, event);\n }\n },\n [closeOnEsc, isOpen, onToggle],\n );\n\n const onDocumentClick = useCallback(\n (event: MouseEvent) => {\n if (isOpen && closeOnOverlayClick && onToggle) {\n const targetIsRoot = event.target === rootRef.current;\n const rootHasTarget = rootRef.current?.contains(event.target as Element);\n\n if (!targetIsRoot && !rootHasTarget) {\n onToggle(false, event);\n }\n }\n },\n [closeOnOverlayClick, isOpen, onToggle],\n );\n\n const onClick = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'click') {\n const targetIsPopover = event.target === popoverRef.current;\n const rootHasTarget = popoverRef.current?.contains(event.target as Element);\n\n if (!targetIsPopover && !rootHasTarget) {\n onToggle?.(!isOpen, event);\n }\n }\n },\n [trigger, isOpen, onToggle],\n );\n\n const onMouseEnter = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(true, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onMouseLeave = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(false, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onFocus = useCallback<React.FocusEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(true, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onBlur = useCallback<React.FocusEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(false, event);\n }\n },\n [trigger, onToggle],\n );\n\n useEffect(() => {\n document.addEventListener('click', onDocumentClick);\n return () => document.removeEventListener('click', onDocumentClick);\n }, [isOpen, onToggle]);\n\n useEffect(() => {\n window.addEventListener('keydown', onEscape);\n return () => window.removeEventListener('keydown', onEscape);\n }, [closeOnEsc, isOpen, onToggle]);\n\n useEffect(() => {\n let portal = document.getElementById(POPOVER_PORTAL_ID);\n\n if (typeof frame !== 'string' && frame && frame.current) {\n portal = frame.current;\n }\n\n if (!usePortal) {\n portal = rootRef.current;\n }\n\n if (!portal) {\n portal = document.createElement('div');\n portal.setAttribute('id', POPOVER_PORTAL_ID);\n\n if (typeof frame === 'string' && frame !== 'document') {\n document.getElementById(frame)?.appendChild(portal);\n } else {\n document.body.appendChild(portal);\n }\n }\n\n portalRef.current = portal;\n\n /**\n * Изменение стейта нужно для того, чтобы Popup\n * отобразился после записи DOM элемента в portalRef.current\n */\n forceRender(true);\n }, []);\n\n useEffect(() => {\n if (!isOpen || !forceUpdate) {\n return;\n }\n\n /*\n * INFO: Метод forceUpdate содержит в себе flushSync и приводит\n * к повторному рендеру компонента, который уже находится в процессе рендера.\n * Данный хак, нужен для того, чтобы это поведение избежать и перенаправить\n * вызов метода в очередь микрозадач.\n */\n Promise.resolve().then(forceUpdate);\n }, [isOpen, children, forceUpdate]);\n\n return (\n <StyledWrapper className={classes.wrapper} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>\n <StyledRoot\n ref={handleRef}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n className={cx(className, classes.target)}\n >\n {target}\n </StyledRoot>\n {children &&\n portalRef.current &&\n ReactDOM.createPortal(\n <Root view={view} className={className} {...rest}>\n <StyledPopover\n {...attributes.popper}\n className={classes.root}\n ref={popoverForkRef}\n style={{\n ...styles.popper,\n ...{ display: isOpen ? 'block' : 'none' },\n ...initialStyles,\n }}\n zIndex={zIndex}\n >\n {hasArrow && (\n <StyledArrow\n className={classes.arrow}\n ref={setArrowElement}\n style={styles.arrow}\n {...attributes.arrow}\n />\n )}\n {children}\n </StyledPopover>\n </Root>,\n portalRef.current,\n )}\n </StyledWrapper>\n );\n },\n );\n\nexport const popoverConfig = {\n name: 'Popover',\n tag: 'div',\n layout: popoverRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n },\n defaults: {\n view: 'default',\n },\n};\n"],"names":["ESCAPE_KEYCODE","POPOVER_PORTAL_ID","popoverRoot","Root","forwardRef","_ref","outerRootRef","_placement$","target","children","isOpen","_ref$trigger","trigger","hasArrow","_ref$frame","frame","className","_ref$placement","placement","_ref$offset","offset","zIndex","_ref$isFocusTrapped","isFocusTrapped","_ref$closeOnEsc","closeOnEsc","_ref$preventOverflow","preventOverflow","_ref$usePortal","usePortal","view","onToggle","closeOnOverlayClick","rest","_objectWithoutProperties","_excluded","rootRef","useRef","popoverRef","handleRef","useForkRef","portalRef","trapRef","useFocusTrap","popoverForkRef","_useState","useState","_useState2","_slicedToArray","arrowElement","setArrowElement","_useState3","_useState4","forceRender","isAutoArray","Array","isArray","isAuto","startsWith","initialStyles","visibility","opacity","_usePopper","usePopper","current","endsWith","modifiers","name","options","mainAxis","enabled","allowedAutoPlacements","element","styles","attributes","forceUpdate","onEscape","useCallback","event","keyCode","onDocumentClick","_rootRef$current","targetIsRoot","rootHasTarget","contains","onClick","_popoverRef$current","targetIsPopover","onMouseEnter","onMouseLeave","onFocus","onBlur","useEffect","document","addEventListener","removeEventListener","window","portal","getElementById","createElement","setAttribute","_document$getElementB","appendChild","body","Promise","resolve","then","React","StyledWrapper","classes","wrapper","StyledRoot","ref","cx","ReactDOM","createPortal","_extends","StyledPopover","popper","root","style","_objectSpread","display","StyledArrow","arrow","popoverConfig","tag","layout","base","variations","css","viewCSS","defaults"],"mappings":";;;;;;;;;;;AAcO,IAAMA,cAAc,GAAG,GAAE;AACzB,IAAMC,iBAAiB,GAAG,sBAAqB;;AAEtD;AACA;AACA;AACA;IACaC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAA6C,EAAA;AAAA,EAAA,oBACrEC,UAAU,CACN,UAAAC,IAAA,EAqBIC,YAAY,EACX;AAAA,IAAA,IAAAC,WAAA,CAAA;AAAA,IAAA,IApBGC,MAAM,GAAAH,IAAA,CAANG,MAAM;MACNC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;MACRC,MAAM,GA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D,KAAK,CACvB,CACJ,EACAnH,QACU,CACb,CAAC,EACPgC,SAAS,CAACuB,OACd,CACO,CAAC,CAAA;AAExB,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAM6D,aAAa,GAAG;AACzB1D,EAAAA,IAAI,EAAE,SAAS;AACf2D,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE7H,WAAW;AACnB8H,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,UAAU,EAAE;AACRnG,IAAAA,IAAI,EAAE;AACFoG,MAAAA,GAAG,EAAEC,IAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNtG,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;"}
|
1
|
+
{"version":3,"file":"Popover.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import React, { useRef, useCallback, useEffect, useState, forwardRef } from 'react';\nimport type { CSSProperties } from 'react';\nimport ReactDOM from 'react-dom';\nimport { usePopper } from 'react-popper';\nimport { useFocusTrap, useForkRef } from '@salutejs/plasma-core';\n\nimport type { RootProps } from '../../engines/types';\nimport { cx } from '../../utils';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport type { PopoverPlacement, PopoverProps } from './Popover.types';\nimport { StyledArrow, StyledPopover, StyledRoot, StyledWrapper } from './Popover.styles';\nimport { classes } from './Popover.tokens';\n\nexport const ESCAPE_KEYCODE = 27;\nexport const POPOVER_PORTAL_ID = 'plasma-popover-root';\n\n/**\n * Всплывающее окно с возможностью позиционирования\n * и вызова по клику либо ховеру.\n */\nexport const popoverRoot = (Root: RootProps<HTMLDivElement, PopoverProps>) =>\n forwardRef<HTMLDivElement, PopoverProps>(\n (\n {\n target,\n children,\n isOpen,\n trigger = 'click',\n hasArrow,\n frame = 'document',\n className,\n placement = 'auto',\n offset = [0, 0],\n zIndex,\n isFocusTrapped = true,\n closeOnEsc = true,\n preventOverflow = true,\n usePortal = false,\n view,\n onToggle,\n closeOnOverlayClick,\n ...rest\n },\n outerRootRef,\n ) => {\n const rootRef = useRef<HTMLDivElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const handleRef = useForkRef<HTMLDivElement>(rootRef, outerRootRef);\n const portalRef = useRef<HTMLElement | null>(null);\n\n const trapRef = useFocusTrap(isOpen && isFocusTrapped);\n\n const popoverForkRef = useForkRef<HTMLDivElement>(popoverRef, trapRef);\n\n const [arrowElement, setArrowElement] = useState<HTMLSpanElement | null>(null);\n\n const [, forceRender] = useState(false);\n\n const isAutoArray = Array.isArray(placement);\n const isAuto = isAutoArray || (placement as PopoverPlacement).startsWith('auto');\n\n const initialStyles = {\n visibility: isOpen ? 'visible' : 'hidden',\n opacity: isOpen ? 1 : 0,\n } as CSSProperties;\n\n const { styles, attributes, forceUpdate } = usePopper(rootRef.current, popoverRef.current, {\n // TODO: #1121\n // eslint-disable-next-line no-nested-ternary\n placement: isAutoArray\n ? placement[0]?.endsWith('start')\n ? 'auto-start'\n : 'auto'\n : (placement as PopoverPlacement),\n modifiers: [\n {\n name: 'preventOverflow',\n options: {\n mainAxis: preventOverflow,\n },\n },\n { name: 'offset', options: { offset: [offset[0], offset[1]] } },\n {\n name: 'flip',\n enabled: isAuto,\n options: {\n allowedAutoPlacements: isAutoArray ? (placement as PopoverPlacement[]) : [],\n },\n },\n {\n name: 'arrow',\n options: {\n element: arrowElement,\n },\n },\n ],\n });\n\n const onEscape = useCallback(\n (event: KeyboardEvent) => {\n if (isOpen && closeOnEsc && event.keyCode === ESCAPE_KEYCODE) {\n onToggle?.(false, event);\n }\n },\n [closeOnEsc, isOpen, onToggle],\n );\n\n const onDocumentClick = useCallback(\n (event: MouseEvent) => {\n if (isOpen && closeOnOverlayClick && onToggle) {\n const targetIsRoot = event.target === rootRef.current;\n const rootHasTarget = rootRef.current?.contains(event.target as Element);\n\n if (!targetIsRoot && !rootHasTarget) {\n onToggle(false, event);\n }\n }\n },\n [closeOnOverlayClick, isOpen, onToggle],\n );\n\n const onClick = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'click') {\n const targetIsPopover = event.target === popoverRef.current;\n const rootHasTarget = popoverRef.current?.contains(event.target as Element);\n\n if (!targetIsPopover && !rootHasTarget) {\n onToggle?.(!isOpen, event);\n }\n }\n },\n [trigger, isOpen, onToggle],\n );\n\n const onMouseEnter = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(true, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onMouseLeave = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(false, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onFocus = useCallback<React.FocusEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(true, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onBlur = useCallback<React.FocusEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(false, event);\n }\n },\n [trigger, onToggle],\n );\n\n useEffect(() => {\n document.addEventListener('click', onDocumentClick);\n return () => document.removeEventListener('click', onDocumentClick);\n }, [isOpen, onToggle]);\n\n useEffect(() => {\n window.addEventListener('keydown', onEscape);\n return () => window.removeEventListener('keydown', onEscape);\n }, [closeOnEsc, isOpen, onToggle]);\n\n useEffect(() => {\n let portal = document.getElementById(POPOVER_PORTAL_ID);\n\n if (typeof frame !== 'string' && frame && frame.current) {\n portal = frame.current;\n }\n\n if (!usePortal) {\n portal = rootRef.current;\n }\n\n if (!portal) {\n portal = document.createElement('div');\n portal.setAttribute('id', POPOVER_PORTAL_ID);\n\n if (typeof frame === 'string' && frame !== 'document') {\n document.getElementById(frame)?.appendChild(portal);\n } else {\n document.body.appendChild(portal);\n }\n }\n\n portalRef.current = portal;\n\n /**\n * Изменение стейта нужно для того, чтобы Popup\n * отобразился после записи DOM элемента в portalRef.current\n */\n forceRender(true);\n }, []);\n\n useEffect(() => {\n if (!isOpen || !forceUpdate) {\n return;\n }\n\n /*\n * INFO: Метод forceUpdate содержит в себе flushSync и приводит\n * к повторному рендеру компонента, который уже находится в процессе рендера.\n * Данный хак, нужен для того, чтобы это поведение избежать и перенаправить\n * вызов метода в очередь микрозадач.\n */\n Promise.resolve().then(forceUpdate);\n }, [isOpen, children, forceUpdate]);\n\n return (\n <StyledWrapper className={classes.wrapper} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>\n <StyledRoot\n ref={handleRef}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n className={cx(className, classes.target)}\n >\n {target}\n </StyledRoot>\n {children &&\n portalRef.current &&\n ReactDOM.createPortal(\n <Root view={view} className={className} {...rest}>\n <StyledPopover\n {...attributes.popper}\n className={classes.root}\n ref={popoverForkRef}\n style={{\n ...styles.popper,\n ...{ display: isOpen ? 'block' : 'none' },\n ...initialStyles,\n }}\n zIndex={zIndex}\n >\n {hasArrow && (\n <StyledArrow\n className={classes.arrow}\n ref={setArrowElement}\n style={styles.arrow}\n {...attributes.arrow}\n />\n )}\n {children}\n </StyledPopover>\n </Root>,\n portalRef.current,\n )}\n </StyledWrapper>\n );\n },\n );\n\nexport const popoverConfig = {\n name: 'Popover',\n tag: 'div',\n layout: popoverRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n },\n defaults: {\n view: 'default',\n },\n};\n"],"names":["ESCAPE_KEYCODE","POPOVER_PORTAL_ID","popoverRoot","Root","forwardRef","_ref","outerRootRef","_placement$","target","children","isOpen","_ref$trigger","trigger","hasArrow","_ref$frame","frame","className","_ref$placement","placement","_ref$offset","offset","zIndex","_ref$isFocusTrapped","isFocusTrapped","_ref$closeOnEsc","closeOnEsc","_ref$preventOverflow","preventOverflow","_ref$usePortal","usePortal","view","onToggle","closeOnOverlayClick","rest","_objectWithoutProperties","_excluded","rootRef","useRef","popoverRef","handleRef","useForkRef","portalRef","trapRef","useFocusTrap","popoverForkRef","_useState","useState","_useState2","_slicedToArray","arrowElement","setArrowElement","_useState3","_useState4","forceRender","isAutoArray","Array","isArray","isAuto","startsWith","initialStyles","visibility","opacity","_usePopper","usePopper","current","endsWith","modifiers","name","options","mainAxis","enabled","allowedAutoPlacements","element","styles","attributes","forceUpdate","onEscape","useCallback","event","keyCode","onDocumentClick","_rootRef$current","targetIsRoot","rootHasTarget","contains","onClick","_popoverRef$current","targetIsPopover","onMouseEnter","onMouseLeave","onFocus","onBlur","useEffect","document","addEventListener","removeEventListener","window","portal","getElementById","createElement","setAttribute","_document$getElementB","appendChild","body","Promise","resolve","then","React","StyledWrapper","classes","wrapper","StyledRoot","ref","cx","ReactDOM","createPortal","_extends","StyledPopover","popper","root","style","_objectSpread","display","StyledArrow","arrow","popoverConfig","tag","layout","base","variations","css","viewCSS","defaults"],"mappings":";;;;;;;;;;;AAcO,IAAMA,cAAc,GAAG,GAAE;AACzB,IAAMC,iBAAiB,GAAG,sBAAqB;;AAEtD;AACA;AACA;AACA;IACaC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAA6C,EAAA;AAAA,EAAA,oBACrEC,UAAU,CACN,UAAAC,IAAA,EAqBIC,YAAY,EACX;AAAA,IAAA,IAAAC,WAAA,CAAA;AAAA,IAAA,IApBGC,MAAM,GAAAH,IAAA,CAANG,MAAM;MACNC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;MACRC,MAAM,GAAAL,IAAA,CAANK,MAAM;MAAAC,YAAA,GAAAN,IAAA,CACNO,OAAO;AAAPA,MAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,YAAA;MACjBE,QAAQ,GAAAR,IAAA,CAARQ,QAAQ;MAAAC,UAAA,GAAAT,IAAA,CACRU,KAAK;AAALA,MAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,UAAU,GAAAA,UAAA;MAClBE,SAAS,GAAAX,IAAA,CAATW,SAAS;MAAAC,cAAA,GAAAZ,IAAA,CACTa,SAAS;AAATA,MAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,G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 'string' && frame !== 'document') {
|
121
121
|
var _document$getElementB;
|
122
|
-
(_document$getElementB = document.getElementById(frame)) === null || _document$getElementB === void 0
|
122
|
+
(_document$getElementB = document.getElementById(frame)) === null || _document$getElementB === void 0 || _document$getElementB.appendChild(portal);
|
123
123
|
} else {
|
124
124
|
document.body.appendChild(portal);
|
125
125
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Popup.js","sources":["../../../src/components/Popup/Popup.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport { useForkRef, safeUseId } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../engines/types';\nimport { cx } from '../../utils';\n\nimport type { PopupPlacementBasic, PopupPlacement, PopupPositionType, PopupProps } from './Popup.types';\nimport { POPUP_PORTAL_ID } from './PopupContext';\nimport { PopupRoot } from './PopupRoot';\nimport { usePopup } from './hooks';\nimport { classes } from './Popup.tokens';\n\nexport const handlePosition = (\n placement: PopupPlacement,\n offset: [number, number] | [string, string],\n): PopupPositionType => {\n let x = '0rem';\n let y = '0rem';\n\n if (offset) {\n const [_x, _y] = offset;\n x = typeof _x === 'number' ? `${_x}rem` : _x;\n y = typeof _y === 'number' ? `${_y}rem` : _y;\n }\n\n if (!placement || placement === 'center') {\n return {\n left: `calc(50% + ${x})`,\n top: `calc(50% - ${y})`,\n transform: 'translate(-50%, -50%)',\n };\n }\n\n let left;\n let right;\n let top;\n let bottom;\n let transform;\n const placements = placement.split('-') as PopupPlacementBasic[];\n\n placements.forEach((placement: PopupPlacementBasic) => {\n switch (placement) {\n case 'left':\n left = x;\n break;\n case 'right':\n right = x;\n break;\n case 'top':\n top = y;\n break;\n case 'bottom':\n bottom = y;\n break;\n default:\n break;\n }\n });\n\n const isCenteredX = left === undefined && right === undefined;\n const isCenteredY = top === undefined && bottom === undefined;\n\n if (isCenteredX) {\n transform = 'translateX(-50%)';\n }\n\n if (isCenteredY) {\n transform = 'translateY(-50%)';\n }\n\n return {\n left: isCenteredX ? `calc(50% + ${x})` : left,\n right,\n top: isCenteredY ? `calc(50% - ${y})` : top,\n bottom,\n transform,\n };\n};\n\n/**\n * Базовый копмонент Popup.\n */\nexport const popupRoot = (Root: RootProps<HTMLDivElement, PopupProps>) =>\n forwardRef<HTMLDivElement, PopupProps>(\n (\n {\n id,\n isOpen = false,\n placement = 'center',\n offset = [0, 0],\n frame = 'document',\n children,\n overlay,\n role,\n zIndex,\n popupInfo,\n withAnimation = false,\n className,\n ...rest\n },\n outerRootRef,\n ) => {\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n\n const { isVisible, animationInfo, setVisible } = usePopup({\n isOpen,\n id: innerId,\n popupInfo,\n withAnimation,\n });\n\n const portalRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n\n const innerRef = useForkRef<HTMLDivElement>(contentRef, outerRootRef);\n\n const [, forceRender] = useState(false);\n\n useEffect(() => {\n let portal = document.getElementById(POPUP_PORTAL_ID);\n\n if (typeof frame !== 'string' && frame && frame.current) {\n portal = frame.current;\n }\n\n if (!portal) {\n portal = document.createElement('div');\n portal.setAttribute('id', POPUP_PORTAL_ID);\n /**\n * Нужно для того, чтобы во фрейме не происходило скачков контента\n * при анимации через transform, если есть элемент с шириной/высотой в 100% (Overlay)\n */\n portal.style.width = '0';\n\n if (typeof frame === 'string' && frame !== 'document') {\n document.getElementById(frame)?.appendChild(portal);\n } else {\n document.body.appendChild(portal);\n }\n }\n\n portalRef.current = portal;\n\n /**\n * Изменение стейта нужно для того, чтобы Popup\n * отобразился после записи DOM элемента в portalRef.current\n */\n forceRender(true);\n }, []);\n\n if (!isVisible && !isOpen) {\n return null;\n }\n\n const cls = cx(\n className,\n animationInfo?.endAnimation ? classes.endAnimation : '',\n animationInfo?.endTransition ? classes.endTransition : '',\n );\n\n return (\n <>\n {portalRef.current &&\n ReactDOM.createPortal(\n <Root className={cls} {...rest}>\n {overlay}\n <PopupRoot\n id={innerId}\n ref={innerRef}\n position={handlePosition(placement, offset)}\n frame={frame}\n zIndex={zIndex}\n animationInfo={animationInfo}\n setVisible={setVisible}\n >\n {children}\n </PopupRoot>\n </Root>,\n portalRef.current,\n )}\n </>\n );\n },\n );\n\nexport const popupConfig = {\n name: 'Popup',\n tag: 'div',\n layout: popupRoot,\n base: '',\n variations: {},\n defaults: {},\n};\n"],"names":["handlePosition","placement","offset","x","y","_offset","_slicedToArray","_x","_y","concat","left","top","transform","right","bottom","placements","split","forEach","isCenteredX","undefined","isCenteredY","popupRoot","Root","forwardRef","_ref","outerRootRef","id","_ref$isOpen","isOpen","_ref$placement","_ref$offset","_ref$frame","frame","children","overlay","zIndex","popupInfo","_ref$withAnimation","withAnimation","className","rest","_objectWithoutProperties","_excluded","uniqId","safeUseId","innerId","_usePopup","usePopup","isVisible","animationInfo","setVisible","portalRef","useRef","contentRef","innerRef","useForkRef","_useState","useState","_useState2","forceRender","useEffect","portal","document","getElementById","POPUP_PORTAL_ID","current","createElement","setAttribute","style","width","_document$getElementB","appendChild","body","cls","cx","endAnimation","classes","endTransition","React","Fragment","ReactDOM","createPortal","_extends","PopupRoot","ref","position","popupConfig","name","tag","layout","base","variations","defaults"],"mappings":";;;;;;;;;;;AAaO,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,CACvBC,SAAyB,EACzBC,MAA2C,EACvB;EACpB,IAAIC,CAAC,GAAG,MAAM,CAAA;EACd,IAAIC,CAAC,GAAG,MAAM,CAAA;AAEd,EAAA,IAAIF,MAAM,EAAE;AACR,IAAA,IAAAG,OAAA,GAAAC,cAAA,CAAiBJ,MAAM,EAAA,CAAA,CAAA;AAAhBK,MAAAA,EAAE,GAAAF,OAAA,CAAA,CAAA,CAAA;AAAEG,MAAAA,EAAE,GAAAH,OAAA,CAAA,CAAA,CAAA,CAAA;IACbF,CAAC,GAAG,OAAOI,EAAE,KAAK,QAAQ,MAAAE,MAAA,CAAMF,EAAE,EAAA,KAAA,CAAA,GAAQA,EAAE,CA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B,YAAY,GAAGC,OAAO,CAACD,YAAY,GAAG,EAAE,EACvD1B,aAAa,KAAA,IAAA,IAAbA,aAAa,KAAbA,KAAAA,CAAAA,IAAAA,aAAa,CAAE4B,aAAa,GAAGD,OAAO,CAACC,aAAa,GAAG,EAC3D,CAAC,CAAA;IAED,oBACIC,KAAA,CAAAZ,aAAA,CAAAY,KAAA,CAAAC,QAAA,EACK5B,IAAAA,EAAAA,SAAS,CAACc,OAAO,iBACde,QAAQ,CAACC,YAAY,eACjBH,KAAA,CAAAZ,aAAA,CAAC5C,IAAI,EAAA4D,QAAA,CAAA;AAAC3C,MAAAA,SAAS,EAAEkC,GAAAA;KAASjC,EAAAA,IAAI,GACzBN,OAAO,eACR4C,KAAA,CAAAZ,aAAA,CAACiB,SAAS,EAAA;AACNzD,MAAAA,EAAE,EAAEmB,OAAQ;AACZuC,MAAAA,GAAG,EAAE9B,QAAS;AACd+B,MAAAA,QAAQ,EAAErF,cAAc,CAACC,SAAS,EAAEC,MAAM,CAAE;AAC5C8B,MAAAA,KAAK,EAAEA,KAAM;AACbG,MAAAA,MAAM,EAAEA,MAAO;AACfc,MAAAA,aAAa,EAAEA,aAAc;AAC7BC,MAAAA,UAAU,EAAEA,UAAAA;KAEXjB,EAAAA,QACM,CACT,CAAC,EACPkB,SAAS,CAACc,OACd,CACN,CAAC,CAAA;AAEX,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMqB,WAAW,GAAG;AACvBC,EAAAA,IAAI,EAAE,OAAO;AACbC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEpE,SAAS;AACjBqE,EAAAA,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE,EAAE;AACdC,EAAAA,QAAQ,EAAE,EAAC;AACf;;;;"}
|
1
|
+
{"version":3,"file":"Popup.js","sources":["../../../src/components/Popup/Popup.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport { useForkRef, safeUseId } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../engines/types';\nimport { cx } from '../../utils';\n\nimport type { PopupPlacementBasic, PopupPlacement, PopupPositionType, PopupProps } from './Popup.types';\nimport { POPUP_PORTAL_ID } from './PopupContext';\nimport { PopupRoot } from './PopupRoot';\nimport { usePopup } from './hooks';\nimport { classes } from './Popup.tokens';\n\nexport const handlePosition = (\n placement: PopupPlacement,\n offset: [number, number] | [string, string],\n): PopupPositionType => {\n let x = '0rem';\n let y = '0rem';\n\n if (offset) {\n const [_x, _y] = offset;\n x = typeof _x === 'number' ? `${_x}rem` : _x;\n y = typeof _y === 'number' ? `${_y}rem` : _y;\n }\n\n if (!placement || placement === 'center') {\n return {\n left: `calc(50% + ${x})`,\n top: `calc(50% - ${y})`,\n transform: 'translate(-50%, -50%)',\n };\n }\n\n let left;\n let right;\n let top;\n let bottom;\n let transform;\n const placements = placement.split('-') as PopupPlacementBasic[];\n\n placements.forEach((placement: PopupPlacementBasic) => {\n switch (placement) {\n case 'left':\n left = x;\n break;\n case 'right':\n right = x;\n break;\n case 'top':\n top = y;\n break;\n case 'bottom':\n bottom = y;\n break;\n default:\n break;\n }\n });\n\n const isCenteredX = left === undefined && right === undefined;\n const isCenteredY = top === undefined && bottom === undefined;\n\n if (isCenteredX) {\n transform = 'translateX(-50%)';\n }\n\n if (isCenteredY) {\n transform = 'translateY(-50%)';\n }\n\n return {\n left: isCenteredX ? `calc(50% + ${x})` : left,\n right,\n top: isCenteredY ? `calc(50% - ${y})` : top,\n bottom,\n transform,\n };\n};\n\n/**\n * Базовый копмонент Popup.\n */\nexport const popupRoot = (Root: RootProps<HTMLDivElement, PopupProps>) =>\n forwardRef<HTMLDivElement, PopupProps>(\n (\n {\n id,\n isOpen = false,\n placement = 'center',\n offset = [0, 0],\n frame = 'document',\n children,\n overlay,\n role,\n zIndex,\n popupInfo,\n withAnimation = false,\n className,\n ...rest\n },\n outerRootRef,\n ) => {\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n\n const { isVisible, animationInfo, setVisible } = usePopup({\n isOpen,\n id: innerId,\n popupInfo,\n withAnimation,\n });\n\n const portalRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n\n const innerRef = useForkRef<HTMLDivElement>(contentRef, outerRootRef);\n\n const [, forceRender] = useState(false);\n\n useEffect(() => {\n let portal = document.getElementById(POPUP_PORTAL_ID);\n\n if (typeof frame !== 'string' && frame && frame.current) {\n portal = frame.current;\n }\n\n if (!portal) {\n portal = document.createElement('div');\n portal.setAttribute('id', POPUP_PORTAL_ID);\n /**\n * Нужно для того, чтобы во фрейме не происходило скачков контента\n * при анимации через transform, если есть элемент с шириной/высотой в 100% (Overlay)\n */\n portal.style.width = '0';\n\n if (typeof frame === 'string' && frame !== 'document') {\n document.getElementById(frame)?.appendChild(portal);\n } else {\n document.body.appendChild(portal);\n }\n }\n\n portalRef.current = portal;\n\n /**\n * Изменение стейта нужно для того, чтобы Popup\n * отобразился после записи DOM элемента в portalRef.current\n */\n forceRender(true);\n }, []);\n\n if (!isVisible && !isOpen) {\n return null;\n }\n\n const cls = cx(\n className,\n animationInfo?.endAnimation ? classes.endAnimation : '',\n animationInfo?.endTransition ? classes.endTransition : '',\n );\n\n return (\n <>\n {portalRef.current &&\n ReactDOM.createPortal(\n <Root className={cls} {...rest}>\n {overlay}\n <PopupRoot\n id={innerId}\n ref={innerRef}\n position={handlePosition(placement, offset)}\n frame={frame}\n zIndex={zIndex}\n animationInfo={animationInfo}\n setVisible={setVisible}\n >\n {children}\n </PopupRoot>\n </Root>,\n portalRef.current,\n )}\n </>\n );\n },\n );\n\nexport const popupConfig = {\n name: 'Popup',\n tag: 'div',\n layout: popupRoot,\n base: '',\n variations: {},\n defaults: {},\n};\n"],"names":["handlePosition","placement","offset","x","y","_offset","_slicedToArray","_x","_y","concat","left","top","transform","right","bottom","placements","split","forEach","isCenteredX","undefined","isCenteredY","popupRoot","Root","forwardRef","_ref","outerRootRef","id","_ref$isOpen","isOpen","_ref$placement","_ref$offset","_ref$frame","frame","children","overlay","zIndex","popupInfo","_ref$withAnimation","withAnimation","className","rest","_objectWithoutProperties","_excluded","uniqId","safeUseId","innerId","_usePopup","usePopup","isVisible","animationInfo","setVisible","portalRef","useRef","contentRef","innerRef","useForkRef","_useState","useState","_useState2","forceRender","useEffect","portal","document","getElementById","POPUP_PORTAL_ID","current","createElement","setAttribute","style","width","_document$getElementB","appendChild","body","cls","cx","endAnimation","classes","endTransition","React","Fragment","ReactDOM","createPortal","_extends","PopupRoot","ref","position","popupConfig","name","tag","layout","base","variations","defaults"],"mappings":";;;;;;;;;;;AAaO,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,CACvBC,SAAyB,EACzBC,MAA2C,EACvB;EACpB,IAAIC,CAAC,GAAG,MAAM,CAAA;EACd,IAAIC,CAAC,GAAG,MAAM,CAAA;AAEd,EAAA,IAAIF,MAAM,EAAE;AACR,IAAA,IAAAG,OAAA,GAAAC,cAAA,CAAiBJ,MAAM,EAAA,CAAA,CAAA;AAAhBK,MAAAA,EAAE,GAAAF,OAAA,CAAA,CAAA,CAAA;AAAEG,MAAAA,EAAE,GAAAH,OAAA,CAAA,CAAA,CAAA,CAAA;IACbF,CAAC,GAAG,OAAOI,EAAE,KAAK,QAAQ,MAAAE,MAAA,CAAMF,EAAE,EAAA,KAAA,CAAA,GAAQA,EAAE,CAAA;IAC5CH,CAAC,GAAG,OAAOI,EAAE,KAAK,QAAQ,MAAAC,MAAA,CAAMD,EAAE,EAAA,KAAA,CAAA,GAAQA,EAAE,CAAA;AAChD,GAAA;AAEA,EAAA,IAAI,CAACP,SAAS,IAAIA,SAAS,KAAK,QAAQ,EAAE;IACtC,OAAO;AACHS,MAAAA,IAAI,EAAAD,aAAAA,CAAAA,MAAA,CAAgBN,CAAC,EAAG,GAAA,CAAA;AACxBQ,MAAAA,GAAG,EAAAF,aAAAA,CAAAA,MAAA,CAAgBL,CAAC,EAAG,GAAA,CAAA;AACvBQ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;AAAC3C,MAAAA,SAAS,EAAEkC,GAAAA;KAASjC,EAAAA,IAAI,GACzBN,OAAO,eACR4C,KAAA,CAAAZ,aAAA,CAACiB,SAAS,EAAA;AACNzD,MAAAA,EAAE,EAAEmB,OAAQ;AACZuC,MAAAA,GAAG,EAAE9B,QAAS;AACd+B,MAAAA,QAAQ,EAAErF,cAAc,CAACC,SAAS,EAAEC,MAAM,CAAE;AAC5C8B,MAAAA,KAAK,EAAEA,KAAM;AACbG,MAAAA,MAAM,EAAEA,MAAO;AACfc,MAAAA,aAAa,EAAEA,aAAc;AAC7BC,MAAAA,UAAU,EAAEA,UAAAA;KAEXjB,EAAAA,QACM,CACT,CAAC,EACPkB,SAAS,CAACc,OACd,CACN,CAAC,CAAA;AAEX,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMqB,WAAW,GAAG;AACvBC,EAAAA,IAAI,EAAE,OAAO;AACbC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEpE,SAAS;AACjBqE,EAAAA,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE,EAAE;AACdC,EAAAA,QAAQ,EAAE,EAAC;AACf;;;;"}
|
@@ -41,8 +41,8 @@ var segmentItemRoot = function segmentItemRoot(Root) {
|
|
41
41
|
if (disabledGroup) {
|
42
42
|
return;
|
43
43
|
}
|
44
|
-
customHandleSelect === null || customHandleSelect === void 0
|
45
|
-
handleSelect === null || handleSelect === void 0
|
44
|
+
customHandleSelect === null || customHandleSelect === void 0 || customHandleSelect(event);
|
45
|
+
handleSelect === null || handleSelect === void 0 || handleSelect(value || ariaLabelDefault);
|
46
46
|
}, [selectionMode]);
|
47
47
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
48
48
|
view: view,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SegmentItem.js","sources":["../../../../../src/components/Segment/ui/SegmentItem/SegmentItem.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from 'react';\nimport type { MouseEvent } from 'react';\nimport { safeUseId } from '@salutejs/plasma-core';\n\nimport type { RootProps } from '../../../../engines/types';\nimport { cx, extractTextFrom } from '../../../../utils';\nimport { classes } from '../../tokens';\nimport { useSegmentInner } from '../../SegmentProvider/SegmentProvider';\n\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { base as pilledCSS } from './variations/_pilled/base';\nimport type { SegmentItemProps } from './SegmentItem.types';\nimport { StyledContent, base } from './SegmentItem.styles';\n\nexport const segmentItemRoot = (Root: RootProps<HTMLLabelElement, SegmentItemProps>) =>\n forwardRef<HTMLLabelElement, SegmentItemProps>((props, outerRef) => {\n const {\n size,\n view,\n id,\n label,\n value,\n pilled,\n customHandleSelect,\n 'aria-label': ariaLabelExternal,\n ...rest\n } = props;\n const { selectionMode, disabledGroup, handleSelect, selectedSegmentItems } = useSegmentInner();\n\n const uniqId = safeUseId();\n const segmentId = id || `label-${uniqId}`;\n\n const ariaLabelDefault = useMemo(() => extractTextFrom(label), [label]);\n const pilledAttr = view !== 'clear' && pilled;\n const pilledClass = pilledAttr ? classes.segmentPilled : undefined;\n\n const isSelected = selectedSegmentItems?.includes(value || ariaLabelDefault);\n const selectedClass = isSelected ? classes.selectedSegmentItem : undefined;\n\n const handleSelectSegment = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n if (disabledGroup) {\n return;\n }\n\n customHandleSelect?.(event);\n handleSelect?.(value || ariaLabelDefault);\n },\n [selectionMode],\n );\n\n return (\n <Root\n view={view}\n size={size}\n id={segmentId}\n ref={outerRef}\n aria-label={ariaLabelExternal || ariaLabelDefault}\n value={value}\n pilled={pilledAttr}\n className={cx(selectedClass, pilledClass)}\n onClick={handleSelectSegment}\n tabIndex={disabledGroup ? -1 : 0}\n disabled={disabledGroup}\n {...rest}\n >\n <StyledContent>{label || value}</StyledContent>\n </Root>\n );\n });\n\nexport const segmentItemConfig = {\n name: 'SegmentItem',\n tag: 'button',\n layout: segmentItemRoot,\n base,\n variations: {\n size: {\n css: sizeCSS,\n },\n view: {\n css: viewCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n pilled: {\n css: pilledCSS,\n attrs: true,\n },\n },\n defaults: {\n view: 'clear',\n size: 'xs',\n },\n};\n"],"names":["segmentItemRoot","Root","forwardRef","props","outerRef","size","view","id","label","value","pilled","customHandleSelect","ariaLabelExternal","rest","_objectWithoutProperties","_excluded","_useSegmentInner","useSegmentInner","selectionMode","disabledGroup","handleSelect","selectedSegmentItems","uniqId","safeUseId","segmentId","concat","ariaLabelDefault","useMemo","extractTextFrom","pilledAttr","pilledClass","classes","segmentPilled","undefined","isSelected","includes","selectedClass","selectedSegmentItem","handleSelectSegment","useCallback","event","React","createElement","_extends","ref","className","cx","onClick","tabIndex","disabled","StyledContent","segmentItemConfig","name","tag","layout","base","variations","css","sizeCSS","viewCSS","disabledCSS","attrs","pilledCSS","defaults"],"mappings":";;;;;;;;;;;;;;IAgBaA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,IAAmD,EAAA;AAAA,EAAA,oBAC/EC,UAAU,CAAqC,UAACC,KAAK,EAAEC,QAAQ,EAAK;AAChE,IAAA,IACIC,IAAI,GASJF,KAAK,CATLE,IAAI;MACJC,IAAI,GAQJH,KAAK,CARLG,IAAI;MACJC,EAAE,GAOFJ,KAAK,CAPLI,EAAE;MACFC,KAAK,GAMLL,KAAK,CANLK,KAAK;MACLC,KAAK,GAKLN,KAAK,CALLM,KAAK;MACLC,MAAM,GAINP,KAAK,CAJLO,MAAM;MACNC,kBAAkB,GAGlBR,KAAK,CAHLQ,kBAAkB;MACJC,iBAAiB,GAE/BT,KAAK,CAFL,YAAY,CAAA;AACTU,MAAAA,IAAI,GAAAC,wBAAA,CACPX,KAAK,EAAAY,SAAA,CAAA,CAAA;AACT,IAAA,IAAAC,gBAAA,GAA6EC,eAAe,EAAE;MAAtFC,aAAa,GAAAF,gBAAA,CAAbE,aAAa;MAAEC,aAAa,GAAAH,gBAAA,CAAbG,aAAa;MAAEC,YAAY,GAAAJ,gBAAA,CAAZI,YAAY;MAAEC,oBAAoB,GAAAL,gBAAA,CAApBK,oBAAoB,CAAA;AAExE,IAAA,IAAMC,MAAM,GAAGC,SAAS,EAAE,CAAA;AAC1B,IAAA,IAAMC,SAAS,GAAGjB,EAAE,aAAAkB,MAAA,CAAaH,MAAM,CAAE,CAAA;IAEzC,IAAMI,gBAAgB,GAAGC,OAAO,CAAC,YAAA;MAAA,OAAMC,eAAe,CAACpB,KAAK,CAAC,CAAA;KAAE,EAAA,CAACA,KAAK,CAAC,CAAC,CAAA;AACvE,IAAA,IAAMqB,UAAU,GAAGvB,IAAI,KAAK,OAAO,IAAII,MAAM,CAAA;IAC7C,IAAMoB,WAAW,GAAGD,UAAU,GAAGE,OAAO,CAACC,aAAa,GAAGC,SAAS,CAAA;AAElE,IAAA,IAAMC,UAAU,GAAGb,oBAAoB,KAAA,IAAA,IAApBA,oBAAoB,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAApBA,oBAAoB,CAAEc,QAAQ,CAAC1B,KAAK,IAAIiB,gBAAgB,CAAC,CAAA;IAC5E,IAAMU,aAAa,GAAGF,UAAU,GAAGH,OAAO,CAACM,mBAAmB,GAAGJ,SAAS,CAAA;AAE1E,IAAA,IAAMK,mBAAmB,GAAGC,WAAW,CACnC,UAACC,KAAoC,EAAK;AACtC,MAAA,IAAIrB,aAAa,EAAE;AACf,QAAA,OAAA;AACJ,OAAA;AAEAR,MAAAA,kBAAkB,aAAlBA,kBAAkB,KAAA,KAAA,CAAA,
|
1
|
+
{"version":3,"file":"SegmentItem.js","sources":["../../../../../src/components/Segment/ui/SegmentItem/SegmentItem.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from 'react';\nimport type { MouseEvent } from 'react';\nimport { safeUseId } from '@salutejs/plasma-core';\n\nimport type { RootProps } from '../../../../engines/types';\nimport { cx, extractTextFrom } from '../../../../utils';\nimport { classes } from '../../tokens';\nimport { useSegmentInner } from '../../SegmentProvider/SegmentProvider';\n\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { base as pilledCSS } from './variations/_pilled/base';\nimport type { SegmentItemProps } from './SegmentItem.types';\nimport { StyledContent, base } from './SegmentItem.styles';\n\nexport const segmentItemRoot = (Root: RootProps<HTMLLabelElement, SegmentItemProps>) =>\n forwardRef<HTMLLabelElement, SegmentItemProps>((props, outerRef) => {\n const {\n size,\n view,\n id,\n label,\n value,\n pilled,\n customHandleSelect,\n 'aria-label': ariaLabelExternal,\n ...rest\n } = props;\n const { selectionMode, disabledGroup, handleSelect, selectedSegmentItems } = useSegmentInner();\n\n const uniqId = safeUseId();\n const segmentId = id || `label-${uniqId}`;\n\n const ariaLabelDefault = useMemo(() => extractTextFrom(label), [label]);\n const pilledAttr = view !== 'clear' && pilled;\n const pilledClass = pilledAttr ? classes.segmentPilled : undefined;\n\n const isSelected = selectedSegmentItems?.includes(value || ariaLabelDefault);\n const selectedClass = isSelected ? classes.selectedSegmentItem : undefined;\n\n const handleSelectSegment = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n if (disabledGroup) {\n return;\n }\n\n customHandleSelect?.(event);\n handleSelect?.(value || ariaLabelDefault);\n },\n [selectionMode],\n );\n\n return (\n <Root\n view={view}\n size={size}\n id={segmentId}\n ref={outerRef}\n aria-label={ariaLabelExternal || ariaLabelDefault}\n value={value}\n pilled={pilledAttr}\n className={cx(selectedClass, pilledClass)}\n onClick={handleSelectSegment}\n tabIndex={disabledGroup ? -1 : 0}\n disabled={disabledGroup}\n {...rest}\n >\n <StyledContent>{label || value}</StyledContent>\n </Root>\n );\n });\n\nexport const segmentItemConfig = {\n name: 'SegmentItem',\n tag: 'button',\n layout: segmentItemRoot,\n base,\n variations: {\n size: {\n css: sizeCSS,\n },\n view: {\n css: viewCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n pilled: {\n css: pilledCSS,\n attrs: true,\n },\n },\n defaults: {\n view: 'clear',\n size: 'xs',\n },\n};\n"],"names":["segmentItemRoot","Root","forwardRef","props","outerRef","size","view","id","label","value","pilled","customHandleSelect","ariaLabelExternal","rest","_objectWithoutProperties","_excluded","_useSegmentInner","useSegmentInner","selectionMode","disabledGroup","handleSelect","selectedSegmentItems","uniqId","safeUseId","segmentId","concat","ariaLabelDefault","useMemo","extractTextFrom","pilledAttr","pilledClass","classes","segmentPilled","undefined","isSelected","includes","selectedClass","selectedSegmentItem","handleSelectSegment","useCallback","event","React","createElement","_extends","ref","className","cx","onClick","tabIndex","disabled","StyledContent","segmentItemConfig","name","tag","layout","base","variations","css","sizeCSS","viewCSS","disabledCSS","attrs","pilledCSS","defaults"],"mappings":";;;;;;;;;;;;;;IAgBaA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,IAAmD,EAAA;AAAA,EAAA,oBAC/EC,UAAU,CAAqC,UAACC,KAAK,EAAEC,QAAQ,EAAK;AAChE,IAAA,IACIC,IAAI,GASJF,KAAK,CATLE,IAAI;MACJC,IAAI,GAQJH,KAAK,CARLG,IAAI;MACJC,EAAE,GAOFJ,KAAK,CAPLI,EAAE;MACFC,KAAK,GAMLL,KAAK,CANLK,KAAK;MACLC,KAAK,GAKLN,KAAK,CALLM,KAAK;MACLC,MAAM,GAINP,KAAK,CAJLO,MAAM;MACNC,kBAAkB,GAGlBR,KAAK,CAHLQ,kBAAkB;MACJC,iBAAiB,GAE/BT,KAAK,CAFL,YAAY,CAAA;AACTU,MAAAA,IAAI,GAAAC,wBAAA,CACPX,KAAK,EAAAY,SAAA,CAAA,CAAA;AACT,IAAA,IAAAC,gBAAA,GAA6EC,eAAe,EAAE;MAAtFC,aAAa,GAAAF,gBAAA,CAAbE,aAAa;MAAEC,aAAa,GAAAH,gBAAA,CAAbG,aAAa;MAAEC,YAAY,GAAAJ,gBAAA,CAAZI,YAAY;MAAEC,oBAA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,12 @@ var selectRoot = function selectRoot(Root) {
|
|
108
108
|
if (rest.valueType === 'multiple') {
|
109
109
|
var _rest$onChangeValue;
|
110
110
|
var _newSelected = getNewSelected(rest.value, newValue, rest.valueType);
|
111
|
-
(_rest$onChangeValue = rest.onChangeValue) === null || _rest$onChangeValue === void 0
|
111
|
+
(_rest$onChangeValue = rest.onChangeValue) === null || _rest$onChangeValue === void 0 || _rest$onChangeValue.call(rest, _newSelected);
|
112
112
|
return;
|
113
113
|
}
|
114
114
|
var newSelected = getNewSelected(rest.value, newValue, 'single');
|
115
|
-
(_rest$onChangeValue2 = rest.onChangeValue) === null || _rest$onChangeValue2 === void 0
|
116
|
-
onInnerToggle === null || onInnerToggle === void 0
|
115
|
+
(_rest$onChangeValue2 = rest.onChangeValue) === null || _rest$onChangeValue2 === void 0 || _rest$onChangeValue2.call(rest, newSelected);
|
116
|
+
onInnerToggle === null || onInnerToggle === void 0 || onInnerToggle(false, event);
|
117
117
|
}, [rest.value, rest.valueType, rest.onChangeValue, onToggle, onInnerToggle]);
|
118
118
|
var onClickChildrenItem = useCallback(function (event) {
|
119
119
|
// INFO: Для корректной работы компонента Popper
|
@@ -128,14 +128,14 @@ var selectRoot = function selectRoot(Root) {
|
|
128
128
|
}
|
129
129
|
var newValue = event.target.value;
|
130
130
|
var newSelected = getNewSelected(rest.value, newValue, 'native');
|
131
|
-
(_rest$onChangeValue3 = rest.onChangeValue) === null || _rest$onChangeValue3 === void 0
|
131
|
+
(_rest$onChangeValue3 = rest.onChangeValue) === null || _rest$onChangeValue3 === void 0 || _rest$onChangeValue3.call(rest, newSelected);
|
132
132
|
}, [rest.value, rest.valueType, rest.onChangeValue]);
|
133
133
|
var onChangeChipValue = useCallback(function (newValue) {
|
134
134
|
var _rest$onChangeValue4;
|
135
135
|
if (rest.valueType !== 'multiple') {
|
136
136
|
return;
|
137
137
|
}
|
138
|
-
(_rest$onChangeValue4 = rest.onChangeValue) === null || _rest$onChangeValue4 === void 0
|
138
|
+
(_rest$onChangeValue4 = rest.onChangeValue) === null || _rest$onChangeValue4 === void 0 || _rest$onChangeValue4.call(rest, newValue);
|
139
139
|
}, [rest.valueType]);
|
140
140
|
var _useKeyNavigation = useKeyNavigation({
|
141
141
|
controlledRefs: controlledRefs,
|