@snap-rail/ui 0.1.1 → 0.3.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 +12 -5
- package/lib/components/index.js +2195 -0
- package/lib/contract.js +138 -62
- package/lib/fallback.js +21 -4
- package/lib/index.js +4287 -261
- package/lib/runtime.js +206 -77
- package/lib/settings-pages/index.js +1326 -0
- package/lib/settings.js +122 -72
- 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/button.js +2 -2
- package/lib/types/components/combobox.d.ts +45 -0
- package/lib/types/components/combobox.js +108 -0
- package/lib/types/components/controls.d.ts +74 -11
- package/lib/types/components/controls.js +67 -24
- package/lib/types/components/dialog.js +1 -1
- 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 +8 -0
- package/lib/types/components/index.js +8 -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 +110 -0
- package/lib/types/components/overlay.js +185 -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/components/surface.js +12 -12
- package/lib/types/contract.d.ts +55 -30
- package/lib/types/contract.js +55 -30
- 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/lib/types/utils.d.ts +7 -1
- package/lib/types/utils.js +7 -1
- package/package.json +14 -7
- package/src/styles/base.css +315 -5
- package/src/styles/default.css +194 -6
package/lib/charts.js
CHANGED
|
@@ -11,7 +11,13 @@ import { createContext, useContext, useSyncExternalStore } from "react";
|
|
|
11
11
|
function cn(...values) {
|
|
12
12
|
return values.filter((value) => typeof value === "string" && value.length > 0).join(" ");
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* The anatomy attributes every semantic component renders. The identity is
|
|
16
|
+
* component-owned: components spread these AFTER caller props so a composite
|
|
17
|
+
* can never mask a host part (a masked `button.root` loses every skin rule
|
|
18
|
+
* and falls back to the UA default look). Composites tag their own wrappers
|
|
19
|
+
* instead of pushing `part()` into a child component's props.
|
|
20
|
+
*/
|
|
15
21
|
function part(component, name) {
|
|
16
22
|
return {
|
|
17
23
|
"data-snap-component": component,
|
|
@@ -50,6 +56,7 @@ function ChartFrame({ title, description, actions, state = "ready", empty, error
|
|
|
50
56
|
...part("chart-frame", "title"),
|
|
51
57
|
children: title
|
|
52
58
|
}), description !== void 0 && jsx("div", {
|
|
59
|
+
...part("chart-frame", "description"),
|
|
53
60
|
className: "snap-chart-frame-description",
|
|
54
61
|
children: description
|
|
55
62
|
})] }), actions !== void 0 && jsx("div", {
|
|
@@ -61,20 +68,20 @@ function ChartFrame({ title, description, actions, state = "ready", empty, error
|
|
|
61
68
|
className: "snap-chart-frame-body",
|
|
62
69
|
"data-state": state,
|
|
63
70
|
children: state === "loading" ? loading ?? jsx("div", {
|
|
64
|
-
...part("
|
|
71
|
+
...part("chart-frame", "loading"),
|
|
65
72
|
children: "加载中…"
|
|
66
73
|
}) : state === "empty" ? empty ?? jsx("div", {
|
|
67
|
-
...part("
|
|
74
|
+
...part("chart-frame", "empty"),
|
|
68
75
|
children: "暂无数据"
|
|
69
76
|
}) : state === "error" ? error ?? jsx("div", {
|
|
70
|
-
...part("
|
|
77
|
+
...part("chart-frame", "error"),
|
|
71
78
|
role: "alert",
|
|
72
79
|
children: "图表加载失败"
|
|
73
80
|
}) : children
|
|
74
81
|
})]
|
|
75
82
|
});
|
|
76
83
|
}
|
|
77
|
-
/**
|
|
84
|
+
/** An alias of {@link ChartFrame} for pages that prefer the generic name. */
|
|
78
85
|
function Visualization(props) {
|
|
79
86
|
return jsx(ChartFrame, { ...props });
|
|
80
87
|
}
|