@robert-stackflow/oneui 0.5.1 → 0.6.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +0 -7
  2. package/README.md +45 -14
  3. package/components/AppShell.d.ts +6 -13
  4. package/components/AppShell.js +28 -17
  5. package/components/AppShell.module.css +251 -269
  6. package/components/AuthLayout.d.ts +8 -0
  7. package/components/AuthLayout.js +25 -0
  8. package/components/AuthLayout.module.css +36 -0
  9. package/components/Badge.d.ts +2 -2
  10. package/components/Badge.js +4 -2
  11. package/components/BarChart.d.ts +8 -0
  12. package/components/BarChart.js +37 -0
  13. package/components/BarChart.module.css +34 -0
  14. package/components/Button.d.ts +1 -1
  15. package/components/Button.module.css +3 -0
  16. package/components/ContributionCalendar.js +2 -2
  17. package/components/ContributionCalendar.module.css +3 -0
  18. package/components/CopyButton.d.ts +9 -0
  19. package/components/CopyButton.js +23 -0
  20. package/components/Layout.d.ts +81 -0
  21. package/components/Layout.js +271 -0
  22. package/components/Layout.module.css +66 -0
  23. package/components/Menu.d.ts +4 -1
  24. package/components/Menu.js +10 -4
  25. package/components/MultiSelect.d.ts +1 -2
  26. package/components/MultiSelect.js +13 -82
  27. package/components/MultiSelect.module.css +0 -6
  28. package/components/NumberInput.d.ts +1 -0
  29. package/components/NumberInput.js +4 -0
  30. package/components/NumberInput.module.css +11 -0
  31. package/components/Page.d.ts +7 -1
  32. package/components/Page.js +15 -8
  33. package/components/Page.module.css +1 -0
  34. package/components/Pagination.d.ts +2 -1
  35. package/components/Pagination.js +3 -2
  36. package/components/ResourceCard.d.ts +12 -0
  37. package/components/ResourceCard.js +24 -0
  38. package/components/ResourceCard.module.css +13 -0
  39. package/components/SidebarNavigation.d.ts +29 -0
  40. package/components/SidebarNavigation.js +139 -0
  41. package/components/SidebarNavigation.module.css +109 -0
  42. package/components/Table.module.css +2 -2
  43. package/components/TableMarkup.d.ts +23 -0
  44. package/components/TableMarkup.js +41 -0
  45. package/components/Tooltip.d.ts +2 -1
  46. package/components/Tooltip.js +3 -1
  47. package/components/index.d.ts +12 -2
  48. package/components/index.js +42 -1
  49. package/package.json +42 -2
@@ -1,269 +1,251 @@
1
- .shell {
2
- height: 100dvh;
3
- display: grid;
4
- grid-template-columns: 228px minmax(0, 1fr);
5
- overflow: hidden;
6
- color: var(--fg);
7
- background: var(--app-background, var(--canvas));
8
- font: 14px/1.6 var(--ui-font, "Segoe UI", "Microsoft YaHei", sans-serif);
9
- transition: grid-template-columns var(--motion-panel) var(--ease);
10
- }
11
- .shell[data-collapsed="true"] {
12
- grid-template-columns: 76px minmax(0, 1fr);
13
- }
14
- .sidebar {
15
- min-width: 0;
16
- display: flex;
17
- flex-direction: column;
18
- gap: 24px;
19
- padding: 24px 16px 18px;
20
- background: var(--navigation);
21
- border-right: 1px solid var(--line);
22
- overflow: hidden;
23
- }
24
- .brand {
25
- display: flex;
26
- align-items: center;
27
- gap: 10px;
28
- min-height: 38px;
29
- padding: 0 10px;
30
- color: var(--fg);
31
- text-decoration: none;
32
- flex-shrink: 0;
33
- }
34
- .brand strong {
35
- font-size: 16px;
36
- letter-spacing: -0.4px;
37
- }
38
- .mark {
39
- display: grid;
40
- place-items: center;
41
- width: 32px;
42
- height: 32px;
43
- flex-shrink: 0;
44
- border-radius: 10px;
45
- background: var(--accent);
46
- color: var(--on-accent);
47
- }
48
- .navigation {
49
- display: flex;
50
- flex-direction: column;
51
- gap: 4px;
52
- min-height: 0;
53
- overflow: auto;
54
- }
55
- .navigation a {
56
- display: flex;
57
- align-items: center;
58
- gap: 11px;
59
- min-height: 40px;
60
- padding: 9px 12px;
61
- border-radius: 8px;
62
- color: var(--muted);
63
- font-size: 13px;
64
- text-decoration: none;
65
- white-space: nowrap;
66
- transition:
67
- background var(--motion-hover),
68
- color var(--motion-hover);
69
- }
70
- .navigation a > svg {
71
- width: 18px;
72
- height: 18px;
73
- flex-shrink: 0;
74
- }
75
- .navigation a:hover {
76
- background: var(--hover);
77
- color: var(--fg);
78
- }
79
- .navigation a[aria-current="page"] {
80
- background: var(--selected);
81
- color: var(--navigation-selected-color, var(--accent));
82
- }
83
- .bottom {
84
- display: flex;
85
- flex-direction: column;
86
- gap: 8px;
87
- margin-top: auto;
88
- flex-shrink: 0;
89
- }
90
- .workspace {
91
- display: flex;
92
- flex-direction: column;
93
- min-width: 0;
94
- min-height: 0;
95
- }
96
- .header {
97
- height: 60px;
98
- min-height: 60px;
99
- display: flex;
100
- align-items: center;
101
- justify-content: space-between;
102
- gap: 16px;
103
- padding: 0 8px;
104
- border-bottom: 1px solid var(--line);
105
- background: var(--surface);
106
- color: var(--fg);
107
- }
108
- .header[data-draggable="true"] {
109
- -webkit-app-region: drag;
110
- }
111
- .header button,
112
- .header a,
113
- .headerEnd {
114
- -webkit-app-region: no-drag;
115
- }
116
- .headerStart,
117
- .headerEnd {
118
- display: flex;
119
- align-items: center;
120
- gap: 12px;
121
- min-width: 0;
122
- }
123
- .headerEnd {
124
- flex-shrink: 0;
125
- }
126
- .title {
127
- font-size: 13px;
128
- overflow: hidden;
129
- text-overflow: ellipsis;
130
- white-space: nowrap;
131
- }
132
- .main {
133
- flex: 1;
134
- min-height: 0;
135
- overflow: auto;
136
- outline: none;
137
- scrollbar-gutter: stable;
138
- overscroll-behavior: contain;
139
- }
140
- .page {
141
- width: 100%;
142
- max-width: 1390px;
143
- margin: 0 auto;
144
- padding: 42px 40px 52px;
145
- --page-max-width: none;
146
- --page-margin: 0;
147
- --page-inset: 0;
148
- --page-wide-top: 0;
149
- --page-title-size: 28px;
150
- --page-title-line-height: 1.3;
151
- }
152
- .page h1 {
153
- margin: 0;
154
- font-size: 28px;
155
- line-height: 1.3;
156
- }
157
- .shell[data-collapsed="true"] > .sidebar .brand strong,
158
- .shell[data-collapsed="true"] > .sidebar .navigation a span {
159
- display: none;
160
- }
161
- .shell[data-collapsed="true"] > .sidebar {
162
- padding-inline: 12px;
163
- }
164
- .shell[data-collapsed="true"] > .sidebar .brand {
165
- padding: 0;
166
- justify-content: center;
167
- }
168
- .shell[data-collapsed="true"] > .sidebar .navigation a {
169
- justify-content: center;
170
- padding-inline: 0;
171
- }
172
- .mobileToggle {
173
- display: none;
174
- }
175
- .floatingNavigation {
176
- position: fixed;
177
- z-index: 50;
178
- top: 12px;
179
- left: 12px;
180
- background: var(--surface);
181
- border: 1px solid var(--line);
182
- box-shadow: var(--shadow-sm);
183
- }
184
- .mobileNav {
185
- display: flex;
186
- flex-direction: column;
187
- gap: 24px;
188
- min-height: 100%;
189
- padding: 8px 0;
190
- }
191
- .mobileNav .bottom {
192
- margin-top: 24px;
193
- }
194
- .skip {
195
- position: fixed;
196
- top: -60px;
197
- left: 12px;
198
- z-index: 5000;
199
- padding: 10px 16px;
200
- background: var(--surface);
201
- color: var(--fg);
202
- }
203
- .skip:focus {
204
- top: 12px;
205
- }
206
- @media (max-width: 800px) {
207
- .shell,
208
- .shell[data-collapsed="true"] {
209
- grid-template-columns: minmax(0, 1fr);
210
- }
211
- .sidebar {
212
- display: none;
213
- }
214
- .desktopToggle {
215
- display: none;
216
- }
217
- .mobileToggle {
218
- display: inline-flex;
219
- }
220
- .header {
221
- padding-inline: 8px;
222
- gap: 8px;
223
- }
224
- .headerStart,
225
- .headerEnd {
226
- gap: 8px;
227
- }
228
- .page {
229
- padding: 28px 24px 40px;
230
- }
231
- .shell[data-header="false"] .page {
232
- padding-top: 64px;
233
- }
234
- }
235
- @media (max-width: 540px) {
236
- .page {
237
- padding: 24px 16px 36px;
238
- }
239
- .page h1 {
240
- font-size: 25px;
241
- }
242
- }
243
-
244
- .page {
245
- font-size: 13px;
246
- line-height: 1.6;
247
- }
248
-
249
- .header[data-window-controls="true"] {
250
- padding-right: 8px;
251
- }
252
-
253
- .navigationGroup {
254
- display: flex;
255
- flex-direction: column;
256
- gap: 4px;
257
- }
258
- .navigationGroup + .navigationGroup {
259
- margin-top: 18px;
260
- padding-top: 18px;
261
- border-top: 1px solid var(--line);
262
- }
263
- .groupLabel {
264
- color: var(--muted);
265
- font-size: 11px;
266
- padding: 0 12px 6px;
267
- }
268
-
269
- .shell[data-collapsed="true"] > .sidebar .groupLabel { display: none; }
1
+ .shell {
2
+ height: 100dvh;
3
+ display: grid;
4
+ grid-template-columns: 228px minmax(0, 1fr);
5
+ overflow: hidden;
6
+ color: var(--fg);
7
+ background: var(--app-background, var(--canvas));
8
+ font: 14px/1.6 var(--ui-font, "Segoe UI", "Microsoft YaHei", sans-serif);
9
+ transition: grid-template-columns var(--motion-panel) var(--ease);
10
+ }
11
+ .shell[data-collapsed="true"] {
12
+ grid-template-columns: 76px minmax(0, 1fr);
13
+ }
14
+ .sidebar {
15
+ min-width: 0;
16
+ display: flex;
17
+ flex-direction: column;
18
+ gap: 24px;
19
+ padding: 24px 16px 18px;
20
+ background: var(--navigation);
21
+ border-right: 1px solid var(--line);
22
+ overflow: hidden;
23
+ }
24
+ .brand {
25
+ display: flex;
26
+ align-items: center;
27
+ gap: 10px;
28
+ min-height: 38px;
29
+ padding: 0 10px;
30
+ color: var(--fg);
31
+ text-decoration: none;
32
+ flex-shrink: 0;
33
+ }
34
+ .brand strong {
35
+ font-size: 16px;
36
+ letter-spacing: -0.4px;
37
+ }
38
+ .mark {
39
+ display: grid;
40
+ place-items: center;
41
+ width: 32px;
42
+ height: 32px;
43
+ flex-shrink: 0;
44
+ border-radius: 10px;
45
+ background: var(--accent);
46
+ color: var(--on-accent);
47
+ }
48
+ .navigation {
49
+ display: flex;
50
+ flex-direction: column;
51
+ gap: 4px;
52
+ min-height: 0;
53
+ overflow: auto;
54
+ }
55
+ .navigation a {
56
+ display: flex;
57
+ align-items: center;
58
+ gap: 11px;
59
+ min-height: 40px;
60
+ padding: 9px 12px;
61
+ border-radius: 8px;
62
+ color: var(--muted);
63
+ font-size: 13px;
64
+ text-decoration: none;
65
+ white-space: nowrap;
66
+ transition:
67
+ background var(--motion-hover),
68
+ color var(--motion-hover);
69
+ }
70
+ .navigation a > svg {
71
+ width: 18px;
72
+ height: 18px;
73
+ flex-shrink: 0;
74
+ }
75
+ .navigation a:hover {
76
+ background: var(--hover);
77
+ color: var(--fg);
78
+ }
79
+ .navigation a[aria-current="page"] {
80
+ background: var(--selected);
81
+ color: var(--navigation-selected-color, var(--accent));
82
+ }
83
+ .bottom {
84
+ display: flex;
85
+ flex-direction: column;
86
+ gap: 8px;
87
+ margin-top: auto;
88
+ flex-shrink: 0;
89
+ }
90
+ .workspace {
91
+ display: flex;
92
+ flex-direction: column;
93
+ min-width: 0;
94
+ min-height: 0;
95
+ }
96
+ .header {
97
+ height: 60px;
98
+ min-height: 60px;
99
+ display: flex;
100
+ align-items: center;
101
+ justify-content: space-between;
102
+ gap: 16px;
103
+ padding: 0 8px;
104
+ border-bottom: 1px solid var(--line);
105
+ background: var(--surface);
106
+ color: var(--fg);
107
+ }
108
+ .header[data-draggable="true"] {
109
+ -webkit-app-region: drag;
110
+ }
111
+ .header button,
112
+ .header a,
113
+ .headerEnd {
114
+ -webkit-app-region: no-drag;
115
+ }
116
+ .headerStart,
117
+ .headerEnd {
118
+ display: flex;
119
+ align-items: center;
120
+ gap: 12px;
121
+ min-width: 0;
122
+ }
123
+ .headerEnd {
124
+ flex-shrink: 0;
125
+ }
126
+ .title {
127
+ font-size: 13px;
128
+ overflow: hidden;
129
+ text-overflow: ellipsis;
130
+ white-space: nowrap;
131
+ }
132
+ .main {
133
+ flex: 1;
134
+ min-height: 0;
135
+ overflow: auto;
136
+ outline: none;
137
+ scrollbar-gutter: stable;
138
+ overscroll-behavior: contain;
139
+ }
140
+ .page {
141
+ width: 100%;
142
+ max-width: 1390px;
143
+ margin: 0 auto;
144
+ padding: 42px 40px 52px;
145
+ --page-max-width: none;
146
+ --page-margin: 0;
147
+ --page-inset: 0;
148
+ --page-wide-top: 0;
149
+ --page-title-size: 28px;
150
+ --page-title-line-height: 1.3;
151
+ }
152
+ .page h1 {
153
+ margin: 0;
154
+ font-size: 28px;
155
+ line-height: 1.3;
156
+ }
157
+ .shell[data-collapsed="true"] > .sidebar .brand strong,
158
+ .shell[data-collapsed="true"] > .sidebar .navigation a span {
159
+ display: none;
160
+ }
161
+ .shell[data-collapsed="true"] > .sidebar {
162
+ padding-inline: 12px;
163
+ }
164
+ .shell[data-collapsed="true"] > .sidebar .brand {
165
+ padding: 0;
166
+ justify-content: center;
167
+ }
168
+ .shell[data-collapsed="true"] > .sidebar .navigation a {
169
+ justify-content: center;
170
+ padding-inline: 0;
171
+ }
172
+ .mobileToggle {
173
+ display: none;
174
+ }
175
+ .floatingNavigation {
176
+ position: fixed;
177
+ z-index: 50;
178
+ top: 12px;
179
+ left: 12px;
180
+ background: var(--surface);
181
+ border: 1px solid var(--line);
182
+ box-shadow: var(--shadow-sm);
183
+ }
184
+ .mobileNav {
185
+ display: flex;
186
+ flex-direction: column;
187
+ gap: 24px;
188
+ min-height: 100%;
189
+ padding: 8px 0;
190
+ }
191
+ .mobileNav .bottom {
192
+ margin-top: 24px;
193
+ }
194
+ .skip {
195
+ position: fixed;
196
+ top: -60px;
197
+ left: 12px;
198
+ z-index: 5000;
199
+ padding: 10px 16px;
200
+ background: var(--surface);
201
+ color: var(--fg);
202
+ }
203
+ .skip:focus {
204
+ top: 12px;
205
+ }
206
+ @media (max-width: 800px) {
207
+ .shell,
208
+ .shell[data-collapsed="true"] {
209
+ grid-template-columns: minmax(0, 1fr);
210
+ }
211
+ .sidebar {
212
+ display: none;
213
+ }
214
+ .desktopToggle {
215
+ display: none;
216
+ }
217
+ .mobileToggle {
218
+ display: inline-flex;
219
+ }
220
+ .header {
221
+ padding-inline: 8px;
222
+ gap: 8px;
223
+ }
224
+ .headerStart,
225
+ .headerEnd {
226
+ gap: 8px;
227
+ }
228
+ .page {
229
+ padding: 28px 24px 40px;
230
+ }
231
+ .shell[data-header="false"] .page {
232
+ padding-top: 64px;
233
+ }
234
+ }
235
+ @media (max-width: 540px) {
236
+ .page {
237
+ padding: 24px 16px 36px;
238
+ }
239
+ .page h1 {
240
+ font-size: 25px;
241
+ }
242
+ }
243
+
244
+ .page {
245
+ font-size: 13px;
246
+ line-height: 1.6;
247
+ }
248
+
249
+ .header[data-window-controls="true"] {
250
+ padding-right: 8px;
251
+ }
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from "react";
2
+ export declare function AuthLayout({ brandName, brandIcon, title, children, footer, }: {
3
+ brandName: string;
4
+ brandIcon?: ReactNode;
5
+ title: string;
6
+ children: ReactNode;
7
+ footer?: ReactNode;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Surface, Stack, Heading } from "./Layout.js";
3
+ import s from "./AuthLayout.module.css";
4
+ function AuthLayout({
5
+ brandName,
6
+ brandIcon,
7
+ title,
8
+ children,
9
+ footer
10
+ }) {
11
+ return /* @__PURE__ */ jsxs("main", { className: s.page, children: [
12
+ /* @__PURE__ */ jsxs("div", { className: s.brand, children: [
13
+ brandIcon,
14
+ /* @__PURE__ */ jsx(Heading, { order: 1, fz: 24, children: brandName })
15
+ ] }),
16
+ /* @__PURE__ */ jsx(Surface, { className: s.panel, p: "xl", children: /* @__PURE__ */ jsxs(Stack, { gap: "lg", children: [
17
+ /* @__PURE__ */ jsx(Heading, { order: 2, fz: 18, children: title }),
18
+ children
19
+ ] }) }),
20
+ footer && /* @__PURE__ */ jsx("div", { className: s.footer, children: footer })
21
+ ] });
22
+ }
23
+ export {
24
+ AuthLayout
25
+ };
@@ -0,0 +1,36 @@
1
+ .page {
2
+ min-height: 100dvh;
3
+ display: flex;
4
+ flex-direction: column;
5
+ align-items: center;
6
+ justify-content: center;
7
+ padding: 24px;
8
+ background: var(--canvas);
9
+ }
10
+ .brand {
11
+ display: flex;
12
+ align-items: center;
13
+ gap: 10px;
14
+ margin-bottom: 28px;
15
+ color: var(--fg);
16
+ }
17
+ .brand > img {
18
+ width: 34px;
19
+ height: 34px;
20
+ }
21
+ .panel {
22
+ width: 100%;
23
+ max-width: 400px;
24
+ }
25
+ .footer {
26
+ max-width: 400px;
27
+ margin-top: 20px;
28
+ color: var(--muted);
29
+ font-size: 12px;
30
+ text-align: center;
31
+ }
32
+ @media (max-width: 480px) {
33
+ .page {
34
+ padding: 18px;
35
+ }
36
+ }
@@ -1,5 +1,5 @@
1
- import type { ReactNode } from "react";
2
- export declare function Badge({ children, tone, }: {
1
+ import type { ReactNode, HTMLAttributes } from "react";
2
+ export declare function Badge({ children, tone, className, ...props }: HTMLAttributes<HTMLSpanElement> & {
3
3
  children: ReactNode;
4
4
  tone?: "neutral" | "success" | "warning" | "accent" | "danger";
5
5
  }): import("react").JSX.Element;
@@ -2,9 +2,11 @@ import { jsx } from "react/jsx-runtime";
2
2
  import s from "./Badge.module.css";
3
3
  function Badge({
4
4
  children,
5
- tone = "neutral"
5
+ tone = "neutral",
6
+ className = "",
7
+ ...props
6
8
  }) {
7
- return /* @__PURE__ */ jsx("span", { className: `${s.badge} ${s[tone]}`, children });
9
+ return /* @__PURE__ */ jsx("span", { ...props, className: `${s.badge} ${s[tone]} ${className}`, children });
8
10
  }
9
11
  export {
10
12
  Badge
@@ -0,0 +1,8 @@
1
+ export declare function BarChart({ data, label, }: {
2
+ data: {
3
+ label: string;
4
+ value: number;
5
+ description?: string;
6
+ }[];
7
+ label: string;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1,37 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Tooltip } from "./Tooltip.js";
3
+ import s from "./BarChart.module.css";
4
+ function BarChart({
5
+ data,
6
+ label
7
+ }) {
8
+ const max = Math.max(1, ...data.map((point) => point.value));
9
+ return /* @__PURE__ */ jsx("div", { className: s.chart, role: "img", "aria-label": label, children: data.map((point, index) => /* @__PURE__ */ jsx(
10
+ Tooltip,
11
+ {
12
+ content: point.description || `${point.label} \xB7 ${point.value}`,
13
+ children: /* @__PURE__ */ jsxs(
14
+ "div",
15
+ {
16
+ className: s.column,
17
+ tabIndex: 0,
18
+ "aria-label": `${point.label}: ${point.value}`,
19
+ children: [
20
+ /* @__PURE__ */ jsx(
21
+ "div",
22
+ {
23
+ className: s.bar,
24
+ style: { height: Math.max(0, point.value) / max * 132 }
25
+ }
26
+ ),
27
+ /* @__PURE__ */ jsx("span", { children: index % Math.max(1, Math.ceil(data.length / 7)) === 0 ? point.label : "" })
28
+ ]
29
+ }
30
+ )
31
+ },
32
+ index
33
+ )) });
34
+ }
35
+ export {
36
+ BarChart
37
+ };
@@ -0,0 +1,34 @@
1
+ .chart {
2
+ height: 166px;
3
+ display: flex;
4
+ align-items: flex-end;
5
+ gap: 5px;
6
+ border-bottom: 1px solid var(--line);
7
+ }
8
+ .chart > span {
9
+ flex: 1;
10
+ min-width: 0;
11
+ height: 100%;
12
+ }
13
+ .column {
14
+ min-width: 0;
15
+ display: flex;
16
+ flex-direction: column;
17
+ justify-content: flex-end;
18
+ align-items: center;
19
+ height: 100%;
20
+ gap: 9px;
21
+ }
22
+ .bar {
23
+ width: 75%;
24
+ background: var(--accent);
25
+ opacity: 0.8;
26
+ border-radius: 4px 4px 0 0;
27
+ }
28
+ .column > span {
29
+ font-size: 9px;
30
+ color: var(--muted);
31
+ white-space: nowrap;
32
+ height: 16px;
33
+ padding-bottom: 3px;
34
+ }