sdaia-ui 1.0.1
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/README.md +89 -0
- package/dist/PlayVideoIcon-BM-4pwUd.d.cts +7 -0
- package/dist/PlayVideoIcon-BM-4pwUd.d.ts +7 -0
- package/dist/dga-icons.cjs +14 -0
- package/dist/dga-icons.cjs.map +1 -0
- package/dist/dga-icons.d.cts +1 -0
- package/dist/dga-icons.d.ts +1 -0
- package/dist/dga-icons.js +3 -0
- package/dist/dga-icons.js.map +1 -0
- package/dist/icons.cjs +4014 -0
- package/dist/icons.cjs.map +1 -0
- package/dist/icons.d.cts +756 -0
- package/dist/icons.d.ts +756 -0
- package/dist/icons.js +3871 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.cjs +43620 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +9407 -0
- package/dist/index.d.ts +9407 -0
- package/dist/index.js +43411 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +242 -0
- package/package.json +65 -0
- package/src/components/Accordion/Accordion.tsx +207 -0
- package/src/components/Accordion/Accordion.types.ts +36 -0
- package/src/components/Accordion/Accordion.variants.ts +283 -0
- package/src/components/Accordion/index.ts +9 -0
- package/src/components/ActionBar/ActionBar.tsx +192 -0
- package/src/components/ActionBar/ActionBar.types.ts +67 -0
- package/src/components/ActionBar/ActionBar.variants.ts +95 -0
- package/src/components/ActionBar/index.ts +8 -0
- package/src/components/Activity/Activity.tsx +52 -0
- package/src/components/Activity/Activity.types.ts +19 -0
- package/src/components/Activity/Activity.variants.ts +15 -0
- package/src/components/Activity/index.ts +2 -0
- package/src/components/ActivityItem/ActivityItem.tsx +298 -0
- package/src/components/ActivityItem/ActivityItem.types.ts +76 -0
- package/src/components/ActivityItem/ActivityItem.variants.ts +117 -0
- package/src/components/ActivityItem/index.ts +8 -0
- package/src/components/Alert/Alert.tsx +183 -0
- package/src/components/Alert/Alert.types.ts +34 -0
- package/src/components/Alert/Alert.variants.ts +168 -0
- package/src/components/Alert/index.ts +2 -0
- package/src/components/AreaChart/AreaChart.tsx +454 -0
- package/src/components/AreaChart/AreaChart.types.ts +117 -0
- package/src/components/AreaChart/AreaChart.variants.ts +202 -0
- package/src/components/AreaChart/index.ts +2 -0
- package/src/components/AspectRatio/AspectRatio.tsx +36 -0
- package/src/components/AspectRatio/AspectRatio.types.ts +33 -0
- package/src/components/AspectRatio/AspectRatio.variants.ts +42 -0
- package/src/components/AspectRatio/index.ts +2 -0
- package/src/components/AudioPlayer/AudioPlayer.tsx +294 -0
- package/src/components/AudioPlayer/AudioPlayer.types.ts +64 -0
- package/src/components/AudioPlayer/AudioPlayer.variants.ts +225 -0
- package/src/components/AudioPlayer/index.ts +2 -0
- package/src/components/Autocomplete/Autocomplete.tsx +353 -0
- package/src/components/Autocomplete/Autocomplete.types.ts +93 -0
- package/src/components/Autocomplete/Autocomplete.variants.ts +149 -0
- package/src/components/Autocomplete/index.ts +6 -0
- package/src/components/Avatar/Avatar.tsx +168 -0
- package/src/components/Avatar/Avatar.types.ts +36 -0
- package/src/components/Avatar/Avatar.variants.ts +102 -0
- package/src/components/Avatar/index.ts +7 -0
- package/src/components/AvatarGroup/AvatarGroup.tsx +87 -0
- package/src/components/AvatarGroup/AvatarGroup.types.ts +44 -0
- package/src/components/AvatarGroup/AvatarGroup.variants.ts +17 -0
- package/src/components/AvatarGroup/index.ts +6 -0
- package/src/components/Badge/Badge.tsx +74 -0
- package/src/components/Badge/Badge.types.ts +31 -0
- package/src/components/Badge/Badge.variants.ts +83 -0
- package/src/components/Badge/index.ts +2 -0
- package/src/components/Bar/Bar.tsx +57 -0
- package/src/components/Bar/Bar.types.ts +18 -0
- package/src/components/Bar/Bar.variants.ts +20 -0
- package/src/components/Bar/index.ts +2 -0
- package/src/components/BarChart/BarChart.tsx +179 -0
- package/src/components/BarChart/BarChart.types.ts +72 -0
- package/src/components/BarChart/BarChart.variants.ts +134 -0
- package/src/components/BarChart/index.ts +2 -0
- package/src/components/BarGroup/BarGroup.tsx +119 -0
- package/src/components/BarGroup/BarGroup.types.ts +50 -0
- package/src/components/BarGroup/BarGroup.variants.ts +76 -0
- package/src/components/BarGroup/index.ts +2 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +137 -0
- package/src/components/Breadcrumb/Breadcrumb.types.ts +21 -0
- package/src/components/Breadcrumb/BreadcrumbItem.tsx +267 -0
- package/src/components/Breadcrumb/BreadcrumbItem.types.ts +66 -0
- package/src/components/Breadcrumb/BreadcrumbItem.variants.ts +102 -0
- package/src/components/Breadcrumb/index.ts +12 -0
- package/src/components/Button/Button.tsx +100 -0
- package/src/components/Button/Button.types.ts +44 -0
- package/src/components/Button/Button.variants.ts +183 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/ButtonClose/ButtonClose.tsx +57 -0
- package/src/components/ButtonClose/ButtonClose.types.ts +18 -0
- package/src/components/ButtonClose/ButtonClose.variants.ts +72 -0
- package/src/components/ButtonClose/index.ts +2 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +127 -0
- package/src/components/ButtonGroup/ButtonGroup.types.ts +51 -0
- package/src/components/ButtonGroup/ButtonGroup.variants.ts +65 -0
- package/src/components/ButtonGroup/index.ts +2 -0
- package/src/components/ButtonMenu/ButtonMenu.tsx +73 -0
- package/src/components/ButtonMenu/ButtonMenu.types.ts +43 -0
- package/src/components/ButtonMenu/ButtonMenu.variants.ts +18 -0
- package/src/components/ButtonMenu/index.ts +2 -0
- package/src/components/ButtonSplit/ButtonSplit.tsx +344 -0
- package/src/components/ButtonSplit/ButtonSplit.types.ts +95 -0
- package/src/components/ButtonSplit/ButtonSplit.variants.ts +165 -0
- package/src/components/ButtonSplit/index.ts +7 -0
- package/src/components/ButtonsWithSdaiaTouch/ButtonHoverPattern.tsx +69 -0
- package/src/components/ButtonsWithSdaiaTouch/ButtonsWithSdaiaTouch.tsx +130 -0
- package/src/components/ButtonsWithSdaiaTouch/ButtonsWithSdaiaTouch.types.ts +4 -0
- package/src/components/ButtonsWithSdaiaTouch/ButtonsWithSdaiaTouch.variants.ts +19 -0
- package/src/components/ButtonsWithSdaiaTouch/index.ts +6 -0
- package/src/components/CLAUDE.md +212 -0
- package/src/components/CalendarHeader/CalendarHeader.tsx +224 -0
- package/src/components/CalendarHeader/CalendarHeader.types.ts +51 -0
- package/src/components/CalendarHeader/CalendarHeader.variants.ts +65 -0
- package/src/components/CalendarHeader/index.ts +2 -0
- package/src/components/Card/Card.tsx +76 -0
- package/src/components/Card/Card.types.ts +11 -0
- package/src/components/Card/Card.variants.ts +30 -0
- package/src/components/Card/index.ts +2 -0
- package/src/components/CardContent/CardContent.tsx +178 -0
- package/src/components/CardContent/CardContent.types.ts +70 -0
- package/src/components/CardContent/CardContent.variants.ts +90 -0
- package/src/components/CardContent/index.ts +6 -0
- package/src/components/CardFooter/CardFooter.tsx +196 -0
- package/src/components/CardFooter/CardFooter.types.ts +59 -0
- package/src/components/CardFooter/CardFooter.variants.ts +127 -0
- package/src/components/CardFooter/index.ts +8 -0
- package/src/components/CardHeader/CardHeader.tsx +150 -0
- package/src/components/CardHeader/CardHeader.types.ts +42 -0
- package/src/components/CardHeader/CardHeader.variants.ts +72 -0
- package/src/components/CardHeader/index.ts +5 -0
- package/src/components/CardLeadingItem/CardLeadingItem.tsx +166 -0
- package/src/components/CardLeadingItem/CardLeadingItem.types.ts +75 -0
- package/src/components/CardLeadingItem/CardLeadingItem.variants.ts +66 -0
- package/src/components/CardLeadingItem/index.ts +6 -0
- package/src/components/CardMedia/CardMedia.tsx +324 -0
- package/src/components/CardMedia/CardMedia.types.ts +114 -0
- package/src/components/CardMedia/CardMedia.variants.ts +139 -0
- package/src/components/CardMedia/index.ts +2 -0
- package/src/components/Carousel/Carousel.tsx +182 -0
- package/src/components/Carousel/Carousel.types.ts +38 -0
- package/src/components/Carousel/Carousel.variants.ts +17 -0
- package/src/components/Carousel/index.ts +2 -0
- package/src/components/CarouselArrow/CarouselArrow.tsx +66 -0
- package/src/components/CarouselArrow/CarouselArrow.types.ts +26 -0
- package/src/components/CarouselArrow/CarouselArrow.variants.ts +83 -0
- package/src/components/CarouselArrow/index.ts +7 -0
- package/src/components/CarouselControlsGroup/CarouselControlsGroup.tsx +81 -0
- package/src/components/CarouselControlsGroup/CarouselControlsGroup.types.ts +24 -0
- package/src/components/CarouselControlsGroup/CarouselControlsGroup.variants.ts +60 -0
- package/src/components/CarouselControlsGroup/index.ts +6 -0
- package/src/components/CarouselImage/CarouselImage.tsx +253 -0
- package/src/components/CarouselImage/CarouselImage.types.ts +72 -0
- package/src/components/CarouselImage/CarouselImage.variants.ts +43 -0
- package/src/components/CarouselImage/index.ts +6 -0
- package/src/components/Chart/Chart.tsx +3 -0
- package/src/components/Chart/Chart.types.ts +2 -0
- package/src/components/Chart/Chart.variants.ts +2 -0
- package/src/components/Chart/index.ts +2 -0
- package/src/components/ChartBadge/ChartBadge.tsx +62 -0
- package/src/components/ChartBadge/ChartBadge.types.ts +27 -0
- package/src/components/ChartBadge/ChartBadge.variants.ts +62 -0
- package/src/components/ChartBadge/index.ts +2 -0
- package/src/components/Checkbox/Checkbox.tsx +243 -0
- package/src/components/Checkbox/Checkbox.types.ts +20 -0
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/CheckboxLabel/CheckboxLabel.tsx +148 -0
- package/src/components/CheckboxLabel/CheckboxLabel.types.ts +55 -0
- package/src/components/CheckboxLabel/CheckboxLabel.variants.ts +35 -0
- package/src/components/CheckboxLabel/index.ts +2 -0
- package/src/components/Chip/Chip.tsx +245 -0
- package/src/components/Chip/Chip.types.ts +83 -0
- package/src/components/Chip/Chip.variants.ts +143 -0
- package/src/components/Chip/index.ts +2 -0
- package/src/components/CircularItem/CircularItem.tsx +133 -0
- package/src/components/CircularItem/CircularItem.types.ts +45 -0
- package/src/components/CircularItem/CircularItem.variants.ts +128 -0
- package/src/components/CircularItem/index.ts +7 -0
- package/src/components/CodeSnippet/CodeSnippet.tsx +421 -0
- package/src/components/CodeSnippet/CodeSnippet.types.ts +99 -0
- package/src/components/CodeSnippet/CodeSnippet.variants.ts +76 -0
- package/src/components/CodeSnippet/index.ts +9 -0
- package/src/components/ColumnChart/ColumnChart.tsx +943 -0
- package/src/components/ColumnChart/ColumnChart.types.ts +98 -0
- package/src/components/ColumnChart/ColumnChart.variants.ts +117 -0
- package/src/components/ColumnChart/index.ts +9 -0
- package/src/components/ComplexComposition/ComplexComposition.tsx +82 -0
- package/src/components/ComplexComposition/ComplexComposition.types.ts +3 -0
- package/src/components/ComplexComposition/ComplexComposition.variants.ts +14 -0
- package/src/components/ComplexComposition/index.ts +2 -0
- package/src/components/ContentSwitcher/ContentSwitcher.tsx +104 -0
- package/src/components/ContentSwitcher/ContentSwitcher.types.ts +28 -0
- package/src/components/ContentSwitcher/ContentSwitcher.variants.ts +70 -0
- package/src/components/ContentSwitcher/index.ts +6 -0
- package/src/components/ContentSwitcherItem/ContentSwitcherItem.tsx +56 -0
- package/src/components/ContentSwitcherItem/ContentSwitcherItem.types.ts +14 -0
- package/src/components/ContentSwitcherItem/ContentSwitcherItem.variants.ts +65 -0
- package/src/components/ContentSwitcherItem/index.ts +6 -0
- package/src/components/ContextMenu/ContextMenu.tsx +101 -0
- package/src/components/ContextMenu/ContextMenu.types.ts +64 -0
- package/src/components/ContextMenu/ContextMenu.variants.ts +36 -0
- package/src/components/ContextMenu/index.ts +7 -0
- package/src/components/ContextMenuDropdown/ContextMenuDropdown.tsx +370 -0
- package/src/components/ContextMenuDropdown/ContextMenuDropdown.types.ts +89 -0
- package/src/components/ContextMenuDropdown/ContextMenuDropdown.variants.ts +88 -0
- package/src/components/ContextMenuDropdown/index.ts +5 -0
- package/src/components/DateCell/DateCell.tsx +181 -0
- package/src/components/DateCell/DateCell.types.ts +53 -0
- package/src/components/DateCell/DateCell.variants.ts +217 -0
- package/src/components/DateCell/index.ts +2 -0
- package/src/components/DatePicker/DatePicker.tsx +923 -0
- package/src/components/DatePicker/DatePicker.types.ts +102 -0
- package/src/components/DatePicker/DatePicker.variants.ts +274 -0
- package/src/components/DatePicker/index.ts +9 -0
- package/src/components/DateTab/DateTab.tsx +91 -0
- package/src/components/DateTab/DateTab.types.ts +9 -0
- package/src/components/DateTab/DateTab.variants.ts +98 -0
- package/src/components/DateTab/index.ts +2 -0
- package/src/components/DgaIcon/DgaIcon.tsx +68 -0
- package/src/components/DgaIcon/DgaIcon.types.ts +57 -0
- package/src/components/DgaIcon/DgaIcon.variants.ts +41 -0
- package/src/components/DgaIcon/DgaIconByName.tsx +76 -0
- package/src/components/DgaIcon/generated/icon-names.ts +4388 -0
- package/src/components/DgaIcon/index.ts +12 -0
- package/src/components/DgaIcon/lib/decodeDataUrl.ts +46 -0
- package/src/components/DigitalStamp/DigitalStamp.tsx +236 -0
- package/src/components/DigitalStamp/DigitalStamp.types.ts +38 -0
- package/src/components/DigitalStamp/DigitalStamp.variants.ts +185 -0
- package/src/components/DigitalStamp/index.ts +2 -0
- package/src/components/Divider/Divider.tsx +83 -0
- package/src/components/Divider/Divider.types.ts +49 -0
- package/src/components/Divider/Divider.variants.ts +55 -0
- package/src/components/Divider/index.ts +8 -0
- package/src/components/DonutChart/DonutChart.tsx +251 -0
- package/src/components/DonutChart/DonutChart.types.ts +97 -0
- package/src/components/DonutChart/DonutChart.variants.ts +203 -0
- package/src/components/DonutChart/index.ts +7 -0
- package/src/components/DonutChartPanel/DonutChartPanel.tsx +778 -0
- package/src/components/DonutChartPanel/DonutChartPanel.types.ts +143 -0
- package/src/components/DonutChartPanel/DonutChartPanel.variants.ts +154 -0
- package/src/components/DonutChartPanel/index.ts +9 -0
- package/src/components/DraggableItem/DraggableItem.tsx +228 -0
- package/src/components/DraggableItem/DraggableItem.types.ts +72 -0
- package/src/components/DraggableItem/DraggableItem.variants.ts +149 -0
- package/src/components/DraggableItem/index.ts +3 -0
- package/src/components/DraggableList/DraggableList.tsx +20 -0
- package/src/components/DraggableList/DraggableList.types.ts +16 -0
- package/src/components/DraggableList/DraggableList.variants.ts +13 -0
- package/src/components/DraggableList/index.ts +3 -0
- package/src/components/Dropdown/Dropdown.tsx +331 -0
- package/src/components/Dropdown/Dropdown.types.ts +108 -0
- package/src/components/Dropdown/Dropdown.variants.ts +73 -0
- package/src/components/Dropdown/index.ts +9 -0
- package/src/components/DropdownListHeader/DropdownListHeader.tsx +79 -0
- package/src/components/DropdownListHeader/DropdownListHeader.types.ts +24 -0
- package/src/components/DropdownListHeader/DropdownListHeader.variants.ts +65 -0
- package/src/components/DropdownListHeader/index.ts +2 -0
- package/src/components/EmptyState/EmptyState.tsx +221 -0
- package/src/components/EmptyState/EmptyState.types.ts +48 -0
- package/src/components/EmptyState/EmptyState.variants.ts +122 -0
- package/src/components/EmptyState/index.ts +3 -0
- package/src/components/Extension/Extension.tsx +240 -0
- package/src/components/Extension/Extension.types.ts +40 -0
- package/src/components/Extension/Extension.variants.ts +27 -0
- package/src/components/Extension/index.ts +6 -0
- package/src/components/Feedback/Feedback.tsx +55 -0
- package/src/components/Feedback/Feedback.types.ts +15 -0
- package/src/components/Feedback/Feedback.variants.ts +9 -0
- package/src/components/Feedback/index.ts +2 -0
- package/src/components/FeedbackOverview/FeedbackOverview.tsx +70 -0
- package/src/components/FeedbackOverview/FeedbackOverview.types.ts +11 -0
- package/src/components/FeedbackOverview/FeedbackOverview.variants.ts +17 -0
- package/src/components/FeedbackOverview/index.ts +2 -0
- package/src/components/FeedbackReaction/FeedbackReaction.tsx +81 -0
- package/src/components/FeedbackReaction/FeedbackReaction.types.ts +14 -0
- package/src/components/FeedbackReaction/FeedbackReaction.variants.ts +39 -0
- package/src/components/FeedbackReaction/index.ts +2 -0
- package/src/components/FileUploadBase/FileUploadBase.tsx +104 -0
- package/src/components/FileUploadBase/FileUploadBase.types.ts +48 -0
- package/src/components/FileUploadBase/FileUploadBase.variants.ts +51 -0
- package/src/components/FileUploadBase/index.ts +2 -0
- package/src/components/FileUploadItemBase/FileUploadItemBase.tsx +197 -0
- package/src/components/FileUploadItemBase/FileUploadItemBase.types.ts +58 -0
- package/src/components/FileUploadItemBase/FileUploadItemBase.variants.ts +67 -0
- package/src/components/FileUploadItemBase/index.ts +6 -0
- package/src/components/FileUploader/FileUploader.tsx +164 -0
- package/src/components/FileUploader/FileUploader.types.ts +46 -0
- package/src/components/FileUploader/FileUploader.variants.ts +9 -0
- package/src/components/FileUploader/index.ts +2 -0
- package/src/components/Filtration/Filtration.tsx +260 -0
- package/src/components/Filtration/Filtration.types.ts +95 -0
- package/src/components/Filtration/Filtration.variants.ts +70 -0
- package/src/components/Filtration/index.ts +6 -0
- package/src/components/FiltrationItem/FiltrationItem.tsx +200 -0
- package/src/components/FiltrationItem/FiltrationItem.types.ts +57 -0
- package/src/components/FiltrationItem/FiltrationItem.variants.ts +81 -0
- package/src/components/FiltrationItem/index.ts +2 -0
- package/src/components/FiltrationList/FiltrationList.tsx +611 -0
- package/src/components/FiltrationList/FiltrationList.types.ts +191 -0
- package/src/components/FiltrationList/FiltrationList.variants.ts +283 -0
- package/src/components/FiltrationList/index.ts +16 -0
- package/src/components/FloatingButton/FloatingButton.tsx +89 -0
- package/src/components/FloatingButton/FloatingButton.types.ts +29 -0
- package/src/components/FloatingButton/FloatingButton.variants.ts +79 -0
- package/src/components/FloatingButton/index.ts +6 -0
- package/src/components/Footer/Footer.tsx +353 -0
- package/src/components/Footer/Footer.types.ts +142 -0
- package/src/components/Footer/Footer.variants.ts +137 -0
- package/src/components/Footer/index.ts +11 -0
- package/src/components/FooterItem/FooterItem.tsx +211 -0
- package/src/components/FooterItem/FooterItem.types.ts +45 -0
- package/src/components/FooterItem/FooterItem.variants.ts +139 -0
- package/src/components/FooterItem/index.ts +2 -0
- package/src/components/FooterLinkList/FooterLinkList.tsx +140 -0
- package/src/components/FooterLinkList/FooterLinkList.types.ts +46 -0
- package/src/components/FooterLinkList/FooterLinkList.variants.ts +64 -0
- package/src/components/FooterLinkList/index.ts +2 -0
- package/src/components/GraphBase/GraphBase.tsx +598 -0
- package/src/components/GraphBase/GraphBase.types.ts +101 -0
- package/src/components/GraphBase/GraphBase.variants.ts +126 -0
- package/src/components/GraphBase/index.ts +7 -0
- package/src/components/HeaderItem/HeaderItem.tsx +206 -0
- package/src/components/HeaderItem/HeaderItem.types.ts +73 -0
- package/src/components/HeaderItem/HeaderItem.variants.ts +139 -0
- package/src/components/HeaderItem/index.ts +2 -0
- package/src/components/HelpIcon/HelpIcon.tsx +173 -0
- package/src/components/HelpIcon/HelpIcon.types.ts +54 -0
- package/src/components/HelpIcon/HelpIcon.variants.ts +79 -0
- package/src/components/HelpIcon/index.ts +2 -0
- package/src/components/HorizontalTabs/HorizontalTabs.tsx +87 -0
- package/src/components/HorizontalTabs/HorizontalTabs.types.ts +41 -0
- package/src/components/HorizontalTabs/HorizontalTabs.variants.ts +54 -0
- package/src/components/HorizontalTabs/index.ts +6 -0
- package/src/components/IllustrationInstance/IllustrationInstance.tsx +46 -0
- package/src/components/IllustrationInstance/IllustrationInstance.types.ts +25 -0
- package/src/components/IllustrationInstance/IllustrationInstance.variants.ts +19 -0
- package/src/components/IllustrationInstance/index.ts +3 -0
- package/src/components/ImagePreview/ImagePreview.tsx +170 -0
- package/src/components/ImagePreview/ImagePreview.types.ts +54 -0
- package/src/components/ImagePreview/ImagePreview.variants.ts +39 -0
- package/src/components/ImagePreview/index.ts +2 -0
- package/src/components/Input/Input.tsx +113 -0
- package/src/components/Input/Input.types.ts +22 -0
- package/src/components/Input/index.ts +2 -0
- package/src/components/InputPrefixSuffix/InputPrefixSuffix.tsx +91 -0
- package/src/components/InputPrefixSuffix/InputPrefixSuffix.types.ts +81 -0
- package/src/components/InputPrefixSuffix/InputPrefixSuffix.variants.ts +128 -0
- package/src/components/InputPrefixSuffix/index.ts +8 -0
- package/src/components/InputsActions/InputsActions.tsx +53 -0
- package/src/components/InputsActions/InputsActions.types.ts +13 -0
- package/src/components/InputsActions/InputsActions.variants.ts +18 -0
- package/src/components/InputsActions/index.ts +2 -0
- package/src/components/InstanceColumn/InstanceColumn.tsx +43 -0
- package/src/components/InstanceColumn/InstanceColumn.types.ts +18 -0
- package/src/components/InstanceColumn/InstanceColumn.variants.ts +11 -0
- package/src/components/InstanceColumn/index.ts +2 -0
- package/src/components/InstanceItem/InstanceItem.tsx +33 -0
- package/src/components/InstanceItem/InstanceItem.types.ts +11 -0
- package/src/components/InstanceItem/InstanceItem.variants.ts +31 -0
- package/src/components/InstanceItem/index.ts +2 -0
- package/src/components/InstanceRows/InstanceRows.tsx +41 -0
- package/src/components/InstanceRows/InstanceRows.types.ts +17 -0
- package/src/components/InstanceRows/InstanceRows.variants.ts +10 -0
- package/src/components/InstanceRows/index.ts +2 -0
- package/src/components/InstanceSlot/InstanceSlot.tsx +25 -0
- package/src/components/InstanceSlot/InstanceSlot.types.ts +10 -0
- package/src/components/InstanceSlot/InstanceSlot.variants.ts +2 -0
- package/src/components/InstanceSlot/index.ts +2 -0
- package/src/components/LineChart/LineChart.tsx +592 -0
- package/src/components/LineChart/LineChart.types.ts +78 -0
- package/src/components/LineChart/LineChart.variants.ts +324 -0
- package/src/components/LineChart/index.ts +7 -0
- package/src/components/Link/Link.tsx +81 -0
- package/src/components/Link/Link.types.ts +23 -0
- package/src/components/Link/Link.variants.ts +69 -0
- package/src/components/Link/index.ts +2 -0
- package/src/components/List/List.tsx +260 -0
- package/src/components/List/List.types.ts +70 -0
- package/src/components/List/List.variants.ts +94 -0
- package/src/components/List/index.ts +5 -0
- package/src/components/ListGroup/ListGroup.tsx +37 -0
- package/src/components/ListGroup/ListGroup.types.ts +14 -0
- package/src/components/ListGroup/ListGroup.variants.ts +17 -0
- package/src/components/ListGroup/index.ts +3 -0
- package/src/components/LoadingIndicator/LoadingIndicator.tsx +208 -0
- package/src/components/LoadingIndicator/LoadingIndicator.types.ts +51 -0
- package/src/components/LoadingIndicator/LoadingIndicator.variants.ts +108 -0
- package/src/components/LoadingIndicator/index.ts +7 -0
- package/src/components/MediaGallery/MediaGallery.tsx +600 -0
- package/src/components/MediaGallery/MediaGallery.types.ts +124 -0
- package/src/components/MediaGallery/MediaGallery.variants.ts +116 -0
- package/src/components/MediaGallery/index.ts +2 -0
- package/src/components/MediaGrids/MediaGrids.tsx +48 -0
- package/src/components/MediaGrids/MediaGrids.types.ts +14 -0
- package/src/components/MediaGrids/MediaGrids.variants.ts +16 -0
- package/src/components/MediaGrids/index.ts +2 -0
- package/src/components/MediaViewer/MediaViewer.tsx +345 -0
- package/src/components/MediaViewer/MediaViewer.types.ts +59 -0
- package/src/components/MediaViewer/MediaViewer.variants.ts +168 -0
- package/src/components/MediaViewer/index.ts +2 -0
- package/src/components/Menu/Menu.tsx +109 -0
- package/src/components/Menu/Menu.types.ts +37 -0
- package/src/components/Menu/Menu.variants.ts +29 -0
- package/src/components/Menu/index.ts +2 -0
- package/src/components/MenuButtonItem/MenuButtonItem.tsx +280 -0
- package/src/components/MenuButtonItem/MenuButtonItem.types.ts +91 -0
- package/src/components/MenuButtonItem/MenuButtonItem.variants.ts +223 -0
- package/src/components/MenuButtonItem/index.ts +8 -0
- package/src/components/MenuItem/MenuItem.tsx +211 -0
- package/src/components/MenuItem/MenuItem.types.ts +40 -0
- package/src/components/MenuItem/MenuItem.variants.ts +48 -0
- package/src/components/MenuItem/index.ts +2 -0
- package/src/components/MenuItemGroup/MenuItemGroup.tsx +91 -0
- package/src/components/MenuItemGroup/MenuItemGroup.types.ts +82 -0
- package/src/components/MenuItemGroup/MenuItemGroup.variants.ts +33 -0
- package/src/components/MenuItemGroup/index.ts +2 -0
- package/src/components/MenuList/MenuList.tsx +44 -0
- package/src/components/MenuList/MenuList.types.ts +28 -0
- package/src/components/MenuList/MenuList.variants.ts +2 -0
- package/src/components/MenuList/index.ts +2 -0
- package/src/components/Metric/Metric.tsx +584 -0
- package/src/components/Metric/Metric.types.ts +77 -0
- package/src/components/Metric/Metric.variants.ts +175 -0
- package/src/components/Metric/index.ts +8 -0
- package/src/components/Modal/Modal.tsx +139 -0
- package/src/components/Modal/Modal.types.ts +55 -0
- package/src/components/Modal/index.ts +2 -0
- package/src/components/ModalActions/ModalActions.tsx +176 -0
- package/src/components/ModalActions/ModalActions.types.ts +31 -0
- package/src/components/ModalActions/index.ts +2 -0
- package/src/components/ModalHeader/ModalHeader.tsx +207 -0
- package/src/components/ModalHeader/ModalHeader.types.ts +24 -0
- package/src/components/ModalHeader/index.ts +2 -0
- package/src/components/NavBar/NavBar.tsx +326 -0
- package/src/components/NavBar/NavBar.types.ts +78 -0
- package/src/components/NavBar/NavBar.variants.ts +139 -0
- package/src/components/NavBar/index.ts +2 -0
- package/src/components/NavHeader/NavHeader.tsx +292 -0
- package/src/components/NavHeader/NavHeader.types.ts +145 -0
- package/src/components/NavHeader/NavHeader.variants.ts +178 -0
- package/src/components/NavHeader/index.ts +2 -0
- package/src/components/NavHeaderActions/NavHeaderActions.tsx +161 -0
- package/src/components/NavHeaderActions/NavHeaderActions.types.ts +61 -0
- package/src/components/NavHeaderActions/NavHeaderActions.variants.ts +58 -0
- package/src/components/NavHeaderActions/index.ts +2 -0
- package/src/components/NavHeaderDropdownItem/NavHeaderDropdownItem.tsx +243 -0
- package/src/components/NavHeaderDropdownItem/NavHeaderDropdownItem.types.ts +76 -0
- package/src/components/NavHeaderDropdownItem/NavHeaderDropdownItem.variants.ts +133 -0
- package/src/components/NavHeaderDropdownItem/index.ts +5 -0
- package/src/components/NavHeaderDropdownItemList/NavHeaderDropdownItemList.tsx +64 -0
- package/src/components/NavHeaderDropdownItemList/NavHeaderDropdownItemList.types.ts +55 -0
- package/src/components/NavHeaderDropdownItemList/NavHeaderDropdownItemList.variants.ts +47 -0
- package/src/components/NavHeaderDropdownItemList/index.ts +5 -0
- package/src/components/NavHeaderMenuButton/NavHeaderMenuButton.tsx +52 -0
- package/src/components/NavHeaderMenuButton/NavHeaderMenuButton.types.ts +17 -0
- package/src/components/NavHeaderMenuButton/NavHeaderMenuButton.variants.ts +73 -0
- package/src/components/NavHeaderMenuButton/index.ts +2 -0
- package/src/components/NavHeaderMenuCard/NavHeaderMenuCard.tsx +126 -0
- package/src/components/NavHeaderMenuCard/NavHeaderMenuCard.types.ts +74 -0
- package/src/components/NavHeaderMenuCard/NavHeaderMenuCard.variants.ts +169 -0
- package/src/components/NavHeaderMenuCard/index.ts +6 -0
- package/src/components/NavHeaderMenuItem/NavHeaderMenuItem.tsx +164 -0
- package/src/components/NavHeaderMenuItem/NavHeaderMenuItem.types.ts +64 -0
- package/src/components/NavHeaderMenuItem/NavHeaderMenuItem.variants.ts +175 -0
- package/src/components/NavHeaderMenuItem/index.ts +2 -0
- package/src/components/NavItem/NavItem.tsx +210 -0
- package/src/components/NavItem/NavItem.types.ts +71 -0
- package/src/components/NavItem/NavItem.variants.ts +61 -0
- package/src/components/NavItem/index.ts +2 -0
- package/src/components/NavLabel/NavLabel.tsx +84 -0
- package/src/components/NavLabel/NavLabel.types.ts +55 -0
- package/src/components/NavLabel/NavLabel.variants.ts +68 -0
- package/src/components/NavLabel/index.ts +2 -0
- package/src/components/NavLogoPlaceholder/NavLogoPlaceholder.tsx +101 -0
- package/src/components/NavLogoPlaceholder/NavLogoPlaceholder.types.ts +27 -0
- package/src/components/NavLogoPlaceholder/NavLogoPlaceholder.variants.ts +42 -0
- package/src/components/NavLogoPlaceholder/index.ts +6 -0
- package/src/components/NotificationBanner/NotificationBanner.tsx +256 -0
- package/src/components/NotificationBanner/NotificationBanner.types.ts +77 -0
- package/src/components/NotificationBanner/NotificationBanner.variants.ts +109 -0
- package/src/components/NotificationBanner/index.ts +7 -0
- package/src/components/NotificationPopup/NotificationPopup.tsx +147 -0
- package/src/components/NotificationPopup/NotificationPopup.types.ts +51 -0
- package/src/components/NotificationPopup/NotificationPopup.variants.ts +145 -0
- package/src/components/NotificationPopup/index.ts +5 -0
- package/src/components/Notifications/Notifications.tsx +209 -0
- package/src/components/Notifications/Notifications.types.ts +68 -0
- package/src/components/Notifications/Notifications.variants.ts +89 -0
- package/src/components/Notifications/index.ts +2 -0
- package/src/components/Number/Number.tsx +497 -0
- package/src/components/Number/Number.types.ts +58 -0
- package/src/components/Number/Number.variants.ts +94 -0
- package/src/components/Number/index.ts +2 -0
- package/src/components/NumberInput/NumberInput.tsx +265 -0
- package/src/components/NumberInput/NumberInput.types.ts +110 -0
- package/src/components/NumberInput/NumberInput.variants.ts +205 -0
- package/src/components/NumberInput/index.ts +6 -0
- package/src/components/Pagination/Pagination.tsx +393 -0
- package/src/components/Pagination/Pagination.types.ts +26 -0
- package/src/components/Pagination/Pagination.variants.ts +88 -0
- package/src/components/Pagination/index.ts +3 -0
- package/src/components/PaginationButtonGroup/PaginationButtonGroup.tsx +132 -0
- package/src/components/PaginationButtonGroup/PaginationButtonGroup.types.ts +20 -0
- package/src/components/PaginationButtonGroup/PaginationButtonGroup.variants.ts +45 -0
- package/src/components/PaginationButtonGroup/index.ts +8 -0
- package/src/components/PaginationCells/PaginationCells.tsx +105 -0
- package/src/components/PaginationCells/PaginationCells.types.ts +31 -0
- package/src/components/PaginationCells/PaginationCells.variants.ts +96 -0
- package/src/components/PaginationCells/index.ts +9 -0
- package/src/components/PdfViewer/PdfViewer.tsx +265 -0
- package/src/components/PdfViewer/PdfViewer.types.ts +79 -0
- package/src/components/PdfViewer/PdfViewer.variants.ts +105 -0
- package/src/components/PdfViewer/index.ts +3 -0
- package/src/components/PieChartPanel/PieChartPanel.tsx +889 -0
- package/src/components/PieChartPanel/PieChartPanel.types.ts +130 -0
- package/src/components/PieChartPanel/PieChartPanel.variants.ts +156 -0
- package/src/components/PieChartPanel/index.ts +8 -0
- package/src/components/Popover/Popover.tsx +398 -0
- package/src/components/Popover/Popover.types.ts +155 -0
- package/src/components/Popover/Popover.variants.ts +147 -0
- package/src/components/Popover/index.ts +7 -0
- package/src/components/ProgressBar/ProgressBar.tsx +241 -0
- package/src/components/ProgressBar/ProgressBar.types.ts +22 -0
- package/src/components/ProgressBar/ProgressBar.variants.ts +54 -0
- package/src/components/ProgressBar/index.ts +2 -0
- package/src/components/ProgressCircle/ProgressCircle.tsx +369 -0
- package/src/components/ProgressCircle/ProgressCircle.types.ts +26 -0
- package/src/components/ProgressCircle/ProgressCircle.variants.ts +88 -0
- package/src/components/ProgressCircle/index.ts +7 -0
- package/src/components/Quote/Quote.tsx +210 -0
- package/src/components/Quote/Quote.types.ts +73 -0
- package/src/components/Quote/Quote.variants.ts +106 -0
- package/src/components/Quote/index.ts +2 -0
- package/src/components/RadialStepper/RadialStepper.tsx +166 -0
- package/src/components/RadialStepper/RadialStepper.types.ts +77 -0
- package/src/components/RadialStepper/RadialStepper.variants.ts +122 -0
- package/src/components/RadialStepper/index.ts +7 -0
- package/src/components/RadioButton/RadioButton.tsx +237 -0
- package/src/components/RadioButton/RadioButton.types.ts +18 -0
- package/src/components/RadioButton/index.ts +2 -0
- package/src/components/RadioLabel/RadioLabel.tsx +157 -0
- package/src/components/RadioLabel/RadioLabel.types.ts +53 -0
- package/src/components/RadioLabel/RadioLabel.variants.ts +36 -0
- package/src/components/RadioLabel/index.ts +2 -0
- package/src/components/RangeSlider/RangeSlider.tsx +389 -0
- package/src/components/RangeSlider/RangeSlider.types.ts +38 -0
- package/src/components/RangeSlider/RangeSlider.variants.ts +27 -0
- package/src/components/RangeSlider/index.ts +2 -0
- package/src/components/Rating/Rating.tsx +246 -0
- package/src/components/Rating/Rating.types.ts +37 -0
- package/src/components/Rating/Rating.variants.ts +52 -0
- package/src/components/Rating/index.ts +8 -0
- package/src/components/RatingOverview/RatingOverview.tsx +170 -0
- package/src/components/RatingOverview/RatingOverview.types.ts +37 -0
- package/src/components/RatingOverview/RatingOverview.variants.ts +50 -0
- package/src/components/RatingOverview/index.ts +2 -0
- package/src/components/RatingStar/RatingStar.tsx +76 -0
- package/src/components/RatingStar/RatingStar.types.ts +18 -0
- package/src/components/RatingStar/RatingStar.variants.ts +34 -0
- package/src/components/RatingStar/index.ts +7 -0
- package/src/components/RichTextEditor/RichTextEditor.tsx +1341 -0
- package/src/components/RichTextEditor/RichTextEditor.types.ts +127 -0
- package/src/components/RichTextEditor/RichTextEditor.variants.ts +231 -0
- package/src/components/RichTextEditor/index.ts +6 -0
- package/src/components/ScatterChart/ScatterChart.tsx +164 -0
- package/src/components/ScatterChart/ScatterChart.types.ts +42 -0
- package/src/components/ScatterChart/ScatterChart.variants.ts +162 -0
- package/src/components/ScatterChart/index.ts +2 -0
- package/src/components/SdaiaLogoAnimation/BGSVG.tsx +216 -0
- package/src/components/SdaiaLogoAnimation/SdaiaLogoAnimation.tsx +120 -0
- package/src/components/SdaiaLogoAnimation/SdaiaLogoAnimation.types.ts +13 -0
- package/src/components/SdaiaLogoAnimation/SdaiaLogoAnimation.variants.ts +22 -0
- package/src/components/SdaiaLogoAnimation/index.ts +2 -0
- package/src/components/SdaiaTouch2dAnimation/SdaiaTouch2dAnimation.tsx +55 -0
- package/src/components/SdaiaTouch2dAnimation/SdaiaTouch2dAnimation.types.ts +12 -0
- package/src/components/SdaiaTouch2dAnimation/SdaiaTouch2dAnimation.variants.ts +28 -0
- package/src/components/SdaiaTouch2dAnimation/Star.tsx +82 -0
- package/src/components/SdaiaTouch2dAnimation/StarShape.tsx +78 -0
- package/src/components/SdaiaTouch2dAnimation/index.ts +6 -0
- package/src/components/SecondNavHeader/SecondNavHeader.tsx +80 -0
- package/src/components/SecondNavHeader/SecondNavHeader.types.ts +41 -0
- package/src/components/SecondNavHeader/SecondNavHeader.variants.ts +42 -0
- package/src/components/SecondNavHeader/index.ts +2 -0
- package/src/components/Select/Select.tsx +351 -0
- package/src/components/Select/Select.types.ts +102 -0
- package/src/components/Select/Select.variants.ts +111 -0
- package/src/components/Select/index.ts +2 -0
- package/src/components/SelectMenuItem/SelectMenuItem.tsx +132 -0
- package/src/components/SelectMenuItem/SelectMenuItem.types.ts +47 -0
- package/src/components/SelectMenuItem/SelectMenuItem.variants.ts +56 -0
- package/src/components/SelectMenuItem/index.ts +2 -0
- package/src/components/SeriesLabel/SeriesLabel.tsx +76 -0
- package/src/components/SeriesLabel/SeriesLabel.types.ts +27 -0
- package/src/components/SeriesLabel/SeriesLabel.variants.ts +84 -0
- package/src/components/SeriesLabel/index.ts +2 -0
- package/src/components/Signature/Signature.tsx +905 -0
- package/src/components/Signature/Signature.types.ts +68 -0
- package/src/components/Signature/Signature.variants.ts +115 -0
- package/src/components/Signature/index.ts +2 -0
- package/src/components/Skeleton/Skeleton.tsx +21 -0
- package/src/components/Skeleton/Skeleton.types.ts +15 -0
- package/src/components/Skeleton/Skeleton.variants.ts +14 -0
- package/src/components/Skeleton/index.ts +2 -0
- package/src/components/SkeletonAvatar/SkeletonAvatar.tsx +21 -0
- package/src/components/SkeletonAvatar/SkeletonAvatar.types.ts +15 -0
- package/src/components/SkeletonAvatar/SkeletonAvatar.variants.ts +14 -0
- package/src/components/SkeletonAvatar/index.ts +2 -0
- package/src/components/SlideoutMenu/SlideoutMenu.tsx +225 -0
- package/src/components/SlideoutMenu/SlideoutMenu.types.ts +39 -0
- package/src/components/SlideoutMenu/SlideoutMenuDivider.tsx +10 -0
- package/src/components/SlideoutMenu/SlideoutMenuSection.tsx +39 -0
- package/src/components/SlideoutMenu/index.ts +5 -0
- package/src/components/SlideoutMenuFooter/SlideoutMenuFooter.tsx +96 -0
- package/src/components/SlideoutMenuFooter/SlideoutMenuFooter.types.ts +28 -0
- package/src/components/SlideoutMenuFooter/SlideoutMenuFooter.variants.ts +49 -0
- package/src/components/SlideoutMenuFooter/index.ts +6 -0
- package/src/components/SlideoutMenuHeader/SlideoutMenuHeader.tsx +83 -0
- package/src/components/SlideoutMenuHeader/SlideoutMenuHeader.types.ts +19 -0
- package/src/components/SlideoutMenuHeader/SlideoutMenuHeader.variants.ts +78 -0
- package/src/components/SlideoutMenuHeader/index.ts +2 -0
- package/src/components/Slider/Slider.tsx +259 -0
- package/src/components/Slider/Slider.types.ts +22 -0
- package/src/components/Slider/Slider.variants.ts +23 -0
- package/src/components/Slider/index.ts +2 -0
- package/src/components/Sparkline/Sparkline.tsx +130 -0
- package/src/components/Sparkline/Sparkline.types.ts +36 -0
- package/src/components/Sparkline/Sparkline.variants.ts +118 -0
- package/src/components/Sparkline/index.ts +2 -0
- package/src/components/StatusDot/StatusDot.tsx +82 -0
- package/src/components/StatusDot/StatusDot.types.ts +35 -0
- package/src/components/StatusDot/StatusDot.variants.ts +66 -0
- package/src/components/StatusDot/index.ts +8 -0
- package/src/components/StructuredList/StructuredList.tsx +79 -0
- package/src/components/StructuredList/StructuredList.types.ts +27 -0
- package/src/components/StructuredList/index.ts +2 -0
- package/src/components/StructuredListGroup/StructuredListGroup.tsx +76 -0
- package/src/components/StructuredListGroup/StructuredListGroup.types.ts +27 -0
- package/src/components/StructuredListGroup/StructuredListGroup.variants.ts +14 -0
- package/src/components/StructuredListGroup/index.ts +5 -0
- package/src/components/StructuredListHeader/StructuredListHeader.tsx +98 -0
- package/src/components/StructuredListHeader/StructuredListHeader.types.ts +26 -0
- package/src/components/StructuredListHeader/StructuredListHeader.variants.ts +24 -0
- package/src/components/StructuredListHeader/index.ts +5 -0
- package/src/components/StructuredListRow/StructuredListRow.tsx +144 -0
- package/src/components/StructuredListRow/StructuredListRow.types.ts +37 -0
- package/src/components/StructuredListRow/StructuredListRow.variants.ts +53 -0
- package/src/components/StructuredListRow/index.ts +6 -0
- package/src/components/SubHeaderItem/SubHeaderItem.tsx +37 -0
- package/src/components/SubHeaderItem/SubHeaderItem.types.ts +20 -0
- package/src/components/SubHeaderItem/SubHeaderItem.variants.ts +23 -0
- package/src/components/SubHeaderItem/index.ts +2 -0
- package/src/components/Switch/Switch.tsx +138 -0
- package/src/components/Switch/Switch.types.ts +18 -0
- package/src/components/Switch/Switch.variants.ts +49 -0
- package/src/components/Switch/index.ts +2 -0
- package/src/components/SwitchLabel/SwitchLabel.tsx +114 -0
- package/src/components/SwitchLabel/SwitchLabel.types.ts +27 -0
- package/src/components/SwitchLabel/SwitchLabel.variants.ts +28 -0
- package/src/components/SwitchLabel/index.ts +2 -0
- package/src/components/Tab/Tab.tsx +92 -0
- package/src/components/Tab/Tab.types.ts +34 -0
- package/src/components/Tab/Tab.variants.ts +79 -0
- package/src/components/Tab/index.ts +2 -0
- package/src/components/Table/Table.tsx +353 -0
- package/src/components/Table/Table.types.ts +80 -0
- package/src/components/Table/Table.variants.ts +110 -0
- package/src/components/Table/index.ts +10 -0
- package/src/components/TableOfContent/TableOfContent.tsx +33 -0
- package/src/components/TableOfContent/TableOfContent.types.ts +15 -0
- package/src/components/TableOfContent/TableOfContent.variants.ts +27 -0
- package/src/components/TableOfContent/index.ts +2 -0
- package/src/components/TableOfContentItem/TableOfContentItem.tsx +85 -0
- package/src/components/TableOfContentItem/TableOfContentItem.types.ts +23 -0
- package/src/components/TableOfContentItem/TableOfContentItem.variants.ts +109 -0
- package/src/components/TableOfContentItem/index.ts +2 -0
- package/src/components/TableOfContentList/TableOfContentList.tsx +60 -0
- package/src/components/TableOfContentList/TableOfContentList.types.ts +39 -0
- package/src/components/TableOfContentList/TableOfContentList.variants.ts +6 -0
- package/src/components/TableOfContentList/index.ts +2 -0
- package/src/components/Tabs/Tabs.tsx +80 -0
- package/src/components/Tabs/Tabs.types.ts +36 -0
- package/src/components/Tabs/Tabs.variants.ts +23 -0
- package/src/components/Tabs/index.ts +2 -0
- package/src/components/Tag/Tag.tsx +114 -0
- package/src/components/Tag/Tag.types.ts +32 -0
- package/src/components/Tag/Tag.variants.ts +57 -0
- package/src/components/Tag/index.ts +2 -0
- package/src/components/TagCount/TagCount.tsx +45 -0
- package/src/components/TagCount/TagCount.types.ts +21 -0
- package/src/components/TagCount/TagCount.variants.ts +26 -0
- package/src/components/TagCount/index.ts +7 -0
- package/src/components/TextArea/TextArea.tsx +130 -0
- package/src/components/TextArea/TextArea.types.ts +20 -0
- package/src/components/TextArea/index.ts +2 -0
- package/src/components/TextInput/TextInput.tsx +568 -0
- package/src/components/TextInput/TextInput.types.ts +87 -0
- package/src/components/TextInput/TextInput.variants.ts +89 -0
- package/src/components/TextInput/TextInputTag.tsx +43 -0
- package/src/components/TextInput/TextInputTag.types.ts +14 -0
- package/src/components/TextInput/index.ts +4 -0
- package/src/components/Tooltip/Tooltip.tsx +229 -0
- package/src/components/Tooltip/Tooltip.types.ts +48 -0
- package/src/components/Tooltip/Tooltip.variants.ts +141 -0
- package/src/components/Tooltip/index.ts +10 -0
- package/src/components/TreeView/TreeView.tsx +130 -0
- package/src/components/TreeView/TreeView.types.ts +42 -0
- package/src/components/TreeView/TreeView.variants.ts +6 -0
- package/src/components/TreeView/index.ts +3 -0
- package/src/components/TreeViewItem/TreeViewItem.tsx +108 -0
- package/src/components/TreeViewItem/TreeViewItem.types.ts +34 -0
- package/src/components/TreeViewItem/TreeViewItem.variants.ts +40 -0
- package/src/components/TreeViewItem/index.ts +3 -0
- package/src/components/VerticalTabs/VerticalTabs.tsx +84 -0
- package/src/components/VerticalTabs/VerticalTabs.types.ts +37 -0
- package/src/components/VerticalTabs/VerticalTabs.variants.ts +43 -0
- package/src/components/VerticalTabs/index.ts +6 -0
- package/src/components/VideoPlayer/VideoPlayer.tsx +470 -0
- package/src/components/VideoPlayer/VideoPlayer.types.ts +59 -0
- package/src/components/VideoPlayer/VideoPlayer.variants.ts +134 -0
- package/src/components/VideoPlayer/index.ts +2 -0
- package/src/components/XAxis/XAxis.tsx +67 -0
- package/src/components/XAxis/XAxis.types.ts +30 -0
- package/src/components/XAxis/XAxis.variants.ts +77 -0
- package/src/components/XAxis/index.ts +2 -0
- package/src/components/YAxis/YAxis.tsx +78 -0
- package/src/components/YAxis/YAxis.types.ts +41 -0
- package/src/components/YAxis/YAxis.variants.ts +94 -0
- package/src/components/YAxis/index.ts +2 -0
- package/src/dga-icons.ts +18 -0
- package/src/hooks/usePresence.ts +73 -0
- package/src/icons/AIIcon.tsx +34 -0
- package/src/icons/AaIcon.tsx +34 -0
- package/src/icons/AlertCircle02Icon.tsx +28 -0
- package/src/icons/AlertCircleIcon.tsx +29 -0
- package/src/icons/AlertCircleSVG.tsx +19 -0
- package/src/icons/AlertCircleWarningIcon.tsx +37 -0
- package/src/icons/AlertTriangleIcon.tsx +27 -0
- package/src/icons/AlignCenterIcon.tsx +31 -0
- package/src/icons/AlignLeftIcon.tsx +31 -0
- package/src/icons/AlignRightIcon.tsx +31 -0
- package/src/icons/ArrowDownIcon.tsx +27 -0
- package/src/icons/ArrowDownLeft01Icon.tsx +32 -0
- package/src/icons/ArrowDownSVG.tsx +16 -0
- package/src/icons/ArrowIcon.tsx +38 -0
- package/src/icons/ArrowLeft01Icon.tsx +23 -0
- package/src/icons/ArrowLeft02SVG.tsx +19 -0
- package/src/icons/ArrowLeftIcon.tsx +28 -0
- package/src/icons/ArrowRight01Icon.tsx +23 -0
- package/src/icons/ArrowRight01SVG.tsx +16 -0
- package/src/icons/ArrowRightIcon.tsx +28 -0
- package/src/icons/ArrowUpIcon.tsx +27 -0
- package/src/icons/ArrowUpRight01Icon.tsx +31 -0
- package/src/icons/ArrowUpSVG.tsx +16 -0
- package/src/icons/AtIcon.tsx +33 -0
- package/src/icons/BeakBottom.tsx +13 -0
- package/src/icons/BeakDown.tsx +29 -0
- package/src/icons/BeakLeft.tsx +13 -0
- package/src/icons/BeakRight.tsx +11 -0
- package/src/icons/BeakTop.tsx +13 -0
- package/src/icons/BeakUp.tsx +23 -0
- package/src/icons/BellCircleIcon.tsx +33 -0
- package/src/icons/BellIcon.tsx +27 -0
- package/src/icons/BoldIcon.tsx +33 -0
- package/src/icons/CalendarIcon.tsx +35 -0
- package/src/icons/ChartsIcon.tsx +25 -0
- package/src/icons/CheckCircleIcon.tsx +29 -0
- package/src/icons/ChevronDownIcon.tsx +30 -0
- package/src/icons/ChevronDownSmIcon.tsx +34 -0
- package/src/icons/ChevronLeftIcon.tsx +20 -0
- package/src/icons/ChevronRightIcon.tsx +36 -0
- package/src/icons/ClearIcon.tsx +34 -0
- package/src/icons/ClockIcon.tsx +34 -0
- package/src/icons/CloseIcon.tsx +29 -0
- package/src/icons/CloudUploadIcon.tsx +21 -0
- package/src/icons/CodeSnippetChevronDownIcon.tsx +25 -0
- package/src/icons/CodeSnippetCopyIcon.tsx +24 -0
- package/src/icons/CodeSnippetStarIcon.tsx +25 -0
- package/src/icons/ColorSquareIcon.tsx +42 -0
- package/src/icons/ComponentsIcon.tsx +25 -0
- package/src/icons/DGALogoSVG.tsx +133 -0
- package/src/icons/DeleteIcon.tsx +24 -0
- package/src/icons/DownloadIcon.tsx +29 -0
- package/src/icons/DragHandleVerticalIcon.tsx +23 -0
- package/src/icons/FeedbackEmojiDislikeIcon.tsx +20 -0
- package/src/icons/FeedbackEmojiLikeIcon.tsx +20 -0
- package/src/icons/FeedbackEmojiNeutralIcon.tsx +20 -0
- package/src/icons/FeedbackThumbDislikeFilledIcon.tsx +26 -0
- package/src/icons/FeedbackThumbDislikeIcon.tsx +20 -0
- package/src/icons/FeedbackThumbLikeFilledIcon.tsx +20 -0
- package/src/icons/FeedbackThumbLikeIcon.tsx +20 -0
- package/src/icons/FileUploadItemCloseIcon.tsx +30 -0
- package/src/icons/FileUploadItemEmptyFileIcon.tsx +27 -0
- package/src/icons/FileUploadItemPdfIcon.tsx +52 -0
- package/src/icons/FilterFunnelIcon.tsx +34 -0
- package/src/icons/FilterIcon.tsx +31 -0
- package/src/icons/FitIcon.tsx +22 -0
- package/src/icons/FolderFilledIcon.tsx +25 -0
- package/src/icons/FolderIcon.tsx +28 -0
- package/src/icons/FoundationsIcon.tsx +25 -0
- package/src/icons/FullscreenExitIcon.tsx +71 -0
- package/src/icons/FullscreenIcon.tsx +70 -0
- package/src/icons/GoBackward10Icon.tsx +27 -0
- package/src/icons/GoForward10Icon.tsx +27 -0
- package/src/icons/GridSquaresIcon.tsx +40 -0
- package/src/icons/HamburgerIcon.tsx +28 -0
- package/src/icons/HelpCircleIcon.tsx +28 -0
- package/src/icons/HomeIcon.tsx +22 -0
- package/src/icons/HomeSVG.tsx +32 -0
- package/src/icons/IconFactory.ts +157 -0
- package/src/icons/Image01SVG.tsx +18 -0
- package/src/icons/ImageIcon.tsx +31 -0
- package/src/icons/InfoCircleIcon.tsx +31 -0
- package/src/icons/InfoCircleSVG.tsx +20 -0
- package/src/icons/InfoIcon.tsx +27 -0
- package/src/icons/ItalicIcon.tsx +31 -0
- package/src/icons/LearnMoreArrowIcon.tsx +22 -0
- package/src/icons/LinkCircleSVG.tsx +58 -0
- package/src/icons/LinkIcon.tsx +33 -0
- package/src/icons/ListLinesIcon.tsx +40 -0
- package/src/icons/LockCircleSVG.tsx +60 -0
- package/src/icons/LockIcon.tsx +36 -0
- package/src/icons/Logout02Icon.tsx +19 -0
- package/src/icons/MicrophoneIcon.tsx +20 -0
- package/src/icons/MinusIcon.tsx +40 -0
- package/src/icons/MoreHorizontalIcon.tsx +24 -0
- package/src/icons/MoreVerticalIcon.tsx +40 -0
- package/src/icons/NextIcon.tsx +44 -0
- package/src/icons/PDFSvg.tsx +39 -0
- package/src/icons/PatternsIcon.tsx +21 -0
- package/src/icons/PauseIcon.tsx +30 -0
- package/src/icons/PencilIcon.tsx +36 -0
- package/src/icons/PlayButtonCardIcon.tsx +41 -0
- package/src/icons/PlayCenterIcon.tsx +45 -0
- package/src/icons/PlayIcon.tsx +27 -0
- package/src/icons/PlayIconSolid.tsx +33 -0
- package/src/icons/PlayIconStroke.tsx +22 -0
- package/src/icons/PlayIconTwotone.tsx +36 -0
- package/src/icons/PlayVideoIcon.tsx +31 -0
- package/src/icons/PlusCircleIcon.tsx +41 -0
- package/src/icons/PlusIcon.tsx +43 -0
- package/src/icons/PreviousIcon.tsx +44 -0
- package/src/icons/PrintIcon.tsx +25 -0
- package/src/icons/QuestionMarkGrayBgIcon.tsx +52 -0
- package/src/icons/QuestionMarkIcon.tsx +47 -0
- package/src/icons/RedoIcon.tsx +41 -0
- package/src/icons/SaudiFlagSVG.tsx +31 -0
- package/src/icons/SdaiaNavLogo.tsx +345 -0
- package/src/icons/SearchIcon.tsx +34 -0
- package/src/icons/SettingsIcon.tsx +25 -0
- package/src/icons/ShareIcon.tsx +26 -0
- package/src/icons/SidebarCollapseIcon.tsx +25 -0
- package/src/icons/SmileIcon.tsx +34 -0
- package/src/icons/SortIcon.tsx +20 -0
- package/src/icons/StarIcon.tsx +38 -0
- package/src/icons/StatusBadgeIcon.tsx +19 -0
- package/src/icons/TextTIcon.tsx +33 -0
- package/src/icons/Tick02Icon.tsx +32 -0
- package/src/icons/TickIcon.tsx +33 -0
- package/src/icons/TrashIcon.tsx +44 -0
- package/src/icons/UnderlineIcon.tsx +31 -0
- package/src/icons/UndoIcon.tsx +31 -0
- package/src/icons/UploadArrowIcon.tsx +40 -0
- package/src/icons/UserIcon.tsx +21 -0
- package/src/icons/VolumeHighIcon.tsx +27 -0
- package/src/icons/VolumeMuteIcon.tsx +53 -0
- package/src/icons/XCircleIcon.tsx +32 -0
- package/src/icons/XIcon.tsx +27 -0
- package/src/icons/XIconSVG.tsx +16 -0
- package/src/icons/XSmallIcon.tsx +29 -0
- package/src/icons/XSvg.tsx +18 -0
- package/src/icons/ZoomInIcon.tsx +25 -0
- package/src/icons/index.ts +5 -0
- package/src/index.ts +699 -0
- package/src/lib/cn.ts +42 -0
- package/src/styles/motion.css +120 -0
- package/src/styles.css +242 -0
|
@@ -0,0 +1,905 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
forwardRef,
|
|
5
|
+
useCallback,
|
|
6
|
+
useEffect,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
type ChangeEvent,
|
|
10
|
+
type DragEvent,
|
|
11
|
+
} from 'react';
|
|
12
|
+
import { cn } from '../../lib/cn';
|
|
13
|
+
import type { SignatureProps, SignatureType } from './Signature.types';
|
|
14
|
+
import {
|
|
15
|
+
CARD_ROOT,
|
|
16
|
+
TAB_SECTION,
|
|
17
|
+
TAB_DIVIDER,
|
|
18
|
+
OPTIONS_ROW,
|
|
19
|
+
OPTIONS_LABEL,
|
|
20
|
+
OPTIONS_TYPEFACE_LABEL,
|
|
21
|
+
OPTIONS_SWATCH_PILL,
|
|
22
|
+
OPTIONS_SIZE_PILL,
|
|
23
|
+
DRAW_CANVAS_WRAPPER,
|
|
24
|
+
TEXT_CANVAS_WRAPPER,
|
|
25
|
+
TEXT_BASELINE,
|
|
26
|
+
TEXT_INPUT,
|
|
27
|
+
HELPER_TEXT,
|
|
28
|
+
ACTIONS_ROW,
|
|
29
|
+
} from './Signature.variants';
|
|
30
|
+
import { Button } from '../Button';
|
|
31
|
+
import { HorizontalTabs } from '../HorizontalTabs';
|
|
32
|
+
import { FileUploadBase } from '../FileUploadBase';
|
|
33
|
+
|
|
34
|
+
/*
|
|
35
|
+
* Signature — a modal-style card for capturing a signature.
|
|
36
|
+
*
|
|
37
|
+
* Figma: "Signature" — node 6253:87861
|
|
38
|
+
*
|
|
39
|
+
* ## Three capture modes (tabs)
|
|
40
|
+
* draw → HTML5 canvas with mouse / touch drawing
|
|
41
|
+
* text → typed input field with font selector
|
|
42
|
+
* upload → file drop zone (reuses FileUploadBase)
|
|
43
|
+
*
|
|
44
|
+
* ## Responsive tab sizes
|
|
45
|
+
* mobile < 768px → HorizontalTabs size="sm"
|
|
46
|
+
* tablet 768–1279px → HorizontalTabs size="md"
|
|
47
|
+
* desktop ≥ 1280px → HorizontalTabs size="lg"
|
|
48
|
+
*
|
|
49
|
+
* ## Cancel behaviour
|
|
50
|
+
* Clicking Cancel clears the current signature content (canvas, typed text,
|
|
51
|
+
* or uploaded file) then fires `onCancel`. It does NOT change the active tab.
|
|
52
|
+
*
|
|
53
|
+
* ## Color picker
|
|
54
|
+
* A custom popover (not the native browser input) opens BELOW the swatch
|
|
55
|
+
* button. Clicking the button again closes it. Clicking outside also closes.
|
|
56
|
+
* Presets + a "Custom" <input type="color"> live inside the popover.
|
|
57
|
+
*
|
|
58
|
+
* ## RTL
|
|
59
|
+
* Set dir="rtl" on an ancestor. CSS direction inheritance reverses flex
|
|
60
|
+
* row order automatically — tabs, options bar, buttons all flip without JS.
|
|
61
|
+
*
|
|
62
|
+
* ## Dark mode
|
|
63
|
+
* Toggle html.dark — all dark: classes are in Signature.variants.ts.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
67
|
+
* Icons
|
|
68
|
+
* ─────────────────────────────────────────────────────────────── */
|
|
69
|
+
|
|
70
|
+
function ChevronDownIcon() {
|
|
71
|
+
return (
|
|
72
|
+
<svg width="100%" height="100%" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
73
|
+
<path
|
|
74
|
+
d="M4 6L8 10L12 6"
|
|
75
|
+
stroke="currentColor"
|
|
76
|
+
strokeWidth="1.5"
|
|
77
|
+
strokeLinecap="round"
|
|
78
|
+
strokeLinejoin="round"
|
|
79
|
+
/>
|
|
80
|
+
</svg>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
85
|
+
* ColorPickerPopover
|
|
86
|
+
*
|
|
87
|
+
* Opens a floating panel BELOW the swatch button.
|
|
88
|
+
* Clicking the trigger again TOGGLES it closed.
|
|
89
|
+
* Clicking outside also closes it.
|
|
90
|
+
* ─────────────────────────────────────────────────────────────── */
|
|
91
|
+
|
|
92
|
+
const PRESET_COLORS = [
|
|
93
|
+
'#000000', '#374151', '#1f2a37', '#111827',
|
|
94
|
+
'#1b8354', '#175cd3', '#b42318', '#7e22ce',
|
|
95
|
+
'#ffffff', '#f9fafb', '#d1d5db', '#9ca3af',
|
|
96
|
+
'#fef3c7', '#fce7f3', '#dbeafe', '#dcfce7',
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
interface ColorPickerPopoverProps {
|
|
100
|
+
value: string;
|
|
101
|
+
onChange: (color: string) => void;
|
|
102
|
+
/** Which edge of the trigger the popover aligns to.
|
|
103
|
+
* 'start' (default) → panel left-aligns with trigger (logical start).
|
|
104
|
+
* 'end' → panel right-aligns with trigger (logical end).
|
|
105
|
+
* Use 'end' when the trigger is near the inline-end of its container
|
|
106
|
+
* to prevent the panel from overflowing outside the card. */
|
|
107
|
+
align?: 'start' | 'end';
|
|
108
|
+
ariaLabel?: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function ColorPickerPopover({ value, onChange, align = 'start', ariaLabel }: ColorPickerPopoverProps) {
|
|
112
|
+
const [open, setOpen] = useState(false);
|
|
113
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
114
|
+
const customInputRef = useRef<HTMLInputElement>(null);
|
|
115
|
+
/** Tracks whether the browser-native color dialog is currently open so we
|
|
116
|
+
* can close it programmatically on a second click of the Custom button. */
|
|
117
|
+
const nativePickerOpenRef = useRef(false);
|
|
118
|
+
|
|
119
|
+
/* Close popover on click outside */
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (!open) return;
|
|
122
|
+
const handleOutside = (e: MouseEvent) => {
|
|
123
|
+
if (containerRef.current && !containerRef.current.contains(e.target as Node)) {
|
|
124
|
+
setOpen(false);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
document.addEventListener('mousedown', handleOutside);
|
|
128
|
+
return () => document.removeEventListener('mousedown', handleOutside);
|
|
129
|
+
}, [open]);
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<div ref={containerRef} className="relative">
|
|
133
|
+
{/* Trigger — clicking toggles the popover */}
|
|
134
|
+
<button
|
|
135
|
+
type="button"
|
|
136
|
+
onClick={() => setOpen((o) => !o)}
|
|
137
|
+
aria-label={ariaLabel ?? 'Pick color'}
|
|
138
|
+
aria-expanded={open}
|
|
139
|
+
aria-haspopup="dialog"
|
|
140
|
+
className={cn(OPTIONS_SWATCH_PILL, 'cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[rgba(27,131,84,0.7)]')}
|
|
141
|
+
>
|
|
142
|
+
<span
|
|
143
|
+
className="block shrink-0 size-icon-sm rounded-[4px] border border-[rgba(210,214,219,1)] dark:border-[rgba(75,85,99,1)]"
|
|
144
|
+
style={{ backgroundColor: value }}
|
|
145
|
+
/>
|
|
146
|
+
<span className="size-icon-sm text-[rgba(108,115,127,1)] dark:text-[rgba(156,163,175,1)]">
|
|
147
|
+
<ChevronDownIcon />
|
|
148
|
+
</span>
|
|
149
|
+
</button>
|
|
150
|
+
|
|
151
|
+
{/* Popover panel — positioned below the trigger, RTL-safe.
|
|
152
|
+
align='start' → start-0 (panel left-edge = button left-edge, flips in RTL).
|
|
153
|
+
align='end' → end-0 (panel right-edge = button right-edge, flips in RTL).
|
|
154
|
+
This prevents the panel from overflowing the card when the trigger is
|
|
155
|
+
near the inline-end of its container (e.g. the Background picker). */}
|
|
156
|
+
{open && (
|
|
157
|
+
<div
|
|
158
|
+
role="dialog"
|
|
159
|
+
aria-label={ariaLabel ?? 'Color picker'}
|
|
160
|
+
className={cn(
|
|
161
|
+
'absolute z-50',
|
|
162
|
+
'top-[calc(100%+4px)]',
|
|
163
|
+
align === 'end' ? 'end-0' : 'start-0',
|
|
164
|
+
'bg-white dark:bg-[rgba(17,25,39,1)]',
|
|
165
|
+
'border border-[rgba(210,214,219,1)] dark:border-[rgba(55,65,81,1)]',
|
|
166
|
+
'rounded-[8px]',
|
|
167
|
+
'shadow-[0px_4px_16px_rgba(0,0,0,0.12)]',
|
|
168
|
+
'p-spacing-md',
|
|
169
|
+
'w-[176px]',
|
|
170
|
+
)}
|
|
171
|
+
>
|
|
172
|
+
{/* Preset swatches — 4 × 4 grid */}
|
|
173
|
+
<div className="grid grid-cols-4 gap-spacing-xs">
|
|
174
|
+
{PRESET_COLORS.map((color) => (
|
|
175
|
+
<button
|
|
176
|
+
key={color}
|
|
177
|
+
type="button"
|
|
178
|
+
onClick={() => { onChange(color); setOpen(false); }}
|
|
179
|
+
className={cn(
|
|
180
|
+
'size-icon-md rounded-[4px] border-2 shrink-0 transition-transform hover:scale-110 focus-visible:outline-none',
|
|
181
|
+
value.toLowerCase() === color.toLowerCase()
|
|
182
|
+
? 'border-[rgba(27,131,84,1)]'
|
|
183
|
+
: 'border-[rgba(210,214,219,1)] dark:border-[rgba(75,85,99,1)]',
|
|
184
|
+
)}
|
|
185
|
+
style={{ backgroundColor: color }}
|
|
186
|
+
aria-label={color}
|
|
187
|
+
title={color}
|
|
188
|
+
/>
|
|
189
|
+
))}
|
|
190
|
+
</div>
|
|
191
|
+
|
|
192
|
+
{/* Custom free-form color.
|
|
193
|
+
The input stays visible (not hidden) so the browser can position the
|
|
194
|
+
native color dialog directly adjacent to it. Toggling is handled
|
|
195
|
+
manually: first click sets nativePickerOpenRef = true (picker opens
|
|
196
|
+
via browser default); second click calls input.blur() which closes
|
|
197
|
+
the native dialog in all major browsers, then resets the flag. The
|
|
198
|
+
onBlur handler covers the case where the picker is dismissed by any
|
|
199
|
+
other means (Escape, clicking a preset, etc.). */}
|
|
200
|
+
<div className="mt-spacing-md pt-spacing-md border-t border-[rgba(210,214,219,1)] dark:border-[rgba(55,65,81,1)] flex items-center gap-spacing-xs">
|
|
201
|
+
<span className="text-text-xs font-normal text-[rgba(108,115,127,1)] dark:text-[rgba(156,163,175,1)] whitespace-nowrap">
|
|
202
|
+
Custom
|
|
203
|
+
</span>
|
|
204
|
+
<input
|
|
205
|
+
ref={customInputRef}
|
|
206
|
+
type="color"
|
|
207
|
+
value={value}
|
|
208
|
+
onChange={(e) => onChange(e.target.value)}
|
|
209
|
+
onClick={() => {
|
|
210
|
+
if (nativePickerOpenRef.current) {
|
|
211
|
+
/* Second click — close the native dialog */
|
|
212
|
+
customInputRef.current?.blur();
|
|
213
|
+
nativePickerOpenRef.current = false;
|
|
214
|
+
} else {
|
|
215
|
+
/* First click — browser will open the native dialog */
|
|
216
|
+
nativePickerOpenRef.current = true;
|
|
217
|
+
}
|
|
218
|
+
}}
|
|
219
|
+
onBlur={() => { nativePickerOpenRef.current = false; }}
|
|
220
|
+
className="h-[20px] w-[36px] rounded-[4px] cursor-pointer border border-[rgba(210,214,219,1)] p-[1px]"
|
|
221
|
+
aria-label="Custom color"
|
|
222
|
+
/>
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
)}
|
|
226
|
+
</div>
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
231
|
+
* SizePicker
|
|
232
|
+
*
|
|
233
|
+
* A styled dropdown for brush / font size.
|
|
234
|
+
* ─────────────────────────────────────────────────────────────── */
|
|
235
|
+
|
|
236
|
+
interface SizePickerProps {
|
|
237
|
+
value: number;
|
|
238
|
+
onChange: (s: number) => void;
|
|
239
|
+
options: number[];
|
|
240
|
+
unit?: string;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function SizePicker({ value, onChange, options, unit = 'px' }: SizePickerProps) {
|
|
244
|
+
const [open, setOpen] = useState(false);
|
|
245
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
246
|
+
|
|
247
|
+
useEffect(() => {
|
|
248
|
+
if (!open) return;
|
|
249
|
+
const handleOutside = (e: MouseEvent) => {
|
|
250
|
+
if (containerRef.current && !containerRef.current.contains(e.target as Node)) {
|
|
251
|
+
setOpen(false);
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
document.addEventListener('mousedown', handleOutside);
|
|
255
|
+
return () => document.removeEventListener('mousedown', handleOutside);
|
|
256
|
+
}, [open]);
|
|
257
|
+
|
|
258
|
+
return (
|
|
259
|
+
<div ref={containerRef} className="relative">
|
|
260
|
+
<button
|
|
261
|
+
type="button"
|
|
262
|
+
onClick={() => setOpen((o) => !o)}
|
|
263
|
+
aria-expanded={open}
|
|
264
|
+
aria-haspopup="listbox"
|
|
265
|
+
aria-label="Brush size"
|
|
266
|
+
className={cn(OPTIONS_SIZE_PILL, 'cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[rgba(27,131,84,0.7)]')}
|
|
267
|
+
>
|
|
268
|
+
<span className={OPTIONS_LABEL}>{value}{unit}</span>
|
|
269
|
+
<span className="size-icon-sm text-[rgba(108,115,127,1)] dark:text-[rgba(156,163,175,1)]">
|
|
270
|
+
<ChevronDownIcon />
|
|
271
|
+
</span>
|
|
272
|
+
</button>
|
|
273
|
+
|
|
274
|
+
{open && (
|
|
275
|
+
<ul
|
|
276
|
+
role="listbox"
|
|
277
|
+
aria-label="Brush size options"
|
|
278
|
+
className={cn(
|
|
279
|
+
'absolute z-50 top-[calc(100%+4px)] start-0',
|
|
280
|
+
'bg-white dark:bg-[rgba(17,25,39,1)]',
|
|
281
|
+
'border border-[rgba(210,214,219,1)] dark:border-[rgba(55,65,81,1)]',
|
|
282
|
+
'rounded-[8px] shadow-[0px_4px_16px_rgba(0,0,0,0.12)]',
|
|
283
|
+
'py-spacing-xs min-w-[80px]',
|
|
284
|
+
'list-none',
|
|
285
|
+
)}
|
|
286
|
+
>
|
|
287
|
+
{options.map((s) => (
|
|
288
|
+
<li key={s} role="option" aria-selected={value === s}>
|
|
289
|
+
<button
|
|
290
|
+
type="button"
|
|
291
|
+
onClick={() => { onChange(s); setOpen(false); }}
|
|
292
|
+
className={cn(
|
|
293
|
+
'w-full text-start px-spacing-md py-spacing-xs text-text-xs font-normal',
|
|
294
|
+
'hover:bg-[rgba(243,244,246,1)] dark:hover:bg-[rgba(55,65,81,1)]',
|
|
295
|
+
value === s
|
|
296
|
+
? 'text-[rgba(27,131,84,1)] font-medium'
|
|
297
|
+
: 'text-[rgba(22,22,22,1)] dark:text-[rgba(229,231,235,1)]',
|
|
298
|
+
)}
|
|
299
|
+
>
|
|
300
|
+
{s}{unit}
|
|
301
|
+
</button>
|
|
302
|
+
</li>
|
|
303
|
+
))}
|
|
304
|
+
</ul>
|
|
305
|
+
)}
|
|
306
|
+
</div>
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
311
|
+
* TypefacePicker
|
|
312
|
+
* ─────────────────────────────────────────────────────────────── */
|
|
313
|
+
|
|
314
|
+
const TYPEFACES = [
|
|
315
|
+
'IBM Plex Sans Arabic',
|
|
316
|
+
'Georgia',
|
|
317
|
+
'Times New Roman',
|
|
318
|
+
'Courier New',
|
|
319
|
+
];
|
|
320
|
+
|
|
321
|
+
interface TypefacePickerProps {
|
|
322
|
+
value: string;
|
|
323
|
+
onChange: (t: string) => void;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function TypefacePicker({ value, onChange }: TypefacePickerProps) {
|
|
327
|
+
const [open, setOpen] = useState(false);
|
|
328
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
329
|
+
|
|
330
|
+
useEffect(() => {
|
|
331
|
+
if (!open) return;
|
|
332
|
+
const handleOutside = (e: MouseEvent) => {
|
|
333
|
+
if (containerRef.current && !containerRef.current.contains(e.target as Node)) {
|
|
334
|
+
setOpen(false);
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
document.addEventListener('mousedown', handleOutside);
|
|
338
|
+
return () => document.removeEventListener('mousedown', handleOutside);
|
|
339
|
+
}, [open]);
|
|
340
|
+
|
|
341
|
+
const shortName = value.split(' ')[0]; // truncate for display
|
|
342
|
+
|
|
343
|
+
return (
|
|
344
|
+
<div ref={containerRef} className="relative flex-1 min-w-0">
|
|
345
|
+
<button
|
|
346
|
+
type="button"
|
|
347
|
+
onClick={() => setOpen((o) => !o)}
|
|
348
|
+
aria-expanded={open}
|
|
349
|
+
aria-haspopup="listbox"
|
|
350
|
+
aria-label="Select typeface"
|
|
351
|
+
className="flex items-center gap-spacing-xxs cursor-pointer focus-visible:outline-none"
|
|
352
|
+
>
|
|
353
|
+
<span className={OPTIONS_TYPEFACE_LABEL}>{shortName}</span>
|
|
354
|
+
<span className="size-icon-sm text-[rgba(108,115,127,1)] dark:text-[rgba(156,163,175,1)] shrink-0">
|
|
355
|
+
<ChevronDownIcon />
|
|
356
|
+
</span>
|
|
357
|
+
</button>
|
|
358
|
+
|
|
359
|
+
{open && (
|
|
360
|
+
<ul
|
|
361
|
+
role="listbox"
|
|
362
|
+
aria-label="Typeface options"
|
|
363
|
+
className={cn(
|
|
364
|
+
'absolute z-50 top-[calc(100%+4px)] start-0',
|
|
365
|
+
'bg-white dark:bg-[rgba(17,25,39,1)]',
|
|
366
|
+
'border border-[rgba(210,214,219,1)] dark:border-[rgba(55,65,81,1)]',
|
|
367
|
+
'rounded-[8px] shadow-[0px_4px_16px_rgba(0,0,0,0.12)]',
|
|
368
|
+
'py-spacing-xs min-w-[180px]',
|
|
369
|
+
'list-none',
|
|
370
|
+
)}
|
|
371
|
+
>
|
|
372
|
+
{TYPEFACES.map((f) => (
|
|
373
|
+
<li key={f} role="option" aria-selected={value === f}>
|
|
374
|
+
<button
|
|
375
|
+
type="button"
|
|
376
|
+
onClick={() => { onChange(f); setOpen(false); }}
|
|
377
|
+
className={cn(
|
|
378
|
+
'w-full text-start px-spacing-md py-spacing-xs text-text-xs font-normal',
|
|
379
|
+
'hover:bg-[rgba(243,244,246,1)] dark:hover:bg-[rgba(55,65,81,1)]',
|
|
380
|
+
value === f
|
|
381
|
+
? 'text-[rgba(27,131,84,1)] font-medium'
|
|
382
|
+
: 'text-[rgba(22,22,22,1)] dark:text-[rgba(229,231,235,1)]',
|
|
383
|
+
)}
|
|
384
|
+
style={{ fontFamily: f }}
|
|
385
|
+
>
|
|
386
|
+
{f}
|
|
387
|
+
</button>
|
|
388
|
+
</li>
|
|
389
|
+
))}
|
|
390
|
+
</ul>
|
|
391
|
+
)}
|
|
392
|
+
</div>
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
397
|
+
* DrawOptions toolbar
|
|
398
|
+
* ─────────────────────────────────────────────────────────────── */
|
|
399
|
+
|
|
400
|
+
const BRUSH_SIZES = [1, 2, 3, 5, 8];
|
|
401
|
+
|
|
402
|
+
interface DrawOptionsProps {
|
|
403
|
+
inkColor: string;
|
|
404
|
+
onInkColorChange: (c: string) => void;
|
|
405
|
+
brushSize: number;
|
|
406
|
+
onBrushSizeChange: (s: number) => void;
|
|
407
|
+
bgColor: string;
|
|
408
|
+
onBgColorChange: (c: string) => void;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
function DrawOptions({
|
|
412
|
+
inkColor, onInkColorChange,
|
|
413
|
+
brushSize, onBrushSizeChange,
|
|
414
|
+
bgColor, onBgColorChange,
|
|
415
|
+
}: DrawOptionsProps) {
|
|
416
|
+
return (
|
|
417
|
+
<div className={cn(OPTIONS_ROW, 'justify-end')}>
|
|
418
|
+
{/* Color */}
|
|
419
|
+
<div className="flex items-center gap-spacing-xxs">
|
|
420
|
+
<span className={OPTIONS_LABEL}>Color</span>
|
|
421
|
+
<ColorPickerPopover value={inkColor} onChange={onInkColorChange} ariaLabel="Ink color picker" />
|
|
422
|
+
</div>
|
|
423
|
+
|
|
424
|
+
{/* Size */}
|
|
425
|
+
<div className="flex items-center gap-spacing-xxs">
|
|
426
|
+
<span className={OPTIONS_LABEL}>Size</span>
|
|
427
|
+
<SizePicker value={brushSize} onChange={onBrushSizeChange} options={BRUSH_SIZES} unit="px" />
|
|
428
|
+
</div>
|
|
429
|
+
|
|
430
|
+
{/* Background — align="end" keeps the panel within the card boundary */}
|
|
431
|
+
<div className="flex items-center gap-spacing-xxs">
|
|
432
|
+
<span className={OPTIONS_LABEL}>Background</span>
|
|
433
|
+
<ColorPickerPopover value={bgColor} onChange={onBgColorChange} align="end" ariaLabel="Background color picker" />
|
|
434
|
+
</div>
|
|
435
|
+
</div>
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
440
|
+
* TextOptions toolbar
|
|
441
|
+
* ─────────────────────────────────────────────────────────────── */
|
|
442
|
+
|
|
443
|
+
const FONT_SIZES = [14, 18, 24, 32, 40];
|
|
444
|
+
|
|
445
|
+
interface TextOptionsProps {
|
|
446
|
+
typeface: string;
|
|
447
|
+
onTypefaceChange: (t: string) => void;
|
|
448
|
+
inkColor: string;
|
|
449
|
+
onInkColorChange: (c: string) => void;
|
|
450
|
+
fontSize: number;
|
|
451
|
+
onFontSizeChange: (s: number) => void;
|
|
452
|
+
bgColor: string;
|
|
453
|
+
onBgColorChange: (c: string) => void;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
function TextOptions({
|
|
457
|
+
typeface, onTypefaceChange,
|
|
458
|
+
inkColor, onInkColorChange,
|
|
459
|
+
fontSize, onFontSizeChange,
|
|
460
|
+
bgColor, onBgColorChange,
|
|
461
|
+
}: TextOptionsProps) {
|
|
462
|
+
return (
|
|
463
|
+
<div className={OPTIONS_ROW}>
|
|
464
|
+
{/* Select typeface — fills remaining space on inline-start side */}
|
|
465
|
+
<TypefacePicker value={typeface} onChange={onTypefaceChange} />
|
|
466
|
+
|
|
467
|
+
{/* Color */}
|
|
468
|
+
<div className="flex items-center gap-spacing-xxs">
|
|
469
|
+
<span className={OPTIONS_LABEL}>Color</span>
|
|
470
|
+
<ColorPickerPopover value={inkColor} onChange={onInkColorChange} ariaLabel="Ink color picker" />
|
|
471
|
+
</div>
|
|
472
|
+
|
|
473
|
+
{/* Size */}
|
|
474
|
+
<div className="flex items-center gap-spacing-xxs">
|
|
475
|
+
<span className={OPTIONS_LABEL}>Size</span>
|
|
476
|
+
<SizePicker value={fontSize} onChange={onFontSizeChange} options={FONT_SIZES} unit="px" />
|
|
477
|
+
</div>
|
|
478
|
+
|
|
479
|
+
{/* Background — align="end" keeps the panel within the card boundary */}
|
|
480
|
+
<div className="flex items-center gap-spacing-xxs">
|
|
481
|
+
<span className={OPTIONS_LABEL}>Background</span>
|
|
482
|
+
<ColorPickerPopover value={bgColor} onChange={onBgColorChange} align="end" ariaLabel="Background color picker" />
|
|
483
|
+
</div>
|
|
484
|
+
</div>
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
489
|
+
* Tab items (stable reference — never recreated)
|
|
490
|
+
* ─────────────────────────────────────────────────────────────── */
|
|
491
|
+
|
|
492
|
+
const TAB_ITEMS = [
|
|
493
|
+
{ value: 'draw', label: 'Draw' },
|
|
494
|
+
{ value: 'text', label: 'Type' },
|
|
495
|
+
{ value: 'upload', label: 'Upload' },
|
|
496
|
+
];
|
|
497
|
+
|
|
498
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
499
|
+
* Signature — main component
|
|
500
|
+
* ─────────────────────────────────────────────────────────────── */
|
|
501
|
+
|
|
502
|
+
export const Signature = forwardRef<HTMLDivElement, SignatureProps>(
|
|
503
|
+
function Signature(
|
|
504
|
+
{
|
|
505
|
+
type: controlledType,
|
|
506
|
+
defaultType = 'draw',
|
|
507
|
+
onTypeChange,
|
|
508
|
+
helperText = 'By signing this document, I certify that I have reviewed and accepted the agreement.',
|
|
509
|
+
showHelperText = true,
|
|
510
|
+
showOptions = true,
|
|
511
|
+
showTabs = true,
|
|
512
|
+
cancelLabel = 'Cancel',
|
|
513
|
+
acceptLabel = 'Accept and Sign',
|
|
514
|
+
onCancel,
|
|
515
|
+
onAccept,
|
|
516
|
+
className,
|
|
517
|
+
...rest
|
|
518
|
+
},
|
|
519
|
+
ref,
|
|
520
|
+
) {
|
|
521
|
+
/* ── Active tab (controlled / uncontrolled) ──────────────── */
|
|
522
|
+
const isControlled = controlledType !== undefined;
|
|
523
|
+
const [internalType, setInternalType] = useState<SignatureType>(defaultType);
|
|
524
|
+
const activeType = isControlled ? controlledType! : internalType;
|
|
525
|
+
|
|
526
|
+
const handleTypeChange = useCallback(
|
|
527
|
+
(next: string) => {
|
|
528
|
+
const t = next as SignatureType;
|
|
529
|
+
if (!isControlled) setInternalType(t);
|
|
530
|
+
onTypeChange?.(t);
|
|
531
|
+
},
|
|
532
|
+
[isControlled, onTypeChange],
|
|
533
|
+
);
|
|
534
|
+
|
|
535
|
+
/* ── Draw options ────────────────────────────────────────── */
|
|
536
|
+
const [inkColor, setInkColor] = useState('#000000');
|
|
537
|
+
const [brushSize, setBrushSize] = useState(2);
|
|
538
|
+
const [drawBgColor, setDrawBgColor] = useState('#f3f4f6');
|
|
539
|
+
|
|
540
|
+
/* ── Text options ────────────────────────────────────────── */
|
|
541
|
+
const [typeface, setTypeface] = useState('IBM Plex Sans Arabic');
|
|
542
|
+
const [fontSize, setFontSize] = useState(24);
|
|
543
|
+
const [textInkColor, setTextInkColor] = useState('#000000');
|
|
544
|
+
const [textBgColor, setTextBgColor] = useState('#f3f4f6');
|
|
545
|
+
const [typedSignature, setTypedSignature] = useState('');
|
|
546
|
+
|
|
547
|
+
/* ── Draw canvas ─────────────────────────────────────────── */
|
|
548
|
+
const canvasRef = useRef<HTMLCanvasElement>(null);
|
|
549
|
+
const isDrawingRef = useRef(false);
|
|
550
|
+
|
|
551
|
+
/* Keep the canvas pixel buffer in sync with its CSS size.
|
|
552
|
+
*
|
|
553
|
+
* Why ResizeObserver instead of a one-shot useEffect:
|
|
554
|
+
* A <canvas> has TWO separate size concepts:
|
|
555
|
+
* 1. CSS size — controlled by Tailwind's `w-full h-full`; purely visual.
|
|
556
|
+
* 2. Pixel buffer — controlled by the `width` / `height` DOM attributes;
|
|
557
|
+
* this is the actual coordinate system used when drawing.
|
|
558
|
+
*
|
|
559
|
+
* If the buffer is smaller than the CSS box (e.g. the default 300×150 px,
|
|
560
|
+
* or whatever offsetWidth returned before the flex layout settled), all
|
|
561
|
+
* drawing commands beyond that size are silently clipped — the canvas
|
|
562
|
+
* LOOKS full-size but you can only draw in a fraction of it.
|
|
563
|
+
*
|
|
564
|
+
* ResizeObserver fires AFTER layout is complete, so the measurements are
|
|
565
|
+
* always correct, even on the first paint and after any window resize.
|
|
566
|
+
*
|
|
567
|
+
* Note: setting canvas.width / canvas.height always clears the buffer —
|
|
568
|
+
* that is unavoidable HTML5 canvas behaviour. We only do it when the
|
|
569
|
+
* measured size actually changed so normal interaction never triggers it. */
|
|
570
|
+
useEffect(() => {
|
|
571
|
+
if (activeType !== 'draw') return;
|
|
572
|
+
const canvas = canvasRef.current;
|
|
573
|
+
if (!canvas) return;
|
|
574
|
+
|
|
575
|
+
const syncSize = () => {
|
|
576
|
+
const w = Math.round(canvas.offsetWidth);
|
|
577
|
+
const h = Math.round(canvas.offsetHeight);
|
|
578
|
+
/* Skip if nothing changed or container not yet laid out */
|
|
579
|
+
if (w === 0 || h === 0) return;
|
|
580
|
+
if (canvas.width === w && canvas.height === h) return;
|
|
581
|
+
canvas.width = w;
|
|
582
|
+
canvas.height = h;
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
syncSize(); // best-effort immediate sync (may already be correct)
|
|
586
|
+
|
|
587
|
+
const ro = new ResizeObserver(syncSize);
|
|
588
|
+
ro.observe(canvas);
|
|
589
|
+
return () => ro.disconnect();
|
|
590
|
+
}, [activeType]);
|
|
591
|
+
|
|
592
|
+
/* Non-passive touch listeners for the draw canvas.
|
|
593
|
+
* React 17+ registers onTouchStart/onTouchMove as passive, so calling
|
|
594
|
+
* preventDefault() inside them triggers a browser warning. We attach
|
|
595
|
+
* them directly as non-passive native listeners instead. */
|
|
596
|
+
useEffect(() => {
|
|
597
|
+
if (activeType !== 'draw') return;
|
|
598
|
+
const canvas = canvasRef.current;
|
|
599
|
+
if (!canvas) return;
|
|
600
|
+
|
|
601
|
+
const onTouchStart = (e: TouchEvent) => {
|
|
602
|
+
e.preventDefault();
|
|
603
|
+
const t = e.touches[0];
|
|
604
|
+
if (!t) return;
|
|
605
|
+
const r = canvas.getBoundingClientRect();
|
|
606
|
+
const ctx = canvas.getContext('2d');
|
|
607
|
+
if (!ctx) return;
|
|
608
|
+
isDrawingRef.current = true;
|
|
609
|
+
ctx.beginPath();
|
|
610
|
+
ctx.moveTo(t.clientX - r.left, t.clientY - r.top);
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
const onTouchMove = (e: TouchEvent) => {
|
|
614
|
+
e.preventDefault();
|
|
615
|
+
if (!isDrawingRef.current) return;
|
|
616
|
+
const t = e.touches[0];
|
|
617
|
+
if (!t) return;
|
|
618
|
+
const r = canvas.getBoundingClientRect();
|
|
619
|
+
const ctx = canvas.getContext('2d');
|
|
620
|
+
if (!ctx) return;
|
|
621
|
+
ctx.lineTo(t.clientX - r.left, t.clientY - r.top);
|
|
622
|
+
ctx.strokeStyle = inkColor;
|
|
623
|
+
ctx.lineWidth = brushSize;
|
|
624
|
+
ctx.lineCap = 'round';
|
|
625
|
+
ctx.lineJoin = 'round';
|
|
626
|
+
ctx.stroke();
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
const onTouchEnd = () => { isDrawingRef.current = false; };
|
|
630
|
+
|
|
631
|
+
canvas.addEventListener('touchstart', onTouchStart, { passive: false });
|
|
632
|
+
canvas.addEventListener('touchmove', onTouchMove, { passive: false });
|
|
633
|
+
canvas.addEventListener('touchend', onTouchEnd);
|
|
634
|
+
|
|
635
|
+
return () => {
|
|
636
|
+
canvas.removeEventListener('touchstart', onTouchStart);
|
|
637
|
+
canvas.removeEventListener('touchmove', onTouchMove);
|
|
638
|
+
canvas.removeEventListener('touchend', onTouchEnd);
|
|
639
|
+
};
|
|
640
|
+
}, [activeType, inkColor, brushSize]);
|
|
641
|
+
|
|
642
|
+
/* Canvas helpers */
|
|
643
|
+
const getPos = (e: React.MouseEvent<HTMLCanvasElement>) => {
|
|
644
|
+
const r = e.currentTarget.getBoundingClientRect();
|
|
645
|
+
return { x: e.clientX - r.left, y: e.clientY - r.top };
|
|
646
|
+
};
|
|
647
|
+
const startStroke = (x: number, y: number) => {
|
|
648
|
+
const ctx = canvasRef.current?.getContext('2d');
|
|
649
|
+
if (!ctx) return;
|
|
650
|
+
isDrawingRef.current = true;
|
|
651
|
+
ctx.beginPath();
|
|
652
|
+
ctx.moveTo(x, y);
|
|
653
|
+
};
|
|
654
|
+
const continueStroke = (x: number, y: number) => {
|
|
655
|
+
if (!isDrawingRef.current) return;
|
|
656
|
+
const ctx = canvasRef.current?.getContext('2d');
|
|
657
|
+
if (!ctx) return;
|
|
658
|
+
ctx.lineTo(x, y);
|
|
659
|
+
ctx.strokeStyle = inkColor;
|
|
660
|
+
ctx.lineWidth = brushSize;
|
|
661
|
+
ctx.lineCap = 'round';
|
|
662
|
+
ctx.lineJoin = 'round';
|
|
663
|
+
ctx.stroke();
|
|
664
|
+
};
|
|
665
|
+
const endStroke = () => { isDrawingRef.current = false; };
|
|
666
|
+
|
|
667
|
+
/* ── File upload ─────────────────────────────────────────── */
|
|
668
|
+
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
669
|
+
const dragDepth = useRef(0);
|
|
670
|
+
const [uploadedFile, setUploadedFile] = useState<File | undefined>();
|
|
671
|
+
const [dragActive, setDragActive] = useState(false);
|
|
672
|
+
|
|
673
|
+
const handleBrowse = useCallback(() => fileInputRef.current?.click(), []);
|
|
674
|
+
|
|
675
|
+
const handleFileChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {
|
|
676
|
+
const file = e.target.files?.[0];
|
|
677
|
+
if (file) setUploadedFile(file);
|
|
678
|
+
}, []);
|
|
679
|
+
|
|
680
|
+
const handleDragEnter = useCallback((e: DragEvent<HTMLDivElement>) => {
|
|
681
|
+
e.preventDefault();
|
|
682
|
+
e.stopPropagation();
|
|
683
|
+
dragDepth.current += 1;
|
|
684
|
+
if (e.dataTransfer.types.includes('Files')) setDragActive(true);
|
|
685
|
+
}, []);
|
|
686
|
+
|
|
687
|
+
const handleDragLeave = useCallback((e: DragEvent<HTMLDivElement>) => {
|
|
688
|
+
e.preventDefault();
|
|
689
|
+
e.stopPropagation();
|
|
690
|
+
dragDepth.current -= 1;
|
|
691
|
+
if (dragDepth.current <= 0) { dragDepth.current = 0; setDragActive(false); }
|
|
692
|
+
}, []);
|
|
693
|
+
|
|
694
|
+
const handleDragOver = useCallback((e: DragEvent<HTMLDivElement>) => {
|
|
695
|
+
e.preventDefault();
|
|
696
|
+
e.stopPropagation();
|
|
697
|
+
}, []);
|
|
698
|
+
|
|
699
|
+
const handleDrop = useCallback((e: DragEvent<HTMLDivElement>) => {
|
|
700
|
+
e.preventDefault();
|
|
701
|
+
e.stopPropagation();
|
|
702
|
+
dragDepth.current = 0;
|
|
703
|
+
setDragActive(false);
|
|
704
|
+
const file = e.dataTransfer.files?.[0];
|
|
705
|
+
if (file) setUploadedFile(file);
|
|
706
|
+
}, []);
|
|
707
|
+
|
|
708
|
+
/* ── Reset (Cancel behaviour) ────────────────────────────── */
|
|
709
|
+
const resetSignature = useCallback(() => {
|
|
710
|
+
if (activeType === 'draw') {
|
|
711
|
+
const canvas = canvasRef.current;
|
|
712
|
+
if (!canvas) return;
|
|
713
|
+
const ctx = canvas.getContext('2d');
|
|
714
|
+
if (ctx) ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
715
|
+
} else if (activeType === 'text') {
|
|
716
|
+
setTypedSignature('');
|
|
717
|
+
} else {
|
|
718
|
+
setUploadedFile(undefined);
|
|
719
|
+
if (fileInputRef.current) fileInputRef.current.value = '';
|
|
720
|
+
}
|
|
721
|
+
}, [activeType]);
|
|
722
|
+
|
|
723
|
+
const handleCancel = useCallback(() => {
|
|
724
|
+
resetSignature();
|
|
725
|
+
onCancel?.();
|
|
726
|
+
}, [resetSignature, onCancel]);
|
|
727
|
+
|
|
728
|
+
/* ── Accept ──────────────────────────────────────────────── */
|
|
729
|
+
const handleAccept = useCallback(() => {
|
|
730
|
+
let data: string | File | undefined;
|
|
731
|
+
if (activeType === 'draw') data = canvasRef.current?.toDataURL('image/png');
|
|
732
|
+
else if (activeType === 'text') data = typedSignature || undefined;
|
|
733
|
+
else data = uploadedFile;
|
|
734
|
+
onAccept?.(data);
|
|
735
|
+
}, [activeType, typedSignature, uploadedFile, onAccept]);
|
|
736
|
+
|
|
737
|
+
/* ── Shared tab bar ──────────────────────────────────────── */
|
|
738
|
+
function renderTabBar(size: 'sm' | 'md' | 'lg') {
|
|
739
|
+
return (
|
|
740
|
+
<HorizontalTabs
|
|
741
|
+
items={TAB_ITEMS}
|
|
742
|
+
type="underline"
|
|
743
|
+
size={size}
|
|
744
|
+
value={activeType}
|
|
745
|
+
onValueChange={handleTypeChange}
|
|
746
|
+
/>
|
|
747
|
+
);
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/* ── Render ──────────────────────────────────────────────── */
|
|
751
|
+
return (
|
|
752
|
+
<div
|
|
753
|
+
ref={ref}
|
|
754
|
+
data-slot="signature"
|
|
755
|
+
className={cn(CARD_ROOT, className)}
|
|
756
|
+
{...rest}
|
|
757
|
+
>
|
|
758
|
+
{/* Tabs row */}
|
|
759
|
+
{showTabs && (
|
|
760
|
+
<div className={TAB_SECTION}>
|
|
761
|
+
<div className="block md:hidden">{renderTabBar('sm')}</div>
|
|
762
|
+
<div className="hidden md:block xl:hidden">{renderTabBar('md')}</div>
|
|
763
|
+
<div className="hidden xl:block">{renderTabBar('lg')}</div>
|
|
764
|
+
{/* Full-width grey underline beneath all tabs */}
|
|
765
|
+
<div className={TAB_DIVIDER} aria-hidden="true" />
|
|
766
|
+
</div>
|
|
767
|
+
)}
|
|
768
|
+
|
|
769
|
+
{/* ── Draw mode ──────────────────────────────────────── */}
|
|
770
|
+
{activeType === 'draw' && (
|
|
771
|
+
<>
|
|
772
|
+
{showOptions && (
|
|
773
|
+
<DrawOptions
|
|
774
|
+
inkColor={inkColor} onInkColorChange={setInkColor}
|
|
775
|
+
brushSize={brushSize} onBrushSizeChange={setBrushSize}
|
|
776
|
+
bgColor={drawBgColor} onBgColorChange={setDrawBgColor}
|
|
777
|
+
/>
|
|
778
|
+
)}
|
|
779
|
+
<div
|
|
780
|
+
className={DRAW_CANVAS_WRAPPER}
|
|
781
|
+
style={{ backgroundColor: drawBgColor }}
|
|
782
|
+
data-slot="draw-canvas-wrapper"
|
|
783
|
+
>
|
|
784
|
+
<canvas
|
|
785
|
+
ref={canvasRef}
|
|
786
|
+
className="block w-full h-full cursor-crosshair touch-none"
|
|
787
|
+
aria-label="Signature drawing area"
|
|
788
|
+
onMouseDown={(e) => { const p = getPos(e); startStroke(p.x, p.y); }}
|
|
789
|
+
onMouseMove={(e) => { const p = getPos(e); continueStroke(p.x, p.y); }}
|
|
790
|
+
onMouseUp={endStroke}
|
|
791
|
+
onMouseLeave={endStroke}
|
|
792
|
+
/>
|
|
793
|
+
</div>
|
|
794
|
+
</>
|
|
795
|
+
)}
|
|
796
|
+
|
|
797
|
+
{/* ── Text mode ──────────────────────────────────────── */}
|
|
798
|
+
{activeType === 'text' && (
|
|
799
|
+
<>
|
|
800
|
+
{showOptions && (
|
|
801
|
+
<TextOptions
|
|
802
|
+
typeface={typeface} onTypefaceChange={setTypeface}
|
|
803
|
+
inkColor={textInkColor} onInkColorChange={setTextInkColor}
|
|
804
|
+
fontSize={fontSize} onFontSizeChange={setFontSize}
|
|
805
|
+
bgColor={textBgColor} onBgColorChange={setTextBgColor}
|
|
806
|
+
/>
|
|
807
|
+
)}
|
|
808
|
+
<div
|
|
809
|
+
className={TEXT_CANVAS_WRAPPER}
|
|
810
|
+
style={{ backgroundColor: textBgColor }}
|
|
811
|
+
data-slot="text-canvas-wrapper"
|
|
812
|
+
>
|
|
813
|
+
<input
|
|
814
|
+
type="text"
|
|
815
|
+
value={typedSignature}
|
|
816
|
+
onChange={(e) => setTypedSignature(e.target.value)}
|
|
817
|
+
placeholder="Type your signature"
|
|
818
|
+
className={TEXT_INPUT}
|
|
819
|
+
style={{ fontFamily: typeface, fontSize: `${fontSize}px`, color: textInkColor }}
|
|
820
|
+
aria-label="Type your signature"
|
|
821
|
+
/>
|
|
822
|
+
<div className={TEXT_BASELINE} data-slot="signature-baseline" />
|
|
823
|
+
</div>
|
|
824
|
+
</>
|
|
825
|
+
)}
|
|
826
|
+
|
|
827
|
+
{/* ── Upload mode ────────────────────────────────────── */}
|
|
828
|
+
{activeType === 'upload' && (
|
|
829
|
+
<>
|
|
830
|
+
{/* The flex-1 wrapper grows to fill all remaining vertical space in
|
|
831
|
+
the Signature card (same pattern as DRAW_CANVAS_WRAPPER). The
|
|
832
|
+
drag handlers live on the wrapper so the entire area is a drop
|
|
833
|
+
target. FileUploadBase is h-full so it fills the wrapper;
|
|
834
|
+
its built-in justify-center keeps the content vertically centred.
|
|
835
|
+
Neither FileUploadBase nor FileUploader renders <input type="file">
|
|
836
|
+
internally — the hidden input below handles file selection. */}
|
|
837
|
+
<div
|
|
838
|
+
className="flex-1 min-h-[180px] w-full"
|
|
839
|
+
data-slot="upload-zone"
|
|
840
|
+
onDragEnter={handleDragEnter}
|
|
841
|
+
onDragLeave={handleDragLeave}
|
|
842
|
+
onDragOver={handleDragOver}
|
|
843
|
+
onDrop={handleDrop}
|
|
844
|
+
>
|
|
845
|
+
<FileUploadBase
|
|
846
|
+
className="h-full w-full"
|
|
847
|
+
active={dragActive}
|
|
848
|
+
label={uploadedFile
|
|
849
|
+
? uploadedFile.name
|
|
850
|
+
: 'Choose a file or drag & drop it here.'}
|
|
851
|
+
helperText="JPEG, PNG, PDF, and GIF formats, up to 2MB"
|
|
852
|
+
showHelperText={!uploadedFile}
|
|
853
|
+
browseLabel="Browse file"
|
|
854
|
+
onBrowse={handleBrowse}
|
|
855
|
+
/>
|
|
856
|
+
</div>
|
|
857
|
+
<input
|
|
858
|
+
ref={fileInputRef}
|
|
859
|
+
type="file"
|
|
860
|
+
className="sr-only"
|
|
861
|
+
accept=".jpg,.jpeg,.png,.pdf,.gif"
|
|
862
|
+
onChange={handleFileChange}
|
|
863
|
+
tabIndex={-1}
|
|
864
|
+
aria-hidden="true"
|
|
865
|
+
/>
|
|
866
|
+
</>
|
|
867
|
+
)}
|
|
868
|
+
|
|
869
|
+
{/* Helper text */}
|
|
870
|
+
{showHelperText && helperText && (
|
|
871
|
+
<p className={HELPER_TEXT} data-slot="helper-text">
|
|
872
|
+
{helperText}
|
|
873
|
+
</p>
|
|
874
|
+
)}
|
|
875
|
+
|
|
876
|
+
{/* Actions row
|
|
877
|
+
* DOM order: neutral first, primary second.
|
|
878
|
+
* LTR: neutral=LEFT, primary=RIGHT.
|
|
879
|
+
* RTL (direction:rtl from ancestor): visual order reverses →
|
|
880
|
+
* neutral=RIGHT, primary=LEFT — matches Figma RTL frames. */}
|
|
881
|
+
<div className={ACTIONS_ROW} data-slot="actions">
|
|
882
|
+
<Button
|
|
883
|
+
variant="secondary-solid"
|
|
884
|
+
size="md"
|
|
885
|
+
type="button"
|
|
886
|
+
onClick={handleCancel}
|
|
887
|
+
data-slot="cancel-button"
|
|
888
|
+
>
|
|
889
|
+
{cancelLabel}
|
|
890
|
+
</Button>
|
|
891
|
+
|
|
892
|
+
<Button
|
|
893
|
+
variant="primary"
|
|
894
|
+
size="md"
|
|
895
|
+
type="button"
|
|
896
|
+
onClick={handleAccept}
|
|
897
|
+
data-slot="accept-button"
|
|
898
|
+
>
|
|
899
|
+
{acceptLabel}
|
|
900
|
+
</Button>
|
|
901
|
+
</div>
|
|
902
|
+
</div>
|
|
903
|
+
);
|
|
904
|
+
},
|
|
905
|
+
);
|