@react-aria/tag 3.0.0-alpha.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/LICENSE +201 -0
- package/README.md +3 -0
- package/dist/main.js +359 -0
- package/dist/main.js.map +1 -0
- package/dist/module.js +341 -0
- package/dist/module.js.map +1 -0
- package/dist/types.d.ts +32 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +37 -0
- package/src/TagKeyboardDelegate.ts +91 -0
- package/src/index.ts +15 -0
- package/src/useTag.ts +93 -0
- package/src/useTagGroup.ts +50 -0
package/dist/module.js
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import {GridKeyboardDelegate as $5e9LZ$GridKeyboardDelegate, useGridRow as $5e9LZ$useGridRow, useGridCell as $5e9LZ$useGridCell} from "@react-aria/grid";
|
|
2
|
+
import {useId as $5e9LZ$useId, filterDOMProps as $5e9LZ$filterDOMProps, mergeProps as $5e9LZ$mergeProps} from "@react-aria/utils";
|
|
3
|
+
import {useMessageFormatter as $5e9LZ$useMessageFormatter} from "@react-aria/i18n";
|
|
4
|
+
import {useState as $5e9LZ$useState} from "react";
|
|
5
|
+
import {useFocusWithin as $5e9LZ$useFocusWithin} from "@react-aria/interactions";
|
|
6
|
+
|
|
7
|
+
function $parcel$export(e, n, v, s) {
|
|
8
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
9
|
+
}
|
|
10
|
+
function $parcel$interopDefault(a) {
|
|
11
|
+
return a && a.__esModule ? a.default : a;
|
|
12
|
+
}
|
|
13
|
+
var $5ba5871437372163$exports = {};
|
|
14
|
+
|
|
15
|
+
$parcel$export($5ba5871437372163$exports, "TagKeyboardDelegate", () => $5ba5871437372163$export$b00754732e683b92);
|
|
16
|
+
|
|
17
|
+
class $5ba5871437372163$export$b00754732e683b92 extends $5e9LZ$GridKeyboardDelegate {
|
|
18
|
+
getKeyRightOf(key) {
|
|
19
|
+
return this.direction === 'rtl' ? this.getKeyAbove(key) : this.getKeyBelow(key);
|
|
20
|
+
}
|
|
21
|
+
getKeyLeftOf(key) {
|
|
22
|
+
return this.direction === 'rtl' ? this.getKeyBelow(key) : this.getKeyAbove(key);
|
|
23
|
+
}
|
|
24
|
+
getKeyBelow(key) {
|
|
25
|
+
let startItem = this.collection.getItem(key);
|
|
26
|
+
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
|
+
// 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
|
+
}
|
|
45
|
+
}
|
|
46
|
+
getKeyAbove(key) {
|
|
47
|
+
let startItem = this.collection.getItem(key);
|
|
48
|
+
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
|
+
// 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
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
var $b4db48365d00db9a$exports = {};
|
|
72
|
+
|
|
73
|
+
$parcel$export($b4db48365d00db9a$exports, "useTag", () => $b4db48365d00db9a$export$3f568fff7dff2f03);
|
|
74
|
+
|
|
75
|
+
var $e7b680695b220600$exports = {};
|
|
76
|
+
var $743900c2455038f6$exports = {};
|
|
77
|
+
$743900c2455038f6$exports = JSON.parse("{\"remove\":\"إزالة\"}");
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
var $8de49871543e21de$exports = {};
|
|
81
|
+
$8de49871543e21de$exports = JSON.parse("{\"remove\":\"Премахване\"}");
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
var $0ca4bb919d4f4435$exports = {};
|
|
85
|
+
$0ca4bb919d4f4435$exports = JSON.parse("{\"remove\":\"Odebrat\"}");
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
var $d1b0e85f63a72271$exports = {};
|
|
89
|
+
$d1b0e85f63a72271$exports = JSON.parse("{\"remove\":\"Fjern\"}");
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
var $179e44d286df468c$exports = {};
|
|
93
|
+
$179e44d286df468c$exports = JSON.parse("{\"remove\":\"Entfernen\"}");
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
var $5922cb1bf85b11f4$exports = {};
|
|
97
|
+
$5922cb1bf85b11f4$exports = JSON.parse("{\"remove\":\"Κατάργηση\"}");
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
var $c1e37dadedf6279e$exports = {};
|
|
101
|
+
$c1e37dadedf6279e$exports = JSON.parse("{\"remove\":\"Remove\"}");
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
var $f777f016f08205c3$exports = {};
|
|
105
|
+
$f777f016f08205c3$exports = JSON.parse("{\"remove\":\"Quitar\"}");
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
var $472921d27a779787$exports = {};
|
|
109
|
+
$472921d27a779787$exports = JSON.parse("{\"remove\":\"Eemalda\"}");
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
var $dbd26d6fbc866397$exports = {};
|
|
113
|
+
$dbd26d6fbc866397$exports = JSON.parse("{\"remove\":\"Poista\"}");
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
var $5e39d42bf33df8d3$exports = {};
|
|
117
|
+
$5e39d42bf33df8d3$exports = JSON.parse("{\"remove\":\"Supprimer\"}");
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
var $e7642eed7fd63832$exports = {};
|
|
121
|
+
$e7642eed7fd63832$exports = JSON.parse("{\"remove\":\"הסר\"}");
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
var $8e37c26f95293312$exports = {};
|
|
125
|
+
$8e37c26f95293312$exports = JSON.parse("{\"remove\":\"Ukloni\"}");
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
var $17cdc86f9558ed3c$exports = {};
|
|
129
|
+
$17cdc86f9558ed3c$exports = JSON.parse("{\"remove\":\"Eltávolítás\"}");
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
var $54eeb2c51646b0c1$exports = {};
|
|
133
|
+
$54eeb2c51646b0c1$exports = JSON.parse("{\"remove\":\"Rimuovi\"}");
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
var $35fa9e31530750b7$exports = {};
|
|
137
|
+
$35fa9e31530750b7$exports = JSON.parse("{\"remove\":\"削除\"}");
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
var $195fd25270b3f59a$exports = {};
|
|
141
|
+
$195fd25270b3f59a$exports = JSON.parse("{\"remove\":\"제거\"}");
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
var $59afcb8ef0fdd255$exports = {};
|
|
145
|
+
$59afcb8ef0fdd255$exports = JSON.parse("{\"remove\":\"Pašalinti\"}");
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
var $7090d6af1633af23$exports = {};
|
|
149
|
+
$7090d6af1633af23$exports = JSON.parse("{\"remove\":\"Noņemt\"}");
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
var $be07885f8b3b96a9$exports = {};
|
|
153
|
+
$be07885f8b3b96a9$exports = JSON.parse("{\"remove\":\"Fjern\"}");
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
var $f2c0f1f0195f0354$exports = {};
|
|
157
|
+
$f2c0f1f0195f0354$exports = JSON.parse("{\"remove\":\"Verwijderen\"}");
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
var $71d3ae8d8fc97727$exports = {};
|
|
161
|
+
$71d3ae8d8fc97727$exports = JSON.parse("{\"remove\":\"Usuń\"}");
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
var $1397e7794fa0c7f3$exports = {};
|
|
165
|
+
$1397e7794fa0c7f3$exports = JSON.parse("{\"remove\":\"Remover\"}");
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
var $db8818414d5aca5a$exports = {};
|
|
169
|
+
$db8818414d5aca5a$exports = JSON.parse("{\"remove\":\"Eliminar\"}");
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
var $42a9d36f6f705fef$exports = {};
|
|
173
|
+
$42a9d36f6f705fef$exports = JSON.parse("{\"remove\":\"Îndepărtaţi\"}");
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
var $af153844a11ef098$exports = {};
|
|
177
|
+
$af153844a11ef098$exports = JSON.parse("{\"remove\":\"Удалить\"}");
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
var $5cf6622ee7608622$exports = {};
|
|
181
|
+
$5cf6622ee7608622$exports = JSON.parse("{\"remove\":\"Odstrániť\"}");
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
var $f9f5a69026a5c16f$exports = {};
|
|
185
|
+
$f9f5a69026a5c16f$exports = JSON.parse("{\"remove\":\"Odstrani\"}");
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
var $1a86645d269e1fc9$exports = {};
|
|
189
|
+
$1a86645d269e1fc9$exports = JSON.parse("{\"remove\":\"Ukloni\"}");
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
var $167b6af1e63b05e3$exports = {};
|
|
193
|
+
$167b6af1e63b05e3$exports = JSON.parse("{\"remove\":\"Ta bort\"}");
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
var $b74cd31c591a8aaa$exports = {};
|
|
197
|
+
$b74cd31c591a8aaa$exports = JSON.parse("{\"remove\":\"Kaldır\"}");
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
var $397d4b29878d3d4b$exports = {};
|
|
201
|
+
$397d4b29878d3d4b$exports = JSON.parse("{\"remove\":\"Видалити\"}");
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
var $5f78b636df0c01b4$exports = {};
|
|
205
|
+
$5f78b636df0c01b4$exports = JSON.parse("{\"remove\":\"删除\"}");
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
var $601a7eb375519934$exports = {};
|
|
209
|
+
$601a7eb375519934$exports = JSON.parse("{\"remove\":\"移除\"}");
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
$e7b680695b220600$exports = {
|
|
213
|
+
"ar-AE": $743900c2455038f6$exports,
|
|
214
|
+
"bg-BG": $8de49871543e21de$exports,
|
|
215
|
+
"cs-CZ": $0ca4bb919d4f4435$exports,
|
|
216
|
+
"da-DK": $d1b0e85f63a72271$exports,
|
|
217
|
+
"de-DE": $179e44d286df468c$exports,
|
|
218
|
+
"el-GR": $5922cb1bf85b11f4$exports,
|
|
219
|
+
"en-US": $c1e37dadedf6279e$exports,
|
|
220
|
+
"es-ES": $f777f016f08205c3$exports,
|
|
221
|
+
"et-EE": $472921d27a779787$exports,
|
|
222
|
+
"fi-FI": $dbd26d6fbc866397$exports,
|
|
223
|
+
"fr-FR": $5e39d42bf33df8d3$exports,
|
|
224
|
+
"he-IL": $e7642eed7fd63832$exports,
|
|
225
|
+
"hr-HR": $8e37c26f95293312$exports,
|
|
226
|
+
"hu-HU": $17cdc86f9558ed3c$exports,
|
|
227
|
+
"it-IT": $54eeb2c51646b0c1$exports,
|
|
228
|
+
"ja-JP": $35fa9e31530750b7$exports,
|
|
229
|
+
"ko-KR": $195fd25270b3f59a$exports,
|
|
230
|
+
"lt-LT": $59afcb8ef0fdd255$exports,
|
|
231
|
+
"lv-LV": $7090d6af1633af23$exports,
|
|
232
|
+
"nb-NO": $be07885f8b3b96a9$exports,
|
|
233
|
+
"nl-NL": $f2c0f1f0195f0354$exports,
|
|
234
|
+
"pl-PL": $71d3ae8d8fc97727$exports,
|
|
235
|
+
"pt-BR": $1397e7794fa0c7f3$exports,
|
|
236
|
+
"pt-PT": $db8818414d5aca5a$exports,
|
|
237
|
+
"ro-RO": $42a9d36f6f705fef$exports,
|
|
238
|
+
"ru-RU": $af153844a11ef098$exports,
|
|
239
|
+
"sk-SK": $5cf6622ee7608622$exports,
|
|
240
|
+
"sl-SI": $f9f5a69026a5c16f$exports,
|
|
241
|
+
"sr-SP": $1a86645d269e1fc9$exports,
|
|
242
|
+
"sv-SE": $167b6af1e63b05e3$exports,
|
|
243
|
+
"tr-TR": $b74cd31c591a8aaa$exports,
|
|
244
|
+
"uk-UA": $397d4b29878d3d4b$exports,
|
|
245
|
+
"zh-CN": $5f78b636df0c01b4$exports,
|
|
246
|
+
"zh-TW": $601a7eb375519934$exports
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
function $b4db48365d00db9a$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 = $5e9LZ$useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($e7b680695b220600$exports)));
|
|
256
|
+
const removeString = formatMessage('remove');
|
|
257
|
+
const labelId = $5e9LZ$useId();
|
|
258
|
+
const buttonId = $5e9LZ$useId();
|
|
259
|
+
let { rowProps: rowProps } = $5e9LZ$useGridRow({
|
|
260
|
+
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 } = $5e9LZ$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);
|
|
274
|
+
e.preventDefault();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
const pressProps = {
|
|
278
|
+
onPress: (e)=>onRemove?.(children, e)
|
|
279
|
+
};
|
|
280
|
+
isFocused = isFocused || state.selectionManager.focusedKey === item.childNodes[0].key;
|
|
281
|
+
let domProps = $5e9LZ$filterDOMProps(props);
|
|
282
|
+
return {
|
|
283
|
+
clearButtonProps: $5e9LZ$mergeProps(pressProps, {
|
|
284
|
+
'aria-label': removeString,
|
|
285
|
+
'aria-labelledby': `${buttonId} ${labelId}`,
|
|
286
|
+
id: buttonId,
|
|
287
|
+
isDisabled: isDisabled
|
|
288
|
+
}),
|
|
289
|
+
labelProps: {
|
|
290
|
+
id: labelId
|
|
291
|
+
},
|
|
292
|
+
tagRowProps: otherRowProps,
|
|
293
|
+
tagProps: $5e9LZ$mergeProps(domProps, gridCellProps, {
|
|
294
|
+
'aria-disabled': isDisabled,
|
|
295
|
+
'aria-errormessage': props['aria-errormessage'],
|
|
296
|
+
'aria-label': props['aria-label'],
|
|
297
|
+
onKeyDown: !isDisabled && isRemovable ? onKeyDown : null,
|
|
298
|
+
tabIndex: (isFocused || state.selectionManager.focusedKey == null) && !isDisabled ? 0 : -1,
|
|
299
|
+
onFocus () {
|
|
300
|
+
state.selectionManager.setFocusedKey(item.childNodes[0].key);
|
|
301
|
+
},
|
|
302
|
+
ref: tagRef
|
|
303
|
+
})
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
var $2aa59344625470f3$exports = {};
|
|
309
|
+
|
|
310
|
+
$parcel$export($2aa59344625470f3$exports, "useTagGroup", () => $2aa59344625470f3$export$4f8b5cda58b7e8ff);
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
function $2aa59344625470f3$export$4f8b5cda58b7e8ff(props, listState) {
|
|
315
|
+
let { isDisabled: isDisabled } = props;
|
|
316
|
+
let [isFocusWithin, setFocusWithin] = $5e9LZ$useState(false);
|
|
317
|
+
let { focusWithinProps: focusWithinProps } = $5e9LZ$useFocusWithin({
|
|
318
|
+
onFocusWithinChange: setFocusWithin
|
|
319
|
+
});
|
|
320
|
+
let allKeys = [
|
|
321
|
+
...listState.collection.getKeys()
|
|
322
|
+
];
|
|
323
|
+
if (!allKeys.some((key)=>!listState.disabledKeys.has(key)
|
|
324
|
+
)) isDisabled = true;
|
|
325
|
+
let domProps = $5e9LZ$filterDOMProps(props);
|
|
326
|
+
return {
|
|
327
|
+
tagGroupProps: $5e9LZ$mergeProps(domProps, {
|
|
328
|
+
'aria-atomic': false,
|
|
329
|
+
'aria-relevant': 'additions',
|
|
330
|
+
'aria-live': isFocusWithin ? 'polite' : 'off',
|
|
331
|
+
'aria-disabled': isDisabled === true,
|
|
332
|
+
...focusWithinProps
|
|
333
|
+
})
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
export {$5ba5871437372163$export$b00754732e683b92 as TagKeyboardDelegate, $b4db48365d00db9a$export$3f568fff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H,CAAC;AACH,CAAC;;;;;;;;;SoC/De,yCAAW,CAAC,KAAwB,EAAE,SAAS,EAAgB,CAAC;IAC9E,GAAG,CAAC,CAAC,aAAA,UAAU,EAAA,CAAC,GAAG,KAAK;IACxB,GAAG,EAAE,aAAa,EAAE,cAAc,IAAI,eAAQ,CAAC,KAAK;IACpD,GAAG,CAAC,CAAC,mBAAA,gBAAgB,EAAA,CAAC,GAAG,qBAAc,CAAC,CAAC;QACvC,mBAAmB,EAAE,cAAc;IACrC,CAAC;IACD,GAAG,CAAC,OAAO,GAAG,CAAC;WAAG,SAAS,CAAC,UAAU,CAAC,OAAO;IAAE,CAAC;IACjD,EAAE,GAAG,OAAO,CAAC,IAAI,EAAC,GAAG,IAAK,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG;OACtD,UAAU,GAAG,IAAI;IAEnB,GAAG,CAAC,QAAQ,GAAG,qBAAc,CAAC,KAAK;IACnC,MAAM,CAAC,CAAC;QACN,aAAa,EAAE,iBAAU,CAAC,QAAQ,EAAE,CAAC;YACnC,CAAa,cAAE,KAAK;YACpB,CAAe,gBAAE,CAAW;YAC5B,CAAW,YAAE,aAAa,GAAG,CAAQ,UAAG,CAAK;YAC7C,CAAe,gBAAE,UAAU,KAAK,IAAI;eACjC,gBAAgB;QACrB,CAAC;IACH,CAAC;AACH,CAAC;","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 * from './TagKeyboardDelegate';\nexport * from './useTag';\nexport * from './useTagGroup';\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 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 let newKey = [...item.childNodes][startItem.index].key;\n\n // Ignore disabled tags\n if (this.disabledKeys.has(newKey)) {\n return this.getKeyBelow(newKey);\n }\n return newKey;\n }\n\n // Otherwise, focus the next row\n if (this.focusMode === 'row') {\n return key;\n }\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 let newKey = [...item.childNodes][startItem.index].key;\n\n // ignore disabled tags\n if (this.disabledKeys.has(newKey)) {\n return this.getKeyAbove(newKey);\n }\n return newKey;\n }\n\n // Otherwise, focus the previous row\n if (this.focusMode === 'row') {\n return key;\n }\n }\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, HTMLAttributes, KeyboardEvent} from 'react';\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 {useMessageFormatter} from '@react-aria/i18n';\n\n\nexport interface TagAria {\n labelProps: HTMLAttributes<HTMLElement>,\n tagProps: HTMLAttributes<HTMLElement>,\n tagRowProps: HTMLAttributes<HTMLElement>,\n clearButtonProps: ButtonHTMLAttributes<HTMLButtonElement>\n}\n\nexport function useTag(props: TagProps<any>, state: GridState<any, any>): TagAria {\n let {isFocused} = props;\n const {\n isDisabled,\n isRemovable,\n onRemove,\n children,\n item,\n tagRef,\n tagRowRef\n } = props;\n const formatMessage = useMessageFormatter(intlMessages);\n const removeString = formatMessage('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<HTMLElement>) {\n if (e.key === 'Delete' || e.key === 'Backspace') {\n onRemove(children, e);\n e.preventDefault();\n }\n }\n const pressProps = {\n onPress: e => onRemove?.(children, e)\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 isDisabled\n }),\n labelProps: {\n id: labelId\n },\n tagRowProps: otherRowProps,\n tagProps: mergeProps(domProps, gridCellProps, {\n 'aria-disabled': isDisabled,\n 'aria-errormessage': props['aria-errormessage'],\n 'aria-label': props['aria-label'],\n onKeyDown: !isDisabled && isRemovable ? onKeyDown : null,\n tabIndex: (isFocused || state.selectionManager.focusedKey == null) && !isDisabled ? 0 : -1,\n onFocus() {\n state.selectionManager.setFocusedKey(item.childNodes[0].key);\n },\n ref: tagRef\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 {DOMProps} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {HTMLAttributes, Key, ReactNode, useState} from 'react';\nimport {useFocusWithin} from '@react-aria/interactions';\n\ninterface AriaTagGroupProps extends DOMProps {\n children: ReactNode,\n disabledKeys?: Iterable<Key>,\n isDisabled?: boolean,\n isReadOnly?: boolean, // removes close button\n validationState?: 'valid' | 'invalid'\n}\n\ninterface TagGroupAria {\n tagGroupProps: HTMLAttributes<HTMLElement>\n}\n\nexport function useTagGroup(props: AriaTagGroupProps, listState): TagGroupAria {\n let {isDisabled} = props;\n let [isFocusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({\n onFocusWithinChange: setFocusWithin\n });\n let allKeys = [...listState.collection.getKeys()];\n if (!allKeys.some(key => !listState.disabledKeys.has(key))) {\n isDisabled = true;\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 'aria-disabled': isDisabled === true,\n ...focusWithinProps\n } as HTMLAttributes<HTMLElement>)\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { GridCollection } from "@react-types/grid";
|
|
2
|
+
import { GridKeyboardDelegate } from "@react-aria/grid";
|
|
3
|
+
import { Key, ButtonHTMLAttributes, HTMLAttributes, ReactNode } from "react";
|
|
4
|
+
import { GridState } from "@react-stately/grid";
|
|
5
|
+
import { TagProps } from "@react-types/tag";
|
|
6
|
+
import { DOMProps } from "@react-types/shared";
|
|
7
|
+
export class TagKeyboardDelegate<T> extends GridKeyboardDelegate<T, GridCollection<T>> {
|
|
8
|
+
getKeyRightOf(key: Key): any;
|
|
9
|
+
getKeyLeftOf(key: Key): any;
|
|
10
|
+
getKeyBelow(key: any): any;
|
|
11
|
+
getKeyAbove(key: any): any;
|
|
12
|
+
}
|
|
13
|
+
export interface TagAria {
|
|
14
|
+
labelProps: HTMLAttributes<HTMLElement>;
|
|
15
|
+
tagProps: HTMLAttributes<HTMLElement>;
|
|
16
|
+
tagRowProps: HTMLAttributes<HTMLElement>;
|
|
17
|
+
clearButtonProps: ButtonHTMLAttributes<HTMLButtonElement>;
|
|
18
|
+
}
|
|
19
|
+
export function useTag(props: TagProps<any>, state: GridState<any, any>): TagAria;
|
|
20
|
+
interface AriaTagGroupProps extends DOMProps {
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
disabledKeys?: Iterable<Key>;
|
|
23
|
+
isDisabled?: boolean;
|
|
24
|
+
isReadOnly?: boolean;
|
|
25
|
+
validationState?: 'valid' | 'invalid';
|
|
26
|
+
}
|
|
27
|
+
interface TagGroupAria {
|
|
28
|
+
tagGroupProps: HTMLAttributes<HTMLElement>;
|
|
29
|
+
}
|
|
30
|
+
export function useTagGroup(props: AriaTagGroupProps, listState: any): TagGroupAria;
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;AAgBA,iCAAiC,CAAC,CAAE,SAAQ,qBAAqB,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC;IACpF,aAAa,CAAC,GAAG,EAAE,GAAG;IAItB,YAAY,CAAC,GAAG,EAAE,GAAG;IAIrB,WAAW,CAAC,GAAG,KAAA;IAiCf,WAAW,CAAC,GAAG,KAAA;CAgChB;ACpED;IACE,UAAU,EAAE,eAAe,WAAW,CAAC,CAAC;IACxC,QAAQ,EAAE,eAAe,WAAW,CAAC,CAAC;IACtC,WAAW,EAAE,eAAe,WAAW,CAAC,CAAC;IACzC,gBAAgB,EAAE,qBAAqB,iBAAiB,CAAC,CAAA;CAC1D;AAED,uBAAuB,KAAK,EAAE,SAAS,GAAG,CAAC,EAAE,KAAK,EAAE,UAAU,GAAG,EAAE,GAAG,CAAC,GAAG,OAAO,CA+DhF;AC3ED,2BAA4B,SAAQ,QAAQ;IAC1C,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACtC;AAED;IACE,aAAa,EAAE,eAAe,WAAW,CAAC,CAAA;CAC3C;AAED,4BAA4B,KAAK,EAAE,iBAAiB,EAAE,SAAS,KAAA,GAAG,YAAY,CAoB7E","sources":["packages/@react-aria/tag/src/packages/@react-aria/tag/src/TagKeyboardDelegate.ts","packages/@react-aria/tag/src/packages/@react-aria/tag/src/useTag.ts","packages/@react-aria/tag/src/packages/@react-aria/tag/src/useTagGroup.ts","packages/@react-aria/tag/src/packages/@react-aria/tag/src/index.ts","packages/@react-aria/tag/src/index.ts"],"sourcesContent":[null,null,null,null,"/*\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 * from './TagKeyboardDelegate';\nexport * from './useTag';\nexport * from './useTagGroup';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-aria/tag",
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
4
|
+
"description": "Spectrum UI components in React",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"main": "dist/main.js",
|
|
7
|
+
"module": "dist/module.js",
|
|
8
|
+
"types": "dist/types.d.ts",
|
|
9
|
+
"source": "src/index.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"src"
|
|
13
|
+
],
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/adobe/react-spectrum"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@babel/runtime": "^7.6.2",
|
|
21
|
+
"@react-aria/grid": "^3.0.0",
|
|
22
|
+
"@react-aria/i18n": "^3.1.0",
|
|
23
|
+
"@react-aria/interactions": "^3.1.0",
|
|
24
|
+
"@react-aria/utils": "^3.1.0",
|
|
25
|
+
"@react-stately/grid": "^3.0.0",
|
|
26
|
+
"@react-types/grid": "^3.0.0",
|
|
27
|
+
"@react-types/shared": "^3.1.0",
|
|
28
|
+
"@react-types/tag": "3.0.0-alpha.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"react": "^16.8.0 || ^17.0.0-rc.1"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"gitHead": "54c2366c4f31bd4bf619126131cd583c12972acc"
|
|
37
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import {GridCollection} from '@react-types/grid';
|
|
14
|
+
import {GridKeyboardDelegate} from '@react-aria/grid';
|
|
15
|
+
import {Key} from 'react';
|
|
16
|
+
|
|
17
|
+
export class TagKeyboardDelegate<T> extends GridKeyboardDelegate<T, GridCollection<T>> {
|
|
18
|
+
getKeyRightOf(key: Key) {
|
|
19
|
+
return this.direction === 'rtl' ? this.getKeyAbove(key) : this.getKeyBelow(key);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
getKeyLeftOf(key: Key) {
|
|
23
|
+
return this.direction === 'rtl' ? this.getKeyBelow(key) : this.getKeyAbove(key);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
getKeyBelow(key) {
|
|
27
|
+
let startItem = this.collection.getItem(key);
|
|
28
|
+
if (!startItem) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// If focus was on a cell, start searching from the parent row
|
|
33
|
+
if (this.isCell(startItem)) {
|
|
34
|
+
key = startItem.parentKey;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Find the next item
|
|
38
|
+
key = this.findNextKey(key);
|
|
39
|
+
if (key != null) {
|
|
40
|
+
// If focus was on a cell, focus the cell with the same index in the next row.
|
|
41
|
+
if (this.isCell(startItem)) {
|
|
42
|
+
let item = this.collection.getItem(key);
|
|
43
|
+
let newKey = [...item.childNodes][startItem.index].key;
|
|
44
|
+
|
|
45
|
+
// Ignore disabled tags
|
|
46
|
+
if (this.disabledKeys.has(newKey)) {
|
|
47
|
+
return this.getKeyBelow(newKey);
|
|
48
|
+
}
|
|
49
|
+
return newKey;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Otherwise, focus the next row
|
|
53
|
+
if (this.focusMode === 'row') {
|
|
54
|
+
return key;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
getKeyAbove(key) {
|
|
60
|
+
let startItem = this.collection.getItem(key);
|
|
61
|
+
if (!startItem) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// If focus is on a cell, start searching from the parent row
|
|
66
|
+
if (this.isCell(startItem)) {
|
|
67
|
+
key = startItem.parentKey;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Find the previous item
|
|
71
|
+
key = this.findPreviousKey(key);
|
|
72
|
+
if (key != null) {
|
|
73
|
+
// If focus was on a cell, focus the cell with the same index in the previous row.
|
|
74
|
+
if (this.isCell(startItem)) {
|
|
75
|
+
let item = this.collection.getItem(key);
|
|
76
|
+
let newKey = [...item.childNodes][startItem.index].key;
|
|
77
|
+
|
|
78
|
+
// ignore disabled tags
|
|
79
|
+
if (this.disabledKeys.has(newKey)) {
|
|
80
|
+
return this.getKeyAbove(newKey);
|
|
81
|
+
}
|
|
82
|
+
return newKey;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Otherwise, focus the previous row
|
|
86
|
+
if (this.focusMode === 'row') {
|
|
87
|
+
return key;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export * from './TagKeyboardDelegate';
|
|
14
|
+
export * from './useTag';
|
|
15
|
+
export * from './useTagGroup';
|
package/src/useTag.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import {ButtonHTMLAttributes, HTMLAttributes, KeyboardEvent} from 'react';
|
|
14
|
+
import {filterDOMProps, mergeProps, useId} from '@react-aria/utils';
|
|
15
|
+
import {GridState} from '@react-stately/grid';
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
import intlMessages from '../intl/*.json';
|
|
18
|
+
import {TagProps} from '@react-types/tag';
|
|
19
|
+
import {useGridCell, useGridRow} from '@react-aria/grid';
|
|
20
|
+
import {useMessageFormatter} from '@react-aria/i18n';
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export interface TagAria {
|
|
24
|
+
labelProps: HTMLAttributes<HTMLElement>,
|
|
25
|
+
tagProps: HTMLAttributes<HTMLElement>,
|
|
26
|
+
tagRowProps: HTMLAttributes<HTMLElement>,
|
|
27
|
+
clearButtonProps: ButtonHTMLAttributes<HTMLButtonElement>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function useTag(props: TagProps<any>, state: GridState<any, any>): TagAria {
|
|
31
|
+
let {isFocused} = props;
|
|
32
|
+
const {
|
|
33
|
+
isDisabled,
|
|
34
|
+
isRemovable,
|
|
35
|
+
onRemove,
|
|
36
|
+
children,
|
|
37
|
+
item,
|
|
38
|
+
tagRef,
|
|
39
|
+
tagRowRef
|
|
40
|
+
} = props;
|
|
41
|
+
const formatMessage = useMessageFormatter(intlMessages);
|
|
42
|
+
const removeString = formatMessage('remove');
|
|
43
|
+
const labelId = useId();
|
|
44
|
+
const buttonId = useId();
|
|
45
|
+
|
|
46
|
+
let {rowProps} = useGridRow({
|
|
47
|
+
node: item
|
|
48
|
+
}, state, tagRowRef);
|
|
49
|
+
// Don't want the row to be focusable or accessible via keyboard
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
51
|
+
let {tabIndex, ...otherRowProps} = rowProps;
|
|
52
|
+
|
|
53
|
+
let {gridCellProps} = useGridCell({
|
|
54
|
+
node: [...item.childNodes][0],
|
|
55
|
+
focusMode: 'cell'
|
|
56
|
+
}, state, tagRef);
|
|
57
|
+
|
|
58
|
+
function onKeyDown(e: KeyboardEvent<HTMLElement>) {
|
|
59
|
+
if (e.key === 'Delete' || e.key === 'Backspace') {
|
|
60
|
+
onRemove(children, e);
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const pressProps = {
|
|
65
|
+
onPress: e => onRemove?.(children, e)
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
isFocused = isFocused || state.selectionManager.focusedKey === item.childNodes[0].key;
|
|
69
|
+
let domProps = filterDOMProps(props);
|
|
70
|
+
return {
|
|
71
|
+
clearButtonProps: mergeProps(pressProps, {
|
|
72
|
+
'aria-label': removeString,
|
|
73
|
+
'aria-labelledby': `${buttonId} ${labelId}`,
|
|
74
|
+
id: buttonId,
|
|
75
|
+
isDisabled
|
|
76
|
+
}),
|
|
77
|
+
labelProps: {
|
|
78
|
+
id: labelId
|
|
79
|
+
},
|
|
80
|
+
tagRowProps: otherRowProps,
|
|
81
|
+
tagProps: mergeProps(domProps, gridCellProps, {
|
|
82
|
+
'aria-disabled': isDisabled,
|
|
83
|
+
'aria-errormessage': props['aria-errormessage'],
|
|
84
|
+
'aria-label': props['aria-label'],
|
|
85
|
+
onKeyDown: !isDisabled && isRemovable ? onKeyDown : null,
|
|
86
|
+
tabIndex: (isFocused || state.selectionManager.focusedKey == null) && !isDisabled ? 0 : -1,
|
|
87
|
+
onFocus() {
|
|
88
|
+
state.selectionManager.setFocusedKey(item.childNodes[0].key);
|
|
89
|
+
},
|
|
90
|
+
ref: tagRef
|
|
91
|
+
})
|
|
92
|
+
};
|
|
93
|
+
}
|