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/dist/react.mjs CHANGED
@@ -721,7 +721,7 @@ function definePolicy(given) {
721
721
  }
722
722
 
723
723
  // src/components.tsx
724
- import { Fragment, useCallback, useEffect, useId, useRef, useState } from "react";
724
+ import { Fragment, useCallback, useEffect, useId, useRef, useState, useSyncExternalStore } from "react";
725
725
  import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
726
726
  var TEXTS = {
727
727
  en: {
@@ -774,7 +774,6 @@ var TEXTS = {
774
774
  savePassword: "Save the password",
775
775
  passwordChanged: "Your password was changed. You can sign in with it now.",
776
776
  confirming: "Confirming your address\u2026",
777
- loading: "Loading\u2026",
778
777
  emailConfirmed: "Your address is confirmed. You can sign in now.",
779
778
  invitedTo: "You've been invited to {workspace}",
780
779
  invitedToOrganization: "You've been invited to {organization} on {workspace}",
@@ -956,7 +955,6 @@ var TEXTS = {
956
955
  savePassword: "Guardar la contrase\xF1a",
957
956
  passwordChanged: "Tu contrase\xF1a se cambi\xF3. Ya puedes entrar con ella.",
958
957
  confirming: "Confirmando tu correo\u2026",
959
- loading: "Cargando\u2026",
960
958
  emailConfirmed: "Tu correo qued\xF3 confirmado. Ya puedes entrar.",
961
959
  invitedTo: "Te invitaron a {workspace}",
962
960
  invitedToOrganization: "Te invitaron a {organization} en {workspace}",
@@ -1090,13 +1088,37 @@ var TEXTS = {
1090
1088
  }
1091
1089
  };
1092
1090
  var PlainButton = ({ variant: _variant, loading, children, ...p }) => /* @__PURE__ */ jsxs("button", { ...p, "aria-busy": loading || void 0, children: [
1093
- loading && /* @__PURE__ */ jsx("span", { className: "cauthy-spinner", "aria-hidden": "true" }),
1091
+ loading && /* @__PURE__ */ jsx(Spinner, {}),
1094
1092
  children
1095
1093
  ] });
1096
1094
  var UnstyledButton = ({ variant: _variant, loading, children, ...p }) => /* @__PURE__ */ jsxs("button", { ...p, "aria-busy": loading || void 0, children: [
1097
- children,
1098
- loading && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "\u2026" })
1095
+ loading && /* @__PURE__ */ jsxs(Fragment2, { children: [
1096
+ /* @__PURE__ */ jsx(Spinner, { plain: true }),
1097
+ " "
1098
+ ] }),
1099
+ children
1099
1100
  ] });
1101
+ function Spinner({ plain }) {
1102
+ if (!plain) return /* @__PURE__ */ jsx("span", { className: "cauthy-spinner", "aria-hidden": "true" });
1103
+ return /* @__PURE__ */ jsx(SpinnerIcon, {});
1104
+ }
1105
+ var LESS_MOTION = "(prefers-reduced-motion: reduce)";
1106
+ function watchMotion(changed) {
1107
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") return () => {
1108
+ };
1109
+ const query = window.matchMedia(LESS_MOTION);
1110
+ query.addEventListener?.("change", changed);
1111
+ return () => query.removeEventListener?.("change", changed);
1112
+ }
1113
+ var stillHere = () => typeof window.matchMedia === "function" && window.matchMedia(LESS_MOTION).matches;
1114
+ var stillOnServer = () => true;
1115
+ function SpinnerIcon() {
1116
+ const still = useSyncExternalStore(watchMotion, stillHere, stillOnServer);
1117
+ return /* @__PURE__ */ jsxs("svg", { className: "cauthy-spinner-icon", width: "1em", height: "1em", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", focusable: "false", children: [
1118
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6.5", stroke: "currentColor", strokeOpacity: "0.25", strokeWidth: "2" }),
1119
+ /* @__PURE__ */ jsx("path", { d: "M14.5 8A6.5 6.5 0 0 0 8 1.5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: !still && /* @__PURE__ */ jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 8 8", to: "360 8 8", dur: "0.7s", repeatCount: "indefinite" }) })
1120
+ ] });
1121
+ }
1100
1122
  var PlainInput = (p) => /* @__PURE__ */ jsx("input", { ...p });
1101
1123
  var looks = /* @__PURE__ */ new Map();
1102
1124
  var loaded = /* @__PURE__ */ new Set();
@@ -1295,12 +1317,7 @@ function Wrap(p) {
1295
1317
  return /* @__PURE__ */ jsx(Tag2, { className: p.slot ? p.f.cx(p.slot) : void 0, ...p.root, onSubmit: p.onSubmit, noValidate: p.noValidate, "aria-busy": busy, children });
1296
1318
  }
1297
1319
  function Pending({ f }) {
1298
- if (f.plain) return /* @__PURE__ */ jsx("p", { role: "status", children: f.t.loading });
1299
- return /* @__PURE__ */ jsxs("p", { role: "status", className: f.cx("pending"), children: [
1300
- /* @__PURE__ */ jsx("span", { className: "cauthy-spinner", "aria-hidden": "true" }),
1301
- " ",
1302
- f.t.loading
1303
- ] });
1320
+ return /* @__PURE__ */ jsx("div", { className: f.cx("pending"), children: /* @__PURE__ */ jsx(Spinner, { plain: f.plain }) });
1304
1321
  }
1305
1322
  function Note({ f, children, footer }) {
1306
1323
  const { Text } = f.C;