@alfadocs/ui-kit 0.42.0 → 0.44.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.
- package/dist/_chunks/{ar-Cn_NxqkN.js → ar-DEz65ZJW.js} +2 -2
- package/dist/_chunks/bmi-calculator-DFPWL2OJ.js +273 -0
- package/dist/_chunks/{booking-4mCw3Mpl.js → booking-CtLwaxkK.js} +4 -4
- package/dist/_chunks/{calculator-dialog-B74fqpFZ.js → calculator-dialog-D-nfvteH.js} +2 -2
- package/dist/_chunks/{chart-Cbt0_sKv.js → chart-Cg3e9EH9.js} +101 -99
- package/dist/_chunks/{cycle-calculator-DsZbyzX6.js → cycle-calculator-ChHBcjet.js} +65 -56
- package/dist/_chunks/{date-picker-CvQfs6Xh.js → date-picker-Bq7xhMA-.js} +109 -108
- package/dist/_chunks/date-picker-variants-DLi1Va_e.js +3238 -0
- package/dist/_chunks/{date-range-picker-U9fn1g9d.js → date-range-picker-DcXuI9y7.js} +20 -19
- package/dist/_chunks/{date-time-picker-Cva0ZCWw.js → date-time-picker-RimumeLR.js} +18 -17
- package/dist/_chunks/{de-BMM2H7Bs.js → de-bTBGdjPS.js} +2 -2
- package/dist/_chunks/dialog-BTpZV6It.js +223 -0
- package/dist/_chunks/{due-date-calculator-s_CBgaFs.js → due-date-calculator-CYXKLoof.js} +65 -45
- package/dist/_chunks/{editable-currency-cell-renderer-BhUkRiPZ.js → editable-currency-cell-renderer-9jqwDv5x.js} +2 -2
- package/dist/_chunks/{el-BYPonAaK.js → el-BWG5RXxa.js} +6 -6
- package/dist/_chunks/{es-CMkVCQ4F.js → es-DfO_G435.js} +2 -2
- package/dist/_chunks/{fr-BcuWxqft.js → fr-BTn24bs8.js} +2 -2
- package/dist/_chunks/{gestation-BXEgDGmP.js → gestation-mWF4AXea.js} +3 -3
- package/dist/_chunks/gestational-age-calculator-sRmoqgVr.js +190 -0
- package/dist/_chunks/{header-CTZWX-tm.js → header-Ce1Br27u.js} +70 -75
- package/dist/_chunks/{hi-wkq_rQAh.js → hi-Dj3oYd84.js} +2 -2
- package/dist/_chunks/insert-result-CoC1oo6R.js +334 -0
- package/dist/_chunks/{isSameWeek-Bim5ftRd.js → isSameWeek-HfxKk6Lz.js} +2 -2
- package/dist/_chunks/{it-GiQrQ9p4.js → it-Y85ofIQQ.js} +7 -7
- package/dist/_chunks/{ja-qfYg3Rua.js → ja-CQ7J6YoA.js} +2 -2
- package/dist/_chunks/{marketplace-app-shell-kVAVycz_.js → marketplace-app-shell-Dc5cTIt8.js} +186 -149
- package/dist/_chunks/{nl-xOogO4sZ.js → nl-D9kHCmp3.js} +2 -2
- package/dist/_chunks/{patient-shell-lDX3wwu6.js → patient-shell-CnT4L8gn.js} +2 -2
- package/dist/_chunks/{pl-GnOW6eGK.js → pl-B3Smqpkr.js} +3 -3
- package/dist/_chunks/{pregnancy-weight-gain-B7kBK-ZR.js → pregnancy-weight-gain-C5YhfYnL.js} +60 -50
- package/dist/_chunks/{pt-_bV5b5RW.js → pt-D3J-1c_7.js} +6 -6
- package/dist/_chunks/{ro-BEcyh5Nj.js → ro-BKAbbEA3.js} +2 -2
- package/dist/_chunks/{ru-Bi86hqMf.js → ru-BeG8f0Ep.js} +3 -3
- package/dist/_chunks/{sign-document-QHfcNKFj.js → sign-document-B-3k_0LO.js} +165 -137
- package/dist/_chunks/{sq-BujHSAWu.js → sq-_hRPaeUy.js} +6 -6
- package/dist/_chunks/subDays-Dv7q9S7u.js +8 -0
- package/dist/_chunks/{sv-C8AeDrTA.js → sv-g009fSpe.js} +2 -2
- package/dist/_chunks/{tab-bar-C4II-7ej.js → tab-bar-Xetknddo.js} +53 -34
- package/dist/_chunks/{tr-CMSs_Vgf.js → tr-OKUOuhMW.js} +2 -2
- package/dist/_chunks/{unit-converter-D1UrEUxa.js → unit-converter-Ds9jalbN.js} +78 -67
- package/dist/_chunks/{zh-CN-eXB-PFu4.js → zh-CN-De4zwEhx.js} +3 -3
- package/dist/agent-catalog.json +1 -1
- package/dist/components/_shared/calendar-class-names.d.ts +8 -0
- package/dist/components/_shared/index.d.ts +2 -0
- package/dist/components/_shared/insert-result.d.ts +149 -4
- package/dist/components/badge/badge.d.ts +1 -1
- package/dist/components/bmi-calculator/bmi-calculator.d.ts +6 -0
- package/dist/components/bmi-calculator/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/calculator-dialog/index.js +1 -1
- package/dist/components/card/card.d.ts +1 -1
- package/dist/components/chart/chart.d.ts +10 -0
- package/dist/components/chart/index.js +1 -1
- package/dist/components/cycle-calculator/cycle-calculator.d.ts +6 -0
- package/dist/components/cycle-calculator/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/date-picker/date-picker.d.ts +0 -1
- package/dist/components/date-picker/index.js +1 -1
- package/dist/components/date-range-picker/date-range-picker.d.ts +0 -1
- package/dist/components/date-range-picker/index.js +1 -1
- package/dist/components/date-time-picker/date-time-picker.d.ts +0 -1
- package/dist/components/date-time-picker/index.js +1 -1
- package/dist/components/dialog/dialog.d.ts +1 -0
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/due-date-calculator/due-date-calculator.d.ts +6 -0
- package/dist/components/due-date-calculator/index.js +2 -2
- package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts +6 -0
- package/dist/components/gestational-age-calculator/index.js +1 -1
- package/dist/components/header/header.d.ts +8 -0
- package/dist/components/header/index.js +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/pregnancy-weight-gain/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts +6 -0
- package/dist/components/public-header/public-header.d.ts +1 -1
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/sign-document/sign-document.d.ts +12 -0
- package/dist/components/stat/stat.d.ts +1 -1
- package/dist/components/tab-bar/index.d.ts +1 -1
- package/dist/components/tab-bar/index.js +1 -1
- package/dist/components/tab-bar/tab-bar.d.ts +44 -1
- package/dist/components/unit-converter/index.js +1 -1
- package/dist/components/unit-converter/unit-converter.d.ts +6 -0
- package/dist/index.js +504 -502
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/marketplace-app-shell.d.ts +57 -1
- package/dist/patterns/patient-shell/index.js +1 -1
- package/dist/tokens.css +1411 -2
- package/package.json +1 -1
- package/dist/_chunks/bmi-calculator-D4juUcyF.js +0 -219
- package/dist/_chunks/dialog-Cee13rHU.js +0 -215
- package/dist/_chunks/gestational-age-calculator-CWOG3bkI.js +0 -178
- package/dist/_chunks/insert-result-DtQQeSSf.js +0 -227
- package/dist/_chunks/react-day-picker-CdtIiKjx.js +0 -3174
- package/dist/_chunks/subDays-_T9YeKPX.js +0 -8
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import { F as
|
|
6
|
-
import { N as
|
|
7
|
-
import { S as
|
|
8
|
-
import { I as
|
|
9
|
-
const
|
|
2
|
+
import { forwardRef as A, useState as v, useMemo as T, useEffect as H } from "react";
|
|
3
|
+
import { c as Y } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as j } from "react-i18next";
|
|
5
|
+
import { F as p } from "./form-field-BOm9hK35.js";
|
|
6
|
+
import { N as B } from "./number-input-Dj5L3pXK.js";
|
|
7
|
+
import { S as C } from "./select-hsCaJSX3.js";
|
|
8
|
+
import { I as L } from "./insert-result-CoC1oo6R.js";
|
|
9
|
+
const _ = {
|
|
10
10
|
// weight → base kg
|
|
11
11
|
kg: { id: "kg", category: "weight", factor: 1, offset: 0 },
|
|
12
12
|
g: { id: "g", category: "weight", factor: 1e-3, offset: 0 },
|
|
@@ -23,19 +23,19 @@ const F = {
|
|
|
23
23
|
// glucose → base mmol/L (1 mg/dL = 1/18.0156 mmol/L)
|
|
24
24
|
mmol_l: { id: "mmol_l", category: "glucose", factor: 1, offset: 0 },
|
|
25
25
|
mg_dl: { id: "mg_dl", category: "glucose", factor: 1 / 18.0156, offset: 0 }
|
|
26
|
-
},
|
|
26
|
+
}, h = {
|
|
27
27
|
weight: ["kg", "g", "lb", "oz"],
|
|
28
28
|
length: ["cm", "m", "in", "ft"],
|
|
29
29
|
temperature: ["c", "f"],
|
|
30
30
|
glucose: ["mmol_l", "mg_dl"]
|
|
31
|
-
},
|
|
31
|
+
}, D = [
|
|
32
32
|
"weight",
|
|
33
33
|
"length",
|
|
34
34
|
"temperature",
|
|
35
35
|
"glucose"
|
|
36
36
|
];
|
|
37
|
-
function
|
|
38
|
-
const o =
|
|
37
|
+
function K(c, r, f) {
|
|
38
|
+
const o = _[r], n = _[f];
|
|
39
39
|
if (!o || !n) throw new Error(`Unknown unit: ${r} → ${f}`);
|
|
40
40
|
if (o.category !== n.category)
|
|
41
41
|
throw new Error(
|
|
@@ -43,113 +43,124 @@ function M(c, r, f) {
|
|
|
43
43
|
);
|
|
44
44
|
return (c * o.factor + o.offset - n.offset) / n.factor;
|
|
45
45
|
}
|
|
46
|
-
const
|
|
46
|
+
const M = Y("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
47
47
|
variants: {
|
|
48
48
|
width: { full: "ds:w-full", auto: "ds:inline-flex" }
|
|
49
49
|
},
|
|
50
50
|
defaultVariants: { width: "full" }
|
|
51
|
-
}),
|
|
51
|
+
}), q = {
|
|
52
|
+
weight: "--info",
|
|
53
|
+
length: "--success",
|
|
54
|
+
temperature: "--warning",
|
|
55
|
+
glucose: "--accent"
|
|
56
|
+
}, J = A(
|
|
52
57
|
({
|
|
53
58
|
defaultCategory: c = "weight",
|
|
54
59
|
onResultChange: r,
|
|
55
60
|
onInsert: f,
|
|
56
61
|
insertVariant: o = "insert",
|
|
57
62
|
onCopy: n,
|
|
58
|
-
onError:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
onError: b,
|
|
64
|
+
insertBrand: E,
|
|
65
|
+
id: F,
|
|
66
|
+
width: U,
|
|
67
|
+
className: O
|
|
68
|
+
}, S) => {
|
|
69
|
+
const { t, i18n: $ } = j(), [g, k] = v(c), [i, G] = v(null), [u, w] = v(
|
|
70
|
+
h[c][0]
|
|
71
|
+
), [l, N] = v(
|
|
72
|
+
h[c][1]
|
|
73
|
+
), V = (s) => {
|
|
74
|
+
const I = s, y = h[I];
|
|
75
|
+
k(I), w(y[0]), N(y[1] ?? y[0]);
|
|
76
|
+
}, a = T(
|
|
77
|
+
() => i === null ? null : K(i, u, l),
|
|
78
|
+
[i, u, l]
|
|
79
|
+
), m = T(
|
|
80
|
+
() => new Intl.NumberFormat($.language, { maximumFractionDigits: 3 }),
|
|
81
|
+
[$.language]
|
|
76
82
|
);
|
|
77
|
-
|
|
83
|
+
H(() => {
|
|
78
84
|
r == null || r(a);
|
|
79
85
|
}, [a, r]);
|
|
80
|
-
const z =
|
|
86
|
+
const z = D.map((s) => ({
|
|
81
87
|
value: s,
|
|
82
88
|
label: t(`unitConverter.category.${s}`)
|
|
83
|
-
})),
|
|
89
|
+
})), x = h[g].map((s) => ({
|
|
84
90
|
value: s,
|
|
85
91
|
label: t(`unitConverter.units.${s}`)
|
|
86
92
|
}));
|
|
87
93
|
return /* @__PURE__ */ d(
|
|
88
94
|
"div",
|
|
89
95
|
{
|
|
90
|
-
ref:
|
|
96
|
+
ref: S,
|
|
91
97
|
"data-component": "unit-converter",
|
|
92
|
-
"data-component-id":
|
|
93
|
-
className:
|
|
98
|
+
"data-component-id": F,
|
|
99
|
+
className: M({ width: U, className: O }),
|
|
94
100
|
children: [
|
|
95
|
-
/* @__PURE__ */ e(
|
|
96
|
-
|
|
101
|
+
/* @__PURE__ */ e(p, { label: t("unitConverter.categoryLabel"), children: /* @__PURE__ */ e(
|
|
102
|
+
C,
|
|
97
103
|
{
|
|
98
104
|
options: z,
|
|
99
|
-
value:
|
|
100
|
-
onValueChange:
|
|
105
|
+
value: g,
|
|
106
|
+
onValueChange: V
|
|
101
107
|
}
|
|
102
108
|
) }),
|
|
103
109
|
/* @__PURE__ */ d("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-3", children: [
|
|
104
|
-
/* @__PURE__ */ e(
|
|
105
|
-
/* @__PURE__ */ e(
|
|
106
|
-
|
|
110
|
+
/* @__PURE__ */ e(p, { label: t("unitConverter.value"), children: /* @__PURE__ */ e(B, { mode: "decimal", value: i, onChange: G }) }),
|
|
111
|
+
/* @__PURE__ */ e(p, { label: t("unitConverter.from"), children: /* @__PURE__ */ e(
|
|
112
|
+
C,
|
|
107
113
|
{
|
|
108
|
-
options:
|
|
109
|
-
value:
|
|
114
|
+
options: x,
|
|
115
|
+
value: u,
|
|
110
116
|
onValueChange: w
|
|
111
117
|
}
|
|
112
118
|
) }),
|
|
113
|
-
/* @__PURE__ */ e(
|
|
114
|
-
|
|
119
|
+
/* @__PURE__ */ e(p, { label: t("unitConverter.to"), children: /* @__PURE__ */ e(
|
|
120
|
+
C,
|
|
115
121
|
{
|
|
116
|
-
options:
|
|
122
|
+
options: x,
|
|
117
123
|
value: l,
|
|
118
|
-
onValueChange:
|
|
124
|
+
onValueChange: N
|
|
119
125
|
}
|
|
120
126
|
) })
|
|
121
127
|
] }),
|
|
122
|
-
/* @__PURE__ */ e("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: a !== null ? `${
|
|
123
|
-
`unitConverter.units.${
|
|
124
|
-
)} = ${
|
|
128
|
+
/* @__PURE__ */ e("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: a !== null ? `${m.format(i ?? 0)} ${t(
|
|
129
|
+
`unitConverter.units.${u}`
|
|
130
|
+
)} = ${m.format(a)} ${t(
|
|
125
131
|
`unitConverter.units.${l}`
|
|
126
132
|
)}` : "" }),
|
|
127
133
|
a !== null ? /* @__PURE__ */ d("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
128
134
|
/* @__PURE__ */ e("span", { className: "type-label ds:text-muted-foreground", children: t("unitConverter.result") }),
|
|
129
135
|
/* @__PURE__ */ d("span", { className: "type-metric ds:text-foreground", children: [
|
|
130
|
-
|
|
136
|
+
m.format(a),
|
|
131
137
|
" ",
|
|
132
138
|
t(`unitConverter.units.${l}`)
|
|
133
139
|
] }),
|
|
134
140
|
o === "copy" || f ? /* @__PURE__ */ e(
|
|
135
|
-
|
|
141
|
+
L,
|
|
136
142
|
{
|
|
137
143
|
variant: o,
|
|
138
144
|
onInsert: f,
|
|
139
145
|
onCopy: n,
|
|
140
|
-
onError:
|
|
146
|
+
onError: b,
|
|
141
147
|
card: {
|
|
142
148
|
title: t("insert.title.unitConverter"),
|
|
149
|
+
highlight: t(`unitConverter.category.${g}`),
|
|
150
|
+
// Chip tints by measurement family so the inserted card
|
|
151
|
+
// signals the category at a glance.
|
|
152
|
+
highlightToken: q[g],
|
|
153
|
+
brand: E,
|
|
143
154
|
fields: [
|
|
144
155
|
{
|
|
145
156
|
label: t("unitConverter.from"),
|
|
146
|
-
value: `${
|
|
147
|
-
`unitConverter.units.${
|
|
157
|
+
value: `${m.format(i ?? 0)} ${t(
|
|
158
|
+
`unitConverter.units.${u}`
|
|
148
159
|
)}`
|
|
149
160
|
},
|
|
150
161
|
{
|
|
151
162
|
label: t("unitConverter.to"),
|
|
152
|
-
value: `${
|
|
163
|
+
value: `${m.format(a)} ${t(
|
|
153
164
|
`unitConverter.units.${l}`
|
|
154
165
|
)}`
|
|
155
166
|
}
|
|
@@ -163,12 +174,12 @@ const q = B("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
163
174
|
);
|
|
164
175
|
}
|
|
165
176
|
);
|
|
166
|
-
|
|
177
|
+
J.displayName = "UnitConverter";
|
|
167
178
|
export {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
179
|
+
D as C,
|
|
180
|
+
_ as U,
|
|
181
|
+
h as a,
|
|
182
|
+
J as b,
|
|
183
|
+
K as c
|
|
173
184
|
};
|
|
174
|
-
//# sourceMappingURL=unit-converter-
|
|
185
|
+
//# sourceMappingURL=unit-converter-Ds9jalbN.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as u } from "./isSameWeek-
|
|
1
|
+
import { q as s, r as i, v as o, w as m } from "./date-picker-variants-DLi1Va_e.js";
|
|
2
|
+
import { i as u } from "./isSameWeek-HfxKk6Lz.js";
|
|
3
3
|
const c = {
|
|
4
4
|
lessThanXSeconds: {
|
|
5
5
|
one: "不到 1 秒",
|
|
@@ -385,4 +385,4 @@ const b = {
|
|
|
385
385
|
export {
|
|
386
386
|
Q as zhCN
|
|
387
387
|
};
|
|
388
|
-
//# sourceMappingURL=zh-CN-
|
|
388
|
+
//# sourceMappingURL=zh-CN-De4zwEhx.js.map
|
package/dist/agent-catalog.json
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ClassNames } from 'react-day-picker';
|
|
2
|
+
/**
|
|
3
|
+
* Partial class-name map passed to every `<DayPicker classNames=…>` in the
|
|
4
|
+
* kit. Keyed by the rdp v9 enums so a future rdp upgrade surfaces missing
|
|
5
|
+
* keys at the type level.
|
|
6
|
+
*/
|
|
7
|
+
export declare const calendarClassNames: Partial<ClassNames>;
|
|
8
|
+
//# sourceMappingURL=calendar-class-names.d.ts.map
|
|
@@ -2,6 +2,7 @@ export { composeRefs } from './compose-refs';
|
|
|
2
2
|
export { isSafeImageSrc, safeImageSrc } from './safe-image-src';
|
|
3
3
|
export { SafeHtml, sanitiseHtml, type SafeHtmlProfile, type SafeHtmlProps, } from './safe-html';
|
|
4
4
|
export { groupOptions } from './group-options';
|
|
5
|
+
export { InsertButton, buildResultText, buildResultHtml, buildResultCardSvg, svgCardToPngDataUri, svgCardToPng, type InsertButtonProps, type InsertVariant, type InsertPayload, type InsertPngResult, type InsertMode, type InsertCardData, type InsertCardField, type InsertCardGauge, type SvgCardToPngOptions, } from './insert-result';
|
|
5
6
|
export { normalizeDiacritics } from './normalize-diacritics';
|
|
6
7
|
export { useDebouncedCallback } from './use-debounced-callback';
|
|
7
8
|
export { useFocusTrap, type UseFocusTrapOptions } from './use-focus-trap';
|
|
@@ -11,6 +12,7 @@ export { INPUT_SURFACE_CHROME, INPUT_SURFACE_TONE, INPUT_SURFACE_HEIGHT, INPUT_S
|
|
|
11
12
|
export { getDateFnsLocale, getShortDateFormat, useDateFnsLocale, } from './date-locale';
|
|
12
13
|
export { buildDisabledMatcher } from './date-utils';
|
|
13
14
|
export { CalendarChevron } from './calendar-chevron';
|
|
15
|
+
export { calendarClassNames } from './calendar-class-names';
|
|
14
16
|
export { triggerVariants, calendarIconVariants, popoverContentVariants, presetButtonVariants, } from './date-picker-variants';
|
|
15
17
|
export type { OptionShape } from './option';
|
|
16
18
|
export type { TimeValue } from './time';
|
|
@@ -1,16 +1,66 @@
|
|
|
1
|
+
import { type ButtonProps } from '../button';
|
|
1
2
|
export type InsertMode = 'text' | 'image' | 'text-image';
|
|
2
3
|
export type InsertVariant = 'insert' | 'copy';
|
|
3
4
|
export interface InsertCardField {
|
|
4
5
|
label: string;
|
|
5
6
|
value: string;
|
|
6
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Optional radial gauge, drawn as a hand-rolled native-SVG donut (track
|
|
10
|
+
* `<circle>` + value arc via `stroke-dasharray`) so it survives the
|
|
11
|
+
* `<img>` → `<canvas>` → `toBlob` raster. No `<foreignObject>`, no charting lib.
|
|
12
|
+
*/
|
|
13
|
+
export interface InsertCardGauge {
|
|
14
|
+
/** Big number rendered in the gauge centre (e.g. `'22.4'`). */
|
|
15
|
+
value: string;
|
|
16
|
+
/**
|
|
17
|
+
* Filled fraction of the ring, `0`–`1`. Takes precedence when supplied;
|
|
18
|
+
* otherwise derived from a `value`/`max` numeric parse (falling back to a
|
|
19
|
+
* full ring when neither is numeric).
|
|
20
|
+
*/
|
|
21
|
+
fraction?: number;
|
|
22
|
+
/** Denominator used to derive `fraction` when `fraction` is omitted. */
|
|
23
|
+
max?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Number of evenly-spaced segment gaps to notch into the ring (e.g. `4` for
|
|
26
|
+
* a quartered dial). `0`/omitted draws a continuous arc.
|
|
27
|
+
*/
|
|
28
|
+
segments?: number;
|
|
29
|
+
/**
|
|
30
|
+
* DS token NAME for the arc colour — e.g. `'--success'`, `'--warning'`,
|
|
31
|
+
* `'--destructive'`, `'--info'`, or the light-orange overweight override.
|
|
32
|
+
* Resolved to a concrete colour from a probe span at raster time; never a
|
|
33
|
+
* hex literal in source.
|
|
34
|
+
*/
|
|
35
|
+
colorToken: string;
|
|
36
|
+
/** Small category label under the value inside the ring. */
|
|
37
|
+
label?: string;
|
|
38
|
+
}
|
|
7
39
|
export interface InsertCardData {
|
|
8
40
|
/** Card heading. */
|
|
9
41
|
title: string;
|
|
10
42
|
/** Key/value rows. */
|
|
11
43
|
fields: InsertCardField[];
|
|
12
|
-
/** Optional highlighted line
|
|
44
|
+
/** Optional highlighted line, rendered as a category chip (pill). */
|
|
13
45
|
highlight?: string;
|
|
46
|
+
/**
|
|
47
|
+
* DS token NAME for the highlight chip fill. Defaults to the accent token
|
|
48
|
+
* (`--primary`). The chip text uses the matching `<token>-foreground` when it
|
|
49
|
+
* resolves, else falls back to the card background for contrast.
|
|
50
|
+
*/
|
|
51
|
+
highlightToken?: string;
|
|
52
|
+
/** Optional radial gauge drawn natively in the card. */
|
|
53
|
+
gauge?: InsertCardGauge;
|
|
54
|
+
/**
|
|
55
|
+
* Brand wordmark printed in the card footer.
|
|
56
|
+
*
|
|
57
|
+
* - omitted → the default `'AlfaDocs'` wordmark.
|
|
58
|
+
* - a string → that custom wordmark.
|
|
59
|
+
* - `false` → no brand line at all.
|
|
60
|
+
*
|
|
61
|
+
* A `brand` passed to {@link SvgCardToPngOptions} overrides this per-render.
|
|
62
|
+
*/
|
|
63
|
+
brand?: string | false;
|
|
14
64
|
}
|
|
15
65
|
export interface InsertPayload {
|
|
16
66
|
/** Which button the user chose. */
|
|
@@ -19,10 +69,48 @@ export interface InsertPayload {
|
|
|
19
69
|
text: string;
|
|
20
70
|
/** Rich HTML summary (heading + list). Always present. */
|
|
21
71
|
html: string;
|
|
22
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Branded SVG result-card markup. Empty for mode `'text'`.
|
|
74
|
+
*
|
|
75
|
+
* Kept for back-compat and for callers that need the live, copy-pasteable
|
|
76
|
+
* vector. NOTE: SVG can carry `<script>` and is routinely stripped by
|
|
77
|
+
* rich-text sanitisers, so it is NOT the format to insert into an editor —
|
|
78
|
+
* use {@link InsertPayload.pngDataUri} for that.
|
|
79
|
+
*/
|
|
23
80
|
svg: string;
|
|
24
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* SVG as an `image/svg+xml` data URI for `<img src>`. Empty for `'text'`.
|
|
83
|
+
*
|
|
84
|
+
* Same caveat as {@link InsertPayload.svg}: fine for a preview `<img>`, but a
|
|
85
|
+
* sanitiser-stripped vector once it reaches an editor. Prefer
|
|
86
|
+
* {@link InsertPayload.pngDataUri}.
|
|
87
|
+
*/
|
|
25
88
|
imageDataUri: string;
|
|
89
|
+
/**
|
|
90
|
+
* Async thunk that resolves the result-card raster — the format intended for
|
|
91
|
+
* editor insertion. PNG is a flat raster: it carries no script and survives
|
|
92
|
+
* the rich-text sanitiser that strips SVG.
|
|
93
|
+
*
|
|
94
|
+
* Resolves to `{ dataUri, width, height }` where `width`/`height` are the
|
|
95
|
+
* **logical (un-scaled) CSS pixel** dimensions: set them on the inserted
|
|
96
|
+
* `<img width height>` and the supersampled (`>= 2×`) PNG renders crisp with
|
|
97
|
+
* no consumer-side shim. For mode `'text'` resolves to an empty
|
|
98
|
+
* `{ dataUri: '', width: 0, height: 0 }`. Rendered lazily so the synchronous
|
|
99
|
+
* payload stays cheap; `await payload.pngDataUri()` only when you need it.
|
|
100
|
+
*
|
|
101
|
+
* @since 0.43.0 — this return shape changed from a bare `Promise<string>` to
|
|
102
|
+
* `Promise<{ dataUri; width; height }>` (see CHANGELOG).
|
|
103
|
+
*/
|
|
104
|
+
pngDataUri: () => Promise<InsertPngResult>;
|
|
105
|
+
}
|
|
106
|
+
/** Resolved PNG raster plus its logical (un-scaled) `<img>` dimensions. */
|
|
107
|
+
export interface InsertPngResult {
|
|
108
|
+
/** `image/png` data URI, or `''` for the text-only mode. */
|
|
109
|
+
dataUri: string;
|
|
110
|
+
/** Logical (CSS px) width to set on the inserted `<img>`. `0` when empty. */
|
|
111
|
+
width: number;
|
|
112
|
+
/** Logical (CSS px) height to set on the inserted `<img>`. `0` when empty. */
|
|
113
|
+
height: number;
|
|
26
114
|
}
|
|
27
115
|
export interface InsertButtonProps {
|
|
28
116
|
/** Structured result used to build every payload representation. */
|
|
@@ -47,6 +135,12 @@ export interface InsertButtonProps {
|
|
|
47
135
|
onError?: (error: unknown) => void;
|
|
48
136
|
/** Trigger size. Defaults to `'sm'`. */
|
|
49
137
|
size?: 'sm' | 'md' | 'lg';
|
|
138
|
+
/**
|
|
139
|
+
* Visual intent of the three trigger buttons (text / image / text+image).
|
|
140
|
+
* Mirrors the `Button` `intent` prop and applies to every trigger uniformly
|
|
141
|
+
* so the three stay visually consistent. Defaults to `'primary'`.
|
|
142
|
+
*/
|
|
143
|
+
intent?: ButtonProps['intent'];
|
|
50
144
|
}
|
|
51
145
|
interface ThemeColours {
|
|
52
146
|
fg: string;
|
|
@@ -55,10 +149,61 @@ interface ThemeColours {
|
|
|
55
149
|
border: string;
|
|
56
150
|
bg: string;
|
|
57
151
|
font: string;
|
|
152
|
+
/**
|
|
153
|
+
* Concrete colours resolved from arbitrary DS token names, keyed by the token
|
|
154
|
+
* name the caller passed (e.g. `'--success'`). Populated for the gauge arc
|
|
155
|
+
* and the highlight chip; consulted by {@link buildResultCardSvg} via
|
|
156
|
+
* {@link resolveToken}.
|
|
157
|
+
*/
|
|
158
|
+
tokens?: Record<string, string>;
|
|
58
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Internal resolved-colour shape, re-exported for tests that construct a card
|
|
162
|
+
* raster without a live DOM probe. Not part of the public component API.
|
|
163
|
+
*/
|
|
164
|
+
export type ThemeColoursForTest = ThemeColours;
|
|
59
165
|
export declare function buildResultText(card: InsertCardData): string;
|
|
60
166
|
export declare function buildResultHtml(card: InsertCardData): string;
|
|
61
|
-
export declare function buildResultCardSvg(card: InsertCardData, c: ThemeColours): string;
|
|
167
|
+
export declare function buildResultCardSvg(card: InsertCardData, c: ThemeColours, brand?: string | false): string;
|
|
168
|
+
/** Options for {@link svgCardToPngDataUri}. */
|
|
169
|
+
export interface SvgCardToPngOptions {
|
|
170
|
+
/**
|
|
171
|
+
* Resolved theme colours to paint into the card. When omitted, the card
|
|
172
|
+
* renders with `currentColor` / transparent fallbacks (see
|
|
173
|
+
* {@link buildResultCardSvg}) — pass sampled colours for a branded raster.
|
|
174
|
+
*/
|
|
175
|
+
colours?: ThemeColours;
|
|
176
|
+
/**
|
|
177
|
+
* Device-pixel scale factor for the raster. `2` yields a retina-sharp PNG.
|
|
178
|
+
* Defaults to `Math.max(2, devicePixelRatio)` so the inserted image is crisp
|
|
179
|
+
* without a consumer-side supersampling shim.
|
|
180
|
+
*/
|
|
181
|
+
scale?: number;
|
|
182
|
+
/**
|
|
183
|
+
* Brand wordmark for the footer. Omitted → the card's own `brand` (then the
|
|
184
|
+
* default `'AlfaDocs'`); a string overrides it; `false` removes it.
|
|
185
|
+
*/
|
|
186
|
+
brand?: string | false;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Render an {@link InsertCardData} result card to an `image/png` data URI.
|
|
190
|
+
*
|
|
191
|
+
* This is the format intended for editor insertion: a flat raster carries no
|
|
192
|
+
* `<script>` and survives the rich-text sanitiser that strips inline SVG. The
|
|
193
|
+
* card is built as SVG, loaded into an `<img>`, painted onto a canvas at the
|
|
194
|
+
* card's intrinsic size (optionally scaled), and read back as `image/png`.
|
|
195
|
+
*
|
|
196
|
+
* Browser-only — relies on `Image`, `<canvas>`, and `canvas.toBlob`. Throws if
|
|
197
|
+
* called in a non-DOM context or if the SVG fails to decode.
|
|
198
|
+
*/
|
|
199
|
+
export declare function svgCardToPngDataUri(card: InsertCardData, opts?: SvgCardToPngOptions): Promise<string>;
|
|
200
|
+
/**
|
|
201
|
+
* Like {@link svgCardToPngDataUri} but also returns the **logical (un-scaled)**
|
|
202
|
+
* card dimensions so consumers can size the inserted `<img width height>` and
|
|
203
|
+
* drop their own supersampling shim. The PNG itself is rasterised at `scale`
|
|
204
|
+
* (default `Math.max(2, devicePixelRatio)`) for crispness.
|
|
205
|
+
*/
|
|
206
|
+
export declare function svgCardToPng(card: InsertCardData, opts?: SvgCardToPngOptions): Promise<InsertPngResult>;
|
|
62
207
|
export declare const InsertButton: import("react").ForwardRefExoticComponent<InsertButtonProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
63
208
|
export {};
|
|
64
209
|
//# sourceMappingURL=insert-result.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
declare const badgeVariants: (props?: ({
|
|
4
|
-
variant?: "error" | "neutral" | "info" | "success" | "warning" | "brand" |
|
|
4
|
+
variant?: "error" | "accent" | "neutral" | "info" | "success" | "warning" | "brand" | null | undefined;
|
|
5
5
|
size?: "sm" | "md" | "lg" | null | undefined;
|
|
6
6
|
shape?: "pill" | "rectangular" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -27,6 +27,12 @@ export interface BmiCalculatorProps extends VariantProps<typeof rootVariants> {
|
|
|
27
27
|
onCopy?: (mode: InsertMode) => void;
|
|
28
28
|
/** `copy` variant only — fired if the clipboard write can't proceed. */
|
|
29
29
|
onError?: (error: unknown) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Brand wordmark printed in the inserted/copied result-card footer.
|
|
32
|
+
* Omitted → the default `'AlfaDocs'` wordmark; a string overrides it;
|
|
33
|
+
* `false` removes the brand line.
|
|
34
|
+
*/
|
|
35
|
+
insertBrand?: string | false;
|
|
30
36
|
/** Opaque instance id, emitted as `data-component-id`. */
|
|
31
37
|
id?: string;
|
|
32
38
|
/** Extra class names on the wrapper. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as m } from "../../_chunks/bmi-calculator-
|
|
1
|
+
import { B as m } from "../../_chunks/bmi-calculator-DFPWL2OJ.js";
|
|
2
2
|
import { b as e, a as t, c as r, d as T, e as c, f as i, i as b, k as n, l as f } from "../../_chunks/bmi-BxD-tFzU.js";
|
|
3
3
|
export {
|
|
4
4
|
m as BmiCalculator,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
declare const cardVariants: (props?: ({
|
|
4
|
-
variant?: "default" | "
|
|
4
|
+
variant?: "default" | "outlined" | "elevated" | null | undefined;
|
|
5
5
|
interactive?: boolean | null | undefined;
|
|
6
6
|
stretch?: boolean | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -29,6 +29,16 @@ export interface ChartProps extends VariantProps<typeof chartVariants> {
|
|
|
29
29
|
width?: number | string;
|
|
30
30
|
/** Opt-in pattern fills for colour-blind users. */
|
|
31
31
|
patterns?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Override the series colour ramp. Pass **already-resolved** colour strings
|
|
34
|
+
* (e.g. the live value of `var(--success)` sampled by the consumer) — these
|
|
35
|
+
* are handed straight to ApexCharts, which can't read CSS custom properties.
|
|
36
|
+
* When omitted, the theme bridge's `colors` ramp from `apexcharts-theme.ts`
|
|
37
|
+
* is used, so existing consumers are unaffected. Typical use: a single-arc
|
|
38
|
+
* `radialBar` gauge (e.g. BMI) that must change hue with the value —
|
|
39
|
+
* green in the healthy band, amber/red outside it.
|
|
40
|
+
*/
|
|
41
|
+
colors?: string[];
|
|
32
42
|
/** Show the ApexCharts toolbar. Defaults to false. */
|
|
33
43
|
toolbar?: boolean;
|
|
34
44
|
/** Locale override — defaults to the active i18next language. */
|
|
@@ -21,6 +21,12 @@ export interface CycleCalculatorProps extends VariantProps<typeof rootVariants>
|
|
|
21
21
|
onCopy?: (mode: InsertMode) => void;
|
|
22
22
|
/** `copy` variant only — fired if the clipboard write can't proceed. */
|
|
23
23
|
onError?: (error: unknown) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Brand wordmark printed in the inserted/copied result-card footer.
|
|
26
|
+
* Omitted → the default `'AlfaDocs'` wordmark; a string overrides it;
|
|
27
|
+
* `false` removes the brand line.
|
|
28
|
+
*/
|
|
29
|
+
insertBrand?: string | false;
|
|
24
30
|
/** Opaque instance id, emitted as `data-component-id`. */
|
|
25
31
|
id?: string;
|
|
26
32
|
/** Extra class names on the wrapper. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as l, B as r, C as t, a as s, D as n, b as d, c as i, d as o, E as C, e as R, I as F, L as g, N as T, f as b, S as u, g as c, h as D, T as m, i as p, j as x, k as f, l as y, m as E, n as S, o as h, U as A, p as L, q as N, u as k } from "../../_chunks/editable-currency-cell-renderer-
|
|
1
|
+
import { A as l, B as r, C as t, a as s, D as n, b as d, c as i, d as o, E as C, e as R, I as F, L as g, N as T, f as b, S as u, g as c, h as D, T as m, i as p, j as x, k as f, l as y, m as E, n as S, o as h, U as A, p as L, q as N, u as k } from "../../_chunks/editable-currency-cell-renderer-9jqwDv5x.js";
|
|
2
2
|
export {
|
|
3
3
|
l as ActionsCellRenderer,
|
|
4
4
|
r as BalanceCellRenderer,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
import { triggerVariants } from '../_shared';
|
|
3
|
-
import '../../tokens/themes/bridges/react-day-picker.css';
|
|
4
3
|
/** Curated imperative handle exposed via `ref` — also consumed by the agent adapter. */
|
|
5
4
|
export interface DatePickerHandle {
|
|
6
5
|
/** Get the current selected date, or undefined. */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
import { triggerVariants } from '../_shared';
|
|
3
|
-
import '../../tokens/themes/bridges/react-day-picker.css';
|
|
4
3
|
/** Curated imperative handle exposed via `ref` — also consumed by the agent adapter. */
|
|
5
4
|
export interface DateTimePickerHandle {
|
|
6
5
|
/** Get the current selected datetime, or undefined. */
|