@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,272 @@
|
|
|
1
|
+
import { Box } from '@chakra-ui/react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import RadialProgress from './RadialProgress';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/RadialProgress',
|
|
8
|
+
component: RadialProgress,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component:
|
|
14
|
+
'A customizable radial progress component that displays multiple segments with colors, values, and optional units.',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
tags: ['autodocs'],
|
|
19
|
+
argTypes: {
|
|
20
|
+
size: {
|
|
21
|
+
control: { type: 'range', min: 100, max: 400, step: 10 },
|
|
22
|
+
description: 'Size of the radial progress component in pixels',
|
|
23
|
+
},
|
|
24
|
+
total: {
|
|
25
|
+
control: { type: 'number' },
|
|
26
|
+
description: 'Total value displayed in the center',
|
|
27
|
+
},
|
|
28
|
+
unit: {
|
|
29
|
+
control: { type: 'text' },
|
|
30
|
+
description: 'Unit label displayed next to the total value',
|
|
31
|
+
},
|
|
32
|
+
segments: {
|
|
33
|
+
control: { type: 'object' },
|
|
34
|
+
description: 'Array of segments with color and value properties',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
decorators: [
|
|
38
|
+
(Story) => (
|
|
39
|
+
<Box p={8} bg="white" borderRadius="md">
|
|
40
|
+
<Story />
|
|
41
|
+
</Box>
|
|
42
|
+
),
|
|
43
|
+
],
|
|
44
|
+
} satisfies Meta<typeof RadialProgress>;
|
|
45
|
+
|
|
46
|
+
export default meta;
|
|
47
|
+
type Story = StoryObj<typeof meta>;
|
|
48
|
+
|
|
49
|
+
// Default story with the user's example
|
|
50
|
+
export const Default: Story = {
|
|
51
|
+
args: {
|
|
52
|
+
segments: [
|
|
53
|
+
{ color: '#4ECDC4', value: 15 },
|
|
54
|
+
{ color: '#FF6B6B', value: 20 },
|
|
55
|
+
{ color: '#FF8E53', value: 30 },
|
|
56
|
+
{ color: '#FFD93D', value: 75 },
|
|
57
|
+
],
|
|
58
|
+
total: 150,
|
|
59
|
+
unit: 'GB',
|
|
60
|
+
size: 200,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// Storage usage example
|
|
65
|
+
export const StorageUsage: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
segments: [
|
|
68
|
+
{ color: '#4ECDC4', value: 15 },
|
|
69
|
+
{ color: '#FF6B6B', value: 20 },
|
|
70
|
+
{ color: '#FF8E53', value: 30 },
|
|
71
|
+
{ color: '#FFD93D', value: 75 },
|
|
72
|
+
],
|
|
73
|
+
total: 150,
|
|
74
|
+
unit: 'GB',
|
|
75
|
+
size: 200,
|
|
76
|
+
},
|
|
77
|
+
parameters: {
|
|
78
|
+
docs: {
|
|
79
|
+
description: {
|
|
80
|
+
story: 'Example showing storage usage with different file types.',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// Memory usage example
|
|
87
|
+
export const MemoryUsage: Story = {
|
|
88
|
+
args: {
|
|
89
|
+
segments: [
|
|
90
|
+
{ color: '#667EEA', value: 2.5 },
|
|
91
|
+
{ color: '#F093FB', value: 1.8 },
|
|
92
|
+
{ color: '#4ECDC4', value: 3.2 },
|
|
93
|
+
{ color: '#FFE66D', value: 0.5 },
|
|
94
|
+
],
|
|
95
|
+
total: 8,
|
|
96
|
+
unit: 'GB',
|
|
97
|
+
size: 200,
|
|
98
|
+
},
|
|
99
|
+
parameters: {
|
|
100
|
+
docs: {
|
|
101
|
+
description: {
|
|
102
|
+
story: 'Memory usage breakdown showing RAM allocation.',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// Budget tracking example
|
|
109
|
+
export const BudgetTracking: Story = {
|
|
110
|
+
args: {
|
|
111
|
+
segments: [
|
|
112
|
+
{ color: '#48BB78', value: 1200 },
|
|
113
|
+
{ color: '#ED8936', value: 800 },
|
|
114
|
+
{ color: '#E53E3E', value: 600 },
|
|
115
|
+
{ color: '#805AD5', value: 400 },
|
|
116
|
+
],
|
|
117
|
+
total: 5000,
|
|
118
|
+
unit: '$',
|
|
119
|
+
size: 200,
|
|
120
|
+
},
|
|
121
|
+
parameters: {
|
|
122
|
+
docs: {
|
|
123
|
+
description: {
|
|
124
|
+
story: 'Budget allocation showing different expense categories.',
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// Small size variant
|
|
131
|
+
export const SmallSize: Story = {
|
|
132
|
+
args: {
|
|
133
|
+
segments: [
|
|
134
|
+
{ color: '#4ECDC4', value: 25 },
|
|
135
|
+
{ color: '#FF6B6B', value: 35 },
|
|
136
|
+
{ color: '#FF8E53', value: 40 },
|
|
137
|
+
],
|
|
138
|
+
total: 100,
|
|
139
|
+
unit: '%',
|
|
140
|
+
size: 120,
|
|
141
|
+
},
|
|
142
|
+
parameters: {
|
|
143
|
+
docs: {
|
|
144
|
+
description: {
|
|
145
|
+
story: 'Smaller version of the component for compact layouts.',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// Large size variant
|
|
152
|
+
export const LargeSize: Story = {
|
|
153
|
+
args: {
|
|
154
|
+
segments: [
|
|
155
|
+
{ color: '#4ECDC4', value: 150 },
|
|
156
|
+
{ color: '#FF6B6B', value: 200 },
|
|
157
|
+
{ color: '#FF8E53', value: 300 },
|
|
158
|
+
{ color: '#FFD93D', value: 350 },
|
|
159
|
+
],
|
|
160
|
+
total: 1000,
|
|
161
|
+
unit: 'MB',
|
|
162
|
+
size: 300,
|
|
163
|
+
},
|
|
164
|
+
parameters: {
|
|
165
|
+
docs: {
|
|
166
|
+
description: {
|
|
167
|
+
story: 'Larger version of the component for prominent display.',
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// Single segment
|
|
174
|
+
export const SingleSegment: Story = {
|
|
175
|
+
args: {
|
|
176
|
+
segments: [{ color: '#4ECDC4', value: 75 }],
|
|
177
|
+
total: 100,
|
|
178
|
+
unit: '%',
|
|
179
|
+
size: 200,
|
|
180
|
+
},
|
|
181
|
+
parameters: {
|
|
182
|
+
docs: {
|
|
183
|
+
description: {
|
|
184
|
+
story: 'Simple progress indicator with a single segment.',
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
// Many segments
|
|
191
|
+
export const ManySegments: Story = {
|
|
192
|
+
args: {
|
|
193
|
+
segments: [
|
|
194
|
+
{ color: '#FF6B6B', value: 10 },
|
|
195
|
+
{ color: '#4ECDC4', value: 15 },
|
|
196
|
+
{ color: '#45B7D1', value: 20 },
|
|
197
|
+
{ color: '#96CEB4', value: 12 },
|
|
198
|
+
{ color: '#FFEAA7', value: 8 },
|
|
199
|
+
{ color: '#DDA0DD', value: 18 },
|
|
200
|
+
{ color: '#98D8C8', value: 7 },
|
|
201
|
+
{ color: '#F7DC6F', value: 10 },
|
|
202
|
+
],
|
|
203
|
+
total: 100,
|
|
204
|
+
unit: 'pts',
|
|
205
|
+
size: 200,
|
|
206
|
+
},
|
|
207
|
+
parameters: {
|
|
208
|
+
docs: {
|
|
209
|
+
description: {
|
|
210
|
+
story: 'Example with many small segments showing detailed breakdown.',
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
// Partial usage (segments don't fill total)
|
|
217
|
+
export const PartialUsage: Story = {
|
|
218
|
+
args: {
|
|
219
|
+
segments: [
|
|
220
|
+
{ color: '#4ECDC4', value: 30 },
|
|
221
|
+
{ color: '#FF6B6B', value: 20 },
|
|
222
|
+
],
|
|
223
|
+
total: 100,
|
|
224
|
+
unit: 'GB',
|
|
225
|
+
size: 200,
|
|
226
|
+
},
|
|
227
|
+
parameters: {
|
|
228
|
+
docs: {
|
|
229
|
+
description: {
|
|
230
|
+
story:
|
|
231
|
+
"Shows remaining capacity when segments don't fill the total value.",
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
// No unit label
|
|
238
|
+
export const NoUnit: Story = {
|
|
239
|
+
args: {
|
|
240
|
+
segments: [
|
|
241
|
+
{ color: '#4ECDC4', value: 45 },
|
|
242
|
+
{ color: '#FF6B6B', value: 30 },
|
|
243
|
+
{ color: '#FF8E53', value: 25 },
|
|
244
|
+
],
|
|
245
|
+
total: 100,
|
|
246
|
+
size: 200,
|
|
247
|
+
},
|
|
248
|
+
parameters: {
|
|
249
|
+
docs: {
|
|
250
|
+
description: {
|
|
251
|
+
story: 'Progress indicator without a unit label.',
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
// Empty segments (edge case)
|
|
258
|
+
export const EmptySegments: Story = {
|
|
259
|
+
args: {
|
|
260
|
+
segments: [],
|
|
261
|
+
total: 100,
|
|
262
|
+
unit: 'GB',
|
|
263
|
+
size: 200,
|
|
264
|
+
},
|
|
265
|
+
parameters: {
|
|
266
|
+
docs: {
|
|
267
|
+
description: {
|
|
268
|
+
story: 'Edge case showing the component with no segments.',
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, useTheme, useToken } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
import { Text } from '../Typography';
|
|
5
|
+
import {
|
|
6
|
+
ProcessedSegment,
|
|
7
|
+
RadialProgressProps,
|
|
8
|
+
Segment,
|
|
9
|
+
SegmentAngle,
|
|
10
|
+
} from './RadialProgress.types';
|
|
11
|
+
|
|
12
|
+
const RadialProgress: React.FC<RadialProgressProps> = ({
|
|
13
|
+
size = 200,
|
|
14
|
+
total = 100,
|
|
15
|
+
unit,
|
|
16
|
+
formatTotal,
|
|
17
|
+
segments = [],
|
|
18
|
+
className,
|
|
19
|
+
...rest
|
|
20
|
+
}) => {
|
|
21
|
+
const theme = useTheme();
|
|
22
|
+
|
|
23
|
+
// Helper function to resolve color tokens
|
|
24
|
+
const resolveColor = (color: string): string => {
|
|
25
|
+
try {
|
|
26
|
+
// Try to resolve as a token first
|
|
27
|
+
const resolvedColor = useToken('colors', color);
|
|
28
|
+
return resolvedColor || color;
|
|
29
|
+
} catch {
|
|
30
|
+
// If token resolution fails, return the original color
|
|
31
|
+
return color;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// Early return if total is 0 or negative to prevent division by zero
|
|
36
|
+
if (total <= 0) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Scale all values based on the size prop (200 is the base size)
|
|
41
|
+
const scale = size / 200;
|
|
42
|
+
|
|
43
|
+
const centerX = 100;
|
|
44
|
+
const centerY = 100;
|
|
45
|
+
const radius = 90;
|
|
46
|
+
const strokeWidth = 16 * scale;
|
|
47
|
+
const fontSize = 48 * scale;
|
|
48
|
+
const unitFontSize = 24 * scale;
|
|
49
|
+
const shadowHeight = 20 * scale;
|
|
50
|
+
const shadowWidth = 160 * scale;
|
|
51
|
+
const shadowOffset = 10 * scale;
|
|
52
|
+
const shadowBlur = 15 * scale;
|
|
53
|
+
|
|
54
|
+
// Convert values to angles with gaps
|
|
55
|
+
const gapDegrees = 7 * scale; // Scale gap with size
|
|
56
|
+
const minSegmentDegrees = 0.01 * scale; // Scale minimum segment size too
|
|
57
|
+
|
|
58
|
+
// Calculate the sum of all segment values
|
|
59
|
+
const usedTotal = segments.reduce((sum, segment) => sum + segment.value, 0);
|
|
60
|
+
const remainingValue = Math.max(0, total - usedTotal);
|
|
61
|
+
|
|
62
|
+
// Add gray segment for remaining space if needed
|
|
63
|
+
const allSegments: Segment[] =
|
|
64
|
+
segments.length === 0
|
|
65
|
+
? [{ color: theme.colors.gray[200], value: total }] // Full gray circle if no segments
|
|
66
|
+
: remainingValue > 0
|
|
67
|
+
? [
|
|
68
|
+
...segments,
|
|
69
|
+
{ color: 'gray.200', value: remainingValue }, // Use token instead of theme.colors.gray[200]
|
|
70
|
+
]
|
|
71
|
+
: segments;
|
|
72
|
+
|
|
73
|
+
// Calculate total available degrees after accounting for gaps
|
|
74
|
+
const totalGaps = gapDegrees * 2 * allSegments.length; // Each segment has gaps on both sides
|
|
75
|
+
const availableDegrees = 360 - totalGaps;
|
|
76
|
+
|
|
77
|
+
// First pass: calculate raw degrees and identify segments needing minimum
|
|
78
|
+
const rawSegments: ProcessedSegment[] = allSegments.map((segment) => {
|
|
79
|
+
// Prevent division by zero when calculating raw degrees
|
|
80
|
+
const rawDegrees =
|
|
81
|
+
total > 0 ? (segment.value / total) * availableDegrees : 0;
|
|
82
|
+
const needsMinimum = segment.value === 0 || rawDegrees < minSegmentDegrees;
|
|
83
|
+
return {
|
|
84
|
+
...segment,
|
|
85
|
+
rawDegrees,
|
|
86
|
+
needsMinimum,
|
|
87
|
+
actualDegrees: needsMinimum ? minSegmentDegrees : rawDegrees,
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// Calculate total degrees needed vs available
|
|
92
|
+
const totalDegreesNeeded = rawSegments.reduce(
|
|
93
|
+
(sum, seg) => sum + seg.actualDegrees,
|
|
94
|
+
0
|
|
95
|
+
);
|
|
96
|
+
// Prevent division by zero when calculating scale factor
|
|
97
|
+
const scaleFactor =
|
|
98
|
+
totalDegreesNeeded > availableDegrees && totalDegreesNeeded > 0
|
|
99
|
+
? availableDegrees / totalDegreesNeeded
|
|
100
|
+
: 1;
|
|
101
|
+
|
|
102
|
+
// Calculate segment angles with proper scaling
|
|
103
|
+
let currentAngle = -90; // Start from top
|
|
104
|
+
const segmentAngles: SegmentAngle[] = rawSegments.map((segment) => {
|
|
105
|
+
const segmentDegrees = segment.actualDegrees * scaleFactor;
|
|
106
|
+
|
|
107
|
+
// For a single full circle segment, don't add gaps
|
|
108
|
+
if (segments.length === 0 && allSegments.length === 1) {
|
|
109
|
+
return {
|
|
110
|
+
color: resolveColor(segment.color),
|
|
111
|
+
start: -90,
|
|
112
|
+
end: 270, // Full circle
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const startAngle = currentAngle + gapDegrees; // Start with gap
|
|
117
|
+
const endAngle = startAngle + segmentDegrees;
|
|
118
|
+
currentAngle = endAngle + gapDegrees; // Add gap before next segment
|
|
119
|
+
|
|
120
|
+
// Segments already have correct positioning with gaps
|
|
121
|
+
return {
|
|
122
|
+
color: resolveColor(segment.color),
|
|
123
|
+
start: startAngle,
|
|
124
|
+
end: endAngle,
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// Helper function to convert angle to radians
|
|
129
|
+
const toRadians = (angle: number): number => (angle * Math.PI) / 180;
|
|
130
|
+
|
|
131
|
+
// Helper function to get point on circle
|
|
132
|
+
const getPoint = (angle: number): { x: number; y: number } => {
|
|
133
|
+
const rad = toRadians(angle);
|
|
134
|
+
return {
|
|
135
|
+
x: centerX + radius * Math.cos(rad),
|
|
136
|
+
y: centerY + radius * Math.sin(rad),
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// Helper function to create arc path
|
|
141
|
+
const createArc = (startAngle: number, endAngle: number): string => {
|
|
142
|
+
const start = getPoint(startAngle);
|
|
143
|
+
const end = getPoint(endAngle);
|
|
144
|
+
const largeArcFlag = endAngle - startAngle > 180 ? 1 : 0;
|
|
145
|
+
|
|
146
|
+
return `M ${start.x} ${start.y} A ${radius} ${radius} 0 ${largeArcFlag} 1 ${end.x} ${end.y}`;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<Box
|
|
151
|
+
display="flex"
|
|
152
|
+
alignItems="center"
|
|
153
|
+
justifyContent="center"
|
|
154
|
+
height={`${size}px`}
|
|
155
|
+
width="100%"
|
|
156
|
+
backgroundColor="white"
|
|
157
|
+
className={['ml-radial-progress', className].join(' ')}
|
|
158
|
+
{...rest}
|
|
159
|
+
>
|
|
160
|
+
<Box position="relative" width={`${size}px`} height={`${size}px`}>
|
|
161
|
+
{/* SVG */}
|
|
162
|
+
<svg
|
|
163
|
+
width={size}
|
|
164
|
+
height={size}
|
|
165
|
+
viewBox="0 0 200 200"
|
|
166
|
+
style={{ width: '100%', height: '100%' }}
|
|
167
|
+
>
|
|
168
|
+
{/* Special case for full circle when no segments */}
|
|
169
|
+
{segments.length === 0 ? (
|
|
170
|
+
<circle
|
|
171
|
+
cx={centerX}
|
|
172
|
+
cy={centerY}
|
|
173
|
+
r={radius}
|
|
174
|
+
fill="none"
|
|
175
|
+
stroke={resolveColor('gray.200')}
|
|
176
|
+
strokeWidth={strokeWidth}
|
|
177
|
+
/>
|
|
178
|
+
) : (
|
|
179
|
+
segmentAngles.map((segment, index) => (
|
|
180
|
+
<path
|
|
181
|
+
key={index}
|
|
182
|
+
d={createArc(segment.start, segment.end)}
|
|
183
|
+
fill="none"
|
|
184
|
+
stroke={segment.color}
|
|
185
|
+
strokeWidth={strokeWidth}
|
|
186
|
+
strokeLinecap="round"
|
|
187
|
+
/>
|
|
188
|
+
))
|
|
189
|
+
)}
|
|
190
|
+
</svg>
|
|
191
|
+
|
|
192
|
+
{/* Center text */}
|
|
193
|
+
<Box
|
|
194
|
+
position="absolute"
|
|
195
|
+
top="50%"
|
|
196
|
+
left="50%"
|
|
197
|
+
transform="translate(-50%, -50%)"
|
|
198
|
+
textAlign="center"
|
|
199
|
+
>
|
|
200
|
+
<Text
|
|
201
|
+
fontSize={`${fontSize}px`}
|
|
202
|
+
fontWeight="500"
|
|
203
|
+
color="gray.600"
|
|
204
|
+
fontFamily="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"
|
|
205
|
+
lineHeight="1"
|
|
206
|
+
>
|
|
207
|
+
{formatTotal ? formatTotal(total) : total}
|
|
208
|
+
<Box as="span" fontSize={`${unitFontSize}px`}>
|
|
209
|
+
{unit}
|
|
210
|
+
</Box>
|
|
211
|
+
</Text>
|
|
212
|
+
</Box>
|
|
213
|
+
|
|
214
|
+
{/* Shadow effect */}
|
|
215
|
+
<Box
|
|
216
|
+
position="absolute"
|
|
217
|
+
bottom={`-${shadowOffset}px`}
|
|
218
|
+
left="50%"
|
|
219
|
+
transform="translateX(-50%)"
|
|
220
|
+
width={`${shadowWidth}px`}
|
|
221
|
+
height={`${shadowHeight}px`}
|
|
222
|
+
background="gray.200"
|
|
223
|
+
borderRadius="50%"
|
|
224
|
+
filter={`blur(${shadowBlur}px)`}
|
|
225
|
+
opacity="0.3"
|
|
226
|
+
/>
|
|
227
|
+
</Box>
|
|
228
|
+
</Box>
|
|
229
|
+
);
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export default RadialProgress;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BoxProps } from '@chakra-ui/react';
|
|
2
|
+
|
|
3
|
+
export interface Segment {
|
|
4
|
+
/** Color value - supports hex colors, CSS color names, and Chakra UI color tokens (e.g., 'primary.500', 'red.400') */
|
|
5
|
+
color: string;
|
|
6
|
+
value: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface RadialProgressProps extends BoxProps {
|
|
10
|
+
size?: number;
|
|
11
|
+
total?: number;
|
|
12
|
+
unit?: string;
|
|
13
|
+
segments?: Segment[];
|
|
14
|
+
formatTotal?: (value: number) => string | number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ProcessedSegment extends Segment {
|
|
18
|
+
rawDegrees: number;
|
|
19
|
+
needsMinimum: boolean;
|
|
20
|
+
actualDegrees: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface SegmentAngle {
|
|
24
|
+
color: string;
|
|
25
|
+
start: number;
|
|
26
|
+
end: number;
|
|
27
|
+
}
|