@react-aria/tag 3.0.0-nightly.2087 → 3.0.0-nightly.2104
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 +17 -9
- package/dist/main.js +16 -8
- package/dist/main.js.map +1 -1
- package/dist/module.js +17 -9
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +6 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/index.ts +1 -1
- package/src/useTag.ts +20 -11
package/dist/import.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {useId as $aIvin$useId, chain as $aIvin$chain, filterDOMProps as $aIvin$filterDOMProps, mergeProps as $aIvin$mergeProps} from "@react-aria/utils";
|
|
1
|
+
import {useId as $aIvin$useId, chain as $aIvin$chain, useDescription as $aIvin$useDescription, filterDOMProps as $aIvin$filterDOMProps, mergeProps as $aIvin$mergeProps} from "@react-aria/utils";
|
|
2
2
|
import {useGridListItem as $aIvin$useGridListItem, useGridList as $aIvin$useGridList} from "@react-aria/gridlist";
|
|
3
|
+
import {useInteractionModality as $aIvin$useInteractionModality, useFocusWithin as $aIvin$useFocusWithin} from "@react-aria/interactions";
|
|
3
4
|
import {useLocalizedStringFormatter as $aIvin$useLocalizedStringFormatter, useLocale as $aIvin$useLocale} from "@react-aria/i18n";
|
|
4
5
|
import {useState as $aIvin$useState} from "react";
|
|
5
6
|
import {useField as $aIvin$useField} from "@react-aria/label";
|
|
6
|
-
import {useFocusWithin as $aIvin$useFocusWithin} from "@react-aria/interactions";
|
|
7
7
|
|
|
8
8
|
function $parcel$interopDefault(a) {
|
|
9
9
|
return a && a.__esModule ? a.default : a;
|
|
@@ -120,7 +120,8 @@ $3618d917e503a8d3$exports = {
|
|
|
120
120
|
|
|
121
121
|
var $9eb56bbbe8e31294$exports = {};
|
|
122
122
|
$9eb56bbbe8e31294$exports = {
|
|
123
|
-
"
|
|
123
|
+
"removeDescription": `Press Delete to remove tag.`,
|
|
124
|
+
"removeButtonLabel": `Remove`
|
|
124
125
|
};
|
|
125
126
|
|
|
126
127
|
|
|
@@ -326,10 +327,10 @@ $4d1b62e0e67c00a4$exports = {
|
|
|
326
327
|
|
|
327
328
|
|
|
328
329
|
|
|
330
|
+
|
|
329
331
|
function $fc6126c82a4601f1$export$3f568fff7dff2f03(props, state, ref) {
|
|
330
|
-
let {
|
|
332
|
+
let { allowsRemoving: allowsRemoving , item: item } = props;
|
|
331
333
|
let stringFormatter = (0, $aIvin$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($4d1b62e0e67c00a4$exports))));
|
|
332
|
-
let removeString = stringFormatter.format("remove");
|
|
333
334
|
let labelId = (0, $aIvin$useId)();
|
|
334
335
|
let buttonId = (0, $aIvin$useId)();
|
|
335
336
|
let { rowProps: rowProps , gridCellProps: gridCellProps } = (0, $aIvin$useGridListItem)({
|
|
@@ -344,11 +345,17 @@ function $fc6126c82a4601f1$export$3f568fff7dff2f03(props, state, ref) {
|
|
|
344
345
|
e.preventDefault();
|
|
345
346
|
}
|
|
346
347
|
};
|
|
347
|
-
|
|
348
|
+
let modality = (0, $aIvin$useInteractionModality)();
|
|
349
|
+
if (modality === "virtual" && typeof window !== "undefined" && "ontouchstart" in window) modality = "touch";
|
|
350
|
+
let description = allowsRemoving && (modality === "keyboard" || modality === "virtual") ? stringFormatter.format("removeDescription") : "";
|
|
351
|
+
let descProps = (0, $aIvin$useDescription)(description);
|
|
348
352
|
let domProps = (0, $aIvin$filterDOMProps)(props);
|
|
353
|
+
let isFocused = item.key === state.selectionManager.focusedKey;
|
|
349
354
|
return {
|
|
350
|
-
|
|
351
|
-
"aria-label":
|
|
355
|
+
removeButtonProps: {
|
|
356
|
+
"aria-label": stringFormatter.format("removeButtonLabel", {
|
|
357
|
+
label: item.textValue
|
|
358
|
+
}),
|
|
352
359
|
"aria-labelledby": `${buttonId} ${labelId}`,
|
|
353
360
|
id: buttonId,
|
|
354
361
|
onPress: ()=>allowsRemoving && onRemove ? onRemove(item.key) : null,
|
|
@@ -360,7 +367,8 @@ function $fc6126c82a4601f1$export$3f568fff7dff2f03(props, state, ref) {
|
|
|
360
367
|
rowProps: {
|
|
361
368
|
...rowProps,
|
|
362
369
|
tabIndex: isFocused || state.selectionManager.focusedKey == null ? 0 : -1,
|
|
363
|
-
onKeyDown: allowsRemoving ? onKeyDown : null
|
|
370
|
+
onKeyDown: allowsRemoving ? onKeyDown : null,
|
|
371
|
+
"aria-describedby": descProps["aria-describedby"]
|
|
364
372
|
},
|
|
365
373
|
gridCellProps: (0, $aIvin$mergeProps)(domProps, gridCellProps, {
|
|
366
374
|
"aria-errormessage": props["aria-errormessage"],
|
package/dist/main.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var $bSzeT$reactariautils = require("@react-aria/utils");
|
|
2
2
|
var $bSzeT$reactariagridlist = require("@react-aria/gridlist");
|
|
3
|
+
var $bSzeT$reactariainteractions = require("@react-aria/interactions");
|
|
3
4
|
var $bSzeT$reactariai18n = require("@react-aria/i18n");
|
|
4
5
|
var $bSzeT$react = require("react");
|
|
5
6
|
var $bSzeT$reactarialabel = require("@react-aria/label");
|
|
6
|
-
var $bSzeT$reactariainteractions = require("@react-aria/interactions");
|
|
7
7
|
|
|
8
8
|
function $parcel$export(e, n, v, s) {
|
|
9
9
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
@@ -127,7 +127,8 @@ $9ec4c01646bfc149$exports = {
|
|
|
127
127
|
|
|
128
128
|
var $0b797b6d677cd5c7$exports = {};
|
|
129
129
|
$0b797b6d677cd5c7$exports = {
|
|
130
|
-
"
|
|
130
|
+
"removeDescription": `Press Delete to remove tag.`,
|
|
131
|
+
"removeButtonLabel": `Remove`
|
|
131
132
|
};
|
|
132
133
|
|
|
133
134
|
|
|
@@ -333,10 +334,10 @@ $29abb9209b62cd49$exports = {
|
|
|
333
334
|
|
|
334
335
|
|
|
335
336
|
|
|
337
|
+
|
|
336
338
|
function $a442534c81d8ad16$export$3f568fff7dff2f03(props, state, ref) {
|
|
337
|
-
let {
|
|
339
|
+
let { allowsRemoving: allowsRemoving , item: item } = props;
|
|
338
340
|
let stringFormatter = (0, $bSzeT$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($29abb9209b62cd49$exports))));
|
|
339
|
-
let removeString = stringFormatter.format("remove");
|
|
340
341
|
let labelId = (0, $bSzeT$reactariautils.useId)();
|
|
341
342
|
let buttonId = (0, $bSzeT$reactariautils.useId)();
|
|
342
343
|
let { rowProps: rowProps , gridCellProps: gridCellProps } = (0, $bSzeT$reactariagridlist.useGridListItem)({
|
|
@@ -351,11 +352,17 @@ function $a442534c81d8ad16$export$3f568fff7dff2f03(props, state, ref) {
|
|
|
351
352
|
e.preventDefault();
|
|
352
353
|
}
|
|
353
354
|
};
|
|
354
|
-
|
|
355
|
+
let modality = (0, $bSzeT$reactariainteractions.useInteractionModality)();
|
|
356
|
+
if (modality === "virtual" && typeof window !== "undefined" && "ontouchstart" in window) modality = "touch";
|
|
357
|
+
let description = allowsRemoving && (modality === "keyboard" || modality === "virtual") ? stringFormatter.format("removeDescription") : "";
|
|
358
|
+
let descProps = (0, $bSzeT$reactariautils.useDescription)(description);
|
|
355
359
|
let domProps = (0, $bSzeT$reactariautils.filterDOMProps)(props);
|
|
360
|
+
let isFocused = item.key === state.selectionManager.focusedKey;
|
|
356
361
|
return {
|
|
357
|
-
|
|
358
|
-
"aria-label":
|
|
362
|
+
removeButtonProps: {
|
|
363
|
+
"aria-label": stringFormatter.format("removeButtonLabel", {
|
|
364
|
+
label: item.textValue
|
|
365
|
+
}),
|
|
359
366
|
"aria-labelledby": `${buttonId} ${labelId}`,
|
|
360
367
|
id: buttonId,
|
|
361
368
|
onPress: ()=>allowsRemoving && onRemove ? onRemove(item.key) : null,
|
|
@@ -367,7 +374,8 @@ function $a442534c81d8ad16$export$3f568fff7dff2f03(props, state, ref) {
|
|
|
367
374
|
rowProps: {
|
|
368
375
|
...rowProps,
|
|
369
376
|
tabIndex: isFocused || state.selectionManager.focusedKey == null ? 0 : -1,
|
|
370
|
-
onKeyDown: allowsRemoving ? onKeyDown : null
|
|
377
|
+
onKeyDown: allowsRemoving ? onKeyDown : null,
|
|
378
|
+
"aria-describedby": descProps["aria-describedby"]
|
|
371
379
|
},
|
|
372
380
|
gridCellProps: (0, $bSzeT$reactariautils.mergeProps)(domProps, gridCellProps, {
|
|
373
381
|
"aria-errormessage": props["aria-errormessage"],
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;QACzB,MAAM,IAAI,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,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 gridCellProps: DOMAttributes,\n /** Props for the tag row element. */\n rowProps: 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') {\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 excludeFromTabOrder: true\n },\n labelProps: {\n id: labelId\n },\n rowProps: {\n ...rowProps,\n tabIndex: (isFocused || state.selectionManager.focusedKey == null) ? 0 : -1,\n onKeyDown: allowsRemoving ? onKeyDown : null\n },\n gridCellProps: 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 gridProps: 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 * A tag group is a focusable list of labels, categories, keywords, or other items, with support for keyboard navigation and removal.\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 gridProps: 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":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED,AAGO,MAAM;IASX,cAAc;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW;IACpC;IAEA,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ages/@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 {AriaTagProps, 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 {AriaLabelingProps, DOMAttributes, DOMProps, FocusableElement} from '@react-types/shared';\nimport {chain, filterDOMProps, mergeProps, useDescription, useId} from '@react-aria/utils';\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 {useInteractionModality} from '@react-aria/interactions';\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 gridCellProps: DOMAttributes,\n /** Props for the tag row element. */\n rowProps: DOMAttributes,\n /** Props for the tag remove button. */\n removeButtonProps: AriaButtonProps\n}\n\nexport interface AriaTagProps<T> extends TagProps<T>, DOMProps, AriaLabelingProps {}\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: AriaTagProps<T>, state: TagGroupState<T>, ref: RefObject<FocusableElement>): TagAria {\n let {\n allowsRemoving,\n item\n } = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages);\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') {\n onRemove(item.key);\n e.preventDefault();\n }\n };\n\n let modality: string = useInteractionModality();\n if (modality === 'virtual' && (typeof window !== 'undefined' && 'ontouchstart' in window)) {\n modality = 'touch';\n }\n let description = allowsRemoving && (modality === 'keyboard' || modality === 'virtual') ? stringFormatter.format('removeDescription') : '';\n let descProps = useDescription(description);\n\n let domProps = filterDOMProps(props);\n let isFocused = item.key === state.selectionManager.focusedKey;\n return {\n removeButtonProps: {\n 'aria-label': stringFormatter.format('removeButtonLabel', {label: item.textValue}),\n 'aria-labelledby': `${buttonId} ${labelId}`,\n id: buttonId,\n onPress: () => allowsRemoving && onRemove ? onRemove(item.key) : null,\n excludeFromTabOrder: true\n },\n labelProps: {\n id: labelId\n },\n rowProps: {\n ...rowProps,\n tabIndex: (isFocused || state.selectionManager.focusedKey == null) ? 0 : -1,\n onKeyDown: allowsRemoving ? onKeyDown : null,\n 'aria-describedby': descProps['aria-describedby']\n },\n gridCellProps: 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 \"removeDescription\": \"Press Delete to remove tag.\",\n \"removeButtonLabel\": \"Remove\"\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 gridProps: 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 * A tag group is a focusable list of labels, categories, keywords, or other items, with support for keyboard navigation and removal.\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 gridProps: 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":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {useId as $aIvin$useId, chain as $aIvin$chain, filterDOMProps as $aIvin$filterDOMProps, mergeProps as $aIvin$mergeProps} from "@react-aria/utils";
|
|
1
|
+
import {useId as $aIvin$useId, chain as $aIvin$chain, useDescription as $aIvin$useDescription, filterDOMProps as $aIvin$filterDOMProps, mergeProps as $aIvin$mergeProps} from "@react-aria/utils";
|
|
2
2
|
import {useGridListItem as $aIvin$useGridListItem, useGridList as $aIvin$useGridList} from "@react-aria/gridlist";
|
|
3
|
+
import {useInteractionModality as $aIvin$useInteractionModality, useFocusWithin as $aIvin$useFocusWithin} from "@react-aria/interactions";
|
|
3
4
|
import {useLocalizedStringFormatter as $aIvin$useLocalizedStringFormatter, useLocale as $aIvin$useLocale} from "@react-aria/i18n";
|
|
4
5
|
import {useState as $aIvin$useState} from "react";
|
|
5
6
|
import {useField as $aIvin$useField} from "@react-aria/label";
|
|
6
|
-
import {useFocusWithin as $aIvin$useFocusWithin} from "@react-aria/interactions";
|
|
7
7
|
|
|
8
8
|
function $parcel$interopDefault(a) {
|
|
9
9
|
return a && a.__esModule ? a.default : a;
|
|
@@ -120,7 +120,8 @@ $3618d917e503a8d3$exports = {
|
|
|
120
120
|
|
|
121
121
|
var $9eb56bbbe8e31294$exports = {};
|
|
122
122
|
$9eb56bbbe8e31294$exports = {
|
|
123
|
-
"
|
|
123
|
+
"removeDescription": `Press Delete to remove tag.`,
|
|
124
|
+
"removeButtonLabel": `Remove`
|
|
124
125
|
};
|
|
125
126
|
|
|
126
127
|
|
|
@@ -326,10 +327,10 @@ $4d1b62e0e67c00a4$exports = {
|
|
|
326
327
|
|
|
327
328
|
|
|
328
329
|
|
|
330
|
+
|
|
329
331
|
function $fc6126c82a4601f1$export$3f568fff7dff2f03(props, state, ref) {
|
|
330
|
-
let {
|
|
332
|
+
let { allowsRemoving: allowsRemoving , item: item } = props;
|
|
331
333
|
let stringFormatter = (0, $aIvin$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($4d1b62e0e67c00a4$exports))));
|
|
332
|
-
let removeString = stringFormatter.format("remove");
|
|
333
334
|
let labelId = (0, $aIvin$useId)();
|
|
334
335
|
let buttonId = (0, $aIvin$useId)();
|
|
335
336
|
let { rowProps: rowProps , gridCellProps: gridCellProps } = (0, $aIvin$useGridListItem)({
|
|
@@ -344,11 +345,17 @@ function $fc6126c82a4601f1$export$3f568fff7dff2f03(props, state, ref) {
|
|
|
344
345
|
e.preventDefault();
|
|
345
346
|
}
|
|
346
347
|
};
|
|
347
|
-
|
|
348
|
+
let modality = (0, $aIvin$useInteractionModality)();
|
|
349
|
+
if (modality === "virtual" && typeof window !== "undefined" && "ontouchstart" in window) modality = "touch";
|
|
350
|
+
let description = allowsRemoving && (modality === "keyboard" || modality === "virtual") ? stringFormatter.format("removeDescription") : "";
|
|
351
|
+
let descProps = (0, $aIvin$useDescription)(description);
|
|
348
352
|
let domProps = (0, $aIvin$filterDOMProps)(props);
|
|
353
|
+
let isFocused = item.key === state.selectionManager.focusedKey;
|
|
349
354
|
return {
|
|
350
|
-
|
|
351
|
-
"aria-label":
|
|
355
|
+
removeButtonProps: {
|
|
356
|
+
"aria-label": stringFormatter.format("removeButtonLabel", {
|
|
357
|
+
label: item.textValue
|
|
358
|
+
}),
|
|
352
359
|
"aria-labelledby": `${buttonId} ${labelId}`,
|
|
353
360
|
id: buttonId,
|
|
354
361
|
onPress: ()=>allowsRemoving && onRemove ? onRemove(item.key) : null,
|
|
@@ -360,7 +367,8 @@ function $fc6126c82a4601f1$export$3f568fff7dff2f03(props, state, ref) {
|
|
|
360
367
|
rowProps: {
|
|
361
368
|
...rowProps,
|
|
362
369
|
tabIndex: isFocused || state.selectionManager.focusedKey == null ? 0 : -1,
|
|
363
|
-
onKeyDown: allowsRemoving ? onKeyDown : null
|
|
370
|
+
onKeyDown: allowsRemoving ? onKeyDown : null,
|
|
371
|
+
"aria-describedby": descProps["aria-describedby"]
|
|
364
372
|
},
|
|
365
373
|
gridCellProps: (0, $aIvin$mergeProps)(domProps, gridCellProps, {
|
|
366
374
|
"aria-errormessage": props["aria-errormessage"],
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;QACzB,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;QACnC,IAAI,OAAO,IAAI,EACb,OAAO;aAEP,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU;IAErC;IAEA,gBAAgB,GAAG,EAAE;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B;IAEA,gBAAgB,GAAG,EAAE;QACnB,OAAO,IAAI,CAAC,WAAW,C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iBAAU,AAAD,EAAE,UAAU,eAAe;YACjD,qBAAqB,KAAK,CAAC,oBAAoB;YAC/C,cAAc,KAAK,CAAC,aAAa;QACnC;IACF;AACF;;;AoC3FA;;;;;;;;;;CAUC,GAED;;;;;;;AAqCO,SAAS,0CAAe,KAA2B,EAAE,KAAuB,EAAE,GAA2B,EAAgB;IAC9H,IAAI,aAAC,UAAS,EAAC,GAAG,CAAA,GAAA,gBAAS,AAAD;IAC1B,IAAI,mBAAmB,MAAM,gBAAgB,IAAI,IAAI,CAAA,GAAA,yCAAmB,AAAD,EAAE,MAAM,UAAU,EAAE;IAC3F,IAAI,cAAC,WAAU,cAAE,WAAU,oBAAE,iBAAgB,qBAAE,kBAAiB,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;IAC7E,IAAI,aAAC,UAAS,EAAC,GAAG,CAAA,GAAA,kBAAW,AAAD,EAAE;QAAC,GAAG,KAAK;QAAE,GAAG,UAAU;0BAAE;IAAgB,GAAG,OAAO;IAElF,iEAAiE;IACjE,OAAO,UAAU,QAAQ;IAEzB,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,WAAW,CAAA,GAAA,iBAAU,AAAD,EAAE,WAAW,UAAU;YACzC,MAAM,MAAM,UAAU,CAAC,IAAI,GAAG,SAAS,IAAI;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 gridCellProps: DOMAttributes,\n /** Props for the tag row element. */\n rowProps: 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') {\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 excludeFromTabOrder: true\n },\n labelProps: {\n id: labelId\n },\n rowProps: {\n ...rowProps,\n tabIndex: (isFocused || state.selectionManager.focusedKey == null) ? 0 : -1,\n onKeyDown: allowsRemoving ? onKeyDown : null\n },\n gridCellProps: 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 gridProps: 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 * A tag group is a focusable list of labels, categories, keywords, or other items, with support for keyboard navigation and removal.\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 gridProps: 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"}
|
|
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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EAAgB;IAC9H,IAAI,aAAC,UAAS,EAAC,GAAG,CAAA,GAAA,gBAAS,AAAD;IAC1B,IAAI,mBAAmB,MAAM,gBAAgB,IAAI,IAAI,CAAA,GAAA,yCAAmB,AAAD,EAAE,MAAM,UAAU,EAAE;IAC3F,IAAI,cAAC,WAAU,cAAE,WAAU,oBAAE,iBAAgB,qBAAE,kBAAiB,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;IAC7E,IAAI,aAAC,UAAS,EAAC,GAAG,CAAA,GAAA,kBAAW,AAAD,EAAE;QAAC,GAAG,KAAK;QAAE,GAAG,UAAU;0BAAE;IAAgB,GAAG,OAAO;IAElF,iEAAiE;IACjE,OAAO,UAAU,QAAQ;IAEzB,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,WAAW,CAAA,GAAA,iBAAU,AAAD,EAAE,WAAW,UAAU;YACzC,MAAM,MAAM,UAAU,CAAC,IAAI,GAAG,SAAS,IAAI;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 {AriaTagProps, 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 {AriaLabelingProps, DOMAttributes, DOMProps, FocusableElement} from '@react-types/shared';\nimport {chain, filterDOMProps, mergeProps, useDescription, useId} from '@react-aria/utils';\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 {useInteractionModality} from '@react-aria/interactions';\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 gridCellProps: DOMAttributes,\n /** Props for the tag row element. */\n rowProps: DOMAttributes,\n /** Props for the tag remove button. */\n removeButtonProps: AriaButtonProps\n}\n\nexport interface AriaTagProps<T> extends TagProps<T>, DOMProps, AriaLabelingProps {}\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: AriaTagProps<T>, state: TagGroupState<T>, ref: RefObject<FocusableElement>): TagAria {\n let {\n allowsRemoving,\n item\n } = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages);\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') {\n onRemove(item.key);\n e.preventDefault();\n }\n };\n\n let modality: string = useInteractionModality();\n if (modality === 'virtual' && (typeof window !== 'undefined' && 'ontouchstart' in window)) {\n modality = 'touch';\n }\n let description = allowsRemoving && (modality === 'keyboard' || modality === 'virtual') ? stringFormatter.format('removeDescription') : '';\n let descProps = useDescription(description);\n\n let domProps = filterDOMProps(props);\n let isFocused = item.key === state.selectionManager.focusedKey;\n return {\n removeButtonProps: {\n 'aria-label': stringFormatter.format('removeButtonLabel', {label: item.textValue}),\n 'aria-labelledby': `${buttonId} ${labelId}`,\n id: buttonId,\n onPress: () => allowsRemoving && onRemove ? onRemove(item.key) : null,\n excludeFromTabOrder: true\n },\n labelProps: {\n id: labelId\n },\n rowProps: {\n ...rowProps,\n tabIndex: (isFocused || state.selectionManager.focusedKey == null) ? 0 : -1,\n onKeyDown: allowsRemoving ? onKeyDown : null,\n 'aria-describedby': descProps['aria-describedby']\n },\n gridCellProps: 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 \"removeDescription\": \"Press Delete to remove tag.\",\n \"removeButtonLabel\": \"Remove\"\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 gridProps: 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 * A tag group is a focusable list of labels, categories, keywords, or other items, with support for keyboard navigation and removal.\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 gridProps: 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,4 +1,4 @@
|
|
|
1
|
-
import { Collection, Direction, KeyboardDelegate,
|
|
1
|
+
import { Collection, Direction, KeyboardDelegate, AriaLabelingProps, DOMAttributes, DOMProps, FocusableElement, Validation } from "@react-types/shared";
|
|
2
2
|
import { Key, RefObject } from "react";
|
|
3
3
|
import { AriaButtonProps } from "@react-types/button";
|
|
4
4
|
import { TagGroupState } from "@react-stately/tag";
|
|
@@ -21,8 +21,10 @@ export interface TagAria {
|
|
|
21
21
|
gridCellProps: DOMAttributes;
|
|
22
22
|
/** Props for the tag row element. */
|
|
23
23
|
rowProps: DOMAttributes;
|
|
24
|
-
/** Props for the tag
|
|
25
|
-
|
|
24
|
+
/** Props for the tag remove button. */
|
|
25
|
+
removeButtonProps: AriaButtonProps;
|
|
26
|
+
}
|
|
27
|
+
export interface AriaTagProps<T> extends TagProps<T>, DOMProps, AriaLabelingProps {
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
30
|
* Provides the behavior and accessibility implementation for a tag component.
|
|
@@ -30,7 +32,7 @@ export interface TagAria {
|
|
|
30
32
|
* @param state - State for the tag group, as returned by `useTagGroupState`.
|
|
31
33
|
* @param ref - A ref to a DOM element for the tag.
|
|
32
34
|
*/
|
|
33
|
-
export function useTag<T>(props:
|
|
35
|
+
export function useTag<T>(props: AriaTagProps<T>, state: TagGroupState<T>, ref: RefObject<FocusableElement>): TagAria;
|
|
34
36
|
export interface TagGroupAria {
|
|
35
37
|
/** Props for the tag grouping element. */
|
|
36
38
|
gridProps: DOMAttributes;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;AAeA,iCAAiC,CAAC,CAAE,YAAW,gBAAgB;gBAIjD,UAAU,EAAE,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS;IAK3D,WAAW;IAIX,UAAU;IAIV,aAAa,CAAC,GAAG,EAAE,GAAG;IAItB,YAAY,CAAC,GAAG,EAAE,GAAG;IAIrB,WAAW,CAAC,GAAG,KAAA;IAgBf,WAAW,CAAC,GAAG,KAAA;IAef,eAAe,CAAC,GAAG,KAAA;IAInB,eAAe,CAAC,GAAG,KAAA;CAGpB;
|
|
1
|
+
{"mappings":";;;;;AAeA,iCAAiC,CAAC,CAAE,YAAW,gBAAgB;gBAIjD,UAAU,EAAE,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS;IAK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C,MAAM,kBAAkB,CAAC","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 {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 {AriaTagProps, TagAria} from './useTag';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/tag",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.2104+83677f944",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-aria/gridlist": "3.2.2-nightly.
|
|
26
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
|
27
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
28
|
-
"@react-aria/label": "3.0.0-nightly.
|
|
29
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
30
|
-
"@react-stately/list": "3.7.1-nightly.
|
|
31
|
-
"@react-stately/tag": "3.0.0-nightly.
|
|
32
|
-
"@react-types/button": "3.7.2-nightly.
|
|
33
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
34
|
-
"@react-types/tag": "3.0.0-nightly.
|
|
25
|
+
"@react-aria/gridlist": "3.2.2-nightly.3804+83677f944",
|
|
26
|
+
"@react-aria/i18n": "3.0.0-nightly.2104+83677f944",
|
|
27
|
+
"@react-aria/interactions": "3.0.0-nightly.2104+83677f944",
|
|
28
|
+
"@react-aria/label": "3.0.0-nightly.2104+83677f944",
|
|
29
|
+
"@react-aria/utils": "3.0.0-nightly.2104+83677f944",
|
|
30
|
+
"@react-stately/list": "3.7.1-nightly.3804+83677f944",
|
|
31
|
+
"@react-stately/tag": "3.0.0-nightly.3804+83677f944",
|
|
32
|
+
"@react-types/button": "3.7.2-nightly.3804+83677f944",
|
|
33
|
+
"@react-types/shared": "3.0.0-nightly.2104+83677f944",
|
|
34
|
+
"@react-types/tag": "3.0.0-nightly.2104+83677f944",
|
|
35
35
|
"@swc/helpers": "^0.4.14"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "83677f94489fdfa535fd511157f5292ad80b7b09"
|
|
44
44
|
}
|
package/src/index.ts
CHANGED
package/src/useTag.ts
CHANGED
|
@@ -11,14 +11,15 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {AriaButtonProps} from '@react-types/button';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import {AriaLabelingProps, DOMAttributes, DOMProps, FocusableElement} from '@react-types/shared';
|
|
15
|
+
import {chain, filterDOMProps, mergeProps, useDescription, useId} from '@react-aria/utils';
|
|
16
16
|
// @ts-ignore
|
|
17
17
|
import intlMessages from '../intl/*.json';
|
|
18
18
|
import {KeyboardEvent, RefObject} from 'react';
|
|
19
19
|
import type {TagGroupState} from '@react-stately/tag';
|
|
20
20
|
import {TagProps} from '@react-types/tag';
|
|
21
21
|
import {useGridListItem} from '@react-aria/gridlist';
|
|
22
|
+
import {useInteractionModality} from '@react-aria/interactions';
|
|
22
23
|
import {useLocalizedStringFormatter} from '@react-aria/i18n';
|
|
23
24
|
|
|
24
25
|
|
|
@@ -29,24 +30,24 @@ export interface TagAria {
|
|
|
29
30
|
gridCellProps: DOMAttributes,
|
|
30
31
|
/** Props for the tag row element. */
|
|
31
32
|
rowProps: DOMAttributes,
|
|
32
|
-
/** Props for the tag
|
|
33
|
-
|
|
33
|
+
/** Props for the tag remove button. */
|
|
34
|
+
removeButtonProps: AriaButtonProps
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
export interface AriaTagProps<T> extends TagProps<T>, DOMProps, AriaLabelingProps {}
|
|
38
|
+
|
|
36
39
|
/**
|
|
37
40
|
* Provides the behavior and accessibility implementation for a tag component.
|
|
38
41
|
* @param props - Props to be applied to the tag.
|
|
39
42
|
* @param state - State for the tag group, as returned by `useTagGroupState`.
|
|
40
43
|
* @param ref - A ref to a DOM element for the tag.
|
|
41
44
|
*/
|
|
42
|
-
export function useTag<T>(props:
|
|
45
|
+
export function useTag<T>(props: AriaTagProps<T>, state: TagGroupState<T>, ref: RefObject<FocusableElement>): TagAria {
|
|
43
46
|
let {
|
|
44
|
-
isFocused,
|
|
45
47
|
allowsRemoving,
|
|
46
48
|
item
|
|
47
49
|
} = props;
|
|
48
50
|
let stringFormatter = useLocalizedStringFormatter(intlMessages);
|
|
49
|
-
let removeString = stringFormatter.format('remove');
|
|
50
51
|
let labelId = useId();
|
|
51
52
|
let buttonId = useId();
|
|
52
53
|
|
|
@@ -66,11 +67,18 @@ export function useTag<T>(props: TagProps<T>, state: TagGroupState<T>, ref: RefO
|
|
|
66
67
|
}
|
|
67
68
|
};
|
|
68
69
|
|
|
69
|
-
|
|
70
|
+
let modality: string = useInteractionModality();
|
|
71
|
+
if (modality === 'virtual' && (typeof window !== 'undefined' && 'ontouchstart' in window)) {
|
|
72
|
+
modality = 'touch';
|
|
73
|
+
}
|
|
74
|
+
let description = allowsRemoving && (modality === 'keyboard' || modality === 'virtual') ? stringFormatter.format('removeDescription') : '';
|
|
75
|
+
let descProps = useDescription(description);
|
|
76
|
+
|
|
70
77
|
let domProps = filterDOMProps(props);
|
|
78
|
+
let isFocused = item.key === state.selectionManager.focusedKey;
|
|
71
79
|
return {
|
|
72
|
-
|
|
73
|
-
'aria-label':
|
|
80
|
+
removeButtonProps: {
|
|
81
|
+
'aria-label': stringFormatter.format('removeButtonLabel', {label: item.textValue}),
|
|
74
82
|
'aria-labelledby': `${buttonId} ${labelId}`,
|
|
75
83
|
id: buttonId,
|
|
76
84
|
onPress: () => allowsRemoving && onRemove ? onRemove(item.key) : null,
|
|
@@ -82,7 +90,8 @@ export function useTag<T>(props: TagProps<T>, state: TagGroupState<T>, ref: RefO
|
|
|
82
90
|
rowProps: {
|
|
83
91
|
...rowProps,
|
|
84
92
|
tabIndex: (isFocused || state.selectionManager.focusedKey == null) ? 0 : -1,
|
|
85
|
-
onKeyDown: allowsRemoving ? onKeyDown : null
|
|
93
|
+
onKeyDown: allowsRemoving ? onKeyDown : null,
|
|
94
|
+
'aria-describedby': descProps['aria-describedby']
|
|
86
95
|
},
|
|
87
96
|
gridCellProps: mergeProps(domProps, gridCellProps, {
|
|
88
97
|
'aria-errormessage': props['aria-errormessage'],
|