@plasmicpkgs/react-aria 0.0.63 → 0.0.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/react-aria.esm.js +88 -66
- package/dist/react-aria.esm.js.map +1 -1
- package/dist/react-aria.js +87 -65
- package/dist/react-aria.js.map +1 -1
- package/dist/registerDialogTrigger.d.ts +2 -2
- package/dist/registerSelect.d.ts +0 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +2 -2
- package/skinny/registerComboBox.cjs.js +19 -2
- package/skinny/registerComboBox.cjs.js.map +1 -1
- package/skinny/registerComboBox.esm.js +20 -3
- package/skinny/registerComboBox.esm.js.map +1 -1
- package/skinny/registerDialogTrigger.cjs.js +12 -3
- package/skinny/registerDialogTrigger.cjs.js.map +1 -1
- package/skinny/registerDialogTrigger.d.ts +2 -2
- package/skinny/registerDialogTrigger.esm.js +12 -3
- package/skinny/registerDialogTrigger.esm.js.map +1 -1
- package/skinny/registerModal.cjs.js +4 -2
- package/skinny/registerModal.cjs.js.map +1 -1
- package/skinny/registerModal.esm.js +5 -3
- package/skinny/registerModal.esm.js.map +1 -1
- package/skinny/registerPopover.cjs.js +5 -0
- package/skinny/registerPopover.cjs.js.map +1 -1
- package/skinny/registerPopover.esm.js +5 -0
- package/skinny/registerPopover.esm.js.map +1 -1
- package/skinny/registerSelect.cjs.js +5 -12
- package/skinny/registerSelect.cjs.js.map +1 -1
- package/skinny/registerSelect.d.ts +0 -1
- package/skinny/registerSelect.esm.js +6 -13
- package/skinny/registerSelect.esm.js.map +1 -1
- package/skinny/registerTooltip.cjs.js +7 -10
- package/skinny/registerTooltip.cjs.js.map +1 -1
- package/skinny/registerTooltip.esm.js +7 -10
- package/skinny/registerTooltip.esm.js.map +1 -1
- package/skinny/utils-8dbb4d1f.cjs.js.map +1 -1
- package/skinny/utils-c7662a47.esm.js.map +1 -1
- package/skinny/utils.d.ts +1 -1
|
@@ -64,6 +64,10 @@ function BasePopover(props) {
|
|
|
64
64
|
isStandalone ? {
|
|
65
65
|
triggerRef,
|
|
66
66
|
isNonModal: true,
|
|
67
|
+
/**
|
|
68
|
+
* 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
|
|
69
|
+
* In component view, we never want to start with an empty artboard, so isOpen has to be true
|
|
70
|
+
* */
|
|
67
71
|
isOpen: true
|
|
68
72
|
} : null
|
|
69
73
|
);
|
|
@@ -163,6 +167,7 @@ function registerPopover(loader, overrides) {
|
|
|
163
167
|
type: "themeResetClass"
|
|
164
168
|
}
|
|
165
169
|
},
|
|
170
|
+
// 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.
|
|
166
171
|
styleSections: true,
|
|
167
172
|
trapsFocus: true
|
|
168
173
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerPopover.cjs.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { PlasmicElement, usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Popover, PopoverContext } from \"react-aria-components\";\nimport { PlasmicPopoverContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface PopoverControlContextData {\n defaultShouldFlip?: boolean;\n}\n\nexport interface BasePopoverProps\n extends React.ComponentProps<typeof Popover>,\n HasControlContextData<PopoverControlContextData> {\n className?: string;\n resetClassName?: string;\n defaultShouldFlip?: boolean;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const { resetClassName, setControlContextData, ...restProps } = props;\n const isStandalone = !React.useContext(PopoverContext);\n const context = React.useContext(PlasmicPopoverContext);\n const triggerRef = React.useRef<any>(null);\n const isEditMode = !!usePlasmicCanvasContext();\n\n const mergedProps = mergeProps(\n {\n isOpen: context?.isOpen,\n shouldFlip: context?.defaultShouldFlip,\n },\n /**\n * isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies. *\n *\n * Setting isNonModal to true in edit mode (canvas) means that the popover will not prevent the user from interacting with the canvas while the popover is open.\n */\n isEditMode ? { isNonModal: true } : null,\n restProps,\n { className: `${resetClassName}` },\n // Override some props if the popover is standalone\n isStandalone\n ? {\n triggerRef,\n isNonModal: true,\n isOpen: true,\n }\n : null\n );\n\n setControlContextData?.({\n defaultShouldFlip: context?.defaultShouldFlip ?? true,\n });\n\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover {...mergedProps} />\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 defaultStyles: {\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n padding: \"20px\",\n width: \"300px\",\n backgroundColor: \"#FDE3C3\",\n },\n props: {\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n POPOVER_ARROW_IMG,\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: 0,\n rowGap: \"10px\",\n },\n children: [\n {\n type: \"text\",\n value: \"This is a Popover!\",\n },\n {\n type: \"text\",\n value: \"You can put anything you can imagine here!\",\n styles: {\n fontWeight: 500,\n },\n },\n {\n type: \"text\",\n value:\n \"Use it in a `Aria Dialog Trigger` component to trigger it on a button click!\",\n },\n ],\n },\n ],\n },\n offset: {\n type: \"number\",\n displayName: \"Offset\",\n description:\n \"Additional offset applied vertically between the popover and its trigger\",\n defaultValueHint: 8,\n },\n shouldFlip: {\n type: \"boolean\",\n description:\n \"Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.\",\n defaultValueHint: (_props, ctx) => ctx?.defaultShouldFlip,\n },\n placement: {\n type: \"choice\",\n description:\n \"Default placement of the popover relative to the trigger, if there is enough space\",\n defaultValueHint: \"bottom\",\n options: [\n \"bottom\",\n \"bottom left\",\n \"bottom right\",\n \"top\",\n \"top left\",\n \"top right\",\n ],\n },\n resetClassName: {\n type: \"themeResetClass\",\n },\n },\n styleSections: true,\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["React","PopoverContext","PlasmicPopoverContext","usePlasmicCanvasContext","mergeProps","Popover","makeComponentName","registerComponentHelper"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,SAAS,YAAY,KAAyB,EAAA;AAzBrD,EAAA,IAAA,EAAA,CAAA;AA0BE,EAAgE,MAAA,EAAA,GAAA,KAAA,EAAxD,kBAAgB,qBA1B1B,EAAA,GA0BkE,IAAd,SAAc,GAAA,SAAA,CAAA,EAAA,EAAd,CAA1C,gBAAgB,EAAA,uBAAA,CAAA,CAAA,CAAA;
|
|
1
|
+
{"version":3,"file":"registerPopover.cjs.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { PlasmicElement, usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Popover, PopoverContext } from \"react-aria-components\";\nimport { PlasmicPopoverContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface PopoverControlContextData {\n defaultShouldFlip?: boolean;\n}\n\nexport interface BasePopoverProps\n extends React.ComponentProps<typeof Popover>,\n HasControlContextData<PopoverControlContextData> {\n className?: string;\n resetClassName?: string;\n defaultShouldFlip?: boolean;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const { resetClassName, setControlContextData, ...restProps } = props;\n // Popover can be inside DialogTrigger, Select, Combobox, etc. So we can't just use a particular context like DialogTrigger (like we do in Modal) to decide if it is standalone\n const isStandalone = !React.useContext(PopoverContext);\n const context = React.useContext(PlasmicPopoverContext);\n const triggerRef = React.useRef<any>(null);\n const isEditMode = !!usePlasmicCanvasContext();\n\n const mergedProps = mergeProps(\n {\n isOpen: context?.isOpen,\n shouldFlip: context?.defaultShouldFlip,\n },\n /**\n * isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies. *\n *\n * Setting isNonModal to true in edit mode (canvas) means that the popover will not prevent the user from interacting with the canvas while the popover is open.\n */\n isEditMode ? { isNonModal: true } : null,\n restProps,\n { className: `${resetClassName}` },\n // Override some props if the popover is standalone\n isStandalone\n ? {\n triggerRef,\n isNonModal: true,\n /**\n * Always true, because we assume that popover is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc, and its only really standalone in component view\n * In component view, we never want to start with an empty artboard, so isOpen has to be true\n * */\n\n isOpen: true,\n }\n : null\n );\n\n setControlContextData?.({\n defaultShouldFlip: context?.defaultShouldFlip ?? true,\n });\n\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover {...mergedProps} />\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 defaultStyles: {\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n padding: \"20px\",\n width: \"300px\",\n backgroundColor: \"#FDE3C3\",\n },\n props: {\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n POPOVER_ARROW_IMG,\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: 0,\n rowGap: \"10px\",\n },\n children: [\n {\n type: \"text\",\n value: \"This is a Popover!\",\n },\n {\n type: \"text\",\n value: \"You can put anything you can imagine here!\",\n styles: {\n fontWeight: 500,\n },\n },\n {\n type: \"text\",\n value:\n \"Use it in a `Aria Dialog Trigger` component to trigger it on a button click!\",\n },\n ],\n },\n ],\n },\n offset: {\n type: \"number\",\n displayName: \"Offset\",\n description:\n \"Additional offset applied vertically between the popover and its trigger\",\n defaultValueHint: 8,\n },\n shouldFlip: {\n type: \"boolean\",\n description:\n \"Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.\",\n defaultValueHint: (_props, ctx) => ctx?.defaultShouldFlip,\n },\n placement: {\n type: \"choice\",\n description:\n \"Default placement of the popover relative to the trigger, if there is enough space\",\n defaultValueHint: \"bottom\",\n options: [\n \"bottom\",\n \"bottom left\",\n \"bottom right\",\n \"top\",\n \"top left\",\n \"top 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":["React","PopoverContext","PlasmicPopoverContext","usePlasmicCanvasContext","mergeProps","Popover","makeComponentName","registerComponentHelper"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,SAA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ACF;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;;;;;;;"}
|
|
@@ -58,6 +58,10 @@ function BasePopover(props) {
|
|
|
58
58
|
isStandalone ? {
|
|
59
59
|
triggerRef,
|
|
60
60
|
isNonModal: true,
|
|
61
|
+
/**
|
|
62
|
+
* 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
|
|
63
|
+
* In component view, we never want to start with an empty artboard, so isOpen has to be true
|
|
64
|
+
* */
|
|
61
65
|
isOpen: true
|
|
62
66
|
} : null
|
|
63
67
|
);
|
|
@@ -157,6 +161,7 @@ function registerPopover(loader, overrides) {
|
|
|
157
161
|
type: "themeResetClass"
|
|
158
162
|
}
|
|
159
163
|
},
|
|
164
|
+
// 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.
|
|
160
165
|
styleSections: true,
|
|
161
166
|
trapsFocus: true
|
|
162
167
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerPopover.esm.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { PlasmicElement, usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Popover, PopoverContext } from \"react-aria-components\";\nimport { PlasmicPopoverContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface PopoverControlContextData {\n defaultShouldFlip?: boolean;\n}\n\nexport interface BasePopoverProps\n extends React.ComponentProps<typeof Popover>,\n HasControlContextData<PopoverControlContextData> {\n className?: string;\n resetClassName?: string;\n defaultShouldFlip?: boolean;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const { resetClassName, setControlContextData, ...restProps } = props;\n const isStandalone = !React.useContext(PopoverContext);\n const context = React.useContext(PlasmicPopoverContext);\n const triggerRef = React.useRef<any>(null);\n const isEditMode = !!usePlasmicCanvasContext();\n\n const mergedProps = mergeProps(\n {\n isOpen: context?.isOpen,\n shouldFlip: context?.defaultShouldFlip,\n },\n /**\n * isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies. *\n *\n * Setting isNonModal to true in edit mode (canvas) means that the popover will not prevent the user from interacting with the canvas while the popover is open.\n */\n isEditMode ? { isNonModal: true } : null,\n restProps,\n { className: `${resetClassName}` },\n // Override some props if the popover is standalone\n isStandalone\n ? {\n triggerRef,\n isNonModal: true,\n isOpen: true,\n }\n : null\n );\n\n setControlContextData?.({\n defaultShouldFlip: context?.defaultShouldFlip ?? true,\n });\n\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover {...mergedProps} />\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 defaultStyles: {\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n padding: \"20px\",\n width: \"300px\",\n backgroundColor: \"#FDE3C3\",\n },\n props: {\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n POPOVER_ARROW_IMG,\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: 0,\n rowGap: \"10px\",\n },\n children: [\n {\n type: \"text\",\n value: \"This is a Popover!\",\n },\n {\n type: \"text\",\n value: \"You can put anything you can imagine here!\",\n styles: {\n fontWeight: 500,\n },\n },\n {\n type: \"text\",\n value:\n \"Use it in a `Aria Dialog Trigger` component to trigger it on a button click!\",\n },\n ],\n },\n ],\n },\n offset: {\n type: \"number\",\n displayName: \"Offset\",\n description:\n \"Additional offset applied vertically between the popover and its trigger\",\n defaultValueHint: 8,\n },\n shouldFlip: {\n type: \"boolean\",\n description:\n \"Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.\",\n defaultValueHint: (_props, ctx) => ctx?.defaultShouldFlip,\n },\n placement: {\n type: \"choice\",\n description:\n \"Default placement of the popover relative to the trigger, if there is enough space\",\n defaultValueHint: \"bottom\",\n options: [\n \"bottom\",\n \"bottom left\",\n \"bottom right\",\n \"top\",\n \"top left\",\n \"top right\",\n ],\n },\n resetClassName: {\n type: \"themeResetClass\",\n },\n },\n styleSections: true,\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,SAAS,YAAY,KAAyB,EAAA;AAzBrD,EAAA,IAAA,EAAA,CAAA;AA0BE,EAAgE,MAAA,EAAA,GAAA,KAAA,EAAxD,kBAAgB,qBA1B1B,EAAA,GA0BkE,IAAd,SAAc,GAAA,SAAA,CAAA,EAAA,EAAd,CAA1C,gBAAgB,EAAA,uBAAA,CAAA,CAAA,CAAA;
|
|
1
|
+
{"version":3,"file":"registerPopover.esm.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import { PlasmicElement, usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { Popover, PopoverContext } from \"react-aria-components\";\nimport { PlasmicPopoverContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface PopoverControlContextData {\n defaultShouldFlip?: boolean;\n}\n\nexport interface BasePopoverProps\n extends React.ComponentProps<typeof Popover>,\n HasControlContextData<PopoverControlContextData> {\n className?: string;\n resetClassName?: string;\n defaultShouldFlip?: boolean;\n}\n\nexport function BasePopover(props: BasePopoverProps) {\n const { resetClassName, setControlContextData, ...restProps } = props;\n // Popover can be inside DialogTrigger, Select, Combobox, etc. So we can't just use a particular context like DialogTrigger (like we do in Modal) to decide if it is standalone\n const isStandalone = !React.useContext(PopoverContext);\n const context = React.useContext(PlasmicPopoverContext);\n const triggerRef = React.useRef<any>(null);\n const isEditMode = !!usePlasmicCanvasContext();\n\n const mergedProps = mergeProps(\n {\n isOpen: context?.isOpen,\n shouldFlip: context?.defaultShouldFlip,\n },\n /**\n * isNonModal: Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies. *\n *\n * Setting isNonModal to true in edit mode (canvas) means that the popover will not prevent the user from interacting with the canvas while the popover is open.\n */\n isEditMode ? { isNonModal: true } : null,\n restProps,\n { className: `${resetClassName}` },\n // Override some props if the popover is standalone\n isStandalone\n ? {\n triggerRef,\n isNonModal: true,\n /**\n * Always true, because we assume that popover is always going to be controlled by a parent like Select, Combobox, DialogTrigger, etc, and its only really standalone in component view\n * In component view, we never want to start with an empty artboard, so isOpen has to be true\n * */\n\n isOpen: true,\n }\n : null\n );\n\n setControlContextData?.({\n defaultShouldFlip: context?.defaultShouldFlip ?? true,\n });\n\n return (\n <>\n {isStandalone && <div ref={triggerRef} />}\n <Popover {...mergedProps} />\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 defaultStyles: {\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n padding: \"20px\",\n width: \"300px\",\n backgroundColor: \"#FDE3C3\",\n },\n props: {\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n POPOVER_ARROW_IMG,\n {\n type: \"vbox\",\n styles: {\n width: \"stretch\",\n padding: 0,\n rowGap: \"10px\",\n },\n children: [\n {\n type: \"text\",\n value: \"This is a Popover!\",\n },\n {\n type: \"text\",\n value: \"You can put anything you can imagine here!\",\n styles: {\n fontWeight: 500,\n },\n },\n {\n type: \"text\",\n value:\n \"Use it in a `Aria Dialog Trigger` component to trigger it on a button click!\",\n },\n ],\n },\n ],\n },\n offset: {\n type: \"number\",\n displayName: \"Offset\",\n description:\n \"Additional offset applied vertically between the popover and its trigger\",\n defaultValueHint: 8,\n },\n shouldFlip: {\n type: \"boolean\",\n description:\n \"Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.\",\n defaultValueHint: (_props, ctx) => ctx?.defaultShouldFlip,\n },\n placement: {\n type: \"choice\",\n description:\n \"Default placement of the popover relative to the trigger, if there is enough space\",\n defaultValueHint: \"bottom\",\n options: [\n \"bottom\",\n \"bottom left\",\n \"bottom right\",\n \"top\",\n \"top left\",\n \"top 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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A,YACA,UAAA;AAAA,YACA,WAAA;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;;;;"}
|
|
@@ -47,11 +47,11 @@ const BaseSelectValue = (props) => {
|
|
|
47
47
|
};
|
|
48
48
|
const SELECT_NAME = utils.makeComponentName("select");
|
|
49
49
|
function BaseSelect(props) {
|
|
50
|
+
var _a, _b;
|
|
50
51
|
const {
|
|
51
52
|
selectedKey,
|
|
52
53
|
onSelectionChange,
|
|
53
54
|
placeholder,
|
|
54
|
-
previewOpen,
|
|
55
55
|
onOpenChange,
|
|
56
56
|
isDisabled,
|
|
57
57
|
className,
|
|
@@ -63,8 +63,8 @@ function BaseSelect(props) {
|
|
|
63
63
|
setControlContextData,
|
|
64
64
|
"aria-label": ariaLabel
|
|
65
65
|
} = props;
|
|
66
|
-
const
|
|
67
|
-
const
|
|
66
|
+
const { isSelected } = (_a = host.usePlasmicCanvasComponentInfo(props)) != null ? _a : {};
|
|
67
|
+
const _isOpen = (_b = isSelected || isOpen) != null ? _b : false;
|
|
68
68
|
let idManager = React.useMemo(() => new registerListBox.ListBoxItemIdManager(), []);
|
|
69
69
|
React.useEffect(() => {
|
|
70
70
|
idManager.subscribe((ids) => {
|
|
@@ -86,12 +86,12 @@ function BaseSelect(props) {
|
|
|
86
86
|
name,
|
|
87
87
|
disabledKeys,
|
|
88
88
|
"aria-label": ariaLabel,
|
|
89
|
-
isOpen:
|
|
89
|
+
isOpen: _isOpen
|
|
90
90
|
}, utils.extractPlasmicDataProps(props)),
|
|
91
91
|
/* @__PURE__ */ React__default.default.createElement(
|
|
92
92
|
contexts.PlasmicPopoverContext.Provider,
|
|
93
93
|
{
|
|
94
|
-
value: { isOpen:
|
|
94
|
+
value: { isOpen: _isOpen, defaultShouldFlip: false }
|
|
95
95
|
},
|
|
96
96
|
/* @__PURE__ */ React__default.default.createElement(
|
|
97
97
|
contexts.PlasmicListBoxContext.Provider,
|
|
@@ -172,13 +172,6 @@ function registerSelect(loader) {
|
|
|
172
172
|
multiSelect: true,
|
|
173
173
|
advanced: true
|
|
174
174
|
},
|
|
175
|
-
previewOpen: {
|
|
176
|
-
type: "boolean",
|
|
177
|
-
displayName: "Preview opened?",
|
|
178
|
-
description: "Preview opened state while designing in Plasmic editor",
|
|
179
|
-
editOnly: true,
|
|
180
|
-
defaultValue: false
|
|
181
|
-
},
|
|
182
175
|
isOpen: {
|
|
183
176
|
type: "boolean",
|
|
184
177
|
defaultValue: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerSelect.cjs.js","sources":["../src/registerSelect.tsx"],"sourcesContent":["import { usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport React, { useEffect, useMemo } from \"react\";\nimport { Select, SelectProps, SelectValue } from \"react-aria-components\";\nimport { getCommonProps } from \"./common\";\nimport { PlasmicListBoxContext, PlasmicPopoverContext } from \"./contexts\";\nimport { ListBoxItemIdManager } from \"./ListBoxItemIdManager\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { LABEL_COMPONENT_NAME } from \"./registerLabel\";\nimport { LIST_BOX_COMPONENT_NAME } from \"./registerListBox\";\nimport { POPOVER_COMPONENT_NAME } from \"./registerPopover\";\nimport {\n extractPlasmicDataProps,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseSelectValueProps\n extends React.ComponentProps<typeof SelectValue> {\n customize?: boolean;\n}\n\nexport const BaseSelectValue = (props: BaseSelectValueProps) => {\n const { children, customize } = props;\n return (\n <SelectValue>\n {({ isPlaceholder, selectedText }) => (\n <>\n {isPlaceholder ? (\n <span>Select an item</span>\n ) : (\n <>\n <span>\n {customize ? (children as React.ReactNode) : selectedText}\n </span>\n </>\n )}\n {}\n </>\n )}\n </SelectValue>\n );\n};\n\nconst SELECT_NAME = makeComponentName(\"select\");\n\nexport interface BaseSelectControlContextData {\n itemIds: string[];\n}\n\nexport interface BaseSelectProps\n extends SelectProps<{}>, // NOTE: We don't need generic type here since we don't use items prop (that needs it). We just need to make the type checker happy\n HasControlContextData<BaseSelectControlContextData> {\n previewOpen?: boolean;\n children?: React.ReactNode;\n}\n\nexport function BaseSelect(props: BaseSelectProps) {\n const {\n selectedKey,\n onSelectionChange,\n placeholder,\n previewOpen,\n onOpenChange,\n isDisabled,\n className,\n style,\n children,\n disabledKeys,\n name,\n isOpen,\n setControlContextData,\n \"aria-label\": ariaLabel,\n } = props;\n\n const isEditMode = !!usePlasmicCanvasContext();\n const openProp = isEditMode && previewOpen ? true : isOpen;\n\n let idManager = useMemo(() => new ListBoxItemIdManager(), []);\n\n useEffect(() => {\n idManager.subscribe((ids: string[]) => {\n setControlContextData?.({\n itemIds: ids,\n });\n });\n }, []);\n\n return (\n <Select\n placeholder={placeholder}\n selectedKey={selectedKey}\n onSelectionChange={onSelectionChange}\n onOpenChange={onOpenChange}\n isDisabled={isDisabled}\n className={className}\n style={style}\n name={name}\n disabledKeys={disabledKeys}\n aria-label={ariaLabel}\n isOpen={openProp}\n {...extractPlasmicDataProps(props)}\n >\n <PlasmicPopoverContext.Provider\n value={{ isOpen: openProp, defaultShouldFlip: false }}\n >\n <PlasmicListBoxContext.Provider\n value={{\n idManager,\n }}\n >\n {children}\n </PlasmicListBoxContext.Provider>\n </PlasmicPopoverContext.Provider>\n </Select>\n );\n}\n\nexport function registerSelect(loader?: Registerable) {\n const selectValueMeta = registerComponentHelper(loader, BaseSelectValue, {\n name: makeComponentName(\"select-value\"),\n displayName: \"Aria Selected Value\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSelect\",\n importName: \"BaseSelectValue\",\n parentComponentName: SELECT_NAME,\n props: {\n customize: {\n type: \"boolean\",\n description: \"Whether to customize the selected value display\",\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Selected value...\",\n },\n ],\n hidden: (props) => !props.customize,\n },\n className: {\n type: \"class\",\n selectors: [\n {\n selector: \":self[data-placeholder]\",\n label: \"Placeholder\",\n },\n ],\n },\n },\n trapsFocus: true,\n });\n\n registerComponentHelper(loader, BaseSelect, {\n name: SELECT_NAME,\n displayName: \"Aria Select\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSelect\",\n importName: \"BaseSelect\",\n props: {\n ...getCommonProps<BaseSelectProps>(\"Select\", [\n \"name\",\n \"aria-label\",\n \"placeholder\",\n \"isDisabled\",\n \"autoFocus\",\n ]),\n selectedKey: {\n type: \"choice\",\n description: \"The selected keys of the listbox\",\n editOnly: true,\n uncontrolledProp: \"defaultSelectedKey\",\n displayName: \"Initial selected key\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n // React Aria Select do not support multiple selections yet\n multiSelect: false,\n },\n onSelectionChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"value\", type: \"string\" }],\n },\n disabledKeys: {\n type: \"choice\",\n description:\n \"The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n multiSelect: true,\n advanced: true,\n },\n previewOpen: {\n type: \"boolean\",\n displayName: \"Preview opened?\",\n description: \"Preview opened state while designing in Plasmic editor\",\n editOnly: true,\n defaultValue: false,\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 onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n children: {\n type: \"slot\",\n mergeWithParent: true,\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: \"component\",\n name: BUTTON_COMPONENT_NAME,\n styles: {\n width: \"100%\",\n },\n props: {\n children: {\n type: \"hbox\",\n styles: {\n width: \"stretch\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n padding: \"2px 5px\",\n },\n children: [\n {\n type: \"component\",\n name: selectValueMeta.name,\n },\n {\n type: \"img\",\n src: \"https://static1.plasmic.app/arrow-up.svg\",\n styles: {\n height: \"20px\",\n width: \"20px\",\n transform: \"rotate(180deg)\",\n },\n },\n ],\n },\n },\n },\n {\n type: \"component\",\n name: POPOVER_COMPONENT_NAME,\n styles: {\n backgroundColor: \"white\",\n padding: \"10px\",\n overflow: \"scroll\",\n },\n props: {\n children: [\n {\n type: \"component\",\n name: LIST_BOX_COMPONENT_NAME,\n props: {\n selectionMode: \"single\",\n },\n styles: {\n borderWidth: 0,\n width: \"stretch\",\n },\n },\n ],\n },\n },\n ],\n },\n ],\n },\n },\n states: {\n selectedKey: {\n type: \"writable\",\n valueProp: \"selectedKey\",\n onChangeProp: \"onSelectionChange\",\n variableType: \"text\",\n },\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: true,\n });\n}\n"],"names":["React","SelectValue","makeComponentName","usePlasmicCanvasContext","useMemo","ListBoxItemIdManager","useEffect","Select","extractPlasmicDataProps","PlasmicPopoverContext","PlasmicListBoxContext","registerComponentHelper","getCommonProps","LABEL_COMPONENT_NAME","BUTTON_COMPONENT_NAME","POPOVER_COMPONENT_NAME","LIST_BOX_COMPONENT_NAME"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBa,MAAA,eAAA,GAAkB,CAAC,KAAgC,KAAA;AAC9D,EAAM,M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,EAAA;AAAA,wBACL,aAAe,EAAA,QAAA;AAAA,uBACjB;AAAA,sBACA,MAAQ,EAAA;AAAA,wBACN,WAAa,EAAA,CAAA;AAAA,wBACb,KAAO,EAAA,SAAA;AAAA,uBACT;AAAA,qBACF;AAAA,mBACF;AAAA,iBACF;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,KACF,CAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,WAAa,EAAA;AAAA,QACX,IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,aAAA;AAAA,QACX,YAAc,EAAA,mBAAA;AAAA,QACd,YAAc,EAAA,MAAA;AAAA,OAChB;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,QAAA;AAAA,QACX,YAAc,EAAA,cAAA;AAAA,QACd,YAAc,EAAA,SAAA;AAAA,OAChB;AAAA,KACF;AAAA,IACA,UAAY,EAAA,IAAA;AAAA,GACb,CAAA,CAAA;AACH;;;;;;"}
|
|
1
|
+
{"version":3,"file":"registerSelect.cjs.js","sources":["../src/registerSelect.tsx"],"sourcesContent":["import { usePlasmicCanvasComponentInfo } from \"@plasmicapp/host\";\nimport React, { useEffect, useMemo } from \"react\";\nimport { Select, SelectProps, SelectValue } from \"react-aria-components\";\nimport { getCommonProps } from \"./common\";\nimport { PlasmicListBoxContext, PlasmicPopoverContext } from \"./contexts\";\nimport { ListBoxItemIdManager } from \"./ListBoxItemIdManager\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { LABEL_COMPONENT_NAME } from \"./registerLabel\";\nimport { LIST_BOX_COMPONENT_NAME } from \"./registerListBox\";\nimport { POPOVER_COMPONENT_NAME } from \"./registerPopover\";\nimport {\n extractPlasmicDataProps,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseSelectValueProps\n extends React.ComponentProps<typeof SelectValue> {\n customize?: boolean;\n}\n\nexport const BaseSelectValue = (props: BaseSelectValueProps) => {\n const { children, customize } = props;\n return (\n <SelectValue>\n {({ isPlaceholder, selectedText }) => (\n <>\n {isPlaceholder ? (\n <span>Select an item</span>\n ) : (\n <>\n <span>\n {customize ? (children as React.ReactNode) : selectedText}\n </span>\n </>\n )}\n {}\n </>\n )}\n </SelectValue>\n );\n};\n\nconst SELECT_NAME = makeComponentName(\"select\");\n\nexport interface BaseSelectControlContextData {\n itemIds: string[];\n}\n\nexport interface BaseSelectProps\n extends SelectProps<{}>, // NOTE: We don't need generic type here since we don't use items prop (that needs it). We just need to make the type checker happy\n HasControlContextData<BaseSelectControlContextData> {\n children?: React.ReactNode;\n}\n\nexport function BaseSelect(props: BaseSelectProps) {\n const {\n selectedKey,\n onSelectionChange,\n placeholder,\n onOpenChange,\n isDisabled,\n className,\n style,\n children,\n disabledKeys,\n name,\n isOpen,\n setControlContextData,\n \"aria-label\": ariaLabel,\n } = props;\n\n const { isSelected } = usePlasmicCanvasComponentInfo(props) ?? {};\n const _isOpen = (isSelected || isOpen) ?? false;\n\n let idManager = useMemo(() => new ListBoxItemIdManager(), []);\n\n useEffect(() => {\n idManager.subscribe((ids: string[]) => {\n setControlContextData?.({\n itemIds: ids,\n });\n });\n }, []);\n\n return (\n <Select\n placeholder={placeholder}\n selectedKey={selectedKey}\n onSelectionChange={onSelectionChange}\n onOpenChange={onOpenChange}\n isDisabled={isDisabled}\n className={className}\n style={style}\n name={name}\n disabledKeys={disabledKeys}\n aria-label={ariaLabel}\n isOpen={_isOpen}\n {...extractPlasmicDataProps(props)}\n >\n <PlasmicPopoverContext.Provider\n value={{ isOpen: _isOpen, defaultShouldFlip: false }}\n >\n <PlasmicListBoxContext.Provider\n value={{\n idManager,\n }}\n >\n {children}\n </PlasmicListBoxContext.Provider>\n </PlasmicPopoverContext.Provider>\n </Select>\n );\n}\n\nexport function registerSelect(loader?: Registerable) {\n const selectValueMeta = registerComponentHelper(loader, BaseSelectValue, {\n name: makeComponentName(\"select-value\"),\n displayName: \"Aria Selected Value\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSelect\",\n importName: \"BaseSelectValue\",\n parentComponentName: SELECT_NAME,\n props: {\n customize: {\n type: \"boolean\",\n description: \"Whether to customize the selected value display\",\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Selected value...\",\n },\n ],\n hidden: (props) => !props.customize,\n },\n className: {\n type: \"class\",\n selectors: [\n {\n selector: \":self[data-placeholder]\",\n label: \"Placeholder\",\n },\n ],\n },\n },\n trapsFocus: true,\n });\n\n registerComponentHelper(loader, BaseSelect, {\n name: SELECT_NAME,\n displayName: \"Aria Select\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSelect\",\n importName: \"BaseSelect\",\n props: {\n ...getCommonProps<BaseSelectProps>(\"Select\", [\n \"name\",\n \"aria-label\",\n \"placeholder\",\n \"isDisabled\",\n \"autoFocus\",\n ]),\n selectedKey: {\n type: \"choice\",\n description: \"The selected keys of the listbox\",\n editOnly: true,\n uncontrolledProp: \"defaultSelectedKey\",\n displayName: \"Initial selected key\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n // React Aria Select do not support multiple selections yet\n multiSelect: false,\n },\n onSelectionChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"value\", type: \"string\" }],\n },\n disabledKeys: {\n type: \"choice\",\n description:\n \"The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n multiSelect: true,\n advanced: true,\n },\n isOpen: {\n type: \"boolean\",\n defaultValue: false,\n // It doesn't make sense to make isOpen prop editable (it's controlled by user interaction and always closed by default), so we keep this prop hidden. We have listed the prop here in the meta only so we can expose a writeable state for it.\n hidden: () => true,\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n children: {\n type: \"slot\",\n mergeWithParent: true,\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: \"component\",\n name: BUTTON_COMPONENT_NAME,\n styles: {\n width: \"100%\",\n },\n props: {\n children: {\n type: \"hbox\",\n styles: {\n width: \"stretch\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n padding: \"2px 5px\",\n },\n children: [\n {\n type: \"component\",\n name: selectValueMeta.name,\n },\n {\n type: \"img\",\n src: \"https://static1.plasmic.app/arrow-up.svg\",\n styles: {\n height: \"20px\",\n width: \"20px\",\n transform: \"rotate(180deg)\",\n },\n },\n ],\n },\n },\n },\n {\n type: \"component\",\n name: POPOVER_COMPONENT_NAME,\n styles: {\n backgroundColor: \"white\",\n padding: \"10px\",\n overflow: \"scroll\",\n },\n props: {\n children: [\n {\n type: \"component\",\n name: LIST_BOX_COMPONENT_NAME,\n props: {\n selectionMode: \"single\",\n },\n styles: {\n borderWidth: 0,\n width: \"stretch\",\n },\n },\n ],\n },\n },\n ],\n },\n ],\n },\n },\n states: {\n selectedKey: {\n type: \"writable\",\n valueProp: \"selectedKey\",\n onChangeProp: \"onSelectionChange\",\n variableType: \"text\",\n },\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: true,\n });\n}\n"],"names":["React","SelectValue","makeComponentName","useMemo","ListBoxItemIdManager","useEffect","Select","extractPlasmicDataProps","PlasmicPopoverContext","PlasmicListBoxContext","registerComponentHelper","getCommonProps","LABEL_COMPONENT_NAME","BUTTON_COMPONENT_NAME","POPOVER_COMPONENT_NAME","LIST_BOX_COMPONENT_NAME"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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Ae,EAAA,QAAA;AAAA,uBACjB;AAAA,sBACA,MAAQ,EAAA;AAAA,wBACN,WAAa,EAAA,CAAA;AAAA,wBACb,KAAO,EAAA,SAAA;AAAA,uBACT;AAAA,qBACF;AAAA,mBACF;AAAA,iBACF;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,KACF,CAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,WAAa,EAAA;AAAA,QACX,IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,aAAA;AAAA,QACX,YAAc,EAAA,mBAAA;AAAA,QACd,YAAc,EAAA,MAAA;AAAA,OAChB;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,QAAA;AAAA,QACX,YAAc,EAAA,cAAA;AAAA,QACd,YAAc,EAAA,SAAA;AAAA,OAChB;AAAA,KACF;AAAA,IACA,UAAY,EAAA,IAAA;AAAA,GACb,CAAA,CAAA;AACH;;;;;;"}
|
|
@@ -10,7 +10,6 @@ export interface BaseSelectControlContextData {
|
|
|
10
10
|
}
|
|
11
11
|
export interface BaseSelectProps extends SelectProps<{}>, // NOTE: We don't need generic type here since we don't use items prop (that needs it). We just need to make the type checker happy
|
|
12
12
|
HasControlContextData<BaseSelectControlContextData> {
|
|
13
|
-
previewOpen?: boolean;
|
|
14
13
|
children?: React.ReactNode;
|
|
15
14
|
}
|
|
16
15
|
export declare function BaseSelect(props: BaseSelectProps): React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { usePlasmicCanvasComponentInfo } from '@plasmicapp/host';
|
|
2
2
|
import React, { useMemo, useEffect } from 'react';
|
|
3
3
|
import { SelectValue, Select } from 'react-aria-components';
|
|
4
4
|
import { g as getCommonProps } from './common-0c4336fe.esm.js';
|
|
@@ -41,11 +41,11 @@ const BaseSelectValue = (props) => {
|
|
|
41
41
|
};
|
|
42
42
|
const SELECT_NAME = makeComponentName("select");
|
|
43
43
|
function BaseSelect(props) {
|
|
44
|
+
var _a, _b;
|
|
44
45
|
const {
|
|
45
46
|
selectedKey,
|
|
46
47
|
onSelectionChange,
|
|
47
48
|
placeholder,
|
|
48
|
-
previewOpen,
|
|
49
49
|
onOpenChange,
|
|
50
50
|
isDisabled,
|
|
51
51
|
className,
|
|
@@ -57,8 +57,8 @@ function BaseSelect(props) {
|
|
|
57
57
|
setControlContextData,
|
|
58
58
|
"aria-label": ariaLabel
|
|
59
59
|
} = props;
|
|
60
|
-
const
|
|
61
|
-
const
|
|
60
|
+
const { isSelected } = (_a = usePlasmicCanvasComponentInfo(props)) != null ? _a : {};
|
|
61
|
+
const _isOpen = (_b = isSelected || isOpen) != null ? _b : false;
|
|
62
62
|
let idManager = useMemo(() => new ListBoxItemIdManager(), []);
|
|
63
63
|
useEffect(() => {
|
|
64
64
|
idManager.subscribe((ids) => {
|
|
@@ -80,12 +80,12 @@ function BaseSelect(props) {
|
|
|
80
80
|
name,
|
|
81
81
|
disabledKeys,
|
|
82
82
|
"aria-label": ariaLabel,
|
|
83
|
-
isOpen:
|
|
83
|
+
isOpen: _isOpen
|
|
84
84
|
}, extractPlasmicDataProps(props)),
|
|
85
85
|
/* @__PURE__ */ React.createElement(
|
|
86
86
|
PlasmicPopoverContext.Provider,
|
|
87
87
|
{
|
|
88
|
-
value: { isOpen:
|
|
88
|
+
value: { isOpen: _isOpen, defaultShouldFlip: false }
|
|
89
89
|
},
|
|
90
90
|
/* @__PURE__ */ React.createElement(
|
|
91
91
|
PlasmicListBoxContext.Provider,
|
|
@@ -166,13 +166,6 @@ function registerSelect(loader) {
|
|
|
166
166
|
multiSelect: true,
|
|
167
167
|
advanced: true
|
|
168
168
|
},
|
|
169
|
-
previewOpen: {
|
|
170
|
-
type: "boolean",
|
|
171
|
-
displayName: "Preview opened?",
|
|
172
|
-
description: "Preview opened state while designing in Plasmic editor",
|
|
173
|
-
editOnly: true,
|
|
174
|
-
defaultValue: false
|
|
175
|
-
},
|
|
176
169
|
isOpen: {
|
|
177
170
|
type: "boolean",
|
|
178
171
|
defaultValue: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerSelect.esm.js","sources":["../src/registerSelect.tsx"],"sourcesContent":["import { usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport React, { useEffect, useMemo } from \"react\";\nimport { Select, SelectProps, SelectValue } from \"react-aria-components\";\nimport { getCommonProps } from \"./common\";\nimport { PlasmicListBoxContext, PlasmicPopoverContext } from \"./contexts\";\nimport { ListBoxItemIdManager } from \"./ListBoxItemIdManager\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { LABEL_COMPONENT_NAME } from \"./registerLabel\";\nimport { LIST_BOX_COMPONENT_NAME } from \"./registerListBox\";\nimport { POPOVER_COMPONENT_NAME } from \"./registerPopover\";\nimport {\n extractPlasmicDataProps,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseSelectValueProps\n extends React.ComponentProps<typeof SelectValue> {\n customize?: boolean;\n}\n\nexport const BaseSelectValue = (props: BaseSelectValueProps) => {\n const { children, customize } = props;\n return (\n <SelectValue>\n {({ isPlaceholder, selectedText }) => (\n <>\n {isPlaceholder ? (\n <span>Select an item</span>\n ) : (\n <>\n <span>\n {customize ? (children as React.ReactNode) : selectedText}\n </span>\n </>\n )}\n {}\n </>\n )}\n </SelectValue>\n );\n};\n\nconst SELECT_NAME = makeComponentName(\"select\");\n\nexport interface BaseSelectControlContextData {\n itemIds: string[];\n}\n\nexport interface BaseSelectProps\n extends SelectProps<{}>, // NOTE: We don't need generic type here since we don't use items prop (that needs it). We just need to make the type checker happy\n HasControlContextData<BaseSelectControlContextData> {\n previewOpen?: boolean;\n children?: React.ReactNode;\n}\n\nexport function BaseSelect(props: BaseSelectProps) {\n const {\n selectedKey,\n onSelectionChange,\n placeholder,\n previewOpen,\n onOpenChange,\n isDisabled,\n className,\n style,\n children,\n disabledKeys,\n name,\n isOpen,\n setControlContextData,\n \"aria-label\": ariaLabel,\n } = props;\n\n const isEditMode = !!usePlasmicCanvasContext();\n const openProp = isEditMode && previewOpen ? true : isOpen;\n\n let idManager = useMemo(() => new ListBoxItemIdManager(), []);\n\n useEffect(() => {\n idManager.subscribe((ids: string[]) => {\n setControlContextData?.({\n itemIds: ids,\n });\n });\n }, []);\n\n return (\n <Select\n placeholder={placeholder}\n selectedKey={selectedKey}\n onSelectionChange={onSelectionChange}\n onOpenChange={onOpenChange}\n isDisabled={isDisabled}\n className={className}\n style={style}\n name={name}\n disabledKeys={disabledKeys}\n aria-label={ariaLabel}\n isOpen={openProp}\n {...extractPlasmicDataProps(props)}\n >\n <PlasmicPopoverContext.Provider\n value={{ isOpen: openProp, defaultShouldFlip: false }}\n >\n <PlasmicListBoxContext.Provider\n value={{\n idManager,\n }}\n >\n {children}\n </PlasmicListBoxContext.Provider>\n </PlasmicPopoverContext.Provider>\n </Select>\n );\n}\n\nexport function registerSelect(loader?: Registerable) {\n const selectValueMeta = registerComponentHelper(loader, BaseSelectValue, {\n name: makeComponentName(\"select-value\"),\n displayName: \"Aria Selected Value\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSelect\",\n importName: \"BaseSelectValue\",\n parentComponentName: SELECT_NAME,\n props: {\n customize: {\n type: \"boolean\",\n description: \"Whether to customize the selected value display\",\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Selected value...\",\n },\n ],\n hidden: (props) => !props.customize,\n },\n className: {\n type: \"class\",\n selectors: [\n {\n selector: \":self[data-placeholder]\",\n label: \"Placeholder\",\n },\n ],\n },\n },\n trapsFocus: true,\n });\n\n registerComponentHelper(loader, BaseSelect, {\n name: SELECT_NAME,\n displayName: \"Aria Select\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSelect\",\n importName: \"BaseSelect\",\n props: {\n ...getCommonProps<BaseSelectProps>(\"Select\", [\n \"name\",\n \"aria-label\",\n \"placeholder\",\n \"isDisabled\",\n \"autoFocus\",\n ]),\n selectedKey: {\n type: \"choice\",\n description: \"The selected keys of the listbox\",\n editOnly: true,\n uncontrolledProp: \"defaultSelectedKey\",\n displayName: \"Initial selected key\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n // React Aria Select do not support multiple selections yet\n multiSelect: false,\n },\n onSelectionChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"value\", type: \"string\" }],\n },\n disabledKeys: {\n type: \"choice\",\n description:\n \"The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n multiSelect: true,\n advanced: true,\n },\n previewOpen: {\n type: \"boolean\",\n displayName: \"Preview opened?\",\n description: \"Preview opened state while designing in Plasmic editor\",\n editOnly: true,\n defaultValue: false,\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 onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n children: {\n type: \"slot\",\n mergeWithParent: true,\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: \"component\",\n name: BUTTON_COMPONENT_NAME,\n styles: {\n width: \"100%\",\n },\n props: {\n children: {\n type: \"hbox\",\n styles: {\n width: \"stretch\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n padding: \"2px 5px\",\n },\n children: [\n {\n type: \"component\",\n name: selectValueMeta.name,\n },\n {\n type: \"img\",\n src: \"https://static1.plasmic.app/arrow-up.svg\",\n styles: {\n height: \"20px\",\n width: \"20px\",\n transform: \"rotate(180deg)\",\n },\n },\n ],\n },\n },\n },\n {\n type: \"component\",\n name: POPOVER_COMPONENT_NAME,\n styles: {\n backgroundColor: \"white\",\n padding: \"10px\",\n overflow: \"scroll\",\n },\n props: {\n children: [\n {\n type: \"component\",\n name: LIST_BOX_COMPONENT_NAME,\n props: {\n selectionMode: \"single\",\n },\n styles: {\n borderWidth: 0,\n width: \"stretch\",\n },\n },\n ],\n },\n },\n ],\n },\n ],\n },\n },\n states: {\n selectedKey: {\n type: \"writable\",\n valueProp: \"selectedKey\",\n onChangeProp: \"onSelectionChange\",\n variableType: \"text\",\n },\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: true,\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBa,MAAA,eAAA,GAAkB,CAAC,KAAgC,KAAA;AAC9D,EAAM,MAAA,EAAE,QAAU,EAAA,SAAA,EAAc,GAAA,KAAA,CAAA;AAChC,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,mBACE,CAAC,EAAE,eAAe,YAAa,EAAA,+DAE3B,aACC,mBAAA,KAAA,CAAA,aAAA,CAAC,cAAK,gBAAc,CAAA,6EAGjB,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAA,EACE,YAAa,QAA+B,GAAA,YAC/C,CACF,CAGJ,CAEJ,CAAA,CAAA;AAEJ,EAAA;AAEA,MAAM,WAAA,GAAc,kBAAkB,QAAQ,CAAA,CAAA;AAavC,SAAS,WAAW,KAAwB,EAAA;AACjD,EAAM,MAAA;AAAA,IACJ,WAAA;AAAA,IACA,iBAAA;AAAA,IACA,WAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IAC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IAAA;AAAA,GACb,CAAA,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"registerSelect.esm.js","sources":["../src/registerSelect.tsx"],"sourcesContent":["import { usePlasmicCanvasComponentInfo } from \"@plasmicapp/host\";\nimport React, { useEffect, useMemo } from \"react\";\nimport { Select, SelectProps, SelectValue } from \"react-aria-components\";\nimport { getCommonProps } from \"./common\";\nimport { PlasmicListBoxContext, PlasmicPopoverContext } from \"./contexts\";\nimport { ListBoxItemIdManager } from \"./ListBoxItemIdManager\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { LABEL_COMPONENT_NAME } from \"./registerLabel\";\nimport { LIST_BOX_COMPONENT_NAME } from \"./registerListBox\";\nimport { POPOVER_COMPONENT_NAME } from \"./registerPopover\";\nimport {\n extractPlasmicDataProps,\n HasControlContextData,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseSelectValueProps\n extends React.ComponentProps<typeof SelectValue> {\n customize?: boolean;\n}\n\nexport const BaseSelectValue = (props: BaseSelectValueProps) => {\n const { children, customize } = props;\n return (\n <SelectValue>\n {({ isPlaceholder, selectedText }) => (\n <>\n {isPlaceholder ? (\n <span>Select an item</span>\n ) : (\n <>\n <span>\n {customize ? (children as React.ReactNode) : selectedText}\n </span>\n </>\n )}\n {}\n </>\n )}\n </SelectValue>\n );\n};\n\nconst SELECT_NAME = makeComponentName(\"select\");\n\nexport interface BaseSelectControlContextData {\n itemIds: string[];\n}\n\nexport interface BaseSelectProps\n extends SelectProps<{}>, // NOTE: We don't need generic type here since we don't use items prop (that needs it). We just need to make the type checker happy\n HasControlContextData<BaseSelectControlContextData> {\n children?: React.ReactNode;\n}\n\nexport function BaseSelect(props: BaseSelectProps) {\n const {\n selectedKey,\n onSelectionChange,\n placeholder,\n onOpenChange,\n isDisabled,\n className,\n style,\n children,\n disabledKeys,\n name,\n isOpen,\n setControlContextData,\n \"aria-label\": ariaLabel,\n } = props;\n\n const { isSelected } = usePlasmicCanvasComponentInfo(props) ?? {};\n const _isOpen = (isSelected || isOpen) ?? false;\n\n let idManager = useMemo(() => new ListBoxItemIdManager(), []);\n\n useEffect(() => {\n idManager.subscribe((ids: string[]) => {\n setControlContextData?.({\n itemIds: ids,\n });\n });\n }, []);\n\n return (\n <Select\n placeholder={placeholder}\n selectedKey={selectedKey}\n onSelectionChange={onSelectionChange}\n onOpenChange={onOpenChange}\n isDisabled={isDisabled}\n className={className}\n style={style}\n name={name}\n disabledKeys={disabledKeys}\n aria-label={ariaLabel}\n isOpen={_isOpen}\n {...extractPlasmicDataProps(props)}\n >\n <PlasmicPopoverContext.Provider\n value={{ isOpen: _isOpen, defaultShouldFlip: false }}\n >\n <PlasmicListBoxContext.Provider\n value={{\n idManager,\n }}\n >\n {children}\n </PlasmicListBoxContext.Provider>\n </PlasmicPopoverContext.Provider>\n </Select>\n );\n}\n\nexport function registerSelect(loader?: Registerable) {\n const selectValueMeta = registerComponentHelper(loader, BaseSelectValue, {\n name: makeComponentName(\"select-value\"),\n displayName: \"Aria Selected Value\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSelect\",\n importName: \"BaseSelectValue\",\n parentComponentName: SELECT_NAME,\n props: {\n customize: {\n type: \"boolean\",\n description: \"Whether to customize the selected value display\",\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Selected value...\",\n },\n ],\n hidden: (props) => !props.customize,\n },\n className: {\n type: \"class\",\n selectors: [\n {\n selector: \":self[data-placeholder]\",\n label: \"Placeholder\",\n },\n ],\n },\n },\n trapsFocus: true,\n });\n\n registerComponentHelper(loader, BaseSelect, {\n name: SELECT_NAME,\n displayName: \"Aria Select\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerSelect\",\n importName: \"BaseSelect\",\n props: {\n ...getCommonProps<BaseSelectProps>(\"Select\", [\n \"name\",\n \"aria-label\",\n \"placeholder\",\n \"isDisabled\",\n \"autoFocus\",\n ]),\n selectedKey: {\n type: \"choice\",\n description: \"The selected keys of the listbox\",\n editOnly: true,\n uncontrolledProp: \"defaultSelectedKey\",\n displayName: \"Initial selected key\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n // React Aria Select do not support multiple selections yet\n multiSelect: false,\n },\n onSelectionChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"value\", type: \"string\" }],\n },\n disabledKeys: {\n type: \"choice\",\n description:\n \"The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.\",\n options: (_props, ctx) => (ctx?.itemIds ? Array.from(ctx.itemIds) : []),\n multiSelect: true,\n advanced: true,\n },\n isOpen: {\n type: \"boolean\",\n defaultValue: false,\n // It doesn't make sense to make isOpen prop editable (it's controlled by user interaction and always closed by default), so we keep this prop hidden. We have listed the prop here in the meta only so we can expose a writeable state for it.\n hidden: () => true,\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n children: {\n type: \"slot\",\n mergeWithParent: true,\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: \"component\",\n name: BUTTON_COMPONENT_NAME,\n styles: {\n width: \"100%\",\n },\n props: {\n children: {\n type: \"hbox\",\n styles: {\n width: \"stretch\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n padding: \"2px 5px\",\n },\n children: [\n {\n type: \"component\",\n name: selectValueMeta.name,\n },\n {\n type: \"img\",\n src: \"https://static1.plasmic.app/arrow-up.svg\",\n styles: {\n height: \"20px\",\n width: \"20px\",\n transform: \"rotate(180deg)\",\n },\n },\n ],\n },\n },\n },\n {\n type: \"component\",\n name: POPOVER_COMPONENT_NAME,\n styles: {\n backgroundColor: \"white\",\n padding: \"10px\",\n overflow: \"scroll\",\n },\n props: {\n children: [\n {\n type: \"component\",\n name: LIST_BOX_COMPONENT_NAME,\n props: {\n selectionMode: \"single\",\n },\n styles: {\n borderWidth: 0,\n width: \"stretch\",\n },\n },\n ],\n },\n },\n ],\n },\n ],\n },\n },\n states: {\n selectedKey: {\n type: \"writable\",\n valueProp: \"selectedKey\",\n onChangeProp: \"onSelectionChange\",\n variableType: \"text\",\n },\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: true,\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBa,MAAA,eAAA,GAAkB,CAAC,KAAgC,KAAA;AAC9D,EAAM,MAAA,EAAE,QAAU,EAAA,SAAA,EAAc,GAAA,KAAA,CAAA;AAChC,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,mBACE,CAAC,EAAE,eAAe,YAAa,EAAA,+DAE3B,aACC,mBAAA,KAAA,CAAA,aAAA,CAAC,cAAK,gBAAc,CAAA,6EAGjB,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAA,EACE,YAAa,QAA+B,GAAA,YAC/C,CACF,CAGJ,CAEJ,CAAA,CAAA;AAEJ,EAAA;AAEA,MAAM,WAAA,GAAc,kBAAkB,QAAQ,CAAA,CAAA;AAYvC,SAAS,WAAW,KAAwB,EAAA;AAzDnD,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AA0DE,EAAM,MAAA;AAAA,IACJ,WAAA;AAAA,IACA,iBAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,IAAA;AAAA,IACA,MAAA;AAAA,IACA,qBAAA;AAAA,IACA,YAAc,EAAA,SAAA;AAAA,GACZ,GAAA,KAAA,CAAA;AAEJ,EAAA,MAAM,EA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ACF;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,iBACZ;AAAA,gBACA,KAAO,EAAA;AAAA,kBACL,QAAU,EAAA;AAAA,oBACR;AAAA,sBACE,IAAM,EAAA,WAAA;AAAA,sBACN,IAAM,EAAA,uBAAA;AAAA,sBACN,KAAO,EAAA;AAAA,wBACL,aAAe,EAAA,QAAA;AAAA,uBACjB;AAAA,sBACA,MAAQ,EAAA;AAAA,wBACN,WAAa,EAAA,CAAA;AAAA,wBACb,KAAO,EAAA,SAAA;AAAA,uBACT;AAAA,qBACF;AAAA,mBACF;AAAA,iBACF;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,KACF,CAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,WAAa,EAAA;AAAA,QACX,IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,aAAA;AAAA,QACX,YAAc,EAAA,mBAAA;AAAA,QACd,YAAc,EAAA,MAAA;AAAA,OAChB;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,QAAA;AAAA,QACX,YAAc,EAAA,cAAA;AAAA,QACd,YAAc,EAAA,SAAA;AAAA,OAChB;AAAA,KACF;AAAA,IACA,UAAY,EAAA,IAAA;AAAA,GACb,CAAA,CAAA;AACH;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var host = require('@plasmicapp/host');
|
|
3
4
|
var utils = require('@react-aria/utils');
|
|
4
5
|
var React = require('react');
|
|
5
6
|
var reactAria = require('react-aria');
|
|
@@ -42,7 +43,10 @@ var __objRest = (source, exclude) => {
|
|
|
42
43
|
return target;
|
|
43
44
|
};
|
|
44
45
|
function BaseTooltip(props) {
|
|
46
|
+
var _b;
|
|
45
47
|
const _a = props, { children, tooltipContent, className, resetClassName } = _a, restProps = __objRest(_a, ["children", "tooltipContent", "className", "resetClassName"]);
|
|
48
|
+
const { isSelected, selectedSlotName } = (_b = host.usePlasmicCanvasComponentInfo(props)) != null ? _b : {};
|
|
49
|
+
const isAutoOpen = selectedSlotName !== "children" && isSelected;
|
|
46
50
|
const state = reactStately.useTooltipTriggerState(restProps);
|
|
47
51
|
const ref = React__default.default.useRef(null);
|
|
48
52
|
const { triggerProps, tooltipProps } = reactAria.useTooltipTrigger(
|
|
@@ -64,7 +68,7 @@ function BaseTooltip(props) {
|
|
|
64
68
|
focusableChild.props,
|
|
65
69
|
triggerProps
|
|
66
70
|
))) : null,
|
|
67
|
-
state.isOpen && /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, React__default.default.cloneElement(
|
|
71
|
+
(isAutoOpen || state.isOpen) && /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, React__default.default.cloneElement(
|
|
68
72
|
hasContent ? tooltipContent : /* @__PURE__ */ React__default.default.createElement("p", null, "Add some content to the tooltip..."),
|
|
69
73
|
utils.mergeProps(tooltipProps, tooltipContent == null ? void 0 : tooltipContent.props.attrs, { className })
|
|
70
74
|
))
|
|
@@ -84,6 +88,7 @@ function registerTooltip(loader, overrides) {
|
|
|
84
88
|
props: {
|
|
85
89
|
children: {
|
|
86
90
|
type: "slot",
|
|
91
|
+
displayName: "Trigger",
|
|
87
92
|
mergeWithParent: true,
|
|
88
93
|
defaultValue: {
|
|
89
94
|
type: "text",
|
|
@@ -121,13 +126,6 @@ function registerTooltip(loader, overrides) {
|
|
|
121
126
|
options: ["focus", "focus and hover"],
|
|
122
127
|
defaultValueHint: "focus and hover"
|
|
123
128
|
},
|
|
124
|
-
isOpen: {
|
|
125
|
-
type: "boolean",
|
|
126
|
-
editOnly: true,
|
|
127
|
-
uncontrolledProp: "defaultOpen",
|
|
128
|
-
description: "Whether the overlay is open by default",
|
|
129
|
-
defaultValueHint: false
|
|
130
|
-
},
|
|
131
129
|
onOpenChange: {
|
|
132
130
|
type: "eventHandler",
|
|
133
131
|
argTypes: [{ name: "isOpen", type: "boolean" }]
|
|
@@ -135,8 +133,7 @@ function registerTooltip(loader, overrides) {
|
|
|
135
133
|
},
|
|
136
134
|
states: {
|
|
137
135
|
isOpen: {
|
|
138
|
-
type: "
|
|
139
|
-
valueProp: "isOpen",
|
|
136
|
+
type: "readonly",
|
|
140
137
|
onChangeProp: "onOpenChange",
|
|
141
138
|
variableType: "boolean"
|
|
142
139
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerTooltip.cjs.js","sources":["../src/registerTooltip.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { useTooltipTrigger } from \"react-aria\";\nimport { TooltipProps } from \"react-aria-components\";\nimport flattenChildren from \"react-keyed-flatten-children\";\nimport { TooltipTriggerProps, useTooltipTriggerState } from \"react-stately\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseTooltipProps extends TooltipTriggerProps, TooltipProps {\n children?: React.ReactElement<HTMLElement>;\n tooltipContent?: React.ReactElement;\n resetClassName?: string;\n className?: string;\n}\n\nexport function BaseTooltip(props: BaseTooltipProps) {\n const { children, tooltipContent, className, resetClassName, ...restProps } =\n props;\n const state = useTooltipTriggerState(restProps);\n const ref = React.useRef(null);\n const { triggerProps, tooltipProps } = useTooltipTrigger(\n restProps,\n state,\n ref\n );\n\n const hasContent =\n tooltipContent &&\n (tooltipContent.type as any).name !== \"CanvasSlotPlaceholder\";\n\n /** We are only accepting a single child here, so we can just use the first one.\n * This is because the trigger props will be applied to the child to enable the triggering of the tooltip.\n * If there has to be more than one things here, wrap them in a horizontal stack for instance.\n * */\n const focusableChild = flattenChildren(children)[0];\n\n return (\n <div\n // this is to ensure that the absolutely positioned tooltip can be positioned correctly within this relatively positioned container.\n style={{ position: \"relative\" }}\n className={resetClassName}\n >\n {React.isValidElement(focusableChild)\n ? React.cloneElement(focusableChild, {\n ref,\n ...mergeProps(\n focusableChild.props as Record<string, any>,\n triggerProps\n ),\n } as Record<string, any> & { ref?: React.Ref<HTMLElement> })\n : null}\n {state.isOpen && (\n <>\n {React.cloneElement(\n hasContent ? (\n tooltipContent\n ) : (\n <p>Add some content to the tooltip...</p>\n ),\n mergeProps(tooltipProps, tooltipContent?.props.attrs, { className })\n )}\n </>\n )}\n </div>\n );\n}\n\nexport function registerTooltip(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseTooltip>\n) {\n registerComponentHelper(\n loader,\n BaseTooltip,\n {\n name: \"plasmic-react-aria-tooltip\",\n displayName: \"Aria Tooltip\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerTooltip\",\n importName: \"BaseTooltip\",\n isAttachment: true,\n styleSections: true,\n props: {\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: {\n type: \"text\",\n value: \"Hover me!\",\n },\n },\n tooltipContent: {\n type: \"slot\",\n mergeWithParent: true,\n displayName: \"Tooltip Content\",\n // NOTE: This is not applied in attachment\n defaultValue: {\n type: \"text\",\n value: \"Hello from Tooltip!\",\n },\n },\n resetClassName: {\n type: \"themeResetClass\",\n },\n isDisabled: {\n type: \"boolean\",\n },\n delay: {\n type: \"number\",\n defaultValueHint: 1500,\n description:\n \"The delay (in milliseconds) for the tooltip to show up.\",\n },\n closeDelay: {\n type: \"number\",\n defaultValueHint: 500,\n description: \"The delay (in milliseconds) for the tooltip to close.\",\n },\n trigger: {\n type: \"choice\",\n options: [\"focus\", \"focus and hover\"],\n defaultValueHint: \"focus and hover\",\n },\n
|
|
1
|
+
{"version":3,"file":"registerTooltip.cjs.js","sources":["../src/registerTooltip.tsx"],"sourcesContent":["import { usePlasmicCanvasComponentInfo } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { useTooltipTrigger } from \"react-aria\";\nimport { TooltipProps } from \"react-aria-components\";\nimport flattenChildren from \"react-keyed-flatten-children\";\nimport { TooltipTriggerProps, useTooltipTriggerState } from \"react-stately\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseTooltipProps extends TooltipTriggerProps, TooltipProps {\n children?: React.ReactElement<HTMLElement>;\n tooltipContent?: React.ReactElement;\n resetClassName?: string;\n className?: string;\n}\n\nexport function BaseTooltip(props: BaseTooltipProps) {\n const { children, tooltipContent, className, resetClassName, ...restProps } =\n props;\n\n const { isSelected, selectedSlotName } =\n usePlasmicCanvasComponentInfo(props) ?? {};\n const isAutoOpen = selectedSlotName !== \"children\" && isSelected;\n\n const state = useTooltipTriggerState(restProps);\n const ref = React.useRef(null);\n const { triggerProps, tooltipProps } = useTooltipTrigger(\n restProps,\n state,\n ref\n );\n\n const hasContent =\n tooltipContent &&\n (tooltipContent.type as any).name !== \"CanvasSlotPlaceholder\";\n\n /** We are only accepting a single child here, so we can just use the first one.\n * This is because the trigger props will be applied to the child to enable the triggering of the tooltip.\n * If there has to be more than one things here, wrap them in a horizontal stack for instance.\n * */\n const focusableChild = flattenChildren(children)[0];\n\n return (\n <div\n // this is to ensure that the absolutely positioned tooltip can be positioned correctly within this relatively positioned container.\n style={{ position: \"relative\" }}\n className={resetClassName}\n >\n {React.isValidElement(focusableChild)\n ? React.cloneElement(focusableChild, {\n ref,\n ...mergeProps(\n focusableChild.props as Record<string, any>,\n triggerProps\n ),\n } as Record<string, any> & { ref?: React.Ref<HTMLElement> })\n : null}\n {(isAutoOpen || state.isOpen) && (\n <>\n {React.cloneElement(\n hasContent ? (\n tooltipContent\n ) : (\n <p>Add some content to the tooltip...</p>\n ),\n mergeProps(tooltipProps, tooltipContent?.props.attrs, { className })\n )}\n </>\n )}\n </div>\n );\n}\n\nexport function registerTooltip(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseTooltip>\n) {\n registerComponentHelper(\n loader,\n BaseTooltip,\n {\n name: \"plasmic-react-aria-tooltip\",\n displayName: \"Aria Tooltip\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerTooltip\",\n importName: \"BaseTooltip\",\n isAttachment: true,\n styleSections: true,\n props: {\n children: {\n type: \"slot\",\n displayName: \"Trigger\",\n mergeWithParent: true,\n defaultValue: {\n type: \"text\",\n value: \"Hover me!\",\n },\n },\n tooltipContent: {\n type: \"slot\",\n mergeWithParent: true,\n displayName: \"Tooltip Content\",\n // NOTE: This is not applied in attachment\n defaultValue: {\n type: \"text\",\n value: \"Hello from Tooltip!\",\n },\n },\n resetClassName: {\n type: \"themeResetClass\",\n },\n isDisabled: {\n type: \"boolean\",\n },\n delay: {\n type: \"number\",\n defaultValueHint: 1500,\n description:\n \"The delay (in milliseconds) for the tooltip to show up.\",\n },\n closeDelay: {\n type: \"number\",\n defaultValueHint: 500,\n description: \"The delay (in milliseconds) for the tooltip to close.\",\n },\n trigger: {\n type: \"choice\",\n options: [\"focus\", \"focus and hover\"],\n defaultValueHint: \"focus and hover\",\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n },\n states: {\n isOpen: {\n type: \"readonly\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["useTooltipTriggerState","React","useTooltipTrigger","flattenChildren","mergeProps","registerComponentHelper"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBO,SAAS,YAAY,KAAyB,EAAA;AApBrD,EAAA,IAAA,EAAA,CAAA;AAqBE,EAAA,MACE,EADM,GAAA,KAAA,EAAA,EAAA,QAAA,EAAU,cAAgB,EAAA,SAAA,EAAW,cArB/C,EAAA,GAsBI,EAD8D,EAAA,SAAA,GAAA,SAAA,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UAClB,WACE,EAAA,yDAAA;AAAA,SACJ;AAAA,QACA,UAAY,EAAA;AAAA,UACV,IAAM,EAAA,QAAA;AAAA,UACN,gBAAkB,EAAA,GAAA;AAAA,UAClB,WAAa,EAAA,uDAAA;AAAA,SACf;AAAA,QACA,OAAS,EAAA;AAAA,UACP,IAAM,EAAA,QAAA;AAAA,UACN,OAAA,EAAS,CAAC,OAAA,EAAS,iBAAiB,CAAA;AAAA,UACpC,gBAAkB,EAAA,iBAAA;AAAA,SACpB;AAAA,QACA,YAAc,EAAA;AAAA,UACZ,IAAM,EAAA,cAAA;AAAA,UACN,UAAU,CAAC,EAAE,MAAM,QAAU,EAAA,IAAA,EAAM,WAAW,CAAA;AAAA,SAChD;AAAA,OACF;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,MAAQ,EAAA;AAAA,UACN,IAAM,EAAA,UAAA;AAAA,UACN,YAAc,EAAA,cAAA;AAAA,UACd,YAAc,EAAA,SAAA;AAAA,SAChB;AAAA,OACF;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { usePlasmicCanvasComponentInfo } from '@plasmicapp/host';
|
|
1
2
|
import { mergeProps } from '@react-aria/utils';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { useTooltipTrigger } from 'react-aria';
|
|
@@ -35,7 +36,10 @@ var __objRest = (source, exclude) => {
|
|
|
35
36
|
return target;
|
|
36
37
|
};
|
|
37
38
|
function BaseTooltip(props) {
|
|
39
|
+
var _b;
|
|
38
40
|
const _a = props, { children, tooltipContent, className, resetClassName } = _a, restProps = __objRest(_a, ["children", "tooltipContent", "className", "resetClassName"]);
|
|
41
|
+
const { isSelected, selectedSlotName } = (_b = usePlasmicCanvasComponentInfo(props)) != null ? _b : {};
|
|
42
|
+
const isAutoOpen = selectedSlotName !== "children" && isSelected;
|
|
39
43
|
const state = useTooltipTriggerState(restProps);
|
|
40
44
|
const ref = React.useRef(null);
|
|
41
45
|
const { triggerProps, tooltipProps } = useTooltipTrigger(
|
|
@@ -57,7 +61,7 @@ function BaseTooltip(props) {
|
|
|
57
61
|
focusableChild.props,
|
|
58
62
|
triggerProps
|
|
59
63
|
))) : null,
|
|
60
|
-
state.isOpen && /* @__PURE__ */ React.createElement(React.Fragment, null, React.cloneElement(
|
|
64
|
+
(isAutoOpen || state.isOpen) && /* @__PURE__ */ React.createElement(React.Fragment, null, React.cloneElement(
|
|
61
65
|
hasContent ? tooltipContent : /* @__PURE__ */ React.createElement("p", null, "Add some content to the tooltip..."),
|
|
62
66
|
mergeProps(tooltipProps, tooltipContent == null ? void 0 : tooltipContent.props.attrs, { className })
|
|
63
67
|
))
|
|
@@ -77,6 +81,7 @@ function registerTooltip(loader, overrides) {
|
|
|
77
81
|
props: {
|
|
78
82
|
children: {
|
|
79
83
|
type: "slot",
|
|
84
|
+
displayName: "Trigger",
|
|
80
85
|
mergeWithParent: true,
|
|
81
86
|
defaultValue: {
|
|
82
87
|
type: "text",
|
|
@@ -114,13 +119,6 @@ function registerTooltip(loader, overrides) {
|
|
|
114
119
|
options: ["focus", "focus and hover"],
|
|
115
120
|
defaultValueHint: "focus and hover"
|
|
116
121
|
},
|
|
117
|
-
isOpen: {
|
|
118
|
-
type: "boolean",
|
|
119
|
-
editOnly: true,
|
|
120
|
-
uncontrolledProp: "defaultOpen",
|
|
121
|
-
description: "Whether the overlay is open by default",
|
|
122
|
-
defaultValueHint: false
|
|
123
|
-
},
|
|
124
122
|
onOpenChange: {
|
|
125
123
|
type: "eventHandler",
|
|
126
124
|
argTypes: [{ name: "isOpen", type: "boolean" }]
|
|
@@ -128,8 +126,7 @@ function registerTooltip(loader, overrides) {
|
|
|
128
126
|
},
|
|
129
127
|
states: {
|
|
130
128
|
isOpen: {
|
|
131
|
-
type: "
|
|
132
|
-
valueProp: "isOpen",
|
|
129
|
+
type: "readonly",
|
|
133
130
|
onChangeProp: "onOpenChange",
|
|
134
131
|
variableType: "boolean"
|
|
135
132
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerTooltip.esm.js","sources":["../src/registerTooltip.tsx"],"sourcesContent":["import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { useTooltipTrigger } from \"react-aria\";\nimport { TooltipProps } from \"react-aria-components\";\nimport flattenChildren from \"react-keyed-flatten-children\";\nimport { TooltipTriggerProps, useTooltipTriggerState } from \"react-stately\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseTooltipProps extends TooltipTriggerProps, TooltipProps {\n children?: React.ReactElement<HTMLElement>;\n tooltipContent?: React.ReactElement;\n resetClassName?: string;\n className?: string;\n}\n\nexport function BaseTooltip(props: BaseTooltipProps) {\n const { children, tooltipContent, className, resetClassName, ...restProps } =\n props;\n const state = useTooltipTriggerState(restProps);\n const ref = React.useRef(null);\n const { triggerProps, tooltipProps } = useTooltipTrigger(\n restProps,\n state,\n ref\n );\n\n const hasContent =\n tooltipContent &&\n (tooltipContent.type as any).name !== \"CanvasSlotPlaceholder\";\n\n /** We are only accepting a single child here, so we can just use the first one.\n * This is because the trigger props will be applied to the child to enable the triggering of the tooltip.\n * If there has to be more than one things here, wrap them in a horizontal stack for instance.\n * */\n const focusableChild = flattenChildren(children)[0];\n\n return (\n <div\n // this is to ensure that the absolutely positioned tooltip can be positioned correctly within this relatively positioned container.\n style={{ position: \"relative\" }}\n className={resetClassName}\n >\n {React.isValidElement(focusableChild)\n ? React.cloneElement(focusableChild, {\n ref,\n ...mergeProps(\n focusableChild.props as Record<string, any>,\n triggerProps\n ),\n } as Record<string, any> & { ref?: React.Ref<HTMLElement> })\n : null}\n {state.isOpen && (\n <>\n {React.cloneElement(\n hasContent ? (\n tooltipContent\n ) : (\n <p>Add some content to the tooltip...</p>\n ),\n mergeProps(tooltipProps, tooltipContent?.props.attrs, { className })\n )}\n </>\n )}\n </div>\n );\n}\n\nexport function registerTooltip(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseTooltip>\n) {\n registerComponentHelper(\n loader,\n BaseTooltip,\n {\n name: \"plasmic-react-aria-tooltip\",\n displayName: \"Aria Tooltip\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerTooltip\",\n importName: \"BaseTooltip\",\n isAttachment: true,\n styleSections: true,\n props: {\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: {\n type: \"text\",\n value: \"Hover me!\",\n },\n },\n tooltipContent: {\n type: \"slot\",\n mergeWithParent: true,\n displayName: \"Tooltip Content\",\n // NOTE: This is not applied in attachment\n defaultValue: {\n type: \"text\",\n value: \"Hello from Tooltip!\",\n },\n },\n resetClassName: {\n type: \"themeResetClass\",\n },\n isDisabled: {\n type: \"boolean\",\n },\n delay: {\n type: \"number\",\n defaultValueHint: 1500,\n description:\n \"The delay (in milliseconds) for the tooltip to show up.\",\n },\n closeDelay: {\n type: \"number\",\n defaultValueHint: 500,\n description: \"The delay (in milliseconds) for the tooltip to close.\",\n },\n trigger: {\n type: \"choice\",\n options: [\"focus\", \"focus and hover\"],\n defaultValueHint: \"focus and hover\",\n },\n
|
|
1
|
+
{"version":3,"file":"registerTooltip.esm.js","sources":["../src/registerTooltip.tsx"],"sourcesContent":["import { usePlasmicCanvasComponentInfo } from \"@plasmicapp/host\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { useTooltipTrigger } from \"react-aria\";\nimport { TooltipProps } from \"react-aria-components\";\nimport flattenChildren from \"react-keyed-flatten-children\";\nimport { TooltipTriggerProps, useTooltipTriggerState } from \"react-stately\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseTooltipProps extends TooltipTriggerProps, TooltipProps {\n children?: React.ReactElement<HTMLElement>;\n tooltipContent?: React.ReactElement;\n resetClassName?: string;\n className?: string;\n}\n\nexport function BaseTooltip(props: BaseTooltipProps) {\n const { children, tooltipContent, className, resetClassName, ...restProps } =\n props;\n\n const { isSelected, selectedSlotName } =\n usePlasmicCanvasComponentInfo(props) ?? {};\n const isAutoOpen = selectedSlotName !== \"children\" && isSelected;\n\n const state = useTooltipTriggerState(restProps);\n const ref = React.useRef(null);\n const { triggerProps, tooltipProps } = useTooltipTrigger(\n restProps,\n state,\n ref\n );\n\n const hasContent =\n tooltipContent &&\n (tooltipContent.type as any).name !== \"CanvasSlotPlaceholder\";\n\n /** We are only accepting a single child here, so we can just use the first one.\n * This is because the trigger props will be applied to the child to enable the triggering of the tooltip.\n * If there has to be more than one things here, wrap them in a horizontal stack for instance.\n * */\n const focusableChild = flattenChildren(children)[0];\n\n return (\n <div\n // this is to ensure that the absolutely positioned tooltip can be positioned correctly within this relatively positioned container.\n style={{ position: \"relative\" }}\n className={resetClassName}\n >\n {React.isValidElement(focusableChild)\n ? React.cloneElement(focusableChild, {\n ref,\n ...mergeProps(\n focusableChild.props as Record<string, any>,\n triggerProps\n ),\n } as Record<string, any> & { ref?: React.Ref<HTMLElement> })\n : null}\n {(isAutoOpen || state.isOpen) && (\n <>\n {React.cloneElement(\n hasContent ? (\n tooltipContent\n ) : (\n <p>Add some content to the tooltip...</p>\n ),\n mergeProps(tooltipProps, tooltipContent?.props.attrs, { className })\n )}\n </>\n )}\n </div>\n );\n}\n\nexport function registerTooltip(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseTooltip>\n) {\n registerComponentHelper(\n loader,\n BaseTooltip,\n {\n name: \"plasmic-react-aria-tooltip\",\n displayName: \"Aria Tooltip\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerTooltip\",\n importName: \"BaseTooltip\",\n isAttachment: true,\n styleSections: true,\n props: {\n children: {\n type: \"slot\",\n displayName: \"Trigger\",\n mergeWithParent: true,\n defaultValue: {\n type: \"text\",\n value: \"Hover me!\",\n },\n },\n tooltipContent: {\n type: \"slot\",\n mergeWithParent: true,\n displayName: \"Tooltip Content\",\n // NOTE: This is not applied in attachment\n defaultValue: {\n type: \"text\",\n value: \"Hello from Tooltip!\",\n },\n },\n resetClassName: {\n type: \"themeResetClass\",\n },\n isDisabled: {\n type: \"boolean\",\n },\n delay: {\n type: \"number\",\n defaultValueHint: 1500,\n description:\n \"The delay (in milliseconds) for the tooltip to show up.\",\n },\n closeDelay: {\n type: \"number\",\n defaultValueHint: 500,\n description: \"The delay (in milliseconds) for the tooltip to close.\",\n },\n trigger: {\n type: \"choice\",\n options: [\"focus\", \"focus and hover\"],\n defaultValueHint: \"focus and hover\",\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n },\n states: {\n isOpen: {\n type: \"readonly\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBO,SAAS,YAAY,KAAyB,EAAA;AApBrD,EAAA,IAAA,EAAA,CAAA;AAqBE,EAAA,MACE,EADM,GAAA,KAAA,EAAA,EAAA,QAAA,EAAU,cAAgB,EAAA,SAAA,EAAW,cArB/C,EAAA,GAsBI,EAD8D,EAAA,SAAA,GAAA,SAAA,CAC9D,EAD8D,EAAA,CAAxD,UAAU,EAAA,gBAAA,EAAgB,WAAW,EAAA,gBAAA,CAAA,CAAA,CAAA;AAG7C,EAAM,MAAA,EAAE,YAAY,gBAAiB,EAAA,GAAA,CACnC,mCAA8B,KAAK,CAAA,KAAnC,YAAwC,EAAC,CAAA;AAC3C,EAAM,MAAA,UAAA,GAAa,qBAAqB,UAAc,IAAA,UAAA,CAAA;AAEtD,EAAM,MAAA,KAAA,GAAQ,uBAAuB,SAAS,CAAA,CAAA;AAC9C,EAAM,MAAA,GAAA,GAAM,KAAM,CAAA,MAAA,CAAO,IAAI,CAAA,CAAA;AAC7B,EAAM,MAAA,EAAE,YAAc,EAAA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