@mindlogic-ai/logician-ui 2.0.0-alpha.0
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/LICENSE +21 -0
- package/README.md +234 -0
- package/USAGE.md +299 -0
- package/dist/Markdown-2D5K42BY.js +16 -0
- package/dist/Markdown-2D5K42BY.js.map +1 -0
- package/dist/Markdown-AZBXO5ZP.css +29 -0
- package/dist/Markdown-AZBXO5ZP.css.map +1 -0
- package/dist/Markdown-RJJEQN4R.mjs +3 -0
- package/dist/Markdown-RJJEQN4R.mjs.map +1 -0
- package/dist/analytics-GNSHP7X3.svg +1 -0
- package/dist/bulb-24SQINQB.svg +1 -0
- package/dist/chat-TLRFEUAS.svg +1 -0
- package/dist/chunk-5FHXD7KR.js +1735 -0
- package/dist/chunk-5FHXD7KR.js.map +1 -0
- package/dist/chunk-WSOHBA2C.mjs +1693 -0
- package/dist/chunk-WSOHBA2C.mjs.map +1 -0
- package/dist/edit-RWL72JNM.svg +1 -0
- package/dist/face-55KPDCH4.svg +1 -0
- package/dist/filled-analytics-RBC7KWND.svg +1 -0
- package/dist/filled-bulb-RC7E2WSM.svg +1 -0
- package/dist/filled-chat-A6J44Q7A.svg +1 -0
- package/dist/filled-edit-NKKWFSTW.svg +1 -0
- package/dist/filled-face-UML5C3LB.svg +1 -0
- package/dist/filled-layout-HBVCSDFO.svg +1 -0
- package/dist/index.css +51 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +964 -0
- package/dist/index.d.ts +964 -0
- package/dist/index.js +5600 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +5401 -0
- package/dist/index.mjs.map +1 -0
- package/dist/language-VBJ24OPV.svg +1 -0
- package/dist/layout-NDDSWNNV.svg +1 -0
- package/dist/pending-NF7NSBYO.svg +1 -0
- package/dist/receipt-MNLQIFCO.svg +1 -0
- package/dist/sparkles-EOEGVL6G.svg +1 -0
- package/dist/store-3RQPBJWG.svg +1 -0
- package/dist/store_active-SAOAGVKC.svg +1 -0
- package/dist/studio-LYPUIEFA.svg +1 -0
- package/dist/studio_active-BC6O66OI.svg +1 -0
- package/dist/vertical-ellipsis-3G4WEOCW.svg +1 -0
- package/package.json +138 -0
- package/src/components/Accordion/Accordion.stories.tsx +41 -0
- package/src/components/Accordion/Accordion.tsx +14 -0
- package/src/components/Accordion/AccordionButton.tsx +40 -0
- package/src/components/Accordion/AccordionItem.tsx +17 -0
- package/src/components/Accordion/index.ts +4 -0
- package/src/components/Alert/Alert.stories.tsx +38 -0
- package/src/components/Alert/Alert.styles.ts +19 -0
- package/src/components/Alert/Alert.tsx +41 -0
- package/src/components/Alert/Alert.types.ts +5 -0
- package/src/components/Alert/index.ts +1 -0
- package/src/components/AutowidthInput/AutowidthInput.stories.tsx +23 -0
- package/src/components/AutowidthInput/AutowidthInput.tsx +47 -0
- package/src/components/AutowidthInput/index.ts +1 -0
- package/src/components/Avatar/Avatar.stories.tsx +23 -0
- package/src/components/Avatar/Avatar.tsx +19 -0
- package/src/components/Avatar/index.tsx +1 -0
- package/src/components/Badge/Badge.stories.tsx +23 -0
- package/src/components/Badge/Badge.styles.ts +11 -0
- package/src/components/Badge/Badge.tsx +26 -0
- package/src/components/Badge/index.ts +2 -0
- package/src/components/Banner/Banner.stories.tsx +37 -0
- package/src/components/Banner/Banner.styles.ts +79 -0
- package/src/components/Banner/Banner.tsx +68 -0
- package/src/components/Banner/Banner.types.ts +6 -0
- package/src/components/Banner/index.ts +2 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +14 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +19 -0
- package/src/components/Breadcrumb/Breadcrumb.types.ts +3 -0
- package/src/components/Breadcrumb/BreadcrumbItem/BreadcrumbItem.tsx +12 -0
- package/src/components/Breadcrumb/BreadcrumbItem/BreadcrumbItem.types.ts +3 -0
- package/src/components/Breadcrumb/BreadcrumbItem/index.ts +2 -0
- package/src/components/Breadcrumb/BreadcrumbLink/BreadcrumbLink.tsx +30 -0
- package/src/components/Breadcrumb/BreadcrumbLink/BreadcrumbLink.types.ts +3 -0
- package/src/components/Breadcrumb/BreadcrumbLink/index.ts +2 -0
- package/src/components/Breadcrumb/index.ts +3 -0
- package/src/components/Button/Button.stories.tsx +52 -0
- package/src/components/Button/Button.styles.ts +59 -0
- package/src/components/Button/Button.tsx +43 -0
- package/src/components/Button/Button.types.ts +13 -0
- package/src/components/Button/index.tsx +3 -0
- package/src/components/Card/Card.stories.tsx +24 -0
- package/src/components/Card/Card.styles.ts +30 -0
- package/src/components/Card/Card.tsx +29 -0
- package/src/components/Card/Card.types.ts +8 -0
- package/src/components/Card/index.ts +2 -0
- package/src/components/Carousel/Carousel.stories.tsx +159 -0
- package/src/components/Carousel/Carousel.tsx +160 -0
- package/src/components/Carousel/Carousel.types.ts +22 -0
- package/src/components/Carousel/index.ts +1 -0
- package/src/components/CarouselModal/CarouselModal.stories.tsx +53 -0
- package/src/components/CarouselModal/CarouselModal.tsx +106 -0
- package/src/components/CarouselModal/CarouselModal.types.ts +16 -0
- package/src/components/CarouselModal/index.ts +2 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +16 -0
- package/src/components/Checkbox/Checkbox.tsx +29 -0
- package/src/components/Checkbox/Checkbox.types.ts +3 -0
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/Chip/Chip.stories.tsx +44 -0
- package/src/components/Chip/Chip.styles.ts +114 -0
- package/src/components/Chip/Chip.tsx +23 -0
- package/src/components/Chip/Chip.types.ts +14 -0
- package/src/components/Chip/index.ts +2 -0
- package/src/components/ChipButton/Chip.types.ts +4 -0
- package/src/components/ChipButton/ChipButton.tsx +25 -0
- package/src/components/ChipButton/index.ts +1 -0
- package/src/components/Code/Code.stories.tsx +28 -0
- package/src/components/Code/Code.tsx +160 -0
- package/src/components/Code/Code.types.ts +40 -0
- package/src/components/Code/_components/CopyButton.tsx +48 -0
- package/src/components/Code/index.ts +1 -0
- package/src/components/CodeTabs/CodeTabs.stories.tsx +51 -0
- package/src/components/CodeTabs/CodeTabs.tsx +98 -0
- package/src/components/CodeTabs/CodeTabs.types.ts +17 -0
- package/src/components/CodeTabs/index.ts +1 -0
- package/src/components/Container/Container.stories.tsx +28 -0
- package/src/components/Container/Container.tsx +21 -0
- package/src/components/Container/index.ts +1 -0
- package/src/components/Container/useContainerSize.ts +47 -0
- package/src/components/CopyableCode/CopyableCode.stories.tsx +26 -0
- package/src/components/CopyableCode/CopyableCode.tsx +58 -0
- package/src/components/CopyableCode/CopyableCode.types.ts +7 -0
- package/src/components/CopyableCode/index.ts +2 -0
- package/src/components/CrossPageToasts/CrossPageToasts.tsx +33 -0
- package/src/components/CrossPageToasts/index.ts +1 -0
- package/src/components/DataField/DataField.stories.tsx +61 -0
- package/src/components/DataField/DataField.styles.ts +33 -0
- package/src/components/DataField/DataField.tsx +141 -0
- package/src/components/DataField/DataField.types.ts +18 -0
- package/src/components/DataField/index.ts +1 -0
- package/src/components/DatePicker/RangeDatePicker.stories.tsx +45 -0
- package/src/components/DatePicker/RangeDatePicker.tsx +74 -0
- package/src/components/DatePicker/SingleDatePicker.stories.tsx +31 -0
- package/src/components/DatePicker/SingleDatePicker.tsx +72 -0
- package/src/components/DatePicker/index.ts +2 -0
- package/src/components/FileInput/FileInput.stories.tsx +28 -0
- package/src/components/FileInput/FileInput.tsx +117 -0
- package/src/components/FileInput/FileInput.types.ts +14 -0
- package/src/components/FileInput/index.ts +2 -0
- package/src/components/FileItem/FileItem.stories.tsx +27 -0
- package/src/components/FileItem/FileItem.tsx +134 -0
- package/src/components/FileItem/FileItem.types.ts +11 -0
- package/src/components/FileItem/index.ts +1 -0
- package/src/components/FileList/FileList.stories.tsx +65 -0
- package/src/components/FileList/FileList.tsx +97 -0
- package/src/components/FileList/FileList.types.ts +18 -0
- package/src/components/FileList/index.tsx +1 -0
- package/src/components/FormControl/FormControl.stories.tsx +16 -0
- package/src/components/FormControl/FormControl.tsx +12 -0
- package/src/components/FormControl/FormControl.types.ts +3 -0
- package/src/components/FormControl/index.ts +2 -0
- package/src/components/FormLabel/FormLabel.tsx +5 -0
- package/src/components/FormLabel/index.ts +1 -0
- package/src/components/GuideCue/GuideCue.stories.tsx +57 -0
- package/src/components/GuideCue/GuideCue.tsx +231 -0
- package/src/components/GuideCue/GuideCueContext.tsx +70 -0
- package/src/components/GuideCue/index.ts +2 -0
- package/src/components/Icon/Icon.stories.tsx +77 -0
- package/src/components/Icon/Icon.styles.ts +6 -0
- package/src/components/Icon/Icon.tsx +73 -0
- package/src/components/Icon/Icon.types.ts +10 -0
- package/src/components/Icon/IconMap.ts +290 -0
- package/src/components/Icon/icons/analytics.svg +1 -0
- package/src/components/Icon/icons/bulb.svg +1 -0
- package/src/components/Icon/icons/chat.svg +1 -0
- package/src/components/Icon/icons/edit.svg +1 -0
- package/src/components/Icon/icons/face.svg +1 -0
- package/src/components/Icon/icons/filled-analytics.svg +1 -0
- package/src/components/Icon/icons/filled-bulb.svg +1 -0
- package/src/components/Icon/icons/filled-chat.svg +1 -0
- package/src/components/Icon/icons/filled-edit.svg +1 -0
- package/src/components/Icon/icons/filled-face.svg +1 -0
- package/src/components/Icon/icons/filled-layout.svg +1 -0
- package/src/components/Icon/icons/language.svg +1 -0
- package/src/components/Icon/icons/layout.svg +1 -0
- package/src/components/Icon/icons/pending.svg +1 -0
- package/src/components/Icon/icons/receipt.svg +1 -0
- package/src/components/Icon/icons/sparkles.svg +1 -0
- package/src/components/Icon/icons/store.svg +1 -0
- package/src/components/Icon/icons/store_active.svg +1 -0
- package/src/components/Icon/icons/studio.svg +1 -0
- package/src/components/Icon/icons/studio_active.svg +1 -0
- package/src/components/Icon/icons/vertical-ellipsis.svg +1 -0
- package/src/components/Icon/index.tsx +3 -0
- package/src/components/IconButton/IconButton.stories.tsx +51 -0
- package/src/components/IconButton/IconButton.styles.ts +52 -0
- package/src/components/IconButton/IconButton.tsx +36 -0
- package/src/components/IconButton/IconButton.types.ts +12 -0
- package/src/components/IconButton/index.tsx +1 -0
- package/src/components/InfoSprinkle/InfoSprinkle.stories.tsx +25 -0
- package/src/components/InfoSprinkle/InfoSprinkle.tsx +48 -0
- package/src/components/InfoSprinkle/index.ts +1 -0
- package/src/components/InlineCode/InlineCode.tsx +18 -0
- package/src/components/InlineCode/index.ts +1 -0
- package/src/components/Input/Input.stories.tsx +55 -0
- package/src/components/Input/Input.tsx +358 -0
- package/src/components/Input/Input.types.ts +19 -0
- package/src/components/Input/index.tsx +2 -0
- package/src/components/LineGraph/LineGraph.stories.tsx +98 -0
- package/src/components/LineGraph/LineGraph.tsx +88 -0
- package/src/components/LineGraph/LineGraph.types.ts +41 -0
- package/src/components/LineGraph/index.ts +1 -0
- package/src/components/Link/Link.styles.ts +13 -0
- package/src/components/Link/Link.tsx +93 -0
- package/src/components/Link/index.ts +1 -0
- package/src/components/Loaders/PageLoader.stories.tsx +29 -0
- package/src/components/Loaders/PageLoader.tsx +30 -0
- package/src/components/Loaders/SectionLoader.stories.tsx +26 -0
- package/src/components/Loaders/SectionLoader.tsx +30 -0
- package/src/components/Loaders/index.ts +1 -0
- package/src/components/MDXEditor/MDXEditor.css +21 -0
- package/src/components/MDXEditor/MDXEditor.stories.tsx +45 -0
- package/src/components/MDXEditor/MDXEditor.tsx +189 -0
- package/src/components/MDXEditor/MDXEditor.types.ts +6 -0
- package/src/components/MDXEditor/index.ts +1 -0
- package/src/components/Markdown/Markdown.module.css +30 -0
- package/src/components/Markdown/Markdown.tsx +133 -0
- package/src/components/Markdown/Markdown.types.ts +5 -0
- package/src/components/Markdown/index.ts +2 -0
- package/src/components/Masonry/Masonry.stories.tsx +288 -0
- package/src/components/Masonry/Masonry.tsx +187 -0
- package/src/components/Masonry/Masonry.types.ts +18 -0
- package/src/components/Masonry/index.ts +2 -0
- package/src/components/MaxLengthIndicator/MaxLengthIndicator.stories.tsx +26 -0
- package/src/components/MaxLengthIndicator/MaxLengthIndicator.tsx +25 -0
- package/src/components/MaxLengthIndicator/index.tsx +1 -0
- package/src/components/Menu/Menu.stories.tsx +186 -0
- package/src/components/Menu/MenuButton.tsx +8 -0
- package/src/components/Menu/MenuButton.types.ts +23 -0
- package/src/components/Menu/MenuItem.tsx +35 -0
- package/src/components/Menu/MenuItem.types.ts +13 -0
- package/src/components/Menu/MenuList.tsx +19 -0
- package/src/components/Menu/index.ts +7 -0
- package/src/components/Modal/Modal.stories.tsx +83 -0
- package/src/components/Modal/Modal.styles.ts +14 -0
- package/src/components/Modal/Modal.tsx +14 -0
- package/src/components/Modal/Modal.types.ts +3 -0
- package/src/components/Modal/ModalBody.tsx +9 -0
- package/src/components/Modal/ModalCloseButton.tsx +18 -0
- package/src/components/Modal/ModalContent/ModalContent.tsx +8 -0
- package/src/components/Modal/ModalContent/ModalContent.types.ts +3 -0
- package/src/components/Modal/ModalContent/index.ts +1 -0
- package/src/components/Modal/ModalFooter/ModalFooter.module.css +3 -0
- package/src/components/Modal/ModalFooter/ModalFooter.tsx +20 -0
- package/src/components/Modal/ModalFooter/index.ts +1 -0
- package/src/components/Modal/ModalHeader.tsx +9 -0
- package/src/components/Modal/ModalOverlay.tsx +9 -0
- package/src/components/Modal/index.tsx +8 -0
- package/src/components/MonthRangePicker/MonthButton/MonthButton.tsx +105 -0
- package/src/components/MonthRangePicker/MonthButton/MonthButton.types.ts +42 -0
- package/src/components/MonthRangePicker/MonthButton/index.ts +2 -0
- package/src/components/MonthRangePicker/MonthRangePicker.stories.tsx +164 -0
- package/src/components/MonthRangePicker/MonthRangePicker.tsx +274 -0
- package/src/components/MonthRangePicker/MonthRangePicker.types.ts +38 -0
- package/src/components/MonthRangePicker/_utils/hasEnabledMonthsInYear.ts +15 -0
- package/src/components/MonthRangePicker/_utils/index.ts +6 -0
- package/src/components/MonthRangePicker/_utils/isMonthDisabled.ts +20 -0
- package/src/components/MonthRangePicker/_utils/isMonthInPreviewRange.ts +32 -0
- package/src/components/MonthRangePicker/_utils/isMonthInRange.ts +17 -0
- package/src/components/MonthRangePicker/_utils/isMonthSelected.ts +19 -0
- package/src/components/MonthRangePicker/_utils/isSelectionStart.ts +12 -0
- package/src/components/MonthRangePicker/constants.ts +63 -0
- package/src/components/MonthRangePicker/index.ts +2 -0
- package/src/components/Pagination/Pagination.stories.tsx +51 -0
- package/src/components/Pagination/Pagination.tsx +150 -0
- package/src/components/Pagination/Pagination.types.ts +12 -0
- package/src/components/Pagination/index.tsx +1 -0
- package/src/components/PasswordInput/PasswordInput.stories.tsx +16 -0
- package/src/components/PasswordInput/PasswordInput.tsx +42 -0
- package/src/components/PasswordInput/PasswordInput.types.ts +11 -0
- package/src/components/PasswordInput/index.ts +1 -0
- package/src/components/PinInput/PinInput.stories.tsx +26 -0
- package/src/components/PinInput/PinInput.tsx +53 -0
- package/src/components/PinInput/PinInput.types.ts +27 -0
- package/src/components/PinInput/index.tsx +2 -0
- package/src/components/ProgressBar/ProgressBar.stories.tsx +18 -0
- package/src/components/ProgressBar/ProgressBar.styles.ts +4 -0
- package/src/components/ProgressBar/ProgressBar.tsx +27 -0
- package/src/components/ProgressBar/ProgressBar.types.ts +4 -0
- package/src/components/ProgressBar/index.ts +1 -0
- package/src/components/RadialProgress/RadialProgress.stories.tsx +272 -0
- package/src/components/RadialProgress/RadialProgress.tsx +232 -0
- package/src/components/RadialProgress/RadialProgress.types.ts +27 -0
- package/src/components/RadialProgress/index.ts +2 -0
- package/src/components/Radio/Radio.stories.tsx +226 -0
- package/src/components/Radio/Radio.tsx +35 -0
- package/src/components/Radio/Radio.types.ts +21 -0
- package/src/components/Radio/RadioGroup.tsx +26 -0
- package/src/components/Radio/index.ts +3 -0
- package/src/components/SeeMoreButton/SeeMoreButton.stories.tsx +48 -0
- package/src/components/SeeMoreButton/SeeMoreButton.styles.ts +11 -0
- package/src/components/SeeMoreButton/SeeMoreButton.tsx +34 -0
- package/src/components/SeeMoreButton/SeeMoreButton.types.ts +6 -0
- package/src/components/SeeMoreButton/index.tsx +1 -0
- package/src/components/SegmentedControl/SegmentedControl.stories.tsx +96 -0
- package/src/components/SegmentedControl/SegmentedControl.styles.ts +28 -0
- package/src/components/SegmentedControl/SegmentedControl.tsx +89 -0
- package/src/components/SegmentedControl/SegmentedControl.types.ts +15 -0
- package/src/components/SegmentedControl/index.ts +2 -0
- package/src/components/SegmentedProgressBar/ProgressSegment.tsx +18 -0
- package/src/components/SegmentedProgressBar/SegmentedProgressBar.stories.tsx +228 -0
- package/src/components/SegmentedProgressBar/SegmentedProgressBar.tsx +25 -0
- package/src/components/SegmentedProgressBar/SegmentedProgressBar.types.ts +11 -0
- package/src/components/SegmentedProgressBar/SegmentedProgressBarContext.tsx +24 -0
- package/src/components/SegmentedProgressBar/index.ts +3 -0
- package/src/components/Select/MenuList/MenuList.tsx +87 -0
- package/src/components/Select/MenuList/MenuList.types.ts +21 -0
- package/src/components/Select/MenuList/VirtualizedMenuList.tsx +140 -0
- package/src/components/Select/MenuList/VirtualizedMenuListContext.tsx +35 -0
- package/src/components/Select/MenuList/index.ts +3 -0
- package/src/components/Select/Select.stories.tsx +70 -0
- package/src/components/Select/Select.styles.ts +102 -0
- package/src/components/Select/Select.tsx +204 -0
- package/src/components/Select/Select.types.ts +18 -0
- package/src/components/Select/_utils/resolveStyle.ts +21 -0
- package/src/components/Select/index.ts +1 -0
- package/src/components/Slider/Slider.stories.tsx +75 -0
- package/src/components/Slider/Slider.tsx +12 -0
- package/src/components/Slider/Slider.types.ts +3 -0
- package/src/components/Slider/SliderFilledTrack/SliderFilledTrack.tsx +14 -0
- package/src/components/Slider/SliderFilledTrack/SliderFilledTrack.types.ts +3 -0
- package/src/components/Slider/SliderFilledTrack/index.ts +2 -0
- package/src/components/Slider/SliderMark/SliderMark.tsx +12 -0
- package/src/components/Slider/SliderMark/SliderMark.types.ts +3 -0
- package/src/components/Slider/SliderMark/index.ts +2 -0
- package/src/components/Slider/SliderThumb/SliderThumb.tsx +22 -0
- package/src/components/Slider/SliderThumb/SliderThumb.types.ts +3 -0
- package/src/components/Slider/SliderThumb/index.ts +2 -0
- package/src/components/Slider/SliderTrack/SliderTrack.tsx +12 -0
- package/src/components/Slider/SliderTrack/SliderTrack.types.ts +3 -0
- package/src/components/Slider/SliderTrack/index.ts +2 -0
- package/src/components/Slider/index.ts +5 -0
- package/src/components/Spinner/Spinner.stories.tsx +16 -0
- package/src/components/Spinner/Spinner.tsx +20 -0
- package/src/components/Spinner/Spinner.types.ts +3 -0
- package/src/components/Spinner/index.ts +2 -0
- package/src/components/Switch/Switch.stories.tsx +63 -0
- package/src/components/Switch/Switch.tsx +8 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/Table/ExpandingTr/ExpandingTr.tsx +31 -0
- package/src/components/Table/ExpandingTr/ExpandingTr.types.ts +9 -0
- package/src/components/Table/ExpandingTr/index.ts +2 -0
- package/src/components/Table/Table.stories.tsx +326 -0
- package/src/components/Table/Table.styles.ts +48 -0
- package/src/components/Table/Table.tsx +9 -0
- package/src/components/Table/Table.types.ts +16 -0
- package/src/components/Table/TableContainer.tsx +55 -0
- package/src/components/Table/TableContext.tsx +187 -0
- package/src/components/Table/Tbody.tsx +12 -0
- package/src/components/Table/Td.tsx +138 -0
- package/src/components/Table/Th.tsx +154 -0
- package/src/components/Table/Thead.tsx +5 -0
- package/src/components/Table/Tr.tsx +5 -0
- package/src/components/Table/index.tsx +8 -0
- package/src/components/Tabs/Tab/Tab.styles.ts +35 -0
- package/src/components/Tabs/Tab/Tab.tsx +67 -0
- package/src/components/Tabs/Tab/index.ts +1 -0
- package/src/components/Tabs/TabList/TabList.styles.ts +11 -0
- package/src/components/Tabs/TabList/TabList.tsx +19 -0
- package/src/components/Tabs/TabList/index.ts +1 -0
- package/src/components/Tabs/TabPanel.tsx +5 -0
- package/src/components/Tabs/TabPanels.tsx +5 -0
- package/src/components/Tabs/Tabs.stories.tsx +45 -0
- package/src/components/Tabs/Tabs.tsx +65 -0
- package/src/components/Tabs/Tabs.types.ts +19 -0
- package/src/components/Tabs/TabsContext.tsx +162 -0
- package/src/components/Tabs/index.tsx +5 -0
- package/src/components/Tag/Tag.stories.tsx +28 -0
- package/src/components/Tag/Tag.styles.ts +12 -0
- package/src/components/Tag/Tag.tsx +23 -0
- package/src/components/Tag/Tag.types.ts +5 -0
- package/src/components/Tag/TagCloseButton/TagCloseButton.tsx +12 -0
- package/src/components/Tag/TagCloseButton/TagCloseButton.types.ts +3 -0
- package/src/components/Tag/TagCloseButton/index.ts +2 -0
- package/src/components/Tag/TagLabel/TagLabel.tsx +12 -0
- package/src/components/Tag/TagLabel/TagLabel.types.ts +3 -0
- package/src/components/Tag/TagLabel/index.ts +2 -0
- package/src/components/Tag/TagLeftIcon/TagLeftIcon.tsx +12 -0
- package/src/components/Tag/TagLeftIcon/TagLeftIcon.types.ts +3 -0
- package/src/components/Tag/TagLeftIcon/index.ts +2 -0
- package/src/components/Tag/TagRightIcon/TagRightIcon.tsx +12 -0
- package/src/components/Tag/TagRightIcon/TagRightIcon.types.ts +3 -0
- package/src/components/Tag/TagRightIcon/index.ts +2 -0
- package/src/components/Tag/index.ts +5 -0
- package/src/components/Textarea/Textarea.tsx +56 -0
- package/src/components/Textarea/adjustHeight.tsx +9 -0
- package/src/components/Textarea/index.ts +1 -0
- package/src/components/Toast/Toast.stories.tsx +49 -0
- package/src/components/Toast/Toast.styles.ts +19 -0
- package/src/components/Toast/Toast.tsx +38 -0
- package/src/components/Toast/Toast.types.ts +22 -0
- package/src/components/Toast/ToastIcon/ToastIcon.tsx +26 -0
- package/src/components/Toast/ToastIcon/index.ts +0 -0
- package/src/components/Toast/index.ts +2 -0
- package/src/components/Toast/useToast.tsx +65 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +97 -0
- package/src/components/Tooltip/Tooltip.tsx +22 -0
- package/src/components/Tooltip/Tooltip.types.ts +3 -0
- package/src/components/Tooltip/index.ts +2 -0
- package/src/components/Typography/H1.tsx +17 -0
- package/src/components/Typography/H2.tsx +17 -0
- package/src/components/Typography/H3.tsx +17 -0
- package/src/components/Typography/H4.tsx +17 -0
- package/src/components/Typography/H5.tsx +17 -0
- package/src/components/Typography/Link.tsx +49 -0
- package/src/components/Typography/Subtext.tsx +17 -0
- package/src/components/Typography/Subtitle.tsx +18 -0
- package/src/components/Typography/Text.tsx +22 -0
- package/src/components/Typography/Typography.stories.tsx +54 -0
- package/src/components/Typography/Typography.types.ts +3 -0
- package/src/components/Typography/index.ts +26 -0
- package/src/components/UrlInput/UrlInput.stories.tsx +66 -0
- package/src/components/UrlInput/UrlInput.tsx +47 -0
- package/src/components/UrlInput/index.tsx +1 -0
- package/src/hooks/useLocale.ts +11 -0
- package/src/hooks/useTranslate.ts +57 -0
- package/src/index.ts +96 -0
- package/src/theme/Palette.stories.tsx +171 -0
- package/src/theme/colors.ts +64 -0
- package/src/theme/font.ts +23 -0
- package/src/theme/global.ts +30 -0
- package/src/theme/index.ts +49 -0
- package/src/translations/Defaults.translations.json +100 -0
- package/src/types/css-modules.d.ts +0 -0
- package/src/types/svg.d.ts +15 -0
- package/src/utils/findKeyByValue.ts +17 -0
- package/src/utils/formatDateByLocale.ts +36 -0
- package/src/utils/formatFileSize.ts +14 -0
- package/src/utils/formatNumber.ts +29 -0
- package/src/utils/formatTextForMarkdown.ts +3 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// src/components/Carousel.stories.tsx
|
|
2
|
+
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import {
|
|
5
|
+
Box,
|
|
6
|
+
Button,
|
|
7
|
+
ChakraProvider,
|
|
8
|
+
Heading,
|
|
9
|
+
Image,
|
|
10
|
+
Text,
|
|
11
|
+
} from '@chakra-ui/react';
|
|
12
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
13
|
+
|
|
14
|
+
import { Carousel } from './Carousel';
|
|
15
|
+
|
|
16
|
+
// Define the metadata for the Carousel component
|
|
17
|
+
const meta: Meta<typeof Carousel> = {
|
|
18
|
+
title: 'Components/Carousel',
|
|
19
|
+
component: Carousel,
|
|
20
|
+
decorators: [
|
|
21
|
+
(Story) => (
|
|
22
|
+
<ChakraProvider>
|
|
23
|
+
<Story />
|
|
24
|
+
</ChakraProvider>
|
|
25
|
+
),
|
|
26
|
+
],
|
|
27
|
+
args: {
|
|
28
|
+
children: [
|
|
29
|
+
<Image
|
|
30
|
+
width="100%"
|
|
31
|
+
height="100vh"
|
|
32
|
+
src="https://via.placeholder.com/800x400.png?text=Slide+1"
|
|
33
|
+
alt="Slide 1"
|
|
34
|
+
/>,
|
|
35
|
+
<Image
|
|
36
|
+
width="100%"
|
|
37
|
+
height="100vh"
|
|
38
|
+
src="https://via.placeholder.com/800x400.png?text=Slide+2"
|
|
39
|
+
alt="Slide 2"
|
|
40
|
+
/>,
|
|
41
|
+
<Image
|
|
42
|
+
width="100%"
|
|
43
|
+
height="100vh"
|
|
44
|
+
src="https://via.placeholder.com/800x400.png?text=Slide+3"
|
|
45
|
+
alt="Slide 3"
|
|
46
|
+
/>,
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default meta;
|
|
52
|
+
type StoryType = StoryFn<typeof Carousel>;
|
|
53
|
+
|
|
54
|
+
// Template for creating stories
|
|
55
|
+
const Template: StoryType = (args) => <Carousel {...args} />;
|
|
56
|
+
|
|
57
|
+
export const ImageCarousel: StoryType = Template.bind({});
|
|
58
|
+
ImageCarousel.storyName = 'Carousel with Images';
|
|
59
|
+
|
|
60
|
+
export const AutoplayCarousel: StoryType = Template.bind({});
|
|
61
|
+
AutoplayCarousel.args = {
|
|
62
|
+
autoplayDuration: 1000,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const HideIndicators: StoryType = Template.bind({});
|
|
66
|
+
HideIndicators.args = {
|
|
67
|
+
showIndicators: false,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const CustomComponentCarousel: StoryType = Template.bind({});
|
|
71
|
+
CustomComponentCarousel.args = {
|
|
72
|
+
children: [
|
|
73
|
+
<Box
|
|
74
|
+
position="relative"
|
|
75
|
+
height="400px"
|
|
76
|
+
backgroundImage={`url(https://via.placeholder.com/800x400.png?text=Custom+Slide+1)`}
|
|
77
|
+
backgroundSize="contain"
|
|
78
|
+
backgroundPosition="center"
|
|
79
|
+
display="flex"
|
|
80
|
+
alignItems="center"
|
|
81
|
+
justifyContent="center"
|
|
82
|
+
color="white"
|
|
83
|
+
textAlign="center"
|
|
84
|
+
p={4}
|
|
85
|
+
>
|
|
86
|
+
<Box bg="rgba(0, 0, 0, 0.5)" p={6} borderRadius="md">
|
|
87
|
+
<Heading mb={4}>Custom Slide 1</Heading>
|
|
88
|
+
<Text mb={4}>This is a custom component slide.</Text>
|
|
89
|
+
<Button colorScheme="teal">Learn More</Button>
|
|
90
|
+
</Box>
|
|
91
|
+
</Box>,
|
|
92
|
+
<Box
|
|
93
|
+
position="relative"
|
|
94
|
+
height="400px"
|
|
95
|
+
backgroundImage={`url(https://via.placeholder.com/800x400.png?text=Custom+Slide+2)`}
|
|
96
|
+
backgroundSize="contain"
|
|
97
|
+
backgroundPosition="center"
|
|
98
|
+
display="flex"
|
|
99
|
+
alignItems="center"
|
|
100
|
+
justifyContent="center"
|
|
101
|
+
color="white"
|
|
102
|
+
textAlign="center"
|
|
103
|
+
p={4}
|
|
104
|
+
>
|
|
105
|
+
<Box bg="rgba(0, 0, 0, 0.5)" p={6} borderRadius="md">
|
|
106
|
+
<Heading mb={4}>Custom Slide 2</Heading>
|
|
107
|
+
<Text mb={4}>Another custom component slide.</Text>
|
|
108
|
+
<Button colorScheme="teal">Get Started</Button>
|
|
109
|
+
</Box>
|
|
110
|
+
</Box>,
|
|
111
|
+
<Box
|
|
112
|
+
display="flex"
|
|
113
|
+
alignItems="center"
|
|
114
|
+
justifyContent="center"
|
|
115
|
+
height="400px"
|
|
116
|
+
bg="gray.100"
|
|
117
|
+
p={8}
|
|
118
|
+
textAlign="center"
|
|
119
|
+
>
|
|
120
|
+
<Box>
|
|
121
|
+
<Heading mb={4}>Text-Only Slide</Heading>
|
|
122
|
+
<Text mb={4}>This slide contains only text and a button.</Text>
|
|
123
|
+
<Button colorScheme="teal">CTA</Button>
|
|
124
|
+
</Box>
|
|
125
|
+
</Box>,
|
|
126
|
+
],
|
|
127
|
+
};
|
|
128
|
+
CustomComponentCarousel.storyName = 'Carousel with Custom Components';
|
|
129
|
+
|
|
130
|
+
export const ControlledCarouselExample = () => {
|
|
131
|
+
const [currentSlide, setCurrentSlide] = useState<number>(0);
|
|
132
|
+
|
|
133
|
+
const handleSlideChange = (newSlide: number) => {
|
|
134
|
+
setCurrentSlide(newSlide);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
return (
|
|
138
|
+
<div>
|
|
139
|
+
<Carousel
|
|
140
|
+
// autoplayDuration={5000}
|
|
141
|
+
currentSlide={currentSlide}
|
|
142
|
+
onSlideChange={handleSlideChange}
|
|
143
|
+
>
|
|
144
|
+
<Box bg="red.500" height="200px">
|
|
145
|
+
Slide 1
|
|
146
|
+
</Box>
|
|
147
|
+
<Box bg="green.500" height="200px">
|
|
148
|
+
Slide 2
|
|
149
|
+
</Box>
|
|
150
|
+
<Box bg="blue.500" height="200px">
|
|
151
|
+
Slide 3
|
|
152
|
+
</Box>
|
|
153
|
+
</Carousel>
|
|
154
|
+
<Button onClick={() => setCurrentSlide((prev) => (prev + 1) % 3)}>
|
|
155
|
+
Next Slide
|
|
156
|
+
</Button>
|
|
157
|
+
</div>
|
|
158
|
+
);
|
|
159
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// src/components/Carousel.tsx
|
|
2
|
+
|
|
3
|
+
import React, { Children, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { Box, Flex, HStack, useBreakpointValue } from '@chakra-ui/react';
|
|
5
|
+
|
|
6
|
+
import { Icon } from '../Icon';
|
|
7
|
+
import { IconButton } from '../IconButton';
|
|
8
|
+
import { CarouselProps } from './Carousel.types';
|
|
9
|
+
|
|
10
|
+
export const Carousel: React.FC<CarouselProps> = ({
|
|
11
|
+
children,
|
|
12
|
+
autoplayDuration,
|
|
13
|
+
currentSlide: controlledCurrentSlide,
|
|
14
|
+
onSlideChange,
|
|
15
|
+
defaultSlide = 0,
|
|
16
|
+
showIndicators = true,
|
|
17
|
+
showArrows = true,
|
|
18
|
+
...rest
|
|
19
|
+
}) => {
|
|
20
|
+
const slides = Children.toArray(children);
|
|
21
|
+
const slidesCount = slides.length;
|
|
22
|
+
|
|
23
|
+
// Determine button size based on screen size
|
|
24
|
+
const buttonSize = useBreakpointValue({ base: 'sm', md: 'md' });
|
|
25
|
+
|
|
26
|
+
// Controlled vs Uncontrolled
|
|
27
|
+
const isControlled = controlledCurrentSlide !== undefined;
|
|
28
|
+
|
|
29
|
+
// Internal state for uncontrolled usage
|
|
30
|
+
const [internalCurrentSlide, setInternalCurrentSlide] = useState<number>(
|
|
31
|
+
defaultSlide >= 0 && defaultSlide < slidesCount ? defaultSlide : 0
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
// Determine the current slide
|
|
35
|
+
const currentSlide = isControlled
|
|
36
|
+
? controlledCurrentSlide!
|
|
37
|
+
: internalCurrentSlide;
|
|
38
|
+
|
|
39
|
+
// Create a ref to store the timer ID
|
|
40
|
+
const autoplayRef = useRef<NodeJS.Timeout | null>(null);
|
|
41
|
+
|
|
42
|
+
const resetAutoplay = () => {
|
|
43
|
+
if (autoplayDuration && autoplayRef.current) {
|
|
44
|
+
clearInterval(autoplayRef.current);
|
|
45
|
+
autoplayRef.current = setInterval(() => {
|
|
46
|
+
handleNext();
|
|
47
|
+
}, autoplayDuration);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const changeSlide = (newSlide: number) => {
|
|
52
|
+
if (isControlled) {
|
|
53
|
+
onSlideChange?.(newSlide);
|
|
54
|
+
} else {
|
|
55
|
+
setInternalCurrentSlide(newSlide);
|
|
56
|
+
}
|
|
57
|
+
resetAutoplay();
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const handlePrev = () => {
|
|
61
|
+
const newSlide = currentSlide === 0 ? slidesCount - 1 : currentSlide - 1;
|
|
62
|
+
changeSlide(newSlide);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const handleNext = () => {
|
|
66
|
+
const newSlide = currentSlide === slidesCount - 1 ? 0 : currentSlide + 1;
|
|
67
|
+
changeSlide(newSlide);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const handleIndicatorClick = (index: number) => {
|
|
71
|
+
changeSlide(index);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (autoplayDuration) {
|
|
76
|
+
autoplayRef.current = setInterval(() => {
|
|
77
|
+
handleNext();
|
|
78
|
+
}, autoplayDuration);
|
|
79
|
+
|
|
80
|
+
// Cleanup on unmount
|
|
81
|
+
return () => {
|
|
82
|
+
if (autoplayRef.current) {
|
|
83
|
+
clearInterval(autoplayRef.current);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}, [slidesCount, autoplayDuration, currentSlide]); // Added currentSlide to dependencies
|
|
88
|
+
|
|
89
|
+
if (!slides) return null;
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<Box position="relative" width="full" overflow="hidden" {...rest}>
|
|
93
|
+
{/* Slides Container */}
|
|
94
|
+
<Flex
|
|
95
|
+
width={`${slidesCount * 100}%`}
|
|
96
|
+
transition="transform 0.5s ease-in-out"
|
|
97
|
+
transform={`translateX(-${currentSlide * (100 / slidesCount)}%)`}
|
|
98
|
+
>
|
|
99
|
+
{slides.map((child, index) => (
|
|
100
|
+
<Box flex={1} key={`slide-${index}`}>
|
|
101
|
+
{child}
|
|
102
|
+
</Box>
|
|
103
|
+
))}
|
|
104
|
+
</Flex>
|
|
105
|
+
|
|
106
|
+
{/* Previous Button */}
|
|
107
|
+
{showArrows && (
|
|
108
|
+
<IconButton
|
|
109
|
+
aria-label="Previous Slide"
|
|
110
|
+
icon={<Icon icon="IoIosArrowBack" />}
|
|
111
|
+
position="absolute"
|
|
112
|
+
left={3}
|
|
113
|
+
top="50%"
|
|
114
|
+
transform="translateY(-50%)"
|
|
115
|
+
zIndex="1"
|
|
116
|
+
onClick={handlePrev}
|
|
117
|
+
size={buttonSize}
|
|
118
|
+
/>
|
|
119
|
+
)}
|
|
120
|
+
|
|
121
|
+
{/* Next Button */}
|
|
122
|
+
{showArrows && (
|
|
123
|
+
<IconButton
|
|
124
|
+
aria-label="Next Slide"
|
|
125
|
+
icon={<Icon icon="IoChevronForward" />}
|
|
126
|
+
position="absolute"
|
|
127
|
+
right={3}
|
|
128
|
+
top="50%"
|
|
129
|
+
transform="translateY(-50%)"
|
|
130
|
+
zIndex="1"
|
|
131
|
+
onClick={handleNext}
|
|
132
|
+
size={buttonSize}
|
|
133
|
+
/>
|
|
134
|
+
)}
|
|
135
|
+
|
|
136
|
+
{/* Indicators */}
|
|
137
|
+
{showIndicators && (
|
|
138
|
+
<HStack
|
|
139
|
+
position="absolute"
|
|
140
|
+
bottom={3}
|
|
141
|
+
width="full"
|
|
142
|
+
justifyContent="center"
|
|
143
|
+
spacing={2}
|
|
144
|
+
>
|
|
145
|
+
{slides.map((_, index) => (
|
|
146
|
+
<Box
|
|
147
|
+
key={index}
|
|
148
|
+
cursor="pointer"
|
|
149
|
+
boxSize={currentSlide === index ? 3 : 2}
|
|
150
|
+
bg={currentSlide === index ? 'gray.600' : 'gray.300'}
|
|
151
|
+
borderRadius="full"
|
|
152
|
+
onClick={() => handleIndicatorClick(index)}
|
|
153
|
+
transition="background-color 0.3s, box-size 0.3s"
|
|
154
|
+
/>
|
|
155
|
+
))}
|
|
156
|
+
</HStack>
|
|
157
|
+
)}
|
|
158
|
+
</Box>
|
|
159
|
+
);
|
|
160
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BoxProps } from '@chakra-ui/react';
|
|
2
|
+
|
|
3
|
+
export interface CarouselProps extends BoxProps {
|
|
4
|
+
/**
|
|
5
|
+
* Will autoplay if defined
|
|
6
|
+
*/
|
|
7
|
+
autoplayDuration?: number;
|
|
8
|
+
currentSlide?: number;
|
|
9
|
+
onSlideChange?: (newSlide: number) => void;
|
|
10
|
+
/**
|
|
11
|
+
* @default 0
|
|
12
|
+
*/
|
|
13
|
+
defaultSlide?: number;
|
|
14
|
+
/**
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
showIndicators?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
showArrows?: boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Carousel } from './Carousel';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box } from '@chakra-ui/react';
|
|
3
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
4
|
+
|
|
5
|
+
import { H4, Text } from '../Typography';
|
|
6
|
+
import { CarouselModal } from './CarouselModal';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof CarouselModal> = {
|
|
9
|
+
title: 'Components/CarouselModal',
|
|
10
|
+
component: CarouselModal,
|
|
11
|
+
args: {
|
|
12
|
+
isOpen: true,
|
|
13
|
+
onClose: () => alert('should close here!'),
|
|
14
|
+
slides: [
|
|
15
|
+
{
|
|
16
|
+
image: 'https://via.placeholder.com/800x400.png?text=Slide+1',
|
|
17
|
+
text: (
|
|
18
|
+
<Box>
|
|
19
|
+
<H4>Welcome! This is a test slide title.</H4>
|
|
20
|
+
<Text>
|
|
21
|
+
Are you ready for this crazy modal?! This is a test slide
|
|
22
|
+
description.
|
|
23
|
+
</Text>
|
|
24
|
+
</Box>
|
|
25
|
+
),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
image: 'https://via.placeholder.com/800x400.png?text=Slide+2',
|
|
29
|
+
text: (
|
|
30
|
+
<Box>
|
|
31
|
+
<H4>This is a title for more content.</H4>
|
|
32
|
+
<Text>Woohoo! This is a test slide description.</Text>
|
|
33
|
+
</Box>
|
|
34
|
+
),
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
image: 'https://via.placeholder.com/800x400.png?text=Slide+3',
|
|
38
|
+
text: (
|
|
39
|
+
<Box>
|
|
40
|
+
<H4>This is a test slide title for even more content!</H4>
|
|
41
|
+
<Text>This is a test slide description. Wowza!</Text>
|
|
42
|
+
</Box>
|
|
43
|
+
),
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default meta;
|
|
50
|
+
|
|
51
|
+
type Story = StoryObj<typeof CarouselModal>;
|
|
52
|
+
|
|
53
|
+
export const Basic: Story = {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { useRef, useState } from 'react';
|
|
2
|
+
import { Box, Flex, Image } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
import { Button } from '@/components/Button';
|
|
5
|
+
import { Carousel } from '@/components/Carousel';
|
|
6
|
+
import {
|
|
7
|
+
Modal,
|
|
8
|
+
ModalBody,
|
|
9
|
+
ModalCloseButton,
|
|
10
|
+
ModalContent,
|
|
11
|
+
ModalFooter,
|
|
12
|
+
} from '@/components/Modal';
|
|
13
|
+
import { useTranslate } from '@/hooks/useTranslate';
|
|
14
|
+
|
|
15
|
+
import { CarouselModalProps } from './CarouselModal.types';
|
|
16
|
+
|
|
17
|
+
export const CarouselModal = ({
|
|
18
|
+
slides,
|
|
19
|
+
onClose,
|
|
20
|
+
...rest
|
|
21
|
+
}: CarouselModalProps) => {
|
|
22
|
+
const nextButtonRef = useRef(null);
|
|
23
|
+
const translate = useTranslate();
|
|
24
|
+
const [currentSlide, setCurrentSlide] = useState<number>(0);
|
|
25
|
+
const handleNextClick = () => {
|
|
26
|
+
if (currentSlide === slides.length - 1) {
|
|
27
|
+
onClose();
|
|
28
|
+
} else {
|
|
29
|
+
setCurrentSlide(currentSlide + 1);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const handleBackClick = () => {
|
|
33
|
+
const newSlide = currentSlide === 0 ? slides.length - 1 : currentSlide - 1;
|
|
34
|
+
setCurrentSlide(newSlide);
|
|
35
|
+
};
|
|
36
|
+
const handleIndicatorClick = (index: number) => {
|
|
37
|
+
setCurrentSlide(index);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const handleEndClick = () => {
|
|
41
|
+
onClose();
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Modal
|
|
46
|
+
size="2xl"
|
|
47
|
+
onClose={onClose}
|
|
48
|
+
initialFocusRef={nextButtonRef}
|
|
49
|
+
{...rest}
|
|
50
|
+
>
|
|
51
|
+
<ModalContent overflow="hidden">
|
|
52
|
+
<ModalCloseButton />
|
|
53
|
+
<ModalBody pb={0} pt={12}>
|
|
54
|
+
<Carousel
|
|
55
|
+
showIndicators={false}
|
|
56
|
+
currentSlide={currentSlide}
|
|
57
|
+
onSlideChange={setCurrentSlide}
|
|
58
|
+
mb={4}
|
|
59
|
+
borderRadius="md"
|
|
60
|
+
overflow="hidden"
|
|
61
|
+
>
|
|
62
|
+
{slides.map((_, index) => (
|
|
63
|
+
<Image
|
|
64
|
+
key={`slider-modal-image-${index}`}
|
|
65
|
+
width="100%"
|
|
66
|
+
height="400px"
|
|
67
|
+
src={slides[index].image}
|
|
68
|
+
alt={`Slide ${index}`}
|
|
69
|
+
/>
|
|
70
|
+
))}
|
|
71
|
+
</Carousel>
|
|
72
|
+
<Box mb={5} textAlign="left">
|
|
73
|
+
{slides[currentSlide].text}
|
|
74
|
+
</Box>
|
|
75
|
+
</ModalBody>
|
|
76
|
+
<ModalFooter mt={4} py={8} borderTop="1px solid" borderColor="gray.300">
|
|
77
|
+
<Button px={0} variant="tertiary" onClick={handleBackClick}>
|
|
78
|
+
{translate('previous')}
|
|
79
|
+
</Button>
|
|
80
|
+
<Flex align="center" flex={1} gap={2} justify="center">
|
|
81
|
+
{slides.map((_, index) => (
|
|
82
|
+
<Box
|
|
83
|
+
key={`slider-modal-slide-text-${index}`}
|
|
84
|
+
cursor="pointer"
|
|
85
|
+
boxSize={currentSlide === index ? 3 : 2}
|
|
86
|
+
bg={currentSlide === index ? 'gray.1000' : 'gray.600'}
|
|
87
|
+
borderRadius="full"
|
|
88
|
+
onClick={() => handleIndicatorClick(index)}
|
|
89
|
+
transition="background-color 0.3s, box-size 0.3s"
|
|
90
|
+
/>
|
|
91
|
+
))}
|
|
92
|
+
</Flex>
|
|
93
|
+
{currentSlide === slides.length - 1 ? (
|
|
94
|
+
<Button px={0} onClick={handleEndClick}>
|
|
95
|
+
{translate('get_started')}
|
|
96
|
+
</Button>
|
|
97
|
+
) : (
|
|
98
|
+
<Button px={0} onClick={handleNextClick} ref={nextButtonRef}>
|
|
99
|
+
{translate('next')}
|
|
100
|
+
</Button>
|
|
101
|
+
)}
|
|
102
|
+
</ModalFooter>
|
|
103
|
+
</ModalContent>
|
|
104
|
+
</Modal>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { ModalProps } from '@/components/Modal';
|
|
4
|
+
|
|
5
|
+
export type CarouselModalProps = Omit<
|
|
6
|
+
ModalProps,
|
|
7
|
+
'children' | 'initialFocusRef'
|
|
8
|
+
> & {
|
|
9
|
+
slides: Array<{
|
|
10
|
+
/**
|
|
11
|
+
* Recommended image resolution is 400 x 540 ish.
|
|
12
|
+
*/
|
|
13
|
+
image: string;
|
|
14
|
+
text: ReactNode;
|
|
15
|
+
}>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { Checkbox } from './Checkbox';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/Checkbox',
|
|
8
|
+
component: Checkbox,
|
|
9
|
+
} as ComponentMeta<typeof Checkbox>;
|
|
10
|
+
|
|
11
|
+
const Template: ComponentStory<typeof Checkbox> = (args) => (
|
|
12
|
+
<Checkbox {...args} />
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const Default = Template.bind({});
|
|
16
|
+
Default.args = {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { Checkbox as ChakraCheckbox } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
import { CheckboxProps } from './Checkbox.types';
|
|
5
|
+
|
|
6
|
+
export const Checkbox = forwardRef(({ sx, ...rest }: CheckboxProps, ref) => {
|
|
7
|
+
return (
|
|
8
|
+
<ChakraCheckbox
|
|
9
|
+
ref={ref}
|
|
10
|
+
{...rest}
|
|
11
|
+
sx={{
|
|
12
|
+
'.chakra-checkbox__control': {
|
|
13
|
+
borderRadius: '4px',
|
|
14
|
+
borderColor: 'gray.400',
|
|
15
|
+
_checked: {
|
|
16
|
+
bg: 'primary.main',
|
|
17
|
+
borderColor: 'primary.main',
|
|
18
|
+
},
|
|
19
|
+
_indeterminate: {
|
|
20
|
+
bg: 'primary.main',
|
|
21
|
+
borderColor: 'primary.main',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
Checkbox.displayName = 'Checkbox';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Flex } from '@chakra-ui/react';
|
|
3
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
4
|
+
|
|
5
|
+
import { Chip, useCaseStyles } from '.';
|
|
6
|
+
import { ChipUseCase } from './Chip.types';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof Chip> = {
|
|
9
|
+
title: 'Components/Chip',
|
|
10
|
+
component: Chip,
|
|
11
|
+
args: {
|
|
12
|
+
children: 'Chip',
|
|
13
|
+
},
|
|
14
|
+
argTypes: {},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryFn<typeof Chip>;
|
|
19
|
+
|
|
20
|
+
export const Basic: Story = (args) => <Chip {...args} />;
|
|
21
|
+
|
|
22
|
+
export const AllChipVariants: Story = (args) => {
|
|
23
|
+
const useCases = Object.keys(useCaseStyles) as Array<ChipUseCase>;
|
|
24
|
+
const variants = ['solid', 'outline', 'subtle'];
|
|
25
|
+
return (
|
|
26
|
+
<Box>
|
|
27
|
+
<Flex mb="16px" gap="16px" align="center">
|
|
28
|
+
<p>default</p>
|
|
29
|
+
<Chip {...args} />
|
|
30
|
+
</Flex>
|
|
31
|
+
{useCases.map((useCase) => (
|
|
32
|
+
<Flex mb="16px" gap="16px" align="center">
|
|
33
|
+
<p style={{ width: '100px' }}>{useCase}</p>
|
|
34
|
+
{variants.map((variant) => (
|
|
35
|
+
<div>
|
|
36
|
+
<p>{variant}</p>
|
|
37
|
+
<Chip {...args} useCase={useCase} variant={variant} />
|
|
38
|
+
</div>
|
|
39
|
+
))}
|
|
40
|
+
</Flex>
|
|
41
|
+
))}
|
|
42
|
+
</Box>
|
|
43
|
+
);
|
|
44
|
+
};
|