@stealthscale/component-feedback 0.2.2 → 0.2.3
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/dist/cyclonedx/bom.json +1 -1
- package/dist/index.js +1 -1825
- package/dist/pages/alert/alert.js +223 -0
- package/dist/pages/alert/alert.props.js +3 -0
- package/dist/pages/empty-state/empty-state.js +96 -0
- package/dist/pages/empty-state/empty-state.props.js +3 -0
- package/dist/pages/loader/loader.js +359 -0
- package/dist/pages/loader/loader.props.js +3 -0
- package/dist/pages/meter/meter.js +785 -0
- package/dist/pages/meter/meter.props.js +3 -0
- package/dist/pages/pages.json +115 -0
- package/dist/pages/progress/progress.js +550 -0
- package/dist/pages/progress/progress.props.js +3 -0
- package/dist/pages/progress-circle/progress-circle.js +329 -0
- package/dist/pages/progress-circle/progress-circle.props.js +3 -0
- package/dist/pages/skeleton/skeleton.js +94 -0
- package/dist/pages/skeleton/skeleton.props.js +3 -0
- package/dist/pages/skeleton-text/skeleton-text.js +81 -0
- package/dist/pages/skeleton-text/skeleton-text.props.js +3 -0
- package/dist/pages/spinner/spinner.js +186 -0
- package/dist/pages/spinner/spinner.props.js +3 -0
- package/dist/pages/toast/toast.js +427 -0
- package/dist/pages/toast/toast.props.js +3 -0
- package/dist/shared-Xc-n0bn7.js +1826 -0
- package/dist/theme.js +1 -1
- package/locales/en/specimen/alert.json +37 -0
- package/locales/en/specimen/empty-state.json +10 -0
- package/locales/en/specimen/loader.json +30 -0
- package/locales/en/specimen/meter.json +81 -0
- package/locales/en/specimen/progress-circle.json +41 -0
- package/locales/en/specimen/progress.json +66 -0
- package/locales/en/specimen/skeleton-text.json +12 -0
- package/locales/en/specimen/skeleton.json +18 -0
- package/locales/en/specimen/spinner.json +33 -0
- package/locales/en/specimen/toast.json +79 -0
- package/package.json +7 -6
- /package/dist/{recipe-CX1gSsN7.js → recipes-CX1gSsN7.js} +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export const dropped = {"RootProps": {"conditions": 284, "foreign": 1038}, "LabelProps": {"conditions": 284, "foreign": 1041}, "MarkerProps": {"conditions": 284, "foreign": 1041}, "RangeProps": {"conditions": 284, "foreign": 1041}, "SegmentProps": {"conditions": 284, "foreign": 1040}, "TrackProps": {"conditions": 284, "foreign": 1041}, "ValueTextProps": {"conditions": 284, "foreign": 1041}};
|
|
2
|
+
export const parts = {"RootProps": [{"accepts": "\"ltr\" | \"rtl\"", "fallback": "\"ltr\"", "kind": "option", "name": "dir", "refers": [], "required": false, "says": "The document's text/writing direction."}, {"accepts": "NumberFormatOptions", "fallback": "{ style: \"percent\" }", "kind": "option", "name": "formatOptions", "refers": [], "required": false, "says": "The options to use for formatting the value."}, {"accepts": "(() => Document | Node | ShadowRoot)", "fallback": "", "kind": "option", "name": "getRootNode", "refers": [], "required": false, "says": "A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron."}, {"accepts": "string", "fallback": "", "kind": "option", "name": "id", "refers": [], "required": false, "says": "The unique identifier of the machine."}, {"accepts": "ElementIds", "fallback": "", "kind": "option", "name": "ids", "refers": ["progress.ElementIds"], "required": false, "says": "The ids of the elements in the progress bar. Useful for composition."}, {"accepts": "\"inline\" | \"stacked\"", "fallback": "", "kind": "variant", "name": "layout", "refers": [], "required": false, "says": ""}, {"accepts": "string", "fallback": "\"en-US\"", "kind": "option", "name": "locale", "refers": [], "required": false, "says": "The locale to use for formatting the value."}, {"accepts": "number", "fallback": "100", "kind": "option", "name": "max", "refers": [], "required": false, "says": "The maximum allowed value of the progress bar."}, {"accepts": "number", "fallback": "0", "kind": "option", "name": "min", "refers": [], "required": false, "says": "The minimum allowed value of the progress bar."}, {"accepts": "\"accent\" | \"error\" | \"info\" | \"neutral\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"", "fallback": "", "kind": "variant", "name": "palette", "refers": [], "required": false, "says": ""}, {"accepts": "\"full\" | \"rounded\" | \"square\"", "fallback": "", "kind": "variant", "name": "shape", "refers": [], "required": false, "says": ""}, {"accepts": "\"lg\" | \"md\" | \"sm\" | \"xl\" | \"xs\"", "fallback": "", "kind": "variant", "name": "size", "refers": [], "required": false, "says": ""}, {"accepts": "number", "fallback": "", "kind": "option", "name": "value", "refers": [], "required": true, "says": "The measured value, between `min` and `max`."}, {"accepts": "\"outline\" | \"subtle\"", "fallback": "", "kind": "variant", "name": "variant", "refers": [], "required": false, "says": ""}], "LabelProps": [], "MarkerProps": [{"accepts": "number", "fallback": "", "kind": "option", "name": "value", "refers": [], "required": true, "says": "Value the marker is placed at, in the units of `min` and `max`."}], "RangeProps": [], "SegmentProps": [{"accepts": "SegmentColor", "fallback": "", "kind": "option", "name": "color", "refers": ["kit.SegmentColor"], "required": false, "says": "Color the segment fills in: a series color, or a palette's solid. The series color at the segment's place unless stated."}, {"accepts": "number", "fallback": "", "kind": "option", "name": "value", "refers": [], "required": true, "says": "Amount the segment stands for, in the units of `min` and `max`."}], "TrackProps": [], "ValueTextProps": []};
|
|
3
|
+
export const shapes = {"progress.ElementIds": [{"accepts": "string", "name": "root", "says": ""}, {"accepts": "string", "name": "track", "says": ""}, {"accepts": "string", "name": "label", "says": ""}, {"accepts": "string", "name": "circle", "says": ""}], "kit.SegmentColor": [{"accepts": "", "name": "\"accent\"", "says": ""}, {"accepts": "", "name": "\"error\"", "says": ""}, {"accepts": "", "name": "\"info\"", "says": ""}, {"accepts": "", "name": "\"neutral\"", "says": ""}, {"accepts": "", "name": "\"primary\"", "says": ""}, {"accepts": "", "name": "\"secondary\"", "says": ""}, {"accepts": "", "name": "\"series.1\"", "says": ""}, {"accepts": "", "name": "\"series.2\"", "says": ""}, {"accepts": "", "name": "\"series.3\"", "says": ""}, {"accepts": "", "name": "\"series.4\"", "says": ""}, {"accepts": "", "name": "\"series.5\"", "says": ""}, {"accepts": "", "name": "\"series.6\"", "says": ""}, {"accepts": "", "name": "\"series.7\"", "says": ""}, {"accepts": "", "name": "\"series.8\"", "says": ""}, {"accepts": "", "name": "\"success\"", "says": ""}, {"accepts": "", "name": "\"warning\"", "says": ""}]};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": 1,
|
|
3
|
+
"pages": [
|
|
4
|
+
{
|
|
5
|
+
"about": "alert.about",
|
|
6
|
+
"group": "",
|
|
7
|
+
"id": "components/feedback/alert",
|
|
8
|
+
"module": "alert/alert.js",
|
|
9
|
+
"namespace": "",
|
|
10
|
+
"props": "alert/alert.props.js",
|
|
11
|
+
"specimen": "src/alert/alert.specimen.tsx",
|
|
12
|
+
"title": "alert.title"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"about": "empty-state.about",
|
|
16
|
+
"group": "",
|
|
17
|
+
"id": "components/feedback/empty-state",
|
|
18
|
+
"module": "empty-state/empty-state.js",
|
|
19
|
+
"namespace": "",
|
|
20
|
+
"props": "empty-state/empty-state.props.js",
|
|
21
|
+
"specimen": "src/empty-state/empty-state.specimen.tsx",
|
|
22
|
+
"title": "empty-state.title"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"about": "loader.about",
|
|
26
|
+
"group": "",
|
|
27
|
+
"id": "components/feedback/loader",
|
|
28
|
+
"module": "loader/loader.js",
|
|
29
|
+
"namespace": "",
|
|
30
|
+
"props": "loader/loader.props.js",
|
|
31
|
+
"specimen": "src/loader/loader.specimen.tsx",
|
|
32
|
+
"title": "loader.title"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"about": "meter.about",
|
|
36
|
+
"group": "",
|
|
37
|
+
"id": "components/feedback/meter",
|
|
38
|
+
"module": "meter/meter.js",
|
|
39
|
+
"namespace": "",
|
|
40
|
+
"props": "meter/meter.props.js",
|
|
41
|
+
"specimen": "src/meter/meter.specimen.tsx",
|
|
42
|
+
"title": "meter.title"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"about": "progress-circle.about",
|
|
46
|
+
"group": "",
|
|
47
|
+
"id": "components/feedback/progress-circle",
|
|
48
|
+
"module": "progress-circle/progress-circle.js",
|
|
49
|
+
"namespace": "",
|
|
50
|
+
"props": "progress-circle/progress-circle.props.js",
|
|
51
|
+
"specimen": "src/progress-circle/progress-circle.specimen.tsx",
|
|
52
|
+
"title": "progress-circle.title"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"about": "progress.about",
|
|
56
|
+
"group": "",
|
|
57
|
+
"id": "components/feedback/progress",
|
|
58
|
+
"module": "progress/progress.js",
|
|
59
|
+
"namespace": "",
|
|
60
|
+
"props": "progress/progress.props.js",
|
|
61
|
+
"specimen": "src/progress/progress.specimen.tsx",
|
|
62
|
+
"title": "progress.title"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"about": "skeleton-text.about",
|
|
66
|
+
"group": "",
|
|
67
|
+
"id": "components/feedback/skeleton-text",
|
|
68
|
+
"module": "skeleton-text/skeleton-text.js",
|
|
69
|
+
"namespace": "",
|
|
70
|
+
"props": "skeleton-text/skeleton-text.props.js",
|
|
71
|
+
"specimen": "src/skeleton-text/skeleton-text.specimen.tsx",
|
|
72
|
+
"title": "skeleton-text.title"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"about": "skeleton.about",
|
|
76
|
+
"group": "",
|
|
77
|
+
"id": "components/feedback/skeleton",
|
|
78
|
+
"module": "skeleton/skeleton.js",
|
|
79
|
+
"namespace": "",
|
|
80
|
+
"props": "skeleton/skeleton.props.js",
|
|
81
|
+
"specimen": "src/skeleton/skeleton.specimen.tsx",
|
|
82
|
+
"title": "skeleton.title"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"about": "spinner.about",
|
|
86
|
+
"group": "",
|
|
87
|
+
"id": "components/feedback/spinner",
|
|
88
|
+
"module": "spinner/spinner.js",
|
|
89
|
+
"namespace": "",
|
|
90
|
+
"props": "spinner/spinner.props.js",
|
|
91
|
+
"specimen": "src/spinner/spinner.specimen.tsx",
|
|
92
|
+
"title": "spinner.title"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"about": "toast.about",
|
|
96
|
+
"group": "",
|
|
97
|
+
"id": "components/feedback/toast",
|
|
98
|
+
"module": "toast/toast.js",
|
|
99
|
+
"namespace": "",
|
|
100
|
+
"props": "toast/toast.props.js",
|
|
101
|
+
"specimen": "src/toast/toast.specimen.tsx",
|
|
102
|
+
"title": "toast.title"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"requires": {
|
|
106
|
+
"@stealthscale/component-actions": "^0.2.0",
|
|
107
|
+
"@stealthscale/component-data": "^0.2.0",
|
|
108
|
+
"@stealthscale/component-forms": "^0.3.0",
|
|
109
|
+
"@stealthscale/component-layout": "^0.2.0",
|
|
110
|
+
"@stealthscale/component-surfaces": "^0.1.0",
|
|
111
|
+
"@stealthscale/component-typography": "^0.3.0",
|
|
112
|
+
"@stealthscale/specimen": "^0.3.0",
|
|
113
|
+
"lucide-react": "^1.52.0"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { a as recipe } from "../../recipes-CX1gSsN7.js";
|
|
3
|
+
import { D as Range, E as Segment, O as Marker, T as Track, j as Root, k as Label, w as ValueText } from "../../shared-Xc-n0bn7.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Matrix, Room, scenesOf, specimen, useWords } from "@stealthscale/specimen";
|
|
7
|
+
import { Stack } from "@stealthscale/component-layout";
|
|
8
|
+
import { Status } from "@stealthscale/component-data";
|
|
9
|
+
//#region src/progress/examples/imported.example.tsx
|
|
10
|
+
var imported_example_exports = /* @__PURE__ */ __exportAll({
|
|
11
|
+
Imported: () => Imported,
|
|
12
|
+
source: () => source$5
|
|
13
|
+
});
|
|
14
|
+
function Imported() {
|
|
15
|
+
const $ = c(17);
|
|
16
|
+
const { t } = useWords("progress");
|
|
17
|
+
let t0;
|
|
18
|
+
if ($[0] !== t) {
|
|
19
|
+
t0 = t("imported");
|
|
20
|
+
$[0] = t;
|
|
21
|
+
$[1] = t0;
|
|
22
|
+
} else t0 = $[1];
|
|
23
|
+
let t1;
|
|
24
|
+
if ($[2] !== t0) {
|
|
25
|
+
t1 = /* @__PURE__ */ jsx(Label, { children: t0 });
|
|
26
|
+
$[2] = t0;
|
|
27
|
+
$[3] = t1;
|
|
28
|
+
} else t1 = $[3];
|
|
29
|
+
let t2;
|
|
30
|
+
if ($[4] !== t) {
|
|
31
|
+
t2 = t("rows");
|
|
32
|
+
$[4] = t;
|
|
33
|
+
$[5] = t2;
|
|
34
|
+
} else t2 = $[5];
|
|
35
|
+
let t3;
|
|
36
|
+
if ($[6] !== t2) {
|
|
37
|
+
t3 = /* @__PURE__ */ jsx(ValueText, { children: t2 });
|
|
38
|
+
$[6] = t2;
|
|
39
|
+
$[7] = t3;
|
|
40
|
+
} else t3 = $[7];
|
|
41
|
+
let t4;
|
|
42
|
+
if ($[8] !== t) {
|
|
43
|
+
t4 = t("rows");
|
|
44
|
+
$[8] = t;
|
|
45
|
+
$[9] = t4;
|
|
46
|
+
} else t4 = $[9];
|
|
47
|
+
let t5;
|
|
48
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
49
|
+
t5 = /* @__PURE__ */ jsx(Range, {});
|
|
50
|
+
$[10] = t5;
|
|
51
|
+
} else t5 = $[10];
|
|
52
|
+
let t6;
|
|
53
|
+
if ($[11] !== t4) {
|
|
54
|
+
t6 = /* @__PURE__ */ jsx(Track, {
|
|
55
|
+
"aria-valuetext": t4,
|
|
56
|
+
children: t5
|
|
57
|
+
});
|
|
58
|
+
$[11] = t4;
|
|
59
|
+
$[12] = t6;
|
|
60
|
+
} else t6 = $[12];
|
|
61
|
+
let t7;
|
|
62
|
+
if ($[13] !== t1 || $[14] !== t3 || $[15] !== t6) {
|
|
63
|
+
t7 = /* @__PURE__ */ jsxs(Root, {
|
|
64
|
+
max: 4200,
|
|
65
|
+
palette: "success",
|
|
66
|
+
value: 2650,
|
|
67
|
+
children: [
|
|
68
|
+
t1,
|
|
69
|
+
t3,
|
|
70
|
+
t6
|
|
71
|
+
]
|
|
72
|
+
});
|
|
73
|
+
$[13] = t1;
|
|
74
|
+
$[14] = t3;
|
|
75
|
+
$[15] = t6;
|
|
76
|
+
$[16] = t7;
|
|
77
|
+
} else t7 = $[16];
|
|
78
|
+
return t7;
|
|
79
|
+
}
|
|
80
|
+
const source$5 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Progress } from \"@stealthscale/component-feedback\";\n\nexport function Imported(): ReactElement {\n const { t } = useWords(\"progress\");\n\n return (\n <Progress.Root max={4200} palette=\"success\" value={2650}>\n <Progress.Label>{t(\"imported\")}</Progress.Label>\n <Progress.ValueText>{t(\"rows\")}</Progress.ValueText>\n <Progress.Track aria-valuetext={t(\"rows\")}>\n <Progress.Range />\n </Progress.Track>\n </Progress.Root>\n );\n}\n";
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/progress/examples/outcomes.example.tsx
|
|
83
|
+
var outcomes_example_exports = /* @__PURE__ */ __exportAll({
|
|
84
|
+
Outcomes: () => Outcomes,
|
|
85
|
+
source: () => source$4
|
|
86
|
+
});
|
|
87
|
+
const TESTS = 1200;
|
|
88
|
+
const OUTCOMES = [
|
|
89
|
+
{
|
|
90
|
+
color: "success",
|
|
91
|
+
count: 812,
|
|
92
|
+
key: "passed"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
color: "error",
|
|
96
|
+
count: 12,
|
|
97
|
+
key: "failed"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
color: "neutral",
|
|
101
|
+
count: 40,
|
|
102
|
+
key: "skipped"
|
|
103
|
+
}
|
|
104
|
+
];
|
|
105
|
+
const RUN = OUTCOMES.reduce((sum, outcome) => sum + outcome.count, 0);
|
|
106
|
+
function Outcomes() {
|
|
107
|
+
const $ = c(22);
|
|
108
|
+
const { t } = useWords("progress");
|
|
109
|
+
let t0;
|
|
110
|
+
if ($[0] !== t) {
|
|
111
|
+
t0 = t("outcomes.value", {
|
|
112
|
+
run: RUN,
|
|
113
|
+
tests: TESTS
|
|
114
|
+
});
|
|
115
|
+
$[0] = t;
|
|
116
|
+
$[1] = t0;
|
|
117
|
+
} else t0 = $[1];
|
|
118
|
+
const words = t0;
|
|
119
|
+
let t1;
|
|
120
|
+
if ($[2] !== t) {
|
|
121
|
+
t1 = t("outcomes.label");
|
|
122
|
+
$[2] = t;
|
|
123
|
+
$[3] = t1;
|
|
124
|
+
} else t1 = $[3];
|
|
125
|
+
let t2;
|
|
126
|
+
if ($[4] !== t1) {
|
|
127
|
+
t2 = /* @__PURE__ */ jsx(Label, { children: t1 });
|
|
128
|
+
$[4] = t1;
|
|
129
|
+
$[5] = t2;
|
|
130
|
+
} else t2 = $[5];
|
|
131
|
+
let t3;
|
|
132
|
+
if ($[6] !== words) {
|
|
133
|
+
t3 = /* @__PURE__ */ jsx(ValueText, { children: words });
|
|
134
|
+
$[6] = words;
|
|
135
|
+
$[7] = t3;
|
|
136
|
+
} else t3 = $[7];
|
|
137
|
+
let t4;
|
|
138
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
139
|
+
t4 = OUTCOMES.map(_temp);
|
|
140
|
+
$[8] = t4;
|
|
141
|
+
} else t4 = $[8];
|
|
142
|
+
let t5;
|
|
143
|
+
if ($[9] !== words) {
|
|
144
|
+
t5 = /* @__PURE__ */ jsx(Track, {
|
|
145
|
+
"aria-valuetext": words,
|
|
146
|
+
children: t4
|
|
147
|
+
});
|
|
148
|
+
$[9] = words;
|
|
149
|
+
$[10] = t5;
|
|
150
|
+
} else t5 = $[10];
|
|
151
|
+
let t6;
|
|
152
|
+
if ($[11] !== t2 || $[12] !== t3 || $[13] !== t5) {
|
|
153
|
+
t6 = /* @__PURE__ */ jsxs(Root, {
|
|
154
|
+
max: TESTS,
|
|
155
|
+
value: RUN,
|
|
156
|
+
children: [
|
|
157
|
+
t2,
|
|
158
|
+
t3,
|
|
159
|
+
t5
|
|
160
|
+
]
|
|
161
|
+
});
|
|
162
|
+
$[11] = t2;
|
|
163
|
+
$[12] = t3;
|
|
164
|
+
$[13] = t5;
|
|
165
|
+
$[14] = t6;
|
|
166
|
+
} else t6 = $[14];
|
|
167
|
+
let t7;
|
|
168
|
+
if ($[15] !== t) {
|
|
169
|
+
t7 = OUTCOMES.map((t8) => {
|
|
170
|
+
const { color: color_0, count: count_0, key: key_0 } = t8;
|
|
171
|
+
return /* @__PURE__ */ jsxs(Status.Root, {
|
|
172
|
+
palette: color_0,
|
|
173
|
+
size: "sm",
|
|
174
|
+
children: [/* @__PURE__ */ jsx(Status.Indicator, {}), t(`outcomes.${key_0}`, { count: count_0 })]
|
|
175
|
+
}, key_0);
|
|
176
|
+
});
|
|
177
|
+
$[15] = t;
|
|
178
|
+
$[16] = t7;
|
|
179
|
+
} else t7 = $[16];
|
|
180
|
+
let t8;
|
|
181
|
+
if ($[17] !== t7) {
|
|
182
|
+
t8 = /* @__PURE__ */ jsx(Stack, {
|
|
183
|
+
direction: "row",
|
|
184
|
+
gap: "md",
|
|
185
|
+
wrap: true,
|
|
186
|
+
children: t7
|
|
187
|
+
});
|
|
188
|
+
$[17] = t7;
|
|
189
|
+
$[18] = t8;
|
|
190
|
+
} else t8 = $[18];
|
|
191
|
+
let t9;
|
|
192
|
+
if ($[19] !== t6 || $[20] !== t8) {
|
|
193
|
+
t9 = /* @__PURE__ */ jsxs(Stack, {
|
|
194
|
+
gap: "sm",
|
|
195
|
+
children: [t6, t8]
|
|
196
|
+
});
|
|
197
|
+
$[19] = t6;
|
|
198
|
+
$[20] = t8;
|
|
199
|
+
$[21] = t9;
|
|
200
|
+
} else t9 = $[21];
|
|
201
|
+
return t9;
|
|
202
|
+
}
|
|
203
|
+
function _temp(t0) {
|
|
204
|
+
const { color, count, key } = t0;
|
|
205
|
+
return /* @__PURE__ */ jsx(Segment, {
|
|
206
|
+
color,
|
|
207
|
+
value: count
|
|
208
|
+
}, key);
|
|
209
|
+
}
|
|
210
|
+
const source$4 = "import { type ReactElement } from \"react\";\n\nimport { Status } from \"@stealthscale/component-data\";\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Progress } from \"@stealthscale/component-feedback\";\n\nconst TESTS = 1200;\n\nconst OUTCOMES = [\n { color: \"success\", count: 812, key: \"passed\" },\n { color: \"error\", count: 12, key: \"failed\" },\n { color: \"neutral\", count: 40, key: \"skipped\" },\n] as const;\n\nconst RUN = OUTCOMES.reduce((sum, outcome) => sum + outcome.count, 0);\n\nexport function Outcomes(): ReactElement {\n const { t } = useWords(\"progress\");\n const words = t(\"outcomes.value\", { run: RUN, tests: TESTS });\n\n return (\n <Stack gap=\"sm\">\n <Progress.Root max={TESTS} value={RUN}>\n <Progress.Label>{t(\"outcomes.label\")}</Progress.Label>\n <Progress.ValueText>{words}</Progress.ValueText>\n <Progress.Track aria-valuetext={words}>\n {OUTCOMES.map(({ color, count, key }) => (\n <Progress.Segment color={color} key={key} value={count} />\n ))}\n </Progress.Track>\n </Progress.Root>\n <Stack direction=\"row\" gap=\"md\" wrap>\n {OUTCOMES.map(({ color, count, key }) => (\n <Status.Root key={key} palette={color} size=\"sm\">\n <Status.Indicator />\n {t(`outcomes.${key}`, { count })}\n </Status.Root>\n ))}\n </Stack>\n </Stack>\n );\n}\n";
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/progress/examples/plan.example.tsx
|
|
213
|
+
var plan_example_exports = /* @__PURE__ */ __exportAll({
|
|
214
|
+
Plan: () => Plan,
|
|
215
|
+
source: () => source$3
|
|
216
|
+
});
|
|
217
|
+
const DONE = 62;
|
|
218
|
+
const PLANNED = 70;
|
|
219
|
+
function Plan() {
|
|
220
|
+
const $ = c(18);
|
|
221
|
+
const { t } = useWords("progress");
|
|
222
|
+
let t0;
|
|
223
|
+
if ($[0] !== t) {
|
|
224
|
+
t0 = t("plan.label");
|
|
225
|
+
$[0] = t;
|
|
226
|
+
$[1] = t0;
|
|
227
|
+
} else t0 = $[1];
|
|
228
|
+
let t1;
|
|
229
|
+
if ($[2] !== t0) {
|
|
230
|
+
t1 = /* @__PURE__ */ jsx(Label, { children: t0 });
|
|
231
|
+
$[2] = t0;
|
|
232
|
+
$[3] = t1;
|
|
233
|
+
} else t1 = $[3];
|
|
234
|
+
let t2;
|
|
235
|
+
if ($[4] !== t) {
|
|
236
|
+
t2 = t("plan.value", {
|
|
237
|
+
done: DONE,
|
|
238
|
+
planned: PLANNED
|
|
239
|
+
});
|
|
240
|
+
$[4] = t;
|
|
241
|
+
$[5] = t2;
|
|
242
|
+
} else t2 = $[5];
|
|
243
|
+
let t3;
|
|
244
|
+
if ($[6] !== t2) {
|
|
245
|
+
t3 = /* @__PURE__ */ jsx(ValueText, { children: t2 });
|
|
246
|
+
$[6] = t2;
|
|
247
|
+
$[7] = t3;
|
|
248
|
+
} else t3 = $[7];
|
|
249
|
+
let t4;
|
|
250
|
+
if ($[8] !== t) {
|
|
251
|
+
t4 = t("plan.spoken", {
|
|
252
|
+
done: DONE,
|
|
253
|
+
planned: PLANNED
|
|
254
|
+
});
|
|
255
|
+
$[8] = t;
|
|
256
|
+
$[9] = t4;
|
|
257
|
+
} else t4 = $[9];
|
|
258
|
+
let t5;
|
|
259
|
+
let t6;
|
|
260
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
261
|
+
t5 = /* @__PURE__ */ jsx(Range, {});
|
|
262
|
+
t6 = /* @__PURE__ */ jsx(Marker, { value: PLANNED });
|
|
263
|
+
$[10] = t5;
|
|
264
|
+
$[11] = t6;
|
|
265
|
+
} else {
|
|
266
|
+
t5 = $[10];
|
|
267
|
+
t6 = $[11];
|
|
268
|
+
}
|
|
269
|
+
let t7;
|
|
270
|
+
if ($[12] !== t4) {
|
|
271
|
+
t7 = /* @__PURE__ */ jsxs(Track, {
|
|
272
|
+
"aria-valuetext": t4,
|
|
273
|
+
children: [t5, t6]
|
|
274
|
+
});
|
|
275
|
+
$[12] = t4;
|
|
276
|
+
$[13] = t7;
|
|
277
|
+
} else t7 = $[13];
|
|
278
|
+
let t8;
|
|
279
|
+
if ($[14] !== t1 || $[15] !== t3 || $[16] !== t7) {
|
|
280
|
+
t8 = /* @__PURE__ */ jsxs(Root, {
|
|
281
|
+
palette: "warning",
|
|
282
|
+
value: DONE,
|
|
283
|
+
children: [
|
|
284
|
+
t1,
|
|
285
|
+
t3,
|
|
286
|
+
t7
|
|
287
|
+
]
|
|
288
|
+
});
|
|
289
|
+
$[14] = t1;
|
|
290
|
+
$[15] = t3;
|
|
291
|
+
$[16] = t7;
|
|
292
|
+
$[17] = t8;
|
|
293
|
+
} else t8 = $[17];
|
|
294
|
+
return t8;
|
|
295
|
+
}
|
|
296
|
+
const source$3 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Progress } from \"@stealthscale/component-feedback\";\n\nconst DONE = 62;\n\nconst PLANNED = 70;\n\nexport function Plan(): ReactElement {\n const { t } = useWords(\"progress\");\n\n return (\n <Progress.Root palette={DONE < PLANNED ? \"warning\" : \"primary\"} value={DONE}>\n <Progress.Label>{t(\"plan.label\")}</Progress.Label>\n <Progress.ValueText>{t(\"plan.value\", { done: DONE, planned: PLANNED })}</Progress.ValueText>\n <Progress.Track aria-valuetext={t(\"plan.spoken\", { done: DONE, planned: PLANNED })}>\n <Progress.Range />\n <Progress.Marker value={PLANNED} />\n </Progress.Track>\n </Progress.Root>\n );\n}\n";
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/progress/examples/playback.example.tsx
|
|
299
|
+
var playback_example_exports = /* @__PURE__ */ __exportAll({
|
|
300
|
+
Playback: () => Playback,
|
|
301
|
+
source: () => source$2
|
|
302
|
+
});
|
|
303
|
+
function Playback() {
|
|
304
|
+
const $ = c(8);
|
|
305
|
+
const { t } = useWords("progress");
|
|
306
|
+
let t0;
|
|
307
|
+
if ($[0] !== t) {
|
|
308
|
+
t0 = t("playback");
|
|
309
|
+
$[0] = t;
|
|
310
|
+
$[1] = t0;
|
|
311
|
+
} else t0 = $[1];
|
|
312
|
+
let t1;
|
|
313
|
+
if ($[2] !== t) {
|
|
314
|
+
t1 = t("played");
|
|
315
|
+
$[2] = t;
|
|
316
|
+
$[3] = t1;
|
|
317
|
+
} else t1 = $[3];
|
|
318
|
+
let t2;
|
|
319
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
320
|
+
t2 = /* @__PURE__ */ jsx(Range, {});
|
|
321
|
+
$[4] = t2;
|
|
322
|
+
} else t2 = $[4];
|
|
323
|
+
let t3;
|
|
324
|
+
if ($[5] !== t0 || $[6] !== t1) {
|
|
325
|
+
t3 = /* @__PURE__ */ jsx(Root, {
|
|
326
|
+
max: 245,
|
|
327
|
+
size: "xs",
|
|
328
|
+
value: 161,
|
|
329
|
+
children: /* @__PURE__ */ jsx(Track, {
|
|
330
|
+
"aria-label": t0,
|
|
331
|
+
"aria-valuetext": t1,
|
|
332
|
+
children: t2
|
|
333
|
+
})
|
|
334
|
+
});
|
|
335
|
+
$[5] = t0;
|
|
336
|
+
$[6] = t1;
|
|
337
|
+
$[7] = t3;
|
|
338
|
+
} else t3 = $[7];
|
|
339
|
+
return t3;
|
|
340
|
+
}
|
|
341
|
+
const source$2 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Progress } from \"@stealthscale/component-feedback\";\n\nexport function Playback(): ReactElement {\n const { t } = useWords(\"progress\");\n\n return (\n <Progress.Root max={245} size=\"xs\" value={161}>\n <Progress.Track aria-label={t(\"playback\")} aria-valuetext={t(\"played\")}>\n <Progress.Range />\n </Progress.Track>\n </Progress.Root>\n );\n}\n";
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region src/progress/examples/preparing.example.tsx
|
|
344
|
+
var preparing_example_exports = /* @__PURE__ */ __exportAll({
|
|
345
|
+
Preparing: () => Preparing,
|
|
346
|
+
source: () => source$1
|
|
347
|
+
});
|
|
348
|
+
function Preparing(props) {
|
|
349
|
+
const $ = c(8);
|
|
350
|
+
const { t } = useWords("progress");
|
|
351
|
+
let t0;
|
|
352
|
+
if ($[0] !== t) {
|
|
353
|
+
t0 = t("preparing");
|
|
354
|
+
$[0] = t;
|
|
355
|
+
$[1] = t0;
|
|
356
|
+
} else t0 = $[1];
|
|
357
|
+
let t1;
|
|
358
|
+
if ($[2] !== t0) {
|
|
359
|
+
t1 = /* @__PURE__ */ jsx(Label, { children: t0 });
|
|
360
|
+
$[2] = t0;
|
|
361
|
+
$[3] = t1;
|
|
362
|
+
} else t1 = $[3];
|
|
363
|
+
let t2;
|
|
364
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
365
|
+
t2 = /* @__PURE__ */ jsx(Track, { children: /* @__PURE__ */ jsx(Range, {}) });
|
|
366
|
+
$[4] = t2;
|
|
367
|
+
} else t2 = $[4];
|
|
368
|
+
let t3;
|
|
369
|
+
if ($[5] !== props || $[6] !== t1) {
|
|
370
|
+
t3 = /* @__PURE__ */ jsxs(Root, {
|
|
371
|
+
value: null,
|
|
372
|
+
...props,
|
|
373
|
+
children: [t1, t2]
|
|
374
|
+
});
|
|
375
|
+
$[5] = props;
|
|
376
|
+
$[6] = t1;
|
|
377
|
+
$[7] = t3;
|
|
378
|
+
} else t3 = $[7];
|
|
379
|
+
return t3;
|
|
380
|
+
}
|
|
381
|
+
const source$1 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Progress } from \"@stealthscale/component-feedback\";\n\nexport function Preparing(props: Progress.RootProps): ReactElement {\n const { t } = useWords(\"progress\");\n\n return (\n <Progress.Root value={null} {...props}>\n <Progress.Label>{t(\"preparing\")}</Progress.Label>\n <Progress.Track>\n <Progress.Range />\n </Progress.Track>\n </Progress.Root>\n );\n}\n";
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region src/progress/examples/reconciling.example.tsx
|
|
384
|
+
var reconciling_example_exports = /* @__PURE__ */ __exportAll({
|
|
385
|
+
Reconciling: () => Reconciling,
|
|
386
|
+
source: () => source
|
|
387
|
+
});
|
|
388
|
+
function Reconciling(props) {
|
|
389
|
+
const $ = c(9);
|
|
390
|
+
const { t } = useWords("progress");
|
|
391
|
+
let t0;
|
|
392
|
+
if ($[0] !== t) {
|
|
393
|
+
t0 = t("reconciling");
|
|
394
|
+
$[0] = t;
|
|
395
|
+
$[1] = t0;
|
|
396
|
+
} else t0 = $[1];
|
|
397
|
+
let t1;
|
|
398
|
+
if ($[2] !== t0) {
|
|
399
|
+
t1 = /* @__PURE__ */ jsx(Label, { children: t0 });
|
|
400
|
+
$[2] = t0;
|
|
401
|
+
$[3] = t1;
|
|
402
|
+
} else t1 = $[3];
|
|
403
|
+
let t2;
|
|
404
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
405
|
+
t2 = /* @__PURE__ */ jsx(ValueText, {});
|
|
406
|
+
$[4] = t2;
|
|
407
|
+
} else t2 = $[4];
|
|
408
|
+
let t3;
|
|
409
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
410
|
+
t3 = /* @__PURE__ */ jsx(Track, { children: /* @__PURE__ */ jsx(Range, {}) });
|
|
411
|
+
$[5] = t3;
|
|
412
|
+
} else t3 = $[5];
|
|
413
|
+
let t4;
|
|
414
|
+
if ($[6] !== props || $[7] !== t1) {
|
|
415
|
+
t4 = /* @__PURE__ */ jsxs(Root, {
|
|
416
|
+
value: 62,
|
|
417
|
+
...props,
|
|
418
|
+
children: [
|
|
419
|
+
t1,
|
|
420
|
+
t2,
|
|
421
|
+
t3
|
|
422
|
+
]
|
|
423
|
+
});
|
|
424
|
+
$[6] = props;
|
|
425
|
+
$[7] = t1;
|
|
426
|
+
$[8] = t4;
|
|
427
|
+
} else t4 = $[8];
|
|
428
|
+
return t4;
|
|
429
|
+
}
|
|
430
|
+
const source = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Progress } from \"@stealthscale/component-feedback\";\n\nexport function Reconciling(props: Progress.RootProps): ReactElement {\n const { t } = useWords(\"progress\");\n\n return (\n <Progress.Root value={62} {...props}>\n <Progress.Label>{t(\"reconciling\")}</Progress.Label>\n <Progress.ValueText />\n <Progress.Track>\n <Progress.Range />\n </Progress.Track>\n </Progress.Root>\n );\n}\n";
|
|
431
|
+
//#endregion
|
|
432
|
+
//#region src/progress/progress.specimen.tsx
|
|
433
|
+
/**
|
|
434
|
+
* Catalogue page for the progress bar.
|
|
435
|
+
*
|
|
436
|
+
* @remarks
|
|
437
|
+
* `scenesOf` generates one scene per recipe axis from a labelled bar at 62%, each in a room at
|
|
438
|
+
* the `xs` measure, because a bar is as wide as its container. The palette scene crosses the
|
|
439
|
+
* looks, the shape scene uses the thickest track, and the effect scene uses the primary palette.
|
|
440
|
+
* Hand-written scenes render a value the machine does not know in both looks, a count in its own
|
|
441
|
+
* units, a bar without words named by `aria-label`, a migration against its plan's marker, and a
|
|
442
|
+
* test run split by outcome. The words are keys under `progress` in
|
|
443
|
+
* `locales/en/specimen/progress.json`.
|
|
444
|
+
*/
|
|
445
|
+
/**
|
|
446
|
+
* Looks of the unknown-value scene.
|
|
447
|
+
*/
|
|
448
|
+
const LOOKS = ["outline", "subtle"];
|
|
449
|
+
/**
|
|
450
|
+
* Hand-written scene for a value the machine does not know, in both looks.
|
|
451
|
+
*/
|
|
452
|
+
const unknown = {
|
|
453
|
+
about: "progress.unknown.about",
|
|
454
|
+
draw: () => /* @__PURE__ */ jsx(Matrix, {
|
|
455
|
+
knob: "variant",
|
|
456
|
+
of: LOOKS,
|
|
457
|
+
children: (variant) => /* @__PURE__ */ jsx(Room, {
|
|
458
|
+
size: "xs",
|
|
459
|
+
children: /* @__PURE__ */ jsx(Preparing, { variant })
|
|
460
|
+
})
|
|
461
|
+
}),
|
|
462
|
+
example: preparing_example_exports,
|
|
463
|
+
props: { variant: "outline" },
|
|
464
|
+
title: "progress.unknown.title"
|
|
465
|
+
};
|
|
466
|
+
/**
|
|
467
|
+
* Hand-written scene for a count in its own units.
|
|
468
|
+
*/
|
|
469
|
+
const units = {
|
|
470
|
+
about: "progress.units.about",
|
|
471
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
472
|
+
size: "xs",
|
|
473
|
+
children: /* @__PURE__ */ jsx(Imported, {})
|
|
474
|
+
}),
|
|
475
|
+
example: imported_example_exports,
|
|
476
|
+
title: "progress.units.title"
|
|
477
|
+
};
|
|
478
|
+
/**
|
|
479
|
+
* Hand-written scene for a bar without words, named by `aria-label`.
|
|
480
|
+
*/
|
|
481
|
+
const bare = {
|
|
482
|
+
about: "progress.bare.about",
|
|
483
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
484
|
+
size: "xs",
|
|
485
|
+
children: /* @__PURE__ */ jsx(Playback, {})
|
|
486
|
+
}),
|
|
487
|
+
example: playback_example_exports,
|
|
488
|
+
title: "progress.bare.title"
|
|
489
|
+
};
|
|
490
|
+
/**
|
|
491
|
+
* Hand-written scene for a migration against the share its plan expects, marked on the track.
|
|
492
|
+
*/
|
|
493
|
+
const planned = {
|
|
494
|
+
about: "progress.plan.about",
|
|
495
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
496
|
+
size: "xs",
|
|
497
|
+
children: /* @__PURE__ */ jsx(Plan, {})
|
|
498
|
+
}),
|
|
499
|
+
example: plan_example_exports,
|
|
500
|
+
title: "progress.plan.title"
|
|
501
|
+
};
|
|
502
|
+
/**
|
|
503
|
+
* Hand-written scene for a test run split by outcome, each outcome a segment.
|
|
504
|
+
*/
|
|
505
|
+
const split = {
|
|
506
|
+
about: "progress.outcomes.about",
|
|
507
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
508
|
+
size: "xs",
|
|
509
|
+
children: /* @__PURE__ */ jsx(Outcomes, {})
|
|
510
|
+
}),
|
|
511
|
+
example: outcomes_example_exports,
|
|
512
|
+
title: "progress.outcomes.title"
|
|
513
|
+
};
|
|
514
|
+
var progress_specimen_default = specimen({
|
|
515
|
+
about: "progress.about",
|
|
516
|
+
id: "components/feedback/progress",
|
|
517
|
+
imports: "import { Progress } from \"@stealthscale/component-feedback\";",
|
|
518
|
+
scenes: [
|
|
519
|
+
...scenesOf(recipe, {
|
|
520
|
+
axes: {
|
|
521
|
+
effect: { with: { palette: "primary" } },
|
|
522
|
+
palette: { across: "variant" },
|
|
523
|
+
shape: { with: { size: "xl" } }
|
|
524
|
+
},
|
|
525
|
+
draw: (props) => /* @__PURE__ */ jsx(Room, {
|
|
526
|
+
size: "xs",
|
|
527
|
+
children: /* @__PURE__ */ jsx(Reconciling, { ...props })
|
|
528
|
+
}),
|
|
529
|
+
example: reconciling_example_exports,
|
|
530
|
+
namespace: "progress",
|
|
531
|
+
order: [
|
|
532
|
+
"size",
|
|
533
|
+
"shape",
|
|
534
|
+
"palette",
|
|
535
|
+
"layout",
|
|
536
|
+
"striped",
|
|
537
|
+
"animated",
|
|
538
|
+
"effect"
|
|
539
|
+
]
|
|
540
|
+
}),
|
|
541
|
+
unknown,
|
|
542
|
+
units,
|
|
543
|
+
bare,
|
|
544
|
+
planned,
|
|
545
|
+
split
|
|
546
|
+
],
|
|
547
|
+
title: "progress.title"
|
|
548
|
+
});
|
|
549
|
+
//#endregion
|
|
550
|
+
export { bare, progress_specimen_default as default, planned, split, units, unknown };
|