@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,76 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import { ListFilter } from "lucide-react";
|
|
4
|
+
import { Popover } from "./Popover.js";
|
|
5
|
+
import { MenuItem } from "./MenuItem.js";
|
|
6
|
+
import { Button } from "./Button.js";
|
|
7
|
+
import { usePopover } from "./usePopover.js";
|
|
8
|
+
import { moveMenuFocus } from "./menuFocus.js";
|
|
9
|
+
import s from "./DataTable.module.css";
|
|
10
|
+
function TableColumnFilter({
|
|
11
|
+
label,
|
|
12
|
+
options,
|
|
13
|
+
value,
|
|
14
|
+
onChange
|
|
15
|
+
}) {
|
|
16
|
+
const pop = usePopover(), list = useRef(null);
|
|
17
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
18
|
+
/* @__PURE__ */ jsx(
|
|
19
|
+
"button",
|
|
20
|
+
{
|
|
21
|
+
type: "button",
|
|
22
|
+
ref: pop.anchor,
|
|
23
|
+
className: s.filter,
|
|
24
|
+
"aria-label": "\u7B5B\u9009" + label,
|
|
25
|
+
"aria-expanded": pop.open,
|
|
26
|
+
"aria-haspopup": "dialog",
|
|
27
|
+
"data-active": value.length > 0,
|
|
28
|
+
onClick: pop.toggle,
|
|
29
|
+
children: /* @__PURE__ */ jsx(ListFilter, {})
|
|
30
|
+
}
|
|
31
|
+
),
|
|
32
|
+
/* @__PURE__ */ jsxs(
|
|
33
|
+
Popover,
|
|
34
|
+
{
|
|
35
|
+
anchor: pop.anchor,
|
|
36
|
+
open: pop.open,
|
|
37
|
+
onClose: pop.close,
|
|
38
|
+
label: label + "\u7B5B\u9009",
|
|
39
|
+
width: 210,
|
|
40
|
+
onKeyDown: (event) => moveMenuFocus(event, list.current),
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ jsx("div", { ref: list, className: s.filterPanel, children: options.map((option) => {
|
|
43
|
+
const checked = value.includes(option);
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
45
|
+
MenuItem,
|
|
46
|
+
{
|
|
47
|
+
role: "checkbox",
|
|
48
|
+
"aria-checked": checked,
|
|
49
|
+
label: option,
|
|
50
|
+
selected: checked,
|
|
51
|
+
selection: "checkbox",
|
|
52
|
+
onClick: () => onChange(
|
|
53
|
+
checked ? value.filter((item) => item !== option) : [...value, option]
|
|
54
|
+
)
|
|
55
|
+
},
|
|
56
|
+
option
|
|
57
|
+
);
|
|
58
|
+
}) }),
|
|
59
|
+
/* @__PURE__ */ jsx("div", { className: s.filterReset, children: /* @__PURE__ */ jsx(
|
|
60
|
+
Button,
|
|
61
|
+
{
|
|
62
|
+
size: "small",
|
|
63
|
+
variant: "ghost",
|
|
64
|
+
disabled: !value.length,
|
|
65
|
+
onClick: () => onChange([]),
|
|
66
|
+
children: "\u91CD\u7F6E\u7B5B\u9009"
|
|
67
|
+
}
|
|
68
|
+
) })
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
TableColumnFilter
|
|
76
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type TableVisibilityColumn = {
|
|
2
|
+
key: string;
|
|
3
|
+
label: string;
|
|
4
|
+
hideable?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare function TableColumnVisibility({ columns, value, onChange, label, }: {
|
|
7
|
+
columns: TableVisibilityColumn[];
|
|
8
|
+
value: string[];
|
|
9
|
+
onChange(keys: string[]): void;
|
|
10
|
+
label?: string;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { moveMenuFocus } from "./menuFocus.js";
|
|
3
|
+
import { useId, useRef } from "react";
|
|
4
|
+
import { Columns3 } from "lucide-react";
|
|
5
|
+
import { Button } from "./Button.js";
|
|
6
|
+
import { MenuItem } from "./MenuItem.js";
|
|
7
|
+
import { Popover } from "./Popover.js";
|
|
8
|
+
import { usePopover } from "./usePopover.js";
|
|
9
|
+
import s from "./DataTable.module.css";
|
|
10
|
+
function TableColumnVisibility({
|
|
11
|
+
columns,
|
|
12
|
+
value,
|
|
13
|
+
onChange,
|
|
14
|
+
label = "\u663E\u793A\u5217"
|
|
15
|
+
}) {
|
|
16
|
+
const pop = usePopover(), id = useId(), root = useRef(null);
|
|
17
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
18
|
+
/* @__PURE__ */ jsxs(
|
|
19
|
+
Button,
|
|
20
|
+
{
|
|
21
|
+
ref: pop.anchor,
|
|
22
|
+
"aria-label": label,
|
|
23
|
+
"aria-haspopup": "menu",
|
|
24
|
+
"aria-expanded": pop.open,
|
|
25
|
+
"aria-controls": id,
|
|
26
|
+
onClick: pop.toggle,
|
|
27
|
+
onKeyDown: (event) => {
|
|
28
|
+
if (event.key === "ArrowDown" && !pop.open) {
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
pop.toggle();
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsx(Columns3, {}),
|
|
35
|
+
"\u663E\u793A\u5217"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
Popover,
|
|
41
|
+
{
|
|
42
|
+
anchor: pop.anchor,
|
|
43
|
+
open: pop.open,
|
|
44
|
+
onClose: pop.close,
|
|
45
|
+
id,
|
|
46
|
+
role: "menu",
|
|
47
|
+
label,
|
|
48
|
+
width: 230,
|
|
49
|
+
onKeyDown: (event) => moveMenuFocus(event, root.current),
|
|
50
|
+
children: /* @__PURE__ */ jsx("div", { ref: root, className: s.columnMenu, children: columns.map((column) => {
|
|
51
|
+
const selected = value.includes(column.key);
|
|
52
|
+
return /* @__PURE__ */ jsx(
|
|
53
|
+
MenuItem,
|
|
54
|
+
{
|
|
55
|
+
role: "menuitemcheckbox",
|
|
56
|
+
"aria-checked": selected,
|
|
57
|
+
label: column.label,
|
|
58
|
+
selected,
|
|
59
|
+
selection: "checkbox",
|
|
60
|
+
disabled: column.hideable === false || selected && value.length === 1,
|
|
61
|
+
onClick: () => onChange(
|
|
62
|
+
selected ? value.filter((key) => key !== column.key) : columns.filter(
|
|
63
|
+
(item) => value.includes(item.key) || item.key === column.key
|
|
64
|
+
).map((item) => item.key)
|
|
65
|
+
)
|
|
66
|
+
},
|
|
67
|
+
column.key
|
|
68
|
+
);
|
|
69
|
+
}) })
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
TableColumnVisibility
|
|
76
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export declare function Tabs({ tabs, value, onChange, label, variant, }: {
|
|
3
|
+
tabs: {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
content?: ReactNode;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}[];
|
|
9
|
+
value: string;
|
|
10
|
+
onChange: (v: string) => void;
|
|
11
|
+
label?: string;
|
|
12
|
+
variant?: "underline" | "segment";
|
|
13
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import s from "./Tabs.module.css";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { TabList } from "./TabList.js";
|
|
5
|
+
function Tabs({
|
|
6
|
+
tabs,
|
|
7
|
+
value,
|
|
8
|
+
onChange,
|
|
9
|
+
label = "\u9009\u9879",
|
|
10
|
+
variant = "underline"
|
|
11
|
+
}) {
|
|
12
|
+
const id = useId();
|
|
13
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14
|
+
/* @__PURE__ */ jsx(
|
|
15
|
+
TabList,
|
|
16
|
+
{
|
|
17
|
+
value,
|
|
18
|
+
onChange,
|
|
19
|
+
label,
|
|
20
|
+
variant: variant === "segment" ? "blocked" : "underlined",
|
|
21
|
+
options: tabs.map((t) => ({
|
|
22
|
+
value: t.id,
|
|
23
|
+
label: t.label,
|
|
24
|
+
disabled: t.disabled,
|
|
25
|
+
id: id + t.id,
|
|
26
|
+
panelId: t.content ? id + "panel" + t.id : void 0
|
|
27
|
+
}))
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
tabs.map(
|
|
31
|
+
(t) => t.content && /* @__PURE__ */ jsx(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
role: "tabpanel",
|
|
35
|
+
id: id + "panel" + t.id,
|
|
36
|
+
"aria-labelledby": id + t.id,
|
|
37
|
+
hidden: value !== t.id,
|
|
38
|
+
tabIndex: 0,
|
|
39
|
+
className: s.panel,
|
|
40
|
+
children: t.content
|
|
41
|
+
},
|
|
42
|
+
t.id
|
|
43
|
+
)
|
|
44
|
+
)
|
|
45
|
+
] });
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
Tabs
|
|
49
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type FieldOptions } from "./field";
|
|
2
|
+
export declare function TagInput({ value, onChange, label, placeholder, maxTags, maxTagLength, caseSensitive, validateTag, ...props }: FieldOptions & {
|
|
3
|
+
value: string[];
|
|
4
|
+
onChange(value: string[]): void;
|
|
5
|
+
label?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
maxTags?: number;
|
|
8
|
+
maxTagLength?: number;
|
|
9
|
+
caseSensitive?: boolean;
|
|
10
|
+
validateTag?(tag: string): string | undefined;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState } from "react";
|
|
3
|
+
import { SelectionTag } from "./SelectionTag.js";
|
|
4
|
+
import { FormField } from "./FormField.js";
|
|
5
|
+
import { joinIds, useFieldControl } from "./field.js";
|
|
6
|
+
import s from "./TagInput.module.css";
|
|
7
|
+
function TagInput({
|
|
8
|
+
value,
|
|
9
|
+
onChange,
|
|
10
|
+
label,
|
|
11
|
+
placeholder = "\u8F93\u5165\u540E\u6309\u56DE\u8F66",
|
|
12
|
+
maxTags = Infinity,
|
|
13
|
+
maxTagLength = 32,
|
|
14
|
+
caseSensitive = false,
|
|
15
|
+
validateTag,
|
|
16
|
+
...props
|
|
17
|
+
}) {
|
|
18
|
+
const field = useFieldControl({ ...props, label }), input = useRef(null), root = useRef(null), [draft, setDraft] = useState(""), [error, setError] = useState("");
|
|
19
|
+
const add = (texts) => {
|
|
20
|
+
if (field.disabled || field.readOnly) return;
|
|
21
|
+
const next = [...value];
|
|
22
|
+
let problem = "";
|
|
23
|
+
for (const raw of texts) {
|
|
24
|
+
const tag = raw.trim();
|
|
25
|
+
if (!tag) continue;
|
|
26
|
+
if (tag.length > maxTagLength) {
|
|
27
|
+
problem = "\u5355\u4E2A\u6807\u7B7E\u6700\u591A " + maxTagLength + " \u4E2A\u5B57\u7B26\u3002";
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const custom = validateTag?.(tag);
|
|
31
|
+
if (custom) {
|
|
32
|
+
problem = custom;
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (next.some(
|
|
36
|
+
(item) => caseSensitive ? item === tag : item.toLowerCase() === tag.toLowerCase()
|
|
37
|
+
)) {
|
|
38
|
+
problem = "\u8BE5\u6807\u7B7E\u5DF2\u5B58\u5728\u3002";
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (next.length >= maxTags) {
|
|
42
|
+
problem = "\u6700\u591A\u53EF\u6DFB\u52A0 " + maxTags + " \u4E2A\u6807\u7B7E\u3002";
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
next.push(tag);
|
|
46
|
+
}
|
|
47
|
+
if (next.length !== value.length) {
|
|
48
|
+
onChange(next);
|
|
49
|
+
setDraft("");
|
|
50
|
+
}
|
|
51
|
+
setError(problem);
|
|
52
|
+
};
|
|
53
|
+
const remove = (index) => {
|
|
54
|
+
if (field.disabled || field.readOnly) return;
|
|
55
|
+
onChange(value.filter((_, i) => i !== index));
|
|
56
|
+
setError("");
|
|
57
|
+
input.current?.focus();
|
|
58
|
+
};
|
|
59
|
+
const control = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
60
|
+
/* @__PURE__ */ jsxs(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
ref: root,
|
|
64
|
+
className: s.control,
|
|
65
|
+
"data-disabled": field.disabled,
|
|
66
|
+
"data-readonly": field.readOnly || void 0,
|
|
67
|
+
"aria-invalid": field.invalid || !!error,
|
|
68
|
+
onClick: () => input.current?.focus(),
|
|
69
|
+
children: [
|
|
70
|
+
value.map((tag, index) => /* @__PURE__ */ jsx(
|
|
71
|
+
SelectionTag,
|
|
72
|
+
{
|
|
73
|
+
label: tag,
|
|
74
|
+
disabled: field.disabled,
|
|
75
|
+
onRemove: field.readOnly ? void 0 : () => remove(index)
|
|
76
|
+
},
|
|
77
|
+
tag
|
|
78
|
+
)),
|
|
79
|
+
/* @__PURE__ */ jsx(
|
|
80
|
+
"input",
|
|
81
|
+
{
|
|
82
|
+
ref: input,
|
|
83
|
+
id: field.id,
|
|
84
|
+
"aria-label": field.label || void 0,
|
|
85
|
+
disabled: field.disabled,
|
|
86
|
+
readOnly: field.readOnly,
|
|
87
|
+
"aria-required": field.required || void 0,
|
|
88
|
+
"aria-invalid": field.invalid || !!error,
|
|
89
|
+
"aria-describedby": joinIds(
|
|
90
|
+
field.descriptionId,
|
|
91
|
+
error ? field.id + "-tag-error" : void 0
|
|
92
|
+
),
|
|
93
|
+
value: draft,
|
|
94
|
+
placeholder: field.readOnly ? void 0 : placeholder,
|
|
95
|
+
maxLength: maxTagLength + 1,
|
|
96
|
+
onChange: (event) => {
|
|
97
|
+
setDraft(event.target.value);
|
|
98
|
+
setError("");
|
|
99
|
+
},
|
|
100
|
+
onKeyDown: (event) => {
|
|
101
|
+
if (event.nativeEvent.isComposing) return;
|
|
102
|
+
if (event.key === "Enter" || event.key === "," || event.key === ";") {
|
|
103
|
+
event.preventDefault();
|
|
104
|
+
add([draft]);
|
|
105
|
+
} else if (event.key === "Backspace" && !draft && value.length)
|
|
106
|
+
root.current?.querySelectorAll("button")[value.length - 1]?.focus();
|
|
107
|
+
else if (event.key === "Escape") {
|
|
108
|
+
event.preventDefault();
|
|
109
|
+
setDraft("");
|
|
110
|
+
setError("");
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
onPaste: (event) => {
|
|
114
|
+
if (field.readOnly) return;
|
|
115
|
+
const text = event.clipboardData.getData("text/plain");
|
|
116
|
+
if (/[\n,;,;]/.test(text)) {
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
add(text.split(/[\n,;,;]+/));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
field.name && value.map((tag) => /* @__PURE__ */ jsx(
|
|
124
|
+
"input",
|
|
125
|
+
{
|
|
126
|
+
type: "hidden",
|
|
127
|
+
name: field.name,
|
|
128
|
+
value: tag,
|
|
129
|
+
disabled: field.disabled
|
|
130
|
+
},
|
|
131
|
+
tag
|
|
132
|
+
))
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
error && /* @__PURE__ */ jsx("p", { id: field.id + "-tag-error", className: s.error, role: "alert", children: error })
|
|
137
|
+
] });
|
|
138
|
+
return field.wrapped ? control : /* @__PURE__ */ jsx(FormField, { ...field, children: control });
|
|
139
|
+
}
|
|
140
|
+
export {
|
|
141
|
+
TagInput
|
|
142
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.control {
|
|
2
|
+
composes: surface from "./Control.module.css";
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
flex-wrap: wrap;
|
|
6
|
+
gap: 5px;
|
|
7
|
+
padding: 4px 6px;
|
|
8
|
+
}
|
|
9
|
+
.control.control {
|
|
10
|
+
height: auto;
|
|
11
|
+
min-height: var(--control-height);
|
|
12
|
+
}
|
|
13
|
+
.control > input:not([type="hidden"]) {
|
|
14
|
+
flex: 1;
|
|
15
|
+
min-width: 90px;
|
|
16
|
+
width: 90px;
|
|
17
|
+
height: 24px;
|
|
18
|
+
padding: 0 4px;
|
|
19
|
+
border: 0;
|
|
20
|
+
outline: 0;
|
|
21
|
+
background: transparent;
|
|
22
|
+
font-size: inherit;
|
|
23
|
+
}
|
|
24
|
+
.tag {
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: 4px;
|
|
28
|
+
max-width: 100%;
|
|
29
|
+
min-height: 23px;
|
|
30
|
+
padding: 2px 5px 2px 8px;
|
|
31
|
+
background: var(--selected);
|
|
32
|
+
border-radius: 5px;
|
|
33
|
+
font-size: 11px;
|
|
34
|
+
line-height: 17px;
|
|
35
|
+
}
|
|
36
|
+
.tag > span {
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
text-overflow: ellipsis;
|
|
39
|
+
white-space: nowrap;
|
|
40
|
+
}
|
|
41
|
+
.tag button {
|
|
42
|
+
display: grid;
|
|
43
|
+
place-items: center;
|
|
44
|
+
width: 18px;
|
|
45
|
+
height: 18px;
|
|
46
|
+
padding: 0;
|
|
47
|
+
border: 0;
|
|
48
|
+
background: transparent;
|
|
49
|
+
border-radius: 3px;
|
|
50
|
+
color: var(--muted);
|
|
51
|
+
}
|
|
52
|
+
.tag button:hover:not(:disabled) {
|
|
53
|
+
background: var(--hover);
|
|
54
|
+
color: var(--fg);
|
|
55
|
+
}
|
|
56
|
+
.tag svg {
|
|
57
|
+
width: 12px;
|
|
58
|
+
height: 12px;
|
|
59
|
+
}
|
|
60
|
+
.error {
|
|
61
|
+
font-size: 11px;
|
|
62
|
+
color: var(--danger);
|
|
63
|
+
margin: 0;
|
|
64
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FormField } from "./FormField.js";
|
|
3
|
+
import { fieldInputProps, useFieldControl } from "./field.js";
|
|
4
|
+
import s from "./Textarea.module.css";
|
|
5
|
+
function Textarea({
|
|
6
|
+
label,
|
|
7
|
+
error,
|
|
8
|
+
hint,
|
|
9
|
+
...props
|
|
10
|
+
}) {
|
|
11
|
+
const field = useFieldControl({ ...props, label, error, hint });
|
|
12
|
+
const control = /* @__PURE__ */ jsx(
|
|
13
|
+
"textarea",
|
|
14
|
+
{
|
|
15
|
+
...props,
|
|
16
|
+
...fieldInputProps(field),
|
|
17
|
+
className: [s.textarea, props.className].filter(Boolean).join(" ")
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
return field.wrapped ? control : /* @__PURE__ */ jsx(FormField, { ...field, children: control });
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
Textarea
|
|
24
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Check, Monitor, Sun, Moon } from "lucide-react";
|
|
3
|
+
import s from "./ThemePicker.module.css";
|
|
4
|
+
function ThemePicker({
|
|
5
|
+
value,
|
|
6
|
+
onChange
|
|
7
|
+
}) {
|
|
8
|
+
return /* @__PURE__ */ jsx("div", { className: s.choices, role: "group", "aria-label": "\u989C\u8272\u6A21\u5F0F", children: [
|
|
9
|
+
{ id: "system", label: "\u8DDF\u968F\u7CFB\u7EDF", Icon: Monitor },
|
|
10
|
+
{ id: "light", label: "\u6D45\u8272", Icon: Sun },
|
|
11
|
+
{ id: "dark", label: "\u6DF1\u8272", Icon: Moon }
|
|
12
|
+
].map(({ id, label, Icon }) => /* @__PURE__ */ jsxs(
|
|
13
|
+
"button",
|
|
14
|
+
{
|
|
15
|
+
type: "button",
|
|
16
|
+
className: s.choice,
|
|
17
|
+
"aria-pressed": value === id,
|
|
18
|
+
onClick: () => onChange(id),
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ jsxs("span", { className: s.preview, "data-mode": id, "aria-hidden": "true", children: [
|
|
21
|
+
/* @__PURE__ */ jsxs("span", { className: s.window, children: [
|
|
22
|
+
/* @__PURE__ */ jsxs("span", { className: s.bar, children: [
|
|
23
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
24
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
25
|
+
/* @__PURE__ */ jsx("i", {})
|
|
26
|
+
] }),
|
|
27
|
+
/* @__PURE__ */ jsxs("span", { className: s.body, children: [
|
|
28
|
+
/* @__PURE__ */ jsxs("span", { className: s.rail, children: [
|
|
29
|
+
/* @__PURE__ */ jsx("b", {}),
|
|
30
|
+
/* @__PURE__ */ jsx("b", {}),
|
|
31
|
+
/* @__PURE__ */ jsx("b", {})
|
|
32
|
+
] }),
|
|
33
|
+
/* @__PURE__ */ jsxs("span", { className: s.content, children: [
|
|
34
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
35
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
36
|
+
/* @__PURE__ */ jsx("b", {}),
|
|
37
|
+
/* @__PURE__ */ jsx("b", {})
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
40
|
+
/* @__PURE__ */ jsx("i", {})
|
|
41
|
+
] })
|
|
42
|
+
] })
|
|
43
|
+
] }),
|
|
44
|
+
id === "system" && /* @__PURE__ */ jsxs("span", { className: s.second, children: [
|
|
45
|
+
/* @__PURE__ */ jsxs("span", { className: s.bar, children: [
|
|
46
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
47
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
48
|
+
/* @__PURE__ */ jsx("i", {})
|
|
49
|
+
] }),
|
|
50
|
+
/* @__PURE__ */ jsxs("span", { className: s.body, children: [
|
|
51
|
+
/* @__PURE__ */ jsxs("span", { className: s.rail, children: [
|
|
52
|
+
/* @__PURE__ */ jsx("b", {}),
|
|
53
|
+
/* @__PURE__ */ jsx("b", {})
|
|
54
|
+
] }),
|
|
55
|
+
/* @__PURE__ */ jsxs("span", { className: s.content, children: [
|
|
56
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
57
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
58
|
+
/* @__PURE__ */ jsx("b", {}),
|
|
59
|
+
/* @__PURE__ */ jsx("b", {})
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ jsx("i", {})
|
|
62
|
+
] })
|
|
63
|
+
] })
|
|
64
|
+
] })
|
|
65
|
+
] }),
|
|
66
|
+
/* @__PURE__ */ jsxs("span", { className: s.caption, children: [
|
|
67
|
+
/* @__PURE__ */ jsx(Icon, {}),
|
|
68
|
+
label,
|
|
69
|
+
/* @__PURE__ */ jsx("span", { className: s.check, "data-selected": value === id, children: /* @__PURE__ */ jsx(Check, {}) })
|
|
70
|
+
] })
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
id
|
|
74
|
+
)) });
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
ThemePicker
|
|
78
|
+
};
|