@salutejs/plasma-new-hope 0.76.3-dev.0 → 0.76.4-canary.1085.8735373257.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/cjs/components/Calendar/CalendarBase/CalendarBase.js +1 -1
- package/cjs/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
- package/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
- package/cjs/components/Calendar/CalendarDouble/CalendarDouble.js.map +1 -1
- package/cjs/components/Calendar/hoc/withRange.js +1 -1
- package/cjs/components/Calendar/hoc/withRange.js.map +1 -1
- package/cjs/components/Calendar/hooks/useKeyNavigation.js +19 -19
- package/cjs/components/Calendar/hooks/useKeyNavigation.js.map +1 -1
- package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
- package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
- package/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
- package/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js.map +1 -1
- package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
- package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
- package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
- package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
- package/cjs/components/Chip/Chip.js +2 -2
- package/cjs/components/Chip/Chip.js.map +1 -1
- package/cjs/components/Combobox/Combobox.js +5 -5
- package/cjs/components/Combobox/Combobox.js.map +1 -1
- package/cjs/components/Combobox/hooks/useFocusController.js +9 -9
- package/cjs/components/Combobox/hooks/useFocusController.js.map +1 -1
- package/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
- package/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js.map +1 -1
- package/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
- package/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js.map +1 -1
- package/cjs/components/Drawer/DrawerContext.js +1 -1
- package/cjs/components/Drawer/DrawerContext.js.map +1 -1
- package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js +2 -2
- package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
- package/cjs/components/Modal/ModalContext.js +1 -1
- package/cjs/components/Modal/ModalContext.js.map +1 -1
- package/cjs/components/Overlay/Overlay.js +1 -1
- package/cjs/components/Overlay/Overlay.js.map +1 -1
- package/cjs/components/Pagination/Pagination.js +2 -2
- package/cjs/components/Pagination/Pagination.js.map +1 -1
- package/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
- package/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js.map +1 -1
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
- package/cjs/components/Popover/Popover.js +7 -7
- package/cjs/components/Popover/Popover.js.map +1 -1
- package/cjs/components/Popup/Popup.js +1 -1
- package/cjs/components/Popup/Popup.js.map +1 -1
- package/cjs/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
- package/cjs/components/Segment/ui/SegmentItem/SegmentItem.js.map +1 -1
- package/cjs/components/Select/Select.js +5 -5
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Select/hooks/useKeyNavigation.js +12 -12
- package/cjs/components/Select/hooks/useKeyNavigation.js.map +1 -1
- package/cjs/components/Select/ui/SelectChip/SelectChip.js +1 -1
- package/cjs/components/Select/ui/SelectChip/SelectChip.js.map +1 -1
- package/cjs/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
- package/cjs/components/Select/ui/SelectTarget/SelectTarget.js.map +1 -1
- package/cjs/components/Select/utils/index.js +2 -2
- package/cjs/components/Select/utils/index.js.map +1 -1
- package/cjs/components/Tabs/TabsContext.js +1 -2
- package/cjs/components/Tabs/TabsContext.js.map +1 -1
- package/cjs/components/Tabs/ui/TabItem/TabItem.js +1 -1
- package/cjs/components/Tabs/ui/TabItem/TabItem.js.map +1 -1
- package/cjs/components/Tabs/ui/Tabs/Tabs.js +2 -2
- package/cjs/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
- package/cjs/components/TextArea/TextArea.js +1 -1
- package/cjs/components/TextArea/TextArea.js.map +1 -1
- package/cjs/components/TextField/TextField.js +2 -2
- package/cjs/components/TextField/TextField.js.map +1 -1
- package/cjs/components/TextField/hooks/useKeyNavigation.js +9 -9
- package/cjs/components/TextField/hooks/useKeyNavigation.js.map +1 -1
- package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
- package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
- package/cjs/components/Toast/ToastProvider/ToastProvider.js +2 -2
- package/cjs/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
- package/cjs/components/Tooltip/Tooltip.js +1 -1
- package/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/es/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/es/components/Calendar/CalendarBase/CalendarBase.js +1 -1
- package/es/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
- package/es/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
- package/es/components/Calendar/CalendarDouble/CalendarDouble.js.map +1 -1
- package/es/components/Calendar/hoc/withRange.js +1 -1
- package/es/components/Calendar/hoc/withRange.js.map +1 -1
- package/es/components/Calendar/hooks/useKeyNavigation.js +19 -19
- package/es/components/Calendar/hooks/useKeyNavigation.js.map +1 -1
- package/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
- package/es/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
- package/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
- package/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js.map +1 -1
- package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
- package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
- package/es/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
- package/es/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
- package/es/components/Chip/Chip.js +2 -2
- package/es/components/Chip/Chip.js.map +1 -1
- package/es/components/Combobox/Combobox.js +5 -5
- package/es/components/Combobox/Combobox.js.map +1 -1
- package/es/components/Combobox/hooks/useFocusController.js +9 -9
- package/es/components/Combobox/hooks/useFocusController.js.map +1 -1
- package/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
- package/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js.map +1 -1
- package/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
- package/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js.map +1 -1
- package/es/components/Drawer/DrawerContext.js +1 -1
- package/es/components/Drawer/DrawerContext.js.map +1 -1
- package/es/components/Dropdown/ui/DropdownItem/DropdownItem.js +2 -2
- package/es/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
- package/es/components/Modal/ModalContext.js +1 -1
- package/es/components/Modal/ModalContext.js.map +1 -1
- package/es/components/Overlay/Overlay.js +1 -1
- package/es/components/Overlay/Overlay.js.map +1 -1
- package/es/components/Pagination/Pagination.js +2 -2
- package/es/components/Pagination/Pagination.js.map +1 -1
- package/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
- package/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js.map +1 -1
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
- package/es/components/Popover/Popover.js +7 -7
- package/es/components/Popover/Popover.js.map +1 -1
- package/es/components/Popup/Popup.js +1 -1
- package/es/components/Popup/Popup.js.map +1 -1
- package/es/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
- package/es/components/Segment/ui/SegmentItem/SegmentItem.js.map +1 -1
- package/es/components/Select/Select.js +5 -5
- package/es/components/Select/Select.js.map +1 -1
- package/es/components/Select/hooks/useKeyNavigation.js +12 -12
- package/es/components/Select/hooks/useKeyNavigation.js.map +1 -1
- package/es/components/Select/ui/SelectChip/SelectChip.js +1 -1
- package/es/components/Select/ui/SelectChip/SelectChip.js.map +1 -1
- package/es/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
- package/es/components/Select/ui/SelectTarget/SelectTarget.js.map +1 -1
- package/es/components/Select/utils/index.js +2 -2
- package/es/components/Select/utils/index.js.map +1 -1
- package/es/components/Tabs/TabsContext.js +1 -2
- package/es/components/Tabs/TabsContext.js.map +1 -1
- package/es/components/Tabs/ui/TabItem/TabItem.js +1 -1
- package/es/components/Tabs/ui/TabItem/TabItem.js.map +1 -1
- package/es/components/Tabs/ui/Tabs/Tabs.js +2 -2
- package/es/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
- package/es/components/TextArea/TextArea.js +1 -1
- package/es/components/TextArea/TextArea.js.map +1 -1
- package/es/components/TextField/TextField.js +2 -2
- package/es/components/TextField/TextField.js.map +1 -1
- package/es/components/TextField/hooks/useKeyNavigation.js +9 -9
- package/es/components/TextField/hooks/useKeyNavigation.js.map +1 -1
- package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
- package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
- package/es/components/Toast/ToastProvider/ToastProvider.js +2 -2
- package/es/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
- package/es/components/Tooltip/Tooltip.js +1 -1
- package/es/components/Tooltip/Tooltip.js.map +1 -1
- package/package.json +13 -13
- package/styled-components/cjs/components/Avatar/Avatar.js +1 -1
- package/styled-components/cjs/components/Avatar/Avatar.styles.js +1 -1
- package/styled-components/cjs/components/AvatarGroup/AvatarGroup.js +1 -1
- package/styled-components/cjs/components/Badge/Badge.js +1 -1
- package/styled-components/cjs/components/Badge/Badge.styles.js +1 -1
- package/styled-components/cjs/components/Button/Button.js +2 -2
- package/styled-components/cjs/components/Button/Button.styles.js +1 -1
- package/styled-components/cjs/components/ButtonGroup/ButtonGroup.js +1 -1
- package/styled-components/cjs/components/Calendar/CalendarBase/CalendarBase.js +2 -2
- package/styled-components/cjs/components/Calendar/CalendarBase/CalendarBase.styles.js +1 -1
- package/styled-components/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +2 -2
- package/styled-components/cjs/components/Calendar/CalendarDouble/CalendarDouble.styles.js +1 -1
- package/styled-components/cjs/components/Calendar/hoc/withRange.js +2 -2
- package/styled-components/cjs/components/Calendar/hooks/useKeyNavigation.js +20 -20
- package/styled-components/cjs/components/Calendar/store/reducer.js +1 -1
- package/styled-components/cjs/components/Calendar/ui/CalendarDayItem/CalendarDayItem.js +1 -1
- package/styled-components/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +4 -4
- package/styled-components/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js +3 -3
- package/styled-components/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +2 -2
- package/styled-components/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +2 -2
- package/styled-components/cjs/components/Cell/Cell.js +1 -1
- package/styled-components/cjs/components/Cell/Cell.styles.js +1 -1
- package/styled-components/cjs/components/Checkbox/Checkbox.js +1 -1
- package/styled-components/cjs/components/Chip/Chip.js +3 -3
- package/styled-components/cjs/components/Chip/Chip.styles.js +1 -1
- package/styled-components/cjs/components/Combobox/Combobox.js +6 -6
- package/styled-components/cjs/components/Combobox/hooks/useFocusController.js +9 -9
- package/styled-components/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js +2 -2
- package/styled-components/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +7 -7
- package/styled-components/cjs/components/Counter/Counter.js +1 -1
- package/styled-components/cjs/components/Divider/Divider.js +2 -2
- package/styled-components/cjs/components/Drawer/Drawer.js +1 -1
- package/styled-components/cjs/components/Drawer/DrawerContext.js +1 -1
- package/styled-components/cjs/components/Drawer/hooks/useDrawer.js +1 -1
- package/styled-components/cjs/components/Drawer/ui/DrawerContent/DrawerContent.js +1 -1
- package/styled-components/cjs/components/Drawer/ui/DrawerFooter/DrawerFooter.js +1 -1
- package/styled-components/cjs/components/Drawer/ui/DrawerHeader/DrawerHeader.js +1 -1
- package/styled-components/cjs/components/Dropdown/Dropdown.js +1 -1
- package/styled-components/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +1 -1
- package/styled-components/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +1 -1
- package/styled-components/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +1 -1
- package/styled-components/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +1 -1
- package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js +4 -4
- package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +1 -1
- package/styled-components/cjs/components/Dropdown/utils/index.js +1 -1
- package/styled-components/cjs/components/Grid/Grid.js +2 -2
- package/styled-components/cjs/components/Grid/ui/Col/Col.js +2 -2
- package/styled-components/cjs/components/Grid/ui/Row/Row.js +1 -1
- package/styled-components/cjs/components/Grid/utils/index.js +1 -1
- package/styled-components/cjs/components/Header/HeaderRoot/HeaderRoot.js +1 -1
- package/styled-components/cjs/components/Header/ui/HeaderArrow/HeaderArrow.js +1 -1
- package/styled-components/cjs/components/Header/ui/HeaderLogo/HeaderLogo.js +1 -1
- package/styled-components/cjs/components/Header/ui/HeaderTitleWrapper/HeaderTitleWrapper.js +1 -1
- package/styled-components/cjs/components/Image/Image.js +2 -2
- package/styled-components/cjs/components/Image/Image.styles.js +1 -1
- package/styled-components/cjs/components/Indicator/Indicator.js +1 -1
- package/styled-components/cjs/components/Link/Link.js +1 -1
- package/styled-components/cjs/components/Modal/Modal.js +1 -1
- package/styled-components/cjs/components/Modal/ModalContext.js +1 -1
- package/styled-components/cjs/components/Modal/hooks/useModal.js +1 -1
- package/styled-components/cjs/components/Notification/Notification.js +1 -1
- package/styled-components/cjs/components/Notification/Notification.styles.js +1 -1
- package/styled-components/cjs/components/Notification/NotificationsPortal.js +1 -1
- package/styled-components/cjs/components/Notification/NotificationsStore.js +1 -1
- package/styled-components/cjs/components/Overlay/Overlay.js +2 -2
- package/styled-components/cjs/components/Pagination/Pagination.js +3 -3
- package/styled-components/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +2 -2
- package/styled-components/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/styled-components/cjs/components/Panel/Panel.js +2 -2
- package/styled-components/cjs/components/Panel/ui/PanelContent/PanelContent.js +1 -1
- package/styled-components/cjs/components/Panel/ui/PanelFooter/PanelFooter.js +1 -1
- package/styled-components/cjs/components/Panel/ui/PanelHeader/PanelHeader.js +1 -1
- package/styled-components/cjs/components/Popover/Popover.js +9 -9
- package/styled-components/cjs/components/Popup/Popup.js +2 -2
- package/styled-components/cjs/components/Popup/PopupContext.js +1 -1
- package/styled-components/cjs/components/Popup/PopupRoot.js +1 -1
- package/styled-components/cjs/components/Popup/hooks/usePopup.js +1 -1
- package/styled-components/cjs/components/Progress/Progress.js +1 -1
- package/styled-components/cjs/components/Progress/Progress.styles.js +1 -1
- package/styled-components/cjs/components/Radiobox/Radiobox.js +1 -1
- package/styled-components/cjs/components/SSRProvider/SSRProvider.js +1 -1
- package/styled-components/cjs/components/Segment/SegmentProvider/SegmentProvider.js +1 -1
- package/styled-components/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.js +1 -1
- package/styled-components/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.styles.js +1 -1
- package/styled-components/cjs/components/Segment/ui/SegmentItem/SegmentItem.js +3 -3
- package/styled-components/cjs/components/Segment/ui/SegmentItem/SegmentItem.styles.js +1 -1
- package/styled-components/cjs/components/Select/Select.js +6 -6
- package/styled-components/cjs/components/Select/hooks/useKeyNavigation.js +12 -12
- package/styled-components/cjs/components/Select/ui/SelectChip/SelectChip.js +2 -2
- package/styled-components/cjs/components/Select/ui/SelectTarget/SelectTarget.js +3 -3
- package/styled-components/cjs/components/Select/utils/index.js +3 -3
- package/styled-components/cjs/components/Skeleton/LineSkeleton/LineSkeleton.js +1 -1
- package/styled-components/cjs/components/Skeleton/LineSkeleton/LineSkeleton.styles.js +1 -1
- package/styled-components/cjs/components/Skeleton/RectSkeleton/RectSkeleton.js +1 -1
- package/styled-components/cjs/components/Skeleton/TextSkeleton/TextSkeleton.js +2 -2
- package/styled-components/cjs/components/Skeleton/hoc/withSkeleton.js +1 -1
- package/styled-components/cjs/components/Spinner/Spinner.js +1 -1
- package/styled-components/cjs/components/Spinner/Spinner.styles.js +1 -1
- package/styled-components/cjs/components/Spinner/utils/index.js +1 -1
- package/styled-components/cjs/components/Switch/Switch.js +1 -1
- package/styled-components/cjs/components/Tabs/TabsContext.js +2 -3
- package/styled-components/cjs/components/Tabs/createTabsController.js +1 -1
- package/styled-components/cjs/components/Tabs/ui/TabItem/TabItem.js +2 -2
- package/styled-components/cjs/components/Tabs/ui/TabItem/TabItem.styles.js +1 -1
- package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.js +3 -3
- package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.styles.js +1 -1
- package/styled-components/cjs/components/TextArea/TextArea.js +2 -2
- package/styled-components/cjs/components/TextField/TextField.js +3 -3
- package/styled-components/cjs/components/TextField/hooks/useKeyNavigation.js +9 -9
- package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +2 -2
- package/styled-components/cjs/components/Toast/Toast.js +2 -2
- package/styled-components/cjs/components/Toast/Toast.styles.js +1 -1
- package/styled-components/cjs/components/Toast/ToastController.js +2 -2
- package/styled-components/cjs/components/Toast/ToastProvider/ToastProvider.js +3 -3
- package/styled-components/cjs/components/Toolbar/Toolbar.js +1 -1
- package/styled-components/cjs/components/Toolbar/ui/ToolbarDivider/ToolbarDivider.js +1 -1
- package/styled-components/cjs/components/Tooltip/Tooltip.js +2 -2
- package/styled-components/cjs/components/Typography/Old/Subtitle/Subtitle.js +2 -2
- package/styled-components/cjs/components/Typography/Old/TypographyOld.js +2 -2
- package/styled-components/cjs/components/Typography/Typography.js +2 -2
- package/styled-components/cjs/engines/common.js +1 -1
- package/styled-components/cjs/engines/styled-components.js +1 -1
- package/styled-components/cjs/examples/_helpers.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Grid/Grid.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Grid/Grid.config.js +1 -1
- package/styled-components/cjs/examples/sds_engineer/components/Grid/Grid.config.js +1 -1
- package/styled-components/cjs/mixins/applySpacing.js +1 -1
- package/styled-components/cjs/mixins/typography.js +1 -1
- package/styled-components/es/components/Button/Button.js +1 -1
- package/styled-components/es/components/Calendar/CalendarBase/CalendarBase.js +1 -1
- package/styled-components/es/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
- package/styled-components/es/components/Calendar/hoc/withRange.js +1 -1
- package/styled-components/es/components/Calendar/hooks/useKeyNavigation.js +20 -20
- package/styled-components/es/components/Calendar/store/reducer.js +1 -1
- package/styled-components/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
- package/styled-components/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
- package/styled-components/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
- package/styled-components/es/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
- package/styled-components/es/components/Chip/Chip.js +2 -2
- package/styled-components/es/components/Combobox/Combobox.js +5 -5
- package/styled-components/es/components/Combobox/hooks/useFocusController.js +9 -9
- package/styled-components/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
- package/styled-components/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
- package/styled-components/es/components/Divider/Divider.js +1 -1
- package/styled-components/es/components/Drawer/DrawerContext.js +1 -1
- package/styled-components/es/components/Drawer/hooks/useDrawer.js +1 -1
- package/styled-components/es/components/Drawer/ui/DrawerContent/DrawerContent.js +1 -1
- package/styled-components/es/components/Drawer/ui/DrawerFooter/DrawerFooter.js +1 -1
- package/styled-components/es/components/Drawer/ui/DrawerHeader/DrawerHeader.js +1 -1
- package/styled-components/es/components/Dropdown/ui/DropdownItem/DropdownItem.js +3 -3
- package/styled-components/es/components/Grid/Grid.js +1 -1
- package/styled-components/es/components/Grid/ui/Col/Col.js +1 -1
- package/styled-components/es/components/Grid/utils/index.js +1 -1
- package/styled-components/es/components/Image/Image.js +1 -1
- package/styled-components/es/components/Modal/ModalContext.js +1 -1
- package/styled-components/es/components/Modal/hooks/useModal.js +1 -1
- package/styled-components/es/components/Notification/NotificationsStore.js +1 -1
- package/styled-components/es/components/Overlay/Overlay.js +1 -1
- package/styled-components/es/components/Pagination/Pagination.js +2 -2
- package/styled-components/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
- package/styled-components/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
- package/styled-components/es/components/Panel/Panel.js +1 -1
- package/styled-components/es/components/Popover/Popover.js +8 -8
- package/styled-components/es/components/Popup/Popup.js +1 -1
- package/styled-components/es/components/Popup/hooks/usePopup.js +1 -1
- package/styled-components/es/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
- package/styled-components/es/components/Select/Select.js +5 -5
- package/styled-components/es/components/Select/hooks/useKeyNavigation.js +12 -12
- package/styled-components/es/components/Select/ui/SelectChip/SelectChip.js +1 -1
- package/styled-components/es/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
- package/styled-components/es/components/Select/utils/index.js +3 -3
- package/styled-components/es/components/Skeleton/TextSkeleton/TextSkeleton.js +1 -1
- package/styled-components/es/components/Skeleton/hoc/withSkeleton.js +1 -1
- package/styled-components/es/components/Spinner/utils/index.js +1 -1
- package/styled-components/es/components/Tabs/TabsContext.js +2 -3
- package/styled-components/es/components/Tabs/ui/TabItem/TabItem.js +1 -1
- package/styled-components/es/components/Tabs/ui/Tabs/Tabs.js +2 -2
- package/styled-components/es/components/TextArea/TextArea.js +1 -1
- package/styled-components/es/components/TextField/TextField.js +2 -2
- package/styled-components/es/components/TextField/hooks/useKeyNavigation.js +9 -9
- package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
- package/styled-components/es/components/Toast/Toast.js +1 -1
- package/styled-components/es/components/Toast/ToastController.js +1 -1
- package/styled-components/es/components/Toast/ToastProvider/ToastProvider.js +2 -2
- package/styled-components/es/components/Toolbar/ui/ToolbarDivider/ToolbarDivider.js +1 -1
- package/styled-components/es/components/Tooltip/Tooltip.js +1 -1
- package/styled-components/es/components/Typography/Old/Subtitle/Subtitle.js +1 -1
- package/styled-components/es/components/Typography/Old/TypographyOld.js +1 -1
- package/styled-components/es/components/Typography/Typography.js +1 -1
- package/styled-components/es/engines/common.js +1 -1
- package/styled-components/es/examples/_helpers.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Grid/Grid.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Grid/Grid.config.js +1 -1
- package/styled-components/es/examples/sds_engineer/components/Grid/Grid.config.js +1 -1
- package/styled-components/es/mixins/applySpacing.js +1 -1
- package/styled-components/es/mixins/typography.js +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"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,KA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AAA,KAAA,EAEIC,IAAI,CAERwB,eAAAA,KAAA,CAAAC,aAAA,CAACtD,IAAI,EAAA;AAACuB,MAAAA,IAAI,EAAEA,IAAK;AAACC,MAAAA,IAAI,EAAEA,IAAK;AAACU,MAAAA,GAAG,EAAEC,MAAAA;AAAO,KAAA,eACtCkB,KAAA,CAAAC,aAAA,CAACM,0BAAW,EAAA;AACR1B,MAAAA,GAAG,EAAE/B,QAAS;AACdC,MAAAA,EAAE,EAAEA,EAAG;AACPwB,MAAAA,SAAS,EAAE6B,QAAE,CAACN,eAAe,CAAE;AAC/BpC,MAAAA,QAAQ,EAAE5B,cAAc,CAAC4B,QAAQ,CAAE;MACnCD,QAAQ,EAAE3B,cAAc,CAAC2B,QAAQ,CAAA;AAAE,KAAA,EAElCW,WAAW,iBAAI4B,KAAA,CAAAC,aAAA,CAACO,gCAAiB,EAAEpC,IAAAA,EAAAA,WAA+B,CAAC,EACnEpB,IACQ,CACX,CACK,CAAC,CAAA;AAExB,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMyD,aAAa,GAAG;AACzBlE,EAAAA,IAAI,EAAE,SAAS;AACfmE,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEjE,WAAW;AACnBkE,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,UAAU,EAAE;AACR3C,IAAAA,IAAI,EAAE;AACF4C,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACD5C,IAAAA,IAAI,EAAE;AACF2C,MAAAA,GAAG,EAAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN/C,IAAAA,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,gBAAS,CAACC,uBAAa,CAAC,CAAA;AAAC,IAAAC,IAAA,GAlBvBA,SAkBuBA,IAAAA,GAAA;AAAA,EAAA,OAEZH,OAAO,CAAA;AAAA,CAAA,CAAA;AAApC,IAAMI,aAAa,gBAAGC,YAAM,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,gBAAU,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,MAAM;MAANA,MAAM,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AE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
|
@@ -149,7 +149,7 @@ var calendarBaseRoot = function calendarBaseRoot(Root) {
|
|
149
149
|
isOutOfRange = _useKeyNavigation2[4];
|
150
150
|
var handleOnChangeDay = useCallback(function (newDate, coord) {
|
151
151
|
var newDay = new Date(newDate.year, newDate.monthIndex, newDate.day);
|
152
|
-
onChangeValue === null || onChangeValue === void 0
|
152
|
+
onChangeValue === null || onChangeValue === void 0 || onChangeValue(newDay);
|
153
153
|
onSelectIndexes(coord);
|
154
154
|
}, [onChangeValue, onSelectIndexes]);
|
155
155
|
var handleOnChangeMonth = useCallback(function (monthIndex) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CalendarBase.js","sources":["../../../../src/components/Calendar/CalendarBase/CalendarBase.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useReducer, useState, KeyboardEvent, HTMLAttributes, forwardRef } from 'react';\n\nimport type { Calendar, DateObject, UseKeyNavigationProps } from '../Calendar.types';\nimport type { CalendarStateType } from '../store/types';\nimport { getInitialState, reducer } from '../store/reducer';\nimport { ActionType, CalendarState } from '../store/types';\nimport { isValueUpdate, YEAR_RENDER_COUNT } from '../utils';\nimport { useKeyNavigation } from '../hooks';\nimport { CalendarDays, CalendarHeader, CalendarMonths, CalendarYears } from '../ui';\nimport { RootProps } from '../../../engines';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { IsOutOfRange, StyledCalendar } from './CalendarBase.styles';\n\nexport type CalendarBaseProps = HTMLAttributes<HTMLDivElement> &\n Calendar & {\n /**\n * Тип отображения календаря: дни, месяца, года.\n */\n type?: CalendarStateType;\n };\n\n/**\n * Компонент календаря.\n */\nexport const calendarBaseRoot = (Root: RootProps<HTMLDivElement, HTMLAttributes<HTMLDivElement>>) =>\n forwardRef<HTMLDivElement, CalendarBaseProps>(\n (\n { value: externalValue, min, max, type = 'Days', eventList, disabledList, onChangeValue, ...rest },\n outerRootRef,\n ) => {\n const [firstValue, secondValue] = useMemo(\n () => (Array.isArray(externalValue) ? externalValue : [externalValue]),\n [externalValue],\n );\n const value = secondValue || firstValue;\n const [hoveredDay, setHoveredDay] = useState<DateObject | undefined>();\n const [prevType, setPrevType] = useState(type);\n const [prevValue, setPrevValue] = useState(value);\n const [outOfRangeKey, setOutOfRangeKey] = useState<number>(0);\n\n const [state, dispatch] = useReducer(reducer, getInitialState(value, [5, 6], type));\n\n const { date, calendarState, startYear, size } = state;\n\n const handlePrev = useCallback<UseKeyNavigationProps['onPrev']>(\n (withShift = false) => {\n if (calendarState === CalendarState.Days) {\n if (withShift) {\n dispatch({\n type: ActionType.PREVIOUS_YEAR,\n payload: { step: 1 },\n });\n\n return;\n }\n\n dispatch({\n type: ActionType.PREVIOUS_MONTH,\n payload: { monthIndex: date.monthIndex, year: date.year },\n });\n\n return;\n }\n\n if (calendarState === CalendarState.Months) {\n dispatch({ type: ActionType.PREVIOUS_YEAR, payload: { step: 1 } });\n\n return;\n }\n\n if (calendarState === CalendarState.Years) {\n dispatch({ type: ActionType.PREVIOUS_START_YEAR, payload: { yearsCount: YEAR_RENDER_COUNT } });\n }\n },\n [date, calendarState],\n );\n\n const handleNext = useCallback<UseKeyNavigationProps['onNext']>(\n (withShift = false) => {\n if (calendarState === CalendarState.Days) {\n if (withShift) {\n dispatch({\n type: ActionType.NEXT_YEAR,\n payload: { step: 1 },\n });\n\n return;\n }\n\n dispatch({\n type: ActionType.NEXT_MONTH,\n payload: { monthIndex: date.monthIndex, year: date.year },\n });\n\n return;\n }\n\n if (calendarState === CalendarState.Months) {\n dispatch({ type: ActionType.NEXT_YEAR, payload: { step: 1 } });\n\n return;\n }\n\n if (calendarState === CalendarState.Years) {\n dispatch({ type: ActionType.NEXT_START_YEAR, payload: { yearsCount: YEAR_RENDER_COUNT } });\n }\n },\n [date, calendarState],\n );\n\n const [selectIndexes, onKeyDown, onSelectIndexes, outerRefs, isOutOfRange] = useKeyNavigation({\n size,\n onNext: handleNext,\n onPrev: handlePrev,\n });\n\n const handleOnChangeDay = useCallback(\n (newDate: DateObject, coord: number[]) => {\n const newDay = new Date(newDate.year, newDate.monthIndex, newDate.day);\n onChangeValue?.(newDay);\n\n onSelectIndexes(coord);\n },\n [onChangeValue, onSelectIndexes],\n );\n\n const handleOnChangeMonth = useCallback((monthIndex: number) => {\n dispatch({\n type: ActionType.UPDATE_MONTH,\n payload: { calendarState: CalendarState.Days, monthIndex, size: [5, 6] },\n });\n }, []);\n\n const handleOnChangeYear = useCallback((year: number) => {\n dispatch({\n type: ActionType.UPDATE_YEAR,\n payload: { calendarState: CalendarState.Months, year },\n });\n }, []);\n\n const handleUpdateCalendarState = useCallback(\n (newCalendarState: CalendarStateType, newSize: [number, number]) => {\n dispatch({\n type: ActionType.UPDATE_CALENDAR_STATE,\n payload: { calendarState: newCalendarState, size: newSize },\n });\n },\n [],\n );\n\n if (value && prevValue && isValueUpdate(value, prevValue)) {\n dispatch({\n type: ActionType.UPDATE_DATE,\n payload: { value },\n });\n\n setPrevValue(value);\n }\n\n if (prevType !== type) {\n dispatch({\n type: ActionType.UPDATE_CALENDAR_STATE,\n payload: { calendarState: type },\n });\n\n setPrevType(type);\n }\n\n // Изменяем ключ каждый раз как пытаемся перейти на даты которые находятся за пределами min/max ограничений.\n // Это необходимо для того чтобы screen-reader корректно озвучивал уведомление aria-live=\"assertive\"\n // о том что нет доступных дат\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n setOutOfRangeKey((previousState) => Number(!previousState));\n\n onKeyDown(event);\n },\n [onKeyDown],\n );\n\n return (\n <Root ref={outerRootRef} aria-label=\"Выбор даты\" {...rest}>\n {isOutOfRange && (\n <IsOutOfRange\n key={outOfRangeKey}\n aria-atomic=\"true\"\n role=\"alert\"\n aria-live=\"assertive\"\n aria-relevant=\"additions\"\n >\n Далее нет доступных дат.\n </IsOutOfRange>\n )}\n <CalendarHeader\n firstDate={date}\n startYear={startYear}\n type={calendarState}\n onPrev={handlePrev}\n onNext={handleNext}\n onUpdateCalendarState={handleUpdateCalendarState}\n />\n {calendarState === CalendarState.Days && (\n <CalendarDays\n eventList={eventList}\n disabledList={disabledList}\n min={min}\n max={max}\n value={externalValue}\n date={date}\n hoveredDay={hoveredDay}\n selectIndexes={selectIndexes}\n onChangeDay={handleOnChangeDay}\n onHoverDay={setHoveredDay}\n onSetSelected={onSelectIndexes}\n onKeyDown={handleKeyDown}\n outerRefs={outerRefs}\n />\n )}\n {calendarState === CalendarState.Months && (\n <CalendarMonths\n date={date}\n selectIndexes={selectIndexes}\n onChangeMonth={handleOnChangeMonth}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n )}\n {calendarState === CalendarState.Years && (\n <CalendarYears\n date={date}\n startYear={startYear}\n selectIndexes={selectIndexes}\n onChangeYear={handleOnChangeYear}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n )}\n </Root>\n );\n },\n );\n\nexport const calendarBaseConfig = {\n name: 'CalendarBase',\n tag: 'div',\n layout: calendarBaseRoot,\n base: StyledCalendar,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["calendarBaseRoot","Root","forwardRef","_ref","outerRootRef","externalValue","value","min","max","_ref$type","type","eventList","disabledList","onChangeValue","rest","_objectWithoutProperties","_excluded","_useMemo","useMemo","Array","isArray","_useMemo2","_slicedToArray","firstValue","secondValue","_useState","useState","_useState2","hoveredDay","setHoveredDay","_useState3","_useState4","prevType","setPrevType","_useState5","_useState6","prevValue","setPrevValue","_useState7","_useState8","outOfRangeKey","setOutOfRangeKey","_useReducer","useReducer","reducer","getInitialState","_useReducer2","state","dispatch","date","calendarState","startYear","size","handlePrev","useCallback","withShift","arguments","length","undefined","CalendarState","Days","ActionType","PREVIOUS_YEAR","payload","step","PREVIOUS_MONTH","monthIndex","year","Months","Years","PREVIOUS_START_YEAR","yearsCount","YEAR_RENDER_COUNT","handleNext","NEXT_YEAR","NEXT_MONTH","NEXT_START_YEAR","_useKeyNavigation","useKeyNavigation","onNext","onPrev","_useKeyNavigation2","selectIndexes","onKeyDown","onSelectIndexes","outerRefs","isOutOfRange","handleOnChangeDay","newDate","coord","newDay","Date","day","handleOnChangeMonth","UPDATE_MONTH","handleOnChangeYear","UPDATE_YEAR","handleUpdateCalendarState","newCalendarState","newSize","UPDATE_CALENDAR_STATE","isValueUpdate","UPDATE_DATE","handleKeyDown","event","previousState","Number","React","createElement","_extends","ref","IsOutOfRange","key","role","CalendarHeader","firstDate","onUpdateCalendarState","CalendarDays","onChangeDay","onHoverDay","onSetSelected","CalendarMonths","onChangeMonth","CalendarYears","onChangeYear","calendarBaseConfig","name","tag","layout","base","StyledCalendar","variations","view","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;AAuBA;AACA;AACA;IACaA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,IAA+D,EAAA;AAAA,EAAA,oBAC5FC,UAAU,CACN,UAAAC,IAAA,EAEIC,YAAY,EACX;AAAA,IAAA,IAFQC,aAAa,GAAAF,IAAA,CAApBG,KAAK;MAAiBC,GAAG,GAAAJ,IAAA,CAAHI,GAAG;MAAEC,GAAG,GAAAL,IAAA,CAAHK,GAAG;MAAAC,SAAA,GAAAN,IAAA,CAAEO,IAAI;AAAJA,MAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,SAAA;MAAEE,SAAS,GAAAR,IAAA,CAATQ,SAAS;MAAEC,YAAY,GAAAT,IAAA,CAAZS,YAAY;MAAEC,aAAa,GAAAV,IAAA,CAAbU,aAAa;AAAKC,MAAAA,IAAI,GAAAC,wBAAA,CAAAZ,IAAA,EAAAa,SAAA,CAAA,CAAA;IAGhG,IAAAC,QAAA,GAAkCC,OAAO,C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AAA,SAAS,EAAEA,SAAU;AACrBE,MAAAA,SAAS,EAAEA,SAAAA;AAAU,KACxB,CACJ,EACAnC,aAAa,KAAKS,aAAa,CAACU,KAAK,iBAClCsC,KAAA,CAAAC,aAAA,CAACe,aAAa,EAAA;AACV1E,MAAAA,IAAI,EAAEA,IAAK;AACXE,MAAAA,SAAS,EAAEA,SAAU;AACrB+B,MAAAA,aAAa,EAAEA,aAAc;AAC7B0C,MAAAA,YAAY,EAAE7B,kBAAmB;AACjCyB,MAAAA,aAAa,EAAEpC,eAAgB;AAC/BD,MAAAA,SAAS,EAAEA,SAAU;AACrBE,MAAAA,SAAS,EAAEA,SAAAA;AAAU,KACxB,CAEH,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMwC,kBAAkB,GAAG;AAC9BC,EAAAA,IAAI,EAAE,cAAc;AACpBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEhI,gBAAgB;AACxBiI,EAAAA,IAAI,EAAEC,cAAc;AACpBC,EAAAA,UAAU,EAAE;AACRC,IAAAA,IAAI,EAAE;AACFC,MAAAA,GAAG,EAAEC,IAAAA;KACR;AACDlF,IAAAA,IAAI,EAAE;AACFiF,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNJ,IAAAA,IAAI,EAAE,SAAS;AACfhF,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
1
|
+
{"version":3,"file":"CalendarBase.js","sources":["../../../../src/components/Calendar/CalendarBase/CalendarBase.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useReducer, useState, KeyboardEvent, HTMLAttributes, forwardRef } from 'react';\n\nimport type { Calendar, DateObject, UseKeyNavigationProps } from '../Calendar.types';\nimport type { CalendarStateType } from '../store/types';\nimport { getInitialState, reducer } from '../store/reducer';\nimport { ActionType, CalendarState } from '../store/types';\nimport { isValueUpdate, YEAR_RENDER_COUNT } from '../utils';\nimport { useKeyNavigation } from '../hooks';\nimport { CalendarDays, CalendarHeader, CalendarMonths, CalendarYears } from '../ui';\nimport { RootProps } from '../../../engines';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { IsOutOfRange, StyledCalendar } from './CalendarBase.styles';\n\nexport type CalendarBaseProps = HTMLAttributes<HTMLDivElement> &\n Calendar & {\n /**\n * Тип отображения календаря: дни, месяца, года.\n */\n type?: CalendarStateType;\n };\n\n/**\n * Компонент календаря.\n */\nexport const calendarBaseRoot = (Root: RootProps<HTMLDivElement, HTMLAttributes<HTMLDivElement>>) =>\n forwardRef<HTMLDivElement, CalendarBaseProps>(\n (\n { value: externalValue, min, max, type = 'Days', eventList, disabledList, onChangeValue, ...rest },\n outerRootRef,\n ) => {\n const [firstValue, secondValue] = useMemo(\n () => (Array.isArray(externalValue) ? externalValue : [externalValue]),\n [externalValue],\n );\n const value = secondValue || firstValue;\n const [hoveredDay, setHoveredDay] = useState<DateObject | undefined>();\n const [prevType, setPrevType] = useState(type);\n const [prevValue, setPrevValue] = useState(value);\n const [outOfRangeKey, setOutOfRangeKey] = useState<number>(0);\n\n const [state, dispatch] = useReducer(reducer, getInitialState(value, [5, 6], type));\n\n const { date, calendarState, startYear, size } = state;\n\n const handlePrev = useCallback<UseKeyNavigationProps['onPrev']>(\n (withShift = false) => {\n if (calendarState === CalendarState.Days) {\n if (withShift) {\n dispatch({\n type: ActionType.PREVIOUS_YEAR,\n payload: { step: 1 },\n });\n\n return;\n }\n\n dispatch({\n type: ActionType.PREVIOUS_MONTH,\n payload: { monthIndex: date.monthIndex, year: date.year },\n });\n\n return;\n }\n\n if (calendarState === CalendarState.Months) {\n dispatch({ type: ActionType.PREVIOUS_YEAR, payload: { step: 1 } });\n\n return;\n }\n\n if (calendarState === CalendarState.Years) {\n dispatch({ type: ActionType.PREVIOUS_START_YEAR, payload: { yearsCount: YEAR_RENDER_COUNT } });\n }\n },\n [date, calendarState],\n );\n\n const handleNext = useCallback<UseKeyNavigationProps['onNext']>(\n (withShift = false) => {\n if (calendarState === CalendarState.Days) {\n if (withShift) {\n dispatch({\n type: ActionType.NEXT_YEAR,\n payload: { step: 1 },\n });\n\n return;\n }\n\n dispatch({\n type: ActionType.NEXT_MONTH,\n payload: { monthIndex: date.monthIndex, year: date.year },\n });\n\n return;\n }\n\n if (calendarState === CalendarState.Months) {\n dispatch({ type: ActionType.NEXT_YEAR, payload: { step: 1 } });\n\n return;\n }\n\n if (calendarState === CalendarState.Years) {\n dispatch({ type: ActionType.NEXT_START_YEAR, payload: { yearsCount: YEAR_RENDER_COUNT } });\n }\n },\n [date, calendarState],\n );\n\n const [selectIndexes, onKeyDown, onSelectIndexes, outerRefs, isOutOfRange] = useKeyNavigation({\n size,\n onNext: handleNext,\n onPrev: handlePrev,\n });\n\n const handleOnChangeDay = useCallback(\n (newDate: DateObject, coord: number[]) => {\n const newDay = new Date(newDate.year, newDate.monthIndex, newDate.day);\n onChangeValue?.(newDay);\n\n onSelectIndexes(coord);\n },\n [onChangeValue, onSelectIndexes],\n );\n\n const handleOnChangeMonth = useCallback((monthIndex: number) => {\n dispatch({\n type: ActionType.UPDATE_MONTH,\n payload: { calendarState: CalendarState.Days, monthIndex, size: [5, 6] },\n });\n }, []);\n\n const handleOnChangeYear = useCallback((year: number) => {\n dispatch({\n type: ActionType.UPDATE_YEAR,\n payload: { calendarState: CalendarState.Months, year },\n });\n }, []);\n\n const handleUpdateCalendarState = useCallback(\n (newCalendarState: CalendarStateType, newSize: [number, number]) => {\n dispatch({\n type: ActionType.UPDATE_CALENDAR_STATE,\n payload: { calendarState: newCalendarState, size: newSize },\n });\n },\n [],\n );\n\n if (value && prevValue && isValueUpdate(value, prevValue)) {\n dispatch({\n type: ActionType.UPDATE_DATE,\n payload: { value },\n });\n\n setPrevValue(value);\n }\n\n if (prevType !== type) {\n dispatch({\n type: ActionType.UPDATE_CALENDAR_STATE,\n payload: { calendarState: type },\n });\n\n setPrevType(type);\n }\n\n // Изменяем ключ каждый раз как пытаемся перейти на даты которые находятся за пределами min/max ограничений.\n // Это необходимо для того чтобы screen-reader корректно озвучивал уведомление aria-live=\"assertive\"\n // о том что нет доступных дат\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n setOutOfRangeKey((previousState) => Number(!previousState));\n\n onKeyDown(event);\n },\n [onKeyDown],\n );\n\n return (\n <Root ref={outerRootRef} aria-label=\"Выбор даты\" {...rest}>\n {isOutOfRange && (\n <IsOutOfRange\n key={outOfRangeKey}\n aria-atomic=\"true\"\n role=\"alert\"\n aria-live=\"assertive\"\n aria-relevant=\"additions\"\n >\n Далее нет доступных дат.\n </IsOutOfRange>\n )}\n <CalendarHeader\n firstDate={date}\n startYear={startYear}\n type={calendarState}\n onPrev={handlePrev}\n onNext={handleNext}\n onUpdateCalendarState={handleUpdateCalendarState}\n />\n {calendarState === CalendarState.Days && (\n <CalendarDays\n eventList={eventList}\n disabledList={disabledList}\n min={min}\n max={max}\n value={externalValue}\n date={date}\n hoveredDay={hoveredDay}\n selectIndexes={selectIndexes}\n onChangeDay={handleOnChangeDay}\n onHoverDay={setHoveredDay}\n onSetSelected={onSelectIndexes}\n onKeyDown={handleKeyDown}\n outerRefs={outerRefs}\n />\n )}\n {calendarState === CalendarState.Months && (\n <CalendarMonths\n date={date}\n selectIndexes={selectIndexes}\n onChangeMonth={handleOnChangeMonth}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n )}\n {calendarState === CalendarState.Years && (\n <CalendarYears\n date={date}\n startYear={startYear}\n selectIndexes={selectIndexes}\n onChangeYear={handleOnChangeYear}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n )}\n </Root>\n );\n },\n );\n\nexport const calendarBaseConfig = {\n name: 'CalendarBase',\n tag: 'div',\n layout: calendarBaseRoot,\n base: StyledCalendar,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["calendarBaseRoot","Root","forwardRef","_ref","outerRootRef","externalValue","value","min","max","_ref$type","type","eventList","disabledList","onChangeValue","rest","_objectWithoutProperties","_excluded","_useMemo","useMemo","Array","isArray","_useMemo2","_slicedToArray","firstValue","secondValue","_useState","useState","_useState2","hoveredDay","setHoveredDay","_useState3","_useState4","prevType","setPrevType","_useState5","_useState6","prevValue","setPrevValue","_useState7","_useState8","outOfRangeKey","setOutOfRangeKey","_useReducer","useReducer","reducer","getInitialState","_useReducer2","state","dispatch","date","calendarState","startYear","size","handlePrev","useCallback","withShift","arguments","length","undefined","CalendarState","Days","ActionType","PREVIOUS_YEAR","payload","step","PREVIOUS_MONTH","monthIndex","year","Months","Years","PREVIOUS_START_YEAR","yearsCount","YEAR_RENDER_COUNT","handleNext","NEXT_YEAR","NEXT_MONTH","NEXT_START_YEAR","_useKeyNavigation","useKeyNavigation","onNext","onPrev","_useKeyNavigation2","selectIndexes","onKeyDown","onSelectIndexes","outerRefs","isOutOfRange","handleOnChangeDay","newDate","coord","newDay","Date","day","handleOnChangeMonth","UPDATE_MONTH","handleOnChangeYear","UPDATE_YEAR","handleUpdateCalendarState","newCalendarState","newSize","UPDATE_CALENDAR_STATE","isValueUpdate","UPDATE_DATE","handleKeyDown","event","previousState","Number","React","createElement","_extends","ref","IsOutOfRange","key","role","CalendarHeader","firstDate","onUpdateCalendarState","CalendarDays","onChangeDay","onHoverDay","onSetSelected","CalendarMonths","onChangeMonth","CalendarYears","onChangeYear","calendarBaseConfig","name","tag","layout","base","StyledCalendar","variations","view","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;AAuBA;AACA;AACA;IACaA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,IAA+D,EAAA;AAAA,EAAA,oBAC5FC,UAAU,CACN,UAAAC,IAAA,EAEIC,YAAY,EACX;AAAA,IA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,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNJ,IAAAA,IAAI,EAAE,SAAS;AACfhF,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
@@ -89,7 +89,7 @@ var calendarDoubleRoot = function calendarDoubleRoot(Root) {
|
|
89
89
|
outerRefs = _useKeyNavigation2[3];
|
90
90
|
var handleOnChangeDay = useCallback(function (newDate, coord) {
|
91
91
|
var newDay = new Date(newDate.year, newDate.monthIndex, newDate.day);
|
92
|
-
onChangeValue === null || onChangeValue === void 0
|
92
|
+
onChangeValue === null || onChangeValue === void 0 || onChangeValue(newDay);
|
93
93
|
onSelectIndexes(coord);
|
94
94
|
}, [onChangeValue, onSelectIndexes]);
|
95
95
|
var firstDate = useMemo(function () {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CalendarDouble.js","sources":["../../../../src/components/Calendar/CalendarDouble/CalendarDouble.tsx"],"sourcesContent":["import React, { useState, useCallback, useMemo, forwardRef, HTMLAttributes } from 'react';\n\nimport type { Calendar, DateObject } from '../Calendar.types';\nimport { getDateFromValue, getNextDate, getPrevDate, isValueUpdate } from '../utils';\nimport { useKeyNavigation } from '../hooks';\nimport { CalendarDays, CalendarHeader } from '../ui';\nimport { RootProps } from '../../../engines/types';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { StyledCalendar, StyledSeparator, StyledWrapper } from './CalendarDouble.styles';\n\nexport type CalendarDoubleProps = HTMLAttributes<HTMLDivElement> & Calendar;\n\n/**\n * Компонент двойного календаря.\n */\nexport const calendarDoubleRoot = (Root: RootProps<HTMLDivElement, HTMLAttributes<HTMLDivElement>>) =>\n forwardRef<HTMLDivElement, CalendarDoubleProps>(\n ({ value: externalValue, min, max, eventList, disabledList, onChangeValue, ...rest }, outerRootRef) => {\n const [firstValue, secondValue] = useMemo(\n () => (Array.isArray(externalValue) ? externalValue : [externalValue]),\n [externalValue],\n );\n const value = secondValue || firstValue;\n const [hoveredDay, setHoveredDay] = useState<DateObject | undefined>();\n\n const [date, setDate] = useState<DateObject>(getDateFromValue(value));\n const [prevValue, setPrevValue] = useState(value);\n const [doubleDate, setMonths] = useState(() => {\n const nextDate = getDateFromValue(firstValue);\n const [initialYear, initialMonth] = getNextDate(nextDate.year, nextDate.monthIndex);\n\n return {\n monthIndex: [nextDate.monthIndex, initialMonth],\n year: [nextDate.year, initialYear],\n };\n });\n\n const handleMonth = useCallback(\n (getDate: (currentYear: number, currentMonth: number) => number[]) => {\n const [newCurrentYear, newCurrentMonth] = getDate(doubleDate.year[0], doubleDate.monthIndex[0]);\n const [newNextYear, newNextMonth] = getDate(doubleDate.year[1], doubleDate.monthIndex[1]);\n\n setMonths({\n monthIndex: [newCurrentMonth, newNextMonth],\n year: [newCurrentYear, newNextYear],\n });\n },\n [doubleDate],\n );\n\n const handlePrev = useCallback(() => {\n handleMonth(getPrevDate);\n }, [handleMonth]);\n\n const handleNext = useCallback(() => {\n handleMonth(getNextDate);\n }, [handleMonth]);\n\n const [selectIndexes, onKeyDown, onSelectIndexes, outerRefs] = useKeyNavigation({\n isDouble: true,\n size: [11, 6],\n onNext: handleNext,\n onPrev: handlePrev,\n });\n\n const handleOnChangeDay = useCallback(\n (newDate: DateObject, coord: number[]) => {\n const newDay = new Date(newDate.year, newDate.monthIndex, newDate.day);\n onChangeValue?.(newDay);\n\n onSelectIndexes(coord);\n },\n [onChangeValue, onSelectIndexes],\n );\n\n const firstDate = useMemo(\n () => ({\n day: date.day,\n year: doubleDate.year[0],\n monthIndex: doubleDate.monthIndex[0],\n }),\n [date, doubleDate],\n );\n\n const secondDate = useMemo(\n () => ({\n day: date.day,\n year: doubleDate.year[1],\n monthIndex: doubleDate.monthIndex[1],\n }),\n [date, doubleDate],\n );\n\n if (value && prevValue && isValueUpdate(value, prevValue)) {\n const newDate = getDateFromValue(value);\n\n const { year, monthIndex } = newDate;\n\n const {\n monthIndex: [, prevMonthIndex],\n year: [, prevYear],\n } = doubleDate;\n\n if (prevMonthIndex !== monthIndex || prevYear !== year) {\n const [nextYear, nextMonthIndex] = getNextDate(year, monthIndex);\n\n setDate(newDate);\n\n setMonths({\n monthIndex: [monthIndex, nextMonthIndex],\n year: [year, nextYear],\n });\n }\n\n setPrevValue(value);\n }\n\n return (\n <Root ref={outerRootRef} aria-label=\"Выбор даты\" {...rest}>\n <CalendarHeader\n isDouble\n firstDate={firstDate}\n secondDate={secondDate}\n onPrev={handlePrev}\n onNext={handleNext}\n />\n\n <StyledWrapper>\n <CalendarDays\n isDouble\n eventList={eventList}\n disabledList={disabledList}\n min={min}\n max={max}\n value={externalValue}\n date={firstDate}\n hoveredDay={hoveredDay}\n selectIndexes={selectIndexes}\n onChangeDay={handleOnChangeDay}\n onHoverDay={setHoveredDay}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n <StyledSeparator />\n <CalendarDays\n isDouble\n isSecond\n eventList={eventList}\n disabledList={disabledList}\n min={min}\n max={max}\n value={externalValue}\n date={secondDate}\n hoveredDay={hoveredDay}\n selectIndexes={selectIndexes}\n onChangeDay={handleOnChangeDay}\n onHoverDay={setHoveredDay}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n </StyledWrapper>\n </Root>\n );\n },\n );\n\nexport const calendarDoubleConfig = {\n name: 'CalendarDouble',\n tag: 'div',\n layout: calendarDoubleRoot,\n base: StyledCalendar,\n variations: {\n view: {\n css: viewCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["calendarDoubleRoot","Root","forwardRef","_ref","outerRootRef","externalValue","value","min","max","eventList","disabledList","onChangeValue","rest","_objectWithoutProperties","_excluded","_useMemo","useMemo","Array","isArray","_useMemo2","_slicedToArray","firstValue","secondValue","_useState","useState","_useState2","hoveredDay","setHoveredDay","_useState3","getDateFromValue","_useState4","date","setDate","_useState5","_useState6","prevValue","setPrevValue","_useState7","nextDate","_getNextDate","getNextDate","year","monthIndex","_getNextDate2","initialYear","initialMonth","_useState8","doubleDate","setMonths","handleMonth","useCallback","getDate","_getDate","_getDate2","newCurrentYear","newCurrentMonth","_getDate3","_getDate4","newNextYear","newNextMonth","handlePrev","getPrevDate","handleNext","_useKeyNavigation","useKeyNavigation","isDouble","size","onNext","onPrev","_useKeyNavigation2","selectIndexes","onKeyDown","onSelectIndexes","outerRefs","handleOnChangeDay","newDate","coord","newDay","Date","day","firstDate","secondDate","isValueUpdate","_doubleDate$monthInde","prevMonthIndex","_doubleDate$year","prevYear","_getNextDate3","_getNextDate4","nextYear","nextMonthIndex","React","createElement","_extends","ref","CalendarHeader","StyledWrapper","CalendarDays","onChangeDay","onHoverDay","onSetSelected","_StyledSeparator","StyledSeparator","isSecond","calendarDoubleConfig","name","tag","layout","base","StyledCalendar","variations","view","css","viewCSS","defaults"],"mappings":";;;;;;;;;;;;;AAaA;AACA;AACA;IACaA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,IAA+D,EAAA;AAAA,EAAA,oBAC9FC,UAAU,CACN,UAAAC,IAAA,EAAsFC,YAAY,EAAK;AAAA,IAAA,IAA7FC,aAAa,GAAAF,IAAA,CAApBG,KAAK;MAAiBC,GAAG,GAAAJ,IAAA,CAAHI,GAAG;MAAEC,GAAG,GAAAL,IAAA,CAAHK,GAAG;MAAEC,SAAS,GAAAN,IAAA,CAATM,SAAS;MAAEC,YAAY,GAAAP,IAAA,CAAZO,YAAY;MAAEC,aAAa,GAAAR,IAAA,CAAbQ,aAAa;AAAKC,MAAAA,IAAI,GAAAC,wBAAA,CAAAV,IAAA,EAAAW,SAAA,CAAA,CAAA;IAC9E,IAAAC,QAAA,GAAkCC,OAAO,CACrC,YAAA;QAAA,OAAOC,KAAK,CAACC,OAAO,CAACb,aAAa,CAAC,GAAGA,aAAa,GAAG,CAACA,aAAa,CAAC,CAAA;AAAA,OAAC,EACtE,CAACA,aAAa,CAClB,CAAC;MAAAc,SAAA,GAAAC,cAA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AAG,EAAEC,IAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNH,IAAAA,IAAI,EAAE,SAAS;AACf7C,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
1
|
+
{"version":3,"file":"CalendarDouble.js","sources":["../../../../src/components/Calendar/CalendarDouble/CalendarDouble.tsx"],"sourcesContent":["import React, { useState, useCallback, useMemo, forwardRef, HTMLAttributes } from 'react';\n\nimport type { Calendar, DateObject } from '../Calendar.types';\nimport { getDateFromValue, getNextDate, getPrevDate, isValueUpdate } from '../utils';\nimport { useKeyNavigation } from '../hooks';\nimport { CalendarDays, CalendarHeader } from '../ui';\nimport { RootProps } from '../../../engines/types';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { StyledCalendar, StyledSeparator, StyledWrapper } from './CalendarDouble.styles';\n\nexport type CalendarDoubleProps = HTMLAttributes<HTMLDivElement> & Calendar;\n\n/**\n * Компонент двойного календаря.\n */\nexport const calendarDoubleRoot = (Root: RootProps<HTMLDivElement, HTMLAttributes<HTMLDivElement>>) =>\n forwardRef<HTMLDivElement, CalendarDoubleProps>(\n ({ value: externalValue, min, max, eventList, disabledList, onChangeValue, ...rest }, outerRootRef) => {\n const [firstValue, secondValue] = useMemo(\n () => (Array.isArray(externalValue) ? externalValue : [externalValue]),\n [externalValue],\n );\n const value = secondValue || firstValue;\n const [hoveredDay, setHoveredDay] = useState<DateObject | undefined>();\n\n const [date, setDate] = useState<DateObject>(getDateFromValue(value));\n const [prevValue, setPrevValue] = useState(value);\n const [doubleDate, setMonths] = useState(() => {\n const nextDate = getDateFromValue(firstValue);\n const [initialYear, initialMonth] = getNextDate(nextDate.year, nextDate.monthIndex);\n\n return {\n monthIndex: [nextDate.monthIndex, initialMonth],\n year: [nextDate.year, initialYear],\n };\n });\n\n const handleMonth = useCallback(\n (getDate: (currentYear: number, currentMonth: number) => number[]) => {\n const [newCurrentYear, newCurrentMonth] = getDate(doubleDate.year[0], doubleDate.monthIndex[0]);\n const [newNextYear, newNextMonth] = getDate(doubleDate.year[1], doubleDate.monthIndex[1]);\n\n setMonths({\n monthIndex: [newCurrentMonth, newNextMonth],\n year: [newCurrentYear, newNextYear],\n });\n },\n [doubleDate],\n );\n\n const handlePrev = useCallback(() => {\n handleMonth(getPrevDate);\n }, [handleMonth]);\n\n const handleNext = useCallback(() => {\n handleMonth(getNextDate);\n }, [handleMonth]);\n\n const [selectIndexes, onKeyDown, onSelectIndexes, outerRefs] = useKeyNavigation({\n isDouble: true,\n size: [11, 6],\n onNext: handleNext,\n onPrev: handlePrev,\n });\n\n const handleOnChangeDay = useCallback(\n (newDate: DateObject, coord: number[]) => {\n const newDay = new Date(newDate.year, newDate.monthIndex, newDate.day);\n onChangeValue?.(newDay);\n\n onSelectIndexes(coord);\n },\n [onChangeValue, onSelectIndexes],\n );\n\n const firstDate = useMemo(\n () => ({\n day: date.day,\n year: doubleDate.year[0],\n monthIndex: doubleDate.monthIndex[0],\n }),\n [date, doubleDate],\n );\n\n const secondDate = useMemo(\n () => ({\n day: date.day,\n year: doubleDate.year[1],\n monthIndex: doubleDate.monthIndex[1],\n }),\n [date, doubleDate],\n );\n\n if (value && prevValue && isValueUpdate(value, prevValue)) {\n const newDate = getDateFromValue(value);\n\n const { year, monthIndex } = newDate;\n\n const {\n monthIndex: [, prevMonthIndex],\n year: [, prevYear],\n } = doubleDate;\n\n if (prevMonthIndex !== monthIndex || prevYear !== year) {\n const [nextYear, nextMonthIndex] = getNextDate(year, monthIndex);\n\n setDate(newDate);\n\n setMonths({\n monthIndex: [monthIndex, nextMonthIndex],\n year: [year, nextYear],\n });\n }\n\n setPrevValue(value);\n }\n\n return (\n <Root ref={outerRootRef} aria-label=\"Выбор даты\" {...rest}>\n <CalendarHeader\n isDouble\n firstDate={firstDate}\n secondDate={secondDate}\n onPrev={handlePrev}\n onNext={handleNext}\n />\n\n <StyledWrapper>\n <CalendarDays\n isDouble\n eventList={eventList}\n disabledList={disabledList}\n min={min}\n max={max}\n value={externalValue}\n date={firstDate}\n hoveredDay={hoveredDay}\n selectIndexes={selectIndexes}\n onChangeDay={handleOnChangeDay}\n onHoverDay={setHoveredDay}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n <StyledSeparator />\n <CalendarDays\n isDouble\n isSecond\n eventList={eventList}\n disabledList={disabledList}\n min={min}\n max={max}\n value={externalValue}\n date={secondDate}\n hoveredDay={hoveredDay}\n selectIndexes={selectIndexes}\n onChangeDay={handleOnChangeDay}\n onHoverDay={setHoveredDay}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n </StyledWrapper>\n </Root>\n );\n },\n );\n\nexport const calendarDoubleConfig = {\n name: 'CalendarDouble',\n tag: 'div',\n layout: calendarDoubleRoot,\n base: StyledCalendar,\n variations: {\n view: {\n css: viewCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["calendarDoubleRoot","Root","forwardRef","_ref","outerRootRef","externalValue","value","min","max","eventList","disabledList","onChangeValue","rest","_objectWithoutProperties","_excluded","_useMemo","useMemo","Array","isArray","_useMemo2","_slicedToArray","firstValue","secondValue","_useState","useState","_useState2","hoveredDay","setHoveredDay","_useState3","getDateFromValue","_useState4","date","setDate","_useState5","_useState6","prevValue","setPrevValue","_useState7","nextDate","_getNextDate","getNextDate","year","monthIndex","_getNextDate2","initialYear","initialMonth","_useState8","doubleDate","setMonths","handleMonth","useCallback","getDate","_getDate","_getDate2","newCurrentYear","newCurrentMonth","_getDate3","_getDate4","newNextYear","newNextMonth","handlePrev","getPrevDate","handleNext","_useKeyNavigation","useKeyNavigation","isDouble","size","onNext","onPrev","_useKeyNavigation2","selectIndexes","onKeyDown","onSelectIndexes","outerRefs","handleOnChangeDay","newDate","coord","newDay","Date","day","firstDate","secondDate","isValueUpdate","_doubleDate$monthInde","prevMonthIndex","_doubleDate$year","prevYear","_getNextDate3","_getNextDate4","nextYear","nextMonthIndex","React","createElement","_extends","ref","CalendarHeader","StyledWrapper","CalendarDays","onChangeDay","onHoverDay","onSetSelected","_StyledSeparator","StyledSeparator","isSecond","calendarDoubleConfig","name","tag","layout","base","StyledCalendar","variations","view","css","viewCSS","defaults"],"mappings":";;;;;;;;;;;;;AAaA;AACA;AACA;IACaA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,IAA+D,EAAA;AAAA,EAAA,oBAC9FC,UAAU,CACN,UAAAC,IAAA,EAAsFC,YAAY,EAAK;AAAA,IAAA,IAA7FC,aAAa,GAAAF,IAAA,CAApBG,KAAK;MAAiBC,GAAG,GAAAJ,IAAA,CAAHI,GAAG;MAAEC,GAAG,GAAAL,IAAA,CAAHK,GAAG;MAAEC,SAAS,GAAAN,IAAA,CAATM,SAAS;MAAEC,YAAY,GAAAP,IAAA,CAAZO,YAAY;MAAEC,aAAa,GAAAR,IAAA,CAAbQ,aAAa;AAAKC,MAAAA,IAAI,GAAAC,wBAAA,CAAAV,IAAA,EAAAW,SAAA,CAAA,CAAA;IAC9E,IAAAC,QAAA,GAAkCC,OAAO,CACrC,YAAA;QAAA,OAAOC,KAAK,CAACC,OAAO,CAACb,aAAa,CAAC,GAAGA,aAAa,GAAG,CAACA,aAAa,CAAC,CAAA;AAAA,OAAC,EACtE,CAACA,aAAa,CAClB,CAAC;MAAAc,SAAA,GAAAC,cAAA,CAAAL,QAAA,EAAA,CAAA,CAAA;AAHMM,MAAAA,UAAU,GAAAF,SAAA,CAAA,CAAA,CAAA;AAAEG,MAAAA,WAAW,GAAAH,SAAA,CAAA,CAAA,CAAA,CAAA;AAI9B,IAAA,IAAMb,KAAK,GAAGgB,WAAW,IAAID,UAAU,CAAA;AACvC,IAAA,IAAAE,SAAA,GAAoCC,QAAQ,EAA0B;MAAAC,UAAA,GAAAL,cAAA,CAAAG,SAAA,EAAA,CAAA,CAAA;AAA/DG,MAAAA,UAAU,GAAAD,UAAA,CAAA,CAAA,CAAA;AAAEE,MA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X,KAAA,CAAAC,aAAA,CAACK,YAAY,EAAA;MACThC,QAAQ,EAAA,IAAA;MACRsC,QAAQ,EAAA,IAAA;AACR9F,MAAAA,SAAS,EAAEA,SAAU;AACrBC,MAAAA,YAAY,EAAEA,YAAa;AAC3BH,MAAAA,GAAG,EAAEA,GAAI;AACTC,MAAAA,GAAG,EAAEA,GAAI;AACTF,MAAAA,KAAK,EAAED,aAAc;AACrB0B,MAAAA,IAAI,EAAEkD,UAAW;AACjBvD,MAAAA,UAAU,EAAEA,UAAW;AACvB4C,MAAAA,aAAa,EAAEA,aAAc;AAC7B4B,MAAAA,WAAW,EAAExB,iBAAkB;AAC/ByB,MAAAA,UAAU,EAAExE,aAAc;AAC1ByE,MAAAA,aAAa,EAAE5B,eAAgB;AAC/BD,MAAAA,SAAS,EAAEA,SAAU;AACrBE,MAAAA,SAAS,EAAEA,SAAAA;KACd,CACU,CACb,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAM+B,oBAAoB,GAAG;AAChCC,EAAAA,IAAI,EAAE,gBAAgB;AACtBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE3G,kBAAkB;AAC1B4G,EAAAA,IAAI,EAAEC,cAAc;AACpBC,EAAAA,UAAU,EAAE;AACRC,IAAAA,IAAI,EAAE;AACFC,MAAAA,GAAG,EAAEC,IAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNH,IAAAA,IAAI,EAAE,SAAS;AACf7C,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
@@ -40,7 +40,7 @@ var withRange = function withRange(Component) {
|
|
40
40
|
var handleOnChangeDay = useCallback(function (newDay) {
|
41
41
|
if (endValue) {
|
42
42
|
setValues([newDay, undefined]);
|
43
|
-
onChangeStartOfRange === null || onChangeStartOfRange === void 0
|
43
|
+
onChangeStartOfRange === null || onChangeStartOfRange === void 0 || onChangeStartOfRange(newDay);
|
44
44
|
return;
|
45
45
|
}
|
46
46
|
setValues([startValue, newDay]);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"withRange.js","sources":["../../../../src/components/Calendar/hoc/withRange.tsx"],"sourcesContent":["import React, { useMemo, useState, useCallback, ReactElement } from 'react';\n\nimport type { Calendar, CalendarRange } from '../Calendar.types';\nimport { getSortedValues, isValueUpdate } from '../utils';\n\n/**\n * HOC для календаря, дающий возможность выбора диапазона даты\n */\nexport const withRange = <T extends Calendar>(Component: React.FC<Calendar>) => ({\n value,\n disabledList,\n eventList,\n min,\n max,\n onChangeValue,\n onChangeStartOfRange,\n ...rest\n}: CalendarRange<T>): ReactElement<T> => {\n const [startExternalValue, endExternalValue] = useMemo(() => value, [value]);\n const [[startValue, endValue], setValues] = useState<[Date, Date?]>([startExternalValue, endExternalValue]);\n const [prevValue, setPrevValue] = useState(value);\n\n if (isValueUpdate(value, prevValue)) {\n setValues([startExternalValue, endExternalValue]);\n\n setPrevValue(value);\n }\n\n const handleOnChangeDay = useCallback(\n (newDay: Date) => {\n if (endValue) {\n setValues([newDay, undefined]);\n\n onChangeStartOfRange?.(newDay);\n\n return;\n }\n\n setValues([startValue, newDay]);\n\n const [first, second] = getSortedValues([startValue, newDay]);\n\n if (first) {\n onChangeValue([first, second]);\n }\n },\n [onChangeValue, onChangeStartOfRange, startValue, endValue],\n );\n\n return (\n <Component\n value={[startValue, endValue]}\n onChangeValue={handleOnChangeDay}\n disabledList={disabledList}\n eventList={eventList}\n min={min}\n max={max}\n {...rest}\n />\n );\n};\n"],"names":["withRange","Component","_ref","value","disabledList","eventList","min","max","onChangeValue","onChangeStartOfRange","rest","_objectWithoutProperties","_excluded","_useMemo","useMemo","_useMemo2","_slicedToArray","startExternalValue","endExternalValue","_useState","useState","_useState2","_useState2$","startValue","endValue","setValues","_useState3","_useState4","prevValue","setPrevValue","isValueUpdate","handleOnChangeDay","useCallback","newDay","undefined","_getSortedValues","getSortedValues","_getSortedValues2","first","second","React","createElement","_ext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,CAAAU,UAAA,EAAA,CAAA,CAAA;AAA1CE,MAAAA,SAAS,GAAAD,UAAA,CAAA,CAAA,CAAA;AAAEE,MAAAA,YAAY,GAAAF,UAAA,CAAA,CAAA,CAAA,CAAA;AAE9B,IAAA,IAAIG,aAAa,CAAC3B,KAAK,EAAEyB,SAAS,CAAC,EAAE;AACjCH,MAAAA,SAAS,CAAC,CAACR,kBAAkB,EAAEC,gBAAgB,CAAC,CAAC,CAAA;MAEjDW,YAAY,CAAC1B,KAAK,CAAC,CAAA;AACvB,KAAA;AAEA,IAAA,IAAM4B,iBAAiB,GAAGC,WAAW,CACjC,UAACC,MAAY,EAAK;AACd,MAAA,IAAIT,QAAQ,EAAE;AACVC,QAAAA,SAAS,CAAC,CAACQ,MAAM,EAAEC,SAAS,CAAC,CAAC,CAAA;AAE9BzB,QAAAA,oBAAoB,aAApBA,oBAAoB,KAAA,KAAA,CAAA,
|
1
|
+
{"version":3,"file":"withRange.js","sources":["../../../../src/components/Calendar/hoc/withRange.tsx"],"sourcesContent":["import React, { useMemo, useState, useCallback, ReactElement } from 'react';\n\nimport type { Calendar, CalendarRange } from '../Calendar.types';\nimport { getSortedValues, isValueUpdate } from '../utils';\n\n/**\n * HOC для календаря, дающий возможность выбора диапазона даты\n */\nexport const withRange = <T extends Calendar>(Component: React.FC<Calendar>) => ({\n value,\n disabledList,\n eventList,\n min,\n max,\n onChangeValue,\n onChangeStartOfRange,\n ...rest\n}: CalendarRange<T>): ReactElement<T> => {\n const [startExternalValue, endExternalValue] = useMemo(() => value, [value]);\n const [[startValue, endValue], setValues] = useState<[Date, Date?]>([startExternalValue, endExternalValue]);\n const [prevValue, setPrevValue] = useState(value);\n\n if (isValueUpdate(value, prevValue)) {\n setValues([startExternalValue, endExternalValue]);\n\n setPrevValue(value);\n }\n\n const handleOnChangeDay = useCallback(\n (newDay: Date) => {\n if (endValue) {\n setValues([newDay, undefined]);\n\n onChangeStartOfRange?.(newDay);\n\n return;\n }\n\n setValues([startValue, newDay]);\n\n const [first, second] = getSortedValues([startValue, newDay]);\n\n if (first) {\n onChangeValue([first, second]);\n }\n },\n [onChangeValue, onChangeStartOfRange, startValue, endValue],\n );\n\n return (\n <Component\n value={[startValue, endValue]}\n onChangeValue={handleOnChangeDay}\n disabledList={disabledList}\n eventList={eventList}\n min={min}\n max={max}\n {...rest}\n />\n );\n};\n"],"names":["withRange","Component","_ref","value","disabledList","eventList","min","max","onChangeValue","onChangeStartOfRange","rest","_objectWithoutProperties","_excluded","_useMemo","useMemo","_useMemo2","_slicedToArray","startExternalValue","endExternalValue","_useState","useState","_useState2","_useState2$","startValue","endValue","setValues","_useState3","_useState4","prevValue","setPrevValue","isValueUpdate","handleOnChangeDay","useCallback","newDay","undefined","_getSortedValues","getSortedValues","_getSortedValues2","first","second","React","createElement","_extends"],"mappings":";;;;;;AAKA;AACA;AACA;IACaA,SAAS,GAAG,SAAZA,SAASA,CAAwBC,SAA6B,EAAA;EAAA,OAAK,UAAAC,IAAA,EASvC;AAAA,IAAA,IARrCC,KAAK,GAAAD,IAAA,CAALC,KAAK;MACLC,YAAY,GAAAF,IAAA,CAAZE,YAAY;MACZC,SAAS,GAAAH,IAAA,CAATG,SAAS;MACTC,GAAG,GAAAJ,IAAA,CAAHI,GAAG;MACHC,GAAG,GAAAL,IAAA,CAAHK,GAAG;MACHC,aAAa,GAAAN,IAAA,CAAbM,aAAa;MACbC,oBAAoB,GAAAP,IAAA,CAApBO,oBAAoB;AACjBC,MAAAA,IAAI,GAAAC,wBAAA,CAAAT,IAAA,EAAAU,SAAA,CAAA,CAAA;IAEP,IAAAC,QAAA,GAA+CC,OAAO,CAAC,YAAA;AAAA,QAAA,OAAMX,KAAK,CAAA;OAAE,EAAA,CAACA,KAAK,CAAC,CAAC;MAAAY,SAAA,GAAAC,cAAA,CAAAH,QAAA,EAAA,CAAA,CAAA;AAArEI,MAAAA,kBAAkB,GAAAF,SAAA,CAAA,CAAA,CAAA;AAAEG,MAAAA,gBAAgB,GAAAH,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AwBC,eAAe,CAAC,CAACb,UAAU,EAAEU,MAAM,CAAC,CAAC;QAAAI,iBAAA,GAAArB,cAAA,CAAAmB,gBAAA,EAAA,CAAA,CAAA;AAAtDG,QAAAA,KAAK,GAAAD,iBAAA,CAAA,CAAA,CAAA;AAAEE,QAAAA,MAAM,GAAAF,iBAAA,CAAA,CAAA,CAAA,CAAA;AAEpB,MAAA,IAAIC,KAAK,EAAE;AACP9B,QAAAA,aAAa,CAAC,CAAC8B,KAAK,EAAEC,MAAM,CAAC,CAAC,CAAA;AAClC,OAAA;KACH,EACD,CAAC/B,aAAa,EAAEC,oBAAoB,EAAEc,UAAU,EAAEC,QAAQ,CAC9D,CAAC,CAAA;AAED,IAAA,oBACIgB,KAAA,CAAAC,aAAA,CAACxC,SAAS,EAAAyC,QAAA,CAAA;AACNvC,MAAAA,KAAK,EAAE,CAACoB,UAAU,EAAEC,QAAQ,CAAE;AAC9BhB,MAAAA,aAAa,EAAEuB,iBAAkB;AACjC3B,MAAAA,YAAY,EAAEA,YAAa;AAC3BC,MAAAA,SAAS,EAAEA,SAAU;AACrBC,MAAAA,GAAG,EAAEA,GAAI;AACTC,MAAAA,GAAG,EAAEA,GAAAA;KACDG,EAAAA,IAAI,CACX,CAAC,CAAA;GAET,CAAA;AAAA;;;;"}
|
@@ -22,31 +22,31 @@ var isOutOfBound = function isOutOfBound(_ref, rowSize, columnSize) {
|
|
22
22
|
return columnIndex === -1 || columnIndex === columnSize + 1 || rowIndex === -1 || rowIndex === rowSize + 1;
|
23
23
|
};
|
24
24
|
var isVisible = function isVisible(refs, row, column) {
|
25
|
-
var _refs$current
|
26
|
-
return (_refs$current = refs.current) === null || _refs$current === void 0
|
25
|
+
var _refs$current;
|
26
|
+
return (_refs$current = refs.current) === null || _refs$current === void 0 || (_refs$current = _refs$current[row]) === null || _refs$current === void 0 ? void 0 : _refs$current[column];
|
27
27
|
};
|
28
28
|
var isAriaDisableItem = function isAriaDisableItem(item) {
|
29
29
|
return (item === null || item === void 0 ? void 0 : item.getAttribute('aria-disabled')) === 'true';
|
30
30
|
};
|
31
31
|
var hasDisabledArrowKey = function hasDisabledArrowKey(_ref3) {
|
32
|
-
var _refs$current2
|
32
|
+
var _refs$current2;
|
33
33
|
var refs = _ref3.refs,
|
34
34
|
payload = _ref3.payload,
|
35
35
|
key = _ref3.key;
|
36
36
|
var _payload = _slicedToArray(payload, 2),
|
37
37
|
previousRowIndex = _payload[0],
|
38
38
|
previousColumnIndex = _payload[1];
|
39
|
-
var disabledArrowKey = (_refs$current2 = refs.current) === null || _refs$current2 === void 0
|
39
|
+
var disabledArrowKey = (_refs$current2 = refs.current) === null || _refs$current2 === void 0 || (_refs$current2 = _refs$current2[previousRowIndex]) === null || _refs$current2 === void 0 || (_refs$current2 = _refs$current2[previousColumnIndex]) === null || _refs$current2 === void 0 ? void 0 : _refs$current2.dataset.disabledArrowKey;
|
40
40
|
return Boolean(disabledArrowKey === null || disabledArrowKey === void 0 ? void 0 : disabledArrowKey.includes(key));
|
41
41
|
};
|
42
42
|
var hasDisabledMonths = function hasDisabledMonths(_ref4) {
|
43
43
|
var _item$dataset, _item$dataset2;
|
44
44
|
var item = _ref4.item,
|
45
45
|
key = _ref4.key;
|
46
|
-
return item !== null && item !== void 0 && (_item$dataset = item.dataset) !== null && _item$dataset !== void 0 && _item$dataset.disabledMonths ? item === null || item === void 0
|
46
|
+
return item !== null && item !== void 0 && (_item$dataset = item.dataset) !== null && _item$dataset !== void 0 && _item$dataset.disabledMonths ? item === null || item === void 0 || (_item$dataset2 = item.dataset) === null || _item$dataset2 === void 0 ? void 0 : _item$dataset2.disabledMonths.includes(key) : false;
|
47
47
|
};
|
48
48
|
var getNextCorrectPosition = function getNextCorrectPosition(_ref5) {
|
49
|
-
var _refs$current3
|
49
|
+
var _refs$current3;
|
50
50
|
var refs = _ref5.refs,
|
51
51
|
rowSize = _ref5.rowSize,
|
52
52
|
newRowIndex = _ref5.newRowIndex,
|
@@ -55,15 +55,15 @@ var getNextCorrectPosition = function getNextCorrectPosition(_ref5) {
|
|
55
55
|
minColumnIndex = _ref5.minColumnIndex,
|
56
56
|
_ref5$defaultState = _ref5.defaultState,
|
57
57
|
defaultState = _ref5$defaultState === void 0 ? [] : _ref5$defaultState;
|
58
|
-
var item = (_refs$current3 = refs.current) === null || _refs$current3 === void 0
|
58
|
+
var item = (_refs$current3 = refs.current) === null || _refs$current3 === void 0 || (_refs$current3 = _refs$current3[newRowIndex]) === null || _refs$current3 === void 0 ? void 0 : _refs$current3[newColumnIndex];
|
59
59
|
while (isAriaDisableItem(item) && newColumnIndex <= columnSize) {
|
60
|
-
var _refs$current4
|
60
|
+
var _refs$current4;
|
61
61
|
newColumnIndex++;
|
62
62
|
if (newColumnIndex > columnSize && newRowIndex < rowSize) {
|
63
63
|
newRowIndex++;
|
64
64
|
newColumnIndex = minColumnIndex;
|
65
65
|
}
|
66
|
-
item = (_refs$current4 = refs.current) === null || _refs$current4 === void 0
|
66
|
+
item = (_refs$current4 = refs.current) === null || _refs$current4 === void 0 || (_refs$current4 = _refs$current4[newRowIndex]) === null || _refs$current4 === void 0 ? void 0 : _refs$current4[newColumnIndex];
|
67
67
|
if (item) {
|
68
68
|
var isDisabledArrowDown = hasDisabledArrowKey({
|
69
69
|
refs: refs,
|
@@ -83,7 +83,7 @@ var getNextCorrectPosition = function getNextCorrectPosition(_ref5) {
|
|
83
83
|
return [newRowIndex, newColumnIndex];
|
84
84
|
};
|
85
85
|
var getPreviousCorrectPosition = function getPreviousCorrectPosition(_ref6) {
|
86
|
-
var _refs$current5
|
86
|
+
var _refs$current5;
|
87
87
|
var refs = _ref6.refs,
|
88
88
|
rowSize = _ref6.rowSize,
|
89
89
|
newRowIndex = _ref6.newRowIndex,
|
@@ -92,15 +92,15 @@ var getPreviousCorrectPosition = function getPreviousCorrectPosition(_ref6) {
|
|
92
92
|
minColumnIndex = _ref6.minColumnIndex,
|
93
93
|
_ref6$defaultState = _ref6.defaultState,
|
94
94
|
defaultState = _ref6$defaultState === void 0 ? [] : _ref6$defaultState;
|
95
|
-
var item = (_refs$current5 = refs.current) === null || _refs$current5 === void 0
|
95
|
+
var item = (_refs$current5 = refs.current) === null || _refs$current5 === void 0 || (_refs$current5 = _refs$current5[newRowIndex]) === null || _refs$current5 === void 0 ? void 0 : _refs$current5[newColumnIndex];
|
96
96
|
while (isAriaDisableItem(item) && newColumnIndex >= minColumnIndex) {
|
97
|
-
var _refs$current6
|
97
|
+
var _refs$current6;
|
98
98
|
newColumnIndex--;
|
99
99
|
if (newColumnIndex < minColumnIndex && newRowIndex <= rowSize) {
|
100
100
|
newRowIndex--;
|
101
101
|
newColumnIndex = columnSize;
|
102
102
|
}
|
103
|
-
item = (_refs$current6 = refs.current) === null || _refs$current6 === void 0
|
103
|
+
item = (_refs$current6 = refs.current) === null || _refs$current6 === void 0 || (_refs$current6 = _refs$current6[newRowIndex]) === null || _refs$current6 === void 0 ? void 0 : _refs$current6[newColumnIndex];
|
104
104
|
if (item && item.dataset.day === '1') {
|
105
105
|
var isDisabledArrowUp = hasDisabledArrowKey({
|
106
106
|
refs: refs,
|
@@ -141,7 +141,7 @@ function getCorrectColumnIndex(_ref7) {
|
|
141
141
|
}) - 1;
|
142
142
|
}
|
143
143
|
var getCorrectIndexes = function getCorrectIndexes(refs, _ref8, rowSize, columnSize, withShift, defaultState) {
|
144
|
-
var _refs$current7
|
144
|
+
var _refs$current7;
|
145
145
|
var _ref9 = _slicedToArray(_ref8, 2),
|
146
146
|
rowIndex = _ref9[0],
|
147
147
|
columnIndex = _ref9[1];
|
@@ -178,7 +178,7 @@ var getCorrectIndexes = function getCorrectIndexes(refs, _ref8, rowSize, columnS
|
|
178
178
|
|
179
179
|
// INFO: Логика для получения правильной позиции дня, когда переключились на другой месяц
|
180
180
|
// INFO: и ставим указатель на первый доступный день. Только при зажатой клавиши Shift.
|
181
|
-
if (isAriaDisableItem((_refs$current7 = refs.current) === null || _refs$current7 === void 0
|
181
|
+
if (isAriaDisableItem((_refs$current7 = refs.current) === null || _refs$current7 === void 0 || (_refs$current7 = _refs$current7[newRowIndex]) === null || _refs$current7 === void 0 ? void 0 : _refs$current7[newColumnIndex]) && withShift) {
|
182
182
|
var isNext = rowIndex === rowSize + 1;
|
183
183
|
var isPrevious = rowIndex === minColumnIndex - 1;
|
184
184
|
var state = {
|
@@ -295,11 +295,11 @@ var useKeyNavigation = function useKeyNavigation(_ref10) {
|
|
295
295
|
setSelectIndexes([newRowIndex, newColumnIndex]);
|
296
296
|
}, [onPrev, onNext, selectIndexes, rowSize, columnSize, withShiftState, currentIndexes, isDouble]);
|
297
297
|
useLayoutEffect(function () {
|
298
|
-
var _outerRefs$current
|
298
|
+
var _outerRefs$current;
|
299
299
|
var _selectIndexes = _slicedToArray(selectIndexes, 2),
|
300
300
|
rowIndex = _selectIndexes[0],
|
301
301
|
columnIndex = _selectIndexes[1];
|
302
|
-
var item = outerRefs === null || outerRefs === void 0
|
302
|
+
var item = outerRefs === null || outerRefs === void 0 || (_outerRefs$current = outerRefs.current) === null || _outerRefs$current === void 0 || (_outerRefs$current = _outerRefs$current[rowIndex]) === null || _outerRefs$current === void 0 ? void 0 : _outerRefs$current[columnIndex];
|
303
303
|
if (item) {
|
304
304
|
item.focus();
|
305
305
|
}
|
@@ -569,8 +569,8 @@ var useKeyNavigation = function useKeyNavigation(_ref10) {
|
|
569
569
|
case Keys.enter:
|
570
570
|
case Keys.space:
|
571
571
|
{
|
572
|
-
var _outerRefs$current2
|
573
|
-
(_outerRefs$current2 = outerRefs.current) === null || _outerRefs$current2 === void 0
|
572
|
+
var _outerRefs$current2;
|
573
|
+
(_outerRefs$current2 = outerRefs.current) === null || _outerRefs$current2 === void 0 || (_outerRefs$current2 = _outerRefs$current2[newRowIndex]) === null || _outerRefs$current2 === void 0 || _outerRefs$current2[newColumnIndex].click();
|
574
574
|
break;
|
575
575
|
}
|
576
576
|
default:
|