@soadtech/cli 0.1.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/dist/index.js +272 -0
- package/package.json +24 -0
- package/registry/base/cn.ts +5 -0
- package/registry/base/css-modules.d.ts +4 -0
- package/registry/base/theme/reset.css +43 -0
- package/registry/base/theme/tokens.css +154 -0
- package/registry/components/Accordion/Accordion.module.css +3 -0
- package/registry/components/Accordion/Accordion.tsx +54 -0
- package/registry/components/Accordion/Accordion.types.ts +17 -0
- package/registry/components/Accordion/AccordionContext.ts +18 -0
- package/registry/components/Accordion/AccordionItem.module.css +124 -0
- package/registry/components/Accordion/AccordionItem.tsx +148 -0
- package/registry/components/Accordion/AccordionItem.types.ts +14 -0
- package/registry/components/Accordion/index.ts +8 -0
- package/registry/components/ActionBar/ActionBar.module.css +18 -0
- package/registry/components/ActionBar/ActionBar.tsx +21 -0
- package/registry/components/ActionBar/ActionBar.types.ts +8 -0
- package/registry/components/ActionBar/ActionBarLink.module.css +31 -0
- package/registry/components/ActionBar/ActionBarLink.tsx +55 -0
- package/registry/components/ActionBar/ActionBarLink.types.ts +7 -0
- package/registry/components/ActionBar/index.ts +4 -0
- package/registry/components/Alert/Alert.module.css +172 -0
- package/registry/components/Alert/Alert.tsx +146 -0
- package/registry/components/Alert/Alert.types.ts +25 -0
- package/registry/components/Alert/index.ts +7 -0
- package/registry/components/Avatar/Avatar.module.css +100 -0
- package/registry/components/Avatar/Avatar.tsx +54 -0
- package/registry/components/Avatar/Avatar.types.ts +18 -0
- package/registry/components/Avatar/AvatarGroup.module.css +64 -0
- package/registry/components/Avatar/AvatarGroup.tsx +65 -0
- package/registry/components/Avatar/AvatarGroup.types.ts +13 -0
- package/registry/components/Avatar/index.ts +8 -0
- package/registry/components/Badge/Badge.module.css +92 -0
- package/registry/components/Badge/Badge.tsx +89 -0
- package/registry/components/Badge/Badge.types.ts +20 -0
- package/registry/components/Badge/TrendBadge.module.css +47 -0
- package/registry/components/Badge/TrendBadge.tsx +65 -0
- package/registry/components/Badge/TrendBadge.types.ts +15 -0
- package/registry/components/Badge/index.ts +14 -0
- package/registry/components/Breadcrumbs/BreadcrumbItem.tsx +41 -0
- package/registry/components/Breadcrumbs/Breadcrumbs.module.css +81 -0
- package/registry/components/Breadcrumbs/Breadcrumbs.tsx +71 -0
- package/registry/components/Breadcrumbs/Breadcrumbs.types.ts +22 -0
- package/registry/components/Breadcrumbs/index.ts +7 -0
- package/registry/components/Button/Button.module.css +169 -0
- package/registry/components/Button/Button.tsx +43 -0
- package/registry/components/Button/Button.types.ts +18 -0
- package/registry/components/Button/index.ts +7 -0
- package/registry/components/ButtonLink/ButtonLink.module.css +85 -0
- package/registry/components/ButtonLink/ButtonLink.tsx +42 -0
- package/registry/components/ButtonLink/ButtonLink.types.ts +18 -0
- package/registry/components/ButtonLink/index.ts +6 -0
- package/registry/components/Calendar/Calendar.module.css +213 -0
- package/registry/components/Calendar/Calendar.tsx +370 -0
- package/registry/components/Calendar/Calendar.types.ts +28 -0
- package/registry/components/Calendar/CalendarDialog.module.css +29 -0
- package/registry/components/Calendar/CalendarDialog.tsx +173 -0
- package/registry/components/Calendar/CalendarDialog.types.ts +30 -0
- package/registry/components/Calendar/index.ts +9 -0
- package/registry/components/Card/Card.module.css +35 -0
- package/registry/components/Card/Card.tsx +36 -0
- package/registry/components/Card/Card.types.ts +37 -0
- package/registry/components/Card/CardContent.module.css +3 -0
- package/registry/components/Card/CardContent.tsx +16 -0
- package/registry/components/Card/CardFooter.module.css +31 -0
- package/registry/components/Card/CardFooter.tsx +34 -0
- package/registry/components/Card/CardHeader.module.css +61 -0
- package/registry/components/Card/CardHeader.tsx +46 -0
- package/registry/components/Card/InsightCard.module.css +106 -0
- package/registry/components/Card/InsightCard.tsx +68 -0
- package/registry/components/Card/InsightCard.types.ts +24 -0
- package/registry/components/Card/KPICard.module.css +31 -0
- package/registry/components/Card/KPICard.tsx +29 -0
- package/registry/components/Card/KPICard.types.ts +13 -0
- package/registry/components/Card/ListItemCard.module.css +59 -0
- package/registry/components/Card/ListItemCard.tsx +37 -0
- package/registry/components/Card/ListItemCard.types.ts +18 -0
- package/registry/components/Card/PlanCard.module.css +125 -0
- package/registry/components/Card/PlanCard.tsx +108 -0
- package/registry/components/Card/PlanCard.types.ts +30 -0
- package/registry/components/Card/ProductCard.module.css +118 -0
- package/registry/components/Card/ProductCard.tsx +56 -0
- package/registry/components/Card/ProductCard.types.ts +24 -0
- package/registry/components/Card/StatCard.module.css +20 -0
- package/registry/components/Card/StatCard.tsx +26 -0
- package/registry/components/Card/StatCard.types.ts +12 -0
- package/registry/components/Card/UserGroupCard.module.css +50 -0
- package/registry/components/Card/UserGroupCard.tsx +59 -0
- package/registry/components/Card/UserGroupCard.types.ts +23 -0
- package/registry/components/Card/index.ts +38 -0
- package/registry/components/Chart/BarChart.module.css +54 -0
- package/registry/components/Chart/BarChart.tsx +196 -0
- package/registry/components/Chart/BarChart.types.ts +20 -0
- package/registry/components/Chart/ChartAction.module.css +43 -0
- package/registry/components/Chart/ChartAction.tsx +35 -0
- package/registry/components/Chart/ChartAction.types.ts +17 -0
- package/registry/components/Chart/ChartAxis.module.css +47 -0
- package/registry/components/Chart/ChartAxis.tsx +79 -0
- package/registry/components/Chart/ChartAxis.types.ts +14 -0
- package/registry/components/Chart/ChartLegend.module.css +31 -0
- package/registry/components/Chart/ChartLegend.tsx +49 -0
- package/registry/components/Chart/ChartLegend.types.ts +18 -0
- package/registry/components/Chart/ChartTooltip.module.css +54 -0
- package/registry/components/Chart/ChartTooltip.tsx +44 -0
- package/registry/components/Chart/ChartTooltip.types.ts +19 -0
- package/registry/components/Chart/DonutChart.module.css +32 -0
- package/registry/components/Chart/DonutChart.tsx +107 -0
- package/registry/components/Chart/DonutChart.types.ts +20 -0
- package/registry/components/Chart/GridChart.module.css +26 -0
- package/registry/components/Chart/GridChart.tsx +61 -0
- package/registry/components/Chart/GridChart.types.ts +14 -0
- package/registry/components/Chart/HoverTooltip.module.css +16 -0
- package/registry/components/Chart/HoverTooltip.tsx +22 -0
- package/registry/components/Chart/KPIIndicator.module.css +48 -0
- package/registry/components/Chart/KPIIndicator.tsx +28 -0
- package/registry/components/Chart/KPIIndicator.types.ts +16 -0
- package/registry/components/Chart/LineChart.module.css +54 -0
- package/registry/components/Chart/LineChart.tsx +282 -0
- package/registry/components/Chart/LineChart.types.ts +22 -0
- package/registry/components/Chart/ProgressChart.module.css +54 -0
- package/registry/components/Chart/ProgressChart.tsx +64 -0
- package/registry/components/Chart/ProgressChart.types.ts +18 -0
- package/registry/components/Chart/TrendLineChart.module.css +5 -0
- package/registry/components/Chart/TrendLineChart.tsx +131 -0
- package/registry/components/Chart/TrendLineChart.types.ts +19 -0
- package/registry/components/Chart/chart.utils.ts +131 -0
- package/registry/components/Chart/index.ts +47 -0
- package/registry/components/Chart/useChartHover.ts +24 -0
- package/registry/components/Checkbox/Checkbox.module.css +101 -0
- package/registry/components/Checkbox/Checkbox.tsx +100 -0
- package/registry/components/Checkbox/Checkbox.types.ts +11 -0
- package/registry/components/Checkbox/CheckboxField.module.css +69 -0
- package/registry/components/Checkbox/CheckboxField.tsx +54 -0
- package/registry/components/Checkbox/CheckboxField.types.ts +9 -0
- package/registry/components/Checkbox/CheckboxGroup.module.css +41 -0
- package/registry/components/Checkbox/CheckboxGroup.tsx +60 -0
- package/registry/components/Checkbox/CheckboxGroup.types.ts +11 -0
- package/registry/components/Checkbox/CheckboxGroupContext.ts +13 -0
- package/registry/components/Checkbox/index.ts +11 -0
- package/registry/components/Chip/Chip.module.css +143 -0
- package/registry/components/Chip/Chip.tsx +93 -0
- package/registry/components/Chip/Chip.types.ts +19 -0
- package/registry/components/Chip/ChipGroup.module.css +5 -0
- package/registry/components/Chip/ChipGroup.tsx +16 -0
- package/registry/components/Chip/ChipGroup.types.ts +3 -0
- package/registry/components/Chip/index.ts +9 -0
- package/registry/components/Datepicker/Datepicker.module.css +133 -0
- package/registry/components/Datepicker/Datepicker.tsx +236 -0
- package/registry/components/Datepicker/Datepicker.types.ts +36 -0
- package/registry/components/Datepicker/index.ts +2 -0
- package/registry/components/Dialog/Dialog.module.css +18 -0
- package/registry/components/Dialog/Dialog.tsx +69 -0
- package/registry/components/Dialog/Dialog.types.ts +45 -0
- package/registry/components/Dialog/DialogBody.module.css +3 -0
- package/registry/components/Dialog/DialogBody.tsx +16 -0
- package/registry/components/Dialog/DialogContext.ts +11 -0
- package/registry/components/Dialog/DialogFooter.module.css +38 -0
- package/registry/components/Dialog/DialogFooter.tsx +30 -0
- package/registry/components/Dialog/DialogHeader.module.css +70 -0
- package/registry/components/Dialog/DialogHeader.tsx +72 -0
- package/registry/components/Dialog/DialogIcon.module.css +31 -0
- package/registry/components/Dialog/DialogIcon.tsx +89 -0
- package/registry/components/Dialog/index.ts +14 -0
- package/registry/components/Divider/Divider.module.css +19 -0
- package/registry/components/Divider/Divider.tsx +20 -0
- package/registry/components/Divider/Divider.types.ts +9 -0
- package/registry/components/Divider/index.ts +2 -0
- package/registry/components/DropdownMenu/DropdownMenu.module.css +9 -0
- package/registry/components/DropdownMenu/DropdownMenu.tsx +21 -0
- package/registry/components/DropdownMenu/DropdownMenu.types.ts +22 -0
- package/registry/components/DropdownMenu/DropdownMenuDivider.module.css +5 -0
- package/registry/components/DropdownMenu/DropdownMenuDivider.tsx +20 -0
- package/registry/components/DropdownMenu/DropdownMenuHeader.module.css +7 -0
- package/registry/components/DropdownMenu/DropdownMenuHeader.tsx +17 -0
- package/registry/components/DropdownMenu/DropdownMenuItem.module.css +78 -0
- package/registry/components/DropdownMenu/DropdownMenuItem.tsx +40 -0
- package/registry/components/DropdownMenu/index.ts +10 -0
- package/registry/components/FileUpload/FileUpload.module.css +122 -0
- package/registry/components/FileUpload/FileUpload.tsx +354 -0
- package/registry/components/FileUpload/FileUpload.types.ts +89 -0
- package/registry/components/FileUpload/FileUploadIcon.module.css +61 -0
- package/registry/components/FileUpload/FileUploadIcon.tsx +84 -0
- package/registry/components/FileUpload/FileUploadInput.module.css +140 -0
- package/registry/components/FileUpload/FileUploadInput.tsx +113 -0
- package/registry/components/FileUpload/FileUploadItem.module.css +41 -0
- package/registry/components/FileUpload/FileUploadItem.tsx +39 -0
- package/registry/components/FileUpload/index.ts +12 -0
- package/registry/components/InputCounter/InputCounter.module.css +146 -0
- package/registry/components/InputCounter/InputCounter.tsx +232 -0
- package/registry/components/InputCounter/InputCounter.types.ts +37 -0
- package/registry/components/InputCounter/index.ts +7 -0
- package/registry/components/InputMessage/InputMessage.module.css +148 -0
- package/registry/components/InputMessage/InputMessage.tsx +294 -0
- package/registry/components/InputMessage/InputMessage.types.ts +30 -0
- package/registry/components/InputMessage/index.ts +2 -0
- package/registry/components/InputSearch/InputSearch.module.css +168 -0
- package/registry/components/InputSearch/InputSearch.tsx +251 -0
- package/registry/components/InputSearch/InputSearch.types.ts +35 -0
- package/registry/components/InputSearch/index.ts +6 -0
- package/registry/components/InputText/InputText.module.css +183 -0
- package/registry/components/InputText/InputText.tsx +244 -0
- package/registry/components/InputText/InputText.types.ts +32 -0
- package/registry/components/InputText/index.ts +7 -0
- package/registry/components/InputTextArea/InputTextArea.module.css +141 -0
- package/registry/components/InputTextArea/InputTextArea.tsx +170 -0
- package/registry/components/InputTextArea/InputTextArea.types.ts +18 -0
- package/registry/components/InputTextArea/index.ts +6 -0
- package/registry/components/NavbarUser/NavbarUser.module.css +265 -0
- package/registry/components/NavbarUser/NavbarUser.tsx +202 -0
- package/registry/components/NavbarUser/NavbarUser.types.ts +31 -0
- package/registry/components/NavbarUser/index.ts +2 -0
- package/registry/components/Notification/Notification.types.ts +65 -0
- package/registry/components/Notification/NotificationItem.module.css +143 -0
- package/registry/components/Notification/NotificationItem.tsx +157 -0
- package/registry/components/Notification/NotificationPanel.module.css +75 -0
- package/registry/components/Notification/NotificationPanel.tsx +68 -0
- package/registry/components/Notification/NotificationReply.module.css +56 -0
- package/registry/components/Notification/NotificationReply.tsx +52 -0
- package/registry/components/Notification/index.ts +9 -0
- package/registry/components/Pagination/Pagination.module.css +123 -0
- package/registry/components/Pagination/Pagination.tsx +212 -0
- package/registry/components/Pagination/Pagination.types.ts +24 -0
- package/registry/components/Pagination/PaginationDots.module.css +60 -0
- package/registry/components/Pagination/PaginationDots.tsx +48 -0
- package/registry/components/Pagination/PaginationDots.types.ts +17 -0
- package/registry/components/Pagination/index.ts +12 -0
- package/registry/components/Persona/MessageDropdown.module.css +76 -0
- package/registry/components/Persona/MessageDropdown.tsx +68 -0
- package/registry/components/Persona/Persona.module.css +92 -0
- package/registry/components/Persona/Persona.tsx +90 -0
- package/registry/components/Persona/Persona.types.ts +71 -0
- package/registry/components/Persona/PersonaAction.module.css +80 -0
- package/registry/components/Persona/PersonaAction.tsx +49 -0
- package/registry/components/Persona/PersonaMessage.module.css +156 -0
- package/registry/components/Persona/PersonaMessage.tsx +70 -0
- package/registry/components/Persona/index.ts +11 -0
- package/registry/components/Progress/Progress.module.css +41 -0
- package/registry/components/Progress/Progress.tsx +43 -0
- package/registry/components/Progress/Progress.types.ts +10 -0
- package/registry/components/Progress/index.ts +2 -0
- package/registry/components/RadioButton/RadioButton.module.css +103 -0
- package/registry/components/RadioButton/RadioButton.tsx +59 -0
- package/registry/components/RadioButton/RadioButton.types.ts +19 -0
- package/registry/components/RadioButton/RadioField.module.css +68 -0
- package/registry/components/RadioButton/RadioField.tsx +68 -0
- package/registry/components/RadioButton/RadioGroup.module.css +41 -0
- package/registry/components/RadioButton/RadioGroup.tsx +76 -0
- package/registry/components/RadioButton/RadioGroupContext.ts +16 -0
- package/registry/components/RadioButton/index.ts +12 -0
- package/registry/components/RangeSlider/RangeSlider.module.css +133 -0
- package/registry/components/RangeSlider/RangeSlider.tsx +251 -0
- package/registry/components/RangeSlider/RangeSlider.types.ts +25 -0
- package/registry/components/RangeSlider/index.ts +2 -0
- package/registry/components/Rating/Rating.module.css +56 -0
- package/registry/components/Rating/Rating.tsx +142 -0
- package/registry/components/Rating/Rating.types.ts +14 -0
- package/registry/components/Rating/index.ts +7 -0
- package/registry/components/SegmentedControl/SegmentedControl.module.css +56 -0
- package/registry/components/SegmentedControl/SegmentedControl.tsx +46 -0
- package/registry/components/SegmentedControl/SegmentedControl.types.ts +27 -0
- package/registry/components/SegmentedControl/SegmentedControlContext.ts +20 -0
- package/registry/components/SegmentedControl/SegmentedControlItem.module.css +55 -0
- package/registry/components/SegmentedControl/SegmentedControlItem.tsx +32 -0
- package/registry/components/SegmentedControl/index.ts +8 -0
- package/registry/components/SelectDropdown/SelectDropdown.module.css +214 -0
- package/registry/components/SelectDropdown/SelectDropdown.tsx +375 -0
- package/registry/components/SelectDropdown/SelectDropdown.types.ts +50 -0
- package/registry/components/SelectDropdown/SelectDropdownOption.module.css +101 -0
- package/registry/components/SelectDropdown/SelectDropdownOption.tsx +86 -0
- package/registry/components/SelectDropdown/SelectDropdownOverlay.module.css +74 -0
- package/registry/components/SelectDropdown/SelectDropdownOverlay.tsx +202 -0
- package/registry/components/SelectDropdown/index.ts +11 -0
- package/registry/components/Sidebar/Sidebar.module.css +14 -0
- package/registry/components/Sidebar/Sidebar.tsx +41 -0
- package/registry/components/Sidebar/Sidebar.types.ts +41 -0
- package/registry/components/Sidebar/SidebarContent.module.css +5 -0
- package/registry/components/Sidebar/SidebarContent.tsx +14 -0
- package/registry/components/Sidebar/SidebarContext.ts +15 -0
- package/registry/components/Sidebar/SidebarDivider.module.css +5 -0
- package/registry/components/Sidebar/SidebarDivider.tsx +17 -0
- package/registry/components/Sidebar/SidebarFooter.module.css +5 -0
- package/registry/components/Sidebar/SidebarFooter.tsx +14 -0
- package/registry/components/Sidebar/SidebarGroup.module.css +12 -0
- package/registry/components/Sidebar/SidebarGroup.tsx +22 -0
- package/registry/components/Sidebar/SidebarHeader.module.css +5 -0
- package/registry/components/Sidebar/SidebarHeader.tsx +14 -0
- package/registry/components/Sidebar/SidebarNavItem.module.css +176 -0
- package/registry/components/Sidebar/SidebarNavItem.tsx +96 -0
- package/registry/components/Sidebar/index.ts +16 -0
- package/registry/components/Stepper/Stepper.module.css +11 -0
- package/registry/components/Stepper/Stepper.tsx +47 -0
- package/registry/components/Stepper/Stepper.types.ts +26 -0
- package/registry/components/Stepper/StepperContext.ts +17 -0
- package/registry/components/Stepper/StepperStep.module.css +183 -0
- package/registry/components/Stepper/StepperStep.tsx +204 -0
- package/registry/components/Stepper/index.ts +9 -0
- package/registry/components/Switch/Switch.module.css +145 -0
- package/registry/components/Switch/Switch.tsx +96 -0
- package/registry/components/Switch/Switch.types.ts +19 -0
- package/registry/components/Switch/SwitchField.module.css +69 -0
- package/registry/components/Switch/SwitchField.tsx +49 -0
- package/registry/components/Switch/index.ts +8 -0
- package/registry/components/Tab/Tab.module.css +20 -0
- package/registry/components/Tab/Tab.tsx +35 -0
- package/registry/components/Tab/Tab.types.ts +21 -0
- package/registry/components/Tab/TabAdd.module.css +36 -0
- package/registry/components/Tab/TabAdd.tsx +41 -0
- package/registry/components/Tab/TabContext.ts +19 -0
- package/registry/components/Tab/TabItem.module.css +145 -0
- package/registry/components/Tab/TabItem.tsx +87 -0
- package/registry/components/Tab/index.ts +9 -0
- package/registry/components/Table/Table.module.css +33 -0
- package/registry/components/Table/Table.tsx +74 -0
- package/registry/components/Table/Table.types.ts +64 -0
- package/registry/components/Table/TableBody.tsx +23 -0
- package/registry/components/Table/TableCell.module.css +21 -0
- package/registry/components/Table/TableCell.tsx +20 -0
- package/registry/components/Table/TableContext.ts +22 -0
- package/registry/components/Table/TableFooter.module.css +27 -0
- package/registry/components/Table/TableFooter.tsx +20 -0
- package/registry/components/Table/TableHeader.module.css +3 -0
- package/registry/components/Table/TableHeader.tsx +17 -0
- package/registry/components/Table/TableHeaderCell.module.css +55 -0
- package/registry/components/Table/TableHeaderCell.tsx +98 -0
- package/registry/components/Table/TableRow.module.css +53 -0
- package/registry/components/Table/TableRow.tsx +31 -0
- package/registry/components/Table/TableToolbar.module.css +7 -0
- package/registry/components/Table/TableToolbar.tsx +16 -0
- package/registry/components/Table/index.ts +22 -0
- package/registry/components/Tag/Tag.module.css +46 -0
- package/registry/components/Tag/Tag.tsx +38 -0
- package/registry/components/Tag/Tag.types.ts +37 -0
- package/registry/components/Tag/TagBrand.module.css +42 -0
- package/registry/components/Tag/TagBrand.tsx +38 -0
- package/registry/components/Tag/TagStatus.module.css +43 -0
- package/registry/components/Tag/TagStatus.tsx +119 -0
- package/registry/components/Tag/index.ts +15 -0
- package/registry/components/Tooltip/Tooltip.module.css +208 -0
- package/registry/components/Tooltip/Tooltip.tsx +81 -0
- package/registry/components/Tooltip/Tooltip.types.ts +27 -0
- package/registry/components/Tooltip/index.ts +7 -0
- package/registry/components/TreeviewList/TreeviewItem.module.css +89 -0
- package/registry/components/TreeviewList/TreeviewItem.tsx +142 -0
- package/registry/components/TreeviewList/TreeviewList.module.css +3 -0
- package/registry/components/TreeviewList/TreeviewList.tsx +19 -0
- package/registry/components/TreeviewList/TreeviewList.types.ts +18 -0
- package/registry/components/TreeviewList/TreeviewListContext.ts +13 -0
- package/registry/components/TreeviewList/index.ts +6 -0
- package/registry/components/VerificationCode/VerificationCode.module.css +49 -0
- package/registry/components/VerificationCode/VerificationCode.tsx +147 -0
- package/registry/components/VerificationCode/VerificationCode.types.ts +21 -0
- package/registry/components/VerificationCode/index.ts +2 -0
- package/registry/registry.json +746 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import { Card } from './Card';
|
|
4
|
+
import { CardHeader } from './CardHeader';
|
|
5
|
+
import { CardContent } from './CardContent';
|
|
6
|
+
import type { StatCardProps } from './StatCard.types';
|
|
7
|
+
import styles from './StatCard.module.css';
|
|
8
|
+
|
|
9
|
+
export const StatCard = forwardRef<HTMLDivElement, StatCardProps>(
|
|
10
|
+
({ title, value, trend, action, className, children, ...rest }, ref) => {
|
|
11
|
+
return (
|
|
12
|
+
<Card ref={ref} className={cn(styles.root, className)} {...rest}>
|
|
13
|
+
<CardHeader title={title} action={action} />
|
|
14
|
+
<CardContent>
|
|
15
|
+
<div className={styles.metric}>
|
|
16
|
+
<span className={styles.value}>{value}</span>
|
|
17
|
+
{trend}
|
|
18
|
+
</div>
|
|
19
|
+
{children && <div className={styles.chart}>{children}</div>}
|
|
20
|
+
</CardContent>
|
|
21
|
+
</Card>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
StatCard.displayName = 'StatCard';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface StatCardProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** Metric label. */
|
|
5
|
+
title: string;
|
|
6
|
+
/** Large metric value. */
|
|
7
|
+
value: string | number;
|
|
8
|
+
/** TrendBadge or custom indicator. */
|
|
9
|
+
trend?: ReactNode;
|
|
10
|
+
/** Time selector, dropdown, etc. */
|
|
11
|
+
action?: ReactNode;
|
|
12
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--st-space-4);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.header {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: flex-start;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
gap: var(--st-space-3);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.text {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
gap: var(--st-space-1);
|
|
18
|
+
min-width: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.title {
|
|
22
|
+
font-size: var(--st-font-size-sm);
|
|
23
|
+
font-weight: var(--st-font-weight-semibold);
|
|
24
|
+
color: var(--st-color-foreground);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.description {
|
|
28
|
+
font-size: var(--st-font-size-xs);
|
|
29
|
+
color: var(--st-color-muted);
|
|
30
|
+
line-height: var(--st-line-height-normal);
|
|
31
|
+
margin: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.value {
|
|
35
|
+
font-size: var(--st-font-size-2xl);
|
|
36
|
+
font-weight: var(--st-font-weight-semibold);
|
|
37
|
+
color: var(--st-color-foreground);
|
|
38
|
+
line-height: var(--st-line-height-tight);
|
|
39
|
+
flex-shrink: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.media {
|
|
43
|
+
border-radius: var(--st-radius-lg);
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.action {
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import { Card } from './Card';
|
|
4
|
+
import { Avatar } from '../Avatar/Avatar';
|
|
5
|
+
import { AvatarGroup } from '../Avatar/AvatarGroup';
|
|
6
|
+
import type { UserGroupCardProps } from './UserGroupCard.types';
|
|
7
|
+
import styles from './UserGroupCard.module.css';
|
|
8
|
+
|
|
9
|
+
export const UserGroupCard = forwardRef<HTMLDivElement, UserGroupCardProps>(
|
|
10
|
+
(
|
|
11
|
+
{
|
|
12
|
+
title,
|
|
13
|
+
description,
|
|
14
|
+
value,
|
|
15
|
+
avatars,
|
|
16
|
+
avatarLimit,
|
|
17
|
+
media,
|
|
18
|
+
action,
|
|
19
|
+
className,
|
|
20
|
+
...rest
|
|
21
|
+
},
|
|
22
|
+
ref
|
|
23
|
+
) => {
|
|
24
|
+
return (
|
|
25
|
+
<Card
|
|
26
|
+
ref={ref}
|
|
27
|
+
className={cn(styles.root, className)}
|
|
28
|
+
padding="md"
|
|
29
|
+
{...rest}
|
|
30
|
+
>
|
|
31
|
+
{(title || description || value) && (
|
|
32
|
+
<div className={styles.header}>
|
|
33
|
+
<div className={styles.text}>
|
|
34
|
+
{title && <span className={styles.title}>{title}</span>}
|
|
35
|
+
{description && (
|
|
36
|
+
<p className={styles.description}>{description}</p>
|
|
37
|
+
)}
|
|
38
|
+
</div>
|
|
39
|
+
{value != null && <span className={styles.value}>{value}</span>}
|
|
40
|
+
</div>
|
|
41
|
+
)}
|
|
42
|
+
|
|
43
|
+
{media && <div className={styles.media}>{media}</div>}
|
|
44
|
+
|
|
45
|
+
{avatars && avatars.length > 0 && (
|
|
46
|
+
<AvatarGroup size="sm" limit={avatarLimit}>
|
|
47
|
+
{avatars.map((a, i) => (
|
|
48
|
+
<Avatar key={i} src={a.src} initials={a.initials} />
|
|
49
|
+
))}
|
|
50
|
+
</AvatarGroup>
|
|
51
|
+
)}
|
|
52
|
+
|
|
53
|
+
{action && <div className={styles.action}>{action}</div>}
|
|
54
|
+
</Card>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
UserGroupCard.displayName = 'UserGroupCard';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface UserGroupAvatar {
|
|
4
|
+
src?: string;
|
|
5
|
+
initials?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface UserGroupCardProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
/** Card title. */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Description text. */
|
|
12
|
+
description?: string;
|
|
13
|
+
/** Large value display. */
|
|
14
|
+
value?: string | number;
|
|
15
|
+
/** Avatar data array. */
|
|
16
|
+
avatars?: UserGroupAvatar[];
|
|
17
|
+
/** Max visible avatars. */
|
|
18
|
+
avatarLimit?: number;
|
|
19
|
+
/** Image grid or custom content. */
|
|
20
|
+
media?: ReactNode;
|
|
21
|
+
/** Action slot. */
|
|
22
|
+
action?: ReactNode;
|
|
23
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export { Card } from './Card';
|
|
2
|
+
export { CardHeader } from './CardHeader';
|
|
3
|
+
export { CardContent } from './CardContent';
|
|
4
|
+
export { CardFooter } from './CardFooter';
|
|
5
|
+
export type {
|
|
6
|
+
CardProps,
|
|
7
|
+
CardVariant,
|
|
8
|
+
CardPadding,
|
|
9
|
+
CardHeaderProps,
|
|
10
|
+
CardHeaderSize,
|
|
11
|
+
CardContentProps,
|
|
12
|
+
CardFooterProps,
|
|
13
|
+
CardFooterAlign,
|
|
14
|
+
} from './Card.types';
|
|
15
|
+
|
|
16
|
+
export { StatCard } from './StatCard';
|
|
17
|
+
export type { StatCardProps } from './StatCard.types';
|
|
18
|
+
|
|
19
|
+
export { PlanCard } from './PlanCard';
|
|
20
|
+
export type { PlanCardProps, PlanCardFeature } from './PlanCard.types';
|
|
21
|
+
|
|
22
|
+
export { InsightCard } from './InsightCard';
|
|
23
|
+
export type { InsightCardProps, InsightCardVariant } from './InsightCard.types';
|
|
24
|
+
|
|
25
|
+
export { ProductCard } from './ProductCard';
|
|
26
|
+
export type { ProductCardProps, ProductCardLayout } from './ProductCard.types';
|
|
27
|
+
|
|
28
|
+
export { KPICard } from './KPICard';
|
|
29
|
+
export type { KPICardProps, KPIItem } from './KPICard.types';
|
|
30
|
+
|
|
31
|
+
export { ListItemCard } from './ListItemCard';
|
|
32
|
+
export type { ListItemCardProps, ListItem } from './ListItemCard.types';
|
|
33
|
+
|
|
34
|
+
export { UserGroupCard } from './UserGroupCard';
|
|
35
|
+
export type {
|
|
36
|
+
UserGroupCardProps,
|
|
37
|
+
UserGroupAvatar,
|
|
38
|
+
} from './UserGroupCard.types';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--st-space-3);
|
|
5
|
+
font-family: var(--st-font-family);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.legend {
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: flex-end;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.grid {
|
|
14
|
+
display: grid;
|
|
15
|
+
grid-template-columns: auto 1fr;
|
|
16
|
+
grid-template-rows: 1fr auto;
|
|
17
|
+
gap: var(--st-space-2);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.yAxis {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
justify-content: space-between;
|
|
24
|
+
text-align: right;
|
|
25
|
+
padding-right: var(--st-space-2);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.yLabel {
|
|
29
|
+
font-size: var(--st-font-size-xs);
|
|
30
|
+
color: var(--st-color-chart-axis);
|
|
31
|
+
line-height: 1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.chartArea {
|
|
35
|
+
position: relative;
|
|
36
|
+
width: 100%;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.chartArea svg {
|
|
40
|
+
display: block;
|
|
41
|
+
width: 100%;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.xAxis {
|
|
45
|
+
display: flex;
|
|
46
|
+
justify-content: space-around;
|
|
47
|
+
padding-top: var(--st-space-2);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.xLabel {
|
|
51
|
+
font-size: var(--st-font-size-xs);
|
|
52
|
+
color: var(--st-color-chart-axis);
|
|
53
|
+
text-align: center;
|
|
54
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { forwardRef, useMemo, useRef, useEffect, useState, useId } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import { niceScale, roundedBarPath } from './chart.utils';
|
|
4
|
+
import { useChartHover } from './useChartHover';
|
|
5
|
+
import { HoverTooltip } from './HoverTooltip';
|
|
6
|
+
import type { BarChartProps } from './BarChart.types';
|
|
7
|
+
import styles from './BarChart.module.css';
|
|
8
|
+
|
|
9
|
+
export const BarChart = forwardRef<HTMLDivElement, BarChartProps>(
|
|
10
|
+
(
|
|
11
|
+
{
|
|
12
|
+
data,
|
|
13
|
+
comparison = false,
|
|
14
|
+
gridLines = true,
|
|
15
|
+
height = 200,
|
|
16
|
+
legend,
|
|
17
|
+
className,
|
|
18
|
+
...rest
|
|
19
|
+
},
|
|
20
|
+
ref
|
|
21
|
+
) => {
|
|
22
|
+
const chartRef = useRef<HTMLDivElement>(null);
|
|
23
|
+
const [chartWidth, setChartWidth] = useState(0);
|
|
24
|
+
const clipId = useId();
|
|
25
|
+
const { hover, show, hide } = useChartHover();
|
|
26
|
+
const [activeIdx, setActiveIdx] = useState<number | null>(null);
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!chartRef.current) return;
|
|
30
|
+
const ro = new ResizeObserver((entries) => {
|
|
31
|
+
for (const entry of entries) {
|
|
32
|
+
setChartWidth(entry.contentRect.width);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
ro.observe(chartRef.current);
|
|
36
|
+
return () => ro.disconnect();
|
|
37
|
+
}, []);
|
|
38
|
+
|
|
39
|
+
const allValues = useMemo(() => {
|
|
40
|
+
const vals = data.map((d) => d.value);
|
|
41
|
+
if (comparison) vals.push(...data.map((d) => d.compareValue ?? 0));
|
|
42
|
+
return vals;
|
|
43
|
+
}, [data, comparison]);
|
|
44
|
+
|
|
45
|
+
const maxVal = Math.max(...allValues, 0);
|
|
46
|
+
const ticks = niceScale(0, maxVal);
|
|
47
|
+
const scaleMax = ticks[ticks.length - 1];
|
|
48
|
+
|
|
49
|
+
const barPadding = 0.3;
|
|
50
|
+
const groupWidth = chartWidth / data.length;
|
|
51
|
+
const barGroupWidth = groupWidth * (1 - barPadding);
|
|
52
|
+
const barRadius = 3;
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<div ref={ref} className={cn(styles.root, className)} {...rest}>
|
|
56
|
+
{legend && <div className={styles.legend}>{legend}</div>}
|
|
57
|
+
<div className={styles.grid}>
|
|
58
|
+
{/* Y-axis */}
|
|
59
|
+
<div className={styles.yAxis} style={{ height }}>
|
|
60
|
+
{[...ticks].reverse().map((tick, i) => (
|
|
61
|
+
<span key={i} className={styles.yLabel}>
|
|
62
|
+
{tick >= 1000 ? `${(tick / 1000).toFixed(tick % 1000 === 0 ? 0 : 1)}k` : tick}
|
|
63
|
+
</span>
|
|
64
|
+
))}
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
{/* Chart area */}
|
|
68
|
+
<div ref={chartRef} className={styles.chartArea} style={{ height }}>
|
|
69
|
+
{chartWidth > 0 && (
|
|
70
|
+
<svg
|
|
71
|
+
width={chartWidth}
|
|
72
|
+
height={height}
|
|
73
|
+
viewBox={`0 0 ${chartWidth} ${height}`}
|
|
74
|
+
>
|
|
75
|
+
<defs>
|
|
76
|
+
<clipPath id={clipId}>
|
|
77
|
+
<rect width={chartWidth} height={height} />
|
|
78
|
+
</clipPath>
|
|
79
|
+
</defs>
|
|
80
|
+
|
|
81
|
+
{/* Grid lines */}
|
|
82
|
+
{gridLines &&
|
|
83
|
+
ticks.map((_, i) => {
|
|
84
|
+
const y = height - (i / (ticks.length - 1)) * height;
|
|
85
|
+
return (
|
|
86
|
+
<line
|
|
87
|
+
key={i}
|
|
88
|
+
x1={0}
|
|
89
|
+
y1={y}
|
|
90
|
+
x2={chartWidth}
|
|
91
|
+
y2={y}
|
|
92
|
+
stroke="var(--st-color-chart-grid)"
|
|
93
|
+
strokeWidth="1"
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
96
|
+
})}
|
|
97
|
+
|
|
98
|
+
{/* Bars */}
|
|
99
|
+
<g clipPath={`url(#${clipId})`}>
|
|
100
|
+
{data.map((d, i) => {
|
|
101
|
+
const cx = groupWidth * i + groupWidth / 2;
|
|
102
|
+
const isActive = activeIdx === i;
|
|
103
|
+
|
|
104
|
+
if (comparison && d.compareValue != null) {
|
|
105
|
+
const bw = barGroupWidth / 2 - 1;
|
|
106
|
+
const h1 = scaleMax > 0 ? (d.value / scaleMax) * height : 0;
|
|
107
|
+
const h2 = scaleMax > 0 ? (d.compareValue / scaleMax) * height : 0;
|
|
108
|
+
return (
|
|
109
|
+
<g key={i}>
|
|
110
|
+
<path
|
|
111
|
+
d={roundedBarPath(cx - barGroupWidth / 2, height - h1, bw, h1, barRadius)}
|
|
112
|
+
fill="var(--st-color-chart-1)"
|
|
113
|
+
opacity={isActive ? 1 : 0.85}
|
|
114
|
+
/>
|
|
115
|
+
<path
|
|
116
|
+
d={roundedBarPath(cx + 1, height - h2, bw, h2, barRadius)}
|
|
117
|
+
fill="var(--st-color-chart-2)"
|
|
118
|
+
opacity={isActive ? 1 : 0.85}
|
|
119
|
+
/>
|
|
120
|
+
{/* Hit area */}
|
|
121
|
+
<rect
|
|
122
|
+
x={groupWidth * i}
|
|
123
|
+
y={0}
|
|
124
|
+
width={groupWidth}
|
|
125
|
+
height={height}
|
|
126
|
+
fill="transparent"
|
|
127
|
+
onMouseEnter={() => {
|
|
128
|
+
setActiveIdx(i);
|
|
129
|
+
show(cx, height - Math.max(h1, h2), (
|
|
130
|
+
<div>
|
|
131
|
+
<div style={{ fontWeight: 600, marginBottom: 2 }}>{d.label}</div>
|
|
132
|
+
<div>{d.value}</div>
|
|
133
|
+
<div>{d.compareValue}</div>
|
|
134
|
+
</div>
|
|
135
|
+
));
|
|
136
|
+
}}
|
|
137
|
+
onMouseLeave={() => { setActiveIdx(null); hide(); }}
|
|
138
|
+
/>
|
|
139
|
+
</g>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const bw = barGroupWidth;
|
|
144
|
+
const h = scaleMax > 0 ? (d.value / scaleMax) * height : 0;
|
|
145
|
+
return (
|
|
146
|
+
<g key={i}>
|
|
147
|
+
<path
|
|
148
|
+
d={roundedBarPath(cx - bw / 2, height - h, bw, h, barRadius)}
|
|
149
|
+
fill="var(--st-color-chart-1)"
|
|
150
|
+
opacity={isActive ? 1 : 0.85}
|
|
151
|
+
/>
|
|
152
|
+
{/* Hit area */}
|
|
153
|
+
<rect
|
|
154
|
+
x={groupWidth * i}
|
|
155
|
+
y={0}
|
|
156
|
+
width={groupWidth}
|
|
157
|
+
height={height}
|
|
158
|
+
fill="transparent"
|
|
159
|
+
onMouseEnter={() => {
|
|
160
|
+
setActiveIdx(i);
|
|
161
|
+
show(cx, height - h, (
|
|
162
|
+
<div>
|
|
163
|
+
<div style={{ fontWeight: 600, marginBottom: 2 }}>{d.label}</div>
|
|
164
|
+
<div>{d.value}</div>
|
|
165
|
+
</div>
|
|
166
|
+
));
|
|
167
|
+
}}
|
|
168
|
+
onMouseLeave={() => { setActiveIdx(null); hide(); }}
|
|
169
|
+
/>
|
|
170
|
+
</g>
|
|
171
|
+
);
|
|
172
|
+
})}
|
|
173
|
+
</g>
|
|
174
|
+
</svg>
|
|
175
|
+
)}
|
|
176
|
+
<HoverTooltip hover={hover} />
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
{/* Spacer */}
|
|
180
|
+
<div />
|
|
181
|
+
|
|
182
|
+
{/* X-axis */}
|
|
183
|
+
<div className={styles.xAxis}>
|
|
184
|
+
{data.map((d, i) => (
|
|
185
|
+
<span key={i} className={styles.xLabel}>
|
|
186
|
+
{d.label}
|
|
187
|
+
</span>
|
|
188
|
+
))}
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
BarChart.displayName = 'BarChart';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface BarChartDataPoint {
|
|
4
|
+
label: string;
|
|
5
|
+
value: number;
|
|
6
|
+
compareValue?: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface BarChartProps extends HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
/** Chart data */
|
|
11
|
+
data: BarChartDataPoint[];
|
|
12
|
+
/** Show comparison bars */
|
|
13
|
+
comparison?: boolean;
|
|
14
|
+
/** Show horizontal grid lines */
|
|
15
|
+
gridLines?: boolean;
|
|
16
|
+
/** Chart height in px */
|
|
17
|
+
height?: number;
|
|
18
|
+
/** Legend element */
|
|
19
|
+
legend?: ReactNode;
|
|
20
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
gap: var(--st-space-3);
|
|
6
|
+
font-family: var(--st-font-family);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.tabs {
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
background-color: var(--st-color-neutral-100);
|
|
12
|
+
border-radius: var(--st-radius-lg);
|
|
13
|
+
padding: 3px;
|
|
14
|
+
gap: 2px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.tab {
|
|
18
|
+
all: unset;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
padding: var(--st-space-1) var(--st-space-3);
|
|
21
|
+
font-size: var(--st-font-size-sm);
|
|
22
|
+
font-weight: var(--st-font-weight-medium);
|
|
23
|
+
color: var(--st-color-muted);
|
|
24
|
+
border-radius: var(--st-radius-md);
|
|
25
|
+
transition: all var(--st-transition-fast);
|
|
26
|
+
white-space: nowrap;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.tab:hover {
|
|
30
|
+
color: var(--st-color-foreground);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.tab.active {
|
|
34
|
+
background-color: var(--st-color-surface);
|
|
35
|
+
color: var(--st-color-foreground);
|
|
36
|
+
box-shadow: var(--st-shadow-xs);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.actions {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: var(--st-space-2);
|
|
43
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { ChartActionProps } from './ChartAction.types';
|
|
4
|
+
import styles from './ChartAction.module.css';
|
|
5
|
+
|
|
6
|
+
export const ChartAction = forwardRef<HTMLDivElement, ChartActionProps>(
|
|
7
|
+
({ tabs, activeTab, onTabChange, actions, className, ...rest }, ref) => {
|
|
8
|
+
return (
|
|
9
|
+
<div ref={ref} className={cn(styles.root, className)} {...rest}>
|
|
10
|
+
{tabs && tabs.length > 0 && (
|
|
11
|
+
<div className={styles.tabs} role="tablist">
|
|
12
|
+
{tabs.map((tab) => (
|
|
13
|
+
<button
|
|
14
|
+
key={tab.value}
|
|
15
|
+
role="tab"
|
|
16
|
+
aria-selected={activeTab === tab.value}
|
|
17
|
+
className={cn(
|
|
18
|
+
styles.tab,
|
|
19
|
+
activeTab === tab.value && styles.active
|
|
20
|
+
)}
|
|
21
|
+
onClick={() => onTabChange?.(tab.value)}
|
|
22
|
+
type="button"
|
|
23
|
+
>
|
|
24
|
+
{tab.label}
|
|
25
|
+
</button>
|
|
26
|
+
))}
|
|
27
|
+
</div>
|
|
28
|
+
)}
|
|
29
|
+
{actions && <div className={styles.actions}>{actions}</div>}
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
ChartAction.displayName = 'ChartAction';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ChartActionTab {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ChartActionProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
/** Segmented tab options */
|
|
10
|
+
tabs?: ChartActionTab[];
|
|
11
|
+
/** Currently active tab value */
|
|
12
|
+
activeTab?: string;
|
|
13
|
+
/** Tab change callback */
|
|
14
|
+
onTabChange?: (value: string) => void;
|
|
15
|
+
/** Slot for action buttons/icons on the right */
|
|
16
|
+
actions?: ReactNode;
|
|
17
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: auto 1fr;
|
|
4
|
+
grid-template-rows: 1fr auto;
|
|
5
|
+
gap: var(--st-space-2);
|
|
6
|
+
font-family: var(--st-font-family);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.yAxis {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
height: var(--ca-chart-h);
|
|
14
|
+
text-align: right;
|
|
15
|
+
padding-right: var(--st-space-2);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.yLabel {
|
|
19
|
+
font-size: var(--st-font-size-xs);
|
|
20
|
+
color: var(--st-color-chart-axis);
|
|
21
|
+
line-height: 1;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.chartArea {
|
|
25
|
+
position: relative;
|
|
26
|
+
width: 100%;
|
|
27
|
+
height: var(--ca-chart-h);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.grid {
|
|
31
|
+
position: absolute;
|
|
32
|
+
top: 0;
|
|
33
|
+
left: 0;
|
|
34
|
+
pointer-events: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.xAxis {
|
|
38
|
+
display: flex;
|
|
39
|
+
justify-content: space-between;
|
|
40
|
+
padding-top: var(--st-space-2);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.xLabel {
|
|
44
|
+
font-size: var(--st-font-size-xs);
|
|
45
|
+
color: var(--st-color-chart-axis);
|
|
46
|
+
text-align: center;
|
|
47
|
+
}
|