@react-aria/tag 3.0.0-beta.1 → 3.0.0-beta.3
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 +424 -0
- package/dist/main.js +96 -112
- package/dist/main.js.map +1 -1
- package/dist/module.js +98 -114
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +41 -15
- package/dist/types.d.ts.map +1 -1
- package/package.json +17 -10
- package/src/TagKeyboardDelegate.ts +20 -47
- package/src/index.ts +1 -1
- package/src/useTag.ts +44 -39
- package/src/useTagGroup.ts +47 -12
package/dist/module.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {useLocalizedStringFormatter as $aIvin$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
1
|
+
import {useId as $aIvin$useId, chain as $aIvin$chain, 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 {useLocalizedStringFormatter as $aIvin$useLocalizedStringFormatter, useLocale as $aIvin$useLocale} from "@react-aria/i18n";
|
|
4
4
|
import {useState as $aIvin$useState} from "react";
|
|
5
|
+
import {useField as $aIvin$useField} from "@react-aria/label";
|
|
5
6
|
import {useFocusWithin as $aIvin$useFocusWithin} from "@react-aria/interactions";
|
|
6
7
|
|
|
7
8
|
function $parcel$interopDefault(a) {
|
|
@@ -27,21 +28,12 @@ function $parcel$interopDefault(a) {
|
|
|
27
28
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
28
29
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
29
30
|
* governing permissions and limitations under the License.
|
|
30
|
-
*/
|
|
31
|
-
class $542448901dbd2c36$export$b00754732e683b92 extends (0, $aIvin$GridKeyboardDelegate) {
|
|
31
|
+
*/ class $542448901dbd2c36$export$b00754732e683b92 {
|
|
32
32
|
getFirstKey() {
|
|
33
|
-
|
|
34
|
-
let item = this.collection.getItem(key);
|
|
35
|
-
return [
|
|
36
|
-
...item.childNodes
|
|
37
|
-
][0].key;
|
|
33
|
+
return this.collection.getFirstKey();
|
|
38
34
|
}
|
|
39
35
|
getLastKey() {
|
|
40
|
-
|
|
41
|
-
let item = this.collection.getItem(key);
|
|
42
|
-
return [
|
|
43
|
-
...item.childNodes
|
|
44
|
-
][0].key;
|
|
36
|
+
return this.collection.getLastKey();
|
|
45
37
|
}
|
|
46
38
|
getKeyRightOf(key) {
|
|
47
39
|
return this.direction === "rtl" ? this.getKeyAbove(key) : this.getKeyBelow(key);
|
|
@@ -52,40 +44,18 @@ class $542448901dbd2c36$export$b00754732e683b92 extends (0, $aIvin$GridKeyboardD
|
|
|
52
44
|
getKeyBelow(key) {
|
|
53
45
|
let startItem = this.collection.getItem(key);
|
|
54
46
|
if (!startItem) return;
|
|
55
|
-
// If focus was on a cell, start searching from the parent row
|
|
56
|
-
if (this.isCell(startItem)) key = startItem.parentKey;
|
|
57
47
|
// Find the next item
|
|
58
|
-
key = this.
|
|
59
|
-
if (key != null)
|
|
60
|
-
|
|
61
|
-
if (this.isCell(startItem)) {
|
|
62
|
-
let item = this.collection.getItem(key);
|
|
63
|
-
return [
|
|
64
|
-
...item.childNodes
|
|
65
|
-
][startItem.index].key;
|
|
66
|
-
}
|
|
67
|
-
// Otherwise, focus the next row
|
|
68
|
-
if (this.focusMode === "row") return key;
|
|
69
|
-
} else return this.getFirstKey();
|
|
48
|
+
key = this.collection.getKeyAfter(key);
|
|
49
|
+
if (key != null) return key;
|
|
50
|
+
else return this.collection.getFirstKey();
|
|
70
51
|
}
|
|
71
52
|
getKeyAbove(key) {
|
|
72
53
|
let startItem = this.collection.getItem(key);
|
|
73
54
|
if (!startItem) return;
|
|
74
|
-
// If focus is on a cell, start searching from the parent row
|
|
75
|
-
if (this.isCell(startItem)) key = startItem.parentKey;
|
|
76
55
|
// Find the previous item
|
|
77
|
-
key = this.
|
|
78
|
-
if (key != null)
|
|
79
|
-
|
|
80
|
-
if (this.isCell(startItem)) {
|
|
81
|
-
let item = this.collection.getItem(key);
|
|
82
|
-
return [
|
|
83
|
-
...item.childNodes
|
|
84
|
-
][startItem.index].key;
|
|
85
|
-
}
|
|
86
|
-
// Otherwise, focus the previous row
|
|
87
|
-
if (this.focusMode === "row") return key;
|
|
88
|
-
} else return this.getLastKey();
|
|
56
|
+
key = this.collection.getKeyBefore(key);
|
|
57
|
+
if (key != null) return key;
|
|
58
|
+
else return this.collection.getLastKey();
|
|
89
59
|
}
|
|
90
60
|
getKeyPageAbove(key) {
|
|
91
61
|
return this.getKeyAbove(key);
|
|
@@ -93,6 +63,10 @@ class $542448901dbd2c36$export$b00754732e683b92 extends (0, $aIvin$GridKeyboardD
|
|
|
93
63
|
getKeyPageBelow(key) {
|
|
94
64
|
return this.getKeyBelow(key);
|
|
95
65
|
}
|
|
66
|
+
constructor(collection, direction){
|
|
67
|
+
this.collection = collection;
|
|
68
|
+
this.direction = direction;
|
|
69
|
+
}
|
|
96
70
|
}
|
|
97
71
|
|
|
98
72
|
|
|
@@ -110,205 +84,205 @@ class $542448901dbd2c36$export$b00754732e683b92 extends (0, $aIvin$GridKeyboardD
|
|
|
110
84
|
var $4d1b62e0e67c00a4$exports = {};
|
|
111
85
|
var $84925f526f90eebd$exports = {};
|
|
112
86
|
$84925f526f90eebd$exports = {
|
|
113
|
-
"remove":
|
|
87
|
+
"remove": `اضغط على زر Space أو Delete لإزالة العلامة.`
|
|
114
88
|
};
|
|
115
89
|
|
|
116
90
|
|
|
117
91
|
var $c0650163dc1b6f9d$exports = {};
|
|
118
92
|
$c0650163dc1b6f9d$exports = {
|
|
119
|
-
"remove":
|
|
93
|
+
"remove": `Натиснете интервал или Delete, за да премахнете маркера.`
|
|
120
94
|
};
|
|
121
95
|
|
|
122
96
|
|
|
123
97
|
var $b2b55661291de587$exports = {};
|
|
124
98
|
$b2b55661291de587$exports = {
|
|
125
|
-
"remove": `
|
|
99
|
+
"remove": `Stisknutím mezerníku nebo klávesy Delete odeberte značku.`
|
|
126
100
|
};
|
|
127
101
|
|
|
128
102
|
|
|
129
103
|
var $deb83970956f6d5b$exports = {};
|
|
130
104
|
$deb83970956f6d5b$exports = {
|
|
131
|
-
"remove": `
|
|
105
|
+
"remove": `Tryk på mellemrum eller Slet for at fjerne tag.`
|
|
132
106
|
};
|
|
133
107
|
|
|
134
108
|
|
|
135
109
|
var $aea1cb4c7ec97e1c$exports = {};
|
|
136
110
|
$aea1cb4c7ec97e1c$exports = {
|
|
137
|
-
"remove": `
|
|
111
|
+
"remove": `Drücken Sie Leertaste oder Löschen, um das Tag zu entfernen.`
|
|
138
112
|
};
|
|
139
113
|
|
|
140
114
|
|
|
141
115
|
var $3618d917e503a8d3$exports = {};
|
|
142
116
|
$3618d917e503a8d3$exports = {
|
|
143
|
-
"remove":
|
|
117
|
+
"remove": `Πατήστε το πλήκτρο διαστήματος ή το πλήκτρο Delete για να καταργήσετε την ετικέτα.`
|
|
144
118
|
};
|
|
145
119
|
|
|
146
120
|
|
|
147
121
|
var $9eb56bbbe8e31294$exports = {};
|
|
148
122
|
$9eb56bbbe8e31294$exports = {
|
|
149
|
-
"remove": `
|
|
123
|
+
"remove": `Press Space or Delete to remove tag.`
|
|
150
124
|
};
|
|
151
125
|
|
|
152
126
|
|
|
153
127
|
var $361c604b0fc269a3$exports = {};
|
|
154
128
|
$361c604b0fc269a3$exports = {
|
|
155
|
-
"remove": `
|
|
129
|
+
"remove": `Pulse Espacio o Eliminar para quitar la etiqueta.`
|
|
156
130
|
};
|
|
157
131
|
|
|
158
132
|
|
|
159
133
|
var $2f00170f4ee3ca01$exports = {};
|
|
160
134
|
$2f00170f4ee3ca01$exports = {
|
|
161
|
-
"remove": `
|
|
135
|
+
"remove": `Sildi eemaldamiseks vajutage tühikuklahvi või kustutusklahvi Delete.`
|
|
162
136
|
};
|
|
163
137
|
|
|
164
138
|
|
|
165
139
|
var $80ee16b64fab9fb5$exports = {};
|
|
166
140
|
$80ee16b64fab9fb5$exports = {
|
|
167
|
-
"remove": `Poista
|
|
141
|
+
"remove": `Poista tunniste painamalla Välilyönti tai Poista.`
|
|
168
142
|
};
|
|
169
143
|
|
|
170
144
|
|
|
171
145
|
var $be9d354476c08087$exports = {};
|
|
172
146
|
$be9d354476c08087$exports = {
|
|
173
|
-
"remove": `Supprimer
|
|
147
|
+
"remove": `Appuyez sur Espace ou Supprimer pour supprimer la balise.`
|
|
174
148
|
};
|
|
175
149
|
|
|
176
150
|
|
|
177
151
|
var $ffeb903ba092eb35$exports = {};
|
|
178
152
|
$ffeb903ba092eb35$exports = {
|
|
179
|
-
"remove":
|
|
153
|
+
"remove": `הקש על רווח או מחק כדי להסיר תג.`
|
|
180
154
|
};
|
|
181
155
|
|
|
182
156
|
|
|
183
157
|
var $1df6722c6f19728b$exports = {};
|
|
184
158
|
$1df6722c6f19728b$exports = {
|
|
185
|
-
"remove": `
|
|
159
|
+
"remove": `Pritisnite Space ili Delete za uklanjanje oznake.`
|
|
186
160
|
};
|
|
187
161
|
|
|
188
162
|
|
|
189
163
|
var $093d57e325bc9071$exports = {};
|
|
190
164
|
$093d57e325bc9071$exports = {
|
|
191
|
-
"remove": `
|
|
165
|
+
"remove": `Nyomja meg a szóköz vagy a Delete billentyűt a címke eltávolításához.`
|
|
192
166
|
};
|
|
193
167
|
|
|
194
168
|
|
|
195
169
|
var $609dbdfbcad85bdb$exports = {};
|
|
196
170
|
$609dbdfbcad85bdb$exports = {
|
|
197
|
-
"remove": `
|
|
171
|
+
"remove": `Premi la barra spaziatrice o CANC per rimuovere il tag.`
|
|
198
172
|
};
|
|
199
173
|
|
|
200
174
|
|
|
201
175
|
var $c08e84f882644048$exports = {};
|
|
202
176
|
$c08e84f882644048$exports = {
|
|
203
|
-
"remove":
|
|
177
|
+
"remove": `タグを削除するには、スペースまたは削除を押します。`
|
|
204
178
|
};
|
|
205
179
|
|
|
206
180
|
|
|
207
181
|
var $5cd130489822fa21$exports = {};
|
|
208
182
|
$5cd130489822fa21$exports = {
|
|
209
|
-
"remove":
|
|
183
|
+
"remove": `태그를 제거하려면 Space 또는 Delete 키를 누르십시오.`
|
|
210
184
|
};
|
|
211
185
|
|
|
212
186
|
|
|
213
187
|
var $ab5183739b6c5e7e$exports = {};
|
|
214
188
|
$ab5183739b6c5e7e$exports = {
|
|
215
|
-
"remove": `
|
|
189
|
+
"remove": `Norėdami pašalinti žymą, paspauskite tarpo arba „Delete“ klavišą.`
|
|
216
190
|
};
|
|
217
191
|
|
|
218
192
|
|
|
219
193
|
var $dd84a0b574be3f23$exports = {};
|
|
220
194
|
$dd84a0b574be3f23$exports = {
|
|
221
|
-
"remove": `
|
|
195
|
+
"remove": `Nospiediet atstarpes taustiņu vai taustiņu Delete, lai noņemtu tagu.`
|
|
222
196
|
};
|
|
223
197
|
|
|
224
198
|
|
|
225
199
|
var $85eee97d14eef7b5$exports = {};
|
|
226
200
|
$85eee97d14eef7b5$exports = {
|
|
227
|
-
"remove": `
|
|
201
|
+
"remove": `Trykk på mellomrom eller Slett for å fjerne taggen.`
|
|
228
202
|
};
|
|
229
203
|
|
|
230
204
|
|
|
231
205
|
var $18781839f93b0314$exports = {};
|
|
232
206
|
$18781839f93b0314$exports = {
|
|
233
|
-
"remove": `Verwijderen
|
|
207
|
+
"remove": `Druk op Spatie of Verwijderen om de tag te verwijderen.`
|
|
234
208
|
};
|
|
235
209
|
|
|
236
210
|
|
|
237
211
|
var $1c40ffbbfe9f3bda$exports = {};
|
|
238
212
|
$1c40ffbbfe9f3bda$exports = {
|
|
239
|
-
"remove": `Usu
|
|
213
|
+
"remove": `Naciśnij Spację lub przycisk Usuń, aby usunąć znacznik.`
|
|
240
214
|
};
|
|
241
215
|
|
|
242
216
|
|
|
243
217
|
var $156880e329b1c717$exports = {};
|
|
244
218
|
$156880e329b1c717$exports = {
|
|
245
|
-
"remove": `
|
|
219
|
+
"remove": `Pressione a barra de espaço ou Delete para remover a tag.`
|
|
246
220
|
};
|
|
247
221
|
|
|
248
222
|
|
|
249
223
|
var $b6d50b1d20768ce4$exports = {};
|
|
250
224
|
$b6d50b1d20768ce4$exports = {
|
|
251
|
-
"remove": `Eliminar
|
|
225
|
+
"remove": `Pressione Espaço ou Eliminar para remover a etiqueta.`
|
|
252
226
|
};
|
|
253
227
|
|
|
254
228
|
|
|
255
229
|
var $d8c38c691b006187$exports = {};
|
|
256
230
|
$d8c38c691b006187$exports = {
|
|
257
|
-
"remove":
|
|
231
|
+
"remove": `Apăsați pe Space (Spațiu) sau pe Delete (Ștergere) pentru a elimina eticheta.`
|
|
258
232
|
};
|
|
259
233
|
|
|
260
234
|
|
|
261
235
|
var $ed9b4bf7ce1fb1d7$exports = {};
|
|
262
236
|
$ed9b4bf7ce1fb1d7$exports = {
|
|
263
|
-
"remove":
|
|
237
|
+
"remove": `Нажмите клавишу пробел или Delete, чтобы удалить тег.`
|
|
264
238
|
};
|
|
265
239
|
|
|
266
240
|
|
|
267
241
|
var $51d8721afda4d678$exports = {};
|
|
268
242
|
$51d8721afda4d678$exports = {
|
|
269
|
-
"remove": `
|
|
243
|
+
"remove": `Ak chcete odstrániť značku, stlačte medzerník alebo kláves Delete.`
|
|
270
244
|
};
|
|
271
245
|
|
|
272
246
|
|
|
273
247
|
var $fd37a27baae493e8$exports = {};
|
|
274
248
|
$fd37a27baae493e8$exports = {
|
|
275
|
-
"remove": `
|
|
249
|
+
"remove": `Pritisnite presledek ali Izbriši, da odstranite oznako.`
|
|
276
250
|
};
|
|
277
251
|
|
|
278
252
|
|
|
279
253
|
var $5505a1ca71ffd6f4$exports = {};
|
|
280
254
|
$5505a1ca71ffd6f4$exports = {
|
|
281
|
-
"remove": `
|
|
255
|
+
"remove": `Pritisnite Space ili Delete da biste uklonili oznaku.`
|
|
282
256
|
};
|
|
283
257
|
|
|
284
258
|
|
|
285
259
|
var $33670e148c84ad02$exports = {};
|
|
286
260
|
$33670e148c84ad02$exports = {
|
|
287
|
-
"remove": `
|
|
261
|
+
"remove": `Tryck på blanksteg eller radera för att ta bort taggen.`
|
|
288
262
|
};
|
|
289
263
|
|
|
290
264
|
|
|
291
265
|
var $0bf46fdcdd7cb5f6$exports = {};
|
|
292
266
|
$0bf46fdcdd7cb5f6$exports = {
|
|
293
|
-
"remove": `
|
|
267
|
+
"remove": `Etiketi kaldırmak için Boşluk veya Sil tuşlarından birine basın.`
|
|
294
268
|
};
|
|
295
269
|
|
|
296
270
|
|
|
297
271
|
var $9d9765222bc08ca2$exports = {};
|
|
298
272
|
$9d9765222bc08ca2$exports = {
|
|
299
|
-
"remove":
|
|
273
|
+
"remove": `Натисніть пробіл або Delete, щоб видалити тег.`
|
|
300
274
|
};
|
|
301
275
|
|
|
302
276
|
|
|
303
277
|
var $d737296cedcdee9f$exports = {};
|
|
304
278
|
$d737296cedcdee9f$exports = {
|
|
305
|
-
"remove":
|
|
279
|
+
"remove": `按下“空格”或“删除”键删除标记。`
|
|
306
280
|
};
|
|
307
281
|
|
|
308
282
|
|
|
309
283
|
var $09cd168ab18773f4$exports = {};
|
|
310
284
|
$09cd168ab18773f4$exports = {
|
|
311
|
-
"remove":
|
|
285
|
+
"remove": `按空格鍵或 Delete 鍵以移除標記。`
|
|
312
286
|
};
|
|
313
287
|
|
|
314
288
|
|
|
@@ -352,53 +326,44 @@ $4d1b62e0e67c00a4$exports = {
|
|
|
352
326
|
|
|
353
327
|
|
|
354
328
|
|
|
355
|
-
function $fc6126c82a4601f1$export$3f568fff7dff2f03(props, state) {
|
|
356
|
-
let { isFocused: isFocused } = props;
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
let { rowProps: rowProps } = (0, $aIvin$useGridRow)({
|
|
329
|
+
function $fc6126c82a4601f1$export$3f568fff7dff2f03(props, state, ref) {
|
|
330
|
+
let { isFocused: isFocused , allowsRemoving: allowsRemoving , item: item } = props;
|
|
331
|
+
let stringFormatter = (0, $aIvin$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($4d1b62e0e67c00a4$exports))));
|
|
332
|
+
let removeString = stringFormatter.format("remove");
|
|
333
|
+
let labelId = (0, $aIvin$useId)();
|
|
334
|
+
let buttonId = (0, $aIvin$useId)();
|
|
335
|
+
let { rowProps: rowProps , gridCellProps: gridCellProps } = (0, $aIvin$useGridListItem)({
|
|
363
336
|
node: item
|
|
364
|
-
}, state,
|
|
365
|
-
//
|
|
366
|
-
|
|
367
|
-
let
|
|
368
|
-
let
|
|
369
|
-
node: [
|
|
370
|
-
...item.childNodes
|
|
371
|
-
][0],
|
|
372
|
-
focusMode: "cell"
|
|
373
|
-
}, state, tagRef);
|
|
374
|
-
function onKeyDown(e) {
|
|
337
|
+
}, state, ref);
|
|
338
|
+
// We want the group to handle keyboard navigation between tags.
|
|
339
|
+
delete rowProps.onKeyDownCapture;
|
|
340
|
+
let onRemove = (0, $aIvin$chain)(props.onRemove, state.onRemove);
|
|
341
|
+
let onKeyDown = (e)=>{
|
|
375
342
|
if (e.key === "Delete" || e.key === "Backspace" || e.key === " ") {
|
|
376
|
-
onRemove(item.
|
|
343
|
+
onRemove(item.key);
|
|
377
344
|
e.preventDefault();
|
|
378
345
|
}
|
|
379
|
-
}
|
|
380
|
-
const pressProps = {
|
|
381
|
-
onPress: ()=>{
|
|
382
|
-
return onRemove === null || onRemove === void 0 ? void 0 : onRemove(item.childNodes[0].key);
|
|
383
|
-
}
|
|
384
346
|
};
|
|
385
|
-
isFocused = isFocused || state.selectionManager.focusedKey === item.
|
|
347
|
+
isFocused = isFocused || state.selectionManager.focusedKey === item.key;
|
|
386
348
|
let domProps = (0, $aIvin$filterDOMProps)(props);
|
|
387
349
|
return {
|
|
388
|
-
clearButtonProps:
|
|
350
|
+
clearButtonProps: {
|
|
389
351
|
"aria-label": removeString,
|
|
390
352
|
"aria-labelledby": `${buttonId} ${labelId}`,
|
|
391
|
-
id: buttonId
|
|
392
|
-
|
|
353
|
+
id: buttonId,
|
|
354
|
+
onPress: ()=>allowsRemoving && onRemove ? onRemove(item.key) : null
|
|
355
|
+
},
|
|
393
356
|
labelProps: {
|
|
394
357
|
id: labelId
|
|
395
358
|
},
|
|
396
|
-
tagRowProps:
|
|
359
|
+
tagRowProps: {
|
|
360
|
+
...rowProps,
|
|
361
|
+
tabIndex: isFocused || state.selectionManager.focusedKey == null ? 0 : -1,
|
|
362
|
+
onKeyDown: allowsRemoving ? onKeyDown : null
|
|
363
|
+
},
|
|
397
364
|
tagProps: (0, $aIvin$mergeProps)(domProps, gridCellProps, {
|
|
398
365
|
"aria-errormessage": props["aria-errormessage"],
|
|
399
|
-
"aria-label": props["aria-label"]
|
|
400
|
-
onKeyDown: allowsRemoving ? onKeyDown : null,
|
|
401
|
-
tabIndex: isFocused || state.selectionManager.focusedKey == null ? 0 : -1
|
|
366
|
+
"aria-label": props["aria-label"]
|
|
402
367
|
})
|
|
403
368
|
};
|
|
404
369
|
}
|
|
@@ -417,19 +382,38 @@ function $fc6126c82a4601f1$export$3f568fff7dff2f03(props, state) {
|
|
|
417
382
|
*/
|
|
418
383
|
|
|
419
384
|
|
|
420
|
-
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
function $d7323bca8d074eeb$export$4f8b5cda58b7e8ff(props, state, ref) {
|
|
390
|
+
let { direction: direction } = (0, $aIvin$useLocale)();
|
|
391
|
+
let keyboardDelegate = props.keyboardDelegate || new (0, $542448901dbd2c36$export$b00754732e683b92)(state.collection, direction);
|
|
392
|
+
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = (0, $aIvin$useField)(props);
|
|
393
|
+
let { gridProps: gridProps } = (0, $aIvin$useGridList)({
|
|
394
|
+
...props,
|
|
395
|
+
...fieldProps,
|
|
396
|
+
keyboardDelegate: keyboardDelegate
|
|
397
|
+
}, state, ref);
|
|
398
|
+
// Don't want the grid to be focusable or accessible via keyboard
|
|
399
|
+
delete gridProps.tabIndex;
|
|
421
400
|
let [isFocusWithin, setFocusWithin] = (0, $aIvin$useState)(false);
|
|
422
401
|
let { focusWithinProps: focusWithinProps } = (0, $aIvin$useFocusWithin)({
|
|
423
402
|
onFocusWithinChange: setFocusWithin
|
|
424
403
|
});
|
|
425
404
|
let domProps = (0, $aIvin$filterDOMProps)(props);
|
|
426
405
|
return {
|
|
427
|
-
tagGroupProps: (0, $aIvin$mergeProps)(domProps, {
|
|
406
|
+
tagGroupProps: (0, $aIvin$mergeProps)(gridProps, domProps, {
|
|
407
|
+
role: state.collection.size ? "grid" : null,
|
|
428
408
|
"aria-atomic": false,
|
|
429
409
|
"aria-relevant": "additions",
|
|
430
410
|
"aria-live": isFocusWithin ? "polite" : "off",
|
|
431
|
-
...focusWithinProps
|
|
432
|
-
|
|
411
|
+
...focusWithinProps,
|
|
412
|
+
...fieldProps
|
|
413
|
+
}),
|
|
414
|
+
labelProps: labelProps,
|
|
415
|
+
descriptionProps: descriptionProps,
|
|
416
|
+
errorMessageProps: errorMessageProps
|
|
433
417
|
};
|
|
434
418
|
}
|
|
435
419
|
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;AAIO,MAAM,kDAA+B,CAAA,GAAA,2BAAoB,AAAD;IAC7D,cAAc;QACZ,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW;QACrC,IAAI,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QAEnC,OAAO;eAAI,KAAK,UAAU;SAAC,CAAC,EAAE,CAAC,GAAG;IACpC;IAEA,aAAa;QACX,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU;QACpC,IAAI,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QAEnC,OAAO;eAAI,KAAK,UAAU;SAAC,CAA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AE,CAAC,GAAG;IACrF,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE;IAC9B,OAAO;QACL,kBAAkB,CAAA,GAAA,iBAAU,AAAD,EAAE,YAAY;YACvC,cAAc;YACd,mBAAmB,CAAC,EAAE,SAAS,CAAC,EAAE,QAAQ,CAAC;YAC3C,IAAI;QACN;QACA,YAAY;YACV,IAAI;QACN;QACA,aAAa;QACb,UAAU,CAAA,GAAA,iBAAU,AAAD,EAAE,UAAU,eAAe;YAC5C,qBAAqB,KAAK,CAAC,oBAAoB;YAC/C,cAAc,KAAK,CAAC,aAAa;YACjC,WAAW,iBAAiB,YAAY,IAAI;YAC5C,UAAU,AAAC,aAAa,MAAM,gBAAgB,CAAC,UAAU,IAAI,IAAI,GAAI,IAAI,EAAE;QAC7E;IACF;AACF;;;AoCrFA;;;;;;;;;;CAUC,GAED;;;AAeO,SAAS,0CAAY,KAAwB,EAAgB;IAClE,IAAI,CAAC,eAAe,eAAe,GAAG,CAAA,GAAA,eAAO,EAAE,KAAK;IACpD,IAAI,oBAAC,iBAAgB,EAAC,GAAG,CAAA,GAAA,qBAAc,AAAD,EAAE;QACtC,qBAAqB;IACvB;IACA,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE;IAC9B,OAAO;QACL,eAAe,CAAA,GAAA,iBAAU,AAAD,EAAE,UAAU;YAClC,eAAe,KAAK;YACpB,iBAAiB;YACjB,aAAa,gBAAgB,WAAW,KAAK;YAC7C,GAAG,gBAAgB;QACrB;IACF;AACF;;","sources":["packages/@react-aria/tag/src/index.ts","packages/@react-aria/tag/src/TagKeyboardDelegate.ts","packages/@react-aria/tag/src/useTag.ts","packages/@react-aria/tag/intl/*.js","packages/@react-aria/tag/intl/ar-AE.json","packages/@react-aria/tag/intl/bg-BG.json","packages/@react-aria/tag/intl/cs-CZ.json","packages/@react-aria/tag/intl/da-DK.json","packages/@react-aria/tag/intl/de-DE.json","packages/@react-aria/tag/intl/el-GR.json","packages/@react-aria/tag/intl/en-US.json","packages/@react-aria/tag/intl/es-ES.json","packages/@react-aria/tag/intl/et-EE.json","packages/@react-aria/tag/intl/fi-FI.json","packages/@react-aria/tag/intl/fr-FR.json","packages/@react-aria/tag/intl/he-IL.json","packages/@react-aria/tag/intl/hr-HR.json","packages/@react-aria/tag/intl/hu-HU.json","packages/@react-aria/tag/intl/it-IT.json","packages/@react-aria/tag/intl/ja-JP.json","packages/@react-aria/tag/intl/ko-KR.json","packages/@react-aria/tag/intl/lt-LT.json","packages/@react-aria/tag/intl/lv-LV.json","packages/@react-aria/tag/intl/nb-NO.json","packages/@react-aria/tag/intl/nl-NL.json","packages/@react-aria/tag/intl/pl-PL.json","packages/@react-aria/tag/intl/pt-BR.json","packages/@react-aria/tag/intl/pt-PT.json","packages/@react-aria/tag/intl/ro-RO.json","packages/@react-aria/tag/intl/ru-RU.json","packages/@react-aria/tag/intl/sk-SK.json","packages/@react-aria/tag/intl/sl-SI.json","packages/@react-aria/tag/intl/sr-SP.json","packages/@react-aria/tag/intl/sv-SE.json","packages/@react-aria/tag/intl/tr-TR.json","packages/@react-aria/tag/intl/uk-UA.json","packages/@react-aria/tag/intl/zh-CN.json","packages/@react-aria/tag/intl/zh-TW.json","packages/@react-aria/tag/src/useTagGroup.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {TagKeyboardDelegate} from './TagKeyboardDelegate';\nexport {useTag} from './useTag';\nexport {useTagGroup} from './useTagGroup';\n\nexport type {TagProps} from '@react-types/tag';\nexport type {AriaTagGroupProps, TagGroupAria} from './useTagGroup';\nexport type {TagAria} from './useTag';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {GridCollection} from '@react-types/grid';\nimport {GridKeyboardDelegate} from '@react-aria/grid';\nimport {Key} from 'react';\n\nexport class TagKeyboardDelegate<T> extends GridKeyboardDelegate<T, GridCollection<T>> {\n getFirstKey() {\n let key = this.collection.getFirstKey();\n let item = this.collection.getItem(key);\n\n return [...item.childNodes][0].key;\n }\n\n getLastKey() {\n let key = this.collection.getLastKey();\n let item = this.collection.getItem(key);\n\n return [...item.childNodes][0].key;\n }\n\n getKeyRightOf(key: Key) {\n return this.direction === 'rtl' ? this.getKeyAbove(key) : this.getKeyBelow(key);\n }\n\n getKeyLeftOf(key: Key) {\n return this.direction === 'rtl' ? this.getKeyBelow(key) : this.getKeyAbove(key);\n }\n\n getKeyBelow(key) {\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return;\n }\n\n // If focus was on a cell, start searching from the parent row\n if (this.isCell(startItem)) {\n key = startItem.parentKey;\n }\n\n // Find the next item\n key = this.findNextKey(key);\n if (key != null) {\n // If focus was on a cell, focus the cell with the same index in the next row.\n if (this.isCell(startItem)) {\n let item = this.collection.getItem(key);\n\n return [...item.childNodes][startItem.index].key;\n }\n\n // Otherwise, focus the next row\n if (this.focusMode === 'row') {\n return key;\n }\n } else {\n return this.getFirstKey();\n }\n }\n\n getKeyAbove(key) {\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return;\n }\n\n // If focus is on a cell, start searching from the parent row\n if (this.isCell(startItem)) {\n key = startItem.parentKey;\n }\n\n // Find the previous item\n key = this.findPreviousKey(key);\n if (key != null) {\n // If focus was on a cell, focus the cell with the same index in the previous row.\n if (this.isCell(startItem)) {\n let item = this.collection.getItem(key);\n return [...item.childNodes][startItem.index].key;\n }\n\n // Otherwise, focus the previous row\n if (this.focusMode === 'row') {\n return key;\n }\n } else {\n return this.getLastKey();\n }\n }\n\n getKeyPageAbove(key) {\n return this.getKeyAbove(key);\n }\n\n getKeyPageBelow(key) {\n return this.getKeyBelow(key);\n }\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ButtonHTMLAttributes, KeyboardEvent} from 'react';\nimport {DOMAttributes} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, useId} from '@react-aria/utils';\nimport {GridState} from '@react-stately/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {TagProps} from '@react-types/tag';\nimport {useGridCell, useGridRow} from '@react-aria/grid';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\n\nexport interface TagAria {\n labelProps: DOMAttributes,\n tagProps: DOMAttributes,\n tagRowProps: DOMAttributes,\n clearButtonProps: ButtonHTMLAttributes<HTMLButtonElement>\n}\n\nexport function useTag(props: TagProps<any>, state: GridState<any, any>): TagAria {\n let {isFocused} = props;\n const {\n allowsRemoving,\n onRemove,\n item,\n tagRef,\n tagRowRef\n } = props;\n const stringFormatter = useLocalizedStringFormatter(intlMessages);\n const removeString = stringFormatter.format('remove');\n const labelId = useId();\n const buttonId = useId();\n\n let {rowProps} = useGridRow({\n node: item\n }, state, tagRowRef);\n // Don't want the row to be focusable or accessible via keyboard\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {tabIndex, ...otherRowProps} = rowProps;\n\n let {gridCellProps} = useGridCell({\n node: [...item.childNodes][0],\n focusMode: 'cell'\n }, state, tagRef);\n\n function onKeyDown(e: KeyboardEvent) {\n if (e.key === 'Delete' || e.key === 'Backspace' || e.key === ' ') {\n onRemove(item.childNodes[0].key);\n e.preventDefault();\n }\n }\n const pressProps = {\n onPress: () => onRemove?.(item.childNodes[0].key)\n };\n\n isFocused = isFocused || state.selectionManager.focusedKey === item.childNodes[0].key;\n let domProps = filterDOMProps(props);\n return {\n clearButtonProps: mergeProps(pressProps, {\n 'aria-label': removeString,\n 'aria-labelledby': `${buttonId} ${labelId}`,\n id: buttonId\n }),\n labelProps: {\n id: labelId\n },\n tagRowProps: otherRowProps,\n tagProps: mergeProps(domProps, gridCellProps, {\n 'aria-errormessage': props['aria-errormessage'],\n 'aria-label': props['aria-label'],\n onKeyDown: allowsRemoving ? onKeyDown : null,\n tabIndex: (isFocused || state.selectionManager.focusedKey == null) ? 0 : -1\n })\n };\n}\n","const _temp0 = require(\"./ar-AE.json\");\nconst _temp1 = require(\"./bg-BG.json\");\nconst _temp2 = require(\"./cs-CZ.json\");\nconst _temp3 = require(\"./da-DK.json\");\nconst _temp4 = require(\"./de-DE.json\");\nconst _temp5 = require(\"./el-GR.json\");\nconst _temp6 = require(\"./en-US.json\");\nconst _temp7 = require(\"./es-ES.json\");\nconst _temp8 = require(\"./et-EE.json\");\nconst _temp9 = require(\"./fi-FI.json\");\nconst _temp10 = require(\"./fr-FR.json\");\nconst _temp11 = require(\"./he-IL.json\");\nconst _temp12 = require(\"./hr-HR.json\");\nconst _temp13 = require(\"./hu-HU.json\");\nconst _temp14 = require(\"./it-IT.json\");\nconst _temp15 = require(\"./ja-JP.json\");\nconst _temp16 = require(\"./ko-KR.json\");\nconst _temp17 = require(\"./lt-LT.json\");\nconst _temp18 = require(\"./lv-LV.json\");\nconst _temp19 = require(\"./nb-NO.json\");\nconst _temp20 = require(\"./nl-NL.json\");\nconst _temp21 = require(\"./pl-PL.json\");\nconst _temp22 = require(\"./pt-BR.json\");\nconst _temp23 = require(\"./pt-PT.json\");\nconst _temp24 = require(\"./ro-RO.json\");\nconst _temp25 = require(\"./ru-RU.json\");\nconst _temp26 = require(\"./sk-SK.json\");\nconst _temp27 = require(\"./sl-SI.json\");\nconst _temp28 = require(\"./sr-SP.json\");\nconst _temp29 = require(\"./sv-SE.json\");\nconst _temp30 = require(\"./tr-TR.json\");\nconst _temp31 = require(\"./uk-UA.json\");\nconst _temp32 = require(\"./zh-CN.json\");\nconst _temp33 = require(\"./zh-TW.json\");\nmodule.exports = {\n \"ar-AE\": _temp0,\n \"bg-BG\": _temp1,\n \"cs-CZ\": _temp2,\n \"da-DK\": _temp3,\n \"de-DE\": _temp4,\n \"el-GR\": _temp5,\n \"en-US\": _temp6,\n \"es-ES\": _temp7,\n \"et-EE\": _temp8,\n \"fi-FI\": _temp9,\n \"fr-FR\": _temp10,\n \"he-IL\": _temp11,\n \"hr-HR\": _temp12,\n \"hu-HU\": _temp13,\n \"it-IT\": _temp14,\n \"ja-JP\": _temp15,\n \"ko-KR\": _temp16,\n \"lt-LT\": _temp17,\n \"lv-LV\": _temp18,\n \"nb-NO\": _temp19,\n \"nl-NL\": _temp20,\n \"pl-PL\": _temp21,\n \"pt-BR\": _temp22,\n \"pt-PT\": _temp23,\n \"ro-RO\": _temp24,\n \"ru-RU\": _temp25,\n \"sk-SK\": _temp26,\n \"sl-SI\": _temp27,\n \"sr-SP\": _temp28,\n \"sv-SE\": _temp29,\n \"tr-TR\": _temp30,\n \"uk-UA\": _temp31,\n \"zh-CN\": _temp32,\n \"zh-TW\": _temp33\n}","{\n \"remove\": \"إزالة\"\n}\n","{\n \"remove\": \"Премахване\"\n}\n","{\n \"remove\": \"Odebrat\"\n}\n","{\n \"remove\": \"Fjern\"\n}\n","{\n \"remove\": \"Entfernen\"\n}\n","{\n \"remove\": \"Κατάργηση\"\n}\n","{\n \"remove\": \"Remove\"\n}\n","{\n \"remove\": \"Quitar\"\n}\n","{\n \"remove\": \"Eemalda\"\n}\n","{\n \"remove\": \"Poista\"\n}\n","{\n \"remove\": \"Supprimer\"\n}\n","{\n \"remove\": \"הסר\"\n}\n","{\n \"remove\": \"Ukloni\"\n}\n","{\n \"remove\": \"Eltávolítás\"\n}\n","{\n \"remove\": \"Rimuovi\"\n}\n","{\n \"remove\": \"削除\"\n}\n","{\n \"remove\": \"제거\"\n}\n","{\n \"remove\": \"Pašalinti\"\n}\n","{\n \"remove\": \"Noņemt\"\n}\n","{\n \"remove\": \"Fjern\"\n}\n","{\n \"remove\": \"Verwijderen\"\n}\n","{\n \"remove\": \"Usuń\"\n}\n","{\n \"remove\": \"Remover\"\n}\n","{\n \"remove\": \"Eliminar\"\n}\n","{\n \"remove\": \"Îndepărtaţi\"\n}\n","{\n \"remove\": \"Удалить\"\n}\n","{\n \"remove\": \"Odstrániť\"\n}\n","{\n \"remove\": \"Odstrani\"\n}\n","{\n \"remove\": \"Ukloni\"\n}\n","{\n \"remove\": \"Ta bort\"\n}\n","{\n \"remove\": \"Kaldır\"\n}\n","{\n \"remove\": \"Видалити\"\n}\n","{\n \"remove\": \"删除\"\n}\n","{\n \"remove\": \"移除\"\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes, DOMProps} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {ReactNode, useState} from 'react';\nimport {useFocusWithin} from '@react-aria/interactions';\n\nexport interface AriaTagGroupProps extends DOMProps {\n children: ReactNode,\n isReadOnly?: boolean, // removes close button\n validationState?: 'valid' | 'invalid'\n}\n\nexport interface TagGroupAria {\n tagGroupProps: DOMAttributes\n}\n\nexport function useTagGroup(props: AriaTagGroupProps): TagGroupAria {\n let [isFocusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({\n onFocusWithinChange: setFocusWithin\n });\n let domProps = filterDOMProps(props);\n return {\n tagGroupProps: mergeProps(domProps, {\n 'aria-atomic': false,\n 'aria-relevant': 'additions',\n 'aria-live': isFocusWithin ? 'polite' : 'off',\n ...focusWithinProps\n } as DOMAttributes)\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED,AAGO,MAAM;IASX,cAAc;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW;IACpC;IAEA,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU;IACnC;IAEA,cAAc,GAAQ,EAAE;QACtB,OAAO,IAAI,CAAC,SAAS,KAAK,QAAQ,IAAI,CAAC,WAAW,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI;IACjF;IAEA,aAAa,GAAQ,EAAE;QACrB,OAAO,IAAI,CAAC,SAAS,KAAK,QAAQ,IAAI,CAAC,WAAW,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI;IACjF;IAEA,YAAY,GAAG,EAAE;QACf,IAAI,YAAY,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QACxC,IAAI,CAAC,WACH;QAGF,qBAAqB;QACrB,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;QAElC,IAAI,OAAO,IAAI,EACb,OAAO;aAEP,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW;IAEtC;IAEA,YAAY,GAAG,EAAE;QACf,IAAI,YAAY,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QACxC,IAAI,CAAC,WACH;QAGF,yBAAyB;QACz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YAC3C,eAAe,KAAK;YACpB,iBAAiB;YACjB,aAAa,gBAAgB,WAAW,KAAK;YAC7C,GAAG,gBAAgB;YACnB,GAAG,UAAU;QACf;oBACA;0BACA;2BACA;IACF;AACF;;","sources":["packages/@react-aria/tag/src/index.ts","packages/@react-aria/tag/src/TagKeyboardDelegate.ts","packages/@react-aria/tag/src/useTag.ts","packages/@react-aria/tag/intl/*.js","packages/@react-aria/tag/intl/ar-AE.json","packages/@react-aria/tag/intl/bg-BG.json","packages/@react-aria/tag/intl/cs-CZ.json","packages/@react-aria/tag/intl/da-DK.json","packages/@react-aria/tag/intl/de-DE.json","packages/@react-aria/tag/intl/el-GR.json","packages/@react-aria/tag/intl/en-US.json","packages/@react-aria/tag/intl/es-ES.json","packages/@react-aria/tag/intl/et-EE.json","packages/@react-aria/tag/intl/fi-FI.json","packages/@react-aria/tag/intl/fr-FR.json","packages/@react-aria/tag/intl/he-IL.json","packages/@react-aria/tag/intl/hr-HR.json","packages/@react-aria/tag/intl/hu-HU.json","packages/@react-aria/tag/intl/it-IT.json","packages/@react-aria/tag/intl/ja-JP.json","packages/@react-aria/tag/intl/ko-KR.json","packages/@react-aria/tag/intl/lt-LT.json","packages/@react-aria/tag/intl/lv-LV.json","packages/@react-aria/tag/intl/nb-NO.json","packages/@react-aria/tag/intl/nl-NL.json","packages/@react-aria/tag/intl/pl-PL.json","packages/@react-aria/tag/intl/pt-BR.json","packages/@react-aria/tag/intl/pt-PT.json","packages/@react-aria/tag/intl/ro-RO.json","packages/@react-aria/tag/intl/ru-RU.json","packages/@react-aria/tag/intl/sk-SK.json","packages/@react-aria/tag/intl/sl-SI.json","packages/@react-aria/tag/intl/sr-SP.json","packages/@react-aria/tag/intl/sv-SE.json","packages/@react-aria/tag/intl/tr-TR.json","packages/@react-aria/tag/intl/uk-UA.json","packages/@react-aria/tag/intl/zh-CN.json","packages/@react-aria/tag/intl/zh-TW.json","packages/@react-aria/tag/src/useTagGroup.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {TagKeyboardDelegate} from './TagKeyboardDelegate';\nexport {useTag} from './useTag';\nexport {useTagGroup} from './useTagGroup';\n\nexport type {TagProps} from '@react-types/tag';\nexport type {TagGroupAria, AriaTagGroupProps} from './useTagGroup';\nexport type {TagAria} from './useTag';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, Direction, KeyboardDelegate} from '@react-types/shared';\nimport {Key} from 'react';\n\nexport class TagKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<T>;\n private direction: Direction;\n\n constructor(collection: Collection<T>, direction: Direction) {\n this.collection = collection;\n this.direction = direction;\n }\n\n getFirstKey() {\n return this.collection.getFirstKey();\n }\n\n getLastKey() {\n return this.collection.getLastKey();\n }\n \n getKeyRightOf(key: Key) {\n return this.direction === 'rtl' ? this.getKeyAbove(key) : this.getKeyBelow(key);\n }\n\n getKeyLeftOf(key: Key) {\n return this.direction === 'rtl' ? this.getKeyBelow(key) : this.getKeyAbove(key);\n }\n\n getKeyBelow(key) {\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return;\n }\n\n // Find the next item\n key = this.collection.getKeyAfter(key);\n\n if (key != null) {\n return key;\n } else {\n return this.collection.getFirstKey();\n }\n }\n\n getKeyAbove(key) {\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return;\n }\n\n // Find the previous item\n key = this.collection.getKeyBefore(key);\n if (key != null) {\n return key;\n } else {\n return this.collection.getLastKey();\n }\n }\n\n getKeyPageAbove(key) {\n return this.getKeyAbove(key);\n }\n\n getKeyPageBelow(key) {\n return this.getKeyBelow(key);\n }\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport {chain, filterDOMProps, mergeProps, useId} from '@react-aria/utils';\nimport {DOMAttributes, FocusableElement} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {KeyboardEvent, RefObject} from 'react';\nimport type {TagGroupState} from '@react-stately/tag';\nimport {TagProps} from '@react-types/tag';\nimport {useGridListItem} from '@react-aria/gridlist';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\n\nexport interface TagAria {\n /** Props for the tag visible label (if any). */\n labelProps: DOMAttributes,\n /** Props for the tag cell element. */\n tagProps: DOMAttributes,\n /** Props for the tag row element. */\n tagRowProps: DOMAttributes,\n /** Props for the tag clear button. */\n clearButtonProps: AriaButtonProps\n}\n\n/**\n * Provides the behavior and accessibility implementation for a tag component.\n * @param props - Props to be applied to the tag.\n * @param state - State for the tag group, as returned by `useTagGroupState`.\n * @param ref - A ref to a DOM element for the tag.\n */\nexport function useTag<T>(props: TagProps<T>, state: TagGroupState<T>, ref: RefObject<FocusableElement>): TagAria {\n let {\n isFocused,\n allowsRemoving,\n item\n } = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages);\n let removeString = stringFormatter.format('remove');\n let labelId = useId();\n let buttonId = useId();\n\n let {rowProps, gridCellProps} = useGridListItem({\n node: item\n }, state, ref);\n\n // We want the group to handle keyboard navigation between tags.\n delete rowProps.onKeyDownCapture;\n\n let onRemove = chain(props.onRemove, state.onRemove);\n\n let onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Delete' || e.key === 'Backspace' || e.key === ' ') {\n onRemove(item.key);\n e.preventDefault();\n }\n };\n\n isFocused = isFocused || state.selectionManager.focusedKey === item.key;\n let domProps = filterDOMProps(props);\n return {\n clearButtonProps: {\n 'aria-label': removeString,\n 'aria-labelledby': `${buttonId} ${labelId}`,\n id: buttonId,\n onPress: () => allowsRemoving && onRemove ? onRemove(item.key) : null\n },\n labelProps: {\n id: labelId\n },\n tagRowProps: {\n ...rowProps,\n tabIndex: (isFocused || state.selectionManager.focusedKey == null) ? 0 : -1,\n onKeyDown: allowsRemoving ? onKeyDown : null\n },\n tagProps: mergeProps(domProps, gridCellProps, {\n 'aria-errormessage': props['aria-errormessage'],\n 'aria-label': props['aria-label']\n })\n };\n}\n","const _temp0 = require(\"./ar-AE.json\");\nconst _temp1 = require(\"./bg-BG.json\");\nconst _temp2 = require(\"./cs-CZ.json\");\nconst _temp3 = require(\"./da-DK.json\");\nconst _temp4 = require(\"./de-DE.json\");\nconst _temp5 = require(\"./el-GR.json\");\nconst _temp6 = require(\"./en-US.json\");\nconst _temp7 = require(\"./es-ES.json\");\nconst _temp8 = require(\"./et-EE.json\");\nconst _temp9 = require(\"./fi-FI.json\");\nconst _temp10 = require(\"./fr-FR.json\");\nconst _temp11 = require(\"./he-IL.json\");\nconst _temp12 = require(\"./hr-HR.json\");\nconst _temp13 = require(\"./hu-HU.json\");\nconst _temp14 = require(\"./it-IT.json\");\nconst _temp15 = require(\"./ja-JP.json\");\nconst _temp16 = require(\"./ko-KR.json\");\nconst _temp17 = require(\"./lt-LT.json\");\nconst _temp18 = require(\"./lv-LV.json\");\nconst _temp19 = require(\"./nb-NO.json\");\nconst _temp20 = require(\"./nl-NL.json\");\nconst _temp21 = require(\"./pl-PL.json\");\nconst _temp22 = require(\"./pt-BR.json\");\nconst _temp23 = require(\"./pt-PT.json\");\nconst _temp24 = require(\"./ro-RO.json\");\nconst _temp25 = require(\"./ru-RU.json\");\nconst _temp26 = require(\"./sk-SK.json\");\nconst _temp27 = require(\"./sl-SI.json\");\nconst _temp28 = require(\"./sr-SP.json\");\nconst _temp29 = require(\"./sv-SE.json\");\nconst _temp30 = require(\"./tr-TR.json\");\nconst _temp31 = require(\"./uk-UA.json\");\nconst _temp32 = require(\"./zh-CN.json\");\nconst _temp33 = require(\"./zh-TW.json\");\nmodule.exports = {\n \"ar-AE\": _temp0,\n \"bg-BG\": _temp1,\n \"cs-CZ\": _temp2,\n \"da-DK\": _temp3,\n \"de-DE\": _temp4,\n \"el-GR\": _temp5,\n \"en-US\": _temp6,\n \"es-ES\": _temp7,\n \"et-EE\": _temp8,\n \"fi-FI\": _temp9,\n \"fr-FR\": _temp10,\n \"he-IL\": _temp11,\n \"hr-HR\": _temp12,\n \"hu-HU\": _temp13,\n \"it-IT\": _temp14,\n \"ja-JP\": _temp15,\n \"ko-KR\": _temp16,\n \"lt-LT\": _temp17,\n \"lv-LV\": _temp18,\n \"nb-NO\": _temp19,\n \"nl-NL\": _temp20,\n \"pl-PL\": _temp21,\n \"pt-BR\": _temp22,\n \"pt-PT\": _temp23,\n \"ro-RO\": _temp24,\n \"ru-RU\": _temp25,\n \"sk-SK\": _temp26,\n \"sl-SI\": _temp27,\n \"sr-SP\": _temp28,\n \"sv-SE\": _temp29,\n \"tr-TR\": _temp30,\n \"uk-UA\": _temp31,\n \"zh-CN\": _temp32,\n \"zh-TW\": _temp33\n}","{\n \"remove\": \"اضغط على زر Space أو Delete لإزالة العلامة.\"\n}\n","{\n \"remove\": \"Натиснете интервал или Delete, за да премахнете маркера.\"\n}\n","{\n \"remove\": \"Stisknutím mezerníku nebo klávesy Delete odeberte značku.\"\n}\n","{\n \"remove\": \"Tryk på mellemrum eller Slet for at fjerne tag.\"\n}\n","{\n \"remove\": \"Drücken Sie Leertaste oder Löschen, um das Tag zu entfernen.\"\n}\n","{\n \"remove\": \"Πατήστε το πλήκτρο διαστήματος ή το πλήκτρο Delete για να καταργήσετε την ετικέτα.\"\n}\n","{ \n \"remove\": \"Press Space or Delete to remove tag.\"\n}\n","{\n \"remove\": \"Pulse Espacio o Eliminar para quitar la etiqueta.\"\n}\n","{\n \"remove\": \"Sildi eemaldamiseks vajutage tühikuklahvi või kustutusklahvi Delete.\"\n}\n","{\n \"remove\": \"Poista tunniste painamalla Välilyönti tai Poista.\"\n}\n","{\n \"remove\": \"Appuyez sur Espace ou Supprimer pour supprimer la balise.\"\n}\n","{\n \"remove\": \"הקש על רווח או מחק כדי להסיר תג.\"\n}\n","{\n \"remove\": \"Pritisnite Space ili Delete za uklanjanje oznake.\"\n}\n","{\n \"remove\": \"Nyomja meg a szóköz vagy a Delete billentyűt a címke eltávolításához.\"\n}\n","{\n \"remove\": \"Premi la barra spaziatrice o CANC per rimuovere il tag.\"\n}\n","{\n \"remove\": \"タグを削除するには、スペースまたは削除を押します。\"\n}\n","{\n \"remove\": \"태그를 제거하려면 Space 또는 Delete 키를 누르십시오.\"\n}\n","{\n \"remove\": \"Norėdami pašalinti žymą, paspauskite tarpo arba „Delete“ klavišą.\"\n}\n","{\n \"remove\": \"Nospiediet atstarpes taustiņu vai taustiņu Delete, lai noņemtu tagu.\"\n}\n","{\n \"remove\": \"Trykk på mellomrom eller Slett for å fjerne taggen.\"\n}\n","{\n \"remove\": \"Druk op Spatie of Verwijderen om de tag te verwijderen.\"\n}\n","{\n \"remove\": \"Naciśnij Spację lub przycisk Usuń, aby usunąć znacznik.\"\n}\n","{\n \"remove\": \"Pressione a barra de espaço ou Delete para remover a tag.\"\n}\n","{\n \"remove\": \"Pressione Espaço ou Eliminar para remover a etiqueta.\"\n}\n","{\n \"remove\": \"Apăsați pe Space (Spațiu) sau pe Delete (Ștergere) pentru a elimina eticheta.\"\n}\n","{\n \"remove\": \"Нажмите клавишу пробел или Delete, чтобы удалить тег.\"\n}\n","{\n \"remove\": \"Ak chcete odstrániť značku, stlačte medzerník alebo kláves Delete.\"\n}\n","{\n \"remove\": \"Pritisnite presledek ali Izbriši, da odstranite oznako.\"\n}\n","{\n \"remove\": \"Pritisnite Space ili Delete da biste uklonili oznaku.\"\n}\n","{\n \"remove\": \"Tryck på blanksteg eller radera för att ta bort taggen.\"\n}\n","{\n \"remove\": \"Etiketi kaldırmak için Boşluk veya Sil tuşlarından birine basın.\"\n}\n","{\n \"remove\": \"Натисніть пробіл або Delete, щоб видалити тег.\"\n}\n","{\n \"remove\": \"按下“空格”或“删除”键删除标记。\"\n}\n","{\n \"remove\": \"按空格鍵或 Delete 鍵以移除標記。\"\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMAttributes, DOMProps, Validation} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {RefObject, useState} from 'react';\nimport {TagGroupProps} from '@react-types/tag';\nimport type {TagGroupState} from '@react-stately/tag';\nimport {TagKeyboardDelegate} from './TagKeyboardDelegate';\nimport {useField} from '@react-aria/label';\nimport {useFocusWithin} from '@react-aria/interactions';\nimport {useGridList} from '@react-aria/gridlist';\nimport {useLocale} from '@react-aria/i18n';\n\nexport interface TagGroupAria {\n /** Props for the tag grouping element. */\n tagGroupProps: DOMAttributes,\n /** Props for the tag group's visible label (if any). */\n labelProps: DOMAttributes,\n /** Props for the tag group description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the tag group error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\nexport interface AriaTagGroupProps<T> extends TagGroupProps<T>, DOMProps, AriaLabelingProps, Validation {\n /**\n * An optional keyboard delegate to handle arrow key navigation,\n * to override the default.\n */\n keyboardDelegate?: TagKeyboardDelegate<T>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a tag group component.\n * Tags allow users to categorize content. They can represent keywords or people, and are grouped to describe an item or a search request.\n * @param props - Props to be applied to the tag group.\n * @param state - State for the tag group, as returned by `useTagGroupState`.\n * @param ref - A ref to a DOM element for the tag group.\n */\nexport function useTagGroup<T>(props: AriaTagGroupProps<T>, state: TagGroupState<T>, ref: RefObject<HTMLElement>): TagGroupAria {\n let {direction} = useLocale();\n let keyboardDelegate = props.keyboardDelegate || new TagKeyboardDelegate(state.collection, direction);\n let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField(props);\n let {gridProps} = useGridList({...props, ...fieldProps, keyboardDelegate}, state, ref);\n\n // Don't want the grid to be focusable or accessible via keyboard\n delete gridProps.tabIndex;\n\n let [isFocusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({\n onFocusWithinChange: setFocusWithin\n });\n let domProps = filterDOMProps(props);\n return {\n tagGroupProps: mergeProps(gridProps, domProps, {\n role: state.collection.size ? 'grid' : null,\n 'aria-atomic': false,\n 'aria-relevant': 'additions',\n 'aria-live': isFocusWithin ? 'polite' : 'off',\n ...focusWithinProps,\n ...fieldProps\n }),\n labelProps,\n descriptionProps,\n errorMessageProps\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Collection, Direction, KeyboardDelegate, DOMAttributes, FocusableElement, AriaLabelingProps, DOMProps, Validation } from "@react-types/shared";
|
|
2
|
+
import { Key, RefObject } from "react";
|
|
3
|
+
import { AriaButtonProps } from "@react-types/button";
|
|
4
|
+
import { TagGroupState } from "@react-stately/tag";
|
|
5
|
+
import { TagProps, TagGroupProps } from "@react-types/tag";
|
|
6
|
+
export class TagKeyboardDelegate<T> implements KeyboardDelegate {
|
|
7
|
+
constructor(collection: Collection<T>, direction: Direction);
|
|
8
8
|
getFirstKey(): Key;
|
|
9
9
|
getLastKey(): Key;
|
|
10
10
|
getKeyRightOf(key: Key): any;
|
|
@@ -15,21 +15,47 @@ export class TagKeyboardDelegate<T> extends GridKeyboardDelegate<T, GridCollecti
|
|
|
15
15
|
getKeyPageBelow(key: any): any;
|
|
16
16
|
}
|
|
17
17
|
export interface TagAria {
|
|
18
|
+
/** Props for the tag visible label (if any). */
|
|
18
19
|
labelProps: DOMAttributes;
|
|
20
|
+
/** Props for the tag cell element. */
|
|
19
21
|
tagProps: DOMAttributes;
|
|
22
|
+
/** Props for the tag row element. */
|
|
20
23
|
tagRowProps: DOMAttributes;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export function useTag(props: TagProps<any>, state: GridState<any, any>): TagAria;
|
|
24
|
-
export interface AriaTagGroupProps extends DOMProps {
|
|
25
|
-
children: ReactNode;
|
|
26
|
-
isReadOnly?: boolean;
|
|
27
|
-
validationState?: 'valid' | 'invalid';
|
|
24
|
+
/** Props for the tag clear button. */
|
|
25
|
+
clearButtonProps: AriaButtonProps;
|
|
28
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Provides the behavior and accessibility implementation for a tag component.
|
|
29
|
+
* @param props - Props to be applied to the tag.
|
|
30
|
+
* @param state - State for the tag group, as returned by `useTagGroupState`.
|
|
31
|
+
* @param ref - A ref to a DOM element for the tag.
|
|
32
|
+
*/
|
|
33
|
+
export function useTag<T>(props: TagProps<T>, state: TagGroupState<T>, ref: RefObject<FocusableElement>): TagAria;
|
|
29
34
|
export interface TagGroupAria {
|
|
35
|
+
/** Props for the tag grouping element. */
|
|
30
36
|
tagGroupProps: DOMAttributes;
|
|
37
|
+
/** Props for the tag group's visible label (if any). */
|
|
38
|
+
labelProps: DOMAttributes;
|
|
39
|
+
/** Props for the tag group description element, if any. */
|
|
40
|
+
descriptionProps: DOMAttributes;
|
|
41
|
+
/** Props for the tag group error message element, if any. */
|
|
42
|
+
errorMessageProps: DOMAttributes;
|
|
43
|
+
}
|
|
44
|
+
export interface AriaTagGroupProps<T> extends TagGroupProps<T>, DOMProps, AriaLabelingProps, Validation {
|
|
45
|
+
/**
|
|
46
|
+
* An optional keyboard delegate to handle arrow key navigation,
|
|
47
|
+
* to override the default.
|
|
48
|
+
*/
|
|
49
|
+
keyboardDelegate?: TagKeyboardDelegate<T>;
|
|
31
50
|
}
|
|
32
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Provides the behavior and accessibility implementation for a tag group component.
|
|
53
|
+
* Tags allow users to categorize content. They can represent keywords or people, and are grouped to describe an item or a search request.
|
|
54
|
+
* @param props - Props to be applied to the tag group.
|
|
55
|
+
* @param state - State for the tag group, as returned by `useTagGroupState`.
|
|
56
|
+
* @param ref - A ref to a DOM element for the tag group.
|
|
57
|
+
*/
|
|
58
|
+
export function useTagGroup<T>(props: AriaTagGroupProps<T>, state: TagGroupState<T>, ref: RefObject<HTMLElement>): TagGroupAria;
|
|
33
59
|
export type { TagProps } from '@react-types/tag';
|
|
34
60
|
|
|
35
61
|
//# sourceMappingURL=types.d.ts.map
|