@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,18 @@
|
|
|
1
|
+
.overlay {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0;
|
|
4
|
+
z-index: var(--st-z-modal);
|
|
5
|
+
background: var(--st-color-overlay);
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.panel {
|
|
12
|
+
width: 100%;
|
|
13
|
+
max-width: 480px;
|
|
14
|
+
background: var(--st-color-surface);
|
|
15
|
+
border-radius: var(--st-radius-xl);
|
|
16
|
+
box-shadow: var(--st-shadow-xl);
|
|
17
|
+
font-family: var(--st-font-family);
|
|
18
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { forwardRef, useEffect } from 'react';
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
import { cn } from '../../utils/cn';
|
|
4
|
+
import { DialogContext } from './DialogContext';
|
|
5
|
+
import type { DialogProps } from './Dialog.types';
|
|
6
|
+
import styles from './Dialog.module.css';
|
|
7
|
+
|
|
8
|
+
export const Dialog = forwardRef<HTMLDivElement, DialogProps>(
|
|
9
|
+
(
|
|
10
|
+
{
|
|
11
|
+
open,
|
|
12
|
+
onClose,
|
|
13
|
+
closeOnOverlayClick = true,
|
|
14
|
+
closeOnEscape = true,
|
|
15
|
+
className,
|
|
16
|
+
children,
|
|
17
|
+
...rest
|
|
18
|
+
},
|
|
19
|
+
ref
|
|
20
|
+
) => {
|
|
21
|
+
// Escape key handler
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!open || !closeOnEscape) return;
|
|
24
|
+
|
|
25
|
+
const handleKeyDown = (e: KeyboardEvent) => {
|
|
26
|
+
if (e.key === 'Escape') onClose();
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
30
|
+
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
31
|
+
}, [open, closeOnEscape, onClose]);
|
|
32
|
+
|
|
33
|
+
// Body scroll lock
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!open) return;
|
|
36
|
+
|
|
37
|
+
const prev = document.body.style.overflow;
|
|
38
|
+
document.body.style.overflow = 'hidden';
|
|
39
|
+
return () => {
|
|
40
|
+
document.body.style.overflow = prev;
|
|
41
|
+
};
|
|
42
|
+
}, [open]);
|
|
43
|
+
|
|
44
|
+
if (!open) return null;
|
|
45
|
+
|
|
46
|
+
return createPortal(
|
|
47
|
+
<div
|
|
48
|
+
className={styles.overlay}
|
|
49
|
+
onClick={closeOnOverlayClick ? onClose : undefined}
|
|
50
|
+
>
|
|
51
|
+
<DialogContext.Provider value={{ onClose }}>
|
|
52
|
+
<div
|
|
53
|
+
ref={ref}
|
|
54
|
+
role="dialog"
|
|
55
|
+
aria-modal="true"
|
|
56
|
+
className={cn(styles.panel, className)}
|
|
57
|
+
onClick={(e) => e.stopPropagation()}
|
|
58
|
+
{...rest}
|
|
59
|
+
>
|
|
60
|
+
{children}
|
|
61
|
+
</div>
|
|
62
|
+
</DialogContext.Provider>
|
|
63
|
+
</div>,
|
|
64
|
+
document.body
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
Dialog.displayName = 'Dialog';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export type DialogIconStatus = 'info' | 'warning' | 'success' | 'error';
|
|
4
|
+
|
|
5
|
+
export interface DialogProps
|
|
6
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, 'role'> {
|
|
7
|
+
/** Controls visibility */
|
|
8
|
+
open: boolean;
|
|
9
|
+
/** Called on overlay click, Escape, or close button */
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
/** Close when clicking overlay backdrop */
|
|
12
|
+
closeOnOverlayClick?: boolean;
|
|
13
|
+
/** Close when pressing Escape */
|
|
14
|
+
closeOnEscape?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface DialogHeaderProps
|
|
18
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
19
|
+
/** Leading icon slot */
|
|
20
|
+
icon?: ReactNode;
|
|
21
|
+
/** Bold title text */
|
|
22
|
+
title?: string;
|
|
23
|
+
/** Muted description below title */
|
|
24
|
+
description?: string;
|
|
25
|
+
/** `undefined` = use context from Dialog; `null` = hide close button */
|
|
26
|
+
onClose?: (() => void) | null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface DialogBodyProps extends HTMLAttributes<HTMLDivElement> {}
|
|
30
|
+
|
|
31
|
+
export type DialogFooterLayout = 'horizontal' | 'vertical';
|
|
32
|
+
|
|
33
|
+
export interface DialogFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
34
|
+
/** Stacking direction */
|
|
35
|
+
layout?: DialogFooterLayout;
|
|
36
|
+
/** Left-aligned link slot (horizontal) or top (vertical) */
|
|
37
|
+
link?: ReactNode;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface DialogIconProps extends HTMLAttributes<HTMLDivElement> {
|
|
41
|
+
/** Determines colors and default icon */
|
|
42
|
+
status: DialogIconStatus;
|
|
43
|
+
/** Custom icon override */
|
|
44
|
+
icon?: ReactNode;
|
|
45
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { DialogBodyProps } from './Dialog.types';
|
|
4
|
+
import styles from './DialogBody.module.css';
|
|
5
|
+
|
|
6
|
+
export const DialogBody = forwardRef<HTMLDivElement, DialogBodyProps>(
|
|
7
|
+
({ className, children, ...rest }, ref) => {
|
|
8
|
+
return (
|
|
9
|
+
<div ref={ref} className={cn(styles.root, className)} {...rest}>
|
|
10
|
+
{children}
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
DialogBody.displayName = 'DialogBody';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface DialogContextValue {
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const DialogContext = createContext<DialogContextValue | null>(null);
|
|
8
|
+
|
|
9
|
+
export function useDialog(): DialogContextValue | null {
|
|
10
|
+
return useContext(DialogContext);
|
|
11
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: flex;
|
|
3
|
+
gap: var(--st-space-3);
|
|
4
|
+
padding: 0 var(--st-space-6) var(--st-space-6);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/* ─── Horizontal layout ─── */
|
|
8
|
+
|
|
9
|
+
.horizontal {
|
|
10
|
+
align-items: center;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.horizontal .link {
|
|
14
|
+
flex-shrink: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.horizontal .actions {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
gap: var(--st-space-3);
|
|
21
|
+
margin-left: auto;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* ─── Vertical layout ─── */
|
|
25
|
+
|
|
26
|
+
.vertical {
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.vertical .actions {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
gap: var(--st-space-3);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.vertical .actions > * {
|
|
37
|
+
width: 100%;
|
|
38
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { DialogFooterProps } from './Dialog.types';
|
|
4
|
+
import styles from './DialogFooter.module.css';
|
|
5
|
+
|
|
6
|
+
export const DialogFooter = forwardRef<HTMLDivElement, DialogFooterProps>(
|
|
7
|
+
(
|
|
8
|
+
{
|
|
9
|
+
layout = 'horizontal',
|
|
10
|
+
link,
|
|
11
|
+
className,
|
|
12
|
+
children,
|
|
13
|
+
...rest
|
|
14
|
+
},
|
|
15
|
+
ref
|
|
16
|
+
) => {
|
|
17
|
+
return (
|
|
18
|
+
<div
|
|
19
|
+
ref={ref}
|
|
20
|
+
className={cn(styles.root, styles[layout], className)}
|
|
21
|
+
{...rest}
|
|
22
|
+
>
|
|
23
|
+
{link && <div className={styles.link}>{link}</div>}
|
|
24
|
+
<div className={styles.actions}>{children}</div>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
DialogFooter.displayName = 'DialogFooter';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: flex-start;
|
|
4
|
+
gap: var(--st-space-3);
|
|
5
|
+
padding: var(--st-space-6);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* ─── Icon ─── */
|
|
9
|
+
|
|
10
|
+
.icon {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
flex-shrink: 0;
|
|
14
|
+
color: var(--st-color-muted);
|
|
15
|
+
margin-top: 1px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* ─── Content ─── */
|
|
19
|
+
|
|
20
|
+
.content {
|
|
21
|
+
flex: 1;
|
|
22
|
+
min-width: 0;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
gap: 2px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.title {
|
|
29
|
+
font-size: var(--st-font-size-md);
|
|
30
|
+
font-weight: var(--st-font-weight-semibold);
|
|
31
|
+
line-height: var(--st-line-height-tight);
|
|
32
|
+
color: var(--st-color-foreground);
|
|
33
|
+
margin: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.description {
|
|
37
|
+
font-size: var(--st-font-size-sm);
|
|
38
|
+
line-height: var(--st-line-height-normal);
|
|
39
|
+
color: var(--st-color-muted);
|
|
40
|
+
margin: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* ─── Close button ─── */
|
|
44
|
+
|
|
45
|
+
.close {
|
|
46
|
+
flex-shrink: 0;
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
width: 24px;
|
|
51
|
+
height: 24px;
|
|
52
|
+
padding: 0;
|
|
53
|
+
border: none;
|
|
54
|
+
border-radius: var(--st-radius-sm);
|
|
55
|
+
background: transparent;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
opacity: 0.7;
|
|
58
|
+
transition: opacity var(--st-transition-fast);
|
|
59
|
+
color: var(--st-color-foreground);
|
|
60
|
+
margin-left: auto;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.close:hover {
|
|
64
|
+
opacity: 1;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.close:focus-visible {
|
|
68
|
+
outline: 2px solid var(--st-color-primary);
|
|
69
|
+
outline-offset: 2px;
|
|
70
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import { useDialog } from './DialogContext';
|
|
4
|
+
import type { DialogHeaderProps } from './Dialog.types';
|
|
5
|
+
import styles from './DialogHeader.module.css';
|
|
6
|
+
|
|
7
|
+
function CloseIcon() {
|
|
8
|
+
return (
|
|
9
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none">
|
|
10
|
+
<path
|
|
11
|
+
d="M4 4L12 12M12 4L4 12"
|
|
12
|
+
stroke="currentColor"
|
|
13
|
+
strokeWidth="1.5"
|
|
14
|
+
strokeLinecap="round"
|
|
15
|
+
/>
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const DialogHeader = forwardRef<HTMLDivElement, DialogHeaderProps>(
|
|
21
|
+
(
|
|
22
|
+
{
|
|
23
|
+
icon,
|
|
24
|
+
title,
|
|
25
|
+
description,
|
|
26
|
+
onClose,
|
|
27
|
+
className,
|
|
28
|
+
children,
|
|
29
|
+
...rest
|
|
30
|
+
},
|
|
31
|
+
ref
|
|
32
|
+
) => {
|
|
33
|
+
const ctx = useDialog();
|
|
34
|
+
// undefined = use context; null = hide; function = use directly
|
|
35
|
+
const closeHandler =
|
|
36
|
+
onClose === undefined ? ctx?.onClose : onClose ?? undefined;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
ref={ref}
|
|
41
|
+
className={cn(styles.root, className)}
|
|
42
|
+
{...rest}
|
|
43
|
+
>
|
|
44
|
+
{icon && <span className={styles.icon}>{icon}</span>}
|
|
45
|
+
|
|
46
|
+
{(title || description) && (
|
|
47
|
+
<div className={styles.content}>
|
|
48
|
+
{title && <p className={styles.title}>{title}</p>}
|
|
49
|
+
{description && (
|
|
50
|
+
<p className={styles.description}>{description}</p>
|
|
51
|
+
)}
|
|
52
|
+
</div>
|
|
53
|
+
)}
|
|
54
|
+
|
|
55
|
+
{children}
|
|
56
|
+
|
|
57
|
+
{closeHandler && (
|
|
58
|
+
<button
|
|
59
|
+
type="button"
|
|
60
|
+
className={styles.close}
|
|
61
|
+
onClick={closeHandler}
|
|
62
|
+
aria-label="Close dialog"
|
|
63
|
+
>
|
|
64
|
+
<CloseIcon />
|
|
65
|
+
</button>
|
|
66
|
+
)}
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
DialogHeader.displayName = 'DialogHeader';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
width: 40px;
|
|
6
|
+
height: 40px;
|
|
7
|
+
border-radius: var(--st-radius-full);
|
|
8
|
+
flex-shrink: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* ─── Status colors ─── */
|
|
12
|
+
|
|
13
|
+
.info {
|
|
14
|
+
background-color: var(--st-color-info-subtle);
|
|
15
|
+
color: var(--st-color-info);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.success {
|
|
19
|
+
background-color: var(--st-color-success-subtle);
|
|
20
|
+
color: var(--st-color-success);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.warning {
|
|
24
|
+
background-color: var(--st-color-warning-subtle);
|
|
25
|
+
color: var(--st-color-warning);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.error {
|
|
29
|
+
background-color: var(--st-color-error-subtle);
|
|
30
|
+
color: var(--st-color-error);
|
|
31
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { DialogIconProps, DialogIconStatus } from './Dialog.types';
|
|
4
|
+
import styles from './DialogIcon.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
|
+
const defaultIcons: Record<DialogIconStatus, JSX.Element> = {
|
|
69
|
+
info: <InfoIcon />,
|
|
70
|
+
success: <SuccessIcon />,
|
|
71
|
+
warning: <WarningIcon />,
|
|
72
|
+
error: <ErrorIcon />,
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const DialogIcon = forwardRef<HTMLDivElement, DialogIconProps>(
|
|
76
|
+
({ status, icon, className, ...rest }, ref) => {
|
|
77
|
+
return (
|
|
78
|
+
<div
|
|
79
|
+
ref={ref}
|
|
80
|
+
className={cn(styles.root, styles[status], className)}
|
|
81
|
+
{...rest}
|
|
82
|
+
>
|
|
83
|
+
{icon ?? defaultIcons[status]}
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
DialogIcon.displayName = 'DialogIcon';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { Dialog } from './Dialog';
|
|
2
|
+
export { DialogHeader } from './DialogHeader';
|
|
3
|
+
export { DialogBody } from './DialogBody';
|
|
4
|
+
export { DialogFooter } from './DialogFooter';
|
|
5
|
+
export { DialogIcon } from './DialogIcon';
|
|
6
|
+
export type {
|
|
7
|
+
DialogProps,
|
|
8
|
+
DialogHeaderProps,
|
|
9
|
+
DialogBodyProps,
|
|
10
|
+
DialogFooterProps,
|
|
11
|
+
DialogFooterLayout,
|
|
12
|
+
DialogIconProps,
|
|
13
|
+
DialogIconStatus,
|
|
14
|
+
} from './Dialog.types';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
flex-shrink: 0;
|
|
3
|
+
border: none;
|
|
4
|
+
background-color: var(--st-color-border);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/* ─── Horizontal ─── */
|
|
8
|
+
|
|
9
|
+
.horizontal {
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 1px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* ─── Vertical ─── */
|
|
15
|
+
|
|
16
|
+
.vertical {
|
|
17
|
+
align-self: stretch;
|
|
18
|
+
width: 1px;
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { DividerProps } from './Divider.types';
|
|
4
|
+
import styles from './Divider.module.css';
|
|
5
|
+
|
|
6
|
+
export const Divider = forwardRef<HTMLDivElement, DividerProps>(
|
|
7
|
+
({ orientation = 'horizontal', className, ...rest }, ref) => {
|
|
8
|
+
return (
|
|
9
|
+
<div
|
|
10
|
+
ref={ref}
|
|
11
|
+
role="separator"
|
|
12
|
+
aria-orientation={orientation}
|
|
13
|
+
className={cn(styles.root, styles[orientation], className)}
|
|
14
|
+
{...rest}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
Divider.displayName = 'Divider';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { DropdownMenuProps } from './DropdownMenu.types';
|
|
4
|
+
import styles from './DropdownMenu.module.css';
|
|
5
|
+
|
|
6
|
+
export const DropdownMenu = forwardRef<HTMLDivElement, DropdownMenuProps>(
|
|
7
|
+
({ className, children, ...rest }, ref) => {
|
|
8
|
+
return (
|
|
9
|
+
<div
|
|
10
|
+
ref={ref}
|
|
11
|
+
role="menu"
|
|
12
|
+
className={cn(styles.root, className)}
|
|
13
|
+
{...rest}
|
|
14
|
+
>
|
|
15
|
+
{children}
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
DropdownMenu.displayName = 'DropdownMenu';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface DropdownMenuProps
|
|
4
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, 'role'> {}
|
|
5
|
+
|
|
6
|
+
export interface DropdownMenuItemProps
|
|
7
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, 'role'> {
|
|
8
|
+
/** Leading icon slot */
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
/** Keyboard shortcut label (right-aligned, muted) */
|
|
11
|
+
shortcut?: string;
|
|
12
|
+
/** Custom trailing content (submenu chevron, switch, etc.) */
|
|
13
|
+
suffix?: ReactNode;
|
|
14
|
+
/** Disables the item */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface DropdownMenuHeaderProps
|
|
19
|
+
extends HTMLAttributes<HTMLDivElement> {}
|
|
20
|
+
|
|
21
|
+
export interface DropdownMenuDividerProps
|
|
22
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, 'role'> {}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { DropdownMenuDividerProps } from './DropdownMenu.types';
|
|
4
|
+
import styles from './DropdownMenuDivider.module.css';
|
|
5
|
+
|
|
6
|
+
export const DropdownMenuDivider = forwardRef<
|
|
7
|
+
HTMLDivElement,
|
|
8
|
+
DropdownMenuDividerProps
|
|
9
|
+
>(({ className, ...rest }, ref) => {
|
|
10
|
+
return (
|
|
11
|
+
<div
|
|
12
|
+
ref={ref}
|
|
13
|
+
role="separator"
|
|
14
|
+
className={cn(styles.root, className)}
|
|
15
|
+
{...rest}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
DropdownMenuDivider.displayName = 'DropdownMenuDivider';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { DropdownMenuHeaderProps } from './DropdownMenu.types';
|
|
4
|
+
import styles from './DropdownMenuHeader.module.css';
|
|
5
|
+
|
|
6
|
+
export const DropdownMenuHeader = forwardRef<
|
|
7
|
+
HTMLDivElement,
|
|
8
|
+
DropdownMenuHeaderProps
|
|
9
|
+
>(({ className, children, ...rest }, ref) => {
|
|
10
|
+
return (
|
|
11
|
+
<div ref={ref} className={cn(styles.root, className)} {...rest}>
|
|
12
|
+
{children}
|
|
13
|
+
</div>
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
DropdownMenuHeader.displayName = 'DropdownMenuHeader';
|