@plasmicapp/react-web 0.2.86 → 0.2.91

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.
Files changed (75) hide show
  1. package/dist/all.d.ts +7 -7
  2. package/dist/react-utils.d.ts +1 -1
  3. package/dist/react-web.cjs.development.js +31 -20
  4. package/dist/react-web.cjs.development.js.map +1 -1
  5. package/dist/react-web.cjs.production.min.js +1 -1
  6. package/dist/react-web.cjs.production.min.js.map +1 -1
  7. package/dist/react-web.esm.js +31 -20
  8. package/dist/react-web.esm.js.map +1 -1
  9. package/dist/render/PlasmicImg/index.d.ts +5 -4
  10. package/dist/render/PlasmicLink.d.ts +2 -2
  11. package/dist/stories/PlasmicImg.stories.d.ts +2 -2
  12. package/package.json +1 -1
  13. package/skinny/dist/index.js +5 -5
  14. package/skinny/dist/index.js.map +1 -1
  15. package/skinny/dist/plume/button/index.js +2 -2
  16. package/skinny/dist/plume/button/index.js.map +1 -1
  17. package/skinny/dist/plume/text-input/index.js +2 -2
  18. package/skinny/dist/plume/text-input/index.js.map +1 -1
  19. package/skinny/dist/plume/triggered-overlay/index.js +1 -2
  20. package/skinny/dist/plume/triggered-overlay/index.js.map +1 -1
  21. package/skinny/dist/react-utils-7c01e440.js.map +1 -1
  22. package/skinny/dist/react-utils.d.ts +1 -1
  23. package/skinny/dist/render/PlasmicImg/index.d.ts +5 -4
  24. package/skinny/dist/render/PlasmicImg/index.js +12 -6
  25. package/skinny/dist/render/PlasmicImg/index.js.map +1 -1
  26. package/skinny/dist/render/PlasmicLink.d.ts +2 -2
  27. package/skinny/dist/stories/PlasmicImg.stories.d.ts +2 -2
  28. package/skinny/dist/collection-utils-21ad9cae.js +0 -238
  29. package/skinny/dist/collection-utils-21ad9cae.js.map +0 -1
  30. package/skinny/dist/collection-utils-87ffc0ed.js +0 -238
  31. package/skinny/dist/collection-utils-87ffc0ed.js.map +0 -1
  32. package/skinny/dist/collection-utils-96cde83c.js +0 -238
  33. package/skinny/dist/collection-utils-96cde83c.js.map +0 -1
  34. package/skinny/dist/collection-utils-976df07d.js +0 -238
  35. package/skinny/dist/collection-utils-976df07d.js.map +0 -1
  36. package/skinny/dist/collection-utils-aadc3a43.js +0 -238
  37. package/skinny/dist/collection-utils-aadc3a43.js.map +0 -1
  38. package/skinny/dist/collection-utils-b0b8f30e.js +0 -238
  39. package/skinny/dist/collection-utils-b0b8f30e.js.map +0 -1
  40. package/skinny/dist/collection-utils-b8a2fd59.js +0 -238
  41. package/skinny/dist/collection-utils-b8a2fd59.js.map +0 -1
  42. package/skinny/dist/props-utils-1f98cfd3.js +0 -40
  43. package/skinny/dist/props-utils-1f98cfd3.js.map +0 -1
  44. package/skinny/dist/props-utils-40224c71.js +0 -40
  45. package/skinny/dist/props-utils-40224c71.js.map +0 -1
  46. package/skinny/dist/props-utils-69f9ba8b.js +0 -40
  47. package/skinny/dist/props-utils-69f9ba8b.js.map +0 -1
  48. package/skinny/dist/props-utils-6cf101b2.js +0 -39
  49. package/skinny/dist/props-utils-6cf101b2.js.map +0 -1
  50. package/skinny/dist/props-utils-754f655a.js +0 -39
  51. package/skinny/dist/props-utils-754f655a.js.map +0 -1
  52. package/skinny/dist/props-utils-85691c9c.js +0 -40
  53. package/skinny/dist/props-utils-85691c9c.js.map +0 -1
  54. package/skinny/dist/props-utils-c632595f.js +0 -39
  55. package/skinny/dist/props-utils-c632595f.js.map +0 -1
  56. package/skinny/dist/react-utils-06bae09a.js +0 -254
  57. package/skinny/dist/react-utils-06bae09a.js.map +0 -1
  58. package/skinny/dist/react-utils-118d8539.js +0 -172
  59. package/skinny/dist/react-utils-118d8539.js.map +0 -1
  60. package/skinny/dist/react-utils-14af9d28.js +0 -172
  61. package/skinny/dist/react-utils-14af9d28.js.map +0 -1
  62. package/skinny/dist/react-utils-834a65c3.js +0 -254
  63. package/skinny/dist/react-utils-834a65c3.js.map +0 -1
  64. package/skinny/dist/react-utils-ae69f4e0.js +0 -254
  65. package/skinny/dist/react-utils-ae69f4e0.js.map +0 -1
  66. package/skinny/dist/react-utils-cca81efc.js +0 -245
  67. package/skinny/dist/react-utils-cca81efc.js.map +0 -1
  68. package/skinny/dist/render/PlasmicImg.d.ts +0 -55
  69. package/skinny/dist/stories/Button.d.ts +0 -29
  70. package/skinny/dist/stories/Header.d.ts +0 -10
  71. package/skinny/dist/stories/Page.d.ts +0 -10
  72. package/skinny/dist/tslib.es6-00014098.js +0 -128
  73. package/skinny/dist/tslib.es6-00014098.js.map +0 -1
  74. package/skinny/dist/tslib.es6-10d3f595.js +0 -132
  75. package/skinny/dist/tslib.es6-10d3f595.js.map +0 -1
package/dist/all.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import * as React from 'react';
3
2
  import React__default, { FocusEvent, KeyboardEvent as KeyboardEvent$1, SyntheticEvent, ReactNode } from 'react';
4
3
 
@@ -19,7 +18,7 @@ type ClassNamesExport = ClassNamesFn & { default: ClassNamesFn };
19
18
  declare function pick<T>(obj: T, ...keys: (string | number | symbol)[]): Partial<T>;
20
19
  declare function omit<T>(obj: T, ...keys: (keyof T)[]): Partial<T>;
21
20
 
22
- declare type StrictProps<T, TExpected> = Exclude<keyof T, keyof TExpected> extends never ? {} : "Unexpected extraneous props";
21
+ declare type StrictProps<T, TExpected> = Exclude<keyof T, keyof TExpected> extends never ? {} : Partial<"Unexpected extraneous props">;
23
22
  declare type HTMLElementRefOf<T extends keyof JSX.IntrinsicElements> = Exclude<React__default.ComponentProps<T>["ref"], string>;
24
23
 
25
24
  interface Variants {
@@ -155,14 +154,15 @@ interface PlasmicImgProps extends ImgTagProps {
155
154
  */
156
155
  style?: React__default.CSSProperties;
157
156
  /**
158
- * Ref for the wrapper element. The normal <PlasmicImg ref={...} />
159
- * prop gives you the wrap to the img element.
157
+ * Ref for the img element. The normal <PlasmicImg ref={...} />
158
+ * prop gives the root element instead, which may be the img element
159
+ * or a wrapper element
160
160
  */
161
- containerRef?: React__default.Ref<HTMLDivElement>;
161
+ imgRef?: React__default.Ref<HTMLImageElement>;
162
162
  }
163
- declare const PlasmicImg: React__default.ForwardRefExoticComponent<PlasmicImgProps & React__default.RefAttributes<HTMLImageElement>>;
163
+ declare const PlasmicImg: React__default.ForwardRefExoticComponent<PlasmicImgProps & React__default.RefAttributes<HTMLElement>>;
164
164
 
165
- declare function PlasmicLink(props: any): JSX.Element;
165
+ declare const PlasmicLink: React__default.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React__default.RefAttributes<any>>;
166
166
 
167
167
  declare function PlasmicSlot<T extends keyof JSX.IntrinsicElements = "div">(props: React.ComponentProps<T> & {
168
168
  as?: T;
@@ -13,7 +13,7 @@ export declare function isReactText(child: React.ReactNode): child is React.Reac
13
13
  export declare function isReactChild(child: React.ReactNode): child is React.ReactChild;
14
14
  export declare function isReactFragment(child: React.ReactNode): child is React.ReactElement;
15
15
  export declare function isReactNode(x: any): boolean;
16
- export declare type StrictProps<T, TExpected> = Exclude<keyof T, keyof TExpected> extends never ? {} : "Unexpected extraneous props";
16
+ export declare type StrictProps<T, TExpected> = Exclude<keyof T, keyof TExpected> extends never ? {} : Partial<"Unexpected extraneous props">;
17
17
  export declare type HTMLElementRefOf<T extends keyof JSX.IntrinsicElements> = Exclude<React.ComponentProps<T>["ref"], string>;
18
18
  export declare function mergeProps(props: Record<string, any>, ...restProps: Record<string, any>[]): Record<string, any>;
19
19
  export declare function mergeRefs<T>(...refs: (React.Ref<T> | undefined)[]): (value: T) => void;
@@ -807,7 +807,7 @@ function PlasmicIcon(props) {
807
807
  var IMG_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];
808
808
  var DEVICE_SIZES = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];
809
809
  var ALL_SIZES = /*#__PURE__*/[].concat(IMG_SIZES, DEVICE_SIZES);
810
- var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(props, ref) {
810
+ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(props, outerRef) {
811
811
  var src = props.src,
812
812
  className = props.className,
813
813
  displayWidth = props.displayWidth,
@@ -818,9 +818,16 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
818
818
  displayMaxHeight = props.displayMaxHeight,
819
819
  quality = props.quality,
820
820
  loader = props.loader,
821
- containerRef = props.containerRef,
821
+ imgRef = props.imgRef,
822
822
  style = props.style,
823
- rest = _objectWithoutPropertiesLoose(props, ["src", "className", "displayWidth", "displayHeight", "displayMinWidth", "displayMinHeight", "displayMaxWidth", "displayMaxHeight", "quality", "loader", "containerRef", "style"]);
823
+ loading = props.loading,
824
+ rest = _objectWithoutPropertiesLoose(props, ["src", "className", "displayWidth", "displayHeight", "displayMinWidth", "displayMinHeight", "displayMaxWidth", "displayMaxHeight", "quality", "loader", "imgRef", "style", "loading"]);
825
+
826
+ var imgProps = Object.assign({}, rest, {
827
+ // Default loading to "lazy" if not specified (which is different from the
828
+ // html img, which defaults to eager!)
829
+ loading: loading != null ? loading : "lazy"
830
+ });
824
831
 
825
832
  var _ref = typeof src === "string" || !src ? {
826
833
  fullWidth: undefined,
@@ -838,8 +845,9 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
838
845
  src: srcStr,
839
846
  className: className,
840
847
  style: style
841
- }, rest, {
842
- ref: ref
848
+ }, imgProps, {
849
+ loading: loading,
850
+ ref: mergeRefs(imgRef, outerRef)
843
851
  }));
844
852
  }
845
853
 
@@ -937,7 +945,7 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
937
945
 
938
946
  return React__default.createElement("div", {
939
947
  className: classNames$1(className, "__wab_img-wrapper"),
940
- ref: containerRef,
948
+ ref: outerRef,
941
949
  style: wrapperStyle
942
950
  }, React__default.createElement("img", {
943
951
  alt: "",
@@ -951,9 +959,9 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
951
959
  sizes: sizes,
952
960
  src: srcStr,
953
961
  quality: quality,
954
- ref: ref,
962
+ ref: imgRef,
955
963
  style: style ? pick(style, "objectFit", "objectPosition") : undefined,
956
- imgProps: rest,
964
+ imgProps: imgProps,
957
965
  className: "__wab_img"
958
966
  }));
959
967
  });
@@ -1157,22 +1165,27 @@ var PLASMIC_IMAGE_LOADER = {
1157
1165
  }
1158
1166
  };
1159
1167
 
1160
- function PlasmicLink(props) {
1168
+ var PlasmicLink = /*#__PURE__*/React__default.forwardRef(function PlasmicLink(props, ref) {
1161
1169
  // props.href is required for nextjs; if no props.href,
1162
1170
  // then we just render the default anchor element
1163
1171
  if (props.platform === "nextjs" && props.href) {
1164
1172
  var nextjsProps = ["href", "replace", "scroll", "shallow", "passHref", "prefetch", "locale"];
1165
- return React__default.createElement(props.component, pick.apply(void 0, [props].concat(nextjsProps)), React__default.createElement("a", Object.assign({}, omit.apply(void 0, [props, "component", "platform"].concat(nextjsProps)))));
1173
+ return React__default.createElement(props.component, pick.apply(void 0, [props].concat(nextjsProps)), React__default.createElement("a", Object.assign({}, omit.apply(void 0, [props, "component", "platform"].concat(nextjsProps)), {
1174
+ ref: ref
1175
+ })));
1166
1176
  }
1167
1177
 
1168
1178
  if (props.platform === "gatsby" && isInternalHref(props.href)) {
1169
1179
  return React__default.createElement(props.component, _extends({}, omit(props, "component", "platform", "href"), {
1170
- to: props.href
1180
+ to: props.href,
1181
+ ref: ref
1171
1182
  }));
1172
1183
  }
1173
1184
 
1174
- return React__default.createElement("a", Object.assign({}, omit(props, "component", "platform")));
1175
- }
1185
+ return React__default.createElement("a", Object.assign({}, omit(props, "component", "platform"), {
1186
+ ref: ref
1187
+ }));
1188
+ });
1176
1189
 
1177
1190
  function isInternalHref(href) {
1178
1191
  return /^\/(?!\/)/.test(href);
@@ -1528,12 +1541,12 @@ function useButton(plasmicClass, props, config, ref) {
1528
1541
 
1529
1542
  var overrides = (_overrides = {}, _overrides[config.root] = {
1530
1543
  as: !!link ? "a" : "button",
1531
- props: _extends({
1544
+ props: _extends({}, omit.apply(void 0, [rest].concat(plasmicClass.internalArgProps, plasmicClass.internalVariantProps)), {
1532
1545
  ref: ref,
1533
1546
  disabled: isDisabled
1534
1547
  }, !!link && {
1535
1548
  href: link
1536
- }, rest)
1549
+ })
1537
1550
  }, _overrides);
1538
1551
  return {
1539
1552
  plasmicProps: {
@@ -2862,12 +2875,12 @@ function useTextInput(plasmicClass, props, config, ref) {
2862
2875
  style: style
2863
2876
  }
2864
2877
  }, _overrides[config.input] = {
2865
- props: _extends({
2878
+ props: _extends({}, omit.apply(void 0, [rest].concat(plasmicClass.internalArgProps, plasmicClass.internalVariantProps)), {
2866
2879
  disabled: isDisabled,
2867
2880
  ref: inputRef,
2868
2881
  className: inputClassName,
2869
2882
  style: inputStyle
2870
- }, rest)
2883
+ })
2871
2884
  }, _overrides);
2872
2885
  return {
2873
2886
  plasmicProps: {
@@ -2977,9 +2990,7 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef) {
2977
2990
  restoreFocus: true
2978
2991
  }, React.createElement(reactAria.DismissButton, {
2979
2992
  onDismiss: state.close
2980
- }), children, React.createElement(reactAria.DismissButton, {
2981
- onDismiss: state.close
2982
- })), _extends2));
2993
+ }), children), _extends2));
2983
2994
 
2984
2995
  var overrides = (_overrides = {}, _overrides[config.root] = {
2985
2996
  props: mergeProps(overlayProps, getStyleProps(props), {