@alfadocs/ui-kit-debug 1.78.0 → 1.79.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.
Files changed (199) hide show
  1. package/dist/_chunks/{address-fields-BUPRs3n-.js → address-fields-GnoSkvh6.js} +2 -2
  2. package/dist/_chunks/{address-fields-BUPRs3n-.js.map → address-fields-GnoSkvh6.js.map} +1 -1
  3. package/dist/_chunks/{anamnesis-summary-rows-vNDyE5HW.js → anamnesis-summary-rows-lONg-zja.js} +2 -2
  4. package/dist/_chunks/{anamnesis-summary-rows-vNDyE5HW.js.map → anamnesis-summary-rows-lONg-zja.js.map} +1 -1
  5. package/dist/_chunks/{bishop-score-CdbU9Nl4.js → bishop-score-C5di6oAV.js} +2 -2
  6. package/dist/_chunks/{bishop-score-CdbU9Nl4.js.map → bishop-score-C5di6oAV.js.map} +1 -1
  7. package/dist/_chunks/{bmi-calculator-DnfiDh4Q.js → bmi-calculator-BIExHBZV.js} +2 -2
  8. package/dist/_chunks/{bmi-calculator-DnfiDh4Q.js.map → bmi-calculator-BIExHBZV.js.map} +1 -1
  9. package/dist/_chunks/{booking-Cz_QjIJe.js → booking-BV2s2J3C.js} +3 -3
  10. package/dist/_chunks/{booking-Cz_QjIJe.js.map → booking-BV2s2J3C.js.map} +1 -1
  11. package/dist/_chunks/{calendar-appointment-editor-dialog-cvUpUjj-.js → calendar-appointment-editor-dialog-DhTTWgXw.js} +3 -3
  12. package/dist/_chunks/{calendar-appointment-editor-dialog-cvUpUjj-.js.map → calendar-appointment-editor-dialog-DhTTWgXw.js.map} +1 -1
  13. package/dist/_chunks/{cycle-calculator-HO3s5InI.js → cycle-calculator-CQkjVSD2.js} +2 -2
  14. package/dist/_chunks/{cycle-calculator-HO3s5InI.js.map → cycle-calculator-CQkjVSD2.js.map} +1 -1
  15. package/dist/_chunks/{due-date-calculator-CDWTSblh.js → due-date-calculator-NjTlmoFK.js} +2 -2
  16. package/dist/_chunks/{due-date-calculator-CDWTSblh.js.map → due-date-calculator-NjTlmoFK.js.map} +1 -1
  17. package/dist/_chunks/{fetal-weight-CrtBFJl-.js → fetal-weight-Brl3n4LN.js} +2 -2
  18. package/dist/_chunks/{fetal-weight-CrtBFJl-.js.map → fetal-weight-Brl3n4LN.js.map} +1 -1
  19. package/dist/_chunks/{forgot-password-form-BSOZVrZG.js → forgot-password-form-BQPvDS7i.js} +2 -2
  20. package/dist/_chunks/{forgot-password-form-BSOZVrZG.js.map → forgot-password-form-BQPvDS7i.js.map} +1 -1
  21. package/dist/_chunks/form-field-CyHfOVKF.js +185 -0
  22. package/dist/_chunks/form-field-CyHfOVKF.js.map +1 -0
  23. package/dist/_chunks/{gestational-age-calculator-CTHeJJdb.js → gestational-age-calculator-Dr9hdDta.js} +2 -2
  24. package/dist/_chunks/{gestational-age-calculator-CTHeJJdb.js.map → gestational-age-calculator-Dr9hdDta.js.map} +1 -1
  25. package/dist/_chunks/{hcg-doubling-BBk-a33g.js → hcg-doubling-K41Wy7LB.js} +2 -2
  26. package/dist/_chunks/{hcg-doubling-BBk-a33g.js.map → hcg-doubling-K41Wy7LB.js.map} +1 -1
  27. package/dist/_chunks/{help-me-write-templates-Ds1FY-WY.js → help-me-write-templates-BJSf24xS.js} +2 -2
  28. package/dist/_chunks/{help-me-write-templates-Ds1FY-WY.js.map → help-me-write-templates-BJSf24xS.js.map} +1 -1
  29. package/dist/_chunks/key-round-DIgsnJSg.js +21 -0
  30. package/dist/_chunks/key-round-DIgsnJSg.js.map +1 -0
  31. package/dist/_chunks/{kit-extensions-sNTZWkoo.js → kit-extensions-a0G4COFH.js} +6 -6
  32. package/dist/_chunks/{kit-extensions-sNTZWkoo.js.map → kit-extensions-a0G4COFH.js.map} +1 -1
  33. package/dist/_chunks/login-dev-card-CvLHj-_N.js +353 -0
  34. package/dist/_chunks/login-dev-card-CvLHj-_N.js.map +1 -0
  35. package/dist/_chunks/{pregnancy-dating-JBAUbM40.js → pregnancy-dating-BHvfDxz4.js} +2 -2
  36. package/dist/_chunks/{pregnancy-dating-JBAUbM40.js.map → pregnancy-dating-BHvfDxz4.js.map} +1 -1
  37. package/dist/_chunks/{pregnancy-weight-gain--Bqv6AWu.js → pregnancy-weight-gain-BeQRxwdP.js} +2 -2
  38. package/dist/_chunks/{pregnancy-weight-gain--Bqv6AWu.js.map → pregnancy-weight-gain-BeQRxwdP.js.map} +1 -1
  39. package/dist/_chunks/{radiograph-panel.agent-DQh2SX8G.js → radiograph-panel.agent-BQ95uFCd.js} +2 -2
  40. package/dist/_chunks/{radiograph-panel.agent-DQh2SX8G.js.map → radiograph-panel.agent-BQ95uFCd.js.map} +1 -1
  41. package/dist/_chunks/registration-form-CNBfUduG.js +1337 -0
  42. package/dist/_chunks/registration-form-CNBfUduG.js.map +1 -0
  43. package/dist/_chunks/reset-password-form-Cf9QPEJu.js +367 -0
  44. package/dist/_chunks/reset-password-form-Cf9QPEJu.js.map +1 -0
  45. package/dist/_chunks/{send-registration-link-form-__DWY62q.js → send-registration-link-form-vTn1HxjA.js} +2 -2
  46. package/dist/_chunks/{send-registration-link-form-__DWY62q.js.map → send-registration-link-form-vTn1HxjA.js.map} +1 -1
  47. package/dist/_chunks/{task-editor-CRhfwP9T.js → task-editor-Cpw-NmND.js} +2 -2
  48. package/dist/_chunks/{task-editor-CRhfwP9T.js.map → task-editor-Cpw-NmND.js.map} +1 -1
  49. package/dist/_chunks/{unit-converter-D59L-gkf.js → unit-converter-BH5ueIhT.js} +2 -2
  50. package/dist/_chunks/{unit-converter-D59L-gkf.js.map → unit-converter-BH5ueIhT.js.map} +1 -1
  51. package/dist/_chunks/{voice-control-panel-DQJwe6_Q.js → voice-control-panel-BziKE-KK.js} +2 -2
  52. package/dist/_chunks/{voice-control-panel-DQJwe6_Q.js.map → voice-control-panel-BziKE-KK.js.map} +1 -1
  53. package/dist/_chunks/{workflow-webhook-action-BvVPZVpG.js → workflow-webhook-action-DulCpCRz.js} +96 -111
  54. package/dist/_chunks/workflow-webhook-action-DulCpCRz.js.map +1 -0
  55. package/dist/agent-catalog.json +89 -3
  56. package/dist/agent-i18n/en.json +11 -2
  57. package/dist/components/address-fields/index.js +1 -1
  58. package/dist/components/bishop-score/index.js +1 -1
  59. package/dist/components/bmi-calculator/index.js +1 -1
  60. package/dist/components/booking/index.js +1 -1
  61. package/dist/components/cycle-calculator/index.js +1 -1
  62. package/dist/components/due-date-calculator/index.js +1 -1
  63. package/dist/components/fetal-weight/index.js +1 -1
  64. package/dist/components/form-field/form-field.d.ts +6 -0
  65. package/dist/components/form-field/form-field.d.ts.map +1 -1
  66. package/dist/components/form-field/index.js +1 -1
  67. package/dist/components/gestational-age-calculator/index.js +1 -1
  68. package/dist/components/hcg-doubling/index.js +1 -1
  69. package/dist/components/index.d.ts +1 -0
  70. package/dist/components/index.d.ts.map +1 -1
  71. package/dist/components/pregnancy-dating/index.js +1 -1
  72. package/dist/components/pregnancy-weight-gain/index.js +1 -1
  73. package/dist/components/radiograph-panel/index.js +1 -1
  74. package/dist/components/rich-text-editor/index.js +1 -1
  75. package/dist/components/task-editor/index.js +1 -1
  76. package/dist/components/unit-converter/index.js +1 -1
  77. package/dist/components/voice-control-panel/index.js +1 -1
  78. package/dist/i18n/locales/ar.d.ts +26 -0
  79. package/dist/i18n/locales/ar.d.ts.map +1 -1
  80. package/dist/i18n/locales/ar.js +27 -1
  81. package/dist/i18n/locales/ar.js.map +1 -1
  82. package/dist/i18n/locales/de.d.ts +26 -0
  83. package/dist/i18n/locales/de.d.ts.map +1 -1
  84. package/dist/i18n/locales/de.js +27 -1
  85. package/dist/i18n/locales/de.js.map +1 -1
  86. package/dist/i18n/locales/el.d.ts +26 -0
  87. package/dist/i18n/locales/el.d.ts.map +1 -1
  88. package/dist/i18n/locales/el.js +27 -1
  89. package/dist/i18n/locales/el.js.map +1 -1
  90. package/dist/i18n/locales/en.d.ts +26 -0
  91. package/dist/i18n/locales/en.d.ts.map +1 -1
  92. package/dist/i18n/locales/en.js +26 -0
  93. package/dist/i18n/locales/en.js.map +1 -1
  94. package/dist/i18n/locales/es.d.ts +26 -0
  95. package/dist/i18n/locales/es.d.ts.map +1 -1
  96. package/dist/i18n/locales/es.js +27 -1
  97. package/dist/i18n/locales/es.js.map +1 -1
  98. package/dist/i18n/locales/fr.d.ts +26 -0
  99. package/dist/i18n/locales/fr.d.ts.map +1 -1
  100. package/dist/i18n/locales/fr.js +27 -1
  101. package/dist/i18n/locales/fr.js.map +1 -1
  102. package/dist/i18n/locales/hi.d.ts +26 -0
  103. package/dist/i18n/locales/hi.d.ts.map +1 -1
  104. package/dist/i18n/locales/hi.js +27 -1
  105. package/dist/i18n/locales/hi.js.map +1 -1
  106. package/dist/i18n/locales/it.d.ts +26 -0
  107. package/dist/i18n/locales/it.d.ts.map +1 -1
  108. package/dist/i18n/locales/it.js +27 -1
  109. package/dist/i18n/locales/it.js.map +1 -1
  110. package/dist/i18n/locales/ja.d.ts +26 -0
  111. package/dist/i18n/locales/ja.d.ts.map +1 -1
  112. package/dist/i18n/locales/ja.js +27 -1
  113. package/dist/i18n/locales/ja.js.map +1 -1
  114. package/dist/i18n/locales/nl.d.ts +26 -0
  115. package/dist/i18n/locales/nl.d.ts.map +1 -1
  116. package/dist/i18n/locales/nl.js +27 -1
  117. package/dist/i18n/locales/nl.js.map +1 -1
  118. package/dist/i18n/locales/pl.d.ts +26 -0
  119. package/dist/i18n/locales/pl.d.ts.map +1 -1
  120. package/dist/i18n/locales/pl.js +27 -1
  121. package/dist/i18n/locales/pl.js.map +1 -1
  122. package/dist/i18n/locales/pt.d.ts +26 -0
  123. package/dist/i18n/locales/pt.d.ts.map +1 -1
  124. package/dist/i18n/locales/pt.js +27 -1
  125. package/dist/i18n/locales/pt.js.map +1 -1
  126. package/dist/i18n/locales/ro.d.ts +26 -0
  127. package/dist/i18n/locales/ro.d.ts.map +1 -1
  128. package/dist/i18n/locales/ro.js +27 -1
  129. package/dist/i18n/locales/ro.js.map +1 -1
  130. package/dist/i18n/locales/ru.d.ts +26 -0
  131. package/dist/i18n/locales/ru.d.ts.map +1 -1
  132. package/dist/i18n/locales/ru.js +27 -1
  133. package/dist/i18n/locales/ru.js.map +1 -1
  134. package/dist/i18n/locales/sq.d.ts +26 -0
  135. package/dist/i18n/locales/sq.d.ts.map +1 -1
  136. package/dist/i18n/locales/sq.js +27 -1
  137. package/dist/i18n/locales/sq.js.map +1 -1
  138. package/dist/i18n/locales/sv.d.ts +26 -0
  139. package/dist/i18n/locales/sv.d.ts.map +1 -1
  140. package/dist/i18n/locales/sv.js +27 -1
  141. package/dist/i18n/locales/sv.js.map +1 -1
  142. package/dist/i18n/locales/tr.d.ts +26 -0
  143. package/dist/i18n/locales/tr.d.ts.map +1 -1
  144. package/dist/i18n/locales/tr.js +27 -1
  145. package/dist/i18n/locales/tr.js.map +1 -1
  146. package/dist/i18n/locales/zh.d.ts +26 -0
  147. package/dist/i18n/locales/zh.d.ts.map +1 -1
  148. package/dist/i18n/locales/zh.js +27 -1
  149. package/dist/i18n/locales/zh.js.map +1 -1
  150. package/dist/index.js +89 -86
  151. package/dist/index.js.map +1 -1
  152. package/dist/locales/ar.json +27 -1
  153. package/dist/locales/de.json +27 -1
  154. package/dist/locales/el.json +27 -1
  155. package/dist/locales/en.json +26 -0
  156. package/dist/locales/es.json +27 -1
  157. package/dist/locales/fr.json +27 -1
  158. package/dist/locales/hi.json +27 -1
  159. package/dist/locales/it.json +27 -1
  160. package/dist/locales/ja.json +27 -1
  161. package/dist/locales/nl.json +27 -1
  162. package/dist/locales/pl.json +27 -1
  163. package/dist/locales/pt.json +27 -1
  164. package/dist/locales/ro.json +27 -1
  165. package/dist/locales/ru.json +27 -1
  166. package/dist/locales/sq.json +27 -1
  167. package/dist/locales/sv.json +27 -1
  168. package/dist/locales/tr.json +27 -1
  169. package/dist/locales/zh.json +27 -1
  170. package/dist/patterns/_shared/password-policy.d.ts +3 -0
  171. package/dist/patterns/_shared/password-policy.d.ts.map +1 -0
  172. package/dist/patterns/anamnesis/index.js +1 -1
  173. package/dist/patterns/calendar/index.js +1 -1
  174. package/dist/patterns/forgot-password-form/index.js +1 -1
  175. package/dist/patterns/help-me-write-templates/index.js +1 -1
  176. package/dist/patterns/login-form/index.js +1 -1
  177. package/dist/patterns/login-form/login-form.d.ts +24 -7
  178. package/dist/patterns/login-form/login-form.d.ts.map +1 -1
  179. package/dist/patterns/registration-form/index.d.ts +1 -1
  180. package/dist/patterns/registration-form/index.d.ts.map +1 -1
  181. package/dist/patterns/registration-form/index.js +1 -1
  182. package/dist/patterns/registration-form/registration-form.d.ts +27 -0
  183. package/dist/patterns/registration-form/registration-form.d.ts.map +1 -1
  184. package/dist/patterns/reset-password-form/index.d.ts +3 -0
  185. package/dist/patterns/reset-password-form/index.d.ts.map +1 -0
  186. package/dist/patterns/reset-password-form/index.js +6 -0
  187. package/dist/patterns/reset-password-form/index.js.map +1 -0
  188. package/dist/patterns/reset-password-form/reset-password-form.d.ts +108 -0
  189. package/dist/patterns/reset-password-form/reset-password-form.d.ts.map +1 -0
  190. package/dist/patterns/send-registration-link-form/index.js +1 -1
  191. package/dist/patterns/workflow-webhook-action/index.js +1 -1
  192. package/package.json +5 -1
  193. package/dist/_chunks/form-field-Ani72sVY.js +0 -176
  194. package/dist/_chunks/form-field-Ani72sVY.js.map +0 -1
  195. package/dist/_chunks/login-dev-card-DRxTPkE9.js +0 -332
  196. package/dist/_chunks/login-dev-card-DRxTPkE9.js.map +0 -1
  197. package/dist/_chunks/registration-form-xORq2s4p.js +0 -1310
  198. package/dist/_chunks/registration-form-xORq2s4p.js.map +0 -1
  199. package/dist/_chunks/workflow-webhook-action-BvVPZVpG.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"send-registration-link-form-__DWY62q.js","sources":["../../src/patterns/send-registration-link-form/send-registration-link-form.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* SendRegistrationLinkForm: the form sales use in the admin area to */\n/* send a doctor a registration link. */\n/* */\n/* Email, confirm email, mobile phone, confirm phone and the last day the link allows */\n/* login. Every prop is data, so a server-rendered page can mount it */\n/* from JSON. The browser posts a real form to the host's own field */\n/* names; the card checks what a browser can check first. The host */\n/* keeps every server rule. The link itself is never shown. */\n/* -------------------------------------------------------------------- */\n\nimport {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type HTMLAttributes,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { cva } from 'class-variance-authority';\nimport {\n format,\n isAfter,\n isBefore,\n isValid,\n parseISO,\n startOfDay,\n} from 'date-fns';\nimport { parsePhoneNumberFromString } from 'libphonenumber-js/min';\nimport isEmail from 'validator/lib/isEmail';\nimport { Alert } from '../../components/alert';\nimport { Button } from '../../components/button';\nimport { Card } from '../../components/card';\nimport { DatePicker } from '../../components/date-picker';\nimport { EmailInput } from '../../components/email-input';\nimport { ErrorSummary } from '../../components/error-summary';\nimport { FormField } from '../../components/form-field';\nimport { PhoneInput } from '../../components/phone-input';\nimport { isSafeHref, isSameSiteHref } from '../../components/_shared/safe-href';\nimport { useStateBackedInput } from '../../components/_shared/use-state-backed-input';\nimport { useFieldMatch } from '../../hooks/use-field-match';\nimport {\n useErrorSummary,\n useFormMessageAnnounce,\n} from '../_shared/use-error-summary';\nimport { useRegistrationSubmit } from '../registration-form/use-registration-submit';\n\n/* -------------------------------------------------------------------- */\n/* Types */\n/* -------------------------------------------------------------------- */\n\n/** The fields of the form, in the order they appear. */\nexport const SEND_REGISTRATION_LINK_FIELDS = [\n 'email',\n 'emailConfirm',\n 'phone',\n 'phoneConfirm',\n 'allowLoginUntil',\n] as const;\n\nexport type SendRegistrationLinkField =\n (typeof SEND_REGISTRATION_LINK_FIELDS)[number];\n\n/** What `onSubmit` receives once every check has passed. */\nexport interface SendRegistrationLinkValues {\n email: string;\n /** As typed. It matches `email` apart from case and outer spaces. */\n emailConfirm: string;\n /** In E.164 form, e.g. `+393331234567`. */\n phone: string;\n /** In E.164 form. Equal to `phone`. */\n phoneConfirm: string;\n /** `yyyy-MM-dd`. */\n allowLoginUntil: string;\n}\n\n/** Values to show when the form opens, e.g. after a refused post.\n * `allowLoginUntil` is `yyyy-MM-dd`. */\nexport type SendRegistrationLinkInitialValues =\n Partial<SendRegistrationLinkValues>;\n\n/** Messages from the server, already translated by the host: one per\n * field, plus `form` for a message about the whole form. */\nexport type SendRegistrationLinkErrors = Partial<\n Record<SendRegistrationLinkField | 'form', string>\n>;\n\n/** The host's own form field names, e.g. `send_registration_link[email]`. */\nexport type SendRegistrationLinkFieldNames = Partial<\n Record<SendRegistrationLinkField, string>\n>;\n\n/** Guidance for the person sending, in the host's own words. */\nexport interface SendRegistrationLinkGuidance {\n /** The notice's heading. Pass it translated. */\n title: string;\n /** One short point each. Pass them translated. Plain text. */\n points: readonly string[];\n}\n\n/** The result of a send, shown instead of the form. */\nexport interface SendRegistrationLinkSent {\n /** The address the email went to. */\n email: string;\n /** The last day the link allows login, `yyyy-MM-dd`. */\n allowLoginUntil: string;\n}\n\nexport interface SendRegistrationLinkFormProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'title' | 'onSubmit'\n> {\n /** Replaces the heading \"Send a registration link\". Pass it translated. */\n title?: string;\n /** The heading's level. Default 2, for a page that has its own `h1`. */\n headingLevel?: 1 | 2 | 3;\n /** A warning-style notice above the form. The kit has no copy for it. */\n guidance?: SendRegistrationLinkGuidance;\n /** The first day that can be chosen, `yyyy-MM-dd`. Default: tomorrow. */\n minDate?: string;\n /** The last day that can be chosen, `yyyy-MM-dd`. Default: no limit.\n * Keep it equal to the server's. */\n maxDate?: string;\n /** Values to show when the form opens. Read once. */\n initialValues?: SendRegistrationLinkInitialValues;\n /** Messages from the server. Each shows on its field until the user\n * changes that field, and the form takes focus when they are present\n * at load. */\n errors?: SendRegistrationLinkErrors;\n /** Fields that refuse paste, so the user types them. Default: none.\n * Refusing a paste in `phoneConfirm` is silent: use it with care. */\n blockPaste?: readonly ('email' | 'emailConfirm' | 'phoneConfirm')[];\n /** Replaces the button's \"Send registration link\". Translated. */\n submitLabel?: string;\n /** True while a React host sends the values. */\n submitting?: boolean;\n /** Shows the result instead of the form. */\n sent?: SendRegistrationLinkSent;\n /** Where \"Send another link\" leads. Same-site path or full address. */\n sendAnotherHref?: string;\n /** For a native form post: the host's field names. When set, the\n * browser posts the form. */\n fieldNames?: SendRegistrationLinkFieldNames;\n /** Where the post goes. Default: the current address. Same site only. */\n action?: string;\n /** Extra hidden inputs for a native post, by name: the CSRF token. */\n hiddenFields?: Readonly<Record<string, string>>;\n /** For React hosts: called once every check has passed. Not called when\n * `fieldNames` is set. */\n onSubmit?: (values: SendRegistrationLinkValues) => void;\n}\n\n/* -------------------------------------------------------------------- */\n/* Helpers */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva(\n 'ds:w-full ds:[max-inline-size:36rem] ds:text-start ds:text-[var(--foreground)]',\n);\n\nconst isoDay = (date: Date): string => format(date, 'yyyy-MM-dd');\n\n/** A `yyyy-MM-dd` string as a local date, or nothing. */\nconst readDay = (value: string | undefined): Date | undefined => {\n if (!value) return undefined;\n const day = parseISO(value);\n return isValid(day) ? startOfDay(day) : undefined;\n};\n\nconst isPossiblePhone = (e164: string): boolean =>\n parsePhoneNumberFromString(e164)?.isPossible() ?? false;\n\nconst hasMessage = (errors: SendRegistrationLinkErrors): boolean =>\n Object.values(errors).some(Boolean);\n\n/* -------------------------------------------------------------------- */\n/* SendRegistrationLinkForm */\n/* -------------------------------------------------------------------- */\n\nexport const SendRegistrationLinkForm = forwardRef<\n HTMLDivElement,\n SendRegistrationLinkFormProps\n>(\n (\n {\n title,\n headingLevel = 2,\n guidance,\n minDate,\n maxDate,\n initialValues,\n errors,\n blockPaste,\n submitLabel,\n submitting = false,\n sent,\n sendAnotherHref,\n fieldNames,\n action,\n hiddenFields,\n onSubmit,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation('ui');\n const titleId = useId();\n const fieldIdBase = useId();\n const fieldId = (field: SendRegistrationLinkField) =>\n `${fieldIdBase}-${field}`;\n const formMessageId = useId();\n const native = fieldNames !== undefined;\n const Heading = `h${headingLevel}` as const;\n\n // The allowed days, whole days in the visitor's time zone. The default\n // first day is tomorrow, worked out once.\n const [tomorrow] = useState(() => {\n const day = startOfDay(new Date());\n day.setDate(day.getDate() + 1);\n return day;\n });\n const first = readDay(minDate) ?? tomorrow;\n const last = readDay(maxDate);\n const inRange = (day: Date) =>\n !isBefore(day, first) && !(last && isAfter(day, last));\n\n /* ------------------------------ State ----------------------------- */\n\n const [values, setValues] = useState(() => ({\n email: initialValues?.email ?? '',\n emailConfirm: initialValues?.emailConfirm ?? '',\n phone: initialValues?.phone ?? '',\n phoneConfirm: initialValues?.phoneConfirm ?? '',\n }));\n const [day, setDay] = useState<Date | undefined>(() =>\n readDay(initialValues?.allowLoginUntil),\n );\n const [phonePossible, setPhonePossible] = useState(() =>\n isPossiblePhone(initialValues?.phone ?? ''),\n );\n const [touched, setTouched] = useState<\n Partial<Record<SendRegistrationLinkField, boolean>>\n >(() => ({ email: Boolean(initialValues?.email) }));\n const [submitted, setSubmitted] = useState(false);\n const [serverErrors, setServerErrors] =\n useState<SendRegistrationLinkErrors>(() => errors ?? {});\n\n const clearServer = (field: SendRegistrationLinkField) =>\n setServerErrors((previous) =>\n previous[field] ? { ...previous, [field]: undefined } : previous,\n );\n const set = (\n field: 'email' | 'emailConfirm' | 'phone' | 'phoneConfirm',\n value: string,\n ) => {\n setValues((previous) => ({ ...previous, [field]: value }));\n clearServer(field);\n };\n const leave = (field: SendRegistrationLinkField) =>\n setTouched((previous) =>\n previous[field] ? previous : { ...previous, [field]: true },\n );\n\n /* ---------------------------- Validation -------------------------- */\n\n // The same comparison the server makes: trimmed, ignoring case.\n const emailMatch = useFieldMatch({\n value: values.email,\n confirmValue: values.emailConfirm,\n kind: 'email',\n submitted,\n });\n\n // Both phones are E.164 values, the ones the form posts.\n const phoneMatch = useFieldMatch({\n value: values.phone,\n confirmValue: values.phoneConfirm,\n kind: 'phone',\n submitted,\n });\n\n const invalid: Record<SendRegistrationLinkField, boolean> = {\n email: !isEmail(values.email),\n emailConfirm: values.emailConfirm === '' || !emailMatch.matches,\n phone: values.phone === '' || !phonePossible,\n phoneConfirm: values.phoneConfirm === '' || !phoneMatch.matches,\n allowLoginUntil: !day || !inRange(day),\n };\n const required = t('registrationForm.required');\n const formatDay = (value: Date) =>\n new Intl.DateTimeFormat(i18n.language, { dateStyle: 'medium' }).format(\n value,\n );\n const labels: Record<SendRegistrationLinkField, string> = {\n email: t('registrationForm.email'),\n emailConfirm: t('registrationForm.emailConfirm'),\n phone: t('sendRegistrationLink.phone'),\n phoneConfirm: t('sendRegistrationLink.phoneConfirm'),\n allowLoginUntil: t('sendRegistrationLink.allowLoginUntil'),\n };\n // A message shows once the user has left the field or tried to submit.\n // A date waits for a submit, or a value out of range: leaving the\n // field to open the calendar is not a mistake.\n const due = (field: SendRegistrationLinkField) =>\n submitted ||\n (field === 'allowLoginUntil'\n ? day !== undefined\n : touched[field] === true);\n const whenDue = (field: SendRegistrationLinkField, message: string) =>\n due(field) && invalid[field] ? message : undefined;\n const ownErrors: Record<SendRegistrationLinkField, string | undefined> = {\n email: whenDue(\n 'email',\n values.email === '' ? required : t('inputs.email.invalid'),\n ),\n emailConfirm:\n values.emailConfirm === ''\n ? whenDue('emailConfirm', required)\n : emailMatch.error,\n phone: whenDue(\n 'phone',\n values.phone === '' ? required : t('registrationForm.phoneInvalid'),\n ),\n phoneConfirm:\n values.phoneConfirm === ''\n ? whenDue('phoneConfirm', required)\n : phoneMatch.error,\n allowLoginUntil: whenDue(\n 'allowLoginUntil',\n !day\n ? required\n : t('sendRegistrationLink.dateOutOfRange', {\n min: formatDay(first),\n max: last ? formatDay(last) : '…',\n }),\n ),\n };\n const errorFor = (field: SendRegistrationLinkField) =>\n serverErrors[field] ?? ownErrors[field];\n\n /* ------------------------------ Focus ----------------------------- */\n\n const form = useRef<HTMLFormElement>(null);\n const formMessage = useRef<HTMLDivElement>(null);\n const emailRef = useRef<HTMLInputElement | null>(null);\n const emailConfirmRef = useRef<HTMLInputElement | null>(null);\n // The addresses stay out of the inputs' `value` attributes.\n const emailField = useStateBackedInput(values.email, emailRef);\n const emailConfirmField = useStateBackedInput(\n values.emailConfirm,\n emailConfirmRef,\n );\n\n const focusField = (field: SendRegistrationLinkField | 'form') => {\n if (field === 'form') {\n formMessage.current?.focus();\n return;\n }\n form.current\n ?.querySelector<HTMLElement>(`[data-field=\"${field}\"] input`)\n ?.focus();\n };\n const focusTargetFor = (messages: SendRegistrationLinkErrors) =>\n SEND_REGISTRATION_LINK_FIELDS.find((field) => messages[field]) ??\n (hasMessage(messages) ? ('form' as const) : undefined);\n\n const [openedWithFieldMessage] = useState(() =>\n SEND_REGISTRATION_LINK_FIELDS.some((field) => Boolean(errors?.[field])),\n );\n const summary = useErrorSummary(\n SEND_REGISTRATION_LINK_FIELDS,\n errorFor,\n openedWithFieldMessage,\n );\n const [focusRequest, setFocusRequest] = useState<{\n target: SendRegistrationLinkField | 'form';\n } | null>(() => {\n const target = openedWithFieldMessage\n ? undefined\n : focusTargetFor(errors ?? {});\n return target ? { target } : null;\n });\n useEffect(() => {\n if (focusRequest) focusField(focusRequest.target);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [focusRequest]);\n\n /* ------------------------------ Submit ---------------------------- */\n\n const submit = useRegistrationSubmit<SendRegistrationLinkField>({\n errors,\n submitting,\n native,\n captcha: false,\n firstProblem: () =>\n SEND_REGISTRATION_LINK_FIELDS.find((field) => invalid[field]),\n onRefused: (field) => {\n setSubmitted(true);\n summary.open(() => setFocusRequest({ target: field }));\n },\n deliver: () =>\n onSubmit?.({\n ...values,\n allowLoginUntil: day ? isoDay(day) : '',\n }),\n onAnswer: (answer) => {\n const next: SendRegistrationLinkErrors = answer;\n setServerErrors(next);\n if (!hasMessage(next)) return;\n setSubmitted(false);\n summary.open(() => {\n const target = focusTargetFor(next);\n if (target) setFocusRequest({ target });\n });\n },\n });\n\n /* ------------------------------ Render ---------------------------- */\n\n const name = (field: SendRegistrationLinkField) =>\n native ? fieldNames[field] : field;\n const formAction =\n native && action && isSameSiteHref(action) ? action : undefined;\n const formError = serverErrors.form;\n const formMessageAnnounce = useFormMessageAnnounce(\n formError,\n summary.listed.length > 0,\n );\n const ownNames = new Set(Object.values(fieldNames ?? {}));\n const extraFields = native\n ? Object.entries(hiddenFields ?? {}).filter(\n ([extra]) => !ownNames.has(extra),\n )\n : [];\n const anotherLink =\n sendAnotherHref && isSafeHref(sendAnotherHref)\n ? sendAnotherHref\n : undefined;\n const sentDay = readDay(sent?.allowLoginUntil);\n\n if (sent) {\n return (\n <div\n ref={ref}\n {...rest}\n data-component=\"send-registration-link-form\"\n data-state=\"sent\"\n className={rootVariants({ className })}\n >\n <Card variant=\"elevated\">\n <Card.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]\">\n <Heading className=\"type-title-card\">\n {title ?? t('sendRegistrationLink.title')}\n </Heading>\n <Alert variant=\"success\" data-slot=\"sent\">\n <Alert.Title as=\"p\">\n {t('sendRegistrationLink.sentTitle')}\n </Alert.Title>\n <Alert.Description>\n {t('sendRegistrationLink.sentEmail', { email: sent.email })}\n </Alert.Description>\n {sentDay && (\n <Alert.Description>\n {t('sendRegistrationLink.sentUntil', {\n date: formatDay(sentDay),\n })}\n </Alert.Description>\n )}\n </Alert>\n {anotherLink && (\n <Button asChild intent=\"secondary\" data-action=\"send-another\">\n <a href={anotherLink}>\n {t('sendRegistrationLink.sendAnother')}\n </a>\n </Button>\n )}\n </Card.Body>\n </Card>\n </div>\n );\n }\n\n return (\n <div\n ref={ref}\n {...rest}\n data-component=\"send-registration-link-form\"\n className={rootVariants({ className })}\n >\n <Card variant=\"elevated\">\n <Card.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]\">\n <Heading id={titleId} className=\"type-title-card\">\n {title ?? t('sendRegistrationLink.title')}\n </Heading>\n\n {guidance && (\n <Alert variant=\"warning\" data-slot=\"guidance\">\n <Alert.Title as=\"p\">{guidance.title}</Alert.Title>\n <ul className=\"ds:mx-0 ds:mb-0 ds:mt-[var(--spacing-xs)] ds:ps-[var(--spacing-lg)] ds:list-disc type-body-sm\">\n {guidance.points.map((point) => (\n <li key={point}>{point}</li>\n ))}\n </ul>\n </Alert>\n )}\n\n <form\n ref={form}\n noValidate\n method=\"post\"\n action={formAction}\n aria-labelledby={titleId}\n aria-busy={submit.busy || undefined}\n onSubmit={submit.handleSubmit}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\"\n >\n <ErrorSummary\n ref={summary.ref}\n headingLevel={(headingLevel + 1) as 2 | 3 | 4}\n aria-describedby={formError ? formMessageId : undefined}\n errors={summary.listed.map((field) => {\n const message = errorFor(field) ?? '';\n return {\n field,\n message,\n label: message === required ? labels[field] : undefined,\n targetId: fieldId(field),\n };\n })}\n />\n\n {formError && (\n <Alert\n ref={formMessage}\n id={formMessageId}\n variant=\"error\"\n announce={formMessageAnnounce}\n tabIndex={-1}\n data-field=\"form\"\n >\n <Alert.Description>{formError}</Alert.Description>\n </Alert>\n )}\n\n <FormField\n id={fieldId('email')}\n label={labels.email}\n required\n error={errorFor('email')}\n announceError={!summary.lists('email')}\n data-field=\"email\"\n >\n <EmailInput\n ref={emailField.ref}\n name={name('email')}\n errorMessage={null}\n onChange={emailField.quiet((event) =>\n set('email', event.target.value),\n )}\n onBlur={() => leave('email')}\n blockPaste={blockPaste?.includes('email') ?? false}\n />\n </FormField>\n\n <FormField\n id={fieldId('emailConfirm')}\n label={labels.emailConfirm}\n required\n error={errorFor('emailConfirm')}\n announceError={!summary.lists('emailConfirm')}\n data-field=\"emailConfirm\"\n >\n <EmailInput\n ref={emailConfirmField.ref}\n name={name('emailConfirm')}\n disableBuiltInValidation\n onChange={emailConfirmField.quiet((event) =>\n set('emailConfirm', event.target.value),\n )}\n onBlur={() => {\n leave('emailConfirm');\n emailMatch.confirmProps.onBlur();\n }}\n blockPaste={blockPaste?.includes('emailConfirm') ?? false}\n />\n </FormField>\n\n <FormField\n id={fieldId('phone')}\n label={labels.phone}\n required\n description={t('sendRegistrationLink.phoneDescription')}\n error={errorFor('phone')}\n announceError={!summary.lists('phone')}\n data-field=\"phone\"\n onBlur={() => leave('phone')}\n >\n {/* The visible input holds the number as typed; a hidden\n input carries the full international number. */}\n <PhoneInput\n name={native ? undefined : 'phone'}\n value={values.phone}\n onChange={(e164, meta) => {\n set('phone', e164);\n setPhonePossible(meta.isPossible);\n }}\n />\n </FormField>\n\n <FormField\n id={fieldId('phoneConfirm')}\n label={labels.phoneConfirm}\n required\n error={errorFor('phoneConfirm')}\n announceError={!summary.lists('phoneConfirm')}\n data-field=\"phoneConfirm\"\n onBlur={() => {\n leave('phoneConfirm');\n phoneMatch.confirmProps.onBlur();\n }}\n onPasteCapture={\n blockPaste?.includes('phoneConfirm')\n ? (event) => event.preventDefault()\n : undefined\n }\n >\n <PhoneInput\n name={native ? undefined : 'phoneConfirm'}\n value={values.phoneConfirm}\n onChange={(e164) => set('phoneConfirm', e164)}\n />\n </FormField>\n\n <FormField\n id={fieldId('allowLoginUntil')}\n label={labels.allowLoginUntil}\n required\n error={errorFor('allowLoginUntil')}\n announceError={!summary.lists('allowLoginUntil')}\n data-field=\"allowLoginUntil\"\n >\n <DatePicker\n value={day}\n minDate={first}\n maxDate={last}\n onChange={(next) => {\n setDay(next);\n clearServer('allowLoginUntil');\n }}\n />\n </FormField>\n\n {native && fieldNames.phone && (\n <input\n type=\"hidden\"\n name={fieldNames.phone}\n value={values.phone}\n />\n )}\n {native && fieldNames.phoneConfirm && (\n <input\n type=\"hidden\"\n name={fieldNames.phoneConfirm}\n value={values.phoneConfirm}\n />\n )}\n {native && fieldNames.allowLoginUntil && (\n <input\n type=\"hidden\"\n name={fieldNames.allowLoginUntil}\n value={day ? isoDay(day) : ''}\n />\n )}\n {extraFields.map(([extra, value]) => (\n <input key={extra} type=\"hidden\" name={extra} value={value} />\n ))}\n\n <Button\n type=\"submit\"\n intent=\"primary\"\n size=\"lg\"\n loading={submit.busy}\n className=\"ds:w-full\"\n data-action=\"submit\"\n >\n {submitLabel ?? t('sendRegistrationLink.submit')}\n </Button>\n <p role=\"status\" className=\"ds:sr-only\">\n {submit.busy ? t('chat.message.status.sending') : ''}\n </p>\n </form>\n </Card.Body>\n </Card>\n </div>\n );\n },\n);\nSendRegistrationLinkForm.displayName = 'SendRegistrationLinkForm';\n"],"names":["SEND_REGISTRATION_LINK_FIELDS","rootVariants","cva","isoDay","date","format","readDay","value","day","parseISO","isValid","startOfDay","isPossiblePhone","e164","_a","parsePhoneNumberFromString","hasMessage","errors","SendRegistrationLinkForm","forwardRef","title","headingLevel","guidance","minDate","maxDate","initialValues","blockPaste","submitLabel","submitting","sent","sendAnotherHref","fieldNames","action","hiddenFields","onSubmit","className","rest","ref","t","i18n","useTranslation","titleId","useId","fieldIdBase","fieldId","field","formMessageId","native","Heading","tomorrow","useState","first","last","inRange","isBefore","isAfter","values","setValues","setDay","phonePossible","setPhonePossible","touched","setTouched","submitted","setSubmitted","serverErrors","setServerErrors","clearServer","previous","set","leave","emailMatch","useFieldMatch","phoneMatch","invalid","isEmail","required","formatDay","labels","due","whenDue","message","ownErrors","errorFor","form","useRef","formMessage","emailRef","emailConfirmRef","emailField","useStateBackedInput","emailConfirmField","focusField","_c","_b","focusTargetFor","messages","openedWithFieldMessage","summary","useErrorSummary","focusRequest","setFocusRequest","target","useEffect","submit","useRegistrationSubmit","answer","next","name","formAction","isSameSiteHref","formError","formMessageAnnounce","useFormMessageAnnounce","ownNames","extraFields","extra","anotherLink","isSafeHref","sentDay","jsx","Card","jsxs","Alert","Button","point","ErrorSummary","FormField","EmailInput","event","PhoneInput","meta","DatePicker"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqDO,MAAMA,IAAgC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAkGMC,KAAeC;AAAA,EACnB;AACF,GAEMC,KAAS,CAACC,MAAuBC,GAAOD,GAAM,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EAAW,mBACpB,gBAAAyF;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,MAAK;AAAA,oBACL,MAAMzF,EAAW;AAAA,oBACjB,OAAOvB,IAAML,GAAOK,CAAG,IAAI;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAG9B2G,GAAY,IAAI,CAAC,CAACC,GAAO7G,CAAK,MAC7B,gBAAAiH,EAAC,SAAA,EAAkB,MAAK,UAAS,MAAMJ,GAAO,OAAA7G,EAAA,GAAlC6G,CAAgD,CAC7D;AAAA,gBAED,gBAAAI;AAAA,kBAACI;AAAA,kBAAA;AAAA,oBACC,MAAK;AAAA,oBACL,QAAO;AAAA,oBACP,MAAK;AAAA,oBACL,SAASpB,EAAO;AAAA,oBAChB,WAAU;AAAA,oBACV,eAAY;AAAA,oBAEX,UAAA7E,MAAeW,EAAE,6BAA6B;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAEjD,gBAAAkF,EAAC,KAAA,EAAE,MAAK,UAAS,WAAU,cACxB,UAAAhB,EAAO,OAAOlE,EAAE,6BAA6B,IAAI,GAAA,CACpD;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACF,EAAA,CACF,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AACApB,GAAyB,cAAc;"}
1
+ {"version":3,"file":"send-registration-link-form-vTn1HxjA.js","sources":["../../src/patterns/send-registration-link-form/send-registration-link-form.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* SendRegistrationLinkForm: the form sales use in the admin area to */\n/* send a doctor a registration link. */\n/* */\n/* Email, confirm email, mobile phone, confirm phone and the last day the link allows */\n/* login. Every prop is data, so a server-rendered page can mount it */\n/* from JSON. The browser posts a real form to the host's own field */\n/* names; the card checks what a browser can check first. The host */\n/* keeps every server rule. The link itself is never shown. */\n/* -------------------------------------------------------------------- */\n\nimport {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type HTMLAttributes,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { cva } from 'class-variance-authority';\nimport {\n format,\n isAfter,\n isBefore,\n isValid,\n parseISO,\n startOfDay,\n} from 'date-fns';\nimport { parsePhoneNumberFromString } from 'libphonenumber-js/min';\nimport isEmail from 'validator/lib/isEmail';\nimport { Alert } from '../../components/alert';\nimport { Button } from '../../components/button';\nimport { Card } from '../../components/card';\nimport { DatePicker } from '../../components/date-picker';\nimport { EmailInput } from '../../components/email-input';\nimport { ErrorSummary } from '../../components/error-summary';\nimport { FormField } from '../../components/form-field';\nimport { PhoneInput } from '../../components/phone-input';\nimport { isSafeHref, isSameSiteHref } from '../../components/_shared/safe-href';\nimport { useStateBackedInput } from '../../components/_shared/use-state-backed-input';\nimport { useFieldMatch } from '../../hooks/use-field-match';\nimport {\n useErrorSummary,\n useFormMessageAnnounce,\n} from '../_shared/use-error-summary';\nimport { useRegistrationSubmit } from '../registration-form/use-registration-submit';\n\n/* -------------------------------------------------------------------- */\n/* Types */\n/* -------------------------------------------------------------------- */\n\n/** The fields of the form, in the order they appear. */\nexport const SEND_REGISTRATION_LINK_FIELDS = [\n 'email',\n 'emailConfirm',\n 'phone',\n 'phoneConfirm',\n 'allowLoginUntil',\n] as const;\n\nexport type SendRegistrationLinkField =\n (typeof SEND_REGISTRATION_LINK_FIELDS)[number];\n\n/** What `onSubmit` receives once every check has passed. */\nexport interface SendRegistrationLinkValues {\n email: string;\n /** As typed. It matches `email` apart from case and outer spaces. */\n emailConfirm: string;\n /** In E.164 form, e.g. `+393331234567`. */\n phone: string;\n /** In E.164 form. Equal to `phone`. */\n phoneConfirm: string;\n /** `yyyy-MM-dd`. */\n allowLoginUntil: string;\n}\n\n/** Values to show when the form opens, e.g. after a refused post.\n * `allowLoginUntil` is `yyyy-MM-dd`. */\nexport type SendRegistrationLinkInitialValues =\n Partial<SendRegistrationLinkValues>;\n\n/** Messages from the server, already translated by the host: one per\n * field, plus `form` for a message about the whole form. */\nexport type SendRegistrationLinkErrors = Partial<\n Record<SendRegistrationLinkField | 'form', string>\n>;\n\n/** The host's own form field names, e.g. `send_registration_link[email]`. */\nexport type SendRegistrationLinkFieldNames = Partial<\n Record<SendRegistrationLinkField, string>\n>;\n\n/** Guidance for the person sending, in the host's own words. */\nexport interface SendRegistrationLinkGuidance {\n /** The notice's heading. Pass it translated. */\n title: string;\n /** One short point each. Pass them translated. Plain text. */\n points: readonly string[];\n}\n\n/** The result of a send, shown instead of the form. */\nexport interface SendRegistrationLinkSent {\n /** The address the email went to. */\n email: string;\n /** The last day the link allows login, `yyyy-MM-dd`. */\n allowLoginUntil: string;\n}\n\nexport interface SendRegistrationLinkFormProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'title' | 'onSubmit'\n> {\n /** Replaces the heading \"Send a registration link\". Pass it translated. */\n title?: string;\n /** The heading's level. Default 2, for a page that has its own `h1`. */\n headingLevel?: 1 | 2 | 3;\n /** A warning-style notice above the form. The kit has no copy for it. */\n guidance?: SendRegistrationLinkGuidance;\n /** The first day that can be chosen, `yyyy-MM-dd`. Default: tomorrow. */\n minDate?: string;\n /** The last day that can be chosen, `yyyy-MM-dd`. Default: no limit.\n * Keep it equal to the server's. */\n maxDate?: string;\n /** Values to show when the form opens. Read once. */\n initialValues?: SendRegistrationLinkInitialValues;\n /** Messages from the server. Each shows on its field until the user\n * changes that field, and the form takes focus when they are present\n * at load. */\n errors?: SendRegistrationLinkErrors;\n /** Fields that refuse paste, so the user types them. Default: none.\n * Refusing a paste in `phoneConfirm` is silent: use it with care. */\n blockPaste?: readonly ('email' | 'emailConfirm' | 'phoneConfirm')[];\n /** Replaces the button's \"Send registration link\". Translated. */\n submitLabel?: string;\n /** True while a React host sends the values. */\n submitting?: boolean;\n /** Shows the result instead of the form. */\n sent?: SendRegistrationLinkSent;\n /** Where \"Send another link\" leads. Same-site path or full address. */\n sendAnotherHref?: string;\n /** For a native form post: the host's field names. When set, the\n * browser posts the form. */\n fieldNames?: SendRegistrationLinkFieldNames;\n /** Where the post goes. Default: the current address. Same site only. */\n action?: string;\n /** Extra hidden inputs for a native post, by name: the CSRF token. */\n hiddenFields?: Readonly<Record<string, string>>;\n /** For React hosts: called once every check has passed. Not called when\n * `fieldNames` is set. */\n onSubmit?: (values: SendRegistrationLinkValues) => void;\n}\n\n/* -------------------------------------------------------------------- */\n/* Helpers */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva(\n 'ds:w-full ds:[max-inline-size:36rem] ds:text-start ds:text-[var(--foreground)]',\n);\n\nconst isoDay = (date: Date): string => format(date, 'yyyy-MM-dd');\n\n/** A `yyyy-MM-dd` string as a local date, or nothing. */\nconst readDay = (value: string | undefined): Date | undefined => {\n if (!value) return undefined;\n const day = parseISO(value);\n return isValid(day) ? startOfDay(day) : undefined;\n};\n\nconst isPossiblePhone = (e164: string): boolean =>\n parsePhoneNumberFromString(e164)?.isPossible() ?? false;\n\nconst hasMessage = (errors: SendRegistrationLinkErrors): boolean =>\n Object.values(errors).some(Boolean);\n\n/* -------------------------------------------------------------------- */\n/* SendRegistrationLinkForm */\n/* -------------------------------------------------------------------- */\n\nexport const SendRegistrationLinkForm = forwardRef<\n HTMLDivElement,\n SendRegistrationLinkFormProps\n>(\n (\n {\n title,\n headingLevel = 2,\n guidance,\n minDate,\n maxDate,\n initialValues,\n errors,\n blockPaste,\n submitLabel,\n submitting = false,\n sent,\n sendAnotherHref,\n fieldNames,\n action,\n hiddenFields,\n onSubmit,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation('ui');\n const titleId = useId();\n const fieldIdBase = useId();\n const fieldId = (field: SendRegistrationLinkField) =>\n `${fieldIdBase}-${field}`;\n const formMessageId = useId();\n const native = fieldNames !== undefined;\n const Heading = `h${headingLevel}` as const;\n\n // The allowed days, whole days in the visitor's time zone. The default\n // first day is tomorrow, worked out once.\n const [tomorrow] = useState(() => {\n const day = startOfDay(new Date());\n day.setDate(day.getDate() + 1);\n return day;\n });\n const first = readDay(minDate) ?? tomorrow;\n const last = readDay(maxDate);\n const inRange = (day: Date) =>\n !isBefore(day, first) && !(last && isAfter(day, last));\n\n /* ------------------------------ State ----------------------------- */\n\n const [values, setValues] = useState(() => ({\n email: initialValues?.email ?? '',\n emailConfirm: initialValues?.emailConfirm ?? '',\n phone: initialValues?.phone ?? '',\n phoneConfirm: initialValues?.phoneConfirm ?? '',\n }));\n const [day, setDay] = useState<Date | undefined>(() =>\n readDay(initialValues?.allowLoginUntil),\n );\n const [phonePossible, setPhonePossible] = useState(() =>\n isPossiblePhone(initialValues?.phone ?? ''),\n );\n const [touched, setTouched] = useState<\n Partial<Record<SendRegistrationLinkField, boolean>>\n >(() => ({ email: Boolean(initialValues?.email) }));\n const [submitted, setSubmitted] = useState(false);\n const [serverErrors, setServerErrors] =\n useState<SendRegistrationLinkErrors>(() => errors ?? {});\n\n const clearServer = (field: SendRegistrationLinkField) =>\n setServerErrors((previous) =>\n previous[field] ? { ...previous, [field]: undefined } : previous,\n );\n const set = (\n field: 'email' | 'emailConfirm' | 'phone' | 'phoneConfirm',\n value: string,\n ) => {\n setValues((previous) => ({ ...previous, [field]: value }));\n clearServer(field);\n };\n const leave = (field: SendRegistrationLinkField) =>\n setTouched((previous) =>\n previous[field] ? previous : { ...previous, [field]: true },\n );\n\n /* ---------------------------- Validation -------------------------- */\n\n // The same comparison the server makes: trimmed, ignoring case.\n const emailMatch = useFieldMatch({\n value: values.email,\n confirmValue: values.emailConfirm,\n kind: 'email',\n submitted,\n });\n\n // Both phones are E.164 values, the ones the form posts.\n const phoneMatch = useFieldMatch({\n value: values.phone,\n confirmValue: values.phoneConfirm,\n kind: 'phone',\n submitted,\n });\n\n const invalid: Record<SendRegistrationLinkField, boolean> = {\n email: !isEmail(values.email),\n emailConfirm: values.emailConfirm === '' || !emailMatch.matches,\n phone: values.phone === '' || !phonePossible,\n phoneConfirm: values.phoneConfirm === '' || !phoneMatch.matches,\n allowLoginUntil: !day || !inRange(day),\n };\n const required = t('registrationForm.required');\n const formatDay = (value: Date) =>\n new Intl.DateTimeFormat(i18n.language, { dateStyle: 'medium' }).format(\n value,\n );\n const labels: Record<SendRegistrationLinkField, string> = {\n email: t('registrationForm.email'),\n emailConfirm: t('registrationForm.emailConfirm'),\n phone: t('sendRegistrationLink.phone'),\n phoneConfirm: t('sendRegistrationLink.phoneConfirm'),\n allowLoginUntil: t('sendRegistrationLink.allowLoginUntil'),\n };\n // A message shows once the user has left the field or tried to submit.\n // A date waits for a submit, or a value out of range: leaving the\n // field to open the calendar is not a mistake.\n const due = (field: SendRegistrationLinkField) =>\n submitted ||\n (field === 'allowLoginUntil'\n ? day !== undefined\n : touched[field] === true);\n const whenDue = (field: SendRegistrationLinkField, message: string) =>\n due(field) && invalid[field] ? message : undefined;\n const ownErrors: Record<SendRegistrationLinkField, string | undefined> = {\n email: whenDue(\n 'email',\n values.email === '' ? required : t('inputs.email.invalid'),\n ),\n emailConfirm:\n values.emailConfirm === ''\n ? whenDue('emailConfirm', required)\n : emailMatch.error,\n phone: whenDue(\n 'phone',\n values.phone === '' ? required : t('registrationForm.phoneInvalid'),\n ),\n phoneConfirm:\n values.phoneConfirm === ''\n ? whenDue('phoneConfirm', required)\n : phoneMatch.error,\n allowLoginUntil: whenDue(\n 'allowLoginUntil',\n !day\n ? required\n : t('sendRegistrationLink.dateOutOfRange', {\n min: formatDay(first),\n max: last ? formatDay(last) : '…',\n }),\n ),\n };\n const errorFor = (field: SendRegistrationLinkField) =>\n serverErrors[field] ?? ownErrors[field];\n\n /* ------------------------------ Focus ----------------------------- */\n\n const form = useRef<HTMLFormElement>(null);\n const formMessage = useRef<HTMLDivElement>(null);\n const emailRef = useRef<HTMLInputElement | null>(null);\n const emailConfirmRef = useRef<HTMLInputElement | null>(null);\n // The addresses stay out of the inputs' `value` attributes.\n const emailField = useStateBackedInput(values.email, emailRef);\n const emailConfirmField = useStateBackedInput(\n values.emailConfirm,\n emailConfirmRef,\n );\n\n const focusField = (field: SendRegistrationLinkField | 'form') => {\n if (field === 'form') {\n formMessage.current?.focus();\n return;\n }\n form.current\n ?.querySelector<HTMLElement>(`[data-field=\"${field}\"] input`)\n ?.focus();\n };\n const focusTargetFor = (messages: SendRegistrationLinkErrors) =>\n SEND_REGISTRATION_LINK_FIELDS.find((field) => messages[field]) ??\n (hasMessage(messages) ? ('form' as const) : undefined);\n\n const [openedWithFieldMessage] = useState(() =>\n SEND_REGISTRATION_LINK_FIELDS.some((field) => Boolean(errors?.[field])),\n );\n const summary = useErrorSummary(\n SEND_REGISTRATION_LINK_FIELDS,\n errorFor,\n openedWithFieldMessage,\n );\n const [focusRequest, setFocusRequest] = useState<{\n target: SendRegistrationLinkField | 'form';\n } | null>(() => {\n const target = openedWithFieldMessage\n ? undefined\n : focusTargetFor(errors ?? {});\n return target ? { target } : null;\n });\n useEffect(() => {\n if (focusRequest) focusField(focusRequest.target);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [focusRequest]);\n\n /* ------------------------------ Submit ---------------------------- */\n\n const submit = useRegistrationSubmit<SendRegistrationLinkField>({\n errors,\n submitting,\n native,\n captcha: false,\n firstProblem: () =>\n SEND_REGISTRATION_LINK_FIELDS.find((field) => invalid[field]),\n onRefused: (field) => {\n setSubmitted(true);\n summary.open(() => setFocusRequest({ target: field }));\n },\n deliver: () =>\n onSubmit?.({\n ...values,\n allowLoginUntil: day ? isoDay(day) : '',\n }),\n onAnswer: (answer) => {\n const next: SendRegistrationLinkErrors = answer;\n setServerErrors(next);\n if (!hasMessage(next)) return;\n setSubmitted(false);\n summary.open(() => {\n const target = focusTargetFor(next);\n if (target) setFocusRequest({ target });\n });\n },\n });\n\n /* ------------------------------ Render ---------------------------- */\n\n const name = (field: SendRegistrationLinkField) =>\n native ? fieldNames[field] : field;\n const formAction =\n native && action && isSameSiteHref(action) ? action : undefined;\n const formError = serverErrors.form;\n const formMessageAnnounce = useFormMessageAnnounce(\n formError,\n summary.listed.length > 0,\n );\n const ownNames = new Set(Object.values(fieldNames ?? {}));\n const extraFields = native\n ? Object.entries(hiddenFields ?? {}).filter(\n ([extra]) => !ownNames.has(extra),\n )\n : [];\n const anotherLink =\n sendAnotherHref && isSafeHref(sendAnotherHref)\n ? sendAnotherHref\n : undefined;\n const sentDay = readDay(sent?.allowLoginUntil);\n\n if (sent) {\n return (\n <div\n ref={ref}\n {...rest}\n data-component=\"send-registration-link-form\"\n data-state=\"sent\"\n className={rootVariants({ className })}\n >\n <Card variant=\"elevated\">\n <Card.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]\">\n <Heading className=\"type-title-card\">\n {title ?? t('sendRegistrationLink.title')}\n </Heading>\n <Alert variant=\"success\" data-slot=\"sent\">\n <Alert.Title as=\"p\">\n {t('sendRegistrationLink.sentTitle')}\n </Alert.Title>\n <Alert.Description>\n {t('sendRegistrationLink.sentEmail', { email: sent.email })}\n </Alert.Description>\n {sentDay && (\n <Alert.Description>\n {t('sendRegistrationLink.sentUntil', {\n date: formatDay(sentDay),\n })}\n </Alert.Description>\n )}\n </Alert>\n {anotherLink && (\n <Button asChild intent=\"secondary\" data-action=\"send-another\">\n <a href={anotherLink}>\n {t('sendRegistrationLink.sendAnother')}\n </a>\n </Button>\n )}\n </Card.Body>\n </Card>\n </div>\n );\n }\n\n return (\n <div\n ref={ref}\n {...rest}\n data-component=\"send-registration-link-form\"\n className={rootVariants({ className })}\n >\n <Card variant=\"elevated\">\n <Card.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]\">\n <Heading id={titleId} className=\"type-title-card\">\n {title ?? t('sendRegistrationLink.title')}\n </Heading>\n\n {guidance && (\n <Alert variant=\"warning\" data-slot=\"guidance\">\n <Alert.Title as=\"p\">{guidance.title}</Alert.Title>\n <ul className=\"ds:mx-0 ds:mb-0 ds:mt-[var(--spacing-xs)] ds:ps-[var(--spacing-lg)] ds:list-disc type-body-sm\">\n {guidance.points.map((point) => (\n <li key={point}>{point}</li>\n ))}\n </ul>\n </Alert>\n )}\n\n <form\n ref={form}\n noValidate\n method=\"post\"\n action={formAction}\n aria-labelledby={titleId}\n aria-busy={submit.busy || undefined}\n onSubmit={submit.handleSubmit}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\"\n >\n <ErrorSummary\n ref={summary.ref}\n headingLevel={(headingLevel + 1) as 2 | 3 | 4}\n aria-describedby={formError ? formMessageId : undefined}\n errors={summary.listed.map((field) => {\n const message = errorFor(field) ?? '';\n return {\n field,\n message,\n label: message === required ? labels[field] : undefined,\n targetId: fieldId(field),\n };\n })}\n />\n\n {formError && (\n <Alert\n ref={formMessage}\n id={formMessageId}\n variant=\"error\"\n announce={formMessageAnnounce}\n tabIndex={-1}\n data-field=\"form\"\n >\n <Alert.Description>{formError}</Alert.Description>\n </Alert>\n )}\n\n <FormField\n id={fieldId('email')}\n label={labels.email}\n required\n error={errorFor('email')}\n announceError={!summary.lists('email')}\n data-field=\"email\"\n >\n <EmailInput\n ref={emailField.ref}\n name={name('email')}\n errorMessage={null}\n onChange={emailField.quiet((event) =>\n set('email', event.target.value),\n )}\n onBlur={() => leave('email')}\n blockPaste={blockPaste?.includes('email') ?? false}\n />\n </FormField>\n\n <FormField\n id={fieldId('emailConfirm')}\n label={labels.emailConfirm}\n required\n error={errorFor('emailConfirm')}\n announceError={!summary.lists('emailConfirm')}\n data-field=\"emailConfirm\"\n >\n <EmailInput\n ref={emailConfirmField.ref}\n name={name('emailConfirm')}\n disableBuiltInValidation\n onChange={emailConfirmField.quiet((event) =>\n set('emailConfirm', event.target.value),\n )}\n onBlur={() => {\n leave('emailConfirm');\n emailMatch.confirmProps.onBlur();\n }}\n blockPaste={blockPaste?.includes('emailConfirm') ?? false}\n />\n </FormField>\n\n <FormField\n id={fieldId('phone')}\n label={labels.phone}\n required\n description={t('sendRegistrationLink.phoneDescription')}\n error={errorFor('phone')}\n announceError={!summary.lists('phone')}\n data-field=\"phone\"\n onBlur={() => leave('phone')}\n >\n {/* The visible input holds the number as typed; a hidden\n input carries the full international number. */}\n <PhoneInput\n name={native ? undefined : 'phone'}\n value={values.phone}\n onChange={(e164, meta) => {\n set('phone', e164);\n setPhonePossible(meta.isPossible);\n }}\n />\n </FormField>\n\n <FormField\n id={fieldId('phoneConfirm')}\n label={labels.phoneConfirm}\n required\n error={errorFor('phoneConfirm')}\n announceError={!summary.lists('phoneConfirm')}\n data-field=\"phoneConfirm\"\n onBlur={() => {\n leave('phoneConfirm');\n phoneMatch.confirmProps.onBlur();\n }}\n onPasteCapture={\n blockPaste?.includes('phoneConfirm')\n ? (event) => event.preventDefault()\n : undefined\n }\n >\n <PhoneInput\n name={native ? undefined : 'phoneConfirm'}\n value={values.phoneConfirm}\n onChange={(e164) => set('phoneConfirm', e164)}\n />\n </FormField>\n\n <FormField\n id={fieldId('allowLoginUntil')}\n label={labels.allowLoginUntil}\n required\n error={errorFor('allowLoginUntil')}\n announceError={!summary.lists('allowLoginUntil')}\n data-field=\"allowLoginUntil\"\n >\n <DatePicker\n value={day}\n minDate={first}\n maxDate={last}\n onChange={(next) => {\n setDay(next);\n clearServer('allowLoginUntil');\n }}\n />\n </FormField>\n\n {native && fieldNames.phone && (\n <input\n type=\"hidden\"\n name={fieldNames.phone}\n value={values.phone}\n />\n )}\n {native && fieldNames.phoneConfirm && (\n <input\n type=\"hidden\"\n name={fieldNames.phoneConfirm}\n value={values.phoneConfirm}\n />\n )}\n {native && fieldNames.allowLoginUntil && (\n <input\n type=\"hidden\"\n name={fieldNames.allowLoginUntil}\n value={day ? isoDay(day) : ''}\n />\n )}\n {extraFields.map(([extra, value]) => (\n <input key={extra} type=\"hidden\" name={extra} value={value} />\n ))}\n\n <Button\n type=\"submit\"\n intent=\"primary\"\n size=\"lg\"\n loading={submit.busy}\n className=\"ds:w-full\"\n data-action=\"submit\"\n >\n {submitLabel ?? t('sendRegistrationLink.submit')}\n </Button>\n <p role=\"status\" className=\"ds:sr-only\">\n {submit.busy ? t('chat.message.status.sending') : ''}\n </p>\n </form>\n </Card.Body>\n </Card>\n </div>\n );\n },\n);\nSendRegistrationLinkForm.displayName = 'SendRegistrationLinkForm';\n"],"names":["SEND_REGISTRATION_LINK_FIELDS","rootVariants","cva","isoDay","date","format","readDay","value","day","parseISO","isValid","startOfDay","isPossiblePhone","e164","_a","parsePhoneNumberFromString","hasMessage","errors","SendRegistrationLinkForm","forwardRef","title","headingLevel","guidance","minDate","maxDate","initialValues","blockPaste","submitLabel","submitting","sent","sendAnotherHref","fieldNames","action","hiddenFields","onSubmit","className","rest","ref","t","i18n","useTranslation","titleId","useId","fieldIdBase","fieldId","field","formMessageId","native","Heading","tomorrow","useState","first","last","inRange","isBefore","isAfter","values","setValues","setDay","phonePossible","setPhonePossible","touched","setTouched","submitted","setSubmitted","serverErrors","setServerErrors","clearServer","previous","set","leave","emailMatch","useFieldMatch","phoneMatch","invalid","isEmail","required","formatDay","labels","due","whenDue","message","ownErrors","errorFor","form","useRef","formMessage","emailRef","emailConfirmRef","emailField","useStateBackedInput","emailConfirmField","focusField","_c","_b","focusTargetFor","messages","openedWithFieldMessage","summary","useErrorSummary","focusRequest","setFocusRequest","target","useEffect","submit","useRegistrationSubmit","answer","next","name","formAction","isSameSiteHref","formError","formMessageAnnounce","useFormMessageAnnounce","ownNames","extraFields","extra","anotherLink","isSafeHref","sentDay","jsx","Card","jsxs","Alert","Button","point","ErrorSummary","FormField","EmailInput","event","PhoneInput","meta","DatePicker"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqDO,MAAMA,IAAgC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAkGMC,KAAeC;AAAA,EACnB;AACF,GAEMC,KAAS,CAACC,MAAuBC,GAAOD,GAAM,YAAY,GAG1DE,IAAU,CAACC,MAAgD;AAC/D,MAAI,CAACA,EAAO;AACZ,QAAMC,IAAMC,GAASF,CAAK;AAC1B,SAAOG,GAAQF,CAAG,IAAIG,GAAWH,CAAG,IAAI;AAC1C,GAEMI,KAAkB,CAACC,MAAA;;AACvB,WAAAC,IAAAC,GAA2BF,CAAI,MAA/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K,MAC7B,gBAAAiH,EAAC,SAAA,EAAkB,MAAK,UAAS,MAAMJ,GAAO,OAAA7G,EAAA,GAAlC6G,CAAgD,CAC7D;AAAA,gBAED,gBAAAI;AAAA,kBAACI;AAAA,kBAAA;AAAA,oBACC,MAAK;AAAA,oBACL,QAAO;AAAA,oBACP,MAAK;AAAA,oBACL,SAASpB,EAAO;AAAA,oBAChB,WAAU;AAAA,oBACV,eAAY;AAAA,oBAEX,UAAA7E,MAAeW,EAAE,6BAA6B;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAEjD,gBAAAkF,EAAC,KAAA,EAAE,MAAK,UAAS,WAAU,cACxB,UAAAhB,EAAO,OAAOlE,EAAE,6BAA6B,IAAI,GAAA,CACpD;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACF,EAAA,CACF,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AACApB,GAAyB,cAAc;"}
@@ -8,7 +8,7 @@ import { I as We } from "./icon-button-S8_weU3g.js";
8
8
  import { C as Qe } from "./combobox-vF9O-QoG.js";
9
9
  import { D as ce } from "./dialog-C7RWaH08.js";
10
10
  import { D as Bt } from "./date-picker-CdhXlgVI.js";
11
- import { F as H } from "./form-field-Ani72sVY.js";
11
+ import { F as H } from "./form-field-CyHfOVKF.js";
12
12
  import { I as Ft } from "./icon-button-group-CRKFR48b.js";
13
13
  import { P as Pt } from "./panel-header-CbtlTe85.js";
14
14
  import { P as Ot } from "./panel-subview-DCyvn-49.js";
@@ -1239,4 +1239,4 @@ export {
1239
1239
  vn as T,
1240
1240
  ln as t
1241
1241
  };
1242
- //# sourceMappingURL=task-editor-CRhfwP9T.js.map
1242
+ //# sourceMappingURL=task-editor-Cpw-NmND.js.map