@okam/stack-ui 1.25.2 → 1.25.3
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/.eslintrc.js +32 -0
- package/.storybook/.eslintrc.js +29 -0
- package/.storybook/main.ts +33 -0
- package/.storybook/preview.js +56 -0
- package/.storybook/tsconfig.json +17 -0
- package/CHANGELOG.md +574 -0
- package/README.md +8 -0
- package/package.json +1 -1
- package/postcss.config.js +15 -0
- package/project.json +77 -0
- package/src/_stories/icons/code-brackets.svg +1 -0
- package/src/_stories/icons/colors.svg +1 -0
- package/src/_stories/icons/comments.svg +1 -0
- package/src/_stories/icons/direction.svg +1 -0
- package/src/_stories/icons/flow.svg +1 -0
- package/src/_stories/icons/plugin.svg +1 -0
- package/src/_stories/icons/repo.svg +1 -0
- package/src/_stories/icons/stackalt.svg +1 -0
- package/src/components/Accordion/accordion.stories.mdx +240 -0
- package/src/components/Accordion/components/AccordionItem.tsx +53 -0
- package/src/components/Accordion/components/AriaAccordionItem.tsx +76 -0
- package/src/components/Accordion/hooks/useAccordionState.ts +46 -0
- package/src/components/Accordion/index.tsx +38 -0
- package/{components/Accordion/interface.d.ts → src/components/Accordion/interface.ts} +23 -17
- package/src/components/Alerts/alerts.stories.mdx +282 -0
- package/src/components/Alerts/components/AlertsCloseButton.tsx +20 -0
- package/src/components/Alerts/components/AlertsItem.tsx +39 -0
- package/src/components/Alerts/components/AlertsNavigationButton.tsx +71 -0
- package/src/components/Alerts/components/AlertsSwiper.tsx +125 -0
- package/src/components/Alerts/components/pagination/AlertsPagination.tsx +32 -0
- package/src/components/Alerts/components/pagination/AlertsPaginationBullet.tsx +61 -0
- package/src/components/Alerts/index.tsx +54 -0
- package/src/components/Alerts/interface.ts +51 -0
- package/src/components/Box/box.stories.mdx +27 -0
- package/src/components/Box/index.tsx +36 -0
- package/src/components/Box/interface.ts +10 -0
- package/src/components/Button/button.stories.mdx +99 -0
- package/src/components/Button/index.tsx +92 -0
- package/src/components/Button/interface.ts +22 -0
- package/src/components/Calendar/RangeCalendar.tsx +61 -0
- package/src/components/Calendar/calendar.stories.mdx +28 -0
- package/src/components/Calendar/components/CalendarCell.tsx +60 -0
- package/src/components/Calendar/components/CalendarGrid.tsx +44 -0
- package/src/components/Calendar/index.tsx +63 -0
- package/src/components/Calendar/interface.ts +37 -0
- package/src/components/Carousel/carousel.stories.mdx +182 -0
- package/src/components/Carousel/index.tsx +99 -0
- package/src/components/Carousel/interface.ts +26 -0
- package/src/components/Date/date.stories.mdx +122 -0
- package/src/components/Date/index.tsx +35 -0
- package/src/components/Date/interface.ts +7 -0
- package/src/components/Dialog/index.tsx +14 -0
- package/src/components/Dialog/interface.ts +6 -0
- package/src/components/DirectusImg/index.tsx +59 -0
- package/src/components/DirectusImg/interface.ts +19 -0
- package/src/components/Icon/index.tsx +40 -0
- package/src/components/Icon/interface.ts +8 -0
- package/src/components/Img/img.stories.mdx +28 -0
- package/src/components/Img/index.tsx +30 -0
- package/src/components/Img/interface.ts +9 -0
- package/src/components/Lightbox/hooks/overlay/index.tsx +36 -0
- package/src/components/Lightbox/index.tsx +82 -0
- package/src/components/Lightbox/interface.ts +28 -0
- package/src/components/Lightbox/lightbox.stories.mdx +79 -0
- package/src/components/Menu/Menu.tsx +43 -0
- package/src/components/Menu/MenuSidePanel.tsx +41 -0
- package/src/components/Menu/components/InnerContent.tsx +26 -0
- package/src/components/Menu/components/MenuItems.tsx +133 -0
- package/src/components/Menu/components/TabContainer.tsx +13 -0
- package/src/components/Menu/interface.ts +41 -0
- package/src/components/Menu/menu.stories.mdx +23 -0
- package/src/components/Modal/components/ModalDialog.tsx +31 -0
- package/src/components/Modal/components/ModalOverlay.tsx +21 -0
- package/src/components/Modal/index.tsx +32 -0
- package/{components/Modal/interface.d.ts → src/components/Modal/interface.ts} +14 -11
- package/src/components/Popover/index.tsx +138 -0
- package/src/components/Popover/interface.ts +25 -0
- package/src/components/Popover/popover.stories.mdx +66 -0
- package/src/components/ShareButton/index.tsx +172 -0
- package/src/components/ShareButton/interface.ts +29 -0
- package/src/components/ShareButton/share-button.stories.mdx +48 -0
- package/src/components/ShareButton/utils/generateUtmTags.ts +4 -0
- package/src/components/ShareButton/utils/useFacebookShareUrl.ts +15 -0
- package/src/components/ShareButton/utils/useMailToShareUrl.ts +15 -0
- package/src/components/ShareButton/utils/useTwitterShareUrl.ts +15 -0
- package/src/components/ShareButton/utils/useWindow.ts +17 -0
- package/src/components/SidePanel/index.tsx +43 -0
- package/src/components/SidePanel/interface.ts +16 -0
- package/src/components/SidePanel/side-panel.stories.mdx +44 -0
- package/src/components/TabList/components/Tab/Tab.tsx +19 -0
- package/src/components/TabList/components/TabPanel/TabPanel.tsx +27 -0
- package/src/components/TabList/index.tsx +44 -0
- package/src/components/TabList/interface.ts +23 -0
- package/src/components/Typography/index.tsx +35 -0
- package/src/components/Typography/interface.ts +9 -0
- package/src/components/Typography/typo.stories.mdx +157 -0
- package/src/components/WysiwygBlock/index.tsx +20 -0
- package/src/components/WysiwygBlock/interface.ts +7 -0
- package/src/components/WysiwygBlock/wysiwyg.stories.mdx +53 -0
- package/src/components/fields/Checkbox/Checkbox.interface.ts +21 -0
- package/src/components/fields/Checkbox/Checkbox.stories.mdx +127 -0
- package/src/components/fields/Checkbox/index.tsx +62 -0
- package/src/components/fields/CheckboxGroup/checkbox-group.stories.mdx +59 -0
- package/src/components/fields/CheckboxGroup/components/CheckboxGroupItem/index.tsx +66 -0
- package/src/components/fields/CheckboxGroup/index.tsx +49 -0
- package/src/components/fields/CheckboxGroup/interface.ts +17 -0
- package/src/components/fields/DatePicker/DateRangePicker.tsx +73 -0
- package/src/components/fields/DatePicker/components/CalendarPopover.tsx +31 -0
- package/src/components/fields/DatePicker/components/DateField.tsx +61 -0
- package/src/components/fields/DatePicker/date-picker.stories.mdx +55 -0
- package/src/components/fields/DatePicker/index.tsx +71 -0
- package/src/components/fields/DatePicker/interface.ts +69 -0
- package/src/components/fields/Radio/Radio.interface.ts +30 -0
- package/src/components/fields/Radio/index.tsx +63 -0
- package/src/components/fields/RadioGroup/index.tsx +33 -0
- package/src/components/fields/RadioGroup/interface.ts +10 -0
- package/src/components/fields/RadioGroup/radio-group.stories.mdx +56 -0
- package/src/components/fields/SearchField/index.tsx +59 -0
- package/src/components/fields/SearchField/interface.ts +10 -0
- package/src/components/fields/SearchField/search.stories.mdx +91 -0
- package/src/components/fields/Select/Select.interface.ts +24 -0
- package/src/components/fields/Select/Select.stories.mdx +53 -0
- package/src/components/fields/Select/Select.tsx +108 -0
- package/{components/fields/Select/components/Listbox.interface.d.ts → src/components/fields/Select/components/Listbox.interface.ts} +11 -8
- package/src/components/fields/Select/components/Listbox.tsx +40 -0
- package/src/components/fields/Select/components/Popover.interface.ts +14 -0
- package/src/components/fields/Select/components/Popover.tsx +32 -0
- package/{components/fields/SelectItem/SelectItem.interface.d.ts → src/components/fields/SelectItem/SelectItem.interface.ts} +4 -3
- package/src/components/fields/SelectItem/SelectItem.tsx +10 -0
- package/src/components/fields/TextArea/index.tsx +105 -0
- package/src/components/fields/TextArea/textArea.stories.mdx +60 -0
- package/src/components/fields/TextInputField/index.tsx +107 -0
- package/src/components/fields/TextInputField/interface.ts +30 -0
- package/src/components/fields/TextInputField/text-input-field.stories.mdx +64 -0
- package/src/components/icons/ArrowDown.tsx +11 -0
- package/src/components/icons/ArrowLeft.tsx +18 -0
- package/src/components/icons/ArrowRight.tsx +18 -0
- package/src/components/icons/Check.tsx +11 -0
- package/src/components/icons/ChevronLeft.tsx +11 -0
- package/src/components/icons/ChevronRight.tsx +11 -0
- package/src/components/icons/CloseBtn.tsx +11 -0
- package/src/components/icons/Facebook.tsx +14 -0
- package/src/components/icons/FacebookColored.tsx +16 -0
- package/src/components/icons/FacebookRounded.tsx +16 -0
- package/src/components/icons/Globe.tsx +38 -0
- package/src/components/icons/IconFallback.tsx +8 -0
- package/src/components/icons/Instagram.tsx +14 -0
- package/src/components/icons/InstagramColored.tsx +59 -0
- package/src/components/icons/Link.tsx +14 -0
- package/src/components/icons/LinkedIn.tsx +16 -0
- package/src/components/icons/Mail.tsx +16 -0
- package/src/components/icons/Plus.tsx +18 -0
- package/src/components/icons/Search.tsx +19 -0
- package/src/components/icons/Share.tsx +16 -0
- package/src/components/icons/Twitter.tsx +16 -0
- package/src/components/icons/TwitterColored.tsx +16 -0
- package/src/components/icons/Upload.tsx +14 -0
- package/src/components/icons/X.tsx +14 -0
- package/src/components/icons/YouTube.tsx +16 -0
- package/src/components/icons/YouTubeColored.tsx +17 -0
- package/src/components/icons/index.ts +24 -0
- package/src/examples/PageLayout/index.tsx +61 -0
- package/src/examples/PageLayout/layout.stories.mdx +35 -0
- package/{index.d.ts → src/index.ts} +72 -57
- package/src/message.tsx +8 -0
- package/src/providers/Accordion/index.tsx +15 -0
- package/src/providers/Accordion/interface.ts +14 -0
- package/src/providers/Alerts/index.tsx +15 -0
- package/src/providers/Alerts/interface.ts +11 -0
- package/src/providers/CheckboxGroup/index.tsx +22 -0
- package/{providers/CheckboxGroup/interface.d.ts → src/providers/CheckboxGroup/interface.ts} +5 -4
- package/src/providers/Client/index.tsx +21 -0
- package/src/providers/Client/interface.ts +13 -0
- package/src/providers/Menu/index.tsx +43 -0
- package/src/providers/Menu/interface.ts +32 -0
- package/src/providers/RadioGroup/RadioGroup.interface.ts +8 -0
- package/src/providers/RadioGroup/RadioGroup.tsx +25 -0
- package/src/providers/SidePanel/index.tsx +55 -0
- package/src/providers/SidePanel/interface.ts +26 -0
- package/src/providers/Theme/hooks.ts +25 -0
- package/src/providers/Theme/index.tsx +40 -0
- package/src/providers/Theme/interface.ts +28 -0
- package/src/providers/Theme/utils.ts +3 -0
- package/src/providers/UserSearchQuery/index.tsx +20 -0
- package/src/providers/UserSearchQuery/interface.ts +12 -0
- package/src/storybook/Lightbox/LightboxControlledState.tsx +28 -0
- package/src/storybook/Menu/Menu.tsx +177 -0
- package/src/storybook/Menu/NestedMenu.tsx +24 -0
- package/src/storybook/Menu/mock.tsx +84 -0
- package/src/storybook/SelectField/index.tsx +57 -0
- package/src/storybook/ShareButtonExample/index.tsx +66 -0
- package/src/tailwind.css +3 -0
- package/src/theme/Accordion/index.tsx +101 -0
- package/src/theme/Alerts/index.ts +97 -0
- package/src/theme/Box/index.ts +45 -0
- package/src/theme/Button/index.tsx +72 -0
- package/src/theme/Calendar/index.tsx +167 -0
- package/src/theme/Carousel/index.ts +36 -0
- package/src/theme/Checkbox/index.ts +49 -0
- package/src/theme/CheckboxGroup/index.ts +14 -0
- package/src/theme/DatePicker/index.tsx +42 -0
- package/src/theme/Image/index.ts +8 -0
- package/src/theme/LightBox/index.ts +56 -0
- package/src/theme/Radio/index.ts +31 -0
- package/src/theme/RadioGroup/index.ts +14 -0
- package/src/theme/Search/index.ts +20 -0
- package/src/theme/ShareButton/index.tsx +76 -0
- package/src/theme/SidePanel/index.ts +9 -0
- package/src/theme/TextArea/index.ts +25 -0
- package/src/theme/Typography/index.tsx +44 -0
- package/src/theme/index.tsx +178 -0
- package/src/transitions/AccordionTransition.tsx +26 -0
- package/src/transitions/ModalTransition.tsx +38 -0
- package/src/transitions/RenderWithOpacity.tsx +25 -0
- package/src/transitions/RenderWithSlide.tsx +21 -0
- package/src/transitions/SidePanelTransition.tsx +30 -0
- package/src/types/components.ts +34 -0
- package/static/images/image.png +0 -0
- package/tailwind.config.js +14 -0
- package/tsconfig.json +20 -0
- package/tsconfig.lib.json +25 -0
- package/vite.config.ts +58 -0
- package/components/Accordion/components/AccordionItem.d.ts +0 -3
- package/components/Accordion/components/AriaAccordionItem.d.ts +0 -3
- package/components/Accordion/hooks/useAccordionState.d.ts +0 -10
- package/components/Accordion/index.d.ts +0 -3
- package/components/Alerts/components/AlertsCloseButton.d.ts +0 -4
- package/components/Alerts/components/AlertsItem.d.ts +0 -3
- package/components/Alerts/components/AlertsNavigationButton.d.ts +0 -8
- package/components/Alerts/components/AlertsSwiper.d.ts +0 -3
- package/components/Alerts/components/pagination/AlertsPagination.d.ts +0 -3
- package/components/Alerts/components/pagination/AlertsPaginationBullet.d.ts +0 -3
- package/components/Alerts/index.d.ts +0 -3
- package/components/Alerts/interface.d.ts +0 -41
- package/components/Box/index.d.ts +0 -5
- package/components/Box/interface.d.ts +0 -10
- package/components/Button/index.d.ts +0 -6
- package/components/Button/interface.d.ts +0 -20
- package/components/Calendar/RangeCalendar.d.ts +0 -3
- package/components/Calendar/components/CalendarCell.d.ts +0 -3
- package/components/Calendar/components/CalendarGrid.d.ts +0 -3
- package/components/Calendar/index.d.ts +0 -3
- package/components/Calendar/interface.d.ts +0 -32
- package/components/Carousel/index.d.ts +0 -3
- package/components/Carousel/interface.d.ts +0 -24
- package/components/Date/index.d.ts +0 -3
- package/components/Date/interface.d.ts +0 -6
- package/components/Dialog/index.d.ts +0 -2
- package/components/Dialog/interface.d.ts +0 -6
- package/components/DirectusImg/index.d.ts +0 -3
- package/components/DirectusImg/interface.d.ts +0 -13
- package/components/Icon/index.d.ts +0 -3
- package/components/Icon/interface.d.ts +0 -7
- package/components/Img/index.d.ts +0 -3
- package/components/Img/interface.d.ts +0 -6
- package/components/Lightbox/index.d.ts +0 -3
- package/components/Lightbox/interface.d.ts +0 -25
- package/components/Menu/Menu.d.ts +0 -3
- package/components/Menu/MenuSidePanel.d.ts +0 -3
- package/components/Menu/components/InnerContent.d.ts +0 -3
- package/components/Menu/components/MenuItems.d.ts +0 -3
- package/components/Menu/components/TabContainer.d.ts +0 -3
- package/components/Menu/interface.d.ts +0 -31
- package/components/Modal/components/ModalDialog.d.ts +0 -3
- package/components/Modal/components/ModalOverlay.d.ts +0 -3
- package/components/Modal/index.d.ts +0 -3
- package/components/Popover/index.d.ts +0 -3
- package/components/Popover/interface.d.ts +0 -21
- package/components/ShareButton/index.d.ts +0 -4
- package/components/ShareButton/interface.d.ts +0 -26
- package/components/ShareButton/utils/generateUtmTags.d.ts +0 -2
- package/components/ShareButton/utils/useFacebookShareUrl.d.ts +0 -2
- package/components/ShareButton/utils/useMailToShareUrl.d.ts +0 -2
- package/components/ShareButton/utils/useTwitterShareUrl.d.ts +0 -2
- package/components/ShareButton/utils/useWindow.d.ts +0 -5
- package/components/SidePanel/index.d.ts +0 -4
- package/components/SidePanel/interface.d.ts +0 -12
- package/components/TabList/components/TabPanel/TabPanel.d.ts +0 -4
- package/components/TabList/interface.d.ts +0 -18
- package/components/Typography/index.d.ts +0 -5
- package/components/Typography/interface.d.ts +0 -9
- package/components/WysiwygBlock/index.d.ts +0 -3
- package/components/WysiwygBlock/interface.d.ts +0 -5
- package/components/fields/Checkbox/Checkbox.interface.d.ts +0 -18
- package/components/fields/Checkbox/index.d.ts +0 -3
- package/components/fields/CheckboxGroup/components/CheckboxGroupItem/index.d.ts +0 -3
- package/components/fields/CheckboxGroup/index.d.ts +0 -3
- package/components/fields/CheckboxGroup/interface.d.ts +0 -13
- package/components/fields/DatePicker/DateRangePicker.d.ts +0 -3
- package/components/fields/DatePicker/components/CalendarPopover.d.ts +0 -2
- package/components/fields/DatePicker/components/DateField.d.ts +0 -4
- package/components/fields/DatePicker/index.d.ts +0 -3
- package/components/fields/DatePicker/interface.d.ts +0 -37
- package/components/fields/Radio/Radio.interface.d.ts +0 -26
- package/components/fields/Radio/index.d.ts +0 -4
- package/components/fields/RadioGroup/index.d.ts +0 -3
- package/components/fields/RadioGroup/interface.d.ts +0 -9
- package/components/fields/SearchField/index.d.ts +0 -3
- package/components/fields/SearchField/interface.d.ts +0 -9
- package/components/fields/Select/Select.d.ts +0 -4
- package/components/fields/Select/Select.interface.d.ts +0 -26
- package/components/fields/Select/components/Listbox.d.ts +0 -4
- package/components/fields/Select/components/Popover.d.ts +0 -3
- package/components/fields/Select/components/Popover.interface.d.ts +0 -13
- package/components/fields/SelectItem/SelectItem.d.ts +0 -3
- package/components/fields/TextArea/index.d.ts +0 -4
- package/components/fields/TextInputField/index.d.ts +0 -4
- package/components/fields/TextInputField/interface.d.ts +0 -24
- package/components/icons/ArrowDown.d.ts +0 -3
- package/components/icons/ArrowLeft.d.ts +0 -3
- package/components/icons/ArrowRight.d.ts +0 -3
- package/components/icons/Check.d.ts +0 -3
- package/components/icons/ChevronLeft.d.ts +0 -3
- package/components/icons/ChevronRight.d.ts +0 -3
- package/components/icons/CloseBtn.d.ts +0 -3
- package/components/icons/Facebook.d.ts +0 -3
- package/components/icons/FacebookColored.d.ts +0 -3
- package/components/icons/FacebookRounded.d.ts +0 -3
- package/components/icons/Globe.d.ts +0 -3
- package/components/icons/IconFallback.d.ts +0 -3
- package/components/icons/Instagram.d.ts +0 -3
- package/components/icons/InstagramColored.d.ts +0 -3
- package/components/icons/Link.d.ts +0 -3
- package/components/icons/LinkedIn.d.ts +0 -3
- package/components/icons/Mail.d.ts +0 -3
- package/components/icons/Plus.d.ts +0 -3
- package/components/icons/Search.d.ts +0 -3
- package/components/icons/Share.d.ts +0 -3
- package/components/icons/Twitter.d.ts +0 -3
- package/components/icons/TwitterColored.d.ts +0 -3
- package/components/icons/Upload.d.ts +0 -3
- package/components/icons/X.d.ts +0 -3
- package/components/icons/YouTube.d.ts +0 -3
- package/components/icons/YouTubeColored.d.ts +0 -3
- package/components/icons/index.d.ts +0 -24
- package/index.js +0 -110
- package/index.mjs +0 -12897
- package/providers/Accordion/index.d.ts +0 -4
- package/providers/Accordion/interface.d.ts +0 -12
- package/providers/Alerts/index.d.ts +0 -4
- package/providers/Alerts/interface.d.ts +0 -9
- package/providers/CheckboxGroup/index.d.ts +0 -5
- package/providers/Client/index.d.ts +0 -4
- package/providers/Client/interface.d.ts +0 -10
- package/providers/Menu/index.d.ts +0 -4
- package/providers/Menu/interface.d.ts +0 -28
- package/providers/RadioGroup/RadioGroup.d.ts +0 -5
- package/providers/RadioGroup/RadioGroup.interface.d.ts +0 -7
- package/providers/SidePanel/index.d.ts +0 -4
- package/providers/SidePanel/interface.d.ts +0 -23
- package/providers/Theme/hooks.d.ts +0 -3
- package/providers/Theme/index.d.ts +0 -10
- package/providers/Theme/interface.d.ts +0 -24
- package/providers/Theme/utils.d.ts +0 -2
- package/providers/UserSearchQuery/index.d.ts +0 -4
- package/providers/UserSearchQuery/interface.d.ts +0 -10
- package/style.css +0 -1
- package/theme/Accordion/index.d.ts +0 -274
- package/theme/Alerts/index.d.ts +0 -1167
- package/theme/Box/index.d.ts +0 -214
- package/theme/Button/index.d.ts +0 -121
- package/theme/Calendar/index.d.ts +0 -366
- package/theme/Carousel/index.d.ts +0 -9
- package/theme/Checkbox/index.d.ts +0 -159
- package/theme/CheckboxGroup/index.d.ts +0 -30
- package/theme/DatePicker/index.d.ts +0 -43
- package/theme/Image/index.d.ts +0 -3
- package/theme/LightBox/index.d.ts +0 -455
- package/theme/Radio/index.d.ts +0 -108
- package/theme/RadioGroup/index.d.ts +0 -30
- package/theme/Search/index.d.ts +0 -30
- package/theme/ShareButton/index.d.ts +0 -174
- package/theme/SidePanel/index.d.ts +0 -3
- package/theme/TextArea/index.d.ts +0 -29
- package/theme/Typography/index.d.ts +0 -233
- package/theme/index.d.ts +0 -5
- package/transitions/AccordionTransition.d.ts +0 -3
- package/transitions/ModalTransition.d.ts +0 -7
- package/transitions/RenderWithOpacity.d.ts +0 -3
- package/transitions/RenderWithSlide.d.ts +0 -7
- package/transitions/SidePanelTransition.d.ts +0 -7
- package/types/components.d.ts +0 -28
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { createCtx } from '@okam/core-lib'
|
|
4
|
+
import { useMemo, useRef } from 'react'
|
|
5
|
+
import { useOverlayTriggerState } from 'react-stately'
|
|
6
|
+
import useOverlayHook from '../../components/Lightbox/hooks/overlay'
|
|
7
|
+
import type { TSidePanelContext, TSidePanelProviderProps } from './interface'
|
|
8
|
+
|
|
9
|
+
const [useSidePanel, SidePanelProvider] = createCtx<TSidePanelContext>()
|
|
10
|
+
|
|
11
|
+
export { useSidePanel }
|
|
12
|
+
|
|
13
|
+
export function SidePanelContextProvider(props: TSidePanelProviderProps) {
|
|
14
|
+
const {
|
|
15
|
+
children,
|
|
16
|
+
defaultSelectedKey,
|
|
17
|
+
onOpenCallback,
|
|
18
|
+
onCloseCallback,
|
|
19
|
+
defaultIsOpen = false,
|
|
20
|
+
type = 'dialog',
|
|
21
|
+
} = props
|
|
22
|
+
|
|
23
|
+
const openButtonRef = useRef(null)
|
|
24
|
+
const closeButtonRef = useRef(null)
|
|
25
|
+
|
|
26
|
+
const overlayState = useOverlayTriggerState({
|
|
27
|
+
defaultOpen: defaultIsOpen,
|
|
28
|
+
onOpenChange(isOpen) {
|
|
29
|
+
if (!isOpen) {
|
|
30
|
+
onCloseCallback?.()
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
onOpenCallback?.()
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const { triggerProps, overlayProps } = useOverlayHook({ type }, overlayState)
|
|
38
|
+
|
|
39
|
+
const value = useMemo<TSidePanelContext>(
|
|
40
|
+
() => ({
|
|
41
|
+
overlayProps,
|
|
42
|
+
defaultSelectedKey,
|
|
43
|
+
overlayState,
|
|
44
|
+
buttonProps: {
|
|
45
|
+
closeButtonProps: triggerProps,
|
|
46
|
+
closeButtonRef,
|
|
47
|
+
openButtonProps: triggerProps,
|
|
48
|
+
openButtonRef,
|
|
49
|
+
},
|
|
50
|
+
}),
|
|
51
|
+
[overlayState, defaultSelectedKey, triggerProps, overlayProps],
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
return <SidePanelProvider value={value}>{children}</SidePanelProvider>
|
|
55
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { OverlayTriggerState } from '@react-stately/overlays'
|
|
2
|
+
import type { DOMProps } from '@react-types/shared'
|
|
3
|
+
import type React from 'react'
|
|
4
|
+
import type { OverlayTriggerProps } from 'react-aria'
|
|
5
|
+
|
|
6
|
+
export type TSidePanelProviderProps = Partial<OverlayTriggerProps> & {
|
|
7
|
+
children: React.ReactNode
|
|
8
|
+
defaultSelectedKey: string
|
|
9
|
+
defaultIsOpen?: boolean
|
|
10
|
+
onOpenCallback?: () => void
|
|
11
|
+
onCloseCallback?: () => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type TButtonProps = {
|
|
15
|
+
closeButtonProps: React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
16
|
+
closeButtonRef: React.MutableRefObject<null>
|
|
17
|
+
openButtonProps: React.HTMLAttributes<HTMLDivElement>
|
|
18
|
+
openButtonRef: React.MutableRefObject<null>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type TSidePanelContext = {
|
|
22
|
+
defaultSelectedKey: string
|
|
23
|
+
overlayState: OverlayTriggerState
|
|
24
|
+
buttonProps: TButtonProps
|
|
25
|
+
overlayProps: DOMProps
|
|
26
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { get } from 'radash'
|
|
4
|
+
import type { TCustomTheme, TToken } from './interface'
|
|
5
|
+
import { useTheme } from './index'
|
|
6
|
+
|
|
7
|
+
const useThemeContext = (func?: string | null, props: TToken = {}, customTheme: TCustomTheme = null) => {
|
|
8
|
+
const theme = useTheme()
|
|
9
|
+
if (theme != null && func != null) {
|
|
10
|
+
const { brandTheme } = theme
|
|
11
|
+
const themeFunc = get(brandTheme, func)
|
|
12
|
+
if (typeof themeFunc === 'function') {
|
|
13
|
+
const returnValue = themeFunc?.(props)
|
|
14
|
+
if (typeof returnValue === 'string') {
|
|
15
|
+
return returnValue
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (!customTheme) {
|
|
20
|
+
return undefined
|
|
21
|
+
}
|
|
22
|
+
return customTheme
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default useThemeContext
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React, { useMemo } from 'react'
|
|
4
|
+
import type { TThemeProviderProps, TThemePanelContext, TDefaultTheme, TTheme } from './interface'
|
|
5
|
+
|
|
6
|
+
export function createCtxNullable<A extends Record<string, unknown> | null>() {
|
|
7
|
+
const ctx = React.createContext<A | undefined>(undefined)
|
|
8
|
+
function useCtx() {
|
|
9
|
+
const c = React.useContext(ctx)
|
|
10
|
+
|
|
11
|
+
if (c === undefined) {
|
|
12
|
+
return null
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return c
|
|
16
|
+
}
|
|
17
|
+
return [useCtx, ctx.Provider] as const // 'as const' makes TypeScript infer a tuple
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const defaultTheme: TDefaultTheme = {
|
|
21
|
+
typography: () => '',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const [useTheme, ThemeProvider] = createCtxNullable<TThemePanelContext<TTheme>>()
|
|
25
|
+
|
|
26
|
+
export function ThemeContextProvider({ children, brandTheme = defaultTheme }: TThemeProviderProps) {
|
|
27
|
+
const value = useMemo<TThemePanelContext>(() => ({ brandTheme }), [brandTheme])
|
|
28
|
+
return <ThemeProvider value={value}>{children}</ThemeProvider>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const createThemeProvider = (brandTheme: TTheme) => {
|
|
32
|
+
const ThemeProviderContext = ({ children }: { children: React.ReactNode }) => (
|
|
33
|
+
<ThemeContextProvider brandTheme={brandTheme}>{children}</ThemeContextProvider>
|
|
34
|
+
)
|
|
35
|
+
return ThemeProviderContext
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { useTheme }
|
|
39
|
+
|
|
40
|
+
export { makeTheme } from './utils'
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type React from 'react'
|
|
2
|
+
|
|
3
|
+
export type TStyleValue = false | string
|
|
4
|
+
export type TToken = Record<string, string | boolean>
|
|
5
|
+
export type TFunc = (props: TToken) => TStyleValue[] | string
|
|
6
|
+
export type TTheme = { [key: string]: TFunc | TTheme }
|
|
7
|
+
|
|
8
|
+
export type TStyle = Record<string, TStyleValue>
|
|
9
|
+
export type TCustomTheme = TStyleValue | null | undefined
|
|
10
|
+
export type TStyleCollection = Record<string, TStyle>
|
|
11
|
+
|
|
12
|
+
export type TDefaultTheme = {
|
|
13
|
+
typography: (props: TToken) => TStyleValue[] | string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type TThemeProviderProps<T = TTheme> = {
|
|
17
|
+
children: React.ReactNode
|
|
18
|
+
brandTheme?: T
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type TThemePanelContext<T = TTheme> = {
|
|
22
|
+
brandTheme: T
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ITheme {
|
|
26
|
+
defaultTokens: TToken
|
|
27
|
+
styles: TStyleCollection
|
|
28
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { createCtx } from '@okam/core-lib'
|
|
4
|
+
import { useMemo, useState } from 'react'
|
|
5
|
+
import type { TSearchListingContext, TSearchProviderProps } from './interface'
|
|
6
|
+
|
|
7
|
+
export const [useUserQueryValHook, SearchProvider] = createCtx<TSearchListingContext>()
|
|
8
|
+
|
|
9
|
+
export function SearchBarProvider(props: TSearchProviderProps) {
|
|
10
|
+
const { userQuery, children } = props
|
|
11
|
+
|
|
12
|
+
const [userVal, setUserVal] = useState(userQuery)
|
|
13
|
+
|
|
14
|
+
const value = useMemo<TSearchListingContext>(
|
|
15
|
+
() => ({ userSearchQuery: userVal, setUserSearchQuery: setUserVal }),
|
|
16
|
+
[userVal, setUserVal],
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
return <SearchProvider value={value}>{children}</SearchProvider>
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Dispatch, SetStateAction } from 'react'
|
|
2
|
+
import type React from 'react'
|
|
3
|
+
|
|
4
|
+
export type TSearchListingContext = {
|
|
5
|
+
userSearchQuery: string
|
|
6
|
+
setUserSearchQuery: Dispatch<SetStateAction<string>>
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface TSearchProviderProps {
|
|
10
|
+
children: React.ReactNode
|
|
11
|
+
userQuery: string
|
|
12
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import Button from '../../components/Button'
|
|
3
|
+
import type { TButtonProps } from '../../components/Button/interface'
|
|
4
|
+
import Lightbox from '../../components/Lightbox'
|
|
5
|
+
import type { TLightboxProps } from '../../components/Lightbox/interface'
|
|
6
|
+
|
|
7
|
+
const LightboxControlledState = (props: TLightboxProps) => {
|
|
8
|
+
const { children, ...rest } = props
|
|
9
|
+
|
|
10
|
+
const [isOpen, setOpen] = useState(false)
|
|
11
|
+
|
|
12
|
+
const closeButtonRender = (buttonProps: TButtonProps) => (
|
|
13
|
+
<Button {...buttonProps} handlePress={() => setOpen(!isOpen)}>
|
|
14
|
+
Close lightbox
|
|
15
|
+
</Button>
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<Button handlePress={() => setOpen(!isOpen)}>Open lightbox</Button>
|
|
21
|
+
<Lightbox {...rest} isOpen={isOpen} setOpen={setOpen} closeButton={closeButtonRender}>
|
|
22
|
+
{children}
|
|
23
|
+
</Lightbox>
|
|
24
|
+
</>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default LightboxControlledState
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { Item } from '@react-stately/collections'
|
|
2
|
+
import { isEmpty } from 'radash'
|
|
3
|
+
import type { ComponentType } from 'react'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
import Button, { ButtonWithForwardRef } from '../../components/Button'
|
|
6
|
+
import type { TButtonProps } from '../../components/Button/interface'
|
|
7
|
+
import MenuItems from '../../components/Menu/components/MenuItems'
|
|
8
|
+
import type { TMenuItemProps, TMenuProps, TMenuSidePanelProps } from '../../components/Menu/interface'
|
|
9
|
+
import MenuSidePanel from '../../components/Menu/MenuSidePanel'
|
|
10
|
+
import Typography from '../../components/Typography'
|
|
11
|
+
import { MenuContextProvider, useMenu } from '../../providers/Menu'
|
|
12
|
+
import { useSidePanel } from '../../providers/SidePanel'
|
|
13
|
+
import RenderWithSlide from '../../transitions/RenderWithSlide'
|
|
14
|
+
import { items } from './mock'
|
|
15
|
+
|
|
16
|
+
export type TSubMenuTab = {
|
|
17
|
+
key: string
|
|
18
|
+
title: string
|
|
19
|
+
childItems?: TMenuItemProps[] | null
|
|
20
|
+
extra: React.ReactNode | undefined
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type TSubMenuExtraData = {
|
|
24
|
+
path: string
|
|
25
|
+
data: React.ReactNode
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const SidePanelControl = () => {
|
|
29
|
+
const { buttonProps } = useSidePanel()
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<ButtonWithForwardRef {...buttonProps?.openButtonProps} ref={buttonProps?.openButtonRef}>
|
|
33
|
+
Open
|
|
34
|
+
</ButtonWithForwardRef>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const BackBtn = ({ label }: TButtonProps & { label?: string }) => {
|
|
39
|
+
const { tabState, defaultSelectedKey } = useMenu()
|
|
40
|
+
const { setSelectedKey } = tabState
|
|
41
|
+
|
|
42
|
+
return <Button handlePress={() => setSelectedKey?.(defaultSelectedKey)}>{label}</Button>
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const CloseBtn = () => {
|
|
46
|
+
const { tabState, defaultSelectedKey } = useMenu()
|
|
47
|
+
const { buttonProps, overlayState } = useSidePanel()
|
|
48
|
+
const { closeButtonProps, closeButtonRef } = buttonProps
|
|
49
|
+
const { isOpen } = overlayState
|
|
50
|
+
|
|
51
|
+
const handlePress = (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
52
|
+
tabState?.setSelectedKey?.(defaultSelectedKey)
|
|
53
|
+
closeButtonProps?.onClick?.(e)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const updatedCloseButtonProps = { ...closeButtonProps, onClick: handlePress }
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
isOpen && (
|
|
60
|
+
<ButtonWithForwardRef type="button" {...updatedCloseButtonProps} ref={closeButtonRef} aria-label="CloseButton">
|
|
61
|
+
Close
|
|
62
|
+
</ButtonWithForwardRef>
|
|
63
|
+
)
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const ShowTab = ({ children }: { children: React.ReactNode }) => (
|
|
68
|
+
<div>
|
|
69
|
+
<div>
|
|
70
|
+
<BackBtn label="SHOWS" />
|
|
71
|
+
<CloseBtn />
|
|
72
|
+
</div>
|
|
73
|
+
<Typography>{children}</Typography>
|
|
74
|
+
</div>
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
export const CloseBtnRender = () => <CloseBtn />
|
|
78
|
+
|
|
79
|
+
export const MenuFactory = ({
|
|
80
|
+
menuItems,
|
|
81
|
+
tabs,
|
|
82
|
+
id,
|
|
83
|
+
defaultIsOpen,
|
|
84
|
+
openBtn = null,
|
|
85
|
+
MenuComponent,
|
|
86
|
+
}: {
|
|
87
|
+
tabs: JSX.Element[]
|
|
88
|
+
id: string
|
|
89
|
+
menuItems?: TMenuItemProps[] | null
|
|
90
|
+
defaultIsOpen?: boolean
|
|
91
|
+
openBtn?: React.ReactNode | null
|
|
92
|
+
MenuComponent: ComponentType<TMenuProps | TMenuSidePanelProps>
|
|
93
|
+
}) => {
|
|
94
|
+
const { tabState, defaultSelectedKey } = useMenu()
|
|
95
|
+
|
|
96
|
+
const handleCloseMenu = () => {
|
|
97
|
+
if (defaultSelectedKey != null) {
|
|
98
|
+
tabState?.setSelectedKey?.(defaultSelectedKey)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<MenuContextProvider
|
|
104
|
+
defaultIsOpen={defaultIsOpen}
|
|
105
|
+
closeBtn={CloseBtnRender}
|
|
106
|
+
openBtn={SidePanelControl}
|
|
107
|
+
defaultSelectedKey="empty"
|
|
108
|
+
onCloseCallback={handleCloseMenu}
|
|
109
|
+
tabs={tabs}
|
|
110
|
+
>
|
|
111
|
+
<>
|
|
112
|
+
{openBtn}
|
|
113
|
+
<MenuComponent id={id} TransitionAnimation={RenderWithSlide as (props: unknown) => JSX.Element}>
|
|
114
|
+
<MenuItems menuItems={menuItems} />
|
|
115
|
+
</MenuComponent>
|
|
116
|
+
</>
|
|
117
|
+
</MenuContextProvider>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const menuTabs = (
|
|
122
|
+
menu: TMenuItemProps[],
|
|
123
|
+
extras?: TSubMenuExtraData[],
|
|
124
|
+
MenuComponent: ComponentType<TMenuProps> = MenuSidePanel,
|
|
125
|
+
) => {
|
|
126
|
+
const tabs: TSubMenuTab[] = [{ key: 'empty', title: 'empty', childItems: null, extra: null }]
|
|
127
|
+
|
|
128
|
+
const recursiveFilter = (x: TMenuItemProps) => {
|
|
129
|
+
if (x.path?.startsWith('#')) {
|
|
130
|
+
const extra = extras?.find((f) => x.path === f.path)
|
|
131
|
+
tabs.push({ key: x.path.substring(1), title: x.label ?? x.path, childItems: x.childItems, extra: extra?.data })
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
menu.forEach(recursiveFilter)
|
|
136
|
+
|
|
137
|
+
return tabs.map(({ childItems, key, title }) => {
|
|
138
|
+
const childTabs = isEmpty(childItems) ? undefined : menuTabs(childItems ?? [], extras, MenuComponent)
|
|
139
|
+
return (
|
|
140
|
+
<Item key={key} title={title}>
|
|
141
|
+
<MenuFactory
|
|
142
|
+
defaultIsOpen
|
|
143
|
+
id={`menu-${title}`}
|
|
144
|
+
tabs={childTabs ?? []}
|
|
145
|
+
menuItems={childItems}
|
|
146
|
+
MenuComponent={MenuComponent}
|
|
147
|
+
/>
|
|
148
|
+
</Item>
|
|
149
|
+
)
|
|
150
|
+
})
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const MenuContent = () => {
|
|
154
|
+
const extras: TSubMenuExtraData[] = [
|
|
155
|
+
{
|
|
156
|
+
path: '#shows',
|
|
157
|
+
data: (
|
|
158
|
+
<ShowTab>
|
|
159
|
+
<div>Hello World</div>
|
|
160
|
+
</ShowTab>
|
|
161
|
+
),
|
|
162
|
+
},
|
|
163
|
+
]
|
|
164
|
+
const tabs = menuTabs(items, extras)
|
|
165
|
+
|
|
166
|
+
return (
|
|
167
|
+
<MenuFactory
|
|
168
|
+
MenuComponent={MenuSidePanel}
|
|
169
|
+
openBtn={<SidePanelControl />}
|
|
170
|
+
id="main-menu"
|
|
171
|
+
tabs={tabs}
|
|
172
|
+
menuItems={items}
|
|
173
|
+
/>
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export default MenuContent
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Menu from '../../components/Menu/Menu'
|
|
2
|
+
import type { TSubMenuExtraData } from './Menu'
|
|
3
|
+
import { ShowTab, menuTabs, MenuFactory, SidePanelControl } from './Menu'
|
|
4
|
+
import { items } from './mock'
|
|
5
|
+
|
|
6
|
+
const MenuContent = () => {
|
|
7
|
+
const extras: TSubMenuExtraData[] = [
|
|
8
|
+
{
|
|
9
|
+
path: '#shows',
|
|
10
|
+
data: (
|
|
11
|
+
<ShowTab>
|
|
12
|
+
<div>Hello World</div>
|
|
13
|
+
</ShowTab>
|
|
14
|
+
),
|
|
15
|
+
},
|
|
16
|
+
]
|
|
17
|
+
const tabs = menuTabs(items, extras, Menu)
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<MenuFactory MenuComponent={Menu} openBtn={<SidePanelControl />} id="main-menu" tabs={tabs} menuItems={items} />
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default MenuContent
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { TMenuItemProps } from '../../components/Menu/interface'
|
|
2
|
+
|
|
3
|
+
export const items: TMenuItemProps[] = [
|
|
4
|
+
{
|
|
5
|
+
id: '1',
|
|
6
|
+
target: null,
|
|
7
|
+
path: '#shows',
|
|
8
|
+
label: 'Open 2nd Level Menu Label',
|
|
9
|
+
children: <div>Open 2nd Level Menu</div>,
|
|
10
|
+
ariaLabel: 'Open 2nd Level Menu Aria',
|
|
11
|
+
childItems: [
|
|
12
|
+
{
|
|
13
|
+
id: 'abc',
|
|
14
|
+
target: null,
|
|
15
|
+
path: '/',
|
|
16
|
+
label: '2nd level link',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: '7',
|
|
20
|
+
target: null,
|
|
21
|
+
path: '#subPanel1',
|
|
22
|
+
label: 'Open 3rd Level Menu',
|
|
23
|
+
childItems: [
|
|
24
|
+
{
|
|
25
|
+
id: '8',
|
|
26
|
+
target: null,
|
|
27
|
+
path: '/',
|
|
28
|
+
label: '3rd level link',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: '9',
|
|
32
|
+
target: null,
|
|
33
|
+
path: '#subPanel2',
|
|
34
|
+
label: 'Open 4th Level Menu',
|
|
35
|
+
childItems: [
|
|
36
|
+
{
|
|
37
|
+
id: '10',
|
|
38
|
+
target: null,
|
|
39
|
+
path: '/',
|
|
40
|
+
label: '4th level link',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: '8',
|
|
50
|
+
target: null,
|
|
51
|
+
path: '#brands',
|
|
52
|
+
label: 'Brands',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: '2',
|
|
56
|
+
target: null,
|
|
57
|
+
path: '/',
|
|
58
|
+
label: 'Today’s Lede Stories',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: '3',
|
|
62
|
+
target: null,
|
|
63
|
+
path: '/',
|
|
64
|
+
label: 'News',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: '4',
|
|
68
|
+
target: null,
|
|
69
|
+
path: '/',
|
|
70
|
+
label: 'Trailers and screeners',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: '5',
|
|
74
|
+
target: null,
|
|
75
|
+
path: '/',
|
|
76
|
+
label: 'Team',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: '6',
|
|
80
|
+
target: null,
|
|
81
|
+
path: '#search',
|
|
82
|
+
label: 'Search the lede',
|
|
83
|
+
},
|
|
84
|
+
]
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import Select from '../../components/fields/Select/Select'
|
|
3
|
+
import type { TSelectProps } from '../../components/fields/Select/Select.interface'
|
|
4
|
+
|
|
5
|
+
const SelectContent = ({
|
|
6
|
+
disabled = false,
|
|
7
|
+
isError = false,
|
|
8
|
+
errorMessage,
|
|
9
|
+
id,
|
|
10
|
+
label,
|
|
11
|
+
name,
|
|
12
|
+
placeholderLabel,
|
|
13
|
+
...rest
|
|
14
|
+
}: TSelectProps) => {
|
|
15
|
+
const [value, setValue] = useState<string>()
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<button type="button" onClick={() => setValue('1')}>
|
|
20
|
+
1
|
|
21
|
+
</button>
|
|
22
|
+
<button type="button" onClick={() => setValue('2')}>
|
|
23
|
+
2
|
|
24
|
+
</button>
|
|
25
|
+
<button type="button" onClick={() => setValue('3')}>
|
|
26
|
+
3
|
|
27
|
+
</button>
|
|
28
|
+
<button type="button" onClick={() => setValue('4')}>
|
|
29
|
+
4
|
|
30
|
+
</button>
|
|
31
|
+
<Select
|
|
32
|
+
id={id}
|
|
33
|
+
label={label}
|
|
34
|
+
name={name}
|
|
35
|
+
placeholderLabel={placeholderLabel}
|
|
36
|
+
disabled={disabled}
|
|
37
|
+
isError={isError}
|
|
38
|
+
errorMessage={errorMessage}
|
|
39
|
+
{...rest}
|
|
40
|
+
onSelectionChange={(key) => {
|
|
41
|
+
setValue(key.toString())
|
|
42
|
+
// eslint-disable-next-line no-console
|
|
43
|
+
console.log('selection changed')
|
|
44
|
+
}}
|
|
45
|
+
value={value}
|
|
46
|
+
options={[
|
|
47
|
+
{ key: '1', value: 'Option 1' },
|
|
48
|
+
{ key: '2', value: 'Option 2' },
|
|
49
|
+
{ key: '3', value: 'Option 3' },
|
|
50
|
+
{ key: '4', value: 'Option 4' },
|
|
51
|
+
]}
|
|
52
|
+
/>
|
|
53
|
+
</>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default SelectContent
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useCopyToClipboard } from 'usehooks-ts'
|
|
2
|
+
import LinkedIn from '../../components/icons/LinkedIn'
|
|
3
|
+
import ShareButton from '../../components/ShareButton'
|
|
4
|
+
import type { TShareButtonProps } from '../../components/ShareButton/interface'
|
|
5
|
+
import Typography from '../../components/Typography'
|
|
6
|
+
|
|
7
|
+
const ShareButtonExample = (props: TShareButtonProps) => {
|
|
8
|
+
const { tokens } = props
|
|
9
|
+
const [value, copy] = useCopyToClipboard()
|
|
10
|
+
return (
|
|
11
|
+
<>
|
|
12
|
+
<ShareButton
|
|
13
|
+
id="share"
|
|
14
|
+
ariaLabel="Share"
|
|
15
|
+
tokens={tokens}
|
|
16
|
+
sharingLinksList={[
|
|
17
|
+
{
|
|
18
|
+
ariaLabel: 'Share on Facebook',
|
|
19
|
+
icon: 'FacebookRounded',
|
|
20
|
+
key: 'facebook',
|
|
21
|
+
href: '#',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
ariaLabel: 'Share on Twitter',
|
|
25
|
+
icon: 'Twitter',
|
|
26
|
+
key: 'twitter',
|
|
27
|
+
href: '#',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
ariaLabel: 'Share on Instagram',
|
|
31
|
+
icon: 'Instagram',
|
|
32
|
+
key: 'instagram',
|
|
33
|
+
href: '#',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
ariaLabel: 'Share on YouTube',
|
|
37
|
+
icon: 'YouTube',
|
|
38
|
+
key: 'youtube',
|
|
39
|
+
href: '#',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
ariaLabel: 'Share on X',
|
|
43
|
+
icon: 'X',
|
|
44
|
+
key: 'x',
|
|
45
|
+
href: '#',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
ariaLabel: 'Share on LinkedIn',
|
|
49
|
+
icon: <LinkedIn />,
|
|
50
|
+
key: 'linkedin',
|
|
51
|
+
href: '#',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
ariaLabel: 'Copy to clipboard',
|
|
55
|
+
icon: 'ArrowDown',
|
|
56
|
+
key: 'copy',
|
|
57
|
+
onClick: (linkKey) => copy(linkKey),
|
|
58
|
+
},
|
|
59
|
+
]}
|
|
60
|
+
/>
|
|
61
|
+
<Typography>{value ? `Copied value: ${value}` : 'Nothing copied yet!'}</Typography>
|
|
62
|
+
</>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default ShareButtonExample
|
package/src/tailwind.css
ADDED