@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,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Link as ChakraLink,
|
|
3
|
+
LinkProps as ChakraLinkProps,
|
|
4
|
+
} from '@chakra-ui/react';
|
|
5
|
+
|
|
6
|
+
import { linkTextStyles } from '@/components/Link/Link.styles';
|
|
7
|
+
// Optional Next.js Link import
|
|
8
|
+
let NextLink: any;
|
|
9
|
+
try {
|
|
10
|
+
NextLink = require('next/link').default;
|
|
11
|
+
} catch {
|
|
12
|
+
NextLink = null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Link component that combines Chakra UI Link with Next.js Link functionality.
|
|
17
|
+
*
|
|
18
|
+
* This component provides:
|
|
19
|
+
* - Next.js client-side navigation for internal routes
|
|
20
|
+
* - Chakra UI styling and theming
|
|
21
|
+
* - All Chakra UI Link props support
|
|
22
|
+
* - Automatic styling from linkTextStyles
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* // Internal navigation
|
|
27
|
+
* <Link href="/dashboard">
|
|
28
|
+
* <Text>Go to Dashboard</Text>
|
|
29
|
+
* </Link>
|
|
30
|
+
*
|
|
31
|
+
* // External link with target="_blank"
|
|
32
|
+
* <Link
|
|
33
|
+
* href="https://example.com"
|
|
34
|
+
* target="_blank"
|
|
35
|
+
* rel="noopener noreferrer"
|
|
36
|
+
* >
|
|
37
|
+
* <Text>External Link</Text>
|
|
38
|
+
* </Link>
|
|
39
|
+
*
|
|
40
|
+
* // With Chakra UI props
|
|
41
|
+
* <Link
|
|
42
|
+
* href="/profile"
|
|
43
|
+
* color="blue.500"
|
|
44
|
+
* fontSize="lg"
|
|
45
|
+
* _hover={{ textDecoration: 'underline' }}
|
|
46
|
+
* >
|
|
47
|
+
* <Text>Profile</Text>
|
|
48
|
+
* </Link>
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
interface LinkProps extends ChakraLinkProps {
|
|
52
|
+
/** The URL to navigate to. Can be internal route or external URL */
|
|
53
|
+
href: string;
|
|
54
|
+
/** The content to render inside the link */
|
|
55
|
+
children: React.ReactNode;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Enhanced Link component that combines Next.js routing with Chakra UI styling.
|
|
60
|
+
*
|
|
61
|
+
* Features:
|
|
62
|
+
* - Uses Next.js Link for client-side navigation
|
|
63
|
+
* - Applies Chakra UI styling and theme support
|
|
64
|
+
* - Supports all Chakra UI Link props (color, fontSize, _hover, etc.)
|
|
65
|
+
* - Automatically applies linkTextStyles
|
|
66
|
+
* - Handles both internal and external links seamlessly
|
|
67
|
+
*
|
|
68
|
+
* @param props - LinkProps object containing href, children, and optional Chakra UI props
|
|
69
|
+
* @returns A styled link component with Next.js routing capabilities
|
|
70
|
+
*/
|
|
71
|
+
export const Link = ({ href, children, ...rest }: LinkProps) => {
|
|
72
|
+
// Use Next.js Link if available, otherwise fall back to regular anchor
|
|
73
|
+
if (NextLink && href.startsWith('/')) {
|
|
74
|
+
return (
|
|
75
|
+
<ChakraLink
|
|
76
|
+
as={NextLink}
|
|
77
|
+
href={href}
|
|
78
|
+
passHref
|
|
79
|
+
{...linkTextStyles}
|
|
80
|
+
{...rest}
|
|
81
|
+
>
|
|
82
|
+
{children}
|
|
83
|
+
</ChakraLink>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Regular link for external URLs or when Next.js is not available
|
|
88
|
+
return (
|
|
89
|
+
<ChakraLink href={href} {...linkTextStyles} {...rest}>
|
|
90
|
+
{children}
|
|
91
|
+
</ChakraLink>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Link } from './Link';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box } from '@chakra-ui/react';
|
|
3
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
4
|
+
|
|
5
|
+
import { PageLoader } from './PageLoader';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof PageLoader> = {
|
|
8
|
+
title: 'Components/PageLoader',
|
|
9
|
+
component: PageLoader,
|
|
10
|
+
argTypes: {
|
|
11
|
+
isLoading: {
|
|
12
|
+
type: 'boolean',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryFn<typeof PageLoader>;
|
|
19
|
+
|
|
20
|
+
export const Basic: Story = (args) => {
|
|
21
|
+
return (
|
|
22
|
+
<Box position="relative" p="128px" bg="red">
|
|
23
|
+
<PageLoader {...args} />
|
|
24
|
+
</Box>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
Basic.args = {
|
|
28
|
+
isLoading: true,
|
|
29
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import BounceLoader from 'react-spinners/BounceLoader';
|
|
2
|
+
import { Box, Flex, FlexProps } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
import theme from '../../theme';
|
|
5
|
+
|
|
6
|
+
export const PageLoader = ({
|
|
7
|
+
isLoading,
|
|
8
|
+
...rest
|
|
9
|
+
}: FlexProps & { isLoading: boolean }) => {
|
|
10
|
+
return (
|
|
11
|
+
<Flex
|
|
12
|
+
position="fixed"
|
|
13
|
+
w="100vw"
|
|
14
|
+
h="100vh"
|
|
15
|
+
top={0}
|
|
16
|
+
left={0}
|
|
17
|
+
align="center"
|
|
18
|
+
justify="center"
|
|
19
|
+
opacity={isLoading ? 0.5 : 0}
|
|
20
|
+
transition="0.3s opacity ease"
|
|
21
|
+
bg={theme.colors.white}
|
|
22
|
+
zIndex={9999}
|
|
23
|
+
{...rest}
|
|
24
|
+
>
|
|
25
|
+
<Box position="relative">
|
|
26
|
+
<BounceLoader color={theme.colors.blue[500]} style={{ zIndex: 999 }} />
|
|
27
|
+
</Box>
|
|
28
|
+
</Flex>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box } from '@chakra-ui/react';
|
|
3
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
4
|
+
|
|
5
|
+
import { SectionLoader } from './SectionLoader';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof SectionLoader> = {
|
|
8
|
+
title: 'Components/SectionLoader',
|
|
9
|
+
component: SectionLoader,
|
|
10
|
+
argTypes: {
|
|
11
|
+
isLoading: {
|
|
12
|
+
type: 'boolean',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryFn<typeof SectionLoader>;
|
|
19
|
+
|
|
20
|
+
export const Basic: Story = (args) => {
|
|
21
|
+
return (
|
|
22
|
+
<Box position="relative" p="128px" bg="red">
|
|
23
|
+
<SectionLoader {...args} />
|
|
24
|
+
</Box>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import DotLoader from 'react-spinners/DotLoader';
|
|
2
|
+
import { Flex, FlexProps, useToken } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
import theme from '../../theme';
|
|
5
|
+
|
|
6
|
+
export const SectionLoader = ({
|
|
7
|
+
isLoading,
|
|
8
|
+
...rest
|
|
9
|
+
}: FlexProps & { isLoading: boolean }) => {
|
|
10
|
+
if (!isLoading) return;
|
|
11
|
+
return (
|
|
12
|
+
<Flex
|
|
13
|
+
position="absolute"
|
|
14
|
+
w="100%"
|
|
15
|
+
h="100%"
|
|
16
|
+
top={0}
|
|
17
|
+
left={0}
|
|
18
|
+
align="center"
|
|
19
|
+
justify="center"
|
|
20
|
+
bg="white"
|
|
21
|
+
transition="0.3 opacity ease"
|
|
22
|
+
zIndex={9999}
|
|
23
|
+
{...rest}
|
|
24
|
+
>
|
|
25
|
+
<DotLoader
|
|
26
|
+
color={useToken('colors', theme.semanticTokens.colors.primary.main)}
|
|
27
|
+
/>
|
|
28
|
+
</Flex>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PageLoader } from './PageLoader';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* MDXEditor popup container overrides */
|
|
2
|
+
[class*='_popupContainer_'] {
|
|
3
|
+
z-index: 9999 !important;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.mdxeditor-popup-container {
|
|
7
|
+
z-index: 9999 !important;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* MDXEditor select content overrides */
|
|
11
|
+
[class*='_selectContent_'] {
|
|
12
|
+
z-index: 9999 !important;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.mdxeditor-select-content {
|
|
16
|
+
z-index: 9999 !important;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
[data-radix-select-content] {
|
|
20
|
+
z-index: 9999 !important;
|
|
21
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { MDXEditor } from './MDXEditor';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Components/MDXEditor',
|
|
7
|
+
component: MDXEditor,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
} satisfies Meta<typeof MDXEditor>;
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
|
|
14
|
+
const sampleMarkdown = `# Hello World
|
|
15
|
+
This is a sample markdown text. You can:
|
|
16
|
+
- Make lists
|
|
17
|
+
- **Bold text**
|
|
18
|
+
- *Italic text*
|
|
19
|
+
- Create [links](https://example.com)
|
|
20
|
+
## Second Level Heading
|
|
21
|
+
> This is a blockquote
|
|
22
|
+
1. Numbered lists
|
|
23
|
+
2. Work too!
|
|
24
|
+
---
|
|
25
|
+
### Try the editor out!
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
markdown: sampleMarkdown,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const Empty: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
markdown: '',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const WithPlaceholder: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
markdown: '',
|
|
43
|
+
placeholder: '마크다운을 입력해보세요...',
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { Box, useTheme } from '@chakra-ui/react';
|
|
5
|
+
import {
|
|
6
|
+
BlockTypeSelect,
|
|
7
|
+
BoldItalicUnderlineToggles,
|
|
8
|
+
headingsPlugin,
|
|
9
|
+
listsPlugin,
|
|
10
|
+
markdownShortcutPlugin,
|
|
11
|
+
MDXEditor as Editor,
|
|
12
|
+
quotePlugin,
|
|
13
|
+
thematicBreakPlugin,
|
|
14
|
+
toolbarPlugin,
|
|
15
|
+
UndoRedo,
|
|
16
|
+
} from '@mdxeditor/editor';
|
|
17
|
+
|
|
18
|
+
import '@mdxeditor/editor/style.css';
|
|
19
|
+
import './MDXEditor.css';
|
|
20
|
+
|
|
21
|
+
import { type MDXEditorProps } from './MDXEditor.types';
|
|
22
|
+
|
|
23
|
+
export function MDXEditor({
|
|
24
|
+
containerProps,
|
|
25
|
+
autoFocus = true,
|
|
26
|
+
...rest
|
|
27
|
+
}: MDXEditorProps) {
|
|
28
|
+
const theme = useTheme();
|
|
29
|
+
const editorRef = useRef<any>(null);
|
|
30
|
+
|
|
31
|
+
const handleContainerClick = (e: React.MouseEvent) => {
|
|
32
|
+
// Only focus if clicking on the container itself, not on toolbar elements
|
|
33
|
+
const target = e.target as HTMLElement;
|
|
34
|
+
const isToolbarClick = target.closest('.toolbar');
|
|
35
|
+
|
|
36
|
+
if (!isToolbarClick && editorRef.current) {
|
|
37
|
+
editorRef.current.focus();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Box {...containerProps}>
|
|
43
|
+
<Box
|
|
44
|
+
width="100%"
|
|
45
|
+
borderWidth="1px"
|
|
46
|
+
borderRadius="lg"
|
|
47
|
+
overflow="hidden"
|
|
48
|
+
onClick={handleContainerClick}
|
|
49
|
+
cursor="text"
|
|
50
|
+
sx={{
|
|
51
|
+
...containerProps?.sx,
|
|
52
|
+
'.mdxeditor': {
|
|
53
|
+
width: '100%',
|
|
54
|
+
minHeight: '300px',
|
|
55
|
+
bg: theme.colors.white,
|
|
56
|
+
display: 'flex',
|
|
57
|
+
flexDirection: 'column',
|
|
58
|
+
},
|
|
59
|
+
'.toolbar': {
|
|
60
|
+
display: 'flex',
|
|
61
|
+
gap: theme.space[2],
|
|
62
|
+
p: theme.space[2],
|
|
63
|
+
borderBottomWidth: '1px',
|
|
64
|
+
bg: theme.colors.gray[50],
|
|
65
|
+
flexShrink: 0,
|
|
66
|
+
cursor: 'default',
|
|
67
|
+
},
|
|
68
|
+
// Target the root contenteditable wrapper
|
|
69
|
+
'[class*="_rootContentEditableWrapper_"]': {
|
|
70
|
+
flex: 1,
|
|
71
|
+
display: 'flex',
|
|
72
|
+
flexDirection: 'column',
|
|
73
|
+
minHeight: 0,
|
|
74
|
+
},
|
|
75
|
+
// Target the actual contenteditable element
|
|
76
|
+
'[contenteditable="true"]': {
|
|
77
|
+
flex: 1,
|
|
78
|
+
minHeight: '100%',
|
|
79
|
+
outline: 'none',
|
|
80
|
+
},
|
|
81
|
+
// Target any intermediate wrapper elements
|
|
82
|
+
'[class*="_contentEditable_"]': {
|
|
83
|
+
flex: 1,
|
|
84
|
+
display: 'flex',
|
|
85
|
+
flexDirection: 'column',
|
|
86
|
+
},
|
|
87
|
+
'.content-editable': {
|
|
88
|
+
padding: theme.space[4],
|
|
89
|
+
color: theme.colors.black,
|
|
90
|
+
display: 'flex',
|
|
91
|
+
flexDirection: 'column',
|
|
92
|
+
gap: theme.space[1.5],
|
|
93
|
+
flex: 1,
|
|
94
|
+
minHeight: '100%',
|
|
95
|
+
|
|
96
|
+
'h1, h2, h3, h4, h5': {
|
|
97
|
+
marginBottom: theme.space[0.5],
|
|
98
|
+
fontWeight: 'bold',
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
'h1:not(:first-child), h2:not(:first-child), h3:not(:first-child), h4:not(:first-child)':
|
|
102
|
+
{
|
|
103
|
+
marginTop: theme.space[1],
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
h1: {
|
|
107
|
+
fontSize: theme.fontSizes.h1,
|
|
108
|
+
},
|
|
109
|
+
h2: {
|
|
110
|
+
fontSize: theme.fontSizes.h2,
|
|
111
|
+
},
|
|
112
|
+
h3: {
|
|
113
|
+
fontSize: theme.fontSizes.h3,
|
|
114
|
+
},
|
|
115
|
+
h4: {
|
|
116
|
+
fontSize: theme.fontSizes.h4,
|
|
117
|
+
},
|
|
118
|
+
h5: {
|
|
119
|
+
fontSize: theme.fontSizes.h5,
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
'ol, ul': {
|
|
123
|
+
marginTop: theme.space[2],
|
|
124
|
+
paddingInlineStart: theme.space[4],
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
li: {
|
|
128
|
+
lineHeight: '1.5',
|
|
129
|
+
marginBottom: theme.space[2],
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
blockquote: {
|
|
133
|
+
borderLeftWidth: '4px',
|
|
134
|
+
borderLeftColor: theme.colors.blue[200],
|
|
135
|
+
bg: theme.colors.blue[50],
|
|
136
|
+
pl: theme.space[4],
|
|
137
|
+
py: theme.space[2],
|
|
138
|
+
my: theme.space[4],
|
|
139
|
+
color: theme.colors.gray[700],
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
a: {
|
|
143
|
+
color: theme.colors.blue[500],
|
|
144
|
+
textDecoration: 'underline',
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
code: {
|
|
148
|
+
fontFamily: 'mono',
|
|
149
|
+
bg: theme.colors.gray[100],
|
|
150
|
+
px: theme.space[1],
|
|
151
|
+
borderRadius: theme.radii.sm,
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
}}
|
|
155
|
+
>
|
|
156
|
+
<Editor
|
|
157
|
+
ref={editorRef}
|
|
158
|
+
contentEditableClassName="content-editable"
|
|
159
|
+
// @ts-expect-error - overlayContainer prop may not be available in this version
|
|
160
|
+
overlayContainer={
|
|
161
|
+
typeof document !== 'undefined' ? document.body : undefined
|
|
162
|
+
}
|
|
163
|
+
autoFocus={autoFocus}
|
|
164
|
+
plugins={[
|
|
165
|
+
headingsPlugin({
|
|
166
|
+
allowedHeadingLevels: [2, 3, 4, 5],
|
|
167
|
+
}),
|
|
168
|
+
listsPlugin(),
|
|
169
|
+
quotePlugin(),
|
|
170
|
+
thematicBreakPlugin(),
|
|
171
|
+
markdownShortcutPlugin(),
|
|
172
|
+
toolbarPlugin({
|
|
173
|
+
toolbarContents: () => (
|
|
174
|
+
<>
|
|
175
|
+
<UndoRedo />
|
|
176
|
+
<BoldItalicUnderlineToggles />
|
|
177
|
+
<BlockTypeSelect />
|
|
178
|
+
{/* <CreateLink />
|
|
179
|
+
<InsertImage /> */}
|
|
180
|
+
</>
|
|
181
|
+
),
|
|
182
|
+
}),
|
|
183
|
+
]}
|
|
184
|
+
{...rest}
|
|
185
|
+
/>
|
|
186
|
+
</Box>
|
|
187
|
+
</Box>
|
|
188
|
+
);
|
|
189
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MDXEditor } from './MDXEditor';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.markdownStyles {
|
|
2
|
+
color: black;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: 1.2em; /* Intended for longer form content like update modals */
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.markdownStyles > h1,
|
|
9
|
+
.markdownStyles > h2,
|
|
10
|
+
.markdownStyles > h3,
|
|
11
|
+
.markdownStyles > h4 {
|
|
12
|
+
margin-bottom: 0.5em !important;
|
|
13
|
+
}
|
|
14
|
+
.markdownStyles > h1:not(:first-child),
|
|
15
|
+
.markdownStyles > h2:not(:first-child),
|
|
16
|
+
.markdownStyles > h3:not(:first-child),
|
|
17
|
+
.markdownStyles > h4:not(:first-child) {
|
|
18
|
+
margin-top: 1em !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.markdownStyles ol,
|
|
22
|
+
.markdownStyles ul {
|
|
23
|
+
margin-top: 8px;
|
|
24
|
+
padding-inline-start: 16px;
|
|
25
|
+
}
|
|
26
|
+
.markdownStyles li {
|
|
27
|
+
/* 1.5x standard line height */
|
|
28
|
+
line-height: calc(16px * 1.5);
|
|
29
|
+
margin-bottom: 8px;
|
|
30
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import ReactMarkdown from 'react-markdown';
|
|
2
|
+
import { Box } from '@chakra-ui/react';
|
|
3
|
+
import rehypeKatex from 'rehype-katex';
|
|
4
|
+
import rehypeRaw from 'rehype-raw';
|
|
5
|
+
import remarkBreaks from 'remark-breaks';
|
|
6
|
+
import remarkFlexibleMarkers from 'remark-flexible-markers';
|
|
7
|
+
import remarkGfm from 'remark-gfm';
|
|
8
|
+
import remarkMath from 'remark-math';
|
|
9
|
+
|
|
10
|
+
import { formatForMarkdown } from '@/utils/formatTextForMarkdown';
|
|
11
|
+
|
|
12
|
+
import 'katex/dist/katex.min.css'; // Import KaTeX CSS
|
|
13
|
+
|
|
14
|
+
import { Code } from '../Code';
|
|
15
|
+
import { InlineCode } from '../InlineCode';
|
|
16
|
+
import { Table, TableContainer, Tbody, Td, Th, Thead, Tr } from '../Table';
|
|
17
|
+
import { H1, H2, H3, H4, H5, Link, Subtitle, Text } from '../Typography';
|
|
18
|
+
import MarkdownStyles from './Markdown.module.css';
|
|
19
|
+
import { MarkdownProps } from './Markdown.types';
|
|
20
|
+
|
|
21
|
+
// Simple wrapper components to avoid type issues
|
|
22
|
+
const H1Wrapper = (props: any) => <H1 {...props} />;
|
|
23
|
+
const H2Wrapper = (props: any) => <H2 {...props} />;
|
|
24
|
+
const H3Wrapper = (props: any) => <H3 {...props} />;
|
|
25
|
+
const H4Wrapper = (props: any) => <H4 {...props} />;
|
|
26
|
+
const H5Wrapper = (props: any) => <H5 {...props} />;
|
|
27
|
+
const SubtitleWrapper = (props: any) => <Subtitle {...props} />;
|
|
28
|
+
const TheadWrapper = (props: any) => <Thead {...props} />;
|
|
29
|
+
const TbodyWrapper = (props: any) => <Tbody {...props} />;
|
|
30
|
+
const TrWrapper = (props: any) => <Tr {...props} />;
|
|
31
|
+
const TdWrapper = (props: any) => <Td {...props} />;
|
|
32
|
+
const ThWrapper = (props: any) => <Th {...props} />;
|
|
33
|
+
|
|
34
|
+
// Prepare base components
|
|
35
|
+
export const baseMarkdownComponents = {
|
|
36
|
+
h1: H1Wrapper,
|
|
37
|
+
h2: H2Wrapper,
|
|
38
|
+
h3: H3Wrapper,
|
|
39
|
+
h4: H4Wrapper,
|
|
40
|
+
h5: H5Wrapper,
|
|
41
|
+
h6: SubtitleWrapper,
|
|
42
|
+
// The key fix: instead of trying to unwrap pre/code combinations,
|
|
43
|
+
// we customize just the code element to detect if it's a code block
|
|
44
|
+
code: ({ inline, className, children, ...props }: any) => {
|
|
45
|
+
// If it's inline code (no language class), use InlineCode component
|
|
46
|
+
if (inline || !className) {
|
|
47
|
+
return <InlineCode {...props}>{children}</InlineCode>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// For code blocks, use the Code component with language
|
|
51
|
+
const language = className.match(/language-(.*)/)?.[1];
|
|
52
|
+
return (
|
|
53
|
+
<Code
|
|
54
|
+
language={language}
|
|
55
|
+
onCopy={(textToCopy: string) => {
|
|
56
|
+
navigator.clipboard
|
|
57
|
+
.writeText(textToCopy)
|
|
58
|
+
.then(() => {
|
|
59
|
+
console.log('Text copied to clipboard');
|
|
60
|
+
})
|
|
61
|
+
.catch((err) => {
|
|
62
|
+
console.error('Could not copy text to clipboard:', err);
|
|
63
|
+
});
|
|
64
|
+
}}
|
|
65
|
+
containerProps={{ mb: 4, className }}
|
|
66
|
+
{...props}
|
|
67
|
+
>
|
|
68
|
+
{children}
|
|
69
|
+
</Code>
|
|
70
|
+
);
|
|
71
|
+
},
|
|
72
|
+
// Make the pre tag a no-op that just renders children
|
|
73
|
+
pre: ({ children }: any) => <Box>{children}</Box>,
|
|
74
|
+
p: (props: any) => <Text color="inherit" {...props} />,
|
|
75
|
+
a: ({ style, ...rest }: any) => (
|
|
76
|
+
// `children` should be inside ...rest
|
|
77
|
+
<Link target="_blank" {...rest} />
|
|
78
|
+
),
|
|
79
|
+
ol: ({ style, ...rest }: any) => (
|
|
80
|
+
<ol
|
|
81
|
+
style={{ paddingInlineStart: '22px', color: 'inherit', ...style }}
|
|
82
|
+
{...rest}
|
|
83
|
+
/>
|
|
84
|
+
),
|
|
85
|
+
ul: ({ style, ...rest }: any) => (
|
|
86
|
+
<ul
|
|
87
|
+
style={{ paddingInlineStart: '22px', color: 'inherit', ...style }}
|
|
88
|
+
{...rest}
|
|
89
|
+
/>
|
|
90
|
+
),
|
|
91
|
+
img: ({ style, ...rest }: any) => (
|
|
92
|
+
<img style={{ maxWidth: '100%', ...style }} alt="chat-image" {...rest} />
|
|
93
|
+
),
|
|
94
|
+
table: (props: any) => (
|
|
95
|
+
<TableContainer mt={4}>
|
|
96
|
+
<Table {...props} />
|
|
97
|
+
</TableContainer>
|
|
98
|
+
),
|
|
99
|
+
thead: TheadWrapper,
|
|
100
|
+
tbody: TbodyWrapper,
|
|
101
|
+
tr: TrWrapper,
|
|
102
|
+
td: TdWrapper,
|
|
103
|
+
th: ThWrapper,
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const Markdown = ({
|
|
107
|
+
className,
|
|
108
|
+
components,
|
|
109
|
+
children,
|
|
110
|
+
...rest
|
|
111
|
+
}: MarkdownProps) => {
|
|
112
|
+
// Combine with any custom components provided by the user
|
|
113
|
+
// The user-provided ones will override our defaults if there's a conflict
|
|
114
|
+
const allComponents = { ...baseMarkdownComponents, ...components };
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<div className={[MarkdownStyles.markdownStyles, className].join(' ')}>
|
|
118
|
+
<ReactMarkdown
|
|
119
|
+
remarkPlugins={[
|
|
120
|
+
remarkGfm,
|
|
121
|
+
remarkFlexibleMarkers,
|
|
122
|
+
remarkBreaks,
|
|
123
|
+
remarkMath,
|
|
124
|
+
]}
|
|
125
|
+
rehypePlugins={[rehypeRaw, rehypeKatex]}
|
|
126
|
+
components={allComponents}
|
|
127
|
+
{...rest}
|
|
128
|
+
>
|
|
129
|
+
{formatForMarkdown(children ?? '')}
|
|
130
|
+
</ReactMarkdown>
|
|
131
|
+
</div>
|
|
132
|
+
);
|
|
133
|
+
};
|