@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.
- 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 +23 -14
- 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 +10 -9
- /package/dist/{recipe-95yCB2V3.js → recipes-95yCB2V3.js} +0 -0
|
@@ -0,0 +1,815 @@
|
|
|
1
|
+
import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { i as recipe } from "../../recipes-95yCB2V3.js";
|
|
3
|
+
import { C as CloseTrigger, S as selectionAfterClose, _ as Trigger, b as Indicator, v as Root, x as Content, y as List } from "../../shared-Cfsikh3X.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { ScrollArea } from "@stealthscale/component-primitives";
|
|
8
|
+
import { VisuallyHidden } from "@stealthscale/component-a11y";
|
|
9
|
+
import { Room, scenesOf, specimen, useWords } from "@stealthscale/specimen";
|
|
10
|
+
import { FileCodeIcon, FolderOpenIcon, RotateCcwIcon, XIcon } from "lucide-react";
|
|
11
|
+
import { Button } from "@stealthscale/component-actions";
|
|
12
|
+
import { Stack } from "@stealthscale/component-layout";
|
|
13
|
+
import { EmptyState } from "@stealthscale/component-feedback";
|
|
14
|
+
import { Status } from "@stealthscale/component-data";
|
|
15
|
+
//#region src/tabs/examples/account.example.tsx
|
|
16
|
+
var account_example_exports = /* @__PURE__ */ __exportAll({
|
|
17
|
+
Account: () => Account,
|
|
18
|
+
source: () => source$4
|
|
19
|
+
});
|
|
20
|
+
function Account(props) {
|
|
21
|
+
const $ = c(41);
|
|
22
|
+
const { t } = useWords("tabs");
|
|
23
|
+
let t0;
|
|
24
|
+
if ($[0] !== t) {
|
|
25
|
+
t0 = t("label");
|
|
26
|
+
$[0] = t;
|
|
27
|
+
$[1] = t0;
|
|
28
|
+
} else t0 = $[1];
|
|
29
|
+
let t1;
|
|
30
|
+
if ($[2] !== t) {
|
|
31
|
+
t1 = t("overview");
|
|
32
|
+
$[2] = t;
|
|
33
|
+
$[3] = t1;
|
|
34
|
+
} else t1 = $[3];
|
|
35
|
+
let t2;
|
|
36
|
+
if ($[4] !== t1) {
|
|
37
|
+
t2 = /* @__PURE__ */ jsx(Trigger, {
|
|
38
|
+
value: "overview",
|
|
39
|
+
children: t1
|
|
40
|
+
});
|
|
41
|
+
$[4] = t1;
|
|
42
|
+
$[5] = t2;
|
|
43
|
+
} else t2 = $[5];
|
|
44
|
+
let t3;
|
|
45
|
+
if ($[6] !== t) {
|
|
46
|
+
t3 = t("activity");
|
|
47
|
+
$[6] = t;
|
|
48
|
+
$[7] = t3;
|
|
49
|
+
} else t3 = $[7];
|
|
50
|
+
let t4;
|
|
51
|
+
if ($[8] !== t3) {
|
|
52
|
+
t4 = /* @__PURE__ */ jsx(Trigger, {
|
|
53
|
+
value: "activity",
|
|
54
|
+
children: t3
|
|
55
|
+
});
|
|
56
|
+
$[8] = t3;
|
|
57
|
+
$[9] = t4;
|
|
58
|
+
} else t4 = $[9];
|
|
59
|
+
let t5;
|
|
60
|
+
if ($[10] !== t) {
|
|
61
|
+
t5 = t("settings");
|
|
62
|
+
$[10] = t;
|
|
63
|
+
$[11] = t5;
|
|
64
|
+
} else t5 = $[11];
|
|
65
|
+
let t6;
|
|
66
|
+
if ($[12] !== t5) {
|
|
67
|
+
t6 = /* @__PURE__ */ jsx(Trigger, {
|
|
68
|
+
value: "settings",
|
|
69
|
+
children: t5
|
|
70
|
+
});
|
|
71
|
+
$[12] = t5;
|
|
72
|
+
$[13] = t6;
|
|
73
|
+
} else t6 = $[13];
|
|
74
|
+
let t7;
|
|
75
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
76
|
+
t7 = /* @__PURE__ */ jsx(Indicator, {});
|
|
77
|
+
$[14] = t7;
|
|
78
|
+
} else t7 = $[14];
|
|
79
|
+
let t8;
|
|
80
|
+
if ($[15] !== t0 || $[16] !== t2 || $[17] !== t4 || $[18] !== t6) {
|
|
81
|
+
t8 = /* @__PURE__ */ jsx(ScrollArea.Viewport, {
|
|
82
|
+
focusable: false,
|
|
83
|
+
children: /* @__PURE__ */ jsx(ScrollArea.Content, { children: /* @__PURE__ */ jsxs(List, {
|
|
84
|
+
"aria-label": t0,
|
|
85
|
+
children: [
|
|
86
|
+
t2,
|
|
87
|
+
t4,
|
|
88
|
+
t6,
|
|
89
|
+
t7
|
|
90
|
+
]
|
|
91
|
+
}) })
|
|
92
|
+
});
|
|
93
|
+
$[15] = t0;
|
|
94
|
+
$[16] = t2;
|
|
95
|
+
$[17] = t4;
|
|
96
|
+
$[18] = t6;
|
|
97
|
+
$[19] = t8;
|
|
98
|
+
} else t8 = $[19];
|
|
99
|
+
let t9;
|
|
100
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
101
|
+
t9 = /* @__PURE__ */ jsx(ScrollArea.Scrollbar, { orientation: "horizontal" });
|
|
102
|
+
$[20] = t9;
|
|
103
|
+
} else t9 = $[20];
|
|
104
|
+
let t10;
|
|
105
|
+
if ($[21] !== t8) {
|
|
106
|
+
t10 = /* @__PURE__ */ jsxs(ScrollArea.Root, {
|
|
107
|
+
fade: true,
|
|
108
|
+
inset: "xs",
|
|
109
|
+
scrolls: "horizontal",
|
|
110
|
+
children: [t8, t9]
|
|
111
|
+
});
|
|
112
|
+
$[21] = t8;
|
|
113
|
+
$[22] = t10;
|
|
114
|
+
} else t10 = $[22];
|
|
115
|
+
let t11;
|
|
116
|
+
if ($[23] !== t) {
|
|
117
|
+
t11 = t("holds");
|
|
118
|
+
$[23] = t;
|
|
119
|
+
$[24] = t11;
|
|
120
|
+
} else t11 = $[24];
|
|
121
|
+
let t12;
|
|
122
|
+
if ($[25] !== t11) {
|
|
123
|
+
t12 = /* @__PURE__ */ jsx(Content, {
|
|
124
|
+
value: "overview",
|
|
125
|
+
children: t11
|
|
126
|
+
});
|
|
127
|
+
$[25] = t11;
|
|
128
|
+
$[26] = t12;
|
|
129
|
+
} else t12 = $[26];
|
|
130
|
+
let t13;
|
|
131
|
+
if ($[27] !== t) {
|
|
132
|
+
t13 = t("lately");
|
|
133
|
+
$[27] = t;
|
|
134
|
+
$[28] = t13;
|
|
135
|
+
} else t13 = $[28];
|
|
136
|
+
let t14;
|
|
137
|
+
if ($[29] !== t13) {
|
|
138
|
+
t14 = /* @__PURE__ */ jsx(Content, {
|
|
139
|
+
value: "activity",
|
|
140
|
+
children: t13
|
|
141
|
+
});
|
|
142
|
+
$[29] = t13;
|
|
143
|
+
$[30] = t14;
|
|
144
|
+
} else t14 = $[30];
|
|
145
|
+
let t15;
|
|
146
|
+
if ($[31] !== t) {
|
|
147
|
+
t15 = t("tuned");
|
|
148
|
+
$[31] = t;
|
|
149
|
+
$[32] = t15;
|
|
150
|
+
} else t15 = $[32];
|
|
151
|
+
let t16;
|
|
152
|
+
if ($[33] !== t15) {
|
|
153
|
+
t16 = /* @__PURE__ */ jsx(Content, {
|
|
154
|
+
value: "settings",
|
|
155
|
+
children: t15
|
|
156
|
+
});
|
|
157
|
+
$[33] = t15;
|
|
158
|
+
$[34] = t16;
|
|
159
|
+
} else t16 = $[34];
|
|
160
|
+
let t17;
|
|
161
|
+
if ($[35] !== props || $[36] !== t10 || $[37] !== t12 || $[38] !== t14 || $[39] !== t16) {
|
|
162
|
+
t17 = /* @__PURE__ */ jsxs(Root, {
|
|
163
|
+
defaultValue: "overview",
|
|
164
|
+
...props,
|
|
165
|
+
children: [
|
|
166
|
+
t10,
|
|
167
|
+
t12,
|
|
168
|
+
t14,
|
|
169
|
+
t16
|
|
170
|
+
]
|
|
171
|
+
});
|
|
172
|
+
$[35] = props;
|
|
173
|
+
$[36] = t10;
|
|
174
|
+
$[37] = t12;
|
|
175
|
+
$[38] = t14;
|
|
176
|
+
$[39] = t16;
|
|
177
|
+
$[40] = t17;
|
|
178
|
+
} else t17 = $[40];
|
|
179
|
+
return t17;
|
|
180
|
+
}
|
|
181
|
+
const source$4 = "import { type ReactElement } from \"react\";\n\nimport { ScrollArea } from \"@stealthscale/component-primitives\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Tabs } from \"@stealthscale/component-disclosure\";\n\nexport function Account(props: Tabs.RootProps): ReactElement {\n const { t } = useWords(\"tabs\");\n\n return (\n <Tabs.Root defaultValue=\"overview\" {...props}>\n <ScrollArea.Root fade inset=\"xs\" scrolls=\"horizontal\">\n <ScrollArea.Viewport focusable={false}>\n <ScrollArea.Content>\n <Tabs.List aria-label={t(\"label\")}>\n <Tabs.Trigger value=\"overview\">{t(\"overview\")}</Tabs.Trigger>\n <Tabs.Trigger value=\"activity\">{t(\"activity\")}</Tabs.Trigger>\n <Tabs.Trigger value=\"settings\">{t(\"settings\")}</Tabs.Trigger>\n <Tabs.Indicator />\n </Tabs.List>\n </ScrollArea.Content>\n </ScrollArea.Viewport>\n <ScrollArea.Scrollbar orientation=\"horizontal\" />\n </ScrollArea.Root>\n <Tabs.Content value=\"overview\">{t(\"holds\")}</Tabs.Content>\n <Tabs.Content value=\"activity\">{t(\"lately\")}</Tabs.Content>\n <Tabs.Content value=\"settings\">{t(\"tuned\")}</Tabs.Content>\n </Tabs.Root>\n );\n}\n";
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/tabs/examples/drafts.example.tsx
|
|
184
|
+
var drafts_example_exports = /* @__PURE__ */ __exportAll({
|
|
185
|
+
Drafts: () => Drafts,
|
|
186
|
+
source: () => source$3
|
|
187
|
+
});
|
|
188
|
+
const DRAFTS = Array.from({ length: 14 }, (_, at) => String(1041 + at));
|
|
189
|
+
function Drafts() {
|
|
190
|
+
const $ = c(23);
|
|
191
|
+
const { t } = useWords("tabs");
|
|
192
|
+
const [open, setOpen] = useState(DRAFTS);
|
|
193
|
+
let t0;
|
|
194
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
195
|
+
t0 = (t1) => {
|
|
196
|
+
const { value } = t1;
|
|
197
|
+
setOpen((was) => was.filter((draft) => draft !== value));
|
|
198
|
+
};
|
|
199
|
+
$[0] = t0;
|
|
200
|
+
} else t0 = $[0];
|
|
201
|
+
let t1;
|
|
202
|
+
if ($[1] !== t) {
|
|
203
|
+
t1 = t("drafts.label");
|
|
204
|
+
$[1] = t;
|
|
205
|
+
$[2] = t1;
|
|
206
|
+
} else t1 = $[2];
|
|
207
|
+
let t2;
|
|
208
|
+
if ($[3] !== open || $[4] !== t) {
|
|
209
|
+
let t3;
|
|
210
|
+
if ($[6] !== t) {
|
|
211
|
+
t3 = (draft_0) => /* @__PURE__ */ jsxs(Trigger, {
|
|
212
|
+
closable: true,
|
|
213
|
+
value: draft_0,
|
|
214
|
+
children: [t("drafts.name", { number: draft_0 }), /* @__PURE__ */ jsx(CloseTrigger, {
|
|
215
|
+
label: t("drafts.close"),
|
|
216
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
217
|
+
})]
|
|
218
|
+
}, draft_0);
|
|
219
|
+
$[6] = t;
|
|
220
|
+
$[7] = t3;
|
|
221
|
+
} else t3 = $[7];
|
|
222
|
+
t2 = open.map(t3);
|
|
223
|
+
$[3] = open;
|
|
224
|
+
$[4] = t;
|
|
225
|
+
$[5] = t2;
|
|
226
|
+
} else t2 = $[5];
|
|
227
|
+
let t3;
|
|
228
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
229
|
+
t3 = /* @__PURE__ */ jsx(Indicator, {});
|
|
230
|
+
$[8] = t3;
|
|
231
|
+
} else t3 = $[8];
|
|
232
|
+
let t4;
|
|
233
|
+
if ($[9] !== t1 || $[10] !== t2) {
|
|
234
|
+
t4 = /* @__PURE__ */ jsx(ScrollArea.Viewport, {
|
|
235
|
+
focusable: false,
|
|
236
|
+
children: /* @__PURE__ */ jsx(ScrollArea.Content, { children: /* @__PURE__ */ jsxs(List, {
|
|
237
|
+
"aria-label": t1,
|
|
238
|
+
children: [t2, t3]
|
|
239
|
+
}) })
|
|
240
|
+
});
|
|
241
|
+
$[9] = t1;
|
|
242
|
+
$[10] = t2;
|
|
243
|
+
$[11] = t4;
|
|
244
|
+
} else t4 = $[11];
|
|
245
|
+
let t5;
|
|
246
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
247
|
+
t5 = /* @__PURE__ */ jsx(ScrollArea.Scrollbar, { orientation: "horizontal" });
|
|
248
|
+
$[12] = t5;
|
|
249
|
+
} else t5 = $[12];
|
|
250
|
+
let t6;
|
|
251
|
+
if ($[13] !== t4) {
|
|
252
|
+
t6 = /* @__PURE__ */ jsxs(ScrollArea.Root, {
|
|
253
|
+
fade: true,
|
|
254
|
+
inset: "xs",
|
|
255
|
+
scrolls: "horizontal",
|
|
256
|
+
children: [t4, t5]
|
|
257
|
+
});
|
|
258
|
+
$[13] = t4;
|
|
259
|
+
$[14] = t6;
|
|
260
|
+
} else t6 = $[14];
|
|
261
|
+
let t7;
|
|
262
|
+
if ($[15] !== open || $[16] !== t) {
|
|
263
|
+
let t8;
|
|
264
|
+
if ($[18] !== t) {
|
|
265
|
+
t8 = (draft_1) => /* @__PURE__ */ jsx(Content, {
|
|
266
|
+
value: draft_1,
|
|
267
|
+
children: t("drafts.body", { number: draft_1 })
|
|
268
|
+
}, draft_1);
|
|
269
|
+
$[18] = t;
|
|
270
|
+
$[19] = t8;
|
|
271
|
+
} else t8 = $[19];
|
|
272
|
+
t7 = open.map(t8);
|
|
273
|
+
$[15] = open;
|
|
274
|
+
$[16] = t;
|
|
275
|
+
$[17] = t7;
|
|
276
|
+
} else t7 = $[17];
|
|
277
|
+
let t8;
|
|
278
|
+
if ($[20] !== t6 || $[21] !== t7) {
|
|
279
|
+
t8 = /* @__PURE__ */ jsxs(Root, {
|
|
280
|
+
defaultValue: "1052",
|
|
281
|
+
onClose: t0,
|
|
282
|
+
children: [t6, t7]
|
|
283
|
+
});
|
|
284
|
+
$[20] = t6;
|
|
285
|
+
$[21] = t7;
|
|
286
|
+
$[22] = t8;
|
|
287
|
+
} else t8 = $[22];
|
|
288
|
+
return t8;
|
|
289
|
+
}
|
|
290
|
+
const source$3 = "import { type ReactElement, useState } from \"react\";\n\nimport { XIcon } from \"lucide-react\";\n\nimport { ScrollArea } from \"@stealthscale/component-primitives\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Tabs } from \"@stealthscale/component-disclosure\";\n\nconst DRAFTS = Array.from({ length: 14 }, (_, at) => String(1041 + at));\n\nexport function Drafts(): ReactElement {\n const { t } = useWords(\"tabs\");\n const [open, setOpen] = useState(DRAFTS);\n\n return (\n <Tabs.Root\n defaultValue=\"1052\"\n onClose={({ value }) => {\n setOpen((was) => was.filter((draft) => draft !== value));\n }}\n >\n <ScrollArea.Root fade inset=\"xs\" scrolls=\"horizontal\">\n <ScrollArea.Viewport focusable={false}>\n <ScrollArea.Content>\n <Tabs.List aria-label={t(\"drafts.label\")}>\n {open.map((draft) => (\n <Tabs.Trigger closable key={draft} value={draft}>\n {t(\"drafts.name\", { number: draft })}\n <Tabs.CloseTrigger label={t(\"drafts.close\")}>\n <XIcon />\n </Tabs.CloseTrigger>\n </Tabs.Trigger>\n ))}\n <Tabs.Indicator />\n </Tabs.List>\n </ScrollArea.Content>\n </ScrollArea.Viewport>\n <ScrollArea.Scrollbar orientation=\"horizontal\" />\n </ScrollArea.Root>\n {open.map((draft) => (\n <Tabs.Content key={draft} value={draft}>\n {t(\"drafts.body\", { number: draft })}\n </Tabs.Content>\n ))}\n </Tabs.Root>\n );\n}\n";
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/tabs/examples/files.example.tsx
|
|
293
|
+
var files_example_exports = /* @__PURE__ */ __exportAll({
|
|
294
|
+
Files: () => Files,
|
|
295
|
+
source: () => source$2
|
|
296
|
+
});
|
|
297
|
+
const FILES = [
|
|
298
|
+
"deploy",
|
|
299
|
+
"build",
|
|
300
|
+
"release",
|
|
301
|
+
"nightly"
|
|
302
|
+
];
|
|
303
|
+
const UNSAVED = "release";
|
|
304
|
+
function emptied(t, onReopen) {
|
|
305
|
+
return /* @__PURE__ */ jsx(EmptyState.Root, {
|
|
306
|
+
size: "sm",
|
|
307
|
+
children: /* @__PURE__ */ jsxs(EmptyState.Content, { children: [
|
|
308
|
+
/* @__PURE__ */ jsx(EmptyState.Indicator, { children: /* @__PURE__ */ jsx(FolderOpenIcon, {}) }),
|
|
309
|
+
/* @__PURE__ */ jsx(EmptyState.Title, {
|
|
310
|
+
as: "h3",
|
|
311
|
+
children: t("files.empty.title")
|
|
312
|
+
}),
|
|
313
|
+
/* @__PURE__ */ jsx(EmptyState.Description, { children: t("files.empty.about") }),
|
|
314
|
+
/* @__PURE__ */ jsx(Button, {
|
|
315
|
+
onClick: onReopen,
|
|
316
|
+
size: "sm",
|
|
317
|
+
variant: "outline",
|
|
318
|
+
children: t("files.empty.reopen")
|
|
319
|
+
})
|
|
320
|
+
] })
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
function Files() {
|
|
324
|
+
const $ = c(26);
|
|
325
|
+
const { t } = useWords("tabs");
|
|
326
|
+
const [open, setOpen] = useState(FILES);
|
|
327
|
+
if (open.length === 0) {
|
|
328
|
+
let t0;
|
|
329
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
330
|
+
t0 = () => {
|
|
331
|
+
setOpen(FILES);
|
|
332
|
+
};
|
|
333
|
+
$[0] = t0;
|
|
334
|
+
} else t0 = $[0];
|
|
335
|
+
let t1;
|
|
336
|
+
if ($[1] !== t) {
|
|
337
|
+
t1 = emptied(t, t0);
|
|
338
|
+
$[1] = t;
|
|
339
|
+
$[2] = t1;
|
|
340
|
+
} else t1 = $[2];
|
|
341
|
+
return t1;
|
|
342
|
+
}
|
|
343
|
+
let t0;
|
|
344
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
345
|
+
t0 = (t1) => {
|
|
346
|
+
const { value } = t1;
|
|
347
|
+
setOpen((was) => was.filter((file) => file !== value));
|
|
348
|
+
};
|
|
349
|
+
$[3] = t0;
|
|
350
|
+
} else t0 = $[3];
|
|
351
|
+
let t1;
|
|
352
|
+
if ($[4] !== t) {
|
|
353
|
+
t1 = t("files.label");
|
|
354
|
+
$[4] = t;
|
|
355
|
+
$[5] = t1;
|
|
356
|
+
} else t1 = $[5];
|
|
357
|
+
let t2;
|
|
358
|
+
if ($[6] !== open || $[7] !== t) {
|
|
359
|
+
let t3;
|
|
360
|
+
if ($[9] !== t) {
|
|
361
|
+
t3 = (file_0) => /* @__PURE__ */ jsxs(Trigger, {
|
|
362
|
+
closable: true,
|
|
363
|
+
value: file_0,
|
|
364
|
+
children: [
|
|
365
|
+
/* @__PURE__ */ jsx(FileCodeIcon, {}),
|
|
366
|
+
t(`files.names.${file_0}`),
|
|
367
|
+
file_0 === UNSAVED ? /* @__PURE__ */ jsxs(Status.Root, {
|
|
368
|
+
palette: "warning",
|
|
369
|
+
size: "inherit",
|
|
370
|
+
children: [/* @__PURE__ */ jsx(Status.Indicator, {}), /* @__PURE__ */ jsx(VisuallyHidden, { children: t("files.unsaved") })]
|
|
371
|
+
}) : null,
|
|
372
|
+
/* @__PURE__ */ jsx(CloseTrigger, {
|
|
373
|
+
label: t("files.close"),
|
|
374
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
375
|
+
})
|
|
376
|
+
]
|
|
377
|
+
}, file_0);
|
|
378
|
+
$[9] = t;
|
|
379
|
+
$[10] = t3;
|
|
380
|
+
} else t3 = $[10];
|
|
381
|
+
t2 = open.map(t3);
|
|
382
|
+
$[6] = open;
|
|
383
|
+
$[7] = t;
|
|
384
|
+
$[8] = t2;
|
|
385
|
+
} else t2 = $[8];
|
|
386
|
+
let t3;
|
|
387
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
388
|
+
t3 = /* @__PURE__ */ jsx(Indicator, {});
|
|
389
|
+
$[11] = t3;
|
|
390
|
+
} else t3 = $[11];
|
|
391
|
+
let t4;
|
|
392
|
+
if ($[12] !== t1 || $[13] !== t2) {
|
|
393
|
+
t4 = /* @__PURE__ */ jsx(ScrollArea.Viewport, {
|
|
394
|
+
focusable: false,
|
|
395
|
+
children: /* @__PURE__ */ jsx(ScrollArea.Content, { children: /* @__PURE__ */ jsxs(List, {
|
|
396
|
+
"aria-label": t1,
|
|
397
|
+
children: [t2, t3]
|
|
398
|
+
}) })
|
|
399
|
+
});
|
|
400
|
+
$[12] = t1;
|
|
401
|
+
$[13] = t2;
|
|
402
|
+
$[14] = t4;
|
|
403
|
+
} else t4 = $[14];
|
|
404
|
+
let t5;
|
|
405
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
406
|
+
t5 = /* @__PURE__ */ jsx(ScrollArea.Scrollbar, { orientation: "horizontal" });
|
|
407
|
+
$[15] = t5;
|
|
408
|
+
} else t5 = $[15];
|
|
409
|
+
let t6;
|
|
410
|
+
if ($[16] !== t4) {
|
|
411
|
+
t6 = /* @__PURE__ */ jsxs(ScrollArea.Root, {
|
|
412
|
+
fade: true,
|
|
413
|
+
inset: "xs",
|
|
414
|
+
scrolls: "horizontal",
|
|
415
|
+
children: [t4, t5]
|
|
416
|
+
});
|
|
417
|
+
$[16] = t4;
|
|
418
|
+
$[17] = t6;
|
|
419
|
+
} else t6 = $[17];
|
|
420
|
+
let t7;
|
|
421
|
+
if ($[18] !== open || $[19] !== t) {
|
|
422
|
+
let t8;
|
|
423
|
+
if ($[21] !== t) {
|
|
424
|
+
t8 = (file_1) => /* @__PURE__ */ jsx(Content, {
|
|
425
|
+
value: file_1,
|
|
426
|
+
children: t(`files.about.${file_1}`)
|
|
427
|
+
}, file_1);
|
|
428
|
+
$[21] = t;
|
|
429
|
+
$[22] = t8;
|
|
430
|
+
} else t8 = $[22];
|
|
431
|
+
t7 = open.map(t8);
|
|
432
|
+
$[18] = open;
|
|
433
|
+
$[19] = t;
|
|
434
|
+
$[20] = t7;
|
|
435
|
+
} else t7 = $[20];
|
|
436
|
+
let t8;
|
|
437
|
+
if ($[23] !== t6 || $[24] !== t7) {
|
|
438
|
+
t8 = /* @__PURE__ */ jsxs(Root, {
|
|
439
|
+
defaultValue: "build",
|
|
440
|
+
onClose: t0,
|
|
441
|
+
children: [t6, t7]
|
|
442
|
+
});
|
|
443
|
+
$[23] = t6;
|
|
444
|
+
$[24] = t7;
|
|
445
|
+
$[25] = t8;
|
|
446
|
+
} else t8 = $[25];
|
|
447
|
+
return t8;
|
|
448
|
+
}
|
|
449
|
+
const source$2 = "import { type ReactElement, useState } from \"react\";\n\nimport { FileCodeIcon, FolderOpenIcon, XIcon } from \"lucide-react\";\n\nimport { VisuallyHidden } from \"@stealthscale/component-a11y\";\nimport { Button } from \"@stealthscale/component-actions\";\nimport { Status } from \"@stealthscale/component-data\";\nimport { EmptyState } from \"@stealthscale/component-feedback\";\nimport { ScrollArea } from \"@stealthscale/component-primitives\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Tabs } from \"@stealthscale/component-disclosure\";\n\nconst FILES = [\"deploy\", \"build\", \"release\", \"nightly\"];\n\nconst UNSAVED = \"release\";\n\nfunction emptied(t: ReturnType<typeof useWords>[\"t\"], onReopen: () => void): ReactElement {\n return (\n <EmptyState.Root size=\"sm\">\n <EmptyState.Content>\n <EmptyState.Indicator>\n <FolderOpenIcon />\n </EmptyState.Indicator>\n <EmptyState.Title as=\"h3\">{t(\"files.empty.title\")}</EmptyState.Title>\n <EmptyState.Description>{t(\"files.empty.about\")}</EmptyState.Description>\n <Button onClick={onReopen} size=\"sm\" variant=\"outline\">\n {t(\"files.empty.reopen\")}\n </Button>\n </EmptyState.Content>\n </EmptyState.Root>\n );\n}\n\nexport function Files(): ReactElement {\n const { t } = useWords(\"tabs\");\n const [open, setOpen] = useState(FILES);\n\n if (open.length === 0) {\n return emptied(t, () => {\n setOpen(FILES);\n });\n }\n\n return (\n <Tabs.Root\n defaultValue=\"build\"\n onClose={({ value }) => {\n setOpen((was) => was.filter((file) => file !== value));\n }}\n >\n <ScrollArea.Root fade inset=\"xs\" scrolls=\"horizontal\">\n <ScrollArea.Viewport focusable={false}>\n <ScrollArea.Content>\n <Tabs.List aria-label={t(\"files.label\")}>\n {open.map((file) => (\n <Tabs.Trigger closable key={file} value={file}>\n <FileCodeIcon />\n {t(`files.names.${file}`)}\n {file === UNSAVED ? (\n <Status.Root palette=\"warning\" size=\"inherit\">\n <Status.Indicator />\n <VisuallyHidden>{t(\"files.unsaved\")}</VisuallyHidden>\n </Status.Root>\n ) : null}\n <Tabs.CloseTrigger label={t(\"files.close\")}>\n <XIcon />\n </Tabs.CloseTrigger>\n </Tabs.Trigger>\n ))}\n <Tabs.Indicator />\n </Tabs.List>\n </ScrollArea.Content>\n </ScrollArea.Viewport>\n <ScrollArea.Scrollbar orientation=\"horizontal\" />\n </ScrollArea.Root>\n {open.map((file) => (\n <Tabs.Content key={file} value={file}>\n {t(`files.about.${file}`)}\n </Tabs.Content>\n ))}\n </Tabs.Root>\n );\n}\n";
|
|
450
|
+
//#endregion
|
|
451
|
+
//#region src/tabs/examples/preferences.example.tsx
|
|
452
|
+
var preferences_example_exports = /* @__PURE__ */ __exportAll({
|
|
453
|
+
Preferences: () => Preferences,
|
|
454
|
+
source: () => source$1
|
|
455
|
+
});
|
|
456
|
+
const SECTIONS = [
|
|
457
|
+
"profile",
|
|
458
|
+
"security",
|
|
459
|
+
"billing",
|
|
460
|
+
"notifications"
|
|
461
|
+
];
|
|
462
|
+
function Preferences() {
|
|
463
|
+
const $ = c(13);
|
|
464
|
+
const { t } = useWords("tabs");
|
|
465
|
+
let t0;
|
|
466
|
+
if ($[0] !== t) {
|
|
467
|
+
t0 = t("preferences.label");
|
|
468
|
+
$[0] = t;
|
|
469
|
+
$[1] = t0;
|
|
470
|
+
} else t0 = $[1];
|
|
471
|
+
let t1;
|
|
472
|
+
if ($[2] !== t) {
|
|
473
|
+
t1 = SECTIONS.map((section) => /* @__PURE__ */ jsx(Trigger, {
|
|
474
|
+
value: section,
|
|
475
|
+
children: t(`preferences.names.${section}`)
|
|
476
|
+
}, section));
|
|
477
|
+
$[2] = t;
|
|
478
|
+
$[3] = t1;
|
|
479
|
+
} else t1 = $[3];
|
|
480
|
+
let t2;
|
|
481
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
482
|
+
t2 = /* @__PURE__ */ jsx(Indicator, {});
|
|
483
|
+
$[4] = t2;
|
|
484
|
+
} else t2 = $[4];
|
|
485
|
+
let t3;
|
|
486
|
+
if ($[5] !== t0 || $[6] !== t1) {
|
|
487
|
+
t3 = /* @__PURE__ */ jsxs(List, {
|
|
488
|
+
"aria-label": t0,
|
|
489
|
+
children: [t1, t2]
|
|
490
|
+
});
|
|
491
|
+
$[5] = t0;
|
|
492
|
+
$[6] = t1;
|
|
493
|
+
$[7] = t3;
|
|
494
|
+
} else t3 = $[7];
|
|
495
|
+
let t4;
|
|
496
|
+
if ($[8] !== t) {
|
|
497
|
+
t4 = SECTIONS.map((section_0) => /* @__PURE__ */ jsx(Content, {
|
|
498
|
+
value: section_0,
|
|
499
|
+
children: t(`preferences.bodies.${section_0}`)
|
|
500
|
+
}, section_0));
|
|
501
|
+
$[8] = t;
|
|
502
|
+
$[9] = t4;
|
|
503
|
+
} else t4 = $[9];
|
|
504
|
+
let t5;
|
|
505
|
+
if ($[10] !== t3 || $[11] !== t4) {
|
|
506
|
+
t5 = /* @__PURE__ */ jsxs(Root, {
|
|
507
|
+
defaultValue: "profile",
|
|
508
|
+
orientation: "vertical",
|
|
509
|
+
children: [t3, t4]
|
|
510
|
+
});
|
|
511
|
+
$[10] = t3;
|
|
512
|
+
$[11] = t4;
|
|
513
|
+
$[12] = t5;
|
|
514
|
+
} else t5 = $[12];
|
|
515
|
+
return t5;
|
|
516
|
+
}
|
|
517
|
+
const source$1 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Tabs } from \"@stealthscale/component-disclosure\";\n\nconst SECTIONS = [\"profile\", \"security\", \"billing\", \"notifications\"];\n\nexport function Preferences(): ReactElement {\n const { t } = useWords(\"tabs\");\n\n return (\n <Tabs.Root defaultValue=\"profile\" orientation=\"vertical\">\n <Tabs.List aria-label={t(\"preferences.label\")}>\n {SECTIONS.map((section) => (\n <Tabs.Trigger key={section} value={section}>\n {t(`preferences.names.${section}`)}\n </Tabs.Trigger>\n ))}\n <Tabs.Indicator />\n </Tabs.List>\n {SECTIONS.map((section) => (\n <Tabs.Content key={section} value={section}>\n {t(`preferences.bodies.${section}`)}\n </Tabs.Content>\n ))}\n </Tabs.Root>\n );\n}\n";
|
|
518
|
+
//#endregion
|
|
519
|
+
//#region src/tabs/examples/reader.example.tsx
|
|
520
|
+
var reader_example_exports = /* @__PURE__ */ __exportAll({
|
|
521
|
+
Reader: () => Reader,
|
|
522
|
+
source: () => source
|
|
523
|
+
});
|
|
524
|
+
const ARTICLES = [
|
|
525
|
+
"billing",
|
|
526
|
+
"invoices",
|
|
527
|
+
"refunds",
|
|
528
|
+
"disputes"
|
|
529
|
+
];
|
|
530
|
+
function listOf(open, t) {
|
|
531
|
+
return /* @__PURE__ */ jsxs(ScrollArea.Root, {
|
|
532
|
+
fade: true,
|
|
533
|
+
inset: "xs",
|
|
534
|
+
scrolls: "horizontal",
|
|
535
|
+
children: [/* @__PURE__ */ jsx(ScrollArea.Viewport, {
|
|
536
|
+
focusable: false,
|
|
537
|
+
children: /* @__PURE__ */ jsx(ScrollArea.Content, { children: /* @__PURE__ */ jsxs(List, {
|
|
538
|
+
"aria-label": t("reader.label"),
|
|
539
|
+
children: [open.map((article) => /* @__PURE__ */ jsxs(Trigger, {
|
|
540
|
+
closable: true,
|
|
541
|
+
value: article,
|
|
542
|
+
children: [t(`reader.names.${article}`), /* @__PURE__ */ jsx(CloseTrigger, {
|
|
543
|
+
label: t("reader.closeTab"),
|
|
544
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
545
|
+
})]
|
|
546
|
+
}, article)), /* @__PURE__ */ jsx(Indicator, {})]
|
|
547
|
+
}) })
|
|
548
|
+
}), /* @__PURE__ */ jsx(ScrollArea.Scrollbar, { orientation: "horizontal" })]
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
function Reader() {
|
|
552
|
+
const $ = c(41);
|
|
553
|
+
const { t } = useWords("tabs");
|
|
554
|
+
const [open, setOpen] = useState(ARTICLES);
|
|
555
|
+
const [value, setValue] = useState("invoices");
|
|
556
|
+
let t0;
|
|
557
|
+
if ($[0] !== open) {
|
|
558
|
+
t0 = (closed) => {
|
|
559
|
+
setValue((was) => selectionAfterClose(open, was, closed));
|
|
560
|
+
setOpen((was_0) => was_0.filter((article) => article !== closed));
|
|
561
|
+
};
|
|
562
|
+
$[0] = open;
|
|
563
|
+
$[1] = t0;
|
|
564
|
+
} else t0 = $[1];
|
|
565
|
+
const close = t0;
|
|
566
|
+
let t1;
|
|
567
|
+
if ($[2] !== close) {
|
|
568
|
+
t1 = (details) => {
|
|
569
|
+
close(details.value);
|
|
570
|
+
};
|
|
571
|
+
$[2] = close;
|
|
572
|
+
$[3] = t1;
|
|
573
|
+
} else t1 = $[3];
|
|
574
|
+
let t2;
|
|
575
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
576
|
+
t2 = (details_0) => {
|
|
577
|
+
setValue(details_0.value);
|
|
578
|
+
};
|
|
579
|
+
$[4] = t2;
|
|
580
|
+
} else t2 = $[4];
|
|
581
|
+
let t3;
|
|
582
|
+
if ($[5] !== open || $[6] !== t) {
|
|
583
|
+
t3 = listOf(open, t);
|
|
584
|
+
$[5] = open;
|
|
585
|
+
$[6] = t;
|
|
586
|
+
$[7] = t3;
|
|
587
|
+
} else t3 = $[7];
|
|
588
|
+
let t4;
|
|
589
|
+
if ($[8] !== open || $[9] !== t) {
|
|
590
|
+
let t5;
|
|
591
|
+
if ($[11] !== t) {
|
|
592
|
+
t5 = (article_0) => /* @__PURE__ */ jsx(Content, {
|
|
593
|
+
value: article_0,
|
|
594
|
+
children: t(`reader.bodies.${article_0}`)
|
|
595
|
+
}, article_0);
|
|
596
|
+
$[11] = t;
|
|
597
|
+
$[12] = t5;
|
|
598
|
+
} else t5 = $[12];
|
|
599
|
+
t4 = open.map(t5);
|
|
600
|
+
$[8] = open;
|
|
601
|
+
$[9] = t;
|
|
602
|
+
$[10] = t4;
|
|
603
|
+
} else t4 = $[10];
|
|
604
|
+
let t5;
|
|
605
|
+
if ($[13] !== t1 || $[14] !== t3 || $[15] !== t4 || $[16] !== value) {
|
|
606
|
+
t5 = /* @__PURE__ */ jsxs(Root, {
|
|
607
|
+
onClose: t1,
|
|
608
|
+
onValueChange: t2,
|
|
609
|
+
value,
|
|
610
|
+
children: [t3, t4]
|
|
611
|
+
});
|
|
612
|
+
$[13] = t1;
|
|
613
|
+
$[14] = t3;
|
|
614
|
+
$[15] = t4;
|
|
615
|
+
$[16] = value;
|
|
616
|
+
$[17] = t5;
|
|
617
|
+
} else t5 = $[17];
|
|
618
|
+
const t6 = value === null || void 0;
|
|
619
|
+
let t7;
|
|
620
|
+
if ($[18] !== close || $[19] !== value) {
|
|
621
|
+
t7 = () => {
|
|
622
|
+
if (value !== null) close(value);
|
|
623
|
+
};
|
|
624
|
+
$[18] = close;
|
|
625
|
+
$[19] = value;
|
|
626
|
+
$[20] = t7;
|
|
627
|
+
} else t7 = $[20];
|
|
628
|
+
let t8;
|
|
629
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
630
|
+
t8 = /* @__PURE__ */ jsx(XIcon, { size: "1em" });
|
|
631
|
+
$[21] = t8;
|
|
632
|
+
} else t8 = $[21];
|
|
633
|
+
let t9;
|
|
634
|
+
if ($[22] !== t) {
|
|
635
|
+
t9 = t("reader.close");
|
|
636
|
+
$[22] = t;
|
|
637
|
+
$[23] = t9;
|
|
638
|
+
} else t9 = $[23];
|
|
639
|
+
let t10;
|
|
640
|
+
if ($[24] !== t6 || $[25] !== t7 || $[26] !== t9) {
|
|
641
|
+
t10 = /* @__PURE__ */ jsxs(Button, {
|
|
642
|
+
"aria-disabled": t6,
|
|
643
|
+
onClick: t7,
|
|
644
|
+
size: "sm",
|
|
645
|
+
variant: "outline",
|
|
646
|
+
children: [t8, t9]
|
|
647
|
+
});
|
|
648
|
+
$[24] = t6;
|
|
649
|
+
$[25] = t7;
|
|
650
|
+
$[26] = t9;
|
|
651
|
+
$[27] = t10;
|
|
652
|
+
} else t10 = $[27];
|
|
653
|
+
const t11 = open.length === ARTICLES.length || void 0;
|
|
654
|
+
let t12;
|
|
655
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
656
|
+
t12 = () => {
|
|
657
|
+
setOpen(ARTICLES);
|
|
658
|
+
setValue(_temp);
|
|
659
|
+
};
|
|
660
|
+
$[28] = t12;
|
|
661
|
+
} else t12 = $[28];
|
|
662
|
+
let t13;
|
|
663
|
+
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
|
|
664
|
+
t13 = /* @__PURE__ */ jsx(RotateCcwIcon, { size: "1em" });
|
|
665
|
+
$[29] = t13;
|
|
666
|
+
} else t13 = $[29];
|
|
667
|
+
let t14;
|
|
668
|
+
if ($[30] !== t) {
|
|
669
|
+
t14 = t("reader.reopen");
|
|
670
|
+
$[30] = t;
|
|
671
|
+
$[31] = t14;
|
|
672
|
+
} else t14 = $[31];
|
|
673
|
+
let t15;
|
|
674
|
+
if ($[32] !== t11 || $[33] !== t14) {
|
|
675
|
+
t15 = /* @__PURE__ */ jsxs(Button, {
|
|
676
|
+
"aria-disabled": t11,
|
|
677
|
+
onClick: t12,
|
|
678
|
+
size: "sm",
|
|
679
|
+
variant: "outline",
|
|
680
|
+
children: [t13, t14]
|
|
681
|
+
});
|
|
682
|
+
$[32] = t11;
|
|
683
|
+
$[33] = t14;
|
|
684
|
+
$[34] = t15;
|
|
685
|
+
} else t15 = $[34];
|
|
686
|
+
let t16;
|
|
687
|
+
if ($[35] !== t10 || $[36] !== t15) {
|
|
688
|
+
t16 = /* @__PURE__ */ jsxs(Stack, {
|
|
689
|
+
direction: "row",
|
|
690
|
+
gap: "sm",
|
|
691
|
+
wrap: true,
|
|
692
|
+
children: [t10, t15]
|
|
693
|
+
});
|
|
694
|
+
$[35] = t10;
|
|
695
|
+
$[36] = t15;
|
|
696
|
+
$[37] = t16;
|
|
697
|
+
} else t16 = $[37];
|
|
698
|
+
let t17;
|
|
699
|
+
if ($[38] !== t16 || $[39] !== t5) {
|
|
700
|
+
t17 = /* @__PURE__ */ jsxs(Stack, {
|
|
701
|
+
align: "stretch",
|
|
702
|
+
gap: "md",
|
|
703
|
+
children: [t5, t16]
|
|
704
|
+
});
|
|
705
|
+
$[38] = t16;
|
|
706
|
+
$[39] = t5;
|
|
707
|
+
$[40] = t17;
|
|
708
|
+
} else t17 = $[40];
|
|
709
|
+
return t17;
|
|
710
|
+
}
|
|
711
|
+
function _temp(was_1) {
|
|
712
|
+
return was_1 ?? "billing";
|
|
713
|
+
}
|
|
714
|
+
const source = "import { type ReactElement, useState } from \"react\";\n\nimport { RotateCcwIcon, XIcon } from \"lucide-react\";\n\nimport { Button } from \"@stealthscale/component-actions\";\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { ScrollArea } from \"@stealthscale/component-primitives\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Tabs } from \"@stealthscale/component-disclosure\";\n\nconst ARTICLES = [\"billing\", \"invoices\", \"refunds\", \"disputes\"];\n\nfunction listOf(open: readonly string[], t: ReturnType<typeof useWords>[\"t\"]): ReactElement {\n return (\n <ScrollArea.Root fade inset=\"xs\" scrolls=\"horizontal\">\n <ScrollArea.Viewport focusable={false}>\n <ScrollArea.Content>\n <Tabs.List aria-label={t(\"reader.label\")}>\n {open.map((article) => (\n <Tabs.Trigger closable key={article} value={article}>\n {t(`reader.names.${article}`)}\n <Tabs.CloseTrigger label={t(\"reader.closeTab\")}>\n <XIcon />\n </Tabs.CloseTrigger>\n </Tabs.Trigger>\n ))}\n <Tabs.Indicator />\n </Tabs.List>\n </ScrollArea.Content>\n </ScrollArea.Viewport>\n <ScrollArea.Scrollbar orientation=\"horizontal\" />\n </ScrollArea.Root>\n );\n}\n\nexport function Reader(): ReactElement {\n const { t } = useWords(\"tabs\");\n const [open, setOpen] = useState(ARTICLES);\n const [value, setValue] = useState<null | string>(\"invoices\");\n\n const close = (closed: string): void => {\n setValue((was) => Tabs.selectionAfterClose(open, was, closed));\n setOpen((was) => was.filter((article) => article !== closed));\n };\n\n return (\n <Stack align=\"stretch\" gap=\"md\">\n <Tabs.Root\n onClose={(details) => {\n close(details.value);\n }}\n onValueChange={(details) => {\n setValue(details.value);\n }}\n value={value}\n >\n {listOf(open, t)}\n {open.map((article) => (\n <Tabs.Content key={article} value={article}>\n {t(`reader.bodies.${article}`)}\n </Tabs.Content>\n ))}\n </Tabs.Root>\n <Stack direction=\"row\" gap=\"sm\" wrap>\n <Button\n aria-disabled={value === null || undefined}\n onClick={() => {\n if (value !== null) close(value);\n }}\n size=\"sm\"\n variant=\"outline\"\n >\n <XIcon size=\"1em\" />\n {t(\"reader.close\")}\n </Button>\n <Button\n aria-disabled={open.length === ARTICLES.length || undefined}\n onClick={() => {\n setOpen(ARTICLES);\n setValue((was) => was ?? \"billing\");\n }}\n size=\"sm\"\n variant=\"outline\"\n >\n <RotateCcwIcon size=\"1em\" />\n {t(\"reader.reopen\")}\n </Button>\n </Stack>\n </Stack>\n );\n}\n";
|
|
715
|
+
//#endregion
|
|
716
|
+
//#region src/tabs/tabs.specimen.tsx
|
|
717
|
+
/**
|
|
718
|
+
* Catalogue page for the tabs.
|
|
719
|
+
*
|
|
720
|
+
* @remarks
|
|
721
|
+
* `scenesOf` generates the looks, palettes, sizes, fitted tabs and distributions from the account
|
|
722
|
+
* example, whose list scrolls sideways where the tabs are wider than their room. The fitted scene
|
|
723
|
+
* uses the enclosed look, where each tab's width shows. The orientation scene is hand-written,
|
|
724
|
+
* because the orientation is the machine's option and not an axis, and draws a vertical list of
|
|
725
|
+
* preferences. Three more hand-written scenes close tabs: files in a `2xl` room, drafts that
|
|
726
|
+
* overflow an `md` room, and a controlled list closed from outside. Each generated set renders in
|
|
727
|
+
* an `md` room, open on its first panel. The words are keys under `tabs` in
|
|
728
|
+
* `locales/en/specimen/tabs.json`.
|
|
729
|
+
*/
|
|
730
|
+
/**
|
|
731
|
+
* Hand-written scene for a vertical list.
|
|
732
|
+
*/
|
|
733
|
+
const orientation = {
|
|
734
|
+
about: "tabs.orientation.about",
|
|
735
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
736
|
+
size: "lg",
|
|
737
|
+
children: /* @__PURE__ */ jsx(Preferences, {})
|
|
738
|
+
}),
|
|
739
|
+
example: preferences_example_exports,
|
|
740
|
+
title: "tabs.orientation.title"
|
|
741
|
+
};
|
|
742
|
+
/**
|
|
743
|
+
* Hand-written scene for closable tabs over a list of files.
|
|
744
|
+
*/
|
|
745
|
+
const closing = {
|
|
746
|
+
about: "tabs.closing.about",
|
|
747
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
748
|
+
size: "2xl",
|
|
749
|
+
children: /* @__PURE__ */ jsx(Files, {})
|
|
750
|
+
}),
|
|
751
|
+
example: files_example_exports,
|
|
752
|
+
title: "tabs.closing.title"
|
|
753
|
+
};
|
|
754
|
+
/**
|
|
755
|
+
* Hand-written scene for a list of tabs wider than its room.
|
|
756
|
+
*/
|
|
757
|
+
const scrolling = {
|
|
758
|
+
about: "tabs.scrolling.about",
|
|
759
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
760
|
+
size: "md",
|
|
761
|
+
children: /* @__PURE__ */ jsx(Drafts, {})
|
|
762
|
+
}),
|
|
763
|
+
example: drafts_example_exports,
|
|
764
|
+
title: "tabs.scrolling.title"
|
|
765
|
+
};
|
|
766
|
+
/**
|
|
767
|
+
* Hand-written scene for a close from outside the list.
|
|
768
|
+
*/
|
|
769
|
+
const controlled = {
|
|
770
|
+
about: "tabs.controlled.about",
|
|
771
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
772
|
+
size: "md",
|
|
773
|
+
children: /* @__PURE__ */ jsx(Reader, {})
|
|
774
|
+
}),
|
|
775
|
+
example: reader_example_exports,
|
|
776
|
+
title: "tabs.controlled.title"
|
|
777
|
+
};
|
|
778
|
+
var tabs_specimen_default = specimen({
|
|
779
|
+
about: "tabs.about",
|
|
780
|
+
id: "components/disclosure/tabs",
|
|
781
|
+
imports: "import { Tabs } from \"@stealthscale/component-disclosure\";",
|
|
782
|
+
scenes: [
|
|
783
|
+
...scenesOf(recipe, {
|
|
784
|
+
axes: {
|
|
785
|
+
fitted: {
|
|
786
|
+
direction: "column",
|
|
787
|
+
with: { variant: "enclosed" }
|
|
788
|
+
},
|
|
789
|
+
justify: { direction: "column" },
|
|
790
|
+
size: { direction: "column" },
|
|
791
|
+
variant: { direction: "column" }
|
|
792
|
+
},
|
|
793
|
+
draw: (props) => /* @__PURE__ */ jsx(Room, {
|
|
794
|
+
size: "md",
|
|
795
|
+
children: /* @__PURE__ */ jsx(Account, { ...props })
|
|
796
|
+
}),
|
|
797
|
+
example: account_example_exports,
|
|
798
|
+
namespace: "tabs",
|
|
799
|
+
order: [
|
|
800
|
+
"variant",
|
|
801
|
+
"palette",
|
|
802
|
+
"size",
|
|
803
|
+
"fitted",
|
|
804
|
+
"justify"
|
|
805
|
+
]
|
|
806
|
+
}),
|
|
807
|
+
orientation,
|
|
808
|
+
closing,
|
|
809
|
+
scrolling,
|
|
810
|
+
controlled
|
|
811
|
+
],
|
|
812
|
+
title: "tabs.title"
|
|
813
|
+
});
|
|
814
|
+
//#endregion
|
|
815
|
+
export { closing, controlled, tabs_specimen_default as default, orientation, scrolling };
|