@robert-stackflow/oneui 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -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 +6 -0
- package/components/Button.js +29 -0
- package/components/Button.module.css +79 -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 +7 -0
- package/components/Card.js +19 -0
- package/components/Card.module.css +28 -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 +11 -0
- package/components/Combobox.js +252 -0
- package/components/Combobox.module.css +26 -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 +73 -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 +9 -0
- package/components/Dialog.js +112 -0
- package/components/Dialog.module.css +71 -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 +146 -0
- package/components/IconButton.d.ts +7 -0
- package/components/IconButton.js +30 -0
- package/components/IconButton.module.css +39 -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 +7 -0
- package/components/Input.js +29 -0
- package/components/Input.module.css +23 -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 +5 -0
- package/components/LoadingState.js +29 -0
- package/components/LoadingState.module.css +14 -0
- package/components/Menu.d.ts +11 -0
- package/components/Menu.js +82 -0
- package/components/MenuItem.d.ts +14 -0
- package/components/MenuItem.js +49 -0
- package/components/MenuItem.module.css +163 -0
- package/components/MenuItemContent.d.ts +8 -0
- package/components/MenuItemContent.js +19 -0
- package/components/MultiSelect.d.ts +12 -0
- package/components/MultiSelect.js +161 -0
- package/components/MultiSelect.module.css +61 -0
- package/components/NumberInput.d.ts +12 -0
- package/components/NumberInput.js +113 -0
- package/components/NumberInput.module.css +33 -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 +101 -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 +172 -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 +13 -0
- package/components/Popover.js +150 -0
- package/components/Popover.module.css +16 -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 +66 -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 +171 -0
- package/components/Select.module.css +21 -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/SettingRow.d.ts +7 -0
- package/components/SettingRow.js +19 -0
- package/components/SettingRow.module.css +44 -0
- package/components/SettingsLayout.d.ts +9 -0
- package/components/SettingsLayout.js +45 -0
- package/components/SettingsLayout.module.css +48 -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 +56 -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 +12 -0
- package/components/Table.js +20 -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 +154 -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 +80 -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/TreeSelect.d.ts +23 -0
- package/components/TreeSelect.js +309 -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 +89 -0
- package/components/appearance.d.ts +19 -0
- package/components/appearance.js +60 -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 +22 -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 +150 -0
- package/components/index.js +219 -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 +783 -3
- package/styles/base.css +189 -0
- package/styles/blue.css +254 -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,220 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import { ArrowDown, ArrowUp, ArrowUpDown } from "lucide-react";
|
|
4
|
+
import { Checkbox } from "./Checkbox.js";
|
|
5
|
+
import { Pagination } from "./Pagination.js";
|
|
6
|
+
import { TableColumnFilter } from "./TableColumnFilter.js";
|
|
7
|
+
import { TableColumnVisibility } from "./TableColumnVisibility.js";
|
|
8
|
+
import { Button } from "./Button.js";
|
|
9
|
+
import { Placeholder } from "./Placeholder.js";
|
|
10
|
+
import { LoadingOverlay } from "./LoadingOverlay.js";
|
|
11
|
+
import s from "./DataTable.module.css";
|
|
12
|
+
const positive = (value, fallback) => typeof value === "number" && Number.isFinite(value) ? Math.max(1, Math.floor(value)) : fallback;
|
|
13
|
+
function DataTable({
|
|
14
|
+
rows,
|
|
15
|
+
columns,
|
|
16
|
+
rowKey,
|
|
17
|
+
label = "\u6570\u636E\u8868\u683C",
|
|
18
|
+
selected,
|
|
19
|
+
onSelectionChange,
|
|
20
|
+
selectionLabel,
|
|
21
|
+
initialPageSize = 5,
|
|
22
|
+
loading = false,
|
|
23
|
+
sort: controlledSort,
|
|
24
|
+
defaultSort = null,
|
|
25
|
+
onSortChange,
|
|
26
|
+
filters: controlledFilters,
|
|
27
|
+
defaultFilters = {},
|
|
28
|
+
onFiltersChange,
|
|
29
|
+
pagination,
|
|
30
|
+
defaultPagination,
|
|
31
|
+
onPaginationChange,
|
|
32
|
+
pageSizes,
|
|
33
|
+
visibleColumns,
|
|
34
|
+
defaultVisibleColumns,
|
|
35
|
+
onVisibleColumnsChange,
|
|
36
|
+
showColumnSelector = true,
|
|
37
|
+
manualFiltering = false,
|
|
38
|
+
manualSorting = false,
|
|
39
|
+
manualPagination = false,
|
|
40
|
+
total
|
|
41
|
+
}) {
|
|
42
|
+
const [localSort, setLocalSort] = useState(defaultSort), [localFilters, setLocalFilters] = useState(defaultFilters), [localPage, setLocalPage] = useState({
|
|
43
|
+
page: positive(defaultPagination?.page, 1),
|
|
44
|
+
pageSize: positive(
|
|
45
|
+
defaultPagination?.pageSize,
|
|
46
|
+
positive(initialPageSize, 5)
|
|
47
|
+
)
|
|
48
|
+
}), [hidden, setHidden] = useState(
|
|
49
|
+
() => defaultVisibleColumns ? columns.filter((column) => !defaultVisibleColumns.includes(column.key)).map((column) => column.key) : []
|
|
50
|
+
);
|
|
51
|
+
const sort = controlledSort === void 0 ? localSort : controlledSort, filters = controlledFilters ?? localFilters;
|
|
52
|
+
const pageSize = positive(pagination?.pageSize, localPage.pageSize), page = positive(pagination?.page, localPage.page);
|
|
53
|
+
const filtered = useMemo(() => {
|
|
54
|
+
const result = manualFiltering ? [...rows] : rows.filter(
|
|
55
|
+
(row) => columns.every(
|
|
56
|
+
(column2) => !filters[column2.key]?.length || filters[column2.key].includes(String(column2.value(row)))
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
const column = columns.find((item) => item.key === sort?.key);
|
|
60
|
+
if (column && sort && !manualSorting)
|
|
61
|
+
result.sort((a, b) => {
|
|
62
|
+
const x = column.value(a), y = column.value(b);
|
|
63
|
+
return (typeof x === "number" && typeof y === "number" ? x - y : String(x).localeCompare(String(y), "zh-CN", { numeric: true })) * (sort.direction === "asc" ? 1 : -1);
|
|
64
|
+
});
|
|
65
|
+
return result;
|
|
66
|
+
}, [rows, columns, filters, sort, manualFiltering, manualSorting]);
|
|
67
|
+
const count = manualPagination ? typeof total === "number" && Number.isFinite(total) ? Math.max(0, Math.floor(total)) : rows.length : filtered.length;
|
|
68
|
+
const current = Math.min(page, Math.max(1, Math.ceil(count / pageSize))), visible = manualPagination ? filtered : filtered.slice((current - 1) * pageSize, current * pageSize), ids = visible.map(rowKey), selection = selected || [], selectedCount = ids.filter((key) => selection.includes(key)).length;
|
|
69
|
+
const normalizeColumns = (keys) => {
|
|
70
|
+
const next = columns.filter(
|
|
71
|
+
(column) => column.hideable === false || keys.includes(column.key)
|
|
72
|
+
).map((column) => column.key);
|
|
73
|
+
if (!next.length && columns[0]) next.push(columns[0].key);
|
|
74
|
+
return next;
|
|
75
|
+
};
|
|
76
|
+
const visibleKeys = normalizeColumns(
|
|
77
|
+
visibleColumns ?? columns.filter((column) => !hidden.includes(column.key)).map((column) => column.key)
|
|
78
|
+
), displayColumns = columns.filter(
|
|
79
|
+
(column) => visibleKeys.includes(column.key)
|
|
80
|
+
);
|
|
81
|
+
const changePage = (next) => {
|
|
82
|
+
if (pagination === void 0) setLocalPage(next);
|
|
83
|
+
if (next.page !== current || next.pageSize !== pageSize)
|
|
84
|
+
onPaginationChange?.(next);
|
|
85
|
+
};
|
|
86
|
+
const changeSort = (next) => {
|
|
87
|
+
if (controlledSort === void 0) setLocalSort(next);
|
|
88
|
+
onSortChange?.(next);
|
|
89
|
+
changePage({ page: 1, pageSize });
|
|
90
|
+
};
|
|
91
|
+
const changeFilters = (next) => {
|
|
92
|
+
if (controlledFilters === void 0) setLocalFilters(next);
|
|
93
|
+
onFiltersChange?.(next);
|
|
94
|
+
changePage({ page: 1, pageSize });
|
|
95
|
+
};
|
|
96
|
+
const active = !!sort || columns.some((column) => filters[column.key]?.length);
|
|
97
|
+
return /* @__PURE__ */ jsxs("div", { className: s.container, role: "region", "aria-label": `${label}\u533A\u57DF`, children: [
|
|
98
|
+
(showColumnSelector || active) && /* @__PURE__ */ jsxs("div", { className: s.toolbar, children: [
|
|
99
|
+
active && /* @__PURE__ */ jsx(
|
|
100
|
+
Button,
|
|
101
|
+
{
|
|
102
|
+
variant: "ghost",
|
|
103
|
+
onClick: () => {
|
|
104
|
+
if (controlledSort === void 0) setLocalSort(null);
|
|
105
|
+
if (controlledFilters === void 0) setLocalFilters({});
|
|
106
|
+
onSortChange?.(null);
|
|
107
|
+
onFiltersChange?.({});
|
|
108
|
+
changePage({ page: 1, pageSize });
|
|
109
|
+
},
|
|
110
|
+
children: "\u6E05\u9664\u7B5B\u9009\u4E0E\u6392\u5E8F"
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
showColumnSelector && /* @__PURE__ */ jsx(
|
|
114
|
+
TableColumnVisibility,
|
|
115
|
+
{
|
|
116
|
+
columns,
|
|
117
|
+
value: visibleKeys,
|
|
118
|
+
label: `${label}\u663E\u793A\u5217`,
|
|
119
|
+
onChange: (keys) => {
|
|
120
|
+
const next = normalizeColumns(keys);
|
|
121
|
+
if (visibleColumns === void 0)
|
|
122
|
+
setHidden(
|
|
123
|
+
columns.filter((column) => !next.includes(column.key)).map((column) => column.key)
|
|
124
|
+
);
|
|
125
|
+
onVisibleColumnsChange?.(next);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
] }),
|
|
130
|
+
/* @__PURE__ */ jsx(LoadingOverlay, { active: loading, children: /* @__PURE__ */ jsxs("div", { className: s.scroll, children: [
|
|
131
|
+
/* @__PURE__ */ jsxs("table", { className: s.table, "aria-label": label, children: [
|
|
132
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
133
|
+
onSelectionChange && /* @__PURE__ */ jsx("th", { className: s.selection, children: /* @__PURE__ */ jsx(
|
|
134
|
+
Checkbox,
|
|
135
|
+
{
|
|
136
|
+
label: "\u9009\u62E9\u5F53\u524D\u9875",
|
|
137
|
+
checked: ids.length > 0 && selectedCount === ids.length,
|
|
138
|
+
indeterminate: selectedCount > 0 && selectedCount < ids.length,
|
|
139
|
+
disabled: !ids.length,
|
|
140
|
+
onChange: (checked) => onSelectionChange(
|
|
141
|
+
checked ? [.../* @__PURE__ */ new Set([...selection, ...ids])] : selection.filter((key) => !ids.includes(key))
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
) }),
|
|
145
|
+
displayColumns.map((column) => /* @__PURE__ */ jsx(
|
|
146
|
+
"th",
|
|
147
|
+
{
|
|
148
|
+
scope: "col",
|
|
149
|
+
"aria-sort": sort?.key === column.key ? sort.direction === "asc" ? "ascending" : "descending" : "none",
|
|
150
|
+
children: /* @__PURE__ */ jsxs("div", { className: s.heading, children: [
|
|
151
|
+
column.sortable ? /* @__PURE__ */ jsxs(
|
|
152
|
+
"button",
|
|
153
|
+
{
|
|
154
|
+
type: "button",
|
|
155
|
+
className: s.sort,
|
|
156
|
+
"aria-label": `\u6392\u5E8F${column.label}`,
|
|
157
|
+
onClick: () => changeSort(
|
|
158
|
+
sort?.key !== column.key ? { key: column.key, direction: "asc" } : sort.direction === "asc" ? { key: column.key, direction: "desc" } : null
|
|
159
|
+
),
|
|
160
|
+
children: [
|
|
161
|
+
column.label,
|
|
162
|
+
sort?.key === column.key ? sort.direction === "asc" ? /* @__PURE__ */ jsx(ArrowUp, {}) : /* @__PURE__ */ jsx(ArrowDown, {}) : /* @__PURE__ */ jsx(ArrowUpDown, {})
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
) : column.label,
|
|
166
|
+
column.filterOptions && /* @__PURE__ */ jsx(
|
|
167
|
+
TableColumnFilter,
|
|
168
|
+
{
|
|
169
|
+
label: column.label,
|
|
170
|
+
options: column.filterOptions,
|
|
171
|
+
value: filters[column.key] || [],
|
|
172
|
+
onChange: (values) => changeFilters({ ...filters, [column.key]: values })
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
] })
|
|
176
|
+
},
|
|
177
|
+
column.key
|
|
178
|
+
))
|
|
179
|
+
] }) }),
|
|
180
|
+
/* @__PURE__ */ jsx("tbody", { children: visible.map((row) => /* @__PURE__ */ jsxs(
|
|
181
|
+
"tr",
|
|
182
|
+
{
|
|
183
|
+
"data-selected": selection.includes(rowKey(row)),
|
|
184
|
+
children: [
|
|
185
|
+
onSelectionChange && /* @__PURE__ */ jsx("td", { className: s.selection, children: /* @__PURE__ */ jsx(
|
|
186
|
+
Checkbox,
|
|
187
|
+
{
|
|
188
|
+
label: selectionLabel?.(row) || `\u9009\u62E9${rowKey(row)}`,
|
|
189
|
+
checked: selection.includes(rowKey(row)),
|
|
190
|
+
onChange: (checked) => onSelectionChange(
|
|
191
|
+
checked ? [.../* @__PURE__ */ new Set([...selection, rowKey(row)])] : selection.filter((key) => key !== rowKey(row))
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
) }),
|
|
195
|
+
displayColumns.map((column) => /* @__PURE__ */ jsx("td", { children: column.render ? column.render(row) : column.value(row) }, column.key))
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
rowKey(row)
|
|
199
|
+
)) })
|
|
200
|
+
] }),
|
|
201
|
+
!filtered.length && /* @__PURE__ */ jsx(Placeholder, { variant: rows.length ? "search" : "empty" })
|
|
202
|
+
] }) }),
|
|
203
|
+
/* @__PURE__ */ jsx(
|
|
204
|
+
Pagination,
|
|
205
|
+
{
|
|
206
|
+
summary: selection.length ? ` \xB7 \u5DF2\u9009\u62E9 ${selection.length} \u9879` : void 0,
|
|
207
|
+
page: current,
|
|
208
|
+
pageSize,
|
|
209
|
+
total: count,
|
|
210
|
+
pageSizes,
|
|
211
|
+
resetPageOnSizeChange: false,
|
|
212
|
+
onPageChange: (next) => changePage({ page: next, pageSize }),
|
|
213
|
+
onPageSizeChange: (next) => changePage({ page: 1, pageSize: next })
|
|
214
|
+
}
|
|
215
|
+
)
|
|
216
|
+
] });
|
|
217
|
+
}
|
|
218
|
+
export {
|
|
219
|
+
DataTable
|
|
220
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
min-width: 0;
|
|
3
|
+
}
|
|
4
|
+
.toolbar {
|
|
5
|
+
display: flex;
|
|
6
|
+
justify-content: flex-end;
|
|
7
|
+
align-items: center;
|
|
8
|
+
gap: 8px;
|
|
9
|
+
flex-wrap: wrap;
|
|
10
|
+
margin-bottom: 12px;
|
|
11
|
+
}
|
|
12
|
+
.columnMenu {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
}
|
|
16
|
+
.scroll {
|
|
17
|
+
overflow: auto;
|
|
18
|
+
border: 1px solid var(--line);
|
|
19
|
+
border-radius: var(--radius);
|
|
20
|
+
}
|
|
21
|
+
.table {
|
|
22
|
+
width: 100%;
|
|
23
|
+
border-collapse: collapse;
|
|
24
|
+
text-align: left;
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
}
|
|
27
|
+
.table th {
|
|
28
|
+
background: var(--soft);
|
|
29
|
+
font-size: 12px;
|
|
30
|
+
font-weight: 500;
|
|
31
|
+
color: var(--muted);
|
|
32
|
+
}
|
|
33
|
+
.table td,
|
|
34
|
+
.table th {
|
|
35
|
+
padding: 12px 16px;
|
|
36
|
+
border-bottom: var(--separator-width) var(--separator-style)
|
|
37
|
+
var(--separator-color);
|
|
38
|
+
height: 48px;
|
|
39
|
+
}
|
|
40
|
+
.table tbody tr:last-child td {
|
|
41
|
+
border-bottom: 0;
|
|
42
|
+
}
|
|
43
|
+
.table tbody tr:hover {
|
|
44
|
+
background: var(--hover);
|
|
45
|
+
}
|
|
46
|
+
.table tr[data-selected="true"] {
|
|
47
|
+
background: var(--selected);
|
|
48
|
+
}
|
|
49
|
+
.heading {
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: space-between;
|
|
53
|
+
gap: 8px;
|
|
54
|
+
}
|
|
55
|
+
.sort,
|
|
56
|
+
.filter {
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: 7px;
|
|
60
|
+
border: 0;
|
|
61
|
+
background: transparent;
|
|
62
|
+
padding: 4px;
|
|
63
|
+
border-radius: 5px;
|
|
64
|
+
color: inherit;
|
|
65
|
+
}
|
|
66
|
+
.sort:hover,
|
|
67
|
+
.filter:hover {
|
|
68
|
+
background: var(--hover);
|
|
69
|
+
color: var(--fg);
|
|
70
|
+
}
|
|
71
|
+
.sort svg,
|
|
72
|
+
.filter svg {
|
|
73
|
+
width: 14px;
|
|
74
|
+
height: 14px;
|
|
75
|
+
}
|
|
76
|
+
.filter[data-active="true"] {
|
|
77
|
+
color: var(--accent);
|
|
78
|
+
background: var(--selected);
|
|
79
|
+
}
|
|
80
|
+
.filterPanel {
|
|
81
|
+
max-height: 300px;
|
|
82
|
+
overflow: auto;
|
|
83
|
+
}
|
|
84
|
+
.selection {
|
|
85
|
+
width: 44px;
|
|
86
|
+
}
|
|
87
|
+
.selection label > span:last-child {
|
|
88
|
+
position: absolute;
|
|
89
|
+
width: 1px;
|
|
90
|
+
height: 1px;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
clip-path: inset(50%);
|
|
93
|
+
}
|
|
94
|
+
.table td > button {
|
|
95
|
+
display: flex;
|
|
96
|
+
gap: 9px;
|
|
97
|
+
align-items: center;
|
|
98
|
+
border: 0;
|
|
99
|
+
background: transparent;
|
|
100
|
+
border-radius: 5px;
|
|
101
|
+
padding: 4px;
|
|
102
|
+
color: inherit;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.filterReset {
|
|
106
|
+
display: flex;
|
|
107
|
+
justify-content: flex-end;
|
|
108
|
+
margin-top: 6px;
|
|
109
|
+
padding-top: 6px;
|
|
110
|
+
border-top: var(--separator-width) var(--separator-style)
|
|
111
|
+
var(--separator-color);
|
|
112
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type FieldOptions } from "./field";
|
|
2
|
+
import { type DateConstraints } from "./dateConstraints";
|
|
3
|
+
import { type DateRangePickerProps } from "./DateRangePicker";
|
|
4
|
+
export type DatePickerMode = "date" | "time" | "datetime" | "range";
|
|
5
|
+
export type SingleDatePickerProps = FieldOptions & DateConstraints & {
|
|
6
|
+
value: string;
|
|
7
|
+
onChange(value: string): void;
|
|
8
|
+
label: string;
|
|
9
|
+
mode?: Exclude<DatePickerMode, "range">;
|
|
10
|
+
seconds?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type DatePickerProps = SingleDatePickerProps | (DateRangePickerProps & {
|
|
13
|
+
mode: "range";
|
|
14
|
+
});
|
|
15
|
+
export declare function DatePicker(props: DatePickerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import { fieldTriggerProps, useFieldControl } from "./field.js";
|
|
4
|
+
import { useId, useState } from "react";
|
|
5
|
+
import { CalendarDays, Clock3 } from "lucide-react";
|
|
6
|
+
import { Popover } from "./Popover.js";
|
|
7
|
+
import { usePopover } from "./usePopover.js";
|
|
8
|
+
import { Calendar, dateKey } from "./Calendar.js";
|
|
9
|
+
import { TimeColumns } from "./TimeColumns.js";
|
|
10
|
+
import { Button } from "./Button.js";
|
|
11
|
+
import s from "./DatePicker.module.css";
|
|
12
|
+
import {
|
|
13
|
+
boundedDate,
|
|
14
|
+
isDateAllowed
|
|
15
|
+
} from "./dateConstraints.js";
|
|
16
|
+
import { DateRangePicker } from "./DateRangePicker.js";
|
|
17
|
+
function DatePicker(props) {
|
|
18
|
+
return props.mode === "range" ? /* @__PURE__ */ jsx(DateRangePicker, { ...props }) : /* @__PURE__ */ jsx(SingleDatePicker, { ...props });
|
|
19
|
+
}
|
|
20
|
+
function SingleDatePicker({
|
|
21
|
+
value,
|
|
22
|
+
onChange,
|
|
23
|
+
label,
|
|
24
|
+
mode = "date",
|
|
25
|
+
seconds = false,
|
|
26
|
+
disabled,
|
|
27
|
+
readOnly,
|
|
28
|
+
name,
|
|
29
|
+
id: controlId,
|
|
30
|
+
required,
|
|
31
|
+
error,
|
|
32
|
+
hint,
|
|
33
|
+
minDate,
|
|
34
|
+
maxDate,
|
|
35
|
+
disabledDate,
|
|
36
|
+
...aria
|
|
37
|
+
}) {
|
|
38
|
+
const constraints = { minDate, maxDate, disabledDate };
|
|
39
|
+
const field = useFieldControl({
|
|
40
|
+
id: controlId,
|
|
41
|
+
name,
|
|
42
|
+
label,
|
|
43
|
+
disabled,
|
|
44
|
+
readOnly,
|
|
45
|
+
required,
|
|
46
|
+
error,
|
|
47
|
+
hint,
|
|
48
|
+
...aria
|
|
49
|
+
});
|
|
50
|
+
const pop = usePopover(field.disabled || field.readOnly), id = useId(), [date, setDate] = useState(value.slice(0, 10) || dateKey(/* @__PURE__ */ new Date())), [time, setTime] = useState("00:00");
|
|
51
|
+
const close = pop.closeAndFocus;
|
|
52
|
+
const show = () => {
|
|
53
|
+
if (field.disabled || field.readOnly) return;
|
|
54
|
+
if (pop.open) {
|
|
55
|
+
pop.close();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
setDate(
|
|
59
|
+
mode === "time" ? dateKey(/* @__PURE__ */ new Date()) : boundedDate(value.slice(0, 10), constraints)
|
|
60
|
+
);
|
|
61
|
+
setTime(
|
|
62
|
+
(mode === "time" ? value : value.split(/[T ]/)[1]) || (seconds ? "00:00:00" : "00:00")
|
|
63
|
+
);
|
|
64
|
+
pop.show();
|
|
65
|
+
};
|
|
66
|
+
const commit = () => {
|
|
67
|
+
if (mode !== "time" && !isDateAllowed(date, constraints)) return;
|
|
68
|
+
onChange(
|
|
69
|
+
mode === "date" ? date : mode === "time" ? time : date + "T" + time
|
|
70
|
+
);
|
|
71
|
+
close();
|
|
72
|
+
};
|
|
73
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
74
|
+
/* @__PURE__ */ jsxs(
|
|
75
|
+
"button",
|
|
76
|
+
{
|
|
77
|
+
...fieldTriggerProps(field),
|
|
78
|
+
role: "combobox",
|
|
79
|
+
ref: pop.anchor,
|
|
80
|
+
type: "button",
|
|
81
|
+
className: s.trigger,
|
|
82
|
+
"aria-expanded": pop.open,
|
|
83
|
+
"aria-haspopup": "dialog",
|
|
84
|
+
"aria-controls": id,
|
|
85
|
+
onClick: show,
|
|
86
|
+
onKeyDown: (e) => {
|
|
87
|
+
if (e.key === "ArrowDown" && !pop.open) {
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
show();
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ jsx("span", { children: value.replace("T", " ") || "\u8BF7\u9009\u62E9" }),
|
|
94
|
+
mode === "time" ? /* @__PURE__ */ jsx(Clock3, {}) : /* @__PURE__ */ jsx(CalendarDays, {})
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
field.name && /* @__PURE__ */ jsx(
|
|
99
|
+
"input",
|
|
100
|
+
{
|
|
101
|
+
type: "hidden",
|
|
102
|
+
name: field.name,
|
|
103
|
+
value,
|
|
104
|
+
disabled: field.disabled
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
/* @__PURE__ */ jsxs(
|
|
108
|
+
Popover,
|
|
109
|
+
{
|
|
110
|
+
anchor: pop.anchor,
|
|
111
|
+
open: pop.open,
|
|
112
|
+
onClose: pop.close,
|
|
113
|
+
label,
|
|
114
|
+
id,
|
|
115
|
+
width: mode === "datetime" ? seconds ? 530 : 470 : mode === "time" ? seconds ? 260 : 210 : 288,
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ jsxs("div", { className: s.body, "data-mode": mode, children: [
|
|
118
|
+
mode !== "time" && /* @__PURE__ */ createElement(
|
|
119
|
+
Calendar,
|
|
120
|
+
{
|
|
121
|
+
...constraints,
|
|
122
|
+
key: pop.open ? "open" : "closed",
|
|
123
|
+
value: date,
|
|
124
|
+
onChange: (next) => {
|
|
125
|
+
if (!isDateAllowed(next, constraints)) return;
|
|
126
|
+
setDate(next);
|
|
127
|
+
if (mode === "date") {
|
|
128
|
+
onChange(next);
|
|
129
|
+
close();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
mode !== "date" && /* @__PURE__ */ jsx(
|
|
135
|
+
TimeColumns,
|
|
136
|
+
{
|
|
137
|
+
value: time,
|
|
138
|
+
onChange: setTime,
|
|
139
|
+
seconds,
|
|
140
|
+
active: pop.open
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
] }),
|
|
144
|
+
/* @__PURE__ */ jsxs("footer", { className: s.footer, children: [
|
|
145
|
+
/* @__PURE__ */ jsx(
|
|
146
|
+
"button",
|
|
147
|
+
{
|
|
148
|
+
type: "button",
|
|
149
|
+
disabled: mode !== "time" && !isDateAllowed(dateKey(/* @__PURE__ */ new Date()), constraints),
|
|
150
|
+
onClick: () => {
|
|
151
|
+
const now = /* @__PURE__ */ new Date(), nextDate = dateKey(now), nextTime = [
|
|
152
|
+
now.getHours(),
|
|
153
|
+
now.getMinutes(),
|
|
154
|
+
...seconds ? [now.getSeconds()] : []
|
|
155
|
+
].map((v) => String(v).padStart(2, "0")).join(":");
|
|
156
|
+
if (mode !== "time" && !isDateAllowed(nextDate, constraints))
|
|
157
|
+
return;
|
|
158
|
+
setDate(nextDate);
|
|
159
|
+
setTime(nextTime);
|
|
160
|
+
if (mode === "date") {
|
|
161
|
+
onChange(nextDate);
|
|
162
|
+
close();
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
children: mode === "date" ? "\u4ECA\u5929" : "\u6B64\u523B"
|
|
166
|
+
}
|
|
167
|
+
),
|
|
168
|
+
mode !== "date" && /* @__PURE__ */ jsx(
|
|
169
|
+
Button,
|
|
170
|
+
{
|
|
171
|
+
variant: "primary",
|
|
172
|
+
size: "small",
|
|
173
|
+
onClick: commit,
|
|
174
|
+
disabled: mode !== "time" && !isDateAllowed(date, constraints),
|
|
175
|
+
children: "\u786E\u5B9A"
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
] })
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
] });
|
|
183
|
+
}
|
|
184
|
+
export {
|
|
185
|
+
DatePicker
|
|
186
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
.trigger {
|
|
2
|
+
composes: surface from "./Control.module.css";
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: space-between;
|
|
6
|
+
gap: 18px;
|
|
7
|
+
padding: 5px 10px;
|
|
8
|
+
min-width: 168px;
|
|
9
|
+
}
|
|
10
|
+
.trigger svg {
|
|
11
|
+
width: 15px;
|
|
12
|
+
height: 15px;
|
|
13
|
+
color: var(--muted);
|
|
14
|
+
}
|
|
15
|
+
.body {
|
|
16
|
+
display: flex;
|
|
17
|
+
}
|
|
18
|
+
.body[data-mode="datetime"] > :first-child {
|
|
19
|
+
flex: 1;
|
|
20
|
+
}
|
|
21
|
+
.body[data-mode="datetime"] > :last-child {
|
|
22
|
+
width: 170px;
|
|
23
|
+
border-left: var(--separator-width) var(--separator-style)
|
|
24
|
+
var(--separator-color);
|
|
25
|
+
margin-left: 8px;
|
|
26
|
+
}
|
|
27
|
+
.body[data-mode="time"] > div {
|
|
28
|
+
width: 100%;
|
|
29
|
+
}
|
|
30
|
+
.footer {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
padding: 9px 4px 4px;
|
|
35
|
+
margin-top: 6px;
|
|
36
|
+
border-top: var(--separator-width) var(--separator-style)
|
|
37
|
+
var(--separator-color);
|
|
38
|
+
min-height: 38px;
|
|
39
|
+
}
|
|
40
|
+
.footer > button:first-child {
|
|
41
|
+
border: 0;
|
|
42
|
+
background: transparent;
|
|
43
|
+
border-radius: 5px;
|
|
44
|
+
padding: 5px 10px;
|
|
45
|
+
font-size: 12px;
|
|
46
|
+
}
|
|
47
|
+
.footer > button:first-child:hover {
|
|
48
|
+
background: var(--hover);
|
|
49
|
+
}
|
|
50
|
+
.footer > button:first-child:disabled {
|
|
51
|
+
cursor: not-allowed;
|
|
52
|
+
opacity: 0.42;
|
|
53
|
+
}
|
|
54
|
+
.footer > button:first-child:disabled:hover {
|
|
55
|
+
background: transparent;
|
|
56
|
+
}
|
|
57
|
+
.rangeSummary {
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
justify-content: space-between;
|
|
61
|
+
gap: 8px;
|
|
62
|
+
padding: 9px 8px;
|
|
63
|
+
font-size: 12px;
|
|
64
|
+
border-bottom: var(--separator-width) var(--separator-style)
|
|
65
|
+
var(--separator-color);
|
|
66
|
+
}
|
|
67
|
+
.rangeSummary > svg {
|
|
68
|
+
width: 14px;
|
|
69
|
+
height: 14px;
|
|
70
|
+
color: var(--muted);
|
|
71
|
+
}
|
|
72
|
+
.rangeError {
|
|
73
|
+
min-height: 20px;
|
|
74
|
+
color: var(--danger);
|
|
75
|
+
font-size: 11px;
|
|
76
|
+
padding: 2px 6px;
|
|
77
|
+
}
|
|
78
|
+
.rangeActions {
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
gap: 6px;
|
|
82
|
+
}
|
|
83
|
+
.footer > button:only-child {
|
|
84
|
+
width: 100%;
|
|
85
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type FieldOptions } from "./field";
|
|
2
|
+
import { type DateConstraints, type DateRange } from "./dateConstraints";
|
|
3
|
+
export type DateRangePickerProps = FieldOptions & DateConstraints & {
|
|
4
|
+
value: DateRange;
|
|
5
|
+
onChange(value: DateRange): void;
|
|
6
|
+
label: string;
|
|
7
|
+
clearable?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function DateRangePicker({ value, onChange, label, clearable, minDate, maxDate, disabledDate, ...options }: DateRangePickerProps): import("react").JSX.Element;
|