@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,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Container as ChakraContainer, ContainerProps } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
import useContainerSize from './useContainerSize';
|
|
5
|
+
|
|
6
|
+
export const Container = ({
|
|
7
|
+
style,
|
|
8
|
+
disableResponsive,
|
|
9
|
+
...rest
|
|
10
|
+
}: ContainerProps & { disableResponsive?: boolean }) => {
|
|
11
|
+
const containerSize = useContainerSize();
|
|
12
|
+
return (
|
|
13
|
+
<ChakraContainer
|
|
14
|
+
style={{
|
|
15
|
+
...style,
|
|
16
|
+
...(disableResponsive ? {} : { minWidth: `${containerSize}px` }),
|
|
17
|
+
}}
|
|
18
|
+
{...rest}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Container } from './Container';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import theme from '@/theme/index';
|
|
5
|
+
|
|
6
|
+
// TODO: make this logic smarter or use something reusable
|
|
7
|
+
// ratio minimum gutter on each side as decimal (i.e. 1 == 100%)
|
|
8
|
+
const GUTTER_RATIO = 0.1;
|
|
9
|
+
|
|
10
|
+
// TODO: optimize this so this calculation only runs once per page
|
|
11
|
+
export const getContainerWidth: (screenSize: number) => number = (
|
|
12
|
+
screenSize
|
|
13
|
+
) => {
|
|
14
|
+
const largestBreakpoint = Object.values(theme.breakpoints).reduce(function (
|
|
15
|
+
i: number,
|
|
16
|
+
j: string
|
|
17
|
+
) {
|
|
18
|
+
const breakpoint = parseInt(j, 10);
|
|
19
|
+
const screenThreshold = screenSize * (1 - GUTTER_RATIO * 2);
|
|
20
|
+
return breakpoint < screenThreshold ? Math.max(i, breakpoint) : i;
|
|
21
|
+
}, 0) as number;
|
|
22
|
+
|
|
23
|
+
return largestBreakpoint;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const useContainerSize = () => {
|
|
27
|
+
const [containerSize, setContainerSize] = useState<number>();
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const handleResize = () => {
|
|
31
|
+
setContainerSize(getContainerWidth(window.innerWidth));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
handleResize();
|
|
35
|
+
|
|
36
|
+
window.addEventListener('resize', handleResize);
|
|
37
|
+
|
|
38
|
+
// Clean up the event listener when the component unmounts
|
|
39
|
+
return () => {
|
|
40
|
+
window.removeEventListener('resize', handleResize);
|
|
41
|
+
};
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
return containerSize;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default useContainerSize;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { CopyableCode } from './CopyableCode';
|
|
5
|
+
import { CopyableCodeProps } from './CopyableCode.types';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof CopyableCode> = {
|
|
8
|
+
title: 'Components/CopyableCode',
|
|
9
|
+
component: CopyableCode,
|
|
10
|
+
args: {
|
|
11
|
+
children: `const example = 'This is a code example';
|
|
12
|
+
console.log(example);`,
|
|
13
|
+
onCopy: () => {
|
|
14
|
+
console.log('Code copied to clipboard');
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
|
|
21
|
+
const Template: StoryFn<CopyableCodeProps> = (args: CopyableCodeProps) => (
|
|
22
|
+
<CopyableCode {...args} />
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export const Basic: StoryFn<CopyableCodeProps> = Template.bind({});
|
|
26
|
+
Basic.args = {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Box, Flex } from '@chakra-ui/react';
|
|
2
|
+
|
|
3
|
+
import { useTranslate } from '@/hooks/useTranslate';
|
|
4
|
+
|
|
5
|
+
import { Button } from '../Button';
|
|
6
|
+
import { Card } from '../Card';
|
|
7
|
+
import { Icon } from '../Icon';
|
|
8
|
+
import { CopyableCodeProps } from './CopyableCode.types';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Intended for a quick one-click copy of one-liner code snippets.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <CopyableCode onCopy={() => {}}>
|
|
15
|
+
* {`const example = 'This is a code example';
|
|
16
|
+
* console.log(example);`}
|
|
17
|
+
* </CopyableCode>
|
|
18
|
+
*/
|
|
19
|
+
export const CopyableCode = ({
|
|
20
|
+
children,
|
|
21
|
+
onCopy,
|
|
22
|
+
containerProps,
|
|
23
|
+
}: CopyableCodeProps) => {
|
|
24
|
+
const translate = useTranslate();
|
|
25
|
+
return (
|
|
26
|
+
<Flex position="relative" width="100%" {...containerProps}>
|
|
27
|
+
<Card overflow="hidden" maxW="100%" p={0} width="100%">
|
|
28
|
+
<Box as="pre" whiteSpace="nowrap" overflowX="scroll" p={4} pr={20}>
|
|
29
|
+
{children}
|
|
30
|
+
</Box>
|
|
31
|
+
<Box
|
|
32
|
+
position="absolute"
|
|
33
|
+
right={0}
|
|
34
|
+
top={0}
|
|
35
|
+
bottom={0}
|
|
36
|
+
w={24}
|
|
37
|
+
bg="linear-gradient(to right, transparent, #fff 15%)"
|
|
38
|
+
pointerEvents="none"
|
|
39
|
+
/>
|
|
40
|
+
</Card>
|
|
41
|
+
<Button
|
|
42
|
+
variant="primary"
|
|
43
|
+
bgColor="primary.dark"
|
|
44
|
+
borderColor="primary.dark"
|
|
45
|
+
size="xs"
|
|
46
|
+
leftIcon={<Icon icon="FaRegCopy" boxSize="xs" />}
|
|
47
|
+
onClick={onCopy}
|
|
48
|
+
position="absolute"
|
|
49
|
+
right={4}
|
|
50
|
+
top="50%"
|
|
51
|
+
transform="translateY(-50%)"
|
|
52
|
+
zIndex={1}
|
|
53
|
+
>
|
|
54
|
+
{translate('copy')}
|
|
55
|
+
</Button>
|
|
56
|
+
</Flex>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useTranslate } from '@/hooks/useTranslate';
|
|
4
|
+
|
|
5
|
+
import { useToast } from '../Toast/useToast';
|
|
6
|
+
// Optional Next.js navigation import
|
|
7
|
+
let useSearchParams: any;
|
|
8
|
+
try {
|
|
9
|
+
useSearchParams = require('next/navigation').useSearchParams;
|
|
10
|
+
} catch {
|
|
11
|
+
useSearchParams = () => ({ get: () => null });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Separate any cross-page toasts sent using the message query param to ensure these can be wrapped with Suspense tags.
|
|
16
|
+
*/
|
|
17
|
+
export function CrossPageToasts() {
|
|
18
|
+
const translate = useTranslate();
|
|
19
|
+
const pushToast = useToast();
|
|
20
|
+
const searchParams = useSearchParams();
|
|
21
|
+
const message = searchParams.get('message'); // Retrieve message with Suspense support
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const timeout = setTimeout(() => {
|
|
25
|
+
if (message) {
|
|
26
|
+
pushToast({ description: translate(message) as string });
|
|
27
|
+
}
|
|
28
|
+
}, 500);
|
|
29
|
+
return () => clearTimeout(timeout);
|
|
30
|
+
}, [message]);
|
|
31
|
+
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CrossPageToasts } from './CrossPageToasts';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { H1 } from '../Typography';
|
|
4
|
+
import { DataField } from './DataField';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof DataField> = {
|
|
7
|
+
title: 'Components/DataField',
|
|
8
|
+
component: DataField,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryFn<typeof DataField>;
|
|
13
|
+
|
|
14
|
+
export const Basic: Story = {
|
|
15
|
+
args: {
|
|
16
|
+
label: 'Session name',
|
|
17
|
+
value: 'test-test-test',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const EditableField: Story = {
|
|
22
|
+
args: {
|
|
23
|
+
...Basic.args,
|
|
24
|
+
isEditable: true,
|
|
25
|
+
onChange: (val) => console.log(val),
|
|
26
|
+
editableProps: {
|
|
27
|
+
onSubmit: (e) => console.log(e),
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const EditableHeaderField: Story = {
|
|
33
|
+
args: {
|
|
34
|
+
...Basic.args,
|
|
35
|
+
isEditable: true,
|
|
36
|
+
as: H1,
|
|
37
|
+
onChange: (val) => console.log(val),
|
|
38
|
+
editableProps: {
|
|
39
|
+
onSubmit: (e) => console.log(e),
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const CopyableField: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
...Basic.args,
|
|
47
|
+
isCopyable: true,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const EditableCopyableField: Story = {
|
|
52
|
+
args: {
|
|
53
|
+
...Basic.args,
|
|
54
|
+
isEditable: true,
|
|
55
|
+
onChange: (val) => console.log(val),
|
|
56
|
+
editableProps: {
|
|
57
|
+
onSubmit: (val) => console.log(val),
|
|
58
|
+
},
|
|
59
|
+
isCopyable: true,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as CSS from 'csstype';
|
|
2
|
+
|
|
3
|
+
import theme from '@/theme/index';
|
|
4
|
+
|
|
5
|
+
export const editableStyles = {
|
|
6
|
+
display: 'flex',
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
gap: 4, // Use direct spacing value instead of theme.spacing[4]
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const previewWrapperStyles = {
|
|
12
|
+
display: 'inline-flex',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const editablePreviewStyles = {
|
|
16
|
+
transition: '0.3s border',
|
|
17
|
+
borderColor: 'transparent',
|
|
18
|
+
overflowWrap: 'anywhere' as CSS.Property.OverflowWrap,
|
|
19
|
+
_hover: {
|
|
20
|
+
borderColor: 'inherit',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const inputStyles = {
|
|
25
|
+
maxWidth: '100%',
|
|
26
|
+
display: 'inline',
|
|
27
|
+
styles: {
|
|
28
|
+
boxSizing: 'content-box',
|
|
29
|
+
},
|
|
30
|
+
_focus: {
|
|
31
|
+
backgroundColor: theme.colors.white,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { useRef, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Editable,
|
|
5
|
+
EditableInput,
|
|
6
|
+
EditablePreview,
|
|
7
|
+
Tooltip,
|
|
8
|
+
} from '@chakra-ui/react';
|
|
9
|
+
|
|
10
|
+
import { AutowidthInput } from '@/components/AutowidthInput';
|
|
11
|
+
import {
|
|
12
|
+
editablePreviewStyles,
|
|
13
|
+
editableStyles,
|
|
14
|
+
inputStyles,
|
|
15
|
+
previewWrapperStyles,
|
|
16
|
+
} from '@/components/DataField/DataField.styles';
|
|
17
|
+
import { DataFieldProps } from '@/components/DataField/DataField.types';
|
|
18
|
+
import { IconButton } from '@/components/IconButton';
|
|
19
|
+
import { Text } from '@/components/Typography';
|
|
20
|
+
|
|
21
|
+
import { Icon } from '../Icon';
|
|
22
|
+
|
|
23
|
+
const TOOLTIP_DISPLAY_TIME = 3000;
|
|
24
|
+
|
|
25
|
+
export const DataField = ({
|
|
26
|
+
label,
|
|
27
|
+
value,
|
|
28
|
+
inputProps: inputPropsProp, // only relevant if `isEditable`
|
|
29
|
+
editableProps, // only relevant if `isEditable`
|
|
30
|
+
editablePreviewProps, // only relevant if `isEditable`
|
|
31
|
+
onChange,
|
|
32
|
+
as,
|
|
33
|
+
isCopyable = false,
|
|
34
|
+
isEditable = false,
|
|
35
|
+
allowEmpty = false,
|
|
36
|
+
}: DataFieldProps) => {
|
|
37
|
+
const previewRef = useRef<HTMLDivElement>(null);
|
|
38
|
+
const [hasOpenCopyTooltip, setOpenCopyTooltip] = useState<boolean>(false);
|
|
39
|
+
const [initialValue, setInitialValue] = useState<string>(value);
|
|
40
|
+
const { onBlur, ...inputProps } = inputPropsProp ?? {};
|
|
41
|
+
|
|
42
|
+
const handleCopyButtonClick = () => {
|
|
43
|
+
navigator.clipboard.writeText(value);
|
|
44
|
+
setOpenCopyTooltip(true);
|
|
45
|
+
const timeout = setTimeout(() => {
|
|
46
|
+
setOpenCopyTooltip(false);
|
|
47
|
+
clearTimeout(timeout);
|
|
48
|
+
}, TOOLTIP_DISPLAY_TIME);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const handleEditButtonClick = () => {
|
|
52
|
+
previewRef.current?.focus();
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
56
|
+
onChange?.(e.target.value);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const actIfAllowed = (
|
|
60
|
+
fn: ((value: string) => void) | undefined,
|
|
61
|
+
newValue: string
|
|
62
|
+
) => {
|
|
63
|
+
if (!allowEmpty && newValue.length < 1) {
|
|
64
|
+
// act with initial value if not allowed
|
|
65
|
+
fn?.(initialValue);
|
|
66
|
+
} else {
|
|
67
|
+
// act with new value if allowed
|
|
68
|
+
fn?.(newValue);
|
|
69
|
+
setInitialValue(newValue);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const handleSubmit = (val: string) => {
|
|
74
|
+
actIfAllowed(editableProps?.onSubmit, val);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const PreviewComponent = as ? as : (props: any) => <span {...props} />;
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<Box>
|
|
81
|
+
{/* TODO: replace with label component */}
|
|
82
|
+
{label && (
|
|
83
|
+
<Text fontWeight="bold" color="black">
|
|
84
|
+
{label}
|
|
85
|
+
</Text>
|
|
86
|
+
)}
|
|
87
|
+
<Text>
|
|
88
|
+
{isEditable ? (
|
|
89
|
+
<Editable
|
|
90
|
+
value={value}
|
|
91
|
+
{...editableStyles}
|
|
92
|
+
{...editableProps}
|
|
93
|
+
onSubmit={handleSubmit}
|
|
94
|
+
>
|
|
95
|
+
<PreviewComponent {...previewWrapperStyles}>
|
|
96
|
+
<EditablePreview
|
|
97
|
+
{...editablePreviewStyles}
|
|
98
|
+
{...editablePreviewProps}
|
|
99
|
+
ref={previewRef}
|
|
100
|
+
/>
|
|
101
|
+
</PreviewComponent>
|
|
102
|
+
<AutowidthInput
|
|
103
|
+
as={EditableInput}
|
|
104
|
+
value={value}
|
|
105
|
+
{...inputStyles}
|
|
106
|
+
{...inputProps}
|
|
107
|
+
onChange={handleInputChange}
|
|
108
|
+
/>
|
|
109
|
+
<IconButton
|
|
110
|
+
aria-label={`Edit ${label}`}
|
|
111
|
+
icon={<Icon icon="Edit" color="gray.400" boxSize="sm" />}
|
|
112
|
+
onClick={handleEditButtonClick}
|
|
113
|
+
/>
|
|
114
|
+
{isCopyable && (
|
|
115
|
+
<Tooltip label="Copied!" isOpen={hasOpenCopyTooltip}>
|
|
116
|
+
<IconButton
|
|
117
|
+
aria-label={`Copy ${label}`}
|
|
118
|
+
icon={<Icon icon="FaRegCopy" color="gray.400" boxSize="sm" />}
|
|
119
|
+
onClick={handleCopyButtonClick}
|
|
120
|
+
/>
|
|
121
|
+
</Tooltip>
|
|
122
|
+
)}
|
|
123
|
+
</Editable>
|
|
124
|
+
) : (
|
|
125
|
+
<Box>
|
|
126
|
+
{value}{' '}
|
|
127
|
+
{isCopyable && (
|
|
128
|
+
<Tooltip label="Copied!" isOpen={hasOpenCopyTooltip}>
|
|
129
|
+
<IconButton
|
|
130
|
+
aria-label={`Copy ${label}`}
|
|
131
|
+
icon={<Icon icon="FaRegCopy" color="gray.400" boxSize="sm" />}
|
|
132
|
+
onClick={handleCopyButtonClick}
|
|
133
|
+
/>
|
|
134
|
+
</Tooltip>
|
|
135
|
+
)}
|
|
136
|
+
</Box>
|
|
137
|
+
)}
|
|
138
|
+
</Text>
|
|
139
|
+
</Box>
|
|
140
|
+
);
|
|
141
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EditablePreviewProps,
|
|
3
|
+
EditableProps,
|
|
4
|
+
InputProps,
|
|
5
|
+
} from '@chakra-ui/react';
|
|
6
|
+
|
|
7
|
+
export interface DataFieldProps {
|
|
8
|
+
label?: string;
|
|
9
|
+
value: string;
|
|
10
|
+
as?: EditableProps['as'];
|
|
11
|
+
onChange?: (val?: string) => void;
|
|
12
|
+
inputProps?: Omit<InputProps, 'value'>;
|
|
13
|
+
editableProps?: Omit<EditableProps, 'value'>;
|
|
14
|
+
editablePreviewProps?: EditablePreviewProps;
|
|
15
|
+
isEditable?: boolean;
|
|
16
|
+
isCopyable?: boolean;
|
|
17
|
+
allowEmpty?: boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DataField } from './DataField';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Box } from '@chakra-ui/react';
|
|
3
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
4
|
+
|
|
5
|
+
import { formatDateByLocale } from '@/utils/formatDateByLocale';
|
|
6
|
+
|
|
7
|
+
import { Text } from '../Typography';
|
|
8
|
+
import { RangeDatePicker } from './RangeDatePicker';
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof RangeDatePicker> = {
|
|
11
|
+
title: 'Components/DatePicker/RangeDatePicker',
|
|
12
|
+
component: RangeDatePicker,
|
|
13
|
+
args: {},
|
|
14
|
+
argTypes: {},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryFn<typeof RangeDatePicker>;
|
|
19
|
+
|
|
20
|
+
export const Basic: Story = ({
|
|
21
|
+
selectedDates: datesProp,
|
|
22
|
+
onDateChange,
|
|
23
|
+
...args
|
|
24
|
+
}) => {
|
|
25
|
+
const [selectedDates, setSelectedDates] = useState<Array<Date>>([
|
|
26
|
+
new Date(),
|
|
27
|
+
new Date(),
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
<Box mb={2}>
|
|
33
|
+
<RangeDatePicker
|
|
34
|
+
{...args}
|
|
35
|
+
selectedDates={selectedDates}
|
|
36
|
+
onDateChange={setSelectedDates}
|
|
37
|
+
/>
|
|
38
|
+
</Box>
|
|
39
|
+
<Text>
|
|
40
|
+
{formatDateByLocale(selectedDates[0])} -{' '}
|
|
41
|
+
{formatDateByLocale(selectedDates[1])}
|
|
42
|
+
</Text>
|
|
43
|
+
</>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RangeDatepicker as BaseRangeDatePicker,
|
|
3
|
+
RangeDatepickerProps,
|
|
4
|
+
} from 'chakra-dayzed-datepicker';
|
|
5
|
+
|
|
6
|
+
import { Icon } from '../Icon';
|
|
7
|
+
|
|
8
|
+
export const RangeDatePicker = ({
|
|
9
|
+
propsConfigs,
|
|
10
|
+
configs,
|
|
11
|
+
usePortal = true,
|
|
12
|
+
...rest
|
|
13
|
+
}: RangeDatepickerProps) => {
|
|
14
|
+
return (
|
|
15
|
+
<BaseRangeDatePicker
|
|
16
|
+
usePortal={usePortal}
|
|
17
|
+
{...rest}
|
|
18
|
+
configs={{
|
|
19
|
+
...configs,
|
|
20
|
+
dateFormat: configs?.dateFormat ?? 'MMM dd, yyyy',
|
|
21
|
+
}}
|
|
22
|
+
propsConfigs={{
|
|
23
|
+
// Manually make it look like an Input
|
|
24
|
+
triggerBtnProps: {
|
|
25
|
+
justifyContent: 'left',
|
|
26
|
+
pl: 2,
|
|
27
|
+
fontWeight: 'regular',
|
|
28
|
+
color: 'gray.1500',
|
|
29
|
+
fontSize: 'md',
|
|
30
|
+
leftIcon: (
|
|
31
|
+
<Icon
|
|
32
|
+
icon="MdOutlineCalendarToday"
|
|
33
|
+
color="gray.600"
|
|
34
|
+
style={{ marginInlineEnd: 3 }}
|
|
35
|
+
/>
|
|
36
|
+
),
|
|
37
|
+
},
|
|
38
|
+
inputProps: {
|
|
39
|
+
color: 'primary.dark',
|
|
40
|
+
...propsConfigs?.inputProps,
|
|
41
|
+
},
|
|
42
|
+
dayOfMonthBtnProps: {
|
|
43
|
+
// Regular day
|
|
44
|
+
defaultBtnProps: {
|
|
45
|
+
fontWeight: 'regular',
|
|
46
|
+
_hover: {
|
|
47
|
+
background: 'primary.light',
|
|
48
|
+
...propsConfigs?.dayOfMonthBtnProps?.defaultBtnProps?._hover,
|
|
49
|
+
},
|
|
50
|
+
...propsConfigs?.dayOfMonthBtnProps?.defaultBtnProps,
|
|
51
|
+
},
|
|
52
|
+
// Today
|
|
53
|
+
todayBtnProps: {
|
|
54
|
+
color: 'gray.1200',
|
|
55
|
+
fontWeight: 'semibold',
|
|
56
|
+
...propsConfigs?.dayOfMonthBtnProps?.todayBtnProps,
|
|
57
|
+
},
|
|
58
|
+
selectedBtnProps: {
|
|
59
|
+
color: 'primary.dark',
|
|
60
|
+
background: 'primary.light',
|
|
61
|
+
...propsConfigs?.dayOfMonthBtnProps?.selectedBtnProps,
|
|
62
|
+
},
|
|
63
|
+
isInRangeBtnProps: {
|
|
64
|
+
color: 'primary.dark',
|
|
65
|
+
background: 'primary.light',
|
|
66
|
+
...propsConfigs?.dayOfMonthBtnProps?.isInRangeBtnProps,
|
|
67
|
+
},
|
|
68
|
+
...propsConfigs?.dayOfMonthBtnProps,
|
|
69
|
+
},
|
|
70
|
+
...propsConfigs,
|
|
71
|
+
}}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Box } from '@chakra-ui/react';
|
|
3
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
4
|
+
|
|
5
|
+
import { formatDateByLocale } from '@/utils/formatDateByLocale';
|
|
6
|
+
|
|
7
|
+
import { Text } from '../Typography';
|
|
8
|
+
import { SingleDatePicker } from './SingleDatePicker';
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof SingleDatePicker> = {
|
|
11
|
+
title: 'Components/DatePicker/SingleDatePicker',
|
|
12
|
+
component: SingleDatePicker,
|
|
13
|
+
args: {},
|
|
14
|
+
argTypes: {},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryFn<typeof SingleDatePicker>;
|
|
19
|
+
|
|
20
|
+
export const Basic: Story = ({ date: dateProp, onDateChange, ...args }) => {
|
|
21
|
+
const [date, setDate] = useState(new Date());
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<Box mb={2}>
|
|
26
|
+
<SingleDatePicker {...args} date={date} onDateChange={setDate} />
|
|
27
|
+
</Box>
|
|
28
|
+
<Text>Selected Date: {formatDateByLocale(date)}</Text>
|
|
29
|
+
</>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
SingleDatepicker,
|
|
4
|
+
SingleDatepickerProps,
|
|
5
|
+
} from 'chakra-dayzed-datepicker';
|
|
6
|
+
|
|
7
|
+
import { Icon } from '../Icon';
|
|
8
|
+
|
|
9
|
+
export const SingleDatePicker = ({
|
|
10
|
+
propsConfigs,
|
|
11
|
+
configs,
|
|
12
|
+
usePortal = true,
|
|
13
|
+
...rest
|
|
14
|
+
}: SingleDatepickerProps) => {
|
|
15
|
+
return (
|
|
16
|
+
<SingleDatepicker
|
|
17
|
+
usePortal={usePortal}
|
|
18
|
+
{...rest}
|
|
19
|
+
configs={{
|
|
20
|
+
...configs,
|
|
21
|
+
dateFormat: configs?.dateFormat ?? 'MM/dd/yyyy',
|
|
22
|
+
}}
|
|
23
|
+
propsConfigs={{
|
|
24
|
+
// Manually make it look like an Input
|
|
25
|
+
triggerBtnProps: {
|
|
26
|
+
justifyContent: 'left',
|
|
27
|
+
pl: 2,
|
|
28
|
+
fontWeight: 'regular',
|
|
29
|
+
color: 'gray.1500',
|
|
30
|
+
fontSize: 'md',
|
|
31
|
+
height: '100%',
|
|
32
|
+
leftIcon: (
|
|
33
|
+
<Icon
|
|
34
|
+
icon="MdOutlineCalendarToday"
|
|
35
|
+
color="gray.600"
|
|
36
|
+
style={{ marginInlineEnd: 3 }}
|
|
37
|
+
/>
|
|
38
|
+
),
|
|
39
|
+
},
|
|
40
|
+
inputProps: {
|
|
41
|
+
color: 'primary.dark',
|
|
42
|
+
|
|
43
|
+
...propsConfigs?.inputProps,
|
|
44
|
+
},
|
|
45
|
+
dayOfMonthBtnProps: {
|
|
46
|
+
// Regular day
|
|
47
|
+
defaultBtnProps: {
|
|
48
|
+
fontWeight: 'regular',
|
|
49
|
+
_hover: {
|
|
50
|
+
background: 'primary.light',
|
|
51
|
+
...propsConfigs?.dayOfMonthBtnProps?.defaultBtnProps?._hover,
|
|
52
|
+
},
|
|
53
|
+
...propsConfigs?.dayOfMonthBtnProps?.defaultBtnProps,
|
|
54
|
+
},
|
|
55
|
+
// Today
|
|
56
|
+
todayBtnProps: {
|
|
57
|
+
color: 'gray.1200',
|
|
58
|
+
fontWeight: 'semibold',
|
|
59
|
+
...propsConfigs?.dayOfMonthBtnProps?.todayBtnProps,
|
|
60
|
+
},
|
|
61
|
+
selectedBtnProps: {
|
|
62
|
+
color: 'primary.dark',
|
|
63
|
+
background: 'primary.light',
|
|
64
|
+
...propsConfigs?.dayOfMonthBtnProps?.selectedBtnProps,
|
|
65
|
+
},
|
|
66
|
+
...propsConfigs?.dayOfMonthBtnProps,
|
|
67
|
+
},
|
|
68
|
+
...propsConfigs,
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
};
|