@stealthscale/component-disclosure 0.2.2 → 0.2.4

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 (43) hide show
  1. package/dist/cyclonedx/bom.json +1 -1
  2. package/dist/index.js +1 -5423
  3. package/dist/pages/accordion/accordion.js +512 -0
  4. package/dist/pages/accordion/accordion.props.js +3 -0
  5. package/dist/pages/collapsible/collapsible.js +173 -0
  6. package/dist/pages/collapsible/collapsible.props.js +3 -0
  7. package/dist/pages/details/details.js +281 -0
  8. package/dist/pages/details/details.props.js +3 -0
  9. package/dist/pages/hover-card/hover-card.js +552 -0
  10. package/dist/pages/hover-card/hover-card.props.js +3 -0
  11. package/dist/pages/menu/menu.js +1103 -0
  12. package/dist/pages/menu/menu.props.js +3 -0
  13. package/dist/pages/menubar/menubar.js +1181 -0
  14. package/dist/pages/menubar/menubar.props.js +3 -0
  15. package/dist/pages/pages.json +138 -0
  16. package/dist/pages/popover/popover.js +161 -0
  17. package/dist/pages/popover/popover.props.js +3 -0
  18. package/dist/pages/steps/steps.js +660 -0
  19. package/dist/pages/steps/steps.props.js +3 -0
  20. package/dist/pages/tabs/tabs.js +815 -0
  21. package/dist/pages/tabs/tabs.props.js +3 -0
  22. package/dist/pages/toggle-tip/toggle-tip.js +344 -0
  23. package/dist/pages/toggle-tip/toggle-tip.props.js +3 -0
  24. package/dist/pages/tooltip/tooltip.js +112 -0
  25. package/dist/pages/tooltip/tooltip.props.js +3 -0
  26. package/dist/pages/truncate/truncate.js +235 -0
  27. package/dist/pages/truncate/truncate.props.js +3 -0
  28. package/dist/shared-Cfsikh3X.js +5424 -0
  29. package/dist/theme.js +23 -14
  30. package/locales/en/specimen/accordion.json +130 -0
  31. package/locales/en/specimen/collapsible.json +27 -0
  32. package/locales/en/specimen/details.json +48 -0
  33. package/locales/en/specimen/hover-card.json +58 -0
  34. package/locales/en/specimen/menu.json +81 -0
  35. package/locales/en/specimen/menubar.json +108 -0
  36. package/locales/en/specimen/popover.json +16 -0
  37. package/locales/en/specimen/steps.json +86 -0
  38. package/locales/en/specimen/tabs.json +108 -0
  39. package/locales/en/specimen/toggle-tip.json +47 -0
  40. package/locales/en/specimen/tooltip.json +14 -0
  41. package/locales/en/specimen/truncate.json +31 -0
  42. package/package.json +10 -9
  43. /package/dist/{recipe-95yCB2V3.js → recipes-95yCB2V3.js} +0 -0
@@ -0,0 +1,512 @@
1
+ import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
2
+ import { m as recipe } from "../../recipes-95yCB2V3.js";
3
+ import { Bt as Item, Gt as ItemBody, Ht as ItemIndicator, Ut as ItemHeading, Vt as ItemTrigger, Wt as ItemContent, zt as Root } from "../../shared-Cfsikh3X.js";
4
+ import { c } from "react/compiler-runtime";
5
+ import { useRef, useState } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { Room, scenesOf, specimen, useWords } from "@stealthscale/specimen";
8
+ import { flushSync } from "react-dom";
9
+ import { CheckIcon, ChevronDownIcon, DownloadIcon, FileTextIcon, ScaleIcon, ShieldIcon } from "lucide-react";
10
+ import { Button, IconButton } from "@stealthscale/component-actions";
11
+ import { Stack } from "@stealthscale/component-layout";
12
+ import { Text } from "@stealthscale/component-typography";
13
+ import { Checkbox } from "@stealthscale/component-forms";
14
+ import { Avatar } from "@stealthscale/component-media";
15
+ //#region src/accordion/examples/checkout.example.tsx
16
+ var checkout_example_exports = /* @__PURE__ */ __exportAll({
17
+ Checkout: () => Checkout,
18
+ source: () => source$5
19
+ });
20
+ const STEPS = [
21
+ "shipping",
22
+ "payment",
23
+ "review"
24
+ ];
25
+ function Checkout() {
26
+ const $ = c(10);
27
+ const { t } = useWords("accordion");
28
+ let t0;
29
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
30
+ t0 = ["shipping"];
31
+ $[0] = t0;
32
+ } else t0 = $[0];
33
+ const [open, setOpen] = useState(t0);
34
+ const [reached, setReached] = useState(0);
35
+ const [placed, setPlaced] = useState(false);
36
+ let t1;
37
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
38
+ t1 = {};
39
+ $[1] = t1;
40
+ } else t1 = $[1];
41
+ const triggers = useRef(t1);
42
+ let t2;
43
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
44
+ t2 = (details) => {
45
+ setOpen(details.value);
46
+ };
47
+ $[2] = t2;
48
+ } else t2 = $[2];
49
+ let t3;
50
+ if ($[3] !== placed || $[4] !== reached || $[5] !== t) {
51
+ t3 = STEPS.map((step, at) => /* @__PURE__ */ jsxs(Item, {
52
+ disabled: at > reached,
53
+ value: step,
54
+ children: [/* @__PURE__ */ jsx(ItemHeading, { children: /* @__PURE__ */ jsxs(ItemTrigger, {
55
+ ref: (node) => {
56
+ triggers.current[step] = node;
57
+ },
58
+ children: [t(`checkout.${step}.title`), /* @__PURE__ */ jsx(ItemIndicator, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: "100%" }) })]
59
+ }) }), /* @__PURE__ */ jsx(ItemContent, { children: /* @__PURE__ */ jsx(ItemBody, { children: /* @__PURE__ */ jsxs(Stack, {
60
+ align: "flex-start",
61
+ gap: "md",
62
+ children: [
63
+ /* @__PURE__ */ jsx(Text, { children: t(`checkout.${step}.summary`) }),
64
+ /* @__PURE__ */ jsx(Button, {
65
+ onClick: () => {
66
+ const next = STEPS[at + 1];
67
+ if (next === void 0) {
68
+ setPlaced(true);
69
+ return;
70
+ }
71
+ flushSync(() => {
72
+ setReached(Math.max(reached, at + 1));
73
+ setOpen([next]);
74
+ });
75
+ triggers.current[next]?.focus();
76
+ },
77
+ size: "sm",
78
+ children: t(`checkout.${step}.next`)
79
+ }),
80
+ step === "review" ? /* @__PURE__ */ jsx(Text, {
81
+ as: "output",
82
+ children: placed ? t("checkout.placed") : null
83
+ }) : null
84
+ ]
85
+ }) }) })]
86
+ }, step));
87
+ $[3] = placed;
88
+ $[4] = reached;
89
+ $[5] = t;
90
+ $[6] = t3;
91
+ } else t3 = $[6];
92
+ let t4;
93
+ if ($[7] !== open || $[8] !== t3) {
94
+ t4 = /* @__PURE__ */ jsx(Root, {
95
+ onValueChange: t2,
96
+ value: open,
97
+ variant: "outline",
98
+ children: t3
99
+ });
100
+ $[7] = open;
101
+ $[8] = t3;
102
+ $[9] = t4;
103
+ } else t4 = $[9];
104
+ return t4;
105
+ }
106
+ const source$5 = "import { type ReactElement, useRef, useState } from \"react\";\nimport { flushSync } from \"react-dom\";\n\nimport { ChevronDownIcon } from \"lucide-react\";\n\nimport { Button } from \"@stealthscale/component-actions\";\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { Text } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Accordion } from \"@stealthscale/component-disclosure\";\n\nconst STEPS = [\"shipping\", \"payment\", \"review\"] as const;\n\nexport function Checkout(): ReactElement {\n const { t } = useWords(\"accordion\");\n const [open, setOpen] = useState<string[]>([\"shipping\"]);\n const [reached, setReached] = useState(0);\n const [placed, setPlaced] = useState(false);\n const triggers = useRef<Partial<Record<string, HTMLButtonElement | null>>>({});\n\n return (\n <Accordion.Root\n onValueChange={(details) => {\n setOpen(details.value);\n }}\n value={open}\n variant=\"outline\"\n >\n {STEPS.map((step, at) => (\n <Accordion.Item disabled={at > reached} key={step} value={step}>\n <Accordion.ItemHeading>\n <Accordion.ItemTrigger\n ref={(node) => {\n triggers.current[step] = node;\n }}\n >\n {t(`checkout.${step}.title`)}\n <Accordion.ItemIndicator>\n <ChevronDownIcon size=\"100%\" />\n </Accordion.ItemIndicator>\n </Accordion.ItemTrigger>\n </Accordion.ItemHeading>\n <Accordion.ItemContent>\n <Accordion.ItemBody>\n <Stack align=\"flex-start\" gap=\"md\">\n <Text>{t(`checkout.${step}.summary`)}</Text>\n <Button\n onClick={() => {\n const next = STEPS[at + 1];\n\n if (next === undefined) {\n setPlaced(true);\n return;\n }\n flushSync(() => {\n setReached(Math.max(reached, at + 1));\n setOpen([next]);\n });\n triggers.current[next]?.focus();\n }}\n size=\"sm\"\n >\n {t(`checkout.${step}.next`)}\n </Button>\n {step === \"review\" ? (\n <Text as=\"output\">{placed ? t(\"checkout.placed\") : null}</Text>\n ) : null}\n </Stack>\n </Accordion.ItemBody>\n </Accordion.ItemContent>\n </Accordion.Item>\n ))}\n </Accordion.Root>\n );\n}\n";
107
+ //#endregion
108
+ //#region src/accordion/examples/clauses.example.tsx
109
+ var clauses_example_exports = /* @__PURE__ */ __exportAll({
110
+ Clauses: () => Clauses,
111
+ source: () => source$4
112
+ });
113
+ const CLAUSES = [
114
+ {
115
+ Icon: FileTextIcon,
116
+ value: "scope"
117
+ },
118
+ {
119
+ Icon: ScaleIcon,
120
+ value: "payment"
121
+ },
122
+ {
123
+ Icon: ShieldIcon,
124
+ value: "liability"
125
+ }
126
+ ];
127
+ function Clauses() {
128
+ const $ = c(5);
129
+ const { t } = useWords("accordion");
130
+ let t0;
131
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
132
+ t0 = ["payment"];
133
+ $[0] = t0;
134
+ } else t0 = $[0];
135
+ let t1;
136
+ if ($[1] !== t) {
137
+ t1 = CLAUSES.map((t2) => {
138
+ const { Icon, value } = t2;
139
+ return /* @__PURE__ */ jsxs(Item, {
140
+ value,
141
+ children: [/* @__PURE__ */ jsx(ItemHeading, { children: /* @__PURE__ */ jsxs(ItemTrigger, { children: [
142
+ /* @__PURE__ */ jsx(Icon, {}),
143
+ t(`clauses.${value}.title`),
144
+ /* @__PURE__ */ jsx(ItemIndicator, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: "100%" }) })
145
+ ] }) }), /* @__PURE__ */ jsx(ItemContent, { children: /* @__PURE__ */ jsx(ItemBody, { children: t(`clauses.${value}.body`) }) })]
146
+ }, value);
147
+ });
148
+ $[1] = t;
149
+ $[2] = t1;
150
+ } else t1 = $[2];
151
+ let t2;
152
+ if ($[3] !== t1) {
153
+ t2 = /* @__PURE__ */ jsx(Root, {
154
+ collapsible: true,
155
+ defaultValue: t0,
156
+ variant: "outline",
157
+ children: t1
158
+ });
159
+ $[3] = t1;
160
+ $[4] = t2;
161
+ } else t2 = $[4];
162
+ return t2;
163
+ }
164
+ const source$4 = "import { type ReactElement } from \"react\";\n\nimport { ChevronDownIcon, FileTextIcon, ScaleIcon, ShieldIcon } from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Accordion } from \"@stealthscale/component-disclosure\";\n\nconst CLAUSES = [\n { Icon: FileTextIcon, value: \"scope\" },\n { Icon: ScaleIcon, value: \"payment\" },\n { Icon: ShieldIcon, value: \"liability\" },\n] as const;\n\nexport function Clauses(): ReactElement {\n const { t } = useWords(\"accordion\");\n\n return (\n <Accordion.Root collapsible defaultValue={[\"payment\"]} variant=\"outline\">\n {CLAUSES.map(({ Icon, value }) => (\n <Accordion.Item key={value} value={value}>\n <Accordion.ItemHeading>\n <Accordion.ItemTrigger>\n <Icon />\n {t(`clauses.${value}.title`)}\n <Accordion.ItemIndicator>\n <ChevronDownIcon size=\"100%\" />\n </Accordion.ItemIndicator>\n </Accordion.ItemTrigger>\n </Accordion.ItemHeading>\n <Accordion.ItemContent>\n <Accordion.ItemBody>{t(`clauses.${value}.body`)}</Accordion.ItemBody>\n </Accordion.ItemContent>\n </Accordion.Item>\n ))}\n </Accordion.Root>\n );\n}\n";
165
+ //#endregion
166
+ //#region src/accordion/examples/documents.example.tsx
167
+ var documents_example_exports = /* @__PURE__ */ __exportAll({
168
+ Documents: () => Documents,
169
+ source: () => source$3
170
+ });
171
+ const DOCUMENTS = [
172
+ "contract",
173
+ "invoice",
174
+ "nda"
175
+ ];
176
+ function Documents() {
177
+ const $ = c(5);
178
+ const { t } = useWords("accordion");
179
+ let t0;
180
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
181
+ t0 = ["contract"];
182
+ $[0] = t0;
183
+ } else t0 = $[0];
184
+ let t1;
185
+ if ($[1] !== t) {
186
+ t1 = DOCUMENTS.map((document) => /* @__PURE__ */ jsxs(Item, {
187
+ value: document,
188
+ children: [/* @__PURE__ */ jsxs(ItemHeading, { children: [/* @__PURE__ */ jsxs(ItemTrigger, { children: [t(`documents.${document}.title`), /* @__PURE__ */ jsx(ItemIndicator, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: "100%" }) })] }), /* @__PURE__ */ jsx(IconButton, {
189
+ "aria-label": t("documents.download", { file: t(`documents.${document}.title`) }),
190
+ size: "sm",
191
+ variant: "ghost",
192
+ children: /* @__PURE__ */ jsx(DownloadIcon, {})
193
+ })] }), /* @__PURE__ */ jsx(ItemContent, { children: /* @__PURE__ */ jsx(ItemBody, { children: t(`documents.${document}.body`) }) })]
194
+ }, document));
195
+ $[1] = t;
196
+ $[2] = t1;
197
+ } else t1 = $[2];
198
+ let t2;
199
+ if ($[3] !== t1) {
200
+ t2 = /* @__PURE__ */ jsx(Root, {
201
+ collapsible: true,
202
+ defaultValue: t0,
203
+ variant: "surface",
204
+ children: t1
205
+ });
206
+ $[3] = t1;
207
+ $[4] = t2;
208
+ } else t2 = $[4];
209
+ return t2;
210
+ }
211
+ const source$3 = "import { type ReactElement } from \"react\";\n\nimport { ChevronDownIcon, DownloadIcon } from \"lucide-react\";\n\nimport { IconButton } from \"@stealthscale/component-actions\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Accordion } from \"@stealthscale/component-disclosure\";\n\nconst DOCUMENTS = [\"contract\", \"invoice\", \"nda\"] as const;\n\nexport function Documents(): ReactElement {\n const { t } = useWords(\"accordion\");\n\n return (\n <Accordion.Root collapsible defaultValue={[\"contract\"]} variant=\"surface\">\n {DOCUMENTS.map((document) => (\n <Accordion.Item key={document} value={document}>\n <Accordion.ItemHeading>\n <Accordion.ItemTrigger>\n {t(`documents.${document}.title`)}\n <Accordion.ItemIndicator>\n <ChevronDownIcon size=\"100%\" />\n </Accordion.ItemIndicator>\n </Accordion.ItemTrigger>\n <IconButton\n aria-label={t(\"documents.download\", { file: t(`documents.${document}.title`) })}\n size=\"sm\"\n variant=\"ghost\"\n >\n <DownloadIcon />\n </IconButton>\n </Accordion.ItemHeading>\n <Accordion.ItemContent>\n <Accordion.ItemBody>{t(`documents.${document}.body`)}</Accordion.ItemBody>\n </Accordion.ItemContent>\n </Accordion.Item>\n ))}\n </Accordion.Root>\n );\n}\n";
212
+ //#endregion
213
+ //#region src/accordion/examples/faq.example.tsx
214
+ var faq_example_exports = /* @__PURE__ */ __exportAll({
215
+ Faq: () => Faq,
216
+ source: () => source$2
217
+ });
218
+ const QUESTIONS = [
219
+ "delivery",
220
+ "returns",
221
+ "abroad"
222
+ ];
223
+ function Faq(props) {
224
+ const $ = c(6);
225
+ const { t } = useWords("accordion");
226
+ let t0;
227
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
228
+ t0 = ["delivery"];
229
+ $[0] = t0;
230
+ } else t0 = $[0];
231
+ let t1;
232
+ if ($[1] !== t) {
233
+ t1 = QUESTIONS.map((question) => /* @__PURE__ */ jsxs(Item, {
234
+ value: question,
235
+ children: [/* @__PURE__ */ jsx(ItemHeading, { children: /* @__PURE__ */ jsxs(ItemTrigger, { children: [t(`faq.${question}.question`), /* @__PURE__ */ jsx(ItemIndicator, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: "100%" }) })] }) }), /* @__PURE__ */ jsx(ItemContent, { children: /* @__PURE__ */ jsx(ItemBody, { children: t(`faq.${question}.answer`) }) })]
236
+ }, question));
237
+ $[1] = t;
238
+ $[2] = t1;
239
+ } else t1 = $[2];
240
+ let t2;
241
+ if ($[3] !== props || $[4] !== t1) {
242
+ t2 = /* @__PURE__ */ jsx(Root, {
243
+ collapsible: true,
244
+ defaultValue: t0,
245
+ ...props,
246
+ children: t1
247
+ });
248
+ $[3] = props;
249
+ $[4] = t1;
250
+ $[5] = t2;
251
+ } else t2 = $[5];
252
+ return t2;
253
+ }
254
+ const source$2 = "import { type ReactElement } from \"react\";\n\nimport { ChevronDownIcon } from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Accordion } from \"@stealthscale/component-disclosure\";\n\nconst QUESTIONS = [\"delivery\", \"returns\", \"abroad\"] as const;\n\nexport function Faq(props: Accordion.RootProps): ReactElement {\n const { t } = useWords(\"accordion\");\n\n return (\n <Accordion.Root collapsible defaultValue={[\"delivery\"]} {...props}>\n {QUESTIONS.map((question) => (\n <Accordion.Item key={question} value={question}>\n <Accordion.ItemHeading>\n <Accordion.ItemTrigger>\n {t(`faq.${question}.question`)}\n <Accordion.ItemIndicator>\n <ChevronDownIcon size=\"100%\" />\n </Accordion.ItemIndicator>\n </Accordion.ItemTrigger>\n </Accordion.ItemHeading>\n <Accordion.ItemContent>\n <Accordion.ItemBody>{t(`faq.${question}.answer`)}</Accordion.ItemBody>\n </Accordion.ItemContent>\n </Accordion.Item>\n ))}\n </Accordion.Root>\n );\n}\n";
255
+ //#endregion
256
+ //#region src/accordion/examples/filters.example.tsx
257
+ var filters_example_exports = /* @__PURE__ */ __exportAll({
258
+ Filters: () => Filters,
259
+ source: () => source$1
260
+ });
261
+ const GROUPS = [
262
+ {
263
+ options: [
264
+ "coats",
265
+ "knitwear",
266
+ "shoes"
267
+ ],
268
+ value: "category"
269
+ },
270
+ {
271
+ options: [
272
+ "under50",
273
+ "under100",
274
+ "over100"
275
+ ],
276
+ value: "price"
277
+ },
278
+ {
279
+ options: [
280
+ "black",
281
+ "navy",
282
+ "sand"
283
+ ],
284
+ value: "colour"
285
+ }
286
+ ];
287
+ function Filters() {
288
+ const $ = c(5);
289
+ const { t } = useWords("accordion");
290
+ let t0;
291
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
292
+ t0 = ["category", "price"];
293
+ $[0] = t0;
294
+ } else t0 = $[0];
295
+ let t1;
296
+ if ($[1] !== t) {
297
+ t1 = GROUPS.map((group) => /* @__PURE__ */ jsxs(Item, {
298
+ value: group.value,
299
+ children: [/* @__PURE__ */ jsx(ItemHeading, { children: /* @__PURE__ */ jsxs(ItemTrigger, { children: [t(`filters.${group.value}`), /* @__PURE__ */ jsx(ItemIndicator, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: "100%" }) })] }) }), /* @__PURE__ */ jsx(ItemContent, { children: /* @__PURE__ */ jsx(ItemBody, { children: /* @__PURE__ */ jsx(Stack, {
300
+ gap: "sm",
301
+ children: group.options.map((option) => /* @__PURE__ */ jsxs(Checkbox.Root, {
302
+ size: "sm",
303
+ value: option,
304
+ children: [/* @__PURE__ */ jsx(Checkbox.Control, { children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(CheckIcon, { strokeWidth: 3 }) }) }), /* @__PURE__ */ jsx(Checkbox.Label, { children: t(`filters.${option}`) })]
305
+ }, option))
306
+ }) }) })]
307
+ }, group.value));
308
+ $[1] = t;
309
+ $[2] = t1;
310
+ } else t1 = $[2];
311
+ let t2;
312
+ if ($[3] !== t1) {
313
+ t2 = /* @__PURE__ */ jsx(Root, {
314
+ defaultValue: t0,
315
+ multiple: true,
316
+ size: "sm",
317
+ children: t1
318
+ });
319
+ $[3] = t1;
320
+ $[4] = t2;
321
+ } else t2 = $[4];
322
+ return t2;
323
+ }
324
+ const source$1 = "import { type ReactElement } from \"react\";\n\nimport { CheckIcon, ChevronDownIcon } from \"lucide-react\";\n\nimport { Checkbox } from \"@stealthscale/component-forms\";\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Accordion } from \"@stealthscale/component-disclosure\";\n\nconst GROUPS = [\n { options: [\"coats\", \"knitwear\", \"shoes\"], value: \"category\" },\n { options: [\"under50\", \"under100\", \"over100\"], value: \"price\" },\n { options: [\"black\", \"navy\", \"sand\"], value: \"colour\" },\n] as const;\n\nexport function Filters(): ReactElement {\n const { t } = useWords(\"accordion\");\n\n return (\n <Accordion.Root defaultValue={[\"category\", \"price\"]} multiple size=\"sm\">\n {GROUPS.map((group) => (\n <Accordion.Item key={group.value} value={group.value}>\n <Accordion.ItemHeading>\n <Accordion.ItemTrigger>\n {t(`filters.${group.value}`)}\n <Accordion.ItemIndicator>\n <ChevronDownIcon size=\"100%\" />\n </Accordion.ItemIndicator>\n </Accordion.ItemTrigger>\n </Accordion.ItemHeading>\n <Accordion.ItemContent>\n <Accordion.ItemBody>\n <Stack gap=\"sm\">\n {group.options.map((option) => (\n <Checkbox.Root key={option} size=\"sm\" value={option}>\n <Checkbox.Control>\n <Checkbox.Indicator>\n <CheckIcon strokeWidth={3} />\n </Checkbox.Indicator>\n </Checkbox.Control>\n <Checkbox.Label>{t(`filters.${option}`)}</Checkbox.Label>\n </Checkbox.Root>\n ))}\n </Stack>\n </Accordion.ItemBody>\n </Accordion.ItemContent>\n </Accordion.Item>\n ))}\n </Accordion.Root>\n );\n}\n";
325
+ //#endregion
326
+ //#region src/accordion/examples/reviewers.example.tsx
327
+ var reviewers_example_exports = /* @__PURE__ */ __exportAll({
328
+ Reviewers: () => Reviewers,
329
+ source: () => source
330
+ });
331
+ const REVIEWERS = [
332
+ "ada",
333
+ "tomas",
334
+ "iris"
335
+ ];
336
+ function Reviewers() {
337
+ const $ = c(5);
338
+ const { t } = useWords("accordion");
339
+ let t0;
340
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
341
+ t0 = ["tomas"];
342
+ $[0] = t0;
343
+ } else t0 = $[0];
344
+ let t1;
345
+ if ($[1] !== t) {
346
+ t1 = REVIEWERS.map((reviewer) => /* @__PURE__ */ jsxs(Item, {
347
+ value: reviewer,
348
+ children: [/* @__PURE__ */ jsx(ItemHeading, { children: /* @__PURE__ */ jsxs(ItemTrigger, { children: [
349
+ /* @__PURE__ */ jsx(Avatar.Root, {
350
+ "aria-hidden": true,
351
+ name: t(`reviewers.${reviewer}.name`),
352
+ size: "xs",
353
+ variant: "surface",
354
+ children: /* @__PURE__ */ jsx(Avatar.Fallback, {})
355
+ }),
356
+ /* @__PURE__ */ jsxs(Stack, {
357
+ as: "span",
358
+ gap: "xs",
359
+ children: [t(`reviewers.${reviewer}.name`), /* @__PURE__ */ jsx(Text, {
360
+ as: "span",
361
+ size: "sm",
362
+ tone: "muted",
363
+ weight: "normal",
364
+ children: t(`reviewers.${reviewer}.role`)
365
+ })]
366
+ }),
367
+ /* @__PURE__ */ jsx(ItemIndicator, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: "100%" }) })
368
+ ] }) }), /* @__PURE__ */ jsx(ItemContent, { children: /* @__PURE__ */ jsx(ItemBody, { children: t(`reviewers.${reviewer}.note`) }) })]
369
+ }, reviewer));
370
+ $[1] = t;
371
+ $[2] = t1;
372
+ } else t1 = $[2];
373
+ let t2;
374
+ if ($[3] !== t1) {
375
+ t2 = /* @__PURE__ */ jsx(Root, {
376
+ collapsible: true,
377
+ defaultValue: t0,
378
+ variant: "subtle",
379
+ children: t1
380
+ });
381
+ $[3] = t1;
382
+ $[4] = t2;
383
+ } else t2 = $[4];
384
+ return t2;
385
+ }
386
+ const source = "import { type ReactElement } from \"react\";\n\nimport { ChevronDownIcon } from \"lucide-react\";\n\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { Avatar } from \"@stealthscale/component-media\";\nimport { Text } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Accordion } from \"@stealthscale/component-disclosure\";\n\nconst REVIEWERS = [\"ada\", \"tomas\", \"iris\"] as const;\n\nexport function Reviewers(): ReactElement {\n const { t } = useWords(\"accordion\");\n\n return (\n <Accordion.Root collapsible defaultValue={[\"tomas\"]} variant=\"subtle\">\n {REVIEWERS.map((reviewer) => (\n <Accordion.Item key={reviewer} value={reviewer}>\n <Accordion.ItemHeading>\n <Accordion.ItemTrigger>\n <Avatar.Root\n aria-hidden\n name={t(`reviewers.${reviewer}.name`)}\n size=\"xs\"\n variant=\"surface\"\n >\n <Avatar.Fallback />\n </Avatar.Root>\n <Stack as=\"span\" gap=\"xs\">\n {t(`reviewers.${reviewer}.name`)}\n <Text as=\"span\" size=\"sm\" tone=\"muted\" weight=\"normal\">\n {t(`reviewers.${reviewer}.role`)}\n </Text>\n </Stack>\n <Accordion.ItemIndicator>\n <ChevronDownIcon size=\"100%\" />\n </Accordion.ItemIndicator>\n </Accordion.ItemTrigger>\n </Accordion.ItemHeading>\n <Accordion.ItemContent>\n <Accordion.ItemBody>{t(`reviewers.${reviewer}.note`)}</Accordion.ItemBody>\n </Accordion.ItemContent>\n </Accordion.Item>\n ))}\n </Accordion.Root>\n );\n}\n";
387
+ //#endregion
388
+ //#region src/accordion/accordion.specimen.tsx
389
+ /**
390
+ * Catalogue page for the accordion.
391
+ *
392
+ * @remarks
393
+ * `scenesOf` generates the looks, palettes, sizes and motions from the questions example, which
394
+ * opens its first question, so every scene shows an open item beside closed ones. The palettes
395
+ * use the subtle look, which fills the open item from the palette. The hand-written scenes show a
396
+ * filter panel with several items open, icons, avatars, a controlled checkout, actions beside the
397
+ * triggers and a disabled accordion. Every accordion renders in a room at its real width: the
398
+ * filter panel in a sidebar's, the others in a column's. The words are keys under `accordion` in
399
+ * `locales/en/specimen/accordion.json`.
400
+ */
401
+ /**
402
+ * Props of the disabled scene's accordion.
403
+ */
404
+ const DISABLED = { disabled: true };
405
+ /**
406
+ * Hand-written scene for a filter panel that keeps several items open.
407
+ */
408
+ const multiple = {
409
+ about: "accordion.multiple.about",
410
+ draw: () => /* @__PURE__ */ jsx(Room, {
411
+ size: "xs",
412
+ children: /* @__PURE__ */ jsx(Filters, {})
413
+ }),
414
+ example: filters_example_exports,
415
+ title: "accordion.multiple.title"
416
+ };
417
+ /**
418
+ * Hand-written scene for triggers that start with an icon.
419
+ */
420
+ const icons = {
421
+ about: "accordion.icons.about",
422
+ draw: () => /* @__PURE__ */ jsx(Room, {
423
+ size: "md",
424
+ children: /* @__PURE__ */ jsx(Clauses, {})
425
+ }),
426
+ example: clauses_example_exports,
427
+ title: "accordion.icons.title"
428
+ };
429
+ /**
430
+ * Hand-written scene for triggers with an avatar and a second line.
431
+ */
432
+ const reviewers = {
433
+ about: "accordion.reviewers.about",
434
+ draw: () => /* @__PURE__ */ jsx(Room, {
435
+ size: "md",
436
+ children: /* @__PURE__ */ jsx(Reviewers, {})
437
+ }),
438
+ example: reviewers_example_exports,
439
+ title: "accordion.reviewers.title"
440
+ };
441
+ /**
442
+ * Hand-written scene for a checkout whose caller opens the next section.
443
+ */
444
+ const checkout = {
445
+ about: "accordion.checkout.about",
446
+ draw: () => /* @__PURE__ */ jsx(Room, {
447
+ size: "md",
448
+ children: /* @__PURE__ */ jsx(Checkout, {})
449
+ }),
450
+ example: checkout_example_exports,
451
+ title: "accordion.checkout.title"
452
+ };
453
+ /**
454
+ * Hand-written scene for an action button after each trigger.
455
+ */
456
+ const documents = {
457
+ about: "accordion.documents.about",
458
+ draw: () => /* @__PURE__ */ jsx(Room, {
459
+ size: "md",
460
+ children: /* @__PURE__ */ jsx(Documents, {})
461
+ }),
462
+ example: documents_example_exports,
463
+ title: "accordion.documents.title"
464
+ };
465
+ /**
466
+ * Hand-written scene for a disabled accordion.
467
+ */
468
+ const disabled = {
469
+ about: "accordion.disabled.about",
470
+ draw: () => /* @__PURE__ */ jsx(Room, {
471
+ size: "md",
472
+ children: /* @__PURE__ */ jsx(Faq, { ...DISABLED })
473
+ }),
474
+ example: faq_example_exports,
475
+ props: { disabled: true },
476
+ title: "accordion.disabled.title"
477
+ };
478
+ var accordion_specimen_default = specimen({
479
+ about: "accordion.about",
480
+ id: "components/disclosure/accordion",
481
+ imports: "import { Accordion } from \"@stealthscale/component-disclosure\";",
482
+ scenes: [
483
+ ...scenesOf(recipe, {
484
+ axes: {
485
+ palette: { with: { variant: "subtle" } },
486
+ size: { direction: "column" },
487
+ variant: { direction: "column" }
488
+ },
489
+ draw: (props) => /* @__PURE__ */ jsx(Room, {
490
+ size: "md",
491
+ children: /* @__PURE__ */ jsx(Faq, { ...props })
492
+ }),
493
+ example: faq_example_exports,
494
+ namespace: "accordion",
495
+ order: [
496
+ "variant",
497
+ "palette",
498
+ "size",
499
+ "motion"
500
+ ]
501
+ }),
502
+ multiple,
503
+ icons,
504
+ reviewers,
505
+ checkout,
506
+ documents,
507
+ disabled
508
+ ],
509
+ title: "accordion.title"
510
+ });
511
+ //#endregion
512
+ export { checkout, accordion_specimen_default as default, disabled, documents, icons, multiple, reviewers };
@@ -0,0 +1,3 @@
1
+ export const dropped = {"ItemBodyProps": {"conditions": 284, "foreign": 1041}, "ItemContentProps": {"conditions": 284, "foreign": 1041}, "ItemHeadingProps": {"conditions": 284, "foreign": 1041}, "ItemIndicatorProps": {"conditions": 284, "foreign": 1041}, "ItemTriggerProps": {"conditions": 284, "foreign": 1051}, "ItemProps": {"conditions": 284, "foreign": 1041}, "RootProps": {"conditions": 284, "foreign": 1038}};
2
+ export const parts = {"ItemBodyProps": [], "ItemContentProps": [], "ItemHeadingProps": [], "ItemIndicatorProps": [], "ItemTriggerProps": [], "ItemProps": [{"accepts": "boolean", "fallback": "", "kind": "option", "name": "disabled", "refers": [], "required": false, "says": "Whether the accordion item is disabled."}, {"accepts": "string", "fallback": "", "kind": "option", "name": "value", "refers": [], "required": true, "says": "The value of the accordion item."}], "RootProps": [{"accepts": "boolean", "fallback": "false", "kind": "option", "name": "collapsible", "refers": [], "required": false, "says": "Whether an accordion item can be closed after it has been expanded."}, {"accepts": "string[]", "fallback": "", "kind": "option", "name": "defaultValue", "refers": [], "required": false, "says": "The initial value of the expanded accordion items. Use when you don't need to control the value of the accordion."}, {"accepts": "\"ltr\" | \"rtl\"", "fallback": "\"ltr\"", "kind": "option", "name": "dir", "refers": [], "required": false, "says": "The document's text/writing direction."}, {"accepts": "boolean", "fallback": "", "kind": "option", "name": "disabled", "refers": [], "required": false, "says": "Whether the accordion items are disabled"}, {"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": ["accordion.ElementIds"], "required": false, "says": "The ids of the elements in the accordion. Useful for composition."}, {"accepts": "\"fade\" | \"none\" | \"slide\"", "fallback": "", "kind": "variant", "name": "motion", "refers": [], "required": false, "says": "Animation of the content as it opens and closes."}, {"accepts": "boolean", "fallback": "false", "kind": "option", "name": "multiple", "refers": [], "required": false, "says": "Whether multiple accordion items can be expanded at the same time."}, {"accepts": "((details: FocusChangeDetails) => void)", "fallback": "", "kind": "option", "name": "onFocusChange", "refers": ["accordion.FocusChangeDetails"], "required": false, "says": "The callback fired when the focused accordion item changes."}, {"accepts": "((details: ValueChangeDetails) => void)", "fallback": "", "kind": "option", "name": "onValueChange", "refers": ["accordion.ValueChangeDetails"], "required": false, "says": "The callback fired when the state of expanded/collapsed accordion items changes."}, {"accepts": "\"accent\" | \"error\" | \"info\" | \"neutral\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"", "fallback": "", "kind": "variant", "name": "palette", "refers": [], "required": false, "says": "Palette the looks read, set on the root."}, {"accepts": "\"lg\" | \"md\" | \"sm\"", "fallback": "", "kind": "variant", "name": "size", "refers": [], "required": false, "says": "Size of the trigger on the control scale, the indicator on the icon scale, and the body's padding and text."}, {"accepts": "string[]", "fallback": "", "kind": "option", "name": "value", "refers": [], "required": false, "says": "The controlled value of the expanded accordion items."}, {"accepts": "\"flushed\" | \"outline\" | \"plain\" | \"subtle\" | \"surface\"", "fallback": "", "kind": "variant", "name": "variant", "refers": [], "required": false, "says": "Look of the items and the box around them."}]};
3
+ export const shapes = {"accordion.ElementIds": [{"accepts": "string", "name": "root", "says": ""}, {"accepts": "((value: string) => string)", "name": "item", "says": ""}, {"accepts": "((value: string) => string)", "name": "itemContent", "says": ""}, {"accepts": "((value: string) => string)", "name": "itemTrigger", "says": ""}], "accordion.ValueChangeDetails": [{"accepts": "string[]", "name": "value", "says": ""}], "accordion.FocusChangeDetails": [{"accepts": "string | null", "name": "value", "says": ""}]};