@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,89 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/* ─── FileUpload (Dropzone) ─── */
|
|
4
|
+
|
|
5
|
+
export type FileUploadVariant = 'default' | 'landscape';
|
|
6
|
+
export type FileUploadStatus = 'idle' | 'uploading' | 'complete';
|
|
7
|
+
|
|
8
|
+
export interface FileUploadProps
|
|
9
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
10
|
+
/** Tall centered vs wider layout */
|
|
11
|
+
variant?: FileUploadVariant;
|
|
12
|
+
/** Visual state */
|
|
13
|
+
status?: FileUploadStatus;
|
|
14
|
+
/** 0–100 circular progress (uploading state) */
|
|
15
|
+
progress?: number;
|
|
16
|
+
/** Primary action text (blue link) */
|
|
17
|
+
label?: string;
|
|
18
|
+
/** Secondary helper text (gray) */
|
|
19
|
+
description?: string;
|
|
20
|
+
/** Bottom text (e.g. "Maximum file size: 20MB") */
|
|
21
|
+
helperText?: string;
|
|
22
|
+
/** File type filter for hidden input */
|
|
23
|
+
accept?: string;
|
|
24
|
+
/** Allow multiple files */
|
|
25
|
+
multiple?: boolean;
|
|
26
|
+
/** Disabled state */
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/** Cancel button callback (uploading state) */
|
|
29
|
+
onCancel?: () => void;
|
|
30
|
+
/** File selection/drop handler */
|
|
31
|
+
onChange?: (files: File[]) => void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* ─── FileUploadInput (Compact inline) ─── */
|
|
35
|
+
|
|
36
|
+
export interface FileUploadInputProps
|
|
37
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
38
|
+
/** Field label above */
|
|
39
|
+
label?: string;
|
|
40
|
+
/** Shown file name (placeholder if empty) */
|
|
41
|
+
fileName?: string;
|
|
42
|
+
/** Button text */
|
|
43
|
+
buttonLabel?: string;
|
|
44
|
+
/** Below-field helper text */
|
|
45
|
+
helperText?: string;
|
|
46
|
+
/** Visual state */
|
|
47
|
+
status?: FileUploadStatus;
|
|
48
|
+
/** Progress bar 0–100 (uploading state) */
|
|
49
|
+
progress?: number;
|
|
50
|
+
/** File type filter */
|
|
51
|
+
accept?: string;
|
|
52
|
+
/** Allow multiple files */
|
|
53
|
+
multiple?: boolean;
|
|
54
|
+
/** Disabled state */
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
/** File selection handler */
|
|
57
|
+
onChange?: (files: File[]) => void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* ─── FileUploadIcon (Square icon) ─── */
|
|
61
|
+
|
|
62
|
+
export interface FileUploadIconProps
|
|
63
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
64
|
+
/** Upload trigger icon */
|
|
65
|
+
icon?: ReactNode;
|
|
66
|
+
/** Text below square */
|
|
67
|
+
label?: string;
|
|
68
|
+
/** Text below label */
|
|
69
|
+
description?: string;
|
|
70
|
+
/** Image URL for preview */
|
|
71
|
+
thumbnail?: string;
|
|
72
|
+
/** File type filter */
|
|
73
|
+
accept?: string;
|
|
74
|
+
/** File selection handler */
|
|
75
|
+
onChange?: (files: File[]) => void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* ─── FileUploadItem (File row) ─── */
|
|
79
|
+
|
|
80
|
+
export interface FileUploadItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
81
|
+
/** File name text */
|
|
82
|
+
name: string;
|
|
83
|
+
/** Left icon slot */
|
|
84
|
+
icon?: ReactNode;
|
|
85
|
+
/** Image URL for thumbnail (overrides icon) */
|
|
86
|
+
thumbnail?: string;
|
|
87
|
+
/** Right action slot (kebab menu, delete btn) */
|
|
88
|
+
action?: ReactNode;
|
|
89
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* ─── FileUploadIcon ─── */
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
width: 120px;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
align-items: center;
|
|
8
|
+
gap: var(--st-space-2);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.box {
|
|
12
|
+
width: 120px;
|
|
13
|
+
height: 120px;
|
|
14
|
+
border: 2px dashed var(--st-color-border);
|
|
15
|
+
border-radius: var(--st-radius-xl);
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
color: var(--st-color-muted);
|
|
22
|
+
transition: border-color var(--st-transition-fast),
|
|
23
|
+
background-color var(--st-transition-fast);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.box:hover {
|
|
27
|
+
border-color: var(--st-color-primary);
|
|
28
|
+
background-color: var(--st-color-primary-subtle);
|
|
29
|
+
color: var(--st-color-primary);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.thumbnail {
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: 100%;
|
|
35
|
+
object-fit: cover;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.label {
|
|
39
|
+
color: var(--st-color-primary);
|
|
40
|
+
font-size: var(--st-font-size-sm);
|
|
41
|
+
font-weight: var(--st-font-weight-semibold);
|
|
42
|
+
text-align: center;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.description {
|
|
46
|
+
color: var(--st-color-muted);
|
|
47
|
+
font-size: var(--st-font-size-xs);
|
|
48
|
+
text-align: center;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.input {
|
|
52
|
+
position: absolute;
|
|
53
|
+
width: 1px;
|
|
54
|
+
height: 1px;
|
|
55
|
+
padding: 0;
|
|
56
|
+
margin: -1px;
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
clip: rect(0, 0, 0, 0);
|
|
59
|
+
white-space: nowrap;
|
|
60
|
+
border: 0;
|
|
61
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { forwardRef, useRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { FileUploadIconProps } from './FileUpload.types';
|
|
4
|
+
import styles from './FileUploadIcon.module.css';
|
|
5
|
+
|
|
6
|
+
function GalleryAddIcon() {
|
|
7
|
+
return (
|
|
8
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
9
|
+
<path
|
|
10
|
+
d="M13 1.25C13.4142 1.25 13.75 1.58579 13.75 2C13.75 2.41421 13.4142 2.75 13 2.75H9C6.57397 2.75 5.0708 3.23974 4.15527 4.15527C3.23974 5.0708 2.75 6.57397 2.75 9V15C2.75 16.1128 2.85379 17.0313 3.05371 17.7881L7.18164 15.0166C8.17819 14.3481 9.56927 14.3703 10.54 15.0635L10.7285 15.2109L10.7354 15.2158L11.0654 15.5059H11.0645C11.5641 15.9293 12.4044 15.9278 12.9014 15.501V15.5L17.0615 11.9307C18.1225 11.0196 19.7974 11.0196 20.8584 11.9307L21.25 12.2666V10C21.25 9.58579 21.5858 9.25 22 9.25C22.4142 9.25 22.75 9.58579 22.75 10V15C22.75 17.574 22.2397 19.5708 20.9053 20.9053C19.5708 22.2397 17.574 22.75 15 22.75H9C6.42603 22.75 4.4292 22.2397 3.09473 20.9053C1.76026 19.5708 1.25 17.574 1.25 15V9C1.25 6.42603 1.76026 4.4292 3.09473 3.09473C4.4292 1.76026 6.42603 1.25 9 1.25H13ZM19.8809 13.0684C19.382 12.6404 18.5379 12.6404 18.0391 13.0684H18.0381L13.8779 16.6377C12.8169 17.5491 11.1421 17.5501 10.0811 16.6387L10.0752 16.6328L9.75098 16.3477C9.30287 15.9633 8.53421 15.9162 8.01758 16.2627L3.64453 19.1982C3.79675 19.4405 3.96616 19.6556 4.15527 19.8447C5.0708 20.7603 6.57397 21.25 9 21.25H15C17.426 21.25 18.9292 20.7603 19.8447 19.8447C20.7603 18.9292 21.25 17.426 21.25 15V14.2432L19.8809 13.0684ZM9 5.25C10.5188 5.25 11.75 6.48122 11.75 8C11.75 9.51878 10.5188 10.75 9 10.75C7.48122 10.75 6.25 9.51878 6.25 8C6.25 6.48122 7.48122 5.25 9 5.25ZM9 6.75C8.30964 6.75 7.75 7.30964 7.75 8C7.75 8.69036 8.30964 9.25 9 9.25C9.69036 9.25 10.25 8.69036 10.25 8C10.25 7.30964 9.69036 6.75 9 6.75ZM18.5 1.5C18.9142 1.5 19.25 1.83579 19.25 2.25V4.25H21.25C21.6642 4.25 22 4.58579 22 5C22 5.41421 21.6642 5.75 21.25 5.75H19.25V7.75C19.25 8.16421 18.9142 8.5 18.5 8.5C18.0858 8.5 17.75 8.16421 17.75 7.75V5.75H15.75C15.3358 5.75 15 5.41421 15 5C15 4.58579 15.3358 4.25 15.75 4.25H17.75V2.25C17.75 1.83579 18.0858 1.5 18.5 1.5Z"
|
|
11
|
+
fill="currentColor"
|
|
12
|
+
/>
|
|
13
|
+
</svg>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const FileUploadIcon = forwardRef<HTMLDivElement, FileUploadIconProps>(
|
|
18
|
+
(
|
|
19
|
+
{
|
|
20
|
+
icon,
|
|
21
|
+
label = 'Click to upload',
|
|
22
|
+
description = 'or drag and drop',
|
|
23
|
+
thumbnail,
|
|
24
|
+
accept,
|
|
25
|
+
onChange,
|
|
26
|
+
className,
|
|
27
|
+
...rest
|
|
28
|
+
},
|
|
29
|
+
ref
|
|
30
|
+
) => {
|
|
31
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
32
|
+
|
|
33
|
+
const handleClick = () => {
|
|
34
|
+
inputRef.current?.click();
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
38
|
+
const files = e.target.files;
|
|
39
|
+
if (files?.length) {
|
|
40
|
+
onChange?.(Array.from(files));
|
|
41
|
+
}
|
|
42
|
+
e.target.value = '';
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div ref={ref} className={cn(styles.root, className)} {...rest}>
|
|
47
|
+
<div
|
|
48
|
+
className={styles.box}
|
|
49
|
+
onClick={handleClick}
|
|
50
|
+
role="button"
|
|
51
|
+
tabIndex={0}
|
|
52
|
+
onKeyDown={(e) => {
|
|
53
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
handleClick();
|
|
56
|
+
}
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
{thumbnail ? (
|
|
60
|
+
<img
|
|
61
|
+
src={thumbnail}
|
|
62
|
+
alt="Preview"
|
|
63
|
+
className={styles.thumbnail}
|
|
64
|
+
/>
|
|
65
|
+
) : (
|
|
66
|
+
icon ?? <GalleryAddIcon />
|
|
67
|
+
)}
|
|
68
|
+
</div>
|
|
69
|
+
<span className={styles.label}>{label}</span>
|
|
70
|
+
<span className={styles.description}>{description}</span>
|
|
71
|
+
<input
|
|
72
|
+
ref={inputRef}
|
|
73
|
+
type="file"
|
|
74
|
+
accept={accept}
|
|
75
|
+
onChange={handleChange}
|
|
76
|
+
className={styles.input}
|
|
77
|
+
tabIndex={-1}
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
FileUploadIcon.displayName = 'FileUploadIcon';
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/* ─── FileUploadInput ─── */
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: var(--st-space-1);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.label {
|
|
10
|
+
font-size: var(--st-font-size-sm);
|
|
11
|
+
font-weight: var(--st-font-weight-medium);
|
|
12
|
+
color: var(--st-color-foreground);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.row {
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
gap: var(--st-space-2);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.inputArea {
|
|
22
|
+
flex: 1;
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
gap: var(--st-space-2);
|
|
26
|
+
padding: var(--st-space-2) var(--st-space-3);
|
|
27
|
+
border: 1px solid var(--st-color-border);
|
|
28
|
+
border-radius: var(--st-radius-lg);
|
|
29
|
+
background: var(--st-color-surface);
|
|
30
|
+
min-height: 40px;
|
|
31
|
+
position: relative;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.fileIcon {
|
|
36
|
+
flex-shrink: 0;
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
color: var(--st-color-muted);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.fileName {
|
|
43
|
+
flex: 1;
|
|
44
|
+
font-size: var(--st-font-size-sm);
|
|
45
|
+
color: var(--st-color-foreground);
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
text-overflow: ellipsis;
|
|
48
|
+
white-space: nowrap;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.placeholder {
|
|
52
|
+
color: var(--st-color-muted);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* ─── Progress Bar ─── */
|
|
56
|
+
|
|
57
|
+
.progressBar {
|
|
58
|
+
position: absolute;
|
|
59
|
+
bottom: 0;
|
|
60
|
+
left: 0;
|
|
61
|
+
right: 0;
|
|
62
|
+
height: 4px;
|
|
63
|
+
background: var(--st-color-primary-subtle);
|
|
64
|
+
border-radius: var(--st-radius-full);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.progressFill {
|
|
68
|
+
height: 100%;
|
|
69
|
+
background: var(--st-color-primary);
|
|
70
|
+
border-radius: var(--st-radius-full);
|
|
71
|
+
transition: width var(--st-transition-base);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* ─── Button ─── */
|
|
75
|
+
|
|
76
|
+
.button {
|
|
77
|
+
flex-shrink: 0;
|
|
78
|
+
display: inline-flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
padding: var(--st-space-2) var(--st-space-4);
|
|
82
|
+
border: 1px solid var(--st-color-border);
|
|
83
|
+
border-radius: var(--st-radius-full);
|
|
84
|
+
background: var(--st-color-surface);
|
|
85
|
+
color: var(--st-color-foreground);
|
|
86
|
+
font-size: var(--st-font-size-sm);
|
|
87
|
+
font-weight: var(--st-font-weight-medium);
|
|
88
|
+
font-family: var(--st-font-family);
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
white-space: nowrap;
|
|
91
|
+
transition: background-color var(--st-transition-fast),
|
|
92
|
+
border-color var(--st-transition-fast),
|
|
93
|
+
color var(--st-transition-fast);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.button:hover:not(:disabled) {
|
|
97
|
+
background-color: var(--st-color-neutral-50);
|
|
98
|
+
border-color: var(--st-color-border-strong);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* ─── Complete State ─── */
|
|
102
|
+
|
|
103
|
+
.complete .button {
|
|
104
|
+
background-color: var(--st-color-neutral-900);
|
|
105
|
+
border-color: var(--st-color-neutral-900);
|
|
106
|
+
color: #ffffff;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.complete .button:hover:not(:disabled) {
|
|
110
|
+
background-color: var(--st-color-neutral-800);
|
|
111
|
+
border-color: var(--st-color-neutral-800);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* ─── Helper Text ─── */
|
|
115
|
+
|
|
116
|
+
.helperText {
|
|
117
|
+
font-size: var(--st-font-size-xs);
|
|
118
|
+
color: var(--st-color-muted);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* ─── Disabled ─── */
|
|
122
|
+
|
|
123
|
+
.disabled {
|
|
124
|
+
opacity: 0.5;
|
|
125
|
+
pointer-events: none;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* ─── Hidden Input ─── */
|
|
129
|
+
|
|
130
|
+
.input {
|
|
131
|
+
position: absolute;
|
|
132
|
+
width: 1px;
|
|
133
|
+
height: 1px;
|
|
134
|
+
padding: 0;
|
|
135
|
+
margin: -1px;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
clip: rect(0, 0, 0, 0);
|
|
138
|
+
white-space: nowrap;
|
|
139
|
+
border: 0;
|
|
140
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { forwardRef, useRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { FileUploadInputProps } from './FileUpload.types';
|
|
4
|
+
import styles from './FileUploadInput.module.css';
|
|
5
|
+
|
|
6
|
+
function FileIcon() {
|
|
7
|
+
return (
|
|
8
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none">
|
|
9
|
+
<path
|
|
10
|
+
d="M15 22.75H9C3.57 22.75 1.25 20.43 1.25 15V9C1.25 3.57 3.57 1.25 9 1.25H14C14.41 1.25 14.75 1.59 14.75 2C14.75 2.41 14.41 2.75 14 2.75H9C4.39 2.75 2.75 4.39 2.75 9V15C2.75 19.61 4.39 21.25 9 21.25H15C19.61 21.25 21.25 19.61 21.25 15V10C21.25 9.59 21.59 9.25 22 9.25C22.41 9.25 22.75 9.59 22.75 10V15C22.75 20.43 20.43 22.75 15 22.75Z"
|
|
11
|
+
fill="currentColor"
|
|
12
|
+
/>
|
|
13
|
+
<path
|
|
14
|
+
d="M22 10.75H18C14.58 10.75 13.25 9.42 13.25 6V2C13.25 1.7 13.43 1.42 13.71 1.31C13.99 1.19 14.31 1.26 14.53 1.47L22.53 9.47C22.74 9.68 22.81 10.01 22.69 10.29C22.57 10.57 22.3 10.75 22 10.75ZM14.75 3.81V6C14.75 8.58 15.42 9.25 18 9.25H20.19L14.75 3.81Z"
|
|
15
|
+
fill="currentColor"
|
|
16
|
+
/>
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const FileUploadInput = forwardRef<HTMLDivElement, FileUploadInputProps>(
|
|
22
|
+
(
|
|
23
|
+
{
|
|
24
|
+
label,
|
|
25
|
+
fileName,
|
|
26
|
+
buttonLabel = 'Select file',
|
|
27
|
+
helperText,
|
|
28
|
+
status = 'idle',
|
|
29
|
+
progress = 0,
|
|
30
|
+
accept,
|
|
31
|
+
multiple = false,
|
|
32
|
+
disabled = false,
|
|
33
|
+
onChange,
|
|
34
|
+
className,
|
|
35
|
+
...rest
|
|
36
|
+
},
|
|
37
|
+
ref
|
|
38
|
+
) => {
|
|
39
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
40
|
+
|
|
41
|
+
const handleClick = () => {
|
|
42
|
+
if (!disabled) {
|
|
43
|
+
inputRef.current?.click();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
48
|
+
const files = e.target.files;
|
|
49
|
+
if (files?.length) {
|
|
50
|
+
onChange?.(Array.from(files));
|
|
51
|
+
}
|
|
52
|
+
e.target.value = '';
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div
|
|
57
|
+
ref={ref}
|
|
58
|
+
className={cn(
|
|
59
|
+
styles.root,
|
|
60
|
+
disabled && styles.disabled,
|
|
61
|
+
styles[status],
|
|
62
|
+
className
|
|
63
|
+
)}
|
|
64
|
+
{...rest}
|
|
65
|
+
>
|
|
66
|
+
{label && <span className={styles.label}>{label}</span>}
|
|
67
|
+
<div className={styles.row}>
|
|
68
|
+
<div className={styles.inputArea}>
|
|
69
|
+
<span className={styles.fileIcon}>
|
|
70
|
+
<FileIcon />
|
|
71
|
+
</span>
|
|
72
|
+
<span
|
|
73
|
+
className={cn(
|
|
74
|
+
styles.fileName,
|
|
75
|
+
!fileName && styles.placeholder
|
|
76
|
+
)}
|
|
77
|
+
>
|
|
78
|
+
{fileName || 'No file selected'}
|
|
79
|
+
</span>
|
|
80
|
+
{status === 'uploading' && (
|
|
81
|
+
<div className={styles.progressBar}>
|
|
82
|
+
<div
|
|
83
|
+
className={styles.progressFill}
|
|
84
|
+
style={{ width: `${Math.min(100, Math.max(0, progress))}%` }}
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
)}
|
|
88
|
+
</div>
|
|
89
|
+
<button
|
|
90
|
+
type="button"
|
|
91
|
+
className={styles.button}
|
|
92
|
+
onClick={handleClick}
|
|
93
|
+
disabled={disabled}
|
|
94
|
+
>
|
|
95
|
+
{buttonLabel}
|
|
96
|
+
</button>
|
|
97
|
+
</div>
|
|
98
|
+
{helperText && <span className={styles.helperText}>{helperText}</span>}
|
|
99
|
+
<input
|
|
100
|
+
ref={inputRef}
|
|
101
|
+
type="file"
|
|
102
|
+
accept={accept}
|
|
103
|
+
multiple={multiple}
|
|
104
|
+
onChange={handleChange}
|
|
105
|
+
className={styles.input}
|
|
106
|
+
tabIndex={-1}
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
FileUploadInput.displayName = 'FileUploadInput';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* ─── FileUploadItem ─── */
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: var(--st-space-3);
|
|
7
|
+
padding: var(--st-space-3);
|
|
8
|
+
border: 1px solid var(--st-color-border);
|
|
9
|
+
border-radius: var(--st-radius-lg);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.iconWrap {
|
|
13
|
+
width: 40px;
|
|
14
|
+
height: 40px;
|
|
15
|
+
flex-shrink: 0;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
background: var(--st-color-neutral-50);
|
|
20
|
+
border-radius: var(--st-radius-md);
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.thumbnail {
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
object-fit: cover;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.name {
|
|
31
|
+
flex: 1;
|
|
32
|
+
font-size: var(--st-font-size-sm);
|
|
33
|
+
color: var(--st-color-foreground);
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
text-overflow: ellipsis;
|
|
36
|
+
white-space: nowrap;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.action {
|
|
40
|
+
flex-shrink: 0;
|
|
41
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import type { FileUploadItemProps } from './FileUpload.types';
|
|
4
|
+
import styles from './FileUploadItem.module.css';
|
|
5
|
+
|
|
6
|
+
function DocumentIcon() {
|
|
7
|
+
return (
|
|
8
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
9
|
+
<path
|
|
10
|
+
d="M15 22.75H9C3.57 22.75 1.25 20.43 1.25 15V9C1.25 3.57 3.57 1.25 9 1.25H14C14.41 1.25 14.75 1.59 14.75 2C14.75 2.41 14.41 2.75 14 2.75H9C4.39 2.75 2.75 4.39 2.75 9V15C2.75 19.61 4.39 21.25 9 21.25H15C19.61 21.25 21.25 19.61 21.25 15V10C21.25 9.59 21.59 9.25 22 9.25C22.41 9.25 22.75 9.59 22.75 10V15C22.75 20.43 20.43 22.75 15 22.75Z"
|
|
11
|
+
fill="#606E80"
|
|
12
|
+
/>
|
|
13
|
+
<path
|
|
14
|
+
d="M22 10.75H18C14.58 10.75 13.25 9.42 13.25 6V2C13.25 1.7 13.43 1.42 13.71 1.31C13.99 1.19 14.31 1.26 14.53 1.47L22.53 9.47C22.74 9.68 22.81 10.01 22.69 10.29C22.57 10.57 22.3 10.75 22 10.75ZM14.75 3.81V6C14.75 8.58 15.42 9.25 18 9.25H20.19L14.75 3.81Z"
|
|
15
|
+
fill="#606E80"
|
|
16
|
+
/>
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const FileUploadItem = forwardRef<HTMLDivElement, FileUploadItemProps>(
|
|
22
|
+
({ name, icon, thumbnail, action, className, ...rest }, ref) => {
|
|
23
|
+
return (
|
|
24
|
+
<div ref={ref} className={cn(styles.root, className)} {...rest}>
|
|
25
|
+
<div className={styles.iconWrap}>
|
|
26
|
+
{thumbnail ? (
|
|
27
|
+
<img src={thumbnail} alt={name} className={styles.thumbnail} />
|
|
28
|
+
) : (
|
|
29
|
+
icon ?? <DocumentIcon />
|
|
30
|
+
)}
|
|
31
|
+
</div>
|
|
32
|
+
<span className={styles.name}>{name}</span>
|
|
33
|
+
{action && <div className={styles.action}>{action}</div>}
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
FileUploadItem.displayName = 'FileUploadItem';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { FileUpload } from './FileUpload';
|
|
2
|
+
export { FileUploadInput } from './FileUploadInput';
|
|
3
|
+
export { FileUploadIcon } from './FileUploadIcon';
|
|
4
|
+
export { FileUploadItem } from './FileUploadItem';
|
|
5
|
+
export type {
|
|
6
|
+
FileUploadProps,
|
|
7
|
+
FileUploadVariant,
|
|
8
|
+
FileUploadStatus,
|
|
9
|
+
FileUploadInputProps,
|
|
10
|
+
FileUploadIconProps,
|
|
11
|
+
FileUploadItemProps,
|
|
12
|
+
} from './FileUpload.types';
|