@robert-stackflow/oneui 0.4.2 → 0.5.1

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.
@@ -1,251 +1,269 @@
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
- }
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; }
@@ -3,6 +3,7 @@ export type DrawerPlacement = "left" | "right" | "top" | "bottom";
3
3
  export type DrawerProps = {
4
4
  open: boolean;
5
5
  onClose(): void;
6
+ onAfterClose?(): void;
6
7
  title: string;
7
8
  description?: ReactNode;
8
9
  children: ReactNode;
@@ -16,4 +17,4 @@ export type DrawerProps = {
16
17
  returnFocus?: RefObject<HTMLElement | null>;
17
18
  className?: string;
18
19
  };
19
- export declare function Drawer({ open: requestedOpen, onClose, title, description, children, footer, placement, size, closable, closeOnEscape, closeOnBackdrop, initialFocus, returnFocus, className, }: DrawerProps): import("react").ReactPortal;
20
+ export declare function Drawer({ open: requestedOpen, onClose, onAfterClose, title, description, children, footer, placement, size, closable, closeOnEscape, closeOnBackdrop, initialFocus, returnFocus, className, }: DrawerProps): import("react").ReactPortal;
@@ -28,6 +28,7 @@ const offsets = {
28
28
  function Drawer({
29
29
  open: requestedOpen,
30
30
  onClose,
31
+ onAfterClose,
31
32
  title,
32
33
  description,
33
34
  children,
@@ -46,6 +47,8 @@ function Drawer({
46
47
  const { rememberFocus, restoreFocus } = useModalFocus(ref, returnFocus);
47
48
  const opened = useRef(open), backdropDown = useRef(false), titleId = useId(), descriptionId = useId();
48
49
  const [closing, setClosing] = useState(false);
50
+ const afterClose = useRef(onAfterClose);
51
+ afterClose.current = onAfterClose;
49
52
  useModalScrollLock(open || closing);
50
53
  opened.current = open;
51
54
  useEffect(() => {
@@ -87,6 +90,7 @@ function Drawer({
87
90
  node.close();
88
91
  restoreFocus();
89
92
  setClosing(false);
93
+ afterClose.current?.();
90
94
  });
91
95
  }, [open, placement, initialFocus, rememberFocus, restoreFocus]);
92
96
  const outside = (event) => {
@@ -110,6 +110,14 @@
110
110
  .field[data-disabled="true"] .inlineLabel > .labelRow {
111
111
  opacity: 0.55;
112
112
  }
113
+ @media (min-width: 701px) {
114
+ .field[data-layout="inline"]:has(textarea) {
115
+ align-items: start;
116
+ }
117
+ .field[data-layout="inline"]:has(textarea) > .inlineLabel {
118
+ padding-top: max(0px, calc((var(--control-height) - 1lh) / 2));
119
+ }
120
+ }
113
121
  @media (max-width: 700px) {
114
122
  .field[data-layout="inline"] {
115
123
  display: flex;
@@ -1,5 +1,5 @@
1
- import type { ButtonHTMLAttributes } from "react";
2
- export declare function IconButton({ label, loading, children, variant, size, ...props }: ButtonHTMLAttributes<HTMLButtonElement> & {
1
+ import type { ComponentPropsWithRef } from "react";
2
+ export declare function IconButton({ label, loading, children, variant, size, ...props }: ComponentPropsWithRef<"button"> & {
3
3
  label: string;
4
4
  loading?: boolean;
5
5
  variant?: "primary" | "secondary" | "ghost" | "danger";
@@ -1,6 +1,6 @@
1
1
  import { type FieldOptions } from "./field";
2
2
  import type { SelectOption } from "./types";
3
- export declare function MultiSelect({ value, onChange, options, label, disabled, readOnly, required, name, id: controlId, error, hint, maxSelected, clearable, placeholder, display, ...aria }: FieldOptions & {
3
+ export declare function MultiSelect({ value, onChange, options, label, disabled, readOnly, required, name, id: controlId, error, hint, maxSelected, clearable, placeholder, display, onCreate, ...aria }: FieldOptions & {
4
4
  value: string[];
5
5
  onChange(value: string[]): void;
6
6
  options: SelectOption[];
@@ -10,4 +10,5 @@ export declare function MultiSelect({ value, onChange, options, label, disabled,
10
10
  clearable?: boolean;
11
11
  placeholder?: string;
12
12
  display?: "summary" | "tags";
13
+ onCreate?(label: string): string | void | Promise<string | void>;
13
14
  }): import("react").JSX.Element;