unframer 2.0.1 → 2.1.0

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/framer.js CHANGED
@@ -8950,7 +8950,7 @@ var cancelSync = stepsOrder.reduce((acc, key7) => {
8950
8950
  return acc;
8951
8951
  }, {});
8952
8952
  exports.cancelSync = cancelSync;
8953
- // https :https://app.framerstatic.com/framer.L736M3IJ.js
8953
+ // https :https://app.framerstatic.com/framer.PRO3WDEJ.js
8954
8954
  const react_46 = require("react");
8955
8955
  const react_47 = __importDefault(require("react"));
8956
8956
  const jsx_runtime_1 = require("react/jsx-runtime");
@@ -9126,15 +9126,15 @@ const jsx_runtime_60 = require("react/jsx-runtime");
9126
9126
  const jsx_runtime_61 = require("react/jsx-runtime");
9127
9127
  const jsx_runtime_62 = require("react/jsx-runtime");
9128
9128
  const jsx_runtime_63 = require("react/jsx-runtime");
9129
+ const react_154 = __importDefault(require("react"));
9129
9130
  const jsx_runtime_64 = require("react/jsx-runtime");
9130
- const react_154 = require("react");
9131
9131
  const jsx_runtime_65 = require("react/jsx-runtime");
9132
- const react_155 = require("react");
9132
+ const react_155 = __importDefault(require("react"));
9133
9133
  const jsx_runtime_66 = require("react/jsx-runtime");
9134
9134
  const react_156 = __importDefault(require("react"));
9135
9135
  const jsx_runtime_67 = require("react/jsx-runtime");
9136
9136
  const react_157 = require("react");
9137
- const React86 = __importStar(require("react"));
9137
+ const React88 = __importStar(require("react"));
9138
9138
  const react_158 = require("react");
9139
9139
  const jsx_runtime_68 = require("react/jsx-runtime");
9140
9140
  const jsx_runtime_69 = require("react/jsx-runtime");
@@ -10301,13 +10301,14 @@ var require_fontfaceobserver_standalone = __commonJS({
10301
10301
  },
10302
10302
  });
10303
10303
  function renderPage(Page4, defaultPageStyle) {
10304
- return react_47.default.isValidElement(Page4)
10305
- ? react_47.default.cloneElement(Page4, { style: defaultPageStyle, })
10306
- : react_47.default.createElement(Page4, { style: defaultPageStyle, });
10304
+ const style = { style: defaultPageStyle, };
10305
+ return react_47.default.isValidElement(Page4) ? react_47.default.cloneElement(Page4, style) : react_47.default.createElement(Page4, style);
10307
10306
  }
10308
10307
  var NotFoundError = class extends Error {
10309
10308
  };
10310
10309
  exports.NotFoundError = NotFoundError;
10310
+ var ErrorBoundaryCaughtError = class extends Error {
10311
+ };
10311
10312
  var ErrorBoundary = class extends react_46.Component {
10312
10313
  constructor(props) {
10313
10314
  super(props);
@@ -10334,7 +10335,9 @@ var ErrorBoundary = class extends react_46.Component {
10334
10335
  return this.props.children;
10335
10336
  }
10336
10337
  if (!(this.state.error instanceof NotFoundError)) {
10337
- throw this.state.error;
10338
+ const error = new ErrorBoundaryCaughtError();
10339
+ error.cause = this.state.error;
10340
+ throw error;
10338
10341
  }
10339
10342
  const { notFoundPage, defaultPageStyle, } = this.props;
10340
10343
  if (!notFoundPage) {
@@ -11206,17 +11209,17 @@ function RoutesProvider({ routes, children, }) {
11206
11209
  return (0, jsx_runtime_3.jsx)(RouterContext.Provider, { value: { getRoute, }, children, });
11207
11210
  }
11208
11211
  var SuspenseErrorBoundary = class extends react_56.Component {
11209
- constructor(props) {
11210
- super(props);
11212
+ constructor() {
11213
+ super(...arguments);
11211
11214
  this.state = { error: void 0, };
11212
11215
  }
11213
11216
  static getDerivedStateFromError(error) {
11214
- console.error('Error in SuspenseErrorBoundary (getDerivedStateFromError).', error);
11217
+ console.error('Derived error in SuspenseErrorBoundary', error);
11215
11218
  return { error, };
11216
11219
  }
11217
11220
  componentDidCatch(error, errorInfo) {
11218
11221
  var _a;
11219
- console.error('Caught error in in SuspenseErrorBoundary.', error, errorInfo);
11222
+ console.error('Caught error in SuspenseErrorBoundary', error, errorInfo);
11220
11223
  (_a = window.__framer_events) === null || _a === void 0 ? void 0 : _a.push([
11221
11224
  'published_site_load_recoverable_error',
11222
11225
  {
@@ -11229,6 +11232,9 @@ var SuspenseErrorBoundary = class extends react_56.Component {
11229
11232
  if (this.state.error === void 0) {
11230
11233
  return this.props.children;
11231
11234
  }
11235
+ if (this.state.error instanceof ErrorBoundaryCaughtError) {
11236
+ throw this.state.error.cause;
11237
+ }
11232
11238
  return (0, jsx_runtime_5.jsx)(react_56.Suspense, { children: this.props.fallbackChildren, });
11233
11239
  }
11234
11240
  };
@@ -16761,6 +16767,7 @@ var hideScrollbars = [
16761
16767
  `[data-hide-scrollbars="true"]::-webkit-scrollbar { width: 0px; height: 0px; }`,
16762
16768
  `[data-hide-scrollbars="true"]::-webkit-scrollbar-thumb { background: transparent; }`,
16763
16769
  ];
16770
+ var formInputRules = [`[data-framer-component-type="Form"] input { padding: var(--input-padding); }`,];
16764
16771
  var frameCSSRules = (isPreview) => {
16765
16772
  return isPreview ? frameCSS : [];
16766
16773
  };
@@ -16782,6 +16789,7 @@ var combineCSSRules = (isPreview) => [
16782
16789
  ...svgCSSRules,
16783
16790
  ...resetCSS,
16784
16791
  ...hideScrollbars,
16792
+ ...formInputRules,
16785
16793
  ];
16786
16794
  exports.combinedCSSRules = combineCSSRules(false);
16787
16795
  var combinedCSSRulesForPreview = combineCSSRules(true);
@@ -20303,7 +20311,7 @@ function hasDataFramerName(props) {
20303
20311
  return 'data-framer-name' in props;
20304
20312
  }
20305
20313
  var VisibleFrame = /* @__PURE__ */ (0, react_72.forwardRef)(function VisibleFrame2(props, forwardedRef) {
20306
- var _f;
20314
+ var _f, _j;
20307
20315
  const { name, center, border, _border, __portal, } = props;
20308
20316
  const { props: propsWithOverrides, children, } = processOverrideForwarding(props);
20309
20317
  const motionProps = getMotionProps(propsWithOverrides);
@@ -20312,7 +20320,7 @@ var VisibleFrame = /* @__PURE__ */ (0, react_72.forwardRef)(function VisibleFram
20312
20320
  const fallbackRef = (0, react_72.useRef)(null);
20313
20321
  const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : fallbackRef;
20314
20322
  const dataProps = {
20315
- 'data-framer-component-type': 'Frame',
20323
+ 'data-framer-component-type': (_f = props.componentType) !== null && _f !== void 0 ? _f : 'Frame',
20316
20324
  'data-framer-cursor': cursor,
20317
20325
  'data-framer-highlight': cursor === 'pointer' ? true : void 0,
20318
20326
  'data-layoutid': layoutId,
@@ -20342,7 +20350,7 @@ var VisibleFrame = /* @__PURE__ */ (0, react_72.forwardRef)(function VisibleFram
20342
20350
  children: [
20343
20351
  backgroundImage
20344
20352
  ? /* @__PURE__ */ (0, jsx_runtime_16.jsx)(BackgroundImageComponent, {
20345
- alt: (_f = props.alt) !== null && _f !== void 0 ? _f : '',
20353
+ alt: (_j = props.alt) !== null && _j !== void 0 ? _j : '',
20346
20354
  image: backgroundImage,
20347
20355
  containerSize: rect !== null && rect !== void 0 ? rect : void 0,
20348
20356
  nodeId: props.id && nodeIdFromString(props.id),
@@ -23960,6 +23968,9 @@ function paddingFromProps(props) {
23960
23968
  }
23961
23969
  exports.paddingFromProps = paddingFromProps;
23962
23970
  function makePaddingString({ top, left, bottom, right, }) {
23971
+ if (top === right && right === bottom && bottom === left) {
23972
+ return `${top}px`;
23973
+ }
23963
23974
  return `${top}px ${right}px ${bottom}px ${left}px`;
23964
23975
  }
23965
23976
  exports.makePaddingString = makePaddingString;
@@ -27243,6 +27254,9 @@ function useStyleTransform({ transformTrigger, styleTransformEffectEnabled, tran
27243
27254
  if (pageInputRange.length !== outputRange[key7].length) {
27244
27255
  continue;
27245
27256
  }
27257
+ if (outputRange[key7][0] === void 0) {
27258
+ continue;
27259
+ }
27246
27260
  effect.values[key7].set(transform(scrollY.progress, pageInputRange, outputRange[key7]));
27247
27261
  }
27248
27262
  }, transformTrigger === 'onInView'
@@ -27268,6 +27282,9 @@ function useStyleTransform({ transformTrigger, styleTransformEffectEnabled, tran
27268
27282
  if (scrollYInputRange.length !== effectKeyOutputRange[key7].length) {
27269
27283
  continue;
27270
27284
  }
27285
+ if (effectKeyOutputRange[key7][0] === void 0) {
27286
+ continue;
27287
+ }
27271
27288
  effect.values[key7].set(transform(scrollY.current, scrollYInputRange, effectKeyOutputRange[key7]));
27272
27289
  }
27273
27290
  });
@@ -36044,47 +36061,91 @@ function CustomProperties({ children, customProperties, }) {
36044
36061
  return /* @__PURE__ */ (0, jsx_runtime_63.jsx)('div', { style: customProperties, children, });
36045
36062
  }
36046
36063
  exports.CustomProperties = CustomProperties;
36047
- var FormContainer = (props) => {
36048
- return /* @__PURE__ */ (0, jsx_runtime_64.jsx)(FrameWithMotion, Object.assign(Object.assign({}, props), { as: 'form' }));
36049
- };
36050
- exports.FormContainer = FormContainer;
36051
- var FormButton = (props) => {
36064
+ var FormButton = /* @__PURE__ */ react_154.default.forwardRef(function FormButon(props, ref) {
36052
36065
  var _f;
36053
- const { __fromCanvasComponent, style: baseStyle2, } = props;
36054
- const layoutId = useLayoutId2(props);
36055
- const ref = (0, react_154.useRef)(null);
36066
+ const [submitting, setSubmitting,] = react_154.default.useState(false);
36067
+ const { style: baseStyle2, } = props;
36056
36068
  const style = mergeWithDefaultStyle(baseStyle2 !== null && baseStyle2 !== void 0 ? baseStyle2 : {});
36057
- const dataProps = {
36058
- 'data-layoutid': layoutId,
36059
- };
36060
- const isDisabled = Boolean(__fromCanvasComponent);
36061
- useMeasureLayout(props, ref);
36062
- return /* @__PURE__ */ (0, jsx_runtime_65.jsx)(motion.input, Object.assign(Object.assign({ type: props.type, disabled: isDisabled }, dataProps), { layoutId,
36063
- ref, style: Object.assign(Object.assign({}, baseStyle2), style), value: (_f = props.value) !== null && _f !== void 0 ? _f : 'Submit' }));
36064
- };
36069
+ const onSubmit = () => {
36070
+ setSubmitting(true);
36071
+ setTimeout(() => {
36072
+ setSubmitting(false);
36073
+ }, 500);
36074
+ };
36075
+ return /* @__PURE__ */ (0, jsx_runtime_64.jsx)(motion.input, {
36076
+ type: props.type,
36077
+ 'data-submitting': submitting,
36078
+ disabled: props.isDisabled || submitting,
36079
+ ref,
36080
+ style,
36081
+ value: submitting ? 'Submitting' : (_f = props.value) !== null && _f !== void 0 ? _f : 'Submit',
36082
+ onClick: onSubmit,
36083
+ });
36084
+ });
36065
36085
  exports.FormButton = FormButton;
36066
36086
  function mergeWithDefaultStyle(style) {
36067
- return Object.assign({ display: 'block', padding: '12px', width: '100%', background: '#222', color: '#fff', borderRadius: '10px', border: '1px solid rgba(0,0,0,0.05)' }, style);
36087
+ return Object.assign({ display: 'block', padding: '12px', fontSize: '14px', width: '100%', fontWeight: 'bold', cursor: 'pointer', background: '#222', color: '#fff', borderRadius: '10px', border: '1px solid rgba(0,0,0,0.05)' }, style);
36068
36088
  }
36069
- var FormPlainTextInput = (props) => {
36070
- const { __fromCanvasComponent, } = props;
36071
- const layoutId = useLayoutId2(props);
36072
- const ref = (0, react_155.useRef)(null);
36073
- const dataProps = {
36074
- 'data-layoutid': layoutId,
36075
- };
36076
- const isDisabled = Boolean(__fromCanvasComponent);
36077
- useMeasureLayout(props, ref);
36089
+ var FormContainer = (_f) => {
36090
+ var { action: _, formId } = _f, props = __rest(_f, ["action", "formId"]);
36091
+ const handleSubmit = (event) => __awaiter(void 0, void 0, void 0, function* () {
36092
+ event.preventDefault();
36093
+ const data2 = new URLSearchParams();
36094
+ for (const [key7, value,] of new FormData(event.currentTarget)) {
36095
+ data2.append(key7, value);
36096
+ }
36097
+ yield fetch('https://hooks.zapier.com/hooks/catch/8935032/3pzgf76/', {
36098
+ body: new URLSearchParams(data2),
36099
+ method: 'POST',
36100
+ });
36101
+ });
36102
+ return /* @__PURE__ */ (0, jsx_runtime_65.jsx)(motion.form, Object.assign(Object.assign({}, props), { 'data-formid': formId, onSubmit: handleSubmit, children: props.children }));
36103
+ };
36104
+ exports.FormContainer = FormContainer;
36105
+ var passwordManagerIgnoreDataProps = {
36106
+ // 1Password
36107
+ 'data-1p-ignore': true,
36108
+ // LastPass
36109
+ 'data-lpignore': true,
36110
+ };
36111
+ var sensibleInputDefaults = {
36112
+ autocomplete: 'off',
36113
+ };
36114
+ var labelStyles = {
36115
+ display: 'block',
36116
+ marginBottom: 8,
36117
+ fontSize: 12,
36118
+ color: '#000',
36119
+ width: '100%',
36120
+ fontWeight: 'bold',
36121
+ textTransform: 'capitalize',
36122
+ };
36123
+ var FormPlainTextInput = /* @__PURE__ */ react_155.default.forwardRef(function FormPlainTextInput2(props, ref) {
36124
+ const dataProps = Object.assign(Object.assign({}, sensibleInputDefaults), passwordManagerIgnoreDataProps);
36078
36125
  const baseStyle2 = {
36079
- padding: '12px',
36126
+ fontSize: '14px',
36080
36127
  width: '100%',
36081
36128
  background: '#f5f5f5',
36082
36129
  borderRadius: '10px',
36083
36130
  border: '1px solid rgba(0,0,0,0.05)',
36084
36131
  };
36085
- return /* @__PURE__ */ (0, jsx_runtime_66.jsx)(motion.input, Object.assign(Object.assign({ disabled: isDisabled }, dataProps), { layoutId,
36086
- ref, style: Object.assign(Object.assign({}, baseStyle2), props.style), placeholder: props.placeholder }));
36087
- };
36132
+ const input = /* @__PURE__ */ (0, jsx_runtime_66.jsx)(motion.input, Object.assign(Object.assign({ id: props.inputName, disabled: props.isDisabled }, dataProps), { type: props.type, required: props.required, autoFocus: props.autoFocus, name: props.inputName, style: baseStyle2, placeholder: props.placeholder }));
36133
+ if (props.label) {
36134
+ return /* @__PURE__ */ (0, jsx_runtime_66.jsx)('div', {
36135
+ ref,
36136
+ style: { width: '100%', },
36137
+ children: /* @__PURE__ */ (0, jsx_runtime_66.jsxs)('label', {
36138
+ style: { width: '100%', },
36139
+ htmlFor: props.inputName,
36140
+ children: [
36141
+ /* @__PURE__ */ (0, jsx_runtime_66.jsx)('span', { style: labelStyles, children: props.label, }),
36142
+ input,
36143
+ ],
36144
+ }),
36145
+ });
36146
+ }
36147
+ return /* @__PURE__ */ (0, jsx_runtime_66.jsx)('div', { ref, style: { width: '100%', }, children: input, });
36148
+ });
36088
36149
  exports.FormPlainTextInput = FormPlainTextInput;
36089
36150
  var Image2 = /* @__PURE__ */ react_156.default.forwardRef(function Image3(props, ref) {
36090
36151
  const { background, children, alt } = props, rest = __rest(props, ["background", "children", "alt"]);
@@ -36187,7 +36248,7 @@ function escapeHTML2(str) {
36187
36248
  }
36188
36249
  var deprecatedRichTextPlaceholder = '{{ text-placeholder }}';
36189
36250
  var richTextWrapperClassName = 'rich-text-wrapper';
36190
- var DeprecatedRichText = /* @__PURE__ */ React86.forwardRef(function Text3(props, forwardedRef) {
36251
+ var DeprecatedRichText = /* @__PURE__ */ React88.forwardRef(function Text3(props, forwardedRef) {
36191
36252
  var _f, _j;
36192
36253
  const { id: id3, name, html, htmlFromDesign, text, textFromDesign, fonts = [], width, height, left, right, top, bottom, center, className, stylesPresetsClassName, visible = true, opacity, rotation = 0, verticalAlignment = 'top', isEditable = false, willChangeTransform, environment: environment2 = RenderTarget.current, withExternalLayout = false, positionSticky, positionStickyTop, positionStickyRight, positionStickyBottom, positionStickyLeft, __htmlStructure, __fromCanvasComponent = false, _forwardedOverrideId, _forwardedOverrides, _usesDOMRect, children } = props, rest = __rest(props, ["id", "name", "html", "htmlFromDesign", "text", "textFromDesign", "fonts", "width", "height", "left", "right", "top", "bottom", "center", "className", "stylesPresetsClassName", "visible", "opacity", "rotation", "verticalAlignment", "isEditable", "willChangeTransform", "environment", "withExternalLayout", "positionSticky", "positionStickyTop", "positionStickyRight", "positionStickyBottom", "positionStickyLeft", "__htmlStructure", "__fromCanvasComponent", "_forwardedOverrideId", "_forwardedOverrides", "_usesDOMRect", "children"]);
36193
36254
  const parentSize = useParentSize();
@@ -36198,7 +36259,7 @@ var DeprecatedRichText = /* @__PURE__ */ React86.forwardRef(function Text3(props
36198
36259
  const currentRoute = useCurrentRoute();
36199
36260
  useRoutePreloader((_f = props.preload) !== null && _f !== void 0 ? _f : []);
36200
36261
  useMeasureLayout(props, layoutRef);
36201
- const inCodeComponent = React86.useContext(ComponentContainerContext);
36262
+ const inCodeComponent = React88.useContext(ComponentContainerContext);
36202
36263
  const isOnCanvas = useIsOnFramerCanvas();
36203
36264
  let textOrOverride = text;
36204
36265
  const forwardedOverrideId = _forwardedOverrideId !== null && _forwardedOverrideId !== void 0 ? _forwardedOverrideId : id3;
@@ -36224,13 +36285,13 @@ var DeprecatedRichText = /* @__PURE__ */ React86.forwardRef(function Text3(props
36224
36285
  innerHTML = htmlFromDesign;
36225
36286
  }
36226
36287
  const implicitPathVariables = useImplicitPathVariables();
36227
- const innerHTMLWithReplacedFramerPageLinks = React86.useMemo(() => {
36288
+ const innerHTMLWithReplacedFramerPageLinks = React88.useMemo(() => {
36228
36289
  if (isOnCanvas || !getRoute || !currentRoute) {
36229
36290
  return innerHTML;
36230
36291
  }
36231
36292
  return replaceFramerPageLinks(innerHTML, getRoute, currentRoute, implicitPathVariables);
36232
36293
  }, [isOnCanvas, innerHTML, getRoute, currentRoute, implicitPathVariables,]);
36233
- React86.useEffect(() => {
36294
+ React88.useEffect(() => {
36234
36295
  const container = layoutRef.current;
36235
36296
  if (container === null) {
36236
36297
  return;
@@ -36251,7 +36312,7 @@ var DeprecatedRichText = /* @__PURE__ */ React86.forwardRef(function Text3(props
36251
36312
  };
36252
36313
  }, [navigate, implicitPathVariables,]);
36253
36314
  useLoadFonts(fonts, __fromCanvasComponent, layoutRef);
36254
- React86.useInsertionEffect(() => {
36315
+ React88.useInsertionEffect(() => {
36255
36316
  injectComponentCSSRules();
36256
36317
  }, []);
36257
36318
  if (!visible) {
@@ -36892,7 +36953,9 @@ var package_default = {
36892
36953
  scripts: {
36893
36954
  prepublishOnly: 'make build',
36894
36955
  coverage: 'yarn :jest --coverage',
36895
- lint: 'yarn :eslint ./src --ext .ts,.tsx --format codeframe --quiet',
36956
+ lint: 'yarn format-check:ts && yarn :eslint ./src --ext .ts,.tsx --format codeframe --quiet',
36957
+ 'format:ts': 'yarn :format "src/**/*.{ts,tsx}"',
36958
+ 'format-check:ts': 'yarn :format-check "src/**/*.{ts,tsx}"',
36896
36959
  'lint:fix': 'yarn lint --fix --cache',
36897
36960
  test: 'yarn :jest',
36898
36961
  watch: 'yarn :jest --watch',