@sevenfold/setto-client 0.8.2 → 0.8.4

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.
@@ -56,3 +56,30 @@ export interface SettoFormProps {
56
56
  classNames?: SettoFormClassNames;
57
57
  }
58
58
  export declare function SettoForm({ formId, fields: propFields, endpoint, endpointKey, className, classNames, }: SettoFormProps): import("react/jsx-runtime").JSX.Element;
59
+ /**
60
+ * Enough that an unstyled form looks intentional, while still losing to
61
+ * anything the site says on purpose. Colours lean on `currentColor`, so the
62
+ * form follows whatever section it sits in, light or dark.
63
+ *
64
+ * Every rule is scoped under `.setto-form`, which is not decoration: written
65
+ * at the zero specificity of a bare `:where()`, these rules lost to Tailwind's
66
+ * Preflight — `button, input, optgroup, select, textarea { padding: 0 }` is an
67
+ * element selector, and an element selector outranks nothing at all. Every
68
+ * generated site ships Preflight, so every form went out with no padding on
69
+ * its fields or its button. Simon, on a real site: "the form in the bottom
70
+ * seems unstyled."
71
+ *
72
+ * So the sheet is in two halves, and which half a property lands in is decided
73
+ * by who it has to beat.
74
+ *
75
+ * SHAPE — padding, width, radius, the things Preflight strips — is scoped
76
+ * `.setto-form :where(…)`. That scores one class, which beats an element
77
+ * selector, and puts back exactly what the reset took away.
78
+ *
79
+ * COLOUR — background, border colour, text colour — stays at zero specificity,
80
+ * because here the site really must win. The generator emits `bg-card` and
81
+ * `text-foreground` on these very elements, and scoping those under a class
82
+ * would tie on weight and then beat them on order, quietly discarding the
83
+ * palette the build chose. Shape is ours; colour is theirs.
84
+ */
85
+ export declare const BASE_CSS = "\n.setto-form{display:grid;gap:1.1rem;position:relative}\n.setto-form :where(.setto-form__field){display:grid;gap:.4rem;position:relative}\n.setto-form :where(.setto-form__label,.setto-form__legend){font-weight:500;line-height:1.3;padding:0}\n.setto-form :where(.setto-form__required){opacity:.6;margin-left:.15em}\n.setto-form :where(.setto-form__input,.setto-form__textarea,.setto-form__select){width:100%;box-sizing:border-box;padding:.7rem .85rem;border-width:1px;border-style:solid;border-radius:.6rem;font:inherit;line-height:1.4}\n.setto-form :where(.setto-form__textarea){min-height:7.5rem;resize:vertical}\n.setto-form :where(.setto-form__fieldset){border:0;padding:0;margin:0;min-width:0;display:grid;gap:.5rem}\n.setto-form :where(.setto-form__options){display:grid;gap:.5rem}\n.setto-form :where(.setto-form__option,.setto-form__check){display:flex;gap:.6rem;align-items:flex-start;line-height:1.4;cursor:pointer;font-weight:400}\n.setto-form :where(.setto-form__option input,.setto-form__check input){margin:.25em 0 0;flex:none;accent-color:currentColor}\n.setto-form :where(.setto-form__actions){display:flex;flex-wrap:wrap;gap:.75rem 1rem;align-items:center}\n.setto-form :where(.setto-form__button){cursor:pointer;font:inherit;font-weight:500;padding:.75rem 1.4rem;border-radius:999px;border-width:1px;border-style:solid}\n.setto-form :where(.setto-form__success){display:grid;gap:.75rem;justify-items:start;outline:none}\n.setto-form :where(.setto-form__success-icon){width:2.5rem;height:2.5rem}\n.setto-form :where(.setto-form__success-text){margin:0;font-size:1.05em}\n.setto-form :where(.setto-form__hp){position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden;opacity:0;pointer-events:none}\n:where(.setto-form__input,.setto-form__textarea,.setto-form__select){border-color:color-mix(in srgb,currentColor 28%,transparent);background:color-mix(in srgb,currentColor 4%,transparent);color:inherit}\n:where(.setto-form__input,.setto-form__textarea,.setto-form__select)::placeholder{color:inherit;opacity:.5}\n:where(.setto-form__input,.setto-form__textarea,.setto-form__select):focus-visible{outline:2px solid currentColor;outline-offset:1px}\n:where(.setto-form__button){border-color:currentColor;background:transparent;color:inherit}\n:where(.setto-form__button:disabled){opacity:.6;cursor:progress}\n:where(.setto-form__field-error,.setto-form__error){font-size:.875rem;color:#b42318;margin:0}\n:where(.setto-form__success-icon){color:#0f7b4f}\n:where(.setto-form__again){background:none;border:0;padding:0;color:inherit;text-decoration:underline;cursor:pointer;font:inherit;opacity:.8;width:fit-content;max-width:100%;text-align:inherit}\n:where(.setto-form [aria-invalid=\"true\"]){border-color:#b42318}\n";
@@ -21410,6 +21410,13 @@ function SettoPreviewBar() {
21410
21410
  const signIn = () => {
21411
21411
  window.location.href = "/setto";
21412
21412
  };
21413
+ const next = () => {
21414
+ if (window.parent !== window) {
21415
+ window.parent.postMessage({ type: "setto:next", siteId: config.siteId }, "*");
21416
+ return;
21417
+ }
21418
+ signIn();
21419
+ };
21413
21420
  const publish = async () => {
21414
21421
  setBusy(true);
21415
21422
  setError(null);
@@ -21459,11 +21466,8 @@ function SettoPreviewBar() {
21459
21466
  /* @__PURE__ */ jsx("button", { type: "button", style: primaryStyle, onClick: publish, disabled: busy, children: busy ? "Åpner betaling …" : "Publiser" })
21460
21467
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
21461
21468
  /* @__PURE__ */ jsx("span", { style: dotStyle, "aria-hidden": true }),
21462
- /* @__PURE__ */ jsxs("span", { style: labelStyle, children: [
21463
- "Forhåndsvisning av ",
21464
- name
21465
- ] }),
21466
- /* @__PURE__ */ jsx("button", { type: "button", style: primaryStyle, onClick: signIn, children: "Rediger" })
21469
+ /* @__PURE__ */ jsx("span", { style: labelStyle, children: "Forhåndsvisning" }),
21470
+ /* @__PURE__ */ jsx("button", { type: "button", style: primaryStyle, onClick: next, children: "Neste" })
21467
21471
  ] })
21468
21472
  }
21469
21473
  ),
@@ -21487,7 +21491,20 @@ const barStyle = {
21487
21491
  fontFamily: 'system-ui, -apple-system, "Segoe UI", sans-serif',
21488
21492
  fontSize: 14,
21489
21493
  lineHeight: 1.3,
21490
- boxShadow: "0 18px 40px -18px rgba(0, 0, 0, 0.65)"
21494
+ boxShadow: "0 18px 40px -18px rgba(0, 0, 0, 0.65)",
21495
+ /*
21496
+ * A frosted rim, so the pill reads as an object on any page.
21497
+ *
21498
+ * The bar sits on sites Setto did not choose the colours for: on a dark hero
21499
+ * a dark pill disappears, and on a pale section its shadow is all that holds
21500
+ * it. A translucent white border with `padding-box` clipping lets the page
21501
+ * show through the rim itself, which separates the pill from either ground
21502
+ * without picking a side.
21503
+ */
21504
+ border: "5px solid rgba(255, 255, 255, 0.22)",
21505
+ backgroundClip: "padding-box",
21506
+ backdropFilter: "blur(10px)",
21507
+ WebkitBackdropFilter: "blur(10px)"
21491
21508
  };
21492
21509
  const dotStyle = {
21493
21510
  width: 7,
@@ -24298,28 +24315,31 @@ function CheckIcon() {
24298
24315
  }
24299
24316
  const STYLE_ID$1 = "setto-form-styles";
24300
24317
  const BASE_CSS = `
24301
- :where(.setto-form){display:grid;gap:1.1rem;position:relative}
24302
- :where(.setto-form__field){display:grid;gap:.4rem;position:relative}
24303
- :where(.setto-form__label,.setto-form__legend){font-weight:500;line-height:1.3;padding:0}
24304
- :where(.setto-form__required){opacity:.6;margin-left:.15em}
24305
- :where(.setto-form__input,.setto-form__textarea,.setto-form__select){width:100%;box-sizing:border-box;padding:.7rem .85rem;border:1px solid color-mix(in srgb,currentColor 28%,transparent);border-radius:.6rem;background:color-mix(in srgb,currentColor 4%,transparent);color:inherit;font:inherit;line-height:1.4}
24318
+ .setto-form{display:grid;gap:1.1rem;position:relative}
24319
+ .setto-form :where(.setto-form__field){display:grid;gap:.4rem;position:relative}
24320
+ .setto-form :where(.setto-form__label,.setto-form__legend){font-weight:500;line-height:1.3;padding:0}
24321
+ .setto-form :where(.setto-form__required){opacity:.6;margin-left:.15em}
24322
+ .setto-form :where(.setto-form__input,.setto-form__textarea,.setto-form__select){width:100%;box-sizing:border-box;padding:.7rem .85rem;border-width:1px;border-style:solid;border-radius:.6rem;font:inherit;line-height:1.4}
24323
+ .setto-form :where(.setto-form__textarea){min-height:7.5rem;resize:vertical}
24324
+ .setto-form :where(.setto-form__fieldset){border:0;padding:0;margin:0;min-width:0;display:grid;gap:.5rem}
24325
+ .setto-form :where(.setto-form__options){display:grid;gap:.5rem}
24326
+ .setto-form :where(.setto-form__option,.setto-form__check){display:flex;gap:.6rem;align-items:flex-start;line-height:1.4;cursor:pointer;font-weight:400}
24327
+ .setto-form :where(.setto-form__option input,.setto-form__check input){margin:.25em 0 0;flex:none;accent-color:currentColor}
24328
+ .setto-form :where(.setto-form__actions){display:flex;flex-wrap:wrap;gap:.75rem 1rem;align-items:center}
24329
+ .setto-form :where(.setto-form__button){cursor:pointer;font:inherit;font-weight:500;padding:.75rem 1.4rem;border-radius:999px;border-width:1px;border-style:solid}
24330
+ .setto-form :where(.setto-form__success){display:grid;gap:.75rem;justify-items:start;outline:none}
24331
+ .setto-form :where(.setto-form__success-icon){width:2.5rem;height:2.5rem}
24332
+ .setto-form :where(.setto-form__success-text){margin:0;font-size:1.05em}
24333
+ .setto-form :where(.setto-form__hp){position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden;opacity:0;pointer-events:none}
24334
+ :where(.setto-form__input,.setto-form__textarea,.setto-form__select){border-color:color-mix(in srgb,currentColor 28%,transparent);background:color-mix(in srgb,currentColor 4%,transparent);color:inherit}
24306
24335
  :where(.setto-form__input,.setto-form__textarea,.setto-form__select)::placeholder{color:inherit;opacity:.5}
24307
24336
  :where(.setto-form__input,.setto-form__textarea,.setto-form__select):focus-visible{outline:2px solid currentColor;outline-offset:1px}
24308
- :where(.setto-form__textarea){min-height:7.5rem;resize:vertical}
24309
- :where(.setto-form__fieldset){border:0;padding:0;margin:0;min-width:0;display:grid;gap:.5rem}
24310
- :where(.setto-form__options){display:grid;gap:.5rem}
24311
- :where(.setto-form__option,.setto-form__check){display:flex;gap:.6rem;align-items:flex-start;line-height:1.4;cursor:pointer;font-weight:400}
24312
- :where(.setto-form__option input,.setto-form__check input){margin:.25em 0 0;flex:none;accent-color:currentColor}
24313
- :where(.setto-form__field-error,.setto-form__error){font-size:.875rem;color:#b42318;margin:0}
24314
- :where(.setto-form [aria-invalid="true"]){border-color:#b42318}
24315
- :where(.setto-form__actions){display:flex;flex-wrap:wrap;gap:.75rem 1rem;align-items:center}
24316
- :where(.setto-form__button){cursor:pointer;font:inherit;font-weight:500;padding:.75rem 1.4rem;border-radius:999px;border:1px solid currentColor;background:transparent;color:inherit}
24337
+ :where(.setto-form__button){border-color:currentColor;background:transparent;color:inherit}
24317
24338
  :where(.setto-form__button:disabled){opacity:.6;cursor:progress}
24318
- :where(.setto-form__success){display:grid;gap:.75rem;justify-items:start;outline:none}
24319
- :where(.setto-form__success-icon){width:2.5rem;height:2.5rem;color:#0f7b4f}
24320
- :where(.setto-form__success-text){margin:0;font-size:1.05em}
24339
+ :where(.setto-form__field-error,.setto-form__error){font-size:.875rem;color:#b42318;margin:0}
24340
+ :where(.setto-form__success-icon){color:#0f7b4f}
24321
24341
  :where(.setto-form__again){background:none;border:0;padding:0;color:inherit;text-decoration:underline;cursor:pointer;font:inherit;opacity:.8;width:fit-content;max-width:100%;text-align:inherit}
24322
- :where(.setto-form__hp){position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden;opacity:0;pointer-events:none}
24342
+ :where(.setto-form [aria-invalid="true"]){border-color:#b42318}
24323
24343
  `;
24324
24344
  function useFormStyles() {
24325
24345
  useInsertionEffect(() => {