@plasmicpkgs/react-aria 0.0.69 → 0.0.71
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 +20 -45
- package/dist/react-aria.esm.js.map +1 -1
- package/dist/react-aria.js +20 -45
- package/dist/react-aria.js.map +1 -1
- package/dist/registerPopover.d.ts +2 -6
- package/package.json +2 -2
- package/skinny/registerComboBox.cjs.js +7 -13
- package/skinny/registerComboBox.cjs.js.map +1 -1
- package/skinny/registerComboBox.esm.js +7 -13
- package/skinny/registerComboBox.esm.js.map +1 -1
- package/skinny/registerDialogTrigger.cjs.js +1 -0
- package/skinny/registerDialogTrigger.cjs.js.map +1 -1
- package/skinny/registerDialogTrigger.esm.js +1 -0
- package/skinny/registerDialogTrigger.esm.js.map +1 -1
- package/skinny/registerPopover.cjs.js +3 -16
- package/skinny/registerPopover.cjs.js.map +1 -1
- package/skinny/registerPopover.d.ts +2 -6
- package/skinny/registerPopover.esm.js +3 -16
- package/skinny/registerPopover.esm.js.map +1 -1
- package/skinny/registerSelect.cjs.js +7 -13
- package/skinny/registerSelect.cjs.js.map +1 -1
- package/skinny/registerSelect.esm.js +7 -13
- package/skinny/registerSelect.esm.js.map +1 -1
- package/skinny/registerTooltip.cjs.js +2 -3
- package/skinny/registerTooltip.cjs.js.map +1 -1
- package/skinny/registerTooltip.esm.js +2 -3
- package/skinny/registerTooltip.esm.js.map +1 -1
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { PlasmicElement } from "@plasmicapp/host";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Popover } from "react-aria-components";
|
|
4
|
-
import { CodeComponentMetaOverrides,
|
|
4
|
+
import { CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
5
5
|
import { WithVariants } from "./variant-utils";
|
|
6
|
-
export interface PopoverControlContextData {
|
|
7
|
-
defaultShouldFlip?: boolean;
|
|
8
|
-
}
|
|
9
6
|
declare const POPOVER_VARIANTS: ("placementLeft" | "placementRight" | "placementTop" | "placementBottom")[];
|
|
10
|
-
export interface BasePopoverProps extends React.ComponentProps<typeof Popover>, WithVariants<typeof POPOVER_VARIANTS
|
|
7
|
+
export interface BasePopoverProps extends React.ComponentProps<typeof Popover>, WithVariants<typeof POPOVER_VARIANTS> {
|
|
11
8
|
className?: string;
|
|
12
9
|
resetClassName?: string;
|
|
13
|
-
defaultShouldFlip?: boolean;
|
|
14
10
|
children?: React.ReactNode;
|
|
15
11
|
}
|
|
16
12
|
export declare function BasePopover(props: BasePopoverProps): React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/react-aria",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.71",
|
|
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": "87d29695931cdd294f1aa3566fa7b67c7bc2abc4"
|
|
78
78
|
}
|
|
@@ -83,21 +83,15 @@ function BaseComboBox(props) {
|
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
85
|
}, []);
|
|
86
|
-
return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.ComboBox, __spreadValues({}, rest), /* @__PURE__ */ React__default.default.createElement(
|
|
87
|
-
contexts.
|
|
86
|
+
return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.ComboBox, __spreadValues({}, rest), /* @__PURE__ */ React__default.default.createElement(contexts.PlasmicPopoverContext.Provider, { value: { isOpen } }, /* @__PURE__ */ React__default.default.createElement(
|
|
87
|
+
contexts.PlasmicListBoxContext.Provider,
|
|
88
88
|
{
|
|
89
|
-
value: {
|
|
89
|
+
value: {
|
|
90
|
+
idManager
|
|
91
|
+
}
|
|
90
92
|
},
|
|
91
|
-
/* @__PURE__ */ React__default.default.createElement(
|
|
92
|
-
|
|
93
|
-
{
|
|
94
|
-
value: {
|
|
95
|
-
idManager
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
/* @__PURE__ */ React__default.default.createElement(contexts.PlasmicInputContext.Provider, { value: { isUncontrolled: true } }, /* @__PURE__ */ React__default.default.createElement(ComboboxAutoOpen, __spreadValues({}, props)), children)
|
|
99
|
-
)
|
|
100
|
-
));
|
|
93
|
+
/* @__PURE__ */ React__default.default.createElement(contexts.PlasmicInputContext.Provider, { value: { isUncontrolled: true } }, /* @__PURE__ */ React__default.default.createElement(ComboboxAutoOpen, __spreadValues({}, props)), children)
|
|
94
|
+
)));
|
|
101
95
|
}
|
|
102
96
|
function registerComboBox(loader) {
|
|
103
97
|
utils.registerComponentHelper(loader, BaseComboBox, {
|
|
@@ -1 +1 @@
|
|
|
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 editOnly: true,\n uncontrolledProp: \"defaultSelectedKey\",\n displayName: \"Initial selected item\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n // React Aria ComboBox do not support multiple selections yet\n multiSelect: false,\n },\n disabledKeys: {\n type: \"choice\",\n displayName: \"Disabled values\",\n description:\n \"The items 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: \"selectedValue\", 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 selectedValue: {\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,EAA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AAA,iBACF;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,KACF,CAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,aAAe,EAAA;AAAA,QACb,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.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 value={{ isOpen }}>\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 editOnly: true,\n uncontrolledProp: \"defaultSelectedKey\",\n displayName: \"Initial selected item\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n // React Aria ComboBox do not support multiple selections yet\n multiSelect: false,\n },\n disabledKeys: {\n type: \"choice\",\n displayName: \"Disabled values\",\n description:\n \"The items 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: \"selectedValue\", 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 selectedValue: {\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;AAC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A;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;;;;;"}
|
|
@@ -77,21 +77,15 @@ function BaseComboBox(props) {
|
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
79
|
}, []);
|
|
80
|
-
return /* @__PURE__ */ React.createElement(ComboBox, __spreadValues({}, rest), /* @__PURE__ */ React.createElement(
|
|
81
|
-
|
|
80
|
+
return /* @__PURE__ */ React.createElement(ComboBox, __spreadValues({}, rest), /* @__PURE__ */ React.createElement(PlasmicPopoverContext.Provider, { value: { isOpen } }, /* @__PURE__ */ React.createElement(
|
|
81
|
+
PlasmicListBoxContext.Provider,
|
|
82
82
|
{
|
|
83
|
-
value: {
|
|
83
|
+
value: {
|
|
84
|
+
idManager
|
|
85
|
+
}
|
|
84
86
|
},
|
|
85
|
-
/* @__PURE__ */ React.createElement(
|
|
86
|
-
|
|
87
|
-
{
|
|
88
|
-
value: {
|
|
89
|
-
idManager
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
/* @__PURE__ */ React.createElement(PlasmicInputContext.Provider, { value: { isUncontrolled: true } }, /* @__PURE__ */ React.createElement(ComboboxAutoOpen, __spreadValues({}, props)), children)
|
|
93
|
-
)
|
|
94
|
-
));
|
|
87
|
+
/* @__PURE__ */ React.createElement(PlasmicInputContext.Provider, { value: { isUncontrolled: true } }, /* @__PURE__ */ React.createElement(ComboboxAutoOpen, __spreadValues({}, props)), children)
|
|
88
|
+
)));
|
|
95
89
|
}
|
|
96
90
|
function registerComboBox(loader) {
|
|
97
91
|
registerComponentHelper(loader, BaseComboBox, {
|
|
@@ -1 +1 @@
|
|
|
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 editOnly: true,\n uncontrolledProp: \"defaultSelectedKey\",\n displayName: \"Initial selected item\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n // React Aria ComboBox do not support multiple selections yet\n multiSelect: false,\n },\n disabledKeys: {\n type: \"choice\",\n displayName: \"Disabled values\",\n description:\n \"The items 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: \"selectedValue\", 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 selectedValue: {\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}\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AAA;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,aAAe,EAAA;AAAA,QACb,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 value={{ isOpen }}>\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 editOnly: true,\n uncontrolledProp: \"defaultSelectedKey\",\n displayName: \"Initial selected item\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n // React Aria ComboBox do not support multiple selections yet\n multiSelect: false,\n },\n disabledKeys: {\n type: \"choice\",\n displayName: \"Disabled values\",\n description:\n \"The items 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: \"selectedValue\", 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 selectedValue: {\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,EAAA,CAAA;AAoDE,EAAM,MAAA,UAAA,GAAa,CAAC,CAAC,uBAAwB,EAAA,CAAA;AAC7C,EAAA,MAAM,EAAE,UAAW,EAAA,GAAA,CAAI,mCAA8B,KAAK,CAAA,KAAnC,YAAwC,EAAC,CAAA;AAChE,EAAM,MAAA,EAAE,MAAM,KAAM,EAAA,GAAA,CAAI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AA;AAAA,MACN,aAAe,EAAA;AAAA,QACb,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;;;;"}
|
|
@@ -67,6 +67,7 @@ function registerDialogTrigger(loader, overrides) {
|
|
|
67
67
|
displayName: "Aria Dialog Trigger",
|
|
68
68
|
importPath: "@plasmicpkgs/react-aria/skinny/registerDialogTrigger",
|
|
69
69
|
importName: "BaseDialogTrigger",
|
|
70
|
+
styleSections: false,
|
|
70
71
|
isAttachment: true,
|
|
71
72
|
props: {
|
|
72
73
|
trigger: {
|
|
@@ -1 +1 @@
|
|
|
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,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,KAAO,EAAA;AAAA,cACL,QAAU,EAAA;AAAA,gBACR,IAAM,EAAA,MAAA;AAAA,gBACN,KAAO,EAAA,aAAA;AAAA,eACT;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,QACA,MAAQ,EAAA;AAAA,UACN,IAAM,EAAA,MAAA;AAAA,UACN,eAAiB,EAAA,IAAA;AAAA,UACjB,YAAc,EAAA;AAAA,YACZ,IAAM,EAAA,WAAA;AAAA,YACN,IAAM,EAAAC,kCAAA;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;;;;;"}
|
|
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 styleSections: false,\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,UAAA,CAAA;AAErD,EAAM,MAAA,WAAA,GAAc,iCACf,IADe,CAAA,EAAA;AAAA,IAElB,MAAA,EAAA,CAAS,EAAc,GAAA,UAAA,IAAA,MAAA,KAAd,IAAyB,GAAA,EAAA,GAAA,KAAA;AAAA,GACpC,CAAA,CAAA;AAEA,EACE,uBAAAA,sBAAA,CAAA,aAAA,CAACC,oCAA4B,CAAA,QAAA,EAA5B,EAAqC,KAAA,EAAO,WAC3C,EAAA,kBAAAD,sBAAA,CAAA,aAAA,CAACE,iCAAkB,EAAA,cAAA,CAAA,EAAA,EAAA,WAAA,CAAA,EAChB,OACA,EAAA,MACH,CACF,CAAA,CAAA;AAEJ,CAAA;AAEgB,SAAA,qBAAA,CACd,QACA,SACA,EAAA;AACA,EAAAC,6BAAA;AAAA,IACE,MAAA;AAAA,IACA,iBAAA;AAAA,IACA;AAAA,MACE,IAAA,EAAMC,wBAAkB,eAAe,CAAA;AAAA,MACvC,WAAa,EAAA,qBAAA;AAAA,MACb,UAAY,EAAA,sDA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Trigger(loader, overrides) {
|
|
|
61
61
|
displayName: "Aria Dialog Trigger",
|
|
62
62
|
importPath: "@plasmicpkgs/react-aria/skinny/registerDialogTrigger",
|
|
63
63
|
importName: "BaseDialogTrigger",
|
|
64
|
+
styleSections: false,
|
|
64
65
|
isAttachment: true,
|
|
65
66
|
props: {
|
|
66
67
|
trigger: {
|
|
@@ -1 +1 @@
|
|
|
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,EAAE,YAAY,gBAAiB,EAAA,GAAA,CACnC,mCAA8B,KAAK,CAAA,KAAnC,YAAwC,EAAC,CAAA;AAC3C,EAAM,MAAA,UAAA,GAAa,qBAAqB,SAAa,IAAA,UAAA,CAAA;AAErD,EAAM,MAAA,WAAA,GAAc,iCACf,IADe,CAAA,EAAA;AAAA,IAElB,MAAA,EAAA,CAAS,EAAc,GAAA,UAAA,IAAA,MAAA,KAAd,IAAyB,GAAA,EAAA,GAAA,KAAA;AAAA,GACpC,CAA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,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;;;;"}
|
|
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 styleSections: false,\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,EAAE,YAAY,gBAAiB,EAAA,GAAA,CACnC,mCAA8B,KAAK,CAAA,KAAnC,YAAwC,EAAC,CAAA;AAC3C,EAAM,MAAA,UAAA,GAAa,qBAAqB,SAAa,IAAA,UAAA,CAAA;AAErD,EAAM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ACA,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;;;;"}
|
|
@@ -49,24 +49,14 @@ const POPOVER_VARIANTS = [
|
|
|
49
49
|
];
|
|
50
50
|
const { variants, withObservedValues } = variantUtils.pickAriaComponentVariants(POPOVER_VARIANTS);
|
|
51
51
|
function BasePopover(props) {
|
|
52
|
-
|
|
53
|
-
const _a = props, {
|
|
54
|
-
resetClassName,
|
|
55
|
-
setControlContextData,
|
|
56
|
-
plasmicUpdateVariant
|
|
57
|
-
} = _a, restProps = __objRest(_a, [
|
|
58
|
-
"resetClassName",
|
|
59
|
-
"setControlContextData",
|
|
60
|
-
"plasmicUpdateVariant"
|
|
61
|
-
]);
|
|
52
|
+
const _a = props, { resetClassName, plasmicUpdateVariant } = _a, restProps = __objRest(_a, ["resetClassName", "plasmicUpdateVariant"]);
|
|
62
53
|
const isStandalone = !React__default.default.useContext(reactAriaComponents.PopoverContext);
|
|
63
54
|
const context = React__default.default.useContext(contexts.PlasmicPopoverContext);
|
|
64
55
|
const triggerRef = React__default.default.useRef(null);
|
|
65
56
|
const isEditMode = !!host.usePlasmicCanvasContext();
|
|
66
57
|
const _b = utils.mergeProps(
|
|
67
58
|
{
|
|
68
|
-
isOpen: context == null ? void 0 : context.isOpen
|
|
69
|
-
shouldFlip: context == null ? void 0 : context.defaultShouldFlip
|
|
59
|
+
isOpen: context == null ? void 0 : context.isOpen
|
|
70
60
|
},
|
|
71
61
|
/**
|
|
72
62
|
* isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies. *
|
|
@@ -87,9 +77,6 @@ function BasePopover(props) {
|
|
|
87
77
|
isOpen: true
|
|
88
78
|
} : null
|
|
89
79
|
), { children } = _b, mergedProps = __objRest(_b, ["children"]);
|
|
90
|
-
setControlContextData == null ? void 0 : setControlContextData({
|
|
91
|
-
defaultShouldFlip: (_c = context == null ? void 0 : context.defaultShouldFlip) != null ? _c : true
|
|
92
|
-
});
|
|
93
80
|
return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, isStandalone && /* @__PURE__ */ React__default.default.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Popover, __spreadValues({}, mergedProps), ({ placement }) => withObservedValues(
|
|
94
81
|
children,
|
|
95
82
|
{
|
|
@@ -174,7 +161,7 @@ function registerPopover(loader, overrides) {
|
|
|
174
161
|
shouldFlip: {
|
|
175
162
|
type: "boolean",
|
|
176
163
|
description: "Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.",
|
|
177
|
-
defaultValueHint:
|
|
164
|
+
defaultValueHint: true
|
|
178
165
|
},
|
|
179
166
|
placement: {
|
|
180
167
|
type: "choice",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerPopover.cjs.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { PlasmicElement, usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Popover, PopoverContext } from \"react-aria-components\";\nimport { PlasmicPopoverContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nexport interface PopoverControlContextData {\n defaultShouldFlip?: boolean;\n}\n\n/*\n NOTE: Placement should be managed as variants, not just props.\n When `shouldFlip` is true, the placement prop may not represent the final position\n (e.g., if placement is set to \"bottom\" but lacks space, the popover may flip to \"top\").\n However, data-selectors will consistently indicate the actual placement of the popover.\n */\nconst POPOVER_VARIANTS = [\n \"placementTop\" as const,\n \"placementBottom\" as const,\n \"placementLeft\" as const,\n \"placementRight\" as const,\n];\n\nconst { variants, withObservedValues } =\n pickAriaComponentVariants(POPOVER_VARIANTS);\n\nexport interface BasePopoverProps\n extends React.ComponentProps<typeof Popover>,\n WithVariants<typeof POPOVER_VARIANTS>,\n HasControlContextData<PopoverControlContextData> {\n className?: string;\n resetClassName?: string;\n defaultShouldFlip?: boolean;\n children?: React.ReactNode;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const {\n resetClassName,\n setControlContextData,\n plasmicUpdateVariant,\n ...restProps\n } = props;\n // Popover can be inside DialogTrigger, Select, Combobox, etc. So we can't just use a particular context like DialogTrigger (like we do in Modal) to decide if it is standalone\n const isStandalone = !React.useContext(PopoverContext);\n const context = React.useContext(PlasmicPopoverContext);\n const triggerRef = React.useRef<any>(null);\n const isEditMode = !!usePlasmicCanvasContext();\n\n const { children, ...mergedProps } = mergeProps(\n {\n isOpen: context?.isOpen,\n shouldFlip: context?.defaultShouldFlip,\n },\n /**\n * isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies. *\n *\n * Setting isNonModal to true in edit mode (canvas) means that the popover will not prevent the user from interacting with the canvas while the popover is open.\n */\n isEditMode ? { isNonModal: true } : null,\n restProps,\n { className: `${resetClassName}` },\n // Override some props if the popover is standalone\n isStandalone\n ? {\n triggerRef,\n isNonModal: true,\n /**\n * Always true, because we assume that popover is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc, and its only really standalone in component view\n * In component view, we never want to start with an empty artboard, so isOpen has to be true\n * */\n\n isOpen: true,\n }\n : null\n );\n\n setControlContextData?.({\n defaultShouldFlip: context?.defaultShouldFlip ?? true,\n });\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover {...mergedProps}>\n {({ placement }) =>\n withObservedValues(\n children,\n {\n placementTop: placement === \"top\",\n placementBottom: placement === \"bottom\",\n placementLeft: placement === \"left\",\n placementRight: placement === \"right\",\n },\n plasmicUpdateVariant\n )\n }\n </Popover>\n </>\n );\n}\n\nexport const POPOVER_COMPONENT_NAME = makeComponentName(\"popover\");\nexport const POPOVER_ARROW_IMG: PlasmicElement = {\n type: \"img\",\n src: \"https://static1.plasmic.app/arrow-up.svg\",\n styles: {\n position: \"absolute\",\n top: \"-14px\",\n // center the arrow horizontally on the popover\n left: \"50%\",\n transform: \"translateX(-50%)\",\n width: \"15px\",\n },\n};\n\nexport function registerPopover(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BasePopover>\n) {\n registerComponentHelper(\n loader,\n BasePopover,\n {\n name: POPOVER_COMPONENT_NAME,\n displayName: \"Aria Popover\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerPopover\",\n importName: \"BasePopover\",\n variants,\n defaultStyles: {\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n padding: \"20px\",\n width: \"300px\",\n backgroundColor: \"#FDE3C3\",\n },\n props: {\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n POPOVER_ARROW_IMG,\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: 0,\n rowGap: \"10px\",\n },\n children: [\n {\n type: \"text\",\n value: \"This is a Popover!\",\n },\n {\n type: \"text\",\n value: \"You can put anything you can imagine here!\",\n styles: {\n fontWeight: 500,\n },\n },\n {\n type: \"text\",\n value:\n \"Use it in a `Aria Dialog Trigger` component to trigger it on a button click!\",\n },\n ],\n },\n ],\n },\n offset: {\n type: \"number\",\n displayName: \"Offset\",\n description:\n \"Additional offset applied vertically between the popover and its trigger\",\n defaultValueHint: 8,\n },\n shouldFlip: {\n type: \"boolean\",\n description:\n \"Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.\",\n defaultValueHint: (_props, ctx) => ctx?.defaultShouldFlip,\n },\n placement: {\n type: \"choice\",\n description:\n \"Default placement of the popover relative to the trigger, if there is enough space\",\n defaultValueHint: \"bottom\",\n options: [\n // Not allowing other placement options here because of https://github.com/adobe/react-spectrum/issues/6825\n \"top\",\n \"bottom\",\n \"left\",\n \"right\",\n ],\n },\n resetClassName: {\n type: \"themeResetClass\",\n },\n },\n // No isOpen state for popover, because we assume that its open state is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc.\n styleSections: true,\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["pickAriaComponentVariants","React","PopoverContext","PlasmicPopoverContext","usePlasmicCanvasContext","mergeProps","Popover","makeComponentName","registerComponentHelper"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,gBAAmB,GAAA;AAAA,EACvB,cAAA;AAAA,EACA,iBAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAA,EAAU,kBAAmB,EAAA,GACnCA,uCAA0B,gBAAgB,CAAA,CAAA;AAYrC,SAAS,YAAY,KAAyB,EAAA;AA5CrD,EAAA,IAAA,EAAA,CAAA;AA6CE,EAAA,MAKI,EAJF,GAAA,KAAA,EAAA;AAAA,IAAA,cAAA;AAAA,IACA,qBAAA;AAAA,IACA,oBAAA;AAAA,GAhDJ,GAkDM,EADC,EAAA,SAAA,GAAA,SAAA,CACD,EADC,EAAA;AAAA,IAHH,gBAAA;AAAA,IACA,uBAAA;AAAA,IACA,sBAAA;AAAA,GAAA,CAAA,CAAA;AAIF,EAAA,MAAM,YAAe,GAAA,CAACC,sBA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AAS,EAAA;AAAA;AAAA,YAEP,KAAA;AAAA,YACA,QAAA;AAAA,YACA,MAAA;AAAA,YACA,OAAA;AAAA,WACF;AAAA,SACF;AAAA,QACA,cAAgB,EAAA;AAAA,UACd,IAAM,EAAA,iBAAA;AAAA,SACR;AAAA,OACF;AAAA;AAAA,MAEA,aAAe,EAAA,IAAA;AAAA,MACf,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"registerPopover.cjs.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { PlasmicElement, usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Popover, PopoverContext } from \"react-aria-components\";\nimport { PlasmicPopoverContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\n/*\n NOTE: Placement should be managed as variants, not just props.\n When `shouldFlip` is true, the placement prop may not represent the final position\n (e.g., if placement is set to \"bottom\" but lacks space, the popover may flip to \"top\").\n However, data-selectors will consistently indicate the actual placement of the popover.\n */\nconst POPOVER_VARIANTS = [\n \"placementTop\" as const,\n \"placementBottom\" as const,\n \"placementLeft\" as const,\n \"placementRight\" as const,\n];\n\nconst { variants, withObservedValues } =\n pickAriaComponentVariants(POPOVER_VARIANTS);\n\nexport interface BasePopoverProps\n extends React.ComponentProps<typeof Popover>,\n WithVariants<typeof POPOVER_VARIANTS> {\n className?: string;\n resetClassName?: string;\n children?: React.ReactNode;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const { resetClassName, plasmicUpdateVariant, ...restProps } = props;\n // Popover can be inside DialogTrigger, Select, Combobox, etc. So we can't just use a particular context like DialogTrigger (like we do in Modal) to decide if it is standalone\n const isStandalone = !React.useContext(PopoverContext);\n const context = React.useContext(PlasmicPopoverContext);\n const triggerRef = React.useRef<any>(null);\n const isEditMode = !!usePlasmicCanvasContext();\n\n const { children, ...mergedProps } = mergeProps(\n {\n isOpen: context?.isOpen,\n },\n /**\n * isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies. *\n *\n * Setting isNonModal to true in edit mode (canvas) means that the popover will not prevent the user from interacting with the canvas while the popover is open.\n */\n isEditMode ? { isNonModal: true } : null,\n restProps,\n { className: `${resetClassName}` },\n // Override some props if the popover is standalone\n isStandalone\n ? {\n triggerRef,\n isNonModal: true,\n /**\n * Always true, because we assume that popover is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc, and its only really standalone in component view\n * In component view, we never want to start with an empty artboard, so isOpen has to be true\n * */\n\n isOpen: true,\n }\n : null\n );\n\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover {...mergedProps}>\n {({ placement }) =>\n withObservedValues(\n children,\n {\n placementTop: placement === \"top\",\n placementBottom: placement === \"bottom\",\n placementLeft: placement === \"left\",\n placementRight: placement === \"right\",\n },\n plasmicUpdateVariant\n )\n }\n </Popover>\n </>\n );\n}\n\nexport const POPOVER_COMPONENT_NAME = makeComponentName(\"popover\");\nexport const POPOVER_ARROW_IMG: PlasmicElement = {\n type: \"img\",\n src: \"https://static1.plasmic.app/arrow-up.svg\",\n styles: {\n position: \"absolute\",\n top: \"-14px\",\n // center the arrow horizontally on the popover\n left: \"50%\",\n transform: \"translateX(-50%)\",\n width: \"15px\",\n },\n};\n\nexport function registerPopover(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BasePopover>\n) {\n registerComponentHelper(\n loader,\n BasePopover,\n {\n name: POPOVER_COMPONENT_NAME,\n displayName: \"Aria Popover\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerPopover\",\n importName: \"BasePopover\",\n variants,\n defaultStyles: {\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n padding: \"20px\",\n width: \"300px\",\n backgroundColor: \"#FDE3C3\",\n },\n props: {\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n POPOVER_ARROW_IMG,\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: 0,\n rowGap: \"10px\",\n },\n children: [\n {\n type: \"text\",\n value: \"This is a Popover!\",\n },\n {\n type: \"text\",\n value: \"You can put anything you can imagine here!\",\n styles: {\n fontWeight: 500,\n },\n },\n {\n type: \"text\",\n value:\n \"Use it in a `Aria Dialog Trigger` component to trigger it on a button click!\",\n },\n ],\n },\n ],\n },\n offset: {\n type: \"number\",\n displayName: \"Offset\",\n description:\n \"Additional offset applied vertically between the popover and its trigger\",\n defaultValueHint: 8,\n },\n shouldFlip: {\n type: \"boolean\",\n description:\n \"Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.\",\n defaultValueHint: true,\n },\n placement: {\n type: \"choice\",\n description:\n \"Default placement of the popover relative to the trigger, if there is enough space\",\n defaultValueHint: \"bottom\",\n options: [\n // Not allowing other placement options here because of https://github.com/adobe/react-spectrum/issues/6825\n \"top\",\n \"bottom\",\n \"left\",\n \"right\",\n ],\n },\n resetClassName: {\n type: \"themeResetClass\",\n },\n },\n // No isOpen state for popover, because we assume that its open state is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc.\n styleSections: true,\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["pickAriaComponentVariants","React","PopoverContext","PlasmicPopoverContext","usePlasmicCanvasContext","mergeProps","Popover","makeComponentName","registerComponentHelper"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,gBAAmB,GAAA;AAAA,EACvB,cAAA;AAAA,EACA,iBAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAA,EAAU,kBAAmB,EAAA,GACnCA,uCAA0B,gBAAgB,CAAA,CAAA;AAUrC,SAAS,YAAY,KA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;AAAA,MAEA,aAAe,EAAA,IAAA;AAAA,MACf,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;;;"}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { PlasmicElement } from "@plasmicapp/host";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Popover } from "react-aria-components";
|
|
4
|
-
import { CodeComponentMetaOverrides,
|
|
4
|
+
import { CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
5
5
|
import { WithVariants } from "./variant-utils";
|
|
6
|
-
export interface PopoverControlContextData {
|
|
7
|
-
defaultShouldFlip?: boolean;
|
|
8
|
-
}
|
|
9
6
|
declare const POPOVER_VARIANTS: ("placementLeft" | "placementRight" | "placementTop" | "placementBottom")[];
|
|
10
|
-
export interface BasePopoverProps extends React.ComponentProps<typeof Popover>, WithVariants<typeof POPOVER_VARIANTS
|
|
7
|
+
export interface BasePopoverProps extends React.ComponentProps<typeof Popover>, WithVariants<typeof POPOVER_VARIANTS> {
|
|
11
8
|
className?: string;
|
|
12
9
|
resetClassName?: string;
|
|
13
|
-
defaultShouldFlip?: boolean;
|
|
14
10
|
children?: React.ReactNode;
|
|
15
11
|
}
|
|
16
12
|
export declare function BasePopover(props: BasePopoverProps): React.JSX.Element;
|
|
@@ -43,24 +43,14 @@ const POPOVER_VARIANTS = [
|
|
|
43
43
|
];
|
|
44
44
|
const { variants, withObservedValues } = pickAriaComponentVariants(POPOVER_VARIANTS);
|
|
45
45
|
function BasePopover(props) {
|
|
46
|
-
|
|
47
|
-
const _a = props, {
|
|
48
|
-
resetClassName,
|
|
49
|
-
setControlContextData,
|
|
50
|
-
plasmicUpdateVariant
|
|
51
|
-
} = _a, restProps = __objRest(_a, [
|
|
52
|
-
"resetClassName",
|
|
53
|
-
"setControlContextData",
|
|
54
|
-
"plasmicUpdateVariant"
|
|
55
|
-
]);
|
|
46
|
+
const _a = props, { resetClassName, plasmicUpdateVariant } = _a, restProps = __objRest(_a, ["resetClassName", "plasmicUpdateVariant"]);
|
|
56
47
|
const isStandalone = !React.useContext(PopoverContext);
|
|
57
48
|
const context = React.useContext(PlasmicPopoverContext);
|
|
58
49
|
const triggerRef = React.useRef(null);
|
|
59
50
|
const isEditMode = !!usePlasmicCanvasContext();
|
|
60
51
|
const _b = mergeProps(
|
|
61
52
|
{
|
|
62
|
-
isOpen: context == null ? void 0 : context.isOpen
|
|
63
|
-
shouldFlip: context == null ? void 0 : context.defaultShouldFlip
|
|
53
|
+
isOpen: context == null ? void 0 : context.isOpen
|
|
64
54
|
},
|
|
65
55
|
/**
|
|
66
56
|
* isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies. *
|
|
@@ -81,9 +71,6 @@ function BasePopover(props) {
|
|
|
81
71
|
isOpen: true
|
|
82
72
|
} : null
|
|
83
73
|
), { children } = _b, mergedProps = __objRest(_b, ["children"]);
|
|
84
|
-
setControlContextData == null ? void 0 : setControlContextData({
|
|
85
|
-
defaultShouldFlip: (_c = context == null ? void 0 : context.defaultShouldFlip) != null ? _c : true
|
|
86
|
-
});
|
|
87
74
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, isStandalone && /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(Popover, __spreadValues({}, mergedProps), ({ placement }) => withObservedValues(
|
|
88
75
|
children,
|
|
89
76
|
{
|
|
@@ -168,7 +155,7 @@ function registerPopover(loader, overrides) {
|
|
|
168
155
|
shouldFlip: {
|
|
169
156
|
type: "boolean",
|
|
170
157
|
description: "Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.",
|
|
171
|
-
defaultValueHint:
|
|
158
|
+
defaultValueHint: true
|
|
172
159
|
},
|
|
173
160
|
placement: {
|
|
174
161
|
type: "choice",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerPopover.esm.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { PlasmicElement, usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Popover, PopoverContext } from \"react-aria-components\";\nimport { PlasmicPopoverContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nexport interface PopoverControlContextData {\n defaultShouldFlip?: boolean;\n}\n\n/*\n NOTE: Placement should be managed as variants, not just props.\n When `shouldFlip` is true, the placement prop may not represent the final position\n (e.g., if placement is set to \"bottom\" but lacks space, the popover may flip to \"top\").\n However, data-selectors will consistently indicate the actual placement of the popover.\n */\nconst POPOVER_VARIANTS = [\n \"placementTop\" as const,\n \"placementBottom\" as const,\n \"placementLeft\" as const,\n \"placementRight\" as const,\n];\n\nconst { variants, withObservedValues } =\n pickAriaComponentVariants(POPOVER_VARIANTS);\n\nexport interface BasePopoverProps\n extends React.ComponentProps<typeof Popover>,\n WithVariants<typeof POPOVER_VARIANTS>,\n HasControlContextData<PopoverControlContextData> {\n className?: string;\n resetClassName?: string;\n defaultShouldFlip?: boolean;\n children?: React.ReactNode;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const {\n resetClassName,\n setControlContextData,\n plasmicUpdateVariant,\n ...restProps\n } = props;\n // Popover can be inside DialogTrigger, Select, Combobox, etc. So we can't just use a particular context like DialogTrigger (like we do in Modal) to decide if it is standalone\n const isStandalone = !React.useContext(PopoverContext);\n const context = React.useContext(PlasmicPopoverContext);\n const triggerRef = React.useRef<any>(null);\n const isEditMode = !!usePlasmicCanvasContext();\n\n const { children, ...mergedProps } = mergeProps(\n {\n isOpen: context?.isOpen,\n shouldFlip: context?.defaultShouldFlip,\n },\n /**\n * isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies. *\n *\n * Setting isNonModal to true in edit mode (canvas) means that the popover will not prevent the user from interacting with the canvas while the popover is open.\n */\n isEditMode ? { isNonModal: true } : null,\n restProps,\n { className: `${resetClassName}` },\n // Override some props if the popover is standalone\n isStandalone\n ? {\n triggerRef,\n isNonModal: true,\n /**\n * Always true, because we assume that popover is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc, and its only really standalone in component view\n * In component view, we never want to start with an empty artboard, so isOpen has to be true\n * */\n\n isOpen: true,\n }\n : null\n );\n\n setControlContextData?.({\n defaultShouldFlip: context?.defaultShouldFlip ?? true,\n });\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover {...mergedProps}>\n {({ placement }) =>\n withObservedValues(\n children,\n {\n placementTop: placement === \"top\",\n placementBottom: placement === \"bottom\",\n placementLeft: placement === \"left\",\n placementRight: placement === \"right\",\n },\n plasmicUpdateVariant\n )\n }\n </Popover>\n </>\n );\n}\n\nexport const POPOVER_COMPONENT_NAME = makeComponentName(\"popover\");\nexport const POPOVER_ARROW_IMG: PlasmicElement = {\n type: \"img\",\n src: \"https://static1.plasmic.app/arrow-up.svg\",\n styles: {\n position: \"absolute\",\n top: \"-14px\",\n // center the arrow horizontally on the popover\n left: \"50%\",\n transform: \"translateX(-50%)\",\n width: \"15px\",\n },\n};\n\nexport function registerPopover(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BasePopover>\n) {\n registerComponentHelper(\n loader,\n BasePopover,\n {\n name: POPOVER_COMPONENT_NAME,\n displayName: \"Aria Popover\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerPopover\",\n importName: \"BasePopover\",\n variants,\n defaultStyles: {\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n padding: \"20px\",\n width: \"300px\",\n backgroundColor: \"#FDE3C3\",\n },\n props: {\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n POPOVER_ARROW_IMG,\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: 0,\n rowGap: \"10px\",\n },\n children: [\n {\n type: \"text\",\n value: \"This is a Popover!\",\n },\n {\n type: \"text\",\n value: \"You can put anything you can imagine here!\",\n styles: {\n fontWeight: 500,\n },\n },\n {\n type: \"text\",\n value:\n \"Use it in a `Aria Dialog Trigger` component to trigger it on a button click!\",\n },\n ],\n },\n ],\n },\n offset: {\n type: \"number\",\n displayName: \"Offset\",\n description:\n \"Additional offset applied vertically between the popover and its trigger\",\n defaultValueHint: 8,\n },\n shouldFlip: {\n type: \"boolean\",\n description:\n \"Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.\",\n defaultValueHint: (_props, ctx) => ctx?.defaultShouldFlip,\n },\n placement: {\n type: \"choice\",\n description:\n \"Default placement of the popover relative to the trigger, if there is enough space\",\n defaultValueHint: \"bottom\",\n options: [\n // Not allowing other placement options here because of https://github.com/adobe/react-spectrum/issues/6825\n \"top\",\n \"bottom\",\n \"left\",\n \"right\",\n ],\n },\n resetClassName: {\n type: \"themeResetClass\",\n },\n },\n // No isOpen state for popover, because we assume that its open state is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc.\n styleSections: true,\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,gBAAmB,GAAA;AAAA,EACvB,cAAA;AAAA,EACA,iBAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAA,EAAU,kBAAmB,EAAA,GACnC,0BAA0B,gBAAgB,CAAA,CAAA;AAYrC,SAAS,YAAY,KAAyB,EAAA;AA5CrD,EAAA,IAAA,EAAA,CAAA;AA6CE,EAAA,MAKI,EAJF,GAAA,KAAA,EAAA;AAAA,IAAA,cAAA;AAAA,IACA,qBAAA;AAAA,IACA,oBAAA;AAAA,GAhDJ,GAkDM,EADC,EAAA,SAAA,GAAA,SAAA,CACD,EADC,EAAA;AAAA,IAHH,gBAAA;AAAA,IACA,uBAAA;AAAA,IAC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A;AAAA,UACF,gBAAkB,EAAA,QAAA;AAAA,UAClB,OAAS,EAAA;AAAA;AAAA,YAEP,KAAA;AAAA,YACA,QAAA;AAAA,YACA,MAAA;AAAA,YACA,OAAA;AAAA,WACF;AAAA,SACF;AAAA,QACA,cAAgB,EAAA;AAAA,UACd,IAAM,EAAA,iBAAA;AAAA,SACR;AAAA,OACF;AAAA;AAAA,MAEA,aAAe,EAAA,IAAA;AAAA,MACf,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"registerPopover.esm.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { PlasmicElement, usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Popover, PopoverContext } from \"react-aria-components\";\nimport { PlasmicPopoverContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\n/*\n NOTE: Placement should be managed as variants, not just props.\n When `shouldFlip` is true, the placement prop may not represent the final position\n (e.g., if placement is set to \"bottom\" but lacks space, the popover may flip to \"top\").\n However, data-selectors will consistently indicate the actual placement of the popover.\n */\nconst POPOVER_VARIANTS = [\n \"placementTop\" as const,\n \"placementBottom\" as const,\n \"placementLeft\" as const,\n \"placementRight\" as const,\n];\n\nconst { variants, withObservedValues } =\n pickAriaComponentVariants(POPOVER_VARIANTS);\n\nexport interface BasePopoverProps\n extends React.ComponentProps<typeof Popover>,\n WithVariants<typeof POPOVER_VARIANTS> {\n className?: string;\n resetClassName?: string;\n children?: React.ReactNode;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const { resetClassName, plasmicUpdateVariant, ...restProps } = props;\n // Popover can be inside DialogTrigger, Select, Combobox, etc. So we can't just use a particular context like DialogTrigger (like we do in Modal) to decide if it is standalone\n const isStandalone = !React.useContext(PopoverContext);\n const context = React.useContext(PlasmicPopoverContext);\n const triggerRef = React.useRef<any>(null);\n const isEditMode = !!usePlasmicCanvasContext();\n\n const { children, ...mergedProps } = mergeProps(\n {\n isOpen: context?.isOpen,\n },\n /**\n * isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies. *\n *\n * Setting isNonModal to true in edit mode (canvas) means that the popover will not prevent the user from interacting with the canvas while the popover is open.\n */\n isEditMode ? { isNonModal: true } : null,\n restProps,\n { className: `${resetClassName}` },\n // Override some props if the popover is standalone\n isStandalone\n ? {\n triggerRef,\n isNonModal: true,\n /**\n * Always true, because we assume that popover is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc, and its only really standalone in component view\n * In component view, we never want to start with an empty artboard, so isOpen has to be true\n * */\n\n isOpen: true,\n }\n : null\n );\n\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover {...mergedProps}>\n {({ placement }) =>\n withObservedValues(\n children,\n {\n placementTop: placement === \"top\",\n placementBottom: placement === \"bottom\",\n placementLeft: placement === \"left\",\n placementRight: placement === \"right\",\n },\n plasmicUpdateVariant\n )\n }\n </Popover>\n </>\n );\n}\n\nexport const POPOVER_COMPONENT_NAME = makeComponentName(\"popover\");\nexport const POPOVER_ARROW_IMG: PlasmicElement = {\n type: \"img\",\n src: \"https://static1.plasmic.app/arrow-up.svg\",\n styles: {\n position: \"absolute\",\n top: \"-14px\",\n // center the arrow horizontally on the popover\n left: \"50%\",\n transform: \"translateX(-50%)\",\n width: \"15px\",\n },\n};\n\nexport function registerPopover(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BasePopover>\n) {\n registerComponentHelper(\n loader,\n BasePopover,\n {\n name: POPOVER_COMPONENT_NAME,\n displayName: \"Aria Popover\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerPopover\",\n importName: \"BasePopover\",\n variants,\n defaultStyles: {\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n padding: \"20px\",\n width: \"300px\",\n backgroundColor: \"#FDE3C3\",\n },\n props: {\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n POPOVER_ARROW_IMG,\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: 0,\n rowGap: \"10px\",\n },\n children: [\n {\n type: \"text\",\n value: \"This is a Popover!\",\n },\n {\n type: \"text\",\n value: \"You can put anything you can imagine here!\",\n styles: {\n fontWeight: 500,\n },\n },\n {\n type: \"text\",\n value:\n \"Use it in a `Aria Dialog Trigger` component to trigger it on a button click!\",\n },\n ],\n },\n ],\n },\n offset: {\n type: \"number\",\n displayName: \"Offset\",\n description:\n \"Additional offset applied vertically between the popover and its trigger\",\n defaultValueHint: 8,\n },\n shouldFlip: {\n type: \"boolean\",\n description:\n \"Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.\",\n defaultValueHint: true,\n },\n placement: {\n type: \"choice\",\n description:\n \"Default placement of the popover relative to the trigger, if there is enough space\",\n defaultValueHint: \"bottom\",\n options: [\n // Not allowing other placement options here because of https://github.com/adobe/react-spectrum/issues/6825\n \"top\",\n \"bottom\",\n \"left\",\n \"right\",\n ],\n },\n resetClassName: {\n type: \"themeResetClass\",\n },\n },\n // No isOpen state for popover, because we assume that its open state is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc.\n styleSections: true,\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,gBAAmB,GAAA;AAAA,EACvB,cAAA;AAAA,EACA,iBAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAA,EAAU,kBAAmB,EAAA,GACnC,0BAA0B,gBAAgB,CAAA,CAAA;AAUrC,SAAS,YAAY,KAAyB,EAAA;AACnD,EAA+D,MAAA,EAAA,GAAA,KAAA,EAAv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A,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -88,21 +88,15 @@ function BaseSelect(props) {
|
|
|
88
88
|
"aria-label": ariaLabel,
|
|
89
89
|
isOpen: _isOpen
|
|
90
90
|
}, utils.extractPlasmicDataProps(props)),
|
|
91
|
-
/* @__PURE__ */ React__default.default.createElement(
|
|
92
|
-
contexts.
|
|
91
|
+
/* @__PURE__ */ React__default.default.createElement(contexts.PlasmicPopoverContext.Provider, { value: { isOpen: _isOpen } }, /* @__PURE__ */ React__default.default.createElement(
|
|
92
|
+
contexts.PlasmicListBoxContext.Provider,
|
|
93
93
|
{
|
|
94
|
-
value: {
|
|
94
|
+
value: {
|
|
95
|
+
idManager
|
|
96
|
+
}
|
|
95
97
|
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
{
|
|
99
|
-
value: {
|
|
100
|
-
idManager
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
children
|
|
104
|
-
)
|
|
105
|
-
)
|
|
98
|
+
children
|
|
99
|
+
))
|
|
106
100
|
);
|
|
107
101
|
}
|
|
108
102
|
function registerSelect(loader) {
|