@react-aria/listbox 3.15.3 → 3.16.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 +3 -7
- package/dist/main.js +7 -11
- package/dist/main.js.map +1 -1
- package/dist/module.js +3 -7
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +3 -0
- package/package.json +15 -19
- package/src/index.ts +3 -8
- package/dist/types.d.ts +0 -134
- package/dist/types.d.ts.map +0 -1
- package/dist/useListBox.main.js +0 -84
- package/dist/useListBox.main.js.map +0 -1
- package/dist/useListBox.mjs +0 -79
- package/dist/useListBox.module.js +0 -79
- package/dist/useListBox.module.js.map +0 -1
- package/dist/useListBoxSection.main.js +0 -47
- package/dist/useListBoxSection.main.js.map +0 -1
- package/dist/useListBoxSection.mjs +0 -42
- package/dist/useListBoxSection.module.js +0 -42
- package/dist/useListBoxSection.module.js.map +0 -1
- package/dist/useOption.main.js +0 -120
- package/dist/useOption.main.js.map +0 -1
- package/dist/useOption.mjs +0 -115
- package/dist/useOption.module.js +0 -115
- package/dist/useOption.module.js.map +0 -1
- package/dist/utils.main.js +0 -30
- package/dist/utils.main.js.map +0 -1
- package/dist/utils.mjs +0 -24
- package/dist/utils.module.js +0 -24
- package/dist/utils.module.js.map +0 -1
- package/src/useListBox.ts +0 -125
- package/src/useListBoxSection.ts +0 -65
- package/src/useOption.ts +0 -179
- package/src/utils.ts +0 -44
package/dist/import.mjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {useListBox as $
|
|
2
|
-
import {
|
|
3
|
-
import {useListBoxSection as $af383d3bef1cfdc9$export$c3f9f39876e4bc7} from "./useListBoxSection.mjs";
|
|
4
|
-
import {getItemId as $b1f0cad8af73213b$export$9145995848b05025, listData as $b1f0cad8af73213b$export$3585ede4d035bf14} from "./utils.mjs";
|
|
1
|
+
import {useListBox as $43f2200f5ef6be4e$re_export$useListBox, useOption as $43f2200f5ef6be4e$re_export$useOption, useListBoxSection as $43f2200f5ef6be4e$re_export$useListBoxSection} from "react-aria/useListBox";
|
|
2
|
+
import {listData as $43f2200f5ef6be4e$re_export$listData, getItemId as $43f2200f5ef6be4e$re_export$getItemId} from "react-aria/private/listbox/utils";
|
|
5
3
|
|
|
6
4
|
/*
|
|
7
5
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -17,7 +15,5 @@ import {getItemId as $b1f0cad8af73213b$export$9145995848b05025, listData as $b1f
|
|
|
17
15
|
|
|
18
16
|
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export {$c132121280ec012d$export$50eacbbf140a3141 as useListBox, $293f70390ea03370$export$497855f14858aa34 as useOption, $af383d3bef1cfdc9$export$c3f9f39876e4bc7 as useListBoxSection, $b1f0cad8af73213b$export$3585ede4d035bf14 as listData, $b1f0cad8af73213b$export$9145995848b05025 as getItemId};
|
|
18
|
+
export {$43f2200f5ef6be4e$re_export$useListBox as useListBox, $43f2200f5ef6be4e$re_export$useOption as useOption, $43f2200f5ef6be4e$re_export$useListBoxSection as useListBoxSection, $43f2200f5ef6be4e$re_export$listData as listData, $43f2200f5ef6be4e$re_export$getItemId as getItemId};
|
|
23
19
|
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $f32afd5f225c3320$exports = require("./useListBoxSection.main.js");
|
|
4
|
-
var $87beb89ab4a308fd$exports = require("./utils.main.js");
|
|
1
|
+
var $dtSeN$reactariauseListBox = require("react-aria/useListBox");
|
|
2
|
+
var $dtSeN$reactariaprivatelistboxutils = require("react-aria/private/listbox/utils");
|
|
5
3
|
|
|
6
4
|
|
|
7
5
|
function $parcel$export(e, n, v, s) {
|
|
8
6
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
9
7
|
}
|
|
10
8
|
|
|
11
|
-
$parcel$export(module.exports, "useListBox", ()
|
|
12
|
-
$parcel$export(module.exports, "useOption", ()
|
|
13
|
-
$parcel$export(module.exports, "useListBoxSection", ()
|
|
14
|
-
$parcel$export(module.exports, "listData", ()
|
|
15
|
-
$parcel$export(module.exports, "getItemId", ()
|
|
9
|
+
$parcel$export(module.exports, "useListBox", function () { return $dtSeN$reactariauseListBox.useListBox; });
|
|
10
|
+
$parcel$export(module.exports, "useOption", function () { return $dtSeN$reactariauseListBox.useOption; });
|
|
11
|
+
$parcel$export(module.exports, "useListBoxSection", function () { return $dtSeN$reactariauseListBox.useListBoxSection; });
|
|
12
|
+
$parcel$export(module.exports, "listData", function () { return $dtSeN$reactariaprivatelistboxutils.listData; });
|
|
13
|
+
$parcel$export(module.exports, "getItemId", function () { return $dtSeN$reactariaprivatelistboxutils.getItemId; });
|
|
16
14
|
/*
|
|
17
15
|
* Copyright 2020 Adobe. All rights reserved.
|
|
18
16
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -27,6 +25,4 @@ $parcel$export(module.exports, "getItemId", () => $87beb89ab4a308fd$exports.getI
|
|
|
27
25
|
|
|
28
26
|
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
28
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/listbox/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useListBox, useOption, useListBoxSection} from 'react-aria/useListBox';\n\nexport {listData, getItemId} from 'react-aria/private/listbox/utils';\nexport type {ListBoxProps, AriaListBoxPropsBase, AriaListBoxProps, AriaListBoxOptions, ListBoxAria, AriaOptionProps, OptionAria, AriaListBoxSectionProps, ListBoxSectionAria} from 'react-aria/useListBox';\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {useListBox as $
|
|
2
|
-
import {
|
|
3
|
-
import {useListBoxSection as $af383d3bef1cfdc9$export$c3f9f39876e4bc7} from "./useListBoxSection.module.js";
|
|
4
|
-
import {getItemId as $b1f0cad8af73213b$export$9145995848b05025, listData as $b1f0cad8af73213b$export$3585ede4d035bf14} from "./utils.module.js";
|
|
1
|
+
import {useListBox as $43f2200f5ef6be4e$re_export$useListBox, useOption as $43f2200f5ef6be4e$re_export$useOption, useListBoxSection as $43f2200f5ef6be4e$re_export$useListBoxSection} from "react-aria/useListBox";
|
|
2
|
+
import {listData as $43f2200f5ef6be4e$re_export$listData, getItemId as $43f2200f5ef6be4e$re_export$getItemId} from "react-aria/private/listbox/utils";
|
|
5
3
|
|
|
6
4
|
/*
|
|
7
5
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -17,7 +15,5 @@ import {getItemId as $b1f0cad8af73213b$export$9145995848b05025, listData as $b1f
|
|
|
17
15
|
|
|
18
16
|
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export {$c132121280ec012d$export$50eacbbf140a3141 as useListBox, $293f70390ea03370$export$497855f14858aa34 as useOption, $af383d3bef1cfdc9$export$c3f9f39876e4bc7 as useListBoxSection, $b1f0cad8af73213b$export$3585ede4d035bf14 as listData, $b1f0cad8af73213b$export$9145995848b05025 as getItemId};
|
|
18
|
+
export {$43f2200f5ef6be4e$re_export$useListBox as useListBox, $43f2200f5ef6be4e$re_export$useOption as useOption, $43f2200f5ef6be4e$re_export$useListBoxSection as useListBoxSection, $43f2200f5ef6be4e$re_export$listData as listData, $43f2200f5ef6be4e$re_export$getItemId as getItemId};
|
|
23
19
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/listbox/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useListBox, useOption, useListBoxSection} from 'react-aria/useListBox';\n\nexport {listData, getItemId} from 'react-aria/private/listbox/utils';\nexport type {ListBoxProps, AriaListBoxPropsBase, AriaListBoxProps, AriaListBoxOptions, ListBoxAria, AriaOptionProps, OptionAria, AriaListBoxSectionProps, ListBoxSectionAria} from 'react-aria/useListBox';\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { useListBox, useOption, useListBoxSection } from 'react-aria/useListBox';
|
|
2
|
+
export { listData, getItemId } from 'react-aria/private/listbox/utils';
|
|
3
|
+
export type { ListBoxProps, AriaListBoxPropsBase, AriaListBoxProps, AriaListBoxOptions, ListBoxAria, AriaOptionProps, OptionAria, AriaListBoxSectionProps, ListBoxSectionAria } from 'react-aria/useListBox';
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/listbox",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/module.js",
|
|
8
8
|
"exports": {
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"./dist/types.d.ts",
|
|
12
|
-
"./
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
9
|
+
".": {
|
|
10
|
+
"source": "./src/index.ts",
|
|
11
|
+
"types": "./dist/types/src/index.d.ts",
|
|
12
|
+
"import": "./dist/import.mjs",
|
|
13
|
+
"require": "./dist/main.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
16
|
},
|
|
17
|
-
"types": "dist/types.d.ts",
|
|
17
|
+
"types": "dist/types/src/index.d.ts",
|
|
18
18
|
"source": "src/index.ts",
|
|
19
19
|
"files": [
|
|
20
20
|
"dist",
|
|
@@ -26,15 +26,8 @@
|
|
|
26
26
|
"url": "https://github.com/adobe/react-spectrum"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@
|
|
30
|
-
"
|
|
31
|
-
"@react-aria/selection": "^3.27.2",
|
|
32
|
-
"@react-aria/utils": "^3.33.1",
|
|
33
|
-
"@react-stately/collections": "^3.12.10",
|
|
34
|
-
"@react-stately/list": "^3.13.4",
|
|
35
|
-
"@react-types/listbox": "^3.7.6",
|
|
36
|
-
"@react-types/shared": "^3.33.1",
|
|
37
|
-
"@swc/helpers": "^0.5.0"
|
|
29
|
+
"@swc/helpers": "^0.5.0",
|
|
30
|
+
"react-aria": "3.48.0"
|
|
38
31
|
},
|
|
39
32
|
"peerDependencies": {
|
|
40
33
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
@@ -43,5 +36,8 @@
|
|
|
43
36
|
"publishConfig": {
|
|
44
37
|
"access": "public"
|
|
45
38
|
},
|
|
46
|
-
"
|
|
39
|
+
"targets": {
|
|
40
|
+
"types": false
|
|
41
|
+
},
|
|
42
|
+
"gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
|
|
47
43
|
}
|
package/src/index.ts
CHANGED
|
@@ -10,12 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
export {useListBox} from '
|
|
14
|
-
export {useOption} from './useOption';
|
|
15
|
-
export {useListBoxSection} from './useListBoxSection';
|
|
16
|
-
export {listData, getItemId} from './utils';
|
|
13
|
+
export {useListBox, useOption, useListBoxSection} from 'react-aria/useListBox';
|
|
17
14
|
|
|
18
|
-
export
|
|
19
|
-
export type {AriaListBoxOptions, ListBoxAria} from '
|
|
20
|
-
export type {AriaOptionProps, OptionAria} from './useOption';
|
|
21
|
-
export type {AriaListBoxSectionProps, ListBoxSectionAria} from './useListBoxSection';
|
|
15
|
+
export {listData, getItemId} from 'react-aria/private/listbox/utils';
|
|
16
|
+
export type {ListBoxProps, AriaListBoxPropsBase, AriaListBoxProps, AriaListBoxOptions, ListBoxAria, AriaOptionProps, OptionAria, AriaListBoxSectionProps, ListBoxSectionAria} from 'react-aria/useListBox';
|
package/dist/types.d.ts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { Key, DOMAttributes, KeyboardDelegate, LayoutDelegate, RefObject, FocusableElement } from "@react-types/shared";
|
|
2
|
-
import { ListState } from "@react-stately/list";
|
|
3
|
-
import { AriaListBoxProps } from "@react-types/listbox";
|
|
4
|
-
import { SelectableItemStates } from "@react-aria/selection";
|
|
5
|
-
import { ReactNode } from "react";
|
|
6
|
-
interface ListData {
|
|
7
|
-
id?: string;
|
|
8
|
-
shouldSelectOnPressUp?: boolean;
|
|
9
|
-
shouldFocusOnHover?: boolean;
|
|
10
|
-
shouldUseVirtualFocus?: boolean;
|
|
11
|
-
isVirtualized?: boolean;
|
|
12
|
-
onAction?: (key: Key) => void;
|
|
13
|
-
linkBehavior?: 'action' | 'selection' | 'override';
|
|
14
|
-
}
|
|
15
|
-
export const listData: WeakMap<ListState<unknown>, ListData>;
|
|
16
|
-
export function getItemId<T>(state: ListState<T>, itemKey: Key): string;
|
|
17
|
-
export interface ListBoxAria {
|
|
18
|
-
/** Props for the listbox element. */
|
|
19
|
-
listBoxProps: DOMAttributes;
|
|
20
|
-
/** Props for the listbox's visual label element (if any). */
|
|
21
|
-
labelProps: DOMAttributes;
|
|
22
|
-
}
|
|
23
|
-
export interface AriaListBoxOptions<T> extends Omit<AriaListBoxProps<T>, 'children'> {
|
|
24
|
-
/** Whether the listbox uses virtual scrolling. */
|
|
25
|
-
isVirtualized?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* An optional keyboard delegate implementation for type to select,
|
|
28
|
-
* to override the default.
|
|
29
|
-
*/
|
|
30
|
-
keyboardDelegate?: KeyboardDelegate;
|
|
31
|
-
/**
|
|
32
|
-
* A delegate object that provides layout information for items in the collection.
|
|
33
|
-
* By default this uses the DOM, but this can be overridden to implement things like
|
|
34
|
-
* virtualized scrolling.
|
|
35
|
-
*/
|
|
36
|
-
layoutDelegate?: LayoutDelegate;
|
|
37
|
-
/**
|
|
38
|
-
* Whether the listbox items should use virtual focus instead of being focused directly.
|
|
39
|
-
*/
|
|
40
|
-
shouldUseVirtualFocus?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* The behavior of links in the collection.
|
|
43
|
-
* - 'action': link behaves like onAction.
|
|
44
|
-
* - 'selection': link follows selection interactions (e.g. if URL drives selection).
|
|
45
|
-
* - 'override': links override all other interactions (link items are not selectable).
|
|
46
|
-
* @default 'override'
|
|
47
|
-
*/
|
|
48
|
-
linkBehavior?: 'action' | 'selection' | 'override';
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Provides the behavior and accessibility implementation for a listbox component.
|
|
52
|
-
* A listbox displays a list of options and allows a user to select one or more of them.
|
|
53
|
-
* @param props - Props for the listbox.
|
|
54
|
-
* @param state - State for the listbox, as returned by `useListState`.
|
|
55
|
-
*/
|
|
56
|
-
export function useListBox<T>(props: AriaListBoxOptions<T>, state: ListState<T>, ref: RefObject<HTMLElement | null>): ListBoxAria;
|
|
57
|
-
export interface OptionAria extends SelectableItemStates {
|
|
58
|
-
/** Props for the option element. */
|
|
59
|
-
optionProps: DOMAttributes;
|
|
60
|
-
/** Props for the main text element inside the option. */
|
|
61
|
-
labelProps: DOMAttributes;
|
|
62
|
-
/** Props for the description text element inside the option, if any. */
|
|
63
|
-
descriptionProps: DOMAttributes;
|
|
64
|
-
/** Whether the option is currently focused. */
|
|
65
|
-
isFocused: boolean;
|
|
66
|
-
/** Whether the option is keyboard focused. */
|
|
67
|
-
isFocusVisible: boolean;
|
|
68
|
-
}
|
|
69
|
-
export interface AriaOptionProps {
|
|
70
|
-
/**
|
|
71
|
-
* Whether the option is disabled.
|
|
72
|
-
* @deprecated
|
|
73
|
-
*/
|
|
74
|
-
isDisabled?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Whether the option is selected.
|
|
77
|
-
* @deprecated
|
|
78
|
-
*/
|
|
79
|
-
isSelected?: boolean;
|
|
80
|
-
/** A screen reader only label for the option. */
|
|
81
|
-
'aria-label'?: string;
|
|
82
|
-
/** The unique key for the option. */
|
|
83
|
-
key: Key;
|
|
84
|
-
/**
|
|
85
|
-
* Whether selection should occur on press up instead of press down.
|
|
86
|
-
* @deprecated
|
|
87
|
-
*/
|
|
88
|
-
shouldSelectOnPressUp?: boolean;
|
|
89
|
-
/**
|
|
90
|
-
* Whether the option should be focused when the user hovers over it.
|
|
91
|
-
* @deprecated
|
|
92
|
-
*/
|
|
93
|
-
shouldFocusOnHover?: boolean;
|
|
94
|
-
/**
|
|
95
|
-
* Whether the option is contained in a virtual scrolling listbox.
|
|
96
|
-
* @deprecated
|
|
97
|
-
*/
|
|
98
|
-
isVirtualized?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Whether the option should use virtual focus instead of being focused directly.
|
|
101
|
-
* @deprecated
|
|
102
|
-
*/
|
|
103
|
-
shouldUseVirtualFocus?: boolean;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Provides the behavior and accessibility implementation for an option in a listbox.
|
|
107
|
-
* See `useListBox` for more details about listboxes.
|
|
108
|
-
* @param props - Props for the option.
|
|
109
|
-
* @param state - State for the listbox, as returned by `useListState`.
|
|
110
|
-
*/
|
|
111
|
-
export function useOption<T>(props: AriaOptionProps, state: ListState<T>, ref: RefObject<FocusableElement | null>): OptionAria;
|
|
112
|
-
export interface AriaListBoxSectionProps {
|
|
113
|
-
/** The heading for the section. */
|
|
114
|
-
heading?: ReactNode;
|
|
115
|
-
/** An accessibility label for the section. Required if `heading` is not present. */
|
|
116
|
-
'aria-label'?: string;
|
|
117
|
-
}
|
|
118
|
-
export interface ListBoxSectionAria {
|
|
119
|
-
/** Props for the wrapper list item. */
|
|
120
|
-
itemProps: DOMAttributes;
|
|
121
|
-
/** Props for the heading element, if any. */
|
|
122
|
-
headingProps: DOMAttributes;
|
|
123
|
-
/** Props for the group element. */
|
|
124
|
-
groupProps: DOMAttributes;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Provides the behavior and accessibility implementation for a section in a listbox.
|
|
128
|
-
* See `useListBox` for more details about listboxes.
|
|
129
|
-
* @param props - Props for the section.
|
|
130
|
-
*/
|
|
131
|
-
export function useListBoxSection(props: AriaListBoxSectionProps): ListBoxSectionAria;
|
|
132
|
-
export type { AriaListBoxProps } from '@react-types/listbox';
|
|
133
|
-
|
|
134
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"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","sources":["packages/@react-aria/listbox/src/packages/@react-aria/listbox/src/utils.ts","packages/@react-aria/listbox/src/packages/@react-aria/listbox/src/useListBox.ts","packages/@react-aria/listbox/src/packages/@react-aria/listbox/src/useOption.ts","packages/@react-aria/listbox/src/packages/@react-aria/listbox/src/useListBoxSection.ts","packages/@react-aria/listbox/src/packages/@react-aria/listbox/src/index.ts","packages/@react-aria/listbox/src/index.ts"],"sourcesContent":[null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useListBox} from './useListBox';\nexport {useOption} from './useOption';\nexport {useListBoxSection} from './useListBoxSection';\nexport {listData, getItemId} from './utils';\n\nexport type {AriaListBoxProps} from '@react-types/listbox';\nexport type {AriaListBoxOptions, ListBoxAria} from './useListBox';\nexport type {AriaOptionProps, OptionAria} from './useOption';\nexport type {AriaListBoxSectionProps, ListBoxSectionAria} from './useListBoxSection';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/dist/useListBox.main.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
var $87beb89ab4a308fd$exports = require("./utils.main.js");
|
|
2
|
-
var $eCULP$reactariautils = require("@react-aria/utils");
|
|
3
|
-
var $eCULP$reactariainteractions = require("@react-aria/interactions");
|
|
4
|
-
var $eCULP$reactarialabel = require("@react-aria/label");
|
|
5
|
-
var $eCULP$reactariaselection = require("@react-aria/selection");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function $parcel$export(e, n, v, s) {
|
|
9
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
$parcel$export(module.exports, "useListBox", () => $a3ce5bb3074610af$export$50eacbbf140a3141);
|
|
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
|
-
function $a3ce5bb3074610af$export$50eacbbf140a3141(props, state, ref) {
|
|
29
|
-
let domProps = (0, $eCULP$reactariautils.filterDOMProps)(props, {
|
|
30
|
-
labelable: true
|
|
31
|
-
});
|
|
32
|
-
// Use props instead of state here. We don't want this to change due to long press.
|
|
33
|
-
let selectionBehavior = props.selectionBehavior || 'toggle';
|
|
34
|
-
let linkBehavior = props.linkBehavior || (selectionBehavior === 'replace' ? 'action' : 'override');
|
|
35
|
-
if (selectionBehavior === 'toggle' && linkBehavior === 'action') // linkBehavior="action" does not work with selectionBehavior="toggle" because there is no way
|
|
36
|
-
// to initiate selection (checkboxes are not allowed inside a listbox). Link items will not be
|
|
37
|
-
// selectable in this configuration.
|
|
38
|
-
linkBehavior = 'override';
|
|
39
|
-
let { listProps: listProps } = (0, $eCULP$reactariaselection.useSelectableList)({
|
|
40
|
-
...props,
|
|
41
|
-
ref: ref,
|
|
42
|
-
selectionManager: state.selectionManager,
|
|
43
|
-
collection: state.collection,
|
|
44
|
-
disabledKeys: state.disabledKeys,
|
|
45
|
-
linkBehavior: linkBehavior
|
|
46
|
-
});
|
|
47
|
-
let { focusWithinProps: focusWithinProps } = (0, $eCULP$reactariainteractions.useFocusWithin)({
|
|
48
|
-
onFocusWithin: props.onFocus,
|
|
49
|
-
onBlurWithin: props.onBlur,
|
|
50
|
-
onFocusWithinChange: props.onFocusChange
|
|
51
|
-
});
|
|
52
|
-
// Share list id and some props with child options.
|
|
53
|
-
let id = (0, $eCULP$reactariautils.useId)(props.id);
|
|
54
|
-
(0, $87beb89ab4a308fd$exports.listData).set(state, {
|
|
55
|
-
id: id,
|
|
56
|
-
shouldUseVirtualFocus: props.shouldUseVirtualFocus,
|
|
57
|
-
shouldSelectOnPressUp: props.shouldSelectOnPressUp,
|
|
58
|
-
shouldFocusOnHover: props.shouldFocusOnHover,
|
|
59
|
-
isVirtualized: props.isVirtualized,
|
|
60
|
-
onAction: props.onAction,
|
|
61
|
-
linkBehavior: linkBehavior,
|
|
62
|
-
// @ts-ignore
|
|
63
|
-
UNSTABLE_itemBehavior: props['UNSTABLE_itemBehavior']
|
|
64
|
-
});
|
|
65
|
-
let { labelProps: labelProps, fieldProps: fieldProps } = (0, $eCULP$reactarialabel.useLabel)({
|
|
66
|
-
...props,
|
|
67
|
-
id: id,
|
|
68
|
-
// listbox is not an HTML input element so it
|
|
69
|
-
// shouldn't be labeled by a <label> element.
|
|
70
|
-
labelElementType: 'span'
|
|
71
|
-
});
|
|
72
|
-
return {
|
|
73
|
-
labelProps: labelProps,
|
|
74
|
-
listBoxProps: (0, $eCULP$reactariautils.mergeProps)(domProps, focusWithinProps, state.selectionManager.selectionMode === 'multiple' ? {
|
|
75
|
-
'aria-multiselectable': 'true'
|
|
76
|
-
} : {}, {
|
|
77
|
-
role: 'listbox',
|
|
78
|
-
...(0, $eCULP$reactariautils.mergeProps)(fieldProps, listProps)
|
|
79
|
-
})
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
//# sourceMappingURL=useListBox.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAwDM,SAAS,0CAAc,KAA4B,EAAE,KAAmB,EAAE,GAAkC;IACjH,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IACrD,mFAAmF;IACnF,IAAI,oBAAoB,MAAM,iBAAiB,IAAI;IACnD,IAAI,eAAe,MAAM,YAAY,IAAK,CAAA,sBAAsB,YAAY,WAAW,UAAS;IAChG,IAAI,sBAAsB,YAAY,iBAAiB,UACrD,8FAA8F;IAC9F,8FAA8F;IAC9F,oCAAoC;IACpC,eAAe;IAGjB,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,2CAAgB,EAAE;QAClC,GAAG,KAAK;aACR;QACA,kBAAkB,MAAM,gBAAgB;QACxC,YAAY,MAAM,UAAU;QAC5B,cAAc,MAAM,YAAY;sBAChC;IACF;IAEA,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,2CAAa,EAAE;QACtC,eAAe,MAAM,OAAO;QAC5B,cAAc,MAAM,MAAM;QAC1B,qBAAqB,MAAM,aAAa;IAC1C;IAEA,mDAAmD;IACnD,IAAI,KAAK,CAAA,GAAA,2BAAI,EAAE,MAAM,EAAE;IACvB,CAAA,GAAA,kCAAO,EAAE,GAAG,CAAC,OAAO;YAClB;QACA,uBAAuB,MAAM,qBAAqB;QAClD,uBAAuB,MAAM,qBAAqB;QAClD,oBAAoB,MAAM,kBAAkB;QAC5C,eAAe,MAAM,aAAa;QAClC,UAAU,MAAM,QAAQ;sBACxB;QACA,aAAa;QACb,uBAAuB,KAAK,CAAC,wBAAwB;IACvD;IAEA,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,8BAAO,EAAE;QACtC,GAAG,KAAK;YACR;QACA,6CAA6C;QAC7C,6CAA6C;QAC7C,kBAAkB;IACpB;IAEA,OAAO;oBACL;QACA,cAAc,CAAA,GAAA,gCAAS,EAAE,UAAU,kBAAkB,MAAM,gBAAgB,CAAC,aAAa,KAAK,aAAa;YACzG,wBAAwB;QAC1B,IAAI,CAAC,GAAG;YACN,MAAM;YACN,GAAG,CAAA,GAAA,gCAAS,EAAE,YAAY,UAAU;QACtC;IACF;AACF","sources":["packages/@react-aria/listbox/src/useListBox.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 {AriaListBoxProps} from '@react-types/listbox';\nimport {DOMAttributes, KeyboardDelegate, LayoutDelegate, RefObject} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, useId} from '@react-aria/utils';\nimport {listData} from './utils';\nimport {ListState} from '@react-stately/list';\nimport {useFocusWithin} from '@react-aria/interactions';\nimport {useLabel} from '@react-aria/label';\nimport {useSelectableList} from '@react-aria/selection';\n\nexport interface ListBoxAria {\n /** Props for the listbox element. */\n listBoxProps: DOMAttributes,\n /** Props for the listbox's visual label element (if any). */\n labelProps: DOMAttributes\n}\n\nexport interface AriaListBoxOptions<T> extends Omit<AriaListBoxProps<T>, 'children'> {\n /** Whether the listbox uses virtual scrolling. */\n isVirtualized?: boolean,\n\n /**\n * An optional keyboard delegate implementation for type to select,\n * to override the default.\n */\n keyboardDelegate?: KeyboardDelegate,\n\n /**\n * A delegate object that provides layout information for items in the collection.\n * By default this uses the DOM, but this can be overridden to implement things like\n * virtualized scrolling.\n */\n layoutDelegate?: LayoutDelegate,\n\n /**\n * Whether the listbox items should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n\n /**\n * The behavior of links in the collection.\n * - 'action': link behaves like onAction.\n * - 'selection': link follows selection interactions (e.g. if URL drives selection).\n * - 'override': links override all other interactions (link items are not selectable).\n * @default 'override'\n */\n linkBehavior?: 'action' | 'selection' | 'override'\n}\n\n/**\n * Provides the behavior and accessibility implementation for a listbox component.\n * A listbox displays a list of options and allows a user to select one or more of them.\n * @param props - Props for the listbox.\n * @param state - State for the listbox, as returned by `useListState`.\n */\nexport function useListBox<T>(props: AriaListBoxOptions<T>, state: ListState<T>, ref: RefObject<HTMLElement | null>): ListBoxAria {\n let domProps = filterDOMProps(props, {labelable: true});\n // Use props instead of state here. We don't want this to change due to long press.\n let selectionBehavior = props.selectionBehavior || 'toggle';\n let linkBehavior = props.linkBehavior || (selectionBehavior === 'replace' ? 'action' : 'override');\n if (selectionBehavior === 'toggle' && linkBehavior === 'action') {\n // linkBehavior=\"action\" does not work with selectionBehavior=\"toggle\" because there is no way\n // to initiate selection (checkboxes are not allowed inside a listbox). Link items will not be\n // selectable in this configuration.\n linkBehavior = 'override';\n }\n\n let {listProps} = useSelectableList({\n ...props,\n ref,\n selectionManager: state.selectionManager,\n collection: state.collection,\n disabledKeys: state.disabledKeys,\n linkBehavior\n });\n\n let {focusWithinProps} = useFocusWithin({\n onFocusWithin: props.onFocus,\n onBlurWithin: props.onBlur,\n onFocusWithinChange: props.onFocusChange\n });\n\n // Share list id and some props with child options.\n let id = useId(props.id);\n listData.set(state, {\n id,\n shouldUseVirtualFocus: props.shouldUseVirtualFocus,\n shouldSelectOnPressUp: props.shouldSelectOnPressUp,\n shouldFocusOnHover: props.shouldFocusOnHover,\n isVirtualized: props.isVirtualized,\n onAction: props.onAction,\n linkBehavior,\n // @ts-ignore\n UNSTABLE_itemBehavior: props['UNSTABLE_itemBehavior']\n });\n\n let {labelProps, fieldProps} = useLabel({\n ...props,\n id,\n // listbox is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: 'span'\n });\n\n return {\n labelProps,\n listBoxProps: mergeProps(domProps, focusWithinProps, state.selectionManager.selectionMode === 'multiple' ? {\n 'aria-multiselectable': 'true'\n } : {}, {\n role: 'listbox',\n ...mergeProps(fieldProps, listProps)\n })\n };\n}\n"],"names":[],"version":3,"file":"useListBox.main.js.map"}
|
package/dist/useListBox.mjs
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import {listData as $b1f0cad8af73213b$export$3585ede4d035bf14} from "./utils.mjs";
|
|
2
|
-
import {filterDOMProps as $by1yQ$filterDOMProps, useId as $by1yQ$useId, mergeProps as $by1yQ$mergeProps} from "@react-aria/utils";
|
|
3
|
-
import {useFocusWithin as $by1yQ$useFocusWithin} from "@react-aria/interactions";
|
|
4
|
-
import {useLabel as $by1yQ$useLabel} from "@react-aria/label";
|
|
5
|
-
import {useSelectableList as $by1yQ$useSelectableList} from "@react-aria/selection";
|
|
6
|
-
|
|
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
|
-
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function $c132121280ec012d$export$50eacbbf140a3141(props, state, ref) {
|
|
23
|
-
let domProps = (0, $by1yQ$filterDOMProps)(props, {
|
|
24
|
-
labelable: true
|
|
25
|
-
});
|
|
26
|
-
// Use props instead of state here. We don't want this to change due to long press.
|
|
27
|
-
let selectionBehavior = props.selectionBehavior || 'toggle';
|
|
28
|
-
let linkBehavior = props.linkBehavior || (selectionBehavior === 'replace' ? 'action' : 'override');
|
|
29
|
-
if (selectionBehavior === 'toggle' && linkBehavior === 'action') // linkBehavior="action" does not work with selectionBehavior="toggle" because there is no way
|
|
30
|
-
// to initiate selection (checkboxes are not allowed inside a listbox). Link items will not be
|
|
31
|
-
// selectable in this configuration.
|
|
32
|
-
linkBehavior = 'override';
|
|
33
|
-
let { listProps: listProps } = (0, $by1yQ$useSelectableList)({
|
|
34
|
-
...props,
|
|
35
|
-
ref: ref,
|
|
36
|
-
selectionManager: state.selectionManager,
|
|
37
|
-
collection: state.collection,
|
|
38
|
-
disabledKeys: state.disabledKeys,
|
|
39
|
-
linkBehavior: linkBehavior
|
|
40
|
-
});
|
|
41
|
-
let { focusWithinProps: focusWithinProps } = (0, $by1yQ$useFocusWithin)({
|
|
42
|
-
onFocusWithin: props.onFocus,
|
|
43
|
-
onBlurWithin: props.onBlur,
|
|
44
|
-
onFocusWithinChange: props.onFocusChange
|
|
45
|
-
});
|
|
46
|
-
// Share list id and some props with child options.
|
|
47
|
-
let id = (0, $by1yQ$useId)(props.id);
|
|
48
|
-
(0, $b1f0cad8af73213b$export$3585ede4d035bf14).set(state, {
|
|
49
|
-
id: id,
|
|
50
|
-
shouldUseVirtualFocus: props.shouldUseVirtualFocus,
|
|
51
|
-
shouldSelectOnPressUp: props.shouldSelectOnPressUp,
|
|
52
|
-
shouldFocusOnHover: props.shouldFocusOnHover,
|
|
53
|
-
isVirtualized: props.isVirtualized,
|
|
54
|
-
onAction: props.onAction,
|
|
55
|
-
linkBehavior: linkBehavior,
|
|
56
|
-
// @ts-ignore
|
|
57
|
-
UNSTABLE_itemBehavior: props['UNSTABLE_itemBehavior']
|
|
58
|
-
});
|
|
59
|
-
let { labelProps: labelProps, fieldProps: fieldProps } = (0, $by1yQ$useLabel)({
|
|
60
|
-
...props,
|
|
61
|
-
id: id,
|
|
62
|
-
// listbox is not an HTML input element so it
|
|
63
|
-
// shouldn't be labeled by a <label> element.
|
|
64
|
-
labelElementType: 'span'
|
|
65
|
-
});
|
|
66
|
-
return {
|
|
67
|
-
labelProps: labelProps,
|
|
68
|
-
listBoxProps: (0, $by1yQ$mergeProps)(domProps, focusWithinProps, state.selectionManager.selectionMode === 'multiple' ? {
|
|
69
|
-
'aria-multiselectable': 'true'
|
|
70
|
-
} : {}, {
|
|
71
|
-
role: 'listbox',
|
|
72
|
-
...(0, $by1yQ$mergeProps)(fieldProps, listProps)
|
|
73
|
-
})
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
export {$c132121280ec012d$export$50eacbbf140a3141 as useListBox};
|
|
79
|
-
//# sourceMappingURL=useListBox.module.js.map
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import {listData as $b1f0cad8af73213b$export$3585ede4d035bf14} from "./utils.module.js";
|
|
2
|
-
import {filterDOMProps as $by1yQ$filterDOMProps, useId as $by1yQ$useId, mergeProps as $by1yQ$mergeProps} from "@react-aria/utils";
|
|
3
|
-
import {useFocusWithin as $by1yQ$useFocusWithin} from "@react-aria/interactions";
|
|
4
|
-
import {useLabel as $by1yQ$useLabel} from "@react-aria/label";
|
|
5
|
-
import {useSelectableList as $by1yQ$useSelectableList} from "@react-aria/selection";
|
|
6
|
-
|
|
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
|
-
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function $c132121280ec012d$export$50eacbbf140a3141(props, state, ref) {
|
|
23
|
-
let domProps = (0, $by1yQ$filterDOMProps)(props, {
|
|
24
|
-
labelable: true
|
|
25
|
-
});
|
|
26
|
-
// Use props instead of state here. We don't want this to change due to long press.
|
|
27
|
-
let selectionBehavior = props.selectionBehavior || 'toggle';
|
|
28
|
-
let linkBehavior = props.linkBehavior || (selectionBehavior === 'replace' ? 'action' : 'override');
|
|
29
|
-
if (selectionBehavior === 'toggle' && linkBehavior === 'action') // linkBehavior="action" does not work with selectionBehavior="toggle" because there is no way
|
|
30
|
-
// to initiate selection (checkboxes are not allowed inside a listbox). Link items will not be
|
|
31
|
-
// selectable in this configuration.
|
|
32
|
-
linkBehavior = 'override';
|
|
33
|
-
let { listProps: listProps } = (0, $by1yQ$useSelectableList)({
|
|
34
|
-
...props,
|
|
35
|
-
ref: ref,
|
|
36
|
-
selectionManager: state.selectionManager,
|
|
37
|
-
collection: state.collection,
|
|
38
|
-
disabledKeys: state.disabledKeys,
|
|
39
|
-
linkBehavior: linkBehavior
|
|
40
|
-
});
|
|
41
|
-
let { focusWithinProps: focusWithinProps } = (0, $by1yQ$useFocusWithin)({
|
|
42
|
-
onFocusWithin: props.onFocus,
|
|
43
|
-
onBlurWithin: props.onBlur,
|
|
44
|
-
onFocusWithinChange: props.onFocusChange
|
|
45
|
-
});
|
|
46
|
-
// Share list id and some props with child options.
|
|
47
|
-
let id = (0, $by1yQ$useId)(props.id);
|
|
48
|
-
(0, $b1f0cad8af73213b$export$3585ede4d035bf14).set(state, {
|
|
49
|
-
id: id,
|
|
50
|
-
shouldUseVirtualFocus: props.shouldUseVirtualFocus,
|
|
51
|
-
shouldSelectOnPressUp: props.shouldSelectOnPressUp,
|
|
52
|
-
shouldFocusOnHover: props.shouldFocusOnHover,
|
|
53
|
-
isVirtualized: props.isVirtualized,
|
|
54
|
-
onAction: props.onAction,
|
|
55
|
-
linkBehavior: linkBehavior,
|
|
56
|
-
// @ts-ignore
|
|
57
|
-
UNSTABLE_itemBehavior: props['UNSTABLE_itemBehavior']
|
|
58
|
-
});
|
|
59
|
-
let { labelProps: labelProps, fieldProps: fieldProps } = (0, $by1yQ$useLabel)({
|
|
60
|
-
...props,
|
|
61
|
-
id: id,
|
|
62
|
-
// listbox is not an HTML input element so it
|
|
63
|
-
// shouldn't be labeled by a <label> element.
|
|
64
|
-
labelElementType: 'span'
|
|
65
|
-
});
|
|
66
|
-
return {
|
|
67
|
-
labelProps: labelProps,
|
|
68
|
-
listBoxProps: (0, $by1yQ$mergeProps)(domProps, focusWithinProps, state.selectionManager.selectionMode === 'multiple' ? {
|
|
69
|
-
'aria-multiselectable': 'true'
|
|
70
|
-
} : {}, {
|
|
71
|
-
role: 'listbox',
|
|
72
|
-
...(0, $by1yQ$mergeProps)(fieldProps, listProps)
|
|
73
|
-
})
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
export {$c132121280ec012d$export$50eacbbf140a3141 as useListBox};
|
|
79
|
-
//# sourceMappingURL=useListBox.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAwDM,SAAS,0CAAc,KAA4B,EAAE,KAAmB,EAAE,GAAkC;IACjH,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IACrD,mFAAmF;IACnF,IAAI,oBAAoB,MAAM,iBAAiB,IAAI;IACnD,IAAI,eAAe,MAAM,YAAY,IAAK,CAAA,sBAAsB,YAAY,WAAW,UAAS;IAChG,IAAI,sBAAsB,YAAY,iBAAiB,UACrD,8FAA8F;IAC9F,8FAA8F;IAC9F,oCAAoC;IACpC,eAAe;IAGjB,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE;QAClC,GAAG,KAAK;aACR;QACA,kBAAkB,MAAM,gBAAgB;QACxC,YAAY,MAAM,UAAU;QAC5B,cAAc,MAAM,YAAY;sBAChC;IACF;IAEA,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;QACtC,eAAe,MAAM,OAAO;QAC5B,cAAc,MAAM,MAAM;QAC1B,qBAAqB,MAAM,aAAa;IAC1C;IAEA,mDAAmD;IACnD,IAAI,KAAK,CAAA,GAAA,YAAI,EAAE,MAAM,EAAE;IACvB,CAAA,GAAA,yCAAO,EAAE,GAAG,CAAC,OAAO;YAClB;QACA,uBAAuB,MAAM,qBAAqB;QAClD,uBAAuB,MAAM,qBAAqB;QAClD,oBAAoB,MAAM,kBAAkB;QAC5C,eAAe,MAAM,aAAa;QAClC,UAAU,MAAM,QAAQ;sBACxB;QACA,aAAa;QACb,uBAAuB,KAAK,CAAC,wBAAwB;IACvD;IAEA,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QACtC,GAAG,KAAK;YACR;QACA,6CAA6C;QAC7C,6CAA6C;QAC7C,kBAAkB;IACpB;IAEA,OAAO;oBACL;QACA,cAAc,CAAA,GAAA,iBAAS,EAAE,UAAU,kBAAkB,MAAM,gBAAgB,CAAC,aAAa,KAAK,aAAa;YACzG,wBAAwB;QAC1B,IAAI,CAAC,GAAG;YACN,MAAM;YACN,GAAG,CAAA,GAAA,iBAAS,EAAE,YAAY,UAAU;QACtC;IACF;AACF","sources":["packages/@react-aria/listbox/src/useListBox.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 {AriaListBoxProps} from '@react-types/listbox';\nimport {DOMAttributes, KeyboardDelegate, LayoutDelegate, RefObject} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, useId} from '@react-aria/utils';\nimport {listData} from './utils';\nimport {ListState} from '@react-stately/list';\nimport {useFocusWithin} from '@react-aria/interactions';\nimport {useLabel} from '@react-aria/label';\nimport {useSelectableList} from '@react-aria/selection';\n\nexport interface ListBoxAria {\n /** Props for the listbox element. */\n listBoxProps: DOMAttributes,\n /** Props for the listbox's visual label element (if any). */\n labelProps: DOMAttributes\n}\n\nexport interface AriaListBoxOptions<T> extends Omit<AriaListBoxProps<T>, 'children'> {\n /** Whether the listbox uses virtual scrolling. */\n isVirtualized?: boolean,\n\n /**\n * An optional keyboard delegate implementation for type to select,\n * to override the default.\n */\n keyboardDelegate?: KeyboardDelegate,\n\n /**\n * A delegate object that provides layout information for items in the collection.\n * By default this uses the DOM, but this can be overridden to implement things like\n * virtualized scrolling.\n */\n layoutDelegate?: LayoutDelegate,\n\n /**\n * Whether the listbox items should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n\n /**\n * The behavior of links in the collection.\n * - 'action': link behaves like onAction.\n * - 'selection': link follows selection interactions (e.g. if URL drives selection).\n * - 'override': links override all other interactions (link items are not selectable).\n * @default 'override'\n */\n linkBehavior?: 'action' | 'selection' | 'override'\n}\n\n/**\n * Provides the behavior and accessibility implementation for a listbox component.\n * A listbox displays a list of options and allows a user to select one or more of them.\n * @param props - Props for the listbox.\n * @param state - State for the listbox, as returned by `useListState`.\n */\nexport function useListBox<T>(props: AriaListBoxOptions<T>, state: ListState<T>, ref: RefObject<HTMLElement | null>): ListBoxAria {\n let domProps = filterDOMProps(props, {labelable: true});\n // Use props instead of state here. We don't want this to change due to long press.\n let selectionBehavior = props.selectionBehavior || 'toggle';\n let linkBehavior = props.linkBehavior || (selectionBehavior === 'replace' ? 'action' : 'override');\n if (selectionBehavior === 'toggle' && linkBehavior === 'action') {\n // linkBehavior=\"action\" does not work with selectionBehavior=\"toggle\" because there is no way\n // to initiate selection (checkboxes are not allowed inside a listbox). Link items will not be\n // selectable in this configuration.\n linkBehavior = 'override';\n }\n\n let {listProps} = useSelectableList({\n ...props,\n ref,\n selectionManager: state.selectionManager,\n collection: state.collection,\n disabledKeys: state.disabledKeys,\n linkBehavior\n });\n\n let {focusWithinProps} = useFocusWithin({\n onFocusWithin: props.onFocus,\n onBlurWithin: props.onBlur,\n onFocusWithinChange: props.onFocusChange\n });\n\n // Share list id and some props with child options.\n let id = useId(props.id);\n listData.set(state, {\n id,\n shouldUseVirtualFocus: props.shouldUseVirtualFocus,\n shouldSelectOnPressUp: props.shouldSelectOnPressUp,\n shouldFocusOnHover: props.shouldFocusOnHover,\n isVirtualized: props.isVirtualized,\n onAction: props.onAction,\n linkBehavior,\n // @ts-ignore\n UNSTABLE_itemBehavior: props['UNSTABLE_itemBehavior']\n });\n\n let {labelProps, fieldProps} = useLabel({\n ...props,\n id,\n // listbox is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: 'span'\n });\n\n return {\n labelProps,\n listBoxProps: mergeProps(domProps, focusWithinProps, state.selectionManager.selectionMode === 'multiple' ? {\n 'aria-multiselectable': 'true'\n } : {}, {\n role: 'listbox',\n ...mergeProps(fieldProps, listProps)\n })\n };\n}\n"],"names":[],"version":3,"file":"useListBox.module.js.map"}
|