@stealthscale/component-screen 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.
Files changed (44) hide show
  1. package/dist/cyclonedx/bom.json +1 -1
  2. package/dist/index.d.ts +3 -3
  3. package/dist/index.js +1 -8216
  4. package/dist/pages/action-bar/action-bar.js +471 -0
  5. package/dist/pages/action-bar/action-bar.props.js +3 -0
  6. package/dist/pages/app-shell/app-shell.js +4899 -0
  7. package/dist/pages/app-shell/app-shell.props.js +3 -0
  8. package/dist/pages/floating-panel/floating-panel.js +995 -0
  9. package/dist/pages/floating-panel/floating-panel.props.js +3 -0
  10. package/dist/pages/locale-switcher/locale-switcher.js +180 -0
  11. package/dist/pages/locale-switcher/locale-switcher.props.js +3 -0
  12. package/dist/pages/page/page.js +2308 -0
  13. package/dist/pages/page/page.props.js +3 -0
  14. package/dist/pages/pages.json +123 -0
  15. package/dist/pages/section/section.js +1241 -0
  16. package/dist/pages/section/section.props.js +3 -0
  17. package/dist/pages/sidebar/sidebar.js +1743 -0
  18. package/dist/pages/sidebar/sidebar.props.js +3 -0
  19. package/dist/pages/splitter/splitter.js +1563 -0
  20. package/dist/pages/splitter/splitter.props.js +3 -0
  21. package/dist/pages/switcher/switcher.js +900 -0
  22. package/dist/pages/switcher/switcher.props.js +3 -0
  23. package/dist/pages/theme-switcher/theme-switcher.js +180 -0
  24. package/dist/pages/theme-switcher/theme-switcher.props.js +3 -0
  25. package/dist/pages/toolbar/toolbar.js +1045 -0
  26. package/dist/pages/toolbar/toolbar.props.js +3 -0
  27. package/dist/{recipe-sZAQY6Kq.js → recipes-Cmy1leBm.js} +312 -30
  28. package/dist/shared-DxlFabHA.js +9547 -0
  29. package/dist/shell.js +1 -165
  30. package/dist/theme.js +3 -4
  31. package/locales/en/specimen/action-bar.json +46 -0
  32. package/locales/en/specimen/app-shell.json +288 -0
  33. package/locales/en/specimen/floating-panel.json +70 -0
  34. package/locales/en/specimen/locale-switcher.json +15 -0
  35. package/locales/en/specimen/page.json +198 -0
  36. package/locales/en/specimen/section.json +91 -0
  37. package/locales/en/specimen/sidebar.json +87 -0
  38. package/locales/en/specimen/splitter.json +93 -0
  39. package/locales/en/specimen/switcher.json +61 -0
  40. package/locales/en/specimen/theme-switcher.json +15 -0
  41. package/locales/en/specimen/toolbar.json +80 -0
  42. package/package.json +25 -24
  43. package/dist/recipe-DRMsitrw.js +0 -283
  44. package/dist/root-qEh4u7y5.js +0 -1182
@@ -0,0 +1,471 @@
1
+ import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
2
+ import { O as recipe } from "../../recipes-Cmy1leBm.js";
3
+ import { Gt as Content, Kt as CloseTrigger, Ut as Root$1, Wt as Positioner, a as Start, c as Root, d as End, p as Action } from "../../shared-DxlFabHA.js";
4
+ import { c } from "react/compiler-runtime";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { useState } from "react";
7
+ import { Checkbox } from "@stealthscale/component-forms";
8
+ import { Grid, Stack } from "@stealthscale/component-layout";
9
+ import { scenesOf, specimen, useWords } from "@stealthscale/specimen";
10
+ import { CheckIcon, DownloadIcon, EllipsisIcon, ReceiptIcon, Share2Icon, XIcon } from "lucide-react";
11
+ import { Text } from "@stealthscale/component-typography";
12
+ //#region src/action-bar/examples/photos.example.tsx
13
+ var photos_example_exports = /* @__PURE__ */ __exportAll({
14
+ Photos: () => Photos,
15
+ source: () => source$1
16
+ });
17
+ const PHOTOS = [
18
+ "harbour",
19
+ "market",
20
+ "bridge",
21
+ "garden",
22
+ "tower",
23
+ "square"
24
+ ];
25
+ const ACTIONS$1 = [
26
+ { name: "album" },
27
+ { name: "trash" },
28
+ {
29
+ Icon: DownloadIcon,
30
+ name: "download"
31
+ },
32
+ {
33
+ Icon: Share2Icon,
34
+ name: "share",
35
+ primary: true
36
+ }
37
+ ];
38
+ function choices$1(names, label, selected, toggle) {
39
+ return names.map((name) => /* @__PURE__ */ jsxs(Checkbox.Root, {
40
+ checked: selected.includes(name),
41
+ onCheckedChange: ({ checked }) => {
42
+ toggle(name, checked === true);
43
+ },
44
+ children: [/* @__PURE__ */ jsx(Checkbox.Control, { children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(CheckIcon, { strokeWidth: 3 }) }) }), /* @__PURE__ */ jsx(Checkbox.Label, { children: label(name) })]
45
+ }, name));
46
+ }
47
+ function Photos() {
48
+ const $ = c(50);
49
+ const { t } = useWords("action-bar");
50
+ let t0;
51
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
52
+ t0 = [];
53
+ $[0] = t0;
54
+ } else t0 = $[0];
55
+ const [selected, setSelected] = useState(t0);
56
+ const [done, setDone] = useState("");
57
+ const count = selected.length;
58
+ let t1;
59
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
60
+ t1 = (photo, on) => {
61
+ setSelected((held) => on ? [...held, photo] : held.filter((each) => each !== photo));
62
+ };
63
+ $[1] = t1;
64
+ } else t1 = $[1];
65
+ const toggle = t1;
66
+ let t2;
67
+ if ($[2] !== t) {
68
+ t2 = (photo_0) => t(`photos.names.${photo_0}`);
69
+ $[2] = t;
70
+ $[3] = t2;
71
+ } else t2 = $[3];
72
+ let t3;
73
+ if ($[4] !== selected || $[5] !== t2) {
74
+ t3 = choices$1(PHOTOS, t2, selected, toggle);
75
+ $[4] = selected;
76
+ $[5] = t2;
77
+ $[6] = t3;
78
+ } else t3 = $[6];
79
+ let t4;
80
+ if ($[7] !== t3) {
81
+ t4 = /* @__PURE__ */ jsx(Grid.Root, {
82
+ columns: "2",
83
+ justify: "start",
84
+ children: t3
85
+ });
86
+ $[7] = t3;
87
+ $[8] = t4;
88
+ } else t4 = $[8];
89
+ let t5;
90
+ if ($[9] !== done) {
91
+ t5 = /* @__PURE__ */ jsx(Text, {
92
+ as: "output",
93
+ children: done
94
+ });
95
+ $[9] = done;
96
+ $[10] = t5;
97
+ } else t5 = $[10];
98
+ let t6;
99
+ if ($[11] !== t) {
100
+ t6 = t("photos.announcement");
101
+ $[11] = t;
102
+ $[12] = t6;
103
+ } else t6 = $[12];
104
+ let t7;
105
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
106
+ t7 = () => {
107
+ setSelected([]);
108
+ };
109
+ $[13] = t7;
110
+ } else t7 = $[13];
111
+ const t8 = count > 0;
112
+ let t9;
113
+ if ($[14] !== t) {
114
+ t9 = t("photos.label");
115
+ $[14] = t;
116
+ $[15] = t9;
117
+ } else t9 = $[15];
118
+ let t10;
119
+ if ($[16] !== t) {
120
+ t10 = t("photos.more");
121
+ $[16] = t;
122
+ $[17] = t10;
123
+ } else t10 = $[17];
124
+ let t11;
125
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
126
+ t11 = /* @__PURE__ */ jsx(EllipsisIcon, { size: "1em" });
127
+ $[18] = t11;
128
+ } else t11 = $[18];
129
+ let t12;
130
+ if ($[19] !== t) {
131
+ t12 = t("clear");
132
+ $[19] = t;
133
+ $[20] = t12;
134
+ } else t12 = $[20];
135
+ let t13;
136
+ if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
137
+ t13 = /* @__PURE__ */ jsx(XIcon, { size: "1em" });
138
+ $[21] = t13;
139
+ } else t13 = $[21];
140
+ let t14;
141
+ if ($[22] !== t12) {
142
+ t14 = /* @__PURE__ */ jsx(CloseTrigger, {
143
+ "aria-label": t12,
144
+ children: t13
145
+ });
146
+ $[22] = t12;
147
+ $[23] = t14;
148
+ } else t14 = $[23];
149
+ let t15;
150
+ if ($[24] !== count || $[25] !== t) {
151
+ t15 = t("photos.count", { count });
152
+ $[24] = count;
153
+ $[25] = t;
154
+ $[26] = t15;
155
+ } else t15 = $[26];
156
+ let t16;
157
+ if ($[27] !== t15) {
158
+ t16 = /* @__PURE__ */ jsx(Text, {
159
+ size: "sm",
160
+ children: t15
161
+ });
162
+ $[27] = t15;
163
+ $[28] = t16;
164
+ } else t16 = $[28];
165
+ let t17;
166
+ if ($[29] !== t14 || $[30] !== t16) {
167
+ t17 = /* @__PURE__ */ jsxs(Start, { children: [t14, t16] });
168
+ $[29] = t14;
169
+ $[30] = t16;
170
+ $[31] = t17;
171
+ } else t17 = $[31];
172
+ let t18;
173
+ if ($[32] !== count || $[33] !== t) {
174
+ t18 = ACTIONS$1.map((action) => /* @__PURE__ */ jsx(Action, {
175
+ icon: "Icon" in action ? /* @__PURE__ */ jsx(action.Icon, { size: "1em" }) : void 0,
176
+ onClick: () => {
177
+ setDone(t("photos.done", {
178
+ action: t(`photos.${action.name}`),
179
+ count
180
+ }));
181
+ },
182
+ primary: "primary" in action,
183
+ priority: "primary" in action ? "primary" : void 0,
184
+ children: t(`photos.${action.name}`)
185
+ }, action.name));
186
+ $[32] = count;
187
+ $[33] = t;
188
+ $[34] = t18;
189
+ } else t18 = $[34];
190
+ let t19;
191
+ if ($[35] !== t18) {
192
+ t19 = /* @__PURE__ */ jsx(End, { children: t18 });
193
+ $[35] = t18;
194
+ $[36] = t19;
195
+ } else t19 = $[36];
196
+ let t20;
197
+ if ($[37] !== t10 || $[38] !== t17 || $[39] !== t19 || $[40] !== t9) {
198
+ t20 = /* @__PURE__ */ jsx(Positioner, { children: /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsxs(Root, {
199
+ "aria-label": t9,
200
+ more: t10,
201
+ moreIcon: t11,
202
+ size: "sm",
203
+ children: [t17, t19]
204
+ }) }) });
205
+ $[37] = t10;
206
+ $[38] = t17;
207
+ $[39] = t19;
208
+ $[40] = t9;
209
+ $[41] = t20;
210
+ } else t20 = $[41];
211
+ let t21;
212
+ if ($[42] !== t20 || $[43] !== t6 || $[44] !== t8) {
213
+ t21 = /* @__PURE__ */ jsx(Root$1, {
214
+ announcement: t6,
215
+ onOpenChange: t7,
216
+ open: t8,
217
+ placement: "bottom-end",
218
+ children: t20
219
+ });
220
+ $[42] = t20;
221
+ $[43] = t6;
222
+ $[44] = t8;
223
+ $[45] = t21;
224
+ } else t21 = $[45];
225
+ let t22;
226
+ if ($[46] !== t21 || $[47] !== t4 || $[48] !== t5) {
227
+ t22 = /* @__PURE__ */ jsxs(Stack, {
228
+ gap: "sm",
229
+ children: [
230
+ t4,
231
+ t5,
232
+ t21
233
+ ]
234
+ });
235
+ $[46] = t21;
236
+ $[47] = t4;
237
+ $[48] = t5;
238
+ $[49] = t22;
239
+ } else t22 = $[49];
240
+ return t22;
241
+ }
242
+ const source$1 = "import { type ReactElement, useState } from \"react\";\n\nimport { CheckIcon, DownloadIcon, EllipsisIcon, Share2Icon, XIcon } from \"lucide-react\";\n\nimport { Checkbox } from \"@stealthscale/component-forms\";\nimport { Grid, Stack } from \"@stealthscale/component-layout\";\nimport { Text } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { ActionBar, Toolbar } from \"@stealthscale/component-screen\";\n\nconst PHOTOS = [\"harbour\", \"market\", \"bridge\", \"garden\", \"tower\", \"square\"] as const;\n\nconst ACTIONS = [\n { name: \"album\" },\n { name: \"trash\" },\n { Icon: DownloadIcon, name: \"download\" },\n { Icon: Share2Icon, name: \"share\", primary: true },\n] as const;\n\nfunction choices<Name extends string>(\n names: readonly Name[],\n label: (name: Name) => string,\n selected: readonly string[],\n toggle: (name: Name, on: boolean) => void,\n): ReactElement[] {\n return names.map((name) => (\n <Checkbox.Root\n checked={selected.includes(name)}\n key={name}\n onCheckedChange={({ checked }) => {\n toggle(name, checked === true);\n }}\n >\n <Checkbox.Control>\n <Checkbox.Indicator>\n <CheckIcon strokeWidth={3} />\n </Checkbox.Indicator>\n </Checkbox.Control>\n <Checkbox.Label>{label(name)}</Checkbox.Label>\n </Checkbox.Root>\n ));\n}\n\nexport function Photos(): ReactElement {\n const { t } = useWords(\"action-bar\");\n const [selected, setSelected] = useState<readonly string[]>([]);\n const [done, setDone] = useState(\"\");\n const count = selected.length;\n const toggle = (photo: string, on: boolean): void => {\n setSelected((held) => (on ? [...held, photo] : held.filter((each) => each !== photo)));\n };\n\n return (\n <Stack gap=\"sm\">\n <Grid.Root columns=\"2\" justify=\"start\">\n {choices(PHOTOS, (photo) => t(`photos.names.${photo}`), selected, toggle)}\n </Grid.Root>\n <Text as=\"output\">{done}</Text>\n <ActionBar.Root\n announcement={t(\"photos.announcement\")}\n onOpenChange={() => {\n setSelected([]);\n }}\n open={count > 0}\n placement=\"bottom-end\"\n >\n <ActionBar.Positioner>\n <ActionBar.Content>\n <Toolbar.Root\n aria-label={t(\"photos.label\")}\n more={t(\"photos.more\")}\n moreIcon={<EllipsisIcon size=\"1em\" />}\n size=\"sm\"\n >\n <Toolbar.Start>\n <ActionBar.CloseTrigger aria-label={t(\"clear\")}>\n <XIcon size=\"1em\" />\n </ActionBar.CloseTrigger>\n <Text size=\"sm\">{t(\"photos.count\", { count })}</Text>\n </Toolbar.Start>\n <Toolbar.End>\n {ACTIONS.map((action) => (\n <Toolbar.Action\n icon={\"Icon\" in action ? <action.Icon size=\"1em\" /> : undefined}\n key={action.name}\n onClick={() => {\n setDone(t(\"photos.done\", { action: t(`photos.${action.name}`), count }));\n }}\n primary={\"primary\" in action}\n priority={\"primary\" in action ? \"primary\" : undefined}\n >\n {t(`photos.${action.name}`)}\n </Toolbar.Action>\n ))}\n </Toolbar.End>\n </Toolbar.Root>\n </ActionBar.Content>\n </ActionBar.Positioner>\n </ActionBar.Root>\n </Stack>\n );\n}\n";
243
+ //#endregion
244
+ //#region src/action-bar/examples/selection.example.tsx
245
+ var selection_example_exports = /* @__PURE__ */ __exportAll({
246
+ Selection: () => Selection,
247
+ source: () => source
248
+ });
249
+ const INVOICES = [
250
+ "1042",
251
+ "1043",
252
+ "1044",
253
+ "1045"
254
+ ];
255
+ const ACTIONS = [{
256
+ Icon: DownloadIcon,
257
+ name: "download",
258
+ primary: false
259
+ }, {
260
+ Icon: ReceiptIcon,
261
+ name: "mark",
262
+ primary: true
263
+ }];
264
+ function choices(names, label, selected, toggle) {
265
+ return names.map((name) => /* @__PURE__ */ jsxs(Checkbox.Root, {
266
+ checked: selected.includes(name),
267
+ onCheckedChange: ({ checked }) => {
268
+ toggle(name, checked === true);
269
+ },
270
+ children: [/* @__PURE__ */ jsx(Checkbox.Control, { children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(CheckIcon, { strokeWidth: 3 }) }) }), /* @__PURE__ */ jsx(Checkbox.Label, { children: label(name) })]
271
+ }, name));
272
+ }
273
+ function Selection(props) {
274
+ const $ = c(42);
275
+ const { t } = useWords("action-bar");
276
+ let t0;
277
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
278
+ t0 = [];
279
+ $[0] = t0;
280
+ } else t0 = $[0];
281
+ const [selected, setSelected] = useState(t0);
282
+ const [done, setDone] = useState("");
283
+ const count = selected.length;
284
+ let t1;
285
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
286
+ t1 = (number, on) => {
287
+ setSelected((held) => on ? [...held, number] : held.filter((each) => each !== number));
288
+ };
289
+ $[1] = t1;
290
+ } else t1 = $[1];
291
+ const toggle = t1;
292
+ let t2;
293
+ if ($[2] !== t) {
294
+ t2 = (number_0) => t("selection.invoice", { number: number_0 });
295
+ $[2] = t;
296
+ $[3] = t2;
297
+ } else t2 = $[3];
298
+ let t3;
299
+ if ($[4] !== selected || $[5] !== t2) {
300
+ t3 = choices(INVOICES, t2, selected, toggle);
301
+ $[4] = selected;
302
+ $[5] = t2;
303
+ $[6] = t3;
304
+ } else t3 = $[6];
305
+ let t4;
306
+ if ($[7] !== done) {
307
+ t4 = /* @__PURE__ */ jsx(Text, {
308
+ as: "output",
309
+ children: done
310
+ });
311
+ $[7] = done;
312
+ $[8] = t4;
313
+ } else t4 = $[8];
314
+ let t5;
315
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
316
+ t5 = () => {
317
+ setSelected([]);
318
+ };
319
+ $[9] = t5;
320
+ } else t5 = $[9];
321
+ const t6 = count > 0;
322
+ let t7;
323
+ if ($[10] !== t) {
324
+ t7 = t("selection.label");
325
+ $[10] = t;
326
+ $[11] = t7;
327
+ } else t7 = $[11];
328
+ let t8;
329
+ if ($[12] !== t) {
330
+ t8 = t("clear");
331
+ $[12] = t;
332
+ $[13] = t8;
333
+ } else t8 = $[13];
334
+ let t9;
335
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
336
+ t9 = /* @__PURE__ */ jsx(XIcon, { size: "1em" });
337
+ $[14] = t9;
338
+ } else t9 = $[14];
339
+ let t10;
340
+ if ($[15] !== t8) {
341
+ t10 = /* @__PURE__ */ jsx(CloseTrigger, {
342
+ "aria-label": t8,
343
+ children: t9
344
+ });
345
+ $[15] = t8;
346
+ $[16] = t10;
347
+ } else t10 = $[16];
348
+ let t11;
349
+ if ($[17] !== count || $[18] !== t) {
350
+ t11 = t("selection.count", { count });
351
+ $[17] = count;
352
+ $[18] = t;
353
+ $[19] = t11;
354
+ } else t11 = $[19];
355
+ let t12;
356
+ if ($[20] !== t11) {
357
+ t12 = /* @__PURE__ */ jsx(Text, {
358
+ size: "sm",
359
+ children: t11
360
+ });
361
+ $[20] = t11;
362
+ $[21] = t12;
363
+ } else t12 = $[21];
364
+ let t13;
365
+ if ($[22] !== t10 || $[23] !== t12) {
366
+ t13 = /* @__PURE__ */ jsxs(Start, { children: [t10, t12] });
367
+ $[22] = t10;
368
+ $[23] = t12;
369
+ $[24] = t13;
370
+ } else t13 = $[24];
371
+ let t14;
372
+ if ($[25] !== count || $[26] !== t) {
373
+ t14 = ACTIONS.map((t15) => {
374
+ const { Icon, name, primary } = t15;
375
+ return /* @__PURE__ */ jsx(Action, {
376
+ icon: /* @__PURE__ */ jsx(Icon, { size: "1em" }),
377
+ onClick: () => {
378
+ setDone(t(`selection.${name}.done`, { count }));
379
+ },
380
+ primary,
381
+ priority: primary ? "primary" : void 0,
382
+ children: t(`selection.${name}.label`)
383
+ }, name);
384
+ });
385
+ $[25] = count;
386
+ $[26] = t;
387
+ $[27] = t14;
388
+ } else t14 = $[27];
389
+ let t15;
390
+ if ($[28] !== t14) {
391
+ t15 = /* @__PURE__ */ jsx(End, { children: t14 });
392
+ $[28] = t14;
393
+ $[29] = t15;
394
+ } else t15 = $[29];
395
+ let t16;
396
+ if ($[30] !== t13 || $[31] !== t15 || $[32] !== t7) {
397
+ t16 = /* @__PURE__ */ jsx(Positioner, { children: /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsxs(Root, {
398
+ "aria-label": t7,
399
+ size: "sm",
400
+ children: [t13, t15]
401
+ }) }) });
402
+ $[30] = t13;
403
+ $[31] = t15;
404
+ $[32] = t7;
405
+ $[33] = t16;
406
+ } else t16 = $[33];
407
+ let t17;
408
+ if ($[34] !== props || $[35] !== t16 || $[36] !== t6) {
409
+ t17 = /* @__PURE__ */ jsx(Root$1, {
410
+ ...props,
411
+ onOpenChange: t5,
412
+ open: t6,
413
+ children: t16
414
+ });
415
+ $[34] = props;
416
+ $[35] = t16;
417
+ $[36] = t6;
418
+ $[37] = t17;
419
+ } else t17 = $[37];
420
+ let t18;
421
+ if ($[38] !== t17 || $[39] !== t3 || $[40] !== t4) {
422
+ t18 = /* @__PURE__ */ jsxs(Stack, {
423
+ gap: "sm",
424
+ children: [
425
+ t3,
426
+ t4,
427
+ t17
428
+ ]
429
+ });
430
+ $[38] = t17;
431
+ $[39] = t3;
432
+ $[40] = t4;
433
+ $[41] = t18;
434
+ } else t18 = $[41];
435
+ return t18;
436
+ }
437
+ const source = "import { type ReactElement, useState } from \"react\";\n\nimport { CheckIcon, DownloadIcon, ReceiptIcon, XIcon } from \"lucide-react\";\n\nimport { Checkbox } from \"@stealthscale/component-forms\";\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { Text } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { ActionBar, Toolbar } from \"@stealthscale/component-screen\";\n\nconst INVOICES = [\"1042\", \"1043\", \"1044\", \"1045\"] as const;\n\nconst ACTIONS = [\n { Icon: DownloadIcon, name: \"download\", primary: false },\n { Icon: ReceiptIcon, name: \"mark\", primary: true },\n] as const;\n\nfunction choices<Name extends string>(\n names: readonly Name[],\n label: (name: Name) => string,\n selected: readonly string[],\n toggle: (name: Name, on: boolean) => void,\n): ReactElement[] {\n return names.map((name) => (\n <Checkbox.Root\n checked={selected.includes(name)}\n key={name}\n onCheckedChange={({ checked }) => {\n toggle(name, checked === true);\n }}\n >\n <Checkbox.Control>\n <Checkbox.Indicator>\n <CheckIcon strokeWidth={3} />\n </Checkbox.Indicator>\n </Checkbox.Control>\n <Checkbox.Label>{label(name)}</Checkbox.Label>\n </Checkbox.Root>\n ));\n}\n\nexport function Selection(props: Omit<ActionBar.RootProps, \"open\">): ReactElement {\n const { t } = useWords(\"action-bar\");\n const [selected, setSelected] = useState<readonly string[]>([]);\n const [done, setDone] = useState(\"\");\n const count = selected.length;\n const toggle = (number: string, on: boolean): void => {\n setSelected((held) => (on ? [...held, number] : held.filter((each) => each !== number)));\n };\n\n return (\n <Stack gap=\"sm\">\n {choices(INVOICES, (number) => t(\"selection.invoice\", { number }), selected, toggle)}\n <Text as=\"output\">{done}</Text>\n <ActionBar.Root\n {...props}\n onOpenChange={() => {\n setSelected([]);\n }}\n open={count > 0}\n >\n <ActionBar.Positioner>\n <ActionBar.Content>\n <Toolbar.Root aria-label={t(\"selection.label\")} size=\"sm\">\n <Toolbar.Start>\n <ActionBar.CloseTrigger aria-label={t(\"clear\")}>\n <XIcon size=\"1em\" />\n </ActionBar.CloseTrigger>\n <Text size=\"sm\">{t(\"selection.count\", { count })}</Text>\n </Toolbar.Start>\n <Toolbar.End>\n {ACTIONS.map(({ Icon, name, primary }) => (\n <Toolbar.Action\n icon={<Icon size=\"1em\" />}\n key={name}\n onClick={() => {\n setDone(t(`selection.${name}.done`, { count }));\n }}\n primary={primary}\n priority={primary ? \"primary\" : undefined}\n >\n {t(`selection.${name}.label`)}\n </Toolbar.Action>\n ))}\n </Toolbar.End>\n </Toolbar.Root>\n </ActionBar.Content>\n </ActionBar.Positioner>\n </ActionBar.Root>\n </Stack>\n );\n}\n";
438
+ //#endregion
439
+ //#region src/action-bar/action-bar.specimen.tsx
440
+ /**
441
+ * Catalogue page for the action bar.
442
+ *
443
+ * @remarks
444
+ * `scenesOf` generates the placements from the selection example, whose bar acts on four
445
+ * invoices. The folding scene is hand-written, because it shows the toolbar inside the bar
446
+ * folding its actions in a narrow window, which no axis sets. Every bar renders closed and is
447
+ * fixed to the window while open, so a scene is as tall as its list. The words are keys under
448
+ * `action-bar` in `locales/en/specimen/action-bar.json`.
449
+ */
450
+ /**
451
+ * Hand-written scene for a bar whose toolbar folds its quieter actions in a narrow window.
452
+ */
453
+ const folding = {
454
+ about: "action-bar.photos.about",
455
+ draw: Photos,
456
+ example: photos_example_exports,
457
+ title: "action-bar.photos.title"
458
+ };
459
+ var action_bar_specimen_default = specimen({
460
+ about: "action-bar.about",
461
+ id: "components/screen/action-bar",
462
+ imports: "import { ActionBar, Toolbar } from \"@stealthscale/component-screen\";",
463
+ scenes: [...scenesOf(recipe, {
464
+ draw: (props) => /* @__PURE__ */ jsx(Selection, { ...props }),
465
+ example: selection_example_exports,
466
+ namespace: "action-bar"
467
+ }), folding],
468
+ title: "action-bar.title"
469
+ });
470
+ //#endregion
471
+ export { action_bar_specimen_default as default, folding };
@@ -0,0 +1,3 @@
1
+ export const dropped = {"CloseTriggerProps": {"conditions": 284, "foreign": 1050}, "ContentProps": {"conditions": 284, "foreign": 1040}, "PositionerProps": {"conditions": 284, "foreign": 1041}, "RootProps": {"conditions": 284, "foreign": 1041}};
2
+ export const parts = {"CloseTriggerProps": [{"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": "string", "fallback": "", "kind": "option", "name": "href", "refers": [], "required": false, "says": "The link's target, which renders the control as an `a`."}, {"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": ""}], "ContentProps": [], "PositionerProps": [], "RootProps": [{"accepts": "string", "fallback": "\"Actions available\"", "kind": "option", "name": "announcement", "refers": [], "required": false, "says": "The words that a screen reader announces when the bar opens."}, {"accepts": "boolean", "fallback": "true", "kind": "option", "name": "closeOnEscape", "refers": [], "required": false, "says": "When true, Escape inside the bar asks to close it."}, {"accepts": "boolean", "fallback": "true", "kind": "option", "name": "lazyMount", "refers": [], "required": false, "says": "When true, the overlay renders no content until it first opens."}, {"accepts": "(() => void)", "fallback": "", "kind": "option", "name": "onExitComplete", "refers": [], "required": false, "says": "Runs once the content's exit animation ends."}, {"accepts": "((details: OpenChangeDetails) => void)", "fallback": "", "kind": "option", "name": "onOpenChange", "refers": ["kit.OpenChangeDetails"], "required": false, "says": "Runs when the bar asks to close. The caller closes the bar by clearing the selection."}, {"accepts": "boolean", "fallback": "", "kind": "option", "name": "open", "refers": [], "required": true, "says": "True while the bar is open. A caller sets it while anything is selected."}, {"accepts": "\"bottom\" | \"bottom-end\" | \"bottom-start\"", "fallback": "", "kind": "variant", "name": "placement", "refers": [], "required": false, "says": "Place of the bar along the bottom of the window: at the start, in the middle or at the end."}, {"accepts": "boolean", "fallback": "", "kind": "option", "name": "skipAnimationOnMount", "refers": [], "required": false, "says": "When true, content that is open on mount plays no entry animation."}, {"accepts": "boolean", "fallback": "true", "kind": "option", "name": "unmountOnExit", "refers": [], "required": false, "says": "When true, the overlay removes its content once the exit animation ends."}]};
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": ""}], "kit.OpenChangeDetails": [{"accepts": "boolean", "name": "open", "says": "The open state that the bar asks for. Escape and the close trigger ask for false."}]};