@react-aria/grid 3.8.9-nightly.4555 → 3.8.9-nightly.4560
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/GridKeyboardDelegate.main.js +252 -0
- package/dist/GridKeyboardDelegate.main.js.map +1 -0
- package/dist/GridKeyboardDelegate.mjs +247 -0
- package/dist/GridKeyboardDelegate.module.js +247 -0
- package/dist/GridKeyboardDelegate.module.js.map +1 -0
- package/dist/ar-AE.mjs +1 -1
- package/dist/bg-BG.mjs +1 -1
- package/dist/cs-CZ.mjs +1 -1
- package/dist/da-DK.mjs +1 -1
- package/dist/de-DE.mjs +1 -1
- package/dist/el-GR.mjs +1 -1
- package/dist/en-US.mjs +1 -1
- package/dist/es-ES.mjs +1 -1
- package/dist/et-EE.mjs +1 -1
- package/dist/fi-FI.mjs +1 -1
- package/dist/fr-FR.mjs +1 -1
- package/dist/he-IL.mjs +1 -1
- package/dist/hr-HR.mjs +1 -1
- package/dist/hu-HU.mjs +1 -1
- package/dist/import.mjs +8 -884
- package/dist/intlStrings.main.js +108 -0
- package/dist/intlStrings.main.js.map +1 -0
- package/dist/intlStrings.mjs +110 -0
- package/dist/intlStrings.module.js +110 -0
- package/dist/intlStrings.module.js.map +1 -0
- package/dist/it-IT.mjs +1 -1
- package/dist/ja-JP.mjs +1 -1
- package/dist/ko-KR.mjs +1 -1
- package/dist/lt-LT.mjs +1 -1
- package/dist/lv-LV.mjs +1 -1
- package/dist/main.js +16 -892
- package/dist/main.js.map +1 -1
- package/dist/module.js +8 -884
- package/dist/module.js.map +1 -1
- package/dist/nb-NO.mjs +1 -1
- package/dist/nl-NL.mjs +1 -1
- package/dist/pl-PL.mjs +1 -1
- package/dist/pt-BR.mjs +1 -1
- package/dist/pt-PT.mjs +1 -1
- package/dist/ro-RO.mjs +1 -1
- package/dist/ru-RU.mjs +1 -1
- package/dist/sk-SK.mjs +1 -1
- package/dist/sl-SI.mjs +1 -1
- package/dist/sr-SP.mjs +1 -1
- package/dist/sv-SE.mjs +1 -1
- package/dist/tr-TR.mjs +1 -1
- package/dist/uk-UA.mjs +1 -1
- package/dist/useGrid.main.js +132 -0
- package/dist/useGrid.main.js.map +1 -0
- package/dist/useGrid.mjs +127 -0
- package/dist/useGrid.module.js +127 -0
- package/dist/useGrid.module.js.map +1 -0
- package/dist/useGridCell.main.js +220 -0
- package/dist/useGridCell.main.js.map +1 -0
- package/dist/useGridCell.mjs +215 -0
- package/dist/useGridCell.module.js +215 -0
- package/dist/useGridCell.module.js.map +1 -0
- package/dist/useGridRow.main.js +53 -0
- package/dist/useGridRow.main.js.map +1 -0
- package/dist/useGridRow.mjs +48 -0
- package/dist/useGridRow.module.js +48 -0
- package/dist/useGridRow.module.js.map +1 -0
- package/dist/useGridRowGroup.main.js +26 -0
- package/dist/useGridRowGroup.main.js.map +1 -0
- package/dist/useGridRowGroup.mjs +21 -0
- package/dist/useGridRowGroup.module.js +21 -0
- package/dist/useGridRowGroup.module.js.map +1 -0
- package/dist/useGridSelectionAnnouncement.main.js +94 -0
- package/dist/useGridSelectionAnnouncement.main.js.map +1 -0
- package/dist/useGridSelectionAnnouncement.mjs +89 -0
- package/dist/useGridSelectionAnnouncement.module.js +89 -0
- package/dist/useGridSelectionAnnouncement.module.js.map +1 -0
- package/dist/useGridSelectionCheckbox.main.js +38 -0
- package/dist/useGridSelectionCheckbox.main.js.map +1 -0
- package/dist/useGridSelectionCheckbox.mjs +33 -0
- package/dist/useGridSelectionCheckbox.module.js +33 -0
- package/dist/useGridSelectionCheckbox.module.js.map +1 -0
- package/dist/useHighlightSelectionDescription.main.js +55 -0
- package/dist/useHighlightSelectionDescription.main.js.map +1 -0
- package/dist/useHighlightSelectionDescription.mjs +50 -0
- package/dist/useHighlightSelectionDescription.module.js +50 -0
- package/dist/useHighlightSelectionDescription.module.js.map +1 -0
- package/dist/utils.main.js +20 -0
- package/dist/utils.main.js.map +1 -0
- package/dist/utils.mjs +15 -0
- package/dist/utils.module.js +15 -0
- package/dist/utils.module.js.map +1 -0
- package/dist/zh-CN.mjs +1 -1
- package/dist/zh-TW.mjs +1 -1
- package/package.json +15 -15
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import $4stjr$intlStringsmodulejs from "./intlStrings.mjs";
|
|
2
|
+
import {announce as $4stjr$announce} from "@react-aria/live-announcer";
|
|
3
|
+
import {useLocalizedStringFormatter as $4stjr$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
4
|
+
import {useRef as $4stjr$useRef} from "react";
|
|
5
|
+
import {useUpdateEffect as $4stjr$useUpdateEffect} from "@react-aria/utils";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
function $parcel$interopDefault(a) {
|
|
9
|
+
return a && a.__esModule ? a.default : a;
|
|
10
|
+
}
|
|
11
|
+
/*
|
|
12
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
13
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
15
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
18
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
19
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
20
|
+
* governing permissions and limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
function $92599c3fd427b763$export$137e594ef3218a10(props, state) {
|
|
27
|
+
let { getRowText: getRowText = (key)=>{
|
|
28
|
+
var _state_collection_getTextValue, _state_collection, _state_collection_getItem;
|
|
29
|
+
var _state_collection_getTextValue1;
|
|
30
|
+
return (_state_collection_getTextValue1 = (_state_collection_getTextValue = (_state_collection = state.collection).getTextValue) === null || _state_collection_getTextValue === void 0 ? void 0 : _state_collection_getTextValue.call(_state_collection, key)) !== null && _state_collection_getTextValue1 !== void 0 ? _state_collection_getTextValue1 : (_state_collection_getItem = state.collection.getItem(key)) === null || _state_collection_getItem === void 0 ? void 0 : _state_collection_getItem.textValue;
|
|
31
|
+
} } = props;
|
|
32
|
+
let stringFormatter = (0, $4stjr$useLocalizedStringFormatter)((0, ($parcel$interopDefault($4stjr$intlStringsmodulejs))), "@react-aria/grid");
|
|
33
|
+
// Many screen readers do not announce when items in a grid are selected/deselected.
|
|
34
|
+
// We do this using an ARIA live region.
|
|
35
|
+
let selection = state.selectionManager.rawSelection;
|
|
36
|
+
let lastSelection = (0, $4stjr$useRef)(selection);
|
|
37
|
+
(0, $4stjr$useUpdateEffect)(()=>{
|
|
38
|
+
var _lastSelection_current;
|
|
39
|
+
if (!state.selectionManager.isFocused) {
|
|
40
|
+
lastSelection.current = selection;
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
let addedKeys = $92599c3fd427b763$var$diffSelection(selection, lastSelection.current);
|
|
44
|
+
let removedKeys = $92599c3fd427b763$var$diffSelection(lastSelection.current, selection);
|
|
45
|
+
// If adding or removing a single row from the selection, announce the name of that item.
|
|
46
|
+
let isReplace = state.selectionManager.selectionBehavior === "replace";
|
|
47
|
+
let messages = [];
|
|
48
|
+
if (state.selectionManager.selectedKeys.size === 1 && isReplace) {
|
|
49
|
+
if (state.collection.getItem(state.selectionManager.selectedKeys.keys().next().value)) {
|
|
50
|
+
let currentSelectionText = getRowText(state.selectionManager.selectedKeys.keys().next().value);
|
|
51
|
+
if (currentSelectionText) messages.push(stringFormatter.format("selectedItem", {
|
|
52
|
+
item: currentSelectionText
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
} else if (addedKeys.size === 1 && removedKeys.size === 0) {
|
|
56
|
+
let addedText = getRowText(addedKeys.keys().next().value);
|
|
57
|
+
if (addedText) messages.push(stringFormatter.format("selectedItem", {
|
|
58
|
+
item: addedText
|
|
59
|
+
}));
|
|
60
|
+
} else if (removedKeys.size === 1 && addedKeys.size === 0) {
|
|
61
|
+
if (state.collection.getItem(removedKeys.keys().next().value)) {
|
|
62
|
+
let removedText = getRowText(removedKeys.keys().next().value);
|
|
63
|
+
if (removedText) messages.push(stringFormatter.format("deselectedItem", {
|
|
64
|
+
item: removedText
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Announce how many items are selected, except when selecting the first item.
|
|
69
|
+
if (state.selectionManager.selectionMode === "multiple") {
|
|
70
|
+
if (messages.length === 0 || selection === "all" || selection.size > 1 || lastSelection.current === "all" || ((_lastSelection_current = lastSelection.current) === null || _lastSelection_current === void 0 ? void 0 : _lastSelection_current.size) > 1) messages.push(selection === "all" ? stringFormatter.format("selectedAll") : stringFormatter.format("selectedCount", {
|
|
71
|
+
count: selection.size
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
if (messages.length > 0) (0, $4stjr$announce)(messages.join(" "));
|
|
75
|
+
lastSelection.current = selection;
|
|
76
|
+
}, [
|
|
77
|
+
selection
|
|
78
|
+
]);
|
|
79
|
+
}
|
|
80
|
+
function $92599c3fd427b763$var$diffSelection(a, b) {
|
|
81
|
+
let res = new Set();
|
|
82
|
+
if (a === "all" || b === "all") return res;
|
|
83
|
+
for (let key of a.keys())if (!b.has(key)) res.add(key);
|
|
84
|
+
return res;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
export {$92599c3fd427b763$export$137e594ef3218a10 as useGridSelectionAnnouncement};
|
|
89
|
+
//# sourceMappingURL=useGridSelectionAnnouncement.mjs.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import $4stjr$intlStringsmodulejs from "./intlStrings.module.js";
|
|
2
|
+
import {announce as $4stjr$announce} from "@react-aria/live-announcer";
|
|
3
|
+
import {useLocalizedStringFormatter as $4stjr$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
4
|
+
import {useRef as $4stjr$useRef} from "react";
|
|
5
|
+
import {useUpdateEffect as $4stjr$useUpdateEffect} from "@react-aria/utils";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
function $parcel$interopDefault(a) {
|
|
9
|
+
return a && a.__esModule ? a.default : a;
|
|
10
|
+
}
|
|
11
|
+
/*
|
|
12
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
13
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
15
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
18
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
19
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
20
|
+
* governing permissions and limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
function $92599c3fd427b763$export$137e594ef3218a10(props, state) {
|
|
27
|
+
let { getRowText: getRowText = (key)=>{
|
|
28
|
+
var _state_collection_getTextValue, _state_collection, _state_collection_getItem;
|
|
29
|
+
var _state_collection_getTextValue1;
|
|
30
|
+
return (_state_collection_getTextValue1 = (_state_collection_getTextValue = (_state_collection = state.collection).getTextValue) === null || _state_collection_getTextValue === void 0 ? void 0 : _state_collection_getTextValue.call(_state_collection, key)) !== null && _state_collection_getTextValue1 !== void 0 ? _state_collection_getTextValue1 : (_state_collection_getItem = state.collection.getItem(key)) === null || _state_collection_getItem === void 0 ? void 0 : _state_collection_getItem.textValue;
|
|
31
|
+
} } = props;
|
|
32
|
+
let stringFormatter = (0, $4stjr$useLocalizedStringFormatter)((0, ($parcel$interopDefault($4stjr$intlStringsmodulejs))), "@react-aria/grid");
|
|
33
|
+
// Many screen readers do not announce when items in a grid are selected/deselected.
|
|
34
|
+
// We do this using an ARIA live region.
|
|
35
|
+
let selection = state.selectionManager.rawSelection;
|
|
36
|
+
let lastSelection = (0, $4stjr$useRef)(selection);
|
|
37
|
+
(0, $4stjr$useUpdateEffect)(()=>{
|
|
38
|
+
var _lastSelection_current;
|
|
39
|
+
if (!state.selectionManager.isFocused) {
|
|
40
|
+
lastSelection.current = selection;
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
let addedKeys = $92599c3fd427b763$var$diffSelection(selection, lastSelection.current);
|
|
44
|
+
let removedKeys = $92599c3fd427b763$var$diffSelection(lastSelection.current, selection);
|
|
45
|
+
// If adding or removing a single row from the selection, announce the name of that item.
|
|
46
|
+
let isReplace = state.selectionManager.selectionBehavior === "replace";
|
|
47
|
+
let messages = [];
|
|
48
|
+
if (state.selectionManager.selectedKeys.size === 1 && isReplace) {
|
|
49
|
+
if (state.collection.getItem(state.selectionManager.selectedKeys.keys().next().value)) {
|
|
50
|
+
let currentSelectionText = getRowText(state.selectionManager.selectedKeys.keys().next().value);
|
|
51
|
+
if (currentSelectionText) messages.push(stringFormatter.format("selectedItem", {
|
|
52
|
+
item: currentSelectionText
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
} else if (addedKeys.size === 1 && removedKeys.size === 0) {
|
|
56
|
+
let addedText = getRowText(addedKeys.keys().next().value);
|
|
57
|
+
if (addedText) messages.push(stringFormatter.format("selectedItem", {
|
|
58
|
+
item: addedText
|
|
59
|
+
}));
|
|
60
|
+
} else if (removedKeys.size === 1 && addedKeys.size === 0) {
|
|
61
|
+
if (state.collection.getItem(removedKeys.keys().next().value)) {
|
|
62
|
+
let removedText = getRowText(removedKeys.keys().next().value);
|
|
63
|
+
if (removedText) messages.push(stringFormatter.format("deselectedItem", {
|
|
64
|
+
item: removedText
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Announce how many items are selected, except when selecting the first item.
|
|
69
|
+
if (state.selectionManager.selectionMode === "multiple") {
|
|
70
|
+
if (messages.length === 0 || selection === "all" || selection.size > 1 || lastSelection.current === "all" || ((_lastSelection_current = lastSelection.current) === null || _lastSelection_current === void 0 ? void 0 : _lastSelection_current.size) > 1) messages.push(selection === "all" ? stringFormatter.format("selectedAll") : stringFormatter.format("selectedCount", {
|
|
71
|
+
count: selection.size
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
if (messages.length > 0) (0, $4stjr$announce)(messages.join(" "));
|
|
75
|
+
lastSelection.current = selection;
|
|
76
|
+
}, [
|
|
77
|
+
selection
|
|
78
|
+
]);
|
|
79
|
+
}
|
|
80
|
+
function $92599c3fd427b763$var$diffSelection(a, b) {
|
|
81
|
+
let res = new Set();
|
|
82
|
+
if (a === "all" || b === "all") return res;
|
|
83
|
+
for (let key of a.keys())if (!b.has(key)) res.add(key);
|
|
84
|
+
return res;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
export {$92599c3fd427b763$export$137e594ef3218a10 as useGridSelectionAnnouncement};
|
|
89
|
+
//# sourceMappingURL=useGridSelectionAnnouncement.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA4BM,SAAS,0CAAgC,KAAqC,EAAE,KAA4B;IACjH,IAAI,cACF,aAAa,CAAC;YAAQ,gCAAA,mBAAwC;YAAxC;eAAA,CAAA,mCAAA,iCAAA,CAAA,oBAAA,MAAM,UAAU,EAAC,YAAY,cAA7B,qDAAA,oCAAA,mBAAgC,kBAAhC,6CAAA,mCAAwC,4BAAA,MAAM,UAAU,CAAC,OAAO,CAAC,kBAAzB,gDAAA,0BAA+B,SAAS;IAAD,GACtG,GAAG;IACJ,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAEhE,oFAAoF;IACpF,wCAAwC;IACxC,IAAI,YAAY,MAAM,gBAAgB,CAAC,YAAY;IACnD,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAE;IAC3B,CAAA,GAAA,sBAAc,EAAE;YAqCiG;QApC/G,IAAI,CAAC,MAAM,gBAAgB,CAAC,SAAS,EAAE;YACrC,cAAc,OAAO,GAAG;YAExB;QACF;QAEA,IAAI,YAAY,oCAAc,WAAW,cAAc,OAAO;QAC9D,IAAI,cAAc,oCAAc,cAAc,OAAO,EAAE;QAEvD,yFAAyF;QACzF,IAAI,YAAY,MAAM,gBAAgB,CAAC,iBAAiB,KAAK;QAC7D,IAAI,WAAW,EAAE;QAEjB,IAAK,MAAM,gBAAgB,CAAC,YAAY,CAAC,IAAI,KAAK,KAAK,WACrD;YAAA,IAAI,MAAM,UAAU,CAAC,OAAO,CAAC,MAAM,gBAAgB,CAAC,YAAY,CAAC,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG;gBACrF,IAAI,uBAAuB,WAAW,MAAM,gBAAgB,CAAC,YAAY,CAAC,IAAI,GAAG,IAAI,GAAG,KAAK;gBAC7F,IAAI,sBACF,SAAS,IAAI,CAAC,gBAAgB,MAAM,CAAC,gBAAgB;oBAAC,MAAM;gBAAoB;YAEpF;QAAA,OACK,IAAI,UAAU,IAAI,KAAK,KAAK,YAAY,IAAI,KAAK,GAAG;YACzD,IAAI,YAAY,WAAW,UAAU,IAAI,GAAG,IAAI,GAAG,KAAK;YACxD,IAAI,WACF,SAAS,IAAI,CAAC,gBAAgB,MAAM,CAAC,gBAAgB;gBAAC,MAAM;YAAS;QAEzE,OAAO,IAAI,YAAY,IAAI,KAAK,KAAK,UAAU,IAAI,KAAK,GACtD;YAAA,IAAI,MAAM,UAAU,CAAC,OAAO,CAAC,YAAY,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG;gBAC7D,IAAI,cAAc,WAAW,YAAY,IAAI,GAAG,IAAI,GAAG,KAAK;gBAC5D,IAAI,aACF,SAAS,IAAI,CAAC,gBAAgB,MAAM,CAAC,kBAAkB;oBAAC,MAAM;gBAAW;YAE7E;QAAA;QAGF,8EAA8E;QAC9E,IAAI,MAAM,gBAAgB,CAAC,aAAa,KAAK,YAC3C;YAAA,IAAI,SAAS,MAAM,KAAK,KAAK,cAAc,SAAS,UAAU,IAAI,GAAG,KAAK,cAAc,OAAO,KAAK,SAAS,EAAA,yBAAA,cAAc,OAAO,cAArB,6CAAA,uBAAuB,IAAI,IAAG,GACzI,SAAS,IAAI,CAAC,cAAc,QACxB,gBAAgB,MAAM,CAAC,iBACvB,gBAAgB,MAAM,CAAC,iBAAiB;gBAAC,OAAO,UAAU,IAAI;YAAA;QAEpE;QAGF,IAAI,SAAS,MAAM,GAAG,GACpB,CAAA,GAAA,eAAO,EAAE,SAAS,IAAI,CAAC;QAGzB,cAAc,OAAO,GAAG;IAC1B,GAAG;QAAC;KAAU;AAChB;AAEA,SAAS,oCAAc,CAAY,EAAE,CAAY;IAC/C,IAAI,MAAM,IAAI;IACd,IAAI,MAAM,SAAS,MAAM,OACvB,OAAO;IAGT,KAAK,IAAI,OAAO,EAAE,IAAI,GACpB,IAAI,CAAC,EAAE,GAAG,CAAC,MACT,IAAI,GAAG,CAAC;IAIZ,OAAO;AACT","sources":["packages/@react-aria/grid/src/useGridSelectionAnnouncement.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {announce} from '@react-aria/live-announcer';\nimport {Collection, Key, Node, Selection} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {SelectionManager} from '@react-stately/selection';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useRef} from 'react';\nimport {useUpdateEffect} from '@react-aria/utils';\n\nexport interface GridSelectionAnnouncementProps {\n /**\n * A function that returns the text that should be announced by assistive technology when a row is added or removed from selection.\n * @default (key) => state.collection.getItem(key)?.textValue\n */\n getRowText?: (key: Key) => string\n}\n\ninterface GridSelectionState<T> {\n /** A collection of items in the grid. */\n collection: Collection<Node<T>>,\n /** A set of items that are disabled. */\n disabledKeys: Set<Key>,\n /** A selection manager to read and update multiple selection state. */\n selectionManager: SelectionManager\n}\n\nexport function useGridSelectionAnnouncement<T>(props: GridSelectionAnnouncementProps, state: GridSelectionState<T>) {\n let {\n getRowText = (key) => state.collection.getTextValue?.(key) ?? state.collection.getItem(key)?.textValue\n } = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/grid');\n\n // Many screen readers do not announce when items in a grid are selected/deselected.\n // We do this using an ARIA live region.\n let selection = state.selectionManager.rawSelection;\n let lastSelection = useRef(selection);\n useUpdateEffect(() => {\n if (!state.selectionManager.isFocused) {\n lastSelection.current = selection;\n\n return;\n }\n\n let addedKeys = diffSelection(selection, lastSelection.current);\n let removedKeys = diffSelection(lastSelection.current, selection);\n\n // If adding or removing a single row from the selection, announce the name of that item.\n let isReplace = state.selectionManager.selectionBehavior === 'replace';\n let messages = [];\n\n if ((state.selectionManager.selectedKeys.size === 1 && isReplace)) {\n if (state.collection.getItem(state.selectionManager.selectedKeys.keys().next().value)) {\n let currentSelectionText = getRowText(state.selectionManager.selectedKeys.keys().next().value);\n if (currentSelectionText) {\n messages.push(stringFormatter.format('selectedItem', {item: currentSelectionText}));\n }\n }\n } else if (addedKeys.size === 1 && removedKeys.size === 0) {\n let addedText = getRowText(addedKeys.keys().next().value);\n if (addedText) {\n messages.push(stringFormatter.format('selectedItem', {item: addedText}));\n }\n } else if (removedKeys.size === 1 && addedKeys.size === 0) {\n if (state.collection.getItem(removedKeys.keys().next().value)) {\n let removedText = getRowText(removedKeys.keys().next().value);\n if (removedText) {\n messages.push(stringFormatter.format('deselectedItem', {item: removedText}));\n }\n }\n }\n\n // Announce how many items are selected, except when selecting the first item.\n if (state.selectionManager.selectionMode === 'multiple') {\n if (messages.length === 0 || selection === 'all' || selection.size > 1 || lastSelection.current === 'all' || lastSelection.current?.size > 1) {\n messages.push(selection === 'all'\n ? stringFormatter.format('selectedAll')\n : stringFormatter.format('selectedCount', {count: selection.size})\n );\n }\n }\n\n if (messages.length > 0) {\n announce(messages.join(' '));\n }\n\n lastSelection.current = selection;\n }, [selection]);\n}\n\nfunction diffSelection(a: Selection, b: Selection): Set<Key> {\n let res = new Set<Key>();\n if (a === 'all' || b === 'all') {\n return res;\n }\n\n for (let key of a.keys()) {\n if (!b.has(key)) {\n res.add(key);\n }\n }\n\n return res;\n}\n"],"names":[],"version":3,"file":"useGridSelectionAnnouncement.module.js.map"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var $085250522aa37816$exports = require("./intlStrings.main.js");
|
|
2
|
+
var $kbAeD$reactariautils = require("@react-aria/utils");
|
|
3
|
+
var $kbAeD$reactariai18n = require("@react-aria/i18n");
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function $parcel$interopDefault(a) {
|
|
7
|
+
return a && a.__esModule ? a.default : a;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function $parcel$export(e, n, v, s) {
|
|
11
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
$parcel$export(module.exports, "useGridSelectionCheckbox", () => $d8385f73d3701365$export$70e2eed1a92976ad);
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
function $d8385f73d3701365$export$70e2eed1a92976ad(props, state) {
|
|
19
|
+
let { key: key } = props;
|
|
20
|
+
let manager = state.selectionManager;
|
|
21
|
+
let checkboxId = (0, $kbAeD$reactariautils.useId)();
|
|
22
|
+
let isDisabled = !state.selectionManager.canSelectItem(key);
|
|
23
|
+
let isSelected = state.selectionManager.isSelected(key);
|
|
24
|
+
let onChange = ()=>manager.select(key);
|
|
25
|
+
const stringFormatter = (0, $kbAeD$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($085250522aa37816$exports))), "@react-aria/grid");
|
|
26
|
+
return {
|
|
27
|
+
checkboxProps: {
|
|
28
|
+
id: checkboxId,
|
|
29
|
+
"aria-label": stringFormatter.format("select"),
|
|
30
|
+
isSelected: isSelected,
|
|
31
|
+
isDisabled: isDisabled,
|
|
32
|
+
onChange: onChange
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=useGridSelectionCheckbox.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;AAyBO,SAAS,0CAAyD,KAAqC,EAAE,KAAsB;IACpI,IAAI,OAAC,GAAG,EAAC,GAAG;IAEZ,IAAI,UAAU,MAAM,gBAAgB;IACpC,IAAI,aAAa,CAAA,GAAA,2BAAI;IACrB,IAAI,aAAa,CAAC,MAAM,gBAAgB,CAAC,aAAa,CAAC;IACvD,IAAI,aAAa,MAAM,gBAAgB,CAAC,UAAU,CAAC;IAEnD,IAAI,WAAW,IAAM,QAAQ,MAAM,CAAC;IAEpC,MAAM,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAElE,OAAO;QACL,eAAe;YACb,IAAI;YACJ,cAAc,gBAAgB,MAAM,CAAC;wBACrC;wBACA;sBACA;QACF;IACF;AACF","sources":["packages/@react-aria/grid/src/useGridSelectionCheckbox.ts"],"sourcesContent":["import {AriaCheckboxProps} from '@react-types/checkbox';\nimport {GridCollection} from '@react-types/grid';\nimport {GridState} from '@react-stately/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Key} from '@react-types/shared';\nimport {useId} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaGridSelectionCheckboxProps {\n /** A unique key for the checkbox. */\n key: Key\n}\n\nexport interface GridSelectionCheckboxAria {\n /** Props for the row selection checkbox element. */\n checkboxProps: AriaCheckboxProps\n}\n\n\n/**\n * Provides the behavior and accessibility implementation for a selection checkbox in a grid.\n * @param props - Props for the selection checkbox.\n * @param state - State of the grid, as returned by `useGridState`.\n */\nexport function useGridSelectionCheckbox<T, C extends GridCollection<T>>(props: AriaGridSelectionCheckboxProps, state: GridState<T, C>): GridSelectionCheckboxAria {\n let {key} = props;\n\n let manager = state.selectionManager;\n let checkboxId = useId();\n let isDisabled = !state.selectionManager.canSelectItem(key);\n let isSelected = state.selectionManager.isSelected(key);\n\n let onChange = () => manager.select(key);\n\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/grid');\n\n return {\n checkboxProps: {\n id: checkboxId,\n 'aria-label': stringFormatter.format('select'),\n isSelected,\n isDisabled,\n onChange\n }\n };\n}\n"],"names":[],"version":3,"file":"useGridSelectionCheckbox.main.js.map"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import $fkdHx$intlStringsmodulejs from "./intlStrings.mjs";
|
|
2
|
+
import {useId as $fkdHx$useId} from "@react-aria/utils";
|
|
3
|
+
import {useLocalizedStringFormatter as $fkdHx$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function $parcel$interopDefault(a) {
|
|
7
|
+
return a && a.__esModule ? a.default : a;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
function $7cb39d07f245a780$export$70e2eed1a92976ad(props, state) {
|
|
13
|
+
let { key: key } = props;
|
|
14
|
+
let manager = state.selectionManager;
|
|
15
|
+
let checkboxId = (0, $fkdHx$useId)();
|
|
16
|
+
let isDisabled = !state.selectionManager.canSelectItem(key);
|
|
17
|
+
let isSelected = state.selectionManager.isSelected(key);
|
|
18
|
+
let onChange = ()=>manager.select(key);
|
|
19
|
+
const stringFormatter = (0, $fkdHx$useLocalizedStringFormatter)((0, ($parcel$interopDefault($fkdHx$intlStringsmodulejs))), "@react-aria/grid");
|
|
20
|
+
return {
|
|
21
|
+
checkboxProps: {
|
|
22
|
+
id: checkboxId,
|
|
23
|
+
"aria-label": stringFormatter.format("select"),
|
|
24
|
+
isSelected: isSelected,
|
|
25
|
+
isDisabled: isDisabled,
|
|
26
|
+
onChange: onChange
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export {$7cb39d07f245a780$export$70e2eed1a92976ad as useGridSelectionCheckbox};
|
|
33
|
+
//# sourceMappingURL=useGridSelectionCheckbox.mjs.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import $fkdHx$intlStringsmodulejs from "./intlStrings.module.js";
|
|
2
|
+
import {useId as $fkdHx$useId} from "@react-aria/utils";
|
|
3
|
+
import {useLocalizedStringFormatter as $fkdHx$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function $parcel$interopDefault(a) {
|
|
7
|
+
return a && a.__esModule ? a.default : a;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
function $7cb39d07f245a780$export$70e2eed1a92976ad(props, state) {
|
|
13
|
+
let { key: key } = props;
|
|
14
|
+
let manager = state.selectionManager;
|
|
15
|
+
let checkboxId = (0, $fkdHx$useId)();
|
|
16
|
+
let isDisabled = !state.selectionManager.canSelectItem(key);
|
|
17
|
+
let isSelected = state.selectionManager.isSelected(key);
|
|
18
|
+
let onChange = ()=>manager.select(key);
|
|
19
|
+
const stringFormatter = (0, $fkdHx$useLocalizedStringFormatter)((0, ($parcel$interopDefault($fkdHx$intlStringsmodulejs))), "@react-aria/grid");
|
|
20
|
+
return {
|
|
21
|
+
checkboxProps: {
|
|
22
|
+
id: checkboxId,
|
|
23
|
+
"aria-label": stringFormatter.format("select"),
|
|
24
|
+
isSelected: isSelected,
|
|
25
|
+
isDisabled: isDisabled,
|
|
26
|
+
onChange: onChange
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export {$7cb39d07f245a780$export$70e2eed1a92976ad as useGridSelectionCheckbox};
|
|
33
|
+
//# sourceMappingURL=useGridSelectionCheckbox.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;AAyBO,SAAS,0CAAyD,KAAqC,EAAE,KAAsB;IACpI,IAAI,OAAC,GAAG,EAAC,GAAG;IAEZ,IAAI,UAAU,MAAM,gBAAgB;IACpC,IAAI,aAAa,CAAA,GAAA,YAAI;IACrB,IAAI,aAAa,CAAC,MAAM,gBAAgB,CAAC,aAAa,CAAC;IACvD,IAAI,aAAa,MAAM,gBAAgB,CAAC,UAAU,CAAC;IAEnD,IAAI,WAAW,IAAM,QAAQ,MAAM,CAAC;IAEpC,MAAM,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAElE,OAAO;QACL,eAAe;YACb,IAAI;YACJ,cAAc,gBAAgB,MAAM,CAAC;wBACrC;wBACA;sBACA;QACF;IACF;AACF","sources":["packages/@react-aria/grid/src/useGridSelectionCheckbox.ts"],"sourcesContent":["import {AriaCheckboxProps} from '@react-types/checkbox';\nimport {GridCollection} from '@react-types/grid';\nimport {GridState} from '@react-stately/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Key} from '@react-types/shared';\nimport {useId} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaGridSelectionCheckboxProps {\n /** A unique key for the checkbox. */\n key: Key\n}\n\nexport interface GridSelectionCheckboxAria {\n /** Props for the row selection checkbox element. */\n checkboxProps: AriaCheckboxProps\n}\n\n\n/**\n * Provides the behavior and accessibility implementation for a selection checkbox in a grid.\n * @param props - Props for the selection checkbox.\n * @param state - State of the grid, as returned by `useGridState`.\n */\nexport function useGridSelectionCheckbox<T, C extends GridCollection<T>>(props: AriaGridSelectionCheckboxProps, state: GridState<T, C>): GridSelectionCheckboxAria {\n let {key} = props;\n\n let manager = state.selectionManager;\n let checkboxId = useId();\n let isDisabled = !state.selectionManager.canSelectItem(key);\n let isSelected = state.selectionManager.isSelected(key);\n\n let onChange = () => manager.select(key);\n\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/grid');\n\n return {\n checkboxProps: {\n id: checkboxId,\n 'aria-label': stringFormatter.format('select'),\n isSelected,\n isDisabled,\n onChange\n }\n };\n}\n"],"names":[],"version":3,"file":"useGridSelectionCheckbox.module.js.map"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var $085250522aa37816$exports = require("./intlStrings.main.js");
|
|
2
|
+
var $98baH$reactariautils = require("@react-aria/utils");
|
|
3
|
+
var $98baH$reactariainteractions = require("@react-aria/interactions");
|
|
4
|
+
var $98baH$reactariai18n = require("@react-aria/i18n");
|
|
5
|
+
var $98baH$react = require("react");
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
function $parcel$interopDefault(a) {
|
|
9
|
+
return a && a.__esModule ? a.default : a;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function $parcel$export(e, n, v, s) {
|
|
13
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
$parcel$export(module.exports, "useHighlightSelectionDescription", () => $340f2fcd0ef9ce8d$export$be42ebdab07ae4c2);
|
|
17
|
+
/*
|
|
18
|
+
* Copyright 2021 Adobe. All rights reserved.
|
|
19
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
20
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
21
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
+
*
|
|
23
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
24
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
25
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
26
|
+
* governing permissions and limitations under the License.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
function $340f2fcd0ef9ce8d$export$be42ebdab07ae4c2(props) {
|
|
33
|
+
let stringFormatter = (0, $98baH$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($085250522aa37816$exports))), "@react-aria/grid");
|
|
34
|
+
let modality = (0, $98baH$reactariainteractions.useInteractionModality)();
|
|
35
|
+
// null is the default if the user hasn't interacted with the table at all yet or the rest of the page
|
|
36
|
+
let shouldLongPress = (modality === "pointer" || modality === "virtual" || modality == null) && typeof window !== "undefined" && "ontouchstart" in window;
|
|
37
|
+
let interactionDescription = (0, $98baH$react.useMemo)(()=>{
|
|
38
|
+
let selectionMode = props.selectionManager.selectionMode;
|
|
39
|
+
let selectionBehavior = props.selectionManager.selectionBehavior;
|
|
40
|
+
let message = undefined;
|
|
41
|
+
if (shouldLongPress) message = stringFormatter.format("longPressToSelect");
|
|
42
|
+
return selectionBehavior === "replace" && selectionMode !== "none" && props.hasItemActions ? message : undefined;
|
|
43
|
+
}, [
|
|
44
|
+
props.selectionManager.selectionMode,
|
|
45
|
+
props.selectionManager.selectionBehavior,
|
|
46
|
+
props.hasItemActions,
|
|
47
|
+
stringFormatter,
|
|
48
|
+
shouldLongPress
|
|
49
|
+
]);
|
|
50
|
+
let descriptionProps = (0, $98baH$reactariautils.useDescription)(interactionDescription);
|
|
51
|
+
return descriptionProps;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=useHighlightSelectionDescription.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAoBM,SAAS,0CAAiC,KAAyC;IACxF,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,IAAI,WAAW,CAAA,GAAA,mDAAqB;IACpC,sGAAsG;IACtG,IAAI,kBAAkB,AAAC,CAAA,aAAa,aAAa,aAAa,aAAa,YAAY,IAAG,KACrF,OAAO,WAAW,eAAe,kBAAkB;IAExD,IAAI,yBAAyB,CAAA,GAAA,oBAAM,EAAE;QACnC,IAAI,gBAAgB,MAAM,gBAAgB,CAAC,aAAa;QACxD,IAAI,oBAAoB,MAAM,gBAAgB,CAAC,iBAAiB;QAEhE,IAAI,UAAU;QACd,IAAI,iBACF,UAAU,gBAAgB,MAAM,CAAC;QAGnC,OAAO,sBAAsB,aAAa,kBAAkB,UAAU,MAAM,cAAc,GAAG,UAAU;IACzG,GAAG;QAAC,MAAM,gBAAgB,CAAC,aAAa;QAAE,MAAM,gBAAgB,CAAC,iBAAiB;QAAE,MAAM,cAAc;QAAE;QAAiB;KAAgB;IAE3I,IAAI,mBAAmB,CAAA,GAAA,oCAAa,EAAE;IACtC,OAAO;AACT","sources":["packages/@react-aria/grid/src/useHighlightSelectionDescription.ts"],"sourcesContent":["/*\n * Copyright 2021 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} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {MultipleSelectionManager} from '@react-stately/selection';\nimport {useDescription} from '@react-aria/utils';\nimport {useInteractionModality} from '@react-aria/interactions';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useMemo} from 'react';\n\nexport interface HighlightSelectionDescriptionProps {\n selectionManager: MultipleSelectionManager,\n hasItemActions?: boolean\n}\n\n/**\n * Computes the description for a grid selectable collection.\n * @param props\n */\nexport function useHighlightSelectionDescription(props: HighlightSelectionDescriptionProps): AriaLabelingProps {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/grid');\n let modality = useInteractionModality();\n // null is the default if the user hasn't interacted with the table at all yet or the rest of the page\n let shouldLongPress = (modality === 'pointer' || modality === 'virtual' || modality == null)\n && typeof window !== 'undefined' && 'ontouchstart' in window;\n\n let interactionDescription = useMemo(() => {\n let selectionMode = props.selectionManager.selectionMode;\n let selectionBehavior = props.selectionManager.selectionBehavior;\n\n let message = undefined;\n if (shouldLongPress) {\n message = stringFormatter.format('longPressToSelect');\n }\n\n return selectionBehavior === 'replace' && selectionMode !== 'none' && props.hasItemActions ? message : undefined;\n }, [props.selectionManager.selectionMode, props.selectionManager.selectionBehavior, props.hasItemActions, stringFormatter, shouldLongPress]);\n\n let descriptionProps = useDescription(interactionDescription);\n return descriptionProps;\n}\n"],"names":[],"version":3,"file":"useHighlightSelectionDescription.main.js.map"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import $kh5JA$intlStringsmodulejs from "./intlStrings.mjs";
|
|
2
|
+
import {useDescription as $kh5JA$useDescription} from "@react-aria/utils";
|
|
3
|
+
import {useInteractionModality as $kh5JA$useInteractionModality} from "@react-aria/interactions";
|
|
4
|
+
import {useLocalizedStringFormatter as $kh5JA$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
5
|
+
import {useMemo as $kh5JA$useMemo} from "react";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
function $parcel$interopDefault(a) {
|
|
9
|
+
return a && a.__esModule ? a.default : a;
|
|
10
|
+
}
|
|
11
|
+
/*
|
|
12
|
+
* Copyright 2021 Adobe. All rights reserved.
|
|
13
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
15
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
18
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
19
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
20
|
+
* governing permissions and limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
function $5b9b5b5723db6ae1$export$be42ebdab07ae4c2(props) {
|
|
27
|
+
let stringFormatter = (0, $kh5JA$useLocalizedStringFormatter)((0, ($parcel$interopDefault($kh5JA$intlStringsmodulejs))), "@react-aria/grid");
|
|
28
|
+
let modality = (0, $kh5JA$useInteractionModality)();
|
|
29
|
+
// null is the default if the user hasn't interacted with the table at all yet or the rest of the page
|
|
30
|
+
let shouldLongPress = (modality === "pointer" || modality === "virtual" || modality == null) && typeof window !== "undefined" && "ontouchstart" in window;
|
|
31
|
+
let interactionDescription = (0, $kh5JA$useMemo)(()=>{
|
|
32
|
+
let selectionMode = props.selectionManager.selectionMode;
|
|
33
|
+
let selectionBehavior = props.selectionManager.selectionBehavior;
|
|
34
|
+
let message = undefined;
|
|
35
|
+
if (shouldLongPress) message = stringFormatter.format("longPressToSelect");
|
|
36
|
+
return selectionBehavior === "replace" && selectionMode !== "none" && props.hasItemActions ? message : undefined;
|
|
37
|
+
}, [
|
|
38
|
+
props.selectionManager.selectionMode,
|
|
39
|
+
props.selectionManager.selectionBehavior,
|
|
40
|
+
props.hasItemActions,
|
|
41
|
+
stringFormatter,
|
|
42
|
+
shouldLongPress
|
|
43
|
+
]);
|
|
44
|
+
let descriptionProps = (0, $kh5JA$useDescription)(interactionDescription);
|
|
45
|
+
return descriptionProps;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
export {$5b9b5b5723db6ae1$export$be42ebdab07ae4c2 as useHighlightSelectionDescription};
|
|
50
|
+
//# sourceMappingURL=useHighlightSelectionDescription.mjs.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import $kh5JA$intlStringsmodulejs from "./intlStrings.module.js";
|
|
2
|
+
import {useDescription as $kh5JA$useDescription} from "@react-aria/utils";
|
|
3
|
+
import {useInteractionModality as $kh5JA$useInteractionModality} from "@react-aria/interactions";
|
|
4
|
+
import {useLocalizedStringFormatter as $kh5JA$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
5
|
+
import {useMemo as $kh5JA$useMemo} from "react";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
function $parcel$interopDefault(a) {
|
|
9
|
+
return a && a.__esModule ? a.default : a;
|
|
10
|
+
}
|
|
11
|
+
/*
|
|
12
|
+
* Copyright 2021 Adobe. All rights reserved.
|
|
13
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
15
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
18
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
19
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
20
|
+
* governing permissions and limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
function $5b9b5b5723db6ae1$export$be42ebdab07ae4c2(props) {
|
|
27
|
+
let stringFormatter = (0, $kh5JA$useLocalizedStringFormatter)((0, ($parcel$interopDefault($kh5JA$intlStringsmodulejs))), "@react-aria/grid");
|
|
28
|
+
let modality = (0, $kh5JA$useInteractionModality)();
|
|
29
|
+
// null is the default if the user hasn't interacted with the table at all yet or the rest of the page
|
|
30
|
+
let shouldLongPress = (modality === "pointer" || modality === "virtual" || modality == null) && typeof window !== "undefined" && "ontouchstart" in window;
|
|
31
|
+
let interactionDescription = (0, $kh5JA$useMemo)(()=>{
|
|
32
|
+
let selectionMode = props.selectionManager.selectionMode;
|
|
33
|
+
let selectionBehavior = props.selectionManager.selectionBehavior;
|
|
34
|
+
let message = undefined;
|
|
35
|
+
if (shouldLongPress) message = stringFormatter.format("longPressToSelect");
|
|
36
|
+
return selectionBehavior === "replace" && selectionMode !== "none" && props.hasItemActions ? message : undefined;
|
|
37
|
+
}, [
|
|
38
|
+
props.selectionManager.selectionMode,
|
|
39
|
+
props.selectionManager.selectionBehavior,
|
|
40
|
+
props.hasItemActions,
|
|
41
|
+
stringFormatter,
|
|
42
|
+
shouldLongPress
|
|
43
|
+
]);
|
|
44
|
+
let descriptionProps = (0, $kh5JA$useDescription)(interactionDescription);
|
|
45
|
+
return descriptionProps;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
export {$5b9b5b5723db6ae1$export$be42ebdab07ae4c2 as useHighlightSelectionDescription};
|
|
50
|
+
//# sourceMappingURL=useHighlightSelectionDescription.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAoBM,SAAS,0CAAiC,KAAyC;IACxF,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,WAAW,CAAA,GAAA,6BAAqB;IACpC,sGAAsG;IACtG,IAAI,kBAAkB,AAAC,CAAA,aAAa,aAAa,aAAa,aAAa,YAAY,IAAG,KACrF,OAAO,WAAW,eAAe,kBAAkB;IAExD,IAAI,yBAAyB,CAAA,GAAA,cAAM,EAAE;QACnC,IAAI,gBAAgB,MAAM,gBAAgB,CAAC,aAAa;QACxD,IAAI,oBAAoB,MAAM,gBAAgB,CAAC,iBAAiB;QAEhE,IAAI,UAAU;QACd,IAAI,iBACF,UAAU,gBAAgB,MAAM,CAAC;QAGnC,OAAO,sBAAsB,aAAa,kBAAkB,UAAU,MAAM,cAAc,GAAG,UAAU;IACzG,GAAG;QAAC,MAAM,gBAAgB,CAAC,aAAa;QAAE,MAAM,gBAAgB,CAAC,iBAAiB;QAAE,MAAM,cAAc;QAAE;QAAiB;KAAgB;IAE3I,IAAI,mBAAmB,CAAA,GAAA,qBAAa,EAAE;IACtC,OAAO;AACT","sources":["packages/@react-aria/grid/src/useHighlightSelectionDescription.ts"],"sourcesContent":["/*\n * Copyright 2021 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} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {MultipleSelectionManager} from '@react-stately/selection';\nimport {useDescription} from '@react-aria/utils';\nimport {useInteractionModality} from '@react-aria/interactions';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useMemo} from 'react';\n\nexport interface HighlightSelectionDescriptionProps {\n selectionManager: MultipleSelectionManager,\n hasItemActions?: boolean\n}\n\n/**\n * Computes the description for a grid selectable collection.\n * @param props\n */\nexport function useHighlightSelectionDescription(props: HighlightSelectionDescriptionProps): AriaLabelingProps {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/grid');\n let modality = useInteractionModality();\n // null is the default if the user hasn't interacted with the table at all yet or the rest of the page\n let shouldLongPress = (modality === 'pointer' || modality === 'virtual' || modality == null)\n && typeof window !== 'undefined' && 'ontouchstart' in window;\n\n let interactionDescription = useMemo(() => {\n let selectionMode = props.selectionManager.selectionMode;\n let selectionBehavior = props.selectionManager.selectionBehavior;\n\n let message = undefined;\n if (shouldLongPress) {\n message = stringFormatter.format('longPressToSelect');\n }\n\n return selectionBehavior === 'replace' && selectionMode !== 'none' && props.hasItemActions ? message : undefined;\n }, [props.selectionManager.selectionMode, props.selectionManager.selectionBehavior, props.hasItemActions, stringFormatter, shouldLongPress]);\n\n let descriptionProps = useDescription(interactionDescription);\n return descriptionProps;\n}\n"],"names":[],"version":3,"file":"useHighlightSelectionDescription.module.js.map"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
function $parcel$export(e, n, v, s) {
|
|
3
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
$parcel$export(module.exports, "gridMap", () => $8ee34951196858d0$export$e6235c0d09b995d0);
|
|
7
|
+
/*
|
|
8
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
9
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
11
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
14
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
15
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
|
+
* governing permissions and limitations under the License.
|
|
17
|
+
*/ const $8ee34951196858d0$export$e6235c0d09b995d0 = new WeakMap();
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=utils.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAiBM,MAAM,4CAAU,IAAI","sources":["packages/@react-aria/grid/src/utils.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\nimport type {GridCollection} from '@react-types/grid';\nimport type {GridState} from '@react-stately/grid';\nimport type {Key, KeyboardDelegate} from '@react-types/shared';\n\ninterface GridMapShared {\n keyboardDelegate: KeyboardDelegate,\n actions: {\n onRowAction: (key: Key) => void,\n onCellAction: (key: Key) => void\n }\n}\n\n// Used to share:\n// keyboard delegate between useGrid and useGridCell\n// onRowAction/onCellAction across hooks\nexport const gridMap = new WeakMap<GridState<unknown, GridCollection<unknown>>, GridMapShared>();\n"],"names":[],"version":3,"file":"utils.main.js.map"}
|
package/dist/utils.mjs
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
|
+
*/ const $1af922eb41e03c8f$export$e6235c0d09b995d0 = new WeakMap();
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
export {$1af922eb41e03c8f$export$e6235c0d09b995d0 as gridMap};
|
|
15
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -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
|
+
*/ const $1af922eb41e03c8f$export$e6235c0d09b995d0 = new WeakMap();
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
export {$1af922eb41e03c8f$export$e6235c0d09b995d0 as gridMap};
|
|
15
|
+
//# sourceMappingURL=utils.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA;;;;;;;;;;CAUC,GAiBM,MAAM,4CAAU,IAAI","sources":["packages/@react-aria/grid/src/utils.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\nimport type {GridCollection} from '@react-types/grid';\nimport type {GridState} from '@react-stately/grid';\nimport type {Key, KeyboardDelegate} from '@react-types/shared';\n\ninterface GridMapShared {\n keyboardDelegate: KeyboardDelegate,\n actions: {\n onRowAction: (key: Key) => void,\n onCellAction: (key: Key) => void\n }\n}\n\n// Used to share:\n// keyboard delegate between useGrid and useGridCell\n// onRowAction/onCellAction across hooks\nexport const gridMap = new WeakMap<GridState<unknown, GridCollection<unknown>>, GridMapShared>();\n"],"names":[],"version":3,"file":"utils.module.js.map"}
|
package/dist/zh-CN.mjs
CHANGED
package/dist/zh-TW.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/grid",
|
|
3
|
-
"version": "3.8.9-nightly.
|
|
3
|
+
"version": "3.8.9-nightly.4560+72775d272",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-aria/focus": "3.0.0-nightly.
|
|
26
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
|
27
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
28
|
-
"@react-aria/live-announcer": "3.0.0-nightly.
|
|
29
|
-
"@react-aria/selection": "3.0.0-nightly.
|
|
30
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
31
|
-
"@react-stately/collections": "3.0.0-nightly.
|
|
32
|
-
"@react-stately/grid": "3.8.6-nightly.
|
|
33
|
-
"@react-stately/selection": "3.0.0-nightly.
|
|
34
|
-
"@react-stately/virtualizer": "3.6.9-nightly.
|
|
35
|
-
"@react-types/checkbox": "3.0.0-nightly.
|
|
36
|
-
"@react-types/grid": "3.2.5-nightly.
|
|
37
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
25
|
+
"@react-aria/focus": "3.0.0-nightly.2848+72775d272",
|
|
26
|
+
"@react-aria/i18n": "3.0.0-nightly.2848+72775d272",
|
|
27
|
+
"@react-aria/interactions": "3.0.0-nightly.2848+72775d272",
|
|
28
|
+
"@react-aria/live-announcer": "3.0.0-nightly.2848+72775d272",
|
|
29
|
+
"@react-aria/selection": "3.0.0-nightly.2848+72775d272",
|
|
30
|
+
"@react-aria/utils": "3.0.0-nightly.2848+72775d272",
|
|
31
|
+
"@react-stately/collections": "3.0.0-nightly.2848+72775d272",
|
|
32
|
+
"@react-stately/grid": "3.8.6-nightly.4560+72775d272",
|
|
33
|
+
"@react-stately/selection": "3.0.0-nightly.2848+72775d272",
|
|
34
|
+
"@react-stately/virtualizer": "3.6.9-nightly.4560+72775d272",
|
|
35
|
+
"@react-types/checkbox": "3.0.0-nightly.2848+72775d272",
|
|
36
|
+
"@react-types/grid": "3.2.5-nightly.4560+72775d272",
|
|
37
|
+
"@react-types/shared": "3.0.0-nightly.2848+72775d272",
|
|
38
38
|
"@swc/helpers": "^0.5.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "72775d272be04cfa32d26ec821bc68513d92a72b"
|
|
48
48
|
}
|