@stealthscale/component-actions 0.2.1 → 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 -996
- package/dist/pages/button/button.js +323 -0
- package/dist/pages/button/button.props.js +3 -0
- package/dist/pages/clipboard/clipboard.js +400 -0
- package/dist/pages/clipboard/clipboard.props.js +3 -0
- package/dist/pages/color-mode-toggle/color-mode-toggle.js +176 -0
- package/dist/pages/color-mode-toggle/color-mode-toggle.props.js +3 -0
- package/dist/pages/download-trigger/download-trigger.js +401 -0
- package/dist/pages/download-trigger/download-trigger.props.js +3 -0
- package/dist/pages/pages.json +74 -0
- package/dist/pages/swap/swap.js +379 -0
- package/dist/pages/swap/swap.props.js +3 -0
- package/dist/pages/toggle-group/toggle-group.js +326 -0
- package/dist/pages/toggle-group/toggle-group.props.js +3 -0
- package/dist/shared-Dv6Wx5nA.js +997 -0
- package/dist/theme.js +34 -13
- package/locales/en/specimen/button.json +39 -0
- package/locales/en/specimen/clipboard.json +33 -0
- package/locales/en/specimen/color-mode-toggle.json +14 -0
- package/locales/en/specimen/download-trigger.json +34 -0
- package/locales/en/specimen/swap.json +30 -0
- package/locales/en/specimen/toggle-group.json +48 -0
- package/package.json +6 -5
- /package/dist/{recipe-BhcK7PNL.js → recipes-BhcK7PNL.js} +0 -0
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { r as recipe } from "../../recipes-BhcK7PNL.js";
|
|
3
|
+
import { b as Button, y as IconButton } from "../../shared-Dv6Wx5nA.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Matrix, scenesOf, specimen, useWords, valuesOf } from "@stealthscale/specimen";
|
|
7
|
+
import { CheckIcon } from "lucide-react";
|
|
8
|
+
//#region src/button/examples/approve.example.tsx
|
|
9
|
+
var approve_example_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
+
Approve: () => Approve,
|
|
11
|
+
source: () => source$6
|
|
12
|
+
});
|
|
13
|
+
function Approve(props) {
|
|
14
|
+
const $ = c(6);
|
|
15
|
+
const { t } = useWords("button");
|
|
16
|
+
let t0;
|
|
17
|
+
if ($[0] !== t) {
|
|
18
|
+
t0 = t("approve");
|
|
19
|
+
$[0] = t;
|
|
20
|
+
$[1] = t0;
|
|
21
|
+
} else t0 = $[1];
|
|
22
|
+
let t1;
|
|
23
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
24
|
+
t1 = /* @__PURE__ */ jsx(CheckIcon, { size: "1em" });
|
|
25
|
+
$[2] = t1;
|
|
26
|
+
} else t1 = $[2];
|
|
27
|
+
let t2;
|
|
28
|
+
if ($[3] !== props || $[4] !== t0) {
|
|
29
|
+
t2 = /* @__PURE__ */ jsx(IconButton, {
|
|
30
|
+
"aria-label": t0,
|
|
31
|
+
...props,
|
|
32
|
+
children: t1
|
|
33
|
+
});
|
|
34
|
+
$[3] = props;
|
|
35
|
+
$[4] = t0;
|
|
36
|
+
$[5] = t2;
|
|
37
|
+
} else t2 = $[5];
|
|
38
|
+
return t2;
|
|
39
|
+
}
|
|
40
|
+
const source$6 = "import { type ReactElement } from \"react\";\n\nimport { CheckIcon } from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { IconButton } from \"@stealthscale/component-actions\";\n\nexport function Approve(\n props: Omit<Parameters<typeof IconButton>[0], \"aria-label\" | \"children\">,\n): ReactElement {\n const { t } = useWords(\"button\");\n\n return (\n <IconButton aria-label={t(\"approve\")} {...props}>\n <CheckIcon size=\"1em\" />\n </IconButton>\n );\n}\n";
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/button/examples/archive.example.tsx
|
|
43
|
+
var archive_example_exports = /* @__PURE__ */ __exportAll({
|
|
44
|
+
Archive: () => Archive,
|
|
45
|
+
source: () => source$5
|
|
46
|
+
});
|
|
47
|
+
function Archive(props) {
|
|
48
|
+
const $ = c(5);
|
|
49
|
+
const { t } = useWords("button");
|
|
50
|
+
let t0;
|
|
51
|
+
if ($[0] !== t) {
|
|
52
|
+
t0 = t("archive");
|
|
53
|
+
$[0] = t;
|
|
54
|
+
$[1] = t0;
|
|
55
|
+
} else t0 = $[1];
|
|
56
|
+
let t1;
|
|
57
|
+
if ($[2] !== props || $[3] !== t0) {
|
|
58
|
+
t1 = /* @__PURE__ */ jsx(Button, {
|
|
59
|
+
...props,
|
|
60
|
+
children: t0
|
|
61
|
+
});
|
|
62
|
+
$[2] = props;
|
|
63
|
+
$[3] = t0;
|
|
64
|
+
$[4] = t1;
|
|
65
|
+
} else t1 = $[4];
|
|
66
|
+
return t1;
|
|
67
|
+
}
|
|
68
|
+
const source$5 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Button } from \"@stealthscale/component-actions\";\n\nexport function Archive(props: Parameters<typeof Button>[0]): ReactElement {\n const { t } = useWords(\"button\");\n\n return <Button {...props}>{t(\"archive\")}</Button>;\n}\n";
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/button/examples/bold.example.tsx
|
|
71
|
+
var bold_example_exports = /* @__PURE__ */ __exportAll({
|
|
72
|
+
Bold: () => Bold,
|
|
73
|
+
source: () => source$4
|
|
74
|
+
});
|
|
75
|
+
function Bold(props) {
|
|
76
|
+
const $ = c(5);
|
|
77
|
+
const { t } = useWords("button");
|
|
78
|
+
let t0;
|
|
79
|
+
if ($[0] !== t) {
|
|
80
|
+
t0 = t("bold");
|
|
81
|
+
$[0] = t;
|
|
82
|
+
$[1] = t0;
|
|
83
|
+
} else t0 = $[1];
|
|
84
|
+
let t1;
|
|
85
|
+
if ($[2] !== props || $[3] !== t0) {
|
|
86
|
+
t1 = /* @__PURE__ */ jsx(Button, {
|
|
87
|
+
...props,
|
|
88
|
+
children: t0
|
|
89
|
+
});
|
|
90
|
+
$[2] = props;
|
|
91
|
+
$[3] = t0;
|
|
92
|
+
$[4] = t1;
|
|
93
|
+
} else t1 = $[4];
|
|
94
|
+
return t1;
|
|
95
|
+
}
|
|
96
|
+
const source$4 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Button } from \"@stealthscale/component-actions\";\n\nexport function Bold(props: Parameters<typeof Button>[0]): ReactElement {\n const { t } = useWords(\"button\");\n\n return <Button {...props}>{t(\"bold\")}</Button>;\n}\n";
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/button/examples/celebrate.example.tsx
|
|
99
|
+
var celebrate_example_exports = /* @__PURE__ */ __exportAll({
|
|
100
|
+
Celebrate: () => Celebrate,
|
|
101
|
+
source: () => source$3
|
|
102
|
+
});
|
|
103
|
+
function Celebrate(props) {
|
|
104
|
+
const $ = c(5);
|
|
105
|
+
const { t } = useWords("button");
|
|
106
|
+
let t0;
|
|
107
|
+
if ($[0] !== t) {
|
|
108
|
+
t0 = t("celebrate");
|
|
109
|
+
$[0] = t;
|
|
110
|
+
$[1] = t0;
|
|
111
|
+
} else t0 = $[1];
|
|
112
|
+
let t1;
|
|
113
|
+
if ($[2] !== props || $[3] !== t0) {
|
|
114
|
+
t1 = /* @__PURE__ */ jsx(Button, {
|
|
115
|
+
...props,
|
|
116
|
+
children: t0
|
|
117
|
+
});
|
|
118
|
+
$[2] = props;
|
|
119
|
+
$[3] = t0;
|
|
120
|
+
$[4] = t1;
|
|
121
|
+
} else t1 = $[4];
|
|
122
|
+
return t1;
|
|
123
|
+
}
|
|
124
|
+
const source$3 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Button } from \"@stealthscale/component-actions\";\n\nexport function Celebrate(props: Parameters<typeof Button>[0]): ReactElement {\n const { t } = useWords(\"button\");\n\n return <Button {...props}>{t(\"celebrate\")}</Button>;\n}\n";
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/button/examples/publish.example.tsx
|
|
127
|
+
var publish_example_exports = /* @__PURE__ */ __exportAll({
|
|
128
|
+
Publish: () => Publish,
|
|
129
|
+
source: () => source$2
|
|
130
|
+
});
|
|
131
|
+
function Publish(props) {
|
|
132
|
+
const $ = c(5);
|
|
133
|
+
const { t } = useWords("button");
|
|
134
|
+
let t0;
|
|
135
|
+
if ($[0] !== t) {
|
|
136
|
+
t0 = t("publish");
|
|
137
|
+
$[0] = t;
|
|
138
|
+
$[1] = t0;
|
|
139
|
+
} else t0 = $[1];
|
|
140
|
+
let t1;
|
|
141
|
+
if ($[2] !== props || $[3] !== t0) {
|
|
142
|
+
t1 = /* @__PURE__ */ jsx(Button, {
|
|
143
|
+
...props,
|
|
144
|
+
children: t0
|
|
145
|
+
});
|
|
146
|
+
$[2] = props;
|
|
147
|
+
$[3] = t0;
|
|
148
|
+
$[4] = t1;
|
|
149
|
+
} else t1 = $[4];
|
|
150
|
+
return t1;
|
|
151
|
+
}
|
|
152
|
+
const source$2 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Button } from \"@stealthscale/component-actions\";\n\nexport function Publish(props: Parameters<typeof Button>[0]): ReactElement {\n const { t } = useWords(\"button\");\n\n return <Button {...props}>{t(\"publish\")}</Button>;\n}\n";
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/button/examples/retry.example.tsx
|
|
155
|
+
var retry_example_exports = /* @__PURE__ */ __exportAll({
|
|
156
|
+
Retry: () => Retry,
|
|
157
|
+
source: () => source$1
|
|
158
|
+
});
|
|
159
|
+
function Retry(props) {
|
|
160
|
+
const $ = c(5);
|
|
161
|
+
const { t } = useWords("button");
|
|
162
|
+
let t0;
|
|
163
|
+
if ($[0] !== t) {
|
|
164
|
+
t0 = t("retry");
|
|
165
|
+
$[0] = t;
|
|
166
|
+
$[1] = t0;
|
|
167
|
+
} else t0 = $[1];
|
|
168
|
+
let t1;
|
|
169
|
+
if ($[2] !== props || $[3] !== t0) {
|
|
170
|
+
t1 = /* @__PURE__ */ jsx(Button, {
|
|
171
|
+
...props,
|
|
172
|
+
children: t0
|
|
173
|
+
});
|
|
174
|
+
$[2] = props;
|
|
175
|
+
$[3] = t0;
|
|
176
|
+
$[4] = t1;
|
|
177
|
+
} else t1 = $[4];
|
|
178
|
+
return t1;
|
|
179
|
+
}
|
|
180
|
+
const source$1 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Button } from \"@stealthscale/component-actions\";\n\nexport function Retry(props: Parameters<typeof Button>[0]): ReactElement {\n const { t } = useWords(\"button\");\n\n return <Button {...props}>{t(\"retry\")}</Button>;\n}\n";
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/button/examples/upload.example.tsx
|
|
183
|
+
var upload_example_exports = /* @__PURE__ */ __exportAll({
|
|
184
|
+
Upload: () => Upload,
|
|
185
|
+
source: () => source
|
|
186
|
+
});
|
|
187
|
+
function Upload(props) {
|
|
188
|
+
const $ = c(5);
|
|
189
|
+
const { t } = useWords("button");
|
|
190
|
+
let t0;
|
|
191
|
+
if ($[0] !== t) {
|
|
192
|
+
t0 = t("upload");
|
|
193
|
+
$[0] = t;
|
|
194
|
+
$[1] = t0;
|
|
195
|
+
} else t0 = $[1];
|
|
196
|
+
let t1;
|
|
197
|
+
if ($[2] !== props || $[3] !== t0) {
|
|
198
|
+
t1 = /* @__PURE__ */ jsx(Button, {
|
|
199
|
+
...props,
|
|
200
|
+
children: t0
|
|
201
|
+
});
|
|
202
|
+
$[2] = props;
|
|
203
|
+
$[3] = t0;
|
|
204
|
+
$[4] = t1;
|
|
205
|
+
} else t1 = $[4];
|
|
206
|
+
return t1;
|
|
207
|
+
}
|
|
208
|
+
const source = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Button } from \"@stealthscale/component-actions\";\n\nexport function Upload(props: Parameters<typeof Button>[0]): ReactElement {\n const { t } = useWords(\"button\");\n\n return <Button {...props}>{t(\"upload\")}</Button>;\n}\n";
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/button/button.specimen.tsx
|
|
211
|
+
/**
|
|
212
|
+
* Catalogue page for the button.
|
|
213
|
+
*
|
|
214
|
+
* @remarks
|
|
215
|
+
* `scenesOf` generates one scene per recipe axis. The pressed and disabled scenes are
|
|
216
|
+
* hand-written, because `aria-pressed` and `disabled` are element attributes, not recipe axes.
|
|
217
|
+
* Every scene renders a component from `examples/` and shows that file as its source, and each
|
|
218
|
+
* scene labels its buttons with a different action. The words are keys under `button` in the
|
|
219
|
+
* `specimen` namespace, stored in `locales/en/specimen/button.json`.
|
|
220
|
+
*/
|
|
221
|
+
/**
|
|
222
|
+
* Look values, crossed with every other axis.
|
|
223
|
+
*/
|
|
224
|
+
const LOOKS = valuesOf(recipe, "variant");
|
|
225
|
+
/**
|
|
226
|
+
* Both values of a boolean attribute, false first.
|
|
227
|
+
*/
|
|
228
|
+
const EITHER = [false, true];
|
|
229
|
+
/**
|
|
230
|
+
* Hand-written scene for `aria-pressed` on every look.
|
|
231
|
+
*/
|
|
232
|
+
const pressed = {
|
|
233
|
+
about: "button.pressed.about",
|
|
234
|
+
draw: () => /* @__PURE__ */ jsx(Matrix, {
|
|
235
|
+
across: {
|
|
236
|
+
knob: "variant",
|
|
237
|
+
of: LOOKS
|
|
238
|
+
},
|
|
239
|
+
knob: "aria-pressed",
|
|
240
|
+
of: EITHER,
|
|
241
|
+
children: (on, variant) => /* @__PURE__ */ jsx(Bold, {
|
|
242
|
+
"aria-pressed": on,
|
|
243
|
+
variant
|
|
244
|
+
})
|
|
245
|
+
}),
|
|
246
|
+
example: bold_example_exports,
|
|
247
|
+
props: {
|
|
248
|
+
"aria-pressed": true,
|
|
249
|
+
variant: "solid"
|
|
250
|
+
},
|
|
251
|
+
title: "button.pressed.title"
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* Hand-written scene for `disabled` on every look.
|
|
255
|
+
*/
|
|
256
|
+
const disabled = {
|
|
257
|
+
about: "button.disabled.about",
|
|
258
|
+
draw: () => /* @__PURE__ */ jsx(Matrix, {
|
|
259
|
+
across: {
|
|
260
|
+
knob: "variant",
|
|
261
|
+
of: LOOKS
|
|
262
|
+
},
|
|
263
|
+
knob: "disabled",
|
|
264
|
+
of: EITHER,
|
|
265
|
+
children: (off, variant) => /* @__PURE__ */ jsx(Archive, {
|
|
266
|
+
disabled: off,
|
|
267
|
+
variant
|
|
268
|
+
})
|
|
269
|
+
}),
|
|
270
|
+
example: archive_example_exports,
|
|
271
|
+
props: {
|
|
272
|
+
disabled: true,
|
|
273
|
+
variant: "solid"
|
|
274
|
+
},
|
|
275
|
+
title: "button.disabled.title"
|
|
276
|
+
};
|
|
277
|
+
var button_specimen_default = specimen({
|
|
278
|
+
about: "button.about",
|
|
279
|
+
id: "components/actions/button",
|
|
280
|
+
imports: "import { Button, IconButton } from \"@stealthscale/component-actions\";",
|
|
281
|
+
scenes: [
|
|
282
|
+
...scenesOf(recipe, {
|
|
283
|
+
axes: {
|
|
284
|
+
effect: {
|
|
285
|
+
across: "variant",
|
|
286
|
+
draw: (props) => /* @__PURE__ */ jsx(Celebrate, { ...props }),
|
|
287
|
+
example: celebrate_example_exports
|
|
288
|
+
},
|
|
289
|
+
elevation: {
|
|
290
|
+
across: "variant",
|
|
291
|
+
draw: (props) => /* @__PURE__ */ jsx(Upload, { ...props }),
|
|
292
|
+
example: upload_example_exports
|
|
293
|
+
},
|
|
294
|
+
palette: {
|
|
295
|
+
across: "variant",
|
|
296
|
+
draw: (props) => /* @__PURE__ */ jsx(Retry, { ...props }),
|
|
297
|
+
example: retry_example_exports
|
|
298
|
+
},
|
|
299
|
+
shape: {
|
|
300
|
+
across: "variant",
|
|
301
|
+
draw: (props) => /* @__PURE__ */ jsx(Approve, { ...props }),
|
|
302
|
+
example: approve_example_exports
|
|
303
|
+
},
|
|
304
|
+
variant: { across: "size" }
|
|
305
|
+
},
|
|
306
|
+
draw: (props) => /* @__PURE__ */ jsx(Publish, { ...props }),
|
|
307
|
+
example: publish_example_exports,
|
|
308
|
+
namespace: "button",
|
|
309
|
+
order: [
|
|
310
|
+
"variant",
|
|
311
|
+
"palette",
|
|
312
|
+
"elevation",
|
|
313
|
+
"effect",
|
|
314
|
+
"shape"
|
|
315
|
+
]
|
|
316
|
+
}),
|
|
317
|
+
pressed,
|
|
318
|
+
disabled
|
|
319
|
+
],
|
|
320
|
+
title: "button.title"
|
|
321
|
+
});
|
|
322
|
+
//#endregion
|
|
323
|
+
export { button_specimen_default as default, disabled, pressed };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export const dropped = {"ButtonProps": {"conditions": 284, "foreign": 1051}, "IconButtonProps": {"conditions": 284, "foreign": 1049}};
|
|
2
|
+
export const parts = {"ButtonProps": [{"accepts": "\"glow\" | \"pulse\"", "fallback": "", "kind": "variant", "name": "effect", "refers": [], "required": false, "says": "The halo around the button, in the palette's solid at half opacity."}, {"accepts": "Lift", "fallback": "", "kind": "variant", "name": "elevation", "refers": ["kit.Lift"], "required": false, "says": ""}, {"accepts": "\"accent\" | \"error\" | \"info\" | \"neutral\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"", "fallback": "", "kind": "variant", "name": "palette", "refers": [], "required": false, "says": "Palette of every look. The base sets `primary`."}, {"accepts": "\"square\"", "fallback": "", "kind": "variant", "name": "shape", "refers": [], "required": false, "says": ""}, {"accepts": "Scale", "fallback": "", "kind": "variant", "name": "size", "refers": ["kit.Scale"], "required": false, "says": ""}, {"accepts": "\"ghost\" | \"glass\" | \"outline\" | \"plain\" | \"solid\" | \"subtle\" | \"surface\"", "fallback": "", "kind": "variant", "name": "variant", "refers": [], "required": false, "says": ""}], "IconButtonProps": [{"accepts": "string", "fallback": "", "kind": "option", "name": "aria-label", "refers": [], "required": false, "says": "Defines a string value that labels the current element. The accessible name a screen reader announces in place of the icon."}, {"accepts": "string", "fallback": "", "kind": "option", "name": "aria-labelledby", "refers": [], "required": false, "says": "Identifies the element (or elements) that labels the current element. The id of the element whose text names the control."}, {"accepts": "\"glow\" | \"pulse\"", "fallback": "", "kind": "variant", "name": "effect", "refers": [], "required": false, "says": "The halo around the button, in the palette's solid at half opacity."}, {"accepts": "Lift", "fallback": "", "kind": "variant", "name": "elevation", "refers": ["kit.Lift"], "required": false, "says": ""}, {"accepts": "\"accent\" | \"error\" | \"info\" | \"neutral\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"", "fallback": "", "kind": "variant", "name": "palette", "refers": [], "required": false, "says": "Palette of every look. The base sets `primary`."}, {"accepts": "\"square\"", "fallback": "", "kind": "variant", "name": "shape", "refers": [], "required": false, "says": ""}, {"accepts": "Scale", "fallback": "", "kind": "variant", "name": "size", "refers": ["kit.Scale"], "required": false, "says": ""}, {"accepts": "\"ghost\" | \"glass\" | \"outline\" | \"plain\" | \"solid\" | \"subtle\" | \"surface\"", "fallback": "", "kind": "variant", "name": "variant", "refers": [], "required": false, "says": ""}]};
|
|
3
|
+
export const shapes = {"kit.Lift": [{"accepts": "", "name": "\"floating\"", "says": ""}, {"accepts": "", "name": "\"raised\"", "says": ""}], "kit.Scale": [{"accepts": "", "name": "\"2xl\"", "says": ""}, {"accepts": "", "name": "\"3xl\"", "says": ""}, {"accepts": "", "name": "\"4xl\"", "says": ""}, {"accepts": "", "name": "\"lg\"", "says": ""}, {"accepts": "", "name": "\"md\"", "says": ""}, {"accepts": "", "name": "\"sm\"", "says": ""}, {"accepts": "", "name": "\"xl\"", "says": ""}, {"accepts": "", "name": "\"xs\"", "says": ""}]};
|