@kanso-labs/react-native-kanso-ui 0.1.0 → 0.2.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/button/index.d.ts +24 -2
- package/dist/button/index.js.map +1 -1
- package/dist/button/pending.js +144 -0
- package/dist/button/pending.js.map +1 -0
- package/dist/components/button/index.d.ts +1 -1
- package/dist/components/button/index.js +154 -112
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +1 -1
- package/dist/components/icon-button/index.js +160 -110
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/meter/index.d.ts +73 -0
- package/dist/components/meter/index.js +179 -0
- package/dist/components/meter/index.js.map +1 -0
- package/dist/components/number-field/index.js +1 -9
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/progress-indicator/index.d.ts +113 -0
- package/dist/components/progress-indicator/index.js +1024 -0
- package/dist/components/progress-indicator/index.js.map +1 -0
- package/dist/components/snackbar/index.d.ts +120 -0
- package/dist/components/snackbar/index.js +540 -0
- package/dist/components/snackbar/index.js.map +1 -0
- package/dist/glyphs/hidden.js +13 -0
- package/dist/glyphs/hidden.js.map +1 -0
- package/dist/glyphs/index.js +2 -8
- package/dist/glyphs/index.js.map +1 -1
- package/dist/i18n/index.js +23 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/messages.js +41 -0
- package/dist/i18n/messages.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +6 -3
- package/dist/indicator/index.d.ts +15 -0
- package/dist/indicator/index.js +256 -0
- package/dist/indicator/index.js.map +1 -0
- package/dist/indicator/motion.js +86 -0
- package/dist/indicator/motion.js.map +1 -0
- package/dist/indicator/paths.js +72 -0
- package/dist/indicator/paths.js.map +1 -0
- package/dist/indicator/styles.js +62 -0
- package/dist/indicator/styles.js.map +1 -0
- package/dist/number/locale.js +14 -0
- package/dist/number/locale.js.map +1 -0
- package/dist/overlay/host.js +65 -2
- package/dist/overlay/host.js.map +1 -1
- package/dist/press/index.js +10 -9
- package/dist/press/index.js.map +1 -1
- package/dist/theme/resolve.js +1 -1
- package/dist/theme/resolve.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
import { CloseGlyph } from "../../glyphs/index.js";
|
|
2
|
+
import { useTheme } from "../../theme/scope.js";
|
|
3
|
+
import { composeStyles, themedStyles } from "../../theme/styles.js";
|
|
4
|
+
import { useTypeRole } from "../../typography/roles.js";
|
|
5
|
+
import { hitSlop, usePressFeedback } from "../../press/index.js";
|
|
6
|
+
import { useWindowSizeClass } from "../../hooks/useWindowSizeClass.js";
|
|
7
|
+
import { Overlay } from "../../overlay/host.js";
|
|
8
|
+
import { c } from "react/compiler-runtime";
|
|
9
|
+
import { AccessibilityInfo, Platform, Pressable, StyleSheet, Text, View } from "react-native";
|
|
10
|
+
import { use, useEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import Animated, { Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withTiming } from "react-native-reanimated";
|
|
13
|
+
import { SafeAreaInsetsContext } from "react-native-safe-area-context";
|
|
14
|
+
//#region src/components/snackbar/index.tsx
|
|
15
|
+
const MESSAGE_MS = 5e3;
|
|
16
|
+
const UNTIL_CLOSED = 0;
|
|
17
|
+
const MIN_WIDE = 320;
|
|
18
|
+
const MAX_WIDE = 576;
|
|
19
|
+
const MESSAGE_BLOCK_PADDING = 14;
|
|
20
|
+
const RING_WIDTH = 2;
|
|
21
|
+
const RING_OFFSET = -4;
|
|
22
|
+
const NO_INSETS = {
|
|
23
|
+
bottom: 0,
|
|
24
|
+
left: 0,
|
|
25
|
+
right: 0,
|
|
26
|
+
top: 0
|
|
27
|
+
};
|
|
28
|
+
const stylesOf = themedStyles(({ colors, radii, shadows, sizing, spacing }) => StyleSheet.create({
|
|
29
|
+
action: {
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
justifyContent: "center",
|
|
32
|
+
minHeight: sizing.controlSm,
|
|
33
|
+
paddingHorizontal: spacing.md,
|
|
34
|
+
paddingVertical: spacing.sm
|
|
35
|
+
},
|
|
36
|
+
actionLabel: { color: colors.inversePrimary },
|
|
37
|
+
actionRing: {
|
|
38
|
+
outlineColor: colors.inversePrimary,
|
|
39
|
+
outlineOffset: RING_OFFSET,
|
|
40
|
+
outlineStyle: "solid",
|
|
41
|
+
outlineWidth: RING_WIDTH
|
|
42
|
+
},
|
|
43
|
+
close: {
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
height: sizing.controlMd,
|
|
46
|
+
justifyContent: "center",
|
|
47
|
+
width: sizing.controlMd
|
|
48
|
+
},
|
|
49
|
+
closeRing: {
|
|
50
|
+
outlineColor: colors.inverseOnSurface,
|
|
51
|
+
outlineOffset: RING_OFFSET,
|
|
52
|
+
outlineStyle: "solid",
|
|
53
|
+
outlineWidth: RING_WIDTH
|
|
54
|
+
},
|
|
55
|
+
control: { borderRadius: radii.pill },
|
|
56
|
+
message: {
|
|
57
|
+
flexBasis: "50%",
|
|
58
|
+
flexGrow: 1,
|
|
59
|
+
marginHorizontal: spacing.sm,
|
|
60
|
+
minWidth: 0,
|
|
61
|
+
paddingVertical: MESSAGE_BLOCK_PADDING
|
|
62
|
+
},
|
|
63
|
+
messageText: { color: colors.inverseOnSurface },
|
|
64
|
+
region: {
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
bottom: 0,
|
|
67
|
+
left: 0,
|
|
68
|
+
paddingTop: spacing.sm,
|
|
69
|
+
pointerEvents: "box-none",
|
|
70
|
+
position: "absolute",
|
|
71
|
+
right: 0
|
|
72
|
+
},
|
|
73
|
+
strip: {
|
|
74
|
+
alignItems: "center",
|
|
75
|
+
backgroundColor: colors.inverseSurface,
|
|
76
|
+
borderRadius: radii.xs,
|
|
77
|
+
boxShadow: shadows.elevation3,
|
|
78
|
+
flexDirection: "row",
|
|
79
|
+
flexWrap: "wrap",
|
|
80
|
+
minHeight: sizing.controlMd,
|
|
81
|
+
paddingHorizontal: spacing.sm,
|
|
82
|
+
width: "100%"
|
|
83
|
+
}
|
|
84
|
+
}));
|
|
85
|
+
const styles = StyleSheet.create({
|
|
86
|
+
controls: {
|
|
87
|
+
alignItems: "center",
|
|
88
|
+
flexDirection: "row",
|
|
89
|
+
flexShrink: 0,
|
|
90
|
+
marginStart: "auto"
|
|
91
|
+
},
|
|
92
|
+
wide: {
|
|
93
|
+
maxWidth: MAX_WIDE,
|
|
94
|
+
minWidth: MIN_WIDE
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* The queue a snackbar is shown from. Make one where the app can reach it, a
|
|
99
|
+
* module of its own being the usual place, mount `Snackbar` once with it, and
|
|
100
|
+
* call `add` from anywhere.
|
|
101
|
+
*
|
|
102
|
+
* ```ts
|
|
103
|
+
* const messages = new Snackbar.Queue()
|
|
104
|
+
* messages.add('Label', { action: { label: 'Undo', onPress: undo } })
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
var SnackbarQueue = class {
|
|
108
|
+
#added = 0;
|
|
109
|
+
#listeners = /* @__PURE__ */ new Set();
|
|
110
|
+
#shown = null;
|
|
111
|
+
/**
|
|
112
|
+
* Shows a message in place of the one on screen, and returns the key that
|
|
113
|
+
* closes it. The message it replaces is closed, so its `onClose` runs, and
|
|
114
|
+
* it does not come back.
|
|
115
|
+
*/
|
|
116
|
+
add(message, options = {}) {
|
|
117
|
+
const { action, onClose, showCloseButton = false, timeout } = options;
|
|
118
|
+
this.clear();
|
|
119
|
+
this.#added += 1;
|
|
120
|
+
const key = `snackbar-${String(this.#added)}`;
|
|
121
|
+
this.#shown = {
|
|
122
|
+
action,
|
|
123
|
+
key,
|
|
124
|
+
message,
|
|
125
|
+
onClose,
|
|
126
|
+
showCloseButton,
|
|
127
|
+
timeout: timeout ?? (action === void 0 ? MESSAGE_MS : UNTIL_CLOSED)
|
|
128
|
+
};
|
|
129
|
+
this.#changed();
|
|
130
|
+
return key;
|
|
131
|
+
}
|
|
132
|
+
/** Closes the snackbar on screen, running its `onClose`. */
|
|
133
|
+
clear() {
|
|
134
|
+
if (this.#shown !== null) this.close(this.#shown.key);
|
|
135
|
+
}
|
|
136
|
+
/** Closes one snackbar, by the key `add` returned. */
|
|
137
|
+
close(key) {
|
|
138
|
+
const shown = this.#shown;
|
|
139
|
+
if (shown?.key !== key) return;
|
|
140
|
+
this.#shown = null;
|
|
141
|
+
this.#changed();
|
|
142
|
+
shown.onClose?.();
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Calls `listener` whenever the message on screen changes, and returns what
|
|
146
|
+
* stops it. `Snackbar` reads the queue through this and `visible`, and
|
|
147
|
+
* neither is meant for a call site.
|
|
148
|
+
*/
|
|
149
|
+
subscribe = (listener) => {
|
|
150
|
+
this.#listeners.add(listener);
|
|
151
|
+
return () => {
|
|
152
|
+
this.#listeners.delete(listener);
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
/** The message on screen, or `null`. */
|
|
156
|
+
visible = () => this.#shown;
|
|
157
|
+
#changed() {
|
|
158
|
+
for (const listener of this.#listeners) listener();
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
function actionOf(action, close) {
|
|
162
|
+
return () => {
|
|
163
|
+
action.onPress();
|
|
164
|
+
close();
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function closeOf(queue, key) {
|
|
168
|
+
return () => {
|
|
169
|
+
queue.close(key);
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function flagOf(set, value) {
|
|
173
|
+
return () => {
|
|
174
|
+
set(value);
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function measureInto(height) {
|
|
178
|
+
return (event) => {
|
|
179
|
+
height.set(event.nativeEvent.layout.height);
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* A brief message at the bottom of the screen, with an optional action, with
|
|
184
|
+
* web's props and values. Mount one of these with a `Snackbar.Queue`, and
|
|
185
|
+
* call the queue's `add` to show a message from anywhere.
|
|
186
|
+
*
|
|
187
|
+
* ```tsx
|
|
188
|
+
* const messages = new Snackbar.Queue()
|
|
189
|
+
*
|
|
190
|
+
* <Snackbar queue={messages} />
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
* It draws in the overlay host of the app's outermost `ThemeScope`, above the
|
|
194
|
+
* screen, and needs one around it. It is one region rather than one per
|
|
195
|
+
* message, so mount it once, near the root, inside the `SafeAreaProvider`
|
|
196
|
+
* whose insets it keeps clear of.
|
|
197
|
+
*
|
|
198
|
+
* `style`, `ref` and `testID` land on that region, a view along the bottom of
|
|
199
|
+
* the screen that holds the message.
|
|
200
|
+
*/
|
|
201
|
+
function Snackbar(t0) {
|
|
202
|
+
const $ = c(24);
|
|
203
|
+
let props;
|
|
204
|
+
let queue;
|
|
205
|
+
let style;
|
|
206
|
+
let t1;
|
|
207
|
+
if ($[0] !== t0) {
|
|
208
|
+
({closeLabel: t1, queue, style, ...props} = t0);
|
|
209
|
+
$[0] = t0;
|
|
210
|
+
$[1] = props;
|
|
211
|
+
$[2] = queue;
|
|
212
|
+
$[3] = style;
|
|
213
|
+
$[4] = t1;
|
|
214
|
+
} else {
|
|
215
|
+
props = $[1];
|
|
216
|
+
queue = $[2];
|
|
217
|
+
style = $[3];
|
|
218
|
+
t1 = $[4];
|
|
219
|
+
}
|
|
220
|
+
const closeLabel = t1 === void 0 ? "Close" : t1;
|
|
221
|
+
const theme = useTheme();
|
|
222
|
+
const insets = use(SafeAreaInsetsContext) ?? NO_INSETS;
|
|
223
|
+
const wide = useWindowSizeClass() !== "compact";
|
|
224
|
+
const shown = useSyncExternalStore(queue.subscribe, queue.visible);
|
|
225
|
+
let t2;
|
|
226
|
+
if ($[5] !== queue) {
|
|
227
|
+
t2 = () => queue.visible()?.key;
|
|
228
|
+
$[5] = queue;
|
|
229
|
+
$[6] = t2;
|
|
230
|
+
} else t2 = $[6];
|
|
231
|
+
const [standing] = useState(t2);
|
|
232
|
+
const { spacing } = theme;
|
|
233
|
+
let t3;
|
|
234
|
+
if ($[7] !== insets.bottom || $[8] !== insets.left || $[9] !== insets.right || $[10] !== spacing.sm || $[11] !== style || $[12] !== theme) {
|
|
235
|
+
t3 = composeStyles(stylesOf(theme).region, {
|
|
236
|
+
paddingBottom: spacing.sm + insets.bottom,
|
|
237
|
+
paddingLeft: spacing.sm + insets.left,
|
|
238
|
+
paddingRight: spacing.sm + insets.right
|
|
239
|
+
}, style);
|
|
240
|
+
$[7] = insets.bottom;
|
|
241
|
+
$[8] = insets.left;
|
|
242
|
+
$[9] = insets.right;
|
|
243
|
+
$[10] = spacing.sm;
|
|
244
|
+
$[11] = style;
|
|
245
|
+
$[12] = theme;
|
|
246
|
+
$[13] = t3;
|
|
247
|
+
} else t3 = $[13];
|
|
248
|
+
let t4;
|
|
249
|
+
if ($[14] !== closeLabel || $[15] !== queue || $[16] !== shown || $[17] !== standing || $[18] !== wide) {
|
|
250
|
+
t4 = shown === null ? null : /* @__PURE__ */ jsx(SnackbarStrip, {
|
|
251
|
+
arrives: shown.key !== standing,
|
|
252
|
+
closeLabel,
|
|
253
|
+
queue,
|
|
254
|
+
shown,
|
|
255
|
+
wide
|
|
256
|
+
}, shown.key);
|
|
257
|
+
$[14] = closeLabel;
|
|
258
|
+
$[15] = queue;
|
|
259
|
+
$[16] = shown;
|
|
260
|
+
$[17] = standing;
|
|
261
|
+
$[18] = wide;
|
|
262
|
+
$[19] = t4;
|
|
263
|
+
} else t4 = $[19];
|
|
264
|
+
let t5;
|
|
265
|
+
if ($[20] !== props || $[21] !== t3 || $[22] !== t4) {
|
|
266
|
+
t5 = /* @__PURE__ */ jsx(Overlay, { children: /* @__PURE__ */ jsx(View, {
|
|
267
|
+
"aria-live": Platform.OS === "web" ? "polite" : void 0,
|
|
268
|
+
...props,
|
|
269
|
+
style: t3,
|
|
270
|
+
children: t4
|
|
271
|
+
}) });
|
|
272
|
+
$[20] = props;
|
|
273
|
+
$[21] = t3;
|
|
274
|
+
$[22] = t4;
|
|
275
|
+
$[23] = t5;
|
|
276
|
+
} else t5 = $[23];
|
|
277
|
+
return t5;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* One of the snackbar's two controls, a pill drawing the state layer, the
|
|
281
|
+
* ripple and the ring in its own colour, over a target brought up to 48dp
|
|
282
|
+
* from the `height` it is drawn at. It reports when it takes and loses focus,
|
|
283
|
+
* which pauses the message's timer.
|
|
284
|
+
*/
|
|
285
|
+
function SnackbarButton(t0) {
|
|
286
|
+
const $ = c(14);
|
|
287
|
+
const { "aria-label": ariaLabel, children, color, height, onFocusChange, onPress, ring, style } = t0;
|
|
288
|
+
const theme = useTheme();
|
|
289
|
+
const corners = stylesOf(theme).control;
|
|
290
|
+
let t1;
|
|
291
|
+
let t2;
|
|
292
|
+
if ($[0] !== onFocusChange) {
|
|
293
|
+
t1 = () => {
|
|
294
|
+
onFocusChange(false);
|
|
295
|
+
};
|
|
296
|
+
t2 = () => {
|
|
297
|
+
onFocusChange(true);
|
|
298
|
+
};
|
|
299
|
+
$[0] = onFocusChange;
|
|
300
|
+
$[1] = t1;
|
|
301
|
+
$[2] = t2;
|
|
302
|
+
} else {
|
|
303
|
+
t1 = $[1];
|
|
304
|
+
t2 = $[2];
|
|
305
|
+
}
|
|
306
|
+
const feedback = usePressFeedback({
|
|
307
|
+
color,
|
|
308
|
+
corners,
|
|
309
|
+
onBlur: t1,
|
|
310
|
+
onFocus: t2
|
|
311
|
+
});
|
|
312
|
+
const T0 = Pressable;
|
|
313
|
+
const t3 = feedback.handlers;
|
|
314
|
+
let t4;
|
|
315
|
+
if ($[3] !== height) {
|
|
316
|
+
t4 = hitSlop(height);
|
|
317
|
+
$[3] = height;
|
|
318
|
+
$[4] = t4;
|
|
319
|
+
} else t4 = $[4];
|
|
320
|
+
const t5 = "button";
|
|
321
|
+
const t6 = composeStyles(corners, style, feedback.ring === void 0 ? void 0 : ring);
|
|
322
|
+
let t7;
|
|
323
|
+
if ($[5] !== T0 || $[6] !== ariaLabel || $[7] !== children || $[8] !== feedback.handlers || $[9] !== feedback.layer || $[10] !== onPress || $[11] !== t4 || $[12] !== t6) {
|
|
324
|
+
t7 = /* @__PURE__ */ jsxs(T0, {
|
|
325
|
+
...t3,
|
|
326
|
+
"aria-label": ariaLabel,
|
|
327
|
+
hitSlop: t4,
|
|
328
|
+
onPress,
|
|
329
|
+
role: t5,
|
|
330
|
+
style: t6,
|
|
331
|
+
children: [feedback.layer, children]
|
|
332
|
+
});
|
|
333
|
+
$[5] = T0;
|
|
334
|
+
$[6] = ariaLabel;
|
|
335
|
+
$[7] = children;
|
|
336
|
+
$[8] = feedback.handlers;
|
|
337
|
+
$[9] = feedback.layer;
|
|
338
|
+
$[10] = onPress;
|
|
339
|
+
$[11] = t4;
|
|
340
|
+
$[12] = t6;
|
|
341
|
+
$[13] = t7;
|
|
342
|
+
} else t7 = $[13];
|
|
343
|
+
return t7;
|
|
344
|
+
}
|
|
345
|
+
/** One message: the words, then whatever sits after them. */
|
|
346
|
+
function SnackbarStrip(t0) {
|
|
347
|
+
const $ = c(15);
|
|
348
|
+
const { arrives, closeLabel, queue, shown, wide } = t0;
|
|
349
|
+
const theme = useTheme();
|
|
350
|
+
const themed = stylesOf(theme);
|
|
351
|
+
const body = useTypeRole("bodyMedium");
|
|
352
|
+
const label = useTypeRole("labelLarge");
|
|
353
|
+
const reduceMotion = useReducedMotion();
|
|
354
|
+
const [focused, setFocused] = useState(false);
|
|
355
|
+
const [hovered, setHovered] = useState(false);
|
|
356
|
+
const { action, key, message, showCloseButton } = shown;
|
|
357
|
+
const { colors, motion, sizing } = theme;
|
|
358
|
+
const rises = arrives && !reduceMotion;
|
|
359
|
+
const arrived = useSharedValue(rises ? 0 : 1);
|
|
360
|
+
const height = useSharedValue(0);
|
|
361
|
+
const rise = useAnimatedStyle(() => {
|
|
362
|
+
"worklet";
|
|
363
|
+
const progress = arrived.get();
|
|
364
|
+
return {
|
|
365
|
+
opacity: progress,
|
|
366
|
+
transform: [{ translateY: (1 - progress) * height.get() }]
|
|
367
|
+
};
|
|
368
|
+
});
|
|
369
|
+
let t1;
|
|
370
|
+
let t2;
|
|
371
|
+
if ($[0] !== arrived || $[1] !== motion || $[2] !== rises) {
|
|
372
|
+
t1 = () => {
|
|
373
|
+
if (rises) arrived.set(withTiming(1, {
|
|
374
|
+
duration: motion.durationMedium1,
|
|
375
|
+
easing: Easing.bezier(...motion.easingEmphasizedDecelerate)
|
|
376
|
+
}));
|
|
377
|
+
};
|
|
378
|
+
t2 = [
|
|
379
|
+
arrived,
|
|
380
|
+
motion,
|
|
381
|
+
rises
|
|
382
|
+
];
|
|
383
|
+
$[0] = arrived;
|
|
384
|
+
$[1] = motion;
|
|
385
|
+
$[2] = rises;
|
|
386
|
+
$[3] = t1;
|
|
387
|
+
$[4] = t2;
|
|
388
|
+
} else {
|
|
389
|
+
t1 = $[3];
|
|
390
|
+
t2 = $[4];
|
|
391
|
+
}
|
|
392
|
+
useEffect(t1, t2);
|
|
393
|
+
let t3;
|
|
394
|
+
let t4;
|
|
395
|
+
if ($[5] !== message) {
|
|
396
|
+
t3 = () => {
|
|
397
|
+
if (Platform.OS === "ios" || Platform.OS === "android") AccessibilityInfo.announceForAccessibilityWithOptions(message, { queue: true });
|
|
398
|
+
};
|
|
399
|
+
t4 = [message];
|
|
400
|
+
$[5] = message;
|
|
401
|
+
$[6] = t3;
|
|
402
|
+
$[7] = t4;
|
|
403
|
+
} else {
|
|
404
|
+
t3 = $[6];
|
|
405
|
+
t4 = $[7];
|
|
406
|
+
}
|
|
407
|
+
useEffect(t3, t4);
|
|
408
|
+
let t5;
|
|
409
|
+
if ($[8] !== key || $[9] !== queue) {
|
|
410
|
+
t5 = closeOf(queue, key);
|
|
411
|
+
$[8] = key;
|
|
412
|
+
$[9] = queue;
|
|
413
|
+
$[10] = t5;
|
|
414
|
+
} else t5 = $[10];
|
|
415
|
+
const close = t5;
|
|
416
|
+
useExpiry(useShownFor(shown.timeout), focused || hovered, close);
|
|
417
|
+
let t6;
|
|
418
|
+
if ($[11] !== height) {
|
|
419
|
+
t6 = measureInto(height);
|
|
420
|
+
$[11] = height;
|
|
421
|
+
$[12] = t6;
|
|
422
|
+
} else t6 = $[12];
|
|
423
|
+
let t7;
|
|
424
|
+
let t8;
|
|
425
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
426
|
+
t7 = flagOf(setHovered, true);
|
|
427
|
+
t8 = flagOf(setHovered, false);
|
|
428
|
+
$[13] = t7;
|
|
429
|
+
$[14] = t8;
|
|
430
|
+
} else {
|
|
431
|
+
t7 = $[13];
|
|
432
|
+
t8 = $[14];
|
|
433
|
+
}
|
|
434
|
+
return /* @__PURE__ */ jsxs(Animated.View, {
|
|
435
|
+
onLayout: t6,
|
|
436
|
+
onPointerEnter: t7,
|
|
437
|
+
onPointerLeave: t8,
|
|
438
|
+
style: composeStyles(themed.strip, wide ? styles.wide : void 0, rise),
|
|
439
|
+
children: [/* @__PURE__ */ jsx(View, {
|
|
440
|
+
style: themed.message,
|
|
441
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
442
|
+
style: composeStyles(body, themed.messageText),
|
|
443
|
+
children: message
|
|
444
|
+
})
|
|
445
|
+
}), action === void 0 && !showCloseButton ? null : /* @__PURE__ */ jsxs(View, {
|
|
446
|
+
style: styles.controls,
|
|
447
|
+
children: [action === void 0 ? null : /* @__PURE__ */ jsx(SnackbarButton, {
|
|
448
|
+
color: colors.inversePrimary,
|
|
449
|
+
height: sizing.controlSm,
|
|
450
|
+
onFocusChange: setFocused,
|
|
451
|
+
onPress: actionOf(action, close),
|
|
452
|
+
ring: themed.actionRing,
|
|
453
|
+
style: themed.action,
|
|
454
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
455
|
+
style: composeStyles(label, themed.actionLabel),
|
|
456
|
+
children: action.label
|
|
457
|
+
})
|
|
458
|
+
}), showCloseButton ? /* @__PURE__ */ jsx(SnackbarButton, {
|
|
459
|
+
"aria-label": closeLabel,
|
|
460
|
+
color: colors.inverseOnSurface,
|
|
461
|
+
height: sizing.controlMd,
|
|
462
|
+
onFocusChange: setFocused,
|
|
463
|
+
onPress: close,
|
|
464
|
+
ring: themed.closeRing,
|
|
465
|
+
style: themed.close,
|
|
466
|
+
children: /* @__PURE__ */ jsx(CloseGlyph, {
|
|
467
|
+
color: colors.inverseOnSurface,
|
|
468
|
+
size: 24
|
|
469
|
+
})
|
|
470
|
+
}) : null]
|
|
471
|
+
})]
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
function useExpiry(duration, paused, expire) {
|
|
475
|
+
const $ = c(5);
|
|
476
|
+
const left = useRef(null);
|
|
477
|
+
let t0;
|
|
478
|
+
let t1;
|
|
479
|
+
if ($[0] !== duration || $[1] !== expire || $[2] !== paused) {
|
|
480
|
+
t0 = () => {
|
|
481
|
+
if (duration === null || duration === 0 || paused) return;
|
|
482
|
+
const remaining = left.current ?? duration;
|
|
483
|
+
const started = Date.now();
|
|
484
|
+
const timer = setTimeout(expire, remaining);
|
|
485
|
+
return () => {
|
|
486
|
+
clearTimeout(timer);
|
|
487
|
+
left.current = remaining - (Date.now() - started);
|
|
488
|
+
};
|
|
489
|
+
};
|
|
490
|
+
t1 = [
|
|
491
|
+
duration,
|
|
492
|
+
expire,
|
|
493
|
+
paused
|
|
494
|
+
];
|
|
495
|
+
$[0] = duration;
|
|
496
|
+
$[1] = expire;
|
|
497
|
+
$[2] = paused;
|
|
498
|
+
$[3] = t0;
|
|
499
|
+
$[4] = t1;
|
|
500
|
+
} else {
|
|
501
|
+
t0 = $[3];
|
|
502
|
+
t1 = $[4];
|
|
503
|
+
}
|
|
504
|
+
useEffect(t0, t1);
|
|
505
|
+
}
|
|
506
|
+
function useShownFor(timeout) {
|
|
507
|
+
const $ = c(4);
|
|
508
|
+
const [recommended, setRecommended] = useState(null);
|
|
509
|
+
const asks = Platform.OS === "android" && timeout > 0;
|
|
510
|
+
let t0;
|
|
511
|
+
let t1;
|
|
512
|
+
if ($[0] !== asks || $[1] !== timeout) {
|
|
513
|
+
t0 = () => {
|
|
514
|
+
if (!asks) return;
|
|
515
|
+
let current = true;
|
|
516
|
+
(async function ask() {
|
|
517
|
+
const milliseconds = await AccessibilityInfo.getRecommendedTimeoutMillis(timeout);
|
|
518
|
+
if (current) setRecommended(milliseconds);
|
|
519
|
+
})();
|
|
520
|
+
return () => {
|
|
521
|
+
current = false;
|
|
522
|
+
};
|
|
523
|
+
};
|
|
524
|
+
t1 = [asks, timeout];
|
|
525
|
+
$[0] = asks;
|
|
526
|
+
$[1] = timeout;
|
|
527
|
+
$[2] = t0;
|
|
528
|
+
$[3] = t1;
|
|
529
|
+
} else {
|
|
530
|
+
t0 = $[2];
|
|
531
|
+
t1 = $[3];
|
|
532
|
+
}
|
|
533
|
+
useEffect(t0, t1);
|
|
534
|
+
return asks ? recommended : timeout;
|
|
535
|
+
}
|
|
536
|
+
Snackbar.Queue = SnackbarQueue;
|
|
537
|
+
//#endregion
|
|
538
|
+
export { Snackbar };
|
|
539
|
+
|
|
540
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","Ref","LayoutChangeEvent","StyleProp","TextStyle","ViewProps","ViewStyle","AnimatedStyle","SharedValue","use","useEffect","useRef","useState","useSyncExternalStore","AccessibilityInfo","Text","NativeText","Platform","Pressable","StyleSheet","View","Animated","Easing","useAnimatedStyle","useReducedMotion","useSharedValue","withTiming","SafeAreaInsetsContext","CloseGlyph","useWindowSizeClass","Overlay","hitSlop","usePressFeedback","useTheme","composeStyles","themedStyles","useTypeRole","MESSAGE_MS","UNTIL_CLOSED","MIN_WIDE","MAX_WIDE","MESSAGE_BLOCK_PADDING","RING_WIDTH","RING_OFFSET","NO_INSETS","bottom","left","right","top","stylesOf","colors","radii","shadows","sizing","spacing","create","action","alignItems","justifyContent","minHeight","controlSm","paddingHorizontal","md","paddingVertical","sm","actionLabel","color","inversePrimary","actionRing","outlineColor","outlineOffset","outlineStyle","outlineWidth","close","height","controlMd","width","closeRing","inverseOnSurface","control","borderRadius","pill","message","flexBasis","flexGrow","marginHorizontal","minWidth","messageText","region","paddingTop","pointerEvents","position","strip","backgroundColor","inverseSurface","xs","boxShadow","elevation3","flexDirection","flexWrap","styles","controls","flexShrink","marginStart","wide","maxWidth","ShownMessage","SnackbarAction","key","onClose","showCloseButton","timeout","label","onPress","SnackbarOptions","SnackbarProps","Omit","closeLabel","queue","SnackbarQueue","ref","style","added","listeners","Set","shown","add","options","clear","String","undefined","changed","subscribe","listener","delete","visible","#changed","actionOf","closeOf","flagOf","set","value","measureInto","event","nativeEvent","layout","Snackbar","t0","$","_c","props","t1","theme","insets","t2","standing","t3","paddingBottom","paddingLeft","paddingRight","t4","t5","OS","SnackbarButton","ariaLabel","children","onFocusChange","ring","corners","feedback","onBlur","onFocus","T0","handlers","t6","t7","layer","SnackbarStrip","arrives","themed","body","reduceMotion","focused","setFocused","hovered","setHovered","motion","rises","arrived","rise","progress","get","opacity","transform","translateY","duration","durationMedium1","easing","bezier","easingEmphasizedDecelerate","announceForAccessibilityWithOptions","useExpiry","useShownFor","t8","Symbol","for","paused","expire","remaining","current","started","Date","now","timer","setTimeout","clearTimeout","recommended","setRecommended","asks","ask","milliseconds","getRecommendedTimeoutMillis","Queue","_c","NativeText"],"sources":["../../../src/components/snackbar/index.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react'\nimport type {\n LayoutChangeEvent,\n StyleProp,\n TextStyle,\n ViewProps,\n ViewStyle,\n} from 'react-native'\nimport type { AnimatedStyle, SharedValue } from 'react-native-reanimated'\n\nimport { use, useEffect, useRef, useState, useSyncExternalStore } from 'react'\nimport {\n AccessibilityInfo,\n Text as NativeText,\n Platform,\n Pressable,\n StyleSheet,\n View,\n} from 'react-native'\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useReducedMotion,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated'\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context'\n\nimport { CloseGlyph } from '../../glyphs'\nimport { useWindowSizeClass } from '../../hooks/useWindowSizeClass'\nimport { Overlay } from '../../overlay'\nimport { hitSlop, usePressFeedback } from '../../press'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\nimport { useTypeRole } from '../../typography/roles'\n\n// The snackbar page's brief message at the bottom of the screen, with an\n// optional action beside it and an optional close button after that, as\n// kanso-ui's Snackbar draws it. The page's container is the inverse surface\n// at a 4dp corner and elevation 3, its supporting text is body-medium in\n// inverse on surface, its action label is inverse primary, and its close icon\n// takes the supporting text's colour. The measurements are the page's too: 8dp\n// of margin from the edges of the screen, 8dp of padding inside the container\n// with another 8dp either side of the message, 14dp above and below on a\n// single line, and between 320 and 576dp wide from the 600dp breakpoint up,\n// the width of the window less its margins below it. The margin is counted\n// from the safe area, so a message clears the home indicator and the gesture\n// bar.\n//\n// One at a time, as on web. The page shows a single snackbar and replaces it\n// rather than stacking, so a message added while another is up closes that\n// one, whose `onClose` runs, and takes its place. Nothing waits behind it, so\n// an Undo never comes back long after the thing it undid.\n//\n// The queue is web's API: `add` a message with its options from anywhere, and\n// mount one `Snackbar` with the queue near the root. It draws in the overlay\n// host of the outermost `ThemeScope`, so it floats above every screen in the\n// theme around it.\n//\n// **A message is read out as it arrives.** On iOS and Android it is\n// announced through `AccessibilityInfo`, after whatever VoiceOver is already\n// saying, which is how CopyField says its confirmation too. Under React Native\n// Web the region it appears in is a polite live region instead, as web's is,\n// and the browser's screen reader reads it as it changes. Android is not given\n// a live region as well, since TalkBack would then read each message twice.\n//\n// **A message is a string, where web takes a node.** The announcement is the\n// message's words, and a node has none to hand VoiceOver.\n//\n// **The action and the close button are drawn here rather than through\n// Button and IconButton**, as on web: the page colours them inverse primary\n// and inverse on surface, which no variant of either carries. They take the\n// state layer, the ripple and the focus ring from src/press, with the ring\n// drawn 2dp inside the control rather than outside it: the close button is\n// 48dp in a strip 48dp tall, so a ring outside it crossed the strip's edges\n// onto the screen, in a colour chosen to read on the strip rather than on\n// the screen around it.\n\n// How long a message is shown when the call site names no `timeout`, web's\n// durations from the snackbar's guidelines and accessibility pages. A message\n// alone leaves after five seconds, which Android lengthens from the reader's\n// own accessibility setting, as its own snackbar does. A message with an\n// action stays until the action is taken or something closes it, since no\n// timer knows how long a reader needs to reach it.\nconst MESSAGE_MS = 5000\nconst UNTIL_CLOSED = 0\n\n// The width from the 600dp breakpoint up, the page's. Literals, as on web:\n// they bound the strip rather than measure anything a theme would resize.\nconst MIN_WIDE = 320\nconst MAX_WIDE = 576\n\n// The page's 14dp above and below the message, which with its 20dp line makes\n// a single-line strip 48dp tall. A literal, as on web, since no spacing step\n// is 14.\nconst MESSAGE_BLOCK_PADDING = 14\n\n// The ring's 2dp, drawn 4dp in from the control's edge so all of it lies\n// inside.\nconst RING_WIDTH = 2\nconst RING_OFFSET = -4\n\n// Outside a SafeAreaProvider the insets are unknown, and the window's own edge\n// is the best bound there is.\nconst NO_INSETS = { bottom: 0, left: 0, right: 0, top: 0 }\n\nconst stylesOf = themedStyles(({ colors, radii, shadows, sizing, spacing }) =>\n StyleSheet.create({\n // Material Design's text button in the page's inverse primary, at the\n // label large the page gives it: 40dp tall, as Button's medium size is,\n // over a 48dp target, which is the strip's own height. A least height\n // rather than a height, so a type scale with a taller line grows the\n // button instead of clipping its label.\n action: {\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: sizing.controlSm,\n paddingHorizontal: spacing.md,\n paddingVertical: spacing.sm,\n },\n actionLabel: {\n color: colors.inversePrimary,\n },\n actionRing: {\n outlineColor: colors.inversePrimary,\n outlineOffset: RING_OFFSET,\n outlineStyle: 'solid',\n outlineWidth: RING_WIDTH,\n },\n // The page's 24dp icon in the supporting text's colour, in a 48dp box,\n // the least press area the icon buttons page allows.\n close: {\n alignItems: 'center',\n height: sizing.controlMd,\n justifyContent: 'center',\n width: sizing.controlMd,\n },\n closeRing: {\n outlineColor: colors.inverseOnSurface,\n outlineOffset: RING_OFFSET,\n outlineStyle: 'solid',\n outlineWidth: RING_WIDTH,\n },\n // Both controls are pills, which the state layer and the ripple clip to.\n control: {\n borderRadius: radii.pill,\n },\n // The message: its 8dp either side inside the strip's own 8dp, and the\n // 14dp above and below. The height is the message's rather than the\n // strip's, which is what lets a 48dp close button sit beside it without\n // making the strip taller than the page draws it.\n //\n // Its basis is half the strip, which is what decides when the controls\n // drop beneath it. A word longer than the line holds breaks inside\n // itself rather than running under the controls, which the least width\n // of 0 allows on the web, where a flex item otherwise keeps the width of\n // its longest word.\n message: {\n flexBasis: '50%',\n flexGrow: 1,\n marginHorizontal: spacing.sm,\n minWidth: 0,\n paddingVertical: MESSAGE_BLOCK_PADDING,\n },\n messageText: {\n color: colors.inverseOnSurface,\n },\n // A strip along the bottom of the overlay layer, with the page's 8dp\n // above it. It passes a touch through wherever no strip is drawn, so\n // the screen under it stays usable.\n region: {\n alignItems: 'center',\n bottom: 0,\n left: 0,\n paddingTop: spacing.sm,\n pointerEvents: 'box-none',\n position: 'absolute',\n right: 0,\n },\n // The container: the page's 8dp either side, and nothing above or\n // below, since what sets its height is the message and the close\n // button. It wraps, so controls too long to leave the message half the\n // strip drop onto a line of their own beneath it, Material Design's\n // two-line snackbar with a longer action.\n strip: {\n alignItems: 'center',\n backgroundColor: colors.inverseSurface,\n borderRadius: radii.xs,\n boxShadow: shadows.elevation3,\n flexDirection: 'row',\n flexWrap: 'wrap',\n minHeight: sizing.controlMd,\n paddingHorizontal: spacing.sm,\n width: '100%',\n },\n }),\n)\n\nconst styles = StyleSheet.create({\n // The action, and the close button after it, kept together after the\n // message so they move beneath it together. The auto margin puts them at\n // the trailing edge: on the message's row the message takes all the room\n // first, and on a row of their own it is all the room there is.\n controls: {\n alignItems: 'center',\n flexDirection: 'row',\n flexShrink: 0,\n marginStart: 'auto',\n },\n wide: {\n maxWidth: MAX_WIDE,\n minWidth: MIN_WIDE,\n },\n})\n\n// A message on screen, with what it was added with.\ntype ShownMessage = {\n readonly action: SnackbarAction | undefined\n readonly key: string\n readonly message: string\n readonly onClose: (() => void) | undefined\n readonly showCloseButton: boolean\n readonly timeout: number\n}\n\ntype SnackbarAction = {\n /** What the action says. The page gives it a single word where it can. */\n readonly label: string\n /** Run when the action is pressed, just before the snackbar closes. */\n readonly onPress: () => void\n}\n\ntype SnackbarOptions = {\n /**\n * A single action shown after the message. Pressing it runs `onPress` and\n * closes the snackbar, which is what the page draws.\n */\n readonly action?: SnackbarAction\n /**\n * Run when the snackbar closes, however it was closed: by its timer, its\n * action or close button, `close`, `clear`, or a newer message added in its\n * place.\n */\n readonly onClose?: () => void\n /**\n * Whether a close button is shown at the end. The page draws one for a\n * message a reader may want out of the way before it expires.\n * @default false\n */\n readonly showCloseButton?: boolean\n /**\n * How long the snackbar is shown, in milliseconds. Defaults to five seconds\n * for a message alone, which Android lengthens from the reader's own\n * accessibility setting. A message with an action defaults to `0` and stays\n * until the action is taken or something closes it, as Material Design asks\n * of an actionable snackbar. The timer is paused while a pointer is over the\n * snackbar or one of its controls has focus, so a message never expires\n * while it is being read.\n *\n * `0` is the page's indefinite length: the snackbar stays until something\n * closes it. Give one of those an action or `showCloseButton`, or there is\n * no way to be rid of it.\n */\n readonly timeout?: number\n}\n\ntype SnackbarProps = Omit<ViewProps, 'children' | 'style'> & {\n /**\n * What a screen reader calls the button that dismisses a snackbar. It sits\n * here rather than on a message's own options because it does not vary by\n * message.\n * @default 'Close'\n */\n readonly closeLabel?: string\n /** The queue the snackbar shows messages from. */\n readonly queue: SnackbarQueue\n readonly ref?: Ref<View>\n readonly style?: StyleProp<ViewStyle>\n}\n\n/**\n * The queue a snackbar is shown from. Make one where the app can reach it, a\n * module of its own being the usual place, mount `Snackbar` once with it, and\n * call `add` from anywhere.\n *\n * ```ts\n * const messages = new Snackbar.Queue()\n * messages.add('Label', { action: { label: 'Undo', onPress: undo } })\n * ```\n */\nclass SnackbarQueue {\n #added = 0\n readonly #listeners = new Set<() => void>()\n #shown: null | ShownMessage = null\n\n /**\n * Shows a message in place of the one on screen, and returns the key that\n * closes it. The message it replaces is closed, so its `onClose` runs, and\n * it does not come back.\n */\n add(message: string, options: SnackbarOptions = {}): string {\n const { action, onClose, showCloseButton = false, timeout } = options\n\n this.clear()\n this.#added += 1\n\n const key = `snackbar-${String(this.#added)}`\n\n this.#shown = {\n action,\n key,\n message,\n onClose,\n showCloseButton,\n timeout: timeout ?? (action === undefined ? MESSAGE_MS : UNTIL_CLOSED),\n }\n this.#changed()\n\n return key\n }\n\n /** Closes the snackbar on screen, running its `onClose`. */\n clear() {\n if (this.#shown !== null) {\n this.close(this.#shown.key)\n }\n }\n\n /** Closes one snackbar, by the key `add` returned. */\n close(key: string) {\n const shown = this.#shown\n\n if (shown?.key !== key) {\n return\n }\n\n // Off the screen before `onClose` runs, so one that adds the next message\n // adds it to an empty queue.\n this.#shown = null\n this.#changed()\n shown.onClose?.()\n }\n\n /**\n * Calls `listener` whenever the message on screen changes, and returns what\n * stops it. `Snackbar` reads the queue through this and `visible`, and\n * neither is meant for a call site.\n */\n readonly subscribe = (listener: () => void) => {\n this.#listeners.add(listener)\n\n return () => {\n this.#listeners.delete(listener)\n }\n }\n\n /** The message on screen, or `null`. */\n readonly visible = () => this.#shown\n\n #changed() {\n for (const listener of this.#listeners) {\n listener()\n }\n }\n}\n\n// The handlers the strip hands its views, each built by a call rather than\n// declared in the component, which is what react-perf's\n// jsx-no-new-function-as-prop is after; the React Compiler memoises the result\n// on its inputs.\nfunction actionOf(action: SnackbarAction, close: () => void) {\n return () => {\n action.onPress()\n close()\n }\n}\n\nfunction closeOf(queue: SnackbarQueue, key: string) {\n return () => {\n queue.close(key)\n }\n}\n\nfunction flagOf(set: (value: boolean) => void, value: boolean) {\n return () => {\n set(value)\n }\n}\n\nfunction measureInto(height: SharedValue<number>) {\n return (event: LayoutChangeEvent) => {\n height.set(event.nativeEvent.layout.height)\n }\n}\n\n/**\n * A brief message at the bottom of the screen, with an optional action, with\n * web's props and values. Mount one of these with a `Snackbar.Queue`, and\n * call the queue's `add` to show a message from anywhere.\n *\n * ```tsx\n * const messages = new Snackbar.Queue()\n *\n * <Snackbar queue={messages} />\n * ```\n *\n * It draws in the overlay host of the app's outermost `ThemeScope`, above the\n * screen, and needs one around it. It is one region rather than one per\n * message, so mount it once, near the root, inside the `SafeAreaProvider`\n * whose insets it keeps clear of.\n *\n * `style`, `ref` and `testID` land on that region, a view along the bottom of\n * the screen that holds the message.\n */\nfunction Snackbar({\n closeLabel = 'Close',\n queue,\n style,\n ...props\n}: SnackbarProps) {\n const theme = useTheme()\n const insets = use(SafeAreaInsetsContext) ?? NO_INSETS\n const wide = useWindowSizeClass() !== 'compact'\n const shown = useSyncExternalStore(queue.subscribe, queue.visible)\n // The message up when the snackbar mounted, which was on screen before it\n // rather than arriving, so it is put in place rather than risen to it: on\n // a screen that remounts the snackbar, and on a story seeded with one.\n const [standing] = useState(() => queue.visible()?.key)\n const { spacing } = theme\n\n return (\n <Overlay>\n <View\n aria-live={Platform.OS === 'web' ? 'polite' : undefined}\n {...props}\n style={composeStyles<ViewStyle>(\n stylesOf(theme).region,\n {\n paddingBottom: spacing.sm + insets.bottom,\n paddingLeft: spacing.sm + insets.left,\n paddingRight: spacing.sm + insets.right,\n },\n style,\n )}\n >\n {shown === null ? null : (\n <SnackbarStrip\n arrives={shown.key !== standing}\n closeLabel={closeLabel}\n key={shown.key}\n queue={queue}\n shown={shown}\n wide={wide}\n />\n )}\n </View>\n </Overlay>\n )\n}\n\n/**\n * One of the snackbar's two controls, a pill drawing the state layer, the\n * ripple and the ring in its own colour, over a target brought up to 48dp\n * from the `height` it is drawn at. It reports when it takes and loses focus,\n * which pauses the message's timer.\n */\nfunction SnackbarButton({\n 'aria-label': ariaLabel,\n children,\n color,\n height,\n onFocusChange,\n onPress,\n ring,\n style,\n}: {\n readonly 'aria-label'?: string\n readonly children: ReactNode\n readonly color: string\n readonly height: number\n readonly onFocusChange: (focused: boolean) => void\n readonly onPress: () => void\n readonly ring: ViewStyle\n readonly style: ViewStyle\n}) {\n const theme = useTheme()\n const corners = stylesOf(theme).control\n const feedback = usePressFeedback({\n color,\n corners,\n onBlur: () => {\n onFocusChange(false)\n },\n onFocus: () => {\n onFocusChange(true)\n },\n })\n\n return (\n <Pressable\n {...feedback.handlers}\n aria-label={ariaLabel}\n hitSlop={hitSlop(height)}\n onPress={onPress}\n role=\"button\"\n style={composeStyles<ViewStyle>(\n corners,\n style,\n feedback.ring === undefined ? undefined : ring,\n )}\n >\n {feedback.layer}\n {children}\n </Pressable>\n )\n}\n\n/** One message: the words, then whatever sits after them. */\nfunction SnackbarStrip({\n arrives,\n closeLabel,\n queue,\n shown,\n wide,\n}: {\n /** Whether the message rises into place, or is drawn there at once. */\n readonly arrives: boolean\n readonly closeLabel: string\n readonly queue: SnackbarQueue\n readonly shown: ShownMessage\n readonly wide: boolean\n}) {\n const theme = useTheme()\n const themed = stylesOf(theme)\n const body = useTypeRole('bodyMedium')\n const label = useTypeRole('labelLarge')\n const reduceMotion = useReducedMotion()\n const [focused, setFocused] = useState(false)\n const [hovered, setHovered] = useState(false)\n const { action, key, message, showCloseButton } = shown\n const { colors, motion, sizing } = theme\n\n // It rises its own height from the bottom edge as it fades in, which is\n // what the page draws and what says the message came from the edge of the\n // screen rather than appearing over it. Reduced motion puts it in its\n // settled place at once, as web's zeroed duration does.\n const rises = arrives && !reduceMotion\n const arrived = useSharedValue(rises ? 0 : 1)\n const height = useSharedValue(0)\n const rise = useAnimatedStyle(() => {\n 'worklet'\n const progress = arrived.get()\n\n return {\n opacity: progress,\n transform: [{ translateY: (1 - progress) * height.get() }],\n }\n })\n\n useEffect(() => {\n if (rises) {\n arrived.set(\n withTiming(1, {\n duration: motion.durationMedium1,\n easing: Easing.bezier(...motion.easingEmphasizedDecelerate),\n }),\n )\n }\n }, [arrived, motion, rises])\n\n useEffect(() => {\n if (Platform.OS === 'ios' || Platform.OS === 'android') {\n AccessibilityInfo.announceForAccessibilityWithOptions(message, {\n queue: true,\n })\n }\n }, [message])\n\n const close = closeOf(queue, key)\n\n useExpiry(useShownFor(shown.timeout), focused || hovered, close)\n\n return (\n <Animated.View\n onLayout={measureInto(height)}\n onPointerEnter={flagOf(setHovered, true)}\n onPointerLeave={flagOf(setHovered, false)}\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n themed.strip,\n wide ? styles.wide : undefined,\n rise,\n )}\n >\n <View style={themed.message}>\n <NativeText style={composeStyles<TextStyle>(body, themed.messageText)}>\n {message}\n </NativeText>\n </View>\n {action === undefined && !showCloseButton ? null : (\n <View style={styles.controls}>\n {action === undefined ? null : (\n <SnackbarButton\n color={colors.inversePrimary}\n height={sizing.controlSm}\n onFocusChange={setFocused}\n onPress={actionOf(action, close)}\n ring={themed.actionRing}\n style={themed.action}\n >\n <NativeText\n style={composeStyles<TextStyle>(label, themed.actionLabel)}\n >\n {action.label}\n </NativeText>\n </SnackbarButton>\n )}\n {showCloseButton ? (\n <SnackbarButton\n aria-label={closeLabel}\n color={colors.inverseOnSurface}\n height={sizing.controlMd}\n onFocusChange={setFocused}\n onPress={close}\n ring={themed.closeRing}\n style={themed.close}\n >\n <CloseGlyph color={colors.inverseOnSurface} size={24} />\n </SnackbarButton>\n ) : null}\n </View>\n )}\n </Animated.View>\n )\n}\n\n// Closes a message once it has been shown for `duration` milliseconds,\n// counting only the time it was not paused. Nothing for a `duration` of 0,\n// which is until closed, or of `null`, which is not yet known.\nfunction useExpiry(\n duration: null | number,\n paused: boolean,\n expire: () => void,\n) {\n const left = useRef<null | number>(null)\n\n useEffect(() => {\n if (duration === null || duration === 0 || paused) {\n return undefined\n }\n\n const remaining = left.current ?? duration\n const started = Date.now()\n const timer = setTimeout(expire, remaining)\n\n return () => {\n clearTimeout(timer)\n left.current = remaining - (Date.now() - started)\n }\n }, [duration, expire, paused])\n}\n\n// How long a message is shown: its `timeout`, which Android lengthens from\n// the reader's \"Time to take action\" setting, as its own snackbar does, and\n// is `null` until Android has answered. Nothing is asked for a message shown\n// until closed.\nfunction useShownFor(timeout: number): null | number {\n const [recommended, setRecommended] = useState<null | number>(null)\n const asks = Platform.OS === 'android' && timeout > 0\n\n useEffect(() => {\n if (!asks) {\n return undefined\n }\n\n let current = true\n\n async function ask() {\n const milliseconds =\n await AccessibilityInfo.getRecommendedTimeoutMillis(timeout)\n\n if (current) {\n setRecommended(milliseconds)\n }\n }\n\n void ask()\n\n return () => {\n current = false\n }\n }, [asks, timeout])\n\n return asks ? recommended : timeout\n}\n\nSnackbar.Queue = SnackbarQueue\n\n// The queue is reached as `Snackbar.Queue` rather than exported beside the\n// component, as on web: a module exporting something that is not a component\n// is one fast refresh reloads whole.\nexport { Snackbar }\nexport type { SnackbarAction, SnackbarOptions, SnackbarProps, SnackbarQueue }\n"],"mappings":";;;;;;;;;;;;;;AAoFA,MAAMqC,aAAa;AACnB,MAAMC,eAAe;AAIrB,MAAMC,WAAW;AACjB,MAAMC,WAAW;AAKjB,MAAMC,wBAAwB;AAI9B,MAAMC,aAAa;AACnB,MAAMC,cAAc;AAIpB,MAAMC,YAAY;CAAEC,QAAQ;CAAGC,MAAM;CAAGC,OAAO;CAAGC,KAAK;AAAE;AAEzD,MAAMC,WAAWd,cAAc,EAAEe,QAAQC,OAAOC,SAASC,QAAQC,cAC/DnC,WAAWoC,OAAO;CAMhBC,QAAQ;EACNC,YAAY;EACZC,gBAAgB;EAChBC,WAAWN,OAAOO;EAClBC,mBAAmBP,QAAQQ;EAC3BC,iBAAiBT,QAAQU;CAC3B;CACAC,aAAa,EACXC,OAAOhB,OAAOiB,eAChB;CACAC,YAAY;EACVC,cAAcnB,OAAOiB;EACrBG,eAAe3B;EACf4B,cAAc;EACdC,cAAc9B;CAChB;CAGA+B,OAAO;EACLhB,YAAY;EACZiB,QAAQrB,OAAOsB;EACfjB,gBAAgB;EAChBkB,OAAOvB,OAAOsB;CAChB;CACAE,WAAW;EACTR,cAAcnB,OAAO4B;EACrBR,eA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AAA/C,EAAA,KAAA2D;EAAA3D,EAAA,KAAA0D;EAAA1D,EAAA,KAAAD;EAAAC,EAAA,KAAAG;CAAA,OAAA;EAAAJ,KAAAC,EAAA;EAAAG,KAAAH,EAAA;CAAA;CAb7B1I,UAAUyI,IAaPI,EAA0B;AAAC;AAOhC,SAAAmD,YAAA3F,SAAA;CAAA,MAAAqC,IAAAC,EAAA,CAAA;CACE,MAAA,CAAAmE,aAAAC,kBAAsC7M,SAAwB,IAAI;CAClE,MAAA8M,OAAazM,SAAQiJ,OAAQ,aAAanD,UAAU;CAAC,IAAAoC;CAAA,IAAAI;CAAA,IAAAH,EAAA,OAAAsE,QAAAtE,EAAA,OAAArC,SAAA;EAE3CoC,WAAA;GACR,IAAI,CAACuE,MAAI;GAIT,IAAAT,UAAc;GAWTU,CAAAA,eATLA,MAAA;IACE,MAAAC,eACE,MAAM9M,kBAAiB+M,4BAA6B9G,OAAO;IAE7D,IAAIkG,SACFQ,eAAeG,YAAY;GAC5B,EAAA,CAGM;GAAC,aAEH;IACLX,UAAUA;GAAH;EACR;EACA1D,KAAA,CAACmE,MAAM3G,OAAO;EAACqC,EAAA,KAAAsE;EAAAtE,EAAA,KAAArC;EAAAqC,EAAA,KAAAD;EAAAC,EAAA,KAAAG;CAAA,OAAA;EAAAJ,KAAAC,EAAA;EAAAG,KAAAH,EAAA;CAAA;CArBlB1I,UAAUyI,IAqBPI,EAAe;CAAC,OAEZmE,OAAAF,cAAAzG;AAA4B;AAGrCmC,SAAS4E,QAAQvG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Platform } from "react-native";
|
|
2
|
+
//#region src/glyphs/hidden.ts
|
|
3
|
+
const HIDDEN = Platform.select({
|
|
4
|
+
default: {
|
|
5
|
+
accessibilityElementsHidden: true,
|
|
6
|
+
importantForAccessibility: "no-hide-descendants"
|
|
7
|
+
},
|
|
8
|
+
web: { "aria-hidden": true }
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { HIDDEN };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=hidden.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hidden.js","names":["SvgProps","Platform","HIDDEN","select","default","accessibilityElementsHidden","importantForAccessibility","web"],"sources":["../../src/glyphs/hidden.ts"],"sourcesContent":["import type { SvgProps } from 'react-native-svg'\n\nimport { Platform } from 'react-native'\n\n// What hides an svg from screen readers, for the glyphs and anything else the\n// library draws in one. On iOS and Android that is React Native's two props,\n// one for VoiceOver and one for TalkBack. Under React Native Web,\n// react-native-svg hands its props to the `<svg>` as they are, so it is\n// `aria-hidden` there, which is the one the browser reads.\nconst HIDDEN = Platform.select<SvgProps>({\n default: {\n accessibilityElementsHidden: true,\n importantForAccessibility: 'no-hide-descendants',\n },\n web: { 'aria-hidden': true },\n})\n\nexport { HIDDEN }\n"],"mappings":";;AASA,MAAME,SAASD,SAASE,OAAiB;CACvCC,SAAS;EACPC,6BAA6B;EAC7BC,2BAA2B;CAC7B;CACAC,KAAK,EAAE,eAAe,KAAK;AAC7B,CAAC"}
|
package/dist/glyphs/index.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
+
import { HIDDEN } from "./hidden.js";
|
|
1
2
|
import { useIconStyle } from "./icon-style.js";
|
|
2
3
|
import { glyphStyles } from "./styles.js";
|
|
3
4
|
import { c } from "react/compiler-runtime";
|
|
4
|
-
import { I18nManager,
|
|
5
|
+
import { I18nManager, StyleSheet } from "react-native";
|
|
5
6
|
import Svg, { Path } from "react-native-svg";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
8
|
//#region src/glyphs/index.tsx
|
|
8
|
-
const HIDDEN = Platform.select({
|
|
9
|
-
default: {
|
|
10
|
-
accessibilityElementsHidden: true,
|
|
11
|
-
importantForAccessibility: "no-hide-descendants"
|
|
12
|
-
},
|
|
13
|
-
web: { "aria-hidden": true }
|
|
14
|
-
});
|
|
15
9
|
function CheckGlyph(props) {
|
|
16
10
|
const $ = c(3);
|
|
17
11
|
let t0;
|