@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,186 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Button } from '@chakra-ui/react';
|
|
3
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
4
|
+
|
|
5
|
+
import { Icon } from '../Icon';
|
|
6
|
+
import { IconButton } from '../IconButton';
|
|
7
|
+
import { Menu, MenuButton, MenuItem, MenuList } from '.';
|
|
8
|
+
import { MenuItemProps } from './MenuItem.types';
|
|
9
|
+
|
|
10
|
+
// Interface for story-specific menu item data
|
|
11
|
+
interface StoryMenuItemProps {
|
|
12
|
+
label: string;
|
|
13
|
+
onClick?: () => void;
|
|
14
|
+
itemIcon?: React.ReactElement;
|
|
15
|
+
variant?: MenuItemProps['variant'];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const meta: Meta = {
|
|
19
|
+
title: 'Components/Menu',
|
|
20
|
+
component: Menu,
|
|
21
|
+
args: {
|
|
22
|
+
label: 'Trigger',
|
|
23
|
+
menuItems: [
|
|
24
|
+
{ label: 'Profile', onClick: () => alert('Profile clicked') },
|
|
25
|
+
{ label: 'Settings', onClick: () => alert('Settings clicked') },
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
argTypes: {
|
|
29
|
+
menuItems: { control: 'object' },
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default meta;
|
|
34
|
+
|
|
35
|
+
type Story = StoryFn<{ label: string; menuItems: StoryMenuItemProps[] }>;
|
|
36
|
+
|
|
37
|
+
const Template: Story = ({ label, menuItems, ...args }) => (
|
|
38
|
+
<Menu>
|
|
39
|
+
<MenuButton
|
|
40
|
+
aria-label={'storybook button menu'}
|
|
41
|
+
as={Button}
|
|
42
|
+
rightIcon={<Icon icon="IoChevronDownOutline" />}
|
|
43
|
+
{...args}
|
|
44
|
+
>
|
|
45
|
+
{label}
|
|
46
|
+
</MenuButton>
|
|
47
|
+
<MenuList>
|
|
48
|
+
{menuItems.map((item) => (
|
|
49
|
+
<MenuItem
|
|
50
|
+
key={item.label}
|
|
51
|
+
variant={item.variant}
|
|
52
|
+
icon={item.itemIcon}
|
|
53
|
+
onClick={item.onClick}
|
|
54
|
+
>
|
|
55
|
+
{item.label}
|
|
56
|
+
</MenuItem>
|
|
57
|
+
))}
|
|
58
|
+
</MenuList>
|
|
59
|
+
</Menu>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
export const DefaultMenu = Template.bind({});
|
|
63
|
+
DefaultMenu.args = {
|
|
64
|
+
menuItems: [
|
|
65
|
+
{ label: 'Profile', onClick: () => alert('Profile clicked') },
|
|
66
|
+
{
|
|
67
|
+
label: 'Settings',
|
|
68
|
+
onClick: () => alert('Settings clicked'),
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const IconMenu = Template.bind({});
|
|
74
|
+
IconMenu.args = {
|
|
75
|
+
menuItems: [
|
|
76
|
+
{
|
|
77
|
+
label: 'Profile',
|
|
78
|
+
onClick: () => alert('Profile clicked'),
|
|
79
|
+
itemIcon: <Icon icon="SlSettings" />,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
label: 'Settings',
|
|
83
|
+
onClick: () => alert('Settings clicked'),
|
|
84
|
+
itemIcon: <Icon icon="SlSettings" />,
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const DangerMenu = Template.bind({});
|
|
90
|
+
DangerMenu.args = {
|
|
91
|
+
menuItems: [
|
|
92
|
+
{ label: 'Profile', onClick: () => alert('Profile clicked') },
|
|
93
|
+
{
|
|
94
|
+
label: 'Settings',
|
|
95
|
+
onClick: () => alert('Settings clicked'),
|
|
96
|
+
itemIcon: <Icon icon="SlSettings" />,
|
|
97
|
+
variant: 'danger',
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const IconButtonTemplate: Story = ({ menuItems, ...args }) => (
|
|
103
|
+
<Menu>
|
|
104
|
+
<MenuButton
|
|
105
|
+
aria-label="storybook icon button menu"
|
|
106
|
+
as={IconButton}
|
|
107
|
+
icon={<Icon icon="IoChevronDownOutline" />}
|
|
108
|
+
{...args}
|
|
109
|
+
/>
|
|
110
|
+
<MenuList>
|
|
111
|
+
{menuItems.map((item) => (
|
|
112
|
+
<MenuItem
|
|
113
|
+
key={item.label}
|
|
114
|
+
variant={item.variant}
|
|
115
|
+
icon={item.itemIcon}
|
|
116
|
+
onClick={item.onClick}
|
|
117
|
+
>
|
|
118
|
+
{item.label}
|
|
119
|
+
</MenuItem>
|
|
120
|
+
))}
|
|
121
|
+
</MenuList>
|
|
122
|
+
</Menu>
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
export const IconButtonTriggerMenu = IconButtonTemplate.bind({});
|
|
126
|
+
IconButtonTriggerMenu.args = {
|
|
127
|
+
menuItems: [
|
|
128
|
+
{ label: 'Profile', onClick: () => alert('Profile clicked') },
|
|
129
|
+
{
|
|
130
|
+
label: 'Settings',
|
|
131
|
+
onClick: () => alert('Settings clicked'),
|
|
132
|
+
itemIcon: <Icon icon="SlSettings" />,
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
};
|
|
136
|
+
IconButtonTriggerMenu.argTypes = {
|
|
137
|
+
label: { table: { disable: true } },
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const SelectiveIconTemplate: Story = ({ label, menuItems, ...args }) => {
|
|
141
|
+
const [selectedLabel, setSelectedLabel] = useState<string | null>(
|
|
142
|
+
menuItems[0].label
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
const handleItemClick = (label: string, onClick?: () => void) => {
|
|
146
|
+
setSelectedLabel(label);
|
|
147
|
+
onClick && onClick();
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<Menu>
|
|
152
|
+
<MenuButton
|
|
153
|
+
aria-label={'storybook button menu'}
|
|
154
|
+
as={Button}
|
|
155
|
+
rightIcon={<Icon icon="IoChevronDownOutline" />}
|
|
156
|
+
{...args}
|
|
157
|
+
>
|
|
158
|
+
{label}
|
|
159
|
+
</MenuButton>
|
|
160
|
+
<MenuList>
|
|
161
|
+
{menuItems.map((item) => (
|
|
162
|
+
<MenuItem
|
|
163
|
+
key={item.label}
|
|
164
|
+
onClick={() => handleItemClick(item.label, item.onClick)}
|
|
165
|
+
icon={
|
|
166
|
+
selectedLabel === item.label ? (
|
|
167
|
+
<Icon icon="SlSettings" />
|
|
168
|
+
) : undefined
|
|
169
|
+
}
|
|
170
|
+
>
|
|
171
|
+
{item.label}
|
|
172
|
+
</MenuItem>
|
|
173
|
+
))}
|
|
174
|
+
</MenuList>
|
|
175
|
+
</Menu>
|
|
176
|
+
);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export const SelectiveIconMenu = SelectiveIconTemplate.bind({});
|
|
180
|
+
SelectiveIconMenu.args = {
|
|
181
|
+
menuItems: [
|
|
182
|
+
{ label: 'Profile', onClick: () => alert('Profile clicked') },
|
|
183
|
+
{ label: 'Settings', onClick: () => alert('Settings clicked') },
|
|
184
|
+
{ label: 'Logout', onClick: () => alert('Logout clicked') },
|
|
185
|
+
],
|
|
186
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MenuButton as ChakraMenuButton } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
import { CustomMenuButtonProps } from './MenuButton.types';
|
|
5
|
+
|
|
6
|
+
export const MenuButton = ({ as, ...rest }: CustomMenuButtonProps) => {
|
|
7
|
+
return <ChakraMenuButton as={as} {...rest} />;
|
|
8
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button,
|
|
3
|
+
MenuButtonProps as ChakraMenuButtonProps,
|
|
4
|
+
} from '@chakra-ui/react';
|
|
5
|
+
|
|
6
|
+
import { IconButton } from '@/components/IconButton';
|
|
7
|
+
|
|
8
|
+
// as 속성에 들어갈 `Button`과 `IconButton`에 따른 조건부 타입
|
|
9
|
+
interface ButtonMenuButtonProps extends ChakraMenuButtonProps {
|
|
10
|
+
as: typeof Button;
|
|
11
|
+
rightIcon?: React.ReactNode;
|
|
12
|
+
icon?: never;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface IconButtonMenuButtonProps extends ChakraMenuButtonProps {
|
|
16
|
+
as: typeof IconButton;
|
|
17
|
+
icon?: React.ReactNode;
|
|
18
|
+
rightIcon?: never;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type CustomMenuButtonProps =
|
|
22
|
+
| ButtonMenuButtonProps
|
|
23
|
+
| IconButtonMenuButtonProps;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { MenuItem as ChakraMenuItem, useTheme } from '@chakra-ui/react';
|
|
2
|
+
|
|
3
|
+
import { ItemVariant, MenuItemProps } from './MenuItem.types';
|
|
4
|
+
|
|
5
|
+
export const MenuItem = ({
|
|
6
|
+
variant = ItemVariant.Default,
|
|
7
|
+
children,
|
|
8
|
+
...rest
|
|
9
|
+
}: MenuItemProps) => {
|
|
10
|
+
const theme = useTheme();
|
|
11
|
+
const isDangerVariant = variant === ItemVariant.Danger;
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<ChakraMenuItem
|
|
15
|
+
color={
|
|
16
|
+
isDangerVariant ? theme.semanticTokens.colors.danger.main : 'gray.800'
|
|
17
|
+
}
|
|
18
|
+
iconSpacing={0}
|
|
19
|
+
fontSize="md"
|
|
20
|
+
py={2}
|
|
21
|
+
minW="fit-content"
|
|
22
|
+
fontWeight="semibold"
|
|
23
|
+
gap={3}
|
|
24
|
+
_hover={{
|
|
25
|
+
color: isDangerVariant
|
|
26
|
+
? theme.semanticTokens.colors.danger.main
|
|
27
|
+
: 'gray.1200',
|
|
28
|
+
backgroundColor: 'gray.50',
|
|
29
|
+
}}
|
|
30
|
+
{...rest}
|
|
31
|
+
>
|
|
32
|
+
{children}
|
|
33
|
+
</ChakraMenuItem>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MenuItemProps as ChakraMenuItemProps } from '@chakra-ui/react';
|
|
2
|
+
|
|
3
|
+
export const ItemVariant = {
|
|
4
|
+
Default: 'default',
|
|
5
|
+
Danger: 'danger',
|
|
6
|
+
} as const;
|
|
7
|
+
|
|
8
|
+
export type ItemVariant = (typeof ItemVariant)[keyof typeof ItemVariant];
|
|
9
|
+
|
|
10
|
+
export interface MenuItemProps extends ChakraMenuItemProps {
|
|
11
|
+
variant?: ItemVariant | null;
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MenuList as ChakraMenuList,
|
|
3
|
+
MenuListProps as ChakraMenuListProps,
|
|
4
|
+
useTheme,
|
|
5
|
+
useToken,
|
|
6
|
+
} from '@chakra-ui/react';
|
|
7
|
+
|
|
8
|
+
export const MenuList = ({ ...rest }: ChakraMenuListProps) => {
|
|
9
|
+
const theme = useTheme();
|
|
10
|
+
return (
|
|
11
|
+
<ChakraMenuList
|
|
12
|
+
border={`1px solid ${useToken('colors', theme.colors.gray[400])}`}
|
|
13
|
+
borderRadius="md"
|
|
14
|
+
boxShadow={`0 5px 20px 1px ${useToken('colors', theme.colors.gray[50])}`}
|
|
15
|
+
padding={1}
|
|
16
|
+
{...rest}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { Button } from '../Button';
|
|
5
|
+
import { ButtonVariant } from '../Button/Button.types';
|
|
6
|
+
import {
|
|
7
|
+
Modal,
|
|
8
|
+
ModalBody,
|
|
9
|
+
ModalCloseButton,
|
|
10
|
+
ModalContent,
|
|
11
|
+
ModalFooter,
|
|
12
|
+
ModalHeader,
|
|
13
|
+
} from '.';
|
|
14
|
+
|
|
15
|
+
interface ModalArgs {
|
|
16
|
+
headerTitle: string;
|
|
17
|
+
hasCloseButton: boolean;
|
|
18
|
+
footerButtons: { label: string; variant?: ButtonVariant }[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
title: 'Components/Modal',
|
|
23
|
+
component: Modal,
|
|
24
|
+
args: {
|
|
25
|
+
header: 'Default Header',
|
|
26
|
+
},
|
|
27
|
+
argTypes: {
|
|
28
|
+
headerTitle: { control: 'text' },
|
|
29
|
+
hasCloseButton: { control: 'boolean', defaultValue: false },
|
|
30
|
+
},
|
|
31
|
+
parameters: {
|
|
32
|
+
controls: {
|
|
33
|
+
expanded: true,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
} as Meta<typeof Modal>;
|
|
37
|
+
|
|
38
|
+
export const Default: StoryFn<ModalArgs> = (args) => {
|
|
39
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<>
|
|
43
|
+
<Button onClick={() => setIsOpen(true)}>Open Confirm Modal</Button>
|
|
44
|
+
<Modal {...args} isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
45
|
+
<ModalContent>
|
|
46
|
+
{args.headerTitle && <ModalHeader>{args.headerTitle}</ModalHeader>}
|
|
47
|
+
{args.hasCloseButton && <ModalCloseButton />}
|
|
48
|
+
<ModalBody>열려라 참깨!</ModalBody>
|
|
49
|
+
{args.footerButtons && (
|
|
50
|
+
<ModalFooter>
|
|
51
|
+
{args.footerButtons.map((button, index) => (
|
|
52
|
+
<Button key={index} variant={button.variant || 'primary'}>
|
|
53
|
+
{button.label}
|
|
54
|
+
</Button>
|
|
55
|
+
))}
|
|
56
|
+
</ModalFooter>
|
|
57
|
+
)}
|
|
58
|
+
</ModalContent>
|
|
59
|
+
</Modal>
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
Default.args = {};
|
|
65
|
+
|
|
66
|
+
export const WithHeader = Default.bind({});
|
|
67
|
+
WithHeader.args = {
|
|
68
|
+
headerTitle: 'Welcome to Mindlogic!',
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const WithFooterButton = Default.bind({});
|
|
72
|
+
WithFooterButton.args = {
|
|
73
|
+
headerTitle: 'Welcome to Mindlogic!',
|
|
74
|
+
footerButtons: [{ label: 'Confirm' }],
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const TwoButtons = Default.bind({});
|
|
78
|
+
TwoButtons.args = {
|
|
79
|
+
footerButtons: [
|
|
80
|
+
{ label: 'Cancel', variant: 'tertiary' },
|
|
81
|
+
{ label: 'Save', variant: 'primary' },
|
|
82
|
+
],
|
|
83
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Modal as ChakraModal } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
import { ModalProps } from './Modal.types';
|
|
5
|
+
import { ModalOverlay } from './ModalOverlay';
|
|
6
|
+
|
|
7
|
+
export const Modal = ({ children, ...rest }: ModalProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<ChakraModal isCentered closeOnOverlayClick {...rest}>
|
|
10
|
+
<ModalOverlay />
|
|
11
|
+
{children}
|
|
12
|
+
</ChakraModal>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ModalBody as ChakraModalBody,
|
|
4
|
+
ModalBodyProps as ChakraModalBodyProps,
|
|
5
|
+
} from '@chakra-ui/react';
|
|
6
|
+
|
|
7
|
+
export const ModalBody = ({ ...rest }: ChakraModalBodyProps) => {
|
|
8
|
+
return <ChakraModalBody px={6} py={4} {...rest} />;
|
|
9
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ModalCloseButton as ChakraModalCloseButton,
|
|
4
|
+
ModalCloseButtonProps as ChakraModalCloseButtonProps,
|
|
5
|
+
} from '@chakra-ui/react';
|
|
6
|
+
|
|
7
|
+
export const ModalCloseButton = ({ ...rest }: ChakraModalCloseButtonProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<ChakraModalCloseButton
|
|
10
|
+
color="gray.600"
|
|
11
|
+
_hover={{
|
|
12
|
+
color: 'primary.main',
|
|
13
|
+
backgroundColor: 'transparent',
|
|
14
|
+
}}
|
|
15
|
+
{...rest}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ModalContent as ChakraModalContent } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
import { ModalContentProps } from './ModalContent.types';
|
|
5
|
+
|
|
6
|
+
export const ModalContent = ({ ...rest }: ModalContentProps) => {
|
|
7
|
+
return <ChakraModalContent {...rest} />;
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ModalContent } from './ModalContent';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ModalFooter as ChakraModalFooter,
|
|
4
|
+
ModalFooterProps as ChakraModalFooterProps,
|
|
5
|
+
} from '@chakra-ui/react';
|
|
6
|
+
|
|
7
|
+
import styles from './ModalFooter.module.css';
|
|
8
|
+
|
|
9
|
+
export const ModalFooter = ({ className, ...rest }: ChakraModalFooterProps) => {
|
|
10
|
+
return (
|
|
11
|
+
<ChakraModalFooter
|
|
12
|
+
className={[styles['ml-modal-footer'], className].join(' ')}
|
|
13
|
+
gap={3}
|
|
14
|
+
pt={4}
|
|
15
|
+
borderTop="1px solid"
|
|
16
|
+
borderColor="gray.50"
|
|
17
|
+
{...rest}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ModalFooter } from './ModalFooter';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ModalHeader as ChakraModalHeader,
|
|
4
|
+
ModalHeaderProps as ChakraModalHeaderProps,
|
|
5
|
+
} from '@chakra-ui/react';
|
|
6
|
+
|
|
7
|
+
export const ModalHeader = ({ ...rest }: ChakraModalHeaderProps) => {
|
|
8
|
+
return <ChakraModalHeader fontSize="xl" {...rest} />;
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ModalOverlay as ChakraModalOverlay,
|
|
4
|
+
ModalOverlayProps as ChakraModalOverlayProps,
|
|
5
|
+
} from '@chakra-ui/react';
|
|
6
|
+
|
|
7
|
+
export const ModalOverlay = ({ ...rest }: ChakraModalOverlayProps) => {
|
|
8
|
+
return <ChakraModalOverlay {...rest} />;
|
|
9
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Modal } from './Modal';
|
|
2
|
+
export { type ModalProps } from './Modal.types';
|
|
3
|
+
export { ModalBody } from './ModalBody';
|
|
4
|
+
export { ModalCloseButton } from './ModalCloseButton';
|
|
5
|
+
export { ModalContent } from './ModalContent';
|
|
6
|
+
export { ModalFooter } from './ModalFooter';
|
|
7
|
+
export { ModalHeader } from './ModalHeader';
|
|
8
|
+
export { ModalOverlay } from './ModalOverlay';
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Button } from '@/components/Button';
|
|
4
|
+
import { ButtonVariant } from '@/components/Button/Button.types';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
isMonthDisabled,
|
|
8
|
+
isMonthInPreviewRange,
|
|
9
|
+
isMonthInRange,
|
|
10
|
+
isMonthSelected,
|
|
11
|
+
isSelectionStart,
|
|
12
|
+
} from '../_utils';
|
|
13
|
+
import { MonthRange } from '../MonthRangePicker.types';
|
|
14
|
+
import { MonthButtonProps } from './MonthButton.types';
|
|
15
|
+
|
|
16
|
+
export const MonthButton: React.FC<MonthButtonProps> = memo(
|
|
17
|
+
({
|
|
18
|
+
month,
|
|
19
|
+
year,
|
|
20
|
+
monthName,
|
|
21
|
+
selectedRange,
|
|
22
|
+
selectionStart,
|
|
23
|
+
hoveredMonth,
|
|
24
|
+
minMonth,
|
|
25
|
+
maxMonth,
|
|
26
|
+
onClick,
|
|
27
|
+
onMouseEnter,
|
|
28
|
+
onMouseLeave,
|
|
29
|
+
...buttonProps
|
|
30
|
+
}) => {
|
|
31
|
+
const disabled = isMonthDisabled(month, year, minMonth, maxMonth);
|
|
32
|
+
|
|
33
|
+
const handleClick = () => {
|
|
34
|
+
if (!disabled) {
|
|
35
|
+
onClick(month, year);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const handleMouseEnter = () => {
|
|
40
|
+
if (!disabled && onMouseEnter) {
|
|
41
|
+
onMouseEnter(month, year);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const handleMouseLeave = () => {
|
|
46
|
+
if (onMouseLeave) {
|
|
47
|
+
onMouseLeave();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const getMonthButtonVariant = (
|
|
52
|
+
month: number,
|
|
53
|
+
year: number,
|
|
54
|
+
selectedRange?: MonthRange | null,
|
|
55
|
+
selectionStart?: Date | null,
|
|
56
|
+
hoveredMonth?: { month: number; year: number } | null,
|
|
57
|
+
minMonth?: Date,
|
|
58
|
+
maxMonth?: Date
|
|
59
|
+
): ButtonVariant => {
|
|
60
|
+
if (isMonthDisabled(month, year, minMonth, maxMonth)) return 'tertiary';
|
|
61
|
+
if (isMonthSelected(month, year, selectedRange)) return 'primary';
|
|
62
|
+
if (isSelectionStart(month, year, selectionStart)) return 'primary';
|
|
63
|
+
if (isMonthInRange(month, year, selectedRange)) return 'secondary';
|
|
64
|
+
|
|
65
|
+
// Show preview range when hovering with a selection start
|
|
66
|
+
if (
|
|
67
|
+
isMonthInPreviewRange(
|
|
68
|
+
month,
|
|
69
|
+
year,
|
|
70
|
+
selectionStart || null,
|
|
71
|
+
hoveredMonth || null
|
|
72
|
+
)
|
|
73
|
+
) {
|
|
74
|
+
return 'secondary';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return 'tertiary';
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<Button
|
|
82
|
+
size="sm"
|
|
83
|
+
variant={getMonthButtonVariant(
|
|
84
|
+
month,
|
|
85
|
+
year,
|
|
86
|
+
selectedRange,
|
|
87
|
+
selectionStart,
|
|
88
|
+
hoveredMonth,
|
|
89
|
+
minMonth,
|
|
90
|
+
maxMonth
|
|
91
|
+
)}
|
|
92
|
+
onClick={handleClick}
|
|
93
|
+
onMouseEnter={handleMouseEnter}
|
|
94
|
+
onMouseLeave={handleMouseLeave}
|
|
95
|
+
disabled={disabled}
|
|
96
|
+
opacity={disabled ? 0.4 : 1}
|
|
97
|
+
{...buttonProps}
|
|
98
|
+
>
|
|
99
|
+
{monthName}
|
|
100
|
+
</Button>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
MonthButton.displayName = 'MonthButton';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ButtonProps } from '@/components/Button/Button.types';
|
|
2
|
+
|
|
3
|
+
import { MonthRange } from '../MonthRangePicker.types';
|
|
4
|
+
|
|
5
|
+
export interface MonthButtonProps
|
|
6
|
+
extends Omit<
|
|
7
|
+
ButtonProps,
|
|
8
|
+
'onClick' | 'variant' | 'disabled' | 'onMouseEnter' | 'onMouseLeave'
|
|
9
|
+
> {
|
|
10
|
+
/** The month index (0-11) */
|
|
11
|
+
month: number;
|
|
12
|
+
|
|
13
|
+
/** The year */
|
|
14
|
+
year: number;
|
|
15
|
+
|
|
16
|
+
/** The display name of the month */
|
|
17
|
+
monthName: string;
|
|
18
|
+
|
|
19
|
+
/** The currently selected month range */
|
|
20
|
+
selectedRange?: MonthRange | null;
|
|
21
|
+
|
|
22
|
+
/** The current selection start (intermediate state) */
|
|
23
|
+
selectionStart?: Date | null;
|
|
24
|
+
|
|
25
|
+
/** The currently hovered month for preview range */
|
|
26
|
+
hoveredMonth?: { month: number; year: number } | null;
|
|
27
|
+
|
|
28
|
+
/** Minimum selectable month */
|
|
29
|
+
minMonth?: Date;
|
|
30
|
+
|
|
31
|
+
/** Maximum selectable month */
|
|
32
|
+
maxMonth?: Date;
|
|
33
|
+
|
|
34
|
+
/** Click handler for month selection */
|
|
35
|
+
onClick: (month: number, year: number) => void;
|
|
36
|
+
|
|
37
|
+
/** Mouse enter handler for hover effects */
|
|
38
|
+
onMouseEnter?: (month: number, year: number) => void;
|
|
39
|
+
|
|
40
|
+
/** Mouse leave handler for hover effects */
|
|
41
|
+
onMouseLeave?: () => void;
|
|
42
|
+
}
|