@react-spectrum/listbox 3.12.8-nightly.4552 → 3.12.8-nightly.4558

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/ListBox.main.js +48 -0
  2. package/dist/ListBox.main.js.map +1 -0
  3. package/dist/ListBox.mjs +39 -0
  4. package/dist/ListBox.module.js +39 -0
  5. package/dist/ListBox.module.js.map +1 -0
  6. package/dist/ListBoxBase.main.js +168 -0
  7. package/dist/ListBoxBase.main.js.map +1 -0
  8. package/dist/ListBoxBase.mjs +162 -0
  9. package/dist/ListBoxBase.module.js +162 -0
  10. package/dist/ListBoxBase.module.js.map +1 -0
  11. package/dist/ListBoxContext.main.js +27 -0
  12. package/dist/ListBoxContext.main.js.map +1 -0
  13. package/dist/ListBoxContext.mjs +18 -0
  14. package/dist/ListBoxContext.module.js +18 -0
  15. package/dist/ListBoxContext.module.js.map +1 -0
  16. package/dist/ListBoxOption.main.js +108 -0
  17. package/dist/ListBoxOption.main.js.map +1 -0
  18. package/dist/ListBoxOption.mjs +103 -0
  19. package/dist/ListBoxOption.module.js +103 -0
  20. package/dist/ListBoxOption.module.js.map +1 -0
  21. package/dist/ListBoxSection.main.js +69 -0
  22. package/dist/ListBoxSection.main.js.map +1 -0
  23. package/dist/ListBoxSection.mjs +64 -0
  24. package/dist/ListBoxSection.module.js +64 -0
  25. package/dist/ListBoxSection.module.js.map +1 -0
  26. package/dist/ar-AE.mjs +1 -1
  27. package/dist/bg-BG.mjs +1 -1
  28. package/dist/cs-CZ.mjs +1 -1
  29. package/dist/da-DK.mjs +1 -1
  30. package/dist/de-DE.mjs +1 -1
  31. package/dist/el-GR.mjs +1 -1
  32. package/dist/en-US.mjs +1 -1
  33. package/dist/es-ES.mjs +1 -1
  34. package/dist/et-EE.mjs +1 -1
  35. package/dist/fi-FI.mjs +1 -1
  36. package/dist/fr-FR.mjs +1 -1
  37. package/dist/he-IL.mjs +1 -1
  38. package/dist/hr-HR.mjs +1 -1
  39. package/dist/hu-HU.mjs +1 -1
  40. package/dist/import.mjs +2 -615
  41. package/dist/intlStrings.main.js +108 -0
  42. package/dist/intlStrings.main.js.map +1 -0
  43. package/dist/intlStrings.mjs +110 -0
  44. package/dist/intlStrings.module.js +110 -0
  45. package/dist/intlStrings.module.js.map +1 -0
  46. package/dist/it-IT.mjs +1 -1
  47. package/dist/ja-JP.mjs +1 -1
  48. package/dist/ko-KR.mjs +1 -1
  49. package/dist/lt-LT.mjs +1 -1
  50. package/dist/lv-LV.mjs +1 -1
  51. package/dist/main.js +5 -614
  52. package/dist/main.js.map +1 -1
  53. package/dist/menu_vars_css.main.js +177 -0
  54. package/dist/menu_vars_css.main.js.map +1 -0
  55. package/dist/menu_vars_css.mjs +179 -0
  56. package/dist/menu_vars_css.module.js +179 -0
  57. package/dist/menu_vars_css.module.js.map +1 -0
  58. package/dist/module.js +2 -615
  59. package/dist/module.js.map +1 -1
  60. package/dist/nb-NO.mjs +1 -1
  61. package/dist/nl-NL.mjs +1 -1
  62. package/dist/pl-PL.mjs +1 -1
  63. package/dist/pt-BR.mjs +1 -1
  64. package/dist/pt-PT.mjs +1 -1
  65. package/dist/ro-RO.mjs +1 -1
  66. package/dist/ru-RU.mjs +1 -1
  67. package/dist/sk-SK.mjs +1 -1
  68. package/dist/sl-SI.mjs +1 -1
  69. package/dist/sr-SP.mjs +1 -1
  70. package/dist/sv-SE.mjs +1 -1
  71. package/dist/tr-TR.mjs +1 -1
  72. package/dist/uk-UA.mjs +1 -1
  73. package/dist/{main.css → vars.5bf8960a.css} +1 -1
  74. package/dist/{main.css.map → vars.5bf8960a.css.map} +1 -1
  75. package/dist/zh-CN.mjs +1 -1
  76. package/dist/zh-TW.mjs +1 -1
  77. package/package.json +20 -20
  78. package/dist/module.css +0 -563
  79. package/dist/module.css.map +0 -1
@@ -0,0 +1,162 @@
1
+ import $gF3QK$intlStringsmodulejs from "./intlStrings.module.js";
2
+ import {ListBoxContext as $0c6f792811e33483$export$7ff8f37d2d81a48d} from "./ListBoxContext.module.js";
3
+ import {ListBoxOption as $86983ea1fa3f7312$export$feb3b6b552c14a12} from "./ListBoxOption.module.js";
4
+ import {ListBoxSection as $92d678ed88836094$export$dca12b0bb56e4fc} from "./ListBoxSection.module.js";
5
+ import "./vars.5bf8960a.css";
6
+ import $gF3QK$menu_vars_cssmodulejs from "./menu_vars_css.module.js";
7
+ import {useListBox as $gF3QK$useListBox} from "@react-aria/listbox";
8
+ import {useStyleProps as $gF3QK$useStyleProps, classNames as $gF3QK$classNames} from "@react-spectrum/utils";
9
+ import {FocusScope as $gF3QK$FocusScope} from "@react-aria/focus";
10
+ import {ListLayout as $gF3QK$ListLayout} from "@react-stately/layout";
11
+ import {useLayoutEffect as $gF3QK$useLayoutEffect, mergeProps as $gF3QK$mergeProps} from "@react-aria/utils";
12
+ import {ProgressCircle as $gF3QK$ProgressCircle} from "@react-spectrum/progress";
13
+ import $gF3QK$react, {useMemo as $gF3QK$useMemo} from "react";
14
+ import {useCollator as $gF3QK$useCollator, useLocalizedStringFormatter as $gF3QK$useLocalizedStringFormatter} from "@react-aria/i18n";
15
+ import {useProvider as $gF3QK$useProvider} from "@react-spectrum/provider";
16
+ import {VirtualizerItem as $gF3QK$VirtualizerItem, Virtualizer as $gF3QK$Virtualizer} from "@react-aria/virtualizer";
17
+
18
+
19
+ function $parcel$interopDefault(a) {
20
+ return a && a.__esModule ? a.default : a;
21
+ }
22
+ /*
23
+ * Copyright 2020 Adobe. All rights reserved.
24
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
25
+ * you may not use this file except in compliance with the License. You may obtain a copy
26
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
27
+ *
28
+ * Unless required by applicable law or agreed to in writing, software distributed under
29
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
30
+ * OF ANY KIND, either express or implied. See the License for the specific language
31
+ * governing permissions and limitations under the License.
32
+ */
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+ function $3247d4a89e6094e9$export$25768ea656ae32a7(state, isLoading) {
48
+ let { scale: scale } = (0, $gF3QK$useProvider)();
49
+ let collator = (0, $gF3QK$useCollator)({
50
+ usage: "search",
51
+ sensitivity: "base"
52
+ });
53
+ let layout = (0, $gF3QK$useMemo)(()=>new (0, $gF3QK$ListLayout)({
54
+ estimatedRowHeight: scale === "large" ? 48 : 32,
55
+ estimatedHeadingHeight: scale === "large" ? 33 : 26,
56
+ padding: scale === "large" ? 5 : 4,
57
+ loaderHeight: 40,
58
+ placeholderHeight: scale === "large" ? 48 : 32,
59
+ collator: collator
60
+ }), [
61
+ collator,
62
+ scale
63
+ ]);
64
+ layout.collection = state.collection;
65
+ layout.disabledKeys = state.disabledKeys;
66
+ (0, $gF3QK$useLayoutEffect)(()=>{
67
+ // Sync loading state into the layout.
68
+ if (layout.isLoading !== isLoading) {
69
+ var _layout_virtualizer;
70
+ layout.isLoading = isLoading;
71
+ (_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.relayoutNow();
72
+ }
73
+ }, [
74
+ layout,
75
+ isLoading
76
+ ]);
77
+ return layout;
78
+ }
79
+ /** @private */ function $3247d4a89e6094e9$var$ListBoxBase(props, ref) {
80
+ let { layout: layout, state: state, shouldSelectOnPressUp: shouldSelectOnPressUp, focusOnPointerEnter: focusOnPointerEnter, shouldUseVirtualFocus: shouldUseVirtualFocus, domProps: domProps = {}, transitionDuration: transitionDuration = 0, onScroll: onScroll } = props;
81
+ let { listBoxProps: listBoxProps } = (0, $gF3QK$useListBox)({
82
+ ...props,
83
+ keyboardDelegate: layout,
84
+ isVirtualized: true
85
+ }, state, ref);
86
+ let { styleProps: styleProps } = (0, $gF3QK$useStyleProps)(props);
87
+ let stringFormatter = (0, $gF3QK$useLocalizedStringFormatter)((0, ($parcel$interopDefault($gF3QK$intlStringsmodulejs))), "@react-spectrum/listbox");
88
+ let renderWrapper = (parent, reusableView, children, renderChildren)=>{
89
+ if (reusableView.viewType === "section") return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $92d678ed88836094$export$dca12b0bb56e4fc), {
90
+ key: reusableView.key,
91
+ item: reusableView.content,
92
+ layoutInfo: reusableView.layoutInfo,
93
+ virtualizer: reusableView.virtualizer,
94
+ headerLayoutInfo: children.find((c)=>c.viewType === "header").layoutInfo
95
+ }, renderChildren(children.filter((c)=>c.viewType === "item")));
96
+ return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$VirtualizerItem), {
97
+ key: reusableView.key,
98
+ layoutInfo: reusableView.layoutInfo,
99
+ virtualizer: reusableView.virtualizer,
100
+ parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
101
+ }, reusableView.rendered);
102
+ };
103
+ return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $0c6f792811e33483$export$7ff8f37d2d81a48d).Provider, {
104
+ value: state
105
+ }, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$FocusScope), null, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$Virtualizer), {
106
+ ...styleProps,
107
+ ...(0, $gF3QK$mergeProps)(listBoxProps, domProps),
108
+ ref: ref,
109
+ focusedKey: state.selectionManager.focusedKey,
110
+ autoFocus: !!props.autoFocus,
111
+ sizeToFit: "height",
112
+ scrollDirection: "vertical",
113
+ className: (0, $gF3QK$classNames)((0, ($parcel$interopDefault($gF3QK$menu_vars_cssmodulejs))), "spectrum-Menu", styleProps.className),
114
+ layout: layout,
115
+ collection: state.collection,
116
+ renderWrapper: renderWrapper,
117
+ transitionDuration: transitionDuration,
118
+ isLoading: props.isLoading,
119
+ onLoadMore: props.onLoadMore,
120
+ shouldUseVirtualFocus: shouldUseVirtualFocus,
121
+ onScroll: onScroll
122
+ }, (type, item)=>{
123
+ if (type === "item") return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $86983ea1fa3f7312$export$feb3b6b552c14a12), {
124
+ item: item,
125
+ shouldSelectOnPressUp: shouldSelectOnPressUp,
126
+ shouldFocusOnHover: focusOnPointerEnter,
127
+ shouldUseVirtualFocus: shouldUseVirtualFocus
128
+ });
129
+ else if (type === "loader") return(// aria-selected isn't needed here since this option is not selectable.
130
+ // eslint-disable-next-line jsx-a11y/role-has-required-aria-props
131
+ /*#__PURE__*/ (0, $gF3QK$react).createElement("div", {
132
+ role: "option",
133
+ style: {
134
+ display: "flex",
135
+ alignItems: "center",
136
+ justifyContent: "center",
137
+ height: "100%"
138
+ }
139
+ }, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$ProgressCircle), {
140
+ isIndeterminate: true,
141
+ size: "S",
142
+ "aria-label": state.collection.size > 0 ? stringFormatter.format("loadingMore") : stringFormatter.format("loading"),
143
+ UNSAFE_className: (0, $gF3QK$classNames)((0, ($parcel$interopDefault($gF3QK$menu_vars_cssmodulejs))), "spectrum-Dropdown-progressCircle")
144
+ })));
145
+ else if (type === "placeholder") {
146
+ let emptyState = props.renderEmptyState ? props.renderEmptyState() : null;
147
+ if (emptyState == null) return null;
148
+ return /*#__PURE__*/ (0, $gF3QK$react).createElement("div", {
149
+ // aria-selected isn't needed here since this option is not selectable.
150
+ // eslint-disable-next-line jsx-a11y/role-has-required-aria-props
151
+ role: "option"
152
+ }, emptyState);
153
+ }
154
+ })));
155
+ }
156
+ // forwardRef doesn't support generic parameters, so cast the result to the correct type
157
+ // https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
158
+ const $3247d4a89e6094e9$export$1afdcf349979fb7e = /*#__PURE__*/ (0, $gF3QK$react).forwardRef($3247d4a89e6094e9$var$ListBoxBase);
159
+
160
+
161
+ export {$3247d4a89e6094e9$export$25768ea656ae32a7 as useListBoxLayout, $3247d4a89e6094e9$export$1afdcf349979fb7e as ListBoxBase};
162
+ //# sourceMappingURL=ListBoxBase.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";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,iEAAiE;sBACjE,gCAAC;YAAI,MAAK;YAAS,OAAO;gBAAC,SAAS;gBAAQ,YAAY;gBAAU,gBAAgB;gBAAU,QAAQ;YAAM;yBACxG,gCAAC,CAAA,GAAA,qBAAa;YACZ,iBAAA;YACA,MAAK;YACL,cAAY,MAAM,UAAU,CAAC,IAAI,GAAG,IAAI,gBAAgB,MAAM,CAAC,iBAAiB,gBAAgB,MAAM,CAAC;YACvG,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;;aAGtC,IAAI,SAAS,eAAe;YACjC,IAAI,aAAa,MAAM,gBAAgB,GAAG,MAAM,gBAAgB,KAAK;YACrE,IAAI,cAAc,MAChB,OAAO;YAGT,qBACE,gCAAC;gBACC,uEAAuE;gBACvE,iEAAiE;gBACjE,MAAK;eACJ;QAGP;IACF;AAKV;AAEA,wFAAwF;AACxF,2GAA2G;AAC3G,MAAM,0DAAe,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/listbox/src/ListBoxBase.tsx"],"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 {AriaLabelingProps, DOMProps, FocusStrategy, Node, StyleProps} from '@react-types/shared';\nimport {AriaListBoxOptions, useListBox} from '@react-aria/listbox';\nimport {classNames, useStyleProps} from '@react-spectrum/utils';\nimport {FocusScope} from '@react-aria/focus';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {ListBoxContext} from './ListBoxContext';\nimport {ListBoxOption} from './ListBoxOption';\nimport {ListBoxSection} from './ListBoxSection';\nimport {ListLayout} from '@react-stately/layout';\nimport {ListState} from '@react-stately/list';\nimport {mergeProps, useLayoutEffect} from '@react-aria/utils';\nimport {ProgressCircle} from '@react-spectrum/progress';\nimport React, {HTMLAttributes, ReactElement, ReactNode, RefObject, useMemo} from 'react';\nimport {ReusableView} from '@react-stately/virtualizer';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {useCollator, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useProvider} from '@react-spectrum/provider';\nimport {Virtualizer, VirtualizerItem} from '@react-aria/virtualizer';\n\ninterface ListBoxBaseProps<T> extends AriaListBoxOptions<T>, DOMProps, AriaLabelingProps, StyleProps {\n layout: ListLayout<T>,\n state: ListState<T>,\n autoFocus?: boolean | FocusStrategy,\n shouldFocusWrap?: boolean,\n shouldSelectOnPressUp?: boolean,\n focusOnPointerEnter?: boolean,\n domProps?: HTMLAttributes<HTMLElement>,\n disallowEmptySelection?: boolean,\n shouldUseVirtualFocus?: boolean,\n transitionDuration?: number,\n isLoading?: boolean,\n onLoadMore?: () => void,\n renderEmptyState?: () => ReactNode,\n onScroll?: () => void\n}\n\n/** @private */\nexport function useListBoxLayout<T>(state: ListState<T>, isLoading: boolean): ListLayout<T> {\n let {scale} = useProvider();\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let layout = useMemo(() =>\n new ListLayout<T>({\n estimatedRowHeight: scale === 'large' ? 48 : 32,\n estimatedHeadingHeight: scale === 'large' ? 33 : 26,\n padding: scale === 'large' ? 5 : 4, // TODO: get from DNA\n loaderHeight: 40,\n placeholderHeight: scale === 'large' ? 48 : 32,\n collator\n })\n , [collator, scale]);\n\n layout.collection = state.collection;\n layout.disabledKeys = state.disabledKeys;\n\n useLayoutEffect(() => {\n // Sync loading state into the layout.\n if (layout.isLoading !== isLoading) {\n layout.isLoading = isLoading;\n layout.virtualizer?.relayoutNow();\n }\n }, [layout, isLoading]);\n return layout;\n}\n\n/** @private */\nfunction ListBoxBase<T>(props: ListBoxBaseProps<T>, ref: RefObject<HTMLDivElement>) {\n let {layout, state, shouldSelectOnPressUp, focusOnPointerEnter, shouldUseVirtualFocus, domProps = {}, transitionDuration = 0, onScroll} = props;\n let {listBoxProps} = useListBox({\n ...props,\n keyboardDelegate: layout,\n isVirtualized: true\n }, state, ref);\n let {styleProps} = useStyleProps(props);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/listbox');\n\n // This overrides collection view's renderWrapper to support hierarchy of items in sections.\n // The header is extracted from the children so it can receive ARIA labeling properties.\n type View = ReusableView<Node<T>, ReactNode>;\n let renderWrapper = (parent: View, reusableView: View, children: View[], renderChildren: (views: View[]) => ReactElement[]) => {\n if (reusableView.viewType === 'section') {\n return (\n <ListBoxSection\n key={reusableView.key}\n item={reusableView.content}\n layoutInfo={reusableView.layoutInfo}\n virtualizer={reusableView.virtualizer}\n headerLayoutInfo={children.find(c => c.viewType === 'header').layoutInfo}>\n {renderChildren(children.filter(c => c.viewType === 'item'))}\n </ListBoxSection>\n );\n }\n\n return (\n <VirtualizerItem\n key={reusableView.key}\n layoutInfo={reusableView.layoutInfo}\n virtualizer={reusableView.virtualizer}\n parent={parent?.layoutInfo}>\n {reusableView.rendered}\n </VirtualizerItem>\n );\n };\n\n return (\n <ListBoxContext.Provider value={state}>\n <FocusScope>\n <Virtualizer\n {...styleProps}\n {...mergeProps(listBoxProps, domProps)}\n ref={ref}\n focusedKey={state.selectionManager.focusedKey}\n autoFocus={!!props.autoFocus}\n sizeToFit=\"height\"\n scrollDirection=\"vertical\"\n className={\n classNames(\n styles,\n 'spectrum-Menu',\n styleProps.className\n )\n }\n layout={layout}\n collection={state.collection}\n renderWrapper={renderWrapper}\n transitionDuration={transitionDuration}\n isLoading={props.isLoading}\n onLoadMore={props.onLoadMore}\n shouldUseVirtualFocus={shouldUseVirtualFocus}\n onScroll={onScroll}>\n {(type, item: Node<T>) => {\n if (type === 'item') {\n return (\n <ListBoxOption\n item={item}\n shouldSelectOnPressUp={shouldSelectOnPressUp}\n shouldFocusOnHover={focusOnPointerEnter}\n shouldUseVirtualFocus={shouldUseVirtualFocus} />\n );\n } else if (type === 'loader') {\n return (\n // aria-selected isn't needed here since this option is not selectable.\n // eslint-disable-next-line jsx-a11y/role-has-required-aria-props\n <div role=\"option\" style={{display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100%'}}>\n <ProgressCircle\n isIndeterminate\n size=\"S\"\n aria-label={state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading')}\n UNSAFE_className={classNames(styles, 'spectrum-Dropdown-progressCircle')} />\n </div>\n );\n } else if (type === 'placeholder') {\n let emptyState = props.renderEmptyState ? props.renderEmptyState() : null;\n if (emptyState == null) {\n return null;\n }\n\n return (\n <div\n // aria-selected isn't needed here since this option is not selectable.\n // eslint-disable-next-line jsx-a11y/role-has-required-aria-props\n role=\"option\">\n {emptyState}\n </div>\n );\n }\n }}\n </Virtualizer>\n </FocusScope>\n </ListBoxContext.Provider>\n );\n}\n\n// forwardRef doesn't support generic parameters, so cast the result to the correct type\n// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref\nconst _ListBoxBase = React.forwardRef(ListBoxBase) as <T>(props: ListBoxBaseProps<T> & {ref?: RefObject<HTMLDivElement>}) => ReactElement;\nexport {_ListBoxBase as ListBoxBase};\n"],"names":[],"version":3,"file":"ListBoxBase.module.js.map"}
@@ -0,0 +1,27 @@
1
+ var $497sr$react = require("react");
2
+
3
+
4
+ function $parcel$interopDefault(a) {
5
+ return a && a.__esModule ? a.default : a;
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, "ListBoxContext", () => $611e93c7b7c0413c$export$7ff8f37d2d81a48d);
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
+ const $611e93c7b7c0413c$export$7ff8f37d2d81a48d = (0, ($parcel$interopDefault($497sr$react))).createContext(null);
25
+
26
+
27
+ //# sourceMappingURL=ListBoxContext.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAKM,MAAM,4CAAiB,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAqB","sources":["packages/@react-spectrum/listbox/src/ListBoxContext.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 {ListState} from '@react-stately/list';\nimport React from 'react';\n\nexport const ListBoxContext = React.createContext<ListState<unknown>>(null);\n"],"names":[],"version":3,"file":"ListBoxContext.main.js.map"}
@@ -0,0 +1,18 @@
1
+ import $8XLda$react from "react";
2
+
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ const $0c6f792811e33483$export$7ff8f37d2d81a48d = (0, $8XLda$react).createContext(null);
15
+
16
+
17
+ export {$0c6f792811e33483$export$7ff8f37d2d81a48d as ListBoxContext};
18
+ //# sourceMappingURL=ListBoxContext.mjs.map
@@ -0,0 +1,18 @@
1
+ import $8XLda$react from "react";
2
+
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ const $0c6f792811e33483$export$7ff8f37d2d81a48d = (0, $8XLda$react).createContext(null);
15
+
16
+
17
+ export {$0c6f792811e33483$export$7ff8f37d2d81a48d as ListBoxContext};
18
+ //# sourceMappingURL=ListBoxContext.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAKM,MAAM,4CAAiB,CAAA,GAAA,YAAI,EAAE,aAAa,CAAqB","sources":["packages/@react-spectrum/listbox/src/ListBoxContext.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 {ListState} from '@react-stately/list';\nimport React from 'react';\n\nexport const ListBoxContext = React.createContext<ListState<unknown>>(null);\n"],"names":[],"version":3,"file":"ListBoxContext.module.js.map"}
@@ -0,0 +1,108 @@
1
+ var $611e93c7b7c0413c$exports = require("./ListBoxContext.main.js");
2
+ require("./vars.5bf8960a.css");
3
+ var $3deee0fd2b46e64f$exports = require("./menu_vars_css.main.js");
4
+ var $8xmxv$spectrumiconsuiCheckmarkMedium = require("@spectrum-icons/ui/CheckmarkMedium");
5
+ var $8xmxv$reactspectrumutils = require("@react-spectrum/utils");
6
+ var $8xmxv$reactariafocus = require("@react-aria/focus");
7
+ var $8xmxv$reactspectrumlayout = require("@react-spectrum/layout");
8
+ var $8xmxv$reactariainteractions = require("@react-aria/interactions");
9
+ var $8xmxv$reactariautils = require("@react-aria/utils");
10
+ var $8xmxv$react = require("react");
11
+ var $8xmxv$reactspectrumtext = require("@react-spectrum/text");
12
+ var $8xmxv$reactarialistbox = require("@react-aria/listbox");
13
+
14
+
15
+ function $parcel$interopDefault(a) {
16
+ return a && a.__esModule ? a.default : a;
17
+ }
18
+
19
+ function $parcel$export(e, n, v, s) {
20
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
21
+ }
22
+
23
+ $parcel$export(module.exports, "ListBoxOption", () => $2205d250ee1cb1ac$export$feb3b6b552c14a12);
24
+ /*
25
+ * Copyright 2020 Adobe. All rights reserved.
26
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
27
+ * you may not use this file except in compliance with the License. You may obtain a copy
28
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
29
+ *
30
+ * Unless required by applicable law or agreed to in writing, software distributed under
31
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
32
+ * OF ANY KIND, either express or implied. See the License for the specific language
33
+ * governing permissions and limitations under the License.
34
+ */
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+ function $2205d250ee1cb1ac$export$feb3b6b552c14a12(props) {
46
+ let { item: item, shouldSelectOnPressUp: shouldSelectOnPressUp, shouldFocusOnHover: shouldFocusOnHover, shouldUseVirtualFocus: shouldUseVirtualFocus } = props;
47
+ let { rendered: rendered, key: key } = item;
48
+ let ElementType = item.props.href ? "a" : "div";
49
+ let state = (0, $8xmxv$react.useContext)((0, $611e93c7b7c0413c$exports.ListBoxContext));
50
+ let ref = (0, $8xmxv$react.useRef)();
51
+ let { optionProps: optionProps, labelProps: labelProps, descriptionProps: descriptionProps, isSelected: isSelected, isDisabled: isDisabled, isFocused: isFocused } = (0, $8xmxv$reactarialistbox.useOption)({
52
+ "aria-label": item["aria-label"],
53
+ key: key,
54
+ shouldSelectOnPressUp: shouldSelectOnPressUp,
55
+ shouldFocusOnHover: shouldFocusOnHover,
56
+ isVirtualized: true,
57
+ shouldUseVirtualFocus: shouldUseVirtualFocus
58
+ }, state, ref);
59
+ let { hoverProps: hoverProps, isHovered: isHovered } = (0, $8xmxv$reactariainteractions.useHover)({
60
+ ...props,
61
+ isDisabled: isDisabled
62
+ });
63
+ let contents = typeof rendered === "string" ? /*#__PURE__*/ (0, ($parcel$interopDefault($8xmxv$react))).createElement((0, $8xmxv$reactspectrumtext.Text), null, rendered) : rendered;
64
+ let isKeyboardModality = (0, $8xmxv$reactariainteractions.isFocusVisible)();
65
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($8xmxv$react))).createElement((0, $8xmxv$reactariafocus.FocusRing), {
66
+ focusRingClass: (0, $8xmxv$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), "focus-ring")
67
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($8xmxv$react))).createElement(ElementType, {
68
+ ...(0, $8xmxv$reactariautils.mergeProps)(optionProps, shouldFocusOnHover ? {} : hoverProps),
69
+ ref: ref,
70
+ className: (0, $8xmxv$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), "spectrum-Menu-item", {
71
+ // If using virtual focus, apply focused styles to the item when the user is interacting with keyboard modality
72
+ "is-focused": shouldUseVirtualFocus && isFocused && isKeyboardModality,
73
+ "is-disabled": isDisabled,
74
+ "is-selected": isSelected,
75
+ "is-selectable": state.selectionManager.selectionMode !== "none",
76
+ // When shouldFocusOnHover is false, apply hover styles both when hovered with the mouse.
77
+ // Otherwise, apply hover styles when focused using non-keyboard modality.
78
+ "is-hovered": isHovered && !shouldFocusOnHover || isFocused && !isKeyboardModality
79
+ })
80
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($8xmxv$react))).createElement((0, $8xmxv$reactspectrumlayout.Grid), {
81
+ UNSAFE_className: (0, $8xmxv$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), "spectrum-Menu-itemGrid")
82
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($8xmxv$react))).createElement((0, $8xmxv$reactspectrumutils.ClearSlots), null, /*#__PURE__*/ (0, ($parcel$interopDefault($8xmxv$react))).createElement((0, $8xmxv$reactspectrumutils.SlotProvider), {
83
+ slots: {
84
+ text: {
85
+ UNSAFE_className: (0, ($parcel$interopDefault($3deee0fd2b46e64f$exports)))["spectrum-Menu-itemLabel"],
86
+ ...labelProps
87
+ },
88
+ icon: {
89
+ size: "S",
90
+ UNSAFE_className: (0, ($parcel$interopDefault($3deee0fd2b46e64f$exports)))["spectrum-Menu-icon"]
91
+ },
92
+ avatar: {
93
+ size: "avatar-size-100",
94
+ UNSAFE_className: (0, ($parcel$interopDefault($3deee0fd2b46e64f$exports)))["spectrum-Menu-avatar"]
95
+ },
96
+ description: {
97
+ UNSAFE_className: (0, ($parcel$interopDefault($3deee0fd2b46e64f$exports)))["spectrum-Menu-description"],
98
+ ...descriptionProps
99
+ }
100
+ }
101
+ }, contents, isSelected && /*#__PURE__*/ (0, ($parcel$interopDefault($8xmxv$react))).createElement((0, ($parcel$interopDefault($8xmxv$spectrumiconsuiCheckmarkMedium))), {
102
+ slot: "checkmark",
103
+ UNSAFE_className: (0, $8xmxv$reactspectrumutils.classNames)((0, ($parcel$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AAc,yBAAyB,aAAa;YACpD,eAAe;YACf,eAAe;YACf,iBAAiB,MAAM,gBAAgB,CAAC,aAAa,KAAK;YAC1D,yFAAyF;YACzF,0EAA0E;YAC1E,cAAc,AAAC,aAAa,CAAC,sBAAwB,aAAa,CAAC;QACrE;qBAEF,0DAAC,CAAA,GAAA,+BAAG;QACF,kBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL;qBAGJ,0DAAC,CAAA,GAAA,oCAAS,uBACR,0DAAC,CAAA,GAAA,sCAAW;QACV,OAAO;YACL,MAAM;gBAAC,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,0BAA0B;gBAAE,GAAG,UAAU;YAAA;YACzE,MAAM;gBAAC,MAAM;gBAAK,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,qBAAqB;YAAA;YAChE,QAAQ;gBAAC,MAAM;gBAAmB,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,uBAAuB;YAAA;YAClF,aAAa;gBAAC,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,4BAA4B;gBAAE,GAAG,gBAAgB;YAAA;QAC1F;OACC,UACA,4BACC,0DAAC,CAAA,GAAA,+DAAc;QACb,MAAK;QACL,kBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL;;AAUtB","sources":["packages/@react-spectrum/listbox/src/ListBoxOption.tsx"],"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 CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';\nimport {classNames, ClearSlots, SlotProvider} from '@react-spectrum/utils';\nimport {FocusRing} from '@react-aria/focus';\nimport {Grid} from '@react-spectrum/layout';\nimport {isFocusVisible, useHover} from '@react-aria/interactions';\nimport {ListBoxContext} from './ListBoxContext';\nimport {mergeProps} from '@react-aria/utils';\nimport {Node} from '@react-types/shared';\nimport React, {useContext, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {Text} from '@react-spectrum/text';\nimport {useOption} from '@react-aria/listbox';\n\ninterface OptionProps<T> {\n item: Node<T>,\n shouldSelectOnPressUp?: boolean,\n shouldFocusOnHover?: boolean,\n shouldUseVirtualFocus?: boolean\n}\n\n/** @private */\nexport function ListBoxOption<T>(props: OptionProps<T>) {\n let {\n item,\n shouldSelectOnPressUp,\n shouldFocusOnHover,\n shouldUseVirtualFocus\n } = props;\n\n let {\n rendered,\n key\n } = item;\n let ElementType: React.ElementType = item.props.href ? 'a' : 'div';\n let state = useContext(ListBoxContext);\n\n let ref = useRef<any>();\n let {optionProps, labelProps, descriptionProps, isSelected, isDisabled, isFocused} = useOption(\n {\n 'aria-label': item['aria-label'],\n key,\n shouldSelectOnPressUp,\n shouldFocusOnHover,\n isVirtualized: true,\n shouldUseVirtualFocus\n },\n state,\n ref\n );\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled\n });\n\n let contents = typeof rendered === 'string'\n ? <Text>{rendered}</Text>\n : rendered;\n\n let isKeyboardModality = isFocusVisible();\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n <ElementType\n {...mergeProps(optionProps, shouldFocusOnHover ? {} : hoverProps)}\n ref={ref}\n className={classNames(\n styles,\n 'spectrum-Menu-item',\n {\n // If using virtual focus, apply focused styles to the item when the user is interacting with keyboard modality\n 'is-focused': shouldUseVirtualFocus && isFocused && isKeyboardModality,\n 'is-disabled': isDisabled,\n 'is-selected': isSelected,\n 'is-selectable': state.selectionManager.selectionMode !== 'none',\n // When shouldFocusOnHover is false, apply hover styles both when hovered with the mouse.\n // Otherwise, apply hover styles when focused using non-keyboard modality.\n 'is-hovered': (isHovered && !shouldFocusOnHover) || (isFocused && !isKeyboardModality)\n }\n )}>\n <Grid\n UNSAFE_className={\n classNames(\n styles,\n 'spectrum-Menu-itemGrid'\n )\n }>\n <ClearSlots>\n <SlotProvider\n slots={{\n text: {UNSAFE_className: styles['spectrum-Menu-itemLabel'], ...labelProps},\n icon: {size: 'S', UNSAFE_className: styles['spectrum-Menu-icon']},\n avatar: {size: 'avatar-size-100', UNSAFE_className: styles['spectrum-Menu-avatar']},\n description: {UNSAFE_className: styles['spectrum-Menu-description'], ...descriptionProps}\n }}>\n {contents}\n {isSelected &&\n <CheckmarkMedium\n slot=\"checkmark\"\n UNSAFE_className={\n classNames(\n styles,\n 'spectrum-Menu-checkmark'\n )\n } />\n }\n </SlotProvider>\n </ClearSlots>\n </Grid>\n </ElementType>\n </FocusRing>\n );\n}\n"],"names":[],"version":3,"file":"ListBoxOption.main.js.map"}
@@ -0,0 +1,103 @@
1
+ import {ListBoxContext as $0c6f792811e33483$export$7ff8f37d2d81a48d} from "./ListBoxContext.mjs";
2
+ import "./vars.5bf8960a.css";
3
+ import $6TrMC$menu_vars_cssmodulejs from "./menu_vars_css.mjs";
4
+ import $6TrMC$spectrumiconsuiCheckmarkMedium from "@spectrum-icons/ui/CheckmarkMedium";
5
+ import {classNames as $6TrMC$classNames, ClearSlots as $6TrMC$ClearSlots, SlotProvider as $6TrMC$SlotProvider} from "@react-spectrum/utils";
6
+ import {FocusRing as $6TrMC$FocusRing} from "@react-aria/focus";
7
+ import {Grid as $6TrMC$Grid} from "@react-spectrum/layout";
8
+ import {useHover as $6TrMC$useHover, isFocusVisible as $6TrMC$isFocusVisible} from "@react-aria/interactions";
9
+ import {mergeProps as $6TrMC$mergeProps} from "@react-aria/utils";
10
+ import $6TrMC$react, {useContext as $6TrMC$useContext, useRef as $6TrMC$useRef} from "react";
11
+ import {Text as $6TrMC$Text} from "@react-spectrum/text";
12
+ import {useOption as $6TrMC$useOption} from "@react-aria/listbox";
13
+
14
+
15
+ function $parcel$interopDefault(a) {
16
+ return a && a.__esModule ? a.default : a;
17
+ }
18
+ /*
19
+ * Copyright 2020 Adobe. All rights reserved.
20
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
21
+ * you may not use this file except in compliance with the License. You may obtain a copy
22
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
23
+ *
24
+ * Unless required by applicable law or agreed to in writing, software distributed under
25
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
26
+ * OF ANY KIND, either express or implied. See the License for the specific language
27
+ * governing permissions and limitations under the License.
28
+ */
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+ function $86983ea1fa3f7312$export$feb3b6b552c14a12(props) {
40
+ let { item: item, shouldSelectOnPressUp: shouldSelectOnPressUp, shouldFocusOnHover: shouldFocusOnHover, shouldUseVirtualFocus: shouldUseVirtualFocus } = props;
41
+ let { rendered: rendered, key: key } = item;
42
+ let ElementType = item.props.href ? "a" : "div";
43
+ let state = (0, $6TrMC$useContext)((0, $0c6f792811e33483$export$7ff8f37d2d81a48d));
44
+ let ref = (0, $6TrMC$useRef)();
45
+ let { optionProps: optionProps, labelProps: labelProps, descriptionProps: descriptionProps, isSelected: isSelected, isDisabled: isDisabled, isFocused: isFocused } = (0, $6TrMC$useOption)({
46
+ "aria-label": item["aria-label"],
47
+ key: key,
48
+ shouldSelectOnPressUp: shouldSelectOnPressUp,
49
+ shouldFocusOnHover: shouldFocusOnHover,
50
+ isVirtualized: true,
51
+ shouldUseVirtualFocus: shouldUseVirtualFocus
52
+ }, state, ref);
53
+ let { hoverProps: hoverProps, isHovered: isHovered } = (0, $6TrMC$useHover)({
54
+ ...props,
55
+ isDisabled: isDisabled
56
+ });
57
+ let contents = typeof rendered === "string" ? /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$Text), null, rendered) : rendered;
58
+ let isKeyboardModality = (0, $6TrMC$isFocusVisible)();
59
+ return /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$FocusRing), {
60
+ focusRingClass: (0, $6TrMC$classNames)((0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs))), "focus-ring")
61
+ }, /*#__PURE__*/ (0, $6TrMC$react).createElement(ElementType, {
62
+ ...(0, $6TrMC$mergeProps)(optionProps, shouldFocusOnHover ? {} : hoverProps),
63
+ ref: ref,
64
+ className: (0, $6TrMC$classNames)((0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs))), "spectrum-Menu-item", {
65
+ // If using virtual focus, apply focused styles to the item when the user is interacting with keyboard modality
66
+ "is-focused": shouldUseVirtualFocus && isFocused && isKeyboardModality,
67
+ "is-disabled": isDisabled,
68
+ "is-selected": isSelected,
69
+ "is-selectable": state.selectionManager.selectionMode !== "none",
70
+ // When shouldFocusOnHover is false, apply hover styles both when hovered with the mouse.
71
+ // Otherwise, apply hover styles when focused using non-keyboard modality.
72
+ "is-hovered": isHovered && !shouldFocusOnHover || isFocused && !isKeyboardModality
73
+ })
74
+ }, /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$Grid), {
75
+ UNSAFE_className: (0, $6TrMC$classNames)((0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs))), "spectrum-Menu-itemGrid")
76
+ }, /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$ClearSlots), null, /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$SlotProvider), {
77
+ slots: {
78
+ text: {
79
+ UNSAFE_className: (0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs)))["spectrum-Menu-itemLabel"],
80
+ ...labelProps
81
+ },
82
+ icon: {
83
+ size: "S",
84
+ UNSAFE_className: (0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs)))["spectrum-Menu-icon"]
85
+ },
86
+ avatar: {
87
+ size: "avatar-size-100",
88
+ UNSAFE_className: (0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs)))["spectrum-Menu-avatar"]
89
+ },
90
+ description: {
91
+ UNSAFE_className: (0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs)))["spectrum-Menu-description"],
92
+ ...descriptionProps
93
+ }
94
+ }
95
+ }, contents, isSelected && /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$spectrumiconsuiCheckmarkMedium), {
96
+ slot: "checkmark",
97
+ UNSAFE_className: (0, $6TrMC$classNames)((0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs))), "spectrum-Menu-checkmark")
98
+ }))))));
99
+ }
100
+
101
+
102
+ export {$86983ea1fa3f7312$export$feb3b6b552c14a12 as ListBoxOption};
103
+ //# sourceMappingURL=ListBoxOption.mjs.map
@@ -0,0 +1,103 @@
1
+ import {ListBoxContext as $0c6f792811e33483$export$7ff8f37d2d81a48d} from "./ListBoxContext.module.js";
2
+ import "./vars.5bf8960a.css";
3
+ import $6TrMC$menu_vars_cssmodulejs from "./menu_vars_css.module.js";
4
+ import $6TrMC$spectrumiconsuiCheckmarkMedium from "@spectrum-icons/ui/CheckmarkMedium";
5
+ import {classNames as $6TrMC$classNames, ClearSlots as $6TrMC$ClearSlots, SlotProvider as $6TrMC$SlotProvider} from "@react-spectrum/utils";
6
+ import {FocusRing as $6TrMC$FocusRing} from "@react-aria/focus";
7
+ import {Grid as $6TrMC$Grid} from "@react-spectrum/layout";
8
+ import {useHover as $6TrMC$useHover, isFocusVisible as $6TrMC$isFocusVisible} from "@react-aria/interactions";
9
+ import {mergeProps as $6TrMC$mergeProps} from "@react-aria/utils";
10
+ import $6TrMC$react, {useContext as $6TrMC$useContext, useRef as $6TrMC$useRef} from "react";
11
+ import {Text as $6TrMC$Text} from "@react-spectrum/text";
12
+ import {useOption as $6TrMC$useOption} from "@react-aria/listbox";
13
+
14
+
15
+ function $parcel$interopDefault(a) {
16
+ return a && a.__esModule ? a.default : a;
17
+ }
18
+ /*
19
+ * Copyright 2020 Adobe. All rights reserved.
20
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
21
+ * you may not use this file except in compliance with the License. You may obtain a copy
22
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
23
+ *
24
+ * Unless required by applicable law or agreed to in writing, software distributed under
25
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
26
+ * OF ANY KIND, either express or implied. See the License for the specific language
27
+ * governing permissions and limitations under the License.
28
+ */
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+ function $86983ea1fa3f7312$export$feb3b6b552c14a12(props) {
40
+ let { item: item, shouldSelectOnPressUp: shouldSelectOnPressUp, shouldFocusOnHover: shouldFocusOnHover, shouldUseVirtualFocus: shouldUseVirtualFocus } = props;
41
+ let { rendered: rendered, key: key } = item;
42
+ let ElementType = item.props.href ? "a" : "div";
43
+ let state = (0, $6TrMC$useContext)((0, $0c6f792811e33483$export$7ff8f37d2d81a48d));
44
+ let ref = (0, $6TrMC$useRef)();
45
+ let { optionProps: optionProps, labelProps: labelProps, descriptionProps: descriptionProps, isSelected: isSelected, isDisabled: isDisabled, isFocused: isFocused } = (0, $6TrMC$useOption)({
46
+ "aria-label": item["aria-label"],
47
+ key: key,
48
+ shouldSelectOnPressUp: shouldSelectOnPressUp,
49
+ shouldFocusOnHover: shouldFocusOnHover,
50
+ isVirtualized: true,
51
+ shouldUseVirtualFocus: shouldUseVirtualFocus
52
+ }, state, ref);
53
+ let { hoverProps: hoverProps, isHovered: isHovered } = (0, $6TrMC$useHover)({
54
+ ...props,
55
+ isDisabled: isDisabled
56
+ });
57
+ let contents = typeof rendered === "string" ? /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$Text), null, rendered) : rendered;
58
+ let isKeyboardModality = (0, $6TrMC$isFocusVisible)();
59
+ return /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$FocusRing), {
60
+ focusRingClass: (0, $6TrMC$classNames)((0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs))), "focus-ring")
61
+ }, /*#__PURE__*/ (0, $6TrMC$react).createElement(ElementType, {
62
+ ...(0, $6TrMC$mergeProps)(optionProps, shouldFocusOnHover ? {} : hoverProps),
63
+ ref: ref,
64
+ className: (0, $6TrMC$classNames)((0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs))), "spectrum-Menu-item", {
65
+ // If using virtual focus, apply focused styles to the item when the user is interacting with keyboard modality
66
+ "is-focused": shouldUseVirtualFocus && isFocused && isKeyboardModality,
67
+ "is-disabled": isDisabled,
68
+ "is-selected": isSelected,
69
+ "is-selectable": state.selectionManager.selectionMode !== "none",
70
+ // When shouldFocusOnHover is false, apply hover styles both when hovered with the mouse.
71
+ // Otherwise, apply hover styles when focused using non-keyboard modality.
72
+ "is-hovered": isHovered && !shouldFocusOnHover || isFocused && !isKeyboardModality
73
+ })
74
+ }, /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$Grid), {
75
+ UNSAFE_className: (0, $6TrMC$classNames)((0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs))), "spectrum-Menu-itemGrid")
76
+ }, /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$ClearSlots), null, /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$SlotProvider), {
77
+ slots: {
78
+ text: {
79
+ UNSAFE_className: (0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs)))["spectrum-Menu-itemLabel"],
80
+ ...labelProps
81
+ },
82
+ icon: {
83
+ size: "S",
84
+ UNSAFE_className: (0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs)))["spectrum-Menu-icon"]
85
+ },
86
+ avatar: {
87
+ size: "avatar-size-100",
88
+ UNSAFE_className: (0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs)))["spectrum-Menu-avatar"]
89
+ },
90
+ description: {
91
+ UNSAFE_className: (0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs)))["spectrum-Menu-description"],
92
+ ...descriptionProps
93
+ }
94
+ }
95
+ }, contents, isSelected && /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$spectrumiconsuiCheckmarkMedium), {
96
+ slot: "checkmark",
97
+ UNSAFE_className: (0, $6TrMC$classNames)((0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs))), "spectrum-Menu-checkmark")
98
+ }))))));
99
+ }
100
+
101
+
102
+ export {$86983ea1fa3f7312$export$feb3b6b552c14a12 as ListBoxOption};
103
+ //# sourceMappingURL=ListBoxOption.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;AAuBM,SAAS,0CAAiB,KAAqB;IACpD,IAAI,QACF,IAAI,yBACJ,qBAAqB,sBACrB,kBAAkB,yBAClB,qBAAqB,EACtB,GAAG;IAEJ,IAAI,YACF,QAAQ,OACR,GAAG,EACJ,GAAG;IACJ,IAAI,cAAiC,KAAK,KAAK,CAAC,IAAI,GAAG,MAAM;IAC7D,IAAI,QAAQ,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAa;IAEpC,IAAI,MAAM,CAAA,GAAA,aAAK;IACf,IAAI,eAAC,WAAW,cAAE,UAAU,oBAAE,gBAAgB,cAAE,UAAU,cAAE,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ,EAC3F;QACE,cAAc,IAAI,CAAC,aAAa;aAChC;+BACA;4BACA;QACA,eAAe;+BACf;IACF,GACA,OACA;IAEF,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QACrC,GAAG,KAAK;oBACR;IACF;IAEA,IAAI,WAAW,OAAO,aAAa,yBAC/B,gCAAC,CAAA,GAAA,WAAG,SAAG,YACP;IAEJ,IAAI,qBAAqB,CAAA,GAAA,qBAAa;IAEtC,qBACE,gCAAC,CAAA,GAAA,gBAAQ;QAAE,gBAAgB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;qBAC5C,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,aAAa,qBAAqB,CAAC,IAAI,WAAW;QACjE,KAAK;QACL,WAAW,CAAA,GAAA,iBAAS,EAClB,CAAA,GAAA,sDAAK,GACL,sBACA;YACE,+GAA+G;YAC/G,cAAc,yBAAyB,aAAa;YACpD,eAAe;YACf,eAAe;YACf,iBAAiB,MAAM,gBAAgB,CAAC,aAAa,KAAK;YAC1D,yFAAyF;YACzF,0EAA0E;YAC1E,cAAc,AAAC,aAAa,CAAC,sBAAwB,aAAa,CAAC;QACrE;qBAEF,gCAAC,CAAA,GAAA,WAAG;QACF,kBACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,sDAAK,GACL;qBAGJ,gCAAC,CAAA,GAAA,iBAAS,uBACR,gCAAC,CAAA,GAAA,mBAAW;QACV,OAAO;YACL,MAAM;gBAAC,kBAAkB,CAAA,GAAA,sDAAK,CAAC,CAAC,0BAA0B;gBAAE,GAAG,UAAU;YAAA;YACzE,MAAM;gBAAC,MAAM;gBAAK,kBAAkB,CAAA,GAAA,sDAAK,CAAC,CAAC,qBAAqB;YAAA;YAChE,QAAQ;gBAAC,MAAM;gBAAmB,kBAAkB,CAAA,GAAA,sDAAK,CAAC,CAAC,uBAAuB;YAAA;YAClF,aAAa;gBAAC,kBAAkB,CAAA,GAAA,sDAAK,CAAC,CAAC,4BAA4B;gBAAE,GAAG,gBAAgB;YAAA;QAC1F;OACC,UACA,4BACC,gCAAC,CAAA,GAAA,qCAAc;QACb,MAAK;QACL,kBACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,sDAAK,GACL;;AAUtB","sources":["packages/@react-spectrum/listbox/src/ListBoxOption.tsx"],"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 CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';\nimport {classNames, ClearSlots, SlotProvider} from '@react-spectrum/utils';\nimport {FocusRing} from '@react-aria/focus';\nimport {Grid} from '@react-spectrum/layout';\nimport {isFocusVisible, useHover} from '@react-aria/interactions';\nimport {ListBoxContext} from './ListBoxContext';\nimport {mergeProps} from '@react-aria/utils';\nimport {Node} from '@react-types/shared';\nimport React, {useContext, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {Text} from '@react-spectrum/text';\nimport {useOption} from '@react-aria/listbox';\n\ninterface OptionProps<T> {\n item: Node<T>,\n shouldSelectOnPressUp?: boolean,\n shouldFocusOnHover?: boolean,\n shouldUseVirtualFocus?: boolean\n}\n\n/** @private */\nexport function ListBoxOption<T>(props: OptionProps<T>) {\n let {\n item,\n shouldSelectOnPressUp,\n shouldFocusOnHover,\n shouldUseVirtualFocus\n } = props;\n\n let {\n rendered,\n key\n } = item;\n let ElementType: React.ElementType = item.props.href ? 'a' : 'div';\n let state = useContext(ListBoxContext);\n\n let ref = useRef<any>();\n let {optionProps, labelProps, descriptionProps, isSelected, isDisabled, isFocused} = useOption(\n {\n 'aria-label': item['aria-label'],\n key,\n shouldSelectOnPressUp,\n shouldFocusOnHover,\n isVirtualized: true,\n shouldUseVirtualFocus\n },\n state,\n ref\n );\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled\n });\n\n let contents = typeof rendered === 'string'\n ? <Text>{rendered}</Text>\n : rendered;\n\n let isKeyboardModality = isFocusVisible();\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n <ElementType\n {...mergeProps(optionProps, shouldFocusOnHover ? {} : hoverProps)}\n ref={ref}\n className={classNames(\n styles,\n 'spectrum-Menu-item',\n {\n // If using virtual focus, apply focused styles to the item when the user is interacting with keyboard modality\n 'is-focused': shouldUseVirtualFocus && isFocused && isKeyboardModality,\n 'is-disabled': isDisabled,\n 'is-selected': isSelected,\n 'is-selectable': state.selectionManager.selectionMode !== 'none',\n // When shouldFocusOnHover is false, apply hover styles both when hovered with the mouse.\n // Otherwise, apply hover styles when focused using non-keyboard modality.\n 'is-hovered': (isHovered && !shouldFocusOnHover) || (isFocused && !isKeyboardModality)\n }\n )}>\n <Grid\n UNSAFE_className={\n classNames(\n styles,\n 'spectrum-Menu-itemGrid'\n )\n }>\n <ClearSlots>\n <SlotProvider\n slots={{\n text: {UNSAFE_className: styles['spectrum-Menu-itemLabel'], ...labelProps},\n icon: {size: 'S', UNSAFE_className: styles['spectrum-Menu-icon']},\n avatar: {size: 'avatar-size-100', UNSAFE_className: styles['spectrum-Menu-avatar']},\n description: {UNSAFE_className: styles['spectrum-Menu-description'], ...descriptionProps}\n }}>\n {contents}\n {isSelected &&\n <CheckmarkMedium\n slot=\"checkmark\"\n UNSAFE_className={\n classNames(\n styles,\n 'spectrum-Menu-checkmark'\n )\n } />\n }\n </SlotProvider>\n </ClearSlots>\n </Grid>\n </ElementType>\n </FocusRing>\n );\n}\n"],"names":[],"version":3,"file":"ListBoxOption.module.js.map"}