@snap-rail/ui 0.1.1 → 0.2.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/lib/charts.js +5 -4
- package/lib/contract.js +118 -61
- package/lib/fallback.js +11 -0
- package/lib/index.js +3948 -154
- package/lib/runtime.js +151 -28
- package/lib/settings.js +67 -23
- package/lib/types/charts.d.ts +1 -1
- package/lib/types/charts.js +5 -5
- package/lib/types/components/alert.d.ts +57 -0
- package/lib/types/components/alert.js +46 -0
- package/lib/types/components/controls.d.ts +74 -11
- package/lib/types/components/controls.js +60 -17
- package/lib/types/components/form-rhf.d.ts +56 -0
- package/lib/types/components/form-rhf.js +74 -0
- package/lib/types/components/form.d.ts +33 -5
- package/lib/types/components/form.js +22 -6
- package/lib/types/components/index.d.ts +7 -0
- package/lib/types/components/index.js +7 -0
- package/lib/types/components/input.d.ts +11 -5
- package/lib/types/components/input.js +34 -7
- package/lib/types/components/layout.d.ts +28 -6
- package/lib/types/components/layout.js +86 -13
- package/lib/types/components/overlay.d.ts +95 -0
- package/lib/types/components/overlay.js +138 -0
- package/lib/types/components/schema-form.d.ts +3 -1
- package/lib/types/components/schema-form.js +46 -40
- package/lib/types/components/slider.d.ts +18 -0
- package/lib/types/components/slider.js +15 -0
- package/lib/types/contract.d.ts +49 -29
- package/lib/types/contract.js +49 -29
- package/lib/types/runtime.js +3 -2
- package/lib/types/settings-pages/appearance.js +2 -2
- package/lib/types/settings-pages/plugins.js +2 -2
- package/package.json +13 -6
- package/src/styles/base.css +243 -5
- package/src/styles/default.css +184 -6
package/lib/charts.js
CHANGED
|
@@ -50,6 +50,7 @@ function ChartFrame({ title, description, actions, state = "ready", empty, error
|
|
|
50
50
|
...part("chart-frame", "title"),
|
|
51
51
|
children: title
|
|
52
52
|
}), description !== void 0 && jsx("div", {
|
|
53
|
+
...part("chart-frame", "description"),
|
|
53
54
|
className: "snap-chart-frame-description",
|
|
54
55
|
children: description
|
|
55
56
|
})] }), actions !== void 0 && jsx("div", {
|
|
@@ -61,20 +62,20 @@ function ChartFrame({ title, description, actions, state = "ready", empty, error
|
|
|
61
62
|
className: "snap-chart-frame-body",
|
|
62
63
|
"data-state": state,
|
|
63
64
|
children: state === "loading" ? loading ?? jsx("div", {
|
|
64
|
-
...part("
|
|
65
|
+
...part("chart-frame", "loading"),
|
|
65
66
|
children: "加载中…"
|
|
66
67
|
}) : state === "empty" ? empty ?? jsx("div", {
|
|
67
|
-
...part("
|
|
68
|
+
...part("chart-frame", "empty"),
|
|
68
69
|
children: "暂无数据"
|
|
69
70
|
}) : state === "error" ? error ?? jsx("div", {
|
|
70
|
-
...part("
|
|
71
|
+
...part("chart-frame", "error"),
|
|
71
72
|
role: "alert",
|
|
72
73
|
children: "图表加载失败"
|
|
73
74
|
}) : children
|
|
74
75
|
})]
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
|
-
/**
|
|
78
|
+
/** An alias of {@link ChartFrame} for pages that prefer the generic name. */
|
|
78
79
|
function Visualization(props) {
|
|
79
80
|
return jsx(ChartFrame, { ...props });
|
|
80
81
|
}
|
package/lib/contract.js
CHANGED
|
@@ -106,7 +106,8 @@ const UI_COMPONENTS = {
|
|
|
106
106
|
props: [
|
|
107
107
|
"size",
|
|
108
108
|
"invalid",
|
|
109
|
-
"disabled"
|
|
109
|
+
"disabled",
|
|
110
|
+
"fieldClassName"
|
|
110
111
|
]
|
|
111
112
|
},
|
|
112
113
|
textarea: {
|
|
@@ -114,7 +115,8 @@ const UI_COMPONENTS = {
|
|
|
114
115
|
props: [
|
|
115
116
|
"size",
|
|
116
117
|
"invalid",
|
|
117
|
-
"disabled"
|
|
118
|
+
"disabled",
|
|
119
|
+
"fieldClassName"
|
|
118
120
|
]
|
|
119
121
|
},
|
|
120
122
|
"number-input": {
|
|
@@ -141,12 +143,14 @@ const UI_COMPONENTS = {
|
|
|
141
143
|
"select.item-indicator",
|
|
142
144
|
"select.empty"
|
|
143
145
|
],
|
|
144
|
-
slots: ["empty"],
|
|
146
|
+
slots: ["empty", "children"],
|
|
145
147
|
props: [
|
|
146
148
|
"size",
|
|
147
149
|
"invalid",
|
|
148
150
|
"disabled",
|
|
149
|
-
"
|
|
151
|
+
"defaultValue",
|
|
152
|
+
"side",
|
|
153
|
+
"align"
|
|
150
154
|
]
|
|
151
155
|
},
|
|
152
156
|
"touch-select": {
|
|
@@ -161,34 +165,49 @@ const UI_COMPONENTS = {
|
|
|
161
165
|
checkbox: {
|
|
162
166
|
parts: [
|
|
163
167
|
"checkbox.root",
|
|
164
|
-
"checkbox.box",
|
|
165
168
|
"checkbox.indicator",
|
|
166
|
-
"checkbox.label"
|
|
169
|
+
"checkbox.label",
|
|
170
|
+
"checkbox.field",
|
|
171
|
+
"checkbox.description"
|
|
167
172
|
],
|
|
168
|
-
slots: ["label"],
|
|
173
|
+
slots: ["label", "description"],
|
|
169
174
|
props: [
|
|
170
175
|
"checked",
|
|
171
176
|
"invalid",
|
|
172
|
-
"disabled"
|
|
177
|
+
"disabled",
|
|
178
|
+
"labelPosition"
|
|
173
179
|
]
|
|
174
180
|
},
|
|
175
181
|
switch: {
|
|
176
182
|
parts: [
|
|
177
183
|
"switch.root",
|
|
178
184
|
"switch.thumb",
|
|
179
|
-
"switch.label"
|
|
185
|
+
"switch.label",
|
|
186
|
+
"switch.field",
|
|
187
|
+
"switch.description"
|
|
180
188
|
],
|
|
181
|
-
slots: ["label"],
|
|
182
|
-
props: [
|
|
189
|
+
slots: ["label", "description"],
|
|
190
|
+
props: [
|
|
191
|
+
"checked",
|
|
192
|
+
"disabled",
|
|
193
|
+
"labelPosition"
|
|
194
|
+
]
|
|
183
195
|
},
|
|
184
196
|
"radio-group": {
|
|
185
197
|
parts: [
|
|
186
198
|
"radio-group.root",
|
|
187
199
|
"radio-group.item",
|
|
188
200
|
"radio-group.indicator",
|
|
189
|
-
"radio-group.label"
|
|
201
|
+
"radio-group.label",
|
|
202
|
+
"radio-group.block",
|
|
203
|
+
"radio-group.description"
|
|
190
204
|
],
|
|
191
|
-
props: [
|
|
205
|
+
props: [
|
|
206
|
+
"value",
|
|
207
|
+
"disabled",
|
|
208
|
+
"label",
|
|
209
|
+
"description"
|
|
210
|
+
]
|
|
192
211
|
},
|
|
193
212
|
tabs: {
|
|
194
213
|
parts: [
|
|
@@ -198,7 +217,7 @@ const UI_COMPONENTS = {
|
|
|
198
217
|
"tabs.content"
|
|
199
218
|
],
|
|
200
219
|
slots: ["list", "content"],
|
|
201
|
-
props: ["value"
|
|
220
|
+
props: ["value"]
|
|
202
221
|
},
|
|
203
222
|
table: {
|
|
204
223
|
parts: [
|
|
@@ -246,7 +265,6 @@ const UI_COMPONENTS = {
|
|
|
246
265
|
},
|
|
247
266
|
dialog: {
|
|
248
267
|
parts: [
|
|
249
|
-
"dialog.root",
|
|
250
268
|
"dialog.overlay",
|
|
251
269
|
"dialog.panel",
|
|
252
270
|
"dialog.header",
|
|
@@ -271,12 +289,13 @@ const UI_COMPONENTS = {
|
|
|
271
289
|
},
|
|
272
290
|
sheet: {
|
|
273
291
|
parts: [
|
|
274
|
-
"
|
|
275
|
-
"
|
|
276
|
-
"
|
|
277
|
-
"
|
|
278
|
-
"
|
|
279
|
-
"
|
|
292
|
+
"dialog.overlay",
|
|
293
|
+
"dialog.panel",
|
|
294
|
+
"dialog.header",
|
|
295
|
+
"dialog.title",
|
|
296
|
+
"dialog.description",
|
|
297
|
+
"dialog.body",
|
|
298
|
+
"dialog.footer"
|
|
280
299
|
],
|
|
281
300
|
slots: [
|
|
282
301
|
"header",
|
|
@@ -286,27 +305,20 @@ const UI_COMPONENTS = {
|
|
|
286
305
|
props: ["open", "presentation"]
|
|
287
306
|
},
|
|
288
307
|
popover: {
|
|
289
|
-
parts: [
|
|
290
|
-
"popover.root",
|
|
291
|
-
"popover.trigger",
|
|
292
|
-
"popover.content"
|
|
293
|
-
],
|
|
308
|
+
parts: ["popover.trigger", "popover.content"],
|
|
294
309
|
slots: ["trigger", "content"]
|
|
295
310
|
},
|
|
296
311
|
tooltip: {
|
|
297
|
-
parts: [
|
|
298
|
-
"tooltip.root",
|
|
299
|
-
"tooltip.trigger",
|
|
300
|
-
"tooltip.content"
|
|
301
|
-
],
|
|
312
|
+
parts: ["tooltip.trigger", "tooltip.content"],
|
|
302
313
|
slots: ["trigger", "content"]
|
|
303
314
|
},
|
|
304
315
|
menu: {
|
|
305
316
|
parts: [
|
|
306
|
-
"menu.root",
|
|
307
317
|
"menu.trigger",
|
|
308
318
|
"menu.content",
|
|
309
319
|
"menu.item",
|
|
320
|
+
"menu.checkbox-item",
|
|
321
|
+
"menu.item-indicator",
|
|
310
322
|
"menu.separator"
|
|
311
323
|
],
|
|
312
324
|
slots: ["trigger", "content"]
|
|
@@ -317,7 +329,8 @@ const UI_COMPONENTS = {
|
|
|
317
329
|
"toast.title",
|
|
318
330
|
"toast.description",
|
|
319
331
|
"toast.action",
|
|
320
|
-
"toast.close"
|
|
332
|
+
"toast.close",
|
|
333
|
+
"toast.viewport"
|
|
321
334
|
],
|
|
322
335
|
slots: ["action"]
|
|
323
336
|
},
|
|
@@ -331,6 +344,52 @@ const UI_COMPONENTS = {
|
|
|
331
344
|
parts: ["led.root", "led.halo"],
|
|
332
345
|
props: ["tone"]
|
|
333
346
|
},
|
|
347
|
+
alert: {
|
|
348
|
+
parts: [
|
|
349
|
+
"alert.root",
|
|
350
|
+
"alert.title",
|
|
351
|
+
"alert.description"
|
|
352
|
+
],
|
|
353
|
+
slots: ["title", "description"],
|
|
354
|
+
props: ["intent"]
|
|
355
|
+
},
|
|
356
|
+
separator: {
|
|
357
|
+
parts: ["separator.root"],
|
|
358
|
+
props: ["orientation"]
|
|
359
|
+
},
|
|
360
|
+
skeleton: {
|
|
361
|
+
parts: ["skeleton.root"],
|
|
362
|
+
props: ["variant"]
|
|
363
|
+
},
|
|
364
|
+
list: {
|
|
365
|
+
parts: [
|
|
366
|
+
"list.root",
|
|
367
|
+
"list.item",
|
|
368
|
+
"list.leading",
|
|
369
|
+
"list.content",
|
|
370
|
+
"list.trailing"
|
|
371
|
+
],
|
|
372
|
+
slots: ["leading", "trailing"],
|
|
373
|
+
props: [
|
|
374
|
+
"divided",
|
|
375
|
+
"selected",
|
|
376
|
+
"disabled"
|
|
377
|
+
]
|
|
378
|
+
},
|
|
379
|
+
slider: {
|
|
380
|
+
parts: [
|
|
381
|
+
"slider.root",
|
|
382
|
+
"slider.track",
|
|
383
|
+
"slider.range",
|
|
384
|
+
"slider.thumb"
|
|
385
|
+
],
|
|
386
|
+
props: [
|
|
387
|
+
"value",
|
|
388
|
+
"min",
|
|
389
|
+
"max",
|
|
390
|
+
"step"
|
|
391
|
+
]
|
|
392
|
+
},
|
|
334
393
|
spinner: { parts: ["spinner.root"] },
|
|
335
394
|
"empty-state": {
|
|
336
395
|
parts: [
|
|
@@ -353,7 +412,13 @@ const UI_COMPONENTS = {
|
|
|
353
412
|
"form.fields",
|
|
354
413
|
"form.actions"
|
|
355
414
|
],
|
|
356
|
-
slots: ["fields", "actions"]
|
|
415
|
+
slots: ["fields", "actions"],
|
|
416
|
+
props: [
|
|
417
|
+
"orientation",
|
|
418
|
+
"gap",
|
|
419
|
+
"columns",
|
|
420
|
+
"form"
|
|
421
|
+
]
|
|
357
422
|
},
|
|
358
423
|
field: {
|
|
359
424
|
parts: [
|
|
@@ -372,12 +437,15 @@ const UI_COMPONENTS = {
|
|
|
372
437
|
props: [
|
|
373
438
|
"invalid",
|
|
374
439
|
"required",
|
|
375
|
-
"
|
|
440
|
+
"orientation",
|
|
441
|
+
"labelWidth",
|
|
442
|
+
"labelAlign"
|
|
376
443
|
]
|
|
377
444
|
},
|
|
378
445
|
"schema-form": {
|
|
379
446
|
parts: ["schema-form.root", "schema-form.field"],
|
|
380
|
-
slots: ["fields"]
|
|
447
|
+
slots: ["fields"],
|
|
448
|
+
props: ["columns"]
|
|
381
449
|
},
|
|
382
450
|
"app-shell": {
|
|
383
451
|
parts: [
|
|
@@ -430,6 +498,7 @@ const UI_COMPONENTS = {
|
|
|
430
498
|
parts: [
|
|
431
499
|
"toolbar.root",
|
|
432
500
|
"toolbar.start",
|
|
501
|
+
"toolbar.center",
|
|
433
502
|
"toolbar.end"
|
|
434
503
|
],
|
|
435
504
|
slots: ["start", "end"]
|
|
@@ -470,23 +539,26 @@ const UI_COMPONENTS = {
|
|
|
470
539
|
"scroll-area": { parts: [
|
|
471
540
|
"scroll-area.root",
|
|
472
541
|
"scroll-area.viewport",
|
|
473
|
-
"scroll-area.scrollbar"
|
|
542
|
+
"scroll-area.scrollbar",
|
|
543
|
+
"scroll-area.thumb"
|
|
474
544
|
] },
|
|
475
545
|
"drag-scroll": { parts: ["drag-scroll.root", "drag-scroll.viewport"] },
|
|
476
|
-
|
|
546
|
+
"chart-frame": {
|
|
477
547
|
parts: [
|
|
478
|
-
"
|
|
479
|
-
"
|
|
480
|
-
"
|
|
481
|
-
"
|
|
482
|
-
"
|
|
483
|
-
"
|
|
484
|
-
"
|
|
485
|
-
"
|
|
548
|
+
"chart-frame.root",
|
|
549
|
+
"chart-frame.header",
|
|
550
|
+
"chart-frame.title",
|
|
551
|
+
"chart-frame.description",
|
|
552
|
+
"chart-frame.actions",
|
|
553
|
+
"chart-frame.body",
|
|
554
|
+
"chart-frame.loading",
|
|
555
|
+
"chart-frame.empty",
|
|
556
|
+
"chart-frame.error"
|
|
486
557
|
],
|
|
487
558
|
slots: [
|
|
488
559
|
"header",
|
|
489
560
|
"title",
|
|
561
|
+
"description",
|
|
490
562
|
"actions",
|
|
491
563
|
"body",
|
|
492
564
|
"empty",
|
|
@@ -495,21 +567,6 @@ const UI_COMPONENTS = {
|
|
|
495
567
|
],
|
|
496
568
|
props: ["state"]
|
|
497
569
|
},
|
|
498
|
-
"chart-frame": {
|
|
499
|
-
parts: [
|
|
500
|
-
"chart-frame.root",
|
|
501
|
-
"chart-frame.header",
|
|
502
|
-
"chart-frame.title",
|
|
503
|
-
"chart-frame.actions",
|
|
504
|
-
"chart-frame.body"
|
|
505
|
-
],
|
|
506
|
-
slots: [
|
|
507
|
-
"header",
|
|
508
|
-
"title",
|
|
509
|
-
"actions",
|
|
510
|
-
"body"
|
|
511
|
-
]
|
|
512
|
-
},
|
|
513
570
|
settings: { parts: [
|
|
514
571
|
"settings.root",
|
|
515
572
|
"settings.header",
|
package/lib/fallback.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "@radix-ui/react-separator";
|
|
2
3
|
import { Slot } from "@radix-ui/react-slot";
|
|
3
4
|
import "@radix-ui/react-checkbox";
|
|
4
5
|
import "@radix-ui/react-label";
|
|
@@ -8,6 +9,14 @@ import "@radix-ui/react-switch";
|
|
|
8
9
|
import "@radix-ui/react-tabs";
|
|
9
10
|
import { Component, createContext, useContext, useSyncExternalStore } from "react";
|
|
10
11
|
import "@radix-ui/react-dialog";
|
|
12
|
+
import "react-hook-form";
|
|
13
|
+
import "@hookform/resolvers/zod";
|
|
14
|
+
import "@radix-ui/react-scroll-area";
|
|
15
|
+
import "@radix-ui/react-dropdown-menu";
|
|
16
|
+
import "@radix-ui/react-popover";
|
|
17
|
+
import "@radix-ui/react-toast";
|
|
18
|
+
import "@radix-ui/react-tooltip";
|
|
19
|
+
import "@radix-ui/react-slider";
|
|
11
20
|
//#region lib/types/utils.js
|
|
12
21
|
/**
|
|
13
22
|
* Small helpers shared by the headless semantic components: class merging and
|
|
@@ -139,6 +148,8 @@ function EmptyState({ title, description, icon, action, className }) {
|
|
|
139
148
|
]
|
|
140
149
|
});
|
|
141
150
|
}
|
|
151
|
+
createContext(null);
|
|
152
|
+
createContext(null);
|
|
142
153
|
//#endregion
|
|
143
154
|
//#region lib/types/components/layout.js
|
|
144
155
|
/** The operator-window shell frame. */
|