@kanso-labs/react-native-kanso-ui 0.8.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 (253) 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/badge/index.js +9 -70
  5. package/dist/badge/index.js.map +1 -1
  6. package/dist/button/group.d.ts +5 -0
  7. package/dist/button/group.js +115 -0
  8. package/dist/button/group.js.map +1 -0
  9. package/dist/button/index.d.ts +4 -1
  10. package/dist/button/index.js +45 -23
  11. package/dist/button/index.js.map +1 -1
  12. package/dist/button/palettes.d.ts +2 -0
  13. package/dist/button/slots.js +2 -1
  14. package/dist/button/slots.js.map +1 -1
  15. package/dist/calendar/index.js +351 -182
  16. package/dist/calendar/index.js.map +1 -1
  17. package/dist/calendar/styles.js +33 -2
  18. package/dist/calendar/styles.js.map +1 -1
  19. package/dist/carousel/arrangement.d.ts +5 -0
  20. package/dist/carousel/arrangement.js +123 -0
  21. package/dist/carousel/arrangement.js.map +1 -0
  22. package/dist/chequer/index.js +95 -0
  23. package/dist/chequer/index.js.map +1 -0
  24. package/dist/collection/index.d.ts +157 -0
  25. package/dist/collection/index.js +1331 -0
  26. package/dist/collection/index.js.map +1 -0
  27. package/dist/color-thumb/index.js +56 -0
  28. package/dist/color-thumb/index.js.map +1 -0
  29. package/dist/components/badge/index.d.ts +48 -0
  30. package/dist/components/badge/index.js +122 -0
  31. package/dist/components/badge/index.js.map +1 -0
  32. package/dist/{badge → components/badge}/styles.js +10 -6
  33. package/dist/components/badge/styles.js.map +1 -0
  34. package/dist/components/breadcrumbs/index.d.ts +66 -0
  35. package/dist/components/breadcrumbs/index.js +285 -0
  36. package/dist/components/breadcrumbs/index.js.map +1 -0
  37. package/dist/components/button/index.d.ts +4 -2
  38. package/dist/components/button/index.js +227 -188
  39. package/dist/components/button/index.js.map +1 -1
  40. package/dist/components/button-group/index.d.ts +87 -0
  41. package/dist/components/button-group/index.js +275 -0
  42. package/dist/components/button-group/index.js.map +1 -0
  43. package/dist/components/calendar/index.d.ts +11 -3
  44. package/dist/components/calendar/index.js +60 -45
  45. package/dist/components/calendar/index.js.map +1 -1
  46. package/dist/components/carousel/index.d.ts +72 -0
  47. package/dist/components/carousel/index.js +496 -0
  48. package/dist/components/carousel/index.js.map +1 -0
  49. package/dist/components/checkbox/index.d.ts +7 -1
  50. package/dist/components/checkbox/index.js +183 -138
  51. package/dist/components/checkbox/index.js.map +1 -1
  52. package/dist/components/checkbox-group/index.d.ts +92 -0
  53. package/dist/components/checkbox-group/index.js +306 -0
  54. package/dist/components/checkbox-group/index.js.map +1 -0
  55. package/dist/components/code/index.d.ts +25 -0
  56. package/dist/components/code/index.js +87 -0
  57. package/dist/components/code/index.js.map +1 -0
  58. package/dist/components/color-area/index.d.ts +85 -0
  59. package/dist/components/color-area/index.js +630 -0
  60. package/dist/components/color-area/index.js.map +1 -0
  61. package/dist/components/color-field/index.d.ts +144 -0
  62. package/dist/components/color-field/index.js +516 -0
  63. package/dist/components/color-field/index.js.map +1 -0
  64. package/dist/components/color-picker/index.d.ts +74 -0
  65. package/dist/components/color-picker/index.js +317 -0
  66. package/dist/components/color-picker/index.js.map +1 -0
  67. package/dist/components/color-slider/index.d.ts +82 -0
  68. package/dist/components/color-slider/index.js +456 -0
  69. package/dist/components/color-slider/index.js.map +1 -0
  70. package/dist/components/color-swatch/index.d.ts +46 -0
  71. package/dist/components/color-swatch/index.js +127 -0
  72. package/dist/components/color-swatch/index.js.map +1 -0
  73. package/dist/components/color-swatch-picker/index.d.ts +81 -0
  74. package/dist/components/color-swatch-picker/index.js +287 -0
  75. package/dist/components/color-swatch-picker/index.js.map +1 -0
  76. package/dist/components/color-wheel/index.d.ts +71 -0
  77. package/dist/components/color-wheel/index.js +407 -0
  78. package/dist/components/color-wheel/index.js.map +1 -0
  79. package/dist/components/combo-box/index.d.ts +193 -0
  80. package/dist/components/combo-box/index.js +616 -0
  81. package/dist/components/combo-box/index.js.map +1 -0
  82. package/dist/components/container/index.d.ts +47 -0
  83. package/dist/components/container/index.js +85 -0
  84. package/dist/components/container/index.js.map +1 -0
  85. package/dist/components/date-field/index.d.ts +120 -0
  86. package/dist/components/date-field/index.js +111 -0
  87. package/dist/components/date-field/index.js.map +1 -0
  88. package/dist/components/date-picker/index.d.ts +130 -0
  89. package/dist/components/date-picker/index.js +310 -0
  90. package/dist/components/date-picker/index.js.map +1 -0
  91. package/dist/components/date-range-picker/index.d.ts +139 -0
  92. package/dist/components/date-range-picker/index.js +421 -0
  93. package/dist/components/date-range-picker/index.js.map +1 -0
  94. package/dist/components/disclosure/index.d.ts +94 -0
  95. package/dist/components/disclosure/index.js +365 -0
  96. package/dist/components/disclosure/index.js.map +1 -0
  97. package/dist/components/disclosure-group/index.d.ts +61 -0
  98. package/dist/components/disclosure-group/index.js +100 -0
  99. package/dist/components/disclosure-group/index.js.map +1 -0
  100. package/dist/components/drop-zone/index.d.ts +113 -0
  101. package/dist/components/drop-zone/index.js +304 -0
  102. package/dist/components/drop-zone/index.js.map +1 -0
  103. package/dist/components/fab/index.d.ts +80 -0
  104. package/dist/components/fab/index.js +246 -0
  105. package/dist/components/fab/index.js.map +1 -0
  106. package/dist/components/fab-menu/index.d.ts +120 -0
  107. package/dist/components/fab-menu/index.js +640 -0
  108. package/dist/components/fab-menu/index.js.map +1 -0
  109. package/dist/components/feed/index.d.ts +57 -0
  110. package/dist/components/feed/index.js +167 -0
  111. package/dist/components/feed/index.js.map +1 -0
  112. package/dist/components/form/index.d.ts +3 -2
  113. package/dist/components/form/index.js.map +1 -1
  114. package/dist/components/icon-button/index.d.ts +4 -2
  115. package/dist/components/icon-button/index.js +204 -171
  116. package/dist/components/icon-button/index.js.map +1 -1
  117. package/dist/components/keycap/index.d.ts +27 -0
  118. package/dist/components/keycap/index.js +136 -0
  119. package/dist/components/keycap/index.js.map +1 -0
  120. package/dist/components/list/index.d.ts +15 -158
  121. package/dist/components/list/index.js +21 -1047
  122. package/dist/components/list/index.js.map +1 -1
  123. package/dist/components/list-box/index.d.ts +73 -0
  124. package/dist/components/list-box/index.js +82 -0
  125. package/dist/components/list-box/index.js.map +1 -0
  126. package/dist/components/loading-indicator/index.d.ts +32 -0
  127. package/dist/components/loading-indicator/index.js +174 -0
  128. package/dist/components/loading-indicator/index.js.map +1 -0
  129. package/dist/components/menu/index.js +1 -1
  130. package/dist/components/navigation-tree/index.d.ts +117 -0
  131. package/dist/components/navigation-tree/index.js +135 -0
  132. package/dist/components/navigation-tree/index.js.map +1 -0
  133. package/dist/components/number-field/index.js +132 -143
  134. package/dist/components/number-field/index.js.map +1 -1
  135. package/dist/components/range-calendar/index.d.ts +69 -0
  136. package/dist/components/range-calendar/index.js +144 -0
  137. package/dist/components/range-calendar/index.js.map +1 -0
  138. package/dist/components/search-view/index.d.ts +78 -0
  139. package/dist/components/search-view/index.js +570 -0
  140. package/dist/components/search-view/index.js.map +1 -0
  141. package/dist/components/select/index.d.ts +152 -0
  142. package/dist/components/select/index.js +419 -0
  143. package/dist/components/select/index.js.map +1 -0
  144. package/dist/components/separator/index.d.ts +3 -2
  145. package/dist/components/separator/index.js +29 -26
  146. package/dist/components/separator/index.js.map +1 -1
  147. package/dist/components/slider/index.d.ts +111 -0
  148. package/dist/components/slider/index.js +673 -0
  149. package/dist/components/slider/index.js.map +1 -0
  150. package/dist/components/split-button/index.d.ts +77 -0
  151. package/dist/components/split-button/index.js +354 -0
  152. package/dist/components/split-button/index.js.map +1 -0
  153. package/dist/components/supporting-pane/index.d.ts +44 -0
  154. package/dist/components/supporting-pane/index.js +109 -0
  155. package/dist/components/supporting-pane/index.js.map +1 -0
  156. package/dist/components/tabs/index.d.ts +196 -0
  157. package/dist/components/tabs/index.js +1137 -0
  158. package/dist/components/tabs/index.js.map +1 -0
  159. package/dist/components/text/index.d.ts +1 -1
  160. package/dist/components/text/index.js +49 -21
  161. package/dist/components/text/index.js.map +1 -1
  162. package/dist/components/text-area/index.d.ts +145 -0
  163. package/dist/components/text-area/index.js +231 -0
  164. package/dist/components/text-area/index.js.map +1 -0
  165. package/dist/components/time-field/index.d.ts +43 -0
  166. package/dist/components/time-field/index.js +107 -0
  167. package/dist/components/time-field/index.js.map +1 -0
  168. package/dist/components/time-picker/index.d.ts +65 -0
  169. package/dist/components/time-picker/index.js +1168 -0
  170. package/dist/components/time-picker/index.js.map +1 -0
  171. package/dist/components/toolbar/index.d.ts +53 -0
  172. package/dist/components/toolbar/index.js +185 -0
  173. package/dist/components/toolbar/index.js.map +1 -0
  174. package/dist/components/tooltip/index.d.ts +101 -0
  175. package/dist/components/tooltip/index.js +223 -0
  176. package/dist/components/tooltip/index.js.map +1 -0
  177. package/dist/components/tree/index.d.ts +112 -0
  178. package/dist/components/tree/index.js +157 -0
  179. package/dist/components/tree/index.js.map +1 -0
  180. package/dist/control/group.js +23 -0
  181. package/dist/control/group.js.map +1 -0
  182. package/dist/disclosure/chevron.js +75 -0
  183. package/dist/disclosure/chevron.js.map +1 -0
  184. package/dist/disclosure/index.js +7 -0
  185. package/dist/disclosure/index.js.map +1 -0
  186. package/dist/drop/index.d.ts +54 -0
  187. package/dist/drop/index.js +161 -0
  188. package/dist/drop/index.js.map +1 -0
  189. package/dist/fab/index.d.ts +19 -0
  190. package/dist/fab/index.js +147 -0
  191. package/dist/fab/index.js.map +1 -0
  192. package/dist/field/chevron.js +74 -0
  193. package/dist/field/chevron.js.map +1 -0
  194. package/dist/field/index.d.ts +2 -1
  195. package/dist/field/index.js +350 -153
  196. package/dist/field/index.js.map +1 -1
  197. package/dist/field/styles.js +27 -0
  198. package/dist/field/styles.js.map +1 -1
  199. package/dist/files/index.d.ts +18 -0
  200. package/dist/files/index.js +107 -0
  201. package/dist/files/index.js.map +1 -0
  202. package/dist/form/index.d.ts +6 -4
  203. package/dist/form/index.js +64 -85
  204. package/dist/form/index.js.map +1 -1
  205. package/dist/glyphs/index.js +92 -1
  206. package/dist/glyphs/index.js.map +1 -1
  207. package/dist/i18n/index.js +20 -1
  208. package/dist/i18n/index.js.map +1 -1
  209. package/dist/i18n/messages.js +1394 -34
  210. package/dist/i18n/messages.js.map +1 -1
  211. package/dist/index.d.ts +51 -6
  212. package/dist/index.js +47 -4
  213. package/dist/indicator/paths.js +23 -1
  214. package/dist/indicator/paths.js.map +1 -1
  215. package/dist/modal/index.js +96 -68
  216. package/dist/modal/index.js.map +1 -1
  217. package/dist/navigation/index.js +8 -5
  218. package/dist/navigation/index.js.map +1 -1
  219. package/dist/number/keyboard.js +16 -0
  220. package/dist/number/keyboard.js.map +1 -0
  221. package/dist/overlay/anchored.js +68 -38
  222. package/dist/overlay/anchored.js.map +1 -1
  223. package/dist/overlay/keyboard.js +57 -0
  224. package/dist/overlay/keyboard.js.map +1 -0
  225. package/dist/overlay/panel.js +173 -19
  226. package/dist/overlay/panel.js.map +1 -1
  227. package/dist/overlay/placement.js +16 -2
  228. package/dist/overlay/placement.js.map +1 -1
  229. package/dist/picker/index.js +322 -0
  230. package/dist/picker/index.js.map +1 -0
  231. package/dist/press/index.d.ts +2 -0
  232. package/dist/press/index.js +102 -100
  233. package/dist/press/index.js.map +1 -1
  234. package/dist/row/index.js +77 -69
  235. package/dist/row/index.js.map +1 -1
  236. package/dist/row/styles.js +13 -2
  237. package/dist/row/styles.js.map +1 -1
  238. package/dist/segments/field.js +277 -0
  239. package/dist/segments/field.js.map +1 -0
  240. package/dist/segments/index.js +574 -0
  241. package/dist/segments/index.js.map +1 -0
  242. package/dist/segments/styles.js +24 -0
  243. package/dist/segments/styles.js.map +1 -0
  244. package/dist/separator/index.js +7 -0
  245. package/dist/separator/index.js.map +1 -0
  246. package/dist/slider/index.js +145 -0
  247. package/dist/slider/index.js.map +1 -0
  248. package/dist/swatch/index.js +56 -0
  249. package/dist/swatch/index.js.map +1 -0
  250. package/dist/typography/size.js +14 -0
  251. package/dist/typography/size.js.map +1 -0
  252. package/package.json +11 -2
  253. package/dist/badge/styles.js.map +0 -1
@@ -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,35 +327,61 @@ 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.
335
+ *
336
+ * `multiline` makes it a text area, `rows` lines of body large tall at the
337
+ * least, its text from the top. iOS and Android grow a multi-line input with
338
+ * what it holds by themselves, so a height floor is all `autosize` asks of
339
+ * them, and `autosize={false}` sets the height instead, which they scroll
340
+ * inside. React Native Web's textarea keeps the height it is given, so there
341
+ * the control lies over a hidden copy of `value` that takes the height the
342
+ * text would, as web's text area lies over its replica. A control that grows
343
+ * is therefore handed its `value`.
324
344
  */
325
345
  function FieldInput(t0) {
326
- const $ = c(23);
346
+ const $ = c(29);
327
347
  let prefix;
328
348
  let props;
329
349
  let suffix;
330
350
  let t1;
331
351
  let t2;
352
+ let t3;
353
+ let t4;
354
+ let t5;
355
+ let t6;
332
356
  if ($[0] !== t0) {
333
- ({described: t1, numeric: t2, prefix, suffix, ...props} = t0);
357
+ ({autosize: t1, chosen: t2, described: t3, multiline: t4, numeric: t5, prefix, rows: t6, suffix, ...props} = t0);
334
358
  $[0] = t0;
335
359
  $[1] = prefix;
336
360
  $[2] = props;
337
361
  $[3] = suffix;
338
362
  $[4] = t1;
339
363
  $[5] = t2;
364
+ $[6] = t3;
365
+ $[7] = t4;
366
+ $[8] = t5;
367
+ $[9] = t6;
340
368
  } else {
341
369
  prefix = $[1];
342
370
  props = $[2];
343
371
  suffix = $[3];
344
372
  t1 = $[4];
345
373
  t2 = $[5];
374
+ t3 = $[6];
375
+ t4 = $[7];
376
+ t5 = $[8];
377
+ t6 = $[9];
346
378
  }
347
- const described = t1 === void 0 ? NO_PARTS : t1;
348
- const numeric = t2 === void 0 ? false : t2;
379
+ const autosize = t1 === void 0 ? true : t1;
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;
349
385
  const box = use(BoxContext);
350
386
  const theme = useTheme();
351
387
  const styles = fieldStylesOf(theme);
@@ -358,74 +394,96 @@ function FieldInput(t0) {
358
394
  const caret = box.invalid ? colors.error : colors.primary;
359
395
  const muted = box.disabled ? withOpacity(colors.onSurface, stateLayerOpacity.disabledContent) : colors.onSurfaceVariant;
360
396
  const affixed = prefix !== void 0 || suffix !== void 0;
397
+ const holdsChosen = chosen !== "";
361
398
  const clearance = box.underLabel ? marginTopOf(typography.bodySmallLineHeight * fontScale) : void 0;
362
399
  const affixStyle = composeStyles(role, colorOf(muted));
363
- let t3;
364
- if ($[6] !== described || $[7] !== id || $[8] !== prefix || $[9] !== suffix) {
365
- t3 = descriptionOf([
400
+ const lines = typography.bodyLargeLineHeight * fontScale * (multiline ? rows : 1);
401
+ const copied = multiline && autosize && Platform.OS === "web";
402
+ const extent = multiline && !autosize ? heightOf(lines) : minHeightOf(lines);
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),
366
407
  ...affixPart(`${id}-prefix`, prefix),
367
408
  ...affixPart(`${id}-suffix`, suffix),
368
409
  ...described
369
410
  ]);
370
- $[6] = described;
371
- $[7] = id;
372
- $[8] = prefix;
373
- $[9] = suffix;
374
- $[10] = t3;
375
- } else t3 = $[10];
376
- let t4;
377
- if ($[11] !== box) {
378
- t4 = webStateOf(box);
379
- $[11] = box;
380
- $[12] = t4;
381
- } else t4 = $[12];
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];
382
425
  const control = /* @__PURE__ */ jsx(TextInput, {
383
426
  ...Platform.OS === "web" ? INHERITS_DIRECTION : void 0,
384
427
  ...props,
385
- ...t3,
386
- ...t4,
428
+ ...t7,
429
+ ...t8,
387
430
  "aria-disabled": box.disabled,
388
431
  cursorColor: caret,
432
+ multiline,
389
433
  placeholderTextColor: muted,
390
434
  selectionColor: caret,
391
- style: composeStyles(role, styles.input, colorOf(content), numeric ? numericOf(mono) : void 0, minHeightOf(typography.bodyLargeLineHeight * fontScale), affixed ? 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),
392
436
  underlineColorAndroid: "transparent"
393
437
  });
394
- if (!affixed) return control;
395
- let t5;
396
- if ($[13] !== affixStyle || $[14] !== box.floated || $[15] !== id || $[16] !== prefix) {
397
- t5 = prefix === void 0 ? null : /* @__PURE__ */ jsx(Affix, {
438
+ if (copied) return /* @__PURE__ */ jsxs(View, {
439
+ style: composeStyles(styles.copied, clearance),
440
+ children: [/* @__PURE__ */ jsx(Text, {
441
+ "aria-hidden": true,
442
+ style: composeStyles(role, styles.copy, extent),
443
+ children: `${props.value ?? ""} `
444
+ }), control]
445
+ });
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, {
398
450
  floated: box.floated,
399
451
  id: `${id}-prefix`,
400
452
  style: affixStyle,
401
453
  children: prefix
402
454
  });
403
- $[13] = affixStyle;
404
- $[14] = box.floated;
405
- $[15] = id;
406
- $[16] = prefix;
407
- $[17] = t5;
408
- } else t5 = $[17];
409
- let t6;
410
- if ($[18] !== affixStyle || $[19] !== box.floated || $[20] !== id || $[21] !== suffix) {
411
- t6 = 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, {
412
464
  floated: box.floated,
413
465
  id: `${id}-suffix`,
414
466
  style: affixStyle,
415
467
  children: suffix
416
468
  });
417
- $[18] = affixStyle;
418
- $[19] = box.floated;
419
- $[20] = id;
420
- $[21] = suffix;
421
- $[22] = t6;
422
- } else t6 = $[22];
469
+ $[24] = affixStyle;
470
+ $[25] = box.floated;
471
+ $[26] = id;
472
+ $[27] = suffix;
473
+ $[28] = t10;
474
+ } else t10 = $[28];
423
475
  return /* @__PURE__ */ jsxs(View, {
424
476
  style: composeStyles(styles.affixLine, clearance),
425
477
  children: [
426
- t5,
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,
427
485
  control,
428
- t6
486
+ t10
429
487
  ]
430
488
  });
431
489
  }
@@ -547,6 +605,44 @@ function FieldMessage(t0) {
547
605
  return t12;
548
606
  }
549
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
+ /**
550
646
  * Hands a control outside a box the states it is drawn in, for a field that
551
647
  * draws a container of its own around the control, as SearchField's bar is.
552
648
  * The control takes its colours and the state a screen reader reads from
@@ -585,6 +681,78 @@ function FieldStates(t0) {
585
681
  return t5;
586
682
  }
587
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
+ /**
588
756
  * Tracks whether the control has focus, around the handlers the field was
589
757
  * given, which are called after.
590
758
  */
@@ -637,9 +805,14 @@ function useFieldFocus(t0) {
637
805
  const ATOMIC = { "aria-atomic": true };
638
806
  const HIDDEN = { "aria-hidden": true };
639
807
  const INHERITS_DIRECTION = { dir: null };
808
+ const NOT_A_CONTROL = {
809
+ accessible: false,
810
+ focusable: false
811
+ };
640
812
  const NOT_DRAWN = { display: "none" };
641
813
  const OUT_OF_FLOW = { position: "absolute" };
642
814
  const SHRINKS = { flexShrink: 1 };
815
+ const CHOSEN_ROOM = 3;
643
816
  /**
644
817
  * A prefix or a suffix, faded in once the label has floated and out when it
645
818
  * comes back to rest, over the label's own `durationShort3`.
@@ -779,6 +952,11 @@ function colorOf(color) {
779
952
  function countOf(length, maxLength, locale) {
780
953
  return maxLength === void 0 ? formatCount(length, locale) : `${formatCount(length, locale)}/${formatCount(maxLength, locale)}`;
781
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
+ */
782
960
  function descriptionOf(parts) {
783
961
  if (Platform.OS === "web") return parts.length === 0 ? void 0 : { "aria-describedby": parts.map((part) => part.id).join(" ") };
784
962
  const said = parts.map((part) => part.text).filter((text) => text !== "");
@@ -786,9 +964,12 @@ function descriptionOf(parts) {
786
964
  }
787
965
  function focusOf(control) {
788
966
  return () => {
789
- control.current?.focus();
967
+ control?.current?.focus();
790
968
  };
791
969
  }
970
+ function heightOf(height) {
971
+ return { height };
972
+ }
792
973
  function iconStyleOf(color) {
793
974
  return {
794
975
  color,
@@ -917,6 +1098,22 @@ function FieldStroke(t0) {
917
1098
  } else t2 = $[4];
918
1099
  return t2;
919
1100
  }
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
+ /**
1113
+ * Says an error on iOS as it arrives, where a live region says nothing. An
1114
+ * error the field opened with is not said, and neither is one that has not
1115
+ * changed.
1116
+ */
920
1117
  function useErrorAnnouncement(error) {
921
1118
  const $ = c(3);
922
1119
  const said = useRef(error);
@@ -1005,6 +1202,6 @@ function widthTo(onMeasure) {
1005
1202
  };
1006
1203
  }
1007
1204
  //#endregion
1008
- export { FieldBox, FieldInput, FieldMessage, FieldStates, FieldStroke, describedBy, useFieldFocus, useStrokeMotion };
1205
+ export { FieldBox, FieldChevron, FieldInput, FieldMessage, FieldSegments, FieldStates, FieldStroke, FieldValue, describedBy, descriptionOf, useErrorAnnouncement, useFieldFocus, useStrokeMotion };
1009
1206
 
1010
1207
  //# sourceMappingURL=index.js.map