@kanso-labs/react-native-kanso-ui 0.3.1 → 0.5.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/dist/autocomplete/index.js +39 -0
- package/dist/autocomplete/index.js.map +1 -0
- package/dist/button/index.d.ts +2 -1
- package/dist/button/index.js +35 -2
- package/dist/button/index.js.map +1 -1
- package/dist/button/pending.js +1 -1
- package/dist/button/slots.d.ts +2 -0
- package/dist/button/slots.js.map +1 -1
- package/dist/chip/index.js +1 -1
- package/dist/components/autocomplete/index.d.ts +49 -0
- package/dist/components/autocomplete/index.js +87 -0
- package/dist/components/autocomplete/index.js.map +1 -0
- package/dist/components/avatar/index.d.ts +1 -1
- package/dist/components/button/index.d.ts +2 -2
- package/dist/components/button/index.js +196 -150
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/card/index.js +1 -1
- package/dist/components/checkbox/index.d.ts +1 -1
- package/dist/components/checkbox/index.js +106 -193
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +1 -1
- package/dist/components/chip-group/index.d.ts +1 -1
- package/dist/components/chip-group/index.js +1 -1
- package/dist/components/copy-field/index.d.ts +1 -1
- package/dist/components/copy-field/index.js +1 -1
- package/dist/components/currency/index.d.ts +1 -1
- package/dist/components/currency/index.js +1 -1
- package/dist/components/dialog/index.d.ts +3 -2
- package/dist/components/dialog/index.js +105 -242
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +2 -2
- package/dist/components/icon-button/index.js +205 -159
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/link/index.d.ts +1 -1
- package/dist/components/link/index.js +1 -1
- package/dist/components/list/index.d.ts +216 -0
- package/dist/components/list/index.js +1118 -0
- package/dist/components/list/index.js.map +1 -0
- package/dist/components/list-item/index.d.ts +63 -0
- package/dist/components/list-item/index.js +275 -0
- package/dist/components/list-item/index.js.map +1 -0
- package/dist/components/menu/index.d.ts +309 -0
- package/dist/components/menu/index.js +1283 -0
- package/dist/components/menu/index.js.map +1 -0
- package/dist/components/meter/index.d.ts +1 -1
- package/dist/components/meter/index.js +1 -1
- package/dist/components/number-field/index.d.ts +1 -1
- package/dist/components/number-field/index.js +2 -2
- package/dist/components/popover/index.d.ts +140 -0
- package/dist/components/popover/index.js +704 -0
- package/dist/components/popover/index.js.map +1 -0
- package/dist/components/product-icon/index.d.ts +1 -1
- package/dist/components/progress-indicator/index.d.ts +1 -1
- package/dist/components/progress-indicator/index.js +1 -1
- package/dist/components/radio-group/index.d.ts +1 -1
- package/dist/components/radio-group/index.js +1 -1
- package/dist/components/search-field/index.d.ts +12 -4
- package/dist/components/search-field/index.js +64 -58
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/segmented-button/index.d.ts +1 -1
- package/dist/components/segmented-button/index.js +1 -1
- package/dist/components/separator/index.d.ts +1 -1
- package/dist/components/separator/index.js +1 -1
- package/dist/components/sheet/index.d.ts +137 -0
- package/dist/components/sheet/index.js +1091 -0
- package/dist/components/sheet/index.js.map +1 -0
- package/dist/components/snackbar/index.d.ts +1 -1
- package/dist/components/snackbar/index.js +1 -1
- package/dist/components/stack/index.d.ts +1 -1
- package/dist/components/stack/index.js +1 -1
- package/dist/components/switch/index.d.ts +1 -1
- package/dist/components/switch/index.js +1 -1
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/text/index.d.ts +1 -1
- package/dist/components/text/index.js +1 -1
- package/dist/components/text-field/index.d.ts +1 -1
- package/dist/components/text-field/index.js +1 -1
- package/dist/control/checkbox-box.js +137 -0
- package/dist/control/checkbox-box.js.map +1 -0
- package/dist/control/index.js +1 -1
- package/dist/field/index.d.ts +1 -1
- package/dist/field/index.js +1 -1
- package/dist/form/index.d.ts +1 -1
- package/dist/glyphs/index.js +21 -2
- package/dist/glyphs/index.js.map +1 -1
- package/dist/i18n/index.js +16 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +374 -34
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +8 -2
- package/dist/indicator/index.d.ts +1 -1
- package/dist/indicator/index.js +2 -2
- package/dist/mark/index.d.ts +1 -1
- package/dist/mark/index.js +1 -1
- package/dist/modal/index.d.ts +16 -0
- package/dist/modal/index.js +277 -0
- package/dist/modal/index.js.map +1 -0
- package/dist/overlay/anchored.d.ts +2 -0
- package/dist/overlay/anchored.js +182 -0
- package/dist/overlay/anchored.js.map +1 -0
- package/dist/overlay/host.d.ts +2 -0
- package/dist/overlay/host.js +1 -1
- package/dist/overlay/index.d.ts +4 -0
- package/dist/overlay/panel.js +215 -0
- package/dist/overlay/panel.js.map +1 -0
- package/dist/overlay/placement.d.ts +8 -0
- package/dist/overlay/placement.js +87 -0
- package/dist/overlay/placement.js.map +1 -0
- package/dist/press/index.js +1 -1
- package/dist/ref/index.js +15 -0
- package/dist/ref/index.js.map +1 -0
- package/dist/router/index.js +1 -1
- package/dist/row/index.js +158 -0
- package/dist/row/index.js.map +1 -0
- package/dist/row/styles.js +51 -0
- package/dist/row/styles.js.map +1 -0
- package/dist/theme/scope.js +1 -1
- package/dist/theme-scope.d.ts +1 -1
- package/dist/theme-scope.js +1 -1
- package/dist/typography/fonts.js +1 -1
- package/package.json +6 -6
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import { CheckGlyph, IndeterminateGlyph } from "../../glyphs/index.js";
|
|
2
1
|
import { useTheme } from "../../theme/scope.js";
|
|
3
2
|
import { composeStyles } from "../../theme/styles.js";
|
|
4
|
-
import { withOpacity } from "../../theme/color.js";
|
|
5
3
|
import { hitSlop, usePressFeedback } from "../../press/index.js";
|
|
6
4
|
import { controlStylesOf } from "../../control/styles.js";
|
|
7
5
|
import { ControlLabel, ControlMessage, describedBy, messageOf } from "../../control/index.js";
|
|
6
|
+
import { CheckboxBox } from "../../control/checkbox-box.js";
|
|
8
7
|
import { c } from "react/compiler-runtime";
|
|
9
|
-
import { Pressable, StyleSheet, View } from "react-native";
|
|
10
8
|
import { useId } from "react";
|
|
11
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
import
|
|
10
|
+
import { Pressable, View } from "react-native";
|
|
13
11
|
import { useToggleState } from "react-stately/useToggleState";
|
|
14
12
|
//#region src/components/checkbox/index.tsx
|
|
15
|
-
const BOX_SIZE = 18;
|
|
16
|
-
const BOX_CORNER = 2;
|
|
17
|
-
const BOX_RULE = 2;
|
|
18
13
|
const LAYERS = {
|
|
19
14
|
error: {
|
|
20
15
|
hover: "error",
|
|
@@ -29,19 +24,6 @@ const LAYERS = {
|
|
|
29
24
|
pressed: "primary"
|
|
30
25
|
}
|
|
31
26
|
};
|
|
32
|
-
const styles = StyleSheet.create({
|
|
33
|
-
box: {
|
|
34
|
-
borderRadius: BOX_CORNER,
|
|
35
|
-
borderWidth: BOX_RULE,
|
|
36
|
-
height: BOX_SIZE,
|
|
37
|
-
width: BOX_SIZE
|
|
38
|
-
},
|
|
39
|
-
glyph: {
|
|
40
|
-
left: 11,
|
|
41
|
-
position: "absolute",
|
|
42
|
-
top: 11
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
27
|
/**
|
|
46
28
|
* A checkbox with its label, and optionally a description or an error under
|
|
47
29
|
* it. Its state is React Stately's, as web's is: pass `isSelected` with
|
|
@@ -63,7 +45,7 @@ const styles = StyleSheet.create({
|
|
|
63
45
|
* positions.
|
|
64
46
|
*/
|
|
65
47
|
function Checkbox(t0) {
|
|
66
|
-
const $ = c(
|
|
48
|
+
const $ = c(69);
|
|
67
49
|
let ariaLabel;
|
|
68
50
|
let children;
|
|
69
51
|
let defaultSelected;
|
|
@@ -155,205 +137,136 @@ function Checkbox(t0) {
|
|
|
155
137
|
} else t9 = $[24];
|
|
156
138
|
const feedback = usePressFeedback(t9);
|
|
157
139
|
const active = feedback.hovered || feedback.pressed || feedback.ring !== void 0;
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
$[
|
|
172
|
-
} else
|
|
173
|
-
const paint = t10;
|
|
174
|
-
const box = useBoxColors(paint);
|
|
175
|
-
const Glyph = isIndeterminate ? IndeterminateGlyph : state.isSelected ? CheckGlyph : null;
|
|
176
|
-
const t11 = isIndeterminate ? "mixed" : state.isSelected;
|
|
177
|
-
let t12;
|
|
178
|
-
if ($[31] !== description || $[32] !== error || $[33] !== messageId) {
|
|
179
|
-
t12 = describedBy(messageId, messageOf(description, error));
|
|
180
|
-
$[31] = description;
|
|
181
|
-
$[32] = error;
|
|
182
|
-
$[33] = messageId;
|
|
183
|
-
$[34] = t12;
|
|
184
|
-
} else t12 = $[34];
|
|
185
|
-
const t13 = feedback.handlers;
|
|
140
|
+
const t10 = isIndeterminate ? "mixed" : state.isSelected;
|
|
141
|
+
let t11;
|
|
142
|
+
if ($[25] !== description || $[26] !== error || $[27] !== messageId) {
|
|
143
|
+
t11 = describedBy(messageId, messageOf(description, error));
|
|
144
|
+
$[25] = description;
|
|
145
|
+
$[26] = error;
|
|
146
|
+
$[27] = messageId;
|
|
147
|
+
$[28] = t11;
|
|
148
|
+
} else t11 = $[28];
|
|
149
|
+
const t12 = feedback.handlers;
|
|
150
|
+
let t13;
|
|
151
|
+
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
|
|
152
|
+
t13 = hitSlop(40, 40);
|
|
153
|
+
$[29] = t13;
|
|
154
|
+
} else t13 = $[29];
|
|
186
155
|
let t14;
|
|
187
|
-
if ($[
|
|
188
|
-
t14 =
|
|
189
|
-
$[
|
|
190
|
-
|
|
156
|
+
if ($[30] !== state) {
|
|
157
|
+
t14 = toggleOf(state);
|
|
158
|
+
$[30] = state;
|
|
159
|
+
$[31] = t14;
|
|
160
|
+
} else t14 = $[31];
|
|
191
161
|
let t15;
|
|
192
|
-
if ($[
|
|
193
|
-
t15 =
|
|
194
|
-
$[
|
|
195
|
-
$[
|
|
196
|
-
} else t15 = $[
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
$[
|
|
202
|
-
|
|
203
|
-
|
|
162
|
+
if ($[32] !== theme) {
|
|
163
|
+
t15 = controlStylesOf(theme);
|
|
164
|
+
$[32] = theme;
|
|
165
|
+
$[33] = t15;
|
|
166
|
+
} else t15 = $[33];
|
|
167
|
+
const t16 = t15.row;
|
|
168
|
+
let t17;
|
|
169
|
+
if ($[34] !== feedback.ring || $[35] !== theme) {
|
|
170
|
+
t17 = composeStyles(controlStylesOf(theme).disc, feedback.ring);
|
|
171
|
+
$[34] = feedback.ring;
|
|
172
|
+
$[35] = theme;
|
|
173
|
+
$[36] = t17;
|
|
174
|
+
} else t17 = $[36];
|
|
204
175
|
let t18;
|
|
205
|
-
if ($[40] !==
|
|
206
|
-
t18 =
|
|
207
|
-
|
|
208
|
-
|
|
176
|
+
if ($[37] !== active || $[38] !== isDisabled || $[39] !== isIndeterminate || $[40] !== state.isSelected || $[41] !== tone) {
|
|
177
|
+
t18 = /* @__PURE__ */ jsx(CheckboxBox, {
|
|
178
|
+
active,
|
|
179
|
+
isDisabled,
|
|
180
|
+
isIndeterminate,
|
|
181
|
+
isSelected: state.isSelected,
|
|
182
|
+
tone,
|
|
183
|
+
within: 40
|
|
184
|
+
});
|
|
185
|
+
$[37] = active;
|
|
186
|
+
$[38] = isDisabled;
|
|
187
|
+
$[39] = isIndeterminate;
|
|
188
|
+
$[40] = state.isSelected;
|
|
189
|
+
$[41] = tone;
|
|
209
190
|
$[42] = t18;
|
|
210
191
|
} else t18 = $[42];
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
$[44] = t20;
|
|
217
|
-
} else t20 = $[44];
|
|
218
|
-
let t21;
|
|
219
|
-
if ($[45] !== t20) {
|
|
220
|
-
t21 = /* @__PURE__ */ jsx(Animated.View, { style: t20 });
|
|
221
|
-
$[45] = t20;
|
|
222
|
-
$[46] = t21;
|
|
223
|
-
} else t21 = $[46];
|
|
224
|
-
let t22;
|
|
225
|
-
if ($[47] !== Glyph || $[48] !== paint) {
|
|
226
|
-
t22 = Glyph === null ? null : /* @__PURE__ */ jsx(Glyph, {
|
|
227
|
-
color: paint.glyph,
|
|
228
|
-
size: BOX_SIZE,
|
|
229
|
-
style: styles.glyph
|
|
230
|
-
});
|
|
231
|
-
$[47] = Glyph;
|
|
232
|
-
$[48] = paint;
|
|
233
|
-
$[49] = t22;
|
|
234
|
-
} else t22 = $[49];
|
|
235
|
-
let t23;
|
|
236
|
-
if ($[50] !== feedback.layer || $[51] !== t18 || $[52] !== t21 || $[53] !== t22) {
|
|
237
|
-
t23 = /* @__PURE__ */ jsxs(View, {
|
|
238
|
-
style: t18,
|
|
239
|
-
children: [
|
|
240
|
-
t19,
|
|
241
|
-
t21,
|
|
242
|
-
t22
|
|
243
|
-
]
|
|
192
|
+
let t19;
|
|
193
|
+
if ($[43] !== feedback.layer || $[44] !== t17 || $[45] !== t18) {
|
|
194
|
+
t19 = /* @__PURE__ */ jsxs(View, {
|
|
195
|
+
style: t17,
|
|
196
|
+
children: [feedback.layer, t18]
|
|
244
197
|
});
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
t24 = /* @__PURE__ */ jsx(ControlLabel, {
|
|
198
|
+
$[43] = feedback.layer;
|
|
199
|
+
$[44] = t17;
|
|
200
|
+
$[45] = t18;
|
|
201
|
+
$[46] = t19;
|
|
202
|
+
} else t19 = $[46];
|
|
203
|
+
let t20;
|
|
204
|
+
if ($[47] !== children || $[48] !== isDisabled) {
|
|
205
|
+
t20 = /* @__PURE__ */ jsx(ControlLabel, {
|
|
254
206
|
isDisabled,
|
|
255
207
|
children
|
|
256
208
|
});
|
|
257
|
-
$[
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
} else
|
|
261
|
-
let
|
|
262
|
-
if ($[
|
|
263
|
-
|
|
264
|
-
"aria-checked":
|
|
209
|
+
$[47] = children;
|
|
210
|
+
$[48] = isDisabled;
|
|
211
|
+
$[49] = t20;
|
|
212
|
+
} else t20 = $[49];
|
|
213
|
+
let t21;
|
|
214
|
+
if ($[50] !== ariaLabel || $[51] !== feedback.handlers || $[52] !== isDisabled || $[53] !== t10 || $[54] !== t11 || $[55] !== t14 || $[56] !== t15.row || $[57] !== t19 || $[58] !== t20) {
|
|
215
|
+
t21 = /* @__PURE__ */ jsxs(Pressable, {
|
|
216
|
+
"aria-checked": t10,
|
|
265
217
|
"aria-label": ariaLabel,
|
|
266
218
|
role: "checkbox",
|
|
219
|
+
...t11,
|
|
267
220
|
...t12,
|
|
268
|
-
...t13,
|
|
269
221
|
disabled: isDisabled,
|
|
270
|
-
hitSlop:
|
|
271
|
-
onPress:
|
|
272
|
-
style:
|
|
273
|
-
children: [
|
|
222
|
+
hitSlop: t13,
|
|
223
|
+
onPress: t14,
|
|
224
|
+
style: t16,
|
|
225
|
+
children: [t19, t20]
|
|
274
226
|
});
|
|
275
|
-
$[
|
|
276
|
-
$[
|
|
277
|
-
$[
|
|
278
|
-
$[
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
$[
|
|
284
|
-
$[
|
|
285
|
-
} else
|
|
286
|
-
let
|
|
287
|
-
if ($[
|
|
288
|
-
|
|
227
|
+
$[50] = ariaLabel;
|
|
228
|
+
$[51] = feedback.handlers;
|
|
229
|
+
$[52] = isDisabled;
|
|
230
|
+
$[53] = t10;
|
|
231
|
+
$[54] = t11;
|
|
232
|
+
$[55] = t14;
|
|
233
|
+
$[56] = t15.row;
|
|
234
|
+
$[57] = t19;
|
|
235
|
+
$[58] = t20;
|
|
236
|
+
$[59] = t21;
|
|
237
|
+
} else t21 = $[59];
|
|
238
|
+
let t22;
|
|
239
|
+
if ($[60] !== description || $[61] !== error || $[62] !== messageId) {
|
|
240
|
+
t22 = /* @__PURE__ */ jsx(ControlMessage, {
|
|
289
241
|
description,
|
|
290
242
|
error,
|
|
291
243
|
id: messageId
|
|
292
244
|
});
|
|
293
|
-
$[
|
|
294
|
-
$[
|
|
295
|
-
$[
|
|
296
|
-
$[
|
|
297
|
-
} else
|
|
298
|
-
let
|
|
299
|
-
if ($[
|
|
300
|
-
|
|
245
|
+
$[60] = description;
|
|
246
|
+
$[61] = error;
|
|
247
|
+
$[62] = messageId;
|
|
248
|
+
$[63] = t22;
|
|
249
|
+
} else t22 = $[63];
|
|
250
|
+
let t23;
|
|
251
|
+
if ($[64] !== props || $[65] !== style || $[66] !== t21 || $[67] !== t22) {
|
|
252
|
+
t23 = /* @__PURE__ */ jsxs(View, {
|
|
301
253
|
...props,
|
|
302
254
|
style,
|
|
303
|
-
children: [
|
|
255
|
+
children: [t21, t22]
|
|
304
256
|
});
|
|
305
|
-
$[
|
|
306
|
-
$[
|
|
307
|
-
$[
|
|
308
|
-
$[
|
|
309
|
-
$[
|
|
310
|
-
} else
|
|
311
|
-
return
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* What the box is painted in: its fill, its rule and the glyph's colour.
|
|
315
|
-
* Where the page draws no fill or no rule it is the colour beside it made
|
|
316
|
-
* clear rather than plain transparent black, so the box eases through its
|
|
317
|
-
* own colour rather than through grey.
|
|
318
|
-
*/
|
|
319
|
-
function paintOf({ colors, stateLayerOpacity }, { active, isDisabled, marked, tone }) {
|
|
320
|
-
const disabled = withOpacity(colors.onSurface, stateLayerOpacity.disabledContent);
|
|
321
|
-
if (marked) {
|
|
322
|
-
const fill = isDisabled ? disabled : tone === "error" ? colors.error : colors.primary;
|
|
323
|
-
return {
|
|
324
|
-
fill,
|
|
325
|
-
glyph: isDisabled ? colors.surface : tone === "error" ? colors.onError : colors.onPrimary,
|
|
326
|
-
rule: withOpacity(fill, 0)
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
const rule = isDisabled ? disabled : tone === "error" ? colors.error : active ? colors.onSurface : colors.onSurfaceVariant;
|
|
330
|
-
return {
|
|
331
|
-
fill: withOpacity(rule, 0),
|
|
332
|
-
glyph: colors.onPrimary,
|
|
333
|
-
rule
|
|
334
|
-
};
|
|
257
|
+
$[64] = props;
|
|
258
|
+
$[65] = style;
|
|
259
|
+
$[66] = t21;
|
|
260
|
+
$[67] = t22;
|
|
261
|
+
$[68] = t23;
|
|
262
|
+
} else t23 = $[68];
|
|
263
|
+
return t23;
|
|
335
264
|
}
|
|
336
265
|
function toggleOf(state) {
|
|
337
266
|
return () => {
|
|
338
267
|
state.toggle();
|
|
339
268
|
};
|
|
340
269
|
}
|
|
341
|
-
function useBoxColors(t0) {
|
|
342
|
-
const { fill, rule } = t0;
|
|
343
|
-
const { motion } = useTheme();
|
|
344
|
-
const reduceMotion = useReducedMotion();
|
|
345
|
-
const timing = {
|
|
346
|
-
duration: motion.durationShort2,
|
|
347
|
-
easing: Easing.bezier(...motion.easingStandard)
|
|
348
|
-
};
|
|
349
|
-
return useAnimatedStyle(() => {
|
|
350
|
-
"worklet";
|
|
351
|
-
return {
|
|
352
|
-
backgroundColor: reduceMotion ? fill : withTiming(fill, timing),
|
|
353
|
-
borderColor: reduceMotion ? rule : withTiming(rule, timing)
|
|
354
|
-
};
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
270
|
//#endregion
|
|
358
271
|
export { Checkbox };
|
|
359
272
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","StyleProp","ViewProps","ViewStyle","AnimatedStyle","ToggleState","useId","Pressable","StyleSheet","View","Animated","Easing","useAnimatedStyle","useReducedMotion","withTiming","useToggleState","ResolvedTheme","ControlLabel","ControlMessage","describedBy","LAYER_SIZE","messageOf","controlStylesOf","CheckGlyph","IndeterminateGlyph","hitSlop","usePressFeedback","withOpacity","useTheme","composeStyles","CheckboxProps","Omit","children","defaultSelected","description","error","isDisabled","isIndeterminate","isReadOnly","isSelected","onChange","ref","style","Tone","BOX_SIZE","BOX_CORNER","BOX_RULE","LAYERS","Readonly","Record","hover","pressed","marked","unmarked","styles","create","box","borderRadius","borderWidth","height","width","glyph","left","position","top","Checkbox","t0","$","_c","ariaLabel","props","t1","t2","t3","undefined","theme","t4","state","messageId","colors","radii","interactive","tone","t5","t6","circle","t7","t8","t9","color","corners","disabled","disc","pressedColor","feedback","active","hovered","ring","t10","paintOf","paint","useBoxColors","Glyph","t11","t12","t13","handlers","t14","Symbol","for","t15","toggleOf","t16","t17","row","t18","t19","layer","t20","t21","t22","t23","t24","t25","t26","t27","stateLayerOpacity","onSurface","disabledContent","fill","primary","surface","onError","onPrimary","rule","onSurfaceVariant","toggle","motion","reduceMotion","timing","duration","durationShort2","easing","bezier","easingStandard","backgroundColor","borderColor","_c"],"sources":["../../../src/components/checkbox/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type { StyleProp, ViewProps, ViewStyle } from 'react-native'\nimport type { AnimatedStyle } from 'react-native-reanimated'\nimport type { ToggleState } from 'react-stately/useToggleState'\n\nimport { useId } from 'react'\nimport { Pressable, StyleSheet, View } from 'react-native'\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useReducedMotion,\n withTiming,\n} from 'react-native-reanimated'\nimport { useToggleState } from 'react-stately/useToggleState'\n\nimport type { ResolvedTheme } from '../../theme/scope'\n\nimport {\n ControlLabel,\n ControlMessage,\n describedBy,\n LAYER_SIZE,\n messageOf,\n} from '../../control'\nimport { controlStylesOf } from '../../control/styles'\nimport { CheckGlyph, IndeterminateGlyph } from '../../glyphs'\nimport { hitSlop, usePressFeedback } from '../../press'\nimport { withOpacity } from '../../theme/color'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles } from '../../theme/styles'\n\n// The checkbox page, as kanso-ui's Checkbox draws it: an 18dp box with a 2dp\n// corner and an 18dp glyph, inside a 40dp state layer, with a 48dp target.\n// Unselected, the box is a 2dp rule in on surface variant that turns on\n// surface while hovered, pressed or focused; selected or indeterminate, it\n// fills with primary and the glyph takes on primary. The error pair is error\n// and on error, and disabled is on surface at the disabled opacity for the\n// rule or the fill, with the glyph in surface. The state layer is on surface\n// over an unselected box and primary over a selected one while hovered, and\n// the two swap once pressed.\n//\n// The box eases between its colours over the motion tokens' short duration\n// on the standard curve, as web's transition does, and at once for a reader\n// who asks the device for reduced motion. The glyph arrives with the fill.\n//\n// The row, the label and the line under it are src/control's, which Radio\n// and Switch draw through as well. The whole row is the `Pressable`, so a\n// press on the label toggles the box, as a press on web's label does. The\n// line under it is outside the row, as web's is outside its label.\n//\n// The corner is a literal: the page's 2dp is a step the shape scale does not\n// carry.\n\ntype CheckboxProps = Omit<ViewProps, 'children' | 'style'> & {\n /**\n * The label, beside the box. A checkbox that a row labels some other way\n * leaves it out and passes `aria-label` instead.\n */\n readonly children?: ReactNode\n /**\n * Whether the checkbox starts selected, when it keeps its own state.\n * @default false\n */\n readonly defaultSelected?: boolean\n /**\n * A hint under the label. Replaced by `error` when there is one, so the\n * 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 checkbox in its error state: the message and the error colours both\n * follow from it.\n */\n readonly error?: string\n /**\n * Draws the checkbox disabled, and takes no presses.\n * @default false\n */\n readonly isDisabled?: boolean\n /**\n * Draws the dash for a box that stands for a partly selected set, and\n * reports the box as mixed to a screen reader. It is the call site's to\n * clear: a press still changes `isSelected` underneath.\n * @default false\n */\n readonly isIndeterminate?: boolean\n /**\n * Shows the state without letting a press change it.\n * @default false\n */\n readonly isReadOnly?: boolean\n /**\n * Whether the checkbox is selected, for a call site holding the state\n * itself with `onChange`.\n */\n readonly isSelected?: boolean\n /** Called with the new state whenever a press changes it. */\n readonly onChange?: (isSelected: boolean) => void\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n}\n\ntype Tone = 'error' | 'marked' | 'unmarked'\n\n// The box's side, its rule and its corner, from the page. The glyph is the\n// box's size and sits over the whole of it, rule included.\nconst BOX_SIZE = 18\nconst BOX_CORNER = 2\nconst BOX_RULE = 2\n\n// The state layer's colour roles, hovered or focused and pressed. Error is\n// error throughout; otherwise the two swap once pressed.\nconst LAYERS: Readonly<\n Record<\n Tone,\n {\n readonly hover: keyof ResolvedTheme['colors']\n readonly pressed: keyof ResolvedTheme['colors']\n }\n >\n> = {\n error: { hover: 'error', pressed: 'error' },\n marked: { hover: 'primary', pressed: 'onSurface' },\n unmarked: { hover: 'onSurface', pressed: 'primary' },\n}\n\nconst styles = StyleSheet.create({\n box: {\n borderRadius: BOX_CORNER,\n borderWidth: BOX_RULE,\n height: BOX_SIZE,\n width: BOX_SIZE,\n },\n // Over the box rather than inside it, since a box's children are laid out\n // inside its rule and the glyph covers the rule as well.\n glyph: {\n left: (LAYER_SIZE - BOX_SIZE) / 2,\n position: 'absolute',\n top: (LAYER_SIZE - BOX_SIZE) / 2,\n },\n})\n\n/**\n * A checkbox with its label, and optionally a description or an error under\n * it. Its state is React Stately's, as web's is: pass `isSelected` with\n * `onChange` to control it, or `defaultSelected` to let it keep its own.\n * `isIndeterminate` draws the dash for a box that stands for a partly\n * selected set.\n *\n * ```tsx\n * <Checkbox defaultSelected description=\"Supporting line\">\n * Label\n * </Checkbox>\n * ```\n *\n * A screen reader hears it as a checkbox named by its label, checked,\n * unchecked or mixed, followed by the line under it. A press anywhere on the\n * box or the label toggles it, and the row takes presses over the 48dp target\n * the page asks of the box. `style`, `ref` and `testID` land on the view\n * holding the row and the line under it, which is the element a layout\n * positions.\n */\nfunction Checkbox({\n 'aria-label': ariaLabel,\n children,\n defaultSelected,\n description,\n error,\n isDisabled = false,\n isIndeterminate = false,\n isReadOnly = false,\n isSelected,\n onChange,\n style,\n ...props\n}: CheckboxProps) {\n const theme = useTheme()\n const state = useToggleState({\n defaultSelected,\n isReadOnly,\n isSelected,\n onChange,\n })\n const messageId = useId()\n\n const { colors, radii } = theme\n const marked = state.isSelected || isIndeterminate\n const interactive = !isDisabled && !isReadOnly\n const tone: Tone =\n error === undefined ? (marked ? 'marked' : 'unmarked') : 'error'\n\n const feedback = usePressFeedback({\n color: colors[LAYERS[tone].hover],\n corners: { borderRadius: radii.circle },\n disabled: !interactive,\n disc: LAYER_SIZE,\n pressedColor: colors[LAYERS[tone].pressed],\n })\n const active =\n feedback.hovered || feedback.pressed || feedback.ring !== undefined\n const paint = paintOf(theme, { active, isDisabled, marked, tone })\n const box = useBoxColors(paint)\n const Glyph = isIndeterminate\n ? IndeterminateGlyph\n : state.isSelected\n ? CheckGlyph\n : null\n\n return (\n <View {...props} style={style}>\n <Pressable\n aria-checked={isIndeterminate ? 'mixed' : state.isSelected}\n aria-label={ariaLabel}\n role=\"checkbox\"\n {...describedBy(messageId, messageOf(description, error))}\n {...feedback.handlers}\n disabled={isDisabled}\n hitSlop={hitSlop(LAYER_SIZE, LAYER_SIZE)}\n onPress={toggleOf(state)}\n style={controlStylesOf(theme).row}\n >\n <View\n style={composeStyles<ViewStyle>(\n controlStylesOf(theme).disc,\n feedback.ring,\n )}\n >\n {feedback.layer}\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(styles.box, box)}\n />\n {Glyph === null ? null : (\n <Glyph color={paint.glyph} size={BOX_SIZE} style={styles.glyph} />\n )}\n </View>\n <ControlLabel isDisabled={isDisabled}>{children}</ControlLabel>\n </Pressable>\n <ControlMessage description={description} error={error} id={messageId} />\n </View>\n )\n}\n\n/**\n * What the box is painted in: its fill, its rule and the glyph's colour.\n * Where the page draws no fill or no rule it is the colour beside it made\n * clear rather than plain transparent black, so the box eases through its\n * own colour rather than through grey.\n */\nfunction paintOf(\n { colors, stateLayerOpacity }: ResolvedTheme,\n {\n active,\n isDisabled,\n marked,\n tone,\n }: {\n readonly active: boolean\n readonly isDisabled: boolean\n readonly marked: boolean\n readonly tone: Tone\n },\n) {\n const disabled = withOpacity(\n colors.onSurface,\n stateLayerOpacity.disabledContent,\n )\n\n if (marked) {\n const fill = isDisabled\n ? disabled\n : tone === 'error'\n ? colors.error\n : colors.primary\n const glyph = isDisabled\n ? colors.surface\n : tone === 'error'\n ? colors.onError\n : colors.onPrimary\n\n return { fill, glyph, rule: withOpacity(fill, 0) }\n }\n\n const rule = isDisabled\n ? disabled\n : tone === 'error'\n ? colors.error\n : active\n ? colors.onSurface\n : colors.onSurfaceVariant\n\n return { fill: withOpacity(rule, 0), glyph: colors.onPrimary, rule }\n}\n\n// A press's toggle. Built by a call rather than declared in the component,\n// which is what react-perf's jsx-no-new-function-as-prop is after; the React\n// Compiler memoises the result on its input.\nfunction toggleOf(state: ToggleState) {\n return () => {\n state.toggle()\n }\n}\n\n// The box's fill and rule, eased to as the state changes.\nfunction useBoxColors({ fill, rule }: { fill: string; rule: string }) {\n const { motion } = useTheme()\n const reduceMotion = useReducedMotion()\n const timing = {\n duration: motion.durationShort2,\n easing: Easing.bezier(...motion.easingStandard),\n }\n\n return useAnimatedStyle(() => {\n 'worklet'\n return {\n backgroundColor: reduceMotion ? fill : withTiming(fill, timing),\n borderColor: reduceMotion ? rule : withTiming(rule, timing),\n }\n })\n}\n\nexport { Checkbox }\nexport type { CheckboxProps }\n"],"mappings":";;;;;;;;;;;;;;AA2GA,MAAM8C,WAAW;AACjB,MAAMC,aAAa;AACnB,MAAMC,WAAW;AAIjB,MAAMC,SAQF;CACFZ,OAAO;EAAEe,OAAO;EAASC,SAAS;CAAQ;CAC1CC,QAAQ;EAAEF,OAAO;EAAWC,SAAS;CAAY;CACjDE,UAAU;EAAEH,OAAO;EAAaC,SAAS;CAAU;AACrD;AAEA,MAAMG,SAAS9C,WAAW+C,OAAO;CAC/BC,KAAK;EACHC,cAAcZ;EACda,aAAaZ;EACba,QAAQf;EACRgB,OAAOhB;CACT;CAGAiB,OAAO;EACLC,MAAAA;EACAC,UAAU;EACVC,KAAAA;CACF;AACF,CAAC;;;;;;;;;;;;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eAAqB7H,iBAAiB;CACtC,MAAA8H,SAAe;EAAAC,UACHH,OAAMI;EAAeC,QACvBnI,OAAMoI,OAAO,GAAIN,OAAMO,cAAe;CAChD;CAAC,OAEMpI,uBAAiB;EAAA;EAAA,OAEf;GAAAqI,iBACYP,eAAAT,OAAsBnH,WAAWmH,MAAMU,MAAM;GAACO,aAClDR,eAAAJ,OAAsBxH,WAAWwH,MAAMK,MAAM;EAC5D;CAAC,CACF;AAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","StyleProp","ViewProps","ViewStyle","ToggleState","useId","Pressable","View","useToggleState","CheckboxTone","ResolvedTheme","ControlLabel","ControlMessage","describedBy","LAYER_SIZE","messageOf","CheckboxBox","controlStylesOf","hitSlop","usePressFeedback","useTheme","composeStyles","CheckboxProps","Omit","children","defaultSelected","description","error","isDisabled","isIndeterminate","isReadOnly","isSelected","onChange","ref","style","LAYERS","Readonly","Record","hover","pressed","marked","unmarked","Checkbox","t0","$","_c","ariaLabel","props","t1","t2","t3","undefined","theme","t4","state","messageId","colors","radii","interactive","tone","t5","t6","circle","borderRadius","t7","t8","t9","color","corners","disabled","disc","pressedColor","feedback","active","hovered","ring","t10","t11","t12","handlers","t13","Symbol","for","t14","toggleOf","t15","t16","row","t17","t18","t19","layer","t20","t21","t22","t23","toggle","_c"],"sources":["../../../src/components/checkbox/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type { StyleProp, ViewProps, ViewStyle } from 'react-native'\nimport type { ToggleState } from 'react-stately/useToggleState'\n\nimport { useId } from 'react'\nimport { Pressable, View } from 'react-native'\nimport { useToggleState } from 'react-stately/useToggleState'\n\nimport type { CheckboxTone } from '../../control/checkbox-box'\nimport type { ResolvedTheme } from '../../theme/scope'\n\nimport {\n ControlLabel,\n ControlMessage,\n describedBy,\n LAYER_SIZE,\n messageOf,\n} from '../../control'\nimport { CheckboxBox } from '../../control/checkbox-box'\nimport { controlStylesOf } from '../../control/styles'\nimport { hitSlop, usePressFeedback } from '../../press'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles } from '../../theme/styles'\n\n// The checkbox page, as kanso-ui's Checkbox draws it: an 18dp box with a 2dp\n// corner and an 18dp glyph, inside a 40dp state layer, with a 48dp target.\n// Unselected, the box is a 2dp rule in on surface variant that turns on\n// surface while hovered, pressed or focused; selected or indeterminate, it\n// fills with primary and the glyph takes on primary. The error pair is error\n// and on error, and disabled is on surface at the disabled opacity for the\n// rule or the fill, with the glyph in surface. The state layer is on surface\n// over an unselected box and primary over a selected one while hovered, and\n// the two swap once pressed.\n//\n// The box eases between its colours over the motion tokens' short duration\n// on the standard curve, as web's transition does, and at once for a reader\n// who asks the device for reduced motion. The glyph arrives with the fill.\n//\n// The row, the label and the line under it are src/control's, which Radio\n// and Switch draw through as well. The whole row is the `Pressable`, so a\n// press on the label toggles the box, as a press on web's label does. The\n// line under it is outside the row, as web's is outside its label.\n//\n// The corner is a literal: the page's 2dp is a step the shape scale does not\n// carry.\n\ntype CheckboxProps = Omit<ViewProps, 'children' | 'style'> & {\n /**\n * The label, beside the box. A checkbox that a row labels some other way\n * leaves it out and passes `aria-label` instead.\n */\n readonly children?: ReactNode\n /**\n * Whether the checkbox starts selected, when it keeps its own state.\n * @default false\n */\n readonly defaultSelected?: boolean\n /**\n * A hint under the label. Replaced by `error` when there is one, so the\n * 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 checkbox in its error state: the message and the error colours both\n * follow from it.\n */\n readonly error?: string\n /**\n * Draws the checkbox disabled, and takes no presses.\n * @default false\n */\n readonly isDisabled?: boolean\n /**\n * Draws the dash for a box that stands for a partly selected set, and\n * reports the box as mixed to a screen reader. It is the call site's to\n * clear: a press still changes `isSelected` underneath.\n * @default false\n */\n readonly isIndeterminate?: boolean\n /**\n * Shows the state without letting a press change it.\n * @default false\n */\n readonly isReadOnly?: boolean\n /**\n * Whether the checkbox is selected, for a call site holding the state\n * itself with `onChange`.\n */\n readonly isSelected?: boolean\n /** Called with the new state whenever a press changes it. */\n readonly onChange?: (isSelected: boolean) => void\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n}\n\n// The state layer's colour roles, hovered or focused and pressed. Error is\n// error throughout; otherwise the two swap once pressed.\nconst LAYERS: Readonly<\n Record<\n CheckboxTone,\n {\n readonly hover: keyof ResolvedTheme['colors']\n readonly pressed: keyof ResolvedTheme['colors']\n }\n >\n> = {\n error: { hover: 'error', pressed: 'error' },\n marked: { hover: 'primary', pressed: 'onSurface' },\n unmarked: { hover: 'onSurface', pressed: 'primary' },\n}\n\n/**\n * A checkbox with its label, and optionally a description or an error under\n * it. Its state is React Stately's, as web's is: pass `isSelected` with\n * `onChange` to control it, or `defaultSelected` to let it keep its own.\n * `isIndeterminate` draws the dash for a box that stands for a partly\n * selected set.\n *\n * ```tsx\n * <Checkbox defaultSelected description=\"Supporting line\">\n * Label\n * </Checkbox>\n * ```\n *\n * A screen reader hears it as a checkbox named by its label, checked,\n * unchecked or mixed, followed by the line under it. A press anywhere on the\n * box or the label toggles it, and the row takes presses over the 48dp target\n * the page asks of the box. `style`, `ref` and `testID` land on the view\n * holding the row and the line under it, which is the element a layout\n * positions.\n */\nfunction Checkbox({\n 'aria-label': ariaLabel,\n children,\n defaultSelected,\n description,\n error,\n isDisabled = false,\n isIndeterminate = false,\n isReadOnly = false,\n isSelected,\n onChange,\n style,\n ...props\n}: CheckboxProps) {\n const theme = useTheme()\n const state = useToggleState({\n defaultSelected,\n isReadOnly,\n isSelected,\n onChange,\n })\n const messageId = useId()\n\n const { colors, radii } = theme\n const marked = state.isSelected || isIndeterminate\n const interactive = !isDisabled && !isReadOnly\n const tone: CheckboxTone =\n error === undefined ? (marked ? 'marked' : 'unmarked') : 'error'\n\n const feedback = usePressFeedback({\n color: colors[LAYERS[tone].hover],\n corners: { borderRadius: radii.circle },\n disabled: !interactive,\n disc: LAYER_SIZE,\n pressedColor: colors[LAYERS[tone].pressed],\n })\n const active =\n feedback.hovered || feedback.pressed || feedback.ring !== undefined\n\n return (\n <View {...props} style={style}>\n <Pressable\n aria-checked={isIndeterminate ? 'mixed' : state.isSelected}\n aria-label={ariaLabel}\n role=\"checkbox\"\n {...describedBy(messageId, messageOf(description, error))}\n {...feedback.handlers}\n disabled={isDisabled}\n hitSlop={hitSlop(LAYER_SIZE, LAYER_SIZE)}\n onPress={toggleOf(state)}\n style={controlStylesOf(theme).row}\n >\n <View\n style={composeStyles<ViewStyle>(\n controlStylesOf(theme).disc,\n feedback.ring,\n )}\n >\n {feedback.layer}\n <CheckboxBox\n active={active}\n isDisabled={isDisabled}\n isIndeterminate={isIndeterminate}\n isSelected={state.isSelected}\n tone={tone}\n within={LAYER_SIZE}\n />\n </View>\n <ControlLabel isDisabled={isDisabled}>{children}</ControlLabel>\n </Pressable>\n <ControlMessage description={description} error={error} id={messageId} />\n </View>\n )\n}\n\n// A press's toggle. Built by a call rather than declared in the component,\n// which is what react-perf's jsx-no-new-function-as-prop is after; the React\n// Compiler memoises the result on its input.\nfunction toggleOf(state: ToggleState) {\n return () => {\n state.toggle()\n }\n}\n\nexport { Checkbox }\nexport type { CheckboxProps }\n"],"mappings":";;;;;;;;;;;;AAkGA,MAAMqC,SAQF;CACFR,OAAO;EAAEW,OAAO;EAASC,SAAS;CAAQ;CAC1CC,QAAQ;EAAEF,OAAO;EAAWC,SAAS;CAAY;CACjDE,UAAU;EAAEH,OAAO;EAAaC,SAAS;CAAU;AACrD;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAAG,SAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAtB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAI;CAAA,IAAAC;CAAA,IAAAe;CAAA,IAAAb;CAAA,IAAAc;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAN,EAAA,OAAAD,IAAA;EAAkB,CAAA,C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CAAA,IAAAlD,EAAA,QAAAlB,eAAAkB,EAAA,QAAAjB,SAAAiB,EAAA,QAAAW,WAAA;EACZuC,MAAA,oBAAC,gBAAD;GAA6BpE;GAAoBC;GAAW4B,IAAAA;EAAS,CAAA;EAAIX,EAAA,MAAAlB;EAAAkB,EAAA,MAAAjB;EAAAiB,EAAA,MAAAW;EAAAX,EAAA,MAAAkD;CAAA,OAAAA,MAAAlD,EAAA;CAAA,IAAAmD;CAAA,IAAAnD,EAAA,QAAAG,SAAAH,EAAA,QAAAV,SAAAU,EAAA,QAAAiD,OAAAjD,EAAA,QAAAkD,KAAA;EA9B3EC,MAAA,qBAAC,MAAD;GAAK,GAAKhD;GAAcb;GAAxB,UAAA,CACE2D,KA6BAC,GA9BG;;EA+BElD,EAAA,MAAAG;EAAAH,EAAA,MAAAV;EAAAU,EAAA,MAAAiD;EAAAjD,EAAA,MAAAkD;EAAAlD,EAAA,MAAAmD;CAAA,OAAAA,MAAAnD,EAAA;CAAA,OA/BPmD;AA+BO;AAOX,SAASX,SAAS9B,OAAoB;CACpC,aAAa;EACXA,MAAM0C,OAAO;CACf;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PressableProps, StyleProp, View, ViewStyle } from "react-native";
|
|
2
1
|
import { ComponentRef, ReactNode, Ref } from "react";
|
|
2
|
+
import { PressableProps, StyleProp, View, ViewStyle } from "react-native";
|
|
3
3
|
//#region src/components/chip/index.d.ts
|
|
4
4
|
/** An assist or suggestion chip: an action, drawn as a plain button. */
|
|
5
5
|
type ChipActionProps = ChipBaseProps & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PressableProps, StyleProp, View, ViewProps, ViewStyle } from "react-native";
|
|
2
1
|
import { ComponentRef, ReactElement, ReactNode, Ref } from "react";
|
|
2
|
+
import { PressableProps, StyleProp, View, ViewProps, ViewStyle } from "react-native";
|
|
3
3
|
import { Key, Selection, SelectionMode } from "react-stately";
|
|
4
4
|
//#region src/components/chip-group/index.d.ts
|
|
5
5
|
type ChipGroupChipProps = Omit<PressableProps, 'children' | 'disabled' | 'id' | 'style'> & {
|
|
@@ -7,9 +7,9 @@ import { usePressFeedback } from "../../press/index.js";
|
|
|
7
7
|
import { stylesOf } from "../../chip/styles.js";
|
|
8
8
|
import { ChipGlyph, ChipLabel, measureThen, paintOf, targetOf, useEasedColors } from "../../chip/index.js";
|
|
9
9
|
import { c } from "react/compiler-runtime";
|
|
10
|
-
import { Platform, Pressable, StyleSheet, Text, View } from "react-native";
|
|
11
10
|
import { useId, useState } from "react";
|
|
12
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { Platform, Pressable, StyleSheet, Text, View } from "react-native";
|
|
13
13
|
import Animated from "react-native-reanimated";
|
|
14
14
|
import { useListState } from "react-stately/useListState";
|
|
15
15
|
//#region src/components/chip-group/index.tsx
|
|
@@ -5,9 +5,9 @@ import { useTypeRole } from "../../typography/roles.js";
|
|
|
5
5
|
import { Button } from "../button/index.js";
|
|
6
6
|
import { useClipboardAvailable, writeClipboard } from "../../clipboard/index.js";
|
|
7
7
|
import { c } from "react/compiler-runtime";
|
|
8
|
-
import { AccessibilityInfo, Platform, StyleSheet, Text, View } from "react-native";
|
|
9
8
|
import { useEffect, useRef, useState } from "react";
|
|
10
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { AccessibilityInfo, Platform, StyleSheet, Text, View } from "react-native";
|
|
11
11
|
//#region src/components/copy-field/index.tsx
|
|
12
12
|
const COPIED_RESET_MS = 2e3;
|
|
13
13
|
const RESERVE = {
|
|
@@ -3,8 +3,8 @@ import { composeStyles, themedStyles } from "../../theme/styles.js";
|
|
|
3
3
|
import { useFontFamily } from "../../typography/fonts.js";
|
|
4
4
|
import { familyStyle, nativeWeight } from "../../typography/roles.js";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
6
|
-
import { StyleSheet, Text } from "react-native";
|
|
7
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { StyleSheet, Text } from "react-native";
|
|
8
8
|
//#region src/components/currency/index.tsx
|
|
9
9
|
const stylesOf = themedStyles(({ colors, typography }) => StyleSheet.create({
|
|
10
10
|
base: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModalOpenProps } from "../../modal/index.js";
|
|
2
2
|
import { ComponentRef, ReactNode, Ref } from "react";
|
|
3
|
+
import { HostInstance, ScrollView, ScrollViewProps, StyleProp, TextProps, View, ViewProps, ViewStyle } from "react-native";
|
|
3
4
|
//#region src/components/dialog/index.d.ts
|
|
4
5
|
type DialogBodyProps = ScrollViewProps & {
|
|
5
6
|
readonly ref?: Ref<ComponentRef<typeof ScrollView>>;
|
|
@@ -31,7 +32,7 @@ type DialogContentProps = DialogOpenProps & Omit<ViewProps, 'children' | 'role'
|
|
|
31
32
|
readonly role?: 'alertdialog' | 'dialog';
|
|
32
33
|
readonly style?: StyleProp<ViewStyle>;
|
|
33
34
|
};
|
|
34
|
-
type DialogOpenProps = {
|
|
35
|
+
type DialogOpenProps = ModalOpenProps & {
|
|
35
36
|
/** Whether the dialog starts open, when it keeps its own state. */
|
|
36
37
|
readonly defaultOpen?: boolean;
|
|
37
38
|
/** Whether the dialog is open, when the call site holds the state. */
|