@alfadocs/ui-kit 0.43.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.
- package/dist/_chunks/{alia-sidebar-BpX4z_af.js → alia-sidebar-Be8FhKYd.js} +332 -237
- package/dist/_chunks/{autocomplete-DIgdhCGJ.js → autocomplete-CDqxB68B.js} +2 -2
- package/dist/_chunks/bmi-calculator-CQqXTVNL.js +258 -0
- package/dist/_chunks/{booking-CtLwaxkK.js → booking-DlDVuWMd.js} +2 -2
- package/dist/_chunks/{calculator-dialog-DdexHrTP.js → calculator-dialog-D-nfvteH.js} +2 -2
- package/dist/_chunks/{cycle-calculator-Dln-y1k_.js → cycle-calculator-KxA8dqDf.js} +73 -54
- package/dist/_chunks/dialog-BTpZV6It.js +223 -0
- package/dist/_chunks/{due-date-calculator-Cc4dRqTI.js → due-date-calculator-mFxpHLml.js} +73 -49
- package/dist/_chunks/{editable-currency-cell-renderer-9jqwDv5x.js → editable-currency-cell-renderer-BEBUQl9P.js} +2 -2
- package/dist/_chunks/{freemium-paywall-BLXESpH4.js → freemium-paywall-BYist2sJ.js} +2 -2
- package/dist/_chunks/gestational-age-calculator-gWI_uRA1.js +203 -0
- package/dist/_chunks/insert-result-C5ABnzDl.js +711 -0
- package/dist/_chunks/{marketplace-app-shell-Dc5cTIt8.js → marketplace-app-shell-Gfsf78ge.js} +2 -2
- package/dist/_chunks/{patient-search-DPe2ZYEL.js → patient-search-CocVcGJ3.js} +2 -2
- package/dist/_chunks/{payment-form-BzVsG6Ks.js → payment-form-DqEiEJRO.js} +247 -195
- package/dist/_chunks/{pdf-viewer-B6MC6VTx.js → pdf-viewer-CWEXTlwq.js} +2 -2
- package/dist/_chunks/{practice-results-CrLpEiiW.js → practice-results-DDi-kvaD.js} +2 -2
- package/dist/_chunks/{pregnancy-weight-gain-zZL5Ir2-.js → pregnancy-weight-gain-BtEHaSqy.js} +78 -56
- package/dist/_chunks/{search-bar-CP6wUJFY.js → search-bar-CvN_S0jW.js} +2 -2
- package/dist/_chunks/{search-input-C1C3jQpD.js → search-input-D3aMvi4l.js} +2 -2
- package/dist/_chunks/{sign-document-B-3k_0LO.js → sign-document-BCyLpFHJ.js} +2 -2
- package/dist/_chunks/{sign-in-with-alfadocs-button-DeHBFRNS.js → sign-in-with-alfadocs-button-CuYn_kKP.js} +2 -2
- package/dist/_chunks/{social-sign-in-button-X54ySJr1.js → social-sign-in-button-uJYLM366.js} +2 -2
- package/dist/_chunks/{spinner-CCByyvcb.js → spinner-OjQNn8oN.js} +7 -3
- package/dist/_chunks/{transcript-panel-CR7VY1uw.js → transcript-panel-B4HiC7ed.js} +2 -2
- package/dist/_chunks/{unit-converter-CuXCXJhK.js → unit-converter-u3CwNDpP.js} +96 -74
- package/dist/_chunks/{wallet-pay-button-DK4ESYge.js → wallet-pay-button-DuDPBlCO.js} +2 -2
- package/dist/agent-catalog.json +1 -1
- package/dist/components/_shared/banded-gauge.d.ts +193 -0
- package/dist/components/_shared/index.d.ts +1 -1
- package/dist/components/_shared/insert-result.d.ts +173 -10
- package/dist/components/autocomplete/index.js +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/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/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 +1 -1
- package/dist/components/freemium-paywall/index.js +1 -1
- 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/index.d.ts +1 -1
- package/dist/components/patient-search/index.js +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/payment-form/payment-form.d.ts +24 -2
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/practice-results/index.js +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/search-bar/index.js +1 -1
- package/dist/components/search-input/index.js +1 -1
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/sign-in-with-alfadocs-button/index.js +1 -1
- package/dist/components/social-sign-in-button/index.js +1 -1
- package/dist/components/spinner/index.js +1 -1
- package/dist/components/spinner/spinner.d.ts +2 -2
- package/dist/components/transcript-panel/index.js +1 -1
- package/dist/components/unit-converter/index.js +1 -1
- package/dist/components/unit-converter/unit-converter.d.ts +6 -0
- package/dist/components/wallet-pay-button/index.js +1 -1
- package/dist/i18n/locales/ar.d.ts +1 -1
- package/dist/i18n/locales/ar.js +1 -1
- package/dist/i18n/locales/de.d.ts +1 -1
- package/dist/i18n/locales/de.js +1 -1
- package/dist/i18n/locales/el.d.ts +1 -1
- package/dist/i18n/locales/el.js +1 -1
- package/dist/i18n/locales/en.d.ts +1 -1
- package/dist/i18n/locales/en.js +1 -1
- package/dist/i18n/locales/es.d.ts +1 -1
- package/dist/i18n/locales/es.js +1 -1
- package/dist/i18n/locales/fr.d.ts +1 -1
- package/dist/i18n/locales/fr.js +1 -1
- package/dist/i18n/locales/hi.d.ts +1 -1
- package/dist/i18n/locales/hi.js +1 -1
- package/dist/i18n/locales/it.d.ts +1 -1
- package/dist/i18n/locales/it.js +1 -1
- package/dist/i18n/locales/ja.d.ts +1 -1
- package/dist/i18n/locales/ja.js +1 -1
- package/dist/i18n/locales/nl.d.ts +1 -1
- package/dist/i18n/locales/nl.js +1 -1
- package/dist/i18n/locales/pl.d.ts +1 -1
- package/dist/i18n/locales/pl.js +1 -1
- package/dist/i18n/locales/pt.d.ts +1 -1
- package/dist/i18n/locales/pt.js +1 -1
- package/dist/i18n/locales/ro.d.ts +1 -1
- package/dist/i18n/locales/ro.js +1 -1
- package/dist/i18n/locales/ru.d.ts +1 -1
- package/dist/i18n/locales/ru.js +1 -1
- package/dist/i18n/locales/sq.d.ts +1 -1
- package/dist/i18n/locales/sq.js +1 -1
- package/dist/i18n/locales/sv.d.ts +1 -1
- package/dist/i18n/locales/sv.js +1 -1
- package/dist/i18n/locales/tr.d.ts +1 -1
- package/dist/i18n/locales/tr.js +1 -1
- package/dist/i18n/locales/zh.d.ts +1 -1
- package/dist/i18n/locales/zh.js +1 -1
- package/dist/index.js +497 -496
- package/dist/locales/ar.json +1 -1
- package/dist/locales/de.json +1 -1
- package/dist/locales/el.json +1 -1
- package/dist/locales/en.json +1 -1
- package/dist/locales/es.json +1 -1
- package/dist/locales/fr.json +1 -1
- package/dist/locales/hi.json +1 -1
- package/dist/locales/it.json +1 -1
- package/dist/locales/ja.json +1 -1
- package/dist/locales/nl.json +1 -1
- package/dist/locales/pl.json +1 -1
- package/dist/locales/pt.json +1 -1
- package/dist/locales/ro.json +1 -1
- package/dist/locales/ru.json +1 -1
- package/dist/locales/sq.json +1 -1
- package/dist/locales/sv.json +1 -1
- package/dist/locales/tr.json +1 -1
- package/dist/locales/zh.json +1 -1
- package/dist/patterns/alia-assistant/alia-types.d.ts +20 -0
- package/dist/patterns/alia-assistant/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/bmi-calculator-DuVSFDuw.js +0 -259
- package/dist/_chunks/dialog-DOYgd75U.js +0 -224
- package/dist/_chunks/gestational-age-calculator-ZMSrzkRW.js +0 -179
- package/dist/_chunks/insert-result-DisOY2G-.js +0 -243
|
@@ -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
|
|
2
|
+
import { forwardRef as z, useState as p, useMemo as I, useEffect as A } from "react";
|
|
3
|
+
import { c as Y } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as j } from "react-i18next";
|
|
5
5
|
import { F as v } from "./form-field-BOm9hK35.js";
|
|
6
|
-
import { N as
|
|
7
|
-
import { S as
|
|
8
|
-
import { I as
|
|
9
|
-
const
|
|
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-C5ABnzDl.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,133 +23,155 @@ 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 =
|
|
39
|
-
if (!o || !
|
|
40
|
-
if (o.category !==
|
|
37
|
+
function K(r, n, f) {
|
|
38
|
+
const o = _[n], a = _[f];
|
|
39
|
+
if (!o || !a) throw new Error(`Unknown unit: ${n} → ${f}`);
|
|
40
|
+
if (o.category !== a.category)
|
|
41
41
|
throw new Error(
|
|
42
|
-
`Cannot convert across categories: ${o.category} → ${
|
|
42
|
+
`Cannot convert across categories: ${o.category} → ${a.category}`
|
|
43
43
|
);
|
|
44
|
-
return (
|
|
44
|
+
return (r * o.factor + o.offset - a.offset) / a.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-readable",
|
|
55
|
+
glucose: "--accent"
|
|
56
|
+
};
|
|
57
|
+
function J(r) {
|
|
58
|
+
return q[r];
|
|
59
|
+
}
|
|
60
|
+
const P = z(
|
|
52
61
|
({
|
|
53
|
-
defaultCategory:
|
|
54
|
-
onResultChange:
|
|
62
|
+
defaultCategory: r = "weight",
|
|
63
|
+
onResultChange: n,
|
|
55
64
|
onInsert: f,
|
|
56
65
|
insertVariant: o = "insert",
|
|
57
|
-
onCopy:
|
|
58
|
-
onError:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
onCopy: a,
|
|
67
|
+
onError: b,
|
|
68
|
+
insertBrand: E,
|
|
69
|
+
id: F,
|
|
70
|
+
width: U,
|
|
71
|
+
className: k
|
|
72
|
+
}, O) => {
|
|
73
|
+
const { t, i18n: $ } = j(), [m, S] = p(r), [c, G] = p(null), [u, w] = p(
|
|
74
|
+
h[r][0]
|
|
75
|
+
), [l, N] = p(
|
|
76
|
+
h[r][1]
|
|
77
|
+
), V = (s) => {
|
|
78
|
+
const T = s, y = h[T];
|
|
79
|
+
S(T), w(y[0]), N(y[1] ?? y[0]);
|
|
80
|
+
}, i = I(
|
|
81
|
+
() => c === null ? null : K(c, u, l),
|
|
82
|
+
[c, u, l]
|
|
83
|
+
), g = I(
|
|
84
|
+
() => new Intl.NumberFormat($.language, { maximumFractionDigits: 3 }),
|
|
85
|
+
[$.language]
|
|
76
86
|
);
|
|
77
87
|
A(() => {
|
|
78
|
-
|
|
79
|
-
}, [
|
|
80
|
-
const
|
|
88
|
+
n == null || n(i);
|
|
89
|
+
}, [i, n]);
|
|
90
|
+
const H = D.map((s) => ({
|
|
81
91
|
value: s,
|
|
82
92
|
label: t(`unitConverter.category.${s}`)
|
|
83
|
-
})),
|
|
93
|
+
})), x = h[m].map((s) => ({
|
|
84
94
|
value: s,
|
|
85
95
|
label: t(`unitConverter.units.${s}`)
|
|
86
96
|
}));
|
|
87
97
|
return /* @__PURE__ */ d(
|
|
88
98
|
"div",
|
|
89
99
|
{
|
|
90
|
-
ref:
|
|
100
|
+
ref: O,
|
|
91
101
|
"data-component": "unit-converter",
|
|
92
|
-
"data-component-id":
|
|
93
|
-
className:
|
|
102
|
+
"data-component-id": F,
|
|
103
|
+
className: M({ width: U, className: k }),
|
|
94
104
|
children: [
|
|
95
105
|
/* @__PURE__ */ e(v, { label: t("unitConverter.categoryLabel"), children: /* @__PURE__ */ e(
|
|
96
|
-
|
|
106
|
+
C,
|
|
97
107
|
{
|
|
98
|
-
options:
|
|
99
|
-
value:
|
|
100
|
-
onValueChange:
|
|
108
|
+
options: H,
|
|
109
|
+
value: m,
|
|
110
|
+
onValueChange: V
|
|
101
111
|
}
|
|
102
112
|
) }),
|
|
103
113
|
/* @__PURE__ */ d("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-3", children: [
|
|
104
|
-
/* @__PURE__ */ e(v, { label: t("unitConverter.value"), children: /* @__PURE__ */ e(
|
|
114
|
+
/* @__PURE__ */ e(v, { label: t("unitConverter.value"), children: /* @__PURE__ */ e(B, { mode: "decimal", value: c, onChange: G }) }),
|
|
105
115
|
/* @__PURE__ */ e(v, { label: t("unitConverter.from"), children: /* @__PURE__ */ e(
|
|
106
|
-
|
|
116
|
+
C,
|
|
107
117
|
{
|
|
108
|
-
options:
|
|
109
|
-
value:
|
|
118
|
+
options: x,
|
|
119
|
+
value: u,
|
|
110
120
|
onValueChange: w
|
|
111
121
|
}
|
|
112
122
|
) }),
|
|
113
123
|
/* @__PURE__ */ e(v, { label: t("unitConverter.to"), children: /* @__PURE__ */ e(
|
|
114
|
-
|
|
124
|
+
C,
|
|
115
125
|
{
|
|
116
|
-
options:
|
|
126
|
+
options: x,
|
|
117
127
|
value: l,
|
|
118
|
-
onValueChange:
|
|
128
|
+
onValueChange: N
|
|
119
129
|
}
|
|
120
130
|
) })
|
|
121
131
|
] }),
|
|
122
|
-
/* @__PURE__ */ e("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children:
|
|
123
|
-
`unitConverter.units.${
|
|
124
|
-
)} = ${
|
|
132
|
+
/* @__PURE__ */ e("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: i !== null ? `${g.format(c ?? 0)} ${t(
|
|
133
|
+
`unitConverter.units.${u}`
|
|
134
|
+
)} = ${g.format(i)} ${t(
|
|
125
135
|
`unitConverter.units.${l}`
|
|
126
136
|
)}` : "" }),
|
|
127
|
-
|
|
137
|
+
i !== null ? /* @__PURE__ */ d("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
128
138
|
/* @__PURE__ */ e("span", { className: "type-label ds:text-muted-foreground", children: t("unitConverter.result") }),
|
|
129
139
|
/* @__PURE__ */ d("span", { className: "type-metric ds:text-foreground", children: [
|
|
130
|
-
|
|
140
|
+
g.format(i),
|
|
131
141
|
" ",
|
|
132
142
|
t(`unitConverter.units.${l}`)
|
|
133
143
|
] }),
|
|
134
144
|
o === "copy" || f ? /* @__PURE__ */ e(
|
|
135
|
-
|
|
145
|
+
L,
|
|
136
146
|
{
|
|
137
147
|
variant: o,
|
|
138
148
|
onInsert: f,
|
|
139
|
-
onCopy:
|
|
140
|
-
onError:
|
|
149
|
+
onCopy: a,
|
|
150
|
+
onError: b,
|
|
141
151
|
card: {
|
|
142
152
|
title: t("insert.title.unitConverter"),
|
|
153
|
+
icon: "ruler",
|
|
154
|
+
highlight: t(`unitConverter.category.${m}`),
|
|
155
|
+
// Chip tints by measurement family so the inserted card
|
|
156
|
+
// signals the category at a glance — with the contrast-safe
|
|
157
|
+
// orange override for the `--warning` temperature family.
|
|
158
|
+
highlightToken: J(m),
|
|
159
|
+
brand: E,
|
|
143
160
|
fields: [
|
|
144
161
|
{
|
|
162
|
+
// Source measurement → ruler glyph (matches the header).
|
|
163
|
+
icon: "ruler",
|
|
145
164
|
label: t("unitConverter.from"),
|
|
146
|
-
value: `${
|
|
147
|
-
`unitConverter.units.${
|
|
165
|
+
value: `${g.format(c ?? 0)} ${t(
|
|
166
|
+
`unitConverter.units.${u}`
|
|
148
167
|
)}`
|
|
149
168
|
},
|
|
150
169
|
{
|
|
170
|
+
// Converted result → trending-up (arrow) glyph signals the
|
|
171
|
+
// conversion direction to the output value.
|
|
172
|
+
icon: "trending-up",
|
|
151
173
|
label: t("unitConverter.to"),
|
|
152
|
-
value: `${
|
|
174
|
+
value: `${g.format(i)} ${t(
|
|
153
175
|
`unitConverter.units.${l}`
|
|
154
176
|
)}`
|
|
155
177
|
}
|
|
@@ -163,12 +185,12 @@ const q = B("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
163
185
|
);
|
|
164
186
|
}
|
|
165
187
|
);
|
|
166
|
-
|
|
188
|
+
P.displayName = "UnitConverter";
|
|
167
189
|
export {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
190
|
+
D as C,
|
|
191
|
+
_ as U,
|
|
192
|
+
h as a,
|
|
193
|
+
P as b,
|
|
194
|
+
K as c
|
|
173
195
|
};
|
|
174
|
-
//# sourceMappingURL=unit-converter-
|
|
196
|
+
//# sourceMappingURL=unit-converter-u3CwNDpP.js.map
|
|
@@ -2,7 +2,7 @@ import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef as B } from "react";
|
|
3
3
|
import { c as S } from "./index-D2ZczOXr.js";
|
|
4
4
|
import { useTranslation as H } from "react-i18next";
|
|
5
|
-
import { S as P } from "./spinner-
|
|
5
|
+
import { S as P } from "./spinner-OjQNn8oN.js";
|
|
6
6
|
function V({ className: a }) {
|
|
7
7
|
return /* @__PURE__ */ s(
|
|
8
8
|
"svg",
|
|
@@ -247,4 +247,4 @@ R.displayName = "WalletPayButton";
|
|
|
247
247
|
export {
|
|
248
248
|
R as W
|
|
249
249
|
};
|
|
250
|
-
//# sourceMappingURL=wallet-pay-button-
|
|
250
|
+
//# sourceMappingURL=wallet-pay-button-DuDPBlCO.js.map
|
package/dist/agent-catalog.json
CHANGED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/** One coloured zone of the track, filled up to (and excluding) `upTo`. */
|
|
2
|
+
export interface BandedGaugeBand {
|
|
3
|
+
/**
|
|
4
|
+
* Upper boundary of the band on the scale (exclusive). The final band's
|
|
5
|
+
* `upTo` is conventionally the scale `max` so it fills to the bar end.
|
|
6
|
+
*/
|
|
7
|
+
upTo: number;
|
|
8
|
+
/**
|
|
9
|
+
* DS token NAME for the band fill — e.g. `'--info'`, `'--success'`,
|
|
10
|
+
* `'--warning-readable'`, `'--destructive'`. Resolved by the surface's
|
|
11
|
+
* `resolve` callback (concrete `rgb()` for the card, `var(<token>)` for the
|
|
12
|
+
* widget). Never a hex/rgb literal in source.
|
|
13
|
+
*/
|
|
14
|
+
colorToken: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A banded-linear gauge. Every visible string (`valueLabel`, `categoryLabel`,
|
|
18
|
+
* `rangeLabel`, `ariaLabel`) arrives ALREADY TRANSLATED — this module is
|
|
19
|
+
* i18n-agnostic; the BMI calculator supplies `t()`-resolved text.
|
|
20
|
+
*/
|
|
21
|
+
export interface BandedGaugeModel {
|
|
22
|
+
/** The true value (printed verbatim even when clamped to a bar end). */
|
|
23
|
+
value: number;
|
|
24
|
+
/** Ascending coloured zones; the last `upTo` should equal `max`. */
|
|
25
|
+
bands: BandedGaugeBand[];
|
|
26
|
+
/** Low end of the drawn scale (maps to the bar's inline start). */
|
|
27
|
+
min: number;
|
|
28
|
+
/** High end of the drawn scale (maps to the bar's inline end). */
|
|
29
|
+
max: number;
|
|
30
|
+
/** Big number rendered above the marker (e.g. `'24.6'`). */
|
|
31
|
+
valueLabel: string;
|
|
32
|
+
/** Band name shown beside the value (e.g. `'normal'`). Pre-translated. */
|
|
33
|
+
categoryLabel?: string;
|
|
34
|
+
/** Range string for the band (e.g. `'18.5–24.9'`). Pre-translated. */
|
|
35
|
+
rangeLabel?: string;
|
|
36
|
+
/** Full accessible name, e.g. `'BMI 24.6 — normal (18.5–24.9)'`. */
|
|
37
|
+
ariaLabel: string;
|
|
38
|
+
/** Threshold tick values drawn under the bar (e.g. `[18.5, 25, 30]`). */
|
|
39
|
+
ticks?: number[];
|
|
40
|
+
}
|
|
41
|
+
/** Drawn BMI scale: 15 (deep underweight) → 40 (deep obesity). */
|
|
42
|
+
export declare const BMI_BANDED_MIN = 15;
|
|
43
|
+
export declare const BMI_BANDED_MAX = 40;
|
|
44
|
+
/** WHO adult cut-offs drawn as ticks under the bar. */
|
|
45
|
+
export declare const BMI_BAND_THRESHOLDS: readonly [18.5, 25, 30];
|
|
46
|
+
/**
|
|
47
|
+
* The four WHO zones as `{ upTo, colorToken }`, plus the scale + ticks, so
|
|
48
|
+
* both the on-screen widget and the insert card share ONE definition:
|
|
49
|
+
*
|
|
50
|
+
* underweight < 18.5 → `--info`
|
|
51
|
+
* normal 18.5–24.9 → `--success`
|
|
52
|
+
* overweight 25–29.9 → `--warning-readable` (contrast-safe orange)
|
|
53
|
+
* obese ≥ 30 → `--destructive` (one obese zone)
|
|
54
|
+
*
|
|
55
|
+
* `--warning-readable` is the kit's contrast-safe orange token — it already
|
|
56
|
+
* resolves correctly per theme (orange-600 in light/non-accessible, `--warning`
|
|
57
|
+
* elsewhere), so NO `document.documentElement` JS override is needed here.
|
|
58
|
+
*/
|
|
59
|
+
export declare function bmiBands(): {
|
|
60
|
+
bands: BandedGaugeBand[];
|
|
61
|
+
min: number;
|
|
62
|
+
max: number;
|
|
63
|
+
ticks: number[];
|
|
64
|
+
};
|
|
65
|
+
/** One filled zone rect in card/widget coordinates. */
|
|
66
|
+
export interface BandRect {
|
|
67
|
+
/** Inline-start x of the zone. */
|
|
68
|
+
x: number;
|
|
69
|
+
/** Zone width. */
|
|
70
|
+
w: number;
|
|
71
|
+
/** Token NAME to fill it with (resolved by the surface). */
|
|
72
|
+
colorToken: string;
|
|
73
|
+
}
|
|
74
|
+
/** The value marker: its drawn x plus the clamp envelope it lives in. */
|
|
75
|
+
export interface MarkerGeometry {
|
|
76
|
+
/** Drawn x of the marker (clamped into `[clampedStart, clampedEnd]`). */
|
|
77
|
+
x: number;
|
|
78
|
+
/** Inline-start x the marker can reach (bar start). */
|
|
79
|
+
clampedStart: number;
|
|
80
|
+
/** Inline-end x the marker can reach (bar end). */
|
|
81
|
+
clampedEnd: number;
|
|
82
|
+
/**
|
|
83
|
+
* `'start'` when the true value sits below `min` (marker pinned to the bar
|
|
84
|
+
* start), `'end'` when it sits above `max`, `null` when it's in range. Drives
|
|
85
|
+
* the out-of-range caret/chevron.
|
|
86
|
+
*/
|
|
87
|
+
overflow: 'start' | 'end' | null;
|
|
88
|
+
}
|
|
89
|
+
/** A threshold tick: its x plus the scale value it marks. */
|
|
90
|
+
export interface TickGeometry {
|
|
91
|
+
x: number;
|
|
92
|
+
value: number;
|
|
93
|
+
}
|
|
94
|
+
/** Everything the two builders need, derived once. */
|
|
95
|
+
export interface BandedGaugeGeometry {
|
|
96
|
+
/** Outer SVG width. */
|
|
97
|
+
width: number;
|
|
98
|
+
/** Outer SVG height. */
|
|
99
|
+
height: number;
|
|
100
|
+
/** Inline-start x of the bar. */
|
|
101
|
+
barStart: number;
|
|
102
|
+
/** Inline-end x of the bar. */
|
|
103
|
+
barEnd: number;
|
|
104
|
+
/** Bar top y. */
|
|
105
|
+
barY: number;
|
|
106
|
+
/** Bar thickness. */
|
|
107
|
+
barH: number;
|
|
108
|
+
/** Bar corner radius. */
|
|
109
|
+
barRadius: number;
|
|
110
|
+
/** Coloured zones, left → right. */
|
|
111
|
+
bands: BandRect[];
|
|
112
|
+
/** The value marker. */
|
|
113
|
+
marker: MarkerGeometry;
|
|
114
|
+
/** Threshold ticks under the bar. */
|
|
115
|
+
ticks: TickGeometry[];
|
|
116
|
+
/** Baseline y for the value label above the bar. */
|
|
117
|
+
valueLabelY: number;
|
|
118
|
+
/** Baseline y for the tick number labels under the bar. */
|
|
119
|
+
tickLabelY: number;
|
|
120
|
+
/** Pre-translated value label (verbatim from the model). */
|
|
121
|
+
valueLabel: string;
|
|
122
|
+
/** Optional `category (range)` summary shown beside the value. */
|
|
123
|
+
summaryLabel: string;
|
|
124
|
+
/** Full accessible name for `<title>` / `aria-label`. */
|
|
125
|
+
ariaLabel: string;
|
|
126
|
+
}
|
|
127
|
+
/** Layout knobs for {@link computeBandedGaugeGeometry}. */
|
|
128
|
+
export interface BandedGaugeLayoutOptions {
|
|
129
|
+
/** Outer SVG width. */
|
|
130
|
+
width: number;
|
|
131
|
+
/** Outer SVG height. */
|
|
132
|
+
height: number;
|
|
133
|
+
}
|
|
134
|
+
export declare const INSET_X = 14;
|
|
135
|
+
/**
|
|
136
|
+
* Pure geometry pass — the ONE place value→x mapping, band widths, marker
|
|
137
|
+
* clamping, and tick positions are computed. Both the SVG-string builder and
|
|
138
|
+
* the JSX component consume this so the two surfaces never drift.
|
|
139
|
+
*
|
|
140
|
+
* The marker x is CLAMPED to `[barStart, barEnd]`, but `valueLabel` always
|
|
141
|
+
* prints the true value; `marker.overflow` flags an out-of-range value so the
|
|
142
|
+
* surface can draw a caret at the clamped end.
|
|
143
|
+
*/
|
|
144
|
+
export declare function computeBandedGaugeGeometry(model: BandedGaugeModel, { width, height }: BandedGaugeLayoutOptions): BandedGaugeGeometry;
|
|
145
|
+
/** A token-name → concrete-colour resolver supplied by each surface. */
|
|
146
|
+
export type ColorResolver = (colorToken: string) => string;
|
|
147
|
+
/** Theme colours + font + resolver for {@link buildBandedGaugeSvgString}. */
|
|
148
|
+
export interface BandedGaugeSvgOptions {
|
|
149
|
+
/**
|
|
150
|
+
* Maps a band token NAME to the colour string painted into the markup. The
|
|
151
|
+
* card passes a probe-resolved `rgb(...)` resolver so the baked PNG carries
|
|
152
|
+
* theme-correct colours; never a literal in source.
|
|
153
|
+
*/
|
|
154
|
+
resolve: ColorResolver;
|
|
155
|
+
/** Font family for the text (resolved from the theme, e.g. `--font-sans`). */
|
|
156
|
+
font: string;
|
|
157
|
+
/** Foreground colour for the value label + marker (concrete). */
|
|
158
|
+
fg: string;
|
|
159
|
+
/** Muted colour for the tick numbers + summary (concrete). */
|
|
160
|
+
muted: string;
|
|
161
|
+
/** Track / unfilled-rail colour, also used for tick rules (concrete). */
|
|
162
|
+
track: string;
|
|
163
|
+
}
|
|
164
|
+
export declare function buildBandedGaugeSvgString(geometry: BandedGaugeGeometry, options: BandedGaugeSvgOptions): string;
|
|
165
|
+
export declare const DEFAULT_HEIGHT = 64;
|
|
166
|
+
export interface BandedGaugeProps {
|
|
167
|
+
/** The gauge model (value, bands, scale, pre-translated labels). */
|
|
168
|
+
model: BandedGaugeModel;
|
|
169
|
+
/** SVG width. Defaults to {@link DEFAULT_WIDTH}. */
|
|
170
|
+
width?: number;
|
|
171
|
+
/** SVG height. Defaults to {@link DEFAULT_HEIGHT}. */
|
|
172
|
+
height?: number;
|
|
173
|
+
/** Extra class names on the root `<svg>`. */
|
|
174
|
+
className?: string;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Presentational banded-linear gauge for the on-screen widget. Renders the SAME
|
|
178
|
+
* geometry as {@link buildBandedGaugeSvgString} but as JSX, filling each band
|
|
179
|
+
* with `fill="var(<token>)"` so the live theme resolves the colour (and a theme
|
|
180
|
+
* switch repaints with no re-sample). Visually equivalent to the card string.
|
|
181
|
+
*
|
|
182
|
+
* The track + marker are decorative; the accessible name on the root carries
|
|
183
|
+
* the meaning (`role="img"` + `aria-label`, mirrored in `<title>`). All text in
|
|
184
|
+
* the model is pre-translated by the caller.
|
|
185
|
+
*
|
|
186
|
+
* The measurement axis runs low→high left-to-right regardless of document
|
|
187
|
+
* direction — SVG coordinates are inherently LTR (a `<rect x>` is unaffected by
|
|
188
|
+
* `direction`), and `direction="ltr"` is pinned on the root to keep any nested
|
|
189
|
+
* `<text>` directionality explicit. Logical properties govern the surrounding
|
|
190
|
+
* layout, never this axis.
|
|
191
|
+
*/
|
|
192
|
+
export declare const BandedGauge: import("react").ForwardRefExoticComponent<BandedGaugeProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
193
|
+
//# sourceMappingURL=banded-gauge.d.ts.map
|
|
@@ -2,7 +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, type InsertButtonProps, type InsertVariant, type InsertPayload, type InsertMode, type InsertCardData, type InsertCardField, type SvgCardToPngOptions, } from './insert-result';
|
|
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';
|
|
6
6
|
export { normalizeDiacritics } from './normalize-diacritics';
|
|
7
7
|
export { useDebouncedCallback } from './use-debounced-callback';
|
|
8
8
|
export { useFocusTrap, type UseFocusTrapOptions } from './use-focus-trap';
|