@robert-stackflow/oneui 0.0.0-stage → 0.2.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/CHANGELOG.md +18 -0
- package/README.md +72 -2
- package/assets/LUCIDE-LICENSE.txt +43 -0
- package/assets/character-metadata.json +1 -0
- package/assets/emoji.json +1 -0
- package/assets/icon-catalog.json +1 -0
- package/assets/symbols.json +1 -0
- package/components/Accessibility.module.css +8 -0
- package/components/Accordion.d.ts +7 -0
- package/components/Accordion.js +41 -0
- package/components/Accordion.module.css +38 -0
- package/components/Alert.d.ts +9 -0
- package/components/Alert.js +42 -0
- package/components/Alert.module.css +56 -0
- package/components/AppShell.d.ts +30 -0
- package/components/AppShell.js +152 -0
- package/components/AppShell.module.css +239 -0
- package/components/AppearanceSettings.d.ts +7 -0
- package/components/AppearanceSettings.js +201 -0
- package/components/AppearanceSettings.module.css +32 -0
- package/components/Avatar.d.ts +14 -0
- package/components/Avatar.js +69 -0
- package/components/Avatar.module.css +70 -0
- package/components/AvatarGroup.d.ts +15 -0
- package/components/AvatarGroup.js +115 -0
- package/components/AvatarGroup.module.css +54 -0
- package/components/Badge.d.ts +5 -0
- package/components/Badge.js +11 -0
- package/components/Badge.module.css +30 -0
- package/components/BlockedTab.d.ts +4 -0
- package/components/BlockedTab.js +10 -0
- package/components/Breadcrumb.d.ts +16 -0
- package/components/Breadcrumb.js +157 -0
- package/components/Breadcrumb.module.css +97 -0
- package/components/Button.d.ts +13 -0
- package/components/Button.js +52 -0
- package/components/Button.module.css +88 -0
- package/components/Calendar.d.ts +10 -0
- package/components/Calendar.js +260 -0
- package/components/Calendar.module.css +106 -0
- package/components/Card.d.ts +8 -0
- package/components/Card.js +29 -0
- package/components/Card.module.css +47 -0
- package/components/Cascader.d.ts +14 -0
- package/components/Cascader.js +296 -0
- package/components/CatalogIcon.d.ts +3 -0
- package/components/CatalogIcon.js +11 -0
- package/components/CharacterPicker.d.ts +15 -0
- package/components/CharacterPicker.js +200 -0
- package/components/Checkbox.d.ts +12 -0
- package/components/Checkbox.js +82 -0
- package/components/Checkbox.module.css +95 -0
- package/components/ColorField.d.ts +6 -0
- package/components/ColorField.js +61 -0
- package/components/ColorField.module.css +15 -0
- package/components/ColorPicker.d.ts +5 -0
- package/components/ColorPicker.js +188 -0
- package/components/ColorPicker.module.css +90 -0
- package/components/Combobox.d.ts +13 -0
- package/components/Combobox.js +338 -0
- package/components/Combobox.module.css +24 -0
- package/components/CommandPalette.d.ts +25 -0
- package/components/CommandPalette.js +269 -0
- package/components/CommandPalette.module.css +49 -0
- package/components/ContextMenu.d.ts +9 -0
- package/components/ContextMenu.js +363 -0
- package/components/ContextMenu.module.css +42 -0
- package/components/ContextMenuPanel.d.ts +22 -0
- package/components/ContextMenuPanel.js +155 -0
- package/components/ContributionCalendar.d.ts +18 -0
- package/components/ContributionCalendar.js +201 -0
- package/components/ContributionCalendar.module.css +114 -0
- package/components/ContributionCell.d.ts +11 -0
- package/components/ContributionCell.js +41 -0
- package/components/Control.module.css +86 -0
- package/components/DataTable.d.ts +49 -0
- package/components/DataTable.js +220 -0
- package/components/DataTable.module.css +112 -0
- package/components/DatePicker.d.ts +15 -0
- package/components/DatePicker.js +186 -0
- package/components/DatePicker.module.css +85 -0
- package/components/DateRangePicker.d.ts +9 -0
- package/components/DateRangePicker.js +168 -0
- package/components/Descriptions.d.ts +21 -0
- package/components/Descriptions.js +162 -0
- package/components/Descriptions.module.css +117 -0
- package/components/Dialog.d.ts +14 -0
- package/components/Dialog.js +125 -0
- package/components/Dialog.module.css +88 -0
- package/components/DialogVariants.d.ts +27 -0
- package/components/DialogVariants.js +161 -0
- package/components/DialogVariants.module.css +29 -0
- package/components/DisclosureChevron.d.ts +3 -0
- package/components/DisclosureChevron.js +17 -0
- package/components/DisclosureChevron.module.css +17 -0
- package/components/Divider.d.ts +5 -0
- package/components/Divider.js +24 -0
- package/components/Divider.module.css +19 -0
- package/components/Drawer.d.ts +18 -0
- package/components/Drawer.js +145 -0
- package/components/Drawer.module.css +109 -0
- package/components/EmojiPicker.d.ts +6 -0
- package/components/EmojiPicker.js +19 -0
- package/components/EmptyState.d.ts +8 -0
- package/components/EmptyState.js +20 -0
- package/components/EmptyState.module.css +30 -0
- package/components/FieldLabel.d.ts +8 -0
- package/components/FieldLabel.js +20 -0
- package/components/FieldMessages.d.ts +5 -0
- package/components/FieldMessages.js +15 -0
- package/components/FileDropOverlay.d.ts +5 -0
- package/components/FileDropOverlay.js +26 -0
- package/components/FileDropOverlay.module.css +55 -0
- package/components/FileDropZone.d.ts +15 -0
- package/components/FileDropZone.js +113 -0
- package/components/FileDropZone.module.css +6 -0
- package/components/FilePicker.d.ts +10 -0
- package/components/FilePicker.js +59 -0
- package/components/FileSelectionFeedback.d.ts +5 -0
- package/components/FileSelectionFeedback.js +23 -0
- package/components/FileSelectionFeedback.module.css +14 -0
- package/components/FileTree.d.ts +13 -0
- package/components/FileTree.js +125 -0
- package/components/FileTree.module.css +66 -0
- package/components/Form.d.ts +7 -0
- package/components/Form.js +26 -0
- package/components/Form.module.css +7 -0
- package/components/FormErrorSummary.d.ts +6 -0
- package/components/FormErrorSummary.js +27 -0
- package/components/FormErrorSummary.module.css +27 -0
- package/components/FormField.d.ts +9 -0
- package/components/FormField.js +59 -0
- package/components/FormField.module.css +85 -0
- package/components/FormGroup.d.ts +9 -0
- package/components/FormGroup.js +32 -0
- package/components/HierarchyPicker.module.css +181 -0
- package/components/IconButton.d.ts +7 -0
- package/components/IconButton.js +30 -0
- package/components/IconButton.module.css +42 -0
- package/components/IconPicker.d.ts +6 -0
- package/components/IconPicker.js +111 -0
- package/components/Indicator.d.ts +18 -0
- package/components/Indicator.js +97 -0
- package/components/Indicator.module.css +83 -0
- package/components/Input.d.ts +8 -0
- package/components/Input.js +37 -0
- package/components/Input.module.css +40 -0
- package/components/LoadingOverlay.d.ts +6 -0
- package/components/LoadingOverlay.js +16 -0
- package/components/LoadingOverlay.module.css +22 -0
- package/components/LoadingState.d.ts +7 -0
- package/components/LoadingState.js +40 -0
- package/components/LoadingState.module.css +17 -0
- package/components/Menu.d.ts +11 -0
- package/components/Menu.js +82 -0
- package/components/MenuItem.d.ts +15 -0
- package/components/MenuItem.js +51 -0
- package/components/MenuItem.module.css +172 -0
- package/components/MenuItemContent.d.ts +8 -0
- package/components/MenuItemContent.js +19 -0
- package/components/MultiSelect.d.ts +13 -0
- package/components/MultiSelect.js +225 -0
- package/components/MultiSelect.module.css +99 -0
- package/components/NumberInput.d.ts +12 -0
- package/components/NumberInput.js +114 -0
- package/components/NumberInput.module.css +33 -0
- package/components/OptionList.module.css +12 -0
- package/components/Page.d.ts +7 -0
- package/components/Page.js +22 -0
- package/components/Page.module.css +44 -0
- package/components/Pagination.d.ts +11 -0
- package/components/Pagination.js +160 -0
- package/components/Pagination.module.css +70 -0
- package/components/PasswordField.d.ts +9 -0
- package/components/PasswordField.js +102 -0
- package/components/PasswordField.module.css +64 -0
- package/components/Picker.module.css +52 -0
- package/components/PinInput.d.ts +13 -0
- package/components/PinInput.js +173 -0
- package/components/PinInput.module.css +72 -0
- package/components/Placeholder.d.ts +31 -0
- package/components/Placeholder.js +36 -0
- package/components/Popconfirm.d.ts +17 -0
- package/components/Popconfirm.js +159 -0
- package/components/Popconfirm.module.css +49 -0
- package/components/Popover.d.ts +16 -0
- package/components/Popover.js +156 -0
- package/components/Popover.module.css +19 -0
- package/components/Progress.d.ts +5 -0
- package/components/Progress.js +31 -0
- package/components/Progress.module.css +33 -0
- package/components/RadioGroup.d.ts +15 -0
- package/components/RadioGroup.js +73 -0
- package/components/RadioGroup.module.css +87 -0
- package/components/RangeSlider.d.ts +22 -0
- package/components/RangeSlider.js +278 -0
- package/components/RangeSlider.module.css +141 -0
- package/components/ResizablePanel.d.ts +21 -0
- package/components/ResizablePanel.js +219 -0
- package/components/ResizablePanel.module.css +101 -0
- package/components/SearchField.d.ts +11 -0
- package/components/SearchField.js +67 -0
- package/components/SearchField.module.css +37 -0
- package/components/Section.d.ts +6 -0
- package/components/Section.js +18 -0
- package/components/Section.module.css +14 -0
- package/components/Segmented.d.ts +11 -0
- package/components/Segmented.js +77 -0
- package/components/Segmented.module.css +82 -0
- package/components/Select.d.ts +11 -0
- package/components/Select.js +172 -0
- package/components/Select.module.css +24 -0
- package/components/SelectOptionContent.d.ts +5 -0
- package/components/SelectOptionContent.js +20 -0
- package/components/SelectOptionContent.module.css +7 -0
- package/components/SelectTrigger.d.ts +5 -0
- package/components/SelectTrigger.js +32 -0
- package/components/SelectTrigger.module.css +24 -0
- package/components/SelectionTag.d.ts +8 -0
- package/components/SelectionTag.js +39 -0
- package/components/SettingRow.d.ts +7 -0
- package/components/SettingRow.js +19 -0
- package/components/SettingRow.module.css +44 -0
- package/components/SettingsLayout.d.ts +11 -0
- package/components/SettingsLayout.js +61 -0
- package/components/SettingsLayout.module.css +68 -0
- package/components/ShortcutInput.d.ts +8 -0
- package/components/ShortcutInput.js +131 -0
- package/components/ShortcutInput.module.css +39 -0
- package/components/Skeleton.d.ts +5 -0
- package/components/Skeleton.js +19 -0
- package/components/Skeleton.module.css +27 -0
- package/components/SkeletonRows.d.ts +4 -0
- package/components/SkeletonRows.js +19 -0
- package/components/SkeletonRows.module.css +19 -0
- package/components/SkinTonePicker.d.ts +4 -0
- package/components/SkinTonePicker.js +43 -0
- package/components/SkinTonePicker.module.css +50 -0
- package/components/Slider.d.ts +10 -0
- package/components/Slider.js +40 -0
- package/components/Slider.module.css +19 -0
- package/components/Spinner.d.ts +6 -0
- package/components/Spinner.js +31 -0
- package/components/Spinner.module.css +57 -0
- package/components/SplitButton.d.ts +17 -0
- package/components/SplitButton.js +102 -0
- package/components/SplitButton.module.css +56 -0
- package/components/Statistic.d.ts +22 -0
- package/components/Statistic.js +102 -0
- package/components/Statistic.module.css +55 -0
- package/components/Steps.d.ts +19 -0
- package/components/Steps.js +102 -0
- package/components/Steps.module.css +176 -0
- package/components/Switch.d.ts +6 -0
- package/components/Switch.js +25 -0
- package/components/Switch.module.css +59 -0
- package/components/SymbolPicker.d.ts +6 -0
- package/components/SymbolPicker.js +18 -0
- package/components/Tab.module.css +145 -0
- package/components/TabList.d.ts +11 -0
- package/components/TabList.js +51 -0
- package/components/Table.d.ts +16 -0
- package/components/Table.js +30 -0
- package/components/Table.module.css +48 -0
- package/components/TableColumnFilter.d.ts +6 -0
- package/components/TableColumnFilter.js +76 -0
- package/components/TableColumnVisibility.d.ts +11 -0
- package/components/TableColumnVisibility.js +76 -0
- package/components/Tabs.d.ts +13 -0
- package/components/Tabs.js +49 -0
- package/components/Tabs.module.css +3 -0
- package/components/TagInput.d.ts +11 -0
- package/components/TagInput.js +142 -0
- package/components/TagInput.module.css +64 -0
- package/components/Textarea.d.ts +6 -0
- package/components/Textarea.js +24 -0
- package/components/Textarea.module.css +9 -0
- package/components/ThemePicker.d.ts +6 -0
- package/components/ThemePicker.js +78 -0
- package/components/ThemePicker.module.css +178 -0
- package/components/ThemeProvider.d.ts +11 -0
- package/components/ThemeProvider.js +94 -0
- package/components/ThemeStylePicker.d.ts +5 -0
- package/components/ThemeStylePicker.js +22 -0
- package/components/TimeColumns.d.ts +6 -0
- package/components/TimeColumns.js +55 -0
- package/components/TimeColumns.module.css +47 -0
- package/components/Timeline.d.ts +26 -0
- package/components/Timeline.js +131 -0
- package/components/Timeline.module.css +202 -0
- package/components/Toast.d.ts +6 -0
- package/components/Toast.js +181 -0
- package/components/Toast.module.css +175 -0
- package/components/ToastProvider.d.ts +35 -0
- package/components/ToastProvider.js +47 -0
- package/components/Tooltip.d.ts +10 -0
- package/components/Tooltip.js +169 -0
- package/components/Tooltip.module.css +53 -0
- package/components/TreeGuides.d.ts +9 -0
- package/components/TreeGuides.js +39 -0
- package/components/TreeGuides.module.css +45 -0
- package/components/TreeSelect.d.ts +26 -0
- package/components/TreeSelect.js +337 -0
- package/components/TreeTable.d.ts +15 -0
- package/components/TreeTable.js +151 -0
- package/components/TreeTable.module.css +53 -0
- package/components/UIProvider.d.ts +10 -0
- package/components/UIProvider.js +20 -0
- package/components/UnderlinedTab.d.ts +2 -0
- package/components/UnderlinedTab.js +8 -0
- package/components/Upload.d.ts +22 -0
- package/components/Upload.js +165 -0
- package/components/Upload.module.css +36 -0
- package/components/UploadList.d.ts +9 -0
- package/components/UploadList.js +14 -0
- package/components/UploadList.module.css +130 -0
- package/components/UploadListItem.d.ts +13 -0
- package/components/UploadListItem.js +122 -0
- package/components/VirtualPickerList.d.ts +25 -0
- package/components/VirtualPickerList.js +269 -0
- package/components/VirtualPickerList.module.css +93 -0
- package/components/appearance.d.ts +20 -0
- package/components/appearance.js +69 -0
- package/components/characterCatalog.d.ts +9 -0
- package/components/characterCatalog.js +55 -0
- package/components/color.d.ts +7 -0
- package/components/color.js +18 -0
- package/components/contribution.d.ts +57 -0
- package/components/contribution.js +86 -0
- package/components/dateConstraints.d.ts +13 -0
- package/components/dateConstraints.js +44 -0
- package/components/field.d.ts +58 -0
- package/components/field.js +57 -0
- package/components/fileSelection.d.ts +21 -0
- package/components/fileSelection.js +43 -0
- package/components/hierarchy.d.ts +23 -0
- package/components/hierarchy.js +33 -0
- package/components/iconCatalog.d.ts +13 -0
- package/components/iconCatalog.js +80 -0
- package/components/index.d.ts +152 -0
- package/components/index.js +225 -0
- package/components/menuFocus.d.ts +7 -0
- package/components/menuFocus.js +21 -0
- package/components/menuPointer.d.ts +6 -0
- package/components/menuPointer.js +13 -0
- package/components/menuTypes.d.ts +24 -0
- package/components/menuTypes.js +0 -0
- package/components/motion.d.ts +9 -0
- package/components/motion.js +82 -0
- package/components/rangeMath.d.ts +12 -0
- package/components/rangeMath.js +30 -0
- package/components/surfacePortal.d.ts +13 -0
- package/components/surfacePortal.js +22 -0
- package/components/tooltipState.d.ts +5 -0
- package/components/tooltipState.js +48 -0
- package/components/types.d.ts +9 -0
- package/components/types.js +0 -0
- package/components/uploadTypes.d.ts +21 -0
- package/components/uploadTypes.js +0 -0
- package/components/useFormState.d.ts +51 -0
- package/components/useFormState.js +218 -0
- package/components/useHierarchy.d.ts +8 -0
- package/components/useHierarchy.js +80 -0
- package/components/useMenuLayers.d.ts +17 -0
- package/components/useMenuLayers.js +23 -0
- package/components/useModalScrollLock.d.ts +1 -0
- package/components/useModalScrollLock.js +18 -0
- package/components/usePopover.d.ts +8 -0
- package/components/usePopover.js +22 -0
- package/components/useTabIndicator.d.ts +12 -0
- package/components/useTabIndicator.js +63 -0
- package/components/useUploadQueue.d.ts +20 -0
- package/components/useUploadQueue.js +175 -0
- package/package.json +810 -3
- package/styles/base.css +206 -0
- package/styles/blue.css +268 -0
- package/styles/desktop.css +2 -0
- package/styles/minimal.css +337 -0
- package/styles/themes.css +2 -0
- package/styles/web.css +2 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Column } from "./Table";
|
|
2
|
+
export type TreeTableProps<T, K extends string | number> = {
|
|
3
|
+
rows: T[];
|
|
4
|
+
columns: Column<T>[];
|
|
5
|
+
rowKey(row: T): K;
|
|
6
|
+
getChildren(row: T): T[] | undefined;
|
|
7
|
+
rowLabel(row: T): string;
|
|
8
|
+
label?: string;
|
|
9
|
+
treeColumn?: string;
|
|
10
|
+
expanded?: K[];
|
|
11
|
+
defaultExpanded?: K[];
|
|
12
|
+
defaultExpandAll?: boolean;
|
|
13
|
+
onExpandedChange?(keys: K[]): void;
|
|
14
|
+
};
|
|
15
|
+
export declare function TreeTable<T, K extends string | number>({ rows, columns, rowKey, getChildren, rowLabel, label, treeColumn, expanded, defaultExpanded, defaultExpandAll, onExpandedChange, }: TreeTableProps<T, K>): import("react").JSX.Element;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useRef, useState } from "react";
|
|
3
|
+
import { Table } from "./Table.js";
|
|
4
|
+
import { IconButton } from "./IconButton.js";
|
|
5
|
+
import { DisclosureChevron } from "./DisclosureChevron.js";
|
|
6
|
+
import { TreeGuides } from "./TreeGuides.js";
|
|
7
|
+
import s from "./TreeTable.module.css";
|
|
8
|
+
function TreeTable({
|
|
9
|
+
rows,
|
|
10
|
+
columns,
|
|
11
|
+
rowKey,
|
|
12
|
+
getChildren,
|
|
13
|
+
rowLabel,
|
|
14
|
+
label = "\u5C42\u7EA7\u8868\u683C",
|
|
15
|
+
treeColumn = columns[0]?.key,
|
|
16
|
+
expanded,
|
|
17
|
+
defaultExpanded = [],
|
|
18
|
+
defaultExpandAll = false,
|
|
19
|
+
onExpandedChange
|
|
20
|
+
}) {
|
|
21
|
+
const [local, setLocal] = useState(() => {
|
|
22
|
+
if (!defaultExpandAll) return defaultExpanded;
|
|
23
|
+
const keys2 = [], seen = /* @__PURE__ */ new Set();
|
|
24
|
+
const walk = (nodes) => nodes.forEach((row) => {
|
|
25
|
+
const key = rowKey(row);
|
|
26
|
+
if (seen.has(key)) return;
|
|
27
|
+
seen.add(key);
|
|
28
|
+
const children = getChildren(row);
|
|
29
|
+
if (children?.length) {
|
|
30
|
+
keys2.push(key);
|
|
31
|
+
walk(children);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
walk(rows);
|
|
35
|
+
return keys2;
|
|
36
|
+
});
|
|
37
|
+
const keys = expanded ?? local, open = new Set(keys);
|
|
38
|
+
const root = useRef(null), [focused, setFocused] = useState();
|
|
39
|
+
const visible = useMemo(() => {
|
|
40
|
+
const entries = [], seen = /* @__PURE__ */ new Set();
|
|
41
|
+
const walk = (nodes, depth, continuations) => nodes.forEach((row, i) => {
|
|
42
|
+
const key = rowKey(row);
|
|
43
|
+
if (seen.has(key)) return;
|
|
44
|
+
seen.add(key);
|
|
45
|
+
const children = getChildren(row) || [], last = i === nodes.length - 1;
|
|
46
|
+
entries.push({
|
|
47
|
+
row,
|
|
48
|
+
key,
|
|
49
|
+
depth,
|
|
50
|
+
last,
|
|
51
|
+
continuations,
|
|
52
|
+
children,
|
|
53
|
+
position: i + 1,
|
|
54
|
+
size: nodes.length
|
|
55
|
+
});
|
|
56
|
+
if (children.length && open.has(key))
|
|
57
|
+
walk(
|
|
58
|
+
children,
|
|
59
|
+
depth + 1,
|
|
60
|
+
depth === 0 ? [] : [...continuations, !last]
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
walk(rows, 0, []);
|
|
64
|
+
return entries;
|
|
65
|
+
}, [rows, getChildren, rowKey, keys]);
|
|
66
|
+
const toggle = (key) => {
|
|
67
|
+
const next = open.has(key) ? keys.filter((k) => k !== key) : [...keys, key];
|
|
68
|
+
if (expanded === void 0) setLocal(next);
|
|
69
|
+
onExpandedChange?.(next);
|
|
70
|
+
};
|
|
71
|
+
const focus = (key) => {
|
|
72
|
+
setFocused(key);
|
|
73
|
+
const index = visible.findIndex((entry) => entry.key === key);
|
|
74
|
+
root.current?.querySelectorAll("tbody tr")[index]?.focus();
|
|
75
|
+
};
|
|
76
|
+
const active = visible.some((entry) => entry.key === focused) ? focused : visible[0]?.key;
|
|
77
|
+
return /* @__PURE__ */ jsx("div", { className: s.root, ref: root, children: /* @__PURE__ */ jsx(
|
|
78
|
+
Table,
|
|
79
|
+
{
|
|
80
|
+
label,
|
|
81
|
+
role: "treegrid",
|
|
82
|
+
rows: visible,
|
|
83
|
+
rowKey: (entry) => typeof entry.key + ":" + String(entry.key),
|
|
84
|
+
rowAttributes: (entry) => ({
|
|
85
|
+
"aria-level": entry.depth + 1,
|
|
86
|
+
"aria-posinset": entry.position,
|
|
87
|
+
"aria-setsize": entry.size,
|
|
88
|
+
"aria-expanded": entry.children.length ? open.has(entry.key) : void 0,
|
|
89
|
+
"data-tree-root": entry.depth === 0,
|
|
90
|
+
tabIndex: entry.key === active ? 0 : -1,
|
|
91
|
+
onFocus: (event) => {
|
|
92
|
+
if (event.target === event.currentTarget) setFocused(entry.key);
|
|
93
|
+
},
|
|
94
|
+
onKeyDown: (event) => {
|
|
95
|
+
if (event.target !== event.currentTarget) return;
|
|
96
|
+
const index = visible.indexOf(entry);
|
|
97
|
+
let next;
|
|
98
|
+
if (event.key === "ArrowDown")
|
|
99
|
+
next = visible[Math.min(visible.length - 1, index + 1)];
|
|
100
|
+
else if (event.key === "ArrowUp")
|
|
101
|
+
next = visible[Math.max(0, index - 1)];
|
|
102
|
+
else if (event.key === "Home") next = visible[0];
|
|
103
|
+
else if (event.key === "End") next = visible.at(-1);
|
|
104
|
+
else if (event.key === "ArrowRight") {
|
|
105
|
+
if (entry.children.length && !open.has(entry.key))
|
|
106
|
+
toggle(entry.key);
|
|
107
|
+
else if (visible[index + 1]?.depth > entry.depth)
|
|
108
|
+
next = visible[index + 1];
|
|
109
|
+
} else if (event.key === "ArrowLeft") {
|
|
110
|
+
if (entry.children.length && open.has(entry.key))
|
|
111
|
+
toggle(entry.key);
|
|
112
|
+
else
|
|
113
|
+
next = visible.slice(0, index).reverse().find((parent) => parent.depth < entry.depth);
|
|
114
|
+
} else return;
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
if (next) focus(next.key);
|
|
117
|
+
}
|
|
118
|
+
}),
|
|
119
|
+
columns: columns.map((column) => ({
|
|
120
|
+
key: column.key,
|
|
121
|
+
title: column.title,
|
|
122
|
+
align: column.align,
|
|
123
|
+
width: column.width,
|
|
124
|
+
render: (entry) => column.key !== treeColumn ? column.render(entry.row) : /* @__PURE__ */ jsxs("div", { className: s.cell, style: { paddingLeft: entry.depth * 24 }, children: [
|
|
125
|
+
/* @__PURE__ */ jsx(
|
|
126
|
+
TreeGuides,
|
|
127
|
+
{
|
|
128
|
+
depth: entry.depth,
|
|
129
|
+
continuations: entry.continuations,
|
|
130
|
+
last: entry.last
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
entry.children.length ? /* @__PURE__ */ jsx(
|
|
134
|
+
IconButton,
|
|
135
|
+
{
|
|
136
|
+
label: `${open.has(entry.key) ? "\u6298\u53E0" : "\u5C55\u5F00"} ${rowLabel(entry.row)}`,
|
|
137
|
+
className: s.expander,
|
|
138
|
+
onClick: () => toggle(entry.key),
|
|
139
|
+
"aria-expanded": open.has(entry.key),
|
|
140
|
+
children: /* @__PURE__ */ jsx(DisclosureChevron, { expanded: open.has(entry.key) })
|
|
141
|
+
}
|
|
142
|
+
) : /* @__PURE__ */ jsx("span", { className: s.spacer }),
|
|
143
|
+
/* @__PURE__ */ jsx("div", { className: s.content, children: column.render(entry.row) })
|
|
144
|
+
] })
|
|
145
|
+
}))
|
|
146
|
+
}
|
|
147
|
+
) });
|
|
148
|
+
}
|
|
149
|
+
export {
|
|
150
|
+
TreeTable
|
|
151
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
border: 1px solid var(--line);
|
|
3
|
+
border-radius: var(--card-radius);
|
|
4
|
+
background: var(--surface);
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
box-shadow: var(--card-shadow, none);
|
|
7
|
+
}
|
|
8
|
+
.root table td {
|
|
9
|
+
padding: 0 18px;
|
|
10
|
+
border-bottom: 0;
|
|
11
|
+
}
|
|
12
|
+
.root table th {
|
|
13
|
+
padding: 14px 18px;
|
|
14
|
+
}
|
|
15
|
+
.root tr:focus-visible {
|
|
16
|
+
outline: 1px solid var(--accent);
|
|
17
|
+
outline-offset: -1px;
|
|
18
|
+
}
|
|
19
|
+
.root table tr[data-tree-root="true"]:not(:first-child) td {
|
|
20
|
+
border-top: 1px solid var(--line);
|
|
21
|
+
}
|
|
22
|
+
.cell {
|
|
23
|
+
--tree-elbow-gap: 8px;
|
|
24
|
+
position: relative;
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: 8px;
|
|
28
|
+
min-height: 72px;
|
|
29
|
+
padding-block: 14px;
|
|
30
|
+
min-width: 260px;
|
|
31
|
+
white-space: normal;
|
|
32
|
+
}
|
|
33
|
+
.expander,
|
|
34
|
+
.spacer {
|
|
35
|
+
flex: 0 0 24px;
|
|
36
|
+
width: 24px;
|
|
37
|
+
height: 26px;
|
|
38
|
+
}
|
|
39
|
+
.content {
|
|
40
|
+
position: relative;
|
|
41
|
+
flex: 1;
|
|
42
|
+
min-width: 0;
|
|
43
|
+
}
|
|
44
|
+
.expander svg {
|
|
45
|
+
width: 14px;
|
|
46
|
+
height: 14px;
|
|
47
|
+
}
|
|
48
|
+
.expander[aria-expanded="false"] svg {
|
|
49
|
+
rotate: -90deg;
|
|
50
|
+
}
|
|
51
|
+
.expander[aria-expanded="true"] svg {
|
|
52
|
+
rotate: 0deg;
|
|
53
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type UIConfig = {
|
|
3
|
+
toastPosition: "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
4
|
+
tooltipPlacement: "top" | "bottom" | "left" | "right";
|
|
5
|
+
requiredIndicator: "asterisk" | "text" | "none";
|
|
6
|
+
};
|
|
7
|
+
export declare function UIProvider({ children, ...config }: Partial<UIConfig> & {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
10
|
+
export declare const useUIConfig: () => UIConfig;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
const defaults = {
|
|
4
|
+
toastPosition: "bottom-right",
|
|
5
|
+
tooltipPlacement: "top",
|
|
6
|
+
requiredIndicator: "none"
|
|
7
|
+
};
|
|
8
|
+
const Context = createContext(defaults);
|
|
9
|
+
function UIProvider({
|
|
10
|
+
children,
|
|
11
|
+
...config
|
|
12
|
+
}) {
|
|
13
|
+
const parent = useContext(Context);
|
|
14
|
+
return /* @__PURE__ */ jsx(Context, { value: { ...parent, ...config }, children });
|
|
15
|
+
}
|
|
16
|
+
const useUIConfig = () => useContext(Context);
|
|
17
|
+
export {
|
|
18
|
+
UIProvider,
|
|
19
|
+
useUIConfig
|
|
20
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type FieldOptions } from "./field";
|
|
3
|
+
import { type FileConstraints, type FileRejection, type FileSelectionResult } from "./fileSelection";
|
|
4
|
+
import type { UploadFile, UploadRequest, UploadResult } from "./uploadTypes";
|
|
5
|
+
export type UploadProps = Omit<FieldOptions, "name"> & Omit<FileConstraints, "selectedCount"> & {
|
|
6
|
+
label: string;
|
|
7
|
+
value?: UploadFile[];
|
|
8
|
+
defaultValue?: UploadFile[];
|
|
9
|
+
onChange?(files: UploadFile[]): void;
|
|
10
|
+
request?: UploadRequest;
|
|
11
|
+
autoUpload?: boolean;
|
|
12
|
+
concurrency?: number;
|
|
13
|
+
draggable?: boolean;
|
|
14
|
+
showThumbnails?: boolean;
|
|
15
|
+
description?: ReactNode;
|
|
16
|
+
onReject?(rejections: FileRejection[]): void;
|
|
17
|
+
onValidation?(result: FileSelectionResult): void;
|
|
18
|
+
onSuccess?(file: UploadFile, result: UploadResult | void): void;
|
|
19
|
+
onError?(file: UploadFile, error: unknown): void;
|
|
20
|
+
onPreview?(file: UploadFile, source?: string): void;
|
|
21
|
+
};
|
|
22
|
+
export declare function Upload({ label, value, defaultValue, onChange, request, autoUpload, concurrency, draggable, showThumbnails, description, onReject, onValidation, onSuccess, onError, onPreview, accept, maxSize, maxFiles, multiple, ...options }: UploadProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { FilePicker } from "./FilePicker.js";
|
|
4
|
+
import { FileDropZone } from "./FileDropZone.js";
|
|
5
|
+
import { FileSelectionFeedback } from "./FileSelectionFeedback.js";
|
|
6
|
+
import { UploadList } from "./UploadList.js";
|
|
7
|
+
import { Button } from "./Button.js";
|
|
8
|
+
import { Dialog } from "./Dialog.js";
|
|
9
|
+
import { useFieldControl } from "./field.js";
|
|
10
|
+
import { useUploadQueue } from "./useUploadQueue.js";
|
|
11
|
+
import {
|
|
12
|
+
validateFiles
|
|
13
|
+
} from "./fileSelection.js";
|
|
14
|
+
import s from "./Upload.module.css";
|
|
15
|
+
function Upload({
|
|
16
|
+
label,
|
|
17
|
+
value,
|
|
18
|
+
defaultValue,
|
|
19
|
+
onChange,
|
|
20
|
+
request,
|
|
21
|
+
autoUpload = true,
|
|
22
|
+
concurrency = 3,
|
|
23
|
+
draggable = true,
|
|
24
|
+
showThumbnails = true,
|
|
25
|
+
description,
|
|
26
|
+
onReject,
|
|
27
|
+
onValidation,
|
|
28
|
+
onSuccess,
|
|
29
|
+
onError,
|
|
30
|
+
onPreview,
|
|
31
|
+
accept,
|
|
32
|
+
maxSize,
|
|
33
|
+
maxFiles,
|
|
34
|
+
multiple,
|
|
35
|
+
...options
|
|
36
|
+
}) {
|
|
37
|
+
const field = useFieldControl({ ...options, label }), blocked = field.disabled || field.readOnly, queue = useUploadQueue({
|
|
38
|
+
value,
|
|
39
|
+
defaultValue,
|
|
40
|
+
onChange,
|
|
41
|
+
request,
|
|
42
|
+
autoUpload,
|
|
43
|
+
concurrency,
|
|
44
|
+
disabled: blocked,
|
|
45
|
+
onSuccess,
|
|
46
|
+
onError
|
|
47
|
+
}), [rejected, setRejected] = useState([]), [preview, setPreview] = useState(), root = useRef(null);
|
|
48
|
+
const receive = (result) => {
|
|
49
|
+
if (blocked) return;
|
|
50
|
+
const checked = validateFiles(result.accepted, {
|
|
51
|
+
accept,
|
|
52
|
+
maxSize,
|
|
53
|
+
maxFiles,
|
|
54
|
+
multiple,
|
|
55
|
+
selectedCount: queue.current.current.length
|
|
56
|
+
}), combined = {
|
|
57
|
+
accepted: checked.accepted,
|
|
58
|
+
rejected: [...result.rejected, ...checked.rejected]
|
|
59
|
+
};
|
|
60
|
+
setRejected(combined.rejected);
|
|
61
|
+
onValidation?.(combined);
|
|
62
|
+
if (combined.rejected.length) onReject?.(combined.rejected);
|
|
63
|
+
if (checked.accepted.length) queue.add(checked.accepted);
|
|
64
|
+
};
|
|
65
|
+
const constraints = {
|
|
66
|
+
accept,
|
|
67
|
+
maxSize,
|
|
68
|
+
maxFiles,
|
|
69
|
+
multiple,
|
|
70
|
+
selectedCount: queue.files.length
|
|
71
|
+
}, picker = /* @__PURE__ */ jsx(
|
|
72
|
+
FilePicker,
|
|
73
|
+
{
|
|
74
|
+
...constraints,
|
|
75
|
+
label: `\u9009\u62E9${label}`,
|
|
76
|
+
disabled: blocked,
|
|
77
|
+
showErrors: false,
|
|
78
|
+
onFiles: () => {
|
|
79
|
+
},
|
|
80
|
+
onValidation: receive
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (!queue.files.length) setRejected((old) => old.length ? [] : old);
|
|
85
|
+
if (preview && !queue.files.some((file) => file.id === preview.id))
|
|
86
|
+
setPreview(void 0);
|
|
87
|
+
}, [queue.files, preview]);
|
|
88
|
+
return /* @__PURE__ */ jsxs(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
id: field.id,
|
|
92
|
+
role: "group",
|
|
93
|
+
"aria-label": label,
|
|
94
|
+
"aria-invalid": field.invalid,
|
|
95
|
+
"aria-describedby": field.descriptionId,
|
|
96
|
+
className: s.upload,
|
|
97
|
+
ref: root,
|
|
98
|
+
tabIndex: -1,
|
|
99
|
+
onFocus: (event) => {
|
|
100
|
+
if (event.target === root.current)
|
|
101
|
+
root.current.querySelector("button:not(:disabled)")?.focus();
|
|
102
|
+
},
|
|
103
|
+
children: [
|
|
104
|
+
draggable ? /* @__PURE__ */ jsx(
|
|
105
|
+
FileDropZone,
|
|
106
|
+
{
|
|
107
|
+
...constraints,
|
|
108
|
+
label: `${label}\u62D6\u62FD\u533A\u57DF`,
|
|
109
|
+
title: "\u6DFB\u52A0\u5230\u4E0A\u4F20\u5217\u8868",
|
|
110
|
+
disabled: blocked,
|
|
111
|
+
onFiles: () => {
|
|
112
|
+
},
|
|
113
|
+
onValidation: receive,
|
|
114
|
+
showErrors: false,
|
|
115
|
+
children: /* @__PURE__ */ jsxs("div", { className: s.drop, children: [
|
|
116
|
+
picker,
|
|
117
|
+
description && /* @__PURE__ */ jsx("div", { className: s.description, children: description })
|
|
118
|
+
] })
|
|
119
|
+
}
|
|
120
|
+
) : /* @__PURE__ */ jsxs("div", { className: s.row, children: [
|
|
121
|
+
picker,
|
|
122
|
+
description && /* @__PURE__ */ jsx("div", { className: s.description, children: description })
|
|
123
|
+
] }),
|
|
124
|
+
/* @__PURE__ */ jsx(FileSelectionFeedback, { rejections: rejected }),
|
|
125
|
+
!autoUpload && request && queue.files.some((file) => file.status === "ready") && /* @__PURE__ */ jsx("div", { className: s.row, children: /* @__PURE__ */ jsx(
|
|
126
|
+
Button,
|
|
127
|
+
{
|
|
128
|
+
size: "small",
|
|
129
|
+
disabled: blocked,
|
|
130
|
+
onClick: () => queue.files.filter((file) => file.status === "ready").forEach((file) => queue.start(file.id)),
|
|
131
|
+
children: "\u5F00\u59CB\u5168\u90E8\u4E0A\u4F20"
|
|
132
|
+
}
|
|
133
|
+
) }),
|
|
134
|
+
/* @__PURE__ */ jsx(
|
|
135
|
+
UploadList,
|
|
136
|
+
{
|
|
137
|
+
files: queue.files,
|
|
138
|
+
label: `${label}\u5217\u8868`,
|
|
139
|
+
disabled: blocked,
|
|
140
|
+
showThumbnails,
|
|
141
|
+
onStart: request ? queue.start : void 0,
|
|
142
|
+
onCancel: queue.cancel,
|
|
143
|
+
onRetry: request ? queue.retry : void 0,
|
|
144
|
+
onRemove: queue.remove,
|
|
145
|
+
onPreview: onPreview || ((file, source) => {
|
|
146
|
+
if (source) setPreview({ id: file.id, name: file.name, source });
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
/* @__PURE__ */ jsx(
|
|
151
|
+
Dialog,
|
|
152
|
+
{
|
|
153
|
+
open: !!preview,
|
|
154
|
+
onClose: () => setPreview(void 0),
|
|
155
|
+
title: preview?.name || "\u6587\u4EF6\u9884\u89C8",
|
|
156
|
+
children: preview && /* @__PURE__ */ jsx("img", { className: s.preview, src: preview.source, alt: preview.name })
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
export {
|
|
164
|
+
Upload
|
|
165
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.upload {
|
|
2
|
+
min-width: 0;
|
|
3
|
+
outline: none;
|
|
4
|
+
}
|
|
5
|
+
.drop {
|
|
6
|
+
border: 1px dashed color-mix(in srgb, var(--fg) 20%, var(--surface));
|
|
7
|
+
border-radius: var(--radius);
|
|
8
|
+
background: var(--canvas);
|
|
9
|
+
min-height: 132px;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
gap: 10px;
|
|
15
|
+
padding: 20px;
|
|
16
|
+
}
|
|
17
|
+
.description {
|
|
18
|
+
color: var(--muted);
|
|
19
|
+
font-size: 12px;
|
|
20
|
+
line-height: 20px;
|
|
21
|
+
overflow-wrap: anywhere;
|
|
22
|
+
}
|
|
23
|
+
.row {
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: 12px;
|
|
27
|
+
flex-wrap: wrap;
|
|
28
|
+
margin: 8px 0;
|
|
29
|
+
}
|
|
30
|
+
.preview {
|
|
31
|
+
display: block;
|
|
32
|
+
max-width: 100%;
|
|
33
|
+
max-height: 65vh;
|
|
34
|
+
object-fit: contain;
|
|
35
|
+
margin: auto;
|
|
36
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type UploadItemActions } from "./UploadListItem";
|
|
3
|
+
import type { UploadFile } from "./uploadTypes";
|
|
4
|
+
export type UploadListProps = UploadItemActions & {
|
|
5
|
+
files: UploadFile[];
|
|
6
|
+
label?: string;
|
|
7
|
+
emptyText?: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export declare function UploadList({ files, label, emptyText, ...actions }: UploadListProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { UploadListItem } from "./UploadListItem.js";
|
|
3
|
+
import s from "./UploadList.module.css";
|
|
4
|
+
function UploadList({
|
|
5
|
+
files,
|
|
6
|
+
label = "\u4E0A\u4F20\u6587\u4EF6\u5217\u8868",
|
|
7
|
+
emptyText = "\u5C1A\u672A\u6DFB\u52A0\u6587\u4EF6",
|
|
8
|
+
...actions
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ jsx("div", { className: s.root, children: files.length ? /* @__PURE__ */ jsx("ul", { className: s.list, "aria-label": label, children: files.map((file) => /* @__PURE__ */ jsx(UploadListItem, { file, ...actions }, file.id)) }) : /* @__PURE__ */ jsx("div", { role: "status", className: s.empty, children: emptyText }) });
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
UploadList
|
|
14
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
min-width: 0;
|
|
3
|
+
}
|
|
4
|
+
.list {
|
|
5
|
+
margin: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
list-style: none;
|
|
8
|
+
}
|
|
9
|
+
.item {
|
|
10
|
+
min-height: 84px;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: 12px;
|
|
14
|
+
min-width: 0;
|
|
15
|
+
padding: 14px 0;
|
|
16
|
+
animation: itemIn 140ms var(--ease);
|
|
17
|
+
}
|
|
18
|
+
.item + .item {
|
|
19
|
+
border-top: var(--separator-width) var(--separator-style)
|
|
20
|
+
var(--separator-color);
|
|
21
|
+
}
|
|
22
|
+
.thumbnail {
|
|
23
|
+
display: grid;
|
|
24
|
+
place-items: center;
|
|
25
|
+
flex: 0 0 42px;
|
|
26
|
+
width: 42px;
|
|
27
|
+
height: 42px;
|
|
28
|
+
border: 1px solid var(--line);
|
|
29
|
+
border-radius: 7px;
|
|
30
|
+
background: var(--soft);
|
|
31
|
+
color: var(--muted);
|
|
32
|
+
padding: 0;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
}
|
|
35
|
+
button.thumbnail {
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
}
|
|
38
|
+
.thumbnail img {
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
object-fit: cover;
|
|
42
|
+
}
|
|
43
|
+
.thumbnail > svg {
|
|
44
|
+
width: 20px;
|
|
45
|
+
height: 20px;
|
|
46
|
+
}
|
|
47
|
+
.body {
|
|
48
|
+
flex: 1;
|
|
49
|
+
min-width: 0;
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
gap: 6px;
|
|
53
|
+
}
|
|
54
|
+
.name {
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
text-overflow: ellipsis;
|
|
57
|
+
white-space: nowrap;
|
|
58
|
+
font-size: 12px;
|
|
59
|
+
line-height: 20px;
|
|
60
|
+
}
|
|
61
|
+
.meta {
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
gap: 12px;
|
|
65
|
+
flex-wrap: wrap;
|
|
66
|
+
font-size: 11px;
|
|
67
|
+
color: var(--muted);
|
|
68
|
+
line-height: 18px;
|
|
69
|
+
}
|
|
70
|
+
.status {
|
|
71
|
+
display: inline-flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
gap: 4px;
|
|
74
|
+
}
|
|
75
|
+
.status svg {
|
|
76
|
+
width: 13px;
|
|
77
|
+
height: 13px;
|
|
78
|
+
}
|
|
79
|
+
.item[data-status="success"] .status {
|
|
80
|
+
color: var(--success);
|
|
81
|
+
}
|
|
82
|
+
.item[data-status="error"] .status,
|
|
83
|
+
.error {
|
|
84
|
+
color: var(--danger);
|
|
85
|
+
}
|
|
86
|
+
.error {
|
|
87
|
+
font-size: 11px;
|
|
88
|
+
line-height: 18px;
|
|
89
|
+
overflow-wrap: anywhere;
|
|
90
|
+
}
|
|
91
|
+
.actions {
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
gap: 2px;
|
|
95
|
+
flex-shrink: 0;
|
|
96
|
+
}
|
|
97
|
+
.empty {
|
|
98
|
+
color: var(--muted);
|
|
99
|
+
font-size: 12px;
|
|
100
|
+
padding: 18px 0;
|
|
101
|
+
text-align: center;
|
|
102
|
+
}
|
|
103
|
+
@keyframes itemIn {
|
|
104
|
+
from {
|
|
105
|
+
opacity: 0;
|
|
106
|
+
transform: translateY(4px);
|
|
107
|
+
}
|
|
108
|
+
to {
|
|
109
|
+
opacity: 1;
|
|
110
|
+
transform: none;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
@media (max-width: 620px) {
|
|
114
|
+
.item {
|
|
115
|
+
gap: 8px;
|
|
116
|
+
}
|
|
117
|
+
.actions {
|
|
118
|
+
flex-direction: column;
|
|
119
|
+
}
|
|
120
|
+
.thumbnail {
|
|
121
|
+
width: 36px;
|
|
122
|
+
height: 36px;
|
|
123
|
+
flex-basis: 36px;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
@media (prefers-reduced-motion: reduce) {
|
|
127
|
+
.item {
|
|
128
|
+
animation: none;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { UploadFile } from "./uploadTypes";
|
|
2
|
+
export type UploadItemActions = {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
showThumbnails?: boolean;
|
|
5
|
+
onStart?(id: string): void;
|
|
6
|
+
onRetry?(id: string): void;
|
|
7
|
+
onCancel?(id: string): void;
|
|
8
|
+
onRemove?(id: string): void;
|
|
9
|
+
onPreview?(file: UploadFile, source?: string): void;
|
|
10
|
+
};
|
|
11
|
+
export declare function UploadListItem({ file, disabled, showThumbnails, onStart, onRetry, onCancel, onRemove, onPreview, }: UploadItemActions & {
|
|
12
|
+
file: UploadFile;
|
|
13
|
+
}): import("react").JSX.Element;
|