@kanso-labs/react-native-kanso-ui 0.10.0 → 0.11.1
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/dist/collection/index.js +107 -80
- package/dist/collection/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +4 -1
- package/dist/components/chip/index.js +229 -161
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/dialog/index.d.ts +5 -5
- package/dist/components/dialog/index.js +5 -5
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/drop-zone/index.d.ts +3 -3
- package/dist/components/drop-zone/index.js +2 -2
- package/dist/components/drop-zone/index.js.map +1 -1
- package/dist/components/menu/index.d.ts +3 -3
- package/dist/components/menu/index.js +3 -3
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +2 -2
- package/dist/components/popover/index.js +2 -2
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/search-view/index.d.ts +3 -2
- package/dist/components/search-view/index.js +3 -2
- package/dist/components/search-view/index.js.map +1 -1
- package/dist/components/sheet/index.d.ts +16 -7
- package/dist/components/sheet/index.js +157 -152
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/table/index.d.ts +391 -0
- package/dist/components/table/index.js +1708 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/token-field/index.d.ts +105 -0
- package/dist/components/token-field/index.js +574 -0
- package/dist/components/token-field/index.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +2 -1
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/field/index.js +50 -1
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +9 -1
- package/dist/field/styles.js.map +1 -1
- package/dist/glyphs/index.js +37 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/i18n/index.js +17 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +340 -0
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/slider/index.js +1 -1
- package/dist/slider/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,574 @@
|
|
|
1
|
+
import { useTheme } from "../../theme/scope.js";
|
|
2
|
+
import { composeStyles } from "../../theme/styles.js";
|
|
3
|
+
import { usePressFeedback } from "../../press/index.js";
|
|
4
|
+
import { useTypeRole } from "../../typography/roles.js";
|
|
5
|
+
import { withOpacity } from "../../theme/color.js";
|
|
6
|
+
import { useLocaleOf, useMessages } from "../../i18n/provider.js";
|
|
7
|
+
import { AnimatedPressable, toggleState } from "../../button/index.js";
|
|
8
|
+
import { FieldBox, FieldInput, FieldMessage, FieldWrap, describedBy, useFieldFocus } from "../../field/index.js";
|
|
9
|
+
import { stylesOf } from "../../chip/styles.js";
|
|
10
|
+
import { ChipLabel, measureThen, paintOf, targetOf, useEasedColors } from "../../chip/index.js";
|
|
11
|
+
import { c } from "react/compiler-runtime";
|
|
12
|
+
import { StyleSheet, Text, View, useWindowDimensions } from "react-native";
|
|
13
|
+
import { useId, useImperativeHandle, useRef, useState } from "react";
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { useTokenFieldState } from "react-stately";
|
|
16
|
+
//#region src/components/token-field/index.tsx
|
|
17
|
+
const CONTROL_ROOM = 3;
|
|
18
|
+
const styles = StyleSheet.create({
|
|
19
|
+
control: {
|
|
20
|
+
flexBasis: 0,
|
|
21
|
+
flexGrow: 1
|
|
22
|
+
},
|
|
23
|
+
text: { flexShrink: 1 }
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Backspace in an empty control: removes the selected pill where there is
|
|
27
|
+
* one, and selects the last otherwise. With no pill, `last` is -1, which no
|
|
28
|
+
* token holds, so it selects nothing. The call site's own handler runs after.
|
|
29
|
+
*/
|
|
30
|
+
function backspaceThen(editor, { editable, last, selected, trailing }, then) {
|
|
31
|
+
return (event) => {
|
|
32
|
+
if (editable && event.nativeEvent.key === "Backspace" && trailing === "") {
|
|
33
|
+
if (selected !== null) editor.remove(selected);
|
|
34
|
+
else editor.select(last);
|
|
35
|
+
}
|
|
36
|
+
then?.(event);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function blurThen(editor, then) {
|
|
40
|
+
return (event) => {
|
|
41
|
+
editor.select(null);
|
|
42
|
+
then?.(event);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function colorOf(color) {
|
|
46
|
+
return { color };
|
|
47
|
+
}
|
|
48
|
+
function editorOf(state, setSelected) {
|
|
49
|
+
return {
|
|
50
|
+
edit: (text) => {
|
|
51
|
+
setSelected(null);
|
|
52
|
+
state.setValue(withTrailing(state.value, text));
|
|
53
|
+
},
|
|
54
|
+
remove: (index) => {
|
|
55
|
+
setSelected(null);
|
|
56
|
+
state.setValue(withoutToken(state.value, index));
|
|
57
|
+
},
|
|
58
|
+
select: setSelected
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function isPopulated(segments) {
|
|
62
|
+
return segments.some((segment) => segment.text.length > 0);
|
|
63
|
+
}
|
|
64
|
+
function lastTokenOf(segments) {
|
|
65
|
+
return segments.findLastIndex((segment) => segment.type === "token");
|
|
66
|
+
}
|
|
67
|
+
function minWidthOf(minWidth) {
|
|
68
|
+
return { minWidth };
|
|
69
|
+
}
|
|
70
|
+
function removeActionsOf(label, onRemove) {
|
|
71
|
+
return {
|
|
72
|
+
accessibilityActions: [{
|
|
73
|
+
label,
|
|
74
|
+
name: "remove"
|
|
75
|
+
}],
|
|
76
|
+
onAccessibilityAction: (event) => {
|
|
77
|
+
if (event.nativeEvent.actionName === "remove") onRemove();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function removeOf(editor, index) {
|
|
82
|
+
return () => {
|
|
83
|
+
editor.remove(index);
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function toggleOf(editor, index, selected, control) {
|
|
87
|
+
return () => {
|
|
88
|
+
editor.select(selected ? null : index);
|
|
89
|
+
control.current?.focus();
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A labelled field whose value is text with tokens in it, drawn as pills: a
|
|
94
|
+
* tag input, a mention field, a structured search box. Its value is React
|
|
95
|
+
* Stately's `TokenFieldValue`, which the package re-exports: pass `value` with
|
|
96
|
+
* `onChange` to control it, or `defaultValue` to let it keep its own.
|
|
97
|
+
*
|
|
98
|
+
* ```tsx
|
|
99
|
+
* const [value, setValue] = useState(new TokenFieldValue([]))
|
|
100
|
+
*
|
|
101
|
+
* <TokenField label="Label" onChange={setValue} value={value} />
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* What counts as a token is the call site's: subclass `TokenFieldValue` and
|
|
105
|
+
* override `tokenize`, which is handed what is typed after the last pill.
|
|
106
|
+
* `renderToken` decides what each pill holds; without it, the segment's own
|
|
107
|
+
* text.
|
|
108
|
+
*
|
|
109
|
+
* React Native's own `TextInput` props reach the control; `style` and `ref`
|
|
110
|
+
* are the field as a whole, and `inputRef` the control.
|
|
111
|
+
*/
|
|
112
|
+
function TokenField(t0) {
|
|
113
|
+
const $ = c(77);
|
|
114
|
+
let defaultValue;
|
|
115
|
+
let description;
|
|
116
|
+
let error;
|
|
117
|
+
let inputRef;
|
|
118
|
+
let label;
|
|
119
|
+
let leadingIcon;
|
|
120
|
+
let onBlur;
|
|
121
|
+
let onChange;
|
|
122
|
+
let onFocus;
|
|
123
|
+
let onKeyPress;
|
|
124
|
+
let props;
|
|
125
|
+
let ref;
|
|
126
|
+
let renderToken;
|
|
127
|
+
let style;
|
|
128
|
+
let t1;
|
|
129
|
+
let t2;
|
|
130
|
+
let t3;
|
|
131
|
+
let t4;
|
|
132
|
+
let trailingIcon;
|
|
133
|
+
let value;
|
|
134
|
+
if ($[0] !== t0) {
|
|
135
|
+
({defaultValue, description, error, floatingLabel: t1, inputRef, isDisabled: t2, isReadOnly: t3, label, leadingIcon, onBlur, onChange, onFocus, onKeyPress, ref, renderToken, style, trailingIcon, value, variant: t4, ...props} = t0);
|
|
136
|
+
$[0] = t0;
|
|
137
|
+
$[1] = defaultValue;
|
|
138
|
+
$[2] = description;
|
|
139
|
+
$[3] = error;
|
|
140
|
+
$[4] = inputRef;
|
|
141
|
+
$[5] = label;
|
|
142
|
+
$[6] = leadingIcon;
|
|
143
|
+
$[7] = onBlur;
|
|
144
|
+
$[8] = onChange;
|
|
145
|
+
$[9] = onFocus;
|
|
146
|
+
$[10] = onKeyPress;
|
|
147
|
+
$[11] = props;
|
|
148
|
+
$[12] = ref;
|
|
149
|
+
$[13] = renderToken;
|
|
150
|
+
$[14] = style;
|
|
151
|
+
$[15] = t1;
|
|
152
|
+
$[16] = t2;
|
|
153
|
+
$[17] = t3;
|
|
154
|
+
$[18] = t4;
|
|
155
|
+
$[19] = trailingIcon;
|
|
156
|
+
$[20] = value;
|
|
157
|
+
} else {
|
|
158
|
+
defaultValue = $[1];
|
|
159
|
+
description = $[2];
|
|
160
|
+
error = $[3];
|
|
161
|
+
inputRef = $[4];
|
|
162
|
+
label = $[5];
|
|
163
|
+
leadingIcon = $[6];
|
|
164
|
+
onBlur = $[7];
|
|
165
|
+
onChange = $[8];
|
|
166
|
+
onFocus = $[9];
|
|
167
|
+
onKeyPress = $[10];
|
|
168
|
+
props = $[11];
|
|
169
|
+
ref = $[12];
|
|
170
|
+
renderToken = $[13];
|
|
171
|
+
style = $[14];
|
|
172
|
+
t1 = $[15];
|
|
173
|
+
t2 = $[16];
|
|
174
|
+
t3 = $[17];
|
|
175
|
+
t4 = $[18];
|
|
176
|
+
trailingIcon = $[19];
|
|
177
|
+
value = $[20];
|
|
178
|
+
}
|
|
179
|
+
const floatingLabel = t1 === void 0 ? true : t1;
|
|
180
|
+
const isDisabled = t2 === void 0 ? false : t2;
|
|
181
|
+
const isReadOnly = t3 === void 0 ? false : t3;
|
|
182
|
+
const variant = t4 === void 0 ? "filled" : t4;
|
|
183
|
+
const id = useId();
|
|
184
|
+
const theme = useTheme();
|
|
185
|
+
const { fontScale } = useWindowDimensions();
|
|
186
|
+
const control = useRef(null);
|
|
187
|
+
let t5;
|
|
188
|
+
if ($[21] !== defaultValue || $[22] !== onChange || $[23] !== value) {
|
|
189
|
+
t5 = {
|
|
190
|
+
defaultValue,
|
|
191
|
+
onChange,
|
|
192
|
+
value
|
|
193
|
+
};
|
|
194
|
+
$[21] = defaultValue;
|
|
195
|
+
$[22] = onChange;
|
|
196
|
+
$[23] = value;
|
|
197
|
+
$[24] = t5;
|
|
198
|
+
} else t5 = $[24];
|
|
199
|
+
const state = useTokenFieldState(t5);
|
|
200
|
+
const [selected, setSelected] = useState(null);
|
|
201
|
+
const editor = editorOf(state, setSelected);
|
|
202
|
+
const focus = useFieldFocus({
|
|
203
|
+
onBlur: blurThen(editor, onBlur),
|
|
204
|
+
onFocus
|
|
205
|
+
});
|
|
206
|
+
const locale = useLocaleOf(void 0);
|
|
207
|
+
const messages = useMessages();
|
|
208
|
+
const editable = !isDisabled && !isReadOnly;
|
|
209
|
+
const { segments } = state.value;
|
|
210
|
+
const last = lastTokenOf(segments);
|
|
211
|
+
const trailing = segments.slice(last + 1).map(_temp).join("");
|
|
212
|
+
const chosen = selected !== null && segments[selected]?.type === "token" ? selected : null;
|
|
213
|
+
let t6;
|
|
214
|
+
let t7;
|
|
215
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
216
|
+
t6 = () => control.current;
|
|
217
|
+
t7 = [];
|
|
218
|
+
$[25] = t6;
|
|
219
|
+
$[26] = t7;
|
|
220
|
+
} else {
|
|
221
|
+
t6 = $[25];
|
|
222
|
+
t7 = $[26];
|
|
223
|
+
}
|
|
224
|
+
useImperativeHandle(inputRef, t6, t7);
|
|
225
|
+
const T0 = View;
|
|
226
|
+
const T1 = FieldBox;
|
|
227
|
+
const t8 = focus.focused;
|
|
228
|
+
const t9 = error !== void 0;
|
|
229
|
+
let t10;
|
|
230
|
+
if ($[27] !== segments) {
|
|
231
|
+
t10 = isPopulated(segments);
|
|
232
|
+
$[27] = segments;
|
|
233
|
+
$[28] = t10;
|
|
234
|
+
} else t10 = $[28];
|
|
235
|
+
const T2 = FieldWrap;
|
|
236
|
+
const t11 = segments.slice(0, last + 1).map((segment_0, index) => {
|
|
237
|
+
const key = `${String(index)}:${segment_0.text}`;
|
|
238
|
+
if (segment_0.type === "token") return /* @__PURE__ */ jsx(TokenPill, {
|
|
239
|
+
control,
|
|
240
|
+
editor,
|
|
241
|
+
index,
|
|
242
|
+
isDisabled,
|
|
243
|
+
isReadOnly,
|
|
244
|
+
isSelected: chosen === index,
|
|
245
|
+
removeLabel: messages.remove,
|
|
246
|
+
text: segment_0.text,
|
|
247
|
+
children: renderToken === void 0 ? segment_0.text : renderToken(segment_0)
|
|
248
|
+
}, key);
|
|
249
|
+
const words = segment_0.text.trim();
|
|
250
|
+
return words === "" ? null : /* @__PURE__ */ jsx(TokenText, {
|
|
251
|
+
isDisabled,
|
|
252
|
+
children: words
|
|
253
|
+
}, key);
|
|
254
|
+
});
|
|
255
|
+
const T3 = View;
|
|
256
|
+
let t12;
|
|
257
|
+
if ($[29] !== fontScale || $[30] !== theme.typography.bodyLargeSize) {
|
|
258
|
+
t12 = composeStyles(styles.control, minWidthOf(CONTROL_ROOM * theme.typography.bodyLargeSize * fontScale));
|
|
259
|
+
$[29] = fontScale;
|
|
260
|
+
$[30] = theme.typography.bodyLargeSize;
|
|
261
|
+
$[31] = t12;
|
|
262
|
+
} else t12 = $[31];
|
|
263
|
+
const T4 = FieldInput;
|
|
264
|
+
const t13 = focus.handlers;
|
|
265
|
+
let t14;
|
|
266
|
+
if ($[32] !== description || $[33] !== error || $[34] !== id || $[35] !== locale) {
|
|
267
|
+
t14 = describedBy(id, {
|
|
268
|
+
description,
|
|
269
|
+
error,
|
|
270
|
+
locale
|
|
271
|
+
});
|
|
272
|
+
$[32] = description;
|
|
273
|
+
$[33] = error;
|
|
274
|
+
$[34] = id;
|
|
275
|
+
$[35] = locale;
|
|
276
|
+
$[36] = t14;
|
|
277
|
+
} else t14 = $[36];
|
|
278
|
+
const t15 = editor.edit;
|
|
279
|
+
const t16 = backspaceThen(editor, {
|
|
280
|
+
editable,
|
|
281
|
+
last,
|
|
282
|
+
selected: chosen,
|
|
283
|
+
trailing
|
|
284
|
+
}, onKeyPress);
|
|
285
|
+
let t17;
|
|
286
|
+
if ($[37] !== T4 || $[38] !== editable || $[39] !== editor || $[40] !== focus.handlers || $[41] !== label || $[42] !== props || $[43] !== t14 || $[44] !== t16 || $[45] !== trailing) {
|
|
287
|
+
t17 = /* @__PURE__ */ jsx(T4, {
|
|
288
|
+
...props,
|
|
289
|
+
...t13,
|
|
290
|
+
"aria-label": label,
|
|
291
|
+
described: t14,
|
|
292
|
+
editable,
|
|
293
|
+
onChangeText: t15,
|
|
294
|
+
onKeyPress: t16,
|
|
295
|
+
ref: control,
|
|
296
|
+
value: trailing
|
|
297
|
+
});
|
|
298
|
+
$[37] = T4;
|
|
299
|
+
$[38] = editable;
|
|
300
|
+
$[39] = editor;
|
|
301
|
+
$[40] = focus.handlers;
|
|
302
|
+
$[41] = label;
|
|
303
|
+
$[42] = props;
|
|
304
|
+
$[43] = t14;
|
|
305
|
+
$[44] = t16;
|
|
306
|
+
$[45] = trailing;
|
|
307
|
+
$[46] = t17;
|
|
308
|
+
} else t17 = $[46];
|
|
309
|
+
let t18;
|
|
310
|
+
if ($[47] !== T3 || $[48] !== t12 || $[49] !== t17) {
|
|
311
|
+
t18 = /* @__PURE__ */ jsx(T3, {
|
|
312
|
+
style: t12,
|
|
313
|
+
children: t17
|
|
314
|
+
});
|
|
315
|
+
$[47] = T3;
|
|
316
|
+
$[48] = t12;
|
|
317
|
+
$[49] = t17;
|
|
318
|
+
$[50] = t18;
|
|
319
|
+
} else t18 = $[50];
|
|
320
|
+
let t19;
|
|
321
|
+
if ($[51] !== T2 || $[52] !== t11 || $[53] !== t18) {
|
|
322
|
+
t19 = /* @__PURE__ */ jsxs(T2, { children: [t11, t18] });
|
|
323
|
+
$[51] = T2;
|
|
324
|
+
$[52] = t11;
|
|
325
|
+
$[53] = t18;
|
|
326
|
+
$[54] = t19;
|
|
327
|
+
} else t19 = $[54];
|
|
328
|
+
let t20;
|
|
329
|
+
if ($[55] !== T1 || $[56] !== floatingLabel || $[57] !== focus.focused || $[58] !== isDisabled || $[59] !== label || $[60] !== leadingIcon || $[61] !== t10 || $[62] !== t19 || $[63] !== t9 || $[64] !== trailingIcon || $[65] !== variant) {
|
|
330
|
+
t20 = /* @__PURE__ */ jsx(T1, {
|
|
331
|
+
control,
|
|
332
|
+
floatingLabel,
|
|
333
|
+
isDisabled,
|
|
334
|
+
isFocused: t8,
|
|
335
|
+
isInvalid: t9,
|
|
336
|
+
isPopulated: t10,
|
|
337
|
+
label,
|
|
338
|
+
leading: leadingIcon,
|
|
339
|
+
trailing: trailingIcon,
|
|
340
|
+
variant,
|
|
341
|
+
children: t19
|
|
342
|
+
});
|
|
343
|
+
$[55] = T1;
|
|
344
|
+
$[56] = floatingLabel;
|
|
345
|
+
$[57] = focus.focused;
|
|
346
|
+
$[58] = isDisabled;
|
|
347
|
+
$[59] = label;
|
|
348
|
+
$[60] = leadingIcon;
|
|
349
|
+
$[61] = t10;
|
|
350
|
+
$[62] = t19;
|
|
351
|
+
$[63] = t9;
|
|
352
|
+
$[64] = trailingIcon;
|
|
353
|
+
$[65] = variant;
|
|
354
|
+
$[66] = t20;
|
|
355
|
+
} else t20 = $[66];
|
|
356
|
+
let t21;
|
|
357
|
+
if ($[67] !== description || $[68] !== error || $[69] !== id) {
|
|
358
|
+
t21 = /* @__PURE__ */ jsx(FieldMessage, {
|
|
359
|
+
description,
|
|
360
|
+
error,
|
|
361
|
+
id
|
|
362
|
+
});
|
|
363
|
+
$[67] = description;
|
|
364
|
+
$[68] = error;
|
|
365
|
+
$[69] = id;
|
|
366
|
+
$[70] = t21;
|
|
367
|
+
} else t21 = $[70];
|
|
368
|
+
let t22;
|
|
369
|
+
if ($[71] !== T0 || $[72] !== ref || $[73] !== style || $[74] !== t20 || $[75] !== t21) {
|
|
370
|
+
t22 = /* @__PURE__ */ jsxs(T0, {
|
|
371
|
+
ref,
|
|
372
|
+
style,
|
|
373
|
+
children: [t20, t21]
|
|
374
|
+
});
|
|
375
|
+
$[71] = T0;
|
|
376
|
+
$[72] = ref;
|
|
377
|
+
$[73] = style;
|
|
378
|
+
$[74] = t20;
|
|
379
|
+
$[75] = t21;
|
|
380
|
+
$[76] = t22;
|
|
381
|
+
} else t22 = $[76];
|
|
382
|
+
return t22;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* One token's pill: the chips page's input chip, unselected at rest and the
|
|
386
|
+
* selected chip while it is selected, holding what `renderToken` draws, or
|
|
387
|
+
* its text.
|
|
388
|
+
*/
|
|
389
|
+
function _temp(segment) {
|
|
390
|
+
return segment.text;
|
|
391
|
+
}
|
|
392
|
+
function TokenPill(t0) {
|
|
393
|
+
const $ = c(46);
|
|
394
|
+
const { children, control, editor, index, isDisabled, isReadOnly, isSelected, removeLabel, text } = t0;
|
|
395
|
+
const theme = useTheme();
|
|
396
|
+
const [width, setWidth] = useState(48);
|
|
397
|
+
const editable = !isDisabled && !isReadOnly;
|
|
398
|
+
let t1;
|
|
399
|
+
if ($[0] !== isDisabled || $[1] !== isSelected || $[2] !== theme) {
|
|
400
|
+
t1 = paintOf(theme, {
|
|
401
|
+
assist: false,
|
|
402
|
+
disabled: isDisabled,
|
|
403
|
+
elevated: false,
|
|
404
|
+
selected: isSelected
|
|
405
|
+
});
|
|
406
|
+
$[0] = isDisabled;
|
|
407
|
+
$[1] = isSelected;
|
|
408
|
+
$[2] = theme;
|
|
409
|
+
$[3] = t1;
|
|
410
|
+
} else t1 = $[3];
|
|
411
|
+
const paint = t1;
|
|
412
|
+
const eased = useEasedColors(paint);
|
|
413
|
+
let t2;
|
|
414
|
+
if ($[4] !== theme.radii.sm) {
|
|
415
|
+
t2 = { borderRadius: theme.radii.sm };
|
|
416
|
+
$[4] = theme.radii.sm;
|
|
417
|
+
$[5] = t2;
|
|
418
|
+
} else t2 = $[5];
|
|
419
|
+
const t3 = !editable;
|
|
420
|
+
let t4;
|
|
421
|
+
if ($[6] !== paint.layer || $[7] !== t2 || $[8] !== t3) {
|
|
422
|
+
t4 = {
|
|
423
|
+
color: paint.layer,
|
|
424
|
+
corners: t2,
|
|
425
|
+
disabled: t3
|
|
426
|
+
};
|
|
427
|
+
$[6] = paint.layer;
|
|
428
|
+
$[7] = t2;
|
|
429
|
+
$[8] = t3;
|
|
430
|
+
$[9] = t4;
|
|
431
|
+
} else t4 = $[9];
|
|
432
|
+
const feedback = usePressFeedback(t4);
|
|
433
|
+
let t5;
|
|
434
|
+
if ($[10] !== isReadOnly || $[11] !== isSelected) {
|
|
435
|
+
t5 = isReadOnly ? void 0 : {
|
|
436
|
+
role: "button",
|
|
437
|
+
...toggleState(isSelected)
|
|
438
|
+
};
|
|
439
|
+
$[10] = isReadOnly;
|
|
440
|
+
$[11] = isSelected;
|
|
441
|
+
$[12] = t5;
|
|
442
|
+
} else t5 = $[12];
|
|
443
|
+
let t6;
|
|
444
|
+
if ($[13] !== editable || $[14] !== editor || $[15] !== index || $[16] !== removeLabel) {
|
|
445
|
+
t6 = editable ? removeActionsOf(removeLabel, removeOf(editor, index)) : void 0;
|
|
446
|
+
$[13] = editable;
|
|
447
|
+
$[14] = editor;
|
|
448
|
+
$[15] = index;
|
|
449
|
+
$[16] = removeLabel;
|
|
450
|
+
$[17] = t6;
|
|
451
|
+
} else t6 = $[17];
|
|
452
|
+
const t7 = feedback.handlers;
|
|
453
|
+
let t8;
|
|
454
|
+
if ($[18] !== theme || $[19] !== width) {
|
|
455
|
+
t8 = targetOf(width, theme);
|
|
456
|
+
$[18] = theme;
|
|
457
|
+
$[19] = width;
|
|
458
|
+
$[20] = t8;
|
|
459
|
+
} else t8 = $[20];
|
|
460
|
+
let t9;
|
|
461
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
462
|
+
t9 = measureThen(setWidth, void 0);
|
|
463
|
+
$[21] = t9;
|
|
464
|
+
} else t9 = $[21];
|
|
465
|
+
let t10;
|
|
466
|
+
if ($[22] !== control || $[23] !== editable || $[24] !== editor || $[25] !== index || $[26] !== isSelected) {
|
|
467
|
+
t10 = editable ? toggleOf(editor, index, isSelected, control) : void 0;
|
|
468
|
+
$[22] = control;
|
|
469
|
+
$[23] = editable;
|
|
470
|
+
$[24] = editor;
|
|
471
|
+
$[25] = index;
|
|
472
|
+
$[26] = isSelected;
|
|
473
|
+
$[27] = t10;
|
|
474
|
+
} else t10 = $[27];
|
|
475
|
+
let t11;
|
|
476
|
+
if ($[28] !== eased.container || $[29] !== feedback.ring || $[30] !== theme) {
|
|
477
|
+
t11 = composeStyles(stylesOf(theme).pill, eased.container, feedback.ring);
|
|
478
|
+
$[28] = eased.container;
|
|
479
|
+
$[29] = feedback.ring;
|
|
480
|
+
$[30] = theme;
|
|
481
|
+
$[31] = t11;
|
|
482
|
+
} else t11 = $[31];
|
|
483
|
+
let t12;
|
|
484
|
+
if ($[32] !== children || $[33] !== eased.label) {
|
|
485
|
+
t12 = /* @__PURE__ */ jsx(ChipLabel, {
|
|
486
|
+
color: eased.label,
|
|
487
|
+
children
|
|
488
|
+
});
|
|
489
|
+
$[32] = children;
|
|
490
|
+
$[33] = eased.label;
|
|
491
|
+
$[34] = t12;
|
|
492
|
+
} else t12 = $[34];
|
|
493
|
+
let t13;
|
|
494
|
+
if ($[35] !== feedback.handlers || $[36] !== feedback.layer || $[37] !== isDisabled || $[38] !== t10 || $[39] !== t11 || $[40] !== t12 || $[41] !== t5 || $[42] !== t6 || $[43] !== t8 || $[44] !== text) {
|
|
495
|
+
t13 = /* @__PURE__ */ jsxs(AnimatedPressable, {
|
|
496
|
+
...t5,
|
|
497
|
+
...t6,
|
|
498
|
+
...t7,
|
|
499
|
+
"aria-label": text,
|
|
500
|
+
disabled: isDisabled,
|
|
501
|
+
hitSlop: t8,
|
|
502
|
+
onLayout: t9,
|
|
503
|
+
onPress: t10,
|
|
504
|
+
style: t11,
|
|
505
|
+
children: [feedback.layer, t12]
|
|
506
|
+
});
|
|
507
|
+
$[35] = feedback.handlers;
|
|
508
|
+
$[36] = feedback.layer;
|
|
509
|
+
$[37] = isDisabled;
|
|
510
|
+
$[38] = t10;
|
|
511
|
+
$[39] = t11;
|
|
512
|
+
$[40] = t12;
|
|
513
|
+
$[41] = t5;
|
|
514
|
+
$[42] = t6;
|
|
515
|
+
$[43] = t8;
|
|
516
|
+
$[44] = text;
|
|
517
|
+
$[45] = t13;
|
|
518
|
+
} else t13 = $[45];
|
|
519
|
+
return t13;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Text before the last pill, in the value's type and colour, with the spaces
|
|
523
|
+
* at its ends left to the row's gaps.
|
|
524
|
+
*/
|
|
525
|
+
function TokenText(t0) {
|
|
526
|
+
const $ = c(8);
|
|
527
|
+
const { children, isDisabled } = t0;
|
|
528
|
+
const { colors, stateLayerOpacity } = useTheme();
|
|
529
|
+
const role = useTypeRole("bodyLarge");
|
|
530
|
+
let t1;
|
|
531
|
+
if ($[0] !== colors.onSurface || $[1] !== isDisabled || $[2] !== role || $[3] !== stateLayerOpacity) {
|
|
532
|
+
t1 = composeStyles(role, colorOf(isDisabled ? withOpacity(colors.onSurface, stateLayerOpacity.disabledContent) : colors.onSurface), styles.text);
|
|
533
|
+
$[0] = colors.onSurface;
|
|
534
|
+
$[1] = isDisabled;
|
|
535
|
+
$[2] = role;
|
|
536
|
+
$[3] = stateLayerOpacity;
|
|
537
|
+
$[4] = t1;
|
|
538
|
+
} else t1 = $[4];
|
|
539
|
+
let t2;
|
|
540
|
+
if ($[5] !== children || $[6] !== t1) {
|
|
541
|
+
t2 = /* @__PURE__ */ jsx(Text, {
|
|
542
|
+
style: t1,
|
|
543
|
+
children
|
|
544
|
+
});
|
|
545
|
+
$[5] = children;
|
|
546
|
+
$[6] = t1;
|
|
547
|
+
$[7] = t2;
|
|
548
|
+
} else t2 = $[7];
|
|
549
|
+
return t2;
|
|
550
|
+
}
|
|
551
|
+
function withoutToken(value, index) {
|
|
552
|
+
return value.replaceRange({
|
|
553
|
+
index,
|
|
554
|
+
offset: 0
|
|
555
|
+
}, {
|
|
556
|
+
index,
|
|
557
|
+
offset: value.segments[index]?.text.length ?? 0
|
|
558
|
+
}, "");
|
|
559
|
+
}
|
|
560
|
+
function withTrailing(value, text) {
|
|
561
|
+
const { segments } = value;
|
|
562
|
+
const end = segments.length - 1;
|
|
563
|
+
return value.replaceRange({
|
|
564
|
+
index: lastTokenOf(segments) + 1,
|
|
565
|
+
offset: 0
|
|
566
|
+
}, {
|
|
567
|
+
index: end,
|
|
568
|
+
offset: segments[end]?.text.length ?? 0
|
|
569
|
+
}, text);
|
|
570
|
+
}
|
|
571
|
+
//#endregion
|
|
572
|
+
export { TokenField };
|
|
573
|
+
|
|
574
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","RefObject","AccessibilityActionEvent","StyleProp","TextInput","TextInputProps","TextStyle","ViewStyle","AnimatedStyle","TokenFieldSegment","TokenFieldState","TokenFieldValue","TokenSegment","useId","useImperativeHandle","useRef","useState","Text","NativeText","StyleSheet","useWindowDimensions","View","useTokenFieldState","FieldVariant","AnimatedPressable","toggleState","ChipLabel","measureThen","paintOf","targetOf","useEasedColors","stylesOf","describedBy","FieldBox","FieldInput","FieldMessage","FieldWrap","useFieldFocus","useLocaleOf","useMessages","TARGET_SIZE","usePressFeedback","withOpacity","useTheme","composeStyles","useTypeRole","Editor","edit","text","remove","index","select","TokenFieldProps","Omit","defaultValue","T","description","error","floatingLabel","inputRef","isDisabled","isReadOnly","label","leadingIcon","onChange","value","ref","renderToken","segment","style","trailingIcon","variant","CONTROL_ROOM","styles","create","control","flexBasis","flexGrow","flexShrink","backspaceThen","editor","editable","last","selected","trailing","then","event","nativeEvent","key","blurThen","colorOf","color","editorOf","state","setSelected","setValue","withTrailing","withoutToken","isPopulated","segments","some","length","lastTokenOf","findLastIndex","type","minWidthOf","minWidth","removeActionsOf","onRemove","accessibilityActions","name","onAccessibilityAction","actionName","removeOf","toggleOf","current","focus","TokenField","t0","$","_c","onBlur","onFocus","onKeyPress","props","t1","t2","t3","t4","undefined","id","theme","fontScale","t5","locale","messages","slice","map","_temp","join","chosen","t6","t7","Symbol","for","T0","T1","t8","focused","t9","t10","T2","t11","segment_0","String","words","trim","T3","t12","typography","bodyLargeSize","T4","t13","handlers","t14","t15","t16","t17","t18","t19","t20","t21","t22","TokenPill","children","isSelected","removeLabel","width","setWidth","assist","disabled","elevated","paint","eased","radii","sm","borderRadius","layer","corners","feedback","role","const","container","ring","pill","TokenText","colors","stateLayerOpacity","onSurface","disabledContent","replaceRange","offset","end","_c","NativeText"],"sources":["../../../src/components/token-field/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref, RefObject } from 'react'\nimport type {\n AccessibilityActionEvent,\n StyleProp,\n TextInput,\n TextInputProps,\n TextStyle,\n ViewStyle,\n} from 'react-native'\nimport type { AnimatedStyle } from 'react-native-reanimated'\nimport type {\n TokenFieldSegment,\n TokenFieldState,\n TokenFieldValue,\n TokenSegment,\n} from 'react-stately'\n\nimport { useId, useImperativeHandle, useRef, useState } from 'react'\nimport {\n Text as NativeText,\n StyleSheet,\n useWindowDimensions,\n View,\n} from 'react-native'\nimport { useTokenFieldState } from 'react-stately'\n\nimport type { FieldVariant } from '../../field'\n\nimport { AnimatedPressable, toggleState } from '../../button'\nimport {\n ChipLabel,\n measureThen,\n paintOf,\n targetOf,\n useEasedColors,\n} from '../../chip'\nimport { stylesOf } from '../../chip/styles'\nimport {\n describedBy,\n FieldBox,\n FieldInput,\n FieldMessage,\n FieldWrap,\n useFieldFocus,\n} from '../../field'\nimport { useLocaleOf, useMessages } from '../../i18n/provider'\nimport { TARGET_SIZE, usePressFeedback } from '../../press'\nimport { withOpacity } from '../../theme/color'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles } from '../../theme/styles'\nimport { useTypeRole } from '../../typography/roles'\n\n// kanso-ui's TokenField: the chips page's input chips inside a text field, a\n// field whose value is text with pills in it, such as a tag input, a mention\n// field or a structured search box. The box, label, supporting line and error\n// are the field chrome in src/field, shared with every other field, and the\n// pill is src/chip's, shared with Chip and ChipGroup's chip, as on web.\n//\n// The value is React Stately's `TokenFieldValue`, a list of text and token\n// segments rather than a string, and the field does not wrap it. What counts\n// as a token is the call site's to decide, by subclassing it and overriding\n// `tokenize`, which the package re-exports for that, as web's does.\n//\n// **What is typed goes into a text input after the last pill**, since a\n// TextInput holds no views, where web's editable area is a contenteditable\n// element holding both. The pills and any text before the last of them are\n// drawn in a row that wraps, the text with the spaces at its ends given to the\n// row's gaps, and the control holds what follows the last pill, which each\n// edit hands to `tokenize` together. So a token is made where it is typed, at\n// the end, and text before the last pill is shown and kept rather than edited\n// in place: it comes back into the control once the pills after it are\n// removed.\n//\n// **Backspace takes a pill out in two presses.** In an empty control the\n// first selects the pill before it, and the second removes it. A press on a\n// pill selects it, or lets it go if it was selected, and moves focus to the\n// control, so Backspace there takes it out next. Typing, or leaving the\n// field, lets the selection go. A selected pill is the selected input chip,\n// on the secondary container pair, with no check, as web draws it.\n//\n// **Each pill is one element to a screen reader**, named by its text whatever\n// `renderToken` draws in it, and a toggle reporting whether it is selected, as\n// a filter chip reports its state. VoiceOver and TalkBack offer it a remove\n// action named in the provider's locale, which takes a pill out without a\n// keyboard. Read-only, a pill is its text and nothing to press.\n//\n// The control keeps three characters' width at the least after the last pill,\n// starting a line of its own when the line has less left, and scrolls what is\n// typed past its width, as any one-line field does.\n\n/** What the field's parts do to its value and its selected pill. */\ntype Editor = {\n /** Takes what the control holds, after the last pill, as typed. */\n readonly edit: (text: string) => void\n /** Takes the token at a segment's index out of the value. */\n readonly remove: (index: number) => void\n /** Selects the pill at a segment's index, or none. */\n readonly select: (index: null | number) => void\n}\n\ntype TokenFieldProps<T extends TokenFieldValue = TokenFieldValue> = Omit<\n TextInputProps,\n | 'accessibilityHint'\n | 'accessibilityLabel'\n | 'aria-disabled'\n | 'aria-label'\n | 'children'\n | 'cursorColor'\n | 'defaultValue'\n | 'editable'\n | 'maxLength'\n | 'multiline'\n | 'numberOfLines'\n | 'onChange'\n | 'onChangeText'\n | 'placeholder'\n | 'placeholderTextColor'\n | 'readOnly'\n | 'rows'\n | 'selectionColor'\n | 'style'\n | 'underlineColorAndroid'\n | 'value'\n> & {\n /** The value the field opens with, when it keeps its own. */\n readonly defaultValue?: T\n /**\n * A hint shown under the field. Replaced by `error` when there is one, so\n * the two never stack.\n */\n readonly description?: string\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state: the message, the error colours, and the\n * invalid state a screen reader reads all follow from it. The line under\n * the field arrives with the message, so the field grows when this does,\n * unless it is inside a `Form`, which keeps the line drawn.\n */\n readonly error?: string\n /**\n * Whether the label sits in the empty box and floats to the top once the\n * field is focused or holds something. `false` keeps it small at the top in\n * every state.\n * @default true\n */\n readonly floatingLabel?: boolean\n /**\n * A ref to the field's own `TextInput`, which is what a call site moves\n * focus to. `ref` is the field as a whole.\n */\n readonly inputRef?: Ref<ComponentRef<typeof TextInput>>\n /**\n * Draws the field disabled: it takes no focus and no input, and its pills\n * take no presses.\n * @default false\n */\n readonly isDisabled?: boolean\n /**\n * Shows the value and takes focus, but takes no input, and its pills are\n * neither selected nor removed.\n * @default false\n */\n readonly isReadOnly?: boolean\n /**\n * What the field is for, and the name a screen reader reads for it.\n * Required, since a field with no label is a box nobody can name.\n */\n readonly label: string\n /**\n * An icon at the start of the box, before the label and the value: the\n * page's 24dp leading icon, in the muted role. The slot hands it that\n * colour and size through `useIconStyle()`.\n */\n readonly leadingIcon?: ReactNode\n /** Called with the new value as it is edited. */\n readonly onChange?: (value: T) => void\n readonly ref?: Ref<ComponentRef<typeof View>>\n /**\n * What each token holds. Given a segment, return what to draw inside its\n * pill; without it the pill holds the segment's own text, which is what a\n * screen reader reads either way.\n */\n readonly renderToken?: (segment: TokenSegment) => ReactNode\n /** Positions and sizes the field as a whole. */\n readonly style?: StyleProp<ViewStyle>\n /**\n * An icon at the end of the box, after the value: the page's 24dp trailing\n * icon, in the muted role and the error role while the field has an\n * error. The slot hands it that colour and size through `useIconStyle()`.\n */\n readonly trailingIcon?: ReactNode\n /** The value, when the call site keeps it. Pass it with `onChange`. */\n readonly value?: T\n /**\n * The filled box, or the outlined one, as the text fields page draws them.\n * @default 'filled'\n */\n readonly variant?: FieldVariant\n}\n\n// How many characters' width the control keeps after the last pill, in its\n// own type's size.\nconst CONTROL_ROOM = 3\n\nconst styles = StyleSheet.create({\n // Takes what the line has left after the pills, from nothing: a basis of\n // its own would start a new line while the line still had room to type in.\n control: {\n flexBasis: 0,\n flexGrow: 1,\n },\n // Text before the last pill gives way to the line it is on, and wraps\n // within it, rather than running out of the box.\n text: {\n flexShrink: 1,\n },\n})\n\n/**\n * Backspace in an empty control: removes the selected pill where there is\n * one, and selects the last otherwise. With no pill, `last` is -1, which no\n * token holds, so it selects nothing. The call site's own handler runs after.\n */\nfunction backspaceThen(\n editor: Editor,\n {\n editable,\n last,\n selected,\n trailing,\n }: {\n readonly editable: boolean\n readonly last: number\n readonly selected: null | number\n readonly trailing: string\n },\n then: TextInputProps['onKeyPress'],\n): TextInputProps['onKeyPress'] {\n return (event) => {\n if (editable && event.nativeEvent.key === 'Backspace' && trailing === '') {\n if (selected !== null) {\n editor.remove(selected)\n } else {\n editor.select(last)\n }\n }\n then?.(event)\n }\n}\n\n// The field's own blur handling, then the call site's.\nfunction blurThen(\n editor: Editor,\n then: TextInputProps['onBlur'],\n): TextInputProps['onBlur'] {\n return (event) => {\n editor.select(null)\n then?.(event)\n }\n}\n\nfunction colorOf(color: string): TextStyle {\n return { color }\n}\n\nfunction editorOf<T extends TokenFieldValue>(\n state: TokenFieldState<T>,\n setSelected: (index: null | number) => void,\n): Editor {\n return {\n edit: (text) => {\n setSelected(null)\n state.setValue(withTrailing(state.value, text))\n },\n remove: (index) => {\n setSelected(null)\n state.setValue(withoutToken(state.value, index))\n },\n select: setSelected,\n }\n}\n\n// Whether the field holds anything, for the floating label: a token, or text\n// of any length.\nfunction isPopulated(segments: readonly TokenFieldSegment[]) {\n return segments.some((segment) => segment.text.length > 0)\n}\n\n// The index of the last token among the segments, or -1 where there is none.\nfunction lastTokenOf(segments: readonly TokenFieldSegment[]) {\n return segments.findLastIndex((segment) => segment.type === 'token')\n}\n\nfunction minWidthOf(minWidth: number): ViewStyle {\n return { minWidth }\n}\n\n// What a screen reader is offered on a pill: an action that removes it.\nfunction removeActionsOf(label: string, onRemove: () => void) {\n return {\n accessibilityActions: [{ label, name: 'remove' }],\n onAccessibilityAction: (event: AccessibilityActionEvent) => {\n if (event.nativeEvent.actionName === 'remove') {\n onRemove()\n }\n },\n }\n}\n\nfunction removeOf(editor: Editor, index: number) {\n return () => {\n editor.remove(index)\n }\n}\n\n// A press on a pill: selects it, or lets it go if it was selected, and moves\n// focus to the control, where Backspace removes a selected pill.\nfunction toggleOf(\n editor: Editor,\n index: number,\n selected: boolean,\n control: RefObject<ComponentRef<typeof TextInput> | null>,\n) {\n return () => {\n editor.select(selected ? null : index)\n control.current?.focus()\n }\n}\n\n/**\n * A labelled field whose value is text with tokens in it, drawn as pills: a\n * tag input, a mention field, a structured search box. Its value is React\n * Stately's `TokenFieldValue`, which the package re-exports: pass `value` with\n * `onChange` to control it, or `defaultValue` to let it keep its own.\n *\n * ```tsx\n * const [value, setValue] = useState(new TokenFieldValue([]))\n *\n * <TokenField label=\"Label\" onChange={setValue} value={value} />\n * ```\n *\n * What counts as a token is the call site's: subclass `TokenFieldValue` and\n * override `tokenize`, which is handed what is typed after the last pill.\n * `renderToken` decides what each pill holds; without it, the segment's own\n * text.\n *\n * React Native's own `TextInput` props reach the control; `style` and `ref`\n * are the field as a whole, and `inputRef` the control.\n */\nfunction TokenField<T extends TokenFieldValue = TokenFieldValue>({\n defaultValue,\n description,\n error,\n floatingLabel = true,\n inputRef,\n isDisabled = false,\n isReadOnly = false,\n label,\n leadingIcon,\n onBlur,\n onChange,\n onFocus,\n onKeyPress,\n ref,\n renderToken,\n style,\n trailingIcon,\n value,\n variant = 'filled',\n ...props\n}: TokenFieldProps<T>) {\n const id = useId()\n const theme = useTheme()\n const { fontScale } = useWindowDimensions()\n const control = useRef<ComponentRef<typeof TextInput>>(null)\n const state = useTokenFieldState<T>({ defaultValue, onChange, value })\n const [selected, setSelected] = useState<null | number>(null)\n const editor = editorOf(state, setSelected)\n const focus = useFieldFocus({ onBlur: blurThen(editor, onBlur), onFocus })\n const locale = useLocaleOf(undefined)\n const messages = useMessages()\n const editable = !isDisabled && !isReadOnly\n const { segments } = state.value\n const last = lastTokenOf(segments)\n const trailing = segments\n .slice(last + 1)\n .map((segment) => segment.text)\n .join('')\n // A selection the value has moved out from under, by an edit the call site\n // made, selects nothing.\n const chosen =\n selected !== null && segments[selected]?.type === 'token' ? selected : null\n\n useImperativeHandle<\n ComponentRef<typeof TextInput> | null,\n ComponentRef<typeof TextInput> | null\n >(inputRef, () => control.current, [])\n\n return (\n <View ref={ref} style={style}>\n <FieldBox\n control={control}\n floatingLabel={floatingLabel}\n isDisabled={isDisabled}\n isFocused={focus.focused}\n isInvalid={error !== undefined}\n isPopulated={isPopulated(segments)}\n label={label}\n leading={leadingIcon}\n trailing={trailingIcon}\n variant={variant}\n >\n <FieldWrap>\n {segments.slice(0, last + 1).map((segment, index) => {\n const key = `${String(index)}:${segment.text}`\n\n if (segment.type === 'token') {\n return (\n <TokenPill\n control={control}\n editor={editor}\n index={index}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isSelected={chosen === index}\n key={key}\n removeLabel={messages.remove}\n text={segment.text}\n >\n {renderToken === undefined\n ? segment.text\n : renderToken(segment)}\n </TokenPill>\n )\n }\n\n const words = segment.text.trim()\n\n return words === '' ? null : (\n <TokenText isDisabled={isDisabled} key={key}>\n {words}\n </TokenText>\n )\n })}\n <View\n style={composeStyles<ViewStyle>(\n styles.control,\n minWidthOf(\n CONTROL_ROOM * theme.typography.bodyLargeSize * fontScale,\n ),\n )}\n >\n <FieldInput\n {...props}\n {...focus.handlers}\n aria-label={label}\n described={describedBy(id, { description, error, locale })}\n editable={editable}\n onChangeText={editor.edit}\n onKeyPress={backspaceThen(\n editor,\n { editable, last, selected: chosen, trailing },\n onKeyPress,\n )}\n ref={control}\n value={trailing}\n />\n </View>\n </FieldWrap>\n </FieldBox>\n <FieldMessage description={description} error={error} id={id} />\n </View>\n )\n}\n\n/**\n * One token's pill: the chips page's input chip, unselected at rest and the\n * selected chip while it is selected, holding what `renderToken` draws, or\n * its text.\n */\nfunction TokenPill({\n children,\n control,\n editor,\n index,\n isDisabled,\n isReadOnly,\n isSelected,\n removeLabel,\n text,\n}: {\n readonly children: ReactNode\n /** The field's control, which a press on the pill moves focus to. */\n readonly control: RefObject<ComponentRef<typeof TextInput> | null>\n readonly editor: Editor\n /** The token's index among the value's segments. */\n readonly index: number\n readonly isDisabled: boolean\n readonly isReadOnly: boolean\n readonly isSelected: boolean\n readonly removeLabel: string\n readonly text: string\n}) {\n const theme = useTheme()\n // Until the pill is measured it takes no reach across, rather than one\n // sized for a pill of no width.\n const [width, setWidth] = useState(TARGET_SIZE)\n const editable = !isDisabled && !isReadOnly\n const paint = paintOf(theme, {\n assist: false,\n disabled: isDisabled,\n elevated: false,\n selected: isSelected,\n })\n const eased = useEasedColors(paint)\n const feedback = usePressFeedback({\n color: paint.layer,\n corners: { borderRadius: theme.radii.sm },\n disabled: !editable,\n })\n\n return (\n <AnimatedPressable\n {...(isReadOnly\n ? undefined\n : { role: 'button' as const, ...toggleState(isSelected) })}\n {...(editable\n ? removeActionsOf(removeLabel, removeOf(editor, index))\n : undefined)}\n {...feedback.handlers}\n aria-label={text}\n disabled={isDisabled}\n hitSlop={targetOf(width, theme)}\n onLayout={measureThen(setWidth, undefined)}\n onPress={\n editable ? toggleOf(editor, index, isSelected, control) : undefined\n }\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n stylesOf(theme).pill,\n eased.container,\n feedback.ring,\n )}\n >\n {feedback.layer}\n <ChipLabel color={eased.label}>{children}</ChipLabel>\n </AnimatedPressable>\n )\n}\n\n/**\n * Text before the last pill, in the value's type and colour, with the spaces\n * at its ends left to the row's gaps.\n */\nfunction TokenText({\n children,\n isDisabled,\n}: {\n readonly children: string\n readonly isDisabled: boolean\n}) {\n const { colors, stateLayerOpacity } = useTheme()\n const role = useTypeRole('bodyLarge')\n\n return (\n <NativeText\n style={composeStyles<TextStyle>(\n role,\n colorOf(\n isDisabled\n ? withOpacity(colors.onSurface, stateLayerOpacity.disabledContent)\n : colors.onSurface,\n ),\n styles.text,\n )}\n >\n {children}\n </NativeText>\n )\n}\n\n// Takes the token at `index` out, joining the text either side of it.\nfunction withoutToken<T extends TokenFieldValue>(value: T, index: number): T {\n return value.replaceRange(\n { index, offset: 0 },\n { index, offset: value.segments[index]?.text.length ?? 0 },\n '',\n )\n}\n\n// Puts `text` in place of everything after the last token, which hands it to\n// `tokenize`: with no token, the whole value, and with nothing after the last\n// token, the end of it.\nfunction withTrailing<T extends TokenFieldValue>(value: T, text: string): T {\n const { segments } = value\n const end = segments.length - 1\n\n return value.replaceRange(\n { index: lastTokenOf(segments) + 1, offset: 0 },\n { index: end, offset: segments[end]?.text.length ?? 0 },\n text,\n )\n}\n\nexport { TokenField }\nexport type { TokenFieldProps, TokenSegment }\n"],"mappings":";;;;;;;;;;;;;;;;AA0MA,MAAM0E,eAAe;AAErB,MAAMC,SAAStD,WAAWuD,OAAO;CAG/BC,SAAS;EACPC,WAAW;EACXC,UAAU;CACZ;CAGA7B,MAAM,EACJ8B,YAAY,EACd;AACF,CAAC;;;;;;AAOD,SAASC,cACPC,QACA,EACEC,UACAC,MACAC,UACAC,YAOFC,MAC8B;CAC9B,QAAQC,UAAU;EAChB,IAAIL,YAAYK,MAAMC,YAAYC,QAAQ,eAAeJ,aAAa,IAAI;GACxE,IAAID,aAAa,MACfH,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,MAAiB;CAC1E,MAAM,EAAEmD,aAAalC;CACrB,MAAMyI,MAAMvG,SAASE,SAAS;CAE9B,OAAOpC,MAAMuI,aACX;EAAEtJ,OAAOoD,YAAYH,QAAQ,IAAI;EAAGsG,QAAQ;CAAE,GAC9C;EAAEvJ,OAAOwJ;EAAKD,QAAQtG,SAASuG,IAAI,EAAE1J,KAAKqD,UAAU;CAAE,GACtDrD,IACF;AACF"}
|
|
@@ -16,7 +16,8 @@ type TooltipProps = {
|
|
|
16
16
|
readonly alignOffset?: number;
|
|
17
17
|
/**
|
|
18
18
|
* The button the tooltip describes, and nothing else: a `Button`,
|
|
19
|
-
* `IconButton` or `
|
|
19
|
+
* `IconButton`, `Fab` or `Chip`, or a `Popover` or `Menu` whose trigger is
|
|
20
|
+
* one.
|
|
20
21
|
*/
|
|
21
22
|
readonly children?: ReactNode;
|
|
22
23
|
/**
|