@retray-dev/ui-kit 9.3.1 → 10.1.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/COMPONENTS.md +136 -22
- package/CONSUMER.md +48 -8
- package/FONTS.md +54 -13
- package/README.md +40 -3
- package/dist/Accordion.d.mts +1 -1
- package/dist/Accordion.d.ts +1 -1
- package/dist/Accordion.js +2 -2
- package/dist/Accordion.mjs +1 -1
- package/dist/ConfirmDialog.d.mts +6 -1
- package/dist/ConfirmDialog.d.ts +6 -1
- package/dist/ConfirmDialog.js +44 -14
- package/dist/ConfirmDialog.mjs +1 -1
- package/dist/ImageViewer.js +282 -141
- package/dist/ImageViewer.mjs +3 -1
- package/dist/Sheet.js +16 -13
- package/dist/Sheet.mjs +1 -1
- package/dist/Switch.js +40 -17
- package/dist/Switch.mjs +1 -1
- package/dist/{chunk-O3HA6TYM.mjs → chunk-DJ7RN37L.mjs} +2 -2
- package/dist/{chunk-FZZLPJ6B.mjs → chunk-KZL5VTYK.mjs} +43 -14
- package/dist/{chunk-QKH5ZOD5.mjs → chunk-WF2XDFRK.mjs} +40 -17
- package/dist/{chunk-Z4BVUWW6.mjs → chunk-WOEYDUJZ.mjs} +19 -31
- package/dist/{chunk-PFZTM6D5.mjs → chunk-Y2NS74WS.mjs} +9 -7
- package/dist/fonts.d.mts +39 -31
- package/dist/fonts.d.ts +39 -31
- package/dist/fonts.js +34 -39
- package/dist/fonts.mjs +35 -34
- package/dist/index.js +119 -76
- package/dist/index.mjs +5 -5
- package/package.json +3 -1
- package/scripts/build-apk.sh +84 -0
- package/scripts/copy-fonts.js +90 -0
- package/scripts/test-consumer-fonts.sh +82 -0
- package/src/components/Accordion/Accordion.tsx +7 -3
- package/src/components/ConfirmDialog/ConfirmDialog.tsx +61 -23
- package/src/components/ImageViewer/ImageViewer.tsx +25 -30
- package/src/components/Sheet/Sheet.tsx +10 -9
- package/src/components/Switch/Switch.tsx +30 -17
- package/src/fonts.ts +59 -40
package/dist/Sheet.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var React2 = require('react');
|
|
4
4
|
var reactNative = require('react-native');
|
|
5
|
-
var
|
|
5
|
+
var BottomSheet = require('@gorhom/bottom-sheet');
|
|
6
6
|
var reactNativeSafeAreaContext = require('react-native-safe-area-context');
|
|
7
7
|
var vectorIcons = require('@expo/vector-icons');
|
|
8
8
|
var reactNativeSizeMatters = require('react-native-size-matters');
|
|
@@ -10,6 +10,7 @@ var reactNativeSizeMatters = require('react-native-size-matters');
|
|
|
10
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
|
|
12
12
|
var React2__default = /*#__PURE__*/_interopDefault(React2);
|
|
13
|
+
var BottomSheet__default = /*#__PURE__*/_interopDefault(BottomSheet);
|
|
13
14
|
|
|
14
15
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
15
16
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
@@ -256,13 +257,13 @@ function Sheet({
|
|
|
256
257
|
React2.useEffect(() => {
|
|
257
258
|
if (open) {
|
|
258
259
|
impactMedium();
|
|
259
|
-
ref.current?.
|
|
260
|
+
ref.current?.snapToIndex(0);
|
|
260
261
|
} else {
|
|
261
|
-
ref.current?.
|
|
262
|
+
ref.current?.close();
|
|
262
263
|
}
|
|
263
264
|
}, [open]);
|
|
264
265
|
const renderBackdrop = React2.useCallback((props) => /* @__PURE__ */ React2__default.default.createElement(
|
|
265
|
-
|
|
266
|
+
BottomSheet.BottomSheetBackdrop,
|
|
266
267
|
{
|
|
267
268
|
...props,
|
|
268
269
|
disappearsOnIndex: -1,
|
|
@@ -279,7 +280,7 @@ function Sheet({
|
|
|
279
280
|
) : children;
|
|
280
281
|
const effectiveSubtitle = subtitle ?? description;
|
|
281
282
|
const showHeader = !!(title || effectiveSubtitle || showCloseButton) && !customHeader;
|
|
282
|
-
const headerNode = customHeader ? customHeader : showHeader ? /* @__PURE__ */ React2__default.default.createElement(reactNative.View, { style: styles.header, accessibilityRole: "header" }, /* @__PURE__ */ React2__default.default.createElement(reactNative.View, { style: styles.headerRow }, title ? /* @__PURE__ */ React2__default.default.createElement(reactNative.Text, { style: [styles.title, { color: colors.foreground }], allowFontScaling: true }, title) : /* @__PURE__ */ React2__default.default.createElement(reactNative.View, { style: { flex: 1 } }), showCloseButton ? /* @__PURE__ */ React2__default.default.createElement(
|
|
283
|
+
const headerNode = customHeader ? customHeader : showHeader ? /* @__PURE__ */ React2__default.default.createElement(reactNative.View, { style: [styles.header, { backgroundColor: colors.card }], accessibilityRole: "header" }, /* @__PURE__ */ React2__default.default.createElement(reactNative.View, { style: styles.headerRow }, title ? /* @__PURE__ */ React2__default.default.createElement(reactNative.Text, { style: [styles.title, { color: colors.foreground }], allowFontScaling: true }, title) : /* @__PURE__ */ React2__default.default.createElement(reactNative.View, { style: { flex: 1 } }), showCloseButton ? /* @__PURE__ */ React2__default.default.createElement(
|
|
283
284
|
reactNative.TouchableOpacity,
|
|
284
285
|
{
|
|
285
286
|
onPress: onClose,
|
|
@@ -296,7 +297,7 @@ function Sheet({
|
|
|
296
297
|
const effectiveFooter = customFooter ? customFooter : footer;
|
|
297
298
|
const renderFooter = React2.useCallback((props) => {
|
|
298
299
|
if (!effectiveFooter) return null;
|
|
299
|
-
return /* @__PURE__ */ React2__default.default.createElement(
|
|
300
|
+
return /* @__PURE__ */ React2__default.default.createElement(BottomSheet.BottomSheetFooter, { ...props }, effectiveFooter);
|
|
300
301
|
}, [effectiveFooter]);
|
|
301
302
|
if (asDialog) {
|
|
302
303
|
return /* @__PURE__ */ React2__default.default.createElement(reactNative.Modal, { visible: open, transparent: true, animationType: "fade", onRequestClose: onClose }, /* @__PURE__ */ React2__default.default.createElement(reactNative.Pressable, { style: styles.dialogBackdrop, onPress: onClose, accessibilityRole: "button", accessibilityLabel: "Close" }, /* @__PURE__ */ React2__default.default.createElement(
|
|
@@ -327,13 +328,14 @@ function Sheet({
|
|
|
327
328
|
const effectiveMaxHeight = maxHeight ?? DEFAULT_MAX_HEIGHT;
|
|
328
329
|
const useDynamicSizing = !snapPoints;
|
|
329
330
|
return /* @__PURE__ */ React2__default.default.createElement(
|
|
330
|
-
|
|
331
|
+
BottomSheet__default.default,
|
|
331
332
|
{
|
|
332
333
|
ref,
|
|
334
|
+
index: -1,
|
|
335
|
+
onClose,
|
|
333
336
|
enableDynamicSizing: useDynamicSizing,
|
|
334
337
|
snapPoints,
|
|
335
338
|
maxDynamicContentSize: useDynamicSizing ? effectiveMaxHeight : void 0,
|
|
336
|
-
onDismiss: onClose,
|
|
337
339
|
backdropComponent: renderBackdrop,
|
|
338
340
|
footerComponent: effectiveFooter ? renderFooter : void 0,
|
|
339
341
|
backgroundStyle: [styles.background, { backgroundColor: colors.card }],
|
|
@@ -346,7 +348,7 @@ function Sheet({
|
|
|
346
348
|
enableBlurKeyboardOnGesture
|
|
347
349
|
},
|
|
348
350
|
useScroll ? /* @__PURE__ */ React2__default.default.createElement(
|
|
349
|
-
|
|
351
|
+
BottomSheet.BottomSheetScrollView,
|
|
350
352
|
{
|
|
351
353
|
contentContainerStyle: [
|
|
352
354
|
styles.scrollContent,
|
|
@@ -355,11 +357,12 @@ function Sheet({
|
|
|
355
357
|
style: contentStyle,
|
|
356
358
|
showsVerticalScrollIndicator: true,
|
|
357
359
|
indicatorStyle: "black",
|
|
358
|
-
persistentScrollbar: isAndroid
|
|
360
|
+
persistentScrollbar: isAndroid,
|
|
361
|
+
stickyHeaderIndices: headerNode ? [0] : void 0
|
|
359
362
|
},
|
|
360
363
|
headerNode,
|
|
361
364
|
contentNode
|
|
362
|
-
) : /* @__PURE__ */ React2__default.default.createElement(
|
|
365
|
+
) : /* @__PURE__ */ React2__default.default.createElement(BottomSheet.BottomSheetView, { style: [styles.content, contentStyle, style] }, headerNode, contentNode)
|
|
363
366
|
);
|
|
364
367
|
}
|
|
365
368
|
Sheet.Header = SheetHeader;
|
|
@@ -441,10 +444,10 @@ var styles = reactNative.StyleSheet.create({
|
|
|
441
444
|
|
|
442
445
|
Object.defineProperty(exports, "BottomSheetModalProvider", {
|
|
443
446
|
enumerable: true,
|
|
444
|
-
get: function () { return
|
|
447
|
+
get: function () { return BottomSheet.BottomSheetModalProvider; }
|
|
445
448
|
});
|
|
446
449
|
Object.defineProperty(exports, "SheetTextInput", {
|
|
447
450
|
enumerable: true,
|
|
448
|
-
get: function () { return
|
|
451
|
+
get: function () { return BottomSheet.BottomSheetTextInput; }
|
|
449
452
|
});
|
|
450
453
|
exports.Sheet = Sheet;
|
package/dist/Sheet.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BottomSheetModalProvider, Sheet, BottomSheetTextInput as SheetTextInput } from './chunk-
|
|
1
|
+
export { BottomSheetModalProvider, Sheet, BottomSheetTextInput as SheetTextInput } from './chunk-Y2NS74WS.mjs';
|
|
2
2
|
import './chunk-EJ7ZPXOH.mjs';
|
|
3
3
|
import './chunk-QY3X2UYR.mjs';
|
|
4
4
|
import './chunk-SOYNZDVY.mjs';
|
package/dist/Switch.js
CHANGED
|
@@ -227,9 +227,11 @@ var THUMB_SIZE = s(24);
|
|
|
227
227
|
var THUMB_OFFSET = s(3);
|
|
228
228
|
var THUMB_TRAVEL = TRACK_WIDTH - THUMB_SIZE - THUMB_OFFSET * 2;
|
|
229
229
|
var ICON_SIZE = s(13);
|
|
230
|
+
var DISABLED_OPACITY = 0.45;
|
|
230
231
|
function Switch({ checked = false, onCheckedChange, disabled, style, accessibilityLabel }) {
|
|
231
232
|
const { colors } = useTheme();
|
|
232
|
-
|
|
233
|
+
const isDisabled = !!disabled;
|
|
234
|
+
return /* @__PURE__ */ React2__default.default.createElement(reactNative.View, { style: [{ alignSelf: "flex-start" }, style] }, /* @__PURE__ */ React2__default.default.createElement(
|
|
233
235
|
reactNative.TouchableOpacity,
|
|
234
236
|
{
|
|
235
237
|
onPress: () => {
|
|
@@ -241,47 +243,68 @@ function Switch({ checked = false, onCheckedChange, disabled, style, accessibili
|
|
|
241
243
|
touchSoundDisabled: true,
|
|
242
244
|
accessibilityRole: "switch",
|
|
243
245
|
accessibilityLabel,
|
|
244
|
-
accessibilityState: { checked, disabled:
|
|
246
|
+
accessibilityState: { checked, disabled: isDisabled },
|
|
245
247
|
style: styles.touchable
|
|
246
248
|
},
|
|
247
|
-
/* @__PURE__ */ React2__default.default.createElement(
|
|
249
|
+
/* @__PURE__ */ React2__default.default.createElement(reactNative.View, { style: styles.trackContainer }, /* @__PURE__ */ React2__default.default.createElement(
|
|
248
250
|
reactNativeEase.EaseView,
|
|
249
251
|
{
|
|
250
|
-
style: styles.track,
|
|
252
|
+
style: [styles.track, isDisabled && styles.disabledTrack],
|
|
251
253
|
animate: { backgroundColor: checked ? colors.primary : colors.surfaceStrong },
|
|
252
254
|
transition: COLOR_TRANSITION
|
|
255
|
+
}
|
|
256
|
+
), /* @__PURE__ */ React2__default.default.createElement(
|
|
257
|
+
reactNativeEase.EaseView,
|
|
258
|
+
{
|
|
259
|
+
style: [styles.trackBorder, { borderWidth: 1.5 }],
|
|
260
|
+
pointerEvents: "none",
|
|
261
|
+
animate: { borderColor: checked ? "transparent" : colors.border },
|
|
262
|
+
transition: COLOR_TRANSITION
|
|
263
|
+
}
|
|
264
|
+
), /* @__PURE__ */ React2__default.default.createElement(
|
|
265
|
+
reactNativeEase.EaseView,
|
|
266
|
+
{
|
|
267
|
+
style: [styles.thumb, { backgroundColor: colors.primaryForeground }],
|
|
268
|
+
animate: { translateX: checked ? THUMB_TRAVEL : 0 },
|
|
269
|
+
transition: SPRING_ELASTIC
|
|
253
270
|
},
|
|
254
271
|
/* @__PURE__ */ React2__default.default.createElement(
|
|
255
272
|
reactNativeEase.EaseView,
|
|
256
273
|
{
|
|
257
|
-
style:
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
274
|
+
style: styles.iconWrapper,
|
|
275
|
+
animate: { opacity: checked ? isDisabled ? DISABLED_OPACITY : 1 : 0 },
|
|
276
|
+
transition: OPACITY_TRANSITION
|
|
277
|
+
},
|
|
278
|
+
/* @__PURE__ */ React2__default.default.createElement(vectorIcons.Feather, { name: "check", size: ICON_SIZE, color: colors.primary })
|
|
262
279
|
),
|
|
263
280
|
/* @__PURE__ */ React2__default.default.createElement(
|
|
264
281
|
reactNativeEase.EaseView,
|
|
265
282
|
{
|
|
266
|
-
style:
|
|
267
|
-
animate: {
|
|
268
|
-
transition:
|
|
283
|
+
style: styles.iconWrapper,
|
|
284
|
+
animate: { opacity: checked ? 0 : isDisabled ? DISABLED_OPACITY : 1 },
|
|
285
|
+
transition: OPACITY_TRANSITION
|
|
269
286
|
},
|
|
270
|
-
/* @__PURE__ */ React2__default.default.createElement(
|
|
271
|
-
/* @__PURE__ */ React2__default.default.createElement(reactNativeEase.EaseView, { style: styles.iconWrapper, animate: { opacity: checked ? 0 : 1 }, transition: OPACITY_TRANSITION }, /* @__PURE__ */ React2__default.default.createElement(vectorIcons.Feather, { name: "x", size: ICON_SIZE, color: colors.foregroundMuted }))
|
|
287
|
+
/* @__PURE__ */ React2__default.default.createElement(vectorIcons.Feather, { name: "x", size: ICON_SIZE, color: colors.foregroundMuted })
|
|
272
288
|
)
|
|
273
|
-
)
|
|
289
|
+
))
|
|
274
290
|
));
|
|
275
291
|
}
|
|
276
292
|
var styles = reactNative.StyleSheet.create({
|
|
277
293
|
touchable: {
|
|
278
294
|
alignSelf: "flex-start"
|
|
279
295
|
},
|
|
280
|
-
|
|
296
|
+
trackContainer: {
|
|
297
|
+
position: "relative",
|
|
281
298
|
width: TRACK_WIDTH,
|
|
282
|
-
height: TRACK_HEIGHT
|
|
299
|
+
height: TRACK_HEIGHT
|
|
300
|
+
},
|
|
301
|
+
track: {
|
|
302
|
+
...reactNative.StyleSheet.absoluteFillObject,
|
|
283
303
|
borderRadius: TRACK_HEIGHT / 2
|
|
284
304
|
},
|
|
305
|
+
disabledTrack: {
|
|
306
|
+
opacity: DISABLED_OPACITY
|
|
307
|
+
},
|
|
285
308
|
trackBorder: {
|
|
286
309
|
...reactNative.StyleSheet.absoluteFillObject,
|
|
287
310
|
borderRadius: TRACK_HEIGHT / 2
|
package/dist/Switch.mjs
CHANGED
|
@@ -49,9 +49,9 @@ function AccordionItemComponent({
|
|
|
49
49
|
},
|
|
50
50
|
accessibilityRole: "button",
|
|
51
51
|
accessibilityState: { expanded: isOpen },
|
|
52
|
-
accessibilityLabel: item.trigger
|
|
52
|
+
accessibilityLabel: typeof item.trigger === "string" ? item.trigger : void 0
|
|
53
53
|
},
|
|
54
|
-
/* @__PURE__ */ React.createElement(View, { style: styles.triggerContent }, resolvedIcon ? /* @__PURE__ */ React.createElement(View, { style: styles.icon }, resolvedIcon) : null, /* @__PURE__ */ React.createElement(Text, { style: [styles.triggerText, { color: colors.foreground }], allowFontScaling: true }, item.trigger)),
|
|
54
|
+
/* @__PURE__ */ React.createElement(View, { style: styles.triggerContent }, resolvedIcon ? /* @__PURE__ */ React.createElement(View, { style: styles.icon }, resolvedIcon) : null, typeof item.trigger === "string" ? /* @__PURE__ */ React.createElement(Text, { style: [styles.triggerText, { color: colors.foreground }], allowFontScaling: true }, item.trigger) : item.trigger),
|
|
55
55
|
/* @__PURE__ */ React.createElement(Animated.View, { style: [styles.chevron, rotationStyle] }, /* @__PURE__ */ React.createElement(Entypo, { name: "chevron-down", size: 18, color: colors.foregroundMuted }))
|
|
56
56
|
), /* @__PURE__ */ React.createElement(Animated.View, { style: bodyStyle }, /* @__PURE__ */ React.createElement(
|
|
57
57
|
View,
|
|
@@ -3,29 +3,32 @@ import { impactMedium, notificationSuccess, selectionAsync } from './chunk-EJ7ZP
|
|
|
3
3
|
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
4
4
|
import { vs, mvs, ms, s } from './chunk-2CE3TQVY.mjs';
|
|
5
5
|
import React, { useRef, useEffect } from 'react';
|
|
6
|
-
import { StyleSheet, Text,
|
|
7
|
-
import {
|
|
6
|
+
import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
|
|
7
|
+
import BottomSheet, { BottomSheetView, BottomSheetBackdrop } from '@gorhom/bottom-sheet';
|
|
8
8
|
import { Feather } from '@expo/vector-icons';
|
|
9
9
|
|
|
10
10
|
function ConfirmDialog({
|
|
11
11
|
visible,
|
|
12
12
|
title,
|
|
13
|
+
subtitle,
|
|
13
14
|
description,
|
|
14
15
|
confirmLabel = "Confirm",
|
|
15
16
|
cancelLabel = "Cancel",
|
|
16
17
|
confirmVariant = "primary",
|
|
17
18
|
loading = false,
|
|
19
|
+
showCloseButton = false,
|
|
18
20
|
onConfirm,
|
|
19
21
|
onCancel
|
|
20
22
|
}) {
|
|
21
23
|
const { colors } = useTheme();
|
|
22
24
|
const ref = useRef(null);
|
|
25
|
+
const effectiveSubtitle = subtitle ?? description;
|
|
23
26
|
useEffect(() => {
|
|
24
27
|
if (visible) {
|
|
25
28
|
impactMedium();
|
|
26
|
-
ref.current?.
|
|
29
|
+
ref.current?.snapToIndex(0);
|
|
27
30
|
} else {
|
|
28
|
-
ref.current?.
|
|
31
|
+
ref.current?.close();
|
|
29
32
|
}
|
|
30
33
|
}, [visible]);
|
|
31
34
|
const renderBackdrop = (props) => /* @__PURE__ */ React.createElement(
|
|
@@ -38,17 +41,30 @@ function ConfirmDialog({
|
|
|
38
41
|
}
|
|
39
42
|
);
|
|
40
43
|
return /* @__PURE__ */ React.createElement(
|
|
41
|
-
|
|
44
|
+
BottomSheet,
|
|
42
45
|
{
|
|
43
46
|
ref,
|
|
47
|
+
index: -1,
|
|
48
|
+
onClose: onCancel,
|
|
44
49
|
enableDynamicSizing: true,
|
|
45
|
-
onDismiss: onCancel,
|
|
46
50
|
backdropComponent: renderBackdrop,
|
|
47
51
|
backgroundStyle: [styles.background, { backgroundColor: colors.card }],
|
|
48
52
|
handleIndicatorStyle: [styles.handle, { backgroundColor: colors.border }],
|
|
49
53
|
enablePanDownToClose: true
|
|
50
54
|
},
|
|
51
|
-
/* @__PURE__ */ React.createElement(BottomSheetView, { style: styles.content }, /* @__PURE__ */ React.createElement(
|
|
55
|
+
/* @__PURE__ */ React.createElement(BottomSheetView, { style: styles.content }, /* @__PURE__ */ React.createElement(View, { style: styles.header, accessibilityRole: "header" }, /* @__PURE__ */ React.createElement(View, { style: styles.headerRow }, /* @__PURE__ */ React.createElement(Text, { style: [styles.title, { color: colors.foreground }], allowFontScaling: true }, title), showCloseButton ? /* @__PURE__ */ React.createElement(
|
|
56
|
+
TouchableOpacity,
|
|
57
|
+
{
|
|
58
|
+
onPress: onCancel,
|
|
59
|
+
style: styles.closeButton,
|
|
60
|
+
activeOpacity: 0.6,
|
|
61
|
+
touchSoundDisabled: true,
|
|
62
|
+
accessibilityRole: "button",
|
|
63
|
+
accessibilityLabel: "Close",
|
|
64
|
+
hitSlop: { top: 12, bottom: 12, left: 12, right: 12 }
|
|
65
|
+
},
|
|
66
|
+
/* @__PURE__ */ React.createElement(Feather, { name: "x", size: ms(18), color: colors.foregroundMuted })
|
|
67
|
+
) : null), effectiveSubtitle ? /* @__PURE__ */ React.createElement(Text, { style: [styles.subtitle, { color: colors.foregroundMuted }], allowFontScaling: true }, effectiveSubtitle) : null), /* @__PURE__ */ React.createElement(View, { style: styles.actions }, /* @__PURE__ */ React.createElement(
|
|
52
68
|
Button,
|
|
53
69
|
{
|
|
54
70
|
label: confirmLabel,
|
|
@@ -95,19 +111,32 @@ var styles = StyleSheet.create({
|
|
|
95
111
|
borderRadius: ms(2)
|
|
96
112
|
},
|
|
97
113
|
content: {
|
|
98
|
-
paddingHorizontal: s(
|
|
99
|
-
paddingBottom: vs(32)
|
|
100
|
-
|
|
114
|
+
paddingHorizontal: s(16),
|
|
115
|
+
paddingBottom: vs(32)
|
|
116
|
+
},
|
|
117
|
+
header: {
|
|
118
|
+
paddingTop: vs(4),
|
|
119
|
+
paddingBottom: vs(12),
|
|
120
|
+
gap: vs(4)
|
|
121
|
+
},
|
|
122
|
+
headerRow: {
|
|
123
|
+
flexDirection: "row",
|
|
124
|
+
alignItems: "center",
|
|
125
|
+
justifyContent: "space-between"
|
|
101
126
|
},
|
|
102
127
|
title: {
|
|
103
128
|
fontFamily: "Sohne-SemiBold",
|
|
104
129
|
fontSize: ms(18),
|
|
105
|
-
|
|
130
|
+
flex: 1
|
|
131
|
+
},
|
|
132
|
+
closeButton: {
|
|
133
|
+
padding: s(4),
|
|
134
|
+
marginLeft: s(8)
|
|
106
135
|
},
|
|
107
|
-
|
|
136
|
+
subtitle: {
|
|
108
137
|
fontFamily: "Sohne-Regular",
|
|
109
|
-
fontSize: ms(
|
|
110
|
-
lineHeight: mvs(
|
|
138
|
+
fontSize: ms(14),
|
|
139
|
+
lineHeight: mvs(20)
|
|
111
140
|
},
|
|
112
141
|
actions: {
|
|
113
142
|
gap: vs(10),
|
|
@@ -13,9 +13,11 @@ var THUMB_SIZE = s(24);
|
|
|
13
13
|
var THUMB_OFFSET = s(3);
|
|
14
14
|
var THUMB_TRAVEL = TRACK_WIDTH - THUMB_SIZE - THUMB_OFFSET * 2;
|
|
15
15
|
var ICON_SIZE = s(13);
|
|
16
|
+
var DISABLED_OPACITY = 0.45;
|
|
16
17
|
function Switch({ checked = false, onCheckedChange, disabled, style, accessibilityLabel }) {
|
|
17
18
|
const { colors } = useTheme();
|
|
18
|
-
|
|
19
|
+
const isDisabled = !!disabled;
|
|
20
|
+
return /* @__PURE__ */ React.createElement(View, { style: [{ alignSelf: "flex-start" }, style] }, /* @__PURE__ */ React.createElement(
|
|
19
21
|
TouchableOpacity,
|
|
20
22
|
{
|
|
21
23
|
onPress: () => {
|
|
@@ -27,47 +29,68 @@ function Switch({ checked = false, onCheckedChange, disabled, style, accessibili
|
|
|
27
29
|
touchSoundDisabled: true,
|
|
28
30
|
accessibilityRole: "switch",
|
|
29
31
|
accessibilityLabel,
|
|
30
|
-
accessibilityState: { checked, disabled:
|
|
32
|
+
accessibilityState: { checked, disabled: isDisabled },
|
|
31
33
|
style: styles.touchable
|
|
32
34
|
},
|
|
33
|
-
/* @__PURE__ */ React.createElement(
|
|
35
|
+
/* @__PURE__ */ React.createElement(View, { style: styles.trackContainer }, /* @__PURE__ */ React.createElement(
|
|
34
36
|
EaseView,
|
|
35
37
|
{
|
|
36
|
-
style: styles.track,
|
|
38
|
+
style: [styles.track, isDisabled && styles.disabledTrack],
|
|
37
39
|
animate: { backgroundColor: checked ? colors.primary : colors.surfaceStrong },
|
|
38
40
|
transition: COLOR_TRANSITION
|
|
41
|
+
}
|
|
42
|
+
), /* @__PURE__ */ React.createElement(
|
|
43
|
+
EaseView,
|
|
44
|
+
{
|
|
45
|
+
style: [styles.trackBorder, { borderWidth: 1.5 }],
|
|
46
|
+
pointerEvents: "none",
|
|
47
|
+
animate: { borderColor: checked ? "transparent" : colors.border },
|
|
48
|
+
transition: COLOR_TRANSITION
|
|
49
|
+
}
|
|
50
|
+
), /* @__PURE__ */ React.createElement(
|
|
51
|
+
EaseView,
|
|
52
|
+
{
|
|
53
|
+
style: [styles.thumb, { backgroundColor: colors.primaryForeground }],
|
|
54
|
+
animate: { translateX: checked ? THUMB_TRAVEL : 0 },
|
|
55
|
+
transition: SPRING_ELASTIC
|
|
39
56
|
},
|
|
40
57
|
/* @__PURE__ */ React.createElement(
|
|
41
58
|
EaseView,
|
|
42
59
|
{
|
|
43
|
-
style:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
60
|
+
style: styles.iconWrapper,
|
|
61
|
+
animate: { opacity: checked ? isDisabled ? DISABLED_OPACITY : 1 : 0 },
|
|
62
|
+
transition: OPACITY_TRANSITION
|
|
63
|
+
},
|
|
64
|
+
/* @__PURE__ */ React.createElement(Feather, { name: "check", size: ICON_SIZE, color: colors.primary })
|
|
48
65
|
),
|
|
49
66
|
/* @__PURE__ */ React.createElement(
|
|
50
67
|
EaseView,
|
|
51
68
|
{
|
|
52
|
-
style:
|
|
53
|
-
animate: {
|
|
54
|
-
transition:
|
|
69
|
+
style: styles.iconWrapper,
|
|
70
|
+
animate: { opacity: checked ? 0 : isDisabled ? DISABLED_OPACITY : 1 },
|
|
71
|
+
transition: OPACITY_TRANSITION
|
|
55
72
|
},
|
|
56
|
-
/* @__PURE__ */ React.createElement(
|
|
57
|
-
/* @__PURE__ */ React.createElement(EaseView, { style: styles.iconWrapper, animate: { opacity: checked ? 0 : 1 }, transition: OPACITY_TRANSITION }, /* @__PURE__ */ React.createElement(Feather, { name: "x", size: ICON_SIZE, color: colors.foregroundMuted }))
|
|
73
|
+
/* @__PURE__ */ React.createElement(Feather, { name: "x", size: ICON_SIZE, color: colors.foregroundMuted })
|
|
58
74
|
)
|
|
59
|
-
)
|
|
75
|
+
))
|
|
60
76
|
));
|
|
61
77
|
}
|
|
62
78
|
var styles = StyleSheet.create({
|
|
63
79
|
touchable: {
|
|
64
80
|
alignSelf: "flex-start"
|
|
65
81
|
},
|
|
66
|
-
|
|
82
|
+
trackContainer: {
|
|
83
|
+
position: "relative",
|
|
67
84
|
width: TRACK_WIDTH,
|
|
68
|
-
height: TRACK_HEIGHT
|
|
85
|
+
height: TRACK_HEIGHT
|
|
86
|
+
},
|
|
87
|
+
track: {
|
|
88
|
+
...StyleSheet.absoluteFillObject,
|
|
69
89
|
borderRadius: TRACK_HEIGHT / 2
|
|
70
90
|
},
|
|
91
|
+
disabledTrack: {
|
|
92
|
+
opacity: DISABLED_OPACITY
|
|
93
|
+
},
|
|
71
94
|
trackBorder: {
|
|
72
95
|
...StyleSheet.absoluteFillObject,
|
|
73
96
|
borderRadius: TRACK_HEIGHT / 2
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PagerDots } from './chunk-4K625MVM.mjs';
|
|
2
|
-
import {
|
|
2
|
+
import { IconButton } from './chunk-3U4SSNWP.mjs';
|
|
3
3
|
import { s, vs } from './chunk-2CE3TQVY.mjs';
|
|
4
4
|
import React, { useState, useCallback } from 'react';
|
|
5
|
-
import { StyleSheet, useWindowDimensions, Modal,
|
|
5
|
+
import { StyleSheet, useWindowDimensions, Dimensions, Modal, View, ScrollView, Image } from 'react-native';
|
|
6
6
|
import { Gesture, GestureHandlerRootView, GestureDetector } from 'react-native-gesture-handler';
|
|
7
7
|
import Animated, { useSharedValue, runOnJS, withTiming, useAnimatedStyle } from 'react-native-reanimated';
|
|
8
8
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
@@ -62,17 +62,12 @@ function ZoomableImage({ source, width, height, onZoomChange }) {
|
|
|
62
62
|
{ scale: scale.value }
|
|
63
63
|
]
|
|
64
64
|
}));
|
|
65
|
-
return /* @__PURE__ */ React.createElement(GestureDetector, { gesture: composed }, /* @__PURE__ */ React.createElement(
|
|
66
|
-
Animated.Image,
|
|
67
|
-
{
|
|
68
|
-
source,
|
|
69
|
-
style: [{ width, height }, animatedStyle],
|
|
70
|
-
resizeMode: "contain"
|
|
71
|
-
}
|
|
72
|
-
)));
|
|
65
|
+
return /* @__PURE__ */ React.createElement(GestureDetector, { gesture: composed }, /* @__PURE__ */ React.createElement(View, { style: [{ width, height }, styles.imageWrap], collapsable: false }, /* @__PURE__ */ React.createElement(Animated.View, { style: [{ width, height }, animatedStyle] }, /* @__PURE__ */ React.createElement(Image, { source, style: { width, height }, resizeMode: "contain" }))));
|
|
73
66
|
}
|
|
74
67
|
function ImageViewer({ images, visible, onClose, initialIndex = 0 }) {
|
|
75
|
-
const
|
|
68
|
+
const window = useWindowDimensions();
|
|
69
|
+
const width = window.width > 0 ? window.width : Dimensions.get("window").width;
|
|
70
|
+
const height = window.height > 0 ? window.height : Dimensions.get("window").height;
|
|
76
71
|
const insets = useSafeAreaInsets();
|
|
77
72
|
const [index, setIndex] = useState(initialIndex);
|
|
78
73
|
const [pagingEnabled, setPagingEnabled] = useState(true);
|
|
@@ -115,7 +110,7 @@ function ImageViewer({ images, visible, onClose, initialIndex = 0 }) {
|
|
|
115
110
|
scrollRef.current?.scrollTo({ x: page * width, animated: true });
|
|
116
111
|
setIndex(page);
|
|
117
112
|
};
|
|
118
|
-
return /* @__PURE__ */ React.createElement(Modal, { visible, transparent: false, animationType: "fade", onRequestClose: onClose, statusBarTranslucent: true }, /* @__PURE__ */ React.createElement(GestureHandlerRootView, { style: styles.root }, /* @__PURE__ */ React.createElement(Animated.View, { style: [styles.backdrop, backdropStyle], pointerEvents: "none" }), /* @__PURE__ */ React.createElement(Animated.View, { style: [styles.container, dismissStyle] }, /* @__PURE__ */ React.createElement(GestureDetector, { gesture: swipeDown }, /* @__PURE__ */ React.createElement(
|
|
113
|
+
return /* @__PURE__ */ React.createElement(Modal, { visible, transparent: false, animationType: "fade", onRequestClose: onClose, statusBarTranslucent: true }, /* @__PURE__ */ React.createElement(GestureHandlerRootView, { style: styles.root }, /* @__PURE__ */ React.createElement(Animated.View, { style: [styles.backdrop, backdropStyle], pointerEvents: "none" }), /* @__PURE__ */ React.createElement(Animated.View, { style: [styles.container, dismissStyle] }, /* @__PURE__ */ React.createElement(GestureDetector, { gesture: swipeDown }, /* @__PURE__ */ React.createElement(View, { style: styles.root, collapsable: false }, /* @__PURE__ */ React.createElement(
|
|
119
114
|
ScrollView,
|
|
120
115
|
{
|
|
121
116
|
ref: scrollRef,
|
|
@@ -136,19 +131,18 @@ function ImageViewer({ images, visible, onClose, initialIndex = 0 }) {
|
|
|
136
131
|
onZoomChange: (zoomed) => setPagingEnabled(!zoomed)
|
|
137
132
|
}
|
|
138
133
|
))
|
|
139
|
-
))), /* @__PURE__ */ React.createElement(
|
|
140
|
-
|
|
134
|
+
))), /* @__PURE__ */ React.createElement(View, { style: [styles.closeButtonWrapper, { top: insets.top + vs(8) }] }, /* @__PURE__ */ React.createElement(
|
|
135
|
+
IconButton,
|
|
141
136
|
{
|
|
142
|
-
|
|
137
|
+
iconName: "x",
|
|
138
|
+
size: "md",
|
|
139
|
+
variant: "text",
|
|
140
|
+
style: { backgroundColor: "rgba(255,255,255,0.18)" },
|
|
141
|
+
iconColor: "#fff",
|
|
143
142
|
onPress: onClose,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
accessibilityLabel: "Close",
|
|
148
|
-
hitSlop: { top: 12, bottom: 12, left: 12, right: 12 }
|
|
149
|
-
},
|
|
150
|
-
renderIcon("x", 26, "#fff")
|
|
151
|
-
), images.length > 1 ? /* @__PURE__ */ React.createElement(View, { style: [styles.dots, { bottom: insets.bottom + vs(16) }], pointerEvents: "box-none" }, /* @__PURE__ */ React.createElement(
|
|
143
|
+
accessibilityLabel: "Close"
|
|
144
|
+
}
|
|
145
|
+
)), images.length > 1 ? /* @__PURE__ */ React.createElement(View, { style: [styles.dots, { bottom: insets.bottom + vs(16) }], pointerEvents: "box-none" }, /* @__PURE__ */ React.createElement(
|
|
152
146
|
PagerDots,
|
|
153
147
|
{
|
|
154
148
|
count: images.length,
|
|
@@ -175,15 +169,9 @@ var styles = StyleSheet.create({
|
|
|
175
169
|
justifyContent: "center",
|
|
176
170
|
overflow: "hidden"
|
|
177
171
|
},
|
|
178
|
-
|
|
172
|
+
closeButtonWrapper: {
|
|
179
173
|
position: "absolute",
|
|
180
|
-
right: s(12)
|
|
181
|
-
width: s(40),
|
|
182
|
-
height: s(40),
|
|
183
|
-
borderRadius: s(20),
|
|
184
|
-
backgroundColor: "rgba(0,0,0,0.4)",
|
|
185
|
-
alignItems: "center",
|
|
186
|
-
justifyContent: "center"
|
|
174
|
+
right: s(12)
|
|
187
175
|
},
|
|
188
176
|
dots: {
|
|
189
177
|
position: "absolute",
|
|
@@ -4,7 +4,7 @@ import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
|
4
4
|
import { vs, s, mvs, ms } from './chunk-2CE3TQVY.mjs';
|
|
5
5
|
import React, { useRef, useEffect, useCallback } from 'react';
|
|
6
6
|
import { Dimensions, Platform, StyleSheet, useWindowDimensions, View, Text, TouchableOpacity, Modal, Pressable, ScrollView } from 'react-native';
|
|
7
|
-
import { BottomSheetBackdrop, BottomSheetFooter,
|
|
7
|
+
import BottomSheet, { BottomSheetBackdrop, BottomSheetFooter, BottomSheetScrollView, BottomSheetView } from '@gorhom/bottom-sheet';
|
|
8
8
|
export { BottomSheetModalProvider, BottomSheetTextInput } from '@gorhom/bottom-sheet';
|
|
9
9
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
10
10
|
import { AntDesign } from '@expo/vector-icons';
|
|
@@ -52,9 +52,9 @@ function Sheet({
|
|
|
52
52
|
useEffect(() => {
|
|
53
53
|
if (open) {
|
|
54
54
|
impactMedium();
|
|
55
|
-
ref.current?.
|
|
55
|
+
ref.current?.snapToIndex(0);
|
|
56
56
|
} else {
|
|
57
|
-
ref.current?.
|
|
57
|
+
ref.current?.close();
|
|
58
58
|
}
|
|
59
59
|
}, [open]);
|
|
60
60
|
const renderBackdrop = useCallback((props) => /* @__PURE__ */ React.createElement(
|
|
@@ -75,7 +75,7 @@ function Sheet({
|
|
|
75
75
|
) : children;
|
|
76
76
|
const effectiveSubtitle = subtitle ?? description;
|
|
77
77
|
const showHeader = !!(title || effectiveSubtitle || showCloseButton) && !customHeader;
|
|
78
|
-
const headerNode = customHeader ? customHeader : showHeader ? /* @__PURE__ */ React.createElement(View, { style: styles.header, accessibilityRole: "header" }, /* @__PURE__ */ React.createElement(View, { style: styles.headerRow }, title ? /* @__PURE__ */ React.createElement(Text, { style: [styles.title, { color: colors.foreground }], allowFontScaling: true }, title) : /* @__PURE__ */ React.createElement(View, { style: { flex: 1 } }), showCloseButton ? /* @__PURE__ */ React.createElement(
|
|
78
|
+
const headerNode = customHeader ? customHeader : showHeader ? /* @__PURE__ */ React.createElement(View, { style: [styles.header, { backgroundColor: colors.card }], accessibilityRole: "header" }, /* @__PURE__ */ React.createElement(View, { style: styles.headerRow }, title ? /* @__PURE__ */ React.createElement(Text, { style: [styles.title, { color: colors.foreground }], allowFontScaling: true }, title) : /* @__PURE__ */ React.createElement(View, { style: { flex: 1 } }), showCloseButton ? /* @__PURE__ */ React.createElement(
|
|
79
79
|
TouchableOpacity,
|
|
80
80
|
{
|
|
81
81
|
onPress: onClose,
|
|
@@ -123,13 +123,14 @@ function Sheet({
|
|
|
123
123
|
const effectiveMaxHeight = maxHeight ?? DEFAULT_MAX_HEIGHT;
|
|
124
124
|
const useDynamicSizing = !snapPoints;
|
|
125
125
|
return /* @__PURE__ */ React.createElement(
|
|
126
|
-
|
|
126
|
+
BottomSheet,
|
|
127
127
|
{
|
|
128
128
|
ref,
|
|
129
|
+
index: -1,
|
|
130
|
+
onClose,
|
|
129
131
|
enableDynamicSizing: useDynamicSizing,
|
|
130
132
|
snapPoints,
|
|
131
133
|
maxDynamicContentSize: useDynamicSizing ? effectiveMaxHeight : void 0,
|
|
132
|
-
onDismiss: onClose,
|
|
133
134
|
backdropComponent: renderBackdrop,
|
|
134
135
|
footerComponent: effectiveFooter ? renderFooter : void 0,
|
|
135
136
|
backgroundStyle: [styles.background, { backgroundColor: colors.card }],
|
|
@@ -151,7 +152,8 @@ function Sheet({
|
|
|
151
152
|
style: contentStyle,
|
|
152
153
|
showsVerticalScrollIndicator: true,
|
|
153
154
|
indicatorStyle: "black",
|
|
154
|
-
persistentScrollbar: isAndroid
|
|
155
|
+
persistentScrollbar: isAndroid,
|
|
156
|
+
stickyHeaderIndices: headerNode ? [0] : void 0
|
|
155
157
|
},
|
|
156
158
|
headerNode,
|
|
157
159
|
contentNode
|