@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,97 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Box, Button, HStack, IconButton, VStack } from '@chakra-ui/react';
|
|
3
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
4
|
+
|
|
5
|
+
import { Icon } from '../Icon';
|
|
6
|
+
import { Tooltip } from './Tooltip';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Components/Tooltip',
|
|
10
|
+
component: Tooltip,
|
|
11
|
+
args: {
|
|
12
|
+
label: 'This is a tooltip',
|
|
13
|
+
},
|
|
14
|
+
argTypes: {
|
|
15
|
+
placement: {
|
|
16
|
+
control: { type: 'select' },
|
|
17
|
+
options: ['top', 'bottom', 'left', 'right', 'auto'],
|
|
18
|
+
},
|
|
19
|
+
isOpen: {
|
|
20
|
+
control: { type: 'boolean' },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
} as Meta<typeof Tooltip>;
|
|
24
|
+
|
|
25
|
+
const Template: StoryFn<typeof Tooltip> = (args) => (
|
|
26
|
+
<Box p={8} display="flex" justifyContent="center">
|
|
27
|
+
<Tooltip {...args}>
|
|
28
|
+
<Button>Hover me</Button>
|
|
29
|
+
</Tooltip>
|
|
30
|
+
</Box>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export const Default = Template.bind({});
|
|
34
|
+
Default.args = {
|
|
35
|
+
label: 'This is a default tooltip',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const DifferentPlacements: StoryFn<typeof Tooltip> = () => (
|
|
39
|
+
<VStack spacing={8} p={8}>
|
|
40
|
+
<HStack spacing={8}>
|
|
41
|
+
<Tooltip label="Top tooltip" placement="top">
|
|
42
|
+
<Button>Top</Button>
|
|
43
|
+
</Tooltip>
|
|
44
|
+
<Tooltip label="Bottom tooltip" placement="bottom">
|
|
45
|
+
<Button>Bottom</Button>
|
|
46
|
+
</Tooltip>
|
|
47
|
+
<Tooltip label="Left tooltip" placement="left">
|
|
48
|
+
<Button>Left</Button>
|
|
49
|
+
</Tooltip>
|
|
50
|
+
<Tooltip label="Right tooltip" placement="right">
|
|
51
|
+
<Button>Right</Button>
|
|
52
|
+
</Tooltip>
|
|
53
|
+
</HStack>
|
|
54
|
+
</VStack>
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
export const LongTooltipContent: StoryFn<typeof Tooltip> = () => (
|
|
58
|
+
<Box p={8} display="flex" justifyContent="center">
|
|
59
|
+
<Tooltip
|
|
60
|
+
label="This is a much longer tooltip content that demonstrates how the tooltip handles wrapping and longer text content. It should display nicely even with multiple lines."
|
|
61
|
+
placement="top"
|
|
62
|
+
>
|
|
63
|
+
<Button>Hover for long tooltip</Button>
|
|
64
|
+
</Tooltip>
|
|
65
|
+
</Box>
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
export const CopyButtonExample: StoryFn<typeof Tooltip> = () => {
|
|
69
|
+
const [tooltipLabel, setTooltipLabel] = useState('Click to copy');
|
|
70
|
+
const [isTooltipOpen, setIsTooltipOpen] = useState<boolean | undefined>(
|
|
71
|
+
undefined
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const handleCopy = () => {
|
|
75
|
+
navigator.clipboard.writeText('Hello World!');
|
|
76
|
+
setTooltipLabel('Copied!');
|
|
77
|
+
setIsTooltipOpen(true);
|
|
78
|
+
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
setTooltipLabel('Click to copy');
|
|
81
|
+
setIsTooltipOpen(undefined);
|
|
82
|
+
}, 2000);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<Box p={8} display="flex" justifyContent="center">
|
|
87
|
+
<Tooltip label={tooltipLabel} isOpen={isTooltipOpen} placement="top">
|
|
88
|
+
<IconButton
|
|
89
|
+
aria-label="Copy text"
|
|
90
|
+
icon={<Icon icon="FaRegCopy" />}
|
|
91
|
+
onClick={handleCopy}
|
|
92
|
+
variant="tertiary"
|
|
93
|
+
/>
|
|
94
|
+
</Tooltip>
|
|
95
|
+
</Box>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ForwardedRef, forwardRef } from 'react';
|
|
2
|
+
import { Tooltip as ChakraTooltip, useTheme } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
import { TooltipProps } from './Tooltip.types';
|
|
5
|
+
|
|
6
|
+
export const Tooltip = forwardRef(
|
|
7
|
+
({ ...rest }: TooltipProps, ref?: ForwardedRef<HTMLDivElement>) => {
|
|
8
|
+
const theme = useTheme();
|
|
9
|
+
return (
|
|
10
|
+
<ChakraTooltip
|
|
11
|
+
bgColor="gray.1200"
|
|
12
|
+
placement="top"
|
|
13
|
+
fontSize={theme.fontSizes.p}
|
|
14
|
+
closeOnScroll
|
|
15
|
+
{...rest}
|
|
16
|
+
ref={ref}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
Tooltip.displayName = 'Tooltip';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { Heading, HeadingProps, useTheme } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
export const H1 = forwardRef<HTMLHeadingElement, HeadingProps>((props, ref) => {
|
|
5
|
+
const theme = useTheme();
|
|
6
|
+
return (
|
|
7
|
+
<Heading
|
|
8
|
+
ref={ref}
|
|
9
|
+
as="h1"
|
|
10
|
+
fontSize={theme.fontSizes.h1}
|
|
11
|
+
fontWeight="bold"
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
H1.displayName = 'H1';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { Heading, HeadingProps, useTheme } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
export const H2 = forwardRef<HTMLHeadingElement, HeadingProps>((props, ref) => {
|
|
5
|
+
const theme = useTheme();
|
|
6
|
+
return (
|
|
7
|
+
<Heading
|
|
8
|
+
ref={ref}
|
|
9
|
+
as="h2"
|
|
10
|
+
fontSize={theme.fontSizes.h2}
|
|
11
|
+
fontWeight="semibold"
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
H2.displayName = 'H2';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { Heading, HeadingProps, useTheme } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
export const H3 = forwardRef<HTMLHeadingElement, HeadingProps>((props, ref) => {
|
|
5
|
+
const theme = useTheme();
|
|
6
|
+
return (
|
|
7
|
+
<Heading
|
|
8
|
+
ref={ref}
|
|
9
|
+
as="h3"
|
|
10
|
+
fontSize={theme.fontSizes.h3}
|
|
11
|
+
fontWeight="semibold"
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
H3.displayName = 'H3';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { Heading, HeadingProps, useTheme } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
export const H4 = forwardRef<HTMLHeadingElement, HeadingProps>((props, ref) => {
|
|
5
|
+
const theme = useTheme();
|
|
6
|
+
return (
|
|
7
|
+
<Heading
|
|
8
|
+
ref={ref}
|
|
9
|
+
as="h4"
|
|
10
|
+
fontSize={theme.fontSizes.h4}
|
|
11
|
+
fontWeight="semibold"
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
H4.displayName = 'H4';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { Heading, HeadingProps, useTheme } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
export const H5 = forwardRef<HTMLHeadingElement, HeadingProps>((props, ref) => {
|
|
5
|
+
const theme = useTheme();
|
|
6
|
+
return (
|
|
7
|
+
<Heading
|
|
8
|
+
ref={ref}
|
|
9
|
+
as="h5"
|
|
10
|
+
fontSize={theme.fontSizes.h5}
|
|
11
|
+
fontWeight="bold"
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
H5.displayName = 'H5';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Link as ChakraLink,
|
|
4
|
+
LinkProps,
|
|
5
|
+
useTheme,
|
|
6
|
+
useToken,
|
|
7
|
+
} from '@chakra-ui/react';
|
|
8
|
+
import { darken } from 'polished';
|
|
9
|
+
|
|
10
|
+
export interface LinkCustomProps extends LinkProps {
|
|
11
|
+
variant?: 'error';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const Link = forwardRef<HTMLAnchorElement, LinkCustomProps>(
|
|
15
|
+
({ color, variant, ...rest }, ref) => {
|
|
16
|
+
const theme = useTheme();
|
|
17
|
+
const defaultColor = theme.semanticTokens.colors.primary.main;
|
|
18
|
+
const errorColor = theme.semanticTokens.colors.danger.main;
|
|
19
|
+
const linkColor =
|
|
20
|
+
useToken(
|
|
21
|
+
'colors',
|
|
22
|
+
variant === 'error' ? errorColor : color || defaultColor
|
|
23
|
+
) ?? color;
|
|
24
|
+
|
|
25
|
+
const getHoverColor = () => {
|
|
26
|
+
let hoverColor;
|
|
27
|
+
try {
|
|
28
|
+
hoverColor = darken(0.1, linkColor);
|
|
29
|
+
} catch (e) {
|
|
30
|
+
hoverColor = 'inherit';
|
|
31
|
+
}
|
|
32
|
+
return hoverColor;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<ChakraLink
|
|
37
|
+
ref={ref}
|
|
38
|
+
fontWeight="semibold"
|
|
39
|
+
color={linkColor}
|
|
40
|
+
_hover={{
|
|
41
|
+
color: getHoverColor(),
|
|
42
|
+
}} // Darken by 10% on hover
|
|
43
|
+
{...rest}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
Link.displayName = 'Link';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { Text, TextProps, useTheme } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
export const Subtext = forwardRef<HTMLSpanElement, TextProps>((props, ref) => {
|
|
5
|
+
const theme = useTheme();
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<Text
|
|
9
|
+
ref={ref}
|
|
10
|
+
fontSize={theme.fontSizes.subtext}
|
|
11
|
+
fontWeight="regular"
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
Subtext.displayName = 'Subtext';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { Text, TextProps, useTheme } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
export const Subtitle = forwardRef<HTMLSpanElement, TextProps>((props, ref) => {
|
|
5
|
+
const theme = useTheme();
|
|
6
|
+
return (
|
|
7
|
+
<Text
|
|
8
|
+
ref={ref}
|
|
9
|
+
as="h6"
|
|
10
|
+
fontSize={theme.fontSizes.p}
|
|
11
|
+
fontWeight="medium"
|
|
12
|
+
color="gray.1000"
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
Subtitle.displayName = 'Subtitle';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { Text as ChakraText, TextProps, useTheme } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
export const Text = forwardRef<HTMLParagraphElement, TextProps>(
|
|
5
|
+
(props, ref) => {
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<ChakraText
|
|
10
|
+
ref={ref}
|
|
11
|
+
as="p"
|
|
12
|
+
fontSize={theme.fontSizes.p}
|
|
13
|
+
lineHeight="1.5"
|
|
14
|
+
fontWeight="medium"
|
|
15
|
+
color="gray.1200"
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
Text.displayName = 'Text';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextProps } from '@chakra-ui/react';
|
|
3
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
4
|
+
|
|
5
|
+
import { H1, H2, H3, H4, H5, Link, Subtext, Subtitle, Text } from '.';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Text> = {
|
|
8
|
+
title: 'Components/Typography',
|
|
9
|
+
component: Text,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryFn<typeof Text>;
|
|
14
|
+
|
|
15
|
+
export const AllTextStyles: Story = (props: TextProps) => {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<H1 {...props}>
|
|
19
|
+
H1 - Lorem ipsum dolor sit amet,{' '}
|
|
20
|
+
<Link variant="error" href="https://example.com">
|
|
21
|
+
consectetur adipiscing elit
|
|
22
|
+
</Link>
|
|
23
|
+
</H1>
|
|
24
|
+
<H2 {...props}>
|
|
25
|
+
H2 - Lorem ipsum dolor sit amet,{' '}
|
|
26
|
+
<Link href="https://example.com">consectetur adipiscing elit</Link>
|
|
27
|
+
</H2>
|
|
28
|
+
<H3 {...props}>
|
|
29
|
+
H3 - Lorem ipsum dolor sit amet,{' '}
|
|
30
|
+
<Link href="https://example.com">consectetur adipiscing elit</Link>
|
|
31
|
+
</H3>
|
|
32
|
+
<H4 {...props}>
|
|
33
|
+
H4 - Lorem ipsum dolor sit amet,{' '}
|
|
34
|
+
<Link href="https://example.com">consectetur adipiscing elit</Link>
|
|
35
|
+
</H4>
|
|
36
|
+
<H5 {...props}>
|
|
37
|
+
H5 - Lorem ipsum dolor sit amet,{' '}
|
|
38
|
+
<Link href="https://example.com">consectetur adipiscing elit</Link>
|
|
39
|
+
</H5>
|
|
40
|
+
<Text {...props}>
|
|
41
|
+
Paragraph - Lorem ipsum dolor sit amet,{' '}
|
|
42
|
+
<Link href="https://example.com">consectetur adipiscing elit</Link>
|
|
43
|
+
</Text>
|
|
44
|
+
<Subtitle {...props}>
|
|
45
|
+
Subtitle - Lorem ipsum dolor sit amet,{' '}
|
|
46
|
+
<Link href="https://example.com">consectetur adipiscing elit</Link>
|
|
47
|
+
</Subtitle>
|
|
48
|
+
<Subtext {...props}>
|
|
49
|
+
Subtext - Lorem ipsum dolor sit amet,{' '}
|
|
50
|
+
<Link href="https://example.com">consectetur adipiscing elit</Link>
|
|
51
|
+
</Subtext>
|
|
52
|
+
</>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Component exports
|
|
2
|
+
export { H1 } from './H1';
|
|
3
|
+
export { H2 } from './H2';
|
|
4
|
+
export { H3 } from './H3';
|
|
5
|
+
export { H4 } from './H4';
|
|
6
|
+
export { H5 } from './H5';
|
|
7
|
+
export { Link } from './Link';
|
|
8
|
+
export { Subtext } from './Subtext';
|
|
9
|
+
export { Subtitle } from './Subtitle';
|
|
10
|
+
export { Text } from './Text';
|
|
11
|
+
|
|
12
|
+
// Type exports
|
|
13
|
+
export type { LinkCustomProps as LinkProps } from './Link';
|
|
14
|
+
export type {
|
|
15
|
+
TypographyProps as SubtextProps,
|
|
16
|
+
TypographyProps as SubtitleProps,
|
|
17
|
+
TypographyProps as TextProps,
|
|
18
|
+
TypographyProps,
|
|
19
|
+
} from './Typography.types';
|
|
20
|
+
export type {
|
|
21
|
+
HeadingProps as H1Props,
|
|
22
|
+
HeadingProps as H2Props,
|
|
23
|
+
HeadingProps as H3Props,
|
|
24
|
+
HeadingProps as H4Props,
|
|
25
|
+
HeadingProps as H5Props,
|
|
26
|
+
} from '@chakra-ui/react';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { UrlInput, UrlInputProps } from './UrlInput';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof UrlInput> = {
|
|
7
|
+
title: 'Components/UrlInput',
|
|
8
|
+
component: UrlInput,
|
|
9
|
+
argTypes: {
|
|
10
|
+
placeholder: { control: 'text' },
|
|
11
|
+
size: {
|
|
12
|
+
control: {
|
|
13
|
+
type: 'select',
|
|
14
|
+
options: ['sm', 'md', 'lg'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
isDisabled: { control: 'boolean' },
|
|
18
|
+
isInvalid: { control: 'boolean' },
|
|
19
|
+
leftAddon: { control: 'text' },
|
|
20
|
+
rightAddon: { control: 'text' },
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
|
|
26
|
+
const Template: StoryFn<UrlInputProps> = (args) => <UrlInput {...args} />;
|
|
27
|
+
|
|
28
|
+
export const Basic: StoryFn<UrlInputProps> = Template.bind({});
|
|
29
|
+
Basic.args = {
|
|
30
|
+
placeholder: 'mysite',
|
|
31
|
+
size: 'md',
|
|
32
|
+
isDisabled: false,
|
|
33
|
+
isInvalid: false,
|
|
34
|
+
leftAddon: 'https://',
|
|
35
|
+
rightAddon: '.com',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Disabled: StoryFn<UrlInputProps> = Template.bind({});
|
|
39
|
+
Disabled.args = {
|
|
40
|
+
placeholder: 'mysite',
|
|
41
|
+
size: 'md',
|
|
42
|
+
isDisabled: true,
|
|
43
|
+
isInvalid: false,
|
|
44
|
+
leftAddon: 'https://',
|
|
45
|
+
rightAddon: '.com',
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const Invalid: StoryFn<UrlInputProps> = Template.bind({});
|
|
49
|
+
Invalid.args = {
|
|
50
|
+
placeholder: 'mysite',
|
|
51
|
+
size: 'md',
|
|
52
|
+
isDisabled: false,
|
|
53
|
+
isInvalid: true,
|
|
54
|
+
leftAddon: 'https://',
|
|
55
|
+
rightAddon: '.com',
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const CustomAddons: StoryFn<UrlInputProps> = Template.bind({});
|
|
59
|
+
CustomAddons.args = {
|
|
60
|
+
placeholder: 'mysite',
|
|
61
|
+
size: 'md',
|
|
62
|
+
isDisabled: false,
|
|
63
|
+
isInvalid: false,
|
|
64
|
+
leftAddon: 'ftp://',
|
|
65
|
+
rightAddon: '/home',
|
|
66
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ForwardedRef, forwardRef } from 'react';
|
|
2
|
+
import { InputGroup, InputLeftAddon, InputProps } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
import { Input } from '@/components/Input';
|
|
5
|
+
|
|
6
|
+
export interface UrlInputProps extends InputProps {
|
|
7
|
+
leftAddon?: string;
|
|
8
|
+
rightAddon?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const UrlInput = forwardRef(
|
|
12
|
+
(
|
|
13
|
+
{ leftAddon = 'https://', value, onChange, ...rest }: UrlInputProps,
|
|
14
|
+
ref?: ForwardedRef<HTMLInputElement>
|
|
15
|
+
) => {
|
|
16
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
17
|
+
const inputValue = e.target.value;
|
|
18
|
+
if (onChange) {
|
|
19
|
+
onChange({
|
|
20
|
+
...e,
|
|
21
|
+
target: {
|
|
22
|
+
...e.target,
|
|
23
|
+
value: leftAddon + inputValue,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const displayValue =
|
|
30
|
+
typeof value === 'string' ? value.replace(leftAddon, '') : value;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<InputGroup width="100%">
|
|
34
|
+
{leftAddon && <InputLeftAddon>{leftAddon}</InputLeftAddon>}
|
|
35
|
+
<Input
|
|
36
|
+
name="service_url"
|
|
37
|
+
{...rest}
|
|
38
|
+
value={displayValue}
|
|
39
|
+
onChange={handleChange}
|
|
40
|
+
ref={ref}
|
|
41
|
+
/>
|
|
42
|
+
</InputGroup>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
UrlInput.displayName = 'UrlInput';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UrlInput } from './UrlInput';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
|
|
4
|
+
import defaultTranslations from '../translations/Defaults.translations.json';
|
|
5
|
+
import { formatForMarkdown } from '../utils/formatTextForMarkdown';
|
|
6
|
+
|
|
7
|
+
const DEFAULT_LOCALE = 'ko';
|
|
8
|
+
|
|
9
|
+
// Given a block of text and variables, replaces instances of the provided variables in the text
|
|
10
|
+
const replaceVariables = (text: string, variables?: { [key: string]: any }) => {
|
|
11
|
+
if (!variables) return formatForMarkdown(text);
|
|
12
|
+
|
|
13
|
+
const regex = /({(.*?)})/gi;
|
|
14
|
+
|
|
15
|
+
const potentialKeys: string[] = text.match(regex) ?? [];
|
|
16
|
+
const textParts: Array<string> = [];
|
|
17
|
+
let lastIndex = 0;
|
|
18
|
+
potentialKeys.forEach((potentialKey: string) => {
|
|
19
|
+
const keyIndex = text.indexOf(potentialKey);
|
|
20
|
+
// Push stuff up to potential key
|
|
21
|
+
textParts.push(text.slice(lastIndex, keyIndex));
|
|
22
|
+
// Push potential key
|
|
23
|
+
textParts.push(text.slice(keyIndex, keyIndex + potentialKey.length));
|
|
24
|
+
lastIndex = keyIndex + potentialKey.length;
|
|
25
|
+
});
|
|
26
|
+
// Push remaining
|
|
27
|
+
textParts.push(text.slice(lastIndex));
|
|
28
|
+
|
|
29
|
+
const parts = textParts.map(
|
|
30
|
+
(partText: string) =>
|
|
31
|
+
// Slice to remove { and }
|
|
32
|
+
variables[partText.slice(1, partText.length - 1)] ??
|
|
33
|
+
formatForMarkdown(partText)
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
return parts.every((part) => typeof part === 'string')
|
|
37
|
+
? parts.join('')
|
|
38
|
+
: parts;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const getLanguage = () => {
|
|
42
|
+
return 'ko';
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const useTranslate = (translations = {}) => {
|
|
46
|
+
const userLanguage = getLanguage();
|
|
47
|
+
return useCallback(
|
|
48
|
+
(key: string, variables?: { [key: string]: any }) => {
|
|
49
|
+
const locale = (userLanguage as string) ?? DEFAULT_LOCALE;
|
|
50
|
+
const translation: string =
|
|
51
|
+
{ ...defaultTranslations, ...translations }[key]?.[locale] ?? key;
|
|
52
|
+
const finalRes = replaceVariables(translation, variables);
|
|
53
|
+
return finalRes;
|
|
54
|
+
},
|
|
55
|
+
[userLanguage, translations]
|
|
56
|
+
);
|
|
57
|
+
};
|