@kanso-labs/kanso-ui 0.40.6 → 0.40.8

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 (46) hide show
  1. package/dist/badge/index.js +15 -0
  2. package/dist/badge/index.js.map +1 -0
  3. package/dist/components/badge/index.js +91 -47
  4. package/dist/components/badge/index.js.map +1 -1
  5. package/dist/components/dialog/index.d.ts +6 -1
  6. package/dist/components/dialog/index.js +67 -37
  7. package/dist/components/dialog/index.js.map +1 -1
  8. package/dist/components/form/index.d.ts +5 -4
  9. package/dist/components/form/index.js.map +1 -1
  10. package/dist/components/link/index.js +16 -5
  11. package/dist/components/link/index.js.map +1 -1
  12. package/dist/components/menu/index.js +29 -21
  13. package/dist/components/menu/index.js.map +1 -1
  14. package/dist/components/navigation-bar/index.js +134 -54
  15. package/dist/components/navigation-bar/index.js.map +1 -1
  16. package/dist/components/navigation-rail/index.js +56 -37
  17. package/dist/components/navigation-rail/index.js.map +1 -1
  18. package/dist/components/navigation-tree/index.js +10 -10
  19. package/dist/components/number-field/index.d.ts +13 -2
  20. package/dist/components/number-field/index.js +95 -84
  21. package/dist/components/number-field/index.js.map +1 -1
  22. package/dist/components/radio-group/index.js +10 -10
  23. package/dist/components/sheet/index.d.ts +8 -1
  24. package/dist/components/sheet/index.js +33 -17
  25. package/dist/components/sheet/index.js.map +1 -1
  26. package/dist/components/snackbar/index.d.ts +4 -0
  27. package/dist/components/snackbar/index.js +54 -49
  28. package/dist/components/snackbar/index.js.map +1 -1
  29. package/dist/components/tree/index.js +6 -6
  30. package/dist/field/index.js +303 -252
  31. package/dist/field/index.js.map +1 -1
  32. package/dist/field/root.js +8 -8
  33. package/dist/field/root.js.map +1 -1
  34. package/dist/field/styles.js +22 -0
  35. package/dist/field/styles.js.map +1 -1
  36. package/dist/hooks/useBottomEdge.js +83 -0
  37. package/dist/hooks/useBottomEdge.js.map +1 -0
  38. package/dist/navigation/context.js.map +1 -1
  39. package/dist/navigation/index.js +16 -4
  40. package/dist/navigation/index.js.map +1 -1
  41. package/dist/navigation/styles.js +35 -1
  42. package/dist/navigation/styles.js.map +1 -1
  43. package/dist/row/styles.js +2 -1
  44. package/dist/row/styles.js.map +1 -1
  45. package/dist/styles.css +90 -24
  46. package/package.json +5 -5
@@ -1,4 +1,5 @@
1
1
  import { props } from "../node_modules/@stylexjs/stylex/lib/es/stylex.js";
2
+ import { spacing } from "../tokens/design.tokens.stylex.js";
2
3
  import { mergeStatefulStyles, mergeStyles } from "../styles/merge.js";
3
4
  import { useMessages } from "../i18n/index.js";
4
5
  import { useInsideForm } from "./root.js";
@@ -35,8 +36,9 @@ const BOX_CONTROLS = {
35
36
  }
36
37
  };
37
38
  const BoxContext = createContext(OUTSIDE_BOX);
38
- function boxContent(label, children, floatingLabel, isFocused, isPopulated, isRequired, leading, multiline, trailing, trigger, variant) {
39
+ function boxContent(label, children, endInset, floatingLabel, isFocused, isPopulated, isRequired, leading, multiline, trailing, trigger, variant) {
39
40
  return (state) => /* @__PURE__ */ jsx(BoxContent, {
41
+ endInset,
40
42
  floatingLabel,
41
43
  isFocused,
42
44
  isPopulated,
@@ -59,8 +61,8 @@ function boxContent(label, children, floatingLabel, isFocused, isPopulated, isRe
59
61
  * for them. See the outlined variant's note above.
60
62
  */
61
63
  function BoxContent(t0) {
62
- const $ = c(45);
63
- const { children, floatingLabel, isFocused, isPopulated, isRequired, label, leading, multiline, state, trailing, trigger, variant } = t0;
64
+ const $ = c(47);
65
+ const { children, endInset, floatingLabel, isFocused, isPopulated, isRequired, label, leading, multiline, state, trailing, trigger, variant } = t0;
64
66
  const read = useFieldPopulated();
65
67
  const populated = isPopulated ?? read;
66
68
  const outlined = variant === "outlined";
@@ -68,98 +70,100 @@ function BoxContent(t0) {
68
70
  const floated = !floatingLabel || focused || populated;
69
71
  const t1 = BOX_CONTROLS[variant][floatingLabel ? "floating" : "fixed"];
70
72
  let t2;
71
- if ($[0] !== floated || $[1] !== focused || $[2] !== isRequired || $[3] !== label || $[4] !== leading || $[5] !== outlined || $[6] !== trailing) {
73
+ if ($[0] !== endInset || $[1] !== floated || $[2] !== focused || $[3] !== isRequired || $[4] !== label || $[5] !== leading || $[6] !== outlined || $[7] !== trailing) {
72
74
  t2 = outlined ? /* @__PURE__ */ jsx("fieldset", {
73
75
  "aria-hidden": "true",
74
- ...props(fieldChromeStyles.outline, leading !== void 0 && fieldChromeStyles.outlineLeading, trailing !== void 0 && fieldChromeStyles.outlineTrailing, focused && fieldChromeStyles.outlineFocused),
76
+ ...props(fieldChromeStyles.outline, leading !== void 0 && fieldChromeStyles.outlineLeading, trailing !== void 0 && fieldChromeStyles.outlineTrailing, focused && fieldChromeStyles.outlineFocused, endInset !== "0px" && fieldChromeStyles.outlineEndInset(`calc(${spacing.lg} - ${spacing.xs} + ${endInset})`)),
75
77
  children: /* @__PURE__ */ jsx("legend", {
76
78
  ...props(fieldChromeStyles.outlineNotch, floated && fieldChromeStyles.outlineNotchOpen),
77
79
  children: floated ? /* @__PURE__ */ jsxs(Fragment$1, { children: [label, isRequired ? REQUIRED_MARK : null] }) : null
78
80
  })
79
81
  }) : null;
80
- $[0] = floated;
81
- $[1] = focused;
82
- $[2] = isRequired;
83
- $[3] = label;
84
- $[4] = leading;
85
- $[5] = outlined;
86
- $[6] = trailing;
87
- $[7] = t2;
88
- } else t2 = $[7];
82
+ $[0] = endInset;
83
+ $[1] = floated;
84
+ $[2] = focused;
85
+ $[3] = isRequired;
86
+ $[4] = label;
87
+ $[5] = leading;
88
+ $[6] = outlined;
89
+ $[7] = trailing;
90
+ $[8] = t2;
91
+ } else t2 = $[8];
89
92
  let t3;
90
- if ($[8] !== leading || $[9] !== multiline || $[10] !== outlined || $[11] !== state.isDisabled) {
93
+ if ($[9] !== leading || $[10] !== multiline || $[11] !== outlined || $[12] !== state.isDisabled) {
91
94
  t3 = leading === void 0 ? null : /* @__PURE__ */ jsx("span", {
92
95
  ...props(fieldChromeStyles.icon, multiline && fieldChromeStyles.iconMultiline, outlined && fieldChromeStyles.iconOutlined, state.isDisabled && fieldChromeStyles.iconDisabled),
93
96
  children: leading
94
97
  });
95
- $[8] = leading;
96
- $[9] = multiline;
97
- $[10] = outlined;
98
- $[11] = state.isDisabled;
99
- $[12] = t3;
100
- } else t3 = $[12];
98
+ $[9] = leading;
99
+ $[10] = multiline;
100
+ $[11] = outlined;
101
+ $[12] = state.isDisabled;
102
+ $[13] = t3;
103
+ } else t3 = $[13];
101
104
  let t4;
102
- if ($[13] !== floatingLabel || $[14] !== state.isDisabled) {
105
+ if ($[14] !== floatingLabel || $[15] !== state.isDisabled) {
103
106
  t4 = props(fieldChromeStyles.column, floatingLabel && fieldChromeStyles.columnFloating, state.isDisabled && (floatingLabel ? fieldChromeStyles.columnDisabledFloating : fieldChromeStyles.columnDisabled));
104
- $[13] = floatingLabel;
105
- $[14] = state.isDisabled;
106
- $[15] = t4;
107
- } else t4 = $[15];
107
+ $[14] = floatingLabel;
108
+ $[15] = state.isDisabled;
109
+ $[16] = t4;
110
+ } else t4 = $[16];
108
111
  let t5;
109
- if ($[16] !== focused || $[17] !== state) {
112
+ if ($[17] !== focused || $[18] !== state) {
110
113
  t5 = withFocus(state, focused);
111
- $[16] = focused;
112
- $[17] = state;
113
- $[18] = t5;
114
- } else t5 = $[18];
114
+ $[17] = focused;
115
+ $[18] = state;
116
+ $[19] = t5;
117
+ } else t5 = $[19];
115
118
  let t6;
116
- if ($[19] !== floated || $[20] !== floatingLabel || $[21] !== outlined) {
117
- t6 = props(fieldChromeStyles.boxLabel, floatingLabel && floated && fieldChromeStyles.boxLabelFloated, outlined && fieldChromeStyles.boxLabelOutlined, outlined && floated && fieldChromeStyles.boxLabelOutlinedFloated);
118
- $[19] = floated;
119
- $[20] = floatingLabel;
120
- $[21] = outlined;
121
- $[22] = t6;
122
- } else t6 = $[22];
119
+ if ($[20] !== endInset || $[21] !== floated || $[22] !== floatingLabel || $[23] !== outlined) {
120
+ t6 = props(fieldChromeStyles.boxLabel, floatingLabel && floated && fieldChromeStyles.boxLabelFloated, outlined && fieldChromeStyles.boxLabelOutlined, outlined && floated && fieldChromeStyles.boxLabelOutlinedFloated, endInset !== "0px" && fieldChromeStyles.boxLabelEndInset(outlined ? `calc(100% + 2 * ${spacing.xs} - ${endInset})` : `calc(100% - ${endInset})`));
121
+ $[20] = endInset;
122
+ $[21] = floated;
123
+ $[22] = floatingLabel;
124
+ $[23] = outlined;
125
+ $[24] = t6;
126
+ } else t6 = $[24];
123
127
  let t7;
124
- if ($[23] !== isRequired || $[24] !== label || $[25] !== t5 || $[26] !== t6) {
128
+ if ($[25] !== isRequired || $[26] !== label || $[27] !== t5 || $[28] !== t6) {
125
129
  t7 = /* @__PURE__ */ jsx(FieldLabel, {
126
130
  isRequired,
127
131
  state: t5,
128
132
  ...t6,
129
133
  children: label
130
134
  });
131
- $[23] = isRequired;
132
- $[24] = label;
133
- $[25] = t5;
134
- $[26] = t6;
135
- $[27] = t7;
136
- } else t7 = $[27];
135
+ $[25] = isRequired;
136
+ $[26] = label;
137
+ $[27] = t5;
138
+ $[28] = t6;
139
+ $[29] = t7;
140
+ } else t7 = $[29];
137
141
  let t8;
138
- if ($[28] !== children || $[29] !== t4 || $[30] !== t7) {
142
+ if ($[30] !== children || $[31] !== t4 || $[32] !== t7) {
139
143
  t8 = /* @__PURE__ */ jsxs("div", {
140
144
  ...t4,
141
145
  children: [t7, children]
142
146
  });
143
- $[28] = children;
144
- $[29] = t4;
145
- $[30] = t7;
146
- $[31] = t8;
147
- } else t8 = $[31];
147
+ $[30] = children;
148
+ $[31] = t4;
149
+ $[32] = t7;
150
+ $[33] = t8;
151
+ } else t8 = $[33];
148
152
  let t9;
149
- if ($[32] !== multiline || $[33] !== outlined || $[34] !== state.isDisabled || $[35] !== state.isInvalid || $[36] !== trailing) {
153
+ if ($[34] !== multiline || $[35] !== outlined || $[36] !== state.isDisabled || $[37] !== state.isInvalid || $[38] !== trailing) {
150
154
  t9 = trailing === void 0 ? null : /* @__PURE__ */ jsx("span", {
151
155
  ...props(fieldChromeStyles.icon, multiline && fieldChromeStyles.iconMultiline, outlined && fieldChromeStyles.iconOutlined, state.isInvalid && fieldChromeStyles.iconError, state.isDisabled && fieldChromeStyles.iconDisabled),
152
156
  children: trailing
153
157
  });
154
- $[32] = multiline;
155
- $[33] = outlined;
156
- $[34] = state.isDisabled;
157
- $[35] = state.isInvalid;
158
- $[36] = trailing;
159
- $[37] = t9;
160
- } else t9 = $[37];
158
+ $[34] = multiline;
159
+ $[35] = outlined;
160
+ $[36] = state.isDisabled;
161
+ $[37] = state.isInvalid;
162
+ $[38] = trailing;
163
+ $[39] = t9;
164
+ } else t9 = $[39];
161
165
  let t10;
162
- if ($[38] !== t1 || $[39] !== t2 || $[40] !== t3 || $[41] !== t8 || $[42] !== t9 || $[43] !== trigger) {
166
+ if ($[40] !== t1 || $[41] !== t2 || $[42] !== t3 || $[43] !== t8 || $[44] !== t9 || $[45] !== trigger) {
163
167
  t10 = /* @__PURE__ */ jsxs(BoxContext, {
164
168
  value: t1,
165
169
  children: [
@@ -170,14 +174,14 @@ function BoxContent(t0) {
170
174
  t9
171
175
  ]
172
176
  });
173
- $[38] = t1;
174
- $[39] = t2;
175
- $[40] = t3;
176
- $[41] = t8;
177
- $[42] = t9;
178
- $[43] = trigger;
179
- $[44] = t10;
180
- } else t10 = $[44];
177
+ $[40] = t1;
178
+ $[41] = t2;
179
+ $[42] = t3;
180
+ $[43] = t8;
181
+ $[44] = t9;
182
+ $[45] = trigger;
183
+ $[46] = t10;
184
+ } else t10 = $[46];
181
185
  return t10;
182
186
  }
183
187
  function boxStyles(floatingLabel, isFocused, multiline, leading, trailing, variant) {
@@ -185,6 +189,29 @@ function boxStyles(floatingLabel, isFocused, multiline, leading, trailing, varia
185
189
  return (state) => props(fieldChromeStyles.box, floatingLabel ? fieldChromeStyles.boxFloating : fieldChromeStyles.boxFixed, multiline && fieldChromeStyles.boxMultiline, leading && fieldChromeStyles.boxLeading, trailing && fieldChromeStyles.boxTrailing, outlined && fieldChromeStyles.boxOutlined, outlined && floatingLabel && fieldChromeStyles.boxOutlinedFloating, outlined && multiline && fieldChromeStyles.boxOutlinedMultiline, state.isInvalid && (outlined ? fieldChromeStyles.boxOutlinedError : fieldChromeStyles.boxError), outlined && state.isHovered && (state.isInvalid ? fieldChromeStyles.boxOutlinedErrorHovered : fieldChromeStyles.boxOutlinedHovered), isFocused && focusedStyle(outlined, state.isInvalid), state.isDisabled && (outlined ? fieldChromeStyles.boxOutlinedDisabled : fieldChromeStyles.boxDisabled));
186
190
  }
187
191
  /**
192
+ * The control's `onInput`, which also commits the field's validation while it
193
+ * shows an error, so an edit that fixes the value clears the error as it is
194
+ * typed rather than once focus leaves.
195
+ *
196
+ * React Aria commits a field's validation — the moment a server's error is
197
+ * cleared, or the browser's own is checked again — on the control's native
198
+ * `change` event, and a text control fires that only on blur. So a reader
199
+ * typing the fix saw the error, red and `aria-invalid`, until they tabbed
200
+ * away from a value that was already right. Re-dispatching `change` on input
201
+ * is what commits early, through React Aria's own listener.
202
+ *
203
+ * Only while the field is invalid. A valid field still commits on blur, so
204
+ * nothing new is flagged in the middle of typing a value: an error is shown
205
+ * late and taken back early. React's `onChange` does not run a second time
206
+ * for it, since the value it tracks has not moved since the input.
207
+ */
208
+ function commitWhileInvalid(isInvalid, onInput) {
209
+ return (event) => {
210
+ onInput?.(event);
211
+ if (isInvalid) event.currentTarget.dispatchEvent(new Event("change", { bubbles: true }));
212
+ };
213
+ }
214
+ /**
188
215
  * The box a control sits in, filled or outlined, with its label. React
189
216
  * Aria's `Group`, so
190
217
  * the field around it hands down `isDisabled` and `isInvalid` through context
@@ -193,9 +220,10 @@ function boxStyles(floatingLabel, isFocused, multiline, leading, trailing, varia
193
220
  * on a button rather than an input — passes the two states itself.
194
221
  */
195
222
  function FieldBox(t0) {
196
- const $ = c(34);
223
+ const $ = c(36);
197
224
  let T0;
198
225
  let children;
226
+ let endInset;
199
227
  let floatingLabel;
200
228
  let isFocused;
201
229
  let isPopulated;
@@ -210,18 +238,19 @@ function FieldBox(t0) {
210
238
  let trigger;
211
239
  let variant;
212
240
  if ($[0] !== t0) {
213
- const { children: t4, floatingLabel: t5, isFocused: t6, isPopulated: t7, isRequired: t8, label: t9, leading: t10, multiline: t11, trailing: t12, trigger: t13, variant: t14, ...props } = t0;
241
+ const { children: t4, endInset: t5, floatingLabel: t6, isFocused: t7, isPopulated: t8, isRequired: t9, label: t10, leading: t11, multiline: t12, trailing: t13, trigger: t14, variant: t15, ...props } = t0;
214
242
  children = t4;
215
- isPopulated = t7;
216
- label = t9;
217
- leading = t10;
218
- trailing = t12;
219
- trigger = t13;
220
- floatingLabel = t5 === void 0 ? true : t5;
221
- isFocused = t6 === void 0 ? false : t6;
222
- isRequired = t8 === void 0 ? false : t8;
223
- multiline = t11 === void 0 ? false : t11;
224
- variant = t14 === void 0 ? "filled" : t14;
243
+ isPopulated = t8;
244
+ label = t10;
245
+ leading = t11;
246
+ trailing = t13;
247
+ trigger = t14;
248
+ endInset = t5 === void 0 ? "0px" : t5;
249
+ floatingLabel = t6 === void 0 ? true : t6;
250
+ isFocused = t7 === void 0 ? false : t7;
251
+ isRequired = t9 === void 0 ? false : t9;
252
+ multiline = t12 === void 0 ? false : t12;
253
+ variant = t15 === void 0 ? "filled" : t15;
225
254
  T0 = Group;
226
255
  t1 = props;
227
256
  t2 = trigger === void 0 ? focusesControl(props.onPointerDown) : props.onPointerDown;
@@ -229,67 +258,70 @@ function FieldBox(t0) {
229
258
  $[0] = t0;
230
259
  $[1] = T0;
231
260
  $[2] = children;
232
- $[3] = floatingLabel;
233
- $[4] = isFocused;
234
- $[5] = isPopulated;
235
- $[6] = isRequired;
236
- $[7] = label;
237
- $[8] = leading;
238
- $[9] = multiline;
239
- $[10] = t1;
240
- $[11] = t2;
241
- $[12] = t3;
242
- $[13] = trailing;
243
- $[14] = trigger;
244
- $[15] = variant;
261
+ $[3] = endInset;
262
+ $[4] = floatingLabel;
263
+ $[5] = isFocused;
264
+ $[6] = isPopulated;
265
+ $[7] = isRequired;
266
+ $[8] = label;
267
+ $[9] = leading;
268
+ $[10] = multiline;
269
+ $[11] = t1;
270
+ $[12] = t2;
271
+ $[13] = t3;
272
+ $[14] = trailing;
273
+ $[15] = trigger;
274
+ $[16] = variant;
245
275
  } else {
246
276
  T0 = $[1];
247
277
  children = $[2];
248
- floatingLabel = $[3];
249
- isFocused = $[4];
250
- isPopulated = $[5];
251
- isRequired = $[6];
252
- label = $[7];
253
- leading = $[8];
254
- multiline = $[9];
255
- t1 = $[10];
256
- t2 = $[11];
257
- t3 = $[12];
258
- trailing = $[13];
259
- trigger = $[14];
260
- variant = $[15];
278
+ endInset = $[3];
279
+ floatingLabel = $[4];
280
+ isFocused = $[5];
281
+ isPopulated = $[6];
282
+ isRequired = $[7];
283
+ label = $[8];
284
+ leading = $[9];
285
+ multiline = $[10];
286
+ t1 = $[11];
287
+ t2 = $[12];
288
+ t3 = $[13];
289
+ trailing = $[14];
290
+ trigger = $[15];
291
+ variant = $[16];
261
292
  }
262
293
  let t4;
263
- if ($[16] !== children || $[17] !== floatingLabel || $[18] !== isFocused || $[19] !== isPopulated || $[20] !== isRequired || $[21] !== label || $[22] !== leading || $[23] !== multiline || $[24] !== trailing || $[25] !== trigger || $[26] !== variant) {
264
- t4 = boxContent(label, children, floatingLabel, isFocused, isPopulated, isRequired, leading, multiline, trailing, trigger, variant);
265
- $[16] = children;
266
- $[17] = floatingLabel;
267
- $[18] = isFocused;
268
- $[19] = isPopulated;
269
- $[20] = isRequired;
270
- $[21] = label;
271
- $[22] = leading;
272
- $[23] = multiline;
273
- $[24] = trailing;
274
- $[25] = trigger;
275
- $[26] = variant;
276
- $[27] = t4;
277
- } else t4 = $[27];
294
+ if ($[17] !== children || $[18] !== endInset || $[19] !== floatingLabel || $[20] !== isFocused || $[21] !== isPopulated || $[22] !== isRequired || $[23] !== label || $[24] !== leading || $[25] !== multiline || $[26] !== trailing || $[27] !== trigger || $[28] !== variant) {
295
+ t4 = boxContent(label, children, endInset, floatingLabel, isFocused, isPopulated, isRequired, leading, multiline, trailing, trigger, variant);
296
+ $[17] = children;
297
+ $[18] = endInset;
298
+ $[19] = floatingLabel;
299
+ $[20] = isFocused;
300
+ $[21] = isPopulated;
301
+ $[22] = isRequired;
302
+ $[23] = label;
303
+ $[24] = leading;
304
+ $[25] = multiline;
305
+ $[26] = trailing;
306
+ $[27] = trigger;
307
+ $[28] = variant;
308
+ $[29] = t4;
309
+ } else t4 = $[29];
278
310
  let t5;
279
- if ($[28] !== T0 || $[29] !== t1 || $[30] !== t2 || $[31] !== t3 || $[32] !== t4) {
311
+ if ($[30] !== T0 || $[31] !== t1 || $[32] !== t2 || $[33] !== t3 || $[34] !== t4) {
280
312
  t5 = /* @__PURE__ */ jsx(T0, {
281
313
  ...t1,
282
314
  onPointerDown: t2,
283
315
  ...t3,
284
316
  children: t4
285
317
  });
286
- $[28] = T0;
287
- $[29] = t1;
288
- $[30] = t2;
289
- $[31] = t3;
290
- $[32] = t4;
291
- $[33] = t5;
292
- } else t5 = $[33];
318
+ $[30] = T0;
319
+ $[31] = t1;
320
+ $[32] = t2;
321
+ $[33] = t3;
322
+ $[34] = t4;
323
+ $[35] = t5;
324
+ } else t5 = $[35];
293
325
  return t5;
294
326
  }
295
327
  const PRESSABLE = "a, button, input, textarea, select, [role=\"button\"], [contenteditable=\"true\"]";
@@ -305,76 +337,80 @@ const PRESSABLE = "a, button, input, textarea, select, [role=\"button\"], [conte
305
337
  * placeholder it was given in every state.
306
338
  */
307
339
  function FieldInput(t0) {
308
- const $ = c(19);
309
- const { numeric: t1, placeholder, prefix, suffix, ...props$3 } = t0;
340
+ const $ = c(20);
341
+ const { numeric: t1, placeholder, prefix, suffix, ...props$1 } = t0;
310
342
  const numeric = t1 === void 0 ? false : t1;
311
343
  const box = useContext(BoxContext);
344
+ const validation = useContext(FieldErrorContext);
312
345
  const T0 = Input;
313
346
  const t2 = placeholder ?? (box.label === "floating" ? " " : void 0);
314
- let t3;
347
+ const t3 = commitWhileInvalid(validation?.isInvalid ?? false, props$1.onInput);
348
+ let t4;
315
349
  if ($[0] !== box || $[1] !== numeric) {
316
- t3 = (state) => props(fieldChromeStyles.input, box.underLabel && fieldChromeStyles.inputUnderLabel, box.label === "floating" && fieldChromeStyles.inputUnderFloatingLabel, numeric && fieldChromeStyles.numeric, state.isDisabled && fieldChromeStyles.inputDisabled);
350
+ t4 = (state) => props(fieldChromeStyles.input, box.underLabel && fieldChromeStyles.inputUnderLabel, box.label === "floating" && fieldChromeStyles.inputUnderFloatingLabel, numeric && fieldChromeStyles.numeric, state.isDisabled && fieldChromeStyles.inputDisabled);
317
351
  $[0] = box;
318
352
  $[1] = numeric;
319
- $[2] = t3;
320
- } else t3 = $[2];
321
- const t4 = mergeStatefulStyles(t3, props$3);
322
- let t5;
323
- if ($[3] !== T0 || $[4] !== props$3 || $[5] !== t2 || $[6] !== t4) {
324
- t5 = /* @__PURE__ */ jsx(T0, {
353
+ $[2] = t4;
354
+ } else t4 = $[2];
355
+ const t5 = mergeStatefulStyles(t4, props$1);
356
+ let t6;
357
+ if ($[3] !== T0 || $[4] !== props$1 || $[5] !== t2 || $[6] !== t3 || $[7] !== t5) {
358
+ t6 = /* @__PURE__ */ jsx(T0, {
325
359
  placeholder: t2,
326
- ...props$3,
327
- ...t4
360
+ ...props$1,
361
+ onInput: t3,
362
+ ...t5
328
363
  });
329
364
  $[3] = T0;
330
- $[4] = props$3;
365
+ $[4] = props$1;
331
366
  $[5] = t2;
332
- $[6] = t4;
367
+ $[6] = t3;
333
368
  $[7] = t5;
334
- } else t5 = $[7];
335
- const control = t5;
336
- if (prefix === void 0 && suffix === void 0) return control;
337
- let t6;
338
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
339
- t6 = props(fieldChromeStyles.affixLine);
340
369
  $[8] = t6;
341
370
  } else t6 = $[8];
371
+ const control = t6;
372
+ if (prefix === void 0 && suffix === void 0) return control;
342
373
  let t7;
343
- if ($[9] !== box || $[10] !== prefix) {
344
- t7 = prefix === void 0 ? null : /* @__PURE__ */ jsx("span", {
374
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
375
+ t7 = props(fieldChromeStyles.affixLine);
376
+ $[9] = t7;
377
+ } else t7 = $[9];
378
+ let t8;
379
+ if ($[10] !== box || $[11] !== prefix) {
380
+ t8 = prefix === void 0 ? null : /* @__PURE__ */ jsx("span", {
345
381
  ...props(fieldChromeStyles.affix, box.underLabel && fieldChromeStyles.inputUnderLabel),
346
382
  children: prefix
347
383
  });
348
- $[9] = box;
349
- $[10] = prefix;
350
- $[11] = t7;
351
- } else t7 = $[11];
352
- let t8;
353
- if ($[12] !== box || $[13] !== suffix) {
354
- t8 = suffix === void 0 ? null : /* @__PURE__ */ jsx("span", {
384
+ $[10] = box;
385
+ $[11] = prefix;
386
+ $[12] = t8;
387
+ } else t8 = $[12];
388
+ let t9;
389
+ if ($[13] !== box || $[14] !== suffix) {
390
+ t9 = suffix === void 0 ? null : /* @__PURE__ */ jsx("span", {
355
391
  ...props(fieldChromeStyles.affix, box.underLabel && fieldChromeStyles.inputUnderLabel),
356
392
  children: suffix
357
393
  });
358
- $[12] = box;
359
- $[13] = suffix;
360
- $[14] = t8;
361
- } else t8 = $[14];
362
- let t9;
363
- if ($[15] !== control || $[16] !== t7 || $[17] !== t8) {
364
- t9 = /* @__PURE__ */ jsxs("span", {
365
- ...t6,
394
+ $[13] = box;
395
+ $[14] = suffix;
396
+ $[15] = t9;
397
+ } else t9 = $[15];
398
+ let t10;
399
+ if ($[16] !== control || $[17] !== t8 || $[18] !== t9) {
400
+ t10 = /* @__PURE__ */ jsxs("span", {
401
+ ...t7,
366
402
  children: [
367
- t7,
403
+ t8,
368
404
  control,
369
- t8
405
+ t9
370
406
  ]
371
407
  });
372
- $[15] = control;
373
- $[16] = t7;
408
+ $[16] = control;
374
409
  $[17] = t8;
375
410
  $[18] = t9;
376
- } else t9 = $[18];
377
- return t9;
411
+ $[19] = t10;
412
+ } else t10 = $[19];
413
+ return t10;
378
414
  }
379
415
  /**
380
416
  * A date or a time's segments, in a {@link FieldBox}: React Aria's
@@ -425,70 +461,74 @@ function FieldSegments(t0) {
425
461
  * of the two is taller.
426
462
  */
427
463
  function FieldTextArea(t0) {
428
- const $ = c(17);
464
+ const $ = c(18);
429
465
  const { autosize: t1, placeholder, ...props$4 } = t0;
430
466
  const autosize = t1 === void 0 ? false : t1;
431
467
  const box = useContext(BoxContext);
432
468
  const context = useSlottedContext(TextAreaContext);
469
+ const validation = useContext(FieldErrorContext);
433
470
  const value = typeof context?.value === "string" ? context.value : "";
434
471
  const T0 = TextArea;
435
472
  const t2 = placeholder ?? (box.label === "floating" ? " " : void 0);
436
- let t3;
473
+ const t3 = commitWhileInvalid(validation?.isInvalid ?? false, props$4.onInput);
474
+ let t4;
437
475
  if ($[0] !== autosize || $[1] !== box) {
438
- t3 = (state) => props(fieldChromeStyles.input, box.underLabel && fieldChromeStyles.inputUnderLabel, box.label === "floating" && fieldChromeStyles.inputUnderFloatingLabel, fieldChromeStyles.textArea, autosize && fieldChromeStyles.textAreaAutosize, autosize && fieldChromeStyles.autosizeCell, state.isDisabled && fieldChromeStyles.inputDisabled);
476
+ t4 = (state) => props(fieldChromeStyles.input, box.underLabel && fieldChromeStyles.inputUnderLabel, box.label === "floating" && fieldChromeStyles.inputUnderFloatingLabel, fieldChromeStyles.textArea, autosize && fieldChromeStyles.textAreaAutosize, autosize && fieldChromeStyles.autosizeCell, state.isDisabled && fieldChromeStyles.inputDisabled);
439
477
  $[0] = autosize;
440
478
  $[1] = box;
441
- $[2] = t3;
442
- } else t3 = $[2];
443
- const t4 = mergeStatefulStyles(t3, props$4);
444
- let t5;
445
- if ($[3] !== T0 || $[4] !== props$4 || $[5] !== t2 || $[6] !== t4) {
446
- t5 = /* @__PURE__ */ jsx(T0, {
479
+ $[2] = t4;
480
+ } else t4 = $[2];
481
+ const t5 = mergeStatefulStyles(t4, props$4);
482
+ let t6;
483
+ if ($[3] !== T0 || $[4] !== props$4 || $[5] !== t2 || $[6] !== t3 || $[7] !== t5) {
484
+ t6 = /* @__PURE__ */ jsx(T0, {
447
485
  placeholder: t2,
448
486
  ...props$4,
449
- ...t4
487
+ onInput: t3,
488
+ ...t5
450
489
  });
451
490
  $[3] = T0;
452
491
  $[4] = props$4;
453
492
  $[5] = t2;
454
- $[6] = t4;
493
+ $[6] = t3;
455
494
  $[7] = t5;
456
- } else t5 = $[7];
457
- const control = t5;
458
- if (!autosize) return control;
459
- let t6;
460
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
461
- t6 = props(fieldChromeStyles.autosize);
462
495
  $[8] = t6;
463
496
  } else t6 = $[8];
497
+ const control = t6;
498
+ if (!autosize) return control;
464
499
  let t7;
465
- if ($[9] !== box.underLabel) {
466
- t7 = props(fieldChromeStyles.input, box.underLabel && fieldChromeStyles.inputUnderLabel, fieldChromeStyles.replica, fieldChromeStyles.autosizeCell);
467
- $[9] = box.underLabel;
468
- $[10] = t7;
469
- } else t7 = $[10];
500
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
501
+ t7 = props(fieldChromeStyles.autosize);
502
+ $[9] = t7;
503
+ } else t7 = $[9];
470
504
  let t8;
471
- if ($[11] !== t7 || $[12] !== value) {
472
- t8 = /* @__PURE__ */ jsxs("div", {
505
+ if ($[10] !== box.underLabel) {
506
+ t8 = props(fieldChromeStyles.input, box.underLabel && fieldChromeStyles.inputUnderLabel, fieldChromeStyles.replica, fieldChromeStyles.autosizeCell);
507
+ $[10] = box.underLabel;
508
+ $[11] = t8;
509
+ } else t8 = $[11];
510
+ let t9;
511
+ if ($[12] !== t8 || $[13] !== value) {
512
+ t9 = /* @__PURE__ */ jsxs("div", {
473
513
  "aria-hidden": "true",
474
- ...t7,
514
+ ...t8,
475
515
  children: [value, " "]
476
516
  });
477
- $[11] = t7;
478
- $[12] = value;
479
- $[13] = t8;
480
- } else t8 = $[13];
481
- let t9;
482
- if ($[14] !== control || $[15] !== t8) {
483
- t9 = /* @__PURE__ */ jsxs("div", {
484
- ...t6,
485
- children: [control, t8]
517
+ $[12] = t8;
518
+ $[13] = value;
519
+ $[14] = t9;
520
+ } else t9 = $[14];
521
+ let t10;
522
+ if ($[15] !== control || $[16] !== t9) {
523
+ t10 = /* @__PURE__ */ jsxs("div", {
524
+ ...t7,
525
+ children: [control, t9]
486
526
  });
487
- $[14] = control;
488
- $[15] = t8;
527
+ $[15] = control;
489
528
  $[16] = t9;
490
- } else t9 = $[16];
491
- return t9;
529
+ $[17] = t10;
530
+ } else t10 = $[17];
531
+ return t10;
492
532
  }
493
533
  /**
494
534
  * The press target over a {@link FieldBox} whose whole surface opens
@@ -538,19 +578,19 @@ function FieldTrigger(props$5) {
538
578
  */
539
579
  function FieldValue(t0) {
540
580
  const $ = c(3);
541
- const { isFocused: t1, isPlaceholder: t2, ...props$1 } = t0;
581
+ const { isFocused: t1, isPlaceholder: t2, ...props$3 } = t0;
542
582
  const isFocused = t1 === void 0 ? false : t1;
543
583
  const isPlaceholder = t2 === void 0 ? false : t2;
544
584
  const box = useContext(BoxContext);
545
585
  const hidden = isPlaceholder && box.label === "floating" && !isFocused;
546
- const t3 = mergeStyles(props(fieldChromeStyles.input, fieldChromeStyles.value, box.underLabel && fieldChromeStyles.inputUnderLabel, isPlaceholder && fieldChromeStyles.valuePlaceholder, hidden && fieldChromeStyles.valuePlaceholderHidden), props$1);
586
+ const t3 = mergeStyles(props(fieldChromeStyles.input, fieldChromeStyles.value, box.underLabel && fieldChromeStyles.inputUnderLabel, isPlaceholder && fieldChromeStyles.valuePlaceholder, hidden && fieldChromeStyles.valuePlaceholderHidden), props$3);
547
587
  let t4;
548
- if ($[0] !== props$1 || $[1] !== t3) {
588
+ if ($[0] !== props$3 || $[1] !== t3) {
549
589
  t4 = /* @__PURE__ */ jsx("span", {
550
- ...props$1,
590
+ ...props$3,
551
591
  ...t3
552
592
  });
553
- $[0] = props$1;
593
+ $[0] = props$3;
554
594
  $[1] = t3;
555
595
  $[2] = t4;
556
596
  } else t4 = $[2];
@@ -674,7 +714,7 @@ function FieldLabel(t0) {
674
714
  * the field's validation state is read for.
675
715
  */
676
716
  function FieldMessage(t0) {
677
- const $ = c(32);
717
+ const $ = c(34);
678
718
  const { characterCount: t1, characterLimitLabel, description, error, errorId, inset: t2, maxLength, reserve: t3 } = t0;
679
719
  const characterCount = t1 === void 0 ? false : t1;
680
720
  const inset = t2 === void 0 ? true : t2;
@@ -709,7 +749,7 @@ function FieldMessage(t0) {
709
749
  $[5] = t5;
710
750
  } else t5 = $[5];
711
751
  const hidden = t5;
712
- if (!invalid && description === void 0 && !characterCount && !(insideForm && reserve)) return hidden;
752
+ const collapsed = !invalid && description === void 0 && !characterCount && !(insideForm && reserve);
713
753
  const value = input?.value ?? textArea?.value ?? "";
714
754
  const length = String(value).length;
715
755
  const hint = invalid ? void 0 : description;
@@ -754,53 +794,64 @@ function FieldMessage(t0) {
754
794
  } else t8 = $[14];
755
795
  const written = t8;
756
796
  let t9;
757
- if ($[15] !== inset) {
758
- t9 = props(fieldChromeStyles.message, fieldChromeStyles.messageLine, inset && fieldChromeStyles.messageInset);
759
- $[15] = inset;
760
- $[16] = t9;
761
- } else t9 = $[16];
797
+ if ($[15] !== collapsed || $[16] !== inset) {
798
+ t9 = props(fieldChromeStyles.message, fieldChromeStyles.messageLine, inset && fieldChromeStyles.messageInset, collapsed && fieldChromeStyles.messageLineCollapsed);
799
+ $[15] = collapsed;
800
+ $[16] = inset;
801
+ $[17] = t9;
802
+ } else t9 = $[17];
762
803
  let t10;
763
- if ($[17] !== error || $[18] !== validation || $[19] !== written) {
764
- t10 = validation === null && error !== void 0 ? written : /* @__PURE__ */ jsx(FieldError, {
765
- ...props(fieldChromeStyles.message, fieldChromeStyles.messageError),
766
- children: error
767
- });
768
- $[17] = error;
769
- $[18] = validation;
770
- $[19] = written;
771
- $[20] = t10;
772
- } else t10 = $[20];
804
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
805
+ t10 = props(fieldChromeStyles.messageRegion);
806
+ $[18] = t10;
807
+ } else t10 = $[18];
773
808
  let t11;
774
- if ($[21] !== characterCount || $[22] !== invalid || $[23] !== length || $[24] !== locale || $[25] !== maxLength) {
775
- t11 = characterCount ? /* @__PURE__ */ jsx("span", {
809
+ if ($[19] !== error || $[20] !== validation || $[21] !== written) {
810
+ t11 = /* @__PURE__ */ jsx("span", {
811
+ "aria-atomic": "true",
812
+ "aria-live": "polite",
813
+ ...t10,
814
+ children: validation === null && error !== void 0 ? written : /* @__PURE__ */ jsx(FieldError, {
815
+ ...props(fieldChromeStyles.message, fieldChromeStyles.messageError),
816
+ children: error
817
+ })
818
+ });
819
+ $[19] = error;
820
+ $[20] = validation;
821
+ $[21] = written;
822
+ $[22] = t11;
823
+ } else t11 = $[22];
824
+ let t12;
825
+ if ($[23] !== characterCount || $[24] !== invalid || $[25] !== length || $[26] !== locale || $[27] !== maxLength) {
826
+ t12 = characterCount ? /* @__PURE__ */ jsx("span", {
776
827
  "aria-hidden": "true",
777
828
  ...props(fieldChromeStyles.message, fieldChromeStyles.counter, invalid && fieldChromeStyles.messageError),
778
829
  children: countIn(locale, length, maxLength)
779
830
  }) : null;
780
- $[21] = characterCount;
781
- $[22] = invalid;
782
- $[23] = length;
783
- $[24] = locale;
784
- $[25] = maxLength;
785
- $[26] = t11;
786
- } else t11 = $[26];
787
- let t12;
788
- if ($[27] !== described || $[28] !== t10 || $[29] !== t11 || $[30] !== t9) {
789
- t12 = /* @__PURE__ */ jsxs("div", {
831
+ $[23] = characterCount;
832
+ $[24] = invalid;
833
+ $[25] = length;
834
+ $[26] = locale;
835
+ $[27] = maxLength;
836
+ $[28] = t12;
837
+ } else t12 = $[28];
838
+ let t13;
839
+ if ($[29] !== described || $[30] !== t11 || $[31] !== t12 || $[32] !== t9) {
840
+ t13 = /* @__PURE__ */ jsxs("div", {
790
841
  ...t9,
791
842
  children: [
792
- t10,
843
+ t11,
793
844
  described,
794
- t11
845
+ t12
795
846
  ]
796
847
  });
797
- $[27] = described;
798
- $[28] = t10;
799
- $[29] = t11;
800
- $[30] = t9;
848
+ $[29] = described;
849
+ $[30] = t11;
801
850
  $[31] = t12;
802
- } else t12 = $[31];
803
- return t12;
851
+ $[32] = t9;
852
+ $[33] = t13;
853
+ } else t13 = $[33];
854
+ return t13;
804
855
  }
805
856
  /**
806
857
  * The same asterisk for a label that is not a field's own — a checkbox's, a