@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,87 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import type { KeyboardEvent } from 'react';
|
|
3
|
+
import { cn } from '../../utils/cn';
|
|
4
|
+
import { useTab } from './TabContext';
|
|
5
|
+
import type { TabItemProps } from './Tab.types';
|
|
6
|
+
import styles from './TabItem.module.css';
|
|
7
|
+
|
|
8
|
+
function CloseIcon() {
|
|
9
|
+
return (
|
|
10
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
|
|
11
|
+
<path
|
|
12
|
+
d="M9 3L3 9M3 3l6 6"
|
|
13
|
+
stroke="currentColor"
|
|
14
|
+
strokeWidth="1.5"
|
|
15
|
+
strokeLinecap="round"
|
|
16
|
+
strokeLinejoin="round"
|
|
17
|
+
/>
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const TabItem = forwardRef<HTMLDivElement, TabItemProps>(
|
|
23
|
+
({ value, icon, badge, onClose, disabled, className, children, ...rest }, ref) => {
|
|
24
|
+
const ctx = useTab();
|
|
25
|
+
const isActive = ctx.value === value;
|
|
26
|
+
const isDisabled = disabled || ctx.disabled;
|
|
27
|
+
const variant = ctx.variant;
|
|
28
|
+
|
|
29
|
+
const handleKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {
|
|
30
|
+
if (isDisabled) return;
|
|
31
|
+
|
|
32
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
ctx.onValueChange?.(value);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if ((e.key === 'Delete' || e.key === 'Backspace') && variant === 'dynamic' && onClose) {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
onClose();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
rest.onKeyDown?.(e);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div
|
|
47
|
+
ref={ref}
|
|
48
|
+
role="tab"
|
|
49
|
+
tabIndex={isDisabled ? -1 : 0}
|
|
50
|
+
aria-selected={isActive}
|
|
51
|
+
aria-disabled={isDisabled || undefined}
|
|
52
|
+
className={cn(
|
|
53
|
+
styles.item,
|
|
54
|
+
styles[variant],
|
|
55
|
+
isActive && styles.active,
|
|
56
|
+
isDisabled && styles.disabled,
|
|
57
|
+
className
|
|
58
|
+
)}
|
|
59
|
+
onClick={isDisabled ? undefined : () => ctx.onValueChange?.(value)}
|
|
60
|
+
onKeyDown={handleKeyDown}
|
|
61
|
+
{...rest}
|
|
62
|
+
>
|
|
63
|
+
{icon && <span className={styles.icon}>{icon}</span>}
|
|
64
|
+
<span className={styles.label}>{children}</span>
|
|
65
|
+
{badge != null && variant === 'basic' && (
|
|
66
|
+
<span className={styles.badge}>{badge}</span>
|
|
67
|
+
)}
|
|
68
|
+
{onClose && variant === 'dynamic' && (
|
|
69
|
+
<button
|
|
70
|
+
type="button"
|
|
71
|
+
tabIndex={-1}
|
|
72
|
+
className={cn(styles.close, isActive && styles.closeActive)}
|
|
73
|
+
onClick={(e) => {
|
|
74
|
+
e.stopPropagation();
|
|
75
|
+
if (!isDisabled) onClose();
|
|
76
|
+
}}
|
|
77
|
+
aria-label="Close tab"
|
|
78
|
+
>
|
|
79
|
+
<CloseIcon />
|
|
80
|
+
</button>
|
|
81
|
+
)}
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
TabItem.displayName = 'TabItem';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
font-family: var(--st-font-family);
|
|
3
|
+
border: 1px solid var(--st-color-border);
|
|
4
|
+
border-radius: var(--st-radius-xl);
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* ── Scroll wrapper ── */
|
|
9
|
+
|
|
10
|
+
.scrollWrapper {
|
|
11
|
+
overflow-x: auto;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* ── Table element ── */
|
|
15
|
+
|
|
16
|
+
.table {
|
|
17
|
+
width: 100%;
|
|
18
|
+
border-collapse: collapse;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* ── Size — sets cell vertical padding via custom property ── */
|
|
22
|
+
|
|
23
|
+
.sm {
|
|
24
|
+
--_table-cell-py: var(--st-space-2);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.md {
|
|
28
|
+
--_table-cell-py: var(--st-space-3);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.lg {
|
|
32
|
+
--_table-cell-py: var(--st-space-4);
|
|
33
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Children, forwardRef, isValidElement } from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import { cn } from '../../utils/cn';
|
|
4
|
+
import { TableContext } from './TableContext';
|
|
5
|
+
import type { TableProps } from './Table.types';
|
|
6
|
+
import styles from './Table.module.css';
|
|
7
|
+
|
|
8
|
+
export const Table = forwardRef<HTMLDivElement, TableProps>(
|
|
9
|
+
(
|
|
10
|
+
{
|
|
11
|
+
selectedRows = [],
|
|
12
|
+
onSelectionChange,
|
|
13
|
+
sortKey,
|
|
14
|
+
sortDirection,
|
|
15
|
+
onSortChange,
|
|
16
|
+
size = 'md',
|
|
17
|
+
striped = false,
|
|
18
|
+
className,
|
|
19
|
+
children,
|
|
20
|
+
...rest
|
|
21
|
+
},
|
|
22
|
+
ref
|
|
23
|
+
) => {
|
|
24
|
+
let toolbar: ReactNode = null;
|
|
25
|
+
let footer: ReactNode = null;
|
|
26
|
+
const tableContent: ReactNode[] = [];
|
|
27
|
+
|
|
28
|
+
Children.forEach(children, (child) => {
|
|
29
|
+
if (!isValidElement(child)) {
|
|
30
|
+
tableContent.push(child);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const displayName = (child.type as { displayName?: string })
|
|
35
|
+
.displayName;
|
|
36
|
+
|
|
37
|
+
if (displayName === 'TableToolbar') {
|
|
38
|
+
toolbar = child;
|
|
39
|
+
} else if (displayName === 'TableFooter') {
|
|
40
|
+
footer = child;
|
|
41
|
+
} else {
|
|
42
|
+
tableContent.push(child);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<TableContext.Provider
|
|
48
|
+
value={{
|
|
49
|
+
selectedRows,
|
|
50
|
+
onSelectionChange,
|
|
51
|
+
sortKey,
|
|
52
|
+
sortDirection,
|
|
53
|
+
onSortChange,
|
|
54
|
+
size,
|
|
55
|
+
striped,
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
<div
|
|
59
|
+
ref={ref}
|
|
60
|
+
className={cn(styles.root, styles[size], className)}
|
|
61
|
+
{...rest}
|
|
62
|
+
>
|
|
63
|
+
{toolbar}
|
|
64
|
+
<div className={styles.scrollWrapper}>
|
|
65
|
+
<table className={styles.table}>{tableContent}</table>
|
|
66
|
+
</div>
|
|
67
|
+
{footer}
|
|
68
|
+
</div>
|
|
69
|
+
</TableContext.Provider>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
Table.displayName = 'Table';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
HTMLAttributes,
|
|
3
|
+
TdHTMLAttributes,
|
|
4
|
+
ThHTMLAttributes,
|
|
5
|
+
} from 'react';
|
|
6
|
+
|
|
7
|
+
export type TableSortDirection = 'asc' | 'desc';
|
|
8
|
+
export type TableSize = 'sm' | 'md' | 'lg';
|
|
9
|
+
export type TableCellAlign = 'left' | 'center' | 'right';
|
|
10
|
+
|
|
11
|
+
export interface TableProps extends HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
/** IDs of currently selected rows. */
|
|
13
|
+
selectedRows?: string[];
|
|
14
|
+
/** Callback when selection changes. */
|
|
15
|
+
onSelectionChange?: (rows: string[]) => void;
|
|
16
|
+
/** Currently sorted column key. */
|
|
17
|
+
sortKey?: string;
|
|
18
|
+
/** Current sort direction. */
|
|
19
|
+
sortDirection?: TableSortDirection;
|
|
20
|
+
/** Callback when sort changes. */
|
|
21
|
+
onSortChange?: (key: string, direction: TableSortDirection) => void;
|
|
22
|
+
/** Row density. */
|
|
23
|
+
size?: TableSize;
|
|
24
|
+
/** Alternate row backgrounds. */
|
|
25
|
+
striped?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface TableToolbarProps extends HTMLAttributes<HTMLDivElement> {}
|
|
29
|
+
|
|
30
|
+
export interface TableHeaderProps
|
|
31
|
+
extends HTMLAttributes<HTMLTableSectionElement> {}
|
|
32
|
+
|
|
33
|
+
export interface TableBodyProps
|
|
34
|
+
extends HTMLAttributes<HTMLTableSectionElement> {}
|
|
35
|
+
|
|
36
|
+
export interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {
|
|
37
|
+
/** Unique ID for selection tracking. */
|
|
38
|
+
rowId?: string;
|
|
39
|
+
/** Disable interaction. */
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface TableHeaderCellProps
|
|
44
|
+
extends ThHTMLAttributes<HTMLTableCellElement> {
|
|
45
|
+
/** Makes the header sortable; value is the sort key. */
|
|
46
|
+
sortKey?: string;
|
|
47
|
+
/** Fixed width. */
|
|
48
|
+
width?: string;
|
|
49
|
+
/** Text alignment. */
|
|
50
|
+
align?: TableCellAlign;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface TableCellProps
|
|
54
|
+
extends TdHTMLAttributes<HTMLTableCellElement> {
|
|
55
|
+
/** Text alignment. */
|
|
56
|
+
align?: TableCellAlign;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type TableFooterAlign = 'left' | 'center' | 'right' | 'between';
|
|
60
|
+
|
|
61
|
+
export interface TableFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
62
|
+
/** Horizontal alignment of footer children. */
|
|
63
|
+
align?: TableFooterAlign;
|
|
64
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import { useTable } from './TableContext';
|
|
4
|
+
import type { TableBodyProps } from './Table.types';
|
|
5
|
+
import rowStyles from './TableRow.module.css';
|
|
6
|
+
|
|
7
|
+
export const TableBody = forwardRef<HTMLTableSectionElement, TableBodyProps>(
|
|
8
|
+
({ className, children, ...rest }, ref) => {
|
|
9
|
+
const { striped } = useTable();
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<tbody
|
|
13
|
+
ref={ref}
|
|
14
|
+
className={cn(striped && rowStyles.striped, className)}
|
|
15
|
+
{...rest}
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
18
|
+
</tbody>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
TableBody.displayName = 'TableBody';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
padding: var(--_table-cell-py) var(--st-space-4);
|
|
3
|
+
font-size: var(--st-font-size-sm);
|
|
4
|
+
color: var(--st-color-foreground);
|
|
5
|
+
line-height: var(--st-line-height-normal);
|
|
6
|
+
vertical-align: middle;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* ── Alignment ── */
|
|
10
|
+
|
|
11
|
+
.left {
|
|
12
|
+
text-align: left;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.center {
|
|
16
|
+
text-align: center;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.right {
|
|
20
|
+
text-align: right;
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { TableCellProps } from './Table.types';
|
|
4
|
+
import styles from './TableCell.module.css';
|
|
5
|
+
|
|
6
|
+
export const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(
|
|
7
|
+
({ align = 'left', className, children, ...rest }, ref) => {
|
|
8
|
+
return (
|
|
9
|
+
<td
|
|
10
|
+
ref={ref}
|
|
11
|
+
className={cn(styles.root, styles[align], className)}
|
|
12
|
+
{...rest}
|
|
13
|
+
>
|
|
14
|
+
{children}
|
|
15
|
+
</td>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
TableCell.displayName = 'TableCell';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
import type { TableSortDirection, TableSize } from './Table.types';
|
|
3
|
+
|
|
4
|
+
export interface TableContextValue {
|
|
5
|
+
selectedRows: string[];
|
|
6
|
+
onSelectionChange?: (rows: string[]) => void;
|
|
7
|
+
sortKey?: string;
|
|
8
|
+
sortDirection?: TableSortDirection;
|
|
9
|
+
onSortChange?: (key: string, direction: TableSortDirection) => void;
|
|
10
|
+
size: TableSize;
|
|
11
|
+
striped: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const TableContext = createContext<TableContextValue | null>(null);
|
|
15
|
+
|
|
16
|
+
export function useTable(): TableContextValue {
|
|
17
|
+
const ctx = useContext(TableContext);
|
|
18
|
+
if (!ctx) {
|
|
19
|
+
throw new Error('Table sub-components must be used within a <Table>');
|
|
20
|
+
}
|
|
21
|
+
return ctx;
|
|
22
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: var(--st-space-3);
|
|
5
|
+
padding: var(--st-space-3) var(--st-space-4);
|
|
6
|
+
border-top: 1px solid var(--st-color-border);
|
|
7
|
+
font-size: var(--st-font-size-sm);
|
|
8
|
+
color: var(--st-color-muted);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* ── Alignment ── */
|
|
12
|
+
|
|
13
|
+
.left {
|
|
14
|
+
justify-content: flex-start;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.center {
|
|
18
|
+
justify-content: center;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.right {
|
|
22
|
+
justify-content: flex-end;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.between {
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { TableFooterProps } from './Table.types';
|
|
4
|
+
import styles from './TableFooter.module.css';
|
|
5
|
+
|
|
6
|
+
export const TableFooter = forwardRef<HTMLDivElement, TableFooterProps>(
|
|
7
|
+
({ align = 'between', className, children, ...rest }, ref) => {
|
|
8
|
+
return (
|
|
9
|
+
<div
|
|
10
|
+
ref={ref}
|
|
11
|
+
className={cn(styles.root, styles[align], className)}
|
|
12
|
+
{...rest}
|
|
13
|
+
>
|
|
14
|
+
{children}
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
TableFooter.displayName = 'TableFooter';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { TableHeaderProps } from './Table.types';
|
|
4
|
+
import styles from './TableHeader.module.css';
|
|
5
|
+
|
|
6
|
+
export const TableHeader = forwardRef<
|
|
7
|
+
HTMLTableSectionElement,
|
|
8
|
+
TableHeaderProps
|
|
9
|
+
>(({ className, children, ...rest }, ref) => {
|
|
10
|
+
return (
|
|
11
|
+
<thead ref={ref} className={cn(styles.root, className)} {...rest}>
|
|
12
|
+
{children}
|
|
13
|
+
</thead>
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
TableHeader.displayName = 'TableHeader';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
padding: var(--_table-cell-py) var(--st-space-4);
|
|
3
|
+
font-size: var(--st-font-size-xs);
|
|
4
|
+
font-weight: var(--st-font-weight-semibold);
|
|
5
|
+
color: var(--st-color-muted);
|
|
6
|
+
white-space: nowrap;
|
|
7
|
+
user-select: none;
|
|
8
|
+
border-bottom: 1px solid var(--st-color-border);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* ── Alignment ── */
|
|
12
|
+
|
|
13
|
+
.left {
|
|
14
|
+
text-align: left;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.center {
|
|
18
|
+
text-align: center;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.right {
|
|
22
|
+
text-align: right;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* ── Content wrapper ── */
|
|
26
|
+
|
|
27
|
+
.content {
|
|
28
|
+
display: inline-flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
gap: var(--st-space-1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* ── Sort icon ── */
|
|
34
|
+
|
|
35
|
+
.sortIcon {
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
flex-shrink: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* ── Sortable ── */
|
|
41
|
+
|
|
42
|
+
.sortable {
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.sortable:hover {
|
|
47
|
+
background: var(--st-color-neutral-100);
|
|
48
|
+
color: var(--st-color-foreground);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* ── Active sort ── */
|
|
52
|
+
|
|
53
|
+
.active {
|
|
54
|
+
color: var(--st-color-foreground);
|
|
55
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import { useTable } from './TableContext';
|
|
4
|
+
import type { TableHeaderCellProps } from './Table.types';
|
|
5
|
+
import type { TableSortDirection } from './Table.types';
|
|
6
|
+
import styles from './TableHeaderCell.module.css';
|
|
7
|
+
|
|
8
|
+
function SortIcon({ direction }: { direction?: TableSortDirection }) {
|
|
9
|
+
return (
|
|
10
|
+
<svg
|
|
11
|
+
width="16"
|
|
12
|
+
height="16"
|
|
13
|
+
viewBox="0 0 16 16"
|
|
14
|
+
fill="none"
|
|
15
|
+
aria-hidden="true"
|
|
16
|
+
>
|
|
17
|
+
<path
|
|
18
|
+
d="M8 3L11 7H5L8 3Z"
|
|
19
|
+
fill={
|
|
20
|
+
direction === 'asc'
|
|
21
|
+
? 'currentColor'
|
|
22
|
+
: 'var(--st-color-neutral-300)'
|
|
23
|
+
}
|
|
24
|
+
/>
|
|
25
|
+
<path
|
|
26
|
+
d="M8 13L5 9H11L8 13Z"
|
|
27
|
+
fill={
|
|
28
|
+
direction === 'desc'
|
|
29
|
+
? 'currentColor'
|
|
30
|
+
: 'var(--st-color-neutral-300)'
|
|
31
|
+
}
|
|
32
|
+
/>
|
|
33
|
+
</svg>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const TableHeaderCell = forwardRef<
|
|
38
|
+
HTMLTableCellElement,
|
|
39
|
+
TableHeaderCellProps
|
|
40
|
+
>(
|
|
41
|
+
(
|
|
42
|
+
{ sortKey, width, align = 'left', className, children, style, ...rest },
|
|
43
|
+
ref
|
|
44
|
+
) => {
|
|
45
|
+
const { sortKey: activeSortKey, sortDirection, onSortChange } = useTable();
|
|
46
|
+
const sortable = !!sortKey;
|
|
47
|
+
const isActive = sortable && sortKey === activeSortKey;
|
|
48
|
+
const activeDirection = isActive ? sortDirection : undefined;
|
|
49
|
+
|
|
50
|
+
function handleClick() {
|
|
51
|
+
if (!sortable || !onSortChange || !sortKey) return;
|
|
52
|
+
|
|
53
|
+
let nextDirection: TableSortDirection = 'asc';
|
|
54
|
+
if (isActive && sortDirection === 'asc') {
|
|
55
|
+
nextDirection = 'desc';
|
|
56
|
+
} else if (isActive && sortDirection === 'desc') {
|
|
57
|
+
nextDirection = 'asc';
|
|
58
|
+
}
|
|
59
|
+
onSortChange(sortKey, nextDirection);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const ariaSortValue = isActive
|
|
63
|
+
? sortDirection === 'asc'
|
|
64
|
+
? 'ascending'
|
|
65
|
+
: 'descending'
|
|
66
|
+
: sortable
|
|
67
|
+
? 'none'
|
|
68
|
+
: undefined;
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<th
|
|
72
|
+
ref={ref}
|
|
73
|
+
className={cn(
|
|
74
|
+
styles.root,
|
|
75
|
+
styles[align],
|
|
76
|
+
sortable && styles.sortable,
|
|
77
|
+
isActive && styles.active,
|
|
78
|
+
className
|
|
79
|
+
)}
|
|
80
|
+
style={{ width, ...style }}
|
|
81
|
+
onClick={sortable ? handleClick : undefined}
|
|
82
|
+
aria-sort={ariaSortValue}
|
|
83
|
+
{...rest}
|
|
84
|
+
>
|
|
85
|
+
<span className={styles.content}>
|
|
86
|
+
{children}
|
|
87
|
+
{sortable && (
|
|
88
|
+
<span className={styles.sortIcon}>
|
|
89
|
+
<SortIcon direction={activeDirection} />
|
|
90
|
+
</span>
|
|
91
|
+
)}
|
|
92
|
+
</span>
|
|
93
|
+
</th>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
TableHeaderCell.displayName = 'TableHeaderCell';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
border-bottom: 1px solid var(--st-color-border);
|
|
3
|
+
transition: background-color var(--st-transition-fast);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.root:hover {
|
|
7
|
+
background-color: var(--st-color-neutral-50);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* ── Selected ── */
|
|
11
|
+
|
|
12
|
+
.selected {
|
|
13
|
+
background-color: color-mix(
|
|
14
|
+
in srgb,
|
|
15
|
+
var(--st-color-primary) 6%,
|
|
16
|
+
var(--st-color-background)
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.selected:hover {
|
|
21
|
+
background-color: color-mix(
|
|
22
|
+
in srgb,
|
|
23
|
+
var(--st-color-primary) 10%,
|
|
24
|
+
var(--st-color-background)
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* ── Disabled ── */
|
|
29
|
+
|
|
30
|
+
.disabled {
|
|
31
|
+
opacity: 0.5;
|
|
32
|
+
pointer-events: none;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* ── Last row in tbody: no double border ── */
|
|
36
|
+
|
|
37
|
+
tbody > .root:last-child {
|
|
38
|
+
border-bottom: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* ── Striped rows ── */
|
|
42
|
+
|
|
43
|
+
tbody.striped > .root:nth-child(even) {
|
|
44
|
+
background-color: var(--st-color-neutral-50);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
tbody.striped > .root.selected:nth-child(even) {
|
|
48
|
+
background-color: color-mix(
|
|
49
|
+
in srgb,
|
|
50
|
+
var(--st-color-primary) 6%,
|
|
51
|
+
var(--st-color-background)
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import { useTable } from './TableContext';
|
|
4
|
+
import type { TableRowProps } from './Table.types';
|
|
5
|
+
import styles from './TableRow.module.css';
|
|
6
|
+
|
|
7
|
+
export const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(
|
|
8
|
+
({ rowId, disabled = false, className, children, ...rest }, ref) => {
|
|
9
|
+
const { selectedRows } = useTable();
|
|
10
|
+
const isSelected = !!rowId && selectedRows.includes(rowId);
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<tr
|
|
14
|
+
ref={ref}
|
|
15
|
+
className={cn(
|
|
16
|
+
styles.root,
|
|
17
|
+
isSelected && styles.selected,
|
|
18
|
+
disabled && styles.disabled,
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
aria-selected={isSelected || undefined}
|
|
22
|
+
aria-disabled={disabled || undefined}
|
|
23
|
+
{...rest}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</tr>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
TableRow.displayName = 'TableRow';
|