@react-aria/tag 3.0.0-nightly.3180 → 3.0.0

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/main.js CHANGED
@@ -1,228 +1,346 @@
1
- var $bSzeT$reactariagrid = require("@react-aria/grid");
2
1
  var $bSzeT$reactariautils = require("@react-aria/utils");
2
+ var $bSzeT$reactariagridlist = require("@react-aria/gridlist");
3
+ var $bSzeT$reactariainteractions = require("@react-aria/interactions");
3
4
  var $bSzeT$reactariai18n = require("@react-aria/i18n");
4
5
  var $bSzeT$react = require("react");
5
- var $bSzeT$reactariainteractions = require("@react-aria/interactions");
6
+ var $bSzeT$reactariaselection = require("@react-aria/selection");
7
+ var $bSzeT$reactarialabel = require("@react-aria/label");
6
8
 
7
- function $parcel$exportWildcard(dest, source) {
8
- Object.keys(source).forEach(function(key) {
9
- if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
10
- return;
11
- }
12
-
13
- Object.defineProperty(dest, key, {
14
- enumerable: true,
15
- get: function get() {
16
- return source[key];
17
- }
18
- });
19
- });
20
-
21
- return dest;
22
- }
23
9
  function $parcel$export(e, n, v, s) {
24
10
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
25
11
  }
26
12
  function $parcel$interopDefault(a) {
27
13
  return a && a.__esModule ? a.default : a;
28
14
  }
29
- var $d3d7c73f2e3f4edb$exports = {};
30
-
31
- $parcel$export($d3d7c73f2e3f4edb$exports, "TagKeyboardDelegate", () => $d3d7c73f2e3f4edb$export$b00754732e683b92);
32
-
33
- class $d3d7c73f2e3f4edb$export$b00754732e683b92 extends $bSzeT$reactariagrid.GridKeyboardDelegate {
34
- getKeyRightOf(key) {
35
- return this.direction === 'rtl' ? this.getKeyAbove(key) : this.getKeyBelow(key);
36
- }
37
- getKeyLeftOf(key) {
38
- return this.direction === 'rtl' ? this.getKeyBelow(key) : this.getKeyAbove(key);
39
- }
40
- getKeyBelow(key) {
41
- let startItem = this.collection.getItem(key);
42
- if (!startItem) return;
43
- // If focus was on a cell, start searching from the parent row
44
- if (this.isCell(startItem)) key = startItem.parentKey;
45
- // Find the next item
46
- key = this.findNextKey(key);
47
- if (key != null) {
48
- // If focus was on a cell, focus the cell with the same index in the next row.
49
- if (this.isCell(startItem)) {
50
- let item = this.collection.getItem(key);
51
- let newKey = [
52
- ...item.childNodes
53
- ][startItem.index].key;
54
- // Ignore disabled tags
55
- if (this.disabledKeys.has(newKey)) return this.getKeyBelow(newKey);
56
- return newKey;
57
- }
58
- // Otherwise, focus the next row
59
- if (this.focusMode === 'row') return key;
60
- }
61
- }
62
- getKeyAbove(key) {
63
- let startItem = this.collection.getItem(key);
64
- if (!startItem) return;
65
- // If focus is on a cell, start searching from the parent row
66
- if (this.isCell(startItem)) key = startItem.parentKey;
67
- // Find the previous item
68
- key = this.findPreviousKey(key);
69
- if (key != null) {
70
- // If focus was on a cell, focus the cell with the same index in the previous row.
71
- if (this.isCell(startItem)) {
72
- let item = this.collection.getItem(key);
73
- let newKey = [
74
- ...item.childNodes
75
- ][startItem.index].key;
76
- // ignore disabled tags
77
- if (this.disabledKeys.has(newKey)) return this.getKeyAbove(newKey);
78
- return newKey;
79
- }
80
- // Otherwise, focus the previous row
81
- if (this.focusMode === 'row') return key;
82
- }
83
- }
84
- }
85
-
86
15
 
87
- var $a442534c81d8ad16$exports = {};
16
+ $parcel$export(module.exports, "useTag", () => $a442534c81d8ad16$export$3f568fff7dff2f03);
17
+ $parcel$export(module.exports, "useTagGroup", () => $09704b0efefe5140$export$4f8b5cda58b7e8ff);
18
+ /*
19
+ * Copyright 2020 Adobe. All rights reserved.
20
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
21
+ * you may not use this file except in compliance with the License. You may obtain a copy
22
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
23
+ *
24
+ * Unless required by applicable law or agreed to in writing, software distributed under
25
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
26
+ * OF ANY KIND, either express or implied. See the License for the specific language
27
+ * governing permissions and limitations under the License.
28
+ */ /*
29
+ * Copyright 2020 Adobe. All rights reserved.
30
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
31
+ * you may not use this file except in compliance with the License. You may obtain a copy
32
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
33
+ *
34
+ * Unless required by applicable law or agreed to in writing, software distributed under
35
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
36
+ * OF ANY KIND, either express or implied. See the License for the specific language
37
+ * governing permissions and limitations under the License.
38
+ */
39
+ /*
40
+ * Copyright 2020 Adobe. All rights reserved.
41
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
42
+ * you may not use this file except in compliance with the License. You may obtain a copy
43
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
44
+ *
45
+ * Unless required by applicable law or agreed to in writing, software distributed under
46
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
47
+ * OF ANY KIND, either express or implied. See the License for the specific language
48
+ * governing permissions and limitations under the License.
49
+ */
50
+
51
+
52
+
53
+
54
+
55
+
56
+ const $09704b0efefe5140$export$653eddfc964b0f8a = new WeakMap();
57
+ function $09704b0efefe5140$export$4f8b5cda58b7e8ff(props, state, ref) {
58
+ let { direction: direction } = (0, $bSzeT$reactariai18n.useLocale)();
59
+ let keyboardDelegate = props.keyboardDelegate || new (0, $bSzeT$reactariaselection.ListKeyboardDelegate)({
60
+ collection: state.collection,
61
+ ref: ref,
62
+ orientation: "horizontal",
63
+ direction: direction,
64
+ disabledKeys: state.disabledKeys
65
+ });
66
+ let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = (0, $bSzeT$reactarialabel.useField)(props);
67
+ let { gridProps: gridProps } = (0, $bSzeT$reactariagridlist.useGridList)({
68
+ ...props,
69
+ ...fieldProps,
70
+ keyboardDelegate: keyboardDelegate,
71
+ shouldFocusWrap: true
72
+ }, state, ref);
73
+ let [isFocusWithin, setFocusWithin] = (0, $bSzeT$react.useState)(false);
74
+ let { focusWithinProps: focusWithinProps } = (0, $bSzeT$reactariainteractions.useFocusWithin)({
75
+ onFocusWithinChange: setFocusWithin
76
+ });
77
+ let domProps = (0, $bSzeT$reactariautils.filterDOMProps)(props);
78
+ // If the last tag is removed, focus the container.
79
+ let prevCount = (0, $bSzeT$react.useRef)(state.collection.size);
80
+ (0, $bSzeT$react.useEffect)(()=>{
81
+ if (prevCount.current > 0 && state.collection.size === 0 && isFocusWithin) ref.current.focus();
82
+ prevCount.current = state.collection.size;
83
+ }, [
84
+ state.collection.size,
85
+ isFocusWithin,
86
+ ref
87
+ ]);
88
+ $09704b0efefe5140$export$653eddfc964b0f8a.set(state, {
89
+ onRemove: props.onRemove
90
+ });
91
+ return {
92
+ gridProps: (0, $bSzeT$reactariautils.mergeProps)(gridProps, domProps, {
93
+ role: state.collection.size ? "grid" : null,
94
+ "aria-atomic": false,
95
+ "aria-relevant": "additions",
96
+ "aria-live": isFocusWithin ? "polite" : "off",
97
+ ...focusWithinProps,
98
+ ...fieldProps
99
+ }),
100
+ labelProps: labelProps,
101
+ descriptionProps: descriptionProps,
102
+ errorMessageProps: errorMessageProps
103
+ };
104
+ }
88
105
 
89
- $parcel$export($a442534c81d8ad16$exports, "useTag", () => $a442534c81d8ad16$export$3f568fff7dff2f03);
90
106
 
91
107
  var $29abb9209b62cd49$exports = {};
92
108
  var $6a4ddf1abe55d42a$exports = {};
93
- $6a4ddf1abe55d42a$exports = JSON.parse("{\"remove\":\"إزالة\"}");
109
+ $6a4ddf1abe55d42a$exports = {
110
+ "removeButtonLabel": `إزالة`,
111
+ "removeDescription": `اضغط على مفتاح DELETE لإزالة علامة.`
112
+ };
94
113
 
95
114
 
96
115
  var $1bdc82b10375b4a8$exports = {};
97
- $1bdc82b10375b4a8$exports = JSON.parse("{\"remove\":\"Премахване\"}");
116
+ $1bdc82b10375b4a8$exports = {
117
+ "removeButtonLabel": `Премахване`,
118
+ "removeDescription": `Натиснете Delete, за да премахнете маркера.`
119
+ };
98
120
 
99
121
 
100
122
  var $e3fdf009dfe14bbc$exports = {};
101
- $e3fdf009dfe14bbc$exports = JSON.parse("{\"remove\":\"Odebrat\"}");
123
+ $e3fdf009dfe14bbc$exports = {
124
+ "removeButtonLabel": `Odebrat`,
125
+ "removeDescription": `Stisknutím klávesy Delete odeberete značku.`
126
+ };
102
127
 
103
128
 
104
129
  var $8e3a8efadaa261b3$exports = {};
105
- $8e3a8efadaa261b3$exports = JSON.parse("{\"remove\":\"Fjern\"}");
130
+ $8e3a8efadaa261b3$exports = {
131
+ "removeButtonLabel": `Fjern`,
132
+ "removeDescription": `Tryk på Slet for at fjerne tag.`
133
+ };
106
134
 
107
135
 
108
136
  var $405462110cf9cc8d$exports = {};
109
- $405462110cf9cc8d$exports = JSON.parse("{\"remove\":\"Entfernen\"}");
137
+ $405462110cf9cc8d$exports = {
138
+ "removeButtonLabel": `Entfernen`,
139
+ "removeDescription": `Auf „Löschen“ drücken, um das Tag zu entfernen.`
140
+ };
110
141
 
111
142
 
112
143
  var $9ec4c01646bfc149$exports = {};
113
- $9ec4c01646bfc149$exports = JSON.parse("{\"remove\":\"Κατάργηση\"}");
144
+ $9ec4c01646bfc149$exports = {
145
+ "removeButtonLabel": `Κατάργηση`,
146
+ "removeDescription": `Πατήστε Διαγραφή για να καταργήσετε την ετικέτα.`
147
+ };
114
148
 
115
149
 
116
150
  var $0b797b6d677cd5c7$exports = {};
117
- $0b797b6d677cd5c7$exports = JSON.parse("{\"remove\":\"Remove\"}");
151
+ $0b797b6d677cd5c7$exports = {
152
+ "removeDescription": `Press Delete to remove tag.`,
153
+ "removeButtonLabel": `Remove`
154
+ };
118
155
 
119
156
 
120
157
  var $bacdb4955d86e000$exports = {};
121
- $bacdb4955d86e000$exports = JSON.parse("{\"remove\":\"Quitar\"}");
158
+ $bacdb4955d86e000$exports = {
159
+ "removeButtonLabel": `Quitar`,
160
+ "removeDescription": `Pulse Eliminar para quitar la etiqueta.`
161
+ };
122
162
 
123
163
 
124
164
  var $28e6b3e2003cb89e$exports = {};
125
- $28e6b3e2003cb89e$exports = JSON.parse("{\"remove\":\"Eemalda\"}");
165
+ $28e6b3e2003cb89e$exports = {
166
+ "removeButtonLabel": `Eemalda`,
167
+ "removeDescription": `Sildi eemaldamiseks vajutage kustutusklahvi Delete.`
168
+ };
126
169
 
127
170
 
128
171
  var $080ec9a9a4197fc3$exports = {};
129
- $080ec9a9a4197fc3$exports = JSON.parse("{\"remove\":\"Poista\"}");
172
+ $080ec9a9a4197fc3$exports = {
173
+ "removeButtonLabel": `Poista`,
174
+ "removeDescription": `Poista tunniste painamalla Poista-painiketta.`
175
+ };
130
176
 
131
177
 
132
178
  var $d186548cad5da12b$exports = {};
133
- $d186548cad5da12b$exports = JSON.parse("{\"remove\":\"Supprimer\"}");
179
+ $d186548cad5da12b$exports = {
180
+ "removeButtonLabel": `Supprimer`,
181
+ "removeDescription": `Appuyez sur Supprimer pour supprimer l’étiquette.`
182
+ };
134
183
 
135
184
 
136
185
  var $58694cb16d86dce9$exports = {};
137
- $58694cb16d86dce9$exports = JSON.parse("{\"remove\":\"הסר\"}");
186
+ $58694cb16d86dce9$exports = {
187
+ "removeButtonLabel": `הסר`,
188
+ "removeDescription": `לחץ על מחק כדי להסיר תג.`
189
+ };
138
190
 
139
191
 
140
192
  var $3622620b71bc3eed$exports = {};
141
- $3622620b71bc3eed$exports = JSON.parse("{\"remove\":\"Ukloni\"}");
193
+ $3622620b71bc3eed$exports = {
194
+ "removeButtonLabel": `Ukloni`,
195
+ "removeDescription": `Pritisnite Delete za uklanjanje oznake.`
196
+ };
142
197
 
143
198
 
144
199
  var $25f88eb7a72b76e1$exports = {};
145
- $25f88eb7a72b76e1$exports = JSON.parse("{\"remove\":\"Eltávolítás\"}");
200
+ $25f88eb7a72b76e1$exports = {
201
+ "removeButtonLabel": `Eltávolítás`,
202
+ "removeDescription": `Nyomja meg a Delete billentyűt a címke eltávolításához.`
203
+ };
146
204
 
147
205
 
148
206
  var $ac7f4b0e2cb68452$exports = {};
149
- $ac7f4b0e2cb68452$exports = JSON.parse("{\"remove\":\"Rimuovi\"}");
207
+ $ac7f4b0e2cb68452$exports = {
208
+ "removeButtonLabel": `Rimuovi`,
209
+ "removeDescription": `Premi Elimina per rimuovere il tag.`
210
+ };
150
211
 
151
212
 
152
213
  var $eb1a168dda0e2196$exports = {};
153
- $eb1a168dda0e2196$exports = JSON.parse("{\"remove\":\"削除\"}");
214
+ $eb1a168dda0e2196$exports = {
215
+ "removeButtonLabel": `削除`,
216
+ "removeDescription": `タグを削除するには、Delete キーを押します。`
217
+ };
154
218
 
155
219
 
156
220
  var $eee5df414cc6e698$exports = {};
157
- $eee5df414cc6e698$exports = JSON.parse("{\"remove\":\"제거\"}");
221
+ $eee5df414cc6e698$exports = {
222
+ "removeButtonLabel": `제거`,
223
+ "removeDescription": `태그를 제거하려면 Delete 키를 누르십시오.`
224
+ };
158
225
 
159
226
 
160
227
  var $89b3b12fbd9b247d$exports = {};
161
- $89b3b12fbd9b247d$exports = JSON.parse("{\"remove\":\"Pašalinti\"}");
228
+ $89b3b12fbd9b247d$exports = {
229
+ "removeButtonLabel": `Pašalinti`,
230
+ "removeDescription": `Norėdami pašalinti žymą, paspauskite „Delete“ klavišą.`
231
+ };
162
232
 
163
233
 
164
234
  var $1919b5d1d79b472a$exports = {};
165
- $1919b5d1d79b472a$exports = JSON.parse("{\"remove\":\"Noņemt\"}");
235
+ $1919b5d1d79b472a$exports = {
236
+ "removeButtonLabel": `Noņemt`,
237
+ "removeDescription": `Nospiediet Delete [Dzēst], lai noņemtu tagu.`
238
+ };
166
239
 
167
240
 
168
241
  var $19c1a9b6c040fcbd$exports = {};
169
- $19c1a9b6c040fcbd$exports = JSON.parse("{\"remove\":\"Fjern\"}");
242
+ $19c1a9b6c040fcbd$exports = {
243
+ "removeButtonLabel": `Fjern`,
244
+ "removeDescription": `Trykk på Slett for å fjerne taggen.`
245
+ };
170
246
 
171
247
 
172
248
  var $be2ec555d5f5fd09$exports = {};
173
- $be2ec555d5f5fd09$exports = JSON.parse("{\"remove\":\"Verwijderen\"}");
249
+ $be2ec555d5f5fd09$exports = {
250
+ "removeButtonLabel": `Verwijderen`,
251
+ "removeDescription": `Druk op Verwijderen om de tag te verwijderen.`
252
+ };
174
253
 
175
254
 
176
255
  var $949a33b7200b0e13$exports = {};
177
- $949a33b7200b0e13$exports = JSON.parse("{\"remove\":\"Usuń\"}");
256
+ $949a33b7200b0e13$exports = {
257
+ "removeButtonLabel": `Usuń`,
258
+ "removeDescription": `Naciśnij Usuń, aby usunąć znacznik.`
259
+ };
178
260
 
179
261
 
180
262
  var $ae5f6174df72ed0e$exports = {};
181
- $ae5f6174df72ed0e$exports = JSON.parse("{\"remove\":\"Remover\"}");
263
+ $ae5f6174df72ed0e$exports = {
264
+ "removeButtonLabel": `Remover`,
265
+ "removeDescription": `Pressione Delete para remover a tag.`
266
+ };
182
267
 
183
268
 
184
269
  var $f93b2eb3a2267af4$exports = {};
185
- $f93b2eb3a2267af4$exports = JSON.parse("{\"remove\":\"Eliminar\"}");
270
+ $f93b2eb3a2267af4$exports = {
271
+ "removeButtonLabel": `Eliminar`,
272
+ "removeDescription": `Prima Delete para eliminar a tag.`
273
+ };
186
274
 
187
275
 
188
276
  var $0986e262b15bfc91$exports = {};
189
- $0986e262b15bfc91$exports = JSON.parse("{\"remove\":\"Îndepărtaţi\"}");
277
+ $0986e262b15bfc91$exports = {
278
+ "removeButtonLabel": `Îndepărtaţi`,
279
+ "removeDescription": `Apăsați pe Delete (Ștergere) pentru a elimina eticheta.`
280
+ };
190
281
 
191
282
 
192
283
  var $1fc455c3f981c785$exports = {};
193
- $1fc455c3f981c785$exports = JSON.parse("{\"remove\":\"Удалить\"}");
284
+ $1fc455c3f981c785$exports = {
285
+ "removeButtonLabel": `Удалить`,
286
+ "removeDescription": `Нажмите DELETE, чтобы удалить тег.`
287
+ };
194
288
 
195
289
 
196
290
  var $93e0f346215d9446$exports = {};
197
- $93e0f346215d9446$exports = JSON.parse("{\"remove\":\"Odstrániť\"}");
291
+ $93e0f346215d9446$exports = {
292
+ "removeButtonLabel": `Odstrániť`,
293
+ "removeDescription": `Ak chcete odstrániť značku, stlačte kláves Delete.`
294
+ };
198
295
 
199
296
 
200
297
  var $fef8a51090f12761$exports = {};
201
- $fef8a51090f12761$exports = JSON.parse("{\"remove\":\"Odstrani\"}");
298
+ $fef8a51090f12761$exports = {
299
+ "removeButtonLabel": `Odstrani`,
300
+ "removeDescription": `Pritisnite Delete, da odstranite oznako.`
301
+ };
202
302
 
203
303
 
204
304
  var $04502b7a450fc878$exports = {};
205
- $04502b7a450fc878$exports = JSON.parse("{\"remove\":\"Ukloni\"}");
305
+ $04502b7a450fc878$exports = {
306
+ "removeButtonLabel": `Ukloni`,
307
+ "removeDescription": `Pritisnite Obriši da biste uklonili oznaku.`
308
+ };
206
309
 
207
310
 
208
311
  var $95460d4e4c3e3778$exports = {};
209
- $95460d4e4c3e3778$exports = JSON.parse("{\"remove\":\"Ta bort\"}");
312
+ $95460d4e4c3e3778$exports = {
313
+ "removeButtonLabel": `Ta bort`,
314
+ "removeDescription": `Tryck på Radera för att ta bort taggen.`
315
+ };
210
316
 
211
317
 
212
318
  var $818e5758c72a695c$exports = {};
213
- $818e5758c72a695c$exports = JSON.parse("{\"remove\":\"Kaldır\"}");
319
+ $818e5758c72a695c$exports = {
320
+ "removeButtonLabel": `Kaldır`,
321
+ "removeDescription": `Etiketi kaldırmak için Sil tuşuna basın.`
322
+ };
214
323
 
215
324
 
216
325
  var $5c17d07165fb1742$exports = {};
217
- $5c17d07165fb1742$exports = JSON.parse("{\"remove\":\"Видалити\"}");
326
+ $5c17d07165fb1742$exports = {
327
+ "removeButtonLabel": `Вилучити`,
328
+ "removeDescription": `Натисніть Delete, щоб вилучити тег.`
329
+ };
218
330
 
219
331
 
220
332
  var $c6666cc31aa025e0$exports = {};
221
- $c6666cc31aa025e0$exports = JSON.parse("{\"remove\":\"删除\"}");
333
+ $c6666cc31aa025e0$exports = {
334
+ "removeButtonLabel": `删除`,
335
+ "removeDescription": `按下“删除”以删除标记。`
336
+ };
222
337
 
223
338
 
224
339
  var $a34b8398aee73e0f$exports = {};
225
- $a34b8398aee73e0f$exports = JSON.parse("{\"remove\":\"移除\"}");
340
+ $a34b8398aee73e0f$exports = {
341
+ "removeButtonLabel": `移除`,
342
+ "removeDescription": `按 Delete 鍵以移除標記。`
343
+ };
226
344
 
227
345
 
228
346
  $29abb9209b62cd49$exports = {
@@ -265,97 +383,60 @@ $29abb9209b62cd49$exports = {
265
383
 
266
384
 
267
385
 
268
- function $a442534c81d8ad16$export$3f568fff7dff2f03(props, state) {
269
- let { isFocused: isFocused } = props;
270
- const { isDisabled: isDisabled , isRemovable: isRemovable , onRemove: onRemove , children: children , item: item , tagRef: tagRef , tagRowRef: tagRowRef } = props;
271
- const formatMessage = $bSzeT$reactariai18n.useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($29abb9209b62cd49$exports)));
272
- const removeString = formatMessage('remove');
273
- const labelId = $bSzeT$reactariautils.useId();
274
- const buttonId = $bSzeT$reactariautils.useId();
275
- let { rowProps: rowProps } = $bSzeT$reactariagrid.useGridRow({
386
+
387
+ function $a442534c81d8ad16$export$3f568fff7dff2f03(props, state, ref) {
388
+ let { item: item } = props;
389
+ let stringFormatter = (0, $bSzeT$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($29abb9209b62cd49$exports))));
390
+ let buttonId = (0, $bSzeT$reactariautils.useId)();
391
+ let { onRemove: onRemove } = (0, $09704b0efefe5140$export$653eddfc964b0f8a).get(state) || {};
392
+ let { rowProps: rowProps , gridCellProps: gridCellProps , ...states } = (0, $bSzeT$reactariagridlist.useGridListItem)({
276
393
  node: item
277
- }, state, tagRowRef);
278
- // Don't want the row to be focusable or accessible via keyboard
279
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
280
- let { tabIndex: tabIndex , ...otherRowProps } = rowProps;
281
- let { gridCellProps: gridCellProps } = $bSzeT$reactariagrid.useGridCell({
282
- node: [
283
- ...item.childNodes
284
- ][0],
285
- focusMode: 'cell'
286
- }, state, tagRef);
287
- function onKeyDown(e) {
288
- if (e.key === 'Delete' || e.key === 'Backspace') {
289
- onRemove(children, e);
394
+ }, state, ref);
395
+ // We want the group to handle keyboard navigation between tags.
396
+ delete rowProps.onKeyDownCapture;
397
+ delete states.descriptionProps;
398
+ let onKeyDown = (e)=>{
399
+ if (e.key === "Delete" || e.key === "Backspace") {
290
400
  e.preventDefault();
291
- }
292
- }
293
- const pressProps = {
294
- onPress: (e)=>{
295
- return onRemove === null || onRemove === void 0 ? void 0 : onRemove(children, e);
401
+ if (state.selectionManager.isSelected(item.key)) onRemove(new Set(state.selectionManager.selectedKeys));
402
+ else onRemove(new Set([
403
+ item.key
404
+ ]));
296
405
  }
297
406
  };
298
- isFocused = isFocused || state.selectionManager.focusedKey === item.childNodes[0].key;
299
- let domProps = $bSzeT$reactariautils.filterDOMProps(props);
407
+ let modality = (0, $bSzeT$reactariainteractions.useInteractionModality)();
408
+ if (modality === "virtual" && typeof window !== "undefined" && "ontouchstart" in window) modality = "touch";
409
+ let description = onRemove && (modality === "keyboard" || modality === "virtual") ? stringFormatter.format("removeDescription") : "";
410
+ let descProps = (0, $bSzeT$reactariautils.useDescription)(description);
411
+ let isFocused = item.key === state.selectionManager.focusedKey;
412
+ // @ts-ignore - data attributes are ok but TS doesn't know about them.
413
+ let domProps = (0, $bSzeT$reactariautils.filterDOMProps)(props);
300
414
  return {
301
- clearButtonProps: $bSzeT$reactariautils.mergeProps(pressProps, {
302
- 'aria-label': removeString,
303
- 'aria-labelledby': `${buttonId} ${labelId}`,
415
+ removeButtonProps: {
416
+ "aria-label": stringFormatter.format("removeButtonLabel"),
417
+ "aria-labelledby": `${buttonId} ${rowProps.id}`,
304
418
  id: buttonId,
305
- isDisabled: isDisabled
306
- }),
307
- labelProps: {
308
- id: labelId
419
+ onPress: ()=>onRemove ? onRemove(new Set([
420
+ item.key
421
+ ])) : null,
422
+ excludeFromTabOrder: true
309
423
  },
310
- tagRowProps: otherRowProps,
311
- tagProps: $bSzeT$reactariautils.mergeProps(domProps, gridCellProps, {
312
- 'aria-disabled': isDisabled,
313
- 'aria-errormessage': props['aria-errormessage'],
314
- 'aria-label': props['aria-label'],
315
- onKeyDown: !isDisabled && isRemovable ? onKeyDown : null,
316
- tabIndex: (isFocused || state.selectionManager.focusedKey == null) && !isDisabled ? 0 : -1,
317
- onFocus () {
318
- state.selectionManager.setFocusedKey(item.childNodes[0].key);
319
- },
320
- ref: tagRef
321
- })
424
+ rowProps: (0, $bSzeT$reactariautils.mergeProps)(rowProps, domProps, {
425
+ tabIndex: isFocused || state.selectionManager.focusedKey == null ? 0 : -1,
426
+ onKeyDown: onRemove ? onKeyDown : undefined,
427
+ "aria-describedby": descProps["aria-describedby"]
428
+ }),
429
+ gridCellProps: (0, $bSzeT$reactariautils.mergeProps)(gridCellProps, {
430
+ "aria-errormessage": props["aria-errormessage"],
431
+ "aria-label": props["aria-label"]
432
+ }),
433
+ ...states,
434
+ allowsRemoving: !!onRemove
322
435
  };
323
436
  }
324
437
 
325
438
 
326
- var $09704b0efefe5140$exports = {};
327
-
328
- $parcel$export($09704b0efefe5140$exports, "useTagGroup", () => $09704b0efefe5140$export$4f8b5cda58b7e8ff);
329
-
330
-
331
-
332
- function $09704b0efefe5140$export$4f8b5cda58b7e8ff(props, listState) {
333
- let { isDisabled: isDisabled } = props;
334
- let [isFocusWithin, setFocusWithin] = $bSzeT$react.useState(false);
335
- let { focusWithinProps: focusWithinProps } = $bSzeT$reactariainteractions.useFocusWithin({
336
- onFocusWithinChange: setFocusWithin
337
- });
338
- let allKeys = [
339
- ...listState.collection.getKeys()
340
- ];
341
- if (!allKeys.some((key)=>!listState.disabledKeys.has(key)
342
- )) isDisabled = true;
343
- let domProps = $bSzeT$reactariautils.filterDOMProps(props);
344
- return {
345
- tagGroupProps: $bSzeT$reactariautils.mergeProps(domProps, {
346
- 'aria-atomic': false,
347
- 'aria-relevant': 'additions',
348
- 'aria-live': isFocusWithin ? 'polite' : 'off',
349
- 'aria-disabled': isDisabled === true,
350
- ...focusWithinProps
351
- })
352
- };
353
- }
354
-
355
439
 
356
- $parcel$exportWildcard(module.exports, $d3d7c73f2e3f4edb$exports);
357
- $parcel$exportWildcard(module.exports, $a442534c81d8ad16$exports);
358
- $parcel$exportWildcard(module.exports, $09704b0efefe5140$exports);
359
440
 
360
441
 
361
442
  //# sourceMappingURL=main.js.map