@alfadocs/ui-kit 0.44.0 → 0.45.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 (120) hide show
  1. package/dist/_chunks/{alia-sidebar-BpX4z_af.js → alia-sidebar-Be8FhKYd.js} +332 -237
  2. package/dist/_chunks/{autocomplete-DIgdhCGJ.js → autocomplete-CDqxB68B.js} +2 -2
  3. package/dist/_chunks/bmi-calculator-CQqXTVNL.js +258 -0
  4. package/dist/_chunks/{booking-CtLwaxkK.js → booking-DlDVuWMd.js} +2 -2
  5. package/dist/_chunks/{cycle-calculator-ChHBcjet.js → cycle-calculator-KxA8dqDf.js} +31 -20
  6. package/dist/_chunks/{due-date-calculator-CYXKLoof.js → due-date-calculator-mFxpHLml.js} +51 -39
  7. package/dist/_chunks/{editable-currency-cell-renderer-9jqwDv5x.js → editable-currency-cell-renderer-BEBUQl9P.js} +2 -2
  8. package/dist/_chunks/{freemium-paywall-BLXESpH4.js → freemium-paywall-BYist2sJ.js} +2 -2
  9. package/dist/_chunks/{gestational-age-calculator-sRmoqgVr.js → gestational-age-calculator-gWI_uRA1.js} +52 -39
  10. package/dist/_chunks/insert-result-C5ABnzDl.js +711 -0
  11. package/dist/_chunks/{marketplace-app-shell-Dc5cTIt8.js → marketplace-app-shell-Gfsf78ge.js} +2 -2
  12. package/dist/_chunks/{patient-search-DPe2ZYEL.js → patient-search-CocVcGJ3.js} +2 -2
  13. package/dist/_chunks/{payment-form-BzVsG6Ks.js → payment-form-DqEiEJRO.js} +247 -195
  14. package/dist/_chunks/{pdf-viewer-B6MC6VTx.js → pdf-viewer-CWEXTlwq.js} +2 -2
  15. package/dist/_chunks/{practice-results-CrLpEiiW.js → practice-results-DDi-kvaD.js} +2 -2
  16. package/dist/_chunks/{pregnancy-weight-gain-C5YhfYnL.js → pregnancy-weight-gain-BtEHaSqy.js} +26 -13
  17. package/dist/_chunks/{search-bar-CP6wUJFY.js → search-bar-CvN_S0jW.js} +2 -2
  18. package/dist/_chunks/{search-input-C1C3jQpD.js → search-input-D3aMvi4l.js} +2 -2
  19. package/dist/_chunks/{sign-document-B-3k_0LO.js → sign-document-BCyLpFHJ.js} +2 -2
  20. package/dist/_chunks/{sign-in-with-alfadocs-button-DeHBFRNS.js → sign-in-with-alfadocs-button-CuYn_kKP.js} +2 -2
  21. package/dist/_chunks/{social-sign-in-button-X54ySJr1.js → social-sign-in-button-uJYLM366.js} +2 -2
  22. package/dist/_chunks/{spinner-CCByyvcb.js → spinner-OjQNn8oN.js} +7 -3
  23. package/dist/_chunks/{transcript-panel-CR7VY1uw.js → transcript-panel-B4HiC7ed.js} +2 -2
  24. package/dist/_chunks/{unit-converter-Ds9jalbN.js → unit-converter-u3CwNDpP.js} +63 -52
  25. package/dist/_chunks/{wallet-pay-button-DK4ESYge.js → wallet-pay-button-DuDPBlCO.js} +2 -2
  26. package/dist/agent-catalog.json +1 -1
  27. package/dist/components/_shared/banded-gauge.d.ts +193 -0
  28. package/dist/components/_shared/insert-result.d.ts +81 -8
  29. package/dist/components/autocomplete/index.js +1 -1
  30. package/dist/components/bmi-calculator/bmi-calculator.d.ts +2 -2
  31. package/dist/components/bmi-calculator/index.js +1 -1
  32. package/dist/components/booking/index.js +1 -1
  33. package/dist/components/cycle-calculator/cycle-calculator.d.ts +2 -2
  34. package/dist/components/cycle-calculator/index.js +1 -1
  35. package/dist/components/data-table/index.js +1 -1
  36. package/dist/components/due-date-calculator/due-date-calculator.d.ts +2 -2
  37. package/dist/components/due-date-calculator/index.js +1 -1
  38. package/dist/components/freemium-paywall/index.js +1 -1
  39. package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts +2 -2
  40. package/dist/components/gestational-age-calculator/index.js +1 -1
  41. package/dist/components/patient-search/index.js +1 -1
  42. package/dist/components/payment-form/index.js +1 -1
  43. package/dist/components/payment-form/payment-form.d.ts +24 -2
  44. package/dist/components/pdf-viewer/index.js +1 -1
  45. package/dist/components/practice-results/index.js +1 -1
  46. package/dist/components/pregnancy-weight-gain/index.js +1 -1
  47. package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts +2 -2
  48. package/dist/components/search-bar/index.js +1 -1
  49. package/dist/components/search-input/index.js +1 -1
  50. package/dist/components/sign-document/index.js +1 -1
  51. package/dist/components/sign-in-with-alfadocs-button/index.js +1 -1
  52. package/dist/components/social-sign-in-button/index.js +1 -1
  53. package/dist/components/spinner/index.js +1 -1
  54. package/dist/components/spinner/spinner.d.ts +2 -2
  55. package/dist/components/transcript-panel/index.js +1 -1
  56. package/dist/components/unit-converter/index.js +1 -1
  57. package/dist/components/unit-converter/unit-converter.d.ts +2 -2
  58. package/dist/components/wallet-pay-button/index.js +1 -1
  59. package/dist/i18n/locales/ar.d.ts +1 -1
  60. package/dist/i18n/locales/ar.js +1 -1
  61. package/dist/i18n/locales/de.d.ts +1 -1
  62. package/dist/i18n/locales/de.js +1 -1
  63. package/dist/i18n/locales/el.d.ts +1 -1
  64. package/dist/i18n/locales/el.js +1 -1
  65. package/dist/i18n/locales/en.d.ts +1 -1
  66. package/dist/i18n/locales/en.js +1 -1
  67. package/dist/i18n/locales/es.d.ts +1 -1
  68. package/dist/i18n/locales/es.js +1 -1
  69. package/dist/i18n/locales/fr.d.ts +1 -1
  70. package/dist/i18n/locales/fr.js +1 -1
  71. package/dist/i18n/locales/hi.d.ts +1 -1
  72. package/dist/i18n/locales/hi.js +1 -1
  73. package/dist/i18n/locales/it.d.ts +1 -1
  74. package/dist/i18n/locales/it.js +1 -1
  75. package/dist/i18n/locales/ja.d.ts +1 -1
  76. package/dist/i18n/locales/ja.js +1 -1
  77. package/dist/i18n/locales/nl.d.ts +1 -1
  78. package/dist/i18n/locales/nl.js +1 -1
  79. package/dist/i18n/locales/pl.d.ts +1 -1
  80. package/dist/i18n/locales/pl.js +1 -1
  81. package/dist/i18n/locales/pt.d.ts +1 -1
  82. package/dist/i18n/locales/pt.js +1 -1
  83. package/dist/i18n/locales/ro.d.ts +1 -1
  84. package/dist/i18n/locales/ro.js +1 -1
  85. package/dist/i18n/locales/ru.d.ts +1 -1
  86. package/dist/i18n/locales/ru.js +1 -1
  87. package/dist/i18n/locales/sq.d.ts +1 -1
  88. package/dist/i18n/locales/sq.js +1 -1
  89. package/dist/i18n/locales/sv.d.ts +1 -1
  90. package/dist/i18n/locales/sv.js +1 -1
  91. package/dist/i18n/locales/tr.d.ts +1 -1
  92. package/dist/i18n/locales/tr.js +1 -1
  93. package/dist/i18n/locales/zh.d.ts +1 -1
  94. package/dist/i18n/locales/zh.js +1 -1
  95. package/dist/index.js +25 -25
  96. package/dist/locales/ar.json +1 -1
  97. package/dist/locales/de.json +1 -1
  98. package/dist/locales/el.json +1 -1
  99. package/dist/locales/en.json +1 -1
  100. package/dist/locales/es.json +1 -1
  101. package/dist/locales/fr.json +1 -1
  102. package/dist/locales/hi.json +1 -1
  103. package/dist/locales/it.json +1 -1
  104. package/dist/locales/ja.json +1 -1
  105. package/dist/locales/nl.json +1 -1
  106. package/dist/locales/pl.json +1 -1
  107. package/dist/locales/pt.json +1 -1
  108. package/dist/locales/ro.json +1 -1
  109. package/dist/locales/ru.json +1 -1
  110. package/dist/locales/sq.json +1 -1
  111. package/dist/locales/sv.json +1 -1
  112. package/dist/locales/tr.json +1 -1
  113. package/dist/locales/zh.json +1 -1
  114. package/dist/patterns/alia-assistant/alia-types.d.ts +20 -0
  115. package/dist/patterns/alia-assistant/index.js +1 -1
  116. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  117. package/dist/tokens.css +1 -1
  118. package/package.json +1 -1
  119. package/dist/_chunks/bmi-calculator-DFPWL2OJ.js +0 -273
  120. package/dist/_chunks/insert-result-CoC1oo6R.js +0 -334
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfadocs/ui-kit",
3
- "version": "0.44.0",
3
+ "version": "0.45.0",
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",
@@ -1,273 +0,0 @@
1
- import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as ee, useId as te, useState as c, useMemo as ae, useEffect as A } from "react";
3
- import { c as M } from "./index-D2ZczOXr.js";
4
- import { useTranslation as le } from "react-i18next";
5
- import { R as G } from "./radio-TWf9Q-mp.js";
6
- import { R as ie } from "./radio-group-CLjK-SlK.js";
7
- import { F as k } from "./form-field-BOm9hK35.js";
8
- import { N as C } from "./number-input-Dj5L3pXK.js";
9
- import { C as oe } from "./chart-Cg3e9EH9.js";
10
- import { C as L } from "./card-DPmk26CL.js";
11
- import { B as re } from "./badge-zsf5i5bH.js";
12
- import { I as ne } from "./insert-result-CoC1oo6R.js";
13
- import { a as S, b as se, e as ce, c as me, f as H, l as V, k as ue } from "./bmi-BxD-tFzU.js";
14
- const de = M("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
15
- variants: {
16
- width: {
17
- full: "ds:w-full",
18
- auto: "ds:inline-flex"
19
- }
20
- },
21
- defaultVariants: { width: "full" }
22
- }), ge = {
23
- underweight: "info",
24
- normal: "success",
25
- overweight: "warning",
26
- obese: "error"
27
- }, O = M("", {
28
- variants: {
29
- category: {
30
- underweight: "--info",
31
- normal: "--success",
32
- overweight: "--warning",
33
- obese: "--destructive"
34
- }
35
- }
36
- }), W = "--color-orange-600";
37
- function be(i) {
38
- if (typeof document > "u") return;
39
- const o = document.documentElement, r = getComputedStyle(o), n = i === "overweight" && o.classList.contains("theme-light") && !o.classList.contains("theme-accessible") ? W : O({ category: i });
40
- return r.getPropertyValue(n).trim() || void 0;
41
- }
42
- function K(i) {
43
- return typeof document < "u" && i === "overweight" && document.documentElement.classList.contains("theme-light") && !document.documentElement.classList.contains("theme-accessible") ? W : O({ category: i });
44
- }
45
- function he(i) {
46
- const [o, r] = c(void 0);
47
- return A(() => {
48
- if (i === null) {
49
- r(void 0);
50
- return;
51
- }
52
- const n = () => r(be(i));
53
- if (n(), typeof document > "u") return;
54
- const f = new MutationObserver(n);
55
- return f.observe(document.documentElement, {
56
- attributes: !0,
57
- attributeFilter: ["class"]
58
- }), () => f.disconnect();
59
- }, [i]), o;
60
- }
61
- const y = (i) => Math.round(i * 10) / 10, fe = ee(
62
- ({
63
- defaultUnitSystem: i = "metric",
64
- onResultChange: o,
65
- onInsert: r,
66
- insertVariant: n = "insert",
67
- onCopy: f,
68
- onError: D,
69
- insertBrand: _,
70
- id: j,
71
- width: z,
72
- className: P
73
- }, R) => {
74
- const { t: e, i18n: w } = le(), N = te(), [m, U] = c(i), [p, T] = c(null), [v, F] = c(null), [u, $] = c(null), [d, I] = c(null), [g, B] = c(null), Y = (Q) => {
75
- const x = Q;
76
- if (x !== m) {
77
- if (x === "imperial") {
78
- if (p !== null) {
79
- const { ft: X, in: Z } = me(p);
80
- $(X), I(y(Z));
81
- }
82
- v !== null && B(y(ue(v)));
83
- } else
84
- (u !== null || d !== null) && T(y(H(u ?? 0, d ?? 0))), g !== null && F(y(V(g)));
85
- U(x);
86
- }
87
- }, q = m === "metric" ? p : u !== null || d !== null ? H(u ?? 0, d ?? 0) : null, J = m === "metric" ? v : g !== null ? V(g) : null, l = ce(J, q), a = l !== null ? se(l) : null, E = he(a), b = ae(
88
- () => new Intl.NumberFormat(w.language, {
89
- minimumFractionDigits: 1,
90
- maximumFractionDigits: 1
91
- }),
92
- [w.language]
93
- );
94
- A(() => {
95
- o == null || o(
96
- l !== null && a !== null ? { bmi: l, category: a } : null
97
- );
98
- }, [l, a, o]);
99
- const h = m === "metric";
100
- return /* @__PURE__ */ s(
101
- "div",
102
- {
103
- ref: R,
104
- "data-component": "bmi-calculator",
105
- "data-component-id": j,
106
- className: de({ width: z, className: P }),
107
- children: [
108
- /* @__PURE__ */ s(
109
- ie,
110
- {
111
- label: e("bmiCalculator.unitSystem.label"),
112
- variant: "horizontal",
113
- value: m,
114
- onValueChange: Y,
115
- children: [
116
- /* @__PURE__ */ t(G, { label: e("bmiCalculator.unitSystem.metric"), value: "metric" }),
117
- /* @__PURE__ */ t(
118
- G,
119
- {
120
- label: e("bmiCalculator.unitSystem.imperial"),
121
- value: "imperial"
122
- }
123
- )
124
- ]
125
- }
126
- ),
127
- /* @__PURE__ */ s("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2", children: [
128
- h ? /* @__PURE__ */ t(
129
- k,
130
- {
131
- label: `${e("bmiCalculator.height")} (${e("bmiCalculator.units.cm")})`,
132
- children: /* @__PURE__ */ t(
133
- C,
134
- {
135
- mode: "decimal",
136
- min: 0,
137
- step: 0.5,
138
- value: p,
139
- onChange: T
140
- }
141
- )
142
- }
143
- ) : /* @__PURE__ */ s("div", { role: "group", "aria-labelledby": N, children: [
144
- /* @__PURE__ */ t(
145
- "span",
146
- {
147
- id: N,
148
- className: "type-label ds:mb-[var(--spacing-xs)] ds:block ds:text-foreground",
149
- children: e("bmiCalculator.height")
150
- }
151
- ),
152
- /* @__PURE__ */ s("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
153
- /* @__PURE__ */ t(
154
- C,
155
- {
156
- mode: "integer",
157
- min: 0,
158
- value: u,
159
- onChange: $,
160
- "aria-label": e("bmiCalculator.feet")
161
- }
162
- ),
163
- /* @__PURE__ */ t("span", { className: "type-label ds:text-muted-foreground", children: e("bmiCalculator.units.ft") }),
164
- /* @__PURE__ */ t(
165
- C,
166
- {
167
- mode: "decimal",
168
- min: 0,
169
- max: 11.9,
170
- step: 0.5,
171
- value: d,
172
- onChange: I,
173
- "aria-label": e("bmiCalculator.inches")
174
- }
175
- ),
176
- /* @__PURE__ */ t("span", { className: "type-label ds:text-muted-foreground", children: e("bmiCalculator.units.in") })
177
- ] })
178
- ] }),
179
- /* @__PURE__ */ t(
180
- k,
181
- {
182
- label: `${e("bmiCalculator.weight")} (${e(
183
- h ? "bmiCalculator.units.kg" : "bmiCalculator.units.lb"
184
- )})`,
185
- children: /* @__PURE__ */ t(
186
- C,
187
- {
188
- mode: "decimal",
189
- min: 0,
190
- step: h ? 0.1 : 0.5,
191
- value: h ? v : g,
192
- onChange: h ? F : B
193
- }
194
- )
195
- }
196
- )
197
- ] }),
198
- /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: l !== null && a !== null ? e("bmiCalculator.gaugeAria", {
199
- bmi: b.format(l),
200
- category: e(`bmiCalculator.category.${a}`)
201
- }) : "" }),
202
- l !== null && a !== null ? /* @__PURE__ */ t(L, { variant: "elevated", children: /* @__PURE__ */ s(L.Body, { className: "ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-md)]", children: [
203
- /* @__PURE__ */ s("div", { className: "ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-xs)] ds:text-center", children: [
204
- /* @__PURE__ */ t("span", { className: "type-label ds:text-muted-foreground", children: e("bmiCalculator.category.label") }),
205
- /* @__PURE__ */ t(re, { variant: ge[a], size: "lg", children: e(`bmiCalculator.category.${a}`) }),
206
- /* @__PURE__ */ t("p", { className: "type-body ds:text-muted-foreground", children: e(`bmiCalculator.range.${a}`) })
207
- ] }),
208
- /* @__PURE__ */ t(
209
- "div",
210
- {
211
- "data-bmi-category": a,
212
- className: "ds:w-[240px] ds:max-w-full",
213
- children: /* @__PURE__ */ t(
214
- oe,
215
- {
216
- type: "radialBar",
217
- title: e("bmiCalculator.gaugeAria", {
218
- bmi: b.format(l),
219
- category: e(`bmiCalculator.category.${a}`)
220
- }),
221
- series: [S(l)],
222
- labels: [e(`bmiCalculator.category.${a}`)],
223
- colors: E ? [E] : void 0,
224
- radialValueFormatter: () => b.format(l),
225
- height: 240
226
- }
227
- )
228
- }
229
- ),
230
- n === "copy" || r ? /* @__PURE__ */ t(
231
- ne,
232
- {
233
- onInsert: r,
234
- variant: n,
235
- onCopy: f,
236
- onError: D,
237
- card: {
238
- title: e("insert.title.bmi"),
239
- highlight: e(`bmiCalculator.category.${a}`),
240
- // Chip + gauge arc share the WHO-category semantic token so
241
- // the inserted PNG matches the on-screen gauge.
242
- highlightToken: K(a),
243
- brand: _,
244
- gauge: {
245
- value: b.format(l),
246
- fraction: S(l) / 100,
247
- colorToken: K(a),
248
- label: e(`bmiCalculator.category.${a}`)
249
- },
250
- fields: [
251
- {
252
- label: e("insert.title.bmi"),
253
- value: b.format(l)
254
- },
255
- {
256
- label: e("bmiCalculator.category.label"),
257
- value: e(`bmiCalculator.category.${a}`)
258
- }
259
- ]
260
- }
261
- }
262
- ) : null
263
- ] }) }) : /* @__PURE__ */ t("p", { className: "type-body ds:text-muted-foreground", children: e("bmiCalculator.empty") })
264
- ]
265
- }
266
- );
267
- }
268
- );
269
- fe.displayName = "BmiCalculator";
270
- export {
271
- fe as B
272
- };
273
- //# sourceMappingURL=bmi-calculator-DFPWL2OJ.js.map
@@ -1,334 +0,0 @@
1
- import { jsxs as E, jsx as p } from "react/jsx-runtime";
2
- import { forwardRef as J, useRef as Q } from "react";
3
- import { useTranslation as Z } from "react-i18next";
4
- import { c as tt } from "./index-D2ZczOXr.js";
5
- import { B as et } from "./button-DD_0Xdmr.js";
6
- import { c as L } from "./createLucideIcon-CrFbzy84.js";
7
- import { I as nt } from "./image-C6RM5hfF.js";
8
- /**
9
- * @license lucide-react v1.8.0 - ISC
10
- *
11
- * This source code is licensed under the ISC license.
12
- * See the LICENSE file in the root directory of this source tree.
13
- */
14
- const ot = [
15
- [
16
- "path",
17
- {
18
- d: "M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",
19
- key: "zw3jo"
20
- }
21
- ],
22
- [
23
- "path",
24
- {
25
- d: "M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",
26
- key: "1wduqc"
27
- }
28
- ],
29
- [
30
- "path",
31
- {
32
- d: "M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",
33
- key: "kqbvx6"
34
- }
35
- ]
36
- ], at = L("layers", ot);
37
- /**
38
- * @license lucide-react v1.8.0 - ISC
39
- *
40
- * This source code is licensed under the ISC license.
41
- * See the LICENSE file in the root directory of this source tree.
42
- */
43
- const it = [
44
- ["path", { d: "M12 4v16", key: "1654pz" }],
45
- ["path", { d: "M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2", key: "e0r10z" }],
46
- ["path", { d: "M9 20h6", key: "s66wpe" }]
47
- ], rt = L("type", it), st = ["fg", "muted", "accent", "border", "bg"], N = "--primary", D = 380, H = (t) => t.trim().replace(/^--/, "");
48
- function R(t) {
49
- const e = /* @__PURE__ */ new Set();
50
- if (t.highlight) {
51
- const o = t.highlightToken ?? N;
52
- e.add(o), e.add(`${o}-foreground`);
53
- }
54
- return t.gauge && e.add(t.gauge.colorToken), [...e];
55
- }
56
- function M(t, e = []) {
57
- const o = {
58
- fg: "currentColor",
59
- muted: "currentColor",
60
- accent: "currentColor",
61
- border: "currentColor",
62
- bg: "transparent",
63
- font: "sans-serif",
64
- tokens: {}
65
- };
66
- if (!t) return o;
67
- const n = (a) => {
68
- const r = t.querySelector(`[data-k="${a}"]`);
69
- return r && getComputedStyle(r).color || "currentColor";
70
- }, i = {};
71
- for (const a of e) {
72
- const r = t.querySelector(
73
- `[data-token="${H(a)}"]`
74
- );
75
- if (r) {
76
- const u = getComputedStyle(r).color;
77
- u && (i[a] = u);
78
- }
79
- }
80
- return {
81
- fg: n("fg"),
82
- muted: n("muted"),
83
- accent: n("accent"),
84
- border: n("border"),
85
- bg: n("bg"),
86
- font: getComputedStyle(t).fontFamily || "sans-serif",
87
- tokens: i
88
- };
89
- }
90
- function _(t, e, o) {
91
- var n;
92
- return e ? ((n = t.tokens) == null ? void 0 : n[e]) ?? o : o;
93
- }
94
- const f = (t) => t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
95
- function O(t) {
96
- const e = [t.title];
97
- t.highlight && e.push(t.highlight);
98
- for (const o of t.fields) e.push(`• ${o.label}: ${o.value}`);
99
- return e.join(`
100
- `);
101
- }
102
- function Y(t) {
103
- const e = t.fields.map((n) => `<li>${f(n.label)}: ${f(n.value)}</li>`).join(""), o = t.highlight ? `<p><strong>${f(t.highlight)}</strong></p>` : "";
104
- return `<p><strong>${f(t.title)}</strong></p>${o}<ul>${e}</ul>`;
105
- }
106
- const z = "AlfaDocs", m = 20, y = m + 18, T = 22, lt = 10, B = 22, S = 16, F = 12, ct = 12, V = 34, U = 9, k = (V + U) * 2;
107
- function A(t, e) {
108
- const o = e !== void 0 ? e : t.brand;
109
- return o === !1 ? !1 : typeof o == "string" ? o : z;
110
- }
111
- function ut(t) {
112
- if (typeof t.fraction == "number")
113
- return Math.min(1, Math.max(0, t.fraction));
114
- const e = parseFloat(t.value);
115
- return Number.isFinite(e) && typeof t.max == "number" && t.max > 0 ? Math.min(1, Math.max(0, e / t.max)) : 1;
116
- }
117
- function W(t, e) {
118
- const o = !!t.highlight, n = y + lt, i = (o ? n + T + S : y + S) + B - 6, a = i + Math.max(0, t.fields.length - 1) * B, r = o ? n : y, u = t.gauge ? r + k : 0, l = Math.max(a, u), c = e ? l + F + ct - 4 : l, d = Math.round(c + (e ? F : m));
119
- return { hasChip: o, chipY: n, firstFieldY: i, fieldsEndY: a, footerY: c, height: d };
120
- }
121
- function q(t, e) {
122
- return W(t, e !== !1).height;
123
- }
124
- function dt(t, e, o, n, i) {
125
- const a = V, r = 2 * Math.PI * a, u = ut(t), l = _(e, t.colorToken, e.accent), c = typeof t.segments == "number" && t.segments > 1 ? t.segments : 0, d = c ? 3 : 0, g = c ? r / c - d : r, $ = c ? `${g} ${d}` : "", v = `${r * u} ${r}`, w = `transform="rotate(-90 ${n} ${i})"`, s = f(
126
- t.label ? `${t.value} — ${t.label}` : t.value
127
- ), x = `<circle cx="${n}" cy="${i}" r="${a}" fill="none" stroke="${e.border}" stroke-width="${U}"${$ ? ` stroke-dasharray="${$}"` : ""} ${w}/>`, h = `<circle cx="${n}" cy="${i}" r="${a}" fill="none" stroke="${l}" stroke-width="${U}" stroke-linecap="round" stroke-dasharray="${v}" ${w}/>`, b = `<text x="${n}" y="${i + 1}" text-anchor="middle" dominant-baseline="middle" font-family="${o}" font-size="16" font-weight="700" fill="${e.fg}">${f(
128
- t.value
129
- )}</text>`, C = t.label ? `<text x="${n}" y="${i + 15}" text-anchor="middle" dominant-baseline="middle" font-family="${o}" font-size="9" fill="${e.muted}">${f(
130
- t.label
131
- )}</text>` : "";
132
- return `<g role="img" aria-label="${s}"><title>${s}</title>${x}${h}${b}${C}</g>`;
133
- }
134
- function ft(t, e, o, n) {
135
- const i = t.highlight, a = t.highlightToken ?? N, r = _(e, a, e.accent), u = _(e, `${a}-foreground`, e.bg), l = Math.round(i.length * 7.2 + 28), c = m + l / 2, d = n + T / 2 + 1;
136
- return `<rect x="${m}" y="${n}" width="${l}" height="${T}" rx="${T / 2}" fill="${r}"/><text x="${c}" y="${d}" text-anchor="middle" dominant-baseline="middle" font-family="${o}" font-size="12" font-weight="600" fill="${u}">${f(
137
- i
138
- )}</text>`;
139
- }
140
- function P(t, e, o = z) {
141
- const n = D, i = W(t, o !== !1), a = i.height, r = f(e.font);
142
- t.gauge ? n - m - k - 12 : n - m;
143
- const u = t.fields.map((g, $) => {
144
- const v = i.firstFieldY + $ * B;
145
- return `<text x="${m}" y="${v}" font-family="${r}" font-size="13"><tspan fill="${e.muted}">${f(
146
- g.label
147
- )}: </tspan><tspan fill="${e.fg}">${f(g.value)}</tspan></text>`;
148
- }).join(""), l = i.hasChip ? ft(t, e, r, i.chipY) : "", c = t.gauge ? dt(
149
- t.gauge,
150
- e,
151
- r,
152
- n - m - k / 2,
153
- (i.hasChip ? i.chipY : y) + k / 2
154
- ) : "", d = o !== !1 ? `<text x="${m}" y="${i.footerY}" font-family="${r}" font-size="10" fill="${e.muted}">${f(
155
- o
156
- )}</text>` : "";
157
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${a}" viewBox="0 0 ${n} ${a}" role="img" aria-label="${f(
158
- t.title
159
- )}"><rect x="0.5" y="0.5" width="${n - 1}" height="${a - 1}" rx="12" fill="${e.bg}" stroke="${e.border}"/><text x="${m}" y="${y}" font-family="${r}" font-size="16" font-weight="700" fill="${e.fg}">${f(
160
- t.title
161
- )}</text>${l}${c}${u}${d}</svg>`;
162
- }
163
- function mt() {
164
- var t;
165
- return typeof navigator < "u" && typeof ((t = navigator.clipboard) == null ? void 0 : t.write) == "function" && typeof ClipboardItem < "u";
166
- }
167
- function j(t, e, o) {
168
- return new Promise((n, i) => {
169
- const a = new Image();
170
- a.decoding = "async", a.onload = () => {
171
- const r = document.createElement("canvas");
172
- r.width = e, r.height = o;
173
- const u = r.getContext("2d");
174
- if (!u) {
175
- i(new Error("2D canvas context unavailable"));
176
- return;
177
- }
178
- u.drawImage(a, 0, 0, e, o), r.toBlob((l) => {
179
- l ? n(l) : i(new Error("canvas.toBlob produced no PNG"));
180
- }, "image/png");
181
- }, a.onerror = () => i(new Error("SVG failed to decode as an image")), a.src = t;
182
- });
183
- }
184
- function K() {
185
- const t = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : 1;
186
- return Math.max(2, t);
187
- }
188
- async function Mt(t, e = {}) {
189
- return (await X(t, e)).dataUri;
190
- }
191
- async function X(t, e = {}) {
192
- const { colours: o, scale: n = K() } = e, i = o ?? M(null), a = A(t, e.brand), r = P(t, i, a), u = `data:image/svg+xml,${encodeURIComponent(r)}`, l = D, c = q(t, a), d = await j(
193
- u,
194
- Math.round(l * n),
195
- Math.round(c * n)
196
- );
197
- return { dataUri: await gt(d), width: l, height: c };
198
- }
199
- function gt(t) {
200
- return new Promise((e, o) => {
201
- const n = new FileReader();
202
- n.onload = () => e(String(n.result)), n.onerror = () => o(n.error ?? new Error("FileReader error")), n.readAsDataURL(t);
203
- });
204
- }
205
- async function ht(t, e, o) {
206
- const n = O(e), i = new Blob([n], { type: "text/plain" });
207
- if (t === "text")
208
- return new ClipboardItem({ "text/plain": i });
209
- const a = A(e, void 0), r = P(e, o, a), u = `data:image/svg+xml,${encodeURIComponent(r)}`, l = K(), c = await j(
210
- u,
211
- Math.round(D * l),
212
- Math.round(q(e, a) * l)
213
- );
214
- if (t === "image")
215
- return new ClipboardItem({ "image/png": c, "text/plain": i });
216
- const d = new Blob([Y(e)], { type: "text/html" });
217
- return new ClipboardItem({
218
- "text/html": d,
219
- "image/png": c,
220
- "text/plain": i
221
- });
222
- }
223
- const pt = tt(
224
- "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]",
225
- {
226
- variants: {
227
- variant: {
228
- insert: "",
229
- copy: ""
230
- }
231
- },
232
- defaultVariants: { variant: "insert" }
233
- }
234
- ), $t = ["text", "image", "text-image"], xt = {
235
- text: /* @__PURE__ */ p(rt, { "aria-hidden": !0 }),
236
- image: /* @__PURE__ */ p(nt, { "aria-hidden": !0 }),
237
- "text-image": /* @__PURE__ */ p(at, { "aria-hidden": !0 })
238
- }, G = {
239
- insert: {
240
- text: "insert.text",
241
- image: "insert.image",
242
- "text-image": "insert.textImage"
243
- },
244
- copy: {
245
- text: "insert.copyText",
246
- image: "insert.copyImage",
247
- "text-image": "insert.copyTextImage"
248
- }
249
- }, bt = J(
250
- function({
251
- card: e,
252
- variant: o = "insert",
253
- onInsert: n,
254
- onCopy: i,
255
- onError: a,
256
- size: r = "sm",
257
- intent: u = "primary"
258
- }, l) {
259
- const { t: c } = Z(), d = Q(null), g = (s) => {
260
- const x = O(e), h = Y(e);
261
- let b = "", C = "";
262
- const I = s === "text" ? null : M(d.current, R(e));
263
- return I && (b = P(e, I, A(e, void 0)), C = `data:image/svg+xml,${encodeURIComponent(b)}`), { mode: s, text: x, html: h, svg: b, imageDataUri: C, pngDataUri: () => I ? X(e, { colours: I }) : Promise.resolve({ dataUri: "", width: 0, height: 0 }) };
264
- }, w = o === "copy" ? (s) => {
265
- if (!mt()) {
266
- a == null || a(new Error("Clipboard write unavailable in this context"));
267
- return;
268
- }
269
- const x = M(
270
- d.current,
271
- R(e)
272
- );
273
- (async () => {
274
- try {
275
- const h = await ht(s, e, x);
276
- await navigator.clipboard.write([h]), i == null || i(s);
277
- } catch (h) {
278
- a == null || a(h);
279
- }
280
- })();
281
- } : (s) => {
282
- n == null || n(g(s));
283
- };
284
- return /* @__PURE__ */ E(
285
- "div",
286
- {
287
- ref: l,
288
- "data-component": "insert-result",
289
- "data-variant": o,
290
- className: pt({ variant: o }),
291
- children: [
292
- /* @__PURE__ */ E("span", { ref: d, "aria-hidden": !0, className: "ds:sr-only", children: [
293
- st.map((s) => /* @__PURE__ */ p(
294
- "span",
295
- {
296
- "data-k": s,
297
- className: s === "fg" ? "ds:text-foreground" : s === "muted" ? "ds:text-muted-foreground" : s === "accent" ? "ds:text-[color:var(--primary)]" : s === "border" ? "ds:text-[color:var(--border)]" : "ds:text-[color:var(--card)]"
298
- },
299
- s
300
- )),
301
- R(e).map((s) => /* @__PURE__ */ p(
302
- "span",
303
- {
304
- "data-token": H(s),
305
- className: `ds:text-[color:var(${s})]`
306
- },
307
- s
308
- ))
309
- ] }),
310
- $t.map((s) => /* @__PURE__ */ p(
311
- et,
312
- {
313
- type: "button",
314
- intent: u,
315
- size: r,
316
- startIcon: xt[s],
317
- "aria-label": c(G[o][s]),
318
- onClick: () => w(s),
319
- children: c(G[o][s])
320
- },
321
- s
322
- ))
323
- ]
324
- }
325
- );
326
- }
327
- );
328
- bt.displayName = "InsertButton";
329
- export {
330
- bt as I,
331
- Mt as a,
332
- X as s
333
- };
334
- //# sourceMappingURL=insert-result-CoC1oo6R.js.map