@plasmicpkgs/react-aria 0.0.95 → 0.0.97

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.
@@ -1,8 +1,8 @@
1
1
  import { usePlasmicCanvasContext, usePlasmicCanvasComponentInfo } from '@plasmicapp/host';
2
2
  import React, { forwardRef, useImperativeHandle } from 'react';
3
3
  import { mergeProps } from 'react-aria';
4
- import { ModalOverlay, Modal, Dialog } from 'react-aria-components';
5
- import { C as COMMON_STYLES, h as hasParent } from './common-2dfadd70.esm.js';
4
+ import { ModalOverlay, Modal } from 'react-aria-components';
5
+ import { h as hasParent } from './common-2dfadd70.esm.js';
6
6
  import { d as PlasmicDialogTriggerContext } from './contexts-5cb81c2f.esm.js';
7
7
  import { HEADING_COMPONENT_NAME } from './registerHeading.esm.js';
8
8
  import { m as makeComponentName, r as registerComponentHelper } from './utils-5d1b4c6b.esm.js';
@@ -88,18 +88,47 @@ const BaseModal = forwardRef(
88
88
  (_a2 = mergedProps.onOpenChange) == null ? void 0 : _a2.call(mergedProps, true);
89
89
  }
90
90
  }));
91
- const dialogInCanvas = /* @__PURE__ */ React.createElement("div", { style: COMMON_STYLES, className }, children);
92
- const dialog = /* @__PURE__ */ React.createElement(Dialog, { style: COMMON_STYLES, className }, children);
93
91
  return /* @__PURE__ */ React.createElement(
94
92
  ModalOverlay,
95
93
  __spreadProps(__spreadValues({}, mergedProps), {
96
94
  className: `${resetClassName} ${modalOverlayClass}`
97
95
  }),
98
- /* @__PURE__ */ React.createElement(Modal, null, canvasCtx ? dialogInCanvas : dialog)
96
+ /* @__PURE__ */ React.createElement(Modal, { className }, children)
99
97
  );
100
98
  }
101
99
  );
102
100
  const MODAL_COMPONENT_NAME = makeComponentName("modal");
101
+ const MODAL_DEFAULT_SLOT_CONTENT = {
102
+ type: "vbox",
103
+ styles: {
104
+ width: "stretch",
105
+ padding: 0,
106
+ gap: "10px",
107
+ justifyContent: "flex-start",
108
+ alignItems: "flex-start"
109
+ },
110
+ children: [
111
+ {
112
+ type: "component",
113
+ name: HEADING_COMPONENT_NAME
114
+ },
115
+ {
116
+ type: "text",
117
+ value: "This is a Modal!"
118
+ },
119
+ {
120
+ type: "text",
121
+ value: "You can put anything you can imagine here!",
122
+ styles: {
123
+ fontWeight: 500
124
+ }
125
+ },
126
+ {
127
+ type: "text",
128
+ value: "Use it in a `Aria Dialog Trigger` component to trigger it on a button click!"
129
+ }
130
+ ]
131
+ };
103
132
  function registerModal(loader, overrides) {
104
133
  registerComponentHelper(
105
134
  loader,
@@ -138,37 +167,7 @@ function registerModal(loader, overrides) {
138
167
  children: {
139
168
  type: "slot",
140
169
  mergeWithParent: true,
141
- defaultValue: {
142
- type: "vbox",
143
- styles: {
144
- width: "stretch",
145
- padding: 0,
146
- gap: "10px",
147
- justifyContent: "flex-start",
148
- alignItems: "flex-start"
149
- },
150
- children: [
151
- {
152
- type: "component",
153
- name: HEADING_COMPONENT_NAME
154
- },
155
- {
156
- type: "text",
157
- value: "This is a Modal!"
158
- },
159
- {
160
- type: "text",
161
- value: "You can put anything you can imagine here!",
162
- styles: {
163
- fontWeight: 500
164
- }
165
- },
166
- {
167
- type: "text",
168
- value: "Use it in a `Aria Dialog Trigger` component to trigger it on a button click!"
169
- }
170
- ]
171
- }
170
+ defaultValue: MODAL_DEFAULT_SLOT_CONTENT
172
171
  },
173
172
  modalOverlayClass: {
174
173
  type: "class",
@@ -213,5 +212,5 @@ function registerModal(loader, overrides) {
213
212
  );
214
213
  }
215
214
 
216
- export { BaseModal, MODAL_COMPONENT_NAME, registerModal };
215
+ export { BaseModal, MODAL_COMPONENT_NAME, MODAL_DEFAULT_SLOT_CONTENT, registerModal };
217
216
  //# sourceMappingURL=registerModal.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"registerModal.esm.js","sources":["../src/registerModal.tsx"],"sourcesContent":["import {\n usePlasmicCanvasComponentInfo,\n usePlasmicCanvasContext,\n} from \"@plasmicapp/host\";\nimport React, { forwardRef, useImperativeHandle } from \"react\";\nimport { mergeProps } from \"react-aria\";\nimport {\n Dialog,\n Modal,\n ModalOverlay,\n ModalOverlayProps,\n} from \"react-aria-components\";\nimport { COMMON_STYLES, hasParent } from \"./common\";\nimport { PlasmicDialogTriggerContext } from \"./contexts\";\nimport { HEADING_COMPONENT_NAME } from \"./registerHeading\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseModalProps\n extends ModalOverlayProps,\n HasControlContextData {\n heading: React.ReactNode;\n modalOverlayClass: string;\n resetClassName?: string;\n children?: React.ReactNode;\n className?: string;\n}\n\nexport interface BaseModalActions {\n close(): void;\n open(): void;\n}\n\nexport const BaseModal = forwardRef<BaseModalActions, BaseModalProps>(\n function BaseModalInner(props, ref) {\n const {\n children,\n modalOverlayClass,\n className,\n isOpen,\n resetClassName,\n setControlContextData,\n isDismissable,\n ...rest\n } = props;\n\n const canvasCtx = usePlasmicCanvasContext();\n const isEditMode = canvasCtx && canvasCtx.interactive === false;\n const isSelected =\n usePlasmicCanvasComponentInfo?.(props)?.isSelected ?? false;\n\n const contextProps = React.useContext(PlasmicDialogTriggerContext);\n const isStandalone = !contextProps;\n const mergedProps = mergeProps(contextProps, rest, {\n isOpen: isStandalone ? isSelected || isOpen : contextProps.isOpen,\n /*\n isDismissable on canvas (non-interactive mode) causes the following two issues:\n 1. Clicking anywhere inside the modal dismisses it\n 2. If the modal is auto-opened due to selection in outline tab, the modal stays open despite issue #1, but the text elements inside the modal are no longer selectable, and therefore the text or headings inside the modal are not editable.\n\n To fix the above issue, we set an interim isDismissable state to false in edit mode, because it only matters in interactive mode.\n */\n isDismissable: isEditMode ? false : isDismissable,\n });\n\n setControlContextData?.({\n parent: isStandalone ? undefined : {},\n });\n\n // Expose close operation using useImperativeHandle\n useImperativeHandle(ref, () => ({\n close: () => {\n mergedProps.onOpenChange?.(false);\n },\n open: () => {\n mergedProps.onOpenChange?.(true);\n },\n }));\n\n /* <Dialog> cannot be used in canvas, because while the dialog is open on the canvas, the focus is trapped inside it, so any Studio modals like the Color Picker modal would glitch due to focus jumping back and forth */\n const dialogInCanvas = (\n <div style={COMMON_STYLES} className={className}>\n {children}\n </div>\n );\n\n const dialog = (\n <Dialog style={COMMON_STYLES} className={className}>\n {children}\n </Dialog>\n );\n\n return (\n <ModalOverlay\n {...mergedProps}\n className={`${resetClassName} ${modalOverlayClass}`}\n >\n <Modal>{canvasCtx ? dialogInCanvas : dialog}</Modal>\n </ModalOverlay>\n );\n }\n);\n\nexport const MODAL_COMPONENT_NAME = makeComponentName(\"modal\");\n\nexport function registerModal(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseModal>\n) {\n registerComponentHelper(\n loader,\n BaseModal,\n {\n name: MODAL_COMPONENT_NAME,\n displayName: \"Aria Modal\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerModal\",\n importName: \"BaseModal\",\n styleSections: true,\n defaultStyles: {\n // centering the modal on the page by default\n position: \"fixed\",\n top: \"10%\",\n left: \"50%\",\n width: \"50%\",\n transform: \"translateX(-50%)\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n padding: \"20px\",\n maxWidth: \"300px\",\n backgroundColor: \"#FDE3C3\",\n },\n refActions: {\n open: {\n description: \"Open the modal\",\n argTypes: [],\n },\n close: {\n description: \"Close the modal\",\n argTypes: [],\n },\n },\n props: {\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: 0,\n gap: \"10px\",\n justifyContent: \"flex-start\",\n alignItems: \"flex-start\",\n },\n children: [\n {\n type: \"component\",\n name: HEADING_COMPONENT_NAME,\n },\n {\n type: \"text\",\n value: \"This is a Modal!\",\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 modalOverlayClass: {\n type: \"class\",\n displayName: \"Modal Overlay\",\n },\n isOpen: {\n type: \"boolean\",\n editOnly: true,\n uncontrolledProp: \"defaultOpen\",\n defaultValueHint: true,\n defaultValue: true,\n hidden: hasParent,\n },\n isDismissable: {\n type: \"boolean\",\n description:\n \"Whether to close the modal when the user interacts outside it.\",\n },\n isKeyboardDismissDisabled: {\n type: \"boolean\",\n description:\n \"Whether pressing the escape key to close the modal should be disabled.\",\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n resetClassName: {\n type: \"themeResetClass\",\n },\n },\n states: {\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n hidden: hasParent,\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCO,MAAM,SAAY,GAAA,UAAA;AAAA,EACvB,SAAS,cAAe,CAAA,KAAA,EAAO,GAAK,EAAA;AAvCtC,IAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAwCI,IAAA,MASI,EARF,GAAA,KAAA,EAAA;AAAA,MAAA,QAAA;AAAA,MACA,iBAAA;AAAA,MACA,SAAA;AAAA,MACA,MAAA;AAAA,MACA,cAAA;AAAA,MACA,qBAAA;AAAA,MACA,aAAA;AAAA,KA/CN,GAiDQ,EADC,EAAA,IAAA,GAAA,SAAA,CACD,EADC,EAAA;AAAA,MAPH,UAAA;AAAA,MACA,mBAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAA;AAAA,MACA,gBAAA;AAAA,MACA,uBAAA;AAAA,MACA,eAAA;AAAA,KAAA,CAAA,CAAA;AAIF,IAAA,MAAM,YAAY,uBAAwB,EAAA,CAAA;AAC1C,IAAM,MAAA,UAAA,GAAa,S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,UACN,IAAM,EAAA,SAAA;AAAA,UACN,QAAU,EAAA,IAAA;AAAA,UACV,gBAAkB,EAAA,aAAA;AAAA,UAClB,gBAAkB,EAAA,IAAA;AAAA,UAClB,YAAc,EAAA,IAAA;AAAA,UACd,MAAQ,EAAA,SAAA;AAAA,SACV;AAAA,QACA,aAAe,EAAA;AAAA,UACb,IAAM,EAAA,SAAA;AAAA,UACN,WACE,EAAA,gEAAA;AAAA,SACJ;AAAA,QACA,yBAA2B,EAAA;AAAA,UACzB,IAAM,EAAA,SAAA;AAAA,UACN,WACE,EAAA,wEAAA;AAAA,SACJ;AAAA,QACA,YAAc,EAAA;AAAA,UACZ,IAAM,EAAA,cAAA;AAAA,UACN,UAAU,CAAC,EAAE,MAAM,QAAU,EAAA,IAAA,EAAM,WAAW,CAAA;AAAA,SAChD;AAAA,QACA,cAAgB,EAAA;AAAA,UACd,IAAM,EAAA,iBAAA;AAAA,SACR;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,UACd,MAAQ,EAAA,SAAA;AAAA,SACV;AAAA,OACF;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"registerModal.esm.js","sources":["../src/registerModal.tsx"],"sourcesContent":["import {\n PlasmicElement,\n usePlasmicCanvasComponentInfo,\n usePlasmicCanvasContext,\n} from \"@plasmicapp/host\";\nimport React, { forwardRef, useImperativeHandle } from \"react\";\nimport { mergeProps } from \"react-aria\";\nimport { Modal, ModalOverlay, ModalOverlayProps } from \"react-aria-components\";\nimport { hasParent } from \"./common\";\nimport { PlasmicDialogTriggerContext } from \"./contexts\";\nimport { HEADING_COMPONENT_NAME } from \"./registerHeading\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseModalProps\n extends ModalOverlayProps,\n HasControlContextData {\n heading: React.ReactNode;\n modalOverlayClass: string;\n resetClassName?: string;\n children?: React.ReactNode;\n className?: string;\n}\n\nexport interface BaseModalActions {\n close(): void;\n open(): void;\n}\n\nexport const BaseModal = forwardRef<BaseModalActions, BaseModalProps>(\n function BaseModalInner(props, ref) {\n const {\n children,\n modalOverlayClass,\n className,\n isOpen,\n resetClassName,\n setControlContextData,\n isDismissable,\n ...rest\n } = props;\n\n const canvasCtx = usePlasmicCanvasContext();\n const isEditMode = canvasCtx && canvasCtx.interactive === false;\n const isSelected =\n usePlasmicCanvasComponentInfo?.(props)?.isSelected ?? false;\n\n const contextProps = React.useContext(PlasmicDialogTriggerContext);\n const isStandalone = !contextProps;\n const mergedProps = mergeProps(contextProps, rest, {\n isOpen: isStandalone ? isSelected || isOpen : contextProps.isOpen,\n /*\n isDismissable on canvas (non-interactive mode) causes the following two issues:\n 1. Clicking anywhere inside the modal dismisses it\n 2. If the modal is auto-opened due to selection in outline tab, the modal stays open despite issue #1, but the text elements inside the modal are no longer selectable, and therefore the text or headings inside the modal are not editable.\n\n To fix the above issue, we set an interim isDismissable state to false in edit mode, because it only matters in interactive mode.\n */\n isDismissable: isEditMode ? false : isDismissable,\n });\n\n setControlContextData?.({\n parent: isStandalone ? undefined : {},\n });\n\n // Expose close operation using useImperativeHandle\n useImperativeHandle(ref, () => ({\n close: () => {\n mergedProps.onOpenChange?.(false);\n },\n open: () => {\n mergedProps.onOpenChange?.(true);\n },\n }));\n\n return (\n <ModalOverlay\n {...mergedProps}\n className={`${resetClassName} ${modalOverlayClass}`}\n >\n <Modal className={className}>{children}</Modal>\n </ModalOverlay>\n );\n }\n);\n\nexport const MODAL_COMPONENT_NAME = makeComponentName(\"modal\");\n\nexport const MODAL_DEFAULT_SLOT_CONTENT: PlasmicElement = {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: 0,\n gap: \"10px\",\n justifyContent: \"flex-start\",\n alignItems: \"flex-start\",\n },\n children: [\n {\n type: \"component\",\n name: HEADING_COMPONENT_NAME,\n },\n {\n type: \"text\",\n value: \"This is a Modal!\",\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\nexport function registerModal(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseModal>\n) {\n registerComponentHelper(\n loader,\n BaseModal,\n {\n name: MODAL_COMPONENT_NAME,\n displayName: \"Aria Modal\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerModal\",\n importName: \"BaseModal\",\n styleSections: true,\n defaultStyles: {\n // centering the modal on the page by default\n position: \"fixed\",\n top: \"10%\",\n left: \"50%\",\n width: \"50%\",\n transform: \"translateX(-50%)\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n padding: \"20px\",\n maxWidth: \"300px\",\n backgroundColor: \"#FDE3C3\",\n },\n refActions: {\n open: {\n description: \"Open the modal\",\n argTypes: [],\n },\n close: {\n description: \"Close the modal\",\n argTypes: [],\n },\n },\n props: {\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: MODAL_DEFAULT_SLOT_CONTENT,\n },\n modalOverlayClass: {\n type: \"class\",\n displayName: \"Modal Overlay\",\n },\n isOpen: {\n type: \"boolean\",\n editOnly: true,\n uncontrolledProp: \"defaultOpen\",\n defaultValueHint: true,\n defaultValue: true,\n hidden: hasParent,\n },\n isDismissable: {\n type: \"boolean\",\n description:\n \"Whether to close the modal when the user interacts outside it.\",\n },\n isKeyboardDismissDisabled: {\n type: \"boolean\",\n description:\n \"Whether pressing the escape key to close the modal should be disabled.\",\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n resetClassName: {\n type: \"themeResetClass\",\n },\n },\n states: {\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n hidden: hasParent,\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCO,MAAM,SAAY,GAAA,UAAA;AAAA,EACvB,SAAS,cAAe,CAAA,KAAA,EAAO,GAAK,EAAA;AAnCtC,IAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAoCI,IAAA,MASI,EARF,GAAA,KAAA,EAAA;AAAA,MAAA,QAAA;AAAA,MACA,iBAAA;AAAA,MACA,SAAA;AAAA,MACA,MAAA;AAAA,MACA,cAAA;AAAA,MACA,qBAAA;AAAA,MACA,aAAA;AAAA,KA3CN,GA6CQ,EADC,EAAA,IAAA,GAAA,SAAA,CACD,EADC,EAAA;AAAA,MAPH,UAAA;AAAA,MACA,mBAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAA;AAAA,MACA,gBAAA;AAAA,MACA,uBAAA;AAAA,MACA,eAAA;AAAA,KAAA,CAAA,CAAA;AAIF,IAAA,MAAM,YAAY,uBAAwB,EAAA,CAAA;AAC1C,IAAM,MAAA,UAAA,GAAa,SAAa,IAAA,SAAA,CAAU,WAAgB,KAAA,KAAA,CAAA;AAC1D,IAAA,MAAM,UACJ,GAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,6BAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAgC,KAAhC,CAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAwC,eAAxC,IAAsD,GAAA,EAAA,GAAA,KAAA,CAAA;AAExD,IAAM,MAAA,YAAA,GAAe,KAAM,CAAA,UAAA,CAAW,2BAA2B,CAAA,CAAA;AACjE,IAAA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AAQ,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,UACd,MAAQ,EAAA,SAAA;AAAA,SACV;AAAA,OACF;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
@@ -66,8 +66,6 @@ function BasePopover(props) {
66
66
  const triggerRef = React__default.default.useRef(null);
67
67
  const canvasContext = host.usePlasmicCanvasContext();
68
68
  const matchTriggerWidthProp = hasTrigger && matchTriggerWidth;
69
- const dialogTriggerContext = React__default.default.useContext(contexts.PlasmicDialogTriggerContext);
70
- const shouldTrapFocus = !canvasContext && !!dialogTriggerContext;
71
69
  const _b = utils.mergeProps(
72
70
  {
73
71
  // isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies.
@@ -90,15 +88,13 @@ function BasePopover(props) {
90
88
  canMatchTriggerWidth: hasTrigger
91
89
  });
92
90
  }, [hasTrigger, setControlContextData]);
93
- const withoutDialog = /* @__PURE__ */ React__default.default.createElement("div", null, children);
94
- const dialog = /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Dialog, null, children);
95
91
  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(
96
92
  reactAriaComponents.Popover,
97
93
  __spreadValues({
98
94
  style: __spreadValues(__spreadValues({}, matchTriggerWidthProp ? { width: `var(--trigger-width)` } : {}), common.COMMON_STYLES)
99
95
  }, mergedProps),
100
96
  ({ placement }) => withObservedValues(
101
- shouldTrapFocus ? dialog : withoutDialog,
97
+ children,
102
98
  {
103
99
  placementTop: placement === "top",
104
100
  placementBottom: placement === "bottom",
@@ -1 +1 @@
1
- {"version":3,"file":"registerPopover.cjs.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React, { useEffect } from \"react\";\nimport { Dialog, Popover, PopoverContext } from \"react-aria-components\";\nimport { COMMON_STYLES, getCommonOverlayProps } from \"./common\";\nimport {\n PlasmicDialogTriggerContext,\n PlasmicPopoverTriggerContext,\n} from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\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 BasePopoverControlContextData {\n canMatchTriggerWidth?: boolean;\n}\nexport interface BasePopoverProps\n extends React.ComponentProps<typeof Popover>,\n WithVariants<typeof POPOVER_VARIANTS>,\n HasControlContextData<BasePopoverControlContextData> {\n className?: string;\n resetClassName?: string;\n children?: React.ReactNode;\n matchTriggerWidth?: boolean;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const {\n resetClassName,\n plasmicUpdateVariant,\n setControlContextData,\n matchTriggerWidth,\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 hasTrigger = !!React.useContext(PlasmicPopoverTriggerContext);\n const triggerRef = React.useRef<any>(null);\n const canvasContext = usePlasmicCanvasContext();\n const matchTriggerWidthProp = hasTrigger && matchTriggerWidth;\n const dialogTriggerContext = React.useContext(PlasmicDialogTriggerContext);\n\n /*\n We only want to trap focus if:\n 1. The popover is NOT in canvas (because while the dialog is open on the canvas, the focus is trapped inside it, so any Studio modals like the Color Picker modal would glitch due to focus jumping back and forth)\n 2. The popover is NOT standalone or inside a Select/Combobox (focus trapping is already handled in Select/Combobox). A way to identify this is by the presence of a DialogTrigger context.\n */\n const shouldTrapFocus = !canvasContext && !!dialogTriggerContext;\n const { children, ...mergedProps } = mergeProps(\n {\n // isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies.\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 isNonModal: canvasContext && !canvasContext.interactive,\n },\n restProps,\n { className: `${resetClassName}` },\n // Override some props if the popover is standalone\n isStandalone\n ? {\n triggerRef,\n isNonModal: true,\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 isOpen: true,\n }\n : null\n );\n\n useEffect(() => {\n setControlContextData?.({\n canMatchTriggerWidth: hasTrigger,\n });\n }, [hasTrigger, setControlContextData]);\n\n /* <Dialog> cannot be used in canvas, because while the dialog is open on the canvas, the focus is trapped inside it, so any Studio modals like the Color Picker modal would glitch due to focus jumping back and forth */\n const withoutDialog = <div>{children}</div>;\n\n const dialog = <Dialog>{children}</Dialog>;\n\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover\n // more about `--trigger-width` here: https://react-spectrum.adobe.com/react-aria/Select.html#popover-1\n style={{\n ...(matchTriggerWidthProp ? { width: `var(--trigger-width)` } : {}),\n ...COMMON_STYLES,\n }}\n {...mergedProps}\n >\n {({ placement }) =>\n withObservedValues(\n shouldTrapFocus ? dialog : withoutDialog,\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\");\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 width: \"300px\",\n backgroundColor: \"#FDE3C3\",\n },\n props: {\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: \"20px\",\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 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\n resetClassName: {\n type: \"themeResetClass\",\n },\n matchTriggerWidth: {\n type: \"boolean\",\n defaultValue: true,\n hidden: (_props, ctx) => !ctx?.canMatchTriggerWidth,\n },\n ...getCommonOverlayProps<BasePopoverProps>(\"popover\", {\n placement: { defaultValueHint: \"bottom\" },\n offset: { defaultValueHint: 8 },\n containerPadding: { defaultValueHint: 12 },\n crossOffset: { defaultValueHint: 0 },\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","PlasmicPopoverTriggerContext","usePlasmicCanvasContext","PlasmicDialogTriggerContext","mergeProps","useEffect","Dialog","Popover","COMMON_STYLES","makeComponentName","registerComponentHelper","getCommonOverlayProps"],"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;AAerC,SAAS,YAAY,KAAyB,EAAA;AACnD,EAAA,MAMI,EALF,GAAA,KAAA,EAAA;AAAA,IAAA,cAAA;AAAA,IACA,oBAAA;AAAA,IACA,qBAAA;AAAA,IACA,iBAAA;AAAA,GApDJ,GAsDM,EADC,EAAA,SAAA,GAAA,SAAA,CACD,EADC,EAAA;AAAA,IAJH,gBAAA;AAAA,IACA,sBAAA;AAAA,IACA,uBAAA;AAAA,IACA,mBAAA;AAAA,GAAA,CAAA,CAAA;AAIF,EAAA,MAAM,YAAe,GAAA,CAACC,sBAAM,CAAA,UAAA,CAAWC,kCAAc,CAAA,CAAA;AACrD,EAAA,MAAM,UAAa,GAAA,CAAC,CAACD,sBAAA,CAAM,WAAWE,qCAA4B,CAAA,CAAA;AAClE,EAAM,MAAA,UAAA,GAAaF,sBAAM,CAAA,MAAA,CAAY,IAAI,CAAA,CAAA;AACzC,EAAA,MAAM,gBAAgBG,4BAAwB,EAAA,CAAA;AAC9C,EAAA,MAAM,wBAAwB,UAAc,IAAA,iBAAA,CAAA;AAC5C,EAAM,MAAA,oBAAA,GAAuBH,sBAAM,CAAA,UAAA,CAAWI,oCAA2B,CAAA,CAAA;AAOzE,EAAA,MAAM,eAAkB,GAAA,CAAC,aAAiB,IAAA,CAAC,CAAC,oBAAA,CAAA;AAC5C,EAAqC,MAAA,EAAA,GAAAC,gBAAA;AAAA,IACnC;AAAA;AAAA;AAAA,MAGE,UAAA,EAA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A,oBACN,UAAY,EAAA,GAAA;AAAA,mBACd;AAAA,iBACF;AAAA,gBACA;AAAA,kBACE,IAAM,EAAA,MAAA;AAAA,kBACN,KACE,EAAA,8EAAA;AAAA,iBACJ;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,QACA,UAAY,EAAA;AAAA,UACV,IAAM,EAAA,SAAA;AAAA,UACN,WACE,EAAA,oJAAA;AAAA,UACF,gBAAkB,EAAA,IAAA;AAAA,SACpB;AAAA,QAEA,cAAgB,EAAA;AAAA,UACd,IAAM,EAAA,iBAAA;AAAA,SACR;AAAA,QACA,iBAAmB,EAAA;AAAA,UACjB,IAAM,EAAA,SAAA;AAAA,UACN,YAAc,EAAA,IAAA;AAAA,UACd,MAAQ,EAAA,CAAC,MAAQ,EAAA,GAAA,KAAQ,EAAC,GAAK,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,GAAA,CAAA,oBAAA,CAAA;AAAA,SACjC;AAAA,OAAA,EACGC,6BAAwC,SAAW,EAAA;AAAA,QACpD,SAAA,EAAW,EAAE,gBAAA,EAAkB,QAAS,EAAA;AAAA,QACxC,MAAA,EAAQ,EAAE,gBAAA,EAAkB,CAAE,EAAA;AAAA,QAC9B,gBAAA,EAAkB,EAAE,gBAAA,EAAkB,EAAG,EAAA;AAAA,QACzC,WAAA,EAAa,EAAE,gBAAA,EAAkB,CAAE,EAAA;AAAA,OACpC,CAAA,CAAA;AAAA;AAAA,MAGH,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 { usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React, { useEffect } from \"react\";\nimport { Popover, PopoverContext } from \"react-aria-components\";\nimport { COMMON_STYLES, getCommonOverlayProps } from \"./common\";\nimport { PlasmicPopoverTriggerContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\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 BasePopoverControlContextData {\n canMatchTriggerWidth?: boolean;\n}\nexport interface BasePopoverProps\n extends React.ComponentProps<typeof Popover>,\n WithVariants<typeof POPOVER_VARIANTS>,\n HasControlContextData<BasePopoverControlContextData> {\n className?: string;\n resetClassName?: string;\n children?: React.ReactNode;\n matchTriggerWidth?: boolean;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const {\n resetClassName,\n plasmicUpdateVariant,\n setControlContextData,\n matchTriggerWidth,\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 hasTrigger = !!React.useContext(PlasmicPopoverTriggerContext);\n const triggerRef = React.useRef<any>(null);\n const canvasContext = usePlasmicCanvasContext();\n const matchTriggerWidthProp = hasTrigger && matchTriggerWidth;\n\n /*\n We only want to trap focus if:\n 1. The popover is NOT in canvas (because while the dialog is open on the canvas, the focus is trapped inside it, so any Studio modals like the Color Picker modal would glitch due to focus jumping back and forth)\n 2. The popover is NOT standalone or inside a Select/Combobox (focus trapping is already handled in Select/Combobox). A way to identify this is by the presence of a DialogTrigger context.\n */\n const { children, ...mergedProps } = mergeProps(\n {\n // isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies.\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 isNonModal: canvasContext && !canvasContext.interactive,\n },\n restProps,\n { className: `${resetClassName}` },\n // Override some props if the popover is standalone\n isStandalone\n ? {\n triggerRef,\n isNonModal: true,\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 isOpen: true,\n }\n : null\n );\n\n useEffect(() => {\n setControlContextData?.({\n canMatchTriggerWidth: hasTrigger,\n });\n }, [hasTrigger, setControlContextData]);\n\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover\n // more about `--trigger-width` here: https://react-spectrum.adobe.com/react-aria/Select.html#popover-1\n style={{\n ...(matchTriggerWidthProp ? { width: `var(--trigger-width)` } : {}),\n ...COMMON_STYLES,\n }}\n {...mergedProps}\n >\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\");\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 width: \"300px\",\n backgroundColor: \"#FDE3C3\",\n },\n props: {\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: \"20px\",\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 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\n resetClassName: {\n type: \"themeResetClass\",\n },\n matchTriggerWidth: {\n type: \"boolean\",\n defaultValue: true,\n hidden: (_props, ctx) => !ctx?.canMatchTriggerWidth,\n },\n ...getCommonOverlayProps<BasePopoverProps>(\"popover\", {\n placement: { defaultValueHint: \"bottom\" },\n offset: { defaultValueHint: 8 },\n containerPadding: { defaultValueHint: 12 },\n crossOffset: { defaultValueHint: 0 },\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","PlasmicPopoverTriggerContext","usePlasmicCanvasContext","mergeProps","useEffect","Popover","COMMON_STYLES","makeComponentName","registerComponentHelper","getCommonOverlayProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,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;AAerC,SAAS,YAAY,KAAyB,EAAA;AACnD,EAAA,MAMI,EALF,GAAA,KAAA,EAAA;AAAA,IAAA,cAAA;AAAA,IACA,oBAAA;AAAA,IACA,qBAAA;AAAA,IACA,iBAAA;AAAA,GAjDJ,GAmDM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AAA;AAAA,MAGH,aAAe,EAAA,IAAA;AAAA,MACf,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;;"}
@@ -1,9 +1,9 @@
1
1
  import { usePlasmicCanvasContext } from '@plasmicapp/host';
2
2
  import { mergeProps } from '@react-aria/utils';
3
3
  import React, { useEffect } from 'react';
4
- import { PopoverContext, Popover, Dialog } from 'react-aria-components';
4
+ import { PopoverContext, Popover } from 'react-aria-components';
5
5
  import { C as COMMON_STYLES, b as getCommonOverlayProps } from './common-2dfadd70.esm.js';
6
- import { a as PlasmicPopoverTriggerContext, d as PlasmicDialogTriggerContext } from './contexts-5cb81c2f.esm.js';
6
+ import { a as PlasmicPopoverTriggerContext } from './contexts-5cb81c2f.esm.js';
7
7
  import { m as makeComponentName, r as registerComponentHelper } from './utils-5d1b4c6b.esm.js';
8
8
  import { p as pickAriaComponentVariants } from './variant-utils-4405ebb0.esm.js';
9
9
  import '@plasmicapp/host/registerComponent';
@@ -60,8 +60,6 @@ function BasePopover(props) {
60
60
  const triggerRef = React.useRef(null);
61
61
  const canvasContext = usePlasmicCanvasContext();
62
62
  const matchTriggerWidthProp = hasTrigger && matchTriggerWidth;
63
- const dialogTriggerContext = React.useContext(PlasmicDialogTriggerContext);
64
- const shouldTrapFocus = !canvasContext && !!dialogTriggerContext;
65
63
  const _b = mergeProps(
66
64
  {
67
65
  // isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies.
@@ -84,15 +82,13 @@ function BasePopover(props) {
84
82
  canMatchTriggerWidth: hasTrigger
85
83
  });
86
84
  }, [hasTrigger, setControlContextData]);
87
- const withoutDialog = /* @__PURE__ */ React.createElement("div", null, children);
88
- const dialog = /* @__PURE__ */ React.createElement(Dialog, null, children);
89
85
  return /* @__PURE__ */ React.createElement(React.Fragment, null, isStandalone && /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(
90
86
  Popover,
91
87
  __spreadValues({
92
88
  style: __spreadValues(__spreadValues({}, matchTriggerWidthProp ? { width: `var(--trigger-width)` } : {}), COMMON_STYLES)
93
89
  }, mergedProps),
94
90
  ({ placement }) => withObservedValues(
95
- shouldTrapFocus ? dialog : withoutDialog,
91
+ children,
96
92
  {
97
93
  placementTop: placement === "top",
98
94
  placementBottom: placement === "bottom",
@@ -1 +1 @@
1
- {"version":3,"file":"registerPopover.esm.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React, { useEffect } from \"react\";\nimport { Dialog, Popover, PopoverContext } from \"react-aria-components\";\nimport { COMMON_STYLES, getCommonOverlayProps } from \"./common\";\nimport {\n PlasmicDialogTriggerContext,\n PlasmicPopoverTriggerContext,\n} from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\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 BasePopoverControlContextData {\n canMatchTriggerWidth?: boolean;\n}\nexport interface BasePopoverProps\n extends React.ComponentProps<typeof Popover>,\n WithVariants<typeof POPOVER_VARIANTS>,\n HasControlContextData<BasePopoverControlContextData> {\n className?: string;\n resetClassName?: string;\n children?: React.ReactNode;\n matchTriggerWidth?: boolean;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const {\n resetClassName,\n plasmicUpdateVariant,\n setControlContextData,\n matchTriggerWidth,\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 hasTrigger = !!React.useContext(PlasmicPopoverTriggerContext);\n const triggerRef = React.useRef<any>(null);\n const canvasContext = usePlasmicCanvasContext();\n const matchTriggerWidthProp = hasTrigger && matchTriggerWidth;\n const dialogTriggerContext = React.useContext(PlasmicDialogTriggerContext);\n\n /*\n We only want to trap focus if:\n 1. The popover is NOT in canvas (because while the dialog is open on the canvas, the focus is trapped inside it, so any Studio modals like the Color Picker modal would glitch due to focus jumping back and forth)\n 2. The popover is NOT standalone or inside a Select/Combobox (focus trapping is already handled in Select/Combobox). A way to identify this is by the presence of a DialogTrigger context.\n */\n const shouldTrapFocus = !canvasContext && !!dialogTriggerContext;\n const { children, ...mergedProps } = mergeProps(\n {\n // isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies.\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 isNonModal: canvasContext && !canvasContext.interactive,\n },\n restProps,\n { className: `${resetClassName}` },\n // Override some props if the popover is standalone\n isStandalone\n ? {\n triggerRef,\n isNonModal: true,\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 isOpen: true,\n }\n : null\n );\n\n useEffect(() => {\n setControlContextData?.({\n canMatchTriggerWidth: hasTrigger,\n });\n }, [hasTrigger, setControlContextData]);\n\n /* <Dialog> cannot be used in canvas, because while the dialog is open on the canvas, the focus is trapped inside it, so any Studio modals like the Color Picker modal would glitch due to focus jumping back and forth */\n const withoutDialog = <div>{children}</div>;\n\n const dialog = <Dialog>{children}</Dialog>;\n\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover\n // more about `--trigger-width` here: https://react-spectrum.adobe.com/react-aria/Select.html#popover-1\n style={{\n ...(matchTriggerWidthProp ? { width: `var(--trigger-width)` } : {}),\n ...COMMON_STYLES,\n }}\n {...mergedProps}\n >\n {({ placement }) =>\n withObservedValues(\n shouldTrapFocus ? dialog : withoutDialog,\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\");\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 width: \"300px\",\n backgroundColor: \"#FDE3C3\",\n },\n props: {\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: \"20px\",\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 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\n resetClassName: {\n type: \"themeResetClass\",\n },\n matchTriggerWidth: {\n type: \"boolean\",\n defaultValue: true,\n hidden: (_props, ctx) => !ctx?.canMatchTriggerWidth,\n },\n ...getCommonOverlayProps<BasePopoverProps>(\"popover\", {\n placement: { defaultValueHint: \"bottom\" },\n offset: { defaultValueHint: 8 },\n containerPadding: { defaultValueHint: 12 },\n crossOffset: { defaultValueHint: 0 },\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;AAerC,SAAS,YAAY,KAAyB,EAAA;AACnD,EAAA,MAMI,EALF,GAAA,KAAA,EAAA;AAAA,IAAA,cAAA;AAAA,IACA,oBAAA;AAAA,IACA,qBAAA;AAAA,IACA,iBAAA;AAAA,GApDJ,GAsDM,EADC,EAAA,SAAA,GAAA,SAAA,CACD,EADC,EAAA;AAAA,IAJH,gBAAA;AAAA,IACA,sBAAA;AAAA,IACA,uBAAA;AAAA,IACA,mBAAA;AAAA,GAAA,CAAA,CAAA;AAIF,EAAA,MAAM,YAAe,GAAA,CAAC,KAAM,CAAA,UAAA,CAAW,cAAc,CAAA,CAAA;AACrD,EAAA,MAAM,UAAa,GAAA,CAAC,CAAC,KAAA,CAAM,WAAW,4BAA4B,CAAA,CAAA;AAClE,EAAM,MAAA,UAAA,GAAa,KAAM,CAAA,MAAA,CAAY,IAAI,CAAA,CAAA;AACzC,EAAA,MAAM,gBAAgB,uBAAwB,EAAA,CAAA;AAC9C,EAAA,MAAM,wBAAwB,UAAc,IAAA,iBAAA,CAAA;AAC5C,EAAM,MAAA,oBAAA,GAAuB,KAAM,CAAA,UAAA,CAAW,2BAA2B,CAAA,CAAA;AAOzE,EAAA,MAAM,eAAkB,GAAA,CAAC,aAAiB,IAAA,CAAC,CAAC,oBA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,EAAA,MAAA;AAAA,kBACN,KAAO,EAAA,4CAAA;AAAA,kBACP,MAAQ,EAAA;AAAA,oBACN,UAAY,EAAA,GAAA;AAAA,mBACd;AAAA,iBACF;AAAA,gBACA;AAAA,kBACE,IAAM,EAAA,MAAA;AAAA,kBACN,KACE,EAAA,8EAAA;AAAA,iBACJ;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,QACA,UAAY,EAAA;AAAA,UACV,IAAM,EAAA,SAAA;AAAA,UACN,WACE,EAAA,oJAAA;AAAA,UACF,gBAAkB,EAAA,IAAA;AAAA,SACpB;AAAA,QAEA,cAAgB,EAAA;AAAA,UACd,IAAM,EAAA,iBAAA;AAAA,SACR;AAAA,QACA,iBAAmB,EAAA;AAAA,UACjB,IAAM,EAAA,SAAA;AAAA,UACN,YAAc,EAAA,IAAA;AAAA,UACd,MAAQ,EAAA,CAAC,MAAQ,EAAA,GAAA,KAAQ,EAAC,GAAK,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,GAAA,CAAA,oBAAA,CAAA;AAAA,SACjC;AAAA,OAAA,EACG,sBAAwC,SAAW,EAAA;AAAA,QACpD,SAAA,EAAW,EAAE,gBAAA,EAAkB,QAAS,EAAA;AAAA,QACxC,MAAA,EAAQ,EAAE,gBAAA,EAAkB,CAAE,EAAA;AAAA,QAC9B,gBAAA,EAAkB,EAAE,gBAAA,EAAkB,EAAG,EAAA;AAAA,QACzC,WAAA,EAAa,EAAE,gBAAA,EAAkB,CAAE,EAAA;AAAA,OACpC,CAAA,CAAA;AAAA;AAAA,MAGH,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 { usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React, { useEffect } from \"react\";\nimport { Popover, PopoverContext } from \"react-aria-components\";\nimport { COMMON_STYLES, getCommonOverlayProps } from \"./common\";\nimport { PlasmicPopoverTriggerContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\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 BasePopoverControlContextData {\n canMatchTriggerWidth?: boolean;\n}\nexport interface BasePopoverProps\n extends React.ComponentProps<typeof Popover>,\n WithVariants<typeof POPOVER_VARIANTS>,\n HasControlContextData<BasePopoverControlContextData> {\n className?: string;\n resetClassName?: string;\n children?: React.ReactNode;\n matchTriggerWidth?: boolean;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const {\n resetClassName,\n plasmicUpdateVariant,\n setControlContextData,\n matchTriggerWidth,\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 hasTrigger = !!React.useContext(PlasmicPopoverTriggerContext);\n const triggerRef = React.useRef<any>(null);\n const canvasContext = usePlasmicCanvasContext();\n const matchTriggerWidthProp = hasTrigger && matchTriggerWidth;\n\n /*\n We only want to trap focus if:\n 1. The popover is NOT in canvas (because while the dialog is open on the canvas, the focus is trapped inside it, so any Studio modals like the Color Picker modal would glitch due to focus jumping back and forth)\n 2. The popover is NOT standalone or inside a Select/Combobox (focus trapping is already handled in Select/Combobox). A way to identify this is by the presence of a DialogTrigger context.\n */\n const { children, ...mergedProps } = mergeProps(\n {\n // isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies.\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 isNonModal: canvasContext && !canvasContext.interactive,\n },\n restProps,\n { className: `${resetClassName}` },\n // Override some props if the popover is standalone\n isStandalone\n ? {\n triggerRef,\n isNonModal: true,\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 isOpen: true,\n }\n : null\n );\n\n useEffect(() => {\n setControlContextData?.({\n canMatchTriggerWidth: hasTrigger,\n });\n }, [hasTrigger, setControlContextData]);\n\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover\n // more about `--trigger-width` here: https://react-spectrum.adobe.com/react-aria/Select.html#popover-1\n style={{\n ...(matchTriggerWidthProp ? { width: `var(--trigger-width)` } : {}),\n ...COMMON_STYLES,\n }}\n {...mergedProps}\n >\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\");\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 width: \"300px\",\n backgroundColor: \"#FDE3C3\",\n },\n props: {\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: \"20px\",\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 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\n resetClassName: {\n type: \"themeResetClass\",\n },\n matchTriggerWidth: {\n type: \"boolean\",\n defaultValue: true,\n hidden: (_props, ctx) => !ctx?.canMatchTriggerWidth,\n },\n ...getCommonOverlayProps<BasePopoverProps>(\"popover\", {\n placement: { defaultValueHint: \"bottom\" },\n offset: { defaultValueHint: 8 },\n containerPadding: { defaultValueHint: 12 },\n crossOffset: { defaultValueHint: 0 },\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,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;AAerC,SAAS,YAAY,KAAyB,EAAA;AACnD,EAAA,MAMI,EALF,GAAA,KAAA,EAAA;AAAA,IAAA,cAAA;AAAA,IACA,oBAAA;AAAA,IACA,qBAAA;AAAA,IACA,iBAAA;AAAA,GAjDJ,GAmDM,EADC,EAAA,SAAA,GAAA,SAAA,CACD,EADC,EAAA;AAAA,IAJH,gBAA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