@stealthscale/component-screen 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cyclonedx/bom.json +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -8216
- package/dist/pages/action-bar/action-bar.js +471 -0
- package/dist/pages/action-bar/action-bar.props.js +3 -0
- package/dist/pages/app-shell/app-shell.js +4899 -0
- package/dist/pages/app-shell/app-shell.props.js +3 -0
- package/dist/pages/floating-panel/floating-panel.js +995 -0
- package/dist/pages/floating-panel/floating-panel.props.js +3 -0
- package/dist/pages/locale-switcher/locale-switcher.js +180 -0
- package/dist/pages/locale-switcher/locale-switcher.props.js +3 -0
- package/dist/pages/page/page.js +2308 -0
- package/dist/pages/page/page.props.js +3 -0
- package/dist/pages/pages.json +123 -0
- package/dist/pages/section/section.js +1241 -0
- package/dist/pages/section/section.props.js +3 -0
- package/dist/pages/sidebar/sidebar.js +1743 -0
- package/dist/pages/sidebar/sidebar.props.js +3 -0
- package/dist/pages/splitter/splitter.js +1563 -0
- package/dist/pages/splitter/splitter.props.js +3 -0
- package/dist/pages/switcher/switcher.js +900 -0
- package/dist/pages/switcher/switcher.props.js +3 -0
- package/dist/pages/theme-switcher/theme-switcher.js +180 -0
- package/dist/pages/theme-switcher/theme-switcher.props.js +3 -0
- package/dist/pages/toolbar/toolbar.js +1045 -0
- package/dist/pages/toolbar/toolbar.props.js +3 -0
- package/dist/{recipe-sZAQY6Kq.js → recipes-Cmy1leBm.js} +312 -30
- package/dist/shared-DxlFabHA.js +9547 -0
- package/dist/shell.js +1 -165
- package/dist/theme.js +3 -4
- package/locales/en/specimen/action-bar.json +46 -0
- package/locales/en/specimen/app-shell.json +288 -0
- package/locales/en/specimen/floating-panel.json +70 -0
- package/locales/en/specimen/locale-switcher.json +15 -0
- package/locales/en/specimen/page.json +198 -0
- package/locales/en/specimen/section.json +91 -0
- package/locales/en/specimen/sidebar.json +87 -0
- package/locales/en/specimen/splitter.json +93 -0
- package/locales/en/specimen/switcher.json +61 -0
- package/locales/en/specimen/theme-switcher.json +15 -0
- package/locales/en/specimen/toolbar.json +80 -0
- package/package.json +25 -24
- package/dist/recipe-DRMsitrw.js +0 -283
- package/dist/root-qEh4u7y5.js +0 -1182
|
@@ -0,0 +1,995 @@
|
|
|
1
|
+
import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { Ct as Header, Dt as CloseTrigger, Et as Content, Ot as Body, St as Positioner, Tt as Control, _t as Trigger, bt as Root, vt as Title, wt as DragTrigger, xt as ResizeTriggers, yt as StageTrigger } from "../../shared-DxlFabHA.js";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
4
|
+
import { Button } from "@stealthscale/component-actions";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { Portal } from "@stealthscale/component-primitives";
|
|
8
|
+
import { Field, Switch } from "@stealthscale/component-forms";
|
|
9
|
+
import { Group, Stack } from "@stealthscale/component-layout";
|
|
10
|
+
import { Sample, specimen, useWords } from "@stealthscale/specimen";
|
|
11
|
+
import { GripHorizontalIcon, Maximize2Icon, Minimize2Icon, MinusIcon, XIcon } from "lucide-react";
|
|
12
|
+
import { Text } from "@stealthscale/component-typography";
|
|
13
|
+
import { Avatar } from "@stealthscale/component-media";
|
|
14
|
+
import { DataList } from "@stealthscale/component-collections";
|
|
15
|
+
//#region src/floating-panel/examples/controlled.example.tsx
|
|
16
|
+
var controlled_example_exports = /* @__PURE__ */ __exportAll({
|
|
17
|
+
Controlled: () => Controlled,
|
|
18
|
+
source: () => source$5
|
|
19
|
+
});
|
|
20
|
+
const FIRST = {
|
|
21
|
+
height: 200,
|
|
22
|
+
width: 320
|
|
23
|
+
};
|
|
24
|
+
function Controlled() {
|
|
25
|
+
const $ = c(52);
|
|
26
|
+
const { t } = useWords("floating-panel");
|
|
27
|
+
const [open, setOpen] = useState(false);
|
|
28
|
+
let t0;
|
|
29
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
30
|
+
t0 = {
|
|
31
|
+
x: 0,
|
|
32
|
+
y: 0
|
|
33
|
+
};
|
|
34
|
+
$[0] = t0;
|
|
35
|
+
} else t0 = $[0];
|
|
36
|
+
const [place, setPlace] = useState(t0);
|
|
37
|
+
const [size, setSize] = useState(FIRST);
|
|
38
|
+
let t1;
|
|
39
|
+
let t2;
|
|
40
|
+
let t3;
|
|
41
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
42
|
+
t1 = (details) => {
|
|
43
|
+
setOpen(details.open);
|
|
44
|
+
};
|
|
45
|
+
t2 = (details_0) => {
|
|
46
|
+
setPlace(details_0.position);
|
|
47
|
+
};
|
|
48
|
+
t3 = (details_1) => {
|
|
49
|
+
setSize(details_1.size);
|
|
50
|
+
};
|
|
51
|
+
$[1] = t1;
|
|
52
|
+
$[2] = t2;
|
|
53
|
+
$[3] = t3;
|
|
54
|
+
} else {
|
|
55
|
+
t1 = $[1];
|
|
56
|
+
t2 = $[2];
|
|
57
|
+
t3 = $[3];
|
|
58
|
+
}
|
|
59
|
+
let t4;
|
|
60
|
+
if ($[4] !== t) {
|
|
61
|
+
t4 = t("controlled.trigger");
|
|
62
|
+
$[4] = t;
|
|
63
|
+
$[5] = t4;
|
|
64
|
+
} else t4 = $[5];
|
|
65
|
+
let t5;
|
|
66
|
+
if ($[6] !== t4) {
|
|
67
|
+
t5 = /* @__PURE__ */ jsx(Trigger, {
|
|
68
|
+
as: Button,
|
|
69
|
+
children: t4
|
|
70
|
+
});
|
|
71
|
+
$[6] = t4;
|
|
72
|
+
$[7] = t5;
|
|
73
|
+
} else t5 = $[7];
|
|
74
|
+
let t6;
|
|
75
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
76
|
+
t6 = /* @__PURE__ */ jsx(GripHorizontalIcon, { "aria-hidden": true });
|
|
77
|
+
$[8] = t6;
|
|
78
|
+
} else t6 = $[8];
|
|
79
|
+
let t7;
|
|
80
|
+
if ($[9] !== t) {
|
|
81
|
+
t7 = t("controlled.heading");
|
|
82
|
+
$[9] = t;
|
|
83
|
+
$[10] = t7;
|
|
84
|
+
} else t7 = $[10];
|
|
85
|
+
let t8;
|
|
86
|
+
if ($[11] !== t7) {
|
|
87
|
+
t8 = /* @__PURE__ */ jsxs(DragTrigger, { children: [t6, /* @__PURE__ */ jsx(Title, { children: t7 })] });
|
|
88
|
+
$[11] = t7;
|
|
89
|
+
$[12] = t8;
|
|
90
|
+
} else t8 = $[12];
|
|
91
|
+
let t9;
|
|
92
|
+
if ($[13] !== t) {
|
|
93
|
+
t9 = t("close");
|
|
94
|
+
$[13] = t;
|
|
95
|
+
$[14] = t9;
|
|
96
|
+
} else t9 = $[14];
|
|
97
|
+
let t10;
|
|
98
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
99
|
+
t10 = /* @__PURE__ */ jsx(XIcon, {});
|
|
100
|
+
$[15] = t10;
|
|
101
|
+
} else t10 = $[15];
|
|
102
|
+
let t11;
|
|
103
|
+
if ($[16] !== t9) {
|
|
104
|
+
t11 = /* @__PURE__ */ jsx(Control, { children: /* @__PURE__ */ jsx(CloseTrigger, {
|
|
105
|
+
label: t9,
|
|
106
|
+
children: t10
|
|
107
|
+
}) });
|
|
108
|
+
$[16] = t9;
|
|
109
|
+
$[17] = t11;
|
|
110
|
+
} else t11 = $[17];
|
|
111
|
+
let t12;
|
|
112
|
+
if ($[18] !== t11 || $[19] !== t8) {
|
|
113
|
+
t12 = /* @__PURE__ */ jsxs(Header, { children: [t8, t11] });
|
|
114
|
+
$[18] = t11;
|
|
115
|
+
$[19] = t8;
|
|
116
|
+
$[20] = t12;
|
|
117
|
+
} else t12 = $[20];
|
|
118
|
+
let t13;
|
|
119
|
+
if ($[21] !== t) {
|
|
120
|
+
t13 = t("controlled.body");
|
|
121
|
+
$[21] = t;
|
|
122
|
+
$[22] = t13;
|
|
123
|
+
} else t13 = $[22];
|
|
124
|
+
let t14;
|
|
125
|
+
if ($[23] !== t13) {
|
|
126
|
+
t14 = /* @__PURE__ */ jsx(Text, {
|
|
127
|
+
size: "sm",
|
|
128
|
+
children: t13
|
|
129
|
+
});
|
|
130
|
+
$[23] = t13;
|
|
131
|
+
$[24] = t14;
|
|
132
|
+
} else t14 = $[24];
|
|
133
|
+
let t15;
|
|
134
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
135
|
+
t15 = () => {
|
|
136
|
+
setSize(FIRST);
|
|
137
|
+
};
|
|
138
|
+
$[25] = t15;
|
|
139
|
+
} else t15 = $[25];
|
|
140
|
+
let t16;
|
|
141
|
+
if ($[26] !== t) {
|
|
142
|
+
t16 = t("controlled.reset");
|
|
143
|
+
$[26] = t;
|
|
144
|
+
$[27] = t16;
|
|
145
|
+
} else t16 = $[27];
|
|
146
|
+
let t17;
|
|
147
|
+
if ($[28] !== t16) {
|
|
148
|
+
t17 = /* @__PURE__ */ jsx(Button, {
|
|
149
|
+
onClick: t15,
|
|
150
|
+
size: "sm",
|
|
151
|
+
variant: "outline",
|
|
152
|
+
children: t16
|
|
153
|
+
});
|
|
154
|
+
$[28] = t16;
|
|
155
|
+
$[29] = t17;
|
|
156
|
+
} else t17 = $[29];
|
|
157
|
+
let t18;
|
|
158
|
+
if ($[30] !== t14 || $[31] !== t17) {
|
|
159
|
+
t18 = /* @__PURE__ */ jsx(Body, { children: /* @__PURE__ */ jsxs(Stack, {
|
|
160
|
+
align: "flex-start",
|
|
161
|
+
gap: "sm",
|
|
162
|
+
children: [t14, t17]
|
|
163
|
+
}) });
|
|
164
|
+
$[30] = t14;
|
|
165
|
+
$[31] = t17;
|
|
166
|
+
$[32] = t18;
|
|
167
|
+
} else t18 = $[32];
|
|
168
|
+
let t19;
|
|
169
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
170
|
+
t19 = /* @__PURE__ */ jsx(ResizeTriggers, {});
|
|
171
|
+
$[33] = t19;
|
|
172
|
+
} else t19 = $[33];
|
|
173
|
+
let t20;
|
|
174
|
+
if ($[34] !== t12 || $[35] !== t18) {
|
|
175
|
+
t20 = /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Positioner, { children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
176
|
+
t12,
|
|
177
|
+
t18,
|
|
178
|
+
t19
|
|
179
|
+
] }) }) });
|
|
180
|
+
$[34] = t12;
|
|
181
|
+
$[35] = t18;
|
|
182
|
+
$[36] = t20;
|
|
183
|
+
} else t20 = $[36];
|
|
184
|
+
let t21;
|
|
185
|
+
if ($[37] !== open || $[38] !== size || $[39] !== t20 || $[40] !== t5) {
|
|
186
|
+
t21 = /* @__PURE__ */ jsxs(Root, {
|
|
187
|
+
onOpenChange: t1,
|
|
188
|
+
onPositionChange: t2,
|
|
189
|
+
onSizeChange: t3,
|
|
190
|
+
open,
|
|
191
|
+
size,
|
|
192
|
+
children: [t5, t20]
|
|
193
|
+
});
|
|
194
|
+
$[37] = open;
|
|
195
|
+
$[38] = size;
|
|
196
|
+
$[39] = t20;
|
|
197
|
+
$[40] = t5;
|
|
198
|
+
$[41] = t21;
|
|
199
|
+
} else t21 = $[41];
|
|
200
|
+
let t22;
|
|
201
|
+
if ($[42] !== open || $[43] !== place || $[44] !== size || $[45] !== t) {
|
|
202
|
+
t22 = open ? t("controlled.place", {
|
|
203
|
+
...size,
|
|
204
|
+
x: Math.round(place.x),
|
|
205
|
+
y: Math.round(place.y)
|
|
206
|
+
}) : null;
|
|
207
|
+
$[42] = open;
|
|
208
|
+
$[43] = place;
|
|
209
|
+
$[44] = size;
|
|
210
|
+
$[45] = t;
|
|
211
|
+
$[46] = t22;
|
|
212
|
+
} else t22 = $[46];
|
|
213
|
+
let t23;
|
|
214
|
+
if ($[47] !== t22) {
|
|
215
|
+
t23 = /* @__PURE__ */ jsx(Text, {
|
|
216
|
+
as: "output",
|
|
217
|
+
size: "sm",
|
|
218
|
+
tone: "muted",
|
|
219
|
+
children: t22
|
|
220
|
+
});
|
|
221
|
+
$[47] = t22;
|
|
222
|
+
$[48] = t23;
|
|
223
|
+
} else t23 = $[48];
|
|
224
|
+
let t24;
|
|
225
|
+
if ($[49] !== t21 || $[50] !== t23) {
|
|
226
|
+
t24 = /* @__PURE__ */ jsxs(Stack, {
|
|
227
|
+
align: "flex-start",
|
|
228
|
+
gap: "sm",
|
|
229
|
+
children: [t21, t23]
|
|
230
|
+
});
|
|
231
|
+
$[49] = t21;
|
|
232
|
+
$[50] = t23;
|
|
233
|
+
$[51] = t24;
|
|
234
|
+
} else t24 = $[51];
|
|
235
|
+
return t24;
|
|
236
|
+
}
|
|
237
|
+
const source$5 = "import { type ReactElement, useState } from \"react\";\n\nimport { GripHorizontalIcon, XIcon } from \"lucide-react\";\n\nimport { Button } from \"@stealthscale/component-actions\";\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 { FloatingPanel } from \"@stealthscale/component-screen\";\n\nconst FIRST = { height: 200, width: 320 };\n\nexport function Controlled(): ReactElement {\n const { t } = useWords(\"floating-panel\");\n const [open, setOpen] = useState(false);\n const [place, setPlace] = useState({ x: 0, y: 0 });\n const [size, setSize] = useState(FIRST);\n\n return (\n <Stack align=\"flex-start\" gap=\"sm\">\n <FloatingPanel.Root\n onOpenChange={(details) => {\n setOpen(details.open);\n }}\n onPositionChange={(details) => {\n setPlace(details.position);\n }}\n onSizeChange={(details) => {\n setSize(details.size);\n }}\n open={open}\n size={size}\n >\n <FloatingPanel.Trigger as={Button}>{t(\"controlled.trigger\")}</FloatingPanel.Trigger>\n <Portal>\n <FloatingPanel.Positioner>\n <FloatingPanel.Content>\n <FloatingPanel.Header>\n <FloatingPanel.DragTrigger>\n <GripHorizontalIcon aria-hidden />\n <FloatingPanel.Title>{t(\"controlled.heading\")}</FloatingPanel.Title>\n </FloatingPanel.DragTrigger>\n <FloatingPanel.Control>\n <FloatingPanel.CloseTrigger label={t(\"close\")}>\n <XIcon />\n </FloatingPanel.CloseTrigger>\n </FloatingPanel.Control>\n </FloatingPanel.Header>\n <FloatingPanel.Body>\n <Stack align=\"flex-start\" gap=\"sm\">\n <Text size=\"sm\">{t(\"controlled.body\")}</Text>\n <Button\n onClick={() => {\n setSize(FIRST);\n }}\n size=\"sm\"\n variant=\"outline\"\n >\n {t(\"controlled.reset\")}\n </Button>\n </Stack>\n </FloatingPanel.Body>\n <FloatingPanel.ResizeTriggers />\n </FloatingPanel.Content>\n </FloatingPanel.Positioner>\n </Portal>\n </FloatingPanel.Root>\n <Text as=\"output\" size=\"sm\" tone=\"muted\">\n {open\n ? t(\"controlled.place\", { ...size, x: Math.round(place.x), y: Math.round(place.y) })\n : null}\n </Text>\n </Stack>\n );\n}\n";
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/floating-panel/examples/inspector.example.tsx
|
|
240
|
+
var inspector_example_exports = /* @__PURE__ */ __exportAll({
|
|
241
|
+
Inspector: () => Inspector,
|
|
242
|
+
source: () => source$4
|
|
243
|
+
});
|
|
244
|
+
const FIELDS = [{
|
|
245
|
+
name: "width",
|
|
246
|
+
value: "1200"
|
|
247
|
+
}, {
|
|
248
|
+
name: "height",
|
|
249
|
+
value: "630"
|
|
250
|
+
}];
|
|
251
|
+
function Inspector() {
|
|
252
|
+
const $ = c(49);
|
|
253
|
+
const { t } = useWords("floating-panel");
|
|
254
|
+
let t0;
|
|
255
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
256
|
+
t0 = {
|
|
257
|
+
height: 300,
|
|
258
|
+
width: 280
|
|
259
|
+
};
|
|
260
|
+
$[0] = t0;
|
|
261
|
+
} else t0 = $[0];
|
|
262
|
+
let t1;
|
|
263
|
+
if ($[1] !== t) {
|
|
264
|
+
t1 = t("inspector.trigger");
|
|
265
|
+
$[1] = t;
|
|
266
|
+
$[2] = t1;
|
|
267
|
+
} else t1 = $[2];
|
|
268
|
+
let t2;
|
|
269
|
+
if ($[3] !== t1) {
|
|
270
|
+
t2 = /* @__PURE__ */ jsx(Trigger, {
|
|
271
|
+
as: Button,
|
|
272
|
+
children: t1
|
|
273
|
+
});
|
|
274
|
+
$[3] = t1;
|
|
275
|
+
$[4] = t2;
|
|
276
|
+
} else t2 = $[4];
|
|
277
|
+
let t3;
|
|
278
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
279
|
+
t3 = /* @__PURE__ */ jsx(GripHorizontalIcon, { "aria-hidden": true });
|
|
280
|
+
$[5] = t3;
|
|
281
|
+
} else t3 = $[5];
|
|
282
|
+
let t4;
|
|
283
|
+
if ($[6] !== t) {
|
|
284
|
+
t4 = t("inspector.heading");
|
|
285
|
+
$[6] = t;
|
|
286
|
+
$[7] = t4;
|
|
287
|
+
} else t4 = $[7];
|
|
288
|
+
let t5;
|
|
289
|
+
if ($[8] !== t4) {
|
|
290
|
+
t5 = /* @__PURE__ */ jsxs(DragTrigger, { children: [t3, /* @__PURE__ */ jsx(Title, { children: t4 })] });
|
|
291
|
+
$[8] = t4;
|
|
292
|
+
$[9] = t5;
|
|
293
|
+
} else t5 = $[9];
|
|
294
|
+
let t6;
|
|
295
|
+
if ($[10] !== t) {
|
|
296
|
+
t6 = t("close");
|
|
297
|
+
$[10] = t;
|
|
298
|
+
$[11] = t6;
|
|
299
|
+
} else t6 = $[11];
|
|
300
|
+
let t7;
|
|
301
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
302
|
+
t7 = /* @__PURE__ */ jsx(XIcon, {});
|
|
303
|
+
$[12] = t7;
|
|
304
|
+
} else t7 = $[12];
|
|
305
|
+
let t8;
|
|
306
|
+
if ($[13] !== t6) {
|
|
307
|
+
t8 = /* @__PURE__ */ jsx(Control, { children: /* @__PURE__ */ jsx(CloseTrigger, {
|
|
308
|
+
label: t6,
|
|
309
|
+
children: t7
|
|
310
|
+
}) });
|
|
311
|
+
$[13] = t6;
|
|
312
|
+
$[14] = t8;
|
|
313
|
+
} else t8 = $[14];
|
|
314
|
+
let t9;
|
|
315
|
+
if ($[15] !== t5 || $[16] !== t8) {
|
|
316
|
+
t9 = /* @__PURE__ */ jsxs(Header, { children: [t5, t8] });
|
|
317
|
+
$[15] = t5;
|
|
318
|
+
$[16] = t8;
|
|
319
|
+
$[17] = t9;
|
|
320
|
+
} else t9 = $[17];
|
|
321
|
+
let t10;
|
|
322
|
+
if ($[18] !== t) {
|
|
323
|
+
t10 = t("inspector.name");
|
|
324
|
+
$[18] = t;
|
|
325
|
+
$[19] = t10;
|
|
326
|
+
} else t10 = $[19];
|
|
327
|
+
let t11;
|
|
328
|
+
if ($[20] !== t10) {
|
|
329
|
+
t11 = /* @__PURE__ */ jsx(Field.Label, { children: t10 });
|
|
330
|
+
$[20] = t10;
|
|
331
|
+
$[21] = t11;
|
|
332
|
+
} else t11 = $[21];
|
|
333
|
+
let t12;
|
|
334
|
+
if ($[22] !== t) {
|
|
335
|
+
t12 = t("inspector.value");
|
|
336
|
+
$[22] = t;
|
|
337
|
+
$[23] = t12;
|
|
338
|
+
} else t12 = $[23];
|
|
339
|
+
let t13;
|
|
340
|
+
if ($[24] !== t12) {
|
|
341
|
+
t13 = /* @__PURE__ */ jsx(Field.Control, { defaultValue: t12 });
|
|
342
|
+
$[24] = t12;
|
|
343
|
+
$[25] = t13;
|
|
344
|
+
} else t13 = $[25];
|
|
345
|
+
let t14;
|
|
346
|
+
if ($[26] !== t11 || $[27] !== t13) {
|
|
347
|
+
t14 = /* @__PURE__ */ jsxs(Field.Root, { children: [t11, t13] });
|
|
348
|
+
$[26] = t11;
|
|
349
|
+
$[27] = t13;
|
|
350
|
+
$[28] = t14;
|
|
351
|
+
} else t14 = $[28];
|
|
352
|
+
let t15;
|
|
353
|
+
if ($[29] !== t) {
|
|
354
|
+
t15 = FIELDS.map((t16) => {
|
|
355
|
+
const { name, value } = t16;
|
|
356
|
+
return /* @__PURE__ */ jsxs(Field.Root, { children: [/* @__PURE__ */ jsx(Field.Label, { children: t(`inspector.${name}`) }), /* @__PURE__ */ jsx(Field.Control, {
|
|
357
|
+
defaultValue: value,
|
|
358
|
+
inputMode: "numeric"
|
|
359
|
+
})] }, name);
|
|
360
|
+
});
|
|
361
|
+
$[29] = t;
|
|
362
|
+
$[30] = t15;
|
|
363
|
+
} else t15 = $[30];
|
|
364
|
+
let t16;
|
|
365
|
+
if ($[31] !== t15) {
|
|
366
|
+
t16 = /* @__PURE__ */ jsx(Group, {
|
|
367
|
+
gap: "sm",
|
|
368
|
+
children: t15
|
|
369
|
+
});
|
|
370
|
+
$[31] = t15;
|
|
371
|
+
$[32] = t16;
|
|
372
|
+
} else t16 = $[32];
|
|
373
|
+
let t17;
|
|
374
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
375
|
+
t17 = /* @__PURE__ */ jsx(Switch.Control, { children: /* @__PURE__ */ jsx(Switch.Thumb, {}) });
|
|
376
|
+
$[33] = t17;
|
|
377
|
+
} else t17 = $[33];
|
|
378
|
+
let t18;
|
|
379
|
+
if ($[34] !== t) {
|
|
380
|
+
t18 = t("inspector.locked");
|
|
381
|
+
$[34] = t;
|
|
382
|
+
$[35] = t18;
|
|
383
|
+
} else t18 = $[35];
|
|
384
|
+
let t19;
|
|
385
|
+
if ($[36] !== t18) {
|
|
386
|
+
t19 = /* @__PURE__ */ jsxs(Switch.Root, { children: [t17, /* @__PURE__ */ jsx(Switch.Label, { children: t18 })] });
|
|
387
|
+
$[36] = t18;
|
|
388
|
+
$[37] = t19;
|
|
389
|
+
} else t19 = $[37];
|
|
390
|
+
let t20;
|
|
391
|
+
if ($[38] !== t14 || $[39] !== t16 || $[40] !== t19) {
|
|
392
|
+
t20 = /* @__PURE__ */ jsx(Body, { children: /* @__PURE__ */ jsxs(Stack, {
|
|
393
|
+
gap: "md",
|
|
394
|
+
children: [
|
|
395
|
+
t14,
|
|
396
|
+
t16,
|
|
397
|
+
t19
|
|
398
|
+
]
|
|
399
|
+
}) });
|
|
400
|
+
$[38] = t14;
|
|
401
|
+
$[39] = t16;
|
|
402
|
+
$[40] = t19;
|
|
403
|
+
$[41] = t20;
|
|
404
|
+
} else t20 = $[41];
|
|
405
|
+
let t21;
|
|
406
|
+
if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
|
|
407
|
+
t21 = /* @__PURE__ */ jsx(ResizeTriggers, {});
|
|
408
|
+
$[42] = t21;
|
|
409
|
+
} else t21 = $[42];
|
|
410
|
+
let t22;
|
|
411
|
+
if ($[43] !== t20 || $[44] !== t9) {
|
|
412
|
+
t22 = /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Positioner, { children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
413
|
+
t9,
|
|
414
|
+
t20,
|
|
415
|
+
t21
|
|
416
|
+
] }) }) });
|
|
417
|
+
$[43] = t20;
|
|
418
|
+
$[44] = t9;
|
|
419
|
+
$[45] = t22;
|
|
420
|
+
} else t22 = $[45];
|
|
421
|
+
let t23;
|
|
422
|
+
if ($[46] !== t2 || $[47] !== t22) {
|
|
423
|
+
t23 = /* @__PURE__ */ jsxs(Root, {
|
|
424
|
+
defaultSize: t0,
|
|
425
|
+
getAnchorPosition: _temp,
|
|
426
|
+
children: [t2, t22]
|
|
427
|
+
});
|
|
428
|
+
$[46] = t2;
|
|
429
|
+
$[47] = t22;
|
|
430
|
+
$[48] = t23;
|
|
431
|
+
} else t23 = $[48];
|
|
432
|
+
return t23;
|
|
433
|
+
}
|
|
434
|
+
function _temp(t0) {
|
|
435
|
+
const { boundaryRect, triggerRect } = t0;
|
|
436
|
+
return {
|
|
437
|
+
x: Math.min(triggerRect?.left ?? 0, (boundaryRect?.width ?? 0) - 288),
|
|
438
|
+
y: Math.min((triggerRect?.bottom ?? 0) + 8, (boundaryRect?.height ?? 0) - 308)
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
const source$4 = "import { type ReactElement } from \"react\";\n\nimport { GripHorizontalIcon, XIcon } from \"lucide-react\";\n\nimport { Button } from \"@stealthscale/component-actions\";\nimport { Field, Switch } from \"@stealthscale/component-forms\";\nimport { Group, Stack } from \"@stealthscale/component-layout\";\nimport { Portal } from \"@stealthscale/component-primitives\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { FloatingPanel } from \"@stealthscale/component-screen\";\n\nconst FIELDS = [\n { name: \"width\", value: \"1200\" },\n { name: \"height\", value: \"630\" },\n] as const;\n\nexport function Inspector(): ReactElement {\n const { t } = useWords(\"floating-panel\");\n\n return (\n <FloatingPanel.Root\n defaultSize={{ height: 300, width: 280 }}\n getAnchorPosition={({ boundaryRect, triggerRect }) => ({\n x: Math.min(triggerRect?.left ?? 0, (boundaryRect?.width ?? 0) - 288),\n y: Math.min((triggerRect?.bottom ?? 0) + 8, (boundaryRect?.height ?? 0) - 308),\n })}\n >\n <FloatingPanel.Trigger as={Button}>{t(\"inspector.trigger\")}</FloatingPanel.Trigger>\n <Portal>\n <FloatingPanel.Positioner>\n <FloatingPanel.Content>\n <FloatingPanel.Header>\n <FloatingPanel.DragTrigger>\n <GripHorizontalIcon aria-hidden />\n <FloatingPanel.Title>{t(\"inspector.heading\")}</FloatingPanel.Title>\n </FloatingPanel.DragTrigger>\n <FloatingPanel.Control>\n <FloatingPanel.CloseTrigger label={t(\"close\")}>\n <XIcon />\n </FloatingPanel.CloseTrigger>\n </FloatingPanel.Control>\n </FloatingPanel.Header>\n <FloatingPanel.Body>\n <Stack gap=\"md\">\n <Field.Root>\n <Field.Label>{t(\"inspector.name\")}</Field.Label>\n <Field.Control defaultValue={t(\"inspector.value\")} />\n </Field.Root>\n <Group gap=\"sm\">\n {FIELDS.map(({ name, value }) => (\n <Field.Root key={name}>\n <Field.Label>{t(`inspector.${name}`)}</Field.Label>\n <Field.Control defaultValue={value} inputMode=\"numeric\" />\n </Field.Root>\n ))}\n </Group>\n <Switch.Root>\n <Switch.Control>\n <Switch.Thumb />\n </Switch.Control>\n <Switch.Label>{t(\"inspector.locked\")}</Switch.Label>\n </Switch.Root>\n </Stack>\n </FloatingPanel.Body>\n <FloatingPanel.ResizeTriggers />\n </FloatingPanel.Content>\n </FloatingPanel.Positioner>\n </Portal>\n </FloatingPanel.Root>\n );\n}\n";
|
|
442
|
+
//#endregion
|
|
443
|
+
//#region src/floating-panel/examples/notes.example.tsx
|
|
444
|
+
var notes_example_exports = /* @__PURE__ */ __exportAll({
|
|
445
|
+
Notes: () => Notes,
|
|
446
|
+
source: () => source$3
|
|
447
|
+
});
|
|
448
|
+
const STAGES = [
|
|
449
|
+
{
|
|
450
|
+
Icon: MinusIcon,
|
|
451
|
+
stage: "minimized",
|
|
452
|
+
word: "minimize"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
Icon: Maximize2Icon,
|
|
456
|
+
stage: "maximized",
|
|
457
|
+
word: "maximize"
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
Icon: Minimize2Icon,
|
|
461
|
+
stage: "default",
|
|
462
|
+
word: "restore"
|
|
463
|
+
}
|
|
464
|
+
];
|
|
465
|
+
function Notes() {
|
|
466
|
+
const $ = c(33);
|
|
467
|
+
const { t } = useWords("floating-panel");
|
|
468
|
+
let t0;
|
|
469
|
+
if ($[0] !== t) {
|
|
470
|
+
t0 = t("notes.trigger");
|
|
471
|
+
$[0] = t;
|
|
472
|
+
$[1] = t0;
|
|
473
|
+
} else t0 = $[1];
|
|
474
|
+
let t1;
|
|
475
|
+
if ($[2] !== t0) {
|
|
476
|
+
t1 = /* @__PURE__ */ jsx(Trigger, {
|
|
477
|
+
as: Button,
|
|
478
|
+
children: t0
|
|
479
|
+
});
|
|
480
|
+
$[2] = t0;
|
|
481
|
+
$[3] = t1;
|
|
482
|
+
} else t1 = $[3];
|
|
483
|
+
let t2;
|
|
484
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
485
|
+
t2 = /* @__PURE__ */ jsx(GripHorizontalIcon, { "aria-hidden": true });
|
|
486
|
+
$[4] = t2;
|
|
487
|
+
} else t2 = $[4];
|
|
488
|
+
let t3;
|
|
489
|
+
if ($[5] !== t) {
|
|
490
|
+
t3 = t("notes.heading");
|
|
491
|
+
$[5] = t;
|
|
492
|
+
$[6] = t3;
|
|
493
|
+
} else t3 = $[6];
|
|
494
|
+
let t4;
|
|
495
|
+
if ($[7] !== t3) {
|
|
496
|
+
t4 = /* @__PURE__ */ jsxs(DragTrigger, { children: [t2, /* @__PURE__ */ jsx(Title, { children: t3 })] });
|
|
497
|
+
$[7] = t3;
|
|
498
|
+
$[8] = t4;
|
|
499
|
+
} else t4 = $[8];
|
|
500
|
+
let t5;
|
|
501
|
+
if ($[9] !== t) {
|
|
502
|
+
t5 = STAGES.map((t6) => {
|
|
503
|
+
const { Icon, stage, word } = t6;
|
|
504
|
+
return /* @__PURE__ */ jsx(StageTrigger, {
|
|
505
|
+
label: t(word),
|
|
506
|
+
stage,
|
|
507
|
+
children: /* @__PURE__ */ jsx(Icon, {})
|
|
508
|
+
}, stage);
|
|
509
|
+
});
|
|
510
|
+
$[9] = t;
|
|
511
|
+
$[10] = t5;
|
|
512
|
+
} else t5 = $[10];
|
|
513
|
+
let t6;
|
|
514
|
+
if ($[11] !== t) {
|
|
515
|
+
t6 = t("close");
|
|
516
|
+
$[11] = t;
|
|
517
|
+
$[12] = t6;
|
|
518
|
+
} else t6 = $[12];
|
|
519
|
+
let t7;
|
|
520
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
521
|
+
t7 = /* @__PURE__ */ jsx(XIcon, {});
|
|
522
|
+
$[13] = t7;
|
|
523
|
+
} else t7 = $[13];
|
|
524
|
+
let t8;
|
|
525
|
+
if ($[14] !== t6) {
|
|
526
|
+
t8 = /* @__PURE__ */ jsx(CloseTrigger, {
|
|
527
|
+
label: t6,
|
|
528
|
+
children: t7
|
|
529
|
+
});
|
|
530
|
+
$[14] = t6;
|
|
531
|
+
$[15] = t8;
|
|
532
|
+
} else t8 = $[15];
|
|
533
|
+
let t9;
|
|
534
|
+
if ($[16] !== t5 || $[17] !== t8) {
|
|
535
|
+
t9 = /* @__PURE__ */ jsxs(Control, { children: [t5, t8] });
|
|
536
|
+
$[16] = t5;
|
|
537
|
+
$[17] = t8;
|
|
538
|
+
$[18] = t9;
|
|
539
|
+
} else t9 = $[18];
|
|
540
|
+
let t10;
|
|
541
|
+
if ($[19] !== t4 || $[20] !== t9) {
|
|
542
|
+
t10 = /* @__PURE__ */ jsxs(Header, { children: [t4, t9] });
|
|
543
|
+
$[19] = t4;
|
|
544
|
+
$[20] = t9;
|
|
545
|
+
$[21] = t10;
|
|
546
|
+
} else t10 = $[21];
|
|
547
|
+
let t11;
|
|
548
|
+
if ($[22] !== t) {
|
|
549
|
+
t11 = t("notes.body");
|
|
550
|
+
$[22] = t;
|
|
551
|
+
$[23] = t11;
|
|
552
|
+
} else t11 = $[23];
|
|
553
|
+
let t12;
|
|
554
|
+
if ($[24] !== t11) {
|
|
555
|
+
t12 = /* @__PURE__ */ jsx(Body, { children: /* @__PURE__ */ jsx(Text, {
|
|
556
|
+
size: "sm",
|
|
557
|
+
children: t11
|
|
558
|
+
}) });
|
|
559
|
+
$[24] = t11;
|
|
560
|
+
$[25] = t12;
|
|
561
|
+
} else t12 = $[25];
|
|
562
|
+
let t13;
|
|
563
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
564
|
+
t13 = /* @__PURE__ */ jsx(ResizeTriggers, {});
|
|
565
|
+
$[26] = t13;
|
|
566
|
+
} else t13 = $[26];
|
|
567
|
+
let t14;
|
|
568
|
+
if ($[27] !== t10 || $[28] !== t12) {
|
|
569
|
+
t14 = /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Positioner, { children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
570
|
+
t10,
|
|
571
|
+
t12,
|
|
572
|
+
t13
|
|
573
|
+
] }) }) });
|
|
574
|
+
$[27] = t10;
|
|
575
|
+
$[28] = t12;
|
|
576
|
+
$[29] = t14;
|
|
577
|
+
} else t14 = $[29];
|
|
578
|
+
let t15;
|
|
579
|
+
if ($[30] !== t1 || $[31] !== t14) {
|
|
580
|
+
t15 = /* @__PURE__ */ jsxs(Root, { children: [t1, t14] });
|
|
581
|
+
$[30] = t1;
|
|
582
|
+
$[31] = t14;
|
|
583
|
+
$[32] = t15;
|
|
584
|
+
} else t15 = $[32];
|
|
585
|
+
return t15;
|
|
586
|
+
}
|
|
587
|
+
const source$3 = "import { type ReactElement } from \"react\";\n\nimport { GripHorizontalIcon, Maximize2Icon, Minimize2Icon, MinusIcon, XIcon } from \"lucide-react\";\n\nimport { Button } from \"@stealthscale/component-actions\";\nimport { Portal } from \"@stealthscale/component-primitives\";\nimport { Text } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { FloatingPanel } from \"@stealthscale/component-screen\";\n\nconst STAGES = [\n { Icon: MinusIcon, stage: \"minimized\", word: \"minimize\" },\n { Icon: Maximize2Icon, stage: \"maximized\", word: \"maximize\" },\n { Icon: Minimize2Icon, stage: \"default\", word: \"restore\" },\n] as const;\n\nexport function Notes(): ReactElement {\n const { t } = useWords(\"floating-panel\");\n\n return (\n <FloatingPanel.Root>\n <FloatingPanel.Trigger as={Button}>{t(\"notes.trigger\")}</FloatingPanel.Trigger>\n <Portal>\n <FloatingPanel.Positioner>\n <FloatingPanel.Content>\n <FloatingPanel.Header>\n <FloatingPanel.DragTrigger>\n <GripHorizontalIcon aria-hidden />\n <FloatingPanel.Title>{t(\"notes.heading\")}</FloatingPanel.Title>\n </FloatingPanel.DragTrigger>\n <FloatingPanel.Control>\n {STAGES.map(({ Icon, stage, word }) => (\n <FloatingPanel.StageTrigger key={stage} label={t(word)} stage={stage}>\n <Icon />\n </FloatingPanel.StageTrigger>\n ))}\n <FloatingPanel.CloseTrigger label={t(\"close\")}>\n <XIcon />\n </FloatingPanel.CloseTrigger>\n </FloatingPanel.Control>\n </FloatingPanel.Header>\n <FloatingPanel.Body>\n <Text size=\"sm\">{t(\"notes.body\")}</Text>\n </FloatingPanel.Body>\n <FloatingPanel.ResizeTriggers />\n </FloatingPanel.Content>\n </FloatingPanel.Positioner>\n </Portal>\n </FloatingPanel.Root>\n );\n}\n";
|
|
588
|
+
//#endregion
|
|
589
|
+
//#region src/floating-panel/examples/preview.example.tsx
|
|
590
|
+
var preview_example_exports = /* @__PURE__ */ __exportAll({
|
|
591
|
+
Preview: () => Preview,
|
|
592
|
+
source: () => source$2
|
|
593
|
+
});
|
|
594
|
+
function Preview() {
|
|
595
|
+
const $ = c(39);
|
|
596
|
+
const { t } = useWords("floating-panel");
|
|
597
|
+
let t0;
|
|
598
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
599
|
+
t0 = {
|
|
600
|
+
height: 234,
|
|
601
|
+
width: 320
|
|
602
|
+
};
|
|
603
|
+
$[0] = t0;
|
|
604
|
+
} else t0 = $[0];
|
|
605
|
+
let t1;
|
|
606
|
+
let t2;
|
|
607
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
608
|
+
t1 = {
|
|
609
|
+
height: 468,
|
|
610
|
+
width: 640
|
|
611
|
+
};
|
|
612
|
+
t2 = {
|
|
613
|
+
height: 176,
|
|
614
|
+
width: 240
|
|
615
|
+
};
|
|
616
|
+
$[1] = t1;
|
|
617
|
+
$[2] = t2;
|
|
618
|
+
} else {
|
|
619
|
+
t1 = $[1];
|
|
620
|
+
t2 = $[2];
|
|
621
|
+
}
|
|
622
|
+
let t3;
|
|
623
|
+
if ($[3] !== t) {
|
|
624
|
+
t3 = t("preview.trigger");
|
|
625
|
+
$[3] = t;
|
|
626
|
+
$[4] = t3;
|
|
627
|
+
} else t3 = $[4];
|
|
628
|
+
let t4;
|
|
629
|
+
if ($[5] !== t3) {
|
|
630
|
+
t4 = /* @__PURE__ */ jsx(Trigger, {
|
|
631
|
+
as: Button,
|
|
632
|
+
children: t3
|
|
633
|
+
});
|
|
634
|
+
$[5] = t3;
|
|
635
|
+
$[6] = t4;
|
|
636
|
+
} else t4 = $[6];
|
|
637
|
+
let t5;
|
|
638
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
639
|
+
t5 = /* @__PURE__ */ jsx(GripHorizontalIcon, { "aria-hidden": true });
|
|
640
|
+
$[7] = t5;
|
|
641
|
+
} else t5 = $[7];
|
|
642
|
+
let t6;
|
|
643
|
+
if ($[8] !== t) {
|
|
644
|
+
t6 = t("preview.heading");
|
|
645
|
+
$[8] = t;
|
|
646
|
+
$[9] = t6;
|
|
647
|
+
} else t6 = $[9];
|
|
648
|
+
let t7;
|
|
649
|
+
if ($[10] !== t6) {
|
|
650
|
+
t7 = /* @__PURE__ */ jsxs(DragTrigger, { children: [t5, /* @__PURE__ */ jsx(Title, { children: t6 })] });
|
|
651
|
+
$[10] = t6;
|
|
652
|
+
$[11] = t7;
|
|
653
|
+
} else t7 = $[11];
|
|
654
|
+
let t8;
|
|
655
|
+
if ($[12] !== t) {
|
|
656
|
+
t8 = t("preview.leave");
|
|
657
|
+
$[12] = t;
|
|
658
|
+
$[13] = t8;
|
|
659
|
+
} else t8 = $[13];
|
|
660
|
+
let t9;
|
|
661
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
662
|
+
t9 = /* @__PURE__ */ jsx(XIcon, {});
|
|
663
|
+
$[14] = t9;
|
|
664
|
+
} else t9 = $[14];
|
|
665
|
+
let t10;
|
|
666
|
+
if ($[15] !== t8) {
|
|
667
|
+
t10 = /* @__PURE__ */ jsx(Control, { children: /* @__PURE__ */ jsx(CloseTrigger, {
|
|
668
|
+
label: t8,
|
|
669
|
+
children: t9
|
|
670
|
+
}) });
|
|
671
|
+
$[15] = t8;
|
|
672
|
+
$[16] = t10;
|
|
673
|
+
} else t10 = $[16];
|
|
674
|
+
let t11;
|
|
675
|
+
if ($[17] !== t10 || $[18] !== t7) {
|
|
676
|
+
t11 = /* @__PURE__ */ jsxs(Header, { children: [t7, t10] });
|
|
677
|
+
$[17] = t10;
|
|
678
|
+
$[18] = t7;
|
|
679
|
+
$[19] = t11;
|
|
680
|
+
} else t11 = $[19];
|
|
681
|
+
let t12;
|
|
682
|
+
if ($[20] !== t) {
|
|
683
|
+
t12 = t("preview.ada");
|
|
684
|
+
$[20] = t;
|
|
685
|
+
$[21] = t12;
|
|
686
|
+
} else t12 = $[21];
|
|
687
|
+
let t13;
|
|
688
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
689
|
+
t13 = /* @__PURE__ */ jsx(Avatar.Fallback, {});
|
|
690
|
+
$[22] = t13;
|
|
691
|
+
} else t13 = $[22];
|
|
692
|
+
let t14;
|
|
693
|
+
if ($[23] !== t12) {
|
|
694
|
+
t14 = /* @__PURE__ */ jsx(Avatar.Root, {
|
|
695
|
+
name: t12,
|
|
696
|
+
size: "lg",
|
|
697
|
+
children: t13
|
|
698
|
+
});
|
|
699
|
+
$[23] = t12;
|
|
700
|
+
$[24] = t14;
|
|
701
|
+
} else t14 = $[24];
|
|
702
|
+
let t15;
|
|
703
|
+
if ($[25] !== t) {
|
|
704
|
+
t15 = t("preview.speaking");
|
|
705
|
+
$[25] = t;
|
|
706
|
+
$[26] = t15;
|
|
707
|
+
} else t15 = $[26];
|
|
708
|
+
let t16;
|
|
709
|
+
if ($[27] !== t15) {
|
|
710
|
+
t16 = /* @__PURE__ */ jsx(Text, {
|
|
711
|
+
size: "sm",
|
|
712
|
+
tone: "muted",
|
|
713
|
+
children: t15
|
|
714
|
+
});
|
|
715
|
+
$[27] = t15;
|
|
716
|
+
$[28] = t16;
|
|
717
|
+
} else t16 = $[28];
|
|
718
|
+
let t17;
|
|
719
|
+
if ($[29] !== t14 || $[30] !== t16) {
|
|
720
|
+
t17 = /* @__PURE__ */ jsx(Body, { children: /* @__PURE__ */ jsxs(Group, {
|
|
721
|
+
align: "baseline",
|
|
722
|
+
gap: "sm",
|
|
723
|
+
children: [t14, t16]
|
|
724
|
+
}) });
|
|
725
|
+
$[29] = t14;
|
|
726
|
+
$[30] = t16;
|
|
727
|
+
$[31] = t17;
|
|
728
|
+
} else t17 = $[31];
|
|
729
|
+
let t18;
|
|
730
|
+
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
|
|
731
|
+
t18 = /* @__PURE__ */ jsx(ResizeTriggers, {});
|
|
732
|
+
$[32] = t18;
|
|
733
|
+
} else t18 = $[32];
|
|
734
|
+
let t19;
|
|
735
|
+
if ($[33] !== t11 || $[34] !== t17) {
|
|
736
|
+
t19 = /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Positioner, { children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
737
|
+
t11,
|
|
738
|
+
t17,
|
|
739
|
+
t18
|
|
740
|
+
] }) }) });
|
|
741
|
+
$[33] = t11;
|
|
742
|
+
$[34] = t17;
|
|
743
|
+
$[35] = t19;
|
|
744
|
+
} else t19 = $[35];
|
|
745
|
+
let t20;
|
|
746
|
+
if ($[36] !== t19 || $[37] !== t4) {
|
|
747
|
+
t20 = /* @__PURE__ */ jsxs(Root, {
|
|
748
|
+
defaultSize: t0,
|
|
749
|
+
lockAspectRatio: true,
|
|
750
|
+
maxSize: t1,
|
|
751
|
+
minSize: t2,
|
|
752
|
+
children: [t4, t19]
|
|
753
|
+
});
|
|
754
|
+
$[36] = t19;
|
|
755
|
+
$[37] = t4;
|
|
756
|
+
$[38] = t20;
|
|
757
|
+
} else t20 = $[38];
|
|
758
|
+
return t20;
|
|
759
|
+
}
|
|
760
|
+
const source$2 = "import { type ReactElement } from \"react\";\n\nimport { GripHorizontalIcon, XIcon } from \"lucide-react\";\n\nimport { Button } from \"@stealthscale/component-actions\";\nimport { Group } from \"@stealthscale/component-layout\";\nimport { Avatar } from \"@stealthscale/component-media\";\nimport { Portal } from \"@stealthscale/component-primitives\";\nimport { Text } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { FloatingPanel } from \"@stealthscale/component-screen\";\n\nexport function Preview(): ReactElement {\n const { t } = useWords(\"floating-panel\");\n\n return (\n <FloatingPanel.Root\n defaultSize={{ height: 234, width: 320 }}\n lockAspectRatio\n maxSize={{ height: 468, width: 640 }}\n minSize={{ height: 176, width: 240 }}\n >\n <FloatingPanel.Trigger as={Button}>{t(\"preview.trigger\")}</FloatingPanel.Trigger>\n <Portal>\n <FloatingPanel.Positioner>\n <FloatingPanel.Content>\n <FloatingPanel.Header>\n <FloatingPanel.DragTrigger>\n <GripHorizontalIcon aria-hidden />\n <FloatingPanel.Title>{t(\"preview.heading\")}</FloatingPanel.Title>\n </FloatingPanel.DragTrigger>\n <FloatingPanel.Control>\n <FloatingPanel.CloseTrigger label={t(\"preview.leave\")}>\n <XIcon />\n </FloatingPanel.CloseTrigger>\n </FloatingPanel.Control>\n </FloatingPanel.Header>\n <FloatingPanel.Body>\n <Group align=\"baseline\" gap=\"sm\">\n <Avatar.Root name={t(\"preview.ada\")} size=\"lg\">\n <Avatar.Fallback />\n </Avatar.Root>\n <Text size=\"sm\" tone=\"muted\">\n {t(\"preview.speaking\")}\n </Text>\n </Group>\n </FloatingPanel.Body>\n <FloatingPanel.ResizeTriggers />\n </FloatingPanel.Content>\n </FloatingPanel.Positioner>\n </Portal>\n </FloatingPanel.Root>\n );\n}\n";
|
|
761
|
+
//#endregion
|
|
762
|
+
//#region src/floating-panel/examples/snapped.example.tsx
|
|
763
|
+
var snapped_example_exports = /* @__PURE__ */ __exportAll({
|
|
764
|
+
Snapped: () => Snapped,
|
|
765
|
+
source: () => source$1
|
|
766
|
+
});
|
|
767
|
+
const SHORTCUTS = [
|
|
768
|
+
"bold",
|
|
769
|
+
"italic",
|
|
770
|
+
"link",
|
|
771
|
+
"undo"
|
|
772
|
+
];
|
|
773
|
+
function Snapped() {
|
|
774
|
+
const $ = c(31);
|
|
775
|
+
const { t } = useWords("floating-panel");
|
|
776
|
+
let t0;
|
|
777
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
778
|
+
t0 = {
|
|
779
|
+
height: 224,
|
|
780
|
+
width: 272
|
|
781
|
+
};
|
|
782
|
+
$[0] = t0;
|
|
783
|
+
} else t0 = $[0];
|
|
784
|
+
let t1;
|
|
785
|
+
let t2;
|
|
786
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
787
|
+
t1 = {
|
|
788
|
+
height: 480,
|
|
789
|
+
width: 480
|
|
790
|
+
};
|
|
791
|
+
t2 = {
|
|
792
|
+
height: 160,
|
|
793
|
+
width: 256
|
|
794
|
+
};
|
|
795
|
+
$[1] = t1;
|
|
796
|
+
$[2] = t2;
|
|
797
|
+
} else {
|
|
798
|
+
t1 = $[1];
|
|
799
|
+
t2 = $[2];
|
|
800
|
+
}
|
|
801
|
+
let t3;
|
|
802
|
+
if ($[3] !== t) {
|
|
803
|
+
t3 = t("snapped.trigger");
|
|
804
|
+
$[3] = t;
|
|
805
|
+
$[4] = t3;
|
|
806
|
+
} else t3 = $[4];
|
|
807
|
+
let t4;
|
|
808
|
+
if ($[5] !== t3) {
|
|
809
|
+
t4 = /* @__PURE__ */ jsx(Trigger, {
|
|
810
|
+
as: Button,
|
|
811
|
+
children: t3
|
|
812
|
+
});
|
|
813
|
+
$[5] = t3;
|
|
814
|
+
$[6] = t4;
|
|
815
|
+
} else t4 = $[6];
|
|
816
|
+
let t5;
|
|
817
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
818
|
+
t5 = /* @__PURE__ */ jsx(GripHorizontalIcon, { "aria-hidden": true });
|
|
819
|
+
$[7] = t5;
|
|
820
|
+
} else t5 = $[7];
|
|
821
|
+
let t6;
|
|
822
|
+
if ($[8] !== t) {
|
|
823
|
+
t6 = t("snapped.heading");
|
|
824
|
+
$[8] = t;
|
|
825
|
+
$[9] = t6;
|
|
826
|
+
} else t6 = $[9];
|
|
827
|
+
let t7;
|
|
828
|
+
if ($[10] !== t6) {
|
|
829
|
+
t7 = /* @__PURE__ */ jsxs(DragTrigger, { children: [t5, /* @__PURE__ */ jsx(Title, { children: t6 })] });
|
|
830
|
+
$[10] = t6;
|
|
831
|
+
$[11] = t7;
|
|
832
|
+
} else t7 = $[11];
|
|
833
|
+
let t8;
|
|
834
|
+
if ($[12] !== t) {
|
|
835
|
+
t8 = t("close");
|
|
836
|
+
$[12] = t;
|
|
837
|
+
$[13] = t8;
|
|
838
|
+
} else t8 = $[13];
|
|
839
|
+
let t9;
|
|
840
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
841
|
+
t9 = /* @__PURE__ */ jsx(XIcon, {});
|
|
842
|
+
$[14] = t9;
|
|
843
|
+
} else t9 = $[14];
|
|
844
|
+
let t10;
|
|
845
|
+
if ($[15] !== t8) {
|
|
846
|
+
t10 = /* @__PURE__ */ jsx(Control, { children: /* @__PURE__ */ jsx(CloseTrigger, {
|
|
847
|
+
label: t8,
|
|
848
|
+
children: t9
|
|
849
|
+
}) });
|
|
850
|
+
$[15] = t8;
|
|
851
|
+
$[16] = t10;
|
|
852
|
+
} else t10 = $[16];
|
|
853
|
+
let t11;
|
|
854
|
+
if ($[17] !== t10 || $[18] !== t7) {
|
|
855
|
+
t11 = /* @__PURE__ */ jsxs(Header, { children: [t7, t10] });
|
|
856
|
+
$[17] = t10;
|
|
857
|
+
$[18] = t7;
|
|
858
|
+
$[19] = t11;
|
|
859
|
+
} else t11 = $[19];
|
|
860
|
+
let t12;
|
|
861
|
+
if ($[20] !== t) {
|
|
862
|
+
t12 = SHORTCUTS.map((shortcut) => /* @__PURE__ */ jsxs(DataList.Item, { children: [/* @__PURE__ */ jsx(DataList.ItemLabel, { children: t(`snapped.shortcuts.${shortcut}.label`) }), /* @__PURE__ */ jsx(DataList.ItemValue, { children: t(`snapped.shortcuts.${shortcut}.keys`) })] }, shortcut));
|
|
863
|
+
$[20] = t;
|
|
864
|
+
$[21] = t12;
|
|
865
|
+
} else t12 = $[21];
|
|
866
|
+
let t13;
|
|
867
|
+
if ($[22] !== t12) {
|
|
868
|
+
t13 = /* @__PURE__ */ jsx(Body, { children: /* @__PURE__ */ jsx(DataList.Root, {
|
|
869
|
+
orientation: "horizontal",
|
|
870
|
+
size: "sm",
|
|
871
|
+
children: t12
|
|
872
|
+
}) });
|
|
873
|
+
$[22] = t12;
|
|
874
|
+
$[23] = t13;
|
|
875
|
+
} else t13 = $[23];
|
|
876
|
+
let t14;
|
|
877
|
+
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
878
|
+
t14 = /* @__PURE__ */ jsx(ResizeTriggers, {});
|
|
879
|
+
$[24] = t14;
|
|
880
|
+
} else t14 = $[24];
|
|
881
|
+
let t15;
|
|
882
|
+
if ($[25] !== t11 || $[26] !== t13) {
|
|
883
|
+
t15 = /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Positioner, { children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
884
|
+
t11,
|
|
885
|
+
t13,
|
|
886
|
+
t14
|
|
887
|
+
] }) }) });
|
|
888
|
+
$[25] = t11;
|
|
889
|
+
$[26] = t13;
|
|
890
|
+
$[27] = t15;
|
|
891
|
+
} else t15 = $[27];
|
|
892
|
+
let t16;
|
|
893
|
+
if ($[28] !== t15 || $[29] !== t4) {
|
|
894
|
+
t16 = /* @__PURE__ */ jsxs(Root, {
|
|
895
|
+
allowOverflow: false,
|
|
896
|
+
defaultSize: t0,
|
|
897
|
+
gridSize: 16,
|
|
898
|
+
maxSize: t1,
|
|
899
|
+
minSize: t2,
|
|
900
|
+
children: [t4, t15]
|
|
901
|
+
});
|
|
902
|
+
$[28] = t15;
|
|
903
|
+
$[29] = t4;
|
|
904
|
+
$[30] = t16;
|
|
905
|
+
} else t16 = $[30];
|
|
906
|
+
return t16;
|
|
907
|
+
}
|
|
908
|
+
const source$1 = "import { type ReactElement } from \"react\";\n\nimport { GripHorizontalIcon, XIcon } from \"lucide-react\";\n\nimport { Button } from \"@stealthscale/component-actions\";\nimport { DataList } from \"@stealthscale/component-collections\";\nimport { Portal } from \"@stealthscale/component-primitives\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { FloatingPanel } from \"@stealthscale/component-screen\";\n\nconst SHORTCUTS = [\"bold\", \"italic\", \"link\", \"undo\"] as const;\n\nexport function Snapped(): ReactElement {\n const { t } = useWords(\"floating-panel\");\n\n return (\n <FloatingPanel.Root\n allowOverflow={false}\n defaultSize={{ height: 224, width: 272 }}\n gridSize={16}\n maxSize={{ height: 480, width: 480 }}\n minSize={{ height: 160, width: 256 }}\n >\n <FloatingPanel.Trigger as={Button}>{t(\"snapped.trigger\")}</FloatingPanel.Trigger>\n <Portal>\n <FloatingPanel.Positioner>\n <FloatingPanel.Content>\n <FloatingPanel.Header>\n <FloatingPanel.DragTrigger>\n <GripHorizontalIcon aria-hidden />\n <FloatingPanel.Title>{t(\"snapped.heading\")}</FloatingPanel.Title>\n </FloatingPanel.DragTrigger>\n <FloatingPanel.Control>\n <FloatingPanel.CloseTrigger label={t(\"close\")}>\n <XIcon />\n </FloatingPanel.CloseTrigger>\n </FloatingPanel.Control>\n </FloatingPanel.Header>\n <FloatingPanel.Body>\n <DataList.Root orientation=\"horizontal\" size=\"sm\">\n {SHORTCUTS.map((shortcut) => (\n <DataList.Item key={shortcut}>\n <DataList.ItemLabel>\n {t(`snapped.shortcuts.${shortcut}.label`)}\n </DataList.ItemLabel>\n <DataList.ItemValue>\n {t(`snapped.shortcuts.${shortcut}.keys`)}\n </DataList.ItemValue>\n </DataList.Item>\n ))}\n </DataList.Root>\n </FloatingPanel.Body>\n <FloatingPanel.ResizeTriggers />\n </FloatingPanel.Content>\n </FloatingPanel.Positioner>\n </Portal>\n </FloatingPanel.Root>\n );\n}\n";
|
|
909
|
+
//#endregion
|
|
910
|
+
//#region src/floating-panel/examples/stacked.example.tsx
|
|
911
|
+
var stacked_example_exports = /* @__PURE__ */ __exportAll({
|
|
912
|
+
Stacked: () => Stacked,
|
|
913
|
+
source: () => source
|
|
914
|
+
});
|
|
915
|
+
const PANELS = ["layers", "history"];
|
|
916
|
+
function placed(step) {
|
|
917
|
+
return ({ boundaryRect }) => ({
|
|
918
|
+
x: (boundaryRect?.width ?? 0) / 2 - 144 + step * 32,
|
|
919
|
+
y: (boundaryRect?.height ?? 0) / 2 - 112 + step * 32
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
function Stacked() {
|
|
923
|
+
const $ = c(4);
|
|
924
|
+
const { t } = useWords("floating-panel");
|
|
925
|
+
let t0;
|
|
926
|
+
if ($[0] !== t) {
|
|
927
|
+
t0 = PANELS.map((name, step) => /* @__PURE__ */ jsxs(Root, {
|
|
928
|
+
defaultSize: {
|
|
929
|
+
height: 192,
|
|
930
|
+
width: 256
|
|
931
|
+
},
|
|
932
|
+
getAnchorPosition: placed(step),
|
|
933
|
+
children: [/* @__PURE__ */ jsx(Trigger, {
|
|
934
|
+
as: Button,
|
|
935
|
+
children: t(`stacked.${name}.trigger`)
|
|
936
|
+
}), /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Positioner, { children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
937
|
+
/* @__PURE__ */ jsxs(Header, { children: [/* @__PURE__ */ jsxs(DragTrigger, { children: [/* @__PURE__ */ jsx(GripHorizontalIcon, { "aria-hidden": true }), /* @__PURE__ */ jsx(Title, { children: t(`stacked.${name}.heading`) })] }), /* @__PURE__ */ jsx(Control, { children: /* @__PURE__ */ jsx(CloseTrigger, {
|
|
938
|
+
label: t("close"),
|
|
939
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
940
|
+
}) })] }),
|
|
941
|
+
/* @__PURE__ */ jsx(Body, { children: /* @__PURE__ */ jsx(Text, {
|
|
942
|
+
size: "sm",
|
|
943
|
+
children: t(`stacked.${name}.body`)
|
|
944
|
+
}) }),
|
|
945
|
+
/* @__PURE__ */ jsx(ResizeTriggers, {})
|
|
946
|
+
] }) }) })]
|
|
947
|
+
}, name));
|
|
948
|
+
$[0] = t;
|
|
949
|
+
$[1] = t0;
|
|
950
|
+
} else t0 = $[1];
|
|
951
|
+
let t1;
|
|
952
|
+
if ($[2] !== t0) {
|
|
953
|
+
t1 = /* @__PURE__ */ jsx(Group, {
|
|
954
|
+
gap: "sm",
|
|
955
|
+
children: t0
|
|
956
|
+
});
|
|
957
|
+
$[2] = t0;
|
|
958
|
+
$[3] = t1;
|
|
959
|
+
} else t1 = $[3];
|
|
960
|
+
return t1;
|
|
961
|
+
}
|
|
962
|
+
const source = "import { type ReactElement } from \"react\";\n\nimport { GripHorizontalIcon, XIcon } from \"lucide-react\";\n\nimport { Button } from \"@stealthscale/component-actions\";\nimport { Group } from \"@stealthscale/component-layout\";\nimport { Portal } from \"@stealthscale/component-primitives\";\nimport { Text } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { FloatingPanel } from \"@stealthscale/component-screen\";\n\nconst PANELS = [\"layers\", \"history\"] as const;\n\nfunction placed(\n step: number,\n): (details: FloatingPanel.AnchorPositionDetails) => FloatingPanel.Point {\n return ({ boundaryRect }) => ({\n x: (boundaryRect?.width ?? 0) / 2 - 144 + step * 32,\n y: (boundaryRect?.height ?? 0) / 2 - 112 + step * 32,\n });\n}\n\nexport function Stacked(): ReactElement {\n const { t } = useWords(\"floating-panel\");\n\n return (\n <Group gap=\"sm\">\n {PANELS.map((name, step) => (\n <FloatingPanel.Root\n defaultSize={{ height: 192, width: 256 }}\n getAnchorPosition={placed(step)}\n key={name}\n >\n <FloatingPanel.Trigger as={Button}>{t(`stacked.${name}.trigger`)}</FloatingPanel.Trigger>\n <Portal>\n <FloatingPanel.Positioner>\n <FloatingPanel.Content>\n <FloatingPanel.Header>\n <FloatingPanel.DragTrigger>\n <GripHorizontalIcon aria-hidden />\n <FloatingPanel.Title>{t(`stacked.${name}.heading`)}</FloatingPanel.Title>\n </FloatingPanel.DragTrigger>\n <FloatingPanel.Control>\n <FloatingPanel.CloseTrigger label={t(\"close\")}>\n <XIcon />\n </FloatingPanel.CloseTrigger>\n </FloatingPanel.Control>\n </FloatingPanel.Header>\n <FloatingPanel.Body>\n <Text size=\"sm\">{t(`stacked.${name}.body`)}</Text>\n </FloatingPanel.Body>\n <FloatingPanel.ResizeTriggers />\n </FloatingPanel.Content>\n </FloatingPanel.Positioner>\n </Portal>\n </FloatingPanel.Root>\n ))}\n </Group>\n );\n}\n";
|
|
963
|
+
//#endregion
|
|
964
|
+
//#region src/floating-panel/floating-panel.specimen.tsx
|
|
965
|
+
/**
|
|
966
|
+
* Returns a scene that renders an example in a sample at the start of the scene.
|
|
967
|
+
*
|
|
968
|
+
* @param name - The example's key under `floating-panel` in the words.
|
|
969
|
+
* @param example - The example module.
|
|
970
|
+
* @param Example - The example's component.
|
|
971
|
+
*/
|
|
972
|
+
function sampled(name, example, Example) {
|
|
973
|
+
return {
|
|
974
|
+
about: `floating-panel.${name}.about`,
|
|
975
|
+
draw: () => /* @__PURE__ */ jsx(Sample, { children: /* @__PURE__ */ jsx(Example, {}) }),
|
|
976
|
+
example,
|
|
977
|
+
title: `floating-panel.${name}.title`
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
var floating_panel_specimen_default = specimen({
|
|
981
|
+
about: "floating-panel.about",
|
|
982
|
+
id: "components/screen/floating-panel",
|
|
983
|
+
imports: "import { FloatingPanel } from \"@stealthscale/component-screen\";",
|
|
984
|
+
scenes: [
|
|
985
|
+
sampled("notes", notes_example_exports, Notes),
|
|
986
|
+
sampled("inspector", inspector_example_exports, Inspector),
|
|
987
|
+
sampled("controlled", controlled_example_exports, Controlled),
|
|
988
|
+
sampled("stacked", stacked_example_exports, Stacked),
|
|
989
|
+
sampled("snapped", snapped_example_exports, Snapped),
|
|
990
|
+
sampled("preview", preview_example_exports, Preview)
|
|
991
|
+
],
|
|
992
|
+
title: "floating-panel.title"
|
|
993
|
+
});
|
|
994
|
+
//#endregion
|
|
995
|
+
export { floating_panel_specimen_default as default };
|