@okam/stack-ui 1.25.3 → 1.25.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Accordion/components/AccordionItem.d.ts +3 -0
- package/components/Accordion/components/AriaAccordionItem.d.ts +3 -0
- package/components/Accordion/hooks/useAccordionState.d.ts +10 -0
- package/components/Accordion/index.d.ts +3 -0
- package/{src/components/Accordion/interface.ts → components/Accordion/interface.d.ts} +17 -23
- package/components/Alerts/components/AlertsCloseButton.d.ts +4 -0
- package/components/Alerts/components/AlertsItem.d.ts +3 -0
- package/components/Alerts/components/AlertsNavigationButton.d.ts +8 -0
- package/components/Alerts/components/AlertsSwiper.d.ts +3 -0
- package/components/Alerts/components/pagination/AlertsPagination.d.ts +3 -0
- package/components/Alerts/components/pagination/AlertsPaginationBullet.d.ts +3 -0
- package/components/Alerts/index.d.ts +3 -0
- package/components/Alerts/interface.d.ts +41 -0
- package/components/Box/index.d.ts +5 -0
- package/components/Box/interface.d.ts +11 -0
- package/components/Button/index.d.ts +6 -0
- package/components/Button/interface.d.ts +20 -0
- package/components/Calendar/RangeCalendar.d.ts +3 -0
- package/components/Calendar/components/CalendarCell.d.ts +3 -0
- package/components/Calendar/components/CalendarGrid.d.ts +3 -0
- package/components/Calendar/index.d.ts +3 -0
- package/components/Calendar/interface.d.ts +32 -0
- package/components/Carousel/index.d.ts +3 -0
- package/components/Carousel/interface.d.ts +24 -0
- package/components/Date/index.d.ts +3 -0
- package/components/Date/interface.d.ts +6 -0
- package/components/Dialog/index.d.ts +2 -0
- package/components/Dialog/interface.d.ts +6 -0
- package/components/DirectusImg/index.d.ts +3 -0
- package/components/DirectusImg/interface.d.ts +17 -0
- package/components/Icon/index.d.ts +3 -0
- package/components/Icon/interface.d.ts +7 -0
- package/components/Img/index.d.ts +3 -0
- package/components/Img/interface.d.ts +6 -0
- package/components/Lightbox/index.d.ts +3 -0
- package/components/Lightbox/interface.d.ts +25 -0
- package/components/Menu/Menu.d.ts +3 -0
- package/components/Menu/MenuSidePanel.d.ts +3 -0
- package/components/Menu/components/InnerContent.d.ts +3 -0
- package/components/Menu/components/MenuItems.d.ts +3 -0
- package/components/Menu/components/TabContainer.d.ts +3 -0
- package/components/Menu/interface.d.ts +31 -0
- package/components/Modal/components/ModalDialog.d.ts +3 -0
- package/components/Modal/components/ModalOverlay.d.ts +3 -0
- package/components/Modal/index.d.ts +3 -0
- package/{src/components/Modal/interface.ts → components/Modal/interface.d.ts} +11 -14
- package/components/Popover/index.d.ts +3 -0
- package/components/Popover/interface.d.ts +21 -0
- package/components/ShareButton/index.d.ts +4 -0
- package/components/ShareButton/interface.d.ts +26 -0
- package/components/ShareButton/utils/generateUtmTags.d.ts +2 -0
- package/components/ShareButton/utils/useFacebookShareUrl.d.ts +2 -0
- package/components/ShareButton/utils/useMailToShareUrl.d.ts +2 -0
- package/components/ShareButton/utils/useTwitterShareUrl.d.ts +2 -0
- package/components/ShareButton/utils/useWindow.d.ts +5 -0
- package/components/SidePanel/index.d.ts +4 -0
- package/components/SidePanel/interface.d.ts +12 -0
- package/components/TabList/components/TabPanel/TabPanel.d.ts +4 -0
- package/components/TabList/interface.d.ts +18 -0
- package/components/Typography/index.d.ts +5 -0
- package/components/Typography/interface.d.ts +10 -0
- package/components/WysiwygBlock/index.d.ts +3 -0
- package/components/WysiwygBlock/interface.d.ts +5 -0
- package/components/fields/Checkbox/Checkbox.interface.d.ts +18 -0
- package/components/fields/Checkbox/index.d.ts +3 -0
- package/components/fields/CheckboxGroup/components/CheckboxGroupItem/index.d.ts +3 -0
- package/components/fields/CheckboxGroup/index.d.ts +3 -0
- package/components/fields/CheckboxGroup/interface.d.ts +13 -0
- package/components/fields/DatePicker/DateRangePicker.d.ts +3 -0
- package/components/fields/DatePicker/components/CalendarPopover.d.ts +2 -0
- package/components/fields/DatePicker/components/DateField.d.ts +4 -0
- package/components/fields/DatePicker/index.d.ts +3 -0
- package/components/fields/DatePicker/interface.d.ts +37 -0
- package/components/fields/Radio/Radio.interface.d.ts +26 -0
- package/components/fields/Radio/index.d.ts +4 -0
- package/components/fields/RadioGroup/index.d.ts +3 -0
- package/components/fields/RadioGroup/interface.d.ts +9 -0
- package/components/fields/SearchField/index.d.ts +3 -0
- package/components/fields/SearchField/interface.d.ts +9 -0
- package/components/fields/Select/Select.d.ts +4 -0
- package/components/fields/Select/Select.interface.d.ts +26 -0
- package/components/fields/Select/components/Listbox.d.ts +4 -0
- package/{src/components/fields/Select/components/Listbox.interface.ts → components/fields/Select/components/Listbox.interface.d.ts} +8 -11
- package/components/fields/Select/components/Popover.d.ts +3 -0
- package/components/fields/Select/components/Popover.interface.d.ts +13 -0
- package/components/fields/SelectItem/SelectItem.d.ts +3 -0
- package/{src/components/fields/SelectItem/SelectItem.interface.ts → components/fields/SelectItem/SelectItem.interface.d.ts} +3 -4
- package/components/fields/TextArea/index.d.ts +4 -0
- package/components/fields/TextInputField/index.d.ts +4 -0
- package/components/fields/TextInputField/interface.d.ts +24 -0
- package/components/icons/ArrowDown.d.ts +3 -0
- package/components/icons/ArrowLeft.d.ts +3 -0
- package/components/icons/ArrowRight.d.ts +3 -0
- package/components/icons/Check.d.ts +3 -0
- package/components/icons/ChevronLeft.d.ts +3 -0
- package/components/icons/ChevronRight.d.ts +3 -0
- package/components/icons/CloseBtn.d.ts +3 -0
- package/components/icons/Facebook.d.ts +3 -0
- package/components/icons/FacebookColored.d.ts +3 -0
- package/components/icons/FacebookRounded.d.ts +3 -0
- package/components/icons/Globe.d.ts +3 -0
- package/components/icons/IconFallback.d.ts +3 -0
- package/components/icons/Instagram.d.ts +3 -0
- package/components/icons/InstagramColored.d.ts +3 -0
- package/components/icons/Link.d.ts +3 -0
- package/components/icons/LinkedIn.d.ts +3 -0
- package/components/icons/Mail.d.ts +3 -0
- package/components/icons/Plus.d.ts +3 -0
- package/components/icons/Search.d.ts +3 -0
- package/components/icons/Share.d.ts +3 -0
- package/components/icons/Twitter.d.ts +3 -0
- package/components/icons/TwitterColored.d.ts +3 -0
- package/components/icons/Upload.d.ts +3 -0
- package/components/icons/X.d.ts +3 -0
- package/components/icons/YouTube.d.ts +3 -0
- package/components/icons/YouTubeColored.d.ts +3 -0
- package/components/icons/index.d.ts +24 -0
- package/{src/index.ts → index.d.ts} +57 -72
- package/index.js +110 -0
- package/index.mjs +12755 -0
- package/package.json +1 -1
- package/providers/Accordion/index.d.ts +4 -0
- package/providers/Accordion/interface.d.ts +12 -0
- package/providers/Alerts/index.d.ts +4 -0
- package/providers/Alerts/interface.d.ts +9 -0
- package/providers/CheckboxGroup/index.d.ts +5 -0
- package/{src/providers/CheckboxGroup/interface.ts → providers/CheckboxGroup/interface.d.ts} +4 -5
- package/providers/Client/index.d.ts +4 -0
- package/providers/Client/interface.d.ts +10 -0
- package/providers/Menu/index.d.ts +4 -0
- package/providers/Menu/interface.d.ts +28 -0
- package/providers/RadioGroup/RadioGroup.d.ts +5 -0
- package/providers/RadioGroup/RadioGroup.interface.d.ts +7 -0
- package/providers/SidePanel/index.d.ts +4 -0
- package/providers/SidePanel/interface.d.ts +23 -0
- package/providers/Theme/hooks.d.ts +3 -0
- package/providers/Theme/index.d.ts +10 -0
- package/providers/Theme/interface.d.ts +24 -0
- package/providers/Theme/utils.d.ts +2 -0
- package/providers/UserSearchQuery/index.d.ts +4 -0
- package/providers/UserSearchQuery/interface.d.ts +10 -0
- package/style.css +1 -0
- package/theme/Accordion/index.d.ts +274 -0
- package/theme/Alerts/index.d.ts +1167 -0
- package/theme/Box/index.d.ts +214 -0
- package/theme/Button/index.d.ts +121 -0
- package/theme/Calendar/index.d.ts +366 -0
- package/theme/Carousel/index.d.ts +9 -0
- package/theme/Checkbox/index.d.ts +159 -0
- package/theme/CheckboxGroup/index.d.ts +30 -0
- package/theme/DatePicker/index.d.ts +43 -0
- package/theme/Image/index.d.ts +3 -0
- package/theme/LightBox/index.d.ts +455 -0
- package/theme/Radio/index.d.ts +108 -0
- package/theme/RadioGroup/index.d.ts +30 -0
- package/theme/Search/index.d.ts +30 -0
- package/theme/ShareButton/index.d.ts +174 -0
- package/theme/SidePanel/index.d.ts +3 -0
- package/theme/TextArea/index.d.ts +29 -0
- package/theme/Typography/index.d.ts +233 -0
- package/theme/index.d.ts +5 -0
- package/transitions/AccordionTransition.d.ts +4 -0
- package/transitions/ModalTransition.d.ts +7 -0
- package/transitions/RenderWithOpacity.d.ts +4 -0
- package/transitions/RenderWithSlide.d.ts +7 -0
- package/transitions/SidePanelTransition.d.ts +7 -0
- package/types/components.d.ts +28 -0
- package/.eslintrc.js +0 -32
- package/.storybook/.eslintrc.js +0 -29
- package/.storybook/main.ts +0 -33
- package/.storybook/preview.js +0 -56
- package/.storybook/tsconfig.json +0 -17
- package/CHANGELOG.md +0 -574
- package/README.md +0 -8
- package/postcss.config.js +0 -15
- package/project.json +0 -77
- package/src/_stories/icons/code-brackets.svg +0 -1
- package/src/_stories/icons/colors.svg +0 -1
- package/src/_stories/icons/comments.svg +0 -1
- package/src/_stories/icons/direction.svg +0 -1
- package/src/_stories/icons/flow.svg +0 -1
- package/src/_stories/icons/plugin.svg +0 -1
- package/src/_stories/icons/repo.svg +0 -1
- package/src/_stories/icons/stackalt.svg +0 -1
- package/src/components/Accordion/accordion.stories.mdx +0 -240
- package/src/components/Accordion/components/AccordionItem.tsx +0 -53
- package/src/components/Accordion/components/AriaAccordionItem.tsx +0 -76
- package/src/components/Accordion/hooks/useAccordionState.ts +0 -46
- package/src/components/Accordion/index.tsx +0 -38
- package/src/components/Alerts/alerts.stories.mdx +0 -282
- package/src/components/Alerts/components/AlertsCloseButton.tsx +0 -20
- package/src/components/Alerts/components/AlertsItem.tsx +0 -39
- package/src/components/Alerts/components/AlertsNavigationButton.tsx +0 -71
- package/src/components/Alerts/components/AlertsSwiper.tsx +0 -125
- package/src/components/Alerts/components/pagination/AlertsPagination.tsx +0 -32
- package/src/components/Alerts/components/pagination/AlertsPaginationBullet.tsx +0 -61
- package/src/components/Alerts/index.tsx +0 -54
- package/src/components/Alerts/interface.ts +0 -51
- package/src/components/Box/box.stories.mdx +0 -27
- package/src/components/Box/index.tsx +0 -36
- package/src/components/Box/interface.ts +0 -10
- package/src/components/Button/button.stories.mdx +0 -99
- package/src/components/Button/index.tsx +0 -92
- package/src/components/Button/interface.ts +0 -22
- package/src/components/Calendar/RangeCalendar.tsx +0 -61
- package/src/components/Calendar/calendar.stories.mdx +0 -28
- package/src/components/Calendar/components/CalendarCell.tsx +0 -60
- package/src/components/Calendar/components/CalendarGrid.tsx +0 -44
- package/src/components/Calendar/index.tsx +0 -63
- package/src/components/Calendar/interface.ts +0 -37
- package/src/components/Carousel/carousel.stories.mdx +0 -182
- package/src/components/Carousel/index.tsx +0 -99
- package/src/components/Carousel/interface.ts +0 -26
- package/src/components/Date/date.stories.mdx +0 -122
- package/src/components/Date/index.tsx +0 -35
- package/src/components/Date/interface.ts +0 -7
- package/src/components/Dialog/index.tsx +0 -14
- package/src/components/Dialog/interface.ts +0 -6
- package/src/components/DirectusImg/index.tsx +0 -59
- package/src/components/DirectusImg/interface.ts +0 -19
- package/src/components/Icon/index.tsx +0 -40
- package/src/components/Icon/interface.ts +0 -8
- package/src/components/Img/img.stories.mdx +0 -28
- package/src/components/Img/index.tsx +0 -30
- package/src/components/Img/interface.ts +0 -9
- package/src/components/Lightbox/hooks/overlay/index.tsx +0 -36
- package/src/components/Lightbox/index.tsx +0 -82
- package/src/components/Lightbox/interface.ts +0 -28
- package/src/components/Lightbox/lightbox.stories.mdx +0 -79
- package/src/components/Menu/Menu.tsx +0 -43
- package/src/components/Menu/MenuSidePanel.tsx +0 -41
- package/src/components/Menu/components/InnerContent.tsx +0 -26
- package/src/components/Menu/components/MenuItems.tsx +0 -133
- package/src/components/Menu/components/TabContainer.tsx +0 -13
- package/src/components/Menu/interface.ts +0 -41
- package/src/components/Menu/menu.stories.mdx +0 -23
- package/src/components/Modal/components/ModalDialog.tsx +0 -31
- package/src/components/Modal/components/ModalOverlay.tsx +0 -21
- package/src/components/Modal/index.tsx +0 -32
- package/src/components/Popover/index.tsx +0 -138
- package/src/components/Popover/interface.ts +0 -25
- package/src/components/Popover/popover.stories.mdx +0 -66
- package/src/components/ShareButton/index.tsx +0 -172
- package/src/components/ShareButton/interface.ts +0 -29
- package/src/components/ShareButton/share-button.stories.mdx +0 -48
- package/src/components/ShareButton/utils/generateUtmTags.ts +0 -4
- package/src/components/ShareButton/utils/useFacebookShareUrl.ts +0 -15
- package/src/components/ShareButton/utils/useMailToShareUrl.ts +0 -15
- package/src/components/ShareButton/utils/useTwitterShareUrl.ts +0 -15
- package/src/components/ShareButton/utils/useWindow.ts +0 -17
- package/src/components/SidePanel/index.tsx +0 -43
- package/src/components/SidePanel/interface.ts +0 -16
- package/src/components/SidePanel/side-panel.stories.mdx +0 -44
- package/src/components/TabList/components/Tab/Tab.tsx +0 -19
- package/src/components/TabList/components/TabPanel/TabPanel.tsx +0 -27
- package/src/components/TabList/index.tsx +0 -44
- package/src/components/TabList/interface.ts +0 -23
- package/src/components/Typography/index.tsx +0 -35
- package/src/components/Typography/interface.ts +0 -9
- package/src/components/Typography/typo.stories.mdx +0 -157
- package/src/components/WysiwygBlock/index.tsx +0 -20
- package/src/components/WysiwygBlock/interface.ts +0 -7
- package/src/components/WysiwygBlock/wysiwyg.stories.mdx +0 -53
- package/src/components/fields/Checkbox/Checkbox.interface.ts +0 -21
- package/src/components/fields/Checkbox/Checkbox.stories.mdx +0 -127
- package/src/components/fields/Checkbox/index.tsx +0 -62
- package/src/components/fields/CheckboxGroup/checkbox-group.stories.mdx +0 -59
- package/src/components/fields/CheckboxGroup/components/CheckboxGroupItem/index.tsx +0 -66
- package/src/components/fields/CheckboxGroup/index.tsx +0 -49
- package/src/components/fields/CheckboxGroup/interface.ts +0 -17
- package/src/components/fields/DatePicker/DateRangePicker.tsx +0 -73
- package/src/components/fields/DatePicker/components/CalendarPopover.tsx +0 -31
- package/src/components/fields/DatePicker/components/DateField.tsx +0 -61
- package/src/components/fields/DatePicker/date-picker.stories.mdx +0 -55
- package/src/components/fields/DatePicker/index.tsx +0 -71
- package/src/components/fields/DatePicker/interface.ts +0 -69
- package/src/components/fields/Radio/Radio.interface.ts +0 -30
- package/src/components/fields/Radio/index.tsx +0 -63
- package/src/components/fields/RadioGroup/index.tsx +0 -33
- package/src/components/fields/RadioGroup/interface.ts +0 -10
- package/src/components/fields/RadioGroup/radio-group.stories.mdx +0 -56
- package/src/components/fields/SearchField/index.tsx +0 -59
- package/src/components/fields/SearchField/interface.ts +0 -10
- package/src/components/fields/SearchField/search.stories.mdx +0 -91
- package/src/components/fields/Select/Select.interface.ts +0 -24
- package/src/components/fields/Select/Select.stories.mdx +0 -53
- package/src/components/fields/Select/Select.tsx +0 -108
- package/src/components/fields/Select/components/Listbox.tsx +0 -40
- package/src/components/fields/Select/components/Popover.interface.ts +0 -14
- package/src/components/fields/Select/components/Popover.tsx +0 -32
- package/src/components/fields/SelectItem/SelectItem.tsx +0 -10
- package/src/components/fields/TextArea/index.tsx +0 -105
- package/src/components/fields/TextArea/textArea.stories.mdx +0 -60
- package/src/components/fields/TextInputField/index.tsx +0 -107
- package/src/components/fields/TextInputField/interface.ts +0 -30
- package/src/components/fields/TextInputField/text-input-field.stories.mdx +0 -64
- package/src/components/icons/ArrowDown.tsx +0 -11
- package/src/components/icons/ArrowLeft.tsx +0 -18
- package/src/components/icons/ArrowRight.tsx +0 -18
- package/src/components/icons/Check.tsx +0 -11
- package/src/components/icons/ChevronLeft.tsx +0 -11
- package/src/components/icons/ChevronRight.tsx +0 -11
- package/src/components/icons/CloseBtn.tsx +0 -11
- package/src/components/icons/Facebook.tsx +0 -14
- package/src/components/icons/FacebookColored.tsx +0 -16
- package/src/components/icons/FacebookRounded.tsx +0 -16
- package/src/components/icons/Globe.tsx +0 -38
- package/src/components/icons/IconFallback.tsx +0 -8
- package/src/components/icons/Instagram.tsx +0 -14
- package/src/components/icons/InstagramColored.tsx +0 -59
- package/src/components/icons/Link.tsx +0 -14
- package/src/components/icons/LinkedIn.tsx +0 -16
- package/src/components/icons/Mail.tsx +0 -16
- package/src/components/icons/Plus.tsx +0 -18
- package/src/components/icons/Search.tsx +0 -19
- package/src/components/icons/Share.tsx +0 -16
- package/src/components/icons/Twitter.tsx +0 -16
- package/src/components/icons/TwitterColored.tsx +0 -16
- package/src/components/icons/Upload.tsx +0 -14
- package/src/components/icons/X.tsx +0 -14
- package/src/components/icons/YouTube.tsx +0 -16
- package/src/components/icons/YouTubeColored.tsx +0 -17
- package/src/components/icons/index.ts +0 -24
- package/src/examples/PageLayout/index.tsx +0 -61
- package/src/examples/PageLayout/layout.stories.mdx +0 -35
- package/src/message.tsx +0 -8
- package/src/providers/Accordion/index.tsx +0 -15
- package/src/providers/Accordion/interface.ts +0 -14
- package/src/providers/Alerts/index.tsx +0 -15
- package/src/providers/Alerts/interface.ts +0 -11
- package/src/providers/CheckboxGroup/index.tsx +0 -22
- package/src/providers/Client/index.tsx +0 -21
- package/src/providers/Client/interface.ts +0 -13
- package/src/providers/Menu/index.tsx +0 -43
- package/src/providers/Menu/interface.ts +0 -32
- package/src/providers/RadioGroup/RadioGroup.interface.ts +0 -8
- package/src/providers/RadioGroup/RadioGroup.tsx +0 -25
- package/src/providers/SidePanel/index.tsx +0 -55
- package/src/providers/SidePanel/interface.ts +0 -26
- package/src/providers/Theme/hooks.ts +0 -25
- package/src/providers/Theme/index.tsx +0 -40
- package/src/providers/Theme/interface.ts +0 -28
- package/src/providers/Theme/utils.ts +0 -3
- package/src/providers/UserSearchQuery/index.tsx +0 -20
- package/src/providers/UserSearchQuery/interface.ts +0 -12
- package/src/storybook/Lightbox/LightboxControlledState.tsx +0 -28
- package/src/storybook/Menu/Menu.tsx +0 -177
- package/src/storybook/Menu/NestedMenu.tsx +0 -24
- package/src/storybook/Menu/mock.tsx +0 -84
- package/src/storybook/SelectField/index.tsx +0 -57
- package/src/storybook/ShareButtonExample/index.tsx +0 -66
- package/src/tailwind.css +0 -3
- package/src/theme/Accordion/index.tsx +0 -101
- package/src/theme/Alerts/index.ts +0 -97
- package/src/theme/Box/index.ts +0 -45
- package/src/theme/Button/index.tsx +0 -72
- package/src/theme/Calendar/index.tsx +0 -167
- package/src/theme/Carousel/index.ts +0 -36
- package/src/theme/Checkbox/index.ts +0 -49
- package/src/theme/CheckboxGroup/index.ts +0 -14
- package/src/theme/DatePicker/index.tsx +0 -42
- package/src/theme/Image/index.ts +0 -8
- package/src/theme/LightBox/index.ts +0 -56
- package/src/theme/Radio/index.ts +0 -31
- package/src/theme/RadioGroup/index.ts +0 -14
- package/src/theme/Search/index.ts +0 -20
- package/src/theme/ShareButton/index.tsx +0 -76
- package/src/theme/SidePanel/index.ts +0 -9
- package/src/theme/TextArea/index.ts +0 -25
- package/src/theme/Typography/index.tsx +0 -44
- package/src/theme/index.tsx +0 -178
- package/src/transitions/AccordionTransition.tsx +0 -26
- package/src/transitions/ModalTransition.tsx +0 -38
- package/src/transitions/RenderWithOpacity.tsx +0 -25
- package/src/transitions/RenderWithSlide.tsx +0 -21
- package/src/transitions/SidePanelTransition.tsx +0 -30
- package/src/types/components.ts +0 -34
- package/static/images/image.png +0 -0
- package/tailwind.config.js +0 -14
- package/tsconfig.json +0 -20
- package/tsconfig.lib.json +0 -25
- package/vite.config.ts +0 -58
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type React from 'react'
|
|
2
|
-
import type * as SwiperModules from 'swiper/modules'
|
|
3
|
-
import type { SwiperProps } from 'swiper/react'
|
|
4
|
-
import type { A11yOptions } from 'swiper/types'
|
|
5
|
-
import type { TDefaultComponent } from '../../types/components'
|
|
6
|
-
import type { TButtonProps } from '../Button/interface'
|
|
7
|
-
import type { LightboxProps } from '../Lightbox/interface'
|
|
8
|
-
|
|
9
|
-
type TAlertsNavigationProps = React.ForwardRefExoticComponent<
|
|
10
|
-
TButtonProps & React.RefAttributes<HTMLButtonElement & HTMLAnchorElement>
|
|
11
|
-
>
|
|
12
|
-
|
|
13
|
-
export interface TAlertsItem {
|
|
14
|
-
id: string
|
|
15
|
-
icon?: React.ReactNode
|
|
16
|
-
title?: string
|
|
17
|
-
ariaLabel?: string
|
|
18
|
-
content?: React.ReactNode
|
|
19
|
-
button?: TButtonProps
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface TAlertsPaginationProps extends TDefaultComponent {
|
|
23
|
-
activeIndex: number
|
|
24
|
-
alerts: TAlertsItem[]
|
|
25
|
-
paginationGroupLabel?: string
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface TAlertsPaginationBulletProps extends TDefaultComponent {
|
|
29
|
-
activeIndex: number
|
|
30
|
-
alerts: TAlertsItem[]
|
|
31
|
-
index: number
|
|
32
|
-
}
|
|
33
|
-
interface TCustomA11yOptions extends A11yOptions {
|
|
34
|
-
paginationGroupLabel?: string
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface TAlertsComponentProps
|
|
38
|
-
extends Omit<TDefaultComponent, 'children'>,
|
|
39
|
-
Omit<SwiperProps, 'children' | 'modules' | 'a11y'> {
|
|
40
|
-
a11y?: TCustomA11yOptions
|
|
41
|
-
alerts: TAlertsItem[]
|
|
42
|
-
children?: (props: TAlertsItemProps) => React.ReactNode
|
|
43
|
-
modules?: (keyof typeof SwiperModules)[]
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export type TAlertsItemProps = TAlertsItem & TDefaultComponent
|
|
47
|
-
|
|
48
|
-
export interface TAlertsProps extends Omit<LightboxProps, 'children'>, TAlertsComponentProps {
|
|
49
|
-
prevButton?: TAlertsNavigationProps
|
|
50
|
-
nextButton?: TAlertsNavigationProps
|
|
51
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{/* box.stories.mdx */}
|
|
2
|
-
|
|
3
|
-
import { Canvas, Meta, Story } from '@storybook/addon-docs'
|
|
4
|
-
import Box from './index'
|
|
5
|
-
|
|
6
|
-
<Meta title="BASE COMPONENTS/Box" component={Box} />
|
|
7
|
-
|
|
8
|
-
export const Template = (args) => (
|
|
9
|
-
<div className="bg-slate-200 p-4">
|
|
10
|
-
<Box {...args}>Hello world!</Box>
|
|
11
|
-
</div>
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
# Box
|
|
15
|
-
|
|
16
|
-
Box component. Generic wrapper for your website or app.
|
|
17
|
-
|
|
18
|
-
<Canvas>
|
|
19
|
-
<Story
|
|
20
|
-
name="Box"
|
|
21
|
-
args={{
|
|
22
|
-
as: 'div',
|
|
23
|
-
}}
|
|
24
|
-
>
|
|
25
|
-
{Template.bind({})}
|
|
26
|
-
</Story>
|
|
27
|
-
</Canvas>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
/* eslint-disable react/display-name */
|
|
4
|
-
import React from 'react'
|
|
5
|
-
import useThemeContext from '../../providers/Theme/hooks'
|
|
6
|
-
import type { TBoxProps } from './interface'
|
|
7
|
-
|
|
8
|
-
const Box = ({
|
|
9
|
-
as: Component = 'div',
|
|
10
|
-
themeName = 'box',
|
|
11
|
-
tokens,
|
|
12
|
-
customTheme,
|
|
13
|
-
children,
|
|
14
|
-
className,
|
|
15
|
-
...rest
|
|
16
|
-
}: TBoxProps) => {
|
|
17
|
-
const theme = useThemeContext(themeName, tokens, customTheme)
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<Component {...rest} className={theme}>
|
|
21
|
-
{children}
|
|
22
|
-
</Component>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const BoxWithForwardRef = React.forwardRef((props: TBoxProps, ref: React.Ref<HTMLElement>) => {
|
|
27
|
-
const { as: Component = 'div', tokens, themeName = 'box', customTheme, children, ...rest } = props
|
|
28
|
-
const theme = useThemeContext(themeName, tokens, customTheme)
|
|
29
|
-
return (
|
|
30
|
-
<Component {...rest} ref={ref} className={theme}>
|
|
31
|
-
{children}
|
|
32
|
-
</Component>
|
|
33
|
-
)
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
export default Box
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
-
import type React from 'react'
|
|
3
|
-
import type { TToken } from '../../providers/Theme/interface'
|
|
4
|
-
import type { TDefaultComponent } from '../../types/components'
|
|
5
|
-
|
|
6
|
-
export interface TBoxProps<T = TToken> extends TDefaultComponent<T> {
|
|
7
|
-
className?: string
|
|
8
|
-
children?: React.ReactNode
|
|
9
|
-
dangerouslySetInnerHTML?: { __html: string | TrustedHTML }
|
|
10
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { Canvas, Meta, Story } from '@storybook/addon-docs'
|
|
2
|
-
import Button from './'
|
|
3
|
-
import Icon from '../Icon'
|
|
4
|
-
|
|
5
|
-
<Meta
|
|
6
|
-
title="BASE COMPONENTS/Button"
|
|
7
|
-
component={Button}
|
|
8
|
-
args={{
|
|
9
|
-
as: 'button',
|
|
10
|
-
disabled: false,
|
|
11
|
-
}}
|
|
12
|
-
/>
|
|
13
|
-
|
|
14
|
-
export const Template = (args) => <Button {...args}>Button</Button>
|
|
15
|
-
|
|
16
|
-
export const IconButton = (args) => (
|
|
17
|
-
<Button {...args}>
|
|
18
|
-
<span>Button</span>
|
|
19
|
-
<Icon icon="ArrowRight" />
|
|
20
|
-
</Button>
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
# Button
|
|
24
|
-
|
|
25
|
-
Button component. You can pass `shape`, `size` and `buttonStyle` into the `tokens` object to change the style.
|
|
26
|
-
You can use property `as` to render the button with a different component, e.g. `button` to `a` if its a link.
|
|
27
|
-
|
|
28
|
-
<Canvas>
|
|
29
|
-
<Story name="Primary" args={{}}>
|
|
30
|
-
{Template.bind({})}
|
|
31
|
-
</Story>
|
|
32
|
-
</Canvas>
|
|
33
|
-
|
|
34
|
-
<Canvas>
|
|
35
|
-
<Story
|
|
36
|
-
name="Large"
|
|
37
|
-
args={{
|
|
38
|
-
tokens: {
|
|
39
|
-
size: 'large',
|
|
40
|
-
shape: 'circular',
|
|
41
|
-
},
|
|
42
|
-
}}
|
|
43
|
-
>
|
|
44
|
-
{Template.bind({})}
|
|
45
|
-
</Story>
|
|
46
|
-
</Canvas>
|
|
47
|
-
|
|
48
|
-
<Canvas>
|
|
49
|
-
<Story
|
|
50
|
-
name="Rounded"
|
|
51
|
-
args={{
|
|
52
|
-
tokens: {
|
|
53
|
-
shape: 'rounded',
|
|
54
|
-
},
|
|
55
|
-
}}
|
|
56
|
-
>
|
|
57
|
-
{Template.bind({})}
|
|
58
|
-
</Story>
|
|
59
|
-
</Canvas>
|
|
60
|
-
|
|
61
|
-
<Canvas>
|
|
62
|
-
<Story
|
|
63
|
-
name="Outline"
|
|
64
|
-
args={{
|
|
65
|
-
tokens: {
|
|
66
|
-
buttonStyle: 'outline',
|
|
67
|
-
},
|
|
68
|
-
}}
|
|
69
|
-
>
|
|
70
|
-
{Template.bind({})}
|
|
71
|
-
</Story>
|
|
72
|
-
</Canvas>
|
|
73
|
-
|
|
74
|
-
<Canvas>
|
|
75
|
-
<Story
|
|
76
|
-
name="Hollow"
|
|
77
|
-
args={{
|
|
78
|
-
tokens: {
|
|
79
|
-
buttonStyle: 'hollow',
|
|
80
|
-
},
|
|
81
|
-
}}
|
|
82
|
-
>
|
|
83
|
-
{Template.bind({})}
|
|
84
|
-
</Story>
|
|
85
|
-
</Canvas>
|
|
86
|
-
|
|
87
|
-
<Canvas>
|
|
88
|
-
<Story
|
|
89
|
-
name="Icon"
|
|
90
|
-
args={{
|
|
91
|
-
tokens: {
|
|
92
|
-
buttonStyle: 'outline',
|
|
93
|
-
intent: 'error',
|
|
94
|
-
},
|
|
95
|
-
}}
|
|
96
|
-
>
|
|
97
|
-
{IconButton.bind({})}
|
|
98
|
-
</Story>
|
|
99
|
-
</Canvas>
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/display-name */
|
|
2
|
-
|
|
3
|
-
'use client'
|
|
4
|
-
|
|
5
|
-
import type { RefObject } from 'react'
|
|
6
|
-
import React, { useRef } from 'react'
|
|
7
|
-
import { FocusRing, useButton, useLink } from 'react-aria'
|
|
8
|
-
import useThemeContext from '../../providers/Theme/hooks'
|
|
9
|
-
import type { TAnchorPropsProps, TButtonProps } from './interface'
|
|
10
|
-
|
|
11
|
-
export const Anchor = React.forwardRef(
|
|
12
|
-
(props: TAnchorPropsProps, forwardRef: React.Ref<HTMLButtonElement & HTMLAnchorElement>) => {
|
|
13
|
-
const {
|
|
14
|
-
as: Component = 'a',
|
|
15
|
-
handlePress,
|
|
16
|
-
children,
|
|
17
|
-
as,
|
|
18
|
-
customTheme,
|
|
19
|
-
tokens,
|
|
20
|
-
themeName = 'button',
|
|
21
|
-
nextLinkProps,
|
|
22
|
-
...rest
|
|
23
|
-
} = props
|
|
24
|
-
|
|
25
|
-
const ref = forwardRef
|
|
26
|
-
const { linkProps } = useLink(
|
|
27
|
-
{
|
|
28
|
-
...{ ...props, ...nextLinkProps },
|
|
29
|
-
href: props.href ?? nextLinkProps?.href?.toString(),
|
|
30
|
-
elementType: as?.toString(),
|
|
31
|
-
onPress: handlePress,
|
|
32
|
-
},
|
|
33
|
-
(forwardRef as RefObject<HTMLElement>) ?? ref,
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
const theme = useThemeContext(themeName, tokens, customTheme)
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<FocusRing focusRingClass="has-focus-ring">
|
|
40
|
-
<Component ref={ref} {...linkProps} {...nextLinkProps} {...rest} className={theme}>
|
|
41
|
-
{children}
|
|
42
|
-
</Component>
|
|
43
|
-
</FocusRing>
|
|
44
|
-
)
|
|
45
|
-
},
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
const Button = React.forwardRef((props: TButtonProps, forwardRef: React.Ref<HTMLButtonElement & HTMLAnchorElement>) => {
|
|
49
|
-
const {
|
|
50
|
-
as: Component = 'button',
|
|
51
|
-
handlePress,
|
|
52
|
-
children,
|
|
53
|
-
as,
|
|
54
|
-
customTheme,
|
|
55
|
-
tokens,
|
|
56
|
-
themeName = 'button',
|
|
57
|
-
isDisabled = false,
|
|
58
|
-
...rest
|
|
59
|
-
} = props
|
|
60
|
-
const ref = forwardRef
|
|
61
|
-
const { buttonProps } = useButton(
|
|
62
|
-
{ ...props, isDisabled, elementType: as, onPress: handlePress },
|
|
63
|
-
(forwardRef as RefObject<HTMLElement>) ?? ref,
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
const theme = useThemeContext(themeName, tokens, customTheme)
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<FocusRing within focusRingClass="has-focus-ring">
|
|
70
|
-
<Component ref={ref} {...buttonProps} {...rest} className={theme}>
|
|
71
|
-
{children}
|
|
72
|
-
</Component>
|
|
73
|
-
</FocusRing>
|
|
74
|
-
)
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
export const ButtonWithForwardRef = React.forwardRef(
|
|
78
|
-
(props: TButtonProps, ref: React.Ref<HTMLButtonElement & HTMLAnchorElement>) => {
|
|
79
|
-
const { as } = props
|
|
80
|
-
if (as === 'a') return <Anchor ref={ref} {...props} />
|
|
81
|
-
return <Button ref={ref} {...props} />
|
|
82
|
-
},
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
const ButtonComponent = (props: TButtonProps) => {
|
|
86
|
-
const { as } = props
|
|
87
|
-
const ref = useRef(null)
|
|
88
|
-
if (as === 'a') return <Anchor ref={ref} {...props} />
|
|
89
|
-
return <Button ref={ref} {...props} />
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export default React.memo(ButtonComponent)
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { PressEvent } from '@react-types/shared'
|
|
2
|
-
import type { LinkProps } from 'next/link'
|
|
3
|
-
import type React from 'react'
|
|
4
|
-
import type { TDefaultComponent } from '../../types/components'
|
|
5
|
-
|
|
6
|
-
export interface TButtonProps extends TDefaultComponent {
|
|
7
|
-
children?: React.ReactNode
|
|
8
|
-
id?: string
|
|
9
|
-
href?: string
|
|
10
|
-
disabled?: boolean
|
|
11
|
-
download?: boolean
|
|
12
|
-
target?: string
|
|
13
|
-
rel?: string
|
|
14
|
-
handlePress?: ((e: PressEvent) => void) | undefined
|
|
15
|
-
tabIndex?: number
|
|
16
|
-
role?: string
|
|
17
|
-
isDisabled?: boolean
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface TAnchorPropsProps extends TButtonProps {
|
|
21
|
-
nextLinkProps?: LinkProps
|
|
22
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-unused-vars */
|
|
2
|
-
import { createCalendar } from '@internationalized/date'
|
|
3
|
-
import { useRangeCalendar } from '@react-aria/calendar'
|
|
4
|
-
import { useLocale } from '@react-aria/i18n'
|
|
5
|
-
import { useRangeCalendarState } from '@react-stately/calendar'
|
|
6
|
-
import { useRef } from 'react'
|
|
7
|
-
import useThemeContext from '../../providers/Theme/hooks'
|
|
8
|
-
import Button from '../Button'
|
|
9
|
-
import Icon from '../Icon'
|
|
10
|
-
import Typography from '../Typography'
|
|
11
|
-
import CalendarGrid from './components/CalendarGrid'
|
|
12
|
-
import type { TRangeCalendarProps } from './interface'
|
|
13
|
-
|
|
14
|
-
function RangeCalendar({ buttons, tokens, customTheme, themeName = 'calendar', ...rest }: TRangeCalendarProps) {
|
|
15
|
-
const { locale } = useLocale()
|
|
16
|
-
const state = useRangeCalendarState({
|
|
17
|
-
...rest,
|
|
18
|
-
locale,
|
|
19
|
-
createCalendar,
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
const ref = useRef(null)
|
|
23
|
-
const { calendarProps, prevButtonProps, nextButtonProps, title } = useRangeCalendar({ ...rest }, state, ref)
|
|
24
|
-
|
|
25
|
-
const containerTheme = useThemeContext(`${themeName}.container`, tokens)
|
|
26
|
-
const headerTheme = useThemeContext(`${themeName}.header`, tokens)
|
|
27
|
-
const navigationButtonsContainer = useThemeContext(`${themeName}.navigationButtonsContainer`, tokens)
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<div {...calendarProps} ref={ref} className={containerTheme}>
|
|
31
|
-
<div className={headerTheme}>
|
|
32
|
-
<Typography as="p" tokens={{ size: 'h6' }}>
|
|
33
|
-
{title}
|
|
34
|
-
</Typography>
|
|
35
|
-
<div className={navigationButtonsContainer}>
|
|
36
|
-
<Button
|
|
37
|
-
themeName={`${themeName}.navigationButtons`}
|
|
38
|
-
tokens={{ ...tokens }}
|
|
39
|
-
type="button"
|
|
40
|
-
{...prevButtonProps}
|
|
41
|
-
handlePress={prevButtonProps?.onPress}
|
|
42
|
-
>
|
|
43
|
-
<Icon icon={buttons?.buttonPrev?.icon ?? 'ArrowLeft'} />
|
|
44
|
-
</Button>
|
|
45
|
-
<Button
|
|
46
|
-
themeName={`${themeName}.navigationButtons`}
|
|
47
|
-
tokens={{ ...tokens }}
|
|
48
|
-
type="button"
|
|
49
|
-
{...nextButtonProps}
|
|
50
|
-
handlePress={nextButtonProps?.onPress}
|
|
51
|
-
>
|
|
52
|
-
<Icon icon={buttons?.buttonNext?.icon ?? 'ArrowRight'} />
|
|
53
|
-
</Button>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
<CalendarGrid state={state} />
|
|
57
|
-
</div>
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export default RangeCalendar
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Canvas, Meta, Story } from '@storybook/addon-docs'
|
|
2
|
-
import Calendar from './'
|
|
3
|
-
import RangeCalendar from './RangeCalendar'
|
|
4
|
-
import { OverlayContainer } from '@react-aria/overlays'
|
|
5
|
-
|
|
6
|
-
<Meta
|
|
7
|
-
title="Base Components/Calendar"
|
|
8
|
-
component={Calendar}
|
|
9
|
-
args={{
|
|
10
|
-
label: 'Filter by date',
|
|
11
|
-
variant: 'primary',
|
|
12
|
-
}}
|
|
13
|
-
/>
|
|
14
|
-
|
|
15
|
-
export const CalendarTemplate = (args) => <Calendar {...args} />
|
|
16
|
-
export const RangeCalendarTemplate = (args) => <RangeCalendar {...args} />
|
|
17
|
-
|
|
18
|
-
# Calendar
|
|
19
|
-
|
|
20
|
-
Calendar component.
|
|
21
|
-
|
|
22
|
-
<Canvas>
|
|
23
|
-
<Story name="Calendar">{CalendarTemplate.bind({})}</Story>
|
|
24
|
-
</Canvas>
|
|
25
|
-
|
|
26
|
-
<Canvas>
|
|
27
|
-
<Story name="Range Calendar">{RangeCalendarTemplate.bind({})}</Story>
|
|
28
|
-
</Canvas>
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { isSameDay, getDayOfWeek } from '@internationalized/date'
|
|
2
|
-
import { useCalendarCell } from '@react-aria/calendar'
|
|
3
|
-
import { useFocusRing } from '@react-aria/focus'
|
|
4
|
-
import { mergeProps } from '@react-aria/utils'
|
|
5
|
-
import type { RangeCalendarState } from '@react-stately/calendar'
|
|
6
|
-
import { useRef } from 'react'
|
|
7
|
-
import { useLocale } from 'react-aria'
|
|
8
|
-
import useThemeContext from '../../../providers/Theme/hooks'
|
|
9
|
-
import type { TCalendarCellProps } from '../interface'
|
|
10
|
-
|
|
11
|
-
function CalendarCell({ themeName = 'calendar', tokens, state, date }: TCalendarCellProps) {
|
|
12
|
-
const ref = useRef(null)
|
|
13
|
-
const { cellProps, buttonProps, isSelected, isOutsideVisibleRange, isDisabled, formattedDate, isInvalid } =
|
|
14
|
-
useCalendarCell({ date }, state, ref)
|
|
15
|
-
|
|
16
|
-
// The start and end date of the selected range will have
|
|
17
|
-
// an emphasized appearance.
|
|
18
|
-
const isSelectionStart = (state as RangeCalendarState)?.highlightedRange
|
|
19
|
-
? isSameDay(date, (state as RangeCalendarState)?.highlightedRange.start)
|
|
20
|
-
: isSelected
|
|
21
|
-
const isSelectionEnd = (state as RangeCalendarState)?.highlightedRange
|
|
22
|
-
? isSameDay(date, (state as RangeCalendarState)?.highlightedRange.end)
|
|
23
|
-
: isSelected
|
|
24
|
-
|
|
25
|
-
const { locale } = useLocale()
|
|
26
|
-
const dayOfWeek = getDayOfWeek(date, locale)
|
|
27
|
-
const isRoundedLeft = isSelected && (isSelectionStart || dayOfWeek === 0 || date.day === 1)
|
|
28
|
-
const isRoundedRight =
|
|
29
|
-
isSelected && (isSelectionEnd || dayOfWeek === 6 || date.day === date.calendar.getDaysInMonth(date))
|
|
30
|
-
|
|
31
|
-
const { focusProps, isFocusVisible } = useFocusRing()
|
|
32
|
-
|
|
33
|
-
const cellContainerTheme = useThemeContext(`${themeName}.cellContainer`, { ...tokens, isFocusVisible })
|
|
34
|
-
const cellTheme = useThemeContext(`${themeName}.cell`, {
|
|
35
|
-
...tokens,
|
|
36
|
-
isSelected,
|
|
37
|
-
isInvalid,
|
|
38
|
-
isDisabled,
|
|
39
|
-
isRoundedLeft,
|
|
40
|
-
isRoundedRight,
|
|
41
|
-
})
|
|
42
|
-
const cellDate = useThemeContext(`${themeName}.cellDate`, {
|
|
43
|
-
...tokens,
|
|
44
|
-
isSelected,
|
|
45
|
-
isInvalid,
|
|
46
|
-
isDisabled,
|
|
47
|
-
isSelectionStart,
|
|
48
|
-
isSelectionEnd,
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<td {...cellProps} aria-disabled={false} className={cellContainerTheme}>
|
|
53
|
-
<div {...mergeProps(buttonProps, focusProps)} ref={ref} hidden={isOutsideVisibleRange} className={cellTheme}>
|
|
54
|
-
<div className={cellDate}>{formattedDate}</div>
|
|
55
|
-
</div>
|
|
56
|
-
</td>
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export default CalendarCell
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/no-array-index-key */
|
|
2
|
-
/* eslint-disable no-unused-vars */
|
|
3
|
-
import { getWeeksInMonth } from '@internationalized/date'
|
|
4
|
-
import { useCalendarGrid } from '@react-aria/calendar'
|
|
5
|
-
import { useLocale } from '@react-aria/i18n'
|
|
6
|
-
import useThemeContext from '../../../providers/Theme/hooks'
|
|
7
|
-
import type { TCalendarGridProps } from '../interface'
|
|
8
|
-
import CalendarCell from './CalendarCell'
|
|
9
|
-
|
|
10
|
-
function CalendarGrid({ themeName = 'calendar', customTheme, tokens, state, ...rest }: TCalendarGridProps) {
|
|
11
|
-
const { locale } = useLocale()
|
|
12
|
-
const { gridProps, headerProps, weekDays } = useCalendarGrid({ ...rest }, state)
|
|
13
|
-
|
|
14
|
-
// Get the number of weeks in the month so we can render the proper number of rows.
|
|
15
|
-
const weeksInMonth = getWeeksInMonth(state.visibleRange.start, locale)
|
|
16
|
-
|
|
17
|
-
const tableTheme = useThemeContext(`${themeName}.calendarTable`, tokens)
|
|
18
|
-
const dayLabelTheme = useThemeContext(`${themeName}.dayLabel`, tokens)
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<table {...gridProps} cellPadding="0" className={tableTheme}>
|
|
22
|
-
<thead {...headerProps}>
|
|
23
|
-
<tr>
|
|
24
|
-
{weekDays.map((day) => (
|
|
25
|
-
<th key={`${day}`} className={dayLabelTheme}>
|
|
26
|
-
{day}
|
|
27
|
-
</th>
|
|
28
|
-
))}
|
|
29
|
-
</tr>
|
|
30
|
-
</thead>
|
|
31
|
-
<tbody>
|
|
32
|
-
{[...new Array(weeksInMonth).keys()].map((weekIndex) => (
|
|
33
|
-
<tr key={weekIndex}>
|
|
34
|
-
{state
|
|
35
|
-
.getDatesInWeek(weekIndex)
|
|
36
|
-
.map((date, i) => (date ? <CalendarCell key={date?.day} state={state} date={date} /> : <td key={i} />))}
|
|
37
|
-
</tr>
|
|
38
|
-
))}
|
|
39
|
-
</tbody>
|
|
40
|
-
</table>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export default CalendarGrid
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
/* eslint-disable no-unused-vars */
|
|
4
|
-
import { createCalendar } from '@internationalized/date'
|
|
5
|
-
import { useCalendar } from '@react-aria/calendar'
|
|
6
|
-
import { useLocale } from '@react-aria/i18n'
|
|
7
|
-
import { useCalendarState } from '@react-stately/calendar'
|
|
8
|
-
import { useRef } from 'react'
|
|
9
|
-
import useThemeContext from '../../providers/Theme/hooks'
|
|
10
|
-
import Button from '../Button'
|
|
11
|
-
import Icon from '../Icon'
|
|
12
|
-
import Typography from '../Typography'
|
|
13
|
-
import CalendarGrid from './components/CalendarGrid'
|
|
14
|
-
import type { TCalendarProps } from './interface'
|
|
15
|
-
|
|
16
|
-
function Calendar({ buttons, tokens, customTheme, themeName = 'calendar', ...rest }: TCalendarProps) {
|
|
17
|
-
const { locale } = useLocale()
|
|
18
|
-
const state = useCalendarState({
|
|
19
|
-
...rest,
|
|
20
|
-
locale,
|
|
21
|
-
createCalendar,
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
const ref = useRef(null)
|
|
25
|
-
const { calendarProps, prevButtonProps, nextButtonProps, title } = useCalendar({ ...rest }, state)
|
|
26
|
-
|
|
27
|
-
const containerTheme = useThemeContext(`${themeName}.container`, tokens)
|
|
28
|
-
const headerTheme = useThemeContext(`${themeName}.header`, tokens)
|
|
29
|
-
const navigationButtonsContainer = useThemeContext(`${themeName}.navigationButtonsContainer`, tokens)
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<div {...calendarProps} ref={ref} className={containerTheme}>
|
|
33
|
-
<div className={headerTheme}>
|
|
34
|
-
<Typography as="p" tokens={{ size: 'h6' }}>
|
|
35
|
-
{title}
|
|
36
|
-
</Typography>
|
|
37
|
-
<div className={navigationButtonsContainer}>
|
|
38
|
-
<Button
|
|
39
|
-
themeName={`${themeName}.navigationButtons`}
|
|
40
|
-
tokens={{ ...tokens }}
|
|
41
|
-
type="button"
|
|
42
|
-
{...prevButtonProps}
|
|
43
|
-
handlePress={prevButtonProps?.onPress}
|
|
44
|
-
>
|
|
45
|
-
<Icon icon={buttons?.buttonPrev?.icon ?? 'ArrowLeft'} />
|
|
46
|
-
</Button>
|
|
47
|
-
<Button
|
|
48
|
-
themeName={`${themeName}.navigationButtons`}
|
|
49
|
-
tokens={{ ...tokens }}
|
|
50
|
-
type="button"
|
|
51
|
-
{...nextButtonProps}
|
|
52
|
-
handlePress={nextButtonProps?.onPress}
|
|
53
|
-
>
|
|
54
|
-
<Icon icon={buttons?.buttonNext?.icon ?? 'ArrowRight'} />
|
|
55
|
-
</Button>
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
<CalendarGrid state={state} />
|
|
59
|
-
</div>
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default Calendar
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-unused-vars */
|
|
2
|
-
import type { CalendarDate, DateValue } from '@internationalized/date'
|
|
3
|
-
import type { CalendarProps, RangeCalendarProps } from '@react-aria/calendar'
|
|
4
|
-
import type { CalendarState, RangeCalendarState } from '@react-stately/calendar'
|
|
5
|
-
import type { AriaCalendarGridProps } from 'react-aria'
|
|
6
|
-
import type { TDefaultComponent } from '../../types/components'
|
|
7
|
-
|
|
8
|
-
export interface TCalendarProps extends CalendarProps<DateValue>, TDefaultComponent {
|
|
9
|
-
buttons?: {
|
|
10
|
-
buttonPrev?: {
|
|
11
|
-
icon?: string
|
|
12
|
-
}
|
|
13
|
-
buttonNext?: {
|
|
14
|
-
icon?: string
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface TRangeCalendarProps extends RangeCalendarProps<DateValue>, TDefaultComponent {
|
|
20
|
-
buttons?: {
|
|
21
|
-
buttonPrev?: {
|
|
22
|
-
icon?: string
|
|
23
|
-
}
|
|
24
|
-
buttonNext?: {
|
|
25
|
-
icon?: string
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface TCalendarGridProps extends AriaCalendarGridProps, TDefaultComponent {
|
|
31
|
-
state: RangeCalendarState | CalendarState
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface TCalendarCellProps extends TDefaultComponent {
|
|
35
|
-
state: RangeCalendarState | CalendarState
|
|
36
|
-
date: CalendarDate
|
|
37
|
-
}
|