@react-spectrum/listbox 3.15.11 → 3.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/import.mjs +6 -4
- package/dist/main.js +10 -8
- package/dist/main.js.map +1 -1
- package/dist/module.js +6 -4
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +5 -0
- package/package.json +14 -42
- package/src/index.ts +6 -4
- package/dist/ListBox.main.js +0 -43
- package/dist/ListBox.main.js.map +0 -1
- package/dist/ListBox.mjs +0 -34
- package/dist/ListBox.module.js +0 -34
- package/dist/ListBox.module.js.map +0 -1
- package/dist/ListBoxBase.main.js +0 -165
- package/dist/ListBoxBase.main.js.map +0 -1
- package/dist/ListBoxBase.mjs +0 -159
- package/dist/ListBoxBase.module.js +0 -159
- package/dist/ListBoxBase.module.js.map +0 -1
- package/dist/ListBoxContext.main.js +0 -27
- package/dist/ListBoxContext.main.js.map +0 -1
- package/dist/ListBoxContext.mjs +0 -18
- package/dist/ListBoxContext.module.js +0 -18
- package/dist/ListBoxContext.module.js.map +0 -1
- package/dist/ListBoxLayout.main.js +0 -79
- package/dist/ListBoxLayout.main.js.map +0 -1
- package/dist/ListBoxLayout.mjs +0 -74
- package/dist/ListBoxLayout.module.js +0 -74
- package/dist/ListBoxLayout.module.js.map +0 -1
- package/dist/ListBoxOption.main.js +0 -105
- package/dist/ListBoxOption.main.js.map +0 -1
- package/dist/ListBoxOption.mjs +0 -100
- package/dist/ListBoxOption.module.js +0 -100
- package/dist/ListBoxOption.module.js.map +0 -1
- package/dist/ListBoxSection.main.js +0 -69
- package/dist/ListBoxSection.main.js.map +0 -1
- package/dist/ListBoxSection.mjs +0 -64
- package/dist/ListBoxSection.module.js +0 -64
- package/dist/ListBoxSection.module.js.map +0 -1
- package/dist/ar-AE.main.js +0 -7
- package/dist/ar-AE.main.js.map +0 -1
- package/dist/ar-AE.mjs +0 -9
- package/dist/ar-AE.module.js +0 -9
- package/dist/ar-AE.module.js.map +0 -1
- package/dist/bg-BG.main.js +0 -7
- package/dist/bg-BG.main.js.map +0 -1
- package/dist/bg-BG.mjs +0 -9
- package/dist/bg-BG.module.js +0 -9
- package/dist/bg-BG.module.js.map +0 -1
- package/dist/cs-CZ.main.js +0 -7
- package/dist/cs-CZ.main.js.map +0 -1
- package/dist/cs-CZ.mjs +0 -9
- package/dist/cs-CZ.module.js +0 -9
- package/dist/cs-CZ.module.js.map +0 -1
- package/dist/da-DK.main.js +0 -7
- package/dist/da-DK.main.js.map +0 -1
- package/dist/da-DK.mjs +0 -9
- package/dist/da-DK.module.js +0 -9
- package/dist/da-DK.module.js.map +0 -1
- package/dist/de-DE.main.js +0 -7
- package/dist/de-DE.main.js.map +0 -1
- package/dist/de-DE.mjs +0 -9
- package/dist/de-DE.module.js +0 -9
- package/dist/de-DE.module.js.map +0 -1
- package/dist/el-GR.main.js +0 -7
- package/dist/el-GR.main.js.map +0 -1
- package/dist/el-GR.mjs +0 -9
- package/dist/el-GR.module.js +0 -9
- package/dist/el-GR.module.js.map +0 -1
- package/dist/en-US.main.js +0 -7
- package/dist/en-US.main.js.map +0 -1
- package/dist/en-US.mjs +0 -9
- package/dist/en-US.module.js +0 -9
- package/dist/en-US.module.js.map +0 -1
- package/dist/es-ES.main.js +0 -7
- package/dist/es-ES.main.js.map +0 -1
- package/dist/es-ES.mjs +0 -9
- package/dist/es-ES.module.js +0 -9
- package/dist/es-ES.module.js.map +0 -1
- package/dist/et-EE.main.js +0 -7
- package/dist/et-EE.main.js.map +0 -1
- package/dist/et-EE.mjs +0 -9
- package/dist/et-EE.module.js +0 -9
- package/dist/et-EE.module.js.map +0 -1
- package/dist/fi-FI.main.js +0 -7
- package/dist/fi-FI.main.js.map +0 -1
- package/dist/fi-FI.mjs +0 -9
- package/dist/fi-FI.module.js +0 -9
- package/dist/fi-FI.module.js.map +0 -1
- package/dist/fr-FR.main.js +0 -7
- package/dist/fr-FR.main.js.map +0 -1
- package/dist/fr-FR.mjs +0 -9
- package/dist/fr-FR.module.js +0 -9
- package/dist/fr-FR.module.js.map +0 -1
- package/dist/he-IL.main.js +0 -7
- package/dist/he-IL.main.js.map +0 -1
- package/dist/he-IL.mjs +0 -9
- package/dist/he-IL.module.js +0 -9
- package/dist/he-IL.module.js.map +0 -1
- package/dist/hr-HR.main.js +0 -7
- package/dist/hr-HR.main.js.map +0 -1
- package/dist/hr-HR.mjs +0 -9
- package/dist/hr-HR.module.js +0 -9
- package/dist/hr-HR.module.js.map +0 -1
- package/dist/hu-HU.main.js +0 -7
- package/dist/hu-HU.main.js.map +0 -1
- package/dist/hu-HU.mjs +0 -9
- package/dist/hu-HU.module.js +0 -9
- package/dist/hu-HU.module.js.map +0 -1
- package/dist/intlStrings.main.js +0 -108
- package/dist/intlStrings.main.js.map +0 -1
- package/dist/intlStrings.mjs +0 -110
- package/dist/intlStrings.module.js +0 -110
- package/dist/intlStrings.module.js.map +0 -1
- package/dist/it-IT.main.js +0 -7
- package/dist/it-IT.main.js.map +0 -1
- package/dist/it-IT.mjs +0 -9
- package/dist/it-IT.module.js +0 -9
- package/dist/it-IT.module.js.map +0 -1
- package/dist/ja-JP.main.js +0 -7
- package/dist/ja-JP.main.js.map +0 -1
- package/dist/ja-JP.mjs +0 -9
- package/dist/ja-JP.module.js +0 -9
- package/dist/ja-JP.module.js.map +0 -1
- package/dist/ko-KR.main.js +0 -7
- package/dist/ko-KR.main.js.map +0 -1
- package/dist/ko-KR.mjs +0 -9
- package/dist/ko-KR.module.js +0 -9
- package/dist/ko-KR.module.js.map +0 -1
- package/dist/listbox.a566c7a6.css +0 -570
- package/dist/listbox.a566c7a6.css.map +0 -1
- package/dist/lt-LT.main.js +0 -7
- package/dist/lt-LT.main.js.map +0 -1
- package/dist/lt-LT.mjs +0 -9
- package/dist/lt-LT.module.js +0 -9
- package/dist/lt-LT.module.js.map +0 -1
- package/dist/lv-LV.main.js +0 -7
- package/dist/lv-LV.main.js.map +0 -1
- package/dist/lv-LV.mjs +0 -9
- package/dist/lv-LV.module.js +0 -9
- package/dist/lv-LV.module.js.map +0 -1
- package/dist/menu_vars_css.main.js +0 -177
- package/dist/menu_vars_css.main.js.map +0 -1
- package/dist/menu_vars_css.mjs +0 -179
- package/dist/menu_vars_css.module.js +0 -179
- package/dist/menu_vars_css.module.js.map +0 -1
- package/dist/nb-NO.main.js +0 -7
- package/dist/nb-NO.main.js.map +0 -1
- package/dist/nb-NO.mjs +0 -9
- package/dist/nb-NO.module.js +0 -9
- package/dist/nb-NO.module.js.map +0 -1
- package/dist/nl-NL.main.js +0 -7
- package/dist/nl-NL.main.js.map +0 -1
- package/dist/nl-NL.mjs +0 -9
- package/dist/nl-NL.module.js +0 -9
- package/dist/nl-NL.module.js.map +0 -1
- package/dist/pl-PL.main.js +0 -7
- package/dist/pl-PL.main.js.map +0 -1
- package/dist/pl-PL.mjs +0 -9
- package/dist/pl-PL.module.js +0 -9
- package/dist/pl-PL.module.js.map +0 -1
- package/dist/pt-BR.main.js +0 -7
- package/dist/pt-BR.main.js.map +0 -1
- package/dist/pt-BR.mjs +0 -9
- package/dist/pt-BR.module.js +0 -9
- package/dist/pt-BR.module.js.map +0 -1
- package/dist/pt-PT.main.js +0 -7
- package/dist/pt-PT.main.js.map +0 -1
- package/dist/pt-PT.mjs +0 -9
- package/dist/pt-PT.module.js +0 -9
- package/dist/pt-PT.module.js.map +0 -1
- package/dist/ro-RO.main.js +0 -7
- package/dist/ro-RO.main.js.map +0 -1
- package/dist/ro-RO.mjs +0 -9
- package/dist/ro-RO.module.js +0 -9
- package/dist/ro-RO.module.js.map +0 -1
- package/dist/ru-RU.main.js +0 -7
- package/dist/ru-RU.main.js.map +0 -1
- package/dist/ru-RU.mjs +0 -9
- package/dist/ru-RU.module.js +0 -9
- package/dist/ru-RU.module.js.map +0 -1
- package/dist/sk-SK.main.js +0 -7
- package/dist/sk-SK.main.js.map +0 -1
- package/dist/sk-SK.mjs +0 -9
- package/dist/sk-SK.module.js +0 -9
- package/dist/sk-SK.module.js.map +0 -1
- package/dist/sl-SI.main.js +0 -7
- package/dist/sl-SI.main.js.map +0 -1
- package/dist/sl-SI.mjs +0 -9
- package/dist/sl-SI.module.js +0 -9
- package/dist/sl-SI.module.js.map +0 -1
- package/dist/sr-SP.main.js +0 -7
- package/dist/sr-SP.main.js.map +0 -1
- package/dist/sr-SP.mjs +0 -9
- package/dist/sr-SP.module.js +0 -9
- package/dist/sr-SP.module.js.map +0 -1
- package/dist/sv-SE.main.js +0 -7
- package/dist/sv-SE.main.js.map +0 -1
- package/dist/sv-SE.mjs +0 -9
- package/dist/sv-SE.module.js +0 -9
- package/dist/sv-SE.module.js.map +0 -1
- package/dist/tr-TR.main.js +0 -7
- package/dist/tr-TR.main.js.map +0 -1
- package/dist/tr-TR.mjs +0 -9
- package/dist/tr-TR.module.js +0 -9
- package/dist/tr-TR.module.js.map +0 -1
- package/dist/types.d.ts +0 -52
- package/dist/types.d.ts.map +0 -1
- package/dist/uk-UA.main.js +0 -7
- package/dist/uk-UA.main.js.map +0 -1
- package/dist/uk-UA.mjs +0 -9
- package/dist/uk-UA.module.js +0 -9
- package/dist/uk-UA.module.js.map +0 -1
- package/dist/zh-CN.main.js +0 -7
- package/dist/zh-CN.main.js.map +0 -1
- package/dist/zh-CN.mjs +0 -9
- package/dist/zh-CN.module.js +0 -9
- package/dist/zh-CN.module.js.map +0 -1
- package/dist/zh-TW.main.js +0 -7
- package/dist/zh-TW.main.js.map +0 -1
- package/dist/zh-TW.mjs +0 -9
- package/dist/zh-TW.module.js +0 -9
- package/dist/zh-TW.module.js.map +0 -1
- package/src/ListBox.tsx +0 -39
- package/src/ListBoxBase.tsx +0 -183
- package/src/ListBoxContext.ts +0 -23
- package/src/ListBoxLayout.ts +0 -88
- package/src/ListBoxOption.tsx +0 -113
- package/src/ListBoxSection.tsx +0 -85
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import {Rect as $3YKfq$Rect, LayoutInfo as $3YKfq$LayoutInfo} from "@react-stately/virtualizer";
|
|
2
|
-
import {ListLayout as $3YKfq$ListLayout} from "@react-stately/layout";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class $d20755daac213984$export$c7e5f5ea00052bf extends (0, $3YKfq$ListLayout) {
|
|
7
|
-
update(invalidationContext) {
|
|
8
|
-
var _invalidationContext_layoutOptions;
|
|
9
|
-
this.isLoading = ((_invalidationContext_layoutOptions = invalidationContext.layoutOptions) === null || _invalidationContext_layoutOptions === void 0 ? void 0 : _invalidationContext_layoutOptions.isLoading) || false;
|
|
10
|
-
super.update(invalidationContext);
|
|
11
|
-
}
|
|
12
|
-
buildCollection() {
|
|
13
|
-
let nodes = super.buildCollection(this.paddingY);
|
|
14
|
-
let y = this.contentSize.height;
|
|
15
|
-
if (this.isLoading) {
|
|
16
|
-
let rect = new (0, $3YKfq$Rect)(0, y, this.virtualizer.visibleRect.width, 40);
|
|
17
|
-
let loader = new (0, $3YKfq$LayoutInfo)('loader', 'loader', rect);
|
|
18
|
-
let node = {
|
|
19
|
-
layoutInfo: loader,
|
|
20
|
-
validRect: loader.rect
|
|
21
|
-
};
|
|
22
|
-
nodes.push(node);
|
|
23
|
-
this.layoutNodes.set(loader.key, node);
|
|
24
|
-
y = loader.rect.maxY;
|
|
25
|
-
}
|
|
26
|
-
if (nodes.length === 0) {
|
|
27
|
-
var _this_placeholderHeight;
|
|
28
|
-
let rect = new (0, $3YKfq$Rect)(0, y, this.virtualizer.visibleRect.width, (_this_placeholderHeight = this.placeholderHeight) !== null && _this_placeholderHeight !== void 0 ? _this_placeholderHeight : this.virtualizer.visibleRect.height);
|
|
29
|
-
let placeholder = new (0, $3YKfq$LayoutInfo)('placeholder', 'placeholder', rect);
|
|
30
|
-
let node = {
|
|
31
|
-
layoutInfo: placeholder,
|
|
32
|
-
validRect: placeholder.rect
|
|
33
|
-
};
|
|
34
|
-
nodes.push(node);
|
|
35
|
-
this.layoutNodes.set(placeholder.key, node);
|
|
36
|
-
y = placeholder.rect.maxY;
|
|
37
|
-
}
|
|
38
|
-
this.contentSize.height = y + this.paddingY;
|
|
39
|
-
return nodes;
|
|
40
|
-
}
|
|
41
|
-
buildSection(node, x, y) {
|
|
42
|
-
// Synthesize a collection node for the header.
|
|
43
|
-
let headerNode = {
|
|
44
|
-
type: 'header',
|
|
45
|
-
key: node.key + ':header',
|
|
46
|
-
parentKey: node.key,
|
|
47
|
-
value: null,
|
|
48
|
-
level: node.level,
|
|
49
|
-
index: node.index,
|
|
50
|
-
hasChildNodes: false,
|
|
51
|
-
childNodes: [],
|
|
52
|
-
rendered: node.rendered,
|
|
53
|
-
textValue: node.textValue
|
|
54
|
-
};
|
|
55
|
-
// Build layout node for it and adjust y offset of section children.
|
|
56
|
-
let header = this.buildSectionHeader(headerNode, x, y);
|
|
57
|
-
header.node = headerNode;
|
|
58
|
-
header.layoutInfo.parentKey = node.key;
|
|
59
|
-
this.layoutNodes.set(headerNode.key, header);
|
|
60
|
-
y += header.layoutInfo.rect.height;
|
|
61
|
-
let section = super.buildSection(node, x, y);
|
|
62
|
-
section.children.unshift(header);
|
|
63
|
-
return section;
|
|
64
|
-
}
|
|
65
|
-
constructor(opts){
|
|
66
|
-
super(opts), this.isLoading = false;
|
|
67
|
-
this.placeholderHeight = opts.placeholderHeight;
|
|
68
|
-
this.paddingY = opts.paddingY;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
export {$d20755daac213984$export$c7e5f5ea00052bf as ListBoxLayout};
|
|
74
|
-
//# sourceMappingURL=ListBoxLayout.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;AAaO,MAAM,iDAAyB,CAAA,GAAA,iBAAS;IAW7C,OAAO,mBAA4D,EAAQ;YACxD;QAAjB,IAAI,CAAC,SAAS,GAAG,EAAA,qCAAA,oBAAoB,aAAa,cAAjC,yDAAA,mCAAmC,SAAS,KAAI;QACjE,KAAK,CAAC,OAAO;IACf;IAEU,kBAAgC;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AG;YACnB,OAAO;YACP,OAAO,KAAK,KAAK;YACjB,OAAO,KAAK,KAAK;YACjB,eAAe;YACf,YAAY,EAAE;YACd,UAAU,KAAK,QAAQ;YACvB,WAAW,KAAK,SAAS;QAC3B;QAEA,oEAAoE;QACpE,IAAI,SAAS,IAAI,CAAC,kBAAkB,CAAC,YAAY,GAAG;QACpD,OAAO,IAAI,GAAG;QACd,OAAO,UAAU,CAAC,SAAS,GAAG,KAAK,GAAG;QACtC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,GAAG,EAAE;QACrC,KAAK,OAAO,UAAU,CAAC,IAAI,CAAC,MAAM;QAElC,IAAI,UAAU,KAAK,CAAC,aAAa,MAAM,GAAG;QAC1C,QAAQ,QAAQ,CAAE,OAAO,CAAC;QAC1B,OAAO;IACT;IApEA,YAAY,IAA0B,CAAE;QACtC,KAAK,CAAC,YALA,YAAqB;QAM3B,IAAI,CAAC,iBAAiB,GAAG,KAAK,iBAAiB;QAC/C,IAAI,CAAC,QAAQ,GAAG,KAAK,QAAQ;IAC/B;AAiEF","sources":["packages/@react-spectrum/listbox/src/ListBoxLayout.ts"],"sourcesContent":["import {InvalidationContext, LayoutInfo, Rect} from '@react-stately/virtualizer';\nimport {LayoutNode, ListLayout, ListLayoutOptions} from '@react-stately/layout';\nimport {Node} from '@react-types/shared';\n\ninterface ListBoxLayoutProps extends ListLayoutOptions {\n isLoading?: boolean\n}\n\ninterface ListBoxLayoutOptions extends ListLayoutOptions {\n placeholderHeight: number,\n paddingY: number\n}\n\nexport class ListBoxLayout<T> extends ListLayout<T, ListBoxLayoutProps> {\n private isLoading: boolean = false;\n private placeholderHeight: number;\n private paddingY: number;\n\n constructor(opts: ListBoxLayoutOptions) {\n super(opts);\n this.placeholderHeight = opts.placeholderHeight;\n this.paddingY = opts.paddingY;\n }\n\n update(invalidationContext: InvalidationContext<ListBoxLayoutProps>): void {\n this.isLoading = invalidationContext.layoutOptions?.isLoading || false;\n super.update(invalidationContext);\n }\n\n protected buildCollection(): LayoutNode[] {\n let nodes = super.buildCollection(this.paddingY);\n let y = this.contentSize.height;\n\n if (this.isLoading) {\n let rect = new Rect(0, y, this.virtualizer!.visibleRect.width, 40);\n let loader = new LayoutInfo('loader', 'loader', rect);\n let node = {\n layoutInfo: loader,\n validRect: loader.rect\n };\n nodes.push(node);\n this.layoutNodes.set(loader.key, node);\n y = loader.rect.maxY;\n }\n\n if (nodes.length === 0) {\n let rect = new Rect(0, y, this.virtualizer!.visibleRect.width, this.placeholderHeight ?? this.virtualizer!.visibleRect.height);\n let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);\n let node = {\n layoutInfo: placeholder,\n validRect: placeholder.rect\n };\n nodes.push(node);\n this.layoutNodes.set(placeholder.key, node);\n y = placeholder.rect.maxY;\n }\n\n this.contentSize.height = y + this.paddingY;\n return nodes;\n }\n\n protected buildSection(node: Node<T>, x: number, y: number): LayoutNode {\n // Synthesize a collection node for the header.\n let headerNode = {\n type: 'header',\n key: node.key + ':header',\n parentKey: node.key,\n value: null,\n level: node.level,\n index: node.index,\n hasChildNodes: false,\n childNodes: [],\n rendered: node.rendered,\n textValue: node.textValue\n };\n\n // Build layout node for it and adjust y offset of section children.\n let header = this.buildSectionHeader(headerNode, x, y);\n header.node = headerNode;\n header.layoutInfo.parentKey = node.key;\n this.layoutNodes.set(headerNode.key, header);\n y += header.layoutInfo.rect.height;\n\n let section = super.buildSection(node, x, y);\n section.children!.unshift(header);\n return section;\n }\n}\n"],"names":[],"version":3,"file":"ListBoxLayout.module.js.map"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
var $611e93c7b7c0413c$exports = require("./ListBoxContext.main.js");
|
|
2
|
-
require("./listbox.a566c7a6.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 } = props;
|
|
47
|
-
let { rendered: rendered, key: key } = item;
|
|
48
|
-
let ElementType = item.props.href ? 'a' : 'div';
|
|
49
|
-
let { state: state, shouldFocusOnHover: shouldFocusOnHover, shouldUseVirtualFocus: shouldUseVirtualFocus } = (0, $8xmxv$react.useContext)((0, $611e93c7b7c0413c$exports.ListBoxContext));
|
|
50
|
-
let ref = (0, $8xmxv$react.useRef)(undefined);
|
|
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
|
-
isVirtualized: true
|
|
55
|
-
}, state, ref);
|
|
56
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $8xmxv$reactariainteractions.useHover)({
|
|
57
|
-
...props,
|
|
58
|
-
isDisabled: isDisabled
|
|
59
|
-
});
|
|
60
|
-
let contents = typeof rendered === 'string' ? /*#__PURE__*/ (0, ($parcel$interopDefault($8xmxv$react))).createElement((0, $8xmxv$reactspectrumtext.Text), null, rendered) : rendered;
|
|
61
|
-
let isKeyboardModality = (0, $8xmxv$reactariainteractions.isFocusVisible)();
|
|
62
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($8xmxv$react))).createElement((0, $8xmxv$reactariafocus.FocusRing), {
|
|
63
|
-
focusRingClass: (0, $8xmxv$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), 'focus-ring')
|
|
64
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($8xmxv$react))).createElement(ElementType, {
|
|
65
|
-
...(0, $8xmxv$reactariautils.mergeProps)(optionProps, shouldFocusOnHover ? {} : hoverProps),
|
|
66
|
-
ref: ref,
|
|
67
|
-
className: (0, $8xmxv$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), 'spectrum-Menu-item', {
|
|
68
|
-
// If using virtual focus, apply focused styles to the item when the user is interacting with keyboard modality
|
|
69
|
-
'is-focused': shouldUseVirtualFocus && isFocused && isKeyboardModality,
|
|
70
|
-
'is-disabled': isDisabled,
|
|
71
|
-
'is-selected': isSelected,
|
|
72
|
-
'is-selectable': state.selectionManager.selectionMode !== 'none',
|
|
73
|
-
// When shouldFocusOnHover is false, apply hover styles both when hovered with the mouse.
|
|
74
|
-
// Otherwise, apply hover styles when focused using non-keyboard modality.
|
|
75
|
-
'is-hovered': isHovered && !shouldFocusOnHover || isFocused && !isKeyboardModality
|
|
76
|
-
})
|
|
77
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($8xmxv$react))).createElement((0, $8xmxv$reactspectrumlayout.Grid), {
|
|
78
|
-
UNSAFE_className: (0, $8xmxv$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), 'spectrum-Menu-itemGrid')
|
|
79
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($8xmxv$react))).createElement((0, $8xmxv$reactspectrumutils.ClearSlots), null, /*#__PURE__*/ (0, ($parcel$interopDefault($8xmxv$react))).createElement((0, $8xmxv$reactspectrumutils.SlotProvider), {
|
|
80
|
-
slots: {
|
|
81
|
-
text: {
|
|
82
|
-
UNSAFE_className: (0, ($parcel$interopDefault($3deee0fd2b46e64f$exports)))['spectrum-Menu-itemLabel'],
|
|
83
|
-
...labelProps
|
|
84
|
-
},
|
|
85
|
-
icon: {
|
|
86
|
-
size: 'S',
|
|
87
|
-
UNSAFE_className: (0, ($parcel$interopDefault($3deee0fd2b46e64f$exports)))['spectrum-Menu-icon']
|
|
88
|
-
},
|
|
89
|
-
avatar: {
|
|
90
|
-
size: 'avatar-size-100',
|
|
91
|
-
UNSAFE_className: (0, ($parcel$interopDefault($3deee0fd2b46e64f$exports)))['spectrum-Menu-avatar']
|
|
92
|
-
},
|
|
93
|
-
description: {
|
|
94
|
-
UNSAFE_className: (0, ($parcel$interopDefault($3deee0fd2b46e64f$exports)))['spectrum-Menu-description'],
|
|
95
|
-
...descriptionProps
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}, contents, isSelected && /*#__PURE__*/ (0, ($parcel$interopDefault($8xmxv$react))).createElement((0, ($parcel$interopDefault($8xmxv$spectrumiconsuiCheckmarkMedium))), {
|
|
99
|
-
slot: "checkmark",
|
|
100
|
-
UNSAFE_className: (0, $8xmxv$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), 'spectrum-Menu-checkmark')
|
|
101
|
-
}))))));
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
//# sourceMappingURL=ListBoxOption.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;AAoBM,SAAS,0CAAiB,KAAqB;IACpD,IAAI,QAAC,IAAI,EAAC,GAAG;IAEb,IAAI,YACF,QAAQ,OACR,GAAG,EACJ,GAAG;IACJ,IAAI,cAAiC,KAAK,KAAK,CAAC,IAAI,GAAG,MAAM;IAC7D,IAAI,SAAC,KAAK,sBAAE,kBAAkB,yBAAE,qBAAqB,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,wCAAa;IAEjF,IAAI,MAAM,CAAA,GAAA,mBAAK,EAAO;IACtB,IAAI,eAAC,WAAW,cAAE,UAAU,oBAAE,gBAAgB,cAAE,UAAU,cAAE,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,iCAAQ,EAC3F;QACE,cAAc,IAAI,CAAC,aAAa;aAChC;QACA,eAAe;IACjB,GACA,OACA;IAEF,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;QACrC,GAAG,KAAK;oBACR;IACF;IAEA,IAAI,WAAW,OAAO,aAAa,yBAC/B,0DAAC,CAAA,GAAA,6BAAG,SAAG,YACP;IAEJ,IAAI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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, {JSX, 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}\n\n/** @private */\nexport function ListBoxOption<T>(props: OptionProps<T>): JSX.Element {\n let {item} = props;\n\n let {\n rendered,\n key\n } = item;\n let ElementType: React.ElementType = item.props.href ? 'a' : 'div';\n let {state, shouldFocusOnHover, shouldUseVirtualFocus} = useContext(ListBoxContext)!;\n\n let ref = useRef<any>(undefined);\n let {optionProps, labelProps, descriptionProps, isSelected, isDisabled, isFocused} = useOption(\n {\n 'aria-label': item['aria-label'],\n key,\n isVirtualized: true\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"}
|
package/dist/ListBoxOption.mjs
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import {ListBoxContext as $0c6f792811e33483$export$7ff8f37d2d81a48d} from "./ListBoxContext.mjs";
|
|
2
|
-
import "./listbox.a566c7a6.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 } = props;
|
|
41
|
-
let { rendered: rendered, key: key } = item;
|
|
42
|
-
let ElementType = item.props.href ? 'a' : 'div';
|
|
43
|
-
let { state: state, shouldFocusOnHover: shouldFocusOnHover, shouldUseVirtualFocus: shouldUseVirtualFocus } = (0, $6TrMC$useContext)((0, $0c6f792811e33483$export$7ff8f37d2d81a48d));
|
|
44
|
-
let ref = (0, $6TrMC$useRef)(undefined);
|
|
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
|
-
isVirtualized: true
|
|
49
|
-
}, state, ref);
|
|
50
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $6TrMC$useHover)({
|
|
51
|
-
...props,
|
|
52
|
-
isDisabled: isDisabled
|
|
53
|
-
});
|
|
54
|
-
let contents = typeof rendered === 'string' ? /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$Text), null, rendered) : rendered;
|
|
55
|
-
let isKeyboardModality = (0, $6TrMC$isFocusVisible)();
|
|
56
|
-
return /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$FocusRing), {
|
|
57
|
-
focusRingClass: (0, $6TrMC$classNames)((0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs))), 'focus-ring')
|
|
58
|
-
}, /*#__PURE__*/ (0, $6TrMC$react).createElement(ElementType, {
|
|
59
|
-
...(0, $6TrMC$mergeProps)(optionProps, shouldFocusOnHover ? {} : hoverProps),
|
|
60
|
-
ref: ref,
|
|
61
|
-
className: (0, $6TrMC$classNames)((0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs))), 'spectrum-Menu-item', {
|
|
62
|
-
// If using virtual focus, apply focused styles to the item when the user is interacting with keyboard modality
|
|
63
|
-
'is-focused': shouldUseVirtualFocus && isFocused && isKeyboardModality,
|
|
64
|
-
'is-disabled': isDisabled,
|
|
65
|
-
'is-selected': isSelected,
|
|
66
|
-
'is-selectable': state.selectionManager.selectionMode !== 'none',
|
|
67
|
-
// When shouldFocusOnHover is false, apply hover styles both when hovered with the mouse.
|
|
68
|
-
// Otherwise, apply hover styles when focused using non-keyboard modality.
|
|
69
|
-
'is-hovered': isHovered && !shouldFocusOnHover || isFocused && !isKeyboardModality
|
|
70
|
-
})
|
|
71
|
-
}, /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$Grid), {
|
|
72
|
-
UNSAFE_className: (0, $6TrMC$classNames)((0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs))), 'spectrum-Menu-itemGrid')
|
|
73
|
-
}, /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$ClearSlots), null, /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$SlotProvider), {
|
|
74
|
-
slots: {
|
|
75
|
-
text: {
|
|
76
|
-
UNSAFE_className: (0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs)))['spectrum-Menu-itemLabel'],
|
|
77
|
-
...labelProps
|
|
78
|
-
},
|
|
79
|
-
icon: {
|
|
80
|
-
size: 'S',
|
|
81
|
-
UNSAFE_className: (0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs)))['spectrum-Menu-icon']
|
|
82
|
-
},
|
|
83
|
-
avatar: {
|
|
84
|
-
size: 'avatar-size-100',
|
|
85
|
-
UNSAFE_className: (0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs)))['spectrum-Menu-avatar']
|
|
86
|
-
},
|
|
87
|
-
description: {
|
|
88
|
-
UNSAFE_className: (0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs)))['spectrum-Menu-description'],
|
|
89
|
-
...descriptionProps
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}, contents, isSelected && /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$spectrumiconsuiCheckmarkMedium), {
|
|
93
|
-
slot: "checkmark",
|
|
94
|
-
UNSAFE_className: (0, $6TrMC$classNames)((0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs))), 'spectrum-Menu-checkmark')
|
|
95
|
-
}))))));
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
export {$86983ea1fa3f7312$export$feb3b6b552c14a12 as ListBoxOption};
|
|
100
|
-
//# sourceMappingURL=ListBoxOption.module.js.map
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import {ListBoxContext as $0c6f792811e33483$export$7ff8f37d2d81a48d} from "./ListBoxContext.module.js";
|
|
2
|
-
import "./listbox.a566c7a6.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 } = props;
|
|
41
|
-
let { rendered: rendered, key: key } = item;
|
|
42
|
-
let ElementType = item.props.href ? 'a' : 'div';
|
|
43
|
-
let { state: state, shouldFocusOnHover: shouldFocusOnHover, shouldUseVirtualFocus: shouldUseVirtualFocus } = (0, $6TrMC$useContext)((0, $0c6f792811e33483$export$7ff8f37d2d81a48d));
|
|
44
|
-
let ref = (0, $6TrMC$useRef)(undefined);
|
|
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
|
-
isVirtualized: true
|
|
49
|
-
}, state, ref);
|
|
50
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $6TrMC$useHover)({
|
|
51
|
-
...props,
|
|
52
|
-
isDisabled: isDisabled
|
|
53
|
-
});
|
|
54
|
-
let contents = typeof rendered === 'string' ? /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$Text), null, rendered) : rendered;
|
|
55
|
-
let isKeyboardModality = (0, $6TrMC$isFocusVisible)();
|
|
56
|
-
return /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$FocusRing), {
|
|
57
|
-
focusRingClass: (0, $6TrMC$classNames)((0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs))), 'focus-ring')
|
|
58
|
-
}, /*#__PURE__*/ (0, $6TrMC$react).createElement(ElementType, {
|
|
59
|
-
...(0, $6TrMC$mergeProps)(optionProps, shouldFocusOnHover ? {} : hoverProps),
|
|
60
|
-
ref: ref,
|
|
61
|
-
className: (0, $6TrMC$classNames)((0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs))), 'spectrum-Menu-item', {
|
|
62
|
-
// If using virtual focus, apply focused styles to the item when the user is interacting with keyboard modality
|
|
63
|
-
'is-focused': shouldUseVirtualFocus && isFocused && isKeyboardModality,
|
|
64
|
-
'is-disabled': isDisabled,
|
|
65
|
-
'is-selected': isSelected,
|
|
66
|
-
'is-selectable': state.selectionManager.selectionMode !== 'none',
|
|
67
|
-
// When shouldFocusOnHover is false, apply hover styles both when hovered with the mouse.
|
|
68
|
-
// Otherwise, apply hover styles when focused using non-keyboard modality.
|
|
69
|
-
'is-hovered': isHovered && !shouldFocusOnHover || isFocused && !isKeyboardModality
|
|
70
|
-
})
|
|
71
|
-
}, /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$Grid), {
|
|
72
|
-
UNSAFE_className: (0, $6TrMC$classNames)((0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs))), 'spectrum-Menu-itemGrid')
|
|
73
|
-
}, /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$ClearSlots), null, /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$SlotProvider), {
|
|
74
|
-
slots: {
|
|
75
|
-
text: {
|
|
76
|
-
UNSAFE_className: (0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs)))['spectrum-Menu-itemLabel'],
|
|
77
|
-
...labelProps
|
|
78
|
-
},
|
|
79
|
-
icon: {
|
|
80
|
-
size: 'S',
|
|
81
|
-
UNSAFE_className: (0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs)))['spectrum-Menu-icon']
|
|
82
|
-
},
|
|
83
|
-
avatar: {
|
|
84
|
-
size: 'avatar-size-100',
|
|
85
|
-
UNSAFE_className: (0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs)))['spectrum-Menu-avatar']
|
|
86
|
-
},
|
|
87
|
-
description: {
|
|
88
|
-
UNSAFE_className: (0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs)))['spectrum-Menu-description'],
|
|
89
|
-
...descriptionProps
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}, contents, isSelected && /*#__PURE__*/ (0, $6TrMC$react).createElement((0, $6TrMC$spectrumiconsuiCheckmarkMedium), {
|
|
93
|
-
slot: "checkmark",
|
|
94
|
-
UNSAFE_className: (0, $6TrMC$classNames)((0, ($parcel$interopDefault($6TrMC$menu_vars_cssmodulejs))), 'spectrum-Menu-checkmark')
|
|
95
|
-
}))))));
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
export {$86983ea1fa3f7312$export$feb3b6b552c14a12 as ListBoxOption};
|
|
100
|
-
//# sourceMappingURL=ListBoxOption.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;AAoBM,SAAS,0CAAiB,KAAqB;IACpD,IAAI,QAAC,IAAI,EAAC,GAAG;IAEb,IAAI,YACF,QAAQ,OACR,GAAG,EACJ,GAAG;IACJ,IAAI,cAAiC,KAAK,KAAK,CAAC,IAAI,GAAG,MAAM;IAC7D,IAAI,SAAC,KAAK,sBAAE,kBAAkB,yBAAE,qBAAqB,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAa;IAEjF,IAAI,MAAM,CAAA,GAAA,aAAK,EAAO;IACtB,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;QACA,eAAe;IACjB,GACA,OACA;IAEF,IAAI,cAAC,UAAU,aAA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Ac;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, {JSX, 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}\n\n/** @private */\nexport function ListBoxOption<T>(props: OptionProps<T>): JSX.Element {\n let {item} = props;\n\n let {\n rendered,\n key\n } = item;\n let ElementType: React.ElementType = item.props.href ? 'a' : 'div';\n let {state, shouldFocusOnHover, shouldUseVirtualFocus} = useContext(ListBoxContext)!;\n\n let ref = useRef<any>(undefined);\n let {optionProps, labelProps, descriptionProps, isSelected, isDisabled, isFocused} = useOption(\n {\n 'aria-label': item['aria-label'],\n key,\n isVirtualized: true\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"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
var $611e93c7b7c0413c$exports = require("./ListBoxContext.main.js");
|
|
2
|
-
require("./listbox.a566c7a6.css");
|
|
3
|
-
var $3deee0fd2b46e64f$exports = require("./menu_vars_css.main.js");
|
|
4
|
-
var $cCu2p$reactspectrumutils = require("@react-spectrum/utils");
|
|
5
|
-
var $cCu2p$reactariavirtualizer = require("@react-aria/virtualizer");
|
|
6
|
-
var $cCu2p$react = require("react");
|
|
7
|
-
var $cCu2p$reactarialistbox = require("@react-aria/listbox");
|
|
8
|
-
var $cCu2p$reactariai18n = require("@react-aria/i18n");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function $parcel$interopDefault(a) {
|
|
12
|
-
return a && a.__esModule ? a.default : a;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function $parcel$export(e, n, v, s) {
|
|
16
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
$parcel$export(module.exports, "ListBoxSection", () => $0f5fd8483f48ef09$export$dca12b0bb56e4fc);
|
|
20
|
-
/*
|
|
21
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
22
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
23
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
24
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
-
*
|
|
26
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
27
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
28
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
29
|
-
* governing permissions and limitations under the License.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
function $0f5fd8483f48ef09$export$dca12b0bb56e4fc(props) {
|
|
38
|
-
let { children: children, layoutInfo: layoutInfo, headerLayoutInfo: headerLayoutInfo, virtualizer: virtualizer, item: item } = props;
|
|
39
|
-
let { headingProps: headingProps, groupProps: groupProps } = (0, $cCu2p$reactarialistbox.useListBoxSection)({
|
|
40
|
-
heading: item.rendered,
|
|
41
|
-
'aria-label': item['aria-label']
|
|
42
|
-
});
|
|
43
|
-
let headerRef = (0, $cCu2p$react.useRef)(null);
|
|
44
|
-
(0, $cCu2p$reactariavirtualizer.useVirtualizerItem)({
|
|
45
|
-
layoutInfo: headerLayoutInfo,
|
|
46
|
-
virtualizer: virtualizer,
|
|
47
|
-
ref: headerRef
|
|
48
|
-
});
|
|
49
|
-
let { direction: direction } = (0, $cCu2p$reactariai18n.useLocale)();
|
|
50
|
-
let { state: state } = (0, $cCu2p$react.useContext)((0, $611e93c7b7c0413c$exports.ListBoxContext));
|
|
51
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($cCu2p$react))).createElement((0, $cCu2p$react.Fragment), null, headerLayoutInfo && /*#__PURE__*/ (0, ($parcel$interopDefault($cCu2p$react))).createElement("div", {
|
|
52
|
-
role: "presentation",
|
|
53
|
-
ref: headerRef,
|
|
54
|
-
style: (0, $cCu2p$reactariavirtualizer.layoutInfoToStyle)(headerLayoutInfo, direction)
|
|
55
|
-
}, item.key !== state.collection.getFirstKey() && /*#__PURE__*/ (0, ($parcel$interopDefault($cCu2p$react))).createElement("div", {
|
|
56
|
-
role: "presentation",
|
|
57
|
-
className: (0, $cCu2p$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), 'spectrum-Menu-divider')
|
|
58
|
-
}), item.rendered && /*#__PURE__*/ (0, ($parcel$interopDefault($cCu2p$react))).createElement("div", {
|
|
59
|
-
...headingProps,
|
|
60
|
-
className: (0, $cCu2p$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), 'spectrum-Menu-sectionHeading')
|
|
61
|
-
}, item.rendered)), /*#__PURE__*/ (0, ($parcel$interopDefault($cCu2p$react))).createElement("div", {
|
|
62
|
-
...groupProps,
|
|
63
|
-
style: (0, $cCu2p$reactariavirtualizer.layoutInfoToStyle)(layoutInfo, direction),
|
|
64
|
-
className: (0, $cCu2p$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), 'spectrum-Menu')
|
|
65
|
-
}, children));
|
|
66
|
-
}
|
|
67
|
-
|
|
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"],"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 {classNames} from '@react-spectrum/utils';\nimport {LayoutInfo} from '@react-stately/virtualizer';\nimport {layoutInfoToStyle, useVirtualizerItem, VirtualizerItemOptions} from '@react-aria/virtualizer';\nimport {ListBoxContext} from './ListBoxContext';\nimport {Node} from '@react-types/shared';\nimport React, {Fragment, JSX, ReactNode, useContext, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {useListBoxSection} from '@react-aria/listbox';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface ListBoxSectionProps<T> extends Omit<VirtualizerItemOptions, 'ref' | 'layoutInfo'> {\n layoutInfo: LayoutInfo,\n headerLayoutInfo: LayoutInfo | null,\n item: Node<T>,\n children?: ReactNode\n}\n\n/** @private */\nexport function ListBoxSection<T>(props: ListBoxSectionProps<T>): JSX.Element {\n let {children, layoutInfo, headerLayoutInfo, virtualizer, item} = props;\n let {headingProps, groupProps} = useListBoxSection({\n heading: item.rendered,\n 'aria-label': item['aria-label']\n });\n\n let headerRef = useRef<HTMLDivElement | null>(null);\n useVirtualizerItem({\n layoutInfo: headerLayoutInfo,\n virtualizer,\n ref: headerRef\n });\n\n let {direction} = useLocale();\n let {state} = useContext(ListBoxContext)!;\n\n return (\n <Fragment>\n {headerLayoutInfo && <div role=\"presentation\" ref={headerRef} style={layoutInfoToStyle(headerLayoutInfo, direction)}>\n {item.key !== state.collection.getFirstKey() &&\n <div\n role=\"presentation\"\n className={classNames(\n styles,\n 'spectrum-Menu-divider'\n )} />\n }\n {item.rendered &&\n <div\n {...headingProps}\n className={\n classNames(\n styles,\n 'spectrum-Menu-sectionHeading'\n )\n }>\n {item.rendered}\n </div>\n }\n </div>}\n <div\n {...groupProps}\n style={layoutInfoToStyle(layoutInfo, direction)}\n className={\n classNames(\n styles,\n 'spectrum-Menu'\n )\n }>\n {children}\n </div>\n </Fragment>\n );\n}\n"],"names":[],"version":3,"file":"ListBoxSection.main.js.map"}
|
package/dist/ListBoxSection.mjs
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import {ListBoxContext as $0c6f792811e33483$export$7ff8f37d2d81a48d} from "./ListBoxContext.mjs";
|
|
2
|
-
import "./listbox.a566c7a6.css";
|
|
3
|
-
import $dzUX8$menu_vars_cssmodulejs from "./menu_vars_css.mjs";
|
|
4
|
-
import {classNames as $dzUX8$classNames} from "@react-spectrum/utils";
|
|
5
|
-
import {useVirtualizerItem as $dzUX8$useVirtualizerItem, layoutInfoToStyle as $dzUX8$layoutInfoToStyle} from "@react-aria/virtualizer";
|
|
6
|
-
import $dzUX8$react, {useRef as $dzUX8$useRef, useContext as $dzUX8$useContext, Fragment as $dzUX8$Fragment} from "react";
|
|
7
|
-
import {useListBoxSection as $dzUX8$useListBoxSection} from "@react-aria/listbox";
|
|
8
|
-
import {useLocale as $dzUX8$useLocale} from "@react-aria/i18n";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function $parcel$interopDefault(a) {
|
|
12
|
-
return a && a.__esModule ? a.default : a;
|
|
13
|
-
}
|
|
14
|
-
/*
|
|
15
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
16
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
17
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
18
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
-
*
|
|
20
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
21
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
22
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
23
|
-
* governing permissions and limitations under the License.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
function $92d678ed88836094$export$dca12b0bb56e4fc(props) {
|
|
32
|
-
let { children: children, layoutInfo: layoutInfo, headerLayoutInfo: headerLayoutInfo, virtualizer: virtualizer, item: item } = props;
|
|
33
|
-
let { headingProps: headingProps, groupProps: groupProps } = (0, $dzUX8$useListBoxSection)({
|
|
34
|
-
heading: item.rendered,
|
|
35
|
-
'aria-label': item['aria-label']
|
|
36
|
-
});
|
|
37
|
-
let headerRef = (0, $dzUX8$useRef)(null);
|
|
38
|
-
(0, $dzUX8$useVirtualizerItem)({
|
|
39
|
-
layoutInfo: headerLayoutInfo,
|
|
40
|
-
virtualizer: virtualizer,
|
|
41
|
-
ref: headerRef
|
|
42
|
-
});
|
|
43
|
-
let { direction: direction } = (0, $dzUX8$useLocale)();
|
|
44
|
-
let { state: state } = (0, $dzUX8$useContext)((0, $0c6f792811e33483$export$7ff8f37d2d81a48d));
|
|
45
|
-
return /*#__PURE__*/ (0, $dzUX8$react).createElement((0, $dzUX8$Fragment), null, headerLayoutInfo && /*#__PURE__*/ (0, $dzUX8$react).createElement("div", {
|
|
46
|
-
role: "presentation",
|
|
47
|
-
ref: headerRef,
|
|
48
|
-
style: (0, $dzUX8$layoutInfoToStyle)(headerLayoutInfo, direction)
|
|
49
|
-
}, item.key !== state.collection.getFirstKey() && /*#__PURE__*/ (0, $dzUX8$react).createElement("div", {
|
|
50
|
-
role: "presentation",
|
|
51
|
-
className: (0, $dzUX8$classNames)((0, ($parcel$interopDefault($dzUX8$menu_vars_cssmodulejs))), 'spectrum-Menu-divider')
|
|
52
|
-
}), item.rendered && /*#__PURE__*/ (0, $dzUX8$react).createElement("div", {
|
|
53
|
-
...headingProps,
|
|
54
|
-
className: (0, $dzUX8$classNames)((0, ($parcel$interopDefault($dzUX8$menu_vars_cssmodulejs))), 'spectrum-Menu-sectionHeading')
|
|
55
|
-
}, item.rendered)), /*#__PURE__*/ (0, $dzUX8$react).createElement("div", {
|
|
56
|
-
...groupProps,
|
|
57
|
-
style: (0, $dzUX8$layoutInfoToStyle)(layoutInfo, direction),
|
|
58
|
-
className: (0, $dzUX8$classNames)((0, ($parcel$interopDefault($dzUX8$menu_vars_cssmodulejs))), 'spectrum-Menu')
|
|
59
|
-
}, children));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
export {$92d678ed88836094$export$dca12b0bb56e4fc as ListBoxSection};
|
|
64
|
-
//# sourceMappingURL=ListBoxSection.module.js.map
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import {ListBoxContext as $0c6f792811e33483$export$7ff8f37d2d81a48d} from "./ListBoxContext.module.js";
|
|
2
|
-
import "./listbox.a566c7a6.css";
|
|
3
|
-
import $dzUX8$menu_vars_cssmodulejs from "./menu_vars_css.module.js";
|
|
4
|
-
import {classNames as $dzUX8$classNames} from "@react-spectrum/utils";
|
|
5
|
-
import {useVirtualizerItem as $dzUX8$useVirtualizerItem, layoutInfoToStyle as $dzUX8$layoutInfoToStyle} from "@react-aria/virtualizer";
|
|
6
|
-
import $dzUX8$react, {useRef as $dzUX8$useRef, useContext as $dzUX8$useContext, Fragment as $dzUX8$Fragment} from "react";
|
|
7
|
-
import {useListBoxSection as $dzUX8$useListBoxSection} from "@react-aria/listbox";
|
|
8
|
-
import {useLocale as $dzUX8$useLocale} from "@react-aria/i18n";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function $parcel$interopDefault(a) {
|
|
12
|
-
return a && a.__esModule ? a.default : a;
|
|
13
|
-
}
|
|
14
|
-
/*
|
|
15
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
16
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
17
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
18
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
-
*
|
|
20
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
21
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
22
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
23
|
-
* governing permissions and limitations under the License.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
function $92d678ed88836094$export$dca12b0bb56e4fc(props) {
|
|
32
|
-
let { children: children, layoutInfo: layoutInfo, headerLayoutInfo: headerLayoutInfo, virtualizer: virtualizer, item: item } = props;
|
|
33
|
-
let { headingProps: headingProps, groupProps: groupProps } = (0, $dzUX8$useListBoxSection)({
|
|
34
|
-
heading: item.rendered,
|
|
35
|
-
'aria-label': item['aria-label']
|
|
36
|
-
});
|
|
37
|
-
let headerRef = (0, $dzUX8$useRef)(null);
|
|
38
|
-
(0, $dzUX8$useVirtualizerItem)({
|
|
39
|
-
layoutInfo: headerLayoutInfo,
|
|
40
|
-
virtualizer: virtualizer,
|
|
41
|
-
ref: headerRef
|
|
42
|
-
});
|
|
43
|
-
let { direction: direction } = (0, $dzUX8$useLocale)();
|
|
44
|
-
let { state: state } = (0, $dzUX8$useContext)((0, $0c6f792811e33483$export$7ff8f37d2d81a48d));
|
|
45
|
-
return /*#__PURE__*/ (0, $dzUX8$react).createElement((0, $dzUX8$Fragment), null, headerLayoutInfo && /*#__PURE__*/ (0, $dzUX8$react).createElement("div", {
|
|
46
|
-
role: "presentation",
|
|
47
|
-
ref: headerRef,
|
|
48
|
-
style: (0, $dzUX8$layoutInfoToStyle)(headerLayoutInfo, direction)
|
|
49
|
-
}, item.key !== state.collection.getFirstKey() && /*#__PURE__*/ (0, $dzUX8$react).createElement("div", {
|
|
50
|
-
role: "presentation",
|
|
51
|
-
className: (0, $dzUX8$classNames)((0, ($parcel$interopDefault($dzUX8$menu_vars_cssmodulejs))), 'spectrum-Menu-divider')
|
|
52
|
-
}), item.rendered && /*#__PURE__*/ (0, $dzUX8$react).createElement("div", {
|
|
53
|
-
...headingProps,
|
|
54
|
-
className: (0, $dzUX8$classNames)((0, ($parcel$interopDefault($dzUX8$menu_vars_cssmodulejs))), 'spectrum-Menu-sectionHeading')
|
|
55
|
-
}, item.rendered)), /*#__PURE__*/ (0, $dzUX8$react).createElement("div", {
|
|
56
|
-
...groupProps,
|
|
57
|
-
style: (0, $dzUX8$layoutInfoToStyle)(layoutInfo, direction),
|
|
58
|
-
className: (0, $dzUX8$classNames)((0, ($parcel$interopDefault($dzUX8$menu_vars_cssmodulejs))), 'spectrum-Menu')
|
|
59
|
-
}, children));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
export {$92d678ed88836094$export$dca12b0bb56e4fc as ListBoxSection};
|
|
64
|
-
//# sourceMappingURL=ListBoxSection.module.js.map
|