@plasmicpkgs/react-aria 0.0.26 → 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
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { Popover } from "react-aria-components";
|
|
2
3
|
import { CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
3
|
-
export
|
|
4
|
+
export interface BasePopoverProps extends React.ComponentProps<typeof Popover> {
|
|
4
5
|
className?: string;
|
|
5
6
|
resetClassName?: string;
|
|
6
|
-
}
|
|
7
|
+
}
|
|
8
|
+
export declare function BasePopover(props: BasePopoverProps): React.JSX.Element;
|
|
7
9
|
export declare function registerPopover(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BasePopover>): void;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { usePlasmicCanvasContext } from '@plasmicapp/host';
|
|
2
1
|
import { mergeProps } from '@react-aria/utils';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { PopoverContext, Popover } from 'react-aria-components';
|
|
@@ -7,8 +6,6 @@ import { r as registerComponentHelper } from './utils-cf2632c9.esm.js';
|
|
|
7
6
|
import '@plasmicapp/host/registerComponent';
|
|
8
7
|
|
|
9
8
|
var __defProp = Object.defineProperty;
|
|
10
|
-
var __defProps = Object.defineProperties;
|
|
11
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
12
9
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
13
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
11
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -24,7 +21,6 @@ var __spreadValues = (a, b) => {
|
|
|
24
21
|
}
|
|
25
22
|
return a;
|
|
26
23
|
};
|
|
27
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
28
24
|
var __objRest = (source, exclude) => {
|
|
29
25
|
var target = {};
|
|
30
26
|
for (var prop in source)
|
|
@@ -41,23 +37,16 @@ function BasePopover(props) {
|
|
|
41
37
|
const _a = props, { resetClassName } = _a, restProps = __objRest(_a, ["resetClassName"]);
|
|
42
38
|
const isStandalone = !React.useContext(PopoverContext);
|
|
43
39
|
const contextProps = React.useContext(PlasmicPopoverContext);
|
|
44
|
-
const canvas = usePlasmicCanvasContext();
|
|
45
40
|
const mergedProps = mergeProps(contextProps, restProps, {
|
|
46
41
|
className: `${resetClassName}`
|
|
47
42
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
isOpen: true
|
|
56
|
-
})
|
|
57
|
-
));
|
|
58
|
-
} else {
|
|
59
|
-
return /* @__PURE__ */ React.createElement(Popover, __spreadProps(__spreadValues({}, mergedProps), { isNonModal: !!canvas }));
|
|
60
|
-
}
|
|
43
|
+
const triggerRef = React.useRef(null);
|
|
44
|
+
const standaloneProps = isStandalone ? {
|
|
45
|
+
triggerRef,
|
|
46
|
+
isNonModal: true,
|
|
47
|
+
isOpen: true
|
|
48
|
+
} : {};
|
|
49
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, isStandalone && /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(Popover, __spreadValues(__spreadValues({}, mergedProps), standaloneProps)));
|
|
61
50
|
}
|
|
62
51
|
function registerPopover(loader, overrides) {
|
|
63
52
|
registerComponentHelper(
|
|
@@ -93,20 +82,6 @@ function registerPopover(loader, overrides) {
|
|
|
93
82
|
resetClassName: {
|
|
94
83
|
type: "themeResetClass"
|
|
95
84
|
}
|
|
96
|
-
// className: {
|
|
97
|
-
// type: "class",
|
|
98
|
-
// displayName: "Additional states",
|
|
99
|
-
// selectors: [
|
|
100
|
-
// {
|
|
101
|
-
// selector: ":self[data-entering]",
|
|
102
|
-
// label: "Entering",
|
|
103
|
-
// },
|
|
104
|
-
// {
|
|
105
|
-
// selector: ":self[data-exiting]",
|
|
106
|
-
// label: "Exiting",
|
|
107
|
-
// },
|
|
108
|
-
// ],
|
|
109
|
-
// },
|
|
110
85
|
},
|
|
111
86
|
styleSections: true
|
|
112
87
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerPopover.esm.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"registerPopover.esm.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":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeO,SAAS,YAAY,KAAyB,EAAA;AACnD,EAAA,MAAyC,YAAjC,EAhBV,cAAA,EAAA,GAgB2C,EAAd,EAAA,SAAA,GAAA,SAAA,CAAc,IAAd,CAAnB,gBAAA,CAAA,CAAA,CAAA;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,EAAM,MAAA,WAAA,GAAc,UAAW,CAAA,YAAA,EAAc,SAAW,EAAA;AAAA,IACtD,WAAW,CAAG,EAAA,cAAA,CAAA,CAAA;AAAA,GACf,CAAA,CAAA;AAED,EAAM,MAAA,UAAA,GAAa,KAAM,CAAA,MAAA,CAAY,IAAI,CAAA,CAAA;AAEzC,EAAA,MAAM,kBAAkB,YACpB,GAAA;AAAA,IACE,UAAA;AAAA,IACA,UAAY,EAAA,IAAA;AAAA,IACZ,MAAQ,EAAA,IAAA;AAAA,MAEV,EAAC,CAAA;AAEL,EACE,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EACG,YAAgB,oBAAA,KAAA,CAAA,aAAA,CAAC,KAAI,EAAA,EAAA,GAAA,EAAK,UAAY,EAAA,CAAA,kBACtC,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,cAAA,CAAA,cAAA,CAAA,EAAA,EAAY,WAAiB,CAAA,EAAA,eAAA,CAAiB,CACjD,CAAA,CAAA;AAEJ,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,cAAA;AAAA,MACb,UAAY,EAAA,gDAAA;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;;;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var reactAriaComponents = require('react-aria-components');
|
|
5
5
|
var common = require('./common-e74a9214.cjs.js');
|
|
6
|
-
var interactionVariantUtils = require('./interaction-variant-utils-
|
|
6
|
+
var interactionVariantUtils = require('./interaction-variant-utils-0f05190f.cjs.js');
|
|
7
7
|
var utils = require('./utils-18b2465b.cjs.js');
|
|
8
8
|
require('@plasmicapp/host/registerComponent');
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import { Radio, RadioGroup } from 'react-aria-components';
|
|
3
3
|
import { g as getCommonInputProps } from './common-52c26d37.esm.js';
|
|
4
|
-
import { p as pickAriaComponentVariants } from './interaction-variant-utils-
|
|
4
|
+
import { p as pickAriaComponentVariants } from './interaction-variant-utils-909267e5.esm.js';
|
|
5
5
|
import { r as registerComponentHelper, m as makeComponentName } from './utils-cf2632c9.esm.js';
|
|
6
6
|
import '@plasmicapp/host/registerComponent';
|
|
7
7
|
|
|
@@ -9,7 +9,7 @@ var registerRadio = require('./registerRadio.cjs.js');
|
|
|
9
9
|
var utils = require('./utils-18b2465b.cjs.js');
|
|
10
10
|
require('./registerText.cjs.js');
|
|
11
11
|
require('react');
|
|
12
|
-
require('./interaction-variant-utils-
|
|
12
|
+
require('./interaction-variant-utils-0f05190f.cjs.js');
|
|
13
13
|
require('@plasmicapp/host/registerComponent');
|
|
14
14
|
|
|
15
15
|
var __defProp = Object.defineProperty;
|
|
@@ -7,7 +7,7 @@ import { registerRadio } from './registerRadio.esm.js';
|
|
|
7
7
|
import { r as registerComponentHelper, a as makeChildComponentName, m as makeComponentName } from './utils-cf2632c9.esm.js';
|
|
8
8
|
import './registerText.esm.js';
|
|
9
9
|
import 'react';
|
|
10
|
-
import './interaction-variant-utils-
|
|
10
|
+
import './interaction-variant-utils-909267e5.esm.js';
|
|
11
11
|
import '@plasmicapp/host/registerComponent';
|
|
12
12
|
|
|
13
13
|
var __defProp = Object.defineProperty;
|
|
@@ -12,41 +12,12 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
12
12
|
|
|
13
13
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
14
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
15
|
function BaseSection(props) {
|
|
44
16
|
const contextProps = React__default.default.useContext(contexts.PlasmicSectionContext);
|
|
45
17
|
const mergedProps = utils.mergeProps(contextProps, props);
|
|
46
|
-
const
|
|
47
|
-
return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Section,
|
|
48
|
-
|
|
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));
|
|
18
|
+
const { section, renderHeader, key, renderItem } = mergedProps;
|
|
19
|
+
return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Section, { id: key }, /* @__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) => {
|
|
20
|
+
return /* @__PURE__ */ React__default.default.createElement(contexts.PlasmicItemContext.Provider, { value: item }, renderItem == null ? void 0 : renderItem(item));
|
|
50
21
|
}));
|
|
51
22
|
}
|
|
52
23
|
function registerSection(loader, overrides) {
|
|
@@ -62,7 +33,7 @@ function registerSection(loader, overrides) {
|
|
|
62
33
|
renderHeader: {
|
|
63
34
|
type: "slot",
|
|
64
35
|
displayName: "Render section header",
|
|
65
|
-
renderPropParams: ["
|
|
36
|
+
renderPropParams: ["sectionProps"]
|
|
66
37
|
}
|
|
67
38
|
}
|
|
68
39
|
},
|
|
@@ -1 +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 {
|
|
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 {\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 ListBox\n renderItem?: (item?: any) => React.ReactNode;\n key?: Key;\n section?: StrictSectionType;\n}\n\nexport function BaseSection(props: BaseSectionProps) {\n const contextProps = React.useContext(PlasmicSectionContext);\n const mergedProps = mergeProps(contextProps, props);\n const { section, renderHeader, key, renderItem } = mergedProps;\n\n return (\n <Section id={key}>\n <PlasmicHeaderContext.Provider value={{ children: section?.label }}>\n {renderHeader?.(section)}\n </PlasmicHeaderContext.Provider>\n <Collection items={section?.items}>\n {(item) => {\n return (\n <PlasmicItemContext.Provider value={item}>\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: \"Aria Section\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSection\",\n importName: \"BaseSection\",\n props: {\n renderHeader: {\n type: \"slot\",\n displayName: \"Render section header\",\n renderPropParams: [\"sectionProps\"],\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":";;;;;;;;;;;;;;AA6BO,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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XD,0BAAkB,SAAS,CAAA;AAAA,GAC7B,CAAA;AAEA,EAAAE,6BAAA,CAAe,MAAQ,EAAA;AAAA,IACrB,mBAAqB,EAAA,QAAA;AAAA,GACtB,CAAA,CAAA;AACH;;;;;"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Key } from "react-aria-components";
|
|
3
3
|
import type { StrictSectionType } from "./option-utils";
|
|
4
|
-
import { BaseListBoxItem } from "./registerListBoxItem";
|
|
5
4
|
import { CodeComponentMetaOverrides, Registerable, Styleable } from "./utils";
|
|
6
5
|
export interface BaseSectionProps extends Styleable {
|
|
7
6
|
renderHeader?: (section: any) => React.ReactNode;
|
|
7
|
+
renderItem?: (item?: any) => React.ReactNode;
|
|
8
8
|
key?: Key;
|
|
9
9
|
section?: StrictSectionType;
|
|
10
|
-
makeItemProps?: (item: any) => Partial<React.ComponentProps<typeof BaseListBoxItem>>;
|
|
11
|
-
renderItem?: (item?: any) => React.ReactNode;
|
|
12
10
|
}
|
|
13
11
|
export declare function BaseSection(props: BaseSectionProps): React.JSX.Element;
|
|
14
12
|
export declare function registerSection(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BaseSection>): void;
|
|
@@ -6,41 +6,12 @@ import { registerHeader } from './registerHeader.esm.js';
|
|
|
6
6
|
import { r as registerComponentHelper, a as makeChildComponentName, m as makeComponentName } from './utils-cf2632c9.esm.js';
|
|
7
7
|
import '@plasmicapp/host/registerComponent';
|
|
8
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
9
|
function BaseSection(props) {
|
|
38
10
|
const contextProps = React.useContext(PlasmicSectionContext);
|
|
39
11
|
const mergedProps = mergeProps(contextProps, props);
|
|
40
|
-
const
|
|
41
|
-
return /* @__PURE__ */ React.createElement(Section,
|
|
42
|
-
|
|
43
|
-
return /* @__PURE__ */ React.createElement(PlasmicItemContext.Provider, { key: itemProps == null ? void 0 : itemProps.key, value: itemProps }, renderItem == null ? void 0 : renderItem(item));
|
|
12
|
+
const { section, renderHeader, key, renderItem } = mergedProps;
|
|
13
|
+
return /* @__PURE__ */ React.createElement(Section, { id: key }, /* @__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) => {
|
|
14
|
+
return /* @__PURE__ */ React.createElement(PlasmicItemContext.Provider, { value: item }, renderItem == null ? void 0 : renderItem(item));
|
|
44
15
|
}));
|
|
45
16
|
}
|
|
46
17
|
function registerSection(loader, overrides) {
|
|
@@ -56,7 +27,7 @@ function registerSection(loader, overrides) {
|
|
|
56
27
|
renderHeader: {
|
|
57
28
|
type: "slot",
|
|
58
29
|
displayName: "Render section header",
|
|
59
|
-
renderPropParams: ["
|
|
30
|
+
renderPropParams: ["sectionProps"]
|
|
60
31
|
}
|
|
61
32
|
}
|
|
62
33
|
},
|
|
@@ -1 +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 {
|
|
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 {\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 ListBox\n renderItem?: (item?: any) => React.ReactNode;\n key?: Key;\n section?: StrictSectionType;\n}\n\nexport function BaseSection(props: BaseSectionProps) {\n const contextProps = React.useContext(PlasmicSectionContext);\n const mergedProps = mergeProps(contextProps, props);\n const { section, renderHeader, key, renderItem } = mergedProps;\n\n return (\n <Section id={key}>\n <PlasmicHeaderContext.Provider value={{ children: section?.label }}>\n {renderHeader?.(section)}\n </PlasmicHeaderContext.Provider>\n <Collection items={section?.items}>\n {(item) => {\n return (\n <PlasmicItemContext.Provider value={item}>\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: \"Aria Section\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSection\",\n importName: \"BaseSection\",\n props: {\n renderHeader: {\n type: \"slot\",\n displayName: \"Render section header\",\n renderPropParams: [\"sectionProps\"],\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":";;;;;;;;AA6BO,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,MAAM,EAAE,OAAA,EAAS,YAAc,EAAA,GAAA,EAAK,YAAe,GAAA,WAAA,CAAA;AAEnD,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,EAAI,EAAA,GAAA,EAAA,sCACV,oBAAqB,CAAA,QAAA,EAArB,EAA8B,KAAA,EAAO,EAAE,QAAA,EAAU,mCAAS,KAAM,EAAA,EAAA,EAC9D,YAAe,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,YAAA,CAAA,OAAA,CAClB,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,KAAO,EAAA,OAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,OAAA,CAAS,KACzB,EAAA,EAAA,CAAC,IAAS,KAAA;AACT,IAAA,2CACG,kBAAmB,CAAA,QAAA,EAAnB,EAA4B,KAAO,EAAA,IAAA,EAAA,EACjC,yCAAa,IAChB,CAAA,CAAA,CAAA;AAAA,GAGN,CACF,CAAA,CAAA;AAEJ,CAAA;AAEgB,SAAA,eAAA,CACd,QACA,SACA,EAAA;AACA,EAAA,uBAAA;AAAA,IACE,MAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,MACE,IAAA,EAAM,kBAAkB,SAAS,CAAA;AAAA,MACjC,WAAa,EAAA,cAAA;AAAA,MACb,UAAY,EAAA,gDAAA;AAAA,MACZ,UAAY,EAAA,aAAA;AAAA,MACZ,KAAO,EAAA;AAAA,QACL,YAAc,EAAA;AAAA,UACZ,IAAM,EAAA,MAAA;AAAA,UACN,WAAa,EAAA,uBAAA;AAAA,UACb,gBAAA,EAAkB,CAAC,cAAc,CAAA;AAAA,SACnC;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;;;;"}
|
|
@@ -4,7 +4,7 @@ var host = require('@plasmicapp/host');
|
|
|
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-
|
|
7
|
+
var optionUtils = require('./option-utils-5e4e85bd.cjs.js');
|
|
8
8
|
var utils = require('./utils-18b2465b.cjs.js');
|
|
9
9
|
require('@plasmicapp/host/registerComponent');
|
|
10
10
|
|
|
@@ -40,13 +40,12 @@ function BaseSelect(props) {
|
|
|
40
40
|
className,
|
|
41
41
|
style,
|
|
42
42
|
structure,
|
|
43
|
-
renderOption,
|
|
44
43
|
name,
|
|
45
44
|
"aria-label": ariaLabel
|
|
46
45
|
} = props;
|
|
47
|
-
const { options
|
|
46
|
+
const { options } = optionUtils.useStrictOptions(props);
|
|
48
47
|
const canvas = host.usePlasmicCanvasContext();
|
|
49
|
-
const disabledKeys = optionUtils.flattenOptions(options).filter((op) => op.isDisabled).map((op) => op.
|
|
48
|
+
const disabledKeys = optionUtils.flattenOptions(options).filter((op) => op.isDisabled).map((op) => op.id);
|
|
50
49
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
51
50
|
reactAriaComponents.Select,
|
|
52
51
|
__spreadValues(__spreadValues({
|
|
@@ -65,17 +64,7 @@ function BaseSelect(props) {
|
|
|
65
64
|
{
|
|
66
65
|
value: {
|
|
67
66
|
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"
|
|
67
|
+
disabledKeys
|
|
79
68
|
}
|
|
80
69
|
},
|
|
81
70
|
structure
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerSelect.cjs.js","sources":["../src/registerSelect.tsx"],"sourcesContent":["import { usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport {\n Key,\n Select,\n SelectValue as BaseSelectValue,\n} from \"react-aria-components\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport {\n flattenOptions,\n HasOptions,\n makeOptionsPropType,\n makeValuePropType,\n useStrictOptions,\n} from \"./option-utils\";\nimport {\n extractPlasmicDataProps,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n Styleable,\n} from \"./utils\";\n\nexport { BaseSelectValue };\n\nconst SELECT_NAME = makeComponentName(\"select\");\n\nexport interface BaseSelectProps<T extends object>\n extends HasOptions<T>,\n Styleable {\n placeholder?: string;\n isDisabled?: boolean;\n\n value?: Key;\n onChange?: (value: Key) => void;\n\n previewOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n\n structure?: React.ReactNode;\n\n name?: string;\n \"aria-label\"?: string;\n\n renderOption?: (item: {\n value: string;\n label?: string;\n isDisabled?: boolean;\n }) => React.ReactNode;\n}\n\nexport function BaseSelect<T extends object>(props: BaseSelectProps<T>) {\n const {\n value,\n onChange,\n placeholder,\n previewOpen,\n onOpenChange,\n isDisabled,\n className,\n style,\n structure,\n renderOption,\n name,\n \"aria-label\": ariaLabel,\n } = props;\n\n const { options, optionText } = useStrictOptions(props);\n\n const canvas = usePlasmicCanvasContext();\n\n const disabledKeys = flattenOptions(options)\n .filter((op) => op.isDisabled)\n .map((op) => op.value);\n\n return (\n <Select\n placeholder={placeholder}\n selectedKey={value}\n onSelectionChange={onChange}\n onOpenChange={onOpenChange}\n isDisabled={isDisabled}\n className={className}\n style={style}\n name={name}\n aria-label={ariaLabel}\n {...(previewOpen && canvas ? { isOpen: previewOpen } : undefined)}\n {...extractPlasmicDataProps(props)}\n >\n <PlasmicListBoxContext.Provider\n value={{\n items: options,\n disabledKeys: disabledKeys,\n makeItemProps: (item) => ({\n key: item.value,\n textValue: optionText(item),\n children: renderOption ? renderOption(item) : optionText(item),\n }),\n makeSectionProps: (section) => ({\n section,\n key: section.key,\n }),\n getItemType: (option) =>\n option.type === \"section\" ? \"section\" : \"item\",\n }}\n >\n {structure}\n </PlasmicListBoxContext.Provider>\n </Select>\n );\n}\n\nexport function registerSelect(loader?: Registerable) {\n registerComponentHelper(loader, BaseSelect, {\n name: SELECT_NAME,\n displayName: \"Aria Select\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSelect\",\n importName: \"BaseSelect\",\n props: {\n options: makeOptionsPropType(),\n placeholder: {\n type: \"string\",\n },\n isDisabled: {\n type: \"boolean\",\n },\n value: makeValuePropType(),\n onChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"value\", type: \"string\" }],\n },\n previewOpen: {\n type: \"boolean\",\n displayName: \"Preview opened?\",\n description: \"Preview opened state while designing in Plasmic editor\",\n editOnly: true,\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n // optionValue: {\n // type: \"string\",\n // displayName: \"Field key for an option's value\",\n // hidden: (ps) =>\n // !ps.options ||\n // !ps.options[0] ||\n // typeof ps.options[0] === \"string\" ||\n // \"value\" in ps.options[0],\n // exprHint:\n // \"Return a function that takes in an option object, and returns the key to use\",\n // },\n // optionText: {\n // type: \"string\",\n // displayName: \"Field key for an option's text value\",\n // hidden: (ps) =>\n // !ps.options ||\n // !ps.options[0] ||\n // typeof ps.options[0] === \"string\" ||\n // \"value\" in ps.options[0],\n // exprHint:\n // \"Return a function that takes in an option object, and returns the text value to use\",\n // },\n // optionDisabled: {\n // type: \"string\",\n // displayName: \"Field key for whether an option is disabled\",\n // hidden: (ps) =>\n // !ps.options ||\n // !ps.options[0] ||\n // typeof ps.options[0] === \"string\" ||\n // \"value\" in ps.options[0],\n // exprHint:\n // \"Return a function that takes in an option object, and returns true if option should be disabled\",\n // },\n\n structure: {\n type: \"slot\",\n },\n\n // renderOption: {\n // type: \"slot\",\n // displayName: \"Custom render option\",\n // renderPropParams: [\"item\"],\n // hidePlaceholder: true\n // },\n\n name: {\n type: \"string\",\n displayName: \"Form field key\",\n description: \"Name of the input, when submitting in an HTML form\",\n advanced: true,\n },\n\n \"aria-label\": {\n type: \"string\",\n displayName: \"Aria Label\",\n description: \"Label for this input, if no visible label is used\",\n advanced: true,\n },\n },\n states: {\n value: {\n type: \"writable\",\n valueProp: \"value\",\n onChangeProp: \"onChange\",\n variableType: \"text\",\n },\n isOpen: {\n type: \"readonly\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n });\n\n registerComponentHelper(loader, BaseSelectValue, {\n name: makeComponentName(\"select-value\"),\n displayName: \"Aria Selected Value\",\n importPath: \"@plasmicpkgs/react-aria/registerSelect\",\n importName: \"SelectValue\",\n parentComponentName: SELECT_NAME,\n props: {\n className: {\n type: \"class\",\n selectors: [\n {\n selector: \":self[data-placeholder]\",\n label: \"Placeholder\",\n },\n ],\n },\n },\n });\n}\n"],"names":["makeComponentName","useStrictOptions","usePlasmicCanvasContext","flattenOptions","React","Select","extractPlasmicDataProps","PlasmicListBoxContext","registerComponentHelper","makeOptionsPropType","makeValuePropType","BaseSelectValue"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAM,WAAA,GAAcA,wBAAkB,QAAQ,CAAA,CAAA;AA0BvC,SAAS,WAA6B,KAA2B,EAAA;AACtE,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,IACA,SAAA;AAAA,IACA,YAAA;AAAA,IACA,IAAA;AAAA,IACA,YAAc,EAAA,SAAA;AAAA,GACZ,GAAA,KAAA,CAAA;AAEJ,EAAA,MAAM,EAAE,OAAA,EAAS,UAAW,EAAA,GAAIC,6BAAiB,KAAK,CAAA,CAAA;AAEtD,EAAA,MAAM,SAASC,4BAAwB,EAAA,CAAA;AAEvC,EAAA,MAAM,YAAe,GAAAC,0BAAA,CAAe,OAAO,CAAA,CACxC,OAAO,CAAC,EAAA,KAAO,EAAG,CAAA,UAAU,CAC5B,CAAA,GAAA,CAAI,CAAC,EAAA,KAAO,GAAG,KAAK,CAAA,CAAA;AAEvB,EACE,uBAAAC,sBAAA,CAAA,aAAA;AAAA,IAACC,0BAAA;AAAA,IAAA,cAAA,CAAA,cAAA,CAAA;AAAA,MACC,WAAA;AAAA,M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AAA;AAAA,QACN,SAAW,EAAA,OAAA;AAAA,QACX,YAAc,EAAA,UAAA;AAAA,QACd,YAAc,EAAA,MAAA;AAAA,OAChB;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,IAAM,EAAA,UAAA;AAAA,QACN,YAAc,EAAA,cAAA;AAAA,QACd,YAAc,EAAA,SAAA;AAAA,OAChB;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AAED,EAAAF,6BAAA,CAAwB,QAAQG,+BAAiB,EAAA;AAAA,IAC/C,IAAA,EAAMX,wBAAkB,cAAc,CAAA;AAAA,IACtC,WAAa,EAAA,qBAAA;AAAA,IACb,UAAY,EAAA,wCAAA;AAAA,IACZ,UAAY,EAAA,aAAA;AAAA,IACZ,mBAAqB,EAAA,WAAA;AAAA,IACrB,KAAO,EAAA;AAAA,MACL,SAAW,EAAA;AAAA,QACT,IAAM,EAAA,OAAA;AAAA,QACN,SAAW,EAAA;AAAA,UACT;AAAA,YACE,QAAU,EAAA,yBAAA;AAAA,YACV,KAAO,EAAA,aAAA;AAAA,WACT;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"registerSelect.cjs.js","sources":["../src/registerSelect.tsx"],"sourcesContent":["import { usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport {\n SelectValue as BaseSelectValue,\n Key,\n Select,\n} from \"react-aria-components\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport {\n flattenOptions,\n HasOptions,\n makeOptionsPropType,\n makeValuePropType,\n useStrictOptions,\n} from \"./option-utils\";\nimport {\n extractPlasmicDataProps,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n Styleable,\n} from \"./utils\";\n\nexport { BaseSelectValue };\n\nconst SELECT_NAME = makeComponentName(\"select\");\n\nexport interface BaseSelectProps<T extends object>\n extends HasOptions<T>,\n Styleable {\n placeholder?: string;\n isDisabled?: boolean;\n\n value?: Key;\n onChange?: (value: Key) => void;\n\n previewOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n\n structure?: React.ReactNode;\n\n name?: string;\n \"aria-label\"?: string;\n\n renderOption?: (item: {\n value: string;\n label?: string;\n isDisabled?: boolean;\n }) => React.ReactNode;\n}\n\nexport function BaseSelect<T extends object>(props: BaseSelectProps<T>) {\n const {\n value,\n onChange,\n placeholder,\n previewOpen,\n onOpenChange,\n isDisabled,\n className,\n style,\n structure,\n name,\n \"aria-label\": ariaLabel,\n } = props;\n\n const { options } = useStrictOptions(props);\n\n const canvas = usePlasmicCanvasContext();\n\n const disabledKeys = flattenOptions(options)\n .filter((op) => op.isDisabled)\n .map((op) => op.id);\n\n return (\n <Select\n placeholder={placeholder}\n selectedKey={value}\n onSelectionChange={onChange}\n onOpenChange={onOpenChange}\n isDisabled={isDisabled}\n className={className}\n style={style}\n name={name}\n aria-label={ariaLabel}\n {...(previewOpen && canvas ? { isOpen: previewOpen } : undefined)}\n {...extractPlasmicDataProps(props)}\n >\n <PlasmicListBoxContext.Provider\n value={{\n items: options,\n disabledKeys: disabledKeys,\n }}\n >\n {structure}\n </PlasmicListBoxContext.Provider>\n </Select>\n );\n}\n\nexport function registerSelect(loader?: Registerable) {\n registerComponentHelper(loader, BaseSelect, {\n name: SELECT_NAME,\n displayName: \"Aria Select\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSelect\",\n importName: \"BaseSelect\",\n props: {\n options: makeOptionsPropType(),\n placeholder: {\n type: \"string\",\n },\n isDisabled: {\n type: \"boolean\",\n },\n value: makeValuePropType(),\n onChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"value\", type: \"string\" }],\n },\n previewOpen: {\n type: \"boolean\",\n displayName: \"Preview opened?\",\n description: \"Preview opened state while designing in Plasmic editor\",\n editOnly: true,\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n // optionValue: {\n // type: \"string\",\n // displayName: \"Field key for an option's value\",\n // hidden: (ps) =>\n // !ps.options ||\n // !ps.options[0] ||\n // typeof ps.options[0] === \"string\" ||\n // \"value\" in ps.options[0],\n // exprHint:\n // \"Return a function that takes in an option object, and returns the key to use\",\n // },\n // optionText: {\n // type: \"string\",\n // displayName: \"Field key for an option's text value\",\n // hidden: (ps) =>\n // !ps.options ||\n // !ps.options[0] ||\n // typeof ps.options[0] === \"string\" ||\n // \"value\" in ps.options[0],\n // exprHint:\n // \"Return a function that takes in an option object, and returns the text value to use\",\n // },\n // optionDisabled: {\n // type: \"string\",\n // displayName: \"Field key for whether an option is disabled\",\n // hidden: (ps) =>\n // !ps.options ||\n // !ps.options[0] ||\n // typeof ps.options[0] === \"string\" ||\n // \"value\" in ps.options[0],\n // exprHint:\n // \"Return a function that takes in an option object, and returns true if option should be disabled\",\n // },\n\n structure: {\n type: \"slot\",\n },\n\n // renderOption: {\n // type: \"slot\",\n // displayName: \"Custom render option\",\n // renderPropParams: [\"item\"],\n // hidePlaceholder: true\n // },\n\n name: {\n type: \"string\",\n displayName: \"Form field key\",\n description: \"Name of the input, when submitting in an HTML form\",\n advanced: true,\n },\n\n \"aria-label\": {\n type: \"string\",\n displayName: \"Aria Label\",\n description: \"Label for this input, if no visible label is used\",\n advanced: true,\n },\n },\n states: {\n value: {\n type: \"writable\",\n valueProp: \"value\",\n onChangeProp: \"onChange\",\n variableType: \"text\",\n },\n isOpen: {\n type: \"readonly\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n });\n\n registerComponentHelper(loader, BaseSelectValue, {\n name: makeComponentName(\"select-value\"),\n displayName: \"Aria Selected Value\",\n importPath: \"@plasmicpkgs/react-aria/registerSelect\",\n importName: \"SelectValue\",\n parentComponentName: SELECT_NAME,\n props: {\n className: {\n type: \"class\",\n selectors: [\n {\n selector: \":self[data-placeholder]\",\n label: \"Placeholder\",\n },\n ],\n },\n },\n });\n}\n"],"names":["makeComponentName","useStrictOptions","usePlasmicCanvasContext","flattenOptions","React","Select","extractPlasmicDataProps","PlasmicListBoxContext","registerComponentHelper","makeOptionsPropType","makeValuePropType","BaseSelectValue"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAM,WAAA,GAAcA,wBAAkB,QAAQ,CAAA,CAAA;AA0BvC,SAAS,WAA6B,KAA2B,EAAA;AACtE,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,IACA,SAAA;AAAA,IACA,IAAA;AAAA,IACA,YAAc,EAAA,SAAA;AAAA,GACZ,GAAA,KAAA,CAAA;AAEJ,EAAA,MAAM,EAAE,OAAA,EAAY,GAAAC,4BAAA,CAAiB,KAAK,CAAA,CAAA;AAE1C,EAAA,MAAM,SAASC,4BAAwB,EAAA,CAAA;AAEvC,EAAA,MAAM,YAAe,GAAAC,0BAAA,CAAe,OAAO,CAAA,CACxC,OAAO,CAAC,EAAA,KAAO,EAAG,CAAA,UAAU,CAC5B,CAAA,GAAA,CAAI,CAAC,EAAA,KAAO,GAAG,EAAE,CAAA,CAAA;AAEpB,EACE,uBAAAC,sBAAA,CAAA,aAAA;AAAA,IAACC,0BAAA;AAAA,IAAA,cAAA,CAAA,cAAA,CAAA;AAAA,MACC,WAAA;AAAA,MACA,WAAa,EAAA,KAAA;AAAA,MACb,iBAAmB,EAAA,QAAA;AAAA,MACnB,YAAA;AAAA,MACA,UAAA;AAAA,MACA,SAAA;AAAA,MACA,KAAA;AAAA,MACA,IAAA;AAAA,MACA,YAAY,EAAA,SAAA;AAAA,KACP,EAAA,WAAA,IAAe,SAAS,EAAE,MAAA,EAAQ,aAAgB,GAAA,KAAA,CAAA,CAAA,EACnDC,8BAAwB,KAAK,CAAA,CAAA;AAAA,oBAEjCF,sBAAA,CAAA,aAAA;AAAA,MAACG,8BAAsB,CAAA,QAAA;AAA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react";
|
|
2
|
-
import {
|
|
2
|
+
import { SelectValue as BaseSelectValue, Key } from "react-aria-components";
|
|
3
3
|
import { HasOptions } from "./option-utils";
|
|
4
4
|
import { Registerable, Styleable } from "./utils";
|
|
5
5
|
export { BaseSelectValue };
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { Select, SelectValue } from 'react-aria-components';
|
|
4
4
|
export { SelectValue as BaseSelectValue } from 'react-aria-components';
|
|
5
5
|
import { P as PlasmicListBoxContext } from './contexts-49f6c298.esm.js';
|
|
6
|
-
import { u as useStrictOptions, f as flattenOptions, m as makeOptionsPropType, a as makeValuePropType } from './option-utils-
|
|
6
|
+
import { u as useStrictOptions, f as flattenOptions, m as makeOptionsPropType, a as makeValuePropType } from './option-utils-4f037568.esm.js';
|
|
7
7
|
import { e as extractPlasmicDataProps, r as registerComponentHelper, m as makeComponentName } from './utils-cf2632c9.esm.js';
|
|
8
8
|
import '@plasmicapp/host/registerComponent';
|
|
9
9
|
|
|
@@ -35,13 +35,12 @@ function BaseSelect(props) {
|
|
|
35
35
|
className,
|
|
36
36
|
style,
|
|
37
37
|
structure,
|
|
38
|
-
renderOption,
|
|
39
38
|
name,
|
|
40
39
|
"aria-label": ariaLabel
|
|
41
40
|
} = props;
|
|
42
|
-
const { options
|
|
41
|
+
const { options } = useStrictOptions(props);
|
|
43
42
|
const canvas = usePlasmicCanvasContext();
|
|
44
|
-
const disabledKeys = flattenOptions(options).filter((op) => op.isDisabled).map((op) => op.
|
|
43
|
+
const disabledKeys = flattenOptions(options).filter((op) => op.isDisabled).map((op) => op.id);
|
|
45
44
|
return /* @__PURE__ */ React.createElement(
|
|
46
45
|
Select,
|
|
47
46
|
__spreadValues(__spreadValues({
|
|
@@ -60,17 +59,7 @@ function BaseSelect(props) {
|
|
|
60
59
|
{
|
|
61
60
|
value: {
|
|
62
61
|
items: options,
|
|
63
|
-
disabledKeys
|
|
64
|
-
makeItemProps: (item) => ({
|
|
65
|
-
key: item.value,
|
|
66
|
-
textValue: optionText(item),
|
|
67
|
-
children: renderOption ? renderOption(item) : optionText(item)
|
|
68
|
-
}),
|
|
69
|
-
makeSectionProps: (section) => ({
|
|
70
|
-
section,
|
|
71
|
-
key: section.key
|
|
72
|
-
}),
|
|
73
|
-
getItemType: (option) => option.type === "section" ? "section" : "item"
|
|
62
|
+
disabledKeys
|
|
74
63
|
}
|
|
75
64
|
},
|
|
76
65
|
structure
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerSelect.esm.js","sources":["../src/registerSelect.tsx"],"sourcesContent":["import { usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport {\n
|
|
1
|
+
{"version":3,"file":"registerSelect.esm.js","sources":["../src/registerSelect.tsx"],"sourcesContent":["import { usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport {\n SelectValue as BaseSelectValue,\n Key,\n Select,\n} from \"react-aria-components\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport {\n flattenOptions,\n HasOptions,\n makeOptionsPropType,\n makeValuePropType,\n useStrictOptions,\n} from \"./option-utils\";\nimport {\n extractPlasmicDataProps,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n Styleable,\n} from \"./utils\";\n\nexport { BaseSelectValue };\n\nconst SELECT_NAME = makeComponentName(\"select\");\n\nexport interface BaseSelectProps<T extends object>\n extends HasOptions<T>,\n Styleable {\n placeholder?: string;\n isDisabled?: boolean;\n\n value?: Key;\n onChange?: (value: Key) => void;\n\n previewOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n\n structure?: React.ReactNode;\n\n name?: string;\n \"aria-label\"?: string;\n\n renderOption?: (item: {\n value: string;\n label?: string;\n isDisabled?: boolean;\n }) => React.ReactNode;\n}\n\nexport function BaseSelect<T extends object>(props: BaseSelectProps<T>) {\n const {\n value,\n onChange,\n placeholder,\n previewOpen,\n onOpenChange,\n isDisabled,\n className,\n style,\n structure,\n name,\n \"aria-label\": ariaLabel,\n } = props;\n\n const { options } = useStrictOptions(props);\n\n const canvas = usePlasmicCanvasContext();\n\n const disabledKeys = flattenOptions(options)\n .filter((op) => op.isDisabled)\n .map((op) => op.id);\n\n return (\n <Select\n placeholder={placeholder}\n selectedKey={value}\n onSelectionChange={onChange}\n onOpenChange={onOpenChange}\n isDisabled={isDisabled}\n className={className}\n style={style}\n name={name}\n aria-label={ariaLabel}\n {...(previewOpen && canvas ? { isOpen: previewOpen } : undefined)}\n {...extractPlasmicDataProps(props)}\n >\n <PlasmicListBoxContext.Provider\n value={{\n items: options,\n disabledKeys: disabledKeys,\n }}\n >\n {structure}\n </PlasmicListBoxContext.Provider>\n </Select>\n );\n}\n\nexport function registerSelect(loader?: Registerable) {\n registerComponentHelper(loader, BaseSelect, {\n name: SELECT_NAME,\n displayName: \"Aria Select\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSelect\",\n importName: \"BaseSelect\",\n props: {\n options: makeOptionsPropType(),\n placeholder: {\n type: \"string\",\n },\n isDisabled: {\n type: \"boolean\",\n },\n value: makeValuePropType(),\n onChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"value\", type: \"string\" }],\n },\n previewOpen: {\n type: \"boolean\",\n displayName: \"Preview opened?\",\n description: \"Preview opened state while designing in Plasmic editor\",\n editOnly: true,\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n // optionValue: {\n // type: \"string\",\n // displayName: \"Field key for an option's value\",\n // hidden: (ps) =>\n // !ps.options ||\n // !ps.options[0] ||\n // typeof ps.options[0] === \"string\" ||\n // \"value\" in ps.options[0],\n // exprHint:\n // \"Return a function that takes in an option object, and returns the key to use\",\n // },\n // optionText: {\n // type: \"string\",\n // displayName: \"Field key for an option's text value\",\n // hidden: (ps) =>\n // !ps.options ||\n // !ps.options[0] ||\n // typeof ps.options[0] === \"string\" ||\n // \"value\" in ps.options[0],\n // exprHint:\n // \"Return a function that takes in an option object, and returns the text value to use\",\n // },\n // optionDisabled: {\n // type: \"string\",\n // displayName: \"Field key for whether an option is disabled\",\n // hidden: (ps) =>\n // !ps.options ||\n // !ps.options[0] ||\n // typeof ps.options[0] === \"string\" ||\n // \"value\" in ps.options[0],\n // exprHint:\n // \"Return a function that takes in an option object, and returns true if option should be disabled\",\n // },\n\n structure: {\n type: \"slot\",\n },\n\n // renderOption: {\n // type: \"slot\",\n // displayName: \"Custom render option\",\n // renderPropParams: [\"item\"],\n // hidePlaceholder: true\n // },\n\n name: {\n type: \"string\",\n displayName: \"Form field key\",\n description: \"Name of the input, when submitting in an HTML form\",\n advanced: true,\n },\n\n \"aria-label\": {\n type: \"string\",\n displayName: \"Aria Label\",\n description: \"Label for this input, if no visible label is used\",\n advanced: true,\n },\n },\n states: {\n value: {\n type: \"writable\",\n valueProp: \"value\",\n onChangeProp: \"onChange\",\n variableType: \"text\",\n },\n isOpen: {\n type: \"readonly\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n });\n\n registerComponentHelper(loader, BaseSelectValue, {\n name: makeComponentName(\"select-value\"),\n displayName: \"Aria Selected Value\",\n importPath: \"@plasmicpkgs/react-aria/registerSelect\",\n importName: \"SelectValue\",\n parentComponentName: SELECT_NAME,\n props: {\n className: {\n type: \"class\",\n selectors: [\n {\n selector: \":self[data-placeholder]\",\n label: \"Placeholder\",\n },\n ],\n },\n },\n });\n}\n"],"names":["BaseSelectValue"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAM,WAAA,GAAc,kBAAkB,QAAQ,CAAA,CAAA;AA0BvC,SAAS,WAA6B,KAA2B,EAAA;AACtE,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,IACA,SAAA;AAAA,IACA,IAAA;AAAA,IACA,YAAc,EAAA,SAAA;A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IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,OAAA;AAAA,QACX,YAAc,EAAA,UAAA;AAAA,QACd,YAAc,EAAA,MAAA;AAAA,OAChB;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,IAAM,EAAA,UAAA;AAAA,QACN,YAAc,EAAA,cAAA;AAAA,QACd,YAAc,EAAA,SAAA;AAAA,OAChB;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AAED,EAAA,uBAAA,CAAwB,QAAQA,WAAiB,EAAA;AAAA,IAC/C,IAAA,EAAM,kBAAkB,cAAc,CAAA;AAAA,IACtC,WAAa,EAAA,qBAAA;AAAA,IACb,UAAY,EAAA,wCAAA;AAAA,IACZ,UAAY,EAAA,aAAA;AAAA,IACZ,mBAAqB,EAAA,WAAA;AAAA,IACrB,KAAO,EAAA;AAAA,MACL,SAAW,EAAA;AAAA,QACT,IAAM,EAAA,OAAA;AAAA,QACN,SAAW,EAAA;AAAA,UACT;AAAA,YACE,QAAU,EAAA,yBAAA;AAAA,YACV,KAAO,EAAA,aAAA;AAAA,WACT;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var reactAriaComponents = require('react-aria-components');
|
|
5
5
|
var common = require('./common-e74a9214.cjs.js');
|
|
6
|
-
var interactionVariantUtils = require('./interaction-variant-utils-
|
|
6
|
+
var interactionVariantUtils = require('./interaction-variant-utils-0f05190f.cjs.js');
|
|
7
7
|
var utils = require('./utils-18b2465b.cjs.js');
|
|
8
8
|
require('@plasmicapp/host/registerComponent');
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Switch } from 'react-aria-components';
|
|
3
3
|
import { g as getCommonInputProps } from './common-52c26d37.esm.js';
|
|
4
|
-
import { p as pickAriaComponentVariants } from './interaction-variant-utils-
|
|
4
|
+
import { p as pickAriaComponentVariants } from './interaction-variant-utils-909267e5.esm.js';
|
|
5
5
|
import { r as registerComponentHelper, m as makeComponentName } from './utils-cf2632c9.esm.js';
|
|
6
6
|
import '@plasmicapp/host/registerComponent';
|
|
7
7
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var reactAriaComponents = require('react-aria-components');
|
|
5
|
-
var interactionVariantUtils = require('./interaction-variant-utils-
|
|
5
|
+
var interactionVariantUtils = require('./interaction-variant-utils-0f05190f.cjs.js');
|
|
6
6
|
var utils = require('./utils-18b2465b.cjs.js');
|
|
7
7
|
require('@plasmicapp/host/registerComponent');
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TextArea } from 'react-aria-components';
|
|
3
|
-
import { p as pickAriaComponentVariants } from './interaction-variant-utils-
|
|
3
|
+
import { p as pickAriaComponentVariants } from './interaction-variant-utils-909267e5.esm.js';
|
|
4
4
|
import { r as registerComponentHelper, m as makeComponentName } from './utils-cf2632c9.esm.js';
|
|
5
5
|
import '@plasmicapp/host/registerComponent';
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ var registerLabel = require('./registerLabel.cjs.js');
|
|
|
10
10
|
var registerTextArea = require('./registerTextArea.cjs.js');
|
|
11
11
|
var utils = require('./utils-18b2465b.cjs.js');
|
|
12
12
|
require('./registerText.cjs.js');
|
|
13
|
-
require('./interaction-variant-utils-
|
|
13
|
+
require('./interaction-variant-utils-0f05190f.cjs.js');
|
|
14
14
|
require('@plasmicapp/host/registerComponent');
|
|
15
15
|
|
|
16
16
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -8,7 +8,7 @@ import { registerLabel } from './registerLabel.esm.js';
|
|
|
8
8
|
import { registerTextArea } from './registerTextArea.esm.js';
|
|
9
9
|
import { r as registerComponentHelper, a as makeChildComponentName, m as makeComponentName } from './utils-cf2632c9.esm.js';
|
|
10
10
|
import './registerText.esm.js';
|
|
11
|
-
import './interaction-variant-utils-
|
|
11
|
+
import './interaction-variant-utils-909267e5.esm.js';
|
|
12
12
|
import '@plasmicapp/host/registerComponent';
|
|
13
13
|
|
|
14
14
|
var __defProp = Object.defineProperty;
|