@alfadocs/ui-kit 1.90.0 → 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 (97) hide show
  1. package/dist/_chunks/address-autocomplete-DR4Xn23Z.js +519 -0
  2. package/dist/_chunks/{address-fields-CfnXK8RT.js → address-fields-qxQkGwPf.js} +5 -5
  3. package/dist/_chunks/{ai-permission-notice-CoW22jx1.js → ai-permission-notice-VNh3W57L.js} +2 -2
  4. package/dist/_chunks/{anamnesis-summary-rows-DUMERHK3.js → anamnesis-summary-rows-EKPfVCmh.js} +662 -654
  5. package/dist/_chunks/autocomplete-BXMcNoa3.js +562 -0
  6. package/dist/_chunks/{balance-badge-cell-C9-hyfxy.js → balance-badge-cell-D9VhFp0L.js} +3 -3
  7. package/dist/_chunks/{booking-C0FoW8Yx.js → booking-CcE_oviI.js} +1896 -1859
  8. package/dist/_chunks/browser-D5CD3WOj.js +565 -0
  9. package/dist/_chunks/{calendar-appointment-editor-dialog-D8Wkbm8_.js → calendar-appointment-editor-dialog-CiAGAX2t.js} +7 -7
  10. package/dist/_chunks/{checkbox-BjDv-r3o.js → checkbox-a7Sh-dXb.js} +32 -31
  11. package/dist/_chunks/{checkbox-group-Cw2H5qaq.js → checkbox-group-eGdv9fZc.js} +2 -2
  12. package/dist/_chunks/{city-input-CJVGswxp.js → city-input-CA59CjnV.js} +2 -2
  13. package/dist/_chunks/{combobox-CDPm_n0p.js → combobox-D-gpgEDy.js} +314 -294
  14. package/dist/_chunks/{country-select-DQ8q7ypA.js → country-select-BfmX9y5i.js} +2 -2
  15. package/dist/_chunks/{data-table-D7EGpqOn.js → data-table-CqQgoNsU.js} +553 -552
  16. package/dist/_chunks/{face-scheme-BgJGFDTa.js → face-scheme-BKSE98bo.js} +2 -2
  17. package/dist/_chunks/{file-manager-DQbWBTfk.js → file-manager-BnI1ZWZu.js} +2 -2
  18. package/dist/_chunks/{header-settings-BVhjndtV.js → header-settings-BeA2fnol.js} +24 -23
  19. package/dist/_chunks/{heatmap-BJB6V9yJ.js → heatmap-fCxwNz2o.js} +2 -2
  20. package/dist/_chunks/index-CpVcVNBu.js +2326 -0
  21. package/dist/_chunks/{index.es-Bpb8_NrX.js → index.es-Beo-XicE.js} +2 -2
  22. package/dist/_chunks/jspdf.es.min-BW7y6yhl.js +9674 -0
  23. package/dist/_chunks/{link-cell-renderer-C0ynDik7.js → link-cell-renderer-CnCgudvq.js} +3 -3
  24. package/dist/_chunks/{login-dev-card-DYwbL5sD.js → login-dev-card-BZBR58mu.js} +2 -2
  25. package/dist/_chunks/{map-view-Bvi06RVh.js → map-view-UrNgxBy3.js} +260 -237
  26. package/dist/_chunks/{index.modern-BeRXQVdc.js → maps-core-gate-DkNqGkm3.js} +360 -319
  27. package/dist/_chunks/{marketplace-app-shell-x_abo_ye.js → marketplace-app-shell-CmZx0Oam.js} +2 -2
  28. package/dist/_chunks/{notes-panel-CZO1qsD-.js → notes-panel-Dywo6R55.js} +2 -2
  29. package/dist/_chunks/{patient-details-D0P5eog5.js → patient-details-BUr7Oemx.js} +2 -2
  30. package/dist/_chunks/{patient-field-row-R73dZJY6.js → patient-field-row-bJk8Q_qr.js} +5 -5
  31. package/dist/_chunks/patient-search-Ca9j5cWb.js +1306 -0
  32. package/dist/_chunks/{patient-summary-card-6U74-ivO.js → patient-summary-card-CCQZ8X37.js} +2 -2
  33. package/dist/_chunks/{periodontal-diagnosis-B9YmmVmM.js → periodontal-diagnosis-DD3hrg9X.js} +2 -2
  34. package/dist/_chunks/{permission-matrix-BoQjENGV.js → permission-matrix-BJ6sg3Zp.js} +3 -3
  35. package/dist/_chunks/{practice-results-B61krlwu.js → practice-results-DQuOfqej.js} +2 -2
  36. package/dist/_chunks/{province-select-CPdTwEob.js → province-select-D64whw0m.js} +2 -2
  37. package/dist/_chunks/{registration-form-DmP3YUfp.js → registration-form-CRm6DaB9.js} +2 -2
  38. package/dist/_chunks/{reviews-panel-UzQQLb-z.js → reviews-panel-B7InBORU.js} +42 -41
  39. package/dist/_chunks/{rich-text-editor-BZTyxQBd.js → rich-text-editor-BfEu57dk.js} +3 -3
  40. package/dist/_chunks/{slot-grid-Bb13H9Rl.js → slot-grid-DrwynKeN.js} +91 -89
  41. package/dist/_chunks/{task-editor-BOETWbjU.js → task-editor-CI1SKUNc.js} +2 -2
  42. package/dist/_chunks/{use-appointment-details-read-CWN-nJCZ.js → use-appointment-details-read-BytPq3Ux.js} +2 -2
  43. package/dist/_chunks/{voice-control-panel-BziKE-KK.js → voice-control-panel-BP0otrID.js} +2 -2
  44. package/dist/_chunks/{workflow-webhook-action-DulCpCRz.js → workflow-webhook-action-B_nBJ_ht.js} +2 -2
  45. package/dist/agent-catalog.json +2 -2
  46. package/dist/agent-i18n/en.json +1 -1
  47. package/dist/components/_shared/maps-core-gate.d.ts +18 -0
  48. package/dist/components/address-autocomplete/index.js +1 -1
  49. package/dist/components/address-fields/index.js +1 -1
  50. package/dist/components/ai-permission-notice/index.js +1 -1
  51. package/dist/components/appointment-details-panel/index.js +1 -1
  52. package/dist/components/autocomplete/index.js +1 -1
  53. package/dist/components/booking/index.js +1 -1
  54. package/dist/components/checkbox/index.js +1 -1
  55. package/dist/components/checkbox-group/index.js +1 -1
  56. package/dist/components/city-input/index.js +1 -1
  57. package/dist/components/combobox/index.js +1 -1
  58. package/dist/components/country-select/index.js +1 -1
  59. package/dist/components/data-table/index.js +2 -2
  60. package/dist/components/data-table/xlsx-export.d.ts +13 -0
  61. package/dist/components/face-scheme/index.js +1 -1
  62. package/dist/components/file-manager/index.js +1 -1
  63. package/dist/components/header-settings/header-settings.d.ts +2 -1
  64. package/dist/components/header-settings/index.js +1 -1
  65. package/dist/components/heatmap/index.js +1 -1
  66. package/dist/components/map-view/index.js +1 -1
  67. package/dist/components/notes-panel/index.js +1 -1
  68. package/dist/components/patient-details/index.js +1 -1
  69. package/dist/components/patient-search/index.js +1 -1
  70. package/dist/components/patient-summary-card/index.js +1 -1
  71. package/dist/components/patient-table/index.js +1 -1
  72. package/dist/components/periodontal-diagnosis/index.js +1 -1
  73. package/dist/components/permission-matrix/index.js +1 -1
  74. package/dist/components/practice-results/index.js +1 -1
  75. package/dist/components/province-select/index.js +1 -1
  76. package/dist/components/reviews-panel/index.js +1 -1
  77. package/dist/components/rich-text-editor/index.js +1 -1
  78. package/dist/components/slot-grid/index.js +1 -1
  79. package/dist/components/task-editor/index.js +1 -1
  80. package/dist/components/voice-control-panel/index.js +1 -1
  81. package/dist/host-compat.css +1 -10
  82. package/dist/index.js +37 -37
  83. package/dist/patterns/anamnesis/anamnesis-export-download.d.ts +1 -1
  84. package/dist/patterns/anamnesis/anamnesis-export.d.ts +3 -1
  85. package/dist/patterns/anamnesis/index.js +1 -1
  86. package/dist/patterns/calendar/index.js +1 -1
  87. package/dist/patterns/login-form/index.js +1 -1
  88. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  89. package/dist/patterns/registration-form/index.js +1 -1
  90. package/dist/patterns/workflow-webhook-action/index.js +1 -1
  91. package/dist/tokens.css +1 -1
  92. package/package.json +4 -8
  93. package/dist/_chunks/address-autocomplete-bPR2mNBt.js +0 -498
  94. package/dist/_chunks/autocomplete-CnB1mHGc.js +0 -539
  95. package/dist/_chunks/exceljs.min-D2MHbJsF.js +0 -23046
  96. package/dist/_chunks/jspdf.es.min-Cal6Nuw_.js +0 -10007
  97. package/dist/_chunks/patient-search-CCOUZABE.js +0 -1196
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfadocs/ui-kit",
3
- "version": "1.90.0",
3
+ "version": "1.90.2",
4
4
  "type": "module",
5
5
  "description": "AlfaDocs shared design system — tokens, components, patterns, and translations for platform, booking, and alfascribe.",
6
6
  "license": "BUSL-1.1",
@@ -1192,11 +1192,6 @@
1192
1192
  "optional": true
1193
1193
  }
1194
1194
  },
1195
- "overrides": {
1196
- "exceljs": {
1197
- "uuid": "^11.1.1"
1198
- }
1199
- },
1200
1195
  "dependencies": {
1201
1196
  "@radix-ui/react-accordion": "^1.2.12",
1202
1197
  "@radix-ui/react-alert-dialog": "^1.1.15",
@@ -1230,7 +1225,8 @@
1230
1225
  "sonner": "^2.0.7",
1231
1226
  "tw-animate-css": "^1.4.0",
1232
1227
  "uqr": "^0.1.3",
1233
- "validator": "^13.15.35"
1228
+ "validator": "^13.15.35",
1229
+ "write-excel-file": "^4.1.1"
1234
1230
  },
1235
1231
  "devDependencies": {
1236
1232
  "@chromatic-com/storybook": "^5.3.1",
@@ -1284,7 +1280,7 @@
1284
1280
  "eslint-plugin-jsx-a11y": "^6.10.2",
1285
1281
  "eslint-plugin-react": "^7.37.5",
1286
1282
  "eslint-plugin-react-hooks": "^5.2.0",
1287
- "exceljs": "^4.4.0",
1283
+ "fflate": "^0.8.3",
1288
1284
  "globals": "^17.6.0",
1289
1285
  "i18next": "^26.0.4",
1290
1286
  "jsqr": "^1.4.0",
@@ -1,498 +0,0 @@
1
- import { jsx as l, jsxs as O } from "react/jsx-runtime";
2
- import { forwardRef as Re, useRef as P, useMemo as ae, useId as ke, useState as H, useCallback as L, useEffect as Ne } from "react";
3
- import { c as Q } from "./index-D2ZczOXr.js";
4
- import { useTranslation as ce } from "react-i18next";
5
- import { A as Pe, c as Ee } from "./index.modern-BeRXQVdc.js";
6
- import { u as Ve, a as Fe } from "./form-field-context-DtiROUJV.js";
7
- import { c as De } from "./compose-refs-C0k0tdqF.js";
8
- import { u as Se } from "./use-controllable-state-BiY4xTzM.js";
9
- import { b as Me } from "./menu-row-BAr8bx1I.js";
10
- import { u as Ue } from "./registry-DvAUVLHh.js";
11
- import { I as $e, a as X, b as J, c as Be } from "./input-surface-iBmxVBfr.js";
12
- import { u as je } from "./use-debounced-callback-BisrB-Fq.js";
13
- import { M as qe } from "./map-pin-BaY37-Km.js";
14
- const Ke = {
15
- id: "address-autocomplete",
16
- capabilities: ["select_single", "filter", "open", "close"],
17
- state: {
18
- value: {
19
- type: "string",
20
- descriptionKey: "ui.agent.addressAutocomplete.state.value",
21
- description: "Current free-text value of the address input.",
22
- read: (t) => t.getValue()
23
- },
24
- query: {
25
- type: "string",
26
- descriptionKey: "ui.agent.addressAutocomplete.state.query",
27
- description: "Current query driving the suggestion listbox.",
28
- read: (t) => t.getQuery()
29
- },
30
- isOpen: {
31
- type: "boolean",
32
- descriptionKey: "ui.agent.addressAutocomplete.state.isOpen",
33
- description: "True when the suggestion listbox is visible.",
34
- read: (t) => t.getIsOpen()
35
- }
36
- },
37
- actions: {
38
- set_value: {
39
- safety: "write",
40
- argsType: "{ value: string }",
41
- argsSchema: {
42
- type: "object",
43
- properties: {
44
- value: {
45
- type: "string",
46
- description: "Text to place in the input (also runs a fetch)."
47
- }
48
- },
49
- required: ["value"]
50
- },
51
- idempotent: !0,
52
- openWorld: !0,
53
- descriptionKey: "ui.agent.addressAutocomplete.actions.setValue",
54
- description: "Set the input text programmatically; opens and refreshes the suggestion list (issues an external address-lookup fetch).",
55
- examples: [
56
- { args: { value: "Via Roma 12" }, note: "Seed a partial address." }
57
- ],
58
- invoke: (t, n) => {
59
- t.setValue(n.value);
60
- }
61
- },
62
- apply_filter: {
63
- safety: "read",
64
- argsType: "{ query: string }",
65
- argsSchema: {
66
- type: "object",
67
- properties: {
68
- query: {
69
- type: "string",
70
- description: "Query text to filter the address suggestions."
71
- }
72
- },
73
- required: ["query"]
74
- },
75
- idempotent: !0,
76
- openWorld: !0,
77
- descriptionKey: "ui.agent.addressAutocomplete.actions.applyFilter",
78
- description: "Set the query text, which refreshes the suggestion list via an external address-lookup fetch.",
79
- invoke: (t, n) => {
80
- t.setQuery(n.query);
81
- }
82
- },
83
- clear: {
84
- safety: "write",
85
- idempotent: !0,
86
- descriptionKey: "ui.agent.addressAutocomplete.actions.clear",
87
- description: "Clear the typed text and dismiss the suggestion list.",
88
- invoke: (t) => {
89
- t.clear();
90
- }
91
- },
92
- open: {
93
- safety: "read",
94
- idempotent: !0,
95
- descriptionKey: "ui.agent.addressAutocomplete.actions.open",
96
- description: "Open the suggestion listbox.",
97
- invoke: (t) => {
98
- t.open();
99
- }
100
- },
101
- close: {
102
- safety: "read",
103
- idempotent: !0,
104
- descriptionKey: "ui.agent.addressAutocomplete.actions.close",
105
- description: "Close the suggestion listbox.",
106
- invoke: (t) => {
107
- t.close();
108
- }
109
- }
110
- },
111
- domHooks: {
112
- root: {
113
- attr: "data-component",
114
- value: "address-autocomplete",
115
- description: "Marks the AddressAutocomplete wrapper."
116
- },
117
- instanceId: {
118
- attr: "data-component-id",
119
- sourceProp: "id",
120
- description: "Sourced from the id prop. Required to address a specific field from the agent."
121
- }
122
- }
123
- };
124
- function U(t) {
125
- return t.longText ?? t.long_name ?? "";
126
- }
127
- function ie(t) {
128
- return t.shortText ?? t.short_name ?? U(t);
129
- }
130
- function C(t, n) {
131
- return t.find((p) => p.types.includes(n));
132
- }
133
- function de(t, n = "") {
134
- const p = C(t, "route"), m = C(t, "street_number"), s = C(t, "locality"), i = C(t, "postal_town"), g = C(t, "administrative_area_level_3"), E = C(t, "postal_code"), V = C(t, "administrative_area_level_2"), d = C(t, "country"), h = p ? U(p) : "", v = m ? U(m) : "", y = [h, v].filter(Boolean).join(" ").trim(), r = s ?? i ?? g, a = r ? U(r) : "", c = E ? U(E) : "", F = V ? ie(V).toUpperCase() : "", T = d ? ie(d).toLowerCase() : "";
135
- return {
136
- street: y,
137
- city: a,
138
- postcode: c,
139
- province: F,
140
- country: T,
141
- formatted: n
142
- };
143
- }
144
- const Oe = Q(
145
- ["ds:flex ds:w-full ds:items-center", Be].join(" "),
146
- {
147
- variants: {
148
- size: {
149
- sm: `${X.sm} ${J.sm}`,
150
- md: `${X.md} ${J.md}`,
151
- lg: `${X.lg} ${J.lg}`
152
- },
153
- tone: $e
154
- },
155
- defaultVariants: { size: "md", tone: "default" }
156
- }
157
- ), He = Q(
158
- [
159
- "ds:flex-1 ds:min-w-0 ds:ps-3 ds:pe-3 ds:bg-transparent ds:text-foreground",
160
- "ds:placeholder:text-muted-foreground",
161
- "ds:outline-none ds:focus:outline-none ds:focus-visible:outline-none",
162
- "ds:disabled:cursor-not-allowed ds:read-only:cursor-default"
163
- ].join(" ")
164
- ), Le = "ds:inline-flex ds:items-center ds:shrink-0 ds:ps-3 ds:text-muted-foreground ds:[&_svg]:size-4", Qe = Q(
165
- [
166
- "ds:absolute ds:z-[var(--z-dropdown)] ds:mt-[var(--spacing-2xs)] ds:w-full",
167
- "ds:overflow-auto ds:max-h-[18rem]",
168
- "ds:rounded-[var(--radius-sm)] ds:border ds:border-border ds:bg-background",
169
- "ds:shadow-[var(--shadow-md)] ds:p-[var(--spacing-xs)]"
170
- ].join(" ")
171
- ), ze = Q(
172
- [
173
- "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
174
- "ds:ps-3 ds:pe-3 ds:py-2 ds:rounded-[var(--radius-sm)]",
175
- "ds:cursor-pointer ds:select-none ds:text-foreground",
176
- "ds:text-start",
177
- // Hover moves the active row, so a separate hover tint would light two.
178
- Me.active
179
- ].join(" ")
180
- ), le = "ds:ps-3 ds:pe-3 ds:py-2 type-body-sm ds:text-muted-foreground";
181
- function Ge({
182
- forwardedRef: t,
183
- regionCodes: n,
184
- onSelect: p,
185
- ...m
186
- }) {
187
- const s = Ee("places"), i = P(null), g = !!(s && "AutocompleteSuggestion" in s && "Place" in s && "AutocompleteSessionToken" in s), E = L(
188
- async (d) => {
189
- if (!s || d.trim().length === 0) return [];
190
- if (g) {
191
- i.current || (i.current = new s.AutocompleteSessionToken());
192
- const { suggestions: r } = await s.AutocompleteSuggestion.fetchAutocompleteSuggestions({
193
- input: d,
194
- sessionToken: i.current,
195
- includedRegionCodes: n
196
- });
197
- return r.map((a) => {
198
- var F, T;
199
- const c = a.placePrediction;
200
- return c ? {
201
- placeId: c.placeId,
202
- primaryText: ((F = c.mainText) == null ? void 0 : F.text) ?? c.text.text,
203
- secondaryText: (T = c.secondaryText) == null ? void 0 : T.text
204
- } : null;
205
- }).filter((a) => a !== null);
206
- }
207
- const h = s.AutocompleteService;
208
- return h ? (await new h().getPlacePredictions({ input: d })).predictions.map((r) => {
209
- var a, c;
210
- return {
211
- placeId: r.place_id,
212
- primaryText: ((a = r.structured_formatting) == null ? void 0 : a.main_text) ?? r.description,
213
- secondaryText: (c = r.structured_formatting) == null ? void 0 : c.secondary_text
214
- };
215
- }) : [];
216
- },
217
- [s, g, n]
218
- ), V = L(
219
- async (d) => {
220
- if (d.address) return d.address;
221
- if (!s) return null;
222
- if (g) {
223
- const y = new s.Place({ id: d.placeId }), { place: r } = await y.fetchFields({
224
- fields: ["addressComponents", "formattedAddress"]
225
- });
226
- i.current = null;
227
- const a = r.addressComponents ?? [];
228
- return de(
229
- a,
230
- r.formattedAddress ?? ""
231
- );
232
- }
233
- const h = s.PlacesService;
234
- if (!h) return null;
235
- const v = new h(document.createElement("div"));
236
- return new Promise((y) => {
237
- v.getDetails(
238
- {
239
- placeId: d.placeId,
240
- fields: ["address_components", "formatted_address"]
241
- },
242
- (r) => {
243
- if (!r) {
244
- y(null);
245
- return;
246
- }
247
- const a = r.address_components ?? [];
248
- y(
249
- de(
250
- a,
251
- r.formatted_address ?? ""
252
- )
253
- );
254
- }
255
- );
256
- });
257
- },
258
- [s, g]
259
- );
260
- return /* @__PURE__ */ l(
261
- Y,
262
- {
263
- ...m,
264
- forwardedRef: t,
265
- getSuggestions: E,
266
- resolveSelection: V,
267
- onSelect: p
268
- }
269
- );
270
- }
271
- function Y({
272
- forwardedRef: t,
273
- value: n,
274
- defaultValue: p,
275
- onValueChange: m,
276
- onSelect: s,
277
- getSuggestions: i,
278
- resolveSelection: g,
279
- placeholder: E,
280
- debounceMs: V = 250,
281
- disabled: d,
282
- required: h,
283
- readOnly: v,
284
- name: y,
285
- id: r,
286
- size: a = "md",
287
- tone: c = "default",
288
- className: F,
289
- "aria-label": T
290
- }) {
291
- const { t: I } = ce("ui"), w = Ve(), z = P(null), ue = ae(
292
- () => De(t, z),
293
- [t]
294
- ), pe = ke(), $ = Fe(w, r) ?? pe, Z = `${$}-listbox`, fe = `${$}-live`, ee = (e) => `${$}-opt-${e}`, D = !!(w.disabled || d), me = !!(w.required || h), te = w.invalid, ge = te ? "error" : c, ve = w.describedBy || void 0, [he, R] = Se({
295
- value: n,
296
- defaultValue: p ?? "",
297
- onChange: m
298
- }), x = he ?? "", [k, f] = H(!1), [u, B] = H([]), [M, G] = H(!1), [_, b] = H(-1), j = P(!1), q = P(""), ye = E ?? I("inputs.addressAutocomplete.placeholder"), xe = L(
299
- (e) => {
300
- !i || D || v || j.current || (q.current = e, G(!0), Promise.resolve(i(e)).then((o) => {
301
- q.current === e && (B(o), b(-1), G(!1));
302
- }).catch(() => {
303
- q.current === e && (B([]), G(!1));
304
- }));
305
- },
306
- [i, D, v]
307
- ), A = je(xe, V);
308
- Ne(() => () => A.cancel(), [A]);
309
- const be = (e) => {
310
- R(e), !(D || v) && (k || f(!0), !j.current && A(e));
311
- }, se = L(
312
- (e) => {
313
- var o;
314
- R(e.primaryText), f(!1), b(-1), B([]), q.current = e.primaryText, g ? Promise.resolve(g(e)).then((N) => {
315
- N && (s == null || s(N));
316
- }).catch(() => {
317
- }) : e.address && (s == null || s(e.address)), (o = z.current) == null || o.focus();
318
- },
319
- [R, g, s, z]
320
- ), re = k && !M && x.trim().length > 0 && u.length === 0 && !!i, K = u.length > 0, S = k && (K || re || M), Ae = (e) => {
321
- if (!e.nativeEvent.isComposing) {
322
- if (e.key === "ArrowDown") {
323
- if (e.preventDefault(), !k) {
324
- f(!0), x && A(x);
325
- return;
326
- }
327
- if (u.length === 0) return;
328
- b((o) => (o + 1) % u.length);
329
- return;
330
- }
331
- if (e.key === "ArrowUp") {
332
- if (e.preventDefault(), u.length === 0) return;
333
- b(
334
- (o) => o <= 0 ? u.length - 1 : o - 1
335
- );
336
- return;
337
- }
338
- if (e.key === "Enter") {
339
- S && (e.preventDefault(), _ >= 0 && u[_] && se(u[_]));
340
- return;
341
- }
342
- e.key === "Escape" && k && (e.preventDefault(), f(!1), b(-1));
343
- }
344
- }, Te = () => {
345
- D || v || x && (f(!0), A(x));
346
- }, we = (e) => {
347
- var N;
348
- const o = e.relatedTarget;
349
- o && ((N = oe.current) != null && N.contains(o)) || (f(!1), b(-1));
350
- }, oe = P(null), _e = k && _ >= 0 && u[_] ? ee(u[_].placeId) : void 0, W = P(x);
351
- W.current = x;
352
- const ne = P(S);
353
- ne.current = S;
354
- const Ce = ae(
355
- () => ({
356
- getValue: () => W.current,
357
- getQuery: () => W.current,
358
- getIsOpen: () => ne.current,
359
- setValue: (e) => {
360
- R(e), f(!0), A(e);
361
- },
362
- setQuery: (e) => {
363
- R(e), f(!0), A(e);
364
- },
365
- clear: () => {
366
- R(""), f(!1), b(-1), B([]);
367
- },
368
- open: () => f(!0),
369
- close: () => {
370
- f(!1), b(-1);
371
- }
372
- }),
373
- [R, A]
374
- );
375
- Ue(Ke, Ce, r);
376
- const Ie = M ? I("inputs.addressAutocomplete.loading") : k && x.trim().length > 0 ? I("inputs.addressAutocomplete.results", { count: u.length }) : "";
377
- return /* @__PURE__ */ O(
378
- "div",
379
- {
380
- className: "ds:relative ds:w-full",
381
- "data-component": "address-autocomplete",
382
- "data-component-id": r,
383
- children: [
384
- /* @__PURE__ */ O(
385
- "div",
386
- {
387
- className: Oe({ size: a, tone: ge, className: F }),
388
- "data-disabled": D || void 0,
389
- children: [
390
- /* @__PURE__ */ l("span", { "aria-hidden": "true", className: Le, children: /* @__PURE__ */ l(qe, {}) }),
391
- /* @__PURE__ */ l(
392
- "input",
393
- {
394
- ref: ue,
395
- id: $,
396
- name: y,
397
- type: "text",
398
- autoComplete: "off",
399
- role: "combobox",
400
- "aria-autocomplete": "list",
401
- "aria-expanded": S,
402
- "aria-controls": S ? Z : void 0,
403
- "aria-activedescendant": _e,
404
- "aria-describedby": ve,
405
- "aria-invalid": te || void 0,
406
- "aria-label": T ?? (w.label ? void 0 : I("inputs.addressAutocomplete.ariaLabel")),
407
- "aria-labelledby": !T && w.label ? `${w.id}-label` : void 0,
408
- placeholder: ye,
409
- value: x,
410
- disabled: D,
411
- required: me,
412
- readOnly: v,
413
- onChange: (e) => be(e.target.value),
414
- onKeyDown: Ae,
415
- onFocus: Te,
416
- onBlur: we,
417
- onCompositionStart: () => {
418
- j.current = !0;
419
- },
420
- onCompositionEnd: (e) => {
421
- j.current = !1, A(e.currentTarget.value);
422
- },
423
- className: He()
424
- }
425
- )
426
- ]
427
- }
428
- ),
429
- S ? /* @__PURE__ */ O(
430
- "ul",
431
- {
432
- ref: oe,
433
- id: Z,
434
- role: "listbox",
435
- "aria-label": T ?? I("inputs.addressAutocomplete.listLabel"),
436
- className: Qe(),
437
- children: [
438
- K ? u.map((e, o) => /* @__PURE__ */ O(
439
- "li",
440
- {
441
- id: ee(e.placeId),
442
- role: "option",
443
- "aria-selected": o === _,
444
- "data-active": o === _ || void 0,
445
- onMouseDown: (N) => {
446
- N.preventDefault(), se(e);
447
- },
448
- onMouseEnter: () => b(o),
449
- className: ze(),
450
- children: [
451
- /* @__PURE__ */ l("span", { className: "ds:truncate", children: e.primaryText }),
452
- e.secondaryText ? /* @__PURE__ */ l("span", { className: "type-meta ds:text-muted-foreground ds:truncate", children: e.secondaryText }) : null
453
- ]
454
- },
455
- e.placeId
456
- )) : null,
457
- !K && M ? /* @__PURE__ */ l("li", { role: "presentation", className: le, children: I("inputs.addressAutocomplete.loading") }) : null,
458
- !K && !M && re ? /* @__PURE__ */ l("li", { role: "presentation", className: le, children: I("inputs.addressAutocomplete.noResults") }) : null
459
- ]
460
- }
461
- ) : null,
462
- /* @__PURE__ */ l(
463
- "span",
464
- {
465
- id: fe,
466
- role: "status",
467
- "aria-live": "polite",
468
- "aria-atomic": "true",
469
- className: "ds:sr-only",
470
- children: Ie
471
- }
472
- )
473
- ]
474
- }
475
- );
476
- }
477
- const We = Re(function({ apiKey: n, getSuggestions: p, ...m }, s) {
478
- const { i18n: i } = ce("ui");
479
- return p ? /* @__PURE__ */ l(
480
- Y,
481
- {
482
- ...m,
483
- forwardedRef: s,
484
- getSuggestions: p,
485
- resolveSelection: Xe
486
- }
487
- ) : n ? /* @__PURE__ */ l(Pe, { apiKey: n, language: i.language, children: /* @__PURE__ */ l(Ge, { ...m, forwardedRef: s }) }) : /* @__PURE__ */ l(Y, { ...m, forwardedRef: s });
488
- });
489
- We.displayName = "AddressAutocomplete";
490
- async function Xe(t) {
491
- return t.address ?? null;
492
- }
493
- export {
494
- We as A,
495
- Ke as a,
496
- de as p
497
- };
498
- //# sourceMappingURL=address-autocomplete-bPR2mNBt.js.map