@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,173 @@
|
|
|
1
|
+
import { forwardRef, useState, useCallback } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import { Calendar } from './Calendar';
|
|
4
|
+
import { Button } from '../Button/Button';
|
|
5
|
+
import type { CalendarDialogProps, DateRange } from './CalendarDialog.types';
|
|
6
|
+
import styles from './CalendarDialog.module.css';
|
|
7
|
+
|
|
8
|
+
export const CalendarDialog = forwardRef<HTMLDivElement, CalendarDialogProps>(
|
|
9
|
+
(
|
|
10
|
+
{
|
|
11
|
+
mode = 'basic',
|
|
12
|
+
defaultValue,
|
|
13
|
+
defaultRange,
|
|
14
|
+
headerAlign = 'center',
|
|
15
|
+
events,
|
|
16
|
+
minDate,
|
|
17
|
+
maxDate,
|
|
18
|
+
onCancel,
|
|
19
|
+
onDone,
|
|
20
|
+
className,
|
|
21
|
+
...rest
|
|
22
|
+
},
|
|
23
|
+
ref
|
|
24
|
+
) => {
|
|
25
|
+
const today = new Date();
|
|
26
|
+
|
|
27
|
+
/* ── Basic mode state ── */
|
|
28
|
+
const [selectedDate, setSelectedDate] = useState<Date | null>(
|
|
29
|
+
defaultValue ?? null
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
/* ── Range mode state ── */
|
|
33
|
+
const [rangeStart, setRangeStart] = useState<Date | null>(
|
|
34
|
+
defaultRange?.start ?? null
|
|
35
|
+
);
|
|
36
|
+
const [rangeEnd, setRangeEnd] = useState<Date | null>(
|
|
37
|
+
defaultRange?.end ?? null
|
|
38
|
+
);
|
|
39
|
+
const [rangeStep, setRangeStep] = useState<'start' | 'end'>('start');
|
|
40
|
+
|
|
41
|
+
/* ── Navigation (left calendar) ── */
|
|
42
|
+
const [leftMonth, setLeftMonth] = useState(
|
|
43
|
+
() =>
|
|
44
|
+
defaultRange?.start?.getMonth() ??
|
|
45
|
+
defaultValue?.getMonth() ??
|
|
46
|
+
today.getMonth()
|
|
47
|
+
);
|
|
48
|
+
const [leftYear, setLeftYear] = useState(
|
|
49
|
+
() =>
|
|
50
|
+
defaultRange?.start?.getFullYear() ??
|
|
51
|
+
defaultValue?.getFullYear() ??
|
|
52
|
+
today.getFullYear()
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
// Right calendar is always the next month
|
|
56
|
+
const rightMonth = leftMonth === 11 ? 0 : leftMonth + 1;
|
|
57
|
+
const rightYear = leftMonth === 11 ? leftYear + 1 : leftYear;
|
|
58
|
+
|
|
59
|
+
/* ── Handlers ── */
|
|
60
|
+
|
|
61
|
+
const handleBasicSelect = useCallback((date: Date) => {
|
|
62
|
+
setSelectedDate(date);
|
|
63
|
+
}, []);
|
|
64
|
+
|
|
65
|
+
const handleRangeSelect = useCallback(
|
|
66
|
+
(date: Date) => {
|
|
67
|
+
if (rangeStep === 'start') {
|
|
68
|
+
setRangeStart(date);
|
|
69
|
+
setRangeEnd(null);
|
|
70
|
+
setRangeStep('end');
|
|
71
|
+
} else {
|
|
72
|
+
// Ensure start ≤ end
|
|
73
|
+
if (rangeStart && date.getTime() < rangeStart.getTime()) {
|
|
74
|
+
setRangeEnd(rangeStart);
|
|
75
|
+
setRangeStart(date);
|
|
76
|
+
} else {
|
|
77
|
+
setRangeEnd(date);
|
|
78
|
+
}
|
|
79
|
+
setRangeStep('start');
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
[rangeStep, rangeStart]
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
const handleDone = useCallback(() => {
|
|
86
|
+
if (mode === 'basic') {
|
|
87
|
+
onDone?.(selectedDate);
|
|
88
|
+
} else if (rangeStart && rangeEnd) {
|
|
89
|
+
onDone?.({ start: rangeStart, end: rangeEnd } as DateRange);
|
|
90
|
+
}
|
|
91
|
+
}, [mode, selectedDate, rangeStart, rangeEnd, onDone]);
|
|
92
|
+
|
|
93
|
+
const dayCount =
|
|
94
|
+
rangeStart && rangeEnd
|
|
95
|
+
? Math.round(
|
|
96
|
+
Math.abs(rangeEnd.getTime() - rangeStart.getTime()) /
|
|
97
|
+
(1000 * 60 * 60 * 24)
|
|
98
|
+
) + 1
|
|
99
|
+
: 0;
|
|
100
|
+
|
|
101
|
+
const isDoneDisabled =
|
|
102
|
+
mode === 'basic' ? !selectedDate : !(rangeStart && rangeEnd);
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<div ref={ref} className={cn(styles.root, className)} {...rest}>
|
|
106
|
+
<div className={styles.calendars}>
|
|
107
|
+
<Calendar
|
|
108
|
+
month={leftMonth}
|
|
109
|
+
year={leftYear}
|
|
110
|
+
value={mode === 'basic' ? selectedDate : undefined}
|
|
111
|
+
rangeStart={mode === 'range' ? rangeStart : undefined}
|
|
112
|
+
rangeEnd={mode === 'range' ? rangeEnd : undefined}
|
|
113
|
+
headerAlign={headerAlign}
|
|
114
|
+
events={events}
|
|
115
|
+
minDate={minDate}
|
|
116
|
+
maxDate={maxDate}
|
|
117
|
+
onDateSelect={
|
|
118
|
+
mode === 'basic' ? handleBasicSelect : handleRangeSelect
|
|
119
|
+
}
|
|
120
|
+
onMonthChange={(m, y) => {
|
|
121
|
+
setLeftMonth(m);
|
|
122
|
+
setLeftYear(y);
|
|
123
|
+
}}
|
|
124
|
+
/>
|
|
125
|
+
|
|
126
|
+
{mode === 'range' && (
|
|
127
|
+
<Calendar
|
|
128
|
+
month={rightMonth}
|
|
129
|
+
year={rightYear}
|
|
130
|
+
rangeStart={rangeStart}
|
|
131
|
+
rangeEnd={rangeEnd}
|
|
132
|
+
headerAlign={headerAlign}
|
|
133
|
+
events={events}
|
|
134
|
+
minDate={minDate}
|
|
135
|
+
maxDate={maxDate}
|
|
136
|
+
onDateSelect={handleRangeSelect}
|
|
137
|
+
onMonthChange={(m, y) => {
|
|
138
|
+
// Keep left = right − 1
|
|
139
|
+
if (m === 0) {
|
|
140
|
+
setLeftMonth(11);
|
|
141
|
+
setLeftYear(y - 1);
|
|
142
|
+
} else {
|
|
143
|
+
setLeftMonth(m - 1);
|
|
144
|
+
setLeftYear(y);
|
|
145
|
+
}
|
|
146
|
+
}}
|
|
147
|
+
/>
|
|
148
|
+
)}
|
|
149
|
+
</div>
|
|
150
|
+
|
|
151
|
+
{mode === 'range' && dayCount > 0 && (
|
|
152
|
+
<p className={styles.rangeInfo}>{dayCount} days selected</p>
|
|
153
|
+
)}
|
|
154
|
+
|
|
155
|
+
<div className={styles.actions}>
|
|
156
|
+
<Button variant="outline" size="md" onClick={onCancel}>
|
|
157
|
+
Cancel
|
|
158
|
+
</Button>
|
|
159
|
+
<Button
|
|
160
|
+
variant="fill"
|
|
161
|
+
size="md"
|
|
162
|
+
onClick={handleDone}
|
|
163
|
+
disabled={isDoneDisabled}
|
|
164
|
+
>
|
|
165
|
+
Done
|
|
166
|
+
</Button>
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
CalendarDialog.displayName = 'CalendarDialog';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
import type { CalendarHeaderAlign } from './Calendar.types';
|
|
3
|
+
|
|
4
|
+
export type CalendarDialogMode = 'basic' | 'range';
|
|
5
|
+
|
|
6
|
+
export interface DateRange {
|
|
7
|
+
start: Date;
|
|
8
|
+
end: Date;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface CalendarDialogProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue'> {
|
|
12
|
+
/** Single calendar or side-by-side range picker. */
|
|
13
|
+
mode?: CalendarDialogMode;
|
|
14
|
+
/** Initial selected date (basic mode). */
|
|
15
|
+
defaultValue?: Date | null;
|
|
16
|
+
/** Initial date range (range mode). */
|
|
17
|
+
defaultRange?: DateRange | null;
|
|
18
|
+
/** Header alignment passed to inner Calendar(s). */
|
|
19
|
+
headerAlign?: CalendarHeaderAlign;
|
|
20
|
+
/** Dates that display an event indicator dot. */
|
|
21
|
+
events?: Date[];
|
|
22
|
+
/** Minimum selectable date. */
|
|
23
|
+
minDate?: Date;
|
|
24
|
+
/** Maximum selectable date. */
|
|
25
|
+
maxDate?: Date;
|
|
26
|
+
/** Called when Cancel is clicked. */
|
|
27
|
+
onCancel?: () => void;
|
|
28
|
+
/** Called when Done is clicked. Returns Date (basic) or DateRange (range). */
|
|
29
|
+
onDone?: (value: Date | DateRange | null) => void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Calendar } from './Calendar';
|
|
2
|
+
export type { CalendarProps, CalendarHeaderAlign } from './Calendar.types';
|
|
3
|
+
|
|
4
|
+
export { CalendarDialog } from './CalendarDialog';
|
|
5
|
+
export type {
|
|
6
|
+
CalendarDialogProps,
|
|
7
|
+
CalendarDialogMode,
|
|
8
|
+
DateRange,
|
|
9
|
+
} from './CalendarDialog.types';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
font-family: var(--st-font-family);
|
|
3
|
+
border-radius: var(--st-radius-xl);
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/* ── Variants ── */
|
|
8
|
+
|
|
9
|
+
.outline {
|
|
10
|
+
background: var(--st-color-surface);
|
|
11
|
+
border: 1px solid var(--st-color-border);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.elevated {
|
|
15
|
+
background: var(--st-color-surface);
|
|
16
|
+
box-shadow: var(--st-shadow-md);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.filled {
|
|
20
|
+
background: var(--st-color-surface-raised);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* ── Padding (simple cards without sub-components) ── */
|
|
24
|
+
|
|
25
|
+
.padSm {
|
|
26
|
+
padding: var(--st-space-4);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.padMd {
|
|
30
|
+
padding: var(--st-space-5);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.padLg {
|
|
34
|
+
padding: var(--st-space-6);
|
|
35
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { CardProps } from './Card.types';
|
|
4
|
+
import styles from './Card.module.css';
|
|
5
|
+
|
|
6
|
+
export const Card = forwardRef<HTMLDivElement, CardProps>(
|
|
7
|
+
(
|
|
8
|
+
{
|
|
9
|
+
variant = 'outline',
|
|
10
|
+
padding = 'none',
|
|
11
|
+
className,
|
|
12
|
+
children,
|
|
13
|
+
...rest
|
|
14
|
+
},
|
|
15
|
+
ref
|
|
16
|
+
) => {
|
|
17
|
+
return (
|
|
18
|
+
<div
|
|
19
|
+
ref={ref}
|
|
20
|
+
className={cn(
|
|
21
|
+
styles.root,
|
|
22
|
+
styles[variant],
|
|
23
|
+
padding === 'sm' && styles.padSm,
|
|
24
|
+
padding === 'md' && styles.padMd,
|
|
25
|
+
padding === 'lg' && styles.padLg,
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...rest}
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
Card.displayName = 'Card';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export type CardVariant = 'outline' | 'elevated' | 'filled';
|
|
4
|
+
export type CardPadding = 'none' | 'sm' | 'md' | 'lg';
|
|
5
|
+
|
|
6
|
+
export interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
/** Visual style. */
|
|
8
|
+
variant?: CardVariant;
|
|
9
|
+
/** Shorthand padding for simple cards (use sub-components for structured cards). */
|
|
10
|
+
padding?: CardPadding;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type CardHeaderSize = 'sm' | 'md' | 'lg';
|
|
14
|
+
|
|
15
|
+
export interface CardHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
16
|
+
/** Header title text or node. */
|
|
17
|
+
title?: ReactNode;
|
|
18
|
+
/** Optional leading icon. */
|
|
19
|
+
icon?: ReactNode;
|
|
20
|
+
/** Right-aligned action area (buttons, selects, etc.). */
|
|
21
|
+
action?: ReactNode;
|
|
22
|
+
/** Show bottom border separator. */
|
|
23
|
+
border?: boolean;
|
|
24
|
+
/** Vertical density. */
|
|
25
|
+
size?: CardHeaderSize;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface CardContentProps extends HTMLAttributes<HTMLDivElement> {}
|
|
29
|
+
|
|
30
|
+
export type CardFooterAlign = 'left' | 'center' | 'right' | 'between';
|
|
31
|
+
|
|
32
|
+
export interface CardFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
33
|
+
/** Show top border separator. */
|
|
34
|
+
border?: boolean;
|
|
35
|
+
/** Horizontal alignment of footer children. */
|
|
36
|
+
align?: CardFooterAlign;
|
|
37
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { CardContentProps } from './Card.types';
|
|
4
|
+
import styles from './CardContent.module.css';
|
|
5
|
+
|
|
6
|
+
export const CardContent = forwardRef<HTMLDivElement, CardContentProps>(
|
|
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
|
+
CardContent.displayName = 'CardContent';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: var(--st-space-3);
|
|
5
|
+
padding: 0 var(--st-space-5) var(--st-space-5);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* ── Border ── */
|
|
9
|
+
|
|
10
|
+
.border {
|
|
11
|
+
border-top: 1px solid var(--st-color-border);
|
|
12
|
+
padding-top: var(--st-space-4);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* ── Alignment ── */
|
|
16
|
+
|
|
17
|
+
.left {
|
|
18
|
+
justify-content: flex-start;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.center {
|
|
22
|
+
justify-content: center;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.right {
|
|
26
|
+
justify-content: flex-end;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.between {
|
|
30
|
+
justify-content: space-between;
|
|
31
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { CardFooterProps } from './Card.types';
|
|
4
|
+
import styles from './CardFooter.module.css';
|
|
5
|
+
|
|
6
|
+
export const CardFooter = forwardRef<HTMLDivElement, CardFooterProps>(
|
|
7
|
+
(
|
|
8
|
+
{
|
|
9
|
+
border = false,
|
|
10
|
+
align = 'right',
|
|
11
|
+
className,
|
|
12
|
+
children,
|
|
13
|
+
...rest
|
|
14
|
+
},
|
|
15
|
+
ref
|
|
16
|
+
) => {
|
|
17
|
+
return (
|
|
18
|
+
<div
|
|
19
|
+
ref={ref}
|
|
20
|
+
className={cn(
|
|
21
|
+
styles.root,
|
|
22
|
+
styles[align],
|
|
23
|
+
border && styles.border,
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
{...rest}
|
|
27
|
+
>
|
|
28
|
+
{children}
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
CardFooter.displayName = 'CardFooter';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
gap: var(--st-space-3);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* ── Sizes ── */
|
|
9
|
+
|
|
10
|
+
.sm {
|
|
11
|
+
padding: var(--st-space-2) var(--st-space-4);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.md {
|
|
15
|
+
padding: var(--st-space-4) var(--st-space-5);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.lg {
|
|
19
|
+
padding: var(--st-space-5) var(--st-space-6);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* ── Border ── */
|
|
23
|
+
|
|
24
|
+
.border {
|
|
25
|
+
border-bottom: 1px solid var(--st-color-border);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* ── Title area ── */
|
|
29
|
+
|
|
30
|
+
.titleWrap {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
gap: var(--st-space-2);
|
|
34
|
+
min-width: 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.icon {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
flex-shrink: 0;
|
|
41
|
+
color: var(--st-color-muted);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.title {
|
|
45
|
+
font-size: var(--st-font-size-sm);
|
|
46
|
+
font-weight: var(--st-font-weight-medium);
|
|
47
|
+
color: var(--st-color-foreground);
|
|
48
|
+
white-space: nowrap;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
text-overflow: ellipsis;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* ── Action area ── */
|
|
54
|
+
|
|
55
|
+
.action {
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
gap: var(--st-space-2);
|
|
59
|
+
flex-shrink: 0;
|
|
60
|
+
margin-left: auto;
|
|
61
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { CardHeaderProps } from './Card.types';
|
|
4
|
+
import styles from './CardHeader.module.css';
|
|
5
|
+
|
|
6
|
+
export const CardHeader = forwardRef<HTMLDivElement, CardHeaderProps>(
|
|
7
|
+
(
|
|
8
|
+
{
|
|
9
|
+
title,
|
|
10
|
+
icon,
|
|
11
|
+
action,
|
|
12
|
+
border = false,
|
|
13
|
+
size = 'md',
|
|
14
|
+
className,
|
|
15
|
+
children,
|
|
16
|
+
...rest
|
|
17
|
+
},
|
|
18
|
+
ref
|
|
19
|
+
) => {
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
ref={ref}
|
|
23
|
+
className={cn(
|
|
24
|
+
styles.root,
|
|
25
|
+
styles[size],
|
|
26
|
+
border && styles.border,
|
|
27
|
+
className
|
|
28
|
+
)}
|
|
29
|
+
{...rest}
|
|
30
|
+
>
|
|
31
|
+
{(title || icon) && (
|
|
32
|
+
<div className={styles.titleWrap}>
|
|
33
|
+
{icon && <span className={styles.icon}>{icon}</span>}
|
|
34
|
+
{title != null && (
|
|
35
|
+
<span className={styles.title}>{title}</span>
|
|
36
|
+
)}
|
|
37
|
+
</div>
|
|
38
|
+
)}
|
|
39
|
+
{action && <div className={styles.action}>{action}</div>}
|
|
40
|
+
{children}
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
CardHeader.displayName = 'CardHeader';
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
padding: var(--st-space-5);
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: var(--st-space-4);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* ── Variants ── */
|
|
9
|
+
|
|
10
|
+
.light {
|
|
11
|
+
background: var(--st-color-surface);
|
|
12
|
+
color: var(--st-color-foreground);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.dark {
|
|
16
|
+
background: var(--st-color-neutral-900);
|
|
17
|
+
color: #ffffff;
|
|
18
|
+
border-color: var(--st-color-neutral-800);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.primary {
|
|
22
|
+
background: var(--st-color-primary);
|
|
23
|
+
color: #ffffff;
|
|
24
|
+
border-color: var(--st-color-primary);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* ── Body ── */
|
|
28
|
+
|
|
29
|
+
.body {
|
|
30
|
+
display: flex;
|
|
31
|
+
gap: var(--st-space-3);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.icon {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: flex-start;
|
|
37
|
+
flex-shrink: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.content {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
gap: var(--st-space-1);
|
|
44
|
+
min-width: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.badge {
|
|
48
|
+
display: inline-flex;
|
|
49
|
+
align-self: flex-start;
|
|
50
|
+
padding: var(--st-space-1) var(--st-space-2);
|
|
51
|
+
border-radius: var(--st-radius-full);
|
|
52
|
+
font-size: var(--st-font-size-xs);
|
|
53
|
+
font-weight: var(--st-font-weight-medium);
|
|
54
|
+
background: rgb(255 255 255 / 0.15);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.light .badge {
|
|
58
|
+
background: var(--st-color-primary-subtle);
|
|
59
|
+
color: var(--st-color-primary);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.title {
|
|
63
|
+
font-size: var(--st-font-size-sm);
|
|
64
|
+
font-weight: var(--st-font-weight-semibold);
|
|
65
|
+
line-height: var(--st-line-height-tight);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.description {
|
|
69
|
+
font-size: var(--st-font-size-sm);
|
|
70
|
+
line-height: var(--st-line-height-normal);
|
|
71
|
+
opacity: 0.8;
|
|
72
|
+
margin: 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.light .description {
|
|
76
|
+
color: var(--st-color-muted);
|
|
77
|
+
opacity: 1;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* ── Actions ── */
|
|
81
|
+
|
|
82
|
+
.actions {
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
gap: var(--st-space-2);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.dark .dismissBtn,
|
|
89
|
+
.primary .dismissBtn {
|
|
90
|
+
color: rgb(255 255 255 / 0.8);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.dark .dismissBtn:hover,
|
|
94
|
+
.primary .dismissBtn:hover {
|
|
95
|
+
color: #ffffff;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.dark .applyBtn {
|
|
99
|
+
background: #ffffff;
|
|
100
|
+
color: var(--st-color-neutral-900);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.primary .applyBtn {
|
|
104
|
+
background: #ffffff;
|
|
105
|
+
color: var(--st-color-primary);
|
|
106
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import { Card } from './Card';
|
|
4
|
+
import { Button } from '../Button/Button';
|
|
5
|
+
import type { InsightCardProps } from './InsightCard.types';
|
|
6
|
+
import styles from './InsightCard.module.css';
|
|
7
|
+
|
|
8
|
+
export const InsightCard = forwardRef<HTMLDivElement, InsightCardProps>(
|
|
9
|
+
(
|
|
10
|
+
{
|
|
11
|
+
icon,
|
|
12
|
+
badge,
|
|
13
|
+
title,
|
|
14
|
+
description,
|
|
15
|
+
variant = 'light',
|
|
16
|
+
onDismiss,
|
|
17
|
+
onApply,
|
|
18
|
+
dismissLabel = 'Dismiss',
|
|
19
|
+
applyLabel = 'Apply',
|
|
20
|
+
className,
|
|
21
|
+
...rest
|
|
22
|
+
},
|
|
23
|
+
ref
|
|
24
|
+
) => {
|
|
25
|
+
return (
|
|
26
|
+
<Card
|
|
27
|
+
ref={ref}
|
|
28
|
+
className={cn(styles.root, styles[variant], className)}
|
|
29
|
+
{...rest}
|
|
30
|
+
>
|
|
31
|
+
<div className={styles.body}>
|
|
32
|
+
{icon && <span className={styles.icon}>{icon}</span>}
|
|
33
|
+
<div className={styles.content}>
|
|
34
|
+
{badge && <span className={styles.badge}>{badge}</span>}
|
|
35
|
+
<span className={styles.title}>{title}</span>
|
|
36
|
+
{description && <p className={styles.description}>{description}</p>}
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
{(onDismiss || onApply) && (
|
|
40
|
+
<div className={styles.actions}>
|
|
41
|
+
{onDismiss && (
|
|
42
|
+
<Button
|
|
43
|
+
variant="ghost"
|
|
44
|
+
size="sm"
|
|
45
|
+
onClick={onDismiss}
|
|
46
|
+
className={styles.dismissBtn}
|
|
47
|
+
>
|
|
48
|
+
{dismissLabel}
|
|
49
|
+
</Button>
|
|
50
|
+
)}
|
|
51
|
+
{onApply && (
|
|
52
|
+
<Button
|
|
53
|
+
variant="fill"
|
|
54
|
+
size="sm"
|
|
55
|
+
onClick={onApply}
|
|
56
|
+
className={styles.applyBtn}
|
|
57
|
+
>
|
|
58
|
+
{applyLabel}
|
|
59
|
+
</Button>
|
|
60
|
+
)}
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
63
|
+
</Card>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
InsightCard.displayName = 'InsightCard';
|