@salutejs/plasma-new-hope 0.76.2-canary.1184.8705168480.0 → 0.76.2-dev.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.css +2 -0
- package/cjs/components/Chip/Chip.js +16 -4
- package/cjs/components/Chip/Chip.js.map +1 -1
- package/cjs/components/Chip/Chip.tokens.js +5 -0
- package/cjs/components/Chip/Chip.tokens.js.map +1 -1
- package/cjs/components/Chip/variations/_pilled/base.js +9 -0
- package/cjs/components/Chip/variations/_pilled/base.js.map +1 -0
- package/cjs/components/Chip/variations/_pilled/base_3kce4h.css +1 -0
- package/cjs/components/Combobox/Combobox.css +2 -0
- 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.css +2 -0
- 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.css +2 -0
- 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.css +2 -0
- package/cjs/components/Pagination/Pagination.js +2 -2
- package/cjs/components/Pagination/Pagination.js.map +1 -1
- package/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
- package/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js.map +1 -1
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +2 -0
- 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.css +2 -0
- 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.css +2 -0
- 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.css +2 -0
- 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 +2 -1
- 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.css +2 -0
- package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
- package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
- package/cjs/components/Toast/ToastProvider/ToastProvider.js +2 -2
- package/cjs/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
- package/cjs/components/Tooltip/Tooltip.js +1 -1
- package/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/cjs/index.css +2 -0
- 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.css +2 -0
- package/es/components/Chip/Chip.js +17 -5
- package/es/components/Chip/Chip.js.map +1 -1
- package/es/components/Chip/Chip.tokens.js +5 -1
- package/es/components/Chip/Chip.tokens.js.map +1 -1
- package/es/components/Chip/variations/_pilled/base.js +5 -0
- package/es/components/Chip/variations/_pilled/base.js.map +1 -0
- package/es/components/Chip/variations/_pilled/base_3kce4h.css +1 -0
- package/es/components/Combobox/Combobox.css +2 -0
- 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.css +2 -0
- 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.css +2 -0
- 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.css +2 -0
- package/es/components/Pagination/Pagination.js +2 -2
- package/es/components/Pagination/Pagination.js.map +1 -1
- package/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
- package/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js.map +1 -1
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +2 -0
- 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.css +2 -0
- 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.css +2 -0
- 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.css +2 -0
- 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 +2 -1
- 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.css +2 -0
- package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
- package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
- package/es/components/Toast/ToastProvider/ToastProvider.js +2 -2
- package/es/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
- package/es/components/Tooltip/Tooltip.js +1 -1
- package/es/components/Tooltip/Tooltip.js.map +1 -1
- package/es/index.css +2 -0
- 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 +17 -5
- package/styled-components/cjs/components/Chip/Chip.styles.js +1 -1
- package/styled-components/cjs/components/Chip/Chip.template-doc.mdx +2 -2
- package/styled-components/cjs/components/Chip/Chip.tokens.js +5 -1
- package/styled-components/cjs/components/Chip/variations/_pilled/base.js +9 -0
- package/styled-components/cjs/components/Chip/variations/_pilled/tokens.json +4 -0
- 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 +3 -2
- 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/Chip/Chip.config.js +10 -7
- package/styled-components/cjs/examples/plasma_b2c/components/Chip/Chip.stories.tsx +18 -2
- package/styled-components/cjs/examples/plasma_b2c/components/Grid/Grid.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Chip/Chip.config.js +10 -7
- package/styled-components/cjs/examples/plasma_web/components/Chip/Chip.stories.tsx +18 -2
- 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 +17 -5
- package/styled-components/es/components/Chip/Chip.template-doc.mdx +2 -2
- package/styled-components/es/components/Chip/Chip.tokens.js +4 -0
- package/styled-components/es/components/Chip/variations/_pilled/base.js +3 -0
- package/styled-components/es/components/Chip/variations/_pilled/tokens.json +4 -0
- 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 +3 -2
- 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/Chip/Chip.config.js +10 -7
- package/styled-components/es/examples/plasma_b2c/components/Chip/Chip.stories.tsx +18 -2
- package/styled-components/es/examples/plasma_b2c/components/Grid/Grid.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Chip/Chip.config.js +10 -7
- package/styled-components/es/examples/plasma_web/components/Chip/Chip.stories.tsx +18 -2
- 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
- package/types/components/Chip/Chip.d.ts +4 -0
- package/types/components/Chip/Chip.d.ts.map +1 -1
- package/types/components/Chip/Chip.tokens.d.ts +4 -0
- package/types/components/Chip/Chip.tokens.d.ts.map +1 -1
- package/types/components/Chip/Chip.types.d.ts +6 -0
- package/types/components/Chip/Chip.types.d.ts.map +1 -1
- package/types/components/Chip/variations/_pilled/base.d.ts +2 -0
- package/types/components/Chip/variations/_pilled/base.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Chip/Chip.config.d.ts +4 -1
- package/types/examples/plasma_b2c/components/Chip/Chip.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Chip/Chip.d.ts +4 -1
- package/types/examples/plasma_b2c/components/Chip/Chip.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Chip/Chip.config.d.ts +4 -1
- package/types/examples/plasma_web/components/Chip/Chip.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Chip/Chip.d.ts +4 -1
- package/types/examples/plasma_web/components/Chip/Chip.d.ts.map +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextField.js","sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef, useState } from 'react';\nimport type { ChangeEventHandler } from 'react';\nimport { safeUseId } from '@salutejs/plasma-core';\nimport { css } from '@linaria/core';\n\nimport type { RootProps } from '../../engines';\nimport { cx } from '../../utils';\n\nimport type { ChipValues, TextFieldPrimitiveValue, TextFieldProps } from './TextField.types';\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 readOnlyCSS } from './variations/_read-only/base';\nimport { base as labelPlacementCSS } from './variations/_label-placement/base';\nimport {\n Input,\n LeftHelper,\n Label,\n InputWrapper,\n InputLabelWrapper,\n StyledContentLeft,\n StyledContentRight,\n StyledChips,\n} from './TextField.styles';\nimport { classes } from './TextField.tokens';\nimport { TextFieldChip } from './ui';\nimport { useKeyNavigation } from './hooks/useKeyNavigation';\n\nexport const base = css`\n /* NOTE: Webkit не применяет opacity к inline тегам */\n display: block;\n overflow: hidden;\n`;\n\nexport const textFieldRoot = (Root: RootProps<HTMLDivElement, TextFieldProps>) =>\n forwardRef<HTMLDivElement, TextFieldProps>(\n (\n {\n id,\n\n // layout\n contentLeft,\n contentRight,\n label,\n labelPlacement,\n placeholder,\n leftHelper,\n enumerationType = 'plain',\n\n // variations\n view,\n size,\n readOnly = false,\n disabled = false,\n\n // controlled\n chips: values,\n\n // events\n onChange,\n onChangeChips,\n onSearch,\n\n ...rest\n },\n ref,\n ) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const chipsRefs = useRef<Array<HTMLButtonElement>>([]);\n\n const controlledRefs = { contentRef, inputRef, chipsRefs };\n\n const [chips, setChips] = useState<Array<ChipValues>>([]);\n\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n const labelId = safeUseId();\n const helperTextId = safeUseId();\n\n const isChipEnumeration = enumerationType === 'chip';\n const hideLabel = (size === 'xs' || isChipEnumeration) && labelPlacement === 'inner';\n const labelInside = size !== 'xs' && labelPlacement === 'inner';\n const innerLabelPlacementValue = hideLabel ? 'outer' : labelPlacement;\n const innerPlaceholderValue = hideLabel ? label : placeholder;\n const innerLabelValue = hideLabel ? undefined : label;\n\n const isChipsVisible = isChipEnumeration && chips?.length;\n const withHasChips = isChipsVisible ? classes.hasChips : undefined;\n const wrapperWithoutLeftContent = !contentLeft && isChipsVisible ? classes.hasEmptyContentLeft : undefined;\n const wrapperWithoutRightContent =\n !contentRight && isChipsVisible ? classes.hasEmptyContentRight : undefined;\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n if (disabled || readOnly) {\n return;\n }\n\n const { maxLength, value } = event.target;\n\n if (maxLength !== -1 && value.length > maxLength) {\n return;\n }\n\n onChange?.(event);\n };\n\n const updateChips = (newChips: Array<ChipValues>, newValues: Array<TextFieldPrimitiveValue>) => {\n setChips(newChips);\n onChangeChips?.(newValues);\n };\n\n const { handleInputKeydown, handleChipKeyDown, onChipClear, handleContentKeyDown } = useKeyNavigation({\n controlledRefs,\n disabled,\n readOnly,\n chips,\n enumerationType,\n updateChips,\n onSearch,\n onChange,\n });\n\n const onChipClick = (event: React.MouseEvent<HTMLButtonElement>) => event.stopPropagation();\n\n const handleInputFocus = () => {\n if (readOnly || disabled || !inputRef?.current) {\n return;\n }\n\n inputRef.current.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n inputRef.current.focus({ preventScroll: true });\n };\n\n const getRef = (element: HTMLButtonElement | null, index: number) => {\n if (element && chipsRefs?.current) {\n chipsRefs.current[index] = element;\n }\n };\n\n useEffect(() => {\n if (!isChipEnumeration && !values?.length) {\n return;\n }\n\n const newChips =\n values?.map((value, index) => ({\n id: `${index}_${value}`,\n text: value,\n })) || [];\n\n setChips(newChips);\n }, [isChipEnumeration, values]);\n\n return (\n <Root\n ref={ref}\n view={view}\n size={size}\n disabled={disabled}\n readOnly={!disabled && readOnly}\n labelPlacement={innerLabelPlacementValue}\n onClick={handleInputFocus}\n >\n {labelInside ||\n (innerLabelValue && (\n <Label id={labelId} htmlFor={id}>\n {innerLabelValue}\n </Label>\n ))}\n <InputWrapper className={cx(withHasChips, wrapperWithoutLeftContent, wrapperWithoutRightContent)}>\n {contentLeft && <StyledContentLeft>{contentLeft}</StyledContentLeft>}\n <InputLabelWrapper\n tabIndex={-1}\n ref={contentRef}\n onKeyDown={handleContentKeyDown}\n className={withHasChips}\n >\n {isChipEnumeration && Boolean(chips?.length) && (\n <StyledChips>\n {chips?.map(({ id: chipId, text }, index) => {\n return (\n <TextFieldChip\n id={chipId}\n ref={(element) => getRef(element, index)}\n key={`${chipId}_${index}`}\n disabled={disabled}\n readOnly={readOnly}\n value={text}\n text={text}\n onKeyDown={(event) => handleChipKeyDown(event, chipId, index)}\n onClear={() => onChipClear(chipId, index)}\n onClick={onChipClick}\n />\n );\n })}\n </StyledChips>\n )}\n <Input\n {...rest}\n ref={inputRef}\n id={innerId}\n aria-labelledby={labelId}\n aria-describedby={helperTextId}\n placeholder={innerPlaceholderValue}\n disabled={disabled}\n readOnly={!disabled && readOnly}\n onChange={handleChange}\n onKeyDown={handleInputKeydown}\n />\n {labelInside && (\n <Label id={labelId} htmlFor={innerId}>\n {innerLabelValue}\n </Label>\n )}\n </InputLabelWrapper>\n {contentRight && <StyledContentRight>{contentRight}</StyledContentRight>}\n </InputWrapper>\n {leftHelper && <LeftHelper id={helperTextId}>{leftHelper}</LeftHelper>}\n </Root>\n );\n },\n );\n\nexport const textFieldConfig = {\n name: 'TextField',\n tag: 'div',\n layout: textFieldRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n readOnly: {\n css: readOnlyCSS,\n attrs: true,\n },\n labelPlacement: {\n css: labelPlacementCSS,\n },\n },\n defaults: {\n size: 'm',\n view: 'default',\n },\n};\n"],"names":["base","textFieldRoot","Root","forwardRef","_ref","ref","id","contentLeft","contentRight","label","labelPlacement","placeholder","leftHelper","_ref$enumerationType","enumerationType","view","size","_ref$readOnly","readOnly","_ref$disabled","disabled","values","chips","onChange","onChangeChips","onSearch","rest","contentRef","useRef","inputRef","chipsRefs","controlledRefs","_useState","useState","_useState2","_slicedToArray","setChips","uniqId","safeUseId","innerId","labelId","helperTextId","isChipEnumeration","hideLabel","labelInside","innerLabelPlacementValue","innerPlaceholderValue","innerLabelValue","undefined","isChipsVisible","length","withHasChips","classes","hasChips","wrapperWithoutLeftContent","hasEmptyContentLeft","wrapperWithoutRightContent","hasEmptyContentRight","handleChange","event","_event$target","target","maxLength","value","updateChips","newChips","newValues","_useKeyNavigation","useKeyNavigation","handleInputKeydown","handleChipKeyDown","onChipClear","handleContentKeyDown","onChipClick","stopPropagation","handleInputFocus","current","scrollIntoView","behavior","block","inline","focus","preventScroll","getRef","element","index","useEffect","map","concat","text","React","createElement","onClick","Label","htmlFor","InputWrapper","className","cx","StyledContentLeft","InputLabelWrapper","tabIndex","onKeyDown","Boolean","StyledChips","_ref2","chipId","TextFieldChip","key","onClear","Input","_extends","StyledContentRight","LeftHelper","textFieldConfig","name","tag","layout","variations","css","viewCSS","sizeCSS","disabledCSS","attrs","readOnlyCSS","labelPlacementCSS","defaults"],"mappings":";;;;;;;;;;;;;;;AA4BO,IAAMA,IAAI,GAIhB,UAAA;IAEYC,aAAa,GAAGA,SAAhBA,aAAaA,CAAIC,IAA+C,EAAA;AAAA,EAAA,oBACzEC,UAAU,CACN,UAAAC,IAAA,EA6BIC,GAAG,EACF;AAAA,IAAA,IA5BGC,EAAE,GAAAF,IAAA,CAAFE,EAAE;MAGFC,WAAW,GAAAH,IAAA,CAAXG,WAAW;MACXC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;MACZC,KAAK,GAAAL,IAAA,CAALK,KAAK;MACLC,cAAc,GAAAN,IAAA,CAAdM,cAAc;MACdC,WAAW,GAAAP,IAAA,CAAXO,WAAW;MACXC,UAAU,GAAAR,IAAA,CAAVQ,UAAU;MAAAC,oBAAA,GAAAT,IAAA,CACVU,eAAe;AAAfA,MAAAA,eAAe,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,oBAAA;MAGzBE,IAAI,GAAAX,IAAA,CAAJW,IAAI;MACJC,IAAI,GAAAZ,IAAA,CAAJY,IAAI;MAAAC,aAAA,GAAAb,IAAA,CACJc,QAAQ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,EAAAA,QAAQ,EAAE;AACN7G,IAAAA,IAAI,EAAE,GAAG;AACTD,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;"}
|
1
|
+
{"version":3,"file":"TextField.js","sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef, useState } from 'react';\nimport type { ChangeEventHandler } from 'react';\nimport { safeUseId } from '@salutejs/plasma-core';\nimport { css } from '@linaria/core';\n\nimport type { RootProps } from '../../engines';\nimport { cx } from '../../utils';\n\nimport type { ChipValues, TextFieldPrimitiveValue, TextFieldProps } from './TextField.types';\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 readOnlyCSS } from './variations/_read-only/base';\nimport { base as labelPlacementCSS } from './variations/_label-placement/base';\nimport {\n Input,\n LeftHelper,\n Label,\n InputWrapper,\n InputLabelWrapper,\n StyledContentLeft,\n StyledContentRight,\n StyledChips,\n} from './TextField.styles';\nimport { classes } from './TextField.tokens';\nimport { TextFieldChip } from './ui';\nimport { useKeyNavigation } from './hooks/useKeyNavigation';\n\nexport const base = css`\n /* NOTE: Webkit не применяет opacity к inline тегам */\n display: block;\n overflow: hidden;\n`;\n\nexport const textFieldRoot = (Root: RootProps<HTMLDivElement, TextFieldProps>) =>\n forwardRef<HTMLDivElement, TextFieldProps>(\n (\n {\n id,\n\n // layout\n contentLeft,\n contentRight,\n label,\n labelPlacement,\n placeholder,\n leftHelper,\n enumerationType = 'plain',\n\n // variations\n view,\n size,\n readOnly = false,\n disabled = false,\n\n // controlled\n chips: values,\n\n // events\n onChange,\n onChangeChips,\n onSearch,\n\n ...rest\n },\n ref,\n ) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const chipsRefs = useRef<Array<HTMLButtonElement>>([]);\n\n const controlledRefs = { contentRef, inputRef, chipsRefs };\n\n const [chips, setChips] = useState<Array<ChipValues>>([]);\n\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n const labelId = safeUseId();\n const helperTextId = safeUseId();\n\n const isChipEnumeration = enumerationType === 'chip';\n const hideLabel = (size === 'xs' || isChipEnumeration) && labelPlacement === 'inner';\n const labelInside = size !== 'xs' && labelPlacement === 'inner';\n const innerLabelPlacementValue = hideLabel ? 'outer' : labelPlacement;\n const innerPlaceholderValue = hideLabel ? label : placeholder;\n const innerLabelValue = hideLabel ? undefined : label;\n\n const isChipsVisible = isChipEnumeration && chips?.length;\n const withHasChips = isChipsVisible ? classes.hasChips : undefined;\n const wrapperWithoutLeftContent = !contentLeft && isChipsVisible ? classes.hasEmptyContentLeft : undefined;\n const wrapperWithoutRightContent =\n !contentRight && isChipsVisible ? classes.hasEmptyContentRight : undefined;\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n if (disabled || readOnly) {\n return;\n }\n\n const { maxLength, value } = event.target;\n\n if (maxLength !== -1 && value.length > maxLength) {\n return;\n }\n\n onChange?.(event);\n };\n\n const updateChips = (newChips: Array<ChipValues>, newValues: Array<TextFieldPrimitiveValue>) => {\n setChips(newChips);\n onChangeChips?.(newValues);\n };\n\n const { handleInputKeydown, handleChipKeyDown, onChipClear, handleContentKeyDown } = useKeyNavigation({\n controlledRefs,\n disabled,\n readOnly,\n chips,\n enumerationType,\n updateChips,\n onSearch,\n onChange,\n });\n\n const onChipClick = (event: React.MouseEvent<HTMLButtonElement>) => event.stopPropagation();\n\n const handleInputFocus = () => {\n if (readOnly || disabled || !inputRef?.current) {\n return;\n }\n\n inputRef.current.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n inputRef.current.focus({ preventScroll: true });\n };\n\n const getRef = (element: HTMLButtonElement | null, index: number) => {\n if (element && chipsRefs?.current) {\n chipsRefs.current[index] = element;\n }\n };\n\n useEffect(() => {\n if (!isChipEnumeration && !values?.length) {\n return;\n }\n\n const newChips =\n values?.map((value, index) => ({\n id: `${index}_${value}`,\n text: value,\n })) || [];\n\n setChips(newChips);\n }, [isChipEnumeration, values]);\n\n return (\n <Root\n ref={ref}\n view={view}\n size={size}\n disabled={disabled}\n readOnly={!disabled && readOnly}\n labelPlacement={innerLabelPlacementValue}\n onClick={handleInputFocus}\n >\n {labelInside ||\n (innerLabelValue && (\n <Label id={labelId} htmlFor={id}>\n {innerLabelValue}\n </Label>\n ))}\n <InputWrapper className={cx(withHasChips, wrapperWithoutLeftContent, wrapperWithoutRightContent)}>\n {contentLeft && <StyledContentLeft>{contentLeft}</StyledContentLeft>}\n <InputLabelWrapper\n tabIndex={-1}\n ref={contentRef}\n onKeyDown={handleContentKeyDown}\n className={withHasChips}\n >\n {isChipEnumeration && Boolean(chips?.length) && (\n <StyledChips>\n {chips?.map(({ id: chipId, text }, index) => {\n return (\n <TextFieldChip\n id={chipId}\n ref={(element) => getRef(element, index)}\n key={`${chipId}_${index}`}\n disabled={disabled}\n readOnly={readOnly}\n value={text}\n text={text}\n onKeyDown={(event) => handleChipKeyDown(event, chipId, index)}\n onClear={() => onChipClear(chipId, index)}\n onClick={onChipClick}\n />\n );\n })}\n </StyledChips>\n )}\n <Input\n {...rest}\n ref={inputRef}\n id={innerId}\n aria-labelledby={labelId}\n aria-describedby={helperTextId}\n placeholder={innerPlaceholderValue}\n disabled={disabled}\n readOnly={!disabled && readOnly}\n onChange={handleChange}\n onKeyDown={handleInputKeydown}\n />\n {labelInside && (\n <Label id={labelId} htmlFor={innerId}>\n {innerLabelValue}\n </Label>\n )}\n </InputLabelWrapper>\n {contentRight && <StyledContentRight>{contentRight}</StyledContentRight>}\n </InputWrapper>\n {leftHelper && <LeftHelper id={helperTextId}>{leftHelper}</LeftHelper>}\n </Root>\n );\n },\n );\n\nexport const textFieldConfig = {\n name: 'TextField',\n tag: 'div',\n layout: textFieldRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n readOnly: {\n css: readOnlyCSS,\n attrs: true,\n },\n labelPlacement: {\n css: labelPlacementCSS,\n },\n },\n defaults: {\n size: 'm',\n view: 'default',\n },\n};\n"],"names":["base","textFieldRoot","Root","forwardRef","_ref","ref","id","contentLeft","contentRight","label","labelPlacement","placeholder","leftHelper","_ref$enumerationType","enumerationType","view","size","_ref$readOnly","readOnly","_ref$disabled","disabled","values","chips","onChange","onChangeChips","onSearch","rest","contentRef","useRef","inputRef","chipsRefs","controlledRefs","_useState","useState","_useState2","_slicedToArray","setChips","uniqId","safeUseId","innerId","labelId","helperTextId","isChipEnumeration","hideLabel","labelInside","innerLabelPlacementValue","innerPlaceholderValue","innerLabelValue","undefined","isChipsVisible","length","withHasChips","classes","hasChips","wrapperWithoutLeftContent","hasEmptyContentLeft","wrapperWithoutRightContent","hasEmptyContentRight","handleChange","event","_event$target","target","maxLength","value","updateChips","newChips","newValues","_useKeyNavigation","useKeyNavigation","handleInputKeydown","handleChipKeyDown","onChipClear","handleContentKeyDown","onChipClick","stopPropagation","handleInputFocus","current","scrollIntoView","behavior","block","inline","focus","preventScroll","getRef","element","index","useEffect","map","concat","text","React","createElement","onClick","Label","htmlFor","InputWrapper","className","cx","StyledContentLeft","InputLabelWrapper","tabIndex","onKeyDown","Boolean","StyledChips","_ref2","chipId","TextFieldChip","key","onClear","Input","_extends","StyledContentRight","LeftHelper","textFieldConfig","name","tag","layout","variations","css","viewCSS","sizeCSS","disabledCSS","attrs","readOnlyCSS","labelPlacementCSS","defaults"],"mappings":";;;;;;;;;;;;;;;AA4BO,IAAMA,IAAI,GAIhB,UAAA;IAEYC,aAAa,GAAGA,SAAhBA,aAAaA,CAAIC,IAA+C,EAAA;AAAA,EAAA,oBACzEC,UAAU,CACN,UAAAC,IAAA,EA6BIC,GAAG,EACF;AAAA,IAAA,IA5BGC,EAAE,GAAAF,IAAA,CAAFE,EAAE;MAGFC,WAAW,GAAAH,IAAA,CAAXG,WAAW;MACXC,YAAY,GAAAJ,IAAA,CAAZ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qH,EAAAA,UAAU,EAAE;AACRtG,IAAAA,IAAI,EAAE;AACFuG,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACDvG,IAAAA,IAAI,EAAE;AACFsG,MAAAA,GAAG,EAAEE,MAAAA;KACR;AACDpG,IAAAA,QAAQ,EAAE;AACNkG,MAAAA,GAAG,EAAEG,MAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;KACV;AACDxG,IAAAA,QAAQ,EAAE;AACNoG,MAAAA,GAAG,EAAEK,MAAW;AAChBD,MAAAA,KAAK,EAAE,IAAA;KACV;AACDhH,IAAAA,cAAc,EAAE;AACZ4G,MAAAA,GAAG,EAAEM,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN7G,IAAAA,IAAI,EAAE,GAAG;AACTD,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;"}
|
@@ -44,15 +44,15 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
44
44
|
});
|
45
45
|
updateChips(newChips, newValues);
|
46
46
|
event.target.value = '';
|
47
|
-
onChange === null || onChange === void 0
|
47
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
48
48
|
}
|
49
49
|
if (event.key === Keys.Enter && onSearch) {
|
50
50
|
onSearch(value, event);
|
51
51
|
}
|
52
|
-
if (event.key === Keys.Backspace && chips.length && (inputRef === null || inputRef === void 0
|
52
|
+
if (event.key === Keys.Backspace && chips.length && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.selectionStart) === 0) {
|
53
53
|
var _newChips = _toConsumableArray(chips);
|
54
|
-
_newChips === null || _newChips === void 0
|
55
|
-
chipsRefs === null || chipsRefs === void 0
|
54
|
+
_newChips === null || _newChips === void 0 ? void 0 : _newChips.pop();
|
55
|
+
chipsRefs === null || chipsRefs === void 0 ? void 0 : chipsRefs.current.pop();
|
56
56
|
var _newValues = _newChips.map(function (_ref4) {
|
57
57
|
var text = _ref4.text;
|
58
58
|
return text;
|
@@ -72,7 +72,7 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
72
72
|
var text = _ref6.text;
|
73
73
|
return text;
|
74
74
|
});
|
75
|
-
chipsRefs === null || chipsRefs === void 0
|
75
|
+
chipsRefs === null || chipsRefs === void 0 ? void 0 : chipsRefs.current.splice(index, 1);
|
76
76
|
updateChips(newChips, newValues);
|
77
77
|
};
|
78
78
|
var handleChipKeyDown = function handleChipKeyDown(event, chipId, chipIndex) {
|
@@ -86,7 +86,7 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
86
86
|
var handleContentKeyDown = function handleContentKeyDown(event) {
|
87
87
|
var _inputRef$current2, _focusedItem, _focusedItem2;
|
88
88
|
var chipsRefsCount = chipsRefs.current.length;
|
89
|
-
var currentCaretPosition = (inputRef === null || inputRef === void 0
|
89
|
+
var currentCaretPosition = (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.selectionStart) || 0;
|
90
90
|
var newActiveChipIndex = activeChipIndex;
|
91
91
|
var focusedItem = null;
|
92
92
|
if (event.key === Keys.ArrowLeft && enumerationType === 'chip' && currentCaretPosition <= 0) {
|
@@ -105,10 +105,10 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
105
105
|
var _chipsRefs$current3;
|
106
106
|
var _index2 = activeChipIndex - 1 <= 0 ? 0 : activeChipIndex - 1;
|
107
107
|
newActiveChipIndex = chipsRefsCount === 0 ? -1 : _index2;
|
108
|
-
focusedItem = chipsRefsCount === 0 ? inputRef === null || inputRef === void 0 ? void 0 : inputRef.current : chipsRefs === null || chipsRefs === void 0
|
108
|
+
focusedItem = chipsRefsCount === 0 ? inputRef === null || inputRef === void 0 ? void 0 : inputRef.current : chipsRefs === null || chipsRefs === void 0 ? void 0 : (_chipsRefs$current3 = chipsRefs.current) === null || _chipsRefs$current3 === void 0 ? void 0 : _chipsRefs$current3[newActiveChipIndex];
|
109
109
|
}
|
110
|
-
(_focusedItem = focusedItem) === null || _focusedItem === void 0
|
111
|
-
(_focusedItem2 = focusedItem) === null || _focusedItem2 === void 0
|
110
|
+
(_focusedItem = focusedItem) === null || _focusedItem === void 0 ? void 0 : _focusedItem.focus();
|
111
|
+
(_focusedItem2 = focusedItem) === null || _focusedItem2 === void 0 ? void 0 : _focusedItem2.scrollIntoView({
|
112
112
|
behavior: 'smooth',
|
113
113
|
block: 'center',
|
114
114
|
inline: 'center'
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useKeyNavigation.js","sources":["../../../../src/components/TextField/hooks/useKeyNavigation.ts"],"sourcesContent":["import { useState } from 'react';\nimport type { ChangeEvent, KeyboardEvent } from 'react';\n\nimport type { UseKeyNavigationProps } from '../TextField.types';\n\nexport const Keys = {\n Enter: 'Enter',\n Tab: 'Tab',\n Escape: 'Escape',\n ArrowLeft: 'ArrowLeft',\n ArrowRight: 'ArrowRight',\n Backspace: 'Backspace',\n};\n\nexport const useKeyNavigation = ({\n controlledRefs: { chipsRefs, contentRef, inputRef },\n disabled,\n readOnly,\n chips,\n enumerationType,\n updateChips,\n onChange,\n onSearch,\n}: UseKeyNavigationProps) => {\n const [activeChipIndex, setActiveChipIndex] = useState(-1);\n\n const handleInputKeydown = (event: ChangeEvent<HTMLInputElement> & KeyboardEvent<HTMLInputElement>) => {\n const { value } = event.target as HTMLInputElement;\n\n if (disabled || readOnly) {\n return;\n }\n\n if (event.key === Keys.Enter && enumerationType === 'chip' && value) {\n const nextIndex = chips?.length || 0;\n\n const newChips = [...chips, { id: `${nextIndex}_${value}`, text: value }];\n const newValues = newChips.map(({ text }) => text);\n\n updateChips(newChips, newValues);\n event.target.value = '';\n onChange?.(event);\n }\n\n if (event.key === Keys.Enter && onSearch) {\n onSearch(value, event);\n }\n\n if (event.key === Keys.Backspace && chips.length && inputRef?.current?.selectionStart === 0) {\n const newChips = [...chips];\n newChips?.pop();\n chipsRefs?.current.pop();\n\n const newValues = newChips.map(({ text }) => text);\n\n updateChips(newChips, newValues);\n }\n };\n\n const onChipClear = (clearId: string, index: number) => {\n if (!chips.length) {\n return;\n }\n\n const newChips = chips?.filter(({ id: chipId }) => chipId !== clearId) || [];\n const newValues = newChips.map(({ text }) => text);\n chipsRefs?.current.splice(index, 1);\n\n updateChips(newChips, newValues);\n };\n\n const handleChipKeyDown = (event: KeyboardEvent<HTMLButtonElement>, chipId: string, chipIndex: number) => {\n if (event.key === Keys.Tab) {\n event.preventDefault();\n }\n\n if (event.key === Keys.Backspace) {\n onChipClear(chipId, chipIndex);\n }\n };\n\n const handleContentKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const chipsRefsCount = chipsRefs.current.length;\n const currentCaretPosition = inputRef?.current?.selectionStart || 0;\n\n let newActiveChipIndex = activeChipIndex;\n let focusedItem: HTMLButtonElement | HTMLInputElement | null = null;\n\n if (event.key === Keys.ArrowLeft && enumerationType === 'chip' && currentCaretPosition <= 0) {\n const index = activeChipIndex - 1 <= 0 ? 0 : activeChipIndex - 1;\n\n newActiveChipIndex = document.activeElement === inputRef?.current ? chipsRefsCount - 1 : index;\n\n focusedItem = chipsRefs.current?.[newActiveChipIndex];\n }\n\n if (\n event.key === Keys.ArrowRight &&\n enumerationType === 'chip' &&\n document.activeElement !== inputRef?.current\n ) {\n const index = activeChipIndex + 1 >= chipsRefsCount ? activeChipIndex : activeChipIndex + 1;\n\n newActiveChipIndex = document.activeElement === contentRef?.current ? 0 : index;\n focusedItem =\n index === activeChipIndex\n ? (inputRef?.current as HTMLInputElement)\n : chipsRefs.current?.[newActiveChipIndex];\n }\n\n if (event.key === Keys.Backspace && document.activeElement !== inputRef?.current) {\n const index = activeChipIndex - 1 <= 0 ? 0 : activeChipIndex - 1;\n\n newActiveChipIndex = chipsRefsCount === 0 ? -1 : index;\n focusedItem =\n chipsRefsCount === 0\n ? (inputRef?.current as HTMLInputElement)\n : chipsRefs?.current?.[newActiveChipIndex];\n }\n\n focusedItem?.focus();\n focusedItem?.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n\n setActiveChipIndex(newActiveChipIndex);\n };\n\n return { handleInputKeydown, handleChipKeyDown, onChipClear, handleContentKeyDown } as const;\n};\n"],"names":["Keys","Enter","Tab","Escape","ArrowLeft","ArrowRight","Backspace","useKeyNavigation","_ref","_ref$controlledRefs","controlledRefs","chipsRefs","contentRef","inputRef","disabled","readOnly","chips","enumerationType","updateChips","onChange","onSearch","_useState","useState","_useState2","_slicedToArray","activeChipIndex","setActiveChipIndex","handleInputKeydown","event","_inputRef$current","_ref2","target","value","key","nextIndex","length","newChips","concat","_toConsumableArray","id","text","newValues","map","_ref3","current","selectionStart","pop","_ref4","onChipClear","clearId","index","filter","_ref5","chipId","_ref6","splice","handleChipKeyDown","chipIndex","preventDefault","handleContentKeyDown","_inputRef$current2","_focusedItem","_focusedItem2","chipsRefsCount","currentCaretPosition","newActiveChipIndex","focusedItem","_chipsRefs$current","document","activeElement","_chipsRefs$current2","_chipsRefs$current3","focus","scrollIntoView","behavior","block","inline"],"mappings":";;;AAKO,IAAMA,IAAI,GAAG;AAChBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,SAAS,EAAE,WAAA;AACf,EAAC;IAEYC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EASA;AAAA,EAAA,IAAAC,mBAAA,GAAAD,IAAA,CARzBE,cAAc;IAAIC,SAAS,GAAAF,mBAAA,CAATE,SAAS;IAAEC,UAAU,GAAAH,mBAAA,CAAVG,UAAU;IAAEC,QAAQ,GAAAJ,mBAAA,CAARI,QAAQ;IACjDC,QAAQ,GAAAN,IAAA,CAARM,QAAQ;IACRC,QAAQ,GAAAP,IAAA,C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ation.js","sources":["../../../../src/components/TextField/hooks/useKeyNavigation.ts"],"sourcesContent":["import { useState } from 'react';\nimport type { ChangeEvent, KeyboardEvent } from 'react';\n\nimport type { UseKeyNavigationProps } from '../TextField.types';\n\nexport const Keys = {\n Enter: 'Enter',\n Tab: 'Tab',\n Escape: 'Escape',\n ArrowLeft: 'ArrowLeft',\n ArrowRight: 'ArrowRight',\n Backspace: 'Backspace',\n};\n\nexport const useKeyNavigation = ({\n controlledRefs: { chipsRefs, contentRef, inputRef },\n disabled,\n readOnly,\n chips,\n enumerationType,\n updateChips,\n onChange,\n onSearch,\n}: UseKeyNavigationProps) => {\n const [activeChipIndex, setActiveChipIndex] = useState(-1);\n\n const handleInputKeydown = (event: ChangeEvent<HTMLInputElement> & KeyboardEvent<HTMLInputElement>) => {\n const { value } = event.target as HTMLInputElement;\n\n if (disabled || readOnly) {\n return;\n }\n\n if (event.key === Keys.Enter && enumerationType === 'chip' && value) {\n const nextIndex = chips?.length || 0;\n\n const newChips = [...chips, { id: `${nextIndex}_${value}`, text: value }];\n const newValues = newChips.map(({ text }) => text);\n\n updateChips(newChips, newValues);\n event.target.value = '';\n onChange?.(event);\n }\n\n if (event.key === Keys.Enter && onSearch) {\n onSearch(value, event);\n }\n\n if (event.key === Keys.Backspace && chips.length && inputRef?.current?.selectionStart === 0) {\n const newChips = [...chips];\n newChips?.pop();\n chipsRefs?.current.pop();\n\n const newValues = newChips.map(({ text }) => text);\n\n updateChips(newChips, newValues);\n }\n };\n\n const onChipClear = (clearId: string, index: number) => {\n if (!chips.length) {\n return;\n }\n\n const newChips = chips?.filter(({ id: chipId }) => chipId !== clearId) || [];\n const newValues = newChips.map(({ text }) => text);\n chipsRefs?.current.splice(index, 1);\n\n updateChips(newChips, newValues);\n };\n\n const handleChipKeyDown = (event: KeyboardEvent<HTMLButtonElement>, chipId: string, chipIndex: number) => {\n if (event.key === Keys.Tab) {\n event.preventDefault();\n }\n\n if (event.key === Keys.Backspace) {\n onChipClear(chipId, chipIndex);\n }\n };\n\n const handleContentKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const chipsRefsCount = chipsRefs.current.length;\n const currentCaretPosition = inputRef?.current?.selectionStart || 0;\n\n let newActiveChipIndex = activeChipIndex;\n let focusedItem: HTMLButtonElement | HTMLInputElement | null = null;\n\n if (event.key === Keys.ArrowLeft && enumerationType === 'chip' && currentCaretPosition <= 0) {\n const index = activeChipIndex - 1 <= 0 ? 0 : activeChipIndex - 1;\n\n newActiveChipIndex = document.activeElement === inputRef?.current ? chipsRefsCount - 1 : index;\n\n focusedItem = chipsRefs.current?.[newActiveChipIndex];\n }\n\n if (\n event.key === Keys.ArrowRight &&\n enumerationType === 'chip' &&\n document.activeElement !== inputRef?.current\n ) {\n const index = activeChipIndex + 1 >= chipsRefsCount ? activeChipIndex : activeChipIndex + 1;\n\n newActiveChipIndex = document.activeElement === contentRef?.current ? 0 : index;\n focusedItem =\n index === activeChipIndex\n ? (inputRef?.current as HTMLInputElement)\n : chipsRefs.current?.[newActiveChipIndex];\n }\n\n if (event.key === Keys.Backspace && document.activeElement !== inputRef?.current) {\n const index = activeChipIndex - 1 <= 0 ? 0 : activeChipIndex - 1;\n\n newActiveChipIndex = chipsRefsCount === 0 ? -1 : index;\n focusedItem =\n chipsRefsCount === 0\n ? (inputRef?.current as HTMLInputElement)\n : chipsRefs?.current?.[newActiveChipIndex];\n }\n\n focusedItem?.focus();\n focusedItem?.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n\n setActiveChipIndex(newActiveChipIndex);\n };\n\n return { handleInputKeydown, handleChipKeyDown, onChipClear, handleContentKeyDown } as const;\n};\n"],"names":["Keys","Enter","Tab","Escape","ArrowLeft","ArrowRight","Backspace","useKeyNavigation","_ref","_ref$controlledRefs","controlledRefs","chipsRefs","contentRef","inputRef","disabled","readOnly","chips","enumerationType","updateChips","onChange","onSearch","_useState","useState","_useState2","_slicedToArray","activeChipIndex","setActiveChipIndex","handleInputKeydown","event","_inputRef$current","_ref2","target","value","key","nextIndex","length","newChips","concat","_toConsumableArray","id","text","newValues","map","_ref3","current","selectionStart","pop","_ref4","onChipClear","clearId","index","filter","_ref5","chipId","_ref6","splice","handleChipKeyDown","chipIndex","preventDefault","handleContentKeyDown","_inputRef$current2","_focusedItem","_focusedItem2","chipsRefsCount","currentCaretPosition","newActiveChipIndex","focusedItem","_chipsRefs$current","document","activeElement","_chipsRefs$current2","_chipsRefs$current3","focus","scrollIntoView","behavior","block","inline"],"mappings":";;;AAKO,IAAMA,IAAI,GAAG;AAChBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,SAAS,EAAE,WAAA;AACf,EAAC;IAEYC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EASA;AAAA,EAAA,IAAAC,mBAAA,GAAAD,IAAA,CARzBE,cAAc;IAAIC,SAAS,GAAAF,mBAAA,CAATE,SAAS;IAAEC,UAAU,GAAAH,mBAAA,CAAVG,UAAU;IAAEC,QAAQ,GAAAJ,mBAAA,CAARI,QAAQ;IACjDC,QAAQ,GAAAN,IAAA,CAARM,QAAQ;IACRC,QAAQ,GAAAP,IAAA,CAARO,QAAQ;IACRC,KAAK,GAAAR,IAAA,CAALQ,KAAK;IACLC,eAAe,GAAAT,IAAA,CAAfS,eAAe;IACfC,WAAW,GAAAV,IAAA,CAAXU,WAAW;IACXC,QAAQ,GAAAX,IAAA,CAARW,QAAQ;IACRC,QAAQ,GAAAZ,IAAA,CAARY,QAAQ,CAAA;AAER,EAAA,IAAAC,SAAA,GAA8CC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAnDI,IAAAA,eAAe,GAAAF,UAAA,CAAA,CAAA,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AA,IAAAA,QAAQ,KAARA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,QAAQ,CAAE+B,OAAO,GAClBjC,SAAS,KAATA,IAAAA,IAAAA,SAAS,KAAA4D,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,CAAAA,mBAAA,GAAT5D,SAAS,CAAEiC,OAAO,MAAA2B,IAAAA,IAAAA,mBAAA,KAAlBA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,mBAAA,CAAqBN,kBAAkB,CAAC,CAAA;AACtD,KAAA;IAEA,CAAAJ,YAAA,GAAAK,WAAW,MAAAL,IAAAA,IAAAA,YAAA,uBAAXA,YAAA,CAAaW,KAAK,EAAE,CAAA;IACpB,CAAAV,aAAA,GAAAI,WAAW,MAAA,IAAA,IAAAJ,aAAA,KAAXA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,aAAA,CAAaW,cAAc,CAAC;AACxBC,MAAAA,QAAQ,EAAE,QAAQ;AAClBC,MAAAA,KAAK,EAAE,QAAQ;AACfC,MAAAA,MAAM,EAAE,QAAA;AACZ,KAAC,CAAC,CAAA;IAEFlD,kBAAkB,CAACuC,kBAAkB,CAAC,CAAA;GACzC,CAAA;EAED,OAAO;AAAEtC,IAAAA,kBAAkB,EAAlBA,kBAAkB;AAAE6B,IAAAA,iBAAiB,EAAjBA,iBAAiB;AAAER,IAAAA,WAAW,EAAXA,WAAW;AAAEW,IAAAA,oBAAoB,EAApBA,oBAAAA;GAAsB,CAAA;AACvF;;;;"}
|
@@ -10,6 +10,8 @@
|
|
10
10
|
|
11
11
|
.base_kgtz8x_b16hf96__46a206b1{--plasma_private-chip-outline-size:var(--plasma-chip-outline-size,0.125rem);position:relative;}.base_kgtz8x_b16hf96__46a206b1:focus{outline:none;}.base_kgtz8x_b16hf96__46a206b1::before{content:'';position:absolute;top:calc(-1 * var(--plasma_private-chip-outline-size));left:calc(-1 * var(--plasma_private-chip-outline-size));right:calc(-1 * var(--plasma_private-chip-outline-size));bottom:calc(-1 * var(--plasma_private-chip-outline-size));z-index:1;display:block;box-sizing:content-box;border:var(--plasma_private-chip-outline-size) solid transparent;border-radius:calc(var(--plasma-chip-border-radius) + var(--plasma_private-chip-outline-size));-webkit-transition:box-shadow 0.2s ease-in-out;transition:box-shadow 0.2s ease-in-out;pointer-events:none;}.base_kgtz8x_b16hf96__46a206b1.base_kgtz8x_focusVisible__46a206b1:focus::before,.base_kgtz8x_b16hf96__46a206b1[data-focus-visible-added]::before{outline:none;box-shadow:0 0 0 var(--plasma_private-chip-outline-size) var(--plasma-chip-focus-color);}
|
12
12
|
|
13
|
+
.base_3kce4h_bvcavwi__c6ad5ca5.base_3kce4h_chipPilled__c6ad5ca5{border-radius:var(--plasma-chip-pilled-border-radius);}
|
14
|
+
|
13
15
|
.Chip_styles_1mwwhiw_bol5daj__07da4d18{position:relative;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0);}
|
14
16
|
.Chip_styles_1mwwhiw_sj20on5__07da4d18{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin-left:var(--plasma-chip-left-content-margin-left);margin-right:var(--plasma-chip-left-content-margin-right);}
|
15
17
|
.Chip_styles_1mwwhiw_s1ror4o9__07da4d18{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
|
@@ -16,7 +16,7 @@ var TextFieldChip = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
16
16
|
return onClear(id);
|
17
17
|
};
|
18
18
|
var onKeyDownHandle = function onKeyDownHandle(event) {
|
19
|
-
onKeyDown === null || onKeyDown === void 0
|
19
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event, id);
|
20
20
|
};
|
21
21
|
return /*#__PURE__*/React.createElement(StyledChip, {
|
22
22
|
ref: ref,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextFieldChip.js","sources":["../../../../../src/components/TextField/ui/TextFieldChip/TextFieldChip.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { StyledChip } from './TextFieldChip.styles';\nimport type { TextFieldChipProps } from './TextFieldChip.types';\n\n/**\n * Чип, отображающий выбранный элемент\n */\nexport const TextFieldChip = forwardRef<HTMLButtonElement, TextFieldChipProps>(\n ({ id, text, disabled, readOnly, onClick, onClear, onKeyDown }, ref) => {\n const onClearHandle = () => onClear(id);\n\n const onKeyDownHandle = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(event, id);\n };\n\n return (\n <StyledChip\n ref={ref}\n tabIndex={-1}\n disabled={disabled}\n readOnly={readOnly}\n onClick={onClick}\n onClear={onClearHandle}\n onKeyDown={onKeyDownHandle}\n text={`${text}`}\n />\n );\n },\n);\n"],"names":["TextFieldChip","forwardRef","_ref","ref","id","text","disabled","readOnly","onClick","onClear","onKeyDown","onClearHandle","onKeyDownHandle","event","React","createElement","StyledChip","tabIndex","concat"],"mappings":";;;AAKA;AACA;AACA;AACO,IAAMA,aAAa,gBAAGC,UAAU,CACnC,UAAAC,IAAA,EAAgEC,GAAG,EAAK;AAAA,EAAA,IAArEC,EAAE,GAAAF,IAAA,CAAFE,EAAE;IAAEC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IAAEC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;IAAEC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IAAEC,OAAO,GAAAN,IAAA,CAAPM,OAAO;IAAEC,OAAO,GAAAP,IAAA,CAAPO,OAAO;IAAEC,SAAS,GAAAR,IAAA,CAATQ,SAAS,CAAA;AACxD,EAAA,IAAMC,aAAa,GAAG,SAAhBA,aAAaA,GAAA;IAAA,OAASF,OAAO,CAACL,EAAE,CAAC,CAAA;AAAA,GAAA,CAAA;AAEvC,EAAA,IAAMQ,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,KAA6C,EAAK;IACvEH,SAAS,KAAA,IAAA,IAATA,SAAS,KAATA,KAAAA,CAAAA,
|
1
|
+
{"version":3,"file":"TextFieldChip.js","sources":["../../../../../src/components/TextField/ui/TextFieldChip/TextFieldChip.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { StyledChip } from './TextFieldChip.styles';\nimport type { TextFieldChipProps } from './TextFieldChip.types';\n\n/**\n * Чип, отображающий выбранный элемент\n */\nexport const TextFieldChip = forwardRef<HTMLButtonElement, TextFieldChipProps>(\n ({ id, text, disabled, readOnly, onClick, onClear, onKeyDown }, ref) => {\n const onClearHandle = () => onClear(id);\n\n const onKeyDownHandle = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(event, id);\n };\n\n return (\n <StyledChip\n ref={ref}\n tabIndex={-1}\n disabled={disabled}\n readOnly={readOnly}\n onClick={onClick}\n onClear={onClearHandle}\n onKeyDown={onKeyDownHandle}\n text={`${text}`}\n />\n );\n },\n);\n"],"names":["TextFieldChip","forwardRef","_ref","ref","id","text","disabled","readOnly","onClick","onClear","onKeyDown","onClearHandle","onKeyDownHandle","event","React","createElement","StyledChip","tabIndex","concat"],"mappings":";;;AAKA;AACA;AACA;AACO,IAAMA,aAAa,gBAAGC,UAAU,CACnC,UAAAC,IAAA,EAAgEC,GAAG,EAAK;AAAA,EAAA,IAArEC,EAAE,GAAAF,IAAA,CAAFE,EAAE;IAAEC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IAAEC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;IAAEC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IAAEC,OAAO,GAAAN,IAAA,CAAPM,OAAO;IAAEC,OAAO,GAAAP,IAAA,CAAPO,OAAO;IAAEC,SAAS,GAAAR,IAAA,CAATQ,SAAS,CAAA;AACxD,EAAA,IAAMC,aAAa,GAAG,SAAhBA,aAAaA,GAAA;IAAA,OAASF,OAAO,CAACL,EAAE,CAAC,CAAA;AAAA,GAAA,CAAA;AAEvC,EAAA,IAAMQ,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,KAA6C,EAAK;IACvEH,SAAS,KAAA,IAAA,IAATA,SAAS,KAATA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,SAAS,CAAGG,KAAK,EAAET,EAAE,CAAC,CAAA;GACzB,CAAA;AAED,EAAA,oBACIU,KAAA,CAAAC,aAAA,CAACC,UAAU,EAAA;AACPb,IAAAA,GAAG,EAAEA,GAAI;IACTc,QAAQ,EAAE,CAAC,CAAE;AACbX,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,OAAO,EAAEE,aAAc;AACvBD,IAAAA,SAAS,EAAEE,eAAgB;IAC3BP,IAAI,EAAA,EAAA,CAAAa,MAAA,CAAKb,IAAI,CAAA;AAAG,GACnB,CAAC,CAAA;AAEV,CACJ;;;;"}
|
@@ -134,7 +134,7 @@ var ToastProviderHoc = function ToastProviderHoc(ToastComponent) {
|
|
134
134
|
});
|
135
135
|
setIsHidden(false);
|
136
136
|
setIsVisible(true);
|
137
|
-
onShow === null || onShow === void 0
|
137
|
+
onShow === null || onShow === void 0 ? void 0 : onShow();
|
138
138
|
};
|
139
139
|
var showToast = useCallback(showToastCallback, []);
|
140
140
|
var onHide = toastInfo.onHide,
|
@@ -147,7 +147,7 @@ var ToastProviderHoc = function ToastProviderHoc(ToastComponent) {
|
|
147
147
|
clearTimeout(hideTimeout.current);
|
148
148
|
hideTimeout.current = null;
|
149
149
|
}
|
150
|
-
onHide === null || onHide === void 0
|
150
|
+
onHide === null || onHide === void 0 ? void 0 : onHide();
|
151
151
|
setIsVisible(false);
|
152
152
|
animationRunTimeout.current = setTimeout(function () {
|
153
153
|
setIsHidden(true);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ToastProvider.js","sources":["../../../../src/components/Toast/ToastProvider/ToastProvider.tsx"],"sourcesContent":["import React, { createContext, useCallback, useContext, useEffect, useRef, useState } from 'react';\nimport type { ReactNode, FC } from 'react';\n\nimport type { CustomToastProps, ToastControllerProps, ToastProps } from '../Toast.types';\nimport { DEFAULT_FADE, DEFAULT_POSITION, TIMER_DELAY } from '../utils';\n\nimport type { ShowToast, ShowToastArgs, ShowToastCallSignature, ToastContextType } from './ToastProvider.types';\n\nexport const ToastContext = createContext<ToastContextType | null>(null);\n\nexport const useToastInner = () => {\n const context = useContext(ToastContext);\n if (!context) {\n throw new Error('useToast must be used within a ToastProvider');\n }\n return context;\n};\n\nexport const useToast = () => {\n const { showToast, hideToast } = useToastInner();\n return { showToast, hideToast };\n};\n\nconst initialToastData = {\n text: undefined,\n offset: undefined,\n position: DEFAULT_POSITION,\n fade: DEFAULT_FADE,\n timeout: undefined,\n contentLeft: undefined,\n role: undefined,\n pilled: undefined,\n hasClose: undefined,\n width: undefined,\n size: 'm',\n view: 'primary',\n} as CustomToastProps;\n\nconst getShowToastCallSignature = (args: ShowToastCallSignature) => {\n if (typeof args[0] === 'object' && 'text' in args[0]) {\n return args[0];\n }\n\n // TODO: issue https://github.com/salute-developers/plasma/issues/333\n const [text, position, timeout, fade, contentLeft, role, offset, pilled, width, hasClose, size, view] = args;\n\n return { text, position, timeout, fade, contentLeft, role, offset, pilled, width, hasClose, size, view };\n};\n\nexport const ToastProviderHoc = <T extends ToastProps>(ToastComponent: FC<T>) =>\n function ToastProvider({ children }: { children: ReactNode }) {\n const [isVisible, setIsVisible] = useState(false);\n const [isHidden, setIsHidden] = useState(true);\n const hideTimeout = useRef<number | null>(null);\n const animationRunTimeout = useRef<number | null>(null);\n\n const [toastProps, setToastProps] = useState<ToastControllerProps>(initialToastData);\n const [toastInfo, setToastInfo] = useState<Pick<ShowToastArgs, 'timeout' | 'onHide'>>({\n timeout: undefined,\n onHide: undefined,\n });\n\n const showToastCallback: ShowToast = (...args: ShowToastCallSignature) => {\n if (isVisible) {\n return;\n }\n\n const {\n text,\n offset,\n position = DEFAULT_POSITION,\n fade = DEFAULT_FADE,\n timeout,\n contentLeft,\n role,\n pilled,\n hasClose,\n size,\n view,\n width,\n onHide,\n onShow,\n } = getShowToastCallSignature(args);\n\n setToastProps({\n text,\n width,\n position,\n offset,\n fade,\n contentLeft,\n role,\n pilled,\n hasClose,\n size,\n view,\n });\n\n setToastInfo({ timeout, onHide });\n\n setIsHidden(false);\n setIsVisible(true);\n onShow?.();\n };\n\n const showToast = useCallback(showToastCallback, []);\n\n const { onHide, timeout } = toastInfo;\n\n const hideToast = useCallback(() => {\n if (!isVisible) {\n return;\n }\n\n if (hideTimeout?.current) {\n clearTimeout(hideTimeout.current);\n hideTimeout.current = null;\n }\n\n onHide?.();\n setIsVisible(false);\n\n animationRunTimeout.current = setTimeout(() => {\n setIsHidden(true);\n setToastProps(initialToastData);\n }, TIMER_DELAY);\n }, [onHide, isVisible, isHidden]);\n\n useEffect(() => {\n if (timeout === null && animationRunTimeout.current !== null) {\n clearTimeout(animationRunTimeout.current);\n animationRunTimeout.current = null;\n }\n }, [timeout]);\n\n useEffect(() => {\n if (timeout && isVisible) {\n hideTimeout.current = setTimeout(() => {\n hideToast();\n }, timeout);\n }\n }, [isVisible, timeout]);\n\n return (\n <ToastContext.Provider value={{ showToast, hideToast, isVisible, hideTimeout, animationRunTimeout }}>\n {children}\n {!isHidden && <ToastComponent {...(toastProps as T)} />}\n </ToastContext.Provider>\n );\n };\n"],"names":["ToastContext","createContext","useToastInner","context","useContext","Error","useToast","_useToastInner","showToast","hideToast","initialToastData","text","undefined","offset","position","DEFAULT_POSITION","fade","DEFAULT_FADE","timeout","contentLeft","role","pilled","hasClose","width","size","view","getShowToastCallSignature","args","_typeof","_args","_slicedToArray","ToastProviderHoc","ToastComponent","ToastProvider","_ref","children","_useState","useState","_useState2","isVisible","setIsVisible","_useState3","_useState4","isHidden","setIsHidden","hideTimeout","useRef","animationRunTimeout","_useState5","_useState6","toastProps","setToastProps","_useState7","onHide","_useState8","toastInfo","setToastInfo","showToastCallback","_len","arguments","length","Array","_key","_getShowToastCallSign","_getShowToastCallSign2","_getShowToastCallSign3","onShow","useCallback","current","clearTimeout","setTimeout","TIMER_DELAY","useEffect","React","createElement","Provider","value"],"mappings":";;;;IAQaA,YAAY,gBAAGC,aAAa,CAA0B,IAAI,EAAC;IAE3DC,aAAa,GAAG,SAAhBA,aAAaA,GAAS;AAC/B,EAAA,IAAMC,OAAO,GAAGC,UAAU,CAACJ,YAAY,CAAC,CAAA;EACxC,IAAI,CAACG,OAAO,EAAE;AACV,IAAA,MAAM,IAAIE,KAAK,CAAC,8CAA8C,CAAC,CAAA;AACnE,GAAA;AACA,EAAA,OAAOF,OAAO,CAAA;AAClB,EAAC;IAEYG,QAAQ,GAAG,SAAXA,QAAQA,GAAS;AAC1B,EAAA,IAAAC,cAAA,GAAiCL,aAAa,EAAE;IAAxCM,SAAS,GAAAD,cAAA,CAATC,SAAS;IAAEC,SAAS,GAAAF,cAAA,CAATE,SAAS,CAAA;EAC5B,OAAO;AAAED,IAAAA,SAAS,EAATA,SAAS;AAAEC,IAAAA,SAAS,EAATA,SAAAA;GAAW,CAAA;AACnC,EAAC;AAED,IAAMC,gBAAgB,GAAG;AACrBC,EAAAA,IAAI,EAAEC,SAAS;AACfC,EAAAA,MAAM,EAAED,SAAS;AACjBE,EAAAA,QAAQ,EAAEC,gBAAgB;AAC1BC,EAAAA,IAAI,EAAEC,YAAY;AAClBC,EAAAA,OAAO,EAAEN,SAAS;AAClBO,EAAAA,WAAW,EAAEP,SAAS;AACtBQ,EAAAA,IAAI,EAAER,SAAS;AACfS,EAAAA,MAAM,EAAET,SAAS;AACjBU,EAAAA,QAAQ,EAAEV,SAAS;AACnBW,EAAAA,KAAK,EAAEX,SAAS;AAChBY,EAAAA,IAAI,EAAE,GAAG;AACTC,EAAAA,IAAI,EAAE,SAAA;AACV,CAAqB,CAAA;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2E,QAAQ,EAAA;AAACC,MAAAA,KAAK,EAAE;AAAEpE,QAAAA,SAAS,EAATA,SAAS;AAAEC,QAAAA,SAAS,EAATA,SAAS;AAAE8B,QAAAA,SAAS,EAATA,SAAS;AAAEM,QAAAA,WAAW,EAAXA,WAAW;AAAEE,QAAAA,mBAAmB,EAAnBA,mBAAAA;AAAoB,OAAA;AAAE,KAAA,EAC/FZ,QAAQ,EACR,CAACQ,QAAQ,iBAAI8B,KAAA,CAAAC,aAAA,CAAC1C,cAAc,EAAMkB,UAAmB,CACnC,CAAC,CAAA;GAE/B,CAAA;AAAA;;;;"}
|
1
|
+
{"version":3,"file":"ToastProvider.js","sources":["../../../../src/components/Toast/ToastProvider/ToastProvider.tsx"],"sourcesContent":["import React, { createContext, useCallback, useContext, useEffect, useRef, useState } from 'react';\nimport type { ReactNode, FC } from 'react';\n\nimport type { CustomToastProps, ToastControllerProps, ToastProps } from '../Toast.types';\nimport { DEFAULT_FADE, DEFAULT_POSITION, TIMER_DELAY } from '../utils';\n\nimport type { ShowToast, ShowToastArgs, ShowToastCallSignature, ToastContextType } from './ToastProvider.types';\n\nexport const ToastContext = createContext<ToastContextType | null>(null);\n\nexport const useToastInner = () => {\n const context = useContext(ToastContext);\n if (!context) {\n throw new Error('useToast must be used within a ToastProvider');\n }\n return context;\n};\n\nexport const useToast = () => {\n const { showToast, hideToast } = useToastInner();\n return { showToast, hideToast };\n};\n\nconst initialToastData = {\n text: undefined,\n offset: undefined,\n position: DEFAULT_POSITION,\n fade: DEFAULT_FADE,\n timeout: undefined,\n contentLeft: undefined,\n role: undefined,\n pilled: undefined,\n hasClose: undefined,\n width: undefined,\n size: 'm',\n view: 'primary',\n} as CustomToastProps;\n\nconst getShowToastCallSignature = (args: ShowToastCallSignature) => {\n if (typeof args[0] === 'object' && 'text' in args[0]) {\n return args[0];\n }\n\n // TODO: issue https://github.com/salute-developers/plasma/issues/333\n const [text, position, timeout, fade, contentLeft, role, offset, pilled, width, hasClose, size, view] = args;\n\n return { text, position, timeout, fade, contentLeft, role, offset, pilled, width, hasClose, size, view };\n};\n\nexport const ToastProviderHoc = <T extends ToastProps>(ToastComponent: FC<T>) =>\n function ToastProvider({ children }: { children: ReactNode }) {\n const [isVisible, setIsVisible] = useState(false);\n const [isHidden, setIsHidden] = useState(true);\n const hideTimeout = useRef<number | null>(null);\n const animationRunTimeout = useRef<number | null>(null);\n\n const [toastProps, setToastProps] = useState<ToastControllerProps>(initialToastData);\n const [toastInfo, setToastInfo] = useState<Pick<ShowToastArgs, 'timeout' | 'onHide'>>({\n timeout: undefined,\n onHide: undefined,\n });\n\n const showToastCallback: ShowToast = (...args: ShowToastCallSignature) => {\n if (isVisible) {\n return;\n }\n\n const {\n text,\n offset,\n position = DEFAULT_POSITION,\n fade = DEFAULT_FADE,\n timeout,\n contentLeft,\n role,\n pilled,\n hasClose,\n size,\n view,\n width,\n onHide,\n onShow,\n } = getShowToastCallSignature(args);\n\n setToastProps({\n text,\n width,\n position,\n offset,\n fade,\n contentLeft,\n role,\n pilled,\n hasClose,\n size,\n view,\n });\n\n setToastInfo({ timeout, onHide });\n\n setIsHidden(false);\n setIsVisible(true);\n onShow?.();\n };\n\n const showToast = useCallback(showToastCallback, []);\n\n const { onHide, timeout } = toastInfo;\n\n const hideToast = useCallback(() => {\n if (!isVisible) {\n return;\n }\n\n if (hideTimeout?.current) {\n clearTimeout(hideTimeout.current);\n hideTimeout.current = null;\n }\n\n onHide?.();\n setIsVisible(false);\n\n animationRunTimeout.current = setTimeout(() => {\n setIsHidden(true);\n setToastProps(initialToastData);\n }, TIMER_DELAY);\n }, [onHide, isVisible, isHidden]);\n\n useEffect(() => {\n if (timeout === null && animationRunTimeout.current !== null) {\n clearTimeout(animationRunTimeout.current);\n animationRunTimeout.current = null;\n }\n }, [timeout]);\n\n useEffect(() => {\n if (timeout && isVisible) {\n hideTimeout.current = setTimeout(() => {\n hideToast();\n }, timeout);\n }\n }, [isVisible, timeout]);\n\n return (\n <ToastContext.Provider value={{ showToast, hideToast, isVisible, hideTimeout, animationRunTimeout }}>\n {children}\n {!isHidden && <ToastComponent {...(toastProps as T)} />}\n </ToastContext.Provider>\n );\n };\n"],"names":["ToastContext","createContext","useToastInner","context","useContext","Error","useToast","_useToastInner","showToast","hideToast","initialToastData","text","undefined","offset","position","DEFAULT_POSITION","fade","DEFAULT_FADE","timeout","contentLeft","role","pilled","hasClose","width","size","view","getShowToastCallSignature","args","_typeof","_args","_slicedToArray","ToastProviderHoc","ToastComponent","ToastProvider","_ref","children","_useState","useState","_useState2","isVisible","setIsVisible","_useState3","_useState4","isHidden","setIsHidden","hideTimeout","useRef","animationRunTimeout","_useState5","_useState6","toastProps","setToastProps","_useState7","onHide","_useState8","toastInfo","setToastInfo","showToastCallback","_len","arguments","length","Array","_key","_getShowToastCallSign","_getShowToastCallSign2","_getShowToastCallSign3","onShow","useCallback","current","clearTimeout","setTimeout","TIMER_DELAY","useEffect","React","createElement","Provider","value"],"mappings":";;;;IAQaA,YAAY,gBAAGC,aAAa,CAA0B,IAAI,EAAC;IAE3DC,aAAa,GAAG,SAAhBA,aAAaA,GAAS;AAC/B,EAAA,IAAMC,OAAO,GAAGC,UAAU,CAACJ,YAAY,CAAC,CAAA;EACxC,IAAI,CAACG,OAAO,EAAE;AACV,IAAA,MAAM,IAAIE,KAAK,CAAC,8CAA8C,CAAC,CAAA;AACnE,GAAA;AACA,EAAA,OAAOF,OAAO,CAAA;AAClB,EAAC;IAEYG,QAAQ,GAAG,SAAXA,QAAQA,GAAS;AAC1B,EAAA,IAAAC,cAAA,GAAiCL,aAAa,EAAE;IAAxCM,SAAS,GAAAD,cAAA,CAATC,SAAS;IAAEC,SAAS,GAAAF,cAAA,CAATE,SAAS,CAAA;EAC5B,OAAO;AAAED,IAAAA,SAAS,EAATA,SAAS;AAAEC,IAAAA,SAAS,EAATA,SAAAA;GAAW,CAAA;AACnC,EAAC;AAED,IAAMC,gBAAgB,GAAG;AACrBC,EAAAA,IAAI,EAAEC,SAA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rB,mBAAmB,CAACqB,OAAO,GAAG,IAAI,CAAA;AACtC,OAAA;AACJ,KAAC,EAAE,CAAClD,OAAO,CAAC,CAAC,CAAA;AAEbsD,IAAAA,SAAS,CAAC,YAAM;MACZ,IAAItD,OAAO,IAAIqB,SAAS,EAAE;AACtBM,QAAAA,WAAW,CAACuB,OAAO,GAAGE,UAAU,CAAC,YAAM;AACnC7D,UAAAA,SAAS,EAAE,CAAA;SACd,EAAES,OAAO,CAAC,CAAA;AACf,OAAA;AACJ,KAAC,EAAE,CAACqB,SAAS,EAAErB,OAAO,CAAC,CAAC,CAAA;AAExB,IAAA,oBACIuD,KAAA,CAAAC,aAAA,CAAC1E,YAAY,CAAC2E,QAAQ,EAAA;AAACC,MAAAA,KAAK,EAAE;AAAEpE,QAAAA,SAAS,EAATA,SAAS;AAAEC,QAAAA,SAAS,EAATA,SAAS;AAAE8B,QAAAA,SAAS,EAATA,SAAS;AAAEM,QAAAA,WAAW,EAAXA,WAAW;AAAEE,QAAAA,mBAAmB,EAAnBA,mBAAAA;AAAoB,OAAA;AAAE,KAAA,EAC/FZ,QAAQ,EACR,CAACQ,QAAQ,iBAAI8B,KAAA,CAAAC,aAAA,CAAC1C,cAAc,EAAMkB,UAAmB,CACnC,CAAC,CAAA;GAE/B,CAAA;AAAA;;;;"}
|
@@ -71,7 +71,7 @@ var tooltipRoot = function tooltipRoot(Root) {
|
|
71
71
|
useEffect(function () {
|
72
72
|
var onKeyDown = function onKeyDown(event) {
|
73
73
|
if (event.keyCode === ESCAPE_KEYCODE) {
|
74
|
-
onDismiss === null || onDismiss === void 0
|
74
|
+
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
75
75
|
}
|
76
76
|
};
|
77
77
|
window.addEventListener('keydown', onKeyDown);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import React, { useEffect, forwardRef, useState } from 'react';\nimport { styled } from '@linaria/react';\n\nimport { RootProps, component } from '../../engines';\nimport { popoverClasses, popoverConfig, popoverTokens } from '../Popover';\nimport { cx } from '../../utils';\n\nimport { TooltipProps } from './Tooltip.types';\nimport { StyledContentLeft, TooltipRoot } from './Tooltip.styles';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { classes, tokens } from './Tooltip.tokens';\n\nconst ESCAPE_KEYCODE = 27;\n\nconst getStringValue = (value?: number | string) => {\n return typeof value === 'number' ? `${value}rem` : value;\n};\n\nconst Popover = component(popoverConfig);\n\nconst StyledPopover = styled(Popover)`\n ${popoverTokens.arrowMaskWidth}: var(${tokens.arrowMaskWidth});\n ${popoverTokens.arrowMaskHeight}: var(${tokens.arrowMaskHeight});\n ${popoverTokens.arrowMaskImage}: var(${tokens.arrowMaskImage});\n ${popoverTokens.arrowBackground}: var(${tokens.arrowBackground});\n ${popoverTokens.arrowHeight}: var(${tokens.arrowHeight});\n ${popoverTokens.arrowEdgeMargin}: var(${tokens.arrowEdgeMargin});\n\n &.${classes.animated} .${popoverClasses.root} {\n transition: opacity 200ms ease-in-out, visibility 200ms ease-in-out;\n }\n`;\n\n/**\n * Компонент для текстовых подсказок. Основное предназначение — подписи к блокам.\n */\n\nexport const tooltipRoot = (Root: RootProps<HTMLDivElement, Omit<TooltipProps, 'isOpen' | 'text'>>) =>\n forwardRef<HTMLDivElement, TooltipProps>(\n (\n {\n id,\n text,\n isOpen,\n isVisible,\n hasArrow = true,\n arrow,\n animated,\n offset = [0, 8],\n minWidth,\n maxWidth,\n placement = 'bottom',\n usePortal = true,\n target,\n children,\n onDismiss,\n view,\n size,\n contentLeft,\n zIndex = '9200',\n className,\n ...rest\n },\n outerRef,\n ) => {\n const [ref, setRef] = useState<HTMLDivElement | null>(null);\n\n // TODO убрать после отказа от старого API\n const innerIsOpen = isVisible || isOpen;\n const innerHasArrow = arrow || hasArrow;\n const showTooltip = innerIsOpen && Boolean(text?.length);\n\n const animatedClass = animated ? classes.animated : undefined;\n\n useEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.keyCode === ESCAPE_KEYCODE) {\n onDismiss?.();\n }\n };\n\n window.addEventListener('keydown', onKeyDown);\n\n return () => {\n window.removeEventListener('keydown', onKeyDown);\n };\n }, []);\n\n const withContentLeft = contentLeft ? classes.hasContentLeft : undefined;\n\n return (\n <StyledPopover\n isOpen={showTooltip}\n placement={placement}\n offset={offset}\n zIndex={zIndex}\n target={target || children}\n usePortal={usePortal}\n hasArrow={innerHasArrow}\n aria-hidden={!innerIsOpen}\n aria-live=\"polite\"\n role=\"tooltip\"\n className={cx(ref?.classList.toString(), animatedClass, className)}\n // INFO: Прокидываем стили для Popover из Root Tooltip-а\n\n {...rest}\n >\n <Root view={view} size={size} ref={setRef}>\n <TooltipRoot\n ref={outerRef}\n id={id}\n className={cx(withContentLeft)}\n maxWidth={getStringValue(maxWidth)}\n minWidth={getStringValue(minWidth)}\n >\n {contentLeft && <StyledContentLeft>{contentLeft}</StyledContentLeft>}\n {text}\n </TooltipRoot>\n </Root>\n </StyledPopover>\n );\n },\n );\n\nexport const tooltipConfig = {\n name: 'Tooltip',\n tag: 'div',\n layout: tooltipRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'default',\n size: 'm',\n },\n};\n"],"names":["ESCAPE_KEYCODE","getStringValue","value","concat","Popover","component","popoverConfig","_exp","StyledPopover","styled","name","class","propsAsIs","tooltipRoot","Root","forwardRef","_ref","outerRef","id","text","isOpen","isVisible","_ref$hasArrow","hasArrow","arrow","animated","_ref$offset","offset","minWidth","maxWidth","_ref$placement","placement","_ref$usePortal","usePortal","target","children","onDismiss","view","size","contentLeft","_ref$zIndex","zIndex","className","rest","_useState","useState","_useState2","_slicedToArray","ref","setRef","innerIsOpen","innerHasArrow","showTooltip","Boolean","length","animatedClass","classes","undefined","useEffect","onKeyDown","event","keyCode","window","addEventListener","removeEventListener","withContentLeft","hasContentLeft","React","createElement","_extends","role","cx","classList","toString","TooltipRoot","StyledContentLeft","tooltipConfig","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;AAaA,IAAMA,cAAc,GAAG,EAAE,CAAA;AAEzB,IAAMC,cAAc,GAAGA,SAAjBA,cAAcA,CAAIC,KAAuB,EAAK;EAChD,OAAO,OAAOA,KAAK,KAAK,QAAQ,MAAAC,MAAA,CAAMD,KAAM,EAAA,KAAA,CAAA,GAAOA,KAAK,CAAA;AAC5D,CAAC,CAAA;AAED,IAAME,OAAO,gBAAGC,SAAS,CAACC,aAAa,CAAC,CAAA;AAAC,IAAAC,IAAA,GAlBvBA,SAkBuBA,IAAAA,GAAA;AAAA,EAAA,OAEZH,OAAO,CAAA;AAAA,CAAA,CAAA;AAApC,IAAMI,aAAa,gBAAGC,MAAM,CAAAF,IAAA,EAAA,CAAA,CAAA;AAAAG,EAAAA,IAAA,EAAA,eAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,IAAA;AAAA,CAW3B,CAAA,CAAA;;AAED;AACA;AACA;;IAEaC,WAAW,GAAGA,SAAdA,WAAWA,CAAIC,IAAsE,EAAA;AAAA,EAAA,oBAC9FC,UAAU,CACN,UAAAC,IAAA,EAwBIC,QAAQ,EACP;AAAA,IAAA,IAvBGC,EAAE,GAAAF,IAAA,CAAFE,EAAE;MACFC,IAAI,GAAAH,IAAA,CAAJG,IAAI;MACJC,MAAM,GAAAJ,IAAA,CAANI,MAAM;MACNC,SAAS,GAAAL,IAAA,CAATK,SAAS;MAAAC,aAAA,GAAAN,IAAA,CACTO,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,aAAA;MACfE,KAAK,GAAAR,IAAA,CAALQ,KAAK;MACLC,QAAQ,GAAAT,IAAA,CAARS,QAAQ;MAAAC,WAAA,GAAAV,IAAA,CACRW,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AA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import React, { useEffect, forwardRef, useState } from 'react';\nimport { styled } from '@linaria/react';\n\nimport { RootProps, component } from '../../engines';\nimport { popoverClasses, popoverConfig, popoverTokens } from '../Popover';\nimport { cx } from '../../utils';\n\nimport { TooltipProps } from './Tooltip.types';\nimport { StyledContentLeft, TooltipRoot } from './Tooltip.styles';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { classes, tokens } from './Tooltip.tokens';\n\nconst ESCAPE_KEYCODE = 27;\n\nconst getStringValue = (value?: number | string) => {\n return typeof value === 'number' ? `${value}rem` : value;\n};\n\nconst Popover = component(popoverConfig);\n\nconst StyledPopover = styled(Popover)`\n ${popoverTokens.arrowMaskWidth}: var(${tokens.arrowMaskWidth});\n ${popoverTokens.arrowMaskHeight}: var(${tokens.arrowMaskHeight});\n ${popoverTokens.arrowMaskImage}: var(${tokens.arrowMaskImage});\n ${popoverTokens.arrowBackground}: var(${tokens.arrowBackground});\n ${popoverTokens.arrowHeight}: var(${tokens.arrowHeight});\n ${popoverTokens.arrowEdgeMargin}: var(${tokens.arrowEdgeMargin});\n\n &.${classes.animated} .${popoverClasses.root} {\n transition: opacity 200ms ease-in-out, visibility 200ms ease-in-out;\n }\n`;\n\n/**\n * Компонент для текстовых подсказок. Основное предназначение — подписи к блокам.\n */\n\nexport const tooltipRoot = (Root: RootProps<HTMLDivElement, Omit<TooltipProps, 'isOpen' | 'text'>>) =>\n forwardRef<HTMLDivElement, TooltipProps>(\n (\n {\n id,\n text,\n isOpen,\n isVisible,\n hasArrow = true,\n arrow,\n animated,\n offset = [0, 8],\n minWidth,\n maxWidth,\n placement = 'bottom',\n usePortal = true,\n target,\n children,\n onDismiss,\n view,\n size,\n contentLeft,\n zIndex = '9200',\n className,\n ...rest\n },\n outerRef,\n ) => {\n const [ref, setRef] = useState<HTMLDivElement | null>(null);\n\n // TODO убрать после отказа от старого API\n const innerIsOpen = isVisible || isOpen;\n const innerHasArrow = arrow || hasArrow;\n const showTooltip = innerIsOpen && Boolean(text?.length);\n\n const animatedClass = animated ? classes.animated : undefined;\n\n useEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.keyCode === ESCAPE_KEYCODE) {\n onDismiss?.();\n }\n };\n\n window.addEventListener('keydown', onKeyDown);\n\n return () => {\n window.removeEventListener('keydown', onKeyDown);\n };\n }, []);\n\n const withContentLeft = contentLeft ? classes.hasContentLeft : undefined;\n\n return (\n <StyledPopover\n isOpen={showTooltip}\n placement={placement}\n offset={offset}\n zIndex={zIndex}\n target={target || children}\n usePortal={usePortal}\n hasArrow={innerHasArrow}\n aria-hidden={!innerIsOpen}\n aria-live=\"polite\"\n role=\"tooltip\"\n className={cx(ref?.classList.toString(), animatedClass, className)}\n // INFO: Прокидываем стили для Popover из Root Tooltip-а\n\n {...rest}\n >\n <Root view={view} size={size} ref={setRef}>\n <TooltipRoot\n ref={outerRef}\n id={id}\n className={cx(withContentLeft)}\n maxWidth={getStringValue(maxWidth)}\n minWidth={getStringValue(minWidth)}\n >\n {contentLeft && <StyledContentLeft>{contentLeft}</StyledContentLeft>}\n {text}\n </TooltipRoot>\n </Root>\n </StyledPopover>\n );\n },\n );\n\nexport const tooltipConfig = {\n name: 'Tooltip',\n tag: 'div',\n layout: tooltipRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'default',\n size: 'm',\n },\n};\n"],"names":["ESCAPE_KEYCODE","getStringValue","value","concat","Popover","component","popoverConfig","_exp","StyledPopover","styled","name","class","propsAsIs","tooltipRoot","Root","forwardRef","_ref","outerRef","id","text","isOpen","isVisible","_ref$hasArrow","hasArrow","arrow","animated","_ref$offset","offset","minWidth","maxWidth","_ref$placement","placement","_ref$usePortal","usePortal","target","children","onDismiss","view","size","contentLeft","_ref$zIndex","zIndex","className","rest","_useState","useState","_useState2","_slicedToArray","ref","setRef","innerIsOpen","innerHasArrow","showTooltip","Boolean","length","animatedClass","classes","undefined","useEffect","onKeyDown","event","keyCode","window","addEventListener","removeEventListener","withContentLeft","hasContentLeft","React","createElement","_extends","role","cx","classList","toString","TooltipRoot","StyledContentLeft","tooltipConfig","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;AAaA,IAAMA,cAAc,GAAG,EAAE,CAAA;AAEzB,IAAMC,cAAc,GAAGA,SAAjBA,cAAcA,CAAIC,KAAuB,EAAK;EAChD,OAAO,OAAOA,KAAK,KAAK,QAAQ,MAAAC,MAAA,CAAMD,KAAM,EAAA,KAAA,CAAA,GAAOA,KAAK,CAAA;AAC5D,CAAC,CAAA;AAED,IAAME,OAAO,gBAAGC,SAAS,CAACC,aAAa,CAAC,CAAA;AAAC,IAAAC,IAAA,GAlBvBA,SAkBuBA,IAAAA,GAAA;AAAA,EAAA,OAEZH,OAAO,CAAA;AAAA,CAAA,CAAA;AAApC,IAAMI,aAAa,gBAAGC,MAAM,CAAAF,IAAA,EAAA,CAAA,CAAA;AAAAG,EAAAA,IAAA,EAAA,eAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,IAAA;AAAA,CAW3B,CAAA,CAAA;;AAED;AACA;AACA;;IAEaC,WAAW,GAAGA,SAAdA,WAAWA,CAAIC,IAAsE,EAAA;AAAA,EAAA,oBAC9FC,UAAU,CACN,UAAAC,IAAA,EAwBIC,QAAQ,EACP;AAAA,IAAA,IAvBGC,EAAE,GAAAF,IAAA,CAAFE,EAAE;MACFC,IAAI,GAAAH,IAAA,CAAJG,IAAI;MACJC,MAAM,GAAAJ,IAAA,CAANI,MAAM;MACNC,SAAS,GAAAL,IAAA,CAATK,SAAS;MAAAC,aAAA,GAAAN,IAAA,CACTO,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AAE,EAAE;AACRC,EAAAA,UAAU,EAAE;AACR3C,IAAAA,IAAI,EAAE;AACF4C,MAAAA,GAAG,EAAEC,IAAAA;KACR;AACD5C,IAAAA,IAAI,EAAE;AACF2C,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN/C,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
package/es/index.css
CHANGED
@@ -40,6 +40,8 @@
|
|
40
40
|
|
41
41
|
.base_kgtz8x_b16hf96__46a206b1{--plasma_private-chip-outline-size:var(--plasma-chip-outline-size,0.125rem);position:relative;}.base_kgtz8x_b16hf96__46a206b1:focus{outline:none;}.base_kgtz8x_b16hf96__46a206b1::before{content:'';position:absolute;top:calc(-1 * var(--plasma_private-chip-outline-size));left:calc(-1 * var(--plasma_private-chip-outline-size));right:calc(-1 * var(--plasma_private-chip-outline-size));bottom:calc(-1 * var(--plasma_private-chip-outline-size));z-index:1;display:block;box-sizing:content-box;border:var(--plasma_private-chip-outline-size) solid transparent;border-radius:calc(var(--plasma-chip-border-radius) + var(--plasma_private-chip-outline-size));-webkit-transition:box-shadow 0.2s ease-in-out;transition:box-shadow 0.2s ease-in-out;pointer-events:none;}.base_kgtz8x_b16hf96__46a206b1.base_kgtz8x_focusVisible__46a206b1:focus::before,.base_kgtz8x_b16hf96__46a206b1[data-focus-visible-added]::before{outline:none;box-shadow:0 0 0 var(--plasma_private-chip-outline-size) var(--plasma-chip-focus-color);}
|
42
42
|
|
43
|
+
.base_3kce4h_bvcavwi__c6ad5ca5.base_3kce4h_chipPilled__c6ad5ca5{border-radius:var(--plasma-chip-pilled-border-radius);}
|
44
|
+
|
43
45
|
.Chip_styles_1mwwhiw_bol5daj__07da4d18{position:relative;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0);}
|
44
46
|
.Chip_styles_1mwwhiw_sj20on5__07da4d18{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin-left:var(--plasma-chip-left-content-margin-left);margin-right:var(--plasma-chip-left-content-margin-right);}
|
45
47
|
.Chip_styles_1mwwhiw_s1ror4o9__07da4d18{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.76.2-
|
3
|
+
"version": "0.76.2-dev.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -55,13 +55,12 @@
|
|
55
55
|
"react-dom": ">=16.13.1"
|
56
56
|
},
|
57
57
|
"devDependencies": {
|
58
|
-
"@babel/cli": "7.
|
59
|
-
"@babel/core": "7.
|
60
|
-
"@babel/plugin-transform-
|
61
|
-
"@babel/
|
62
|
-
"@babel/preset-
|
63
|
-
"@babel/preset-
|
64
|
-
"@babel/preset-typescript": "7.24.1",
|
58
|
+
"@babel/cli": "7.15.4",
|
59
|
+
"@babel/core": "7.15.5",
|
60
|
+
"@babel/plugin-transform-react-constant-elements": "7.17.12",
|
61
|
+
"@babel/preset-env": "7.15.4",
|
62
|
+
"@babel/preset-react": "7.14.5",
|
63
|
+
"@babel/preset-typescript": "7.15.0",
|
65
64
|
"@ironkinoko/rollup-plugin-styles": "^4.0.3",
|
66
65
|
"@linaria/rollup": "5.0.4",
|
67
66
|
"@linaria/vite": "5.0.4",
|
@@ -84,6 +83,7 @@
|
|
84
83
|
"babel-loader": "8.2.2",
|
85
84
|
"babel-plugin-annotate-pure-calls": "0.4.0",
|
86
85
|
"babel-plugin-styled-components": "1.13.2",
|
86
|
+
"babel-plugin-transform-class-properties": "6.24.1",
|
87
87
|
"default-browser-id": "2.0.0",
|
88
88
|
"react": "18.2.0",
|
89
89
|
"react-dom": "18.2.0",
|
@@ -91,7 +91,7 @@
|
|
91
91
|
"storybook": "7.6.17",
|
92
92
|
"styled-components": "5.3.1",
|
93
93
|
"typescript": "4.2.4",
|
94
|
-
"vite": "4.5.
|
94
|
+
"vite": "4.5.1"
|
95
95
|
},
|
96
96
|
"dependencies": {
|
97
97
|
"@linaria/core": "5.0.2",
|
@@ -102,5 +102,5 @@
|
|
102
102
|
"react-popper": "2.3.0",
|
103
103
|
"storeon": "3.1.5"
|
104
104
|
},
|
105
|
-
"gitHead": "
|
105
|
+
"gitHead": "533c41b7c508c86073cbec87f3856ecaaeafb056"
|
106
106
|
}
|
@@ -18,7 +18,7 @@ var _utils2 = /*#__PURE__*/require("./utils");
|
|
18
18
|
var _excluded = ["size", "name", "url", "customText", "status", "className", "focused", "isScalable"];
|
19
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
20
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
21
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
22
22
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
23
23
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
24
24
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
@@ -9,7 +9,7 @@ var _styledComponents = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/requi
|
|
9
9
|
var _Avatar = /*#__PURE__*/require("./Avatar.tokens");
|
10
10
|
var _templateObject;
|
11
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
13
13
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
14
14
|
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteral(["\n position: relative;\n"])));
|
15
15
|
var Wrapper = exports.Wrapper = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
@@ -9,7 +9,7 @@ var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react")
|
|
9
9
|
var _AvatarGroup = /*#__PURE__*/require("./AvatarGroup.styles");
|
10
10
|
var _excluded = ["children"];
|
11
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
13
13
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
14
14
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
15
15
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
@@ -15,7 +15,7 @@ var _Badge = /*#__PURE__*/require("./Badge.styles");
|
|
15
15
|
var _Badge2 = /*#__PURE__*/require("./Badge.tokens");
|
16
16
|
var _excluded = ["children", "className", "text", "contentLeft", "contentRight", "size", "view", "pilled", "transparent"];
|
17
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
18
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
19
19
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
20
20
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
21
21
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
@@ -8,7 +8,7 @@ exports.base = exports.StyledContentRight = exports.StyledContentMain = exports.
|
|
8
8
|
var _styledComponents = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("styled-components"));
|
9
9
|
var _Badge = /*#__PURE__*/require("./Badge.tokens");
|
10
10
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
11
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
12
12
|
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["display:inline-flex;align-items:center;box-sizing:border-box;justify-content:center;width:max-content;"]);
|
13
13
|
var StyledContentLeft = exports.StyledContentLeft = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
14
14
|
componentId: "plasma-new-hope__sc-naxmb2-0"
|
@@ -19,12 +19,12 @@ var _Button2 = /*#__PURE__*/require("./Button.tokens");
|
|
19
19
|
var _StyledSpinner;
|
20
20
|
var _excluded = ["children", "view", "size", "text", "contentLeft", "contentRight", "isLoading", "loader", "stretch", "square", "pin", "disabled", "focused", "outlined", "className", "blur", "style", "stretching"];
|
21
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
22
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
22
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
23
23
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
24
24
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
25
25
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
26
26
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
27
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i
|
27
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
28
28
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
29
29
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
30
30
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
@@ -12,7 +12,7 @@ var _Spinner = /*#__PURE__*/require("../Spinner");
|
|
12
12
|
var _Button = /*#__PURE__*/require("./Button.tokens");
|
13
13
|
var _templateObject;
|
14
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
15
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
16
16
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
17
17
|
// issue #823
|
18
18
|
var mergedConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_Spinner.spinnerConfig);
|