@repzo/widget-react-native 1.0.0 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +167 -74
- package/lib/commonjs/api/client.js +3 -1
- package/lib/commonjs/api/client.js.map +1 -1
- package/lib/commonjs/api/realtime.js +2 -0
- package/lib/commonjs/api/realtime.js.map +1 -1
- package/lib/commonjs/attachments/pickers.js +493 -0
- package/lib/commonjs/attachments/pickers.js.map +1 -0
- package/lib/commonjs/i18n.js +45 -0
- package/lib/commonjs/i18n.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/locales.js +21 -0
- package/lib/commonjs/locales.js.map +1 -1
- package/lib/commonjs/state/widget-store.js +256 -18
- package/lib/commonjs/state/widget-store.js.map +1 -1
- package/lib/commonjs/types.js +16 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/ui/WidgetProvider.js +70 -10
- package/lib/commonjs/ui/WidgetProvider.js.map +1 -1
- package/lib/commonjs/ui/components/AttachmentChips.js +135 -0
- package/lib/commonjs/ui/components/AttachmentChips.js.map +1 -0
- package/lib/commonjs/ui/components/AttachmentMenu.js +125 -0
- package/lib/commonjs/ui/components/AttachmentMenu.js.map +1 -0
- package/lib/commonjs/ui/components/ImageViewer.js +181 -0
- package/lib/commonjs/ui/components/ImageViewer.js.map +1 -0
- package/lib/commonjs/ui/components/InAppNotification.js +210 -0
- package/lib/commonjs/ui/components/InAppNotification.js.map +1 -0
- package/lib/commonjs/ui/components/TeamAvatars.js +63 -0
- package/lib/commonjs/ui/components/TeamAvatars.js.map +1 -0
- package/lib/commonjs/ui/components/icons.js +50 -0
- package/lib/commonjs/ui/components/icons.js.map +1 -1
- package/lib/commonjs/ui/screens/chat/ChatView.js +303 -24
- package/lib/commonjs/ui/screens/chat/ChatView.js.map +1 -1
- package/lib/commonjs/ui/screens/chat/ChatView.styles.js +70 -0
- package/lib/commonjs/ui/screens/chat/ChatView.styles.js.map +1 -1
- package/lib/module/api/client.js +3 -1
- package/lib/module/api/client.js.map +1 -1
- package/lib/module/api/realtime.js +2 -0
- package/lib/module/api/realtime.js.map +1 -1
- package/lib/module/attachments/pickers.js +479 -0
- package/lib/module/attachments/pickers.js.map +1 -0
- package/lib/module/i18n.js +44 -0
- package/lib/module/i18n.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/locales.js +21 -0
- package/lib/module/locales.js.map +1 -1
- package/lib/module/state/widget-store.js +256 -18
- package/lib/module/state/widget-store.js.map +1 -1
- package/lib/module/types.js +16 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/ui/WidgetProvider.js +71 -11
- package/lib/module/ui/WidgetProvider.js.map +1 -1
- package/lib/module/ui/components/AttachmentChips.js +131 -0
- package/lib/module/ui/components/AttachmentChips.js.map +1 -0
- package/lib/module/ui/components/AttachmentMenu.js +120 -0
- package/lib/module/ui/components/AttachmentMenu.js.map +1 -0
- package/lib/module/ui/components/ImageViewer.js +177 -0
- package/lib/module/ui/components/ImageViewer.js.map +1 -0
- package/lib/module/ui/components/InAppNotification.js +208 -0
- package/lib/module/ui/components/InAppNotification.js.map +1 -0
- package/lib/module/ui/components/TeamAvatars.js +59 -0
- package/lib/module/ui/components/TeamAvatars.js.map +1 -0
- package/lib/module/ui/components/icons.js +49 -0
- package/lib/module/ui/components/icons.js.map +1 -1
- package/lib/module/ui/screens/chat/ChatView.js +306 -27
- package/lib/module/ui/screens/chat/ChatView.js.map +1 -1
- package/lib/module/ui/screens/chat/ChatView.styles.js +70 -0
- package/lib/module/ui/screens/chat/ChatView.styles.js.map +1 -1
- package/lib/typescript/commonjs/api/client.d.ts +8 -2
- package/lib/typescript/commonjs/api/client.d.ts.map +1 -1
- package/lib/typescript/commonjs/api/realtime.d.ts.map +1 -1
- package/lib/typescript/commonjs/attachments/pickers.d.ts +81 -0
- package/lib/typescript/commonjs/attachments/pickers.d.ts.map +1 -0
- package/lib/typescript/commonjs/i18n.d.ts +23 -0
- package/lib/typescript/commonjs/i18n.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +1 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/locales.d.ts.map +1 -1
- package/lib/typescript/commonjs/state/widget-store.d.ts +40 -2
- package/lib/typescript/commonjs/state/widget-store.d.ts.map +1 -1
- package/lib/typescript/commonjs/types.d.ts +88 -1
- package/lib/typescript/commonjs/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/WidgetProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/AttachmentChips.d.ts +16 -0
- package/lib/typescript/commonjs/ui/components/AttachmentChips.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/AttachmentMenu.d.ts +28 -0
- package/lib/typescript/commonjs/ui/components/AttachmentMenu.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/ImageViewer.d.ts +23 -0
- package/lib/typescript/commonjs/ui/components/ImageViewer.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/InAppNotification.d.ts +28 -0
- package/lib/typescript/commonjs/ui/components/InAppNotification.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/TeamAvatars.d.ts +17 -0
- package/lib/typescript/commonjs/ui/components/TeamAvatars.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/icons.d.ts +2 -0
- package/lib/typescript/commonjs/ui/components/icons.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.d.ts +3 -2
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.styles.d.ts +69 -0
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.styles.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts +41 -2
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts.map +1 -1
- package/lib/typescript/module/api/client.d.ts +8 -2
- package/lib/typescript/module/api/client.d.ts.map +1 -1
- package/lib/typescript/module/api/realtime.d.ts.map +1 -1
- package/lib/typescript/module/attachments/pickers.d.ts +81 -0
- package/lib/typescript/module/attachments/pickers.d.ts.map +1 -0
- package/lib/typescript/module/i18n.d.ts +23 -0
- package/lib/typescript/module/i18n.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +1 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/locales.d.ts.map +1 -1
- package/lib/typescript/module/state/widget-store.d.ts +40 -2
- package/lib/typescript/module/state/widget-store.d.ts.map +1 -1
- package/lib/typescript/module/types.d.ts +88 -1
- package/lib/typescript/module/types.d.ts.map +1 -1
- package/lib/typescript/module/ui/WidgetProvider.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/AttachmentChips.d.ts +16 -0
- package/lib/typescript/module/ui/components/AttachmentChips.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/AttachmentMenu.d.ts +28 -0
- package/lib/typescript/module/ui/components/AttachmentMenu.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/ImageViewer.d.ts +23 -0
- package/lib/typescript/module/ui/components/ImageViewer.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/InAppNotification.d.ts +28 -0
- package/lib/typescript/module/ui/components/InAppNotification.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/TeamAvatars.d.ts +17 -0
- package/lib/typescript/module/ui/components/TeamAvatars.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/icons.d.ts +2 -0
- package/lib/typescript/module/ui/components/icons.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/chat/ChatView.d.ts +3 -2
- package/lib/typescript/module/ui/screens/chat/ChatView.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/chat/ChatView.styles.d.ts +69 -0
- package/lib/typescript/module/ui/screens/chat/ChatView.styles.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts +41 -2
- package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts.map +1 -1
- package/metro.js +17 -32
- package/package.json +18 -1
- package/src/api/client.ts +5 -3
- package/src/api/realtime.ts +2 -0
- package/src/attachments/pickers.ts +515 -0
- package/src/i18n.ts +48 -0
- package/src/index.tsx +4 -0
- package/src/locales.ts +21 -0
- package/src/state/widget-store.ts +256 -19
- package/src/types.ts +95 -0
- package/src/ui/WidgetProvider.tsx +90 -9
- package/src/ui/components/AttachmentChips.tsx +135 -0
- package/src/ui/components/AttachmentMenu.tsx +132 -0
- package/src/ui/components/ImageViewer.tsx +178 -0
- package/src/ui/components/InAppNotification.tsx +225 -0
- package/src/ui/components/TeamAvatars.tsx +58 -0
- package/src/ui/components/icons.tsx +37 -0
- package/src/ui/screens/chat/ChatView.styles.ts +70 -0
- package/src/ui/screens/chat/ChatView.tsx +345 -35
- package/src/ui/screens/chat/ChatView.types.ts +51 -2
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AttachmentChips = AttachmentChips;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _pickers = require("../../attachments/pickers.js");
|
|
9
|
+
var _i18n = require("../../i18n.js");
|
|
10
|
+
var _theme = require("../styles/theme.js");
|
|
11
|
+
var _rtl = require("../utils/rtl.js");
|
|
12
|
+
var _icons = require("./icons.js");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
/**
|
|
15
|
+
* Picked-but-unsent attachments above the composer: a thumbnail for images, a
|
|
16
|
+
* name + size card for everything else, each with its own remove button.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
function AttachmentChips({
|
|
20
|
+
attachments,
|
|
21
|
+
disabled,
|
|
22
|
+
removeLabel,
|
|
23
|
+
onRemove
|
|
24
|
+
}) {
|
|
25
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
|
26
|
+
horizontal: true,
|
|
27
|
+
showsHorizontalScrollIndicator: false,
|
|
28
|
+
keyboardShouldPersistTaps: "handled",
|
|
29
|
+
style: styles.scroller,
|
|
30
|
+
contentContainerStyle: styles.row,
|
|
31
|
+
children: attachments.map(attachment => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
32
|
+
style: [styles.chip, disabled && styles.chipDisabled],
|
|
33
|
+
children: [(0, _pickers.isImageAttachment)(attachment.contentType) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
|
34
|
+
source: {
|
|
35
|
+
uri: attachment.previewUri
|
|
36
|
+
},
|
|
37
|
+
style: styles.thumbnail,
|
|
38
|
+
resizeMode: "cover",
|
|
39
|
+
accessible: true,
|
|
40
|
+
accessibilityLabel: attachment.name,
|
|
41
|
+
accessibilityIgnoresInvertColors: true
|
|
42
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
43
|
+
style: styles.file,
|
|
44
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
45
|
+
style: styles.fileName,
|
|
46
|
+
numberOfLines: 1,
|
|
47
|
+
children: attachment.name
|
|
48
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
49
|
+
style: styles.fileSize,
|
|
50
|
+
children: (0, _pickers.formatBytes)(attachment.size)
|
|
51
|
+
})]
|
|
52
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
53
|
+
onPress: () => onRemove(attachment.id),
|
|
54
|
+
disabled: disabled,
|
|
55
|
+
accessibilityRole: "button",
|
|
56
|
+
accessibilityLabel: (0, _i18n.formatLabel)(removeLabel, {
|
|
57
|
+
name: attachment.name
|
|
58
|
+
}),
|
|
59
|
+
accessibilityState: {
|
|
60
|
+
disabled: !!disabled
|
|
61
|
+
}
|
|
62
|
+
// 22pt badge + 11pt on every side = a 44pt target.
|
|
63
|
+
,
|
|
64
|
+
hitSlop: 11,
|
|
65
|
+
style: ({
|
|
66
|
+
pressed
|
|
67
|
+
}) => [styles.remove, pressed && styles.removePressed],
|
|
68
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.CloseIcon, {
|
|
69
|
+
size: 10,
|
|
70
|
+
color: _theme.palette.white
|
|
71
|
+
})
|
|
72
|
+
})]
|
|
73
|
+
}, attachment.id))
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
const CHIP_HEIGHT = 64;
|
|
77
|
+
const styles = _reactNative.StyleSheet.create({
|
|
78
|
+
scroller: {
|
|
79
|
+
flexGrow: 0,
|
|
80
|
+
marginBottom: _theme.spacing.sm
|
|
81
|
+
},
|
|
82
|
+
row: {
|
|
83
|
+
gap: _theme.spacing.sm
|
|
84
|
+
},
|
|
85
|
+
chip: {
|
|
86
|
+
height: CHIP_HEIGHT,
|
|
87
|
+
borderRadius: _theme.radius.md,
|
|
88
|
+
overflow: 'hidden',
|
|
89
|
+
backgroundColor: _theme.palette.surfaceAlt,
|
|
90
|
+
borderWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
91
|
+
borderColor: _theme.palette.border
|
|
92
|
+
},
|
|
93
|
+
chipDisabled: {
|
|
94
|
+
opacity: 0.5
|
|
95
|
+
},
|
|
96
|
+
thumbnail: {
|
|
97
|
+
width: CHIP_HEIGHT,
|
|
98
|
+
height: CHIP_HEIGHT
|
|
99
|
+
},
|
|
100
|
+
file: {
|
|
101
|
+
width: 156,
|
|
102
|
+
height: CHIP_HEIGHT,
|
|
103
|
+
justifyContent: 'center',
|
|
104
|
+
paddingStart: _theme.spacing.md,
|
|
105
|
+
// Clear of the remove badge in the top corner.
|
|
106
|
+
paddingEnd: _theme.spacing.xl + _theme.spacing.sm
|
|
107
|
+
},
|
|
108
|
+
fileName: {
|
|
109
|
+
textAlign: _rtl.START_ALIGN,
|
|
110
|
+
fontSize: _theme.fontSize.meta,
|
|
111
|
+
fontWeight: '600',
|
|
112
|
+
color: _theme.palette.ink
|
|
113
|
+
},
|
|
114
|
+
fileSize: {
|
|
115
|
+
textAlign: _rtl.START_ALIGN,
|
|
116
|
+
fontSize: _theme.fontSize.caption,
|
|
117
|
+
color: _theme.palette.textMuted,
|
|
118
|
+
marginTop: 2
|
|
119
|
+
},
|
|
120
|
+
remove: {
|
|
121
|
+
position: 'absolute',
|
|
122
|
+
top: _theme.spacing.xs,
|
|
123
|
+
end: _theme.spacing.xs,
|
|
124
|
+
width: 22,
|
|
125
|
+
height: 22,
|
|
126
|
+
borderRadius: 11,
|
|
127
|
+
alignItems: 'center',
|
|
128
|
+
justifyContent: 'center',
|
|
129
|
+
backgroundColor: (0, _theme.withAlpha)(_theme.palette.ink, 0.72)
|
|
130
|
+
},
|
|
131
|
+
removePressed: {
|
|
132
|
+
opacity: 0.7
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
//# sourceMappingURL=AttachmentChips.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_pickers","_i18n","_theme","_rtl","_icons","_jsxRuntime","AttachmentChips","attachments","disabled","removeLabel","onRemove","jsx","ScrollView","horizontal","showsHorizontalScrollIndicator","keyboardShouldPersistTaps","style","styles","scroller","contentContainerStyle","row","children","map","attachment","jsxs","View","chip","chipDisabled","isImageAttachment","contentType","Image","source","uri","previewUri","thumbnail","resizeMode","accessible","accessibilityLabel","name","accessibilityIgnoresInvertColors","file","Text","fileName","numberOfLines","fileSize","formatBytes","size","Pressable","onPress","id","accessibilityRole","formatLabel","accessibilityState","hitSlop","pressed","remove","removePressed","CloseIcon","color","palette","white","CHIP_HEIGHT","StyleSheet","create","flexGrow","marginBottom","spacing","sm","gap","height","borderRadius","radius","md","overflow","backgroundColor","surfaceAlt","borderWidth","hairlineWidth","borderColor","border","opacity","width","justifyContent","paddingStart","paddingEnd","xl","textAlign","START_ALIGN","fontSize","meta","fontWeight","ink","caption","textMuted","marginTop","position","top","xs","end","alignItems","withAlpha"],"sourceRoot":"../../../../src","sources":["ui/components/AttachmentChips.tsx"],"mappings":";;;;;;AAKA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAAoC,IAAAM,WAAA,GAAAN,OAAA;AAfpC;AACA;AACA;AACA;;AAuBO,SAASO,eAAeA,CAAC;EAC9BC,WAAW;EACXC,QAAQ;EACRC,WAAW;EACXC;AACoB,CAAC,EAAE;EACvB,oBACE,IAAAL,WAAA,CAAAM,GAAA,EAACb,YAAA,CAAAc,UAAU;IACTC,UAAU;IACVC,8BAA8B,EAAE,KAAM;IACtCC,yBAAyB,EAAC,SAAS;IACnCC,KAAK,EAAEC,MAAM,CAACC,QAAS;IACvBC,qBAAqB,EAAEF,MAAM,CAACG,GAAI;IAAAC,QAAA,EACjCd,WAAW,CAACe,GAAG,CAAEC,UAAU,iBAC1B,IAAAlB,WAAA,CAAAmB,IAAA,EAAC1B,YAAA,CAAA2B,IAAI;MAAqBT,KAAK,EAAE,CAACC,MAAM,CAACS,IAAI,EAAElB,QAAQ,IAAIS,MAAM,CAACU,YAAY,CAAE;MAAAN,QAAA,GAC7E,IAAAO,0BAAiB,EAACL,UAAU,CAACM,WAAW,CAAC,gBACxC,IAAAxB,WAAA,CAAAM,GAAA,EAACb,YAAA,CAAAgC,KAAK;QACJC,MAAM,EAAE;UAAEC,GAAG,EAAET,UAAU,CAACU;QAAW,CAAE;QACvCjB,KAAK,EAAEC,MAAM,CAACiB,SAAU;QACxBC,UAAU,EAAC,OAAO;QAClBC,UAAU;QACVC,kBAAkB,EAAEd,UAAU,CAACe,IAAK;QACpCC,gCAAgC;MAAA,CACjC,CAAC,gBAEF,IAAAlC,WAAA,CAAAmB,IAAA,EAAC1B,YAA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AC+B,EAAE;IACfhB,KAAK,EAAE,EAAE;IACTZ,MAAM,EAAE,EAAE;IACVC,YAAY,EAAE,EAAE;IAChB6B,UAAU,EAAE,QAAQ;IACpBjB,cAAc,EAAE,QAAQ;IACxBR,eAAe,EAAE,IAAA0B,gBAAS,EAACzC,cAAO,CAACgC,GAAG,EAAE,IAAI;EAC9C,CAAC;EACDnC,aAAa,EAAE;IACbwB,OAAO,EAAE;EACX;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AttachmentMenu = AttachmentMenu;
|
|
7
|
+
exports.showNativeAttachmentMenu = showNativeAttachmentMenu;
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _useWidgetInsets = require("../hooks/use-widget-insets.js");
|
|
10
|
+
var _theme = require("../styles/theme.js");
|
|
11
|
+
var _rtl = require("../utils/rtl.js");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
/**
|
|
14
|
+
* The attach button's choice of source.
|
|
15
|
+
*
|
|
16
|
+
* iOS gets the native action sheet. Android has no equivalent (`Alert` caps at
|
|
17
|
+
* three buttons, and three sources plus Cancel is four), so it gets a small
|
|
18
|
+
* bottom sheet in its own transparent modal — which also lets the hardware
|
|
19
|
+
* back button close the sheet rather than the whole widget.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* iOS only: shows the native sheet and calls `onSelect` with the chosen key
|
|
24
|
+
* (nothing on cancel). Returns false elsewhere, so the caller shows
|
|
25
|
+
* `AttachmentMenu` instead.
|
|
26
|
+
*/
|
|
27
|
+
function showNativeAttachmentMenu(options, cancelLabel, onSelect) {
|
|
28
|
+
if (_reactNative.Platform.OS !== 'ios') return false;
|
|
29
|
+
_reactNative.ActionSheetIOS.showActionSheetWithOptions({
|
|
30
|
+
options: [...options.map(option => option.label), cancelLabel],
|
|
31
|
+
cancelButtonIndex: options.length
|
|
32
|
+
}, index => {
|
|
33
|
+
const chosen = options[index];
|
|
34
|
+
if (chosen) onSelect(chosen.key);
|
|
35
|
+
});
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
function AttachmentMenu({
|
|
39
|
+
visible,
|
|
40
|
+
options,
|
|
41
|
+
cancelLabel,
|
|
42
|
+
onSelect,
|
|
43
|
+
onClose
|
|
44
|
+
}) {
|
|
45
|
+
const insets = (0, _useWidgetInsets.useWidgetInsets)();
|
|
46
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Modal, {
|
|
47
|
+
visible: visible,
|
|
48
|
+
transparent: true,
|
|
49
|
+
animationType: "fade",
|
|
50
|
+
statusBarTranslucent: true,
|
|
51
|
+
onRequestClose: onClose,
|
|
52
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
53
|
+
style: styles.backdrop,
|
|
54
|
+
onPress: onClose,
|
|
55
|
+
accessibilityRole: "button",
|
|
56
|
+
accessibilityLabel: cancelLabel
|
|
57
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
58
|
+
style: [styles.sheet, {
|
|
59
|
+
paddingBottom: insets.bottom + _theme.spacing.sm
|
|
60
|
+
}],
|
|
61
|
+
accessibilityViewIsModal: true,
|
|
62
|
+
children: [options.map(option => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
63
|
+
onPress: () => onSelect(option.key),
|
|
64
|
+
accessibilityRole: "button",
|
|
65
|
+
style: ({
|
|
66
|
+
pressed
|
|
67
|
+
}) => [styles.row, pressed && styles.rowPressed],
|
|
68
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
69
|
+
style: styles.rowLabel,
|
|
70
|
+
children: option.label
|
|
71
|
+
})
|
|
72
|
+
}, option.key)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
73
|
+
style: styles.divider
|
|
74
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
75
|
+
onPress: onClose,
|
|
76
|
+
accessibilityRole: "button",
|
|
77
|
+
style: ({
|
|
78
|
+
pressed
|
|
79
|
+
}) => [styles.row, pressed && styles.rowPressed],
|
|
80
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
81
|
+
style: [styles.rowLabel, styles.cancelLabel],
|
|
82
|
+
children: cancelLabel
|
|
83
|
+
})
|
|
84
|
+
})]
|
|
85
|
+
})]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const styles = _reactNative.StyleSheet.create({
|
|
89
|
+
backdrop: {
|
|
90
|
+
..._reactNative.StyleSheet.absoluteFillObject,
|
|
91
|
+
backgroundColor: 'rgba(0, 0, 0, 0.32)'
|
|
92
|
+
},
|
|
93
|
+
sheet: {
|
|
94
|
+
position: 'absolute',
|
|
95
|
+
start: 0,
|
|
96
|
+
end: 0,
|
|
97
|
+
bottom: 0,
|
|
98
|
+
backgroundColor: _theme.palette.white,
|
|
99
|
+
borderTopLeftRadius: _theme.radius.xl + 4,
|
|
100
|
+
borderTopRightRadius: _theme.radius.xl + 4,
|
|
101
|
+
paddingTop: _theme.spacing.sm
|
|
102
|
+
},
|
|
103
|
+
row: {
|
|
104
|
+
minHeight: 52,
|
|
105
|
+
justifyContent: 'center',
|
|
106
|
+
paddingHorizontal: _theme.spacing.xl
|
|
107
|
+
},
|
|
108
|
+
rowPressed: {
|
|
109
|
+
backgroundColor: _theme.palette.surfaceAlt
|
|
110
|
+
},
|
|
111
|
+
rowLabel: {
|
|
112
|
+
textAlign: _rtl.START_ALIGN,
|
|
113
|
+
fontSize: _theme.fontSize.body,
|
|
114
|
+
color: _theme.palette.ink
|
|
115
|
+
},
|
|
116
|
+
cancelLabel: {
|
|
117
|
+
color: _theme.palette.textMuted
|
|
118
|
+
},
|
|
119
|
+
divider: {
|
|
120
|
+
height: _reactNative.StyleSheet.hairlineWidth,
|
|
121
|
+
backgroundColor: _theme.palette.border,
|
|
122
|
+
marginVertical: _theme.spacing.xs
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
//# sourceMappingURL=AttachmentMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_useWidgetInsets","_theme","_rtl","_jsxRuntime","showNativeAttachmentMenu","options","cancelLabel","onSelect","Platform","OS","ActionSheetIOS","showActionSheetWithOptions","map","option","label","cancelButtonIndex","length","index","chosen","key","AttachmentMenu","visible","onClose","insets","useWidgetInsets","jsxs","Modal","transparent","animationType","statusBarTranslucent","onRequestClose","children","jsx","Pressable","style","styles","backdrop","onPress","accessibilityRole","accessibilityLabel","View","sheet","paddingBottom","bottom","spacing","sm","accessibilityViewIsModal","pressed","row","rowPressed","Text","rowLabel","divider","StyleSheet","create","absoluteFillObject","backgroundColor","position","start","end","palette","white","borderTopLeftRadius","radius","xl","borderTopRightRadius","paddingTop","minHeight","justifyContent","paddingHorizontal","surfaceAlt","textAlign","START_ALIGN","fontSize","body","color","ink","textMuted","height","hairlineWidth","border","marginVertical","xs"],"sourceRoot":"../../../../src","sources":["ui/components/AttachmentMenu.tsx"],"mappings":";;;;;;;AASA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AAA2C,IAAAI,WAAA,GAAAJ,OAAA;AAb3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACO,SAASK,wBAAwBA,CACtCC,OAAkC,EAClCC,WAAmB,EACnBC,QAA0B,EACjB;EACT,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE,OAAO,KAAK;EACvCC,2BAAc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AAE,CAAC;IACRC,GAAG,EAAE,CAAC;IACNhB,MAAM,EAAE,CAAC;IACTa,eAAe,EAAEI,cAAO,CAACC,KAAK;IAC9BC,mBAAmB,EAAEC,aAAM,CAACC,EAAE,GAAG,CAAC;IAClCC,oBAAoB,EAAEF,aAAM,CAACC,EAAE,GAAG,CAAC;IACnCE,UAAU,EAAEtB,cAAO,CAACC;EACtB,CAAC;EACDG,GAAG,EAAE;IACHmB,SAAS,EAAE,EAAE;IACbC,cAAc,EAAE,QAAQ;IACxBC,iBAAiB,EAAEzB,cAAO,CAACoB;EAC7B,CAAC;EACDf,UAAU,EAAE;IACVO,eAAe,EAAEI,cAAO,CAACU;EAC3B,CAAC;EACDnB,QAAQ,EAAE;IACRoB,SAAS,EAAEC,gBAAW;IACtBC,QAAQ,EAAEA,eAAQ,CAACC,IAAI;IACvBC,KAAK,EAAEf,cAAO,CAACgB;EACjB,CAAC;EACDtE,WAAW,EAAE;IACXqE,KAAK,EAAEf,cAAO,CAACiB;EACjB,CAAC;EACDzB,OAAO,EAAE;IACP0B,MAAM,EAAEzB,uBAAU,CAAC0B,aAAa;IAChCvB,eAAe,EAAEI,cAAO,CAACoB,MAAM;IAC/BC,cAAc,EAAErC,cAAO,CAACsC;EAC1B;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ImageViewer = ImageViewer;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _useWidgetInsets = require("../hooks/use-widget-insets.js");
|
|
10
|
+
var _theme = require("../styles/theme.js");
|
|
11
|
+
var _icons = require("./icons.js");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
/**
|
|
14
|
+
* Full-screen viewer for image attachments, so a tap on a photo the agent sent
|
|
15
|
+
* stays inside the messenger instead of bouncing to the browser. Pinch-to-zoom
|
|
16
|
+
* uses the native ScrollView zoom (iOS); Android shows the image fitted.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
function ImageViewer({
|
|
20
|
+
image,
|
|
21
|
+
labels,
|
|
22
|
+
onClose,
|
|
23
|
+
onOpenExternally
|
|
24
|
+
}) {
|
|
25
|
+
const insets = (0, _useWidgetInsets.useWidgetInsets)();
|
|
26
|
+
// Keyed by URL so opening another image starts from a clean loading state.
|
|
27
|
+
const [status, setStatus] = (0, _react.useState)({
|
|
28
|
+
url: null,
|
|
29
|
+
state: 'loading'
|
|
30
|
+
});
|
|
31
|
+
const state = status.url === image?.url ? status.state : 'loading';
|
|
32
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Modal, {
|
|
33
|
+
visible: !!image,
|
|
34
|
+
transparent: true,
|
|
35
|
+
animationType: "fade",
|
|
36
|
+
statusBarTranslucent: true,
|
|
37
|
+
onRequestClose: onClose,
|
|
38
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
39
|
+
style: styles.backdrop,
|
|
40
|
+
accessibilityViewIsModal: true,
|
|
41
|
+
children: [image ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
|
42
|
+
style: styles.fill,
|
|
43
|
+
contentContainerStyle: styles.center,
|
|
44
|
+
maximumZoomScale: 4,
|
|
45
|
+
minimumZoomScale: 1,
|
|
46
|
+
centerContent: true,
|
|
47
|
+
showsHorizontalScrollIndicator: false,
|
|
48
|
+
showsVerticalScrollIndicator: false,
|
|
49
|
+
bouncesZoom: true,
|
|
50
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
|
51
|
+
source: {
|
|
52
|
+
uri: image.url
|
|
53
|
+
},
|
|
54
|
+
style: styles.image,
|
|
55
|
+
resizeMode: "contain",
|
|
56
|
+
accessibilityLabel: image.name,
|
|
57
|
+
accessibilityIgnoresInvertColors: true,
|
|
58
|
+
onLoad: () => setStatus({
|
|
59
|
+
url: image.url,
|
|
60
|
+
state: 'ready'
|
|
61
|
+
}),
|
|
62
|
+
onError: () => setStatus({
|
|
63
|
+
url: image.url,
|
|
64
|
+
state: 'failed'
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
}) : null, image && state === 'loading' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
68
|
+
style: _reactNative.StyleSheet.absoluteFill,
|
|
69
|
+
color: _theme.palette.white
|
|
70
|
+
}) : null, image && state === 'failed' ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
71
|
+
style: [_reactNative.StyleSheet.absoluteFill, styles.center, styles.failed],
|
|
72
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
73
|
+
style: styles.failedText,
|
|
74
|
+
children: labels.loadFailed
|
|
75
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
76
|
+
onPress: () => onOpenExternally(image.url),
|
|
77
|
+
accessibilityRole: "button",
|
|
78
|
+
style: ({
|
|
79
|
+
pressed
|
|
80
|
+
}) => [styles.externalButton, pressed && styles.pressed],
|
|
81
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
82
|
+
style: styles.externalLabel,
|
|
83
|
+
children: labels.openExternally
|
|
84
|
+
})
|
|
85
|
+
})]
|
|
86
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
87
|
+
style: [styles.header, {
|
|
88
|
+
paddingTop: insets.top + _theme.spacing.sm
|
|
89
|
+
}],
|
|
90
|
+
pointerEvents: "box-none",
|
|
91
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
92
|
+
style: styles.title,
|
|
93
|
+
numberOfLines: 1,
|
|
94
|
+
children: image?.name ?? ''
|
|
95
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
96
|
+
onPress: onClose,
|
|
97
|
+
accessibilityRole: "button",
|
|
98
|
+
accessibilityLabel: labels.close,
|
|
99
|
+
hitSlop: 12,
|
|
100
|
+
style: ({
|
|
101
|
+
pressed
|
|
102
|
+
}) => [styles.closeButton, pressed && styles.pressed],
|
|
103
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.CloseIcon, {
|
|
104
|
+
size: 20,
|
|
105
|
+
color: _theme.palette.white
|
|
106
|
+
})
|
|
107
|
+
})]
|
|
108
|
+
})]
|
|
109
|
+
})
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
const styles = _reactNative.StyleSheet.create({
|
|
113
|
+
backdrop: {
|
|
114
|
+
flex: 1,
|
|
115
|
+
backgroundColor: '#000000'
|
|
116
|
+
},
|
|
117
|
+
fill: {
|
|
118
|
+
flex: 1
|
|
119
|
+
},
|
|
120
|
+
center: {
|
|
121
|
+
flexGrow: 1,
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
justifyContent: 'center'
|
|
124
|
+
},
|
|
125
|
+
image: {
|
|
126
|
+
width: '100%',
|
|
127
|
+
height: '100%'
|
|
128
|
+
},
|
|
129
|
+
header: {
|
|
130
|
+
position: 'absolute',
|
|
131
|
+
top: 0,
|
|
132
|
+
left: 0,
|
|
133
|
+
right: 0,
|
|
134
|
+
flexDirection: 'row',
|
|
135
|
+
alignItems: 'center',
|
|
136
|
+
gap: _theme.spacing.md,
|
|
137
|
+
paddingHorizontal: _theme.spacing.lg,
|
|
138
|
+
paddingBottom: _theme.spacing.sm,
|
|
139
|
+
backgroundColor: 'rgba(0,0,0,0.45)'
|
|
140
|
+
},
|
|
141
|
+
title: {
|
|
142
|
+
flex: 1,
|
|
143
|
+
minWidth: 0,
|
|
144
|
+
color: _theme.palette.white,
|
|
145
|
+
fontSize: _theme.fontSize.body,
|
|
146
|
+
fontWeight: '600'
|
|
147
|
+
},
|
|
148
|
+
closeButton: {
|
|
149
|
+
width: 36,
|
|
150
|
+
height: 36,
|
|
151
|
+
borderRadius: 18,
|
|
152
|
+
alignItems: 'center',
|
|
153
|
+
justifyContent: 'center',
|
|
154
|
+
backgroundColor: 'rgba(255,255,255,0.14)'
|
|
155
|
+
},
|
|
156
|
+
pressed: {
|
|
157
|
+
opacity: 0.7
|
|
158
|
+
},
|
|
159
|
+
failed: {
|
|
160
|
+
gap: _theme.spacing.md,
|
|
161
|
+
paddingHorizontal: _theme.spacing.xxl
|
|
162
|
+
},
|
|
163
|
+
failedText: {
|
|
164
|
+
color: _theme.palette.white,
|
|
165
|
+
fontSize: _theme.fontSize.body,
|
|
166
|
+
textAlign: 'center'
|
|
167
|
+
},
|
|
168
|
+
externalButton: {
|
|
169
|
+
paddingHorizontal: _theme.spacing.lg,
|
|
170
|
+
paddingVertical: _theme.spacing.sm,
|
|
171
|
+
borderRadius: 999,
|
|
172
|
+
borderWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
173
|
+
borderColor: 'rgba(255,255,255,0.5)'
|
|
174
|
+
},
|
|
175
|
+
externalLabel: {
|
|
176
|
+
color: _theme.palette.white,
|
|
177
|
+
fontSize: _theme.fontSize.meta,
|
|
178
|
+
fontWeight: _reactNative.Platform.OS === 'ios' ? '600' : 'bold'
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
//# sourceMappingURL=ImageViewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_useWidgetInsets","_theme","_icons","_jsxRuntime","ImageViewer","image","labels","onClose","onOpenExternally","insets","useWidgetInsets","status","setStatus","useState","url","state","jsx","Modal","visible","transparent","animationType","statusBarTranslucent","onRequestClose","children","jsxs","View","style","styles","backdrop","accessibilityViewIsModal","ScrollView","fill","contentContainerStyle","center","maximumZoomScale","minimumZoomScale","centerContent","showsHorizontalScrollIndicator","showsVerticalScrollIndicator","bouncesZoom","Image","source","uri","resizeMode","accessibilityLabel","name","accessibilityIgnoresInvertColors","onLoad","onError","ActivityIndicator","StyleSheet","absoluteFill","color","palette","white","failed","Text","failedText","loadFailed","Pressable","onPress","accessibilityRole","pressed","externalButton","externalLabel","openExternally","header","paddingTop","top","spacing","sm","pointerEvents","title","numberOfLines","close","hitSlop","closeButton","CloseIcon","size","create","flex","backgroundColor","flexGrow","alignItems","justifyContent","width","height","position","left","right","flexDirection","gap","md","paddingHorizontal","lg","paddingBottom","minWidth","fontSize","body","fontWeight","borderRadius","opacity","xxl","textAlign","paddingVertical","borderWidth","hairlineWidth","borderColor","meta","Platform","OS"],"sourceRoot":"../../../../src","sources":["ui/components/ImageViewer.tsx"],"mappings":";;;;;;AAMA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAYA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAAoC,IAAAK,WAAA,GAAAL,OAAA;AArBpC;AACA;AACA;AACA;AACA;;AAiCO,SAASM,WAAWA,CAAC;EAAEC,KAAK;EAAEC,MAAM;EAAEC,OAAO;EAAEC;AAAmC,CAAC,EAAE;EAC1F,MAAMC,MAAM,GAAG,IAAAC,gCAAe,EAAC,CAAC;EAChC;EACA,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAG,IAAAC,eAAQ,EAClC;IAAEC,GAAG,EAAE,IAAI;IAAEC,KAAK,EAAE;EAAU,CAChC,CAAC;EACD,MAAMA,KAAK,GAAGJ,MAAM,CAACG,GAAG,KAAKT,KAAK,EAAES,GAAG,GAAGH,MAAM,CAACI,KAAK,GAAG,SAAS;EAElE,oBACE,IAAAZ,WAAA,CAAAa,GAAA,EAACjB,YAAA,CAAAkB,KAAK;IACJC,OAAO,EAAE,CAAC,CAACb,KAAM;IACjBc,WAAW;IACXC,aAAa,EAAC,MAAM;IACpBC,oBAAoB;IAC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