@plasmicpkgs/react-aria 0.0.63 → 0.0.65
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 +92 -68
- package/dist/react-aria.esm.js.map +1 -1
- package/dist/react-aria.js +91 -67
- 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/registerListBoxItem.cjs.js +4 -2
- package/skinny/registerListBoxItem.cjs.js.map +1 -1
- package/skinny/registerListBoxItem.esm.js +4 -2
- package/skinny/registerListBoxItem.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
|
@@ -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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EAAA,iBAAA;AAAA;AAAA,UAEb,YAAc,EAAA;AAAA,YACZ,IAAM,EAAA,MAAA;AAAA,YACN,KAAO,EAAA,qBAAA;AAAA,WACT;AAAA,SACF;AAAA,QACA,cAAgB,EAAA;AAAA,UACd,IAAM,EAAA,iBAAA;AAAA,SACR;AAAA,QACA,UAAY,EAAA;AAAA,UACV,IAAM,EAAA,SAAA;AAAA,SACR;AAAA,QACA,KAAO,EAAA;AAAA,UACL,IAAM,EAAA,QAAA;AAAA,UACN,gBAAkB,EAAA,IAAA;AAAA,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,C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AAA;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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-8dbb4d1f.cjs.js","sources":["../src/utils.ts"],"sourcesContent":["import type
|
|
1
|
+
{"version":3,"file":"utils-8dbb4d1f.cjs.js","sources":["../src/utils.ts"],"sourcesContent":["import { type CodeComponentMeta } from \"@plasmicapp/host\";\nimport registerComponent from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\n\nexport type HasControlContextData<T = BaseControlContextData> = {\n setControlContextData?: (ctxData: T) => void;\n};\n\nexport type BaseControlContextData = {\n parent?: {\n isDisabled?: boolean;\n isReadOnly?: boolean;\n };\n};\n\nexport type Registerable = {\n registerComponent: typeof registerComponent;\n};\n\nexport type OtherCodeComponentsMeta = {\n text: CodeComponentMeta<any>;\n description: CodeComponentMeta<any>;\n};\n\nexport type CodeComponentMetaOverrides<T extends React.ComponentType<any>> =\n Partial<\n Pick<\n CodeComponentMeta<React.ComponentProps<T>>,\n \"parentComponentName\" | \"props\" | \"displayName\" | \"name\"\n >\n >;\n\nexport function registerComponentHelper<T extends React.ComponentType<any>>(\n loader: Registerable | undefined,\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>,\n overrides?: CodeComponentMetaOverrides<T>\n) {\n meta = {\n ...meta,\n defaultStyles: {\n boxSizing: \"border-box\",\n ...(meta.defaultStyles ?? {}),\n },\n };\n if (overrides) {\n meta = {\n ...meta,\n ...overrides,\n props: {\n ...meta.props,\n ...overrides.props,\n },\n };\n if (overrides.parentComponentName) {\n meta.name = makeChildComponentName(\n overrides.parentComponentName,\n meta.name\n );\n }\n }\n if (loader) {\n loader.registerComponent(component, meta);\n } else {\n registerComponent(component, meta);\n }\n return meta;\n}\n\nexport function makeComponentName(name: string) {\n return `plasmic-react-aria-${name}`;\n}\n\nexport function makeChildComponentName(\n fullParentName: string | undefined,\n fullChildName: string\n) {\n if (!fullParentName) {\n return fullChildName;\n }\n return `${fullParentName}-${fullChildName.replace(\n \"plasmic-react-aria-\",\n \"\"\n )}`;\n}\n\nexport interface Styleable {\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport function extractPlasmicDataProps(props: Record<string, any>) {\n return Object.fromEntries(\n Object.entries(props).filter(([key]) => key.startsWith(\"data-plasmic-\"))\n );\n}\n\nexport function withoutNils<T>(array: (T | undefined | null)[]) {\n return array.filter((x): x is T => x != null);\n}\n\nexport function isDefined<T>(thing: T | undefined | null): thing is T {\n return thing !== undefined && thing !== null;\n}\n"],"names":["registerComponent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCO,SAAS,uBACd,CAAA,MAAA,EACA,SACA,EAAA,IAAA,EACA,SACA,EAAA;AArCF,EAAA,IAAA,EAAA,CAAA;AAsCE,EAAA,IAAA,GAAO,iCACF,IADE,CAAA,EAAA;AAAA,IAEL,aAAe,EAAA,cAAA,CAAA;AAAA,MACb,SAAW,EAAA,YAAA;AAAA,KACP,EAAA,CAAA,EAAA,GAAA,IAAA,CAAK,aAAL,KAAA,IAAA,GAAA,EAAA,GAAsB,EAAC,CAAA;AA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C,CAAA;AAAA,GACzE,CAAA;AACF,CAAA;AAMO,SAAS,UAAa,KAAyC,EAAA;AACpE,EAAO,OAAA,KAAA,KAAU,UAAa,KAAU,KAAA,IAAA,CAAA;AAC1C;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-c7662a47.esm.js","sources":["../src/utils.ts"],"sourcesContent":["import type
|
|
1
|
+
{"version":3,"file":"utils-c7662a47.esm.js","sources":["../src/utils.ts"],"sourcesContent":["import { type CodeComponentMeta } from \"@plasmicapp/host\";\nimport registerComponent from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\n\nexport type HasControlContextData<T = BaseControlContextData> = {\n setControlContextData?: (ctxData: T) => void;\n};\n\nexport type BaseControlContextData = {\n parent?: {\n isDisabled?: boolean;\n isReadOnly?: boolean;\n };\n};\n\nexport type Registerable = {\n registerComponent: typeof registerComponent;\n};\n\nexport type OtherCodeComponentsMeta = {\n text: CodeComponentMeta<any>;\n description: CodeComponentMeta<any>;\n};\n\nexport type CodeComponentMetaOverrides<T extends React.ComponentType<any>> =\n Partial<\n Pick<\n CodeComponentMeta<React.ComponentProps<T>>,\n \"parentComponentName\" | \"props\" | \"displayName\" | \"name\"\n >\n >;\n\nexport function registerComponentHelper<T extends React.ComponentType<any>>(\n loader: Registerable | undefined,\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>,\n overrides?: CodeComponentMetaOverrides<T>\n) {\n meta = {\n ...meta,\n defaultStyles: {\n boxSizing: \"border-box\",\n ...(meta.defaultStyles ?? {}),\n },\n };\n if (overrides) {\n meta = {\n ...meta,\n ...overrides,\n props: {\n ...meta.props,\n ...overrides.props,\n },\n };\n if (overrides.parentComponentName) {\n meta.name = makeChildComponentName(\n overrides.parentComponentName,\n meta.name\n );\n }\n }\n if (loader) {\n loader.registerComponent(component, meta);\n } else {\n registerComponent(component, meta);\n }\n return meta;\n}\n\nexport function makeComponentName(name: string) {\n return `plasmic-react-aria-${name}`;\n}\n\nexport function makeChildComponentName(\n fullParentName: string | undefined,\n fullChildName: string\n) {\n if (!fullParentName) {\n return fullChildName;\n }\n return `${fullParentName}-${fullChildName.replace(\n \"plasmic-react-aria-\",\n \"\"\n )}`;\n}\n\nexport interface Styleable {\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport function extractPlasmicDataProps(props: Record<string, any>) {\n return Object.fromEntries(\n Object.entries(props).filter(([key]) => key.startsWith(\"data-plasmic-\"))\n );\n}\n\nexport function withoutNils<T>(array: (T | undefined | null)[]) {\n return array.filter((x): x is T => x != null);\n}\n\nexport function isDefined<T>(thing: T | undefined | null): thing is T {\n return thing !== undefined && thing !== null;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgCO,SAAS,uBACd,CAAA,MAAA,EACA,SACA,EAAA,IAAA,EACA,SACA,EAAA;AArCF,EAAA,IAAA,EAAA,CAAA;AAsCE,EAAA,IAAA,GAAO,iCACF,IADE,CAAA,EAAA;AAAA,IAEL,aAAe,EAAA,cAAA,CAAA;AAAA,MACb,SAAW,EAAA,YAAA;AAAA,KACP,EAAA,CAAA,EAAA,GAAA,IAAA,CAAK,aAAL,KAAA,IAAA,GAAA,EAAA,GAAsB,EAAC,CAAA;AAAA,GAE/B,CAAA,CAAA;AACA,EAAA,IAAI,SAAW,EAAA;AACb,IAAO,IAAA,GAAA,aAAA,CAAA,cAAA,CAAA,cAAA,CAAA,EAAA,EACF,OACA,SAFE,CAAA,EAAA;AAAA,MAGL,KAAO,EAAA,cAAA,CAAA,cAAA,CAAA,EAAA,EACF,IAAK,CAAA,KAAA,CAAA,EACL,SAAU,CAAA,KAAA,CAAA;AAAA,KAEjB,CAAA,CAAA;AACA,IAAA,IAAI,UAAU,mBAAqB,EAAA;AACjC,MAAA,IAAA,CAAK,IAAO,GAAA,sBAAA;AAAA,QACV,SAAU,CAAA,mBAAA;AAAA,QACV,IAAK,CAAA,IAAA;AAAA,OACP,CAAA;AAAA,KACF;AAAA,GACF;AACA,EAAA,IAAI,MAAQ,EAAA;AACV,IAAO,MAAA,CAAA,iBAAA,CAAkB,WAAW,IAAI,CAAA,CAAA;AAAA,GACnC,MAAA;AACL,IAAA,iBAAA,CAAkB,WAAW,IAAI,CAAA,CAAA;AAAA,GACnC;AACA,EAAO,OAAA,IAAA,CAAA;AACT,CAAA;AAEO,SAAS,kBAAkB,IAAc,EAAA;AAC9C,EAAA,OAAO,CAAsB,mBAAA,EAAA,IAAA,CAAA,CAAA,CAAA;AAC/B,CAAA;AAEgB,SAAA,sBAAA,CACd,gBACA,aACA,EAAA;AACA,EAAA,IAAI,CAAC,cAAgB,EAAA;AACnB,IAAO,OAAA,aAAA,CAAA;AAAA,GACT;AACA,EAAO,OAAA,CAAA,EAAG,kBAAkB,aAAc,CAAA,OAAA;AAAA,IACxC,qBAAA;AAAA,IACA,EAAA;AAAA,GACF,CAAA,CAAA,CAAA;AACF,CAAA;AAOO,SAAS,wBAAwB,KAA4B,EAAA;AAClE,EAAA,OAAO,MAAO,CAAA,WAAA;AAAA,IACZ,MAAO,CAAA,OAAA,CAAQ,KAAK,CAAA,CAAE,MAAO,CAAA,CAAC,CAAC,GAAG,CAAM,KAAA,GAAA,CAAI,UAAW,CAAA,eAAe,CAAC,CAAA;AAAA,GACzE,CAAA;AACF,CAAA;AAMO,SAAS,UAAa,KAAyC,EAAA;AACpE,EAAO,OAAA,KAAA,KAAU,UAAa,KAAU,KAAA,IAAA,CAAA;AAC1C;;;;"}
|
package/skinny/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CodeComponentMeta } from "@plasmicapp/host";
|
|
2
2
|
import registerComponent from "@plasmicapp/host/registerComponent";
|
|
3
3
|
import React from "react";
|
|
4
4
|
export type HasControlContextData<T = BaseControlContextData> = {
|