@react-spectrum/tag 3.0.0-nightly.2182 → 3.0.0-nightly.2196
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/import.mjs +95 -41
- package/dist/main.js +94 -40
- package/dist/main.js.map +1 -1
- package/dist/module.js +95 -41
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/TagGroup.tsx +53 -34
package/dist/import.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import {useDOMRef as $fUaQ2$useDOMRef, classNames as $fUaQ2$classNames, useStyle
|
|
|
6
6
|
import {Field as $fUaQ2$Field} from "@react-spectrum/label";
|
|
7
7
|
import {FocusScope as $fUaQ2$FocusScope, FocusRing as $fUaQ2$FocusRing, useFocusRing as $fUaQ2$useFocusRing} from "@react-aria/focus";
|
|
8
8
|
import {useListState as $fUaQ2$useListState, ListCollection as $fUaQ2$ListCollection} from "@react-stately/list";
|
|
9
|
-
import {useProviderProps as $fUaQ2$useProviderProps, Provider as $fUaQ2$Provider} from "@react-spectrum/provider";
|
|
9
|
+
import {useProviderProps as $fUaQ2$useProviderProps, useProvider as $fUaQ2$useProvider, Provider as $fUaQ2$Provider} from "@react-spectrum/provider";
|
|
10
10
|
import $fUaQ2$react, {useRef as $fUaQ2$useRef, useState as $fUaQ2$useState, useMemo as $fUaQ2$useMemo, useCallback as $fUaQ2$useCallback, useEffect as $fUaQ2$useEffect} from "react";
|
|
11
11
|
import {useFormProps as $fUaQ2$useFormProps} from "@react-spectrum/form";
|
|
12
12
|
import {useValueEffect as $fUaQ2$useValueEffect, useId as $fUaQ2$useId, useResizeObserver as $fUaQ2$useResizeObserver, useLayoutEffect as $fUaQ2$useLayoutEffect, mergeProps as $fUaQ2$mergeProps} from "@react-aria/utils";
|
|
@@ -50,8 +50,8 @@ var $4f97095b36611c9c$exports = {};
|
|
|
50
50
|
$4f97095b36611c9c$exports = {
|
|
51
51
|
"actions": `الإجراءات`,
|
|
52
52
|
"hideButtonLabel": `إظهار أقل`,
|
|
53
|
-
"
|
|
54
|
-
"
|
|
53
|
+
"noTags": `بدون`,
|
|
54
|
+
"showAllButtonLabel": (args, formatter)=>`عرض الكل (${formatter.number(args.tagCount)})`
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
|
|
@@ -59,6 +59,7 @@ var $d1606ced019b0a9e$exports = {};
|
|
|
59
59
|
$d1606ced019b0a9e$exports = {
|
|
60
60
|
"actions": `Действия`,
|
|
61
61
|
"hideButtonLabel": `Показване на по-малко`,
|
|
62
|
+
"noTags": `Нито един`,
|
|
62
63
|
"showAllButtonLabel": (args, formatter)=>`Показване на всички (${formatter.number(args.tagCount)})`
|
|
63
64
|
};
|
|
64
65
|
|
|
@@ -67,6 +68,7 @@ var $01e300f7d0078144$exports = {};
|
|
|
67
68
|
$01e300f7d0078144$exports = {
|
|
68
69
|
"actions": `Akce`,
|
|
69
70
|
"hideButtonLabel": `Zobrazit méně`,
|
|
71
|
+
"noTags": `Žádný`,
|
|
70
72
|
"showAllButtonLabel": (args, formatter)=>`Zobrazit vše (${formatter.number(args.tagCount)})`
|
|
71
73
|
};
|
|
72
74
|
|
|
@@ -75,6 +77,7 @@ var $f3862a5e5adf53a4$exports = {};
|
|
|
75
77
|
$f3862a5e5adf53a4$exports = {
|
|
76
78
|
"actions": `Handlinger`,
|
|
77
79
|
"hideButtonLabel": `Vis mindre`,
|
|
80
|
+
"noTags": `Ingen`,
|
|
78
81
|
"showAllButtonLabel": (args, formatter)=>`Vis alle (${formatter.number(args.tagCount)})`
|
|
79
82
|
};
|
|
80
83
|
|
|
@@ -83,6 +86,7 @@ var $74c0b6e11258b497$exports = {};
|
|
|
83
86
|
$74c0b6e11258b497$exports = {
|
|
84
87
|
"actions": `Aktionen`,
|
|
85
88
|
"hideButtonLabel": `Weniger zeigen`,
|
|
89
|
+
"noTags": `Keine`,
|
|
86
90
|
"showAllButtonLabel": (args, formatter)=>`Alle anzeigen (${formatter.number(args.tagCount)})`
|
|
87
91
|
};
|
|
88
92
|
|
|
@@ -91,6 +95,7 @@ var $54fc4e3090259431$exports = {};
|
|
|
91
95
|
$54fc4e3090259431$exports = {
|
|
92
96
|
"actions": `Ενέργειες`,
|
|
93
97
|
"hideButtonLabel": `Εμφάνιση λιγότερων`,
|
|
98
|
+
"noTags": `Κανένα`,
|
|
94
99
|
"showAllButtonLabel": (args, formatter)=>`Εμφάνιση όλων (${formatter.number(args.tagCount)})`
|
|
95
100
|
};
|
|
96
101
|
|
|
@@ -108,6 +113,7 @@ var $b15ad3cf4b213b8e$exports = {};
|
|
|
108
113
|
$b15ad3cf4b213b8e$exports = {
|
|
109
114
|
"actions": `Acciones`,
|
|
110
115
|
"hideButtonLabel": `Mostrar menos`,
|
|
116
|
+
"noTags": `Ninguno`,
|
|
111
117
|
"showAllButtonLabel": (args, formatter)=>`Mostrar todo (${formatter.number(args.tagCount)})`
|
|
112
118
|
};
|
|
113
119
|
|
|
@@ -116,6 +122,7 @@ var $36cfda096c3db653$exports = {};
|
|
|
116
122
|
$36cfda096c3db653$exports = {
|
|
117
123
|
"actions": `Toimingud`,
|
|
118
124
|
"hideButtonLabel": `Kuva vähem`,
|
|
125
|
+
"noTags": `Puudub`,
|
|
119
126
|
"showAllButtonLabel": (args, formatter)=>`Kuva kõik (${formatter.number(args.tagCount)})`
|
|
120
127
|
};
|
|
121
128
|
|
|
@@ -124,6 +131,7 @@ var $1a42e74299cab64d$exports = {};
|
|
|
124
131
|
$1a42e74299cab64d$exports = {
|
|
125
132
|
"actions": `Toiminnot`,
|
|
126
133
|
"hideButtonLabel": `Näytä vähemmän`,
|
|
134
|
+
"noTags": `Ei mitään`,
|
|
127
135
|
"showAllButtonLabel": (args, formatter)=>`Näytä kaikki (${formatter.number(args.tagCount)})`
|
|
128
136
|
};
|
|
129
137
|
|
|
@@ -132,6 +140,7 @@ var $dd8d3f41a5bfc373$exports = {};
|
|
|
132
140
|
$dd8d3f41a5bfc373$exports = {
|
|
133
141
|
"actions": `Actions`,
|
|
134
142
|
"hideButtonLabel": `Afficher moins`,
|
|
143
|
+
"noTags": `Aucun`,
|
|
135
144
|
"showAllButtonLabel": (args, formatter)=>`Tout afficher (${formatter.number(args.tagCount)})`
|
|
136
145
|
};
|
|
137
146
|
|
|
@@ -140,6 +149,7 @@ var $35d68da324c3ed3e$exports = {};
|
|
|
140
149
|
$35d68da324c3ed3e$exports = {
|
|
141
150
|
"actions": `פעולות`,
|
|
142
151
|
"hideButtonLabel": `הצג פחות`,
|
|
152
|
+
"noTags": `ללא`,
|
|
143
153
|
"showAllButtonLabel": (args, formatter)=>`הצג הכל (${formatter.number(args.tagCount)})`
|
|
144
154
|
};
|
|
145
155
|
|
|
@@ -148,6 +158,7 @@ var $92746ce1284cd29f$exports = {};
|
|
|
148
158
|
$92746ce1284cd29f$exports = {
|
|
149
159
|
"actions": `Radnje`,
|
|
150
160
|
"hideButtonLabel": `Prikaži manje`,
|
|
161
|
+
"noTags": `Nema`,
|
|
151
162
|
"showAllButtonLabel": (args, formatter)=>`Prikaži sve (${formatter.number(args.tagCount)})`
|
|
152
163
|
};
|
|
153
164
|
|
|
@@ -156,6 +167,7 @@ var $570956f4f59f34b9$exports = {};
|
|
|
156
167
|
$570956f4f59f34b9$exports = {
|
|
157
168
|
"actions": `Műveletek`,
|
|
158
169
|
"hideButtonLabel": `Mutass kevesebbet`,
|
|
170
|
+
"noTags": `Egyik sem`,
|
|
159
171
|
"showAllButtonLabel": (args, formatter)=>`Az összes megjelenítése (${formatter.number(args.tagCount)})`
|
|
160
172
|
};
|
|
161
173
|
|
|
@@ -164,6 +176,7 @@ var $f680d16d6f0d92d8$exports = {};
|
|
|
164
176
|
$f680d16d6f0d92d8$exports = {
|
|
165
177
|
"actions": `Azioni`,
|
|
166
178
|
"hideButtonLabel": `Mostra meno`,
|
|
179
|
+
"noTags": `Nessuno`,
|
|
167
180
|
"showAllButtonLabel": (args, formatter)=>`Mostra tutto (${formatter.number(args.tagCount)})`
|
|
168
181
|
};
|
|
169
182
|
|
|
@@ -172,6 +185,7 @@ var $d28c56f33dc08452$exports = {};
|
|
|
172
185
|
$d28c56f33dc08452$exports = {
|
|
173
186
|
"actions": `アクション`,
|
|
174
187
|
"hideButtonLabel": `表示を減らす`,
|
|
188
|
+
"noTags": `なし`,
|
|
175
189
|
"showAllButtonLabel": (args, formatter)=>`すべての (${formatter.number(args.tagCount)}) を表示`
|
|
176
190
|
};
|
|
177
191
|
|
|
@@ -180,6 +194,7 @@ var $fc6f973338bd2d9c$exports = {};
|
|
|
180
194
|
$fc6f973338bd2d9c$exports = {
|
|
181
195
|
"actions": `액션`,
|
|
182
196
|
"hideButtonLabel": `간단히 표시`,
|
|
197
|
+
"noTags": `없음`,
|
|
183
198
|
"showAllButtonLabel": (args, formatter)=>`모두 표시 (${formatter.number(args.tagCount)})`
|
|
184
199
|
};
|
|
185
200
|
|
|
@@ -188,6 +203,7 @@ var $8664f3f6a18cfaa6$exports = {};
|
|
|
188
203
|
$8664f3f6a18cfaa6$exports = {
|
|
189
204
|
"actions": `Veiksmai`,
|
|
190
205
|
"hideButtonLabel": `Rodyti mažiau`,
|
|
206
|
+
"noTags": `Nėra`,
|
|
191
207
|
"showAllButtonLabel": (args, formatter)=>`Rodyti viską (${formatter.number(args.tagCount)})`
|
|
192
208
|
};
|
|
193
209
|
|
|
@@ -196,6 +212,7 @@ var $bd6e0fb18b482534$exports = {};
|
|
|
196
212
|
$bd6e0fb18b482534$exports = {
|
|
197
213
|
"actions": `Darbības`,
|
|
198
214
|
"hideButtonLabel": `Rādīt mazāk`,
|
|
215
|
+
"noTags": `Nav`,
|
|
199
216
|
"showAllButtonLabel": (args, formatter)=>`Rādīt visu (${formatter.number(args.tagCount)})`
|
|
200
217
|
};
|
|
201
218
|
|
|
@@ -204,6 +221,7 @@ var $3df66303c61fb25b$exports = {};
|
|
|
204
221
|
$3df66303c61fb25b$exports = {
|
|
205
222
|
"actions": `Handlinger`,
|
|
206
223
|
"hideButtonLabel": `Vis mindre`,
|
|
224
|
+
"noTags": `Ingen`,
|
|
207
225
|
"showAllButtonLabel": (args, formatter)=>`Vis alle (${formatter.number(args.tagCount)})`
|
|
208
226
|
};
|
|
209
227
|
|
|
@@ -212,6 +230,7 @@ var $0f533b61cdf70176$exports = {};
|
|
|
212
230
|
$0f533b61cdf70176$exports = {
|
|
213
231
|
"actions": `Acties`,
|
|
214
232
|
"hideButtonLabel": `Minder weergeven`,
|
|
233
|
+
"noTags": `Geen`,
|
|
215
234
|
"showAllButtonLabel": (args, formatter)=>`Alles tonen (${formatter.number(args.tagCount)})`
|
|
216
235
|
};
|
|
217
236
|
|
|
@@ -220,6 +239,7 @@ var $03a6cd8f61b18787$exports = {};
|
|
|
220
239
|
$03a6cd8f61b18787$exports = {
|
|
221
240
|
"actions": `Działania`,
|
|
222
241
|
"hideButtonLabel": `Wyświetl mniej`,
|
|
242
|
+
"noTags": `Brak`,
|
|
223
243
|
"showAllButtonLabel": (args, formatter)=>`Pokaż wszystko (${formatter.number(args.tagCount)})`
|
|
224
244
|
};
|
|
225
245
|
|
|
@@ -228,6 +248,7 @@ var $c726a9d931f60c66$exports = {};
|
|
|
228
248
|
$c726a9d931f60c66$exports = {
|
|
229
249
|
"actions": `Ações`,
|
|
230
250
|
"hideButtonLabel": `Mostrar menos`,
|
|
251
|
+
"noTags": `Nenhum`,
|
|
231
252
|
"showAllButtonLabel": (args, formatter)=>`Mostrar tudo (${formatter.number(args.tagCount)})`
|
|
232
253
|
};
|
|
233
254
|
|
|
@@ -236,6 +257,7 @@ var $ae9982f17f7235eb$exports = {};
|
|
|
236
257
|
$ae9982f17f7235eb$exports = {
|
|
237
258
|
"actions": `Ações`,
|
|
238
259
|
"hideButtonLabel": `Mostrar menos`,
|
|
260
|
+
"noTags": `Nenhum`,
|
|
239
261
|
"showAllButtonLabel": (args, formatter)=>`Mostrar tudo (${formatter.number(args.tagCount)})`
|
|
240
262
|
};
|
|
241
263
|
|
|
@@ -244,6 +266,7 @@ var $c756723b814c63fa$exports = {};
|
|
|
244
266
|
$c756723b814c63fa$exports = {
|
|
245
267
|
"actions": `Acțiuni`,
|
|
246
268
|
"hideButtonLabel": `Se afișează mai puțin`,
|
|
269
|
+
"noTags": `Niciuna`,
|
|
247
270
|
"showAllButtonLabel": (args, formatter)=>`Se afișează tot (${formatter.number(args.tagCount)})`
|
|
248
271
|
};
|
|
249
272
|
|
|
@@ -252,6 +275,7 @@ var $1601284ef6ec0730$exports = {};
|
|
|
252
275
|
$1601284ef6ec0730$exports = {
|
|
253
276
|
"actions": `Действия`,
|
|
254
277
|
"hideButtonLabel": `Показать меньше`,
|
|
278
|
+
"noTags": `Нет`,
|
|
255
279
|
"showAllButtonLabel": (args, formatter)=>`Показать все (${formatter.number(args.tagCount)})`
|
|
256
280
|
};
|
|
257
281
|
|
|
@@ -260,6 +284,7 @@ var $0388aac8e3bc5b59$exports = {};
|
|
|
260
284
|
$0388aac8e3bc5b59$exports = {
|
|
261
285
|
"actions": `Akcie`,
|
|
262
286
|
"hideButtonLabel": `Zobraziť menej`,
|
|
287
|
+
"noTags": `Žiadne`,
|
|
263
288
|
"showAllButtonLabel": (args, formatter)=>`Zobraziť všetko (${formatter.number(args.tagCount)})`
|
|
264
289
|
};
|
|
265
290
|
|
|
@@ -268,6 +293,7 @@ var $247d9c4a71da6b08$exports = {};
|
|
|
268
293
|
$247d9c4a71da6b08$exports = {
|
|
269
294
|
"actions": `Dejanja`,
|
|
270
295
|
"hideButtonLabel": `Prikaži manj`,
|
|
296
|
+
"noTags": `Nič`,
|
|
271
297
|
"showAllButtonLabel": (args, formatter)=>`Prikaž vse (${formatter.number(args.tagCount)})`
|
|
272
298
|
};
|
|
273
299
|
|
|
@@ -276,6 +302,7 @@ var $91424dbafdc02f68$exports = {};
|
|
|
276
302
|
$91424dbafdc02f68$exports = {
|
|
277
303
|
"actions": `Radnje`,
|
|
278
304
|
"hideButtonLabel": `Prikaži manje`,
|
|
305
|
+
"noTags": `Ne postoji`,
|
|
279
306
|
"showAllButtonLabel": (args, formatter)=>`Prikaži sve (${formatter.number(args.tagCount)})`
|
|
280
307
|
};
|
|
281
308
|
|
|
@@ -284,6 +311,7 @@ var $23c23096b6c1b0fa$exports = {};
|
|
|
284
311
|
$23c23096b6c1b0fa$exports = {
|
|
285
312
|
"actions": `Åtgärder`,
|
|
286
313
|
"hideButtonLabel": `Visa mindre`,
|
|
314
|
+
"noTags": `Ingen`,
|
|
287
315
|
"showAllButtonLabel": (args, formatter)=>`Visa alla (${formatter.number(args.tagCount)})`
|
|
288
316
|
};
|
|
289
317
|
|
|
@@ -292,6 +320,7 @@ var $d82875ae28963e58$exports = {};
|
|
|
292
320
|
$d82875ae28963e58$exports = {
|
|
293
321
|
"actions": `Eylemler`,
|
|
294
322
|
"hideButtonLabel": `Daha az göster`,
|
|
323
|
+
"noTags": `Hiçbiri`,
|
|
295
324
|
"showAllButtonLabel": (args, formatter)=>`Tümünü göster (${formatter.number(args.tagCount)})`
|
|
296
325
|
};
|
|
297
326
|
|
|
@@ -300,6 +329,7 @@ var $1dd153688f5574fc$exports = {};
|
|
|
300
329
|
$1dd153688f5574fc$exports = {
|
|
301
330
|
"actions": `Дії`,
|
|
302
331
|
"hideButtonLabel": `Показувати менше`,
|
|
332
|
+
"noTags": `Немає`,
|
|
303
333
|
"showAllButtonLabel": (args, formatter)=>`Показати всі (${formatter.number(args.tagCount)})`
|
|
304
334
|
};
|
|
305
335
|
|
|
@@ -308,6 +338,7 @@ var $6427307c9596258c$exports = {};
|
|
|
308
338
|
$6427307c9596258c$exports = {
|
|
309
339
|
"actions": `操作`,
|
|
310
340
|
"hideButtonLabel": `显示更少`,
|
|
341
|
+
"noTags": `无`,
|
|
311
342
|
"showAllButtonLabel": (args, formatter)=>`全部显示 (${formatter.number(args.tagCount)})`
|
|
312
343
|
};
|
|
313
344
|
|
|
@@ -316,6 +347,7 @@ var $18b85da2aafaaf3e$exports = {};
|
|
|
316
347
|
$18b85da2aafaaf3e$exports = {
|
|
317
348
|
"actions": `動作`,
|
|
318
349
|
"hideButtonLabel": `顯示較少`,
|
|
350
|
+
"noTags": `無`,
|
|
319
351
|
"showAllButtonLabel": (args, formatter)=>`顯示全部 (${formatter.number(args.tagCount)})`
|
|
320
352
|
};
|
|
321
353
|
|
|
@@ -498,6 +530,16 @@ function $b5f5ee35d3b6b95c$var$TagRemoveButton(props) {
|
|
|
498
530
|
|
|
499
531
|
|
|
500
532
|
|
|
533
|
+
const $880d112c7a588209$var$TAG_STYLES = {
|
|
534
|
+
medium: {
|
|
535
|
+
height: 24,
|
|
536
|
+
margin: 4
|
|
537
|
+
},
|
|
538
|
+
large: {
|
|
539
|
+
height: 30,
|
|
540
|
+
margin: 5
|
|
541
|
+
}
|
|
542
|
+
};
|
|
501
543
|
function $880d112c7a588209$var$TagGroup(props, ref) {
|
|
502
544
|
props = (0, $fUaQ2$useProviderProps)(props);
|
|
503
545
|
props = (0, $fUaQ2$useFormProps)(props);
|
|
@@ -506,13 +548,13 @@ function $880d112c7a588209$var$TagGroup(props, ref) {
|
|
|
506
548
|
let containerRef = (0, $fUaQ2$useRef)(null);
|
|
507
549
|
let tagsRef = (0, $fUaQ2$useRef)(null);
|
|
508
550
|
let { direction: direction } = (0, $fUaQ2$useLocale)();
|
|
551
|
+
let { scale: scale } = (0, $fUaQ2$useProvider)();
|
|
509
552
|
let stringFormatter = (0, $fUaQ2$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($70cc9ce0ced2eb4a$exports))));
|
|
510
553
|
let [isCollapsed, setIsCollapsed] = (0, $fUaQ2$useState)(maxRows != null);
|
|
511
554
|
let state = (0, $fUaQ2$useListState)(props);
|
|
512
555
|
let [tagState, setTagState] = (0, $fUaQ2$useValueEffect)({
|
|
513
556
|
visibleTagCount: state.collection.size,
|
|
514
|
-
showCollapseButton: false
|
|
515
|
-
maxHeight: undefined
|
|
557
|
+
showCollapseButton: false
|
|
516
558
|
});
|
|
517
559
|
let keyboardDelegate = (0, $fUaQ2$useMemo)(()=>isCollapsed ? new (0, $fUaQ2$TagKeyboardDelegate)(new (0, $fUaQ2$ListCollection)([
|
|
518
560
|
...state.collection
|
|
@@ -531,30 +573,26 @@ function $880d112c7a588209$var$TagGroup(props, ref) {
|
|
|
531
573
|
keyboardDelegate: keyboardDelegate
|
|
532
574
|
}, state, tagsRef);
|
|
533
575
|
let actionsId = (0, $fUaQ2$useId)();
|
|
576
|
+
let actionsRef = (0, $fUaQ2$useRef)(null);
|
|
534
577
|
let updateVisibleTagCount = (0, $fUaQ2$useCallback)(()=>{
|
|
535
578
|
if (maxRows > 0) {
|
|
536
579
|
let computeVisibleTagCount = ()=>{
|
|
537
|
-
var _tags_;
|
|
538
580
|
// Refs can be null at runtime.
|
|
539
581
|
let currContainerRef = containerRef.current;
|
|
540
582
|
let currTagsRef = tagsRef.current;
|
|
541
|
-
|
|
583
|
+
let currActionsRef = actionsRef.current;
|
|
584
|
+
if (!currContainerRef || !currTagsRef || state.collection.size === 0) return {
|
|
585
|
+
visibleTagCount: 0,
|
|
586
|
+
showCollapseButton: false
|
|
587
|
+
};
|
|
588
|
+
// Count rows and show tags until we hit the maxRows.
|
|
542
589
|
let tags = [
|
|
543
590
|
...currTagsRef.children
|
|
544
591
|
];
|
|
545
|
-
let buttons = [
|
|
546
|
-
...currContainerRef.parentElement.querySelectorAll("button")
|
|
547
|
-
];
|
|
548
|
-
if (tags.length === 0 || buttons.length === 0) return {
|
|
549
|
-
visibleTagCount: 0,
|
|
550
|
-
showCollapseButton: false,
|
|
551
|
-
maxHeight: undefined
|
|
552
|
-
};
|
|
553
592
|
let currY = -Infinity;
|
|
554
593
|
let rowCount = 0;
|
|
555
594
|
let index = 0;
|
|
556
595
|
let tagWidths = [];
|
|
557
|
-
// Count rows and show tags until we hit the maxRows.
|
|
558
596
|
for (let tag of tags){
|
|
559
597
|
let { width: width , y: y } = tag.getBoundingClientRect();
|
|
560
598
|
if (y !== currY) {
|
|
@@ -566,31 +604,33 @@ function $880d112c7a588209$var$TagGroup(props, ref) {
|
|
|
566
604
|
index++;
|
|
567
605
|
}
|
|
568
606
|
// Remove tags until there is space for the collapse button and action button (if present) on the last row.
|
|
569
|
-
let
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
index
|
|
607
|
+
let buttons = [
|
|
608
|
+
...currActionsRef.children
|
|
609
|
+
];
|
|
610
|
+
if (buttons.length > 0 && rowCount >= maxRows) {
|
|
611
|
+
var _tags_;
|
|
612
|
+
let buttonsWidth = buttons.reduce((acc, curr)=>acc += curr.getBoundingClientRect().width, 0);
|
|
613
|
+
buttonsWidth += $880d112c7a588209$var$TAG_STYLES[scale].margin * 2 * buttons.length;
|
|
614
|
+
let end = direction === "ltr" ? "right" : "left";
|
|
615
|
+
let containerEnd = currContainerRef.parentElement.getBoundingClientRect()[end];
|
|
616
|
+
let lastTagEnd = (_tags_ = tags[index - 1]) === null || _tags_ === void 0 ? void 0 : _tags_.getBoundingClientRect()[end];
|
|
617
|
+
lastTagEnd += $880d112c7a588209$var$TAG_STYLES[scale].margin;
|
|
618
|
+
let availableWidth = containerEnd - lastTagEnd;
|
|
619
|
+
while(availableWidth < buttonsWidth && index > 0){
|
|
620
|
+
availableWidth += tagWidths.pop();
|
|
621
|
+
index--;
|
|
622
|
+
}
|
|
579
623
|
}
|
|
580
|
-
let tagStyle = window.getComputedStyle(tags[0]);
|
|
581
|
-
let maxHeight = (parseInt(tagStyle.height, 10) + parseInt(tagStyle.marginTop, 10) * 2) * maxRows;
|
|
582
624
|
return {
|
|
583
|
-
visibleTagCount: index,
|
|
584
|
-
showCollapseButton: index < state.collection.size
|
|
585
|
-
maxHeight: maxHeight
|
|
625
|
+
visibleTagCount: Math.max(index, 1),
|
|
626
|
+
showCollapseButton: index < state.collection.size
|
|
586
627
|
};
|
|
587
628
|
};
|
|
588
629
|
setTagState(function*() {
|
|
589
630
|
// Update to show all items.
|
|
590
631
|
yield {
|
|
591
632
|
visibleTagCount: state.collection.size,
|
|
592
|
-
showCollapseButton: true
|
|
593
|
-
maxHeight: undefined
|
|
633
|
+
showCollapseButton: true
|
|
594
634
|
};
|
|
595
635
|
// Measure, and update to show the items until maxRows is reached.
|
|
596
636
|
yield computeVisibleTagCount();
|
|
@@ -600,6 +640,7 @@ function $880d112c7a588209$var$TagGroup(props, ref) {
|
|
|
600
640
|
maxRows,
|
|
601
641
|
setTagState,
|
|
602
642
|
direction,
|
|
643
|
+
scale,
|
|
603
644
|
state.collection.size
|
|
604
645
|
]);
|
|
605
646
|
(0, $fUaQ2$useResizeObserver)({
|
|
@@ -616,10 +657,13 @@ function $880d112c7a588209$var$TagGroup(props, ref) {
|
|
|
616
657
|
(_document_fonts = document.fonts) === null || _document_fonts === void 0 ? void 0 : _document_fonts.ready.then(()=>updateVisibleTagCount());
|
|
617
658
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
618
659
|
}, []);
|
|
619
|
-
let visibleTags = [
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
660
|
+
let visibleTags = (0, $fUaQ2$useMemo)(()=>[
|
|
661
|
+
...state.collection
|
|
662
|
+
].slice(0, isCollapsed ? tagState.visibleTagCount : state.collection.size), [
|
|
663
|
+
isCollapsed,
|
|
664
|
+
state.collection,
|
|
665
|
+
tagState.visibleTagCount
|
|
666
|
+
]);
|
|
623
667
|
let handlePressCollapse = ()=>{
|
|
624
668
|
// Prevents button from losing focus if focusedKey got collapsed.
|
|
625
669
|
state.selectionManager.setFocusedKey(null);
|
|
@@ -627,6 +671,18 @@ function $880d112c7a588209$var$TagGroup(props, ref) {
|
|
|
627
671
|
};
|
|
628
672
|
let showActions = tagState.showCollapseButton || actionLabel && onAction;
|
|
629
673
|
let isEmpty = state.collection.size === 0;
|
|
674
|
+
let containerStyle = (0, $fUaQ2$useMemo)(()=>{
|
|
675
|
+
if (maxRows == null || !isCollapsed) return undefined;
|
|
676
|
+
let maxHeight = ($880d112c7a588209$var$TAG_STYLES[scale].height + $880d112c7a588209$var$TAG_STYLES[scale].margin * 2) * maxRows;
|
|
677
|
+
return {
|
|
678
|
+
maxHeight: maxHeight,
|
|
679
|
+
overflow: "hidden"
|
|
680
|
+
};
|
|
681
|
+
}, [
|
|
682
|
+
isCollapsed,
|
|
683
|
+
maxRows,
|
|
684
|
+
scale
|
|
685
|
+
]);
|
|
630
686
|
return /*#__PURE__*/ (0, $fUaQ2$react).createElement((0, $fUaQ2$FocusScope), null, /*#__PURE__*/ (0, $fUaQ2$react).createElement((0, $fUaQ2$Field), {
|
|
631
687
|
...props,
|
|
632
688
|
labelProps: labelProps,
|
|
@@ -639,11 +695,8 @@ function $880d112c7a588209$var$TagGroup(props, ref) {
|
|
|
639
695
|
"spectrum-Tags-fieldWrapper--positionSide": labelPosition === "side"
|
|
640
696
|
})
|
|
641
697
|
}, /*#__PURE__*/ (0, $fUaQ2$react).createElement("div", {
|
|
642
|
-
style: maxRows != null && tagState.showCollapseButton && isCollapsed ? {
|
|
643
|
-
maxHeight: tagState.maxHeight,
|
|
644
|
-
overflow: "hidden"
|
|
645
|
-
} : undefined,
|
|
646
698
|
ref: containerRef,
|
|
699
|
+
style: containerStyle,
|
|
647
700
|
className: (0, $fUaQ2$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($c033a7c057e84ef1$exports))), "spectrum-Tags-container", {
|
|
648
701
|
"spectrum-Tags-container--empty": isEmpty
|
|
649
702
|
})
|
|
@@ -666,6 +719,7 @@ function $880d112c7a588209$var$TagGroup(props, ref) {
|
|
|
666
719
|
isDisabled: false
|
|
667
720
|
}, /*#__PURE__*/ (0, $fUaQ2$react).createElement("div", {
|
|
668
721
|
role: "group",
|
|
722
|
+
ref: actionsRef,
|
|
669
723
|
id: actionsId,
|
|
670
724
|
"aria-label": stringFormatter.format("actions"),
|
|
671
725
|
"aria-labelledby": `${gridProps.id} ${actionsId}`,
|