@plasmicpkgs/react-aria 0.0.86 → 0.0.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/common.d.ts +10 -1
- package/dist/react-aria.esm.js +273 -177
- package/dist/react-aria.esm.js.map +1 -1
- package/dist/react-aria.js +272 -176
- package/dist/react-aria.js.map +1 -1
- package/dist/registerOverlayArrow.d.ts +11 -0
- package/dist/registerPopover.d.ts +0 -2
- package/package.json +2 -2
- package/skinny/{common-1e5dba7d.cjs.js → common-47e48033.cjs.js} +89 -1
- package/skinny/common-47e48033.cjs.js.map +1 -0
- package/skinny/{common-a8f4a4b1.esm.js → common-7ecf439d.esm.js} +88 -2
- package/skinny/common-7ecf439d.esm.js.map +1 -0
- package/skinny/common.d.ts +10 -1
- package/skinny/registerButton.cjs.js +1 -1
- package/skinny/registerButton.esm.js +1 -1
- package/skinny/registerCheckbox.cjs.js +1 -1
- package/skinny/registerCheckbox.esm.js +1 -1
- package/skinny/registerCheckboxGroup.cjs.js +1 -1
- package/skinny/registerCheckboxGroup.esm.js +1 -1
- package/skinny/registerComboBox.cjs.js +2 -14
- package/skinny/registerComboBox.cjs.js.map +1 -1
- package/skinny/registerComboBox.esm.js +2 -14
- package/skinny/registerComboBox.esm.js.map +1 -1
- package/skinny/registerDialogTrigger.cjs.js +1 -1
- package/skinny/registerDialogTrigger.esm.js +1 -1
- package/skinny/registerInput.cjs.js +1 -1
- package/skinny/registerInput.esm.js +1 -1
- package/skinny/registerModal.cjs.js +1 -1
- package/skinny/registerModal.esm.js +1 -1
- package/skinny/registerOverlayArrow.cjs.js +72 -0
- package/skinny/registerOverlayArrow.cjs.js.map +1 -0
- package/skinny/registerOverlayArrow.d.ts +11 -0
- package/skinny/registerOverlayArrow.esm.js +64 -0
- package/skinny/registerOverlayArrow.esm.js.map +1 -0
- package/skinny/registerPopover.cjs.js +9 -36
- package/skinny/registerPopover.cjs.js.map +1 -1
- package/skinny/registerPopover.d.ts +0 -2
- package/skinny/registerPopover.esm.js +10 -36
- package/skinny/registerPopover.esm.js.map +1 -1
- package/skinny/registerRadio.cjs.js +1 -1
- package/skinny/registerRadio.esm.js +1 -1
- package/skinny/registerRadioGroup.cjs.js +1 -1
- package/skinny/registerRadioGroup.esm.js +1 -1
- package/skinny/registerSelect.cjs.js +2 -10
- package/skinny/registerSelect.cjs.js.map +1 -1
- package/skinny/registerSelect.esm.js +2 -10
- package/skinny/registerSelect.esm.js.map +1 -1
- package/skinny/registerSlider.cjs.js +1 -1
- package/skinny/registerSlider.esm.js +1 -1
- package/skinny/registerSliderThumb.cjs.js +1 -1
- package/skinny/registerSliderThumb.esm.js +1 -1
- package/skinny/registerSwitch.cjs.js +1 -1
- package/skinny/registerSwitch.esm.js +1 -1
- package/skinny/registerTextArea.cjs.js +1 -1
- package/skinny/registerTextArea.esm.js +1 -1
- package/skinny/registerTextField.cjs.js +1 -1
- package/skinny/registerTextField.esm.js +1 -1
- package/skinny/registerTooltip.cjs.js +18 -15
- package/skinny/registerTooltip.cjs.js.map +1 -1
- package/skinny/registerTooltip.esm.js +18 -15
- package/skinny/registerTooltip.esm.js.map +1 -1
- package/skinny/common-1e5dba7d.cjs.js.map +0 -1
- package/skinny/common-a8f4a4b1.esm.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerComboBox.esm.js","sources":["../src/registerComboBox.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo } from \"react\";\nimport {\n ComboBox,\n ComboBoxProps,\n ComboBoxRenderProps,\n ComboBoxStateContext,\n} from \"react-aria-components\";\nimport { getCommonProps } from \"./common\";\nimport {\n PlasmicInputContext,\n PlasmicListBoxContext,\n PlasmicPopoverTriggerContext,\n} from \"./contexts\";\nimport { ListBoxItemIdManager } from \"./ListBoxItemIdManager\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { INPUT_COMPONENT_NAME } from \"./registerInput\";\nimport { LABEL_COMPONENT_NAME } from \"./registerLabel\";\nimport { LIST_BOX_COMPONENT_NAME } from \"./registerListBox\";\nimport { POPOVER_COMPONENT_NAME } from \"./registerPopover\";\nimport {\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n useAutoOpen,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst COMBOBOX_NAME = makeComponentName(\"combobox\");\n\nexport interface BaseComboboxControlContextData {\n itemIds: string[];\n}\n\nconst COMBOBOX_VARIANTS = [\"disabled\" as const];\n\nconst { variants: COMBOBOX_VARIANTS_DATA } =\n pickAriaComponentVariants(COMBOBOX_VARIANTS);\n\nexport interface BaseComboboxProps\n extends ComboBoxProps<{}>,\n WithVariants<typeof COMBOBOX_VARIANTS>,\n HasControlContextData<BaseComboboxControlContextData> {\n children?: React.ReactNode;\n isOpen?: boolean;\n className?: string;\n}\n\n/*\n This React Hook is used to help with auto-opening the combobox when the canvas component is selected.\n Currently, there is a bug in react-aria combobox (https://github.com/adobe/react-spectrum/issues/7149) where, when the combobox's popover is auto-opened, it is unable to render any listbox items.\n Setting popover's open state to true in not enough unless, unless it has previously been opened via user interaction with combobox.\n Also, <Combobox> does not support an `isOpen` prop either.\n\n So, we use this custom hook to access the combobox's internal state via ComboBoxStateContext and change the `open` state manually via tha available `open` method.\n\n Note: It cannot be used as a hook like useAutoOpen() within the BaseSelect component\n because it needs access to SelectStateContext, which is only created in the BaseSelect component's render function.\n */\nfunction ComboboxAutoOpen(props: any) {\n const { open, close } = React.useContext(ComboBoxStateContext) ?? {};\n\n useAutoOpen({ props, open, close });\n\n return null;\n}\n\nexport function BaseComboBox(props: BaseComboboxProps) {\n const {\n children,\n setControlContextData,\n plasmicUpdateVariant,\n className,\n isOpen: _isOpen, // uncontrolled if not selected in canvas/edit mode\n ...rest\n } = props;\n\n const classNameProp = useCallback(\n ({ isDisabled }: ComboBoxRenderProps) => {\n plasmicUpdateVariant?.({\n disabled: isDisabled,\n });\n return className ?? \"\";\n },\n [className, plasmicUpdateVariant]\n );\n\n const idManager = useMemo(() => new ListBoxItemIdManager(), []);\n\n useEffect(() => {\n idManager.subscribe((ids: string[]) => {\n setControlContextData?.({\n itemIds: ids,\n });\n });\n }, []);\n\n return (\n <ComboBox className={classNameProp} {...rest}>\n <PlasmicPopoverTriggerContext.Provider value={true}>\n <PlasmicListBoxContext.Provider\n value={{\n idManager,\n }}\n >\n <PlasmicInputContext.Provider value={{ isUncontrolled: true }}>\n <ComboboxAutoOpen {...props} />\n {children}\n </PlasmicInputContext.Provider>\n </PlasmicListBoxContext.Provider>\n </PlasmicPopoverTriggerContext.Provider>\n </ComboBox>\n );\n}\n\nexport function registerComboBox(loader?: Registerable) {\n registerComponentHelper(loader, BaseComboBox, {\n name: COMBOBOX_NAME,\n displayName: \"Aria ComboBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerComboBox\",\n importName: \"BaseComboBox\",\n variants: COMBOBOX_VARIANTS_DATA,\n props: {\n ...getCommonProps<BaseComboboxProps>(\"ComboBox\", [\n \"name\",\n \"aria-label\",\n \"isDisabled\",\n ]),\n selectedKey: {\n type: \"choice\",\n editOnly: true,\n uncontrolledProp: \"defaultSelectedKey\",\n displayName: \"Initial selected item\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n // React Aria ComboBox do not support multiple selections yet\n multiSelect: false,\n },\n disabledKeys: {\n type: \"choice\",\n displayName: \"Disabled values\",\n description:\n \"The items that are disabled. These items cannot be selected, focused, or otherwise interacted with.\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n multiSelect: true,\n advanced: true,\n },\n isOpen: {\n type: \"boolean\",\n defaultValue: false,\n // It doesn't make sense to make isOpen prop editable (it's controlled by user interaction and always closed by default), so we keep this prop hidden. We have listed the prop here in the meta only so we can expose a writeable state for it.\n hidden: () => true,\n },\n onSelectionChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"selectedValue\", type: \"string\" }],\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"vbox\",\n styles: {\n justifyContent: \"flex-start\",\n alignItems: \"flex-start\",\n width: \"300px\",\n padding: 0,\n },\n children: [\n {\n type: \"component\",\n name: LABEL_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: \"Label\",\n },\n },\n },\n {\n type: \"hbox\",\n styles: {\n padding: 0,\n },\n children: [\n {\n type: \"component\",\n name: INPUT_COMPONENT_NAME,\n styles: {\n width: \"100%\",\n borderRightWidth: 0,\n },\n },\n {\n type: \"component\",\n name: BUTTON_COMPONENT_NAME,\n props: {\n children: {\n type: \"img\",\n // TODO: Replace with the image of an arrow pointing up, like: https://icon-sets.iconify.design/mdi/triangle/\n src: \"https://static1.plasmic.app/arrow-up.svg\",\n styles: {\n width: \"15px\",\n transform: \"rotate(180deg)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n padding: 0,\n },\n },\n },\n },\n ],\n },\n {\n type: \"component\",\n name: POPOVER_COMPONENT_NAME,\n styles: {\n backgroundColor: \"white\",\n padding: \"10px\",\n overflow: \"scroll\",\n width: \"unset\",\n },\n props: {\n offset: 0,\n children: [\n {\n type: \"component\",\n name: LIST_BOX_COMPONENT_NAME,\n props: {\n selectionMode: \"single\",\n },\n styles: {\n borderWidth: 0,\n width: \"stretch\",\n },\n },\n ],\n },\n },\n ],\n },\n ],\n },\n },\n states: {\n selectedValue: {\n type: \"writable\",\n valueProp: \"selectedKey\",\n onChangeProp: \"onSelectionChange\",\n variableType: \"text\",\n },\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: true,\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ACF;AAAA,qBACF;AAAA,mBACF;AAAA,iBACF;AAAA,eACF;AAAA,cACA;AAAA,gBACE,IAAM,EAAA,WAAA;AAAA,gBACN,IAAM,EAAA,sBAAA;AAAA,gBACN,MAAQ,EAAA;AAAA,kBACN,eAAiB,EAAA,OAAA;AAAA,kBACjB,OAAS,EAAA,MAAA;AAAA,kBACT,QAAU,EAAA,QAAA;AAAA,kBACV,KAAO,EAAA,OAAA;AAAA,iBACT;AAAA,gBACA,KAAO,EAAA;AAAA,kBACL,MAAQ,EAAA,CAAA;AAAA,kBACR,QAAU,EAAA;AAAA,oBACR;AAAA,sBACE,IAAM,EAAA,WAAA;AAAA,sBACN,IAAM,EAAA,uBAAA;AAAA,sBACN,KAAO,EAAA;AAAA,wBACL,aAAe,EAAA,QAAA;AAAA,uBACjB;AAAA,sBACA,MAAQ,EAAA;AAAA,wBACN,WAAa,EAAA,CAAA;AAAA,wBACb,KAAO,EAAA,SAAA;AAAA,uBACT;AAAA,qBACF;AAAA,mBACF;AAAA,iBACF;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,KACF,CAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,aAAe,EAAA;AAAA,QACb,IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,aAAA;AAAA,QACX,YAAc,EAAA,mBAAA;AAAA,QACd,YAAc,EAAA,MAAA;AAAA,OAChB;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,QAAA;AAAA,QACX,YAAc,EAAA,cAAA;AAAA,QACd,YAAc,EAAA,SAAA;AAAA,OAChB;AAAA,KACF;AAAA,IACA,UAAY,EAAA,IAAA;AAAA,GACb,CAAA,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"registerComboBox.esm.js","sources":["../src/registerComboBox.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo } from \"react\";\nimport {\n ComboBox,\n ComboBoxProps,\n ComboBoxRenderProps,\n ComboBoxStateContext,\n} from \"react-aria-components\";\nimport { arrowDown, getCommonProps } from \"./common\";\nimport {\n PlasmicInputContext,\n PlasmicListBoxContext,\n PlasmicPopoverTriggerContext,\n} from \"./contexts\";\nimport { ListBoxItemIdManager } from \"./ListBoxItemIdManager\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { INPUT_COMPONENT_NAME } from \"./registerInput\";\nimport { LABEL_COMPONENT_NAME } from \"./registerLabel\";\nimport { LIST_BOX_COMPONENT_NAME } from \"./registerListBox\";\nimport { POPOVER_COMPONENT_NAME } from \"./registerPopover\";\nimport {\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n useAutoOpen,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst COMBOBOX_NAME = makeComponentName(\"combobox\");\n\nexport interface BaseComboboxControlContextData {\n itemIds: string[];\n}\n\nconst COMBOBOX_VARIANTS = [\"disabled\" as const];\n\nconst { variants: COMBOBOX_VARIANTS_DATA } =\n pickAriaComponentVariants(COMBOBOX_VARIANTS);\n\nexport interface BaseComboboxProps\n extends ComboBoxProps<{}>,\n WithVariants<typeof COMBOBOX_VARIANTS>,\n HasControlContextData<BaseComboboxControlContextData> {\n children?: React.ReactNode;\n isOpen?: boolean;\n className?: string;\n}\n\n/*\n This React Hook is used to help with auto-opening the combobox when the canvas component is selected.\n Currently, there is a bug in react-aria combobox (https://github.com/adobe/react-spectrum/issues/7149) where, when the combobox's popover is auto-opened, it is unable to render any listbox items.\n Setting popover's open state to true in not enough unless, unless it has previously been opened via user interaction with combobox.\n Also, <Combobox> does not support an `isOpen` prop either.\n\n So, we use this custom hook to access the combobox's internal state via ComboBoxStateContext and change the `open` state manually via tha available `open` method.\n\n Note: It cannot be used as a hook like useAutoOpen() within the BaseSelect component\n because it needs access to SelectStateContext, which is only created in the BaseSelect component's render function.\n */\nfunction ComboboxAutoOpen(props: any) {\n const { open, close } = React.useContext(ComboBoxStateContext) ?? {};\n\n useAutoOpen({ props, open, close });\n\n return null;\n}\n\nexport function BaseComboBox(props: BaseComboboxProps) {\n const {\n children,\n setControlContextData,\n plasmicUpdateVariant,\n className,\n isOpen: _isOpen, // uncontrolled if not selected in canvas/edit mode\n ...rest\n } = props;\n\n const classNameProp = useCallback(\n ({ isDisabled }: ComboBoxRenderProps) => {\n plasmicUpdateVariant?.({\n disabled: isDisabled,\n });\n return className ?? \"\";\n },\n [className, plasmicUpdateVariant]\n );\n\n const idManager = useMemo(() => new ListBoxItemIdManager(), []);\n\n useEffect(() => {\n idManager.subscribe((ids: string[]) => {\n setControlContextData?.({\n itemIds: ids,\n });\n });\n }, []);\n\n return (\n <ComboBox className={classNameProp} {...rest}>\n <PlasmicPopoverTriggerContext.Provider value={true}>\n <PlasmicListBoxContext.Provider\n value={{\n idManager,\n }}\n >\n <PlasmicInputContext.Provider value={{ isUncontrolled: true }}>\n <ComboboxAutoOpen {...props} />\n {children}\n </PlasmicInputContext.Provider>\n </PlasmicListBoxContext.Provider>\n </PlasmicPopoverTriggerContext.Provider>\n </ComboBox>\n );\n}\n\nexport function registerComboBox(loader?: Registerable) {\n registerComponentHelper(loader, BaseComboBox, {\n name: COMBOBOX_NAME,\n displayName: \"Aria ComboBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerComboBox\",\n importName: \"BaseComboBox\",\n variants: COMBOBOX_VARIANTS_DATA,\n props: {\n ...getCommonProps<BaseComboboxProps>(\"ComboBox\", [\n \"name\",\n \"aria-label\",\n \"isDisabled\",\n ]),\n selectedKey: {\n type: \"choice\",\n editOnly: true,\n uncontrolledProp: \"defaultSelectedKey\",\n displayName: \"Initial selected item\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n // React Aria ComboBox do not support multiple selections yet\n multiSelect: false,\n },\n disabledKeys: {\n type: \"choice\",\n displayName: \"Disabled values\",\n description:\n \"The items that are disabled. These items cannot be selected, focused, or otherwise interacted with.\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n multiSelect: true,\n advanced: true,\n },\n isOpen: {\n type: \"boolean\",\n defaultValue: false,\n // It doesn't make sense to make isOpen prop editable (it's controlled by user interaction and always closed by default), so we keep this prop hidden. We have listed the prop here in the meta only so we can expose a writeable state for it.\n hidden: () => true,\n },\n onSelectionChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"selectedValue\", type: \"string\" }],\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"vbox\",\n styles: {\n justifyContent: \"flex-start\",\n alignItems: \"flex-start\",\n width: \"300px\",\n padding: 0,\n },\n children: [\n {\n type: \"component\",\n name: LABEL_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: \"Label\",\n },\n },\n },\n {\n type: \"hbox\",\n styles: {\n padding: 0,\n },\n children: [\n {\n type: \"component\",\n name: INPUT_COMPONENT_NAME,\n styles: {\n width: \"100%\",\n borderRightWidth: 0,\n },\n },\n {\n type: \"component\",\n name: BUTTON_COMPONENT_NAME,\n props: {\n children: arrowDown,\n },\n },\n ],\n },\n {\n type: \"component\",\n name: POPOVER_COMPONENT_NAME,\n styles: {\n backgroundColor: \"white\",\n padding: \"10px\",\n overflow: \"scroll\",\n width: \"unset\",\n },\n props: {\n offset: 0,\n children: [\n {\n type: \"component\",\n name: LIST_BOX_COMPONENT_NAME,\n props: {\n selectionMode: \"single\",\n },\n styles: {\n borderWidth: 0,\n width: \"stretch\",\n },\n },\n ],\n },\n },\n ],\n },\n ],\n },\n },\n states: {\n selectedValue: {\n type: \"writable\",\n valueProp: \"selectedKey\",\n onChangeProp: \"onSelectionChange\",\n variableType: \"text\",\n },\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: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A,kBACT,QAAU,EAAA,QAAA;AAAA,kBACV,KAAO,EAAA,OAAA;AAAA,iBACT;AAAA,gBACA,KAAO,EAAA;AAAA,kBACL,MAAQ,EAAA,CAAA;AAAA,kBACR,QAAU,EAAA;AAAA,oBACR;AAAA,sBACE,IAAM,EAAA,WAAA;AAAA,sBACN,IAAM,EAAA,uBAAA;AAAA,sBACN,KAAO,EAAA;AAAA,wBACL,aAAe,EAAA,QAAA;AAAA,uBACjB;AAAA,sBACA,MAAQ,EAAA;AAAA,wBACN,WAAa,EAAA,CAAA;AAAA,wBACb,KAAO,EAAA,SAAA;AAAA,uBACT;AAAA,qBACF;AAAA,mBACF;AAAA,iBACF;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,KACF,CAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,aAAe,EAAA;AAAA,QACb,IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,aAAA;AAAA,QACX,YAAc,EAAA,mBAAA;AAAA,QACd,YAAc,EAAA,MAAA;AAAA,OAChB;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,QAAA;AAAA,QACX,YAAc,EAAA,cAAA;AAAA,QACd,YAAc,EAAA,SAAA;AAAA,OAChB;AAAA,KACF;AAAA,IACA,UAAY,EAAA,IAAA;AAAA,GACb,CAAA,CAAA;AACH;;;;"}
|
|
@@ -8,7 +8,7 @@ var registerButton = require('./registerButton.cjs.js');
|
|
|
8
8
|
var registerModal = require('./registerModal.cjs.js');
|
|
9
9
|
var utils = require('./utils-d1c8094f.cjs.js');
|
|
10
10
|
require('react-aria');
|
|
11
|
-
require('./common-
|
|
11
|
+
require('./common-47e48033.cjs.js');
|
|
12
12
|
require('./variant-utils-0ad70db8.cjs.js');
|
|
13
13
|
require('./registerHeading.cjs.js');
|
|
14
14
|
require('@plasmicapp/host/registerComponent');
|
|
@@ -6,7 +6,7 @@ import { BUTTON_COMPONENT_NAME } from './registerButton.esm.js';
|
|
|
6
6
|
import { MODAL_COMPONENT_NAME } from './registerModal.esm.js';
|
|
7
7
|
import { r as registerComponentHelper, a as makeComponentName } from './utils-41b3d43b.esm.js';
|
|
8
8
|
import 'react-aria';
|
|
9
|
-
import './common-
|
|
9
|
+
import './common-7ecf439d.esm.js';
|
|
10
10
|
import './variant-utils-4405ebb0.esm.js';
|
|
11
11
|
import './registerHeading.esm.js';
|
|
12
12
|
import '@plasmicapp/host/registerComponent';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var reactAria = require('react-aria');
|
|
5
5
|
var reactAriaComponents = require('react-aria-components');
|
|
6
|
-
var common = require('./common-
|
|
6
|
+
var common = require('./common-47e48033.cjs.js');
|
|
7
7
|
var contexts = require('./contexts-6d0cb2b1.cjs.js');
|
|
8
8
|
var utils = require('./utils-d1c8094f.cjs.js');
|
|
9
9
|
var variantUtils = require('./variant-utils-0ad70db8.cjs.js');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { mergeProps } from 'react-aria';
|
|
3
3
|
import { Input } from 'react-aria-components';
|
|
4
|
-
import { r as resolveAutoComplete, g as getCommonProps } from './common-
|
|
4
|
+
import { r as resolveAutoComplete, g as getCommonProps } from './common-7ecf439d.esm.js';
|
|
5
5
|
import { g as PlasmicTextFieldContext, c as PlasmicInputContext } from './contexts-5cb81c2f.esm.js';
|
|
6
6
|
import { a as makeComponentName, r as registerComponentHelper } from './utils-41b3d43b.esm.js';
|
|
7
7
|
import { p as pickAriaComponentVariants } from './variant-utils-4405ebb0.esm.js';
|
|
@@ -4,7 +4,7 @@ var host = require('@plasmicapp/host');
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var reactAria = require('react-aria');
|
|
6
6
|
var reactAriaComponents = require('react-aria-components');
|
|
7
|
-
var common = require('./common-
|
|
7
|
+
var common = require('./common-47e48033.cjs.js');
|
|
8
8
|
var contexts = require('./contexts-6d0cb2b1.cjs.js');
|
|
9
9
|
var registerHeading = require('./registerHeading.cjs.js');
|
|
10
10
|
var utils = require('./utils-d1c8094f.cjs.js');
|
|
@@ -2,7 +2,7 @@ import { usePlasmicCanvasContext, usePlasmicCanvasComponentInfo } from '@plasmic
|
|
|
2
2
|
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
3
3
|
import { mergeProps } from 'react-aria';
|
|
4
4
|
import { ModalOverlay, Modal, Dialog } from 'react-aria-components';
|
|
5
|
-
import { h as hasParent } from './common-
|
|
5
|
+
import { h as hasParent } from './common-7ecf439d.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 { a as makeComponentName, r as registerComponentHelper } from './utils-41b3d43b.esm.js';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var reactAriaComponents = require('react-aria-components');
|
|
5
|
+
var common = require('./common-47e48033.cjs.js');
|
|
6
|
+
var utils = require('./utils-d1c8094f.cjs.js');
|
|
7
|
+
var variantUtils = require('./variant-utils-0ad70db8.cjs.js');
|
|
8
|
+
require('@plasmicapp/host');
|
|
9
|
+
require('@plasmicapp/host/registerComponent');
|
|
10
|
+
|
|
11
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
14
|
+
|
|
15
|
+
const OVERLAY_ARROW_VARIANTS = [
|
|
16
|
+
// We do not offer a placementDown variant, because that's the default placement (an overlay arrow always has [data-placement=bottom] if it's not explicitly set)
|
|
17
|
+
"placementTop",
|
|
18
|
+
"placementLeft",
|
|
19
|
+
"placementRight"
|
|
20
|
+
];
|
|
21
|
+
const { variants, withObservedValues } = variantUtils.pickAriaComponentVariants(
|
|
22
|
+
OVERLAY_ARROW_VARIANTS
|
|
23
|
+
);
|
|
24
|
+
function BaseOverlayArrow({
|
|
25
|
+
children,
|
|
26
|
+
plasmicUpdateVariant,
|
|
27
|
+
className
|
|
28
|
+
}) {
|
|
29
|
+
const popoverContext = React__default.default.useContext(reactAriaComponents.PopoverContext);
|
|
30
|
+
const tooltipContext = React__default.default.useContext(reactAriaComponents.TooltipContext);
|
|
31
|
+
const isStandalone = !popoverContext && !tooltipContext;
|
|
32
|
+
const overlayArrow = /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.OverlayArrow, { style: { lineHeight: "0" }, className }, ({ placement }) => withObservedValues(
|
|
33
|
+
/* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, children),
|
|
34
|
+
{
|
|
35
|
+
placementTop: placement === "top",
|
|
36
|
+
placementLeft: placement === "left",
|
|
37
|
+
placementRight: placement === "right"
|
|
38
|
+
},
|
|
39
|
+
plasmicUpdateVariant
|
|
40
|
+
));
|
|
41
|
+
if (isStandalone) {
|
|
42
|
+
return /* @__PURE__ */ React__default.default.createElement("div", { style: { position: "relative" } }, overlayArrow);
|
|
43
|
+
}
|
|
44
|
+
return overlayArrow;
|
|
45
|
+
}
|
|
46
|
+
const OVERLAY_ARROW_COMPONENT_NAME = utils.makeComponentName("overlayArrow");
|
|
47
|
+
function registerOverlayArrow(loader, overrides) {
|
|
48
|
+
return utils.registerComponentHelper(
|
|
49
|
+
loader,
|
|
50
|
+
BaseOverlayArrow,
|
|
51
|
+
{
|
|
52
|
+
name: OVERLAY_ARROW_COMPONENT_NAME,
|
|
53
|
+
displayName: "Aria Overlay Arrow",
|
|
54
|
+
importPath: "@plasmicpkgs/react-aria/skinny/registerOverlayArrow",
|
|
55
|
+
importName: "BaseOverlayArrow",
|
|
56
|
+
styleSections: false,
|
|
57
|
+
variants,
|
|
58
|
+
props: {
|
|
59
|
+
children: {
|
|
60
|
+
type: "slot",
|
|
61
|
+
defaultValue: common.arrowDown
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
overrides
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
exports.BaseOverlayArrow = BaseOverlayArrow;
|
|
70
|
+
exports.OVERLAY_ARROW_COMPONENT_NAME = OVERLAY_ARROW_COMPONENT_NAME;
|
|
71
|
+
exports.registerOverlayArrow = registerOverlayArrow;
|
|
72
|
+
//# sourceMappingURL=registerOverlayArrow.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerOverlayArrow.cjs.js","sources":["../src/registerOverlayArrow.tsx"],"sourcesContent":["import React from \"react\";\nimport type {\n OverlayArrowProps,\n OverlayArrowRenderProps,\n} from \"react-aria-components\";\nimport {\n OverlayArrow,\n PopoverContext,\n TooltipContext,\n} from \"react-aria-components\";\nimport { arrowDown } from \"./common\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst OVERLAY_ARROW_VARIANTS = [\n // We do not offer a placementDown variant, because that's the default placement (an overlay arrow always has [data-placement=bottom] if it's not explicitly set)\n \"placementTop\" as const,\n \"placementLeft\" as const,\n \"placementRight\" as const,\n];\n\nexport interface BaseOverlayArrowProps\n extends OverlayArrowProps,\n WithVariants<typeof OVERLAY_ARROW_VARIANTS> {}\n\nconst { variants, withObservedValues } = pickAriaComponentVariants(\n OVERLAY_ARROW_VARIANTS\n);\n\nexport function BaseOverlayArrow({\n children,\n plasmicUpdateVariant,\n className,\n}: BaseOverlayArrowProps) {\n const popoverContext = React.useContext(PopoverContext);\n const tooltipContext = React.useContext(TooltipContext);\n const isStandalone = !popoverContext && !tooltipContext; // i.e. without a trigger to point to\n const overlayArrow = (\n <OverlayArrow style={{ lineHeight: \"0\" }} className={className}>\n {({ placement }: OverlayArrowRenderProps) =>\n withObservedValues(\n <>{children}</>,\n {\n placementTop: placement === \"top\",\n placementLeft: placement === \"left\",\n placementRight: placement === \"right\",\n },\n plasmicUpdateVariant\n )\n }\n </OverlayArrow>\n );\n if (isStandalone) {\n return <div style={{ position: \"relative\" }}>{overlayArrow}</div>;\n }\n return overlayArrow;\n}\n\nexport const OVERLAY_ARROW_COMPONENT_NAME = makeComponentName(\"overlayArrow\");\n\nexport function registerOverlayArrow(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseOverlayArrow>\n) {\n return registerComponentHelper(\n loader,\n BaseOverlayArrow,\n {\n name: OVERLAY_ARROW_COMPONENT_NAME,\n displayName: \"Aria Overlay Arrow\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerOverlayArrow\",\n importName: \"BaseOverlayArrow\",\n styleSections: false,\n variants,\n props: {\n children: {\n type: \"slot\",\n defaultValue: arrowDown,\n },\n },\n },\n overrides\n );\n}\n"],"names":["pickAriaComponentVariants","React","PopoverContext","TooltipContext","OverlayArrow","makeComponentName","registerComponentHelper","arrowDown"],"mappings":";;;;;;;;;;;;;;AAmBA,MAAM,sBAAyB,GAAA;AAAA;AAAA,EAE7B,cAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AACF,CAAA,CAAA;AAMA,MAAM,EAAE,QAAU,EAAA,kBAAA,EAAuB,GAAAA,sCAAA;AAAA,EACvC,sBAAA;AACF,CAAA,CAAA;AAEO,SAAS,gBAAiB,CAAA;AAAA,EAC/B,QAAA;AAAA,EACA,oBAAA;AAAA,EACA,SAAA;AACF,CAA0B,EAAA;AACxB,EAAM,MAAA,cAAA,GAAiBC,sBAAM,CAAA,UAAA,CAAWC,kCAAc,CAAA,CAAA;AACtD,EAAM,MAAA,cAAA,GAAiBD,sBAAM,CAAA,UAAA,CAAWE,kCAAc,CAAA,CAAA;AACtD,EAAM,MAAA,YAAA,GAAe,CAAC,cAAA,IAAkB,CAAC,cAAA,CAAA;AACzC,EAAA,MAAM,YACJ,mBAAAF,sBAAA,CAAA,aAAA,CAACG,gCAAa,EAAA,EAAA,KAAA,EAAO,EAAE,UAAA,EAAY,GAAI,EAAA,EAAG,SACvC,EAAA,EAAA,CAAC,EAAE,SAAA,EACF,KAAA,kBAAA;AAAA,gGACK,QAAS,CAAA;AAAA,IACZ;AAAA,MACE,cAAc,SAAc,KAAA,KAAA;AAAA,MAC5B,eAAe,SAAc,KAAA,MAAA;AAAA,MAC7B,gBAAgB,SAAc,KAAA,OAAA;AAAA,KAChC;AAAA,IACA,oBAAA;AAAA,GAGN,CAAA,CAAA;AAEF,EAAA,IAAI,YAAc,EAAA;AAChB,IAAA,4DAAQ,KAAI,EAAA,EAAA,KAAA,EAAO,EAAE,QAAU,EAAA,UAAA,MAAe,YAAa,CAAA,CAAA;AAAA,GAC7D;AACA,EAAO,OAAA,YAAA,CAAA;AACT,CAAA;AAEa,MAAA,4BAAA,GAA+BC,wBAAkB,cAAc,EAAA;AAE5D,SAAA,oBAAA,CACd,QACA,SACA,EAAA;AACA,EAAO,OAAAC,6BAAA;AAAA,IACL,MAAA;AAAA,IACA,gBAAA;AAAA,IACA;AAAA,MACE,IAAM,EAAA,4BAAA;AAAA,MACN,WAAa,EAAA,oBAAA;AAAA,MACb,UAAY,EAAA,qDAAA;AAAA,MACZ,UAAY,EAAA,kBAAA;AAAA,MACZ,aAAe,EAAA,KAAA;AAAA,MACf,QAAA;AAAA,MACA,KAAO,EAAA;AAAA,QACL,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,MAAA;AAAA,UACN,YAAc,EAAAC,gBAAA;AAAA,SAChB;AAAA,OACF;AAAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { OverlayArrowProps } from "react-aria-components";
|
|
3
|
+
import { CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
4
|
+
import { WithVariants } from "./variant-utils";
|
|
5
|
+
declare const OVERLAY_ARROW_VARIANTS: ("placementLeft" | "placementRight" | "placementTop")[];
|
|
6
|
+
export interface BaseOverlayArrowProps extends OverlayArrowProps, WithVariants<typeof OVERLAY_ARROW_VARIANTS> {
|
|
7
|
+
}
|
|
8
|
+
export declare function BaseOverlayArrow({ children, plasmicUpdateVariant, className, }: BaseOverlayArrowProps): React.JSX.Element;
|
|
9
|
+
export declare const OVERLAY_ARROW_COMPONENT_NAME: string;
|
|
10
|
+
export declare function registerOverlayArrow(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BaseOverlayArrow>): import("@plasmicapp/host").CodeComponentMeta<BaseOverlayArrowProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PopoverContext, TooltipContext, OverlayArrow } from 'react-aria-components';
|
|
3
|
+
import { a as arrowDown } from './common-7ecf439d.esm.js';
|
|
4
|
+
import { a as makeComponentName, r as registerComponentHelper } from './utils-41b3d43b.esm.js';
|
|
5
|
+
import { p as pickAriaComponentVariants } from './variant-utils-4405ebb0.esm.js';
|
|
6
|
+
import '@plasmicapp/host';
|
|
7
|
+
import '@plasmicapp/host/registerComponent';
|
|
8
|
+
|
|
9
|
+
const OVERLAY_ARROW_VARIANTS = [
|
|
10
|
+
// We do not offer a placementDown variant, because that's the default placement (an overlay arrow always has [data-placement=bottom] if it's not explicitly set)
|
|
11
|
+
"placementTop",
|
|
12
|
+
"placementLeft",
|
|
13
|
+
"placementRight"
|
|
14
|
+
];
|
|
15
|
+
const { variants, withObservedValues } = pickAriaComponentVariants(
|
|
16
|
+
OVERLAY_ARROW_VARIANTS
|
|
17
|
+
);
|
|
18
|
+
function BaseOverlayArrow({
|
|
19
|
+
children,
|
|
20
|
+
plasmicUpdateVariant,
|
|
21
|
+
className
|
|
22
|
+
}) {
|
|
23
|
+
const popoverContext = React.useContext(PopoverContext);
|
|
24
|
+
const tooltipContext = React.useContext(TooltipContext);
|
|
25
|
+
const isStandalone = !popoverContext && !tooltipContext;
|
|
26
|
+
const overlayArrow = /* @__PURE__ */ React.createElement(OverlayArrow, { style: { lineHeight: "0" }, className }, ({ placement }) => withObservedValues(
|
|
27
|
+
/* @__PURE__ */ React.createElement(React.Fragment, null, children),
|
|
28
|
+
{
|
|
29
|
+
placementTop: placement === "top",
|
|
30
|
+
placementLeft: placement === "left",
|
|
31
|
+
placementRight: placement === "right"
|
|
32
|
+
},
|
|
33
|
+
plasmicUpdateVariant
|
|
34
|
+
));
|
|
35
|
+
if (isStandalone) {
|
|
36
|
+
return /* @__PURE__ */ React.createElement("div", { style: { position: "relative" } }, overlayArrow);
|
|
37
|
+
}
|
|
38
|
+
return overlayArrow;
|
|
39
|
+
}
|
|
40
|
+
const OVERLAY_ARROW_COMPONENT_NAME = makeComponentName("overlayArrow");
|
|
41
|
+
function registerOverlayArrow(loader, overrides) {
|
|
42
|
+
return registerComponentHelper(
|
|
43
|
+
loader,
|
|
44
|
+
BaseOverlayArrow,
|
|
45
|
+
{
|
|
46
|
+
name: OVERLAY_ARROW_COMPONENT_NAME,
|
|
47
|
+
displayName: "Aria Overlay Arrow",
|
|
48
|
+
importPath: "@plasmicpkgs/react-aria/skinny/registerOverlayArrow",
|
|
49
|
+
importName: "BaseOverlayArrow",
|
|
50
|
+
styleSections: false,
|
|
51
|
+
variants,
|
|
52
|
+
props: {
|
|
53
|
+
children: {
|
|
54
|
+
type: "slot",
|
|
55
|
+
defaultValue: arrowDown
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
overrides
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { BaseOverlayArrow, OVERLAY_ARROW_COMPONENT_NAME, registerOverlayArrow };
|
|
64
|
+
//# sourceMappingURL=registerOverlayArrow.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerOverlayArrow.esm.js","sources":["../src/registerOverlayArrow.tsx"],"sourcesContent":["import React from \"react\";\nimport type {\n OverlayArrowProps,\n OverlayArrowRenderProps,\n} from \"react-aria-components\";\nimport {\n OverlayArrow,\n PopoverContext,\n TooltipContext,\n} from \"react-aria-components\";\nimport { arrowDown } from \"./common\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst OVERLAY_ARROW_VARIANTS = [\n // We do not offer a placementDown variant, because that's the default placement (an overlay arrow always has [data-placement=bottom] if it's not explicitly set)\n \"placementTop\" as const,\n \"placementLeft\" as const,\n \"placementRight\" as const,\n];\n\nexport interface BaseOverlayArrowProps\n extends OverlayArrowProps,\n WithVariants<typeof OVERLAY_ARROW_VARIANTS> {}\n\nconst { variants, withObservedValues } = pickAriaComponentVariants(\n OVERLAY_ARROW_VARIANTS\n);\n\nexport function BaseOverlayArrow({\n children,\n plasmicUpdateVariant,\n className,\n}: BaseOverlayArrowProps) {\n const popoverContext = React.useContext(PopoverContext);\n const tooltipContext = React.useContext(TooltipContext);\n const isStandalone = !popoverContext && !tooltipContext; // i.e. without a trigger to point to\n const overlayArrow = (\n <OverlayArrow style={{ lineHeight: \"0\" }} className={className}>\n {({ placement }: OverlayArrowRenderProps) =>\n withObservedValues(\n <>{children}</>,\n {\n placementTop: placement === \"top\",\n placementLeft: placement === \"left\",\n placementRight: placement === \"right\",\n },\n plasmicUpdateVariant\n )\n }\n </OverlayArrow>\n );\n if (isStandalone) {\n return <div style={{ position: \"relative\" }}>{overlayArrow}</div>;\n }\n return overlayArrow;\n}\n\nexport const OVERLAY_ARROW_COMPONENT_NAME = makeComponentName(\"overlayArrow\");\n\nexport function registerOverlayArrow(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseOverlayArrow>\n) {\n return registerComponentHelper(\n loader,\n BaseOverlayArrow,\n {\n name: OVERLAY_ARROW_COMPONENT_NAME,\n displayName: \"Aria Overlay Arrow\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerOverlayArrow\",\n importName: \"BaseOverlayArrow\",\n styleSections: false,\n variants,\n props: {\n children: {\n type: \"slot\",\n defaultValue: arrowDown,\n },\n },\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAmBA,MAAM,sBAAyB,GAAA;AAAA;AAAA,EAE7B,cAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AACF,CAAA,CAAA;AAMA,MAAM,EAAE,QAAU,EAAA,kBAAA,EAAuB,GAAA,yBAAA;AAAA,EACvC,sBAAA;AACF,CAAA,CAAA;AAEO,SAAS,gBAAiB,CAAA;AAAA,EAC/B,QAAA;AAAA,EACA,oBAAA;AAAA,EACA,SAAA;AACF,CAA0B,EAAA;AACxB,EAAM,MAAA,cAAA,GAAiB,KAAM,CAAA,UAAA,CAAW,cAAc,CAAA,CAAA;AACtD,EAAM,MAAA,cAAA,GAAiB,KAAM,CAAA,UAAA,CAAW,cAAc,CAAA,CAAA;AACtD,EAAM,MAAA,YAAA,GAAe,CAAC,cAAA,IAAkB,CAAC,cAAA,CAAA;AACzC,EAAA,MAAM,YACJ,mBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,EAAA,KAAA,EAAO,EAAE,UAAA,EAAY,GAAI,EAAA,EAAG,SACvC,EAAA,EAAA,CAAC,EAAE,SAAA,EACF,KAAA,kBAAA;AAAA,8DACK,QAAS,CAAA;AAAA,IACZ;AAAA,MACE,cAAc,SAAc,KAAA,KAAA;AAAA,MAC5B,eAAe,SAAc,KAAA,MAAA;AAAA,MAC7B,gBAAgB,SAAc,KAAA,OAAA;AAAA,KAChC;AAAA,IACA,oBAAA;AAAA,GAGN,CAAA,CAAA;AAEF,EAAA,IAAI,YAAc,EAAA;AAChB,IAAA,2CAAQ,KAAI,EAAA,EAAA,KAAA,EAAO,EAAE,QAAU,EAAA,UAAA,MAAe,YAAa,CAAA,CAAA;AAAA,GAC7D;AACA,EAAO,OAAA,YAAA,CAAA;AACT,CAAA;AAEa,MAAA,4BAAA,GAA+B,kBAAkB,cAAc,EAAA;AAE5D,SAAA,oBAAA,CACd,QACA,SACA,EAAA;AACA,EAAO,OAAA,uBAAA;AAAA,IACL,MAAA;AAAA,IACA,gBAAA;AAAA,IACA;AAAA,MACE,IAAM,EAAA,4BAAA;AAAA,MACN,WAAa,EAAA,oBAAA;AAAA,MACb,UAAY,EAAA,qDAAA;AAAA,MACZ,UAAY,EAAA,kBAAA;AAAA,MACZ,aAAe,EAAA,KAAA;AAAA,MACf,QAAA;AAAA,MACA,KAAO,EAAA;AAAA,QACL,QAAU,EAAA;AAAA,UACR,IAAM,EAAA,MAAA;AAAA,UACN,YAAc,EAAA,SAAA;AAAA,SAChB;AAAA,OACF;AAAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -4,6 +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 common = require('./common-47e48033.cjs.js');
|
|
7
8
|
var contexts = require('./contexts-6d0cb2b1.cjs.js');
|
|
8
9
|
var utils$1 = require('./utils-d1c8094f.cjs.js');
|
|
9
10
|
var variantUtils = require('./variant-utils-0ad70db8.cjs.js');
|
|
@@ -105,18 +106,6 @@ function BasePopover(props) {
|
|
|
105
106
|
));
|
|
106
107
|
}
|
|
107
108
|
const POPOVER_COMPONENT_NAME = utils$1.makeComponentName("popover");
|
|
108
|
-
const POPOVER_ARROW_IMG = {
|
|
109
|
-
type: "img",
|
|
110
|
-
src: "https://static1.plasmic.app/arrow-up.svg",
|
|
111
|
-
styles: {
|
|
112
|
-
position: "absolute",
|
|
113
|
-
top: "-14px",
|
|
114
|
-
// center the arrow horizontally on the popover
|
|
115
|
-
left: "50%",
|
|
116
|
-
transform: "translateX(-50%)",
|
|
117
|
-
width: "15px"
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
109
|
function registerPopover(loader, overrides) {
|
|
121
110
|
utils$1.registerComponentHelper(
|
|
122
111
|
loader,
|
|
@@ -131,21 +120,19 @@ function registerPopover(loader, overrides) {
|
|
|
131
120
|
borderWidth: "1px",
|
|
132
121
|
borderStyle: "solid",
|
|
133
122
|
borderColor: "black",
|
|
134
|
-
padding: "20px",
|
|
135
123
|
width: "300px",
|
|
136
124
|
backgroundColor: "#FDE3C3"
|
|
137
125
|
},
|
|
138
|
-
props: {
|
|
126
|
+
props: __spreadValues({
|
|
139
127
|
children: {
|
|
140
128
|
type: "slot",
|
|
141
129
|
mergeWithParent: true,
|
|
142
130
|
defaultValue: [
|
|
143
|
-
POPOVER_ARROW_IMG,
|
|
144
131
|
{
|
|
145
132
|
type: "vbox",
|
|
146
133
|
styles: {
|
|
147
134
|
width: "stretch",
|
|
148
|
-
padding:
|
|
135
|
+
padding: "20px",
|
|
149
136
|
rowGap: "10px"
|
|
150
137
|
},
|
|
151
138
|
children: [
|
|
@@ -168,29 +155,11 @@ function registerPopover(loader, overrides) {
|
|
|
168
155
|
}
|
|
169
156
|
]
|
|
170
157
|
},
|
|
171
|
-
offset: {
|
|
172
|
-
type: "number",
|
|
173
|
-
displayName: "Offset",
|
|
174
|
-
description: "Additional offset applied vertically between the popover and its trigger",
|
|
175
|
-
defaultValueHint: 8
|
|
176
|
-
},
|
|
177
158
|
shouldFlip: {
|
|
178
159
|
type: "boolean",
|
|
179
160
|
description: "Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.",
|
|
180
161
|
defaultValueHint: true
|
|
181
162
|
},
|
|
182
|
-
placement: {
|
|
183
|
-
type: "choice",
|
|
184
|
-
description: "Default placement of the popover relative to the trigger, if there is enough space",
|
|
185
|
-
defaultValueHint: "bottom",
|
|
186
|
-
options: [
|
|
187
|
-
// Not allowing other placement options here because of https://github.com/adobe/react-spectrum/issues/6825
|
|
188
|
-
"top",
|
|
189
|
-
"bottom",
|
|
190
|
-
"left",
|
|
191
|
-
"right"
|
|
192
|
-
]
|
|
193
|
-
},
|
|
194
163
|
resetClassName: {
|
|
195
164
|
type: "themeResetClass"
|
|
196
165
|
},
|
|
@@ -199,7 +168,12 @@ function registerPopover(loader, overrides) {
|
|
|
199
168
|
defaultValue: true,
|
|
200
169
|
hidden: (_props, ctx) => !(ctx == null ? void 0 : ctx.canMatchTriggerWidth)
|
|
201
170
|
}
|
|
202
|
-
},
|
|
171
|
+
}, common.getCommonOverlayProps("popover", {
|
|
172
|
+
placement: { defaultValueHint: "bottom" },
|
|
173
|
+
offset: { defaultValueHint: 8 },
|
|
174
|
+
containerPadding: { defaultValueHint: 12 },
|
|
175
|
+
crossOffset: { defaultValueHint: 0 }
|
|
176
|
+
})),
|
|
203
177
|
// 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.
|
|
204
178
|
styleSections: true,
|
|
205
179
|
trapsFocus: true
|
|
@@ -209,7 +183,6 @@ function registerPopover(loader, overrides) {
|
|
|
209
183
|
}
|
|
210
184
|
|
|
211
185
|
exports.BasePopover = BasePopover;
|
|
212
|
-
exports.POPOVER_ARROW_IMG = POPOVER_ARROW_IMG;
|
|
213
186
|
exports.POPOVER_COMPONENT_NAME = POPOVER_COMPONENT_NAME;
|
|
214
187
|
exports.registerPopover = registerPopover;
|
|
215
188
|
//# sourceMappingURL=registerPopover.cjs.js.map
|
|
@@ -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, { 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;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AAAA,QACA,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,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 { usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React, { useEffect } from \"react\";\nimport { Popover, PopoverContext } from \"react-aria-components\";\nimport { 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 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\");\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","makeComponentName","registerComponentHelper","getCommonOverlayProps"],"mappings":";;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AAK,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,4 +1,3 @@
|
|
|
1
|
-
import { PlasmicElement } from "@plasmicapp/host";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { Popover } from "react-aria-components";
|
|
4
3
|
import { CodeComponentMetaOverrides, HasControlContextData, Registerable } from "./utils";
|
|
@@ -15,6 +14,5 @@ export interface BasePopoverProps extends React.ComponentProps<typeof Popover>,
|
|
|
15
14
|
}
|
|
16
15
|
export declare function BasePopover(props: BasePopoverProps): React.JSX.Element;
|
|
17
16
|
export declare const POPOVER_COMPONENT_NAME: string;
|
|
18
|
-
export declare const POPOVER_ARROW_IMG: PlasmicElement;
|
|
19
17
|
export declare function registerPopover(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BasePopover>): void;
|
|
20
18
|
export {};
|
|
@@ -2,6 +2,7 @@ import { usePlasmicCanvasContext } from '@plasmicapp/host';
|
|
|
2
2
|
import { mergeProps } from '@react-aria/utils';
|
|
3
3
|
import React, { useEffect } from 'react';
|
|
4
4
|
import { PopoverContext, Popover } from 'react-aria-components';
|
|
5
|
+
import { b as getCommonOverlayProps } from './common-7ecf439d.esm.js';
|
|
5
6
|
import { a as PlasmicPopoverTriggerContext } from './contexts-5cb81c2f.esm.js';
|
|
6
7
|
import { a as makeComponentName, r as registerComponentHelper } from './utils-41b3d43b.esm.js';
|
|
7
8
|
import { p as pickAriaComponentVariants } from './variant-utils-4405ebb0.esm.js';
|
|
@@ -99,18 +100,6 @@ function BasePopover(props) {
|
|
|
99
100
|
));
|
|
100
101
|
}
|
|
101
102
|
const POPOVER_COMPONENT_NAME = makeComponentName("popover");
|
|
102
|
-
const POPOVER_ARROW_IMG = {
|
|
103
|
-
type: "img",
|
|
104
|
-
src: "https://static1.plasmic.app/arrow-up.svg",
|
|
105
|
-
styles: {
|
|
106
|
-
position: "absolute",
|
|
107
|
-
top: "-14px",
|
|
108
|
-
// center the arrow horizontally on the popover
|
|
109
|
-
left: "50%",
|
|
110
|
-
transform: "translateX(-50%)",
|
|
111
|
-
width: "15px"
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
103
|
function registerPopover(loader, overrides) {
|
|
115
104
|
registerComponentHelper(
|
|
116
105
|
loader,
|
|
@@ -125,21 +114,19 @@ function registerPopover(loader, overrides) {
|
|
|
125
114
|
borderWidth: "1px",
|
|
126
115
|
borderStyle: "solid",
|
|
127
116
|
borderColor: "black",
|
|
128
|
-
padding: "20px",
|
|
129
117
|
width: "300px",
|
|
130
118
|
backgroundColor: "#FDE3C3"
|
|
131
119
|
},
|
|
132
|
-
props: {
|
|
120
|
+
props: __spreadValues({
|
|
133
121
|
children: {
|
|
134
122
|
type: "slot",
|
|
135
123
|
mergeWithParent: true,
|
|
136
124
|
defaultValue: [
|
|
137
|
-
POPOVER_ARROW_IMG,
|
|
138
125
|
{
|
|
139
126
|
type: "vbox",
|
|
140
127
|
styles: {
|
|
141
128
|
width: "stretch",
|
|
142
|
-
padding:
|
|
129
|
+
padding: "20px",
|
|
143
130
|
rowGap: "10px"
|
|
144
131
|
},
|
|
145
132
|
children: [
|
|
@@ -162,29 +149,11 @@ function registerPopover(loader, overrides) {
|
|
|
162
149
|
}
|
|
163
150
|
]
|
|
164
151
|
},
|
|
165
|
-
offset: {
|
|
166
|
-
type: "number",
|
|
167
|
-
displayName: "Offset",
|
|
168
|
-
description: "Additional offset applied vertically between the popover and its trigger",
|
|
169
|
-
defaultValueHint: 8
|
|
170
|
-
},
|
|
171
152
|
shouldFlip: {
|
|
172
153
|
type: "boolean",
|
|
173
154
|
description: "Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.",
|
|
174
155
|
defaultValueHint: true
|
|
175
156
|
},
|
|
176
|
-
placement: {
|
|
177
|
-
type: "choice",
|
|
178
|
-
description: "Default placement of the popover relative to the trigger, if there is enough space",
|
|
179
|
-
defaultValueHint: "bottom",
|
|
180
|
-
options: [
|
|
181
|
-
// Not allowing other placement options here because of https://github.com/adobe/react-spectrum/issues/6825
|
|
182
|
-
"top",
|
|
183
|
-
"bottom",
|
|
184
|
-
"left",
|
|
185
|
-
"right"
|
|
186
|
-
]
|
|
187
|
-
},
|
|
188
157
|
resetClassName: {
|
|
189
158
|
type: "themeResetClass"
|
|
190
159
|
},
|
|
@@ -193,7 +162,12 @@ function registerPopover(loader, overrides) {
|
|
|
193
162
|
defaultValue: true,
|
|
194
163
|
hidden: (_props, ctx) => !(ctx == null ? void 0 : ctx.canMatchTriggerWidth)
|
|
195
164
|
}
|
|
196
|
-
},
|
|
165
|
+
}, getCommonOverlayProps("popover", {
|
|
166
|
+
placement: { defaultValueHint: "bottom" },
|
|
167
|
+
offset: { defaultValueHint: 8 },
|
|
168
|
+
containerPadding: { defaultValueHint: 12 },
|
|
169
|
+
crossOffset: { defaultValueHint: 0 }
|
|
170
|
+
})),
|
|
197
171
|
// 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.
|
|
198
172
|
styleSections: true,
|
|
199
173
|
trapsFocus: true
|
|
@@ -202,5 +176,5 @@ function registerPopover(loader, overrides) {
|
|
|
202
176
|
);
|
|
203
177
|
}
|
|
204
178
|
|
|
205
|
-
export { BasePopover,
|
|
179
|
+
export { BasePopover, POPOVER_COMPONENT_NAME, registerPopover };
|
|
206
180
|
//# sourceMappingURL=registerPopover.esm.js.map
|