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