@react-aria/table 3.17.10 → 3.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/import.mjs +2 -19
- package/dist/main.js +10 -27
- package/dist/main.js.map +1 -1
- package/dist/module.js +2 -19
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +4 -0
- package/package.json +15 -25
- package/src/index.ts +4 -21
- package/dist/TableKeyboardDelegate.main.js +0 -142
- package/dist/TableKeyboardDelegate.main.js.map +0 -1
- package/dist/TableKeyboardDelegate.mjs +0 -137
- package/dist/TableKeyboardDelegate.module.js +0 -137
- package/dist/TableKeyboardDelegate.module.js.map +0 -1
- package/dist/ar-AE.main.js +0 -14
- package/dist/ar-AE.main.js.map +0 -1
- package/dist/ar-AE.mjs +0 -16
- package/dist/ar-AE.module.js +0 -16
- package/dist/ar-AE.module.js.map +0 -1
- package/dist/bg-BG.main.js +0 -14
- package/dist/bg-BG.main.js.map +0 -1
- package/dist/bg-BG.mjs +0 -16
- package/dist/bg-BG.module.js +0 -16
- package/dist/bg-BG.module.js.map +0 -1
- package/dist/cs-CZ.main.js +0 -14
- package/dist/cs-CZ.main.js.map +0 -1
- package/dist/cs-CZ.mjs +0 -16
- package/dist/cs-CZ.module.js +0 -16
- package/dist/cs-CZ.module.js.map +0 -1
- package/dist/da-DK.main.js +0 -14
- package/dist/da-DK.main.js.map +0 -1
- package/dist/da-DK.mjs +0 -16
- package/dist/da-DK.module.js +0 -16
- package/dist/da-DK.module.js.map +0 -1
- package/dist/de-DE.main.js +0 -14
- package/dist/de-DE.main.js.map +0 -1
- package/dist/de-DE.mjs +0 -16
- package/dist/de-DE.module.js +0 -16
- package/dist/de-DE.module.js.map +0 -1
- package/dist/el-GR.main.js +0 -14
- package/dist/el-GR.main.js.map +0 -1
- package/dist/el-GR.mjs +0 -16
- package/dist/el-GR.module.js +0 -16
- package/dist/el-GR.module.js.map +0 -1
- package/dist/en-US.main.js +0 -14
- package/dist/en-US.main.js.map +0 -1
- package/dist/en-US.mjs +0 -16
- package/dist/en-US.module.js +0 -16
- package/dist/en-US.module.js.map +0 -1
- package/dist/es-ES.main.js +0 -14
- package/dist/es-ES.main.js.map +0 -1
- package/dist/es-ES.mjs +0 -16
- package/dist/es-ES.module.js +0 -16
- package/dist/es-ES.module.js.map +0 -1
- package/dist/et-EE.main.js +0 -14
- package/dist/et-EE.main.js.map +0 -1
- package/dist/et-EE.mjs +0 -16
- package/dist/et-EE.module.js +0 -16
- package/dist/et-EE.module.js.map +0 -1
- package/dist/fi-FI.main.js +0 -14
- package/dist/fi-FI.main.js.map +0 -1
- package/dist/fi-FI.mjs +0 -16
- package/dist/fi-FI.module.js +0 -16
- package/dist/fi-FI.module.js.map +0 -1
- package/dist/fr-FR.main.js +0 -14
- package/dist/fr-FR.main.js.map +0 -1
- package/dist/fr-FR.mjs +0 -16
- package/dist/fr-FR.module.js +0 -16
- package/dist/fr-FR.module.js.map +0 -1
- package/dist/he-IL.main.js +0 -14
- package/dist/he-IL.main.js.map +0 -1
- package/dist/he-IL.mjs +0 -16
- package/dist/he-IL.module.js +0 -16
- package/dist/he-IL.module.js.map +0 -1
- package/dist/hr-HR.main.js +0 -14
- package/dist/hr-HR.main.js.map +0 -1
- package/dist/hr-HR.mjs +0 -16
- package/dist/hr-HR.module.js +0 -16
- package/dist/hr-HR.module.js.map +0 -1
- package/dist/hu-HU.main.js +0 -14
- package/dist/hu-HU.main.js.map +0 -1
- package/dist/hu-HU.mjs +0 -16
- package/dist/hu-HU.module.js +0 -16
- package/dist/hu-HU.module.js.map +0 -1
- package/dist/intlStrings.main.js +0 -108
- package/dist/intlStrings.main.js.map +0 -1
- package/dist/intlStrings.mjs +0 -110
- package/dist/intlStrings.module.js +0 -110
- package/dist/intlStrings.module.js.map +0 -1
- package/dist/it-IT.main.js +0 -14
- package/dist/it-IT.main.js.map +0 -1
- package/dist/it-IT.mjs +0 -16
- package/dist/it-IT.module.js +0 -16
- package/dist/it-IT.module.js.map +0 -1
- package/dist/ja-JP.main.js +0 -14
- package/dist/ja-JP.main.js.map +0 -1
- package/dist/ja-JP.mjs +0 -16
- package/dist/ja-JP.module.js +0 -16
- package/dist/ja-JP.module.js.map +0 -1
- package/dist/ko-KR.main.js +0 -14
- package/dist/ko-KR.main.js.map +0 -1
- package/dist/ko-KR.mjs +0 -16
- package/dist/ko-KR.module.js +0 -16
- package/dist/ko-KR.module.js.map +0 -1
- package/dist/lt-LT.main.js +0 -14
- package/dist/lt-LT.main.js.map +0 -1
- package/dist/lt-LT.mjs +0 -16
- package/dist/lt-LT.module.js +0 -16
- package/dist/lt-LT.module.js.map +0 -1
- package/dist/lv-LV.main.js +0 -14
- package/dist/lv-LV.main.js.map +0 -1
- package/dist/lv-LV.mjs +0 -16
- package/dist/lv-LV.module.js +0 -16
- package/dist/lv-LV.module.js.map +0 -1
- package/dist/nb-NO.main.js +0 -14
- package/dist/nb-NO.main.js.map +0 -1
- package/dist/nb-NO.mjs +0 -16
- package/dist/nb-NO.module.js +0 -16
- package/dist/nb-NO.module.js.map +0 -1
- package/dist/nl-NL.main.js +0 -14
- package/dist/nl-NL.main.js.map +0 -1
- package/dist/nl-NL.mjs +0 -16
- package/dist/nl-NL.module.js +0 -16
- package/dist/nl-NL.module.js.map +0 -1
- package/dist/pl-PL.main.js +0 -14
- package/dist/pl-PL.main.js.map +0 -1
- package/dist/pl-PL.mjs +0 -16
- package/dist/pl-PL.module.js +0 -16
- package/dist/pl-PL.module.js.map +0 -1
- package/dist/pt-BR.main.js +0 -14
- package/dist/pt-BR.main.js.map +0 -1
- package/dist/pt-BR.mjs +0 -16
- package/dist/pt-BR.module.js +0 -16
- package/dist/pt-BR.module.js.map +0 -1
- package/dist/pt-PT.main.js +0 -14
- package/dist/pt-PT.main.js.map +0 -1
- package/dist/pt-PT.mjs +0 -16
- package/dist/pt-PT.module.js +0 -16
- package/dist/pt-PT.module.js.map +0 -1
- package/dist/ro-RO.main.js +0 -14
- package/dist/ro-RO.main.js.map +0 -1
- package/dist/ro-RO.mjs +0 -16
- package/dist/ro-RO.module.js +0 -16
- package/dist/ro-RO.module.js.map +0 -1
- package/dist/ru-RU.main.js +0 -14
- package/dist/ru-RU.main.js.map +0 -1
- package/dist/ru-RU.mjs +0 -16
- package/dist/ru-RU.module.js +0 -16
- package/dist/ru-RU.module.js.map +0 -1
- package/dist/sk-SK.main.js +0 -14
- package/dist/sk-SK.main.js.map +0 -1
- package/dist/sk-SK.mjs +0 -16
- package/dist/sk-SK.module.js +0 -16
- package/dist/sk-SK.module.js.map +0 -1
- package/dist/sl-SI.main.js +0 -14
- package/dist/sl-SI.main.js.map +0 -1
- package/dist/sl-SI.mjs +0 -16
- package/dist/sl-SI.module.js +0 -16
- package/dist/sl-SI.module.js.map +0 -1
- package/dist/sr-SP.main.js +0 -14
- package/dist/sr-SP.main.js.map +0 -1
- package/dist/sr-SP.mjs +0 -16
- package/dist/sr-SP.module.js +0 -16
- package/dist/sr-SP.module.js.map +0 -1
- package/dist/sv-SE.main.js +0 -14
- package/dist/sv-SE.main.js.map +0 -1
- package/dist/sv-SE.mjs +0 -16
- package/dist/sv-SE.module.js +0 -16
- package/dist/sv-SE.module.js.map +0 -1
- package/dist/tr-TR.main.js +0 -14
- package/dist/tr-TR.main.js.map +0 -1
- package/dist/tr-TR.mjs +0 -16
- package/dist/tr-TR.module.js +0 -16
- package/dist/tr-TR.module.js.map +0 -1
- package/dist/types.d.ts +0 -157
- package/dist/types.d.ts.map +0 -1
- package/dist/uk-UA.main.js +0 -14
- package/dist/uk-UA.main.js.map +0 -1
- package/dist/uk-UA.mjs +0 -16
- package/dist/uk-UA.module.js +0 -16
- package/dist/uk-UA.module.js.map +0 -1
- package/dist/useTable.main.js +0 -114
- package/dist/useTable.main.js.map +0 -1
- package/dist/useTable.mjs +0 -109
- package/dist/useTable.module.js +0 -109
- package/dist/useTable.module.js.map +0 -1
- package/dist/useTableCell.main.js +0 -37
- package/dist/useTableCell.main.js.map +0 -1
- package/dist/useTableCell.mjs +0 -32
- package/dist/useTableCell.module.js +0 -32
- package/dist/useTableCell.module.js.map +0 -1
- package/dist/useTableColumnHeader.main.js +0 -92
- package/dist/useTableColumnHeader.main.js.map +0 -1
- package/dist/useTableColumnHeader.mjs +0 -87
- package/dist/useTableColumnHeader.module.js +0 -87
- package/dist/useTableColumnHeader.module.js.map +0 -1
- package/dist/useTableColumnResize.main.js +0 -226
- package/dist/useTableColumnResize.main.js.map +0 -1
- package/dist/useTableColumnResize.mjs +0 -221
- package/dist/useTableColumnResize.module.js +0 -221
- package/dist/useTableColumnResize.module.js.map +0 -1
- package/dist/useTableHeaderRow.main.js +0 -32
- package/dist/useTableHeaderRow.main.js.map +0 -1
- package/dist/useTableHeaderRow.mjs +0 -27
- package/dist/useTableHeaderRow.module.js +0 -27
- package/dist/useTableHeaderRow.module.js.map +0 -1
- package/dist/useTableRow.main.js +0 -82
- package/dist/useTableRow.main.js.map +0 -1
- package/dist/useTableRow.mjs +0 -77
- package/dist/useTableRow.module.js +0 -77
- package/dist/useTableRow.module.js.map +0 -1
- package/dist/useTableSelectionCheckbox.main.js +0 -56
- package/dist/useTableSelectionCheckbox.main.js.map +0 -1
- package/dist/useTableSelectionCheckbox.mjs +0 -50
- package/dist/useTableSelectionCheckbox.module.js +0 -50
- package/dist/useTableSelectionCheckbox.module.js.map +0 -1
- package/dist/utils.main.js +0 -43
- package/dist/utils.main.js.map +0 -1
- package/dist/utils.mjs +0 -35
- package/dist/utils.module.js +0 -35
- package/dist/utils.module.js.map +0 -1
- package/dist/zh-CN.main.js +0 -14
- package/dist/zh-CN.main.js.map +0 -1
- package/dist/zh-CN.mjs +0 -16
- package/dist/zh-CN.module.js +0 -16
- package/dist/zh-CN.module.js.map +0 -1
- package/dist/zh-TW.main.js +0 -14
- package/dist/zh-TW.main.js.map +0 -1
- package/dist/zh-TW.mjs +0 -16
- package/dist/zh-TW.module.js +0 -16
- package/dist/zh-TW.module.js.map +0 -1
- package/src/TableKeyboardDelegate.ts +0 -214
- package/src/useTable.ts +0 -123
- package/src/useTableCell.ts +0 -59
- package/src/useTableColumnHeader.ts +0 -108
- package/src/useTableColumnResize.ts +0 -277
- package/src/useTableHeaderRow.ts +0 -42
- package/src/useTableRow.ts +0 -86
- package/src/useTableSelectionCheckbox.ts +0 -72
- package/src/utils.ts +0 -49
package/dist/useTable.module.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import {gridIds as $2140fb2337097f2d$export$552312adfd451dab} from "./utils.module.js";
|
|
2
|
-
import $dDeJM$intlStringsmodulejs from "./intlStrings.module.js";
|
|
3
|
-
import {TableKeyboardDelegate as $0ba3c81c7f1caedd$export$da43f8f5cb04028d} from "./TableKeyboardDelegate.module.js";
|
|
4
|
-
import {announce as $dDeJM$announce} from "@react-aria/live-announcer";
|
|
5
|
-
import {useGrid as $dDeJM$useGrid} from "@react-aria/grid";
|
|
6
|
-
import {useId as $dDeJM$useId, useDescription as $dDeJM$useDescription, useUpdateEffect as $dDeJM$useUpdateEffect, mergeProps as $dDeJM$mergeProps} from "@react-aria/utils";
|
|
7
|
-
import {tableNestedRows as $dDeJM$tableNestedRows} from "@react-stately/flags";
|
|
8
|
-
import {useCollator as $dDeJM$useCollator, useLocale as $dDeJM$useLocale, useLocalizedStringFormatter as $dDeJM$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
9
|
-
import {useMemo as $dDeJM$useMemo} from "react";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function $parcel$interopDefault(a) {
|
|
13
|
-
return a && a.__esModule ? a.default : a;
|
|
14
|
-
}
|
|
15
|
-
/*
|
|
16
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
17
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
18
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
19
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
-
*
|
|
21
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
22
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
23
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
24
|
-
* governing permissions and limitations under the License.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
35
|
-
let { keyboardDelegate: keyboardDelegate, isVirtualized: isVirtualized, layoutDelegate: layoutDelegate, layout: layout } = props;
|
|
36
|
-
// By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
|
|
37
|
-
// When virtualized, the layout object will be passed in as a prop and override this.
|
|
38
|
-
let collator = (0, $dDeJM$useCollator)({
|
|
39
|
-
usage: 'search',
|
|
40
|
-
sensitivity: 'base'
|
|
41
|
-
});
|
|
42
|
-
let { direction: direction } = (0, $dDeJM$useLocale)();
|
|
43
|
-
let disabledBehavior = state.selectionManager.disabledBehavior;
|
|
44
|
-
let delegate = (0, $dDeJM$useMemo)(()=>keyboardDelegate || new (0, $0ba3c81c7f1caedd$export$da43f8f5cb04028d)({
|
|
45
|
-
collection: state.collection,
|
|
46
|
-
disabledKeys: state.disabledKeys,
|
|
47
|
-
disabledBehavior: disabledBehavior,
|
|
48
|
-
ref: ref,
|
|
49
|
-
direction: direction,
|
|
50
|
-
collator: collator,
|
|
51
|
-
layoutDelegate: layoutDelegate,
|
|
52
|
-
layout: layout
|
|
53
|
-
}), [
|
|
54
|
-
keyboardDelegate,
|
|
55
|
-
state.collection,
|
|
56
|
-
state.disabledKeys,
|
|
57
|
-
disabledBehavior,
|
|
58
|
-
ref,
|
|
59
|
-
direction,
|
|
60
|
-
collator,
|
|
61
|
-
layoutDelegate,
|
|
62
|
-
layout
|
|
63
|
-
]);
|
|
64
|
-
let id = (0, $dDeJM$useId)(props.id);
|
|
65
|
-
(0, $2140fb2337097f2d$export$552312adfd451dab).set(state, id);
|
|
66
|
-
let { gridProps: gridProps } = (0, $dDeJM$useGrid)({
|
|
67
|
-
...props,
|
|
68
|
-
id: id,
|
|
69
|
-
keyboardDelegate: delegate
|
|
70
|
-
}, state, ref);
|
|
71
|
-
// Override to include header rows
|
|
72
|
-
if (isVirtualized) gridProps['aria-rowcount'] = state.collection.size + state.collection.headerRows.length;
|
|
73
|
-
if ((0, $dDeJM$tableNestedRows)() && 'expandedKeys' in state) gridProps.role = 'treegrid';
|
|
74
|
-
let { column: column, direction: sortDirection } = state.sortDescriptor || {};
|
|
75
|
-
let stringFormatter = (0, $dDeJM$useLocalizedStringFormatter)((0, ($parcel$interopDefault($dDeJM$intlStringsmodulejs))), '@react-aria/table');
|
|
76
|
-
let sortDescription = (0, $dDeJM$useMemo)(()=>{
|
|
77
|
-
var _state_collection_columns_find;
|
|
78
|
-
var _state_collection_columns_find_textValue;
|
|
79
|
-
let columnName = (_state_collection_columns_find_textValue = (_state_collection_columns_find = state.collection.columns.find((c)=>c.key === column)) === null || _state_collection_columns_find === void 0 ? void 0 : _state_collection_columns_find.textValue) !== null && _state_collection_columns_find_textValue !== void 0 ? _state_collection_columns_find_textValue : '';
|
|
80
|
-
return sortDirection && column ? stringFormatter.format(`${sortDirection}Sort`, {
|
|
81
|
-
columnName: columnName
|
|
82
|
-
}) : undefined;
|
|
83
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
84
|
-
}, [
|
|
85
|
-
sortDirection,
|
|
86
|
-
column,
|
|
87
|
-
state.collection.columns
|
|
88
|
-
]);
|
|
89
|
-
let descriptionProps = (0, $dDeJM$useDescription)(sortDescription);
|
|
90
|
-
// Only announce after initial render, tabbing to the table will tell you the initial sort info already
|
|
91
|
-
(0, $dDeJM$useUpdateEffect)(()=>{
|
|
92
|
-
if (sortDescription) (0, $dDeJM$announce)(sortDescription, 'assertive', 500);
|
|
93
|
-
}, [
|
|
94
|
-
sortDescription
|
|
95
|
-
]);
|
|
96
|
-
return {
|
|
97
|
-
gridProps: (0, $dDeJM$mergeProps)(gridProps, descriptionProps, {
|
|
98
|
-
// merge sort description with long press information
|
|
99
|
-
'aria-describedby': [
|
|
100
|
-
descriptionProps['aria-describedby'],
|
|
101
|
-
gridProps['aria-describedby']
|
|
102
|
-
].filter(Boolean).join(' ')
|
|
103
|
-
})
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
export {$6e31608fbba75bab$export$25bceaac3c7e4dc7 as useTable};
|
|
109
|
-
//# sourceMappingURL=useTable.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AA4CM,SAAS,0CAAY,KAAqB,EAAE,KAAuC,EAAE,GAAkC;IAC5H,IAAI,oBACF,gBAAgB,iBAChB,aAAa,kBACb,cAAc,UACd,MAAM,EACP,GAAG;IAEJ,0HAA0H;IAC1H,qFAAqF;IACrF,IAAI,WAAW,CAAA,GAAA,kBAAU,EAAE;QAAC,OAAO;QAAU,aAAa;IAAM;IAChE,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,mBAAmB,MAAM,gBAAgB,CAAC,gBAAgB;IAC9D,IAAI,WAAW,CAAA,GAAA,cAAM,EAAE,IAAM,oBAAoB,IAAI,CAAA,GAAA,yCAAoB,EAAE;YACzE,YAAY,MAAM,UAAU;YAC5B,cAAc,MAAM,YAAY;8BAChC;iBACA;uBACA;sBACA;4BACA;oBACA;QACF,IAAI;QAAC;QAAkB,MAAM,UAAU;QAAE,MAAM,YAAY;QAAE;QAAkB;QAAK;QAAW;QAAU;QAAgB;KAAO;IAChI,IAAI,KAAK,CAAA,GAAA,YAAI,EAAE,MAAM,EAAE;IACvB,CAAA,GAAA,yCAAM,EAAE,GAAG,CAAC,OAAO;IAEnB,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,cAAM,EAAE;QACxB,GAAG,KAAK;YACR;QACA,kBAAkB;IACpB,GAAG,OAAO;IAEV,kCAAkC;IAClC,IAAI,eACF,SAAS,CAAC,gBAAgB,GAAG,MAAM,UAAU,CAAC,IAAI,GAAG,MAAM,UAAU,CAAC,UAAU,CAAC,MAAM;IAGzF,IAAI,CAAA,GAAA,sBAAc,OAAO,kBAAkB,OACzC,UAAU,IAAI,GAAG;IAGnB,IAAI,UAAC,MAAM,EAAE,WAAW,aAAa,EAAC,GAAG,MAAM,cAAc,IAAI,CAAC;IAClE,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,kBAAkB,CAAA,GAAA,cAAM,EAAE;YACX;YAAA;QAAjB,IAAI,aAAa,CAAA,4CAAA,iCAAA,MAAM,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA,IAAK,EAAE,GAAG,KAAK,qBAA7C,qDAAA,+BAAsD,SAAS,cAA/D,sDAAA,2CAAmE;QACpF,OAAO,iBAAiB,SAAS,gBAAgB,MAAM,CAAC,GAAG,cAAc,IAAI,CAAC,EAAE;wBAAC;QAAU,KAAK;IAClG,uDAAuD;IACvD,GAAG;QAAC;QAAe;QAAQ,MAAM,UAAU,CAAC,OAAO;KAAC;IAEpD,IAAI,mBAAmB,CAAA,GAAA,qBAAa,EAAE;IAEtC,uGAAuG;IACvG,CAAA,GAAA,sBAAc,EAAE;QACd,IAAI,iBACF,CAAA,GAAA,eAAO,EAAE,iBAAiB,aAAa;IAE3C,GAAG;QAAC;KAAgB;IAEpB,OAAO;QACL,WAAW,CAAA,GAAA,iBAAS,EAClB,WACA,kBACA;YACE,qDAAqD;YACrD,oBAAoB;gBAAC,gBAAgB,CAAC,mBAAmB;gBAAE,SAAS,CAAC,mBAAmB;aAAC,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC;QACjH;IAEJ;AACF","sources":["packages/@react-aria/table/src/useTable.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 {announce} from '@react-aria/live-announcer';\nimport {GridAria, GridProps, useGrid} from '@react-aria/grid';\nimport {gridIds} from './utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Key, LayoutDelegate, Rect, RefObject, Size} from '@react-types/shared';\nimport {mergeProps, useDescription, useId, useUpdateEffect} from '@react-aria/utils';\nimport {TableKeyboardDelegate} from './TableKeyboardDelegate';\nimport {tableNestedRows} from '@react-stately/flags';\nimport {TableState, TreeGridState} from '@react-stately/table';\nimport {useCollator, useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useMemo} from 'react';\n\nexport interface AriaTableProps extends GridProps {\n /** The layout object for the table. Computes what content is visible and how to position and style them. */\n layoutDelegate?: LayoutDelegate,\n /** @deprecated - Use layoutDelegate instead. */\n layout?: DeprecatedLayout\n}\n\ninterface DeprecatedLayout {\n getLayoutInfo(key: Key): DeprecatedLayoutInfo,\n getContentSize(): Size,\n virtualizer: DeprecatedVirtualizer\n}\n\ninterface DeprecatedLayoutInfo {\n rect: Rect\n}\n\ninterface DeprecatedVirtualizer {\n visibleRect: Rect\n}\n\n/**\n * Provides the behavior and accessibility implementation for a table component.\n * A table displays data in rows and columns and enables a user to navigate its contents via directional navigation keys,\n * and optionally supports row selection and sorting.\n * @param props - Props for the table.\n * @param state - State for the table, as returned by `useTableState`.\n * @param ref - The ref attached to the table element.\n */\nexport function useTable<T>(props: AriaTableProps, state: TableState<T> | TreeGridState<T>, ref: RefObject<HTMLElement | null>): GridAria {\n let {\n keyboardDelegate,\n isVirtualized,\n layoutDelegate,\n layout\n } = props;\n\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let {direction} = useLocale();\n let disabledBehavior = state.selectionManager.disabledBehavior;\n let delegate = useMemo(() => keyboardDelegate || new TableKeyboardDelegate({\n collection: state.collection,\n disabledKeys: state.disabledKeys,\n disabledBehavior,\n ref,\n direction,\n collator,\n layoutDelegate,\n layout\n }), [keyboardDelegate, state.collection, state.disabledKeys, disabledBehavior, ref, direction, collator, layoutDelegate, layout]);\n let id = useId(props.id);\n gridIds.set(state, id);\n\n let {gridProps} = useGrid({\n ...props,\n id,\n keyboardDelegate: delegate\n }, state, ref);\n\n // Override to include header rows\n if (isVirtualized) {\n gridProps['aria-rowcount'] = state.collection.size + state.collection.headerRows.length;\n }\n\n if (tableNestedRows() && 'expandedKeys' in state) {\n gridProps.role = 'treegrid';\n }\n\n let {column, direction: sortDirection} = state.sortDescriptor || {};\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n let sortDescription = useMemo(() => {\n let columnName = state.collection.columns.find(c => c.key === column)?.textValue ?? '';\n return sortDirection && column ? stringFormatter.format(`${sortDirection}Sort`, {columnName}) : undefined;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [sortDirection, column, state.collection.columns]);\n\n let descriptionProps = useDescription(sortDescription);\n\n // Only announce after initial render, tabbing to the table will tell you the initial sort info already\n useUpdateEffect(() => {\n if (sortDescription) {\n announce(sortDescription, 'assertive', 500);\n }\n }, [sortDescription]);\n\n return {\n gridProps: mergeProps(\n gridProps,\n descriptionProps,\n {\n // merge sort description with long press information\n 'aria-describedby': [descriptionProps['aria-describedby'], gridProps['aria-describedby']].filter(Boolean).join(' ')\n }\n )\n };\n}\n"],"names":[],"version":3,"file":"useTable.module.js.map"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
var $6acf696f746f932c$exports = require("./utils.main.js");
|
|
2
|
-
var $8iEv8$reactariagrid = require("@react-aria/grid");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function $parcel$export(e, n, v, s) {
|
|
6
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
$parcel$export(module.exports, "useTableCell", () => $32387a1f2c61cda2$export$49571c903d73624c);
|
|
10
|
-
/*
|
|
11
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
12
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
*
|
|
16
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
-
* governing permissions and limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
function $32387a1f2c61cda2$export$49571c903d73624c(props, state, ref) {
|
|
23
|
-
var _props_node_column;
|
|
24
|
-
let { gridCellProps: gridCellProps, isPressed: isPressed } = (0, $8iEv8$reactariagrid.useGridCell)(props, state, ref);
|
|
25
|
-
let columnKey = (_props_node_column = props.node.column) === null || _props_node_column === void 0 ? void 0 : _props_node_column.key;
|
|
26
|
-
if (columnKey != null && state.collection.rowHeaderColumnKeys.has(columnKey)) {
|
|
27
|
-
gridCellProps.role = 'rowheader';
|
|
28
|
-
gridCellProps.id = (0, $6acf696f746f932c$exports.getCellId)(state, props.node.parentKey, columnKey);
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
gridCellProps: gridCellProps,
|
|
32
|
-
isPressed: isPressed
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
//# sourceMappingURL=useTableCell.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAoCM,SAAS,0CAAgB,KAAyB,EAAE,KAAoB,EAAE,GAAuC;QAEtG;IADhB,IAAI,iBAAC,aAAa,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,gCAAU,EAAE,OAAO,OAAO;IAC3D,IAAI,aAAY,qBAAA,MAAM,IAAI,CAAC,MAAM,cAAjB,yCAAA,mBAAmB,GAAG;IACtC,IAAI,aAAa,QAAQ,MAAM,UAAU,CAAC,mBAAmB,CAAC,GAAG,CAAC,YAAY;QAC5E,cAAc,IAAI,GAAG;QACrB,cAAc,EAAE,GAAG,CAAA,GAAA,mCAAQ,EAAE,OAAO,MAAM,IAAI,CAAC,SAAS,EAAG;IAC7D;IAEA,OAAO;uBACL;mBACA;IACF;AACF","sources":["packages/@react-aria/table/src/useTableCell.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 {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {getCellId} from './utils';\nimport {GridNode} from '@react-types/grid';\nimport {TableState} from '@react-stately/table';\nimport {useGridCell} from '@react-aria/grid';\n\nexport interface AriaTableCellProps {\n /** An object representing the table cell. Contains all the relevant information that makes up the row header. */\n node: GridNode<unknown>,\n /** Whether the cell is contained in a virtual scroller. */\n isVirtualized?: boolean,\n /** Whether selection should occur on press up instead of press down. */\n shouldSelectOnPressUp?: boolean,\n /**\n * Handler that is called when a user performs an action on the cell.\n * Please use onCellAction at the collection level instead.\n * @deprecated\n **/\n onAction?: () => void\n}\n\nexport interface TableCellAria {\n /** Props for the table cell element. */\n gridCellProps: DOMAttributes,\n /** Whether the cell is currently in a pressed state. */\n isPressed: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for a cell in a table.\n * @param props - Props for the cell.\n * @param state - State of the table, as returned by `useTableState`.\n * @param ref - The ref attached to the cell element.\n */\nexport function useTableCell<T>(props: AriaTableCellProps, state: TableState<T>, ref: RefObject<FocusableElement | null>): TableCellAria {\n let {gridCellProps, isPressed} = useGridCell(props, state, ref);\n let columnKey = props.node.column?.key;\n if (columnKey != null && state.collection.rowHeaderColumnKeys.has(columnKey)) {\n gridCellProps.role = 'rowheader';\n gridCellProps.id = getCellId(state, props.node.parentKey!, columnKey);\n }\n\n return {\n gridCellProps,\n isPressed\n };\n}\n"],"names":[],"version":3,"file":"useTableCell.main.js.map"}
|
package/dist/useTableCell.mjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {getCellId as $2140fb2337097f2d$export$19baff3266315d44} from "./utils.mjs";
|
|
2
|
-
import {useGridCell as $1jd6q$useGridCell} from "@react-aria/grid";
|
|
3
|
-
|
|
4
|
-
/*
|
|
5
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
6
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
-
* governing permissions and limitations under the License.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
function $7713593715703b24$export$49571c903d73624c(props, state, ref) {
|
|
17
|
-
var _props_node_column;
|
|
18
|
-
let { gridCellProps: gridCellProps, isPressed: isPressed } = (0, $1jd6q$useGridCell)(props, state, ref);
|
|
19
|
-
let columnKey = (_props_node_column = props.node.column) === null || _props_node_column === void 0 ? void 0 : _props_node_column.key;
|
|
20
|
-
if (columnKey != null && state.collection.rowHeaderColumnKeys.has(columnKey)) {
|
|
21
|
-
gridCellProps.role = 'rowheader';
|
|
22
|
-
gridCellProps.id = (0, $2140fb2337097f2d$export$19baff3266315d44)(state, props.node.parentKey, columnKey);
|
|
23
|
-
}
|
|
24
|
-
return {
|
|
25
|
-
gridCellProps: gridCellProps,
|
|
26
|
-
isPressed: isPressed
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export {$7713593715703b24$export$49571c903d73624c as useTableCell};
|
|
32
|
-
//# sourceMappingURL=useTableCell.module.js.map
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {getCellId as $2140fb2337097f2d$export$19baff3266315d44} from "./utils.module.js";
|
|
2
|
-
import {useGridCell as $1jd6q$useGridCell} from "@react-aria/grid";
|
|
3
|
-
|
|
4
|
-
/*
|
|
5
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
6
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
-
* governing permissions and limitations under the License.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
function $7713593715703b24$export$49571c903d73624c(props, state, ref) {
|
|
17
|
-
var _props_node_column;
|
|
18
|
-
let { gridCellProps: gridCellProps, isPressed: isPressed } = (0, $1jd6q$useGridCell)(props, state, ref);
|
|
19
|
-
let columnKey = (_props_node_column = props.node.column) === null || _props_node_column === void 0 ? void 0 : _props_node_column.key;
|
|
20
|
-
if (columnKey != null && state.collection.rowHeaderColumnKeys.has(columnKey)) {
|
|
21
|
-
gridCellProps.role = 'rowheader';
|
|
22
|
-
gridCellProps.id = (0, $2140fb2337097f2d$export$19baff3266315d44)(state, props.node.parentKey, columnKey);
|
|
23
|
-
}
|
|
24
|
-
return {
|
|
25
|
-
gridCellProps: gridCellProps,
|
|
26
|
-
isPressed: isPressed
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export {$7713593715703b24$export$49571c903d73624c as useTableCell};
|
|
32
|
-
//# sourceMappingURL=useTableCell.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAoCM,SAAS,0CAAgB,KAAyB,EAAE,KAAoB,EAAE,GAAuC;QAEtG;IADhB,IAAI,iBAAC,aAAa,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,kBAAU,EAAE,OAAO,OAAO;IAC3D,IAAI,aAAY,qBAAA,MAAM,IAAI,CAAC,MAAM,cAAjB,yCAAA,mBAAmB,GAAG;IACtC,IAAI,aAAa,QAAQ,MAAM,UAAU,CAAC,mBAAmB,CAAC,GAAG,CAAC,YAAY;QAC5E,cAAc,IAAI,GAAG;QACrB,cAAc,EAAE,GAAG,CAAA,GAAA,yCAAQ,EAAE,OAAO,MAAM,IAAI,CAAC,SAAS,EAAG;IAC7D;IAEA,OAAO;uBACL;mBACA;IACF;AACF","sources":["packages/@react-aria/table/src/useTableCell.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 {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {getCellId} from './utils';\nimport {GridNode} from '@react-types/grid';\nimport {TableState} from '@react-stately/table';\nimport {useGridCell} from '@react-aria/grid';\n\nexport interface AriaTableCellProps {\n /** An object representing the table cell. Contains all the relevant information that makes up the row header. */\n node: GridNode<unknown>,\n /** Whether the cell is contained in a virtual scroller. */\n isVirtualized?: boolean,\n /** Whether selection should occur on press up instead of press down. */\n shouldSelectOnPressUp?: boolean,\n /**\n * Handler that is called when a user performs an action on the cell.\n * Please use onCellAction at the collection level instead.\n * @deprecated\n **/\n onAction?: () => void\n}\n\nexport interface TableCellAria {\n /** Props for the table cell element. */\n gridCellProps: DOMAttributes,\n /** Whether the cell is currently in a pressed state. */\n isPressed: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for a cell in a table.\n * @param props - Props for the cell.\n * @param state - State of the table, as returned by `useTableState`.\n * @param ref - The ref attached to the cell element.\n */\nexport function useTableCell<T>(props: AriaTableCellProps, state: TableState<T>, ref: RefObject<FocusableElement | null>): TableCellAria {\n let {gridCellProps, isPressed} = useGridCell(props, state, ref);\n let columnKey = props.node.column?.key;\n if (columnKey != null && state.collection.rowHeaderColumnKeys.has(columnKey)) {\n gridCellProps.role = 'rowheader';\n gridCellProps.id = getCellId(state, props.node.parentKey!, columnKey);\n }\n\n return {\n gridCellProps,\n isPressed\n };\n}\n"],"names":[],"version":3,"file":"useTableCell.module.js.map"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
var $6acf696f746f932c$exports = require("./utils.main.js");
|
|
2
|
-
var $7ff3f66df3873a5e$exports = require("./intlStrings.main.js");
|
|
3
|
-
var $33PgG$reactariautils = require("@react-aria/utils");
|
|
4
|
-
var $33PgG$react = require("react");
|
|
5
|
-
var $33PgG$reactariainteractions = require("@react-aria/interactions");
|
|
6
|
-
var $33PgG$reactariagrid = require("@react-aria/grid");
|
|
7
|
-
var $33PgG$reactariai18n = require("@react-aria/i18n");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function $parcel$interopDefault(a) {
|
|
11
|
-
return a && a.__esModule ? a.default : a;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function $parcel$export(e, n, v, s) {
|
|
15
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
$parcel$export(module.exports, "useTableColumnHeader", () => $7669c34a63ef0113$export$9514819a8c81e960);
|
|
19
|
-
/*
|
|
20
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
21
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
22
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
23
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
24
|
-
*
|
|
25
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
26
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
27
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
28
|
-
* governing permissions and limitations under the License.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
function $7669c34a63ef0113$export$9514819a8c81e960(props, state, ref) {
|
|
37
|
-
var _state_sortDescriptor, _state_sortDescriptor1;
|
|
38
|
-
let { node: node } = props;
|
|
39
|
-
let allowsSorting = node.props.allowsSorting;
|
|
40
|
-
// if there are no focusable children, the column header will focus the cell
|
|
41
|
-
let { gridCellProps: gridCellProps } = (0, $33PgG$reactariagrid.useGridCell)({
|
|
42
|
-
...props,
|
|
43
|
-
focusMode: 'child'
|
|
44
|
-
}, state, ref);
|
|
45
|
-
let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === 'single';
|
|
46
|
-
let { pressProps: pressProps, isPressed: isPressed } = (0, $33PgG$reactariainteractions.usePress)({
|
|
47
|
-
isDisabled: !allowsSorting || isSelectionCellDisabled,
|
|
48
|
-
onPress () {
|
|
49
|
-
state.sort(node.key);
|
|
50
|
-
},
|
|
51
|
-
ref: ref
|
|
52
|
-
});
|
|
53
|
-
// Needed to pick up the focusable context, enabling things like Tooltips for example
|
|
54
|
-
let { focusableProps: focusableProps } = (0, $33PgG$reactariainteractions.useFocusable)({}, ref);
|
|
55
|
-
let ariaSort = undefined;
|
|
56
|
-
let isSortedColumn = ((_state_sortDescriptor = state.sortDescriptor) === null || _state_sortDescriptor === void 0 ? void 0 : _state_sortDescriptor.column) === node.key;
|
|
57
|
-
let sortDirection = (_state_sortDescriptor1 = state.sortDescriptor) === null || _state_sortDescriptor1 === void 0 ? void 0 : _state_sortDescriptor1.direction;
|
|
58
|
-
// aria-sort not supported in Android Talkback
|
|
59
|
-
if (node.props.allowsSorting && !(0, $33PgG$reactariautils.isAndroid)()) ariaSort = isSortedColumn ? sortDirection : 'none';
|
|
60
|
-
let stringFormatter = (0, $33PgG$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($7ff3f66df3873a5e$exports))), '@react-aria/table');
|
|
61
|
-
let sortDescription;
|
|
62
|
-
if (allowsSorting) {
|
|
63
|
-
sortDescription = `${stringFormatter.format('sortable')}`;
|
|
64
|
-
// Android Talkback doesn't support aria-sort so we add sort order details to the aria-described by here
|
|
65
|
-
if (isSortedColumn && sortDirection && (0, $33PgG$reactariautils.isAndroid)()) sortDescription = `${sortDescription}, ${stringFormatter.format(sortDirection)}`;
|
|
66
|
-
}
|
|
67
|
-
let descriptionProps = (0, $33PgG$reactariautils.useDescription)(sortDescription);
|
|
68
|
-
let shouldDisableFocus = state.collection.size === 0;
|
|
69
|
-
(0, $33PgG$react.useEffect)(()=>{
|
|
70
|
-
if (shouldDisableFocus && state.selectionManager.focusedKey === node.key) state.selectionManager.setFocusedKey(null);
|
|
71
|
-
}, [
|
|
72
|
-
shouldDisableFocus,
|
|
73
|
-
state.selectionManager,
|
|
74
|
-
node.key
|
|
75
|
-
]);
|
|
76
|
-
return {
|
|
77
|
-
columnHeaderProps: {
|
|
78
|
-
...(0, $33PgG$reactariautils.mergeProps)(focusableProps, gridCellProps, pressProps, descriptionProps, // If the table is empty, make all column headers untabbable
|
|
79
|
-
shouldDisableFocus ? {
|
|
80
|
-
tabIndex: -1
|
|
81
|
-
} : null),
|
|
82
|
-
role: 'columnheader',
|
|
83
|
-
id: (0, $6acf696f746f932c$exports.getColumnHeaderId)(state, node.key),
|
|
84
|
-
'aria-colspan': node.colSpan && node.colSpan > 1 ? node.colSpan : undefined,
|
|
85
|
-
'aria-sort': ariaSort
|
|
86
|
-
},
|
|
87
|
-
isPressed: isPressed
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
//# sourceMappingURL=useTableColumnHeader.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAkCM,SAAS,0CAAwB,KAAoC,EAAE,KAAoB,EAAE,GAAuC;QAoBpH,uBACD;IApBpB,IAAI,QAAC,IAAI,EAAC,GAAG;IACb,IAAI,gBAAgB,KAAK,KAAK,CAAC,aAAa;IAC5C,4EAA4E;IAC5E,IAAI,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,gCAAU,EAAE;QAAC,GAAG,KAAK;QAAE,WAAW;IAAO,GAAG,OAAO;IAEzE,IAAI,0BAA0B,KAAK,KAAK,CAAC,eAAe,IAAI,MAAM,gBAAgB,CAAC,aAAa,KAAK;IAErG,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;QACrC,YAAY,CAAC,iBAAiB;QAC9B;YACE,MAAM,IAAI,CAAC,KAAK,GAAG;QACrB;aACA;IACF;IAEA,qFAAqF;IACrF,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,yCAAW,EAAE,CAAC,GAAG;IAExC,IAAI,WAAmD;IACvD,IAAI,iBAAiB,EAAA,wBAAA,MAAM,cAAc,cAApB,4CAAA,sBAAsB,MAAM,MAAK,KAAK,GAAG;IAC9D,IAAI,iBAAgB,yBAAA,MAAM,cAAc,cAApB,6CAAA,uBAAsB,SAAS;IACnD,8CAA8C;IAC9C,IAAI,KAAK,KAAK,CAAC,aAAa,IAAI,CAAC,CAAA,GAAA,+BAAQ,KACvC,WAAW,iBAAiB,gBAAgB;IAG9C,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,IAAI;IACJ,IAAI,eAAe;QACjB,kBAAkB,GAAG,gBAAgB,MAAM,CAAC,aAAa;QACzD,wGAAwG;QACxG,IAAI,kBAAkB,iBAAiB,CAAA,GAAA,+BAAQ,KAC7C,kBAAkB,GAAG,gBAAgB,EAAE,EAAE,gBAAgB,MAAM,CAAC,gBAAgB;IAEpF;IAEA,IAAI,mBAAmB,CAAA,GAAA,oCAAa,EAAE;IAEtC,IAAI,qBAAqB,MAAM,UAAU,CAAC,IAAI,KAAK;IACnD,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,sBAAsB,MAAM,gBAAgB,CAAC,UAAU,KAAK,KAAK,GAAG,EACtE,MAAM,gBAAgB,CAAC,aAAa,CAAC;IAEzC,GAAG;QAAC;QAAoB,MAAM,gBAAgB;QAAE,KAAK,GAAG;KAAC;IAEzD,OAAO;QACL,mBAAmB;YACjB,GAAG,CAAA,GAAA,gCAAS,EACV,gBACA,eACA,YACA,kBACA,4DAA4D;YAC5D,qBAAqB;gBAAC,UAAU;YAAE,IAAI,KACvC;YACD,MAAM;YACN,IAAI,CAAA,GAAA,2CAAgB,EAAE,OAAO,KAAK,GAAG;YACrC,gBAAgB,KAAK,OAAO,IAAI,KAAK,OAAO,GAAG,IAAI,KAAK,OAAO,GAAG;YAClE,aAAa;QACf;mBACA;IACF;AACF","sources":["packages/@react-aria/table/src/useTableColumnHeader.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 {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {getColumnHeaderId} from './utils';\nimport {GridNode} from '@react-types/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {isAndroid, mergeProps, useDescription} from '@react-aria/utils';\nimport {TableState} from '@react-stately/table';\nimport {useEffect} from 'react';\nimport {useFocusable, usePress} from '@react-aria/interactions';\nimport {useGridCell} from '@react-aria/grid';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTableColumnHeaderProps<T> {\n /** An object representing the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader). Contains all the relevant information that makes up the column header. */\n node: GridNode<T>,\n /** Whether the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader) is contained in a virtual scroller. */\n isVirtualized?: boolean\n}\n\nexport interface TableColumnHeaderAria {\n /** Props for the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader) element. */\n columnHeaderProps: DOMAttributes,\n /** Whether the column is currently in a pressed state. */\n isPressed: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for a column header in a table.\n * @param props - Props for the column header.\n * @param state - State of the table, as returned by `useTableState`.\n * @param ref - The ref attached to the column header element.\n */\nexport function useTableColumnHeader<T>(props: AriaTableColumnHeaderProps<T>, state: TableState<T>, ref: RefObject<FocusableElement | null>): TableColumnHeaderAria {\n let {node} = props;\n let allowsSorting = node.props.allowsSorting;\n // if there are no focusable children, the column header will focus the cell\n let {gridCellProps} = useGridCell({...props, focusMode: 'child'}, state, ref);\n\n let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === 'single';\n\n let {pressProps, isPressed} = usePress({\n isDisabled: !allowsSorting || isSelectionCellDisabled,\n onPress() {\n state.sort(node.key);\n },\n ref\n });\n\n // Needed to pick up the focusable context, enabling things like Tooltips for example\n let {focusableProps} = useFocusable({}, ref);\n\n let ariaSort: DOMAttributes['aria-sort'] | undefined = undefined;\n let isSortedColumn = state.sortDescriptor?.column === node.key;\n let sortDirection = state.sortDescriptor?.direction;\n // aria-sort not supported in Android Talkback\n if (node.props.allowsSorting && !isAndroid()) {\n ariaSort = isSortedColumn ? sortDirection : 'none';\n }\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n let sortDescription;\n if (allowsSorting) {\n sortDescription = `${stringFormatter.format('sortable')}`;\n // Android Talkback doesn't support aria-sort so we add sort order details to the aria-described by here\n if (isSortedColumn && sortDirection && isAndroid()) {\n sortDescription = `${sortDescription}, ${stringFormatter.format(sortDirection)}`;\n }\n }\n\n let descriptionProps = useDescription(sortDescription);\n\n let shouldDisableFocus = state.collection.size === 0;\n useEffect(() => {\n if (shouldDisableFocus && state.selectionManager.focusedKey === node.key) {\n state.selectionManager.setFocusedKey(null);\n }\n }, [shouldDisableFocus, state.selectionManager, node.key]);\n\n return {\n columnHeaderProps: {\n ...mergeProps(\n focusableProps,\n gridCellProps,\n pressProps,\n descriptionProps,\n // If the table is empty, make all column headers untabbable\n shouldDisableFocus ? {tabIndex: -1} : null\n ),\n role: 'columnheader',\n id: getColumnHeaderId(state, node.key),\n 'aria-colspan': node.colSpan && node.colSpan > 1 ? node.colSpan : undefined,\n 'aria-sort': ariaSort\n },\n isPressed\n };\n}\n"],"names":[],"version":3,"file":"useTableColumnHeader.main.js.map"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import {getColumnHeaderId as $2140fb2337097f2d$export$37cd4213f2ad742e} from "./utils.mjs";
|
|
2
|
-
import $cjB6b$intlStringsmodulejs from "./intlStrings.mjs";
|
|
3
|
-
import {isAndroid as $cjB6b$isAndroid, useDescription as $cjB6b$useDescription, mergeProps as $cjB6b$mergeProps} from "@react-aria/utils";
|
|
4
|
-
import {useEffect as $cjB6b$useEffect} from "react";
|
|
5
|
-
import {usePress as $cjB6b$usePress, useFocusable as $cjB6b$useFocusable} from "@react-aria/interactions";
|
|
6
|
-
import {useGridCell as $cjB6b$useGridCell} from "@react-aria/grid";
|
|
7
|
-
import {useLocalizedStringFormatter as $cjB6b$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function $parcel$interopDefault(a) {
|
|
11
|
-
return a && a.__esModule ? a.default : a;
|
|
12
|
-
}
|
|
13
|
-
/*
|
|
14
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
15
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
16
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
17
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
-
*
|
|
19
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
20
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
21
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
22
|
-
* governing permissions and limitations under the License.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
|
|
31
|
-
var _state_sortDescriptor, _state_sortDescriptor1;
|
|
32
|
-
let { node: node } = props;
|
|
33
|
-
let allowsSorting = node.props.allowsSorting;
|
|
34
|
-
// if there are no focusable children, the column header will focus the cell
|
|
35
|
-
let { gridCellProps: gridCellProps } = (0, $cjB6b$useGridCell)({
|
|
36
|
-
...props,
|
|
37
|
-
focusMode: 'child'
|
|
38
|
-
}, state, ref);
|
|
39
|
-
let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === 'single';
|
|
40
|
-
let { pressProps: pressProps, isPressed: isPressed } = (0, $cjB6b$usePress)({
|
|
41
|
-
isDisabled: !allowsSorting || isSelectionCellDisabled,
|
|
42
|
-
onPress () {
|
|
43
|
-
state.sort(node.key);
|
|
44
|
-
},
|
|
45
|
-
ref: ref
|
|
46
|
-
});
|
|
47
|
-
// Needed to pick up the focusable context, enabling things like Tooltips for example
|
|
48
|
-
let { focusableProps: focusableProps } = (0, $cjB6b$useFocusable)({}, ref);
|
|
49
|
-
let ariaSort = undefined;
|
|
50
|
-
let isSortedColumn = ((_state_sortDescriptor = state.sortDescriptor) === null || _state_sortDescriptor === void 0 ? void 0 : _state_sortDescriptor.column) === node.key;
|
|
51
|
-
let sortDirection = (_state_sortDescriptor1 = state.sortDescriptor) === null || _state_sortDescriptor1 === void 0 ? void 0 : _state_sortDescriptor1.direction;
|
|
52
|
-
// aria-sort not supported in Android Talkback
|
|
53
|
-
if (node.props.allowsSorting && !(0, $cjB6b$isAndroid)()) ariaSort = isSortedColumn ? sortDirection : 'none';
|
|
54
|
-
let stringFormatter = (0, $cjB6b$useLocalizedStringFormatter)((0, ($parcel$interopDefault($cjB6b$intlStringsmodulejs))), '@react-aria/table');
|
|
55
|
-
let sortDescription;
|
|
56
|
-
if (allowsSorting) {
|
|
57
|
-
sortDescription = `${stringFormatter.format('sortable')}`;
|
|
58
|
-
// Android Talkback doesn't support aria-sort so we add sort order details to the aria-described by here
|
|
59
|
-
if (isSortedColumn && sortDirection && (0, $cjB6b$isAndroid)()) sortDescription = `${sortDescription}, ${stringFormatter.format(sortDirection)}`;
|
|
60
|
-
}
|
|
61
|
-
let descriptionProps = (0, $cjB6b$useDescription)(sortDescription);
|
|
62
|
-
let shouldDisableFocus = state.collection.size === 0;
|
|
63
|
-
(0, $cjB6b$useEffect)(()=>{
|
|
64
|
-
if (shouldDisableFocus && state.selectionManager.focusedKey === node.key) state.selectionManager.setFocusedKey(null);
|
|
65
|
-
}, [
|
|
66
|
-
shouldDisableFocus,
|
|
67
|
-
state.selectionManager,
|
|
68
|
-
node.key
|
|
69
|
-
]);
|
|
70
|
-
return {
|
|
71
|
-
columnHeaderProps: {
|
|
72
|
-
...(0, $cjB6b$mergeProps)(focusableProps, gridCellProps, pressProps, descriptionProps, // If the table is empty, make all column headers untabbable
|
|
73
|
-
shouldDisableFocus ? {
|
|
74
|
-
tabIndex: -1
|
|
75
|
-
} : null),
|
|
76
|
-
role: 'columnheader',
|
|
77
|
-
id: (0, $2140fb2337097f2d$export$37cd4213f2ad742e)(state, node.key),
|
|
78
|
-
'aria-colspan': node.colSpan && node.colSpan > 1 ? node.colSpan : undefined,
|
|
79
|
-
'aria-sort': ariaSort
|
|
80
|
-
},
|
|
81
|
-
isPressed: isPressed
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
export {$f329116d8ad0aba0$export$9514819a8c81e960 as useTableColumnHeader};
|
|
87
|
-
//# sourceMappingURL=useTableColumnHeader.module.js.map
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import {getColumnHeaderId as $2140fb2337097f2d$export$37cd4213f2ad742e} from "./utils.module.js";
|
|
2
|
-
import $cjB6b$intlStringsmodulejs from "./intlStrings.module.js";
|
|
3
|
-
import {isAndroid as $cjB6b$isAndroid, useDescription as $cjB6b$useDescription, mergeProps as $cjB6b$mergeProps} from "@react-aria/utils";
|
|
4
|
-
import {useEffect as $cjB6b$useEffect} from "react";
|
|
5
|
-
import {usePress as $cjB6b$usePress, useFocusable as $cjB6b$useFocusable} from "@react-aria/interactions";
|
|
6
|
-
import {useGridCell as $cjB6b$useGridCell} from "@react-aria/grid";
|
|
7
|
-
import {useLocalizedStringFormatter as $cjB6b$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function $parcel$interopDefault(a) {
|
|
11
|
-
return a && a.__esModule ? a.default : a;
|
|
12
|
-
}
|
|
13
|
-
/*
|
|
14
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
15
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
16
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
17
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
-
*
|
|
19
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
20
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
21
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
22
|
-
* governing permissions and limitations under the License.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
|
|
31
|
-
var _state_sortDescriptor, _state_sortDescriptor1;
|
|
32
|
-
let { node: node } = props;
|
|
33
|
-
let allowsSorting = node.props.allowsSorting;
|
|
34
|
-
// if there are no focusable children, the column header will focus the cell
|
|
35
|
-
let { gridCellProps: gridCellProps } = (0, $cjB6b$useGridCell)({
|
|
36
|
-
...props,
|
|
37
|
-
focusMode: 'child'
|
|
38
|
-
}, state, ref);
|
|
39
|
-
let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === 'single';
|
|
40
|
-
let { pressProps: pressProps, isPressed: isPressed } = (0, $cjB6b$usePress)({
|
|
41
|
-
isDisabled: !allowsSorting || isSelectionCellDisabled,
|
|
42
|
-
onPress () {
|
|
43
|
-
state.sort(node.key);
|
|
44
|
-
},
|
|
45
|
-
ref: ref
|
|
46
|
-
});
|
|
47
|
-
// Needed to pick up the focusable context, enabling things like Tooltips for example
|
|
48
|
-
let { focusableProps: focusableProps } = (0, $cjB6b$useFocusable)({}, ref);
|
|
49
|
-
let ariaSort = undefined;
|
|
50
|
-
let isSortedColumn = ((_state_sortDescriptor = state.sortDescriptor) === null || _state_sortDescriptor === void 0 ? void 0 : _state_sortDescriptor.column) === node.key;
|
|
51
|
-
let sortDirection = (_state_sortDescriptor1 = state.sortDescriptor) === null || _state_sortDescriptor1 === void 0 ? void 0 : _state_sortDescriptor1.direction;
|
|
52
|
-
// aria-sort not supported in Android Talkback
|
|
53
|
-
if (node.props.allowsSorting && !(0, $cjB6b$isAndroid)()) ariaSort = isSortedColumn ? sortDirection : 'none';
|
|
54
|
-
let stringFormatter = (0, $cjB6b$useLocalizedStringFormatter)((0, ($parcel$interopDefault($cjB6b$intlStringsmodulejs))), '@react-aria/table');
|
|
55
|
-
let sortDescription;
|
|
56
|
-
if (allowsSorting) {
|
|
57
|
-
sortDescription = `${stringFormatter.format('sortable')}`;
|
|
58
|
-
// Android Talkback doesn't support aria-sort so we add sort order details to the aria-described by here
|
|
59
|
-
if (isSortedColumn && sortDirection && (0, $cjB6b$isAndroid)()) sortDescription = `${sortDescription}, ${stringFormatter.format(sortDirection)}`;
|
|
60
|
-
}
|
|
61
|
-
let descriptionProps = (0, $cjB6b$useDescription)(sortDescription);
|
|
62
|
-
let shouldDisableFocus = state.collection.size === 0;
|
|
63
|
-
(0, $cjB6b$useEffect)(()=>{
|
|
64
|
-
if (shouldDisableFocus && state.selectionManager.focusedKey === node.key) state.selectionManager.setFocusedKey(null);
|
|
65
|
-
}, [
|
|
66
|
-
shouldDisableFocus,
|
|
67
|
-
state.selectionManager,
|
|
68
|
-
node.key
|
|
69
|
-
]);
|
|
70
|
-
return {
|
|
71
|
-
columnHeaderProps: {
|
|
72
|
-
...(0, $cjB6b$mergeProps)(focusableProps, gridCellProps, pressProps, descriptionProps, // If the table is empty, make all column headers untabbable
|
|
73
|
-
shouldDisableFocus ? {
|
|
74
|
-
tabIndex: -1
|
|
75
|
-
} : null),
|
|
76
|
-
role: 'columnheader',
|
|
77
|
-
id: (0, $2140fb2337097f2d$export$37cd4213f2ad742e)(state, node.key),
|
|
78
|
-
'aria-colspan': node.colSpan && node.colSpan > 1 ? node.colSpan : undefined,
|
|
79
|
-
'aria-sort': ariaSort
|
|
80
|
-
},
|
|
81
|
-
isPressed: isPressed
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
export {$f329116d8ad0aba0$export$9514819a8c81e960 as useTableColumnHeader};
|
|
87
|
-
//# sourceMappingURL=useTableColumnHeader.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAkCM,SAAS,0CAAwB,KAAoC,EAAE,KAAoB,EAAE,GAAuC;QAoBpH,uBACD;IApBpB,IAAI,QAAC,IAAI,EAAC,GAAG;IACb,IAAI,gBAAgB,KAAK,KAAK,CAAC,aAAa;IAC5C,4EAA4E;IAC5E,IAAI,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,kBAAU,EAAE;QAAC,GAAG,KAAK;QAAE,WAAW;IAAO,GAAG,OAAO;IAEzE,IAAI,0BAA0B,KAAK,KAAK,CAAC,eAAe,IAAI,MAAM,gBAAgB,CAAC,aAAa,KAAK;IAErG,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QACrC,YAAY,CAAC,iBAAiB;QAC9B;YACE,MAAM,IAAI,CAAC,KAAK,GAAG;QACrB;aACA;IACF;IAEA,qFAAqF;IACrF,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE,CAAC,GAAG;IAExC,IAAI,WAAmD;IACvD,IAAI,iBAAiB,EAAA,wBAAA,MAAM,cAAc,cAApB,4CAAA,sBAAsB,MAAM,MAAK,KAAK,GAAG;IAC9D,IAAI,iBAAgB,yBAAA,MAAM,cAAc,cAApB,6CAAA,uBAAsB,SAAS;IACnD,8CAA8C;IAC9C,IAAI,KAAK,KAAK,CAAC,aAAa,IAAI,CAAC,CAAA,GAAA,gBAAQ,KACvC,WAAW,iBAAiB,gBAAgB;IAG9C,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI;IACJ,IAAI,eAAe;QACjB,kBAAkB,GAAG,gBAAgB,MAAM,CAAC,aAAa;QACzD,wGAAwG;QACxG,IAAI,kBAAkB,iBAAiB,CAAA,GAAA,gBAAQ,KAC7C,kBAAkB,GAAG,gBAAgB,EAAE,EAAE,gBAAgB,MAAM,CAAC,gBAAgB;IAEpF;IAEA,IAAI,mBAAmB,CAAA,GAAA,qBAAa,EAAE;IAEtC,IAAI,qBAAqB,MAAM,UAAU,CAAC,IAAI,KAAK;IACnD,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,sBAAsB,MAAM,gBAAgB,CAAC,UAAU,KAAK,KAAK,GAAG,EACtE,MAAM,gBAAgB,CAAC,aAAa,CAAC;IAEzC,GAAG;QAAC;QAAoB,MAAM,gBAAgB;QAAE,KAAK,GAAG;KAAC;IAEzD,OAAO;QACL,mBAAmB;YACjB,GAAG,CAAA,GAAA,iBAAS,EACV,gBACA,eACA,YACA,kBACA,4DAA4D;YAC5D,qBAAqB;gBAAC,UAAU;YAAE,IAAI,KACvC;YACD,MAAM;YACN,IAAI,CAAA,GAAA,yCAAgB,EAAE,OAAO,KAAK,GAAG;YACrC,gBAAgB,KAAK,OAAO,IAAI,KAAK,OAAO,GAAG,IAAI,KAAK,OAAO,GAAG;YAClE,aAAa;QACf;mBACA;IACF;AACF","sources":["packages/@react-aria/table/src/useTableColumnHeader.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 {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {getColumnHeaderId} from './utils';\nimport {GridNode} from '@react-types/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {isAndroid, mergeProps, useDescription} from '@react-aria/utils';\nimport {TableState} from '@react-stately/table';\nimport {useEffect} from 'react';\nimport {useFocusable, usePress} from '@react-aria/interactions';\nimport {useGridCell} from '@react-aria/grid';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTableColumnHeaderProps<T> {\n /** An object representing the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader). Contains all the relevant information that makes up the column header. */\n node: GridNode<T>,\n /** Whether the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader) is contained in a virtual scroller. */\n isVirtualized?: boolean\n}\n\nexport interface TableColumnHeaderAria {\n /** Props for the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader) element. */\n columnHeaderProps: DOMAttributes,\n /** Whether the column is currently in a pressed state. */\n isPressed: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for a column header in a table.\n * @param props - Props for the column header.\n * @param state - State of the table, as returned by `useTableState`.\n * @param ref - The ref attached to the column header element.\n */\nexport function useTableColumnHeader<T>(props: AriaTableColumnHeaderProps<T>, state: TableState<T>, ref: RefObject<FocusableElement | null>): TableColumnHeaderAria {\n let {node} = props;\n let allowsSorting = node.props.allowsSorting;\n // if there are no focusable children, the column header will focus the cell\n let {gridCellProps} = useGridCell({...props, focusMode: 'child'}, state, ref);\n\n let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === 'single';\n\n let {pressProps, isPressed} = usePress({\n isDisabled: !allowsSorting || isSelectionCellDisabled,\n onPress() {\n state.sort(node.key);\n },\n ref\n });\n\n // Needed to pick up the focusable context, enabling things like Tooltips for example\n let {focusableProps} = useFocusable({}, ref);\n\n let ariaSort: DOMAttributes['aria-sort'] | undefined = undefined;\n let isSortedColumn = state.sortDescriptor?.column === node.key;\n let sortDirection = state.sortDescriptor?.direction;\n // aria-sort not supported in Android Talkback\n if (node.props.allowsSorting && !isAndroid()) {\n ariaSort = isSortedColumn ? sortDirection : 'none';\n }\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n let sortDescription;\n if (allowsSorting) {\n sortDescription = `${stringFormatter.format('sortable')}`;\n // Android Talkback doesn't support aria-sort so we add sort order details to the aria-described by here\n if (isSortedColumn && sortDirection && isAndroid()) {\n sortDescription = `${sortDescription}, ${stringFormatter.format(sortDirection)}`;\n }\n }\n\n let descriptionProps = useDescription(sortDescription);\n\n let shouldDisableFocus = state.collection.size === 0;\n useEffect(() => {\n if (shouldDisableFocus && state.selectionManager.focusedKey === node.key) {\n state.selectionManager.setFocusedKey(null);\n }\n }, [shouldDisableFocus, state.selectionManager, node.key]);\n\n return {\n columnHeaderProps: {\n ...mergeProps(\n focusableProps,\n gridCellProps,\n pressProps,\n descriptionProps,\n // If the table is empty, make all column headers untabbable\n shouldDisableFocus ? {tabIndex: -1} : null\n ),\n role: 'columnheader',\n id: getColumnHeaderId(state, node.key),\n 'aria-colspan': node.colSpan && node.colSpan > 1 ? node.colSpan : undefined,\n 'aria-sort': ariaSort\n },\n isPressed\n };\n}\n"],"names":[],"version":3,"file":"useTableColumnHeader.module.js.map"}
|