@alfadocs/ui-kit 1.3.13 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/dist/_chunks/agenda-card.agent-Cb5tuEh3.js +28 -0
  2. package/dist/_chunks/{alia-sidebar-DzNz1gDf.js → alia-sidebar-DSBZMick.js} +3 -3
  3. package/dist/_chunks/{anamnesis-i18n-CfC0qYzy.js → anamnesis-i18n-BA631X4t.js} +2209 -2144
  4. package/dist/_chunks/{antenatal-schedule-timeline-BMMpi2lb.js → antenatal-schedule-timeline-u8TsS2QJ.js} +27 -26
  5. package/dist/_chunks/{appointment-timeline-B630OT_J.js → appointment-timeline-Bqf1sTU5.js} +2 -2
  6. package/dist/_chunks/{ar-THMLfSoN.js → ar-BR1FGFP2.js} +14 -14
  7. package/dist/_chunks/{bmi-calculator-CM0-G2mg.js → bmi-calculator-CpyY13MV.js} +2 -2
  8. package/dist/_chunks/{booking-DjNbd7C1.js → booking-BjsA7j1-.js} +699 -688
  9. package/dist/_chunks/calculator-dialog-12d3Sxaz.js +48 -0
  10. package/dist/_chunks/{care-plan-card-1G_f4I5s.js → care-plan-card-BvQy366X.js} +3 -3
  11. package/dist/_chunks/{care-plan-entry-card-DmBsffHS.js → care-plan-entry-card-apk_5B3O.js} +2 -2
  12. package/dist/_chunks/{chat-container-HlFnoEIl.js → chat-container-CYYego1W.js} +105 -81
  13. package/dist/_chunks/cycle-calculator-B7fyH-h4.js +425 -0
  14. package/dist/_chunks/{date-picker-ZHejTVAJ.js → date-picker-Bp64zk2p.js} +19 -19
  15. package/dist/_chunks/date-picker-variants-pKAJfnWr.js +2089 -0
  16. package/dist/_chunks/{date-range-picker-pEG3Ln3i.js → date-range-picker-CDrZ8Zh0.js} +27 -27
  17. package/dist/_chunks/{date-time-picker-695QvBGj.js → date-time-picker-DafkGDGO.js} +10 -10
  18. package/dist/_chunks/{de-DmZ-8rTN.js → de-3iM4rGqo.js} +7 -7
  19. package/dist/_chunks/{document-preview-D3gg4MXB.js → document-preview-DOrsqiN1.js} +2 -2
  20. package/dist/_chunks/due-date-calculator-CnkbbAej.js +571 -0
  21. package/dist/_chunks/{editor-overlay-DE3esyio.js → editor-overlay-B1tr2i7B.js} +22 -21
  22. package/dist/_chunks/{el-Bela9mxs.js → el-C96rGJvU.js} +2 -2
  23. package/dist/_chunks/{es-BNncHKex.js → es-Cxiqjx8r.js} +12 -12
  24. package/dist/_chunks/fetal-weight-avlj-l-S.js +223 -0
  25. package/dist/_chunks/format-4HNwNGrN.js +1315 -0
  26. package/dist/_chunks/{fr-CH8ADfhN.js → fr-Bhr6SYKj.js} +21 -21
  27. package/dist/_chunks/{freemium-paywall-C_Ue6wxU.js → freemium-paywall-DRDdWuOg.js} +3 -3
  28. package/dist/_chunks/gestational-age-calculator-BljY_DVJ.js +488 -0
  29. package/dist/_chunks/hcg-doubling-Cv_vH61p.js +312 -0
  30. package/dist/_chunks/header-settings-Cn5fPXCE.js +335 -0
  31. package/dist/_chunks/{hi-Bppfxp8l.js → hi-BxXX26d_.js} +12 -12
  32. package/dist/_chunks/isSameWeek-B73MagWB.js +13 -0
  33. package/dist/_chunks/{it-B4ySaRyK.js → it-Xmjomvyj.js} +24 -24
  34. package/dist/_chunks/{ja-CGF6Io9P.js → ja-mfZvt1ZV.js} +16 -16
  35. package/dist/_chunks/{link-cell-renderer-C5XLwVXQ.js → link-cell-renderer-CJ_gk7gl.js} +3 -3
  36. package/dist/_chunks/{locale-picker-BfBUdT1m.js → locale-picker-D9Kv2zrK.js} +153 -132
  37. package/dist/_chunks/map-view-2yZCQW2l.js +445 -0
  38. package/dist/_chunks/{marketplace-app-shell-DwcFMxzp.js → marketplace-app-shell-BLRvg-M0.js} +49 -40
  39. package/dist/_chunks/{nl-DuShqwuV.js → nl-DDs-KEnD.js} +15 -15
  40. package/dist/_chunks/{notes-panel-DPsgB4Mv.js → notes-panel-CiFN3sLW.js} +2 -2
  41. package/dist/_chunks/{number-input-DrozbZAU.js → number-input-DOe5VYei.js} +64 -64
  42. package/dist/_chunks/{optical-prescription-BDHJr8Zz.js → optical-prescription-CRemE8fL.js} +2 -2
  43. package/dist/_chunks/{parse-DvA97ro9.js → parse-JqixfsU0.js} +43 -43
  44. package/dist/_chunks/parseISO-fOGpHKXm.js +120 -0
  45. package/dist/_chunks/{patient-details-DqjjwPmt.js → patient-details-CpunD0qx.js} +3 -3
  46. package/dist/_chunks/{patient-table-BmIDrLIS.js → patient-table-2eWx-Rrk.js} +2 -2
  47. package/dist/_chunks/{payment-form-h-BZ8onk.js → payment-form-Ds1I9KqB.js} +308 -231
  48. package/dist/_chunks/{pdf-viewer-Ddx-T053.js → pdf-viewer-DUIsV9s5.js} +429 -369
  49. package/dist/_chunks/{pl-CKQwX9Fk.js → pl-BYYMnEWP.js} +18 -18
  50. package/dist/_chunks/{practice-results-B-HPc13W.js → practice-results-SjCniMd2.js} +2 -2
  51. package/dist/_chunks/pregnancy-dating-BmpHScZ0.js +770 -0
  52. package/dist/_chunks/pregnancy-weight-gain-B5KSJzdc.js +553 -0
  53. package/dist/_chunks/progress-CK8otcQ-.js +343 -0
  54. package/dist/_chunks/{pt-_njpXyOZ.js → pt-BSPnVrQ7.js} +20 -20
  55. package/dist/_chunks/{radiograph-panel.agent-BQZ64Riy.js → radiograph-panel.agent-CtFtNMzk.js} +3 -3
  56. package/dist/_chunks/{rich-text-editor-CfeXPPWs.js → rich-text-editor-BedTpWzL.js} +2 -2
  57. package/dist/_chunks/{ro-3X6_4FcN.js → ro-BbiylGmG.js} +14 -14
  58. package/dist/_chunks/{ru-bAcgmnS-.js → ru-BX_qsV67.js} +14 -14
  59. package/dist/_chunks/{session-countdown-Bc70VXN1.js → session-countdown-BL-Psg8u.js} +2 -2
  60. package/dist/_chunks/{sign-document-CW_ByDUh.js → sign-document-jF4fZDJ5.js} +2 -2
  61. package/dist/_chunks/slot-grid-DNiUcXy2.js +640 -0
  62. package/dist/_chunks/{sparkline-BTY4B5tv.js → sparkline-BmGcEyZO.js} +209 -164
  63. package/dist/_chunks/{sq-jYFqr4Ga.js → sq-i9UOk4P7.js} +10 -10
  64. package/dist/_chunks/subDays-CAUv47M1.js +8 -0
  65. package/dist/_chunks/{sv-BSGEJ-8B.js → sv-CpTdtmDQ.js} +8 -8
  66. package/dist/_chunks/{tab-bar-Axhk6xzx.js → tab-bar-BYESZINM.js} +83 -77
  67. package/dist/_chunks/task-card.agent-CF2N_uu4.js +29 -0
  68. package/dist/_chunks/{tr-CTpgUtw6.js → tr-DXG2QN1K.js} +17 -17
  69. package/dist/_chunks/{unit-converter-COgkN7YP.js → unit-converter-CHPDuV7W.js} +2 -2
  70. package/dist/_chunks/{warning-stack-BtjmJChC.js → warning-stack-B7t_8jRE.js} +42 -37
  71. package/dist/_chunks/{zh-CN-BgM0Io2O.js → zh-CN-vPkPEK6H.js} +18 -18
  72. package/dist/agent-catalog.json +6426 -3382
  73. package/dist/agent-i18n/en.json +234 -15
  74. package/dist/components/agenda-card/index.js +1 -1
  75. package/dist/components/appointment-timeline/index.js +1 -1
  76. package/dist/components/bmi-calculator/index.js +1 -1
  77. package/dist/components/booking/index.js +1 -1
  78. package/dist/components/calculator-dialog/index.js +1 -1
  79. package/dist/components/care-plan-card/index.js +1 -1
  80. package/dist/components/care-plan-entry-card/index.js +1 -1
  81. package/dist/components/chat-container/chat-container.d.ts +14 -0
  82. package/dist/components/chat-container/index.js +1 -1
  83. package/dist/components/cycle-calculator/cycle-calculator.agent.d.ts +4 -0
  84. package/dist/components/cycle-calculator/cycle-calculator.d.ts +42 -0
  85. package/dist/components/cycle-calculator/index.d.ts +1 -1
  86. package/dist/components/cycle-calculator/index.js +1 -1
  87. package/dist/components/data-table/index.js +1 -1
  88. package/dist/components/date-picker/index.js +1 -1
  89. package/dist/components/date-range-picker/index.js +1 -1
  90. package/dist/components/date-time-picker/index.js +1 -1
  91. package/dist/components/document-preview/index.js +1 -1
  92. package/dist/components/due-date-calculator/due-date-calculator.agent.d.ts +4 -0
  93. package/dist/components/due-date-calculator/due-date-calculator.d.ts +61 -1
  94. package/dist/components/due-date-calculator/index.d.ts +1 -1
  95. package/dist/components/due-date-calculator/index.js +2 -2
  96. package/dist/components/editor-overlay/editor-overlay.d.ts +7 -1
  97. package/dist/components/editor-overlay/index.js +1 -1
  98. package/dist/components/fetal-weight/fetal-weight.agent.d.ts +4 -0
  99. package/dist/components/fetal-weight/fetal-weight.d.ts +26 -0
  100. package/dist/components/fetal-weight/index.d.ts +1 -1
  101. package/dist/components/fetal-weight/index.js +1 -1
  102. package/dist/components/freemium-paywall/index.js +1 -1
  103. package/dist/components/gestational-age-calculator/gestational-age-calculator.agent.d.ts +4 -0
  104. package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts +44 -2
  105. package/dist/components/gestational-age-calculator/index.d.ts +1 -1
  106. package/dist/components/gestational-age-calculator/index.js +1 -1
  107. package/dist/components/hcg-doubling/hcg-doubling.agent.d.ts +4 -0
  108. package/dist/components/hcg-doubling/hcg-doubling.d.ts +30 -0
  109. package/dist/components/hcg-doubling/index.d.ts +1 -1
  110. package/dist/components/hcg-doubling/index.js +1 -1
  111. package/dist/components/header-settings/header-settings.d.ts +13 -1
  112. package/dist/components/header-settings/index.js +1 -1
  113. package/dist/components/locale-picker/index.js +1 -1
  114. package/dist/components/locale-picker/locale-picker.d.ts +9 -0
  115. package/dist/components/map-view/index.js +1 -1
  116. package/dist/components/map-view/map-view.d.ts +22 -0
  117. package/dist/components/notes-panel/index.js +1 -1
  118. package/dist/components/number-input/index.js +1 -1
  119. package/dist/components/number-input/number-input.d.ts +2 -1
  120. package/dist/components/optical-prescription/index.js +1 -1
  121. package/dist/components/patient-details/index.js +1 -1
  122. package/dist/components/patient-table/index.js +1 -1
  123. package/dist/components/payment-form/index.d.ts +1 -1
  124. package/dist/components/payment-form/index.js +1 -1
  125. package/dist/components/payment-form/payment-form.d.ts +32 -1
  126. package/dist/components/pdf-viewer/index.js +1 -1
  127. package/dist/components/pdf-viewer/pdf-viewer.d.ts +13 -0
  128. package/dist/components/practice-results/index.js +1 -1
  129. package/dist/components/pregnancy-dating/index.d.ts +1 -1
  130. package/dist/components/pregnancy-dating/index.js +1 -1
  131. package/dist/components/pregnancy-dating/pregnancy-dating.agent.d.ts +4 -0
  132. package/dist/components/pregnancy-dating/pregnancy-dating.d.ts +65 -1
  133. package/dist/components/pregnancy-weight-gain/index.d.ts +2 -1
  134. package/dist/components/pregnancy-weight-gain/index.js +6 -5
  135. package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.agent.d.ts +4 -0
  136. package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts +35 -0
  137. package/dist/components/progress/index.js +1 -1
  138. package/dist/components/progress/progress.d.ts +13 -0
  139. package/dist/components/radiograph-panel/index.js +1 -1
  140. package/dist/components/rich-text-editor/index.js +1 -1
  141. package/dist/components/session-countdown/index.js +1 -1
  142. package/dist/components/sign-document/index.js +1 -1
  143. package/dist/components/slot-grid/index.d.ts +2 -1
  144. package/dist/components/slot-grid/index.js +5 -4
  145. package/dist/components/slot-grid/slot-grid.agent.d.ts +4 -0
  146. package/dist/components/slot-grid/slot-grid.d.ts +34 -0
  147. package/dist/components/sparkline/index.js +1 -1
  148. package/dist/components/sparkline/sparkline.d.ts +10 -0
  149. package/dist/components/tab-bar/index.js +1 -1
  150. package/dist/components/tab-bar/tab-bar.d.ts +13 -0
  151. package/dist/components/task-card/index.js +1 -1
  152. package/dist/components/unit-converter/index.js +1 -1
  153. package/dist/components/warning-stack/index.js +1 -1
  154. package/dist/index.js +630 -627
  155. package/dist/patterns/alia-assistant/index.js +1 -1
  156. package/dist/patterns/anamnesis/anamnesis-derive.d.ts +27 -8
  157. package/dist/patterns/anamnesis/anamnesis-format.d.ts +11 -3
  158. package/dist/patterns/anamnesis/anamnesis-highlight.d.ts +6 -0
  159. package/dist/patterns/anamnesis/anamnesis-questionnaire.d.ts +23 -9
  160. package/dist/patterns/anamnesis/anamnesis-types.d.ts +7 -0
  161. package/dist/patterns/anamnesis/anamnesis.d.ts +16 -7
  162. package/dist/patterns/anamnesis/index.d.ts +3 -2
  163. package/dist/patterns/anamnesis/index.js +7 -6
  164. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  165. package/dist/patterns/marketplace-app-shell/marketplace-app-shell.d.ts +6 -0
  166. package/dist/tokens.css +1 -1
  167. package/package.json +1 -1
  168. package/dist/_chunks/agenda-card.agent-mTCrkKSZ.js +0 -27
  169. package/dist/_chunks/calculator-dialog-DuXMQSdm.js +0 -40
  170. package/dist/_chunks/cycle-calculator-BwqYVPB4.js +0 -252
  171. package/dist/_chunks/date-picker-variants-eL6HjWvw.js +0 -3363
  172. package/dist/_chunks/due-date-calculator-CwfsFd3T.js +0 -256
  173. package/dist/_chunks/fetal-weight-ePlLjJPc.js +0 -122
  174. package/dist/_chunks/gestational-age-calculator-DdgbH69Z.js +0 -311
  175. package/dist/_chunks/hcg-doubling-BBqD2wI2.js +0 -170
  176. package/dist/_chunks/header-settings--pjYOe6g.js +0 -284
  177. package/dist/_chunks/isSameDay-DUEiAT0G.js +0 -39
  178. package/dist/_chunks/isSameWeek-CK4HS9lH.js +0 -14
  179. package/dist/_chunks/map-view-CsaHfoo6.js +0 -378
  180. package/dist/_chunks/pregnancy-dating-DzYTlBkT.js +0 -421
  181. package/dist/_chunks/pregnancy-weight-gain-O6J0sUIi.js +0 -322
  182. package/dist/_chunks/progress-DA413-zn.js +0 -299
  183. package/dist/_chunks/slot-grid-CQSULZjd.js +0 -502
  184. package/dist/_chunks/subDays-BcNi04uf.js +0 -8
  185. package/dist/_chunks/task-card.agent-Bt14CzUd.js +0 -25
@@ -0,0 +1,445 @@
1
+ import { jsx as a, jsxs as g } from "react/jsx-runtime";
2
+ import { forwardRef as Q, useId as W, useMemo as w, useState as N, useEffect as f, useRef as h, useCallback as z, useImperativeHandle as X } from "react";
3
+ import { c } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as L } from "react-i18next";
5
+ import { A as Y, M as ee, a as te, P as se, b as ne, u as oe } from "./index.modern-Zta-A4Jm.js";
6
+ import { B as ae } from "./button-CPGiR_bH.js";
7
+ import { u as re } from "./registry-DvAUVLHh.js";
8
+ import { M as ie } from "./map-pin-BaY37-Km.js";
9
+ import { E as de } from "./external-link-CY6zAXXU.js";
10
+ const le = {
11
+ id: "map-view",
12
+ // pan → scroll (viewport move); set_zoom → set_value; select_marker → pick
13
+ // (NON-persisting marker focus, no value state slot).
14
+ capabilities: ["scroll", "set_value", "pick"],
15
+ // Every action routes through the imperative bridge, which only exists
16
+ // inside the `APIProvider` subtree — and that subtree renders only once
17
+ // consent is granted (the default is `consentGranted={false}`). Under
18
+ // the gate all three actions are silent no-ops. `consentGranted` is the
19
+ // slot that tells an agent so; `center` / `zoom` are read off the live
20
+ // map because Google clamps zoom and animates pans, so requested is not
21
+ // applied; `selectedMarkerId` is the only confirmation the host accepted
22
+ // a `select_marker` proposal.
23
+ //
24
+ // A9: marker ids only (`MapMarker.id` is a stable opaque id). Never
25
+ // `MapMarker.label`, never the `address` prop (consumer-supplied free
26
+ // text, PII in any patient-address deployment), never `apiKey`.
27
+ state: {
28
+ consentGranted: {
29
+ type: "boolean",
30
+ descriptionKey: "ui.agent.mapView.state.consentGranted",
31
+ description: "True when the GDPR consent gate has been passed and the Google Maps subtree is mounted. Read this FIRST — while it is false every action is a silent no-op against a placeholder, and nothing else in the surface says so.",
32
+ read: (t) => t.isConsentGranted()
33
+ },
34
+ markerCount: {
35
+ type: "number",
36
+ descriptionKey: "ui.agent.mapView.state.markerCount",
37
+ description: "Number of markers the consumer passed. Zero means there is nothing for `select_marker` to select. A count only — no ids, labels or positions.",
38
+ read: (t) => t.getMarkerCount()
39
+ },
40
+ selectedMarkerId: {
41
+ type: "string | null",
42
+ descriptionKey: "ui.agent.mapView.state.selectedMarkerId",
43
+ description: "Id of the marker the host currently holds as selected, or null. Selection is fully controlled by the consumer, so `select_marker` only proposes — this slot is the only way to see whether the proposal was accepted.",
44
+ read: (t) => t.getSelectedMarkerId()
45
+ },
46
+ center: {
47
+ type: "{ lat: number; lng: number } | null",
48
+ descriptionKey: "ui.agent.mapView.state.center",
49
+ description: "Live map centre in lat/lng, or null while the map subtree is unmounted (consent not granted). The read-back for `pan_to`.",
50
+ read: (t) => t.getCenter()
51
+ },
52
+ zoom: {
53
+ type: "number | null",
54
+ descriptionKey: "ui.agent.mapView.state.zoom",
55
+ description: "Live zoom level, or null while the map subtree is unmounted. Google clamps zoom to the map type's range, so this is not necessarily the value last passed to `set_zoom`.",
56
+ read: (t) => t.getZoom()
57
+ }
58
+ },
59
+ actions: {
60
+ pan_to: {
61
+ // Ephemeral viewport move, no data loss → read.
62
+ safety: "read",
63
+ argsType: "{ position: { lat: number; lng: number } }",
64
+ argsSchema: {
65
+ type: "object",
66
+ properties: {
67
+ position: {
68
+ type: "object",
69
+ properties: {
70
+ lat: { type: "number", description: "Latitude in degrees." },
71
+ lng: { type: "number", description: "Longitude in degrees." }
72
+ },
73
+ required: ["lat", "lng"]
74
+ }
75
+ },
76
+ required: ["position"]
77
+ },
78
+ idempotent: !0,
79
+ descriptionKey: "ui.agent.mapView.actions.panTo",
80
+ description: "Pan the map to a new centre without changing zoom. Read the `center` slot back to confirm — Google animates the pan, so the applied centre settles after the call.",
81
+ errors: [
82
+ "Silent no-op while `consentGranted` is false — there is no map, only the consent placeholder."
83
+ ],
84
+ invoke: (t, r) => {
85
+ t.panTo(r.position);
86
+ }
87
+ },
88
+ set_zoom: {
89
+ // Ephemeral viewport zoom, no data loss → read.
90
+ safety: "read",
91
+ argsType: "{ zoom: number }",
92
+ argsSchema: {
93
+ type: "object",
94
+ properties: {
95
+ zoom: {
96
+ type: "number",
97
+ description: "Zoom level, typical range 1–20."
98
+ }
99
+ },
100
+ required: ["zoom"]
101
+ },
102
+ idempotent: !0,
103
+ descriptionKey: "ui.agent.mapView.actions.setZoom",
104
+ description: "Set the map zoom level (typical range 1–20). Read the `zoom` slot back — Google clamps the request to the map type’s supported range, so requested and applied can differ.",
105
+ errors: [
106
+ "Silent no-op while `consentGranted` is false — there is no map, only the consent placeholder.",
107
+ "Requested zoom is clamped to the map type's range; `zoom` reports what was actually applied."
108
+ ],
109
+ invoke: (t, r) => {
110
+ t.setZoom(r.zoom);
111
+ }
112
+ },
113
+ select_marker: {
114
+ // Ephemeral marker focus, no data loss → read.
115
+ safety: "read",
116
+ argsType: "{ id: string | null }",
117
+ argsSchema: {
118
+ type: "object",
119
+ properties: {
120
+ id: {
121
+ type: ["string", "null"],
122
+ description: "Marker id to select, or null to clear the selection."
123
+ }
124
+ },
125
+ required: ["id"]
126
+ },
127
+ idempotent: !0,
128
+ descriptionKey: "ui.agent.mapView.actions.selectMarker",
129
+ description: "Propose a marker selection by id, or pass null to clear it. Fires the host's `onMarkerClick`; selection is controlled by the host, so read the `selectedMarkerId` slot back to see whether it accepted.",
130
+ errors: [
131
+ "Silent no-op while `consentGranted` is false — there is no map, only the consent placeholder.",
132
+ "The host owns `selectedMarkerId` and may ignore the proposal; `selectedMarkerId` is unchanged when it does."
133
+ ],
134
+ invoke: (t, r) => {
135
+ t.selectMarker(r.id);
136
+ }
137
+ }
138
+ },
139
+ domHooks: {
140
+ root: {
141
+ attr: "data-component",
142
+ value: "map-view",
143
+ description: "Marks the element as a kit MapView."
144
+ },
145
+ instanceId: {
146
+ attr: "data-component-id",
147
+ sourceProp: "id",
148
+ description: "Sourced from the id prop."
149
+ }
150
+ }
151
+ }, ce = c(
152
+ ["ds:relative ds:overflow-hidden ds:block", "ds:bg-[var(--muted)]"].join(" "),
153
+ {
154
+ variants: {
155
+ size: {
156
+ sm: "ds:[--map-block-size:14rem]",
157
+ md: "ds:[--map-block-size:20rem]",
158
+ lg: "ds:[--map-block-size:28rem]",
159
+ // `fill` defers sizing to the parent. The outer takes
160
+ // `block-size: 100%` so the inner (also 100%) has something
161
+ // to inherit from. Use inside a viewport-locked column —
162
+ // `<PracticeResults variant="map-first">` wires this through
163
+ // automatically; standalone consumers must give the parent
164
+ // a constrained block-size or the map collapses to 0.
165
+ fill: "ds:[block-size:100%]"
166
+ },
167
+ surface: {
168
+ bordered: "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
169
+ elevated: "ds:rounded-[var(--radius-md)] ds:shadow-[var(--shadow-card)] ds:border ds:border-[color:var(--card-border)] ds:[.theme-accessible_&]:border-2",
170
+ bare: "ds:rounded-none ds:border-0"
171
+ }
172
+ },
173
+ defaultVariants: { size: "md", surface: "bordered" }
174
+ }
175
+ ), pe = c("ds:block ds:inline-size-full", {
176
+ variants: {
177
+ size: {
178
+ sm: "ds:[block-size:var(--map-block-size)]",
179
+ md: "ds:[block-size:var(--map-block-size)]",
180
+ lg: "ds:[block-size:var(--map-block-size)]",
181
+ fill: "ds:[block-size:100%]"
182
+ }
183
+ },
184
+ defaultVariants: { size: "md" }
185
+ }), me = c(
186
+ [
187
+ "ds:absolute ds:inset-0",
188
+ "ds:flex ds:flex-col ds:items-center ds:justify-center",
189
+ "ds:gap-[var(--spacing-sm)]",
190
+ "ds:p-[var(--spacing-md)]",
191
+ "ds:bg-[var(--muted)] ds:text-[var(--foreground)]",
192
+ "ds:text-center"
193
+ ].join(" ")
194
+ ), ue = c("type-heading-3 ds:m-0"), R = c(
195
+ "type-body-sm ds:text-[var(--muted-foreground)] ds:[max-inline-size:28rem] ds:m-0"
196
+ );
197
+ function he({
198
+ onHandleReady: t,
199
+ onMarkerSelect: r
200
+ }) {
201
+ const s = oe();
202
+ return f(() => {
203
+ if (s)
204
+ return t({
205
+ panTo: (n) => s.panTo(n),
206
+ setZoom: (n) => s.setZoom(n),
207
+ selectMarker: (n) => r(n),
208
+ // Read straight off the live map: Google clamps `setZoom` to the
209
+ // map type's range and animates `panTo`, so requested and applied
210
+ // are not the same value.
211
+ getCenter: () => {
212
+ var n;
213
+ return ((n = s.getCenter()) == null ? void 0 : n.toJSON()) ?? null;
214
+ },
215
+ getZoom: () => s.getZoom() ?? null
216
+ }), () => t(null);
217
+ }, [s, t, r]), null;
218
+ }
219
+ function ge({
220
+ address: t,
221
+ description: r,
222
+ onLoadMap: s,
223
+ openInGoogleMapsHref: n,
224
+ consentCta: p
225
+ }) {
226
+ const { t: l } = L();
227
+ return /* @__PURE__ */ g("div", { className: me(), "data-testid": "map-view-consent", children: [
228
+ /* @__PURE__ */ a(
229
+ ie,
230
+ {
231
+ "aria-hidden": "true",
232
+ className: "ds:size-6 ds:text-[var(--muted-foreground)]"
233
+ }
234
+ ),
235
+ /* @__PURE__ */ a("p", { className: ue(), children: l("mapView.consentTitle") }),
236
+ t ? /* @__PURE__ */ a(
237
+ "p",
238
+ {
239
+ className: R(),
240
+ "data-testid": "map-view-address",
241
+ children: t
242
+ }
243
+ ) : null,
244
+ /* @__PURE__ */ a("p", { className: R(), children: r }),
245
+ /* @__PURE__ */ g("div", { className: "ds:flex ds:gap-[var(--spacing-sm)] ds:flex-wrap ds:items-center ds:justify-center", children: [
246
+ p ?? /* @__PURE__ */ a(
247
+ ae,
248
+ {
249
+ type: "button",
250
+ intent: "primary",
251
+ size: "sm",
252
+ onClick: s,
253
+ "data-testid": "map-view-load-cta",
254
+ children: l("mapView.consentCta")
255
+ }
256
+ ),
257
+ /* @__PURE__ */ g(
258
+ "a",
259
+ {
260
+ href: n,
261
+ target: "_blank",
262
+ rel: "noopener noreferrer",
263
+ className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)] ds:text-[var(--primary)] ds:underline ds:underline-offset-2",
264
+ children: [
265
+ l("mapView.openInGoogleMaps"),
266
+ /* @__PURE__ */ a(de, { "aria-hidden": "true", className: "ds:size-3" })
267
+ ]
268
+ }
269
+ )
270
+ ] })
271
+ ] });
272
+ }
273
+ const fe = Q(
274
+ ({
275
+ id: t,
276
+ apiKey: r,
277
+ center: s,
278
+ zoom: n = 15,
279
+ markers: p,
280
+ selectedMarkerId: l,
281
+ onMarkerClick: i,
282
+ consentGranted: _ = !1,
283
+ onConsentRequest: b,
284
+ address: m,
285
+ consentDescription: j,
286
+ consentCta: P,
287
+ mapId: V,
288
+ size: I,
289
+ surface: q,
290
+ ariaLabel: K,
291
+ className: A,
292
+ ...C
293
+ }, E) => {
294
+ const { t: y, i18n: H } = L(), M = W(), D = w(
295
+ () => `map-${M.replace(/[^a-zA-Z0-9-_]/g, "")}`,
296
+ [M]
297
+ ), [T, $] = N(!1);
298
+ f(() => {
299
+ if (typeof window > "u") return;
300
+ const e = window.matchMedia("(prefers-reduced-motion: reduce)"), o = () => $(e.matches);
301
+ return o(), e.addEventListener("change", o), () => e.removeEventListener("change", o);
302
+ }, []);
303
+ const B = w(() => `https://www.google.com/maps/search/?api=1&query=${m ? encodeURIComponent(m) : `${s.lat},${s.lng}`}`, [m, s.lat, s.lng]), d = h(null), F = z((e) => {
304
+ d.current = e;
305
+ }, []), x = h(!1), S = h(null), Z = h(0), u = z(
306
+ () => ({
307
+ panTo: (e) => {
308
+ var o;
309
+ return (o = d.current) == null ? void 0 : o.panTo(e);
310
+ },
311
+ setZoom: (e) => {
312
+ var o;
313
+ return (o = d.current) == null ? void 0 : o.setZoom(e);
314
+ },
315
+ selectMarker: (e) => {
316
+ var o;
317
+ return (o = d.current) == null ? void 0 : o.selectMarker(e);
318
+ },
319
+ // Without `isConsentGranted` an agent has no way to learn that
320
+ // its pan / zoom / select was swallowed by the GDPR gate rather
321
+ // than applied: under the default (`consentGranted={false}`) the
322
+ // whole Maps subtree is unmounted and every action optional-chains
323
+ // into nothing.
324
+ isConsentGranted: () => x.current,
325
+ getCenter: () => {
326
+ var e;
327
+ return ((e = d.current) == null ? void 0 : e.getCenter()) ?? null;
328
+ },
329
+ getZoom: () => {
330
+ var e;
331
+ return ((e = d.current) == null ? void 0 : e.getZoom()) ?? null;
332
+ },
333
+ getSelectedMarkerId: () => S.current,
334
+ getMarkerCount: () => Z.current
335
+ }),
336
+ []
337
+ );
338
+ X(E, u, [u]);
339
+ const U = w(
340
+ () => u(),
341
+ [u]
342
+ );
343
+ re(le, U, t), f(() => {
344
+ var e;
345
+ T || (e = d.current) == null || e.panTo(s);
346
+ }, [s.lat, s.lng, T]), f(() => {
347
+ var e;
348
+ (e = d.current) == null || e.setZoom(n);
349
+ }, [n]);
350
+ const [J, k] = N(!1), G = _ || J;
351
+ x.current = G, S.current = l ?? null, Z.current = (p ?? []).length;
352
+ const O = z(() => {
353
+ if (b) {
354
+ b(), k(!0);
355
+ return;
356
+ }
357
+ k(!0);
358
+ }, [b]);
359
+ return /* @__PURE__ */ a(
360
+ "div",
361
+ {
362
+ className: ce({ size: I, surface: q, className: A }),
363
+ "data-component": "map-view",
364
+ "data-component-id": t ?? D,
365
+ role: "region",
366
+ "aria-label": K ?? y("mapView.label"),
367
+ ...C,
368
+ children: /* @__PURE__ */ a("div", { className: pe({ size: I }), children: G ? /* @__PURE__ */ a(
369
+ Y,
370
+ {
371
+ apiKey: r,
372
+ language: H.language,
373
+ children: /* @__PURE__ */ g(
374
+ ee,
375
+ {
376
+ defaultCenter: s,
377
+ defaultZoom: n,
378
+ mapId: V,
379
+ gestureHandling: "cooperative",
380
+ disableDefaultUI: !1,
381
+ onClick: () => i == null ? void 0 : i(null),
382
+ className: "ds:[inline-size:100%] ds:[block-size:100%]",
383
+ children: [
384
+ /* @__PURE__ */ a(
385
+ he,
386
+ {
387
+ onHandleReady: F,
388
+ onMarkerSelect: (e) => i == null ? void 0 : i(e)
389
+ }
390
+ ),
391
+ (p ?? []).map((e) => {
392
+ const o = l != null && l === e.id, v = y("mapView.markerLabel", {
393
+ label: e.label ?? e.id
394
+ });
395
+ return V ? /* @__PURE__ */ a(
396
+ te,
397
+ {
398
+ position: e.position,
399
+ title: v,
400
+ "aria-label": v,
401
+ "data-selected": o ? "true" : "false",
402
+ onClick: () => i == null ? void 0 : i(e.id),
403
+ children: /* @__PURE__ */ a(
404
+ se,
405
+ {
406
+ background: "var(--primary)",
407
+ borderColor: "var(--primary)",
408
+ glyphColor: "var(--primary-foreground)"
409
+ }
410
+ )
411
+ },
412
+ e.id
413
+ ) : /* @__PURE__ */ a(
414
+ ne,
415
+ {
416
+ position: e.position,
417
+ title: v,
418
+ onClick: () => i == null ? void 0 : i(e.id)
419
+ },
420
+ e.id
421
+ );
422
+ })
423
+ ]
424
+ }
425
+ )
426
+ }
427
+ ) : /* @__PURE__ */ a(
428
+ ge,
429
+ {
430
+ address: m,
431
+ description: j ?? y("mapView.consentDescription"),
432
+ onLoadMap: O,
433
+ consentCta: P,
434
+ openInGoogleMapsHref: B
435
+ }
436
+ ) })
437
+ }
438
+ );
439
+ }
440
+ );
441
+ fe.displayName = "MapView";
442
+ export {
443
+ fe as M
444
+ };
445
+ //# sourceMappingURL=map-view-2yZCQW2l.js.map