@plasmicpkgs/react-aria 0.0.98 → 0.0.100
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 +190 -122
- package/dist/react-aria.esm.js.map +1 -1
- package/dist/react-aria.js +188 -120
- package/dist/react-aria.js.map +1 -1
- package/dist/registerButton.d.ts +10 -3
- package/dist/registerHeading.d.ts +1 -1
- package/package.json +2 -2
- package/skinny/registerButton.cjs.js +89 -22
- package/skinny/registerButton.cjs.js.map +1 -1
- package/skinny/registerButton.d.ts +10 -3
- package/skinny/registerButton.esm.js +90 -23
- package/skinny/registerButton.esm.js.map +1 -1
- package/skinny/registerComboBox.cjs.js +1 -1
- package/skinny/registerComboBox.esm.js +1 -1
- package/skinny/registerDialogTrigger.cjs.js +0 -1
- package/skinny/registerDialogTrigger.cjs.js.map +1 -1
- package/skinny/registerDialogTrigger.esm.js +0 -1
- package/skinny/registerDialogTrigger.esm.js.map +1 -1
- package/skinny/registerHeading.cjs.js +1 -2
- package/skinny/registerHeading.cjs.js.map +1 -1
- package/skinny/registerHeading.d.ts +1 -1
- package/skinny/registerHeading.esm.js +3 -3
- package/skinny/registerHeading.esm.js.map +1 -1
- package/skinny/registerModal.cjs.js +3 -3
- package/skinny/registerModal.cjs.js.map +1 -1
- package/skinny/registerModal.esm.js +3 -3
- package/skinny/registerModal.esm.js.map +1 -1
- package/skinny/registerSelect.cjs.js +1 -1
- package/skinny/registerSelect.esm.js +1 -1
package/dist/registerButton.d.ts
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { ButtonProps } from "react-aria-components";
|
|
2
|
+
import type { ButtonProps, LinkProps } from "react-aria-components";
|
|
3
3
|
import { CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
4
4
|
import { WithVariants } from "./variant-utils";
|
|
5
5
|
declare const BUTTON_VARIANTS: ("disabled" | "hovered" | "pressed" | "focused" | "focusVisible")[];
|
|
6
|
-
|
|
6
|
+
type CommonProps = {
|
|
7
7
|
children: React.ReactNode;
|
|
8
|
+
} & Omit<ButtonProps, "className" | "children"> & Omit<LinkProps, "className" | "children">;
|
|
9
|
+
type LinkSpecificProps = Pick<LinkProps, "href" | "target">;
|
|
10
|
+
type ButtonSpecificProps = {
|
|
8
11
|
resetsForm?: boolean;
|
|
9
12
|
submitsForm?: boolean;
|
|
13
|
+
};
|
|
14
|
+
interface BaseButtonProps extends CommonProps, LinkSpecificProps, ButtonSpecificProps, WithVariants<typeof BUTTON_VARIANTS> {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
className?: string;
|
|
10
17
|
}
|
|
11
|
-
export declare const BaseButton: React.ForwardRefExoticComponent<BaseButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
18
|
+
export declare const BaseButton: React.ForwardRefExoticComponent<BaseButtonProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
12
19
|
export declare const BUTTON_COMPONENT_NAME: string;
|
|
13
20
|
export declare function registerButton(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BaseButton>): void;
|
|
14
21
|
export {};
|
|
@@ -2,5 +2,5 @@ import React from "react";
|
|
|
2
2
|
import type { HeadingProps } from "react-aria-components";
|
|
3
3
|
import { CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
4
4
|
export declare function BaseHeading({ children, ...rest }: HeadingProps): React.JSX.Element;
|
|
5
|
-
|
|
5
|
+
/** @deprecated Use Plasmic's built-in `Text` component instead */
|
|
6
6
|
export declare function registerHeading(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BaseHeading>): import("@plasmicapp/host").CodeComponentMeta<HeadingProps>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/react-aria",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"description": "Plasmic registration calls for react-aria based components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "677335e0728f1aae092989b044bb4bc40a5d72ce"
|
|
78
78
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var host = require('@plasmicapp/host');
|
|
3
4
|
var React = require('react');
|
|
4
5
|
var reactAria = require('react-aria');
|
|
5
6
|
var reactAriaComponents = require('react-aria-components');
|
|
6
7
|
var common = require('./common-b3b54c72.cjs.js');
|
|
7
8
|
var utils = require('./utils-7d000fa4.cjs.js');
|
|
8
9
|
var variantUtils = require('./variant-utils-0ad70db8.cjs.js');
|
|
9
|
-
require('@plasmicapp/host');
|
|
10
10
|
require('@plasmicapp/host/registerComponent');
|
|
11
11
|
|
|
12
12
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -53,24 +53,73 @@ const BUTTON_VARIANTS = [
|
|
|
53
53
|
];
|
|
54
54
|
const { variants, withObservedValues } = variantUtils.pickAriaComponentVariants(BUTTON_VARIANTS);
|
|
55
55
|
const BaseButton = React__default.default.forwardRef(function BaseButtonInner(props, ref) {
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
const { href } = props;
|
|
57
|
+
if (href) {
|
|
58
|
+
return /* @__PURE__ */ React__default.default.createElement(
|
|
59
|
+
LinkButton,
|
|
60
|
+
{
|
|
61
|
+
props,
|
|
62
|
+
ref
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
} else {
|
|
66
|
+
const _a = props, { submitsForm, resetsForm, children, plasmicUpdateVariant } = _a, rest = __objRest(_a, ["submitsForm", "resetsForm", "children", "plasmicUpdateVariant"]);
|
|
67
|
+
const type = submitsForm ? "submit" : resetsForm ? "reset" : "button";
|
|
68
|
+
const buttonProps = reactAria.mergeProps(rest, {
|
|
69
|
+
type,
|
|
70
|
+
style: common.COMMON_STYLES,
|
|
71
|
+
ref
|
|
72
|
+
});
|
|
73
|
+
return /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.Button, __spreadValues({}, buttonProps), ({ isHovered, isPressed, isFocused, isFocusVisible, isDisabled }) => withObservedValues(
|
|
74
|
+
children,
|
|
75
|
+
{
|
|
76
|
+
hovered: isHovered,
|
|
77
|
+
pressed: isPressed,
|
|
78
|
+
focused: isFocused,
|
|
79
|
+
focusVisible: isFocusVisible,
|
|
80
|
+
disabled: isDisabled
|
|
81
|
+
},
|
|
82
|
+
plasmicUpdateVariant
|
|
83
|
+
));
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
function LinkButton({
|
|
87
|
+
props,
|
|
88
|
+
ref
|
|
89
|
+
}) {
|
|
90
|
+
const _a = props, { href, children, plasmicUpdateVariant } = _a, rest = __objRest(_a, ["href", "children", "plasmicUpdateVariant"]);
|
|
91
|
+
const PlasmicLink = host.usePlasmicLink();
|
|
92
|
+
const { linkProps, isPressed } = reactAria.useLink(props, ref);
|
|
93
|
+
const { hoverProps, isHovered } = reactAria.useHover(props);
|
|
94
|
+
const { focusProps, isFocused, isFocusVisible } = reactAria.useFocusRing();
|
|
95
|
+
const combinedLinkProps = reactAria.mergeProps(linkProps, hoverProps, focusProps, {
|
|
96
|
+
href,
|
|
97
|
+
className: props.className,
|
|
98
|
+
style: common.COMMON_STYLES,
|
|
60
99
|
ref
|
|
61
100
|
});
|
|
62
|
-
return /* @__PURE__ */ React__default.default.createElement(
|
|
63
|
-
|
|
64
|
-
{
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
disabled: isDisabled
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
101
|
+
return /* @__PURE__ */ React__default.default.createElement(
|
|
102
|
+
PlasmicLink,
|
|
103
|
+
__spreadProps(__spreadValues({}, combinedLinkProps), {
|
|
104
|
+
"data-focused": isFocused || void 0,
|
|
105
|
+
"data-hovered": isHovered || void 0,
|
|
106
|
+
"data-pressed": isPressed || void 0,
|
|
107
|
+
"data-focus-visible": isFocusVisible || void 0,
|
|
108
|
+
"data-disabled": props.isDisabled || void 0
|
|
109
|
+
}),
|
|
110
|
+
withObservedValues(
|
|
111
|
+
children,
|
|
112
|
+
{
|
|
113
|
+
hovered: isHovered,
|
|
114
|
+
pressed: isPressed,
|
|
115
|
+
focused: isFocused,
|
|
116
|
+
focusVisible: isFocusVisible,
|
|
117
|
+
disabled: !!rest.isDisabled
|
|
118
|
+
},
|
|
119
|
+
plasmicUpdateVariant
|
|
120
|
+
)
|
|
121
|
+
);
|
|
122
|
+
}
|
|
74
123
|
const BUTTON_COMPONENT_NAME = utils.makeComponentName("button");
|
|
75
124
|
function registerButton(loader, overrides) {
|
|
76
125
|
utils.registerComponentHelper(
|
|
@@ -83,11 +132,18 @@ function registerButton(loader, overrides) {
|
|
|
83
132
|
importName: "BaseButton",
|
|
84
133
|
variants,
|
|
85
134
|
defaultStyles: {
|
|
86
|
-
|
|
87
|
-
|
|
135
|
+
// Ensure consistent design across rendered elements (button, anchor tag).
|
|
136
|
+
backgroundColor: "#EFEFEF",
|
|
88
137
|
borderColor: "black",
|
|
138
|
+
borderStyle: "solid",
|
|
139
|
+
borderWidth: "1px",
|
|
140
|
+
color: "#000000",
|
|
141
|
+
cursor: "pointer",
|
|
142
|
+
fontFamily: "Arial",
|
|
143
|
+
fontSize: "1rem",
|
|
144
|
+
lineHeight: "1.2",
|
|
89
145
|
padding: "2px 10px",
|
|
90
|
-
|
|
146
|
+
textDecorationLine: "none"
|
|
91
147
|
},
|
|
92
148
|
props: __spreadProps(__spreadValues({}, common.getCommonProps("button", [
|
|
93
149
|
"autoFocus",
|
|
@@ -102,11 +158,22 @@ function registerButton(loader, overrides) {
|
|
|
102
158
|
value: "Button"
|
|
103
159
|
}
|
|
104
160
|
},
|
|
161
|
+
href: {
|
|
162
|
+
type: "href",
|
|
163
|
+
description: "The URL this button navigates to. If present, this button is an <a> element."
|
|
164
|
+
},
|
|
165
|
+
target: {
|
|
166
|
+
type: "choice",
|
|
167
|
+
options: ["_blank", "_self", "_parent", "_top"],
|
|
168
|
+
description: "Same as target attribute of <a> element. Only applies when the href prop is present.",
|
|
169
|
+
hidden: (props) => !props.href,
|
|
170
|
+
defaultValueHint: "_self"
|
|
171
|
+
},
|
|
105
172
|
submitsForm: {
|
|
106
173
|
type: "boolean",
|
|
107
174
|
displayName: "Submits form?",
|
|
108
175
|
defaultValueHint: false,
|
|
109
|
-
hidden: (props) => Boolean(props.resetsForm),
|
|
176
|
+
hidden: (props) => Boolean(props.resetsForm) || Boolean(props.href),
|
|
110
177
|
description: "Whether clicking this button should submit the enclosing form.",
|
|
111
178
|
advanced: true
|
|
112
179
|
},
|
|
@@ -114,7 +181,7 @@ function registerButton(loader, overrides) {
|
|
|
114
181
|
type: "boolean",
|
|
115
182
|
displayName: "Resets form?",
|
|
116
183
|
defaultValueHint: false,
|
|
117
|
-
hidden: (props) => Boolean(props.submitsForm),
|
|
184
|
+
hidden: (props) => Boolean(props.submitsForm) || Boolean(props.href),
|
|
118
185
|
description: "Whether clicking this button should reset the enclosing form.",
|
|
119
186
|
advanced: true
|
|
120
187
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerButton.cjs.js","sources":["../src/registerButton.tsx"],"sourcesContent":["import React from \"react\";\nimport { mergeProps } from \"react-aria\";\nimport type { ButtonProps } from \"react-aria-components\";\nimport { Button } from \"react-aria-components\";\nimport { COMMON_STYLES, getCommonProps } from \"./common\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst BUTTON_VARIANTS = [\n \"hovered\" as const,\n \"pressed\" as const,\n \"focused\" as const,\n \"focusVisible\" as const,\n \"disabled\" as const,\n];\n\nconst { variants, withObservedValues } =\n pickAriaComponentVariants(BUTTON_VARIANTS);\n\ninterface BaseButtonProps\n extends ButtonProps,\n WithVariants<typeof BUTTON_VARIANTS> {\n children: React.ReactNode;\n resetsForm?: boolean;\n submitsForm?: boolean;\n}\n\nexport const BaseButton = React.forwardRef(function BaseButtonInner(\n props: BaseButtonProps,\n ref: React.Ref<HTMLButtonElement>\n) {\n const { submitsForm, resetsForm, children, plasmicUpdateVariant, ...rest } =\n props;\n\n const type = submitsForm ? \"submit\" : resetsForm ? \"reset\" : \"button\";\n\n const mergedProps = mergeProps(rest, {\n type,\n ref,\n });\n\n return (\n <Button {...mergedProps} style={COMMON_STYLES}>\n {({ isHovered, isPressed, isFocused, isFocusVisible, isDisabled }) =>\n withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n disabled: isDisabled,\n },\n plasmicUpdateVariant\n )\n }\n </Button>\n );\n});\n\nexport const BUTTON_COMPONENT_NAME = makeComponentName(\"button\");\n\nexport function registerButton(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseButton>\n) {\n registerComponentHelper(\n loader,\n BaseButton,\n {\n name: BUTTON_COMPONENT_NAME,\n displayName: \"Aria Button\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerButton\",\n importName: \"BaseButton\",\n variants,\n defaultStyles: {\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n padding: \"2px 10px\",\n cursor: \"pointer\",\n },\n props: {\n ...getCommonProps<BaseButtonProps>(\"button\", [\n \"autoFocus\",\n \"isDisabled\",\n \"aria-label\",\n ]),\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: {\n type: \"text\",\n value: \"Button\",\n },\n },\n submitsForm: {\n type: \"boolean\",\n displayName: \"Submits form?\",\n defaultValueHint: false,\n hidden: (props) => Boolean(props.resetsForm),\n description:\n \"Whether clicking this button should submit the enclosing form.\",\n advanced: true,\n },\n resetsForm: {\n type: \"boolean\",\n displayName: \"Resets form?\",\n defaultValueHint: false,\n hidden: (props) => Boolean(props.submitsForm),\n description:\n \"Whether clicking this button should reset the enclosing form.\",\n advanced: true,\n },\n onPress: {\n type: \"eventHandler\",\n argTypes: [{ name: \"event\", type: \"object\" }],\n },\n onFocus: {\n type: \"eventHandler\",\n argTypes: [{ name: \"event\", type: \"object\" }],\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["pickAriaComponentVariants","React","mergeProps","Button","COMMON_STYLES","makeComponentName","registerComponentHelper","getCommonProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAM,eAAkB,GAAA;AAAA,EACtB,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAA,EAAU,kBAAmB,EAAA,GACnCA,uCAA0B,eAAe,CAAA,CAAA;AAUpC,MAAM,aAAaC,sBAAM,CAAA,UAAA,CAAW,SAAS,eAAA,CAClD,OACA,GACA,EAAA;AACA,EAAA,MACE,EADM,GAAA,KAAA,EAAA,EAAA,WAAA,EAAa,UAAY,EAAA,QAAA,EAAU,oBApC7C,EAAA,GAqCI,EADkE,EAAA,IAAA,GAAA,SAAA,CAClE,EADkE,EAAA,CAA5D,aAAa,EAAA,YAAA,EAAY,UAAU,EAAA,sBAAA,CAAA,CAAA,CAAA;AAG3C,EAAA,MAAM,IAAO,GAAA,WAAA,GAAc,QAAW,GAAA,UAAA,GAAa,OAAU,GAAA,QAAA,CAAA;AAE7D,EAAM,MAAA,WAAA,GAAcC,qBAAW,IAAM,EAAA;AAAA,IACnC,IAAA;AAAA,IACA,GAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAA,uBACGD,sBAAA,CAAA,aAAA,CA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,EAAA,QAAA;AAAA,WACT;AAAA,SACF;AAAA,QACA,WAAa,EAAA;AAAA,UACX,IAAM,EAAA,SAAA;AAAA,UACN,WAAa,EAAA,eAAA;AAAA,UACb,gBAAkB,EAAA,KAAA;AAAA,UAClB,MAAQ,EAAA,CAAC,KAAU,KAAA,OAAA,CAAQ,MAAM,UAAU,CAAA;AAAA,UAC3C,WACE,EAAA,gEAAA;AAAA,UACF,QAAU,EAAA,IAAA;AAAA,SACZ;AAAA,QACA,UAAY,EAAA;AAAA,UACV,IAAM,EAAA,SAAA;AAAA,UACN,WAAa,EAAA,cAAA;AAAA,UACb,gBAAkB,EAAA,KAAA;AAAA,UAClB,MAAQ,EAAA,CAAC,KAAU,KAAA,OAAA,CAAQ,MAAM,WAAW,CAAA;AAAA,UAC5C,WACE,EAAA,+DAAA;AAAA,UACF,QAAU,EAAA,IAAA;AAAA,SACZ;AAAA,QACA,OAAS,EAAA;AAAA,UACP,IAAM,EAAA,cAAA;AAAA,UACN,UAAU,CAAC,EAAE,MAAM,OAAS,EAAA,IAAA,EAAM,UAAU,CAAA;AAAA,SAC9C;AAAA,QACA,OAAS,EAAA;AAAA,UACP,IAAM,EAAA,cAAA;AAAA,UACN,UAAU,CAAC,EAAE,MAAM,OAAS,EAAA,IAAA,EAAM,UAAU,CAAA;AAAA,SAC9C;AAAA,OACF,CAAA;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;;"}
|
|
1
|
+
{"version":3,"file":"registerButton.cjs.js","sources":["../src/registerButton.tsx"],"sourcesContent":["import { usePlasmicLink } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport { mergeProps, useFocusRing, useHover, useLink } from \"react-aria\";\nimport type { ButtonProps, LinkProps } from \"react-aria-components\";\nimport { Button } from \"react-aria-components\";\nimport { COMMON_STYLES, getCommonProps } from \"./common\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst BUTTON_VARIANTS = [\n \"hovered\" as const,\n \"pressed\" as const,\n \"focused\" as const,\n \"focusVisible\" as const,\n \"disabled\" as const,\n];\n\nconst { variants, withObservedValues } =\n pickAriaComponentVariants(BUTTON_VARIANTS);\n\ntype CommonProps = { children: React.ReactNode } & Omit<\n ButtonProps,\n \"className\" | \"children\"\n> &\n Omit<LinkProps, \"className\" | \"children\">;\ntype LinkSpecificProps = Pick<LinkProps, \"href\" | \"target\">;\ntype ButtonSpecificProps = {\n resetsForm?: boolean;\n submitsForm?: boolean;\n};\n\ninterface BaseButtonProps\n extends CommonProps,\n LinkSpecificProps,\n ButtonSpecificProps,\n WithVariants<typeof BUTTON_VARIANTS> {\n children: React.ReactNode;\n className?: string;\n}\n\nexport const BaseButton = React.forwardRef(function BaseButtonInner(\n props: BaseButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n) {\n const { href } = props;\n\n if (href) {\n return (\n <LinkButton\n props={props}\n ref={ref as React.RefObject<HTMLAnchorElement>}\n />\n );\n } else {\n const { submitsForm, resetsForm, children, plasmicUpdateVariant, ...rest } =\n props;\n const type = submitsForm ? \"submit\" : resetsForm ? \"reset\" : \"button\";\n\n const buttonProps = mergeProps(rest, {\n type,\n style: COMMON_STYLES,\n ref: ref as React.Ref<HTMLButtonElement>,\n });\n\n return (\n <Button {...buttonProps}>\n {({ isHovered, isPressed, isFocused, isFocusVisible, isDisabled }) =>\n withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n disabled: isDisabled,\n },\n plasmicUpdateVariant\n )\n }\n </Button>\n );\n }\n});\n\nfunction LinkButton({\n props,\n ref,\n}: {\n props: BaseButtonProps;\n ref: React.RefObject<HTMLAnchorElement>;\n}) {\n const { href, children, plasmicUpdateVariant, ...rest } = props;\n const PlasmicLink = usePlasmicLink();\n const { linkProps, isPressed } = useLink(props, ref);\n const { hoverProps, isHovered } = useHover(props);\n const { focusProps, isFocused, isFocusVisible } = useFocusRing();\n\n const combinedLinkProps = mergeProps(linkProps, hoverProps, focusProps, {\n href,\n className: props.className,\n style: COMMON_STYLES,\n ref,\n });\n\n return (\n <PlasmicLink\n {...combinedLinkProps}\n data-focused={isFocused || undefined}\n data-hovered={isHovered || undefined}\n data-pressed={isPressed || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n >\n {withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n disabled: !!rest.isDisabled,\n },\n plasmicUpdateVariant\n )}\n </PlasmicLink>\n );\n}\n\nexport const BUTTON_COMPONENT_NAME = makeComponentName(\"button\");\n\nexport function registerButton(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseButton>\n) {\n registerComponentHelper(\n loader,\n BaseButton,\n {\n name: BUTTON_COMPONENT_NAME,\n displayName: \"Aria Button\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerButton\",\n importName: \"BaseButton\",\n variants,\n defaultStyles: {\n // Ensure consistent design across rendered elements (button, anchor tag).\n backgroundColor: \"#EFEFEF\",\n borderColor: \"black\",\n borderStyle: \"solid\",\n borderWidth: \"1px\",\n color: \"#000000\",\n cursor: \"pointer\",\n fontFamily: \"Arial\",\n fontSize: \"1rem\",\n lineHeight: \"1.2\",\n padding: \"2px 10px\",\n textDecorationLine: \"none\",\n },\n props: {\n ...getCommonProps<BaseButtonProps>(\"button\", [\n \"autoFocus\",\n \"isDisabled\",\n \"aria-label\",\n ]),\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: {\n type: \"text\",\n value: \"Button\",\n },\n },\n href: {\n type: \"href\",\n description:\n \"The URL this button navigates to. If present, this button is an <a> element.\",\n },\n target: {\n type: \"choice\",\n options: [\"_blank\", \"_self\", \"_parent\", \"_top\"],\n description:\n \"Same as target attribute of <a> element. Only applies when the href prop is present.\",\n hidden: (props) => !props.href,\n defaultValueHint: \"_self\",\n },\n submitsForm: {\n type: \"boolean\",\n displayName: \"Submits form?\",\n defaultValueHint: false,\n hidden: (props) => Boolean(props.resetsForm) || Boolean(props.href),\n description:\n \"Whether clicking this button should submit the enclosing form.\",\n advanced: true,\n },\n resetsForm: {\n type: \"boolean\",\n displayName: \"Resets form?\",\n defaultValueHint: false,\n hidden: (props) => Boolean(props.submitsForm) || Boolean(props.href),\n description:\n \"Whether clicking this button should reset the enclosing form.\",\n advanced: true,\n },\n onPress: {\n type: \"eventHandler\",\n argTypes: [{ name: \"event\", type: \"object\" }],\n },\n onFocus: {\n type: \"eventHandler\",\n argTypes: [{ name: \"event\", type: \"object\" }],\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["pickAriaComponentVariants","React","mergeProps","COMMON_STYLES","Button","usePlasmicLink","useLink","useHover","useFocusRing","makeComponentName","registerComponentHelper","getCommonProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAM,eAAkB,GAAA;AAAA,EACtB,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAA,EAAU,kBAAmB,EAAA,GACnCA,uCAA0B,eAAe,CAAA,CAAA;AAsBpC,MAAM,aAAaC,sBAAM,CAAA,UAAA,CAAW,SAAS,eAAA,CAClD,OACA,GACA,EAAA;AACA,EAAM,MAAA,EAAE,MAAS,GAAA,KAAA,CAAA;AAEjB,EAAA,IAAI,IAAM,EAAA;AACR,IACE,uBAAAA,sBAAA,CAAA,aAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,KAAA;AAAA,QACA,GAAA;AAAA,OAAA;AAAA,KACF,CAAA;AAAA,GAEG,MAAA;AACL,IAAA,MACE,EADM,GAAA,KAAA,EAAA,EA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,EAAA,SAAA;AAAA,UACN,WAAa,EAAA,eAAA;AAAA,UACb,gBAAkB,EAAA,KAAA;AAAA,UAClB,MAAA,EAAQ,CAAC,KAAU,KAAA,OAAA,CAAQ,MAAM,UAAU,CAAA,IAAK,OAAQ,CAAA,KAAA,CAAM,IAAI,CAAA;AAAA,UAClE,WACE,EAAA,gEAAA;AAAA,UACF,QAAU,EAAA,IAAA;AAAA,SACZ;AAAA,QACA,UAAY,EAAA;AAAA,UACV,IAAM,EAAA,SAAA;AAAA,UACN,WAAa,EAAA,cAAA;AAAA,UACb,gBAAkB,EAAA,KAAA;AAAA,UAClB,MAAA,EAAQ,CAAC,KAAU,KAAA,OAAA,CAAQ,MAAM,WAAW,CAAA,IAAK,OAAQ,CAAA,KAAA,CAAM,IAAI,CAAA;AAAA,UACnE,WACE,EAAA,+DAAA;AAAA,UACF,QAAU,EAAA,IAAA;AAAA,SACZ;AAAA,QACA,OAAS,EAAA;AAAA,UACP,IAAM,EAAA,cAAA;AAAA,UACN,UAAU,CAAC,EAAE,MAAM,OAAS,EAAA,IAAA,EAAM,UAAU,CAAA;AAAA,SAC9C;AAAA,QACA,OAAS,EAAA;AAAA,UACP,IAAM,EAAA,cAAA;AAAA,UACN,UAAU,CAAC,EAAE,MAAM,OAAS,EAAA,IAAA,EAAM,UAAU,CAAA;AAAA,SAC9C;AAAA,OACF,CAAA;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;;"}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { ButtonProps } from "react-aria-components";
|
|
2
|
+
import type { ButtonProps, LinkProps } from "react-aria-components";
|
|
3
3
|
import { CodeComponentMetaOverrides, Registerable } from "./utils";
|
|
4
4
|
import { WithVariants } from "./variant-utils";
|
|
5
5
|
declare const BUTTON_VARIANTS: ("disabled" | "hovered" | "pressed" | "focused" | "focusVisible")[];
|
|
6
|
-
|
|
6
|
+
type CommonProps = {
|
|
7
7
|
children: React.ReactNode;
|
|
8
|
+
} & Omit<ButtonProps, "className" | "children"> & Omit<LinkProps, "className" | "children">;
|
|
9
|
+
type LinkSpecificProps = Pick<LinkProps, "href" | "target">;
|
|
10
|
+
type ButtonSpecificProps = {
|
|
8
11
|
resetsForm?: boolean;
|
|
9
12
|
submitsForm?: boolean;
|
|
13
|
+
};
|
|
14
|
+
interface BaseButtonProps extends CommonProps, LinkSpecificProps, ButtonSpecificProps, WithVariants<typeof BUTTON_VARIANTS> {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
className?: string;
|
|
10
17
|
}
|
|
11
|
-
export declare const BaseButton: React.ForwardRefExoticComponent<BaseButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
18
|
+
export declare const BaseButton: React.ForwardRefExoticComponent<BaseButtonProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
12
19
|
export declare const BUTTON_COMPONENT_NAME: string;
|
|
13
20
|
export declare function registerButton(loader?: Registerable, overrides?: CodeComponentMetaOverrides<typeof BaseButton>): void;
|
|
14
21
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { usePlasmicLink } from '@plasmicapp/host';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import { mergeProps } from 'react-aria';
|
|
3
|
+
import { mergeProps, useLink, useHover, useFocusRing } from 'react-aria';
|
|
3
4
|
import { Button } from 'react-aria-components';
|
|
4
5
|
import { C as COMMON_STYLES, g as getCommonProps } from './common-ceebbaea.esm.js';
|
|
5
6
|
import { m as makeComponentName, r as registerComponentHelper } from './utils-5d1b4c6b.esm.js';
|
|
6
7
|
import { p as pickAriaComponentVariants } from './variant-utils-4405ebb0.esm.js';
|
|
7
|
-
import '@plasmicapp/host';
|
|
8
8
|
import '@plasmicapp/host/registerComponent';
|
|
9
9
|
|
|
10
10
|
var __defProp = Object.defineProperty;
|
|
@@ -47,24 +47,73 @@ const BUTTON_VARIANTS = [
|
|
|
47
47
|
];
|
|
48
48
|
const { variants, withObservedValues } = pickAriaComponentVariants(BUTTON_VARIANTS);
|
|
49
49
|
const BaseButton = React.forwardRef(function BaseButtonInner(props, ref) {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
const { href } = props;
|
|
51
|
+
if (href) {
|
|
52
|
+
return /* @__PURE__ */ React.createElement(
|
|
53
|
+
LinkButton,
|
|
54
|
+
{
|
|
55
|
+
props,
|
|
56
|
+
ref
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
} else {
|
|
60
|
+
const _a = props, { submitsForm, resetsForm, children, plasmicUpdateVariant } = _a, rest = __objRest(_a, ["submitsForm", "resetsForm", "children", "plasmicUpdateVariant"]);
|
|
61
|
+
const type = submitsForm ? "submit" : resetsForm ? "reset" : "button";
|
|
62
|
+
const buttonProps = mergeProps(rest, {
|
|
63
|
+
type,
|
|
64
|
+
style: COMMON_STYLES,
|
|
65
|
+
ref
|
|
66
|
+
});
|
|
67
|
+
return /* @__PURE__ */ React.createElement(Button, __spreadValues({}, buttonProps), ({ isHovered, isPressed, isFocused, isFocusVisible, isDisabled }) => withObservedValues(
|
|
68
|
+
children,
|
|
69
|
+
{
|
|
70
|
+
hovered: isHovered,
|
|
71
|
+
pressed: isPressed,
|
|
72
|
+
focused: isFocused,
|
|
73
|
+
focusVisible: isFocusVisible,
|
|
74
|
+
disabled: isDisabled
|
|
75
|
+
},
|
|
76
|
+
plasmicUpdateVariant
|
|
77
|
+
));
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
function LinkButton({
|
|
81
|
+
props,
|
|
82
|
+
ref
|
|
83
|
+
}) {
|
|
84
|
+
const _a = props, { href, children, plasmicUpdateVariant } = _a, rest = __objRest(_a, ["href", "children", "plasmicUpdateVariant"]);
|
|
85
|
+
const PlasmicLink = usePlasmicLink();
|
|
86
|
+
const { linkProps, isPressed } = useLink(props, ref);
|
|
87
|
+
const { hoverProps, isHovered } = useHover(props);
|
|
88
|
+
const { focusProps, isFocused, isFocusVisible } = useFocusRing();
|
|
89
|
+
const combinedLinkProps = mergeProps(linkProps, hoverProps, focusProps, {
|
|
90
|
+
href,
|
|
91
|
+
className: props.className,
|
|
92
|
+
style: COMMON_STYLES,
|
|
54
93
|
ref
|
|
55
94
|
});
|
|
56
|
-
return /* @__PURE__ */ React.createElement(
|
|
57
|
-
|
|
58
|
-
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
disabled: isDisabled
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
95
|
+
return /* @__PURE__ */ React.createElement(
|
|
96
|
+
PlasmicLink,
|
|
97
|
+
__spreadProps(__spreadValues({}, combinedLinkProps), {
|
|
98
|
+
"data-focused": isFocused || void 0,
|
|
99
|
+
"data-hovered": isHovered || void 0,
|
|
100
|
+
"data-pressed": isPressed || void 0,
|
|
101
|
+
"data-focus-visible": isFocusVisible || void 0,
|
|
102
|
+
"data-disabled": props.isDisabled || void 0
|
|
103
|
+
}),
|
|
104
|
+
withObservedValues(
|
|
105
|
+
children,
|
|
106
|
+
{
|
|
107
|
+
hovered: isHovered,
|
|
108
|
+
pressed: isPressed,
|
|
109
|
+
focused: isFocused,
|
|
110
|
+
focusVisible: isFocusVisible,
|
|
111
|
+
disabled: !!rest.isDisabled
|
|
112
|
+
},
|
|
113
|
+
plasmicUpdateVariant
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
}
|
|
68
117
|
const BUTTON_COMPONENT_NAME = makeComponentName("button");
|
|
69
118
|
function registerButton(loader, overrides) {
|
|
70
119
|
registerComponentHelper(
|
|
@@ -77,11 +126,18 @@ function registerButton(loader, overrides) {
|
|
|
77
126
|
importName: "BaseButton",
|
|
78
127
|
variants,
|
|
79
128
|
defaultStyles: {
|
|
80
|
-
|
|
81
|
-
|
|
129
|
+
// Ensure consistent design across rendered elements (button, anchor tag).
|
|
130
|
+
backgroundColor: "#EFEFEF",
|
|
82
131
|
borderColor: "black",
|
|
132
|
+
borderStyle: "solid",
|
|
133
|
+
borderWidth: "1px",
|
|
134
|
+
color: "#000000",
|
|
135
|
+
cursor: "pointer",
|
|
136
|
+
fontFamily: "Arial",
|
|
137
|
+
fontSize: "1rem",
|
|
138
|
+
lineHeight: "1.2",
|
|
83
139
|
padding: "2px 10px",
|
|
84
|
-
|
|
140
|
+
textDecorationLine: "none"
|
|
85
141
|
},
|
|
86
142
|
props: __spreadProps(__spreadValues({}, getCommonProps("button", [
|
|
87
143
|
"autoFocus",
|
|
@@ -96,11 +152,22 @@ function registerButton(loader, overrides) {
|
|
|
96
152
|
value: "Button"
|
|
97
153
|
}
|
|
98
154
|
},
|
|
155
|
+
href: {
|
|
156
|
+
type: "href",
|
|
157
|
+
description: "The URL this button navigates to. If present, this button is an <a> element."
|
|
158
|
+
},
|
|
159
|
+
target: {
|
|
160
|
+
type: "choice",
|
|
161
|
+
options: ["_blank", "_self", "_parent", "_top"],
|
|
162
|
+
description: "Same as target attribute of <a> element. Only applies when the href prop is present.",
|
|
163
|
+
hidden: (props) => !props.href,
|
|
164
|
+
defaultValueHint: "_self"
|
|
165
|
+
},
|
|
99
166
|
submitsForm: {
|
|
100
167
|
type: "boolean",
|
|
101
168
|
displayName: "Submits form?",
|
|
102
169
|
defaultValueHint: false,
|
|
103
|
-
hidden: (props) => Boolean(props.resetsForm),
|
|
170
|
+
hidden: (props) => Boolean(props.resetsForm) || Boolean(props.href),
|
|
104
171
|
description: "Whether clicking this button should submit the enclosing form.",
|
|
105
172
|
advanced: true
|
|
106
173
|
},
|
|
@@ -108,7 +175,7 @@ function registerButton(loader, overrides) {
|
|
|
108
175
|
type: "boolean",
|
|
109
176
|
displayName: "Resets form?",
|
|
110
177
|
defaultValueHint: false,
|
|
111
|
-
hidden: (props) => Boolean(props.submitsForm),
|
|
178
|
+
hidden: (props) => Boolean(props.submitsForm) || Boolean(props.href),
|
|
112
179
|
description: "Whether clicking this button should reset the enclosing form.",
|
|
113
180
|
advanced: true
|
|
114
181
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerButton.esm.js","sources":["../src/registerButton.tsx"],"sourcesContent":["import React from \"react\";\nimport { mergeProps } from \"react-aria\";\nimport type { ButtonProps } from \"react-aria-components\";\nimport { Button } from \"react-aria-components\";\nimport { COMMON_STYLES, getCommonProps } from \"./common\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst BUTTON_VARIANTS = [\n \"hovered\" as const,\n \"pressed\" as const,\n \"focused\" as const,\n \"focusVisible\" as const,\n \"disabled\" as const,\n];\n\nconst { variants, withObservedValues } =\n pickAriaComponentVariants(BUTTON_VARIANTS);\n\ninterface BaseButtonProps\n extends ButtonProps,\n WithVariants<typeof BUTTON_VARIANTS> {\n children: React.ReactNode;\n resetsForm?: boolean;\n submitsForm?: boolean;\n}\n\nexport const BaseButton = React.forwardRef(function BaseButtonInner(\n props: BaseButtonProps,\n ref: React.Ref<HTMLButtonElement>\n) {\n const { submitsForm, resetsForm, children, plasmicUpdateVariant, ...rest } =\n props;\n\n const type = submitsForm ? \"submit\" : resetsForm ? \"reset\" : \"button\";\n\n const mergedProps = mergeProps(rest, {\n type,\n ref,\n });\n\n return (\n <Button {...mergedProps} style={COMMON_STYLES}>\n {({ isHovered, isPressed, isFocused, isFocusVisible, isDisabled }) =>\n withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n disabled: isDisabled,\n },\n plasmicUpdateVariant\n )\n }\n </Button>\n );\n});\n\nexport const BUTTON_COMPONENT_NAME = makeComponentName(\"button\");\n\nexport function registerButton(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseButton>\n) {\n registerComponentHelper(\n loader,\n BaseButton,\n {\n name: BUTTON_COMPONENT_NAME,\n displayName: \"Aria Button\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerButton\",\n importName: \"BaseButton\",\n variants,\n defaultStyles: {\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n padding: \"2px 10px\",\n cursor: \"pointer\",\n },\n props: {\n ...getCommonProps<BaseButtonProps>(\"button\", [\n \"autoFocus\",\n \"isDisabled\",\n \"aria-label\",\n ]),\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: {\n type: \"text\",\n value: \"Button\",\n },\n },\n submitsForm: {\n type: \"boolean\",\n displayName: \"Submits form?\",\n defaultValueHint: false,\n hidden: (props) => Boolean(props.resetsForm),\n description:\n \"Whether clicking this button should submit the enclosing form.\",\n advanced: true,\n },\n resetsForm: {\n type: \"boolean\",\n displayName: \"Resets form?\",\n defaultValueHint: false,\n hidden: (props) => Boolean(props.submitsForm),\n description:\n \"Whether clicking this button should reset the enclosing form.\",\n advanced: true,\n },\n onPress: {\n type: \"eventHandler\",\n argTypes: [{ name: \"event\", type: \"object\" }],\n },\n onFocus: {\n type: \"eventHandler\",\n argTypes: [{ name: \"event\", type: \"object\" }],\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAM,eAAkB,GAAA;AAAA,EACtB,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAA,EAAU,kBAAmB,EAAA,GACnC,0BAA0B,eAAe,CAAA,CAAA;AAUpC,MAAM,aAAa,KAAM,CAAA,UAAA,CAAW,SAAS,eAAA,CAClD,OACA,GACA,EAAA;AACA,EAAA,MACE,EADM,GAAA,KAAA,EAAA,EAAA,WAAA,EAAa,UAAY,EAAA,QAAA,EAAU,oBApC7C,EAAA,GAqCI,EADkE,EAAA,IAAA,GAA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AA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"registerButton.esm.js","sources":["../src/registerButton.tsx"],"sourcesContent":["import { usePlasmicLink } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport { mergeProps, useFocusRing, useHover, useLink } from \"react-aria\";\nimport type { ButtonProps, LinkProps } from \"react-aria-components\";\nimport { Button } from \"react-aria-components\";\nimport { COMMON_STYLES, getCommonProps } from \"./common\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst BUTTON_VARIANTS = [\n \"hovered\" as const,\n \"pressed\" as const,\n \"focused\" as const,\n \"focusVisible\" as const,\n \"disabled\" as const,\n];\n\nconst { variants, withObservedValues } =\n pickAriaComponentVariants(BUTTON_VARIANTS);\n\ntype CommonProps = { children: React.ReactNode } & Omit<\n ButtonProps,\n \"className\" | \"children\"\n> &\n Omit<LinkProps, \"className\" | \"children\">;\ntype LinkSpecificProps = Pick<LinkProps, \"href\" | \"target\">;\ntype ButtonSpecificProps = {\n resetsForm?: boolean;\n submitsForm?: boolean;\n};\n\ninterface BaseButtonProps\n extends CommonProps,\n LinkSpecificProps,\n ButtonSpecificProps,\n WithVariants<typeof BUTTON_VARIANTS> {\n children: React.ReactNode;\n className?: string;\n}\n\nexport const BaseButton = React.forwardRef(function BaseButtonInner(\n props: BaseButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n) {\n const { href } = props;\n\n if (href) {\n return (\n <LinkButton\n props={props}\n ref={ref as React.RefObject<HTMLAnchorElement>}\n />\n );\n } else {\n const { submitsForm, resetsForm, children, plasmicUpdateVariant, ...rest } =\n props;\n const type = submitsForm ? \"submit\" : resetsForm ? \"reset\" : \"button\";\n\n const buttonProps = mergeProps(rest, {\n type,\n style: COMMON_STYLES,\n ref: ref as React.Ref<HTMLButtonElement>,\n });\n\n return (\n <Button {...buttonProps}>\n {({ isHovered, isPressed, isFocused, isFocusVisible, isDisabled }) =>\n withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n disabled: isDisabled,\n },\n plasmicUpdateVariant\n )\n }\n </Button>\n );\n }\n});\n\nfunction LinkButton({\n props,\n ref,\n}: {\n props: BaseButtonProps;\n ref: React.RefObject<HTMLAnchorElement>;\n}) {\n const { href, children, plasmicUpdateVariant, ...rest } = props;\n const PlasmicLink = usePlasmicLink();\n const { linkProps, isPressed } = useLink(props, ref);\n const { hoverProps, isHovered } = useHover(props);\n const { focusProps, isFocused, isFocusVisible } = useFocusRing();\n\n const combinedLinkProps = mergeProps(linkProps, hoverProps, focusProps, {\n href,\n className: props.className,\n style: COMMON_STYLES,\n ref,\n });\n\n return (\n <PlasmicLink\n {...combinedLinkProps}\n data-focused={isFocused || undefined}\n data-hovered={isHovered || undefined}\n data-pressed={isPressed || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n >\n {withObservedValues(\n children,\n {\n hovered: isHovered,\n pressed: isPressed,\n focused: isFocused,\n focusVisible: isFocusVisible,\n disabled: !!rest.isDisabled,\n },\n plasmicUpdateVariant\n )}\n </PlasmicLink>\n );\n}\n\nexport const BUTTON_COMPONENT_NAME = makeComponentName(\"button\");\n\nexport function registerButton(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseButton>\n) {\n registerComponentHelper(\n loader,\n BaseButton,\n {\n name: BUTTON_COMPONENT_NAME,\n displayName: \"Aria Button\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerButton\",\n importName: \"BaseButton\",\n variants,\n defaultStyles: {\n // Ensure consistent design across rendered elements (button, anchor tag).\n backgroundColor: \"#EFEFEF\",\n borderColor: \"black\",\n borderStyle: \"solid\",\n borderWidth: \"1px\",\n color: \"#000000\",\n cursor: \"pointer\",\n fontFamily: \"Arial\",\n fontSize: \"1rem\",\n lineHeight: \"1.2\",\n padding: \"2px 10px\",\n textDecorationLine: \"none\",\n },\n props: {\n ...getCommonProps<BaseButtonProps>(\"button\", [\n \"autoFocus\",\n \"isDisabled\",\n \"aria-label\",\n ]),\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: {\n type: \"text\",\n value: \"Button\",\n },\n },\n href: {\n type: \"href\",\n description:\n \"The URL this button navigates to. If present, this button is an <a> element.\",\n },\n target: {\n type: \"choice\",\n options: [\"_blank\", \"_self\", \"_parent\", \"_top\"],\n description:\n \"Same as target attribute of <a> element. Only applies when the href prop is present.\",\n hidden: (props) => !props.href,\n defaultValueHint: \"_self\",\n },\n submitsForm: {\n type: \"boolean\",\n displayName: \"Submits form?\",\n defaultValueHint: false,\n hidden: (props) => Boolean(props.resetsForm) || Boolean(props.href),\n description:\n \"Whether clicking this button should submit the enclosing form.\",\n advanced: true,\n },\n resetsForm: {\n type: \"boolean\",\n displayName: \"Resets form?\",\n defaultValueHint: false,\n hidden: (props) => Boolean(props.submitsForm) || Boolean(props.href),\n description:\n \"Whether clicking this button should reset the enclosing form.\",\n advanced: true,\n },\n onPress: {\n type: \"eventHandler\",\n argTypes: [{ name: \"event\", type: \"object\" }],\n },\n onFocus: {\n type: \"eventHandler\",\n argTypes: [{ name: \"event\", type: \"object\" }],\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAM,eAAkB,GAAA;AAAA,EACtB,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAA,EAAU,kBAAmB,EAAA,GACnC,0BAA0B,eAAe,CAAA,CAAA;AAsBpC,MAAM,aAAa,KAAM,CAAA,UAAA,CAAW,SAAS,eAAA,CAClD,OACA,GACA,EAAA;AACA,EAAM,MAAA,EAAE,MAAS,GAAA,KAAA,CAAA;AAEjB,EA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,UAC9C,WACE,EAAA,sFAAA;AAAA,UACF,MAAQ,EAAA,CAAC,KAAU,KAAA,CAAC,KAAM,CAAA,IAAA;AAAA,UAC1B,gBAAkB,EAAA,OAAA;AAAA,SACpB;AAAA,QACA,WAAa,EAAA;AAAA,UACX,IAAM,EAAA,SAAA;AAAA,UACN,WAAa,EAAA,eAAA;AAAA,UACb,gBAAkB,EAAA,KAAA;AAAA,UAClB,MAAA,EAAQ,CAAC,KAAU,KAAA,OAAA,CAAQ,MAAM,UAAU,CAAA,IAAK,OAAQ,CAAA,KAAA,CAAM,IAAI,CAAA;AAAA,UAClE,WACE,EAAA,gEAAA;AAAA,UACF,QAAU,EAAA,IAAA;AAAA,SACZ;AAAA,QACA,UAAY,EAAA;AAAA,UACV,IAAM,EAAA,SAAA;AAAA,UACN,WAAa,EAAA,cAAA;AAAA,UACb,gBAAkB,EAAA,KAAA;AAAA,UAClB,MAAA,EAAQ,CAAC,KAAU,KAAA,OAAA,CAAQ,MAAM,WAAW,CAAA,IAAK,OAAQ,CAAA,KAAA,CAAM,IAAI,CAAA;AAAA,UACnE,WACE,EAAA,+DAAA;AAAA,UACF,QAAU,EAAA,IAAA;AAAA,SACZ;AAAA,QACA,OAAS,EAAA;AAAA,UACP,IAAM,EAAA,cAAA;AAAA,UACN,UAAU,CAAC,EAAE,MAAM,OAAS,EAAA,IAAA,EAAM,UAAU,CAAA;AAAA,SAC9C;AAAA,QACA,OAAS,EAAA;AAAA,UACP,IAAM,EAAA,cAAA;AAAA,UACN,UAAU,CAAC,EAAE,MAAM,OAAS,EAAA,IAAA,EAAM,UAAU,CAAA;AAAA,SAC9C;AAAA,OACF,CAAA;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -12,11 +12,11 @@ var registerSection = require('./registerListBox-a99736df.cjs.js');
|
|
|
12
12
|
var registerPopover = require('./registerPopover.cjs.js');
|
|
13
13
|
var utils = require('./utils-7d000fa4.cjs.js');
|
|
14
14
|
var variantUtils = require('./variant-utils-0ad70db8.cjs.js');
|
|
15
|
+
require('@plasmicapp/host');
|
|
15
16
|
require('react-aria');
|
|
16
17
|
require('./registerListBoxItem.cjs.js');
|
|
17
18
|
require('./registerDescription.cjs.js');
|
|
18
19
|
require('./registerText.cjs.js');
|
|
19
|
-
require('@plasmicapp/host');
|
|
20
20
|
require('@react-aria/utils');
|
|
21
21
|
require('@plasmicapp/host/registerComponent');
|
|
22
22
|
|
|
@@ -10,11 +10,11 @@ import { L as LIST_BOX_COMPONENT_NAME } from './registerListBox-40846430.esm.js'
|
|
|
10
10
|
import { POPOVER_COMPONENT_NAME } from './registerPopover.esm.js';
|
|
11
11
|
import { r as registerComponentHelper, m as makeComponentName, u as useAutoOpen } from './utils-5d1b4c6b.esm.js';
|
|
12
12
|
import { p as pickAriaComponentVariants } from './variant-utils-4405ebb0.esm.js';
|
|
13
|
+
import '@plasmicapp/host';
|
|
13
14
|
import 'react-aria';
|
|
14
15
|
import './registerListBoxItem.esm.js';
|
|
15
16
|
import './registerDescription.esm.js';
|
|
16
17
|
import './registerText.esm.js';
|
|
17
|
-
import '@plasmicapp/host';
|
|
18
18
|
import '@react-aria/utils';
|
|
19
19
|
import '@plasmicapp/host/registerComponent';
|
|
20
20
|
|
|
@@ -11,7 +11,6 @@ var utils = require('./utils-7d000fa4.cjs.js');
|
|
|
11
11
|
require('react-aria');
|
|
12
12
|
require('./common-b3b54c72.cjs.js');
|
|
13
13
|
require('./variant-utils-0ad70db8.cjs.js');
|
|
14
|
-
require('./registerHeading.cjs.js');
|
|
15
14
|
require('@plasmicapp/host/registerComponent');
|
|
16
15
|
|
|
17
16
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerDialogTrigger.cjs.js","sources":["../src/registerDialogTrigger.tsx"],"sourcesContent":["import { usePlasmicCanvasComponentInfo } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport { DialogTrigger } from \"react-aria-components\";\nimport { PlasmicDialogTriggerContext } from \"./contexts\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { DIALOG_COMPONENT_NAME } from \"./registerDialog\";\nimport {\n MODAL_COMPONENT_NAME,\n MODAL_DEFAULT_SLOT_CONTENT,\n} from \"./registerModal\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseDialogTriggerProps\n extends React.ComponentProps<typeof DialogTrigger> {\n trigger?: React.ReactNode;\n dialog?: React.ReactNode;\n}\n\nexport function BaseDialogTrigger(props: BaseDialogTriggerProps) {\n const { trigger, dialog, isOpen, ...rest } = props;\n\n const { isSelected, selectedSlotName } =\n usePlasmicCanvasComponentInfo?.(props) ?? {};\n const isAutoOpen = selectedSlotName !== \"trigger\" && isSelected;\n\n const mergedProps = {\n ...rest,\n isOpen: (isAutoOpen || isOpen) ?? false,\n };\n\n return (\n <PlasmicDialogTriggerContext.Provider value={mergedProps}>\n <DialogTrigger {...mergedProps}>\n {trigger}\n {dialog}\n </DialogTrigger>\n </PlasmicDialogTriggerContext.Provider>\n );\n}\n\nexport function registerDialogTrigger(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseDialogTrigger>\n) {\n registerComponentHelper(\n loader,\n BaseDialogTrigger,\n {\n name: makeComponentName(\"dialogTrigger\"),\n displayName: \"Aria Dialog Trigger\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerDialogTrigger\",\n importName: \"BaseDialogTrigger\",\n styleSections: false,\n props: {\n trigger: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: {\n type: \"component\",\n name: BUTTON_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: \"Open Dialog\",\n },\n },\n },\n },\n dialog: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n {\n type: \"component\",\n name: MODAL_COMPONENT_NAME,\n props: {\n children: {\n type: \"component\",\n name: DIALOG_COMPONENT_NAME,\n props: {\n children: MODAL_DEFAULT_SLOT_CONTENT,\n },\n },\n },\n },\n ],\n },\n isOpen: {\n type: \"boolean\",\n defaultValueHint: false,\n editOnly: true,\n uncontrolledProp: \"defaultOpen\",\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n },\n states: {\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["usePlasmicCanvasComponentInfo","React","PlasmicDialogTriggerContext","DialogTrigger","registerComponentHelper","makeComponentName","BUTTON_COMPONENT_NAME","MODAL_COMPONENT_NAME","DIALOG_COMPONENT_NAME","MODAL_DEFAULT_SLOT_CONTENT"],"mappings":"
|
|
1
|
+
{"version":3,"file":"registerDialogTrigger.cjs.js","sources":["../src/registerDialogTrigger.tsx"],"sourcesContent":["import { usePlasmicCanvasComponentInfo } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport { DialogTrigger } from \"react-aria-components\";\nimport { PlasmicDialogTriggerContext } from \"./contexts\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { DIALOG_COMPONENT_NAME } from \"./registerDialog\";\nimport {\n MODAL_COMPONENT_NAME,\n MODAL_DEFAULT_SLOT_CONTENT,\n} from \"./registerModal\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseDialogTriggerProps\n extends React.ComponentProps<typeof DialogTrigger> {\n trigger?: React.ReactNode;\n dialog?: React.ReactNode;\n}\n\nexport function BaseDialogTrigger(props: BaseDialogTriggerProps) {\n const { trigger, dialog, isOpen, ...rest } = props;\n\n const { isSelected, selectedSlotName } =\n usePlasmicCanvasComponentInfo?.(props) ?? {};\n const isAutoOpen = selectedSlotName !== \"trigger\" && isSelected;\n\n const mergedProps = {\n ...rest,\n isOpen: (isAutoOpen || isOpen) ?? false,\n };\n\n return (\n <PlasmicDialogTriggerContext.Provider value={mergedProps}>\n <DialogTrigger {...mergedProps}>\n {trigger}\n {dialog}\n </DialogTrigger>\n </PlasmicDialogTriggerContext.Provider>\n );\n}\n\nexport function registerDialogTrigger(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseDialogTrigger>\n) {\n registerComponentHelper(\n loader,\n BaseDialogTrigger,\n {\n name: makeComponentName(\"dialogTrigger\"),\n displayName: \"Aria Dialog Trigger\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerDialogTrigger\",\n importName: \"BaseDialogTrigger\",\n styleSections: false,\n props: {\n trigger: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: {\n type: \"component\",\n name: BUTTON_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: \"Open Dialog\",\n },\n },\n },\n },\n dialog: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n {\n type: \"component\",\n name: MODAL_COMPONENT_NAME,\n props: {\n children: {\n type: \"component\",\n name: DIALOG_COMPONENT_NAME,\n props: {\n children: MODAL_DEFAULT_SLOT_CONTENT,\n },\n },\n },\n },\n ],\n },\n isOpen: {\n type: \"boolean\",\n defaultValueHint: false,\n editOnly: true,\n uncontrolledProp: \"defaultOpen\",\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n },\n states: {\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["usePlasmicCanvasComponentInfo","React","PlasmicDialogTriggerContext","DialogTrigger","registerComponentHelper","makeComponentName","BUTTON_COMPONENT_NAME","MODAL_COMPONENT_NAME","DIALOG_COMPONENT_NAME","MODAL_DEFAULT_SLOT_CONTENT"],"mappings":";;;;;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AAAA,UACd,YAAc,EAAA,SAAA;AAAA,SAChB;AAAA,OACF;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;"}
|
|
@@ -9,7 +9,6 @@ import { r as registerComponentHelper, m as makeComponentName } from './utils-5d
|
|
|
9
9
|
import 'react-aria';
|
|
10
10
|
import './common-ceebbaea.esm.js';
|
|
11
11
|
import './variant-utils-4405ebb0.esm.js';
|
|
12
|
-
import './registerHeading.esm.js';
|
|
13
12
|
import '@plasmicapp/host/registerComponent';
|
|
14
13
|
|
|
15
14
|
var __defProp = Object.defineProperty;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerDialogTrigger.esm.js","sources":["../src/registerDialogTrigger.tsx"],"sourcesContent":["import { usePlasmicCanvasComponentInfo } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport { DialogTrigger } from \"react-aria-components\";\nimport { PlasmicDialogTriggerContext } from \"./contexts\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { DIALOG_COMPONENT_NAME } from \"./registerDialog\";\nimport {\n MODAL_COMPONENT_NAME,\n MODAL_DEFAULT_SLOT_CONTENT,\n} from \"./registerModal\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseDialogTriggerProps\n extends React.ComponentProps<typeof DialogTrigger> {\n trigger?: React.ReactNode;\n dialog?: React.ReactNode;\n}\n\nexport function BaseDialogTrigger(props: BaseDialogTriggerProps) {\n const { trigger, dialog, isOpen, ...rest } = props;\n\n const { isSelected, selectedSlotName } =\n usePlasmicCanvasComponentInfo?.(props) ?? {};\n const isAutoOpen = selectedSlotName !== \"trigger\" && isSelected;\n\n const mergedProps = {\n ...rest,\n isOpen: (isAutoOpen || isOpen) ?? false,\n };\n\n return (\n <PlasmicDialogTriggerContext.Provider value={mergedProps}>\n <DialogTrigger {...mergedProps}>\n {trigger}\n {dialog}\n </DialogTrigger>\n </PlasmicDialogTriggerContext.Provider>\n );\n}\n\nexport function registerDialogTrigger(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseDialogTrigger>\n) {\n registerComponentHelper(\n loader,\n BaseDialogTrigger,\n {\n name: makeComponentName(\"dialogTrigger\"),\n displayName: \"Aria Dialog Trigger\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerDialogTrigger\",\n importName: \"BaseDialogTrigger\",\n styleSections: false,\n props: {\n trigger: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: {\n type: \"component\",\n name: BUTTON_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: \"Open Dialog\",\n },\n },\n },\n },\n dialog: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n {\n type: \"component\",\n name: MODAL_COMPONENT_NAME,\n props: {\n children: {\n type: \"component\",\n name: DIALOG_COMPONENT_NAME,\n props: {\n children: MODAL_DEFAULT_SLOT_CONTENT,\n },\n },\n },\n },\n ],\n },\n isOpen: {\n type: \"boolean\",\n defaultValueHint: false,\n editOnly: true,\n uncontrolledProp: \"defaultOpen\",\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n },\n states: {\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registerDialogTrigger.esm.js","sources":["../src/registerDialogTrigger.tsx"],"sourcesContent":["import { usePlasmicCanvasComponentInfo } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport { DialogTrigger } from \"react-aria-components\";\nimport { PlasmicDialogTriggerContext } from \"./contexts\";\nimport { BUTTON_COMPONENT_NAME } from \"./registerButton\";\nimport { DIALOG_COMPONENT_NAME } from \"./registerDialog\";\nimport {\n MODAL_COMPONENT_NAME,\n MODAL_DEFAULT_SLOT_CONTENT,\n} from \"./registerModal\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseDialogTriggerProps\n extends React.ComponentProps<typeof DialogTrigger> {\n trigger?: React.ReactNode;\n dialog?: React.ReactNode;\n}\n\nexport function BaseDialogTrigger(props: BaseDialogTriggerProps) {\n const { trigger, dialog, isOpen, ...rest } = props;\n\n const { isSelected, selectedSlotName } =\n usePlasmicCanvasComponentInfo?.(props) ?? {};\n const isAutoOpen = selectedSlotName !== \"trigger\" && isSelected;\n\n const mergedProps = {\n ...rest,\n isOpen: (isAutoOpen || isOpen) ?? false,\n };\n\n return (\n <PlasmicDialogTriggerContext.Provider value={mergedProps}>\n <DialogTrigger {...mergedProps}>\n {trigger}\n {dialog}\n </DialogTrigger>\n </PlasmicDialogTriggerContext.Provider>\n );\n}\n\nexport function registerDialogTrigger(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseDialogTrigger>\n) {\n registerComponentHelper(\n loader,\n BaseDialogTrigger,\n {\n name: makeComponentName(\"dialogTrigger\"),\n displayName: \"Aria Dialog Trigger\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerDialogTrigger\",\n importName: \"BaseDialogTrigger\",\n styleSections: false,\n props: {\n trigger: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: {\n type: \"component\",\n name: BUTTON_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: \"Open Dialog\",\n },\n },\n },\n },\n dialog: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: [\n {\n type: \"component\",\n name: MODAL_COMPONENT_NAME,\n props: {\n children: {\n type: \"component\",\n name: DIALOG_COMPONENT_NAME,\n props: {\n children: MODAL_DEFAULT_SLOT_CONTENT,\n },\n },\n },\n },\n ],\n },\n isOpen: {\n type: \"boolean\",\n defaultValueHint: false,\n editOnly: true,\n uncontrolledProp: \"defaultOpen\",\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isOpen\", type: \"boolean\" }],\n },\n },\n states: {\n isOpen: {\n type: \"writable\",\n valueProp: \"isOpen\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBO,SAAS,kBAAkB,KAA+B,EAAA;AAvBjE,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAwBE,EAA6C,MAAA,EAAA,GAAA,KAAA,EAArC,EAAS,OAAA,EAAA,MAAA,EAAQ,MAxB3B,EAAA,GAwB+C,IAAT,IAAS,GAAA,SAAA,CAAA,EAAA,EAAT,CAA5B,SAAA,EAAS,QAAQ,EAAA,QAAA,CAAA,CAAA,CAAA;AAEzB,EAAA,MAAM,EAAE,UAAY,EAAA,gBAAA,MAClB,EAAgC,GAAA,CAAA,EAAA,GAAA,6BAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,KAAA,CAAA,KAAhC,YAA0C,EAAC,CAAA;AAC7C,EAAM,MAAA,UAAA,GAAa,qBAAqB,SAAa,IAAA,UAAA,CAAA;AAErD,EAAM,MAAA,WAAA,GAAc,iCACf,IADe,CAAA,EAAA;AAAA,IAElB,MAAA,EAAA,CAAS,EAAc,GAAA,UAAA,IAAA,MAAA,KAAd,IAAyB,GAAA,EAAA,GAAA,KAAA;AAAA,GACpC,CAAA,CAAA;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,2BAA4B,CAAA,QAAA,EAA5B,EAAqC,KAAA,EAAO,WAC3C,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAkB,EAAA,cAAA,CAAA,EAAA,EAAA,WAAA,CAAA,EAChB,OACA,EAAA,MACH,CACF,CAAA,CAAA;AAEJ,CAAA;AAEgB,SAAA,qBAAA,CACd,Q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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,SAAW,EAAA,QAAA;AAAA,UACX,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;;;;"}
|
|
@@ -53,7 +53,7 @@ function registerHeading(loader, overrides) {
|
|
|
53
53
|
BaseHeading,
|
|
54
54
|
{
|
|
55
55
|
name: HEADING_COMPONENT_NAME,
|
|
56
|
-
displayName: "Aria Heading",
|
|
56
|
+
displayName: "Aria Heading (deprecated)",
|
|
57
57
|
importPath: "@plasmicpkgs/react-aria/skinny/registerHeading",
|
|
58
58
|
importName: "BaseHeading",
|
|
59
59
|
defaultStyles: {
|
|
@@ -83,6 +83,5 @@ function registerHeading(loader, overrides) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
exports.BaseHeading = BaseHeading;
|
|
86
|
-
exports.HEADING_COMPONENT_NAME = HEADING_COMPONENT_NAME;
|
|
87
86
|
exports.registerHeading = registerHeading;
|
|
88
87
|
//# sourceMappingURL=registerHeading.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerHeading.cjs.js","sources":["../src/registerHeading.tsx"],"sourcesContent":["import React from \"react\";\nimport type { HeadingProps } from \"react-aria-components\";\nimport { Heading } from \"react-aria-components\";\nimport { COMMON_STYLES } from \"./common\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport function BaseHeading({ children, ...rest }: HeadingProps) {\n return (\n <Heading {...rest} style={COMMON_STYLES}>\n {children}\n </Heading>\n );\n}\n\
|
|
1
|
+
{"version":3,"file":"registerHeading.cjs.js","sources":["../src/registerHeading.tsx"],"sourcesContent":["import React from \"react\";\nimport type { HeadingProps } from \"react-aria-components\";\nimport { Heading } from \"react-aria-components\";\nimport { COMMON_STYLES } from \"./common\";\nimport {\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport function BaseHeading({ children, ...rest }: HeadingProps) {\n return (\n <Heading {...rest} style={COMMON_STYLES}>\n {children}\n </Heading>\n );\n}\n\nconst HEADING_COMPONENT_NAME = makeComponentName(\"heading\");\n\n/** @deprecated Use Plasmic's built-in `Text` component instead */\nexport function registerHeading(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseHeading>\n) {\n return registerComponentHelper(\n loader,\n BaseHeading,\n {\n name: HEADING_COMPONENT_NAME,\n displayName: \"Aria Heading (deprecated)\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerHeading\",\n importName: \"BaseHeading\",\n defaultStyles: {\n fontSize: \"20px\",\n fontWeight: \"bold\",\n marginBottom: \"10px\",\n },\n props: {\n children: {\n type: \"slot\",\n mergeWithParent: true,\n defaultValue: {\n type: \"text\",\n value: \"Heading\",\n },\n },\n slot: {\n type: \"string\",\n defaultValue: \"title\",\n hidden: () => true,\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n}\n"],"names":["Heading","COMMON_STYLES","makeComponentName","registerComponentHelper"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,SAAS,YAAY,EAAqC,EAAA;AAArC,EAAA,IAAA,EAAA,GAAA,EAAA,EAAE,EAX9B,QAAA,EAAA,GAW4B,EAAe,EAAA,IAAA,GAAA,SAAA,CAAf,IAAe,CAAb,UAAA,CAAA,CAAA,CAAA;AAC5B,EAAA,4DACGA,2BAAY,EAAA,aAAA,CAAA,cAAA,CAAA,EAAA,EAAA,IAAA,CAAA,EAAZ,EAAkB,KAAA,EAAOC,yBACvB,QACH,CAAA,CAAA;AAEJ,CA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