@robert-stackflow/oneui 0.6.7 → 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 +63 -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/Tab.module.css +148 -148
- 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 +4 -25
|
@@ -1,148 +1,148 @@
|
|
|
1
|
-
.viewport {
|
|
2
|
-
overflow-x: auto;
|
|
3
|
-
overflow-y: hidden;
|
|
4
|
-
scrollbar-width: none;
|
|
5
|
-
padding-bottom: 1px;
|
|
6
|
-
min-width: 0;
|
|
7
|
-
max-width: 100%;
|
|
8
|
-
}
|
|
9
|
-
.tabs {
|
|
10
|
-
position: relative;
|
|
11
|
-
display: flex;
|
|
12
|
-
align-items: stretch;
|
|
13
|
-
gap: 4px;
|
|
14
|
-
width: max-content;
|
|
15
|
-
min-width: 100%;
|
|
16
|
-
isolation: isolate;
|
|
17
|
-
}
|
|
18
|
-
.tabs button {
|
|
19
|
-
position: relative;
|
|
20
|
-
z-index: 1;
|
|
21
|
-
display: flex;
|
|
22
|
-
align-items: center;
|
|
23
|
-
justify-content: center;
|
|
24
|
-
gap: 7px;
|
|
25
|
-
white-space: nowrap;
|
|
26
|
-
border: 0;
|
|
27
|
-
background: transparent;
|
|
28
|
-
min-height: 34px;
|
|
29
|
-
padding: 7px 12px;
|
|
30
|
-
font-size: 12px;
|
|
31
|
-
color: var(--muted);
|
|
32
|
-
border-radius: 6px;
|
|
33
|
-
transition:
|
|
34
|
-
color var(--motion-hover),
|
|
35
|
-
background var(--motion-hover);
|
|
36
|
-
}
|
|
37
|
-
.tabs button:hover:not(:disabled) {
|
|
38
|
-
color: var(--fg);
|
|
39
|
-
}
|
|
40
|
-
.tabs button[aria-selected="true"] {
|
|
41
|
-
color: var(--fg);
|
|
42
|
-
}
|
|
43
|
-
.tabs button:focus-visible {
|
|
44
|
-
outline-offset: -2px;
|
|
45
|
-
}
|
|
46
|
-
.indicator {
|
|
47
|
-
position: absolute;
|
|
48
|
-
z-index: 0;
|
|
49
|
-
pointer-events: none;
|
|
50
|
-
opacity: var(--tab-opacity, 0);
|
|
51
|
-
left: 0;
|
|
52
|
-
top: 0;
|
|
53
|
-
transform: translate(var(--tab-x, 0px), var(--tab-y, 0px));
|
|
54
|
-
width: var(--tab-width, 0px);
|
|
55
|
-
height: var(--tab-height, 0px);
|
|
56
|
-
background: var(--selected);
|
|
57
|
-
border-radius: 6px;
|
|
58
|
-
}
|
|
59
|
-
.tabs[data-ready="true"] .indicator {
|
|
60
|
-
transition:
|
|
61
|
-
transform var(--motion-segment) var(--ease),
|
|
62
|
-
width var(--motion-segment) var(--ease),
|
|
63
|
-
height var(--motion-segment) var(--ease),
|
|
64
|
-
opacity var(--motion-hover);
|
|
65
|
-
}
|
|
66
|
-
.viewport[data-orientation="vertical"] {
|
|
67
|
-
width: 112px;
|
|
68
|
-
flex: 0 0 112px;
|
|
69
|
-
}
|
|
70
|
-
.viewport[data-orientation="vertical"] .tabs {
|
|
71
|
-
flex-direction: column;
|
|
72
|
-
width: 100%;
|
|
73
|
-
min-width: 0;
|
|
74
|
-
}
|
|
75
|
-
.viewport[data-orientation="vertical"] button {
|
|
76
|
-
justify-content: flex-start;
|
|
77
|
-
padding: 7px 9px;
|
|
78
|
-
min-height: 34px;
|
|
79
|
-
}
|
|
80
|
-
.underlined {
|
|
81
|
-
gap: 16px;
|
|
82
|
-
border-bottom: var(--separator-width) var(--separator-style)
|
|
83
|
-
var(--separator-color);
|
|
84
|
-
}
|
|
85
|
-
.underlined button {
|
|
86
|
-
padding: 9px 2px;
|
|
87
|
-
border-radius: 0;
|
|
88
|
-
}
|
|
89
|
-
.underlined .indicator {
|
|
90
|
-
top: auto;
|
|
91
|
-
bottom: -1px;
|
|
92
|
-
height: 2px;
|
|
93
|
-
transform: translateX(var(--tab-x, 0px));
|
|
94
|
-
background: var(--
|
|
95
|
-
border-radius: 2px;
|
|
96
|
-
}
|
|
97
|
-
.underlined button[aria-selected="true"] {
|
|
98
|
-
color: var(--
|
|
99
|
-
}
|
|
100
|
-
@media (max-width: 450px) {
|
|
101
|
-
.viewport[data-orientation="vertical"] {
|
|
102
|
-
width: 94px;
|
|
103
|
-
flex-basis: 94px;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.blocked button:hover:not(:disabled) {
|
|
108
|
-
background: color-mix(in srgb, var(--hover) 55%, transparent);
|
|
109
|
-
}
|
|
110
|
-
.underlined button:hover:not(:disabled) {
|
|
111
|
-
background: transparent;
|
|
112
|
-
color: var(--
|
|
113
|
-
}
|
|
114
|
-
.tabs button {
|
|
115
|
-
min-height: var(--tab-height-min);
|
|
116
|
-
font-size: var(--field-font-size);
|
|
117
|
-
cursor: pointer;
|
|
118
|
-
}
|
|
119
|
-
.blocked {
|
|
120
|
-
width: var(--blocked-width);
|
|
121
|
-
min-width: var(--blocked-min-width);
|
|
122
|
-
padding: var(--blocked-padding);
|
|
123
|
-
border: var(--blocked-border);
|
|
124
|
-
background: var(--blocked-background);
|
|
125
|
-
border-radius: var(--blocked-radius);
|
|
126
|
-
}
|
|
127
|
-
.blocked .indicator {
|
|
128
|
-
background: var(--blocked-selected);
|
|
129
|
-
box-shadow: var(--blocked-shadow);
|
|
130
|
-
}
|
|
131
|
-
.blocked button {
|
|
132
|
-
min-height: var(--blocked-height);
|
|
133
|
-
padding: var(--blocked-button-padding);
|
|
134
|
-
}
|
|
135
|
-
.blocked button[aria-selected="true"] {
|
|
136
|
-
color: var(--tab-selected-color);
|
|
137
|
-
}
|
|
138
|
-
.tabs button:disabled {
|
|
139
|
-
opacity: 0.45;
|
|
140
|
-
cursor: not-allowed;
|
|
141
|
-
}
|
|
142
|
-
.viewport[data-orientation="vertical"] {
|
|
143
|
-
width: var(--vertical-tab-width);
|
|
144
|
-
flex-basis: var(--vertical-tab-width);
|
|
145
|
-
}
|
|
146
|
-
.viewport[data-orientation="vertical"] .blocked {
|
|
147
|
-
width: 100%;
|
|
148
|
-
}
|
|
1
|
+
.viewport {
|
|
2
|
+
overflow-x: auto;
|
|
3
|
+
overflow-y: hidden;
|
|
4
|
+
scrollbar-width: none;
|
|
5
|
+
padding-bottom: 1px;
|
|
6
|
+
min-width: 0;
|
|
7
|
+
max-width: 100%;
|
|
8
|
+
}
|
|
9
|
+
.tabs {
|
|
10
|
+
position: relative;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: stretch;
|
|
13
|
+
gap: 4px;
|
|
14
|
+
width: max-content;
|
|
15
|
+
min-width: 100%;
|
|
16
|
+
isolation: isolate;
|
|
17
|
+
}
|
|
18
|
+
.tabs button {
|
|
19
|
+
position: relative;
|
|
20
|
+
z-index: 1;
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
gap: 7px;
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
border: 0;
|
|
27
|
+
background: transparent;
|
|
28
|
+
min-height: 34px;
|
|
29
|
+
padding: 7px 12px;
|
|
30
|
+
font-size: 12px;
|
|
31
|
+
color: var(--muted);
|
|
32
|
+
border-radius: 6px;
|
|
33
|
+
transition:
|
|
34
|
+
color var(--motion-hover),
|
|
35
|
+
background var(--motion-hover);
|
|
36
|
+
}
|
|
37
|
+
.tabs button:hover:not(:disabled) {
|
|
38
|
+
color: var(--fg);
|
|
39
|
+
}
|
|
40
|
+
.tabs button[aria-selected="true"] {
|
|
41
|
+
color: var(--fg);
|
|
42
|
+
}
|
|
43
|
+
.tabs button:focus-visible {
|
|
44
|
+
outline-offset: -2px;
|
|
45
|
+
}
|
|
46
|
+
.indicator {
|
|
47
|
+
position: absolute;
|
|
48
|
+
z-index: 0;
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
opacity: var(--tab-opacity, 0);
|
|
51
|
+
left: 0;
|
|
52
|
+
top: 0;
|
|
53
|
+
transform: translate(var(--tab-x, 0px), var(--tab-y, 0px));
|
|
54
|
+
width: var(--tab-width, 0px);
|
|
55
|
+
height: var(--tab-height, 0px);
|
|
56
|
+
background: var(--selected);
|
|
57
|
+
border-radius: 6px;
|
|
58
|
+
}
|
|
59
|
+
.tabs[data-ready="true"] .indicator {
|
|
60
|
+
transition:
|
|
61
|
+
transform var(--motion-segment) var(--ease),
|
|
62
|
+
width var(--motion-segment) var(--ease),
|
|
63
|
+
height var(--motion-segment) var(--ease),
|
|
64
|
+
opacity var(--motion-hover);
|
|
65
|
+
}
|
|
66
|
+
.viewport[data-orientation="vertical"] {
|
|
67
|
+
width: 112px;
|
|
68
|
+
flex: 0 0 112px;
|
|
69
|
+
}
|
|
70
|
+
.viewport[data-orientation="vertical"] .tabs {
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
width: 100%;
|
|
73
|
+
min-width: 0;
|
|
74
|
+
}
|
|
75
|
+
.viewport[data-orientation="vertical"] button {
|
|
76
|
+
justify-content: flex-start;
|
|
77
|
+
padding: 7px 9px;
|
|
78
|
+
min-height: 34px;
|
|
79
|
+
}
|
|
80
|
+
.underlined {
|
|
81
|
+
gap: 16px;
|
|
82
|
+
border-bottom: var(--separator-width) var(--separator-style)
|
|
83
|
+
var(--separator-color);
|
|
84
|
+
}
|
|
85
|
+
.underlined button {
|
|
86
|
+
padding: 9px 2px;
|
|
87
|
+
border-radius: 0;
|
|
88
|
+
}
|
|
89
|
+
.underlined .indicator {
|
|
90
|
+
top: auto;
|
|
91
|
+
bottom: -1px;
|
|
92
|
+
height: 2px;
|
|
93
|
+
transform: translateX(var(--tab-x, 0px));
|
|
94
|
+
background: var(--tab-selected-color);
|
|
95
|
+
border-radius: 2px;
|
|
96
|
+
}
|
|
97
|
+
.underlined button[aria-selected="true"] {
|
|
98
|
+
color: var(--tab-selected-color);
|
|
99
|
+
}
|
|
100
|
+
@media (max-width: 450px) {
|
|
101
|
+
.viewport[data-orientation="vertical"] {
|
|
102
|
+
width: 94px;
|
|
103
|
+
flex-basis: 94px;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.blocked button:hover:not(:disabled) {
|
|
108
|
+
background: color-mix(in srgb, var(--hover) 55%, transparent);
|
|
109
|
+
}
|
|
110
|
+
.underlined button:hover:not(:disabled) {
|
|
111
|
+
background: transparent;
|
|
112
|
+
color: var(--tab-selected-color);
|
|
113
|
+
}
|
|
114
|
+
.tabs button {
|
|
115
|
+
min-height: var(--tab-height-min);
|
|
116
|
+
font-size: var(--field-font-size);
|
|
117
|
+
cursor: pointer;
|
|
118
|
+
}
|
|
119
|
+
.blocked {
|
|
120
|
+
width: var(--blocked-width);
|
|
121
|
+
min-width: var(--blocked-min-width);
|
|
122
|
+
padding: var(--blocked-padding);
|
|
123
|
+
border: var(--blocked-border);
|
|
124
|
+
background: var(--blocked-background);
|
|
125
|
+
border-radius: var(--blocked-radius);
|
|
126
|
+
}
|
|
127
|
+
.blocked .indicator {
|
|
128
|
+
background: var(--blocked-selected);
|
|
129
|
+
box-shadow: var(--blocked-shadow);
|
|
130
|
+
}
|
|
131
|
+
.blocked button {
|
|
132
|
+
min-height: var(--blocked-height);
|
|
133
|
+
padding: var(--blocked-button-padding);
|
|
134
|
+
}
|
|
135
|
+
.blocked button[aria-selected="true"] {
|
|
136
|
+
color: var(--tab-selected-color);
|
|
137
|
+
}
|
|
138
|
+
.tabs button:disabled {
|
|
139
|
+
opacity: 0.45;
|
|
140
|
+
cursor: not-allowed;
|
|
141
|
+
}
|
|
142
|
+
.viewport[data-orientation="vertical"] {
|
|
143
|
+
width: var(--vertical-tab-width);
|
|
144
|
+
flex-basis: var(--vertical-tab-width);
|
|
145
|
+
}
|
|
146
|
+
.viewport[data-orientation="vertical"] .blocked {
|
|
147
|
+
width: 100%;
|
|
148
|
+
}
|
package/components/Table.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { ReactNode, HTMLAttributes, CSSProperties } from "react";
|
|
2
|
+
export type TableAppearance = {
|
|
3
|
+
striped?: boolean;
|
|
4
|
+
density?: "comfortable" | "compact";
|
|
5
|
+
hoverable?: boolean;
|
|
6
|
+
bordered?: boolean;
|
|
7
|
+
stickyHeader?: boolean;
|
|
8
|
+
};
|
|
2
9
|
export interface Column<T> {
|
|
3
10
|
key: string;
|
|
4
11
|
title: ReactNode;
|
|
@@ -6,7 +13,7 @@ export interface Column<T> {
|
|
|
6
13
|
align?: "left" | "center" | "right";
|
|
7
14
|
width?: CSSProperties["width"];
|
|
8
15
|
}
|
|
9
|
-
export declare function Table<T>({ columns, rows, rowKey, label, role, rowAttributes, }: {
|
|
16
|
+
export declare function Table<T>({ columns, rows, rowKey, label, role, rowAttributes, striped, density, hoverable, bordered, stickyHeader, }: TableAppearance & {
|
|
10
17
|
columns: Column<T>[];
|
|
11
18
|
rows: T[];
|
|
12
19
|
rowKey: (row: T) => string;
|
package/components/Table.js
CHANGED
|
@@ -6,24 +6,41 @@ function Table({
|
|
|
6
6
|
rowKey,
|
|
7
7
|
label,
|
|
8
8
|
role,
|
|
9
|
-
rowAttributes
|
|
9
|
+
rowAttributes,
|
|
10
|
+
striped = false,
|
|
11
|
+
density = "comfortable",
|
|
12
|
+
hoverable = true,
|
|
13
|
+
bordered = false,
|
|
14
|
+
stickyHeader = false
|
|
10
15
|
}) {
|
|
11
|
-
return /* @__PURE__ */ jsx("div", { className: s.scroll, role: "region", "aria-label": label, tabIndex: 0, children: /* @__PURE__ */ jsxs(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
return /* @__PURE__ */ jsx("div", { className: s.scroll, role: "region", "aria-label": label, tabIndex: 0, children: /* @__PURE__ */ jsxs(
|
|
17
|
+
"table",
|
|
18
|
+
{
|
|
19
|
+
className: s.table,
|
|
20
|
+
role,
|
|
21
|
+
"data-striped": striped,
|
|
22
|
+
"data-density": density,
|
|
23
|
+
"data-hoverable": hoverable,
|
|
24
|
+
"data-bordered": bordered,
|
|
25
|
+
"data-sticky-header": stickyHeader,
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsx("caption", { className: s.caption, children: label }),
|
|
28
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: columns.map((c) => /* @__PURE__ */ jsx(
|
|
29
|
+
"th",
|
|
30
|
+
{
|
|
31
|
+
scope: "col",
|
|
32
|
+
style: { textAlign: c.align, width: c.width },
|
|
33
|
+
children: c.title
|
|
34
|
+
},
|
|
35
|
+
c.key
|
|
36
|
+
)) }) }),
|
|
37
|
+
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
38
|
+
rows.map((r) => /* @__PURE__ */ jsx("tr", { ...rowAttributes?.(r), children: columns.map((c) => /* @__PURE__ */ jsx("td", { style: { textAlign: c.align }, children: c.render(r) }, c.key)) }, rowKey(r))),
|
|
39
|
+
rows.length === 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: columns.length, className: s.empty, children: "\u6682\u65E0\u7ED3\u679C" }) })
|
|
40
|
+
] })
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
) });
|
|
27
44
|
}
|
|
28
45
|
export {
|
|
29
46
|
Table
|
|
@@ -1,48 +1,87 @@
|
|
|
1
|
-
.scroll {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
.table
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
.scroll {
|
|
2
|
+
max-width: 100%;
|
|
3
|
+
min-width: 0;
|
|
4
|
+
overflow: auto;
|
|
5
|
+
border: 1px solid var(--line);
|
|
6
|
+
border-radius: var(--table-radius, var(--radius));
|
|
7
|
+
overscroll-behavior: contain;
|
|
8
|
+
}
|
|
9
|
+
.scroll:focus-visible {
|
|
10
|
+
outline: 2px solid var(--accent-ink, var(--accent));
|
|
11
|
+
outline-offset: 2px;
|
|
12
|
+
}
|
|
13
|
+
.table {
|
|
14
|
+
width: 100%;
|
|
15
|
+
border-collapse: separate;
|
|
16
|
+
border-spacing: 0;
|
|
17
|
+
text-align: left;
|
|
18
|
+
white-space: nowrap;
|
|
19
|
+
font-size: 13px;
|
|
20
|
+
line-height: 1.55;
|
|
21
|
+
background: var(--surface);
|
|
22
|
+
}
|
|
23
|
+
.table :is(th, td) {
|
|
24
|
+
height: 48px;
|
|
25
|
+
padding: 12px 16px;
|
|
26
|
+
border: 0;
|
|
27
|
+
border-bottom: 1px solid var(--line);
|
|
28
|
+
vertical-align: middle;
|
|
29
|
+
font-variant-numeric: tabular-nums;
|
|
30
|
+
}
|
|
31
|
+
.table th {
|
|
32
|
+
color: var(--muted);
|
|
33
|
+
background: var(--canvas);
|
|
34
|
+
font-size: 12px;
|
|
35
|
+
font-weight: 500;
|
|
36
|
+
}
|
|
37
|
+
.table tbody tr:last-child td {
|
|
38
|
+
border-bottom: 0;
|
|
39
|
+
}
|
|
40
|
+
.table tbody tr {
|
|
41
|
+
transition: background-color var(--motion-hover);
|
|
42
|
+
}
|
|
43
|
+
.table[data-striped="true"] tbody tr:nth-child(even) {
|
|
44
|
+
background: color-mix(in srgb, var(--fg) 3%, var(--surface));
|
|
45
|
+
}
|
|
46
|
+
.table:not([data-hoverable="false"]) tbody tr:hover,
|
|
47
|
+
.table tbody tr:focus-within {
|
|
48
|
+
background: var(--hover);
|
|
49
|
+
}
|
|
50
|
+
.table.table tbody tr:is([data-selected="true"], [aria-selected="true"]) {
|
|
51
|
+
background: var(--selected);
|
|
52
|
+
}
|
|
53
|
+
.table[data-density="compact"] :is(th, td) {
|
|
54
|
+
height: 36px;
|
|
55
|
+
padding: 7px 12px;
|
|
56
|
+
font-size: 12px;
|
|
57
|
+
}
|
|
58
|
+
.table[data-bordered="true"] tr > :is(th, td) + :is(th, td) {
|
|
59
|
+
border-left: 1px solid var(--line);
|
|
60
|
+
}
|
|
61
|
+
.table[data-sticky-header="true"] thead th {
|
|
62
|
+
position: sticky;
|
|
63
|
+
top: 0;
|
|
64
|
+
z-index: 1;
|
|
65
|
+
box-shadow: 0 1px 0 var(--line);
|
|
66
|
+
}
|
|
67
|
+
.empty {
|
|
68
|
+
text-align: center;
|
|
69
|
+
height: 150px;
|
|
70
|
+
color: var(--muted);
|
|
71
|
+
}
|
|
72
|
+
.caption {
|
|
73
|
+
position: absolute;
|
|
74
|
+
width: 1px;
|
|
75
|
+
height: 1px;
|
|
76
|
+
padding: 0;
|
|
77
|
+
margin: -1px;
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
clip: rect(0, 0, 0, 0);
|
|
80
|
+
white-space: nowrap;
|
|
81
|
+
border: 0;
|
|
82
|
+
}
|
|
83
|
+
@media (prefers-reduced-motion: reduce) {
|
|
84
|
+
.table tbody tr {
|
|
85
|
+
transition: none;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes, CSSProperties, ReactNode } from "react";
|
|
2
|
+
import type { TableAppearance } from "./Table";
|
|
2
3
|
/** Semantic table composition for cells with forms, selection and nested content. */
|
|
3
|
-
declare function Markup({ children, className, ...props }: HTMLAttributes<HTMLTableElement>): import("react").JSX.Element;
|
|
4
|
+
declare function Markup({ children, className, striped, density, hoverable, bordered, stickyHeader, ...props }: HTMLAttributes<HTMLTableElement> & TableAppearance): import("react").JSX.Element;
|
|
4
5
|
declare function ScrollContainer({ children, minWidth, }: {
|
|
5
6
|
children: ReactNode;
|
|
6
7
|
minWidth?: number;
|
|
@@ -3,9 +3,26 @@ import s from "./Table.module.css";
|
|
|
3
3
|
function Markup({
|
|
4
4
|
children,
|
|
5
5
|
className = "",
|
|
6
|
+
striped = false,
|
|
7
|
+
density = "comfortable",
|
|
8
|
+
hoverable = true,
|
|
9
|
+
bordered = false,
|
|
10
|
+
stickyHeader = false,
|
|
6
11
|
...props
|
|
7
12
|
}) {
|
|
8
|
-
return /* @__PURE__ */ jsx(
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
"table",
|
|
15
|
+
{
|
|
16
|
+
...props,
|
|
17
|
+
className: `${s.table} ${className}`,
|
|
18
|
+
"data-striped": striped,
|
|
19
|
+
"data-density": density,
|
|
20
|
+
"data-hoverable": hoverable,
|
|
21
|
+
"data-bordered": bordered,
|
|
22
|
+
"data-sticky-header": stickyHeader,
|
|
23
|
+
children
|
|
24
|
+
}
|
|
25
|
+
);
|
|
9
26
|
}
|
|
10
27
|
function ScrollContainer({
|
|
11
28
|
children,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
export type TableOfContentsItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
level?: number;
|
|
6
|
+
description?: string;
|
|
7
|
+
};
|
|
8
|
+
export type TableOfContentsProps = {
|
|
9
|
+
items?: readonly TableOfContentsItem[];
|
|
10
|
+
contentRef?: RefObject<HTMLElement | null>;
|
|
11
|
+
variant?: "tree" | "rail";
|
|
12
|
+
hoverMode?: "single" | "nearby" | "all";
|
|
13
|
+
previewCount?: number;
|
|
14
|
+
depthBasedLength?: boolean;
|
|
15
|
+
label?: string;
|
|
16
|
+
activeId?: string;
|
|
17
|
+
onActiveChange?(id: string): void;
|
|
18
|
+
maxLevel?: number;
|
|
19
|
+
scrollOffset?: number;
|
|
20
|
+
className?: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function TableOfContents({ items, contentRef, variant, hoverMode, previewCount, depthBasedLength, label, activeId, onActiveChange, maxLevel, scrollOffset, className, }: TableOfContentsProps): import("react").JSX.Element | null;
|