@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,27 +0,0 @@
|
|
|
1
|
-
import { useTabPanel } from '@react-aria/tabs'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import RenderWithOpacity from '../../../../transitions/RenderWithOpacity'
|
|
4
|
-
import type { TDefaultComponent } from '../../../../types/components'
|
|
5
|
-
import { BoxWithForwardRef } from '../../../Box'
|
|
6
|
-
import type { TTabPanel } from '../../interface'
|
|
7
|
-
|
|
8
|
-
function TabPanel({ state, customTheme, themeName = 'tabPanel', tokens, ...props }: TTabPanel & TDefaultComponent) {
|
|
9
|
-
const ref = React.useRef(null)
|
|
10
|
-
const { tabPanelProps } = useTabPanel(props, state, ref)
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<RenderWithOpacity isVisible>
|
|
14
|
-
<BoxWithForwardRef
|
|
15
|
-
themeName={`${themeName}`}
|
|
16
|
-
tokens={tokens}
|
|
17
|
-
customTheme={customTheme}
|
|
18
|
-
{...tabPanelProps}
|
|
19
|
-
ref={ref}
|
|
20
|
-
>
|
|
21
|
-
{state.selectedItem?.props.children}
|
|
22
|
-
</BoxWithForwardRef>
|
|
23
|
-
</RenderWithOpacity>
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export default TabPanel
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { useTabList } from '@react-aria/tabs'
|
|
2
|
-
import { useTabListState } from '@react-stately/tabs'
|
|
3
|
-
import { isEmpty } from 'lodash'
|
|
4
|
-
import { useRef } from 'react'
|
|
5
|
-
import Box, { BoxWithForwardRef } from '../Box'
|
|
6
|
-
import Heading from '../Typography'
|
|
7
|
-
import Tab from './components/Tab/Tab'
|
|
8
|
-
import TabPanel from './components/TabPanel/TabPanel'
|
|
9
|
-
import type { TTabList } from './interface'
|
|
10
|
-
|
|
11
|
-
function TabList(props: TTabList) {
|
|
12
|
-
const { label, id } = props
|
|
13
|
-
|
|
14
|
-
const state = useTabListState({
|
|
15
|
-
...props,
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
const ref = useRef(null)
|
|
19
|
-
const { tabListProps } = useTabList(props, state, ref)
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<Box>
|
|
23
|
-
<Box>
|
|
24
|
-
{!isEmpty(label) && (
|
|
25
|
-
<Box>
|
|
26
|
-
<Box>
|
|
27
|
-
<Heading as="p">{label}</Heading>
|
|
28
|
-
</Box>
|
|
29
|
-
</Box>
|
|
30
|
-
)}
|
|
31
|
-
<BoxWithForwardRef {...tabListProps} ref={ref}>
|
|
32
|
-
{[...state.collection].map((item) => (
|
|
33
|
-
<Box key={`tablist-${id}-${item.key}`}>
|
|
34
|
-
<Tab key={item.key} item={item} state={state} />
|
|
35
|
-
</Box>
|
|
36
|
-
))}
|
|
37
|
-
</BoxWithForwardRef>
|
|
38
|
-
</Box>
|
|
39
|
-
<TabPanel key={state.selectedItem?.key} state={state} />
|
|
40
|
-
</Box>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export default TabList
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-unresolved */
|
|
2
|
-
import type { TabListState } from '@react-stately/tabs'
|
|
3
|
-
import type { Node } from '@react-types/shared'
|
|
4
|
-
import type { AriaTabListProps, AriaTabPanelProps } from '@react-types/tabs'
|
|
5
|
-
import type React from 'react'
|
|
6
|
-
|
|
7
|
-
export interface TTab {
|
|
8
|
-
item: Node<object>
|
|
9
|
-
state: TabListState<object>
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface TTabPanel extends AriaTabPanelProps {
|
|
13
|
-
state: TabListState<object>
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface TTabList extends AriaTabListProps<object> {
|
|
17
|
-
label?: React.ReactNode | string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface TPreviousTabState {
|
|
21
|
-
previousSelectedHash: string
|
|
22
|
-
previousSelectedKey: string
|
|
23
|
-
}
|
|
@@ -1,35 +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 { TTypographyProps } from './interface'
|
|
7
|
-
|
|
8
|
-
const Typography = ({
|
|
9
|
-
as: Component = 'span',
|
|
10
|
-
themeName = 'typography',
|
|
11
|
-
tokens,
|
|
12
|
-
customTheme,
|
|
13
|
-
children,
|
|
14
|
-
...rest
|
|
15
|
-
}: TTypographyProps) => {
|
|
16
|
-
const theme = useThemeContext(themeName, tokens, customTheme)
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<Component {...rest} className={theme}>
|
|
20
|
-
{children}
|
|
21
|
-
</Component>
|
|
22
|
-
)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const TypographyWithForwardRef = React.forwardRef((props: TTypographyProps, ref: React.Ref<HTMLElement>) => {
|
|
26
|
-
const { as: Component = 'span', tokens, themeName = 'typography', customTheme, children, ...rest } = props
|
|
27
|
-
const theme = useThemeContext(themeName, tokens, customTheme)
|
|
28
|
-
return (
|
|
29
|
-
<Component {...rest} ref={ref} className={theme}>
|
|
30
|
-
{children}
|
|
31
|
-
</Component>
|
|
32
|
-
)
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
export default Typography
|
|
@@ -1,9 +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 TTypographyProps<T = TToken> extends TDefaultComponent<T> {
|
|
7
|
-
children?: React.ReactNode
|
|
8
|
-
dangerouslySetInnerHTML?: { __html: string | TrustedHTML }
|
|
9
|
-
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
{/* typo.stories.mdx */}
|
|
2
|
-
|
|
3
|
-
import { Canvas, Meta, Story } from '@storybook/addon-docs'
|
|
4
|
-
import Typography from './index'
|
|
5
|
-
|
|
6
|
-
<Meta title="BASE COMPONENTS/Typography" component={Typography} />
|
|
7
|
-
|
|
8
|
-
export const Template = (args) => (
|
|
9
|
-
<div>
|
|
10
|
-
<Typography {...args}>Hello world!</Typography>
|
|
11
|
-
</div>
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
# Typography
|
|
15
|
-
|
|
16
|
-
Typography component. You can pass `size tokens` to change the style, from 'h1' to 'h6', 'leading', 'paragraph' and 'footnote' and 'xs'.
|
|
17
|
-
You can use property `as` to render the typography with a different component, e.g. `h1` to `h6` or even `div` and `header`.
|
|
18
|
-
|
|
19
|
-
<Canvas>
|
|
20
|
-
<Story
|
|
21
|
-
name="Heading 1"
|
|
22
|
-
args={{
|
|
23
|
-
as: 'h1',
|
|
24
|
-
tokens: {
|
|
25
|
-
size: 'h1',
|
|
26
|
-
},
|
|
27
|
-
}}
|
|
28
|
-
>
|
|
29
|
-
{Template.bind({})}
|
|
30
|
-
</Story>
|
|
31
|
-
</Canvas>
|
|
32
|
-
|
|
33
|
-
<Canvas>
|
|
34
|
-
<Story
|
|
35
|
-
name="Heading 2"
|
|
36
|
-
args={{
|
|
37
|
-
as: 'h2',
|
|
38
|
-
tokens: {
|
|
39
|
-
size: 'h2',
|
|
40
|
-
},
|
|
41
|
-
}}
|
|
42
|
-
>
|
|
43
|
-
{Template.bind({})}
|
|
44
|
-
</Story>
|
|
45
|
-
</Canvas>
|
|
46
|
-
|
|
47
|
-
<Canvas>
|
|
48
|
-
<Story
|
|
49
|
-
name="Heading 3"
|
|
50
|
-
args={{
|
|
51
|
-
as: 'h3',
|
|
52
|
-
tokens: {
|
|
53
|
-
size: 'h3',
|
|
54
|
-
},
|
|
55
|
-
}}
|
|
56
|
-
>
|
|
57
|
-
{Template.bind({})}
|
|
58
|
-
</Story>
|
|
59
|
-
</Canvas>
|
|
60
|
-
|
|
61
|
-
<Canvas>
|
|
62
|
-
<Story
|
|
63
|
-
name="Heading 4"
|
|
64
|
-
args={{
|
|
65
|
-
as: 'h4',
|
|
66
|
-
tokens: {
|
|
67
|
-
size: 'h4',
|
|
68
|
-
},
|
|
69
|
-
}}
|
|
70
|
-
>
|
|
71
|
-
{Template.bind({})}
|
|
72
|
-
</Story>
|
|
73
|
-
</Canvas>
|
|
74
|
-
|
|
75
|
-
<Canvas>
|
|
76
|
-
<Story
|
|
77
|
-
name="Heading 5"
|
|
78
|
-
args={{
|
|
79
|
-
as: 'h5',
|
|
80
|
-
tokens: {
|
|
81
|
-
size: 'h5',
|
|
82
|
-
},
|
|
83
|
-
}}
|
|
84
|
-
>
|
|
85
|
-
{Template.bind({})}
|
|
86
|
-
</Story>
|
|
87
|
-
</Canvas>
|
|
88
|
-
|
|
89
|
-
<Canvas>
|
|
90
|
-
<Story
|
|
91
|
-
name="Heading 6"
|
|
92
|
-
args={{
|
|
93
|
-
as: 'h6',
|
|
94
|
-
tokens: {
|
|
95
|
-
size: 'h6',
|
|
96
|
-
},
|
|
97
|
-
}}
|
|
98
|
-
>
|
|
99
|
-
{Template.bind({})}
|
|
100
|
-
</Story>
|
|
101
|
-
</Canvas>
|
|
102
|
-
|
|
103
|
-
<Canvas>
|
|
104
|
-
<Story
|
|
105
|
-
name="Default"
|
|
106
|
-
args={{
|
|
107
|
-
as: 'p',
|
|
108
|
-
tokens: {
|
|
109
|
-
size: 'paragraph',
|
|
110
|
-
},
|
|
111
|
-
}}
|
|
112
|
-
>
|
|
113
|
-
{Template.bind({})}
|
|
114
|
-
</Story>
|
|
115
|
-
</Canvas>
|
|
116
|
-
|
|
117
|
-
<Canvas>
|
|
118
|
-
<Story
|
|
119
|
-
name="Leading"
|
|
120
|
-
args={{
|
|
121
|
-
as: 'strong',
|
|
122
|
-
tokens: {
|
|
123
|
-
size: 'leading',
|
|
124
|
-
},
|
|
125
|
-
}}
|
|
126
|
-
>
|
|
127
|
-
{Template.bind({})}
|
|
128
|
-
</Story>
|
|
129
|
-
</Canvas>
|
|
130
|
-
|
|
131
|
-
<Canvas>
|
|
132
|
-
<Story
|
|
133
|
-
name="Footnotes"
|
|
134
|
-
args={{
|
|
135
|
-
as: 'p',
|
|
136
|
-
tokens: {
|
|
137
|
-
size: 'footnote',
|
|
138
|
-
},
|
|
139
|
-
}}
|
|
140
|
-
>
|
|
141
|
-
{Template.bind({})}
|
|
142
|
-
</Story>
|
|
143
|
-
</Canvas>
|
|
144
|
-
|
|
145
|
-
<Canvas>
|
|
146
|
-
<Story
|
|
147
|
-
name="XSmall"
|
|
148
|
-
args={{
|
|
149
|
-
as: 'p',
|
|
150
|
-
tokens: {
|
|
151
|
-
size: 'xs',
|
|
152
|
-
},
|
|
153
|
-
}}
|
|
154
|
-
>
|
|
155
|
-
{Template.bind({})}
|
|
156
|
-
</Story>
|
|
157
|
-
</Canvas>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import DOMPurify from 'isomorphic-dompurify'
|
|
2
|
-
import Typography from '../Typography'
|
|
3
|
-
import type TWysiwygBlockProps from './interface'
|
|
4
|
-
|
|
5
|
-
const WysiwygBlock = ({ content, themeName = 'wysiwyg', ...rest }: TWysiwygBlockProps) => {
|
|
6
|
-
return (
|
|
7
|
-
<Typography
|
|
8
|
-
{...rest}
|
|
9
|
-
themeName={themeName}
|
|
10
|
-
dangerouslySetInnerHTML={{
|
|
11
|
-
__html: DOMPurify.sanitize(content, {
|
|
12
|
-
ADD_TAGS: ['iframe'],
|
|
13
|
-
ADD_ATTR: ['allow', 'allowfullscreen', 'frameborder', 'scrolling', 'target'],
|
|
14
|
-
}),
|
|
15
|
-
}}
|
|
16
|
-
/>
|
|
17
|
-
)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default WysiwygBlock
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Canvas, Meta, Story } from '@storybook/addon-docs'
|
|
2
|
-
import { ArgTypes } from '@storybook/blocks'
|
|
3
|
-
import WysiwygBlock from './'
|
|
4
|
-
|
|
5
|
-
<Meta
|
|
6
|
-
title="BASE COMPONENTS/Wysiwyg Block"
|
|
7
|
-
component={WysiwygBlock}
|
|
8
|
-
argTypes={{
|
|
9
|
-
content: {
|
|
10
|
-
description: 'Takes HTML elements in string form from the Wysiwyg block content',
|
|
11
|
-
},
|
|
12
|
-
WysiwygBlockAttributes: {
|
|
13
|
-
description: 'target, allow, allowfullscreen, frameborder, scrolling, iframe',
|
|
14
|
-
}
|
|
15
|
-
}}
|
|
16
|
-
args={{
|
|
17
|
-
content: '<a target="_self" href="https://www.google.com/">Link with target _self</a>',
|
|
18
|
-
}}
|
|
19
|
-
/>
|
|
20
|
-
|
|
21
|
-
export const Template = (args) => {
|
|
22
|
-
return <WysiwygBlock {...args} />
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
# Wysiwyg Block
|
|
26
|
-
|
|
27
|
-
#### Wysiwyg Block. Can be used in CMS to insert HTML elements as text with certain attributes (h1, h2, h3, link with target, etc.)
|
|
28
|
-
|
|
29
|
-
## Props
|
|
30
|
-
|
|
31
|
-
<ArgTypes />
|
|
32
|
-
|
|
33
|
-
## Showcase
|
|
34
|
-
|
|
35
|
-
### Wysiwyg Block link with target \_self
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<Canvas>
|
|
39
|
-
<Story name="Link with target _self">{Template.bind({})}</Story>
|
|
40
|
-
</Canvas>
|
|
41
|
-
|
|
42
|
-
### Wysiwyg Block link with target \_blank
|
|
43
|
-
|
|
44
|
-
<Canvas>
|
|
45
|
-
<Story
|
|
46
|
-
name="Link with target blank"
|
|
47
|
-
args={{
|
|
48
|
-
content: '<a target="_blank" href="https://www.google.com/">Link with target _blank</a>',
|
|
49
|
-
}}
|
|
50
|
-
>
|
|
51
|
-
{Template.bind({})}
|
|
52
|
-
</Story>
|
|
53
|
-
</Canvas>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type React from 'react'
|
|
2
|
-
import type { AriaCheckboxProps } from 'react-aria'
|
|
3
|
-
import type { TDefaultComponent } from '../../../types/components'
|
|
4
|
-
|
|
5
|
-
export interface TCheckboxProps extends TDefaultComponent, AriaCheckboxProps {
|
|
6
|
-
label: string
|
|
7
|
-
isError?: boolean
|
|
8
|
-
errorMessage?: string
|
|
9
|
-
ariaLabel?: string
|
|
10
|
-
icon?: React.ReactNode
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface TCheckboxLabelStyles {
|
|
14
|
-
isDisabled?: boolean
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface TCheckboxStyles {
|
|
18
|
-
isDisabled?: boolean
|
|
19
|
-
isFocused?: boolean
|
|
20
|
-
isError?: boolean
|
|
21
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
{/* Checkbox.stories.mdx */}
|
|
2
|
-
import { Canvas, Meta, Story } from '@storybook/addon-docs'
|
|
3
|
-
import Checkbox from './index'
|
|
4
|
-
import Check from '../../icons/Check'
|
|
5
|
-
import Button from '../../Button'
|
|
6
|
-
import { useState } from 'react'
|
|
7
|
-
|
|
8
|
-
<Meta
|
|
9
|
-
title="Form/Fields/Checkbox"
|
|
10
|
-
component={Checkbox}
|
|
11
|
-
args={{
|
|
12
|
-
label: 'This is a checkbox label',
|
|
13
|
-
name: 'checkbox',
|
|
14
|
-
ariaLabel: 'checkbox-label',
|
|
15
|
-
onChange: (isSelected) => console.log(`isSelected: ${isSelected}`),
|
|
16
|
-
}}
|
|
17
|
-
/>
|
|
18
|
-
|
|
19
|
-
export const Template = (args) => <Checkbox {...args} />
|
|
20
|
-
|
|
21
|
-
export const TemplateWithButton = (args) => {
|
|
22
|
-
const [checked, setChecked] = useState(args?.defaultSelected ?? false)
|
|
23
|
-
const { onChange, ...restOfArgs } = args
|
|
24
|
-
return (
|
|
25
|
-
<div className={`flex gap-4 items-center`}>
|
|
26
|
-
<Checkbox
|
|
27
|
-
isSelected={checked}
|
|
28
|
-
onChange={(isSelected) => {
|
|
29
|
-
setChecked(!checked)
|
|
30
|
-
onChange(isSelected)
|
|
31
|
-
}}
|
|
32
|
-
{...restOfArgs}
|
|
33
|
-
/>
|
|
34
|
-
<Button handlePress={() => setChecked(!checked)}>Click to check</Button>
|
|
35
|
-
</div>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
# Checkbox
|
|
40
|
-
|
|
41
|
-
Checkbox component.
|
|
42
|
-
|
|
43
|
-
## Default
|
|
44
|
-
|
|
45
|
-
<Canvas>
|
|
46
|
-
<Story
|
|
47
|
-
name="Default"
|
|
48
|
-
args={{
|
|
49
|
-
id: 'checkbox-1',
|
|
50
|
-
}}
|
|
51
|
-
>
|
|
52
|
-
{Template.bind({})}
|
|
53
|
-
</Story>
|
|
54
|
-
</Canvas>
|
|
55
|
-
|
|
56
|
-
## Color variant
|
|
57
|
-
|
|
58
|
-
<Canvas>
|
|
59
|
-
<Story
|
|
60
|
-
name="Gray"
|
|
61
|
-
args={{
|
|
62
|
-
id: 'checkbox-8',
|
|
63
|
-
tokens: {
|
|
64
|
-
color: 'gray',
|
|
65
|
-
},
|
|
66
|
-
}}
|
|
67
|
-
>
|
|
68
|
-
{Template.bind({})}
|
|
69
|
-
</Story>
|
|
70
|
-
</Canvas>
|
|
71
|
-
|
|
72
|
-
## With icon
|
|
73
|
-
|
|
74
|
-
<Canvas>
|
|
75
|
-
<Story
|
|
76
|
-
name="With icon"
|
|
77
|
-
args={{
|
|
78
|
-
id: 'checkbox-2',
|
|
79
|
-
icon: <Check />,
|
|
80
|
-
defaultSelected: true,
|
|
81
|
-
}}
|
|
82
|
-
>
|
|
83
|
-
{Template.bind({})}
|
|
84
|
-
</Story>
|
|
85
|
-
</Canvas>
|
|
86
|
-
|
|
87
|
-
## Disabled
|
|
88
|
-
|
|
89
|
-
<Canvas>
|
|
90
|
-
<Story
|
|
91
|
-
name="Disabled"
|
|
92
|
-
args={{
|
|
93
|
-
id: 'checkbox-3',
|
|
94
|
-
isDisabled: true,
|
|
95
|
-
}}
|
|
96
|
-
>
|
|
97
|
-
{Template.bind({})}
|
|
98
|
-
</Story>
|
|
99
|
-
</Canvas>
|
|
100
|
-
|
|
101
|
-
## Error
|
|
102
|
-
|
|
103
|
-
<Canvas>
|
|
104
|
-
<Story
|
|
105
|
-
name="Error"
|
|
106
|
-
args={{
|
|
107
|
-
id: 'checkbox-4',
|
|
108
|
-
isError: true,
|
|
109
|
-
errorMessage: 'This is an error message',
|
|
110
|
-
}}
|
|
111
|
-
>
|
|
112
|
-
{Template.bind({})}
|
|
113
|
-
</Story>
|
|
114
|
-
</Canvas>
|
|
115
|
-
|
|
116
|
-
## Check from other component
|
|
117
|
-
|
|
118
|
-
<Canvas>
|
|
119
|
-
<Story
|
|
120
|
-
name="Check from other component"
|
|
121
|
-
args={{
|
|
122
|
-
id: 'checkbox-5',
|
|
123
|
-
}}
|
|
124
|
-
>
|
|
125
|
-
{TemplateWithButton.bind({})}
|
|
126
|
-
</Story>
|
|
127
|
-
</Canvas>
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { useCheckbox } from '@react-aria/checkbox'
|
|
4
|
-
import { FocusRing, useFocusRing } from '@react-aria/focus'
|
|
5
|
-
import { VisuallyHidden } from '@react-aria/visually-hidden'
|
|
6
|
-
import { useToggleState } from '@react-stately/toggle'
|
|
7
|
-
import { useRef } from 'react'
|
|
8
|
-
import useThemeContext from '../../../providers/Theme/hooks'
|
|
9
|
-
import Icon from '../../Icon'
|
|
10
|
-
import Typography from '../../Typography'
|
|
11
|
-
import type { TCheckboxProps } from './Checkbox.interface'
|
|
12
|
-
|
|
13
|
-
const Checkbox = (props: TCheckboxProps) => {
|
|
14
|
-
const {
|
|
15
|
-
id,
|
|
16
|
-
label,
|
|
17
|
-
isDisabled = false,
|
|
18
|
-
isError = false,
|
|
19
|
-
errorMessage,
|
|
20
|
-
ariaLabel,
|
|
21
|
-
icon,
|
|
22
|
-
themeName = 'checkbox',
|
|
23
|
-
tokens,
|
|
24
|
-
customTheme,
|
|
25
|
-
} = props
|
|
26
|
-
const state = useToggleState(props)
|
|
27
|
-
const ref = useRef<HTMLInputElement | null>(null)
|
|
28
|
-
const { inputProps } = useCheckbox(props, state, ref)
|
|
29
|
-
const { isSelected } = state
|
|
30
|
-
const { focusProps, isFocusVisible } = useFocusRing()
|
|
31
|
-
|
|
32
|
-
const checkBoxTokens = { ...tokens, selected: isSelected, isDisabled, isError, isFocusVisible }
|
|
33
|
-
const checkBoxContainerTheme = useThemeContext(`${themeName}.container`, checkBoxTokens, customTheme)
|
|
34
|
-
const checkBoxTheme = useThemeContext(`${themeName}.checkBox`, checkBoxTokens, customTheme)
|
|
35
|
-
const checkMarkTheme = useThemeContext(`${themeName}.checkMark`, checkBoxTokens, customTheme)
|
|
36
|
-
const checkMarkIconTheme = useThemeContext(`${themeName}.checkMarkIcon`, checkBoxTokens, customTheme)
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<div>
|
|
40
|
-
<FocusRing focusRingClass="has-focus-ring" within>
|
|
41
|
-
<label className={checkBoxContainerTheme} htmlFor={id} aria-label={ariaLabel} aria-disabled={isDisabled}>
|
|
42
|
-
<VisuallyHidden>
|
|
43
|
-
<input type="checkbox" ref={ref} aria-labelledby={id} {...inputProps} {...focusProps} />
|
|
44
|
-
</VisuallyHidden>
|
|
45
|
-
<div className={checkBoxTheme} aria-checked={isSelected} role="checkbox" aria-labelledby={id}>
|
|
46
|
-
<div className={checkMarkTheme}>{icon && <Icon icon={icon} customTheme={checkMarkIconTheme} />}</div>
|
|
47
|
-
</div>
|
|
48
|
-
<Typography themeName={`${themeName}.label`} tokens={checkBoxTokens}>
|
|
49
|
-
{label}
|
|
50
|
-
</Typography>
|
|
51
|
-
</label>
|
|
52
|
-
</FocusRing>
|
|
53
|
-
{isError && errorMessage && (
|
|
54
|
-
<Typography themeName={`${themeName}.errorMessage`} tokens={checkBoxTokens}>
|
|
55
|
-
{errorMessage}
|
|
56
|
-
</Typography>
|
|
57
|
-
)}
|
|
58
|
-
</div>
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export default Checkbox
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Canvas, Meta, Story } from '@storybook/addon-docs'
|
|
2
|
-
import CheckboxGroup from './index'
|
|
3
|
-
import CheckboxGroupItem from './components/CheckboxGroupItem'
|
|
4
|
-
|
|
5
|
-
<Meta title="Form/Fields/CheckboxGroup" component={CheckboxGroup} />
|
|
6
|
-
|
|
7
|
-
export const Template = (args) => {
|
|
8
|
-
return (
|
|
9
|
-
<CheckboxGroup label="Question 1/12" {...args}>
|
|
10
|
-
<CheckboxGroupItem id="item1" label="Item 1" name="item" value="1" ariaLabel="Item 1" />
|
|
11
|
-
<CheckboxGroupItem id="item2" label="Item 2" name="item" value="2" ariaLabel="Item 2" />
|
|
12
|
-
<CheckboxGroupItem id="item3" label="Item 3" name="item" value="3" ariaLabel="Item 3" />
|
|
13
|
-
</CheckboxGroup>
|
|
14
|
-
)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const TemplateError = (args) => {
|
|
18
|
-
return (
|
|
19
|
-
<CheckboxGroup label="Question 2/12" {...args}>
|
|
20
|
-
<CheckboxGroupItem id="item4" label="Item 1" name="item" value="1" ariaLabel="Item 1" />
|
|
21
|
-
<CheckboxGroupItem id="item5" label="Item 2" name="item" value="2" ariaLabel="Item 2" />
|
|
22
|
-
<CheckboxGroupItem id="item6" label="Item 3" name="item" value="3" ariaLabel="Item 3" />
|
|
23
|
-
</CheckboxGroup>
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
# CheckboxGroup
|
|
28
|
-
|
|
29
|
-
CheckboxGroup component.
|
|
30
|
-
|
|
31
|
-
<Canvas>
|
|
32
|
-
<Story name="Default">{Template.bind({})}</Story>
|
|
33
|
-
</Canvas>
|
|
34
|
-
|
|
35
|
-
<Canvas>
|
|
36
|
-
<Story
|
|
37
|
-
name="Disabled"
|
|
38
|
-
args={{
|
|
39
|
-
isDisabled: true,
|
|
40
|
-
}}
|
|
41
|
-
|
|
42
|
-
>
|
|
43
|
-
|
|
44
|
-
{Template.bind({})}
|
|
45
|
-
|
|
46
|
-
</Story>
|
|
47
|
-
</Canvas>
|
|
48
|
-
|
|
49
|
-
<Canvas>
|
|
50
|
-
<Story
|
|
51
|
-
name="Error"
|
|
52
|
-
args={{
|
|
53
|
-
isError: true,
|
|
54
|
-
errorMessage: 'This is an error message',
|
|
55
|
-
}}
|
|
56
|
-
>
|
|
57
|
-
{TemplateError.bind({})}
|
|
58
|
-
</Story>
|
|
59
|
-
</Canvas>
|