@react-aria/gridlist 3.14.4 → 3.15.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.
Files changed (40) hide show
  1. package/dist/import.mjs +2 -8
  2. package/dist/main.js +5 -11
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +2 -8
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +3 -0
  7. package/package.json +15 -20
  8. package/src/index.ts +3 -7
  9. package/dist/types.d.ts +0 -135
  10. package/dist/types.d.ts.map +0 -1
  11. package/dist/useGridList.main.js +0 -83
  12. package/dist/useGridList.main.js.map +0 -1
  13. package/dist/useGridList.mjs +0 -78
  14. package/dist/useGridList.module.js +0 -78
  15. package/dist/useGridList.module.js.map +0 -1
  16. package/dist/useGridListItem.main.js +0 -305
  17. package/dist/useGridListItem.main.js.map +0 -1
  18. package/dist/useGridListItem.mjs +0 -300
  19. package/dist/useGridListItem.module.js +0 -300
  20. package/dist/useGridListItem.module.js.map +0 -1
  21. package/dist/useGridListSection.main.js +0 -43
  22. package/dist/useGridListSection.main.js.map +0 -1
  23. package/dist/useGridListSection.mjs +0 -38
  24. package/dist/useGridListSection.module.js +0 -38
  25. package/dist/useGridListSection.module.js.map +0 -1
  26. package/dist/useGridListSelectionCheckbox.main.js +0 -34
  27. package/dist/useGridListSelectionCheckbox.main.js.map +0 -1
  28. package/dist/useGridListSelectionCheckbox.mjs +0 -29
  29. package/dist/useGridListSelectionCheckbox.module.js +0 -29
  30. package/dist/useGridListSelectionCheckbox.module.js.map +0 -1
  31. package/dist/utils.main.js +0 -31
  32. package/dist/utils.main.js.map +0 -1
  33. package/dist/utils.mjs +0 -25
  34. package/dist/utils.module.js +0 -25
  35. package/dist/utils.module.js.map +0 -1
  36. package/src/useGridList.ts +0 -182
  37. package/src/useGridListItem.ts +0 -346
  38. package/src/useGridListSection.ts +0 -60
  39. package/src/useGridListSelectionCheckbox.ts +0 -32
  40. package/src/utils.ts +0 -43
package/src/utils.ts DELETED
@@ -1,43 +0,0 @@
1
- /*
2
- * Copyright 2020 Adobe. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */
12
-
13
- import {Key} from '@react-types/shared';
14
- import type {ListState} from '@react-stately/list';
15
-
16
- interface ListMapShared {
17
- id: string,
18
- onAction?: (key: Key) => void,
19
- linkBehavior?: 'action' | 'selection' | 'override',
20
- keyboardNavigationBehavior: 'arrow' | 'tab',
21
- shouldSelectOnPressUp?: boolean
22
- }
23
-
24
- // Used to share:
25
- // id of the list and onAction between useList, useListItem, and useListSelectionCheckbox
26
- export const listMap: WeakMap<ListState<unknown>, ListMapShared> = new WeakMap<ListState<unknown>, ListMapShared>();
27
-
28
- export function getRowId<T>(state: ListState<T>, key: Key): string {
29
- let {id} = listMap.get(state) ?? {};
30
- if (!id) {
31
- throw new Error('Unknown list');
32
- }
33
-
34
- return `${id}-${normalizeKey(key)}`;
35
- }
36
-
37
- export function normalizeKey(key: Key): string {
38
- if (typeof key === 'string') {
39
- return key.replace(/\s*/g, '');
40
- }
41
-
42
- return '' + key;
43
- }