@bettercms-ai/kit 3.0.2 → 3.1.1

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 (161) hide show
  1. package/dist/adapters/lossy.d.ts +1 -1
  2. package/dist/adapters/lossy.js +3 -2
  3. package/dist/adapters/lossy.js.map +1 -1
  4. package/dist/adapters/schema.js +5 -5
  5. package/dist/adapters/schema.js.map +1 -1
  6. package/dist/brand/logo.js +18 -67
  7. package/dist/brand/logo.js.map +1 -1
  8. package/dist/context.js +3 -8
  9. package/dist/context.js.map +1 -1
  10. package/dist/controls/button.js +134 -451
  11. package/dist/controls/button.js.map +1 -1
  12. package/dist/controls/choice.js +95 -336
  13. package/dist/controls/choice.js.map +1 -1
  14. package/dist/controls/code.js +72 -245
  15. package/dist/controls/code.js.map +1 -1
  16. package/dist/controls/color.js +31 -108
  17. package/dist/controls/color.js.map +1 -1
  18. package/dist/controls/date.js +83 -268
  19. package/dist/controls/date.js.map +1 -1
  20. package/dist/controls/form-picker.js +9 -26
  21. package/dist/controls/form-picker.js.map +1 -1
  22. package/dist/controls/icon.js +100 -341
  23. package/dist/controls/icon.js.map +1 -1
  24. package/dist/controls/json.js +7 -20
  25. package/dist/controls/json.js.map +1 -1
  26. package/dist/controls/link.js +156 -561
  27. package/dist/controls/link.js.map +1 -1
  28. package/dist/controls/location.js +35 -124
  29. package/dist/controls/location.js.map +1 -1
  30. package/dist/controls/media.js +267 -928
  31. package/dist/controls/media.js.map +1 -1
  32. package/dist/controls/number.js +23 -80
  33. package/dist/controls/number.js.map +1 -1
  34. package/dist/controls/reference.js +155 -516
  35. package/dist/controls/reference.js.map +1 -1
  36. package/dist/controls/rich-text/article-shell.js +86 -327
  37. package/dist/controls/rich-text/article-shell.js.map +1 -1
  38. package/dist/controls/rich-text/author.js +21 -78
  39. package/dist/controls/rich-text/author.js.map +1 -1
  40. package/dist/controls/rich-text/blocks.js +317 -1086
  41. package/dist/controls/rich-text/blocks.js.map +1 -1
  42. package/dist/controls/rich-text/button.js +10 -31
  43. package/dist/controls/rich-text/button.js.map +1 -1
  44. package/dist/controls/rich-text/catalog.js +51 -168
  45. package/dist/controls/rich-text/catalog.js.map +1 -1
  46. package/dist/controls/rich-text/columns.js +31 -104
  47. package/dist/controls/rich-text/columns.js.map +1 -1
  48. package/dist/controls/rich-text/component-card.js +209 -790
  49. package/dist/controls/rich-text/component-card.js.map +1 -1
  50. package/dist/controls/rich-text/component-panel.js +40 -102
  51. package/dist/controls/rich-text/component-panel.js.map +1 -1
  52. package/dist/controls/rich-text/control.js +32 -101
  53. package/dist/controls/rich-text/control.js.map +1 -1
  54. package/dist/controls/rich-text/editor.js +108 -369
  55. package/dist/controls/rich-text/editor.js.map +1 -1
  56. package/dist/controls/rich-text/embed.js +51 -184
  57. package/dist/controls/rich-text/embed.js.map +1 -1
  58. package/dist/controls/rich-text/floating.js +42 -171
  59. package/dist/controls/rich-text/floating.js.map +1 -1
  60. package/dist/controls/rich-text/footnote.js +28 -89
  61. package/dist/controls/rich-text/footnote.js.map +1 -1
  62. package/dist/controls/rich-text/gallery.js +27 -88
  63. package/dist/controls/rich-text/gallery.js.map +1 -1
  64. package/dist/controls/rich-text/link-form.d.ts +10 -0
  65. package/dist/controls/rich-text/link-form.js +16 -204
  66. package/dist/controls/rich-text/link-form.js.map +1 -1
  67. package/dist/controls/rich-text/plain.js +3 -8
  68. package/dist/controls/rich-text/plain.js.map +1 -1
  69. package/dist/controls/rich-text/related.js +25 -86
  70. package/dist/controls/rich-text/related.js.map +1 -1
  71. package/dist/controls/rich-text/toc.js +15 -48
  72. package/dist/controls/rich-text/toc.js.map +1 -1
  73. package/dist/controls/rich-text/toolbar.js +105 -402
  74. package/dist/controls/rich-text/toolbar.js.map +1 -1
  75. package/dist/controls/scale.js +52 -169
  76. package/dist/controls/scale.js.map +1 -1
  77. package/dist/controls/slot.js +73 -238
  78. package/dist/controls/slot.js.map +1 -1
  79. package/dist/controls/table/table-editor.js +500 -1766
  80. package/dist/controls/table/table-editor.js.map +1 -1
  81. package/dist/controls/table/table-link.js +41 -121
  82. package/dist/controls/table/table-link.js.map +1 -1
  83. package/dist/controls/table/table.js +9 -26
  84. package/dist/controls/table/table.js.map +1 -1
  85. package/dist/controls/text.js +68 -221
  86. package/dist/controls/text.js.map +1 -1
  87. package/dist/controls/unknown-value.js +22 -79
  88. package/dist/controls/unknown-value.js.map +1 -1
  89. package/dist/engine/array.js +228 -821
  90. package/dist/engine/array.js.map +1 -1
  91. package/dist/engine/bits.js +13 -38
  92. package/dist/engine/bits.js.map +1 -1
  93. package/dist/engine/breadcrumb.js +8 -25
  94. package/dist/engine/breadcrumb.js.map +1 -1
  95. package/dist/engine/expand.js +13 -38
  96. package/dist/engine/expand.js.map +1 -1
  97. package/dist/engine/field-list.js +5 -14
  98. package/dist/engine/field-list.js.map +1 -1
  99. package/dist/engine/field-shell.js +244 -849
  100. package/dist/engine/field-shell.js.map +1 -1
  101. package/dist/engine/frame.js +78 -275
  102. package/dist/engine/frame.js.map +1 -1
  103. package/dist/engine/grouping.js +193 -630
  104. package/dist/engine/grouping.js.map +1 -1
  105. package/dist/engine/item-list.js +50 -187
  106. package/dist/engine/item-list.js.map +1 -1
  107. package/dist/engine/kit-field.js +95 -320
  108. package/dist/engine/kit-field.js.map +1 -1
  109. package/dist/engine/schema-form.js +32 -101
  110. package/dist/engine/schema-form.js.map +1 -1
  111. package/dist/engine/slot.js +45 -146
  112. package/dist/engine/slot.js.map +1 -1
  113. package/dist/lib/icons.js +5 -14
  114. package/dist/lib/icons.js.map +1 -1
  115. package/dist/library/kit-catalog.json +2 -1
  116. package/dist/styles.css +1 -5821
  117. package/dist/table/table-view.js +16 -49
  118. package/dist/table/table-view.js.map +1 -1
  119. package/dist/testing/test-form.js +5 -14
  120. package/dist/testing/test-form.js.map +1 -1
  121. package/dist/theme.js +3 -8
  122. package/dist/theme.js.map +1 -1
  123. package/dist/ui/action-tray.js +24 -97
  124. package/dist/ui/action-tray.js.map +1 -1
  125. package/dist/ui/autocomplete.js +38 -135
  126. package/dist/ui/autocomplete.js.map +1 -1
  127. package/dist/ui/button.js +31 -108
  128. package/dist/ui/button.js.map +1 -1
  129. package/dist/ui/choice-switch.js +5 -14
  130. package/dist/ui/choice-switch.js.map +1 -1
  131. package/dist/ui/controls.js +86 -279
  132. package/dist/ui/controls.js.map +1 -1
  133. package/dist/ui/display.js +116 -401
  134. package/dist/ui/display.js.map +1 -1
  135. package/dist/ui/expanded-editor-modal.js +27 -100
  136. package/dist/ui/expanded-editor-modal.js.map +1 -1
  137. package/dist/ui/floating-panel.js +37 -130
  138. package/dist/ui/floating-panel.js.map +1 -1
  139. package/dist/ui/input.js +59 -196
  140. package/dist/ui/input.js.map +1 -1
  141. package/dist/ui/mode-bar.js +11 -32
  142. package/dist/ui/mode-bar.js.map +1 -1
  143. package/dist/ui/overlay.js +176 -613
  144. package/dist/ui/overlay.js.map +1 -1
  145. package/dist/ui/path-crumbs.js +113 -374
  146. package/dist/ui/path-crumbs.js.map +1 -1
  147. package/dist/ui/select.js +78 -311
  148. package/dist/ui/select.js.map +1 -1
  149. package/dist/ui/shortcut-hint.js +6 -19
  150. package/dist/ui/shortcut-hint.js.map +1 -1
  151. package/dist/ui/spinner.js +7 -20
  152. package/dist/ui/spinner.js.map +1 -1
  153. package/dist/ui/split-button.js +10 -35
  154. package/dist/ui/split-button.js.map +1 -1
  155. package/dist/ui/tab.js +17 -50
  156. package/dist/ui/tab.js.map +1 -1
  157. package/dist/ui/toast.js +30 -107
  158. package/dist/ui/toast.js.map +1 -1
  159. package/dist/ui/tooltip-root.js +7 -24
  160. package/dist/ui/tooltip-root.js.map +1 -1
  161. package/package.json +1 -1
package/dist/ui/input.js CHANGED
@@ -3,7 +3,7 @@ import { FieldDescribedByContext, FieldIdContext, FieldLabelledByContext, useFie
3
3
  import { HintTooltip } from "./button.js";
4
4
  import { useShortcutHints } from "./shortcut-hint.js";
5
5
  import * as React from "react";
6
- import { Fragment, jsxDEV } from "react/jsx-dev-runtime";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { IconInfoCircle, IconSearch, IconX } from "@tabler/icons-react";
8
8
  //#region src/ui/input.tsx
9
9
  /**
@@ -11,7 +11,6 @@ import { IconInfoCircle, IconSearch, IconX } from "@tabler/icons-react";
11
11
  * "filled" (grey, borderless) is kept only for search fields, which Figma draws grey.
12
12
  * Heights follow buttons: sm 28 · md 32 · lg 36.
13
13
  */
14
- var _jsxFileName = "D:/Github/bettercms/bettercms-backend/packages/kit/src/ui/input.tsx";
15
14
  var joinIds = (...ids) => ids.filter(Boolean).join(" ") || void 0;
16
15
  var base = "w-full min-w-0 rounded-kit-md border border-kit-field-border bg-kit-field-bg text-kit-fg shadow-kit-field placeholder:text-kit-fg-4 transition-[border-color,box-shadow] duration-150 hover:border-kit-field-border-hover focus:border-kit-field-border-focus focus:shadow-kit-ring-field disabled:cursor-not-allowed disabled:bg-kit-subtle disabled:opacity-60 aria-[invalid=true]:border-[var(--kit-field-invalid)]";
17
16
  var Input = React.forwardRef(({ className, size = "md", leading, trailing, variant = "outline", ...rest }, ref) => {
@@ -28,49 +27,29 @@ var Input = React.forwardRef(({ className, size = "md", leading, trailing, varia
28
27
  };
29
28
  const h = size === "sm" ? "h-7 text-kit-sm" : size === "lg" ? "h-9 text-kit-base" : "h-8 text-kit-sm";
30
29
  const v = variant === "filled" ? "bg-kit-muted border-transparent shadow-none hover:border-kit-line-strong" : "";
31
- if (!leading && !trailing) return /* @__PURE__ */ jsxDEV("input", {
30
+ if (!leading && !trailing) return /* @__PURE__ */ jsx("input", {
32
31
  ref,
33
32
  className: cn(base, h, v, "px-2.5", className),
34
33
  ...props
35
- }, void 0, false, {
36
- fileName: _jsxFileName,
37
- lineNumber: 51,
38
- columnNumber: 39
39
- }, void 0);
40
- return /* @__PURE__ */ jsxDEV("div", {
34
+ });
35
+ return /* @__PURE__ */ jsxs("div", {
41
36
  className: cn("relative flex items-center", className),
42
37
  children: [
43
- leading ? /* @__PURE__ */ jsxDEV("span", {
38
+ leading ? /* @__PURE__ */ jsx("span", {
44
39
  className: "pointer-events-none absolute left-2.5 flex text-kit-fg-3 [&_svg]:size-4",
45
40
  children: leading
46
- }, void 0, false, {
47
- fileName: _jsxFileName,
48
- lineNumber: 55,
49
- columnNumber: 11
50
- }, void 0) : null,
51
- /* @__PURE__ */ jsxDEV("input", {
41
+ }) : null,
42
+ /* @__PURE__ */ jsx("input", {
52
43
  ref,
53
44
  className: cn(base, h, v, leading ? "pl-8" : "pl-2.5", trailing ? "pr-8" : "pr-2.5"),
54
45
  ...props
55
- }, void 0, false, {
56
- fileName: _jsxFileName,
57
- lineNumber: 57,
58
- columnNumber: 9
59
- }, void 0),
60
- trailing ? /* @__PURE__ */ jsxDEV("span", {
46
+ }),
47
+ trailing ? /* @__PURE__ */ jsx("span", {
61
48
  className: "absolute right-2 flex items-center text-kit-fg-3 [&_svg]:size-4",
62
49
  children: trailing
63
- }, void 0, false, {
64
- fileName: _jsxFileName,
65
- lineNumber: 58,
66
- columnNumber: 21
67
- }, void 0) : null
50
+ }) : null
68
51
  ]
69
- }, void 0, true, {
70
- fileName: _jsxFileName,
71
- lineNumber: 53,
72
- columnNumber: 7
73
- }, void 0);
52
+ });
74
53
  });
75
54
  Input.displayName = "Input";
76
55
  var Textarea = React.forwardRef(({ className, autoGrow = true, variant = "outline", onInput, ...rest }, ref) => {
@@ -110,7 +89,7 @@ var Textarea = React.forwardRef(({ className, autoGrow = true, variant = "outlin
110
89
  ro.disconnect();
111
90
  };
112
91
  }, [autoGrow]);
113
- return /* @__PURE__ */ jsxDEV("textarea", {
92
+ return /* @__PURE__ */ jsx("textarea", {
114
93
  ref: inner,
115
94
  rows: props.rows ?? 2,
116
95
  onInput: (e) => {
@@ -119,16 +98,12 @@ var Textarea = React.forwardRef(({ className, autoGrow = true, variant = "outlin
119
98
  },
120
99
  className: cn(base, "min-h-16 resize-none px-2.5 py-2 text-kit-sm leading-[20px]", variant === "filled" && "bg-kit-muted border-transparent shadow-none", className),
121
100
  ...props
122
- }, void 0, false, {
123
- fileName: _jsxFileName,
124
- lineNumber: 109,
125
- columnNumber: 7
126
- }, void 0);
101
+ });
127
102
  });
128
103
  Textarea.displayName = "Textarea";
129
104
  function SearchInput({ value, onChange, placeholder = "Search…", className, size = "md", autoFocus, shortcut, variant = "filled", count, onKeyDown, inputRef, "aria-label": ariaLabel }) {
130
105
  const hints = useShortcutHints();
131
- return /* @__PURE__ */ jsxDEV(Input, {
106
+ return /* @__PURE__ */ jsx(Input, {
132
107
  ref: inputRef,
133
108
  variant,
134
109
  size,
@@ -138,65 +113,33 @@ function SearchInput({ value, onChange, placeholder = "Search…", className, si
138
113
  "aria-label": ariaLabel ?? placeholder.replace(/…$/, ""),
139
114
  onChange: (e) => onChange(e.target.value),
140
115
  onKeyDown,
141
- leading: /* @__PURE__ */ jsxDEV(IconSearch, { "aria-hidden": true }, void 0, false, {
142
- fileName: _jsxFileName,
143
- lineNumber: 174,
144
- columnNumber: 16
145
- }, this),
116
+ leading: /* @__PURE__ */ jsx(IconSearch, { "aria-hidden": true }),
146
117
  className: cn(className, value && count ? "[&_input]:pr-28" : void 0),
147
- trailing: value ? /* @__PURE__ */ jsxDEV("span", {
118
+ trailing: value ? /* @__PURE__ */ jsxs("span", {
148
119
  className: "flex items-center gap-1.5",
149
- children: [count ? /* @__PURE__ */ jsxDEV("span", {
120
+ children: [count ? /* @__PURE__ */ jsx("span", {
150
121
  "aria-live": "polite",
151
122
  className: "whitespace-nowrap text-kit-xs tabular-nums text-kit-fg-3",
152
123
  children: count
153
- }, void 0, false, {
154
- fileName: _jsxFileName,
155
- lineNumber: 180,
156
- columnNumber: 15
157
- }, this) : null, /* @__PURE__ */ jsxDEV("button", {
124
+ }) : null, /* @__PURE__ */ jsx("button", {
158
125
  type: "button",
159
126
  "aria-label": "Clear search",
160
127
  onClick: () => onChange(""),
161
128
  className: "flex size-5 items-center justify-center rounded-kit-sm text-kit-fg-3 hover:bg-kit-selected hover:text-kit-fg [&_svg]:size-3.5",
162
- children: /* @__PURE__ */ jsxDEV(IconX, { "aria-hidden": true }, void 0, false, {
163
- fileName: _jsxFileName,
164
- lineNumber: 190,
165
- columnNumber: 15
166
- }, this)
167
- }, void 0, false, {
168
- fileName: _jsxFileName,
169
- lineNumber: 184,
170
- columnNumber: 13
171
- }, this)]
172
- }, void 0, true, {
173
- fileName: _jsxFileName,
174
- lineNumber: 178,
175
- columnNumber: 11
176
- }, this) : shortcut && hints ? /* @__PURE__ */ jsxDEV("kbd", {
129
+ children: /* @__PURE__ */ jsx(IconX, { "aria-hidden": true })
130
+ })]
131
+ }) : shortcut && hints ? /* @__PURE__ */ jsx("kbd", {
177
132
  "data-hint": "shortcuts",
178
133
  className: "font-kit-sans text-kit-2xs text-kit-fg-3",
179
134
  children: shortcut
180
- }, void 0, false, {
181
- fileName: _jsxFileName,
182
- lineNumber: 194,
183
- columnNumber: 11
184
- }, this) : void 0
185
- }, void 0, false, {
186
- fileName: _jsxFileName,
187
- lineNumber: 164,
188
- columnNumber: 5
189
- }, this);
135
+ }) : void 0
136
+ });
190
137
  }
191
138
  function Label({ className, ...props }) {
192
- return /* @__PURE__ */ jsxDEV("label", {
139
+ return /* @__PURE__ */ jsx("label", {
193
140
  className: cn("text-kit-sm font-medium text-kit-fg", className),
194
141
  ...props
195
- }, void 0, false, {
196
- fileName: _jsxFileName,
197
- lineNumber: 204,
198
- columnNumber: 10
199
- }, this);
142
+ });
200
143
  }
201
144
  /**
202
145
  * Field = label row · help · control · error. CPO D39, the one help system (same spec as the Block Kit FieldShell):
@@ -214,172 +157,92 @@ function Field({ label, htmlFor, hint, help, helpMore, error, required, counter,
214
157
  const moreId = `${id}-more`;
215
158
  const errId = `${id}-error`;
216
159
  const describedBy = [error ? errId : help ? helpId : null, helpMore ? moreId : null].filter(Boolean).join(" ") || void 0;
217
- return /* @__PURE__ */ jsxDEV("div", {
160
+ return /* @__PURE__ */ jsxs("div", {
218
161
  className: cn("flex flex-col gap-1.5", className),
219
162
  children: [
220
- label || actions || counter ? /* @__PURE__ */ jsxDEV("div", {
163
+ label || actions || counter ? /* @__PURE__ */ jsxs("div", {
221
164
  className: "flex min-h-5 items-center justify-between gap-2",
222
- children: [/* @__PURE__ */ jsxDEV("span", {
165
+ children: [/* @__PURE__ */ jsxs("span", {
223
166
  className: "flex min-w-0 items-center gap-1",
224
- children: [/* @__PURE__ */ jsxDEV(Label, {
167
+ children: [/* @__PURE__ */ jsxs(Label, {
225
168
  htmlFor: label ? id : void 0,
226
169
  className: "flex items-center gap-1.5 text-kit-sm text-kit-fg-2",
227
170
  children: [
228
171
  label,
229
- required ? /* @__PURE__ */ jsxDEV(Fragment, { children: [/* @__PURE__ */ jsxDEV("span", {
172
+ required ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
230
173
  "aria-hidden": true,
231
174
  className: "text-kit-danger-fg",
232
175
  children: "*"
233
- }, void 0, false, {
234
- fileName: _jsxFileName,
235
- lineNumber: 259,
236
- columnNumber: 19
237
- }, this), /* @__PURE__ */ jsxDEV("span", {
176
+ }), /* @__PURE__ */ jsx("span", {
238
177
  className: "sr-only",
239
178
  children: "(required)"
240
- }, void 0, false, {
241
- fileName: _jsxFileName,
242
- lineNumber: 260,
243
- columnNumber: 19
244
- }, this)] }, void 0, true, {
245
- fileName: _jsxFileName,
246
- lineNumber: 258,
247
- columnNumber: 17
248
- }, this) : null,
249
- hint ? /* @__PURE__ */ jsxDEV("span", {
179
+ })] }) : null,
180
+ hint ? /* @__PURE__ */ jsx("span", {
250
181
  className: "font-normal text-kit-fg-3",
251
182
  children: hint
252
- }, void 0, false, {
253
- fileName: _jsxFileName,
254
- lineNumber: 263,
255
- columnNumber: 23
256
- }, this) : null
183
+ }) : null
257
184
  ]
258
- }, void 0, true, {
259
- fileName: _jsxFileName,
260
- lineNumber: 255,
261
- columnNumber: 13
262
- }, this), helpMore ? /* @__PURE__ */ jsxDEV(HelpMore, {
185
+ }), helpMore ? /* @__PURE__ */ jsx(HelpMore, {
263
186
  id: moreId,
264
187
  label: typeof label === "string" ? label : void 0,
265
188
  children: helpMore
266
- }, void 0, false, {
267
- fileName: _jsxFileName,
268
- lineNumber: 266,
269
- columnNumber: 15
270
- }, this) : null]
271
- }, void 0, true, {
272
- fileName: _jsxFileName,
273
- lineNumber: 254,
274
- columnNumber: 11
275
- }, this), /* @__PURE__ */ jsxDEV("div", {
189
+ }) : null]
190
+ }), /* @__PURE__ */ jsxs("div", {
276
191
  className: "flex items-center gap-1",
277
- children: [counter ? /* @__PURE__ */ jsxDEV("span", {
192
+ children: [counter ? /* @__PURE__ */ jsxs("span", {
278
193
  className: cn("tabular-nums text-kit-xs", counter.value > counter.max ? "text-kit-danger-fg" : counter.value > counter.max * .9 ? "text-kit-warning-fg" : "text-kit-fg-3"),
279
194
  children: [
280
195
  counter.value,
281
196
  "/",
282
197
  counter.max
283
198
  ]
284
- }, void 0, true, {
285
- fileName: _jsxFileName,
286
- lineNumber: 273,
287
- columnNumber: 15
288
- }, this) : null, actions]
289
- }, void 0, true, {
290
- fileName: _jsxFileName,
291
- lineNumber: 271,
292
- columnNumber: 11
293
- }, this)]
294
- }, void 0, true, {
295
- fileName: _jsxFileName,
296
- lineNumber: 253,
297
- columnNumber: 9
298
- }, this) : null,
299
- help && !error ? /* @__PURE__ */ jsxDEV("p", {
199
+ }) : null, actions]
200
+ })]
201
+ }) : null,
202
+ help && !error ? /* @__PURE__ */ jsx("p", {
300
203
  id: helpId,
301
204
  "data-slot": "field-help",
302
205
  className: "-mt-0.5 text-kit-xs leading-4 text-kit-fg-3",
303
206
  children: help
304
- }, void 0, false, {
305
- fileName: _jsxFileName,
306
- lineNumber: 291,
307
- columnNumber: 9
308
- }, this) : null,
309
- /* @__PURE__ */ jsxDEV(FieldIdContext.Provider, {
207
+ }) : null,
208
+ /* @__PURE__ */ jsx(FieldIdContext.Provider, {
310
209
  value: label ? id : void 0,
311
- children: /* @__PURE__ */ jsxDEV(FieldDescribedByContext.Provider, {
210
+ children: /* @__PURE__ */ jsx(FieldDescribedByContext.Provider, {
312
211
  value: describedBy,
313
212
  children
314
- }, void 0, false, {
315
- fileName: _jsxFileName,
316
- lineNumber: 296,
317
- columnNumber: 9
318
- }, this)
319
- }, void 0, false, {
320
- fileName: _jsxFileName,
321
- lineNumber: 295,
322
- columnNumber: 7
323
- }, this),
324
- error ? /* @__PURE__ */ jsxDEV("p", {
213
+ })
214
+ }),
215
+ error ? /* @__PURE__ */ jsx("p", {
325
216
  id: errId,
326
217
  role: "alert",
327
218
  className: "text-kit-xs leading-4 text-kit-danger-fg",
328
219
  children: error
329
- }, void 0, false, {
330
- fileName: _jsxFileName,
331
- lineNumber: 299,
332
- columnNumber: 9
333
- }, this) : null
220
+ }) : null
334
221
  ]
335
- }, void 0, true, {
336
- fileName: _jsxFileName,
337
- lineNumber: 251,
338
- columnNumber: 5
339
- }, this);
222
+ });
340
223
  }
341
224
  /** The ⓘ next to a label: longer help in a tooltip, also read by screen readers through aria-describedby (D39). */
342
225
  function HelpMore({ id, label, children }) {
343
- return /* @__PURE__ */ jsxDEV(HintTooltip, {
344
- content: /* @__PURE__ */ jsxDEV("span", {
226
+ return /* @__PURE__ */ jsx(HintTooltip, {
227
+ content: /* @__PURE__ */ jsx("span", {
345
228
  className: "block max-w-[260px] whitespace-normal font-normal leading-4",
346
229
  children
347
- }, void 0, false, {
348
- fileName: _jsxFileName,
349
- lineNumber: 310,
350
- columnNumber: 27
351
- }, this),
352
- children: /* @__PURE__ */ jsxDEV("button", {
230
+ }),
231
+ children: /* @__PURE__ */ jsxs("button", {
353
232
  type: "button",
354
233
  "aria-label": label ? `About ${label}` : "More about this field",
355
234
  className: "hit-area inline-flex size-4 shrink-0 items-center justify-center rounded-kit-sm text-kit-fg-4 [--hit-size:16px] hover:text-kit-fg-2",
356
- children: [/* @__PURE__ */ jsxDEV(IconInfoCircle, {
235
+ children: [/* @__PURE__ */ jsx(IconInfoCircle, {
357
236
  className: "size-3.5",
358
237
  stroke: 1.5,
359
238
  "aria-hidden": true
360
- }, void 0, false, {
361
- fileName: _jsxFileName,
362
- lineNumber: 316,
363
- columnNumber: 9
364
- }, this), /* @__PURE__ */ jsxDEV("span", {
239
+ }), /* @__PURE__ */ jsx("span", {
365
240
  id,
366
241
  className: "sr-only",
367
242
  children
368
- }, void 0, false, {
369
- fileName: _jsxFileName,
370
- lineNumber: 317,
371
- columnNumber: 9
372
- }, this)]
373
- }, void 0, true, {
374
- fileName: _jsxFileName,
375
- lineNumber: 311,
376
- columnNumber: 7
377
- }, this)
378
- }, void 0, false, {
379
- fileName: _jsxFileName,
380
- lineNumber: 310,
381
- columnNumber: 5
382
- }, this);
243
+ })]
244
+ })
245
+ });
383
246
  }
384
247
  //#endregion
385
248
  export { Field, FieldDescribedByContext, FieldLabelledByContext, HelpMore, Input, Label, SearchInput, Textarea, useFieldDescribedBy, useFieldId, useFieldLabelledBy };
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","names":[],"sources":["../../src/ui/input.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { IconInfoCircle, IconSearch, IconX } from \"@tabler/icons-react\";\nimport { cn } from \"../lib/cn\";\nimport { HintTooltip } from \"./button\";\nimport { useShortcutHints } from \"./shortcut-hint\";\n\n/**\n * Inputs — CPO D19: white field + 1px --field-border at rest (default \"outline\"), border darkens on hover, halo on focus.\n * \"filled\" (grey, borderless) is kept only for search fields, which Figma draws grey.\n * Heights follow buttons: sm 28 · md 32 · lg 36.\n */\nimport {\n FieldDescribedByContext,\n FieldIdContext,\n FieldLabelledByContext,\n useFieldDescribedBy,\n useFieldId,\n useFieldLabelledBy,\n useLabelFor,\n} from \"./field-context\";\n/* The Field contexts live in field-context.ts so controls in other files (Switch, Select) read the same ones. */\nexport { FieldDescribedByContext, FieldLabelledByContext, useFieldDescribedBy, useFieldId, useFieldLabelledBy };\n\nconst joinIds = (...ids: (string | undefined)[]) => ids.filter(Boolean).join(\" \") || undefined;\n\nconst base =\n \"w-full min-w-0 rounded-kit-md border border-kit-field-border bg-kit-field-bg text-kit-fg shadow-kit-field placeholder:text-kit-fg-4 transition-[border-color,box-shadow] duration-150 hover:border-kit-field-border-hover focus:border-kit-field-border-focus focus:shadow-kit-ring-field disabled:cursor-not-allowed disabled:bg-kit-subtle disabled:opacity-60 aria-[invalid=true]:border-[var(--kit-field-invalid)]\";\n\nexport interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\" | \"prefix\"> {\n size?: \"sm\" | \"md\" | \"lg\";\n leading?: React.ReactNode;\n trailing?: React.ReactNode;\n variant?: \"filled\" | \"outline\";\n}\n\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({ className, size = \"md\", leading, trailing, variant = \"outline\", ...rest }, ref) => {\n const fieldId = useFieldId();\n const labelledBy = useFieldLabelledBy();\n const named = rest.id ?? fieldId ?? rest[\"aria-label\"] ?? rest[\"aria-labelledby\"];\n const labelFor = useLabelFor(rest.id ?? fieldId);\n const describedBy = useFieldDescribedBy();\n const props = {\n ...rest,\n id: rest.id ?? fieldId,\n \"aria-labelledby\": rest[\"aria-labelledby\"] ?? (rest[\"aria-label\"] ? undefined : (labelFor ?? (named ? undefined : labelledBy))),\n \"aria-describedby\": joinIds(rest[\"aria-describedby\"], describedBy),\n };\n const h = size === \"sm\" ? \"h-7 text-kit-sm\" : size === \"lg\" ? \"h-9 text-kit-base\" : \"h-8 text-kit-sm\";\n const v = variant === \"filled\" ? \"bg-kit-muted border-transparent shadow-none hover:border-kit-line-strong\" : \"\";\n if (!leading && !trailing) return <input ref={ref} className={cn(base, h, v, \"px-2.5\", className)} {...props} />;\n return (\n <div className={cn(\"relative flex items-center\", className)}>\n {leading ? (\n <span className=\"pointer-events-none absolute left-2.5 flex text-kit-fg-3 [&_svg]:size-4\">{leading}</span>\n ) : null}\n <input ref={ref} className={cn(base, h, v, leading ? \"pl-8\" : \"pl-2.5\", trailing ? \"pr-8\" : \"pr-2.5\")} {...props} />\n {trailing ? <span className=\"absolute right-2 flex items-center text-kit-fg-3 [&_svg]:size-4\">{trailing}</span> : null}\n </div>\n );\n },\n);\nInput.displayName = \"Input\";\n\nexport type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & { autoGrow?: boolean; variant?: \"filled\" | \"outline\" };\n\nexport const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ className, autoGrow = true, variant = \"outline\", onInput, ...rest }, ref) => {\n const fieldId = useFieldId();\n const labelFor = useLabelFor(rest.id ?? fieldId);\n const describedBy = useFieldDescribedBy();\n const props = {\n ...rest,\n id: rest.id ?? fieldId,\n \"aria-labelledby\": rest[\"aria-labelledby\"] ?? (rest[\"aria-label\"] ? undefined : labelFor),\n \"aria-describedby\": joinIds(rest[\"aria-describedby\"], describedBy),\n };\n const inner = React.useRef<HTMLTextAreaElement | null>(null);\n React.useImperativeHandle(ref, () => inner.current as HTMLTextAreaElement);\n const grow = () => {\n const el = inner.current;\n if (!el || !autoGrow || !el.clientWidth) return; // hidden / zero-width: measuring now would be wrong\n el.style.height = \"auto\";\n el.style.height = `${el.scrollHeight + 2}px`;\n };\n React.useLayoutEffect(grow, [props.value, autoGrow]); // eslint-disable-line react-hooks/exhaustive-deps\n /* Re-measure when the WIDTH changes (a panel resize or a panel that mounts mid-animation): a height measured at a\n narrower width is stale and leaves single-line fields hundreds of px tall. Height-only changes are ignored, so\n the observer never feeds itself. */\n React.useEffect(() => {\n const el = inner.current;\n if (!el || !autoGrow || typeof ResizeObserver === \"undefined\") return;\n let w = el.clientWidth;\n let raf = 0;\n const ro = new ResizeObserver(() => {\n const nw = el.clientWidth;\n if (nw === w) return;\n w = nw;\n cancelAnimationFrame(raf);\n raf = requestAnimationFrame(grow);\n });\n ro.observe(el);\n return () => {\n cancelAnimationFrame(raf);\n ro.disconnect();\n };\n }, [autoGrow]); // eslint-disable-line react-hooks/exhaustive-deps\n return (\n <textarea\n ref={inner}\n rows={props.rows ?? 2}\n onInput={(e) => {\n grow();\n onInput?.(e);\n }}\n className={cn(\n base,\n \"min-h-16 resize-none px-2.5 py-2 text-kit-sm leading-[20px]\",\n variant === \"filled\" && \"bg-kit-muted border-transparent shadow-none\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nTextarea.displayName = \"Textarea\";\n\nexport function SearchInput({\n value,\n onChange,\n placeholder = \"Search…\",\n className,\n size = \"md\",\n autoFocus,\n shortcut,\n variant = \"filled\",\n count,\n onKeyDown,\n inputRef,\n \"aria-label\": ariaLabel,\n}: {\n \"aria-label\"?: string;\n value: string;\n onChange: (v: string) => void;\n placeholder?: string;\n className?: string;\n size?: \"sm\" | \"md\" | \"lg\";\n autoFocus?: boolean;\n /** Shown only while the D44 keyboard hints switch is on. */\n shortcut?: string;\n /**\n * \"filled\" (grey) for search on white surfaces (menus, sidebars, lists); \"outline\" is the standard field (field-bg,\n * field-border) for search that sits on a grey plane, where a grey fill reads as a pill, not a field (D70, the schema desk).\n */\n variant?: \"filled\" | \"outline\";\n /** a result count shown inside the field while there is a query (\"3 matches\", \"2 of 5\"); announced politely */\n count?: string;\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n inputRef?: React.Ref<HTMLInputElement>;\n}) {\n const hints = useShortcutHints();\n return (\n <Input\n ref={inputRef}\n variant={variant}\n size={size}\n autoFocus={autoFocus}\n value={value}\n placeholder={placeholder}\n aria-label={ariaLabel ?? placeholder.replace(/…$/, \"\")}\n onChange={(e) => onChange(e.target.value)}\n onKeyDown={onKeyDown}\n leading={<IconSearch aria-hidden />}\n className={cn(className, value && count ? \"[&_input]:pr-28\" : undefined)}\n trailing={\n value ? (\n <span className=\"flex items-center gap-1.5\">\n {count ? (\n <span aria-live=\"polite\" className=\"whitespace-nowrap text-kit-xs tabular-nums text-kit-fg-3\">\n {count}\n </span>\n ) : null}\n <button\n type=\"button\"\n aria-label=\"Clear search\"\n onClick={() => onChange(\"\")}\n className=\"flex size-5 items-center justify-center rounded-kit-sm text-kit-fg-3 hover:bg-kit-selected hover:text-kit-fg [&_svg]:size-3.5\"\n >\n <IconX aria-hidden />\n </button>\n </span>\n ) : shortcut && hints ? (\n <kbd data-hint=\"shortcuts\" className=\"font-kit-sans text-kit-2xs text-kit-fg-3\">\n {shortcut}\n </kbd>\n ) : undefined\n }\n />\n );\n}\n\nexport function Label({ className, ...props }: React.LabelHTMLAttributes<HTMLLabelElement>) {\n return <label className={cn(\"text-kit-sm font-medium text-kit-fg\", className)} {...props} />;\n}\n\n/**\n * Field = label row · help · control · error. CPO D39, the one help system (same spec as the Block Kit FieldShell):\n * [Label *] [hint] [i helpMore] …… [counter] [actions]\n * help: 12/16, --fg-3 (≥4.5:1 light + dark), 4px under the label, 1–2 lines\n * control\n * error: replaces the help, danger colour, under the control\n * The control gets `aria-describedby` → help + ⓘ text + error.\n * Required marker is V2 ui/input.tsx:249 (--danger-fg); the sr-only \"(required)\" names it for screen readers.\n */\nexport function Field({\n label,\n htmlFor,\n hint,\n help,\n helpMore,\n error,\n required,\n counter,\n actions,\n children,\n className,\n}: {\n label?: React.ReactNode;\n htmlFor?: string;\n /** short, quiet aside on the label row (\"Optional\", \"Shown publicly\") */\n hint?: React.ReactNode;\n /** the help line under the label */\n help?: React.ReactNode;\n /** longer explanation behind the ⓘ next to the label */\n helpMore?: React.ReactNode;\n error?: React.ReactNode;\n required?: boolean;\n counter?: { value: number; max: number };\n actions?: React.ReactNode;\n children: React.ReactNode;\n className?: string;\n}) {\n const autoId = React.useId();\n const id = htmlFor ?? autoId;\n const helpId = `${id}-help`;\n const moreId = `${id}-more`;\n const errId = `${id}-error`;\n const describedBy = [error ? errId : help ? helpId : null, helpMore ? moreId : null].filter(Boolean).join(\" \") || undefined;\n return (\n <div className={cn(\"flex flex-col gap-1.5\", className)}>\n {label || actions || counter ? (\n <div className=\"flex min-h-5 items-center justify-between gap-2\">\n <span className=\"flex min-w-0 items-center gap-1\">\n <Label htmlFor={label ? id : undefined} className=\"flex items-center gap-1.5 text-kit-sm text-kit-fg-2\">\n {label}\n {required ? (\n <>\n <span aria-hidden className=\"text-kit-danger-fg\">*</span>\n <span className=\"sr-only\">(required)</span>\n </>\n ) : null}\n {hint ? <span className=\"font-normal text-kit-fg-3\">{hint}</span> : null}\n </Label>\n {helpMore ? (\n <HelpMore id={moreId} label={typeof label === \"string\" ? label : undefined}>\n {helpMore}\n </HelpMore>\n ) : null}\n </span>\n <div className=\"flex items-center gap-1\">\n {counter ? (\n <span\n className={cn(\n \"tabular-nums text-kit-xs\",\n counter.value > counter.max\n ? \"text-kit-danger-fg\"\n : counter.value > counter.max * 0.9\n ? \"text-kit-warning-fg\"\n : \"text-kit-fg-3\",\n )}\n >\n {counter.value}/{counter.max}\n </span>\n ) : null}\n {actions}\n </div>\n </div>\n ) : null}\n {help && !error ? (\n <p id={helpId} data-slot=\"field-help\" className=\"-mt-0.5 text-kit-xs leading-4 text-kit-fg-3\">\n {help}\n </p>\n ) : null}\n <FieldIdContext.Provider value={label ? id : undefined}>\n <FieldDescribedByContext.Provider value={describedBy}>{children}</FieldDescribedByContext.Provider>\n </FieldIdContext.Provider>\n {error ? (\n <p id={errId} role=\"alert\" className=\"text-kit-xs leading-4 text-kit-danger-fg\">\n {error}\n </p>\n ) : null}\n </div>\n );\n}\n\n/** The ⓘ next to a label: longer help in a tooltip, also read by screen readers through aria-describedby (D39). */\nexport function HelpMore({ id, label, children }: { id?: string; label?: string; children: React.ReactNode }) {\n return (\n <HintTooltip content={<span className=\"block max-w-[260px] whitespace-normal font-normal leading-4\">{children}</span>}>\n <button\n type=\"button\"\n aria-label={label ? `About ${label}` : \"More about this field\"}\n className=\"hit-area inline-flex size-4 shrink-0 items-center justify-center rounded-kit-sm text-kit-fg-4 [--hit-size:16px] hover:text-kit-fg-2\"\n >\n <IconInfoCircle className=\"size-3.5\" stroke={1.5} aria-hidden />\n <span id={id} className=\"sr-only\">\n {children}\n </span>\n </button>\n </HintTooltip>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAuBA,IA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A,GAAA,OAAA;;;;GACA,GAAA,IAAA,CAAA;;;;;;CACG,GAAA,KAAA,GAAA,OAAA;;;;;AAEjB"}
1
+ {"version":3,"file":"input.js","names":[],"sources":["../../src/ui/input.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { IconInfoCircle, IconSearch, IconX } from \"@tabler/icons-react\";\nimport { cn } from \"../lib/cn\";\nimport { HintTooltip } from \"./button\";\nimport { useShortcutHints } from \"./shortcut-hint\";\n\n/**\n * Inputs — CPO D19: white field + 1px --field-border at rest (default \"outline\"), border darkens on hover, halo on focus.\n * \"filled\" (grey, borderless) is kept only for search fields, which Figma draws grey.\n * Heights follow buttons: sm 28 · md 32 · lg 36.\n */\nimport {\n FieldDescribedByContext,\n FieldIdContext,\n FieldLabelledByContext,\n useFieldDescribedBy,\n useFieldId,\n useFieldLabelledBy,\n useLabelFor,\n} from \"./field-context\";\n/* The Field contexts live in field-context.ts so controls in other files (Switch, Select) read the same ones. */\nexport { FieldDescribedByContext, FieldLabelledByContext, useFieldDescribedBy, useFieldId, useFieldLabelledBy };\n\nconst joinIds = (...ids: (string | undefined)[]) => ids.filter(Boolean).join(\" \") || undefined;\n\nconst base =\n \"w-full min-w-0 rounded-kit-md border border-kit-field-border bg-kit-field-bg text-kit-fg shadow-kit-field placeholder:text-kit-fg-4 transition-[border-color,box-shadow] duration-150 hover:border-kit-field-border-hover focus:border-kit-field-border-focus focus:shadow-kit-ring-field disabled:cursor-not-allowed disabled:bg-kit-subtle disabled:opacity-60 aria-[invalid=true]:border-[var(--kit-field-invalid)]\";\n\nexport interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\" | \"prefix\"> {\n size?: \"sm\" | \"md\" | \"lg\";\n leading?: React.ReactNode;\n trailing?: React.ReactNode;\n variant?: \"filled\" | \"outline\";\n}\n\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({ className, size = \"md\", leading, trailing, variant = \"outline\", ...rest }, ref) => {\n const fieldId = useFieldId();\n const labelledBy = useFieldLabelledBy();\n const named = rest.id ?? fieldId ?? rest[\"aria-label\"] ?? rest[\"aria-labelledby\"];\n const labelFor = useLabelFor(rest.id ?? fieldId);\n const describedBy = useFieldDescribedBy();\n const props = {\n ...rest,\n id: rest.id ?? fieldId,\n \"aria-labelledby\": rest[\"aria-labelledby\"] ?? (rest[\"aria-label\"] ? undefined : (labelFor ?? (named ? undefined : labelledBy))),\n \"aria-describedby\": joinIds(rest[\"aria-describedby\"], describedBy),\n };\n const h = size === \"sm\" ? \"h-7 text-kit-sm\" : size === \"lg\" ? \"h-9 text-kit-base\" : \"h-8 text-kit-sm\";\n const v = variant === \"filled\" ? \"bg-kit-muted border-transparent shadow-none hover:border-kit-line-strong\" : \"\";\n if (!leading && !trailing) return <input ref={ref} className={cn(base, h, v, \"px-2.5\", className)} {...props} />;\n return (\n <div className={cn(\"relative flex items-center\", className)}>\n {leading ? (\n <span className=\"pointer-events-none absolute left-2.5 flex text-kit-fg-3 [&_svg]:size-4\">{leading}</span>\n ) : null}\n <input ref={ref} className={cn(base, h, v, leading ? \"pl-8\" : \"pl-2.5\", trailing ? \"pr-8\" : \"pr-2.5\")} {...props} />\n {trailing ? <span className=\"absolute right-2 flex items-center text-kit-fg-3 [&_svg]:size-4\">{trailing}</span> : null}\n </div>\n );\n },\n);\nInput.displayName = \"Input\";\n\nexport type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & { autoGrow?: boolean; variant?: \"filled\" | \"outline\" };\n\nexport const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ className, autoGrow = true, variant = \"outline\", onInput, ...rest }, ref) => {\n const fieldId = useFieldId();\n const labelFor = useLabelFor(rest.id ?? fieldId);\n const describedBy = useFieldDescribedBy();\n const props = {\n ...rest,\n id: rest.id ?? fieldId,\n \"aria-labelledby\": rest[\"aria-labelledby\"] ?? (rest[\"aria-label\"] ? undefined : labelFor),\n \"aria-describedby\": joinIds(rest[\"aria-describedby\"], describedBy),\n };\n const inner = React.useRef<HTMLTextAreaElement | null>(null);\n React.useImperativeHandle(ref, () => inner.current as HTMLTextAreaElement);\n const grow = () => {\n const el = inner.current;\n if (!el || !autoGrow || !el.clientWidth) return; // hidden / zero-width: measuring now would be wrong\n el.style.height = \"auto\";\n el.style.height = `${el.scrollHeight + 2}px`;\n };\n React.useLayoutEffect(grow, [props.value, autoGrow]); // eslint-disable-line react-hooks/exhaustive-deps\n /* Re-measure when the WIDTH changes (a panel resize or a panel that mounts mid-animation): a height measured at a\n narrower width is stale and leaves single-line fields hundreds of px tall. Height-only changes are ignored, so\n the observer never feeds itself. */\n React.useEffect(() => {\n const el = inner.current;\n if (!el || !autoGrow || typeof ResizeObserver === \"undefined\") return;\n let w = el.clientWidth;\n let raf = 0;\n const ro = new ResizeObserver(() => {\n const nw = el.clientWidth;\n if (nw === w) return;\n w = nw;\n cancelAnimationFrame(raf);\n raf = requestAnimationFrame(grow);\n });\n ro.observe(el);\n return () => {\n cancelAnimationFrame(raf);\n ro.disconnect();\n };\n }, [autoGrow]); // eslint-disable-line react-hooks/exhaustive-deps\n return (\n <textarea\n ref={inner}\n rows={props.rows ?? 2}\n onInput={(e) => {\n grow();\n onInput?.(e);\n }}\n className={cn(\n base,\n \"min-h-16 resize-none px-2.5 py-2 text-kit-sm leading-[20px]\",\n variant === \"filled\" && \"bg-kit-muted border-transparent shadow-none\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nTextarea.displayName = \"Textarea\";\n\nexport function SearchInput({\n value,\n onChange,\n placeholder = \"Search…\",\n className,\n size = \"md\",\n autoFocus,\n shortcut,\n variant = \"filled\",\n count,\n onKeyDown,\n inputRef,\n \"aria-label\": ariaLabel,\n}: {\n \"aria-label\"?: string;\n value: string;\n onChange: (v: string) => void;\n placeholder?: string;\n className?: string;\n size?: \"sm\" | \"md\" | \"lg\";\n autoFocus?: boolean;\n /** Shown only while the D44 keyboard hints switch is on. */\n shortcut?: string;\n /**\n * \"filled\" (grey) for search on white surfaces (menus, sidebars, lists); \"outline\" is the standard field (field-bg,\n * field-border) for search that sits on a grey plane, where a grey fill reads as a pill, not a field (D70, the schema desk).\n */\n variant?: \"filled\" | \"outline\";\n /** a result count shown inside the field while there is a query (\"3 matches\", \"2 of 5\"); announced politely */\n count?: string;\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n inputRef?: React.Ref<HTMLInputElement>;\n}) {\n const hints = useShortcutHints();\n return (\n <Input\n ref={inputRef}\n variant={variant}\n size={size}\n autoFocus={autoFocus}\n value={value}\n placeholder={placeholder}\n aria-label={ariaLabel ?? placeholder.replace(/…$/, \"\")}\n onChange={(e) => onChange(e.target.value)}\n onKeyDown={onKeyDown}\n leading={<IconSearch aria-hidden />}\n className={cn(className, value && count ? \"[&_input]:pr-28\" : undefined)}\n trailing={\n value ? (\n <span className=\"flex items-center gap-1.5\">\n {count ? (\n <span aria-live=\"polite\" className=\"whitespace-nowrap text-kit-xs tabular-nums text-kit-fg-3\">\n {count}\n </span>\n ) : null}\n <button\n type=\"button\"\n aria-label=\"Clear search\"\n onClick={() => onChange(\"\")}\n className=\"flex size-5 items-center justify-center rounded-kit-sm text-kit-fg-3 hover:bg-kit-selected hover:text-kit-fg [&_svg]:size-3.5\"\n >\n <IconX aria-hidden />\n </button>\n </span>\n ) : shortcut && hints ? (\n <kbd data-hint=\"shortcuts\" className=\"font-kit-sans text-kit-2xs text-kit-fg-3\">\n {shortcut}\n </kbd>\n ) : undefined\n }\n />\n );\n}\n\nexport function Label({ className, ...props }: React.LabelHTMLAttributes<HTMLLabelElement>) {\n return <label className={cn(\"text-kit-sm font-medium text-kit-fg\", className)} {...props} />;\n}\n\n/**\n * Field = label row · help · control · error. CPO D39, the one help system (same spec as the Block Kit FieldShell):\n * [Label *] [hint] [i helpMore] …… [counter] [actions]\n * help: 12/16, --fg-3 (≥4.5:1 light + dark), 4px under the label, 1–2 lines\n * control\n * error: replaces the help, danger colour, under the control\n * The control gets `aria-describedby` → help + ⓘ text + error.\n * Required marker is V2 ui/input.tsx:249 (--danger-fg); the sr-only \"(required)\" names it for screen readers.\n */\nexport function Field({\n label,\n htmlFor,\n hint,\n help,\n helpMore,\n error,\n required,\n counter,\n actions,\n children,\n className,\n}: {\n label?: React.ReactNode;\n htmlFor?: string;\n /** short, quiet aside on the label row (\"Optional\", \"Shown publicly\") */\n hint?: React.ReactNode;\n /** the help line under the label */\n help?: React.ReactNode;\n /** longer explanation behind the ⓘ next to the label */\n helpMore?: React.ReactNode;\n error?: React.ReactNode;\n required?: boolean;\n counter?: { value: number; max: number };\n actions?: React.ReactNode;\n children: React.ReactNode;\n className?: string;\n}) {\n const autoId = React.useId();\n const id = htmlFor ?? autoId;\n const helpId = `${id}-help`;\n const moreId = `${id}-more`;\n const errId = `${id}-error`;\n const describedBy = [error ? errId : help ? helpId : null, helpMore ? moreId : null].filter(Boolean).join(\" \") || undefined;\n return (\n <div className={cn(\"flex flex-col gap-1.5\", className)}>\n {label || actions || counter ? (\n <div className=\"flex min-h-5 items-center justify-between gap-2\">\n <span className=\"flex min-w-0 items-center gap-1\">\n <Label htmlFor={label ? id : undefined} className=\"flex items-center gap-1.5 text-kit-sm text-kit-fg-2\">\n {label}\n {required ? (\n <>\n <span aria-hidden className=\"text-kit-danger-fg\">*</span>\n <span className=\"sr-only\">(required)</span>\n </>\n ) : null}\n {hint ? <span className=\"font-normal text-kit-fg-3\">{hint}</span> : null}\n </Label>\n {helpMore ? (\n <HelpMore id={moreId} label={typeof label === \"string\" ? label : undefined}>\n {helpMore}\n </HelpMore>\n ) : null}\n </span>\n <div className=\"flex items-center gap-1\">\n {counter ? (\n <span\n className={cn(\n \"tabular-nums text-kit-xs\",\n counter.value > counter.max\n ? \"text-kit-danger-fg\"\n : counter.value > counter.max * 0.9\n ? \"text-kit-warning-fg\"\n : \"text-kit-fg-3\",\n )}\n >\n {counter.value}/{counter.max}\n </span>\n ) : null}\n {actions}\n </div>\n </div>\n ) : null}\n {help && !error ? (\n <p id={helpId} data-slot=\"field-help\" className=\"-mt-0.5 text-kit-xs leading-4 text-kit-fg-3\">\n {help}\n </p>\n ) : null}\n <FieldIdContext.Provider value={label ? id : undefined}>\n <FieldDescribedByContext.Provider value={describedBy}>{children}</FieldDescribedByContext.Provider>\n </FieldIdContext.Provider>\n {error ? (\n <p id={errId} role=\"alert\" className=\"text-kit-xs leading-4 text-kit-danger-fg\">\n {error}\n </p>\n ) : null}\n </div>\n );\n}\n\n/** The ⓘ next to a label: longer help in a tooltip, also read by screen readers through aria-describedby (D39). */\nexport function HelpMore({ id, label, children }: { id?: string; label?: string; children: React.ReactNode }) {\n return (\n <HintTooltip content={<span className=\"block max-w-[260px] whitespace-normal font-normal leading-4\">{children}</span>}>\n <button\n type=\"button\"\n aria-label={label ? `About ${label}` : \"More about this field\"}\n className=\"hit-area inline-flex size-4 shrink-0 items-center justify-center rounded-kit-sm text-kit-fg-4 [--hit-size:16px] hover:text-kit-fg-2\"\n >\n <IconInfoCircle className=\"size-3.5\" stroke={1.5} aria-hidden />\n <span id={id} className=\"sr-only\">\n {children}\n </span>\n </button>\n </HintTooltip>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAuBA,IAAM,WAAW,GAAG,QAAgC,IAAI,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KAAK,KAAA;AAErF,IAAM,OACJ;AASF,IAAa,QAAQ,MAAM,YACxB,EAAE,WAAW,OAAO,MAAM,SAAS,UAAU,UAAU,WAAW,GAAG,QAAQ,QAAQ;CACpF,MAAM,UAAU,WAAW;CAC3B,MAAM,aAAa,mBAAmB;CACtC,MAAM,QAAQ,KAAK,MAAM,WAAW,KAAK,iBAAiB,KAAK;CAC/D,MAAM,WAAW,YAAY,KAAK,MAAM,OAAO;CAC/C,MAAM,cAAc,oBAAoB;CACxC,MAAM,QAAQ;EACZ,GAAG;EACH,IAAI,KAAK,MAAM;EACf,mBAAmB,KAAK,uBAAuB,KAAK,gBAAgB,KAAA,IAAa,aAAa,QAAQ,KAAA,IAAY;EAClH,o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"react";
4
- import { jsxDEV } from "react/jsx-dev-runtime";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
5
  //#region src/ui/mode-bar.tsx
6
6
  /**
7
7
  * MODE BAR (D61 §3.7, shared with D58 view-as). One 36px strip that says "you are in a mode": an icon, a sentence and
@@ -14,13 +14,12 @@ import { jsxDEV } from "react/jsx-dev-runtime";
14
14
  * If both apply, both show: view-as on top. Tokens only, both themes (D56).
15
15
  * The strip sits in the app shell, outside any kit host, so its root carries the kit scope itself (like the portalled layers).
16
16
  */
17
- var _jsxFileName = "D:/Github/bettercms/bettercms-backend/packages/kit/src/ui/mode-bar.tsx";
18
17
  var TONE = {
19
18
  info: "border-kit-info-line bg-kit-info-soft",
20
19
  raised: "border-kit-line bg-kit-surface-raised"
21
20
  };
22
21
  var ModeBar = React.forwardRef(function ModeBar({ label, icon, tone = "info", align = "center", announce, className, children, ...rest }, ref) {
23
- return /* @__PURE__ */ jsxDEV("div", {
22
+ return /* @__PURE__ */ jsxs("div", {
24
23
  ref,
25
24
  role: "region",
26
25
  "aria-label": label,
@@ -29,56 +28,36 @@ var ModeBar = React.forwardRef(function ModeBar({ label, icon, tone = "info", al
29
28
  className: cn("relative flex h-9 shrink-0 items-center gap-2 border-b px-4 text-kit-sm text-kit-fg", align === "center" ? "justify-center" : "justify-start", TONE[tone], className),
30
29
  ...rest,
31
30
  children: [
32
- /* @__PURE__ */ jsxDEV("span", {
31
+ /* @__PURE__ */ jsx("span", {
33
32
  "aria-live": "polite",
34
33
  className: "sr-only",
35
34
  children: announce ?? ""
36
- }, void 0, false, {
37
- fileName: _jsxFileName,
38
- lineNumber: 54,
39
- columnNumber: 7
40
- }, this),
41
- icon ? /* @__PURE__ */ jsxDEV("span", {
35
+ }),
36
+ icon ? /* @__PURE__ */ jsx("span", {
42
37
  "aria-hidden": true,
43
38
  className: "flex shrink-0 text-kit-fg-2 [&>svg]:size-4",
44
39
  children: icon
45
- }, void 0, false, {
46
- fileName: _jsxFileName,
47
- lineNumber: 55,
48
- columnNumber: 15
49
- }, this) : null,
40
+ }) : null,
50
41
  children
51
42
  ]
52
- }, void 0, true, {
53
- fileName: _jsxFileName,
54
- lineNumber: 40,
55
- columnNumber: 5
56
- }, this);
43
+ });
57
44
  });
58
45
  /** The quiet "·" between parts of a mode bar sentence. */
59
46
  function ModeBarDot({ className }) {
60
- return /* @__PURE__ */ jsxDEV("span", {
47
+ return /* @__PURE__ */ jsx("span", {
61
48
  "aria-hidden": true,
62
49
  className: cn("text-kit-fg-3", className),
63
50
  children: "·"
64
- }, void 0, false, {
65
- fileName: _jsxFileName,
66
- lineNumber: 63,
67
- columnNumber: 10
68
- }, this);
51
+ });
69
52
  }
70
53
  /** A text action in a mode bar ("Exit"): underlined, not a button chip. */
71
54
  var ModeBarLink = React.forwardRef(function ModeBarLink({ className, ...rest }, ref) {
72
- return /* @__PURE__ */ jsxDEV("button", {
55
+ return /* @__PURE__ */ jsx("button", {
73
56
  ref,
74
57
  type: "button",
75
58
  className: cn("shrink-0 rounded-kit-sm px-1 font-medium text-kit-fg underline decoration-kit-fg-3 underline-offset-2 hover:decoration-kit-fg", className),
76
59
  ...rest
77
- }, void 0, false, {
78
- fileName: _jsxFileName,
79
- lineNumber: 72,
80
- columnNumber: 5
81
- }, this);
60
+ });
82
61
  });
83
62
  //#endregion
84
63
  export { ModeBar, ModeBarDot, ModeBarLink };
@@ -1 +1 @@
1
- {"version":3,"file":"mode-bar.js","names":[],"sources":["../../src/ui/mode-bar.tsx"],"sourcesContent":["/**\n * MODE BAR (D61 §3.7, shared with D58 view-as). One 36px strip that says \"you are in a mode\": an icon, a sentence and\n * its actions, with a polite live-region announcement. The primitive is shared; the placement is not:\n *\n * - View as (D58): app-wide, above the top bar (it changes who you are). `tone=\"info\"`, centred. Esc does not exit.\n * - Revision preview (D61): inside the editor, under its header (it changes what you are looking at).\n * `tone=\"raised\"`, start-aligned. Esc goes back to current (the host wires it).\n *\n * If both apply, both show: view-as on top. Tokens only, both themes (D56).\n * The strip sits in the app shell, outside any kit host, so its root carries the kit scope itself (like the portalled layers).\n */\nimport * as React from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { KIT_SCOPE } from \"./surfaces\";\n\nexport type ModeBarTone = \"info\" | \"raised\";\n\nconst TONE: Record<ModeBarTone, string> = {\n info: \"border-kit-info-line bg-kit-info-soft\",\n raised: \"border-kit-line bg-kit-surface-raised\",\n};\n\nexport interface ModeBarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"role\"> {\n /** the region's accessible name (\"View as\", \"Version preview\") */\n label: string;\n /** a 16px glyph, decorative */\n icon?: React.ReactNode;\n tone?: ModeBarTone;\n /** \"center\" (view-as) or \"start\" (revision preview) */\n align?: \"center\" | \"start\";\n /** polite announcement, read once when it changes */\n announce?: string;\n}\n\nexport const ModeBar = React.forwardRef<HTMLDivElement, ModeBarProps>(function ModeBar(\n { label, icon, tone = \"info\", align = \"center\", announce, className, children, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n role=\"region\"\n aria-label={label}\n data-mode-bar={tone}\n {...KIT_SCOPE}\n className={cn(\n \"relative flex h-9 shrink-0 items-center gap-2 border-b px-4 text-kit-sm text-kit-fg\",\n align === \"center\" ? \"justify-center\" : \"justify-start\",\n TONE[tone],\n className,\n )}\n {...rest}\n >\n <span aria-live=\"polite\" className=\"sr-only\">{announce ?? \"\"}</span>\n {icon ? <span aria-hidden className=\"flex shrink-0 text-kit-fg-2 [&>svg]:size-4\">{icon}</span> : null}\n {children}\n </div>\n );\n});\n\n/** The quiet \"·\" between parts of a mode bar sentence. */\nexport function ModeBarDot({ className }: { className?: string }) {\n return <span aria-hidden className={cn(\"text-kit-fg-3\", className)}>·</span>;\n}\n\n/** A text action in a mode bar (\"Exit\"): underlined, not a button chip. */\nexport const ModeBarLink = React.forwardRef<HTMLButtonElement, React.ButtonHTMLAttributes<HTMLButtonElement>>(function ModeBarLink(\n { className, ...rest },\n ref,\n) {\n return (\n <button\n ref={ref}\n type=\"button\"\n className={cn(\n \"shrink-0 rounded-kit-sm px-1 font-medium text-kit-fg underline decoration-kit-fg-3 underline-offset-2 hover:decoration-kit-fg\",\n className,\n )}\n {...rest}\n />\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,IAAM,OAAoC;CACxC,MAAM;CACN,QAAQ;AACV;AAcA,IAAa,UAAU,MAAM,WAAyC,SAAS,QAC7E,EAAE,OAAO,MAAM,OAAO,QAAQ,QAAQ,UAAU,UAAU,WAAW,UAAU,GAAG,QAClF,KACA;CACA,OACE,uBAAC,OAAD;EACO;EACL,MAAK;EACL,cAAY;EACZ,iBAAe;EACf,GAAI;EACJ,WAAW,GACT,uFACA,UAAU,WAAW,mBAAmB,iBACxC,KAAK,OACL,SACF;EACA,GAAI;EAZN,UAAA;GAcE,uBAAC,QAAD;IAAM,aAAU;IAAS,WAAU;IAAW,UAAA,YAAY;GAAS,GAAA,KAAA,GAAA,OAAA;;;;;GAClE,OAAO,uBAAC,QAAD;IAAM,eAAA;IAAY,WAAU;IAA8C,UAAA;GAAW,GAAA,KAAA,GAAA,OAAA;;;;GAAI,GAAA,IAAA,IAAA;GAChG;EACE;;;;;;AAET,CAAC;;AAGD,SAAgB,WAAW,EAAE,aAAqC;CAChE,OAAO,uBAAC,QAAD;EAAM,eAAA;EAAY,WAAW,GAAG,iBAAiB,SAAS;EAAG,UAAA;CAAO,GAAA,KAAA,GAAA,OAAA;;;;;AAC7E;;AAGA,IAAa,cAAc,MAAM,WAA6E,SAAS,YACrH,EAAE,WAAW,GAAG,QAChB,KACA;CACA,OACE,uBAAC,UAAD;EACO;EACL,MAAK;EACL,WAAW,GACT,iIACA,SACF;EACA,GAAI;CACL,GAAA,KAAA,GAAA,OAAA;;;;;AAEL,CAAC"}
1
+ {"version":3,"file":"mode-bar.js","names":[],"sources":["../../src/ui/mode-bar.tsx"],"sourcesContent":["/**\n * MODE BAR (D61 §3.7, shared with D58 view-as). One 36px strip that says \"you are in a mode\": an icon, a sentence and\n * its actions, with a polite live-region announcement. The primitive is shared; the placement is not:\n *\n * - View as (D58): app-wide, above the top bar (it changes who you are). `tone=\"info\"`, centred. Esc does not exit.\n * - Revision preview (D61): inside the editor, under its header (it changes what you are looking at).\n * `tone=\"raised\"`, start-aligned. Esc goes back to current (the host wires it).\n *\n * If both apply, both show: view-as on top. Tokens only, both themes (D56).\n * The strip sits in the app shell, outside any kit host, so its root carries the kit scope itself (like the portalled layers).\n */\nimport * as React from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { KIT_SCOPE } from \"./surfaces\";\n\nexport type ModeBarTone = \"info\" | \"raised\";\n\nconst TONE: Record<ModeBarTone, string> = {\n info: \"border-kit-info-line bg-kit-info-soft\",\n raised: \"border-kit-line bg-kit-surface-raised\",\n};\n\nexport interface ModeBarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"role\"> {\n /** the region's accessible name (\"View as\", \"Version preview\") */\n label: string;\n /** a 16px glyph, decorative */\n icon?: React.ReactNode;\n tone?: ModeBarTone;\n /** \"center\" (view-as) or \"start\" (revision preview) */\n align?: \"center\" | \"start\";\n /** polite announcement, read once when it changes */\n announce?: string;\n}\n\nexport const ModeBar = React.forwardRef<HTMLDivElement, ModeBarProps>(function ModeBar(\n { label, icon, tone = \"info\", align = \"center\", announce, className, children, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n role=\"region\"\n aria-label={label}\n data-mode-bar={tone}\n {...KIT_SCOPE}\n className={cn(\n \"relative flex h-9 shrink-0 items-center gap-2 border-b px-4 text-kit-sm text-kit-fg\",\n align === \"center\" ? \"justify-center\" : \"justify-start\",\n TONE[tone],\n className,\n )}\n {...rest}\n >\n <span aria-live=\"polite\" className=\"sr-only\">{announce ?? \"\"}</span>\n {icon ? <span aria-hidden className=\"flex shrink-0 text-kit-fg-2 [&>svg]:size-4\">{icon}</span> : null}\n {children}\n </div>\n );\n});\n\n/** The quiet \"·\" between parts of a mode bar sentence. */\nexport function ModeBarDot({ className }: { className?: string }) {\n return <span aria-hidden className={cn(\"text-kit-fg-3\", className)}>·</span>;\n}\n\n/** A text action in a mode bar (\"Exit\"): underlined, not a button chip. */\nexport const ModeBarLink = React.forwardRef<HTMLButtonElement, React.ButtonHTMLAttributes<HTMLButtonElement>>(function ModeBarLink(\n { className, ...rest },\n ref,\n) {\n return (\n <button\n ref={ref}\n type=\"button\"\n className={cn(\n \"shrink-0 rounded-kit-sm px-1 font-medium text-kit-fg underline decoration-kit-fg-3 underline-offset-2 hover:decoration-kit-fg\",\n className,\n )}\n {...rest}\n />\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,IAAM,OAAoC;CACxC,MAAM;CACN,QAAQ;AACV;AAcA,IAAa,UAAU,MAAM,WAAyC,SAAS,QAC7E,EAAE,OAAO,MAAM,OAAO,QAAQ,QAAQ,UAAU,UAAU,WAAW,UAAU,GAAG,QAClF,KACA;CACA,OACE,qBAAC,OAAD;EACO;EACL,MAAK;EACL,cAAY;EACZ,iBAAe;EACf,GAAI;EACJ,WAAW,GACT,uFACA,UAAU,WAAW,mBAAmB,iBACxC,KAAK,OACL,SACF;EACA,GAAI;EAZN,UAAA;GAcE,oBAAC,QAAD;IAAM,aAAU;IAAS,WAAU;IAAW,UAAA,YAAY;GAAS,CAAA;GAClE,OAAO,oBAAC,QAAD;IAAM,eAAA;IAAY,WAAU;IAA8C,UAAA;GAAW,CAAA,IAAI;GAChG;EACE;;AAET,CAAC;;AAGD,SAAgB,WAAW,EAAE,aAAqC;CAChE,OAAO,oBAAC,QAAD;EAAM,eAAA;EAAY,WAAW,GAAG,iBAAiB,SAAS;EAAG,UAAA;CAAO,CAAA;AAC7E;;AAGA,IAAa,cAAc,MAAM,WAA6E,SAAS,YACrH,EAAE,WAAW,GAAG,QAChB,KACA;CACA,OACE,oBAAC,UAAD;EACO;EACL,MAAK;EACL,WAAW,GACT,iIACA,SACF;EACA,GAAI;CACL,CAAA;AAEL,CAAC"}