@plasmicapp/react-web 0.2.205 → 0.2.207
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/all.d.ts +3 -1
- package/dist/index.cjs.js +18 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/plume/button/index.d.ts +3 -1
- package/dist/react-web.esm.js +18 -3
- package/dist/react-web.esm.js.map +1 -1
- package/package.json +3 -3
- package/skinny/dist/plume/button/index.d.ts +3 -1
- package/skinny/dist/plume/button/index.js +18 -3
- package/skinny/dist/plume/button/index.js.map +1 -1
|
@@ -9,9 +9,11 @@ interface CommonProps {
|
|
|
9
9
|
isDisabled?: boolean;
|
|
10
10
|
}
|
|
11
11
|
interface HtmlButtonProps extends Omit<React.ComponentProps<"button">, "ref" | "disabled"> {
|
|
12
|
+
submitsForm?: boolean;
|
|
12
13
|
}
|
|
13
|
-
interface HtmlAnchorProps extends Omit<React.ComponentProps<"a">, "ref" | "href"> {
|
|
14
|
+
interface HtmlAnchorProps extends Omit<React.ComponentProps<"a">, "ref" | "href" | "target"> {
|
|
14
15
|
link?: string;
|
|
16
|
+
target?: React.ComponentProps<"a">["target"] | boolean;
|
|
15
17
|
}
|
|
16
18
|
export type BaseButtonProps = CommonProps & HtmlButtonProps & HtmlAnchorProps;
|
|
17
19
|
export type HtmlAnchorOnlyProps = Exclude<keyof HtmlAnchorProps, keyof HtmlButtonProps>;
|
package/dist/react-web.esm.js
CHANGED
|
@@ -2589,13 +2589,28 @@ function getPlumeType(child) {
|
|
|
2589
2589
|
function useButton(plasmicClass, props, config, ref) {
|
|
2590
2590
|
var _a, _b, _c, _d;
|
|
2591
2591
|
if (ref === void 0) { ref = null; }
|
|
2592
|
-
var link = props.link, isDisabled = props.isDisabled, startIcon = props.startIcon, endIcon = props.endIcon, showStartIcon = props.showStartIcon, showEndIcon = props.showEndIcon, children = props.children, rest = __rest(props, ["link", "isDisabled", "startIcon", "endIcon", "showStartIcon", "showEndIcon", "children"]);
|
|
2592
|
+
var link = props.link, isDisabled = props.isDisabled, startIcon = props.startIcon, endIcon = props.endIcon, showStartIcon = props.showStartIcon, showEndIcon = props.showEndIcon, children = props.children, target = props.target, _e = props.submitsForm, submitsForm = _e === void 0 ? false : _e, rest = __rest(props, ["link", "isDisabled", "startIcon", "endIcon", "showStartIcon", "showEndIcon", "children", "target", "submitsForm"]);
|
|
2593
2593
|
var variants = __assign(__assign({}, pick.apply(void 0, __spreadArray([props], __read(plasmicClass.internalVariantProps), false))), mergeVariantToggles({ def: config.showStartIconVariant, active: showStartIcon }, { def: config.showEndIconVariant, active: showEndIcon }, { def: config.isDisabledVariant, active: isDisabled }));
|
|
2594
2594
|
var args = __assign(__assign(__assign(__assign({}, pick.apply(void 0, __spreadArray([props], __read(plasmicClass.internalArgProps), false))), (config.startIconSlot && (_a = {}, _a[config.startIconSlot] = startIcon, _a))), (config.endIconSlot && (_b = {}, _b[config.endIconSlot] = endIcon, _b))), (_c = {}, _c[config.contentSlot] = children, _c));
|
|
2595
|
+
var buttonType = undefined;
|
|
2596
|
+
if (!link) {
|
|
2597
|
+
if (!plasmicClass.internalVariantProps.includes("type") &&
|
|
2598
|
+
!plasmicClass.internalArgProps.includes("type") &&
|
|
2599
|
+
"type" in rest) {
|
|
2600
|
+
// There's no Plasmic-defined variant or arg called "type",
|
|
2601
|
+
// but the user passed in a "type" arg, so must be an override
|
|
2602
|
+
// or direct instantiation. We use that value
|
|
2603
|
+
buttonType = rest.type;
|
|
2604
|
+
}
|
|
2605
|
+
else {
|
|
2606
|
+
// Otherwise, we set buttonType depending in submitsForm
|
|
2607
|
+
buttonType = submitsForm ? "submit" : "button";
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2595
2610
|
var overrides = (_d = {},
|
|
2596
2611
|
_d[config.root] = {
|
|
2597
|
-
as:
|
|
2598
|
-
props: __assign(__assign(__assign({}, omit.apply(void 0, __spreadArray(__spreadArray([rest], __read(plasmicClass.internalArgProps), false), __read(plasmicClass.internalVariantProps), false))), { ref: ref, disabled: isDisabled }), (!!link && { href: link })),
|
|
2612
|
+
as: link ? "a" : "button",
|
|
2613
|
+
props: __assign(__assign(__assign({}, omit.apply(void 0, __spreadArray(__spreadArray([rest], __read(plasmicClass.internalArgProps), false), __read(plasmicClass.internalVariantProps), false))), { type: buttonType, ref: ref, disabled: isDisabled, target: target === true ? "_blank" : target === false ? undefined : target }), (!!link && { href: link })),
|
|
2599
2614
|
},
|
|
2600
2615
|
_d);
|
|
2601
2616
|
return {
|