@alfadocs/ui-kit-debug 1.90.1 → 1.90.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/dist/_chunks/address-autocomplete-DR4Xn23Z.js +519 -0
  2. package/dist/_chunks/address-autocomplete-DR4Xn23Z.js.map +1 -0
  3. package/dist/_chunks/{address-fields-CfnXK8RT.js → address-fields-qxQkGwPf.js} +5 -5
  4. package/dist/_chunks/{address-fields-CfnXK8RT.js.map → address-fields-qxQkGwPf.js.map} +1 -1
  5. package/dist/_chunks/{ai-permission-notice-CoW22jx1.js → ai-permission-notice-VNh3W57L.js} +2 -2
  6. package/dist/_chunks/{ai-permission-notice-CoW22jx1.js.map → ai-permission-notice-VNh3W57L.js.map} +1 -1
  7. package/dist/_chunks/{anamnesis-summary-rows-fbEQwcuW.js → anamnesis-summary-rows-EKPfVCmh.js} +2 -2
  8. package/dist/_chunks/{anamnesis-summary-rows-fbEQwcuW.js.map → anamnesis-summary-rows-EKPfVCmh.js.map} +1 -1
  9. package/dist/_chunks/autocomplete-BXMcNoa3.js +562 -0
  10. package/dist/_chunks/autocomplete-BXMcNoa3.js.map +1 -0
  11. package/dist/_chunks/{balance-badge-cell-C4FYwmrZ.js → balance-badge-cell-D9VhFp0L.js} +3 -3
  12. package/dist/_chunks/{balance-badge-cell-C4FYwmrZ.js.map → balance-badge-cell-D9VhFp0L.js.map} +1 -1
  13. package/dist/_chunks/{booking-C0FoW8Yx.js → booking-CcE_oviI.js} +1896 -1859
  14. package/dist/_chunks/booking-CcE_oviI.js.map +1 -0
  15. package/dist/_chunks/{calendar-appointment-editor-dialog-C1v2MNE4.js → calendar-appointment-editor-dialog-CiAGAX2t.js} +7 -7
  16. package/dist/_chunks/{calendar-appointment-editor-dialog-C1v2MNE4.js.map → calendar-appointment-editor-dialog-CiAGAX2t.js.map} +1 -1
  17. package/dist/_chunks/{checkbox-BjDv-r3o.js → checkbox-a7Sh-dXb.js} +32 -31
  18. package/dist/_chunks/checkbox-a7Sh-dXb.js.map +1 -0
  19. package/dist/_chunks/{checkbox-group-Cw2H5qaq.js → checkbox-group-eGdv9fZc.js} +2 -2
  20. package/dist/_chunks/{checkbox-group-Cw2H5qaq.js.map → checkbox-group-eGdv9fZc.js.map} +1 -1
  21. package/dist/_chunks/{city-input-CJVGswxp.js → city-input-CA59CjnV.js} +2 -2
  22. package/dist/_chunks/{city-input-CJVGswxp.js.map → city-input-CA59CjnV.js.map} +1 -1
  23. package/dist/_chunks/{combobox-CDPm_n0p.js → combobox-D-gpgEDy.js} +314 -294
  24. package/dist/_chunks/combobox-D-gpgEDy.js.map +1 -0
  25. package/dist/_chunks/{country-select-DQ8q7ypA.js → country-select-BfmX9y5i.js} +2 -2
  26. package/dist/_chunks/{country-select-DQ8q7ypA.js.map → country-select-BfmX9y5i.js.map} +1 -1
  27. package/dist/_chunks/{data-table-B_IcS0Ke.js → data-table-CqQgoNsU.js} +2 -2
  28. package/dist/_chunks/{data-table-B_IcS0Ke.js.map → data-table-CqQgoNsU.js.map} +1 -1
  29. package/dist/_chunks/{face-scheme-BgJGFDTa.js → face-scheme-BKSE98bo.js} +2 -2
  30. package/dist/_chunks/{face-scheme-BgJGFDTa.js.map → face-scheme-BKSE98bo.js.map} +1 -1
  31. package/dist/_chunks/{file-manager-C9YOT-Dn.js → file-manager-BnI1ZWZu.js} +2 -2
  32. package/dist/_chunks/{file-manager-C9YOT-Dn.js.map → file-manager-BnI1ZWZu.js.map} +1 -1
  33. package/dist/_chunks/{header-settings-BVhjndtV.js → header-settings-BeA2fnol.js} +24 -23
  34. package/dist/_chunks/header-settings-BeA2fnol.js.map +1 -0
  35. package/dist/_chunks/{heatmap-HTz3Jvzy.js → heatmap-fCxwNz2o.js} +2 -2
  36. package/dist/_chunks/{heatmap-HTz3Jvzy.js.map → heatmap-fCxwNz2o.js.map} +1 -1
  37. package/dist/_chunks/{link-cell-renderer-C0ynDik7.js → link-cell-renderer-CnCgudvq.js} +3 -3
  38. package/dist/_chunks/{link-cell-renderer-C0ynDik7.js.map → link-cell-renderer-CnCgudvq.js.map} +1 -1
  39. package/dist/_chunks/{login-dev-card-DYwbL5sD.js → login-dev-card-BZBR58mu.js} +2 -2
  40. package/dist/_chunks/{login-dev-card-DYwbL5sD.js.map → login-dev-card-BZBR58mu.js.map} +1 -1
  41. package/dist/_chunks/{map-view-Bvi06RVh.js → map-view-UrNgxBy3.js} +260 -237
  42. package/dist/_chunks/map-view-UrNgxBy3.js.map +1 -0
  43. package/dist/_chunks/{index.modern-BeRXQVdc.js → maps-core-gate-DkNqGkm3.js} +360 -319
  44. package/dist/_chunks/maps-core-gate-DkNqGkm3.js.map +1 -0
  45. package/dist/_chunks/{marketplace-app-shell-x_abo_ye.js → marketplace-app-shell-CmZx0Oam.js} +2 -2
  46. package/dist/_chunks/{marketplace-app-shell-x_abo_ye.js.map → marketplace-app-shell-CmZx0Oam.js.map} +1 -1
  47. package/dist/_chunks/{notes-panel-CZO1qsD-.js → notes-panel-Dywo6R55.js} +2 -2
  48. package/dist/_chunks/{notes-panel-CZO1qsD-.js.map → notes-panel-Dywo6R55.js.map} +1 -1
  49. package/dist/_chunks/{patient-details-D0P5eog5.js → patient-details-BUr7Oemx.js} +2 -2
  50. package/dist/_chunks/{patient-details-D0P5eog5.js.map → patient-details-BUr7Oemx.js.map} +1 -1
  51. package/dist/_chunks/{patient-field-row-R73dZJY6.js → patient-field-row-bJk8Q_qr.js} +5 -5
  52. package/dist/_chunks/{patient-field-row-R73dZJY6.js.map → patient-field-row-bJk8Q_qr.js.map} +1 -1
  53. package/dist/_chunks/patient-search-Ca9j5cWb.js +1306 -0
  54. package/dist/_chunks/patient-search-Ca9j5cWb.js.map +1 -0
  55. package/dist/_chunks/{patient-summary-card-6U74-ivO.js → patient-summary-card-CCQZ8X37.js} +2 -2
  56. package/dist/_chunks/{patient-summary-card-6U74-ivO.js.map → patient-summary-card-CCQZ8X37.js.map} +1 -1
  57. package/dist/_chunks/{periodontal-diagnosis-B9YmmVmM.js → periodontal-diagnosis-DD3hrg9X.js} +2 -2
  58. package/dist/_chunks/{periodontal-diagnosis-B9YmmVmM.js.map → periodontal-diagnosis-DD3hrg9X.js.map} +1 -1
  59. package/dist/_chunks/{permission-matrix-BoQjENGV.js → permission-matrix-BJ6sg3Zp.js} +3 -3
  60. package/dist/_chunks/{permission-matrix-BoQjENGV.js.map → permission-matrix-BJ6sg3Zp.js.map} +1 -1
  61. package/dist/_chunks/{practice-results-B61krlwu.js → practice-results-DQuOfqej.js} +2 -2
  62. package/dist/_chunks/{practice-results-B61krlwu.js.map → practice-results-DQuOfqej.js.map} +1 -1
  63. package/dist/_chunks/{province-select-CPdTwEob.js → province-select-D64whw0m.js} +2 -2
  64. package/dist/_chunks/{province-select-CPdTwEob.js.map → province-select-D64whw0m.js.map} +1 -1
  65. package/dist/_chunks/{registration-form-DmP3YUfp.js → registration-form-CRm6DaB9.js} +2 -2
  66. package/dist/_chunks/{registration-form-DmP3YUfp.js.map → registration-form-CRm6DaB9.js.map} +1 -1
  67. package/dist/_chunks/{reviews-panel-UzQQLb-z.js → reviews-panel-B7InBORU.js} +42 -41
  68. package/dist/_chunks/reviews-panel-B7InBORU.js.map +1 -0
  69. package/dist/_chunks/{rich-text-editor-BZTyxQBd.js → rich-text-editor-BfEu57dk.js} +3 -3
  70. package/dist/_chunks/{rich-text-editor-BZTyxQBd.js.map → rich-text-editor-BfEu57dk.js.map} +1 -1
  71. package/dist/_chunks/{slot-grid-Bb13H9Rl.js → slot-grid-DrwynKeN.js} +91 -89
  72. package/dist/_chunks/{slot-grid-Bb13H9Rl.js.map → slot-grid-DrwynKeN.js.map} +1 -1
  73. package/dist/_chunks/{task-editor-BOETWbjU.js → task-editor-CI1SKUNc.js} +2 -2
  74. package/dist/_chunks/{task-editor-BOETWbjU.js.map → task-editor-CI1SKUNc.js.map} +1 -1
  75. package/dist/_chunks/{use-appointment-details-read-CWN-nJCZ.js → use-appointment-details-read-BytPq3Ux.js} +2 -2
  76. package/dist/_chunks/{use-appointment-details-read-CWN-nJCZ.js.map → use-appointment-details-read-BytPq3Ux.js.map} +1 -1
  77. package/dist/_chunks/{voice-control-panel-BziKE-KK.js → voice-control-panel-BP0otrID.js} +2 -2
  78. package/dist/_chunks/{voice-control-panel-BziKE-KK.js.map → voice-control-panel-BP0otrID.js.map} +1 -1
  79. package/dist/_chunks/{workflow-webhook-action-DulCpCRz.js → workflow-webhook-action-B_nBJ_ht.js} +2 -2
  80. package/dist/_chunks/{workflow-webhook-action-DulCpCRz.js.map → workflow-webhook-action-B_nBJ_ht.js.map} +1 -1
  81. package/dist/agent-catalog.json +2 -2
  82. package/dist/agent-i18n/en.json +1 -1
  83. package/dist/components/_shared/maps-core-gate.d.ts +18 -0
  84. package/dist/components/_shared/maps-core-gate.d.ts.map +1 -0
  85. package/dist/components/address-autocomplete/address-autocomplete.d.ts.map +1 -1
  86. package/dist/components/address-autocomplete/index.js +1 -1
  87. package/dist/components/address-fields/index.js +1 -1
  88. package/dist/components/ai-permission-notice/index.js +1 -1
  89. package/dist/components/appointment-details-panel/index.js +1 -1
  90. package/dist/components/autocomplete/autocomplete.agent.d.ts.map +1 -1
  91. package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
  92. package/dist/components/autocomplete/index.js +1 -1
  93. package/dist/components/booking/booking.d.ts.map +1 -1
  94. package/dist/components/booking/details-form.d.ts.map +1 -1
  95. package/dist/components/booking/index.js +1 -1
  96. package/dist/components/checkbox/checkbox.d.ts.map +1 -1
  97. package/dist/components/checkbox/index.js +1 -1
  98. package/dist/components/checkbox-group/index.js +1 -1
  99. package/dist/components/city-input/index.js +1 -1
  100. package/dist/components/combobox/combobox.d.ts.map +1 -1
  101. package/dist/components/combobox/index.js +1 -1
  102. package/dist/components/country-select/index.js +1 -1
  103. package/dist/components/data-table/index.js +2 -2
  104. package/dist/components/face-scheme/index.js +1 -1
  105. package/dist/components/file-manager/index.js +1 -1
  106. package/dist/components/header-settings/header-settings.d.ts +2 -1
  107. package/dist/components/header-settings/header-settings.d.ts.map +1 -1
  108. package/dist/components/header-settings/index.js +1 -1
  109. package/dist/components/heatmap/index.js +1 -1
  110. package/dist/components/map-view/index.js +1 -1
  111. package/dist/components/map-view/map-view.d.ts.map +1 -1
  112. package/dist/components/notes-panel/index.js +1 -1
  113. package/dist/components/patient-details/index.js +1 -1
  114. package/dist/components/patient-search/index.js +1 -1
  115. package/dist/components/patient-search/patient-search.d.ts.map +1 -1
  116. package/dist/components/patient-summary-card/index.js +1 -1
  117. package/dist/components/patient-table/index.js +1 -1
  118. package/dist/components/periodontal-diagnosis/index.js +1 -1
  119. package/dist/components/permission-matrix/index.js +1 -1
  120. package/dist/components/practice-results/index.js +1 -1
  121. package/dist/components/province-select/index.js +1 -1
  122. package/dist/components/reviews-panel/index.js +1 -1
  123. package/dist/components/reviews-panel/reviews-panel.d.ts.map +1 -1
  124. package/dist/components/rich-text-editor/index.js +1 -1
  125. package/dist/components/slot-grid/index.js +1 -1
  126. package/dist/components/slot-grid/slot-grid.d.ts.map +1 -1
  127. package/dist/components/task-editor/index.js +1 -1
  128. package/dist/components/voice-control-panel/index.js +1 -1
  129. package/dist/host-compat.css +1 -10
  130. package/dist/index.js +37 -37
  131. package/dist/patterns/anamnesis/index.js +1 -1
  132. package/dist/patterns/calendar/index.js +1 -1
  133. package/dist/patterns/login-form/index.js +1 -1
  134. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  135. package/dist/patterns/registration-form/index.js +1 -1
  136. package/dist/patterns/workflow-webhook-action/index.js +1 -1
  137. package/dist/tokens.css +1 -1
  138. package/package.json +1 -1
  139. package/dist/_chunks/address-autocomplete-bPR2mNBt.js +0 -498
  140. package/dist/_chunks/address-autocomplete-bPR2mNBt.js.map +0 -1
  141. package/dist/_chunks/autocomplete-CnB1mHGc.js +0 -539
  142. package/dist/_chunks/autocomplete-CnB1mHGc.js.map +0 -1
  143. package/dist/_chunks/booking-C0FoW8Yx.js.map +0 -1
  144. package/dist/_chunks/checkbox-BjDv-r3o.js.map +0 -1
  145. package/dist/_chunks/combobox-CDPm_n0p.js.map +0 -1
  146. package/dist/_chunks/header-settings-BVhjndtV.js.map +0 -1
  147. package/dist/_chunks/index.modern-BeRXQVdc.js.map +0 -1
  148. package/dist/_chunks/map-view-Bvi06RVh.js.map +0 -1
  149. package/dist/_chunks/patient-search-CCOUZABE.js +0 -1196
  150. package/dist/_chunks/patient-search-CCOUZABE.js.map +0 -1
  151. package/dist/_chunks/reviews-panel-UzQQLb-z.js.map +0 -1
@@ -2,13 +2,13 @@ import { jsx as c } from "react/jsx-runtime";
2
2
  import { forwardRef as k, useRef as N, useEffect as O, useCallback as D, useMemo as B } from "react";
3
3
  import { c as H } from "./index-D2ZczOXr.js";
4
4
  import { useTranslation as K } from "react-i18next";
5
- import { C as M } from "./country-select-DQ8q7ypA.js";
6
- import { P as U } from "./province-select-CPdTwEob.js";
5
+ import { C as M } from "./country-select-BfmX9y5i.js";
6
+ import { P as U } from "./province-select-D64whw0m.js";
7
7
  import { P as W } from "./postal-code-input-CfZOnIkW.js";
8
- import { C as Y } from "./city-input-CJVGswxp.js";
8
+ import { C as Y } from "./city-input-CA59CjnV.js";
9
9
  import { T as z } from "./text-input-CaG9ApoE.js";
10
10
  import { F as y } from "./form-field-CyHfOVKF.js";
11
- import { A as G } from "./address-autocomplete-bPR2mNBt.js";
11
+ import { A as G } from "./address-autocomplete-DR4Xn23Z.js";
12
12
  import { u as J } from "./registry-DvAUVLHh.js";
13
13
  const Q = {
14
14
  street: { type: "string" },
@@ -295,4 +295,4 @@ export {
295
295
  te as A,
296
296
  X as a
297
297
  };
298
- //# sourceMappingURL=address-fields-CfnXK8RT.js.map
298
+ //# sourceMappingURL=address-fields-qxQkGwPf.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"address-fields-CfnXK8RT.js","sources":["../../src/components/address-fields/address-fields.agent.ts","../../src/components/address-fields/address-fields.tsx"],"sourcesContent":["import type { AgentAdapter } from '../../agent/types';\nimport type { StructuredAddress } from '../address-autocomplete';\n\nexport interface AddressFieldsHandle {\n getValue: () => StructuredAddress;\n setValue: (value: StructuredAddress) => void;\n setField: (field: keyof StructuredAddress, value: string) => void;\n}\n\nconst ADDRESS_PROPERTIES = {\n street: { type: 'string' },\n city: { type: 'string' },\n postcode: { type: 'string' },\n province: { type: 'string', description: 'UPPERCASED province code.' },\n country: { type: 'string', description: 'ISO alpha-2, lowercased.' },\n formatted: { type: 'string' },\n} as const;\n\nexport const addressFieldsAgent: AgentAdapter<AddressFieldsHandle> = {\n id: 'address-fields',\n // `set_value` only — a structured address form sets discrete fields; it does\n // no granular in-place rich-text editing, so `edit_inline` does not apply.\n capabilities: ['set_value'],\n state: {\n value: {\n type: 'object',\n descriptionKey: 'ui.agent.addressFields.state.value',\n description:\n 'The current structured address: { street, city, postcode, province, country, formatted }.',\n read: (handle) => handle.getValue(),\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ value: StructuredAddress }',\n argsSchema: {\n type: 'object',\n properties: {\n value: { type: 'object', properties: ADDRESS_PROPERTIES },\n },\n required: ['value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.addressFields.actions.setValue',\n description: 'Replace the entire address.',\n invoke: (handle, args: { value: StructuredAddress }) => {\n handle.setValue(args.value);\n },\n },\n set_field: {\n // Contact-data write (street/city/postcode/etc.), not clinical PHI —\n // consistent with PhoneInput / EmailInput / FiscalCodeInput, which all\n // treat identifying contact data as `write`.\n safety: 'write',\n argsType:\n \"{ field: 'street' | 'city' | 'postcode' | 'province' | 'country'; value: string }\",\n argsSchema: {\n type: 'object',\n properties: {\n field: {\n type: 'string',\n enum: ['street', 'city', 'postcode', 'province', 'country'],\n },\n value: { type: 'string' },\n },\n required: ['field', 'value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.addressFields.actions.setField',\n description:\n 'Set a single address field. Setting `country` also clears the now-stale province.',\n examples: [\n {\n args: { field: 'country', value: 'it' },\n note: 'Set the country to Italy.',\n },\n ],\n invoke: (\n handle,\n args: { field: keyof StructuredAddress; value: string },\n ) => {\n handle.setField(args.field, args.value);\n },\n },\n },\n domHooks: {\n root: { attr: 'data-component', value: 'address-fields' },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n type ChangeEvent,\n type ReactNode,\n} from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { CountrySelect } from '../country-select/country-select';\nimport { ProvinceSelect } from '../province-select/province-select';\nimport { PostalCodeInput } from '../postal-code-input/postal-code-input';\nimport { CityInput, type CityLoaderContext } from '../city-input/city-input';\nimport { TextInput } from '../text-input';\nimport { FormField } from '../form-field/form-field';\nimport {\n AddressAutocomplete,\n type GetSuggestions,\n type StructuredAddress,\n} from '../address-autocomplete';\nimport type { OptionShape } from '../_shared/option';\nimport { useAgentRegistration } from '../../agent';\nimport {\n addressFieldsAgent,\n type AddressFieldsHandle,\n} from './address-fields.agent';\n\n/* ------------------------------------------------------------------ */\n/* Public API */\n/* */\n/* A shippable composite that wires the address fields together and */\n/* emits a single StructuredAddress. Country drives the rest: it re-keys */\n/* the province dataset, swaps the postcode rule, and re-orders the */\n/* fields. An optional \"find address\" bar fans an AddressAutocomplete */\n/* selection out into the individual fields. */\n/* ------------------------------------------------------------------ */\n\nexport type AddressFieldKey = 'street' | 'city' | 'postcode' | 'province';\n\nconst EMPTY_ADDRESS: StructuredAddress = {\n street: '',\n city: '',\n postcode: '',\n province: '',\n country: '',\n formatted: '',\n};\n\n// Minimal country-keyed field-order map — NOT a libaddressinput port.\n// Extend with another entry when a country needs a different order.\nconst FIELD_ORDER: Record<string, AddressFieldKey[]> = {\n it: ['street', 'postcode', 'city', 'province'],\n};\nconst DEFAULT_ORDER: AddressFieldKey[] = [\n 'street',\n 'city',\n 'postcode',\n 'province',\n];\n\n// Fields that span the full width in the grid layout.\nconst WIDE_CELLS = new Set<string>(['findbar', 'country', 'street']);\n\nconst layoutVariants = cva('', {\n variants: {\n layout: {\n stacked: 'ds:flex ds:flex-col ds:gap-[var(--spacing-md)]',\n grid: 'ds:grid ds:grid-cols-2 ds:gap-[var(--spacing-md)]',\n },\n },\n defaultVariants: { layout: 'stacked' },\n});\n\nexport interface AddressFieldsProps {\n /** The controlled address value. */\n value?: StructuredAddress;\n /** Fires with the next full address on any field change. */\n onChange?: (next: StructuredAddress) => void;\n /**\n * Which address-line fields to render, in order. The country picker\n * always renders first. Default resolves from the selected country.\n */\n fields?: AddressFieldKey[];\n /** Async city suggestion loader, forwarded to CityInput. */\n loadCities?: (\n query: string,\n ctx: CityLoaderContext,\n ) => Promise<OptionShape[]>;\n /** Float these countries to the top of the country picker. */\n popularCountries?: string[];\n /** Enable the \"find address\" bar — provide a Places API key… */\n apiKey?: string;\n /** …or a mock/real suggestion injector (wins over apiKey, like AddressAutocomplete). */\n getSuggestions?: GetSuggestions;\n layout?: 'stacked' | 'grid';\n /** Marks fields as required: `true` for every field shown, or a list\n * of the ones that are (a province is mandatory in some countries\n * only). The host still validates. */\n required?: boolean | readonly (AddressFieldKey | 'country')[];\n /** An error message per field, shown under it. The host validates and\n * decides when to show each one. */\n errors?: Partial<Record<AddressFieldKey | 'country', string>>;\n /** Whether a field's message raises `role=\"alert\"`, per field; each\n * does unless set to `false`. Turn it off for messages shown together,\n * such as by a refused submit, so they are not all announced at once. */\n announceErrors?: Partial<Record<AddressFieldKey | 'country', boolean>>;\n disabled?: boolean;\n id?: string;\n className?: string;\n}\n\nexport const AddressFields = forwardRef<HTMLDivElement, AddressFieldsProps>(\n function AddressFields(\n {\n value,\n onChange,\n fields,\n loadCities,\n popularCountries,\n apiKey,\n getSuggestions,\n layout = 'stacked',\n required,\n errors,\n announceErrors,\n disabled,\n id,\n className,\n },\n ref,\n ) {\n const { t } = useTranslation('ui');\n const address = value ?? EMPTY_ADDRESS;\n const country = address.country;\n\n const valueRef = useRef(address);\n useEffect(() => {\n valueRef.current = address;\n }, [address]);\n\n const update = useCallback(\n (patch: Partial<StructuredAddress>) => {\n /* A browser fills every field in one go, faster than the host\n re-renders: each change must build on the one before it. */\n const next = { ...valueRef.current, ...patch };\n valueRef.current = next;\n onChange?.(next);\n },\n [onChange],\n );\n\n // Find-bar selection fans the looked-up address out into every field.\n const handleFind = useCallback(\n (found: StructuredAddress) =>\n onChange?.({ ...valueRef.current, ...found }),\n [onChange],\n );\n\n const agentHandle = useMemo<AddressFieldsHandle>(\n () => ({\n getValue: () => valueRef.current,\n setValue: (next) => onChange?.(next),\n setField: (field, fieldValue) => {\n const patch: Partial<StructuredAddress> = { [field]: fieldValue };\n // Mirror the UI path: changing country re-keys the stale province.\n if (field === 'country') patch.province = '';\n onChange?.({ ...valueRef.current, ...patch });\n },\n }),\n [onChange],\n );\n useAgentRegistration(addressFieldsAgent, agentHandle, id);\n\n const order =\n fields ?? FIELD_ORDER[country?.toLowerCase() ?? ''] ?? DEFAULT_ORDER;\n\n const isRequired = (key: AddressFieldKey | 'country'): boolean =>\n required === true || (Array.isArray(required) && required.includes(key));\n\n const showFindBar = Boolean(apiKey || getSuggestions);\n\n // The composite's own adapter (`address-fields`) is the agent-addressable\n // surface; the child inputs below are deliberately rendered without an\n // `id`, so they register un-scoped rather than competing for handles.\n const fieldNode = (key: AddressFieldKey | 'country'): ReactNode => {\n switch (key) {\n case 'country':\n return (\n <FormField\n label={t('inputs.addressFields.country', 'Country')}\n required={isRequired('country')}\n error={errors?.country}\n announceError={announceErrors?.country ?? true}\n >\n <CountrySelect\n // cmdk names its input itself, so the label is passed too.\n aria-label={t('inputs.addressFields.country', 'Country')}\n value={country}\n // Country drives the rest — re-key province on change.\n onValueChange={(next) =>\n update({ country: next, province: '' })\n }\n popularCountries={popularCountries}\n disabled={disabled}\n />\n </FormField>\n );\n case 'street':\n return (\n <FormField\n label={t('inputs.addressFields.street', 'Street')}\n required={isRequired('street')}\n error={errors?.street}\n announceError={announceErrors?.street ?? true}\n >\n <TextInput\n value={address.street}\n onChange={(event: ChangeEvent<HTMLInputElement>) =>\n update({ street: event.target.value })\n }\n autoComplete=\"address-line1\"\n disabled={disabled}\n />\n </FormField>\n );\n case 'city':\n return (\n <FormField\n label={t('inputs.addressFields.city', 'City')}\n required={isRequired('city')}\n error={errors?.city}\n announceError={announceErrors?.city ?? true}\n >\n <CityInput\n value={address.city}\n onValueChange={(next) => update({ city: next })}\n loadCities={loadCities}\n country={country}\n province={address.province}\n disabled={disabled}\n />\n </FormField>\n );\n case 'postcode':\n return (\n <FormField\n label={t('inputs.addressFields.postcode', 'Postcode')}\n required={isRequired('postcode')}\n error={errors?.postcode}\n announceError={announceErrors?.postcode ?? true}\n >\n <PostalCodeInput\n value={address.postcode}\n onValueChange={(next) => update({ postcode: next })}\n country={country}\n disabled={disabled}\n />\n </FormField>\n );\n case 'province':\n return (\n <FormField\n label={t('inputs.addressFields.province', 'Province')}\n required={isRequired('province')}\n error={errors?.province}\n announceError={announceErrors?.province ?? true}\n >\n <ProvinceSelect\n aria-label={t('inputs.addressFields.province', 'Province')}\n value={address.province}\n onValueChange={(next) => update({ province: next })}\n country={country}\n disabled={disabled}\n />\n </FormField>\n );\n }\n };\n\n const cell = (key: string, node: ReactNode): ReactNode =>\n layout === 'grid' ? (\n <div\n key={key}\n data-address-field={key}\n className={WIDE_CELLS.has(key) ? 'ds:col-span-2' : undefined}\n >\n {node}\n </div>\n ) : (\n <div key={key} data-address-field={key}>\n {node}\n </div>\n );\n\n const children: ReactNode[] = [];\n if (showFindBar) {\n children.push(\n cell(\n 'findbar',\n <FormField label={t('inputs.addressFields.find', 'Find address')}>\n <AddressAutocomplete\n apiKey={apiKey}\n getSuggestions={getSuggestions}\n regionCodes={country ? [country] : undefined}\n disabled={disabled}\n onSelect={handleFind}\n />\n </FormField>,\n ),\n );\n }\n children.push(cell('country', fieldNode('country')));\n for (const key of order) children.push(cell(key, fieldNode(key)));\n\n return (\n <div\n ref={ref}\n data-component=\"address-fields\"\n data-component-id={id}\n className={[layoutVariants({ layout }), className]\n .filter(Boolean)\n .join(' ')}\n >\n {children}\n </div>\n );\n },\n);\n\nAddressFields.displayName = 'AddressFields';\n"],"names":["ADDRESS_PROPERTIES","addressFieldsAgent","handle","args","EMPTY_ADDRESS","FIELD_ORDER","DEFAULT_ORDER","WIDE_CELLS","layoutVariants","cva","AddressFields","forwardRef","value","onChange","fields","loadCities","popularCountries","apiKey","getSuggestions","layout","required","errors","announceErrors","disabled","id","className","ref","t","useTranslation","address","country","valueRef","useRef","useEffect","update","useCallback","patch","next","handleFind","found","agentHandle","useMemo","field","fieldValue","useAgentRegistration","order","isRequired","key","showFindBar","fieldNode","jsx","FormField","CountrySelect","TextInput","event","CityInput","PostalCodeInput","ProvinceSelect","cell","node","children","AddressAutocomplete"],"mappings":";;;;;;;;;;;;AASA,MAAMA,IAAqB;AAAA,EACzB,QAAQ,EAAE,MAAM,SAAA;AAAA,EAChB,MAAM,EAAE,MAAM,SAAA;AAAA,EACd,UAAU,EAAE,MAAM,SAAA;AAAA,EAClB,UAAU,EAAE,MAAM,UAAU,aAAa,4BAAA;AAAA,EACzC,SAAS,EAAE,MAAM,UAAU,aAAa,2BAAA;AAAA,EACxC,WAAW,EAAE,MAAM,SAAA;AACrB,GAEaC,IAAwD;AAAA,EACnE,IAAI;AAAA;AAAA;AAAA,EAGJ,cAAc,CAAC,WAAW;AAAA,EAC1B,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,EACpC;AAAA,EAEF,SAAS;AAAA,IACP,WAAW;AAAA,MACT,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,OAAO,EAAE,MAAM,UAAU,YAAYF,EAAA;AAAA,QAAmB;AAAA,QAE1D,U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EAAKX,GAAKE,EAAUF,CAAG,CAAC,CAAC;AAEhE,WACE,gBAAAG;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAxB;AAAA,QACA,kBAAe;AAAA,QACf,qBAAmBF;AAAA,QACnB,WAAW,CAAChB,GAAe,EAAE,QAAAW,GAAQ,GAAGM,CAAS,EAC9C,OAAO,OAAO,EACd,KAAK,GAAG;AAAA,QAEV,UAAAmC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEAlD,GAAc,cAAc;"}
1
+ {"version":3,"file":"address-fields-qxQkGwPf.js","sources":["../../src/components/address-fields/address-fields.agent.ts","../../src/components/address-fields/address-fields.tsx"],"sourcesContent":["import type { AgentAdapter } from '../../agent/types';\nimport type { StructuredAddress } from '../address-autocomplete';\n\nexport interface AddressFieldsHandle {\n getValue: () => StructuredAddress;\n setValue: (value: StructuredAddress) => void;\n setField: (field: keyof StructuredAddress, value: string) => void;\n}\n\nconst ADDRESS_PROPERTIES = {\n street: { type: 'string' },\n city: { type: 'string' },\n postcode: { type: 'string' },\n province: { type: 'string', description: 'UPPERCASED province code.' },\n country: { type: 'string', description: 'ISO alpha-2, lowercased.' },\n formatted: { type: 'string' },\n} as const;\n\nexport const addressFieldsAgent: AgentAdapter<AddressFieldsHandle> = {\n id: 'address-fields',\n // `set_value` only — a structured address form sets discrete fields; it does\n // no granular in-place rich-text editing, so `edit_inline` does not apply.\n capabilities: ['set_value'],\n state: {\n value: {\n type: 'object',\n descriptionKey: 'ui.agent.addressFields.state.value',\n description:\n 'The current structured address: { street, city, postcode, province, country, formatted }.',\n read: (handle) => handle.getValue(),\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ value: StructuredAddress }',\n argsSchema: {\n type: 'object',\n properties: {\n value: { type: 'object', properties: ADDRESS_PROPERTIES },\n },\n required: ['value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.addressFields.actions.setValue',\n description: 'Replace the entire address.',\n invoke: (handle, args: { value: StructuredAddress }) => {\n handle.setValue(args.value);\n },\n },\n set_field: {\n // Contact-data write (street/city/postcode/etc.), not clinical PHI —\n // consistent with PhoneInput / EmailInput / FiscalCodeInput, which all\n // treat identifying contact data as `write`.\n safety: 'write',\n argsType:\n \"{ field: 'street' | 'city' | 'postcode' | 'province' | 'country'; value: string }\",\n argsSchema: {\n type: 'object',\n properties: {\n field: {\n type: 'string',\n enum: ['street', 'city', 'postcode', 'province', 'country'],\n },\n value: { type: 'string' },\n },\n required: ['field', 'value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.addressFields.actions.setField',\n description:\n 'Set a single address field. Setting `country` also clears the now-stale province.',\n examples: [\n {\n args: { field: 'country', value: 'it' },\n note: 'Set the country to Italy.',\n },\n ],\n invoke: (\n handle,\n args: { field: keyof StructuredAddress; value: string },\n ) => {\n handle.setField(args.field, args.value);\n },\n },\n },\n domHooks: {\n root: { attr: 'data-component', value: 'address-fields' },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n type ChangeEvent,\n type ReactNode,\n} from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { CountrySelect } from '../country-select/country-select';\nimport { ProvinceSelect } from '../province-select/province-select';\nimport { PostalCodeInput } from '../postal-code-input/postal-code-input';\nimport { CityInput, type CityLoaderContext } from '../city-input/city-input';\nimport { TextInput } from '../text-input';\nimport { FormField } from '../form-field/form-field';\nimport {\n AddressAutocomplete,\n type GetSuggestions,\n type StructuredAddress,\n} from '../address-autocomplete';\nimport type { OptionShape } from '../_shared/option';\nimport { useAgentRegistration } from '../../agent';\nimport {\n addressFieldsAgent,\n type AddressFieldsHandle,\n} from './address-fields.agent';\n\n/* ------------------------------------------------------------------ */\n/* Public API */\n/* */\n/* A shippable composite that wires the address fields together and */\n/* emits a single StructuredAddress. Country drives the rest: it re-keys */\n/* the province dataset, swaps the postcode rule, and re-orders the */\n/* fields. An optional \"find address\" bar fans an AddressAutocomplete */\n/* selection out into the individual fields. */\n/* ------------------------------------------------------------------ */\n\nexport type AddressFieldKey = 'street' | 'city' | 'postcode' | 'province';\n\nconst EMPTY_ADDRESS: StructuredAddress = {\n street: '',\n city: '',\n postcode: '',\n province: '',\n country: '',\n formatted: '',\n};\n\n// Minimal country-keyed field-order map — NOT a libaddressinput port.\n// Extend with another entry when a country needs a different order.\nconst FIELD_ORDER: Record<string, AddressFieldKey[]> = {\n it: ['street', 'postcode', 'city', 'province'],\n};\nconst DEFAULT_ORDER: AddressFieldKey[] = [\n 'street',\n 'city',\n 'postcode',\n 'province',\n];\n\n// Fields that span the full width in the grid layout.\nconst WIDE_CELLS = new Set<string>(['findbar', 'country', 'street']);\n\nconst layoutVariants = cva('', {\n variants: {\n layout: {\n stacked: 'ds:flex ds:flex-col ds:gap-[var(--spacing-md)]',\n grid: 'ds:grid ds:grid-cols-2 ds:gap-[var(--spacing-md)]',\n },\n },\n defaultVariants: { layout: 'stacked' },\n});\n\nexport interface AddressFieldsProps {\n /** The controlled address value. */\n value?: StructuredAddress;\n /** Fires with the next full address on any field change. */\n onChange?: (next: StructuredAddress) => void;\n /**\n * Which address-line fields to render, in order. The country picker\n * always renders first. Default resolves from the selected country.\n */\n fields?: AddressFieldKey[];\n /** Async city suggestion loader, forwarded to CityInput. */\n loadCities?: (\n query: string,\n ctx: CityLoaderContext,\n ) => Promise<OptionShape[]>;\n /** Float these countries to the top of the country picker. */\n popularCountries?: string[];\n /** Enable the \"find address\" bar — provide a Places API key… */\n apiKey?: string;\n /** …or a mock/real suggestion injector (wins over apiKey, like AddressAutocomplete). */\n getSuggestions?: GetSuggestions;\n layout?: 'stacked' | 'grid';\n /** Marks fields as required: `true` for every field shown, or a list\n * of the ones that are (a province is mandatory in some countries\n * only). The host still validates. */\n required?: boolean | readonly (AddressFieldKey | 'country')[];\n /** An error message per field, shown under it. The host validates and\n * decides when to show each one. */\n errors?: Partial<Record<AddressFieldKey | 'country', string>>;\n /** Whether a field's message raises `role=\"alert\"`, per field; each\n * does unless set to `false`. Turn it off for messages shown together,\n * such as by a refused submit, so they are not all announced at once. */\n announceErrors?: Partial<Record<AddressFieldKey | 'country', boolean>>;\n disabled?: boolean;\n id?: string;\n className?: string;\n}\n\nexport const AddressFields = forwardRef<HTMLDivElement, AddressFieldsProps>(\n function AddressFields(\n {\n value,\n onChange,\n fields,\n loadCities,\n popularCountries,\n apiKey,\n getSuggestions,\n layout = 'stacked',\n required,\n errors,\n announceErrors,\n disabled,\n id,\n className,\n },\n ref,\n ) {\n const { t } = useTranslation('ui');\n const address = value ?? EMPTY_ADDRESS;\n const country = address.country;\n\n const valueRef = useRef(address);\n useEffect(() => {\n valueRef.current = address;\n }, [address]);\n\n const update = useCallback(\n (patch: Partial<StructuredAddress>) => {\n /* A browser fills every field in one go, faster than the host\n re-renders: each change must build on the one before it. */\n const next = { ...valueRef.current, ...patch };\n valueRef.current = next;\n onChange?.(next);\n },\n [onChange],\n );\n\n // Find-bar selection fans the looked-up address out into every field.\n const handleFind = useCallback(\n (found: StructuredAddress) =>\n onChange?.({ ...valueRef.current, ...found }),\n [onChange],\n );\n\n const agentHandle = useMemo<AddressFieldsHandle>(\n () => ({\n getValue: () => valueRef.current,\n setValue: (next) => onChange?.(next),\n setField: (field, fieldValue) => {\n const patch: Partial<StructuredAddress> = { [field]: fieldValue };\n // Mirror the UI path: changing country re-keys the stale province.\n if (field === 'country') patch.province = '';\n onChange?.({ ...valueRef.current, ...patch });\n },\n }),\n [onChange],\n );\n useAgentRegistration(addressFieldsAgent, agentHandle, id);\n\n const order =\n fields ?? FIELD_ORDER[country?.toLowerCase() ?? ''] ?? DEFAULT_ORDER;\n\n const isRequired = (key: AddressFieldKey | 'country'): boolean =>\n required === true || (Array.isArray(required) && required.includes(key));\n\n const showFindBar = Boolean(apiKey || getSuggestions);\n\n // The composite's own adapter (`address-fields`) is the agent-addressable\n // surface; the child inputs below are deliberately rendered without an\n // `id`, so they register un-scoped rather than competing for handles.\n const fieldNode = (key: AddressFieldKey | 'country'): ReactNode => {\n switch (key) {\n case 'country':\n return (\n <FormField\n label={t('inputs.addressFields.country', 'Country')}\n required={isRequired('country')}\n error={errors?.country}\n announceError={announceErrors?.country ?? true}\n >\n <CountrySelect\n // cmdk names its input itself, so the label is passed too.\n aria-label={t('inputs.addressFields.country', 'Country')}\n value={country}\n // Country drives the rest — re-key province on change.\n onValueChange={(next) =>\n update({ country: next, province: '' })\n }\n popularCountries={popularCountries}\n disabled={disabled}\n />\n </FormField>\n );\n case 'street':\n return (\n <FormField\n label={t('inputs.addressFields.street', 'Street')}\n required={isRequired('street')}\n error={errors?.street}\n announceError={announceErrors?.street ?? true}\n >\n <TextInput\n value={address.street}\n onChange={(event: ChangeEvent<HTMLInputElement>) =>\n update({ street: event.target.value })\n }\n autoComplete=\"address-line1\"\n disabled={disabled}\n />\n </FormField>\n );\n case 'city':\n return (\n <FormField\n label={t('inputs.addressFields.city', 'City')}\n required={isRequired('city')}\n error={errors?.city}\n announceError={announceErrors?.city ?? true}\n >\n <CityInput\n value={address.city}\n onValueChange={(next) => update({ city: next })}\n loadCities={loadCities}\n country={country}\n province={address.province}\n disabled={disabled}\n />\n </FormField>\n );\n case 'postcode':\n return (\n <FormField\n label={t('inputs.addressFields.postcode', 'Postcode')}\n required={isRequired('postcode')}\n error={errors?.postcode}\n announceError={announceErrors?.postcode ?? true}\n >\n <PostalCodeInput\n value={address.postcode}\n onValueChange={(next) => update({ postcode: next })}\n country={country}\n disabled={disabled}\n />\n </FormField>\n );\n case 'province':\n return (\n <FormField\n label={t('inputs.addressFields.province', 'Province')}\n required={isRequired('province')}\n error={errors?.province}\n announceError={announceErrors?.province ?? true}\n >\n <ProvinceSelect\n aria-label={t('inputs.addressFields.province', 'Province')}\n value={address.province}\n onValueChange={(next) => update({ province: next })}\n country={country}\n disabled={disabled}\n />\n </FormField>\n );\n }\n };\n\n const cell = (key: string, node: ReactNode): ReactNode =>\n layout === 'grid' ? (\n <div\n key={key}\n data-address-field={key}\n className={WIDE_CELLS.has(key) ? 'ds:col-span-2' : undefined}\n >\n {node}\n </div>\n ) : (\n <div key={key} data-address-field={key}>\n {node}\n </div>\n );\n\n const children: ReactNode[] = [];\n if (showFindBar) {\n children.push(\n cell(\n 'findbar',\n <FormField label={t('inputs.addressFields.find', 'Find address')}>\n <AddressAutocomplete\n apiKey={apiKey}\n getSuggestions={getSuggestions}\n regionCodes={country ? [country] : undefined}\n disabled={disabled}\n onSelect={handleFind}\n />\n </FormField>,\n ),\n );\n }\n children.push(cell('country', fieldNode('country')));\n for (const key of order) children.push(cell(key, fieldNode(key)));\n\n return (\n <div\n ref={ref}\n data-component=\"address-fields\"\n data-component-id={id}\n className={[layoutVariants({ layout }), className]\n .filter(Boolean)\n .join(' ')}\n >\n {children}\n </div>\n );\n },\n);\n\nAddressFields.displayName = 'AddressFields';\n"],"names":["ADDRESS_PROPERTIES","addressFieldsAgent","handle","args","EMPTY_ADDRESS","FIELD_ORDER","DEFAULT_ORDER","WIDE_CELLS","layoutVariants","cva","AddressFields","forwardRef","value","onChange","fields","loadCities","popularCountries","apiKey","getSuggestions","layout","required","errors","announceErrors","disabled","id","className","ref","t","useTranslation","address","country","valueRef","useRef","useEffect","update","useCallback","patch","next","handleFind","found","agentHandle","useMemo","field","fieldValue","useAgentRegistration","order","isRequired","key","showFindBar","fieldNode","jsx","FormField","CountrySelect","TextInput","event","CityInput","PostalCodeInput","ProvinceSelect","cell","node","children","AddressAutocomplete"],"mappings":";;;;;;;;;;;;AASA,MAAMA,IAAqB;AAAA,EACzB,QAAQ,EAAE,MAAM,SAAA;AAAA,EAChB,MAAM,EAAE,MAAM,SAAA;AAAA,EACd,UAAU,EAAE,MAAM,SAAA;AAAA,EAClB,UAAU,EAAE,MAAM,UAAU,aAAa,4BAAA;AAAA,EACzC,SAAS,EAAE,MAAM,UAAU,aAAa,2BAAA;AAAA,EACxC,WAAW,EAA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,IAAwB,CAAA;AAC9B,IAAIZ,KACFY,EAAS;AAAA,MACPF;AAAA,QACE;AAAA,0BACCP,GAAA,EAAU,OAAOxB,EAAE,6BAA6B,cAAc,GAC7D,UAAA,gBAAAuB;AAAA,UAACW;AAAA,UAAA;AAAA,YACC,QAAA5C;AAAA,YACA,gBAAAC;AAAA,YACA,aAAaY,IAAU,CAACA,CAAO,IAAI;AAAA,YACnC,UAAAP;AAAA,YACA,UAAUe;AAAA,UAAA;AAAA,QAAA,EACZ,CACF;AAAA,MAAA;AAAA,IACF,GAGJsB,EAAS,KAAKF,EAAK,WAAWT,EAAU,SAAS,CAAC,CAAC;AACnD,eAAWF,KAAOF,EAAO,CAAAe,EAAS,KAAKF,EAAKX,GAAKE,EAAUF,CAAG,CAAC,CAAC;AAEhE,WACE,gBAAAG;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAxB;AAAA,QACA,kBAAe;AAAA,QACf,qBAAmBF;AAAA,QACnB,WAAW,CAAChB,GAAe,EAAE,QAAAW,GAAQ,GAAGM,CAAS,EAC9C,OAAO,OAAO,EACd,KAAK,GAAG;AAAA,QAEV,UAAAmC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEAlD,GAAc,cAAc;"}
@@ -5,7 +5,7 @@ import { useTranslation as P } from "react-i18next";
5
5
  import { A as g } from "./alert-9kEwDza3.js";
6
6
  import { B as D } from "./badge-BUk4RjTS.js";
7
7
  import { B as H } from "./button-DohK_Ak_.js";
8
- import { C as J } from "./checkbox-BjDv-r3o.js";
8
+ import { C as J } from "./checkbox-a7Sh-dXb.js";
9
9
  import { S as U } from "./spinner-CoflYlEx.js";
10
10
  import { T as W } from "./timestamp-DPLDWdxA.js";
11
11
  import { u as _ } from "./registry-DvAUVLHh.js";
@@ -203,4 +203,4 @@ export {
203
203
  Q as A,
204
204
  $ as a
205
205
  };
206
- //# sourceMappingURL=ai-permission-notice-CoW22jx1.js.map
206
+ //# sourceMappingURL=ai-permission-notice-VNh3W57L.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ai-permission-notice-CoW22jx1.js","sources":["../../src/components/ai-permission-notice/ai-permission-notice.agent.ts","../../src/components/ai-permission-notice/ai-permission-notice.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — AiConsentBanner. */\n/* */\n/* Read-only structural surface: the current consent state and whether */\n/* the grant affordance is armed. Identifiers / structural state ONLY — */\n/* never the grantee's name or any PHI. The real consent gate lives */\n/* server-side; this adapter does not expose a grant action so an agent */\n/* cannot consent on a user's behalf. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { AiConsentBannerHandle } from './ai-permission-notice';\n\nexport const aiConsentBannerAgent: AgentAdapter<AiConsentBannerHandle> = {\n id: 'ai-consent-banner',\n capabilities: [],\n state: {\n consentState: {\n type: \"'granted' | 'required' | 'pending'\",\n descriptionKey: 'ui.agent.aiConsentBanner.state.consentState',\n description:\n 'Current consent state. Structural only — never the grantee identity.',\n read: (handle) => handle.getState(),\n },\n armed: {\n type: 'boolean',\n descriptionKey: 'ui.agent.aiConsentBanner.state.armed',\n description:\n 'Whether the consent confirmation checkbox is ticked (required state only).',\n read: (handle) => handle.isArmed(),\n },\n },\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'ai-consent-banner',\n description: 'Marks the AiConsentBanner root region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific banner from the agent.',\n },\n },\n};\n","import {\n forwardRef,\n useMemo,\n useRef,\n useState,\n type ComponentPropsWithoutRef,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Alert } from '../alert/alert';\nimport { Badge } from '../badge/badge';\nimport { Button } from '../button/button';\nimport { Checkbox } from '../checkbox/checkbox';\nimport { Spinner } from '../spinner/spinner';\nimport { Timestamp } from '../timestamp/timestamp';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { aiConsentBannerAgent } from './ai-permission-notice.agent';\n\n/* -------------------------------------------------------------------- */\n/* AiConsentBanner */\n/* */\n/* Presentational AI-consent gate surfaced above an AI-assisted surface */\n/* (e.g. Alfascribe consultation transcription). The SERVER owns the */\n/* real gate — this component only reflects the consent record and lets */\n/* the operator initiate a grant; it never enforces access itself. */\n/* */\n/* Three states drive the Alert variant + body: */\n/* - granted → success Alert with a Badge + when/who it was granted. */\n/* - required → info Alert with a Checkbox-gated Grant Button. */\n/* - pending → info Alert in a disabled, Spinner-busy state while the */\n/* server persists the grant. */\n/* */\n/* All kit text flows through useTranslation('ui') against the */\n/* `aiConsentBanner.*` namespace. `subject` picks the kit-owned wording */\n/* preset; `copy` lets a host replace single strings with its own text. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* CVA — root */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva('ds:w-full ds:text-[color:var(--foreground)]', {\n variants: {\n state: {\n granted: '',\n required: '',\n pending: '',\n },\n },\n defaultVariants: {\n state: 'required',\n },\n});\n\n/* -------------------------------------------------------------------- */\n/* State derivation */\n/* -------------------------------------------------------------------- */\n\nexport type AiConsentState = NonNullable<\n VariantProps<typeof rootVariants>['state']\n>;\n\n/** Heading levels `AiConsentBanner.headingLevel` accepts. */\nexport type AiConsentBannerHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/** Pending wins over granted/required so the busy state is never masked. */\nfunction deriveState(granted: boolean, pending: boolean): AiConsentState {\n if (pending) return 'pending';\n return granted ? 'granted' : 'required';\n}\n\n/* -------------------------------------------------------------------- */\n/* Subject presets */\n/* -------------------------------------------------------------------- */\n\n/** What the consent covers; each subject has kit-owned, translated wording.\n * `'patient-record'` (default) is one patient's record. `'practice-statistics'`\n * is the practice's aggregate figures (totals, rates), never patient data. */\nexport type AiConsentSubject = 'patient-record' | 'practice-statistics';\n\ntype AiConsentSubjectField =\n | 'descriptionRequired'\n | 'descriptionGranted'\n | 'confirmLabel'\n | 'notAllowed';\n\n/* Only these four strings differ by subject; the rest share one key each. */\nconst SUBJECT_KEYS = {\n 'patient-record': {\n descriptionRequired: {\n key: 'aiConsentBanner.description.required',\n fallback: 'AI assistance requires recorded consent before it can run.',\n },\n descriptionGranted: {\n key: 'aiConsentBanner.description.granted',\n fallback: 'AI assistance is enabled for this record.',\n },\n confirmLabel: {\n key: 'aiConsentBanner.confirmLabel',\n fallback: 'I confirm consent has been obtained for AI assistance.',\n },\n notAllowed: {\n key: 'aiConsentBanner.notAllowed',\n fallback: 'You do not have permission to grant AI assistance consent.',\n },\n },\n 'practice-statistics': {\n descriptionRequired: {\n key: 'aiConsentBanner.practiceStatistics.description.required',\n fallback:\n \"AI assistance needs consent before it can read this practice's statistics. It uses aggregate figures only, never patient data.\",\n },\n descriptionGranted: {\n key: 'aiConsentBanner.practiceStatistics.description.granted',\n fallback:\n \"AI assistance can read this practice's statistics. It uses aggregate figures only, never patient data.\",\n },\n confirmLabel: {\n key: 'aiConsentBanner.practiceStatistics.confirmLabel',\n fallback:\n 'I may decide for this practice, and I agree to AI assistance reading its statistics.',\n },\n notAllowed: {\n key: 'aiConsentBanner.practiceStatistics.notAllowed',\n fallback:\n 'You do not have permission to grant AI assistance consent for this practice.',\n },\n },\n} as const satisfies Record<\n AiConsentSubject,\n Record<AiConsentSubjectField, { key: string; fallback: string }>\n>;\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* -------------------------------------------------------------------- */\n\n/**\n * Patient AI-consent gate for an AI surface that sends patient data to a\n * service: the RichTextEditor's Help-me-write action and dictation mics, and\n * the VoiceControlPanel's microphone. Omit entirely for today's ungated\n * behaviour — no existing host breaks.\n *\n * Present and `granted: false`: the affordances stay visible (this never\n * hides a control), but using one shows the kit's `AiConsentBanner` instead\n * of starting the AI action. When `granted` flips `true` after a Grant click\n * in that banner, the surface resumes exactly the action it gated; when it\n * flips for any other reason (another patient, another tab) it only closes\n * the banner.\n *\n * Present and `granted: true`: normal behaviour.\n */\nexport interface AiConsentGate {\n /** Whether AI consent has already been recorded for the current patient. */\n granted: boolean;\n /** When consent was granted — passed straight to `AiConsentBanner`. */\n grantedAt?: string | number | Date;\n /** Who granted consent — passed straight to `AiConsentBanner`. */\n grantedBy?: string;\n /** Whether the signed-in reader may grant consent. Default `true`; treated\n * as `false` when `onGrant` is absent, so no dead Grant control shows. */\n canGrant?: boolean;\n /** The grant is being persisted server-side (host-driven busy state). */\n pending?: boolean;\n /**\n * Fired when the reader confirms the grant in the banner. A returned\n * promise drives the banner's own pending/Spinner state until it settles,\n * in addition to (or absent) a host-supplied `pending`.\n */\n onGrant?: () => void | Promise<void>;\n}\n\n/** Host-translated strings; the host owns their wording and translation.\n * Each one replaces the `subject` preset for that string only. Plain text,\n * not i18n keys: interpolate any values (a practice name) before passing. */\nexport interface AiConsentBannerCopy {\n /** Banner heading. */\n title?: string;\n /** Description in the required and pending states. */\n descriptionRequired?: string;\n /** Description in the granted state. */\n descriptionGranted?: string;\n /** Label of the confirmation checkbox. */\n confirmLabel?: string;\n /** Label of the Grant button. */\n grantButton?: string;\n /** Note shown instead of the grant controls when `canGrant` is false. */\n notAllowed?: string;\n /** Badge text in the granted state. */\n badgeGranted?: string;\n /** Busy text (and Spinner label) in the pending state. */\n pendingLabel?: string;\n}\n\n/** Agent-readiness curated handle. Exposes the structural consent state only. */\nexport interface AiConsentBannerHandle {\n /** Current derived state: 'granted' | 'required' | 'pending'. */\n getState: () => AiConsentState;\n /** Whether the Grant affordance is currently armed (checkbox ticked). */\n isArmed: () => boolean;\n}\n\nexport interface AiConsentBannerProps extends Omit<\n ComponentPropsWithoutRef<'div'>,\n 'aria-label' | 'children' | 'role'\n> {\n /**\n * Stable instance id. Surfaced on the root as `data-component-id` so an\n * agent / MCP UI bridge can address this specific banner. Mirrored to the\n * real DOM `id`.\n */\n id?: string;\n /** Whether consent has already been granted. Server-sourced. */\n granted: boolean;\n /**\n * When consent was granted — ISO-8601 string, ms-epoch, or Date. Rendered\n * via `Timestamp` in the granted state.\n */\n grantedAt?: string | number | Date;\n /** Who granted consent (operator display name / role). Granted state only. */\n grantedBy?: string;\n /**\n * Whether the current user is allowed to grant consent. When `false`, the\n * required-state Grant affordance is hidden and a not-allowed note shows.\n * Default `true`.\n */\n canGrant?: boolean;\n /** The grant is being persisted server-side — shows the busy Spinner state. */\n pending?: boolean;\n /** Fired when the operator confirms the consent grant. */\n onGrantConsent?: () => void;\n /**\n * Heading level for the banner's own title, so it can be nested under a\n * host section's heading without skipping levels (axe `heading-order`).\n * Additive: default `5` matches the banner's original, unconditional\n * `<h5>` — every existing consumer is unaffected.\n */\n headingLevel?: AiConsentBannerHeadingLevel;\n /** What the consent covers; picks the kit's translated wording. Default\n * `'patient-record'`, which renders exactly as before this prop existed. */\n subject?: AiConsentSubject;\n /** Host-translated strings; the host owns their wording and translation.\n * Each key overrides only its own string. `title` also names the region,\n * unless `aria-label` is passed. */\n copy?: Partial<AiConsentBannerCopy>;\n /** Override the region's accessible name. */\n 'aria-label'?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const AiConsentBanner = forwardRef<HTMLDivElement, AiConsentBannerProps>(\n (\n {\n id,\n granted,\n grantedAt,\n grantedBy,\n canGrant = true,\n pending = false,\n onGrantConsent,\n headingLevel = 5,\n subject = 'patient-record',\n copy,\n 'aria-label': ariaLabel,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation('ui');\n const state = deriveState(granted, pending);\n\n // A host string wins over the preset for that string only. A blank or\n // whitespace-only one counts as missing, so no control loses its name.\n const own = (value?: string) => value?.trim() || undefined;\n // An unknown subject from an untyped host falls back to the default.\n const keys = SUBJECT_KEYS[subject] ?? SUBJECT_KEYS['patient-record'];\n const text = {\n title:\n own(copy?.title) || t('aiConsentBanner.title', 'AI assistance consent'),\n descriptionRequired:\n own(copy?.descriptionRequired) ||\n t(keys.descriptionRequired.key, keys.descriptionRequired.fallback),\n descriptionGranted:\n own(copy?.descriptionGranted) ||\n t(keys.descriptionGranted.key, keys.descriptionGranted.fallback),\n confirmLabel:\n own(copy?.confirmLabel) ||\n t(keys.confirmLabel.key, keys.confirmLabel.fallback),\n grantButton:\n own(copy?.grantButton) ||\n t('aiConsentBanner.grantButton', 'Grant consent'),\n notAllowed:\n own(copy?.notAllowed) ||\n t(keys.notAllowed.key, keys.notAllowed.fallback),\n badgeGranted:\n own(copy?.badgeGranted) ||\n t('aiConsentBanner.badge.granted', 'Consent granted'),\n pendingLabel:\n own(copy?.pendingLabel) ||\n t('aiConsentBanner.pendingLabel', 'Saving consent…'),\n };\n\n // Grant stays disabled until the checkbox is ticked. Any change of subject\n // or statement unticks it, even back to an earlier one, so a tick only\n // confirms what was on screen when it was given.\n const statement = [\n subject,\n text.confirmLabel,\n text.descriptionRequired,\n ].join('\\u0000');\n const [ticked, setTicked] = useState(false);\n const [tickedFor, setTickedFor] = useState(statement);\n if (tickedFor !== statement) {\n setTickedFor(statement);\n setTicked(false);\n }\n const armed = ticked && tickedFor === statement;\n\n const armedRef = useRef(armed);\n armedRef.current = armed;\n\n const handle = useMemo<AiConsentBannerHandle>(\n () => ({\n getState: () => deriveState(granted, pending),\n isArmed: () => armedRef.current,\n }),\n [granted, pending],\n );\n useAgentRegistration(aiConsentBannerAgent, handle, id);\n\n // A host title also names the region, so the name matches the heading.\n const resolvedAriaLabel =\n own(ariaLabel) ||\n own(copy?.title) ||\n t('aiConsentBanner.regionLabel', 'AI assistance consent');\n\n // Alert variant per state: granted → success, required/pending → info.\n const alertVariant = state === 'granted' ? 'success' : 'info';\n\n let body: React.ReactNode;\n if (state === 'granted') {\n body = (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Badge variant=\"success\">{text.badgeGranted}</Badge>\n {grantedAt !== undefined ? (\n <span className=\"type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {t('aiConsentBanner.grantedAtPrefix', 'Granted')}{' '}\n <Timestamp value={grantedAt} format=\"relative\" shape=\"inline\" />\n </span>\n ) : null}\n </div>\n {grantedBy ? (\n <p className=\"type-body-sm ds:m-0 ds:text-[color:var(--muted-foreground)]\">\n {t('aiConsentBanner.grantedBy', {\n name: grantedBy,\n defaultValue: 'By {{name}}',\n })}\n </p>\n ) : null}\n </div>\n );\n } else if (state === 'pending') {\n body = (\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Spinner variant=\"pulse\" size=\"sm\" label={text.pendingLabel} />\n <span className=\"type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {text.pendingLabel}\n </span>\n </div>\n );\n } else {\n // required\n body = canGrant ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <Checkbox\n checked={armed}\n onCheckedChange={(next) => setTicked(next === true)}\n label={text.confirmLabel}\n />\n <Alert.Action>\n <Button\n intent=\"primary\"\n size=\"sm\"\n disabled={!armed}\n onClick={onGrantConsent}\n >\n {text.grantButton}\n </Button>\n </Alert.Action>\n </div>\n ) : (\n <p className=\"type-body-sm ds:m-0 ds:text-[color:var(--muted-foreground)]\">\n {text.notAllowed}\n </p>\n );\n }\n\n return (\n <div\n ref={ref}\n role=\"region\"\n aria-label={resolvedAriaLabel}\n aria-busy={state === 'pending' ? true : undefined}\n data-component=\"ai-consent-banner\"\n data-component-id={id}\n data-state={state}\n id={id}\n className={rootVariants({ state, className })}\n {...rest}\n >\n <Alert\n variant={alertVariant}\n icon={state === 'pending' ? null : undefined}\n >\n <Alert.Title as={`h${headingLevel}` as const}>\n {text.title}\n </Alert.Title>\n <Alert.Description>\n {state === 'granted'\n ? text.descriptionGranted\n : text.descriptionRequired}\n </Alert.Description>\n {body}\n </Alert>\n </div>\n );\n },\n);\n\nAiConsentBanner.displayName = 'AiConsentBanner';\n"],"names":["aiConsentBannerAgent","handle","rootVariants","cva","deriveState","granted","pending","SUBJECT_KEYS","AiConsentBanner","forwardRef","id","grantedAt","grantedBy","canGrant","onGrantConsent","headingLevel","subject","copy","ariaLabel","className","rest","ref","useTranslation","state","own","value","keys","text","statement","ticked","setTicked","useState","tickedFor","setTickedFor","armed","armedRef","useRef","useMemo","useAgentRegistration","resolvedAriaLabel","alertVariant","body","jsxs","jsx","Badge","Timestamp","Spinner","Checkbox","next","Alert","Button"],"mappings":";;;;;;;;;;;AAaO,MAAMA,IAA4D;AAAA,EACvE,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO;AAAA,IACL,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,QAAA;AAAA,IAAQ;AAAA,EACnC;AAAA,EAEF,SAAS,CAAA;AAAA,EACT,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IAAA;AAAA,IAEf,YAAY;AAAA,MACV,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,aACE;AAAA,IAAA;AAAA,EACJ;AAEJ,GCLMC,IAAeC,EAAI,+CAA+C;AAAA,EACtE,UAAU;AAAA,IACR,OAAO;AAAA,MACL,SAAS;AAAA,MACT,UAAU;AAAA,MACV,SAAS;AAAA,IAAA;AAAA,EACX;AAAA,EAEF,iBAAiB;AAAA,IACf,OAAO;AAAA,EAAA;AAEX,CAAC;AAcD,SAASC,EAAYC,GAAkBC,GAAkC;AACvE,SAAIA,IAAgB,YACbD,IAAU,YAAY;AAC/B;AAkBA,MAAME,IAAe;AAAA,EACnB,kBAAkB;AAAA,IAChB,qBAAqB;AAAA,MACnB,KAAK;AAAA,MACL,UAAU;AAAA,IAAA;AAAA,IAEZ,oB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A,UACX,SAASpB;AAAA,UAER,UAAAa,EAAK;AAAA,QAAA;AAAA,MAAA,EACR,CACF;AAAA,IAAA,GACF,IAEA,gBAAAgB,EAAC,KAAA,EAAE,WAAU,+DACV,YAAK,YACR,GAKF,gBAAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAtB;AAAA,QACA,MAAK;AAAA,QACL,cAAYkB;AAAA,QACZ,aAAWhB,MAAU,YAAY,KAAO;AAAA,QACxC,kBAAe;AAAA,QACf,qBAAmBb;AAAA,QACnB,cAAYa;AAAA,QACZ,IAAAb;AAAA,QACA,WAAWR,EAAa,EAAE,OAAAqB,GAAO,WAAAJ,GAAW;AAAA,QAC3C,GAAGC;AAAA,QAEJ,UAAA,gBAAAsB;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,SAAST;AAAA,YACT,MAAMjB,MAAU,YAAY,OAAO;AAAA,YAEnC,UAAA;AAAA,cAAA,gBAAAoB,EAACM,EAAM,OAAN,EAAY,IAAI,IAAIlC,CAAY,IAC9B,YAAK,MAAA,CACR;AAAA,cACA,gBAAA4B,EAACM,EAAM,aAAN,EACE,gBAAU,YACPtB,EAAK,qBACLA,EAAK,oBAAA,CACX;AAAA,cACCc;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAGN;AACF;AAEAjC,EAAgB,cAAc;"}
1
+ {"version":3,"file":"ai-permission-notice-VNh3W57L.js","sources":["../../src/components/ai-permission-notice/ai-permission-notice.agent.ts","../../src/components/ai-permission-notice/ai-permission-notice.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — AiConsentBanner. */\n/* */\n/* Read-only structural surface: the current consent state and whether */\n/* the grant affordance is armed. Identifiers / structural state ONLY — */\n/* never the grantee's name or any PHI. The real consent gate lives */\n/* server-side; this adapter does not expose a grant action so an agent */\n/* cannot consent on a user's behalf. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { AiConsentBannerHandle } from './ai-permission-notice';\n\nexport const aiConsentBannerAgent: AgentAdapter<AiConsentBannerHandle> = {\n id: 'ai-consent-banner',\n capabilities: [],\n state: {\n consentState: {\n type: \"'granted' | 'required' | 'pending'\",\n descriptionKey: 'ui.agent.aiConsentBanner.state.consentState',\n description:\n 'Current consent state. Structural only — never the grantee identity.',\n read: (handle) => handle.getState(),\n },\n armed: {\n type: 'boolean',\n descriptionKey: 'ui.agent.aiConsentBanner.state.armed',\n description:\n 'Whether the consent confirmation checkbox is ticked (required state only).',\n read: (handle) => handle.isArmed(),\n },\n },\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'ai-consent-banner',\n description: 'Marks the AiConsentBanner root region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific banner from the agent.',\n },\n },\n};\n","import {\n forwardRef,\n useMemo,\n useRef,\n useState,\n type ComponentPropsWithoutRef,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Alert } from '../alert/alert';\nimport { Badge } from '../badge/badge';\nimport { Button } from '../button/button';\nimport { Checkbox } from '../checkbox/checkbox';\nimport { Spinner } from '../spinner/spinner';\nimport { Timestamp } from '../timestamp/timestamp';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { aiConsentBannerAgent } from './ai-permission-notice.agent';\n\n/* -------------------------------------------------------------------- */\n/* AiConsentBanner */\n/* */\n/* Presentational AI-consent gate surfaced above an AI-assisted surface */\n/* (e.g. Alfascribe consultation transcription). The SERVER owns the */\n/* real gate — this component only reflects the consent record and lets */\n/* the operator initiate a grant; it never enforces access itself. */\n/* */\n/* Three states drive the Alert variant + body: */\n/* - granted → success Alert with a Badge + when/who it was granted. */\n/* - required → info Alert with a Checkbox-gated Grant Button. */\n/* - pending → info Alert in a disabled, Spinner-busy state while the */\n/* server persists the grant. */\n/* */\n/* All kit text flows through useTranslation('ui') against the */\n/* `aiConsentBanner.*` namespace. `subject` picks the kit-owned wording */\n/* preset; `copy` lets a host replace single strings with its own text. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* CVA — root */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva('ds:w-full ds:text-[color:var(--foreground)]', {\n variants: {\n state: {\n granted: '',\n required: '',\n pending: '',\n },\n },\n defaultVariants: {\n state: 'required',\n },\n});\n\n/* -------------------------------------------------------------------- */\n/* State derivation */\n/* -------------------------------------------------------------------- */\n\nexport type AiConsentState = NonNullable<\n VariantProps<typeof rootVariants>['state']\n>;\n\n/** Heading levels `AiConsentBanner.headingLevel` accepts. */\nexport type AiConsentBannerHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/** Pending wins over granted/required so the busy state is never masked. */\nfunction deriveState(granted: boolean, pending: boolean): AiConsentState {\n if (pending) return 'pending';\n return granted ? 'granted' : 'required';\n}\n\n/* -------------------------------------------------------------------- */\n/* Subject presets */\n/* -------------------------------------------------------------------- */\n\n/** What the consent covers; each subject has kit-owned, translated wording.\n * `'patient-record'` (default) is one patient's record. `'practice-statistics'`\n * is the practice's aggregate figures (totals, rates), never patient data. */\nexport type AiConsentSubject = 'patient-record' | 'practice-statistics';\n\ntype AiConsentSubjectField =\n | 'descriptionRequired'\n | 'descriptionGranted'\n | 'confirmLabel'\n | 'notAllowed';\n\n/* Only these four strings differ by subject; the rest share one key each. */\nconst SUBJECT_KEYS = {\n 'patient-record': {\n descriptionRequired: {\n key: 'aiConsentBanner.description.required',\n fallback: 'AI assistance requires recorded consent before it can run.',\n },\n descriptionGranted: {\n key: 'aiConsentBanner.description.granted',\n fallback: 'AI assistance is enabled for this record.',\n },\n confirmLabel: {\n key: 'aiConsentBanner.confirmLabel',\n fallback: 'I confirm consent has been obtained for AI assistance.',\n },\n notAllowed: {\n key: 'aiConsentBanner.notAllowed',\n fallback: 'You do not have permission to grant AI assistance consent.',\n },\n },\n 'practice-statistics': {\n descriptionRequired: {\n key: 'aiConsentBanner.practiceStatistics.description.required',\n fallback:\n \"AI assistance needs consent before it can read this practice's statistics. It uses aggregate figures only, never patient data.\",\n },\n descriptionGranted: {\n key: 'aiConsentBanner.practiceStatistics.description.granted',\n fallback:\n \"AI assistance can read this practice's statistics. It uses aggregate figures only, never patient data.\",\n },\n confirmLabel: {\n key: 'aiConsentBanner.practiceStatistics.confirmLabel',\n fallback:\n 'I may decide for this practice, and I agree to AI assistance reading its statistics.',\n },\n notAllowed: {\n key: 'aiConsentBanner.practiceStatistics.notAllowed',\n fallback:\n 'You do not have permission to grant AI assistance consent for this practice.',\n },\n },\n} as const satisfies Record<\n AiConsentSubject,\n Record<AiConsentSubjectField, { key: string; fallback: string }>\n>;\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* -------------------------------------------------------------------- */\n\n/**\n * Patient AI-consent gate for an AI surface that sends patient data to a\n * service: the RichTextEditor's Help-me-write action and dictation mics, and\n * the VoiceControlPanel's microphone. Omit entirely for today's ungated\n * behaviour — no existing host breaks.\n *\n * Present and `granted: false`: the affordances stay visible (this never\n * hides a control), but using one shows the kit's `AiConsentBanner` instead\n * of starting the AI action. When `granted` flips `true` after a Grant click\n * in that banner, the surface resumes exactly the action it gated; when it\n * flips for any other reason (another patient, another tab) it only closes\n * the banner.\n *\n * Present and `granted: true`: normal behaviour.\n */\nexport interface AiConsentGate {\n /** Whether AI consent has already been recorded for the current patient. */\n granted: boolean;\n /** When consent was granted — passed straight to `AiConsentBanner`. */\n grantedAt?: string | number | Date;\n /** Who granted consent — passed straight to `AiConsentBanner`. */\n grantedBy?: string;\n /** Whether the signed-in reader may grant consent. Default `true`; treated\n * as `false` when `onGrant` is absent, so no dead Grant control shows. */\n canGrant?: boolean;\n /** The grant is being persisted server-side (host-driven busy state). */\n pending?: boolean;\n /**\n * Fired when the reader confirms the grant in the banner. A returned\n * promise drives the banner's own pending/Spinner state until it settles,\n * in addition to (or absent) a host-supplied `pending`.\n */\n onGrant?: () => void | Promise<void>;\n}\n\n/** Host-translated strings; the host owns their wording and translation.\n * Each one replaces the `subject` preset for that string only. Plain text,\n * not i18n keys: interpolate any values (a practice name) before passing. */\nexport interface AiConsentBannerCopy {\n /** Banner heading. */\n title?: string;\n /** Description in the required and pending states. */\n descriptionRequired?: string;\n /** Description in the granted state. */\n descriptionGranted?: string;\n /** Label of the confirmation checkbox. */\n confirmLabel?: string;\n /** Label of the Grant button. */\n grantButton?: string;\n /** Note shown instead of the grant controls when `canGrant` is false. */\n notAllowed?: string;\n /** Badge text in the granted state. */\n badgeGranted?: string;\n /** Busy text (and Spinner label) in the pending state. */\n pendingLabel?: string;\n}\n\n/** Agent-readiness curated handle. Exposes the structural consent state only. */\nexport interface AiConsentBannerHandle {\n /** Current derived state: 'granted' | 'required' | 'pending'. */\n getState: () => AiConsentState;\n /** Whether the Grant affordance is currently armed (checkbox ticked). */\n isArmed: () => boolean;\n}\n\nexport interface AiConsentBannerProps extends Omit<\n ComponentPropsWithoutRef<'div'>,\n 'aria-label' | 'children' | 'role'\n> {\n /**\n * Stable instance id. Surfaced on the root as `data-component-id` so an\n * agent / MCP UI bridge can address this specific banner. Mirrored to the\n * real DOM `id`.\n */\n id?: string;\n /** Whether consent has already been granted. Server-sourced. */\n granted: boolean;\n /**\n * When consent was granted — ISO-8601 string, ms-epoch, or Date. Rendered\n * via `Timestamp` in the granted state.\n */\n grantedAt?: string | number | Date;\n /** Who granted consent (operator display name / role). Granted state only. */\n grantedBy?: string;\n /**\n * Whether the current user is allowed to grant consent. When `false`, the\n * required-state Grant affordance is hidden and a not-allowed note shows.\n * Default `true`.\n */\n canGrant?: boolean;\n /** The grant is being persisted server-side — shows the busy Spinner state. */\n pending?: boolean;\n /** Fired when the operator confirms the consent grant. */\n onGrantConsent?: () => void;\n /**\n * Heading level for the banner's own title, so it can be nested under a\n * host section's heading without skipping levels (axe `heading-order`).\n * Additive: default `5` matches the banner's original, unconditional\n * `<h5>` — every existing consumer is unaffected.\n */\n headingLevel?: AiConsentBannerHeadingLevel;\n /** What the consent covers; picks the kit's translated wording. Default\n * `'patient-record'`, which renders exactly as before this prop existed. */\n subject?: AiConsentSubject;\n /** Host-translated strings; the host owns their wording and translation.\n * Each key overrides only its own string. `title` also names the region,\n * unless `aria-label` is passed. */\n copy?: Partial<AiConsentBannerCopy>;\n /** Override the region's accessible name. */\n 'aria-label'?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const AiConsentBanner = forwardRef<HTMLDivElement, AiConsentBannerProps>(\n (\n {\n id,\n granted,\n grantedAt,\n grantedBy,\n canGrant = true,\n pending = false,\n onGrantConsent,\n headingLevel = 5,\n subject = 'patient-record',\n copy,\n 'aria-label': ariaLabel,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation('ui');\n const state = deriveState(granted, pending);\n\n // A host string wins over the preset for that string only. A blank or\n // whitespace-only one counts as missing, so no control loses its name.\n const own = (value?: string) => value?.trim() || undefined;\n // An unknown subject from an untyped host falls back to the default.\n const keys = SUBJECT_KEYS[subject] ?? SUBJECT_KEYS['patient-record'];\n const text = {\n title:\n own(copy?.title) || t('aiConsentBanner.title', 'AI assistance consent'),\n descriptionRequired:\n own(copy?.descriptionRequired) ||\n t(keys.descriptionRequired.key, keys.descriptionRequired.fallback),\n descriptionGranted:\n own(copy?.descriptionGranted) ||\n t(keys.descriptionGranted.key, keys.descriptionGranted.fallback),\n confirmLabel:\n own(copy?.confirmLabel) ||\n t(keys.confirmLabel.key, keys.confirmLabel.fallback),\n grantButton:\n own(copy?.grantButton) ||\n t('aiConsentBanner.grantButton', 'Grant consent'),\n notAllowed:\n own(copy?.notAllowed) ||\n t(keys.notAllowed.key, keys.notAllowed.fallback),\n badgeGranted:\n own(copy?.badgeGranted) ||\n t('aiConsentBanner.badge.granted', 'Consent granted'),\n pendingLabel:\n own(copy?.pendingLabel) ||\n t('aiConsentBanner.pendingLabel', 'Saving consent…'),\n };\n\n // Grant stays disabled until the checkbox is ticked. Any change of subject\n // or statement unticks it, even back to an earlier one, so a tick only\n // confirms what was on screen when it was given.\n const statement = [\n subject,\n text.confirmLabel,\n text.descriptionRequired,\n ].join('\\u0000');\n const [ticked, setTicked] = useState(false);\n const [tickedFor, setTickedFor] = useState(statement);\n if (tickedFor !== statement) {\n setTickedFor(statement);\n setTicked(false);\n }\n const armed = ticked && tickedFor === statement;\n\n const armedRef = useRef(armed);\n armedRef.current = armed;\n\n const handle = useMemo<AiConsentBannerHandle>(\n () => ({\n getState: () => deriveState(granted, pending),\n isArmed: () => armedRef.current,\n }),\n [granted, pending],\n );\n useAgentRegistration(aiConsentBannerAgent, handle, id);\n\n // A host title also names the region, so the name matches the heading.\n const resolvedAriaLabel =\n own(ariaLabel) ||\n own(copy?.title) ||\n t('aiConsentBanner.regionLabel', 'AI assistance consent');\n\n // Alert variant per state: granted → success, required/pending → info.\n const alertVariant = state === 'granted' ? 'success' : 'info';\n\n let body: React.ReactNode;\n if (state === 'granted') {\n body = (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Badge variant=\"success\">{text.badgeGranted}</Badge>\n {grantedAt !== undefined ? (\n <span className=\"type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {t('aiConsentBanner.grantedAtPrefix', 'Granted')}{' '}\n <Timestamp value={grantedAt} format=\"relative\" shape=\"inline\" />\n </span>\n ) : null}\n </div>\n {grantedBy ? (\n <p className=\"type-body-sm ds:m-0 ds:text-[color:var(--muted-foreground)]\">\n {t('aiConsentBanner.grantedBy', {\n name: grantedBy,\n defaultValue: 'By {{name}}',\n })}\n </p>\n ) : null}\n </div>\n );\n } else if (state === 'pending') {\n body = (\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Spinner variant=\"pulse\" size=\"sm\" label={text.pendingLabel} />\n <span className=\"type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {text.pendingLabel}\n </span>\n </div>\n );\n } else {\n // required\n body = canGrant ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <Checkbox\n checked={armed}\n onCheckedChange={(next) => setTicked(next === true)}\n label={text.confirmLabel}\n />\n <Alert.Action>\n <Button\n intent=\"primary\"\n size=\"sm\"\n disabled={!armed}\n onClick={onGrantConsent}\n >\n {text.grantButton}\n </Button>\n </Alert.Action>\n </div>\n ) : (\n <p className=\"type-body-sm ds:m-0 ds:text-[color:var(--muted-foreground)]\">\n {text.notAllowed}\n </p>\n );\n }\n\n return (\n <div\n ref={ref}\n role=\"region\"\n aria-label={resolvedAriaLabel}\n aria-busy={state === 'pending' ? true : undefined}\n data-component=\"ai-consent-banner\"\n data-component-id={id}\n data-state={state}\n id={id}\n className={rootVariants({ state, className })}\n {...rest}\n >\n <Alert\n variant={alertVariant}\n icon={state === 'pending' ? null : undefined}\n >\n <Alert.Title as={`h${headingLevel}` as const}>\n {text.title}\n </Alert.Title>\n <Alert.Description>\n {state === 'granted'\n ? text.descriptionGranted\n : text.descriptionRequired}\n </Alert.Description>\n {body}\n </Alert>\n </div>\n );\n },\n);\n\nAiConsentBanner.displayName = 'AiConsentBanner';\n"],"names":["aiConsentBannerAgent","handle","rootVariants","cva","deriveState","granted","pending","SUBJECT_KEYS","AiConsentBanner","forwardRef","id","grantedAt","grantedBy","canGrant","onGrantConsent","headingLevel","subject","copy","ariaLabel","className","rest","ref","useTranslation","state","own","value","keys","text","statement","ticked","setTicked","useState","tickedFor","setTickedFor","armed","armedRef","useRef","useMemo","useAgentRegistration","resolvedAriaLabel","alertVariant","body","jsxs","jsx","Badge","Timestamp","Spinner","Checkbox","next","Alert","Button"],"mappings":";;;;;;;;;;;AAaO,MAAMA,IAA4D;AAAA,EACvE,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO;AAAA,IACL,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,gBAAgB;AAA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AAAJ,GAAW;AAAA,QAC3C,GAAGC;AAAA,QAEJ,UAAA,gBAAAsB;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,SAAST;AAAA,YACT,MAAMjB,MAAU,YAAY,OAAO;AAAA,YAEnC,UAAA;AAAA,cAAA,gBAAAoB,EAACM,EAAM,OAAN,EAAY,IAAI,IAAIlC,CAAY,IAC9B,YAAK,MAAA,CACR;AAAA,cACA,gBAAA4B,EAACM,EAAM,aAAN,EACE,gBAAU,YACPtB,EAAK,qBACLA,EAAK,oBAAA,CACX;AAAA,cACCc;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAGN;AACF;AAEAjC,EAAgB,cAAc;"}
@@ -34,7 +34,7 @@ import { F as bn } from "./file-text-5yv6r2ls.js";
34
34
  import { P as fn } from "./printer-rkK0T1gi.js";
35
35
  import { F as yn } from "./file-spreadsheet-DmwyfV4O.js";
36
36
  import { D as vn } from "./download-CfYKJO_j.js";
37
- import { C as kn } from "./checkbox-BjDv-r3o.js";
37
+ import { C as kn } from "./checkbox-a7Sh-dXb.js";
38
38
  import { T as wn } from "./text-input-CaG9ApoE.js";
39
39
  import { T as zn } from "./time-picker-DVfyAR81.js";
40
40
  import { H as xn } from "./heart-pulse-BCppJyN2.js";
@@ -20936,4 +20936,4 @@ export {
20936
20936
  Vi as t,
20937
20937
  od as u
20938
20938
  };
20939
- //# sourceMappingURL=anamnesis-summary-rows-fbEQwcuW.js.map
20939
+ //# sourceMappingURL=anamnesis-summary-rows-EKPfVCmh.js.map