@plasmicpkgs/react-aria 0.0.2
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/LICENSE.md +21 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/contexts.d.ts +14 -0
- package/dist/index.d.ts +2 -0
- package/dist/option-utils.d.ts +51 -0
- package/dist/react-aria.esm.js +1191 -0
- package/dist/react-aria.esm.js.map +1 -0
- package/dist/react-aria.js +1198 -0
- package/dist/react-aria.js.map +1 -0
- package/dist/registerButton.d.ts +4 -0
- package/dist/registerComboBox.d.ts +21 -0
- package/dist/registerHeader.d.ts +5 -0
- package/dist/registerInput.d.ts +5 -0
- package/dist/registerLabel.d.ts +5 -0
- package/dist/registerListBox.d.ts +14 -0
- package/dist/registerListBoxItem.d.ts +7 -0
- package/dist/registerPopover.d.ts +7 -0
- package/dist/registerSection.d.ts +14 -0
- package/dist/registerSelect.d.ts +23 -0
- package/dist/utils.d.ts +18 -0
- package/package.json +74 -0
- package/skinny/contexts-c0294d96.cjs.js +24 -0
- package/skinny/contexts-c0294d96.cjs.js.map +1 -0
- package/skinny/contexts-fd3e1077.esm.js +12 -0
- package/skinny/contexts-fd3e1077.esm.js.map +1 -0
- package/skinny/contexts.d.ts +14 -0
- package/skinny/option-utils-0db61f6d.cjs.js +162 -0
- package/skinny/option-utils-0db61f6d.cjs.js.map +1 -0
- package/skinny/option-utils-765a1782.esm.js +153 -0
- package/skinny/option-utils-765a1782.esm.js.map +1 -0
- package/skinny/option-utils.d.ts +51 -0
- package/skinny/registerButton.cjs.js +31 -0
- package/skinny/registerButton.cjs.js.map +1 -0
- package/skinny/registerButton.d.ts +4 -0
- package/skinny/registerButton.esm.js +26 -0
- package/skinny/registerButton.esm.js.map +1 -0
- package/skinny/registerComboBox.cjs.js +291 -0
- package/skinny/registerComboBox.cjs.js.map +1 -0
- package/skinny/registerComboBox.d.ts +21 -0
- package/skinny/registerComboBox.esm.js +284 -0
- package/skinny/registerComboBox.esm.js.map +1 -0
- package/skinny/registerHeader.cjs.js +51 -0
- package/skinny/registerHeader.cjs.js.map +1 -0
- package/skinny/registerHeader.d.ts +5 -0
- package/skinny/registerHeader.esm.js +44 -0
- package/skinny/registerHeader.esm.js.map +1 -0
- package/skinny/registerInput.cjs.js +78 -0
- package/skinny/registerInput.cjs.js.map +1 -0
- package/skinny/registerInput.d.ts +5 -0
- package/skinny/registerInput.esm.js +71 -0
- package/skinny/registerInput.esm.js.map +1 -0
- package/skinny/registerLabel.cjs.js +59 -0
- package/skinny/registerLabel.cjs.js.map +1 -0
- package/skinny/registerLabel.d.ts +5 -0
- package/skinny/registerLabel.esm.js +52 -0
- package/skinny/registerLabel.esm.js.map +1 -0
- package/skinny/registerListBox.cjs.js +145 -0
- package/skinny/registerListBox.cjs.js.map +1 -0
- package/skinny/registerListBox.d.ts +14 -0
- package/skinny/registerListBox.esm.js +138 -0
- package/skinny/registerListBox.esm.js.map +1 -0
- package/skinny/registerListBoxItem.cjs.js +72 -0
- package/skinny/registerListBoxItem.cjs.js.map +1 -0
- package/skinny/registerListBoxItem.d.ts +7 -0
- package/skinny/registerListBoxItem.esm.js +65 -0
- package/skinny/registerListBoxItem.esm.js.map +1 -0
- package/skinny/registerPopover.cjs.js +111 -0
- package/skinny/registerPopover.cjs.js.map +1 -0
- package/skinny/registerPopover.d.ts +7 -0
- package/skinny/registerPopover.esm.js +104 -0
- package/skinny/registerPopover.esm.js.map +1 -0
- package/skinny/registerSection.cjs.js +82 -0
- package/skinny/registerSection.cjs.js.map +1 -0
- package/skinny/registerSection.d.ts +14 -0
- package/skinny/registerSection.esm.js +75 -0
- package/skinny/registerSection.esm.js.map +1 -0
- package/skinny/registerSelect.cjs.js +199 -0
- package/skinny/registerSelect.cjs.js.map +1 -0
- package/skinny/registerSelect.d.ts +23 -0
- package/skinny/registerSelect.esm.js +189 -0
- package/skinny/registerSelect.esm.js.map +1 -0
- package/skinny/utils-044c7f37.cjs.js +74 -0
- package/skinny/utils-044c7f37.cjs.js.map +1 -0
- package/skinny/utils-d92b3b76.esm.js +64 -0
- package/skinny/utils-d92b3b76.esm.js.map +1 -0
- package/skinny/utils.d.ts +18 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var host = require('@plasmicapp/host');
|
|
4
|
+
var utils = require('@react-aria/utils');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var reactAriaComponents = require('react-aria-components');
|
|
7
|
+
var contexts = require('./contexts-c0294d96.cjs.js');
|
|
8
|
+
var utils$1 = require('./utils-044c7f37.cjs.js');
|
|
9
|
+
require('@plasmicapp/host/registerComponent');
|
|
10
|
+
|
|
11
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
14
|
+
|
|
15
|
+
var __defProp = Object.defineProperty;
|
|
16
|
+
var __defProps = Object.defineProperties;
|
|
17
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
18
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
19
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
20
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
21
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
22
|
+
var __spreadValues = (a, b) => {
|
|
23
|
+
for (var prop in b || (b = {}))
|
|
24
|
+
if (__hasOwnProp.call(b, prop))
|
|
25
|
+
__defNormalProp(a, prop, b[prop]);
|
|
26
|
+
if (__getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
28
|
+
if (__propIsEnum.call(b, prop))
|
|
29
|
+
__defNormalProp(a, prop, b[prop]);
|
|
30
|
+
}
|
|
31
|
+
return a;
|
|
32
|
+
};
|
|
33
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
34
|
+
var __objRest = (source, exclude) => {
|
|
35
|
+
var target = {};
|
|
36
|
+
for (var prop in source)
|
|
37
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
38
|
+
target[prop] = source[prop];
|
|
39
|
+
if (source != null && __getOwnPropSymbols)
|
|
40
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
41
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
42
|
+
target[prop] = source[prop];
|
|
43
|
+
}
|
|
44
|
+
return target;
|
|
45
|
+
};
|
|
46
|
+
function BasePopover(props) {
|
|
47
|
+
const _a = props, restProps = __objRest(_a, ["resetClassName"]);
|
|
48
|
+
const isStandalone = !React__default.default.useContext(reactAriaComponents.PopoverContext);
|
|
49
|
+
const contextProps = React__default.default.useContext(contexts.PlasmicPopoverContext);
|
|
50
|
+
const canvas = host.usePlasmicCanvasContext();
|
|
51
|
+
const mergedProps = utils.mergeProps(contextProps, restProps, {
|
|
52
|
+
className: `${props.resetClassName}`
|
|
53
|
+
});
|
|
54
|
+
if (isStandalone) {
|
|
55
|
+
const triggerRef = React__default.default.useRef(null);
|
|
56
|
+
return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React__default.default.createElement(
|
|
57
|
+
reactAriaComponents.Popover,
|
|
58
|
+
__spreadProps(__spreadValues({}, mergedProps), {
|
|
59
|
+
triggerRef,
|
|
60
|
+
isNonModal: true,
|
|
61
|
+
isOpen: true
|
|
62
|
+
})
|
|
63
|
+
));
|
|
64
|
+
} else {
|
|
65
|
+
return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Popover, __spreadProps(__spreadValues({}, mergedProps), { isNonModal: !!canvas }));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function registerPopover(loader, overrides) {
|
|
69
|
+
utils$1.registerComponentHelper(
|
|
70
|
+
loader,
|
|
71
|
+
BasePopover,
|
|
72
|
+
{
|
|
73
|
+
name: "plasmic-react-aria-popover",
|
|
74
|
+
displayName: "BasePopover",
|
|
75
|
+
importPath: "@plasmicpkgs/react-aria/registerPopover",
|
|
76
|
+
importName: "BasePopover",
|
|
77
|
+
props: {
|
|
78
|
+
children: {
|
|
79
|
+
type: "slot"
|
|
80
|
+
},
|
|
81
|
+
offset: {
|
|
82
|
+
type: "number",
|
|
83
|
+
displayName: "Offset",
|
|
84
|
+
description: "Additional offset applied vertically between the popover and its trigger",
|
|
85
|
+
defaultValueHint: 0
|
|
86
|
+
},
|
|
87
|
+
placement: {
|
|
88
|
+
type: "choice",
|
|
89
|
+
description: "Default placement of the popover relative to the trigger, if there is enough space",
|
|
90
|
+
options: [
|
|
91
|
+
"bottom",
|
|
92
|
+
"bottom left",
|
|
93
|
+
"bottom right",
|
|
94
|
+
"top",
|
|
95
|
+
"top left",
|
|
96
|
+
"top right"
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
resetClassName: {
|
|
100
|
+
type: "themeResetClass"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
styleSections: true
|
|
104
|
+
},
|
|
105
|
+
overrides
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
exports.BasePopover = BasePopover;
|
|
110
|
+
exports.registerPopover = registerPopover;
|
|
111
|
+
//# sourceMappingURL=registerPopover.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerPopover.cjs.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { 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 function BasePopover(props: {\n className?: string;\n resetClassName?: string;\n}) {\n const { resetClassName, ...restProps } = props;\n const isStandalone = !React.useContext(PopoverContext);\n const contextProps = React.useContext(PlasmicPopoverContext);\n const canvas = usePlasmicCanvasContext();\n const mergedProps = mergeProps(contextProps, restProps, {\n className: `${props.resetClassName}`,\n });\n\n if (isStandalone) {\n const triggerRef = React.useRef<any>(null);\n return (\n <>\n <div ref={triggerRef} />\n <Popover\n {...mergedProps}\n triggerRef={triggerRef}\n isNonModal={true}\n isOpen={true}\n />\n </>\n );\n } else {\n return <Popover {...mergedProps} isNonModal={!!canvas} />;\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: \"BasePopover\",\n importPath: \"@plasmicpkgs/react-aria/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","usePlasmicCanvasContext","mergeProps","Popover","registerComponentHelper"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,SAAS,YAAY,KAGzB,EAAA;AACD,EAAA,MAAyC,YAAd,SAAA,GAAA,SAAA,CAAc,IAAd,CAAnB,gBAAA,CAAA,EAAA;AACR,EAAA,MAAM,YAAe,GAAA,CAACA,sBAAM,CAAA,UAAA,CAAWC,kCAAc,CAAA,CAAA;AACrD,EAAM,MAAA,YAAA,GAAeD,sBA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;AAAA,QACA,MAAQ,EAAA;AAAA,UACN,IAAM,EAAA,QAAA;AAAA,UACN,WAAa,EAAA,QAAA;AAAA,UACb,WACE,EAAA,0EAAA;AAAA,UACF,gBAAkB,EAAA,CAAA;AAAA,SACpB;AAAA,QACA,SAAW,EAAA;AAAA,UACT,IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,oFAAA;AAAA,UACF,OAAS,EAAA;AAAA,YACP,QAAA;AAAA,YACA,aAAA;AAAA,YACA,cAAA;AAAA,YACA,KAAA;AAAA,YACA,UAAA;AAAA,YACA,WAAA;AAAA,WACF;AAAA,SACF;AAAA,QACA,cAAgB,EAAA;AAAA,UACd,IAAM,EAAA,iBAAA;AAAA,SACR;AAAA,OACF;AAAA,MACA,aAAe,EAAA,IAAA;AAAA,KACjB;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
3
|
+
export declare function BasePopover(props: {
|
|
4
|
+
className?: string;
|
|
5
|
+
resetClassName?: string;
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
export declare function registerPopover(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BasePopover>): void;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { usePlasmicCanvasContext } from '@plasmicapp/host';
|
|
2
|
+
import { mergeProps } from '@react-aria/utils';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { PopoverContext, Popover } from 'react-aria-components';
|
|
5
|
+
import { e as PlasmicPopoverContext } from './contexts-fd3e1077.esm.js';
|
|
6
|
+
import { r as registerComponentHelper } from './utils-d92b3b76.esm.js';
|
|
7
|
+
import '@plasmicapp/host/registerComponent';
|
|
8
|
+
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __defProps = Object.defineProperties;
|
|
11
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
12
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
15
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16
|
+
var __spreadValues = (a, b) => {
|
|
17
|
+
for (var prop in b || (b = {}))
|
|
18
|
+
if (__hasOwnProp.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
if (__getOwnPropSymbols)
|
|
21
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
22
|
+
if (__propIsEnum.call(b, prop))
|
|
23
|
+
__defNormalProp(a, prop, b[prop]);
|
|
24
|
+
}
|
|
25
|
+
return a;
|
|
26
|
+
};
|
|
27
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
28
|
+
var __objRest = (source, exclude) => {
|
|
29
|
+
var target = {};
|
|
30
|
+
for (var prop in source)
|
|
31
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
if (source != null && __getOwnPropSymbols)
|
|
34
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
35
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
36
|
+
target[prop] = source[prop];
|
|
37
|
+
}
|
|
38
|
+
return target;
|
|
39
|
+
};
|
|
40
|
+
function BasePopover(props) {
|
|
41
|
+
const _a = props, restProps = __objRest(_a, ["resetClassName"]);
|
|
42
|
+
const isStandalone = !React.useContext(PopoverContext);
|
|
43
|
+
const contextProps = React.useContext(PlasmicPopoverContext);
|
|
44
|
+
const canvas = usePlasmicCanvasContext();
|
|
45
|
+
const mergedProps = mergeProps(contextProps, restProps, {
|
|
46
|
+
className: `${props.resetClassName}`
|
|
47
|
+
});
|
|
48
|
+
if (isStandalone) {
|
|
49
|
+
const triggerRef = React.useRef(null);
|
|
50
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(
|
|
51
|
+
Popover,
|
|
52
|
+
__spreadProps(__spreadValues({}, mergedProps), {
|
|
53
|
+
triggerRef,
|
|
54
|
+
isNonModal: true,
|
|
55
|
+
isOpen: true
|
|
56
|
+
})
|
|
57
|
+
));
|
|
58
|
+
} else {
|
|
59
|
+
return /* @__PURE__ */ React.createElement(Popover, __spreadProps(__spreadValues({}, mergedProps), { isNonModal: !!canvas }));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function registerPopover(loader, overrides) {
|
|
63
|
+
registerComponentHelper(
|
|
64
|
+
loader,
|
|
65
|
+
BasePopover,
|
|
66
|
+
{
|
|
67
|
+
name: "plasmic-react-aria-popover",
|
|
68
|
+
displayName: "BasePopover",
|
|
69
|
+
importPath: "@plasmicpkgs/react-aria/registerPopover",
|
|
70
|
+
importName: "BasePopover",
|
|
71
|
+
props: {
|
|
72
|
+
children: {
|
|
73
|
+
type: "slot"
|
|
74
|
+
},
|
|
75
|
+
offset: {
|
|
76
|
+
type: "number",
|
|
77
|
+
displayName: "Offset",
|
|
78
|
+
description: "Additional offset applied vertically between the popover and its trigger",
|
|
79
|
+
defaultValueHint: 0
|
|
80
|
+
},
|
|
81
|
+
placement: {
|
|
82
|
+
type: "choice",
|
|
83
|
+
description: "Default placement of the popover relative to the trigger, if there is enough space",
|
|
84
|
+
options: [
|
|
85
|
+
"bottom",
|
|
86
|
+
"bottom left",
|
|
87
|
+
"bottom right",
|
|
88
|
+
"top",
|
|
89
|
+
"top left",
|
|
90
|
+
"top right"
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
resetClassName: {
|
|
94
|
+
type: "themeResetClass"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
styleSections: true
|
|
98
|
+
},
|
|
99
|
+
overrides
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { BasePopover, registerPopover };
|
|
104
|
+
//# sourceMappingURL=registerPopover.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerPopover.esm.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { 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 function BasePopover(props: {\n className?: string;\n resetClassName?: string;\n}) {\n const { resetClassName, ...restProps } = props;\n const isStandalone = !React.useContext(PopoverContext);\n const contextProps = React.useContext(PlasmicPopoverContext);\n const canvas = usePlasmicCanvasContext();\n const mergedProps = mergeProps(contextProps, restProps, {\n className: `${props.resetClassName}`,\n });\n\n if (isStandalone) {\n const triggerRef = React.useRef<any>(null);\n return (\n <>\n <div ref={triggerRef} />\n <Popover\n {...mergedProps}\n triggerRef={triggerRef}\n isNonModal={true}\n isOpen={true}\n />\n </>\n );\n } else {\n return <Popover {...mergedProps} isNonModal={!!canvas} />;\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: \"BasePopover\",\n importPath: \"@plasmicpkgs/react-aria/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":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,SAAS,YAAY,KAGzB,EAAA;AACD,EAAA,MAAyC,YAAd,SAAA,GAAA,SAAA,CAAc,IAAd,CAAnB,gBAAA,CAAA,EAAA;AACR,EAAA,MAAM,YAAe,GAAA,CAAC,KAAM,CAAA,UAAA,CAAW,cAAc,CAAA,CAAA;AACrD,EAAM,MAAA,YAAA,GAAe,KAAM,CAAA,UAAA,CAAW,qBAAqB,CAAA,CAAA;AAC3D,EAAA,MAAM,SAAS,uBAAwB,EAAA,CAAA;AACvC,EAAM,MAAA,WAAA,GAAc,UAAW,CAAA,YAAA,EAAc,SAAW,EAAA;AAAA,IACtD,SAAA,EAAW,GAAG,KAAM,CAAA,cAAA,CAAA,CAAA;AAAA,GACrB,CAAA,CAAA;AAED,EAAA,IAAI,YAAc,EAAA;AAChB,IAAM,MAAA,UAAA,GAAa,KAAM,CAAA,MAAA,CAAY,IAAI,CAAA,CAAA;AACzC,IAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAI,EAAA,EAAA,GAAA,EAAK,YAAY,CACtB,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,OAAA;AAAA,MAAA,aAAA,CAAA,cAAA,CAAA,EAAA,EACK,WADL,CAAA,EAAA;AAAA,QAEC,UAAA;AAAA,QACA,UAAY,EAAA,IAAA;AAAA,QACZ,MAAQ,EAAA,IAAA;AAAA,OAAA,CAAA;AAAA,KAEZ,CAAA,CAAA;AAAA,GAEG,MAAA;AACL,IAAA,2CAAQ,OAAY,EAAA,aAAA,CAAA,cAAA,CAAA,EAAA,EAAA,WAAA,CAAA,EAAZ,EAAyB,UAAY,EAAA,CAAC,CAAC,MAAQ,EAAA,CAAA,CAAA,CAAA;AAAA,GACzD;AACF,CAAA;AAEgB,SAAA,eAAA,CACd,QACA,SACA,EAAA;AACA,EAAA,uBAAA;AAAA,IACE,MAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,MACE,IAAM,EAAA,4BAAA;AAAA,MACN,WAAa,EAAA,aAAA;AAAA,MACb,UAAY,EAAA,yCAAA;AAAA,MACZ,UAAY,EAAA,aAAA;AAAA,MACZ,KAAO,EAAA;AAAA,QACL,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,MAAA;AAAA,SACR;AAAA,QACA,MAAQ,EAAA;AAAA,UACN,IAAM,EAAA,QAAA;AAAA,UACN,WAAa,EAAA,QAAA;AAAA,UACb,WACE,EAAA,0EAAA;AAAA,UACF,gBAAkB,EAAA,CAAA;AAAA,SACpB;AAAA,QACA,SAAW,EAAA;AAAA,UACT,IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,oFAAA;AAAA,UACF,OAAS,EAAA;AAAA,YACP,QAAA;AAAA,YACA,aAAA;AAAA,YACA,cAAA;AAAA,YACA,KAAA;AAAA,YACA,UAAA;AAAA,YACA,WAAA;AAAA,WACF;AAAA,SACF;AAAA,QACA,cAAgB,EAAA;AAAA,UACd,IAAM,EAAA,iBAAA;AAAA,SACR;AAAA,OACF;AAAA,MACA,aAAe,EAAA,IAAA;AAAA,KACjB;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('@react-aria/utils');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var reactAriaComponents = require('react-aria-components');
|
|
6
|
+
var contexts = require('./contexts-c0294d96.cjs.js');
|
|
7
|
+
var registerHeader = require('./registerHeader.cjs.js');
|
|
8
|
+
var utils$1 = require('./utils-044c7f37.cjs.js');
|
|
9
|
+
require('@plasmicapp/host/registerComponent');
|
|
10
|
+
|
|
11
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
14
|
+
|
|
15
|
+
var __defProp = Object.defineProperty;
|
|
16
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
17
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
19
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
20
|
+
var __spreadValues = (a, b) => {
|
|
21
|
+
for (var prop in b || (b = {}))
|
|
22
|
+
if (__hasOwnProp.call(b, prop))
|
|
23
|
+
__defNormalProp(a, prop, b[prop]);
|
|
24
|
+
if (__getOwnPropSymbols)
|
|
25
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
26
|
+
if (__propIsEnum.call(b, prop))
|
|
27
|
+
__defNormalProp(a, prop, b[prop]);
|
|
28
|
+
}
|
|
29
|
+
return a;
|
|
30
|
+
};
|
|
31
|
+
var __objRest = (source, exclude) => {
|
|
32
|
+
var target = {};
|
|
33
|
+
for (var prop in source)
|
|
34
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
35
|
+
target[prop] = source[prop];
|
|
36
|
+
if (source != null && __getOwnPropSymbols)
|
|
37
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
38
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
39
|
+
target[prop] = source[prop];
|
|
40
|
+
}
|
|
41
|
+
return target;
|
|
42
|
+
};
|
|
43
|
+
function BaseSection(props) {
|
|
44
|
+
const contextProps = React__default.default.useContext(contexts.PlasmicSectionContext);
|
|
45
|
+
const mergedProps = utils.mergeProps(contextProps, props);
|
|
46
|
+
const _a = mergedProps, { section, renderHeader, key, makeItemProps, renderItem } = _a, rest = __objRest(_a, ["section", "renderHeader", "key", "makeItemProps", "renderItem"]);
|
|
47
|
+
return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Section, __spreadValues({ id: key != null ? key : void 0 }, rest), /* @__PURE__ */ React__default.default.createElement(contexts.PlasmicHeaderContext.Provider, { value: { children: section == null ? void 0 : section.label } }, renderHeader == null ? void 0 : renderHeader(section)), /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Collection, { items: section == null ? void 0 : section.items }, (item) => {
|
|
48
|
+
const itemProps = makeItemProps == null ? void 0 : makeItemProps(item);
|
|
49
|
+
return /* @__PURE__ */ React__default.default.createElement(contexts.PlasmicItemContext.Provider, { key: itemProps == null ? void 0 : itemProps.key, value: itemProps }, renderItem == null ? void 0 : renderItem(item));
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
function registerSection(loader, overrides) {
|
|
53
|
+
utils$1.registerComponentHelper(
|
|
54
|
+
loader,
|
|
55
|
+
BaseSection,
|
|
56
|
+
{
|
|
57
|
+
name: utils$1.makeComponentName("section"),
|
|
58
|
+
displayName: "BaseSection",
|
|
59
|
+
importPath: "@plasmicpkgs/react-aria/registerSection",
|
|
60
|
+
importName: "BaseSection",
|
|
61
|
+
props: {
|
|
62
|
+
renderHeader: {
|
|
63
|
+
type: "slot",
|
|
64
|
+
displayName: "Render section header",
|
|
65
|
+
renderPropParams: ["section"]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
overrides
|
|
70
|
+
);
|
|
71
|
+
const thisName = utils$1.makeChildComponentName(
|
|
72
|
+
overrides == null ? void 0 : overrides.parentComponentName,
|
|
73
|
+
utils$1.makeComponentName("section")
|
|
74
|
+
);
|
|
75
|
+
registerHeader.registerHeader(loader, {
|
|
76
|
+
parentComponentName: thisName
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
exports.BaseSection = BaseSection;
|
|
81
|
+
exports.registerSection = registerSection;
|
|
82
|
+
//# sourceMappingURL=registerSection.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerSection.cjs.js","sources":["../src/registerSection.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Collection, Key, Section } from \"react-aria-components\";\nimport {\n PlasmicHeaderContext,\n PlasmicItemContext,\n PlasmicSectionContext,\n} from \"./contexts\";\nimport type { StrictSectionType } from \"./option-utils\";\nimport { registerHeader } from \"./registerHeader\";\nimport { BaseListBoxItem } from \"./registerListBoxItem\";\nimport {\n CodeComponentMetaOverrides,\n makeChildComponentName,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n Styleable,\n} from \"./utils\";\n\nexport interface BaseSectionProps extends Styleable {\n // Configured via Studio\n renderHeader?: (section: any) => React.ReactNode;\n\n // Passed down via context from Select, ComboBox\n key?: Key;\n section?: StrictSectionType;\n\n // Passed down via context from ListBox\n makeItemProps?: (\n item: any\n ) => Partial<React.ComponentProps<typeof BaseListBoxItem>>;\n renderItem?: (item?: any) => React.ReactNode;\n}\n\nexport function BaseSection(props: BaseSectionProps) {\n const contextProps = React.useContext(PlasmicSectionContext);\n const mergedProps = mergeProps(contextProps, props);\n const { section, renderHeader, key, makeItemProps, renderItem, ...rest } =\n mergedProps;\n return (\n <Section id={key ?? undefined} {...rest}>\n <PlasmicHeaderContext.Provider value={{ children: section?.label }}>\n {renderHeader?.(section)}\n </PlasmicHeaderContext.Provider>\n <Collection items={section?.items}>\n {(item) => {\n const itemProps = makeItemProps?.(item);\n return (\n <PlasmicItemContext.Provider key={itemProps?.key} value={itemProps}>\n {renderItem?.(item)}\n </PlasmicItemContext.Provider>\n );\n }}\n </Collection>\n </Section>\n );\n}\n\nexport function registerSection(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseSection>\n) {\n registerComponentHelper(\n loader,\n BaseSection,\n {\n name: makeComponentName(\"section\"),\n displayName: \"BaseSection\",\n importPath: \"@plasmicpkgs/react-aria/registerSection\",\n importName: \"BaseSection\",\n props: {\n renderHeader: {\n type: \"slot\",\n displayName: \"Render section header\",\n renderPropParams: [\"section\"],\n },\n },\n },\n overrides\n );\n\n const thisName = makeChildComponentName(\n overrides?.parentComponentName,\n makeComponentName(\"section\")\n );\n\n registerHeader(loader, {\n parentComponentName: thisName,\n });\n}\n"],"names":["React","PlasmicSectionContext","mergeProps","Section","PlasmicHeaderContext","Collection","PlasmicItemContext","registerComponentHelper","makeComponentName","makeChildComponentName","registerHeader"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCO,SAAS,YAAY,KAAyB,EAAA;AACnD,EAAM,MAAA,YAAA,GAAeA,sBAAM,CAAA,UAAA,CAAWC,8BAAqB,CAAA,CAAA;AAC3D,EAAM,MAAA,WAAA,GAAcC,gBAAW,CAAA,YAAA,EAAc,KAAK,CAAA,CAAA;AAClD,EAAA,MACE,EADM,GAAA,WAAA,EAAA,EAAA,OAAA,EAAS,YAAc,EAAA,GAAA,EAAK,eAAe,UAtCrD,EAAA,GAuCI,EADgE,EAAA,IAAA,GAAA,SAAA,CAChE,EADgE,EAAA,CAA1D,SAAS,EAAA,cAAA,EAAc,OAAK,eAAe,EAAA,YAAA,CAAA,CAAA,CAAA;AAEnD,EACE,uBAAAF,sBAAA,CAAA,aAAA,CAACG,2BAAQ,EAAA,cAAA,CAAA,EAAA,EAAA,EAAI,GAAO,IAAA,IAAA,GAAA,GAAA,GAAA,KAAA,CAAA,EAAA,EAAe,uBAChCH,sBAAA,CAAA,aAAA,CAAAI,6BAAA,CAAqB,QAArB,EAAA,EAA8B,KAAO,EAAA,EAAE,UAAU,OAAS,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,OAAA,CAAA,KAAA,EACxD,EAAA,EAAA,YAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,YAAA,CAAe,OAClB,CAAA,CAAA,kBACCJ,sBAAA,CAAA,aAAA,CAAAK,8BAAA,EAAA,EAAW,K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";
|
|
2
|
+
import { Key } from "react-aria-components";
|
|
3
|
+
import type { StrictSectionType } from "./option-utils";
|
|
4
|
+
import { BaseListBoxItem } from "./registerListBoxItem";
|
|
5
|
+
import { CodeComponentMetaOverrides, Registerable, Styleable } from "./utils";
|
|
6
|
+
export interface BaseSectionProps extends Styleable {
|
|
7
|
+
renderHeader?: (section: any) => React.ReactNode;
|
|
8
|
+
key?: Key;
|
|
9
|
+
section?: StrictSectionType;
|
|
10
|
+
makeItemProps?: (item: any) => Partial<React.ComponentProps<typeof BaseListBoxItem>>;
|
|
11
|
+
renderItem?: (item?: any) => React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function BaseSection(props: BaseSectionProps): React.JSX.Element;
|
|
14
|
+
export declare function registerSection(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BaseSection>): void;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { mergeProps } from '@react-aria/utils';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Section, Collection } from 'react-aria-components';
|
|
4
|
+
import { c as PlasmicSectionContext, f as PlasmicHeaderContext, d as PlasmicItemContext } from './contexts-fd3e1077.esm.js';
|
|
5
|
+
import { registerHeader } from './registerHeader.esm.js';
|
|
6
|
+
import { r as registerComponentHelper, a as makeChildComponentName, m as makeComponentName } from './utils-d92b3b76.esm.js';
|
|
7
|
+
import '@plasmicapp/host/registerComponent';
|
|
8
|
+
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
13
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
+
var __spreadValues = (a, b) => {
|
|
15
|
+
for (var prop in b || (b = {}))
|
|
16
|
+
if (__hasOwnProp.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
if (__getOwnPropSymbols)
|
|
19
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
20
|
+
if (__propIsEnum.call(b, prop))
|
|
21
|
+
__defNormalProp(a, prop, b[prop]);
|
|
22
|
+
}
|
|
23
|
+
return a;
|
|
24
|
+
};
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
function BaseSection(props) {
|
|
38
|
+
const contextProps = React.useContext(PlasmicSectionContext);
|
|
39
|
+
const mergedProps = mergeProps(contextProps, props);
|
|
40
|
+
const _a = mergedProps, { section, renderHeader, key, makeItemProps, renderItem } = _a, rest = __objRest(_a, ["section", "renderHeader", "key", "makeItemProps", "renderItem"]);
|
|
41
|
+
return /* @__PURE__ */ React.createElement(Section, __spreadValues({ id: key != null ? key : void 0 }, rest), /* @__PURE__ */ React.createElement(PlasmicHeaderContext.Provider, { value: { children: section == null ? void 0 : section.label } }, renderHeader == null ? void 0 : renderHeader(section)), /* @__PURE__ */ React.createElement(Collection, { items: section == null ? void 0 : section.items }, (item) => {
|
|
42
|
+
const itemProps = makeItemProps == null ? void 0 : makeItemProps(item);
|
|
43
|
+
return /* @__PURE__ */ React.createElement(PlasmicItemContext.Provider, { key: itemProps == null ? void 0 : itemProps.key, value: itemProps }, renderItem == null ? void 0 : renderItem(item));
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
function registerSection(loader, overrides) {
|
|
47
|
+
registerComponentHelper(
|
|
48
|
+
loader,
|
|
49
|
+
BaseSection,
|
|
50
|
+
{
|
|
51
|
+
name: makeComponentName("section"),
|
|
52
|
+
displayName: "BaseSection",
|
|
53
|
+
importPath: "@plasmicpkgs/react-aria/registerSection",
|
|
54
|
+
importName: "BaseSection",
|
|
55
|
+
props: {
|
|
56
|
+
renderHeader: {
|
|
57
|
+
type: "slot",
|
|
58
|
+
displayName: "Render section header",
|
|
59
|
+
renderPropParams: ["section"]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
overrides
|
|
64
|
+
);
|
|
65
|
+
const thisName = makeChildComponentName(
|
|
66
|
+
overrides == null ? void 0 : overrides.parentComponentName,
|
|
67
|
+
makeComponentName("section")
|
|
68
|
+
);
|
|
69
|
+
registerHeader(loader, {
|
|
70
|
+
parentComponentName: thisName
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { BaseSection, registerSection };
|
|
75
|
+
//# sourceMappingURL=registerSection.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerSection.esm.js","sources":["../src/registerSection.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Collection, Key, Section } from \"react-aria-components\";\nimport {\n PlasmicHeaderContext,\n PlasmicItemContext,\n PlasmicSectionContext,\n} from \"./contexts\";\nimport type { StrictSectionType } from \"./option-utils\";\nimport { registerHeader } from \"./registerHeader\";\nimport { BaseListBoxItem } from \"./registerListBoxItem\";\nimport {\n CodeComponentMetaOverrides,\n makeChildComponentName,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n Styleable,\n} from \"./utils\";\n\nexport interface BaseSectionProps extends Styleable {\n // Configured via Studio\n renderHeader?: (section: any) => React.ReactNode;\n\n // Passed down via context from Select, ComboBox\n key?: Key;\n section?: StrictSectionType;\n\n // Passed down via context from ListBox\n makeItemProps?: (\n item: any\n ) => Partial<React.ComponentProps<typeof BaseListBoxItem>>;\n renderItem?: (item?: any) => React.ReactNode;\n}\n\nexport function BaseSection(props: BaseSectionProps) {\n const contextProps = React.useContext(PlasmicSectionContext);\n const mergedProps = mergeProps(contextProps, props);\n const { section, renderHeader, key, makeItemProps, renderItem, ...rest } =\n mergedProps;\n return (\n <Section id={key ?? undefined} {...rest}>\n <PlasmicHeaderContext.Provider value={{ children: section?.label }}>\n {renderHeader?.(section)}\n </PlasmicHeaderContext.Provider>\n <Collection items={section?.items}>\n {(item) => {\n const itemProps = makeItemProps?.(item);\n return (\n <PlasmicItemContext.Provider key={itemProps?.key} value={itemProps}>\n {renderItem?.(item)}\n </PlasmicItemContext.Provider>\n );\n }}\n </Collection>\n </Section>\n );\n}\n\nexport function registerSection(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseSection>\n) {\n registerComponentHelper(\n loader,\n BaseSection,\n {\n name: makeComponentName(\"section\"),\n displayName: \"BaseSection\",\n importPath: \"@plasmicpkgs/react-aria/registerSection\",\n importName: \"BaseSection\",\n props: {\n renderHeader: {\n type: \"slot\",\n displayName: \"Render section header\",\n renderPropParams: [\"section\"],\n },\n },\n },\n overrides\n );\n\n const thisName = makeChildComponentName(\n overrides?.parentComponentName,\n makeComponentName(\"section\")\n );\n\n registerHeader(loader, {\n parentComponentName: thisName,\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCO,SAAS,YAAY,KAAyB,EAAA;AACnD,EAAM,MAAA,YAAA,GAAe,KAAM,CAAA,UAAA,CAAW,qBAAqB,CAAA,CAAA;AAC3D,EAAM,MAAA,WAAA,GAAc,UAAW,CAAA,YAAA,EAAc,KAAK,CAAA,CAAA;AAClD,EAAA,MACE,EADM,GAAA,WAAA,EAAA,EAAA,OAAA,EAAS,YAAc,EAAA,GAAA,EAAK,eAAe,UAtCrD,EAAA,GAuCI,EADgE,EAAA,IAAA,GAAA,SAAA,CAChE,EAD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A;AAAA,QACL,YAAc,EAAA;AAAA,UACZ,IAAM,EAAA,MAAA;AAAA,UACN,WAAa,EAAA,uBAAA;AAAA,UACb,gBAAA,EAAkB,CAAC,SAAS,CAAA;AAAA,SAC9B;AAAA,OACF;AAAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AAEA,EAAA,MAAM,QAAW,GAAA,sBAAA;AAAA,IACf,SAAW,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,SAAA,CAAA,mBAAA;AAAA,IACX,kBAAkB,SAAS,CAAA;AAAA,GAC7B,CAAA;AAEA,EAAA,cAAA,CAAe,MAAQ,EAAA;AAAA,IACrB,mBAAqB,EAAA,QAAA;AAAA,GACtB,CAAA,CAAA;AACH;;;;"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var host = require('@plasmicapp/host');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var reactAriaComponents = require('react-aria-components');
|
|
6
|
+
var contexts = require('./contexts-c0294d96.cjs.js');
|
|
7
|
+
var optionUtils = require('./option-utils-0db61f6d.cjs.js');
|
|
8
|
+
var utils = require('./utils-044c7f37.cjs.js');
|
|
9
|
+
require('@plasmicapp/host/registerComponent');
|
|
10
|
+
|
|
11
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
14
|
+
|
|
15
|
+
var __defProp = Object.defineProperty;
|
|
16
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
17
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
19
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
20
|
+
var __spreadValues = (a, b) => {
|
|
21
|
+
for (var prop in b || (b = {}))
|
|
22
|
+
if (__hasOwnProp.call(b, prop))
|
|
23
|
+
__defNormalProp(a, prop, b[prop]);
|
|
24
|
+
if (__getOwnPropSymbols)
|
|
25
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
26
|
+
if (__propIsEnum.call(b, prop))
|
|
27
|
+
__defNormalProp(a, prop, b[prop]);
|
|
28
|
+
}
|
|
29
|
+
return a;
|
|
30
|
+
};
|
|
31
|
+
const SELECT_NAME = utils.makeComponentName("select");
|
|
32
|
+
function BaseSelect(props) {
|
|
33
|
+
const {
|
|
34
|
+
value,
|
|
35
|
+
onChange,
|
|
36
|
+
placeholder,
|
|
37
|
+
previewOpen,
|
|
38
|
+
onOpenChange,
|
|
39
|
+
isDisabled,
|
|
40
|
+
className,
|
|
41
|
+
style,
|
|
42
|
+
structure,
|
|
43
|
+
renderOption,
|
|
44
|
+
name,
|
|
45
|
+
"aria-label": ariaLabel
|
|
46
|
+
} = props;
|
|
47
|
+
const { options, optionText } = optionUtils.useStrictOptions(props);
|
|
48
|
+
const canvas = host.usePlasmicCanvasContext();
|
|
49
|
+
const disabledKeys = optionUtils.flattenOptions(options).filter((op) => op.isDisabled).map((op) => op.value);
|
|
50
|
+
return /* @__PURE__ */ React__default.default.createElement(
|
|
51
|
+
reactAriaComponents.Select,
|
|
52
|
+
__spreadValues(__spreadValues({
|
|
53
|
+
placeholder,
|
|
54
|
+
selectedKey: value,
|
|
55
|
+
onSelectionChange: onChange,
|
|
56
|
+
onOpenChange,
|
|
57
|
+
isDisabled,
|
|
58
|
+
className,
|
|
59
|
+
style,
|
|
60
|
+
name,
|
|
61
|
+
"aria-label": ariaLabel
|
|
62
|
+
}, previewOpen && canvas ? { isOpen: previewOpen } : void 0), utils.extractPlasmicDataProps(props)),
|
|
63
|
+
/* @__PURE__ */ React__default.default.createElement(
|
|
64
|
+
contexts.PlasmicListBoxContext.Provider,
|
|
65
|
+
{
|
|
66
|
+
value: {
|
|
67
|
+
items: options,
|
|
68
|
+
disabledKeys,
|
|
69
|
+
makeItemProps: (item) => ({
|
|
70
|
+
key: item.value,
|
|
71
|
+
textValue: optionText(item),
|
|
72
|
+
children: renderOption ? renderOption(item) : optionText(item)
|
|
73
|
+
}),
|
|
74
|
+
makeSectionProps: (section) => ({
|
|
75
|
+
section,
|
|
76
|
+
key: section.key
|
|
77
|
+
}),
|
|
78
|
+
getItemType: (option) => option.type === "section" ? "section" : "item"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
structure
|
|
82
|
+
)
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
function registerSelect(loader) {
|
|
86
|
+
utils.registerComponentHelper(loader, BaseSelect, {
|
|
87
|
+
name: SELECT_NAME,
|
|
88
|
+
displayName: "BaseSelect",
|
|
89
|
+
importPath: "@plasmicpkgs/react-aria/registerSelect",
|
|
90
|
+
importName: "BaseSelect",
|
|
91
|
+
props: {
|
|
92
|
+
options: optionUtils.makeOptionsPropType(),
|
|
93
|
+
placeholder: {
|
|
94
|
+
type: "string"
|
|
95
|
+
},
|
|
96
|
+
isDisabled: {
|
|
97
|
+
type: "boolean"
|
|
98
|
+
},
|
|
99
|
+
value: optionUtils.makeValuePropType(),
|
|
100
|
+
onChange: {
|
|
101
|
+
type: "eventHandler",
|
|
102
|
+
argTypes: [{ name: "value", type: "string" }]
|
|
103
|
+
},
|
|
104
|
+
previewOpen: {
|
|
105
|
+
type: "boolean",
|
|
106
|
+
displayName: "Preview opened?",
|
|
107
|
+
description: "Preview opened state while designing in Plasmic editor",
|
|
108
|
+
editOnly: true
|
|
109
|
+
},
|
|
110
|
+
onOpenChange: {
|
|
111
|
+
type: "eventHandler",
|
|
112
|
+
argTypes: [{ name: "isOpen", type: "boolean" }]
|
|
113
|
+
},
|
|
114
|
+
// optionValue: {
|
|
115
|
+
// type: "string",
|
|
116
|
+
// displayName: "Field key for an option's value",
|
|
117
|
+
// hidden: (ps) =>
|
|
118
|
+
// !ps.options ||
|
|
119
|
+
// !ps.options[0] ||
|
|
120
|
+
// typeof ps.options[0] === "string" ||
|
|
121
|
+
// "value" in ps.options[0],
|
|
122
|
+
// exprHint:
|
|
123
|
+
// "Return a function that takes in an option object, and returns the key to use",
|
|
124
|
+
// },
|
|
125
|
+
// optionText: {
|
|
126
|
+
// type: "string",
|
|
127
|
+
// displayName: "Field key for an option's text value",
|
|
128
|
+
// hidden: (ps) =>
|
|
129
|
+
// !ps.options ||
|
|
130
|
+
// !ps.options[0] ||
|
|
131
|
+
// typeof ps.options[0] === "string" ||
|
|
132
|
+
// "value" in ps.options[0],
|
|
133
|
+
// exprHint:
|
|
134
|
+
// "Return a function that takes in an option object, and returns the text value to use",
|
|
135
|
+
// },
|
|
136
|
+
// optionDisabled: {
|
|
137
|
+
// type: "string",
|
|
138
|
+
// displayName: "Field key for whether an option is disabled",
|
|
139
|
+
// hidden: (ps) =>
|
|
140
|
+
// !ps.options ||
|
|
141
|
+
// !ps.options[0] ||
|
|
142
|
+
// typeof ps.options[0] === "string" ||
|
|
143
|
+
// "value" in ps.options[0],
|
|
144
|
+
// exprHint:
|
|
145
|
+
// "Return a function that takes in an option object, and returns true if option should be disabled",
|
|
146
|
+
// },
|
|
147
|
+
structure: {
|
|
148
|
+
type: "slot"
|
|
149
|
+
},
|
|
150
|
+
// renderOption: {
|
|
151
|
+
// type: "slot",
|
|
152
|
+
// displayName: "Custom render option",
|
|
153
|
+
// renderPropParams: ["item"],
|
|
154
|
+
// hidePlaceholder: true
|
|
155
|
+
// },
|
|
156
|
+
name: {
|
|
157
|
+
type: "string",
|
|
158
|
+
displayName: "Form field key",
|
|
159
|
+
description: "Name of the input, when submitting in an HTML form",
|
|
160
|
+
advanced: true
|
|
161
|
+
},
|
|
162
|
+
"aria-label": {
|
|
163
|
+
type: "string",
|
|
164
|
+
displayName: "Aria Label",
|
|
165
|
+
description: "Label for this input, if no visible label is used",
|
|
166
|
+
advanced: true
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
states: {
|
|
170
|
+
value: {
|
|
171
|
+
type: "writable",
|
|
172
|
+
valueProp: "value",
|
|
173
|
+
onChangeProp: "onChange",
|
|
174
|
+
variableType: "text"
|
|
175
|
+
},
|
|
176
|
+
isOpen: {
|
|
177
|
+
type: "readonly",
|
|
178
|
+
onChangeProp: "onOpenChange",
|
|
179
|
+
variableType: "boolean"
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
utils.registerComponentHelper(loader, reactAriaComponents.SelectValue, {
|
|
184
|
+
name: utils.makeComponentName("select-value"),
|
|
185
|
+
displayName: "Base Selected Value",
|
|
186
|
+
importPath: "@plasmicpkgs/react-aria/registerSelect",
|
|
187
|
+
importName: "SelectValue",
|
|
188
|
+
parentComponentName: SELECT_NAME,
|
|
189
|
+
props: {}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
Object.defineProperty(exports, 'BaseSelectValue', {
|
|
194
|
+
enumerable: true,
|
|
195
|
+
get: function () { return reactAriaComponents.SelectValue; }
|
|
196
|
+
});
|
|
197
|
+
exports.BaseSelect = BaseSelect;
|
|
198
|
+
exports.registerSelect = registerSelect;
|
|
199
|
+
//# sourceMappingURL=registerSelect.cjs.js.map
|