@plasmicpkgs/react-aria 0.0.153 → 0.0.155
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/.tsbuildinfo +1 -1
- package/dist/react-aria.esm.js +276 -287
- package/dist/react-aria.esm.js.map +1 -1
- package/dist/react-aria.js +275 -286
- package/dist/react-aria.js.map +1 -1
- package/dist/registerListBox.d.ts +1 -1
- package/dist/variant-utils.d.ts +4 -3
- package/package.json +3 -3
- package/skinny/registerButton.cjs.js +27 -22
- package/skinny/registerButton.cjs.js.map +1 -1
- package/skinny/registerButton.esm.js +27 -22
- package/skinny/registerButton.esm.js.map +1 -1
- package/skinny/registerCheckbox.cjs.js +18 -16
- package/skinny/registerCheckbox.cjs.js.map +1 -1
- package/skinny/registerCheckbox.esm.js +18 -16
- package/skinny/registerCheckbox.esm.js.map +1 -1
- package/skinny/registerCheckboxGroup.cjs.js +12 -12
- package/skinny/registerCheckboxGroup.cjs.js.map +1 -1
- package/skinny/registerCheckboxGroup.esm.js +12 -12
- package/skinny/registerCheckboxGroup.esm.js.map +1 -1
- package/skinny/registerComboBox.cjs.js +11 -16
- package/skinny/registerComboBox.cjs.js.map +1 -1
- package/skinny/registerComboBox.esm.js +11 -16
- package/skinny/registerComboBox.esm.js.map +1 -1
- package/skinny/registerDialogTrigger.cjs.js +1 -1
- package/skinny/registerDialogTrigger.esm.js +1 -1
- package/skinny/registerInput.cjs.js +1 -1
- package/skinny/registerInput.esm.js +1 -1
- package/skinny/{registerListBox-7a50077e.cjs.js → registerListBox-28474381.cjs.js} +24 -32
- package/skinny/registerListBox-28474381.cjs.js.map +1 -0
- package/skinny/{registerListBox-14503b0a.esm.js → registerListBox-7197abae.esm.js} +26 -34
- package/skinny/registerListBox-7197abae.esm.js.map +1 -0
- package/skinny/registerListBox.cjs.js +4 -3
- package/skinny/registerListBox.cjs.js.map +1 -1
- package/skinny/registerListBox.d.ts +1 -1
- package/skinny/registerListBox.esm.js +4 -3
- package/skinny/registerListBox.esm.js.map +1 -1
- package/skinny/registerListBoxItem.cjs.js +20 -17
- package/skinny/registerListBoxItem.cjs.js.map +1 -1
- package/skinny/registerListBoxItem.esm.js +20 -17
- package/skinny/registerListBoxItem.esm.js.map +1 -1
- package/skinny/registerOverlayArrow.cjs.js +12 -12
- package/skinny/registerOverlayArrow.cjs.js.map +1 -1
- package/skinny/registerOverlayArrow.esm.js +12 -12
- package/skinny/registerOverlayArrow.esm.js.map +1 -1
- package/skinny/registerRadio.cjs.js +17 -15
- package/skinny/registerRadio.cjs.js.map +1 -1
- package/skinny/registerRadio.esm.js +17 -15
- package/skinny/registerRadio.esm.js.map +1 -1
- package/skinny/registerRadioGroup.cjs.js +12 -10
- package/skinny/registerRadioGroup.cjs.js.map +1 -1
- package/skinny/registerRadioGroup.esm.js +12 -10
- package/skinny/registerRadioGroup.esm.js.map +1 -1
- package/skinny/registerSection.cjs.js +3 -2
- package/skinny/registerSection.cjs.js.map +1 -1
- package/skinny/registerSection.esm.js +3 -2
- package/skinny/registerSection.esm.js.map +1 -1
- package/skinny/registerSelect.cjs.js +19 -25
- package/skinny/registerSelect.cjs.js.map +1 -1
- package/skinny/registerSelect.esm.js +19 -25
- package/skinny/registerSelect.esm.js.map +1 -1
- package/skinny/registerSlider.cjs.js +10 -8
- package/skinny/registerSlider.cjs.js.map +1 -1
- package/skinny/registerSlider.esm.js +10 -8
- package/skinny/registerSlider.esm.js.map +1 -1
- package/skinny/registerSliderOutput.cjs.js +10 -10
- package/skinny/registerSliderOutput.cjs.js.map +1 -1
- package/skinny/registerSliderOutput.esm.js +10 -10
- package/skinny/registerSliderOutput.esm.js.map +1 -1
- package/skinny/registerSliderThumb.cjs.js +9 -15
- package/skinny/registerSliderThumb.cjs.js.map +1 -1
- package/skinny/registerSliderThumb.esm.js +9 -15
- package/skinny/registerSliderThumb.esm.js.map +1 -1
- package/skinny/registerSliderTrack.cjs.js +20 -20
- package/skinny/registerSliderTrack.cjs.js.map +1 -1
- package/skinny/registerSliderTrack.esm.js +20 -20
- package/skinny/registerSliderTrack.esm.js.map +1 -1
- package/skinny/registerSwitch.cjs.js +16 -14
- package/skinny/registerSwitch.cjs.js.map +1 -1
- package/skinny/registerSwitch.esm.js +16 -14
- package/skinny/registerSwitch.esm.js.map +1 -1
- package/skinny/registerTextArea.cjs.js +1 -1
- package/skinny/registerTextArea.esm.js +1 -1
- package/skinny/registerTextField.cjs.js +11 -9
- package/skinny/registerTextField.cjs.js.map +1 -1
- package/skinny/registerTextField.esm.js +11 -9
- package/skinny/registerTextField.esm.js.map +1 -1
- package/skinny/{variant-utils-0ad70db8.cjs.js → variant-utils-1c84aebb.cjs.js} +5 -9
- package/skinny/variant-utils-1c84aebb.cjs.js.map +1 -0
- package/skinny/{variant-utils-4405ebb0.esm.js → variant-utils-5f356d53.esm.js} +5 -10
- package/skinny/variant-utils-5f356d53.esm.js.map +1 -0
- package/skinny/variant-utils.d.ts +4 -3
- package/skinny/registerListBox-14503b0a.esm.js.map +0 -1
- package/skinny/registerListBox-7a50077e.cjs.js.map +0 -1
- package/skinny/variant-utils-0ad70db8.cjs.js.map +0 -1
- package/skinny/variant-utils-4405ebb0.esm.js.map +0 -1
|
@@ -2,20 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
var host = require('@plasmicapp/host');
|
|
4
4
|
var React = require('react');
|
|
5
|
+
var reactAria = require('react-aria');
|
|
5
6
|
var reactAriaComponents = require('react-aria-components');
|
|
7
|
+
var OptionsItemIdManager = require('./OptionsItemIdManager-cb3a2c53.cjs.js');
|
|
6
8
|
var common = require('./common-7f948fa5.cjs.js');
|
|
7
9
|
var contexts = require('./contexts-6d0cb2b1.cjs.js');
|
|
8
|
-
var OptionsItemIdManager = require('./OptionsItemIdManager-cb3a2c53.cjs.js');
|
|
9
10
|
var registerListBoxItem = require('./registerListBoxItem.cjs.js');
|
|
10
|
-
var variantUtils = require('./variant-utils-
|
|
11
|
+
var variantUtils = require('./variant-utils-1c84aebb.cjs.js');
|
|
11
12
|
|
|
12
13
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
14
|
|
|
14
15
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
15
16
|
|
|
16
17
|
var __defProp$1 = Object.defineProperty;
|
|
17
|
-
var __defProps = Object.defineProperties;
|
|
18
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
18
|
+
var __defProps$1 = Object.defineProperties;
|
|
19
|
+
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
19
20
|
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
20
21
|
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
21
22
|
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
@@ -31,7 +32,7 @@ var __spreadValues$1 = (a, b) => {
|
|
|
31
32
|
}
|
|
32
33
|
return a;
|
|
33
34
|
};
|
|
34
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
35
|
+
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
35
36
|
var __objRest$1 = (source, exclude) => {
|
|
36
37
|
var target = {};
|
|
37
38
|
for (var prop in source)
|
|
@@ -48,7 +49,7 @@ function BaseSection(props) {
|
|
|
48
49
|
const _a = props, { header, items } = _a, rest = __objRest$1(_a, ["header", "items"]);
|
|
49
50
|
const contextProps = React__default.default.useContext(contexts.PlasmicListBoxContext);
|
|
50
51
|
const isStandalone = !contextProps;
|
|
51
|
-
const section = /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.
|
|
52
|
+
const section = /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.ListBoxSection, __spreadProps$1(__spreadValues$1({}, rest), { style: common.COMMON_STYLES }), /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Header, null, header), items);
|
|
52
53
|
if (isStandalone) {
|
|
53
54
|
return (
|
|
54
55
|
// BaseListbox should give section a listbox context (that it can't be used without)
|
|
@@ -96,6 +97,8 @@ function registerSection(loader, overrides) {
|
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
var __defProp = Object.defineProperty;
|
|
100
|
+
var __defProps = Object.defineProperties;
|
|
101
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
99
102
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
100
103
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
101
104
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -111,6 +114,7 @@ var __spreadValues = (a, b) => {
|
|
|
111
114
|
}
|
|
112
115
|
return a;
|
|
113
116
|
};
|
|
117
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
114
118
|
var __objRest = (source, exclude) => {
|
|
115
119
|
var target = {};
|
|
116
120
|
for (var prop in source)
|
|
@@ -123,8 +127,8 @@ var __objRest = (source, exclude) => {
|
|
|
123
127
|
}
|
|
124
128
|
return target;
|
|
125
129
|
};
|
|
126
|
-
const LISTBOX_VARIANTS = ["focused"
|
|
127
|
-
const { variants } = variantUtils.pickAriaComponentVariants(LISTBOX_VARIANTS);
|
|
130
|
+
const LISTBOX_VARIANTS = ["focused"];
|
|
131
|
+
const { variants: LISTBOX_VARIANTS_DATA } = variantUtils.pickAriaComponentVariants(LISTBOX_VARIANTS);
|
|
128
132
|
const listboxHelpers = {
|
|
129
133
|
states: {
|
|
130
134
|
selectedValue: {
|
|
@@ -141,14 +145,12 @@ function BaseListBox(props) {
|
|
|
141
145
|
const _a = props, {
|
|
142
146
|
setControlContextData,
|
|
143
147
|
children,
|
|
144
|
-
className,
|
|
145
148
|
selectedKeys,
|
|
146
149
|
defaultSelectedKeys,
|
|
147
150
|
plasmicUpdateVariant
|
|
148
151
|
} = _a, rest = __objRest(_a, [
|
|
149
152
|
"setControlContextData",
|
|
150
153
|
"children",
|
|
151
|
-
"className",
|
|
152
154
|
"selectedKeys",
|
|
153
155
|
"defaultSelectedKeys",
|
|
154
156
|
"plasmicUpdateVariant"
|
|
@@ -158,32 +160,22 @@ function BaseListBox(props) {
|
|
|
158
160
|
const [ids, setIds] = React.useState([]);
|
|
159
161
|
const inEditor = host.usePlasmicCanvasContext();
|
|
160
162
|
const idManager = OptionsItemIdManager.useIdManager(setIds, context == null ? void 0 : context.idManager);
|
|
163
|
+
const mergedProps = reactAria.mergeProps(rest, __spreadProps(__spreadValues({
|
|
164
|
+
onFocusChange: (focused) => {
|
|
165
|
+
plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({ focused });
|
|
166
|
+
}
|
|
167
|
+
}, inEditor ? { shouldUseVirtualFocus: true } : {}), {
|
|
168
|
+
style: common.COMMON_STYLES,
|
|
169
|
+
selectedKeys: normalizeSelectedKeys(selectedKeys),
|
|
170
|
+
defaultSelectedKeys: normalizeSelectedKeys(defaultSelectedKeys)
|
|
171
|
+
}));
|
|
161
172
|
React.useEffect(() => {
|
|
162
173
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
163
174
|
itemIds: ids,
|
|
164
175
|
isStandalone
|
|
165
176
|
});
|
|
166
177
|
}, [ids, isStandalone, setControlContextData]);
|
|
167
|
-
const
|
|
168
|
-
({ isFocusVisible, isFocused }) => {
|
|
169
|
-
plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({
|
|
170
|
-
focused: isFocused,
|
|
171
|
-
focusVisible: isFocusVisible
|
|
172
|
-
});
|
|
173
|
-
return className != null ? className : "";
|
|
174
|
-
},
|
|
175
|
-
[className, plasmicUpdateVariant]
|
|
176
|
-
);
|
|
177
|
-
const listbox = /* @__PURE__ */ React__default.default.createElement(
|
|
178
|
-
reactAriaComponents.ListBox,
|
|
179
|
-
__spreadValues(__spreadValues({
|
|
180
|
-
selectedKeys: normalizeSelectedKeys(selectedKeys),
|
|
181
|
-
defaultSelectedKeys: normalizeSelectedKeys(defaultSelectedKeys),
|
|
182
|
-
className: classNameProp,
|
|
183
|
-
style: common.COMMON_STYLES
|
|
184
|
-
}, inEditor ? { shouldUseVirtualFocus: true } : {}), rest),
|
|
185
|
-
children
|
|
186
|
-
);
|
|
178
|
+
const listbox = /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.ListBox, __spreadValues({}, mergedProps), children);
|
|
187
179
|
if (isStandalone) {
|
|
188
180
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
189
181
|
contexts.PlasmicListBoxContext.Provider,
|
|
@@ -262,7 +254,7 @@ function registerListBox(loader, overrides) {
|
|
|
262
254
|
displayName: "Aria ListBox",
|
|
263
255
|
importPath: "@plasmicpkgs/react-aria/skinny/registerListBox",
|
|
264
256
|
importName: "BaseListBox",
|
|
265
|
-
variants,
|
|
257
|
+
variants: LISTBOX_VARIANTS_DATA,
|
|
266
258
|
defaultStyles: {
|
|
267
259
|
width: "250px",
|
|
268
260
|
borderWidth: "1px",
|
|
@@ -374,4 +366,4 @@ exports.LIST_BOX_COMPONENT_NAME = LIST_BOX_COMPONENT_NAME;
|
|
|
374
366
|
exports.listboxHelpers = listboxHelpers;
|
|
375
367
|
exports.registerListBox = registerListBox;
|
|
376
368
|
exports.registerSection = registerSection;
|
|
377
|
-
//# sourceMappingURL=registerListBox-
|
|
369
|
+
//# sourceMappingURL=registerListBox-28474381.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerListBox-28474381.cjs.js","sources":["../src/registerSection.tsx","../src/registerListBox.tsx"],"sourcesContent":["import React from \"react\";\nimport { Header, ListBoxSection } from \"react-aria-components\";\nimport { COMMON_STYLES, createAriaLabelProp } from \"./common\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport { BaseListBox } from \"./registerListBox\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n Styleable,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseSectionProps extends Styleable {\n items: React.ReactNode;\n header: React.ReactNode;\n}\n\nexport function BaseSection(props: BaseSectionProps) {\n const { header, items, ...rest } = props;\n const contextProps = React.useContext(PlasmicListBoxContext);\n const isStandalone = !contextProps;\n\n const section = (\n <ListBoxSection {...rest} style={COMMON_STYLES}>\n <Header>{header}</Header>\n {items}\n </ListBoxSection>\n );\n\n if (isStandalone) {\n return (\n // BaseListbox should give section a listbox context (that it can't be used without)\n // as well as the id manager (that is needed to identify and warn about duplication of ids)\n // selection mode needs to be single/multiple to be able to trigger hover state on it.\n <BaseListBox selectionMode=\"single\">{section}</BaseListBox>\n );\n }\n\n return section;\n}\n\nexport function registerSection(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseSection>\n) {\n return registerComponentHelper(\n loader,\n BaseSection,\n {\n name: makeComponentName(\"section\"),\n displayName: \"Aria Section\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSection\",\n importName: \"BaseSection\",\n defaultStyles: {\n width: \"stretch\",\n padding: \"10px\",\n },\n props: {\n \"aria-label\": createAriaLabelProp(\"Section\"),\n header: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n {\n type: \"text\",\n value: \"Section Header.\",\n },\n ],\n },\n items: {\n type: \"slot\",\n mergeWithParent: true,\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n","import { usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport React, { useEffect, useState } from \"react\";\nimport { mergeProps } from \"react-aria\";\nimport { Key, ListBox } from \"react-aria-components\";\nimport { useIdManager } from \"./OptionsItemIdManager\";\nimport { COMMON_STYLES, createAriaLabelProp, createIdProp } from \"./common\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport {\n makeDefaultListBoxItemChildren,\n registerListBoxItem,\n} from \"./registerListBoxItem\";\nimport { registerSection } from \"./registerSection\";\nimport {\n BaseControlContextDataForLists,\n CodeComponentMetaOverrides,\n HasControlContextData,\n Registerable,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\nimport { WithVariants, pickAriaComponentVariants } from \"./variant-utils\";\n\nexport interface BaseListBoxControlContextData\n extends BaseControlContextDataForLists {\n isStandalone: boolean;\n}\n\nconst LISTBOX_VARIANTS = [\"focused\" as const];\n\nconst { variants: LISTBOX_VARIANTS_DATA } =\n pickAriaComponentVariants(LISTBOX_VARIANTS);\n\nexport interface BaseListBoxProps\n extends Omit<\n React.ComponentProps<typeof ListBox>,\n \"selectedKeys\" | \"defaultSelectedKeys\" | \"className\"\n >,\n HasControlContextData<BaseListBoxControlContextData>,\n WithVariants<typeof LISTBOX_VARIANTS> {\n children?: React.ReactNode;\n selectedKeys?: string | string[] | undefined;\n defaultSelectedKeys?: string | string[] | undefined;\n className?: string;\n}\n\nexport const listboxHelpers = {\n states: {\n selectedValue: {\n onChangeArgsToValue: (value: Set<Key> | string[] | string) => {\n // only single selection is supported\n return Array.from(value)[0];\n },\n },\n },\n};\n\nfunction normalizeSelectedKeys(selectedKeys: string | string[] | undefined) {\n // Listbox expects it to be of type \"all\" | Iterable\n return typeof selectedKeys === \"string\" && selectedKeys !== \"all\"\n ? [selectedKeys]\n : selectedKeys;\n}\n\nexport function BaseListBox(props: BaseListBoxProps) {\n const {\n setControlContextData: setControlContextData,\n children,\n selectedKeys,\n defaultSelectedKeys,\n plasmicUpdateVariant,\n ...rest\n } = props;\n const context = React.useContext(PlasmicListBoxContext);\n const isStandalone = !context;\n const [ids, setIds] = useState<string[]>([]);\n const inEditor = usePlasmicCanvasContext();\n\n const idManager = useIdManager(setIds, context?.idManager);\n\n const mergedProps = mergeProps(rest, {\n onFocusChange: (focused: boolean) => {\n plasmicUpdateVariant?.({ focused });\n },\n // `shouldUseVirtualFocus` is not part of the ListBox prop types, but it's passed through to useListBox, which does support it.\n // In editor, we use virtual focus to prevent the listbox from stealing focus\n ...(inEditor ? { shouldUseVirtualFocus: true } : {}),\n style: COMMON_STYLES,\n selectedKeys: normalizeSelectedKeys(selectedKeys),\n defaultSelectedKeys: normalizeSelectedKeys(defaultSelectedKeys),\n });\n\n useEffect(() => {\n setControlContextData?.({\n itemIds: ids,\n isStandalone,\n });\n }, [ids, isStandalone, setControlContextData]);\n\n const listbox = <ListBox {...mergedProps}>{children}</ListBox>;\n\n if (isStandalone) {\n return (\n <PlasmicListBoxContext.Provider\n value={{\n idManager,\n }}\n >\n {listbox}\n </PlasmicListBoxContext.Provider>\n );\n }\n\n return listbox;\n}\n\nexport const LIST_BOX_COMPONENT_NAME = makeComponentName(\"listbox\");\n\nexport function registerListBox(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBox>\n) {\n const listBoxItemMeta = registerListBoxItem(loader, {\n parentComponentName: LIST_BOX_COMPONENT_NAME,\n });\n const sectionMeta = registerSection(loader, {\n parentComponentName: LIST_BOX_COMPONENT_NAME,\n props: {\n items: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"section-1-1\",\n textValue: \"Section1-Item 1\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 1\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"section-1-2\",\n textValue: \"Section1-Item 2\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 2\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"section-1-3\",\n textValue: \"Section1-Item 3\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 3\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n ],\n },\n },\n });\n\n registerComponentHelper(\n loader,\n BaseListBox,\n {\n name: LIST_BOX_COMPONENT_NAME,\n displayName: \"Aria ListBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBox\",\n importName: \"BaseListBox\",\n variants: LISTBOX_VARIANTS_DATA,\n defaultStyles: {\n width: \"250px\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n },\n props: {\n id: createIdProp(\"List Box\"),\n \"aria-label\": createAriaLabelProp(\"List Box\"),\n children: {\n type: \"slot\",\n displayName: \"List Items\",\n allowedComponents: [listBoxItemMeta.name, sectionMeta.name],\n allowRootWrapper: true,\n defaultValue: [\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"1\",\n textValue: \"Item 1\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 1\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"2\",\n textValue: \"Item 2\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 2\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"3\",\n textValue: \"Item 3\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 3\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n {\n type: \"component\",\n name: sectionMeta.name,\n },\n ],\n },\n selectionMode: {\n type: \"choice\",\n description: \"The selection mode of the listbox\",\n options: [\"none\", \"single\"],\n defaultValue: \"none\",\n hidden: (_props, ctx) => !ctx?.isStandalone,\n },\n selectedKeys: {\n type: \"choice\",\n editOnly: true,\n uncontrolledProp: \"defaultSelectedKeys\",\n displayName: \"Initial selected item\",\n options: (_props, ctx) =>\n ctx?.itemIds ? Array.from(ctx.itemIds) : [],\n hidden: (props, ctx) =>\n !ctx?.isStandalone || props.selectionMode === \"none\",\n // We do not support multiple selections yet (Because React Aria select and combobox only support single selections).\n multiSelect: false,\n },\n onSelectionChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"selectedValues\", type: \"object\" }],\n },\n },\n states: {\n selectedValue: {\n type: \"writable\",\n valueProp: \"selectedKeys\",\n hidden: (props, ctx) =>\n !ctx?.isStandalone || props.selectionMode === \"none\",\n onChangeProp: \"onSelectionChange\",\n variableType: \"text\",\n ...listboxHelpers.states.selectedValue,\n },\n },\n componentHelpers: {\n helpers: listboxHelpers,\n importName: \"listboxHelpers\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBox\",\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["__objRest","React","PlasmicListBoxContext","ListBoxSection","__spreadProps","__spreadValues","COMMON_STYLES","Header","registerComponentHelper","makeComponentName","createAriaLabelProp","pickAriaComponentVariants","useState","usePlasmicCanvasContext","useIdManager","mergeProps","useEffect","ListBox","registerListBoxItem","makeDefaultListBoxItemChildren","createIdProp"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBO,SAAS,YAAY,KAAyB,EAAA;AACnD,EAAmC,MAAA,EAAA,GAAA,KAAA,EAA3B,UAAQ,KAnBlB,EAAA,GAmBqC,IAAT,IAAS,GAAAA,WAAA,CAAA,EAAA,EAAT,CAAlB,QAAQ,EAAA,OAAA,CAAA,CAAA,CAAA;AAChB,EAAM,MAAA,YAAA,GAAeC,sBAAM,CAAA,UAAA,CAAWC,8BAAqB,CAAA,CAAA;AAC3D,EAAA,MAAM,eAAe,CAAC,YAAA,CAAA;AAEtB,EAAM,MAAA,OAAA,mBACHD,sBAAA,CAAA,aAAA,CAAAE,kCAAA,EAAAC,eAAA,CAAAC,gBAAA,CAAA,EAAA,EAAmB,IAAnB,CAAA,EAAA,EAAyB,KAAO,EAAAC,oBAAA,EAAA,CAAA,kBAC9BL,sBAAA,CAAA,aAAA,CAAAM,0BAAA,EAAA,IAAA,EAAQ,MAAO,CAAA,EACf,KACH,CAAA,CAAA;AAGF,EAAA,IAAI,YAAc,EAAA;AAChB,IAAA;AAAA;AAAA;AAAA;AAAA,sBAIGN,sBAAA,CAAA,aAAA,CAAA,WAAA,EAAA,EAAY,aAAc,EAAA,QAAA,EAAA,EAAU,OAAQ,CAAA;AAAA,MAAA;AAAA,GAEjD;AAEA,EAAO,OAAA,OAAA,CAAA;AACT,CAAA;AAEgB,SAAA,eAAA,CACd,QACA,SACA,EAAA;AACA,EAAO,OAAA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AChD,YAAc,EAAA,mBAAA;AAAA,UACd,YAAc,EAAA,MAAA;AAAA,SAAA,EACX,eAAe,MAAO,CAAA,aAAA,CAAA;AAAA,OAE7B;AAAA,MACA,gBAAkB,EAAA;AAAA,QAChB,OAAS,EAAA,cAAA;AAAA,QACT,UAAY,EAAA,gBAAA;AAAA,QACZ,UAAY,EAAA,gDAAA;AAAA,OACd;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;;;;;"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { usePlasmicCanvasContext } from '@plasmicapp/host';
|
|
2
|
-
import React, { useState, useEffect
|
|
3
|
-
import {
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import { mergeProps } from 'react-aria';
|
|
4
|
+
import { ListBoxSection, Header, ListBox } from 'react-aria-components';
|
|
5
|
+
import { u as useIdManager } from './OptionsItemIdManager-0ce90944.esm.js';
|
|
4
6
|
import { r as registerComponentHelper, C as COMMON_STYLES, m as makeComponentName, f as createAriaLabelProp, c as createIdProp } from './common-81f08e86.esm.js';
|
|
5
7
|
import { b as PlasmicListBoxContext } from './contexts-5cb81c2f.esm.js';
|
|
6
|
-
import { u as useIdManager } from './OptionsItemIdManager-0ce90944.esm.js';
|
|
7
8
|
import { registerListBoxItem, makeDefaultListBoxItemChildren } from './registerListBoxItem.esm.js';
|
|
8
|
-
import { p as pickAriaComponentVariants } from './variant-utils-
|
|
9
|
+
import { p as pickAriaComponentVariants } from './variant-utils-5f356d53.esm.js';
|
|
9
10
|
|
|
10
11
|
var __defProp$1 = Object.defineProperty;
|
|
11
|
-
var __defProps = Object.defineProperties;
|
|
12
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
12
|
+
var __defProps$1 = Object.defineProperties;
|
|
13
|
+
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
13
14
|
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
14
15
|
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
15
16
|
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
@@ -25,7 +26,7 @@ var __spreadValues$1 = (a, b) => {
|
|
|
25
26
|
}
|
|
26
27
|
return a;
|
|
27
28
|
};
|
|
28
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
29
|
+
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
29
30
|
var __objRest$1 = (source, exclude) => {
|
|
30
31
|
var target = {};
|
|
31
32
|
for (var prop in source)
|
|
@@ -42,7 +43,7 @@ function BaseSection(props) {
|
|
|
42
43
|
const _a = props, { header, items } = _a, rest = __objRest$1(_a, ["header", "items"]);
|
|
43
44
|
const contextProps = React.useContext(PlasmicListBoxContext);
|
|
44
45
|
const isStandalone = !contextProps;
|
|
45
|
-
const section = /* @__PURE__ */ React.createElement(
|
|
46
|
+
const section = /* @__PURE__ */ React.createElement(ListBoxSection, __spreadProps$1(__spreadValues$1({}, rest), { style: COMMON_STYLES }), /* @__PURE__ */ React.createElement(Header, null, header), items);
|
|
46
47
|
if (isStandalone) {
|
|
47
48
|
return (
|
|
48
49
|
// BaseListbox should give section a listbox context (that it can't be used without)
|
|
@@ -90,6 +91,8 @@ function registerSection(loader, overrides) {
|
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
var __defProp = Object.defineProperty;
|
|
94
|
+
var __defProps = Object.defineProperties;
|
|
95
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
93
96
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
94
97
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
95
98
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -105,6 +108,7 @@ var __spreadValues = (a, b) => {
|
|
|
105
108
|
}
|
|
106
109
|
return a;
|
|
107
110
|
};
|
|
111
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
108
112
|
var __objRest = (source, exclude) => {
|
|
109
113
|
var target = {};
|
|
110
114
|
for (var prop in source)
|
|
@@ -117,8 +121,8 @@ var __objRest = (source, exclude) => {
|
|
|
117
121
|
}
|
|
118
122
|
return target;
|
|
119
123
|
};
|
|
120
|
-
const LISTBOX_VARIANTS = ["focused"
|
|
121
|
-
const { variants } = pickAriaComponentVariants(LISTBOX_VARIANTS);
|
|
124
|
+
const LISTBOX_VARIANTS = ["focused"];
|
|
125
|
+
const { variants: LISTBOX_VARIANTS_DATA } = pickAriaComponentVariants(LISTBOX_VARIANTS);
|
|
122
126
|
const listboxHelpers = {
|
|
123
127
|
states: {
|
|
124
128
|
selectedValue: {
|
|
@@ -135,14 +139,12 @@ function BaseListBox(props) {
|
|
|
135
139
|
const _a = props, {
|
|
136
140
|
setControlContextData,
|
|
137
141
|
children,
|
|
138
|
-
className,
|
|
139
142
|
selectedKeys,
|
|
140
143
|
defaultSelectedKeys,
|
|
141
144
|
plasmicUpdateVariant
|
|
142
145
|
} = _a, rest = __objRest(_a, [
|
|
143
146
|
"setControlContextData",
|
|
144
147
|
"children",
|
|
145
|
-
"className",
|
|
146
148
|
"selectedKeys",
|
|
147
149
|
"defaultSelectedKeys",
|
|
148
150
|
"plasmicUpdateVariant"
|
|
@@ -152,32 +154,22 @@ function BaseListBox(props) {
|
|
|
152
154
|
const [ids, setIds] = useState([]);
|
|
153
155
|
const inEditor = usePlasmicCanvasContext();
|
|
154
156
|
const idManager = useIdManager(setIds, context == null ? void 0 : context.idManager);
|
|
157
|
+
const mergedProps = mergeProps(rest, __spreadProps(__spreadValues({
|
|
158
|
+
onFocusChange: (focused) => {
|
|
159
|
+
plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({ focused });
|
|
160
|
+
}
|
|
161
|
+
}, inEditor ? { shouldUseVirtualFocus: true } : {}), {
|
|
162
|
+
style: COMMON_STYLES,
|
|
163
|
+
selectedKeys: normalizeSelectedKeys(selectedKeys),
|
|
164
|
+
defaultSelectedKeys: normalizeSelectedKeys(defaultSelectedKeys)
|
|
165
|
+
}));
|
|
155
166
|
useEffect(() => {
|
|
156
167
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
157
168
|
itemIds: ids,
|
|
158
169
|
isStandalone
|
|
159
170
|
});
|
|
160
171
|
}, [ids, isStandalone, setControlContextData]);
|
|
161
|
-
const
|
|
162
|
-
({ isFocusVisible, isFocused }) => {
|
|
163
|
-
plasmicUpdateVariant == null ? void 0 : plasmicUpdateVariant({
|
|
164
|
-
focused: isFocused,
|
|
165
|
-
focusVisible: isFocusVisible
|
|
166
|
-
});
|
|
167
|
-
return className != null ? className : "";
|
|
168
|
-
},
|
|
169
|
-
[className, plasmicUpdateVariant]
|
|
170
|
-
);
|
|
171
|
-
const listbox = /* @__PURE__ */ React.createElement(
|
|
172
|
-
ListBox,
|
|
173
|
-
__spreadValues(__spreadValues({
|
|
174
|
-
selectedKeys: normalizeSelectedKeys(selectedKeys),
|
|
175
|
-
defaultSelectedKeys: normalizeSelectedKeys(defaultSelectedKeys),
|
|
176
|
-
className: classNameProp,
|
|
177
|
-
style: COMMON_STYLES
|
|
178
|
-
}, inEditor ? { shouldUseVirtualFocus: true } : {}), rest),
|
|
179
|
-
children
|
|
180
|
-
);
|
|
172
|
+
const listbox = /* @__PURE__ */ React.createElement(ListBox, __spreadValues({}, mergedProps), children);
|
|
181
173
|
if (isStandalone) {
|
|
182
174
|
return /* @__PURE__ */ React.createElement(
|
|
183
175
|
PlasmicListBoxContext.Provider,
|
|
@@ -256,7 +248,7 @@ function registerListBox(loader, overrides) {
|
|
|
256
248
|
displayName: "Aria ListBox",
|
|
257
249
|
importPath: "@plasmicpkgs/react-aria/skinny/registerListBox",
|
|
258
250
|
importName: "BaseListBox",
|
|
259
|
-
variants,
|
|
251
|
+
variants: LISTBOX_VARIANTS_DATA,
|
|
260
252
|
defaultStyles: {
|
|
261
253
|
width: "250px",
|
|
262
254
|
borderWidth: "1px",
|
|
@@ -363,4 +355,4 @@ function registerListBox(loader, overrides) {
|
|
|
363
355
|
}
|
|
364
356
|
|
|
365
357
|
export { BaseSection as B, LIST_BOX_COMPONENT_NAME as L, BaseListBox as a, registerListBox as b, listboxHelpers as l, registerSection as r };
|
|
366
|
-
//# sourceMappingURL=registerListBox-
|
|
358
|
+
//# sourceMappingURL=registerListBox-7197abae.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerListBox-7197abae.esm.js","sources":["../src/registerSection.tsx","../src/registerListBox.tsx"],"sourcesContent":["import React from \"react\";\nimport { Header, ListBoxSection } from \"react-aria-components\";\nimport { COMMON_STYLES, createAriaLabelProp } from \"./common\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport { BaseListBox } from \"./registerListBox\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n Styleable,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseSectionProps extends Styleable {\n items: React.ReactNode;\n header: React.ReactNode;\n}\n\nexport function BaseSection(props: BaseSectionProps) {\n const { header, items, ...rest } = props;\n const contextProps = React.useContext(PlasmicListBoxContext);\n const isStandalone = !contextProps;\n\n const section = (\n <ListBoxSection {...rest} style={COMMON_STYLES}>\n <Header>{header}</Header>\n {items}\n </ListBoxSection>\n );\n\n if (isStandalone) {\n return (\n // BaseListbox should give section a listbox context (that it can't be used without)\n // as well as the id manager (that is needed to identify and warn about duplication of ids)\n // selection mode needs to be single/multiple to be able to trigger hover state on it.\n <BaseListBox selectionMode=\"single\">{section}</BaseListBox>\n );\n }\n\n return section;\n}\n\nexport function registerSection(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseSection>\n) {\n return registerComponentHelper(\n loader,\n BaseSection,\n {\n name: makeComponentName(\"section\"),\n displayName: \"Aria Section\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSection\",\n importName: \"BaseSection\",\n defaultStyles: {\n width: \"stretch\",\n padding: \"10px\",\n },\n props: {\n \"aria-label\": createAriaLabelProp(\"Section\"),\n header: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n {\n type: \"text\",\n value: \"Section Header.\",\n },\n ],\n },\n items: {\n type: \"slot\",\n mergeWithParent: true,\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n","import { usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport React, { useEffect, useState } from \"react\";\nimport { mergeProps } from \"react-aria\";\nimport { Key, ListBox } from \"react-aria-components\";\nimport { useIdManager } from \"./OptionsItemIdManager\";\nimport { COMMON_STYLES, createAriaLabelProp, createIdProp } from \"./common\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport {\n makeDefaultListBoxItemChildren,\n registerListBoxItem,\n} from \"./registerListBoxItem\";\nimport { registerSection } from \"./registerSection\";\nimport {\n BaseControlContextDataForLists,\n CodeComponentMetaOverrides,\n HasControlContextData,\n Registerable,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\nimport { WithVariants, pickAriaComponentVariants } from \"./variant-utils\";\n\nexport interface BaseListBoxControlContextData\n extends BaseControlContextDataForLists {\n isStandalone: boolean;\n}\n\nconst LISTBOX_VARIANTS = [\"focused\" as const];\n\nconst { variants: LISTBOX_VARIANTS_DATA } =\n pickAriaComponentVariants(LISTBOX_VARIANTS);\n\nexport interface BaseListBoxProps\n extends Omit<\n React.ComponentProps<typeof ListBox>,\n \"selectedKeys\" | \"defaultSelectedKeys\" | \"className\"\n >,\n HasControlContextData<BaseListBoxControlContextData>,\n WithVariants<typeof LISTBOX_VARIANTS> {\n children?: React.ReactNode;\n selectedKeys?: string | string[] | undefined;\n defaultSelectedKeys?: string | string[] | undefined;\n className?: string;\n}\n\nexport const listboxHelpers = {\n states: {\n selectedValue: {\n onChangeArgsToValue: (value: Set<Key> | string[] | string) => {\n // only single selection is supported\n return Array.from(value)[0];\n },\n },\n },\n};\n\nfunction normalizeSelectedKeys(selectedKeys: string | string[] | undefined) {\n // Listbox expects it to be of type \"all\" | Iterable\n return typeof selectedKeys === \"string\" && selectedKeys !== \"all\"\n ? [selectedKeys]\n : selectedKeys;\n}\n\nexport function BaseListBox(props: BaseListBoxProps) {\n const {\n setControlContextData: setControlContextData,\n children,\n selectedKeys,\n defaultSelectedKeys,\n plasmicUpdateVariant,\n ...rest\n } = props;\n const context = React.useContext(PlasmicListBoxContext);\n const isStandalone = !context;\n const [ids, setIds] = useState<string[]>([]);\n const inEditor = usePlasmicCanvasContext();\n\n const idManager = useIdManager(setIds, context?.idManager);\n\n const mergedProps = mergeProps(rest, {\n onFocusChange: (focused: boolean) => {\n plasmicUpdateVariant?.({ focused });\n },\n // `shouldUseVirtualFocus` is not part of the ListBox prop types, but it's passed through to useListBox, which does support it.\n // In editor, we use virtual focus to prevent the listbox from stealing focus\n ...(inEditor ? { shouldUseVirtualFocus: true } : {}),\n style: COMMON_STYLES,\n selectedKeys: normalizeSelectedKeys(selectedKeys),\n defaultSelectedKeys: normalizeSelectedKeys(defaultSelectedKeys),\n });\n\n useEffect(() => {\n setControlContextData?.({\n itemIds: ids,\n isStandalone,\n });\n }, [ids, isStandalone, setControlContextData]);\n\n const listbox = <ListBox {...mergedProps}>{children}</ListBox>;\n\n if (isStandalone) {\n return (\n <PlasmicListBoxContext.Provider\n value={{\n idManager,\n }}\n >\n {listbox}\n </PlasmicListBoxContext.Provider>\n );\n }\n\n return listbox;\n}\n\nexport const LIST_BOX_COMPONENT_NAME = makeComponentName(\"listbox\");\n\nexport function registerListBox(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBox>\n) {\n const listBoxItemMeta = registerListBoxItem(loader, {\n parentComponentName: LIST_BOX_COMPONENT_NAME,\n });\n const sectionMeta = registerSection(loader, {\n parentComponentName: LIST_BOX_COMPONENT_NAME,\n props: {\n items: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"section-1-1\",\n textValue: \"Section1-Item 1\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 1\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"section-1-2\",\n textValue: \"Section1-Item 2\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 2\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"section-1-3\",\n textValue: \"Section1-Item 3\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 3\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n ],\n },\n },\n });\n\n registerComponentHelper(\n loader,\n BaseListBox,\n {\n name: LIST_BOX_COMPONENT_NAME,\n displayName: \"Aria ListBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBox\",\n importName: \"BaseListBox\",\n variants: LISTBOX_VARIANTS_DATA,\n defaultStyles: {\n width: \"250px\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n },\n props: {\n id: createIdProp(\"List Box\"),\n \"aria-label\": createAriaLabelProp(\"List Box\"),\n children: {\n type: \"slot\",\n displayName: \"List Items\",\n allowedComponents: [listBoxItemMeta.name, sectionMeta.name],\n allowRootWrapper: true,\n defaultValue: [\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"1\",\n textValue: \"Item 1\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 1\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"2\",\n textValue: \"Item 2\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 2\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"3\",\n textValue: \"Item 3\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 3\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n {\n type: \"component\",\n name: sectionMeta.name,\n },\n ],\n },\n selectionMode: {\n type: \"choice\",\n description: \"The selection mode of the listbox\",\n options: [\"none\", \"single\"],\n defaultValue: \"none\",\n hidden: (_props, ctx) => !ctx?.isStandalone,\n },\n selectedKeys: {\n type: \"choice\",\n editOnly: true,\n uncontrolledProp: \"defaultSelectedKeys\",\n displayName: \"Initial selected item\",\n options: (_props, ctx) =>\n ctx?.itemIds ? Array.from(ctx.itemIds) : [],\n hidden: (props, ctx) =>\n !ctx?.isStandalone || props.selectionMode === \"none\",\n // We do not support multiple selections yet (Because React Aria select and combobox only support single selections).\n multiSelect: false,\n },\n onSelectionChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"selectedValues\", type: \"object\" }],\n },\n },\n states: {\n selectedValue: {\n type: \"writable\",\n valueProp: \"selectedKeys\",\n hidden: (props, ctx) =>\n !ctx?.isStandalone || props.selectionMode === \"none\",\n onChangeProp: \"onSelectionChange\",\n variableType: \"text\",\n ...listboxHelpers.states.selectedValue,\n },\n },\n componentHelpers: {\n helpers: listboxHelpers,\n importName: \"listboxHelpers\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBox\",\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["__objRest","__spreadProps","__spreadValues"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBO,SAAS,YAAY,KAAyB,EAAA;AACnD,EAAmC,MAAA,EAAA,GAAA,KAAA,EAA3B,UAAQ,KAnBlB,EAAA,GAmBqC,IAAT,IAAS,GAAAA,WAAA,CAAA,EAAA,EAAT,CAAlB,QAAQ,EAAA,OAAA,CAAA,CAAA,CAAA;AAChB,EAAM,MAAA,YAAA,GAAe,KAAM,CAAA,UAAA,CAAW,qBAAqB,CAAA,CAAA;AAC3D,EAAA,MAAM,eAAe,CAAC,YAAA,CAAA;AAEtB,EAAM,MAAA,OAAA,mB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EhD,WAAa,EAAA,KAAA;AAAA,SACf;AAAA,QACA,iBAAmB,EAAA;AAAA,UACjB,IAAM,EAAA,cAAA;AAAA,UACN,UAAU,CAAC,EAAE,MAAM,gBAAkB,EAAA,IAAA,EAAM,UAAU,CAAA;AAAA,SACvD;AAAA,OACF;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,aAAe,EAAA,cAAA,CAAA;AAAA,UACb,IAAM,EAAA,UAAA;AAAA,UACN,SAAW,EAAA,cAAA;AAAA,UACX,MAAA,EAAQ,CAAC,KAAO,EAAA,GAAA,KACd,EAAC,GAAK,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,GAAA,CAAA,YAAA,CAAA,IAAgB,MAAM,aAAkB,KAAA,MAAA;AAAA,UAChD,YAAc,EAAA,mBAAA;AAAA,UACd,YAAc,EAAA,MAAA;AAAA,SAAA,EACX,eAAe,MAAO,CAAA,aAAA,CAAA;AAAA,OAE7B;AAAA,MACA,gBAAkB,EAAA;AAAA,QAChB,OAAS,EAAA,cAAA;AAAA,QACT,UAAY,EAAA,gBAAA;AAAA,QACZ,UAAY,EAAA,gDAAA;AAAA,OACd;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
require('@plasmicapp/host');
|
|
4
4
|
require('react');
|
|
5
|
+
require('react-aria');
|
|
5
6
|
require('react-aria-components');
|
|
7
|
+
require('./OptionsItemIdManager-cb3a2c53.cjs.js');
|
|
6
8
|
require('./common-7f948fa5.cjs.js');
|
|
7
9
|
require('./contexts-6d0cb2b1.cjs.js');
|
|
8
|
-
require('./OptionsItemIdManager-cb3a2c53.cjs.js');
|
|
9
10
|
require('./registerListBoxItem.cjs.js');
|
|
10
|
-
var registerSection = require('./registerListBox-
|
|
11
|
-
require('./variant-utils-
|
|
11
|
+
var registerSection = require('./registerListBox-28474381.cjs.js');
|
|
12
|
+
require('./variant-utils-1c84aebb.cjs.js');
|
|
12
13
|
require('@plasmicapp/host/registerComponent');
|
|
13
14
|
require('./registerDescription.cjs.js');
|
|
14
15
|
require('./registerText.cjs.js');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerListBox.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registerListBox.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -5,7 +5,7 @@ import { WithVariants } from "./variant-utils";
|
|
|
5
5
|
export interface BaseListBoxControlContextData extends BaseControlContextDataForLists {
|
|
6
6
|
isStandalone: boolean;
|
|
7
7
|
}
|
|
8
|
-
declare const LISTBOX_VARIANTS:
|
|
8
|
+
declare const LISTBOX_VARIANTS: "focused"[];
|
|
9
9
|
export interface BaseListBoxProps extends Omit<React.ComponentProps<typeof ListBox>, "selectedKeys" | "defaultSelectedKeys" | "className">, HasControlContextData<BaseListBoxControlContextData>, WithVariants<typeof LISTBOX_VARIANTS> {
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
selectedKeys?: string | string[] | undefined;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import '@plasmicapp/host';
|
|
2
2
|
import 'react';
|
|
3
|
+
import 'react-aria';
|
|
3
4
|
import 'react-aria-components';
|
|
5
|
+
import './OptionsItemIdManager-0ce90944.esm.js';
|
|
4
6
|
import './common-81f08e86.esm.js';
|
|
5
7
|
import './contexts-5cb81c2f.esm.js';
|
|
6
|
-
import './OptionsItemIdManager-0ce90944.esm.js';
|
|
7
8
|
import './registerListBoxItem.esm.js';
|
|
8
|
-
export { a as BaseListBox, L as LIST_BOX_COMPONENT_NAME, l as listboxHelpers, b as registerListBox } from './registerListBox-
|
|
9
|
-
import './variant-utils-
|
|
9
|
+
export { a as BaseListBox, L as LIST_BOX_COMPONENT_NAME, l as listboxHelpers, b as registerListBox } from './registerListBox-7197abae.esm.js';
|
|
10
|
+
import './variant-utils-5f356d53.esm.js';
|
|
10
11
|
import '@plasmicapp/host/registerComponent';
|
|
11
12
|
import './registerDescription.esm.js';
|
|
12
13
|
import './registerText.esm.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerListBox.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registerListBox.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var reactAriaComponents = require('react-aria-components');
|
|
5
|
+
var OptionsItemIdManager = require('./OptionsItemIdManager-cb3a2c53.cjs.js');
|
|
5
6
|
var common = require('./common-7f948fa5.cjs.js');
|
|
6
7
|
var contexts = require('./contexts-6d0cb2b1.cjs.js');
|
|
7
|
-
var OptionsItemIdManager = require('./OptionsItemIdManager-cb3a2c53.cjs.js');
|
|
8
8
|
var registerDescription = require('./registerDescription.cjs.js');
|
|
9
9
|
var registerText = require('./registerText.cjs.js');
|
|
10
|
-
var variantUtils = require('./variant-utils-
|
|
10
|
+
var variantUtils = require('./variant-utils-1c84aebb.cjs.js');
|
|
11
11
|
require('@plasmicapp/host');
|
|
12
12
|
require('@plasmicapp/host/registerComponent');
|
|
13
13
|
|
|
@@ -54,14 +54,15 @@ const LIST_BOX_ITEM_VARIANTS = [
|
|
|
54
54
|
"selected",
|
|
55
55
|
"disabled"
|
|
56
56
|
];
|
|
57
|
-
const { variants
|
|
58
|
-
LIST_BOX_ITEM_VARIANTS
|
|
59
|
-
);
|
|
57
|
+
const { variants } = variantUtils.pickAriaComponentVariants(LIST_BOX_ITEM_VARIANTS);
|
|
60
58
|
function BaseListBoxItem(props) {
|
|
61
59
|
const _a = props, { children, setControlContextData, plasmicUpdateVariant, id } = _a, rest = __objRest(_a, ["children", "setControlContextData", "plasmicUpdateVariant", "id"]);
|
|
62
60
|
const listboxContext = React__default.default.useContext(contexts.PlasmicListBoxContext);
|
|
63
61
|
const isStandalone = !listboxContext;
|
|
64
|
-
const { registeredId, idError } = OptionsItemIdManager.useOptionsItemId(
|
|
62
|
+
const { registeredId, idError } = OptionsItemIdManager.useOptionsItemId(
|
|
63
|
+
id,
|
|
64
|
+
listboxContext == null ? void 0 : listboxContext.idManager
|
|
65
|
+
);
|
|
65
66
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
66
67
|
idError
|
|
67
68
|
});
|
|
@@ -80,18 +81,20 @@ function BaseListBoxItem(props) {
|
|
|
80
81
|
isFocusVisible,
|
|
81
82
|
isSelected,
|
|
82
83
|
isDisabled
|
|
83
|
-
}) =>
|
|
84
|
-
|
|
84
|
+
}) => /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement(
|
|
85
|
+
variantUtils.VariantUpdater,
|
|
85
86
|
{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
changes: {
|
|
88
|
+
hovered: isHovered,
|
|
89
|
+
pressed: isPressed,
|
|
90
|
+
focused: isFocused,
|
|
91
|
+
focusVisible: isFocusVisible,
|
|
92
|
+
selected: isSelected,
|
|
93
|
+
disabled: isDisabled
|
|
94
|
+
},
|
|
95
|
+
updateVariant: plasmicUpdateVariant
|
|
96
|
+
}
|
|
97
|
+
), children)
|
|
95
98
|
);
|
|
96
99
|
if (isStandalone) {
|
|
97
100
|
return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.ListBox, { selectionMode: "single" }, listboxItem);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerListBoxItem.cjs.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport { ListBox, ListBoxItem } from \"react-aria-components\";\nimport {
|
|
1
|
+
{"version":3,"file":"registerListBoxItem.cjs.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport { ListBox, ListBoxItem } from \"react-aria-components\";\nimport { useOptionsItemId } from \"./OptionsItemIdManager\";\nimport { COMMON_STYLES } from \"./common\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport { DESCRIPTION_COMPONENT_NAME } from \"./registerDescription\";\nimport { TEXT_COMPONENT_NAME } from \"./registerText\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n Registerable,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\nimport {\n VariantUpdater,\n WithVariants,\n pickAriaComponentVariants,\n} from \"./variant-utils\";\n\nconst LIST_BOX_ITEM_VARIANTS = [\n \"hovered\" as const,\n \"pressed\" as const,\n \"focused\" as const,\n \"focusVisible\" as const,\n \"selected\" as const,\n \"disabled\" as const,\n];\n\nconst { variants } = pickAriaComponentVariants(LIST_BOX_ITEM_VARIANTS);\n\nexport interface BaseListBoxControlContextData {\n idError?: string;\n}\n\nexport type BaseListBoxItemProps = Omit<\n React.ComponentProps<typeof ListBoxItem>,\n \"id\"\n> &\n HasControlContextData<BaseListBoxControlContextData> &\n WithVariants<typeof LIST_BOX_ITEM_VARIANTS> & {\n id?: string;\n children?: React.ReactNode;\n };\n\nexport function BaseListBoxItem(props: BaseListBoxItemProps) {\n const { children, setControlContextData, plasmicUpdateVariant, id, ...rest } =\n props;\n const listboxContext = React.useContext(PlasmicListBoxContext);\n const isStandalone = !listboxContext;\n /**\n * Ids of each listboxitem inside a listbox have to be unique. Otherwise, the items won't show up in the listbox.\n * This is particularly important to ensure, because the most common use case would be to apply Repeat Element to the listbox item.\n * The ids of each repeated item will initially be the same (until the user changes the id prop of the listboxitem).\n *\n * The registerId, therefore, is the unique id of the listboxitem.\n * It is the id registered with the listbox context, so that it can auto-generate a unique id if it identifies a duplicate.\n */\n const { registeredId, idError } = useOptionsItemId(\n id,\n listboxContext?.idManager\n );\n\n setControlContextData?.({\n idError,\n });\n\n const listboxItem = (\n <ListBoxItem\n key={registeredId}\n id={registeredId}\n {...rest}\n style={COMMON_STYLES}\n >\n {({\n isHovered,\n isPressed,\n isFocused,\n isFocusVisible,\n isSelected,\n isDisabled,\n }) => (\n <>\n <VariantUpdater\n changes={{\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n selected: isSelected,\n disabled: isDisabled,\n }}\n updateVariant={plasmicUpdateVariant}\n />\n {children}\n </>\n )}\n </ListBoxItem>\n );\n\n if (isStandalone) {\n // selection mode needs to be single/multiple to be able to trigger hover state on it.\n return <ListBox selectionMode=\"single\">{listboxItem}</ListBox>;\n }\n\n return listboxItem;\n}\n\nexport const makeDefaultListBoxItemChildren = (\n label: string,\n description?: string\n): PlasmicElement => ({\n type: \"vbox\",\n styles: {\n display: \"flex\",\n alignItems: \"flex-start\",\n gap: \"2px\",\n },\n children: [\n {\n type: \"component\",\n name: TEXT_COMPONENT_NAME,\n props: {\n slot: \"label\",\n children: {\n type: \"text\",\n styles: {\n fontWeight: 500,\n },\n value: label,\n },\n },\n },\n {\n type: \"component\",\n name: DESCRIPTION_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n styles: {\n color: \"#838383\",\n },\n value: description ?? `Some description for ${label}...`,\n },\n },\n },\n ],\n});\n\nexport function registerListBoxItem(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBoxItem>\n) {\n return registerComponentHelper(\n loader,\n BaseListBoxItem,\n {\n name: makeComponentName(\"item\"),\n displayName: \"Aria ListBoxItem\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBoxItem\",\n importName: \"BaseListBoxItem\",\n variants,\n props: {\n id: {\n type: \"string\",\n description: \"A unique value for tracking the selected item in state\",\n required: true,\n displayName: \"Value\",\n validator: (_value, _props, ctx) => {\n if (ctx?.idError) {\n return ctx.idError;\n }\n return true;\n },\n },\n textValue: {\n type: \"string\",\n displayName: \"Label\",\n description:\n \"A user-friendly text representation of the item's contents, used for features like typeahead.\",\n },\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: makeDefaultListBoxItemChildren(\"Item\"),\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["pickAriaComponentVariants","React","PlasmicListBoxContext","useOptionsItemId","ListBoxItem","COMMON_STYLES","VariantUpdater","ListBox","TEXT_COMPONENT_NAME","DESCRIPTION_COMPONENT_NAME","registerComponentHelper","makeComponentName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,sBAAyB,GAAA;AAAA,EAC7B,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAA,EAAa,GAAAA,sCAAA,CAA0B,sBAAsB,CAAA,CAAA;AAgB9D,SAAS,gBAAgB,KAA6B,EAAA;AAC3D,EAAA,MACE,EADM,GAAA,KAAA,EAAA,EAAA,QAAA,EAAU,qBAAuB,EAAA,oBAAA,EAAsB,EA/CjE,EAAA,GAgDI,EADoE,EAAA,IAAA,GAAA,SAAA,CACpE,EADoE,EAAA,CAA9D,UAAU,EAAA,uBAAA,EAAuB,sBAAsB,EAAA,IAAA,CAAA,CAAA,CAAA;AAE/D,EAAM,MAAA,cAAA,GAAiBC,sBAAM,CAAA,UAAA,CAAWC,8BAAqB,CAAA,CAAA;AAC7D,EAAA,MAAM,eAAe,CAAC,cAAA,CAAA;AAStB,EAAM,MAAA,EAAE,YAAc,EAAA,OAAA,EAAY,GAAAC,qCAAA;AAAA,IAChC,EAAA;AAAA,IACA,cAAgB,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,cAAA,CAAA,SAAA;AAAA,GAClB,CAAA;AAEA,EAAwB,qBAAA,IAAA,IAAA,GAAA,KAAA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AAS,EAAA;AAChB,cAAA,OAAO,GAAI,CAAA,OAAA,CAAA;AAAA,aACb;AACA,YAAO,OAAA,IAAA,CAAA;AAAA,WACT;AAAA,SACF;AAAA,QACA,SAAW,EAAA;AAAA,UACT,IAAM,EAAA,QAAA;AAAA,UACN,WAAa,EAAA,OAAA;AAAA,UACb,WACE,EAAA,+FAAA;AAAA,SACJ;AAAA,QACA,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,MAAA;AAAA,UACN,eAAiB,EAAA,IAAA;AAAA,UACjB,YAAA,EAAc,+BAA+B,MAAM,CAAA;AAAA,SACrD;AAAA,OACF;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ListBoxItem, ListBox } from 'react-aria-components';
|
|
3
|
+
import { a as useOptionsItemId } from './OptionsItemIdManager-0ce90944.esm.js';
|
|
3
4
|
import { r as registerComponentHelper, C as COMMON_STYLES, m as makeComponentName } from './common-81f08e86.esm.js';
|
|
4
5
|
import { b as PlasmicListBoxContext } from './contexts-5cb81c2f.esm.js';
|
|
5
|
-
import { a as useOptionsItemId } from './OptionsItemIdManager-0ce90944.esm.js';
|
|
6
6
|
import { DESCRIPTION_COMPONENT_NAME } from './registerDescription.esm.js';
|
|
7
7
|
import { TEXT_COMPONENT_NAME } from './registerText.esm.js';
|
|
8
|
-
import { p as pickAriaComponentVariants } from './variant-utils-
|
|
8
|
+
import { p as pickAriaComponentVariants, V as VariantUpdater } from './variant-utils-5f356d53.esm.js';
|
|
9
9
|
import '@plasmicapp/host';
|
|
10
10
|
import '@plasmicapp/host/registerComponent';
|
|
11
11
|
|
|
@@ -48,14 +48,15 @@ const LIST_BOX_ITEM_VARIANTS = [
|
|
|
48
48
|
"selected",
|
|
49
49
|
"disabled"
|
|
50
50
|
];
|
|
51
|
-
const { variants
|
|
52
|
-
LIST_BOX_ITEM_VARIANTS
|
|
53
|
-
);
|
|
51
|
+
const { variants } = pickAriaComponentVariants(LIST_BOX_ITEM_VARIANTS);
|
|
54
52
|
function BaseListBoxItem(props) {
|
|
55
53
|
const _a = props, { children, setControlContextData, plasmicUpdateVariant, id } = _a, rest = __objRest(_a, ["children", "setControlContextData", "plasmicUpdateVariant", "id"]);
|
|
56
54
|
const listboxContext = React.useContext(PlasmicListBoxContext);
|
|
57
55
|
const isStandalone = !listboxContext;
|
|
58
|
-
const { registeredId, idError } = useOptionsItemId(
|
|
56
|
+
const { registeredId, idError } = useOptionsItemId(
|
|
57
|
+
id,
|
|
58
|
+
listboxContext == null ? void 0 : listboxContext.idManager
|
|
59
|
+
);
|
|
59
60
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
60
61
|
idError
|
|
61
62
|
});
|
|
@@ -74,18 +75,20 @@ function BaseListBoxItem(props) {
|
|
|
74
75
|
isFocusVisible,
|
|
75
76
|
isSelected,
|
|
76
77
|
isDisabled
|
|
77
|
-
}) =>
|
|
78
|
-
|
|
78
|
+
}) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
79
|
+
VariantUpdater,
|
|
79
80
|
{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
changes: {
|
|
82
|
+
hovered: isHovered,
|
|
83
|
+
pressed: isPressed,
|
|
84
|
+
focused: isFocused,
|
|
85
|
+
focusVisible: isFocusVisible,
|
|
86
|
+
selected: isSelected,
|
|
87
|
+
disabled: isDisabled
|
|
88
|
+
},
|
|
89
|
+
updateVariant: plasmicUpdateVariant
|
|
90
|
+
}
|
|
91
|
+
), children)
|
|
89
92
|
);
|
|
90
93
|
if (isStandalone) {
|
|
91
94
|
return /* @__PURE__ */ React.createElement(ListBox, { selectionMode: "single" }, listboxItem);
|