@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,22 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import s from "./Page.module.css";
|
|
3
|
+
function Page({
|
|
4
|
+
title,
|
|
5
|
+
description,
|
|
6
|
+
actions,
|
|
7
|
+
children
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ jsxs("div", { className: s.page, children: [
|
|
10
|
+
/* @__PURE__ */ jsxs("header", { className: s.heading, children: [
|
|
11
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
12
|
+
/* @__PURE__ */ jsx("h1", { children: title }),
|
|
13
|
+
description && /* @__PURE__ */ jsx("p", { children: description })
|
|
14
|
+
] }),
|
|
15
|
+
actions && /* @__PURE__ */ jsx("div", { className: s.actions, children: actions })
|
|
16
|
+
] }),
|
|
17
|
+
children
|
|
18
|
+
] });
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
Page
|
|
22
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.page {
|
|
2
|
+
max-width: var(--page-max-width);
|
|
3
|
+
margin: var(--page-margin);
|
|
4
|
+
padding: var(--page-inset);
|
|
5
|
+
animation: page-enter var(--motion-page) var(--ease-page);
|
|
6
|
+
}
|
|
7
|
+
.heading {
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
align-items: var(--page-heading-align);
|
|
11
|
+
gap: 20px;
|
|
12
|
+
margin-bottom: 30px;
|
|
13
|
+
}
|
|
14
|
+
.heading p {
|
|
15
|
+
color: var(--muted);
|
|
16
|
+
font-size: 12px;
|
|
17
|
+
margin-top: 8px;
|
|
18
|
+
}
|
|
19
|
+
.actions {
|
|
20
|
+
display: flex;
|
|
21
|
+
gap: 8px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.heading h1 {
|
|
25
|
+
font-size: var(--page-title-size);
|
|
26
|
+
line-height: var(--page-title-line-height);
|
|
27
|
+
}
|
|
28
|
+
@media (min-width: 1450px) {
|
|
29
|
+
.page {
|
|
30
|
+
padding-top: var(--page-wide-top);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
@media (max-width: 600px) {
|
|
34
|
+
.heading {
|
|
35
|
+
gap: 14px;
|
|
36
|
+
flex-wrap: wrap;
|
|
37
|
+
}
|
|
38
|
+
.heading h1 {
|
|
39
|
+
font-size: var(--page-small-title);
|
|
40
|
+
}
|
|
41
|
+
.actions {
|
|
42
|
+
flex-wrap: wrap;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export declare function Pagination({ page, pageSize, total, onPageChange, onPageSizeChange, pageSizes, summary, resetPageOnSizeChange, }: {
|
|
3
|
+
page: number;
|
|
4
|
+
pageSize: number;
|
|
5
|
+
total: number;
|
|
6
|
+
onPageChange(page: number): void;
|
|
7
|
+
onPageSizeChange?(size: number): void;
|
|
8
|
+
pageSizes?: number[];
|
|
9
|
+
summary?: ReactNode;
|
|
10
|
+
resetPageOnSizeChange?: boolean;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useId, useState } from "react";
|
|
3
|
+
import {
|
|
4
|
+
ChevronLeft,
|
|
5
|
+
ChevronRight,
|
|
6
|
+
ChevronsLeft,
|
|
7
|
+
ChevronsRight
|
|
8
|
+
} from "lucide-react";
|
|
9
|
+
import { Button } from "./Button.js";
|
|
10
|
+
import { Select } from "./Select.js";
|
|
11
|
+
import control from "./Control.module.css";
|
|
12
|
+
import s from "./Pagination.module.css";
|
|
13
|
+
function Pagination({
|
|
14
|
+
page,
|
|
15
|
+
pageSize,
|
|
16
|
+
total,
|
|
17
|
+
onPageChange,
|
|
18
|
+
onPageSizeChange,
|
|
19
|
+
pageSizes = [5, 10, 20, 50],
|
|
20
|
+
summary,
|
|
21
|
+
resetPageOnSizeChange = true
|
|
22
|
+
}) {
|
|
23
|
+
const size = Math.max(1, pageSize), pages = Math.max(1, Math.ceil(total / size)), current = Math.min(pages, Math.max(1, page)), id = useId(), [draft, setDraft] = useState(String(current));
|
|
24
|
+
useEffect(() => setDraft(String(current)), [current]);
|
|
25
|
+
const jump = () => {
|
|
26
|
+
const parsed = Number(draft);
|
|
27
|
+
if (!draft.trim() || !Number.isFinite(parsed)) {
|
|
28
|
+
setDraft(String(current));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const target = Math.min(pages, Math.max(1, Math.trunc(parsed)));
|
|
32
|
+
setDraft(String(target));
|
|
33
|
+
onPageChange(target);
|
|
34
|
+
};
|
|
35
|
+
const visible = [
|
|
36
|
+
.../* @__PURE__ */ new Set([
|
|
37
|
+
1,
|
|
38
|
+
...Array.from({ length: 3 }, (_, i) => current - 1 + i).filter(
|
|
39
|
+
(n) => n > 1 && n < pages
|
|
40
|
+
),
|
|
41
|
+
pages
|
|
42
|
+
])
|
|
43
|
+
].sort((a, b) => a - b);
|
|
44
|
+
return /* @__PURE__ */ jsxs("nav", { className: s.pagination, "aria-label": "\u5206\u9875", children: [
|
|
45
|
+
/* @__PURE__ */ jsxs("span", { className: s.summary, children: [
|
|
46
|
+
total ? (current - 1) * size + 1 + "\u2013" + Math.min(current * size, total) : 0,
|
|
47
|
+
" ",
|
|
48
|
+
"/ ",
|
|
49
|
+
total,
|
|
50
|
+
" \u9879",
|
|
51
|
+
summary
|
|
52
|
+
] }),
|
|
53
|
+
/* @__PURE__ */ jsxs("div", { className: s.controls, children: [
|
|
54
|
+
onPageSizeChange && /* @__PURE__ */ jsx(
|
|
55
|
+
Select,
|
|
56
|
+
{
|
|
57
|
+
label: "\u6BCF\u9875\u6761\u6570",
|
|
58
|
+
value: String(size),
|
|
59
|
+
onChange: (v) => {
|
|
60
|
+
onPageSizeChange(Number(v));
|
|
61
|
+
if (resetPageOnSizeChange) onPageChange(1);
|
|
62
|
+
},
|
|
63
|
+
options: [.../* @__PURE__ */ new Set([...pageSizes, size])].sort((a, b) => a - b).map((n) => ({ value: String(n), label: n + " / \u9875" }))
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
/* @__PURE__ */ jsxs("div", { className: s.pages, children: [
|
|
67
|
+
/* @__PURE__ */ jsx(
|
|
68
|
+
Button,
|
|
69
|
+
{
|
|
70
|
+
className: s.arrow,
|
|
71
|
+
"aria-label": "\u7B2C\u4E00\u9875",
|
|
72
|
+
disabled: current === 1,
|
|
73
|
+
onClick: () => onPageChange(1),
|
|
74
|
+
children: /* @__PURE__ */ jsx(ChevronsLeft, {})
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ jsx(
|
|
78
|
+
Button,
|
|
79
|
+
{
|
|
80
|
+
className: s.arrow,
|
|
81
|
+
"aria-label": "\u4E0A\u4E00\u9875",
|
|
82
|
+
disabled: current === 1,
|
|
83
|
+
onClick: () => onPageChange(current - 1),
|
|
84
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, {})
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
visible.map((n, i) => /* @__PURE__ */ jsxs("span", { className: s.number, children: [
|
|
88
|
+
i > 0 && n - visible[i - 1] > 1 && /* @__PURE__ */ jsx("span", { className: s.ellipsis, children: "\u2026" }),
|
|
89
|
+
/* @__PURE__ */ jsx(
|
|
90
|
+
Button,
|
|
91
|
+
{
|
|
92
|
+
className: s.page,
|
|
93
|
+
"aria-label": "\u7B2C " + n + " \u9875",
|
|
94
|
+
"aria-current": n === current ? "page" : void 0,
|
|
95
|
+
variant: n === current ? "primary" : "ghost",
|
|
96
|
+
onClick: () => onPageChange(n),
|
|
97
|
+
children: n
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] }, n)),
|
|
101
|
+
/* @__PURE__ */ jsx(
|
|
102
|
+
Button,
|
|
103
|
+
{
|
|
104
|
+
className: s.arrow,
|
|
105
|
+
"aria-label": "\u4E0B\u4E00\u9875",
|
|
106
|
+
disabled: current === pages,
|
|
107
|
+
onClick: () => onPageChange(current + 1),
|
|
108
|
+
children: /* @__PURE__ */ jsx(ChevronRight, {})
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ jsx(
|
|
112
|
+
Button,
|
|
113
|
+
{
|
|
114
|
+
className: s.arrow,
|
|
115
|
+
"aria-label": "\u6700\u540E\u4E00\u9875",
|
|
116
|
+
disabled: current === pages,
|
|
117
|
+
onClick: () => onPageChange(pages),
|
|
118
|
+
children: /* @__PURE__ */ jsx(ChevronsRight, {})
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] }),
|
|
122
|
+
/* @__PURE__ */ jsxs(
|
|
123
|
+
"form",
|
|
124
|
+
{
|
|
125
|
+
className: s.jump,
|
|
126
|
+
onSubmit: (e) => {
|
|
127
|
+
e.preventDefault();
|
|
128
|
+
jump();
|
|
129
|
+
},
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ jsx("label", { htmlFor: id, children: "\u8DF3\u81F3" }),
|
|
132
|
+
/* @__PURE__ */ jsx(
|
|
133
|
+
"input",
|
|
134
|
+
{
|
|
135
|
+
id,
|
|
136
|
+
className: control.surface,
|
|
137
|
+
"aria-label": "\u8DF3\u8F6C\u9875\u7801",
|
|
138
|
+
"aria-description": "\u8F93\u5165\u9875\u7801\u540E\u6309\u56DE\u8F66\u786E\u8BA4",
|
|
139
|
+
inputMode: "numeric",
|
|
140
|
+
value: draft,
|
|
141
|
+
onChange: (e) => setDraft(e.target.value),
|
|
142
|
+
onBlur: jump,
|
|
143
|
+
onKeyDown: (e) => {
|
|
144
|
+
if (e.key === "Escape") {
|
|
145
|
+
e.preventDefault();
|
|
146
|
+
setDraft(String(current));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
/* @__PURE__ */ jsx("span", { children: "\u9875" })
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
] })
|
|
156
|
+
] });
|
|
157
|
+
}
|
|
158
|
+
export {
|
|
159
|
+
Pagination
|
|
160
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
.pagination {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
gap: 16px;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
padding: 16px 0;
|
|
8
|
+
}
|
|
9
|
+
.summary {
|
|
10
|
+
color: var(--muted);
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
font-size: 12px;
|
|
13
|
+
}
|
|
14
|
+
.controls {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: 16px;
|
|
18
|
+
flex-wrap: wrap;
|
|
19
|
+
justify-content: flex-end;
|
|
20
|
+
}
|
|
21
|
+
.controls > [role="combobox"] {
|
|
22
|
+
min-width: 90px;
|
|
23
|
+
}
|
|
24
|
+
.pages,
|
|
25
|
+
.number {
|
|
26
|
+
display: flex;
|
|
27
|
+
gap: 4px;
|
|
28
|
+
align-items: center;
|
|
29
|
+
}
|
|
30
|
+
.pages .arrow,
|
|
31
|
+
.pages .page {
|
|
32
|
+
height: var(--control-height);
|
|
33
|
+
min-height: var(--control-height);
|
|
34
|
+
min-width: var(--control-height);
|
|
35
|
+
padding: 0 7px;
|
|
36
|
+
}
|
|
37
|
+
.arrow svg {
|
|
38
|
+
width: 14px;
|
|
39
|
+
height: 14px;
|
|
40
|
+
}
|
|
41
|
+
.ellipsis {
|
|
42
|
+
padding: 0 3px;
|
|
43
|
+
color: var(--muted);
|
|
44
|
+
}
|
|
45
|
+
.jump {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: 8px;
|
|
49
|
+
color: var(--muted);
|
|
50
|
+
font-size: 12px;
|
|
51
|
+
}
|
|
52
|
+
.jump input {
|
|
53
|
+
width: 48px;
|
|
54
|
+
text-align: center;
|
|
55
|
+
padding: 0 5px;
|
|
56
|
+
color: var(--fg);
|
|
57
|
+
}
|
|
58
|
+
@media (max-width: 650px) {
|
|
59
|
+
.controls {
|
|
60
|
+
gap: 10px;
|
|
61
|
+
width: 100%;
|
|
62
|
+
justify-content: flex-start;
|
|
63
|
+
}
|
|
64
|
+
.pagination {
|
|
65
|
+
gap: 10px;
|
|
66
|
+
}
|
|
67
|
+
.pages {
|
|
68
|
+
gap: 2px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef } from "react";
|
|
2
|
+
export declare function PasswordField({ value, onChange, label, strength, error, hint, ...props }: Omit<ComponentPropsWithoutRef<"input">, "value" | "onChange" | "type"> & {
|
|
3
|
+
value: string;
|
|
4
|
+
onChange(value: string): void;
|
|
5
|
+
label?: string;
|
|
6
|
+
strength?: 0 | 1 | 2 | 3 | 4;
|
|
7
|
+
error?: string;
|
|
8
|
+
hint?: string;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState } from "react";
|
|
3
|
+
import { Eye, EyeOff } from "lucide-react";
|
|
4
|
+
import { FormField } from "./FormField.js";
|
|
5
|
+
import { joinIds, useFieldControl } from "./field.js";
|
|
6
|
+
import s from "./PasswordField.module.css";
|
|
7
|
+
function PasswordField({
|
|
8
|
+
value,
|
|
9
|
+
onChange,
|
|
10
|
+
label,
|
|
11
|
+
strength,
|
|
12
|
+
error,
|
|
13
|
+
hint,
|
|
14
|
+
...props
|
|
15
|
+
}) {
|
|
16
|
+
const field = useFieldControl({ ...props, label, error, hint }), input = useRef(null), [visible, setVisible] = useState(false), [caps, setCaps] = useState(false), strengthLabels = ["\u672A\u8BC4\u4F30", "\u5F31", "\u4E00\u822C", "\u8F83\u5F3A", "\u5F3A"];
|
|
17
|
+
const control = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
18
|
+
/* @__PURE__ */ jsxs(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
className: s.control,
|
|
22
|
+
"data-disabled": field.disabled,
|
|
23
|
+
"data-readonly": field.readOnly || void 0,
|
|
24
|
+
"aria-invalid": field.invalid,
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ jsx(
|
|
27
|
+
"input",
|
|
28
|
+
{
|
|
29
|
+
...props,
|
|
30
|
+
ref: input,
|
|
31
|
+
id: field.id,
|
|
32
|
+
name: field.name,
|
|
33
|
+
type: visible ? "text" : "password",
|
|
34
|
+
value,
|
|
35
|
+
required: field.required,
|
|
36
|
+
disabled: field.disabled,
|
|
37
|
+
readOnly: field.readOnly,
|
|
38
|
+
autoComplete: props.autoComplete || "current-password",
|
|
39
|
+
"aria-invalid": field.invalid,
|
|
40
|
+
"aria-describedby": joinIds(
|
|
41
|
+
field.descriptionId,
|
|
42
|
+
caps ? field.id + "-caps" : void 0
|
|
43
|
+
),
|
|
44
|
+
onChange: (event) => onChange(event.target.value),
|
|
45
|
+
onKeyDown: (event) => {
|
|
46
|
+
setCaps(event.getModifierState("CapsLock"));
|
|
47
|
+
props.onKeyDown?.(event);
|
|
48
|
+
},
|
|
49
|
+
onKeyUp: (event) => {
|
|
50
|
+
setCaps(event.getModifierState("CapsLock"));
|
|
51
|
+
props.onKeyUp?.(event);
|
|
52
|
+
},
|
|
53
|
+
onBlur: (event) => {
|
|
54
|
+
setCaps(false);
|
|
55
|
+
props.onBlur?.(event);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
"button",
|
|
61
|
+
{
|
|
62
|
+
type: "button",
|
|
63
|
+
disabled: field.disabled,
|
|
64
|
+
"aria-label": visible ? "\u9690\u85CF\u5BC6\u7801" : "\u663E\u793A\u5BC6\u7801",
|
|
65
|
+
"aria-pressed": visible,
|
|
66
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
67
|
+
onClick: () => {
|
|
68
|
+
const start = input.current?.selectionStart, end = input.current?.selectionEnd;
|
|
69
|
+
setVisible((value2) => !value2);
|
|
70
|
+
requestAnimationFrame(() => {
|
|
71
|
+
input.current?.focus({ preventScroll: true });
|
|
72
|
+
if (start != null && end != null)
|
|
73
|
+
input.current?.setSelectionRange(start, end);
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
children: visible ? /* @__PURE__ */ jsx(EyeOff, {}) : /* @__PURE__ */ jsx(Eye, {})
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
caps && /* @__PURE__ */ jsx("p", { className: s.caps, id: field.id + "-caps", role: "status", children: "\u5927\u5199\u9501\u5B9A\u5DF2\u5F00\u542F" }),
|
|
83
|
+
strength !== void 0 && /* @__PURE__ */ jsx(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
className: s.strength,
|
|
87
|
+
role: "meter",
|
|
88
|
+
"aria-label": "\u5BC6\u7801\u5F3A\u5EA6",
|
|
89
|
+
"aria-valuemin": 0,
|
|
90
|
+
"aria-valuemax": 4,
|
|
91
|
+
"aria-valuenow": strength,
|
|
92
|
+
"aria-valuetext": strengthLabels[strength],
|
|
93
|
+
"data-strength": strength,
|
|
94
|
+
children: [1, 2, 3, 4].map((level) => /* @__PURE__ */ jsx("span", { "data-active": level <= strength }, level))
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
] });
|
|
98
|
+
return field.wrapped ? control : /* @__PURE__ */ jsx(FormField, { ...field, children: control });
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
PasswordField
|
|
102
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.control {
|
|
2
|
+
composes: surface from "./Control.module.css";
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: 7px;
|
|
6
|
+
padding: 0 8px 0 10px;
|
|
7
|
+
}
|
|
8
|
+
.control input {
|
|
9
|
+
flex: 1;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 100%;
|
|
13
|
+
padding: 0;
|
|
14
|
+
border: 0;
|
|
15
|
+
outline: 0;
|
|
16
|
+
background: transparent;
|
|
17
|
+
font-size: inherit;
|
|
18
|
+
}
|
|
19
|
+
.control button {
|
|
20
|
+
display: grid;
|
|
21
|
+
place-items: center;
|
|
22
|
+
flex-shrink: 0;
|
|
23
|
+
width: 26px;
|
|
24
|
+
height: 26px;
|
|
25
|
+
border: 0;
|
|
26
|
+
padding: 0;
|
|
27
|
+
border-radius: 5px;
|
|
28
|
+
background: transparent;
|
|
29
|
+
color: var(--muted);
|
|
30
|
+
}
|
|
31
|
+
.control button:hover {
|
|
32
|
+
background: var(--hover);
|
|
33
|
+
color: var(--fg);
|
|
34
|
+
}
|
|
35
|
+
.control svg {
|
|
36
|
+
width: 16px;
|
|
37
|
+
height: 16px;
|
|
38
|
+
}
|
|
39
|
+
.caps {
|
|
40
|
+
font-size: 11px;
|
|
41
|
+
color: var(--warning);
|
|
42
|
+
margin: 0;
|
|
43
|
+
}
|
|
44
|
+
.strength {
|
|
45
|
+
display: flex;
|
|
46
|
+
gap: 4px;
|
|
47
|
+
height: 4px;
|
|
48
|
+
}
|
|
49
|
+
.strength span {
|
|
50
|
+
height: 4px;
|
|
51
|
+
flex: 1;
|
|
52
|
+
border-radius: 3px;
|
|
53
|
+
background: var(--line);
|
|
54
|
+
}
|
|
55
|
+
.strength[data-strength="1"] [data-active="true"] {
|
|
56
|
+
background: var(--danger);
|
|
57
|
+
}
|
|
58
|
+
.strength[data-strength="2"] [data-active="true"] {
|
|
59
|
+
background: var(--warning);
|
|
60
|
+
}
|
|
61
|
+
.strength[data-strength="3"] [data-active="true"],
|
|
62
|
+
.strength[data-strength="4"] [data-active="true"] {
|
|
63
|
+
background: var(--success);
|
|
64
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
.panel {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 12px;
|
|
5
|
+
padding: 12px;
|
|
6
|
+
max-height: min(540px, 80vh);
|
|
7
|
+
}
|
|
8
|
+
.footer {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
color: var(--muted);
|
|
12
|
+
font-size: 12px;
|
|
13
|
+
min-height: 20px;
|
|
14
|
+
}
|
|
15
|
+
.preview {
|
|
16
|
+
display: grid;
|
|
17
|
+
place-items: center;
|
|
18
|
+
font-size: 16px;
|
|
19
|
+
line-height: 18px;
|
|
20
|
+
width: 18px;
|
|
21
|
+
flex-shrink: 0;
|
|
22
|
+
font-family: "Segoe UI Emoji", "Segoe UI Symbol", var(--ui-font);
|
|
23
|
+
}
|
|
24
|
+
.loading {
|
|
25
|
+
display: grid;
|
|
26
|
+
place-items: center;
|
|
27
|
+
height: 320px;
|
|
28
|
+
}
|
|
29
|
+
.variantPanel {
|
|
30
|
+
height: 320px;
|
|
31
|
+
overflow: auto;
|
|
32
|
+
}
|
|
33
|
+
.variantGrid {
|
|
34
|
+
display: grid;
|
|
35
|
+
grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
|
|
36
|
+
gap: 5px;
|
|
37
|
+
margin-top: 14px;
|
|
38
|
+
}
|
|
39
|
+
.cell {
|
|
40
|
+
display: grid;
|
|
41
|
+
place-items: center;
|
|
42
|
+
height: 38px;
|
|
43
|
+
padding: 0;
|
|
44
|
+
border: 1px solid transparent;
|
|
45
|
+
border-radius: 7px;
|
|
46
|
+
background: transparent;
|
|
47
|
+
font-size: 23px;
|
|
48
|
+
font-family: "Segoe UI Emoji", "Segoe UI Symbol", var(--ui-font);
|
|
49
|
+
}
|
|
50
|
+
.cell:hover {
|
|
51
|
+
background: var(--hover);
|
|
52
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ComponentPropsWithRef } from "react";
|
|
2
|
+
export declare function PinInput({ value, onChange, onComplete, length, format, mask, groups, label, error, hint, ref: forwardedRef, ...props }: Omit<ComponentPropsWithRef<"input">, "value" | "onChange" | "type" | "maxLength" | "pattern" | "size"> & {
|
|
3
|
+
value: string;
|
|
4
|
+
onChange(value: string): void;
|
|
5
|
+
onComplete?(value: string): void;
|
|
6
|
+
length?: number;
|
|
7
|
+
format?: "numeric" | "alphanumeric";
|
|
8
|
+
mask?: boolean;
|
|
9
|
+
groups?: number[];
|
|
10
|
+
label?: string;
|
|
11
|
+
error?: string;
|
|
12
|
+
hint?: string;
|
|
13
|
+
}): import("react").JSX.Element;
|