@robert-stackflow/oneui 0.6.8 → 0.6.16
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 +58 -0
- package/README.md +255 -188
- package/components/AccountItem.module.css +103 -103
- package/components/Alert.d.ts +2 -9
- package/components/Alert.js +2 -40
- package/components/AppShell.d.ts +7 -7
- package/components/AppShell.js +37 -33
- package/components/AppShell.module.css +223 -271
- package/components/AppearanceSettings.js +25 -32
- package/components/Badge.module.css +30 -30
- package/components/Banner.d.ts +17 -0
- package/components/Banner.js +99 -0
- package/components/Banner.module.css +143 -0
- package/components/BarChart.module.css +35 -34
- package/components/Breadcrumb.module.css +97 -97
- package/components/Button.module.css +120 -120
- package/components/Cascader.js +1 -0
- package/components/CharacterPicker.js +2 -0
- package/components/Checkbox.module.css +95 -95
- package/components/Combobox.js +1 -0
- package/components/Combobox.module.css +6 -1
- package/components/CommandPalette.js +2 -2
- package/components/ContributionCalendar.module.css +121 -121
- package/components/Control.module.css +86 -86
- package/components/DataTable.d.ts +3 -2
- package/components/DataTable.js +92 -66
- package/components/DataTable.module.css +3 -31
- package/components/DatePicker.js +1 -0
- package/components/DateRangePicker.js +1 -0
- package/components/Dialog.d.ts +3 -1
- package/components/Dialog.js +11 -4
- package/components/Dialog.module.css +139 -97
- package/components/DialogVariants.d.ts +2 -1
- package/components/DialogVariants.js +35 -7
- package/components/HierarchyPicker.module.css +185 -181
- package/components/IconPicker.js +2 -0
- package/components/Indicator.module.css +83 -83
- package/components/Layout.module.css +82 -82
- package/components/Markdown.d.ts +13 -0
- package/components/Markdown.js +164 -0
- package/components/Markdown.module.css +227 -0
- package/components/MenuItem.module.css +172 -172
- package/components/MultiSelect.js +1 -0
- package/components/MultiSelect.module.css +2 -0
- package/components/NavBar.d.ts +20 -0
- package/components/NavBar.js +197 -0
- package/components/NavBar.module.css +130 -0
- package/components/NavigationSurface.module.css +27 -0
- package/components/Picker.module.css +7 -0
- package/components/Popover.d.ts +6 -1
- package/components/Popover.js +39 -13
- package/components/Popover.module.css +8 -0
- package/components/Progress.module.css +33 -33
- package/components/RadioGroup.module.css +87 -87
- package/components/RangeSlider.module.css +141 -141
- package/components/ResizablePanel.module.css +101 -101
- package/components/ResourceCard.module.css +98 -98
- package/components/SelectSettingRow.d.ts +7 -0
- package/components/SelectSettingRow.js +58 -0
- package/components/SettingRow.d.ts +9 -3
- package/components/SettingRow.js +32 -8
- package/components/SettingRow.module.css +17 -0
- package/components/SettingsLayout.d.ts +15 -3
- package/components/SettingsLayout.js +46 -29
- package/components/SideBar.d.ts +9 -0
- package/components/SideBar.js +30 -0
- package/components/SidebarNavigation.d.ts +24 -3
- package/components/SidebarNavigation.js +274 -47
- package/components/SidebarNavigation.module.css +352 -130
- package/components/Slider.module.css +19 -19
- package/components/Steps.module.css +176 -176
- package/components/Switch.d.ts +3 -1
- package/components/Switch.js +5 -1
- package/components/Switch.module.css +59 -59
- package/components/SwitchSettingRow.d.ts +7 -0
- package/components/SwitchSettingRow.js +45 -0
- package/components/Table.d.ts +8 -1
- package/components/Table.js +34 -17
- package/components/Table.module.css +87 -48
- package/components/TableMarkup.d.ts +2 -1
- package/components/TableMarkup.js +18 -1
- package/components/TableOfContents.d.ts +22 -0
- package/components/TableOfContents.js +462 -0
- package/components/TableOfContents.module.css +252 -0
- package/components/TextAreaSettingRow.d.ts +9 -0
- package/components/TextAreaSettingRow.js +47 -0
- package/components/TextSettingRow.d.ts +9 -0
- package/components/TextSettingRow.js +45 -0
- package/components/ThemePicker.module.css +178 -178
- package/components/ThemeProvider.js +2 -0
- package/components/TimeColumns.module.css +47 -47
- package/components/Timeline.module.css +202 -202
- package/components/Toast.d.ts +8 -1
- package/components/Toast.js +49 -17
- package/components/Toast.module.css +25 -0
- package/components/ToastProvider.d.ts +4 -1
- package/components/ToastProvider.js +67 -12
- package/components/TreeSelect.js +1 -0
- package/components/TreeTable.d.ts +3 -3
- package/components/TreeTable.js +12 -2
- package/components/TreeTable.module.css +57 -53
- package/components/createToaster.d.ts +2 -1
- package/components/createToaster.js +28 -14
- package/components/index.d.ts +18 -1
- package/components/index.js +24 -0
- package/components/motion.d.ts +1 -0
- package/components/motion.js +18 -6
- package/components/settingRowControl.d.ts +7 -0
- package/components/settingRowControl.js +15 -0
- package/package.json +57 -3
- package/styles/base.css +206 -206
- package/styles/blue.css +270 -268
- package/styles/minimal.css +1 -0
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
.calendar {
|
|
2
|
-
container-type: inline-size;
|
|
3
|
-
--calendar-cell: 13px;
|
|
4
|
-
--calendar-gap: 3px;
|
|
5
|
-
min-width: 0;
|
|
6
|
-
border: 1px solid var(--line);
|
|
7
|
-
border-radius: var(--radius);
|
|
8
|
-
padding: 20px;
|
|
9
|
-
background: var(--surface);
|
|
10
|
-
}
|
|
11
|
-
.header,
|
|
12
|
-
.footer {
|
|
13
|
-
display: flex;
|
|
14
|
-
align-items: center;
|
|
15
|
-
justify-content: space-between;
|
|
16
|
-
gap: 14px;
|
|
17
|
-
}
|
|
18
|
-
.header {
|
|
19
|
-
margin-bottom: 16px;
|
|
20
|
-
}
|
|
21
|
-
.header > span,
|
|
22
|
-
.footer {
|
|
23
|
-
font-size: 11px;
|
|
24
|
-
color: var(--muted);
|
|
25
|
-
}
|
|
26
|
-
.scroll {
|
|
27
|
-
--calendar-cell: clamp(
|
|
28
|
-
9px,
|
|
29
|
-
calc((100cqw - 32px) / var(--calendar-weeks) - var(--calendar-gap)),
|
|
30
|
-
13px
|
|
31
|
-
);
|
|
32
|
-
overflow: auto;
|
|
33
|
-
padding: 3px 2px 6px;
|
|
34
|
-
}
|
|
35
|
-
.months,
|
|
36
|
-
.row {
|
|
37
|
-
display: grid;
|
|
38
|
-
column-gap: var(--calendar-gap);
|
|
39
|
-
width: max-content;
|
|
40
|
-
align-items: center;
|
|
41
|
-
}
|
|
42
|
-
.months {
|
|
43
|
-
height: 22px;
|
|
44
|
-
font-size: 10px;
|
|
45
|
-
color: var(--muted);
|
|
46
|
-
}
|
|
47
|
-
.months > span {
|
|
48
|
-
grid-row: 1;
|
|
49
|
-
white-space: nowrap;
|
|
50
|
-
}
|
|
51
|
-
.row {
|
|
52
|
-
height: calc(var(--calendar-cell) + var(--calendar-gap));
|
|
53
|
-
}
|
|
54
|
-
.weekday {
|
|
55
|
-
font-size: 10px;
|
|
56
|
-
color: var(--muted);
|
|
57
|
-
}
|
|
58
|
-
.day,
|
|
59
|
-
.pad {
|
|
60
|
-
width: var(--calendar-cell);
|
|
61
|
-
height: var(--calendar-cell);
|
|
62
|
-
}
|
|
63
|
-
.day {
|
|
64
|
-
display: block;
|
|
65
|
-
padding: 0;
|
|
66
|
-
border: 1px solid color-mix(in srgb, var(--fg) 6%, transparent);
|
|
67
|
-
border-radius: 3px;
|
|
68
|
-
background: color-mix(in srgb, var(--fg) 8%, var(--surface));
|
|
69
|
-
transition:
|
|
70
|
-
transform var(--motion-press),
|
|
71
|
-
box-shadow var(--motion-hover);
|
|
72
|
-
}
|
|
73
|
-
.day[data-level="1"] {
|
|
74
|
-
background: color-mix(in srgb, var(--calendar-color) 25%, var(--surface));
|
|
75
|
-
}
|
|
76
|
-
.day[data-level="2"] {
|
|
77
|
-
background: color-mix(in srgb, var(--calendar-color) 45%, var(--surface));
|
|
78
|
-
}
|
|
79
|
-
.day[data-level="3"] {
|
|
80
|
-
background: color-mix(in srgb, var(--calendar-color) 70%, var(--surface));
|
|
81
|
-
}
|
|
82
|
-
.day[data-level="4"] {
|
|
83
|
-
background: var(--calendar-color);
|
|
84
|
-
}
|
|
85
|
-
.day[data-future="true"] {
|
|
86
|
-
opacity: 0.3;
|
|
87
|
-
cursor: default;
|
|
88
|
-
}
|
|
89
|
-
.day[data-missing="true"] {
|
|
90
|
-
background: repeating-linear-gradient(
|
|
91
|
-
135deg,
|
|
92
|
-
transparent,
|
|
93
|
-
transparent 2px,
|
|
94
|
-
color-mix(in srgb, var(--fg) 12%, var(--surface)) 2px,
|
|
95
|
-
color-mix(in srgb, var(--fg) 12%, var(--surface)) 3px
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
.day:hover:not([data-future="true"]) {
|
|
99
|
-
transform: scale(1.12);
|
|
100
|
-
}
|
|
101
|
-
.day:focus-visible,
|
|
102
|
-
.day[aria-selected="true"] {
|
|
103
|
-
outline: 2px solid var(--accent);
|
|
104
|
-
outline-offset: 1px;
|
|
105
|
-
}
|
|
106
|
-
.footer {
|
|
107
|
-
margin-top: 12px;
|
|
108
|
-
min-height: 18px;
|
|
109
|
-
}
|
|
110
|
-
.legend {
|
|
111
|
-
display: flex;
|
|
112
|
-
align-items: center;
|
|
113
|
-
gap: 4px;
|
|
114
|
-
margin-left: auto;
|
|
115
|
-
}
|
|
116
|
-
.legend > span {
|
|
117
|
-
margin: 0 3px;
|
|
118
|
-
}
|
|
119
|
-
.legend .day {
|
|
120
|
-
cursor: default;
|
|
121
|
-
}
|
|
1
|
+
.calendar {
|
|
2
|
+
container-type: inline-size;
|
|
3
|
+
--calendar-cell: 13px;
|
|
4
|
+
--calendar-gap: 3px;
|
|
5
|
+
min-width: 0;
|
|
6
|
+
border: 1px solid var(--line);
|
|
7
|
+
border-radius: var(--radius);
|
|
8
|
+
padding: 20px;
|
|
9
|
+
background: var(--surface);
|
|
10
|
+
}
|
|
11
|
+
.header,
|
|
12
|
+
.footer {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: space-between;
|
|
16
|
+
gap: 14px;
|
|
17
|
+
}
|
|
18
|
+
.header {
|
|
19
|
+
margin-bottom: 16px;
|
|
20
|
+
}
|
|
21
|
+
.header > span,
|
|
22
|
+
.footer {
|
|
23
|
+
font-size: 11px;
|
|
24
|
+
color: var(--muted);
|
|
25
|
+
}
|
|
26
|
+
.scroll {
|
|
27
|
+
--calendar-cell: clamp(
|
|
28
|
+
9px,
|
|
29
|
+
calc((100cqw - 32px) / var(--calendar-weeks) - var(--calendar-gap)),
|
|
30
|
+
13px
|
|
31
|
+
);
|
|
32
|
+
overflow: auto;
|
|
33
|
+
padding: 3px 2px 6px;
|
|
34
|
+
}
|
|
35
|
+
.months,
|
|
36
|
+
.row {
|
|
37
|
+
display: grid;
|
|
38
|
+
column-gap: var(--calendar-gap);
|
|
39
|
+
width: max-content;
|
|
40
|
+
align-items: center;
|
|
41
|
+
}
|
|
42
|
+
.months {
|
|
43
|
+
height: 22px;
|
|
44
|
+
font-size: 10px;
|
|
45
|
+
color: var(--muted);
|
|
46
|
+
}
|
|
47
|
+
.months > span {
|
|
48
|
+
grid-row: 1;
|
|
49
|
+
white-space: nowrap;
|
|
50
|
+
}
|
|
51
|
+
.row {
|
|
52
|
+
height: calc(var(--calendar-cell) + var(--calendar-gap));
|
|
53
|
+
}
|
|
54
|
+
.weekday {
|
|
55
|
+
font-size: 10px;
|
|
56
|
+
color: var(--muted);
|
|
57
|
+
}
|
|
58
|
+
.day,
|
|
59
|
+
.pad {
|
|
60
|
+
width: var(--calendar-cell);
|
|
61
|
+
height: var(--calendar-cell);
|
|
62
|
+
}
|
|
63
|
+
.day {
|
|
64
|
+
display: block;
|
|
65
|
+
padding: 0;
|
|
66
|
+
border: 1px solid color-mix(in srgb, var(--fg) 6%, transparent);
|
|
67
|
+
border-radius: 3px;
|
|
68
|
+
background: color-mix(in srgb, var(--fg) 8%, var(--surface));
|
|
69
|
+
transition:
|
|
70
|
+
transform var(--motion-press),
|
|
71
|
+
box-shadow var(--motion-hover);
|
|
72
|
+
}
|
|
73
|
+
.day[data-level="1"] {
|
|
74
|
+
background: color-mix(in srgb, var(--calendar-color) 25%, var(--surface));
|
|
75
|
+
}
|
|
76
|
+
.day[data-level="2"] {
|
|
77
|
+
background: color-mix(in srgb, var(--calendar-color) 45%, var(--surface));
|
|
78
|
+
}
|
|
79
|
+
.day[data-level="3"] {
|
|
80
|
+
background: color-mix(in srgb, var(--calendar-color) 70%, var(--surface));
|
|
81
|
+
}
|
|
82
|
+
.day[data-level="4"] {
|
|
83
|
+
background: var(--calendar-color);
|
|
84
|
+
}
|
|
85
|
+
.day[data-future="true"] {
|
|
86
|
+
opacity: 0.3;
|
|
87
|
+
cursor: default;
|
|
88
|
+
}
|
|
89
|
+
.day[data-missing="true"] {
|
|
90
|
+
background: repeating-linear-gradient(
|
|
91
|
+
135deg,
|
|
92
|
+
transparent,
|
|
93
|
+
transparent 2px,
|
|
94
|
+
color-mix(in srgb, var(--fg) 12%, var(--surface)) 2px,
|
|
95
|
+
color-mix(in srgb, var(--fg) 12%, var(--surface)) 3px
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
.day:hover:not([data-future="true"]) {
|
|
99
|
+
transform: scale(1.12);
|
|
100
|
+
}
|
|
101
|
+
.day:focus-visible,
|
|
102
|
+
.day[aria-selected="true"] {
|
|
103
|
+
outline: 2px solid var(--accent-ink, var(--accent));
|
|
104
|
+
outline-offset: 1px;
|
|
105
|
+
}
|
|
106
|
+
.footer {
|
|
107
|
+
margin-top: 12px;
|
|
108
|
+
min-height: 18px;
|
|
109
|
+
}
|
|
110
|
+
.legend {
|
|
111
|
+
display: flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
gap: 4px;
|
|
114
|
+
margin-left: auto;
|
|
115
|
+
}
|
|
116
|
+
.legend > span {
|
|
117
|
+
margin: 0 3px;
|
|
118
|
+
}
|
|
119
|
+
.legend .day {
|
|
120
|
+
cursor: default;
|
|
121
|
+
}
|
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
.surface {
|
|
2
|
-
height: var(--control-height);
|
|
3
|
-
min-width: 0;
|
|
4
|
-
border: 1px solid var(--control-border, var(--line));
|
|
5
|
-
border-radius: var(--field-radius);
|
|
6
|
-
background: var(--field);
|
|
7
|
-
color: var(--fg);
|
|
8
|
-
font-size: var(--field-font-size);
|
|
9
|
-
line-height: var(--field-line-height);
|
|
10
|
-
outline: none;
|
|
11
|
-
transition:
|
|
12
|
-
border-color var(--motion-hover),
|
|
13
|
-
box-shadow var(--motion-hover),
|
|
14
|
-
background-color var(--motion-hover);
|
|
15
|
-
}
|
|
16
|
-
.surface:hover:where(
|
|
17
|
-
:not(
|
|
18
|
-
:disabled,
|
|
19
|
-
[data-disabled="true"],
|
|
20
|
-
[aria-disabled="true"],
|
|
21
|
-
[readonly],
|
|
22
|
-
[aria-readonly="true"],
|
|
23
|
-
[data-readonly="true"],
|
|
24
|
-
[data-disabled="true"] *,
|
|
25
|
-
[aria-disabled="true"] *,
|
|
26
|
-
[data-readonly="true"] *,
|
|
27
|
-
fieldset:disabled *,
|
|
28
|
-
:has(input:disabled, textarea:disabled)
|
|
29
|
-
)
|
|
30
|
-
) {
|
|
31
|
-
border-color: var(
|
|
32
|
-
--field-hover-border,
|
|
33
|
-
color-mix(in srgb, var(--fg) var(--field-hover-strength), var(--surface))
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
.surface[data-focus="true"],
|
|
37
|
-
.surface:focus,
|
|
38
|
-
.surface:focus-visible,
|
|
39
|
-
.surface:focus-within,
|
|
40
|
-
.surface[aria-expanded="true"] {
|
|
41
|
-
outline: none;
|
|
42
|
-
border-color: var(--field-focus-border);
|
|
43
|
-
box-shadow: 0 0 0 var(--field-focus-width)
|
|
44
|
-
color-mix(in srgb, var(--accent) var(--field-focus-strength), transparent);
|
|
45
|
-
}
|
|
46
|
-
.surface[aria-invalid="true"] {
|
|
47
|
-
border-color: var(--danger);
|
|
48
|
-
}
|
|
49
|
-
.surface[aria-invalid="true"][data-focus="true"],
|
|
50
|
-
.surface[aria-invalid="true"]:focus-within {
|
|
51
|
-
box-shadow: 0 0 0 var(--field-focus-width)
|
|
52
|
-
color-mix(in srgb, var(--danger) var(--field-focus-strength), transparent);
|
|
53
|
-
}
|
|
54
|
-
.surface:disabled,
|
|
55
|
-
.surface[data-disabled="true"] {
|
|
56
|
-
opacity: var(--field-disabled-opacity);
|
|
57
|
-
cursor: not-allowed;
|
|
58
|
-
}
|
|
59
|
-
.surface[data-disabled="true"] input:disabled {
|
|
60
|
-
opacity: 1;
|
|
61
|
-
}
|
|
62
|
-
.surface input {
|
|
63
|
-
outline: none;
|
|
64
|
-
color: inherit;
|
|
65
|
-
font-family: inherit;
|
|
66
|
-
line-height: inherit;
|
|
67
|
-
}
|
|
68
|
-
.surface input:focus-visible {
|
|
69
|
-
outline: none;
|
|
70
|
-
}
|
|
71
|
-
.surface::placeholder,
|
|
72
|
-
.surface input::placeholder {
|
|
73
|
-
color: var(--placeholder);
|
|
74
|
-
opacity: 1;
|
|
75
|
-
}
|
|
76
|
-
.surface[readonly],
|
|
77
|
-
.surface[aria-readonly="true"],
|
|
78
|
-
.surface:has(input[readonly]) {
|
|
79
|
-
background: var(--field-readonly);
|
|
80
|
-
}
|
|
81
|
-
@media (max-width: 600px) {
|
|
82
|
-
.surface:has(input),
|
|
83
|
-
.surface:is(input, textarea) {
|
|
84
|
-
font-size: 16px;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
1
|
+
.surface {
|
|
2
|
+
height: var(--control-height);
|
|
3
|
+
min-width: 0;
|
|
4
|
+
border: 1px solid var(--control-border, var(--line));
|
|
5
|
+
border-radius: var(--field-radius);
|
|
6
|
+
background: var(--field);
|
|
7
|
+
color: var(--fg);
|
|
8
|
+
font-size: var(--field-font-size);
|
|
9
|
+
line-height: var(--field-line-height);
|
|
10
|
+
outline: none;
|
|
11
|
+
transition:
|
|
12
|
+
border-color var(--motion-hover),
|
|
13
|
+
box-shadow var(--motion-hover),
|
|
14
|
+
background-color var(--motion-hover);
|
|
15
|
+
}
|
|
16
|
+
.surface:hover:where(
|
|
17
|
+
:not(
|
|
18
|
+
:disabled,
|
|
19
|
+
[data-disabled="true"],
|
|
20
|
+
[aria-disabled="true"],
|
|
21
|
+
[readonly],
|
|
22
|
+
[aria-readonly="true"],
|
|
23
|
+
[data-readonly="true"],
|
|
24
|
+
[data-disabled="true"] *,
|
|
25
|
+
[aria-disabled="true"] *,
|
|
26
|
+
[data-readonly="true"] *,
|
|
27
|
+
fieldset:disabled *,
|
|
28
|
+
:has(input:disabled, textarea:disabled)
|
|
29
|
+
)
|
|
30
|
+
) {
|
|
31
|
+
border-color: var(
|
|
32
|
+
--field-hover-border,
|
|
33
|
+
color-mix(in srgb, var(--fg) var(--field-hover-strength), var(--surface))
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
.surface[data-focus="true"],
|
|
37
|
+
.surface:focus,
|
|
38
|
+
.surface:focus-visible,
|
|
39
|
+
.surface:focus-within,
|
|
40
|
+
.surface[aria-expanded="true"] {
|
|
41
|
+
outline: none;
|
|
42
|
+
border-color: var(--field-focus-border);
|
|
43
|
+
box-shadow: 0 0 0 var(--field-focus-width)
|
|
44
|
+
color-mix(in srgb, var(--accent-ink, var(--accent)) var(--field-focus-strength), transparent);
|
|
45
|
+
}
|
|
46
|
+
.surface[aria-invalid="true"] {
|
|
47
|
+
border-color: var(--danger);
|
|
48
|
+
}
|
|
49
|
+
.surface[aria-invalid="true"][data-focus="true"],
|
|
50
|
+
.surface[aria-invalid="true"]:focus-within {
|
|
51
|
+
box-shadow: 0 0 0 var(--field-focus-width)
|
|
52
|
+
color-mix(in srgb, var(--danger) var(--field-focus-strength), transparent);
|
|
53
|
+
}
|
|
54
|
+
.surface:disabled,
|
|
55
|
+
.surface[data-disabled="true"] {
|
|
56
|
+
opacity: var(--field-disabled-opacity);
|
|
57
|
+
cursor: not-allowed;
|
|
58
|
+
}
|
|
59
|
+
.surface[data-disabled="true"] input:disabled {
|
|
60
|
+
opacity: 1;
|
|
61
|
+
}
|
|
62
|
+
.surface input {
|
|
63
|
+
outline: none;
|
|
64
|
+
color: inherit;
|
|
65
|
+
font-family: inherit;
|
|
66
|
+
line-height: inherit;
|
|
67
|
+
}
|
|
68
|
+
.surface input:focus-visible {
|
|
69
|
+
outline: none;
|
|
70
|
+
}
|
|
71
|
+
.surface::placeholder,
|
|
72
|
+
.surface input::placeholder {
|
|
73
|
+
color: var(--placeholder);
|
|
74
|
+
opacity: 1;
|
|
75
|
+
}
|
|
76
|
+
.surface[readonly],
|
|
77
|
+
.surface[aria-readonly="true"],
|
|
78
|
+
.surface:has(input[readonly]) {
|
|
79
|
+
background: var(--field-readonly);
|
|
80
|
+
}
|
|
81
|
+
@media (max-width: 600px) {
|
|
82
|
+
.surface:has(input),
|
|
83
|
+
.surface:is(input, textarea) {
|
|
84
|
+
font-size: 16px;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TableAppearance } from "./Table";
|
|
1
2
|
import { type ReactNode, type CSSProperties } from "react";
|
|
2
3
|
export interface TableColumn<T> {
|
|
3
4
|
key: string;
|
|
@@ -19,7 +20,7 @@ export type TablePagination = {
|
|
|
19
20
|
page: number;
|
|
20
21
|
pageSize: number;
|
|
21
22
|
};
|
|
22
|
-
export type DataTableProps<T, K extends string | number> = {
|
|
23
|
+
export type DataTableProps<T, K extends string | number> = TableAppearance & {
|
|
23
24
|
rows: T[];
|
|
24
25
|
columns: TableColumn<T>[];
|
|
25
26
|
rowKey(row: T): K;
|
|
@@ -48,4 +49,4 @@ export type DataTableProps<T, K extends string | number> = {
|
|
|
48
49
|
manualPagination?: boolean;
|
|
49
50
|
total?: number;
|
|
50
51
|
};
|
|
51
|
-
export declare function DataTable<T, K extends string | number>({ rows, columns, rowKey, label, selected, onSelectionChange, selectionLabel, initialPageSize, loading, sort: controlledSort, defaultSort, onSortChange, filters: controlledFilters, defaultFilters, onFiltersChange, pagination, defaultPagination, onPaginationChange, pageSizes, visibleColumns, defaultVisibleColumns, onVisibleColumnsChange, showColumnSelector, manualFiltering, manualSorting, manualPagination, total, }: DataTableProps<T, K>): import("react").JSX.Element;
|
|
52
|
+
export declare function DataTable<T, K extends string | number>({ rows, columns, rowKey, label, selected, onSelectionChange, selectionLabel, initialPageSize, loading, sort: controlledSort, defaultSort, onSortChange, filters: controlledFilters, defaultFilters, onFiltersChange, pagination, defaultPagination, onPaginationChange, pageSizes, visibleColumns, defaultVisibleColumns, onVisibleColumnsChange, showColumnSelector, manualFiltering, manualSorting, manualPagination, total, striped, density, hoverable, bordered, stickyHeader, }: DataTableProps<T, K>): import("react").JSX.Element;
|
package/components/DataTable.js
CHANGED
|
@@ -37,7 +37,12 @@ function DataTable({
|
|
|
37
37
|
manualFiltering = false,
|
|
38
38
|
manualSorting = false,
|
|
39
39
|
manualPagination = false,
|
|
40
|
-
total
|
|
40
|
+
total,
|
|
41
|
+
striped = false,
|
|
42
|
+
density = "comfortable",
|
|
43
|
+
hoverable = true,
|
|
44
|
+
bordered = false,
|
|
45
|
+
stickyHeader = false
|
|
41
46
|
}) {
|
|
42
47
|
const [localSort, setLocalSort] = useState(defaultSort), [localFilters, setLocalFilters] = useState(defaultFilters), [localPage, setLocalPage] = useState({
|
|
43
48
|
page: positive(defaultPagination?.page, 1),
|
|
@@ -128,77 +133,98 @@ function DataTable({
|
|
|
128
133
|
)
|
|
129
134
|
] }),
|
|
130
135
|
/* @__PURE__ */ jsx(LoadingOverlay, { active: loading, children: /* @__PURE__ */ jsxs("div", { className: s.scroll, children: [
|
|
131
|
-
/* @__PURE__ */ jsxs(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
) }),
|
|
145
|
-
displayColumns.map((column) => /* @__PURE__ */ jsx(
|
|
146
|
-
"th",
|
|
147
|
-
{
|
|
148
|
-
style: { width: column.width, textAlign: column.align },
|
|
149
|
-
scope: "col",
|
|
150
|
-
"aria-sort": sort?.key === column.key ? sort.direction === "asc" ? "ascending" : "descending" : "none",
|
|
151
|
-
children: /* @__PURE__ */ jsxs("div", { className: s.heading, style: { justifyContent: column.align === "right" ? "flex-end" : column.align === "center" ? "center" : void 0 }, children: [
|
|
152
|
-
column.sortable ? /* @__PURE__ */ jsxs(
|
|
153
|
-
"button",
|
|
154
|
-
{
|
|
155
|
-
type: "button",
|
|
156
|
-
className: s.sort,
|
|
157
|
-
"aria-label": `\u6392\u5E8F${column.label}`,
|
|
158
|
-
onClick: () => changeSort(
|
|
159
|
-
sort?.key !== column.key ? { key: column.key, direction: "asc" } : sort.direction === "asc" ? { key: column.key, direction: "desc" } : null
|
|
160
|
-
),
|
|
161
|
-
children: [
|
|
162
|
-
column.label,
|
|
163
|
-
sort?.key === column.key ? sort.direction === "asc" ? /* @__PURE__ */ jsx(ArrowUp, {}) : /* @__PURE__ */ jsx(ArrowDown, {}) : /* @__PURE__ */ jsx(ArrowUpDown, {})
|
|
164
|
-
]
|
|
165
|
-
}
|
|
166
|
-
) : column.label,
|
|
167
|
-
column.filterOptions && /* @__PURE__ */ jsx(
|
|
168
|
-
TableColumnFilter,
|
|
169
|
-
{
|
|
170
|
-
label: column.label,
|
|
171
|
-
options: column.filterOptions,
|
|
172
|
-
value: filters[column.key] || [],
|
|
173
|
-
onChange: (values) => changeFilters({ ...filters, [column.key]: values })
|
|
174
|
-
}
|
|
175
|
-
)
|
|
176
|
-
] })
|
|
177
|
-
},
|
|
178
|
-
column.key
|
|
179
|
-
))
|
|
180
|
-
] }) }),
|
|
181
|
-
/* @__PURE__ */ jsx("tbody", { children: visible.map((row) => /* @__PURE__ */ jsxs(
|
|
182
|
-
"tr",
|
|
183
|
-
{
|
|
184
|
-
"data-selected": selection.includes(rowKey(row)),
|
|
185
|
-
children: [
|
|
186
|
-
onSelectionChange && /* @__PURE__ */ jsx("td", { className: s.selection, children: /* @__PURE__ */ jsx(
|
|
136
|
+
/* @__PURE__ */ jsxs(
|
|
137
|
+
"table",
|
|
138
|
+
{
|
|
139
|
+
className: s.table,
|
|
140
|
+
"aria-label": label,
|
|
141
|
+
"data-striped": striped,
|
|
142
|
+
"data-density": density,
|
|
143
|
+
"data-hoverable": hoverable,
|
|
144
|
+
"data-bordered": bordered,
|
|
145
|
+
"data-sticky-header": stickyHeader,
|
|
146
|
+
children: [
|
|
147
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
148
|
+
onSelectionChange && /* @__PURE__ */ jsx("th", { className: s.selection, children: /* @__PURE__ */ jsx(
|
|
187
149
|
Checkbox,
|
|
188
150
|
{
|
|
189
|
-
label:
|
|
190
|
-
checked:
|
|
151
|
+
label: "\u9009\u62E9\u5F53\u524D\u9875",
|
|
152
|
+
checked: ids.length > 0 && selectedCount === ids.length,
|
|
153
|
+
indeterminate: selectedCount > 0 && selectedCount < ids.length,
|
|
154
|
+
disabled: !ids.length,
|
|
191
155
|
onChange: (checked) => onSelectionChange(
|
|
192
|
-
checked ? [.../* @__PURE__ */ new Set([...selection,
|
|
156
|
+
checked ? [.../* @__PURE__ */ new Set([...selection, ...ids])] : selection.filter((key) => !ids.includes(key))
|
|
193
157
|
)
|
|
194
158
|
}
|
|
195
159
|
) }),
|
|
196
|
-
displayColumns.map((column) => /* @__PURE__ */ jsx(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
160
|
+
displayColumns.map((column) => /* @__PURE__ */ jsx(
|
|
161
|
+
"th",
|
|
162
|
+
{
|
|
163
|
+
style: { width: column.width, textAlign: column.align },
|
|
164
|
+
scope: "col",
|
|
165
|
+
"aria-sort": sort?.key === column.key ? sort.direction === "asc" ? "ascending" : "descending" : "none",
|
|
166
|
+
children: /* @__PURE__ */ jsxs(
|
|
167
|
+
"div",
|
|
168
|
+
{
|
|
169
|
+
className: s.heading,
|
|
170
|
+
style: {
|
|
171
|
+
justifyContent: column.align === "right" ? "flex-end" : column.align === "center" ? "center" : void 0
|
|
172
|
+
},
|
|
173
|
+
children: [
|
|
174
|
+
column.sortable ? /* @__PURE__ */ jsxs(
|
|
175
|
+
"button",
|
|
176
|
+
{
|
|
177
|
+
type: "button",
|
|
178
|
+
className: s.sort,
|
|
179
|
+
"aria-label": `\u6392\u5E8F${column.label}`,
|
|
180
|
+
onClick: () => changeSort(
|
|
181
|
+
sort?.key !== column.key ? { key: column.key, direction: "asc" } : sort.direction === "asc" ? { key: column.key, direction: "desc" } : null
|
|
182
|
+
),
|
|
183
|
+
children: [
|
|
184
|
+
column.label,
|
|
185
|
+
sort?.key === column.key ? sort.direction === "asc" ? /* @__PURE__ */ jsx(ArrowUp, {}) : /* @__PURE__ */ jsx(ArrowDown, {}) : /* @__PURE__ */ jsx(ArrowUpDown, {})
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
) : column.label,
|
|
189
|
+
column.filterOptions && /* @__PURE__ */ jsx(
|
|
190
|
+
TableColumnFilter,
|
|
191
|
+
{
|
|
192
|
+
label: column.label,
|
|
193
|
+
options: column.filterOptions,
|
|
194
|
+
value: filters[column.key] || [],
|
|
195
|
+
onChange: (values) => changeFilters({ ...filters, [column.key]: values })
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
},
|
|
202
|
+
column.key
|
|
203
|
+
))
|
|
204
|
+
] }) }),
|
|
205
|
+
/* @__PURE__ */ jsx("tbody", { children: visible.map((row) => /* @__PURE__ */ jsxs(
|
|
206
|
+
"tr",
|
|
207
|
+
{
|
|
208
|
+
"data-selected": selection.includes(rowKey(row)),
|
|
209
|
+
children: [
|
|
210
|
+
onSelectionChange && /* @__PURE__ */ jsx("td", { className: s.selection, children: /* @__PURE__ */ jsx(
|
|
211
|
+
Checkbox,
|
|
212
|
+
{
|
|
213
|
+
label: selectionLabel?.(row) || `\u9009\u62E9${rowKey(row)}`,
|
|
214
|
+
checked: selection.includes(rowKey(row)),
|
|
215
|
+
onChange: (checked) => onSelectionChange(
|
|
216
|
+
checked ? [.../* @__PURE__ */ new Set([...selection, rowKey(row)])] : selection.filter((key) => key !== rowKey(row))
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
) }),
|
|
220
|
+
displayColumns.map((column) => /* @__PURE__ */ jsx("td", { style: { textAlign: column.align }, children: column.render ? column.render(row) : column.value(row) }, column.key))
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
rowKey(row)
|
|
224
|
+
)) })
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
),
|
|
202
228
|
!filtered.length && /* @__PURE__ */ jsx(Placeholder, { variant: rows.length ? "search" : "empty" })
|
|
203
229
|
] }) }),
|
|
204
230
|
/* @__PURE__ */ jsx(
|
|
@@ -14,37 +14,10 @@
|
|
|
14
14
|
flex-direction: column;
|
|
15
15
|
}
|
|
16
16
|
.scroll {
|
|
17
|
-
|
|
18
|
-
border: 1px solid var(--line);
|
|
19
|
-
border-radius: var(--radius);
|
|
17
|
+
composes: scroll from "./Table.module.css";
|
|
20
18
|
}
|
|
21
19
|
.table {
|
|
22
|
-
|
|
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);
|
|
20
|
+
composes: table from "./Table.module.css";
|
|
48
21
|
}
|
|
49
22
|
.heading {
|
|
50
23
|
display: flex;
|
|
@@ -74,7 +47,7 @@
|
|
|
74
47
|
height: 14px;
|
|
75
48
|
}
|
|
76
49
|
.filter[data-active="true"] {
|
|
77
|
-
color: var(--accent);
|
|
50
|
+
color: var(--accent-ink, var(--accent));
|
|
78
51
|
background: var(--selected);
|
|
79
52
|
}
|
|
80
53
|
.filterPanel {
|
|
@@ -92,7 +65,6 @@
|
|
|
92
65
|
clip-path: inset(50%);
|
|
93
66
|
}
|
|
94
67
|
|
|
95
|
-
|
|
96
68
|
.filterReset {
|
|
97
69
|
display: flex;
|
|
98
70
|
justify-content: flex-end;
|