@alfadocs/ui-kit-debug 1.80.0 → 1.82.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/{address-fields-GnoSkvh6.js → address-fields-CfnXK8RT.js} +4 -4
- package/dist/_chunks/{address-fields-GnoSkvh6.js.map → address-fields-CfnXK8RT.js.map} +1 -1
- package/dist/_chunks/{ai-prompt-input-M6u29f87.js → ai-prompt-input-DH_rnV-F.js} +33 -26
- package/dist/_chunks/{ai-prompt-input-M6u29f87.js.map → ai-prompt-input-DH_rnV-F.js.map} +1 -1
- package/dist/_chunks/{anamnesis-summary-rows-lONg-zja.js → anamnesis-summary-rows-6gMuu0ZK.js} +2 -2
- package/dist/_chunks/{anamnesis-summary-rows-lONg-zja.js.map → anamnesis-summary-rows-6gMuu0ZK.js.map} +1 -1
- package/dist/_chunks/{autocomplete-DosDnGie.js → autocomplete-CnB1mHGc.js} +65 -64
- package/dist/_chunks/{autocomplete-DosDnGie.js.map → autocomplete-CnB1mHGc.js.map} +1 -1
- package/dist/_chunks/{balance-badge-cell-Dzd-Z_5W.js → balance-badge-cell-BHXJS8Ga.js} +2 -2
- package/dist/_chunks/{balance-badge-cell-Dzd-Z_5W.js.map → balance-badge-cell-BHXJS8Ga.js.map} +1 -1
- package/dist/_chunks/{benefit-card-BWBClvdF.js → benefit-card-BcPtRHgM.js} +37 -36
- package/dist/_chunks/{benefit-card-BWBClvdF.js.map → benefit-card-BcPtRHgM.js.map} +1 -1
- package/dist/_chunks/booking-dsgiuhKg.js +4304 -0
- package/dist/_chunks/booking-dsgiuhKg.js.map +1 -0
- package/dist/_chunks/{calendar-appointment-editor-dialog-DhTTWgXw.js → calendar-appointment-editor-dialog-BuumJbcv.js} +4 -4
- package/dist/_chunks/{calendar-appointment-editor-dialog-DhTTWgXw.js.map → calendar-appointment-editor-dialog-BuumJbcv.js.map} +1 -1
- package/dist/_chunks/{city-input-3J3bz9EO.js → city-input-CJVGswxp.js} +2 -2
- package/dist/_chunks/{city-input-3J3bz9EO.js.map → city-input-CJVGswxp.js.map} +1 -1
- package/dist/_chunks/{combobox-vF9O-QoG.js → combobox-CDPm_n0p.js} +93 -92
- package/dist/_chunks/{combobox-vF9O-QoG.js.map → combobox-CDPm_n0p.js.map} +1 -1
- package/dist/_chunks/{command-palette-D9TBzmOG.js → command-palette-B3dVqm9D.js} +68 -68
- package/dist/_chunks/{command-palette-D9TBzmOG.js.map → command-palette-B3dVqm9D.js.map} +1 -1
- package/dist/_chunks/{contact-profile-card-DKk94l-d.js → contact-profile-card-Da1vmJQI.js} +115 -102
- package/dist/_chunks/contact-profile-card-Da1vmJQI.js.map +1 -0
- package/dist/_chunks/{country-select-CSE2Zm_s.js → country-select-DQ8q7ypA.js} +2 -2
- package/dist/_chunks/{country-select-CSE2Zm_s.js.map → country-select-DQ8q7ypA.js.map} +1 -1
- package/dist/_chunks/{face-scheme-BIPJqw9f.js → face-scheme-BgJGFDTa.js} +2 -2
- package/dist/_chunks/{face-scheme-BIPJqw9f.js.map → face-scheme-BgJGFDTa.js.map} +1 -1
- package/dist/_chunks/{header-settings-BYpVmLip.js → header-settings-CifwJEKB.js} +2 -2
- package/dist/_chunks/{header-settings-BYpVmLip.js.map → header-settings-CifwJEKB.js.map} +1 -1
- package/dist/_chunks/{link-cell-renderer-B0riA_h_.js → link-cell-renderer-C0ynDik7.js} +3 -3
- package/dist/_chunks/{link-cell-renderer-B0riA_h_.js.map → link-cell-renderer-C0ynDik7.js.map} +1 -1
- package/dist/_chunks/{locale-picker-DzdGDSBI.js → locale-picker-QbT1p60X.js} +39 -38
- package/dist/_chunks/{locale-picker-DzdGDSBI.js.map → locale-picker-QbT1p60X.js.map} +1 -1
- package/dist/_chunks/{map-view-C6MIVaqn.js → map-view-Bvi06RVh.js} +2 -2
- package/dist/_chunks/{map-view-C6MIVaqn.js.map → map-view-Bvi06RVh.js.map} +1 -1
- package/dist/_chunks/{marketplace-app-shell-mS7Q2-81.js → marketplace-app-shell-vON3WhD0.js} +2 -2
- package/dist/_chunks/{marketplace-app-shell-mS7Q2-81.js.map → marketplace-app-shell-vON3WhD0.js.map} +1 -1
- package/dist/_chunks/{multi-select-BOad3za9.js → multi-select-i5MFRpXg.js} +194 -187
- package/dist/_chunks/multi-select-i5MFRpXg.js.map +1 -0
- package/dist/_chunks/{otp-input-BgEZi0py.js → otp-input-gV1446Dw.js} +70 -70
- package/dist/_chunks/otp-input-gV1446Dw.js.map +1 -0
- package/dist/_chunks/{patient-details-B-I9Xkh9.js → patient-details-D0P5eog5.js} +2 -2
- package/dist/_chunks/{patient-details-B-I9Xkh9.js.map → patient-details-D0P5eog5.js.map} +1 -1
- package/dist/_chunks/{patient-field-row-Bn0z6lAZ.js → patient-field-row-R73dZJY6.js} +5 -5
- package/dist/_chunks/{patient-field-row-Bn0z6lAZ.js.map → patient-field-row-R73dZJY6.js.map} +1 -1
- package/dist/_chunks/{patient-search-CxqNcth4.js → patient-search-Dy0sxcwv.js} +2 -2
- package/dist/_chunks/{patient-search-CxqNcth4.js.map → patient-search-Dy0sxcwv.js.map} +1 -1
- package/dist/_chunks/{patient-summary-card-bhDo0gVX.js → patient-summary-card-6U74-ivO.js} +2 -2
- package/dist/_chunks/{patient-summary-card-bhDo0gVX.js.map → patient-summary-card-6U74-ivO.js.map} +1 -1
- package/dist/_chunks/{payment-automation-upsell-AQpHOS1X.js → payment-automation-upsell-D1YdO1xY.js} +2 -2
- package/dist/_chunks/{payment-automation-upsell-AQpHOS1X.js.map → payment-automation-upsell-D1YdO1xY.js.map} +1 -1
- package/dist/_chunks/{phone-input-C3NrD-nl.js → phone-input-DJ4BN8tG.js} +70 -63
- package/dist/_chunks/{phone-input-C3NrD-nl.js.map → phone-input-DJ4BN8tG.js.map} +1 -1
- package/dist/_chunks/{practice-results-CtOanuzZ.js → practice-results-B61krlwu.js} +2 -2
- package/dist/_chunks/{practice-results-CtOanuzZ.js.map → practice-results-B61krlwu.js.map} +1 -1
- package/dist/_chunks/{province-select-CDjs5obD.js → province-select-CPdTwEob.js} +2 -2
- package/dist/_chunks/{province-select-CDjs5obD.js.map → province-select-CPdTwEob.js.map} +1 -1
- package/dist/_chunks/{registration-form-CNBfUduG.js → registration-form-DmP3YUfp.js} +3 -3
- package/dist/_chunks/{registration-form-CNBfUduG.js.map → registration-form-DmP3YUfp.js.map} +1 -1
- package/dist/_chunks/{send-registration-link-form-vTn1HxjA.js → send-registration-link-form-CZYOO7NO.js} +2 -2
- package/dist/_chunks/{send-registration-link-form-vTn1HxjA.js.map → send-registration-link-form-CZYOO7NO.js.map} +1 -1
- package/dist/_chunks/{task-editor-Cpw-NmND.js → task-editor-BOETWbjU.js} +2 -2
- package/dist/_chunks/{task-editor-Cpw-NmND.js.map → task-editor-BOETWbjU.js.map} +1 -1
- package/dist/_chunks/{use-appointment-details-read-lFUL4kkd.js → use-appointment-details-read-CWN-nJCZ.js} +2 -2
- package/dist/_chunks/{use-appointment-details-read-lFUL4kkd.js.map → use-appointment-details-read-CWN-nJCZ.js.map} +1 -1
- package/dist/agent-catalog.json +4 -4
- package/dist/agent-i18n/en.json +1 -1
- package/dist/components/address-fields/index.js +1 -1
- package/dist/components/ai-prompt-input/ai-prompt-input.d.ts.map +1 -1
- package/dist/components/ai-prompt-input/index.js +1 -1
- package/dist/components/appointment-details-panel/index.js +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/index.js +1 -1
- package/dist/components/benefit-card/benefit-card.d.ts +7 -1
- package/dist/components/benefit-card/benefit-card.d.ts.map +1 -1
- package/dist/components/benefit-card/index.js +1 -1
- package/dist/components/booking/booking-types.d.ts +35 -2
- package/dist/components/booking/booking-types.d.ts.map +1 -1
- package/dist/components/booking/booking.d.ts.map +1 -1
- package/dist/components/booking/code-step.d.ts +4 -2
- package/dist/components/booking/code-step.d.ts.map +1 -1
- package/dist/components/booking/details-form.d.ts +2 -0
- package/dist/components/booking/details-form.d.ts.map +1 -1
- package/dist/components/booking/handover.d.ts +12 -0
- package/dist/components/booking/handover.d.ts.map +1 -0
- package/dist/components/booking/index.js +1 -1
- package/dist/components/booking/reserved.d.ts +24 -0
- package/dist/components/booking/reserved.d.ts.map +1 -0
- package/dist/components/booking/use-booking-payment.d.ts +3 -1
- package/dist/components/booking/use-booking-payment.d.ts.map +1 -1
- package/dist/components/city-input/index.js +1 -1
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/index.js +1 -1
- package/dist/components/command-palette/index.js +1 -1
- package/dist/components/contact-profile-card/contact-profile-card.d.ts +4 -1
- package/dist/components/contact-profile-card/contact-profile-card.d.ts.map +1 -1
- package/dist/components/contact-profile-card/index.js +1 -1
- package/dist/components/country-select/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/face-scheme/index.js +1 -1
- package/dist/components/header-settings/index.js +1 -1
- package/dist/components/locale-picker/index.js +1 -1
- package/dist/components/locale-picker/locale-picker.d.ts.map +1 -1
- package/dist/components/map-view/index.js +1 -1
- package/dist/components/multi-select/index.js +1 -1
- package/dist/components/multi-select/multi-select.d.ts.map +1 -1
- package/dist/components/otp-input/index.js +1 -1
- package/dist/components/otp-input/otp-input.d.ts +1 -1
- package/dist/components/otp-input/otp-input.d.ts.map +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-search/index.js +1 -1
- package/dist/components/patient-summary-card/index.js +1 -1
- package/dist/components/patient-table/index.js +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/practice-results/index.js +1 -1
- package/dist/components/province-select/index.js +1 -1
- package/dist/components/task-editor/index.js +1 -1
- package/dist/i18n/locales/ar.d.ts +8 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +8 -0
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +8 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +8 -0
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +8 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +8 -0
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +8 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +8 -0
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +8 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +8 -0
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +8 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +8 -0
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +8 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +8 -0
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +8 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +8 -0
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +8 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +8 -0
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +8 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +8 -0
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +8 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +8 -0
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +8 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +8 -0
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +8 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +8 -0
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +8 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +8 -0
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +8 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +8 -0
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +8 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +8 -0
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +8 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +8 -0
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +8 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +8 -0
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +30 -30
- package/dist/locales/ar.json +8 -0
- package/dist/locales/de.json +8 -0
- package/dist/locales/el.json +8 -0
- package/dist/locales/en.json +8 -0
- package/dist/locales/es.json +8 -0
- package/dist/locales/fr.json +8 -0
- package/dist/locales/hi.json +8 -0
- package/dist/locales/it.json +8 -0
- package/dist/locales/ja.json +8 -0
- package/dist/locales/nl.json +8 -0
- package/dist/locales/pl.json +8 -0
- package/dist/locales/pt.json +8 -0
- package/dist/locales/ro.json +8 -0
- package/dist/locales/ru.json +8 -0
- package/dist/locales/sq.json +8 -0
- package/dist/locales/sv.json +8 -0
- package/dist/locales/tr.json +8 -0
- package/dist/locales/zh.json +8 -0
- package/dist/patterns/anamnesis/index.js +1 -1
- package/dist/patterns/calendar/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/payment-automation-upsell/index.js +1 -1
- package/dist/patterns/registration-form/index.js +1 -1
- package/dist/patterns/send-registration-link-form/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/booking-By4I_1A-.js +0 -4068
- package/dist/_chunks/booking-By4I_1A-.js.map +0 -1
- package/dist/_chunks/contact-profile-card-DKk94l-d.js.map +0 -1
- package/dist/_chunks/multi-select-BOad3za9.js.map +0 -1
- package/dist/_chunks/otp-input-BgEZi0py.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-select-i5MFRpXg.js","sources":["../../src/components/multi-select/multi-select.agent.ts","../../src/components/multi-select/multi-select.tsx"],"sourcesContent":["import type { AgentAdapter } from '../../agent/types';\nimport type { MultiSelectHandle } from './multi-select';\n\nexport const multiSelectAgent: AgentAdapter<MultiSelectHandle> = {\n id: 'multi-select',\n // Persisted multi-choice (selection state + set_selection) → select_multiple,\n // plus type-to-filter and open/close of the option list.\n capabilities: ['select_multiple', 'filter', 'open', 'close'],\n state: {\n selection: {\n type: 'string[]',\n descriptionKey: 'ui.agent.multiSelect.state.selection',\n description: 'Values of currently-selected options.',\n read: (handle) => handle.getSelection(),\n },\n query: {\n type: 'string',\n descriptionKey: 'ui.agent.multiSelect.state.query',\n description: 'Current filter query.',\n read: (handle) => handle.getQuery(),\n },\n isOpen: {\n type: 'boolean',\n descriptionKey: 'ui.agent.multiSelect.state.isOpen',\n description: 'True when the option list is visible.',\n read: (handle) => handle.getIsOpen(),\n },\n },\n actions: {\n set_selection: {\n // Persists the user's chosen options — reversible via the same UI.\n safety: 'write',\n argsType: '{ values: string[] }',\n argsSchema: {\n type: 'object',\n properties: {\n values: {\n type: 'array',\n items: { type: 'string' },\n description:\n 'Option values to select (replaces the current selection).',\n },\n },\n required: ['values'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.multiSelect.actions.setSelection',\n description:\n 'Replace the current selection with the given list of values.',\n examples: [\n {\n args: { values: ['a', 'b'] },\n note: 'Select exactly options \"a\" and \"b\".',\n },\n ],\n invoke: (handle, args: { values: string[] }) => {\n handle.setSelection(args.values);\n },\n },\n clear_selection: {\n // Discards the persisted selection — destructive (loses the choices).\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.multiSelect.actions.clearSelection',\n description: 'Clear the current selection.',\n invoke: (handle) => {\n handle.clearSelection();\n },\n },\n apply_filter: {\n // Pure ephemeral filter of the visible options — no persisted change.\n safety: 'read',\n argsType: '{ query: string }',\n argsSchema: {\n type: 'object',\n properties: {\n query: { type: 'string', description: 'Filter text for the list.' },\n },\n required: ['query'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.multiSelect.actions.applyFilter',\n description: 'Set the filter query for the option list.',\n invoke: (handle, args: { query: string }) => {\n handle.setQuery(args.query);\n },\n },\n open: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.multiSelect.actions.open',\n description: 'Open the option list.',\n invoke: (handle) => {\n handle.open();\n },\n },\n close: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.multiSelect.actions.close',\n description: 'Close the option list.',\n invoke: (handle) => {\n handle.close();\n },\n },\n },\n domHooks: {\n root: { attr: 'data-component', value: 'multi-select' },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n item: {\n attr: 'data-option-id',\n description: 'Each option emits its value as data-option-id.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n type Ref,\n} from 'react';\nimport * as Popover from '@radix-ui/react-popover';\nimport { Command } from 'cmdk';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Check, X } from 'lucide-react';\nimport {\n FormFieldContext,\n useFormField,\n useFormFieldControlRef,\n} from '../form-field/form-field-context';\nimport { Tooltip } from '../tooltip';\nimport type { OptionShape } from '../_shared/option';\nimport { composeRefs } from '../_shared/compose-refs';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport { useIsomorphicLayoutEffect } from '../../hooks/use-isomorphic-layout-effect';\nimport { groupOptions } from '../_shared/group-options';\nimport { MENU_ROW_HIGHLIGHT } from '../_shared/menu-row';\nimport {\n OPTION_BODY_CLASSES,\n OPTION_END_CLASSES,\n OPTION_LABEL_ROW_CLASSES,\n optionDescriptionVariants,\n optionLabelVariants,\n} from '../_shared/option-row';\nimport {\n INPUT_SURFACE_CHROME,\n INPUT_SURFACE_TEXT,\n} from '../_shared/input-surface';\nimport { useAgentRegistration } from '../../agent';\nimport { multiSelectAgent } from './multi-select.agent';\n\n// MultiSelect uses `min-h-*` (not `h-*`) because the wrapper grows vertically\n// as chips wrap to additional lines. The height floor per size mirrors the\n// other inputs' fixed heights in _shared/input-surface.ts.\nconst multiSelectVariants = cva(\n [\n 'ds:inline-flex ds:flex-wrap ds:items-center ds:gap-1 ds:w-full',\n INPUT_SURFACE_CHROME,\n 'ds:aria-[invalid=true]:border-destructive',\n 'ds:aria-disabled:cursor-not-allowed ds:aria-disabled:opacity-50',\n ],\n {\n variants: {\n size: {\n sm: `ds:min-h-8 ds:ps-2 ds:pe-2 ds:py-1 ${INPUT_SURFACE_TEXT.sm}`,\n md: `ds:min-h-[var(--min-target-size)] ds:ps-3 ds:pe-3 ds:py-1.5 ${INPUT_SURFACE_TEXT.md}`,\n lg: `ds:min-h-12 ds:ps-4 ds:pe-4 ds:py-2 ${INPUT_SURFACE_TEXT.lg}`,\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\nconst chipVariants = cva(\n [\n 'ds:inline-flex ds:items-center ds:gap-1',\n 'ds:rounded-[var(--radius-sm)] ds:border ds:border-border ds:bg-muted',\n 'ds:text-foreground ds:select-none',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-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 ],\n {\n variants: {\n size: {\n sm: 'ds:ps-2 ds:pe-1 ds:py-0.5 ds:text-[length:var(--font-size-xs)]',\n md: 'ds:ps-2 ds:pe-1 ds:py-0.5 ds:text-[length:var(--font-size-sm)]',\n lg: 'ds:ps-3 ds:pe-1.5 ds:py-1 ds:text-[length:var(--font-size-base)]',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\nconst chipDismissClasses = [\n 'ds:inline-flex ds:items-center ds:justify-center ds:shrink-0',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:text-muted-foreground ds:hover:text-foreground',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-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:size-4',\n 'ds:relative ds:before:absolute ds:before:inset-[calc((var(--min-target-size)-100%)/-2)] ds:before:content-[\"\"]',\n].join(' ');\n\nconst popoverContentClasses = [\n 'ds:z-[var(--z-dropdown)] ds:overflow-hidden',\n // At least as wide as the field, at most as wide as the screen allows: a\n // long option wraps or ends in an ellipsis instead of running off the\n // edge. The floor gives way to the cap on a field wider than that.\n 'ds:min-w-[min(var(--radix-popover-trigger-width),var(--radix-popover-content-available-width))]',\n 'ds:max-w-[var(--radix-popover-content-available-width)]',\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 commandItemClasses = [\n 'ds:relative ds:flex ds:cursor-pointer ds:items-center',\n 'ds:rounded-[var(--radius-sm)] ds:ps-2 ds:pe-2 ds:py-1.5',\n 'ds:text-[var(--font-size-sm)] ds:text-foreground ds:outline-none ds:select-none',\n MENU_ROW_HIGHLIGHT.selected,\n 'ds:aria-[disabled=true]:pointer-events-none ds:aria-[disabled=true]:opacity-50',\n 'ds:data-[disabled=true]:pointer-events-none ds:data-[disabled=true]:opacity-50',\n].join(' ');\n\nconst actionItemClasses = [\n 'ds:relative ds:flex ds:cursor-pointer ds:items-center',\n 'ds:rounded-[var(--radius-sm)] ds:ps-2 ds:pe-2 ds:py-1.5',\n 'ds:text-[var(--font-size-sm)] ds:font-medium ds:text-primary ds:outline-none ds:select-none',\n MENU_ROW_HIGHLIGHT.selected,\n].join(' ');\n\nconst SELECT_ALL_VALUE = '__ui-multiselect-select-all__';\nconst CLEAR_ALL_VALUE = '__ui-multiselect-clear-all__';\n\ntype HTMLDivAttributes = HTMLAttributes<HTMLDivElement>;\n\n// Curated agent-readiness handle — see multi-select.agent.ts.\nexport interface MultiSelectHandle {\n getSelection: () => string[];\n getQuery: () => string;\n getIsOpen: () => boolean;\n setSelection: (values: string[]) => void;\n clearSelection: () => void;\n setQuery: (query: string) => void;\n open: () => void;\n close: () => void;\n}\n\nexport interface MultiSelectProps<T extends string = string>\n extends\n Omit<HTMLDivAttributes, 'onChange'>,\n VariantProps<typeof multiSelectVariants> {\n options: OptionShape<T>[];\n value?: T[];\n defaultValue?: T[];\n onChange?: (next: T[]) => void;\n onComplete?: (values: T[]) => void;\n placeholder?: string;\n maxSelections?: number;\n allowSelectAll?: boolean;\n allowClear?: boolean;\n filter?: (query: string, option: OptionShape<T>) => boolean;\n size?: 'sm' | 'md' | 'lg';\n disabled?: boolean;\n /**\n * Let a long option label wrap onto a second line instead of ending in an\n * ellipsis. Longer still, it is clipped after two lines. Off by default.\n * An option's `description` always sits on its own line under the label.\n */\n wrapOptionLabels?: boolean;\n}\n\nconst MultiSelectImpl = forwardRef<HTMLDivElement, MultiSelectProps>(\n function MultiSelect(\n {\n options,\n value,\n defaultValue,\n onChange,\n onComplete,\n placeholder,\n maxSelections,\n allowSelectAll = false,\n allowClear = false,\n filter,\n size = 'md',\n disabled,\n wrapOptionLabels = false,\n className,\n id,\n // Pull `aria-label` out of the div spread so it names the combobox\n // INPUT (the interactive control) rather than the wrapper div. Lets a\n // consumer give the trigger a meaningful name when there's no visible\n // label or FormField (e.g. a data-table floating filter naming itself\n // after its column). Untouched callers fall back to the placeholder.\n // Inside a FormField the field's label names the input and this is\n // ignored, so it can never override the visible text (WCAG 2.5.3).\n 'aria-label': ariaLabel,\n ...divProps\n },\n ref,\n ) {\n const { t } = useTranslation('ui');\n const ctx = useFormField();\n const inFormField = useContext(FormFieldContext) !== null;\n\n const [currentValueRaw, setMultiSelectValue] = useControllableState<\n string[]\n >({\n value,\n defaultValue: defaultValue ?? [],\n onChange,\n });\n const currentValue = currentValueRaw ?? [];\n\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState('');\n\n const inputRef = useRef<HTMLInputElement>(null);\n const counterId = `${useId()}-count`;\n const chipRefs = useRef<Array<HTMLSpanElement | null>>([]);\n const triggerRef = useRef<HTMLDivElement>(null);\n const composedRef = composeRefs<HTMLDivElement>(ref, triggerRef);\n\n // Chips are spans: a disabled ancestor fieldset does not reach them.\n const [inDisabledFieldset, setInDisabledFieldset] = useState(false);\n useIsomorphicLayoutEffect(() => {\n setInDisabledFieldset(\n Boolean(triggerRef.current?.closest('fieldset:disabled')),\n );\n });\n const effectiveDisabled =\n (inFormField && ctx.disabled) || Boolean(disabled) || inDisabledFieldset;\n const effectiveRequired = inFormField && ctx.required;\n const effectiveInvalid = inFormField && ctx.invalid;\n const describedBy =\n inFormField && ctx.describedBy ? ctx.describedBy : undefined;\n const triggerId = id ?? (inFormField ? ctx.id : undefined);\n /* cmdk writes its own id on the input, so the field's label follows\n that one. */\n useFormFieldControlRef(ctx, inputRef);\n\n const labelByValue = useMemo(() => {\n const map = new Map<string, string>();\n for (const option of options) map.set(option.value, option.label);\n return map;\n }, [options]);\n const dirByValue = useMemo(() => {\n const map = new Map<string, OptionShape['dir']>();\n for (const option of options) map.set(option.value, option.dir);\n return map;\n }, [options]);\n\n const atCap =\n typeof maxSelections === 'number' && currentValue.length >= maxSelections;\n\n const commit = (next: string[]): void => {\n setMultiSelectValue(next);\n };\n\n const toggle = (val: string): void => {\n if (currentValue.includes(val)) {\n commit(currentValue.filter((v) => v !== val));\n return;\n }\n if (atCap) return;\n commit([...currentValue, val]);\n };\n\n const removeAt = (index: number): string[] => {\n const next = currentValue.filter((_, i) => i !== index);\n commit(next);\n return next;\n };\n\n const handleSelectAll = (): void => {\n const selectable = options.filter((o) => !o.disabled).map((o) => o.value);\n const cap =\n typeof maxSelections === 'number' ? maxSelections : selectable.length;\n commit(selectable.slice(0, cap));\n };\n\n const handleClearAll = (): void => {\n commit([]);\n };\n\n // Agent handle — refs for fresh reads from the memoized handle.\n const valueRef = useRef<string[]>(currentValue);\n useEffect(() => {\n valueRef.current = currentValue;\n }, [currentValue]);\n const queryRef = useRef<string>(query);\n useEffect(() => {\n queryRef.current = query;\n }, [query]);\n const openRef = useRef<boolean>(open);\n useEffect(() => {\n openRef.current = open;\n }, [open]);\n\n const commitStable = useCallback(\n (next: string[]) => {\n setMultiSelectValue(next);\n },\n [setMultiSelectValue],\n );\n\n const agentHandle = useMemo<MultiSelectHandle>(\n () => ({\n getSelection: () => [...valueRef.current],\n getQuery: () => queryRef.current,\n getIsOpen: () => openRef.current,\n setSelection: (values) => commitStable(values),\n clearSelection: () => commitStable([]),\n setQuery: (next) => setQuery(next),\n open: () => setOpen(true),\n close: () => setOpen(false),\n }),\n [commitStable],\n );\n useAgentRegistration(multiSelectAgent, agentHandle, id);\n\n const resolvedPlaceholder =\n placeholder ?? t('inputs.multiSelect.placeholder', 'Select…');\n\n const filteredOptions = useMemo(() => {\n if (!query) return options;\n const needle = query.toLowerCase();\n return options.filter((option) => {\n if (filter) return filter(query, option);\n return option.label.toLowerCase().includes(needle);\n });\n }, [options, query, filter]);\n\n const groups = useMemo(\n () => groupOptions(filteredOptions),\n [filteredOptions],\n );\n\n const handleInputKeyDown = (e: KeyboardEvent<HTMLInputElement>): void => {\n const target = e.currentTarget;\n if (e.key === 'Backspace' && query === '' && currentValue.length > 0) {\n e.preventDefault();\n const removedIndex = currentValue.length - 1;\n const next = removeAt(removedIndex);\n const newLast = next.length - 1;\n if (newLast >= 0) {\n requestAnimationFrame(() => {\n chipRefs.current[newLast]?.focus();\n });\n }\n return;\n }\n const caretAtStart =\n target.selectionStart === 0 && target.selectionEnd === 0;\n if (\n (e.key === 'ArrowLeft' || e.key === 'ArrowRight') &&\n caretAtStart &&\n currentValue.length > 0\n ) {\n const isRTL = document.dir === 'rtl' || target.dir === 'rtl';\n const shouldNavigate =\n (isRTL && e.key === 'ArrowRight') ||\n (!isRTL && e.key === 'ArrowLeft');\n if (shouldNavigate) {\n e.preventDefault();\n const lastIdx = currentValue.length - 1;\n chipRefs.current[lastIdx]?.focus();\n }\n return;\n }\n if (e.key === 'Escape') {\n setOpen(false);\n return;\n }\n if (!open && (e.key === 'ArrowDown' || e.key === 'Enter')) {\n setOpen(true);\n }\n };\n\n const handleChipKeyDown =\n (index: number) =>\n (e: KeyboardEvent<HTMLSpanElement>): void => {\n if (\n e.key === 'Backspace' ||\n e.key === 'Delete' ||\n e.key === 'Enter' ||\n e.key === ' '\n ) {\n e.preventDefault();\n e.stopPropagation();\n const next = removeAt(index);\n if (next.length === 0) {\n requestAnimationFrame(() => inputRef.current?.focus());\n return;\n }\n const focusIdx = Math.min(index, next.length - 1);\n requestAnimationFrame(() => {\n chipRefs.current[focusIdx]?.focus();\n });\n return;\n }\n const isRTL = document.dir === 'rtl';\n const prevKey = isRTL ? 'ArrowRight' : 'ArrowLeft';\n const nextKey = isRTL ? 'ArrowLeft' : 'ArrowRight';\n if (e.key === prevKey) {\n e.preventDefault();\n const newIdx = Math.max(0, index - 1);\n chipRefs.current[newIdx]?.focus();\n return;\n }\n if (e.key === nextKey) {\n e.preventDefault();\n if (index < currentValue.length - 1) {\n chipRefs.current[index + 1]?.focus();\n } else {\n inputRef.current?.focus();\n }\n return;\n }\n if (e.key === 'Escape') {\n setOpen(false);\n inputRef.current?.focus();\n }\n };\n\n // ----- Chip overflow measurement -----\n // The measurement must read the FULL chip row, never the collapsed one.\n // Counting only the rendered (collapsed) chips is self-referential: hiding\n // the overflow behind \"+N more\" leaves a subset that trivially fits row 1,\n // the next measure concludes \"everything fits\", it expands, re-wraps, and\n // the ResizeObserver oscillates every frame (the visible flicker).\n //\n // Instead we run a two-pass cycle driven by `measureNonce`: a request first\n // renders every chip (visibleCount → ∞), then the layout effect measures\n // that complete row and sets the collapsed count. Both passes are layout\n // effects, so React flushes them before paint — the browser only ever shows\n // the settled, single-line result, with no full-row flash.\n const [visibleCount, setVisibleCount] = useState<number>(\n Number.POSITIVE_INFINITY,\n );\n const [measureNonce, setMeasureNonce] = useState<number>(0);\n const lastWidthRef = useRef<number>(-1);\n\n const requestMeasure = useCallback((): void => {\n setVisibleCount(Number.POSITIVE_INFINITY);\n setMeasureNonce((n) => n + 1);\n }, []);\n\n // Pass two: the \"show all\" render has committed — measure the true wrap\n // point off the complete chip row and collapse to it. Runs once per request\n // (keyed on measureNonce); collapsing does not bump the nonce, so it settles.\n useIsomorphicLayoutEffect(() => {\n const el = triggerRef.current;\n if (!el) return;\n const chipEls = Array.from(\n el.querySelectorAll<HTMLElement>('[data-ui-chip=\"true\"]'),\n );\n if (chipEls.length === 0) {\n setVisibleCount(Number.POSITIVE_INFINITY);\n return;\n }\n const firstTop = chipEls[0].offsetTop;\n let firstRowCount = 0;\n for (const chip of chipEls) {\n if (chip.offsetTop === firstTop) firstRowCount++;\n else break;\n }\n setVisibleCount(\n firstRowCount === chipEls.length\n ? Number.POSITIVE_INFINITY\n : Math.max(1, firstRowCount - 1),\n );\n }, [measureNonce]);\n\n // Re-measure whenever the selected set or the size variant changes.\n useIsomorphicLayoutEffect(() => {\n requestMeasure();\n }, [currentValue.length, size, requestMeasure]);\n\n // Re-measure on a real width change only. Collapsing shrinks the trigger's\n // height, not its width, so a width guard keeps that from re-triggering the\n // cycle — the ResizeObserver never chases its own output.\n useIsomorphicLayoutEffect(() => {\n const el = triggerRef.current;\n if (!el) return;\n const ro = new ResizeObserver((entries) => {\n const width = Math.round(\n entries[0]?.contentRect.width ?? el.clientWidth,\n );\n if (width === lastWidthRef.current) return;\n lastWidthRef.current = width;\n requestMeasure();\n });\n ro.observe(el);\n return () => ro.disconnect();\n }, [requestMeasure]);\n\n const chips = currentValue.map((val) => ({\n value: val,\n label: labelByValue.get(val) ?? val,\n }));\n\n const showAllChips =\n visibleCount === Number.POSITIVE_INFINITY || visibleCount >= chips.length;\n const visibleChips = showAllChips ? chips : chips.slice(0, visibleCount);\n const overflowChips = showAllChips ? [] : chips.slice(visibleCount);\n const overflowCount = overflowChips.length;\n\n const handleTriggerClick = (event: MouseEvent<HTMLDivElement>): void => {\n if (effectiveDisabled) return;\n // Ignore clicks on chips/buttons so they can manage their own focus.\n const target = event.target as HTMLElement;\n if (target.closest('[data-ui-chip=\"true\"]')) return;\n if (target.closest('[data-ui-chip-dismiss=\"true\"]')) return;\n setOpen(true);\n inputRef.current?.focus();\n };\n\n const handleOpenChange = (next: boolean): void => {\n if (effectiveDisabled) {\n setOpen(false);\n return;\n }\n setOpen(next);\n if (!next) {\n setQuery('');\n onComplete?.(currentValue);\n }\n };\n\n const hasActionRow = allowSelectAll || allowClear;\n\n const counterMessage = t('inputs.multiSelect.selected', {\n count: currentValue.length,\n defaultValue: `${currentValue.length} selected`,\n });\n\n /* cmdk writes `aria-labelledby` on the input after the props it is\n given, pointing at its own hidden `<label cmdk-label>` whose text is\n the Command root's `label`. So that label is the input's name: the\n host's `aria-label`, else the placeholder, so the input is never\n unnamed. The count of chosen options describes the input rather than\n naming it. */\n const accessibleName =\n (inFormField ? ctx.label || ariaLabel : ariaLabel) || resolvedPlaceholder;\n const inputDescribedBy = [counterId, describedBy].filter(Boolean).join(' ');\n\n /* Inside a FormField the name is the field's own `<label>`, read whole,\n as for every other control: its labelStart and labelEnd marks and\n \"(optional)\" join it, and the host's `aria-label` never overrides\n that visible text. cmdk's hidden label holds the label string only,\n so the input is pointed at the field's label instead. React leaves\n the attribute alone afterwards: cmdk's prop for it never changes. */\n const fieldLabelId = inFormField ? `${ctx.id}-label` : undefined;\n const cmdkLabelledBy = useRef<string | null>(null);\n useIsomorphicLayoutEffect(() => {\n const input = inputRef.current;\n if (!input) return;\n const current = input.getAttribute('aria-labelledby');\n if (fieldLabelId) {\n if (current === fieldLabelId) return;\n cmdkLabelledBy.current = current;\n input.setAttribute('aria-labelledby', fieldLabelId);\n } else if (cmdkLabelledBy.current !== null) {\n // Out of the field again: back to cmdk's own label.\n input.setAttribute('aria-labelledby', cmdkLabelledBy.current);\n cmdkLabelledBy.current = null;\n }\n });\n\n const { onClick: onClickProp, ...restDivProps } = divProps;\n\n return (\n <Command shouldFilter={false} label={accessibleName}>\n <Popover.Root open={open} onOpenChange={handleOpenChange}>\n <Popover.Anchor asChild>\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions -- compound input shell; keyboard handling lives on the inner searchable input which is always rendered */}\n <div\n ref={composedRef}\n className={multiSelectVariants({ size, className })}\n aria-disabled={effectiveDisabled || undefined}\n aria-invalid={effectiveInvalid || undefined}\n data-component=\"multi-select\"\n data-component-id={id}\n onClick={(event) => {\n onClickProp?.(event);\n handleTriggerClick(event);\n }}\n {...restDivProps}\n >\n {visibleChips.map((chip, idx) => (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions -- chip pill receives focus via roving tabindex; chip removal uses an inner button\n <span\n key={chip.value}\n ref={(el) => {\n chipRefs.current[idx] = el;\n }}\n tabIndex={effectiveDisabled ? -1 : 0}\n data-ui-chip=\"true\"\n className={chipVariants({ size })}\n onKeyDown={handleChipKeyDown(idx)}\n aria-label={chip.label}\n >\n <span dir={dirByValue.get(chip.value)}>{chip.label}</span>\n <button\n type=\"button\"\n tabIndex={-1}\n data-ui-chip-dismiss=\"true\"\n aria-label={t('inputs.multiSelect.remove', {\n label: chip.label,\n defaultValue: `Remove ${chip.label}`,\n })}\n disabled={effectiveDisabled}\n onClick={(event) => {\n event.stopPropagation();\n removeAt(idx);\n requestAnimationFrame(() => inputRef.current?.focus());\n }}\n className={chipDismissClasses}\n >\n <X aria-hidden=\"true\" className=\"ds:size-3.5\" />\n </button>\n </span>\n ))}\n {overflowCount > 0 ? (\n <Tooltip\n label={overflowChips.map((c) => c.label).join(', ')}\n delayDuration={200}\n >\n <span\n className={chipVariants({ size })}\n tabIndex={effectiveDisabled ? -1 : 0}\n role=\"button\"\n aria-label={t('inputs.multiSelect.overflow', {\n count: overflowCount,\n defaultValue: `+${overflowCount} more`,\n })}\n >\n <span>\n {t('inputs.multiSelect.overflow', {\n count: overflowCount,\n defaultValue: `+${overflowCount} more`,\n })}\n </span>\n </span>\n </Tooltip>\n ) : null}\n <Command.Input\n ref={inputRef}\n value={query}\n onValueChange={setQuery}\n onKeyDown={handleInputKeyDown}\n onFocus={() => {\n if (!effectiveDisabled) setOpen(true);\n }}\n placeholder={\n currentValue.length === 0 ? resolvedPlaceholder : ''\n }\n id={triggerId}\n // The name comes from the Command root's `label` above, or\n // from the FormField's label: cmdk writes `aria-labelledby`\n // after these props, and a layout effect above re-points it.\n aria-describedby={inputDescribedBy}\n aria-invalid={effectiveInvalid || undefined}\n aria-required={effectiveRequired || undefined}\n disabled={effectiveDisabled}\n className={[\n 'ds:flex-1 ds:min-w-[6rem] ds:bg-transparent ds:outline-none',\n 'ds:placeholder:text-muted-foreground ds:text-start',\n 'ds:disabled:cursor-not-allowed',\n ].join(' ')}\n />\n {/* Hidden: read only as the input's description, not as stray\n text on the page. */}\n <span id={counterId} hidden>\n {counterMessage}\n </span>\n </div>\n </Popover.Anchor>\n <Popover.Portal>\n {/* Portalled to <body>, so the list carries its own bounding\n marker: the kit's cascade reset — and a host's shield against\n its own bare-element CSS — scope to [data-component]. */}\n <Popover.Content\n data-component=\"multi-select-list\"\n onOpenAutoFocus={(e) => e.preventDefault()}\n onCloseAutoFocus={(e) => e.preventDefault()}\n align=\"start\"\n sideOffset={4}\n collisionPadding={8}\n className={popoverContentClasses}\n >\n <Command.List\n role=\"listbox\"\n aria-multiselectable=\"true\"\n // cmdk writes its own aria-label after ours, \"Suggestions\"\n // in English unless it gets `label`.\n label={accessibleName}\n className=\"ds:max-h-[20rem] ds:overflow-y-auto ds:p-1\"\n >\n {hasActionRow ? (\n <Command.Group>\n {allowSelectAll ? (\n <Command.Item\n value={SELECT_ALL_VALUE}\n onSelect={handleSelectAll}\n className={actionItemClasses}\n >\n {t('inputs.multiSelect.selectAll', 'Select all')}\n </Command.Item>\n ) : null}\n {allowClear ? (\n <Command.Item\n value={CLEAR_ALL_VALUE}\n onSelect={handleClearAll}\n className={actionItemClasses}\n >\n {t('inputs.multiSelect.clearAll', 'Clear all')}\n </Command.Item>\n ) : null}\n </Command.Group>\n ) : null}\n <Command.Empty className=\"ds:ps-2 ds:pe-2 ds:py-2 type-body-sm ds:text-muted-foreground\">\n {t('inputs.multiSelect.noOptions', 'No options found')}\n </Command.Empty>\n {groups.map(({ group, items }, gi) => {\n const body = items.map((option) => {\n const isSelected = currentValue.includes(option.value);\n const isCapped = !isSelected && atCap;\n const isDisabled = Boolean(option.disabled) || isCapped;\n const item = (\n <Command.Item\n key={option.value}\n value={option.value}\n // Agent DOM hook — see multi-select.agent.ts item.\n data-option-id={option.value}\n disabled={isDisabled}\n onSelect={() => {\n if (isDisabled) return;\n toggle(option.value);\n }}\n aria-selected={isSelected}\n aria-disabled={isDisabled || undefined}\n className={commandItemClasses}\n >\n <span\n // Off, the box is a state indicator, so its edge is\n // the 3:1 --control-border (WCAG 1.4.11), as on\n // Checkbox.\n className={[\n 'ds:inline-flex ds:items-center ds:justify-center ds:me-[var(--spacing-xs)] ds:shrink-0',\n 'ds:size-4 ds:rounded-[var(--radius-sm)] ds:border',\n isSelected\n ? 'ds:bg-primary ds:border-primary ds:text-primary-foreground'\n : 'ds:bg-background ds:border-[color:var(--control-border)]',\n ].join(' ')}\n aria-hidden=\"true\"\n >\n {isSelected ? (\n <Check className=\"ds:size-3.5\" />\n ) : null}\n </span>\n {option.startAdornment ? (\n // Decorative by contract — the accessible name comes\n // from the option label.\n <span\n aria-hidden=\"true\"\n className=\"ds:inline-flex ds:items-center ds:shrink-0 ds:me-[var(--spacing-xs)]\"\n >\n {option.startAdornment}\n </span>\n ) : null}\n {option.description || wrapOptionLabels ? (\n // Stacked, as in Combobox: the label and its end\n // content on one row, the description under them.\n // The option's name reads in that order.\n <span className={OPTION_BODY_CLASSES}>\n <span className={OPTION_LABEL_ROW_CLASSES}>\n <span\n dir={option.dir}\n className={optionLabelVariants({\n wrap: wrapOptionLabels,\n className: 'ds:flex-1 ds:text-start',\n })}\n >\n {option.label}\n </span>\n {option.endContent ? (\n // Announced, as below.\n <span className={OPTION_END_CLASSES}>\n {option.endContent}\n </span>\n ) : null}\n </span>\n {option.description ? (\n <span\n className={optionDescriptionVariants({\n tone: option.descriptionTone,\n className: 'ds:text-start',\n })}\n >\n {option.description}\n </span>\n ) : null}\n </span>\n ) : (\n <>\n {/* `min-w-0 truncate` matches Combobox and Select.\n Without it a long service name cannot be\n clipped, so it pushes the trailing content and\n overflows the row instead of the name\n ellipsing — the CJK and long-label case. */}\n <span\n dir={option.dir}\n className=\"ds:flex-1 ds:min-w-0 ds:truncate ds:text-start\"\n >\n {option.label}\n </span>\n {option.endContent ? (\n // Deliberately NOT aria-hidden — unlike\n // `startAdornment`, this slot carries meaning\n // (a price, a count) and must reach the\n // option's accessible name. `ms-auto` pins it\n // to the inline-end and flips under RTL.\n <span className=\"ds:inline-flex ds:items-center ds:ms-auto ds:shrink-0 ds:ps-[var(--spacing-xs)]\">\n {option.endContent}\n </span>\n ) : null}\n </>\n )}\n </Command.Item>\n );\n if (isCapped) {\n return (\n <Tooltip\n key={option.value}\n label={t('inputs.multiSelect.maxReached', {\n count: maxSelections,\n defaultValue: `Maximum ${maxSelections} selections`,\n })}\n delayDuration={200}\n >\n {item}\n </Tooltip>\n );\n }\n return item;\n });\n if (!group) {\n return (\n <Command.Group key={`group-${gi}`}>{body}</Command.Group>\n );\n }\n return (\n <Command.Group\n key={`group-${group}`}\n heading={group}\n className=\"ds:[&_[cmdk-group-heading]]:ps-2 ds:[&_[cmdk-group-heading]]:pe-2 ds:[&_[cmdk-group-heading]]:py-1 ds:[&_[cmdk-group-heading]]:type-eyebrow ds:[&_[cmdk-group-heading]]:text-muted-foreground\"\n >\n {body}\n </Command.Group>\n );\n })}\n </Command.List>\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n </Command>\n );\n },\n);\nMultiSelectImpl.displayName = 'MultiSelect';\n\ninterface MultiSelectComponent {\n <T extends string = string>(\n props: MultiSelectProps<T> & { ref?: Ref<HTMLDivElement> },\n ): ReactElement | null;\n displayName?: string;\n}\n\nexport const MultiSelect = MultiSelectImpl as unknown as MultiSelectComponent;\n\nexport { multiSelectVariants };\n"],"names":["multiSelectAgent","handle","args","multiSelectVariants","cva","INPUT_SURFACE_CHROME","INPUT_SURFACE_TEXT","chipVariants","chipDismissClasses","popoverContentClasses","commandItemClasses","MENU_ROW_HIGHLIGHT","actionItemClasses","SELECT_ALL_VALUE","CLEAR_ALL_VALUE","MultiSelectImpl","forwardRef","options","value","defaultValue","onChange","onComplete","placeholder","maxSelections","allowSelectAll","allowClear","filter","size","disabled","wrapOptionLabels","className","id","ariaLabel","divProps","ref","t","useTranslation","ctx","useFormField","inFormField","useContext","FormFieldContext","currentValueRaw","setMultiSelectValue","useControllableState","currentValue","open","setOpen","useState","query","setQuery","inputRef","useRef","counterId","useId","chipRefs","triggerRef","composedRef","composeRefs","inDisabledFieldset","setInDisabledFieldset","useIsomorphicLayoutEffect","_a","effectiveDisabled","effectiveRequired","effectiveInvalid","describedBy","triggerId","useFormFieldControlRef","labelByValue","useMemo","map","option","dirByValue","atCap","commit","next","toggle","val","v","removeAt","index","_","i","handleSelectAll","selectable","o","cap","handleClearAll","valueRef","useEffect","queryRef","openRef","commitStable","useCallback","agentHandle","values","useAgentRegistration","resolvedPlaceholder","filteredOptions","needle","groups","groupOptions","handleInputKeyDown","target","removedIndex","newLast","caretAtStart","isRTL","lastIdx","handleChipKeyDown","e","focusIdx","prevKey","nextKey","newIdx","_b","_c","_d","visibleCount","setVisibleCount","measureNonce","setMeasureNonce","lastWidthRef","requestMeasure","n","el","chipEls","firstTop","firstRowCount","chip","ro","entries","width","chips","showAllChips","visibleChips","overflowChips","overflowCount","handleTriggerClick","event","handleOpenChange","hasActionRow","counterMessage","accessibleName","inputDescribedBy","fieldLabelId","cmdkLabelledBy","input","current","onClickProp","restDivProps","jsx","Command","jsxs","Popover","idx","X","Tooltip","c","group","items","gi","body","isSelected","isCapped","isDisabled","item","Check","OPTION_BODY_CLASSES","OPTION_LABEL_ROW_CLASSES","optionLabelVariants","OPTION_END_CLASSES","optionDescriptionVariants","Fragment","MultiSelect"],"mappings":";;;;;;;;;;;;;;;;;;AAGO,MAAMA,KAAoD;AAAA,EAC/D,IAAI;AAAA;AAAA;AAAA,EAGJ,cAAc,CAAC,mBAAmB,UAAU,QAAQ,OAAO;AAAA,EAC3D,OAAO;AAAA,IACL,WAAW;AAAA,MACT,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,aAAA;AAAA,IAAa;AAAA,IAExC,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAE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he = {
|
|
|
46
46
|
examples: [{ args: { value: "123456" } }],
|
|
47
47
|
descriptionKey: "ui.agent.otpInput.actions.setValue",
|
|
48
48
|
description: "Replace the entered digits.",
|
|
49
|
-
invoke: (a,
|
|
50
|
-
a.setValue(
|
|
49
|
+
invoke: (a, o) => {
|
|
50
|
+
a.setValue(o.value);
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
clear: {
|
|
@@ -103,18 +103,18 @@ const he = {
|
|
|
103
103
|
}
|
|
104
104
|
);
|
|
105
105
|
function z(a) {
|
|
106
|
-
return a.replace(/[\u0660-\u0669]/g, (
|
|
106
|
+
return a.replace(/[\u0660-\u0669]/g, (o) => String(o.charCodeAt(0) - 1632)).replace(/[\u06F0-\u06F9]/g, (o) => String(o.charCodeAt(0) - 1776));
|
|
107
107
|
}
|
|
108
108
|
const ye = 3, we = 10;
|
|
109
109
|
function Ie(a) {
|
|
110
|
-
const
|
|
111
|
-
return Math.max(ye, Math.min(we,
|
|
110
|
+
const o = Number.isFinite(a) ? Math.floor(a) : 6;
|
|
111
|
+
return Math.max(ye, Math.min(we, o));
|
|
112
112
|
}
|
|
113
|
-
function k(a,
|
|
114
|
-
return (g === "alphanumeric" ? a.replace(/[^A-Za-z0-9]/g, "").toUpperCase() : z(a).replace(/\D/g, "")).slice(0,
|
|
113
|
+
function k(a, o, g) {
|
|
114
|
+
return (g === "alphanumeric" ? a.replace(/[^A-Za-z0-9]/g, "").toUpperCase() : z(a).replace(/\D/g, "")).slice(0, o);
|
|
115
115
|
}
|
|
116
|
-
function ke(a,
|
|
117
|
-
const p = k(a,
|
|
116
|
+
function ke(a, o, g) {
|
|
117
|
+
const p = k(a, o, g), d = new Array(o).fill("");
|
|
118
118
|
for (let m = 0; m < p.length; m += 1)
|
|
119
119
|
d[m] = p[m];
|
|
120
120
|
return d;
|
|
@@ -122,7 +122,7 @@ function ke(a, n, g) {
|
|
|
122
122
|
const Ve = se(
|
|
123
123
|
({
|
|
124
124
|
length: a = 6,
|
|
125
|
-
value:
|
|
125
|
+
value: o,
|
|
126
126
|
defaultValue: g,
|
|
127
127
|
onChange: p,
|
|
128
128
|
onComplete: d,
|
|
@@ -137,29 +137,29 @@ const Ve = se(
|
|
|
137
137
|
mode: i = "numeric"
|
|
138
138
|
}, q) => {
|
|
139
139
|
const { t: x } = ue("ui"), r = Ie(a), v = fe(), G = ne(), B = V ? G : void 0, [W, H] = pe({
|
|
140
|
-
value:
|
|
140
|
+
value: o,
|
|
141
141
|
defaultValue: k(g ?? "", r, i)
|
|
142
142
|
}), h = k(W ?? "", r, i), X = ke(h, r, i), y = v.disabled || !!m, O = v.invalid || !!$, J = O ? "error" : "default", P = R([]), D = R(h.length === r), f = R(h);
|
|
143
143
|
f.current = h;
|
|
144
144
|
const Q = () => {
|
|
145
|
-
const
|
|
146
|
-
return
|
|
145
|
+
const e = h.length;
|
|
146
|
+
return e >= r ? r - 1 : e;
|
|
147
147
|
}, [b, A] = oe(Q);
|
|
148
148
|
ie(() => {
|
|
149
149
|
b >= r && A(r - 1);
|
|
150
150
|
}, [b, r]);
|
|
151
151
|
const l = S(
|
|
152
|
-
(t) => {
|
|
153
|
-
const
|
|
154
|
-
A(
|
|
155
|
-
const s = P.current[
|
|
156
|
-
s && (s.focus(), s.select());
|
|
152
|
+
(e, t) => {
|
|
153
|
+
const n = Math.max(0, Math.min(r - 1, e));
|
|
154
|
+
A(n);
|
|
155
|
+
const s = P.current[n];
|
|
156
|
+
s && (s.focus(t), s.select());
|
|
157
157
|
},
|
|
158
158
|
[r]
|
|
159
159
|
), u = S(
|
|
160
|
-
(
|
|
161
|
-
const
|
|
162
|
-
H(
|
|
160
|
+
(e) => {
|
|
161
|
+
const t = k(e, r, i);
|
|
162
|
+
H(t), f.current = t, p == null || p(t), t.length === r ? D.current || (D.current = !0, d == null || d(t)) : D.current = !1;
|
|
163
163
|
},
|
|
164
164
|
[H, r, i, p, d]
|
|
165
165
|
);
|
|
@@ -167,67 +167,67 @@ const Ve = se(
|
|
|
167
167
|
enabled: U && !y,
|
|
168
168
|
onCode: u
|
|
169
169
|
});
|
|
170
|
-
const Y = (
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
173
|
-
if (
|
|
174
|
-
const N = c.slice(0,
|
|
170
|
+
const Y = (e) => (t) => {
|
|
171
|
+
const n = t.target.value, s = i === "alphanumeric" ? n.replace(/[^A-Za-z0-9]/g, "").toUpperCase() : z(n).replace(/\D/g, ""), c = f.current;
|
|
172
|
+
if (s.length === 0) {
|
|
173
|
+
if (n === "" && e < c.length) {
|
|
174
|
+
const N = c.slice(0, e) + c.slice(e + 1);
|
|
175
175
|
u(N);
|
|
176
176
|
}
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
179
|
-
const w = c.slice(0,
|
|
179
|
+
const w = c.slice(0, e), C = c.slice(e + s.length), F = (w + s + C).slice(0, r);
|
|
180
180
|
u(F);
|
|
181
|
-
const L = Math.min(
|
|
181
|
+
const L = Math.min(e + s.length, r - 1);
|
|
182
182
|
l(L);
|
|
183
|
-
}, ee = (
|
|
184
|
-
const
|
|
185
|
-
if (
|
|
186
|
-
if (
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
u(
|
|
183
|
+
}, ee = (e) => (t) => {
|
|
184
|
+
const n = f.current;
|
|
185
|
+
if (t.key === "Backspace") {
|
|
186
|
+
if (n[e]) {
|
|
187
|
+
t.preventDefault();
|
|
188
|
+
const s = n.slice(0, e) + n.slice(e + 1);
|
|
189
|
+
u(s);
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
|
-
if (
|
|
193
|
-
|
|
194
|
-
const
|
|
195
|
-
u(
|
|
192
|
+
if (e > 0) {
|
|
193
|
+
t.preventDefault();
|
|
194
|
+
const s = n.slice(0, e - 1) + n.slice(e);
|
|
195
|
+
u(s), l(e - 1);
|
|
196
196
|
}
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
|
-
if (
|
|
200
|
-
|
|
199
|
+
if (t.key === "ArrowLeft") {
|
|
200
|
+
t.preventDefault(), e > 0 && l(e - 1);
|
|
201
201
|
return;
|
|
202
202
|
}
|
|
203
|
-
if (
|
|
204
|
-
|
|
203
|
+
if (t.key === "ArrowRight") {
|
|
204
|
+
t.preventDefault(), e < r - 1 && l(e + 1);
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
|
-
if (
|
|
208
|
-
|
|
207
|
+
if (t.key === "Home") {
|
|
208
|
+
t.preventDefault(), l(0);
|
|
209
209
|
return;
|
|
210
210
|
}
|
|
211
|
-
|
|
212
|
-
}, te = (
|
|
213
|
-
const
|
|
211
|
+
t.key === "End" && (t.preventDefault(), l(r - 1));
|
|
212
|
+
}, te = (e) => (t) => {
|
|
213
|
+
const s = t.clipboardData.getData("text").replace(/\s+/g, ""), c = i === "alphanumeric" ? s.replace(/[^A-Za-z0-9]/g, "").toUpperCase() : z(s);
|
|
214
214
|
if (i === "alphanumeric" ? c.length === 0 : !/^[0-9]+$/.test(c))
|
|
215
215
|
return;
|
|
216
|
-
|
|
217
|
-
const w = f.current, C = w.slice(0,
|
|
216
|
+
t.preventDefault();
|
|
217
|
+
const w = f.current, C = w.slice(0, e), F = w.slice(e + c.length), L = (C + c + F).slice(0, r);
|
|
218
218
|
u(L);
|
|
219
|
-
const N = Math.min(
|
|
219
|
+
const N = Math.min(e + c.length, r - 1);
|
|
220
220
|
l(N);
|
|
221
|
-
}, re = (
|
|
222
|
-
A(
|
|
221
|
+
}, re = (e) => (t) => {
|
|
222
|
+
A(e), t.currentTarget.select();
|
|
223
223
|
}, T = v.id;
|
|
224
224
|
ge(v, `${T}-0`);
|
|
225
225
|
const M = ce(
|
|
226
226
|
() => ({
|
|
227
227
|
getValue: () => f.current,
|
|
228
|
-
setValue: (
|
|
228
|
+
setValue: (e) => u(e),
|
|
229
229
|
clear: () => u(""),
|
|
230
|
-
focus: () => l(b),
|
|
230
|
+
focus: (e) => l(b, e),
|
|
231
231
|
isComplete: () => f.current.length === r
|
|
232
232
|
}),
|
|
233
233
|
[u, l, b, r]
|
|
@@ -254,38 +254,38 @@ const Ve = se(
|
|
|
254
254
|
"data-component": "otp-input",
|
|
255
255
|
"data-component-id": E,
|
|
256
256
|
className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]",
|
|
257
|
-
children: X.map((
|
|
258
|
-
const
|
|
257
|
+
children: X.map((e, t) => {
|
|
258
|
+
const n = !y && t === b;
|
|
259
259
|
return /* @__PURE__ */ I(
|
|
260
260
|
"input",
|
|
261
261
|
{
|
|
262
|
-
ref: (
|
|
263
|
-
P.current[
|
|
262
|
+
ref: (s) => {
|
|
263
|
+
P.current[t] = s;
|
|
264
264
|
},
|
|
265
|
-
id: `${T}-${
|
|
265
|
+
id: `${T}-${t}`,
|
|
266
266
|
type: "text",
|
|
267
267
|
inputMode: i === "alphanumeric" ? "text" : "numeric",
|
|
268
268
|
pattern: i === "alphanumeric" ? "[A-Za-z0-9]*" : "[0-9]*",
|
|
269
269
|
autoCapitalize: i === "alphanumeric" ? "characters" : void 0,
|
|
270
|
-
autoComplete:
|
|
270
|
+
autoComplete: t === 0 ? "one-time-code" : "off",
|
|
271
271
|
maxLength: 1,
|
|
272
|
-
value:
|
|
272
|
+
value: e,
|
|
273
273
|
disabled: y,
|
|
274
|
-
tabIndex:
|
|
274
|
+
tabIndex: n ? 0 : -1,
|
|
275
275
|
"aria-label": x(
|
|
276
276
|
i === "alphanumeric" ? "inputs.otp.charLabel" : "inputs.otp.digitLabel",
|
|
277
277
|
{
|
|
278
|
-
current:
|
|
278
|
+
current: t + 1,
|
|
279
279
|
total: r
|
|
280
280
|
}
|
|
281
281
|
),
|
|
282
|
-
onChange: Y(
|
|
283
|
-
onKeyDown: ee(
|
|
284
|
-
onPaste: te(
|
|
285
|
-
onFocus: re(
|
|
282
|
+
onChange: Y(t),
|
|
283
|
+
onKeyDown: ee(t),
|
|
284
|
+
onPaste: te(t),
|
|
285
|
+
onFocus: re(t),
|
|
286
286
|
className: be({ tone: J })
|
|
287
287
|
},
|
|
288
|
-
|
|
288
|
+
t
|
|
289
289
|
);
|
|
290
290
|
})
|
|
291
291
|
}
|
|
@@ -298,4 +298,4 @@ Ve.displayName = "OTPInput";
|
|
|
298
298
|
export {
|
|
299
299
|
Ve as O
|
|
300
300
|
};
|
|
301
|
-
//# sourceMappingURL=otp-input-
|
|
301
|
+
//# sourceMappingURL=otp-input-gV1446Dw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otp-input-gV1446Dw.js","sources":["../../src/components/otp-input/otp-input.agent.ts","../../src/components/otp-input/otp-input.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — OTPInput. */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` for the contract. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { OTPInputHandle } from './otp-input';\n\nexport const otpInputAgent: AgentAdapter<OTPInputHandle> = {\n id: 'otp-input',\n // Value input — `set_value` replaces the digits. There is no `submit`\n // action: completion is host-driven (the consumer's `onComplete` fires\n // automatically once every digit is filled) and is observable via the\n // `isComplete` state slot, so the old unbacked `submit` capability is\n // removed.\n capabilities: ['set_value'],\n state: {\n value: {\n type: 'string',\n descriptionKey: 'ui.agent.otpInput.state.value',\n description: 'Current digits entered, packed into a single string.',\n read: (handle) => handle.getValue(),\n },\n isComplete: {\n type: 'boolean',\n descriptionKey: 'ui.agent.otpInput.state.isComplete',\n description: 'Whether all required digits have been entered.',\n read: (handle) => handle.isComplete(),\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 'The digits to fill, packed into a single string (one char per cell).',\n },\n },\n required: ['value'],\n },\n idempotent: true,\n examples: [{ args: { value: '123456' } }],\n descriptionKey: 'ui.agent.otpInput.actions.setValue',\n description: 'Replace the entered digits.',\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.otpInput.actions.clear',\n description: 'Empty all digit cells. Loses any typed value.',\n invoke: (handle) => {\n handle.clear();\n },\n },\n focus: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.otpInput.actions.focus',\n description: 'Move keyboard focus to the active digit cell.',\n invoke: (handle) => {\n handle.focus();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'otp-input',\n description:\n 'Marks the OTPInput wrapper. Completion is observable via state.isComplete; the host onComplete callback fires once when all digits are filled.',\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 useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type ClipboardEvent,\n type FocusEvent,\n type KeyboardEvent,\n} from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport { useWebOtp } from '../../hooks/use-web-otp';\nimport {\n useFormField,\n useFormFieldControlId,\n} from '../form-field/form-field-context';\nimport { useAgentRegistration } from '../../agent';\nimport { otpInputAgent } from './otp-input.agent';\n\nexport type OTPMode = 'numeric' | 'alphanumeric';\n\n/** Agent-readiness curated handle for OTPInput. */\nexport interface OTPInputHandle {\n getValue: () => string;\n setValue: (value: string) => void;\n clear: () => void;\n focus: (options?: FocusOptions) => void;\n isComplete: () => boolean;\n}\n\nconst wrapperVariants = cva('ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]');\n\nconst boxVariants = cva(\n [\n 'ds:w-[var(--min-target-size)] ds:h-[var(--min-target-size)]',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:border ds:bg-input ds:text-foreground ds:text-center ds:font-medium ds:text-[length:var(--font-size-lg)]',\n 'ds:shadow-[var(--shadow-input)]',\n 'ds:transition-[colors,box-shadow] ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-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:disabled:cursor-not-allowed ds:disabled:opacity-50',\n ].join(' '),\n {\n variants: {\n tone: {\n default: 'ds:border-[color:var(--control-border)]',\n error: 'ds:border-destructive',\n },\n },\n defaultVariants: { tone: 'default' },\n },\n);\n\nexport interface OTPInputProps {\n /**\n * Number of boxes. Default 6. Any integer in [3, 10] is honoured;\n * out-of-range values are clamped (with a DEV warning).\n */\n length?: number;\n value?: string;\n defaultValue?: string;\n onChange?: (value: string) => void;\n onComplete?: (code: string) => void;\n disabled?: boolean;\n error?: boolean;\n label?: string;\n 'aria-describedby'?: string;\n /** Stable id, used to address this instance from the agent runtime. */\n id?: string;\n className?: string;\n /**\n * Opt into Chrome-Android's WebOTP API for one-tap SMS autofill. When\n * the browser surfaces a matching SMS-bound credential, the kit spreads\n * the code across every digit box and fires `onComplete` automatically.\n *\n * Falls back silently to manual entry on Firefox / desktop / iOS — those\n * platforms either don't ship the API at all or rely on the\n * `autocomplete=\"one-time-code\"` QuickType heuristic the kit already\n * applies to the first input.\n *\n * Prerequisites the prop can't enforce: page must be HTTPS, and the SMS\n * body must end with `@<origin> #<code>` on its last line (Chrome's\n * spec — without it the browser refuses to surface the message).\n * Default `false` so the listener stays opt-in.\n */\n webOtp?: boolean;\n /**\n * When set, renders a hidden `<input name={name}>` kept in sync with the\n * packed code so consumers can POST the OTP declaratively, e.g.\n * `sms_code_form[code]`. Default off — no behaviour change.\n */\n name?: string;\n /**\n * Character set. `numeric` (default) accepts digits only (with Arabic-Indic\n * digit folding) — byte-identical to prior behaviour. `alphanumeric` accepts\n * `[A-Za-z0-9]`, uppercases the value, and switches the boxes to text input\n * (for SMS codes that mix letters and digits).\n */\n mode?: OTPMode;\n}\n\nfunction normaliseDigits(str: string): string {\n return str\n .replace(/[\\u0660-\\u0669]/g, (c) => String(c.charCodeAt(0) - 0x0660))\n .replace(/[\\u06F0-\\u06F9]/g, (c) => String(c.charCodeAt(0) - 0x06f0));\n}\n\nconst MIN_LENGTH = 3;\nconst MAX_LENGTH = 10;\n\n/** Clamp an arbitrary length into a sane range; DEV-warn if it had to. */\nfunction resolveLength(length: number): number {\n // Fall back to the default for non-finite input (e.g. `length={parseInt(x)}`\n // yielding NaN) so the component never reaches `new Array(NaN)`.\n const n = Number.isFinite(length) ? Math.floor(length) : 6;\n const clamped = Math.max(MIN_LENGTH, Math.min(MAX_LENGTH, n));\n if (import.meta.env.DEV && clamped !== length) {\n console.warn(\n `[OTPInput] length ${length} is out of range [${MIN_LENGTH}, ${MAX_LENGTH}] \\u2014 clamped to ${clamped}.`,\n );\n }\n return clamped;\n}\n\n/**\n * Filter + normalise a string to the mode's charset, then clamp to length.\n * - `numeric`: Arabic-Indic digits folded to ASCII, then digits only.\n * - `alphanumeric`: `[A-Za-z0-9]` only, uppercased (codes are uppercase and the\n * server compares case-insensitively \\u2014 uppercasing keeps the display and the\n * posted value consistent).\n */\nfunction packValue(value: string, length: number, mode: OTPMode): string {\n const filtered =\n mode === 'alphanumeric'\n ? value.replace(/[^A-Za-z0-9]/g, '').toUpperCase()\n : normaliseDigits(value).replace(/\\D/g, '');\n return filtered.slice(0, length);\n}\n\nfunction valueToArray(value: string, length: number, mode: OTPMode): string[] {\n const packed = packValue(value, length, mode);\n const arr = new Array<string>(length).fill('');\n for (let i = 0; i < packed.length; i += 1) {\n arr[i] = packed[i];\n }\n return arr;\n}\n\nexport const OTPInput = forwardRef<OTPInputHandle, OTPInputProps>(\n (\n {\n length: lengthProp = 6,\n value,\n defaultValue,\n onChange,\n onComplete,\n disabled,\n error,\n label,\n 'aria-describedby': describedBy,\n id,\n className,\n webOtp = false,\n name,\n mode = 'numeric',\n },\n ref,\n ) => {\n const { t } = useTranslation('ui');\n const length = resolveLength(lengthProp);\n const ctx = useFormField();\n const generatedLabelId = useId();\n const labelId = label ? generatedLabelId : undefined;\n\n const [internalValueRaw, setInternalValue] = useControllableState<string>({\n value,\n defaultValue: packValue(defaultValue ?? '', length, mode),\n });\n const currentValue = packValue(internalValueRaw ?? '', length, mode);\n const digits = valueToArray(currentValue, length, mode);\n\n const effectiveDisabled = ctx.disabled || Boolean(disabled);\n const effectiveError = ctx.invalid || Boolean(error);\n const effectiveTone = effectiveError ? 'error' : 'default';\n\n const inputsRef = useRef<Array<HTMLInputElement | null>>([]);\n const completedRef = useRef(currentValue.length === length);\n const valueRef = useRef(currentValue);\n valueRef.current = currentValue;\n\n const computeInitialIndex = () => {\n const firstEmpty = currentValue.length;\n if (firstEmpty >= length) return length - 1;\n return firstEmpty;\n };\n const [activeIndex, setActiveIndex] = useState<number>(computeInitialIndex);\n\n useEffect(() => {\n if (activeIndex >= length) setActiveIndex(length - 1);\n }, [activeIndex, length]);\n\n const focusBox = useCallback(\n (index: number, options?: FocusOptions) => {\n const clamped = Math.max(0, Math.min(length - 1, index));\n setActiveIndex(clamped);\n const node = inputsRef.current[clamped];\n if (node) {\n node.focus(options);\n node.select();\n }\n },\n [length],\n );\n\n const commit = useCallback(\n (next: string) => {\n const packed = packValue(next, length, mode);\n setInternalValue(packed);\n valueRef.current = packed;\n onChange?.(packed);\n if (packed.length === length) {\n if (!completedRef.current) {\n completedRef.current = true;\n onComplete?.(packed);\n }\n } else {\n completedRef.current = false;\n }\n },\n [setInternalValue, length, mode, onChange, onComplete],\n );\n\n // WebOTP one-tap autofill. The hook silently no-ops when the API is\n // unavailable (Firefox / Safari / desktop Chromium) — `commit()` is\n // the same path manual entry takes, so `onChange` + `onComplete` fire\n // identically whether the digits arrived via SMS, paste, or typing.\n useWebOtp({\n enabled: webOtp && !effectiveDisabled,\n onCode: commit,\n });\n\n const handleChange =\n (index: number) => (event: ChangeEvent<HTMLInputElement>) => {\n const raw = event.target.value;\n const norm =\n mode === 'alphanumeric'\n ? raw.replace(/[^A-Za-z0-9]/g, '').toUpperCase()\n : normaliseDigits(raw).replace(/\\D/g, '');\n const current = valueRef.current;\n\n if (norm.length === 0) {\n if (raw === '' && index < current.length) {\n const newValue = current.slice(0, index) + current.slice(index + 1);\n commit(newValue);\n }\n return;\n }\n\n const before = current.slice(0, index);\n const after = current.slice(index + norm.length);\n const newValue = (before + norm + after).slice(0, length);\n commit(newValue);\n\n const focusTarget = Math.min(index + norm.length, length - 1);\n focusBox(focusTarget);\n };\n\n const handleKeyDown =\n (index: number) => (event: KeyboardEvent<HTMLInputElement>) => {\n const current = valueRef.current;\n if (event.key === 'Backspace') {\n if (current[index]) {\n event.preventDefault();\n const newValue = current.slice(0, index) + current.slice(index + 1);\n commit(newValue);\n return;\n }\n if (index > 0) {\n event.preventDefault();\n const newValue = current.slice(0, index - 1) + current.slice(index);\n commit(newValue);\n focusBox(index - 1);\n }\n return;\n }\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n if (index > 0) focusBox(index - 1);\n return;\n }\n if (event.key === 'ArrowRight') {\n event.preventDefault();\n if (index < length - 1) focusBox(index + 1);\n return;\n }\n if (event.key === 'Home') {\n event.preventDefault();\n focusBox(0);\n return;\n }\n if (event.key === 'End') {\n event.preventDefault();\n focusBox(length - 1);\n }\n };\n\n const handlePaste =\n (index: number) => (event: ClipboardEvent<HTMLInputElement>) => {\n const text = event.clipboardData.getData('text');\n const stripped = text.replace(/\\s+/g, '');\n const norm =\n mode === 'alphanumeric'\n ? stripped.replace(/[^A-Za-z0-9]/g, '').toUpperCase()\n : normaliseDigits(stripped);\n // numeric: reject the whole paste unless it is all digits (byte-identical\n // to prior behaviour); alphanumeric: accept the stripped [A-Za-z0-9].\n if (\n mode === 'alphanumeric' ? norm.length === 0 : !/^[0-9]+$/.test(norm)\n ) {\n return;\n }\n event.preventDefault();\n const current = valueRef.current;\n const before = current.slice(0, index);\n const after = current.slice(index + norm.length);\n const newValue = (before + norm + after).slice(0, length);\n commit(newValue);\n const focusTarget = Math.min(index + norm.length, length - 1);\n focusBox(focusTarget);\n };\n\n const handleFocus =\n (index: number) => (event: FocusEvent<HTMLInputElement>) => {\n setActiveIndex(index);\n event.currentTarget.select();\n };\n\n const baseId = ctx.id;\n /* No element carries the field's own id: its label points at the\n first box. */\n useFormFieldControlId(ctx, `${baseId}-0`);\n\n const agentHandle = useMemo<OTPInputHandle>(\n () => ({\n getValue: () => valueRef.current,\n setValue: (next) => commit(next),\n clear: () => commit(''),\n focus: (options) => focusBox(activeIndex, options),\n isComplete: () => valueRef.current.length === length,\n }),\n [commit, focusBox, activeIndex, length],\n );\n useAgentRegistration(otpInputAgent, agentHandle, id);\n // Expose the same imperative handle to React refs so consumers can\n // focus / read / clear the field (e.g. focus the boxes on a step change).\n useImperativeHandle(ref, () => agentHandle, [agentHandle]);\n\n return (\n <div className={wrapperVariants({ className })}>\n {label ? (\n <label\n id={labelId}\n htmlFor={`${baseId}-0`}\n className=\"type-label ds:text-foreground\"\n >\n {label}\n </label>\n ) : null}\n {/* eslint-disable-next-line jsx-a11y/role-supports-aria-props -- aria-invalid is a global ARIA state; conveys group-level validation */}\n <div\n role=\"group\"\n dir=\"ltr\"\n aria-labelledby={labelId}\n aria-invalid={effectiveError || undefined}\n aria-describedby={\n [describedBy, ctx.describedBy].filter(Boolean).join(' ') ||\n undefined\n }\n aria-disabled={effectiveDisabled || undefined}\n data-component=\"otp-input\"\n data-component-id={id}\n className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]\"\n >\n {digits.map((digit, index) => {\n const isTabbable = !effectiveDisabled && index === activeIndex;\n return (\n <input\n key={index}\n ref={(node) => {\n inputsRef.current[index] = node;\n }}\n id={`${baseId}-${index}`}\n type=\"text\"\n inputMode={mode === 'alphanumeric' ? 'text' : 'numeric'}\n pattern={mode === 'alphanumeric' ? '[A-Za-z0-9]*' : '[0-9]*'}\n autoCapitalize={\n mode === 'alphanumeric' ? 'characters' : undefined\n }\n autoComplete={index === 0 ? 'one-time-code' : 'off'}\n maxLength={1}\n value={digit}\n disabled={effectiveDisabled}\n tabIndex={isTabbable ? 0 : -1}\n aria-label={t(\n mode === 'alphanumeric'\n ? 'inputs.otp.charLabel'\n : 'inputs.otp.digitLabel',\n {\n current: index + 1,\n total: length,\n },\n )}\n onChange={handleChange(index)}\n onKeyDown={handleKeyDown(index)}\n onPaste={handlePaste(index)}\n onFocus={handleFocus(index)}\n className={boxVariants({ tone: effectiveTone })}\n />\n );\n })}\n </div>\n {name ? (\n <input type=\"hidden\" name={name} value={currentValue} readOnly />\n ) : null}\n </div>\n );\n },\n);\n\nOTPInput.displayName = 'OTPInput';\n"],"names":["otpInputAgent","handle","args","wrapperVariants","cva","boxVariants","normaliseDigits","str","c","MIN_LENGTH","MAX_LENGTH","resolveLength","length","n","packValue","value","mode","valueToArray","packed","arr","i","OTPInput","forwardRef","lengthProp","defaultValue","onChange","onComplete","disabled","error","label","describedBy","id","className","webOtp","name","ref","t","useTranslation","ctx","useFormField","generatedLabelId","useId","labelId","internalValueRaw","setInternalValue","useControllableState","currentValue","digits","effectiveDisabled","effectiveError","effectiveTone","inputsRef","useRef","completedRef","valueRef","computeInitialIndex","firstEmpty","activeIndex","setActiveIndex","useState","useEffect","focusBox","useCallback","index","options","clamped","node","commit","next","useWebOtp","handleChange","event","raw","norm","current","newValue","before","after","focusTarget","handleKeyDown","handlePaste","stripped","handleFocus","baseId","useFormFieldControlId","agentHandle","useMemo","useAgentRegistration","useImperativeHandle","jsx","digit","isTabbable"],"mappings":";;;;;;;;AASO,MAAMA,KAA8C;AAAA,EACzD,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMJ,cAAc,CAAC,WAAW;AAAA,EAC1B,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,YAAY;AAAA,MACV,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,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7B,IACC,gBAAAuD,EAAC,SAAA,EAAM,MAAK,UAAS,MAAAvD,GAAY,OAAOY,GAAc,UAAQ,GAAA,CAAC,IAC7D;AAAA,IAAA,GACN;AAAA,EAEJ;AACF;AAEAzB,GAAS,cAAc;"}
|
|
@@ -8,7 +8,7 @@ import { C as ie, b as te, a as se } from "./collapsible-DVPM46bq.js";
|
|
|
8
8
|
import { D as ae } from "./description-list-BxzDN9o2.js";
|
|
9
9
|
import { P as de } from "./panel-header-CbtlTe85.js";
|
|
10
10
|
import { u as re } from "./registry-DvAUVLHh.js";
|
|
11
|
-
import { u as ne, F as le, r as oe, P as ce } from "./patient-field-row-
|
|
11
|
+
import { u as ne, F as le, r as oe, P as ce } from "./patient-field-row-R73dZJY6.js";
|
|
12
12
|
import { C as pe } from "./clipboard-list-rSzfIYZB.js";
|
|
13
13
|
const me = {
|
|
14
14
|
id: "patient-details",
|
|
@@ -368,4 +368,4 @@ export {
|
|
|
368
368
|
ue as P,
|
|
369
369
|
me as p
|
|
370
370
|
};
|
|
371
|
-
//# sourceMappingURL=patient-details-
|
|
371
|
+
//# sourceMappingURL=patient-details-D0P5eog5.js.map
|