@plasmicpkgs/react-aria 0.0.63 → 0.0.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/react-aria.esm.js +92 -68
- package/dist/react-aria.esm.js.map +1 -1
- package/dist/react-aria.js +91 -67
- package/dist/react-aria.js.map +1 -1
- package/dist/registerDialogTrigger.d.ts +2 -2
- package/dist/registerSelect.d.ts +0 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +2 -2
- package/skinny/registerComboBox.cjs.js +19 -2
- package/skinny/registerComboBox.cjs.js.map +1 -1
- package/skinny/registerComboBox.esm.js +20 -3
- package/skinny/registerComboBox.esm.js.map +1 -1
- package/skinny/registerDialogTrigger.cjs.js +12 -3
- package/skinny/registerDialogTrigger.cjs.js.map +1 -1
- package/skinny/registerDialogTrigger.d.ts +2 -2
- package/skinny/registerDialogTrigger.esm.js +12 -3
- package/skinny/registerDialogTrigger.esm.js.map +1 -1
- package/skinny/registerListBoxItem.cjs.js +4 -2
- package/skinny/registerListBoxItem.cjs.js.map +1 -1
- package/skinny/registerListBoxItem.esm.js +4 -2
- package/skinny/registerListBoxItem.esm.js.map +1 -1
- package/skinny/registerModal.cjs.js +4 -2
- package/skinny/registerModal.cjs.js.map +1 -1
- package/skinny/registerModal.esm.js +5 -3
- package/skinny/registerModal.esm.js.map +1 -1
- package/skinny/registerPopover.cjs.js +5 -0
- package/skinny/registerPopover.cjs.js.map +1 -1
- package/skinny/registerPopover.esm.js +5 -0
- package/skinny/registerPopover.esm.js.map +1 -1
- package/skinny/registerSelect.cjs.js +5 -12
- package/skinny/registerSelect.cjs.js.map +1 -1
- package/skinny/registerSelect.d.ts +0 -1
- package/skinny/registerSelect.esm.js +6 -13
- package/skinny/registerSelect.esm.js.map +1 -1
- package/skinny/registerTooltip.cjs.js +7 -10
- package/skinny/registerTooltip.cjs.js.map +1 -1
- package/skinny/registerTooltip.esm.js +7 -10
- package/skinny/registerTooltip.esm.js.map +1 -1
- package/skinny/utils-8dbb4d1f.cjs.js.map +1 -1
- package/skinny/utils-c7662a47.esm.js.map +1 -1
- package/skinny/utils.d.ts +1 -1
|
@@ -2,8 +2,8 @@ import React from "react";
|
|
|
2
2
|
import { DialogTrigger } from "react-aria-components";
|
|
3
3
|
import { CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
4
4
|
export interface BaseDialogTriggerProps extends React.ComponentProps<typeof DialogTrigger> {
|
|
5
|
-
trigger
|
|
6
|
-
dialog
|
|
5
|
+
trigger?: React.ReactNode;
|
|
6
|
+
dialog?: React.ReactNode;
|
|
7
7
|
}
|
|
8
8
|
export declare function BaseDialogTrigger(props: BaseDialogTriggerProps): React.JSX.Element;
|
|
9
9
|
export declare function registerDialogTrigger(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BaseDialogTrigger>): void;
|
package/dist/registerSelect.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export interface BaseSelectControlContextData {
|
|
|
10
10
|
}
|
|
11
11
|
export interface BaseSelectProps extends SelectProps<{}>, // NOTE: We don't need generic type here since we don't use items prop (that needs it). We just need to make the type checker happy
|
|
12
12
|
HasControlContextData<BaseSelectControlContextData> {
|
|
13
|
-
previewOpen?: boolean;
|
|
14
13
|
children?: React.ReactNode;
|
|
15
14
|
}
|
|
16
15
|
export declare function BaseSelect(props: BaseSelectProps): React.JSX.Element;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CodeComponentMeta } from "@plasmicapp/host";
|
|
2
2
|
import registerComponent from "@plasmicapp/host/registerComponent";
|
|
3
3
|
import React from "react";
|
|
4
4
|
export type HasControlContextData<T = BaseControlContextData> = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/react-aria",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.65",
|
|
4
4
|
"description": "Plasmic registration calls for react-aria based components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "0203141dd0a61cf9d6a5d3c8e0cef9d93d4e8292"
|
|
78
78
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var host = require('@plasmicapp/host');
|
|
3
4
|
var React = require('react');
|
|
4
5
|
var reactAriaComponents = require('react-aria-components');
|
|
5
6
|
var common = require('./common-2e984ab4.cjs.js');
|
|
@@ -17,7 +18,6 @@ require('./variant-utils-db5b9590.cjs.js');
|
|
|
17
18
|
require('./registerSection.cjs.js');
|
|
18
19
|
require('@react-aria/utils');
|
|
19
20
|
require('react-aria');
|
|
20
|
-
require('@plasmicapp/host');
|
|
21
21
|
require('@plasmicapp/host/registerComponent');
|
|
22
22
|
|
|
23
23
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -56,6 +56,23 @@ var __objRest = (source, exclude) => {
|
|
|
56
56
|
return target;
|
|
57
57
|
};
|
|
58
58
|
const COMBOBOX_NAME = utils.makeComponentName("combobox");
|
|
59
|
+
function ComboboxAutoOpen(props) {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
const isEditMode = !!host.usePlasmicCanvasContext();
|
|
62
|
+
const { isSelected } = (_a = host.usePlasmicCanvasComponentInfo(props)) != null ? _a : {};
|
|
63
|
+
const { open, close } = (_b = React__default.default.useContext(reactAriaComponents.ComboBoxStateContext)) != null ? _b : {};
|
|
64
|
+
React.useEffect(() => {
|
|
65
|
+
if (!isEditMode) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (isSelected) {
|
|
69
|
+
open == null ? void 0 : open(void 0, "manual");
|
|
70
|
+
} else {
|
|
71
|
+
close == null ? void 0 : close();
|
|
72
|
+
}
|
|
73
|
+
}, [isSelected, isEditMode]);
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
59
76
|
function BaseComboBox(props) {
|
|
60
77
|
const _a = props, { children, setControlContextData, isOpen } = _a, rest = __objRest(_a, ["children", "setControlContextData", "isOpen"]);
|
|
61
78
|
const idManager = React.useMemo(() => new registerListBox.ListBoxItemIdManager(), []);
|
|
@@ -78,7 +95,7 @@ function BaseComboBox(props) {
|
|
|
78
95
|
idManager
|
|
79
96
|
}
|
|
80
97
|
},
|
|
81
|
-
/* @__PURE__ */ React__default.default.createElement(contexts.PlasmicInputContext.Provider, { value: { isUncontrolled: true } }, children)
|
|
98
|
+
/* @__PURE__ */ React__default.default.createElement(contexts.PlasmicInputContext.Provider, { value: { isUncontrolled: true } }, /* @__PURE__ */ React__default.default.createElement(ComboboxAutoOpen, __spreadValues({}, props)), children)
|
|
82
99
|
)
|
|
83
100
|
));
|
|
84
101
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerComboBox.cjs.js","sources":["../src/registerComboBox.tsx"],"sourcesContent":["import React, { useEffect, useMemo } from \"react\";\nimport { ComboBox, ComboBoxProps } from \"react-aria-components\";\nimport { getCommonProps } from \"./common\";\nimport {\n PlasmicInputContext,\n PlasmicListBoxContext,\n PlasmicPopoverContext,\n} from \"./contexts\";\nimport { ListBoxItemIdManager } from \"./ListBoxItemIdManager\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { INPUT_COMPONENT_NAME } from \"./registerInput\";\nimport { LABEL_COMPONENT_NAME } from \"./registerLabel\";\nimport { LIST_BOX_COMPONENT_NAME } from \"./registerListBox\";\nimport { POPOVER_COMPONENT_NAME } from \"./registerPopover\";\nimport {\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nconst COMBOBOX_NAME = makeComponentName(\"combobox\");\n\nexport interface BaseComboboxControlContextData {\n itemIds: string[];\n}\n\nexport interface BaseComboboxProps\n extends ComboBoxProps<{}>,\n HasControlContextData<BaseComboboxControlContextData> {\n placeholder?: string;\n children?: React.ReactNode;\n isOpen?: boolean;\n}\n\nexport function BaseComboBox(props: BaseComboboxProps) {\n const { children, setControlContextData, isOpen, ...rest } = props;\n\n const idManager = useMemo(() => new ListBoxItemIdManager(), []);\n\n useEffect(() => {\n idManager.subscribe((ids: string[]) => {\n setControlContextData?.({\n itemIds: ids,\n });\n });\n }, []);\n\n return (\n <ComboBox {...rest}>\n <PlasmicPopoverContext.Provider\n value={{ isOpen, defaultShouldFlip: false }}\n >\n <PlasmicListBoxContext.Provider\n value={{\n idManager,\n }}\n >\n <PlasmicInputContext.Provider value={{ isUncontrolled: true }}>\n {children}\n </PlasmicInputContext.Provider>\n </PlasmicListBoxContext.Provider>\n </PlasmicPopoverContext.Provider>\n </ComboBox>\n );\n}\n\nexport function registerComboBox(loader?: Registerable) {\n registerComponentHelper(loader, BaseComboBox, {\n name: COMBOBOX_NAME,\n displayName: \"Aria ComboBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerComboBox\",\n importName: \"BaseComboBox\",\n props: {\n ...getCommonProps<BaseComboboxProps>(\"ComboBox\", [\n \"name\",\n \"aria-label\",\n \"placeholder\",\n \"isDisabled\",\n ]),\n selectedKey: {\n type: \"choice\",\n description: \"The selected keys of the listbox\",\n editOnly: true,\n uncontrolledProp: \"defaultSelectedKey\",\n displayName: \"Initial selected key\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n // React Aria ComboBox do not support multiple comboBoxions yet\n multiSelect: false,\n },\n disabledKeys: {\n type: \"choice\",\n description:\n \"The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n multiSelect: true,\n advanced: true,\n },\n isOpen: {\n type: \"boolean\",\n defaultValue: false,\n // It doesn't make sense to make isOpen prop editable (it's controlled by user interaction and always closed by default), so we keep this prop hidden. We have listed the prop here in the meta only so we can expose a writeable state for it.\n hidden: () => true,\n },\n onSelectionChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"selectedKey\", type: \"string\" }],\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"vbox\",\n styles: {\n justifyContent: \"flex-start\",\n alignItems: \"flex-start\",\n width: \"300px\",\n padding: 0,\n },\n children: [\n {\n type: \"component\",\n name: LABEL_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: \"Label\",\n },\n },\n },\n {\n type: \"hbox\",\n children: [\n {\n type: \"component\",\n name: INPUT_COMPONENT_NAME,\n styles: {\n width: \"100%\",\n },\n },\n {\n type: \"component\",\n name: BUTTON_COMPONENT_NAME,\n props: {\n children: {\n type: \"img\",\n // TODO: Replace with the image of an arrow pointing up, like: https://icon-sets.iconify.design/mdi/triangle/\n src: \"https://static1.plasmic.app/arrow-up.svg\",\n styles: {\n width: \"15px\",\n transform: \"rotate(180deg)\",\n },\n },\n },\n },\n ],\n },\n {\n type: \"component\",\n name: POPOVER_COMPONENT_NAME,\n styles: {\n backgroundColor: \"white\",\n padding: \"10px\",\n overflow: \"scroll\",\n },\n props: {\n offset: 0,\n children: [\n {\n type: \"component\",\n name: LIST_BOX_COMPONENT_NAME,\n props: {\n selectionMode: \"single\",\n },\n styles: {\n borderWidth: 0,\n width: \"stretch\",\n },\n },\n ],\n },\n },\n ],\n },\n ],\n },\n },\n states: {\n selectedKey: {\n type: \"writable\",\n valueProp: \"selectedKey\",\n onChangeProp: \"onSelectionChange\",\n variableType: \"text\",\n },\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: true,\n });\n}\n"],"names":["makeComponentName","useMemo","ListBoxItemIdManager","useEffect","React","ComboBox","PlasmicPopoverContext","PlasmicListBoxContext","PlasmicInputContext","registerComponentHelper","getCommonProps","LABEL_COMPONENT_NAME","INPUT_COMPONENT_NAME","BUTTON_COMPONENT_NAME","POPOVER_COMPONENT_NAME","LIST_BOX_COMPONENT_NAME"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,aAAA,GAAgBA,wBAAkB,UAAU,CAAA,CAAA;AAc3C,SAAS,aAAa,KAA0B,EAAA;AACrD,EAA6D,MAAA,EAAA,GAAA,KAAA,EAArD,EAAU,QAAA,EAAA,qBAAA,EAAuB,MApC3C,EAAA,GAoC+D,IAAT,IAAS,GAAA,SAAA,CAAA,EAAA,EAAT,CAA5C,UAAA,EAAU,uBAAuB,EAAA,QAAA,CAAA,CAAA,CAAA;AAEzC,EAAA,MAAM,YAAYC,aAAQ,CAAA,MAAM,IAAIC,oCAAqB,EAAA,EAAG,EAAE,CAAA,CAAA;AAE9D,EAAAC,eAAA,CAAU,MAAM;AACd,IAAU,SAAA,CAAA,SAAA,CAAU,CAAC,GAAkB,KAAA;AACrC,MAAwB,qBAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,qBAAA,CAAA;AAAA,QACtB,OAAS,EAAA,GAAA;AAAA,OACX,CAAA,CAAA;AAAA,KACD,CAAA,CAAA;AAAA,GACH,EAAG,EAAE,CAAA,CAAA;AAEL,EACE,uBAAAC,sBAAA,CAAA,aAAA,CAACC,iDAAa,IACZ,CAAA,kBAAAD,sBAAA,CAAA,aAAA;AAAA,IAACE,8BAAsB,CAAA,QAAA;AAAA,IAAtB;AAAA,MACC,KAAO,EAAA,EAAE,MAAQ,EAAA,iBAAA,EAAmB,KAAM,EAAA;AAAA,KAAA;AAAA,oBAE1CF,sBAAA,CAAA,aAAA;AAAA,MAACG,8BAAsB,CAAA,QAAA;AAAA,MAAtB;AAAA,QACC,KAAO,EAAA;AAAA,UACL,SAAA;AAAA,SACF;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AA,QACX,YAAc,EAAA,cAAA;AAAA,QACd,YAAc,EAAA,SAAA;AAAA,OAChB;AAAA,KACF;AAAA,IACA,UAAY,EAAA,IAAA;AAAA,GACb,CAAA,CAAA;AACH;;;;;"}
|
|
1
|
+
{"version":3,"file":"registerComboBox.cjs.js","sources":["../src/registerComboBox.tsx"],"sourcesContent":["import {\n usePlasmicCanvasComponentInfo,\n usePlasmicCanvasContext,\n} from \"@plasmicapp/host\";\nimport React, { useEffect, useMemo } from \"react\";\nimport {\n ComboBox,\n ComboBoxProps,\n ComboBoxStateContext,\n} from \"react-aria-components\";\nimport { getCommonProps } from \"./common\";\nimport {\n PlasmicInputContext,\n PlasmicListBoxContext,\n PlasmicPopoverContext,\n} from \"./contexts\";\nimport { ListBoxItemIdManager } from \"./ListBoxItemIdManager\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { INPUT_COMPONENT_NAME } from \"./registerInput\";\nimport { LABEL_COMPONENT_NAME } from \"./registerLabel\";\nimport { LIST_BOX_COMPONENT_NAME } from \"./registerListBox\";\nimport { POPOVER_COMPONENT_NAME } from \"./registerPopover\";\nimport {\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nconst COMBOBOX_NAME = makeComponentName(\"combobox\");\n\nexport interface BaseComboboxControlContextData {\n itemIds: string[];\n}\n\nexport interface BaseComboboxProps\n extends ComboBoxProps<{}>,\n HasControlContextData<BaseComboboxControlContextData> {\n placeholder?: string;\n children?: React.ReactNode;\n isOpen?: boolean;\n}\n\n/**\n * This React Hook is used to help with auto-opening the combobox when the canvas component is selected.\n * Currently, there is a bug in react-aria combobox (https://github.com/adobe/react-spectrum/issues/7149) where, when the combobox's popover is auto-opened, it is unable to render any listbox items.\n * Setting popover's open state to true in not enough unless, unless it has previously been opened via user interaction with combobox.\n * Also, <Combobox> does not support an `isOpen` prop either.\n *\n * So, we use this custom hook to access the combobox's internal state via ComboBoxStateContext and change the `open` state manually via tha available `open` method.\n * */\nfunction ComboboxAutoOpen(props: any) {\n const isEditMode = !!usePlasmicCanvasContext();\n const { isSelected } = usePlasmicCanvasComponentInfo(props) ?? {};\n const { open, close } = React.useContext(ComboBoxStateContext) ?? {};\n\n useEffect(() => {\n if (!isEditMode) {\n return;\n }\n if (isSelected) {\n open?.(undefined, \"manual\");\n } else {\n close?.();\n }\n // Not putting open and close in the useEffect dependencies array, because it causes a re-render loop.\n }, [isSelected, isEditMode]);\n\n return null;\n}\n\nexport function BaseComboBox(props: BaseComboboxProps) {\n const { children, setControlContextData, isOpen, ...rest } = props;\n\n const idManager = useMemo(() => new ListBoxItemIdManager(), []);\n\n useEffect(() => {\n idManager.subscribe((ids: string[]) => {\n setControlContextData?.({\n itemIds: ids,\n });\n });\n }, []);\n\n return (\n <ComboBox {...rest}>\n <PlasmicPopoverContext.Provider\n value={{ isOpen, defaultShouldFlip: false }}\n >\n <PlasmicListBoxContext.Provider\n value={{\n idManager,\n }}\n >\n <PlasmicInputContext.Provider value={{ isUncontrolled: true }}>\n <ComboboxAutoOpen {...props} />\n {children}\n </PlasmicInputContext.Provider>\n </PlasmicListBoxContext.Provider>\n </PlasmicPopoverContext.Provider>\n </ComboBox>\n );\n}\n\nexport function registerComboBox(loader?: Registerable) {\n registerComponentHelper(loader, BaseComboBox, {\n name: COMBOBOX_NAME,\n displayName: \"Aria ComboBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerComboBox\",\n importName: \"BaseComboBox\",\n props: {\n ...getCommonProps<BaseComboboxProps>(\"ComboBox\", [\n \"name\",\n \"aria-label\",\n \"placeholder\",\n \"isDisabled\",\n ]),\n selectedKey: {\n type: \"choice\",\n description: \"The selected keys of the listbox\",\n editOnly: true,\n uncontrolledProp: \"defaultSelectedKey\",\n displayName: \"Initial selected key\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n // React Aria ComboBox do not support multiple comboBoxions yet\n multiSelect: false,\n },\n disabledKeys: {\n type: \"choice\",\n description:\n \"The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n multiSelect: true,\n advanced: true,\n },\n isOpen: {\n type: \"boolean\",\n defaultValue: false,\n // It doesn't make sense to make isOpen prop editable (it's controlled by user interaction and always closed by default), so we keep this prop hidden. We have listed the prop here in the meta only so we can expose a writeable state for it.\n hidden: () => true,\n },\n onSelectionChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"selectedKey\", type: \"string\" }],\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"vbox\",\n styles: {\n justifyContent: \"flex-start\",\n alignItems: \"flex-start\",\n width: \"300px\",\n padding: 0,\n },\n children: [\n {\n type: \"component\",\n name: LABEL_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: \"Label\",\n },\n },\n },\n {\n type: \"hbox\",\n children: [\n {\n type: \"component\",\n name: INPUT_COMPONENT_NAME,\n styles: {\n width: \"100%\",\n },\n },\n {\n type: \"component\",\n name: BUTTON_COMPONENT_NAME,\n props: {\n children: {\n type: \"img\",\n // TODO: Replace with the image of an arrow pointing up, like: https://icon-sets.iconify.design/mdi/triangle/\n src: \"https://static1.plasmic.app/arrow-up.svg\",\n styles: {\n width: \"15px\",\n transform: \"rotate(180deg)\",\n },\n },\n },\n },\n ],\n },\n {\n type: \"component\",\n name: POPOVER_COMPONENT_NAME,\n styles: {\n backgroundColor: \"white\",\n padding: \"10px\",\n overflow: \"scroll\",\n },\n props: {\n offset: 0,\n children: [\n {\n type: \"component\",\n name: LIST_BOX_COMPONENT_NAME,\n props: {\n selectionMode: \"single\",\n },\n styles: {\n borderWidth: 0,\n width: \"stretch\",\n },\n },\n ],\n },\n },\n ],\n },\n ],\n },\n },\n states: {\n selectedKey: {\n type: \"writable\",\n valueProp: \"selectedKey\",\n onChangeProp: \"onSelectionChange\",\n variableType: \"text\",\n },\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: true,\n });\n}\n"],"names":["makeComponentName","usePlasmicCanvasContext","ComboBoxStateContext","useEffect","useMemo","ListBoxItemIdManager","React","ComboBox","PlasmicPopoverContext","PlasmicListBoxContext","PlasmicInputContext","registerComponentHelper","getCommonProps","LABEL_COMPONENT_NAME","INPUT_COMPONENT_NAME","BUTTON_COMPONENT_NAME","POPOVER_COMPONENT_NAME","LIST_BOX_COMPONENT_NAME"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,aAAA,GAAgBA,wBAAkB,UAAU,CAAA,CAAA;AAsBlD,SAAS,iBAAiB,KAAY,EAAA;AAnDtC,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAoDE,EAAM,MAAA,UAAA,GAAa,CAAC,CAACC,4BAAwB,EAAA,CAAA;AAC7C,EAAA,MAAM,EAAE,UAAW,EAAA,GAAA,CAAI,wCAA8B,KAAK,CAAA,KAAnC,YAAwC,EAAC,CAAA;AAChE,EAAM,MAAA,EAAE,MAAM,KAAM,EAAA,GAAA,CAAI,4BAAM,UAAW,CAAAC,wCAAoB,CAArC,KAAA,IAAA,GAAA,EAAA,GAA0C,EAAC,CAAA;AAEnE,EAAAC,eAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,UAAY,EAAA;AACf,MAAA,OAAA;AAAA,KACF;AACA,IAAA,IAAI,UAAY,EAAA;AACd,MAAA,IAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,IAAA,CAAO,KAAW,CAAA,EAAA,QAAA,CAAA,CAAA;AAAA,KACb,MAAA;AACL,MAAA,KAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,KAAA,EAAA,CAAA;AAAA,KACF;AAAA,GAEC,EAAA,CAAC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,CAAA,CAAA;AACH;;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { usePlasmicCanvasContext, usePlasmicCanvasComponentInfo } from '@plasmicapp/host';
|
|
1
2
|
import React, { useMemo, useEffect } from 'react';
|
|
2
|
-
import { ComboBox } from 'react-aria-components';
|
|
3
|
+
import { ComboBox, ComboBoxStateContext } from 'react-aria-components';
|
|
3
4
|
import { g as getCommonProps } from './common-0c4336fe.esm.js';
|
|
4
5
|
import { a as PlasmicPopoverContext, b as PlasmicListBoxContext, c as PlasmicInputContext } from './contexts-081d65a0.esm.js';
|
|
5
6
|
import { L as ListBoxItemIdManager, a as LIST_BOX_COMPONENT_NAME } from './registerListBox-8c096263.esm.js';
|
|
@@ -15,7 +16,6 @@ import './variant-utils-23360776.esm.js';
|
|
|
15
16
|
import './registerSection.esm.js';
|
|
16
17
|
import '@react-aria/utils';
|
|
17
18
|
import 'react-aria';
|
|
18
|
-
import '@plasmicapp/host';
|
|
19
19
|
import '@plasmicapp/host/registerComponent';
|
|
20
20
|
|
|
21
21
|
var __defProp = Object.defineProperty;
|
|
@@ -50,6 +50,23 @@ var __objRest = (source, exclude) => {
|
|
|
50
50
|
return target;
|
|
51
51
|
};
|
|
52
52
|
const COMBOBOX_NAME = makeComponentName("combobox");
|
|
53
|
+
function ComboboxAutoOpen(props) {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
const isEditMode = !!usePlasmicCanvasContext();
|
|
56
|
+
const { isSelected } = (_a = usePlasmicCanvasComponentInfo(props)) != null ? _a : {};
|
|
57
|
+
const { open, close } = (_b = React.useContext(ComboBoxStateContext)) != null ? _b : {};
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (!isEditMode) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (isSelected) {
|
|
63
|
+
open == null ? void 0 : open(void 0, "manual");
|
|
64
|
+
} else {
|
|
65
|
+
close == null ? void 0 : close();
|
|
66
|
+
}
|
|
67
|
+
}, [isSelected, isEditMode]);
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
53
70
|
function BaseComboBox(props) {
|
|
54
71
|
const _a = props, { children, setControlContextData, isOpen } = _a, rest = __objRest(_a, ["children", "setControlContextData", "isOpen"]);
|
|
55
72
|
const idManager = useMemo(() => new ListBoxItemIdManager(), []);
|
|
@@ -72,7 +89,7 @@ function BaseComboBox(props) {
|
|
|
72
89
|
idManager
|
|
73
90
|
}
|
|
74
91
|
},
|
|
75
|
-
/* @__PURE__ */ React.createElement(PlasmicInputContext.Provider, { value: { isUncontrolled: true } }, children)
|
|
92
|
+
/* @__PURE__ */ React.createElement(PlasmicInputContext.Provider, { value: { isUncontrolled: true } }, /* @__PURE__ */ React.createElement(ComboboxAutoOpen, __spreadValues({}, props)), children)
|
|
76
93
|
)
|
|
77
94
|
));
|
|
78
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerComboBox.esm.js","sources":["../src/registerComboBox.tsx"],"sourcesContent":["import React, { useEffect, useMemo } from \"react\";\nimport { ComboBox, ComboBoxProps } from \"react-aria-components\";\nimport { getCommonProps } from \"./common\";\nimport {\n PlasmicInputContext,\n PlasmicListBoxContext,\n PlasmicPopoverContext,\n} from \"./contexts\";\nimport { ListBoxItemIdManager } from \"./ListBoxItemIdManager\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { INPUT_COMPONENT_NAME } from \"./registerInput\";\nimport { LABEL_COMPONENT_NAME } from \"./registerLabel\";\nimport { LIST_BOX_COMPONENT_NAME } from \"./registerListBox\";\nimport { POPOVER_COMPONENT_NAME } from \"./registerPopover\";\nimport {\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nconst COMBOBOX_NAME = makeComponentName(\"combobox\");\n\nexport interface BaseComboboxControlContextData {\n itemIds: string[];\n}\n\nexport interface BaseComboboxProps\n extends ComboBoxProps<{}>,\n HasControlContextData<BaseComboboxControlContextData> {\n placeholder?: string;\n children?: React.ReactNode;\n isOpen?: boolean;\n}\n\nexport function BaseComboBox(props: BaseComboboxProps) {\n const { children, setControlContextData, isOpen, ...rest } = props;\n\n const idManager = useMemo(() => new ListBoxItemIdManager(), []);\n\n useEffect(() => {\n idManager.subscribe((ids: string[]) => {\n setControlContextData?.({\n itemIds: ids,\n });\n });\n }, []);\n\n return (\n <ComboBox {...rest}>\n <PlasmicPopoverContext.Provider\n value={{ isOpen, defaultShouldFlip: false }}\n >\n <PlasmicListBoxContext.Provider\n value={{\n idManager,\n }}\n >\n <PlasmicInputContext.Provider value={{ isUncontrolled: true }}>\n {children}\n </PlasmicInputContext.Provider>\n </PlasmicListBoxContext.Provider>\n </PlasmicPopoverContext.Provider>\n </ComboBox>\n );\n}\n\nexport function registerComboBox(loader?: Registerable) {\n registerComponentHelper(loader, BaseComboBox, {\n name: COMBOBOX_NAME,\n displayName: \"Aria ComboBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerComboBox\",\n importName: \"BaseComboBox\",\n props: {\n ...getCommonProps<BaseComboboxProps>(\"ComboBox\", [\n \"name\",\n \"aria-label\",\n \"placeholder\",\n \"isDisabled\",\n ]),\n selectedKey: {\n type: \"choice\",\n description: \"The selected keys of the listbox\",\n editOnly: true,\n uncontrolledProp: \"defaultSelectedKey\",\n displayName: \"Initial selected key\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n // React Aria ComboBox do not support multiple comboBoxions yet\n multiSelect: false,\n },\n disabledKeys: {\n type: \"choice\",\n description:\n \"The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n multiSelect: true,\n advanced: true,\n },\n isOpen: {\n type: \"boolean\",\n defaultValue: false,\n // It doesn't make sense to make isOpen prop editable (it's controlled by user interaction and always closed by default), so we keep this prop hidden. We have listed the prop here in the meta only so we can expose a writeable state for it.\n hidden: () => true,\n },\n onSelectionChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"selectedKey\", type: \"string\" }],\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"vbox\",\n styles: {\n justifyContent: \"flex-start\",\n alignItems: \"flex-start\",\n width: \"300px\",\n padding: 0,\n },\n children: [\n {\n type: \"component\",\n name: LABEL_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: \"Label\",\n },\n },\n },\n {\n type: \"hbox\",\n children: [\n {\n type: \"component\",\n name: INPUT_COMPONENT_NAME,\n styles: {\n width: \"100%\",\n },\n },\n {\n type: \"component\",\n name: BUTTON_COMPONENT_NAME,\n props: {\n children: {\n type: \"img\",\n // TODO: Replace with the image of an arrow pointing up, like: https://icon-sets.iconify.design/mdi/triangle/\n src: \"https://static1.plasmic.app/arrow-up.svg\",\n styles: {\n width: \"15px\",\n transform: \"rotate(180deg)\",\n },\n },\n },\n },\n ],\n },\n {\n type: \"component\",\n name: POPOVER_COMPONENT_NAME,\n styles: {\n backgroundColor: \"white\",\n padding: \"10px\",\n overflow: \"scroll\",\n },\n props: {\n offset: 0,\n children: [\n {\n type: \"component\",\n name: LIST_BOX_COMPONENT_NAME,\n props: {\n selectionMode: \"single\",\n },\n styles: {\n borderWidth: 0,\n width: \"stretch\",\n },\n },\n ],\n },\n },\n ],\n },\n ],\n },\n },\n states: {\n selectedKey: {\n type: \"writable\",\n valueProp: \"selectedKey\",\n onChangeProp: \"onSelectionChange\",\n variableType: \"text\",\n },\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: true,\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,aAAA,GAAgB,kBAAkB,UAAU,CAAA,CAAA;AAc3C,SAAS,aAAa,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A,eACF;AAAA,cACA;AAAA,gBACE,IAAM,EAAA,WAAA;AAAA,gBACN,IAAM,EAAA,sBAAA;AAAA,gBACN,MAAQ,EAAA;AAAA,kBACN,eAAiB,EAAA,OAAA;AAAA,kBACjB,OAAS,EAAA,MAAA;AAAA,kBACT,QAAU,EAAA,QAAA;AAAA,iBACZ;AAAA,gBACA,KAAO,EAAA;AAAA,kBACL,MAAQ,EAAA,CAAA;AAAA,kBACR,QAAU,EAAA;AAAA,oBACR;AAAA,sBACE,IAAM,EAAA,WAAA;AAAA,sBACN,IAAM,EAAA,uBAAA;AAAA,sBACN,KAAO,EAAA;AAAA,wBACL,aAAe,EAAA,QAAA;AAAA,uBACjB;AAAA,sBACA,MAAQ,EAAA;AAAA,wBACN,WAAa,EAAA,CAAA;AAAA,wBACb,KAAO,EAAA,SAAA;AAAA,uBACT;AAAA,qBACF;AAAA,mBACF;AAAA,iBACF;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,KACF,CAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,WAAa,EAAA;AAAA,QACX,IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,aAAA;AAAA,QACX,YAAc,EAAA,mBAAA;AAAA,QACd,YAAc,EAAA,MAAA;AAAA,OAChB;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,QAAA;AAAA,QACX,YAAc,EAAA,cAAA;AAAA,QACd,YAAc,EAAA,SAAA;AAAA,OAChB;AAAA,KACF;AAAA,IACA,UAAY,EAAA,IAAA;AAAA,GACb,CAAA,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"registerComboBox.esm.js","sources":["../src/registerComboBox.tsx"],"sourcesContent":["import {\n usePlasmicCanvasComponentInfo,\n usePlasmicCanvasContext,\n} from \"@plasmicapp/host\";\nimport React, { useEffect, useMemo } from \"react\";\nimport {\n ComboBox,\n ComboBoxProps,\n ComboBoxStateContext,\n} from \"react-aria-components\";\nimport { getCommonProps } from \"./common\";\nimport {\n PlasmicInputContext,\n PlasmicListBoxContext,\n PlasmicPopoverContext,\n} from \"./contexts\";\nimport { ListBoxItemIdManager } from \"./ListBoxItemIdManager\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { INPUT_COMPONENT_NAME } from \"./registerInput\";\nimport { LABEL_COMPONENT_NAME } from \"./registerLabel\";\nimport { LIST_BOX_COMPONENT_NAME } from \"./registerListBox\";\nimport { POPOVER_COMPONENT_NAME } from \"./registerPopover\";\nimport {\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nconst COMBOBOX_NAME = makeComponentName(\"combobox\");\n\nexport interface BaseComboboxControlContextData {\n itemIds: string[];\n}\n\nexport interface BaseComboboxProps\n extends ComboBoxProps<{}>,\n HasControlContextData<BaseComboboxControlContextData> {\n placeholder?: string;\n children?: React.ReactNode;\n isOpen?: boolean;\n}\n\n/**\n * This React Hook is used to help with auto-opening the combobox when the canvas component is selected.\n * Currently, there is a bug in react-aria combobox (https://github.com/adobe/react-spectrum/issues/7149) where, when the combobox's popover is auto-opened, it is unable to render any listbox items.\n * Setting popover's open state to true in not enough unless, unless it has previously been opened via user interaction with combobox.\n * Also, <Combobox> does not support an `isOpen` prop either.\n *\n * So, we use this custom hook to access the combobox's internal state via ComboBoxStateContext and change the `open` state manually via tha available `open` method.\n * */\nfunction ComboboxAutoOpen(props: any) {\n const isEditMode = !!usePlasmicCanvasContext();\n const { isSelected } = usePlasmicCanvasComponentInfo(props) ?? {};\n const { open, close } = React.useContext(ComboBoxStateContext) ?? {};\n\n useEffect(() => {\n if (!isEditMode) {\n return;\n }\n if (isSelected) {\n open?.(undefined, \"manual\");\n } else {\n close?.();\n }\n // Not putting open and close in the useEffect dependencies array, because it causes a re-render loop.\n }, [isSelected, isEditMode]);\n\n return null;\n}\n\nexport function BaseComboBox(props: BaseComboboxProps) {\n const { children, setControlContextData, isOpen, ...rest } = props;\n\n const idManager = useMemo(() => new ListBoxItemIdManager(), []);\n\n useEffect(() => {\n idManager.subscribe((ids: string[]) => {\n setControlContextData?.({\n itemIds: ids,\n });\n });\n }, []);\n\n return (\n <ComboBox {...rest}>\n <PlasmicPopoverContext.Provider\n value={{ isOpen, defaultShouldFlip: false }}\n >\n <PlasmicListBoxContext.Provider\n value={{\n idManager,\n }}\n >\n <PlasmicInputContext.Provider value={{ isUncontrolled: true }}>\n <ComboboxAutoOpen {...props} />\n {children}\n </PlasmicInputContext.Provider>\n </PlasmicListBoxContext.Provider>\n </PlasmicPopoverContext.Provider>\n </ComboBox>\n );\n}\n\nexport function registerComboBox(loader?: Registerable) {\n registerComponentHelper(loader, BaseComboBox, {\n name: COMBOBOX_NAME,\n displayName: \"Aria ComboBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerComboBox\",\n importName: \"BaseComboBox\",\n props: {\n ...getCommonProps<BaseComboboxProps>(\"ComboBox\", [\n \"name\",\n \"aria-label\",\n \"placeholder\",\n \"isDisabled\",\n ]),\n selectedKey: {\n type: \"choice\",\n description: \"The selected keys of the listbox\",\n editOnly: true,\n uncontrolledProp: \"defaultSelectedKey\",\n displayName: \"Initial selected key\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n // React Aria ComboBox do not support multiple comboBoxions yet\n multiSelect: false,\n },\n disabledKeys: {\n type: \"choice\",\n description:\n \"The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n multiSelect: true,\n advanced: true,\n },\n isOpen: {\n type: \"boolean\",\n defaultValue: false,\n // It doesn't make sense to make isOpen prop editable (it's controlled by user interaction and always closed by default), so we keep this prop hidden. We have listed the prop here in the meta only so we can expose a writeable state for it.\n hidden: () => true,\n },\n onSelectionChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"selectedKey\", type: \"string\" }],\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"vbox\",\n styles: {\n justifyContent: \"flex-start\",\n alignItems: \"flex-start\",\n width: \"300px\",\n padding: 0,\n },\n children: [\n {\n type: \"component\",\n name: LABEL_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: \"Label\",\n },\n },\n },\n {\n type: \"hbox\",\n children: [\n {\n type: \"component\",\n name: INPUT_COMPONENT_NAME,\n styles: {\n width: \"100%\",\n },\n },\n {\n type: \"component\",\n name: BUTTON_COMPONENT_NAME,\n props: {\n children: {\n type: \"img\",\n // TODO: Replace with the image of an arrow pointing up, like: https://icon-sets.iconify.design/mdi/triangle/\n src: \"https://static1.plasmic.app/arrow-up.svg\",\n styles: {\n width: \"15px\",\n transform: \"rotate(180deg)\",\n },\n },\n },\n },\n ],\n },\n {\n type: \"component\",\n name: POPOVER_COMPONENT_NAME,\n styles: {\n backgroundColor: \"white\",\n padding: \"10px\",\n overflow: \"scroll\",\n },\n props: {\n offset: 0,\n children: [\n {\n type: \"component\",\n name: LIST_BOX_COMPONENT_NAME,\n props: {\n selectionMode: \"single\",\n },\n styles: {\n borderWidth: 0,\n width: \"stretch\",\n },\n },\n ],\n },\n },\n ],\n },\n ],\n },\n },\n states: {\n selectedKey: {\n type: \"writable\",\n valueProp: \"selectedKey\",\n onChangeProp: \"onSelectionChange\",\n variableType: \"text\",\n },\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: true,\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,aAAA,GAAgB,kBAAkB,UAAU,CAAA,CAAA;AAsBlD,SAAS,iBAAiB,KAAY,EAAA;AAnDtC,EAAA,IAAA,EAAA,EAAA,EA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wBACL,aAAe,EAAA,QAAA;AAAA,uBACjB;AAAA,sBACA,MAAQ,EAAA;AAAA,wBACN,WAAa,EAAA,CAAA;AAAA,wBACb,KAAO,EAAA,SAAA;AAAA,uBACT;AAAA,qBACF;AAAA,mBACF;AAAA,iBACF;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,KACF,CAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,WAAa,EAAA;AAAA,QACX,IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,aAAA;AAAA,QACX,YAAc,EAAA,mBAAA;AAAA,QACd,YAAc,EAAA,MAAA;AAAA,OAChB;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,QAAA;AAAA,QACX,YAAc,EAAA,cAAA;AAAA,QACd,YAAc,EAAA,SAAA;AAAA,OAChB;AAAA,KACF;AAAA,IACA,UAAY,EAAA,IAAA;AAAA,GACb,CAAA,CAAA;AACH;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var host = require('@plasmicapp/host');
|
|
3
4
|
var React = require('react');
|
|
4
5
|
var reactAriaComponents = require('react-aria-components');
|
|
5
6
|
var contexts = require('./contexts-baa37b74.cjs.js');
|
|
@@ -8,7 +9,6 @@ var registerModal = require('./registerModal.cjs.js');
|
|
|
8
9
|
var utils = require('./utils-8dbb4d1f.cjs.js');
|
|
9
10
|
require('./common-2e984ab4.cjs.js');
|
|
10
11
|
require('./variant-utils-db5b9590.cjs.js');
|
|
11
|
-
require('@plasmicapp/host');
|
|
12
12
|
require('react-aria');
|
|
13
13
|
require('./registerHeading.cjs.js');
|
|
14
14
|
require('@plasmicapp/host/registerComponent');
|
|
@@ -18,6 +18,8 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
18
18
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
19
19
|
|
|
20
20
|
var __defProp = Object.defineProperty;
|
|
21
|
+
var __defProps = Object.defineProperties;
|
|
22
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
21
23
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
22
24
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
23
25
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -33,6 +35,7 @@ var __spreadValues = (a, b) => {
|
|
|
33
35
|
}
|
|
34
36
|
return a;
|
|
35
37
|
};
|
|
38
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
36
39
|
var __objRest = (source, exclude) => {
|
|
37
40
|
var target = {};
|
|
38
41
|
for (var prop in source)
|
|
@@ -46,8 +49,14 @@ var __objRest = (source, exclude) => {
|
|
|
46
49
|
return target;
|
|
47
50
|
};
|
|
48
51
|
function BaseDialogTrigger(props) {
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
var _b, _c;
|
|
53
|
+
const _a = props, { trigger, dialog, isOpen } = _a, rest = __objRest(_a, ["trigger", "dialog", "isOpen"]);
|
|
54
|
+
const { isSelected, selectedSlotName } = (_b = host.usePlasmicCanvasComponentInfo(props)) != null ? _b : {};
|
|
55
|
+
const isAutoOpen = selectedSlotName !== "trigger" && isSelected;
|
|
56
|
+
const mergedProps = __spreadProps(__spreadValues({}, rest), {
|
|
57
|
+
isOpen: (_c = isAutoOpen || isOpen) != null ? _c : false
|
|
58
|
+
});
|
|
59
|
+
return /* @__PURE__ */ React__default.default.createElement(contexts.PlasmicDialogTriggerContext.Provider, { value: mergedProps }, /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.DialogTrigger, __spreadValues({}, mergedProps), trigger, dialog));
|
|
51
60
|
}
|
|
52
61
|
function registerDialogTrigger(loader, overrides) {
|
|
53
62
|
utils.registerComponentHelper(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerDialogTrigger.cjs.js","sources":["../src/registerDialogTrigger.tsx"],"sourcesContent":["import React from \"react\";\nimport { DialogTrigger } from \"react-aria-components\";\nimport { PlasmicDialogTriggerContext } from \"./contexts\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { MODAL_COMPONENT_NAME } from \"./registerModal\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseDialogTriggerProps\n extends React.ComponentProps<typeof DialogTrigger> {\n trigger
|
|
1
|
+
{"version":3,"file":"registerDialogTrigger.cjs.js","sources":["../src/registerDialogTrigger.tsx"],"sourcesContent":["import { usePlasmicCanvasComponentInfo } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport { DialogTrigger } from \"react-aria-components\";\nimport { PlasmicDialogTriggerContext } from \"./contexts\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { MODAL_COMPONENT_NAME } from \"./registerModal\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseDialogTriggerProps\n extends React.ComponentProps<typeof DialogTrigger> {\n trigger?: React.ReactNode;\n dialog?: React.ReactNode;\n}\n\nexport function BaseDialogTrigger(props: BaseDialogTriggerProps) {\n const { trigger, dialog, isOpen, ...rest } = props;\n\n const { isSelected, selectedSlotName } =\n usePlasmicCanvasComponentInfo(props) ?? {};\n const isAutoOpen = selectedSlotName !== \"trigger\" && isSelected;\n\n const mergedProps = {\n ...rest,\n isOpen: (isAutoOpen || isOpen) ?? false,\n };\n\n return (\n <PlasmicDialogTriggerContext.Provider value={mergedProps}>\n <DialogTrigger {...mergedProps}>\n {trigger}\n {dialog}\n </DialogTrigger>\n </PlasmicDialogTriggerContext.Provider>\n );\n}\n\nexport function registerDialogTrigger(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseDialogTrigger>\n) {\n registerComponentHelper(\n loader,\n BaseDialogTrigger,\n {\n name: makeComponentName(\"dialogTrigger\"),\n displayName: \"Aria Dialog Trigger\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerDialogTrigger\",\n importName: \"BaseDialogTrigger\",\n isAttachment: true,\n props: {\n trigger: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: {\n type: \"component\",\n name: BUTTON_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: \"Open Dialog\",\n },\n },\n },\n },\n dialog: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: {\n type: \"component\",\n name: MODAL_COMPONENT_NAME,\n },\n },\n isOpen: {\n type: \"boolean\",\n defaultValueHint: false,\n editOnly: true,\n uncontrolledProp: \"defaultOpen\",\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n },\n states: {\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["React","PlasmicDialogTriggerContext","DialogTrigger","registerComponentHelper","makeComponentName","BUTTON_COMPONENT_NAME","MODAL_COMPONENT_NAME"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,SAAS,kBAAkB,KAA+B,EAAA;AAnBjE,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAoBE,EAA6C,MAAA,EAAA,GAAA,KAAA,EAArC,EAAS,OAAA,EAAA,MAAA,EAAQ,MApB3B,EAAA,GAoB+C,IAAT,IAAS,GAAA,SAAA,CAAA,EAAA,EAAT,CAA5B,SAAA,EAAS,QAAQ,EAAA,QAAA,CAAA,CAAA,CAAA;AAEzB,EAAM,MAAA,EAAE,YAAY,gBAAiB,EAAA,GAAA,CACnC,wCAA8B,KAAK,CAAA,KAAnC,YAAwC,EAAC,CAAA;AAC3C,EAAM,MAAA,UAAA,GAAa,qBAAqB,SAAa,IAAA,UAA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QACA,MAAQ,EAAA;AAAA,UACN,IAAM,EAAA,SAAA;AAAA,UACN,gBAAkB,EAAA,KAAA;AAAA,UAClB,QAAU,EAAA,IAAA;AAAA,UACV,gBAAkB,EAAA,aAAA;AAAA,SACpB;AAAA,QACA,YAAc,EAAA;AAAA,UACZ,IAAM,EAAA,cAAA;AAAA,UACN,UAAU,CAAC,EAAE,MAAM,QAAU,EAAA,IAAA,EAAM,WAAW,CAAA;AAAA,SAChD;AAAA,OACF;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,MAAQ,EAAA;AAAA,UACN,IAAM,EAAA,UAAA;AAAA,UACN,SAAW,EAAA,QAAA;AAAA,UACX,YAAc,EAAA,cAAA;AAAA,UACd,YAAc,EAAA,SAAA;AAAA,SAChB;AAAA,OACF;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;"}
|
|
@@ -2,8 +2,8 @@ import React from "react";
|
|
|
2
2
|
import { DialogTrigger } from "react-aria-components";
|
|
3
3
|
import { CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
4
4
|
export interface BaseDialogTriggerProps extends React.ComponentProps<typeof DialogTrigger> {
|
|
5
|
-
trigger
|
|
6
|
-
dialog
|
|
5
|
+
trigger?: React.ReactNode;
|
|
6
|
+
dialog?: React.ReactNode;
|
|
7
7
|
}
|
|
8
8
|
export declare function BaseDialogTrigger(props: BaseDialogTriggerProps): React.JSX.Element;
|
|
9
9
|
export declare function registerDialogTrigger(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BaseDialogTrigger>): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { usePlasmicCanvasComponentInfo } from '@plasmicapp/host';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { DialogTrigger } from 'react-aria-components';
|
|
3
4
|
import { d as PlasmicDialogTriggerContext } from './contexts-081d65a0.esm.js';
|
|
@@ -6,12 +7,13 @@ import { MODAL_COMPONENT_NAME } from './registerModal.esm.js';
|
|
|
6
7
|
import { r as registerComponentHelper, a as makeComponentName } from './utils-c7662a47.esm.js';
|
|
7
8
|
import './common-0c4336fe.esm.js';
|
|
8
9
|
import './variant-utils-23360776.esm.js';
|
|
9
|
-
import '@plasmicapp/host';
|
|
10
10
|
import 'react-aria';
|
|
11
11
|
import './registerHeading.esm.js';
|
|
12
12
|
import '@plasmicapp/host/registerComponent';
|
|
13
13
|
|
|
14
14
|
var __defProp = Object.defineProperty;
|
|
15
|
+
var __defProps = Object.defineProperties;
|
|
16
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
15
17
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
16
18
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
17
19
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -27,6 +29,7 @@ var __spreadValues = (a, b) => {
|
|
|
27
29
|
}
|
|
28
30
|
return a;
|
|
29
31
|
};
|
|
32
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
30
33
|
var __objRest = (source, exclude) => {
|
|
31
34
|
var target = {};
|
|
32
35
|
for (var prop in source)
|
|
@@ -40,8 +43,14 @@ var __objRest = (source, exclude) => {
|
|
|
40
43
|
return target;
|
|
41
44
|
};
|
|
42
45
|
function BaseDialogTrigger(props) {
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
var _b, _c;
|
|
47
|
+
const _a = props, { trigger, dialog, isOpen } = _a, rest = __objRest(_a, ["trigger", "dialog", "isOpen"]);
|
|
48
|
+
const { isSelected, selectedSlotName } = (_b = usePlasmicCanvasComponentInfo(props)) != null ? _b : {};
|
|
49
|
+
const isAutoOpen = selectedSlotName !== "trigger" && isSelected;
|
|
50
|
+
const mergedProps = __spreadProps(__spreadValues({}, rest), {
|
|
51
|
+
isOpen: (_c = isAutoOpen || isOpen) != null ? _c : false
|
|
52
|
+
});
|
|
53
|
+
return /* @__PURE__ */ React.createElement(PlasmicDialogTriggerContext.Provider, { value: mergedProps }, /* @__PURE__ */ React.createElement(DialogTrigger, __spreadValues({}, mergedProps), trigger, dialog));
|
|
45
54
|
}
|
|
46
55
|
function registerDialogTrigger(loader, overrides) {
|
|
47
56
|
registerComponentHelper(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerDialogTrigger.esm.js","sources":["../src/registerDialogTrigger.tsx"],"sourcesContent":["import React from \"react\";\nimport { DialogTrigger } from \"react-aria-components\";\nimport { PlasmicDialogTriggerContext } from \"./contexts\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { MODAL_COMPONENT_NAME } from \"./registerModal\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseDialogTriggerProps\n extends React.ComponentProps<typeof DialogTrigger> {\n trigger
|
|
1
|
+
{"version":3,"file":"registerDialogTrigger.esm.js","sources":["../src/registerDialogTrigger.tsx"],"sourcesContent":["import { usePlasmicCanvasComponentInfo } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport { DialogTrigger } from \"react-aria-components\";\nimport { PlasmicDialogTriggerContext } from \"./contexts\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { MODAL_COMPONENT_NAME } from \"./registerModal\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseDialogTriggerProps\n extends React.ComponentProps<typeof DialogTrigger> {\n trigger?: React.ReactNode;\n dialog?: React.ReactNode;\n}\n\nexport function BaseDialogTrigger(props: BaseDialogTriggerProps) {\n const { trigger, dialog, isOpen, ...rest } = props;\n\n const { isSelected, selectedSlotName } =\n usePlasmicCanvasComponentInfo(props) ?? {};\n const isAutoOpen = selectedSlotName !== \"trigger\" && isSelected;\n\n const mergedProps = {\n ...rest,\n isOpen: (isAutoOpen || isOpen) ?? false,\n };\n\n return (\n <PlasmicDialogTriggerContext.Provider value={mergedProps}>\n <DialogTrigger {...mergedProps}>\n {trigger}\n {dialog}\n </DialogTrigger>\n </PlasmicDialogTriggerContext.Provider>\n );\n}\n\nexport function registerDialogTrigger(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseDialogTrigger>\n) {\n registerComponentHelper(\n loader,\n BaseDialogTrigger,\n {\n name: makeComponentName(\"dialogTrigger\"),\n displayName: \"Aria Dialog Trigger\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerDialogTrigger\",\n importName: \"BaseDialogTrigger\",\n isAttachment: true,\n props: {\n trigger: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: {\n type: \"component\",\n name: BUTTON_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: \"Open Dialog\",\n },\n },\n },\n },\n dialog: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: {\n type: \"component\",\n name: MODAL_COMPONENT_NAME,\n },\n },\n isOpen: {\n type: \"boolean\",\n defaultValueHint: false,\n editOnly: true,\n uncontrolledProp: \"defaultOpen\",\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n },\n states: {\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,SAAS,kBAAkB,KAA+B,EAAA;AAnBjE,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAoBE,EAA6C,MAAA,EAAA,GAAA,KAAA,EAArC,EAAS,OAAA,EAAA,MAAA,EAAQ,MApB3B,EAAA,GAoB+C,IAAT,IAAS,GAAA,SAAA,CAAA,EAAA,EAAT,CAA5B,SAAA,EAAS,QAAQ,EAAA,QAAA,CAAA,CAAA,CAAA;AAEzB,EAAM,MAAA,E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AiB,EAAA,IAAA;AAAA,UACjB,YAAc,EAAA;AAAA,YACZ,IAAM,EAAA,WAAA;AAAA,YACN,IAAM,EAAA,oBAAA;AAAA,WACR;AAAA,SACF;AAAA,QACA,MAAQ,EAAA;AAAA,UACN,IAAM,EAAA,SAAA;AAAA,UACN,gBAAkB,EAAA,KAAA;AAAA,UAClB,QAAU,EAAA,IAAA;AAAA,UACV,gBAAkB,EAAA,aAAA;AAAA,SACpB;AAAA,QACA,YAAc,EAAA;AAAA,UACZ,IAAM,EAAA,cAAA;AAAA,UACN,UAAU,CAAC,EAAE,MAAM,QAAU,EAAA,IAAA,EAAM,WAAW,CAAA;AAAA,SAChD;AAAA,OACF;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,MAAQ,EAAA;AAAA,UACN,IAAM,EAAA,UAAA;AAAA,UACN,SAAW,EAAA,QAAA;AAAA,UACX,YAAc,EAAA,cAAA;AAAA,UACd,YAAc,EAAA,SAAA;AAAA,SAChB;AAAA,OACF;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -159,8 +159,9 @@ function registerListBoxItem(loader, overrides) {
|
|
|
159
159
|
props: {
|
|
160
160
|
id: {
|
|
161
161
|
type: "string",
|
|
162
|
-
description: "
|
|
162
|
+
description: "A unique key for tracking the selected item in state",
|
|
163
163
|
required: true,
|
|
164
|
+
displayName: "Value",
|
|
164
165
|
validator: (_value, _props, ctx) => {
|
|
165
166
|
if (ctx == null ? void 0 : ctx.idError) {
|
|
166
167
|
return ctx.idError;
|
|
@@ -170,7 +171,8 @@ function registerListBoxItem(loader, overrides) {
|
|
|
170
171
|
},
|
|
171
172
|
textValue: {
|
|
172
173
|
type: "string",
|
|
173
|
-
|
|
174
|
+
displayName: "Label",
|
|
175
|
+
description: "A user-friendly text representation of the item's contents, used for features like typeahead."
|
|
174
176
|
},
|
|
175
177
|
children: {
|
|
176
178
|
type: "slot",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerListBoxItem.cjs.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport React, { useEffect, useState } from \"react\";\nimport { ListBox, ListBoxItem } from \"react-aria-components\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport { DESCRIPTION_COMPONENT_NAME } from \"./registerDescription\";\nimport { TEXT_COMPONENT_NAME } from \"./registerText\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst LIST_BOX_ITEM_VARIANTS = [\n \"hovered\" as const,\n \"pressed\" as const,\n \"focused\" as const,\n \"focusVisible\" as const,\n \"selected\" as const,\n \"disabled\" as const,\n];\n\nconst { variants, withObservedValues } = pickAriaComponentVariants(\n LIST_BOX_ITEM_VARIANTS\n);\n\nexport interface BaseListBoxControlContextData {\n idError?: string;\n}\n\nexport interface BaseListBoxItemProps\n extends React.ComponentProps<typeof ListBoxItem>,\n HasControlContextData<BaseListBoxControlContextData>,\n WithVariants<typeof LIST_BOX_ITEM_VARIANTS> {\n id?: string;\n children?: React.ReactNode;\n}\n\nexport function BaseListBoxItem(props: BaseListBoxItemProps) {\n const { children, setControlContextData, plasmicUpdateVariant, id, ...rest } =\n props;\n const listboxContext = React.useContext(PlasmicListBoxContext);\n const isStandalone = !listboxContext;\n /**\n * Ids of each listboxitem inside a listbox have to be unique. Otherwise, the items won't show up in the listbox.\n * This is particularly important to ensure, because the most common use case would be to apply Repeat Element to the listbox item.\n * The ids of each repeated item will initially be the same (until the user changes the id prop of the listboxitem).\n *\n * The registerId, therefore, is the unique id of the listboxitem.\n * It is the id registered with the listbox context, so that it can auto-generate a unique id if it identifies a duplicate.\n */\n const [registeredId, setRegisteredId] = useState<string | undefined>();\n\n useEffect(() => {\n if (!listboxContext) {\n return;\n }\n\n const localId = listboxContext.idManager.register(id);\n setRegisteredId(localId);\n\n return () => {\n listboxContext.idManager.unregister(localId);\n setRegisteredId(undefined);\n };\n }, [id]);\n\n setControlContextData?.({\n idError: (() => {\n if (id === undefined) {\n return \"ID must be defined\";\n }\n if (typeof id !== \"string\") {\n return \"ID must be a string\";\n }\n if (!id.trim()) {\n return \"ID must be defined\";\n }\n if (!isStandalone && id != registeredId) {\n return \"ID must be unique\";\n }\n return undefined;\n })(),\n });\n\n const listboxItem = (\n <ListBoxItem key={registeredId} id={registeredId} {...rest}>\n {({\n isHovered,\n isPressed,\n isFocused,\n isFocusVisible,\n isSelected,\n isDisabled,\n }) =>\n withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n selected: isSelected,\n disabled: isDisabled,\n },\n plasmicUpdateVariant\n )\n }\n </ListBoxItem>\n );\n\n if (isStandalone) {\n // selection mode needs to be single/multiple to be able to trigger hover state on it.\n return <ListBox selectionMode=\"single\">{listboxItem}</ListBox>;\n }\n\n return listboxItem;\n}\n\nexport const makeDefaultListBoxItemChildren = (\n label: string,\n description?: string\n): PlasmicElement => ({\n type: \"vbox\",\n styles: {\n display: \"flex\",\n alignItems: \"flex-start\",\n gap: \"2px\",\n },\n children: [\n {\n type: \"component\",\n name: TEXT_COMPONENT_NAME,\n props: {\n slot: \"label\",\n children: {\n type: \"text\",\n styles: {\n fontWeight: 500,\n },\n value: label,\n },\n },\n },\n {\n type: \"component\",\n name: DESCRIPTION_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n styles: {\n color: \"#838383\",\n },\n value: description ?? `Some description for ${label}...`,\n },\n },\n },\n ],\n});\n\nexport function registerListBoxItem(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBoxItem>\n) {\n return registerComponentHelper(\n loader,\n BaseListBoxItem,\n {\n name: makeComponentName(\"item\"),\n displayName: \"Aria ListBoxItem\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBoxItem\",\n importName: \"BaseListBoxItem\",\n variants,\n props: {\n id: {\n type: \"string\",\n description: \"
|
|
1
|
+
{"version":3,"file":"registerListBoxItem.cjs.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport React, { useEffect, useState } from \"react\";\nimport { ListBox, ListBoxItem } from \"react-aria-components\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport { DESCRIPTION_COMPONENT_NAME } from \"./registerDescription\";\nimport { TEXT_COMPONENT_NAME } from \"./registerText\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst LIST_BOX_ITEM_VARIANTS = [\n \"hovered\" as const,\n \"pressed\" as const,\n \"focused\" as const,\n \"focusVisible\" as const,\n \"selected\" as const,\n \"disabled\" as const,\n];\n\nconst { variants, withObservedValues } = pickAriaComponentVariants(\n LIST_BOX_ITEM_VARIANTS\n);\n\nexport interface BaseListBoxControlContextData {\n idError?: string;\n}\n\nexport interface BaseListBoxItemProps\n extends React.ComponentProps<typeof ListBoxItem>,\n HasControlContextData<BaseListBoxControlContextData>,\n WithVariants<typeof LIST_BOX_ITEM_VARIANTS> {\n id?: string;\n children?: React.ReactNode;\n}\n\nexport function BaseListBoxItem(props: BaseListBoxItemProps) {\n const { children, setControlContextData, plasmicUpdateVariant, id, ...rest } =\n props;\n const listboxContext = React.useContext(PlasmicListBoxContext);\n const isStandalone = !listboxContext;\n /**\n * Ids of each listboxitem inside a listbox have to be unique. Otherwise, the items won't show up in the listbox.\n * This is particularly important to ensure, because the most common use case would be to apply Repeat Element to the listbox item.\n * The ids of each repeated item will initially be the same (until the user changes the id prop of the listboxitem).\n *\n * The registerId, therefore, is the unique id of the listboxitem.\n * It is the id registered with the listbox context, so that it can auto-generate a unique id if it identifies a duplicate.\n */\n const [registeredId, setRegisteredId] = useState<string | undefined>();\n\n useEffect(() => {\n if (!listboxContext) {\n return;\n }\n\n const localId = listboxContext.idManager.register(id);\n setRegisteredId(localId);\n\n return () => {\n listboxContext.idManager.unregister(localId);\n setRegisteredId(undefined);\n };\n }, [id]);\n\n setControlContextData?.({\n idError: (() => {\n if (id === undefined) {\n return \"ID must be defined\";\n }\n if (typeof id !== \"string\") {\n return \"ID must be a string\";\n }\n if (!id.trim()) {\n return \"ID must be defined\";\n }\n if (!isStandalone && id != registeredId) {\n return \"ID must be unique\";\n }\n return undefined;\n })(),\n });\n\n const listboxItem = (\n <ListBoxItem key={registeredId} id={registeredId} {...rest}>\n {({\n isHovered,\n isPressed,\n isFocused,\n isFocusVisible,\n isSelected,\n isDisabled,\n }) =>\n withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n selected: isSelected,\n disabled: isDisabled,\n },\n plasmicUpdateVariant\n )\n }\n </ListBoxItem>\n );\n\n if (isStandalone) {\n // selection mode needs to be single/multiple to be able to trigger hover state on it.\n return <ListBox selectionMode=\"single\">{listboxItem}</ListBox>;\n }\n\n return listboxItem;\n}\n\nexport const makeDefaultListBoxItemChildren = (\n label: string,\n description?: string\n): PlasmicElement => ({\n type: \"vbox\",\n styles: {\n display: \"flex\",\n alignItems: \"flex-start\",\n gap: \"2px\",\n },\n children: [\n {\n type: \"component\",\n name: TEXT_COMPONENT_NAME,\n props: {\n slot: \"label\",\n children: {\n type: \"text\",\n styles: {\n fontWeight: 500,\n },\n value: label,\n },\n },\n },\n {\n type: \"component\",\n name: DESCRIPTION_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n styles: {\n color: \"#838383\",\n },\n value: description ?? `Some description for ${label}...`,\n },\n },\n },\n ],\n});\n\nexport function registerListBoxItem(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBoxItem>\n) {\n return registerComponentHelper(\n loader,\n BaseListBoxItem,\n {\n name: makeComponentName(\"item\"),\n displayName: \"Aria ListBoxItem\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBoxItem\",\n importName: \"BaseListBoxItem\",\n variants,\n props: {\n id: {\n type: \"string\",\n description: \"A unique key for tracking the selected item in state\",\n required: true,\n displayName: \"Value\",\n validator: (_value, _props, ctx) => {\n if (ctx?.idError) {\n return ctx.idError;\n }\n return true;\n },\n },\n textValue: {\n type: \"string\",\n displayName: \"Label\",\n description:\n \"A user-friendly text representation of the item's contents, used for features like typeahead.\",\n },\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: makeDefaultListBoxItemChildren(\"Item\"),\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["pickAriaComponentVariants","React","PlasmicListBoxContext","useState","useEffect","ListBoxItem","ListBox","TEXT_COMPONENT_NAME","DESCRIPTION_COMPONENT_NAME","registerComponentHelper","makeComponentName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAM,sBAAyB,GAAA;AAAA,EAC7B,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAU,EAAA,kBAAA,EAAuB,GAAAA,sCAAA;AAAA,EACvC,sBAAA;AACF,CAAA,CAAA;AAcO,SAAS,gBAAgB,KAA6B,EAAA;AAC3D,EAAA,MACE,EADM,GAAA,KAAA,EAAA,EAAA,QAAA,EAAU,qBAAuB,EAAA,oBAAA,EAAsB,EAzCjE,EAAA,GA0CI,EADoE,EAAA,IAAA,GAAA,SAAA,CACpE,EADoE,EAAA,CAA9D,UAAU,EAAA,uBAAA,EAAuB,sBAAsB,EAAA,IAAA,CAAA,CAAA,CAAA;AAE/D,EAAM,MAAA,cAAA,GAAiBC,sBAAM,CAAA,UAAA,CAAWC,8BAAqB,CAAA,CAAA;AAC7D,EAAA,MAAM,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|
props: {
|
|
154
154
|
id: {
|
|
155
155
|
type: "string",
|
|
156
|
-
description: "
|
|
156
|
+
description: "A unique key for tracking the selected item in state",
|
|
157
157
|
required: true,
|
|
158
|
+
displayName: "Value",
|
|
158
159
|
validator: (_value, _props, ctx) => {
|
|
159
160
|
if (ctx == null ? void 0 : ctx.idError) {
|
|
160
161
|
return ctx.idError;
|
|
@@ -164,7 +165,8 @@ function registerListBoxItem(loader, overrides) {
|
|
|
164
165
|
},
|
|
165
166
|
textValue: {
|
|
166
167
|
type: "string",
|
|
167
|
-
|
|
168
|
+
displayName: "Label",
|
|
169
|
+
description: "A user-friendly text representation of the item's contents, used for features like typeahead."
|
|
168
170
|
},
|
|
169
171
|
children: {
|
|
170
172
|
type: "slot",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerListBoxItem.esm.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport React, { useEffect, useState } from \"react\";\nimport { ListBox, ListBoxItem } from \"react-aria-components\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport { DESCRIPTION_COMPONENT_NAME } from \"./registerDescription\";\nimport { TEXT_COMPONENT_NAME } from \"./registerText\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst LIST_BOX_ITEM_VARIANTS = [\n \"hovered\" as const,\n \"pressed\" as const,\n \"focused\" as const,\n \"focusVisible\" as const,\n \"selected\" as const,\n \"disabled\" as const,\n];\n\nconst { variants, withObservedValues } = pickAriaComponentVariants(\n LIST_BOX_ITEM_VARIANTS\n);\n\nexport interface BaseListBoxControlContextData {\n idError?: string;\n}\n\nexport interface BaseListBoxItemProps\n extends React.ComponentProps<typeof ListBoxItem>,\n HasControlContextData<BaseListBoxControlContextData>,\n WithVariants<typeof LIST_BOX_ITEM_VARIANTS> {\n id?: string;\n children?: React.ReactNode;\n}\n\nexport function BaseListBoxItem(props: BaseListBoxItemProps) {\n const { children, setControlContextData, plasmicUpdateVariant, id, ...rest } =\n props;\n const listboxContext = React.useContext(PlasmicListBoxContext);\n const isStandalone = !listboxContext;\n /**\n * Ids of each listboxitem inside a listbox have to be unique. Otherwise, the items won't show up in the listbox.\n * This is particularly important to ensure, because the most common use case would be to apply Repeat Element to the listbox item.\n * The ids of each repeated item will initially be the same (until the user changes the id prop of the listboxitem).\n *\n * The registerId, therefore, is the unique id of the listboxitem.\n * It is the id registered with the listbox context, so that it can auto-generate a unique id if it identifies a duplicate.\n */\n const [registeredId, setRegisteredId] = useState<string | undefined>();\n\n useEffect(() => {\n if (!listboxContext) {\n return;\n }\n\n const localId = listboxContext.idManager.register(id);\n setRegisteredId(localId);\n\n return () => {\n listboxContext.idManager.unregister(localId);\n setRegisteredId(undefined);\n };\n }, [id]);\n\n setControlContextData?.({\n idError: (() => {\n if (id === undefined) {\n return \"ID must be defined\";\n }\n if (typeof id !== \"string\") {\n return \"ID must be a string\";\n }\n if (!id.trim()) {\n return \"ID must be defined\";\n }\n if (!isStandalone && id != registeredId) {\n return \"ID must be unique\";\n }\n return undefined;\n })(),\n });\n\n const listboxItem = (\n <ListBoxItem key={registeredId} id={registeredId} {...rest}>\n {({\n isHovered,\n isPressed,\n isFocused,\n isFocusVisible,\n isSelected,\n isDisabled,\n }) =>\n withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n selected: isSelected,\n disabled: isDisabled,\n },\n plasmicUpdateVariant\n )\n }\n </ListBoxItem>\n );\n\n if (isStandalone) {\n // selection mode needs to be single/multiple to be able to trigger hover state on it.\n return <ListBox selectionMode=\"single\">{listboxItem}</ListBox>;\n }\n\n return listboxItem;\n}\n\nexport const makeDefaultListBoxItemChildren = (\n label: string,\n description?: string\n): PlasmicElement => ({\n type: \"vbox\",\n styles: {\n display: \"flex\",\n alignItems: \"flex-start\",\n gap: \"2px\",\n },\n children: [\n {\n type: \"component\",\n name: TEXT_COMPONENT_NAME,\n props: {\n slot: \"label\",\n children: {\n type: \"text\",\n styles: {\n fontWeight: 500,\n },\n value: label,\n },\n },\n },\n {\n type: \"component\",\n name: DESCRIPTION_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n styles: {\n color: \"#838383\",\n },\n value: description ?? `Some description for ${label}...`,\n },\n },\n },\n ],\n});\n\nexport function registerListBoxItem(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBoxItem>\n) {\n return registerComponentHelper(\n loader,\n BaseListBoxItem,\n {\n name: makeComponentName(\"item\"),\n displayName: \"Aria ListBoxItem\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBoxItem\",\n importName: \"BaseListBoxItem\",\n variants,\n props: {\n id: {\n type: \"string\",\n description: \"
|
|
1
|
+
{"version":3,"file":"registerListBoxItem.esm.js","sources":["../src/registerListBoxItem.tsx"],"sourcesContent":["import { PlasmicElement } from \"@plasmicapp/host\";\nimport React, { useEffect, useState } from \"react\";\nimport { ListBox, ListBoxItem } from \"react-aria-components\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport { DESCRIPTION_COMPONENT_NAME } from \"./registerDescription\";\nimport { TEXT_COMPONENT_NAME } from \"./registerText\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst LIST_BOX_ITEM_VARIANTS = [\n \"hovered\" as const,\n \"pressed\" as const,\n \"focused\" as const,\n \"focusVisible\" as const,\n \"selected\" as const,\n \"disabled\" as const,\n];\n\nconst { variants, withObservedValues } = pickAriaComponentVariants(\n LIST_BOX_ITEM_VARIANTS\n);\n\nexport interface BaseListBoxControlContextData {\n idError?: string;\n}\n\nexport interface BaseListBoxItemProps\n extends React.ComponentProps<typeof ListBoxItem>,\n HasControlContextData<BaseListBoxControlContextData>,\n WithVariants<typeof LIST_BOX_ITEM_VARIANTS> {\n id?: string;\n children?: React.ReactNode;\n}\n\nexport function BaseListBoxItem(props: BaseListBoxItemProps) {\n const { children, setControlContextData, plasmicUpdateVariant, id, ...rest } =\n props;\n const listboxContext = React.useContext(PlasmicListBoxContext);\n const isStandalone = !listboxContext;\n /**\n * Ids of each listboxitem inside a listbox have to be unique. Otherwise, the items won't show up in the listbox.\n * This is particularly important to ensure, because the most common use case would be to apply Repeat Element to the listbox item.\n * The ids of each repeated item will initially be the same (until the user changes the id prop of the listboxitem).\n *\n * The registerId, therefore, is the unique id of the listboxitem.\n * It is the id registered with the listbox context, so that it can auto-generate a unique id if it identifies a duplicate.\n */\n const [registeredId, setRegisteredId] = useState<string | undefined>();\n\n useEffect(() => {\n if (!listboxContext) {\n return;\n }\n\n const localId = listboxContext.idManager.register(id);\n setRegisteredId(localId);\n\n return () => {\n listboxContext.idManager.unregister(localId);\n setRegisteredId(undefined);\n };\n }, [id]);\n\n setControlContextData?.({\n idError: (() => {\n if (id === undefined) {\n return \"ID must be defined\";\n }\n if (typeof id !== \"string\") {\n return \"ID must be a string\";\n }\n if (!id.trim()) {\n return \"ID must be defined\";\n }\n if (!isStandalone && id != registeredId) {\n return \"ID must be unique\";\n }\n return undefined;\n })(),\n });\n\n const listboxItem = (\n <ListBoxItem key={registeredId} id={registeredId} {...rest}>\n {({\n isHovered,\n isPressed,\n isFocused,\n isFocusVisible,\n isSelected,\n isDisabled,\n }) =>\n withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n selected: isSelected,\n disabled: isDisabled,\n },\n plasmicUpdateVariant\n )\n }\n </ListBoxItem>\n );\n\n if (isStandalone) {\n // selection mode needs to be single/multiple to be able to trigger hover state on it.\n return <ListBox selectionMode=\"single\">{listboxItem}</ListBox>;\n }\n\n return listboxItem;\n}\n\nexport const makeDefaultListBoxItemChildren = (\n label: string,\n description?: string\n): PlasmicElement => ({\n type: \"vbox\",\n styles: {\n display: \"flex\",\n alignItems: \"flex-start\",\n gap: \"2px\",\n },\n children: [\n {\n type: \"component\",\n name: TEXT_COMPONENT_NAME,\n props: {\n slot: \"label\",\n children: {\n type: \"text\",\n styles: {\n fontWeight: 500,\n },\n value: label,\n },\n },\n },\n {\n type: \"component\",\n name: DESCRIPTION_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n styles: {\n color: \"#838383\",\n },\n value: description ?? `Some description for ${label}...`,\n },\n },\n },\n ],\n});\n\nexport function registerListBoxItem(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBoxItem>\n) {\n return registerComponentHelper(\n loader,\n BaseListBoxItem,\n {\n name: makeComponentName(\"item\"),\n displayName: \"Aria ListBoxItem\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBoxItem\",\n importName: \"BaseListBoxItem\",\n variants,\n props: {\n id: {\n type: \"string\",\n description: \"A unique key for tracking the selected item in state\",\n required: true,\n displayName: \"Value\",\n validator: (_value, _props, ctx) => {\n if (ctx?.idError) {\n return ctx.idError;\n }\n return true;\n },\n },\n textValue: {\n type: \"string\",\n displayName: \"Label\",\n description:\n \"A user-friendly text representation of the item's contents, used for features like typeahead.\",\n },\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: makeDefaultListBoxItemChildren(\"Item\"),\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAM,sBAAyB,GAAA;AAAA,EAC7B,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAU,EAAA,kBAAA,EAAuB,GAAA,yBAAA;AAAA,EACvC,sBAAA;AACF,CAAA,CAAA;AAcO,SAAS,gBAAgB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WACE,EAAA,+FAAA;AAAA,SACJ;AAAA,QACA,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,MAAA;AAAA,UACN,eAAiB,EAAA,IAAA;AAAA,UACjB,YAAA,EAAc,+BAA+B,MAAM,CAAA;AAAA,SACrD;AAAA,OACF;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -50,6 +50,7 @@ const INLINE_STYLES = {
|
|
|
50
50
|
};
|
|
51
51
|
const BaseModal = React.forwardRef(
|
|
52
52
|
function _BaseModal(props, ref) {
|
|
53
|
+
var _b;
|
|
53
54
|
const _a = props, {
|
|
54
55
|
children,
|
|
55
56
|
modalOverlayClass,
|
|
@@ -65,10 +66,11 @@ const BaseModal = React.forwardRef(
|
|
|
65
66
|
"resetClassName",
|
|
66
67
|
"setControlContextData"
|
|
67
68
|
]);
|
|
69
|
+
const { isSelected } = (_b = host.usePlasmicCanvasComponentInfo(props)) != null ? _b : {};
|
|
68
70
|
const contextProps = React__default.default.useContext(contexts.PlasmicDialogTriggerContext);
|
|
69
71
|
const isStandalone = !contextProps;
|
|
70
72
|
const mergedProps = reactAria.mergeProps(contextProps, rest, {
|
|
71
|
-
isOpen: isStandalone ? isOpen : contextProps.isOpen
|
|
73
|
+
isOpen: isStandalone ? isSelected || isOpen : contextProps.isOpen
|
|
72
74
|
});
|
|
73
75
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
74
76
|
parent: isStandalone ? void 0 : {}
|
|
@@ -174,7 +176,7 @@ function registerModal(loader, overrides) {
|
|
|
174
176
|
type: "boolean",
|
|
175
177
|
editOnly: true,
|
|
176
178
|
uncontrolledProp: "defaultOpen",
|
|
177
|
-
defaultValueHint:
|
|
179
|
+
defaultValueHint: true,
|
|
178
180
|
defaultValue: true,
|
|
179
181
|
hidden: common.hasParent
|
|
180
182
|
},
|