@alfadocs/ui-kit-debug 0.63.0 → 0.64.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 (146) hide show
  1. package/dist/_chunks/{ai-prompt-input-C6sCr1Vi.js → ai-prompt-input-Dx8eXoPm.js} +2 -2
  2. package/dist/_chunks/{ai-prompt-input-C6sCr1Vi.js.map → ai-prompt-input-Dx8eXoPm.js.map} +1 -1
  3. package/dist/_chunks/{audio-recorder-D6OVfNiZ.js → audio-recorder-CdXuT9ln.js} +2 -2
  4. package/dist/_chunks/{audio-recorder-D6OVfNiZ.js.map → audio-recorder-CdXuT9ln.js.map} +1 -1
  5. package/dist/_chunks/{bishop-score-B9tvgoIq.js → bishop-score-CzjSx-dm.js} +2 -2
  6. package/dist/_chunks/{bishop-score-B9tvgoIq.js.map → bishop-score-CzjSx-dm.js.map} +1 -1
  7. package/dist/_chunks/{booking-BUV9fspj.js → booking-ChfvWy3P.js} +2 -2
  8. package/dist/_chunks/{booking-BUV9fspj.js.map → booking-ChfvWy3P.js.map} +1 -1
  9. package/dist/_chunks/{care-plan-card-QmNpGggC.js → care-plan-card-DhZNoXs4.js} +2 -2
  10. package/dist/_chunks/{care-plan-card-QmNpGggC.js.map → care-plan-card-DhZNoXs4.js.map} +1 -1
  11. package/dist/_chunks/{care-plan-entry-card-Cnra7vUc.js → care-plan-entry-card-DW70yBOD.js} +2 -2
  12. package/dist/_chunks/{care-plan-entry-card-Cnra7vUc.js.map → care-plan-entry-card-DW70yBOD.js.map} +1 -1
  13. package/dist/_chunks/{editable-currency-cell-renderer-D5C5tCfu.js → editable-currency-cell-renderer-BQgaKFCz.js} +2 -2
  14. package/dist/_chunks/{editable-currency-cell-renderer-D5C5tCfu.js.map → editable-currency-cell-renderer-BQgaKFCz.js.map} +1 -1
  15. package/dist/_chunks/{gestational-age-calculator-AkNFfZYs.js → gestational-age-calculator-D85E8lGN.js} +2 -2
  16. package/dist/_chunks/{gestational-age-calculator-AkNFfZYs.js.map → gestational-age-calculator-D85E8lGN.js.map} +1 -1
  17. package/dist/_chunks/{pregnancy-dating-Dg6dTe1p.js → pregnancy-dating-7NUaAfob.js} +2 -2
  18. package/dist/_chunks/{pregnancy-dating-Dg6dTe1p.js.map → pregnancy-dating-7NUaAfob.js.map} +1 -1
  19. package/dist/_chunks/{select-hsCaJSX3.js → select-CEtRcon5.js} +46 -45
  20. package/dist/_chunks/select-CEtRcon5.js.map +1 -0
  21. package/dist/_chunks/{tabs-BpPYVme_.js → tabs-BIQ0ew1T.js} +2 -2
  22. package/dist/_chunks/{tabs-BpPYVme_.js.map → tabs-BIQ0ew1T.js.map} +1 -1
  23. package/dist/_chunks/tooth-scheme-CiphQaON.js +1257 -0
  24. package/dist/_chunks/tooth-scheme-CiphQaON.js.map +1 -0
  25. package/dist/_chunks/{unit-converter-3sINXO3m.js → unit-converter-BIbXHIQA.js} +2 -2
  26. package/dist/_chunks/{unit-converter-3sINXO3m.js.map → unit-converter-BIbXHIQA.js.map} +1 -1
  27. package/dist/agent-catalog.json +41 -4
  28. package/dist/components/ai-prompt-input/index.js +1 -1
  29. package/dist/components/audio-recorder/index.js +1 -1
  30. package/dist/components/bishop-score/index.js +1 -1
  31. package/dist/components/booking/index.js +1 -1
  32. package/dist/components/care-plan-card/index.js +1 -1
  33. package/dist/components/care-plan-entry-card/index.js +1 -1
  34. package/dist/components/data-table/index.js +1 -1
  35. package/dist/components/gestational-age-calculator/index.js +1 -1
  36. package/dist/components/pregnancy-dating/index.js +1 -1
  37. package/dist/components/select/index.js +1 -1
  38. package/dist/components/select/select.d.ts +8 -0
  39. package/dist/components/select/select.d.ts.map +1 -1
  40. package/dist/components/tabs/index.js +1 -1
  41. package/dist/components/tooth-scheme/index.d.ts +2 -2
  42. package/dist/components/tooth-scheme/index.d.ts.map +1 -1
  43. package/dist/components/tooth-scheme/index.js +22 -15
  44. package/dist/components/tooth-scheme/tooth-data.d.ts +79 -18
  45. package/dist/components/tooth-scheme/tooth-data.d.ts.map +1 -1
  46. package/dist/components/tooth-scheme/tooth-scheme.agent.d.ts +2 -0
  47. package/dist/components/tooth-scheme/tooth-scheme.agent.d.ts.map +1 -1
  48. package/dist/components/tooth-scheme/tooth-scheme.d.ts +48 -1
  49. package/dist/components/tooth-scheme/tooth-scheme.d.ts.map +1 -1
  50. package/dist/components/unit-converter/index.js +1 -1
  51. package/dist/i18n/locales/ar.d.ts +17 -0
  52. package/dist/i18n/locales/ar.d.ts.map +1 -1
  53. package/dist/i18n/locales/ar.js +18 -1
  54. package/dist/i18n/locales/ar.js.map +1 -1
  55. package/dist/i18n/locales/de.d.ts +17 -0
  56. package/dist/i18n/locales/de.d.ts.map +1 -1
  57. package/dist/i18n/locales/de.js +18 -1
  58. package/dist/i18n/locales/de.js.map +1 -1
  59. package/dist/i18n/locales/el.d.ts +17 -0
  60. package/dist/i18n/locales/el.d.ts.map +1 -1
  61. package/dist/i18n/locales/el.js +18 -1
  62. package/dist/i18n/locales/el.js.map +1 -1
  63. package/dist/i18n/locales/en.d.ts +17 -0
  64. package/dist/i18n/locales/en.d.ts.map +1 -1
  65. package/dist/i18n/locales/en.js +18 -1
  66. package/dist/i18n/locales/en.js.map +1 -1
  67. package/dist/i18n/locales/es.d.ts +17 -0
  68. package/dist/i18n/locales/es.d.ts.map +1 -1
  69. package/dist/i18n/locales/es.js +18 -1
  70. package/dist/i18n/locales/es.js.map +1 -1
  71. package/dist/i18n/locales/fr.d.ts +17 -0
  72. package/dist/i18n/locales/fr.d.ts.map +1 -1
  73. package/dist/i18n/locales/fr.js +18 -1
  74. package/dist/i18n/locales/fr.js.map +1 -1
  75. package/dist/i18n/locales/hi.d.ts +17 -0
  76. package/dist/i18n/locales/hi.d.ts.map +1 -1
  77. package/dist/i18n/locales/hi.js +18 -1
  78. package/dist/i18n/locales/hi.js.map +1 -1
  79. package/dist/i18n/locales/it.d.ts +17 -0
  80. package/dist/i18n/locales/it.d.ts.map +1 -1
  81. package/dist/i18n/locales/it.js +18 -1
  82. package/dist/i18n/locales/it.js.map +1 -1
  83. package/dist/i18n/locales/ja.d.ts +17 -0
  84. package/dist/i18n/locales/ja.d.ts.map +1 -1
  85. package/dist/i18n/locales/ja.js +18 -1
  86. package/dist/i18n/locales/ja.js.map +1 -1
  87. package/dist/i18n/locales/nl.d.ts +17 -0
  88. package/dist/i18n/locales/nl.d.ts.map +1 -1
  89. package/dist/i18n/locales/nl.js +18 -1
  90. package/dist/i18n/locales/nl.js.map +1 -1
  91. package/dist/i18n/locales/pl.d.ts +17 -0
  92. package/dist/i18n/locales/pl.d.ts.map +1 -1
  93. package/dist/i18n/locales/pl.js +18 -1
  94. package/dist/i18n/locales/pl.js.map +1 -1
  95. package/dist/i18n/locales/pt.d.ts +17 -0
  96. package/dist/i18n/locales/pt.d.ts.map +1 -1
  97. package/dist/i18n/locales/pt.js +18 -1
  98. package/dist/i18n/locales/pt.js.map +1 -1
  99. package/dist/i18n/locales/ro.d.ts +17 -0
  100. package/dist/i18n/locales/ro.d.ts.map +1 -1
  101. package/dist/i18n/locales/ro.js +18 -1
  102. package/dist/i18n/locales/ro.js.map +1 -1
  103. package/dist/i18n/locales/ru.d.ts +17 -0
  104. package/dist/i18n/locales/ru.d.ts.map +1 -1
  105. package/dist/i18n/locales/ru.js +18 -1
  106. package/dist/i18n/locales/ru.js.map +1 -1
  107. package/dist/i18n/locales/sq.d.ts +17 -0
  108. package/dist/i18n/locales/sq.d.ts.map +1 -1
  109. package/dist/i18n/locales/sq.js +18 -1
  110. package/dist/i18n/locales/sq.js.map +1 -1
  111. package/dist/i18n/locales/sv.d.ts +17 -0
  112. package/dist/i18n/locales/sv.d.ts.map +1 -1
  113. package/dist/i18n/locales/sv.js +18 -1
  114. package/dist/i18n/locales/sv.js.map +1 -1
  115. package/dist/i18n/locales/tr.d.ts +17 -0
  116. package/dist/i18n/locales/tr.d.ts.map +1 -1
  117. package/dist/i18n/locales/tr.js +18 -1
  118. package/dist/i18n/locales/tr.js.map +1 -1
  119. package/dist/i18n/locales/zh.d.ts +17 -0
  120. package/dist/i18n/locales/zh.d.ts.map +1 -1
  121. package/dist/i18n/locales/zh.js +18 -1
  122. package/dist/i18n/locales/zh.js.map +1 -1
  123. package/dist/index.js +180 -173
  124. package/dist/locales/ar.json +18 -1
  125. package/dist/locales/de.json +18 -1
  126. package/dist/locales/el.json +18 -1
  127. package/dist/locales/en.json +18 -1
  128. package/dist/locales/es.json +18 -1
  129. package/dist/locales/fr.json +18 -1
  130. package/dist/locales/hi.json +18 -1
  131. package/dist/locales/it.json +18 -1
  132. package/dist/locales/ja.json +18 -1
  133. package/dist/locales/nl.json +18 -1
  134. package/dist/locales/pl.json +18 -1
  135. package/dist/locales/pt.json +18 -1
  136. package/dist/locales/ro.json +18 -1
  137. package/dist/locales/ru.json +18 -1
  138. package/dist/locales/sq.json +18 -1
  139. package/dist/locales/sv.json +18 -1
  140. package/dist/locales/tr.json +18 -1
  141. package/dist/locales/zh.json +18 -1
  142. package/dist/tokens.css +1 -1
  143. package/package.json +1 -1
  144. package/dist/_chunks/select-hsCaJSX3.js.map +0 -1
  145. package/dist/_chunks/tooth-scheme-CxlsLjfN.js +0 -753
  146. package/dist/_chunks/tooth-scheme-CxlsLjfN.js.map +0 -1
@@ -1,753 +0,0 @@
1
- import { jsx as i, jsxs as S } from "react/jsx-runtime";
2
- import { forwardRef as xt, useId as wt, useMemo as U, useState as K, useEffect as rt, useRef as at, useCallback as H, useImperativeHandle as yt } from "react";
3
- import * as D from "@radix-ui/react-tooltip";
4
- import { c as M } from "./index-D2ZczOXr.js";
5
- import { useTranslation as lt } from "react-i18next";
6
- import { u as bt } from "./registry-nPAVE19X.js";
7
- const Ct = {
8
- id: "tooth-scheme",
9
- capabilities: ["pick"],
10
- state: {
11
- chart: {
12
- type: "object",
13
- description: "Current dental chart state — tooth conditions keyed by FDI id.",
14
- read: (n) => n.getChart()
15
- }
16
- },
17
- actions: {
18
- focus_tooth: {
19
- safety: "read",
20
- argsType: "{ id: FdiId }",
21
- description: "Move focus to a specific tooth by FDI id.",
22
- invoke: (n, e) => {
23
- n.focusTooth(e.id);
24
- }
25
- }
26
- },
27
- domHooks: {
28
- root: { attr: "data-component", value: "tooth-scheme" },
29
- instanceId: {
30
- attr: "data-component-id",
31
- sourceProp: "id",
32
- description: "Sourced from the id prop."
33
- },
34
- item: {
35
- attr: "data-fdi",
36
- description: 'Each rendered tooth `<g>` carries its FDI id as `data-fdi`. Tests still use `data-testid="tooth-<fdi>"` separately.'
37
- }
38
- }
39
- }, J = [
40
- // upper
41
- "18",
42
- "17",
43
- "16",
44
- "15",
45
- "14",
46
- "13",
47
- "12",
48
- "11",
49
- "21",
50
- "22",
51
- "23",
52
- "24",
53
- "25",
54
- "26",
55
- "27",
56
- "28",
57
- // lower
58
- "48",
59
- "47",
60
- "46",
61
- "45",
62
- "44",
63
- "43",
64
- "42",
65
- "41",
66
- "31",
67
- "32",
68
- "33",
69
- "34",
70
- "35",
71
- "36",
72
- "37",
73
- "38"
74
- ], Y = [
75
- // upper
76
- "55",
77
- "54",
78
- "53",
79
- "52",
80
- "51",
81
- "61",
82
- "62",
83
- "63",
84
- "64",
85
- "65",
86
- // lower
87
- "85",
88
- "84",
89
- "83",
90
- "82",
91
- "81",
92
- "71",
93
- "72",
94
- "73",
95
- "74",
96
- "75"
97
- ];
98
- function Tt(n) {
99
- return n <= 2 ? "incisor" : n === 3 ? "canine" : n <= 5 ? "premolar" : "molar";
100
- }
101
- function kt(n) {
102
- return n <= 2 ? "incisor" : n === 3 ? "canine" : "molar";
103
- }
104
- function Lt(n, e) {
105
- const r = (n - 1) % 4 + 1;
106
- return `${r === 1 ? "UR" : r === 2 ? "UL" : r === 3 ? "LL" : "LR"}${e}`;
107
- }
108
- function Ot(n, e) {
109
- switch (n) {
110
- case 1:
111
- return String(1 + (8 - e));
112
- case 2:
113
- return String(8 + e);
114
- case 3:
115
- return String(17 + (8 - e));
116
- case 4:
117
- return String(24 + e);
118
- default:
119
- return "";
120
- }
121
- }
122
- function It(n, e) {
123
- const r = "ABCDEFGHIJKLMNOPQRST";
124
- let a = -1;
125
- switch (n) {
126
- case 5:
127
- a = 0 + (5 - e);
128
- break;
129
- case 6:
130
- a = 5 + (e - 1);
131
- break;
132
- case 7:
133
- a = 10 + (5 - e);
134
- break;
135
- case 8:
136
- a = 15 + (e - 1);
137
- break;
138
- default:
139
- a = -1;
140
- }
141
- return a >= 0 ? r[a] : "";
142
- }
143
- function St(n) {
144
- const e = Number(n[0]), r = Number(n[1]), a = e >= 5, h = a ? kt(r) : Tt(r), N = e === 1 || e === 2 || e === 5 || e === 6 ? "upper" : "lower", w = e === 1 || e === 4 || e === 5 || e === 8 ? "right" : "left", u = a ? It(e, r) : Ot(e, r), v = Lt(e, r);
145
- return {
146
- fdi: n,
147
- universal: u,
148
- palmer: v,
149
- quadrant: e,
150
- positionInQuadrant: r,
151
- anatomy: h,
152
- arch: N,
153
- side: w,
154
- dentition: a ? "primary" : "permanent"
155
- };
156
- }
157
- const b = [
158
- ...J,
159
- ...Y
160
- ].reduce((n, e) => (n[e] = St(e), n), {}), $t = Object.fromEntries(
161
- Object.entries(b).map(([n, e]) => [n, e.universal])
162
- ), Mt = Object.fromEntries(
163
- Object.entries(b).map(([n, e]) => [n, e.palmer])
164
- ), Nt = {
165
- caries: "--destructive",
166
- filled: "--info",
167
- crowned: "--warning",
168
- missing: "--muted-foreground",
169
- implant: "--accent",
170
- rootCanal: "--primary"
171
- }, $ = {
172
- caries: "var(--destructive)",
173
- filled: "var(--info)",
174
- crowned: "var(--warning)",
175
- missing: "var(--muted-foreground)",
176
- implant: "var(--accent)",
177
- rootCanal: "var(--primary)"
178
- }, P = {
179
- caries: "tooth-scheme-pattern-diagonal",
180
- filled: "tooth-scheme-pattern-dots",
181
- crowned: "tooth-scheme-pattern-crosshatch",
182
- missing: "tooth-scheme-pattern-blank",
183
- implant: "tooth-scheme-pattern-vertical",
184
- rootCanal: "tooth-scheme-pattern-horizontal"
185
- }, Q = {
186
- incisor: {
187
- width: 22,
188
- height: 50,
189
- // Narrow rounded rectangle — slightly wider at the occlusal/biting edge.
190
- path: "M4 4 C4 2 6 0 8 0 L14 0 C16 0 18 2 18 4 L20 44 C20 47 18 50 14 50 L8 50 C4 50 2 47 2 44 Z"
191
- },
192
- canine: {
193
- width: 26,
194
- height: 50,
195
- // Pointed cusp at the bottom — canines present a single prominent cusp.
196
- path: "M4 4 C4 2 6 0 8 0 L18 0 C20 0 22 2 22 4 L24 40 L13 50 L2 40 Z"
197
- },
198
- premolar: {
199
- width: 28,
200
- height: 50,
201
- // Wider rounded rectangle with a subtle horizontal notch hinting at two cusps.
202
- path: "M4 4 C4 2 6 0 8 0 L20 0 C22 0 24 2 24 4 L26 44 C26 47 24 50 20 50 L8 50 C4 50 2 47 2 44 Z",
203
- innerPath: "M6 34 L22 34"
204
- },
205
- molar: {
206
- width: 32,
207
- height: 50,
208
- // Widest rounded rectangle with a cross-notch hinting at the occlusal fissure pattern.
209
- path: "M4 4 C4 2 6 0 8 0 L24 0 C26 0 28 2 28 4 L30 44 C30 47 28 50 24 50 L8 50 C4 50 2 47 2 44 Z",
210
- innerPath: "M6 32 L26 32 M16 22 L16 42"
211
- }
212
- }, _ = 4, st = 24, O = 4;
213
- function Rt(n) {
214
- const e = n === "primary" ? Y : n === "mixed" ? [...J, ...Y] : J, r = [], a = [];
215
- for (const o of e)
216
- b[o].arch === "upper" ? r.push(o) : a.push(o);
217
- const h = 50, N = Math.max(r.length, a.length);
218
- function w(o, p) {
219
- const E = o.reduce((g, y) => {
220
- const x = Q[b[y].anatomy];
221
- return g + x.width + _;
222
- }, 0), z = o.length > 0 ? E - _ : 0;
223
- let C = ((function() {
224
- return (r.length >= a.length ? r : a).reduce((T, B) => {
225
- const R = Q[b[B].anatomy];
226
- return T + R.width + _;
227
- }, 0) - _;
228
- })() - z) / 2;
229
- return o.map((g) => {
230
- const y = b[g], x = Q[y.anatomy], T = {
231
- fdi: g,
232
- meta: y,
233
- shape: x,
234
- x: C,
235
- y: p
236
- };
237
- return C += x.width + _, T;
238
- });
239
- }
240
- const u = w(r, 0), v = w(a, h + st), j = Math.max(
241
- u.reduce((o, p) => Math.max(o, p.x + p.shape.width), 0),
242
- v.reduce((o, p) => Math.max(o, p.x + p.shape.width), 0)
243
- ), F = j > 0 ? j : N * 30, q = h * 2 + st;
244
- return { teeth: [...u, ...v], width: F, height: q };
245
- }
246
- function it(n, e) {
247
- switch (e) {
248
- case "universal":
249
- return $t[n] ?? n;
250
- case "palmer":
251
- return Mt[n] ?? n;
252
- case "fdi":
253
- default:
254
- return n;
255
- }
256
- }
257
- function Qt() {
258
- return {};
259
- }
260
- function ot(n) {
261
- const e = {};
262
- for (const [r, a] of Object.entries(n))
263
- !a || a.length === 0 || (e[r] = { conditions: a, surfaces: [] });
264
- return e;
265
- }
266
- const At = M(
267
- [
268
- "ds:tooth-scheme-alfadocs",
269
- "ds:inline-flex ds:flex-col",
270
- "ds:gap-[var(--spacing-sm)]",
271
- "ds:bg-[var(--background)] ds:text-[var(--foreground)]"
272
- ].join(" ")
273
- ), Dt = M(
274
- ["ds:block ds:max-w-full ds:h-auto", "ds:text-[var(--foreground)]"].join(" ")
275
- ), Pt = M(
276
- [
277
- "ds:group ds:cursor-pointer",
278
- "ds:focus:outline-none",
279
- "ds:transition-[fill,stroke,opacity] ds:duration-[var(--animation-duration)]",
280
- "ds:motion-reduce:transition-none"
281
- ].join(" ")
282
- ), Et = M(
283
- [
284
- "ds:flex ds:flex-wrap ds:items-center",
285
- "ds:gap-[var(--spacing-sm)]",
286
- "type-meta ds:text-[var(--muted-foreground)]"
287
- ].join(" ")
288
- ), _t = M(
289
- ["ds:inline-flex ds:items-center", "ds:gap-[var(--spacing-xs)]"].join(" ")
290
- ), jt = M(
291
- [
292
- "ds:inline-block",
293
- "ds:inline-size-[0.75rem] ds:block-size-[0.75rem]",
294
- "ds:rounded-[var(--radius-xs)]",
295
- "ds:border ds:border-[color:var(--border)]"
296
- ].join(" ")
297
- ), Wt = M(["ds:sr-only"].join(" "));
298
- function X(n) {
299
- return n.value !== void 0;
300
- }
301
- function ct() {
302
- return { conditions: [], surfaces: [] };
303
- }
304
- function dt(n) {
305
- return !n || n.length === 0 ? ["caries"] : [];
306
- }
307
- function Ut(n) {
308
- return n.replace(/[^a-zA-Z0-9-_]/g, "");
309
- }
310
- function Ht({ idPrefix: n }) {
311
- const e = (r) => `${n}-${r}`;
312
- return /* @__PURE__ */ S("defs", { children: [
313
- /* @__PURE__ */ i(
314
- "pattern",
315
- {
316
- id: e(P.caries),
317
- patternUnits: "userSpaceOnUse",
318
- width: "6",
319
- height: "6",
320
- patternTransform: "rotate(45)",
321
- children: /* @__PURE__ */ i(
322
- "line",
323
- {
324
- x1: "0",
325
- y1: "0",
326
- x2: "0",
327
- y2: "6",
328
- stroke: $.caries,
329
- strokeWidth: "2"
330
- }
331
- )
332
- }
333
- ),
334
- /* @__PURE__ */ i(
335
- "pattern",
336
- {
337
- id: e(P.filled),
338
- patternUnits: "userSpaceOnUse",
339
- width: "5",
340
- height: "5",
341
- children: /* @__PURE__ */ i("circle", { cx: "2.5", cy: "2.5", r: "1", fill: $.filled })
342
- }
343
- ),
344
- /* @__PURE__ */ i(
345
- "pattern",
346
- {
347
- id: e(P.crowned),
348
- patternUnits: "userSpaceOnUse",
349
- width: "6",
350
- height: "6",
351
- children: /* @__PURE__ */ i(
352
- "path",
353
- {
354
- d: "M0 0 L6 6 M6 0 L0 6",
355
- stroke: $.crowned,
356
- strokeWidth: "1"
357
- }
358
- )
359
- }
360
- ),
361
- /* @__PURE__ */ i(
362
- "pattern",
363
- {
364
- id: e(P.implant),
365
- patternUnits: "userSpaceOnUse",
366
- width: "4",
367
- height: "4",
368
- children: /* @__PURE__ */ i(
369
- "line",
370
- {
371
- x1: "1",
372
- y1: "0",
373
- x2: "1",
374
- y2: "4",
375
- stroke: $.implant,
376
- strokeWidth: "1"
377
- }
378
- )
379
- }
380
- ),
381
- /* @__PURE__ */ i(
382
- "pattern",
383
- {
384
- id: e(P.rootCanal),
385
- patternUnits: "userSpaceOnUse",
386
- width: "4",
387
- height: "4",
388
- children: /* @__PURE__ */ i(
389
- "line",
390
- {
391
- x1: "0",
392
- y1: "1",
393
- x2: "4",
394
- y2: "1",
395
- stroke: $.rootCanal,
396
- strokeWidth: "1"
397
- }
398
- )
399
- }
400
- )
401
- ] });
402
- }
403
- const Ft = [
404
- "caries",
405
- "filled",
406
- "crowned",
407
- "missing",
408
- "implant",
409
- "rootCanal"
410
- ];
411
- function qt({ idPrefix: n }) {
412
- const { t: e } = lt();
413
- return /* @__PURE__ */ i(
414
- "ul",
415
- {
416
- className: Et(),
417
- "data-testid": "tooth-scheme-legend",
418
- "aria-label": e("toothScheme.legendLabel"),
419
- children: Ft.map((r) => /* @__PURE__ */ S("li", { className: _t(), children: [
420
- /* @__PURE__ */ i(
421
- "span",
422
- {
423
- className: jt(),
424
- "aria-hidden": "true",
425
- "data-condition": r,
426
- "data-token": Nt[r],
427
- "data-testid": `tooth-scheme-legend-swatch-${r}`
428
- }
429
- ),
430
- /* @__PURE__ */ i("span", { children: e(`toothScheme.condition.${r}`) })
431
- ] }, r))
432
- }
433
- );
434
- }
435
- const zt = xt(
436
- ({
437
- id: n,
438
- dentition: e = "permanent",
439
- numbering: r = "fdi",
440
- mode: a = "interactive",
441
- value: h,
442
- defaultValue: N,
443
- onChange: w,
444
- onSelect: u,
445
- conditions: v,
446
- ariaLabel: j,
447
- className: F
448
- }, q) => {
449
- const { t: o } = lt(), p = wt(), E = U(() => `ts-${Ut(p)}`, [p]), [z, V] = K(() => h !== void 0 ? h : N !== void 0 ? N : v ? ot(v) : {}), f = X({ value: h }) ? h : z;
450
- rt(() => {
451
- X({ value: h }) || v !== void 0 && V(ot(v));
452
- }, [v, h]);
453
- const C = U(() => Rt(e), [e]), g = U(() => C.teeth.map((t) => t.fdi), [C]), y = g[0], [x, T] = K(y);
454
- rt(() => {
455
- (!x || !g.includes(x)) && T(y);
456
- }, [y, x, g]);
457
- const [B, R] = K(""), tt = at(null), W = H(
458
- (t) => {
459
- X({ value: h }) || V(t), w == null || w(t);
460
- },
461
- [w, h]
462
- ), k = H((t) => {
463
- const c = tt.current;
464
- if (!c) return;
465
- const s = c.querySelector(`g[data-fdi="${t}"]`);
466
- s && (s.focus(), T(t));
467
- }, []), ht = at(null), Z = U(
468
- () => ({
469
- focusTooth: (t) => {
470
- k(t);
471
- },
472
- getChart: () => f
473
- }),
474
- [f, k]
475
- );
476
- yt(q, () => Z, [Z]), bt(Ct, Z, n);
477
- const ut = H(
478
- (t, c) => {
479
- var A;
480
- if (a !== "interactive") return;
481
- const s = b[c];
482
- if (!s) return;
483
- const d = g, I = d.indexOf(c);
484
- switch (t.key) {
485
- case "ArrowRight": {
486
- t.preventDefault();
487
- const l = Math.min(d.length - 1, I + 1);
488
- k(d[l]);
489
- return;
490
- }
491
- case "ArrowLeft": {
492
- t.preventDefault();
493
- const l = Math.max(0, I - 1);
494
- k(d[l]);
495
- return;
496
- }
497
- case "ArrowUp":
498
- case "ArrowDown": {
499
- t.preventDefault();
500
- const m = {
501
- 1: 4,
502
- 4: 1,
503
- 2: 3,
504
- 3: 2,
505
- 5: 8,
506
- 8: 5,
507
- 6: 7,
508
- 7: 6
509
- }[s.quadrant];
510
- if (!m) return;
511
- const L = `${m}${s.positionInQuadrant}`;
512
- d.includes(L) && k(L);
513
- return;
514
- }
515
- case "Home": {
516
- t.preventDefault();
517
- const l = d.filter(
518
- (m) => b[m].quadrant === s.quadrant
519
- );
520
- l.length > 0 && k(l[0]);
521
- return;
522
- }
523
- case "End": {
524
- t.preventDefault();
525
- const l = d.filter(
526
- (m) => b[m].quadrant === s.quadrant
527
- );
528
- l.length > 0 && k(l[l.length - 1]);
529
- return;
530
- }
531
- case " ":
532
- case "Enter": {
533
- t.preventDefault();
534
- const l = (A = f[c]) == null ? void 0 : A.conditions, m = dt(l), L = { ...f };
535
- m.length === 0 ? (delete L[c], R(o("toothScheme.deselected", { id: c }))) : (L[c] = {
536
- ...f[c] ?? ct(),
537
- conditions: m
538
- }, R(
539
- o("toothScheme.selected", {
540
- id: c,
541
- conditions: m.map((G) => o(`toothScheme.condition.${G}`)).join(", ")
542
- })
543
- )), W(L), u == null || u(c);
544
- return;
545
- }
546
- default:
547
- return;
548
- }
549
- },
550
- [f, W, k, a, u, o, g]
551
- ), ft = H(
552
- (t) => {
553
- var I;
554
- if (a !== "interactive") return;
555
- T(t);
556
- const c = (I = f[t]) == null ? void 0 : I.conditions, s = dt(c), d = { ...f };
557
- s.length === 0 ? (delete d[t], R(o("toothScheme.deselected", { id: t }))) : (d[t] = {
558
- ...f[t] ?? ct(),
559
- conditions: s
560
- }, R(
561
- o("toothScheme.selected", {
562
- id: t,
563
- conditions: s.map((A) => o(`toothScheme.condition.${A}`)).join(", ")
564
- })
565
- )), W(d), u == null || u(t);
566
- },
567
- [f, W, a, u, o]
568
- ), mt = C.width + 4, pt = C.height + 4, et = j ?? o("toothScheme.ariaLabel");
569
- return /* @__PURE__ */ i(D.Provider, { delayDuration: 200, children: /* @__PURE__ */ S(
570
- "div",
571
- {
572
- ref: ht,
573
- role: "region",
574
- "aria-label": et,
575
- className: [At(), F].filter(Boolean).join(" "),
576
- "data-component": "tooth-scheme",
577
- "data-component-id": n,
578
- "data-testid": "tooth-scheme-root",
579
- "data-dentition": e,
580
- "data-numbering": r,
581
- "data-mode": a,
582
- children: [
583
- /* @__PURE__ */ S(
584
- "svg",
585
- {
586
- ref: tt,
587
- viewBox: `0 0 ${mt} ${pt}`,
588
- className: Dt(),
589
- role: "group",
590
- "aria-label": et,
591
- "data-testid": "tooth-scheme-svg",
592
- focusable: "false",
593
- xmlns: "http://www.w3.org/2000/svg",
594
- children: [
595
- /* @__PURE__ */ i(Ht, { idPrefix: E }),
596
- C.teeth.map((t) => {
597
- var nt;
598
- const c = f[t.fdi], s = (nt = c == null ? void 0 : c.conditions) == null ? void 0 : nt[0], d = o(
599
- `toothScheme.anatomy.${t.meta.anatomy}`
600
- ), I = s ? `, ${o(`toothScheme.condition.${s}`)}` : "", A = o("toothScheme.toothLabel", {
601
- id: it(t.fdi, r),
602
- anatomy: d,
603
- conditionSuffix: I
604
- }), l = a === "interactive" ? t.fdi === x ? 0 : -1 : void 0, m = s && s !== "missing" ? `url(#${E}-${P[s]})` : "var(--muted)", L = s && s !== "missing" ? $[s] : "var(--border)", G = s ? `${d} · ${o(`toothScheme.condition.${s}`)}` : d, gt = it(t.fdi, r);
605
- return /* @__PURE__ */ S(D.Root, { children: [
606
- /* @__PURE__ */ i(D.Trigger, { asChild: !0, children: /* @__PURE__ */ S(
607
- "g",
608
- {
609
- "data-fdi": t.fdi,
610
- "data-anatomy": t.meta.anatomy,
611
- "data-arch": t.meta.arch,
612
- "data-side": t.meta.side,
613
- "data-quadrant": t.meta.quadrant,
614
- "data-condition": s ?? "none",
615
- "data-testid": `tooth-${t.fdi}`,
616
- transform: `translate(${t.x}, ${t.y})`,
617
- tabIndex: l,
618
- role: a === "interactive" ? "button" : "img",
619
- "aria-label": A,
620
- "aria-pressed": a === "interactive" ? s !== void 0 : void 0,
621
- className: Pt(),
622
- onClick: a === "interactive" ? () => ft(t.fdi) : void 0,
623
- onFocus: () => T(t.fdi),
624
- onKeyDown: (vt) => ut(vt, t.fdi),
625
- children: [
626
- /* @__PURE__ */ i(
627
- "rect",
628
- {
629
- x: -O,
630
- y: -O,
631
- width: t.shape.width + O * 2,
632
- height: t.shape.height + O * 2,
633
- fill: "transparent"
634
- }
635
- ),
636
- /* @__PURE__ */ i(
637
- "path",
638
- {
639
- d: t.shape.path,
640
- fill: m,
641
- stroke: L,
642
- strokeWidth: "1.5",
643
- vectorEffect: "non-scaling-stroke"
644
- }
645
- ),
646
- t.shape.innerPath ? /* @__PURE__ */ i(
647
- "path",
648
- {
649
- d: t.shape.innerPath,
650
- fill: "none",
651
- stroke: "var(--muted-foreground)",
652
- strokeWidth: "0.75",
653
- vectorEffect: "non-scaling-stroke"
654
- }
655
- ) : null,
656
- /* @__PURE__ */ i(
657
- "rect",
658
- {
659
- x: -O,
660
- y: -O,
661
- width: t.shape.width + O * 2,
662
- height: t.shape.height + O * 2,
663
- fill: "none",
664
- stroke: "var(--ring)",
665
- strokeWidth: "var(--focus-ring-width)",
666
- className: [
667
- "ds:opacity-0",
668
- "ds:group-focus-visible:opacity-100",
669
- "ds:forced-colors:stroke-[CanvasText]"
670
- ].join(" "),
671
- "data-testid": `tooth-${t.fdi}-focus-ring`,
672
- pointerEvents: "none",
673
- rx: "4"
674
- }
675
- ),
676
- s === "missing" ? /* @__PURE__ */ i(
677
- "path",
678
- {
679
- d: `M2 2 L${t.shape.width - 2} ${t.shape.height - 2} M${t.shape.width - 2} 2 L2 ${t.shape.height - 2}`,
680
- stroke: $.missing,
681
- strokeWidth: "2",
682
- fill: "none"
683
- }
684
- ) : null,
685
- /* @__PURE__ */ i(
686
- "text",
687
- {
688
- x: t.shape.width / 2,
689
- y: t.meta.arch === "upper" ? t.shape.height + 12 : -4,
690
- textAnchor: "middle",
691
- fontSize: "10",
692
- fill: "var(--muted-foreground)",
693
- className: "ds:select-none",
694
- "aria-hidden": "true",
695
- children: gt
696
- }
697
- )
698
- ]
699
- }
700
- ) }),
701
- /* @__PURE__ */ i(D.Portal, { children: /* @__PURE__ */ S(
702
- D.Content,
703
- {
704
- side: "top",
705
- sideOffset: 6,
706
- className: "ds:z-[var(--z-tooltip)] ds:rounded-[var(--radius-sm)] ds:bg-[var(--foreground)] ds:text-[var(--background)] ds:ps-[var(--spacing-xs)] ds:pe-[var(--spacing-xs)] ds:pt-[calc(var(--spacing-xs)/2)] ds:pb-[calc(var(--spacing-xs)/2)] ds:text-[length:var(--font-size-xs)]",
707
- children: [
708
- G,
709
- /* @__PURE__ */ i(D.Arrow, { className: "ds:fill-[var(--foreground)]" })
710
- ]
711
- }
712
- ) })
713
- ] }, t.fdi);
714
- })
715
- ]
716
- }
717
- ),
718
- /* @__PURE__ */ i(qt, { idPrefix: E }),
719
- /* @__PURE__ */ i(
720
- "div",
721
- {
722
- className: Wt(),
723
- "aria-live": "polite",
724
- "aria-atomic": "true",
725
- "data-testid": "tooth-scheme-live",
726
- children: B
727
- }
728
- )
729
- ]
730
- }
731
- ) });
732
- }
733
- );
734
- zt.displayName = "ToothScheme";
735
- export {
736
- $ as C,
737
- b as F,
738
- J as P,
739
- Q as T,
740
- P as a,
741
- Nt as b,
742
- Mt as c,
743
- $t as d,
744
- Y as e,
745
- zt as f,
746
- ot as g,
747
- Qt as h,
748
- Rt as i,
749
- it as l,
750
- At as r,
751
- Ct as t
752
- };
753
- //# sourceMappingURL=tooth-scheme-CxlsLjfN.js.map