@kanso-labs/kanso-ui 0.40.7 → 0.40.9

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 (61) hide show
  1. package/dist/badge/index.js +15 -0
  2. package/dist/badge/index.js.map +1 -0
  3. package/dist/components/avatar/index.d.ts +7 -0
  4. package/dist/components/avatar/index.js.map +1 -1
  5. package/dist/components/badge/index.js +96 -48
  6. package/dist/components/badge/index.js.map +1 -1
  7. package/dist/components/dialog/index.d.ts +6 -1
  8. package/dist/components/dialog/index.js +54 -24
  9. package/dist/components/dialog/index.js.map +1 -1
  10. package/dist/components/form/index.d.ts +5 -4
  11. package/dist/components/form/index.js.map +1 -1
  12. package/dist/components/link/index.js +16 -5
  13. package/dist/components/link/index.js.map +1 -1
  14. package/dist/components/menu/index.js +29 -21
  15. package/dist/components/menu/index.js.map +1 -1
  16. package/dist/components/navigation-bar/index.js +134 -54
  17. package/dist/components/navigation-bar/index.js.map +1 -1
  18. package/dist/components/navigation-rail/index.js +56 -37
  19. package/dist/components/navigation-rail/index.js.map +1 -1
  20. package/dist/components/number-field/index.d.ts +13 -2
  21. package/dist/components/number-field/index.js +95 -84
  22. package/dist/components/number-field/index.js.map +1 -1
  23. package/dist/components/popover/index.d.ts +4 -1
  24. package/dist/components/popover/index.js +239 -137
  25. package/dist/components/popover/index.js.map +1 -1
  26. package/dist/components/product-icon/index.d.ts +3 -1
  27. package/dist/components/product-icon/index.js.map +1 -1
  28. package/dist/components/progress-indicator/index.js +1 -1
  29. package/dist/components/progress-indicator/index.js.map +1 -1
  30. package/dist/components/search-field/index.js +7 -3
  31. package/dist/components/search-field/index.js.map +1 -1
  32. package/dist/components/segmented-button/index.d.ts +17 -1
  33. package/dist/components/segmented-button/index.js +132 -59
  34. package/dist/components/segmented-button/index.js.map +1 -1
  35. package/dist/components/sheet/index.d.ts +8 -1
  36. package/dist/components/sheet/index.js +45 -29
  37. package/dist/components/sheet/index.js.map +1 -1
  38. package/dist/components/snackbar/index.d.ts +4 -0
  39. package/dist/components/snackbar/index.js +54 -49
  40. package/dist/components/snackbar/index.js.map +1 -1
  41. package/dist/field/index.js +314 -284
  42. package/dist/field/index.js.map +1 -1
  43. package/dist/field/press.js +27 -0
  44. package/dist/field/press.js.map +1 -0
  45. package/dist/field/root.js +8 -8
  46. package/dist/field/root.js.map +1 -1
  47. package/dist/field/styles.js +22 -0
  48. package/dist/field/styles.js.map +1 -1
  49. package/dist/hooks/useBottomEdge.js +83 -0
  50. package/dist/hooks/useBottomEdge.js.map +1 -0
  51. package/dist/mark/initials.js +41 -26
  52. package/dist/mark/initials.js.map +1 -1
  53. package/dist/navigation/context.js.map +1 -1
  54. package/dist/navigation/index.js +16 -4
  55. package/dist/navigation/index.js.map +1 -1
  56. package/dist/navigation/styles.js +35 -1
  57. package/dist/navigation/styles.js.map +1 -1
  58. package/dist/row/styles.js +2 -1
  59. package/dist/row/styles.js.map +1 -1
  60. package/dist/styles.css +110 -32
  61. package/package.json +2 -2
@@ -1,6 +1,8 @@
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";
5
+ import { focusesControl } from "./press.js";
4
6
  import { useInsideForm } from "./root.js";
5
7
  import { fieldChromeStyles, groupStyles } from "./styles.js";
6
8
  import { c } from "react/compiler-runtime";
@@ -35,8 +37,9 @@ const BOX_CONTROLS = {
35
37
  }
36
38
  };
37
39
  const BoxContext = createContext(OUTSIDE_BOX);
38
- function boxContent(label, children, floatingLabel, isFocused, isPopulated, isRequired, leading, multiline, trailing, trigger, variant) {
40
+ function boxContent(label, children, endInset, floatingLabel, isFocused, isPopulated, isRequired, leading, multiline, trailing, trigger, variant) {
39
41
  return (state) => /* @__PURE__ */ jsx(BoxContent, {
42
+ endInset,
40
43
  floatingLabel,
41
44
  isFocused,
42
45
  isPopulated,
@@ -59,8 +62,8 @@ function boxContent(label, children, floatingLabel, isFocused, isPopulated, isRe
59
62
  * for them. See the outlined variant's note above.
60
63
  */
61
64
  function BoxContent(t0) {
62
- const $ = c(45);
63
- const { children, floatingLabel, isFocused, isPopulated, isRequired, label, leading, multiline, state, trailing, trigger, variant } = t0;
65
+ const $ = c(47);
66
+ const { children, endInset, floatingLabel, isFocused, isPopulated, isRequired, label, leading, multiline, state, trailing, trigger, variant } = t0;
64
67
  const read = useFieldPopulated();
65
68
  const populated = isPopulated ?? read;
66
69
  const outlined = variant === "outlined";
@@ -68,98 +71,100 @@ function BoxContent(t0) {
68
71
  const floated = !floatingLabel || focused || populated;
69
72
  const t1 = BOX_CONTROLS[variant][floatingLabel ? "floating" : "fixed"];
70
73
  let t2;
71
- if ($[0] !== floated || $[1] !== focused || $[2] !== isRequired || $[3] !== label || $[4] !== leading || $[5] !== outlined || $[6] !== trailing) {
74
+ if ($[0] !== endInset || $[1] !== floated || $[2] !== focused || $[3] !== isRequired || $[4] !== label || $[5] !== leading || $[6] !== outlined || $[7] !== trailing) {
72
75
  t2 = outlined ? /* @__PURE__ */ jsx("fieldset", {
73
76
  "aria-hidden": "true",
74
- ...props(fieldChromeStyles.outline, leading !== void 0 && fieldChromeStyles.outlineLeading, trailing !== void 0 && fieldChromeStyles.outlineTrailing, focused && fieldChromeStyles.outlineFocused),
77
+ ...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
78
  children: /* @__PURE__ */ jsx("legend", {
76
79
  ...props(fieldChromeStyles.outlineNotch, floated && fieldChromeStyles.outlineNotchOpen),
77
80
  children: floated ? /* @__PURE__ */ jsxs(Fragment$1, { children: [label, isRequired ? REQUIRED_MARK : null] }) : null
78
81
  })
79
82
  }) : 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];
83
+ $[0] = endInset;
84
+ $[1] = floated;
85
+ $[2] = focused;
86
+ $[3] = isRequired;
87
+ $[4] = label;
88
+ $[5] = leading;
89
+ $[6] = outlined;
90
+ $[7] = trailing;
91
+ $[8] = t2;
92
+ } else t2 = $[8];
89
93
  let t3;
90
- if ($[8] !== leading || $[9] !== multiline || $[10] !== outlined || $[11] !== state.isDisabled) {
94
+ if ($[9] !== leading || $[10] !== multiline || $[11] !== outlined || $[12] !== state.isDisabled) {
91
95
  t3 = leading === void 0 ? null : /* @__PURE__ */ jsx("span", {
92
96
  ...props(fieldChromeStyles.icon, multiline && fieldChromeStyles.iconMultiline, outlined && fieldChromeStyles.iconOutlined, state.isDisabled && fieldChromeStyles.iconDisabled),
93
97
  children: leading
94
98
  });
95
- $[8] = leading;
96
- $[9] = multiline;
97
- $[10] = outlined;
98
- $[11] = state.isDisabled;
99
- $[12] = t3;
100
- } else t3 = $[12];
99
+ $[9] = leading;
100
+ $[10] = multiline;
101
+ $[11] = outlined;
102
+ $[12] = state.isDisabled;
103
+ $[13] = t3;
104
+ } else t3 = $[13];
101
105
  let t4;
102
- if ($[13] !== floatingLabel || $[14] !== state.isDisabled) {
106
+ if ($[14] !== floatingLabel || $[15] !== state.isDisabled) {
103
107
  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];
108
+ $[14] = floatingLabel;
109
+ $[15] = state.isDisabled;
110
+ $[16] = t4;
111
+ } else t4 = $[16];
108
112
  let t5;
109
- if ($[16] !== focused || $[17] !== state) {
113
+ if ($[17] !== focused || $[18] !== state) {
110
114
  t5 = withFocus(state, focused);
111
- $[16] = focused;
112
- $[17] = state;
113
- $[18] = t5;
114
- } else t5 = $[18];
115
+ $[17] = focused;
116
+ $[18] = state;
117
+ $[19] = t5;
118
+ } else t5 = $[19];
115
119
  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];
120
+ if ($[20] !== endInset || $[21] !== floated || $[22] !== floatingLabel || $[23] !== outlined) {
121
+ 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})`));
122
+ $[20] = endInset;
123
+ $[21] = floated;
124
+ $[22] = floatingLabel;
125
+ $[23] = outlined;
126
+ $[24] = t6;
127
+ } else t6 = $[24];
123
128
  let t7;
124
- if ($[23] !== isRequired || $[24] !== label || $[25] !== t5 || $[26] !== t6) {
129
+ if ($[25] !== isRequired || $[26] !== label || $[27] !== t5 || $[28] !== t6) {
125
130
  t7 = /* @__PURE__ */ jsx(FieldLabel, {
126
131
  isRequired,
127
132
  state: t5,
128
133
  ...t6,
129
134
  children: label
130
135
  });
131
- $[23] = isRequired;
132
- $[24] = label;
133
- $[25] = t5;
134
- $[26] = t6;
135
- $[27] = t7;
136
- } else t7 = $[27];
136
+ $[25] = isRequired;
137
+ $[26] = label;
138
+ $[27] = t5;
139
+ $[28] = t6;
140
+ $[29] = t7;
141
+ } else t7 = $[29];
137
142
  let t8;
138
- if ($[28] !== children || $[29] !== t4 || $[30] !== t7) {
143
+ if ($[30] !== children || $[31] !== t4 || $[32] !== t7) {
139
144
  t8 = /* @__PURE__ */ jsxs("div", {
140
145
  ...t4,
141
146
  children: [t7, children]
142
147
  });
143
- $[28] = children;
144
- $[29] = t4;
145
- $[30] = t7;
146
- $[31] = t8;
147
- } else t8 = $[31];
148
+ $[30] = children;
149
+ $[31] = t4;
150
+ $[32] = t7;
151
+ $[33] = t8;
152
+ } else t8 = $[33];
148
153
  let t9;
149
- if ($[32] !== multiline || $[33] !== outlined || $[34] !== state.isDisabled || $[35] !== state.isInvalid || $[36] !== trailing) {
154
+ if ($[34] !== multiline || $[35] !== outlined || $[36] !== state.isDisabled || $[37] !== state.isInvalid || $[38] !== trailing) {
150
155
  t9 = trailing === void 0 ? null : /* @__PURE__ */ jsx("span", {
151
156
  ...props(fieldChromeStyles.icon, multiline && fieldChromeStyles.iconMultiline, outlined && fieldChromeStyles.iconOutlined, state.isInvalid && fieldChromeStyles.iconError, state.isDisabled && fieldChromeStyles.iconDisabled),
152
157
  children: trailing
153
158
  });
154
- $[32] = multiline;
155
- $[33] = outlined;
156
- $[34] = state.isDisabled;
157
- $[35] = state.isInvalid;
158
- $[36] = trailing;
159
- $[37] = t9;
160
- } else t9 = $[37];
159
+ $[34] = multiline;
160
+ $[35] = outlined;
161
+ $[36] = state.isDisabled;
162
+ $[37] = state.isInvalid;
163
+ $[38] = trailing;
164
+ $[39] = t9;
165
+ } else t9 = $[39];
161
166
  let t10;
162
- if ($[38] !== t1 || $[39] !== t2 || $[40] !== t3 || $[41] !== t8 || $[42] !== t9 || $[43] !== trigger) {
167
+ if ($[40] !== t1 || $[41] !== t2 || $[42] !== t3 || $[43] !== t8 || $[44] !== t9 || $[45] !== trigger) {
163
168
  t10 = /* @__PURE__ */ jsxs(BoxContext, {
164
169
  value: t1,
165
170
  children: [
@@ -170,14 +175,14 @@ function BoxContent(t0) {
170
175
  t9
171
176
  ]
172
177
  });
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];
178
+ $[40] = t1;
179
+ $[41] = t2;
180
+ $[42] = t3;
181
+ $[43] = t8;
182
+ $[44] = t9;
183
+ $[45] = trigger;
184
+ $[46] = t10;
185
+ } else t10 = $[46];
181
186
  return t10;
182
187
  }
183
188
  function boxStyles(floatingLabel, isFocused, multiline, leading, trailing, variant) {
@@ -185,6 +190,29 @@ function boxStyles(floatingLabel, isFocused, multiline, leading, trailing, varia
185
190
  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
191
  }
187
192
  /**
193
+ * The control's `onInput`, which also commits the field's validation while it
194
+ * shows an error, so an edit that fixes the value clears the error as it is
195
+ * typed rather than once focus leaves.
196
+ *
197
+ * React Aria commits a field's validation — the moment a server's error is
198
+ * cleared, or the browser's own is checked again — on the control's native
199
+ * `change` event, and a text control fires that only on blur. So a reader
200
+ * typing the fix saw the error, red and `aria-invalid`, until they tabbed
201
+ * away from a value that was already right. Re-dispatching `change` on input
202
+ * is what commits early, through React Aria's own listener.
203
+ *
204
+ * Only while the field is invalid. A valid field still commits on blur, so
205
+ * nothing new is flagged in the middle of typing a value: an error is shown
206
+ * late and taken back early. React's `onChange` does not run a second time
207
+ * for it, since the value it tracks has not moved since the input.
208
+ */
209
+ function commitWhileInvalid(isInvalid, onInput) {
210
+ return (event) => {
211
+ onInput?.(event);
212
+ if (isInvalid) event.currentTarget.dispatchEvent(new Event("change", { bubbles: true }));
213
+ };
214
+ }
215
+ /**
188
216
  * The box a control sits in, filled or outlined, with its label. React
189
217
  * Aria's `Group`, so
190
218
  * the field around it hands down `isDisabled` and `isInvalid` through context
@@ -193,9 +221,10 @@ function boxStyles(floatingLabel, isFocused, multiline, leading, trailing, varia
193
221
  * on a button rather than an input — passes the two states itself.
194
222
  */
195
223
  function FieldBox(t0) {
196
- const $ = c(34);
224
+ const $ = c(36);
197
225
  let T0;
198
226
  let children;
227
+ let endInset;
199
228
  let floatingLabel;
200
229
  let isFocused;
201
230
  let isPopulated;
@@ -210,18 +239,19 @@ function FieldBox(t0) {
210
239
  let trigger;
211
240
  let variant;
212
241
  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;
242
+ 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
243
  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;
244
+ isPopulated = t8;
245
+ label = t10;
246
+ leading = t11;
247
+ trailing = t13;
248
+ trigger = t14;
249
+ endInset = t5 === void 0 ? "0px" : t5;
250
+ floatingLabel = t6 === void 0 ? true : t6;
251
+ isFocused = t7 === void 0 ? false : t7;
252
+ isRequired = t9 === void 0 ? false : t9;
253
+ multiline = t12 === void 0 ? false : t12;
254
+ variant = t15 === void 0 ? "filled" : t15;
225
255
  T0 = Group;
226
256
  t1 = props;
227
257
  t2 = trigger === void 0 ? focusesControl(props.onPointerDown) : props.onPointerDown;
@@ -229,70 +259,72 @@ function FieldBox(t0) {
229
259
  $[0] = t0;
230
260
  $[1] = T0;
231
261
  $[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;
262
+ $[3] = endInset;
263
+ $[4] = floatingLabel;
264
+ $[5] = isFocused;
265
+ $[6] = isPopulated;
266
+ $[7] = isRequired;
267
+ $[8] = label;
268
+ $[9] = leading;
269
+ $[10] = multiline;
270
+ $[11] = t1;
271
+ $[12] = t2;
272
+ $[13] = t3;
273
+ $[14] = trailing;
274
+ $[15] = trigger;
275
+ $[16] = variant;
245
276
  } else {
246
277
  T0 = $[1];
247
278
  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];
279
+ endInset = $[3];
280
+ floatingLabel = $[4];
281
+ isFocused = $[5];
282
+ isPopulated = $[6];
283
+ isRequired = $[7];
284
+ label = $[8];
285
+ leading = $[9];
286
+ multiline = $[10];
287
+ t1 = $[11];
288
+ t2 = $[12];
289
+ t3 = $[13];
290
+ trailing = $[14];
291
+ trigger = $[15];
292
+ variant = $[16];
261
293
  }
262
294
  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];
295
+ 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) {
296
+ t4 = boxContent(label, children, endInset, floatingLabel, isFocused, isPopulated, isRequired, leading, multiline, trailing, trigger, variant);
297
+ $[17] = children;
298
+ $[18] = endInset;
299
+ $[19] = floatingLabel;
300
+ $[20] = isFocused;
301
+ $[21] = isPopulated;
302
+ $[22] = isRequired;
303
+ $[23] = label;
304
+ $[24] = leading;
305
+ $[25] = multiline;
306
+ $[26] = trailing;
307
+ $[27] = trigger;
308
+ $[28] = variant;
309
+ $[29] = t4;
310
+ } else t4 = $[29];
278
311
  let t5;
279
- if ($[28] !== T0 || $[29] !== t1 || $[30] !== t2 || $[31] !== t3 || $[32] !== t4) {
312
+ if ($[30] !== T0 || $[31] !== t1 || $[32] !== t2 || $[33] !== t3 || $[34] !== t4) {
280
313
  t5 = /* @__PURE__ */ jsx(T0, {
281
314
  ...t1,
282
315
  onPointerDown: t2,
283
316
  ...t3,
284
317
  children: t4
285
318
  });
286
- $[28] = T0;
287
- $[29] = t1;
288
- $[30] = t2;
289
- $[31] = t3;
290
- $[32] = t4;
291
- $[33] = t5;
292
- } else t5 = $[33];
319
+ $[30] = T0;
320
+ $[31] = t1;
321
+ $[32] = t2;
322
+ $[33] = t3;
323
+ $[34] = t4;
324
+ $[35] = t5;
325
+ } else t5 = $[35];
293
326
  return t5;
294
327
  }
295
- const PRESSABLE = "a, button, input, textarea, select, [role=\"button\"], [contenteditable=\"true\"]";
296
328
  /**
297
329
  * A field's text control, in a {@link FieldBox} or on its own. React Aria's
298
330
  * `Input`, which takes its label association, value and validation from the
@@ -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);
340
+ const $ = c(20);
309
341
  const { numeric: t1, placeholder, prefix, suffix, ...props$3 } = 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$3.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$3);
356
+ let t6;
357
+ if ($[3] !== T0 || $[4] !== props$3 || $[5] !== t2 || $[6] !== t3 || $[7] !== t5) {
358
+ t6 = /* @__PURE__ */ jsx(T0, {
325
359
  placeholder: t2,
326
360
  ...props$3,
327
- ...t4
361
+ onInput: t3,
362
+ ...t5
328
363
  });
329
364
  $[3] = T0;
330
365
  $[4] = props$3;
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);
429
- const { autosize: t1, placeholder, ...props$4 } = t0;
464
+ const $ = c(18);
465
+ const { autosize: t1, placeholder, ...props$1 } = 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$1.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$1);
482
+ let t6;
483
+ if ($[3] !== T0 || $[4] !== props$1 || $[5] !== t2 || $[6] !== t3 || $[7] !== t5) {
484
+ t6 = /* @__PURE__ */ jsx(T0, {
447
485
  placeholder: t2,
448
- ...props$4,
449
- ...t4
486
+ ...props$1,
487
+ onInput: t3,
488
+ ...t5
450
489
  });
451
490
  $[3] = T0;
452
- $[4] = props$4;
491
+ $[4] = props$1;
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
@@ -500,21 +540,21 @@ function FieldTextArea(t0) {
500
540
  * the fill, the underline and the focus indicator, and it lights up while
501
541
  * this has focus because the indicator follows focus within.
502
542
  */
503
- function FieldTrigger(props$5) {
543
+ function FieldTrigger(props$2) {
504
544
  const $ = c(5);
505
545
  let t0;
506
- if ($[0] !== props$5) {
507
- t0 = mergeStatefulStyles(props(fieldChromeStyles.trigger), props$5);
508
- $[0] = props$5;
546
+ if ($[0] !== props$2) {
547
+ t0 = mergeStatefulStyles(props(fieldChromeStyles.trigger), props$2);
548
+ $[0] = props$2;
509
549
  $[1] = t0;
510
550
  } else t0 = $[1];
511
551
  let t1;
512
- if ($[2] !== props$5 || $[3] !== t0) {
552
+ if ($[2] !== props$2 || $[3] !== t0) {
513
553
  t1 = /* @__PURE__ */ jsx(Button, {
514
- ...props$5,
554
+ ...props$2,
515
555
  ...t0
516
556
  });
517
- $[2] = props$5;
557
+ $[2] = props$2;
518
558
  $[3] = t0;
519
559
  $[4] = t1;
520
560
  } else t1 = $[4];
@@ -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$4 } = 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$4);
547
587
  let t4;
548
- if ($[0] !== props$1 || $[1] !== t3) {
588
+ if ($[0] !== props$4 || $[1] !== t3) {
549
589
  t4 = /* @__PURE__ */ jsx("span", {
550
- ...props$1,
590
+ ...props$4,
551
591
  ...t3
552
592
  });
553
- $[0] = props$1;
593
+ $[0] = props$4;
554
594
  $[1] = t3;
555
595
  $[2] = t4;
556
596
  } else t4 = $[2];
@@ -560,27 +600,6 @@ function focusedStyle(outlined, invalid) {
560
600
  if (outlined) return invalid ? fieldChromeStyles.boxOutlinedErrorFocused : fieldChromeStyles.boxOutlinedFocused;
561
601
  return invalid ? fieldChromeStyles.boxErrorFocused : fieldChromeStyles.boxFocused;
562
602
  }
563
- const CONTROL = "input:not([type=\"hidden\"]), textarea, [contenteditable=\"true\"]";
564
- /**
565
- * The box's press handler: a press anywhere on the box focuses the control
566
- * in it, as the whole of a native text field's box does. The box is 56dp
567
- * and the control's line 24dp of it, so the padding above and below the
568
- * line, the padding at either end and the icons were dead to a press —
569
- * nothing took focus, and nothing said why. Built by a call rather than
570
- * written at the prop, which is what react-perf's no-new-function-as-prop is
571
- * after; the React Compiler memoises it on the call site's own handler,
572
- * which runs first.
573
- */
574
- function focusesControl(onPointerDown) {
575
- return (event) => {
576
- onPointerDown?.(event);
577
- if (event.defaultPrevented || event.button !== 0 || !(event.target instanceof Element) || event.target.closest(PRESSABLE) !== null) return;
578
- const control = event.currentTarget.querySelector(CONTROL);
579
- if (control === null || control.matches(":disabled")) return;
580
- event.preventDefault();
581
- control.focus();
582
- };
583
- }
584
603
  function returnToStart(event) {
585
604
  if (!event.currentTarget.contains(event.relatedTarget)) event.currentTarget.scrollLeft = 0;
586
605
  }
@@ -622,7 +641,7 @@ function FieldLabel(t0) {
622
641
  let t1;
623
642
  let t2;
624
643
  if ($[0] !== t0) {
625
- const { children: t3, isRequired: t4, state: t5, variant: t6, ...props$2 } = t0;
644
+ const { children: t3, isRequired: t4, state: t5, variant: t6, ...props$5 } = t0;
626
645
  children = t3;
627
646
  isRequired = t4 === void 0 ? false : t4;
628
647
  const state = t5 === void 0 ? NO_STATE : t5;
@@ -632,8 +651,8 @@ function FieldLabel(t0) {
632
651
  const isFocusWithin = t8 === void 0 ? false : t8;
633
652
  const isInvalid = t9 === void 0 ? false : t9;
634
653
  T0 = Label;
635
- t1 = props$2;
636
- t2 = mergeStyles(props(fieldChromeStyles.label, variant === "group" && groupStyles.label, isDisabled && fieldChromeStyles.labelDisabled, isInvalid && fieldChromeStyles.labelError, !isDisabled && !isInvalid && isFocusWithin && fieldChromeStyles.labelFocused), props$2);
654
+ t1 = props$5;
655
+ t2 = mergeStyles(props(fieldChromeStyles.label, variant === "group" && groupStyles.label, isDisabled && fieldChromeStyles.labelDisabled, isInvalid && fieldChromeStyles.labelError, !isDisabled && !isInvalid && isFocusWithin && fieldChromeStyles.labelFocused), props$5);
637
656
  $[0] = t0;
638
657
  $[1] = T0;
639
658
  $[2] = children;
@@ -674,7 +693,7 @@ function FieldLabel(t0) {
674
693
  * the field's validation state is read for.
675
694
  */
676
695
  function FieldMessage(t0) {
677
- const $ = c(32);
696
+ const $ = c(34);
678
697
  const { characterCount: t1, characterLimitLabel, description, error, errorId, inset: t2, maxLength, reserve: t3 } = t0;
679
698
  const characterCount = t1 === void 0 ? false : t1;
680
699
  const inset = t2 === void 0 ? true : t2;
@@ -709,7 +728,7 @@ function FieldMessage(t0) {
709
728
  $[5] = t5;
710
729
  } else t5 = $[5];
711
730
  const hidden = t5;
712
- if (!invalid && description === void 0 && !characterCount && !(insideForm && reserve)) return hidden;
731
+ const collapsed = !invalid && description === void 0 && !characterCount && !(insideForm && reserve);
713
732
  const value = input?.value ?? textArea?.value ?? "";
714
733
  const length = String(value).length;
715
734
  const hint = invalid ? void 0 : description;
@@ -754,53 +773,64 @@ function FieldMessage(t0) {
754
773
  } else t8 = $[14];
755
774
  const written = t8;
756
775
  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];
776
+ if ($[15] !== collapsed || $[16] !== inset) {
777
+ t9 = props(fieldChromeStyles.message, fieldChromeStyles.messageLine, inset && fieldChromeStyles.messageInset, collapsed && fieldChromeStyles.messageLineCollapsed);
778
+ $[15] = collapsed;
779
+ $[16] = inset;
780
+ $[17] = t9;
781
+ } else t9 = $[17];
762
782
  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];
783
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
784
+ t10 = props(fieldChromeStyles.messageRegion);
785
+ $[18] = t10;
786
+ } else t10 = $[18];
773
787
  let t11;
774
- if ($[21] !== characterCount || $[22] !== invalid || $[23] !== length || $[24] !== locale || $[25] !== maxLength) {
775
- t11 = characterCount ? /* @__PURE__ */ jsx("span", {
788
+ if ($[19] !== error || $[20] !== validation || $[21] !== written) {
789
+ t11 = /* @__PURE__ */ jsx("span", {
790
+ "aria-atomic": "true",
791
+ "aria-live": "polite",
792
+ ...t10,
793
+ children: validation === null && error !== void 0 ? written : /* @__PURE__ */ jsx(FieldError, {
794
+ ...props(fieldChromeStyles.message, fieldChromeStyles.messageError),
795
+ children: error
796
+ })
797
+ });
798
+ $[19] = error;
799
+ $[20] = validation;
800
+ $[21] = written;
801
+ $[22] = t11;
802
+ } else t11 = $[22];
803
+ let t12;
804
+ if ($[23] !== characterCount || $[24] !== invalid || $[25] !== length || $[26] !== locale || $[27] !== maxLength) {
805
+ t12 = characterCount ? /* @__PURE__ */ jsx("span", {
776
806
  "aria-hidden": "true",
777
807
  ...props(fieldChromeStyles.message, fieldChromeStyles.counter, invalid && fieldChromeStyles.messageError),
778
808
  children: countIn(locale, length, maxLength)
779
809
  }) : 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", {
810
+ $[23] = characterCount;
811
+ $[24] = invalid;
812
+ $[25] = length;
813
+ $[26] = locale;
814
+ $[27] = maxLength;
815
+ $[28] = t12;
816
+ } else t12 = $[28];
817
+ let t13;
818
+ if ($[29] !== described || $[30] !== t11 || $[31] !== t12 || $[32] !== t9) {
819
+ t13 = /* @__PURE__ */ jsxs("div", {
790
820
  ...t9,
791
821
  children: [
792
- t10,
822
+ t11,
793
823
  described,
794
- t11
824
+ t12
795
825
  ]
796
826
  });
797
- $[27] = described;
798
- $[28] = t10;
799
- $[29] = t11;
800
- $[30] = t9;
827
+ $[29] = described;
828
+ $[30] = t11;
801
829
  $[31] = t12;
802
- } else t12 = $[31];
803
- return t12;
830
+ $[32] = t9;
831
+ $[33] = t13;
832
+ } else t13 = $[33];
833
+ return t13;
804
834
  }
805
835
  /**
806
836
  * The same asterisk for a label that is not a field's own — a checkbox's, a