@plasmicpkgs/react-aria 0.0.75 → 0.0.77

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.
Files changed (74) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/contexts.d.ts +1 -1
  3. package/dist/react-aria.esm.js +52 -27
  4. package/dist/react-aria.esm.js.map +1 -1
  5. package/dist/react-aria.js +52 -27
  6. package/dist/react-aria.js.map +1 -1
  7. package/dist/registerPopover.d.ts +6 -2
  8. package/package.json +2 -2
  9. package/skinny/{contexts-081d65a0.esm.js → contexts-5cb81c2f.esm.js} +3 -3
  10. package/skinny/contexts-5cb81c2f.esm.js.map +1 -0
  11. package/skinny/{contexts-baa37b74.cjs.js → contexts-6d0cb2b1.cjs.js} +3 -3
  12. package/skinny/contexts-6d0cb2b1.cjs.js.map +1 -0
  13. package/skinny/contexts.d.ts +1 -1
  14. package/skinny/registerCheckbox.cjs.js +1 -1
  15. package/skinny/registerCheckbox.esm.js +1 -1
  16. package/skinny/registerCheckboxGroup.cjs.js +1 -1
  17. package/skinny/registerCheckboxGroup.esm.js +1 -1
  18. package/skinny/registerComboBox.cjs.js +6 -5
  19. package/skinny/registerComboBox.cjs.js.map +1 -1
  20. package/skinny/registerComboBox.esm.js +6 -5
  21. package/skinny/registerComboBox.esm.js.map +1 -1
  22. package/skinny/registerDialogTrigger.cjs.js +1 -1
  23. package/skinny/registerDialogTrigger.esm.js +1 -1
  24. package/skinny/registerInput.cjs.js +1 -1
  25. package/skinny/registerInput.esm.js +1 -1
  26. package/skinny/{registerListBox-64bcf3d2.esm.js → registerListBox-25d602fa.esm.js} +3 -5
  27. package/skinny/registerListBox-25d602fa.esm.js.map +1 -0
  28. package/skinny/{registerListBox-c2c63064.cjs.js → registerListBox-f4f6beb5.cjs.js} +8 -10
  29. package/skinny/registerListBox-f4f6beb5.cjs.js.map +1 -0
  30. package/skinny/registerListBox.cjs.js +2 -3
  31. package/skinny/registerListBox.cjs.js.map +1 -1
  32. package/skinny/registerListBox.esm.js +2 -3
  33. package/skinny/registerListBox.esm.js.map +1 -1
  34. package/skinny/registerListBoxItem.cjs.js +1 -1
  35. package/skinny/registerListBoxItem.esm.js +1 -1
  36. package/skinny/registerModal.cjs.js +1 -1
  37. package/skinny/registerModal.esm.js +1 -1
  38. package/skinny/registerPopover.cjs.js +40 -14
  39. package/skinny/registerPopover.cjs.js.map +1 -1
  40. package/skinny/registerPopover.d.ts +6 -2
  41. package/skinny/registerPopover.esm.js +41 -15
  42. package/skinny/registerPopover.esm.js.map +1 -1
  43. package/skinny/registerRadio.cjs.js +1 -1
  44. package/skinny/registerRadio.esm.js +1 -1
  45. package/skinny/registerRadioGroup.cjs.js +1 -1
  46. package/skinny/registerRadioGroup.esm.js +1 -1
  47. package/skinny/registerSection.cjs.js +2 -3
  48. package/skinny/registerSection.cjs.js.map +1 -1
  49. package/skinny/registerSection.esm.js +2 -3
  50. package/skinny/registerSection.esm.js.map +1 -1
  51. package/skinny/registerSelect.cjs.js +6 -5
  52. package/skinny/registerSelect.cjs.js.map +1 -1
  53. package/skinny/registerSelect.esm.js +6 -5
  54. package/skinny/registerSelect.esm.js.map +1 -1
  55. package/skinny/registerSlider.cjs.js +1 -2
  56. package/skinny/registerSlider.cjs.js.map +1 -1
  57. package/skinny/registerSlider.esm.js +1 -2
  58. package/skinny/registerSlider.esm.js.map +1 -1
  59. package/skinny/registerSliderThumb.cjs.js +1 -5
  60. package/skinny/registerSliderThumb.cjs.js.map +1 -1
  61. package/skinny/registerSliderThumb.esm.js +1 -5
  62. package/skinny/registerSliderThumb.esm.js.map +1 -1
  63. package/skinny/registerSliderTrack.cjs.js +5 -6
  64. package/skinny/registerSliderTrack.cjs.js.map +1 -1
  65. package/skinny/registerSliderTrack.esm.js +5 -6
  66. package/skinny/registerSliderTrack.esm.js.map +1 -1
  67. package/skinny/registerTextArea.cjs.js +1 -1
  68. package/skinny/registerTextArea.esm.js +1 -1
  69. package/skinny/registerTextField.cjs.js +1 -1
  70. package/skinny/registerTextField.esm.js +1 -1
  71. package/skinny/contexts-081d65a0.esm.js.map +0 -1
  72. package/skinny/contexts-baa37b74.cjs.js.map +0 -1
  73. package/skinny/registerListBox-64bcf3d2.esm.js.map +0 -1
  74. package/skinny/registerListBox-c2c63064.cjs.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerListBox-f4f6beb5.cjs.js","sources":["../src/ListBoxItemIdManager.ts","../src/registerSection.tsx","../src/registerListBox.tsx"],"sourcesContent":["type Observer = (ids: string[]) => void;\n\nexport class ListBoxItemIdManager {\n private readonly _ids: Set<string> = new Set();\n private readonly _observers: Set<Observer> = new Set();\n\n private generateDuplicateId(id: string, count = 1): string {\n const dupId = `${id} duplicate(${count})`;\n if (this._ids.has(dupId)) {\n return this.generateDuplicateId(id, count + 1);\n } else {\n return dupId;\n }\n }\n\n private generateMissingId(count = 1): string {\n const missingId = `missing(${count})`;\n if (this._ids.has(missingId)) {\n return this.generateMissingId(count + 1);\n } else {\n return missingId;\n }\n }\n\n register(id?: unknown): string {\n const idStr = id === undefined ? undefined : String(id).trim();\n let newId: string;\n\n if (!idStr) {\n // No id is provided, so generate one\n newId = this.generateMissingId();\n } else if (this._ids.has(idStr)) {\n // The provided id is already registered with another uuid (i.e. it's not unique), so just generate a new one\n newId = this.generateDuplicateId(idStr);\n } else {\n // The provided id is not already registered, so use it\n newId = idStr;\n }\n\n this._ids.add(newId);\n this.notify();\n return newId;\n }\n\n unregister(id: string) {\n this._ids.delete(id);\n this.notify();\n }\n\n subscribe(observer: Observer) {\n this._observers.add(observer);\n observer(this.ids);\n }\n\n // Notify all observers about an event.\n notify() {\n this._observers.forEach((observer) => observer(this.ids));\n }\n\n get ids(): string[] {\n return Array.from(this._ids);\n }\n}\n","import React from \"react\";\nimport { Header, Section } from \"react-aria-components\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport { BaseListBox } from \"./registerListBox\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n Styleable,\n} from \"./utils\";\n\nexport interface BaseSectionProps extends Styleable {\n items: React.ReactNode;\n header: React.ReactNode;\n}\n\nexport function BaseSection(props: BaseSectionProps) {\n const { header, items, ...rest } = props;\n const contextProps = React.useContext(PlasmicListBoxContext);\n const isStandalone = !contextProps;\n\n const section = (\n <Section {...rest}>\n <Header>{header}</Header>\n {items}\n </Section>\n );\n\n if (isStandalone) {\n return (\n // BaseListbox should give section a listbox context (that it can't be used without)\n // as well as the id manager (that is needed to identify and warn about duplication of ids)\n <BaseListBox>{section}</BaseListBox>\n );\n }\n\n return section;\n}\n\nexport function registerSection(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseSection>\n) {\n return registerComponentHelper(\n loader,\n BaseSection,\n {\n name: makeComponentName(\"section\"),\n displayName: \"Aria Section\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSection\",\n importName: \"BaseSection\",\n defaultStyles: {\n width: \"stretch\",\n padding: \"10px\",\n },\n props: {\n header: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n {\n type: \"text\",\n value: \"Section Header.\",\n },\n ],\n },\n items: {\n type: \"slot\",\n mergeWithParent: true,\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n","import React, { useEffect, useMemo, useState } from \"react\";\nimport { Key, ListBox } from \"react-aria-components\";\nimport { PlasmicListBoxContext } from \"./contexts\";\nimport { ListBoxItemIdManager } from \"./ListBoxItemIdManager\";\nimport {\n makeDefaultListBoxItemChildren,\n registerListBoxItem,\n} from \"./registerListBoxItem\";\nimport { registerSection } from \"./registerSection\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseListBoxControlContextData {\n itemIds: string[];\n isStandalone: boolean;\n}\n\nexport interface BaseListBoxProps\n extends Omit<\n React.ComponentProps<typeof ListBox>,\n \"selectedKeys\" | \"defaultSelectedKeys\"\n >,\n HasControlContextData<BaseListBoxControlContextData> {\n children?: React.ReactNode;\n selectedKeys?: string | string[] | undefined;\n defaultSelectedKeys?: string | string[] | undefined;\n}\n\nexport const listboxHelpers = {\n states: {\n selectedValue: {\n onChangeArgsToValue: (value: Set<Key> | string[] | string) => {\n // only single selection is supported\n return Array.from(value)[0];\n },\n },\n },\n};\n\nfunction normalizeSelectedKeys(selectedKeys: string | string[] | undefined) {\n // Listbox expects it to be of type \"all\" | Iterable\n return typeof selectedKeys === \"string\" && selectedKeys !== \"all\"\n ? [selectedKeys]\n : selectedKeys;\n}\n\nexport function BaseListBox(props: BaseListBoxProps) {\n const {\n setControlContextData: setControlContextData,\n children,\n selectedKeys,\n defaultSelectedKeys,\n ...rest\n } = props;\n const context = React.useContext(PlasmicListBoxContext);\n const isStandalone = !context;\n const [ids, setIds] = useState<string[]>([]);\n\n const idManager = useMemo(\n () => context?.idManager ?? new ListBoxItemIdManager(),\n []\n );\n\n useEffect(() => {\n setControlContextData?.({\n itemIds: ids,\n isStandalone,\n });\n }, [ids, isStandalone, setControlContextData]);\n\n useEffect(() => {\n idManager.subscribe((_ids: string[]) => {\n setIds(_ids);\n });\n }, []);\n\n const listbox = (\n <ListBox\n selectedKeys={normalizeSelectedKeys(selectedKeys)}\n defaultSelectedKeys={normalizeSelectedKeys(defaultSelectedKeys)}\n {...rest}\n >\n {children}\n </ListBox>\n );\n\n if (isStandalone) {\n return (\n <PlasmicListBoxContext.Provider\n value={{\n idManager,\n }}\n >\n {listbox}\n </PlasmicListBoxContext.Provider>\n );\n }\n\n return listbox;\n}\n\nexport const LIST_BOX_COMPONENT_NAME = makeComponentName(\"listbox\");\n\nexport function registerListBox(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBox>\n) {\n const listBoxItemMeta = registerListBoxItem(loader, {\n parentComponentName: LIST_BOX_COMPONENT_NAME,\n });\n const sectionMeta = registerSection(loader, {\n parentComponentName: LIST_BOX_COMPONENT_NAME,\n props: {\n items: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"section-1-1\",\n textValue: \"Section1-Item 1\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 1\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"section-1-2\",\n textValue: \"Section1-Item 2\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 2\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"section-1-3\",\n textValue: \"Section1-Item 3\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 3\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n ],\n },\n },\n });\n\n registerComponentHelper(\n loader,\n BaseListBox,\n {\n name: LIST_BOX_COMPONENT_NAME,\n displayName: \"Aria ListBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBox\",\n importName: \"BaseListBox\",\n defaultStyles: {\n width: \"250px\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n },\n props: {\n children: {\n type: \"slot\",\n displayName: \"List Items\",\n allowedComponents: [listBoxItemMeta.name, sectionMeta.name],\n allowRootWrapper: true,\n defaultValue: [\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"1\",\n textValue: \"Item 1\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 1\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"2\",\n textValue: \"Item 2\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 2\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n id: \"3\",\n textValue: \"Item 3\",\n children: [\n makeDefaultListBoxItemChildren(\n \"Item 3\",\n \"Add dynamic values to make it more interesting\"\n ),\n ],\n },\n },\n {\n type: \"component\",\n name: sectionMeta.name,\n },\n ],\n },\n selectionMode: {\n type: \"choice\",\n description: \"The selection mode of the listbox\",\n options: [\"none\", \"single\"],\n defaultValue: \"none\",\n hidden: (_props, ctx) => !ctx?.isStandalone,\n },\n selectedKeys: {\n type: \"choice\",\n editOnly: true,\n uncontrolledProp: \"defaultSelectedKeys\",\n displayName: \"Initial selected item\",\n options: (_props, ctx) =>\n ctx?.itemIds ? Array.from(ctx.itemIds) : [],\n hidden: (props, ctx) =>\n !ctx?.isStandalone || props.selectionMode === \"none\",\n // We do not support multiple selections yet (Because React Aria select and combobox only support single selections).\n multiSelect: false,\n },\n onSelectionChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"selectedValues\", type: \"object\" }],\n },\n },\n states: {\n selectedValue: {\n type: \"writable\",\n valueProp: \"selectedKeys\",\n hidden: (props, ctx) =>\n !ctx?.isStandalone || props.selectionMode === \"none\",\n onChangeProp: \"onSelectionChange\",\n variableType: \"text\",\n ...listboxHelpers.states.selectedValue,\n },\n },\n componentHelpers: {\n helpers: listboxHelpers,\n importName: \"listboxHelpers\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBox\",\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["__objRest","React","PlasmicListBoxContext","Section","__spreadValues","Header","registerComponentHelper","makeComponentName","useState","useMemo","_a","useEffect","ListBox","registerListBoxItem","makeDefaultListBoxItemChildren"],"mappings":";;;;;;;;;;;;AAEO,MAAM,oBAAqB,CAAA;AAAA,EAA3B,WAAA,GAAA;AACL,IAAiB,IAAA,CAAA,IAAA,uBAAwB,GAAI,EAAA,CAAA;AAC7C,IAAiB,IAAA,CAAA,UAAA,uBAAgC,GAAI,EAAA,CAAA;AAAA,GAAA;AAAA,EAE7C,mBAAA,CAAoB,EAAY,EAAA,KAAA,GAAQ,CAAW,EAAA;AACzD,IAAM,MAAA,KA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,GACF,CAAA;AACF;;;;;;;;;;"}
@@ -2,11 +2,10 @@
2
2
 
3
3
  require('react');
4
4
  require('react-aria-components');
5
- require('./contexts-baa37b74.cjs.js');
6
- var registerSection = require('./registerListBox-c2c63064.cjs.js');
5
+ require('./contexts-6d0cb2b1.cjs.js');
6
+ var registerSection = require('./registerListBox-f4f6beb5.cjs.js');
7
7
  require('./registerListBoxItem.cjs.js');
8
8
  require('./utils-3e796b18.cjs.js');
9
- require('@react-aria/utils');
10
9
  require('./registerDescription.cjs.js');
11
10
  require('./registerText.cjs.js');
12
11
  require('@plasmicapp/host');
@@ -1 +1 @@
1
- {"version":3,"file":"registerListBox.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"registerListBox.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
@@ -1,10 +1,9 @@
1
1
  import 'react';
2
2
  import 'react-aria-components';
3
- import './contexts-081d65a0.esm.js';
4
- export { b as BaseListBox, a as LIST_BOX_COMPONENT_NAME, l as listboxHelpers, c as registerListBox } from './registerListBox-64bcf3d2.esm.js';
3
+ import './contexts-5cb81c2f.esm.js';
4
+ export { b as BaseListBox, a as LIST_BOX_COMPONENT_NAME, l as listboxHelpers, c as registerListBox } from './registerListBox-25d602fa.esm.js';
5
5
  import './registerListBoxItem.esm.js';
6
6
  import './utils-25448fbd.esm.js';
7
- import '@react-aria/utils';
8
7
  import './registerDescription.esm.js';
9
8
  import './registerText.esm.js';
10
9
  import '@plasmicapp/host';
@@ -1 +1 @@
1
- {"version":3,"file":"registerListBox.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
1
+ {"version":3,"file":"registerListBox.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
@@ -2,7 +2,7 @@
2
2
 
3
3
  var React = require('react');
4
4
  var reactAriaComponents = require('react-aria-components');
5
- var contexts = require('./contexts-baa37b74.cjs.js');
5
+ var contexts = require('./contexts-6d0cb2b1.cjs.js');
6
6
  var registerDescription = require('./registerDescription.cjs.js');
7
7
  var registerText = require('./registerText.cjs.js');
8
8
  var utils = require('./utils-3e796b18.cjs.js');
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { ListBoxItem, ListBox } from 'react-aria-components';
3
- import { b as PlasmicListBoxContext } from './contexts-081d65a0.esm.js';
3
+ import { b as PlasmicListBoxContext } from './contexts-5cb81c2f.esm.js';
4
4
  import { DESCRIPTION_COMPONENT_NAME } from './registerDescription.esm.js';
5
5
  import { TEXT_COMPONENT_NAME } from './registerText.esm.js';
6
6
  import { r as registerComponentHelper, a as makeComponentName } from './utils-25448fbd.esm.js';
@@ -5,7 +5,7 @@ var React = require('react');
5
5
  var reactAria = require('react-aria');
6
6
  var reactAriaComponents = require('react-aria-components');
7
7
  var common = require('./common-f6de262a.cjs.js');
8
- var contexts = require('./contexts-baa37b74.cjs.js');
8
+ var contexts = require('./contexts-6d0cb2b1.cjs.js');
9
9
  var registerHeading = require('./registerHeading.cjs.js');
10
10
  var utils = require('./utils-3e796b18.cjs.js');
11
11
  require('@plasmicapp/host/registerComponent');
@@ -3,7 +3,7 @@ import React, { forwardRef, useImperativeHandle } from 'react';
3
3
  import { mergeProps } from 'react-aria';
4
4
  import { ModalOverlay, Modal, Dialog } from 'react-aria-components';
5
5
  import { h as hasParent } from './common-70efdf8a.esm.js';
6
- import { d as PlasmicDialogTriggerContext } from './contexts-081d65a0.esm.js';
6
+ import { d as PlasmicDialogTriggerContext } from './contexts-5cb81c2f.esm.js';
7
7
  import { HEADING_COMPONENT_NAME } from './registerHeading.esm.js';
8
8
  import { a as makeComponentName, r as registerComponentHelper } from './utils-25448fbd.esm.js';
9
9
  import '@plasmicapp/host/registerComponent';
@@ -4,7 +4,7 @@ var host = require('@plasmicapp/host');
4
4
  var utils = require('@react-aria/utils');
5
5
  var React = require('react');
6
6
  var reactAriaComponents = require('react-aria-components');
7
- var contexts = require('./contexts-baa37b74.cjs.js');
7
+ var contexts = require('./contexts-6d0cb2b1.cjs.js');
8
8
  var utils$1 = require('./utils-3e796b18.cjs.js');
9
9
  var variantUtils = require('./variant-utils-8cb38f8f.cjs.js');
10
10
  require('@plasmicapp/host/registerComponent');
@@ -49,14 +49,24 @@ const POPOVER_VARIANTS = [
49
49
  ];
50
50
  const { variants, withObservedValues } = variantUtils.pickAriaComponentVariants(POPOVER_VARIANTS);
51
51
  function BasePopover(props) {
52
- const _a = props, { resetClassName, plasmicUpdateVariant } = _a, restProps = __objRest(_a, ["resetClassName", "plasmicUpdateVariant"]);
52
+ const _a = props, {
53
+ resetClassName,
54
+ plasmicUpdateVariant,
55
+ setControlContextData,
56
+ matchTriggerWidth
57
+ } = _a, restProps = __objRest(_a, [
58
+ "resetClassName",
59
+ "plasmicUpdateVariant",
60
+ "setControlContextData",
61
+ "matchTriggerWidth"
62
+ ]);
53
63
  const isStandalone = !React__default.default.useContext(reactAriaComponents.PopoverContext);
54
- const context = React__default.default.useContext(contexts.PlasmicPopoverContext);
64
+ const hasTrigger = !!React__default.default.useContext(contexts.PlasmicPopoverTriggerContext);
55
65
  const triggerRef = React__default.default.useRef(null);
56
66
  const canvasContext = host.usePlasmicCanvasContext();
67
+ const matchTriggerWidthProp = hasTrigger && matchTriggerWidth;
57
68
  const _b = utils.mergeProps(
58
69
  {
59
- isOpen: context == null ? void 0 : context.isOpen,
60
70
  // isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies.
61
71
  // 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.
62
72
  isNonModal: canvasContext && !canvasContext.interactive
@@ -72,16 +82,27 @@ function BasePopover(props) {
72
82
  isOpen: true
73
83
  } : null
74
84
  ), { children } = _b, mergedProps = __objRest(_b, ["children"]);
75
- 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(
76
- children,
77
- {
78
- placementTop: placement === "top",
79
- placementBottom: placement === "bottom",
80
- placementLeft: placement === "left",
81
- placementRight: placement === "right"
82
- },
83
- plasmicUpdateVariant
84
- )));
85
+ React.useEffect(() => {
86
+ setControlContextData == null ? void 0 : setControlContextData({
87
+ canMatchTriggerWidth: hasTrigger
88
+ });
89
+ }, [hasTrigger, setControlContextData]);
90
+ 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(
91
+ reactAriaComponents.Popover,
92
+ __spreadValues({
93
+ style: matchTriggerWidthProp ? { width: `var(--trigger-width)` } : void 0
94
+ }, mergedProps),
95
+ ({ placement }) => withObservedValues(
96
+ children,
97
+ {
98
+ placementTop: placement === "top",
99
+ placementBottom: placement === "bottom",
100
+ placementLeft: placement === "left",
101
+ placementRight: placement === "right"
102
+ },
103
+ plasmicUpdateVariant
104
+ )
105
+ ));
85
106
  }
86
107
  const POPOVER_COMPONENT_NAME = utils$1.makeComponentName("popover");
87
108
  const POPOVER_ARROW_IMG = {
@@ -172,6 +193,11 @@ function registerPopover(loader, overrides) {
172
193
  },
173
194
  resetClassName: {
174
195
  type: "themeResetClass"
196
+ },
197
+ matchTriggerWidth: {
198
+ type: "boolean",
199
+ defaultValue: true,
200
+ hidden: (_props, ctx) => !(ctx == null ? void 0 : ctx.canMatchTriggerWidth)
175
201
  }
176
202
  },
177
203
  // 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.
@@ -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 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 canvasContext = usePlasmicCanvasContext();\n const { children, ...mergedProps } = mergeProps(\n {\n isOpen: context?.isOpen,\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 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,KAAyB,EAAA;AACnD,EAA+D,MAAA,EAAA,GAAA,KAAA,EAAvD,kBAAgB,oBAtC1B,EAAA,GAsCiE,IAAd,SAAc,GAAA,SAAA,CAAA,EAAA,EAAd,CAAzC,gBAAgB,EAAA,sBAAA,CAAA,CAAA,CAAA;AAExB,EAAA,MAAM,YAAe,GAAA,CAACC,sBAAM,CAAA,UAAA,CAAWC,kCAAc,CAAA,CAAA;AACrD,EAAM,MAAA,OAAA,GAAUD,sBAAM,CAAA,UAAA,CAAWE,8BAAqB,CAAA,CAAA;AACtD,EAAM,MAAA,UAAA,GAAaF,sBAAM,CAAA,MAAA,CAAY,IAAI,CAAA,CAAA;AACzC,EAAA,MAAM,gBAAgBG,4BAAwB,EAAA,CAAA;AAC9C,E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A,gBACA;AAAA,kBACE,IAAM,EAAA,MAAA;AAAA,kBACN,KACE,EAAA,8EAAA;AAAA,iBACJ;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,QACA,MAAQ,EAAA;AAAA,UACN,IAAM,EAAA,QAAA;AAAA,UACN,WAAa,EAAA,QAAA;AAAA,UACb,WACE,EAAA,0EAAA;AAAA,UACF,gBAAkB,EAAA,CAAA;AAAA,SACpB;AAAA,QACA,UAAY,EAAA;AAAA,UACV,IAAM,EAAA,SAAA;AAAA,UACN,WACE,EAAA,oJAAA;AAAA,UACF,gBAAkB,EAAA,IAAA;AAAA,SACpB;AAAA,QACA,SAAW,EAAA;AAAA,UACT,IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,oFAAA;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.cjs.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { PlasmicElement, usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React, { useEffect } from \"react\";\nimport { Popover, PopoverContext } from \"react-aria-components\";\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 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)` } : undefined\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\");\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 matchTriggerWidth: {\n type: \"boolean\",\n defaultValue: true,\n hidden: (_props, ctx) => !ctx?.canMatchTriggerWidth,\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","makeComponentName","registerComponentHelper"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,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,GAhDJ,GAkDM,EADC,EAAA,SAAA,GAAA,SAAA,CACD,EADC,EAAA;AAAA,IAJH,gBAAA;AAAA,IACA,sBAAA;AAAA,IACA,uBAAA;AAAA,IACA,mBAAA;A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AM,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,OACF;AAAA;AAAA,MAEA,aAAe,EAAA,IAAA;AAAA,MACf,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;;;"}
@@ -1,13 +1,17 @@
1
1
  import { PlasmicElement } from "@plasmicapp/host";
2
2
  import React from "react";
3
3
  import { Popover } from "react-aria-components";
4
- import { CodeComponentMetaOverrides, Registerable } from "./utils";
4
+ import { CodeComponentMetaOverrides, HasControlContextData, Registerable } from "./utils";
5
5
  import { WithVariants } from "./variant-utils";
6
6
  declare const POPOVER_VARIANTS: ("placementLeft" | "placementRight" | "placementTop" | "placementBottom")[];
7
- export interface BasePopoverProps extends React.ComponentProps<typeof Popover>, WithVariants<typeof POPOVER_VARIANTS> {
7
+ export interface BasePopoverControlContextData {
8
+ canMatchTriggerWidth?: boolean;
9
+ }
10
+ export interface BasePopoverProps extends React.ComponentProps<typeof Popover>, WithVariants<typeof POPOVER_VARIANTS>, HasControlContextData<BasePopoverControlContextData> {
8
11
  className?: string;
9
12
  resetClassName?: string;
10
13
  children?: React.ReactNode;
14
+ matchTriggerWidth?: boolean;
11
15
  }
12
16
  export declare function BasePopover(props: BasePopoverProps): React.JSX.Element;
13
17
  export declare const POPOVER_COMPONENT_NAME: string;
@@ -1,8 +1,8 @@
1
1
  import { usePlasmicCanvasContext } from '@plasmicapp/host';
2
2
  import { mergeProps } from '@react-aria/utils';
3
- import React from 'react';
3
+ import React, { useEffect } from 'react';
4
4
  import { PopoverContext, Popover } from 'react-aria-components';
5
- import { a as PlasmicPopoverContext } from './contexts-081d65a0.esm.js';
5
+ import { a as PlasmicPopoverTriggerContext } from './contexts-5cb81c2f.esm.js';
6
6
  import { a as makeComponentName, r as registerComponentHelper } from './utils-25448fbd.esm.js';
7
7
  import { p as pickAriaComponentVariants } from './variant-utils-7c2ea202.esm.js';
8
8
  import '@plasmicapp/host/registerComponent';
@@ -43,14 +43,24 @@ const POPOVER_VARIANTS = [
43
43
  ];
44
44
  const { variants, withObservedValues } = pickAriaComponentVariants(POPOVER_VARIANTS);
45
45
  function BasePopover(props) {
46
- const _a = props, { resetClassName, plasmicUpdateVariant } = _a, restProps = __objRest(_a, ["resetClassName", "plasmicUpdateVariant"]);
46
+ const _a = props, {
47
+ resetClassName,
48
+ plasmicUpdateVariant,
49
+ setControlContextData,
50
+ matchTriggerWidth
51
+ } = _a, restProps = __objRest(_a, [
52
+ "resetClassName",
53
+ "plasmicUpdateVariant",
54
+ "setControlContextData",
55
+ "matchTriggerWidth"
56
+ ]);
47
57
  const isStandalone = !React.useContext(PopoverContext);
48
- const context = React.useContext(PlasmicPopoverContext);
58
+ const hasTrigger = !!React.useContext(PlasmicPopoverTriggerContext);
49
59
  const triggerRef = React.useRef(null);
50
60
  const canvasContext = usePlasmicCanvasContext();
61
+ const matchTriggerWidthProp = hasTrigger && matchTriggerWidth;
51
62
  const _b = mergeProps(
52
63
  {
53
- isOpen: context == null ? void 0 : context.isOpen,
54
64
  // isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies.
55
65
  // 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.
56
66
  isNonModal: canvasContext && !canvasContext.interactive
@@ -66,16 +76,27 @@ function BasePopover(props) {
66
76
  isOpen: true
67
77
  } : null
68
78
  ), { children } = _b, mergedProps = __objRest(_b, ["children"]);
69
- return /* @__PURE__ */ React.createElement(React.Fragment, null, isStandalone && /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(Popover, __spreadValues({}, mergedProps), ({ placement }) => withObservedValues(
70
- children,
71
- {
72
- placementTop: placement === "top",
73
- placementBottom: placement === "bottom",
74
- placementLeft: placement === "left",
75
- placementRight: placement === "right"
76
- },
77
- plasmicUpdateVariant
78
- )));
79
+ useEffect(() => {
80
+ setControlContextData == null ? void 0 : setControlContextData({
81
+ canMatchTriggerWidth: hasTrigger
82
+ });
83
+ }, [hasTrigger, setControlContextData]);
84
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, isStandalone && /* @__PURE__ */ React.createElement("div", { ref: triggerRef }), /* @__PURE__ */ React.createElement(
85
+ Popover,
86
+ __spreadValues({
87
+ style: matchTriggerWidthProp ? { width: `var(--trigger-width)` } : void 0
88
+ }, mergedProps),
89
+ ({ placement }) => withObservedValues(
90
+ children,
91
+ {
92
+ placementTop: placement === "top",
93
+ placementBottom: placement === "bottom",
94
+ placementLeft: placement === "left",
95
+ placementRight: placement === "right"
96
+ },
97
+ plasmicUpdateVariant
98
+ )
99
+ ));
79
100
  }
80
101
  const POPOVER_COMPONENT_NAME = makeComponentName("popover");
81
102
  const POPOVER_ARROW_IMG = {
@@ -166,6 +187,11 @@ function registerPopover(loader, overrides) {
166
187
  },
167
188
  resetClassName: {
168
189
  type: "themeResetClass"
190
+ },
191
+ matchTriggerWidth: {
192
+ type: "boolean",
193
+ defaultValue: true,
194
+ hidden: (_props, ctx) => !(ctx == null ? void 0 : ctx.canMatchTriggerWidth)
169
195
  }
170
196
  },
171
197
  // 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.
@@ -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 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 canvasContext = usePlasmicCanvasContext();\n const { children, ...mergedProps } = mergeProps(\n {\n isOpen: context?.isOpen,\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 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,EAAvD,kBAAgB,oBAtC1B,EAAA,GAsCiE,IAAd,SAAc,GAAA,SAAA,CAAA,EAAA,EAAd,CAAzC,gBAAgB,EAAA,sBAAA,CAAA,CAAA,CAAA;AAExB,EAAA,MAAM,YAAe,GAAA,CAAC,KAAM,CAAA,UAAA,CAAW,cAAc,CAAA,CAAA;AACrD,EAAM,MAAA,OAAA,GAAU,KAAM,CAAA,UAAA,CAAW,qBAAqB,CAAA,CAAA;AACtD,EAAM,MAAA,UAAA,GAAa,KAAM,CAAA,MAAA,CAAY,IAAI,CAAA,CAAA;AACzC,EAAA,MAAM,gBAAgB,uBAAwB,EAAA,CAAA;AAC9C,EAAqC,MAAA,EAAA,GAAA,UAAA;AAAA,IACnC;AAAA,MACE,QAAQ,OAAS,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,OAAA,CAAA,MAAA;AAAA;AAAA;AAAA,MAGjB,UAAA,EAAY,aAAiB,IAAA,CAAC,aAAc,CAAA,WAAA;AAAA,KAC9C;AAAA,IACA,SAAA;AA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F,gBAAkB,EAAA,CAAA;AAAA,SACpB;AAAA,QACA,UAAY,EAAA;AAAA,UACV,IAAM,EAAA,SAAA;AAAA,UACN,WACE,EAAA,oJAAA;AAAA,UACF,gBAAkB,EAAA,IAAA;AAAA,SACpB;AAAA,QACA,SAAW,EAAA;AAAA,UACT,IAAM,EAAA,QAAA;AAAA,UACN,WACE,EAAA,oFAAA;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, { useEffect } from \"react\";\nimport { Popover, PopoverContext } from \"react-aria-components\";\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 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)` } : undefined\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\");\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 matchTriggerWidth: {\n type: \"boolean\",\n defaultValue: true,\n hidden: (_props, ctx) => !ctx?.canMatchTriggerWidth,\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,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,GAhDJ,GAkDM,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;A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F;;;;"}
@@ -3,7 +3,7 @@
3
3
  var React = require('react');
4
4
  var reactAriaComponents = require('react-aria-components');
5
5
  var common = require('./common-f6de262a.cjs.js');
6
- var contexts = require('./contexts-baa37b74.cjs.js');
6
+ var contexts = require('./contexts-6d0cb2b1.cjs.js');
7
7
  var registerLabel = require('./registerLabel.cjs.js');
8
8
  var utils = require('./utils-3e796b18.cjs.js');
9
9
  var variantUtils = require('./variant-utils-8cb38f8f.cjs.js');
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Radio, RadioGroup } from 'react-aria-components';
3
3
  import { g as getCommonProps } from './common-70efdf8a.esm.js';
4
- import { e as PlasmicRadioGroupContext } from './contexts-081d65a0.esm.js';
4
+ import { e as PlasmicRadioGroupContext } from './contexts-5cb81c2f.esm.js';
5
5
  import { LABEL_COMPONENT_NAME } from './registerLabel.esm.js';
6
6
  import { r as registerComponentHelper, a as makeComponentName } from './utils-25448fbd.esm.js';
7
7
  import { p as pickAriaComponentVariants } from './variant-utils-7c2ea202.esm.js';
@@ -3,7 +3,7 @@
3
3
  var React = require('react');
4
4
  var reactAriaComponents = require('react-aria-components');
5
5
  var common = require('./common-f6de262a.cjs.js');
6
- var contexts = require('./contexts-baa37b74.cjs.js');
6
+ var contexts = require('./contexts-6d0cb2b1.cjs.js');
7
7
  var registerDescription = require('./registerDescription.cjs.js');
8
8
  var registerFieldError = require('./registerFieldError.cjs.js');
9
9
  var registerLabel = require('./registerLabel.cjs.js');
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { RadioGroup } from 'react-aria-components';
3
3
  import { g as getCommonProps } from './common-70efdf8a.esm.js';
4
- import { e as PlasmicRadioGroupContext } from './contexts-081d65a0.esm.js';
4
+ import { e as PlasmicRadioGroupContext } from './contexts-5cb81c2f.esm.js';
5
5
  import { DESCRIPTION_COMPONENT_NAME } from './registerDescription.esm.js';
6
6
  import { registerFieldError } from './registerFieldError.esm.js';
7
7
  import { registerLabel, LABEL_COMPONENT_NAME } from './registerLabel.esm.js';
@@ -1,10 +1,9 @@
1
1
  'use strict';
2
2
 
3
- require('@react-aria/utils');
4
3
  require('react');
5
4
  require('react-aria-components');
6
- require('./contexts-baa37b74.cjs.js');
7
- var registerSection = require('./registerListBox-c2c63064.cjs.js');
5
+ require('./contexts-6d0cb2b1.cjs.js');
6
+ var registerSection = require('./registerListBox-f4f6beb5.cjs.js');
8
7
  require('./utils-3e796b18.cjs.js');
9
8
  require('./registerListBoxItem.cjs.js');
10
9
  require('./registerDescription.cjs.js');
@@ -1 +1 @@
1
- {"version":3,"file":"registerSection.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"registerSection.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
@@ -1,8 +1,7 @@
1
- import '@react-aria/utils';
2
1
  import 'react';
3
2
  import 'react-aria-components';
4
- import './contexts-081d65a0.esm.js';
5
- export { B as BaseSection, r as registerSection } from './registerListBox-64bcf3d2.esm.js';
3
+ import './contexts-5cb81c2f.esm.js';
4
+ export { B as BaseSection, r as registerSection } from './registerListBox-25d602fa.esm.js';
6
5
  import './utils-25448fbd.esm.js';
7
6
  import './registerListBoxItem.esm.js';
8
7
  import './registerDescription.esm.js';
@@ -1 +1 @@
1
- {"version":3,"file":"registerSection.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
1
+ {"version":3,"file":"registerSection.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
@@ -3,8 +3,8 @@
3
3
  var React = require('react');
4
4
  var reactAriaComponents = require('react-aria-components');
5
5
  var common = require('./common-f6de262a.cjs.js');
6
- var contexts = require('./contexts-baa37b74.cjs.js');
7
- var registerSection = require('./registerListBox-c2c63064.cjs.js');
6
+ var contexts = require('./contexts-6d0cb2b1.cjs.js');
7
+ var registerSection = require('./registerListBox-f4f6beb5.cjs.js');
8
8
  var registerButton = require('./registerButton.cjs.js');
9
9
  var registerLabel = require('./registerLabel.cjs.js');
10
10
  var registerPopover = require('./registerPopover.cjs.js');
@@ -13,8 +13,8 @@ var variantUtils = require('./variant-utils-8cb38f8f.cjs.js');
13
13
  require('./registerListBoxItem.cjs.js');
14
14
  require('./registerDescription.cjs.js');
15
15
  require('./registerText.cjs.js');
16
- require('@react-aria/utils');
17
16
  require('@plasmicapp/host');
17
+ require('@react-aria/utils');
18
18
  require('@plasmicapp/host/registerComponent');
19
19
 
20
20
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -98,7 +98,7 @@ function BaseSelect(props) {
98
98
  "aria-label": ariaLabel
99
99
  }, utils.extractPlasmicDataProps(props)),
100
100
  /* @__PURE__ */ React__default.default.createElement(SelectAutoOpen, __spreadValues({}, props)),
101
- /* @__PURE__ */ React__default.default.createElement(contexts.PlasmicPopoverContext.Provider, { value: {} }, /* @__PURE__ */ React__default.default.createElement(
101
+ /* @__PURE__ */ React__default.default.createElement(contexts.PlasmicPopoverTriggerContext.Provider, { value: true }, /* @__PURE__ */ React__default.default.createElement(
102
102
  contexts.PlasmicListBoxContext.Provider,
103
103
  {
104
104
  value: {
@@ -240,7 +240,8 @@ function registerSelect(loader) {
240
240
  styles: {
241
241
  backgroundColor: "white",
242
242
  padding: "10px",
243
- overflow: "scroll"
243
+ overflow: "scroll",
244
+ width: "unset"
244
245
  },
245
246
  props: {
246
247
  children: [