@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,70 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import { Avatar } from '../Avatar';
|
|
4
|
+
import { VerifiedBadge } from './Persona';
|
|
5
|
+
import type { PersonaMessageProps, PersonaSize } from './Persona.types';
|
|
6
|
+
import styles from './PersonaMessage.module.css';
|
|
7
|
+
|
|
8
|
+
const avatarSizeMap: Record<PersonaSize, 'lg' | 'md' | 'sm'> = {
|
|
9
|
+
lg: 'lg',
|
|
10
|
+
md: 'md',
|
|
11
|
+
sm: 'sm',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const PersonaMessage = forwardRef<HTMLDivElement, PersonaMessageProps>(
|
|
15
|
+
(
|
|
16
|
+
{
|
|
17
|
+
avatarSrc,
|
|
18
|
+
avatarAlt = '',
|
|
19
|
+
name,
|
|
20
|
+
username,
|
|
21
|
+
verified = false,
|
|
22
|
+
message,
|
|
23
|
+
time,
|
|
24
|
+
badgeCount,
|
|
25
|
+
unread = false,
|
|
26
|
+
size = 'md',
|
|
27
|
+
className,
|
|
28
|
+
...rest
|
|
29
|
+
},
|
|
30
|
+
ref
|
|
31
|
+
) => {
|
|
32
|
+
const showBadge = badgeCount != null && badgeCount > 0;
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
ref={ref}
|
|
37
|
+
className={cn(styles.root, styles[size], className)}
|
|
38
|
+
tabIndex={0}
|
|
39
|
+
{...rest}
|
|
40
|
+
>
|
|
41
|
+
<Avatar src={avatarSrc} alt={avatarAlt} size={avatarSizeMap[size]} />
|
|
42
|
+
<div className={styles.body}>
|
|
43
|
+
<div className={styles.header}>
|
|
44
|
+
<span className={styles.nameRow}>
|
|
45
|
+
<span className={styles.name}>{name}</span>
|
|
46
|
+
{verified && <VerifiedBadge />}
|
|
47
|
+
{username && <span className={styles.username}>{username}</span>}
|
|
48
|
+
</span>
|
|
49
|
+
<span className={styles.trailing}>
|
|
50
|
+
{time && <span className={styles.time}>{time}</span>}
|
|
51
|
+
{unread && <span className={styles.unreadDot} />}
|
|
52
|
+
</span>
|
|
53
|
+
</div>
|
|
54
|
+
{message && <span className={styles.message}>{message}</span>}
|
|
55
|
+
</div>
|
|
56
|
+
{showBadge && (
|
|
57
|
+
<div className={styles.badgeArea}>
|
|
58
|
+
{size === 'sm' ? (
|
|
59
|
+
<span className={styles.badgeDot} />
|
|
60
|
+
) : (
|
|
61
|
+
<span className={styles.badge}>{badgeCount}</span>
|
|
62
|
+
)}
|
|
63
|
+
</div>
|
|
64
|
+
)}
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
PersonaMessage.displayName = 'PersonaMessage';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { Persona } from './Persona';
|
|
2
|
+
export { PersonaMessage } from './PersonaMessage';
|
|
3
|
+
export { PersonaAction } from './PersonaAction';
|
|
4
|
+
export { MessageDropdown } from './MessageDropdown';
|
|
5
|
+
export type {
|
|
6
|
+
PersonaProps,
|
|
7
|
+
PersonaSize,
|
|
8
|
+
PersonaMessageProps,
|
|
9
|
+
PersonaActionProps,
|
|
10
|
+
MessageDropdownProps,
|
|
11
|
+
} from './Persona.types';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* ═══ Progress ═══ */
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: var(--st-space-1);
|
|
7
|
+
font-family: var(--st-font-family);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* ─── Label ─── */
|
|
11
|
+
|
|
12
|
+
.label {
|
|
13
|
+
font-size: var(--st-font-size-sm);
|
|
14
|
+
font-weight: var(--st-font-weight-semibold);
|
|
15
|
+
color: var(--st-color-foreground);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* ─── Track & Fill ─── */
|
|
19
|
+
|
|
20
|
+
.track {
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 8px;
|
|
23
|
+
border-radius: var(--st-radius-full);
|
|
24
|
+
background-color: var(--st-color-neutral-200);
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.fill {
|
|
29
|
+
height: 100%;
|
|
30
|
+
border-radius: var(--st-radius-full);
|
|
31
|
+
background-color: var(--st-color-primary);
|
|
32
|
+
transition: width var(--st-transition-normal);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* ─── Value ─── */
|
|
36
|
+
|
|
37
|
+
.value {
|
|
38
|
+
font-size: var(--st-font-size-xs);
|
|
39
|
+
color: var(--st-color-muted);
|
|
40
|
+
text-align: right;
|
|
41
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { ProgressProps } from './Progress.types';
|
|
4
|
+
import styles from './Progress.module.css';
|
|
5
|
+
|
|
6
|
+
export const Progress = forwardRef<HTMLDivElement, ProgressProps>(
|
|
7
|
+
(
|
|
8
|
+
{
|
|
9
|
+
label,
|
|
10
|
+
value = 0,
|
|
11
|
+
showValue = true,
|
|
12
|
+
className,
|
|
13
|
+
...rest
|
|
14
|
+
},
|
|
15
|
+
ref
|
|
16
|
+
) => {
|
|
17
|
+
const clamped = Math.max(0, Math.min(100, value));
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div ref={ref} className={cn(styles.root, className)} {...rest}>
|
|
21
|
+
{label && <span className={styles.label}>{label}</span>}
|
|
22
|
+
<div
|
|
23
|
+
className={styles.track}
|
|
24
|
+
role="progressbar"
|
|
25
|
+
aria-valuenow={clamped}
|
|
26
|
+
aria-valuemin={0}
|
|
27
|
+
aria-valuemax={100}
|
|
28
|
+
aria-label={label}
|
|
29
|
+
>
|
|
30
|
+
<div
|
|
31
|
+
className={styles.fill}
|
|
32
|
+
style={{ width: `${clamped}%` }}
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
{showValue && (
|
|
36
|
+
<span className={styles.value}>{clamped}%</span>
|
|
37
|
+
)}
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
Progress.displayName = 'Progress';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ProgressProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** Label text above the bar */
|
|
5
|
+
label?: string;
|
|
6
|
+
/** Progress value 0–100 */
|
|
7
|
+
value?: number;
|
|
8
|
+
/** Show percentage text below the bar */
|
|
9
|
+
showValue?: boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/* ─── Root ─── */
|
|
2
|
+
.root {
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
flex-shrink: 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* ─── Sizes ─── */
|
|
11
|
+
.md {
|
|
12
|
+
width: 20px;
|
|
13
|
+
height: 20px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.sm {
|
|
17
|
+
width: 16px;
|
|
18
|
+
height: 16px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* ─── Hidden native input ─── */
|
|
22
|
+
.input {
|
|
23
|
+
position: absolute;
|
|
24
|
+
inset: 0;
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
margin: 0;
|
|
28
|
+
padding: 0;
|
|
29
|
+
opacity: 0;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
z-index: 1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* ─── Visual circle ─── */
|
|
35
|
+
.circle {
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
border: 1.5px solid var(--st-color-neutral-300);
|
|
42
|
+
border-radius: 50%;
|
|
43
|
+
background-color: var(--st-color-background);
|
|
44
|
+
transition:
|
|
45
|
+
background-color var(--st-transition-fast),
|
|
46
|
+
border-color var(--st-transition-fast),
|
|
47
|
+
box-shadow var(--st-transition-fast);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* ─── Inner dot ─── */
|
|
51
|
+
.dot {
|
|
52
|
+
width: 8px;
|
|
53
|
+
height: 8px;
|
|
54
|
+
border-radius: 50%;
|
|
55
|
+
background-color: var(--st-color-success-foreground);
|
|
56
|
+
opacity: 0;
|
|
57
|
+
transition: opacity var(--st-transition-fast);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.sm .dot {
|
|
61
|
+
width: 6px;
|
|
62
|
+
height: 6px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* ─── Checked state ─── */
|
|
66
|
+
.root:has(.input:checked) .circle {
|
|
67
|
+
background-color: var(--st-color-success);
|
|
68
|
+
border-color: var(--st-color-success);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.root:has(.input:checked) .dot {
|
|
72
|
+
opacity: 1;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* ─── Hover ─── */
|
|
76
|
+
.root:not(.disabled):not(.readOnly):has(.input:hover) .circle {
|
|
77
|
+
border-color: var(--st-color-neutral-400);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.root:not(.disabled):not(.readOnly):has(.input:checked:hover) .circle {
|
|
81
|
+
background-color: var(--st-color-success-hover);
|
|
82
|
+
border-color: var(--st-color-success-hover);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* ─── Focus ─── */
|
|
86
|
+
.root:has(.input:focus-visible) .circle {
|
|
87
|
+
box-shadow: 0 0 0 2px var(--st-color-success);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* ─── Disabled ─── */
|
|
91
|
+
.disabled {
|
|
92
|
+
opacity: 0.5;
|
|
93
|
+
pointer-events: none;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* ─── Read-only ─── */
|
|
97
|
+
.readOnly .input {
|
|
98
|
+
cursor: default;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.readOnly .circle {
|
|
102
|
+
border-color: var(--st-color-neutral-200);
|
|
103
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { RadioButtonProps } from './RadioButton.types';
|
|
4
|
+
import styles from './RadioButton.module.css';
|
|
5
|
+
|
|
6
|
+
export const RadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(
|
|
7
|
+
(
|
|
8
|
+
{
|
|
9
|
+
readOnly = false,
|
|
10
|
+
size = 'md',
|
|
11
|
+
disabled = false,
|
|
12
|
+
checked,
|
|
13
|
+
defaultChecked,
|
|
14
|
+
onCheckedChange,
|
|
15
|
+
onChange,
|
|
16
|
+
className,
|
|
17
|
+
...rest
|
|
18
|
+
},
|
|
19
|
+
ref,
|
|
20
|
+
) => {
|
|
21
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
22
|
+
if (readOnly) {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
onChange?.(e);
|
|
27
|
+
onCheckedChange?.(e.target.checked);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<span
|
|
32
|
+
className={cn(
|
|
33
|
+
styles.root,
|
|
34
|
+
styles[size],
|
|
35
|
+
disabled && styles.disabled,
|
|
36
|
+
readOnly && styles.readOnly,
|
|
37
|
+
className,
|
|
38
|
+
)}
|
|
39
|
+
>
|
|
40
|
+
<input
|
|
41
|
+
ref={ref}
|
|
42
|
+
type="radio"
|
|
43
|
+
className={styles.input}
|
|
44
|
+
checked={checked}
|
|
45
|
+
defaultChecked={defaultChecked}
|
|
46
|
+
disabled={disabled}
|
|
47
|
+
readOnly={readOnly}
|
|
48
|
+
onChange={handleChange}
|
|
49
|
+
{...rest}
|
|
50
|
+
/>
|
|
51
|
+
<span className={styles.circle}>
|
|
52
|
+
<span className={styles.dot} />
|
|
53
|
+
</span>
|
|
54
|
+
</span>
|
|
55
|
+
);
|
|
56
|
+
},
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
RadioButton.displayName = 'RadioButton';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { InputHTMLAttributes } from 'react';
|
|
2
|
+
|
|
3
|
+
export type RadioSize = 'md' | 'sm';
|
|
4
|
+
|
|
5
|
+
export interface RadioButtonProps
|
|
6
|
+
extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {
|
|
7
|
+
size?: RadioSize;
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type RadioFieldVariant = 'default' | 'card';
|
|
13
|
+
|
|
14
|
+
export interface RadioFieldProps extends RadioButtonProps {
|
|
15
|
+
label: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
variant?: RadioFieldVariant;
|
|
18
|
+
value?: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* ─── Root ─── */
|
|
2
|
+
.root {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: flex-start;
|
|
5
|
+
gap: var(--st-space-2);
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
user-select: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* ─── Content ─── */
|
|
11
|
+
.content {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
gap: var(--st-space-0);
|
|
15
|
+
padding-top: 1px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* ─── Label ─── */
|
|
19
|
+
.label {
|
|
20
|
+
font-family: var(--st-font-family);
|
|
21
|
+
font-size: var(--st-font-size-sm);
|
|
22
|
+
font-weight: var(--st-font-weight-medium);
|
|
23
|
+
line-height: var(--st-line-height-tight);
|
|
24
|
+
color: var(--st-color-foreground);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* ─── Description ─── */
|
|
28
|
+
.description {
|
|
29
|
+
font-family: var(--st-font-family);
|
|
30
|
+
font-size: var(--st-font-size-xs);
|
|
31
|
+
line-height: var(--st-line-height-normal);
|
|
32
|
+
color: var(--st-color-muted);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* ─── Card variant ─── */
|
|
36
|
+
.card {
|
|
37
|
+
border: 1px solid var(--st-color-border);
|
|
38
|
+
border-radius: var(--st-radius-xl);
|
|
39
|
+
padding: var(--st-space-3) var(--st-space-4);
|
|
40
|
+
transition:
|
|
41
|
+
border-color var(--st-transition-fast),
|
|
42
|
+
background-color var(--st-transition-fast);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.card:hover:not(.disabled):not(.readOnly) {
|
|
46
|
+
border-color: var(--st-color-border-strong);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.card:has(input:checked) {
|
|
50
|
+
border-color: var(--st-color-success);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.card:has(input:focus-visible) {
|
|
54
|
+
border-color: var(--st-color-success);
|
|
55
|
+
box-shadow: 0 0 0 2px var(--st-color-success);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* ─── Disabled ─── */
|
|
59
|
+
.disabled {
|
|
60
|
+
opacity: 0.5;
|
|
61
|
+
cursor: default;
|
|
62
|
+
pointer-events: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* ─── Read-only ─── */
|
|
66
|
+
.readOnly {
|
|
67
|
+
cursor: default;
|
|
68
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import { RadioButton } from './RadioButton';
|
|
4
|
+
import { useRadioGroup } from './RadioGroupContext';
|
|
5
|
+
import type { RadioFieldProps } from './RadioButton.types';
|
|
6
|
+
import styles from './RadioField.module.css';
|
|
7
|
+
|
|
8
|
+
export const RadioField = forwardRef<HTMLInputElement, RadioFieldProps>(
|
|
9
|
+
(
|
|
10
|
+
{
|
|
11
|
+
label,
|
|
12
|
+
description,
|
|
13
|
+
variant = 'default',
|
|
14
|
+
disabled = false,
|
|
15
|
+
readOnly = false,
|
|
16
|
+
size,
|
|
17
|
+
value,
|
|
18
|
+
className,
|
|
19
|
+
...rest
|
|
20
|
+
},
|
|
21
|
+
ref,
|
|
22
|
+
) => {
|
|
23
|
+
const group = useRadioGroup();
|
|
24
|
+
const isDisabled = disabled || group?.disabled || false;
|
|
25
|
+
const isReadOnly = readOnly || group?.readOnly || false;
|
|
26
|
+
|
|
27
|
+
const groupProps: Record<string, unknown> = {};
|
|
28
|
+
if (group) {
|
|
29
|
+
if (group.name) groupProps.name = group.name;
|
|
30
|
+
if (group.value !== undefined && value !== undefined) {
|
|
31
|
+
groupProps.checked = group.value === value;
|
|
32
|
+
}
|
|
33
|
+
if (group.onValueChange && value !== undefined) {
|
|
34
|
+
groupProps.onChange = () => group.onValueChange!(value);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<label
|
|
40
|
+
className={cn(
|
|
41
|
+
styles.root,
|
|
42
|
+
styles[variant],
|
|
43
|
+
isDisabled && styles.disabled,
|
|
44
|
+
isReadOnly && styles.readOnly,
|
|
45
|
+
className,
|
|
46
|
+
)}
|
|
47
|
+
>
|
|
48
|
+
<RadioButton
|
|
49
|
+
ref={ref}
|
|
50
|
+
disabled={isDisabled}
|
|
51
|
+
readOnly={isReadOnly}
|
|
52
|
+
size={size}
|
|
53
|
+
value={value}
|
|
54
|
+
{...groupProps}
|
|
55
|
+
{...rest}
|
|
56
|
+
/>
|
|
57
|
+
<span className={styles.content}>
|
|
58
|
+
<span className={styles.label}>{label}</span>
|
|
59
|
+
{description && (
|
|
60
|
+
<span className={styles.description}>{description}</span>
|
|
61
|
+
)}
|
|
62
|
+
</span>
|
|
63
|
+
</label>
|
|
64
|
+
);
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
RadioField.displayName = 'RadioField';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* ─── Root ─── */
|
|
2
|
+
.root {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: var(--st-space-3);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* ─── Group label ─── */
|
|
9
|
+
.label {
|
|
10
|
+
font-family: var(--st-font-family);
|
|
11
|
+
font-size: var(--st-font-size-sm);
|
|
12
|
+
font-weight: var(--st-font-weight-semibold);
|
|
13
|
+
line-height: var(--st-line-height-tight);
|
|
14
|
+
color: var(--st-color-foreground);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* ─── Items container ─── */
|
|
18
|
+
.items {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
gap: var(--st-space-3);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* ─── Helper text ─── */
|
|
25
|
+
.helperText {
|
|
26
|
+
font-family: var(--st-font-family);
|
|
27
|
+
font-size: var(--st-font-size-xs);
|
|
28
|
+
line-height: var(--st-line-height-normal);
|
|
29
|
+
color: var(--st-color-muted);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* ─── Error ─── */
|
|
33
|
+
.error {
|
|
34
|
+
display: inline-flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
gap: var(--st-space-1);
|
|
37
|
+
font-family: var(--st-font-family);
|
|
38
|
+
font-size: var(--st-font-size-xs);
|
|
39
|
+
line-height: var(--st-line-height-normal);
|
|
40
|
+
color: var(--st-color-error);
|
|
41
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { forwardRef, useMemo } from 'react';
|
|
3
|
+
import { cn } from '../../utils/cn';
|
|
4
|
+
import { RadioGroupContext } from './RadioGroupContext';
|
|
5
|
+
import styles from './RadioGroup.module.css';
|
|
6
|
+
|
|
7
|
+
export interface RadioGroupProps
|
|
8
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
9
|
+
label?: string;
|
|
10
|
+
helperText?: string;
|
|
11
|
+
error?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
readOnly?: boolean;
|
|
14
|
+
name?: string;
|
|
15
|
+
value?: string;
|
|
16
|
+
onValueChange?: (value: string) => void;
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(
|
|
21
|
+
(
|
|
22
|
+
{
|
|
23
|
+
label,
|
|
24
|
+
helperText,
|
|
25
|
+
error,
|
|
26
|
+
disabled = false,
|
|
27
|
+
readOnly = false,
|
|
28
|
+
name,
|
|
29
|
+
value,
|
|
30
|
+
onValueChange,
|
|
31
|
+
children,
|
|
32
|
+
className,
|
|
33
|
+
...rest
|
|
34
|
+
},
|
|
35
|
+
ref,
|
|
36
|
+
) => {
|
|
37
|
+
const ctx = useMemo(
|
|
38
|
+
() => ({ disabled, readOnly, name, value, onValueChange }),
|
|
39
|
+
[disabled, readOnly, name, value, onValueChange],
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<RadioGroupContext.Provider value={ctx}>
|
|
44
|
+
<div
|
|
45
|
+
ref={ref}
|
|
46
|
+
role="radiogroup"
|
|
47
|
+
aria-label={label}
|
|
48
|
+
className={cn(styles.root, className)}
|
|
49
|
+
{...rest}
|
|
50
|
+
>
|
|
51
|
+
{label && <span className={styles.label}>{label}</span>}
|
|
52
|
+
<div className={styles.items}>{children}</div>
|
|
53
|
+
{error && (
|
|
54
|
+
<span className={styles.error}>
|
|
55
|
+
<svg
|
|
56
|
+
width="8"
|
|
57
|
+
height="8"
|
|
58
|
+
viewBox="0 0 8 8"
|
|
59
|
+
fill="none"
|
|
60
|
+
aria-hidden="true"
|
|
61
|
+
>
|
|
62
|
+
<circle cx="4" cy="4" r="4" fill="currentColor" />
|
|
63
|
+
</svg>
|
|
64
|
+
{error}
|
|
65
|
+
</span>
|
|
66
|
+
)}
|
|
67
|
+
{!error && helperText && (
|
|
68
|
+
<span className={styles.helperText}>{helperText}</span>
|
|
69
|
+
)}
|
|
70
|
+
</div>
|
|
71
|
+
</RadioGroupContext.Provider>
|
|
72
|
+
);
|
|
73
|
+
},
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
RadioGroup.displayName = 'RadioGroup';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface RadioGroupContextValue {
|
|
4
|
+
disabled: boolean;
|
|
5
|
+
readOnly: boolean;
|
|
6
|
+
name?: string;
|
|
7
|
+
value?: string;
|
|
8
|
+
onValueChange?: (value: string) => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const RadioGroupContext =
|
|
12
|
+
createContext<RadioGroupContextValue | null>(null);
|
|
13
|
+
|
|
14
|
+
export function useRadioGroup(): RadioGroupContextValue | null {
|
|
15
|
+
return useContext(RadioGroupContext);
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { RadioButton } from './RadioButton';
|
|
2
|
+
export type {
|
|
3
|
+
RadioButtonProps,
|
|
4
|
+
RadioSize,
|
|
5
|
+
RadioFieldProps,
|
|
6
|
+
RadioFieldVariant,
|
|
7
|
+
} from './RadioButton.types';
|
|
8
|
+
|
|
9
|
+
export { RadioField } from './RadioField';
|
|
10
|
+
|
|
11
|
+
export { RadioGroup } from './RadioGroup';
|
|
12
|
+
export type { RadioGroupProps } from './RadioGroup';
|