@plasmicpkgs/react-aria 0.0.27 → 0.0.28
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/contexts.d.ts +2 -7
- package/dist/option-utils.d.ts +4 -13
- package/dist/react-aria.esm.js +346 -379
- package/dist/react-aria.esm.js.map +1 -1
- package/dist/react-aria.js +345 -378
- package/dist/react-aria.js.map +1 -1
- package/dist/registerDialogTrigger.d.ts +10 -0
- package/dist/registerListBox.d.ts +7 -5
- package/dist/registerListBoxItem.d.ts +2 -4
- package/dist/registerPopover.d.ts +4 -2
- package/dist/registerSection.d.ts +1 -3
- package/dist/registerSelect.d.ts +1 -1
- package/package.json +3 -3
- package/skinny/contexts.d.ts +2 -7
- package/skinny/{interaction-variant-utils-80bf1cfd.cjs.js → interaction-variant-utils-0f05190f.cjs.js} +16 -2
- package/skinny/interaction-variant-utils-0f05190f.cjs.js.map +1 -0
- package/skinny/{interaction-variant-utils-608d984b.esm.js → interaction-variant-utils-909267e5.esm.js} +16 -2
- package/skinny/interaction-variant-utils-909267e5.esm.js.map +1 -0
- package/skinny/{option-utils-765a1782.esm.js → option-utils-4f037568.esm.js} +22 -22
- package/skinny/option-utils-4f037568.esm.js.map +1 -0
- package/skinny/{option-utils-0db61f6d.cjs.js → option-utils-5e4e85bd.cjs.js} +22 -22
- package/skinny/option-utils-5e4e85bd.cjs.js.map +1 -0
- package/skinny/option-utils.d.ts +4 -13
- package/skinny/registerButton.cjs.js +5 -1
- package/skinny/registerButton.cjs.js.map +1 -1
- package/skinny/registerButton.esm.js +5 -1
- package/skinny/registerButton.esm.js.map +1 -1
- package/skinny/registerCheckbox.cjs.js +1 -1
- package/skinny/registerCheckbox.esm.js +1 -1
- package/skinny/registerCheckboxGroup.cjs.js +1 -1
- package/skinny/registerCheckboxGroup.esm.js +1 -1
- package/skinny/registerComboBox.cjs.js +10 -18
- package/skinny/registerComboBox.cjs.js.map +1 -1
- package/skinny/registerComboBox.esm.js +10 -18
- package/skinny/registerComboBox.esm.js.map +1 -1
- package/skinny/registerDialogTrigger.cjs.js +88 -0
- package/skinny/registerDialogTrigger.cjs.js.map +1 -0
- package/skinny/registerDialogTrigger.d.ts +10 -0
- package/skinny/registerDialogTrigger.esm.js +81 -0
- package/skinny/registerDialogTrigger.esm.js.map +1 -0
- package/skinny/registerInput.cjs.js +1 -1
- package/skinny/registerInput.esm.js +1 -1
- package/skinny/registerListBox.cjs.js +29 -73
- package/skinny/registerListBox.cjs.js.map +1 -1
- package/skinny/registerListBox.d.ts +7 -5
- package/skinny/registerListBox.esm.js +29 -73
- package/skinny/registerListBox.esm.js.map +1 -1
- package/skinny/registerListBoxItem.cjs.js +3 -19
- package/skinny/registerListBoxItem.cjs.js.map +1 -1
- package/skinny/registerListBoxItem.d.ts +2 -4
- package/skinny/registerListBoxItem.esm.js +3 -19
- package/skinny/registerListBoxItem.esm.js.map +1 -1
- package/skinny/registerPopover.cjs.js +7 -32
- package/skinny/registerPopover.cjs.js.map +1 -1
- package/skinny/registerPopover.d.ts +4 -2
- package/skinny/registerPopover.esm.js +7 -32
- package/skinny/registerPopover.esm.js.map +1 -1
- package/skinny/registerRadio.cjs.js +1 -1
- package/skinny/registerRadio.esm.js +1 -1
- package/skinny/registerRadioGroup.cjs.js +1 -1
- package/skinny/registerRadioGroup.esm.js +1 -1
- package/skinny/registerSection.cjs.js +4 -33
- package/skinny/registerSection.cjs.js.map +1 -1
- package/skinny/registerSection.d.ts +1 -3
- package/skinny/registerSection.esm.js +4 -33
- package/skinny/registerSection.esm.js.map +1 -1
- package/skinny/registerSelect.cjs.js +4 -15
- package/skinny/registerSelect.cjs.js.map +1 -1
- package/skinny/registerSelect.d.ts +1 -1
- package/skinny/registerSelect.esm.js +4 -15
- package/skinny/registerSelect.esm.js.map +1 -1
- package/skinny/registerSwitch.cjs.js +1 -1
- package/skinny/registerSwitch.esm.js +1 -1
- package/skinny/registerTextArea.cjs.js +1 -1
- package/skinny/registerTextArea.esm.js +1 -1
- package/skinny/registerTextField.cjs.js +1 -1
- package/skinny/registerTextField.esm.js +1 -1
- package/skinny/registerTooltip.cjs.js +13 -6
- package/skinny/registerTooltip.cjs.js.map +1 -1
- package/skinny/registerTooltip.esm.js +13 -6
- package/skinny/registerTooltip.esm.js.map +1 -1
- package/skinny/interaction-variant-utils-608d984b.esm.js.map +0 -1
- package/skinny/interaction-variant-utils-80bf1cfd.cjs.js.map +0 -1
- package/skinny/option-utils-0db61f6d.cjs.js.map +0 -1
- package/skinny/option-utils-765a1782.esm.js.map +0 -1
|
@@ -4,6 +4,7 @@ var utils = require('@react-aria/utils');
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var reactAriaComponents = require('react-aria-components');
|
|
6
6
|
var contexts = require('./contexts-3e42cdf9.cjs.js');
|
|
7
|
+
var optionUtils = require('./option-utils-5e4e85bd.cjs.js');
|
|
7
8
|
var registerListBoxItem = require('./registerListBoxItem.cjs.js');
|
|
8
9
|
var utils$1 = require('./utils-18b2465b.cjs.js');
|
|
9
10
|
require('@plasmicapp/host/registerComponent');
|
|
@@ -43,71 +44,36 @@ var __objRest = (source, exclude) => {
|
|
|
43
44
|
}
|
|
44
45
|
return target;
|
|
45
46
|
};
|
|
46
|
-
const STANDALONE_PROPS = {
|
|
47
|
-
getItemType: (item) => item.type,
|
|
48
|
-
items: [
|
|
49
|
-
{ type: "item", value: "op1", label: "Option 1" },
|
|
50
|
-
{ type: "item", value: "op2", label: "Option 2" },
|
|
51
|
-
{ type: "item", value: "op3", label: "Option 3" },
|
|
52
|
-
{
|
|
53
|
-
type: "section",
|
|
54
|
-
label: "Section 1",
|
|
55
|
-
items: [
|
|
56
|
-
{ type: "item", value: "s1op1", label: "Section 1 Option 1" },
|
|
57
|
-
{ type: "item", value: "s1op2", label: "Section 1 Option 2" },
|
|
58
|
-
{ type: "item", value: "s1op3", label: "Section 1 Option 3" }
|
|
59
|
-
]
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
type: "section",
|
|
63
|
-
label: "Section 2",
|
|
64
|
-
items: [
|
|
65
|
-
{ type: "item", value: "s2op1", label: "Section 2 Option 1" },
|
|
66
|
-
{ type: "item", value: "s2op2", label: "Section 2 Option 2" },
|
|
67
|
-
{ type: "item", value: "s2op3", label: "Section 2 Option 3" }
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
],
|
|
71
|
-
makeItemProps: (item) => ({
|
|
72
|
-
key: item.value,
|
|
73
|
-
textValue: item.label,
|
|
74
|
-
children: item.label
|
|
75
|
-
}),
|
|
76
|
-
makeSectionProps: (section) => ({
|
|
77
|
-
section,
|
|
78
|
-
key: section.label
|
|
79
|
-
})
|
|
80
|
-
};
|
|
81
47
|
function BaseListBox(props) {
|
|
48
|
+
var _c;
|
|
82
49
|
const contextProps = React__default.default.useContext(contexts.PlasmicListBoxContext);
|
|
83
50
|
const isStandalone = !contextProps;
|
|
84
|
-
const _a =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
} =
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if ((getItemType == null ? void 0 : getItemType(item)) === "section") {
|
|
99
|
-
const sectionProps = makeSectionProps == null ? void 0 : makeSectionProps(item);
|
|
100
|
-
return /* @__PURE__ */ React__default.default.createElement(
|
|
51
|
+
const _a = props, rest = __objRest(_a, ["options"]);
|
|
52
|
+
const { options } = optionUtils.useStrictOptions(props);
|
|
53
|
+
const _b = utils.mergeProps(
|
|
54
|
+
contextProps,
|
|
55
|
+
rest,
|
|
56
|
+
isStandalone ? { items: options } : {}
|
|
57
|
+
), { renderItem, renderSection } = _b, mergedProps = __objRest(_b, ["renderItem", "renderSection"]);
|
|
58
|
+
(_c = props.setControlContextData) == null ? void 0 : _c.call(props, {
|
|
59
|
+
isStandalone
|
|
60
|
+
});
|
|
61
|
+
return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.ListBox, __spreadValues({}, mergedProps), (item) => {
|
|
62
|
+
var _a2;
|
|
63
|
+
if (item.type === "option-group") {
|
|
64
|
+
return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement(
|
|
101
65
|
contexts.PlasmicSectionContext.Provider,
|
|
102
66
|
{
|
|
103
|
-
|
|
104
|
-
|
|
67
|
+
value: {
|
|
68
|
+
renderItem,
|
|
69
|
+
key: (_a2 = item.key) != null ? _a2 : item.label,
|
|
70
|
+
section: item
|
|
71
|
+
}
|
|
105
72
|
},
|
|
106
73
|
renderSection == null ? void 0 : renderSection(item)
|
|
107
|
-
);
|
|
74
|
+
));
|
|
108
75
|
} else {
|
|
109
|
-
|
|
110
|
-
return /* @__PURE__ */ React__default.default.createElement(contexts.PlasmicItemContext.Provider, { key: itemProps == null ? void 0 : itemProps.key, value: itemProps }, renderItem == null ? void 0 : renderItem(item));
|
|
76
|
+
return /* @__PURE__ */ React__default.default.createElement(contexts.PlasmicItemContext.Provider, { value: item }, renderItem == null ? void 0 : renderItem(item));
|
|
111
77
|
}
|
|
112
78
|
});
|
|
113
79
|
}
|
|
@@ -121,29 +87,19 @@ function registerListBox(loader, overrides) {
|
|
|
121
87
|
importPath: "@plasmicpkgs/react-aria/skinny/registerListBox",
|
|
122
88
|
importName: "BaseListBox",
|
|
123
89
|
props: {
|
|
90
|
+
options: __spreadProps(__spreadValues({}, optionUtils.makeOptionsPropType()), {
|
|
91
|
+
displayName: "Items",
|
|
92
|
+
hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
|
|
93
|
+
}),
|
|
124
94
|
renderItem: {
|
|
125
95
|
type: "slot",
|
|
126
96
|
displayName: "Render Item",
|
|
127
|
-
renderPropParams: ["
|
|
97
|
+
renderPropParams: ["itemProps"]
|
|
128
98
|
},
|
|
129
99
|
renderSection: {
|
|
130
100
|
type: "slot",
|
|
131
101
|
displayName: "Render Section",
|
|
132
|
-
renderPropParams: ["
|
|
133
|
-
},
|
|
134
|
-
className: {
|
|
135
|
-
type: "class",
|
|
136
|
-
displayName: "Additional states",
|
|
137
|
-
selectors: [
|
|
138
|
-
{
|
|
139
|
-
selector: ":self[data-focused]",
|
|
140
|
-
label: "Focused"
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
selector: ":self[data-focus-visible]",
|
|
144
|
-
label: "Focused by keyboard"
|
|
145
|
-
}
|
|
146
|
-
]
|
|
102
|
+
renderPropParams: ["sectionProps"]
|
|
147
103
|
}
|
|
148
104
|
}
|
|
149
105
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerListBox.cjs.js","sources":["../src/registerListBox.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { ListBox } from \"react-aria-components\";\nimport {\n PlasmicItemContext,\n PlasmicListBoxContext,\n PlasmicSectionContext,\n} from \"./contexts\";\nimport {\n
|
|
1
|
+
{"version":3,"file":"registerListBox.cjs.js","sources":["../src/registerListBox.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { ListBox } from \"react-aria-components\";\nimport {\n PlasmicItemContext,\n PlasmicListBoxContext,\n PlasmicSectionContext,\n} from \"./contexts\";\nimport {\n HasOptions,\n makeOptionsPropType,\n StrictOptionType,\n useStrictOptions,\n} from \"./option-utils\";\nimport { registerListBoxItem } from \"./registerListBoxItem\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\ninterface BaseListBoxControlContextData {\n isStandalone: boolean;\n}\n\nexport interface BaseListBoxProps\n extends React.ComponentProps<typeof ListBox>,\n HasOptions<any> {\n renderItem?: (item: any) => React.ReactNode;\n renderSection?: (section: any) => React.ReactNode;\n getItemType?: (thing: any) => \"item\" | \"section\";\n setControlContextData?: (ctxData: BaseListBoxControlContextData) => void;\n}\n\nexport function BaseListBox(props: BaseListBoxProps) {\n const contextProps = React.useContext(PlasmicListBoxContext);\n const isStandalone: boolean = !contextProps;\n const { options: _rawOptions, ...rest } = props;\n const { options } = useStrictOptions(props);\n const { renderItem, renderSection, ...mergedProps } = mergeProps(\n contextProps,\n rest,\n isStandalone ? { items: options } : {}\n );\n\n // Tell the prop control about whether the listbox is standalone or not, so it can hide/show the items prop\n props.setControlContextData?.({\n isStandalone,\n });\n\n return (\n <ListBox {...mergedProps}>\n {(item: StrictOptionType) => {\n if (item.type === \"option-group\") {\n return (\n <>\n <PlasmicSectionContext.Provider\n value={{\n renderItem,\n key: item.key ?? item.label,\n section: item,\n }}\n >\n {renderSection?.(item)}\n </PlasmicSectionContext.Provider>\n </>\n );\n } else {\n return (\n <PlasmicItemContext.Provider value={item}>\n {renderItem?.(item)}\n </PlasmicItemContext.Provider>\n );\n }\n }}\n </ListBox>\n );\n}\n\nexport function registerListBox(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBox>\n) {\n registerComponentHelper(\n loader,\n BaseListBox,\n {\n name: makeComponentName(\"listbox\"),\n displayName: \"Aria ListBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBox\",\n importName: \"BaseListBox\",\n props: {\n options: {\n ...makeOptionsPropType(),\n displayName: \"Items\",\n hidden: (\n _ps: BaseListBoxProps,\n ctx: BaseListBoxControlContextData | null\n ) => !ctx?.isStandalone,\n },\n renderItem: {\n type: \"slot\",\n displayName: \"Render Item\",\n renderPropParams: [\"itemProps\"],\n },\n renderSection: {\n type: \"slot\",\n displayName: \"Render Section\",\n renderPropParams: [\"sectionProps\"],\n },\n },\n },\n overrides\n );\n\n registerListBoxItem(loader, {\n parentComponentName: makeComponentName(\"listbox\"),\n });\n}\n"],"names":["React","PlasmicListBoxContext","useStrictOptions","mergeProps","ListBox","_a","PlasmicSectionContext","PlasmicItemContext","registerComponentHelper","makeComponentName","makeOptionsPropType","registerListBoxItem"],"mappings":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AAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AAEA,EAAAC,uCAAA,CAAoB,MAAQ,EAAA;AAAA,IAC1B,mBAAA,EAAqBF,0BAAkB,SAAS,CAAA;AAAA,GACjD,CAAA,CAAA;AACH;;;;;"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ListBox } from "react-aria-components";
|
|
3
|
-
import {
|
|
4
|
-
import type { BaseSection } from "./registerSection";
|
|
3
|
+
import { HasOptions } from "./option-utils";
|
|
5
4
|
import { CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
interface BaseListBoxControlContextData {
|
|
6
|
+
isStandalone: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface BaseListBoxProps extends React.ComponentProps<typeof ListBox>, HasOptions<any> {
|
|
9
9
|
renderItem?: (item: any) => React.ReactNode;
|
|
10
10
|
renderSection?: (section: any) => React.ReactNode;
|
|
11
11
|
getItemType?: (thing: any) => "item" | "section";
|
|
12
|
+
setControlContextData?: (ctxData: BaseListBoxControlContextData) => void;
|
|
12
13
|
}
|
|
13
14
|
export declare function BaseListBox(props: BaseListBoxProps): React.JSX.Element;
|
|
14
15
|
export declare function registerListBox(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BaseListBox>): void;
|
|
16
|
+
export {};
|
|
@@ -2,6 +2,7 @@ import { mergeProps } from '@react-aria/utils';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ListBox } from 'react-aria-components';
|
|
4
4
|
import { P as PlasmicListBoxContext, b as PlasmicSectionContext, c as PlasmicItemContext } from './contexts-49f6c298.esm.js';
|
|
5
|
+
import { u as useStrictOptions, m as makeOptionsPropType } from './option-utils-4f037568.esm.js';
|
|
5
6
|
import { registerListBoxItem } from './registerListBoxItem.esm.js';
|
|
6
7
|
import { r as registerComponentHelper, m as makeComponentName } from './utils-cf2632c9.esm.js';
|
|
7
8
|
import '@plasmicapp/host/registerComponent';
|
|
@@ -37,71 +38,36 @@ var __objRest = (source, exclude) => {
|
|
|
37
38
|
}
|
|
38
39
|
return target;
|
|
39
40
|
};
|
|
40
|
-
const STANDALONE_PROPS = {
|
|
41
|
-
getItemType: (item) => item.type,
|
|
42
|
-
items: [
|
|
43
|
-
{ type: "item", value: "op1", label: "Option 1" },
|
|
44
|
-
{ type: "item", value: "op2", label: "Option 2" },
|
|
45
|
-
{ type: "item", value: "op3", label: "Option 3" },
|
|
46
|
-
{
|
|
47
|
-
type: "section",
|
|
48
|
-
label: "Section 1",
|
|
49
|
-
items: [
|
|
50
|
-
{ type: "item", value: "s1op1", label: "Section 1 Option 1" },
|
|
51
|
-
{ type: "item", value: "s1op2", label: "Section 1 Option 2" },
|
|
52
|
-
{ type: "item", value: "s1op3", label: "Section 1 Option 3" }
|
|
53
|
-
]
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
type: "section",
|
|
57
|
-
label: "Section 2",
|
|
58
|
-
items: [
|
|
59
|
-
{ type: "item", value: "s2op1", label: "Section 2 Option 1" },
|
|
60
|
-
{ type: "item", value: "s2op2", label: "Section 2 Option 2" },
|
|
61
|
-
{ type: "item", value: "s2op3", label: "Section 2 Option 3" }
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
makeItemProps: (item) => ({
|
|
66
|
-
key: item.value,
|
|
67
|
-
textValue: item.label,
|
|
68
|
-
children: item.label
|
|
69
|
-
}),
|
|
70
|
-
makeSectionProps: (section) => ({
|
|
71
|
-
section,
|
|
72
|
-
key: section.label
|
|
73
|
-
})
|
|
74
|
-
};
|
|
75
41
|
function BaseListBox(props) {
|
|
42
|
+
var _c;
|
|
76
43
|
const contextProps = React.useContext(PlasmicListBoxContext);
|
|
77
44
|
const isStandalone = !contextProps;
|
|
78
|
-
const _a =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
} =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if ((getItemType == null ? void 0 : getItemType(item)) === "section") {
|
|
93
|
-
const sectionProps = makeSectionProps == null ? void 0 : makeSectionProps(item);
|
|
94
|
-
return /* @__PURE__ */ React.createElement(
|
|
45
|
+
const _a = props, rest = __objRest(_a, ["options"]);
|
|
46
|
+
const { options } = useStrictOptions(props);
|
|
47
|
+
const _b = mergeProps(
|
|
48
|
+
contextProps,
|
|
49
|
+
rest,
|
|
50
|
+
isStandalone ? { items: options } : {}
|
|
51
|
+
), { renderItem, renderSection } = _b, mergedProps = __objRest(_b, ["renderItem", "renderSection"]);
|
|
52
|
+
(_c = props.setControlContextData) == null ? void 0 : _c.call(props, {
|
|
53
|
+
isStandalone
|
|
54
|
+
});
|
|
55
|
+
return /* @__PURE__ */ React.createElement(ListBox, __spreadValues({}, mergedProps), (item) => {
|
|
56
|
+
var _a2;
|
|
57
|
+
if (item.type === "option-group") {
|
|
58
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
95
59
|
PlasmicSectionContext.Provider,
|
|
96
60
|
{
|
|
97
|
-
|
|
98
|
-
|
|
61
|
+
value: {
|
|
62
|
+
renderItem,
|
|
63
|
+
key: (_a2 = item.key) != null ? _a2 : item.label,
|
|
64
|
+
section: item
|
|
65
|
+
}
|
|
99
66
|
},
|
|
100
67
|
renderSection == null ? void 0 : renderSection(item)
|
|
101
|
-
);
|
|
68
|
+
));
|
|
102
69
|
} else {
|
|
103
|
-
|
|
104
|
-
return /* @__PURE__ */ React.createElement(PlasmicItemContext.Provider, { key: itemProps == null ? void 0 : itemProps.key, value: itemProps }, renderItem == null ? void 0 : renderItem(item));
|
|
70
|
+
return /* @__PURE__ */ React.createElement(PlasmicItemContext.Provider, { value: item }, renderItem == null ? void 0 : renderItem(item));
|
|
105
71
|
}
|
|
106
72
|
});
|
|
107
73
|
}
|
|
@@ -115,29 +81,19 @@ function registerListBox(loader, overrides) {
|
|
|
115
81
|
importPath: "@plasmicpkgs/react-aria/skinny/registerListBox",
|
|
116
82
|
importName: "BaseListBox",
|
|
117
83
|
props: {
|
|
84
|
+
options: __spreadProps(__spreadValues({}, makeOptionsPropType()), {
|
|
85
|
+
displayName: "Items",
|
|
86
|
+
hidden: (_ps, ctx) => !(ctx == null ? void 0 : ctx.isStandalone)
|
|
87
|
+
}),
|
|
118
88
|
renderItem: {
|
|
119
89
|
type: "slot",
|
|
120
90
|
displayName: "Render Item",
|
|
121
|
-
renderPropParams: ["
|
|
91
|
+
renderPropParams: ["itemProps"]
|
|
122
92
|
},
|
|
123
93
|
renderSection: {
|
|
124
94
|
type: "slot",
|
|
125
95
|
displayName: "Render Section",
|
|
126
|
-
renderPropParams: ["
|
|
127
|
-
},
|
|
128
|
-
className: {
|
|
129
|
-
type: "class",
|
|
130
|
-
displayName: "Additional states",
|
|
131
|
-
selectors: [
|
|
132
|
-
{
|
|
133
|
-
selector: ":self[data-focused]",
|
|
134
|
-
label: "Focused"
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
selector: ":self[data-focus-visible]",
|
|
138
|
-
label: "Focused by keyboard"
|
|
139
|
-
}
|
|
140
|
-
]
|
|
96
|
+
renderPropParams: ["sectionProps"]
|
|
141
97
|
}
|
|
142
98
|
}
|
|
143
99
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerListBox.esm.js","sources":["../src/registerListBox.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { ListBox } from \"react-aria-components\";\nimport {\n PlasmicItemContext,\n PlasmicListBoxContext,\n PlasmicSectionContext,\n} from \"./contexts\";\nimport {\n
|
|
1
|
+
{"version":3,"file":"registerListBox.esm.js","sources":["../src/registerListBox.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { ListBox } from \"react-aria-components\";\nimport {\n PlasmicItemContext,\n PlasmicListBoxContext,\n PlasmicSectionContext,\n} from \"./contexts\";\nimport {\n HasOptions,\n makeOptionsPropType,\n StrictOptionType,\n useStrictOptions,\n} from \"./option-utils\";\nimport { registerListBoxItem } from \"./registerListBoxItem\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\ninterface BaseListBoxControlContextData {\n isStandalone: boolean;\n}\n\nexport interface BaseListBoxProps\n extends React.ComponentProps<typeof ListBox>,\n HasOptions<any> {\n renderItem?: (item: any) => React.ReactNode;\n renderSection?: (section: any) => React.ReactNode;\n getItemType?: (thing: any) => \"item\" | \"section\";\n setControlContextData?: (ctxData: BaseListBoxControlContextData) => void;\n}\n\nexport function BaseListBox(props: BaseListBoxProps) {\n const contextProps = React.useContext(PlasmicListBoxContext);\n const isStandalone: boolean = !contextProps;\n const { options: _rawOptions, ...rest } = props;\n const { options } = useStrictOptions(props);\n const { renderItem, renderSection, ...mergedProps } = mergeProps(\n contextProps,\n rest,\n isStandalone ? { items: options } : {}\n );\n\n // Tell the prop control about whether the listbox is standalone or not, so it can hide/show the items prop\n props.setControlContextData?.({\n isStandalone,\n });\n\n return (\n <ListBox {...mergedProps}>\n {(item: StrictOptionType) => {\n if (item.type === \"option-group\") {\n return (\n <>\n <PlasmicSectionContext.Provider\n value={{\n renderItem,\n key: item.key ?? item.label,\n section: item,\n }}\n >\n {renderSection?.(item)}\n </PlasmicSectionContext.Provider>\n </>\n );\n } else {\n return (\n <PlasmicItemContext.Provider value={item}>\n {renderItem?.(item)}\n </PlasmicItemContext.Provider>\n );\n }\n }}\n </ListBox>\n );\n}\n\nexport function registerListBox(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBox>\n) {\n registerComponentHelper(\n loader,\n BaseListBox,\n {\n name: makeComponentName(\"listbox\"),\n displayName: \"Aria ListBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBox\",\n importName: \"BaseListBox\",\n props: {\n options: {\n ...makeOptionsPropType(),\n displayName: \"Items\",\n hidden: (\n _ps: BaseListBoxProps,\n ctx: BaseListBoxControlContextData | null\n ) => !ctx?.isStandalone,\n },\n renderItem: {\n type: \"slot\",\n displayName: \"Render Item\",\n renderPropParams: [\"itemProps\"],\n },\n renderSection: {\n type: \"slot\",\n displayName: \"Render Section\",\n renderPropParams: [\"sectionProps\"],\n },\n },\n },\n overrides\n );\n\n registerListBoxItem(loader, {\n parentComponentName: makeComponentName(\"listbox\"),\n });\n}\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCO,SAAS,YAAY,KAAyB,EAAA;AAnCrD,EAAA,IAAA,EAAA,CAAA;AAoCE,EAAM,MAAA,YAAA,GAAe,KAAM,CAAA,UAAA,CAAW,qBAAqB,CAAA,CAAA;AAC3D,EAAA,MAAM,eAAwB,CAAC,YAAA,CAAA;AAC/B,EAAA,MAA0C,YAAT,IAAA,GAAA,SAAA,CAAS,IAAT,CAAzB,SAAA,CAAA,EAAA;AACR,EAAA,MAAM,EAAE,OAAA,EAAY,GAAA,gBAAA,CAAiB,KAAK,CAAA,CAAA;AAC1C,EAAsD,MAAA,EAAA,GAAA,UAAA;AAAA,IACpD,YAAA;AAAA,IACA,IAAA;AAAA,IACA,YAAe,GAAA,EAAE,KAAO,EAAA,OAAA,KAAY,EAAC;AAAA,GACvC,EAJQ,cAAY,aAxCtB,EAAA,GAwCwD,IAAhB,WAAgB,GAAA,SAAA,CAAA,EAAA,EAAhB,CAA9B,YAAY,EAAA,eAAA,CAAA,CAAA,CAAA;AAOpB,EAAA,CAAA,EAAA,GAAA,KAAA,CAAM,0BAAN,IAA8B,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,KAAA,EAAA;AAAA,IAC5B,YAAA;AAAA,GACF,CAAA,CAAA;AAEA,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,OAAA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AA,GAAA,GAAA,CAAA,YAAA,CAAA;AAAA,SACb,CAAA;AAAA,QACA,UAAY,EAAA;AAAA,UACV,IAAM,EAAA,MAAA;AAAA,UACN,WAAa,EAAA,aAAA;AAAA,UACb,gBAAA,EAAkB,CAAC,WAAW,CAAA;AAAA,SAChC;AAAA,QACA,aAAe,EAAA;AAAA,UACb,IAAM,EAAA,MAAA;AAAA,UACN,WAAa,EAAA,gBAAA;AAAA,UACb,gBAAA,EAAkB,CAAC,cAAc,CAAA;AAAA,SACnC;AAAA,OACF;AAAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AAEA,EAAA,mBAAA,CAAoB,MAAQ,EAAA;AAAA,IAC1B,mBAAA,EAAqB,kBAAkB,SAAS,CAAA;AAAA,GACjD,CAAA,CAAA;AACH;;;;"}
|
|
@@ -28,10 +28,9 @@ var __spreadValues = (a, b) => {
|
|
|
28
28
|
return a;
|
|
29
29
|
};
|
|
30
30
|
function BaseListBoxItem(props) {
|
|
31
|
-
var _a;
|
|
32
31
|
const contextProps = React__default.default.useContext(contexts.PlasmicItemContext);
|
|
33
32
|
const mergedProps = utils.mergeProps(contextProps, props);
|
|
34
|
-
return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.ListBoxItem, __spreadValues({
|
|
33
|
+
return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.ListBoxItem, __spreadValues({}, mergedProps), mergedProps.children);
|
|
35
34
|
}
|
|
36
35
|
function registerListBoxItem(loader, overrides) {
|
|
37
36
|
utils$1.registerComponentHelper(
|
|
@@ -43,23 +42,8 @@ function registerListBoxItem(loader, overrides) {
|
|
|
43
42
|
importPath: "@plasmicpkgs/react-aria/skinny/registerListBoxItem",
|
|
44
43
|
importName: "BaseListBoxItem",
|
|
45
44
|
props: {
|
|
46
|
-
|
|
47
|
-
type: "
|
|
48
|
-
displayName: "Additional states",
|
|
49
|
-
selectors: [
|
|
50
|
-
{
|
|
51
|
-
selector: ":self[data-selected]",
|
|
52
|
-
label: "Selected"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
selector: ":self[data-focused], :self[data-hovered]",
|
|
56
|
-
label: "Focused"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
selector: ":self[data-disabled]",
|
|
60
|
-
label: "Disabled"
|
|
61
|
-
}
|
|
62
|
-
]
|
|
45
|
+
children: {
|
|
46
|
+
type: "slot"
|
|
63
47
|
}
|
|
64
48
|
}
|
|
65
49
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerListBoxItem.cjs.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"registerListBoxItem.cjs.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { ListBoxItem } from \"react-aria-components\";\nimport { PlasmicItemContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport function BaseListBoxItem(\n props: React.ComponentProps<typeof ListBoxItem>\n) {\n const contextProps = React.useContext(PlasmicItemContext);\n const mergedProps = mergeProps(contextProps, props);\n return (\n <ListBoxItem {...mergedProps}>\n {mergedProps.children as React.ReactNode}\n </ListBoxItem>\n );\n}\n\nexport function registerListBoxItem(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBoxItem>\n) {\n 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 props: {\n children: {\n type: \"slot\",\n },\n },\n },\n overrides\n );\n}\n"],"names":["React","PlasmicItemContext","mergeProps","ListBoxItem","registerComponentHelper","makeComponentName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,SAAS,gBACd,KACA,EAAA;AACA,EAAM,MAAA,YAAA,GAAeA,sBAAM,CAAA,UAAA,CAAWC,2BAAkB,CAAA,CAAA;AACxD,EAAM,MAAA,WAAA,GAAcC,gBAAW,CAAA,YAAA,EAAc,KAAK,CAAA,CAAA;AAClD,EAAA,uBACGF,sBAAA,CAAA,aAAA,CAAAG,+BAAA,EAAA,cAAA,CAAA,EAAA,EAAgB,WACd,CAAA,EAAA,WAAA,CAAY,QACf,CAAA,CAAA;AAEJ,CAAA;AAEgB,SAAA,mBAAA,CACd,QACA,SACA,EAAA;AACA,EAAAC,+BAAA;AAAA,IACE,MAAA;AAAA,IACA,eAAA;AAAA,IACA;AAAA,MACE,IAAA,EAAMC,0BAAkB,MAAM,CAAA;AAAA,MAC9B,WAAa,EAAA,kBAAA;AAAA,MACb,UAAY,EAAA,oDAAA;AAAA,MACZ,UAAY,EAAA,iBAAA;AAAA,MACZ,KAAO,EAAA;AAAA,QACL,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,MAAA;AAAA,SACR;AAAA,OACF;AAAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { ListBoxItem } from "react-aria-components";
|
|
3
3
|
import { CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
4
|
-
export declare function BaseListBoxItem(props: React.ComponentProps<typeof ListBoxItem>
|
|
5
|
-
key?: Key;
|
|
6
|
-
}): React.JSX.Element;
|
|
4
|
+
export declare function BaseListBoxItem(props: React.ComponentProps<typeof ListBoxItem>): React.JSX.Element;
|
|
7
5
|
export declare function registerListBoxItem(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BaseListBoxItem>): void;
|
|
@@ -22,10 +22,9 @@ var __spreadValues = (a, b) => {
|
|
|
22
22
|
return a;
|
|
23
23
|
};
|
|
24
24
|
function BaseListBoxItem(props) {
|
|
25
|
-
var _a;
|
|
26
25
|
const contextProps = React.useContext(PlasmicItemContext);
|
|
27
26
|
const mergedProps = mergeProps(contextProps, props);
|
|
28
|
-
return /* @__PURE__ */ React.createElement(ListBoxItem, __spreadValues({
|
|
27
|
+
return /* @__PURE__ */ React.createElement(ListBoxItem, __spreadValues({}, mergedProps), mergedProps.children);
|
|
29
28
|
}
|
|
30
29
|
function registerListBoxItem(loader, overrides) {
|
|
31
30
|
registerComponentHelper(
|
|
@@ -37,23 +36,8 @@ function registerListBoxItem(loader, overrides) {
|
|
|
37
36
|
importPath: "@plasmicpkgs/react-aria/skinny/registerListBoxItem",
|
|
38
37
|
importName: "BaseListBoxItem",
|
|
39
38
|
props: {
|
|
40
|
-
|
|
41
|
-
type: "
|
|
42
|
-
displayName: "Additional states",
|
|
43
|
-
selectors: [
|
|
44
|
-
{
|
|
45
|
-
selector: ":self[data-selected]",
|
|
46
|
-
label: "Selected"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
selector: ":self[data-focused], :self[data-hovered]",
|
|
50
|
-
label: "Focused"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
selector: ":self[data-disabled]",
|
|
54
|
-
label: "Disabled"
|
|
55
|
-
}
|
|
56
|
-
]
|
|
39
|
+
children: {
|
|
40
|
+
type: "slot"
|
|
57
41
|
}
|
|
58
42
|
}
|
|
59
43
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerListBoxItem.esm.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"registerListBoxItem.esm.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { ListBoxItem } from \"react-aria-components\";\nimport { PlasmicItemContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport function BaseListBoxItem(\n props: React.ComponentProps<typeof ListBoxItem>\n) {\n const contextProps = React.useContext(PlasmicItemContext);\n const mergedProps = mergeProps(contextProps, props);\n return (\n <ListBoxItem {...mergedProps}>\n {mergedProps.children as React.ReactNode}\n </ListBoxItem>\n );\n}\n\nexport function registerListBoxItem(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBoxItem>\n) {\n 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 props: {\n children: {\n type: \"slot\",\n },\n },\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAWO,SAAS,gBACd,KACA,EAAA;AACA,EAAM,MAAA,YAAA,GAAe,KAAM,CAAA,UAAA,CAAW,kBAAkB,CAAA,CAAA;AACxD,EAAM,MAAA,WAAA,GAAc,UAAW,CAAA,YAAA,EAAc,KAAK,CAAA,CAAA;AAClD,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,cAAA,CAAA,EAAA,EAAgB,WACd,CAAA,EAAA,WAAA,CAAY,QACf,CAAA,CAAA;AAEJ,CAAA;AAEgB,SAAA,mBAAA,CACd,QACA,SACA,EAAA;AACA,EAAA,uBAAA;AAAA,IACE,MAAA;AAAA,IACA,eAAA;AAAA,IACA;AAAA,MACE,IAAA,EAAM,kBAAkB,MAAM,CAAA;AAAA,MAC9B,WAAa,EAAA,kBAAA;AAAA,MACb,UAAY,EAAA,oDAAA;AAAA,MACZ,UAAY,EAAA,iBAAA;AAAA,MACZ,KAAO,EAAA;AAAA,QACL,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,MAAA;AAAA,SACR;AAAA,OACF;AAAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var host = require('@plasmicapp/host');
|
|
4
3
|
var utils = require('@react-aria/utils');
|
|
5
4
|
var React = require('react');
|
|
6
5
|
var reactAriaComponents = require('react-aria-components');
|
|
@@ -13,8 +12,6 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
13
12
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
14
13
|
|
|
15
14
|
var __defProp = Object.defineProperty;
|
|
16
|
-
var __defProps = Object.defineProperties;
|
|
17
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
18
15
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
19
16
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
20
17
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -30,7 +27,6 @@ var __spreadValues = (a, b) => {
|
|
|
30
27
|
}
|
|
31
28
|
return a;
|
|
32
29
|
};
|
|
33
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
34
30
|
var __objRest = (source, exclude) => {
|
|
35
31
|
var target = {};
|
|
36
32
|
for (var prop in source)
|
|
@@ -47,23 +43,16 @@ function BasePopover(props) {
|
|
|
47
43
|
const _a = props, { resetClassName } = _a, restProps = __objRest(_a, ["resetClassName"]);
|
|
48
44
|
const isStandalone = !React__default.default.useContext(reactAriaComponents.PopoverContext);
|
|
49
45
|
const contextProps = React__default.default.useContext(contexts.PlasmicPopoverContext);
|
|
50
|
-
const canvas = host.usePlasmicCanvasContext();
|
|
51
46
|
const mergedProps = utils.mergeProps(contextProps, restProps, {
|
|
52
47
|
className: `${resetClassName}`
|
|
53
48
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
isOpen: true
|
|
62
|
-
})
|
|
63
|
-
));
|
|
64
|
-
} else {
|
|
65
|
-
return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Popover, __spreadProps(__spreadValues({}, mergedProps), { isNonModal: !!canvas }));
|
|
66
|
-
}
|
|
49
|
+
const triggerRef = React__default.default.useRef(null);
|
|
50
|
+
const standaloneProps = isStandalone ? {
|
|
51
|
+
triggerRef,
|
|
52
|
+
isNonModal: true,
|
|
53
|
+
isOpen: true
|
|
54
|
+
} : {};
|
|
55
|
+
return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, isStandalone && /* @__PURE__ */ React__default.default.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Popover, __spreadValues(__spreadValues({}, mergedProps), standaloneProps)));
|
|
67
56
|
}
|
|
68
57
|
function registerPopover(loader, overrides) {
|
|
69
58
|
utils$1.registerComponentHelper(
|
|
@@ -99,20 +88,6 @@ function registerPopover(loader, overrides) {
|
|
|
99
88
|
resetClassName: {
|
|
100
89
|
type: "themeResetClass"
|
|
101
90
|
}
|
|
102
|
-
// className: {
|
|
103
|
-
// type: "class",
|
|
104
|
-
// displayName: "Additional states",
|
|
105
|
-
// selectors: [
|
|
106
|
-
// {
|
|
107
|
-
// selector: ":self[data-entering]",
|
|
108
|
-
// label: "Entering",
|
|
109
|
-
// },
|
|
110
|
-
// {
|
|
111
|
-
// selector: ":self[data-exiting]",
|
|
112
|
-
// label: "Exiting",
|
|
113
|
-
// },
|
|
114
|
-
// ],
|
|
115
|
-
// },
|
|
116
91
|
},
|
|
117
92
|
styleSections: true
|
|
118
93
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerPopover.cjs.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"registerPopover.cjs.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Popover, PopoverContext } from \"react-aria-components\";\nimport { PlasmicPopoverContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BasePopoverProps extends React.ComponentProps<typeof Popover> {\n className?: string;\n resetClassName?: string;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const { resetClassName, ...restProps } = props;\n const isStandalone = !React.useContext(PopoverContext);\n const contextProps = React.useContext(PlasmicPopoverContext);\n const mergedProps = mergeProps(contextProps, restProps, {\n className: `${resetClassName}`,\n });\n\n const triggerRef = React.useRef<any>(null);\n\n const standaloneProps = isStandalone\n ? {\n triggerRef,\n isNonModal: true,\n isOpen: true,\n }\n : {};\n\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover {...mergedProps} {...standaloneProps} />\n </>\n );\n}\n\nexport function registerPopover(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BasePopover>\n) {\n registerComponentHelper(\n loader,\n BasePopover,\n {\n name: \"plasmic-react-aria-popover\",\n displayName: \"Aria Popover\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerPopover\",\n importName: \"BasePopover\",\n props: {\n children: {\n type: \"slot\",\n },\n offset: {\n type: \"number\",\n displayName: \"Offset\",\n description:\n \"Additional offset applied vertically between the popover and its trigger\",\n defaultValueHint: 0,\n },\n placement: {\n type: \"choice\",\n description:\n \"Default placement of the popover relative to the trigger, if there is enough space\",\n options: [\n \"bottom\",\n \"bottom left\",\n \"bottom right\",\n \"top\",\n \"top left\",\n \"top right\",\n ],\n },\n resetClassName: {\n type: \"themeResetClass\",\n },\n },\n styleSections: true,\n },\n overrides\n );\n}\n"],"names":["React","PopoverContext","PlasmicPopoverContext","mergeProps","Popover","registerComponentHelper"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeO,SAAS,YAAY,KAAyB,EAAA;AACnD,EAAA,MAAyC,YAAjC,EAhBV,cAAA,EAAA,GAgB2C,EAAd,EAAA,SAAA,GAAA,SAAA,CAAc,IAAd,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