@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,146 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { AlertProps, AlertStatus } from './Alert.types';
|
|
4
|
+
import styles from './Alert.module.css';
|
|
5
|
+
|
|
6
|
+
function InfoIcon() {
|
|
7
|
+
return (
|
|
8
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
9
|
+
<circle cx="10" cy="10" r="8.5" stroke="currentColor" strokeWidth="1.5" />
|
|
10
|
+
<path
|
|
11
|
+
d="M10 9V14M10 6.5V7"
|
|
12
|
+
stroke="currentColor"
|
|
13
|
+
strokeWidth="1.5"
|
|
14
|
+
strokeLinecap="round"
|
|
15
|
+
/>
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function SuccessIcon() {
|
|
21
|
+
return (
|
|
22
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
23
|
+
<circle cx="10" cy="10" r="8.5" stroke="currentColor" strokeWidth="1.5" />
|
|
24
|
+
<path
|
|
25
|
+
d="M6.5 10L9 12.5L13.5 7.5"
|
|
26
|
+
stroke="currentColor"
|
|
27
|
+
strokeWidth="1.5"
|
|
28
|
+
strokeLinecap="round"
|
|
29
|
+
strokeLinejoin="round"
|
|
30
|
+
/>
|
|
31
|
+
</svg>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function WarningIcon() {
|
|
36
|
+
return (
|
|
37
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
38
|
+
<path
|
|
39
|
+
d="M10 2.5L18.5 17.5H1.5L10 2.5Z"
|
|
40
|
+
stroke="currentColor"
|
|
41
|
+
strokeWidth="1.5"
|
|
42
|
+
strokeLinejoin="round"
|
|
43
|
+
/>
|
|
44
|
+
<path
|
|
45
|
+
d="M10 8V12M10 14.5V15"
|
|
46
|
+
stroke="currentColor"
|
|
47
|
+
strokeWidth="1.5"
|
|
48
|
+
strokeLinecap="round"
|
|
49
|
+
/>
|
|
50
|
+
</svg>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function ErrorIcon() {
|
|
55
|
+
return (
|
|
56
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
57
|
+
<circle cx="10" cy="10" r="8.5" stroke="currentColor" strokeWidth="1.5" />
|
|
58
|
+
<path
|
|
59
|
+
d="M10 6V11M10 13.5V14"
|
|
60
|
+
stroke="currentColor"
|
|
61
|
+
strokeWidth="1.5"
|
|
62
|
+
strokeLinecap="round"
|
|
63
|
+
/>
|
|
64
|
+
</svg>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function CloseIcon() {
|
|
69
|
+
return (
|
|
70
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none">
|
|
71
|
+
<path
|
|
72
|
+
d="M4 4L12 12M12 4L4 12"
|
|
73
|
+
stroke="currentColor"
|
|
74
|
+
strokeWidth="1.5"
|
|
75
|
+
strokeLinecap="round"
|
|
76
|
+
/>
|
|
77
|
+
</svg>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const defaultIcons: Record<AlertStatus, JSX.Element> = {
|
|
82
|
+
info: <InfoIcon />,
|
|
83
|
+
success: <SuccessIcon />,
|
|
84
|
+
warning: <WarningIcon />,
|
|
85
|
+
error: <ErrorIcon />,
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const Alert = forwardRef<HTMLDivElement, AlertProps>(
|
|
89
|
+
(
|
|
90
|
+
{
|
|
91
|
+
status = 'info',
|
|
92
|
+
variant = 'solid',
|
|
93
|
+
layout = 'inline',
|
|
94
|
+
title,
|
|
95
|
+
description,
|
|
96
|
+
icon,
|
|
97
|
+
onClose,
|
|
98
|
+
actions,
|
|
99
|
+
className,
|
|
100
|
+
...rest
|
|
101
|
+
},
|
|
102
|
+
ref
|
|
103
|
+
) => {
|
|
104
|
+
const renderedIcon = icon ?? defaultIcons[status];
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<div
|
|
108
|
+
ref={ref}
|
|
109
|
+
role="alert"
|
|
110
|
+
className={cn(
|
|
111
|
+
styles.root,
|
|
112
|
+
styles[variant],
|
|
113
|
+
styles[status],
|
|
114
|
+
styles[layout],
|
|
115
|
+
className
|
|
116
|
+
)}
|
|
117
|
+
{...rest}
|
|
118
|
+
>
|
|
119
|
+
<span className={styles.statusIcon}>{renderedIcon}</span>
|
|
120
|
+
|
|
121
|
+
<div className={styles.body}>
|
|
122
|
+
<div className={styles.content}>
|
|
123
|
+
<p className={styles.title}>{title}</p>
|
|
124
|
+
{description && (
|
|
125
|
+
<p className={styles.description}>{description}</p>
|
|
126
|
+
)}
|
|
127
|
+
</div>
|
|
128
|
+
{actions && <div className={styles.actions}>{actions}</div>}
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
{onClose && (
|
|
132
|
+
<button
|
|
133
|
+
type="button"
|
|
134
|
+
className={styles.close}
|
|
135
|
+
onClick={onClose}
|
|
136
|
+
aria-label="Close alert"
|
|
137
|
+
>
|
|
138
|
+
<CloseIcon />
|
|
139
|
+
</button>
|
|
140
|
+
)}
|
|
141
|
+
</div>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
Alert.displayName = 'Alert';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export type AlertStatus = 'info' | 'success' | 'warning' | 'error';
|
|
4
|
+
export type AlertVariant = 'solid' | 'alpha';
|
|
5
|
+
export type AlertLayout = 'inline' | 'stacked';
|
|
6
|
+
|
|
7
|
+
export interface AlertProps
|
|
8
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
9
|
+
/** Semantic status */
|
|
10
|
+
status?: AlertStatus;
|
|
11
|
+
/** Visual style: solid (filled bg) or alpha (light bg + colored left border) */
|
|
12
|
+
variant?: AlertVariant;
|
|
13
|
+
/** Actions placement: inline (beside text) or stacked (below text) */
|
|
14
|
+
layout?: AlertLayout;
|
|
15
|
+
/** Alert title */
|
|
16
|
+
title: string;
|
|
17
|
+
/** Optional description text */
|
|
18
|
+
description?: string;
|
|
19
|
+
/** Custom icon override (defaults based on status) */
|
|
20
|
+
icon?: ReactNode;
|
|
21
|
+
/** Close callback — renders close button when provided */
|
|
22
|
+
onClose?: () => void;
|
|
23
|
+
/** Action slot (buttons, links) */
|
|
24
|
+
actions?: ReactNode;
|
|
25
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
border-radius: var(--st-radius-full);
|
|
7
|
+
background-color: var(--st-color-neutral-200);
|
|
8
|
+
color: var(--st-color-neutral-600);
|
|
9
|
+
font-family: var(--st-font-family);
|
|
10
|
+
font-weight: var(--st-font-weight-semibold);
|
|
11
|
+
overflow: visible;
|
|
12
|
+
flex-shrink: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* ─── Sizes ─── */
|
|
16
|
+
|
|
17
|
+
.xl {
|
|
18
|
+
width: 64px;
|
|
19
|
+
height: 64px;
|
|
20
|
+
font-size: var(--st-font-size-xl);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.lg {
|
|
24
|
+
width: 48px;
|
|
25
|
+
height: 48px;
|
|
26
|
+
font-size: var(--st-font-size-md);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.md {
|
|
30
|
+
width: 36px;
|
|
31
|
+
height: 36px;
|
|
32
|
+
font-size: var(--st-font-size-sm);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.sm {
|
|
36
|
+
width: 28px;
|
|
37
|
+
height: 28px;
|
|
38
|
+
font-size: var(--st-font-size-xs);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* ─── Image ─── */
|
|
42
|
+
|
|
43
|
+
.image {
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 100%;
|
|
46
|
+
object-fit: cover;
|
|
47
|
+
border-radius: var(--st-radius-full);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* ─── Initials ─── */
|
|
51
|
+
|
|
52
|
+
.initials {
|
|
53
|
+
line-height: 1;
|
|
54
|
+
user-select: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* ─── Icon ─── */
|
|
58
|
+
|
|
59
|
+
.icon {
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.iconSvg {
|
|
66
|
+
width: 55%;
|
|
67
|
+
height: 55%;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* ─── Status indicator ─── */
|
|
71
|
+
|
|
72
|
+
.status {
|
|
73
|
+
position: absolute;
|
|
74
|
+
bottom: 0;
|
|
75
|
+
right: 0;
|
|
76
|
+
border-radius: var(--st-radius-full);
|
|
77
|
+
background-color: var(--st-color-success);
|
|
78
|
+
border: 2px solid var(--st-color-background);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.xl .status {
|
|
82
|
+
width: 14px;
|
|
83
|
+
height: 14px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.lg .status {
|
|
87
|
+
width: 12px;
|
|
88
|
+
height: 12px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.md .status {
|
|
92
|
+
width: 10px;
|
|
93
|
+
height: 10px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.sm .status {
|
|
97
|
+
width: 8px;
|
|
98
|
+
height: 8px;
|
|
99
|
+
border-width: 1.5px;
|
|
100
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { AvatarProps } from './Avatar.types';
|
|
4
|
+
import styles from './Avatar.module.css';
|
|
5
|
+
|
|
6
|
+
function PersonIcon() {
|
|
7
|
+
return (
|
|
8
|
+
<svg viewBox="0 0 24 24" fill="none" className={styles.iconSvg}>
|
|
9
|
+
<path
|
|
10
|
+
d="M12 12C14.21 12 16 10.21 16 8C16 5.79 14.21 4 12 4C9.79 4 8 5.79 8 8C8 10.21 9.79 12 12 12ZM12 14C9.33 14 4 15.34 4 18V20H20V18C20 15.34 14.67 14 12 14Z"
|
|
11
|
+
fill="currentColor"
|
|
12
|
+
/>
|
|
13
|
+
</svg>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const Avatar = forwardRef<HTMLDivElement, AvatarProps>(
|
|
18
|
+
(
|
|
19
|
+
{
|
|
20
|
+
src,
|
|
21
|
+
alt = '',
|
|
22
|
+
initials,
|
|
23
|
+
icon,
|
|
24
|
+
size = 'md',
|
|
25
|
+
status = false,
|
|
26
|
+
className,
|
|
27
|
+
...rest
|
|
28
|
+
},
|
|
29
|
+
ref
|
|
30
|
+
) => {
|
|
31
|
+
const renderContent = () => {
|
|
32
|
+
if (src) {
|
|
33
|
+
return <img src={src} alt={alt} className={styles.image} />;
|
|
34
|
+
}
|
|
35
|
+
if (initials) {
|
|
36
|
+
return <span className={styles.initials}>{initials}</span>;
|
|
37
|
+
}
|
|
38
|
+
return <span className={styles.icon}>{icon ?? <PersonIcon />}</span>;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div
|
|
43
|
+
ref={ref}
|
|
44
|
+
className={cn(styles.root, styles[size], className)}
|
|
45
|
+
{...rest}
|
|
46
|
+
>
|
|
47
|
+
{renderContent()}
|
|
48
|
+
{status && <span className={styles.status} />}
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
Avatar.displayName = 'Avatar';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export type AvatarSize = 'xl' | 'lg' | 'md' | 'sm';
|
|
4
|
+
|
|
5
|
+
export interface AvatarProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/** Image URL */
|
|
7
|
+
src?: string;
|
|
8
|
+
/** Alt text for image */
|
|
9
|
+
alt?: string;
|
|
10
|
+
/** Initials to display when no image */
|
|
11
|
+
initials?: string;
|
|
12
|
+
/** Custom icon to display when no image or initials */
|
|
13
|
+
icon?: ReactNode;
|
|
14
|
+
/** Avatar size */
|
|
15
|
+
size?: AvatarSize;
|
|
16
|
+
/** Show online/status indicator */
|
|
17
|
+
status?: boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/* ─── Spacing ─── */
|
|
7
|
+
|
|
8
|
+
.overlap > * {
|
|
9
|
+
border: 2px solid var(--st-color-background);
|
|
10
|
+
border-radius: var(--st-radius-full);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.overlap.xl > *:not(:first-child) { margin-left: -16px; }
|
|
14
|
+
.overlap.lg > *:not(:first-child) { margin-left: -12px; }
|
|
15
|
+
.overlap.md > *:not(:first-child) { margin-left: -8px; }
|
|
16
|
+
.overlap.sm > *:not(:first-child) { margin-left: -6px; }
|
|
17
|
+
|
|
18
|
+
.spaced.xl { gap: var(--st-space-2); }
|
|
19
|
+
.spaced.lg { gap: var(--st-space-2); }
|
|
20
|
+
.spaced.md { gap: var(--st-space-2); }
|
|
21
|
+
.spaced.sm { gap: var(--st-space-1); }
|
|
22
|
+
|
|
23
|
+
/* ─── Counter ─── */
|
|
24
|
+
|
|
25
|
+
.counter {
|
|
26
|
+
display: inline-flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
border-radius: var(--st-radius-full);
|
|
30
|
+
background-color: var(--st-color-neutral-200);
|
|
31
|
+
color: var(--st-color-neutral-600);
|
|
32
|
+
font-family: var(--st-font-family);
|
|
33
|
+
font-weight: var(--st-font-weight-medium);
|
|
34
|
+
flex-shrink: 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.counterXl {
|
|
38
|
+
width: 64px;
|
|
39
|
+
height: 64px;
|
|
40
|
+
font-size: var(--st-font-size-lg);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.counterLg {
|
|
44
|
+
width: 48px;
|
|
45
|
+
height: 48px;
|
|
46
|
+
font-size: var(--st-font-size-md);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.counterMd {
|
|
50
|
+
width: 36px;
|
|
51
|
+
height: 36px;
|
|
52
|
+
font-size: var(--st-font-size-sm);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.counterSm {
|
|
56
|
+
width: 28px;
|
|
57
|
+
height: 28px;
|
|
58
|
+
font-size: var(--st-font-size-xs);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Counter inherits spacing from parent */
|
|
62
|
+
.overlap .counter {
|
|
63
|
+
border: 2px solid var(--st-color-background);
|
|
64
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { forwardRef, Children, isValidElement, cloneElement } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { AvatarGroupProps } from './AvatarGroup.types';
|
|
4
|
+
import type { AvatarSize } from './Avatar.types';
|
|
5
|
+
import styles from './AvatarGroup.module.css';
|
|
6
|
+
|
|
7
|
+
const sizeMap: Record<AvatarSize, string> = {
|
|
8
|
+
xl: styles.xl,
|
|
9
|
+
lg: styles.lg,
|
|
10
|
+
md: styles.md,
|
|
11
|
+
sm: styles.sm,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const counterSizeMap: Record<AvatarSize, string> = {
|
|
15
|
+
xl: styles.counterXl,
|
|
16
|
+
lg: styles.counterLg,
|
|
17
|
+
md: styles.counterMd,
|
|
18
|
+
sm: styles.counterSm,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const AvatarGroup = forwardRef<HTMLDivElement, AvatarGroupProps>(
|
|
22
|
+
(
|
|
23
|
+
{
|
|
24
|
+
size = 'md',
|
|
25
|
+
spacing = 'overlap',
|
|
26
|
+
limit,
|
|
27
|
+
className,
|
|
28
|
+
children,
|
|
29
|
+
...rest
|
|
30
|
+
},
|
|
31
|
+
ref
|
|
32
|
+
) => {
|
|
33
|
+
const childArray = Children.toArray(children).filter(isValidElement);
|
|
34
|
+
const total = childArray.length;
|
|
35
|
+
const visibleChildren =
|
|
36
|
+
limit && total > limit ? childArray.slice(0, limit) : childArray;
|
|
37
|
+
const excess = limit && total > limit ? total - limit : 0;
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
ref={ref}
|
|
42
|
+
className={cn(
|
|
43
|
+
styles.root,
|
|
44
|
+
styles[spacing],
|
|
45
|
+
sizeMap[size],
|
|
46
|
+
className
|
|
47
|
+
)}
|
|
48
|
+
{...rest}
|
|
49
|
+
>
|
|
50
|
+
{visibleChildren.map((child) =>
|
|
51
|
+
cloneElement(child as React.ReactElement<{ size?: AvatarSize }>, {
|
|
52
|
+
size,
|
|
53
|
+
})
|
|
54
|
+
)}
|
|
55
|
+
{excess > 0 && (
|
|
56
|
+
<span className={cn(styles.counter, counterSizeMap[size])}>
|
|
57
|
+
+{excess}
|
|
58
|
+
</span>
|
|
59
|
+
)}
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
AvatarGroup.displayName = 'AvatarGroup';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
import type { AvatarSize } from './Avatar.types';
|
|
3
|
+
|
|
4
|
+
export type AvatarGroupSpacing = 'overlap' | 'spaced';
|
|
5
|
+
|
|
6
|
+
export interface AvatarGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
/** Avatar size applied to all children */
|
|
8
|
+
size?: AvatarSize;
|
|
9
|
+
/** Spacing mode: overlap (negative margin) or spaced (gap) */
|
|
10
|
+
spacing?: AvatarGroupSpacing;
|
|
11
|
+
/** Max visible avatars — excess shown as "+N" counter */
|
|
12
|
+
limit?: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/* ─── Indicator base ─── */
|
|
7
|
+
|
|
8
|
+
.indicator {
|
|
9
|
+
position: absolute;
|
|
10
|
+
z-index: 1;
|
|
11
|
+
pointer-events: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* ─── Positions ─── */
|
|
15
|
+
|
|
16
|
+
.rightTop {
|
|
17
|
+
top: 0;
|
|
18
|
+
right: 0;
|
|
19
|
+
transform: translate(50%, -50%);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.rightCenter {
|
|
23
|
+
top: 50%;
|
|
24
|
+
right: 0;
|
|
25
|
+
transform: translate(50%, -50%);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.rightBottom {
|
|
29
|
+
bottom: 0;
|
|
30
|
+
right: 0;
|
|
31
|
+
transform: translate(50%, 50%);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* ─── Dot ─── */
|
|
35
|
+
|
|
36
|
+
.dot {
|
|
37
|
+
border-radius: var(--st-radius-full);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.dot.md {
|
|
41
|
+
width: 10px;
|
|
42
|
+
height: 10px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.dot.sm {
|
|
46
|
+
width: 8px;
|
|
47
|
+
height: 8px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.dot.primary {
|
|
51
|
+
background-color: var(--st-color-success);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.dot.secondary {
|
|
55
|
+
background-color: var(--st-color-primary);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* ─── Pill (number / text) ─── */
|
|
59
|
+
|
|
60
|
+
.pill {
|
|
61
|
+
display: inline-flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
border-radius: var(--st-radius-full);
|
|
65
|
+
font-family: var(--st-font-family);
|
|
66
|
+
font-weight: var(--st-font-weight-semibold);
|
|
67
|
+
white-space: nowrap;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.pill.md {
|
|
71
|
+
min-width: 20px;
|
|
72
|
+
height: 20px;
|
|
73
|
+
padding: 0 6px;
|
|
74
|
+
font-size: 11px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.pill.sm {
|
|
78
|
+
min-width: 18px;
|
|
79
|
+
height: 18px;
|
|
80
|
+
padding: 0 5px;
|
|
81
|
+
font-size: 10px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.pill.primary {
|
|
85
|
+
background-color: var(--st-color-success);
|
|
86
|
+
color: #ffffff;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.pill.secondary {
|
|
90
|
+
background-color: var(--st-color-primary);
|
|
91
|
+
color: #ffffff;
|
|
92
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { BadgeProps } from './Badge.types';
|
|
4
|
+
import styles from './Badge.module.css';
|
|
5
|
+
|
|
6
|
+
const positionClass: Record<string, string> = {
|
|
7
|
+
'right-top': styles.rightTop,
|
|
8
|
+
'right-center': styles.rightCenter,
|
|
9
|
+
'right-bottom': styles.rightBottom,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Badge = forwardRef<HTMLDivElement, BadgeProps>(
|
|
13
|
+
(
|
|
14
|
+
{
|
|
15
|
+
position = 'right-top',
|
|
16
|
+
variant = 'primary',
|
|
17
|
+
size = 'md',
|
|
18
|
+
count,
|
|
19
|
+
label,
|
|
20
|
+
dot = true,
|
|
21
|
+
className,
|
|
22
|
+
children,
|
|
23
|
+
...rest
|
|
24
|
+
},
|
|
25
|
+
ref
|
|
26
|
+
) => {
|
|
27
|
+
const hasPill = count !== undefined || label !== undefined;
|
|
28
|
+
const showDot = !hasPill && dot;
|
|
29
|
+
|
|
30
|
+
const renderIndicator = () => {
|
|
31
|
+
if (count !== undefined) {
|
|
32
|
+
return (
|
|
33
|
+
<span
|
|
34
|
+
className={cn(
|
|
35
|
+
styles.indicator,
|
|
36
|
+
styles.pill,
|
|
37
|
+
styles[variant],
|
|
38
|
+
styles[size],
|
|
39
|
+
positionClass[position]
|
|
40
|
+
)}
|
|
41
|
+
>
|
|
42
|
+
+{count}
|
|
43
|
+
</span>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (label !== undefined) {
|
|
48
|
+
return (
|
|
49
|
+
<span
|
|
50
|
+
className={cn(
|
|
51
|
+
styles.indicator,
|
|
52
|
+
styles.pill,
|
|
53
|
+
styles[variant],
|
|
54
|
+
styles[size],
|
|
55
|
+
positionClass[position]
|
|
56
|
+
)}
|
|
57
|
+
>
|
|
58
|
+
{label}
|
|
59
|
+
</span>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (showDot) {
|
|
64
|
+
return (
|
|
65
|
+
<span
|
|
66
|
+
className={cn(
|
|
67
|
+
styles.indicator,
|
|
68
|
+
styles.dot,
|
|
69
|
+
styles[variant],
|
|
70
|
+
styles[size],
|
|
71
|
+
positionClass[position]
|
|
72
|
+
)}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return null;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<div ref={ref} className={cn(styles.root, className)} {...rest}>
|
|
82
|
+
{children}
|
|
83
|
+
{renderIndicator()}
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
Badge.displayName = 'Badge';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
|
|
3
|
+
export type BadgePosition = 'right-top' | 'right-center' | 'right-bottom';
|
|
4
|
+
export type BadgeVariant = 'primary' | 'secondary';
|
|
5
|
+
export type BadgeSize = 'md' | 'sm';
|
|
6
|
+
|
|
7
|
+
export interface BadgeProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
/** Badge position relative to children */
|
|
9
|
+
position?: BadgePosition;
|
|
10
|
+
/** Color variant: primary (green) or secondary (blue) */
|
|
11
|
+
variant?: BadgeVariant;
|
|
12
|
+
/** Badge size */
|
|
13
|
+
size?: BadgeSize;
|
|
14
|
+
/** Number to display as "+N" */
|
|
15
|
+
count?: number;
|
|
16
|
+
/** Text label to display (e.g. "New") */
|
|
17
|
+
label?: string;
|
|
18
|
+
/** When true (and no count/label), shows a dot indicator. Defaults to true. */
|
|
19
|
+
dot?: boolean;
|
|
20
|
+
}
|