@alfadocs/ui-kit-debug 1.46.0 → 1.47.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/booking-C4MwImkS.js +3362 -0
- package/dist/_chunks/booking-C4MwImkS.js.map +1 -0
- package/dist/_chunks/calendar-workspace-DDnQmiIL.js +12427 -0
- package/dist/_chunks/calendar-workspace-DDnQmiIL.js.map +1 -0
- package/dist/_chunks/{freemium-paywall-Cz-O9lQD.js → freemium-paywall-BaW5ODc9.js} +2 -2
- package/dist/_chunks/{freemium-paywall-Cz-O9lQD.js.map → freemium-paywall-BaW5ODc9.js.map} +1 -1
- package/dist/_chunks/{patient-details-DUj1htsH.js → patient-details-yrgkSeEY.js} +2 -2
- package/dist/_chunks/{patient-details-DUj1htsH.js.map → patient-details-yrgkSeEY.js.map} +1 -1
- package/dist/_chunks/{patient-field-row-CO0WR7yA.js → patient-field-row-DCMkFGqI.js} +2 -2
- package/dist/_chunks/{patient-field-row-CO0WR7yA.js.map → patient-field-row-DCMkFGqI.js.map} +1 -1
- package/dist/_chunks/{patient-summary-card-DNzdYjxE.js → patient-summary-card-CmEFflGS.js} +2 -2
- package/dist/_chunks/{patient-summary-card-DNzdYjxE.js.map → patient-summary-card-CmEFflGS.js.map} +1 -1
- package/dist/_chunks/payment-form-DqJFiplX.js +881 -0
- package/dist/_chunks/payment-form-DqJFiplX.js.map +1 -0
- package/dist/_chunks/{phone-input-BsZIoE36.js → phone-input-IWrGOCwm.js} +40 -39
- package/dist/_chunks/{phone-input-BsZIoE36.js.map → phone-input-IWrGOCwm.js.map} +1 -1
- package/dist/_chunks/{stepper-accordion-DmVykr5F.js → stepper-accordion-jMR8NaOB.js} +2 -1
- package/dist/_chunks/{stepper-accordion-DmVykr5F.js.map → stepper-accordion-jMR8NaOB.js.map} +1 -1
- package/dist/agent-catalog.json +5 -4
- package/dist/agent-i18n/en.json +2 -2
- package/dist/components/booking/booking-types.d.ts +60 -1
- package/dist/components/booking/booking-types.d.ts.map +1 -1
- package/dist/components/booking/booking.agent.d.ts.map +1 -1
- package/dist/components/booking/booking.d.ts +1 -1
- package/dist/components/booking/booking.d.ts.map +1 -1
- package/dist/components/booking/details-form.d.ts +5 -1
- package/dist/components/booking/details-form.d.ts.map +1 -1
- package/dist/components/booking/index.d.ts +1 -1
- package/dist/components/booking/index.d.ts.map +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/booking/payment.d.ts +9 -0
- package/dist/components/booking/payment.d.ts.map +1 -0
- package/dist/components/booking/use-booking-payment.d.ts +14 -0
- package/dist/components/booking/use-booking-payment.d.ts.map +1 -0
- package/dist/components/freemium-paywall/index.js +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-summary-card/index.js +1 -1
- package/dist/components/payment-form/index.d.ts +1 -1
- package/dist/components/payment-form/index.d.ts.map +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/payment-form/payment-form.d.ts +35 -3
- package/dist/components/payment-form/payment-form.d.ts.map +1 -1
- package/dist/components/phone-input/index.js +1 -1
- package/dist/components/phone-input/phone-input.d.ts.map +1 -1
- package/dist/components/stepper-accordion/index.js +1 -1
- package/dist/components/stepper-accordion/stepper-accordion.d.ts.map +1 -1
- package/dist/i18n/locales/ar.d.ts +36 -1
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +36 -1
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +36 -1
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +36 -1
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +36 -1
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +36 -1
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +36 -1
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +36 -1
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +36 -1
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +36 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +36 -1
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +36 -1
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +36 -1
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +36 -1
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +36 -1
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +36 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +36 -1
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +36 -1
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +36 -1
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +36 -1
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +36 -1
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +36 -1
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +36 -1
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +36 -1
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +36 -1
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +36 -1
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +36 -1
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +36 -1
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +36 -1
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +36 -1
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +36 -1
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +36 -1
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +36 -1
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +36 -1
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +36 -1
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +36 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +8 -8
- package/dist/locales/ar.json +36 -1
- package/dist/locales/de.json +36 -1
- package/dist/locales/el.json +36 -1
- package/dist/locales/en.json +36 -1
- package/dist/locales/es.json +36 -1
- package/dist/locales/fr.json +36 -1
- package/dist/locales/hi.json +36 -1
- package/dist/locales/it.json +36 -1
- package/dist/locales/ja.json +36 -1
- package/dist/locales/nl.json +36 -1
- package/dist/locales/pl.json +36 -1
- package/dist/locales/pt.json +36 -1
- package/dist/locales/ro.json +36 -1
- package/dist/locales/ru.json +36 -1
- package/dist/locales/sq.json +36 -1
- package/dist/locales/sv.json +36 -1
- package/dist/locales/tr.json +36 -1
- package/dist/locales/zh.json +36 -1
- package/dist/patterns/calendar/calendar-bookings-panel.d.ts.map +1 -1
- package/dist/patterns/calendar/calendar-editor-fields.d.ts +33 -0
- package/dist/patterns/calendar/calendar-editor-fields.d.ts.map +1 -0
- package/dist/patterns/calendar/calendar-sticky-offset.d.ts +20 -0
- package/dist/patterns/calendar/calendar-sticky-offset.d.ts.map +1 -0
- package/dist/patterns/calendar/calendar-task-editor.d.ts.map +1 -1
- package/dist/patterns/calendar/calendar-workspace.d.ts.map +1 -1
- package/dist/patterns/calendar/calendar.data.d.ts +17 -0
- package/dist/patterns/calendar/calendar.data.d.ts.map +1 -1
- package/dist/patterns/calendar/calendar.sheets.d.ts.map +1 -1
- package/dist/patterns/calendar/calendar.surface.d.ts.map +1 -1
- package/dist/patterns/calendar/calendar.types.d.ts +24 -10
- package/dist/patterns/calendar/calendar.types.d.ts.map +1 -1
- package/dist/patterns/calendar/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/booking-B7gA9gFB.js +0 -3017
- package/dist/_chunks/booking-B7gA9gFB.js.map +0 -1
- package/dist/_chunks/calendar-workspace-BB-BZT7W.js +0 -12251
- package/dist/_chunks/calendar-workspace-BB-BZT7W.js.map +0 -1
- package/dist/_chunks/payment-form-BHMDqW9C.js +0 -767
- package/dist/_chunks/payment-form-BHMDqW9C.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone-input-BsZIoE36.js","sources":["../../src/components/phone-input/phone-input.agent.ts","../../src/components/phone-input/phone-input.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — PhoneInput. */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` for the contract. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { PhoneInputHandle } from './phone-input';\n\nexport const phoneInputAgent: AgentAdapter<PhoneInputHandle> = {\n id: 'phone-input',\n // A phone number is a single form value, not free-form rich text — `set_value`\n // (not `edit_inline`, which is reserved for in-place rich/cell editing).\n capabilities: ['set_value'],\n state: {\n value: {\n type: 'string',\n descriptionKey: 'ui.agent.phoneInput.state.value',\n description:\n 'Current E.164 phone number, or empty string when not yet valid.',\n read: (handle) => handle.getValue(),\n },\n isEmpty: {\n type: 'boolean',\n descriptionKey: 'ui.agent.phoneInput.state.isEmpty',\n description: 'Whether the input has no value.',\n read: (handle) => handle.getValue() === '',\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ value: string }',\n argsSchema: {\n type: 'object',\n properties: {\n value: {\n type: 'string',\n description:\n 'Phone number in E.164 or national format; the parser infers the country.',\n },\n },\n required: ['value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.phoneInput.actions.setValue',\n description:\n 'Replace the phone number (E.164 or national format; parser will infer country).',\n examples: [\n { args: { value: '+393331234567' }, note: 'Set an Italian mobile.' },\n ],\n invoke: (handle, args: { value: string }) => {\n handle.setValue(args.value);\n },\n },\n clear: {\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.phoneInput.actions.clear',\n description: 'Empty the input. Loses any typed value.',\n invoke: (handle) => {\n handle.clear();\n },\n },\n focus: {\n safety: 'read',\n descriptionKey: 'ui.agent.phoneInput.actions.focus',\n description: 'Move keyboard focus to the phone-number input.',\n invoke: (handle) => {\n handle.focus();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'phone-input',\n description: 'Marks the PhoneInput wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n} from 'react';\nimport { useAgentRegistration } from '../../agent';\nimport { phoneInputAgent } from './phone-input.agent';\nimport { useIsomorphicLayoutEffect } from '../../hooks/use-isomorphic-layout-effect';\n\n/** Agent-readiness curated handle for PhoneInput. */\nexport interface PhoneInputHandle {\n getValue: () => string;\n setValue: (value: string) => void;\n clear: () => void;\n focus: () => void;\n}\nimport * as Popover from '@radix-ui/react-popover';\nimport { Command, defaultFilter } from 'cmdk';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { ChevronDown } from 'lucide-react';\nimport {\n AsYouType,\n getCountries,\n getCountryCallingCode,\n parsePhoneNumberFromString,\n type CountryCode,\n} from 'libphonenumber-js/min';\nimport {\n FormFieldContext,\n useFormField,\n} from '../form-field/form-field-context';\nimport { composeRefs } from '../_shared/compose-refs';\nimport { normalizeDiacritics } from '../_shared/normalize-diacritics';\nimport { Flag } from '../flag';\n\nexport interface PhoneInputChangeMeta {\n country: CountryCode;\n isValid: boolean;\n isPossible: boolean;\n type?: string;\n}\n\nexport interface PhoneInputProps {\n value?: string;\n defaultValue?: string;\n /**\n * Country pre-selected when no value is supplied. Defaults to `IT`\n * (AlfaDocs's dominant user base is Italian). Pass a different\n * `CountryCode` to override, or enable `detectBrowserCountry` to\n * derive it from the browser locale.\n */\n defaultCountry?: CountryCode;\n /**\n * When true, infer the default country from `navigator.language` /\n * `Intl.Locale` before falling back to `defaultCountry` (or `IT`).\n * Off by default — most AlfaDocs flows should stay on IT regardless\n * of the visitor's browser locale.\n */\n detectBrowserCountry?: boolean;\n onChange?: (e164: string, meta: PhoneInputChangeMeta) => void;\n size?: 'sm' | 'md' | 'lg';\n tone?: 'default' | 'error';\n disabled?: boolean;\n readOnly?: boolean;\n placeholder?: string;\n popularCountries?: CountryCode[];\n /**\n * Restrict the country picker to this set (ISO 3166-1 alpha-2 codes), in\n * the order given. Unsupported or duplicate codes are dropped; an empty /\n * all-invalid list is ignored (every country stays selectable).\n * `popularCountries` is intersected with this set. When the list resolves\n * to a single country the picker collapses to a fixed, non-interactive\n * dial code — only the national-number field stays editable.\n */\n allowedCountries?: CountryCode[];\n className?: string;\n id?: string;\n name?: string;\n required?: boolean;\n 'aria-label'?: string;\n}\n\nconst phoneInputWrapperVariants = cva(\n [\n 'ds:group ds:relative ds:inline-flex ds:items-stretch ds:w-full',\n 'ds:rounded-[var(--radius-sm)] ds:border ds:border-border ds:bg-input',\n 'ds:shadow-[var(--shadow-input)]',\n 'ds:text-foreground',\n 'ds:transition-[colors,box-shadow] ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:focus-within:outline-[length:var(--focus-ring-width)] ds:focus-within:outline-solid',\n 'ds:focus-within:outline-ring ds:focus-within:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-within:outline-[CanvasText]',\n 'ds:has-[:disabled]:cursor-not-allowed ds:has-[:disabled]:opacity-50',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:h-8 ds:text-[length:var(--font-size-sm)]',\n md: 'ds:h-[var(--min-target-size)] ds:text-[length:var(--font-size-base)]',\n lg: 'ds:h-12 ds:text-[length:var(--font-size-lg)]',\n },\n tone: {\n default: '',\n error: 'ds:border-destructive ds:focus-within:outline-destructive',\n },\n },\n defaultVariants: {\n size: 'md',\n tone: 'default',\n },\n },\n);\n\nconst countryTriggerVariants = cva(\n [\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]',\n 'ds:bg-transparent ds:text-foreground',\n 'ds:border-0 ds:border-e ds:border-e-border',\n 'ds:rounded-s-[var(--radius-sm)]',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:hover:bg-muted',\n 'ds:focus:outline-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n 'ds:disabled:cursor-not-allowed',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:ps-3 ds:pe-2',\n md: 'ds:ps-3 ds:pe-2',\n lg: 'ds:ps-4 ds:pe-3',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\nconst phoneNumberInputVariants = cva(\n [\n 'ds:flex-1 ds:min-w-0 ds:bg-transparent ds:text-foreground ds:placeholder:text-muted-foreground',\n 'ds:border-0 ds:outline-none',\n 'ds:disabled:cursor-not-allowed',\n 'ds:read-only:cursor-default',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:ps-2 ds:pe-3 ds:text-[length:var(--font-size-sm)]',\n md: 'ds:ps-2 ds:pe-3 ds:text-[length:var(--font-size-base)]',\n lg: 'ds:ps-3 ds:pe-4 ds:text-[length:var(--font-size-lg)]',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\nconst pickerContentClasses = [\n 'ds:z-[var(--z-popover)] ds:overflow-hidden ds:w-72',\n 'ds:rounded-[var(--radius-md)] ds:border ds:border-border ds:bg-background ds:text-foreground',\n 'ds:shadow-[var(--shadow-lg)]',\n 'ds:animate-in ds:fade-in ds:zoom-in-95',\n 'ds:data-[state=closed]:animate-out ds:data-[state=closed]:fade-out',\n 'ds:data-[state=closed]:zoom-out-95',\n 'ds:data-[side=bottom]:slide-in-from-top-2',\n 'ds:data-[side=top]:slide-in-from-bottom-2',\n 'ds:motion-reduce:animate-none',\n].join(' ');\n\nconst pickerSearchClasses = [\n 'ds:w-full ds:bg-transparent ds:text-foreground ds:placeholder:text-muted-foreground',\n 'ds:border-0 ds:border-b ds:border-b-border ds:outline-none',\n 'ds:ps-3 ds:pe-3 ds:py-2 ds:text-[var(--font-size-sm)]',\n 'ds:focus:outline-none',\n].join(' ');\n\nconst pickerListClasses =\n 'ds:max-h-72 ds:overflow-y-auto ds:p-[var(--spacing-xs)]';\n\nconst pickerItemClasses = [\n 'ds:relative ds:flex ds:cursor-pointer ds:items-center ds:gap-[var(--spacing-sm)]',\n 'ds:rounded-[var(--radius-sm)] ds:ps-3 ds:pe-3 ds:py-2 ds:text-[var(--font-size-sm)]',\n 'ds:text-foreground ds:outline-none ds:select-none',\n 'ds:data-[highlighted]:bg-muted ds:data-[highlighted]:text-foreground',\n 'ds:data-[highlighted]:border-s-2 ds:data-[highlighted]:border-s-primary',\n 'ds:aria-selected:bg-muted',\n].join(' ');\n\nconst pickerGroupHeadingClasses = [\n 'ds:ps-3 ds:pe-3 ds:py-1.5',\n 'type-eyebrow ds:text-muted-foreground',\n].join(' ');\n\nconst pickerEmptyClasses =\n 'ds:ps-3 ds:pe-3 ds:py-2 type-body-sm ds:text-muted-foreground';\n\nconst chevronSizeBySize = {\n sm: 'ds:size-3.5',\n md: 'ds:size-4',\n lg: 'ds:size-5',\n} as const;\n\nconst flagSizeBySize = {\n sm: 'sm',\n md: 'md',\n lg: 'lg',\n} as const satisfies Record<'sm' | 'md' | 'lg', 'sm' | 'md' | 'lg'>;\n\nfunction countDigitsBefore(str: string, position: number): number {\n let digits = 0;\n for (let i = 0; i < position && i < str.length; i++) {\n if (str[i] >= '0' && str[i] <= '9') digits++;\n }\n return digits;\n}\n\nfunction positionAfterDigits(str: string, targetDigits: number): number {\n if (targetDigits === 0) return 0;\n let count = 0;\n for (let i = 0; i < str.length; i++) {\n if (str[i] >= '0' && str[i] <= '9') {\n count++;\n if (count === targetDigits) return i + 1;\n }\n }\n return str.length;\n}\n\nfunction resolveDefaultCountry(\n explicit: CountryCode | undefined,\n supported: Set<string>,\n detectBrowser: boolean,\n locale: string,\n allowedList: CountryCode[] | null,\n): CountryCode {\n const allowed =\n allowedList && allowedList.length ? new Set<string>(allowedList) : null;\n const ok = (code: string) =>\n supported.has(code) && (!allowed || allowed.has(code));\n\n if (explicit && ok(explicit)) return explicit;\n\n if (detectBrowser) {\n const fromNavigator =\n typeof navigator !== 'undefined' ? navigator.language : undefined;\n if (fromNavigator) {\n const match = fromNavigator.match(/-([A-Za-z]{2})/);\n if (match) {\n const candidate = match[1].toUpperCase();\n if (ok(candidate)) return candidate as CountryCode;\n }\n }\n\n try {\n const region = new Intl.Locale(locale).region;\n if (region && ok(region.toUpperCase())) {\n return region.toUpperCase() as CountryCode;\n }\n } catch {\n // Intl.Locale may throw on malformed BCP-47 — fall through.\n }\n }\n\n // A restricted list with no explicit / detected hit defaults to the\n // consumer's first listed country; otherwise AlfaDocs's Italian-first\n // fallback.\n if (allowed) return allowedList![0];\n return 'IT';\n}\n\ninterface CountryRow {\n code: CountryCode;\n name: string;\n dialCode: string;\n}\n\nfunction buildCountryRows(\n locale: string,\n countries: CountryCode[],\n): CountryRow[] {\n let displayNames: Intl.DisplayNames;\n try {\n displayNames = new Intl.DisplayNames([locale], { type: 'region' });\n } catch {\n displayNames = new Intl.DisplayNames(['en'], { type: 'region' });\n }\n const rows = countries.map<CountryRow>((code) => ({\n code,\n name: displayNames.of(code) ?? code,\n dialCode: getCountryCallingCode(code),\n }));\n const collator = new Intl.Collator(locale);\n return rows.sort((a, b) => collator.compare(a.name, b.name));\n}\n\nexport const PhoneInput = forwardRef<HTMLInputElement, PhoneInputProps>(\n function PhoneInput(\n {\n value,\n defaultValue,\n defaultCountry,\n detectBrowserCountry = false,\n onChange,\n size = 'md',\n tone = 'default',\n disabled,\n readOnly,\n placeholder,\n popularCountries,\n allowedCountries,\n className,\n id,\n name,\n required,\n 'aria-label': ariaLabel,\n },\n ref,\n ) {\n const { t, i18n } = useTranslation();\n const ctx = useFormField();\n const inFormField = useContext(FormFieldContext) !== null;\n\n const supportedCountries = useMemo(\n () => new Set(getCountries() as string[]),\n [],\n );\n\n // Consumer-restricted country set, filtered to supported + deduped with\n // order preserved. `null` means \"no restriction\" (every country shown).\n const allowedList = useMemo<CountryCode[] | null>(() => {\n if (!allowedCountries || allowedCountries.length === 0) return null;\n const seen = new Set<string>();\n const filtered = allowedCountries.filter((code) => {\n if (!supportedCountries.has(code) || seen.has(code)) return false;\n seen.add(code);\n return true;\n });\n return filtered.length > 0 ? filtered : null;\n }, [allowedCountries, supportedCountries]);\n\n // A single allowed country has nothing to pick — render the dial code as a\n // fixed, non-interactive prefix instead of a one-item picker.\n const isCountryFixed = allowedList !== null && allowedList.length === 1;\n\n const initialState = useMemo(() => {\n const resolvedCountry = resolveDefaultCountry(\n defaultCountry,\n supportedCountries,\n detectBrowserCountry,\n i18n.language,\n allowedList,\n );\n const raw = value ?? defaultValue;\n if (raw) {\n const parsed = parsePhoneNumberFromString(raw);\n if (parsed?.country) {\n // Clamp the parsed country to `allowedCountries` so the rendered dial\n // code can never leave the allowed set — a single-country lock stays\n // on its country even when handed an off-set value.\n if (!allowedList || allowedList.includes(parsed.country)) {\n return {\n country: parsed.country,\n display: parsed.formatNational(),\n pinned: true,\n };\n }\n return {\n country: resolvedCountry,\n display: new AsYouType(resolvedCountry).input(\n parsed.nationalNumber,\n ),\n pinned: true,\n };\n }\n return { country: resolvedCountry, display: raw, pinned: false };\n }\n return { country: resolvedCountry, display: '', pinned: false };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const [country, setCountry] = useState<CountryCode>(initialState.country);\n const [displayValue, setDisplayValue] = useState<string>(\n initialState.display,\n );\n const [pickerOpen, setPickerOpen] = useState(false);\n const [pickerSearch, setPickerSearch] = useState('');\n\n const isControlled = value !== undefined;\n const lastEmittedRef = useRef<string>('');\n const pendingCaretRef = useRef<number | null>(null);\n // Pins the country once the user (or an incoming value) selects one,\n // so the locale-flip effect below stops re-resolving.\n const userSelectedCountryRef = useRef(initialState.pinned);\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n const composedInputRef = composeRefs(ref, inputRef);\n\n // Re-resolve the country when i18n.language flips from the bootstrap\n // fallback to the real locale on first paint, unless the user has\n // already pinned a country.\n useEffect(() => {\n if (userSelectedCountryRef.current) return;\n const next = resolveDefaultCountry(\n defaultCountry,\n supportedCountries,\n detectBrowserCountry,\n i18n.language,\n allowedList,\n );\n setCountry((prev) => (prev === next ? prev : next));\n }, [\n i18n.language,\n defaultCountry,\n supportedCountries,\n detectBrowserCountry,\n allowedList,\n ]);\n\n // Sync state back from a controlled `value` prop change that did not\n // originate from this component (e.g. parent reset). Skip the sync when\n // the incoming value matches what we just emitted.\n useEffect(() => {\n if (!isControlled) return;\n const current = value ?? '';\n if (current === lastEmittedRef.current) return;\n if (current === '') {\n setDisplayValue('');\n return;\n }\n const parsed = parsePhoneNumberFromString(current);\n if (\n parsed?.country &&\n (!allowedList || allowedList.includes(parsed.country))\n ) {\n userSelectedCountryRef.current = true;\n setCountry(parsed.country);\n setDisplayValue(parsed.formatNational());\n } else {\n // Off-set or unparseable controlled value — keep the country within the\n // allowed set; only sync the displayed digits.\n setDisplayValue(parsed ? parsed.formatNational() : current);\n }\n }, [value, isControlled, allowedList]);\n\n useIsomorphicLayoutEffect(() => {\n if (pendingCaretRef.current == null) return;\n const pos = pendingCaretRef.current;\n pendingCaretRef.current = null;\n const node = inputRef.current;\n if (node && document.activeElement === node) {\n node.setSelectionRange(pos, pos);\n }\n });\n\n const emit = useCallback(\n (nextDisplay: string, nextCountry: CountryCode) => {\n const parsed = parsePhoneNumberFromString(nextDisplay, nextCountry);\n const e164 = parsed?.number ?? '';\n lastEmittedRef.current = e164;\n onChange?.(e164, {\n country: nextCountry,\n isValid: parsed?.isValid() ?? false,\n isPossible: parsed?.isPossible() ?? false,\n type: parsed?.getType(),\n });\n },\n [onChange],\n );\n\n const inputId = id ?? (inFormField ? ctx.id : undefined);\n const effectiveDisabled =\n (inFormField ? ctx.disabled : false) || Boolean(disabled);\n const effectiveRequired =\n (inFormField ? ctx.required : false) || Boolean(required);\n const effectiveInvalid = inFormField ? ctx.invalid : false;\n const effectiveTone = effectiveInvalid ? 'error' : tone;\n const describedBy =\n inFormField && ctx.describedBy ? ctx.describedBy : undefined;\n\n const resolvedPlaceholder =\n placeholder ?? t('inputs.phone.placeholder', 'Phone number');\n\n const handleInputChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (readOnly) return;\n const target = event.target;\n const raw = target.value;\n const caret = target.selectionStart ?? raw.length;\n const digitsBefore = countDigitsBefore(raw, caret);\n\n const formatter = new AsYouType(country);\n const formatted = formatter.input(raw);\n\n pendingCaretRef.current = positionAfterDigits(formatted, digitsBefore);\n setDisplayValue(formatted);\n emit(formatted, country);\n };\n\n const lastEmittedRefForHandle = lastEmittedRef;\n const agentHandle = useMemo<PhoneInputHandle>(\n () => ({\n getValue: () => lastEmittedRefForHandle.current,\n setValue: (next) => {\n if (next === '') {\n setDisplayValue('');\n emit('', country);\n return;\n }\n const parsed = parsePhoneNumberFromString(next);\n if (parsed?.country) {\n userSelectedCountryRef.current = true;\n setCountry(parsed.country);\n setDisplayValue(parsed.formatNational());\n emit(parsed.formatNational(), parsed.country);\n } else {\n const formatter = new AsYouType(country);\n const formatted = formatter.input(next);\n setDisplayValue(formatted);\n emit(formatted, country);\n }\n },\n clear: () => {\n setDisplayValue('');\n emit('', country);\n },\n focus: () => inputRef.current?.focus(),\n }),\n [country, emit, lastEmittedRefForHandle],\n );\n useAgentRegistration(phoneInputAgent, agentHandle, id);\n\n const handleCountrySelect = (nextCountry: CountryCode) => {\n if (nextCountry === country) {\n setPickerOpen(false);\n return;\n }\n const digits = displayValue.replace(/\\D/g, '');\n const formatter = new AsYouType(nextCountry);\n const reformatted = digits ? formatter.input(digits) : '';\n userSelectedCountryRef.current = true;\n setCountry(nextCountry);\n setDisplayValue(reformatted);\n setPickerOpen(false);\n setPickerSearch('');\n emit(reformatted, nextCountry);\n requestAnimationFrame(() => {\n inputRef.current?.focus();\n });\n };\n\n const countryRows = useMemo(\n () =>\n buildCountryRows(\n i18n.language,\n allowedList ?? (Array.from(supportedCountries) as CountryCode[]),\n ),\n [i18n.language, supportedCountries, allowedList],\n );\n\n const popularRows = useMemo(() => {\n if (!popularCountries || popularCountries.length === 0) return [];\n const byCode = new Map(countryRows.map((row) => [row.code, row]));\n return popularCountries\n .filter((code): code is CountryCode => supportedCountries.has(code))\n .map((code) => byCode.get(code))\n .filter((row): row is CountryRow => Boolean(row));\n }, [popularCountries, countryRows, supportedCountries]);\n\n const popularCodes = useMemo(\n () => new Set(popularRows.map((row) => row.code)),\n [popularRows],\n );\n\n const remainingRows = useMemo(\n () =>\n popularCodes.size > 0\n ? countryRows.filter((row) => !popularCodes.has(row.code))\n : countryRows,\n [countryRows, popularCodes],\n );\n\n const selected = useMemo(\n () => countryRows.find((row) => row.code === country),\n [countryRows, country],\n );\n const selectedDialCode = selected ? selected.dialCode : '';\n const selectedName = selected ? selected.name : country;\n\n const triggerLabel = t('inputs.phone.countryPickerLabel', 'Country');\n const triggerAccessibleName = `${triggerLabel}: ${selectedName}, +${selectedDialCode}`;\n\n const filterFn = useCallback(\n (candidate: string, searchStr: string, keywords?: string[]) => {\n const normalizedCandidate = normalizeDiacritics(candidate);\n const normalizedSearch = normalizeDiacritics(searchStr);\n const normalizedKeywords = keywords?.map(normalizeDiacritics);\n return defaultFilter(\n normalizedCandidate,\n normalizedSearch,\n normalizedKeywords,\n );\n },\n [],\n );\n\n const renderRow = (row: CountryRow) => {\n const accessibleLabel = `${row.name}, +${row.dialCode}`;\n return (\n <Command.Item\n key={row.code}\n value={row.code}\n keywords={[row.name, row.dialCode, `+${row.dialCode}`]}\n onSelect={() => handleCountrySelect(row.code)}\n className={pickerItemClasses}\n aria-label={accessibleLabel}\n >\n <Flag country={row.code} size={flagSizeBySize[size]} />\n <span className=\"ds:flex-1 ds:truncate\">{row.name}</span>\n <bdi dir=\"ltr\" className=\"ds:text-muted-foreground ds:tabular-nums\">\n +{row.dialCode}\n </bdi>\n </Command.Item>\n );\n };\n\n return (\n <div\n data-component=\"phone-input\"\n data-component-id={id}\n data-slot=\"phone-input\"\n className={phoneInputWrapperVariants({\n size,\n tone: effectiveTone,\n className,\n })}\n >\n {isCountryFixed ? (\n <span\n data-slot=\"phone-country-fixed\"\n className={`${countryTriggerVariants({ size })} ds:cursor-default ds:hover:bg-transparent`}\n >\n <span className=\"ds:sr-only\">{`${triggerLabel}: ${selectedName}`}</span>\n <Flag country={country} size={flagSizeBySize[size]} />\n <bdi dir=\"ltr\" className=\"ds:tabular-nums\">\n +{selectedDialCode}\n </bdi>\n </span>\n ) : (\n <Popover.Root open={pickerOpen} onOpenChange={setPickerOpen}>\n <Popover.Trigger asChild>\n <button\n type=\"button\"\n disabled={effectiveDisabled}\n aria-haspopup=\"listbox\"\n aria-expanded={pickerOpen}\n aria-label={triggerAccessibleName}\n className={countryTriggerVariants({ size })}\n >\n <Flag country={country} size={flagSizeBySize[size]} />\n <bdi dir=\"ltr\" className=\"ds:tabular-nums\">\n +{selectedDialCode}\n </bdi>\n <ChevronDown\n aria-hidden=\"true\"\n className={[\n chevronSizeBySize[size],\n 'ds:shrink-0 ds:text-muted-foreground',\n 'ds:transition-transform ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n pickerOpen ? 'ds:rotate-180' : '',\n ].join(' ')}\n />\n </button>\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content\n sideOffset={6}\n align=\"start\"\n className={pickerContentClasses}\n >\n <Command\n filter={filterFn}\n shouldFilter\n loop\n label={triggerLabel}\n >\n <Command.Input\n asChild\n value={pickerSearch}\n onValueChange={setPickerSearch}\n >\n <input\n data-phone-country-search=\"true\"\n type=\"text\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n spellCheck={false}\n placeholder={t(\n 'inputs.phone.searchCountry',\n 'Search countries…',\n )}\n className={pickerSearchClasses}\n />\n </Command.Input>\n <Command.List className={pickerListClasses}>\n <Command.Empty className={pickerEmptyClasses}>\n {t('inputs.phone.noCountryFound', 'No country found')}\n </Command.Empty>\n {popularRows.length > 0 ? (\n <Command.Group\n heading={\n <span className={pickerGroupHeadingClasses}>\n {t('inputs.phone.popularCountries', 'Popular')}\n </span>\n }\n >\n {popularRows.map(renderRow)}\n </Command.Group>\n ) : null}\n <Command.Group\n heading={\n popularRows.length > 0 ? (\n <span className={pickerGroupHeadingClasses}>\n {t('inputs.phone.allCountries', 'All countries')}\n </span>\n ) : undefined\n }\n >\n {remainingRows.map(renderRow)}\n </Command.Group>\n </Command.List>\n </Command>\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n )}\n <input\n ref={composedInputRef}\n id={inputId}\n name={name}\n type=\"tel\"\n inputMode=\"tel\"\n autoComplete=\"tel-national\"\n value={displayValue}\n placeholder={resolvedPlaceholder}\n disabled={effectiveDisabled}\n readOnly={readOnly}\n required={effectiveRequired}\n aria-label={ariaLabel}\n aria-describedby={describedBy}\n aria-invalid={effectiveInvalid || undefined}\n onChange={handleInputChange}\n className={phoneNumberInputVariants({ size })}\n />\n </div>\n );\n },\n);\n\nPhoneInput.displayName = 'PhoneInput';\n\nexport {\n phoneInputWrapperVariants,\n countryTriggerVariants,\n phoneNumberInputVariants,\n};\n"],"names":["phoneInputAgent","handle","args","phoneInputWrapperVariants","cva","countryTriggerVariants","phoneNumberInputVariants","pickerContentClasses","pickerSearchClasses","pickerListClasses","pickerItemClasses","pickerGroupHeadingClasses","pickerEmptyClasses","chevronSizeBySize","flagSizeBySize","countDigitsBefore","str","position","digits","i","positionAfterDigits","targetDigits","count","resolveDefaultCountry","explicit","supported","detectBrowser","locale","allowedList","allowed","ok","code","fromNavigator","match","candidate","region","buildCountryRows","countries","displayNames","rows","getCountryCallingCode","collator","a","b","PhoneInput","forwardRef","value","defaultValue","defaultCountry","detectBrowserCountry","onChange","size","tone","disabled","readOnly","placeholder","popularCountries","allowedCountries","className","id","name","required","ariaLabel","ref","t","i18n","useTranslation","ctx","useFormField","inFormField","useContext","FormFieldContext","supportedCountries","useMemo","getCountries","seen","filtered","isCountryFixed","initialState","resolvedCountry","raw","parsed","parsePhoneNumberFromString","AsYouType","country","setCountry","useState","displayValue","setDisplayValue","pickerOpen","setPickerOpen","pickerSearch","setPickerSearch","isControlled","lastEmittedRef","useRef","pendingCaretRef","userSelectedCountryRef","inputRef","composedInputRef","composeRefs","useEffect","next","prev","current","useIsomorphicLayoutEffect","pos","node","emit","useCallback","nextDisplay","nextCountry","e164","inputId","effectiveDisabled","effectiveRequired","effectiveInvalid","effectiveTone","describedBy","resolvedPlaceholder","handleInputChange","event","target","caret","digitsBefore","formatted","lastEmittedRefForHandle","agentHandle","_a","useAgentRegistration","handleCountrySelect","formatter","reformatted","countryRows","popularRows","byCode","row","popularCodes","remainingRows","selected","selectedDialCode","selectedName","triggerLabel","triggerAccessibleName","filterFn","searchStr","keywords","normalizedCandidate","normalizeDiacritics","normalizedSearch","normalizedKeywords","defaultFilter","renderRow","accessibleLabel","jsxs","Command","jsx","Flag","Popover","ChevronDown"],"mappings":";;;;;;;;;;;;;;AASO,MAAMA,KAAkD;AAAA,EAC7D,IAAI;AAAA;AAAA;AAAA,EAGJ,cAAc,CAAC,WAAW;AAAA,EAC1B,OAAO;AAAA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AY,IAAIkB,EAAS;AAAA,0BAAA;AAAA,wBAAA,IAE1B;AAAA,wBACJ,gBAAAI;AAAA,0BAACD,EAAQ;AAAA,0BAAR;AAAA,4BACC,SACErB,EAAY,SAAS,IACnB,gBAAAsB,EAAC,QAAA,EAAK,WAAWjJ,IACd,UAAAqD,EAAE,6BAA6B,eAAe,EAAA,CACjD,IACE;AAAA,4BAGL,UAAA0E,GAAc,IAAIc,EAAS;AAAA,0BAAA;AAAA,wBAAA;AAAA,sBAC9B,EAAA,CACF;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA,EACF,CACF;AAAA,UAAA,GACF;AAAA,UAEF,gBAAAI;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,KAAKzD;AAAA,cACL,IAAIc;AAAA,cACJ,MAAArD;AAAA,cACA,MAAK;AAAA,cACL,WAAU;AAAA,cACV,cAAa;AAAA,cACb,OAAO2B;AAAA,cACP,aAAagC;AAAA,cACb,UAAUL;AAAA,cACV,UAAA5D;AAAA,cACA,UAAU6D;AAAA,cACV,cAAYrD;AAAA,cACZ,oBAAkBwD;AAAA,cAClB,gBAAcF,MAAoB;AAAA,cAClC,UAAUI;AAAA,cACV,WAAWlH,GAAyB,EAAE,MAAA6C,EAAA,CAAM;AAAA,YAAA;AAAA,UAAA;AAAA,QAC9C;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEAP,GAAW,cAAc;"}
|
|
1
|
+
{"version":3,"file":"phone-input-IWrGOCwm.js","sources":["../../src/components/phone-input/phone-input.agent.ts","../../src/components/phone-input/phone-input.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — PhoneInput. */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` for the contract. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { PhoneInputHandle } from './phone-input';\n\nexport const phoneInputAgent: AgentAdapter<PhoneInputHandle> = {\n id: 'phone-input',\n // A phone number is a single form value, not free-form rich text — `set_value`\n // (not `edit_inline`, which is reserved for in-place rich/cell editing).\n capabilities: ['set_value'],\n state: {\n value: {\n type: 'string',\n descriptionKey: 'ui.agent.phoneInput.state.value',\n description:\n 'Current E.164 phone number, or empty string when not yet valid.',\n read: (handle) => handle.getValue(),\n },\n isEmpty: {\n type: 'boolean',\n descriptionKey: 'ui.agent.phoneInput.state.isEmpty',\n description: 'Whether the input has no value.',\n read: (handle) => handle.getValue() === '',\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ value: string }',\n argsSchema: {\n type: 'object',\n properties: {\n value: {\n type: 'string',\n description:\n 'Phone number in E.164 or national format; the parser infers the country.',\n },\n },\n required: ['value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.phoneInput.actions.setValue',\n description:\n 'Replace the phone number (E.164 or national format; parser will infer country).',\n examples: [\n { args: { value: '+393331234567' }, note: 'Set an Italian mobile.' },\n ],\n invoke: (handle, args: { value: string }) => {\n handle.setValue(args.value);\n },\n },\n clear: {\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.phoneInput.actions.clear',\n description: 'Empty the input. Loses any typed value.',\n invoke: (handle) => {\n handle.clear();\n },\n },\n focus: {\n safety: 'read',\n descriptionKey: 'ui.agent.phoneInput.actions.focus',\n description: 'Move keyboard focus to the phone-number input.',\n invoke: (handle) => {\n handle.focus();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'phone-input',\n description: 'Marks the PhoneInput wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n} from 'react';\nimport { useAgentRegistration } from '../../agent';\nimport { phoneInputAgent } from './phone-input.agent';\nimport { useIsomorphicLayoutEffect } from '../../hooks/use-isomorphic-layout-effect';\n\n/** Agent-readiness curated handle for PhoneInput. */\nexport interface PhoneInputHandle {\n getValue: () => string;\n setValue: (value: string) => void;\n clear: () => void;\n focus: () => void;\n}\nimport * as Popover from '@radix-ui/react-popover';\nimport { Command, defaultFilter } from 'cmdk';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { ChevronDown } from 'lucide-react';\nimport {\n AsYouType,\n getCountries,\n getCountryCallingCode,\n parsePhoneNumberFromString,\n type CountryCode,\n} from 'libphonenumber-js/min';\nimport {\n FormFieldContext,\n useFormField,\n} from '../form-field/form-field-context';\nimport { composeRefs } from '../_shared/compose-refs';\nimport { normalizeDiacritics } from '../_shared/normalize-diacritics';\nimport { Flag } from '../flag';\n\nexport interface PhoneInputChangeMeta {\n country: CountryCode;\n isValid: boolean;\n isPossible: boolean;\n type?: string;\n}\n\nexport interface PhoneInputProps {\n value?: string;\n defaultValue?: string;\n /**\n * Country pre-selected when no value is supplied. Defaults to `IT`\n * (AlfaDocs's dominant user base is Italian). Pass a different\n * `CountryCode` to override, or enable `detectBrowserCountry` to\n * derive it from the browser locale.\n */\n defaultCountry?: CountryCode;\n /**\n * When true, infer the default country from `navigator.language` /\n * `Intl.Locale` before falling back to `defaultCountry` (or `IT`).\n * Off by default — most AlfaDocs flows should stay on IT regardless\n * of the visitor's browser locale.\n */\n detectBrowserCountry?: boolean;\n onChange?: (e164: string, meta: PhoneInputChangeMeta) => void;\n size?: 'sm' | 'md' | 'lg';\n tone?: 'default' | 'error';\n disabled?: boolean;\n readOnly?: boolean;\n placeholder?: string;\n popularCountries?: CountryCode[];\n /**\n * Restrict the country picker to this set (ISO 3166-1 alpha-2 codes), in\n * the order given. Unsupported or duplicate codes are dropped; an empty /\n * all-invalid list is ignored (every country stays selectable).\n * `popularCountries` is intersected with this set. When the list resolves\n * to a single country the picker collapses to a fixed, non-interactive\n * dial code — only the national-number field stays editable.\n */\n allowedCountries?: CountryCode[];\n className?: string;\n id?: string;\n name?: string;\n required?: boolean;\n 'aria-label'?: string;\n}\n\nconst phoneInputWrapperVariants = cva(\n [\n 'ds:group ds:relative ds:inline-flex ds:items-stretch ds:w-full',\n 'ds:rounded-[var(--radius-sm)] ds:border ds:border-border ds:bg-input',\n 'ds:shadow-[var(--shadow-input)]',\n 'ds:text-foreground',\n 'ds:transition-[colors,box-shadow] ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:focus-within:outline-[length:var(--focus-ring-width)] ds:focus-within:outline-solid',\n 'ds:focus-within:outline-ring ds:focus-within:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-within:outline-[CanvasText]',\n 'ds:has-[:disabled]:cursor-not-allowed ds:has-[:disabled]:opacity-50',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:h-8 ds:text-[length:var(--font-size-sm)]',\n md: 'ds:h-[var(--min-target-size)] ds:text-[length:var(--font-size-base)]',\n lg: 'ds:h-12 ds:text-[length:var(--font-size-lg)]',\n },\n tone: {\n default: '',\n error: 'ds:border-destructive ds:focus-within:outline-destructive',\n },\n },\n defaultVariants: {\n size: 'md',\n tone: 'default',\n },\n },\n);\n\nconst countryTriggerVariants = cva(\n [\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]',\n 'ds:bg-transparent ds:text-foreground',\n 'ds:border-0 ds:border-e ds:border-e-border',\n 'ds:rounded-s-[var(--radius-sm)]',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:hover:bg-muted',\n 'ds:focus:outline-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n 'ds:disabled:cursor-not-allowed',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:ps-3 ds:pe-2',\n md: 'ds:ps-3 ds:pe-2',\n lg: 'ds:ps-4 ds:pe-3',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\nconst phoneNumberInputVariants = cva(\n [\n 'ds:flex-1 ds:min-w-0 ds:bg-transparent ds:text-foreground ds:placeholder:text-muted-foreground',\n 'ds:border-0 ds:outline-none',\n 'ds:disabled:cursor-not-allowed',\n 'ds:read-only:cursor-default',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:ps-2 ds:pe-3 ds:text-[length:var(--font-size-sm)]',\n md: 'ds:ps-2 ds:pe-3 ds:text-[length:var(--font-size-base)]',\n lg: 'ds:ps-3 ds:pe-4 ds:text-[length:var(--font-size-lg)]',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\nconst pickerContentClasses = [\n 'ds:z-[var(--z-popover)] ds:overflow-hidden ds:w-72',\n 'ds:rounded-[var(--radius-md)] ds:border ds:border-border ds:bg-background ds:text-foreground',\n 'ds:shadow-[var(--shadow-lg)]',\n 'ds:animate-in ds:fade-in ds:zoom-in-95',\n 'ds:data-[state=closed]:animate-out ds:data-[state=closed]:fade-out',\n 'ds:data-[state=closed]:zoom-out-95',\n 'ds:data-[side=bottom]:slide-in-from-top-2',\n 'ds:data-[side=top]:slide-in-from-bottom-2',\n 'ds:motion-reduce:animate-none',\n].join(' ');\n\nconst pickerSearchClasses = [\n 'ds:w-full ds:bg-transparent ds:text-foreground ds:placeholder:text-muted-foreground',\n 'ds:border-0 ds:border-b ds:border-b-border ds:outline-none',\n 'ds:ps-3 ds:pe-3 ds:py-2 ds:text-[var(--font-size-sm)]',\n 'ds:focus:outline-none',\n].join(' ');\n\nconst pickerListClasses =\n 'ds:max-h-72 ds:overflow-y-auto ds:p-[var(--spacing-xs)]';\n\nconst pickerItemClasses = [\n 'ds:relative ds:flex ds:cursor-pointer ds:items-center ds:gap-[var(--spacing-sm)]',\n 'ds:rounded-[var(--radius-sm)] ds:ps-3 ds:pe-3 ds:py-2 ds:text-[var(--font-size-sm)]',\n 'ds:text-foreground ds:outline-none ds:select-none',\n 'ds:data-[highlighted]:bg-muted ds:data-[highlighted]:text-foreground',\n 'ds:data-[highlighted]:border-s-2 ds:data-[highlighted]:border-s-primary',\n 'ds:aria-selected:bg-muted',\n].join(' ');\n\nconst pickerGroupHeadingClasses = [\n 'ds:ps-3 ds:pe-3 ds:py-1.5',\n 'type-eyebrow ds:text-muted-foreground',\n].join(' ');\n\nconst pickerEmptyClasses =\n 'ds:ps-3 ds:pe-3 ds:py-2 type-body-sm ds:text-muted-foreground';\n\nconst chevronSizeBySize = {\n sm: 'ds:size-3.5',\n md: 'ds:size-4',\n lg: 'ds:size-5',\n} as const;\n\nconst flagSizeBySize = {\n sm: 'sm',\n md: 'md',\n lg: 'lg',\n} as const satisfies Record<'sm' | 'md' | 'lg', 'sm' | 'md' | 'lg'>;\n\nfunction countDigitsBefore(str: string, position: number): number {\n let digits = 0;\n for (let i = 0; i < position && i < str.length; i++) {\n if (str[i] >= '0' && str[i] <= '9') digits++;\n }\n return digits;\n}\n\nfunction positionAfterDigits(str: string, targetDigits: number): number {\n if (targetDigits === 0) return 0;\n let count = 0;\n for (let i = 0; i < str.length; i++) {\n if (str[i] >= '0' && str[i] <= '9') {\n count++;\n if (count === targetDigits) return i + 1;\n }\n }\n return str.length;\n}\n\nfunction resolveDefaultCountry(\n explicit: CountryCode | undefined,\n supported: Set<string>,\n detectBrowser: boolean,\n locale: string,\n allowedList: CountryCode[] | null,\n): CountryCode {\n const allowed =\n allowedList && allowedList.length ? new Set<string>(allowedList) : null;\n const ok = (code: string) =>\n supported.has(code) && (!allowed || allowed.has(code));\n\n if (explicit && ok(explicit)) return explicit;\n\n if (detectBrowser) {\n const fromNavigator =\n typeof navigator !== 'undefined' ? navigator.language : undefined;\n if (fromNavigator) {\n const match = fromNavigator.match(/-([A-Za-z]{2})/);\n if (match) {\n const candidate = match[1].toUpperCase();\n if (ok(candidate)) return candidate as CountryCode;\n }\n }\n\n try {\n const region = new Intl.Locale(locale).region;\n if (region && ok(region.toUpperCase())) {\n return region.toUpperCase() as CountryCode;\n }\n } catch {\n // Intl.Locale may throw on malformed BCP-47 — fall through.\n }\n }\n\n // A restricted list with no explicit / detected hit defaults to the\n // consumer's first listed country; otherwise AlfaDocs's Italian-first\n // fallback.\n if (allowed) return allowedList![0];\n return 'IT';\n}\n\ninterface CountryRow {\n code: CountryCode;\n name: string;\n dialCode: string;\n}\n\nfunction buildCountryRows(\n locale: string,\n countries: CountryCode[],\n): CountryRow[] {\n let displayNames: Intl.DisplayNames;\n try {\n displayNames = new Intl.DisplayNames([locale], { type: 'region' });\n } catch {\n displayNames = new Intl.DisplayNames(['en'], { type: 'region' });\n }\n const rows = countries.map<CountryRow>((code) => ({\n code,\n name: displayNames.of(code) ?? code,\n dialCode: getCountryCallingCode(code),\n }));\n const collator = new Intl.Collator(locale);\n return rows.sort((a, b) => collator.compare(a.name, b.name));\n}\n\nexport const PhoneInput = forwardRef<HTMLInputElement, PhoneInputProps>(\n function PhoneInput(\n {\n value,\n defaultValue,\n defaultCountry,\n detectBrowserCountry = false,\n onChange,\n size = 'md',\n tone = 'default',\n disabled,\n readOnly,\n placeholder,\n popularCountries,\n allowedCountries,\n className,\n id,\n name,\n required,\n 'aria-label': ariaLabel,\n },\n ref,\n ) {\n const { t, i18n } = useTranslation();\n const ctx = useFormField();\n const inFormField = useContext(FormFieldContext) !== null;\n\n const supportedCountries = useMemo(\n () => new Set(getCountries() as string[]),\n [],\n );\n\n // Consumer-restricted country set, filtered to supported + deduped with\n // order preserved. `null` means \"no restriction\" (every country shown).\n const allowedList = useMemo<CountryCode[] | null>(() => {\n if (!allowedCountries || allowedCountries.length === 0) return null;\n const seen = new Set<string>();\n const filtered = allowedCountries.filter((code) => {\n if (!supportedCountries.has(code) || seen.has(code)) return false;\n seen.add(code);\n return true;\n });\n return filtered.length > 0 ? filtered : null;\n }, [allowedCountries, supportedCountries]);\n\n // A single allowed country has nothing to pick — render the dial code as a\n // fixed, non-interactive prefix instead of a one-item picker.\n const isCountryFixed = allowedList !== null && allowedList.length === 1;\n\n const initialState = useMemo(() => {\n const resolvedCountry = resolveDefaultCountry(\n defaultCountry,\n supportedCountries,\n detectBrowserCountry,\n i18n.language,\n allowedList,\n );\n const raw = value ?? defaultValue;\n if (raw) {\n const parsed = parsePhoneNumberFromString(raw);\n if (parsed?.country) {\n // Clamp the parsed country to `allowedCountries` so the rendered dial\n // code can never leave the allowed set — a single-country lock stays\n // on its country even when handed an off-set value.\n if (!allowedList || allowedList.includes(parsed.country)) {\n return {\n country: parsed.country,\n display: parsed.formatNational(),\n pinned: true,\n };\n }\n return {\n country: resolvedCountry,\n display: new AsYouType(resolvedCountry).input(\n parsed.nationalNumber,\n ),\n pinned: true,\n };\n }\n return { country: resolvedCountry, display: raw, pinned: false };\n }\n return { country: resolvedCountry, display: '', pinned: false };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const [country, setCountry] = useState<CountryCode>(initialState.country);\n const [displayValue, setDisplayValue] = useState<string>(\n initialState.display,\n );\n const [pickerOpen, setPickerOpen] = useState(false);\n const [pickerSearch, setPickerSearch] = useState('');\n\n const isControlled = value !== undefined;\n const lastEmittedRef = useRef<string>('');\n const pendingCaretRef = useRef<number | null>(null);\n // Pins the country once the user (or an incoming value) selects one,\n // so the locale-flip effect below stops re-resolving.\n const userSelectedCountryRef = useRef(initialState.pinned);\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n const composedInputRef = composeRefs(ref, inputRef);\n\n // Re-resolve the country when i18n.language flips from the bootstrap\n // fallback to the real locale on first paint, unless the user has\n // already pinned a country.\n useEffect(() => {\n if (userSelectedCountryRef.current) return;\n const next = resolveDefaultCountry(\n defaultCountry,\n supportedCountries,\n detectBrowserCountry,\n i18n.language,\n allowedList,\n );\n setCountry((prev) => (prev === next ? prev : next));\n }, [\n i18n.language,\n defaultCountry,\n supportedCountries,\n detectBrowserCountry,\n allowedList,\n ]);\n\n // Sync state back from a controlled `value` prop change that did not\n // originate from this component (e.g. parent reset). Skip the sync when\n // the incoming value matches what we just emitted.\n useEffect(() => {\n if (!isControlled) return;\n const current = value ?? '';\n if (current === lastEmittedRef.current) return;\n if (current === '') {\n setDisplayValue('');\n return;\n }\n const parsed = parsePhoneNumberFromString(current);\n if (\n parsed?.country &&\n (!allowedList || allowedList.includes(parsed.country))\n ) {\n userSelectedCountryRef.current = true;\n setCountry(parsed.country);\n setDisplayValue(parsed.formatNational());\n } else {\n // Off-set or unparseable controlled value — keep the country within the\n // allowed set; only sync the displayed digits.\n setDisplayValue(parsed ? parsed.formatNational() : current);\n }\n }, [value, isControlled, allowedList]);\n\n useIsomorphicLayoutEffect(() => {\n if (pendingCaretRef.current == null) return;\n const pos = pendingCaretRef.current;\n pendingCaretRef.current = null;\n const node = inputRef.current;\n if (node && document.activeElement === node) {\n node.setSelectionRange(pos, pos);\n }\n });\n\n const emit = useCallback(\n (nextDisplay: string, nextCountry: CountryCode) => {\n const parsed = parsePhoneNumberFromString(nextDisplay, nextCountry);\n const e164 = parsed?.number ?? '';\n lastEmittedRef.current = e164;\n onChange?.(e164, {\n country: nextCountry,\n isValid: parsed?.isValid() ?? false,\n isPossible: parsed?.isPossible() ?? false,\n type: parsed?.getType(),\n });\n },\n [onChange],\n );\n\n const inputId = id ?? (inFormField ? ctx.id : undefined);\n const effectiveDisabled =\n (inFormField ? ctx.disabled : false) || Boolean(disabled);\n const effectiveRequired =\n (inFormField ? ctx.required : false) || Boolean(required);\n const effectiveInvalid = inFormField ? ctx.invalid : false;\n const effectiveTone = effectiveInvalid ? 'error' : tone;\n const describedBy =\n inFormField && ctx.describedBy ? ctx.describedBy : undefined;\n\n const resolvedPlaceholder =\n placeholder ?? t('inputs.phone.placeholder', 'Phone number');\n\n const handleInputChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (readOnly) return;\n const target = event.target;\n const raw = target.value;\n const caret = target.selectionStart ?? raw.length;\n const digitsBefore = countDigitsBefore(raw, caret);\n\n const formatter = new AsYouType(country);\n const formatted = formatter.input(raw);\n\n pendingCaretRef.current = positionAfterDigits(formatted, digitsBefore);\n setDisplayValue(formatted);\n emit(formatted, country);\n };\n\n const lastEmittedRefForHandle = lastEmittedRef;\n const agentHandle = useMemo<PhoneInputHandle>(\n () => ({\n getValue: () => lastEmittedRefForHandle.current,\n setValue: (next) => {\n if (next === '') {\n setDisplayValue('');\n emit('', country);\n return;\n }\n const parsed = parsePhoneNumberFromString(next);\n if (parsed?.country) {\n userSelectedCountryRef.current = true;\n setCountry(parsed.country);\n setDisplayValue(parsed.formatNational());\n emit(parsed.formatNational(), parsed.country);\n } else {\n const formatter = new AsYouType(country);\n const formatted = formatter.input(next);\n setDisplayValue(formatted);\n emit(formatted, country);\n }\n },\n clear: () => {\n setDisplayValue('');\n emit('', country);\n },\n focus: () => inputRef.current?.focus(),\n }),\n [country, emit, lastEmittedRefForHandle],\n );\n useAgentRegistration(phoneInputAgent, agentHandle, id);\n\n const handleCountrySelect = (nextCountry: CountryCode) => {\n if (nextCountry === country) {\n setPickerOpen(false);\n return;\n }\n const digits = displayValue.replace(/\\D/g, '');\n const formatter = new AsYouType(nextCountry);\n const reformatted = digits ? formatter.input(digits) : '';\n userSelectedCountryRef.current = true;\n setCountry(nextCountry);\n setDisplayValue(reformatted);\n setPickerOpen(false);\n setPickerSearch('');\n emit(reformatted, nextCountry);\n requestAnimationFrame(() => {\n inputRef.current?.focus();\n });\n };\n\n const countryRows = useMemo(\n () =>\n buildCountryRows(\n i18n.language,\n allowedList ?? (Array.from(supportedCountries) as CountryCode[]),\n ),\n [i18n.language, supportedCountries, allowedList],\n );\n\n const popularRows = useMemo(() => {\n if (!popularCountries || popularCountries.length === 0) return [];\n const byCode = new Map(countryRows.map((row) => [row.code, row]));\n return popularCountries\n .filter((code): code is CountryCode => supportedCountries.has(code))\n .map((code) => byCode.get(code))\n .filter((row): row is CountryRow => Boolean(row));\n }, [popularCountries, countryRows, supportedCountries]);\n\n const popularCodes = useMemo(\n () => new Set(popularRows.map((row) => row.code)),\n [popularRows],\n );\n\n const remainingRows = useMemo(\n () =>\n popularCodes.size > 0\n ? countryRows.filter((row) => !popularCodes.has(row.code))\n : countryRows,\n [countryRows, popularCodes],\n );\n\n const selected = useMemo(\n () => countryRows.find((row) => row.code === country),\n [countryRows, country],\n );\n const selectedDialCode = selected ? selected.dialCode : '';\n const selectedName = selected ? selected.name : country;\n\n const triggerLabel = t('inputs.phone.countryPickerLabel', 'Country');\n const triggerAccessibleName = `${triggerLabel}: ${selectedName}, +${selectedDialCode}`;\n\n const filterFn = useCallback(\n (candidate: string, searchStr: string, keywords?: string[]) => {\n const normalizedCandidate = normalizeDiacritics(candidate);\n const normalizedSearch = normalizeDiacritics(searchStr);\n const normalizedKeywords = keywords?.map(normalizeDiacritics);\n return defaultFilter(\n normalizedCandidate,\n normalizedSearch,\n normalizedKeywords,\n );\n },\n [],\n );\n\n const renderRow = (row: CountryRow) => {\n const accessibleLabel = `${row.name}, +${row.dialCode}`;\n return (\n <Command.Item\n key={row.code}\n value={row.code}\n keywords={[row.name, row.dialCode, `+${row.dialCode}`]}\n onSelect={() => handleCountrySelect(row.code)}\n className={pickerItemClasses}\n aria-label={accessibleLabel}\n >\n <Flag country={row.code} size={flagSizeBySize[size]} />\n <span className=\"ds:flex-1 ds:truncate\">{row.name}</span>\n <bdi dir=\"ltr\" className=\"ds:text-muted-foreground ds:tabular-nums\">\n +{row.dialCode}\n </bdi>\n </Command.Item>\n );\n };\n\n return (\n <div\n data-component=\"phone-input\"\n data-component-id={id}\n data-slot=\"phone-input\"\n className={phoneInputWrapperVariants({\n size,\n tone: effectiveTone,\n className,\n })}\n >\n {isCountryFixed ? (\n <span\n data-slot=\"phone-country-fixed\"\n className={`${countryTriggerVariants({ size })} ds:cursor-default ds:hover:bg-transparent`}\n >\n <span className=\"ds:sr-only\">{`${triggerLabel}: ${selectedName}`}</span>\n <Flag country={country} size={flagSizeBySize[size]} />\n <bdi dir=\"ltr\" className=\"ds:tabular-nums\">\n +{selectedDialCode}\n </bdi>\n </span>\n ) : (\n <Popover.Root open={pickerOpen} onOpenChange={setPickerOpen}>\n <Popover.Trigger asChild>\n <button\n type=\"button\"\n disabled={effectiveDisabled}\n aria-haspopup=\"listbox\"\n aria-expanded={pickerOpen}\n aria-label={triggerAccessibleName}\n className={countryTriggerVariants({ size })}\n >\n <Flag country={country} size={flagSizeBySize[size]} />\n <bdi dir=\"ltr\" className=\"ds:tabular-nums\">\n +{selectedDialCode}\n </bdi>\n <ChevronDown\n aria-hidden=\"true\"\n className={[\n chevronSizeBySize[size],\n 'ds:shrink-0 ds:text-muted-foreground',\n 'ds:transition-transform ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n pickerOpen ? 'ds:rotate-180' : '',\n ].join(' ')}\n />\n </button>\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content\n sideOffset={6}\n align=\"start\"\n // Radix gives the content role=\"dialog\" with no name.\n aria-label={triggerLabel}\n className={pickerContentClasses}\n >\n <Command\n filter={filterFn}\n shouldFilter\n loop\n label={triggerLabel}\n >\n <Command.Input\n asChild\n value={pickerSearch}\n onValueChange={setPickerSearch}\n >\n <input\n data-phone-country-search=\"true\"\n type=\"text\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n spellCheck={false}\n placeholder={t(\n 'inputs.phone.searchCountry',\n 'Search countries…',\n )}\n className={pickerSearchClasses}\n />\n </Command.Input>\n <Command.List className={pickerListClasses}>\n <Command.Empty className={pickerEmptyClasses}>\n {t('inputs.phone.noCountryFound', 'No country found')}\n </Command.Empty>\n {popularRows.length > 0 ? (\n <Command.Group\n heading={\n <span className={pickerGroupHeadingClasses}>\n {t('inputs.phone.popularCountries', 'Popular')}\n </span>\n }\n >\n {popularRows.map(renderRow)}\n </Command.Group>\n ) : null}\n <Command.Group\n heading={\n popularRows.length > 0 ? (\n <span className={pickerGroupHeadingClasses}>\n {t('inputs.phone.allCountries', 'All countries')}\n </span>\n ) : undefined\n }\n >\n {remainingRows.map(renderRow)}\n </Command.Group>\n </Command.List>\n </Command>\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n )}\n <input\n ref={composedInputRef}\n id={inputId}\n name={name}\n type=\"tel\"\n inputMode=\"tel\"\n autoComplete=\"tel-national\"\n value={displayValue}\n placeholder={resolvedPlaceholder}\n disabled={effectiveDisabled}\n readOnly={readOnly}\n required={effectiveRequired}\n aria-label={ariaLabel}\n aria-describedby={describedBy}\n aria-invalid={effectiveInvalid || undefined}\n onChange={handleInputChange}\n className={phoneNumberInputVariants({ size })}\n />\n </div>\n );\n },\n);\n\nPhoneInput.displayName = 'PhoneInput';\n\nexport {\n phoneInputWrapperVariants,\n countryTriggerVariants,\n phoneNumberInputVariants,\n};\n"],"names":["phoneInputAgent","handle","args","phoneInputWrapperVariants","cva","countryTriggerVariants","phoneNumberInputVariants","pickerContentClasses","pickerSearchClasses","pickerListClasses","pickerItemClasses","pickerGroupHeadingClasses","pickerEmptyClasses","chevronSizeBySize","flagSizeBySize","countDigitsBefore","str","position","digits","i","positionAfterDigits","targetDigits","count","resolveDefaultCountry","explicit","supported","detectBrowser","locale","allowedList","allowed","ok","code","fromNavigator","match","candidate","region","buildCountryRows","countries","displayNames","rows","getCountryCallingCode","collator","a","b","PhoneInput","forwardRef","value","defaultValue","defaultCountry","detectBrowserCountry","onChange","size","tone","disabled","readOnly","placeholder","popularCountries","allowedCountries","className","id","name","required","ariaLabel","ref","t","i18n","useTranslation","ctx","useFormField","inFormField","useContext","FormFieldContext","supportedCountries","useMemo","getCountries","seen","filtered","isCountryFixed","initialState","resolvedCountry","raw","parsed","parsePhoneNumberFromString","AsYouType","country","setCountry","useState","displayValue","setDisplayValue","pickerOpen","setPickerOpen","pickerSearch","setPickerSearch","isControlled","lastEmittedRef","useRef","pendingCaretRef","userSelectedCountryRef","inputRef","composedInputRef","composeRefs","useEffect","next","prev","current","useIsomorphicLayoutEffect","pos","node","emit","useCallback","nextDisplay","nextCountry","e164","inputId","effectiveDisabled","effectiveRequired","effectiveInvalid","effectiveTone","describedBy","resolvedPlaceholder","handleInputChange","event","target","caret","digitsBefore","formatted","lastEmittedRefForHandle","agentHandle","_a","useAgentRegistration","handleCountrySelect","formatter","reformatted","countryRows","popularRows","byCode","row","popularCodes","remainingRows","selected","selectedDialCode","selectedName","triggerLabel","triggerAccessibleName","filterFn","searchStr","keywords","normalizedCandidate","normalizeDiacritics","normalizedSearch","normalizedKeywords","defaultFilter","renderRow","accessibleLabel","jsxs","Command","jsx","Flag","Popover","ChevronDown"],"mappings":";;;;;;;;;;;;;;AASO,MAAMA,KAAkD;AAAA,EAC7D,IAAI;AAAA;AAAA;AAAA,EAGJ,cAAc,CAAC,WAAW;AAAA,EAC1B,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,SAAS;AAAA,MACP,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,eAAe;AAAA,IAAA;AAAA,EAC1C;AAAA,EAEF,SAAS;AAAA,IACP,WAAW;AAAA,MACT,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,OAAO;AAAA,YACL,MAAM;AAAA,YACN,aACE;AAAA,UAAA;AAAA,QACJ;AAAA,QAEF,UAAU,CAAC,OAAO;AAAA,MAAA;AAAA,MAEpB,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,UAAU;AAAA,QACR,EAAE,MAAM,EAAE,OAAO,gBAAA,GAAmB,MAAM,yBAAA;AAAA,MAAyB;AAAA,MAErE,QAAQ,CAACA,GAAQC,MAA4B;AAC3C,QAAAD,EAAO,SAASC,EAAK,KAAK;AAAA,MAC5B;AAAA,IAAA;AAAA,IAEF,OAAO;AAAA,MACL,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;A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AAA;AAAA,QAC9C;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEAP,GAAW,cAAc;"}
|
|
@@ -176,6 +176,7 @@ const K = [
|
|
|
176
176
|
value: w(n),
|
|
177
177
|
onValueChange: I,
|
|
178
178
|
collapsible: !1,
|
|
179
|
+
role: "group",
|
|
179
180
|
"aria-label": V,
|
|
180
181
|
id: x,
|
|
181
182
|
"data-component": "stepper-accordion",
|
|
@@ -247,4 +248,4 @@ oe.displayName = "StepperAccordion";
|
|
|
247
248
|
export {
|
|
248
249
|
oe as S
|
|
249
250
|
};
|
|
250
|
-
//# sourceMappingURL=stepper-accordion-
|
|
251
|
+
//# sourceMappingURL=stepper-accordion-jMR8NaOB.js.map
|
package/dist/_chunks/{stepper-accordion-DmVykr5F.js.map → stepper-accordion-jMR8NaOB.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stepper-accordion-DmVykr5F.js","sources":["../../src/components/_shared/stepper.ts","../../src/components/stepper-accordion/stepper-accordion.tsx"],"sourcesContent":["// Shared types + state machine for the two stepper variants:\n// - src/components/stepper-progress (lightweight progress bar + caption)\n// - src/components/stepper-accordion (vertical disclosure wizard)\n//\n// Both components consume `StepSpec` and the `stateForStep` helper so the\n// four-state machine (upcoming | current | completed | error) stays in one\n// place. Rename or removal is a MAJOR per src/docs/13-maintainability.mdx.\n\n/**\n * Consumer-supplied override for a step.\n *\n * - `completed` — the step holds a value; render the tick and let the user\n * back in to change it.\n * - `error` — the step's own validation failed; always wins.\n * - `unlocked` (1.11.0) — the step has been *reached* but holds no value of\n * its own. It renders exactly like an upcoming step, but the user may open\n * it. Added for flows whose final step can never report itself \"completed\"\n * because its validity belongs to a form inside it: without this, moving\n * the cursor backwards left that step HTML-`disabled` and unreachable.\n *\n * `'completed'` and `'error'` behave exactly as before, so consumers passing\n * either (or nothing) are unaffected. A consumer that reads this union back\n * in an exhaustive `switch` needs a case for `'unlocked'`; `StepState` — the\n * union such a switch usually runs on — is deliberately untouched.\n */\nexport type StepStatus = 'completed' | 'error' | 'unlocked';\n\nexport type StepState = 'upcoming' | 'current' | 'completed' | 'error';\n\nexport interface StepSpec {\n /** Visible step label — comes from the consumer, already translated. */\n label: string;\n /** Optional secondary line (kept short; shown in accordion + progress captions). */\n description?: string;\n /**\n * Consumer-explicit status override. `error` always wins; `completed` is\n * honoured only for steps at or beyond the active index so the active step\n * always keeps `current` (otherwise a consumer pre-setting `completed` on\n * every step would silently mask the current position). `unlocked` changes\n * reachability only — see `stepIsReachable` — and never the rendered state.\n */\n status?: StepStatus;\n}\n\nexport function stateForStep(\n index: number,\n activeStep: number,\n status?: StepStatus,\n): StepState {\n if (status === 'error') return 'error';\n if (index === activeStep) return 'current';\n if (status === 'completed') return 'completed';\n if (index < activeStep) return 'completed';\n // `unlocked` deliberately falls through: it is a reachability hint, not a\n // visual state, so the returned `StepState` union is unchanged and any\n // exhaustive switch a consumer already wrote keeps compiling.\n return 'upcoming';\n}\n\n/**\n * May the user open this step?\n *\n * Everything at or before the cursor is reachable, as is any step the\n * consumer has explicitly marked `completed`, `error` or `unlocked`.\n * Steps ahead of the cursor with no status stay locked, exactly as before.\n */\nexport function stepIsReachable(\n index: number,\n activeStep: number,\n status?: StepStatus,\n): boolean {\n if (status !== undefined) return true;\n return index <= activeStep;\n}\n","import {\n forwardRef,\n useImperativeHandle,\n useMemo,\n type ComponentPropsWithoutRef,\n type ReactNode,\n} from 'react';\nimport * as AccordionPrimitive from '@radix-ui/react-accordion';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { ChevronDown, Lock } from 'lucide-react';\nimport { useTranslation } from 'react-i18next';\nimport {\n stateForStep,\n stepIsReachable,\n type StepSpec,\n type StepState,\n} from '../_shared/stepper';\n\n/* -------------------------------------------------------------------- */\n/* StepperAccordion */\n/* */\n/* Vertical disclosure wizard. The current step is expanded inline; */\n/* completed steps collapse to a one-line summary with an \"Edit\" hint */\n/* that re-opens them; upcoming steps are locked. Built on Radix */\n/* Accordion in controlled-single mode with collapsible=false so the */\n/* current panel always stays open. */\n/* -------------------------------------------------------------------- */\n\nconst STEP_VALUE_PREFIX = 'step-';\nconst makeValue = (index: number) => `${STEP_VALUE_PREFIX}${index}`;\nconst indexFromValue = (value: string): number =>\n Number(value.slice(STEP_VALUE_PREFIX.length));\n\n/* -------------------------------------------------------------------- */\n/* Indicator — shared with progress bar visual tone but sized for the */\n/* vertical wizard's dense header row. */\n/* -------------------------------------------------------------------- */\n\nconst iconDrawClasses = [\n 'ds:[stroke-dasharray:1] ds:[stroke-dashoffset:1]',\n 'ds:animate-[stepper-icon-draw_var(--animation-duration)_var(--ease-out)_forwards]',\n 'ds:motion-reduce:animate-none ds:motion-reduce:[stroke-dashoffset:0]',\n].join(' ');\n\nfunction CheckGlyph() {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n className=\"ds:size-4\"\n >\n <path pathLength=\"1\" d=\"M5 12l5 5L20 7\" className={iconDrawClasses} />\n </svg>\n );\n}\n\nfunction CrossGlyph() {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n className=\"ds:size-4\"\n >\n <path pathLength=\"1\" d=\"M6 6l12 12\" className={iconDrawClasses} />\n <path pathLength=\"1\" d=\"M18 6l-12 12\" className={iconDrawClasses} />\n </svg>\n );\n}\n\nconst indicatorClasses = [\n 'ds:inline-flex ds:shrink-0 ds:items-center ds:justify-center',\n 'ds:min-w-[var(--min-target-size)] ds:min-h-[var(--min-target-size)]',\n 'ds:size-[var(--min-target-size)]',\n 'ds:rounded-[var(--radius-full)]',\n 'ds:text-[var(--font-size-sm)] ds:font-[var(--font-weight-semibold)]',\n 'ds:border ds:border-[var(--border)]',\n 'ds:transition-[background-color,border-color,color]',\n 'ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n 'ds:motion-reduce:transition-none',\n].join(' ');\n\nconst indicatorVariants = cva(indicatorClasses, {\n variants: {\n state: {\n upcoming: 'ds:bg-[var(--background)] ds:text-[var(--muted-foreground)]',\n current: [\n 'ds:border-[var(--primary)] ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)]',\n 'ds:animate-[stepper-indicator-pop_var(--animation-duration)_var(--ease-out)_both]',\n 'ds:motion-reduce:animate-none',\n ].join(' '),\n completed:\n 'ds:border-[var(--primary)] ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)]',\n error: [\n 'ds:border-[var(--destructive)] ds:bg-[var(--destructive)] ds:text-[var(--destructive-foreground)]',\n 'ds:animate-[stepper-indicator-pop_var(--animation-duration)_var(--ease-out)_both]',\n 'ds:motion-reduce:animate-none',\n ].join(' '),\n },\n },\n});\n\n/* -------------------------------------------------------------------- */\n/* Item / trigger / content variants */\n/* -------------------------------------------------------------------- */\n\nconst itemVariants = cva(\n [\n 'ds:group/item ds:overflow-hidden ds:rounded-[var(--radius-md)]',\n 'ds:border ds:border-[color:var(--card-border)] ds:[.theme-accessible_&]:border-2 ds:bg-[var(--card)]',\n 'ds:data-[state=open]:border-[var(--primary)]',\n 'ds:transition-[border-color] ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n 'ds:motion-reduce:transition-none',\n ].join(' '),\n {\n variants: {\n tone: {\n neutral: '',\n error: 'ds:data-[state=open]:border-[var(--destructive)]',\n },\n },\n defaultVariants: { tone: 'neutral' },\n },\n);\n\nconst triggerClasses = [\n 'ds:flex ds:w-full ds:items-center ds:gap-[var(--spacing-sm)]',\n 'ds:min-h-[var(--min-target-size)]',\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n 'ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]',\n 'ds:text-start',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:disabled:cursor-not-allowed',\n 'ds:transition-[background-color] ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n 'ds:motion-reduce:transition-none',\n 'ds:hover:enabled:bg-[var(--muted)]/40',\n].join(' ');\n\nconst labelClasses = (state: StepState) =>\n [\n 'type-body-sm',\n state === 'current' || state === 'error'\n ? 'ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]'\n : state === 'completed'\n ? 'ds:text-[var(--foreground)]'\n : 'ds:text-[var(--muted-foreground)]',\n ].join(' ');\n\nconst descriptionClasses = [\n 'type-meta ds:text-[var(--muted-foreground)]',\n 'ds:mt-[var(--spacing-xs)]',\n].join(' ');\n\nconst hintClasses = [\n 'type-meta',\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]',\n 'ds:text-[var(--muted-foreground)]',\n].join(' ');\n\nconst chevronClasses = [\n 'ds:size-4 ds:shrink-0 ds:text-[var(--muted-foreground)]',\n 'ds:transition-transform ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n 'ds:motion-reduce:transition-none',\n 'ds:group-data-[state=open]/item:rotate-180',\n].join(' ');\n\nconst summaryClasses = [\n 'type-meta ds:text-[var(--muted-foreground)]',\n 'ds:ps-[calc(var(--min-target-size)+var(--spacing-md)+var(--spacing-sm))]',\n 'ds:pe-[var(--spacing-md)] ds:pb-[var(--spacing-sm)]',\n 'ds:group-data-[state=open]/item:hidden',\n].join(' ');\n\nconst contentClasses = [\n 'ds:overflow-hidden',\n 'ds:data-[state=open]:animate-[accordion-down_var(--animation-duration)_var(--ease-out)]',\n 'ds:data-[state=closed]:animate-[accordion-up_var(--animation-duration)_var(--ease-in)]',\n].join(' ');\n\nconst contentInnerClasses = [\n 'ds:ps-[calc(var(--min-target-size)+var(--spacing-md)+var(--spacing-sm))]',\n 'ds:pe-[var(--spacing-md)] ds:pt-[var(--spacing-xs)] ds:pb-[var(--spacing-md)]',\n].join(' ');\n\n/* -------------------------------------------------------------------- */\n/* Types */\n/* -------------------------------------------------------------------- */\n\nexport interface AccordionStepSpec extends StepSpec {\n /** Form content rendered inside the expanded panel. */\n content: ReactNode;\n /**\n * One-line summary shown under the header when the step is completed\n * and its panel is collapsed. Typically a preview of the captured\n * data — \"Mario Rossi · 12/03/1985\".\n */\n summary?: ReactNode;\n}\n\nconst rootVariants = cva('ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]', {\n variants: {},\n});\n\nexport interface StepperAccordionProps\n extends\n Omit<\n ComponentPropsWithoutRef<typeof AccordionPrimitive.Root>,\n 'type' | 'value' | 'defaultValue' | 'onValueChange' | 'collapsible'\n >,\n VariantProps<typeof rootVariants> {\n /** Active step (0-indexed). The matching panel is the one that is open. */\n activeStep: number;\n /** Step specs — each one provides its own content + optional summary. */\n steps: AccordionStepSpec[];\n /**\n * Fires when the user re-opens a completed step. Upcoming steps cannot\n * be activated — their triggers are disabled. The current step cannot\n * be collapsed (Radix `collapsible=false`).\n */\n onStepChange?: (index: number) => void;\n /** Override the default `aria-label` on the list wrapper. */\n 'aria-label'?: string;\n /**\n * Consumer-supplied instance id, surfaced as `data-component-id` so an\n * agent / UI bridge can address this instance.\n */\n id?: string;\n}\n\n/**\n * Imperative handle for agent-readiness. Routes state mutations through\n * the consumer's `onStepChange`, never mutating directly.\n */\nexport interface StepperAccordionHandle {\n getCurrentStep: () => number;\n getTotalSteps: () => number;\n /** Indices of currently-open panels — singleton under Radix `type=\"single\"`. */\n getOpenSteps: () => number[];\n gotoStep: (step: number) => void;\n next: () => void;\n previous: () => void;\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nconst StepperAccordion = forwardRef<\n StepperAccordionHandle,\n StepperAccordionProps\n>(\n (\n {\n activeStep,\n steps,\n onStepChange,\n 'aria-label': ariaLabel,\n id,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const total = steps.length;\n const clampedActive = Math.max(0, Math.min(activeStep, total - 1));\n const label = ariaLabel ?? t('navigation.stepper.label');\n const editCopy = t('navigation.stepper.edit');\n const openCopy = t('navigation.stepper.open');\n const lockedCopy = t('navigation.stepper.locked');\n const completedCopy = t('navigation.stepper.completed');\n const errorCopy = t('navigation.stepper.error');\n\n const handleValueChange = (value: string) => {\n // `collapsible=false` prevents empty-string values in practice, but the\n // primitive's type still allows one — guard anyway.\n if (!value) return;\n const index = indexFromValue(value);\n if (Number.isFinite(index) && index !== clampedActive) {\n onStepChange?.(index);\n }\n };\n\n const handle = useMemo<StepperAccordionHandle>(\n () => ({\n getCurrentStep: () => clampedActive,\n getTotalSteps: () => total,\n getOpenSteps: () => [clampedActive],\n gotoStep: (step: number) => {\n if (!onStepChange) return;\n const clamped = Math.max(0, Math.min(step, Math.max(total - 1, 0)));\n if (clamped !== clampedActive) onStepChange(clamped);\n },\n next: () => {\n if (!onStepChange) return;\n if (clampedActive < total - 1) onStepChange(clampedActive + 1);\n },\n previous: () => {\n if (!onStepChange) return;\n if (clampedActive > 0) onStepChange(clampedActive - 1);\n },\n }),\n [clampedActive, total, onStepChange],\n );\n useImperativeHandle(ref, () => handle, [handle]);\n\n return (\n <AccordionPrimitive.Root\n type=\"single\"\n value={makeValue(clampedActive)}\n onValueChange={handleValueChange}\n collapsible={false}\n aria-label={label}\n id={id}\n data-component=\"stepper-accordion\"\n data-component-id={id}\n className={rootVariants({ className })}\n {...rest}\n >\n {steps.map((spec, index) => {\n const state = stateForStep(index, clampedActive, spec.status);\n const isCurrent = state === 'current' || state === 'error';\n const isUpcoming = state === 'upcoming';\n // An `unlocked` step renders as `upcoming` but stays reachable —\n // only a step that is BOTH upcoming and unreachable is locked.\n const isLocked =\n isUpcoming && !stepIsReachable(index, clampedActive, spec.status);\n const itemTone = state === 'error' ? 'error' : 'neutral';\n const stepN = t('navigation.stepper.stepN', { n: index + 1 });\n\n const indicatorContent = (() => {\n if (state === 'completed') {\n return (\n <>\n <CheckGlyph />\n <span className=\"ds:sr-only\">{completedCopy}</span>\n </>\n );\n }\n if (state === 'error') {\n return (\n <>\n <CrossGlyph />\n <span className=\"ds:sr-only\">{errorCopy}</span>\n </>\n );\n }\n return <span>{index + 1}</span>;\n })();\n\n const hint = (() => {\n if (state === 'completed') {\n return <span className={hintClasses}>{editCopy}</span>;\n }\n if (isLocked) {\n return (\n <span className={hintClasses}>\n <Lock aria-hidden=\"true\" className=\"ds:size-3\" />\n {lockedCopy}\n </span>\n );\n }\n if (isUpcoming) {\n // Reachable but empty — say so, otherwise the row reads\n // identically to a locked one and nothing signals it opens.\n return <span className={hintClasses}>{openCopy}</span>;\n }\n return null;\n })();\n\n return (\n <AccordionPrimitive.Item\n key={index}\n value={makeValue(index)}\n data-step-id={String(index)}\n className={itemVariants({ tone: itemTone })}\n >\n <AccordionPrimitive.Header className=\"ds:flex\">\n <AccordionPrimitive.Trigger\n // Locked steps (upcoming, and not marked reachable by a\n // `completed` / `error` / `unlocked` status) are *HTML*-\n // disabled — they must not be\n // reachable by Tab or by Radix's arrow-key navigation ring\n // (Radix filters `item.ref.current?.disabled`, which is\n // the HTML attribute). Current is only *ARIA*-disabled so\n // keyboard users can Tab to it as a heading anchor and\n // hear \"current step\"; Radix's `collapsible=false` makes\n // the click a no-op regardless. Setting `disabled` at the\n // Trigger rather than the Item because `...triggerProps`\n // spreads after Collapsible writes its own `disabled`\n // from context, so the Item-level disabled gets overridden.\n disabled={isLocked}\n aria-disabled={isCurrent || undefined}\n // The hint is rendered text, but `aria-label` overrides\n // element content wholesale — so the affordance has to be\n // appended here too or AT hears none of it.\n aria-label={\n state === 'completed'\n ? `${stepN}, ${editCopy}`\n : isUpcoming && !isLocked\n ? `${stepN}, ${openCopy}`\n : stepN\n }\n aria-current={isCurrent ? 'step' : undefined}\n className={triggerClasses}\n >\n <span\n aria-hidden=\"true\"\n className={indicatorVariants({ state })}\n >\n {indicatorContent}\n </span>\n <span className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col\">\n <span className={labelClasses(state)}>{spec.label}</span>\n {spec.description ? (\n <span className={descriptionClasses}>\n {spec.description}\n </span>\n ) : null}\n </span>\n {hint}\n {isCurrent ? null : (\n <ChevronDown\n aria-hidden=\"true\"\n className={chevronClasses}\n />\n )}\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n {spec.summary && state === 'completed' ? (\n <div className={summaryClasses}>{spec.summary}</div>\n ) : null}\n <AccordionPrimitive.Content className={contentClasses}>\n <div className={contentInnerClasses}>{spec.content}</div>\n </AccordionPrimitive.Content>\n </AccordionPrimitive.Item>\n );\n })}\n </AccordionPrimitive.Root>\n );\n },\n);\nStepperAccordion.displayName = 'StepperAccordion';\n\nexport { StepperAccordion };\n"],"names":["stateForStep","index","activeStep","status","stepIsReachable","STEP_VALUE_PREFIX","makeValue","indexFromValue","value","iconDrawClasses","CheckGlyph","jsx","CrossGlyph","jsxs","indicatorClasses","indicatorVariants","cva","itemVariants","triggerClasses","labelClasses","state","descriptionClasses","hintClasses","chevronClasses","summaryClasses","contentClasses","contentInnerClasses","rootVariants","StepperAccordion","forwardRef","steps","onStepChange","ariaLabel","id","className","rest","ref","t","useTranslation","total","clampedActive","label","editCopy","openCopy","lockedCopy","completedCopy","errorCopy","handleValueChange","handle","useMemo","step","clamped","useImperativeHandle","AccordionPrimitive","spec","isCurrent","isUpcoming","isLocked","itemTone","stepN","indicatorContent","Fragment","hint","Lock","ChevronDown"],"mappings":";;;;;;;AA4CO,SAASA,EACdC,GACAC,GACAC,GACW;AACX,SAAIA,MAAW,UAAgB,UAC3BF,MAAUC,IAAmB,YAC7BC,MAAW,eACXF,IAAQC,IAAmB,cAIxB;AACT;AASO,SAASE,EACdH,GACAC,GACAC,GACS;AACT,SAAIA,MAAW,SAAkB,KAC1BF,KAASC;AAClB;AC7CA,MAAMG,IAAoB,SACpBC,IAAY,CAACL,MAAkB,GAAGI,CAAiB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A,GAGN;AAAA,gBACC+B,EAAK,WAAWlC,MAAU,cACzB,gBAAAT,EAAC,SAAI,WAAWa,IAAiB,UAAA8B,EAAK,QAAA,CAAQ,IAC5C;AAAA,gBACJ,gBAAA3C,EAAC0C,EAAmB,SAAnB,EAA2B,WAAW5B,IACrC,UAAA,gBAAAd,EAAC,OAAA,EAAI,WAAWe,IAAsB,UAAA4B,EAAK,QAAA,CAAQ,EAAA,CACrD;AAAA,cAAA;AAAA,YAAA;AAAA,YA9DKrD;AAAA,UAAA;AAAA,QAiEX,CAAC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA2B,GAAiB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"stepper-accordion-jMR8NaOB.js","sources":["../../src/components/_shared/stepper.ts","../../src/components/stepper-accordion/stepper-accordion.tsx"],"sourcesContent":["// Shared types + state machine for the two stepper variants:\n// - src/components/stepper-progress (lightweight progress bar + caption)\n// - src/components/stepper-accordion (vertical disclosure wizard)\n//\n// Both components consume `StepSpec` and the `stateForStep` helper so the\n// four-state machine (upcoming | current | completed | error) stays in one\n// place. Rename or removal is a MAJOR per src/docs/13-maintainability.mdx.\n\n/**\n * Consumer-supplied override for a step.\n *\n * - `completed` — the step holds a value; render the tick and let the user\n * back in to change it.\n * - `error` — the step's own validation failed; always wins.\n * - `unlocked` (1.11.0) — the step has been *reached* but holds no value of\n * its own. It renders exactly like an upcoming step, but the user may open\n * it. Added for flows whose final step can never report itself \"completed\"\n * because its validity belongs to a form inside it: without this, moving\n * the cursor backwards left that step HTML-`disabled` and unreachable.\n *\n * `'completed'` and `'error'` behave exactly as before, so consumers passing\n * either (or nothing) are unaffected. A consumer that reads this union back\n * in an exhaustive `switch` needs a case for `'unlocked'`; `StepState` — the\n * union such a switch usually runs on — is deliberately untouched.\n */\nexport type StepStatus = 'completed' | 'error' | 'unlocked';\n\nexport type StepState = 'upcoming' | 'current' | 'completed' | 'error';\n\nexport interface StepSpec {\n /** Visible step label — comes from the consumer, already translated. */\n label: string;\n /** Optional secondary line (kept short; shown in accordion + progress captions). */\n description?: string;\n /**\n * Consumer-explicit status override. `error` always wins; `completed` is\n * honoured only for steps at or beyond the active index so the active step\n * always keeps `current` (otherwise a consumer pre-setting `completed` on\n * every step would silently mask the current position). `unlocked` changes\n * reachability only — see `stepIsReachable` — and never the rendered state.\n */\n status?: StepStatus;\n}\n\nexport function stateForStep(\n index: number,\n activeStep: number,\n status?: StepStatus,\n): StepState {\n if (status === 'error') return 'error';\n if (index === activeStep) return 'current';\n if (status === 'completed') return 'completed';\n if (index < activeStep) return 'completed';\n // `unlocked` deliberately falls through: it is a reachability hint, not a\n // visual state, so the returned `StepState` union is unchanged and any\n // exhaustive switch a consumer already wrote keeps compiling.\n return 'upcoming';\n}\n\n/**\n * May the user open this step?\n *\n * Everything at or before the cursor is reachable, as is any step the\n * consumer has explicitly marked `completed`, `error` or `unlocked`.\n * Steps ahead of the cursor with no status stay locked, exactly as before.\n */\nexport function stepIsReachable(\n index: number,\n activeStep: number,\n status?: StepStatus,\n): boolean {\n if (status !== undefined) return true;\n return index <= activeStep;\n}\n","import {\n forwardRef,\n useImperativeHandle,\n useMemo,\n type ComponentPropsWithoutRef,\n type ReactNode,\n} from 'react';\nimport * as AccordionPrimitive from '@radix-ui/react-accordion';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { ChevronDown, Lock } from 'lucide-react';\nimport { useTranslation } from 'react-i18next';\nimport {\n stateForStep,\n stepIsReachable,\n type StepSpec,\n type StepState,\n} from '../_shared/stepper';\n\n/* -------------------------------------------------------------------- */\n/* StepperAccordion */\n/* */\n/* Vertical disclosure wizard. The current step is expanded inline; */\n/* completed steps collapse to a one-line summary with an \"Edit\" hint */\n/* that re-opens them; upcoming steps are locked. Built on Radix */\n/* Accordion in controlled-single mode with collapsible=false so the */\n/* current panel always stays open. */\n/* -------------------------------------------------------------------- */\n\nconst STEP_VALUE_PREFIX = 'step-';\nconst makeValue = (index: number) => `${STEP_VALUE_PREFIX}${index}`;\nconst indexFromValue = (value: string): number =>\n Number(value.slice(STEP_VALUE_PREFIX.length));\n\n/* -------------------------------------------------------------------- */\n/* Indicator — shared with progress bar visual tone but sized for the */\n/* vertical wizard's dense header row. */\n/* -------------------------------------------------------------------- */\n\nconst iconDrawClasses = [\n 'ds:[stroke-dasharray:1] ds:[stroke-dashoffset:1]',\n 'ds:animate-[stepper-icon-draw_var(--animation-duration)_var(--ease-out)_forwards]',\n 'ds:motion-reduce:animate-none ds:motion-reduce:[stroke-dashoffset:0]',\n].join(' ');\n\nfunction CheckGlyph() {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n className=\"ds:size-4\"\n >\n <path pathLength=\"1\" d=\"M5 12l5 5L20 7\" className={iconDrawClasses} />\n </svg>\n );\n}\n\nfunction CrossGlyph() {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n className=\"ds:size-4\"\n >\n <path pathLength=\"1\" d=\"M6 6l12 12\" className={iconDrawClasses} />\n <path pathLength=\"1\" d=\"M18 6l-12 12\" className={iconDrawClasses} />\n </svg>\n );\n}\n\nconst indicatorClasses = [\n 'ds:inline-flex ds:shrink-0 ds:items-center ds:justify-center',\n 'ds:min-w-[var(--min-target-size)] ds:min-h-[var(--min-target-size)]',\n 'ds:size-[var(--min-target-size)]',\n 'ds:rounded-[var(--radius-full)]',\n 'ds:text-[var(--font-size-sm)] ds:font-[var(--font-weight-semibold)]',\n 'ds:border ds:border-[var(--border)]',\n 'ds:transition-[background-color,border-color,color]',\n 'ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n 'ds:motion-reduce:transition-none',\n].join(' ');\n\nconst indicatorVariants = cva(indicatorClasses, {\n variants: {\n state: {\n upcoming: 'ds:bg-[var(--background)] ds:text-[var(--muted-foreground)]',\n current: [\n 'ds:border-[var(--primary)] ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)]',\n 'ds:animate-[stepper-indicator-pop_var(--animation-duration)_var(--ease-out)_both]',\n 'ds:motion-reduce:animate-none',\n ].join(' '),\n completed:\n 'ds:border-[var(--primary)] ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)]',\n error: [\n 'ds:border-[var(--destructive)] ds:bg-[var(--destructive)] ds:text-[var(--destructive-foreground)]',\n 'ds:animate-[stepper-indicator-pop_var(--animation-duration)_var(--ease-out)_both]',\n 'ds:motion-reduce:animate-none',\n ].join(' '),\n },\n },\n});\n\n/* -------------------------------------------------------------------- */\n/* Item / trigger / content variants */\n/* -------------------------------------------------------------------- */\n\nconst itemVariants = cva(\n [\n 'ds:group/item ds:overflow-hidden ds:rounded-[var(--radius-md)]',\n 'ds:border ds:border-[color:var(--card-border)] ds:[.theme-accessible_&]:border-2 ds:bg-[var(--card)]',\n 'ds:data-[state=open]:border-[var(--primary)]',\n 'ds:transition-[border-color] ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n 'ds:motion-reduce:transition-none',\n ].join(' '),\n {\n variants: {\n tone: {\n neutral: '',\n error: 'ds:data-[state=open]:border-[var(--destructive)]',\n },\n },\n defaultVariants: { tone: 'neutral' },\n },\n);\n\nconst triggerClasses = [\n 'ds:flex ds:w-full ds:items-center ds:gap-[var(--spacing-sm)]',\n 'ds:min-h-[var(--min-target-size)]',\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n 'ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]',\n 'ds:text-start',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:disabled:cursor-not-allowed',\n 'ds:transition-[background-color] ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n 'ds:motion-reduce:transition-none',\n 'ds:hover:enabled:bg-[var(--muted)]/40',\n].join(' ');\n\nconst labelClasses = (state: StepState) =>\n [\n 'type-body-sm',\n state === 'current' || state === 'error'\n ? 'ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]'\n : state === 'completed'\n ? 'ds:text-[var(--foreground)]'\n : 'ds:text-[var(--muted-foreground)]',\n ].join(' ');\n\nconst descriptionClasses = [\n 'type-meta ds:text-[var(--muted-foreground)]',\n 'ds:mt-[var(--spacing-xs)]',\n].join(' ');\n\nconst hintClasses = [\n 'type-meta',\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]',\n 'ds:text-[var(--muted-foreground)]',\n].join(' ');\n\nconst chevronClasses = [\n 'ds:size-4 ds:shrink-0 ds:text-[var(--muted-foreground)]',\n 'ds:transition-transform ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n 'ds:motion-reduce:transition-none',\n 'ds:group-data-[state=open]/item:rotate-180',\n].join(' ');\n\nconst summaryClasses = [\n 'type-meta ds:text-[var(--muted-foreground)]',\n 'ds:ps-[calc(var(--min-target-size)+var(--spacing-md)+var(--spacing-sm))]',\n 'ds:pe-[var(--spacing-md)] ds:pb-[var(--spacing-sm)]',\n 'ds:group-data-[state=open]/item:hidden',\n].join(' ');\n\nconst contentClasses = [\n 'ds:overflow-hidden',\n 'ds:data-[state=open]:animate-[accordion-down_var(--animation-duration)_var(--ease-out)]',\n 'ds:data-[state=closed]:animate-[accordion-up_var(--animation-duration)_var(--ease-in)]',\n].join(' ');\n\nconst contentInnerClasses = [\n 'ds:ps-[calc(var(--min-target-size)+var(--spacing-md)+var(--spacing-sm))]',\n 'ds:pe-[var(--spacing-md)] ds:pt-[var(--spacing-xs)] ds:pb-[var(--spacing-md)]',\n].join(' ');\n\n/* -------------------------------------------------------------------- */\n/* Types */\n/* -------------------------------------------------------------------- */\n\nexport interface AccordionStepSpec extends StepSpec {\n /** Form content rendered inside the expanded panel. */\n content: ReactNode;\n /**\n * One-line summary shown under the header when the step is completed\n * and its panel is collapsed. Typically a preview of the captured\n * data — \"Mario Rossi · 12/03/1985\".\n */\n summary?: ReactNode;\n}\n\nconst rootVariants = cva('ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]', {\n variants: {},\n});\n\nexport interface StepperAccordionProps\n extends\n Omit<\n ComponentPropsWithoutRef<typeof AccordionPrimitive.Root>,\n 'type' | 'value' | 'defaultValue' | 'onValueChange' | 'collapsible'\n >,\n VariantProps<typeof rootVariants> {\n /** Active step (0-indexed). The matching panel is the one that is open. */\n activeStep: number;\n /** Step specs — each one provides its own content + optional summary. */\n steps: AccordionStepSpec[];\n /**\n * Fires when the user re-opens a completed step. Upcoming steps cannot\n * be activated — their triggers are disabled. The current step cannot\n * be collapsed (Radix `collapsible=false`).\n */\n onStepChange?: (index: number) => void;\n /** Override the default `aria-label` on the list wrapper. */\n 'aria-label'?: string;\n /**\n * Consumer-supplied instance id, surfaced as `data-component-id` so an\n * agent / UI bridge can address this instance.\n */\n id?: string;\n}\n\n/**\n * Imperative handle for agent-readiness. Routes state mutations through\n * the consumer's `onStepChange`, never mutating directly.\n */\nexport interface StepperAccordionHandle {\n getCurrentStep: () => number;\n getTotalSteps: () => number;\n /** Indices of currently-open panels — singleton under Radix `type=\"single\"`. */\n getOpenSteps: () => number[];\n gotoStep: (step: number) => void;\n next: () => void;\n previous: () => void;\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nconst StepperAccordion = forwardRef<\n StepperAccordionHandle,\n StepperAccordionProps\n>(\n (\n {\n activeStep,\n steps,\n onStepChange,\n 'aria-label': ariaLabel,\n id,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const total = steps.length;\n const clampedActive = Math.max(0, Math.min(activeStep, total - 1));\n const label = ariaLabel ?? t('navigation.stepper.label');\n const editCopy = t('navigation.stepper.edit');\n const openCopy = t('navigation.stepper.open');\n const lockedCopy = t('navigation.stepper.locked');\n const completedCopy = t('navigation.stepper.completed');\n const errorCopy = t('navigation.stepper.error');\n\n const handleValueChange = (value: string) => {\n // `collapsible=false` prevents empty-string values in practice, but the\n // primitive's type still allows one — guard anyway.\n if (!value) return;\n const index = indexFromValue(value);\n if (Number.isFinite(index) && index !== clampedActive) {\n onStepChange?.(index);\n }\n };\n\n const handle = useMemo<StepperAccordionHandle>(\n () => ({\n getCurrentStep: () => clampedActive,\n getTotalSteps: () => total,\n getOpenSteps: () => [clampedActive],\n gotoStep: (step: number) => {\n if (!onStepChange) return;\n const clamped = Math.max(0, Math.min(step, Math.max(total - 1, 0)));\n if (clamped !== clampedActive) onStepChange(clamped);\n },\n next: () => {\n if (!onStepChange) return;\n if (clampedActive < total - 1) onStepChange(clampedActive + 1);\n },\n previous: () => {\n if (!onStepChange) return;\n if (clampedActive > 0) onStepChange(clampedActive - 1);\n },\n }),\n [clampedActive, total, onStepChange],\n );\n useImperativeHandle(ref, () => handle, [handle]);\n\n return (\n <AccordionPrimitive.Root\n type=\"single\"\n value={makeValue(clampedActive)}\n onValueChange={handleValueChange}\n collapsible={false}\n // Radix renders a plain div, and aria-label is prohibited on the\n // generic role. `group` lets the label name the set of steps.\n role=\"group\"\n aria-label={label}\n id={id}\n data-component=\"stepper-accordion\"\n data-component-id={id}\n className={rootVariants({ className })}\n {...rest}\n >\n {steps.map((spec, index) => {\n const state = stateForStep(index, clampedActive, spec.status);\n const isCurrent = state === 'current' || state === 'error';\n const isUpcoming = state === 'upcoming';\n // An `unlocked` step renders as `upcoming` but stays reachable —\n // only a step that is BOTH upcoming and unreachable is locked.\n const isLocked =\n isUpcoming && !stepIsReachable(index, clampedActive, spec.status);\n const itemTone = state === 'error' ? 'error' : 'neutral';\n const stepN = t('navigation.stepper.stepN', { n: index + 1 });\n\n const indicatorContent = (() => {\n if (state === 'completed') {\n return (\n <>\n <CheckGlyph />\n <span className=\"ds:sr-only\">{completedCopy}</span>\n </>\n );\n }\n if (state === 'error') {\n return (\n <>\n <CrossGlyph />\n <span className=\"ds:sr-only\">{errorCopy}</span>\n </>\n );\n }\n return <span>{index + 1}</span>;\n })();\n\n const hint = (() => {\n if (state === 'completed') {\n return <span className={hintClasses}>{editCopy}</span>;\n }\n if (isLocked) {\n return (\n <span className={hintClasses}>\n <Lock aria-hidden=\"true\" className=\"ds:size-3\" />\n {lockedCopy}\n </span>\n );\n }\n if (isUpcoming) {\n // Reachable but empty — say so, otherwise the row reads\n // identically to a locked one and nothing signals it opens.\n return <span className={hintClasses}>{openCopy}</span>;\n }\n return null;\n })();\n\n return (\n <AccordionPrimitive.Item\n key={index}\n value={makeValue(index)}\n data-step-id={String(index)}\n className={itemVariants({ tone: itemTone })}\n >\n <AccordionPrimitive.Header className=\"ds:flex\">\n <AccordionPrimitive.Trigger\n // Locked steps (upcoming, and not marked reachable by a\n // `completed` / `error` / `unlocked` status) are *HTML*-\n // disabled — they must not be\n // reachable by Tab or by Radix's arrow-key navigation ring\n // (Radix filters `item.ref.current?.disabled`, which is\n // the HTML attribute). Current is only *ARIA*-disabled so\n // keyboard users can Tab to it as a heading anchor and\n // hear \"current step\"; Radix's `collapsible=false` makes\n // the click a no-op regardless. Setting `disabled` at the\n // Trigger rather than the Item because `...triggerProps`\n // spreads after Collapsible writes its own `disabled`\n // from context, so the Item-level disabled gets overridden.\n disabled={isLocked}\n aria-disabled={isCurrent || undefined}\n // The hint is rendered text, but `aria-label` overrides\n // element content wholesale — so the affordance has to be\n // appended here too or AT hears none of it.\n aria-label={\n state === 'completed'\n ? `${stepN}, ${editCopy}`\n : isUpcoming && !isLocked\n ? `${stepN}, ${openCopy}`\n : stepN\n }\n aria-current={isCurrent ? 'step' : undefined}\n className={triggerClasses}\n >\n <span\n aria-hidden=\"true\"\n className={indicatorVariants({ state })}\n >\n {indicatorContent}\n </span>\n <span className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col\">\n <span className={labelClasses(state)}>{spec.label}</span>\n {spec.description ? (\n <span className={descriptionClasses}>\n {spec.description}\n </span>\n ) : null}\n </span>\n {hint}\n {isCurrent ? null : (\n <ChevronDown\n aria-hidden=\"true\"\n className={chevronClasses}\n />\n )}\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n {spec.summary && state === 'completed' ? (\n <div className={summaryClasses}>{spec.summary}</div>\n ) : null}\n <AccordionPrimitive.Content className={contentClasses}>\n <div className={contentInnerClasses}>{spec.content}</div>\n </AccordionPrimitive.Content>\n </AccordionPrimitive.Item>\n );\n })}\n </AccordionPrimitive.Root>\n );\n },\n);\nStepperAccordion.displayName = 'StepperAccordion';\n\nexport { StepperAccordion };\n"],"names":["stateForStep","index","activeStep","status","stepIsReachable","STEP_VALUE_PREFIX","makeValue","indexFromValue","value","iconDrawClasses","CheckGlyph","jsx","CrossGlyph","jsxs","indicatorClasses","indicatorVariants","cva","itemVariants","triggerClasses","labelClasses","state","descriptionClasses","hintClasses","chevronClasses","summaryClasses","contentClasses","contentInnerClasses","rootVariants","StepperAccordion","forwardRef","steps","onStepChange","ariaLabel","id","className","rest","ref","t","useTranslation","total","clampedActive","label","editCopy","openCopy","lockedCopy","completedCopy","errorCopy","handleValueChange","handle","useMemo","step","clamped","useImperativeHandle","AccordionPrimitive","spec","isCurrent","isUpcoming","isLocked","itemTone","stepN","indicatorContent","Fragment","hint","Lock","ChevronDown"],"mappings":";;;;;;;AA4CO,SAASA,EACdC,GACAC,GACAC,GACW;AACX,SAAIA,MAAW,UAAgB,UAC3BF,MAAUC,IAAmB,YAC7BC,MAAW,eACXF,IAAQC,IAAmB,cAIxB;AACT;AASO,SAASE,EACdH,GACAC,GACAC,GACS;AACT,SAAIA,MAAW,SAAkB,KAC1BF,KAASC;AAClB;AC7CA,MAAMG,IAAoB,SACpBC,IAAY,CAACL,MAAkB,GAAGI,CAAiB,GAAGJ,CAAK,IAC3DM,IAAiB,CAACC,MACtB,OAAOA,EAAM,MAAMH,EAAk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BAAAT,EAAC,SAAI,WAAWa,IAAiB,UAAA8B,EAAK,QAAA,CAAQ,IAC5C;AAAA,gBACJ,gBAAA3C,EAAC0C,EAAmB,SAAnB,EAA2B,WAAW5B,IACrC,UAAA,gBAAAd,EAAC,OAAA,EAAI,WAAWe,IAAsB,UAAA4B,EAAK,QAAA,CAAQ,EAAA,CACrD;AAAA,cAAA;AAAA,YAAA;AAAA,YA9DKrD;AAAA,UAAA;AAAA,QAiEX,CAAC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA2B,GAAiB,cAAc;"}
|
package/dist/agent-catalog.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"packageVersion": "1.
|
|
3
|
+
"packageVersion": "1.47.0",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
6
6
|
"kind": "component",
|
|
@@ -1295,7 +1295,8 @@
|
|
|
1295
1295
|
"safety": "destructive",
|
|
1296
1296
|
"idempotent": true,
|
|
1297
1297
|
"errors": [
|
|
1298
|
-
"Resetting after submit has no effect — the flow is on step 8."
|
|
1298
|
+
"Resetting after submit has no effect — the flow is on step 8.",
|
|
1299
|
+
"Refused while a payment session is open (step 7): the consumer must cancel the hold first."
|
|
1299
1300
|
],
|
|
1300
1301
|
"description": "Clear the booking value back to an empty state. Use to abandon an in-progress flow.",
|
|
1301
1302
|
"descriptionKey": "ui.agent.booking.actions.reset"
|
|
@@ -8931,7 +8932,7 @@
|
|
|
8931
8932
|
{
|
|
8932
8933
|
"name": "complete",
|
|
8933
8934
|
"type": "boolean",
|
|
8934
|
-
"description": "True when Stripe reports the payment fields as complete. Read this before `submit` — outside preview mode the submit control is disabled while it is false, so the call will not be accepted.",
|
|
8935
|
+
"description": "True when Stripe reports the payment fields, and any required billing address, as complete. Read this before `submit` — outside preview mode the submit control is disabled while it is false, so the call will not be accepted.",
|
|
8935
8936
|
"descriptionKey": "ui.agent.paymentForm.state.complete"
|
|
8936
8937
|
},
|
|
8937
8938
|
{
|
|
@@ -8966,7 +8967,7 @@
|
|
|
8966
8967
|
"name": "reset",
|
|
8967
8968
|
"safety": "destructive",
|
|
8968
8969
|
"idempotent": true,
|
|
8969
|
-
"description": "
|
|
8970
|
+
"description": "Clear recoverable errors and return their status to \"idle\". Stripe fields remain unchanged. Pending or paid attempts cannot be reset and require a new session.",
|
|
8970
8971
|
"descriptionKey": "ui.agent.paymentForm.actions.reset"
|
|
8971
8972
|
}
|
|
8972
8973
|
],
|
package/dist/agent-i18n/en.json
CHANGED
|
@@ -942,13 +942,13 @@
|
|
|
942
942
|
"paymentForm": {
|
|
943
943
|
"state": {
|
|
944
944
|
"status": "Lifecycle of the current payment attempt. `succeeded` is only reached once Stripe confirmed the PaymentIntent; `failed` covers validation, decline and processor errors alike. Still `idle` after `submit` means the attempt never fired — Stripe had not mounted.",
|
|
945
|
-
"complete": "True when Stripe reports the payment fields as complete. Read this before `submit` — outside preview mode the submit control is disabled while it is false, so the call will not be accepted.",
|
|
945
|
+
"complete": "True when Stripe reports the payment fields, and any required billing address, as complete. Read this before `submit` — outside preview mode the submit control is disabled while it is false, so the call will not be accepted.",
|
|
946
946
|
"errorKey": "i18n key of the current error (e.g. `payment.error.cardDeclined`), or null. The key is the structural datum — the translated message is free text and is never exposed.",
|
|
947
947
|
"paymentIntentId": "Opaque Stripe PaymentIntent id once a charge succeeded, else null. The receipt — the attribution handle for the money that moved. Never the client secret."
|
|
948
948
|
},
|
|
949
949
|
"actions": {
|
|
950
950
|
"submit": "Submit the payment. Charges the configured payment method — irreversible. Resolves once the attempt has settled; the outcome is never in the resolved value, so read `status`, then `errorKey` on failure or `paymentIntentId` on success.",
|
|
951
|
-
"reset": "
|
|
951
|
+
"reset": "Clear recoverable errors and return their status to \"idle\". Stripe fields remain unchanged. Pending or paid attempts cannot be reset and require a new session."
|
|
952
952
|
}
|
|
953
953
|
},
|
|
954
954
|
"pdfViewer": {
|
|
@@ -13,6 +13,48 @@ export interface BookingSpecialty {
|
|
|
13
13
|
/** Restrict to operators-on-page when lockedOperatorId is set. */
|
|
14
14
|
operatorIds?: string[];
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* One appointment payment, in currency minor units. Set it only when the
|
|
18
|
+
* platform AppointmentBookingReason.requireAdvancePayment is true.
|
|
19
|
+
*/
|
|
20
|
+
export interface BookingServicePayment {
|
|
21
|
+
/** No platform field: the consumer derives it, e.g. deposit when advanceAmount < price. */
|
|
22
|
+
kind: 'full' | 'deposit';
|
|
23
|
+
/** Platform advanceAmount (euros) x 100. NOT price, which only feeds priceLabel. */
|
|
24
|
+
amountCents: number;
|
|
25
|
+
/** Defaults to EUR, the only currency production charges. */
|
|
26
|
+
currencyCode?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface BookingResolvedPayment extends BookingServicePayment {
|
|
29
|
+
serviceId: string;
|
|
30
|
+
currencyCode: string;
|
|
31
|
+
}
|
|
32
|
+
export interface BookingPaymentSession {
|
|
33
|
+
/** Opaque hold identity. Keep Stripe credentials in the consumer, keyed by this id. */
|
|
34
|
+
id: string;
|
|
35
|
+
payment: BookingResolvedPayment;
|
|
36
|
+
}
|
|
37
|
+
export interface BookingSubmitResult {
|
|
38
|
+
paymentSession: BookingPaymentSession;
|
|
39
|
+
}
|
|
40
|
+
export type BookingPaymentState = {
|
|
41
|
+
sessionId: string;
|
|
42
|
+
status: 'ready' | 'cancelled' | 'paid';
|
|
43
|
+
} | {
|
|
44
|
+
sessionId: string;
|
|
45
|
+
status: 'processing';
|
|
46
|
+
phase: 'payment' | 'completion';
|
|
47
|
+
} | {
|
|
48
|
+
sessionId: string;
|
|
49
|
+
status: 'failed';
|
|
50
|
+
phase: 'payment' | 'completion';
|
|
51
|
+
error?: ReactNode;
|
|
52
|
+
};
|
|
53
|
+
export interface BookingPaymentRenderContext {
|
|
54
|
+
session: BookingPaymentSession;
|
|
55
|
+
payment: BookingResolvedPayment;
|
|
56
|
+
state: BookingPaymentState;
|
|
57
|
+
}
|
|
16
58
|
export interface BookingService {
|
|
17
59
|
id: string;
|
|
18
60
|
label: string;
|
|
@@ -27,6 +69,8 @@ export interface BookingService {
|
|
|
27
69
|
* string verbatim. Added in 1.6.0.
|
|
28
70
|
*/
|
|
29
71
|
priceLabel?: string;
|
|
72
|
+
/** Mandatory online payment for this service only. Never inferred from priceLabel. */
|
|
73
|
+
payment?: BookingServicePayment;
|
|
30
74
|
/** Required when useSpecialties is true. */
|
|
31
75
|
specialtyId?: string;
|
|
32
76
|
/** Operators who can perform this service. */
|
|
@@ -50,6 +94,8 @@ export interface BookingOperator {
|
|
|
50
94
|
export interface BookingSlot {
|
|
51
95
|
/** Opaque unique key within `availableSlots[date]`. */
|
|
52
96
|
key: string;
|
|
97
|
+
/** Actual service booked when serviceIds contains several search alternatives. */
|
|
98
|
+
serviceId?: string;
|
|
53
99
|
/** HH:mm 24h — used for display. */
|
|
54
100
|
time: string;
|
|
55
101
|
available: boolean;
|
|
@@ -70,6 +116,8 @@ export interface BookingDetails {
|
|
|
70
116
|
* only when the service carries that text; omitted otherwise.
|
|
71
117
|
*/
|
|
72
118
|
criticalInformationAccepted?: boolean;
|
|
119
|
+
/** Included only when the patient accepts this service's payment quote. */
|
|
120
|
+
paymentAccepted?: boolean;
|
|
73
121
|
codiceFiscale?: string;
|
|
74
122
|
dateOfBirth?: string;
|
|
75
123
|
insuranceNumber?: string;
|
|
@@ -122,6 +170,7 @@ export interface BookingSubmitPayload {
|
|
|
122
170
|
value: BookingValue;
|
|
123
171
|
/** Fully populated + validated (privacy + terms ticked, required fields filled). */
|
|
124
172
|
details: BookingDetails;
|
|
173
|
+
payment?: BookingResolvedPayment;
|
|
125
174
|
}
|
|
126
175
|
export interface BookingValidationResult {
|
|
127
176
|
valid: boolean;
|
|
@@ -179,6 +228,16 @@ export interface BookingProps extends Omit<ComponentPropsWithoutRef<'div'>, 'ari
|
|
|
179
228
|
showReturningPatientFlag?: boolean;
|
|
180
229
|
privacyPolicyUrl?: string;
|
|
181
230
|
termsUrl?: string;
|
|
231
|
+
paymentTermsUrl?: string;
|
|
232
|
+
/** Publish paid only after the server verifies payment AND saves the appointment. */
|
|
233
|
+
paymentState?: BookingPaymentState;
|
|
234
|
+
/** Render PaymentForm here. The consumer owns Stripe credentials and completion calls. */
|
|
235
|
+
renderPayment?: (context: BookingPaymentRenderContext) => ReactNode;
|
|
236
|
+
/**
|
|
237
|
+
* Completion retry only: never render card entry or start another payment here.
|
|
238
|
+
* Supply it with renderPayment; without it a failed completion shows only the error.
|
|
239
|
+
*/
|
|
240
|
+
renderPaymentCompletion?: (context: BookingPaymentRenderContext) => ReactNode;
|
|
182
241
|
validateCodiceFiscale?: BookingValidator;
|
|
183
242
|
validateInsuranceNumber?: BookingValidator;
|
|
184
243
|
/** Default: false. Specialty auto-select on length=1 is always on. */
|
|
@@ -198,7 +257,7 @@ export interface BookingProps extends Omit<ComponentPropsWithoutRef<'div'>, 'ari
|
|
|
198
257
|
defaultConfirmationChannels?: ConfirmationChannel[];
|
|
199
258
|
value: BookingValue;
|
|
200
259
|
onChange: (next: BookingValue) => void;
|
|
201
|
-
onSubmit: (payload: BookingSubmitPayload) => void | Promise<void>;
|
|
260
|
+
onSubmit: (payload: BookingSubmitPayload) => void | BookingSubmitResult | Promise<void | BookingSubmitResult>;
|
|
202
261
|
/**
|
|
203
262
|
* Calendar/date-strip shimmer — set true while `availableDates` is being
|
|
204
263
|
* fetched. When omitted, the kit falls back to `loadingSlots` for the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"booking-types.d.ts","sourceRoot":"","sources":["../../../src/components/booking/booking-types.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMjE,MAAM,MAAM,cAAc,GACtB,aAAa,GACb,WAAW,GACX,UAAU,GACV,UAAU,GACV,UAAU,CAAC;AAMf,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,Q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AAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"booking-types.d.ts","sourceRoot":"","sources":["../../../src/components/booking/booking-types.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMjE,MAAM,MAAM,cAAc,GACtB,aAAa,GACb,WAAW,GACX,UAAU,GACV,UAAU,GACV,UAAU,CAAC;AAMf,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEjD,sEAAsE;AACtE,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,UAAU,GAAG,KAAK,CAAC;AAE/D,0DAA0D;AAC1D,eAAO,MAAM,0BAA0B,EAAE,SAAS,mBAAmB,EAI3D,CAAC;AAEX,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,2FAA2F;IAC3F,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,oFAAoF;IACpF,WAAW,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,sBAAuB,SAAQ,qBAAqB;IACnE,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,uFAAuF;IACvF,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,MA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wBAAwB,CAAC,EAAE,SAAS,CAAC;IAGrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"booking.agent.d.ts","sourceRoot":"","sources":["../../../src/components/booking/booking.agent.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"booking.agent.d.ts","sourceRoot":"","sources":["../../../src/components/booking/booking.agent.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,aAAa,CA+EpD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BookingProps } from './booking-types';
|
|
2
|
-
export type { BookingDetails, BookingHandle, BookingOperator, BookingProps, BookingService, BookingSlot, BookingSpecialty, BookingSubmitPayload, BookingValidationResult, BookingValidator, BookingValue, BookingVariant, ConfirmationChannel, InsuranceType, } from './booking-types';
|
|
2
|
+
export type { BookingPaymentSession, BookingPaymentState, BookingPaymentRenderContext, BookingSubmitResult, BookingServicePayment, BookingResolvedPayment, BookingDetails, BookingHandle, BookingOperator, BookingProps, BookingService, BookingSlot, BookingSpecialty, BookingSubmitPayload, BookingValidationResult, BookingValidator, BookingValue, BookingVariant, ConfirmationChannel, InsuranceType, } from './booking-types';
|
|
3
3
|
export { CONFIRMATION_CHANNEL_ORDER } from './booking-types';
|
|
4
4
|
export { OPERATORS_ALL } from './cascade';
|
|
5
5
|
export declare const Booking: import("react").ForwardRefExoticComponent<BookingProps & import("react").RefAttributes<HTMLDivElement>>;
|