@stealthscale/component-navigation 0.3.0 → 0.3.2

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.
@@ -0,0 +1,789 @@
1
+ import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
2
+ import { C as Item, S as Link, T as Content, _ as Viewport, b as Root, v as ViewportPositioner, w as Indicator, x as List, y as Trigger } from "../../shared-Cz6A-cF-.js";
3
+ import { c } from "react/compiler-runtime";
4
+ import { useState } from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Matrix, Room, Screen, specimen, useWords } from "@stealthscale/specimen";
7
+ import { Span, Strong, Text } from "@stealthscale/component-typography";
8
+ import { BookOpenIcon, ChartColumnIcon, ChevronDownIcon, ChevronRightIcon, CreditCardIcon, ReceiptTextIcon } from "lucide-react";
9
+ import { Container, Grid, Stack } from "@stealthscale/component-layout";
10
+ //#region src/navigation-menu/examples/aligned.example.tsx
11
+ var aligned_example_exports = /* @__PURE__ */ __exportAll({
12
+ Aligned: () => Aligned,
13
+ source: () => source$5
14
+ });
15
+ const SECTIONS$2 = [{
16
+ key: "api",
17
+ links: [
18
+ "payments",
19
+ "refunds",
20
+ "webhooks"
21
+ ]
22
+ }, {
23
+ key: "tools",
24
+ links: [
25
+ "cli",
26
+ "sandbox",
27
+ "logs"
28
+ ]
29
+ }];
30
+ function Aligned(props) {
31
+ const $ = c(14);
32
+ const { t } = useWords("navigation-menu.inline");
33
+ let t0;
34
+ if ($[0] !== t) {
35
+ t0 = t("label");
36
+ $[0] = t;
37
+ $[1] = t0;
38
+ } else t0 = $[1];
39
+ let t1;
40
+ if ($[2] !== t) {
41
+ t1 = SECTIONS$2.map((t2) => {
42
+ const { key, links } = t2;
43
+ return /* @__PURE__ */ jsxs(Item, {
44
+ value: key,
45
+ children: [/* @__PURE__ */ jsxs(Trigger, { children: [t(key), /* @__PURE__ */ jsx(ChevronDownIcon, {})] }), /* @__PURE__ */ jsx(Content, { children: links.map((link) => /* @__PURE__ */ jsx(Link, {
46
+ href: `#${link}`,
47
+ children: t(link)
48
+ }, link)) })]
49
+ }, key);
50
+ });
51
+ $[2] = t;
52
+ $[3] = t1;
53
+ } else t1 = $[3];
54
+ let t2;
55
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
56
+ t2 = /* @__PURE__ */ jsx(Indicator, {});
57
+ $[4] = t2;
58
+ } else t2 = $[4];
59
+ let t3;
60
+ if ($[5] !== t1) {
61
+ t3 = /* @__PURE__ */ jsxs(List, { children: [t1, t2] });
62
+ $[5] = t1;
63
+ $[6] = t3;
64
+ } else t3 = $[6];
65
+ let t4;
66
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
67
+ t4 = /* @__PURE__ */ jsx(Viewport, {});
68
+ $[7] = t4;
69
+ } else t4 = $[7];
70
+ let t5;
71
+ if ($[8] !== props) {
72
+ t5 = /* @__PURE__ */ jsx(ViewportPositioner, {
73
+ ...props,
74
+ children: t4
75
+ });
76
+ $[8] = props;
77
+ $[9] = t5;
78
+ } else t5 = $[9];
79
+ let t6;
80
+ if ($[10] !== t0 || $[11] !== t3 || $[12] !== t5) {
81
+ t6 = /* @__PURE__ */ jsxs(Root, {
82
+ "aria-label": t0,
83
+ children: [t3, t5]
84
+ });
85
+ $[10] = t0;
86
+ $[11] = t3;
87
+ $[12] = t5;
88
+ $[13] = t6;
89
+ } else t6 = $[13];
90
+ return t6;
91
+ }
92
+ const source$5 = "import { type ReactElement } from \"react\";\n\nimport { ChevronDownIcon } from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { NavigationMenu } from \"@stealthscale/component-navigation\";\n\nconst SECTIONS = [\n { key: \"api\", links: [\"payments\", \"refunds\", \"webhooks\"] },\n { key: \"tools\", links: [\"cli\", \"sandbox\", \"logs\"] },\n] as const;\n\nexport function Aligned(props: NavigationMenu.ViewportPositionerProps): ReactElement {\n const { t } = useWords(\"navigation-menu.inline\");\n\n return (\n <NavigationMenu.Root aria-label={t(\"label\")}>\n <NavigationMenu.List>\n {SECTIONS.map(({ key, links }) => (\n <NavigationMenu.Item key={key} value={key}>\n <NavigationMenu.Trigger>\n {t(key)}\n <ChevronDownIcon />\n </NavigationMenu.Trigger>\n <NavigationMenu.Content>\n {links.map((link) => (\n <NavigationMenu.Link href={`#${link}`} key={link}>\n {t(link)}\n </NavigationMenu.Link>\n ))}\n </NavigationMenu.Content>\n </NavigationMenu.Item>\n ))}\n <NavigationMenu.Indicator />\n </NavigationMenu.List>\n <NavigationMenu.ViewportPositioner {...props}>\n <NavigationMenu.Viewport />\n </NavigationMenu.ViewportPositioner>\n </NavigationMenu.Root>\n );\n}\n";
93
+ //#endregion
94
+ //#region src/navigation-menu/examples/click.example.tsx
95
+ var click_example_exports = /* @__PURE__ */ __exportAll({
96
+ Click: () => Click,
97
+ source: () => source$4
98
+ });
99
+ const MENUS = [{
100
+ key: "workspace",
101
+ links: [
102
+ "switch",
103
+ "members",
104
+ "settings"
105
+ ]
106
+ }, {
107
+ key: "help",
108
+ links: [
109
+ "docs",
110
+ "shortcuts",
111
+ "support"
112
+ ]
113
+ }];
114
+ function Click() {
115
+ const $ = c(9);
116
+ const { t } = useWords("navigation-menu.click");
117
+ let t0;
118
+ if ($[0] !== t) {
119
+ t0 = t("label");
120
+ $[0] = t;
121
+ $[1] = t0;
122
+ } else t0 = $[1];
123
+ let t1;
124
+ if ($[2] !== t) {
125
+ t1 = MENUS.map((t2) => {
126
+ const { key, links } = t2;
127
+ return /* @__PURE__ */ jsxs(Item, {
128
+ value: key,
129
+ children: [/* @__PURE__ */ jsxs(Trigger, { children: [t(key), /* @__PURE__ */ jsx(ChevronDownIcon, {})] }), /* @__PURE__ */ jsx(Content, { children: links.map((link) => /* @__PURE__ */ jsx(Link, {
130
+ href: `#${link}`,
131
+ children: t(link)
132
+ }, link)) })]
133
+ }, key);
134
+ });
135
+ $[2] = t;
136
+ $[3] = t1;
137
+ } else t1 = $[3];
138
+ let t2;
139
+ if ($[4] !== t1) {
140
+ t2 = /* @__PURE__ */ jsx(List, { children: t1 });
141
+ $[4] = t1;
142
+ $[5] = t2;
143
+ } else t2 = $[5];
144
+ let t3;
145
+ if ($[6] !== t0 || $[7] !== t2) {
146
+ t3 = /* @__PURE__ */ jsx(Root, {
147
+ "aria-label": t0,
148
+ disableHoverTrigger: true,
149
+ disablePointerLeaveClose: true,
150
+ children: t2
151
+ });
152
+ $[6] = t0;
153
+ $[7] = t2;
154
+ $[8] = t3;
155
+ } else t3 = $[8];
156
+ return t3;
157
+ }
158
+ const source$4 = "import { type ReactElement } from \"react\";\n\nimport { ChevronDownIcon } from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { NavigationMenu } from \"@stealthscale/component-navigation\";\n\nconst MENUS = [\n { key: \"workspace\", links: [\"switch\", \"members\", \"settings\"] },\n { key: \"help\", links: [\"docs\", \"shortcuts\", \"support\"] },\n] as const;\n\nexport function Click(): ReactElement {\n const { t } = useWords(\"navigation-menu.click\");\n\n return (\n <NavigationMenu.Root aria-label={t(\"label\")} disableHoverTrigger disablePointerLeaveClose>\n <NavigationMenu.List>\n {MENUS.map(({ key, links }) => (\n <NavigationMenu.Item key={key} value={key}>\n <NavigationMenu.Trigger>\n {t(key)}\n <ChevronDownIcon />\n </NavigationMenu.Trigger>\n <NavigationMenu.Content>\n {links.map((link) => (\n <NavigationMenu.Link href={`#${link}`} key={link}>\n {t(link)}\n </NavigationMenu.Link>\n ))}\n </NavigationMenu.Content>\n </NavigationMenu.Item>\n ))}\n </NavigationMenu.List>\n </NavigationMenu.Root>\n );\n}\n";
159
+ //#endregion
160
+ //#region src/navigation-menu/examples/controlled.example.tsx
161
+ var controlled_example_exports = /* @__PURE__ */ __exportAll({
162
+ Controlled: () => Controlled,
163
+ source: () => source$3
164
+ });
165
+ const SECTIONS$1 = [{
166
+ key: "api",
167
+ links: [
168
+ "payments",
169
+ "refunds",
170
+ "webhooks"
171
+ ]
172
+ }, {
173
+ key: "tools",
174
+ links: [
175
+ "cli",
176
+ "sandbox",
177
+ "logs"
178
+ ]
179
+ }];
180
+ function Controlled() {
181
+ const $ = c(25);
182
+ const { t } = useWords("navigation-menu");
183
+ const [value, setValue] = useState("");
184
+ const [picked, setPicked] = useState("");
185
+ let t0;
186
+ if ($[0] !== value) {
187
+ t0 = SECTIONS$1.find((section) => section.key === value);
188
+ $[0] = value;
189
+ $[1] = t0;
190
+ } else t0 = $[1];
191
+ const open = t0;
192
+ let t1;
193
+ if ($[2] !== open || $[3] !== t) {
194
+ t1 = open === void 0 ? t("controlled.closed") : t("controlled.open", { item: t(`inline.${open.key}`) });
195
+ $[2] = open;
196
+ $[3] = t;
197
+ $[4] = t1;
198
+ } else t1 = $[4];
199
+ const status = t1;
200
+ let t2;
201
+ if ($[5] !== t) {
202
+ t2 = t("inline.label");
203
+ $[5] = t;
204
+ $[6] = t2;
205
+ } else t2 = $[6];
206
+ let t3;
207
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
208
+ t3 = (details) => {
209
+ setValue(details.value);
210
+ };
211
+ $[7] = t3;
212
+ } else t3 = $[7];
213
+ let t4;
214
+ if ($[8] !== t) {
215
+ t4 = SECTIONS$1.map((t5) => {
216
+ const { key, links } = t5;
217
+ return /* @__PURE__ */ jsxs(Item, {
218
+ value: key,
219
+ children: [/* @__PURE__ */ jsxs(Trigger, { children: [t(`inline.${key}`), /* @__PURE__ */ jsx(ChevronDownIcon, {})] }), /* @__PURE__ */ jsx(Content, { children: links.map((link) => /* @__PURE__ */ jsx(Link, {
220
+ href: `#${link}`,
221
+ onSelect: () => {
222
+ setPicked(t(`inline.${link}`));
223
+ },
224
+ children: t(`inline.${link}`)
225
+ }, link)) })]
226
+ }, key);
227
+ });
228
+ $[8] = t;
229
+ $[9] = t4;
230
+ } else t4 = $[9];
231
+ let t5;
232
+ if ($[10] !== t4) {
233
+ t5 = /* @__PURE__ */ jsx(List, { children: t4 });
234
+ $[10] = t4;
235
+ $[11] = t5;
236
+ } else t5 = $[11];
237
+ let t6;
238
+ if ($[12] !== t2 || $[13] !== t5 || $[14] !== value) {
239
+ t6 = /* @__PURE__ */ jsx(Root, {
240
+ "aria-label": t2,
241
+ onValueChange: t3,
242
+ value,
243
+ children: t5
244
+ });
245
+ $[12] = t2;
246
+ $[13] = t5;
247
+ $[14] = value;
248
+ $[15] = t6;
249
+ } else t6 = $[15];
250
+ let t7;
251
+ if ($[16] !== picked || $[17] !== status || $[18] !== t) {
252
+ t7 = picked === "" ? status : `${status} ${t("controlled.picked", { link: picked })}`;
253
+ $[16] = picked;
254
+ $[17] = status;
255
+ $[18] = t;
256
+ $[19] = t7;
257
+ } else t7 = $[19];
258
+ let t8;
259
+ if ($[20] !== t7) {
260
+ t8 = /* @__PURE__ */ jsx(Text, {
261
+ as: "output",
262
+ children: t7
263
+ });
264
+ $[20] = t7;
265
+ $[21] = t8;
266
+ } else t8 = $[21];
267
+ let t9;
268
+ if ($[22] !== t6 || $[23] !== t8) {
269
+ t9 = /* @__PURE__ */ jsxs(Stack, {
270
+ direction: "row",
271
+ gap: "lg",
272
+ wrap: true,
273
+ children: [t6, t8]
274
+ });
275
+ $[22] = t6;
276
+ $[23] = t8;
277
+ $[24] = t9;
278
+ } else t9 = $[24];
279
+ return t9;
280
+ }
281
+ const source$3 = "import { type ReactElement, useState } from \"react\";\n\nimport { ChevronDownIcon } from \"lucide-react\";\n\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { Text } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { NavigationMenu } from \"@stealthscale/component-navigation\";\n\nconst SECTIONS = [\n { key: \"api\", links: [\"payments\", \"refunds\", \"webhooks\"] },\n { key: \"tools\", links: [\"cli\", \"sandbox\", \"logs\"] },\n] as const;\n\nexport function Controlled(): ReactElement {\n const { t } = useWords(\"navigation-menu\");\n const [value, setValue] = useState(\"\");\n const [picked, setPicked] = useState(\"\");\n const open = SECTIONS.find((section) => section.key === value);\n const status =\n open === undefined\n ? t(\"controlled.closed\")\n : t(\"controlled.open\", { item: t(`inline.${open.key}`) });\n\n return (\n <Stack direction=\"row\" gap=\"lg\" wrap>\n <NavigationMenu.Root\n aria-label={t(\"inline.label\")}\n onValueChange={(details) => {\n setValue(details.value);\n }}\n value={value}\n >\n <NavigationMenu.List>\n {SECTIONS.map(({ key, links }) => (\n <NavigationMenu.Item key={key} value={key}>\n <NavigationMenu.Trigger>\n {t(`inline.${key}`)}\n <ChevronDownIcon />\n </NavigationMenu.Trigger>\n <NavigationMenu.Content>\n {links.map((link) => (\n <NavigationMenu.Link\n href={`#${link}`}\n key={link}\n onSelect={() => {\n setPicked(t(`inline.${link}`));\n }}\n >\n {t(`inline.${link}`)}\n </NavigationMenu.Link>\n ))}\n </NavigationMenu.Content>\n </NavigationMenu.Item>\n ))}\n </NavigationMenu.List>\n </NavigationMenu.Root>\n <Text as=\"output\">\n {picked === \"\" ? status : `${status} ${t(\"controlled.picked\", { link: picked })}`}\n </Text>\n </Stack>\n );\n}\n";
282
+ //#endregion
283
+ //#region src/navigation-menu/examples/header.example.tsx
284
+ var header_example_exports = /* @__PURE__ */ __exportAll({
285
+ Header: () => Header,
286
+ source: () => source$2
287
+ });
288
+ const PRODUCTS = [
289
+ {
290
+ icon: CreditCardIcon,
291
+ key: "payments"
292
+ },
293
+ {
294
+ icon: ReceiptTextIcon,
295
+ key: "invoicing"
296
+ },
297
+ {
298
+ icon: BookOpenIcon,
299
+ key: "ledger"
300
+ },
301
+ {
302
+ icon: ChartColumnIcon,
303
+ key: "reports"
304
+ }
305
+ ];
306
+ const RESOURCES = [
307
+ "guides",
308
+ "reference",
309
+ "changelog"
310
+ ];
311
+ const COMPANY = [
312
+ "story",
313
+ "careers",
314
+ "contact"
315
+ ];
316
+ function panel(value, label, links) {
317
+ return /* @__PURE__ */ jsxs(Item, {
318
+ value,
319
+ children: [/* @__PURE__ */ jsxs(Trigger, { children: [label, /* @__PURE__ */ jsx(ChevronDownIcon, {})] }), /* @__PURE__ */ jsx(Content, { children: links })]
320
+ });
321
+ }
322
+ function Header(props) {
323
+ const $ = c(25);
324
+ const { t } = useWords("navigation-menu.header");
325
+ let t0;
326
+ if ($[0] !== t) {
327
+ t0 = t("label");
328
+ $[0] = t;
329
+ $[1] = t0;
330
+ } else t0 = $[1];
331
+ let t1;
332
+ if ($[2] !== t) {
333
+ const t2 = t("products");
334
+ const t4 = PRODUCTS.map((t3) => {
335
+ const { icon: Icon, key } = t3;
336
+ return /* @__PURE__ */ jsxs(Link, {
337
+ href: `#${key}`,
338
+ children: [
339
+ /* @__PURE__ */ jsx(Icon, {}),
340
+ /* @__PURE__ */ jsx(Strong, {
341
+ weight: "medium",
342
+ children: t(`${key}.title`)
343
+ }),
344
+ /* @__PURE__ */ jsx(Span, {
345
+ tone: "muted",
346
+ children: t(`${key}.about`)
347
+ })
348
+ ]
349
+ }, key);
350
+ });
351
+ let t5;
352
+ if ($[4] !== t4) {
353
+ t5 = /* @__PURE__ */ jsx(Grid.Root, {
354
+ columns: "2",
355
+ gap: "xs",
356
+ children: t4
357
+ });
358
+ $[4] = t4;
359
+ $[5] = t5;
360
+ } else t5 = $[5];
361
+ t1 = panel("products", t2, t5);
362
+ $[2] = t;
363
+ $[3] = t1;
364
+ } else t1 = $[3];
365
+ let t2;
366
+ if ($[6] !== t) {
367
+ t2 = panel("resources", t("resources"), RESOURCES.map((key_0) => /* @__PURE__ */ jsxs(Link, {
368
+ href: `#${key_0}`,
369
+ children: [/* @__PURE__ */ jsx(Strong, {
370
+ weight: "medium",
371
+ children: t(`${key_0}.title`)
372
+ }), /* @__PURE__ */ jsx(Span, {
373
+ tone: "muted",
374
+ children: t(`${key_0}.about`)
375
+ })]
376
+ }, key_0)));
377
+ $[6] = t;
378
+ $[7] = t2;
379
+ } else t2 = $[7];
380
+ let t3;
381
+ if ($[8] !== t) {
382
+ t3 = panel("company", t("company"), COMPANY.map((key_1) => /* @__PURE__ */ jsx(Link, {
383
+ href: `#${key_1}`,
384
+ children: t(key_1)
385
+ }, key_1)));
386
+ $[8] = t;
387
+ $[9] = t3;
388
+ } else t3 = $[9];
389
+ let t4;
390
+ if ($[10] !== t) {
391
+ t4 = t("pricing");
392
+ $[10] = t;
393
+ $[11] = t4;
394
+ } else t4 = $[11];
395
+ let t5;
396
+ if ($[12] !== t4) {
397
+ t5 = /* @__PURE__ */ jsx(Item, {
398
+ value: "pricing",
399
+ children: /* @__PURE__ */ jsx(Link, {
400
+ current: true,
401
+ href: "#pricing",
402
+ children: t4
403
+ })
404
+ });
405
+ $[12] = t4;
406
+ $[13] = t5;
407
+ } else t5 = $[13];
408
+ let t6;
409
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
410
+ t6 = /* @__PURE__ */ jsx(Indicator, {});
411
+ $[14] = t6;
412
+ } else t6 = $[14];
413
+ let t7;
414
+ if ($[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t5) {
415
+ t7 = /* @__PURE__ */ jsxs(List, { children: [
416
+ t1,
417
+ t2,
418
+ t3,
419
+ t5,
420
+ t6
421
+ ] });
422
+ $[15] = t1;
423
+ $[16] = t2;
424
+ $[17] = t3;
425
+ $[18] = t5;
426
+ $[19] = t7;
427
+ } else t7 = $[19];
428
+ let t8;
429
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
430
+ t8 = /* @__PURE__ */ jsx(ViewportPositioner, {
431
+ align: "start",
432
+ children: /* @__PURE__ */ jsx(Viewport, {})
433
+ });
434
+ $[20] = t8;
435
+ } else t8 = $[20];
436
+ let t9;
437
+ if ($[21] !== props || $[22] !== t0 || $[23] !== t7) {
438
+ t9 = /* @__PURE__ */ jsxs(Root, {
439
+ "aria-label": t0,
440
+ ...props,
441
+ children: [t7, t8]
442
+ });
443
+ $[21] = props;
444
+ $[22] = t0;
445
+ $[23] = t7;
446
+ $[24] = t9;
447
+ } else t9 = $[24];
448
+ return t9;
449
+ }
450
+ const source$2 = "import { type ReactElement, type ReactNode } from \"react\";\n\nimport {\n BookOpenIcon,\n ChartColumnIcon,\n ChevronDownIcon,\n CreditCardIcon,\n ReceiptTextIcon,\n} from \"lucide-react\";\n\nimport { Grid } from \"@stealthscale/component-layout\";\nimport { Span, Strong } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { NavigationMenu } from \"@stealthscale/component-navigation\";\n\nconst PRODUCTS = [\n { icon: CreditCardIcon, key: \"payments\" },\n { icon: ReceiptTextIcon, key: \"invoicing\" },\n { icon: BookOpenIcon, key: \"ledger\" },\n { icon: ChartColumnIcon, key: \"reports\" },\n] as const;\n\nconst RESOURCES = [\"guides\", \"reference\", \"changelog\"] as const;\n\nconst COMPANY = [\"story\", \"careers\", \"contact\"] as const;\n\nfunction panel(value: string, label: string, links: ReactNode): ReactElement {\n return (\n <NavigationMenu.Item value={value}>\n <NavigationMenu.Trigger>\n {label}\n <ChevronDownIcon />\n </NavigationMenu.Trigger>\n <NavigationMenu.Content>{links}</NavigationMenu.Content>\n </NavigationMenu.Item>\n );\n}\n\nexport function Header(props: NavigationMenu.RootProps): ReactElement {\n const { t } = useWords(\"navigation-menu.header\");\n\n return (\n <NavigationMenu.Root aria-label={t(\"label\")} {...props}>\n <NavigationMenu.List>\n {panel(\n \"products\",\n t(\"products\"),\n <Grid.Root columns=\"2\" gap=\"xs\">\n {PRODUCTS.map(({ icon: Icon, key }) => (\n <NavigationMenu.Link href={`#${key}`} key={key}>\n <Icon />\n <Strong weight=\"medium\">{t(`${key}.title`)}</Strong>\n <Span tone=\"muted\">{t(`${key}.about`)}</Span>\n </NavigationMenu.Link>\n ))}\n </Grid.Root>,\n )}\n {panel(\n \"resources\",\n t(\"resources\"),\n RESOURCES.map((key) => (\n <NavigationMenu.Link href={`#${key}`} key={key}>\n <Strong weight=\"medium\">{t(`${key}.title`)}</Strong>\n <Span tone=\"muted\">{t(`${key}.about`)}</Span>\n </NavigationMenu.Link>\n )),\n )}\n {panel(\n \"company\",\n t(\"company\"),\n COMPANY.map((key) => (\n <NavigationMenu.Link href={`#${key}`} key={key}>\n {t(key)}\n </NavigationMenu.Link>\n )),\n )}\n <NavigationMenu.Item value=\"pricing\">\n <NavigationMenu.Link current href=\"#pricing\">\n {t(\"pricing\")}\n </NavigationMenu.Link>\n </NavigationMenu.Item>\n <NavigationMenu.Indicator />\n </NavigationMenu.List>\n <NavigationMenu.ViewportPositioner align=\"start\">\n <NavigationMenu.Viewport />\n </NavigationMenu.ViewportPositioner>\n </NavigationMenu.Root>\n );\n}\n";
451
+ //#endregion
452
+ //#region src/navigation-menu/examples/inline.example.tsx
453
+ var inline_example_exports = /* @__PURE__ */ __exportAll({
454
+ Inline: () => Inline,
455
+ source: () => source$1
456
+ });
457
+ const SECTIONS = [{
458
+ key: "api",
459
+ links: [
460
+ "payments",
461
+ "refunds",
462
+ "webhooks"
463
+ ]
464
+ }, {
465
+ key: "tools",
466
+ links: [
467
+ "cli",
468
+ "sandbox",
469
+ "logs"
470
+ ]
471
+ }];
472
+ function Inline(props) {
473
+ const $ = c(16);
474
+ const { t } = useWords("navigation-menu.inline");
475
+ let t0;
476
+ if ($[0] !== t) {
477
+ t0 = t("label");
478
+ $[0] = t;
479
+ $[1] = t0;
480
+ } else t0 = $[1];
481
+ let t1;
482
+ if ($[2] !== t) {
483
+ t1 = SECTIONS.map((t2) => {
484
+ const { key, links } = t2;
485
+ return /* @__PURE__ */ jsxs(Item, {
486
+ value: key,
487
+ children: [/* @__PURE__ */ jsxs(Trigger, { children: [t(key), /* @__PURE__ */ jsx(ChevronDownIcon, {})] }), /* @__PURE__ */ jsx(Content, { children: links.map((link) => /* @__PURE__ */ jsx(Link, {
488
+ href: `#${link}`,
489
+ children: t(link)
490
+ }, link)) })]
491
+ }, key);
492
+ });
493
+ $[2] = t;
494
+ $[3] = t1;
495
+ } else t1 = $[3];
496
+ let t2;
497
+ if ($[4] !== t) {
498
+ t2 = t("changelog");
499
+ $[4] = t;
500
+ $[5] = t2;
501
+ } else t2 = $[5];
502
+ let t3;
503
+ if ($[6] !== t2) {
504
+ t3 = /* @__PURE__ */ jsx(Item, {
505
+ value: "changelog",
506
+ children: /* @__PURE__ */ jsx(Link, {
507
+ current: true,
508
+ href: "#changelog",
509
+ children: t2
510
+ })
511
+ });
512
+ $[6] = t2;
513
+ $[7] = t3;
514
+ } else t3 = $[7];
515
+ let t4;
516
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
517
+ t4 = /* @__PURE__ */ jsx(Indicator, {});
518
+ $[8] = t4;
519
+ } else t4 = $[8];
520
+ let t5;
521
+ if ($[9] !== t1 || $[10] !== t3) {
522
+ t5 = /* @__PURE__ */ jsxs(List, { children: [
523
+ t1,
524
+ t3,
525
+ t4
526
+ ] });
527
+ $[9] = t1;
528
+ $[10] = t3;
529
+ $[11] = t5;
530
+ } else t5 = $[11];
531
+ let t6;
532
+ if ($[12] !== props || $[13] !== t0 || $[14] !== t5) {
533
+ t6 = /* @__PURE__ */ jsx(Root, {
534
+ "aria-label": t0,
535
+ ...props,
536
+ children: t5
537
+ });
538
+ $[12] = props;
539
+ $[13] = t0;
540
+ $[14] = t5;
541
+ $[15] = t6;
542
+ } else t6 = $[15];
543
+ return t6;
544
+ }
545
+ const source$1 = "import { type ReactElement } from \"react\";\n\nimport { ChevronDownIcon } from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { NavigationMenu } from \"@stealthscale/component-navigation\";\n\nconst SECTIONS = [\n { key: \"api\", links: [\"payments\", \"refunds\", \"webhooks\"] },\n { key: \"tools\", links: [\"cli\", \"sandbox\", \"logs\"] },\n] as const;\n\nexport function Inline(props: NavigationMenu.RootProps): ReactElement {\n const { t } = useWords(\"navigation-menu.inline\");\n\n return (\n <NavigationMenu.Root aria-label={t(\"label\")} {...props}>\n <NavigationMenu.List>\n {SECTIONS.map(({ key, links }) => (\n <NavigationMenu.Item key={key} value={key}>\n <NavigationMenu.Trigger>\n {t(key)}\n <ChevronDownIcon />\n </NavigationMenu.Trigger>\n <NavigationMenu.Content>\n {links.map((link) => (\n <NavigationMenu.Link href={`#${link}`} key={link}>\n {t(link)}\n </NavigationMenu.Link>\n ))}\n </NavigationMenu.Content>\n </NavigationMenu.Item>\n ))}\n <NavigationMenu.Item value=\"changelog\">\n <NavigationMenu.Link current href=\"#changelog\">\n {t(\"changelog\")}\n </NavigationMenu.Link>\n </NavigationMenu.Item>\n <NavigationMenu.Indicator />\n </NavigationMenu.List>\n </NavigationMenu.Root>\n );\n}\n";
546
+ //#endregion
547
+ //#region src/navigation-menu/examples/sidebar.example.tsx
548
+ var sidebar_example_exports = /* @__PURE__ */ __exportAll({
549
+ Sidebar: () => Sidebar,
550
+ source: () => source
551
+ });
552
+ const GROUPS = [{
553
+ key: "billing",
554
+ links: [
555
+ "invoices",
556
+ "subscriptions",
557
+ "tax"
558
+ ]
559
+ }, {
560
+ key: "settings",
561
+ links: [
562
+ "team",
563
+ "security",
564
+ "keys"
565
+ ]
566
+ }];
567
+ function Sidebar() {
568
+ const $ = c(14);
569
+ const { t } = useWords("navigation-menu.sidebar");
570
+ let t0;
571
+ if ($[0] !== t) {
572
+ t0 = t("label");
573
+ $[0] = t;
574
+ $[1] = t0;
575
+ } else t0 = $[1];
576
+ let t1;
577
+ if ($[2] !== t) {
578
+ t1 = t("dashboard");
579
+ $[2] = t;
580
+ $[3] = t1;
581
+ } else t1 = $[3];
582
+ let t2;
583
+ if ($[4] !== t1) {
584
+ t2 = /* @__PURE__ */ jsx(Item, {
585
+ value: "dashboard",
586
+ children: /* @__PURE__ */ jsx(Link, {
587
+ current: true,
588
+ href: "#dashboard",
589
+ children: t1
590
+ })
591
+ });
592
+ $[4] = t1;
593
+ $[5] = t2;
594
+ } else t2 = $[5];
595
+ let t3;
596
+ if ($[6] !== t) {
597
+ t3 = GROUPS.map((t4) => {
598
+ const { key, links } = t4;
599
+ return /* @__PURE__ */ jsxs(Item, {
600
+ value: key,
601
+ children: [/* @__PURE__ */ jsxs(Trigger, { children: [t(key), /* @__PURE__ */ jsx(ChevronRightIcon, {})] }), /* @__PURE__ */ jsx(Content, { children: links.map((link) => /* @__PURE__ */ jsx(Link, {
602
+ href: `#${link}`,
603
+ children: t(link)
604
+ }, link)) })]
605
+ }, key);
606
+ });
607
+ $[6] = t;
608
+ $[7] = t3;
609
+ } else t3 = $[7];
610
+ let t4;
611
+ if ($[8] !== t2 || $[9] !== t3) {
612
+ t4 = /* @__PURE__ */ jsxs(List, { children: [t2, t3] });
613
+ $[8] = t2;
614
+ $[9] = t3;
615
+ $[10] = t4;
616
+ } else t4 = $[10];
617
+ let t5;
618
+ if ($[11] !== t0 || $[12] !== t4) {
619
+ t5 = /* @__PURE__ */ jsx(Root, {
620
+ "aria-label": t0,
621
+ orientation: "vertical",
622
+ children: t4
623
+ });
624
+ $[11] = t0;
625
+ $[12] = t4;
626
+ $[13] = t5;
627
+ } else t5 = $[13];
628
+ return t5;
629
+ }
630
+ const source = "import { type ReactElement } from \"react\";\n\nimport { ChevronRightIcon } from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { NavigationMenu } from \"@stealthscale/component-navigation\";\n\nconst GROUPS = [\n { key: \"billing\", links: [\"invoices\", \"subscriptions\", \"tax\"] },\n { key: \"settings\", links: [\"team\", \"security\", \"keys\"] },\n] as const;\n\nexport function Sidebar(): ReactElement {\n const { t } = useWords(\"navigation-menu.sidebar\");\n\n return (\n <NavigationMenu.Root aria-label={t(\"label\")} orientation=\"vertical\">\n <NavigationMenu.List>\n <NavigationMenu.Item value=\"dashboard\">\n <NavigationMenu.Link current href=\"#dashboard\">\n {t(\"dashboard\")}\n </NavigationMenu.Link>\n </NavigationMenu.Item>\n {GROUPS.map(({ key, links }) => (\n <NavigationMenu.Item key={key} value={key}>\n <NavigationMenu.Trigger>\n {t(key)}\n <ChevronRightIcon />\n </NavigationMenu.Trigger>\n <NavigationMenu.Content>\n {links.map((link) => (\n <NavigationMenu.Link href={`#${link}`} key={link}>\n {t(link)}\n </NavigationMenu.Link>\n ))}\n </NavigationMenu.Content>\n </NavigationMenu.Item>\n ))}\n </NavigationMenu.List>\n </NavigationMenu.Root>\n );\n}\n";
631
+ //#endregion
632
+ //#region src/navigation-menu/navigation-menu.specimen.tsx
633
+ /**
634
+ * Alignments of the alignment scene, in reading order.
635
+ */
636
+ const ALIGNS = [
637
+ "start",
638
+ "center",
639
+ "end"
640
+ ];
641
+ /**
642
+ * Palettes of the palette scene.
643
+ */
644
+ const PALETTES = [
645
+ "primary",
646
+ "accent",
647
+ "neutral",
648
+ "success"
649
+ ];
650
+ /**
651
+ * Sizes of the size scene.
652
+ */
653
+ const SIZES = [
654
+ "sm",
655
+ "md",
656
+ "lg"
657
+ ];
658
+ /**
659
+ * Renders a menu inside the page's gutter at the top of a site's window.
660
+ *
661
+ * @param size - The window's height.
662
+ * @param menu - The menu.
663
+ * @returns The window.
664
+ */
665
+ function windowed(size, menu) {
666
+ return /* @__PURE__ */ jsx(Screen, {
667
+ size,
668
+ children: /* @__PURE__ */ jsx(Container, {
669
+ size: "full",
670
+ children: menu
671
+ })
672
+ });
673
+ }
674
+ /**
675
+ * Hand-written scene for a site header with a shared viewport and an indicator.
676
+ */
677
+ const header = {
678
+ about: "navigation-menu.header.about",
679
+ draw: () => windowed("sm", /* @__PURE__ */ jsx(Header, {})),
680
+ example: header_example_exports,
681
+ title: "navigation-menu.header.title"
682
+ };
683
+ /**
684
+ * Hand-written scene for every size of the site header.
685
+ */
686
+ const size = {
687
+ about: "navigation-menu.size.about",
688
+ axes: ["size"],
689
+ draw: () => /* @__PURE__ */ jsx(Matrix, {
690
+ direction: "column",
691
+ knob: "size",
692
+ of: SIZES,
693
+ children: (each) => windowed("md", /* @__PURE__ */ jsx(Header, { size: each }))
694
+ }),
695
+ example: header_example_exports,
696
+ props: { size: "sm" },
697
+ title: "navigation-menu.size.title"
698
+ };
699
+ /**
700
+ * Hand-written scene for the indicator and a current link in several palettes.
701
+ */
702
+ const palette = {
703
+ about: "navigation-menu.palette.about",
704
+ axes: ["palette"],
705
+ draw: () => /* @__PURE__ */ jsx(Matrix, {
706
+ direction: "column",
707
+ knob: "palette",
708
+ of: PALETTES,
709
+ children: (each) => windowed("xs", /* @__PURE__ */ jsx(Inline, { palette: each }))
710
+ }),
711
+ example: inline_example_exports,
712
+ props: { palette: "primary" },
713
+ title: "navigation-menu.palette.title"
714
+ };
715
+ /**
716
+ * Hand-written scene for panels that open under their own triggers.
717
+ */
718
+ const inline = {
719
+ about: "navigation-menu.inline.about",
720
+ draw: () => windowed("xs", /* @__PURE__ */ jsx(Inline, {})),
721
+ example: inline_example_exports,
722
+ title: "navigation-menu.inline.title"
723
+ };
724
+ /**
725
+ * Hand-written scene for a vertical menu at a sidebar's width.
726
+ */
727
+ const sidebar = {
728
+ about: "navigation-menu.sidebar.about",
729
+ draw: () => /* @__PURE__ */ jsx(Screen, {
730
+ size: "xs",
731
+ children: /* @__PURE__ */ jsx(Room, {
732
+ size: "xs",
733
+ children: /* @__PURE__ */ jsx(Sidebar, {})
734
+ })
735
+ }),
736
+ example: sidebar_example_exports,
737
+ title: "navigation-menu.sidebar.title"
738
+ };
739
+ /**
740
+ * Hand-written scene for a menu whose panels open only on a press.
741
+ */
742
+ const click = {
743
+ about: "navigation-menu.click.about",
744
+ draw: () => windowed("xs", /* @__PURE__ */ jsx(Click, {})),
745
+ example: click_example_exports,
746
+ title: "navigation-menu.click.title"
747
+ };
748
+ /**
749
+ * Hand-written scene for a menu whose open item the caller keeps.
750
+ */
751
+ const controlled = {
752
+ about: "navigation-menu.controlled.about",
753
+ draw: () => windowed("xs", /* @__PURE__ */ jsx(Controlled, {})),
754
+ example: controlled_example_exports,
755
+ title: "navigation-menu.controlled.title"
756
+ };
757
+ /**
758
+ * Hand-written scene for every alignment of the viewport against the open trigger.
759
+ */
760
+ const aligned = {
761
+ about: "navigation-menu.aligned.about",
762
+ draw: () => /* @__PURE__ */ jsx(Matrix, {
763
+ direction: "column",
764
+ knob: "align",
765
+ of: ALIGNS,
766
+ children: (align) => windowed("xs", /* @__PURE__ */ jsx(Aligned, { align }))
767
+ }),
768
+ example: aligned_example_exports,
769
+ props: { align: "start" },
770
+ title: "navigation-menu.aligned.title"
771
+ };
772
+ var navigation_menu_specimen_default = specimen({
773
+ about: "navigation-menu.about",
774
+ id: "components/navigation/navigation-menu",
775
+ imports: "import { NavigationMenu } from \"@stealthscale/component-navigation\";",
776
+ scenes: [
777
+ header,
778
+ size,
779
+ palette,
780
+ inline,
781
+ sidebar,
782
+ click,
783
+ controlled,
784
+ aligned
785
+ ],
786
+ title: "navigation-menu.title"
787
+ });
788
+ //#endregion
789
+ export { aligned, click, controlled, navigation_menu_specimen_default as default, header, inline, palette, sidebar, size };