@kanso-labs/react-native-kanso-ui 0.9.0 → 0.10.0

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 (196) hide show
  1. package/README.md +4 -3
  2. package/dist/autocomplete/index.js +15 -1
  3. package/dist/autocomplete/index.js.map +1 -1
  4. package/dist/button/group.d.ts +5 -0
  5. package/dist/button/group.js +115 -0
  6. package/dist/button/group.js.map +1 -0
  7. package/dist/button/index.d.ts +4 -1
  8. package/dist/button/index.js +44 -22
  9. package/dist/button/index.js.map +1 -1
  10. package/dist/button/slots.js +2 -1
  11. package/dist/button/slots.js.map +1 -1
  12. package/dist/calendar/index.js +351 -182
  13. package/dist/calendar/index.js.map +1 -1
  14. package/dist/calendar/styles.js +33 -2
  15. package/dist/calendar/styles.js.map +1 -1
  16. package/dist/carousel/arrangement.d.ts +5 -0
  17. package/dist/carousel/arrangement.js +123 -0
  18. package/dist/carousel/arrangement.js.map +1 -0
  19. package/dist/chequer/index.js +95 -0
  20. package/dist/chequer/index.js.map +1 -0
  21. package/dist/collection/index.d.ts +157 -0
  22. package/dist/collection/index.js +1331 -0
  23. package/dist/collection/index.js.map +1 -0
  24. package/dist/color-thumb/index.js +56 -0
  25. package/dist/color-thumb/index.js.map +1 -0
  26. package/dist/components/button/index.d.ts +4 -2
  27. package/dist/components/button/index.js +227 -188
  28. package/dist/components/button/index.js.map +1 -1
  29. package/dist/components/button-group/index.d.ts +87 -0
  30. package/dist/components/button-group/index.js +275 -0
  31. package/dist/components/button-group/index.js.map +1 -0
  32. package/dist/components/calendar/index.d.ts +11 -3
  33. package/dist/components/calendar/index.js +60 -45
  34. package/dist/components/calendar/index.js.map +1 -1
  35. package/dist/components/carousel/index.d.ts +72 -0
  36. package/dist/components/carousel/index.js +496 -0
  37. package/dist/components/carousel/index.js.map +1 -0
  38. package/dist/components/checkbox-group/index.d.ts +3 -4
  39. package/dist/components/checkbox-group/index.js +1 -1
  40. package/dist/components/checkbox-group/index.js.map +1 -1
  41. package/dist/components/color-area/index.d.ts +85 -0
  42. package/dist/components/color-area/index.js +630 -0
  43. package/dist/components/color-area/index.js.map +1 -0
  44. package/dist/components/color-field/index.d.ts +144 -0
  45. package/dist/components/color-field/index.js +516 -0
  46. package/dist/components/color-field/index.js.map +1 -0
  47. package/dist/components/color-picker/index.d.ts +74 -0
  48. package/dist/components/color-picker/index.js +317 -0
  49. package/dist/components/color-picker/index.js.map +1 -0
  50. package/dist/components/color-slider/index.d.ts +82 -0
  51. package/dist/components/color-slider/index.js +456 -0
  52. package/dist/components/color-slider/index.js.map +1 -0
  53. package/dist/components/color-swatch/index.d.ts +46 -0
  54. package/dist/components/color-swatch/index.js +127 -0
  55. package/dist/components/color-swatch/index.js.map +1 -0
  56. package/dist/components/color-swatch-picker/index.d.ts +81 -0
  57. package/dist/components/color-swatch-picker/index.js +287 -0
  58. package/dist/components/color-swatch-picker/index.js.map +1 -0
  59. package/dist/components/color-wheel/index.d.ts +71 -0
  60. package/dist/components/color-wheel/index.js +407 -0
  61. package/dist/components/color-wheel/index.js.map +1 -0
  62. package/dist/components/combo-box/index.d.ts +193 -0
  63. package/dist/components/combo-box/index.js +616 -0
  64. package/dist/components/combo-box/index.js.map +1 -0
  65. package/dist/components/date-field/index.d.ts +120 -0
  66. package/dist/components/date-field/index.js +111 -0
  67. package/dist/components/date-field/index.js.map +1 -0
  68. package/dist/components/date-picker/index.d.ts +130 -0
  69. package/dist/components/date-picker/index.js +310 -0
  70. package/dist/components/date-picker/index.js.map +1 -0
  71. package/dist/components/date-range-picker/index.d.ts +139 -0
  72. package/dist/components/date-range-picker/index.js +421 -0
  73. package/dist/components/date-range-picker/index.js.map +1 -0
  74. package/dist/components/disclosure/index.d.ts +94 -0
  75. package/dist/components/disclosure/index.js +365 -0
  76. package/dist/components/disclosure/index.js.map +1 -0
  77. package/dist/components/disclosure-group/index.d.ts +61 -0
  78. package/dist/components/disclosure-group/index.js +100 -0
  79. package/dist/components/disclosure-group/index.js.map +1 -0
  80. package/dist/components/drop-zone/index.d.ts +113 -0
  81. package/dist/components/drop-zone/index.js +304 -0
  82. package/dist/components/drop-zone/index.js.map +1 -0
  83. package/dist/components/fab/index.d.ts +1 -1
  84. package/dist/components/fab/index.js +91 -76
  85. package/dist/components/fab/index.js.map +1 -1
  86. package/dist/components/form/index.d.ts +3 -2
  87. package/dist/components/form/index.js.map +1 -1
  88. package/dist/components/icon-button/index.d.ts +4 -2
  89. package/dist/components/icon-button/index.js +204 -171
  90. package/dist/components/icon-button/index.js.map +1 -1
  91. package/dist/components/list/index.d.ts +15 -158
  92. package/dist/components/list/index.js +21 -1047
  93. package/dist/components/list/index.js.map +1 -1
  94. package/dist/components/list-box/index.d.ts +73 -0
  95. package/dist/components/list-box/index.js +82 -0
  96. package/dist/components/list-box/index.js.map +1 -0
  97. package/dist/components/loading-indicator/index.d.ts +32 -0
  98. package/dist/components/loading-indicator/index.js +174 -0
  99. package/dist/components/loading-indicator/index.js.map +1 -0
  100. package/dist/components/navigation-tree/index.d.ts +117 -0
  101. package/dist/components/navigation-tree/index.js +135 -0
  102. package/dist/components/navigation-tree/index.js.map +1 -0
  103. package/dist/components/number-field/index.js +132 -143
  104. package/dist/components/number-field/index.js.map +1 -1
  105. package/dist/components/range-calendar/index.d.ts +69 -0
  106. package/dist/components/range-calendar/index.js +144 -0
  107. package/dist/components/range-calendar/index.js.map +1 -0
  108. package/dist/components/search-view/index.d.ts +78 -0
  109. package/dist/components/search-view/index.js +570 -0
  110. package/dist/components/search-view/index.js.map +1 -0
  111. package/dist/components/select/index.d.ts +152 -0
  112. package/dist/components/select/index.js +419 -0
  113. package/dist/components/select/index.js.map +1 -0
  114. package/dist/components/slider/index.d.ts +111 -0
  115. package/dist/components/slider/index.js +673 -0
  116. package/dist/components/slider/index.js.map +1 -0
  117. package/dist/components/split-button/index.d.ts +77 -0
  118. package/dist/components/split-button/index.js +354 -0
  119. package/dist/components/split-button/index.js.map +1 -0
  120. package/dist/components/tabs/index.d.ts +196 -0
  121. package/dist/components/tabs/index.js +1137 -0
  122. package/dist/components/tabs/index.js.map +1 -0
  123. package/dist/components/time-field/index.d.ts +43 -0
  124. package/dist/components/time-field/index.js +107 -0
  125. package/dist/components/time-field/index.js.map +1 -0
  126. package/dist/components/time-picker/index.d.ts +65 -0
  127. package/dist/components/time-picker/index.js +1168 -0
  128. package/dist/components/time-picker/index.js.map +1 -0
  129. package/dist/components/tooltip/index.d.ts +101 -0
  130. package/dist/components/tooltip/index.js +223 -0
  131. package/dist/components/tooltip/index.js.map +1 -0
  132. package/dist/components/tree/index.d.ts +112 -0
  133. package/dist/components/tree/index.js +157 -0
  134. package/dist/components/tree/index.js.map +1 -0
  135. package/dist/disclosure/chevron.js +75 -0
  136. package/dist/disclosure/chevron.js.map +1 -0
  137. package/dist/disclosure/index.js +7 -0
  138. package/dist/disclosure/index.js.map +1 -0
  139. package/dist/drop/index.d.ts +54 -0
  140. package/dist/drop/index.js +161 -0
  141. package/dist/drop/index.js.map +1 -0
  142. package/dist/field/chevron.js +74 -0
  143. package/dist/field/chevron.js.map +1 -0
  144. package/dist/field/index.d.ts +2 -1
  145. package/dist/field/index.js +310 -154
  146. package/dist/field/index.js.map +1 -1
  147. package/dist/field/styles.js +9 -0
  148. package/dist/field/styles.js.map +1 -1
  149. package/dist/files/index.d.ts +18 -0
  150. package/dist/files/index.js +107 -0
  151. package/dist/files/index.js.map +1 -0
  152. package/dist/form/index.d.ts +5 -2
  153. package/dist/form/index.js +64 -85
  154. package/dist/form/index.js.map +1 -1
  155. package/dist/glyphs/index.js +92 -1
  156. package/dist/glyphs/index.js.map +1 -1
  157. package/dist/i18n/index.js +20 -1
  158. package/dist/i18n/index.js.map +1 -1
  159. package/dist/i18n/messages.js +1394 -34
  160. package/dist/i18n/messages.js.map +1 -1
  161. package/dist/index.d.ts +35 -3
  162. package/dist/index.js +34 -3
  163. package/dist/indicator/paths.js +23 -1
  164. package/dist/indicator/paths.js.map +1 -1
  165. package/dist/modal/index.js +92 -77
  166. package/dist/modal/index.js.map +1 -1
  167. package/dist/number/keyboard.js +16 -0
  168. package/dist/number/keyboard.js.map +1 -0
  169. package/dist/overlay/anchored.js +68 -38
  170. package/dist/overlay/anchored.js.map +1 -1
  171. package/dist/overlay/keyboard.js +57 -0
  172. package/dist/overlay/keyboard.js.map +1 -0
  173. package/dist/overlay/panel.js +173 -19
  174. package/dist/overlay/panel.js.map +1 -1
  175. package/dist/overlay/placement.js +13 -1
  176. package/dist/overlay/placement.js.map +1 -1
  177. package/dist/picker/index.js +322 -0
  178. package/dist/picker/index.js.map +1 -0
  179. package/dist/press/index.d.ts +2 -0
  180. package/dist/press/index.js +102 -100
  181. package/dist/press/index.js.map +1 -1
  182. package/dist/row/index.js +77 -69
  183. package/dist/row/index.js.map +1 -1
  184. package/dist/row/styles.js +13 -2
  185. package/dist/row/styles.js.map +1 -1
  186. package/dist/segments/field.js +277 -0
  187. package/dist/segments/field.js.map +1 -0
  188. package/dist/segments/index.js +574 -0
  189. package/dist/segments/index.js.map +1 -0
  190. package/dist/segments/styles.js +24 -0
  191. package/dist/segments/styles.js.map +1 -0
  192. package/dist/slider/index.js +145 -0
  193. package/dist/slider/index.js.map +1 -0
  194. package/dist/swatch/index.js +56 -0
  195. package/dist/swatch/index.js.map +1 -0
  196. package/package.json +11 -2
@@ -10,6 +10,7 @@ import { limitFor } from "../i18n/index.js";
10
10
  import { useLocaleOf } from "../i18n/provider.js";
11
11
  import { useInsideForm } from "../form/index.js";
12
12
  import { fieldStylesOf } from "./styles.js";
13
+ import { FieldChevron } from "./chevron.js";
13
14
  import { c } from "react/compiler-runtime";
14
15
  import { AccessibilityInfo, Platform, Pressable, Text, TextInput, View, useWindowDimensions } from "react-native";
15
16
  import Animated, { Easing, useAnimatedStyle, useDerivedValue, useReducedMotion, withTiming } from "react-native-reanimated";
@@ -26,6 +27,7 @@ const OUTSIDE_BOX = {
26
27
  underLabel: false
27
28
  };
28
29
  const BoxContext = createContext(OUTSIDE_BOX);
30
+ const SegmentsLineContext = createContext(false);
29
31
  const NO_PARTS = [];
30
32
  /**
31
33
  * How a field's control is described by the line under it: the error while
@@ -50,12 +52,13 @@ function describedBy(id, { characterLimitLabel, description, error, locale, maxL
50
52
  }
51
53
  /**
52
54
  * The box a control sits in, filled or outlined, with its label. Pressed
53
- * anywhere, it focuses its control. The states it draws are handed to it,
54
- * since the field around it is what knows them.
55
+ * anywhere, it focuses its control, or runs its `trigger` where the box is
56
+ * the control itself. The states it draws are handed to it, since the field
57
+ * around it is what knows them.
55
58
  */
56
59
  function FieldBox(t0) {
57
- const $ = c(72);
58
- const { children, control, end, floatingLabel: t1, isDisabled: t2, isFocused: t3, isInvalid: t4, isPopulated: t5, isRequired: t6, label, leading, trailing, variant: t7 } = t0;
60
+ const $ = c(77);
61
+ const { children, control, end, floatingLabel: t1, isDisabled: t2, isFocused: t3, isInvalid: t4, isPopulated: t5, isRequired: t6, label, leading, ref, trailing, trigger, variant: t7 } = t0;
59
62
  const floatingLabel = t1 === void 0 ? true : t1;
60
63
  const isDisabled = t2 === void 0 ? false : t2;
61
64
  const isFocused = t3 === void 0 ? false : t3;
@@ -130,18 +133,23 @@ function FieldBox(t0) {
130
133
  } else t13 = $[20];
131
134
  const disabledContent = t13;
132
135
  const T0 = Pressable;
133
- const t14 = false;
134
- const t15 = false;
135
- const t16 = feedback.handlers.onHoverIn;
136
- const t17 = feedback.handlers.onHoverOut;
137
- let t18;
138
- if ($[21] !== control) {
139
- t18 = focusOf(control);
140
- $[21] = control;
141
- $[22] = t18;
142
- } else t18 = $[22];
143
- const t19 = composeStyles(styles.box, leading === void 0 ? void 0 : styles.boxLeading, trailing === void 0 ? void 0 : styles.boxTrailing, outlined ? styles.boxOutlined : void 0, isDisabled && !outlined ? styles.boxDisabled : void 0, minHeightOf(outlined ? 2 * spacing.lg + typography.bodyLargeLineHeight * fontScale : 2 * spacing.sm + (typography.bodySmallLineHeight + typography.bodyLargeLineHeight) * fontScale));
144
- const t20 = outlined ? /* @__PURE__ */ jsxs(View, {
136
+ let t14;
137
+ if ($[21] !== trigger) {
138
+ t14 = trigger === void 0 ? NOT_A_CONTROL : triggerOf(trigger);
139
+ $[21] = trigger;
140
+ $[22] = t14;
141
+ } else t14 = $[22];
142
+ const t15 = feedback.handlers.onHoverIn;
143
+ const t16 = feedback.handlers.onHoverOut;
144
+ let t17;
145
+ if ($[23] !== control || $[24] !== trigger?.onPress) {
146
+ t17 = trigger?.onPress ?? focusOf(control);
147
+ $[23] = control;
148
+ $[24] = trigger?.onPress;
149
+ $[25] = t17;
150
+ } else t17 = $[25];
151
+ const t18 = composeStyles(styles.box, trigger === void 0 ? void 0 : styles.boxTrigger, leading === void 0 ? void 0 : styles.boxLeading, trailing === void 0 ? void 0 : styles.boxTrailing, outlined ? styles.boxOutlined : void 0, isDisabled && !outlined ? styles.boxDisabled : void 0, minHeightOf(outlined ? 2 * spacing.lg + typography.bodyLargeLineHeight * fontScale : 2 * spacing.sm + (typography.bodySmallLineHeight + typography.bodyLargeLineHeight) * fontScale));
152
+ const t19 = outlined ? /* @__PURE__ */ jsxs(View, {
145
153
  "aria-hidden": true,
146
154
  style: styles.outline,
147
155
  children: [
@@ -179,25 +187,25 @@ function FieldBox(t0) {
179
187
  style: styles.indicator,
180
188
  width: rule.width
181
189
  })] });
182
- let t21;
183
- if ($[23] !== colors.onSurfaceVariant || $[24] !== disabledContent || $[25] !== isDisabled || $[26] !== leading || $[27] !== styles.icon) {
184
- t21 = leading === void 0 ? null : /* @__PURE__ */ jsx(View, {
190
+ let t20;
191
+ if ($[26] !== colors.onSurfaceVariant || $[27] !== disabledContent || $[28] !== isDisabled || $[29] !== leading || $[30] !== styles.icon) {
192
+ t20 = leading === void 0 ? null : /* @__PURE__ */ jsx(View, {
185
193
  style: styles.icon,
186
194
  children: /* @__PURE__ */ jsx(IconStyleContext, {
187
195
  value: iconStyleOf(isDisabled ? disabledContent : colors.onSurfaceVariant),
188
196
  children: leading
189
197
  })
190
198
  });
191
- $[23] = colors.onSurfaceVariant;
192
- $[24] = disabledContent;
193
- $[25] = isDisabled;
194
- $[26] = leading;
195
- $[27] = styles.icon;
196
- $[28] = t21;
197
- } else t21 = $[28];
198
- let t22;
199
- if ($[29] !== floated || $[30] !== floatingLabel || $[31] !== isDisabled || $[32] !== isFocused || $[33] !== isInvalid || $[34] !== isRequired || $[35] !== label || $[36] !== variant) {
200
- t22 = /* @__PURE__ */ jsx(BoxLabel, {
199
+ $[26] = colors.onSurfaceVariant;
200
+ $[27] = disabledContent;
201
+ $[28] = isDisabled;
202
+ $[29] = leading;
203
+ $[30] = styles.icon;
204
+ $[31] = t20;
205
+ } else t20 = $[31];
206
+ let t21;
207
+ if ($[32] !== floated || $[33] !== floatingLabel || $[34] !== isDisabled || $[35] !== isFocused || $[36] !== isInvalid || $[37] !== isRequired || $[38] !== label || $[39] !== variant) {
208
+ t21 = /* @__PURE__ */ jsx(BoxLabel, {
201
209
  floated,
202
210
  floatingLabel,
203
211
  isDisabled,
@@ -207,107 +215,109 @@ function FieldBox(t0) {
207
215
  variant,
208
216
  children: label
209
217
  });
210
- $[29] = floated;
211
- $[30] = floatingLabel;
212
- $[31] = isDisabled;
213
- $[32] = isFocused;
214
- $[33] = isInvalid;
215
- $[34] = isRequired;
216
- $[35] = label;
217
- $[36] = variant;
218
- $[37] = t22;
219
- } else t22 = $[37];
220
- let t23;
221
- if ($[38] !== floatingLabel || $[39] !== isRequired || $[40] !== label || $[41] !== outlined || $[42] !== setNotch) {
222
- t23 = outlined ? /* @__PURE__ */ jsx(NotchMeasure, {
218
+ $[32] = floated;
219
+ $[33] = floatingLabel;
220
+ $[34] = isDisabled;
221
+ $[35] = isFocused;
222
+ $[36] = isInvalid;
223
+ $[37] = isRequired;
224
+ $[38] = label;
225
+ $[39] = variant;
226
+ $[40] = t21;
227
+ } else t21 = $[40];
228
+ let t22;
229
+ if ($[41] !== floatingLabel || $[42] !== isRequired || $[43] !== label || $[44] !== outlined || $[45] !== setNotch) {
230
+ t22 = outlined ? /* @__PURE__ */ jsx(NotchMeasure, {
223
231
  floatingLabel,
224
232
  isRequired,
225
233
  onMeasure: setNotch,
226
234
  children: label
227
235
  }) : null;
228
- $[38] = floatingLabel;
229
- $[39] = isRequired;
230
- $[40] = label;
231
- $[41] = outlined;
232
- $[42] = setNotch;
233
- $[43] = t23;
234
- } else t23 = $[43];
235
- let t24;
236
- if ($[44] !== boxControl || $[45] !== children) {
237
- t24 = /* @__PURE__ */ jsx(BoxContext, {
236
+ $[41] = floatingLabel;
237
+ $[42] = isRequired;
238
+ $[43] = label;
239
+ $[44] = outlined;
240
+ $[45] = setNotch;
241
+ $[46] = t22;
242
+ } else t22 = $[46];
243
+ let t23;
244
+ if ($[47] !== boxControl || $[48] !== children) {
245
+ t23 = /* @__PURE__ */ jsx(BoxContext, {
238
246
  value: boxControl,
239
247
  children
240
248
  });
241
- $[44] = boxControl;
242
- $[45] = children;
243
- $[46] = t24;
244
- } else t24 = $[46];
245
- let t25;
246
- if ($[47] !== styles.column || $[48] !== t22 || $[49] !== t23 || $[50] !== t24) {
247
- t25 = /* @__PURE__ */ jsxs(View, {
249
+ $[47] = boxControl;
250
+ $[48] = children;
251
+ $[49] = t23;
252
+ } else t23 = $[49];
253
+ let t24;
254
+ if ($[50] !== styles.column || $[51] !== t21 || $[52] !== t22 || $[53] !== t23) {
255
+ t24 = /* @__PURE__ */ jsxs(View, {
248
256
  style: styles.column,
249
257
  children: [
258
+ t21,
250
259
  t22,
251
- t23,
252
- t24
260
+ t23
253
261
  ]
254
262
  });
255
- $[47] = styles.column;
256
- $[48] = t22;
257
- $[49] = t23;
258
- $[50] = t24;
259
- $[51] = t25;
260
- } else t25 = $[51];
261
- let t26;
262
- if ($[52] !== colors.error || $[53] !== colors.onSurfaceVariant || $[54] !== disabledContent || $[55] !== isDisabled || $[56] !== isInvalid || $[57] !== styles.icon || $[58] !== trailing) {
263
- t26 = trailing === void 0 ? null : /* @__PURE__ */ jsx(View, {
263
+ $[50] = styles.column;
264
+ $[51] = t21;
265
+ $[52] = t22;
266
+ $[53] = t23;
267
+ $[54] = t24;
268
+ } else t24 = $[54];
269
+ let t25;
270
+ if ($[55] !== colors.error || $[56] !== colors.onSurfaceVariant || $[57] !== disabledContent || $[58] !== isDisabled || $[59] !== isInvalid || $[60] !== styles.icon || $[61] !== trailing) {
271
+ t25 = trailing === void 0 ? null : /* @__PURE__ */ jsx(View, {
264
272
  style: styles.icon,
265
273
  children: /* @__PURE__ */ jsx(IconStyleContext, {
266
274
  value: iconStyleOf(isDisabled ? disabledContent : isInvalid ? colors.error : colors.onSurfaceVariant),
267
275
  children: trailing
268
276
  })
269
277
  });
270
- $[52] = colors.error;
271
- $[53] = colors.onSurfaceVariant;
272
- $[54] = disabledContent;
273
- $[55] = isDisabled;
274
- $[56] = isInvalid;
275
- $[57] = styles.icon;
276
- $[58] = trailing;
277
- $[59] = t26;
278
- } else t26 = $[59];
279
- let t27;
280
- if ($[60] !== T0 || $[61] !== end || $[62] !== feedback.handlers.onHoverIn || $[63] !== feedback.handlers.onHoverOut || $[64] !== isDisabled || $[65] !== t18 || $[66] !== t19 || $[67] !== t20 || $[68] !== t21 || $[69] !== t25 || $[70] !== t26) {
281
- t27 = /* @__PURE__ */ jsxs(T0, {
282
- accessible: t14,
278
+ $[55] = colors.error;
279
+ $[56] = colors.onSurfaceVariant;
280
+ $[57] = disabledContent;
281
+ $[58] = isDisabled;
282
+ $[59] = isInvalid;
283
+ $[60] = styles.icon;
284
+ $[61] = trailing;
285
+ $[62] = t25;
286
+ } else t25 = $[62];
287
+ let t26;
288
+ if ($[63] !== T0 || $[64] !== end || $[65] !== feedback.handlers.onHoverIn || $[66] !== feedback.handlers.onHoverOut || $[67] !== isDisabled || $[68] !== ref || $[69] !== t14 || $[70] !== t17 || $[71] !== t18 || $[72] !== t19 || $[73] !== t20 || $[74] !== t24 || $[75] !== t25) {
289
+ t26 = /* @__PURE__ */ jsxs(T0, {
290
+ ...t14,
283
291
  disabled: isDisabled,
284
- focusable: t15,
285
- onHoverIn: t16,
286
- onHoverOut: t17,
287
- onPress: t18,
288
- style: t19,
292
+ onHoverIn: t15,
293
+ onHoverOut: t16,
294
+ onPress: t17,
295
+ ref,
296
+ style: t18,
289
297
  children: [
298
+ t19,
290
299
  t20,
291
- t21,
292
- t25,
300
+ t24,
293
301
  end,
294
- t26
302
+ t25
295
303
  ]
296
304
  });
297
- $[60] = T0;
298
- $[61] = end;
299
- $[62] = feedback.handlers.onHoverIn;
300
- $[63] = feedback.handlers.onHoverOut;
301
- $[64] = isDisabled;
302
- $[65] = t18;
303
- $[66] = t19;
304
- $[67] = t20;
305
- $[68] = t21;
306
- $[69] = t25;
307
- $[70] = t26;
308
- $[71] = t27;
309
- } else t27 = $[71];
310
- return t27;
305
+ $[63] = T0;
306
+ $[64] = end;
307
+ $[65] = feedback.handlers.onHoverIn;
308
+ $[66] = feedback.handlers.onHoverOut;
309
+ $[67] = isDisabled;
310
+ $[68] = ref;
311
+ $[69] = t14;
312
+ $[70] = t17;
313
+ $[71] = t18;
314
+ $[72] = t19;
315
+ $[73] = t20;
316
+ $[74] = t24;
317
+ $[75] = t25;
318
+ $[76] = t26;
319
+ } else t26 = $[76];
320
+ return t26;
311
321
  }
312
322
  /**
313
323
  * A field's text control, in a {@link FieldBox}, or in {@link FieldStates}
@@ -317,9 +327,10 @@ function FieldBox(t0) {
317
327
  * error role for its caret while the field has an error, and draws a
318
328
  * placeholder in the muted role.
319
329
  *
320
- * It is described by its prefix and suffix, ahead of what the field hands it
321
- * in `described`, so a reader hears the unit the value is read against as a
322
- * sighted one sees it beside the value: on iOS and Android as its hint, and
330
+ * It is described by what it holds chosen, its prefix and its suffix, ahead
331
+ * of what the field hands it in `described`, so a reader hears the options
332
+ * chosen beside the text and the unit the value is read against as a sighted
333
+ * one sees them on the value's line: on iOS and Android as its hint, and
323
334
  * under React Native Web through `aria-describedby`, which drops the hint.
324
335
  *
325
336
  * `multiline` makes it a text area, `rows` lines of body large tall at the
@@ -332,7 +343,7 @@ function FieldBox(t0) {
332
343
  * is therefore handed its `value`.
333
344
  */
334
345
  function FieldInput(t0) {
335
- const $ = c(26);
346
+ const $ = c(29);
336
347
  let prefix;
337
348
  let props;
338
349
  let suffix;
@@ -341,8 +352,9 @@ function FieldInput(t0) {
341
352
  let t3;
342
353
  let t4;
343
354
  let t5;
355
+ let t6;
344
356
  if ($[0] !== t0) {
345
- ({autosize: t1, described: t2, multiline: t3, numeric: t4, prefix, rows: t5, suffix, ...props} = t0);
357
+ ({autosize: t1, chosen: t2, described: t3, multiline: t4, numeric: t5, prefix, rows: t6, suffix, ...props} = t0);
346
358
  $[0] = t0;
347
359
  $[1] = prefix;
348
360
  $[2] = props;
@@ -352,6 +364,7 @@ function FieldInput(t0) {
352
364
  $[6] = t3;
353
365
  $[7] = t4;
354
366
  $[8] = t5;
367
+ $[9] = t6;
355
368
  } else {
356
369
  prefix = $[1];
357
370
  props = $[2];
@@ -361,12 +374,14 @@ function FieldInput(t0) {
361
374
  t3 = $[6];
362
375
  t4 = $[7];
363
376
  t5 = $[8];
377
+ t6 = $[9];
364
378
  }
365
379
  const autosize = t1 === void 0 ? true : t1;
366
- const described = t2 === void 0 ? NO_PARTS : t2;
367
- const multiline = t3 === void 0 ? false : t3;
368
- const numeric = t4 === void 0 ? false : t4;
369
- const rows = t5 === void 0 ? 1 : t5;
380
+ const chosen = t2 === void 0 ? "" : t2;
381
+ const described = t3 === void 0 ? NO_PARTS : t3;
382
+ const multiline = t4 === void 0 ? false : t4;
383
+ const numeric = t5 === void 0 ? false : t5;
384
+ const rows = t6 === void 0 ? 1 : t6;
370
385
  const box = use(BoxContext);
371
386
  const theme = useTheme();
372
387
  const styles = fieldStylesOf(theme);
@@ -379,41 +394,45 @@ function FieldInput(t0) {
379
394
  const caret = box.invalid ? colors.error : colors.primary;
380
395
  const muted = box.disabled ? withOpacity(colors.onSurface, stateLayerOpacity.disabledContent) : colors.onSurfaceVariant;
381
396
  const affixed = prefix !== void 0 || suffix !== void 0;
397
+ const holdsChosen = chosen !== "";
382
398
  const clearance = box.underLabel ? marginTopOf(typography.bodySmallLineHeight * fontScale) : void 0;
383
399
  const affixStyle = composeStyles(role, colorOf(muted));
384
400
  const lines = typography.bodyLargeLineHeight * fontScale * (multiline ? rows : 1);
385
401
  const copied = multiline && autosize && Platform.OS === "web";
386
402
  const extent = multiline && !autosize ? heightOf(lines) : minHeightOf(lines);
387
- let t6;
388
- if ($[9] !== described || $[10] !== id || $[11] !== prefix || $[12] !== suffix) {
389
- t6 = descriptionOf([
403
+ let t7;
404
+ if ($[10] !== chosen || $[11] !== described || $[12] !== holdsChosen || $[13] !== id || $[14] !== prefix || $[15] !== suffix) {
405
+ t7 = descriptionOf([
406
+ ...affixPart(`${id}-chosen`, holdsChosen ? chosen : void 0),
390
407
  ...affixPart(`${id}-prefix`, prefix),
391
408
  ...affixPart(`${id}-suffix`, suffix),
392
409
  ...described
393
410
  ]);
394
- $[9] = described;
395
- $[10] = id;
396
- $[11] = prefix;
397
- $[12] = suffix;
398
- $[13] = t6;
399
- } else t6 = $[13];
400
- let t7;
401
- if ($[14] !== box) {
402
- t7 = webStateOf(box);
403
- $[14] = box;
404
- $[15] = t7;
405
- } else t7 = $[15];
411
+ $[10] = chosen;
412
+ $[11] = described;
413
+ $[12] = holdsChosen;
414
+ $[13] = id;
415
+ $[14] = prefix;
416
+ $[15] = suffix;
417
+ $[16] = t7;
418
+ } else t7 = $[16];
419
+ let t8;
420
+ if ($[17] !== box) {
421
+ t8 = webStateOf(box);
422
+ $[17] = box;
423
+ $[18] = t8;
424
+ } else t8 = $[18];
406
425
  const control = /* @__PURE__ */ jsx(TextInput, {
407
426
  ...Platform.OS === "web" ? INHERITS_DIRECTION : void 0,
408
427
  ...props,
409
- ...t6,
410
428
  ...t7,
429
+ ...t8,
411
430
  "aria-disabled": box.disabled,
412
431
  cursorColor: caret,
413
432
  multiline,
414
433
  placeholderTextColor: muted,
415
434
  selectionColor: caret,
416
- style: composeStyles(role, styles.input, colorOf(content), numeric ? numericOf(mono) : void 0, multiline ? styles.inputMultiline : void 0, copied ? styles.inputOverCopy : extent, affixed || copied ? void 0 : clearance),
435
+ style: composeStyles(role, styles.input, colorOf(content), numeric ? numericOf(mono) : void 0, multiline ? styles.inputMultiline : void 0, copied ? styles.inputOverCopy : extent, holdsChosen ? minWidthOf(CHOSEN_ROOM * typography.bodyLargeSize * fontScale) : void 0, affixed || copied || holdsChosen ? void 0 : clearance),
417
436
  underlineColorAndroid: "transparent"
418
437
  });
419
438
  if (copied) return /* @__PURE__ */ jsxs(View, {
@@ -424,41 +443,47 @@ function FieldInput(t0) {
424
443
  children: `${props.value ?? ""} `
425
444
  }), control]
426
445
  });
427
- if (!affixed) return control;
428
- let t8;
429
- if ($[16] !== affixStyle || $[17] !== box.floated || $[18] !== id || $[19] !== prefix) {
430
- t8 = prefix === void 0 ? null : /* @__PURE__ */ jsx(Affix, {
446
+ if (!affixed && !holdsChosen) return control;
447
+ let t9;
448
+ if ($[19] !== affixStyle || $[20] !== box.floated || $[21] !== id || $[22] !== prefix) {
449
+ t9 = prefix === void 0 ? null : /* @__PURE__ */ jsx(Affix, {
431
450
  floated: box.floated,
432
451
  id: `${id}-prefix`,
433
452
  style: affixStyle,
434
453
  children: prefix
435
454
  });
436
- $[16] = affixStyle;
437
- $[17] = box.floated;
438
- $[18] = id;
439
- $[19] = prefix;
440
- $[20] = t8;
441
- } else t8 = $[20];
442
- let t9;
443
- if ($[21] !== affixStyle || $[22] !== box.floated || $[23] !== id || $[24] !== suffix) {
444
- t9 = suffix === void 0 ? null : /* @__PURE__ */ jsx(Affix, {
455
+ $[19] = affixStyle;
456
+ $[20] = box.floated;
457
+ $[21] = id;
458
+ $[22] = prefix;
459
+ $[23] = t9;
460
+ } else t9 = $[23];
461
+ let t10;
462
+ if ($[24] !== affixStyle || $[25] !== box.floated || $[26] !== id || $[27] !== suffix) {
463
+ t10 = suffix === void 0 ? null : /* @__PURE__ */ jsx(Affix, {
445
464
  floated: box.floated,
446
465
  id: `${id}-suffix`,
447
466
  style: affixStyle,
448
467
  children: suffix
449
468
  });
450
- $[21] = affixStyle;
451
- $[22] = box.floated;
452
- $[23] = id;
453
- $[24] = suffix;
454
- $[25] = t9;
455
- } else t9 = $[25];
469
+ $[24] = affixStyle;
470
+ $[25] = box.floated;
471
+ $[26] = id;
472
+ $[27] = suffix;
473
+ $[28] = t10;
474
+ } else t10 = $[28];
456
475
  return /* @__PURE__ */ jsxs(View, {
457
476
  style: composeStyles(styles.affixLine, clearance),
458
477
  children: [
459
- t8,
478
+ holdsChosen ? /* @__PURE__ */ jsx(Text, {
479
+ id: `${id}-chosen`,
480
+ numberOfLines: 1,
481
+ style: composeStyles(role, colorOf(content), SHRINKS),
482
+ children: chosen
483
+ }) : null,
484
+ t9,
460
485
  control,
461
- t9
486
+ t10
462
487
  ]
463
488
  });
464
489
  }
@@ -580,6 +605,44 @@ function FieldMessage(t0) {
580
605
  return t12;
581
606
  }
582
607
  /**
608
+ * A date or a time's segments on the value's line of a {@link FieldBox}, in
609
+ * a row, clearing the label at the top where the box is filled, as a control
610
+ * does: web's `FieldSegments`. One inside another is a row on the outer
611
+ * one's line, which has already cleared the label.
612
+ */
613
+ function FieldSegments(t0) {
614
+ const $ = c(6);
615
+ const { children } = t0;
616
+ const box = use(BoxContext);
617
+ const onLine = use(SegmentsLineContext);
618
+ const theme = useTheme();
619
+ const styles = fieldStylesOf(theme);
620
+ const { fontScale } = useWindowDimensions();
621
+ const T0 = View;
622
+ const t1 = composeStyles(styles.segments, box.underLabel && !onLine ? marginTopOf(theme.typography.bodySmallLineHeight * fontScale) : void 0);
623
+ let t2;
624
+ if ($[0] !== children) {
625
+ t2 = /* @__PURE__ */ jsx(SegmentsLineContext, {
626
+ value: true,
627
+ children
628
+ });
629
+ $[0] = children;
630
+ $[1] = t2;
631
+ } else t2 = $[1];
632
+ let t3;
633
+ if ($[2] !== T0 || $[3] !== t1 || $[4] !== t2) {
634
+ t3 = /* @__PURE__ */ jsx(T0, {
635
+ style: t1,
636
+ children: t2
637
+ });
638
+ $[2] = T0;
639
+ $[3] = t1;
640
+ $[4] = t2;
641
+ $[5] = t3;
642
+ } else t3 = $[5];
643
+ return t3;
644
+ }
645
+ /**
583
646
  * Hands a control outside a box the states it is drawn in, for a field that
584
647
  * draws a container of its own around the control, as SearchField's bar is.
585
648
  * The control takes its colours and the state a screen reader reads from
@@ -618,6 +681,78 @@ function FieldStates(t0) {
618
681
  return t5;
619
682
  }
620
683
  /**
684
+ * A field's value where it was chosen rather than typed, on the value's line
685
+ * of a {@link FieldBox} whose `trigger` makes the box the control: body
686
+ * large, one line cut short with an ellipsis, clearing the label at the top
687
+ * as a control does. Hidden from a screen reader, which reads the value in
688
+ * the trigger's name.
689
+ *
690
+ * `isPlaceholder` says nothing has been chosen, which takes the muted role;
691
+ * under a floating label at rest it is not drawn until the label floats,
692
+ * exactly as an input's placeholder is, so the two never overlap.
693
+ *
694
+ * On web the value opens with a space, which a browser drops at the start
695
+ * of the line. It keeps the label and the value two words in the box's text,
696
+ * which axe reads as one string with nothing between its parts, and holds to
697
+ * the trigger's name, as WCAG's label in name asks; without it the label
698
+ * runs into the value's first word.
699
+ */
700
+ function FieldValue(t0) {
701
+ const $ = c(19);
702
+ const { children, isPlaceholder: t1 } = t0;
703
+ const isPlaceholder = t1 === void 0 ? false : t1;
704
+ const box = use(BoxContext);
705
+ const theme = useTheme();
706
+ const { fontScale } = useWindowDimensions();
707
+ const role = useTypeRole("bodyLarge");
708
+ const { colors, stateLayerOpacity, typography } = theme;
709
+ let T0;
710
+ let t2;
711
+ let t3;
712
+ let t4;
713
+ if ($[0] !== box.disabled || $[1] !== box.floated || $[2] !== box.underLabel || $[3] !== colors || $[4] !== fontScale || $[5] !== isPlaceholder || $[6] !== role || $[7] !== stateLayerOpacity || $[8] !== typography) {
714
+ const color = isPlaceholder && !box.floated ? "transparent" : box.disabled ? withOpacity(colors.onSurface, stateLayerOpacity.disabledContent) : isPlaceholder ? colors.onSurfaceVariant : colors.onSurface;
715
+ T0 = Text;
716
+ t2 = true;
717
+ t3 = 1;
718
+ t4 = composeStyles(role, colorOf(color), box.underLabel ? marginTopOf(typography.bodySmallLineHeight * fontScale) : void 0);
719
+ $[0] = box.disabled;
720
+ $[1] = box.floated;
721
+ $[2] = box.underLabel;
722
+ $[3] = colors;
723
+ $[4] = fontScale;
724
+ $[5] = isPlaceholder;
725
+ $[6] = role;
726
+ $[7] = stateLayerOpacity;
727
+ $[8] = typography;
728
+ $[9] = T0;
729
+ $[10] = t2;
730
+ $[11] = t3;
731
+ $[12] = t4;
732
+ } else {
733
+ T0 = $[9];
734
+ t2 = $[10];
735
+ t3 = $[11];
736
+ t4 = $[12];
737
+ }
738
+ let t5;
739
+ if ($[13] !== T0 || $[14] !== children || $[15] !== t2 || $[16] !== t3 || $[17] !== t4) {
740
+ t5 = /* @__PURE__ */ jsxs(T0, {
741
+ "aria-hidden": t2,
742
+ numberOfLines: t3,
743
+ style: t4,
744
+ children: [Platform.OS === "web" ? " " : null, children]
745
+ });
746
+ $[13] = T0;
747
+ $[14] = children;
748
+ $[15] = t2;
749
+ $[16] = t3;
750
+ $[17] = t4;
751
+ $[18] = t5;
752
+ } else t5 = $[18];
753
+ return t5;
754
+ }
755
+ /**
621
756
  * Tracks whether the control has focus, around the handlers the field was
622
757
  * given, which are called after.
623
758
  */
@@ -670,9 +805,14 @@ function useFieldFocus(t0) {
670
805
  const ATOMIC = { "aria-atomic": true };
671
806
  const HIDDEN = { "aria-hidden": true };
672
807
  const INHERITS_DIRECTION = { dir: null };
808
+ const NOT_A_CONTROL = {
809
+ accessible: false,
810
+ focusable: false
811
+ };
673
812
  const NOT_DRAWN = { display: "none" };
674
813
  const OUT_OF_FLOW = { position: "absolute" };
675
814
  const SHRINKS = { flexShrink: 1 };
815
+ const CHOSEN_ROOM = 3;
676
816
  /**
677
817
  * A prefix or a suffix, faded in once the label has floated and out when it
678
818
  * comes back to rest, over the label's own `durationShort3`.
@@ -812,6 +952,11 @@ function colorOf(color) {
812
952
  function countOf(length, maxLength, locale) {
813
953
  return maxLength === void 0 ? formatCount(length, locale) : `${formatCount(length, locale)}/${formatCount(maxLength, locale)}`;
814
954
  }
955
+ /**
956
+ * What describes a control by `parts`, as a field's control is described: the
957
+ * ids of the elements showing them under React Native Web, and their text as
958
+ * the hint VoiceOver and TalkBack read out on iOS and Android.
959
+ */
815
960
  function descriptionOf(parts) {
816
961
  if (Platform.OS === "web") return parts.length === 0 ? void 0 : { "aria-describedby": parts.map((part) => part.id).join(" ") };
817
962
  const said = parts.map((part) => part.text).filter((text) => text !== "");
@@ -819,7 +964,7 @@ function descriptionOf(parts) {
819
964
  }
820
965
  function focusOf(control) {
821
966
  return () => {
822
- control.current?.focus();
967
+ control?.current?.focus();
823
968
  };
824
969
  }
825
970
  function heightOf(height) {
@@ -954,6 +1099,17 @@ function FieldStroke(t0) {
954
1099
  return t2;
955
1100
  }
956
1101
  /**
1102
+ * The box as the control: a button named by the trigger and described by the
1103
+ * line under the field, which a keyboard and a screen reader reach.
1104
+ */
1105
+ function triggerOf({ described = NO_PARTS, onPress: _onPress, ...trigger }) {
1106
+ return {
1107
+ ...trigger,
1108
+ ...descriptionOf(described),
1109
+ role: "button"
1110
+ };
1111
+ }
1112
+ /**
957
1113
  * Says an error on iOS as it arrives, where a live region says nothing. An
958
1114
  * error the field opened with is not said, and neither is one that has not
959
1115
  * changed.
@@ -1046,6 +1202,6 @@ function widthTo(onMeasure) {
1046
1202
  };
1047
1203
  }
1048
1204
  //#endregion
1049
- export { FieldBox, FieldInput, FieldMessage, FieldStates, FieldStroke, describedBy, useErrorAnnouncement, useFieldFocus, useStrokeMotion };
1205
+ export { FieldBox, FieldChevron, FieldInput, FieldMessage, FieldSegments, FieldStates, FieldStroke, FieldValue, describedBy, descriptionOf, useErrorAnnouncement, useFieldFocus, useStrokeMotion };
1050
1206
 
1051
1207
  //# sourceMappingURL=index.js.map