@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,102 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useId, useState } from "react";
|
|
3
|
+
import { Check, CircleAlert } from "lucide-react";
|
|
4
|
+
import { Spinner } from "./Spinner.js";
|
|
5
|
+
import s from "./Steps.module.css";
|
|
6
|
+
const statusNames = {
|
|
7
|
+
waiting: "\u672A\u5F00\u59CB",
|
|
8
|
+
current: "\u5F53\u524D\u6B65\u9AA4",
|
|
9
|
+
complete: "\u5DF2\u5B8C\u6210",
|
|
10
|
+
error: "\u53D1\u751F\u9519\u8BEF",
|
|
11
|
+
loading: "\u8FDB\u884C\u4E2D"
|
|
12
|
+
};
|
|
13
|
+
function Steps({
|
|
14
|
+
items,
|
|
15
|
+
value,
|
|
16
|
+
onChange,
|
|
17
|
+
orientation = "horizontal",
|
|
18
|
+
label = "\u6B65\u9AA4",
|
|
19
|
+
className = ""
|
|
20
|
+
}) {
|
|
21
|
+
const current = items.findIndex((item) => item.value === value), id = useId();
|
|
22
|
+
const [focused, setFocused] = useState(null);
|
|
23
|
+
useEffect(() => setFocused(null), [value]);
|
|
24
|
+
const enabled = items.filter((item) => !item.disabled);
|
|
25
|
+
const tabStop = enabled.find((item) => item.value === focused)?.value ?? enabled.find((item) => item.value === value)?.value ?? enabled[0]?.value;
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
"ol",
|
|
28
|
+
{
|
|
29
|
+
className: `${s.steps} ${className}`,
|
|
30
|
+
"aria-label": label,
|
|
31
|
+
"data-orientation": orientation,
|
|
32
|
+
onKeyDown: (event) => {
|
|
33
|
+
if (!onChange || !enabled.length) return;
|
|
34
|
+
const active = enabled.findIndex(
|
|
35
|
+
(item) => item.value === event.target.closest(
|
|
36
|
+
"[data-step-value]"
|
|
37
|
+
)?.dataset.stepValue
|
|
38
|
+
);
|
|
39
|
+
if (active < 0) return;
|
|
40
|
+
const previous = orientation === "horizontal" ? "ArrowLeft" : "ArrowUp", next = orientation === "horizontal" ? "ArrowRight" : "ArrowDown";
|
|
41
|
+
const index = event.key === "Home" ? 0 : event.key === "End" ? enabled.length - 1 : event.key === previous ? (active - 1 + enabled.length) % enabled.length : event.key === next ? (active + 1) % enabled.length : -1;
|
|
42
|
+
if (index < 0) return;
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
setFocused(enabled[index].value);
|
|
45
|
+
[
|
|
46
|
+
...event.currentTarget.querySelectorAll(
|
|
47
|
+
"[data-step-value]"
|
|
48
|
+
)
|
|
49
|
+
].find((node) => node.dataset.stepValue === enabled[index].value)?.focus();
|
|
50
|
+
},
|
|
51
|
+
children: items.map((item, index) => {
|
|
52
|
+
const status = item.status ?? (current < 0 || index > current ? "waiting" : index < current ? "complete" : "current");
|
|
53
|
+
const descriptionId = `${id}-${index}`;
|
|
54
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
55
|
+
/* @__PURE__ */ jsx("span", { className: s.marker, "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", { className: s.mark, children: status === "loading" ? /* @__PURE__ */ jsx(Spinner, { decorative: true }) : status === "complete" ? /* @__PURE__ */ jsx(Check, {}) : status === "error" ? /* @__PURE__ */ jsx(CircleAlert, {}) : item.icon || index + 1 }, status) }),
|
|
56
|
+
/* @__PURE__ */ jsxs("span", { className: s.copy, children: [
|
|
57
|
+
/* @__PURE__ */ jsx("span", { className: s.label, children: item.label }),
|
|
58
|
+
item.description && /* @__PURE__ */ jsx("span", { id: descriptionId, className: s.description, children: item.description })
|
|
59
|
+
] })
|
|
60
|
+
] });
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
"li",
|
|
63
|
+
{
|
|
64
|
+
className: s.item,
|
|
65
|
+
"data-status": status,
|
|
66
|
+
"data-disabled": item.disabled || void 0,
|
|
67
|
+
children: onChange ? /* @__PURE__ */ jsx(
|
|
68
|
+
"button",
|
|
69
|
+
{
|
|
70
|
+
type: "button",
|
|
71
|
+
className: s.control,
|
|
72
|
+
"data-step-value": item.value,
|
|
73
|
+
disabled: item.disabled,
|
|
74
|
+
tabIndex: item.value === tabStop ? 0 : -1,
|
|
75
|
+
"aria-current": index === current ? "step" : void 0,
|
|
76
|
+
"aria-label": `${item.label}\uFF0C${statusNames[status]}`,
|
|
77
|
+
"aria-describedby": item.description ? descriptionId : void 0,
|
|
78
|
+
onFocus: () => setFocused(item.value),
|
|
79
|
+
onClick: () => onChange(item.value),
|
|
80
|
+
children: content
|
|
81
|
+
}
|
|
82
|
+
) : /* @__PURE__ */ jsxs(
|
|
83
|
+
"div",
|
|
84
|
+
{
|
|
85
|
+
className: s.control,
|
|
86
|
+
"aria-current": index === current ? "step" : void 0,
|
|
87
|
+
children: [
|
|
88
|
+
content,
|
|
89
|
+
/* @__PURE__ */ jsx("span", { className: s.srOnly, children: statusNames[status] })
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
},
|
|
94
|
+
item.value
|
|
95
|
+
);
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
Steps
|
|
102
|
+
};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
.steps {
|
|
2
|
+
list-style: none;
|
|
3
|
+
display: flex;
|
|
4
|
+
min-width: 0;
|
|
5
|
+
margin: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
gap: 0;
|
|
8
|
+
}
|
|
9
|
+
.item {
|
|
10
|
+
position: relative;
|
|
11
|
+
flex: 1;
|
|
12
|
+
min-width: 0;
|
|
13
|
+
padding-right: 20px;
|
|
14
|
+
isolation: isolate;
|
|
15
|
+
}
|
|
16
|
+
.item:last-child {
|
|
17
|
+
padding-right: 0;
|
|
18
|
+
}
|
|
19
|
+
.item:not(:last-child)::before,
|
|
20
|
+
.item:not(:last-child)::after {
|
|
21
|
+
content: "";
|
|
22
|
+
position: absolute;
|
|
23
|
+
left: 34px;
|
|
24
|
+
right: 8px;
|
|
25
|
+
top: 12px;
|
|
26
|
+
height: var(--separator-width);
|
|
27
|
+
background: var(--separator-color);
|
|
28
|
+
z-index: -1;
|
|
29
|
+
}
|
|
30
|
+
.item:not(:last-child)::after {
|
|
31
|
+
background: var(--accent);
|
|
32
|
+
transform: scaleX(0);
|
|
33
|
+
transform-origin: left;
|
|
34
|
+
transition:
|
|
35
|
+
transform var(--motion-segment) var(--ease),
|
|
36
|
+
background var(--motion-hover);
|
|
37
|
+
}
|
|
38
|
+
.item[data-status="complete"]::after {
|
|
39
|
+
transform: scaleX(1);
|
|
40
|
+
}
|
|
41
|
+
.control {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: flex-start;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
gap: 9px;
|
|
46
|
+
width: 100%;
|
|
47
|
+
min-width: 0;
|
|
48
|
+
padding: 0;
|
|
49
|
+
border: 0;
|
|
50
|
+
border-radius: max(4px, calc(var(--radius) - 3px));
|
|
51
|
+
background: transparent;
|
|
52
|
+
color: var(--muted);
|
|
53
|
+
text-align: left;
|
|
54
|
+
font-size: 12px;
|
|
55
|
+
}
|
|
56
|
+
.marker {
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
width: 26px;
|
|
61
|
+
height: 26px;
|
|
62
|
+
flex: none;
|
|
63
|
+
border: 1px solid var(--line);
|
|
64
|
+
border-radius: 50%;
|
|
65
|
+
color: var(--muted);
|
|
66
|
+
background: var(--surface);
|
|
67
|
+
transition:
|
|
68
|
+
color var(--motion-hover),
|
|
69
|
+
background var(--motion-hover),
|
|
70
|
+
border-color var(--motion-hover),
|
|
71
|
+
box-shadow var(--motion-hover);
|
|
72
|
+
}
|
|
73
|
+
.mark {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
animation: mark-in var(--motion-segment) var(--ease);
|
|
78
|
+
}
|
|
79
|
+
.mark > svg {
|
|
80
|
+
width: 15px;
|
|
81
|
+
height: 15px;
|
|
82
|
+
}
|
|
83
|
+
.copy {
|
|
84
|
+
display: flex;
|
|
85
|
+
min-width: 0;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
gap: 4px;
|
|
88
|
+
line-height: 20px;
|
|
89
|
+
overflow-wrap: anywhere;
|
|
90
|
+
}
|
|
91
|
+
.label {
|
|
92
|
+
color: var(--fg);
|
|
93
|
+
transition: color var(--motion-hover);
|
|
94
|
+
}
|
|
95
|
+
.description {
|
|
96
|
+
color: var(--muted);
|
|
97
|
+
font-size: 11px;
|
|
98
|
+
line-height: 18px;
|
|
99
|
+
}
|
|
100
|
+
.item[data-status="current"] .marker,
|
|
101
|
+
.item[data-status="loading"] .marker {
|
|
102
|
+
color: var(--on-accent);
|
|
103
|
+
background: var(--accent);
|
|
104
|
+
border-color: var(--accent);
|
|
105
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 9%, transparent);
|
|
106
|
+
}
|
|
107
|
+
.item[data-status="complete"] .marker {
|
|
108
|
+
color: var(--accent);
|
|
109
|
+
background: color-mix(in srgb, var(--accent) 9%, var(--surface));
|
|
110
|
+
border-color: color-mix(in srgb, var(--accent) 35%, var(--surface));
|
|
111
|
+
}
|
|
112
|
+
.item[data-status="error"] .marker {
|
|
113
|
+
color: var(--danger);
|
|
114
|
+
border-color: var(--danger);
|
|
115
|
+
background: color-mix(in srgb, var(--danger) 8%, var(--surface));
|
|
116
|
+
}
|
|
117
|
+
.item[data-status="error"] .label {
|
|
118
|
+
color: var(--danger);
|
|
119
|
+
}
|
|
120
|
+
.control:is(button):hover:not(:disabled) .marker {
|
|
121
|
+
border-color: var(--accent);
|
|
122
|
+
}
|
|
123
|
+
.control:is(button):hover:not(:disabled) .label {
|
|
124
|
+
color: var(--accent);
|
|
125
|
+
}
|
|
126
|
+
.control:focus-visible {
|
|
127
|
+
outline-offset: 5px;
|
|
128
|
+
}
|
|
129
|
+
.item[data-disabled="true"] .control {
|
|
130
|
+
opacity: 0.42;
|
|
131
|
+
}
|
|
132
|
+
.steps[data-orientation="vertical"] {
|
|
133
|
+
flex-direction: column;
|
|
134
|
+
}
|
|
135
|
+
.steps[data-orientation="vertical"] .item {
|
|
136
|
+
padding: 0 0 24px;
|
|
137
|
+
}
|
|
138
|
+
.steps[data-orientation="vertical"] .item:last-child {
|
|
139
|
+
padding-bottom: 0;
|
|
140
|
+
}
|
|
141
|
+
.steps[data-orientation="vertical"] .control {
|
|
142
|
+
flex-direction: row;
|
|
143
|
+
gap: 12px;
|
|
144
|
+
}
|
|
145
|
+
.steps[data-orientation="vertical"] .copy {
|
|
146
|
+
padding-top: 3px;
|
|
147
|
+
}
|
|
148
|
+
.steps[data-orientation="vertical"] .item:not(:last-child)::before,
|
|
149
|
+
.steps[data-orientation="vertical"] .item:not(:last-child)::after {
|
|
150
|
+
left: 12px;
|
|
151
|
+
right: auto;
|
|
152
|
+
top: 34px;
|
|
153
|
+
bottom: 8px;
|
|
154
|
+
width: var(--separator-width);
|
|
155
|
+
height: auto;
|
|
156
|
+
}
|
|
157
|
+
.steps[data-orientation="vertical"] .item:not(:last-child)::after {
|
|
158
|
+
transform: scaleY(0);
|
|
159
|
+
transform-origin: top;
|
|
160
|
+
}
|
|
161
|
+
.steps[data-orientation="vertical"] .item[data-status="complete"]::after {
|
|
162
|
+
transform: scaleY(1);
|
|
163
|
+
}
|
|
164
|
+
.srOnly {
|
|
165
|
+
composes: visuallyHidden from "./Accessibility.module.css";
|
|
166
|
+
}
|
|
167
|
+
@keyframes mark-in {
|
|
168
|
+
from {
|
|
169
|
+
opacity: 0;
|
|
170
|
+
transform: scale(0.85);
|
|
171
|
+
}
|
|
172
|
+
to {
|
|
173
|
+
opacity: 1;
|
|
174
|
+
transform: scale(1);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import s from "./Switch.module.css";
|
|
3
|
+
function Switch({
|
|
4
|
+
checked,
|
|
5
|
+
onChange,
|
|
6
|
+
label,
|
|
7
|
+
disabled
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
"button",
|
|
11
|
+
{
|
|
12
|
+
type: "button",
|
|
13
|
+
role: "switch",
|
|
14
|
+
"aria-label": label,
|
|
15
|
+
"aria-checked": checked,
|
|
16
|
+
disabled,
|
|
17
|
+
className: s.switch,
|
|
18
|
+
onClick: () => onChange(!checked),
|
|
19
|
+
children: /* @__PURE__ */ jsx("span", {})
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
Switch
|
|
25
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.switch {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 36px;
|
|
4
|
+
height: 22px;
|
|
5
|
+
flex-shrink: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
border: 1px solid color-mix(in srgb, var(--fg) 25%, var(--surface));
|
|
8
|
+
border-radius: 999px;
|
|
9
|
+
background: var(--field);
|
|
10
|
+
transition:
|
|
11
|
+
background-color var(--motion-panel) var(--ease),
|
|
12
|
+
border-color var(--motion-panel) var(--ease),
|
|
13
|
+
box-shadow var(--motion-hover);
|
|
14
|
+
}
|
|
15
|
+
.switch span {
|
|
16
|
+
position: absolute;
|
|
17
|
+
left: 3px;
|
|
18
|
+
top: 3px;
|
|
19
|
+
width: 14px;
|
|
20
|
+
height: 14px;
|
|
21
|
+
border-radius: 50%;
|
|
22
|
+
background: var(--muted);
|
|
23
|
+
transition:
|
|
24
|
+
transform var(--motion-panel) var(--ease),
|
|
25
|
+
width var(--motion-press) var(--ease),
|
|
26
|
+
background-color var(--motion-panel);
|
|
27
|
+
}
|
|
28
|
+
.switch:hover:not(:disabled) {
|
|
29
|
+
background: var(--hover);
|
|
30
|
+
border-color: var(--muted);
|
|
31
|
+
}
|
|
32
|
+
.switch[aria-checked="true"] {
|
|
33
|
+
background: var(--switch-on, var(--accent));
|
|
34
|
+
border-color: var(--switch-on, var(--accent));
|
|
35
|
+
}
|
|
36
|
+
.switch[aria-checked="true"]:hover:not(:disabled) {
|
|
37
|
+
background: var(
|
|
38
|
+
--switch-on-hover,
|
|
39
|
+
color-mix(in srgb, var(--accent) 88%, var(--fg))
|
|
40
|
+
);
|
|
41
|
+
border-color: var(--switch-on, var(--accent));
|
|
42
|
+
}
|
|
43
|
+
.switch[aria-checked="true"] span {
|
|
44
|
+
transform: translateX(14px);
|
|
45
|
+
background: var(--switch-thumb-on, var(--on-accent));
|
|
46
|
+
}
|
|
47
|
+
.switch:active:not(:disabled) span {
|
|
48
|
+
width: 17px;
|
|
49
|
+
}
|
|
50
|
+
.switch[aria-checked="true"]:active:not(:disabled) span {
|
|
51
|
+
transform: translateX(11px);
|
|
52
|
+
}
|
|
53
|
+
.switch:focus-visible {
|
|
54
|
+
outline: 0;
|
|
55
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
|
|
56
|
+
}
|
|
57
|
+
.switch:disabled {
|
|
58
|
+
opacity: 0.4;
|
|
59
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CharacterPicker } from "./CharacterPicker.js";
|
|
3
|
+
import { useCharacterCatalog } from "./characterCatalog.js";
|
|
4
|
+
function SymbolPicker(props) {
|
|
5
|
+
const { retry, ...catalog } = useCharacterCatalog("symbols");
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
CharacterPicker,
|
|
8
|
+
{
|
|
9
|
+
...props,
|
|
10
|
+
...catalog,
|
|
11
|
+
onRetry: retry,
|
|
12
|
+
label: props.label || "\u7B26\u53F7"
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
SymbolPicker
|
|
18
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
.viewport {
|
|
2
|
+
overflow: auto;
|
|
3
|
+
min-width: 0;
|
|
4
|
+
max-width: 100%;
|
|
5
|
+
}
|
|
6
|
+
.tabs {
|
|
7
|
+
position: relative;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: stretch;
|
|
10
|
+
gap: 4px;
|
|
11
|
+
width: max-content;
|
|
12
|
+
min-width: 100%;
|
|
13
|
+
isolation: isolate;
|
|
14
|
+
}
|
|
15
|
+
.tabs button {
|
|
16
|
+
position: relative;
|
|
17
|
+
z-index: 1;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
gap: 7px;
|
|
22
|
+
white-space: nowrap;
|
|
23
|
+
border: 0;
|
|
24
|
+
background: transparent;
|
|
25
|
+
min-height: 34px;
|
|
26
|
+
padding: 7px 12px;
|
|
27
|
+
font-size: 12px;
|
|
28
|
+
color: var(--muted);
|
|
29
|
+
border-radius: 6px;
|
|
30
|
+
transition:
|
|
31
|
+
color var(--motion-hover),
|
|
32
|
+
background var(--motion-hover);
|
|
33
|
+
}
|
|
34
|
+
.tabs button:hover:not(:disabled) {
|
|
35
|
+
color: var(--fg);
|
|
36
|
+
}
|
|
37
|
+
.tabs button[aria-selected="true"] {
|
|
38
|
+
color: var(--fg);
|
|
39
|
+
}
|
|
40
|
+
.tabs button:focus-visible {
|
|
41
|
+
outline-offset: -2px;
|
|
42
|
+
}
|
|
43
|
+
.indicator {
|
|
44
|
+
position: absolute;
|
|
45
|
+
z-index: 0;
|
|
46
|
+
pointer-events: none;
|
|
47
|
+
opacity: var(--tab-opacity, 0);
|
|
48
|
+
left: 0;
|
|
49
|
+
top: 0;
|
|
50
|
+
transform: translate(var(--tab-x, 0px), var(--tab-y, 0px));
|
|
51
|
+
width: var(--tab-width, 0px);
|
|
52
|
+
height: var(--tab-height, 0px);
|
|
53
|
+
background: var(--selected);
|
|
54
|
+
border-radius: 6px;
|
|
55
|
+
}
|
|
56
|
+
.tabs[data-ready="true"] .indicator {
|
|
57
|
+
transition:
|
|
58
|
+
transform var(--motion-segment) var(--ease),
|
|
59
|
+
width var(--motion-segment) var(--ease),
|
|
60
|
+
height var(--motion-segment) var(--ease),
|
|
61
|
+
opacity var(--motion-hover);
|
|
62
|
+
}
|
|
63
|
+
.viewport[data-orientation="vertical"] {
|
|
64
|
+
width: 112px;
|
|
65
|
+
flex: 0 0 112px;
|
|
66
|
+
}
|
|
67
|
+
.viewport[data-orientation="vertical"] .tabs {
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
width: 100%;
|
|
70
|
+
min-width: 0;
|
|
71
|
+
}
|
|
72
|
+
.viewport[data-orientation="vertical"] button {
|
|
73
|
+
justify-content: flex-start;
|
|
74
|
+
padding: 7px 9px;
|
|
75
|
+
min-height: 34px;
|
|
76
|
+
}
|
|
77
|
+
.underlined {
|
|
78
|
+
gap: 16px;
|
|
79
|
+
border-bottom: var(--separator-width) var(--separator-style)
|
|
80
|
+
var(--separator-color);
|
|
81
|
+
}
|
|
82
|
+
.underlined button {
|
|
83
|
+
padding: 9px 2px;
|
|
84
|
+
border-radius: 0;
|
|
85
|
+
}
|
|
86
|
+
.underlined .indicator {
|
|
87
|
+
top: auto;
|
|
88
|
+
bottom: -1px;
|
|
89
|
+
height: 2px;
|
|
90
|
+
transform: translateX(var(--tab-x, 0px));
|
|
91
|
+
background: var(--accent);
|
|
92
|
+
border-radius: 2px;
|
|
93
|
+
}
|
|
94
|
+
.underlined button[aria-selected="true"] {
|
|
95
|
+
color: var(--accent);
|
|
96
|
+
}
|
|
97
|
+
@media (max-width: 450px) {
|
|
98
|
+
.viewport[data-orientation="vertical"] {
|
|
99
|
+
width: 94px;
|
|
100
|
+
flex-basis: 94px;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.blocked button:hover:not(:disabled) {
|
|
105
|
+
background: color-mix(in srgb, var(--hover) 55%, transparent);
|
|
106
|
+
}
|
|
107
|
+
.underlined button:hover:not(:disabled) {
|
|
108
|
+
background: transparent;
|
|
109
|
+
color: var(--accent);
|
|
110
|
+
}
|
|
111
|
+
.tabs button {
|
|
112
|
+
min-height: var(--tab-height-min);
|
|
113
|
+
font-size: var(--field-font-size);
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
}
|
|
116
|
+
.blocked {
|
|
117
|
+
width: var(--blocked-width);
|
|
118
|
+
min-width: var(--blocked-min-width);
|
|
119
|
+
padding: var(--blocked-padding);
|
|
120
|
+
border: var(--blocked-border);
|
|
121
|
+
background: var(--blocked-background);
|
|
122
|
+
border-radius: var(--blocked-radius);
|
|
123
|
+
}
|
|
124
|
+
.blocked .indicator {
|
|
125
|
+
background: var(--blocked-selected);
|
|
126
|
+
box-shadow: var(--blocked-shadow);
|
|
127
|
+
}
|
|
128
|
+
.blocked button {
|
|
129
|
+
min-height: var(--blocked-height);
|
|
130
|
+
padding: var(--blocked-button-padding);
|
|
131
|
+
}
|
|
132
|
+
.blocked button[aria-selected="true"] {
|
|
133
|
+
color: var(--tab-selected-color);
|
|
134
|
+
}
|
|
135
|
+
.tabs button:disabled {
|
|
136
|
+
opacity: 0.45;
|
|
137
|
+
cursor: not-allowed;
|
|
138
|
+
}
|
|
139
|
+
.viewport[data-orientation="vertical"] {
|
|
140
|
+
width: var(--vertical-tab-width);
|
|
141
|
+
flex-basis: var(--vertical-tab-width);
|
|
142
|
+
}
|
|
143
|
+
.viewport[data-orientation="vertical"] .blocked {
|
|
144
|
+
width: 100%;
|
|
145
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type TabOption } from "./useTabIndicator";
|
|
2
|
+
export type TabListProps<T extends string> = {
|
|
3
|
+
value: T;
|
|
4
|
+
onChange(value: T): void;
|
|
5
|
+
options: TabOption<T>[];
|
|
6
|
+
label: string;
|
|
7
|
+
orientation?: "horizontal" | "vertical";
|
|
8
|
+
};
|
|
9
|
+
export declare function TabList<T extends string>({ value, onChange, options, label, orientation, variant, }: TabListProps<T> & {
|
|
10
|
+
variant: "blocked" | "underlined";
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTabIndicator } from "./useTabIndicator.js";
|
|
3
|
+
import s from "./Tab.module.css";
|
|
4
|
+
function TabList({
|
|
5
|
+
value,
|
|
6
|
+
onChange,
|
|
7
|
+
options,
|
|
8
|
+
label,
|
|
9
|
+
orientation = "horizontal",
|
|
10
|
+
variant
|
|
11
|
+
}) {
|
|
12
|
+
const { root, onKeyDown } = useTabIndicator(
|
|
13
|
+
value,
|
|
14
|
+
options,
|
|
15
|
+
onChange,
|
|
16
|
+
orientation
|
|
17
|
+
);
|
|
18
|
+
return /* @__PURE__ */ jsx("div", { className: s.viewport, "data-orientation": orientation, children: /* @__PURE__ */ jsxs(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
ref: root,
|
|
22
|
+
className: `${s.tabs} ${s[variant]}`,
|
|
23
|
+
role: "tablist",
|
|
24
|
+
"aria-label": label,
|
|
25
|
+
"aria-orientation": orientation,
|
|
26
|
+
onKeyDown,
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ jsx("span", { className: s.indicator, "aria-hidden": "true" }),
|
|
29
|
+
options.map((option) => /* @__PURE__ */ jsx(
|
|
30
|
+
"button",
|
|
31
|
+
{
|
|
32
|
+
type: "button",
|
|
33
|
+
role: "tab",
|
|
34
|
+
"data-value": option.value,
|
|
35
|
+
id: option.id,
|
|
36
|
+
"aria-controls": option.panelId,
|
|
37
|
+
"aria-selected": value === option.value,
|
|
38
|
+
disabled: option.disabled,
|
|
39
|
+
tabIndex: (options.some((item) => item.value === value && !item.disabled) ? value === option.value : option === options.find((item) => !item.disabled)) ? 0 : -1,
|
|
40
|
+
onClick: () => onChange(option.value),
|
|
41
|
+
children: option.label
|
|
42
|
+
},
|
|
43
|
+
option.value
|
|
44
|
+
))
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
) });
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
TabList
|
|
51
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactNode, HTMLAttributes, CSSProperties } from "react";
|
|
2
|
+
export interface Column<T> {
|
|
3
|
+
key: string;
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
render: (row: T) => ReactNode;
|
|
6
|
+
align?: "left" | "center" | "right";
|
|
7
|
+
width?: CSSProperties["width"];
|
|
8
|
+
}
|
|
9
|
+
export declare function Table<T>({ columns, rows, rowKey, label, role, rowAttributes, }: {
|
|
10
|
+
columns: Column<T>[];
|
|
11
|
+
rows: T[];
|
|
12
|
+
rowKey: (row: T) => string;
|
|
13
|
+
label: string;
|
|
14
|
+
role?: "table" | "treegrid";
|
|
15
|
+
rowAttributes?(row: T): HTMLAttributes<HTMLTableRowElement>;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import s from "./Table.module.css";
|
|
3
|
+
function Table({
|
|
4
|
+
columns,
|
|
5
|
+
rows,
|
|
6
|
+
rowKey,
|
|
7
|
+
label,
|
|
8
|
+
role,
|
|
9
|
+
rowAttributes
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ jsx("div", { className: s.scroll, role: "region", "aria-label": label, tabIndex: 0, children: /* @__PURE__ */ jsxs("table", { className: s.table, role, children: [
|
|
12
|
+
/* @__PURE__ */ jsx("caption", { className: s.caption, children: label }),
|
|
13
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: columns.map((c) => /* @__PURE__ */ jsx(
|
|
14
|
+
"th",
|
|
15
|
+
{
|
|
16
|
+
scope: "col",
|
|
17
|
+
style: { textAlign: c.align, width: c.width },
|
|
18
|
+
children: c.title
|
|
19
|
+
},
|
|
20
|
+
c.key
|
|
21
|
+
)) }) }),
|
|
22
|
+
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
23
|
+
rows.map((r) => /* @__PURE__ */ jsx("tr", { ...rowAttributes?.(r), children: columns.map((c) => /* @__PURE__ */ jsx("td", { style: { textAlign: c.align }, children: c.render(r) }, c.key)) }, rowKey(r))),
|
|
24
|
+
rows.length === 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: columns.length, className: s.empty, children: "\u6682\u65E0\u7ED3\u679C" }) })
|
|
25
|
+
] })
|
|
26
|
+
] }) });
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
Table
|
|
30
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
.scroll {
|
|
2
|
+
overflow-x: auto;
|
|
3
|
+
border-radius: var(--radius);
|
|
4
|
+
max-width: 100%;
|
|
5
|
+
}
|
|
6
|
+
.table {
|
|
7
|
+
border-collapse: collapse;
|
|
8
|
+
width: 100%;
|
|
9
|
+
font-size: 13px;
|
|
10
|
+
text-align: left;
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
}
|
|
13
|
+
.table th {
|
|
14
|
+
color: var(--muted);
|
|
15
|
+
font-size: 11px;
|
|
16
|
+
font-weight: 500;
|
|
17
|
+
background: var(--canvas);
|
|
18
|
+
padding: 12px 16px;
|
|
19
|
+
}
|
|
20
|
+
.table td {
|
|
21
|
+
padding: 15px 16px;
|
|
22
|
+
border-bottom: 1px solid var(--line);
|
|
23
|
+
}
|
|
24
|
+
.table tbody tr:last-child td {
|
|
25
|
+
border-bottom: 0;
|
|
26
|
+
}
|
|
27
|
+
.table tbody tr {
|
|
28
|
+
transition: background var(--motion-hover);
|
|
29
|
+
}
|
|
30
|
+
.table tbody tr:hover {
|
|
31
|
+
background: var(--hover);
|
|
32
|
+
}
|
|
33
|
+
.empty {
|
|
34
|
+
text-align: center;
|
|
35
|
+
height: 150px;
|
|
36
|
+
color: var(--muted);
|
|
37
|
+
}
|
|
38
|
+
.caption {
|
|
39
|
+
position: absolute;
|
|
40
|
+
width: 1px;
|
|
41
|
+
height: 1px;
|
|
42
|
+
padding: 0;
|
|
43
|
+
margin: -1px;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
clip: rect(0, 0, 0, 0);
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
border: 0;
|
|
48
|
+
}
|