@alfadocs/ui-kit-debug 1.79.0 → 1.81.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-BYtpwCyn.js} +2 -2
- package/dist/_chunks/{anamnesis-summary-rows-lONg-zja.js.map → anamnesis-summary-rows-BYtpwCyn.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-NoEPeFdj.js} +2 -2
- package/dist/_chunks/{balance-badge-cell-Dzd-Z_5W.js.map → balance-badge-cell-NoEPeFdj.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-BV2s2J3C.js → booking-CxrB0e6d.js} +1782 -1754
- package/dist/_chunks/booking-CxrB0e6d.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-Dwp_DCYT.js} +3 -3
- package/dist/_chunks/{link-cell-renderer-B0riA_h_.js.map → link-cell-renderer-Dwp_DCYT.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-IOVnOGlP.js} +106 -106
- package/dist/_chunks/{multi-select-BOad3za9.js.map → multi-select-IOVnOGlP.js.map} +1 -1
- 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-BnY2EkzI.js → practice-results-B61krlwu.js} +659 -615
- package/dist/_chunks/practice-results-B61krlwu.js.map +1 -0
- 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-e9oYscB7.js} +2 -2
- package/dist/_chunks/{registration-form-CNBfUduG.js.map → registration-form-e9oYscB7.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 +3 -3
- 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 +16 -1
- 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/cascade.d.ts +3 -0
- package/dist/components/booking/cascade.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/index.js +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/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/practice-results/practice-results.d.ts +19 -2
- package/dist/components/practice-results/practice-results.d.ts.map +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 +2 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +3 -1
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +2 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +3 -1
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +2 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +3 -1
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +2 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +3 -1
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +2 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +3 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +2 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +3 -1
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +2 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +3 -1
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +2 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +3 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +2 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +3 -1
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +2 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +3 -1
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +2 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +3 -1
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +2 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +3 -1
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +2 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +3 -1
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +2 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +3 -1
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +2 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +3 -1
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +2 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +3 -1
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +2 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +3 -1
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +2 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +3 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +29 -29
- package/dist/locales/ar.json +3 -1
- package/dist/locales/de.json +3 -1
- package/dist/locales/el.json +3 -1
- package/dist/locales/en.json +3 -1
- package/dist/locales/es.json +3 -1
- package/dist/locales/fr.json +3 -1
- package/dist/locales/hi.json +3 -1
- package/dist/locales/it.json +3 -1
- package/dist/locales/ja.json +3 -1
- package/dist/locales/nl.json +3 -1
- package/dist/locales/pl.json +3 -1
- package/dist/locales/pt.json +3 -1
- package/dist/locales/ro.json +3 -1
- package/dist/locales/ru.json +3 -1
- package/dist/locales/sq.json +3 -1
- package/dist/locales/sv.json +3 -1
- package/dist/locales/tr.json +3 -1
- package/dist/locales/zh.json +3 -1
- 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-BV2s2J3C.js.map +0 -1
- package/dist/_chunks/contact-profile-card-DKk94l-d.js.map +0 -1
- package/dist/_chunks/practice-results-BnY2EkzI.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-select-BOad3za9.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 const effectiveDisabled =\n (inFormField && ctx.disabled) || Boolean(disabled);\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={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 aria-label={resolvedPlaceholder}\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","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","_a","caretAtStart","isRTL","lastIdx","handleChipKeyDown","e","focusIdx","prevKey","nextKey","newIdx","_b","_c","_d","visibleCount","setVisibleCount","measureNonce","setMeasureNonce","lastWidthRef","requestMeasure","n","useIsomorphicLayoutEffect","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,IAEpC,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,EACrC;AAAA,EAEF,SAAS;AAAA,IACP,eAAe;AAAA;AAAA,MAEb,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,QAAQ;AAAA,YACN,MAAM;AAAA,YACN,OAAO,EAAE,MAAM,SAAA;AAAA,YACf,aACE;AAAA,UAAA;AAAA,QACJ;AAAA,QAEF,UAAU,CAAC,QAAQ;AAAA,MAAA;AAAA,MAErB,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,UAAU;AAAA,QACR;AAAA,UACE,MAAM,EAAE,QAAQ,CAAC,KAAK,GAAG,EAAA;AAAA,UACzB,MAAM;AAAA,QAAA;AAAA,MACR;AAAA,MAEF,QAAQ,CAACA,GAAQC,MAA+B;AAC9C,QAAAD,EAAO,aAAaC,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ACT,WAAU;AAAA,sBAET,UAAAG;AAAA,oBAAA;AAAA,oBAJI,SAASH,CAAK;AAAA,kBAAA,sBALlBP,EAAQ,OAAR,EAAmC,UAAAU,EAAA,GAAhB,SAASD,CAAE,EAAU;AAAA,gBAY/C,CAAC;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA,EACF,CACF;AAAA,IAAA,EAAA,CACF,EAAA,CACF;AAAA,EAEJ;AACF;AACAjJ,GAAgB,cAAc;AASvB,MAAM8J,KAAc9J;"}
|
|
1
|
+
{"version":3,"file":"multi-select-IOVnOGlP.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 const effectiveDisabled =\n (inFormField && ctx.disabled) || Boolean(disabled);\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={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","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","_a","caretAtStart","isRTL","lastIdx","handleChipKeyDown","e","focusIdx","prevKey","nextKey","newIdx","_b","_c","_d","visibleCount","setVisibleCount","measureNonce","setMeasureNonce","lastWidthRef","requestMeasure","n","useIsomorphicLayoutEffect","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,IAEpC,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,EACrC;AAAA,EAEF,SAAS;AAAA,IACP,eAAe;AAAA;AAAA,MAEb,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,QA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AAA,oBAAA;AAoGhB,2BAAI+F,IAEA,gBAAAb;AAAA,sBAACM;AAAA,sBAAA;AAAA,wBAEC,OAAOzH,EAAE,iCAAiC;AAAA,0BACxC,OAAOZ;AAAA,0BACP,cAAc,WAAWA,CAAa;AAAA,wBAAA,CACvC;AAAA,wBACD,eAAe;AAAA,wBAEd,UAAA8I;AAAA,sBAAA;AAAA,sBAPIjG,EAAO;AAAA,oBAAA,IAWXiG;AAAA,kBACT,CAAC;AACD,yBAAKP,IAMH,gBAAAR;AAAA,oBAACC,EAAQ;AAAA,oBAAR;AAAA,sBAEC,SAASO;AAAA,sBACT,WAAU;AAAA,sBAET,UAAAG;AAAA,oBAAA;AAAA,oBAJI,SAASH,CAAK;AAAA,kBAAA,sBALlBP,EAAQ,OAAR,EAAmC,UAAAU,EAAA,GAAhB,SAASD,CAAE,EAAU;AAAA,gBAY/C,CAAC;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA,EACF,CACF;AAAA,IAAA,EAAA,CACF,EAAA,CACF;AAAA,EAEJ;AACF;AACAjJ,GAAgB,cAAc;AASvB,MAAM8J,KAAc9J;"}
|
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patient-details-B-I9Xkh9.js","sources":["../../src/components/patient-details/patient-details.agent.ts","../../src/components/patient-details/patient-details.tsx"],"sourcesContent":["import type { AgentAdapter } from '../../agent/types';\nimport type { PatientDetailsHandle } from './patient-details';\n\n/* -------------------------------------------------------------------- */\n/* Agent adapter — PatientDetails */\n/* */\n/* Exposes the patient panel to a future MCP runtime: */\n/* - VIEW CONFIG (safety: write) — show/hide + reorder the visible */\n/* field set. These mutate the user's view, not the patient record. */\n/* - PHI WRITE (safety: phi) — `update_field` writes a patient field */\n/* value. It is the ONLY PHI mutation and routes through the same */\n/* `onFieldSave` path as a human inline edit, so the consumer's */\n/* permission + validation + audit are the single write authority. */\n/* `phi` (not `write`) forces the runtime's confirm-before-act gate. */\n/* */\n/* STATE exposes only field KEYS (`visibleFieldOrder`) and an opaque */\n/* `patientId` — never a field value or patient identity (PRS §Security, */\n/* 26-agent-readiness §6.1/§7). */\n/* -------------------------------------------------------------------- */\n\nexport const patientDetailsAgent: AgentAdapter<PatientDetailsHandle> = {\n id: 'patient-details',\n // `view_change` backs the view-config actions (show/hide + reorder are both\n // view reconfigurations); `set_value` backs the single-value `update_field`\n // (not `edit_inline`, which is for granular free-text/formatting edits).\n capabilities: ['view_change', 'set_value'],\n state: {\n visibleFieldOrder: {\n type: 'string[]',\n descriptionKey: 'ui.agent.patientDetails.state.visibleFieldOrder',\n description:\n 'Ordered list of visible field KEYS (e.g. \"fiscalCode\"). Never a field value.',\n read: (handle) => handle.getVisibleFieldOrder(),\n },\n patientId: {\n type: 'string | undefined',\n descriptionKey: 'ui.agent.patientDetails.state.patientId',\n description:\n 'Opaque patient id the panel is bound to. No patient-identifiable data.',\n read: (handle) => handle.getPatientId(),\n },\n },\n actions: {\n set_visible_fields: {\n safety: 'write',\n argsType: '{ fieldIds: string[] }',\n argsSchema: {\n type: 'object',\n properties: {\n fieldIds: { type: 'array', items: { type: 'string' } },\n },\n required: ['fieldIds'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.patientDetails.actions.setVisibleFields',\n description:\n 'Set which fields are visible (and their order). Unknown ids are ignored.',\n examples: [\n {\n args: { fieldIds: ['lastName', 'firstName', 'phone', 'email'] },\n note: 'Show only name + contact fields.',\n },\n ],\n invoke: (handle, args: { fieldIds: string[] }) => {\n handle.setVisibleFields(args.fieldIds);\n },\n },\n set_field_order: {\n safety: 'write',\n argsType: '{ orderedIds: string[] }',\n argsSchema: {\n type: 'object',\n properties: {\n orderedIds: { type: 'array', items: { type: 'string' } },\n },\n required: ['orderedIds'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.patientDetails.actions.setFieldOrder',\n description:\n 'Reorder the visible fields. Order within a section is honoured; sections stay fixed.',\n invoke: (handle, args: { orderedIds: string[] }) => {\n handle.setFieldOrder(args.orderedIds);\n },\n },\n update_field: {\n // PHI: mutates a patient-identifiable value. NOT `write` — the runtime\n // must confirm + audit. Routes through `onFieldSave` (server write).\n safety: 'phi',\n openWorld: true,\n argsType: '{ fieldId: string; value: unknown }',\n argsSchema: {\n type: 'object',\n properties: {\n fieldId: { type: 'string' },\n value: {},\n },\n required: ['fieldId', 'value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.patientDetails.actions.updateField',\n description:\n \"Write a patient field value via the consumer's audited save path. Subject to the same permissions and validation as a human edit.\",\n errors: ['no-save-handler', 'validation-failed', 'permission-denied'],\n examples: [\n {\n args: { fieldId: 'job', value: 'Architect' },\n note: 'Update the patient’s occupation.',\n },\n ],\n invoke: (handle, args: { fieldId: string; value: unknown }) =>\n handle.updateField(args.fieldId, args.value),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'patient-details',\n description: 'Marks the PatientDetails root region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop. Addresses a specific panel.',\n },\n item: {\n attr: 'data-field-id',\n description:\n 'Stable field KEY on each row. Never the field value (no PHI in the DOM hook).',\n },\n },\n};\n","import {\n forwardRef,\n Fragment,\n useId,\n useMemo,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { ClipboardList } from 'lucide-react';\nimport { Avatar } from '../avatar/avatar';\nimport { Card } from '../card/card';\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from '../collapsible/collapsible';\nimport { DescriptionList } from '../description-list/description-list';\nimport { PanelHeader } from '../panel-header/panel-header';\nimport { useAgentRegistration } from '../../agent/registry';\nimport {\n resolveVisibleFields,\n type PatientField,\n type PatientFieldEditType,\n type PatientFieldEditValue,\n type PatientFieldOption,\n type PatientFieldSection,\n} from '../_shared/patient-fields';\nimport { usePatientFieldVisibility } from '../_shared/field-visibility';\nimport { FieldVisibilityCog } from '../_shared/field-visibility-cog';\nimport { PatientFieldRow } from '../_shared/patient-field-row';\nimport { patientDetailsAgent } from './patient-details.agent';\n\n/* -------------------------------------------------------------------- */\n/* PatientDetails */\n/* */\n/* The customizable, inline-editable patient record panel — the kit's */\n/* replacement for platform's hardcoded, per-user-identical patient */\n/* \"scheda paziente\" table. Mounts as a CONTEXTUAL tool in the Control */\n/* Room rail (a separate tool from EntitySummary, the AI brief). */\n/* */\n/* Boundaries (PRS §Security + 26-agent-readiness §PHI): */\n/* - DATA-IN for values: the consumer maps DoctorPatient → sections. */\n/* The kit owns the layout, the cog field-picker, i18n & theming. */\n/* - PERSISTENCE-OUT: the cog emits `onVisibleFieldsChange`; the */\n/* consumer persists the user's chosen ordered field set (platform: */\n/* a per-user × per-practice JSON column). */\n/* - WRITE-OUT: inline edits AND the agent's `update_field` BOTH route */\n/* through the single `onFieldSave` callback, so platform's */\n/* permission + validation + audit path is the only write channel. */\n/* - DOM hooks + agent state carry only field KEYS and an opaque */\n/* `patientId` — never a field VALUE / patient identity. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* CVA — root */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva(\n 'ds:flex ds:flex-col ds:text-[color:var(--foreground)]',\n {\n variants: {\n // `compact` (default) suits the narrow rail panel; `comfortable`\n // relaxes spacing for a wider host (a full-width profile page).\n density: {\n comfortable: '',\n compact: '',\n },\n },\n defaultVariants: {\n density: 'compact',\n },\n },\n);\n\n// The scrolling body sits BELOW the shared PanelHeader (which owns the title\n// row + divider + its own top/side padding). The header is full-bleed at the\n// top of the scroll region; the body carries the panel's content padding.\nconst bodyVariants = cva('ds:flex ds:flex-col ds:gap-[var(--spacing-md)]', {\n variants: {\n density: {\n comfortable: 'ds:p-[var(--spacing-md)]',\n compact: 'ds:p-[var(--spacing-sm)]',\n },\n },\n defaultVariants: {\n density: 'compact',\n },\n});\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* */\n/* The field model is the shared `_shared/patient-fields` vocabulary, so */\n/* PatientDetails and PatientSummaryCard speak ONE field language. The */\n/* visible set + order are a PER-CONTEXT preference the consumer owns and */\n/* wires per placement — never a single value synced across surfaces. The */\n/* `PatientDetails*` names below are kept as aliases for back-compat. */\n/* -------------------------------------------------------------------- */\n\nexport type {\n PatientField,\n PatientFieldSection,\n PatientFieldOption,\n PatientFieldEditType,\n PatientFieldEditValue,\n} from '../_shared/patient-fields';\n\n/** A label→value patient field. Alias of the shared {@link PatientField}. */\nexport type PatientDetailsField = PatientField;\n/** A labelled, collapsible group of fields. Alias of {@link PatientFieldSection}. */\nexport type PatientDetailsSection = PatientFieldSection;\n/** Alias of the shared {@link PatientFieldOption}. */\nexport type PatientDetailsFieldOption = PatientFieldOption;\n/** Alias of the shared {@link PatientFieldEditType}. */\nexport type PatientDetailsEditType = PatientFieldEditType;\n/** Alias of the shared {@link PatientFieldEditValue}. */\nexport type PatientDetailsEditValue = PatientFieldEditValue;\n\n/**\n * Imperative handle the agent adapter drives. Exposes only field KEYS and\n * an opaque `patientId` for reads; `updateField` routes writes through the\n * same `onFieldSave` path as a human inline edit (no second channel).\n */\nexport interface PatientDetailsHandle {\n /** The current ordered list of visible field ids. */\n getVisibleFieldOrder: () => string[];\n /** Opaque patient id (no PHI). */\n getPatientId: () => string | undefined;\n /** Replace the visible set, preserving the given order (filtered to known fields). */\n setVisibleFields: (fieldIds: string[]) => void;\n /** Replace the full ordered visible list (filtered to known fields). */\n setFieldOrder: (orderedIds: string[]) => void;\n /** Write a field value — delegates to `onFieldSave`. Rejects if no handler. */\n updateField: (fieldId: string, value: unknown) => Promise<void>;\n}\n\nexport interface PatientDetailsProps extends Omit<\n HTMLAttributes<HTMLElement>,\n 'title' | 'children'\n> {\n /** Patient display name — the panel heading. */\n title: ReactNode;\n /** The sectioned field catalogue (consumer-mapped from DoctorPatient). */\n sections: PatientDetailsSection[];\n /**\n * Header avatar photo / initials override. The panel always fronts the name\n * with an Avatar — initials derive from a string `title` by default; pass\n * `src` for a photo, or `name` to override the initials source.\n */\n avatar?: { src?: string; name?: string };\n /** At-a-glance chips under the name (consumer-composed Badge/Tag/Chip row). */\n headerChips?: ReactNode;\n\n /* ----- inline editing (kit-owned controls, consumer-owned write) ----- */\n\n /**\n * Frame the identity header and each section in its own elevated `Card`,\n * for a \"control-room\" rail that reads as a stack of cards rather than one\n * flat panel. Default `false` (the flat panel with a header rule + eyebrow\n * section headings). When framed, the header rule is dropped — the cards\n * provide the separation.\n */\n framed?: boolean;\n /** Master switch — show edit affordances on `editable` fields. */\n editable?: boolean;\n /**\n * Persist a field edit. Resolve ⇒ committed; reject(Error) ⇒ the message\n * is shown inline and the row stays in edit mode. Also the single channel\n * the agent's `update_field` uses.\n */\n onFieldSave?: (fieldId: string, value: unknown) => Promise<void>;\n /** Domain validation — return an error message, or `null` when valid. */\n validate?: (fieldId: string, value: unknown) => string | null;\n\n /* ----- customization (the cog; controlled OR uncontrolled) ----- */\n\n /**\n * Controlled ordered list of visible field ids. `undefined` ⇒ every field\n * visible; an explicit `[]` ⇒ none (a panel that starts collapsed).\n */\n visibleFieldOrder?: string[];\n /** Uncontrolled initial order. Omit both ⇒ every field visible, in declaration order. */\n defaultVisibleFieldOrder?: string[];\n /** Fired whenever the user shows/hides/reorders fields via the cog. */\n onVisibleFieldsChange?: (orderedIds: string[]) => void;\n\n /* ----- states ----- */\n\n /** Render the loading skeleton. */\n loading?: boolean;\n /** Shown when there are no sections / no patient. Defaults to a localised hint. */\n emptyState?: ReactNode;\n\n /* ----- agent / a11y ----- */\n\n /** Opaque patient id — emitted as `data-patient-id` + agent stateRead. No PHI. */\n patientId?: string;\n /** Agent-readiness instance id, surfaced as `data-component-id`. */\n id?: string;\n /** BCP-47 locale override (currency / number editors). */\n locale?: string;\n /** Override the cog trigger's accessible name. */\n cogLabel?: string;\n /**\n * Visible panel-chrome heading (the sticky PanelHeader title). Defaults\n * to the kit's localised \"Patient details\". Pass an app-translated\n * string when the panel fronts a different record built from the same\n * chrome — \"Appointment details\", \"Task details\" — so the header names\n * what is actually shown. Also the `aria-label` fallback.\n */\n panelTitle?: string;\n /** Override the panel region's accessible name (defaults to the heading). */\n 'aria-label'?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const PatientDetails = forwardRef<HTMLElement, PatientDetailsProps>(\n function PatientDetails(\n {\n title,\n sections,\n avatar,\n headerChips,\n framed = false,\n editable = false,\n onFieldSave,\n validate,\n visibleFieldOrder,\n defaultVisibleFieldOrder,\n onVisibleFieldsChange,\n loading = false,\n emptyState,\n patientId,\n id,\n locale,\n cogLabel,\n panelTitle: panelTitleProp,\n 'aria-label': ariaLabel,\n className,\n ...rest\n },\n ref,\n ) {\n const { t } = useTranslation('ui');\n const headingId = useId();\n\n // Per-context field visibility + ordering. The order is a per-INSTANCE\n // preference the kit never persists — the consumer wires its own\n // value/onChange, so the same field vocabulary can render differently in\n // different parts of the app (see usePatientFieldVisibility).\n const {\n visible,\n catalogueIds,\n setOrder,\n toggleField,\n toggleSection,\n moveFieldOnto,\n reset: resetToDefaults,\n } = usePatientFieldVisibility(sections, {\n value: visibleFieldOrder,\n defaultValue: defaultVisibleFieldOrder,\n onChange: onVisibleFieldsChange,\n });\n\n /* ---- imperative handle (agent) ------------------------------- */\n\n const handle = useMemo<PatientDetailsHandle>(\n () => ({\n getVisibleFieldOrder: () => visible,\n getPatientId: () => patientId,\n setVisibleFields: (fieldIds) => setOrder(fieldIds),\n setFieldOrder: (orderedIds) => setOrder(orderedIds),\n updateField: (fieldId, value) => {\n if (!onFieldSave) {\n return Promise.reject(\n new Error('PatientDetails: no onFieldSave handler is wired.'),\n );\n }\n return onFieldSave(fieldId, value);\n },\n }),\n [visible, patientId, setOrder, onFieldSave],\n );\n useAgentRegistration(patientDetailsAgent, handle, id);\n\n /* ---- region accessible name ---------------------------------- */\n\n const panelTitle =\n panelTitleProp ??\n t('patientDetails.regionLabel', {\n defaultValue: 'Patient details',\n });\n const resolvedAriaLabel = ariaLabel ?? panelTitle;\n\n /* ---- header avatar ------------------------------------------- */\n // Parity with the card: the panel fronts the name with an Avatar (photo via\n // `avatar.src`, else initials from the name). Omitted only when `title` is a\n // non-string node and no `avatar.name` is given (nothing to derive from).\n const avatarName =\n avatar?.name ?? (typeof title === 'string' ? title : undefined);\n const showAvatar = Boolean(avatar?.src || avatarName);\n\n /* ---- loading / empty ----------------------------------------- */\n\n const hasVisible = catalogueIds.some((cid) => visible.includes(cid));\n\n if (loading) {\n return (\n <section\n ref={ref}\n data-component=\"patient-details\"\n data-component-id={id}\n data-patient-id={patientId}\n aria-label={resolvedAriaLabel}\n aria-busy=\"true\"\n className={rootVariants({ className })}\n {...rest}\n >\n <div className={bodyVariants()}>\n <PatientDetailsSkeleton />\n </div>\n </section>\n );\n }\n\n const isEmpty = sections.length === 0 || !hasVisible;\n\n // The identity card (avatar + name + chips) is now the FIRST block of the\n // scrolling body — the shared PanelHeader owns the panel title row. The\n // name demotes to <h3> (the PanelHeader title is the <h2>).\n const identityBlock = (\n <div className=\"ds:flex ds:items-start ds:gap-[var(--spacing-sm)]\">\n {showAvatar ? (\n <Avatar\n size=\"md\"\n name={avatarName}\n src={avatar?.src}\n className=\"ds:shrink-0\"\n />\n ) : null}\n <div className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-2xs)]\">\n <h3 className=\"ds:m-0 type-title-item ds:text-[color:var(--foreground)]\">\n {title}\n </h3>\n {/* Chips sit under the NAME (not the avatar) — same column shape\n as the card's identity line. */}\n {headerChips ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]\">\n {headerChips}\n </div>\n ) : null}\n </div>\n </div>\n );\n\n return (\n <section\n ref={ref}\n data-component=\"patient-details\"\n data-component-id={id}\n data-patient-id={patientId}\n aria-labelledby={ariaLabel ? undefined : headingId}\n aria-label={ariaLabel ?? undefined}\n className={rootVariants({ className })}\n {...rest}\n >\n {/* The shared rail-panel header: panel title + the field-picker cog as\n its panel-owned action; the rail injects favourite/close after it.\n Sticky + divider so the title stays as the body scrolls. */}\n <PanelHeader\n title={panelTitle}\n icon={<ClipboardList aria-hidden=\"true\" />}\n headingId={headingId}\n sticky\n divider\n actions={\n <FieldVisibilityCog\n sections={sections}\n visible={visible}\n onToggleField={toggleField}\n onToggleSection={toggleSection}\n onMoveFieldOnto={moveFieldOnto}\n onReset={resetToDefaults}\n label={cogLabel}\n />\n }\n />\n\n <div className={bodyVariants()}>\n {/* Identity card — first block of the body; framed wraps it in its\n own elevated card alongside each section. */}\n {framed ? (\n <Card variant=\"elevated\">\n <Card.Body>{identityBlock}</Card.Body>\n </Card>\n ) : (\n identityBlock\n )}\n\n {/* Body — one card per section when framed, otherwise a flat stack. */}\n {isEmpty ? (\n <p className=\"ds:m-0 type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {emptyState ??\n t('patientDetails.empty', {\n defaultValue: 'No patient selected.',\n })}\n </p>\n ) : (\n resolveVisibleFields(sections, visible)\n // A section whose fields are all hidden drops out entirely —\n // no empty card / \"No fields shown.\" placeholder. (The field\n // picker still lists it, so hidden fields can be re-added.)\n .filter(({ fields }) => fields.length > 0)\n .map(({ section, fields }) => {\n const block = (\n <SectionBlock\n section={section}\n fields={fields}\n editable={editable}\n onFieldSave={onFieldSave}\n validate={validate}\n locale={locale}\n />\n );\n return framed ? (\n <Card key={section.id} variant=\"elevated\">\n <Card.Body>{block}</Card.Body>\n </Card>\n ) : (\n <Fragment key={section.id}>{block}</Fragment>\n );\n })\n )}\n </div>\n </section>\n );\n },\n);\n\nPatientDetails.displayName = 'PatientDetails';\n\n/* -------------------------------------------------------------------- */\n/* SectionBlock — one collapsible group */\n/* -------------------------------------------------------------------- */\n\nfunction SectionBlock({\n section,\n fields,\n editable,\n onFieldSave,\n validate,\n locale,\n}: {\n section: PatientDetailsSection;\n fields: PatientDetailsField[];\n editable: boolean;\n onFieldSave?: (fieldId: string, value: unknown) => Promise<void>;\n validate?: (fieldId: string, value: unknown) => string | null;\n locale?: string;\n}): ReactNode {\n const { t } = useTranslation('ui');\n const headingId = useId();\n const collapsible = section.collapsible ?? true;\n\n // The empty hint must be a SIBLING of the <dl>, never a child — a <p> is\n // not a valid direct child of <dl> (axe `definition-list`).\n const rows =\n fields.length === 0 ? (\n <p className=\"ds:m-0 type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {t('patientDetails.section.empty', {\n defaultValue: 'No fields shown.',\n })}\n </p>\n ) : (\n <DescriptionList\n layout=\"inline\"\n density=\"compact\"\n divider=\"none\"\n // Label icons paint in the accent (the slot's recolour hook); no row rules.\n className=\"ds:[--description-list-icon-color:var(--accent)]\"\n >\n {fields.map((field) => (\n <PatientFieldRow\n key={field.id}\n field={field}\n // Surface the icon on the direct child: DescriptionList reserves its\n // icon column by inspecting direct children only, so the FieldRow\n // wrapper must carry it (not just the nested Row).\n icon={field.icon ?? null}\n editable={editable}\n onFieldSave={onFieldSave}\n validate={validate}\n locale={locale}\n />\n ))}\n </DescriptionList>\n );\n\n if (!collapsible) {\n return (\n <section\n aria-labelledby={headingId}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\"\n >\n <h3\n id={headingId}\n className=\"ds:m-0 type-eyebrow ds:text-[color:var(--foreground)]\"\n >\n {section.heading}\n </h3>\n {rows}\n </section>\n );\n }\n\n return (\n <Collapsible\n defaultOpen={section.defaultOpen ?? true}\n variant=\"minimal\"\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\"\n >\n {/* Real <h3> so collapsible sections appear in the heading outline\n (the non-collapsible branch is an <h3> too); the WAI-ARIA accordion\n pattern is a heading wrapping the disclosure button. */}\n <h3 className=\"ds:m-0\">\n <CollapsibleTrigger asChild>\n <button\n type=\"button\"\n id={headingId}\n className=\"ds:flex ds:w-full ds:items-center ds:justify-between ds:gap-[var(--spacing-xs)] ds:bg-transparent ds:border-0 ds:p-0 ds:text-start ds:cursor-pointer ds:rounded-[var(--radius-sm)] ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)] ds:forced-colors:focus-visible:outline-[CanvasText] type-eyebrow ds:text-[color:var(--foreground)]\"\n >\n {section.heading}\n </button>\n </CollapsibleTrigger>\n </h3>\n <CollapsibleContent aria-labelledby={headingId}>\n {rows}\n </CollapsibleContent>\n </Collapsible>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* Skeleton */\n/* -------------------------------------------------------------------- */\n\nfunction PatientDetailsSkeleton(): ReactNode {\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n <span className=\"ds:size-10 ds:shrink-0 ds:rounded-full ds:bg-[color:var(--muted)]\" />\n <span className=\"ds:h-4 ds:w-1/2 ds:rounded-[var(--radius-sm)] ds:bg-[color:var(--muted)]\" />\n </div>\n {[0, 1, 2].map((i) => (\n <span\n key={i}\n className=\"ds:h-4 ds:w-full ds:rounded-[var(--radius-sm)] ds:bg-[color:var(--muted)]\"\n />\n ))}\n </div>\n );\n}\n\n/** Density variant union re-exported for downstream typing. */\nexport type PatientDetailsDensity = NonNullable<\n VariantProps<typeof rootVariants>['density']\n>;\n"],"names":["patientDetailsAgent","handle","args","rootVariants","cva","bodyVariants","PatientDetails","forwardRef","title","sections","avatar","headerChips","framed","editable","onFieldSave","validate","visibleFieldOrder","defaultVisibleFieldOrder","onVisibleFieldsChange","loading","emptyState","patientId","id","locale","cogLabel","panelTitleProp","ariaLabel","className","rest","ref","t","useTranslation","headingId","useId","visible","catalogueIds","setOrder","toggleField","toggleSection","moveFieldOnto","resetToDefaults","usePatientFieldVisibility","useMemo","fieldIds","orderedIds","fieldId","value","useAgentRegistration","panelTitle","resolvedAriaLabel","avatarName","showAvatar","hasVisible","cid","jsx","PatientDetailsSkeleton","isEmpty","identityBlock","jsxs","Avatar","PanelHeader","ClipboardList","FieldVisibilityCog","Card","resolveVisibleFields","fields","section","block","SectionBlock","Fragment","collapsible","rows","DescriptionList","field","PatientFieldRow","Collapsible","CollapsibleTrigger","CollapsibleContent"],"mappings":";;;;;;;;;;;;AAoBO,MAAMA,KAA0D;AAAA,EACrE,IAAI;AAAA;AAAA;AAAA;AAAA,EAIJ,cAAc,CAAC,eAAe,WAAW;AAAA,EACzC,OAAO;AAAA,IACL,mBAAmB;AAAA,MACjB,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,qBAAA;AAAA,IAAqB;AAAA,IAEhD,WAAW;AAAA,MACT,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,aAAA;AAAA,IAAa;AAAA,EACxC;AAAA,EAEF,SAAS;AAAA,IACP,oBAAoB;AAAA,MAClB,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,U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A,QAAA,gBAAAsB;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAItB;AAAA,YACJ,WAAU;AAAA,YAET,UAAAkC,EAAQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAEVK;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AA8BT;AAMA,SAAShB,KAAoC;AAC3C,SACE,gBAAAG,EAAC,OAAA,EAAI,WAAU,kDACb,UAAA;AAAA,IAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,sDACb,UAAA;AAAA,MAAA,gBAAAJ,EAAC,QAAA,EAAK,WAAU,oEAAA,CAAoE;AAAA,MACpF,gBAAAA,EAAC,QAAA,EAAK,WAAU,2EAAA,CAA2E;AAAA,IAAA,GAC7F;AAAA,IACC,CAAC,GAAG,GAAG,CAAC,EAAE,IAAI,CAAC,MACd,gBAAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QAEC,WAAU;AAAA,MAAA;AAAA,MADL;AAAA,IAAA,CAGR;AAAA,EAAA,GACH;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"patient-details-D0P5eog5.js","sources":["../../src/components/patient-details/patient-details.agent.ts","../../src/components/patient-details/patient-details.tsx"],"sourcesContent":["import type { AgentAdapter } from '../../agent/types';\nimport type { PatientDetailsHandle } from './patient-details';\n\n/* -------------------------------------------------------------------- */\n/* Agent adapter — PatientDetails */\n/* */\n/* Exposes the patient panel to a future MCP runtime: */\n/* - VIEW CONFIG (safety: write) — show/hide + reorder the visible */\n/* field set. These mutate the user's view, not the patient record. */\n/* - PHI WRITE (safety: phi) — `update_field` writes a patient field */\n/* value. It is the ONLY PHI mutation and routes through the same */\n/* `onFieldSave` path as a human inline edit, so the consumer's */\n/* permission + validation + audit are the single write authority. */\n/* `phi` (not `write`) forces the runtime's confirm-before-act gate. */\n/* */\n/* STATE exposes only field KEYS (`visibleFieldOrder`) and an opaque */\n/* `patientId` — never a field value or patient identity (PRS §Security, */\n/* 26-agent-readiness §6.1/§7). */\n/* -------------------------------------------------------------------- */\n\nexport const patientDetailsAgent: AgentAdapter<PatientDetailsHandle> = {\n id: 'patient-details',\n // `view_change` backs the view-config actions (show/hide + reorder are both\n // view reconfigurations); `set_value` backs the single-value `update_field`\n // (not `edit_inline`, which is for granular free-text/formatting edits).\n capabilities: ['view_change', 'set_value'],\n state: {\n visibleFieldOrder: {\n type: 'string[]',\n descriptionKey: 'ui.agent.patientDetails.state.visibleFieldOrder',\n description:\n 'Ordered list of visible field KEYS (e.g. \"fiscalCode\"). Never a field value.',\n read: (handle) => handle.getVisibleFieldOrder(),\n },\n patientId: {\n type: 'string | undefined',\n descriptionKey: 'ui.agent.patientDetails.state.patientId',\n description:\n 'Opaque patient id the panel is bound to. No patient-identifiable data.',\n read: (handle) => handle.getPatientId(),\n },\n },\n actions: {\n set_visible_fields: {\n safety: 'write',\n argsType: '{ fieldIds: string[] }',\n argsSchema: {\n type: 'object',\n properties: {\n fieldIds: { type: 'array', items: { type: 'string' } },\n },\n required: ['fieldIds'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.patientDetails.actions.setVisibleFields',\n description:\n 'Set which fields are visible (and their order). Unknown ids are ignored.',\n examples: [\n {\n args: { fieldIds: ['lastName', 'firstName', 'phone', 'email'] },\n note: 'Show only name + contact fields.',\n },\n ],\n invoke: (handle, args: { fieldIds: string[] }) => {\n handle.setVisibleFields(args.fieldIds);\n },\n },\n set_field_order: {\n safety: 'write',\n argsType: '{ orderedIds: string[] }',\n argsSchema: {\n type: 'object',\n properties: {\n orderedIds: { type: 'array', items: { type: 'string' } },\n },\n required: ['orderedIds'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.patientDetails.actions.setFieldOrder',\n description:\n 'Reorder the visible fields. Order within a section is honoured; sections stay fixed.',\n invoke: (handle, args: { orderedIds: string[] }) => {\n handle.setFieldOrder(args.orderedIds);\n },\n },\n update_field: {\n // PHI: mutates a patient-identifiable value. NOT `write` — the runtime\n // must confirm + audit. Routes through `onFieldSave` (server write).\n safety: 'phi',\n openWorld: true,\n argsType: '{ fieldId: string; value: unknown }',\n argsSchema: {\n type: 'object',\n properties: {\n fieldId: { type: 'string' },\n value: {},\n },\n required: ['fieldId', 'value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.patientDetails.actions.updateField',\n description:\n \"Write a patient field value via the consumer's audited save path. Subject to the same permissions and validation as a human edit.\",\n errors: ['no-save-handler', 'validation-failed', 'permission-denied'],\n examples: [\n {\n args: { fieldId: 'job', value: 'Architect' },\n note: 'Update the patient’s occupation.',\n },\n ],\n invoke: (handle, args: { fieldId: string; value: unknown }) =>\n handle.updateField(args.fieldId, args.value),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'patient-details',\n description: 'Marks the PatientDetails root region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop. Addresses a specific panel.',\n },\n item: {\n attr: 'data-field-id',\n description:\n 'Stable field KEY on each row. Never the field value (no PHI in the DOM hook).',\n },\n },\n};\n","import {\n forwardRef,\n Fragment,\n useId,\n useMemo,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { ClipboardList } from 'lucide-react';\nimport { Avatar } from '../avatar/avatar';\nimport { Card } from '../card/card';\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from '../collapsible/collapsible';\nimport { DescriptionList } from '../description-list/description-list';\nimport { PanelHeader } from '../panel-header/panel-header';\nimport { useAgentRegistration } from '../../agent/registry';\nimport {\n resolveVisibleFields,\n type PatientField,\n type PatientFieldEditType,\n type PatientFieldEditValue,\n type PatientFieldOption,\n type PatientFieldSection,\n} from '../_shared/patient-fields';\nimport { usePatientFieldVisibility } from '../_shared/field-visibility';\nimport { FieldVisibilityCog } from '../_shared/field-visibility-cog';\nimport { PatientFieldRow } from '../_shared/patient-field-row';\nimport { patientDetailsAgent } from './patient-details.agent';\n\n/* -------------------------------------------------------------------- */\n/* PatientDetails */\n/* */\n/* The customizable, inline-editable patient record panel — the kit's */\n/* replacement for platform's hardcoded, per-user-identical patient */\n/* \"scheda paziente\" table. Mounts as a CONTEXTUAL tool in the Control */\n/* Room rail (a separate tool from EntitySummary, the AI brief). */\n/* */\n/* Boundaries (PRS §Security + 26-agent-readiness §PHI): */\n/* - DATA-IN for values: the consumer maps DoctorPatient → sections. */\n/* The kit owns the layout, the cog field-picker, i18n & theming. */\n/* - PERSISTENCE-OUT: the cog emits `onVisibleFieldsChange`; the */\n/* consumer persists the user's chosen ordered field set (platform: */\n/* a per-user × per-practice JSON column). */\n/* - WRITE-OUT: inline edits AND the agent's `update_field` BOTH route */\n/* through the single `onFieldSave` callback, so platform's */\n/* permission + validation + audit path is the only write channel. */\n/* - DOM hooks + agent state carry only field KEYS and an opaque */\n/* `patientId` — never a field VALUE / patient identity. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* CVA — root */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva(\n 'ds:flex ds:flex-col ds:text-[color:var(--foreground)]',\n {\n variants: {\n // `compact` (default) suits the narrow rail panel; `comfortable`\n // relaxes spacing for a wider host (a full-width profile page).\n density: {\n comfortable: '',\n compact: '',\n },\n },\n defaultVariants: {\n density: 'compact',\n },\n },\n);\n\n// The scrolling body sits BELOW the shared PanelHeader (which owns the title\n// row + divider + its own top/side padding). The header is full-bleed at the\n// top of the scroll region; the body carries the panel's content padding.\nconst bodyVariants = cva('ds:flex ds:flex-col ds:gap-[var(--spacing-md)]', {\n variants: {\n density: {\n comfortable: 'ds:p-[var(--spacing-md)]',\n compact: 'ds:p-[var(--spacing-sm)]',\n },\n },\n defaultVariants: {\n density: 'compact',\n },\n});\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* */\n/* The field model is the shared `_shared/patient-fields` vocabulary, so */\n/* PatientDetails and PatientSummaryCard speak ONE field language. The */\n/* visible set + order are a PER-CONTEXT preference the consumer owns and */\n/* wires per placement — never a single value synced across surfaces. The */\n/* `PatientDetails*` names below are kept as aliases for back-compat. */\n/* -------------------------------------------------------------------- */\n\nexport type {\n PatientField,\n PatientFieldSection,\n PatientFieldOption,\n PatientFieldEditType,\n PatientFieldEditValue,\n} from '../_shared/patient-fields';\n\n/** A label→value patient field. Alias of the shared {@link PatientField}. */\nexport type PatientDetailsField = PatientField;\n/** A labelled, collapsible group of fields. Alias of {@link PatientFieldSection}. */\nexport type PatientDetailsSection = PatientFieldSection;\n/** Alias of the shared {@link PatientFieldOption}. */\nexport type PatientDetailsFieldOption = PatientFieldOption;\n/** Alias of the shared {@link PatientFieldEditType}. */\nexport type PatientDetailsEditType = PatientFieldEditType;\n/** Alias of the shared {@link PatientFieldEditValue}. */\nexport type PatientDetailsEditValue = PatientFieldEditValue;\n\n/**\n * Imperative handle the agent adapter drives. Exposes only field KEYS and\n * an opaque `patientId` for reads; `updateField` routes writes through the\n * same `onFieldSave` path as a human inline edit (no second channel).\n */\nexport interface PatientDetailsHandle {\n /** The current ordered list of visible field ids. */\n getVisibleFieldOrder: () => string[];\n /** Opaque patient id (no PHI). */\n getPatientId: () => string | undefined;\n /** Replace the visible set, preserving the given order (filtered to known fields). */\n setVisibleFields: (fieldIds: string[]) => void;\n /** Replace the full ordered visible list (filtered to known fields). */\n setFieldOrder: (orderedIds: string[]) => void;\n /** Write a field value — delegates to `onFieldSave`. Rejects if no handler. */\n updateField: (fieldId: string, value: unknown) => Promise<void>;\n}\n\nexport interface PatientDetailsProps extends Omit<\n HTMLAttributes<HTMLElement>,\n 'title' | 'children'\n> {\n /** Patient display name — the panel heading. */\n title: ReactNode;\n /** The sectioned field catalogue (consumer-mapped from DoctorPatient). */\n sections: PatientDetailsSection[];\n /**\n * Header avatar photo / initials override. The panel always fronts the name\n * with an Avatar — initials derive from a string `title` by default; pass\n * `src` for a photo, or `name` to override the initials source.\n */\n avatar?: { src?: string; name?: string };\n /** At-a-glance chips under the name (consumer-composed Badge/Tag/Chip row). */\n headerChips?: ReactNode;\n\n /* ----- inline editing (kit-owned controls, consumer-owned write) ----- */\n\n /**\n * Frame the identity header and each section in its own elevated `Card`,\n * for a \"control-room\" rail that reads as a stack of cards rather than one\n * flat panel. Default `false` (the flat panel with a header rule + eyebrow\n * section headings). When framed, the header rule is dropped — the cards\n * provide the separation.\n */\n framed?: boolean;\n /** Master switch — show edit affordances on `editable` fields. */\n editable?: boolean;\n /**\n * Persist a field edit. Resolve ⇒ committed; reject(Error) ⇒ the message\n * is shown inline and the row stays in edit mode. Also the single channel\n * the agent's `update_field` uses.\n */\n onFieldSave?: (fieldId: string, value: unknown) => Promise<void>;\n /** Domain validation — return an error message, or `null` when valid. */\n validate?: (fieldId: string, value: unknown) => string | null;\n\n /* ----- customization (the cog; controlled OR uncontrolled) ----- */\n\n /**\n * Controlled ordered list of visible field ids. `undefined` ⇒ every field\n * visible; an explicit `[]` ⇒ none (a panel that starts collapsed).\n */\n visibleFieldOrder?: string[];\n /** Uncontrolled initial order. Omit both ⇒ every field visible, in declaration order. */\n defaultVisibleFieldOrder?: string[];\n /** Fired whenever the user shows/hides/reorders fields via the cog. */\n onVisibleFieldsChange?: (orderedIds: string[]) => void;\n\n /* ----- states ----- */\n\n /** Render the loading skeleton. */\n loading?: boolean;\n /** Shown when there are no sections / no patient. Defaults to a localised hint. */\n emptyState?: ReactNode;\n\n /* ----- agent / a11y ----- */\n\n /** Opaque patient id — emitted as `data-patient-id` + agent stateRead. No PHI. */\n patientId?: string;\n /** Agent-readiness instance id, surfaced as `data-component-id`. */\n id?: string;\n /** BCP-47 locale override (currency / number editors). */\n locale?: string;\n /** Override the cog trigger's accessible name. */\n cogLabel?: string;\n /**\n * Visible panel-chrome heading (the sticky PanelHeader title). Defaults\n * to the kit's localised \"Patient details\". Pass an app-translated\n * string when the panel fronts a different record built from the same\n * chrome — \"Appointment details\", \"Task details\" — so the header names\n * what is actually shown. Also the `aria-label` fallback.\n */\n panelTitle?: string;\n /** Override the panel region's accessible name (defaults to the heading). */\n 'aria-label'?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const PatientDetails = forwardRef<HTMLElement, PatientDetailsProps>(\n function PatientDetails(\n {\n title,\n sections,\n avatar,\n headerChips,\n framed = false,\n editable = false,\n onFieldSave,\n validate,\n visibleFieldOrder,\n defaultVisibleFieldOrder,\n onVisibleFieldsChange,\n loading = false,\n emptyState,\n patientId,\n id,\n locale,\n cogLabel,\n panelTitle: panelTitleProp,\n 'aria-label': ariaLabel,\n className,\n ...rest\n },\n ref,\n ) {\n const { t } = useTranslation('ui');\n const headingId = useId();\n\n // Per-context field visibility + ordering. The order is a per-INSTANCE\n // preference the kit never persists — the consumer wires its own\n // value/onChange, so the same field vocabulary can render differently in\n // different parts of the app (see usePatientFieldVisibility).\n const {\n visible,\n catalogueIds,\n setOrder,\n toggleField,\n toggleSection,\n moveFieldOnto,\n reset: resetToDefaults,\n } = usePatientFieldVisibility(sections, {\n value: visibleFieldOrder,\n defaultValue: defaultVisibleFieldOrder,\n onChange: onVisibleFieldsChange,\n });\n\n /* ---- imperative handle (agent) ------------------------------- */\n\n const handle = useMemo<PatientDetailsHandle>(\n () => ({\n getVisibleFieldOrder: () => visible,\n getPatientId: () => patientId,\n setVisibleFields: (fieldIds) => setOrder(fieldIds),\n setFieldOrder: (orderedIds) => setOrder(orderedIds),\n updateField: (fieldId, value) => {\n if (!onFieldSave) {\n return Promise.reject(\n new Error('PatientDetails: no onFieldSave handler is wired.'),\n );\n }\n return onFieldSave(fieldId, value);\n },\n }),\n [visible, patientId, setOrder, onFieldSave],\n );\n useAgentRegistration(patientDetailsAgent, handle, id);\n\n /* ---- region accessible name ---------------------------------- */\n\n const panelTitle =\n panelTitleProp ??\n t('patientDetails.regionLabel', {\n defaultValue: 'Patient details',\n });\n const resolvedAriaLabel = ariaLabel ?? panelTitle;\n\n /* ---- header avatar ------------------------------------------- */\n // Parity with the card: the panel fronts the name with an Avatar (photo via\n // `avatar.src`, else initials from the name). Omitted only when `title` is a\n // non-string node and no `avatar.name` is given (nothing to derive from).\n const avatarName =\n avatar?.name ?? (typeof title === 'string' ? title : undefined);\n const showAvatar = Boolean(avatar?.src || avatarName);\n\n /* ---- loading / empty ----------------------------------------- */\n\n const hasVisible = catalogueIds.some((cid) => visible.includes(cid));\n\n if (loading) {\n return (\n <section\n ref={ref}\n data-component=\"patient-details\"\n data-component-id={id}\n data-patient-id={patientId}\n aria-label={resolvedAriaLabel}\n aria-busy=\"true\"\n className={rootVariants({ className })}\n {...rest}\n >\n <div className={bodyVariants()}>\n <PatientDetailsSkeleton />\n </div>\n </section>\n );\n }\n\n const isEmpty = sections.length === 0 || !hasVisible;\n\n // The identity card (avatar + name + chips) is now the FIRST block of the\n // scrolling body — the shared PanelHeader owns the panel title row. The\n // name demotes to <h3> (the PanelHeader title is the <h2>).\n const identityBlock = (\n <div className=\"ds:flex ds:items-start ds:gap-[var(--spacing-sm)]\">\n {showAvatar ? (\n <Avatar\n size=\"md\"\n name={avatarName}\n src={avatar?.src}\n className=\"ds:shrink-0\"\n />\n ) : null}\n <div className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-2xs)]\">\n <h3 className=\"ds:m-0 type-title-item ds:text-[color:var(--foreground)]\">\n {title}\n </h3>\n {/* Chips sit under the NAME (not the avatar) — same column shape\n as the card's identity line. */}\n {headerChips ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]\">\n {headerChips}\n </div>\n ) : null}\n </div>\n </div>\n );\n\n return (\n <section\n ref={ref}\n data-component=\"patient-details\"\n data-component-id={id}\n data-patient-id={patientId}\n aria-labelledby={ariaLabel ? undefined : headingId}\n aria-label={ariaLabel ?? undefined}\n className={rootVariants({ className })}\n {...rest}\n >\n {/* The shared rail-panel header: panel title + the field-picker cog as\n its panel-owned action; the rail injects favourite/close after it.\n Sticky + divider so the title stays as the body scrolls. */}\n <PanelHeader\n title={panelTitle}\n icon={<ClipboardList aria-hidden=\"true\" />}\n headingId={headingId}\n sticky\n divider\n actions={\n <FieldVisibilityCog\n sections={sections}\n visible={visible}\n onToggleField={toggleField}\n onToggleSection={toggleSection}\n onMoveFieldOnto={moveFieldOnto}\n onReset={resetToDefaults}\n label={cogLabel}\n />\n }\n />\n\n <div className={bodyVariants()}>\n {/* Identity card — first block of the body; framed wraps it in its\n own elevated card alongside each section. */}\n {framed ? (\n <Card variant=\"elevated\">\n <Card.Body>{identityBlock}</Card.Body>\n </Card>\n ) : (\n identityBlock\n )}\n\n {/* Body — one card per section when framed, otherwise a flat stack. */}\n {isEmpty ? (\n <p className=\"ds:m-0 type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {emptyState ??\n t('patientDetails.empty', {\n defaultValue: 'No patient selected.',\n })}\n </p>\n ) : (\n resolveVisibleFields(sections, visible)\n // A section whose fields are all hidden drops out entirely —\n // no empty card / \"No fields shown.\" placeholder. (The field\n // picker still lists it, so hidden fields can be re-added.)\n .filter(({ fields }) => fields.length > 0)\n .map(({ section, fields }) => {\n const block = (\n <SectionBlock\n section={section}\n fields={fields}\n editable={editable}\n onFieldSave={onFieldSave}\n validate={validate}\n locale={locale}\n />\n );\n return framed ? (\n <Card key={section.id} variant=\"elevated\">\n <Card.Body>{block}</Card.Body>\n </Card>\n ) : (\n <Fragment key={section.id}>{block}</Fragment>\n );\n })\n )}\n </div>\n </section>\n );\n },\n);\n\nPatientDetails.displayName = 'PatientDetails';\n\n/* -------------------------------------------------------------------- */\n/* SectionBlock — one collapsible group */\n/* -------------------------------------------------------------------- */\n\nfunction SectionBlock({\n section,\n fields,\n editable,\n onFieldSave,\n validate,\n locale,\n}: {\n section: PatientDetailsSection;\n fields: PatientDetailsField[];\n editable: boolean;\n onFieldSave?: (fieldId: string, value: unknown) => Promise<void>;\n validate?: (fieldId: string, value: unknown) => string | null;\n locale?: string;\n}): ReactNode {\n const { t } = useTranslation('ui');\n const headingId = useId();\n const collapsible = section.collapsible ?? true;\n\n // The empty hint must be a SIBLING of the <dl>, never a child — a <p> is\n // not a valid direct child of <dl> (axe `definition-list`).\n const rows =\n fields.length === 0 ? (\n <p className=\"ds:m-0 type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {t('patientDetails.section.empty', {\n defaultValue: 'No fields shown.',\n })}\n </p>\n ) : (\n <DescriptionList\n layout=\"inline\"\n density=\"compact\"\n divider=\"none\"\n // Label icons paint in the accent (the slot's recolour hook); no row rules.\n className=\"ds:[--description-list-icon-color:var(--accent)]\"\n >\n {fields.map((field) => (\n <PatientFieldRow\n key={field.id}\n field={field}\n // Surface the icon on the direct child: DescriptionList reserves its\n // icon column by inspecting direct children only, so the FieldRow\n // wrapper must carry it (not just the nested Row).\n icon={field.icon ?? null}\n editable={editable}\n onFieldSave={onFieldSave}\n validate={validate}\n locale={locale}\n />\n ))}\n </DescriptionList>\n );\n\n if (!collapsible) {\n return (\n <section\n aria-labelledby={headingId}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\"\n >\n <h3\n id={headingId}\n className=\"ds:m-0 type-eyebrow ds:text-[color:var(--foreground)]\"\n >\n {section.heading}\n </h3>\n {rows}\n </section>\n );\n }\n\n return (\n <Collapsible\n defaultOpen={section.defaultOpen ?? true}\n variant=\"minimal\"\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\"\n >\n {/* Real <h3> so collapsible sections appear in the heading outline\n (the non-collapsible branch is an <h3> too); the WAI-ARIA accordion\n pattern is a heading wrapping the disclosure button. */}\n <h3 className=\"ds:m-0\">\n <CollapsibleTrigger asChild>\n <button\n type=\"button\"\n id={headingId}\n className=\"ds:flex ds:w-full ds:items-center ds:justify-between ds:gap-[var(--spacing-xs)] ds:bg-transparent ds:border-0 ds:p-0 ds:text-start ds:cursor-pointer ds:rounded-[var(--radius-sm)] ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)] ds:forced-colors:focus-visible:outline-[CanvasText] type-eyebrow ds:text-[color:var(--foreground)]\"\n >\n {section.heading}\n </button>\n </CollapsibleTrigger>\n </h3>\n <CollapsibleContent aria-labelledby={headingId}>\n {rows}\n </CollapsibleContent>\n </Collapsible>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* Skeleton */\n/* -------------------------------------------------------------------- */\n\nfunction PatientDetailsSkeleton(): ReactNode {\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n <span className=\"ds:size-10 ds:shrink-0 ds:rounded-full ds:bg-[color:var(--muted)]\" />\n <span className=\"ds:h-4 ds:w-1/2 ds:rounded-[var(--radius-sm)] ds:bg-[color:var(--muted)]\" />\n </div>\n {[0, 1, 2].map((i) => (\n <span\n key={i}\n className=\"ds:h-4 ds:w-full ds:rounded-[var(--radius-sm)] ds:bg-[color:var(--muted)]\"\n />\n ))}\n </div>\n );\n}\n\n/** Density variant union re-exported for downstream typing. */\nexport type PatientDetailsDensity = NonNullable<\n VariantProps<typeof rootVariants>['density']\n>;\n"],"names":["patientDetailsAgent","handle","args","rootVariants","cva","bodyVariants","PatientDetails","forwardRef","title","sections","avatar","headerChips","framed","editable","onFieldSave","validate","visibleFieldOrder","defaultVisibleFieldOrder","onVisibleFieldsChange","loading","emptyState","patientId","id","locale","cogLabel","panelTitleProp","ariaLabel","className","rest","ref","t","useTranslation","headingId","useId","visible","catalogueIds","setOrder","toggleField","toggleSection","moveFieldOnto","resetToDefaults","usePatientFieldVisibility","useMemo","fieldIds","orderedIds","fieldId","value","useAgentRegistration","panelTitle","resolvedAriaLabel","avatarName","showAvatar","hasVisible","cid","jsx","PatientDetailsSkeleton","isEmpty","identityBlock","jsxs","Avatar","PanelHeader","ClipboardList","FieldVisibilityCog","Card","resolveVisibleFields","fields","section","block","SectionBlock","Fragment","collapsible","rows","DescriptionList","field","PatientFieldRow","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oe } from "./calendar-days-BGWklvE-.js";
|
|
|
18
18
|
import { H as le } from "./hourglass-BEAzW1wE.js";
|
|
19
19
|
import { c as G } from "./createLucideIcon-DhHxpK9K.js";
|
|
20
20
|
import { U as ce } from "./user-B12p7bVF.js";
|
|
21
|
-
import { C as de } from "./city-input-
|
|
22
|
-
import { C as ue } from "./country-select-
|
|
21
|
+
import { C as de } from "./city-input-CJVGswxp.js";
|
|
22
|
+
import { C as ue } from "./country-select-DQ8q7ypA.js";
|
|
23
23
|
import { D as me } from "./date-picker-CdhXlgVI.js";
|
|
24
24
|
import { E as pe } from "./email-input-C7THAwh2.js";
|
|
25
25
|
import { F as fe } from "./fiscal-code-input-BzWmNDnl.js";
|
|
26
26
|
import { N as ge } from "./number-input-CVwI1ltI.js";
|
|
27
|
-
import { P as he } from "./phone-input-
|
|
27
|
+
import { P as he } from "./phone-input-DJ4BN8tG.js";
|
|
28
28
|
import { P as ye } from "./postal-code-input-CfZOnIkW.js";
|
|
29
|
-
import { P as be } from "./province-select-
|
|
29
|
+
import { P as be } from "./province-select-CPdTwEob.js";
|
|
30
30
|
import { S as ve } from "./select-4S-eYZUf.js";
|
|
31
31
|
import { S as xe } from "./switch-D--x7n6h.js";
|
|
32
32
|
import { T as Ce } from "./text-area-COMVJ1yE.js";
|
|
@@ -805,4 +805,4 @@ export {
|
|
|
805
805
|
Dt as r,
|
|
806
806
|
St as u
|
|
807
807
|
};
|
|
808
|
-
//# sourceMappingURL=patient-field-row-
|
|
808
|
+
//# sourceMappingURL=patient-field-row-R73dZJY6.js.map
|