@unif/react-native-chat 0.2.1 → 0.2.2
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/lib/commonjs/bubble/Bubble.js +74 -72
- package/lib/commonjs/bubble/Bubble.js.map +1 -1
- package/lib/commonjs/card-wrapper/CardWrapper.js +25 -24
- package/lib/commonjs/card-wrapper/CardWrapper.js.map +1 -1
- package/lib/commonjs/conversations/Conversations.js +135 -84
- package/lib/commonjs/conversations/Conversations.js.map +1 -1
- package/lib/commonjs/index.js +0 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/prompts/Prompts.js +38 -37
- package/lib/commonjs/prompts/Prompts.js.map +1 -1
- package/lib/commonjs/sender/Sender.js +120 -122
- package/lib/commonjs/sender/Sender.js.map +1 -1
- package/lib/commonjs/theme/tokens.js +2 -56
- package/lib/commonjs/theme/tokens.js.map +1 -1
- package/lib/commonjs/welcome/Welcome.js +89 -90
- package/lib/commonjs/welcome/Welcome.js.map +1 -1
- package/lib/module/bubble/Bubble.js +73 -71
- package/lib/module/bubble/Bubble.js.map +1 -1
- package/lib/module/card-wrapper/CardWrapper.js +24 -23
- package/lib/module/card-wrapper/CardWrapper.js.map +1 -1
- package/lib/module/conversations/Conversations.js +137 -86
- package/lib/module/conversations/Conversations.js.map +1 -1
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/prompts/Prompts.js +37 -36
- package/lib/module/prompts/Prompts.js.map +1 -1
- package/lib/module/sender/Sender.js +121 -123
- package/lib/module/sender/Sender.js.map +1 -1
- package/lib/module/theme/tokens.js +2 -55
- package/lib/module/theme/tokens.js.map +1 -1
- package/lib/module/welcome/Welcome.js +88 -89
- package/lib/module/welcome/Welcome.js.map +1 -1
- package/lib/typescript/commonjs/bubble/Bubble.d.ts.map +1 -1
- package/lib/typescript/commonjs/card-wrapper/CardWrapper.d.ts.map +1 -1
- package/lib/typescript/commonjs/conversations/Conversations.d.ts +4 -2
- package/lib/typescript/commonjs/conversations/Conversations.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +2 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/prompts/Prompts.d.ts.map +1 -1
- package/lib/typescript/commonjs/sender/Sender.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/tokens.d.ts +1 -45
- package/lib/typescript/commonjs/theme/tokens.d.ts.map +1 -1
- package/lib/typescript/commonjs/welcome/Welcome.d.ts.map +1 -1
- package/lib/typescript/module/bubble/Bubble.d.ts.map +1 -1
- package/lib/typescript/module/card-wrapper/CardWrapper.d.ts.map +1 -1
- package/lib/typescript/module/conversations/Conversations.d.ts +4 -2
- package/lib/typescript/module/conversations/Conversations.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +2 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/prompts/Prompts.d.ts.map +1 -1
- package/lib/typescript/module/sender/Sender.d.ts.map +1 -1
- package/lib/typescript/module/theme/tokens.d.ts +1 -45
- package/lib/typescript/module/theme/tokens.d.ts.map +1 -1
- package/lib/typescript/module/welcome/Welcome.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/bubble/Bubble.tsx +85 -80
- package/src/card-wrapper/CardWrapper.tsx +31 -29
- package/src/conversations/Conversations.tsx +170 -100
- package/src/index.tsx +4 -1
- package/src/prompts/Prompts.tsx +51 -41
- package/src/sender/Sender.tsx +125 -138
- package/src/theme/tokens.ts +1 -56
- package/src/welcome/Welcome.tsx +109 -108
|
@@ -4,11 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeUi = require("@unif/react-native-ui");
|
|
9
10
|
var _tokens = require("../theme/tokens");
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
13
|
/**
|
|
13
14
|
* Bubble — 消息气泡容器
|
|
14
15
|
*
|
|
@@ -27,18 +28,78 @@ const Bubble = ({
|
|
|
27
28
|
styles: semanticStyles,
|
|
28
29
|
testID
|
|
29
30
|
}) => {
|
|
31
|
+
const t = (0, _reactNativeUi.useTokens)();
|
|
32
|
+
const styles = (0, _react.useMemo)(() => _reactNative.StyleSheet.create({
|
|
33
|
+
// Assistant
|
|
34
|
+
assistantRow: {
|
|
35
|
+
paddingHorizontal: t.spaceMd,
|
|
36
|
+
paddingVertical: t.spaceSm,
|
|
37
|
+
marginBottom: 12
|
|
38
|
+
},
|
|
39
|
+
headerRow: {
|
|
40
|
+
flexDirection: 'row',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
marginBottom: 6
|
|
43
|
+
},
|
|
44
|
+
avatarContainer: {
|
|
45
|
+
marginRight: 8
|
|
46
|
+
},
|
|
47
|
+
assistantName: {
|
|
48
|
+
fontSize: 13,
|
|
49
|
+
fontWeight: '500',
|
|
50
|
+
color: t.colorTextSecondary
|
|
51
|
+
},
|
|
52
|
+
contentArea: {
|
|
53
|
+
paddingLeft: 36
|
|
54
|
+
},
|
|
55
|
+
separator: {
|
|
56
|
+
marginTop: 12,
|
|
57
|
+
marginLeft: 36,
|
|
58
|
+
height: _reactNative.StyleSheet.hairlineWidth,
|
|
59
|
+
backgroundColor: t.colorBorder,
|
|
60
|
+
opacity: 0.5
|
|
61
|
+
},
|
|
62
|
+
footer: {
|
|
63
|
+
paddingLeft: 36,
|
|
64
|
+
marginTop: 4
|
|
65
|
+
},
|
|
66
|
+
// User
|
|
67
|
+
userRow: {
|
|
68
|
+
flexDirection: 'row',
|
|
69
|
+
justifyContent: 'flex-end',
|
|
70
|
+
flexWrap: 'wrap',
|
|
71
|
+
paddingHorizontal: t.spaceMd,
|
|
72
|
+
paddingVertical: t.spaceSm,
|
|
73
|
+
marginBottom: t.spaceSm
|
|
74
|
+
},
|
|
75
|
+
userBubble: {
|
|
76
|
+
backgroundColor: _tokens.chatTokens.colorBgUserMsg,
|
|
77
|
+
borderTopLeftRadius: 20,
|
|
78
|
+
borderTopRightRadius: 20,
|
|
79
|
+
borderBottomLeftRadius: 20,
|
|
80
|
+
borderBottomRightRadius: 6,
|
|
81
|
+
paddingHorizontal: t.spaceMd,
|
|
82
|
+
paddingVertical: t.space,
|
|
83
|
+
maxWidth: '75%'
|
|
84
|
+
},
|
|
85
|
+
userText: {
|
|
86
|
+
fontSize: t.fontSize,
|
|
87
|
+
color: t.colorText,
|
|
88
|
+
lineHeight: t.lineHeight
|
|
89
|
+
}
|
|
90
|
+
}), [t]);
|
|
30
91
|
if (role === 'user') {
|
|
31
92
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
32
|
-
style: [
|
|
93
|
+
style: [styles.userRow, semanticStyles?.root, style],
|
|
33
94
|
testID: testID ?? 'bubble-user',
|
|
34
95
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
35
|
-
style:
|
|
96
|
+
style: styles.userBubble,
|
|
36
97
|
children: typeof children === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
37
|
-
style:
|
|
98
|
+
style: styles.userText,
|
|
38
99
|
children: children
|
|
39
100
|
}) : children
|
|
40
101
|
}), footer && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
41
|
-
style: [
|
|
102
|
+
style: [styles.footer, semanticStyles?.footer],
|
|
42
103
|
children: footer
|
|
43
104
|
})]
|
|
44
105
|
});
|
|
@@ -46,86 +107,27 @@ const Bubble = ({
|
|
|
46
107
|
|
|
47
108
|
// assistant / system
|
|
48
109
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
49
|
-
style: [
|
|
110
|
+
style: [styles.assistantRow, semanticStyles?.root, style],
|
|
50
111
|
testID: testID ?? 'bubble-assistant',
|
|
51
112
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
52
|
-
style:
|
|
113
|
+
style: styles.headerRow,
|
|
53
114
|
children: [avatar && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
54
|
-
style: [
|
|
115
|
+
style: [styles.avatarContainer, semanticStyles?.avatar],
|
|
55
116
|
children: avatar
|
|
56
117
|
}), name && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
57
|
-
style: [
|
|
118
|
+
style: [styles.assistantName, semanticStyles?.name],
|
|
58
119
|
children: name
|
|
59
120
|
})]
|
|
60
121
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
61
|
-
style: [
|
|
122
|
+
style: [styles.contentArea, semanticStyles?.content],
|
|
62
123
|
children: children
|
|
63
124
|
}), footer && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
64
|
-
style: [
|
|
125
|
+
style: [styles.footer, semanticStyles?.footer],
|
|
65
126
|
children: footer
|
|
66
127
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
67
|
-
style:
|
|
128
|
+
style: styles.separator
|
|
68
129
|
})]
|
|
69
130
|
});
|
|
70
131
|
};
|
|
71
|
-
const defaultStyles = _reactNative.StyleSheet.create({
|
|
72
|
-
// Assistant
|
|
73
|
-
assistantRow: {
|
|
74
|
-
paddingHorizontal: _tokens.chatTokens.spaceMd,
|
|
75
|
-
paddingVertical: _tokens.chatTokens.spaceSm,
|
|
76
|
-
marginBottom: 12
|
|
77
|
-
},
|
|
78
|
-
headerRow: {
|
|
79
|
-
flexDirection: 'row',
|
|
80
|
-
alignItems: 'center',
|
|
81
|
-
marginBottom: 6
|
|
82
|
-
},
|
|
83
|
-
avatarContainer: {
|
|
84
|
-
marginRight: 8
|
|
85
|
-
},
|
|
86
|
-
assistantName: {
|
|
87
|
-
fontSize: 13,
|
|
88
|
-
fontWeight: '500',
|
|
89
|
-
color: _tokens.chatTokens.colorTextSecondary
|
|
90
|
-
},
|
|
91
|
-
contentArea: {
|
|
92
|
-
paddingLeft: 36
|
|
93
|
-
},
|
|
94
|
-
separator: {
|
|
95
|
-
marginTop: 12,
|
|
96
|
-
marginLeft: 36,
|
|
97
|
-
height: _reactNative.StyleSheet.hairlineWidth,
|
|
98
|
-
backgroundColor: _tokens.chatTokens.colorBorder,
|
|
99
|
-
opacity: 0.5
|
|
100
|
-
},
|
|
101
|
-
footer: {
|
|
102
|
-
paddingLeft: 36,
|
|
103
|
-
marginTop: 4
|
|
104
|
-
},
|
|
105
|
-
// User
|
|
106
|
-
userRow: {
|
|
107
|
-
flexDirection: 'row',
|
|
108
|
-
justifyContent: 'flex-end',
|
|
109
|
-
flexWrap: 'wrap',
|
|
110
|
-
paddingHorizontal: _tokens.chatTokens.spaceMd,
|
|
111
|
-
paddingVertical: _tokens.chatTokens.spaceSm,
|
|
112
|
-
marginBottom: _tokens.chatTokens.spaceSm
|
|
113
|
-
},
|
|
114
|
-
userBubble: {
|
|
115
|
-
backgroundColor: _tokens.chatTokens.colorBgUserMsg,
|
|
116
|
-
borderTopLeftRadius: 20,
|
|
117
|
-
borderTopRightRadius: 20,
|
|
118
|
-
borderBottomLeftRadius: 20,
|
|
119
|
-
borderBottomRightRadius: 6,
|
|
120
|
-
paddingHorizontal: _tokens.chatTokens.spaceMd,
|
|
121
|
-
paddingVertical: _tokens.chatTokens.space,
|
|
122
|
-
maxWidth: '75%'
|
|
123
|
-
},
|
|
124
|
-
userText: {
|
|
125
|
-
fontSize: _tokens.chatTokens.fontSize,
|
|
126
|
-
color: _tokens.chatTokens.colorText,
|
|
127
|
-
lineHeight: _tokens.chatTokens.lineHeight
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
132
|
var _default = exports.default = /*#__PURE__*/_react.default.memo(Bubble);
|
|
131
133
|
//# sourceMappingURL=Bubble.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeUi","_tokens","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Bubble","role","avatar","name","children","footer","style","styles","semanticStyles","testID","useTokens","useMemo","StyleSheet","create","assistantRow","paddingHorizontal","spaceMd","paddingVertical","spaceSm","marginBottom","headerRow","flexDirection","alignItems","avatarContainer","marginRight","assistantName","fontSize","fontWeight","color","colorTextSecondary","contentArea","paddingLeft","separator","marginTop","marginLeft","height","hairlineWidth","backgroundColor","colorBorder","opacity","userRow","justifyContent","flexWrap","userBubble","chatTokens","colorBgUserMsg","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","space","maxWidth","userText","colorText","lineHeight","jsxs","View","root","jsx","Text","content","_default","exports","React","memo"],"sourceRoot":"../../../src","sources":["bubble/Bubble.tsx"],"mappings":";;;;;;AAQA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAA6C,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAD,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC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EAAC9E,YAAA,CAAA+E,IAAI;MAAClD,KAAK,EAAEC,MAAM,CAACa,SAAU;MAAAhB,QAAA,GAC3BF,MAAM,iBACL,IAAAtB,WAAA,CAAA8E,GAAA,EAACjF,YAAA,CAAA+E,IAAI;QAAClD,KAAK,EAAE,CAACC,MAAM,CAACgB,eAAe,EAAEf,cAAc,EAAEN,MAAM,CAAE;QAAAE,QAAA,EAC3DF;MAAM,CACH,CACP,EACAC,IAAI,iBACH,IAAAvB,WAAA,CAAA8E,GAAA,EAACjF,YAAA,CAAAkF,IAAI;QAACrD,KAAK,EAAE,CAACC,MAAM,CAACkB,aAAa,EAAEjB,cAAc,EAAEL,IAAI,CAAE;QAAAC,QAAA,EACvDD;MAAI,CACD,CACP;IAAA,CACG,CAAC,eACP,IAAAvB,WAAA,CAAA8E,GAAA,EAACjF,YAAA,CAAA+E,IAAI;MAAClD,KAAK,EAAE,CAACC,MAAM,CAACuB,WAAW,EAAEtB,cAAc,EAAEoD,OAAO,CAAE;MAAAxD,QAAA,EACxDA;IAAQ,CACL,CAAC,EACNC,MAAM,iBACL,IAAAzB,WAAA,CAAA8E,GAAA,EAACjF,YAAA,CAAA+E,IAAI;MAAClD,KAAK,EAAE,CAACC,MAAM,CAACF,MAAM,EAAEG,cAAc,EAAEH,MAAM,CAAE;MAAAD,QAAA,EAAEC;IAAM,CAAO,CACrE,eACD,IAAAzB,WAAA,CAAA8E,GAAA,EAACjF,YAAA,CAAA+E,IAAI;MAAClD,KAAK,EAAEC,MAAM,CAACyB;IAAU,CAAE,CAAC;EAAA,CAC7B,CAAC;AAEX,CAAC;AAAC,IAAA6B,QAAA,GAAAC,OAAA,CAAAvE,OAAA,gBAEawE,cAAK,CAACC,IAAI,CAAChE,MAAM,CAAC","ignoreList":[]}
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
var
|
|
9
|
+
var _reactNativeUi = require("@unif/react-native-ui");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
12
|
/**
|
|
13
13
|
* CardWrapper — 通用卡片路由容器
|
|
14
14
|
* registry 通过 props 注入(而非全局 import),更灵活
|
|
@@ -23,19 +23,38 @@ const CardWrapper = ({
|
|
|
23
23
|
style,
|
|
24
24
|
testID
|
|
25
25
|
}) => {
|
|
26
|
+
const t = (0, _reactNativeUi.useTokens)();
|
|
27
|
+
const ds = (0, _react.useMemo)(() => _reactNative.StyleSheet.create({
|
|
28
|
+
container: {
|
|
29
|
+
backgroundColor: t.colorBgElevated,
|
|
30
|
+
borderRadius: 12,
|
|
31
|
+
borderWidth: 1,
|
|
32
|
+
borderColor: t.colorBorder,
|
|
33
|
+
marginLeft: 8,
|
|
34
|
+
marginRight: 40,
|
|
35
|
+
marginBottom: 4,
|
|
36
|
+
overflow: 'hidden',
|
|
37
|
+
maxWidth: '85%'
|
|
38
|
+
},
|
|
39
|
+
fallback: {
|
|
40
|
+
padding: 12,
|
|
41
|
+
fontSize: 13,
|
|
42
|
+
color: t.colorTextSecondary
|
|
43
|
+
}
|
|
44
|
+
}), [t]);
|
|
26
45
|
const CardComponent = registry[cardType];
|
|
27
46
|
if (!CardComponent) {
|
|
28
47
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
29
|
-
style: [
|
|
48
|
+
style: [ds.container, style],
|
|
30
49
|
testID: testID,
|
|
31
50
|
children: fallback ?? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
32
|
-
style:
|
|
51
|
+
style: ds.fallback,
|
|
33
52
|
children: ["\u4E0D\u652F\u6301\u7684\u5361\u7247\u7C7B\u578B: ", cardType]
|
|
34
53
|
})
|
|
35
54
|
});
|
|
36
55
|
}
|
|
37
56
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
38
|
-
style: [
|
|
57
|
+
style: [ds.container, style],
|
|
39
58
|
testID: testID ?? `card-${cardType}`,
|
|
40
59
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(CardComponent, {
|
|
41
60
|
data: data,
|
|
@@ -43,23 +62,5 @@ const CardWrapper = ({
|
|
|
43
62
|
})
|
|
44
63
|
});
|
|
45
64
|
};
|
|
46
|
-
const defaultStyles = _reactNative.StyleSheet.create({
|
|
47
|
-
container: {
|
|
48
|
-
backgroundColor: _tokens.chatTokens.colorBgElevated,
|
|
49
|
-
borderRadius: 12,
|
|
50
|
-
borderWidth: 1,
|
|
51
|
-
borderColor: _tokens.chatTokens.colorBorder,
|
|
52
|
-
marginLeft: 8,
|
|
53
|
-
marginRight: 40,
|
|
54
|
-
marginBottom: 4,
|
|
55
|
-
overflow: 'hidden',
|
|
56
|
-
maxWidth: '85%'
|
|
57
|
-
},
|
|
58
|
-
fallback: {
|
|
59
|
-
padding: 12,
|
|
60
|
-
fontSize: 13,
|
|
61
|
-
color: _tokens.chatTokens.colorTextSecondary
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
65
|
var _default = exports.default = /*#__PURE__*/_react.default.memo(CardWrapper);
|
|
65
66
|
//# sourceMappingURL=CardWrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeUi","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","CardWrapper","cardType","data","actions","registry","fallback","style","testID","useTokens","ds","useMemo","StyleSheet","create","container","backgroundColor","colorBgElevated","borderRadius","borderWidth","borderColor","colorBorder","marginLeft","marginRight","marginBottom","overflow","maxWidth","padding","fontSize","color","colorTextSecondary","CardComponent","jsx","View","children","jsxs","Text","_default","exports","React","memo"],"sourceRoot":"../../../src","sources":["card-wrapper/CardWrapper.tsx"],"mappings":";;;;;;AAKA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAAkD,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IA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I,SAAS,EAAEP,KAAK,CAAE;MAACC,MAAM,EAAEA,MAAO;MAAAyB,QAAA,EAChD3B,QAAQ,iBACP,IAAAzB,WAAA,CAAAqD,IAAA,EAACvD,YAAA,CAAAwD,IAAI;QAAC5B,KAAK,EAAEG,EAAE,CAACJ,QAAS;QAAA2B,QAAA,GAAC,oDAAU,EAAC/B,QAAQ;MAAA,CAAO;IACrD,CACG,CAAC;EAEX;EAEA,oBACE,IAAArB,WAAA,CAAAkD,GAAA,EAACpD,YAAA,CAAAqD,IAAI;IAACzB,KAAK,EAAE,CAACG,EAAE,CAACI,SAAS,EAAEP,KAAK,CAAE;IAACC,MAAM,EAAEA,MAAM,IAAI,QAAQN,QAAQ,EAAG;IAAA+B,QAAA,eACvE,IAAApD,WAAA,CAAAkD,GAAA,EAACD,aAAa;MAAC3B,IAAI,EAAEA,IAAK;MAACC,OAAO,EAAEA;IAAQ,CAAE;EAAC,CAC3C,CAAC;AAEX,CAAC;AAAC,IAAAgC,QAAA,GAAAC,OAAA,CAAA7C,OAAA,gBAEa8C,cAAK,CAACC,IAAI,CAACtC,WAAW,CAAC","ignoreList":[]}
|
|
@@ -6,17 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
var
|
|
9
|
+
var _reactNativeUi = require("@unif/react-native-ui");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
12
|
/**
|
|
13
13
|
* Conversations — 会话列表
|
|
14
14
|
*
|
|
15
15
|
* SectionList + 日期分组(今天/昨天/更早)
|
|
16
|
-
*
|
|
16
|
+
* 长按弹出 Menu 菜单
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
function
|
|
19
|
+
function groupByDateFn(sessions) {
|
|
20
20
|
const now = new Date();
|
|
21
21
|
const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
|
|
22
22
|
const yesterdayStart = todayStart - 86400000;
|
|
@@ -47,75 +47,169 @@ function groupByDate(sessions) {
|
|
|
47
47
|
});
|
|
48
48
|
return groups;
|
|
49
49
|
}
|
|
50
|
+
const initialMenuState = {
|
|
51
|
+
visible: false,
|
|
52
|
+
item: null,
|
|
53
|
+
layout: {
|
|
54
|
+
x: 0,
|
|
55
|
+
y: 0,
|
|
56
|
+
width: 0,
|
|
57
|
+
height: 0
|
|
58
|
+
}
|
|
59
|
+
};
|
|
50
60
|
const Conversations = ({
|
|
51
61
|
items,
|
|
52
62
|
activeId,
|
|
53
63
|
onSelect,
|
|
54
|
-
onDelete,
|
|
55
64
|
onNew,
|
|
56
65
|
groupByDate: shouldGroup = true,
|
|
57
66
|
header,
|
|
67
|
+
menus,
|
|
68
|
+
onMenuAction,
|
|
58
69
|
style,
|
|
59
70
|
styles: semanticStyles,
|
|
60
71
|
testID = 'conversations'
|
|
61
72
|
}) => {
|
|
73
|
+
const t = (0, _reactNativeUi.useTokens)();
|
|
74
|
+
const [menuState, setMenuState] = (0, _react.useState)(initialMenuState);
|
|
75
|
+
const itemRefs = (0, _react.useRef)({});
|
|
62
76
|
const sections = (0, _react.useMemo)(() => {
|
|
63
77
|
if (shouldGroup) {
|
|
64
|
-
return
|
|
78
|
+
return groupByDateFn(items);
|
|
65
79
|
}
|
|
66
80
|
return [{
|
|
67
81
|
title: '',
|
|
68
82
|
data: items
|
|
69
83
|
}];
|
|
70
84
|
}, [items, shouldGroup]);
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
const closeMenu = (0, _react.useCallback)(() => {
|
|
86
|
+
setMenuState(initialMenuState);
|
|
87
|
+
}, []);
|
|
88
|
+
const handleLongPress = (0, _react.useCallback)(item => {
|
|
89
|
+
if (!menus) return;
|
|
90
|
+
const ref = itemRefs.current[item.id];
|
|
91
|
+
if (ref) {
|
|
92
|
+
ref.measureInWindow((x, y, width, height) => {
|
|
93
|
+
setMenuState({
|
|
94
|
+
visible: true,
|
|
95
|
+
item,
|
|
96
|
+
layout: {
|
|
97
|
+
x,
|
|
98
|
+
y,
|
|
99
|
+
width,
|
|
100
|
+
height
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}, [menus]);
|
|
106
|
+
const handleMenuAction = (0, _react.useCallback)(action => {
|
|
107
|
+
const item = menuState.item;
|
|
108
|
+
if (item && onMenuAction) {
|
|
109
|
+
onMenuAction(action, item);
|
|
110
|
+
}
|
|
111
|
+
}, [menuState.item, onMenuAction]);
|
|
112
|
+
const setItemRef = (0, _react.useCallback)(id => ref => {
|
|
113
|
+
itemRefs.current[id] = ref;
|
|
114
|
+
}, []);
|
|
115
|
+
const menuActions = (0, _react.useMemo)(() => {
|
|
116
|
+
if (!menus || !menuState.item) return [];
|
|
117
|
+
if (typeof menus === 'function') {
|
|
118
|
+
return menus(menuState.item);
|
|
119
|
+
}
|
|
120
|
+
return menus;
|
|
121
|
+
}, [menus, menuState.item]);
|
|
122
|
+
const ds = (0, _react.useMemo)(() => _reactNative.StyleSheet.create({
|
|
123
|
+
container: {
|
|
124
|
+
flex: 1
|
|
125
|
+
},
|
|
126
|
+
newButtonWrapper: {
|
|
127
|
+
alignItems: 'center',
|
|
128
|
+
paddingVertical: 12,
|
|
129
|
+
paddingHorizontal: 20
|
|
130
|
+
},
|
|
131
|
+
newButton: {
|
|
132
|
+
flexDirection: 'row',
|
|
133
|
+
alignItems: 'center',
|
|
134
|
+
justifyContent: 'center',
|
|
135
|
+
width: '80%',
|
|
136
|
+
paddingVertical: 10,
|
|
137
|
+
borderRadius: t.radiusFull,
|
|
138
|
+
borderWidth: 1,
|
|
139
|
+
borderColor: t.colorPrimary
|
|
140
|
+
},
|
|
141
|
+
newButtonText: {
|
|
142
|
+
fontSize: 14,
|
|
143
|
+
fontWeight: '500',
|
|
144
|
+
color: t.colorPrimary
|
|
145
|
+
},
|
|
146
|
+
sectionHeader: {
|
|
147
|
+
fontSize: 12,
|
|
148
|
+
color: t.colorTextSecondary,
|
|
149
|
+
paddingHorizontal: 20,
|
|
150
|
+
paddingTop: 16,
|
|
151
|
+
paddingBottom: 6
|
|
152
|
+
},
|
|
153
|
+
sessionItem: {
|
|
154
|
+
flexDirection: 'row',
|
|
155
|
+
alignItems: 'center',
|
|
156
|
+
paddingHorizontal: 20,
|
|
157
|
+
paddingVertical: 12
|
|
158
|
+
},
|
|
159
|
+
sessionItemActive: {
|
|
160
|
+
backgroundColor: '#F3F4F6'
|
|
161
|
+
},
|
|
162
|
+
sessionTitle: {
|
|
163
|
+
flex: 1,
|
|
164
|
+
fontSize: 14,
|
|
165
|
+
fontWeight: '500',
|
|
166
|
+
color: t.colorText
|
|
167
|
+
},
|
|
168
|
+
list: {
|
|
169
|
+
flex: 1
|
|
170
|
+
}
|
|
171
|
+
}), [t]);
|
|
82
172
|
const renderItem = (0, _react.useCallback)(({
|
|
83
173
|
item
|
|
84
174
|
}) => {
|
|
85
175
|
const isActive = item.id === activeId;
|
|
86
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
children:
|
|
176
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
177
|
+
ref: setItemRef(item.id),
|
|
178
|
+
collapsable: false,
|
|
179
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
180
|
+
style: [ds.sessionItem, semanticStyles?.item, isActive && ds.sessionItemActive, isActive && semanticStyles?.itemActive],
|
|
181
|
+
onPress: () => onSelect(item.id),
|
|
182
|
+
onLongPress: () => handleLongPress(item),
|
|
183
|
+
activeOpacity: 0.7,
|
|
184
|
+
testID: `${testID}-item-${item.id}`,
|
|
185
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
186
|
+
style: ds.sessionTitle,
|
|
187
|
+
numberOfLines: 1,
|
|
188
|
+
children: item.title
|
|
189
|
+
})
|
|
96
190
|
})
|
|
97
191
|
});
|
|
98
|
-
}, [activeId, onSelect,
|
|
192
|
+
}, [activeId, onSelect, handleLongPress, semanticStyles, testID, setItemRef, ds]);
|
|
99
193
|
const renderSectionHeader = (0, _react.useCallback)(({
|
|
100
194
|
section
|
|
101
195
|
}) => {
|
|
102
196
|
if (!section.title) return null;
|
|
103
197
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
104
|
-
style: [
|
|
198
|
+
style: [ds.sectionHeader, semanticStyles?.sectionHeader],
|
|
105
199
|
children: section.title
|
|
106
200
|
});
|
|
107
|
-
}, [semanticStyles]);
|
|
201
|
+
}, [semanticStyles, ds]);
|
|
108
202
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
109
|
-
style: [
|
|
203
|
+
style: [ds.container, semanticStyles?.root, style],
|
|
110
204
|
testID: testID,
|
|
111
205
|
children: [header, onNew && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
112
|
-
style:
|
|
206
|
+
style: ds.newButtonWrapper,
|
|
113
207
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
114
|
-
style: [
|
|
208
|
+
style: [ds.newButton, semanticStyles?.newButton],
|
|
115
209
|
onPress: onNew,
|
|
116
210
|
testID: `${testID}-new`,
|
|
117
211
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
118
|
-
style:
|
|
212
|
+
style: ds.newButtonText,
|
|
119
213
|
children: "\uFF0B \u65B0\u5EFA\u4F1A\u8BDD"
|
|
120
214
|
})
|
|
121
215
|
})
|
|
@@ -124,61 +218,18 @@ const Conversations = ({
|
|
|
124
218
|
keyExtractor: item => item.id,
|
|
125
219
|
renderItem: renderItem,
|
|
126
220
|
renderSectionHeader: renderSectionHeader,
|
|
127
|
-
style:
|
|
221
|
+
style: ds.list,
|
|
128
222
|
showsVerticalScrollIndicator: false,
|
|
129
223
|
stickySectionHeadersEnabled: false
|
|
224
|
+
}), menus && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeUi.Menu, {
|
|
225
|
+
visible: menuState.visible,
|
|
226
|
+
onClose: closeMenu,
|
|
227
|
+
anchorLayout: menuState.layout,
|
|
228
|
+
actions: menuActions,
|
|
229
|
+
onAction: handleMenuAction,
|
|
230
|
+
testID: `${testID}-menu`
|
|
130
231
|
})]
|
|
131
232
|
});
|
|
132
233
|
};
|
|
133
|
-
const defaultStyles = _reactNative.StyleSheet.create({
|
|
134
|
-
container: {
|
|
135
|
-
flex: 1
|
|
136
|
-
},
|
|
137
|
-
newButtonWrapper: {
|
|
138
|
-
alignItems: 'center',
|
|
139
|
-
paddingVertical: 12,
|
|
140
|
-
paddingHorizontal: 20
|
|
141
|
-
},
|
|
142
|
-
newButton: {
|
|
143
|
-
flexDirection: 'row',
|
|
144
|
-
alignItems: 'center',
|
|
145
|
-
justifyContent: 'center',
|
|
146
|
-
width: '80%',
|
|
147
|
-
paddingVertical: 10,
|
|
148
|
-
borderRadius: _tokens.chatTokens.radiusFull,
|
|
149
|
-
borderWidth: 1,
|
|
150
|
-
borderColor: _tokens.chatTokens.colorPrimary
|
|
151
|
-
},
|
|
152
|
-
newButtonText: {
|
|
153
|
-
fontSize: 14,
|
|
154
|
-
fontWeight: '500',
|
|
155
|
-
color: _tokens.chatTokens.colorPrimary
|
|
156
|
-
},
|
|
157
|
-
sectionHeader: {
|
|
158
|
-
fontSize: 12,
|
|
159
|
-
color: _tokens.chatTokens.colorTextSecondary,
|
|
160
|
-
paddingHorizontal: 20,
|
|
161
|
-
paddingTop: 16,
|
|
162
|
-
paddingBottom: 6
|
|
163
|
-
},
|
|
164
|
-
sessionItem: {
|
|
165
|
-
flexDirection: 'row',
|
|
166
|
-
alignItems: 'center',
|
|
167
|
-
paddingHorizontal: 20,
|
|
168
|
-
paddingVertical: 12
|
|
169
|
-
},
|
|
170
|
-
sessionItemActive: {
|
|
171
|
-
backgroundColor: '#F3F4F6'
|
|
172
|
-
},
|
|
173
|
-
sessionTitle: {
|
|
174
|
-
flex: 1,
|
|
175
|
-
fontSize: 14,
|
|
176
|
-
fontWeight: '500',
|
|
177
|
-
color: _tokens.chatTokens.colorText
|
|
178
|
-
},
|
|
179
|
-
list: {
|
|
180
|
-
flex: 1
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
234
|
var _default = exports.default = /*#__PURE__*/_react.default.memo(Conversations);
|
|
184
235
|
//# sourceMappingURL=Conversations.js.map
|