@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,28 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { FileInput, FileInputProps } from '.';
|
|
5
|
+
|
|
6
|
+
const meta: Meta = {
|
|
7
|
+
title: 'Components/FileInput',
|
|
8
|
+
component: FileInput,
|
|
9
|
+
args: {},
|
|
10
|
+
argTypes: {},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
|
|
15
|
+
type Story = StoryFn<FileInputProps>;
|
|
16
|
+
|
|
17
|
+
const Template: Story = ({ ...args }) => {
|
|
18
|
+
const [bgImage, setBgImage] = useState<string>();
|
|
19
|
+
const handleChange = (filePath: string) => {
|
|
20
|
+
if (filePath.startsWith('data:image')) {
|
|
21
|
+
setBgImage(filePath);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return <FileInput {...args} onChange={handleChange} bgImage={bgImage} />;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Basic = Template.bind({});
|
|
28
|
+
Basic.args = {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { ChangeEventHandler, forwardRef } from 'react';
|
|
2
|
+
import { Box, Flex, Input, useTheme } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
import { Icon, IconTypes } from '@/components/Icon';
|
|
5
|
+
import { Spinner } from '@/components/Spinner';
|
|
6
|
+
import { Text } from '@/components/Typography';
|
|
7
|
+
import { useTranslate } from '@/hooks/useTranslate';
|
|
8
|
+
|
|
9
|
+
import { FileInputProps } from './FileInput.types';
|
|
10
|
+
|
|
11
|
+
export const FileInput = forwardRef<HTMLInputElement, FileInputProps>(
|
|
12
|
+
(
|
|
13
|
+
{
|
|
14
|
+
fileInputLabel,
|
|
15
|
+
containerStyle = {},
|
|
16
|
+
bgImage,
|
|
17
|
+
onChange,
|
|
18
|
+
isLoading,
|
|
19
|
+
...rest
|
|
20
|
+
},
|
|
21
|
+
ref
|
|
22
|
+
) => {
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
const translate = useTranslate();
|
|
25
|
+
|
|
26
|
+
const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {
|
|
27
|
+
onChange(event.currentTarget.files);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Flex
|
|
32
|
+
role="button"
|
|
33
|
+
w="100%"
|
|
34
|
+
h="100%"
|
|
35
|
+
maxH={32}
|
|
36
|
+
flexDir="column"
|
|
37
|
+
align="center"
|
|
38
|
+
justify="center"
|
|
39
|
+
border="1px dashed"
|
|
40
|
+
borderColor="gray.500"
|
|
41
|
+
position="relative"
|
|
42
|
+
overflow="hidden"
|
|
43
|
+
borderRadius="md"
|
|
44
|
+
{...containerStyle}
|
|
45
|
+
>
|
|
46
|
+
<label
|
|
47
|
+
role="group"
|
|
48
|
+
style={{ width: '100%', height: '100%', cursor: 'pointer' }}
|
|
49
|
+
>
|
|
50
|
+
{bgImage && (
|
|
51
|
+
<Box
|
|
52
|
+
position="absolute"
|
|
53
|
+
top="0"
|
|
54
|
+
left="0"
|
|
55
|
+
right="0"
|
|
56
|
+
bottom="0"
|
|
57
|
+
backgroundImage={bgImage}
|
|
58
|
+
backgroundSize="cover"
|
|
59
|
+
backgroundPosition="center"
|
|
60
|
+
filter="grayscale(50%) brightness(80%)"
|
|
61
|
+
zIndex="-1"
|
|
62
|
+
/>
|
|
63
|
+
)}
|
|
64
|
+
<Input
|
|
65
|
+
type="file"
|
|
66
|
+
hidden
|
|
67
|
+
ref={ref} // ref 전달
|
|
68
|
+
onChange={handleChange}
|
|
69
|
+
{...rest}
|
|
70
|
+
/>
|
|
71
|
+
<Flex
|
|
72
|
+
w="100%"
|
|
73
|
+
h="100%"
|
|
74
|
+
p={7}
|
|
75
|
+
flexDir="column"
|
|
76
|
+
justify="center"
|
|
77
|
+
align="center"
|
|
78
|
+
bgColor={`${theme.colors.white}da`}
|
|
79
|
+
opacity={bgImage ? 0 : 1}
|
|
80
|
+
transition="ease-in"
|
|
81
|
+
_groupHover={{ opacity: 1 }} // Set opacity to 1 on parent hover
|
|
82
|
+
>
|
|
83
|
+
{isLoading ? (
|
|
84
|
+
<Spinner />
|
|
85
|
+
) : (
|
|
86
|
+
<Flex w="100%" flexDir="column" align="center" justify="center">
|
|
87
|
+
<Box
|
|
88
|
+
borderRadius="lg"
|
|
89
|
+
bgColor={bgImage ? 'transparent' : 'gray.50'}
|
|
90
|
+
p={3}
|
|
91
|
+
mb={1}
|
|
92
|
+
w="fit-content"
|
|
93
|
+
>
|
|
94
|
+
<Icon
|
|
95
|
+
icon={IconTypes.LuUpload}
|
|
96
|
+
color={
|
|
97
|
+
bgImage ? theme.colors.gray[1200] : theme.colors.gray[800]
|
|
98
|
+
}
|
|
99
|
+
/>
|
|
100
|
+
</Box>
|
|
101
|
+
<Text
|
|
102
|
+
color={
|
|
103
|
+
bgImage ? theme.colors.gray[1200] : theme.colors.gray[800]
|
|
104
|
+
}
|
|
105
|
+
>
|
|
106
|
+
{fileInputLabel || translate('upload_your_file')}
|
|
107
|
+
</Text>
|
|
108
|
+
</Flex>
|
|
109
|
+
)}
|
|
110
|
+
</Flex>
|
|
111
|
+
</label>
|
|
112
|
+
</Flex>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
FileInput.displayName = 'FileInput';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FlexProps } from '@chakra-ui/react';
|
|
2
|
+
|
|
3
|
+
import { InputProps } from '@/components/Input';
|
|
4
|
+
|
|
5
|
+
export type FileInputProps = Omit<InputProps, 'onChange' | 'bgImage'> & {
|
|
6
|
+
fileInputLabel?: string;
|
|
7
|
+
containerStyle?: FlexProps;
|
|
8
|
+
onChange: (files: FileList | null) => void;
|
|
9
|
+
/**
|
|
10
|
+
* background image change
|
|
11
|
+
*/
|
|
12
|
+
bgImage?: string;
|
|
13
|
+
isLoading?: boolean;
|
|
14
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { FileItemProps } from '@/components/FileItem/FileItem.types';
|
|
4
|
+
|
|
5
|
+
import { FileItem } from './FileItem';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof FileItem> = {
|
|
8
|
+
title: 'Components/FileItem',
|
|
9
|
+
component: FileItem,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
|
|
14
|
+
type Story = StoryObj<FileItemProps>;
|
|
15
|
+
|
|
16
|
+
export const Basic: Story = {
|
|
17
|
+
args: {
|
|
18
|
+
fileName: 'Test File',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const WithProgress: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
fileName: 'Test File',
|
|
25
|
+
progress: 30,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Fragment } from 'react';
|
|
2
|
+
import { Box, Flex, useTheme } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
import { FileItemProps } from '@/components/FileItem/FileItem.types';
|
|
5
|
+
import { Icon, IconTypes } from '@/components/Icon';
|
|
6
|
+
import { IconButton } from '@/components/IconButton';
|
|
7
|
+
import { ProgressBar } from '@/components/ProgressBar';
|
|
8
|
+
import { Subtext, Subtitle, Text } from '@/components/Typography';
|
|
9
|
+
import { formatFileSize } from '@/utils/formatFileSize';
|
|
10
|
+
|
|
11
|
+
import { Spinner } from '../Spinner';
|
|
12
|
+
import { Tooltip } from '../Tooltip';
|
|
13
|
+
|
|
14
|
+
export const FileItem = ({
|
|
15
|
+
fileName,
|
|
16
|
+
error,
|
|
17
|
+
onFileDownload,
|
|
18
|
+
onFileDelete,
|
|
19
|
+
progress,
|
|
20
|
+
fileSize,
|
|
21
|
+
isDeleting = false,
|
|
22
|
+
...rest
|
|
23
|
+
}: FileItemProps) => {
|
|
24
|
+
const theme = useTheme();
|
|
25
|
+
const errorColor = 'danger.main';
|
|
26
|
+
|
|
27
|
+
const isUploadingFile =
|
|
28
|
+
!error && typeof progress === 'number' && progress >= 0 && progress < 100;
|
|
29
|
+
const isFileUploadComplete = !progress || error || progress === 100;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Flex
|
|
33
|
+
px={3}
|
|
34
|
+
py={2}
|
|
35
|
+
gap={2}
|
|
36
|
+
justifyContent="space-between"
|
|
37
|
+
alignItems="center"
|
|
38
|
+
border="1px solid"
|
|
39
|
+
borderColor="gray.200"
|
|
40
|
+
w="100%"
|
|
41
|
+
position="relative"
|
|
42
|
+
_before={{
|
|
43
|
+
content: '""',
|
|
44
|
+
position: 'absolute',
|
|
45
|
+
top: 0,
|
|
46
|
+
bottom: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
width: '3px',
|
|
49
|
+
backgroundColor: error ? errorColor : 'transparent',
|
|
50
|
+
}}
|
|
51
|
+
{...rest}
|
|
52
|
+
>
|
|
53
|
+
<Flex w="60%" alignItems="center" gap={2}>
|
|
54
|
+
<Box minW={5}>
|
|
55
|
+
<Icon
|
|
56
|
+
icon={IconTypes.CiFileOn}
|
|
57
|
+
color={error ? errorColor : 'gray.800'}
|
|
58
|
+
/>
|
|
59
|
+
</Box>
|
|
60
|
+
<Text isTruncated color={error ? errorColor : undefined}>
|
|
61
|
+
{fileName}
|
|
62
|
+
</Text>
|
|
63
|
+
</Flex>
|
|
64
|
+
<Flex align="center" gap={2} flex={1}>
|
|
65
|
+
{error ? (
|
|
66
|
+
<Flex w="100%" justify="flex-end" align="center" gap={2}>
|
|
67
|
+
<Tooltip label={error} placement="top" shouldWrapChildren>
|
|
68
|
+
<Icon icon="MdError" color={errorColor} />
|
|
69
|
+
</Tooltip>
|
|
70
|
+
{/* TODO: implement retry button */}
|
|
71
|
+
</Flex>
|
|
72
|
+
) : (
|
|
73
|
+
<Box w="100%">
|
|
74
|
+
{isUploadingFile && (
|
|
75
|
+
<Flex align="center" justify="flex-end" gap={2}>
|
|
76
|
+
<Subtext>{progress}%</Subtext>
|
|
77
|
+
<ProgressBar w="100%" minW={3} maxW={20} value={progress} />
|
|
78
|
+
<Spinner size="xs" />
|
|
79
|
+
<IconButton
|
|
80
|
+
aria-label={'remove uploading file button'}
|
|
81
|
+
onClick={onFileDelete}
|
|
82
|
+
icon={
|
|
83
|
+
<Icon
|
|
84
|
+
icon={IconTypes.IoClose}
|
|
85
|
+
color={theme.colors.gray[600]}
|
|
86
|
+
boxSize="lg"
|
|
87
|
+
/>
|
|
88
|
+
}
|
|
89
|
+
size="xs"
|
|
90
|
+
isDisabled={isDeleting}
|
|
91
|
+
/>
|
|
92
|
+
</Flex>
|
|
93
|
+
)}
|
|
94
|
+
</Box>
|
|
95
|
+
)}
|
|
96
|
+
{!isUploadingFile && isFileUploadComplete && (
|
|
97
|
+
<Fragment>
|
|
98
|
+
{fileSize && <Subtitle mr={4}>{formatFileSize(fileSize)}</Subtitle>}
|
|
99
|
+
{onFileDownload && !error && (
|
|
100
|
+
<IconButton
|
|
101
|
+
aria-label={'download uploaded file button'}
|
|
102
|
+
onClick={onFileDownload}
|
|
103
|
+
icon={
|
|
104
|
+
<Icon
|
|
105
|
+
icon={IconTypes.LuDownload}
|
|
106
|
+
color={theme.colors.gray[800]}
|
|
107
|
+
/>
|
|
108
|
+
}
|
|
109
|
+
size="xs"
|
|
110
|
+
/>
|
|
111
|
+
)}
|
|
112
|
+
{onFileDelete && (
|
|
113
|
+
<IconButton
|
|
114
|
+
aria-label={'remove uploaded file button'}
|
|
115
|
+
onClick={onFileDelete}
|
|
116
|
+
icon={
|
|
117
|
+
isDeleting ? (
|
|
118
|
+
<Spinner size="xs" />
|
|
119
|
+
) : (
|
|
120
|
+
<Icon icon={IconTypes.FaRegTrashAlt} boxSize="sm" />
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
size="xs"
|
|
124
|
+
isDisabled={isDeleting}
|
|
125
|
+
/>
|
|
126
|
+
)}
|
|
127
|
+
</Fragment>
|
|
128
|
+
)}
|
|
129
|
+
</Flex>
|
|
130
|
+
</Flex>
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
FileItem.displayName = 'FileItem';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FlexProps } from '@chakra-ui/react';
|
|
2
|
+
|
|
3
|
+
export interface FileItemProps extends FlexProps {
|
|
4
|
+
fileName: string;
|
|
5
|
+
error?: string;
|
|
6
|
+
onFileDownload?: () => void;
|
|
7
|
+
onFileDelete?: () => void;
|
|
8
|
+
progress?: number;
|
|
9
|
+
fileSize?: number; // in bytes
|
|
10
|
+
isDeleting?: boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FileItem } from './FileItem';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
FileGroupProps,
|
|
6
|
+
FileItemData,
|
|
7
|
+
} from '@/components/FileList/FileList.types';
|
|
8
|
+
|
|
9
|
+
import { FileList } from './FileList';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: 'Components/FileList',
|
|
13
|
+
component: FileList,
|
|
14
|
+
} as Meta;
|
|
15
|
+
|
|
16
|
+
const Template: StoryFn<FileGroupProps> = ({ ...args }) => {
|
|
17
|
+
const [files, setFiles] = useState<FileItemData[]>(args.files);
|
|
18
|
+
const [visibleCount, setVisibleCount] = useState(3);
|
|
19
|
+
|
|
20
|
+
const handleFileDelete = (currentFile: FileItemData) => {
|
|
21
|
+
setFiles((prevFiles) =>
|
|
22
|
+
prevFiles.filter((file) => file.id !== currentFile.id)
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<FileList
|
|
28
|
+
{...args}
|
|
29
|
+
files={files}
|
|
30
|
+
onFileDelete={handleFileDelete}
|
|
31
|
+
visibleCount={visibleCount}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Default = Template.bind({});
|
|
37
|
+
Default.args = {
|
|
38
|
+
files: [
|
|
39
|
+
{
|
|
40
|
+
id: 1,
|
|
41
|
+
name: 'File1.pdf',
|
|
42
|
+
progress: 100,
|
|
43
|
+
error: false,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 2,
|
|
47
|
+
name: 'Image.png',
|
|
48
|
+
progress: 70,
|
|
49
|
+
error: false,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 3,
|
|
53
|
+
name: 'Document.docx',
|
|
54
|
+
progress: 45,
|
|
55
|
+
error: true,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 4,
|
|
59
|
+
name: 'Presentation.pptx',
|
|
60
|
+
progress: 80,
|
|
61
|
+
error: false,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
visibleCount: 3,
|
|
65
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Button, List, useTheme } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
import { FileItem } from '@/components/FileItem';
|
|
5
|
+
import { FileGroupProps } from '@/components/FileList/FileList.types';
|
|
6
|
+
import { Icon, IconTypes } from '@/components/Icon';
|
|
7
|
+
import { Subtitle } from '@/components/Typography';
|
|
8
|
+
import { useTranslate } from '@/hooks/useTranslate';
|
|
9
|
+
|
|
10
|
+
export const FileList = ({
|
|
11
|
+
files,
|
|
12
|
+
onFileDelete,
|
|
13
|
+
onFileDownload,
|
|
14
|
+
visibleCount = 3,
|
|
15
|
+
}: FileGroupProps) => {
|
|
16
|
+
const [currentVisibleCount, setCurrentVisibleCount] = useState<number>(
|
|
17
|
+
visibleCount ?? 3
|
|
18
|
+
);
|
|
19
|
+
const [deletingFileIds, setDeletingFileIds] = useState<Set<number | null>>(
|
|
20
|
+
new Set()
|
|
21
|
+
);
|
|
22
|
+
const theme = useTheme();
|
|
23
|
+
const translate = useTranslate();
|
|
24
|
+
const shouldShowLoadMoreButton = files && files.length > currentVisibleCount;
|
|
25
|
+
|
|
26
|
+
const handleFileLoadMore = () => {
|
|
27
|
+
setCurrentVisibleCount((prev) => prev + 3);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const handleFileDelete = async (file: FileGroupProps['files'][0]) => {
|
|
31
|
+
if (!onFileDelete || deletingFileIds.has(file.id)) return;
|
|
32
|
+
|
|
33
|
+
setDeletingFileIds((prev) => new Set(prev).add(file.id));
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
await onFileDelete(file);
|
|
37
|
+
} finally {
|
|
38
|
+
setDeletingFileIds((prev) => {
|
|
39
|
+
const newSet = new Set(prev);
|
|
40
|
+
newSet.delete(file.id);
|
|
41
|
+
return newSet;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
if (files?.length <= 0) return null;
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<List
|
|
50
|
+
w="100%"
|
|
51
|
+
border="1px solid"
|
|
52
|
+
borderColor="gray.200"
|
|
53
|
+
borderRadius="md"
|
|
54
|
+
overflow="hidden"
|
|
55
|
+
>
|
|
56
|
+
{files?.slice(0, currentVisibleCount).map((file) => (
|
|
57
|
+
<FileItem
|
|
58
|
+
key={file.id}
|
|
59
|
+
fileName={file.name}
|
|
60
|
+
onFileDelete={onFileDelete ? () => handleFileDelete(file) : undefined}
|
|
61
|
+
onFileDownload={
|
|
62
|
+
onFileDownload && file.fileUrl
|
|
63
|
+
? () => onFileDownload?.(file)
|
|
64
|
+
: undefined
|
|
65
|
+
}
|
|
66
|
+
border={0}
|
|
67
|
+
borderBottom="1px solid"
|
|
68
|
+
borderBottomColor="gray.50"
|
|
69
|
+
progress={file.progress}
|
|
70
|
+
error={file.error}
|
|
71
|
+
fileSize={file.size}
|
|
72
|
+
isDeleting={deletingFileIds.has(file.id)}
|
|
73
|
+
/>
|
|
74
|
+
))}
|
|
75
|
+
{shouldShowLoadMoreButton && (
|
|
76
|
+
<Button
|
|
77
|
+
onClick={handleFileLoadMore}
|
|
78
|
+
alignSelf="stretch"
|
|
79
|
+
w="100%"
|
|
80
|
+
variant="unstyled"
|
|
81
|
+
display="flex"
|
|
82
|
+
gap={1}
|
|
83
|
+
>
|
|
84
|
+
<Subtitle color="gray.600">
|
|
85
|
+
{translate('see_more')} ({visibleCount}/{files.length})
|
|
86
|
+
</Subtitle>
|
|
87
|
+
<Icon
|
|
88
|
+
icon={IconTypes.IoChevronDownOutline}
|
|
89
|
+
color={theme.colors.gray[600]}
|
|
90
|
+
/>
|
|
91
|
+
</Button>
|
|
92
|
+
)}
|
|
93
|
+
</List>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
FileList.displayName = 'FileList';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface FileItemData {
|
|
2
|
+
error?: string;
|
|
3
|
+
errorCode?: number | null;
|
|
4
|
+
progress?: number;
|
|
5
|
+
id: number | null;
|
|
6
|
+
fileUrl?: string;
|
|
7
|
+
name: string;
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
timeStamp?: string;
|
|
10
|
+
size?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface FileGroupProps {
|
|
14
|
+
files: FileItemData[];
|
|
15
|
+
onFileDelete?: (file: FileItemData) => void;
|
|
16
|
+
onFileDownload?: (file: FileItemData) => void;
|
|
17
|
+
visibleCount?: number;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FileList } from './FileList';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { FormControl } from './FormControl';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/FormControl',
|
|
8
|
+
component: FormControl,
|
|
9
|
+
} as ComponentMeta<typeof FormControl>;
|
|
10
|
+
|
|
11
|
+
const Template: ComponentStory<typeof FormControl> = (args) => (
|
|
12
|
+
<FormControl {...args} />
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const Default = Template.bind({});
|
|
16
|
+
Default.args = {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ForwardedRef, forwardRef } from 'react';
|
|
2
|
+
import { FormControl as ChakraFormControl } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
import { FormControlProps } from './FormControl.types';
|
|
5
|
+
|
|
6
|
+
export const FormControl = forwardRef(
|
|
7
|
+
({ ...rest }: FormControlProps, ref?: ForwardedRef<HTMLDivElement>) => {
|
|
8
|
+
return <ChakraFormControl noValidate {...rest} ref={ref} />;
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
FormControl.displayName = 'FormControl';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FormLabel } from './FormLabel';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
import { Box, Flex } from '@chakra-ui/react';
|
|
3
|
+
import { StoryFn } from '@storybook/react';
|
|
4
|
+
|
|
5
|
+
import { Button } from '../Button';
|
|
6
|
+
import { GuideCue } from './GuideCue';
|
|
7
|
+
import { GuideCueProvider } from './GuideCueContext';
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Components/GuideCue',
|
|
10
|
+
component: GuideCue,
|
|
11
|
+
args: {
|
|
12
|
+
page: 'storybook',
|
|
13
|
+
index: 0,
|
|
14
|
+
title: 'Hello',
|
|
15
|
+
description: 'This is a description',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const Template: StoryFn<typeof GuideCue> = (args) => {
|
|
20
|
+
const containerRef = useRef<HTMLButtonElement>(null);
|
|
21
|
+
return (
|
|
22
|
+
<GuideCueProvider page="storybook" numSteps={1}>
|
|
23
|
+
<Box p={20}>
|
|
24
|
+
<Button ref={containerRef} mb={20} position="relative">
|
|
25
|
+
Trigger
|
|
26
|
+
</Button>
|
|
27
|
+
<GuideCue {...args} containerRef={containerRef} />
|
|
28
|
+
</Box>
|
|
29
|
+
</GuideCueProvider>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const Default = Template.bind({});
|
|
34
|
+
|
|
35
|
+
export const MultipleSteps: StoryFn<typeof GuideCue> = (args) => {
|
|
36
|
+
const step1Ref = useRef<HTMLButtonElement>(null);
|
|
37
|
+
const step2Ref = useRef<HTMLButtonElement>(null);
|
|
38
|
+
return (
|
|
39
|
+
<GuideCueProvider page="storybook" numSteps={2}>
|
|
40
|
+
<Flex p={20} gap={4}>
|
|
41
|
+
<Button ref={step1Ref} mb={20} position="relative">
|
|
42
|
+
Bottom popover step
|
|
43
|
+
</Button>
|
|
44
|
+
<Button ref={step2Ref} mb={20} position="relative">
|
|
45
|
+
Right popover step
|
|
46
|
+
</Button>
|
|
47
|
+
<GuideCue {...args} index={0} containerRef={step1Ref} />
|
|
48
|
+
<GuideCue
|
|
49
|
+
{...args}
|
|
50
|
+
index={1}
|
|
51
|
+
containerRef={step2Ref}
|
|
52
|
+
placement="right"
|
|
53
|
+
/>
|
|
54
|
+
</Flex>
|
|
55
|
+
</GuideCueProvider>
|
|
56
|
+
);
|
|
57
|
+
};
|