@bettercms-ai/kit 3.0.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/dist/brand/logo.js +67 -18
  2. package/dist/brand/logo.js.map +1 -1
  3. package/dist/context.js +8 -3
  4. package/dist/context.js.map +1 -1
  5. package/dist/controls/button.js +451 -134
  6. package/dist/controls/button.js.map +1 -1
  7. package/dist/controls/choice.js +336 -95
  8. package/dist/controls/choice.js.map +1 -1
  9. package/dist/controls/code.js +245 -72
  10. package/dist/controls/code.js.map +1 -1
  11. package/dist/controls/color.js +108 -31
  12. package/dist/controls/color.js.map +1 -1
  13. package/dist/controls/date.js +268 -83
  14. package/dist/controls/date.js.map +1 -1
  15. package/dist/controls/form-picker.js +26 -9
  16. package/dist/controls/form-picker.js.map +1 -1
  17. package/dist/controls/icon.js +341 -100
  18. package/dist/controls/icon.js.map +1 -1
  19. package/dist/controls/json.js +20 -7
  20. package/dist/controls/json.js.map +1 -1
  21. package/dist/controls/link.js +561 -156
  22. package/dist/controls/link.js.map +1 -1
  23. package/dist/controls/location.js +124 -35
  24. package/dist/controls/location.js.map +1 -1
  25. package/dist/controls/media.js +928 -267
  26. package/dist/controls/media.js.map +1 -1
  27. package/dist/controls/number.js +80 -23
  28. package/dist/controls/number.js.map +1 -1
  29. package/dist/controls/reference.js +516 -155
  30. package/dist/controls/reference.js.map +1 -1
  31. package/dist/controls/rich-text/article-shell.js +327 -86
  32. package/dist/controls/rich-text/article-shell.js.map +1 -1
  33. package/dist/controls/rich-text/author.js +78 -21
  34. package/dist/controls/rich-text/author.js.map +1 -1
  35. package/dist/controls/rich-text/blocks.js +1084 -315
  36. package/dist/controls/rich-text/blocks.js.map +1 -1
  37. package/dist/controls/rich-text/button.js +30 -9
  38. package/dist/controls/rich-text/button.js.map +1 -1
  39. package/dist/controls/rich-text/catalog.js +168 -51
  40. package/dist/controls/rich-text/catalog.js.map +1 -1
  41. package/dist/controls/rich-text/columns.js +104 -31
  42. package/dist/controls/rich-text/columns.js.map +1 -1
  43. package/dist/controls/rich-text/component-card.js +790 -209
  44. package/dist/controls/rich-text/component-card.js.map +1 -1
  45. package/dist/controls/rich-text/component-panel.js +102 -40
  46. package/dist/controls/rich-text/component-panel.js.map +1 -1
  47. package/dist/controls/rich-text/control.js +101 -32
  48. package/dist/controls/rich-text/control.js.map +1 -1
  49. package/dist/controls/rich-text/editor.js +423 -121
  50. package/dist/controls/rich-text/editor.js.map +1 -1
  51. package/dist/controls/rich-text/embed.js +184 -51
  52. package/dist/controls/rich-text/embed.js.map +1 -1
  53. package/dist/controls/rich-text/floating.js +171 -42
  54. package/dist/controls/rich-text/floating.js.map +1 -1
  55. package/dist/controls/rich-text/footnote.js +89 -28
  56. package/dist/controls/rich-text/footnote.js.map +1 -1
  57. package/dist/controls/rich-text/gallery.js +88 -27
  58. package/dist/controls/rich-text/gallery.js.map +1 -1
  59. package/dist/controls/rich-text/link-form.js +111 -34
  60. package/dist/controls/rich-text/link-form.js.map +1 -1
  61. package/dist/controls/rich-text/plain.js +8 -3
  62. package/dist/controls/rich-text/plain.js.map +1 -1
  63. package/dist/controls/rich-text/related.js +86 -25
  64. package/dist/controls/rich-text/related.js.map +1 -1
  65. package/dist/controls/rich-text/toc.js +48 -15
  66. package/dist/controls/rich-text/toc.js.map +1 -1
  67. package/dist/controls/rich-text/toolbar.js +408 -107
  68. package/dist/controls/rich-text/toolbar.js.map +1 -1
  69. package/dist/controls/scale.js +169 -52
  70. package/dist/controls/scale.js.map +1 -1
  71. package/dist/controls/slot.js +238 -73
  72. package/dist/controls/slot.js.map +1 -1
  73. package/dist/controls/table/table-editor.js +1766 -500
  74. package/dist/controls/table/table-editor.js.map +1 -1
  75. package/dist/controls/table/table-link.js +119 -38
  76. package/dist/controls/table/table-link.js.map +1 -1
  77. package/dist/controls/table/table.js +26 -9
  78. package/dist/controls/table/table.js.map +1 -1
  79. package/dist/controls/text.js +221 -68
  80. package/dist/controls/text.js.map +1 -1
  81. package/dist/controls/unknown-value.js +79 -22
  82. package/dist/controls/unknown-value.js.map +1 -1
  83. package/dist/engine/array.js +821 -228
  84. package/dist/engine/array.js.map +1 -1
  85. package/dist/engine/bits.js +38 -13
  86. package/dist/engine/bits.js.map +1 -1
  87. package/dist/engine/breadcrumb.js +25 -8
  88. package/dist/engine/breadcrumb.js.map +1 -1
  89. package/dist/engine/expand.js +38 -13
  90. package/dist/engine/expand.js.map +1 -1
  91. package/dist/engine/field-list.js +14 -5
  92. package/dist/engine/field-list.js.map +1 -1
  93. package/dist/engine/field-shell.js +849 -244
  94. package/dist/engine/field-shell.js.map +1 -1
  95. package/dist/engine/frame.js +275 -78
  96. package/dist/engine/frame.js.map +1 -1
  97. package/dist/engine/grouping.js +630 -193
  98. package/dist/engine/grouping.js.map +1 -1
  99. package/dist/engine/item-list.js +187 -50
  100. package/dist/engine/item-list.js.map +1 -1
  101. package/dist/engine/kit-field.js +320 -95
  102. package/dist/engine/kit-field.js.map +1 -1
  103. package/dist/engine/schema-form.js +101 -32
  104. package/dist/engine/schema-form.js.map +1 -1
  105. package/dist/engine/slot.js +146 -45
  106. package/dist/engine/slot.js.map +1 -1
  107. package/dist/index.js +2 -2
  108. package/dist/lib/icons.js +14 -5
  109. package/dist/lib/icons.js.map +1 -1
  110. package/dist/styles.css +5821 -1
  111. package/dist/table/table-view.js +49 -16
  112. package/dist/table/table-view.js.map +1 -1
  113. package/dist/testing/test-form.js +14 -5
  114. package/dist/testing/test-form.js.map +1 -1
  115. package/dist/theme.js +8 -3
  116. package/dist/theme.js.map +1 -1
  117. package/dist/ui/action-tray.js +97 -24
  118. package/dist/ui/action-tray.js.map +1 -1
  119. package/dist/ui/autocomplete.js +135 -38
  120. package/dist/ui/autocomplete.js.map +1 -1
  121. package/dist/ui/button.js +108 -31
  122. package/dist/ui/button.js.map +1 -1
  123. package/dist/ui/choice-switch.js +14 -5
  124. package/dist/ui/choice-switch.js.map +1 -1
  125. package/dist/ui/controls.js +279 -86
  126. package/dist/ui/controls.js.map +1 -1
  127. package/dist/ui/display.js +401 -116
  128. package/dist/ui/display.js.map +1 -1
  129. package/dist/ui/expanded-editor-modal.js +100 -27
  130. package/dist/ui/expanded-editor-modal.js.map +1 -1
  131. package/dist/ui/floating-panel.js +130 -37
  132. package/dist/ui/floating-panel.js.map +1 -1
  133. package/dist/ui/index.js +2 -2
  134. package/dist/ui/input.js +196 -59
  135. package/dist/ui/input.js.map +1 -1
  136. package/dist/ui/mode-bar.js +32 -11
  137. package/dist/ui/mode-bar.js.map +1 -1
  138. package/dist/ui/overlay.js +616 -179
  139. package/dist/ui/overlay.js.map +1 -1
  140. package/dist/ui/path-crumbs.js +374 -113
  141. package/dist/ui/path-crumbs.js.map +1 -1
  142. package/dist/ui/select.js +311 -78
  143. package/dist/ui/select.js.map +1 -1
  144. package/dist/ui/shortcut-hint.d.ts +3 -0
  145. package/dist/ui/shortcut-hint.js +33 -7
  146. package/dist/ui/shortcut-hint.js.map +1 -1
  147. package/dist/ui/spinner.js +20 -7
  148. package/dist/ui/spinner.js.map +1 -1
  149. package/dist/ui/split-button.js +35 -10
  150. package/dist/ui/split-button.js.map +1 -1
  151. package/dist/ui/tab.js +50 -17
  152. package/dist/ui/tab.js.map +1 -1
  153. package/dist/ui/toast.js +107 -30
  154. package/dist/ui/toast.js.map +1 -1
  155. package/dist/ui/tooltip-root.js +24 -7
  156. package/dist/ui/tooltip-root.js.map +1 -1
  157. package/package.json +2 -2
@@ -5,7 +5,7 @@ import { fieldScale } from "../schema/scale.js";
5
5
  import { FallbackControl } from "../engine/kit-field.js";
6
6
  import { TEXT_FOCUS } from "./text.js";
7
7
  import * as React from "react";
8
- import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { jsxDEV } from "react/jsx-dev-runtime";
9
9
  import { IconStarFilled } from "@tabler/icons-react";
10
10
  //#region src/controls/number.tsx
11
11
  /**
@@ -19,6 +19,7 @@ import { IconStarFilled } from "@tabler/icons-react";
19
19
  * Stored shapes (prod `number`, `typeof === "number"`): a number, or null when cleared. A rating stays on its scale
20
20
  * (ratingToProd refuses anything off it), so the control only ever writes a step of the scale or null.
21
21
  */
22
+ var _jsxFileName = "D:/Github/bettercms/bettercms-backend/packages/kit/src/controls/number.tsx";
22
23
  /** Registered by the choice / scale lane: the control for a number with a scale. */
23
24
  var NUMBER_SCALE = {};
24
25
  var toNum = (v) => typeof v === "number" && Number.isFinite(v) ? v : typeof v === "string" && v.trim() !== "" && Number.isFinite(Number(v)) ? Number(v) : null;
@@ -26,9 +27,17 @@ var toNum = (v) => typeof v === "number" && Number.isFinite(v) ? v : typeof v ==
26
27
  var NUMBER_TYPING = /^-?\d*\.?\d*$/;
27
28
  var decimals = (n) => (String(n).split(".")[1] ?? "").length;
28
29
  function NumberControl(p) {
29
- if (!fieldScale(p.field)) return /* @__PURE__ */ jsx(PlainNumber, { ...p });
30
+ if (!fieldScale(p.field)) return /* @__PURE__ */ jsxDEV(PlainNumber, { ...p }, void 0, false, {
31
+ fileName: _jsxFileName,
32
+ lineNumber: 33,
33
+ columnNumber: 36
34
+ }, this);
30
35
  const Scale = NUMBER_SCALE.control ?? FallbackControl;
31
- return /* @__PURE__ */ jsx(Scale, { ...p });
36
+ return /* @__PURE__ */ jsxDEV(Scale, { ...p }, void 0, false, {
37
+ fileName: _jsxFileName,
38
+ lineNumber: 35,
39
+ columnNumber: 10
40
+ }, this);
32
41
  }
33
42
  function PlainNumber({ field, value, onChange, readOnly, id, invalid, onBlur }) {
34
43
  const { variant } = useKitEnv();
@@ -53,10 +62,10 @@ function PlainNumber({ field, value, onChange, readOnly, id, invalid, onBlur })
53
62
  }
54
63
  setDraft(null);
55
64
  };
56
- return /* @__PURE__ */ jsxs("div", {
65
+ return /* @__PURE__ */ jsxDEV("div", {
57
66
  "data-slot": "kit-number",
58
67
  className: cn("flex w-full max-w-40 items-center rounded-kit-md border border-kit-line-strong bg-kit-field-bg transition-colors hover:border-kit-line-strong focus-within:border-kit-line-strong focus-within:bg-kit-field-bg", variant === "document" ? "h-9" : "h-8", invalid && "border-[var(--kit-field-invalid)]", readOnly && "opacity-80"),
59
- children: [/* @__PURE__ */ jsx("input", {
68
+ children: [/* @__PURE__ */ jsxDEV("input", {
60
69
  id,
61
70
  inputMode: "decimal",
62
71
  value: draft ?? (n == null ? "" : String(n)),
@@ -85,9 +94,13 @@ function PlainNumber({ field, value, onChange, readOnly, id, invalid, onBlur })
85
94
  }
86
95
  },
87
96
  className: cn(TEXT_FOCUS, "tabular-nums h-full min-w-0 flex-1 bg-transparent px-2.5 text-kit-sm text-kit-fg outline-none placeholder:text-kit-fg-3")
88
- }), unit ? /* @__PURE__ */ jsx(Tooltip, {
97
+ }, void 0, false, {
98
+ fileName: _jsxFileName,
99
+ lineNumber: 73,
100
+ columnNumber: 7
101
+ }, this), unit ? /* @__PURE__ */ jsxDEV(Tooltip, {
89
102
  content: readOnly ? void 0 : "Drag to adjust · Shift for ×10",
90
- children: /* @__PURE__ */ jsx("span", {
103
+ children: /* @__PURE__ */ jsxDEV("span", {
91
104
  "data-slot": "kit-number-unit",
92
105
  onPointerDown: (e) => {
93
106
  if (readOnly) return;
@@ -107,9 +120,21 @@ function PlainNumber({ field, value, onChange, readOnly, id, invalid, onBlur })
107
120
  onPointerCancel: () => start.current = null,
108
121
  className: "flex h-full cursor-ew-resize select-none items-center pl-1 pr-2.5 text-kit-xs text-kit-fg-3 hover:text-kit-fg",
109
122
  children: unit
110
- })
111
- }) : null]
112
- });
123
+ }, void 0, false, {
124
+ fileName: _jsxFileName,
125
+ lineNumber: 105,
126
+ columnNumber: 11
127
+ }, this)
128
+ }, void 0, false, {
129
+ fileName: _jsxFileName,
130
+ lineNumber: 104,
131
+ columnNumber: 9
132
+ }, this) : null]
133
+ }, void 0, true, {
134
+ fileName: _jsxFileName,
135
+ lineNumber: 64,
136
+ columnNumber: 5
137
+ }, this);
113
138
  }
114
139
  /** Prod's rating scale, from the field's numeric bounds (0 · 5 · 1 unset). */
115
140
  function ratingScale(field) {
@@ -139,10 +164,10 @@ function RatingControl({ field, value, onChange, readOnly, id, invalid, onBlur }
139
164
  }
140
165
  setDraft(null);
141
166
  };
142
- return /* @__PURE__ */ jsxs("div", {
167
+ return /* @__PURE__ */ jsxDEV("div", {
143
168
  className: "flex items-center gap-3",
144
169
  children: [
145
- /* @__PURE__ */ jsx("div", {
170
+ /* @__PURE__ */ jsxDEV("div", {
146
171
  role: "radiogroup",
147
172
  "aria-label": `${field.title} rating`,
148
173
  className: "flex items-center",
@@ -150,7 +175,7 @@ function RatingControl({ field, value, onChange, readOnly, id, invalid, onBlur }
150
175
  children: Array.from({ length: stars }, (_, k) => k + 1).map((i) => {
151
176
  const fill = Math.max(0, Math.min(1, shown - (i - 1)));
152
177
  const pick = snapRating(i, scale);
153
- return /* @__PURE__ */ jsxs("button", {
178
+ return /* @__PURE__ */ jsxDEV("button", {
154
179
  type: "button",
155
180
  role: "radio",
156
181
  "aria-checked": n != null && Math.ceil(n) === i,
@@ -159,15 +184,35 @@ function RatingControl({ field, value, onChange, readOnly, id, invalid, onBlur }
159
184
  onMouseEnter: () => setHover(i),
160
185
  onClick: () => onChange(pick),
161
186
  className: "relative flex size-7 items-center justify-center transition-transform hover:scale-110",
162
- children: [/* @__PURE__ */ jsx(IconStarFilled, { className: "size-[18px] text-kit-line-strong" }), /* @__PURE__ */ jsx("span", {
187
+ children: [/* @__PURE__ */ jsxDEV(IconStarFilled, { className: "size-[18px] text-kit-line-strong" }, void 0, false, {
188
+ fileName: _jsxFileName,
189
+ lineNumber: 176,
190
+ columnNumber: 15
191
+ }, this), /* @__PURE__ */ jsxDEV("span", {
163
192
  className: "absolute inset-0 flex items-center justify-center overflow-hidden",
164
193
  style: { clipPath: `inset(0 ${100 - fill * 100}% 0 0)` },
165
- children: /* @__PURE__ */ jsx(IconStarFilled, { className: "size-[18px] text-kit-warning" })
166
- })]
167
- }, i);
194
+ children: /* @__PURE__ */ jsxDEV(IconStarFilled, { className: "size-[18px] text-kit-warning" }, void 0, false, {
195
+ fileName: _jsxFileName,
196
+ lineNumber: 178,
197
+ columnNumber: 17
198
+ }, this)
199
+ }, void 0, false, {
200
+ fileName: _jsxFileName,
201
+ lineNumber: 177,
202
+ columnNumber: 15
203
+ }, this)]
204
+ }, i, true, {
205
+ fileName: _jsxFileName,
206
+ lineNumber: 165,
207
+ columnNumber: 13
208
+ }, this);
168
209
  })
169
- }),
170
- /* @__PURE__ */ jsx("input", {
210
+ }, void 0, false, {
211
+ fileName: _jsxFileName,
212
+ lineNumber: 160,
213
+ columnNumber: 7
214
+ }, this),
215
+ /* @__PURE__ */ jsxDEV("input", {
171
216
  id,
172
217
  inputMode: "decimal",
173
218
  value: draft ?? (n == null ? "" : String(n)),
@@ -182,13 +227,25 @@ function RatingControl({ field, value, onChange, readOnly, id, invalid, onBlur }
182
227
  },
183
228
  onKeyDown: (e) => e.key === "Enter" && e.currentTarget.blur(),
184
229
  className: "tabular-nums h-7 w-12 rounded-kit-md border border-kit-line-strong bg-kit-field-bg px-2 text-kit-sm text-kit-fg outline-none hover:border-kit-line-strong focus:border-kit-line-strong focus:bg-kit-field-bg"
185
- }),
186
- /* @__PURE__ */ jsxs("span", {
230
+ }, void 0, false, {
231
+ fileName: _jsxFileName,
232
+ lineNumber: 184,
233
+ columnNumber: 7
234
+ }, this),
235
+ /* @__PURE__ */ jsxDEV("span", {
187
236
  className: "text-kit-xs text-kit-fg-3",
188
237
  children: ["out of ", scale.max]
189
- })
238
+ }, void 0, true, {
239
+ fileName: _jsxFileName,
240
+ lineNumber: 200,
241
+ columnNumber: 7
242
+ }, this)
190
243
  ]
191
- });
244
+ }, void 0, true, {
245
+ fileName: _jsxFileName,
246
+ lineNumber: 159,
247
+ columnNumber: 5
248
+ }, this);
192
249
  }
193
250
  //#endregion
194
251
  export { NUMBER_SCALE, NumberControl, PlainNumber, RatingControl, ratingScale, snapRating, toNum };
@@ -1 +1 @@
1
- {"version":3,"file":"number.js","names":[],"sources":["../../src/controls/number.tsx"],"sourcesContent":["/**\n * NUMBER — a plain input, NO stepper (prod CPO-068), V2 HEAD 9829bf1 kit/controls/number.tsx, DESIGN §8.4.\n * ↑/↓ step (Shift ×10), the value commits on blur or Enter, clamped to min/max and rounded to the step's precision only when the schema sets a step (V2 rounds to a default step of 1; prod never rounds, so a typed 2.5 stays 2.5);\n * the unit suffix scrubs on drag (Shift ×10); the wheel never changes a value (it blurs).\n * A number with a scale (`field.scale`, or `layout: \"slider\"` + min/max) is the scale control, which the choice lane\n * registers in NUMBER_SCALE; a host that never registered it edits the raw value (FallbackControl), never a plain box.\n * RATING — stars across the prod scale (config.min 0 · max 5 · step 1 unset) plus a number box for half steps.\n *\n * Stored shapes (prod `number`, `typeof === \"number\"`): a number, or null when cleared. A rating stays on its scale\n * (ratingToProd refuses anything off it), so the control only ever writes a step of the scale or null.\n */\nimport * as React from \"react\";\nimport type { ComponentType } from \"react\";\nimport { IconStarFilled } from \"@tabler/icons-react\";\nimport { cn } from \"../lib/cn\";\nimport { useKitEnv } from \"../context\";\nimport { fieldScale } from \"../schema/scale\";\nimport { FallbackControl } from \"../engine/kit-field\";\nimport { Tooltip } from \"../ui/overlay\";\nimport type { ControlProps } from \"../types\";\nimport { TEXT_FOCUS } from \"./text\";\n\n/** Registered by the choice / scale lane: the control for a number with a scale. */\nexport const NUMBER_SCALE: { control?: ComponentType<ControlProps> } = {};\n\nexport const toNum = (v: unknown): number | null =>\n typeof v === \"number\" && Number.isFinite(v) ? v : typeof v === \"string\" && v.trim() !== \"\" && Number.isFinite(Number(v)) ? Number(v) : null;\n/** What a keystroke may leave in a number box: an optional minus, digits, one decimal point. */\nconst NUMBER_TYPING = /^-?\\d*\\.?\\d*$/;\nconst decimals = (n: number) => (String(n).split(\".\")[1] ?? \"\").length;\n\nexport function NumberControl(p: ControlProps) {\n if (!fieldScale(p.field)) return <PlainNumber {...p} />;\n const Scale = NUMBER_SCALE.control ?? FallbackControl;\n return <Scale {...p} />;\n}\n\nexport function PlainNumber({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const { variant } = useKitEnv();\n const n = toNum(value);\n const step = field.numeric?.step && field.numeric.step > 0 ? field.numeric.step : 1;\n const lo = field.numeric?.min ?? -Infinity;\n const hi = field.numeric?.max ?? Infinity;\n /* Round to the step only when the schema sets one: with no step a typed 2.5 stays 2.5 (prod NumberField never rounds).\n The rounding then only trims float noise from ↑/↓ (2.5 + 1 → 3.5, 0.1 + 0.2 → 0.3). */\n const setStep = !!field.numeric?.step && field.numeric.step > 0;\n const clamp = (x: number, from?: number) => {\n const precision = setStep ? decimals(step) : from == null ? null : Math.max(decimals(step), decimals(from));\n return Math.min(hi, Math.max(lo, precision == null ? x : Number(x.toFixed(precision))));\n };\n const [draft, setDraft] = React.useState<string | null>(null);\n const start = React.useRef<{ x: number; v: number } | null>(null);\n const unit = field.numeric?.unit;\n const commit = () => {\n if (draft !== null) {\n const t = draft.trim();\n const x = Number(t);\n if (t === \"\") onChange(null);\n else if (t !== \"-\" && t !== \".\" && Number.isFinite(x)) onChange(clamp(x));\n }\n setDraft(null);\n };\n return (\n <div\n data-slot=\"kit-number\"\n className={cn(\n \"flex w-full max-w-40 items-center rounded-kit-md border border-kit-line-strong bg-kit-field-bg transition-colors hover:border-kit-line-strong focus-within:border-kit-line-strong focus-within:bg-kit-field-bg\",\n variant === \"document\" ? \"h-9\" : \"h-8\",\n invalid && \"border-[var(--kit-field-invalid)]\",\n readOnly && \"opacity-80\",\n )}\n >\n <input\n id={id}\n inputMode=\"decimal\"\n value={draft ?? (n == null ? \"\" : String(n))}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder={field.placeholder ?? \"0\"}\n onWheel={(e) => e.currentTarget.blur()}\n onChange={(e) => NUMBER_TYPING.test(e.target.value) && setDraft(e.target.value)}\n onBlur={() => {\n commit();\n onBlur?.();\n }}\n onKeyDown={(e) => {\n if (readOnly) return;\n if (e.key === \"Enter\") e.currentTarget.blur();\n if (e.key === \"Escape\" && draft !== null) {\n e.stopPropagation();\n setDraft(null);\n }\n if (e.key === \"ArrowUp\" || e.key === \"ArrowDown\") {\n e.preventDefault();\n const base = draft !== null && Number.isFinite(Number(draft)) && draft.trim() !== \"\" ? Number(draft) : (n ?? 0);\n const d = (e.key === \"ArrowUp\" ? 1 : -1) * step * (e.shiftKey ? 10 : 1);\n setDraft(null);\n onChange(clamp(base + d, base));\n }\n }}\n className={cn(TEXT_FOCUS, \"tabular-nums h-full min-w-0 flex-1 bg-transparent px-2.5 text-kit-sm text-kit-fg outline-none placeholder:text-kit-fg-3\")}\n />\n {unit ? (\n <Tooltip content={readOnly ? undefined : \"Drag to adjust · Shift for ×10\"}>\n <span\n data-slot=\"kit-number-unit\"\n onPointerDown={(e) => {\n if (readOnly) return;\n e.currentTarget.setPointerCapture?.(e.pointerId);\n start.current = { x: e.clientX, v: n ?? 0 };\n }}\n onPointerMove={(e) => {\n if (!start.current) return;\n const dx = e.clientX - start.current.x;\n const next = clamp(start.current.v + Math.round(dx / 4) * step * (e.shiftKey ? 10 : 1), start.current.v);\n if (next !== n) onChange(next);\n }}\n onPointerUp={() => (start.current = null)}\n onPointerCancel={() => (start.current = null)}\n className=\"flex h-full cursor-ew-resize select-none items-center pl-1 pr-2.5 text-kit-xs text-kit-fg-3 hover:text-kit-fg\"\n >\n {unit}\n </span>\n </Tooltip>\n ) : null}\n </div>\n );\n}\n\n/** Prod's rating scale, from the field's numeric bounds (0 · 5 · 1 unset). */\nexport function ratingScale(field: ControlProps[\"field\"]) {\n const min = field.numeric?.min ?? 0;\n const max = field.numeric?.max ?? 5;\n const step = field.numeric?.step && field.numeric.step > 0 ? field.numeric.step : 1;\n return { min, max, step };\n}\n/** A typed rating snapped onto its scale; null when it cannot be (empty, not a number). */\nexport function snapRating(x: number, { min, max, step }: { min: number; max: number; step: number }): number {\n const snapped = min + Math.round((x - min) / step) * step;\n return Number(Math.min(max, Math.max(min, snapped)).toFixed(decimals(step)));\n}\n\nexport function RatingControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const scale = ratingScale(field);\n const stars = Math.max(1, Math.min(10, Math.ceil(scale.max)));\n const n = toNum(value);\n const [hover, setHover] = React.useState<number | null>(null);\n const [draft, setDraft] = React.useState<string | null>(null);\n const shown = hover ?? n ?? 0;\n const commit = () => {\n if (draft !== null) {\n const t = draft.trim();\n if (t === \"\") onChange(null);\n else if (Number.isFinite(Number(t)) && t !== \".\") onChange(snapRating(Number(t), scale));\n }\n setDraft(null);\n };\n return (\n <div className=\"flex items-center gap-3\">\n <div role=\"radiogroup\" aria-label={`${field.title} rating`} className=\"flex items-center\" onMouseLeave={() => setHover(null)}>\n {Array.from({ length: stars }, (_, k) => k + 1).map((i) => {\n const fill = Math.max(0, Math.min(1, shown - (i - 1)));\n const pick = snapRating(i, scale);\n return (\n <button\n key={i}\n type=\"button\"\n role=\"radio\"\n aria-checked={n != null && Math.ceil(n) === i}\n aria-label={`${i} star${i > 1 ? \"s\" : \"\"}`}\n disabled={readOnly}\n onMouseEnter={() => setHover(i)}\n onClick={() => onChange(pick)}\n className=\"relative flex size-7 items-center justify-center transition-transform hover:scale-110\"\n >\n <IconStarFilled className=\"size-[18px] text-kit-line-strong\" />\n <span className=\"absolute inset-0 flex items-center justify-center overflow-hidden\" style={{ clipPath: `inset(0 ${100 - fill * 100}% 0 0)` }}>\n <IconStarFilled className=\"size-[18px] text-kit-warning\" />\n </span>\n </button>\n );\n })}\n </div>\n <input\n id={id}\n inputMode=\"decimal\"\n value={draft ?? (n == null ? \"\" : String(n))}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder=\"–\"\n onWheel={(e) => e.currentTarget.blur()}\n onChange={(e) => /^\\d*\\.?\\d*$/.test(e.target.value) && setDraft(e.target.value)}\n onBlur={() => {\n commit();\n onBlur?.();\n }}\n onKeyDown={(e) => e.key === \"Enter\" && e.currentTarget.blur()}\n className=\"tabular-nums h-7 w-12 rounded-kit-md border border-kit-line-strong bg-kit-field-bg px-2 text-kit-sm text-kit-fg outline-none hover:border-kit-line-strong focus:border-kit-line-strong focus:bg-kit-field-bg\"\n />\n <span className=\"text-kit-xs text-kit-fg-3\">out of {scale.max}</span>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAa,eAA0D,CAAC;AAExE,IAAa,SAAS,MACpB,OAAO,MAAM,YAAY,OAAO,SAAS,CAAC,IAAI,IAAI,OAAO,MAAM,YAAY,EAAE,KAAK,MAAM,MAAM,OAAO,SAAS,OAAO,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI;;AAEzI,IAAM,gBAAgB;AACtB,IAAM,YAAY,OAAe,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,GAAA,CAAI;AAEhE,SAAgB,cAAc,GAAiB;CAC7C,IAAI,CAAC,WAAW,EAAE,KAAK,GAAG,OAAO,oBAAC,aAAD,EAAa,GAAI,EAAI,CAAA;CACtD,MAAM,QAAQ,aAAa,WAAW;CACtC,OAAO,oBAAC,OAAD,EAAO,GAAI,EAAI,CAAA;AACxB;AAEA,SAAgB,YAAY,EAAE,OAAO,OAAO,UAAU,UAAU,IAAI,SAAS,UAAwB;CACnG,MAAM,EAAE,YAAY,UAAU;CAC9B,MAAM,IAAI,MAAM,KAAK;CACrB,MAAM,OAAO,MAAM,SAAS,QAAQ,MAAM,QAAQ,OAAO,IAAI,MAAM,QAAQ,OAAO;CAClF,MAAM,KAAK,MAAM,SAAS,OAAO;CACjC,MAAM,KAAK,MAAM,SAAS,OAAO;CAGjC,MAAM,UAAU,CAAC,CAAC,MAAM,SAAS,QAAQ,MAAM,QAAQ,OAAO;CAC9D,MAAM,SAAS,GAAW,SAAkB;EAC1C,MAAM,YAAY,UAAU,SAAS,IAAI,IAAI,QAAQ,OAAO,OAAO,KAAK,IAAI,SAAS,IAAI,GAAG,SAAS,IAAI,CAAC;EAC1G,OAAO,KAAK,IAAI,IAAI,KAAK,IAAI,IAAI,aAAa,OAAO,IAAI,O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I,QAAQ;OACzI,UAAA,oBAAC,gBAAD,EAAgB,WAAU,+BAAgC,CAAA;MACtD,CAAA,CACA;KAdD,GAAA,CAcC;IAEZ,CAAC;GACE,CAAA;GACL,oBAAC,SAAD;IACM;IACJ,WAAU;IACV,OAAO,UAAU,KAAK,OAAO,KAAK,OAAO,CAAC;IAChC;IACV,gBAAc;IACd,aAAY;IACZ,UAAU,MAAM,EAAE,cAAc,KAAK;IACrC,WAAW,MAAM,cAAc,KAAK,EAAE,OAAO,KAAK,KAAK,SAAS,EAAE,OAAO,KAAK;IAC9E,cAAc;KACZ,OAAO;KACP,SAAS;IACX;IACA,YAAY,MAAM,EAAE,QAAQ,WAAW,EAAE,cAAc,KAAK;IAC5D,WAAU;GACX,CAAA;GACD,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CAA4C,WAAQ,MAAM,GAAU;;EACjE;;AAET"}
1
+ {"version":3,"file":"number.js","names":[],"sources":["../../src/controls/number.tsx"],"sourcesContent":["/**\n * NUMBER — a plain input, NO stepper (prod CPO-068), V2 HEAD 9829bf1 kit/controls/number.tsx, DESIGN §8.4.\n * ↑/↓ step (Shift ×10), the value commits on blur or Enter, clamped to min/max and rounded to the step's precision only when the schema sets a step (V2 rounds to a default step of 1; prod never rounds, so a typed 2.5 stays 2.5);\n * the unit suffix scrubs on drag (Shift ×10); the wheel never changes a value (it blurs).\n * A number with a scale (`field.scale`, or `layout: \"slider\"` + min/max) is the scale control, which the choice lane\n * registers in NUMBER_SCALE; a host that never registered it edits the raw value (FallbackControl), never a plain box.\n * RATING — stars across the prod scale (config.min 0 · max 5 · step 1 unset) plus a number box for half steps.\n *\n * Stored shapes (prod `number`, `typeof === \"number\"`): a number, or null when cleared. A rating stays on its scale\n * (ratingToProd refuses anything off it), so the control only ever writes a step of the scale or null.\n */\nimport * as React from \"react\";\nimport type { ComponentType } from \"react\";\nimport { IconStarFilled } from \"@tabler/icons-react\";\nimport { cn } from \"../lib/cn\";\nimport { useKitEnv } from \"../context\";\nimport { fieldScale } from \"../schema/scale\";\nimport { FallbackControl } from \"../engine/kit-field\";\nimport { Tooltip } from \"../ui/overlay\";\nimport type { ControlProps } from \"../types\";\nimport { TEXT_FOCUS } from \"./text\";\n\n/** Registered by the choice / scale lane: the control for a number with a scale. */\nexport const NUMBER_SCALE: { control?: ComponentType<ControlProps> } = {};\n\nexport const toNum = (v: unknown): number | null =>\n typeof v === \"number\" && Number.isFinite(v) ? v : typeof v === \"string\" && v.trim() !== \"\" && Number.isFinite(Number(v)) ? Number(v) : null;\n/** What a keystroke may leave in a number box: an optional minus, digits, one decimal point. */\nconst NUMBER_TYPING = /^-?\\d*\\.?\\d*$/;\nconst decimals = (n: number) => (String(n).split(\".\")[1] ?? \"\").length;\n\nexport function NumberControl(p: ControlProps) {\n if (!fieldScale(p.field)) return <PlainNumber {...p} />;\n const Scale = NUMBER_SCALE.control ?? FallbackControl;\n return <Scale {...p} />;\n}\n\nexport function PlainNumber({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const { variant } = useKitEnv();\n const n = toNum(value);\n const step = field.numeric?.step && field.numeric.step > 0 ? field.numeric.step : 1;\n const lo = field.numeric?.min ?? -Infinity;\n const hi = field.numeric?.max ?? Infinity;\n /* Round to the step only when the schema sets one: with no step a typed 2.5 stays 2.5 (prod NumberField never rounds).\n The rounding then only trims float noise from ↑/↓ (2.5 + 1 → 3.5, 0.1 + 0.2 → 0.3). */\n const setStep = !!field.numeric?.step && field.numeric.step > 0;\n const clamp = (x: number, from?: number) => {\n const precision = setStep ? decimals(step) : from == null ? null : Math.max(decimals(step), decimals(from));\n return Math.min(hi, Math.max(lo, precision == null ? x : Number(x.toFixed(precision))));\n };\n const [draft, setDraft] = React.useState<string | null>(null);\n const start = React.useRef<{ x: number; v: number } | null>(null);\n const unit = field.numeric?.unit;\n const commit = () => {\n if (draft !== null) {\n const t = draft.trim();\n const x = Number(t);\n if (t === \"\") onChange(null);\n else if (t !== \"-\" && t !== \".\" && Number.isFinite(x)) onChange(clamp(x));\n }\n setDraft(null);\n };\n return (\n <div\n data-slot=\"kit-number\"\n className={cn(\n \"flex w-full max-w-40 items-center rounded-kit-md border border-kit-line-strong bg-kit-field-bg transition-colors hover:border-kit-line-strong focus-within:border-kit-line-strong focus-within:bg-kit-field-bg\",\n variant === \"document\" ? \"h-9\" : \"h-8\",\n invalid && \"border-[var(--kit-field-invalid)]\",\n readOnly && \"opacity-80\",\n )}\n >\n <input\n id={id}\n inputMode=\"decimal\"\n value={draft ?? (n == null ? \"\" : String(n))}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder={field.placeholder ?? \"0\"}\n onWheel={(e) => e.currentTarget.blur()}\n onChange={(e) => NUMBER_TYPING.test(e.target.value) && setDraft(e.target.value)}\n onBlur={() => {\n commit();\n onBlur?.();\n }}\n onKeyDown={(e) => {\n if (readOnly) return;\n if (e.key === \"Enter\") e.currentTarget.blur();\n if (e.key === \"Escape\" && draft !== null) {\n e.stopPropagation();\n setDraft(null);\n }\n if (e.key === \"ArrowUp\" || e.key === \"ArrowDown\") {\n e.preventDefault();\n const base = draft !== null && Number.isFinite(Number(draft)) && draft.trim() !== \"\" ? Number(draft) : (n ?? 0);\n const d = (e.key === \"ArrowUp\" ? 1 : -1) * step * (e.shiftKey ? 10 : 1);\n setDraft(null);\n onChange(clamp(base + d, base));\n }\n }}\n className={cn(TEXT_FOCUS, \"tabular-nums h-full min-w-0 flex-1 bg-transparent px-2.5 text-kit-sm text-kit-fg outline-none placeholder:text-kit-fg-3\")}\n />\n {unit ? (\n <Tooltip content={readOnly ? undefined : \"Drag to adjust · Shift for ×10\"}>\n <span\n data-slot=\"kit-number-unit\"\n onPointerDown={(e) => {\n if (readOnly) return;\n e.currentTarget.setPointerCapture?.(e.pointerId);\n start.current = { x: e.clientX, v: n ?? 0 };\n }}\n onPointerMove={(e) => {\n if (!start.current) return;\n const dx = e.clientX - start.current.x;\n const next = clamp(start.current.v + Math.round(dx / 4) * step * (e.shiftKey ? 10 : 1), start.current.v);\n if (next !== n) onChange(next);\n }}\n onPointerUp={() => (start.current = null)}\n onPointerCancel={() => (start.current = null)}\n className=\"flex h-full cursor-ew-resize select-none items-center pl-1 pr-2.5 text-kit-xs text-kit-fg-3 hover:text-kit-fg\"\n >\n {unit}\n </span>\n </Tooltip>\n ) : null}\n </div>\n );\n}\n\n/** Prod's rating scale, from the field's numeric bounds (0 · 5 · 1 unset). */\nexport function ratingScale(field: ControlProps[\"field\"]) {\n const min = field.numeric?.min ?? 0;\n const max = field.numeric?.max ?? 5;\n const step = field.numeric?.step && field.numeric.step > 0 ? field.numeric.step : 1;\n return { min, max, step };\n}\n/** A typed rating snapped onto its scale; null when it cannot be (empty, not a number). */\nexport function snapRating(x: number, { min, max, step }: { min: number; max: number; step: number }): number {\n const snapped = min + Math.round((x - min) / step) * step;\n return Number(Math.min(max, Math.max(min, snapped)).toFixed(decimals(step)));\n}\n\nexport function RatingControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const scale = ratingScale(field);\n const stars = Math.max(1, Math.min(10, Math.ceil(scale.max)));\n const n = toNum(value);\n const [hover, setHover] = React.useState<number | null>(null);\n const [draft, setDraft] = React.useState<string | null>(null);\n const shown = hover ?? n ?? 0;\n const commit = () => {\n if (draft !== null) {\n const t = draft.trim();\n if (t === \"\") onChange(null);\n else if (Number.isFinite(Number(t)) && t !== \".\") onChange(snapRating(Number(t), scale));\n }\n setDraft(null);\n };\n return (\n <div className=\"flex items-center gap-3\">\n <div role=\"radiogroup\" aria-label={`${field.title} rating`} className=\"flex items-center\" onMouseLeave={() => setHover(null)}>\n {Array.from({ length: stars }, (_, k) => k + 1).map((i) => {\n const fill = Math.max(0, Math.min(1, shown - (i - 1)));\n const pick = snapRating(i, scale);\n return (\n <button\n key={i}\n type=\"button\"\n role=\"radio\"\n aria-checked={n != null && Math.ceil(n) === i}\n aria-label={`${i} star${i > 1 ? \"s\" : \"\"}`}\n disabled={readOnly}\n onMouseEnter={() => setHover(i)}\n onClick={() => onChange(pick)}\n className=\"relative flex size-7 items-center justify-center transition-transform hover:scale-110\"\n >\n <IconStarFilled className=\"size-[18px] text-kit-line-strong\" />\n <span className=\"absolute inset-0 flex items-center justify-center overflow-hidden\" style={{ clipPath: `inset(0 ${100 - fill * 100}% 0 0)` }}>\n <IconStarFilled className=\"size-[18px] text-kit-warning\" />\n </span>\n </button>\n );\n })}\n </div>\n <input\n id={id}\n inputMode=\"decimal\"\n value={draft ?? (n == null ? \"\" : String(n))}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder=\"–\"\n onWheel={(e) => e.currentTarget.blur()}\n onChange={(e) => /^\\d*\\.?\\d*$/.test(e.target.value) && setDraft(e.target.value)}\n onBlur={() => {\n commit();\n onBlur?.();\n }}\n onKeyDown={(e) => e.key === \"Enter\" && e.currentTarget.blur()}\n className=\"tabular-nums h-7 w-12 rounded-kit-md border border-kit-line-strong bg-kit-field-bg px-2 text-kit-sm text-kit-fg outline-none hover:border-kit-line-strong focus:border-kit-line-strong focus:bg-kit-field-bg\"\n />\n <span className=\"text-kit-xs text-kit-fg-3\">out of {scale.max}</span>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAa,eAA0D,CAAC;AAExE,IAAa,SAAS,MACpB,OAAO,MAAM,YAAY,OAAO,SAAS,CAAC,IAAI,IAAI,OAAO,MAAM,YAAY,EAAE,KAAK,MAAM,MAAM,OAAO,SAAS,OAAO,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI;;AAEzI,IAAM,gBAAgB;AACtB,IAAM,YAAY,OAAe,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,GAAA,CAAI;AAEhE,SAAgB,cAAc,GAAiB;CAC7C,IAAI,CAAC,WAAW,EAAE,KAAK,GAAG,OAAO,uBAAC,aAAD,EAAa,GAAI,EAAI,GAAA,KAAA,GAAA,OAAA;;;;;CACtD,MAAM,QAAQ,aAAa,WAAW;CACt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