@stealthscale/component-disclosure 0.2.3 → 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.
- package/dist/cyclonedx/bom.json +1 -1
- package/dist/index.js +1 -5423
- package/dist/pages/accordion/accordion.js +512 -0
- package/dist/pages/accordion/accordion.props.js +3 -0
- package/dist/pages/collapsible/collapsible.js +173 -0
- package/dist/pages/collapsible/collapsible.props.js +3 -0
- package/dist/pages/details/details.js +281 -0
- package/dist/pages/details/details.props.js +3 -0
- package/dist/pages/hover-card/hover-card.js +552 -0
- package/dist/pages/hover-card/hover-card.props.js +3 -0
- package/dist/pages/menu/menu.js +1103 -0
- package/dist/pages/menu/menu.props.js +3 -0
- package/dist/pages/menubar/menubar.js +1181 -0
- package/dist/pages/menubar/menubar.props.js +3 -0
- package/dist/pages/pages.json +138 -0
- package/dist/pages/popover/popover.js +161 -0
- package/dist/pages/popover/popover.props.js +3 -0
- package/dist/pages/steps/steps.js +660 -0
- package/dist/pages/steps/steps.props.js +3 -0
- package/dist/pages/tabs/tabs.js +815 -0
- package/dist/pages/tabs/tabs.props.js +3 -0
- package/dist/pages/toggle-tip/toggle-tip.js +344 -0
- package/dist/pages/toggle-tip/toggle-tip.props.js +3 -0
- package/dist/pages/tooltip/tooltip.js +112 -0
- package/dist/pages/tooltip/tooltip.props.js +3 -0
- package/dist/pages/truncate/truncate.js +235 -0
- package/dist/pages/truncate/truncate.props.js +3 -0
- package/dist/shared-Cfsikh3X.js +5424 -0
- package/dist/theme.js +1 -1
- package/locales/en/specimen/accordion.json +130 -0
- package/locales/en/specimen/collapsible.json +27 -0
- package/locales/en/specimen/details.json +48 -0
- package/locales/en/specimen/hover-card.json +58 -0
- package/locales/en/specimen/menu.json +81 -0
- package/locales/en/specimen/menubar.json +108 -0
- package/locales/en/specimen/popover.json +16 -0
- package/locales/en/specimen/steps.json +86 -0
- package/locales/en/specimen/tabs.json +108 -0
- package/locales/en/specimen/toggle-tip.json +47 -0
- package/locales/en/specimen/tooltip.json +14 -0
- package/locales/en/specimen/truncate.json +31 -0
- package/package.json +9 -8
- /package/dist/{recipe-95yCB2V3.js → recipes-95yCB2V3.js} +0 -0
|
@@ -0,0 +1,1181 @@
|
|
|
1
|
+
import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { s as recipe } from "../../recipes-95yCB2V3.js";
|
|
3
|
+
import { $ as Content, Q as Menu, X as Trigger, Z as Root, at as Positioner, ct as ItemText, dt as ItemIndicator, gt as Indicator, ht as ItemCommand, it as Root$1, nt as TriggerItem, ot as OptionItem, rt as Separator, st as Item, vt as Content$1 } from "../../shared-Cfsikh3X.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Portal } from "@stealthscale/component-primitives";
|
|
8
|
+
import { Room, scenesOf, specimen, useWords } from "@stealthscale/specimen";
|
|
9
|
+
import { ArchiveIcon, ArrowLeftIcon, CheckIcon, ChevronRightIcon, CopyIcon, FolderInputIcon, FolderPlusIcon, MenuIcon, PencilIcon, Trash2Icon } from "lucide-react";
|
|
10
|
+
import { Button } from "@stealthscale/component-actions";
|
|
11
|
+
import { Stack } from "@stealthscale/component-layout";
|
|
12
|
+
import { Text } from "@stealthscale/component-typography";
|
|
13
|
+
//#region src/menubar/examples/controlled.example.tsx
|
|
14
|
+
var controlled_example_exports = /* @__PURE__ */ __exportAll({
|
|
15
|
+
Controlled: () => Controlled,
|
|
16
|
+
source: () => source$6
|
|
17
|
+
});
|
|
18
|
+
const MENUS$3 = [
|
|
19
|
+
["file", [
|
|
20
|
+
"new",
|
|
21
|
+
"open",
|
|
22
|
+
"save"
|
|
23
|
+
]],
|
|
24
|
+
["edit", ["undo", "redo"]],
|
|
25
|
+
["view", ["zoomIn", "zoomOut"]]
|
|
26
|
+
];
|
|
27
|
+
function Controlled() {
|
|
28
|
+
const $ = c(30);
|
|
29
|
+
const { t } = useWords("menubar");
|
|
30
|
+
const [value, setValue] = useState("");
|
|
31
|
+
let T0;
|
|
32
|
+
let T1;
|
|
33
|
+
let t0;
|
|
34
|
+
let t1;
|
|
35
|
+
let t2;
|
|
36
|
+
let t3;
|
|
37
|
+
let t4;
|
|
38
|
+
if ($[0] !== t || $[1] !== value) {
|
|
39
|
+
let t5;
|
|
40
|
+
if ($[9] !== value) {
|
|
41
|
+
t5 = (t6) => {
|
|
42
|
+
const [menu] = t6;
|
|
43
|
+
return menu === value;
|
|
44
|
+
};
|
|
45
|
+
$[9] = value;
|
|
46
|
+
$[10] = t5;
|
|
47
|
+
} else t5 = $[10];
|
|
48
|
+
const open = MENUS$3.find(t5);
|
|
49
|
+
T1 = Stack;
|
|
50
|
+
t2 = "flex-start";
|
|
51
|
+
t3 = "md";
|
|
52
|
+
let t6;
|
|
53
|
+
if ($[11] !== t) {
|
|
54
|
+
t6 = t("label");
|
|
55
|
+
$[11] = t;
|
|
56
|
+
$[12] = t6;
|
|
57
|
+
} else t6 = $[12];
|
|
58
|
+
let t7;
|
|
59
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
60
|
+
t7 = (details) => {
|
|
61
|
+
setValue(details.value);
|
|
62
|
+
};
|
|
63
|
+
$[13] = t7;
|
|
64
|
+
} else t7 = $[13];
|
|
65
|
+
let t8;
|
|
66
|
+
if ($[14] !== t) {
|
|
67
|
+
t8 = MENUS$3.map((t9) => {
|
|
68
|
+
const [menu_0, rows] = t9;
|
|
69
|
+
return /* @__PURE__ */ jsxs(Menu, {
|
|
70
|
+
value: menu_0,
|
|
71
|
+
children: [/* @__PURE__ */ jsx(Trigger, { children: t(menu_0) }), /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, { children: rows.map((row) => /* @__PURE__ */ jsx(Item, {
|
|
72
|
+
value: row,
|
|
73
|
+
children: t(row)
|
|
74
|
+
}, row)) }) })]
|
|
75
|
+
}, menu_0);
|
|
76
|
+
});
|
|
77
|
+
$[14] = t;
|
|
78
|
+
$[15] = t8;
|
|
79
|
+
} else t8 = $[15];
|
|
80
|
+
if ($[16] !== t6 || $[17] !== t8 || $[18] !== value) {
|
|
81
|
+
t4 = /* @__PURE__ */ jsx(Root, {
|
|
82
|
+
"aria-label": t6,
|
|
83
|
+
onValueChange: t7,
|
|
84
|
+
value,
|
|
85
|
+
children: t8
|
|
86
|
+
});
|
|
87
|
+
$[16] = t6;
|
|
88
|
+
$[17] = t8;
|
|
89
|
+
$[18] = value;
|
|
90
|
+
$[19] = t4;
|
|
91
|
+
} else t4 = $[19];
|
|
92
|
+
T0 = Text;
|
|
93
|
+
t0 = "output";
|
|
94
|
+
t1 = open === void 0 ? t("closed") : t("opened", { menu: t(open[0]) });
|
|
95
|
+
$[0] = t;
|
|
96
|
+
$[1] = value;
|
|
97
|
+
$[2] = T0;
|
|
98
|
+
$[3] = T1;
|
|
99
|
+
$[4] = t0;
|
|
100
|
+
$[5] = t1;
|
|
101
|
+
$[6] = t2;
|
|
102
|
+
$[7] = t3;
|
|
103
|
+
$[8] = t4;
|
|
104
|
+
} else {
|
|
105
|
+
T0 = $[2];
|
|
106
|
+
T1 = $[3];
|
|
107
|
+
t0 = $[4];
|
|
108
|
+
t1 = $[5];
|
|
109
|
+
t2 = $[6];
|
|
110
|
+
t3 = $[7];
|
|
111
|
+
t4 = $[8];
|
|
112
|
+
}
|
|
113
|
+
let t5;
|
|
114
|
+
if ($[20] !== T0 || $[21] !== t0 || $[22] !== t1) {
|
|
115
|
+
t5 = /* @__PURE__ */ jsx(T0, {
|
|
116
|
+
as: t0,
|
|
117
|
+
children: t1
|
|
118
|
+
});
|
|
119
|
+
$[20] = T0;
|
|
120
|
+
$[21] = t0;
|
|
121
|
+
$[22] = t1;
|
|
122
|
+
$[23] = t5;
|
|
123
|
+
} else t5 = $[23];
|
|
124
|
+
let t6;
|
|
125
|
+
if ($[24] !== T1 || $[25] !== t2 || $[26] !== t3 || $[27] !== t4 || $[28] !== t5) {
|
|
126
|
+
t6 = /* @__PURE__ */ jsxs(T1, {
|
|
127
|
+
align: t2,
|
|
128
|
+
gap: t3,
|
|
129
|
+
children: [t4, t5]
|
|
130
|
+
});
|
|
131
|
+
$[24] = T1;
|
|
132
|
+
$[25] = t2;
|
|
133
|
+
$[26] = t3;
|
|
134
|
+
$[27] = t4;
|
|
135
|
+
$[28] = t5;
|
|
136
|
+
$[29] = t6;
|
|
137
|
+
} else t6 = $[29];
|
|
138
|
+
return t6;
|
|
139
|
+
}
|
|
140
|
+
const source$6 = "import { type ReactElement, useState } from \"react\";\n\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { Portal } from \"@stealthscale/component-primitives\";\nimport { Text } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Menu, Menubar } from \"@stealthscale/component-disclosure\";\n\nconst MENUS = [\n [\"file\", [\"new\", \"open\", \"save\"]],\n [\"edit\", [\"undo\", \"redo\"]],\n [\"view\", [\"zoomIn\", \"zoomOut\"]],\n] as const;\n\nexport function Controlled(): ReactElement {\n const { t } = useWords(\"menubar\");\n const [value, setValue] = useState(\"\");\n const open = MENUS.find(([menu]) => menu === value);\n\n return (\n <Stack align=\"flex-start\" gap=\"md\">\n <Menubar.Root\n aria-label={t(\"label\")}\n onValueChange={(details) => {\n setValue(details.value);\n }}\n value={value}\n >\n {MENUS.map(([menu, rows]) => (\n <Menubar.Menu key={menu} value={menu}>\n <Menubar.Trigger>{t(menu)}</Menubar.Trigger>\n <Portal>\n <Menubar.Content>\n {rows.map((row) => (\n <Menu.Item key={row} value={row}>\n {t(row)}\n </Menu.Item>\n ))}\n </Menubar.Content>\n </Portal>\n </Menubar.Menu>\n ))}\n </Menubar.Root>\n <Text as=\"output\">\n {open === undefined ? t(\"closed\") : t(\"opened\", { menu: t(open[0]) })}\n </Text>\n </Stack>\n );\n}\n";
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region src/menubar/examples/editor.example.tsx
|
|
143
|
+
var editor_example_exports = /* @__PURE__ */ __exportAll({
|
|
144
|
+
Editor: () => Editor,
|
|
145
|
+
source: () => source$5
|
|
146
|
+
});
|
|
147
|
+
function commands(list) {
|
|
148
|
+
return list.map(({ keys, label, value }) => /* @__PURE__ */ jsxs(Item, {
|
|
149
|
+
value,
|
|
150
|
+
children: [/* @__PURE__ */ jsx(ItemText, { children: label }), keys === void 0 ? null : /* @__PURE__ */ jsx(ItemCommand, { children: keys })]
|
|
151
|
+
}, value));
|
|
152
|
+
}
|
|
153
|
+
function menu(value, label, rows) {
|
|
154
|
+
return /* @__PURE__ */ jsxs(Menu, {
|
|
155
|
+
value,
|
|
156
|
+
children: [/* @__PURE__ */ jsx(Trigger, { children: label }), /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, { children: rows }) })]
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
function Editor(props) {
|
|
160
|
+
const $ = c(41);
|
|
161
|
+
const { t } = useWords("menubar");
|
|
162
|
+
let t0;
|
|
163
|
+
if ($[0] !== t) {
|
|
164
|
+
t0 = t("share");
|
|
165
|
+
$[0] = t;
|
|
166
|
+
$[1] = t0;
|
|
167
|
+
} else t0 = $[1];
|
|
168
|
+
let t1;
|
|
169
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
170
|
+
t1 = /* @__PURE__ */ jsx(Indicator, { children: /* @__PURE__ */ jsx(ChevronRightIcon, {}) });
|
|
171
|
+
$[2] = t1;
|
|
172
|
+
} else t1 = $[2];
|
|
173
|
+
let t2;
|
|
174
|
+
if ($[3] !== t0) {
|
|
175
|
+
t2 = /* @__PURE__ */ jsxs(TriggerItem, { children: [t0, t1] });
|
|
176
|
+
$[3] = t0;
|
|
177
|
+
$[4] = t2;
|
|
178
|
+
} else t2 = $[4];
|
|
179
|
+
let t3;
|
|
180
|
+
if ($[5] !== t) {
|
|
181
|
+
t3 = commands([{
|
|
182
|
+
label: t("link"),
|
|
183
|
+
value: "link"
|
|
184
|
+
}, {
|
|
185
|
+
label: t("mail"),
|
|
186
|
+
value: "mail"
|
|
187
|
+
}]);
|
|
188
|
+
$[5] = t;
|
|
189
|
+
$[6] = t3;
|
|
190
|
+
} else t3 = $[6];
|
|
191
|
+
let t4;
|
|
192
|
+
if ($[7] !== t3) {
|
|
193
|
+
t4 = /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Positioner, { children: /* @__PURE__ */ jsx(Content$1, { children: t3 }) }) });
|
|
194
|
+
$[7] = t3;
|
|
195
|
+
$[8] = t4;
|
|
196
|
+
} else t4 = $[8];
|
|
197
|
+
let t5;
|
|
198
|
+
if ($[9] !== t2 || $[10] !== t4) {
|
|
199
|
+
t5 = /* @__PURE__ */ jsxs(Root$1, { children: [t2, t4] });
|
|
200
|
+
$[9] = t2;
|
|
201
|
+
$[10] = t4;
|
|
202
|
+
$[11] = t5;
|
|
203
|
+
} else t5 = $[11];
|
|
204
|
+
const share = t5;
|
|
205
|
+
let t6;
|
|
206
|
+
if ($[12] !== t) {
|
|
207
|
+
t6 = t("label");
|
|
208
|
+
$[12] = t;
|
|
209
|
+
$[13] = t6;
|
|
210
|
+
} else t6 = $[13];
|
|
211
|
+
let t7;
|
|
212
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
213
|
+
t7 = /* @__PURE__ */ jsx(ChevronRightIcon, {});
|
|
214
|
+
$[14] = t7;
|
|
215
|
+
} else t7 = $[14];
|
|
216
|
+
let t8;
|
|
217
|
+
if ($[15] !== share || $[16] !== t) {
|
|
218
|
+
const t9 = t("file");
|
|
219
|
+
let t10;
|
|
220
|
+
if ($[18] !== t) {
|
|
221
|
+
t10 = commands([
|
|
222
|
+
{
|
|
223
|
+
keys: "⌘N",
|
|
224
|
+
label: t("new"),
|
|
225
|
+
value: "new"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
keys: "⌘O",
|
|
229
|
+
label: t("open"),
|
|
230
|
+
value: "open"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
keys: "⌘S",
|
|
234
|
+
label: t("save"),
|
|
235
|
+
value: "save"
|
|
236
|
+
}
|
|
237
|
+
]);
|
|
238
|
+
$[18] = t;
|
|
239
|
+
$[19] = t10;
|
|
240
|
+
} else t10 = $[19];
|
|
241
|
+
let t11;
|
|
242
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
243
|
+
t11 = /* @__PURE__ */ jsx(Separator, {});
|
|
244
|
+
$[20] = t11;
|
|
245
|
+
} else t11 = $[20];
|
|
246
|
+
let t12;
|
|
247
|
+
if ($[21] !== share || $[22] !== t10) {
|
|
248
|
+
t12 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
249
|
+
t10,
|
|
250
|
+
t11,
|
|
251
|
+
share
|
|
252
|
+
] });
|
|
253
|
+
$[21] = share;
|
|
254
|
+
$[22] = t10;
|
|
255
|
+
$[23] = t12;
|
|
256
|
+
} else t12 = $[23];
|
|
257
|
+
t8 = menu("file", t9, t12);
|
|
258
|
+
$[15] = share;
|
|
259
|
+
$[16] = t;
|
|
260
|
+
$[17] = t8;
|
|
261
|
+
} else t8 = $[17];
|
|
262
|
+
let t9;
|
|
263
|
+
if ($[24] !== t) {
|
|
264
|
+
const t10 = t("edit");
|
|
265
|
+
const t11 = commands([{
|
|
266
|
+
keys: "⌘Z",
|
|
267
|
+
label: t("undo"),
|
|
268
|
+
value: "undo"
|
|
269
|
+
}, {
|
|
270
|
+
keys: "⇧⌘Z",
|
|
271
|
+
label: t("redo"),
|
|
272
|
+
value: "redo"
|
|
273
|
+
}]);
|
|
274
|
+
let t12;
|
|
275
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
276
|
+
t12 = /* @__PURE__ */ jsx(Separator, {});
|
|
277
|
+
$[26] = t12;
|
|
278
|
+
} else t12 = $[26];
|
|
279
|
+
const t13 = commands([
|
|
280
|
+
{
|
|
281
|
+
keys: "⌘X",
|
|
282
|
+
label: t("cut"),
|
|
283
|
+
value: "cut"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
keys: "⌘C",
|
|
287
|
+
label: t("copy"),
|
|
288
|
+
value: "copy"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
keys: "⌘V",
|
|
292
|
+
label: t("paste"),
|
|
293
|
+
value: "paste"
|
|
294
|
+
}
|
|
295
|
+
]);
|
|
296
|
+
let t14;
|
|
297
|
+
if ($[27] !== t11 || $[28] !== t13) {
|
|
298
|
+
t14 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
299
|
+
t11,
|
|
300
|
+
t12,
|
|
301
|
+
t13
|
|
302
|
+
] });
|
|
303
|
+
$[27] = t11;
|
|
304
|
+
$[28] = t13;
|
|
305
|
+
$[29] = t14;
|
|
306
|
+
} else t14 = $[29];
|
|
307
|
+
t9 = menu("edit", t10, t14);
|
|
308
|
+
$[24] = t;
|
|
309
|
+
$[25] = t9;
|
|
310
|
+
} else t9 = $[25];
|
|
311
|
+
let t10;
|
|
312
|
+
if ($[30] !== t) {
|
|
313
|
+
t10 = menu("view", t("view"), commands([{
|
|
314
|
+
keys: "⌘+",
|
|
315
|
+
label: t("zoomIn"),
|
|
316
|
+
value: "zoom-in"
|
|
317
|
+
}, {
|
|
318
|
+
keys: "⌘−",
|
|
319
|
+
label: t("zoomOut"),
|
|
320
|
+
value: "zoom-out"
|
|
321
|
+
}]));
|
|
322
|
+
$[30] = t;
|
|
323
|
+
$[31] = t10;
|
|
324
|
+
} else t10 = $[31];
|
|
325
|
+
let t11;
|
|
326
|
+
if ($[32] !== t) {
|
|
327
|
+
t11 = menu("help", t("help"), commands([{
|
|
328
|
+
label: t("docs"),
|
|
329
|
+
value: "docs"
|
|
330
|
+
}, {
|
|
331
|
+
label: t("shortcuts"),
|
|
332
|
+
value: "shortcuts"
|
|
333
|
+
}]));
|
|
334
|
+
$[32] = t;
|
|
335
|
+
$[33] = t11;
|
|
336
|
+
} else t11 = $[33];
|
|
337
|
+
let t12;
|
|
338
|
+
if ($[34] !== props || $[35] !== t10 || $[36] !== t11 || $[37] !== t6 || $[38] !== t8 || $[39] !== t9) {
|
|
339
|
+
t12 = /* @__PURE__ */ jsxs(Root, {
|
|
340
|
+
"aria-label": t6,
|
|
341
|
+
foldIndicator: t7,
|
|
342
|
+
...props,
|
|
343
|
+
children: [
|
|
344
|
+
t8,
|
|
345
|
+
t9,
|
|
346
|
+
t10,
|
|
347
|
+
t11
|
|
348
|
+
]
|
|
349
|
+
});
|
|
350
|
+
$[34] = props;
|
|
351
|
+
$[35] = t10;
|
|
352
|
+
$[36] = t11;
|
|
353
|
+
$[37] = t6;
|
|
354
|
+
$[38] = t8;
|
|
355
|
+
$[39] = t9;
|
|
356
|
+
$[40] = t12;
|
|
357
|
+
} else t12 = $[40];
|
|
358
|
+
return t12;
|
|
359
|
+
}
|
|
360
|
+
const source$5 = "import { type ReactElement, type ReactNode } from \"react\";\n\nimport { ChevronRightIcon } from \"lucide-react\";\n\nimport { Portal } from \"@stealthscale/component-primitives\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Menu, Menubar } from \"@stealthscale/component-disclosure\";\n\ninterface Command {\n readonly keys?: string;\n readonly label: string;\n readonly value: string;\n}\n\nfunction commands(list: readonly Command[]): ReactNode {\n return list.map(({ keys, label, value }) => (\n <Menu.Item key={value} value={value}>\n <Menu.ItemText>{label}</Menu.ItemText>\n {keys === undefined ? null : <Menu.ItemCommand>{keys}</Menu.ItemCommand>}\n </Menu.Item>\n ));\n}\n\nfunction menu(value: string, label: string, rows: ReactNode): ReactElement {\n return (\n <Menubar.Menu value={value}>\n <Menubar.Trigger>{label}</Menubar.Trigger>\n <Portal>\n <Menubar.Content>{rows}</Menubar.Content>\n </Portal>\n </Menubar.Menu>\n );\n}\n\nexport function Editor(props: Omit<Menubar.RootProps, \"aria-label\">): ReactElement {\n const { t } = useWords(\"menubar\");\n const share = (\n <Menu.Root>\n <Menu.TriggerItem>\n {t(\"share\")}\n <Menu.Indicator>\n <ChevronRightIcon />\n </Menu.Indicator>\n </Menu.TriggerItem>\n <Portal>\n <Menu.Positioner>\n <Menu.Content>\n {commands([\n { label: t(\"link\"), value: \"link\" },\n { label: t(\"mail\"), value: \"mail\" },\n ])}\n </Menu.Content>\n </Menu.Positioner>\n </Portal>\n </Menu.Root>\n );\n\n return (\n <Menubar.Root aria-label={t(\"label\")} foldIndicator={<ChevronRightIcon />} {...props}>\n {menu(\n \"file\",\n t(\"file\"),\n <>\n {commands([\n { keys: \"⌘N\", label: t(\"new\"), value: \"new\" },\n { keys: \"⌘O\", label: t(\"open\"), value: \"open\" },\n { keys: \"⌘S\", label: t(\"save\"), value: \"save\" },\n ])}\n <Menu.Separator />\n {share}\n </>,\n )}\n {menu(\n \"edit\",\n t(\"edit\"),\n <>\n {commands([\n { keys: \"⌘Z\", label: t(\"undo\"), value: \"undo\" },\n { keys: \"⇧⌘Z\", label: t(\"redo\"), value: \"redo\" },\n ])}\n <Menu.Separator />\n {commands([\n { keys: \"⌘X\", label: t(\"cut\"), value: \"cut\" },\n { keys: \"⌘C\", label: t(\"copy\"), value: \"copy\" },\n { keys: \"⌘V\", label: t(\"paste\"), value: \"paste\" },\n ])}\n </>,\n )}\n {menu(\n \"view\",\n t(\"view\"),\n commands([\n { keys: \"⌘+\", label: t(\"zoomIn\"), value: \"zoom-in\" },\n { keys: \"⌘−\", label: t(\"zoomOut\"), value: \"zoom-out\" },\n ]),\n )}\n {menu(\n \"help\",\n t(\"help\"),\n commands([\n { label: t(\"docs\"), value: \"docs\" },\n { label: t(\"shortcuts\"), value: \"shortcuts\" },\n ]),\n )}\n </Menubar.Root>\n );\n}\n";
|
|
361
|
+
//#endregion
|
|
362
|
+
//#region src/menubar/examples/folded.example.tsx
|
|
363
|
+
var folded_example_exports = /* @__PURE__ */ __exportAll({
|
|
364
|
+
Folded: () => Folded,
|
|
365
|
+
source: () => source$4
|
|
366
|
+
});
|
|
367
|
+
const MENUS$2 = [
|
|
368
|
+
["file", [
|
|
369
|
+
"new",
|
|
370
|
+
"open",
|
|
371
|
+
"save"
|
|
372
|
+
]],
|
|
373
|
+
["edit", ["undo", "redo"]],
|
|
374
|
+
["selection", ["selectAll", "expand"]],
|
|
375
|
+
["view", ["zoomIn", "zoomOut"]],
|
|
376
|
+
["go", ["goFile", "goLine"]],
|
|
377
|
+
["run", ["debug", "plain"]],
|
|
378
|
+
["terminal", ["newTerminal", "split"]],
|
|
379
|
+
["help", ["docs", "shortcuts"]]
|
|
380
|
+
];
|
|
381
|
+
function Folded() {
|
|
382
|
+
const $ = c(12);
|
|
383
|
+
const { t } = useWords("menubar");
|
|
384
|
+
let t0;
|
|
385
|
+
if ($[0] !== t) {
|
|
386
|
+
t0 = t("label");
|
|
387
|
+
$[0] = t;
|
|
388
|
+
$[1] = t0;
|
|
389
|
+
} else t0 = $[1];
|
|
390
|
+
let t1;
|
|
391
|
+
if ($[2] !== t) {
|
|
392
|
+
t1 = t("fold");
|
|
393
|
+
$[2] = t;
|
|
394
|
+
$[3] = t1;
|
|
395
|
+
} else t1 = $[3];
|
|
396
|
+
let t2;
|
|
397
|
+
let t3;
|
|
398
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
399
|
+
t2 = /* @__PURE__ */ jsx(MenuIcon, { "aria-hidden": true });
|
|
400
|
+
t3 = /* @__PURE__ */ jsx(ChevronRightIcon, {});
|
|
401
|
+
$[4] = t2;
|
|
402
|
+
$[5] = t3;
|
|
403
|
+
} else {
|
|
404
|
+
t2 = $[4];
|
|
405
|
+
t3 = $[5];
|
|
406
|
+
}
|
|
407
|
+
let t4;
|
|
408
|
+
if ($[6] !== t) {
|
|
409
|
+
t4 = MENUS$2.map((t5) => {
|
|
410
|
+
const [menu, rows] = t5;
|
|
411
|
+
return /* @__PURE__ */ jsxs(Menu, {
|
|
412
|
+
value: menu,
|
|
413
|
+
children: [/* @__PURE__ */ jsx(Trigger, { children: t(menu) }), /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, { children: rows.map((row) => /* @__PURE__ */ jsx(Item, {
|
|
414
|
+
value: row,
|
|
415
|
+
children: t(row)
|
|
416
|
+
}, row)) }) })]
|
|
417
|
+
}, menu);
|
|
418
|
+
});
|
|
419
|
+
$[6] = t;
|
|
420
|
+
$[7] = t4;
|
|
421
|
+
} else t4 = $[7];
|
|
422
|
+
let t5;
|
|
423
|
+
if ($[8] !== t0 || $[9] !== t1 || $[10] !== t4) {
|
|
424
|
+
t5 = /* @__PURE__ */ jsx(Root, {
|
|
425
|
+
"aria-label": t0,
|
|
426
|
+
fold: t1,
|
|
427
|
+
foldIcon: t2,
|
|
428
|
+
foldIndicator: t3,
|
|
429
|
+
children: t4
|
|
430
|
+
});
|
|
431
|
+
$[8] = t0;
|
|
432
|
+
$[9] = t1;
|
|
433
|
+
$[10] = t4;
|
|
434
|
+
$[11] = t5;
|
|
435
|
+
} else t5 = $[11];
|
|
436
|
+
return t5;
|
|
437
|
+
}
|
|
438
|
+
const source$4 = "import { type ReactElement } from \"react\";\n\nimport { ChevronRightIcon, MenuIcon } from \"lucide-react\";\n\nimport { Portal } from \"@stealthscale/component-primitives\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Menu, Menubar } from \"@stealthscale/component-disclosure\";\n\nconst MENUS = [\n [\"file\", [\"new\", \"open\", \"save\"]],\n [\"edit\", [\"undo\", \"redo\"]],\n [\"selection\", [\"selectAll\", \"expand\"]],\n [\"view\", [\"zoomIn\", \"zoomOut\"]],\n [\"go\", [\"goFile\", \"goLine\"]],\n [\"run\", [\"debug\", \"plain\"]],\n [\"terminal\", [\"newTerminal\", \"split\"]],\n [\"help\", [\"docs\", \"shortcuts\"]],\n] as const;\n\nexport function Folded(): ReactElement {\n const { t } = useWords(\"menubar\");\n\n return (\n <Menubar.Root\n aria-label={t(\"label\")}\n fold={t(\"fold\")}\n foldIcon={<MenuIcon aria-hidden />}\n foldIndicator={<ChevronRightIcon />}\n >\n {MENUS.map(([menu, rows]) => (\n <Menubar.Menu key={menu} value={menu}>\n <Menubar.Trigger>{t(menu)}</Menubar.Trigger>\n <Portal>\n <Menubar.Content>\n {rows.map((row) => (\n <Menu.Item key={row} value={row}>\n {t(row)}\n </Menu.Item>\n ))}\n </Menubar.Content>\n </Portal>\n </Menubar.Menu>\n ))}\n </Menubar.Root>\n );\n}\n";
|
|
439
|
+
//#endregion
|
|
440
|
+
//#region src/menubar/examples/icons.example.tsx
|
|
441
|
+
var icons_example_exports = /* @__PURE__ */ __exportAll({
|
|
442
|
+
Icons: () => Icons,
|
|
443
|
+
source: () => source$3
|
|
444
|
+
});
|
|
445
|
+
function Icons() {
|
|
446
|
+
const $ = c(64);
|
|
447
|
+
const { t } = useWords("menubar");
|
|
448
|
+
let t0;
|
|
449
|
+
if ($[0] !== t) {
|
|
450
|
+
t0 = t("mailbox");
|
|
451
|
+
$[0] = t;
|
|
452
|
+
$[1] = t0;
|
|
453
|
+
} else t0 = $[1];
|
|
454
|
+
let t1;
|
|
455
|
+
if ($[2] !== t) {
|
|
456
|
+
t1 = t("message");
|
|
457
|
+
$[2] = t;
|
|
458
|
+
$[3] = t1;
|
|
459
|
+
} else t1 = $[3];
|
|
460
|
+
let t2;
|
|
461
|
+
if ($[4] !== t1) {
|
|
462
|
+
t2 = /* @__PURE__ */ jsx(Trigger, { children: t1 });
|
|
463
|
+
$[4] = t1;
|
|
464
|
+
$[5] = t2;
|
|
465
|
+
} else t2 = $[5];
|
|
466
|
+
let t3;
|
|
467
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
468
|
+
t3 = /* @__PURE__ */ jsx(CopyIcon, { "aria-hidden": true });
|
|
469
|
+
$[6] = t3;
|
|
470
|
+
} else t3 = $[6];
|
|
471
|
+
let t4;
|
|
472
|
+
if ($[7] !== t) {
|
|
473
|
+
t4 = t("duplicate");
|
|
474
|
+
$[7] = t;
|
|
475
|
+
$[8] = t4;
|
|
476
|
+
} else t4 = $[8];
|
|
477
|
+
let t5;
|
|
478
|
+
if ($[9] !== t4) {
|
|
479
|
+
t5 = /* @__PURE__ */ jsxs(Item, {
|
|
480
|
+
value: "duplicate",
|
|
481
|
+
children: [t3, t4]
|
|
482
|
+
});
|
|
483
|
+
$[9] = t4;
|
|
484
|
+
$[10] = t5;
|
|
485
|
+
} else t5 = $[10];
|
|
486
|
+
let t6;
|
|
487
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
488
|
+
t6 = /* @__PURE__ */ jsx(FolderInputIcon, { "aria-hidden": true });
|
|
489
|
+
$[11] = t6;
|
|
490
|
+
} else t6 = $[11];
|
|
491
|
+
let t7;
|
|
492
|
+
if ($[12] !== t) {
|
|
493
|
+
t7 = t("move");
|
|
494
|
+
$[12] = t;
|
|
495
|
+
$[13] = t7;
|
|
496
|
+
} else t7 = $[13];
|
|
497
|
+
let t8;
|
|
498
|
+
if ($[14] !== t7) {
|
|
499
|
+
t8 = /* @__PURE__ */ jsxs(Item, {
|
|
500
|
+
value: "move",
|
|
501
|
+
children: [t6, t7]
|
|
502
|
+
});
|
|
503
|
+
$[14] = t7;
|
|
504
|
+
$[15] = t8;
|
|
505
|
+
} else t8 = $[15];
|
|
506
|
+
let t9;
|
|
507
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
508
|
+
t9 = /* @__PURE__ */ jsx(ArchiveIcon, { "aria-hidden": true });
|
|
509
|
+
$[16] = t9;
|
|
510
|
+
} else t9 = $[16];
|
|
511
|
+
let t10;
|
|
512
|
+
if ($[17] !== t) {
|
|
513
|
+
t10 = t("archive");
|
|
514
|
+
$[17] = t;
|
|
515
|
+
$[18] = t10;
|
|
516
|
+
} else t10 = $[18];
|
|
517
|
+
let t11;
|
|
518
|
+
if ($[19] !== t10) {
|
|
519
|
+
t11 = /* @__PURE__ */ jsxs(Item, {
|
|
520
|
+
value: "archive",
|
|
521
|
+
children: [t9, t10]
|
|
522
|
+
});
|
|
523
|
+
$[19] = t10;
|
|
524
|
+
$[20] = t11;
|
|
525
|
+
} else t11 = $[20];
|
|
526
|
+
let t12;
|
|
527
|
+
if ($[21] !== t) {
|
|
528
|
+
t12 = t("unread");
|
|
529
|
+
$[21] = t;
|
|
530
|
+
$[22] = t12;
|
|
531
|
+
} else t12 = $[22];
|
|
532
|
+
let t13;
|
|
533
|
+
if ($[23] !== t12) {
|
|
534
|
+
t13 = /* @__PURE__ */ jsx(Item, {
|
|
535
|
+
value: "unread",
|
|
536
|
+
children: t12
|
|
537
|
+
});
|
|
538
|
+
$[23] = t12;
|
|
539
|
+
$[24] = t13;
|
|
540
|
+
} else t13 = $[24];
|
|
541
|
+
let t14;
|
|
542
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
543
|
+
t14 = /* @__PURE__ */ jsx(Separator, {});
|
|
544
|
+
$[25] = t14;
|
|
545
|
+
} else t14 = $[25];
|
|
546
|
+
let t15;
|
|
547
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
548
|
+
t15 = /* @__PURE__ */ jsx(Trash2Icon, { "aria-hidden": true });
|
|
549
|
+
$[26] = t15;
|
|
550
|
+
} else t15 = $[26];
|
|
551
|
+
let t16;
|
|
552
|
+
if ($[27] !== t) {
|
|
553
|
+
t16 = t("delete");
|
|
554
|
+
$[27] = t;
|
|
555
|
+
$[28] = t16;
|
|
556
|
+
} else t16 = $[28];
|
|
557
|
+
let t17;
|
|
558
|
+
if ($[29] !== t16) {
|
|
559
|
+
t17 = /* @__PURE__ */ jsxs(Item, {
|
|
560
|
+
tone: "critical",
|
|
561
|
+
value: "delete",
|
|
562
|
+
children: [t15, t16]
|
|
563
|
+
});
|
|
564
|
+
$[29] = t16;
|
|
565
|
+
$[30] = t17;
|
|
566
|
+
} else t17 = $[30];
|
|
567
|
+
let t18;
|
|
568
|
+
if ($[31] !== t11 || $[32] !== t13 || $[33] !== t17 || $[34] !== t5 || $[35] !== t8) {
|
|
569
|
+
t18 = /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
570
|
+
t5,
|
|
571
|
+
t8,
|
|
572
|
+
t11,
|
|
573
|
+
t13,
|
|
574
|
+
t14,
|
|
575
|
+
t17
|
|
576
|
+
] }) });
|
|
577
|
+
$[31] = t11;
|
|
578
|
+
$[32] = t13;
|
|
579
|
+
$[33] = t17;
|
|
580
|
+
$[34] = t5;
|
|
581
|
+
$[35] = t8;
|
|
582
|
+
$[36] = t18;
|
|
583
|
+
} else t18 = $[36];
|
|
584
|
+
let t19;
|
|
585
|
+
if ($[37] !== t18 || $[38] !== t2) {
|
|
586
|
+
t19 = /* @__PURE__ */ jsxs(Menu, {
|
|
587
|
+
inset: true,
|
|
588
|
+
value: "message",
|
|
589
|
+
children: [t2, t18]
|
|
590
|
+
});
|
|
591
|
+
$[37] = t18;
|
|
592
|
+
$[38] = t2;
|
|
593
|
+
$[39] = t19;
|
|
594
|
+
} else t19 = $[39];
|
|
595
|
+
let t20;
|
|
596
|
+
if ($[40] !== t) {
|
|
597
|
+
t20 = t("folder");
|
|
598
|
+
$[40] = t;
|
|
599
|
+
$[41] = t20;
|
|
600
|
+
} else t20 = $[41];
|
|
601
|
+
let t21;
|
|
602
|
+
if ($[42] !== t20) {
|
|
603
|
+
t21 = /* @__PURE__ */ jsx(Trigger, { children: t20 });
|
|
604
|
+
$[42] = t20;
|
|
605
|
+
$[43] = t21;
|
|
606
|
+
} else t21 = $[43];
|
|
607
|
+
let t22;
|
|
608
|
+
if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
|
|
609
|
+
t22 = /* @__PURE__ */ jsx(FolderPlusIcon, { "aria-hidden": true });
|
|
610
|
+
$[44] = t22;
|
|
611
|
+
} else t22 = $[44];
|
|
612
|
+
let t23;
|
|
613
|
+
if ($[45] !== t) {
|
|
614
|
+
t23 = t("create");
|
|
615
|
+
$[45] = t;
|
|
616
|
+
$[46] = t23;
|
|
617
|
+
} else t23 = $[46];
|
|
618
|
+
let t24;
|
|
619
|
+
if ($[47] !== t23) {
|
|
620
|
+
t24 = /* @__PURE__ */ jsxs(Item, {
|
|
621
|
+
value: "create",
|
|
622
|
+
children: [t22, t23]
|
|
623
|
+
});
|
|
624
|
+
$[47] = t23;
|
|
625
|
+
$[48] = t24;
|
|
626
|
+
} else t24 = $[48];
|
|
627
|
+
let t25;
|
|
628
|
+
if ($[49] === Symbol.for("react.memo_cache_sentinel")) {
|
|
629
|
+
t25 = /* @__PURE__ */ jsx(PencilIcon, { "aria-hidden": true });
|
|
630
|
+
$[49] = t25;
|
|
631
|
+
} else t25 = $[49];
|
|
632
|
+
let t26;
|
|
633
|
+
if ($[50] !== t) {
|
|
634
|
+
t26 = t("rename");
|
|
635
|
+
$[50] = t;
|
|
636
|
+
$[51] = t26;
|
|
637
|
+
} else t26 = $[51];
|
|
638
|
+
let t27;
|
|
639
|
+
if ($[52] !== t26) {
|
|
640
|
+
t27 = /* @__PURE__ */ jsxs(Item, {
|
|
641
|
+
value: "rename",
|
|
642
|
+
children: [t25, t26]
|
|
643
|
+
});
|
|
644
|
+
$[52] = t26;
|
|
645
|
+
$[53] = t27;
|
|
646
|
+
} else t27 = $[53];
|
|
647
|
+
let t28;
|
|
648
|
+
if ($[54] !== t24 || $[55] !== t27) {
|
|
649
|
+
t28 = /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsxs(Content, { children: [t24, t27] }) });
|
|
650
|
+
$[54] = t24;
|
|
651
|
+
$[55] = t27;
|
|
652
|
+
$[56] = t28;
|
|
653
|
+
} else t28 = $[56];
|
|
654
|
+
let t29;
|
|
655
|
+
if ($[57] !== t21 || $[58] !== t28) {
|
|
656
|
+
t29 = /* @__PURE__ */ jsxs(Menu, {
|
|
657
|
+
value: "folder",
|
|
658
|
+
children: [t21, t28]
|
|
659
|
+
});
|
|
660
|
+
$[57] = t21;
|
|
661
|
+
$[58] = t28;
|
|
662
|
+
$[59] = t29;
|
|
663
|
+
} else t29 = $[59];
|
|
664
|
+
let t30;
|
|
665
|
+
if ($[60] !== t0 || $[61] !== t19 || $[62] !== t29) {
|
|
666
|
+
t30 = /* @__PURE__ */ jsxs(Root, {
|
|
667
|
+
"aria-label": t0,
|
|
668
|
+
children: [t19, t29]
|
|
669
|
+
});
|
|
670
|
+
$[60] = t0;
|
|
671
|
+
$[61] = t19;
|
|
672
|
+
$[62] = t29;
|
|
673
|
+
$[63] = t30;
|
|
674
|
+
} else t30 = $[63];
|
|
675
|
+
return t30;
|
|
676
|
+
}
|
|
677
|
+
const source$3 = "import { type ReactElement } from \"react\";\n\nimport {\n ArchiveIcon,\n CopyIcon,\n FolderInputIcon,\n FolderPlusIcon,\n PencilIcon,\n Trash2Icon,\n} from \"lucide-react\";\n\nimport { Portal } from \"@stealthscale/component-primitives\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Menu, Menubar } from \"@stealthscale/component-disclosure\";\n\nexport function Icons(): ReactElement {\n const { t } = useWords(\"menubar\");\n\n return (\n <Menubar.Root aria-label={t(\"mailbox\")}>\n <Menubar.Menu inset value=\"message\">\n <Menubar.Trigger>{t(\"message\")}</Menubar.Trigger>\n <Portal>\n <Menubar.Content>\n <Menu.Item value=\"duplicate\">\n <CopyIcon aria-hidden />\n {t(\"duplicate\")}\n </Menu.Item>\n <Menu.Item value=\"move\">\n <FolderInputIcon aria-hidden />\n {t(\"move\")}\n </Menu.Item>\n <Menu.Item value=\"archive\">\n <ArchiveIcon aria-hidden />\n {t(\"archive\")}\n </Menu.Item>\n <Menu.Item value=\"unread\">{t(\"unread\")}</Menu.Item>\n <Menu.Separator />\n <Menu.Item tone=\"critical\" value=\"delete\">\n <Trash2Icon aria-hidden />\n {t(\"delete\")}\n </Menu.Item>\n </Menubar.Content>\n </Portal>\n </Menubar.Menu>\n <Menubar.Menu value=\"folder\">\n <Menubar.Trigger>{t(\"folder\")}</Menubar.Trigger>\n <Portal>\n <Menubar.Content>\n <Menu.Item value=\"create\">\n <FolderPlusIcon aria-hidden />\n {t(\"create\")}\n </Menu.Item>\n <Menu.Item value=\"rename\">\n <PencilIcon aria-hidden />\n {t(\"rename\")}\n </Menu.Item>\n </Menubar.Content>\n </Portal>\n </Menubar.Menu>\n </Menubar.Root>\n );\n}\n";
|
|
678
|
+
//#endregion
|
|
679
|
+
//#region src/menubar/examples/options.example.tsx
|
|
680
|
+
var options_example_exports = /* @__PURE__ */ __exportAll({
|
|
681
|
+
Options: () => Options,
|
|
682
|
+
source: () => source$2
|
|
683
|
+
});
|
|
684
|
+
const SHOWN = ["minimap", "status"];
|
|
685
|
+
const PANELS = [
|
|
686
|
+
"explorer",
|
|
687
|
+
"search",
|
|
688
|
+
"timeline"
|
|
689
|
+
];
|
|
690
|
+
function Options() {
|
|
691
|
+
const $ = c(32);
|
|
692
|
+
const { t } = useWords("menubar");
|
|
693
|
+
let t0;
|
|
694
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
695
|
+
t0 = ["status"];
|
|
696
|
+
$[0] = t0;
|
|
697
|
+
} else t0 = $[0];
|
|
698
|
+
const [shown, setShown] = useState(t0);
|
|
699
|
+
const [panel, setPanel] = useState("explorer");
|
|
700
|
+
let t1;
|
|
701
|
+
if ($[1] !== t) {
|
|
702
|
+
t1 = t("layout");
|
|
703
|
+
$[1] = t;
|
|
704
|
+
$[2] = t1;
|
|
705
|
+
} else t1 = $[2];
|
|
706
|
+
let t2;
|
|
707
|
+
if ($[3] !== t) {
|
|
708
|
+
t2 = t("show");
|
|
709
|
+
$[3] = t;
|
|
710
|
+
$[4] = t2;
|
|
711
|
+
} else t2 = $[4];
|
|
712
|
+
let t3;
|
|
713
|
+
if ($[5] !== t2) {
|
|
714
|
+
t3 = /* @__PURE__ */ jsx(Trigger, { children: t2 });
|
|
715
|
+
$[5] = t2;
|
|
716
|
+
$[6] = t3;
|
|
717
|
+
} else t3 = $[6];
|
|
718
|
+
let t4;
|
|
719
|
+
if ($[7] !== shown || $[8] !== t) {
|
|
720
|
+
t4 = SHOWN.map((name) => /* @__PURE__ */ jsxs(OptionItem, {
|
|
721
|
+
checked: shown.includes(name),
|
|
722
|
+
onCheckedChange: (checked) => {
|
|
723
|
+
setShown((was) => checked ? [...was, name] : was.filter((on) => on !== name));
|
|
724
|
+
},
|
|
725
|
+
type: "checkbox",
|
|
726
|
+
value: name,
|
|
727
|
+
children: [/* @__PURE__ */ jsx(ItemText, { children: t(name) }), /* @__PURE__ */ jsx(ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { size: "1em" }) })]
|
|
728
|
+
}, name));
|
|
729
|
+
$[7] = shown;
|
|
730
|
+
$[8] = t;
|
|
731
|
+
$[9] = t4;
|
|
732
|
+
} else t4 = $[9];
|
|
733
|
+
let t5;
|
|
734
|
+
if ($[10] !== t4) {
|
|
735
|
+
t5 = /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, { children: t4 }) });
|
|
736
|
+
$[10] = t4;
|
|
737
|
+
$[11] = t5;
|
|
738
|
+
} else t5 = $[11];
|
|
739
|
+
let t6;
|
|
740
|
+
if ($[12] !== t3 || $[13] !== t5) {
|
|
741
|
+
t6 = /* @__PURE__ */ jsxs(Menu, {
|
|
742
|
+
value: "show",
|
|
743
|
+
children: [t3, t5]
|
|
744
|
+
});
|
|
745
|
+
$[12] = t3;
|
|
746
|
+
$[13] = t5;
|
|
747
|
+
$[14] = t6;
|
|
748
|
+
} else t6 = $[14];
|
|
749
|
+
let t7;
|
|
750
|
+
if ($[15] !== panel || $[16] !== t) {
|
|
751
|
+
t7 = t("panel", { panel: t(panel) });
|
|
752
|
+
$[15] = panel;
|
|
753
|
+
$[16] = t;
|
|
754
|
+
$[17] = t7;
|
|
755
|
+
} else t7 = $[17];
|
|
756
|
+
let t8;
|
|
757
|
+
if ($[18] !== t7) {
|
|
758
|
+
t8 = /* @__PURE__ */ jsx(Trigger, { children: t7 });
|
|
759
|
+
$[18] = t7;
|
|
760
|
+
$[19] = t8;
|
|
761
|
+
} else t8 = $[19];
|
|
762
|
+
let t9;
|
|
763
|
+
if ($[20] !== panel || $[21] !== t) {
|
|
764
|
+
t9 = PANELS.map((name_0) => /* @__PURE__ */ jsxs(OptionItem, {
|
|
765
|
+
checked: panel === name_0,
|
|
766
|
+
onCheckedChange: () => {
|
|
767
|
+
setPanel(name_0);
|
|
768
|
+
},
|
|
769
|
+
type: "radio",
|
|
770
|
+
value: name_0,
|
|
771
|
+
children: [/* @__PURE__ */ jsx(ItemText, { children: t(name_0) }), /* @__PURE__ */ jsx(ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { size: "1em" }) })]
|
|
772
|
+
}, name_0));
|
|
773
|
+
$[20] = panel;
|
|
774
|
+
$[21] = t;
|
|
775
|
+
$[22] = t9;
|
|
776
|
+
} else t9 = $[22];
|
|
777
|
+
let t10;
|
|
778
|
+
if ($[23] !== t9) {
|
|
779
|
+
t10 = /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, { children: t9 }) });
|
|
780
|
+
$[23] = t9;
|
|
781
|
+
$[24] = t10;
|
|
782
|
+
} else t10 = $[24];
|
|
783
|
+
let t11;
|
|
784
|
+
if ($[25] !== t10 || $[26] !== t8) {
|
|
785
|
+
t11 = /* @__PURE__ */ jsxs(Menu, {
|
|
786
|
+
value: "panel",
|
|
787
|
+
children: [t8, t10]
|
|
788
|
+
});
|
|
789
|
+
$[25] = t10;
|
|
790
|
+
$[26] = t8;
|
|
791
|
+
$[27] = t11;
|
|
792
|
+
} else t11 = $[27];
|
|
793
|
+
let t12;
|
|
794
|
+
if ($[28] !== t1 || $[29] !== t11 || $[30] !== t6) {
|
|
795
|
+
t12 = /* @__PURE__ */ jsxs(Root, {
|
|
796
|
+
"aria-label": t1,
|
|
797
|
+
children: [t6, t11]
|
|
798
|
+
});
|
|
799
|
+
$[28] = t1;
|
|
800
|
+
$[29] = t11;
|
|
801
|
+
$[30] = t6;
|
|
802
|
+
$[31] = t12;
|
|
803
|
+
} else t12 = $[31];
|
|
804
|
+
return t12;
|
|
805
|
+
}
|
|
806
|
+
const source$2 = "import { type ReactElement, useState } from \"react\";\n\nimport { CheckIcon } from \"lucide-react\";\n\nimport { Portal } from \"@stealthscale/component-primitives\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Menu, Menubar } from \"@stealthscale/component-disclosure\";\n\nconst SHOWN = [\"minimap\", \"status\"] as const;\n\nconst PANELS = [\"explorer\", \"search\", \"timeline\"] as const;\n\nexport function Options(): ReactElement {\n const { t } = useWords(\"menubar\");\n const [shown, setShown] = useState<readonly string[]>([\"status\"]);\n const [panel, setPanel] = useState<(typeof PANELS)[number]>(\"explorer\");\n\n return (\n <Menubar.Root aria-label={t(\"layout\")}>\n <Menubar.Menu value=\"show\">\n <Menubar.Trigger>{t(\"show\")}</Menubar.Trigger>\n <Portal>\n <Menubar.Content>\n {SHOWN.map((name) => (\n <Menu.OptionItem\n checked={shown.includes(name)}\n key={name}\n onCheckedChange={(checked) => {\n setShown((was) => (checked ? [...was, name] : was.filter((on) => on !== name)));\n }}\n type=\"checkbox\"\n value={name}\n >\n <Menu.ItemText>{t(name)}</Menu.ItemText>\n <Menu.ItemIndicator>\n <CheckIcon size=\"1em\" />\n </Menu.ItemIndicator>\n </Menu.OptionItem>\n ))}\n </Menubar.Content>\n </Portal>\n </Menubar.Menu>\n <Menubar.Menu value=\"panel\">\n <Menubar.Trigger>{t(\"panel\", { panel: t(panel) })}</Menubar.Trigger>\n <Portal>\n <Menubar.Content>\n {PANELS.map((name) => (\n <Menu.OptionItem\n checked={panel === name}\n key={name}\n onCheckedChange={() => {\n setPanel(name);\n }}\n type=\"radio\"\n value={name}\n >\n <Menu.ItemText>{t(name)}</Menu.ItemText>\n <Menu.ItemIndicator>\n <CheckIcon size=\"1em\" />\n </Menu.ItemIndicator>\n </Menu.OptionItem>\n ))}\n </Menubar.Content>\n </Portal>\n </Menubar.Menu>\n </Menubar.Root>\n );\n}\n";
|
|
807
|
+
//#endregion
|
|
808
|
+
//#region src/menubar/examples/rtl.example.tsx
|
|
809
|
+
var rtl_example_exports = /* @__PURE__ */ __exportAll({
|
|
810
|
+
Rtl: () => Rtl,
|
|
811
|
+
source: () => source$1
|
|
812
|
+
});
|
|
813
|
+
const MENUS$1 = [["edit", ["undo", "redo"]], ["view", ["zoomIn", "zoomOut"]]];
|
|
814
|
+
function Rtl() {
|
|
815
|
+
const $ = c(46);
|
|
816
|
+
const { t } = useWords("menubar.rtl");
|
|
817
|
+
let t0;
|
|
818
|
+
if ($[0] !== t) {
|
|
819
|
+
t0 = t("label");
|
|
820
|
+
$[0] = t;
|
|
821
|
+
$[1] = t0;
|
|
822
|
+
} else t0 = $[1];
|
|
823
|
+
let t1;
|
|
824
|
+
if ($[2] !== t) {
|
|
825
|
+
t1 = t("file");
|
|
826
|
+
$[2] = t;
|
|
827
|
+
$[3] = t1;
|
|
828
|
+
} else t1 = $[3];
|
|
829
|
+
let t2;
|
|
830
|
+
if ($[4] !== t1) {
|
|
831
|
+
t2 = /* @__PURE__ */ jsx(Trigger, { children: t1 });
|
|
832
|
+
$[4] = t1;
|
|
833
|
+
$[5] = t2;
|
|
834
|
+
} else t2 = $[5];
|
|
835
|
+
let t3;
|
|
836
|
+
if ($[6] !== t) {
|
|
837
|
+
t3 = t("new");
|
|
838
|
+
$[6] = t;
|
|
839
|
+
$[7] = t3;
|
|
840
|
+
} else t3 = $[7];
|
|
841
|
+
let t4;
|
|
842
|
+
if ($[8] !== t3) {
|
|
843
|
+
t4 = /* @__PURE__ */ jsx(Item, {
|
|
844
|
+
value: "new",
|
|
845
|
+
children: t3
|
|
846
|
+
});
|
|
847
|
+
$[8] = t3;
|
|
848
|
+
$[9] = t4;
|
|
849
|
+
} else t4 = $[9];
|
|
850
|
+
let t5;
|
|
851
|
+
if ($[10] !== t) {
|
|
852
|
+
t5 = t("open");
|
|
853
|
+
$[10] = t;
|
|
854
|
+
$[11] = t5;
|
|
855
|
+
} else t5 = $[11];
|
|
856
|
+
let t6;
|
|
857
|
+
if ($[12] !== t5) {
|
|
858
|
+
t6 = /* @__PURE__ */ jsx(Item, {
|
|
859
|
+
value: "open",
|
|
860
|
+
children: t5
|
|
861
|
+
});
|
|
862
|
+
$[12] = t5;
|
|
863
|
+
$[13] = t6;
|
|
864
|
+
} else t6 = $[13];
|
|
865
|
+
let t7;
|
|
866
|
+
if ($[14] !== t) {
|
|
867
|
+
t7 = t("share");
|
|
868
|
+
$[14] = t;
|
|
869
|
+
$[15] = t7;
|
|
870
|
+
} else t7 = $[15];
|
|
871
|
+
let t8;
|
|
872
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
873
|
+
t8 = /* @__PURE__ */ jsx(Indicator, { children: /* @__PURE__ */ jsx(ChevronRightIcon, {}) });
|
|
874
|
+
$[16] = t8;
|
|
875
|
+
} else t8 = $[16];
|
|
876
|
+
let t9;
|
|
877
|
+
if ($[17] !== t7) {
|
|
878
|
+
t9 = /* @__PURE__ */ jsxs(TriggerItem, { children: [t7, t8] });
|
|
879
|
+
$[17] = t7;
|
|
880
|
+
$[18] = t9;
|
|
881
|
+
} else t9 = $[18];
|
|
882
|
+
let t10;
|
|
883
|
+
if ($[19] !== t) {
|
|
884
|
+
t10 = t("link");
|
|
885
|
+
$[19] = t;
|
|
886
|
+
$[20] = t10;
|
|
887
|
+
} else t10 = $[20];
|
|
888
|
+
let t11;
|
|
889
|
+
if ($[21] !== t10) {
|
|
890
|
+
t11 = /* @__PURE__ */ jsx(Item, {
|
|
891
|
+
value: "link",
|
|
892
|
+
children: t10
|
|
893
|
+
});
|
|
894
|
+
$[21] = t10;
|
|
895
|
+
$[22] = t11;
|
|
896
|
+
} else t11 = $[22];
|
|
897
|
+
let t12;
|
|
898
|
+
if ($[23] !== t) {
|
|
899
|
+
t12 = t("mail");
|
|
900
|
+
$[23] = t;
|
|
901
|
+
$[24] = t12;
|
|
902
|
+
} else t12 = $[24];
|
|
903
|
+
let t13;
|
|
904
|
+
if ($[25] !== t12) {
|
|
905
|
+
t13 = /* @__PURE__ */ jsx(Item, {
|
|
906
|
+
value: "mail",
|
|
907
|
+
children: t12
|
|
908
|
+
});
|
|
909
|
+
$[25] = t12;
|
|
910
|
+
$[26] = t13;
|
|
911
|
+
} else t13 = $[26];
|
|
912
|
+
let t14;
|
|
913
|
+
if ($[27] !== t11 || $[28] !== t13) {
|
|
914
|
+
t14 = /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Positioner, { children: /* @__PURE__ */ jsxs(Content$1, { children: [t11, t13] }) }) });
|
|
915
|
+
$[27] = t11;
|
|
916
|
+
$[28] = t13;
|
|
917
|
+
$[29] = t14;
|
|
918
|
+
} else t14 = $[29];
|
|
919
|
+
let t15;
|
|
920
|
+
if ($[30] !== t14 || $[31] !== t9) {
|
|
921
|
+
t15 = /* @__PURE__ */ jsxs(Root$1, { children: [t9, t14] });
|
|
922
|
+
$[30] = t14;
|
|
923
|
+
$[31] = t9;
|
|
924
|
+
$[32] = t15;
|
|
925
|
+
} else t15 = $[32];
|
|
926
|
+
let t16;
|
|
927
|
+
if ($[33] !== t15 || $[34] !== t4 || $[35] !== t6) {
|
|
928
|
+
t16 = /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
929
|
+
t4,
|
|
930
|
+
t6,
|
|
931
|
+
t15
|
|
932
|
+
] }) });
|
|
933
|
+
$[33] = t15;
|
|
934
|
+
$[34] = t4;
|
|
935
|
+
$[35] = t6;
|
|
936
|
+
$[36] = t16;
|
|
937
|
+
} else t16 = $[36];
|
|
938
|
+
let t17;
|
|
939
|
+
if ($[37] !== t16 || $[38] !== t2) {
|
|
940
|
+
t17 = /* @__PURE__ */ jsxs(Menu, {
|
|
941
|
+
value: "file",
|
|
942
|
+
children: [t2, t16]
|
|
943
|
+
});
|
|
944
|
+
$[37] = t16;
|
|
945
|
+
$[38] = t2;
|
|
946
|
+
$[39] = t17;
|
|
947
|
+
} else t17 = $[39];
|
|
948
|
+
let t18;
|
|
949
|
+
if ($[40] !== t) {
|
|
950
|
+
t18 = MENUS$1.map((t19) => {
|
|
951
|
+
const [menu, rows] = t19;
|
|
952
|
+
return /* @__PURE__ */ jsxs(Menu, {
|
|
953
|
+
value: menu,
|
|
954
|
+
children: [/* @__PURE__ */ jsx(Trigger, { children: t(menu) }), /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, { children: rows.map((row) => /* @__PURE__ */ jsx(Item, {
|
|
955
|
+
value: row,
|
|
956
|
+
children: t(row)
|
|
957
|
+
}, row)) }) })]
|
|
958
|
+
}, menu);
|
|
959
|
+
});
|
|
960
|
+
$[40] = t;
|
|
961
|
+
$[41] = t18;
|
|
962
|
+
} else t18 = $[41];
|
|
963
|
+
let t19;
|
|
964
|
+
if ($[42] !== t0 || $[43] !== t17 || $[44] !== t18) {
|
|
965
|
+
t19 = /* @__PURE__ */ jsxs(Root, {
|
|
966
|
+
"aria-label": t0,
|
|
967
|
+
dir: "rtl",
|
|
968
|
+
children: [t17, t18]
|
|
969
|
+
});
|
|
970
|
+
$[42] = t0;
|
|
971
|
+
$[43] = t17;
|
|
972
|
+
$[44] = t18;
|
|
973
|
+
$[45] = t19;
|
|
974
|
+
} else t19 = $[45];
|
|
975
|
+
return t19;
|
|
976
|
+
}
|
|
977
|
+
const source$1 = "import { type ReactElement } from \"react\";\n\nimport { ChevronRightIcon } from \"lucide-react\";\n\nimport { Portal } from \"@stealthscale/component-primitives\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Menu, Menubar } from \"@stealthscale/component-disclosure\";\n\nconst MENUS = [\n [\"edit\", [\"undo\", \"redo\"]],\n [\"view\", [\"zoomIn\", \"zoomOut\"]],\n] as const;\n\nexport function Rtl(): ReactElement {\n const { t } = useWords(\"menubar.rtl\");\n\n return (\n <Menubar.Root aria-label={t(\"label\")} dir=\"rtl\">\n <Menubar.Menu value=\"file\">\n <Menubar.Trigger>{t(\"file\")}</Menubar.Trigger>\n <Portal>\n <Menubar.Content>\n <Menu.Item value=\"new\">{t(\"new\")}</Menu.Item>\n <Menu.Item value=\"open\">{t(\"open\")}</Menu.Item>\n <Menu.Root>\n <Menu.TriggerItem>\n {t(\"share\")}\n <Menu.Indicator>\n <ChevronRightIcon />\n </Menu.Indicator>\n </Menu.TriggerItem>\n <Portal>\n <Menu.Positioner>\n <Menu.Content>\n <Menu.Item value=\"link\">{t(\"link\")}</Menu.Item>\n <Menu.Item value=\"mail\">{t(\"mail\")}</Menu.Item>\n </Menu.Content>\n </Menu.Positioner>\n </Portal>\n </Menu.Root>\n </Menubar.Content>\n </Portal>\n </Menubar.Menu>\n {MENUS.map(([menu, rows]) => (\n <Menubar.Menu key={menu} value={menu}>\n <Menubar.Trigger>{t(menu)}</Menubar.Trigger>\n <Portal>\n <Menubar.Content>\n {rows.map((row) => (\n <Menu.Item key={row} value={row}>\n {t(row)}\n </Menu.Item>\n ))}\n </Menubar.Content>\n </Portal>\n </Menubar.Menu>\n ))}\n </Menubar.Root>\n );\n}\n";
|
|
978
|
+
//#endregion
|
|
979
|
+
//#region src/menubar/examples/stop.example.tsx
|
|
980
|
+
var stop_example_exports = /* @__PURE__ */ __exportAll({
|
|
981
|
+
Stop: () => Stop,
|
|
982
|
+
source: () => source
|
|
983
|
+
});
|
|
984
|
+
const MENUS = [
|
|
985
|
+
["file", [
|
|
986
|
+
"new",
|
|
987
|
+
"open",
|
|
988
|
+
"save"
|
|
989
|
+
]],
|
|
990
|
+
["edit", ["undo", "redo"]],
|
|
991
|
+
["view", ["zoomIn", "zoomOut"]]
|
|
992
|
+
];
|
|
993
|
+
function Stop() {
|
|
994
|
+
const $ = c(20);
|
|
995
|
+
const { t } = useWords("menubar");
|
|
996
|
+
let t0;
|
|
997
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
998
|
+
t0 = /* @__PURE__ */ jsx(ArrowLeftIcon, {});
|
|
999
|
+
$[0] = t0;
|
|
1000
|
+
} else t0 = $[0];
|
|
1001
|
+
let t1;
|
|
1002
|
+
if ($[1] !== t) {
|
|
1003
|
+
t1 = t("back");
|
|
1004
|
+
$[1] = t;
|
|
1005
|
+
$[2] = t1;
|
|
1006
|
+
} else t1 = $[2];
|
|
1007
|
+
let t2;
|
|
1008
|
+
if ($[3] !== t1) {
|
|
1009
|
+
t2 = /* @__PURE__ */ jsxs(Button, {
|
|
1010
|
+
variant: "ghost",
|
|
1011
|
+
children: [t0, t1]
|
|
1012
|
+
});
|
|
1013
|
+
$[3] = t1;
|
|
1014
|
+
$[4] = t2;
|
|
1015
|
+
} else t2 = $[4];
|
|
1016
|
+
let t3;
|
|
1017
|
+
if ($[5] !== t) {
|
|
1018
|
+
t3 = t("label");
|
|
1019
|
+
$[5] = t;
|
|
1020
|
+
$[6] = t3;
|
|
1021
|
+
} else t3 = $[6];
|
|
1022
|
+
let t4;
|
|
1023
|
+
if ($[7] !== t) {
|
|
1024
|
+
t4 = MENUS.map((t5) => {
|
|
1025
|
+
const [menu, rows] = t5;
|
|
1026
|
+
return /* @__PURE__ */ jsxs(Menu, {
|
|
1027
|
+
value: menu,
|
|
1028
|
+
children: [/* @__PURE__ */ jsx(Trigger, { children: t(menu) }), /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, { children: rows.map((row) => /* @__PURE__ */ jsx(Item, {
|
|
1029
|
+
value: row,
|
|
1030
|
+
children: t(row)
|
|
1031
|
+
}, row)) }) })]
|
|
1032
|
+
}, menu);
|
|
1033
|
+
});
|
|
1034
|
+
$[7] = t;
|
|
1035
|
+
$[8] = t4;
|
|
1036
|
+
} else t4 = $[8];
|
|
1037
|
+
let t5;
|
|
1038
|
+
if ($[9] !== t3 || $[10] !== t4) {
|
|
1039
|
+
t5 = /* @__PURE__ */ jsx(Root, {
|
|
1040
|
+
"aria-label": t3,
|
|
1041
|
+
children: t4
|
|
1042
|
+
});
|
|
1043
|
+
$[9] = t3;
|
|
1044
|
+
$[10] = t4;
|
|
1045
|
+
$[11] = t5;
|
|
1046
|
+
} else t5 = $[11];
|
|
1047
|
+
let t6;
|
|
1048
|
+
if ($[12] !== t) {
|
|
1049
|
+
t6 = t("publish");
|
|
1050
|
+
$[12] = t;
|
|
1051
|
+
$[13] = t6;
|
|
1052
|
+
} else t6 = $[13];
|
|
1053
|
+
let t7;
|
|
1054
|
+
if ($[14] !== t6) {
|
|
1055
|
+
t7 = /* @__PURE__ */ jsx(Button, { children: t6 });
|
|
1056
|
+
$[14] = t6;
|
|
1057
|
+
$[15] = t7;
|
|
1058
|
+
} else t7 = $[15];
|
|
1059
|
+
let t8;
|
|
1060
|
+
if ($[16] !== t2 || $[17] !== t5 || $[18] !== t7) {
|
|
1061
|
+
t8 = /* @__PURE__ */ jsxs(Stack, {
|
|
1062
|
+
direction: "row",
|
|
1063
|
+
gap: "md",
|
|
1064
|
+
wrap: true,
|
|
1065
|
+
children: [
|
|
1066
|
+
t2,
|
|
1067
|
+
t5,
|
|
1068
|
+
t7
|
|
1069
|
+
]
|
|
1070
|
+
});
|
|
1071
|
+
$[16] = t2;
|
|
1072
|
+
$[17] = t5;
|
|
1073
|
+
$[18] = t7;
|
|
1074
|
+
$[19] = t8;
|
|
1075
|
+
} else t8 = $[19];
|
|
1076
|
+
return t8;
|
|
1077
|
+
}
|
|
1078
|
+
const source = "import { type ReactElement } from \"react\";\n\nimport { ArrowLeftIcon } from \"lucide-react\";\n\nimport { Button } from \"@stealthscale/component-actions\";\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { Portal } from \"@stealthscale/component-primitives\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Menu, Menubar } from \"@stealthscale/component-disclosure\";\n\nconst MENUS = [\n [\"file\", [\"new\", \"open\", \"save\"]],\n [\"edit\", [\"undo\", \"redo\"]],\n [\"view\", [\"zoomIn\", \"zoomOut\"]],\n] as const;\n\nexport function Stop(): ReactElement {\n const { t } = useWords(\"menubar\");\n\n return (\n <Stack direction=\"row\" gap=\"md\" wrap>\n <Button variant=\"ghost\">\n <ArrowLeftIcon />\n {t(\"back\")}\n </Button>\n <Menubar.Root aria-label={t(\"label\")}>\n {MENUS.map(([menu, rows]) => (\n <Menubar.Menu key={menu} value={menu}>\n <Menubar.Trigger>{t(menu)}</Menubar.Trigger>\n <Portal>\n <Menubar.Content>\n {rows.map((row) => (\n <Menu.Item key={row} value={row}>\n {t(row)}\n </Menu.Item>\n ))}\n </Menubar.Content>\n </Portal>\n </Menubar.Menu>\n ))}\n </Menubar.Root>\n <Button>{t(\"publish\")}</Button>\n </Stack>\n );\n}\n";
|
|
1079
|
+
//#endregion
|
|
1080
|
+
//#region src/menubar/menubar.specimen.tsx
|
|
1081
|
+
/**
|
|
1082
|
+
* Catalogue page for the menubar.
|
|
1083
|
+
*
|
|
1084
|
+
* @remarks
|
|
1085
|
+
* `scenesOf` generates the sizes, one bar per row, and the palettes from the editor example. The
|
|
1086
|
+
* editor, options, icons, tab stop, right-to-left, folded and controlled scenes are hand-written,
|
|
1087
|
+
* because each shows a part or a behaviour that no axis sets. Every menu renders closed and
|
|
1088
|
+
* portals its panel to the document body, so a scene is as tall as its bar. The folded scene
|
|
1089
|
+
* renders in an `xs` room, which a bar of eight menus does not fit at any width. The words are
|
|
1090
|
+
* keys under `menubar` in `locales/en/specimen/menubar.json`.
|
|
1091
|
+
*/
|
|
1092
|
+
/**
|
|
1093
|
+
* Hand-written scene for an editor's bar with commands, keys, a separator and a submenu.
|
|
1094
|
+
*/
|
|
1095
|
+
const editor = {
|
|
1096
|
+
about: "menubar.editor.about",
|
|
1097
|
+
draw: () => /* @__PURE__ */ jsx(Editor, {}),
|
|
1098
|
+
example: editor_example_exports,
|
|
1099
|
+
title: "menubar.editor.title"
|
|
1100
|
+
};
|
|
1101
|
+
/**
|
|
1102
|
+
* Hand-written scene for checkbox and radio rows, and a name that reads the chosen radio.
|
|
1103
|
+
*/
|
|
1104
|
+
const options = {
|
|
1105
|
+
about: "menubar.options.about",
|
|
1106
|
+
draw: Options,
|
|
1107
|
+
example: options_example_exports,
|
|
1108
|
+
title: "menubar.options.title"
|
|
1109
|
+
};
|
|
1110
|
+
/**
|
|
1111
|
+
* Hand-written scene for rows that lead with an icon, an inset row and a critical row.
|
|
1112
|
+
*/
|
|
1113
|
+
const icons = {
|
|
1114
|
+
about: "menubar.icons.about",
|
|
1115
|
+
draw: Icons,
|
|
1116
|
+
example: icons_example_exports,
|
|
1117
|
+
title: "menubar.icons.title"
|
|
1118
|
+
};
|
|
1119
|
+
/**
|
|
1120
|
+
* Hand-written scene for the bar's one tab stop between two buttons.
|
|
1121
|
+
*/
|
|
1122
|
+
const stop = {
|
|
1123
|
+
about: "menubar.stop.about",
|
|
1124
|
+
draw: Stop,
|
|
1125
|
+
example: stop_example_exports,
|
|
1126
|
+
title: "menubar.stop.title"
|
|
1127
|
+
};
|
|
1128
|
+
/**
|
|
1129
|
+
* Hand-written scene for a bar in a right-to-left document.
|
|
1130
|
+
*/
|
|
1131
|
+
const rtl = {
|
|
1132
|
+
about: "menubar.rtl.about",
|
|
1133
|
+
draw: Rtl,
|
|
1134
|
+
example: rtl_example_exports,
|
|
1135
|
+
title: "menubar.rtl.title"
|
|
1136
|
+
};
|
|
1137
|
+
/**
|
|
1138
|
+
* Hand-written scene for a bar too narrow for its names, which folds into one menu.
|
|
1139
|
+
*/
|
|
1140
|
+
const folded = {
|
|
1141
|
+
about: "menubar.folded.about",
|
|
1142
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1143
|
+
size: "xs",
|
|
1144
|
+
children: /* @__PURE__ */ jsx(Folded, {})
|
|
1145
|
+
}),
|
|
1146
|
+
example: folded_example_exports,
|
|
1147
|
+
title: "menubar.folded.title"
|
|
1148
|
+
};
|
|
1149
|
+
/**
|
|
1150
|
+
* Hand-written scene for a bar whose open menu the caller keeps.
|
|
1151
|
+
*/
|
|
1152
|
+
const controlled = {
|
|
1153
|
+
about: "menubar.controlled.about",
|
|
1154
|
+
draw: Controlled,
|
|
1155
|
+
example: controlled_example_exports,
|
|
1156
|
+
title: "menubar.controlled.title"
|
|
1157
|
+
};
|
|
1158
|
+
var menubar_specimen_default = specimen({
|
|
1159
|
+
about: "menubar.about",
|
|
1160
|
+
id: "components/disclosure/menubar",
|
|
1161
|
+
imports: "import { Menubar } from \"@stealthscale/component-disclosure\";",
|
|
1162
|
+
scenes: [
|
|
1163
|
+
editor,
|
|
1164
|
+
...scenesOf(recipe, {
|
|
1165
|
+
axes: { size: { direction: "column" } },
|
|
1166
|
+
draw: (props) => /* @__PURE__ */ jsx(Editor, { ...props }),
|
|
1167
|
+
example: editor_example_exports,
|
|
1168
|
+
namespace: "menubar",
|
|
1169
|
+
order: ["size", "palette"]
|
|
1170
|
+
}),
|
|
1171
|
+
options,
|
|
1172
|
+
icons,
|
|
1173
|
+
stop,
|
|
1174
|
+
rtl,
|
|
1175
|
+
folded,
|
|
1176
|
+
controlled
|
|
1177
|
+
],
|
|
1178
|
+
title: "menubar.title"
|
|
1179
|
+
});
|
|
1180
|
+
//#endregion
|
|
1181
|
+
export { controlled, menubar_specimen_default as default, editor, folded, icons, options, rtl, stop };
|