@stealthscale/component-collections 0.1.1 → 0.1.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.js +1 -5700
- package/dist/pages/data-list/data-list.js +351 -0
- package/dist/pages/data-list/data-list.props.js +3 -0
- package/dist/pages/listbox/listbox.js +1277 -0
- package/dist/pages/listbox/listbox.props.js +3 -0
- package/dist/pages/pages.json +105 -0
- package/dist/pages/sortable/sortable.js +576 -0
- package/dist/pages/sortable/sortable.props.js +3 -0
- package/dist/pages/status-matrix/status-matrix.js +1403 -0
- package/dist/pages/status-matrix/status-matrix.props.js +3 -0
- package/dist/pages/swipe-actions/swipe-actions.js +212 -0
- package/dist/pages/swipe-actions/swipe-actions.props.js +3 -0
- package/dist/pages/table/table.js +1701 -0
- package/dist/pages/table/table.props.js +3 -0
- package/dist/pages/timeline/timeline.js +380 -0
- package/dist/pages/timeline/timeline.props.js +3 -0
- package/dist/pages/transfer/transfer.js +465 -0
- package/dist/pages/transfer/transfer.props.js +3 -0
- package/dist/pages/tree-view/tree-view.js +1059 -0
- package/dist/pages/tree-view/tree-view.props.js +3 -0
- package/dist/shared-DVn824MJ.js +5701 -0
- package/dist/theme.js +23 -13
- package/locales/en/specimen/data-list.json +64 -0
- package/locales/en/specimen/listbox.json +98 -0
- package/locales/en/specimen/sortable.json +65 -0
- package/locales/en/specimen/status-matrix.json +47 -0
- package/locales/en/specimen/swipe-actions.json +32 -0
- package/locales/en/specimen/table.json +94 -0
- package/locales/en/specimen/timeline.json +72 -0
- package/locales/en/specimen/transfer.json +34 -0
- package/locales/en/specimen/tree-view.json +107 -0
- package/package.json +10 -9
- /package/dist/{recipe-C1oaF8pO.js → recipes-C1oaF8pO.js} +0 -0
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { h as Transfer } from "../../shared-DVn824MJ.js";
|
|
3
|
+
import { r as recipe } from "../../recipes-C1oaF8pO.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Room, scenesOf, specimen, useWords } from "@stealthscale/specimen";
|
|
8
|
+
import { CheckIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
9
|
+
import { Text } from "@stealthscale/component-typography";
|
|
10
|
+
import { Stack } from "@stealthscale/component-layout";
|
|
11
|
+
//#region src/transfer/examples/clients.example.tsx
|
|
12
|
+
var clients_example_exports = /* @__PURE__ */ __exportAll({
|
|
13
|
+
Clients: () => Clients,
|
|
14
|
+
source: () => source$2
|
|
15
|
+
});
|
|
16
|
+
const CLIENTS$2 = [
|
|
17
|
+
"fathom",
|
|
18
|
+
"lantern",
|
|
19
|
+
"pebble",
|
|
20
|
+
"quartz"
|
|
21
|
+
];
|
|
22
|
+
function Clients(props) {
|
|
23
|
+
const $ = c(23);
|
|
24
|
+
const { t } = useWords("transfer");
|
|
25
|
+
let t0;
|
|
26
|
+
if ($[0] !== t) {
|
|
27
|
+
t0 = t("giveBack");
|
|
28
|
+
$[0] = t;
|
|
29
|
+
$[1] = t0;
|
|
30
|
+
} else t0 = $[1];
|
|
31
|
+
let t1;
|
|
32
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
33
|
+
t1 = /* @__PURE__ */ jsx(ChevronLeftIcon, { size: "100%" });
|
|
34
|
+
$[2] = t1;
|
|
35
|
+
} else t1 = $[2];
|
|
36
|
+
let t2;
|
|
37
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
38
|
+
t2 = /* @__PURE__ */ jsx(CheckIcon, { size: "100%" });
|
|
39
|
+
$[3] = t2;
|
|
40
|
+
} else t2 = $[3];
|
|
41
|
+
let t3;
|
|
42
|
+
if ($[4] !== t) {
|
|
43
|
+
t3 = t("nothingHere");
|
|
44
|
+
$[4] = t;
|
|
45
|
+
$[5] = t3;
|
|
46
|
+
} else t3 = $[5];
|
|
47
|
+
let t4;
|
|
48
|
+
if ($[6] !== t) {
|
|
49
|
+
t4 = t("available");
|
|
50
|
+
$[6] = t;
|
|
51
|
+
$[7] = t4;
|
|
52
|
+
} else t4 = $[7];
|
|
53
|
+
let t5;
|
|
54
|
+
if ($[8] !== t) {
|
|
55
|
+
t5 = CLIENTS$2.map((id) => ({
|
|
56
|
+
id,
|
|
57
|
+
name: t(id)
|
|
58
|
+
}));
|
|
59
|
+
$[8] = t;
|
|
60
|
+
$[9] = t5;
|
|
61
|
+
} else t5 = $[9];
|
|
62
|
+
let t6;
|
|
63
|
+
if ($[10] !== t) {
|
|
64
|
+
t6 = t("take");
|
|
65
|
+
$[10] = t;
|
|
66
|
+
$[11] = t6;
|
|
67
|
+
} else t6 = $[11];
|
|
68
|
+
let t7;
|
|
69
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
70
|
+
t7 = /* @__PURE__ */ jsx(ChevronRightIcon, { size: "100%" });
|
|
71
|
+
$[12] = t7;
|
|
72
|
+
} else t7 = $[12];
|
|
73
|
+
let t8;
|
|
74
|
+
if ($[13] !== t) {
|
|
75
|
+
t8 = t("chosen");
|
|
76
|
+
$[13] = t;
|
|
77
|
+
$[14] = t8;
|
|
78
|
+
} else t8 = $[14];
|
|
79
|
+
let t9;
|
|
80
|
+
if ($[15] !== props || $[16] !== t0 || $[17] !== t3 || $[18] !== t4 || $[19] !== t5 || $[20] !== t6 || $[21] !== t8) {
|
|
81
|
+
t9 = /* @__PURE__ */ jsx(Transfer, {
|
|
82
|
+
giveBackLabel: t0,
|
|
83
|
+
giveBackMark: t1,
|
|
84
|
+
itemToString: _temp$2,
|
|
85
|
+
itemToValue: _temp2$2,
|
|
86
|
+
mark: t2,
|
|
87
|
+
nothing: t3,
|
|
88
|
+
offeredTitle: t4,
|
|
89
|
+
rows: t5,
|
|
90
|
+
takeLabel: t6,
|
|
91
|
+
takeMark: t7,
|
|
92
|
+
takenTitle: t8,
|
|
93
|
+
...props
|
|
94
|
+
});
|
|
95
|
+
$[15] = props;
|
|
96
|
+
$[16] = t0;
|
|
97
|
+
$[17] = t3;
|
|
98
|
+
$[18] = t4;
|
|
99
|
+
$[19] = t5;
|
|
100
|
+
$[20] = t6;
|
|
101
|
+
$[21] = t8;
|
|
102
|
+
$[22] = t9;
|
|
103
|
+
} else t9 = $[22];
|
|
104
|
+
return t9;
|
|
105
|
+
}
|
|
106
|
+
function _temp2$2(client_0) {
|
|
107
|
+
return client_0.id;
|
|
108
|
+
}
|
|
109
|
+
function _temp$2(client) {
|
|
110
|
+
return client.name;
|
|
111
|
+
}
|
|
112
|
+
const source$2 = "import { type ReactElement } from \"react\";\n\nimport { CheckIcon, ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Transfer, TransferProps } from \"@stealthscale/component-collections\";\n\ninterface Client {\n readonly id: string;\n readonly name: string;\n}\n\nconst CLIENTS = [\"fathom\", \"lantern\", \"pebble\", \"quartz\"] as const;\n\nexport function Clients(props: Pick<TransferProps<Client>, \"palette\" | \"size\">): ReactElement {\n const { t } = useWords(\"transfer\");\n\n return (\n <Transfer<Client>\n giveBackLabel={t(\"giveBack\")}\n giveBackMark={<ChevronLeftIcon size=\"100%\" />}\n itemToString={(client) => client.name}\n itemToValue={(client) => client.id}\n mark={<CheckIcon size=\"100%\" />}\n nothing={t(\"nothingHere\")}\n offeredTitle={t(\"available\")}\n rows={CLIENTS.map((id) => ({ id, name: t(id) }))}\n takeLabel={t(\"take\")}\n takeMark={<ChevronRightIcon size=\"100%\" />}\n takenTitle={t(\"chosen\")}\n {...props}\n />\n );\n}\n";
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/transfer/examples/described.example.tsx
|
|
115
|
+
var described_example_exports = /* @__PURE__ */ __exportAll({
|
|
116
|
+
Described: () => Described,
|
|
117
|
+
source: () => source$1
|
|
118
|
+
});
|
|
119
|
+
const CLIENTS$1 = [
|
|
120
|
+
"fathom",
|
|
121
|
+
"lantern",
|
|
122
|
+
"pebble",
|
|
123
|
+
"quartz"
|
|
124
|
+
];
|
|
125
|
+
function Described() {
|
|
126
|
+
const $ = c(23);
|
|
127
|
+
const { t } = useWords("transfer");
|
|
128
|
+
let t0;
|
|
129
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
130
|
+
t0 = ["lantern"];
|
|
131
|
+
$[0] = t0;
|
|
132
|
+
} else t0 = $[0];
|
|
133
|
+
let t1;
|
|
134
|
+
if ($[1] !== t) {
|
|
135
|
+
t1 = t("giveBack");
|
|
136
|
+
$[1] = t;
|
|
137
|
+
$[2] = t1;
|
|
138
|
+
} else t1 = $[2];
|
|
139
|
+
let t2;
|
|
140
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
141
|
+
t2 = /* @__PURE__ */ jsx(ChevronLeftIcon, { size: "100%" });
|
|
142
|
+
$[3] = t2;
|
|
143
|
+
} else t2 = $[3];
|
|
144
|
+
let t3;
|
|
145
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
146
|
+
t3 = /* @__PURE__ */ jsx(CheckIcon, { size: "100%" });
|
|
147
|
+
$[4] = t3;
|
|
148
|
+
} else t3 = $[4];
|
|
149
|
+
let t4;
|
|
150
|
+
if ($[5] !== t) {
|
|
151
|
+
t4 = t("nothingHere");
|
|
152
|
+
$[5] = t;
|
|
153
|
+
$[6] = t4;
|
|
154
|
+
} else t4 = $[6];
|
|
155
|
+
let t5;
|
|
156
|
+
if ($[7] !== t) {
|
|
157
|
+
t5 = t("available");
|
|
158
|
+
$[7] = t;
|
|
159
|
+
$[8] = t5;
|
|
160
|
+
} else t5 = $[8];
|
|
161
|
+
let t6;
|
|
162
|
+
if ($[9] !== t) {
|
|
163
|
+
t6 = CLIENTS$1.map((id) => ({
|
|
164
|
+
id,
|
|
165
|
+
name: t(id),
|
|
166
|
+
terms: t(`${id}Of`)
|
|
167
|
+
}));
|
|
168
|
+
$[9] = t;
|
|
169
|
+
$[10] = t6;
|
|
170
|
+
} else t6 = $[10];
|
|
171
|
+
let t7;
|
|
172
|
+
if ($[11] !== t) {
|
|
173
|
+
t7 = t("take");
|
|
174
|
+
$[11] = t;
|
|
175
|
+
$[12] = t7;
|
|
176
|
+
} else t7 = $[12];
|
|
177
|
+
let t8;
|
|
178
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
179
|
+
t8 = /* @__PURE__ */ jsx(ChevronRightIcon, { size: "100%" });
|
|
180
|
+
$[13] = t8;
|
|
181
|
+
} else t8 = $[13];
|
|
182
|
+
let t9;
|
|
183
|
+
if ($[14] !== t) {
|
|
184
|
+
t9 = t("chosen");
|
|
185
|
+
$[14] = t;
|
|
186
|
+
$[15] = t9;
|
|
187
|
+
} else t9 = $[15];
|
|
188
|
+
let t10;
|
|
189
|
+
if ($[16] !== t1 || $[17] !== t4 || $[18] !== t5 || $[19] !== t6 || $[20] !== t7 || $[21] !== t9) {
|
|
190
|
+
t10 = /* @__PURE__ */ jsx(Transfer, {
|
|
191
|
+
defaultValue: t0,
|
|
192
|
+
description: _temp$1,
|
|
193
|
+
giveBackLabel: t1,
|
|
194
|
+
giveBackMark: t2,
|
|
195
|
+
itemToString: _temp2$1,
|
|
196
|
+
itemToValue: _temp3,
|
|
197
|
+
mark: t3,
|
|
198
|
+
nothing: t4,
|
|
199
|
+
offeredTitle: t5,
|
|
200
|
+
rows: t6,
|
|
201
|
+
takeLabel: t7,
|
|
202
|
+
takeMark: t8,
|
|
203
|
+
takenTitle: t9
|
|
204
|
+
});
|
|
205
|
+
$[16] = t1;
|
|
206
|
+
$[17] = t4;
|
|
207
|
+
$[18] = t5;
|
|
208
|
+
$[19] = t6;
|
|
209
|
+
$[20] = t7;
|
|
210
|
+
$[21] = t9;
|
|
211
|
+
$[22] = t10;
|
|
212
|
+
} else t10 = $[22];
|
|
213
|
+
return t10;
|
|
214
|
+
}
|
|
215
|
+
function _temp3(client_1) {
|
|
216
|
+
return client_1.id;
|
|
217
|
+
}
|
|
218
|
+
function _temp2$1(client_0) {
|
|
219
|
+
return client_0.name;
|
|
220
|
+
}
|
|
221
|
+
function _temp$1(client) {
|
|
222
|
+
return client.terms;
|
|
223
|
+
}
|
|
224
|
+
const source$1 = "import { type ReactElement } from \"react\";\n\nimport { CheckIcon, ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Transfer } from \"@stealthscale/component-collections\";\n\ninterface Client {\n readonly id: string;\n readonly name: string;\n readonly terms: string;\n}\n\nconst CLIENTS = [\"fathom\", \"lantern\", \"pebble\", \"quartz\"] as const;\n\nexport function Described(): ReactElement {\n const { t } = useWords(\"transfer\");\n\n return (\n <Transfer<Client>\n defaultValue={[\"lantern\"]}\n description={(client) => client.terms}\n giveBackLabel={t(\"giveBack\")}\n giveBackMark={<ChevronLeftIcon size=\"100%\" />}\n itemToString={(client) => client.name}\n itemToValue={(client) => client.id}\n mark={<CheckIcon size=\"100%\" />}\n nothing={t(\"nothingHere\")}\n offeredTitle={t(\"available\")}\n rows={CLIENTS.map((id) => ({ id, name: t(id), terms: t(`${id}Of`) }))}\n takeLabel={t(\"take\")}\n takeMark={<ChevronRightIcon size=\"100%\" />}\n takenTitle={t(\"chosen\")}\n />\n );\n}\n";
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/transfer/examples/held.example.tsx
|
|
227
|
+
var held_example_exports = /* @__PURE__ */ __exportAll({
|
|
228
|
+
Held: () => Held,
|
|
229
|
+
source: () => source
|
|
230
|
+
});
|
|
231
|
+
const CLIENTS = [
|
|
232
|
+
"fathom",
|
|
233
|
+
"lantern",
|
|
234
|
+
"pebble",
|
|
235
|
+
"quartz"
|
|
236
|
+
];
|
|
237
|
+
function Held() {
|
|
238
|
+
const $ = c(32);
|
|
239
|
+
const { t } = useWords("transfer");
|
|
240
|
+
let t0;
|
|
241
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
242
|
+
t0 = ["fathom"];
|
|
243
|
+
$[0] = t0;
|
|
244
|
+
} else t0 = $[0];
|
|
245
|
+
const [taken, setTaken] = useState(t0);
|
|
246
|
+
let t1;
|
|
247
|
+
if ($[1] !== t) {
|
|
248
|
+
t1 = t("giveBack");
|
|
249
|
+
$[1] = t;
|
|
250
|
+
$[2] = t1;
|
|
251
|
+
} else t1 = $[2];
|
|
252
|
+
let t2;
|
|
253
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
254
|
+
t2 = /* @__PURE__ */ jsx(ChevronLeftIcon, { size: "100%" });
|
|
255
|
+
$[3] = t2;
|
|
256
|
+
} else t2 = $[3];
|
|
257
|
+
let t3;
|
|
258
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
259
|
+
t3 = /* @__PURE__ */ jsx(CheckIcon, { size: "100%" });
|
|
260
|
+
$[4] = t3;
|
|
261
|
+
} else t3 = $[4];
|
|
262
|
+
let t4;
|
|
263
|
+
if ($[5] !== t) {
|
|
264
|
+
t4 = t("nothingHere");
|
|
265
|
+
$[5] = t;
|
|
266
|
+
$[6] = t4;
|
|
267
|
+
} else t4 = $[6];
|
|
268
|
+
let t5;
|
|
269
|
+
if ($[7] !== t) {
|
|
270
|
+
t5 = t("available");
|
|
271
|
+
$[7] = t;
|
|
272
|
+
$[8] = t5;
|
|
273
|
+
} else t5 = $[8];
|
|
274
|
+
let t6;
|
|
275
|
+
if ($[9] !== t) {
|
|
276
|
+
t6 = CLIENTS.map((id) => ({
|
|
277
|
+
id,
|
|
278
|
+
name: t(id)
|
|
279
|
+
}));
|
|
280
|
+
$[9] = t;
|
|
281
|
+
$[10] = t6;
|
|
282
|
+
} else t6 = $[10];
|
|
283
|
+
let t7;
|
|
284
|
+
if ($[11] !== t) {
|
|
285
|
+
t7 = t("take");
|
|
286
|
+
$[11] = t;
|
|
287
|
+
$[12] = t7;
|
|
288
|
+
} else t7 = $[12];
|
|
289
|
+
let t8;
|
|
290
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
291
|
+
t8 = /* @__PURE__ */ jsx(ChevronRightIcon, { size: "100%" });
|
|
292
|
+
$[13] = t8;
|
|
293
|
+
} else t8 = $[13];
|
|
294
|
+
let t9;
|
|
295
|
+
if ($[14] !== t) {
|
|
296
|
+
t9 = t("chosen");
|
|
297
|
+
$[14] = t;
|
|
298
|
+
$[15] = t9;
|
|
299
|
+
} else t9 = $[15];
|
|
300
|
+
let t10;
|
|
301
|
+
if ($[16] !== t1 || $[17] !== t4 || $[18] !== t5 || $[19] !== t6 || $[20] !== t7 || $[21] !== t9 || $[22] !== taken) {
|
|
302
|
+
t10 = /* @__PURE__ */ jsx(Transfer, {
|
|
303
|
+
giveBackLabel: t1,
|
|
304
|
+
giveBackMark: t2,
|
|
305
|
+
itemToString: _temp,
|
|
306
|
+
itemToValue: _temp2,
|
|
307
|
+
mark: t3,
|
|
308
|
+
nothing: t4,
|
|
309
|
+
offeredTitle: t5,
|
|
310
|
+
onValueChange: setTaken,
|
|
311
|
+
rows: t6,
|
|
312
|
+
takeLabel: t7,
|
|
313
|
+
takeMark: t8,
|
|
314
|
+
takenTitle: t9,
|
|
315
|
+
value: taken
|
|
316
|
+
});
|
|
317
|
+
$[16] = t1;
|
|
318
|
+
$[17] = t4;
|
|
319
|
+
$[18] = t5;
|
|
320
|
+
$[19] = t6;
|
|
321
|
+
$[20] = t7;
|
|
322
|
+
$[21] = t9;
|
|
323
|
+
$[22] = taken;
|
|
324
|
+
$[23] = t10;
|
|
325
|
+
} else t10 = $[23];
|
|
326
|
+
let t11;
|
|
327
|
+
if ($[24] !== t || $[25] !== taken) {
|
|
328
|
+
t11 = taken.length === 0 ? t("nothing") : taken.map((id_0) => t(id_0)).join(", ");
|
|
329
|
+
$[24] = t;
|
|
330
|
+
$[25] = taken;
|
|
331
|
+
$[26] = t11;
|
|
332
|
+
} else t11 = $[26];
|
|
333
|
+
let t12;
|
|
334
|
+
if ($[27] !== t11) {
|
|
335
|
+
t12 = /* @__PURE__ */ jsx(Text, {
|
|
336
|
+
"aria-live": "polite",
|
|
337
|
+
children: t11
|
|
338
|
+
});
|
|
339
|
+
$[27] = t11;
|
|
340
|
+
$[28] = t12;
|
|
341
|
+
} else t12 = $[28];
|
|
342
|
+
let t13;
|
|
343
|
+
if ($[29] !== t10 || $[30] !== t12) {
|
|
344
|
+
t13 = /* @__PURE__ */ jsxs(Stack, {
|
|
345
|
+
gap: "md",
|
|
346
|
+
children: [t10, t12]
|
|
347
|
+
});
|
|
348
|
+
$[29] = t10;
|
|
349
|
+
$[30] = t12;
|
|
350
|
+
$[31] = t13;
|
|
351
|
+
} else t13 = $[31];
|
|
352
|
+
return t13;
|
|
353
|
+
}
|
|
354
|
+
function _temp2(client_0) {
|
|
355
|
+
return client_0.id;
|
|
356
|
+
}
|
|
357
|
+
function _temp(client) {
|
|
358
|
+
return client.name;
|
|
359
|
+
}
|
|
360
|
+
const source = "import { type ReactElement, useState } from \"react\";\n\nimport { CheckIcon, ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\n\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { Text } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Transfer } from \"@stealthscale/component-collections\";\n\ninterface Client {\n readonly id: string;\n readonly name: string;\n}\n\nconst CLIENTS = [\"fathom\", \"lantern\", \"pebble\", \"quartz\"] as const;\n\nexport function Held(): ReactElement {\n const { t } = useWords(\"transfer\");\n const [taken, setTaken] = useState<readonly string[]>([\"fathom\"]);\n\n return (\n <Stack gap=\"md\">\n <Transfer<Client>\n giveBackLabel={t(\"giveBack\")}\n giveBackMark={<ChevronLeftIcon size=\"100%\" />}\n itemToString={(client) => client.name}\n itemToValue={(client) => client.id}\n mark={<CheckIcon size=\"100%\" />}\n nothing={t(\"nothingHere\")}\n offeredTitle={t(\"available\")}\n onValueChange={setTaken}\n rows={CLIENTS.map((id) => ({ id, name: t(id) }))}\n takeLabel={t(\"take\")}\n takeMark={<ChevronRightIcon size=\"100%\" />}\n takenTitle={t(\"chosen\")}\n value={taken}\n />\n <Text aria-live=\"polite\">\n {taken.length === 0 ? t(\"nothing\") : taken.map((id) => t(id)).join(\", \")}\n </Text>\n </Stack>\n );\n}\n";
|
|
361
|
+
//#endregion
|
|
362
|
+
//#region src/transfer/transfer.specimen.tsx
|
|
363
|
+
/**
|
|
364
|
+
* Catalogue page for the transfer.
|
|
365
|
+
*
|
|
366
|
+
* @remarks
|
|
367
|
+
* `scenesOf` generates the size and palette scenes from the clients example. The palette scene
|
|
368
|
+
* checks the first row after it mounts, so the palette shows in a still image. The described and
|
|
369
|
+
* held scenes are hand-written. Every transfer renders in an `lg` room, and every scene shows its
|
|
370
|
+
* example file as its source. The words are keys under `transfer` in
|
|
371
|
+
* `locales/en/specimen/transfer.json`.
|
|
372
|
+
*/
|
|
373
|
+
/**
|
|
374
|
+
* Renders a transfer and checks its first row after it mounts.
|
|
375
|
+
*
|
|
376
|
+
* @remarks
|
|
377
|
+
* The staging clicks the row only while it is unchecked, so a second run of the effect leaves it
|
|
378
|
+
* checked. The staging never appears in an example.
|
|
379
|
+
*/
|
|
380
|
+
function Picked(t0) {
|
|
381
|
+
const $ = c(5);
|
|
382
|
+
const { children } = t0;
|
|
383
|
+
const [box, setBox] = useState(null);
|
|
384
|
+
let t1;
|
|
385
|
+
let t2;
|
|
386
|
+
if ($[0] !== box) {
|
|
387
|
+
t1 = () => {
|
|
388
|
+
const first = box?.querySelector("[role=option]");
|
|
389
|
+
if (first !== void 0 && first !== null && first.getAttribute("aria-selected") !== "true") first.click();
|
|
390
|
+
};
|
|
391
|
+
t2 = [box];
|
|
392
|
+
$[0] = box;
|
|
393
|
+
$[1] = t1;
|
|
394
|
+
$[2] = t2;
|
|
395
|
+
} else {
|
|
396
|
+
t1 = $[1];
|
|
397
|
+
t2 = $[2];
|
|
398
|
+
}
|
|
399
|
+
useEffect(t1, t2);
|
|
400
|
+
let t3;
|
|
401
|
+
if ($[3] !== children) {
|
|
402
|
+
t3 = /* @__PURE__ */ jsx("div", {
|
|
403
|
+
ref: setBox,
|
|
404
|
+
children
|
|
405
|
+
});
|
|
406
|
+
$[3] = children;
|
|
407
|
+
$[4] = t3;
|
|
408
|
+
} else t3 = $[4];
|
|
409
|
+
return t3;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Hand-written scene for rows with a second line.
|
|
413
|
+
*/
|
|
414
|
+
const described = {
|
|
415
|
+
about: "transfer.described.about",
|
|
416
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
417
|
+
size: "lg",
|
|
418
|
+
children: /* @__PURE__ */ jsx(Described, {})
|
|
419
|
+
}),
|
|
420
|
+
example: described_example_exports,
|
|
421
|
+
title: "transfer.described.title"
|
|
422
|
+
};
|
|
423
|
+
/**
|
|
424
|
+
* Hand-written scene for a set the page controls.
|
|
425
|
+
*/
|
|
426
|
+
const held = {
|
|
427
|
+
about: "transfer.held.about",
|
|
428
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
429
|
+
size: "lg",
|
|
430
|
+
children: /* @__PURE__ */ jsx(Held, {})
|
|
431
|
+
}),
|
|
432
|
+
example: held_example_exports,
|
|
433
|
+
title: "transfer.held.title"
|
|
434
|
+
};
|
|
435
|
+
var transfer_specimen_default = specimen({
|
|
436
|
+
about: "transfer.about",
|
|
437
|
+
id: "components/collections/transfer",
|
|
438
|
+
imports: "import { Transfer } from \"@stealthscale/component-collections\";",
|
|
439
|
+
scenes: [
|
|
440
|
+
...scenesOf(recipe, {
|
|
441
|
+
axes: {
|
|
442
|
+
palette: {
|
|
443
|
+
draw: (props) => /* @__PURE__ */ jsx(Room, {
|
|
444
|
+
size: "lg",
|
|
445
|
+
children: /* @__PURE__ */ jsx(Picked, { children: /* @__PURE__ */ jsx(Clients, { ...props }) })
|
|
446
|
+
}),
|
|
447
|
+
example: clients_example_exports
|
|
448
|
+
},
|
|
449
|
+
size: { direction: "column" }
|
|
450
|
+
},
|
|
451
|
+
draw: (props) => /* @__PURE__ */ jsx(Room, {
|
|
452
|
+
size: "lg",
|
|
453
|
+
children: /* @__PURE__ */ jsx(Clients, { ...props })
|
|
454
|
+
}),
|
|
455
|
+
example: clients_example_exports,
|
|
456
|
+
namespace: "transfer",
|
|
457
|
+
order: ["size", "palette"]
|
|
458
|
+
}),
|
|
459
|
+
described,
|
|
460
|
+
held
|
|
461
|
+
],
|
|
462
|
+
title: "transfer.title"
|
|
463
|
+
});
|
|
464
|
+
//#endregion
|
|
465
|
+
export { transfer_specimen_default as default, described, held };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export const dropped = {"TransferProps": {"conditions": 0, "foreign": 0}};
|
|
2
|
+
export const parts = {"TransferProps": [{"accepts": "readonly string[]", "fallback": "", "kind": "option", "name": "defaultValue", "refers": [], "required": false, "says": "Values of the moved rows on first render, when `value` is not set."}, {"accepts": "((row: Row) => ReactNode)", "fallback": "", "kind": "option", "name": "description", "refers": ["kit.Row"], "required": false, "says": "Returns a row's second line."}, {"accepts": "string", "fallback": "", "kind": "option", "name": "giveBackLabel", "refers": [], "required": true, "says": "Accessible name of the control that moves checked rows back."}, {"accepts": "ReactNode", "fallback": "", "kind": "option", "name": "giveBackMark", "refers": ["react.ReactElement", "react.ReactPortal"], "required": true, "says": "Content of the control that moves checked rows back."}, {"accepts": "(row: Row) => string", "fallback": "", "kind": "option", "name": "itemToString", "refers": ["kit.Row"], "required": true, "says": "Returns a row's text."}, {"accepts": "(row: Row) => string", "fallback": "", "kind": "option", "name": "itemToValue", "refers": ["kit.Row"], "required": true, "says": "Returns a row's value."}, {"accepts": "ReactNode", "fallback": "", "kind": "option", "name": "mark", "refers": ["react.ReactElement", "react.ReactPortal"], "required": false, "says": "Mark of a checked row's checkbox."}, {"accepts": "ReactNode", "fallback": "", "kind": "option", "name": "nothing", "refers": ["react.ReactElement", "react.ReactPortal"], "required": false, "says": "Content rendered on a side with no rows."}, {"accepts": "ReactNode", "fallback": "", "kind": "option", "name": "offeredTitle", "refers": ["react.ReactElement", "react.ReactPortal"], "required": true, "says": "Label of the list rows are moved from."}, {"accepts": "((taken: readonly string[]) => void)", "fallback": "", "kind": "option", "name": "onValueChange", "refers": [], "required": false, "says": "Called with the values of the moved rows after each move."}, {"accepts": "\"accent\" | \"error\" | \"info\" | \"neutral\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"", "fallback": "", "kind": "option", "name": "palette", "refers": [], "required": false, "says": "Palette the checkboxes and fills of both lists read."}, {"accepts": "readonly Row[]", "fallback": "", "kind": "option", "name": "rows", "refers": ["kit.Row"], "required": true, "says": "Every row, on either side."}, {"accepts": "\"lg\" | \"md\" | \"sm\"", "fallback": "", "kind": "option", "name": "size", "refers": [], "required": false, "says": "Size of the gap between the parts and of the controls."}, {"accepts": "string", "fallback": "", "kind": "option", "name": "takeLabel", "refers": [], "required": true, "says": "Accessible name of the control that moves checked rows across."}, {"accepts": "ReactNode", "fallback": "", "kind": "option", "name": "takeMark", "refers": ["react.ReactElement", "react.ReactPortal"], "required": true, "says": "Content of the control that moves checked rows across."}, {"accepts": "ReactNode", "fallback": "", "kind": "option", "name": "takenTitle", "refers": ["react.ReactElement", "react.ReactPortal"], "required": true, "says": "Label of the list rows are moved to."}, {"accepts": "readonly string[]", "fallback": "", "kind": "option", "name": "value", "refers": [], "required": false, "says": "Values of the moved rows, when the caller controls them."}]};
|
|
3
|
+
export const shapes = {"react.ReactElement": [{"accepts": "string | JSXElementConstructor<any>", "name": "type", "says": ""}, {"accepts": "unknown", "name": "props", "says": ""}, {"accepts": "string | null", "name": "key", "says": ""}], "react.ReactPortal": [{"accepts": "ReactNode", "name": "children", "says": ""}, {"accepts": "string | JSXElementConstructor<any>", "name": "type", "says": ""}, {"accepts": "unknown", "name": "props", "says": ""}, {"accepts": "string | null", "name": "key", "says": ""}]};
|