@kanso-labs/kanso-ui 0.40.2 → 0.40.4

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 (68) hide show
  1. package/dist/chip/styles.js +2 -2
  2. package/dist/chip/styles.js.map +1 -1
  3. package/dist/collection/styles.js +2 -1
  4. package/dist/collection/styles.js.map +1 -1
  5. package/dist/components/app-bar/index.js +11 -7
  6. package/dist/components/app-bar/index.js.map +1 -1
  7. package/dist/components/button/index.js +2 -0
  8. package/dist/components/button/index.js.map +1 -1
  9. package/dist/components/card/index.js +8 -1
  10. package/dist/components/card/index.js.map +1 -1
  11. package/dist/components/checkbox/index.js +3 -3
  12. package/dist/components/checkbox/index.js.map +1 -1
  13. package/dist/components/checkbox-group/index.js +1 -1
  14. package/dist/components/chip-group/index.js +1 -1
  15. package/dist/components/dialog/index.d.ts +5 -0
  16. package/dist/components/dialog/index.js +5 -0
  17. package/dist/components/dialog/index.js.map +1 -1
  18. package/dist/components/link/index.js +1 -0
  19. package/dist/components/link/index.js.map +1 -1
  20. package/dist/components/list-item/index.js +2 -1
  21. package/dist/components/list-item/index.js.map +1 -1
  22. package/dist/components/menu/index.d.ts +4 -1
  23. package/dist/components/menu/index.js +68 -10
  24. package/dist/components/menu/index.js.map +1 -1
  25. package/dist/components/popover/index.js +310 -93
  26. package/dist/components/popover/index.js.map +1 -1
  27. package/dist/components/progress-indicator/index.js +6 -6
  28. package/dist/components/progress-indicator/index.js.map +1 -1
  29. package/dist/components/radio-group/index.js +27 -38
  30. package/dist/components/radio-group/index.js.map +1 -1
  31. package/dist/components/segmented-button/index.d.ts +3 -1
  32. package/dist/components/segmented-button/index.js +33 -17
  33. package/dist/components/segmented-button/index.js.map +1 -1
  34. package/dist/components/select/index.js +1 -0
  35. package/dist/components/select/index.js.map +1 -1
  36. package/dist/components/sheet/index.d.ts +5 -0
  37. package/dist/components/sheet/index.js +6 -1
  38. package/dist/components/sheet/index.js.map +1 -1
  39. package/dist/components/snackbar/index.js +1 -1
  40. package/dist/components/snackbar/index.js.map +1 -1
  41. package/dist/components/text/index.js +1 -0
  42. package/dist/components/text/index.js.map +1 -1
  43. package/dist/control/index.js +54 -1
  44. package/dist/control/index.js.map +1 -1
  45. package/dist/control/styles.js +8 -2
  46. package/dist/control/styles.js.map +1 -1
  47. package/dist/field/index.js +183 -131
  48. package/dist/field/index.js.map +1 -1
  49. package/dist/field/styles.js +27 -1
  50. package/dist/field/styles.js.map +1 -1
  51. package/dist/indicator/index.js +6 -5
  52. package/dist/indicator/index.js.map +1 -1
  53. package/dist/indicator/styles.js +13 -2
  54. package/dist/indicator/styles.js.map +1 -1
  55. package/dist/mark/styles.js +3 -0
  56. package/dist/mark/styles.js.map +1 -1
  57. package/dist/navigation/styles.js +1 -1
  58. package/dist/navigation/styles.js.map +1 -1
  59. package/dist/render/content.js +16 -0
  60. package/dist/render/content.js.map +1 -0
  61. package/dist/row/index.js +5 -4
  62. package/dist/row/index.js.map +1 -1
  63. package/dist/row/styles.js +5 -1
  64. package/dist/row/styles.js.map +1 -1
  65. package/dist/styles/overlay.js +1 -0
  66. package/dist/styles/overlay.js.map +1 -1
  67. package/dist/styles.css +19 -3
  68. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import { props } from "../node_modules/@stylexjs/stylex/lib/es/stylex.js";
2
2
  import { mergeStatefulStyles, mergeStyles } from "../styles/merge.js";
3
3
  import { useMessages } from "../i18n/index.js";
4
- import { useInsideForm } from "./root.js";
5
4
  import { fieldChromeStyles, groupStyles } from "./styles.js";
5
+ import { useInsideForm } from "./root.js";
6
6
  import { c } from "react/compiler-runtime";
7
7
  import { createContext, useContext } from "react";
8
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -35,9 +35,10 @@ const BOX_CONTROLS = {
35
35
  }
36
36
  };
37
37
  const BoxContext = createContext(OUTSIDE_BOX);
38
- function boxContent(label, children, floatingLabel, isPopulated, isRequired, leading, multiline, trailing, trigger, variant) {
38
+ function boxContent(label, children, floatingLabel, isFocused, isPopulated, isRequired, leading, multiline, trailing, trigger, variant) {
39
39
  return (state) => /* @__PURE__ */ jsx(BoxContent, {
40
40
  floatingLabel,
41
+ isFocused,
41
42
  isPopulated,
42
43
  isRequired,
43
44
  label,
@@ -58,29 +59,30 @@ function boxContent(label, children, floatingLabel, isPopulated, isRequired, lea
58
59
  * for them. See the outlined variant's note above.
59
60
  */
60
61
  function BoxContent(t0) {
61
- const $ = c(42);
62
- const { children, floatingLabel, isPopulated, isRequired, label, leading, multiline, state, trailing, trigger, variant } = t0;
62
+ const $ = c(45);
63
+ const { children, floatingLabel, isFocused, isPopulated, isRequired, label, leading, multiline, state, trailing, trigger, variant } = t0;
63
64
  const read = useFieldPopulated();
64
65
  const populated = isPopulated ?? read;
65
66
  const outlined = variant === "outlined";
66
- const floated = !floatingLabel || state.isFocusWithin || populated;
67
+ const focused = state.isFocusWithin || isFocused;
68
+ const floated = !floatingLabel || focused || populated;
67
69
  const t1 = BOX_CONTROLS[variant][floatingLabel ? "floating" : "fixed"];
68
70
  let t2;
69
- if ($[0] !== floated || $[1] !== isRequired || $[2] !== label || $[3] !== leading || $[4] !== outlined || $[5] !== state.isFocusWithin || $[6] !== trailing) {
71
+ if ($[0] !== floated || $[1] !== focused || $[2] !== isRequired || $[3] !== label || $[4] !== leading || $[5] !== outlined || $[6] !== trailing) {
70
72
  t2 = outlined ? /* @__PURE__ */ jsx("fieldset", {
71
73
  "aria-hidden": "true",
72
- ...props(fieldChromeStyles.outline, leading !== void 0 && fieldChromeStyles.outlineLeading, trailing !== void 0 && fieldChromeStyles.outlineTrailing, state.isFocusWithin && fieldChromeStyles.outlineFocused),
74
+ ...props(fieldChromeStyles.outline, leading !== void 0 && fieldChromeStyles.outlineLeading, trailing !== void 0 && fieldChromeStyles.outlineTrailing, focused && fieldChromeStyles.outlineFocused),
73
75
  children: /* @__PURE__ */ jsx("legend", {
74
76
  ...props(fieldChromeStyles.outlineNotch, floated && fieldChromeStyles.outlineNotchOpen),
75
77
  children: floated ? /* @__PURE__ */ jsxs(Fragment$1, { children: [label, isRequired ? REQUIRED_MARK : null] }) : null
76
78
  })
77
79
  }) : null;
78
80
  $[0] = floated;
79
- $[1] = isRequired;
80
- $[2] = label;
81
- $[3] = leading;
82
- $[4] = outlined;
83
- $[5] = state.isFocusWithin;
81
+ $[1] = focused;
82
+ $[2] = isRequired;
83
+ $[3] = label;
84
+ $[4] = leading;
85
+ $[5] = outlined;
84
86
  $[6] = trailing;
85
87
  $[7] = t2;
86
88
  } else t2 = $[7];
@@ -104,76 +106,83 @@ function BoxContent(t0) {
104
106
  $[15] = t4;
105
107
  } else t4 = $[15];
106
108
  let t5;
107
- if ($[16] !== floated || $[17] !== floatingLabel || $[18] !== outlined) {
108
- t5 = props(fieldChromeStyles.boxLabel, floatingLabel && floated && fieldChromeStyles.boxLabelFloated, outlined && fieldChromeStyles.boxLabelOutlined, outlined && floated && fieldChromeStyles.boxLabelOutlinedFloated);
109
- $[16] = floated;
110
- $[17] = floatingLabel;
111
- $[18] = outlined;
112
- $[19] = t5;
113
- } else t5 = $[19];
109
+ if ($[16] !== focused || $[17] !== state) {
110
+ t5 = withFocus(state, focused);
111
+ $[16] = focused;
112
+ $[17] = state;
113
+ $[18] = t5;
114
+ } else t5 = $[18];
114
115
  let t6;
115
- if ($[20] !== isRequired || $[21] !== label || $[22] !== state || $[23] !== t5) {
116
- t6 = /* @__PURE__ */ jsx(FieldLabel, {
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];
123
+ let t7;
124
+ if ($[23] !== isRequired || $[24] !== label || $[25] !== t5 || $[26] !== t6) {
125
+ t7 = /* @__PURE__ */ jsx(FieldLabel, {
117
126
  isRequired,
118
- state,
119
- ...t5,
127
+ state: t5,
128
+ ...t6,
120
129
  children: label
121
130
  });
122
- $[20] = isRequired;
123
- $[21] = label;
124
- $[22] = state;
125
- $[23] = t5;
126
- $[24] = t6;
127
- } else t6 = $[24];
128
- let t7;
129
- if ($[25] !== children || $[26] !== t4 || $[27] !== t6) {
130
- t7 = /* @__PURE__ */ jsxs("div", {
131
+ $[23] = isRequired;
132
+ $[24] = label;
133
+ $[25] = t5;
134
+ $[26] = t6;
135
+ $[27] = t7;
136
+ } else t7 = $[27];
137
+ let t8;
138
+ if ($[28] !== children || $[29] !== t4 || $[30] !== t7) {
139
+ t8 = /* @__PURE__ */ jsxs("div", {
131
140
  ...t4,
132
- children: [t6, children]
141
+ children: [t7, children]
133
142
  });
134
- $[25] = children;
135
- $[26] = t4;
136
- $[27] = t6;
137
- $[28] = t7;
138
- } else t7 = $[28];
139
- let t8;
140
- if ($[29] !== multiline || $[30] !== outlined || $[31] !== state.isDisabled || $[32] !== state.isInvalid || $[33] !== trailing) {
141
- t8 = trailing === void 0 ? null : /* @__PURE__ */ jsx("span", {
143
+ $[28] = children;
144
+ $[29] = t4;
145
+ $[30] = t7;
146
+ $[31] = t8;
147
+ } else t8 = $[31];
148
+ let t9;
149
+ if ($[32] !== multiline || $[33] !== outlined || $[34] !== state.isDisabled || $[35] !== state.isInvalid || $[36] !== trailing) {
150
+ t9 = trailing === void 0 ? null : /* @__PURE__ */ jsx("span", {
142
151
  ...props(fieldChromeStyles.icon, multiline && fieldChromeStyles.iconMultiline, outlined && fieldChromeStyles.iconOutlined, state.isInvalid && fieldChromeStyles.iconError, state.isDisabled && fieldChromeStyles.iconDisabled),
143
152
  children: trailing
144
153
  });
145
- $[29] = multiline;
146
- $[30] = outlined;
147
- $[31] = state.isDisabled;
148
- $[32] = state.isInvalid;
149
- $[33] = trailing;
150
- $[34] = t8;
151
- } else t8 = $[34];
152
- let t9;
153
- if ($[35] !== t1 || $[36] !== t2 || $[37] !== t3 || $[38] !== t7 || $[39] !== t8 || $[40] !== trigger) {
154
- t9 = /* @__PURE__ */ jsxs(BoxContext, {
154
+ $[32] = multiline;
155
+ $[33] = outlined;
156
+ $[34] = state.isDisabled;
157
+ $[35] = state.isInvalid;
158
+ $[36] = trailing;
159
+ $[37] = t9;
160
+ } else t9 = $[37];
161
+ let t10;
162
+ if ($[38] !== t1 || $[39] !== t2 || $[40] !== t3 || $[41] !== t8 || $[42] !== t9 || $[43] !== trigger) {
163
+ t10 = /* @__PURE__ */ jsxs(BoxContext, {
155
164
  value: t1,
156
165
  children: [
157
166
  t2,
158
167
  trigger,
159
168
  t3,
160
- t7,
161
- t8
169
+ t8,
170
+ t9
162
171
  ]
163
172
  });
164
- $[35] = t1;
165
- $[36] = t2;
166
- $[37] = t3;
167
- $[38] = t7;
168
- $[39] = t8;
169
- $[40] = trigger;
170
- $[41] = t9;
171
- } else t9 = $[41];
172
- return t9;
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];
181
+ return t10;
173
182
  }
174
- function boxStyles(floatingLabel, multiline, leading, trailing, variant) {
183
+ function boxStyles(floatingLabel, isFocused, multiline, leading, trailing, variant) {
175
184
  const outlined = variant === "outlined";
176
- 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), state.isDisabled && (outlined ? fieldChromeStyles.boxOutlinedDisabled : fieldChromeStyles.boxDisabled));
185
+ 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));
177
186
  }
178
187
  /**
179
188
  * The box a control sits in, filled or outlined, with its label. React
@@ -184,10 +193,11 @@ function boxStyles(floatingLabel, multiline, leading, trailing, variant) {
184
193
  * on a button rather than an input — passes the two states itself.
185
194
  */
186
195
  function FieldBox(t0) {
187
- const $ = c(30);
196
+ const $ = c(34);
188
197
  let T0;
189
198
  let children;
190
199
  let floatingLabel;
200
+ let isFocused;
191
201
  let isPopulated;
192
202
  let isRequired;
193
203
  let label;
@@ -195,83 +205,94 @@ function FieldBox(t0) {
195
205
  let multiline;
196
206
  let t1;
197
207
  let t2;
208
+ let t3;
198
209
  let trailing;
199
210
  let trigger;
200
211
  let variant;
201
212
  if ($[0] !== t0) {
202
- const { children: t3, floatingLabel: t4, isPopulated: t5, isRequired: t6, label: t7, leading: t8, multiline: t9, trailing: t10, trigger: t11, variant: t12, ...props } = t0;
203
- children = t3;
204
- isPopulated = t5;
205
- label = t7;
206
- leading = t8;
207
- trailing = t10;
208
- trigger = t11;
209
- floatingLabel = t4 === void 0 ? true : t4;
210
- isRequired = t6 === void 0 ? false : t6;
211
- multiline = t9 === void 0 ? false : t9;
212
- variant = t12 === void 0 ? "filled" : t12;
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;
214
+ 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;
213
225
  T0 = Group;
214
226
  t1 = props;
215
- t2 = mergeStatefulStyles(boxStyles(floatingLabel, multiline, leading !== void 0, trailing !== void 0, variant), props);
227
+ t2 = trigger === void 0 ? focusesControl(props.onPointerDown) : props.onPointerDown;
228
+ t3 = mergeStatefulStyles(boxStyles(floatingLabel, isFocused, multiline, leading !== void 0, trailing !== void 0, variant), props);
216
229
  $[0] = t0;
217
230
  $[1] = T0;
218
231
  $[2] = children;
219
232
  $[3] = floatingLabel;
220
- $[4] = isPopulated;
221
- $[5] = isRequired;
222
- $[6] = label;
223
- $[7] = leading;
224
- $[8] = multiline;
225
- $[9] = t1;
226
- $[10] = t2;
227
- $[11] = trailing;
228
- $[12] = trigger;
229
- $[13] = variant;
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;
230
245
  } else {
231
246
  T0 = $[1];
232
247
  children = $[2];
233
248
  floatingLabel = $[3];
234
- isPopulated = $[4];
235
- isRequired = $[5];
236
- label = $[6];
237
- leading = $[7];
238
- multiline = $[8];
239
- t1 = $[9];
240
- t2 = $[10];
241
- trailing = $[11];
242
- trigger = $[12];
243
- variant = $[13];
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];
244
261
  }
245
- let t3;
246
- if ($[14] !== children || $[15] !== floatingLabel || $[16] !== isPopulated || $[17] !== isRequired || $[18] !== label || $[19] !== leading || $[20] !== multiline || $[21] !== trailing || $[22] !== trigger || $[23] !== variant) {
247
- t3 = boxContent(label, children, floatingLabel, isPopulated, isRequired, leading, multiline, trailing, trigger, variant);
248
- $[14] = children;
249
- $[15] = floatingLabel;
250
- $[16] = isPopulated;
251
- $[17] = isRequired;
252
- $[18] = label;
253
- $[19] = leading;
254
- $[20] = multiline;
255
- $[21] = trailing;
256
- $[22] = trigger;
257
- $[23] = variant;
258
- $[24] = t3;
259
- } else t3 = $[24];
260
262
  let t4;
261
- if ($[25] !== T0 || $[26] !== t1 || $[27] !== t2 || $[28] !== t3) {
262
- t4 = /* @__PURE__ */ jsx(T0, {
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];
278
+ let t5;
279
+ if ($[28] !== T0 || $[29] !== t1 || $[30] !== t2 || $[31] !== t3 || $[32] !== t4) {
280
+ t5 = /* @__PURE__ */ jsx(T0, {
263
281
  ...t1,
264
- ...t2,
265
- children: t3
282
+ onPointerDown: t2,
283
+ ...t3,
284
+ children: t4
266
285
  });
267
- $[25] = T0;
268
- $[26] = t1;
269
- $[27] = t2;
270
- $[28] = t3;
271
- $[29] = t4;
272
- } else t4 = $[29];
273
- return t4;
286
+ $[28] = T0;
287
+ $[29] = t1;
288
+ $[30] = t2;
289
+ $[31] = t3;
290
+ $[32] = t4;
291
+ $[33] = t5;
292
+ } else t5 = $[33];
293
+ return t5;
274
294
  }
295
+ const PRESSABLE = "a, button, input, textarea, select, [role=\"button\"], [contenteditable=\"true\"]";
275
296
  /**
276
297
  * A field's text control, in a {@link FieldBox} or on its own. React Aria's
277
298
  * `Input`, which takes its label association, value and validation from the
@@ -405,7 +426,7 @@ function FieldSegments(t0) {
405
426
  */
406
427
  function FieldTextArea(t0) {
407
428
  const $ = c(17);
408
- const { autosize: t1, placeholder, ...props$2 } = t0;
429
+ const { autosize: t1, placeholder, ...props$4 } = t0;
409
430
  const autosize = t1 === void 0 ? false : t1;
410
431
  const box = useContext(BoxContext);
411
432
  const context = useSlottedContext(TextAreaContext);
@@ -419,16 +440,16 @@ function FieldTextArea(t0) {
419
440
  $[1] = box;
420
441
  $[2] = t3;
421
442
  } else t3 = $[2];
422
- const t4 = mergeStatefulStyles(t3, props$2);
443
+ const t4 = mergeStatefulStyles(t3, props$4);
423
444
  let t5;
424
- if ($[3] !== T0 || $[4] !== props$2 || $[5] !== t2 || $[6] !== t4) {
445
+ if ($[3] !== T0 || $[4] !== props$4 || $[5] !== t2 || $[6] !== t4) {
425
446
  t5 = /* @__PURE__ */ jsx(T0, {
426
447
  placeholder: t2,
427
- ...props$2,
448
+ ...props$4,
428
449
  ...t4
429
450
  });
430
451
  $[3] = T0;
431
- $[4] = props$2;
452
+ $[4] = props$4;
432
453
  $[5] = t2;
433
454
  $[6] = t4;
434
455
  $[7] = t5;
@@ -535,6 +556,31 @@ function FieldValue(t0) {
535
556
  } else t4 = $[2];
536
557
  return t4;
537
558
  }
559
+ function focusedStyle(outlined, invalid) {
560
+ if (outlined) return invalid ? fieldChromeStyles.boxOutlinedErrorFocused : fieldChromeStyles.boxOutlinedFocused;
561
+ return invalid ? fieldChromeStyles.boxErrorFocused : fieldChromeStyles.boxFocused;
562
+ }
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
+ }
538
584
  function returnToStart(event) {
539
585
  if (!event.currentTarget.contains(event.relatedTarget)) event.currentTarget.scrollLeft = 0;
540
586
  }
@@ -546,6 +592,12 @@ function useFieldPopulated() {
546
592
  const value = input?.value ?? textArea?.value ?? "";
547
593
  return String(value).length > 0;
548
594
  }
595
+ function withFocus(state, focused) {
596
+ return focused === state.isFocusWithin ? state : {
597
+ ...state,
598
+ isFocusWithin: focused
599
+ };
600
+ }
549
601
  /**
550
602
  * Whether the control in this box is holding anything, read off React
551
603
  * Aria's context for whichever control the field renders. The filled box
@@ -570,7 +622,7 @@ function FieldLabel(t0) {
570
622
  let t1;
571
623
  let t2;
572
624
  if ($[0] !== t0) {
573
- const { children: t3, isRequired: t4, state: t5, variant: t6, ...props$4 } = t0;
625
+ const { children: t3, isRequired: t4, state: t5, variant: t6, ...props$2 } = t0;
574
626
  children = t3;
575
627
  isRequired = t4 === void 0 ? false : t4;
576
628
  const state = t5 === void 0 ? NO_STATE : t5;
@@ -580,8 +632,8 @@ function FieldLabel(t0) {
580
632
  const isFocusWithin = t8 === void 0 ? false : t8;
581
633
  const isInvalid = t9 === void 0 ? false : t9;
582
634
  T0 = Label;
583
- t1 = props$4;
584
- t2 = mergeStyles(props(fieldChromeStyles.label, variant === "group" && groupStyles.label, isDisabled && fieldChromeStyles.labelDisabled, isInvalid && fieldChromeStyles.labelError, !isDisabled && !isInvalid && isFocusWithin && fieldChromeStyles.labelFocused), props$4);
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);
585
637
  $[0] = t0;
586
638
  $[1] = T0;
587
639
  $[2] = children;