@alfadocs/ui-kit-debug 1.4.12 → 1.4.13
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/actions-cell-renderer-BD-jruqA.js +1784 -0
- package/dist/_chunks/actions-cell-renderer-BD-jruqA.js.map +1 -0
- package/dist/_chunks/{anamnesis-summary-rows-DAIpD0Or.js → anamnesis-summary-rows-B5MAYkJ-.js} +2150 -2092
- package/dist/_chunks/anamnesis-summary-rows-B5MAYkJ-.js.map +1 -0
- package/dist/_chunks/{bmi-calculator-CxPn0T0s.js → bmi-calculator-DC5SaqXT.js} +2 -2
- package/dist/_chunks/{bmi-calculator-CxPn0T0s.js.map → bmi-calculator-DC5SaqXT.js.map} +1 -1
- package/dist/_chunks/{cycle-calculator-D9M7IKfh.js → cycle-calculator-B_NlctlQ.js} +2 -2
- package/dist/_chunks/{cycle-calculator-D9M7IKfh.js.map → cycle-calculator-B_NlctlQ.js.map} +1 -1
- package/dist/_chunks/{due-date-calculator-BkqZEvL4.js → due-date-calculator-le1z3KpW.js} +2 -2
- package/dist/_chunks/{due-date-calculator-BkqZEvL4.js.map → due-date-calculator-le1z3KpW.js.map} +1 -1
- package/dist/_chunks/{fetal-weight-C7JXGg6E.js → fetal-weight-DXA6ZpMq.js} +2 -2
- package/dist/_chunks/{fetal-weight-C7JXGg6E.js.map → fetal-weight-DXA6ZpMq.js.map} +1 -1
- package/dist/_chunks/{file-manager-DzWYcRpE.js → file-manager-BjCM2fZB.js} +2 -2
- package/dist/_chunks/{file-manager-DzWYcRpE.js.map → file-manager-BjCM2fZB.js.map} +1 -1
- package/dist/_chunks/{hcg-doubling-CFJlMH7Z.js → hcg-doubling-BT6lki_i.js} +2 -2
- package/dist/_chunks/{hcg-doubling-CFJlMH7Z.js.map → hcg-doubling-BT6lki_i.js.map} +1 -1
- package/dist/_chunks/{link-cell-renderer-DCCca2m3.js → link-cell-renderer-C7GvyK66.js} +2 -2
- package/dist/_chunks/{link-cell-renderer-DCCca2m3.js.map → link-cell-renderer-C7GvyK66.js.map} +1 -1
- package/dist/_chunks/number-input-CM1q9zvH.js +414 -0
- package/dist/_chunks/number-input-CM1q9zvH.js.map +1 -0
- package/dist/_chunks/{optical-prescription-Brs0CeP3.js → optical-prescription-CQR_WJiS.js} +2 -2
- package/dist/_chunks/{optical-prescription-Brs0CeP3.js.map → optical-prescription-CQR_WJiS.js.map} +1 -1
- package/dist/_chunks/{patient-details-CGhnfdUB.js → patient-details-CnFgF3MU.js} +2 -2
- package/dist/_chunks/{patient-details-CGhnfdUB.js.map → patient-details-CnFgF3MU.js.map} +1 -1
- package/dist/_chunks/{patient-table-D2fhV4mV.js → patient-table-BXzcrC79.js} +3 -3
- package/dist/_chunks/{patient-table-D2fhV4mV.js.map → patient-table-BXzcrC79.js.map} +1 -1
- package/dist/_chunks/{pregnancy-dating-iI6_j2K2.js → pregnancy-dating-4tPV_Yko.js} +2 -2
- package/dist/_chunks/{pregnancy-dating-iI6_j2K2.js.map → pregnancy-dating-4tPV_Yko.js.map} +1 -1
- package/dist/_chunks/{pregnancy-weight-gain-Co-YFMJZ.js → pregnancy-weight-gain-BBgbWBGe.js} +2 -2
- package/dist/_chunks/{pregnancy-weight-gain-Co-YFMJZ.js.map → pregnancy-weight-gain-BBgbWBGe.js.map} +1 -1
- package/dist/_chunks/{signature-status-chip-DUcTgQ0E.js → signature-status-chip-DlLJk1VA.js} +16 -14
- package/dist/_chunks/signature-status-chip-DlLJk1VA.js.map +1 -0
- package/dist/_chunks/{unit-converter-BeTicruA.js → unit-converter-Dsk__pjA.js} +2 -2
- package/dist/_chunks/{unit-converter-BeTicruA.js.map → unit-converter-Dsk__pjA.js.map} +1 -1
- package/dist/agent-catalog.json +14 -8
- package/dist/agent-i18n/en.json +3 -2
- package/dist/components/bmi-calculator/index.js +1 -1
- package/dist/components/cycle-calculator/index.js +1 -1
- package/dist/components/data-table/data-table.agent.d.ts.map +1 -1
- package/dist/components/data-table/data-table.d.ts +19 -0
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/expanded-row-renderer.d.ts +47 -0
- package/dist/components/data-table/expanded-row-renderer.d.ts.map +1 -0
- package/dist/components/data-table/index.d.ts +2 -0
- package/dist/components/data-table/index.d.ts.map +1 -1
- package/dist/components/data-table/index.js +31 -27
- package/dist/components/due-date-calculator/index.js +1 -1
- package/dist/components/fetal-weight/index.js +1 -1
- package/dist/components/file-manager/index.js +1 -1
- package/dist/components/hcg-doubling/index.js +1 -1
- package/dist/components/number-input/index.js +1 -1
- package/dist/components/number-input/number-input.d.ts +11 -0
- package/dist/components/number-input/number-input.d.ts.map +1 -1
- package/dist/components/optical-prescription/index.js +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/pregnancy-dating/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/index.js +1 -1
- package/dist/components/signature-status-chip/index.js +1 -1
- package/dist/components/signature-status-chip/signature-status-chip.d.ts.map +1 -1
- package/dist/components/unit-converter/index.js +1 -1
- package/dist/host-compat.css +4 -1
- package/dist/i18n/locales/ar.d.ts +1 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +1 -0
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +1 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +1 -0
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +1 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +1 -0
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +1 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +1 -0
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +1 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +1 -0
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +1 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +1 -0
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +1 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +1 -0
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +1 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +1 -0
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +1 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +1 -0
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +1 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +1 -0
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +1 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +1 -0
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +1 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +1 -0
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +1 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +1 -0
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +1 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +1 -0
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +1 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +1 -0
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +1 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +1 -0
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +1 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +1 -0
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +1 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +1 -0
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +779 -775
- package/dist/locales/ar.json +1 -0
- package/dist/locales/de.json +1 -0
- package/dist/locales/el.json +1 -0
- package/dist/locales/en.json +1 -0
- package/dist/locales/es.json +1 -0
- package/dist/locales/fr.json +1 -0
- package/dist/locales/hi.json +1 -0
- package/dist/locales/it.json +1 -0
- package/dist/locales/ja.json +1 -0
- package/dist/locales/nl.json +1 -0
- package/dist/locales/pl.json +1 -0
- package/dist/locales/pt.json +1 -0
- package/dist/locales/ro.json +1 -0
- package/dist/locales/ru.json +1 -0
- package/dist/locales/sq.json +1 -0
- package/dist/locales/sv.json +1 -0
- package/dist/locales/tr.json +1 -0
- package/dist/locales/zh.json +1 -0
- package/dist/patterns/anamnesis/anamnesis-evolution.d.ts.map +1 -1
- package/dist/patterns/anamnesis/anamnesis-field.d.ts.map +1 -1
- package/dist/patterns/anamnesis/anamnesis-i18n.d.ts.map +1 -1
- package/dist/patterns/anamnesis/anamnesis-intake.d.ts +5 -1
- package/dist/patterns/anamnesis/anamnesis-intake.d.ts.map +1 -1
- package/dist/patterns/anamnesis/index.js +1 -1
- package/dist/tokens.css +5 -2
- package/package.json +1 -1
- package/dist/_chunks/actions-cell-renderer-C67oj7mR.js +0 -1581
- package/dist/_chunks/actions-cell-renderer-C67oj7mR.js.map +0 -1
- package/dist/_chunks/anamnesis-summary-rows-DAIpD0Or.js.map +0 -1
- package/dist/_chunks/number-input-DOe5VYei.js +0 -370
- package/dist/_chunks/number-input-DOe5VYei.js.map +0 -1
- package/dist/_chunks/signature-status-chip-DUcTgQ0E.js.map +0 -1
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import { jsxs as Se, jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as te, forwardRef as ke, useId as ze, useRef as q, useCallback as P, useState as H, useEffect as Me } from "react";
|
|
3
|
+
import { c as W } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as Te } from "react-i18next";
|
|
5
|
+
import { u as Pe } from "./use-controllable-state-BiY4xTzM.js";
|
|
6
|
+
import { u as Ue } from "./form-field-context-B3APVHKx.js";
|
|
7
|
+
import { c as Be } from "./compose-refs-C0k0tdqF.js";
|
|
8
|
+
import { u as Re } from "./registry-DvAUVLHh.js";
|
|
9
|
+
import { C as Ae } from "./chevron-down-DWE7GSq9.js";
|
|
10
|
+
import { C as je } from "./chevron-up-umRGgtJA.js";
|
|
11
|
+
const Ee = {
|
|
12
|
+
id: "number-input",
|
|
13
|
+
capabilities: ["set_value"],
|
|
14
|
+
state: {
|
|
15
|
+
value: {
|
|
16
|
+
type: "number | null",
|
|
17
|
+
descriptionKey: "ui.agent.numberInput.state.value",
|
|
18
|
+
description: "Current numeric value, or null when empty.",
|
|
19
|
+
read: (n) => n.getValue()
|
|
20
|
+
},
|
|
21
|
+
isEmpty: {
|
|
22
|
+
type: "boolean",
|
|
23
|
+
descriptionKey: "ui.agent.numberInput.state.isEmpty",
|
|
24
|
+
description: "Whether the input has no value.",
|
|
25
|
+
read: (n) => n.getValue() === null
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
actions: {
|
|
29
|
+
set_value: {
|
|
30
|
+
safety: "write",
|
|
31
|
+
argsType: "{ value: number | null }",
|
|
32
|
+
argsSchema: {
|
|
33
|
+
type: "object",
|
|
34
|
+
properties: { value: { type: ["number", "null"] } },
|
|
35
|
+
required: ["value"]
|
|
36
|
+
},
|
|
37
|
+
idempotent: !0,
|
|
38
|
+
examples: [{ args: { value: 42 } }, { args: { value: null } }],
|
|
39
|
+
descriptionKey: "ui.agent.numberInput.actions.setValue",
|
|
40
|
+
description: "Replace the numeric value, or pass null to clear.",
|
|
41
|
+
invoke: (n, s) => {
|
|
42
|
+
n.setValue(s.value);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
clear: {
|
|
46
|
+
safety: "destructive",
|
|
47
|
+
idempotent: !0,
|
|
48
|
+
descriptionKey: "ui.agent.numberInput.actions.clear",
|
|
49
|
+
description: "Empty the input. Loses any typed value.",
|
|
50
|
+
invoke: (n) => {
|
|
51
|
+
n.clear();
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
focus: {
|
|
55
|
+
safety: "read",
|
|
56
|
+
idempotent: !0,
|
|
57
|
+
descriptionKey: "ui.agent.numberInput.actions.focus",
|
|
58
|
+
description: "Move keyboard focus to the input.",
|
|
59
|
+
invoke: (n) => {
|
|
60
|
+
n.focus();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
domHooks: {
|
|
65
|
+
root: {
|
|
66
|
+
attr: "data-component",
|
|
67
|
+
value: "number-input",
|
|
68
|
+
description: "Marks the NumberInput wrapper."
|
|
69
|
+
},
|
|
70
|
+
instanceId: {
|
|
71
|
+
attr: "data-component-id",
|
|
72
|
+
sourceProp: "id",
|
|
73
|
+
description: "Sourced from the id prop."
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
function Le(n) {
|
|
78
|
+
let s = "";
|
|
79
|
+
for (const l of n) {
|
|
80
|
+
const r = l.codePointAt(0);
|
|
81
|
+
r !== void 0 && (r >= 1632 && r <= 1641 ? s += String.fromCodePoint(48 + (r - 1632)) : r >= 1776 && r <= 1785 ? s += String.fromCodePoint(48 + (r - 1776)) : s += l);
|
|
82
|
+
}
|
|
83
|
+
return s;
|
|
84
|
+
}
|
|
85
|
+
function Ke(n, s, l) {
|
|
86
|
+
return te(() => {
|
|
87
|
+
var k, m;
|
|
88
|
+
const r = new Intl.NumberFormat(n).formatToParts(1234.5), u = ((k = r.find((o) => o.type === "decimal")) == null ? void 0 : k.value) ?? ".", S = ((m = r.find((o) => o.type === "group")) == null ? void 0 : m.value) ?? ",", p = s === "currency" ? new Intl.NumberFormat(n, {
|
|
89
|
+
style: "currency",
|
|
90
|
+
currency: l ?? "USD"
|
|
91
|
+
}) : s === "percentage" ? new Intl.NumberFormat(n, {
|
|
92
|
+
style: "percent",
|
|
93
|
+
maximumFractionDigits: 4
|
|
94
|
+
}) : s === "integer" ? new Intl.NumberFormat(n, { maximumFractionDigits: 0 }) : new Intl.NumberFormat(n, { maximumFractionDigits: 10 }), U = (o) => Number.isFinite(o) ? p.format(o) : "", B = (o) => {
|
|
95
|
+
if (!o) return NaN;
|
|
96
|
+
const y = Le(o), z = y.trim(), D = z.startsWith("-") || z.startsWith("−");
|
|
97
|
+
let g = "";
|
|
98
|
+
for (const v of y)
|
|
99
|
+
v >= "0" && v <= "9" ? g += v : v === u && (g += ".");
|
|
100
|
+
if (!g || g === ".") return NaN;
|
|
101
|
+
let d = Number(g);
|
|
102
|
+
return Number.isFinite(d) ? (D && (d = -d), s === "percentage" && (d = d / 100), d) : NaN;
|
|
103
|
+
};
|
|
104
|
+
let N = "decimal";
|
|
105
|
+
if (s === "integer")
|
|
106
|
+
N = "numeric";
|
|
107
|
+
else if (s === "currency")
|
|
108
|
+
try {
|
|
109
|
+
const { maximumFractionDigits: o } = new Intl.NumberFormat(n, {
|
|
110
|
+
style: "currency",
|
|
111
|
+
currency: l ?? "USD"
|
|
112
|
+
}).resolvedOptions();
|
|
113
|
+
N = o === 0 ? "numeric" : "decimal";
|
|
114
|
+
} catch {
|
|
115
|
+
N = "decimal";
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
format: U,
|
|
119
|
+
parse: B,
|
|
120
|
+
decimalSeparator: u,
|
|
121
|
+
groupingSeparator: S,
|
|
122
|
+
inputMode: N
|
|
123
|
+
};
|
|
124
|
+
}, [n, s, l]);
|
|
125
|
+
}
|
|
126
|
+
const qe = W(
|
|
127
|
+
[
|
|
128
|
+
"ds:flex ds:items-center ds:rounded-[var(--radius-sm)]",
|
|
129
|
+
"ds:border ds:bg-input ds:text-foreground",
|
|
130
|
+
"ds:shadow-[var(--shadow-input)]",
|
|
131
|
+
"ds:transition-[colors,box-shadow] ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
|
|
132
|
+
"ds:focus-within:outline-[length:var(--focus-ring-width)] ds:focus-within:outline-solid",
|
|
133
|
+
"ds:focus-within:outline-ring ds:focus-within:outline-offset-[length:var(--focus-ring-offset)]",
|
|
134
|
+
"ds:has-[:disabled]:cursor-not-allowed ds:has-[:disabled]:opacity-50"
|
|
135
|
+
].join(" "),
|
|
136
|
+
{
|
|
137
|
+
variants: {
|
|
138
|
+
size: {
|
|
139
|
+
sm: "ds:h-8 ds:text-[length:var(--font-size-sm)]",
|
|
140
|
+
md: "ds:h-[var(--min-target-size)] ds:text-[length:var(--font-size-base)]",
|
|
141
|
+
lg: "ds:h-12 ds:text-[length:var(--font-size-lg)]"
|
|
142
|
+
},
|
|
143
|
+
tone: {
|
|
144
|
+
default: "ds:border-border",
|
|
145
|
+
error: "ds:border-destructive ds:focus-within:outline-destructive"
|
|
146
|
+
},
|
|
147
|
+
// Intrinsic sizes shrink-wrap the frame around field, unit and paddings;
|
|
148
|
+
// the floor keeps a bare 'sm' field a valid tap target.
|
|
149
|
+
inline: {
|
|
150
|
+
full: "ds:w-full",
|
|
151
|
+
sm: "ds:w-fit ds:min-w-[var(--min-target-size)]",
|
|
152
|
+
md: "ds:w-fit ds:min-w-[var(--min-target-size)]",
|
|
153
|
+
lg: "ds:w-fit ds:min-w-[var(--min-target-size)]"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
defaultVariants: { size: "md", tone: "default", inline: "full" }
|
|
157
|
+
}
|
|
158
|
+
), He = W(
|
|
159
|
+
"ds:min-w-0 ds:bg-transparent ds:outline-none ds:text-start ds:tabular-nums ds:disabled:cursor-not-allowed",
|
|
160
|
+
{
|
|
161
|
+
variants: {
|
|
162
|
+
variant: { stepper: "ds:ps-2", plain: "ds:ps-3" },
|
|
163
|
+
hasUnit: { true: "ds:pe-1", false: "" },
|
|
164
|
+
// `ch` is the advance of "0", so with tabular numerals N digits fit
|
|
165
|
+
// exactly; box-content keeps the paddings outside that count.
|
|
166
|
+
inline: {
|
|
167
|
+
full: "ds:flex-1 ds:w-full",
|
|
168
|
+
sm: "ds:box-content ds:w-[8ch]",
|
|
169
|
+
md: "ds:box-content ds:w-[12ch]",
|
|
170
|
+
lg: "ds:box-content ds:w-[16ch]"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
compoundVariants: [
|
|
174
|
+
{ variant: "stepper", hasUnit: !1, class: "ds:pe-2" },
|
|
175
|
+
{ variant: "plain", hasUnit: !1, class: "ds:pe-3" }
|
|
176
|
+
],
|
|
177
|
+
defaultVariants: { variant: "stepper", hasUnit: !1, inline: "full" }
|
|
178
|
+
}
|
|
179
|
+
), We = W(
|
|
180
|
+
"ds:shrink-0 ds:select-none ds:whitespace-nowrap ds:text-muted-foreground",
|
|
181
|
+
{
|
|
182
|
+
variants: {
|
|
183
|
+
variant: { stepper: "ds:pe-1", plain: "ds:pe-3" }
|
|
184
|
+
},
|
|
185
|
+
defaultVariants: { variant: "stepper" }
|
|
186
|
+
}
|
|
187
|
+
), ee = [
|
|
188
|
+
"ds:inline-flex ds:items-center ds:justify-center",
|
|
189
|
+
"ds:h-full ds:shrink-0",
|
|
190
|
+
"ds:text-muted-foreground ds:hover:text-foreground",
|
|
191
|
+
"ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
|
|
192
|
+
"ds:disabled:cursor-not-allowed ds:disabled:opacity-50"
|
|
193
|
+
].join(" "), Oe = () => typeof navigator < "u" && navigator.language ? navigator.language : "en-US", _e = (n) => typeof n == "string" && n.trim() !== "" ? n : void 0;
|
|
194
|
+
function $e(n) {
|
|
195
|
+
if (!Number.isFinite(n)) return 0;
|
|
196
|
+
const s = String(n), l = s.indexOf(".");
|
|
197
|
+
return l === -1 ? 0 : s.length - l - 1;
|
|
198
|
+
}
|
|
199
|
+
function Ge(n, s) {
|
|
200
|
+
if (s <= 0 || !Number.isFinite(s)) return n;
|
|
201
|
+
const r = 10 ** $e(s);
|
|
202
|
+
return Math.round(n * r) / r;
|
|
203
|
+
}
|
|
204
|
+
const Je = ke(
|
|
205
|
+
({
|
|
206
|
+
value: n,
|
|
207
|
+
defaultValue: s,
|
|
208
|
+
onChange: l,
|
|
209
|
+
min: r,
|
|
210
|
+
max: u,
|
|
211
|
+
step: S = 1,
|
|
212
|
+
mode: p = "integer",
|
|
213
|
+
currency: U,
|
|
214
|
+
locale: B,
|
|
215
|
+
size: N = "md",
|
|
216
|
+
tone: k,
|
|
217
|
+
variant: m = "stepper",
|
|
218
|
+
unit: o,
|
|
219
|
+
inline: y = "full",
|
|
220
|
+
className: z,
|
|
221
|
+
id: D,
|
|
222
|
+
disabled: g,
|
|
223
|
+
onFocus: d,
|
|
224
|
+
onBlur: v,
|
|
225
|
+
onKeyDown: R,
|
|
226
|
+
...ne
|
|
227
|
+
}, re) => {
|
|
228
|
+
const { t: O, i18n: se } = Te(), V = Ue(), ie = D ?? V.id, M = !!(V.disabled || g), _ = ze(), ae = [V.describedBy, o ? _ : void 0].filter(Boolean).join(" ") || void 0, oe = B ?? _e(se.language) ?? Oe(), A = Ke(oe, p, U), {
|
|
229
|
+
decimalSeparator: T,
|
|
230
|
+
groupingSeparator: $,
|
|
231
|
+
format: j,
|
|
232
|
+
parse: G
|
|
233
|
+
} = A, J = q(null), ue = Be(re, J), [le, de] = Pe({
|
|
234
|
+
value: n,
|
|
235
|
+
defaultValue: s ?? null,
|
|
236
|
+
onChange: l
|
|
237
|
+
}), a = le ?? null, Q = q(a);
|
|
238
|
+
Q.current = a;
|
|
239
|
+
const C = P(
|
|
240
|
+
(e) => {
|
|
241
|
+
const t = p === "percentage" ? e * 100 : e;
|
|
242
|
+
return (Number.isInteger(t) ? String(t) : t.toString()).replace(".", T);
|
|
243
|
+
},
|
|
244
|
+
[p, T]
|
|
245
|
+
), b = P(
|
|
246
|
+
(e) => e == null || Number.isNaN(e) ? "" : j(e),
|
|
247
|
+
[j]
|
|
248
|
+
), [E, c] = H(
|
|
249
|
+
() => b(a)
|
|
250
|
+
), w = q(!1), [ce, h] = H(!1), [L, F] = H(!1), K = P(
|
|
251
|
+
(e) => {
|
|
252
|
+
if (e >= "0" && e <= "9") return !0;
|
|
253
|
+
const t = e.codePointAt(0) ?? 0;
|
|
254
|
+
return t >= 1632 && t <= 1641 || t >= 1776 && t <= 1785 ? !0 : e === T || e === $ || e === "-" || e === "−";
|
|
255
|
+
},
|
|
256
|
+
[T, $]
|
|
257
|
+
), fe = P(
|
|
258
|
+
(e) => {
|
|
259
|
+
let t = "";
|
|
260
|
+
for (const i of e)
|
|
261
|
+
K(i) && (t += i);
|
|
262
|
+
return t;
|
|
263
|
+
},
|
|
264
|
+
[K]
|
|
265
|
+
);
|
|
266
|
+
Me(() => {
|
|
267
|
+
!w.current && !L && c(b(a));
|
|
268
|
+
}, [a, b, L]);
|
|
269
|
+
const pe = ce || L || a !== null && (r !== void 0 && a < r || u !== void 0 && a > u), X = V.invalid || pe, me = X ? "error" : k ?? "default", f = (e) => {
|
|
270
|
+
de(e);
|
|
271
|
+
}, I = (e) => {
|
|
272
|
+
let i = (a ?? 0) + S * e;
|
|
273
|
+
r !== void 0 && (i = Math.max(r, i)), u !== void 0 && (i = Math.min(u, i)), i = Ge(i, S), f(i), h(!1), c(
|
|
274
|
+
w.current ? C(i) : b(i)
|
|
275
|
+
);
|
|
276
|
+
}, Y = (e) => {
|
|
277
|
+
f(e), h(!1), c(
|
|
278
|
+
w.current ? C(e) : b(e)
|
|
279
|
+
);
|
|
280
|
+
}, ve = (e) => {
|
|
281
|
+
if (R == null || R(e), e.defaultPrevented || M) return;
|
|
282
|
+
const { key: t, shiftKey: i } = e;
|
|
283
|
+
t === "ArrowUp" ? (e.preventDefault(), I(i ? 10 : 1)) : t === "ArrowDown" ? (e.preventDefault(), I(i ? -10 : -1)) : t === "PageUp" ? (e.preventDefault(), I(100)) : t === "PageDown" ? (e.preventDefault(), I(-100)) : t === "Home" && r !== void 0 ? (e.preventDefault(), Y(r)) : t === "End" && u !== void 0 && (e.preventDefault(), Y(u));
|
|
284
|
+
}, be = (e) => {
|
|
285
|
+
const t = fe(e.target.value);
|
|
286
|
+
if (c(t), t.trim() === "") {
|
|
287
|
+
f(null), h(!1), F(!1);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const i = G(t);
|
|
291
|
+
Number.isNaN(i) || (f(i), F(!1));
|
|
292
|
+
}, ge = (e) => {
|
|
293
|
+
const { data: t } = e.nativeEvent;
|
|
294
|
+
typeof t != "string" || t.length !== 1 || K(t) || e.preventDefault();
|
|
295
|
+
}, he = (e) => {
|
|
296
|
+
d == null || d(e), w.current = !0, a != null && c(C(a));
|
|
297
|
+
}, Ne = (e) => {
|
|
298
|
+
if (v == null || v(e), w.current = !1, E.trim() === "") {
|
|
299
|
+
f(null), h(!1), F(!1), c("");
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
const t = G(E);
|
|
303
|
+
if (Number.isNaN(t)) {
|
|
304
|
+
F(!0), h(!1), f(null);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
const i = r !== void 0 && t < r || u !== void 0 && t > u;
|
|
308
|
+
h(i), F(!1), f(t), c(b(t));
|
|
309
|
+
}, Z = (e) => {
|
|
310
|
+
e.preventDefault();
|
|
311
|
+
}, ye = () => I(1), we = () => I(-1), Ie = te(
|
|
312
|
+
() => ({
|
|
313
|
+
getValue: () => Q.current,
|
|
314
|
+
setValue: (e) => {
|
|
315
|
+
f(e), c(
|
|
316
|
+
e === null ? "" : w.current ? C(e) : b(e)
|
|
317
|
+
);
|
|
318
|
+
},
|
|
319
|
+
clear: () => {
|
|
320
|
+
f(null), c(""), h(!1);
|
|
321
|
+
},
|
|
322
|
+
focus: () => {
|
|
323
|
+
var e;
|
|
324
|
+
return (e = J.current) == null ? void 0 : e.focus();
|
|
325
|
+
}
|
|
326
|
+
}),
|
|
327
|
+
// The handle is reconstructed per render; consumers (the agent runtime)
|
|
328
|
+
// re-register only when the identity changes, which is a cheap no-op.
|
|
329
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
330
|
+
[C, b]
|
|
331
|
+
);
|
|
332
|
+
Re(Ee, Ie, D);
|
|
333
|
+
const xe = M || r !== void 0 && a !== null && a <= r, De = M || u !== void 0 && a !== null && a >= u, Ve = a ?? void 0, Ce = (p === "currency" || p === "percentage") && a !== null && a !== null ? j(a) : void 0, Fe = A.inputMode === "numeric" ? "[0-9]*" : void 0;
|
|
334
|
+
return /* @__PURE__ */ Se(
|
|
335
|
+
"div",
|
|
336
|
+
{
|
|
337
|
+
className: qe({
|
|
338
|
+
size: N,
|
|
339
|
+
tone: me,
|
|
340
|
+
inline: y,
|
|
341
|
+
className: z
|
|
342
|
+
}),
|
|
343
|
+
"data-component": "number-input",
|
|
344
|
+
"data-component-id": D,
|
|
345
|
+
"data-mode": p,
|
|
346
|
+
"data-variant": m,
|
|
347
|
+
"data-inline": y,
|
|
348
|
+
children: [
|
|
349
|
+
m === "stepper" ? /* @__PURE__ */ x(
|
|
350
|
+
"button",
|
|
351
|
+
{
|
|
352
|
+
type: "button",
|
|
353
|
+
tabIndex: -1,
|
|
354
|
+
"aria-label": O("inputs.number.decrement", "Decrement"),
|
|
355
|
+
onClick: we,
|
|
356
|
+
onMouseDown: Z,
|
|
357
|
+
disabled: xe,
|
|
358
|
+
className: `${ee} ds:ps-2 ds:pe-1`,
|
|
359
|
+
children: /* @__PURE__ */ x(Ae, { "aria-hidden": "true", className: "ds:size-4" })
|
|
360
|
+
}
|
|
361
|
+
) : null,
|
|
362
|
+
/* @__PURE__ */ x(
|
|
363
|
+
"input",
|
|
364
|
+
{
|
|
365
|
+
ref: ue,
|
|
366
|
+
id: ie,
|
|
367
|
+
type: "text",
|
|
368
|
+
role: "spinbutton",
|
|
369
|
+
inputMode: A.inputMode,
|
|
370
|
+
pattern: Fe,
|
|
371
|
+
autoComplete: "off",
|
|
372
|
+
value: E,
|
|
373
|
+
disabled: M,
|
|
374
|
+
"aria-valuemin": r,
|
|
375
|
+
"aria-valuemax": u,
|
|
376
|
+
"aria-valuenow": Ve,
|
|
377
|
+
"aria-valuetext": Ce,
|
|
378
|
+
"aria-invalid": X || void 0,
|
|
379
|
+
"aria-required": V.required || void 0,
|
|
380
|
+
"aria-describedby": ae,
|
|
381
|
+
onBeforeInput: ge,
|
|
382
|
+
onChange: be,
|
|
383
|
+
onFocus: he,
|
|
384
|
+
onBlur: Ne,
|
|
385
|
+
onKeyDown: ve,
|
|
386
|
+
className: He({ variant: m, hasUnit: !!o, inline: y }),
|
|
387
|
+
...ne
|
|
388
|
+
}
|
|
389
|
+
),
|
|
390
|
+
o ? /* @__PURE__ */ x("span", { id: _, className: We({ variant: m }), children: o }) : null,
|
|
391
|
+
m === "stepper" ? /* @__PURE__ */ x(
|
|
392
|
+
"button",
|
|
393
|
+
{
|
|
394
|
+
type: "button",
|
|
395
|
+
tabIndex: -1,
|
|
396
|
+
"aria-label": O("inputs.number.increment", "Increment"),
|
|
397
|
+
onClick: ye,
|
|
398
|
+
onMouseDown: Z,
|
|
399
|
+
disabled: De,
|
|
400
|
+
className: `${ee} ds:ps-1 ds:pe-2`,
|
|
401
|
+
children: /* @__PURE__ */ x(je, { "aria-hidden": "true", className: "ds:size-4" })
|
|
402
|
+
}
|
|
403
|
+
) : null
|
|
404
|
+
]
|
|
405
|
+
}
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
);
|
|
409
|
+
Je.displayName = "NumberInput";
|
|
410
|
+
export {
|
|
411
|
+
Je as N,
|
|
412
|
+
Ke as u
|
|
413
|
+
};
|
|
414
|
+
//# sourceMappingURL=number-input-CM1q9zvH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-input-CM1q9zvH.js","sources":["../../src/components/number-input/number-input.agent.ts","../../src/components/number-input/use-locale-number.ts","../../src/components/number-input/number-input.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — NumberInput. */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` for the contract. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { NumberInputHandle } from './number-input';\n\nexport const numberInputAgent: AgentAdapter<NumberInputHandle> = {\n id: 'number-input',\n capabilities: ['set_value'],\n state: {\n value: {\n type: 'number | null',\n descriptionKey: 'ui.agent.numberInput.state.value',\n description: 'Current numeric value, or null when empty.',\n read: (handle) => handle.getValue(),\n },\n isEmpty: {\n type: 'boolean',\n descriptionKey: 'ui.agent.numberInput.state.isEmpty',\n description: 'Whether the input has no value.',\n read: (handle) => handle.getValue() === null,\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ value: number | null }',\n argsSchema: {\n type: 'object',\n properties: { value: { type: ['number', 'null'] } },\n required: ['value'],\n },\n idempotent: true,\n examples: [{ args: { value: 42 } }, { args: { value: null } }],\n descriptionKey: 'ui.agent.numberInput.actions.setValue',\n description: 'Replace the numeric value, or pass null to clear.',\n invoke: (handle, args: { value: number | null }) => {\n handle.setValue(args.value);\n },\n },\n clear: {\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.numberInput.actions.clear',\n description: 'Empty the input. Loses any typed value.',\n invoke: (handle) => {\n handle.clear();\n },\n },\n focus: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.numberInput.actions.focus',\n description: 'Move keyboard focus to the input.',\n invoke: (handle) => {\n handle.focus();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'number-input',\n description: 'Marks the NumberInput wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import { useMemo } from 'react';\n\nexport type NumberInputMode = 'integer' | 'decimal' | 'currency' | 'percentage';\n\nexport interface LocaleNumber {\n /** Format a JS number for display (e.g. `1234.5` → `1.234,5` in de-DE). */\n format: (value: number) => string;\n /** Parse a locale-formatted string back to a JS number. Returns `NaN` for invalid input. */\n parse: (text: string) => number;\n /** The decimal separator for this locale (e.g. `.` or `,`). */\n decimalSeparator: string;\n /** The grouping separator for this locale (e.g. `,` or `.` or ` `). */\n groupingSeparator: string;\n /** The correct `inputMode` for the virtual keyboard. */\n inputMode: 'numeric' | 'decimal';\n}\n\nfunction normalizeDigits(text: string): string {\n let result = '';\n for (const ch of text) {\n const code = ch.codePointAt(0);\n if (code === undefined) continue;\n if (code >= 0x0660 && code <= 0x0669) {\n result += String.fromCodePoint(0x30 + (code - 0x0660));\n } else if (code >= 0x06f0 && code <= 0x06f9) {\n result += String.fromCodePoint(0x30 + (code - 0x06f0));\n } else {\n result += ch;\n }\n }\n return result;\n}\n\nexport function useLocaleNumber(\n locale: string,\n mode: NumberInputMode,\n currency?: string,\n): LocaleNumber {\n return useMemo(() => {\n const parts = new Intl.NumberFormat(locale).formatToParts(1234.5);\n const decimalSeparator =\n parts.find((p) => p.type === 'decimal')?.value ?? '.';\n const groupingSeparator =\n parts.find((p) => p.type === 'group')?.value ?? ',';\n\n const displayFormatter: Intl.NumberFormat = (() => {\n if (mode === 'currency') {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: currency ?? 'USD',\n });\n }\n if (mode === 'percentage') {\n return new Intl.NumberFormat(locale, {\n style: 'percent',\n maximumFractionDigits: 4,\n });\n }\n if (mode === 'integer') {\n return new Intl.NumberFormat(locale, { maximumFractionDigits: 0 });\n }\n return new Intl.NumberFormat(locale, { maximumFractionDigits: 10 });\n })();\n\n const format = (value: number): string => {\n if (!Number.isFinite(value)) return '';\n return displayFormatter.format(value);\n };\n\n const parse = (text: string): number => {\n if (!text) return NaN;\n const normalized = normalizeDigits(text);\n const trimmed = normalized.trim();\n const hasMinus = trimmed.startsWith('-') || trimmed.startsWith('\\u2212');\n\n let cleaned = '';\n for (const ch of normalized) {\n if (ch >= '0' && ch <= '9') {\n cleaned += ch;\n } else if (ch === decimalSeparator) {\n cleaned += '.';\n }\n }\n if (!cleaned || cleaned === '.') return NaN;\n\n let n = Number(cleaned);\n if (!Number.isFinite(n)) return NaN;\n if (hasMinus) n = -n;\n if (mode === 'percentage') n = n / 100;\n return n;\n };\n\n let inputMode: 'numeric' | 'decimal' = 'decimal';\n if (mode === 'integer') {\n inputMode = 'numeric';\n } else if (mode === 'currency') {\n try {\n const { maximumFractionDigits } = new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: currency ?? 'USD',\n }).resolvedOptions();\n inputMode = maximumFractionDigits === 0 ? 'numeric' : 'decimal';\n } catch {\n inputMode = 'decimal';\n }\n }\n\n return {\n format,\n parse,\n decimalSeparator,\n groupingSeparator,\n inputMode,\n };\n }, [locale, mode, currency]);\n}\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type FocusEvent,\n type FormEvent,\n type InputHTMLAttributes,\n type KeyboardEvent,\n type MouseEvent,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { ChevronDown, ChevronUp } from 'lucide-react';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport { useFormField } from '../form-field/form-field-context';\nimport { composeRefs } from '../_shared/compose-refs';\nimport { useAgentRegistration } from '../../agent';\nimport { numberInputAgent } from './number-input.agent';\nimport { useLocaleNumber, type NumberInputMode } from './use-locale-number';\n\n/** Agent-readiness curated handle for NumberInput. */\nexport interface NumberInputHandle {\n getValue: () => number | null;\n setValue: (value: number | null) => void;\n clear: () => void;\n focus: () => void;\n}\n\nconst numberInputVariants = cva(\n [\n 'ds:flex ds:items-center ds:rounded-[var(--radius-sm)]',\n 'ds:border ds:bg-input ds:text-foreground',\n 'ds:shadow-[var(--shadow-input)]',\n 'ds:transition-[colors,box-shadow] ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:focus-within:outline-[length:var(--focus-ring-width)] ds:focus-within:outline-solid',\n 'ds:focus-within:outline-ring ds:focus-within:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:has-[:disabled]:cursor-not-allowed ds:has-[:disabled]:opacity-50',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:h-8 ds:text-[length:var(--font-size-sm)]',\n md: 'ds:h-[var(--min-target-size)] ds:text-[length:var(--font-size-base)]',\n lg: 'ds:h-12 ds:text-[length:var(--font-size-lg)]',\n },\n tone: {\n default: 'ds:border-border',\n error: 'ds:border-destructive ds:focus-within:outline-destructive',\n },\n // Intrinsic sizes shrink-wrap the frame around field, unit and paddings;\n // the floor keeps a bare 'sm' field a valid tap target.\n inline: {\n full: 'ds:w-full',\n sm: 'ds:w-fit ds:min-w-[var(--min-target-size)]',\n md: 'ds:w-fit ds:min-w-[var(--min-target-size)]',\n lg: 'ds:w-fit ds:min-w-[var(--min-target-size)]',\n },\n },\n defaultVariants: { size: 'md', tone: 'default', inline: 'full' },\n },\n);\n\n// Field padding follows its neighbour: chevrons bring their own inset, a bare\n// frame needs the TextInput gutter, a unit closes the gap to the number.\nconst fieldVariants = cva(\n 'ds:min-w-0 ds:bg-transparent ds:outline-none ds:text-start ds:tabular-nums ds:disabled:cursor-not-allowed',\n {\n variants: {\n variant: { stepper: 'ds:ps-2', plain: 'ds:ps-3' },\n hasUnit: { true: 'ds:pe-1', false: '' },\n // `ch` is the advance of \"0\", so with tabular numerals N digits fit\n // exactly; box-content keeps the paddings outside that count.\n inline: {\n full: 'ds:flex-1 ds:w-full',\n sm: 'ds:box-content ds:w-[8ch]',\n md: 'ds:box-content ds:w-[12ch]',\n lg: 'ds:box-content ds:w-[16ch]',\n },\n },\n compoundVariants: [\n { variant: 'stepper', hasUnit: false, class: 'ds:pe-2' },\n { variant: 'plain', hasUnit: false, class: 'ds:pe-3' },\n ],\n defaultVariants: { variant: 'stepper', hasUnit: false, inline: 'full' },\n },\n);\n\nconst unitVariants = cva(\n 'ds:shrink-0 ds:select-none ds:whitespace-nowrap ds:text-muted-foreground',\n {\n variants: {\n variant: { stepper: 'ds:pe-1', plain: 'ds:pe-3' },\n },\n defaultVariants: { variant: 'stepper' },\n },\n);\n\nconst spinnerButton = [\n 'ds:inline-flex ds:items-center ds:justify-center',\n 'ds:h-full ds:shrink-0',\n 'ds:text-muted-foreground ds:hover:text-foreground',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:disabled:cursor-not-allowed ds:disabled:opacity-50',\n].join(' ');\n\nexport type { NumberInputMode };\n\nexport interface NumberInputProps\n extends\n Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'type' | 'onChange' | 'value' | 'defaultValue' | 'size'\n >,\n VariantProps<typeof numberInputVariants> {\n /** Current numeric value (controlled). */\n value?: number | null;\n /** Initial value (uncontrolled). */\n defaultValue?: number;\n /** Fires with the parsed number (not a string). `null` when the field is empty. */\n onChange?: (value: number | null) => void;\n /** Minimum allowed value. Maps to `aria-valuemin`. */\n min?: number;\n /** Maximum allowed value. Maps to `aria-valuemax`. */\n max?: number;\n /** Increment step. Defaults to `1`. */\n step?: number;\n /** Display/parse mode. Defaults to `'integer'`. */\n mode?: NumberInputMode;\n /** ISO 4217 currency code, required when `mode='currency'`. */\n currency?: string;\n /** BCP 47 locale. Defaults to the app language (`i18n.language`), then\n * `navigator.language`, then `'en-US'`. */\n locale?: string;\n /** Size variant. */\n size?: 'sm' | 'md' | 'lg';\n /** 'stepper' (default) keeps the chevron buttons; 'plain' renders the bare\n * field — keyboard arrows still step, and the wheel scrolls the page as it\n * always has. */\n variant?: 'stepper' | 'plain';\n /** Unit shown inside the field at the inline end (e.g. \"cm\"), muted; joins\n * the input's accessible description, never its value. */\n unit?: string;\n /** Intrinsic inline size: 'full' (default) fills the container; 'sm' ≈ 8\n * characters, 'md' ≈ 12, 'lg' ≈ 16 — plus room for the unit and paddings. */\n inline?: 'sm' | 'md' | 'lg' | 'full';\n /** Additional class names on the wrapper. */\n className?: string;\n}\n\nconst resolveDefaultLocale = (): string => {\n if (typeof navigator !== 'undefined' && navigator.language) {\n return navigator.language;\n }\n return 'en-US';\n};\n\n/** The app language, when i18next has one. An uninitialised instance reports\n * `undefined` (or an empty string), and handing either to `Intl` would pick\n * the runtime default over the browser's — the fallback below does better. */\nconst appLocale = (language: unknown): string | undefined =>\n typeof language === 'string' && language.trim() !== '' ? language : undefined;\n\nfunction decimalPlaces(n: number): number {\n if (!Number.isFinite(n)) return 0;\n const s = String(n);\n const dot = s.indexOf('.');\n if (dot === -1) return 0;\n return s.length - dot - 1;\n}\n\nfunction roundToStep(value: number, step: number): number {\n if (step <= 0 || !Number.isFinite(step)) return value;\n const precision = decimalPlaces(step);\n const factor = 10 ** precision;\n return Math.round(value * factor) / factor;\n}\n\nexport const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(\n (\n {\n value,\n defaultValue,\n onChange,\n min,\n max,\n step = 1,\n mode = 'integer',\n currency,\n locale,\n size = 'md',\n tone,\n variant = 'stepper',\n unit,\n inline = 'full',\n className,\n id,\n disabled,\n onFocus,\n onBlur,\n onKeyDown,\n ...rest\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const ctx = useFormField();\n const inputId = id ?? ctx.id;\n const effectiveDisabled = Boolean(ctx.disabled || disabled);\n\n // The unit is a description, not part of the value: a reader hears\n // \"175, cm\" rather than \"175cm\", and the number stays a number.\n const unitId = useId();\n const describedBy =\n [ctx.describedBy, unit ? unitId : undefined].filter(Boolean).join(' ') ||\n undefined;\n\n // The app language wins over the browser's: an Italian practice on an\n // English OS still types 72,5 — the separator the rest of the screen uses.\n const resolvedLocale =\n locale ?? appLocale(i18n.language) ?? resolveDefaultLocale();\n const localeNumber = useLocaleNumber(resolvedLocale, mode, currency);\n const {\n decimalSeparator,\n groupingSeparator,\n format: localeFormat,\n parse: localeParse,\n } = localeNumber;\n\n const innerInputRef = useRef<HTMLInputElement | null>(null);\n const composedRef = composeRefs(ref, innerInputRef);\n\n const [currentValueRaw, setCurrentValue] = useControllableState<\n number | null\n >({\n value,\n defaultValue: defaultValue ?? null,\n onChange,\n });\n const currentValue: number | null = currentValueRaw ?? null;\n\n const currentValueRef = useRef<number | null>(currentValue);\n currentValueRef.current = currentValue;\n\n const formatForEdit = useCallback(\n (n: number): string => {\n const displayed = mode === 'percentage' ? n * 100 : n;\n const raw = Number.isInteger(displayed)\n ? String(displayed)\n : displayed.toString();\n return raw.replace('.', decimalSeparator);\n },\n [mode, decimalSeparator],\n );\n\n const formatCurrent = useCallback(\n (n: number | null | undefined): string =>\n n === null || n === undefined || Number.isNaN(n) ? '' : localeFormat(n),\n [localeFormat],\n );\n\n const [inputText, setInputText] = useState<string>(() =>\n formatCurrent(currentValue),\n );\n const isFocusedRef = useRef(false);\n const [crossedBounds, setCrossedBounds] = useState(false);\n // The text on screen is not a number. Set on BLUR, never mid-typing: \"-\"\n // and \"1,\" are legitimate states on the way to a value and shouting at\n // them would make the field unusable.\n const [textNotANumber, setTextNotANumber] = useState(false);\n\n /** Can this character be part of a number in this locale? Everything else\n * is refused at the keystroke: a letter in a number field is never a typo\n * the user meant, and silently dropping it on blur is what made the field\n * look as though it validated nothing at all. Arabic-Indic and extended\n * Arabic-Indic digits pass — `parse` already normalises them. */\n const isNumberChar = useCallback(\n (ch: string): boolean => {\n if (ch >= '0' && ch <= '9') return true;\n const code = ch.codePointAt(0) ?? 0;\n if (code >= 0x0660 && code <= 0x0669) return true;\n if (code >= 0x06f0 && code <= 0x06f9) return true;\n return (\n ch === decimalSeparator ||\n ch === groupingSeparator ||\n ch === '-' ||\n ch === '\\u2212'\n );\n },\n [decimalSeparator, groupingSeparator],\n );\n\n /** Strip what could never belong to a number. Applied to whatever reaches\n * `change` — a paste of \"72,5 kg\" keeps its 72,5 rather than being\n * refused outright, which is the one case worth being lenient about. */\n const stripNonNumber = useCallback(\n (text: string): string => {\n let kept = '';\n for (const ch of text) {\n if (isNumberChar(ch)) kept += ch;\n }\n return kept;\n },\n [isNumberChar],\n );\n\n useEffect(() => {\n // Not while the reader is looking at their own invalid text: committing\n // null below would otherwise bounce back through here and erase it,\n // leaving a blank red box that says nothing about what was wrong.\n if (!isFocusedRef.current && !textNotANumber) {\n setInputText(formatCurrent(currentValue));\n }\n }, [currentValue, formatCurrent, textNotANumber]);\n\n const computedInvalid =\n crossedBounds ||\n textNotANumber ||\n (currentValue !== null &&\n ((min !== undefined && currentValue < min) ||\n (max !== undefined && currentValue > max)));\n const ariaInvalid = ctx.invalid || computedInvalid;\n const effectiveTone: 'default' | 'error' = ariaInvalid\n ? 'error'\n : (tone ?? 'default');\n\n const commitValue = (next: number | null) => {\n setCurrentValue(next);\n };\n\n const applyDelta = (multiplier: number) => {\n const base = currentValue ?? 0;\n let next = base + step * multiplier;\n if (min !== undefined) next = Math.max(min, next);\n if (max !== undefined) next = Math.min(max, next);\n next = roundToStep(next, step);\n commitValue(next);\n setCrossedBounds(false);\n setInputText(\n isFocusedRef.current ? formatForEdit(next) : formatCurrent(next),\n );\n };\n\n const jumpTo = (target: number) => {\n commitValue(target);\n setCrossedBounds(false);\n setInputText(\n isFocusedRef.current ? formatForEdit(target) : formatCurrent(target),\n );\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n if (effectiveDisabled) return;\n\n const { key, shiftKey } = event;\n if (key === 'ArrowUp') {\n event.preventDefault();\n applyDelta(shiftKey ? 10 : 1);\n } else if (key === 'ArrowDown') {\n event.preventDefault();\n applyDelta(shiftKey ? -10 : -1);\n } else if (key === 'PageUp') {\n event.preventDefault();\n applyDelta(100);\n } else if (key === 'PageDown') {\n event.preventDefault();\n applyDelta(-100);\n } else if (key === 'Home' && min !== undefined) {\n event.preventDefault();\n jumpTo(min);\n } else if (key === 'End' && max !== undefined) {\n event.preventDefault();\n jumpTo(max);\n }\n };\n\n const handleInputChange = (event: ChangeEvent<HTMLInputElement>) => {\n const text = stripNonNumber(event.target.value);\n setInputText(text);\n if (text.trim() === '') {\n commitValue(null);\n setCrossedBounds(false);\n setTextNotANumber(false);\n return;\n }\n const parsed = localeParse(text);\n if (!Number.isNaN(parsed)) {\n commitValue(parsed);\n // Typing your way back to a number clears the flag immediately —\n // the reader should not have to leave the field to see it go.\n setTextNotANumber(false);\n }\n };\n\n /** Refuse a single disallowed keystroke without touching the caret.\n * Multi-character insertions (paste, IME) fall through to `change`, which\n * strips rather than refuses — losing a whole paste over a stray unit\n * would be worse than cleaning it. */\n const handleBeforeInput = (event: FormEvent<HTMLInputElement>) => {\n const { data } = event.nativeEvent as InputEvent;\n if (typeof data !== 'string' || data.length !== 1) return;\n if (!isNumberChar(data)) event.preventDefault();\n };\n\n const handleFocus = (event: FocusEvent<HTMLInputElement>) => {\n onFocus?.(event);\n isFocusedRef.current = true;\n if (currentValue !== null && currentValue !== undefined) {\n setInputText(formatForEdit(currentValue));\n }\n };\n\n const handleBlur = (event: FocusEvent<HTMLInputElement>) => {\n onBlur?.(event);\n isFocusedRef.current = false;\n\n if (inputText.trim() === '') {\n commitValue(null);\n setCrossedBounds(false);\n setTextNotANumber(false);\n setInputText('');\n return;\n }\n const parsed = localeParse(inputText);\n if (Number.isNaN(parsed)) {\n // KEEP WHAT WAS TYPED AND SAY IT IS WRONG. Reverting to the last good\n // value silently discarded the reader's input and looked like the\n // field simply ignored them; the box now goes to the error tone with\n // aria-invalid, holding no number until it is fixed.\n setTextNotANumber(true);\n setCrossedBounds(false);\n commitValue(null);\n return;\n }\n const crossed =\n (min !== undefined && parsed < min) ||\n (max !== undefined && parsed > max);\n setCrossedBounds(crossed);\n setTextNotANumber(false);\n commitValue(parsed);\n setInputText(formatCurrent(parsed));\n };\n\n const preventButtonBlur = (event: MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n };\n\n const handleIncrement = () => applyDelta(1);\n const handleDecrement = () => applyDelta(-1);\n\n const agentHandle = useMemo<NumberInputHandle>(\n () => ({\n getValue: () => currentValueRef.current,\n setValue: (next) => {\n commitValue(next);\n setInputText(\n next === null\n ? ''\n : isFocusedRef.current\n ? formatForEdit(next)\n : formatCurrent(next),\n );\n },\n clear: () => {\n commitValue(null);\n setInputText('');\n setCrossedBounds(false);\n },\n focus: () => innerInputRef.current?.focus(),\n }),\n // The handle is reconstructed per render; consumers (the agent runtime)\n // re-register only when the identity changes, which is a cheap no-op.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [formatForEdit, formatCurrent],\n );\n useAgentRegistration(numberInputAgent, agentHandle, id);\n\n const decrementDisabled =\n effectiveDisabled ||\n (min !== undefined && currentValue !== null && currentValue <= min);\n const incrementDisabled =\n effectiveDisabled ||\n (max !== undefined && currentValue !== null && currentValue >= max);\n\n const valueNow = currentValue ?? undefined;\n const valueTextNeeded =\n (mode === 'currency' || mode === 'percentage') && currentValue !== null;\n const valueText =\n valueTextNeeded && currentValue !== null\n ? localeFormat(currentValue)\n : undefined;\n\n const patternAttr =\n localeNumber.inputMode === 'numeric' ? '[0-9]*' : undefined;\n\n return (\n <div\n className={numberInputVariants({\n size,\n tone: effectiveTone,\n inline,\n className,\n })}\n data-component=\"number-input\"\n data-component-id={id}\n data-mode={mode}\n data-variant={variant}\n data-inline={inline}\n >\n {variant === 'stepper' ? (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label={t('inputs.number.decrement', 'Decrement')}\n onClick={handleDecrement}\n onMouseDown={preventButtonBlur}\n disabled={decrementDisabled}\n className={`${spinnerButton} ds:ps-2 ds:pe-1`}\n >\n <ChevronDown aria-hidden=\"true\" className=\"ds:size-4\" />\n </button>\n ) : null}\n <input\n ref={composedRef}\n id={inputId}\n type=\"text\"\n role=\"spinbutton\"\n inputMode={localeNumber.inputMode}\n pattern={patternAttr}\n autoComplete=\"off\"\n value={inputText}\n disabled={effectiveDisabled}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuenow={valueNow}\n aria-valuetext={valueText}\n aria-invalid={ariaInvalid || undefined}\n aria-required={ctx.required || undefined}\n aria-describedby={describedBy}\n onBeforeInput={handleBeforeInput}\n onChange={handleInputChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n className={fieldVariants({ variant, hasUnit: Boolean(unit), inline })}\n {...rest}\n />\n {unit ? (\n <span id={unitId} className={unitVariants({ variant })}>\n {unit}\n </span>\n ) : null}\n {variant === 'stepper' ? (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label={t('inputs.number.increment', 'Increment')}\n onClick={handleIncrement}\n onMouseDown={preventButtonBlur}\n disabled={incrementDisabled}\n className={`${spinnerButton} ds:ps-1 ds:pe-2`}\n >\n <ChevronUp aria-hidden=\"true\" className=\"ds:size-4\" />\n </button>\n ) : null}\n </div>\n );\n },\n);\n\nNumberInput.displayName = 'NumberInput';\n"],"names":["numberInputAgent","handle","args","normalizeDigits","text","result","ch","code","useLocaleNumber","locale","mode","currency","useMemo","parts","decimalSeparator","_a","p","groupingSeparator","_b","displayFormatter","format","value","parse","normalized","trimmed","hasMinus","cleaned","n","inputMode","maximumFractionDigits","numberInputVariants","cva","fieldVariants","unitVariants","spinnerButton","resolveDefaultLocale","appLocale","language","decimalPlaces","dot","roundToStep","step","factor","NumberInput","forwardRef","defaultValue","onChange","min","max","size","tone","variant","unit","inline","className","id","disabled","onFocus","onBlur","onKeyDown","rest","ref","t","i18n","useTranslation","ctx","useFormField","inputId","effectiveDisabled","unitId","useId","describedBy","resolvedLocale","localeNumber","localeFormat","localeParse","innerInputRef","useRef","composedRef","composeRefs","currentValueRaw","setCurrentValue","useControllableState","currentValue","currentValueRef","formatForEdit","useCallback","displayed","formatCurrent","inputText","setInputText","useState","isFocusedRef","crossedBounds","setCrossedBounds","textNotANumber","setTextNotANumber","isNumberChar","stripNonNumber","kept","useEffect","computedInvalid","ariaInvalid","effectiveTone","commitValue","next","applyDelta","multiplier","jumpTo","target","handleKeyDown","event","key","shiftKey","handleInputChange","parsed","handleBeforeInput","data","handleFocus","handleBlur","crossed","preventButtonBlur","handleIncrement","handleDecrement","agentHandle","useAgentRegistration","decrementDisabled","incrementDisabled","valueNow","valueText","patternAttr","jsxs","jsx","ChevronDown","ChevronUp"],"mappings":";;;;;;;;;;AASO,MAAMA,KAAoD;AAAA,EAC/D,IAAI;AAAA,EACJ,cAAc,CAAC,WAAW;AAAA,EAC1B,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,SAAS;AAAA,MACP,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,eAAe;AAAA,IAAA;AAAA,EAC1C;AAAA,EAEF,SAAS;AAAA,IACP,WAAW;AAAA,MACT,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,UAAU,MAAM,IAAE;AAAA,QAChD,UAAU,CAAC,OAAO;AAAA,MAAA;AAAA,MAEpB,YAAY;AAAA,MACZ,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,GAAA,KAAQ,EAAE,MAAM,EAAE,OAAO,KAAA,GAAQ;AAAA,MAC7D,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,QAAQ,CAACA,GAAQC,MAAmC;AAClD,QAAAD,EAAO,SAASC,EAAK,KAAK;AAAA,MAC5B;AAAA,IAAA;AAAA,IAEF,OAAO;AAAA,MACL,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa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zC;AAAA,cACP,UAAUrB;AAAA,cACV,iBAAerB;AAAA,cACf,iBAAeC;AAAA,cACf,iBAAegF;AAAA,cACf,kBAAgBC;AAAA,cAChB,gBAAc3B,KAAe;AAAA,cAC7B,iBAAerC,EAAI,YAAY;AAAA,cAC/B,oBAAkBM;AAAA,cAClB,eAAe6C;AAAA,cACf,UAAUF;AAAA,cACV,SAASI;AAAA,cACT,QAAQC;AAAA,cACR,WAAWT;AAAA,cACX,WAAW9E,GAAc,EAAE,SAAAmB,GAAS,SAAS,EAAQC,GAAO,QAAAC,GAAQ;AAAA,cACnE,GAAGO;AAAA,YAAA;AAAA,UAAA;AAAA,UAELR,IACC,gBAAAgF,EAAC,QAAA,EAAK,IAAI/D,GAAQ,WAAWpC,GAAa,EAAE,SAAAkB,EAAA,CAAS,GAClD,UAAAC,EAAA,CACH,IACE;AAAA,UACHD,MAAY,YACX,gBAAAiF;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,UAAU;AAAA,cACV,cAAYtE,EAAE,2BAA2B,WAAW;AAAA,cACpD,SAAS4D;AAAA,cACT,aAAaD;AAAA,cACb,UAAUM;AAAA,cACV,WAAW,GAAG7F,EAAa;AAAA,cAE3B,UAAA,gBAAAkG,EAACE,IAAA,EAAU,eAAY,QAAO,WAAU,YAAA,CAAY;AAAA,YAAA;AAAA,UAAA,IAEpD;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;AAEA3F,GAAY,cAAc;"}
|
|
@@ -3,7 +3,7 @@ import { forwardRef as We, useId as je, useRef as ue, useState as Xe, useCallbac
|
|
|
3
3
|
import { c as He } from "./index-D2ZczOXr.js";
|
|
4
4
|
import { useTranslation as Fe } from "react-i18next";
|
|
5
5
|
import { u as qe } from "./registry-DvAUVLHh.js";
|
|
6
|
-
import { N as se } from "./number-input-
|
|
6
|
+
import { N as se } from "./number-input-CM1q9zvH.js";
|
|
7
7
|
import { S as he } from "./select-BW5ecXlX.js";
|
|
8
8
|
import { T as Ke } from "./text-area-Bt3p7Pt0.js";
|
|
9
9
|
import { D as v } from "./description-list-Ck7fKdt5.js";
|
|
@@ -1257,4 +1257,4 @@ export {
|
|
|
1257
1257
|
yt as y,
|
|
1258
1258
|
Re as z
|
|
1259
1259
|
};
|
|
1260
|
-
//# sourceMappingURL=optical-prescription-
|
|
1260
|
+
//# sourceMappingURL=optical-prescription-CQR_WJiS.js.map
|