@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.
- package/README.md +4 -3
- package/dist/autocomplete/index.js +15 -1
- package/dist/autocomplete/index.js.map +1 -1
- package/dist/button/group.d.ts +5 -0
- package/dist/button/group.js +115 -0
- package/dist/button/group.js.map +1 -0
- package/dist/button/index.d.ts +4 -1
- package/dist/button/index.js +44 -22
- package/dist/button/index.js.map +1 -1
- package/dist/button/slots.js +2 -1
- package/dist/button/slots.js.map +1 -1
- package/dist/calendar/index.js +351 -182
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/styles.js +33 -2
- package/dist/calendar/styles.js.map +1 -1
- package/dist/carousel/arrangement.d.ts +5 -0
- package/dist/carousel/arrangement.js +123 -0
- package/dist/carousel/arrangement.js.map +1 -0
- package/dist/chequer/index.js +95 -0
- package/dist/chequer/index.js.map +1 -0
- package/dist/collection/index.d.ts +157 -0
- package/dist/collection/index.js +1331 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/color-thumb/index.js +56 -0
- package/dist/color-thumb/index.js.map +1 -0
- package/dist/components/button/index.d.ts +4 -2
- package/dist/components/button/index.js +227 -188
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button-group/index.d.ts +87 -0
- package/dist/components/button-group/index.js +275 -0
- package/dist/components/button-group/index.js.map +1 -0
- package/dist/components/calendar/index.d.ts +11 -3
- package/dist/components/calendar/index.js +60 -45
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/carousel/index.d.ts +72 -0
- package/dist/components/carousel/index.js +496 -0
- package/dist/components/carousel/index.js.map +1 -0
- package/dist/components/checkbox-group/index.d.ts +3 -4
- package/dist/components/checkbox-group/index.js +1 -1
- package/dist/components/checkbox-group/index.js.map +1 -1
- package/dist/components/color-area/index.d.ts +85 -0
- package/dist/components/color-area/index.js +630 -0
- package/dist/components/color-area/index.js.map +1 -0
- package/dist/components/color-field/index.d.ts +144 -0
- package/dist/components/color-field/index.js +516 -0
- package/dist/components/color-field/index.js.map +1 -0
- package/dist/components/color-picker/index.d.ts +74 -0
- package/dist/components/color-picker/index.js +317 -0
- package/dist/components/color-picker/index.js.map +1 -0
- package/dist/components/color-slider/index.d.ts +82 -0
- package/dist/components/color-slider/index.js +456 -0
- package/dist/components/color-slider/index.js.map +1 -0
- package/dist/components/color-swatch/index.d.ts +46 -0
- package/dist/components/color-swatch/index.js +127 -0
- package/dist/components/color-swatch/index.js.map +1 -0
- package/dist/components/color-swatch-picker/index.d.ts +81 -0
- package/dist/components/color-swatch-picker/index.js +287 -0
- package/dist/components/color-swatch-picker/index.js.map +1 -0
- package/dist/components/color-wheel/index.d.ts +71 -0
- package/dist/components/color-wheel/index.js +407 -0
- package/dist/components/color-wheel/index.js.map +1 -0
- package/dist/components/combo-box/index.d.ts +193 -0
- package/dist/components/combo-box/index.js +616 -0
- package/dist/components/combo-box/index.js.map +1 -0
- package/dist/components/date-field/index.d.ts +120 -0
- package/dist/components/date-field/index.js +111 -0
- package/dist/components/date-field/index.js.map +1 -0
- package/dist/components/date-picker/index.d.ts +130 -0
- package/dist/components/date-picker/index.js +310 -0
- package/dist/components/date-picker/index.js.map +1 -0
- package/dist/components/date-range-picker/index.d.ts +139 -0
- package/dist/components/date-range-picker/index.js +421 -0
- package/dist/components/date-range-picker/index.js.map +1 -0
- package/dist/components/disclosure/index.d.ts +94 -0
- package/dist/components/disclosure/index.js +365 -0
- package/dist/components/disclosure/index.js.map +1 -0
- package/dist/components/disclosure-group/index.d.ts +61 -0
- package/dist/components/disclosure-group/index.js +100 -0
- package/dist/components/disclosure-group/index.js.map +1 -0
- package/dist/components/drop-zone/index.d.ts +113 -0
- package/dist/components/drop-zone/index.js +304 -0
- package/dist/components/drop-zone/index.js.map +1 -0
- package/dist/components/fab/index.d.ts +1 -1
- package/dist/components/fab/index.js +91 -76
- package/dist/components/fab/index.js.map +1 -1
- package/dist/components/form/index.d.ts +3 -2
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +4 -2
- package/dist/components/icon-button/index.js +204 -171
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/list/index.d.ts +15 -158
- package/dist/components/list/index.js +21 -1047
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-box/index.d.ts +73 -0
- package/dist/components/list-box/index.js +82 -0
- package/dist/components/list-box/index.js.map +1 -0
- package/dist/components/loading-indicator/index.d.ts +32 -0
- package/dist/components/loading-indicator/index.js +174 -0
- package/dist/components/loading-indicator/index.js.map +1 -0
- package/dist/components/navigation-tree/index.d.ts +117 -0
- package/dist/components/navigation-tree/index.js +135 -0
- package/dist/components/navigation-tree/index.js.map +1 -0
- package/dist/components/number-field/index.js +132 -143
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/range-calendar/index.d.ts +69 -0
- package/dist/components/range-calendar/index.js +144 -0
- package/dist/components/range-calendar/index.js.map +1 -0
- package/dist/components/search-view/index.d.ts +78 -0
- package/dist/components/search-view/index.js +570 -0
- package/dist/components/search-view/index.js.map +1 -0
- package/dist/components/select/index.d.ts +152 -0
- package/dist/components/select/index.js +419 -0
- package/dist/components/select/index.js.map +1 -0
- package/dist/components/slider/index.d.ts +111 -0
- package/dist/components/slider/index.js +673 -0
- package/dist/components/slider/index.js.map +1 -0
- package/dist/components/split-button/index.d.ts +77 -0
- package/dist/components/split-button/index.js +354 -0
- package/dist/components/split-button/index.js.map +1 -0
- package/dist/components/tabs/index.d.ts +196 -0
- package/dist/components/tabs/index.js +1137 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/time-field/index.d.ts +43 -0
- package/dist/components/time-field/index.js +107 -0
- package/dist/components/time-field/index.js.map +1 -0
- package/dist/components/time-picker/index.d.ts +65 -0
- package/dist/components/time-picker/index.js +1168 -0
- package/dist/components/time-picker/index.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +101 -0
- package/dist/components/tooltip/index.js +223 -0
- package/dist/components/tooltip/index.js.map +1 -0
- package/dist/components/tree/index.d.ts +112 -0
- package/dist/components/tree/index.js +157 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/disclosure/chevron.js +75 -0
- package/dist/disclosure/chevron.js.map +1 -0
- package/dist/disclosure/index.js +7 -0
- package/dist/disclosure/index.js.map +1 -0
- package/dist/drop/index.d.ts +54 -0
- package/dist/drop/index.js +161 -0
- package/dist/drop/index.js.map +1 -0
- package/dist/field/chevron.js +74 -0
- package/dist/field/chevron.js.map +1 -0
- package/dist/field/index.d.ts +2 -1
- package/dist/field/index.js +310 -154
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +9 -0
- package/dist/field/styles.js.map +1 -1
- package/dist/files/index.d.ts +18 -0
- package/dist/files/index.js +107 -0
- package/dist/files/index.js.map +1 -0
- package/dist/form/index.d.ts +5 -2
- package/dist/form/index.js +64 -85
- package/dist/form/index.js.map +1 -1
- package/dist/glyphs/index.js +92 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/i18n/index.js +20 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +1394 -34
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +35 -3
- package/dist/index.js +34 -3
- package/dist/indicator/paths.js +23 -1
- package/dist/indicator/paths.js.map +1 -1
- package/dist/modal/index.js +92 -77
- package/dist/modal/index.js.map +1 -1
- package/dist/number/keyboard.js +16 -0
- package/dist/number/keyboard.js.map +1 -0
- package/dist/overlay/anchored.js +68 -38
- package/dist/overlay/anchored.js.map +1 -1
- package/dist/overlay/keyboard.js +57 -0
- package/dist/overlay/keyboard.js.map +1 -0
- package/dist/overlay/panel.js +173 -19
- package/dist/overlay/panel.js.map +1 -1
- package/dist/overlay/placement.js +13 -1
- package/dist/overlay/placement.js.map +1 -1
- package/dist/picker/index.js +322 -0
- package/dist/picker/index.js.map +1 -0
- package/dist/press/index.d.ts +2 -0
- package/dist/press/index.js +102 -100
- package/dist/press/index.js.map +1 -1
- package/dist/row/index.js +77 -69
- package/dist/row/index.js.map +1 -1
- package/dist/row/styles.js +13 -2
- package/dist/row/styles.js.map +1 -1
- package/dist/segments/field.js +277 -0
- package/dist/segments/field.js.map +1 -0
- package/dist/segments/index.js +574 -0
- package/dist/segments/index.js.map +1 -0
- package/dist/segments/styles.js +24 -0
- package/dist/segments/styles.js.map +1 -0
- package/dist/slider/index.js +145 -0
- package/dist/slider/index.js.map +1 -0
- package/dist/swatch/index.js +56 -0
- package/dist/swatch/index.js.map +1 -0
- package/package.json +11 -2
package/dist/field/index.js
CHANGED
|
@@ -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
|
|
54
|
-
*
|
|
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(
|
|
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
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
|
183
|
-
if ($[
|
|
184
|
-
|
|
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
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
195
|
-
$[
|
|
196
|
-
$[
|
|
197
|
-
} else
|
|
198
|
-
let
|
|
199
|
-
if ($[
|
|
200
|
-
|
|
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
|
-
$[
|
|
211
|
-
$[
|
|
212
|
-
$[
|
|
213
|
-
$[
|
|
214
|
-
$[
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
$[
|
|
219
|
-
} else
|
|
220
|
-
let
|
|
221
|
-
if ($[
|
|
222
|
-
|
|
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
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
233
|
-
$[
|
|
234
|
-
} else
|
|
235
|
-
let
|
|
236
|
-
if ($[
|
|
237
|
-
|
|
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
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
} else
|
|
245
|
-
let
|
|
246
|
-
if ($[
|
|
247
|
-
|
|
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
|
-
$[
|
|
256
|
-
$[
|
|
257
|
-
$[
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
} else
|
|
261
|
-
let
|
|
262
|
-
if ($[
|
|
263
|
-
|
|
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
|
-
$[
|
|
271
|
-
$[
|
|
272
|
-
$[
|
|
273
|
-
$[
|
|
274
|
-
$[
|
|
275
|
-
$[
|
|
276
|
-
$[
|
|
277
|
-
$[
|
|
278
|
-
} else
|
|
279
|
-
let
|
|
280
|
-
if ($[
|
|
281
|
-
|
|
282
|
-
|
|
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
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
style:
|
|
292
|
+
onHoverIn: t15,
|
|
293
|
+
onHoverOut: t16,
|
|
294
|
+
onPress: t17,
|
|
295
|
+
ref,
|
|
296
|
+
style: t18,
|
|
289
297
|
children: [
|
|
298
|
+
t19,
|
|
290
299
|
t20,
|
|
291
|
-
|
|
292
|
-
t25,
|
|
300
|
+
t24,
|
|
293
301
|
end,
|
|
294
|
-
|
|
302
|
+
t25
|
|
295
303
|
]
|
|
296
304
|
});
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
$[
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
305
|
-
$[
|
|
306
|
-
$[
|
|
307
|
-
$[
|
|
308
|
-
$[
|
|
309
|
-
|
|
310
|
-
|
|
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
|
|
321
|
-
* in `described`, so a reader hears the
|
|
322
|
-
*
|
|
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(
|
|
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,
|
|
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
|
|
367
|
-
const
|
|
368
|
-
const
|
|
369
|
-
const
|
|
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
|
|
388
|
-
if ($[
|
|
389
|
-
|
|
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
|
-
$[
|
|
395
|
-
$[
|
|
396
|
-
$[
|
|
397
|
-
$[
|
|
398
|
-
$[
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
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
|
|
429
|
-
if ($[
|
|
430
|
-
|
|
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
|
-
$[
|
|
437
|
-
$[
|
|
438
|
-
$[
|
|
439
|
-
$[
|
|
440
|
-
$[
|
|
441
|
-
} else
|
|
442
|
-
let
|
|
443
|
-
if ($[
|
|
444
|
-
|
|
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
|
-
$[
|
|
451
|
-
$[
|
|
452
|
-
$[
|
|
453
|
-
$[
|
|
454
|
-
$[
|
|
455
|
-
} else
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|