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