@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 CHANGED
@@ -12415,9 +12415,11 @@ interface CommonProps {
12415
12415
  isDisabled?: boolean;
12416
12416
  }
12417
12417
  interface HtmlButtonProps extends Omit<React$1.ComponentProps<"button">, "ref" | "disabled"> {
12418
+ submitsForm?: boolean;
12418
12419
  }
12419
- interface HtmlAnchorProps extends Omit<React$1.ComponentProps<"a">, "ref" | "href"> {
12420
+ interface HtmlAnchorProps extends Omit<React$1.ComponentProps<"a">, "ref" | "href" | "target"> {
12420
12421
  link?: string;
12422
+ target?: React$1.ComponentProps<"a">["target"] | boolean;
12421
12423
  }
12422
12424
  type BaseButtonProps = CommonProps & HtmlButtonProps & HtmlAnchorProps;
12423
12425
  type HtmlAnchorOnlyProps = Exclude<keyof HtmlAnchorProps, keyof HtmlButtonProps>;
package/dist/index.cjs.js CHANGED
@@ -2620,13 +2620,28 @@ function getPlumeType(child) {
2620
2620
  function useButton(plasmicClass, props, config, ref) {
2621
2621
  var _a, _b, _c, _d;
2622
2622
  if (ref === void 0) { ref = null; }
2623
- 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"]);
2623
+ 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"]);
2624
2624
  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 }));
2625
2625
  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));
2626
+ var buttonType = undefined;
2627
+ if (!link) {
2628
+ if (!plasmicClass.internalVariantProps.includes("type") &&
2629
+ !plasmicClass.internalArgProps.includes("type") &&
2630
+ "type" in rest) {
2631
+ // There's no Plasmic-defined variant or arg called "type",
2632
+ // but the user passed in a "type" arg, so must be an override
2633
+ // or direct instantiation. We use that value
2634
+ buttonType = rest.type;
2635
+ }
2636
+ else {
2637
+ // Otherwise, we set buttonType depending in submitsForm
2638
+ buttonType = submitsForm ? "submit" : "button";
2639
+ }
2640
+ }
2626
2641
  var overrides = (_d = {},
2627
2642
  _d[config.root] = {
2628
- as: !!link ? "a" : "button",
2629
- 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 })),
2643
+ as: link ? "a" : "button",
2644
+ 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 })),
2630
2645
  },
2631
2646
  _d);
2632
2647
  return {