@alfadocs/ui-kit 0.33.0 → 0.33.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.
@@ -0,0 +1,33 @@
1
+ import { useRef as f, useEffect as l } from "react";
2
+ function p({
3
+ onCode: i,
4
+ onError: o,
5
+ enabled: c = !0
6
+ }) {
7
+ const s = f(i), e = f(o);
8
+ s.current = i, e.current = o, l(() => {
9
+ if (!c || typeof window > "u" || !("OTPCredential" in window)) return;
10
+ const u = new AbortController(), a = {
11
+ otp: { transport: ["sms"] },
12
+ signal: u.signal
13
+ };
14
+ let r = !1;
15
+ return navigator.credentials.get(a).then((t) => {
16
+ if (r) return;
17
+ const n = t;
18
+ n != null && n.code && s.current(n.code);
19
+ }).catch((t) => {
20
+ var n;
21
+ r || t instanceof DOMException && t.name === "AbortError" || (n = e.current) == null || n.call(
22
+ e,
23
+ t instanceof Error ? t : new Error(String(t))
24
+ );
25
+ }), () => {
26
+ r = !0, u.abort();
27
+ };
28
+ }, [c]);
29
+ }
30
+ export {
31
+ p as u
32
+ };
33
+ //# sourceMappingURL=use-web-otp-D_utzp6S.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "0.33.0",
3
+ "packageVersion": "0.33.2",
4
4
  "components": [
5
5
  {
6
6
  "kind": "component",
@@ -1,4 +1,4 @@
1
- import { O as r } from "../../_chunks/otp-input-BEg_sn8A.js";
1
+ import { O as r } from "../../_chunks/otp-input-CDTWT5EK.js";
2
2
  export {
3
3
  r as OTPInput
4
4
  };
@@ -18,6 +18,22 @@ export interface OTPInputProps {
18
18
  /** Stable id, used to address this instance from the agent runtime. */
19
19
  id?: string;
20
20
  className?: string;
21
+ /**
22
+ * Opt into Chrome-Android's WebOTP API for one-tap SMS autofill. When
23
+ * the browser surfaces a matching SMS-bound credential, the kit spreads
24
+ * the code across every digit box and fires `onComplete` automatically.
25
+ *
26
+ * Falls back silently to manual entry on Firefox / desktop / iOS — those
27
+ * platforms either don't ship the API at all or rely on the
28
+ * `autocomplete="one-time-code"` QuickType heuristic the kit already
29
+ * applies to the first input.
30
+ *
31
+ * Prerequisites the prop can't enforce: page must be HTTPS, and the SMS
32
+ * body must end with `@<origin> #<code>` on its last line (Chrome's
33
+ * spec — without it the browser refuses to surface the message).
34
+ * Default `false` so the listener stays opt-in.
35
+ */
36
+ webOtp?: boolean;
21
37
  }
22
38
  export declare const OTPInput: import("react").ForwardRefExoticComponent<OTPInputProps & import("react").RefAttributes<HTMLDivElement>>;
23
39
  //# sourceMappingURL=otp-input.d.ts.map
@@ -1,4 +1,4 @@
1
- import { P as t, p as a } from "../../_chunks/practice-results-Bw5fJTYF.js";
1
+ import { P as t, p as a } from "../../_chunks/practice-results-Dwm5tzLV.js";
2
2
  export {
3
3
  t as PracticeResults,
4
4
  a as practiceResultsAgent
@@ -99,6 +99,17 @@ export interface PracticeResultsProps extends Omit<ComponentPropsWithoutRef<'div
99
99
  };
100
100
  facets?: FacetGroup[];
101
101
  googleMapsApiKey?: string;
102
+ /**
103
+ * Google Maps Map ID — required when consumers use Google's
104
+ * `AdvancedMarkerElement`. Forwarded to every internal `<MapView>`
105
+ * instance (split-list-map's desktop + mobile-sheet column,
106
+ * map-first's main canvas). `rich-cards` thumbnails are unaffected
107
+ * — they're static `<img>` fetches, not the JS SDK.
108
+ *
109
+ * When omitted, MapView falls back to the kit's inline-style
110
+ * theming (`getGoogleMapsTheme()`), same as before.
111
+ */
112
+ mapId?: string;
102
113
  /** Initial map zoom. Default 13. */
103
114
  defaultZoom?: number;
104
115
  /** Fires when patient pans/zooms (split + map-first only). */
@@ -16,4 +16,5 @@ export { useFocusTrap, type UseFocusTrapOptions } from './use-focus-trap';
16
16
  export { useDirection, useDocumentDirection, type Direction, } from './use-direction';
17
17
  export { usePersistentState } from './use-persistent-state';
18
18
  export { useIsomorphicLayoutEffect } from './use-isomorphic-layout-effect';
19
+ export { useWebOtp, type UseWebOtpOptions } from './use-web-otp';
19
20
  //# sourceMappingURL=index.d.ts.map
@@ -1,27 +1,28 @@
1
1
  import { u as v } from "../_chunks/use-prefers-reduced-motion-BMwIQRjB.js";
2
2
  import { u as D } from "../_chunks/use-media-query-CcAx5SMM.js";
3
3
  import { u as _ } from "../_chunks/use-scroll-to-first-error-4Za-u5Nw.js";
4
- import { u as g } from "../_chunks/use-count-up-BLLetaZ8.js";
5
- import { u as w } from "../_chunks/use-locale-BkCIHujH.js";
6
- import { A as O, T as R, a as H, r as M, t as Y, u as q } from "../_chunks/use-theme-C2dHKUAN.js";
4
+ import { u as O } from "../_chunks/use-count-up-BLLetaZ8.js";
5
+ import { u as k } from "../_chunks/use-locale-BkCIHujH.js";
6
+ import { A as K, T as R, a as H, r as M, t as Y, u as q } from "../_chunks/use-theme-C2dHKUAN.js";
7
7
  import { u as G } from "../_chunks/use-controllable-state-BiY4xTzM.js";
8
8
  import { u as U } from "../_chunks/use-copy-to-clipboard-Cyfc_dlv.js";
9
9
  import { u as j } from "../_chunks/use-debounced-callback-BisrB-Fq.js";
10
10
  import { useState as x, useRef as b, useEffect as E } from "react";
11
- import { u as z, a as J } from "../_chunks/use-direction-Dp8h70PP.js";
12
- import { u as W } from "../_chunks/use-persistent-state-i23OWy6G.js";
11
+ import { u as W, a as z } from "../_chunks/use-direction-Dp8h70PP.js";
12
+ import { u as N } from "../_chunks/use-persistent-state-i23OWy6G.js";
13
13
  import { u as Z } from "../_chunks/use-isomorphic-layout-effect-BGfaCOP1.js";
14
+ import { u as ee } from "../_chunks/use-web-otp-D_utzp6S.js";
14
15
  function S(e, o) {
15
- const [t, c] = x(e), n = b(null);
16
+ const [t, c] = x(e), u = b(null);
16
17
  return E(() => {
17
18
  if (o <= 0) {
18
- n.current !== null && (clearTimeout(n.current), n.current = null), c(e);
19
+ u.current !== null && (clearTimeout(u.current), u.current = null), c(e);
19
20
  return;
20
21
  }
21
22
  const s = setTimeout(() => {
22
- c(e), n.current = null;
23
+ c(e), u.current = null;
23
24
  }, o);
24
- return n.current = s, () => clearTimeout(s);
25
+ return u.current = s, () => clearTimeout(s);
25
26
  }, [e, o]), t;
26
27
  }
27
28
  const T = [
@@ -49,57 +50,58 @@ function p(e) {
49
50
  });
50
51
  }
51
52
  function C(e, o = {}) {
52
- const { enabled: t = !0, autoFocus: c = !0, restoreFocus: n = !0 } = o, s = b(null);
53
+ const { enabled: t = !0, autoFocus: c = !0, restoreFocus: u = !0 } = o, s = b(null);
53
54
  E(() => {
54
55
  if (!t) return;
55
56
  const a = e.current;
56
57
  if (!a) return;
57
58
  if (s.current = typeof document < "u" && document.activeElement instanceof HTMLElement ? document.activeElement : null, c) {
58
- const u = p(a)[0] ?? (a.tabIndex >= -1 ? a : null);
59
- u == null || u.focus();
59
+ const n = p(a)[0] ?? (a.tabIndex >= -1 ? a : null);
60
+ n == null || n.focus();
60
61
  }
61
62
  function f(r) {
62
63
  if (r.key !== "Tab") return;
63
- const u = e.current;
64
- if (!u) return;
65
- const i = p(u);
64
+ const n = e.current;
65
+ if (!n) return;
66
+ const i = p(n);
66
67
  if (i.length === 0) {
67
68
  r.preventDefault();
68
69
  return;
69
70
  }
70
71
  const d = i[0], m = i[i.length - 1], l = document.activeElement;
71
- r.shiftKey ? (l === d || !u.contains(l)) && (r.preventDefault(), m.focus()) : (l === m || !u.contains(l)) && (r.preventDefault(), d.focus());
72
+ r.shiftKey ? (l === d || !n.contains(l)) && (r.preventDefault(), m.focus()) : (l === m || !n.contains(l)) && (r.preventDefault(), d.focus());
72
73
  }
73
74
  return a.addEventListener("keydown", f), () => {
74
- if (a.removeEventListener("keydown", f), n && s.current) {
75
+ if (a.removeEventListener("keydown", f), u && s.current) {
75
76
  const r = s.current;
76
77
  requestAnimationFrame(() => {
77
78
  r.isConnected && r.focus();
78
79
  });
79
80
  }
80
81
  };
81
- }, [t, c, n, e]);
82
+ }, [t, c, u, e]);
82
83
  }
83
84
  export {
84
- O as ACCESSIBILITY_STORAGE_KEY,
85
+ K as ACCESSIBILITY_STORAGE_KEY,
85
86
  R as THEME_CLASS,
86
87
  H as THEME_STORAGE_KEY,
87
88
  M as resolveTheme,
88
89
  Y as themeClassList,
89
90
  G as useControllableState,
90
91
  U as useCopyToClipboard,
91
- g as useCountUp,
92
+ O as useCountUp,
92
93
  j as useDebouncedCallback,
93
94
  S as useDebouncedValue,
94
- z as useDirection,
95
- J as useDocumentDirection,
95
+ W as useDirection,
96
+ z as useDocumentDirection,
96
97
  C as useFocusTrap,
97
98
  Z as useIsomorphicLayoutEffect,
98
- w as useLocale,
99
+ k as useLocale,
99
100
  D as useMediaQuery,
100
- W as usePersistentState,
101
+ N as usePersistentState,
101
102
  v as usePrefersReducedMotion,
102
103
  _ as useScrollToFirstError,
103
- q as useTheme
104
+ q as useTheme,
105
+ ee as useWebOtp
104
106
  };
105
107
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,22 @@
1
+ export interface UseWebOtpOptions {
2
+ /**
3
+ * Invoked once with the full code when the browser surfaces a matching
4
+ * SMS. Setting state from inside `onCode` is safe — the hook will not
5
+ * fire again for the same lifecycle (it auto-aborts after success).
6
+ */
7
+ onCode: (code: string) => void;
8
+ /**
9
+ * Optional error sink. `AbortError` (the normal cleanup path) is NEVER
10
+ * forwarded — only real failures (permission denied, malformed SMS, etc.).
11
+ * When omitted the hook silently swallows everything so a consumer that
12
+ * doesn't care about telemetry can call the hook bare.
13
+ */
14
+ onError?: (error: Error) => void;
15
+ /**
16
+ * Gate the listener. When `false` the hook is a no-op; flipping back to
17
+ * `true` reinstalls the listener. Default `true`.
18
+ */
19
+ enabled?: boolean;
20
+ }
21
+ export declare function useWebOtp({ onCode, onError, enabled, }: UseWebOtpOptions): void;
22
+ //# sourceMappingURL=use-web-otp.d.ts.map
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ import { F as ba } from "./_chunks/form-field-BOm9hK35.js";
27
27
  import { F as Ra, u as Ia } from "./_chunks/form-field-context-B3APVHKx.js";
28
28
  import { M as Fa, m as Ea, a as La } from "./_chunks/multi-select-DOLO3K_z.js";
29
29
  import { N as ka, u as Oa } from "./_chunks/number-input-Dj5L3pXK.js";
30
- import { O as ya } from "./_chunks/otp-input-BEg_sn8A.js";
30
+ import { O as ya } from "./_chunks/otp-input-CDTWT5EK.js";
31
31
  import { P as Ma, u as Da } from "./_chunks/use-password-requirements-DsgduV1x.js";
32
32
  import { P as Va, c as va, p as Ha, a as Wa } from "./_chunks/phone-input-DfZbPPvh.js";
33
33
  import { R as Ua, r as Ka } from "./_chunks/recaptcha-widget-CFYyLSEX.js";
@@ -131,7 +131,7 @@ import { C as Mn, c as Dn, r as wn } from "./_chunks/calendar-YHFknAGv.js";
131
131
  import { O as vn, o as Hn } from "./_chunks/operator-hero-7LiiP7zi.js";
132
132
  import { P as Gn, p as Un } from "./_chunks/patient-search-CBq62kmL.js";
133
133
  import { C as Yn, a as jn, b as zn, c as qn } from "./_chunks/contact-profile-card-Ce-LIDU8.js";
134
- import { P as Jn, p as Xn } from "./_chunks/practice-results-Bw5fJTYF.js";
134
+ import { P as Jn, p as Xn } from "./_chunks/practice-results-Dwm5tzLV.js";
135
135
  import { P as $n, f as ap, p as ep, a as rp, s as op, b as tp, c as sp } from "./_chunks/payment-form-D5rgnZu7.js";
136
136
  import { P as np, p as pp } from "./_chunks/pdf-viewer-DvtEHcEP.js";
137
137
  import { R as lp, r as fp } from "./_chunks/reviews-panel-Dow8Dzoa.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfadocs/ui-kit",
3
- "version": "0.33.0",
3
+ "version": "0.33.2",
4
4
  "type": "module",
5
5
  "description": "AlfaDocs shared design system — tokens, components, patterns, and translations for platform, booking, and alfascribe.",
6
6
  "license": "BUSL-1.1",