@sproutsocial/seeds-react-tree 0.3.1 → 0.4.1
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +46 -0
- package/dist/esm/index.js +389 -32
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +86 -1
- package/dist/index.d.ts +86 -1
- package/dist/index.js +391 -32
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
- package/src/Common/TreeSearchableSelectBase.tsx +383 -0
- package/src/Common/flattenTree.ts +22 -0
- package/src/MultiTreeSearchableSelect.stories.tsx +256 -0
- package/src/MultiTreeSearchableSelect.tsx +92 -0
- package/src/SingleTreeSearchableSelect.stories.tsx +217 -0
- package/src/SingleTreeSearchableSelect.tsx +95 -0
- package/src/TreeCombobox.tsx +91 -52
- package/src/TreeStyles.tsx +3 -2
- package/src/__tests__/MultiTreeSearchableSelect.test.tsx +194 -0
- package/src/__tests__/SingleTreeSearchableSelect.test.tsx +210 -0
- package/src/index.ts +8 -0
- package/src/storyData.tsx +339 -6
package/src/storyData.tsx
CHANGED
|
@@ -42,6 +42,339 @@ export const collections: TreeItemData[] = [
|
|
|
42
42
|
},
|
|
43
43
|
];
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* A 7-level deep Pokémon hierarchy: Generation → Region → Type →
|
|
47
|
+
* Evolutionary Line → Stage → Pokémon → Form. Useful for stress-testing
|
|
48
|
+
* TreeCombobox indentation, scrolling, and filter-auto-expand behavior with
|
|
49
|
+
* names a reviewer can recognize.
|
|
50
|
+
*/
|
|
51
|
+
export const pokedex: TreeItemData[] = [
|
|
52
|
+
{
|
|
53
|
+
id: "gen-1",
|
|
54
|
+
label: "Generation I",
|
|
55
|
+
icon: <span>🎮</span>,
|
|
56
|
+
children: [
|
|
57
|
+
{
|
|
58
|
+
id: "kanto",
|
|
59
|
+
label: "Kanto",
|
|
60
|
+
children: [
|
|
61
|
+
{
|
|
62
|
+
id: "kanto-grass",
|
|
63
|
+
label: "Grass-type",
|
|
64
|
+
icon: <span>🌿</span>,
|
|
65
|
+
children: [
|
|
66
|
+
{
|
|
67
|
+
id: "bulbasaur-line",
|
|
68
|
+
label: "Bulbasaur Line",
|
|
69
|
+
children: [
|
|
70
|
+
{
|
|
71
|
+
id: "bulba-stage-1",
|
|
72
|
+
label: "Stage 1",
|
|
73
|
+
children: [
|
|
74
|
+
{
|
|
75
|
+
id: "bulbasaur",
|
|
76
|
+
label: "Bulbasaur",
|
|
77
|
+
icon: <span>🌱</span>,
|
|
78
|
+
children: [
|
|
79
|
+
{ id: "bulbasaur-std", label: "Standard" },
|
|
80
|
+
{ id: "bulbasaur-shiny", label: "Shiny" },
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: "bulba-stage-2",
|
|
87
|
+
label: "Stage 2",
|
|
88
|
+
children: [
|
|
89
|
+
{
|
|
90
|
+
id: "ivysaur",
|
|
91
|
+
label: "Ivysaur",
|
|
92
|
+
icon: <span>🌱</span>,
|
|
93
|
+
children: [
|
|
94
|
+
{ id: "ivysaur-std", label: "Standard" },
|
|
95
|
+
{ id: "ivysaur-shiny", label: "Shiny" },
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: "bulba-stage-3",
|
|
102
|
+
label: "Stage 3 / Final",
|
|
103
|
+
children: [
|
|
104
|
+
{
|
|
105
|
+
id: "venusaur",
|
|
106
|
+
label: "Venusaur",
|
|
107
|
+
icon: <span>🌻</span>,
|
|
108
|
+
children: [
|
|
109
|
+
{ id: "venusaur-std", label: "Standard" },
|
|
110
|
+
{ id: "venusaur-mega", label: "Mega Venusaur" },
|
|
111
|
+
{ id: "venusaur-gmax", label: "Gigantamax" },
|
|
112
|
+
{ id: "venusaur-shiny", label: "Shiny" },
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: "kanto-fire",
|
|
123
|
+
label: "Fire-type",
|
|
124
|
+
icon: <span>🔥</span>,
|
|
125
|
+
children: [
|
|
126
|
+
{
|
|
127
|
+
id: "charmander-line",
|
|
128
|
+
label: "Charmander Line",
|
|
129
|
+
children: [
|
|
130
|
+
{
|
|
131
|
+
id: "charm-stage-1",
|
|
132
|
+
label: "Stage 1",
|
|
133
|
+
children: [
|
|
134
|
+
{
|
|
135
|
+
id: "charmander",
|
|
136
|
+
label: "Charmander",
|
|
137
|
+
icon: <span>🦎</span>,
|
|
138
|
+
children: [
|
|
139
|
+
{ id: "charmander-std", label: "Standard" },
|
|
140
|
+
{ id: "charmander-shiny", label: "Shiny" },
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: "charm-stage-2",
|
|
147
|
+
label: "Stage 2",
|
|
148
|
+
children: [
|
|
149
|
+
{
|
|
150
|
+
id: "charmeleon",
|
|
151
|
+
label: "Charmeleon",
|
|
152
|
+
icon: <span>🦎</span>,
|
|
153
|
+
children: [
|
|
154
|
+
{ id: "charmeleon-std", label: "Standard" },
|
|
155
|
+
{ id: "charmeleon-shiny", label: "Shiny" },
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: "charm-stage-3",
|
|
162
|
+
label: "Stage 3 / Final",
|
|
163
|
+
children: [
|
|
164
|
+
{
|
|
165
|
+
id: "charizard",
|
|
166
|
+
label: "Charizard",
|
|
167
|
+
icon: <span>🐉</span>,
|
|
168
|
+
children: [
|
|
169
|
+
{ id: "charizard-std", label: "Standard" },
|
|
170
|
+
{ id: "charizard-mega-x", label: "Mega Charizard X" },
|
|
171
|
+
{ id: "charizard-mega-y", label: "Mega Charizard Y" },
|
|
172
|
+
{ id: "charizard-gmax", label: "Gigantamax" },
|
|
173
|
+
{ id: "charizard-shiny", label: "Shiny" },
|
|
174
|
+
],
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: "kanto-water",
|
|
184
|
+
label: "Water-type",
|
|
185
|
+
icon: <span>💧</span>,
|
|
186
|
+
children: [
|
|
187
|
+
{
|
|
188
|
+
id: "squirtle-line",
|
|
189
|
+
label: "Squirtle Line",
|
|
190
|
+
children: [
|
|
191
|
+
{
|
|
192
|
+
id: "squir-stage-1",
|
|
193
|
+
label: "Stage 1",
|
|
194
|
+
children: [
|
|
195
|
+
{
|
|
196
|
+
id: "squirtle",
|
|
197
|
+
label: "Squirtle",
|
|
198
|
+
icon: <span>🐢</span>,
|
|
199
|
+
children: [
|
|
200
|
+
{ id: "squirtle-std", label: "Standard" },
|
|
201
|
+
{ id: "squirtle-shiny", label: "Shiny" },
|
|
202
|
+
],
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
id: "squir-stage-2",
|
|
208
|
+
label: "Stage 2",
|
|
209
|
+
children: [
|
|
210
|
+
{
|
|
211
|
+
id: "wartortle",
|
|
212
|
+
label: "Wartortle",
|
|
213
|
+
icon: <span>🐢</span>,
|
|
214
|
+
children: [
|
|
215
|
+
{ id: "wartortle-std", label: "Standard" },
|
|
216
|
+
{ id: "wartortle-shiny", label: "Shiny" },
|
|
217
|
+
],
|
|
218
|
+
},
|
|
219
|
+
],
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
id: "squir-stage-3",
|
|
223
|
+
label: "Stage 3 / Final",
|
|
224
|
+
children: [
|
|
225
|
+
{
|
|
226
|
+
id: "blastoise",
|
|
227
|
+
label: "Blastoise",
|
|
228
|
+
icon: <span>🐢</span>,
|
|
229
|
+
children: [
|
|
230
|
+
{ id: "blastoise-std", label: "Standard" },
|
|
231
|
+
{ id: "blastoise-mega", label: "Mega Blastoise" },
|
|
232
|
+
{ id: "blastoise-gmax", label: "Gigantamax" },
|
|
233
|
+
{ id: "blastoise-shiny", label: "Shiny" },
|
|
234
|
+
],
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
],
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
id: "gen-2",
|
|
248
|
+
label: "Generation II",
|
|
249
|
+
icon: <span>🎮</span>,
|
|
250
|
+
children: [
|
|
251
|
+
{
|
|
252
|
+
id: "johto",
|
|
253
|
+
label: "Johto",
|
|
254
|
+
children: [
|
|
255
|
+
{
|
|
256
|
+
id: "johto-grass",
|
|
257
|
+
label: "Grass-type",
|
|
258
|
+
icon: <span>🌿</span>,
|
|
259
|
+
children: [
|
|
260
|
+
{
|
|
261
|
+
id: "chikorita-line",
|
|
262
|
+
label: "Chikorita Line",
|
|
263
|
+
children: [
|
|
264
|
+
{
|
|
265
|
+
id: "chiko-stage-1",
|
|
266
|
+
label: "Stage 1",
|
|
267
|
+
children: [
|
|
268
|
+
{
|
|
269
|
+
id: "chikorita",
|
|
270
|
+
label: "Chikorita",
|
|
271
|
+
icon: <span>🌿</span>,
|
|
272
|
+
children: [
|
|
273
|
+
{ id: "chikorita-std", label: "Standard" },
|
|
274
|
+
{ id: "chikorita-shiny", label: "Shiny" },
|
|
275
|
+
],
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
id: "chiko-stage-2",
|
|
281
|
+
label: "Stage 2",
|
|
282
|
+
children: [
|
|
283
|
+
{
|
|
284
|
+
id: "bayleef",
|
|
285
|
+
label: "Bayleef",
|
|
286
|
+
icon: <span>🍃</span>,
|
|
287
|
+
children: [
|
|
288
|
+
{ id: "bayleef-std", label: "Standard" },
|
|
289
|
+
{ id: "bayleef-shiny", label: "Shiny" },
|
|
290
|
+
],
|
|
291
|
+
},
|
|
292
|
+
],
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
id: "chiko-stage-3",
|
|
296
|
+
label: "Stage 3 / Final",
|
|
297
|
+
children: [
|
|
298
|
+
{
|
|
299
|
+
id: "meganium",
|
|
300
|
+
label: "Meganium",
|
|
301
|
+
icon: <span>🌸</span>,
|
|
302
|
+
children: [
|
|
303
|
+
{ id: "meganium-std", label: "Standard" },
|
|
304
|
+
{ id: "meganium-shiny", label: "Shiny" },
|
|
305
|
+
],
|
|
306
|
+
},
|
|
307
|
+
],
|
|
308
|
+
},
|
|
309
|
+
],
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
id: "johto-fire",
|
|
315
|
+
label: "Fire-type",
|
|
316
|
+
icon: <span>🔥</span>,
|
|
317
|
+
children: [
|
|
318
|
+
{
|
|
319
|
+
id: "cyndaquil-line",
|
|
320
|
+
label: "Cyndaquil Line",
|
|
321
|
+
children: [
|
|
322
|
+
{
|
|
323
|
+
id: "cynda-stage-1",
|
|
324
|
+
label: "Stage 1",
|
|
325
|
+
children: [
|
|
326
|
+
{
|
|
327
|
+
id: "cyndaquil",
|
|
328
|
+
label: "Cyndaquil",
|
|
329
|
+
icon: <span>🔥</span>,
|
|
330
|
+
children: [
|
|
331
|
+
{ id: "cyndaquil-std", label: "Standard" },
|
|
332
|
+
{ id: "cyndaquil-shiny", label: "Shiny" },
|
|
333
|
+
],
|
|
334
|
+
},
|
|
335
|
+
],
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
id: "cynda-stage-2",
|
|
339
|
+
label: "Stage 2",
|
|
340
|
+
children: [
|
|
341
|
+
{
|
|
342
|
+
id: "quilava",
|
|
343
|
+
label: "Quilava",
|
|
344
|
+
icon: <span>🔥</span>,
|
|
345
|
+
children: [
|
|
346
|
+
{ id: "quilava-std", label: "Standard" },
|
|
347
|
+
{ id: "quilava-shiny", label: "Shiny" },
|
|
348
|
+
],
|
|
349
|
+
},
|
|
350
|
+
],
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
id: "cynda-stage-3",
|
|
354
|
+
label: "Stage 3 / Final",
|
|
355
|
+
children: [
|
|
356
|
+
{
|
|
357
|
+
id: "typhlosion",
|
|
358
|
+
label: "Typhlosion",
|
|
359
|
+
icon: <span>🔥</span>,
|
|
360
|
+
children: [
|
|
361
|
+
{ id: "typhlosion-std", label: "Standard" },
|
|
362
|
+
{ id: "typhlosion-shiny", label: "Shiny" },
|
|
363
|
+
{ id: "typhlosion-hisuian", label: "Hisuian" },
|
|
364
|
+
],
|
|
365
|
+
},
|
|
366
|
+
],
|
|
367
|
+
},
|
|
368
|
+
],
|
|
369
|
+
},
|
|
370
|
+
],
|
|
371
|
+
},
|
|
372
|
+
],
|
|
373
|
+
},
|
|
374
|
+
],
|
|
375
|
+
},
|
|
376
|
+
];
|
|
377
|
+
|
|
45
378
|
export const fileTree: TreeItemData[] = [
|
|
46
379
|
{
|
|
47
380
|
id: "src",
|
|
@@ -82,8 +415,8 @@ const RadioOuter = styled.span<{ $selected: boolean; $disabled: boolean }>`
|
|
|
82
415
|
align-items: center;
|
|
83
416
|
justify-content: center;
|
|
84
417
|
flex-shrink: 0;
|
|
85
|
-
width:
|
|
86
|
-
height:
|
|
418
|
+
width: 16px;
|
|
419
|
+
height: 16px;
|
|
87
420
|
border-radius: 50%;
|
|
88
421
|
border: 2px solid
|
|
89
422
|
${({ theme, $selected }) =>
|
|
@@ -95,8 +428,8 @@ const RadioOuter = styled.span<{ $selected: boolean; $disabled: boolean }>`
|
|
|
95
428
|
`;
|
|
96
429
|
|
|
97
430
|
const RadioInner = styled.span`
|
|
98
|
-
width:
|
|
99
|
-
height:
|
|
431
|
+
width: 8px;
|
|
432
|
+
height: 8px;
|
|
100
433
|
border-radius: 50%;
|
|
101
434
|
background: ${({ theme }) => theme.colors.form.border.selected};
|
|
102
435
|
`;
|
|
@@ -115,8 +448,8 @@ const CheckboxOuter = styled.span<{ $selected: boolean; $disabled: boolean }>`
|
|
|
115
448
|
align-items: center;
|
|
116
449
|
justify-content: center;
|
|
117
450
|
flex-shrink: 0;
|
|
118
|
-
width:
|
|
119
|
-
height:
|
|
451
|
+
width: 16px;
|
|
452
|
+
height: 16px;
|
|
120
453
|
border-radius: 4px;
|
|
121
454
|
border: 2px solid
|
|
122
455
|
${({ theme, $selected }) =>
|