cauthy-auth 0.35.0 → 0.35.2

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/README.md CHANGED
@@ -195,7 +195,7 @@ const Button = ({ variant, loading, children, ...rest }: AuthButtonProps) => (
195
195
  )
196
196
  ```
197
197
 
198
- The forms stay busy from the press until the work is really over. A sign-in that leaves the form (the password, the second step, a passkey, a provider, SSO, a sign-up done, an invitation accepted) stays busy until the browser leaves the page; with `onSuccess`, return a Promise when the form stays on screen while your application moves on (`onSuccess={() => router.navigate({ to: '/' })}`), and the form waits for it, then is free again if still shown. A plain `onSuccess` keeps it busy until it unmounts. A refusal, a sign-in link sent or a sign-up that asks to confirm the address frees it; so does coming back from the browser's back-forward cache. Until the workspace says what it offers, `<SignIn />` shows its form busy with nothing to press, and `<SignUp />`, `<Account />` and `<OrganizationMembers />` say "Loading…" (`texts.loading`). The plain button draws a spinner before its label (`.cauthy-spinner` in `styles.css`, still under `prefers-reduced-motion`); with `unstyled`, it adds "…" after the label.
198
+ The forms stay busy from the press until the work is really over. A sign-in that leaves the form (the password, the second step, a passkey, a provider, SSO, a sign-up done, an invitation accepted) stays busy until the browser leaves the page; with `onSuccess`, return a Promise when the form stays on screen while your application moves on (`onSuccess={() => router.navigate({ to: '/' })}`), and the form waits for it, then is free again if still shown. A plain `onSuccess` keeps it busy until it unmounts. A refusal, a sign-in link sent or a sign-up that asks to confirm the address frees it; so does coming back from the browser's back-forward cache. Until the workspace says what it offers, `<SignIn />` shows its form busy with nothing to press, and `<SignUp />`, `<Account />` and `<OrganizationMembers />` show a spinner alone, centred, with `aria-busy` on their wrapper. Loaders are icons, never words, so they read the same in any language. The plain button draws a spinner before its label (`.cauthy-spinner` in `styles.css`, still under `prefers-reduced-motion`); with `unstyled`, an SVG icon that turns by itself (no stylesheet needed) and stands still under `prefers-reduced-motion`. The icon is `aria-hidden`; the button says `aria-busy`.
199
199
 
200
200
  | Part | Is given |
201
201
  | --- | --- |
package/dist/react.d.mts CHANGED
@@ -1197,8 +1197,6 @@ interface AuthTexts {
1197
1197
  savePassword: string;
1198
1198
  passwordChanged: string;
1199
1199
  confirming: string;
1200
- /** While a form waits on what the workspace offers, or on the account it shows. */
1201
- loading: string;
1202
1200
  emailConfirmed: string;
1203
1201
  invitedTo: string;
1204
1202
  invitedToOrganization: string;
package/dist/react.d.ts CHANGED
@@ -1197,8 +1197,6 @@ interface AuthTexts {
1197
1197
  savePassword: string;
1198
1198
  passwordChanged: string;
1199
1199
  confirming: string;
1200
- /** While a form waits on what the workspace offers, or on the account it shows. */
1201
- loading: string;
1202
1200
  emailConfirmed: string;
1203
1201
  invitedTo: string;
1204
1202
  invitedToOrganization: string;
package/dist/react.js CHANGED
@@ -823,7 +823,6 @@ var TEXTS = {
823
823
  savePassword: "Save the password",
824
824
  passwordChanged: "Your password was changed. You can sign in with it now.",
825
825
  confirming: "Confirming your address\u2026",
826
- loading: "Loading\u2026",
827
826
  emailConfirmed: "Your address is confirmed. You can sign in now.",
828
827
  invitedTo: "You've been invited to {workspace}",
829
828
  invitedToOrganization: "You've been invited to {organization} on {workspace}",
@@ -1005,7 +1004,6 @@ var TEXTS = {
1005
1004
  savePassword: "Guardar la contrase\xF1a",
1006
1005
  passwordChanged: "Tu contrase\xF1a se cambi\xF3. Ya puedes entrar con ella.",
1007
1006
  confirming: "Confirmando tu correo\u2026",
1008
- loading: "Cargando\u2026",
1009
1007
  emailConfirmed: "Tu correo qued\xF3 confirmado. Ya puedes entrar.",
1010
1008
  invitedTo: "Te invitaron a {workspace}",
1011
1009
  invitedToOrganization: "Te invitaron a {organization} en {workspace}",
@@ -1139,13 +1137,37 @@ var TEXTS = {
1139
1137
  }
1140
1138
  };
1141
1139
  var PlainButton = ({ variant: _variant, loading, children, ...p }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { ...p, "aria-busy": loading || void 0, children: [
1142
- loading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "cauthy-spinner", "aria-hidden": "true" }),
1140
+ loading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, {}),
1143
1141
  children
1144
1142
  ] });
1145
1143
  var UnstyledButton = ({ variant: _variant, loading, children, ...p }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { ...p, "aria-busy": loading || void 0, children: [
1146
- children,
1147
- loading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": "true", children: "\u2026" })
1144
+ loading && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1145
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { plain: true }),
1146
+ " "
1147
+ ] }),
1148
+ children
1148
1149
  ] });
1150
+ function Spinner({ plain }) {
1151
+ if (!plain) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "cauthy-spinner", "aria-hidden": "true" });
1152
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SpinnerIcon, {});
1153
+ }
1154
+ var LESS_MOTION = "(prefers-reduced-motion: reduce)";
1155
+ function watchMotion(changed) {
1156
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") return () => {
1157
+ };
1158
+ const query = window.matchMedia(LESS_MOTION);
1159
+ query.addEventListener?.("change", changed);
1160
+ return () => query.removeEventListener?.("change", changed);
1161
+ }
1162
+ var stillHere = () => typeof window.matchMedia === "function" && window.matchMedia(LESS_MOTION).matches;
1163
+ var stillOnServer = () => true;
1164
+ function SpinnerIcon() {
1165
+ const still = (0, import_react.useSyncExternalStore)(watchMotion, stillHere, stillOnServer);
1166
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { className: "cauthy-spinner-icon", width: "1em", height: "1em", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", focusable: "false", children: [
1167
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "8", r: "6.5", stroke: "currentColor", strokeOpacity: "0.25", strokeWidth: "2" }),
1168
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M14.5 8A6.5 6.5 0 0 0 8 1.5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: !still && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("animateTransform", { attributeName: "transform", type: "rotate", from: "0 8 8", to: "360 8 8", dur: "0.7s", repeatCount: "indefinite" }) })
1169
+ ] });
1170
+ }
1149
1171
  var PlainInput = (p) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { ...p });
1150
1172
  var looks = /* @__PURE__ */ new Map();
1151
1173
  var loaded = /* @__PURE__ */ new Set();
@@ -1344,12 +1366,7 @@ function Wrap(p) {
1344
1366
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tag2, { className: p.slot ? p.f.cx(p.slot) : void 0, ...p.root, onSubmit: p.onSubmit, noValidate: p.noValidate, "aria-busy": busy, children });
1345
1367
  }
1346
1368
  function Pending({ f }) {
1347
- if (f.plain) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "status", children: f.t.loading });
1348
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { role: "status", className: f.cx("pending"), children: [
1349
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "cauthy-spinner", "aria-hidden": "true" }),
1350
- " ",
1351
- f.t.loading
1352
- ] });
1369
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: f.cx("pending"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { plain: f.plain }) });
1353
1370
  }
1354
1371
  function Note({ f, children, footer }) {
1355
1372
  const { Text } = f.C;