@alfadocs/ui-kit 1.133.0 → 1.134.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/_chunks/{agenda-card-B8hV3dZV.js → agenda-card-B9wgX_Ed.js} +2 -2
- package/dist/_chunks/{agenda-tray-Bu46s3dI.js → agenda-tray-CGcS_qoM.js} +2 -2
- package/dist/_chunks/appointment-card-DG3m9yN-.js +504 -0
- package/dist/_chunks/{appointment-peek-DZa6xyUb.js → appointment-peek-BK0tDs4C.js} +2 -2
- package/dist/_chunks/{appointment-timeline-DQePqpyH.js → appointment-timeline-BiI2riRZ.js} +2 -2
- package/dist/_chunks/appointment-tray-ClJCtYQj.js +200 -0
- package/dist/_chunks/{appointment-workflow-status-DMjuIK90.js → appointment-workflow-status-S-lx81Yz.js} +2 -2
- package/dist/_chunks/ban-CiSCCcOE.js +15 -0
- package/dist/_chunks/{calendar-BIoOeBTT.js → calendar-CyLtLBNP.js} +2 -2
- package/dist/_chunks/{calendar-appointment-editor-dialog-BHx6kUhX.js → calendar-appointment-editor-dialog-BSkIYGlW.js} +13 -13
- package/dist/_chunks/{calendar-event-card-BNEzkjm-.js → calendar-event-card-BJifpYZQ.js} +7 -6
- package/dist/_chunks/{care-plan-card-DKScH9Ss.js → care-plan-card-CjHq6PLo.js} +6 -6
- package/dist/_chunks/{care-plan-entry-card-AG1y3nyW.js → care-plan-entry-card-DY1toF6E.js} +2 -2
- package/dist/_chunks/{care-plan-header-Dx5OMkc9.js → care-plan-header-CeFXUDnL.js} +6 -6
- package/dist/_chunks/check-in-documents-CEVcgcYZ.js +136 -0
- package/dist/_chunks/{clinical-note-card-pPaeWWnu.js → clinical-note-card-D--IwbZa.js} +2 -2
- package/dist/_chunks/document-preview-DLVIrOYV.js +385 -0
- package/dist/_chunks/{entity-card-fpm-KUKc.js → entity-card-p-LANpYt.js} +18 -17
- package/dist/_chunks/{error-page-B0fGNTRB.js → error-page-WLhmWUTq.js} +100 -115
- package/dist/_chunks/finished-terminal-unDnXT4j.js +191 -0
- package/dist/_chunks/house-DGCypGTo.js +21 -0
- package/dist/_chunks/is-safe-url-CEy9CEml.js +8 -0
- package/dist/_chunks/keypad-DBH_keVs.js +152 -0
- package/dist/_chunks/keypad-button-mOaPQRrH.js +114 -0
- package/dist/_chunks/{message-card-BG3_3nN1.js → message-card-Bw_q1qKx.js} +2 -2
- package/dist/_chunks/{message-tray-BjZv0Fsk.js → message-tray-pLGgLmoG.js} +2 -2
- package/dist/_chunks/{note-attachment-MNTIqdSz.js → note-attachment-JTIy9iXN.js} +2 -2
- package/dist/_chunks/{note-timeline-BQeW0VZY.js → note-timeline-BbjHMhkL.js} +2 -2
- package/dist/_chunks/{notes-panel-Cm-_pCRJ.js → notes-panel-BAyPOr8N.js} +2 -2
- package/dist/_chunks/{operator-hero-CnfWckNQ.js → operator-hero-D4wfVu2l.js} +2 -2
- package/dist/_chunks/otp-input-BNOTlxq3.js +342 -0
- package/dist/_chunks/patient-account-settings-BkAtIxJW.js +546 -0
- package/dist/_chunks/patient-card-DTh3QTyS.js +125 -0
- package/dist/_chunks/patient-check-in-resume-xhqjC6gf.js +742 -0
- package/dist/_chunks/patient-sign-in-pin-CDBqV254.js +432 -0
- package/dist/_chunks/patient-sign-in-steps-C2JSqlok.js +199 -0
- package/dist/_chunks/{patient-summary-card-BUcZ-gaL.js → patient-summary-card-Bl2NknPe.js} +2 -2
- package/dist/_chunks/{payment-request-card-Dv4WbRBe.js → payment-request-card-CNW00DCx.js} +6 -6
- package/dist/_chunks/{pdf-viewer-BnBKdx0y.js → pdf-viewer-TRC5jEm5.js} +472 -425
- package/dist/_chunks/pin-entry-BugWQMOS.js +219 -0
- package/dist/_chunks/pin-indicator-Cb-n40UI.js +124 -0
- package/dist/_chunks/portal-details-CTEsm705.js +478 -0
- package/dist/_chunks/portal-documents-D8skew0h.js +902 -0
- package/dist/_chunks/portal-parts-BdR29P7z.js +285 -0
- package/dist/_chunks/{privacy-mask-DJ1gee4c.js → privacy-mask-C19dJFMk.js} +5 -5
- package/dist/_chunks/{product-hub-panel-a8wdVOUt.js → product-hub-panel-K4QbULG7.js} +2 -2
- package/dist/_chunks/{registration-form-CwbhtKcy.js → registration-form-DS3RuKHu.js} +2 -2
- package/dist/_chunks/{reserved.agent-W8mR179D.js → reserved.agent-DOzOBUW7.js} +2 -2
- package/dist/_chunks/session-countdown-DOx1IBUB.js +232 -0
- package/dist/_chunks/{sign-document-CQZVzfpk.js → sign-document-DDZbmYHu.js} +2 -2
- package/dist/_chunks/{signature-field-DjabvRZm.js → signature-field-BjlY_yXH.js} +39 -34
- package/dist/_chunks/{signature-request-4pGq3YBe.js → signature-request-CHsM_iWi.js} +2 -2
- package/dist/_chunks/{signature-status-chip-pIoQjvH8.js → signature-status-chip-DS9hHwIt.js} +66 -69
- package/dist/_chunks/signing-end-screen-an9P8DOT.js +1041 -0
- package/dist/_chunks/sms-code-entry-Dgp4GwlM.js +316 -0
- package/dist/_chunks/step-up-dialog-C2JqJmCA.js +132 -0
- package/dist/_chunks/{task-editor-BL2hHxNz.js → task-editor-g1AGfxhr.js} +38 -38
- package/dist/_chunks/{use-appointment-details-read-_b7FRB1x.js → use-appointment-details-read-Dzc6fEzG.js} +6 -6
- package/dist/_chunks/use-zoom-drilldown-Cr1baU5X.js +221 -0
- package/dist/_chunks/{user-x-DYszNtIg.js → user-x-BJZg4kaP.js} +8 -19
- package/dist/_chunks/{verify-identity-types-CxtrBXsZ.js → verify-identity-types-C6Bam8v6.js} +2 -2
- package/dist/agent-catalog.json +723 -364
- package/dist/agent-i18n/en.json +75 -18
- package/dist/browser-support.js +1 -1
- package/dist/components/_shared/is-safe-url.d.ts +3 -1
- package/dist/components/agenda-card/index.js +2 -2
- package/dist/components/agenda-tray/index.js +1 -1
- package/dist/components/appointment-card/appointment-card.d.ts +45 -0
- package/dist/components/appointment-card/appointment-tray.d.ts +11 -0
- package/dist/components/appointment-card/index.js +3 -3
- package/dist/components/appointment-details-panel/index.js +1 -1
- package/dist/components/appointment-peek/index.js +1 -1
- package/dist/components/appointment-timeline/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/calendar/index.js +1 -1
- package/dist/components/calendar-event-card/index.js +1 -1
- package/dist/components/care-plan-card/index.js +1 -1
- package/dist/components/care-plan-entry-card/index.js +1 -1
- package/dist/components/care-plan-header/index.js +1 -1
- package/dist/components/clinical-note-card/index.js +1 -1
- package/dist/components/document-preview/document-preview.d.ts +61 -7
- package/dist/components/document-preview/index.js +1 -1
- package/dist/components/finished-terminal/finished-terminal.d.ts +63 -6
- package/dist/components/finished-terminal/index.d.ts +1 -1
- package/dist/components/finished-terminal/index.js +1 -1
- package/dist/components/index.d.ts +12 -0
- package/dist/components/keypad/index.d.ts +3 -0
- package/dist/components/keypad/index.js +6 -0
- package/dist/components/keypad/keypad.d.ts +54 -0
- package/dist/components/keypad-button/index.d.ts +3 -0
- package/dist/components/keypad-button/index.js +6 -0
- package/dist/components/keypad-button/keypad-button.d.ts +33 -0
- package/dist/components/message-card/index.js +2 -2
- package/dist/components/message-tray/index.js +1 -1
- package/dist/components/note-timeline/index.js +1 -1
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/operator-hero/index.js +1 -1
- package/dist/components/otp-input/index.js +1 -1
- package/dist/components/otp-input/otp-input.d.ts +11 -0
- package/dist/components/patient-summary-card/index.js +1 -1
- package/dist/components/payment-card/index.js +1 -1
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/pdf-viewer/pdf-viewer.d.ts +7 -0
- package/dist/components/pin-entry/index.d.ts +3 -0
- package/dist/components/pin-entry/index.js +5 -0
- package/dist/components/pin-entry/pin-entry.agent.d.ts +4 -0
- package/dist/components/pin-entry/pin-entry.d.ts +64 -0
- package/dist/components/pin-indicator/index.d.ts +3 -0
- package/dist/components/pin-indicator/index.js +9 -0
- package/dist/components/pin-indicator/pin-indicator.d.ts +34 -0
- package/dist/components/product-hub-tray/index.js +2 -2
- package/dist/components/session-countdown/index.js +1 -1
- package/dist/components/session-countdown/session-countdown.d.ts +19 -0
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/signature-field/index.js +1 -1
- package/dist/components/signature-field/signature-field.d.ts +17 -6
- package/dist/components/signature-status-chip/index.js +1 -1
- package/dist/components/signature-status-chip/signature-status-chip.d.ts +3 -2
- package/dist/components/sms-code-entry/index.d.ts +3 -0
- package/dist/components/sms-code-entry/index.js +5 -0
- package/dist/components/sms-code-entry/sms-code-entry.agent.d.ts +4 -0
- package/dist/components/sms-code-entry/sms-code-entry.d.ts +156 -0
- package/dist/components/step-up-dialog/index.d.ts +3 -0
- package/dist/components/step-up-dialog/index.js +5 -0
- package/dist/components/step-up-dialog/step-up-dialog.d.ts +108 -0
- package/dist/components/task-editor/index.js +1 -1
- package/dist/components/workflow-status/index.js +1 -1
- package/dist/core.css +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/use-signing-session.d.ts +7 -2
- package/dist/host-compat.css +10 -1
- package/dist/i18n/locales/ar.d.ts +512 -1
- package/dist/i18n/locales/ar.js +509 -3
- package/dist/i18n/locales/de.d.ts +512 -1
- package/dist/i18n/locales/de.js +517 -4
- package/dist/i18n/locales/el.d.ts +512 -1
- package/dist/i18n/locales/el.js +512 -4
- package/dist/i18n/locales/en.d.ts +514 -1
- package/dist/i18n/locales/en.js +520 -4
- package/dist/i18n/locales/es.d.ts +512 -1
- package/dist/i18n/locales/es.js +510 -4
- package/dist/i18n/locales/fr.d.ts +512 -1
- package/dist/i18n/locales/fr.js +510 -4
- package/dist/i18n/locales/hi.d.ts +512 -1
- package/dist/i18n/locales/hi.js +510 -4
- package/dist/i18n/locales/it.d.ts +512 -1
- package/dist/i18n/locales/it.js +517 -4
- package/dist/i18n/locales/ja.d.ts +512 -1
- package/dist/i18n/locales/ja.js +510 -4
- package/dist/i18n/locales/nl.d.ts +512 -1
- package/dist/i18n/locales/nl.js +517 -4
- package/dist/i18n/locales/pl.d.ts +512 -1
- package/dist/i18n/locales/pl.js +517 -4
- package/dist/i18n/locales/pt.d.ts +512 -1
- package/dist/i18n/locales/pt.js +517 -4
- package/dist/i18n/locales/ro.d.ts +512 -1
- package/dist/i18n/locales/ro.js +517 -4
- package/dist/i18n/locales/ru.d.ts +512 -1
- package/dist/i18n/locales/ru.js +509 -3
- package/dist/i18n/locales/sq.d.ts +512 -1
- package/dist/i18n/locales/sq.js +510 -4
- package/dist/i18n/locales/sv.d.ts +512 -1
- package/dist/i18n/locales/sv.js +510 -4
- package/dist/i18n/locales/tr.d.ts +512 -1
- package/dist/i18n/locales/tr.js +512 -4
- package/dist/i18n/locales/zh.d.ts +512 -1
- package/dist/i18n/locales/zh.js +510 -4
- package/dist/index.js +1271 -1204
- package/dist/locales/ar.json +513 -2
- package/dist/locales/de.json +514 -3
- package/dist/locales/el.json +514 -3
- package/dist/locales/en.json +514 -3
- package/dist/locales/es.json +514 -3
- package/dist/locales/fr.json +514 -3
- package/dist/locales/hi.json +514 -3
- package/dist/locales/it.json +514 -3
- package/dist/locales/ja.json +514 -3
- package/dist/locales/nl.json +514 -3
- package/dist/locales/pl.json +514 -3
- package/dist/locales/pt.json +514 -3
- package/dist/locales/ro.json +514 -3
- package/dist/locales/ru.json +513 -2
- package/dist/locales/sq.json +514 -3
- package/dist/locales/sv.json +514 -3
- package/dist/locales/tr.json +514 -3
- package/dist/locales/zh.json +514 -3
- package/dist/patterns/calendar/index.js +1 -1
- package/dist/patterns/check-in-documents/check-in-documents.d.ts +61 -0
- package/dist/patterns/check-in-documents/check-in-signable-document.d.ts +32 -0
- package/dist/patterns/check-in-documents/index.d.ts +4 -0
- package/dist/patterns/check-in-documents/index.js +5 -0
- package/dist/patterns/error-page/index.js +1 -1
- package/dist/patterns/patient-account-settings/index.d.ts +4 -0
- package/dist/patterns/patient-account-settings/index.js +5 -0
- package/dist/patterns/patient-account-settings/patient-account-settings-panels.d.ts +36 -0
- package/dist/patterns/patient-account-settings/patient-account-settings.d.ts +94 -0
- package/dist/patterns/patient-account-settings/patient-account-settings.types.d.ts +91 -0
- package/dist/patterns/patient-check-in/index.d.ts +20 -0
- package/dist/patterns/patient-check-in/index.js +13 -0
- package/dist/patterns/patient-check-in/patient-check-in-changed.d.ts +33 -0
- package/dist/patterns/patient-check-in/patient-check-in-connection-notice.d.ts +29 -0
- package/dist/patterns/patient-check-in/patient-check-in-done.d.ts +25 -0
- package/dist/patterns/patient-check-in/patient-check-in-entry.d.ts +29 -0
- package/dist/patterns/patient-check-in/patient-check-in-hub-empty.d.ts +23 -0
- package/dist/patterns/patient-check-in/patient-check-in-hub.d.ts +61 -0
- package/dist/patterns/patient-check-in/patient-check-in-personal-data.d.ts +73 -0
- package/dist/patterns/patient-check-in/patient-check-in-privacy.d.ts +9 -0
- package/dist/patterns/patient-check-in/patient-check-in-resume.d.ts +29 -0
- package/dist/patterns/patient-check-in/patient-check-in-shell.d.ts +60 -0
- package/dist/patterns/patient-check-in/patient-check-in-types.d.ts +92 -0
- package/dist/patterns/patient-portal/index.d.ts +12 -0
- package/dist/patterns/patient-portal/index.js +13 -0
- package/dist/patterns/patient-portal/portal-appointments.d.ts +70 -0
- package/dist/patterns/patient-portal/portal-details.d.ts +148 -0
- package/dist/patterns/patient-portal/portal-documents.d.ts +74 -0
- package/dist/patterns/patient-portal/portal-format.d.ts +14 -0
- package/dist/patterns/patient-portal/portal-home.d.ts +71 -0
- package/dist/patterns/patient-portal/portal-parts.d.ts +107 -0
- package/dist/patterns/patient-portal/portal-shell.d.ts +84 -0
- package/dist/patterns/patient-portal/portal-types.d.ts +157 -0
- package/dist/patterns/patient-sign-in/index.d.ts +7 -0
- package/dist/patterns/patient-sign-in/index.js +15 -0
- package/dist/patterns/patient-sign-in/patient-card.d.ts +74 -0
- package/dist/patterns/patient-sign-in/patient-sign-in-email.d.ts +109 -0
- package/dist/patterns/patient-sign-in/patient-sign-in-pin.d.ts +157 -0
- package/dist/patterns/patient-sign-in/patient-sign-in-steps.d.ts +143 -0
- package/dist/patterns/registration-form/index.js +1 -1
- package/dist/patterns/signature-request/index.js +1 -1
- package/dist/patterns/signing/index.d.ts +25 -0
- package/dist/patterns/signing/index.js +16 -0
- package/dist/patterns/signing/multi-field-signer.d.ts +117 -0
- package/dist/patterns/signing/signing-awaiting-screen.d.ts +25 -0
- package/dist/patterns/signing/signing-chrome.d.ts +30 -0
- package/dist/patterns/signing/signing-document-screen.d.ts +87 -0
- package/dist/patterns/signing/signing-end-screen.d.ts +27 -0
- package/dist/patterns/signing/signing-finished-screen.d.ts +34 -0
- package/dist/patterns/signing/signing-footer.d.ts +56 -0
- package/dist/patterns/signing/signing-handoff-screen.d.ts +37 -0
- package/dist/patterns/signing/signing-message-dialog.d.ts +29 -0
- package/dist/patterns/signing/signing-progress-chip.d.ts +27 -0
- package/dist/patterns/signing/signing-roster.d.ts +44 -0
- package/dist/patterns/signing/signing-staff-id-confirmation.d.ts +49 -0
- package/dist/patterns/verify-identity/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +49 -1
- package/dist/_chunks/appointment-card-OAOur8lH.js +0 -434
- package/dist/_chunks/appointment-tray-DSFqO5Rm.js +0 -193
- package/dist/_chunks/document-preview-_kQ9QvZV.js +0 -291
- package/dist/_chunks/finished-terminal-FR8uc_Ws.js +0 -122
- package/dist/_chunks/is-safe-url-DkETxeHz.js +0 -7
- package/dist/_chunks/otp-input-gV1446Dw.js +0 -301
- package/dist/_chunks/session-countdown-C4tzbJVc.js +0 -223
- package/dist/_chunks/use-zoom-drilldown-qCX34w9I.js +0 -210
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { jsx as y, jsxs as le } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ue, useId as de, useRef as x, useState as pe, useEffect as fe, useCallback as j, useMemo as ge, useImperativeHandle as me } from "react";
|
|
3
|
+
import { c as k } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as ve } from "react-i18next";
|
|
5
|
+
import { u as he } from "./use-controllable-state-BiY4xTzM.js";
|
|
6
|
+
import { u as be } from "./use-web-otp-D_utzp6S.js";
|
|
7
|
+
import { u as ye, a as we } from "./form-field-context-DtiROUJV.js";
|
|
8
|
+
import { u as Ie } from "./registry-DvAUVLHh.js";
|
|
9
|
+
import { i as G } from "./is-development-CLUAnsU7.js";
|
|
10
|
+
const Ve = {
|
|
11
|
+
id: "otp-input",
|
|
12
|
+
// Value input — `set_value` replaces the digits. There is no `submit`
|
|
13
|
+
// action: completion is host-driven (the consumer's `onComplete` fires
|
|
14
|
+
// automatically once every digit is filled) and is observable via the
|
|
15
|
+
// `isComplete` state slot, so the old unbacked `submit` capability is
|
|
16
|
+
// removed.
|
|
17
|
+
capabilities: ["set_value"],
|
|
18
|
+
state: {
|
|
19
|
+
value: {
|
|
20
|
+
type: "string",
|
|
21
|
+
descriptionKey: "ui.agent.otpInput.state.value",
|
|
22
|
+
description: "Current digits entered, packed into a single string.",
|
|
23
|
+
read: (r) => r.getValue()
|
|
24
|
+
},
|
|
25
|
+
isComplete: {
|
|
26
|
+
type: "boolean",
|
|
27
|
+
descriptionKey: "ui.agent.otpInput.state.isComplete",
|
|
28
|
+
description: "Whether all required digits have been entered.",
|
|
29
|
+
read: (r) => r.isComplete()
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
actions: {
|
|
33
|
+
set_value: {
|
|
34
|
+
safety: "write",
|
|
35
|
+
argsType: "{ value: string }",
|
|
36
|
+
argsSchema: {
|
|
37
|
+
type: "object",
|
|
38
|
+
properties: {
|
|
39
|
+
value: {
|
|
40
|
+
type: "string",
|
|
41
|
+
description: "The digits to fill, packed into a single string (one char per cell)."
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
required: ["value"]
|
|
45
|
+
},
|
|
46
|
+
idempotent: !0,
|
|
47
|
+
examples: [{ args: { value: "123456" } }],
|
|
48
|
+
descriptionKey: "ui.agent.otpInput.actions.setValue",
|
|
49
|
+
description: "Replace the entered digits.",
|
|
50
|
+
invoke: (r, s) => {
|
|
51
|
+
r.setValue(s.value);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
clear: {
|
|
55
|
+
safety: "destructive",
|
|
56
|
+
idempotent: !0,
|
|
57
|
+
descriptionKey: "ui.agent.otpInput.actions.clear",
|
|
58
|
+
description: "Empty all digit cells. Loses any typed value.",
|
|
59
|
+
invoke: (r) => {
|
|
60
|
+
r.clear();
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
focus: {
|
|
64
|
+
safety: "read",
|
|
65
|
+
idempotent: !0,
|
|
66
|
+
descriptionKey: "ui.agent.otpInput.actions.focus",
|
|
67
|
+
description: "Move keyboard focus to the active digit cell.",
|
|
68
|
+
invoke: (r) => {
|
|
69
|
+
r.focus();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
domHooks: {
|
|
74
|
+
root: {
|
|
75
|
+
attr: "data-component",
|
|
76
|
+
value: "otp-input",
|
|
77
|
+
description: "Marks the OTPInput wrapper. Completion is observable via state.isComplete; the host onComplete callback fires once when all digits are filled."
|
|
78
|
+
},
|
|
79
|
+
instanceId: {
|
|
80
|
+
attr: "data-component-id",
|
|
81
|
+
sourceProp: "id",
|
|
82
|
+
description: "Sourced from the id prop."
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, ke = k("ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]"), De = k("", {
|
|
86
|
+
variants: {
|
|
87
|
+
grouped: {
|
|
88
|
+
false: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]",
|
|
89
|
+
true: "ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-sm)]"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
defaultVariants: { grouped: !1 }
|
|
93
|
+
}), Te = k(
|
|
94
|
+
"ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]"
|
|
95
|
+
), Ae = k(
|
|
96
|
+
[
|
|
97
|
+
"ds:w-[var(--min-target-size)] ds:h-[var(--min-target-size)]",
|
|
98
|
+
"ds:rounded-[var(--radius-sm)]",
|
|
99
|
+
"ds:border ds:bg-input ds:text-foreground ds:text-center ds:font-medium ds:text-[length:var(--font-size-lg)]",
|
|
100
|
+
"ds:shadow-[var(--shadow-input)]",
|
|
101
|
+
"ds:transition-[colors,box-shadow] ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
|
|
102
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
|
|
103
|
+
"ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
104
|
+
"ds:disabled:cursor-not-allowed ds:disabled:opacity-50"
|
|
105
|
+
].join(" "),
|
|
106
|
+
{
|
|
107
|
+
variants: {
|
|
108
|
+
tone: {
|
|
109
|
+
default: "ds:border-[color:var(--control-border)]",
|
|
110
|
+
error: "ds:border-destructive"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
defaultVariants: { tone: "default" }
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
function z(r) {
|
|
117
|
+
return r.replace(/[\u0660-\u0669]/g, (s) => String(s.charCodeAt(0) - 1632)).replace(/[\u06F0-\u06F9]/g, (s) => String(s.charCodeAt(0) - 1776));
|
|
118
|
+
}
|
|
119
|
+
const Z = 3, _ = 10;
|
|
120
|
+
function Me(r) {
|
|
121
|
+
const s = Number.isFinite(r) ? Math.floor(r) : 6, o = Math.max(Z, Math.min(_, s));
|
|
122
|
+
return G() && o !== r && console.warn(
|
|
123
|
+
`[OTPInput] length ${r} is out of range [${Z}, ${_}] — clamped to ${o}.`
|
|
124
|
+
), o;
|
|
125
|
+
}
|
|
126
|
+
function Ce(r, s) {
|
|
127
|
+
if (r === void 0) return;
|
|
128
|
+
const o = Number.isFinite(r) ? Math.floor(r) : 0;
|
|
129
|
+
if (o < 1) {
|
|
130
|
+
G() && console.warn(
|
|
131
|
+
`[OTPInput] groupSize ${r} is not a number of 1 or more: the boxes stay in one row.`
|
|
132
|
+
);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
return o < s ? o : void 0;
|
|
136
|
+
}
|
|
137
|
+
function Fe(r, s) {
|
|
138
|
+
const o = [];
|
|
139
|
+
for (let c = 0; c < r.length; c += s)
|
|
140
|
+
o.push(r.slice(c, c + s));
|
|
141
|
+
return o;
|
|
142
|
+
}
|
|
143
|
+
function V(r, s, o) {
|
|
144
|
+
return (o === "alphanumeric" ? r.replace(/[^A-Za-z0-9]/g, "").toUpperCase() : z(r).replace(/\D/g, "")).slice(0, s);
|
|
145
|
+
}
|
|
146
|
+
function Ne(r, s, o) {
|
|
147
|
+
const c = V(r, s, o), f = new Array(s).fill("");
|
|
148
|
+
for (let m = 0; m < c.length; m += 1)
|
|
149
|
+
f[m] = c[m];
|
|
150
|
+
return f;
|
|
151
|
+
}
|
|
152
|
+
const Re = ue(
|
|
153
|
+
({
|
|
154
|
+
length: r = 6,
|
|
155
|
+
value: s,
|
|
156
|
+
defaultValue: o,
|
|
157
|
+
onChange: c,
|
|
158
|
+
onComplete: f,
|
|
159
|
+
disabled: m,
|
|
160
|
+
error: U,
|
|
161
|
+
label: D,
|
|
162
|
+
"aria-describedby": q,
|
|
163
|
+
id: O,
|
|
164
|
+
className: W,
|
|
165
|
+
webOtp: X = !1,
|
|
166
|
+
name: P,
|
|
167
|
+
mode: l = "numeric",
|
|
168
|
+
groupSize: J
|
|
169
|
+
}, Q) => {
|
|
170
|
+
const { t: Y } = ve("ui"), a = Me(r), T = Ce(J, a), h = ye(), ee = de(), E = D ? ee : void 0, [te, K] = he({
|
|
171
|
+
value: s,
|
|
172
|
+
defaultValue: V(o ?? "", a, l)
|
|
173
|
+
}), v = V(te ?? "", a, l), re = Ne(v, a, l), w = h.disabled || !!m, S = h.invalid || !!U, ae = S ? "error" : "default", B = x([]), A = x(v.length === a), g = x(v);
|
|
174
|
+
g.current = v;
|
|
175
|
+
const se = () => {
|
|
176
|
+
const e = v.length;
|
|
177
|
+
return e >= a ? a - 1 : e;
|
|
178
|
+
}, [b, M] = pe(se);
|
|
179
|
+
fe(() => {
|
|
180
|
+
b >= a && M(a - 1);
|
|
181
|
+
}, [b, a]);
|
|
182
|
+
const d = j(
|
|
183
|
+
(e, t) => {
|
|
184
|
+
const i = Math.max(0, Math.min(a - 1, e));
|
|
185
|
+
M(i);
|
|
186
|
+
const n = B.current[i];
|
|
187
|
+
n && (n.focus(t), n.select());
|
|
188
|
+
},
|
|
189
|
+
[a]
|
|
190
|
+
), p = j(
|
|
191
|
+
(e) => {
|
|
192
|
+
const t = V(e, a, l);
|
|
193
|
+
K(t), g.current = t, c == null || c(t), t.length === a ? A.current || (A.current = !0, f == null || f(t)) : A.current = !1;
|
|
194
|
+
},
|
|
195
|
+
[K, a, l, c, f]
|
|
196
|
+
);
|
|
197
|
+
be({
|
|
198
|
+
enabled: X && !w,
|
|
199
|
+
onCode: p
|
|
200
|
+
});
|
|
201
|
+
const ne = (e) => (t) => {
|
|
202
|
+
const i = t.target.value, n = l === "alphanumeric" ? i.replace(/[^A-Za-z0-9]/g, "").toUpperCase() : z(i).replace(/\D/g, ""), u = g.current;
|
|
203
|
+
if (n.length === 0) {
|
|
204
|
+
if (i === "" && e < u.length) {
|
|
205
|
+
const L = u.slice(0, e) + u.slice(e + 1);
|
|
206
|
+
p(L);
|
|
207
|
+
}
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const I = u.slice(0, e), N = u.slice(e + n.length), R = (I + n + N).slice(0, a);
|
|
211
|
+
p(R);
|
|
212
|
+
const $ = Math.min(e + n.length, a - 1);
|
|
213
|
+
d($);
|
|
214
|
+
}, oe = (e) => (t) => {
|
|
215
|
+
const i = g.current;
|
|
216
|
+
if (t.key === "Backspace") {
|
|
217
|
+
if (i[e]) {
|
|
218
|
+
t.preventDefault();
|
|
219
|
+
const n = i.slice(0, e) + i.slice(e + 1);
|
|
220
|
+
p(n);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (e > 0) {
|
|
224
|
+
t.preventDefault();
|
|
225
|
+
const n = i.slice(0, e - 1) + i.slice(e);
|
|
226
|
+
p(n), d(e - 1);
|
|
227
|
+
}
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if (t.key === "ArrowLeft") {
|
|
231
|
+
t.preventDefault(), e > 0 && d(e - 1);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (t.key === "ArrowRight") {
|
|
235
|
+
t.preventDefault(), e < a - 1 && d(e + 1);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (t.key === "Home") {
|
|
239
|
+
t.preventDefault(), d(0);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
t.key === "End" && (t.preventDefault(), d(a - 1));
|
|
243
|
+
}, ie = (e) => (t) => {
|
|
244
|
+
const n = t.clipboardData.getData("text").replace(/\s+/g, ""), u = l === "alphanumeric" ? n.replace(/[^A-Za-z0-9]/g, "").toUpperCase() : z(n);
|
|
245
|
+
if (l === "alphanumeric" ? u.length === 0 : !/^[0-9]+$/.test(u))
|
|
246
|
+
return;
|
|
247
|
+
t.preventDefault();
|
|
248
|
+
const I = g.current, N = I.slice(0, e), R = I.slice(e + u.length), $ = (N + u + R).slice(0, a);
|
|
249
|
+
p($);
|
|
250
|
+
const L = Math.min(e + u.length, a - 1);
|
|
251
|
+
d(L);
|
|
252
|
+
}, ce = (e) => (t) => {
|
|
253
|
+
M(e), t.currentTarget.select();
|
|
254
|
+
}, C = h.id;
|
|
255
|
+
we(h, `${C}-0`);
|
|
256
|
+
const F = ge(
|
|
257
|
+
() => ({
|
|
258
|
+
getValue: () => g.current,
|
|
259
|
+
setValue: (e) => p(e),
|
|
260
|
+
clear: () => p(""),
|
|
261
|
+
focus: (e) => d(b, e),
|
|
262
|
+
isComplete: () => g.current.length === a
|
|
263
|
+
}),
|
|
264
|
+
[p, d, b, a]
|
|
265
|
+
);
|
|
266
|
+
Ie(Ve, F, O), me(Q, () => F, [F]);
|
|
267
|
+
const H = re.map((e, t) => {
|
|
268
|
+
const i = !w && t === b;
|
|
269
|
+
return /* @__PURE__ */ y(
|
|
270
|
+
"input",
|
|
271
|
+
{
|
|
272
|
+
ref: (n) => {
|
|
273
|
+
B.current[t] = n;
|
|
274
|
+
},
|
|
275
|
+
id: `${C}-${t}`,
|
|
276
|
+
type: "text",
|
|
277
|
+
inputMode: l === "alphanumeric" ? "text" : "numeric",
|
|
278
|
+
pattern: l === "alphanumeric" ? "[A-Za-z0-9]*" : "[0-9]*",
|
|
279
|
+
autoCapitalize: l === "alphanumeric" ? "characters" : void 0,
|
|
280
|
+
autoComplete: t === 0 ? "one-time-code" : "off",
|
|
281
|
+
maxLength: 1,
|
|
282
|
+
value: e,
|
|
283
|
+
disabled: w,
|
|
284
|
+
tabIndex: i ? 0 : -1,
|
|
285
|
+
"aria-label": Y(
|
|
286
|
+
l === "alphanumeric" ? "inputs.otp.charLabel" : "inputs.otp.digitLabel",
|
|
287
|
+
{
|
|
288
|
+
current: t + 1,
|
|
289
|
+
total: a
|
|
290
|
+
}
|
|
291
|
+
),
|
|
292
|
+
onChange: ne(t),
|
|
293
|
+
onKeyDown: oe(t),
|
|
294
|
+
onPaste: ie(t),
|
|
295
|
+
onFocus: ce(t),
|
|
296
|
+
className: Ae({ tone: ae })
|
|
297
|
+
},
|
|
298
|
+
t
|
|
299
|
+
);
|
|
300
|
+
});
|
|
301
|
+
return /* @__PURE__ */ le("div", { className: ke({ className: W }), children: [
|
|
302
|
+
D ? /* @__PURE__ */ y(
|
|
303
|
+
"label",
|
|
304
|
+
{
|
|
305
|
+
id: E,
|
|
306
|
+
htmlFor: `${C}-0`,
|
|
307
|
+
className: "type-label ds:text-foreground",
|
|
308
|
+
children: D
|
|
309
|
+
}
|
|
310
|
+
) : null,
|
|
311
|
+
/* @__PURE__ */ y(
|
|
312
|
+
"div",
|
|
313
|
+
{
|
|
314
|
+
role: "group",
|
|
315
|
+
dir: "ltr",
|
|
316
|
+
"aria-labelledby": E,
|
|
317
|
+
"aria-invalid": S || void 0,
|
|
318
|
+
"aria-describedby": [q, h.describedBy].filter(Boolean).join(" ") || void 0,
|
|
319
|
+
"aria-disabled": w || void 0,
|
|
320
|
+
"data-component": "otp-input",
|
|
321
|
+
"data-component-id": O,
|
|
322
|
+
className: De({ grouped: T !== void 0 }),
|
|
323
|
+
children: T === void 0 ? H : Fe(H, T).map((e, t) => /* @__PURE__ */ y(
|
|
324
|
+
"div",
|
|
325
|
+
{
|
|
326
|
+
"data-slot": "otp-group",
|
|
327
|
+
className: Te(),
|
|
328
|
+
children: e
|
|
329
|
+
},
|
|
330
|
+
t
|
|
331
|
+
))
|
|
332
|
+
}
|
|
333
|
+
),
|
|
334
|
+
P ? /* @__PURE__ */ y("input", { type: "hidden", name: P, value: v, readOnly: !0 }) : null
|
|
335
|
+
] });
|
|
336
|
+
}
|
|
337
|
+
);
|
|
338
|
+
Re.displayName = "OTPInput";
|
|
339
|
+
export {
|
|
340
|
+
Re as O
|
|
341
|
+
};
|
|
342
|
+
//# sourceMappingURL=otp-input-BNOTlxq3.js.map
|