@react-aria/listbox 3.4.1 → 3.4.3-nightly.3120

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/main.js CHANGED
@@ -1,8 +1,8 @@
1
- var $cCiqH$reactariautils = require("@react-aria/utils");
2
- var $cCiqH$reactariainteractions = require("@react-aria/interactions");
3
- var $cCiqH$reactarialabel = require("@react-aria/label");
4
- var $cCiqH$reactariaselection = require("@react-aria/selection");
5
- var $cCiqH$reactstatelycollections = require("@react-stately/collections");
1
+ var $eFCLV$reactariautils = require("@react-aria/utils");
2
+ var $eFCLV$reactariainteractions = require("@react-aria/interactions");
3
+ var $eFCLV$reactarialabel = require("@react-aria/label");
4
+ var $eFCLV$reactariaselection = require("@react-aria/selection");
5
+ var $eFCLV$reactstatelycollections = require("@react-stately/collections");
6
6
 
7
7
  function $parcel$exportWildcard(dest, source) {
8
8
  Object.keys(source).forEach(function(key) {
@@ -23,23 +23,23 @@ function $parcel$exportWildcard(dest, source) {
23
23
  function $parcel$export(e, n, v, s) {
24
24
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
25
25
  }
26
- var $791342f030d1fc2c$exports = {};
26
+ var $a3ce5bb3074610af$exports = {};
27
27
 
28
- $parcel$export($791342f030d1fc2c$exports, "useListBox", () => $791342f030d1fc2c$export$50eacbbf140a3141);
28
+ $parcel$export($a3ce5bb3074610af$exports, "useListBox", () => $a3ce5bb3074610af$export$50eacbbf140a3141);
29
29
 
30
- var $55ba9445af8053ba$exports = {};
30
+ var $87beb89ab4a308fd$exports = {};
31
31
 
32
- $parcel$export($55ba9445af8053ba$exports, "listData", () => $55ba9445af8053ba$export$3585ede4d035bf14);
33
- $parcel$export($55ba9445af8053ba$exports, "getItemId", () => $55ba9445af8053ba$export$9145995848b05025);
34
- const $55ba9445af8053ba$export$3585ede4d035bf14 = new WeakMap();
35
- function $55ba9445af8053ba$var$normalizeKey(key) {
32
+ $parcel$export($87beb89ab4a308fd$exports, "listData", () => $87beb89ab4a308fd$export$3585ede4d035bf14);
33
+ $parcel$export($87beb89ab4a308fd$exports, "getItemId", () => $87beb89ab4a308fd$export$9145995848b05025);
34
+ const $87beb89ab4a308fd$export$3585ede4d035bf14 = new WeakMap();
35
+ function $87beb89ab4a308fd$var$normalizeKey(key) {
36
36
  if (typeof key === 'string') return key.replace(/\s*/g, '');
37
37
  return '' + key;
38
38
  }
39
- function $55ba9445af8053ba$export$9145995848b05025(state, itemKey) {
40
- let data = $55ba9445af8053ba$export$3585ede4d035bf14.get(state);
39
+ function $87beb89ab4a308fd$export$9145995848b05025(state, itemKey) {
40
+ let data = $87beb89ab4a308fd$export$3585ede4d035bf14.get(state);
41
41
  if (!data) throw new Error('Unknown list');
42
- return `${data.id}-option-${$55ba9445af8053ba$var$normalizeKey(itemKey)}`;
42
+ return `${data.id}-option-${$87beb89ab4a308fd$var$normalizeKey(itemKey)}`;
43
43
  }
44
44
 
45
45
 
@@ -47,32 +47,32 @@ function $55ba9445af8053ba$export$9145995848b05025(state, itemKey) {
47
47
 
48
48
 
49
49
 
50
- function $791342f030d1fc2c$export$50eacbbf140a3141(props, state, ref) {
51
- let domProps = $cCiqH$reactariautils.filterDOMProps(props, {
50
+ function $a3ce5bb3074610af$export$50eacbbf140a3141(props, state, ref) {
51
+ let domProps = $eFCLV$reactariautils.filterDOMProps(props, {
52
52
  labelable: true
53
53
  });
54
- let { listProps: listProps } = $cCiqH$reactariaselection.useSelectableList({
54
+ let { listProps: listProps } = $eFCLV$reactariaselection.useSelectableList({
55
55
  ...props,
56
56
  ref: ref,
57
57
  selectionManager: state.selectionManager,
58
58
  collection: state.collection,
59
59
  disabledKeys: state.disabledKeys
60
60
  });
61
- let { focusWithinProps: focusWithinProps } = $cCiqH$reactariainteractions.useFocusWithin({
61
+ let { focusWithinProps: focusWithinProps } = $eFCLV$reactariainteractions.useFocusWithin({
62
62
  onFocusWithin: props.onFocus,
63
63
  onBlurWithin: props.onBlur,
64
64
  onFocusWithinChange: props.onFocusChange
65
65
  });
66
66
  // Share list id and some props with child options.
67
- let id = $cCiqH$reactariautils.useId(props.id);
68
- $55ba9445af8053ba$export$3585ede4d035bf14.set(state, {
67
+ let id = $eFCLV$reactariautils.useId(props.id);
68
+ $87beb89ab4a308fd$export$3585ede4d035bf14.set(state, {
69
69
  id: id,
70
70
  shouldUseVirtualFocus: props.shouldUseVirtualFocus,
71
71
  shouldSelectOnPressUp: props.shouldSelectOnPressUp,
72
72
  shouldFocusOnHover: props.shouldFocusOnHover,
73
73
  isVirtualized: props.isVirtualized
74
74
  });
75
- let { labelProps: labelProps , fieldProps: fieldProps } = $cCiqH$reactarialabel.useLabel({
75
+ let { labelProps: labelProps , fieldProps: fieldProps } = $eFCLV$reactarialabel.useLabel({
76
76
  ...props,
77
77
  id: id,
78
78
  // listbox is not an HTML input element so it
@@ -81,37 +81,43 @@ function $791342f030d1fc2c$export$50eacbbf140a3141(props, state, ref) {
81
81
  });
82
82
  return {
83
83
  labelProps: labelProps,
84
- listBoxProps: $cCiqH$reactariautils.mergeProps(domProps, focusWithinProps, state.selectionManager.selectionMode === 'multiple' ? {
84
+ listBoxProps: $eFCLV$reactariautils.mergeProps(domProps, focusWithinProps, state.selectionManager.selectionMode === 'multiple' ? {
85
85
  'aria-multiselectable': 'true'
86
86
  } : {
87
87
  }, {
88
88
  role: 'listbox',
89
- ...$cCiqH$reactariautils.mergeProps(fieldProps, listProps)
89
+ ...$eFCLV$reactariautils.mergeProps(fieldProps, listProps)
90
90
  })
91
91
  };
92
92
  }
93
93
 
94
94
 
95
- var $379f8fed3835a355$exports = {};
95
+ var $c164f9f79f4cef2d$exports = {};
96
96
 
97
- $parcel$export($379f8fed3835a355$exports, "useOption", () => $379f8fed3835a355$export$497855f14858aa34);
97
+ $parcel$export($c164f9f79f4cef2d$exports, "useOption", () => $c164f9f79f4cef2d$export$497855f14858aa34);
98
98
 
99
99
 
100
100
 
101
101
 
102
102
 
103
- function $379f8fed3835a355$export$497855f14858aa34(props, state, ref) {
103
+ function $c164f9f79f4cef2d$export$497855f14858aa34(props, state, ref) {
104
104
  let { key: key } = props;
105
- let data = $55ba9445af8053ba$export$3585ede4d035bf14.get(state);
106
- let isDisabled = props.isDisabled ?? state.disabledKeys.has(key);
107
- let isSelected = props.isSelected ?? state.selectionManager.isSelected(key);
105
+ let data = $87beb89ab4a308fd$export$3585ede4d035bf14.get(state);
106
+ var _isDisabled;
107
+ let isDisabled = (_isDisabled = props.isDisabled) !== null && _isDisabled !== void 0 ? _isDisabled : state.disabledKeys.has(key);
108
+ var _isSelected;
109
+ let isSelected = (_isSelected = props.isSelected) !== null && _isSelected !== void 0 ? _isSelected : state.selectionManager.isSelected(key);
108
110
  let isFocused = state.selectionManager.focusedKey === key;
109
- let shouldSelectOnPressUp = props.shouldSelectOnPressUp ?? data.shouldSelectOnPressUp;
110
- let shouldFocusOnHover = props.shouldFocusOnHover ?? data.shouldFocusOnHover;
111
- let shouldUseVirtualFocus = props.shouldUseVirtualFocus ?? data.shouldUseVirtualFocus;
112
- let isVirtualized = props.isVirtualized ?? data.isVirtualized;
113
- let labelId = $cCiqH$reactariautils.useSlotId();
114
- let descriptionId = $cCiqH$reactariautils.useSlotId();
111
+ var _shouldSelectOnPressUp;
112
+ let shouldSelectOnPressUp = (_shouldSelectOnPressUp = props.shouldSelectOnPressUp) !== null && _shouldSelectOnPressUp !== void 0 ? _shouldSelectOnPressUp : data.shouldSelectOnPressUp;
113
+ var _shouldFocusOnHover;
114
+ let shouldFocusOnHover = (_shouldFocusOnHover = props.shouldFocusOnHover) !== null && _shouldFocusOnHover !== void 0 ? _shouldFocusOnHover : data.shouldFocusOnHover;
115
+ var _shouldUseVirtualFocus;
116
+ let shouldUseVirtualFocus = (_shouldUseVirtualFocus = props.shouldUseVirtualFocus) !== null && _shouldUseVirtualFocus !== void 0 ? _shouldUseVirtualFocus : data.shouldUseVirtualFocus;
117
+ var _isVirtualized;
118
+ let isVirtualized = (_isVirtualized = props.isVirtualized) !== null && _isVirtualized !== void 0 ? _isVirtualized : data.isVirtualized;
119
+ let labelId = $eFCLV$reactariautils.useSlotId();
120
+ let descriptionId = $eFCLV$reactariautils.useSlotId();
115
121
  let optionProps = {
116
122
  role: 'option',
117
123
  'aria-disabled': isDisabled,
@@ -120,16 +126,16 @@ function $379f8fed3835a355$export$497855f14858aa34(props, state, ref) {
120
126
  // Safari with VoiceOver on macOS misreads options with aria-labelledby or aria-label as simply "text".
121
127
  // We should not map slots to the label and description on Safari and instead just have VoiceOver read the textContent.
122
128
  // https://bugs.webkit.org/show_bug.cgi?id=209279
123
- if (!($cCiqH$reactariautils.isMac() && $cCiqH$reactariautils.isWebKit())) {
129
+ if (!($eFCLV$reactariautils.isMac() && $eFCLV$reactariautils.isWebKit())) {
124
130
  optionProps['aria-label'] = props['aria-label'];
125
131
  optionProps['aria-labelledby'] = labelId;
126
132
  optionProps['aria-describedby'] = descriptionId;
127
133
  }
128
134
  if (isVirtualized) {
129
135
  optionProps['aria-posinset'] = state.collection.getItem(key).index + 1;
130
- optionProps['aria-setsize'] = $cCiqH$reactstatelycollections.getItemCount(state.collection);
136
+ optionProps['aria-setsize'] = $eFCLV$reactstatelycollections.getItemCount(state.collection);
131
137
  }
132
- let { itemProps: itemProps , isPressed: isPressed } = $cCiqH$reactariaselection.useSelectableItem({
138
+ let { itemProps: itemProps , isPressed: isPressed } = $eFCLV$reactariaselection.useSelectableItem({
133
139
  selectionManager: state.selectionManager,
134
140
  key: key,
135
141
  ref: ref,
@@ -138,10 +144,10 @@ function $379f8fed3835a355$export$497855f14858aa34(props, state, ref) {
138
144
  shouldUseVirtualFocus: shouldUseVirtualFocus,
139
145
  isDisabled: isDisabled
140
146
  });
141
- let { hoverProps: hoverProps } = $cCiqH$reactariainteractions.useHover({
147
+ let { hoverProps: hoverProps } = $eFCLV$reactariainteractions.useHover({
142
148
  isDisabled: isDisabled || !shouldFocusOnHover,
143
149
  onHoverStart () {
144
- if (!$cCiqH$reactariainteractions.isFocusVisible()) {
150
+ if (!$eFCLV$reactariainteractions.isFocusVisible()) {
145
151
  state.selectionManager.setFocused(true);
146
152
  state.selectionManager.setFocusedKey(key);
147
153
  }
@@ -150,8 +156,8 @@ function $379f8fed3835a355$export$497855f14858aa34(props, state, ref) {
150
156
  return {
151
157
  optionProps: {
152
158
  ...optionProps,
153
- ...$cCiqH$reactariautils.mergeProps(itemProps, hoverProps),
154
- id: $55ba9445af8053ba$export$9145995848b05025(state, key)
159
+ ...$eFCLV$reactariautils.mergeProps(itemProps, hoverProps),
160
+ id: $87beb89ab4a308fd$export$9145995848b05025(state, key)
155
161
  },
156
162
  labelProps: {
157
163
  id: labelId
@@ -167,13 +173,13 @@ function $379f8fed3835a355$export$497855f14858aa34(props, state, ref) {
167
173
  }
168
174
 
169
175
 
170
- var $701722104b57f7b1$exports = {};
176
+ var $f32afd5f225c3320$exports = {};
171
177
 
172
- $parcel$export($701722104b57f7b1$exports, "useListBoxSection", () => $701722104b57f7b1$export$c3f9f39876e4bc7);
178
+ $parcel$export($f32afd5f225c3320$exports, "useListBoxSection", () => $f32afd5f225c3320$export$c3f9f39876e4bc7);
173
179
 
174
- function $701722104b57f7b1$export$c3f9f39876e4bc7(props) {
180
+ function $f32afd5f225c3320$export$c3f9f39876e4bc7(props) {
175
181
  let { heading: heading , 'aria-label': ariaLabel } = props;
176
- let headingId = $cCiqH$reactariautils.useId();
182
+ let headingId = $eFCLV$reactariautils.useId();
177
183
  return {
178
184
  itemProps: {
179
185
  role: 'presentation'
@@ -196,10 +202,10 @@ function $701722104b57f7b1$export$c3f9f39876e4bc7(props) {
196
202
 
197
203
 
198
204
 
199
- $parcel$exportWildcard(module.exports, $791342f030d1fc2c$exports);
200
- $parcel$exportWildcard(module.exports, $379f8fed3835a355$exports);
201
- $parcel$exportWildcard(module.exports, $701722104b57f7b1$exports);
202
- $parcel$exportWildcard(module.exports, $55ba9445af8053ba$exports);
205
+ $parcel$exportWildcard(module.exports, $a3ce5bb3074610af$exports);
206
+ $parcel$exportWildcard(module.exports, $c164f9f79f4cef2d$exports);
207
+ $parcel$exportWildcard(module.exports, $f32afd5f225c3320$exports);
208
+ $parcel$exportWildcard(module.exports, $87beb89ab4a308fd$exports);
203
209
 
204
210
 
205
211
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEuBO,KAAK,CAAC,yCAAQ,GAAG,GAAG,CAAC,OAAO;SAE1B,kCAAY,CAAC,GAAQ,EAAU,CAAC;IACvC,EAAE,EAAE,MAAM,CAAC,GAAG,KAAK,CAAQ,SACzB,MAAM,CAAC,GAAG,CAAC,OAAO,SAAS,CAAE;IAG/B,MAAM,CAAC,CAAE,IAAG,GAAG;AACjB,CAAC;SAEe,yCAAS,CAAI,KAAmB,EAAE,OAAY,EAAU,CAAC;IACvE,GAAG,CAAC,IAAI,GAAG,yCAAQ,CAAC,GAAG,CAAC,KAAK;IAE7B,EAAE,GAAG,IAAI,EACP,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAc;IAGhC,MAAM,IAAI,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,kCAAY,CAAC,OAAO;AAClD,CAAC;;;;;;;SDsBe,yCAAU,CAAI,KAA4B,EAAE,KAAmB,EAAE,GAA2B,EAAe,CAAC;IAC1H,GAAG,CAAC,QAAQ,GAAG,oCAAc,CAAC,KAAK,EAAE,CAAC;QAAA,SAAS,EAAE,IAAI;IAAA,CAAC;IACtD,GAAG,CAAC,CAAC,YAAA,SAAS,EAAA,CAAC,GAAG,2CAAiB,CAAC,CAAC;WAChC,KAAK;aACR,GAAG;QACH,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;QACxC,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,YAAY,EAAE,KAAK,CAAC,YAAY;IAClC,CAAC;IAED,GAAG,CAAC,CAAC,mBAAA,gBAAgB,EAAA,CAAC,GAAG,2CA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AAAlE,gEAAkE;YAClE,EAAiE,AAAjE,+DAAiE;YACjE,EAAmC,AAAnC,iCAAmC;YACnC,EAAE,EAAE,SAAS;YACb,CAAa,cAAE,IAAI;QACrB,CAAC,GAAG,CAAC;QAAA,CAAC;QACN,UAAU,EAAE,CAAC;YACX,IAAI,EAAE,CAAO;YACb,CAAY,aAAE,SAAS;YACvB,CAAiB,kBAAE,OAAO,GAAG,SAAS,GAAG,SAAS;QACpD,CAAC;IACH,CAAC;AACH,CAAC;","sources":["packages/@react-aria/listbox/src/index.ts","packages/@react-aria/listbox/src/useListBox.ts","packages/@react-aria/listbox/src/utils.ts","packages/@react-aria/listbox/src/useOption.ts","packages/@react-aria/listbox/src/useListBoxSection.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 * from './useListBox';\nexport * from './useOption';\nexport * from './useListBoxSection';\nexport * from './utils';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaListBoxProps} from '@react-types/listbox';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {HTMLAttributes, ReactNode, RefObject} from 'react';\nimport {KeyboardDelegate} from '@react-types/shared';\nimport {listData} from './utils';\nimport {ListState} from '@react-stately/list';\nimport {useFocusWithin} from '@react-aria/interactions';\nimport {useId} from '@react-aria/utils';\nimport {useLabel} from '@react-aria/label';\nimport {useSelectableList} from '@react-aria/selection';\n\ninterface ListBoxAria {\n /** Props for the listbox element. */\n listBoxProps: HTMLAttributes<HTMLElement>,\n /** Props for the listbox's visual label element (if any). */\n labelProps: HTMLAttributes<HTMLElement>\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 * Whether the listbox items should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n\n /** Whether selection should occur on press up instead of press down. */\n shouldSelectOnPressUp?: boolean,\n\n /** Whether options should be focused when the user hovers over them. */\n shouldFocusOnHover?: boolean,\n\n /**\n * An optional visual label for the listbox.\n */\n label?: ReactNode\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>): ListBoxAria {\n let domProps = filterDOMProps(props, {labelable: true});\n let {listProps} = useSelectableList({\n ...props,\n ref,\n selectionManager: state.selectionManager,\n collection: state.collection,\n disabledKeys: state.disabledKeys\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 });\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","/*\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 {Key} from 'react';\nimport {ListState} from '@react-stately/list';\n\ninterface ListData {\n id: string,\n shouldSelectOnPressUp?: boolean,\n shouldFocusOnHover?: boolean,\n shouldUseVirtualFocus?: boolean,\n isVirtualized?: boolean\n}\n\nexport const listData = new WeakMap<ListState<unknown>, ListData>();\n\nfunction normalizeKey(key: Key): string {\n if (typeof key === 'string') {\n return key.replace(/\\s*/g, '');\n }\n\n return '' + key;\n}\n\nexport function getItemId<T>(state: ListState<T>, itemKey: Key): string {\n let data = listData.get(state);\n\n if (!data) {\n throw new Error('Unknown list');\n }\n\n return `${data.id}-option-${normalizeKey(itemKey)}`;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getItemCount} from '@react-stately/collections';\nimport {getItemId, listData} from './utils';\nimport {HTMLAttributes, Key, RefObject} from 'react';\nimport {isFocusVisible, useHover} from '@react-aria/interactions';\nimport {isMac, isWebKit, mergeProps, useSlotId} from '@react-aria/utils';\nimport {ListState} from '@react-stately/list';\nimport {useSelectableItem} from '@react-aria/selection';\n\ninterface OptionAria {\n /** Props for the option element. */\n optionProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the main text element inside the option. */\n labelProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the description text element inside the option, if any. */\n descriptionProps: HTMLAttributes<HTMLElement>,\n\n /** Whether the option is currently focused. */\n isFocused: boolean,\n /** Whether the option is currently selected. */\n isSelected: boolean,\n /** Whether the option is currently in a pressed state. */\n isPressed: boolean,\n /** Whether the option is disabled. */\n isDisabled: boolean\n}\n\ninterface AriaOptionProps {\n /**\n * Whether the option is disabled.\n * @deprecated\n */\n isDisabled?: boolean,\n\n /**\n * Whether the option is selected.\n * @deprecated\n */\n isSelected?: boolean,\n\n /** A screen reader only label for the option. */\n 'aria-label'?: string,\n\n /** The unique key for the option. */\n key: Key,\n\n /**\n * Whether selection should occur on press up instead of press down.\n * @deprecated\n */\n shouldSelectOnPressUp?: boolean,\n\n /**\n * Whether the option should be focused when the user hovers over it.\n * @deprecated\n */\n shouldFocusOnHover?: boolean,\n\n /**\n * Whether the option is contained in a virtual scrolling listbox.\n * @deprecated\n */\n isVirtualized?: boolean,\n\n /**\n * Whether the option should use virtual focus instead of being focused directly.\n * @deprecated\n */\n shouldUseVirtualFocus?: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for an option in a listbox.\n * See `useListBox` for more details about listboxes.\n * @param props - Props for the option.\n * @param state - State for the listbox, as returned by `useListState`.\n */\nexport function useOption<T>(props: AriaOptionProps, state: ListState<T>, ref: RefObject<HTMLElement>): OptionAria {\n let {\n key\n } = props;\n\n let data = listData.get(state);\n\n let isDisabled = props.isDisabled ?? state.disabledKeys.has(key);\n let isSelected = props.isSelected ?? state.selectionManager.isSelected(key);\n let isFocused = state.selectionManager.focusedKey === key;\n let shouldSelectOnPressUp = props.shouldSelectOnPressUp ?? data.shouldSelectOnPressUp;\n let shouldFocusOnHover = props.shouldFocusOnHover ?? data.shouldFocusOnHover;\n let shouldUseVirtualFocus = props.shouldUseVirtualFocus ?? data.shouldUseVirtualFocus;\n let isVirtualized = props.isVirtualized ?? data.isVirtualized;\n\n let labelId = useSlotId();\n let descriptionId = useSlotId();\n\n let optionProps = {\n role: 'option',\n 'aria-disabled': isDisabled,\n 'aria-selected': state.selectionManager.selectionMode !== 'none' ? isSelected : undefined\n };\n\n // Safari with VoiceOver on macOS misreads options with aria-labelledby or aria-label as simply \"text\".\n // We should not map slots to the label and description on Safari and instead just have VoiceOver read the textContent.\n // https://bugs.webkit.org/show_bug.cgi?id=209279\n if (!(isMac() && isWebKit())) {\n optionProps['aria-label'] = props['aria-label'];\n optionProps['aria-labelledby'] = labelId;\n optionProps['aria-describedby'] = descriptionId;\n }\n\n if (isVirtualized) {\n optionProps['aria-posinset'] = state.collection.getItem(key).index + 1;\n optionProps['aria-setsize'] = getItemCount(state.collection);\n }\n\n let {itemProps, isPressed} = useSelectableItem({\n selectionManager: state.selectionManager,\n key,\n ref,\n shouldSelectOnPressUp,\n isVirtualized,\n shouldUseVirtualFocus,\n isDisabled\n });\n\n let {hoverProps} = useHover({\n isDisabled: isDisabled || !shouldFocusOnHover,\n onHoverStart() {\n if (!isFocusVisible()) {\n state.selectionManager.setFocused(true);\n state.selectionManager.setFocusedKey(key);\n }\n }\n });\n\n return {\n optionProps: {\n ...optionProps,\n ...mergeProps(itemProps, hoverProps),\n id: getItemId(state, key)\n },\n labelProps: {\n id: labelId\n },\n descriptionProps: {\n id: descriptionId\n },\n isFocused,\n isSelected,\n isDisabled,\n isPressed\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {HTMLAttributes, ReactNode} from 'react';\nimport {useId} from '@react-aria/utils';\n\ninterface AriaListBoxSectionProps {\n /** The heading for the section. */\n heading?: ReactNode,\n /** An accessibility label for the section. Required if `heading` is not present. */\n 'aria-label'?: string\n}\n\ninterface ListBoxSectionAria {\n /** Props for the wrapper list item. */\n itemProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the heading element, if any. */\n headingProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the group element. */\n groupProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a section in a listbox.\n * See `useListBox` for more details about listboxes.\n * @param props - Props for the section.\n */\nexport function useListBoxSection(props: AriaListBoxSectionProps): ListBoxSectionAria {\n let {heading, 'aria-label': ariaLabel} = props;\n let headingId = useId();\n\n return {\n itemProps: {\n role: 'presentation'\n },\n headingProps: heading ? {\n // Techincally, listbox cannot contain headings according to ARIA.\n // We hide the heading from assistive technology, and only use it\n // as a label for the nested group.\n id: headingId,\n 'aria-hidden': true\n } : {},\n groupProps: {\n role: 'group',\n 'aria-label': ariaLabel,\n 'aria-labelledby': heading ? headingId : undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEuBO,KAAK,CAAC,yCAAQ,GAAG,GAAG,CAAC,OAAO;SAE1B,kCAAY,CAAC,GAAQ,EAAU,CAAC;IACvC,EAAE,EAAE,MAAM,CAAC,GAAG,KAAK,CAAQ,SACzB,MAAM,CAAC,GAAG,CAAC,OAAO,SAAS,CAAE;IAG/B,MAAM,CAAC,CAAE,IAAG,GAAG;AACjB,CAAC;SAE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QAAA,CAAC;QACN,UAAU,EAAE,CAAC;YACX,IAAI,EAAE,CAAO;YACb,CAAY,aAAE,SAAS;YACvB,CAAiB,kBAAE,OAAO,GAAG,SAAS,GAAG,SAAS;QACpD,CAAC;IACH,CAAC;AACH,CAAC;","sources":["packages/@react-aria/listbox/src/index.ts","packages/@react-aria/listbox/src/useListBox.ts","packages/@react-aria/listbox/src/utils.ts","packages/@react-aria/listbox/src/useOption.ts","packages/@react-aria/listbox/src/useListBoxSection.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 * from './useListBox';\nexport * from './useOption';\nexport * from './useListBoxSection';\nexport * from './utils';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaListBoxProps} from '@react-types/listbox';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {HTMLAttributes, ReactNode, RefObject} from 'react';\nimport {KeyboardDelegate} from '@react-types/shared';\nimport {listData} from './utils';\nimport {ListState} from '@react-stately/list';\nimport {useFocusWithin} from '@react-aria/interactions';\nimport {useId} from '@react-aria/utils';\nimport {useLabel} from '@react-aria/label';\nimport {useSelectableList} from '@react-aria/selection';\n\ninterface ListBoxAria {\n /** Props for the listbox element. */\n listBoxProps: HTMLAttributes<HTMLElement>,\n /** Props for the listbox's visual label element (if any). */\n labelProps: HTMLAttributes<HTMLElement>\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 * Whether the listbox items should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n\n /** Whether selection should occur on press up instead of press down. */\n shouldSelectOnPressUp?: boolean,\n\n /** Whether options should be focused when the user hovers over them. */\n shouldFocusOnHover?: boolean,\n\n /**\n * An optional visual label for the listbox.\n */\n label?: ReactNode\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>): ListBoxAria {\n let domProps = filterDOMProps(props, {labelable: true});\n let {listProps} = useSelectableList({\n ...props,\n ref,\n selectionManager: state.selectionManager,\n collection: state.collection,\n disabledKeys: state.disabledKeys\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 });\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","/*\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 {Key} from 'react';\nimport {ListState} from '@react-stately/list';\n\ninterface ListData {\n id: string,\n shouldSelectOnPressUp?: boolean,\n shouldFocusOnHover?: boolean,\n shouldUseVirtualFocus?: boolean,\n isVirtualized?: boolean\n}\n\nexport const listData = new WeakMap<ListState<unknown>, ListData>();\n\nfunction normalizeKey(key: Key): string {\n if (typeof key === 'string') {\n return key.replace(/\\s*/g, '');\n }\n\n return '' + key;\n}\n\nexport function getItemId<T>(state: ListState<T>, itemKey: Key): string {\n let data = listData.get(state);\n\n if (!data) {\n throw new Error('Unknown list');\n }\n\n return `${data.id}-option-${normalizeKey(itemKey)}`;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getItemCount} from '@react-stately/collections';\nimport {getItemId, listData} from './utils';\nimport {HTMLAttributes, Key, RefObject} from 'react';\nimport {isFocusVisible, useHover} from '@react-aria/interactions';\nimport {isMac, isWebKit, mergeProps, useSlotId} from '@react-aria/utils';\nimport {ListState} from '@react-stately/list';\nimport {useSelectableItem} from '@react-aria/selection';\n\ninterface OptionAria {\n /** Props for the option element. */\n optionProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the main text element inside the option. */\n labelProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the description text element inside the option, if any. */\n descriptionProps: HTMLAttributes<HTMLElement>,\n\n /** Whether the option is currently focused. */\n isFocused: boolean,\n /** Whether the option is currently selected. */\n isSelected: boolean,\n /** Whether the option is currently in a pressed state. */\n isPressed: boolean,\n /** Whether the option is disabled. */\n isDisabled: boolean\n}\n\ninterface AriaOptionProps {\n /**\n * Whether the option is disabled.\n * @deprecated\n */\n isDisabled?: boolean,\n\n /**\n * Whether the option is selected.\n * @deprecated\n */\n isSelected?: boolean,\n\n /** A screen reader only label for the option. */\n 'aria-label'?: string,\n\n /** The unique key for the option. */\n key: Key,\n\n /**\n * Whether selection should occur on press up instead of press down.\n * @deprecated\n */\n shouldSelectOnPressUp?: boolean,\n\n /**\n * Whether the option should be focused when the user hovers over it.\n * @deprecated\n */\n shouldFocusOnHover?: boolean,\n\n /**\n * Whether the option is contained in a virtual scrolling listbox.\n * @deprecated\n */\n isVirtualized?: boolean,\n\n /**\n * Whether the option should use virtual focus instead of being focused directly.\n * @deprecated\n */\n shouldUseVirtualFocus?: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for an option in a listbox.\n * See `useListBox` for more details about listboxes.\n * @param props - Props for the option.\n * @param state - State for the listbox, as returned by `useListState`.\n */\nexport function useOption<T>(props: AriaOptionProps, state: ListState<T>, ref: RefObject<HTMLElement>): OptionAria {\n let {\n key\n } = props;\n\n let data = listData.get(state);\n\n let isDisabled = props.isDisabled ?? state.disabledKeys.has(key);\n let isSelected = props.isSelected ?? state.selectionManager.isSelected(key);\n let isFocused = state.selectionManager.focusedKey === key;\n let shouldSelectOnPressUp = props.shouldSelectOnPressUp ?? data.shouldSelectOnPressUp;\n let shouldFocusOnHover = props.shouldFocusOnHover ?? data.shouldFocusOnHover;\n let shouldUseVirtualFocus = props.shouldUseVirtualFocus ?? data.shouldUseVirtualFocus;\n let isVirtualized = props.isVirtualized ?? data.isVirtualized;\n\n let labelId = useSlotId();\n let descriptionId = useSlotId();\n\n let optionProps = {\n role: 'option',\n 'aria-disabled': isDisabled,\n 'aria-selected': state.selectionManager.selectionMode !== 'none' ? isSelected : undefined\n };\n\n // Safari with VoiceOver on macOS misreads options with aria-labelledby or aria-label as simply \"text\".\n // We should not map slots to the label and description on Safari and instead just have VoiceOver read the textContent.\n // https://bugs.webkit.org/show_bug.cgi?id=209279\n if (!(isMac() && isWebKit())) {\n optionProps['aria-label'] = props['aria-label'];\n optionProps['aria-labelledby'] = labelId;\n optionProps['aria-describedby'] = descriptionId;\n }\n\n if (isVirtualized) {\n optionProps['aria-posinset'] = state.collection.getItem(key).index + 1;\n optionProps['aria-setsize'] = getItemCount(state.collection);\n }\n\n let {itemProps, isPressed} = useSelectableItem({\n selectionManager: state.selectionManager,\n key,\n ref,\n shouldSelectOnPressUp,\n isVirtualized,\n shouldUseVirtualFocus,\n isDisabled\n });\n\n let {hoverProps} = useHover({\n isDisabled: isDisabled || !shouldFocusOnHover,\n onHoverStart() {\n if (!isFocusVisible()) {\n state.selectionManager.setFocused(true);\n state.selectionManager.setFocusedKey(key);\n }\n }\n });\n\n return {\n optionProps: {\n ...optionProps,\n ...mergeProps(itemProps, hoverProps),\n id: getItemId(state, key)\n },\n labelProps: {\n id: labelId\n },\n descriptionProps: {\n id: descriptionId\n },\n isFocused,\n isSelected,\n isDisabled,\n isPressed\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {HTMLAttributes, ReactNode} from 'react';\nimport {useId} from '@react-aria/utils';\n\ninterface AriaListBoxSectionProps {\n /** The heading for the section. */\n heading?: ReactNode,\n /** An accessibility label for the section. Required if `heading` is not present. */\n 'aria-label'?: string\n}\n\ninterface ListBoxSectionAria {\n /** Props for the wrapper list item. */\n itemProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the heading element, if any. */\n headingProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the group element. */\n groupProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a section in a listbox.\n * See `useListBox` for more details about listboxes.\n * @param props - Props for the section.\n */\nexport function useListBoxSection(props: AriaListBoxSectionProps): ListBoxSectionAria {\n let {heading, 'aria-label': ariaLabel} = props;\n let headingId = useId();\n\n return {\n itemProps: {\n role: 'presentation'\n },\n headingProps: heading ? {\n // Techincally, listbox cannot contain headings according to ARIA.\n // We hide the heading from assistive technology, and only use it\n // as a label for the nested group.\n id: headingId,\n 'aria-hidden': true\n } : {},\n groupProps: {\n role: 'group',\n 'aria-label': ariaLabel,\n 'aria-labelledby': heading ? headingId : undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,29 +1,29 @@
1
- import {filterDOMProps as $7Yq4N$filterDOMProps, useId as $7Yq4N$useId, mergeProps as $7Yq4N$mergeProps, useSlotId as $7Yq4N$useSlotId, isMac as $7Yq4N$isMac, isWebKit as $7Yq4N$isWebKit} from "@react-aria/utils";
2
- import {useFocusWithin as $7Yq4N$useFocusWithin, useHover as $7Yq4N$useHover, isFocusVisible as $7Yq4N$isFocusVisible} from "@react-aria/interactions";
3
- import {useLabel as $7Yq4N$useLabel} from "@react-aria/label";
4
- import {useSelectableList as $7Yq4N$useSelectableList, useSelectableItem as $7Yq4N$useSelectableItem} from "@react-aria/selection";
5
- import {getItemCount as $7Yq4N$getItemCount} from "@react-stately/collections";
1
+ import {filterDOMProps as $frWMC$filterDOMProps, useId as $frWMC$useId, mergeProps as $frWMC$mergeProps, useSlotId as $frWMC$useSlotId, isMac as $frWMC$isMac, isWebKit as $frWMC$isWebKit} from "@react-aria/utils";
2
+ import {useFocusWithin as $frWMC$useFocusWithin, useHover as $frWMC$useHover, isFocusVisible as $frWMC$isFocusVisible} from "@react-aria/interactions";
3
+ import {useLabel as $frWMC$useLabel} from "@react-aria/label";
4
+ import {useSelectableList as $frWMC$useSelectableList, useSelectableItem as $frWMC$useSelectableItem} from "@react-aria/selection";
5
+ import {getItemCount as $frWMC$getItemCount} from "@react-stately/collections";
6
6
 
7
7
  function $parcel$export(e, n, v, s) {
8
8
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
9
9
  }
10
- var $b6a6a3879de3c160$exports = {};
10
+ var $c132121280ec012d$exports = {};
11
11
 
12
- $parcel$export($b6a6a3879de3c160$exports, "useListBox", () => $b6a6a3879de3c160$export$50eacbbf140a3141);
12
+ $parcel$export($c132121280ec012d$exports, "useListBox", () => $c132121280ec012d$export$50eacbbf140a3141);
13
13
 
14
- var $d786742a15de2e64$exports = {};
14
+ var $b1f0cad8af73213b$exports = {};
15
15
 
16
- $parcel$export($d786742a15de2e64$exports, "listData", () => $d786742a15de2e64$export$3585ede4d035bf14);
17
- $parcel$export($d786742a15de2e64$exports, "getItemId", () => $d786742a15de2e64$export$9145995848b05025);
18
- const $d786742a15de2e64$export$3585ede4d035bf14 = new WeakMap();
19
- function $d786742a15de2e64$var$normalizeKey(key) {
16
+ $parcel$export($b1f0cad8af73213b$exports, "listData", () => $b1f0cad8af73213b$export$3585ede4d035bf14);
17
+ $parcel$export($b1f0cad8af73213b$exports, "getItemId", () => $b1f0cad8af73213b$export$9145995848b05025);
18
+ const $b1f0cad8af73213b$export$3585ede4d035bf14 = new WeakMap();
19
+ function $b1f0cad8af73213b$var$normalizeKey(key) {
20
20
  if (typeof key === 'string') return key.replace(/\s*/g, '');
21
21
  return '' + key;
22
22
  }
23
- function $d786742a15de2e64$export$9145995848b05025(state, itemKey) {
24
- let data = $d786742a15de2e64$export$3585ede4d035bf14.get(state);
23
+ function $b1f0cad8af73213b$export$9145995848b05025(state, itemKey) {
24
+ let data = $b1f0cad8af73213b$export$3585ede4d035bf14.get(state);
25
25
  if (!data) throw new Error('Unknown list');
26
- return `${data.id}-option-${$d786742a15de2e64$var$normalizeKey(itemKey)}`;
26
+ return `${data.id}-option-${$b1f0cad8af73213b$var$normalizeKey(itemKey)}`;
27
27
  }
28
28
 
29
29
 
@@ -31,32 +31,32 @@ function $d786742a15de2e64$export$9145995848b05025(state, itemKey) {
31
31
 
32
32
 
33
33
 
34
- function $b6a6a3879de3c160$export$50eacbbf140a3141(props, state, ref) {
35
- let domProps = $7Yq4N$filterDOMProps(props, {
34
+ function $c132121280ec012d$export$50eacbbf140a3141(props, state, ref) {
35
+ let domProps = $frWMC$filterDOMProps(props, {
36
36
  labelable: true
37
37
  });
38
- let { listProps: listProps } = $7Yq4N$useSelectableList({
38
+ let { listProps: listProps } = $frWMC$useSelectableList({
39
39
  ...props,
40
40
  ref: ref,
41
41
  selectionManager: state.selectionManager,
42
42
  collection: state.collection,
43
43
  disabledKeys: state.disabledKeys
44
44
  });
45
- let { focusWithinProps: focusWithinProps } = $7Yq4N$useFocusWithin({
45
+ let { focusWithinProps: focusWithinProps } = $frWMC$useFocusWithin({
46
46
  onFocusWithin: props.onFocus,
47
47
  onBlurWithin: props.onBlur,
48
48
  onFocusWithinChange: props.onFocusChange
49
49
  });
50
50
  // Share list id and some props with child options.
51
- let id = $7Yq4N$useId(props.id);
52
- $d786742a15de2e64$export$3585ede4d035bf14.set(state, {
51
+ let id = $frWMC$useId(props.id);
52
+ $b1f0cad8af73213b$export$3585ede4d035bf14.set(state, {
53
53
  id: id,
54
54
  shouldUseVirtualFocus: props.shouldUseVirtualFocus,
55
55
  shouldSelectOnPressUp: props.shouldSelectOnPressUp,
56
56
  shouldFocusOnHover: props.shouldFocusOnHover,
57
57
  isVirtualized: props.isVirtualized
58
58
  });
59
- let { labelProps: labelProps , fieldProps: fieldProps } = $7Yq4N$useLabel({
59
+ let { labelProps: labelProps , fieldProps: fieldProps } = $frWMC$useLabel({
60
60
  ...props,
61
61
  id: id,
62
62
  // listbox is not an HTML input element so it
@@ -65,37 +65,43 @@ function $b6a6a3879de3c160$export$50eacbbf140a3141(props, state, ref) {
65
65
  });
66
66
  return {
67
67
  labelProps: labelProps,
68
- listBoxProps: $7Yq4N$mergeProps(domProps, focusWithinProps, state.selectionManager.selectionMode === 'multiple' ? {
68
+ listBoxProps: $frWMC$mergeProps(domProps, focusWithinProps, state.selectionManager.selectionMode === 'multiple' ? {
69
69
  'aria-multiselectable': 'true'
70
70
  } : {
71
71
  }, {
72
72
  role: 'listbox',
73
- ...$7Yq4N$mergeProps(fieldProps, listProps)
73
+ ...$frWMC$mergeProps(fieldProps, listProps)
74
74
  })
75
75
  };
76
76
  }
77
77
 
78
78
 
79
- var $ffbe2720d8d792ce$exports = {};
79
+ var $293f70390ea03370$exports = {};
80
80
 
81
- $parcel$export($ffbe2720d8d792ce$exports, "useOption", () => $ffbe2720d8d792ce$export$497855f14858aa34);
81
+ $parcel$export($293f70390ea03370$exports, "useOption", () => $293f70390ea03370$export$497855f14858aa34);
82
82
 
83
83
 
84
84
 
85
85
 
86
86
 
87
- function $ffbe2720d8d792ce$export$497855f14858aa34(props, state, ref) {
87
+ function $293f70390ea03370$export$497855f14858aa34(props, state, ref) {
88
88
  let { key: key } = props;
89
- let data = $d786742a15de2e64$export$3585ede4d035bf14.get(state);
90
- let isDisabled = props.isDisabled ?? state.disabledKeys.has(key);
91
- let isSelected = props.isSelected ?? state.selectionManager.isSelected(key);
89
+ let data = $b1f0cad8af73213b$export$3585ede4d035bf14.get(state);
90
+ var _isDisabled;
91
+ let isDisabled = (_isDisabled = props.isDisabled) !== null && _isDisabled !== void 0 ? _isDisabled : state.disabledKeys.has(key);
92
+ var _isSelected;
93
+ let isSelected = (_isSelected = props.isSelected) !== null && _isSelected !== void 0 ? _isSelected : state.selectionManager.isSelected(key);
92
94
  let isFocused = state.selectionManager.focusedKey === key;
93
- let shouldSelectOnPressUp = props.shouldSelectOnPressUp ?? data.shouldSelectOnPressUp;
94
- let shouldFocusOnHover = props.shouldFocusOnHover ?? data.shouldFocusOnHover;
95
- let shouldUseVirtualFocus = props.shouldUseVirtualFocus ?? data.shouldUseVirtualFocus;
96
- let isVirtualized = props.isVirtualized ?? data.isVirtualized;
97
- let labelId = $7Yq4N$useSlotId();
98
- let descriptionId = $7Yq4N$useSlotId();
95
+ var _shouldSelectOnPressUp;
96
+ let shouldSelectOnPressUp = (_shouldSelectOnPressUp = props.shouldSelectOnPressUp) !== null && _shouldSelectOnPressUp !== void 0 ? _shouldSelectOnPressUp : data.shouldSelectOnPressUp;
97
+ var _shouldFocusOnHover;
98
+ let shouldFocusOnHover = (_shouldFocusOnHover = props.shouldFocusOnHover) !== null && _shouldFocusOnHover !== void 0 ? _shouldFocusOnHover : data.shouldFocusOnHover;
99
+ var _shouldUseVirtualFocus;
100
+ let shouldUseVirtualFocus = (_shouldUseVirtualFocus = props.shouldUseVirtualFocus) !== null && _shouldUseVirtualFocus !== void 0 ? _shouldUseVirtualFocus : data.shouldUseVirtualFocus;
101
+ var _isVirtualized;
102
+ let isVirtualized = (_isVirtualized = props.isVirtualized) !== null && _isVirtualized !== void 0 ? _isVirtualized : data.isVirtualized;
103
+ let labelId = $frWMC$useSlotId();
104
+ let descriptionId = $frWMC$useSlotId();
99
105
  let optionProps = {
100
106
  role: 'option',
101
107
  'aria-disabled': isDisabled,
@@ -104,16 +110,16 @@ function $ffbe2720d8d792ce$export$497855f14858aa34(props, state, ref) {
104
110
  // Safari with VoiceOver on macOS misreads options with aria-labelledby or aria-label as simply "text".
105
111
  // We should not map slots to the label and description on Safari and instead just have VoiceOver read the textContent.
106
112
  // https://bugs.webkit.org/show_bug.cgi?id=209279
107
- if (!($7Yq4N$isMac() && $7Yq4N$isWebKit())) {
113
+ if (!($frWMC$isMac() && $frWMC$isWebKit())) {
108
114
  optionProps['aria-label'] = props['aria-label'];
109
115
  optionProps['aria-labelledby'] = labelId;
110
116
  optionProps['aria-describedby'] = descriptionId;
111
117
  }
112
118
  if (isVirtualized) {
113
119
  optionProps['aria-posinset'] = state.collection.getItem(key).index + 1;
114
- optionProps['aria-setsize'] = $7Yq4N$getItemCount(state.collection);
120
+ optionProps['aria-setsize'] = $frWMC$getItemCount(state.collection);
115
121
  }
116
- let { itemProps: itemProps , isPressed: isPressed } = $7Yq4N$useSelectableItem({
122
+ let { itemProps: itemProps , isPressed: isPressed } = $frWMC$useSelectableItem({
117
123
  selectionManager: state.selectionManager,
118
124
  key: key,
119
125
  ref: ref,
@@ -122,10 +128,10 @@ function $ffbe2720d8d792ce$export$497855f14858aa34(props, state, ref) {
122
128
  shouldUseVirtualFocus: shouldUseVirtualFocus,
123
129
  isDisabled: isDisabled
124
130
  });
125
- let { hoverProps: hoverProps } = $7Yq4N$useHover({
131
+ let { hoverProps: hoverProps } = $frWMC$useHover({
126
132
  isDisabled: isDisabled || !shouldFocusOnHover,
127
133
  onHoverStart () {
128
- if (!$7Yq4N$isFocusVisible()) {
134
+ if (!$frWMC$isFocusVisible()) {
129
135
  state.selectionManager.setFocused(true);
130
136
  state.selectionManager.setFocusedKey(key);
131
137
  }
@@ -134,8 +140,8 @@ function $ffbe2720d8d792ce$export$497855f14858aa34(props, state, ref) {
134
140
  return {
135
141
  optionProps: {
136
142
  ...optionProps,
137
- ...$7Yq4N$mergeProps(itemProps, hoverProps),
138
- id: $d786742a15de2e64$export$9145995848b05025(state, key)
143
+ ...$frWMC$mergeProps(itemProps, hoverProps),
144
+ id: $b1f0cad8af73213b$export$9145995848b05025(state, key)
139
145
  },
140
146
  labelProps: {
141
147
  id: labelId
@@ -151,13 +157,13 @@ function $ffbe2720d8d792ce$export$497855f14858aa34(props, state, ref) {
151
157
  }
152
158
 
153
159
 
154
- var $60eb9482f3936d5e$exports = {};
160
+ var $af383d3bef1cfdc9$exports = {};
155
161
 
156
- $parcel$export($60eb9482f3936d5e$exports, "useListBoxSection", () => $60eb9482f3936d5e$export$c3f9f39876e4bc7);
162
+ $parcel$export($af383d3bef1cfdc9$exports, "useListBoxSection", () => $af383d3bef1cfdc9$export$c3f9f39876e4bc7);
157
163
 
158
- function $60eb9482f3936d5e$export$c3f9f39876e4bc7(props) {
164
+ function $af383d3bef1cfdc9$export$c3f9f39876e4bc7(props) {
159
165
  let { heading: heading , 'aria-label': ariaLabel } = props;
160
- let headingId = $7Yq4N$useId();
166
+ let headingId = $frWMC$useId();
161
167
  return {
162
168
  itemProps: {
163
169
  role: 'presentation'
@@ -182,5 +188,5 @@ function $60eb9482f3936d5e$export$c3f9f39876e4bc7(props) {
182
188
 
183
189
 
184
190
 
185
- export {$b6a6a3879de3c160$export$50eacbbf140a3141 as useListBox, $ffbe2720d8d792ce$export$497855f14858aa34 as useOption, $60eb9482f3936d5e$export$c3f9f39876e4bc7 as useListBoxSection, $d786742a15de2e64$export$3585ede4d035bf14 as listData, $d786742a15de2e64$export$9145995848b05025 as getItemId};
191
+ 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};
186
192
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;AEuBO,KAAK,CAAC,yCAAQ,GAAG,GAAG,CAAC,OAAO;SAE1B,kCAAY,CAAC,GAAQ,EAAU,CAAC;IACvC,EAAE,EAAE,MAAM,CAAC,GAAG,KAAK,CAAQ,SACzB,MAAM,CAAC,GAAG,CAAC,OAAO,SAAS,CAAE;IAG/B,MAAM,CAAC,CAAE,IAAG,GAAG;AACjB,CAAC;SAEe,yCA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C,gBAAgB,CAAC,aAAa,CAAC,GAAG;YAC1C,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,CAAC,CAAC;QACN,WAAW,EAAE,CAAC;eACT,WAAW;eACX,iBAAU,CAAC,SAAS,EAAE,UAAU;YACnC,EAAE,EAAE,yCAAS,CAAC,KAAK,EAAE,GAAG;QAC1B,CAAC;QACD,UAAU,EAAE,CAAC;YACX,EAAE,EAAE,OAAO;QACb,CAAC;QACD,gBAAgB,EAAE,CAAC;YACjB,EAAE,EAAE,aAAa;QACnB,CAAC;mBACD,SAAS;oBACT,UAAU;oBACV,UAAU;mBACV,SAAS;IACX,CAAC;AACH,CAAC;;;;;;;SC/He,wCAAiB,CAAC,KAA8B,EAAsB,CAAC;IACrF,GAAG,CAAC,CAAC,UAAA,OAAO,GAAE,CAAY,aAAE,SAAS,EAAA,CAAC,GAAG,KAAK;IAC9C,GAAG,CAAC,SAAS,GAAG,YAAK;IAErB,MAAM,CAAC,CAAC;QACN,SAAS,EAAE,CAAC;YACV,IAAI,EAAE,CAAc;QACtB,CAAC;QACD,YAAY,EAAE,OAAO,GAAG,CAAC;YACvB,EAAkE,AAAlE,gEAAkE;YAClE,EAAiE,AAAjE,+DAAiE;YACjE,EAAmC,AAAnC,iCAAmC;YACnC,EAAE,EAAE,SAAS;YACb,CAAa,cAAE,IAAI;QACrB,CAAC,GAAG,CAAC;QAAA,CAAC;QACN,UAAU,EAAE,CAAC;YACX,IAAI,EAAE,CAAO;YACb,CAAY,aAAE,SAAS;YACvB,CAAiB,kBAAE,OAAO,GAAG,SAAS,GAAG,SAAS;QACpD,CAAC;IACH,CAAC;AACH,CAAC;","sources":["packages/@react-aria/listbox/src/index.ts","packages/@react-aria/listbox/src/useListBox.ts","packages/@react-aria/listbox/src/utils.ts","packages/@react-aria/listbox/src/useOption.ts","packages/@react-aria/listbox/src/useListBoxSection.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 * from './useListBox';\nexport * from './useOption';\nexport * from './useListBoxSection';\nexport * from './utils';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaListBoxProps} from '@react-types/listbox';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {HTMLAttributes, ReactNode, RefObject} from 'react';\nimport {KeyboardDelegate} from '@react-types/shared';\nimport {listData} from './utils';\nimport {ListState} from '@react-stately/list';\nimport {useFocusWithin} from '@react-aria/interactions';\nimport {useId} from '@react-aria/utils';\nimport {useLabel} from '@react-aria/label';\nimport {useSelectableList} from '@react-aria/selection';\n\ninterface ListBoxAria {\n /** Props for the listbox element. */\n listBoxProps: HTMLAttributes<HTMLElement>,\n /** Props for the listbox's visual label element (if any). */\n labelProps: HTMLAttributes<HTMLElement>\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 * Whether the listbox items should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n\n /** Whether selection should occur on press up instead of press down. */\n shouldSelectOnPressUp?: boolean,\n\n /** Whether options should be focused when the user hovers over them. */\n shouldFocusOnHover?: boolean,\n\n /**\n * An optional visual label for the listbox.\n */\n label?: ReactNode\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>): ListBoxAria {\n let domProps = filterDOMProps(props, {labelable: true});\n let {listProps} = useSelectableList({\n ...props,\n ref,\n selectionManager: state.selectionManager,\n collection: state.collection,\n disabledKeys: state.disabledKeys\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 });\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","/*\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 {Key} from 'react';\nimport {ListState} from '@react-stately/list';\n\ninterface ListData {\n id: string,\n shouldSelectOnPressUp?: boolean,\n shouldFocusOnHover?: boolean,\n shouldUseVirtualFocus?: boolean,\n isVirtualized?: boolean\n}\n\nexport const listData = new WeakMap<ListState<unknown>, ListData>();\n\nfunction normalizeKey(key: Key): string {\n if (typeof key === 'string') {\n return key.replace(/\\s*/g, '');\n }\n\n return '' + key;\n}\n\nexport function getItemId<T>(state: ListState<T>, itemKey: Key): string {\n let data = listData.get(state);\n\n if (!data) {\n throw new Error('Unknown list');\n }\n\n return `${data.id}-option-${normalizeKey(itemKey)}`;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getItemCount} from '@react-stately/collections';\nimport {getItemId, listData} from './utils';\nimport {HTMLAttributes, Key, RefObject} from 'react';\nimport {isFocusVisible, useHover} from '@react-aria/interactions';\nimport {isMac, isWebKit, mergeProps, useSlotId} from '@react-aria/utils';\nimport {ListState} from '@react-stately/list';\nimport {useSelectableItem} from '@react-aria/selection';\n\ninterface OptionAria {\n /** Props for the option element. */\n optionProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the main text element inside the option. */\n labelProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the description text element inside the option, if any. */\n descriptionProps: HTMLAttributes<HTMLElement>,\n\n /** Whether the option is currently focused. */\n isFocused: boolean,\n /** Whether the option is currently selected. */\n isSelected: boolean,\n /** Whether the option is currently in a pressed state. */\n isPressed: boolean,\n /** Whether the option is disabled. */\n isDisabled: boolean\n}\n\ninterface AriaOptionProps {\n /**\n * Whether the option is disabled.\n * @deprecated\n */\n isDisabled?: boolean,\n\n /**\n * Whether the option is selected.\n * @deprecated\n */\n isSelected?: boolean,\n\n /** A screen reader only label for the option. */\n 'aria-label'?: string,\n\n /** The unique key for the option. */\n key: Key,\n\n /**\n * Whether selection should occur on press up instead of press down.\n * @deprecated\n */\n shouldSelectOnPressUp?: boolean,\n\n /**\n * Whether the option should be focused when the user hovers over it.\n * @deprecated\n */\n shouldFocusOnHover?: boolean,\n\n /**\n * Whether the option is contained in a virtual scrolling listbox.\n * @deprecated\n */\n isVirtualized?: boolean,\n\n /**\n * Whether the option should use virtual focus instead of being focused directly.\n * @deprecated\n */\n shouldUseVirtualFocus?: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for an option in a listbox.\n * See `useListBox` for more details about listboxes.\n * @param props - Props for the option.\n * @param state - State for the listbox, as returned by `useListState`.\n */\nexport function useOption<T>(props: AriaOptionProps, state: ListState<T>, ref: RefObject<HTMLElement>): OptionAria {\n let {\n key\n } = props;\n\n let data = listData.get(state);\n\n let isDisabled = props.isDisabled ?? state.disabledKeys.has(key);\n let isSelected = props.isSelected ?? state.selectionManager.isSelected(key);\n let isFocused = state.selectionManager.focusedKey === key;\n let shouldSelectOnPressUp = props.shouldSelectOnPressUp ?? data.shouldSelectOnPressUp;\n let shouldFocusOnHover = props.shouldFocusOnHover ?? data.shouldFocusOnHover;\n let shouldUseVirtualFocus = props.shouldUseVirtualFocus ?? data.shouldUseVirtualFocus;\n let isVirtualized = props.isVirtualized ?? data.isVirtualized;\n\n let labelId = useSlotId();\n let descriptionId = useSlotId();\n\n let optionProps = {\n role: 'option',\n 'aria-disabled': isDisabled,\n 'aria-selected': state.selectionManager.selectionMode !== 'none' ? isSelected : undefined\n };\n\n // Safari with VoiceOver on macOS misreads options with aria-labelledby or aria-label as simply \"text\".\n // We should not map slots to the label and description on Safari and instead just have VoiceOver read the textContent.\n // https://bugs.webkit.org/show_bug.cgi?id=209279\n if (!(isMac() && isWebKit())) {\n optionProps['aria-label'] = props['aria-label'];\n optionProps['aria-labelledby'] = labelId;\n optionProps['aria-describedby'] = descriptionId;\n }\n\n if (isVirtualized) {\n optionProps['aria-posinset'] = state.collection.getItem(key).index + 1;\n optionProps['aria-setsize'] = getItemCount(state.collection);\n }\n\n let {itemProps, isPressed} = useSelectableItem({\n selectionManager: state.selectionManager,\n key,\n ref,\n shouldSelectOnPressUp,\n isVirtualized,\n shouldUseVirtualFocus,\n isDisabled\n });\n\n let {hoverProps} = useHover({\n isDisabled: isDisabled || !shouldFocusOnHover,\n onHoverStart() {\n if (!isFocusVisible()) {\n state.selectionManager.setFocused(true);\n state.selectionManager.setFocusedKey(key);\n }\n }\n });\n\n return {\n optionProps: {\n ...optionProps,\n ...mergeProps(itemProps, hoverProps),\n id: getItemId(state, key)\n },\n labelProps: {\n id: labelId\n },\n descriptionProps: {\n id: descriptionId\n },\n isFocused,\n isSelected,\n isDisabled,\n isPressed\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {HTMLAttributes, ReactNode} from 'react';\nimport {useId} from '@react-aria/utils';\n\ninterface AriaListBoxSectionProps {\n /** The heading for the section. */\n heading?: ReactNode,\n /** An accessibility label for the section. Required if `heading` is not present. */\n 'aria-label'?: string\n}\n\ninterface ListBoxSectionAria {\n /** Props for the wrapper list item. */\n itemProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the heading element, if any. */\n headingProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the group element. */\n groupProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a section in a listbox.\n * See `useListBox` for more details about listboxes.\n * @param props - Props for the section.\n */\nexport function useListBoxSection(props: AriaListBoxSectionProps): ListBoxSectionAria {\n let {heading, 'aria-label': ariaLabel} = props;\n let headingId = useId();\n\n return {\n itemProps: {\n role: 'presentation'\n },\n headingProps: heading ? {\n // Techincally, listbox cannot contain headings according to ARIA.\n // We hide the heading from assistive technology, and only use it\n // as a label for the nested group.\n id: headingId,\n 'aria-hidden': true\n } : {},\n groupProps: {\n role: 'group',\n 'aria-label': ariaLabel,\n 'aria-labelledby': heading ? headingId : undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;AEuBO,KAAK,CAAC,yCAAQ,GAAG,GAAG,CAAC,OAAO;SAE1B,kCAAY,CAAC,GAAQ,EAAU,CAAC;IACvC,EAAE,EAAE,MAAM,CAAC,GAAG,KAAK,CAAQ,SACzB,MAAM,CAAC,GAAG,CAAC,OAAO,SAAS,CAAE;IAG/B,MAAM,CAAC,CAAE,IAAG,GAAG;AACjB,CAAC;SAEe,yCAAS,CAAI,KAAmB,EAAE,OAAY,EAAU,CAAC;IACvE,GAAG,CAAC,IAAI,GAAG,yCAAQ,CAAC,GAAG,CAAC,KAAK;IAE7B,EAAE,GAAG,IAAI,EACP,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAc;IAGhC,MAAM,IAAI,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,kCAAY,CAAC,OAAO;AAClD,CAAC;;;;;;;SDsBe,yCAAU,CAAI,KAA4B,EAAE,KAAmB,EAAE,GAA2B,EAAe,CAAC;IAC1H,GAAG,CAAC,QAAQ,GAAG,qBAAc,CAAC,KAAK,EAAE,CAAC;QAAA,SAAS,EAAE,IAAI;IAAA,CAAC;IACtD,GAAG,CAAC,CAAC,YAAA,SAAS,EAAA,CAAC,GAAG,wBAAiB,CAAC,CAAC;WAChC,KAAK;aACR,GAAG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AE,EAAE,yCAAS,CAAC,KAAK,EAAE,GAAG;QAC1B,CAAC;QACD,UAAU,EAAE,CAAC;YACX,EAAE,EAAE,OAAO;QACb,CAAC;QACD,gBAAgB,EAAE,CAAC;YACjB,EAAE,EAAE,aAAa;QACnB,CAAC;mBACD,SAAS;oBACT,UAAU;oBACV,UAAU;mBACV,SAAS;IACX,CAAC;AACH,CAAC;;;;;;;SC/He,wCAAiB,CAAC,KAA8B,EAAsB,CAAC;IACrF,GAAG,CAAC,CAAC,UAAA,OAAO,GAAE,CAAY,aAAE,SAAS,EAAA,CAAC,GAAG,KAAK;IAC9C,GAAG,CAAC,SAAS,GAAG,YAAK;IAErB,MAAM,CAAC,CAAC;QACN,SAAS,EAAE,CAAC;YACV,IAAI,EAAE,CAAc;QACtB,CAAC;QACD,YAAY,EAAE,OAAO,GAAG,CAAC;YACvB,EAAkE,AAAlE,gEAAkE;YAClE,EAAiE,AAAjE,+DAAiE;YACjE,EAAmC,AAAnC,iCAAmC;YACnC,EAAE,EAAE,SAAS;YACb,CAAa,cAAE,IAAI;QACrB,CAAC,GAAG,CAAC;QAAA,CAAC;QACN,UAAU,EAAE,CAAC;YACX,IAAI,EAAE,CAAO;YACb,CAAY,aAAE,SAAS;YACvB,CAAiB,kBAAE,OAAO,GAAG,SAAS,GAAG,SAAS;QACpD,CAAC;IACH,CAAC;AACH,CAAC;","sources":["packages/@react-aria/listbox/src/index.ts","packages/@react-aria/listbox/src/useListBox.ts","packages/@react-aria/listbox/src/utils.ts","packages/@react-aria/listbox/src/useOption.ts","packages/@react-aria/listbox/src/useListBoxSection.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 * from './useListBox';\nexport * from './useOption';\nexport * from './useListBoxSection';\nexport * from './utils';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaListBoxProps} from '@react-types/listbox';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {HTMLAttributes, ReactNode, RefObject} from 'react';\nimport {KeyboardDelegate} from '@react-types/shared';\nimport {listData} from './utils';\nimport {ListState} from '@react-stately/list';\nimport {useFocusWithin} from '@react-aria/interactions';\nimport {useId} from '@react-aria/utils';\nimport {useLabel} from '@react-aria/label';\nimport {useSelectableList} from '@react-aria/selection';\n\ninterface ListBoxAria {\n /** Props for the listbox element. */\n listBoxProps: HTMLAttributes<HTMLElement>,\n /** Props for the listbox's visual label element (if any). */\n labelProps: HTMLAttributes<HTMLElement>\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 * Whether the listbox items should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n\n /** Whether selection should occur on press up instead of press down. */\n shouldSelectOnPressUp?: boolean,\n\n /** Whether options should be focused when the user hovers over them. */\n shouldFocusOnHover?: boolean,\n\n /**\n * An optional visual label for the listbox.\n */\n label?: ReactNode\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>): ListBoxAria {\n let domProps = filterDOMProps(props, {labelable: true});\n let {listProps} = useSelectableList({\n ...props,\n ref,\n selectionManager: state.selectionManager,\n collection: state.collection,\n disabledKeys: state.disabledKeys\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 });\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","/*\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 {Key} from 'react';\nimport {ListState} from '@react-stately/list';\n\ninterface ListData {\n id: string,\n shouldSelectOnPressUp?: boolean,\n shouldFocusOnHover?: boolean,\n shouldUseVirtualFocus?: boolean,\n isVirtualized?: boolean\n}\n\nexport const listData = new WeakMap<ListState<unknown>, ListData>();\n\nfunction normalizeKey(key: Key): string {\n if (typeof key === 'string') {\n return key.replace(/\\s*/g, '');\n }\n\n return '' + key;\n}\n\nexport function getItemId<T>(state: ListState<T>, itemKey: Key): string {\n let data = listData.get(state);\n\n if (!data) {\n throw new Error('Unknown list');\n }\n\n return `${data.id}-option-${normalizeKey(itemKey)}`;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getItemCount} from '@react-stately/collections';\nimport {getItemId, listData} from './utils';\nimport {HTMLAttributes, Key, RefObject} from 'react';\nimport {isFocusVisible, useHover} from '@react-aria/interactions';\nimport {isMac, isWebKit, mergeProps, useSlotId} from '@react-aria/utils';\nimport {ListState} from '@react-stately/list';\nimport {useSelectableItem} from '@react-aria/selection';\n\ninterface OptionAria {\n /** Props for the option element. */\n optionProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the main text element inside the option. */\n labelProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the description text element inside the option, if any. */\n descriptionProps: HTMLAttributes<HTMLElement>,\n\n /** Whether the option is currently focused. */\n isFocused: boolean,\n /** Whether the option is currently selected. */\n isSelected: boolean,\n /** Whether the option is currently in a pressed state. */\n isPressed: boolean,\n /** Whether the option is disabled. */\n isDisabled: boolean\n}\n\ninterface AriaOptionProps {\n /**\n * Whether the option is disabled.\n * @deprecated\n */\n isDisabled?: boolean,\n\n /**\n * Whether the option is selected.\n * @deprecated\n */\n isSelected?: boolean,\n\n /** A screen reader only label for the option. */\n 'aria-label'?: string,\n\n /** The unique key for the option. */\n key: Key,\n\n /**\n * Whether selection should occur on press up instead of press down.\n * @deprecated\n */\n shouldSelectOnPressUp?: boolean,\n\n /**\n * Whether the option should be focused when the user hovers over it.\n * @deprecated\n */\n shouldFocusOnHover?: boolean,\n\n /**\n * Whether the option is contained in a virtual scrolling listbox.\n * @deprecated\n */\n isVirtualized?: boolean,\n\n /**\n * Whether the option should use virtual focus instead of being focused directly.\n * @deprecated\n */\n shouldUseVirtualFocus?: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for an option in a listbox.\n * See `useListBox` for more details about listboxes.\n * @param props - Props for the option.\n * @param state - State for the listbox, as returned by `useListState`.\n */\nexport function useOption<T>(props: AriaOptionProps, state: ListState<T>, ref: RefObject<HTMLElement>): OptionAria {\n let {\n key\n } = props;\n\n let data = listData.get(state);\n\n let isDisabled = props.isDisabled ?? state.disabledKeys.has(key);\n let isSelected = props.isSelected ?? state.selectionManager.isSelected(key);\n let isFocused = state.selectionManager.focusedKey === key;\n let shouldSelectOnPressUp = props.shouldSelectOnPressUp ?? data.shouldSelectOnPressUp;\n let shouldFocusOnHover = props.shouldFocusOnHover ?? data.shouldFocusOnHover;\n let shouldUseVirtualFocus = props.shouldUseVirtualFocus ?? data.shouldUseVirtualFocus;\n let isVirtualized = props.isVirtualized ?? data.isVirtualized;\n\n let labelId = useSlotId();\n let descriptionId = useSlotId();\n\n let optionProps = {\n role: 'option',\n 'aria-disabled': isDisabled,\n 'aria-selected': state.selectionManager.selectionMode !== 'none' ? isSelected : undefined\n };\n\n // Safari with VoiceOver on macOS misreads options with aria-labelledby or aria-label as simply \"text\".\n // We should not map slots to the label and description on Safari and instead just have VoiceOver read the textContent.\n // https://bugs.webkit.org/show_bug.cgi?id=209279\n if (!(isMac() && isWebKit())) {\n optionProps['aria-label'] = props['aria-label'];\n optionProps['aria-labelledby'] = labelId;\n optionProps['aria-describedby'] = descriptionId;\n }\n\n if (isVirtualized) {\n optionProps['aria-posinset'] = state.collection.getItem(key).index + 1;\n optionProps['aria-setsize'] = getItemCount(state.collection);\n }\n\n let {itemProps, isPressed} = useSelectableItem({\n selectionManager: state.selectionManager,\n key,\n ref,\n shouldSelectOnPressUp,\n isVirtualized,\n shouldUseVirtualFocus,\n isDisabled\n });\n\n let {hoverProps} = useHover({\n isDisabled: isDisabled || !shouldFocusOnHover,\n onHoverStart() {\n if (!isFocusVisible()) {\n state.selectionManager.setFocused(true);\n state.selectionManager.setFocusedKey(key);\n }\n }\n });\n\n return {\n optionProps: {\n ...optionProps,\n ...mergeProps(itemProps, hoverProps),\n id: getItemId(state, key)\n },\n labelProps: {\n id: labelId\n },\n descriptionProps: {\n id: descriptionId\n },\n isFocused,\n isSelected,\n isDisabled,\n isPressed\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {HTMLAttributes, ReactNode} from 'react';\nimport {useId} from '@react-aria/utils';\n\ninterface AriaListBoxSectionProps {\n /** The heading for the section. */\n heading?: ReactNode,\n /** An accessibility label for the section. Required if `heading` is not present. */\n 'aria-label'?: string\n}\n\ninterface ListBoxSectionAria {\n /** Props for the wrapper list item. */\n itemProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the heading element, if any. */\n headingProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the group element. */\n groupProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a section in a listbox.\n * See `useListBox` for more details about listboxes.\n * @param props - Props for the section.\n */\nexport function useListBoxSection(props: AriaListBoxSectionProps): ListBoxSectionAria {\n let {heading, 'aria-label': ariaLabel} = props;\n let headingId = useId();\n\n return {\n itemProps: {\n role: 'presentation'\n },\n headingProps: heading ? {\n // Techincally, listbox cannot contain headings according to ARIA.\n // We hide the heading from assistive technology, and only use it\n // as a label for the nested group.\n id: headingId,\n 'aria-hidden': true\n } : {},\n groupProps: {\n role: 'group',\n 'aria-label': ariaLabel,\n 'aria-labelledby': heading ? headingId : undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/listbox",
3
- "version": "3.4.1",
3
+ "version": "3.4.3-nightly.3120+1aa66e6e7",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -18,15 +18,15 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@babel/runtime": "^7.6.2",
21
- "@react-aria/focus": "^3.5.1",
22
- "@react-aria/interactions": "^3.8.0",
23
- "@react-aria/label": "^3.2.2",
24
- "@react-aria/selection": "^3.7.2",
25
- "@react-aria/utils": "^3.11.1",
26
- "@react-stately/collections": "^3.3.5",
27
- "@react-stately/list": "^3.4.2",
28
- "@react-types/listbox": "^3.2.2",
29
- "@react-types/shared": "^3.11.0"
21
+ "@react-aria/focus": "3.0.0-nightly.1424+1aa66e6e7",
22
+ "@react-aria/interactions": "3.0.0-nightly.1424+1aa66e6e7",
23
+ "@react-aria/label": "3.0.0-nightly.1424+1aa66e6e7",
24
+ "@react-aria/selection": "3.0.0-nightly.1424+1aa66e6e7",
25
+ "@react-aria/utils": "3.0.0-nightly.1424+1aa66e6e7",
26
+ "@react-stately/collections": "3.0.0-nightly.1424+1aa66e6e7",
27
+ "@react-stately/list": "3.4.4-nightly.3120+1aa66e6e7",
28
+ "@react-types/listbox": "3.2.4-nightly.3120+1aa66e6e7",
29
+ "@react-types/shared": "3.0.0-nightly.1424+1aa66e6e7"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": "^16.8.0 || ^17.0.0-rc.1"
@@ -34,5 +34,5 @@
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
- "gitHead": "54c2366c4f31bd4bf619126131cd583c12972acc"
37
+ "gitHead": "1aa66e6e75e2da014f44177686c3332cd625fb9f"
38
38
  }