kaleido-ui 0.1.53 → 0.1.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/native/index.cjs +93 -4
- package/dist/native/index.d.cts +20 -1
- package/dist/native/index.d.ts +20 -1
- package/dist/native/index.js +93 -5
- package/package.json +1 -1
package/dist/native/index.cjs
CHANGED
|
@@ -36,6 +36,7 @@ __export(native_exports, {
|
|
|
36
36
|
AssetSelector: () => import_wdk_uikit_react_native2.AssetSelector,
|
|
37
37
|
Balance: () => import_wdk_uikit_react_native2.Balance,
|
|
38
38
|
BalanceCard: () => BalanceCard,
|
|
39
|
+
ChatBubble: () => ChatBubble,
|
|
39
40
|
CryptoAddressInput: () => import_wdk_uikit_react_native2.CryptoAddressInput,
|
|
40
41
|
EmptyState: () => EmptyState,
|
|
41
42
|
KButton: () => KButton,
|
|
@@ -1051,13 +1052,100 @@ var styles5 = import_react_native14.StyleSheet.create({
|
|
|
1051
1052
|
label: { fontSize: 13, marginLeft: 10, fontWeight: "500" }
|
|
1052
1053
|
});
|
|
1053
1054
|
|
|
1054
|
-
// src/native/components/
|
|
1055
|
+
// src/native/components/chat-bubble.tsx
|
|
1056
|
+
var import_react4 = require("react");
|
|
1055
1057
|
var import_react_native15 = require("react-native");
|
|
1056
1058
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1059
|
+
function ChatBubble({
|
|
1060
|
+
role,
|
|
1061
|
+
avatar,
|
|
1062
|
+
time,
|
|
1063
|
+
animateOnMount = true,
|
|
1064
|
+
onLongPress,
|
|
1065
|
+
maxWidth = "78%",
|
|
1066
|
+
style,
|
|
1067
|
+
children
|
|
1068
|
+
}) {
|
|
1069
|
+
const { theme, fontFamily: fontFamily2 } = useKaleidoTheme();
|
|
1070
|
+
const isUser = role === "user";
|
|
1071
|
+
const enter = (0, import_react4.useRef)(new import_react_native15.Animated.Value(animateOnMount ? 0 : 1)).current;
|
|
1072
|
+
(0, import_react4.useEffect)(() => {
|
|
1073
|
+
if (!animateOnMount) return;
|
|
1074
|
+
import_react_native15.Animated.spring(enter, { toValue: 1, tension: 120, friction: 9, useNativeDriver: true }).start();
|
|
1075
|
+
}, [enter, animateOnMount]);
|
|
1076
|
+
const bubble = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1077
|
+
import_react_native15.Pressable,
|
|
1078
|
+
{
|
|
1079
|
+
onLongPress,
|
|
1080
|
+
delayLongPress: 300,
|
|
1081
|
+
style: [
|
|
1082
|
+
styles6.bubble,
|
|
1083
|
+
{ maxWidth },
|
|
1084
|
+
isUser ? { backgroundColor: theme.primary } : {
|
|
1085
|
+
backgroundColor: theme.card,
|
|
1086
|
+
shadowColor: theme.background,
|
|
1087
|
+
shadowOffset: { width: 0, height: 4 },
|
|
1088
|
+
shadowOpacity: 0.3,
|
|
1089
|
+
shadowRadius: 6,
|
|
1090
|
+
elevation: 3
|
|
1091
|
+
},
|
|
1092
|
+
style
|
|
1093
|
+
],
|
|
1094
|
+
children: [
|
|
1095
|
+
children,
|
|
1096
|
+
time ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1097
|
+
import_react_native15.Text,
|
|
1098
|
+
{
|
|
1099
|
+
style: [
|
|
1100
|
+
styles6.time,
|
|
1101
|
+
{
|
|
1102
|
+
color: isUser ? theme.text.onAccent : theme.text.muted,
|
|
1103
|
+
fontFamily: fontFamily2,
|
|
1104
|
+
textAlign: isUser ? "right" : "left"
|
|
1105
|
+
}
|
|
1106
|
+
],
|
|
1107
|
+
children: time
|
|
1108
|
+
}
|
|
1109
|
+
) : null
|
|
1110
|
+
]
|
|
1111
|
+
}
|
|
1112
|
+
);
|
|
1113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1114
|
+
import_react_native15.Animated.View,
|
|
1115
|
+
{
|
|
1116
|
+
style: [
|
|
1117
|
+
styles6.row,
|
|
1118
|
+
{ justifyContent: isUser ? "flex-end" : "flex-start" },
|
|
1119
|
+
{
|
|
1120
|
+
opacity: enter,
|
|
1121
|
+
transform: [
|
|
1122
|
+
{ translateY: enter.interpolate({ inputRange: [0, 1], outputRange: [14, 0] }) },
|
|
1123
|
+
{ translateX: enter.interpolate({ inputRange: [0, 1], outputRange: [isUser ? 22 : -22, 0] }) },
|
|
1124
|
+
{ scale: enter.interpolate({ inputRange: [0, 1], outputRange: [0.96, 1] }) }
|
|
1125
|
+
]
|
|
1126
|
+
}
|
|
1127
|
+
],
|
|
1128
|
+
children: [
|
|
1129
|
+
!isUser && avatar,
|
|
1130
|
+
bubble,
|
|
1131
|
+
isUser && avatar
|
|
1132
|
+
]
|
|
1133
|
+
}
|
|
1134
|
+
);
|
|
1135
|
+
}
|
|
1136
|
+
var styles6 = import_react_native15.StyleSheet.create({
|
|
1137
|
+
row: { flexDirection: "row", alignItems: "flex-end", width: "100%", marginBottom: 16 },
|
|
1138
|
+
bubble: { borderRadius: 24, padding: 16, overflow: "hidden" },
|
|
1139
|
+
time: { fontSize: 12, marginTop: 8, fontWeight: "500" }
|
|
1140
|
+
});
|
|
1141
|
+
|
|
1142
|
+
// src/native/components/mode-toggle.tsx
|
|
1143
|
+
var import_react_native16 = require("react-native");
|
|
1144
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1057
1145
|
function ModeToggle({ icon, size = 40, onToggle }) {
|
|
1058
1146
|
const { theme, mode, toggleMode } = useKaleidoTheme();
|
|
1059
|
-
return /* @__PURE__ */ (0,
|
|
1060
|
-
|
|
1147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1148
|
+
import_react_native16.Pressable,
|
|
1061
1149
|
{
|
|
1062
1150
|
accessibilityRole: "switch",
|
|
1063
1151
|
accessibilityState: { checked: mode === "dark" },
|
|
@@ -1077,7 +1165,7 @@ function ModeToggle({ icon, size = 40, onToggle }) {
|
|
|
1077
1165
|
justifyContent: "center",
|
|
1078
1166
|
opacity: pressed ? 0.85 : 1
|
|
1079
1167
|
}),
|
|
1080
|
-
children: /* @__PURE__ */ (0,
|
|
1168
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native16.View, { children: icon(mode, theme.text.primary, Math.round(size * 0.5)) })
|
|
1081
1169
|
}
|
|
1082
1170
|
);
|
|
1083
1171
|
}
|
|
@@ -1156,6 +1244,7 @@ var transition = {
|
|
|
1156
1244
|
AssetSelector,
|
|
1157
1245
|
Balance,
|
|
1158
1246
|
BalanceCard,
|
|
1247
|
+
ChatBubble,
|
|
1159
1248
|
CryptoAddressInput,
|
|
1160
1249
|
EmptyState,
|
|
1161
1250
|
KButton,
|
package/dist/native/index.d.cts
CHANGED
|
@@ -379,6 +379,25 @@ interface TypingDotsProps {
|
|
|
379
379
|
}
|
|
380
380
|
declare function TypingDots({ label, color, style }: TypingDotsProps): react_jsx_runtime.JSX.Element;
|
|
381
381
|
|
|
382
|
+
type ChatRole = 'user' | 'assistant';
|
|
383
|
+
interface ChatBubbleProps {
|
|
384
|
+
role: ChatRole;
|
|
385
|
+
/** Consumer-owned avatar node (icon, gradient, image) rendered beside the bubble. */
|
|
386
|
+
avatar?: ReactNode;
|
|
387
|
+
/** Timestamp label rendered at the bubble foot. */
|
|
388
|
+
time?: string;
|
|
389
|
+
/** Run the spring entrance animation on mount (default true). */
|
|
390
|
+
animateOnMount?: boolean;
|
|
391
|
+
onLongPress?: () => void;
|
|
392
|
+
/** Max bubble width relative to the row (default '78%'). */
|
|
393
|
+
maxWidth?: ViewStyle['maxWidth'];
|
|
394
|
+
/** Style applied to the bubble container. */
|
|
395
|
+
style?: ViewStyle;
|
|
396
|
+
/** Message body — consumer renders text / markdown / cards / typing dots. */
|
|
397
|
+
children: ReactNode;
|
|
398
|
+
}
|
|
399
|
+
declare function ChatBubble({ role, avatar, time, animateOnMount, onLongPress, maxWidth, style, children, }: ChatBubbleProps): react_jsx_runtime.JSX.Element;
|
|
400
|
+
|
|
382
401
|
interface ModeToggleProps {
|
|
383
402
|
icon: (mode: ThemeMode, color: string, size: number) => React.ReactNode;
|
|
384
403
|
size?: number;
|
|
@@ -572,4 +591,4 @@ declare const transition: {
|
|
|
572
591
|
readonly slow: "300ms ease-out";
|
|
573
592
|
};
|
|
574
593
|
|
|
575
|
-
export { ActionButton, type ActionButtonProps, AlertBanner, BalanceCard, type BalanceCardProps, EmptyState, type EmptyStateProps, KButton, type KButtonProps, KCard, type KCardProps, KScreen, type KScreenProps, KText, type KTextProps, type KaleidoTheme, KaleidoThemeProvider, KaleidoUIProvider, type KaleidoUIProviderProps, ModeToggle, type ModeToggleProps, type NativeTypeLevel, NetworkBadge, NetworkChip, type NetworkChipProps, type NetworkKey, type NetworkType, QrCode, type QrCodeProps, SectionLabel, StatusBadge, type StatusType, type ThemeMode, TypingDots, type TypingDotsProps, colors, fontFamily, fontWeight, kaleidoswapBrandConfig, kaleidoswapTokens, makeTheme, nativeType, radius, shadow, themes, transition, typeScale, useKaleidoTheme };
|
|
594
|
+
export { ActionButton, type ActionButtonProps, AlertBanner, BalanceCard, type BalanceCardProps, ChatBubble, type ChatBubbleProps, type ChatRole, EmptyState, type EmptyStateProps, KButton, type KButtonProps, KCard, type KCardProps, KScreen, type KScreenProps, KText, type KTextProps, type KaleidoTheme, KaleidoThemeProvider, KaleidoUIProvider, type KaleidoUIProviderProps, ModeToggle, type ModeToggleProps, type NativeTypeLevel, NetworkBadge, NetworkChip, type NetworkChipProps, type NetworkKey, type NetworkType, QrCode, type QrCodeProps, SectionLabel, StatusBadge, type StatusType, type ThemeMode, TypingDots, type TypingDotsProps, colors, fontFamily, fontWeight, kaleidoswapBrandConfig, kaleidoswapTokens, makeTheme, nativeType, radius, shadow, themes, transition, typeScale, useKaleidoTheme };
|
package/dist/native/index.d.ts
CHANGED
|
@@ -379,6 +379,25 @@ interface TypingDotsProps {
|
|
|
379
379
|
}
|
|
380
380
|
declare function TypingDots({ label, color, style }: TypingDotsProps): react_jsx_runtime.JSX.Element;
|
|
381
381
|
|
|
382
|
+
type ChatRole = 'user' | 'assistant';
|
|
383
|
+
interface ChatBubbleProps {
|
|
384
|
+
role: ChatRole;
|
|
385
|
+
/** Consumer-owned avatar node (icon, gradient, image) rendered beside the bubble. */
|
|
386
|
+
avatar?: ReactNode;
|
|
387
|
+
/** Timestamp label rendered at the bubble foot. */
|
|
388
|
+
time?: string;
|
|
389
|
+
/** Run the spring entrance animation on mount (default true). */
|
|
390
|
+
animateOnMount?: boolean;
|
|
391
|
+
onLongPress?: () => void;
|
|
392
|
+
/** Max bubble width relative to the row (default '78%'). */
|
|
393
|
+
maxWidth?: ViewStyle['maxWidth'];
|
|
394
|
+
/** Style applied to the bubble container. */
|
|
395
|
+
style?: ViewStyle;
|
|
396
|
+
/** Message body — consumer renders text / markdown / cards / typing dots. */
|
|
397
|
+
children: ReactNode;
|
|
398
|
+
}
|
|
399
|
+
declare function ChatBubble({ role, avatar, time, animateOnMount, onLongPress, maxWidth, style, children, }: ChatBubbleProps): react_jsx_runtime.JSX.Element;
|
|
400
|
+
|
|
382
401
|
interface ModeToggleProps {
|
|
383
402
|
icon: (mode: ThemeMode, color: string, size: number) => React.ReactNode;
|
|
384
403
|
size?: number;
|
|
@@ -572,4 +591,4 @@ declare const transition: {
|
|
|
572
591
|
readonly slow: "300ms ease-out";
|
|
573
592
|
};
|
|
574
593
|
|
|
575
|
-
export { ActionButton, type ActionButtonProps, AlertBanner, BalanceCard, type BalanceCardProps, EmptyState, type EmptyStateProps, KButton, type KButtonProps, KCard, type KCardProps, KScreen, type KScreenProps, KText, type KTextProps, type KaleidoTheme, KaleidoThemeProvider, KaleidoUIProvider, type KaleidoUIProviderProps, ModeToggle, type ModeToggleProps, type NativeTypeLevel, NetworkBadge, NetworkChip, type NetworkChipProps, type NetworkKey, type NetworkType, QrCode, type QrCodeProps, SectionLabel, StatusBadge, type StatusType, type ThemeMode, TypingDots, type TypingDotsProps, colors, fontFamily, fontWeight, kaleidoswapBrandConfig, kaleidoswapTokens, makeTheme, nativeType, radius, shadow, themes, transition, typeScale, useKaleidoTheme };
|
|
594
|
+
export { ActionButton, type ActionButtonProps, AlertBanner, BalanceCard, type BalanceCardProps, ChatBubble, type ChatBubbleProps, type ChatRole, EmptyState, type EmptyStateProps, KButton, type KButtonProps, KCard, type KCardProps, KScreen, type KScreenProps, KText, type KTextProps, type KaleidoTheme, KaleidoThemeProvider, KaleidoUIProvider, type KaleidoUIProviderProps, ModeToggle, type ModeToggleProps, type NativeTypeLevel, NetworkBadge, NetworkChip, type NetworkChipProps, type NetworkKey, type NetworkType, QrCode, type QrCodeProps, SectionLabel, StatusBadge, type StatusType, type ThemeMode, TypingDots, type TypingDotsProps, colors, fontFamily, fontWeight, kaleidoswapBrandConfig, kaleidoswapTokens, makeTheme, nativeType, radius, shadow, themes, transition, typeScale, useKaleidoTheme };
|
package/dist/native/index.js
CHANGED
|
@@ -991,13 +991,100 @@ var styles5 = StyleSheet5.create({
|
|
|
991
991
|
label: { fontSize: 13, marginLeft: 10, fontWeight: "500" }
|
|
992
992
|
});
|
|
993
993
|
|
|
994
|
+
// src/native/components/chat-bubble.tsx
|
|
995
|
+
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
996
|
+
import { Text as Text7, StyleSheet as StyleSheet6, Animated as Animated2, Pressable as Pressable4 } from "react-native";
|
|
997
|
+
import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
998
|
+
function ChatBubble({
|
|
999
|
+
role,
|
|
1000
|
+
avatar,
|
|
1001
|
+
time,
|
|
1002
|
+
animateOnMount = true,
|
|
1003
|
+
onLongPress,
|
|
1004
|
+
maxWidth = "78%",
|
|
1005
|
+
style,
|
|
1006
|
+
children
|
|
1007
|
+
}) {
|
|
1008
|
+
const { theme, fontFamily: fontFamily2 } = useKaleidoTheme();
|
|
1009
|
+
const isUser = role === "user";
|
|
1010
|
+
const enter = useRef2(new Animated2.Value(animateOnMount ? 0 : 1)).current;
|
|
1011
|
+
useEffect2(() => {
|
|
1012
|
+
if (!animateOnMount) return;
|
|
1013
|
+
Animated2.spring(enter, { toValue: 1, tension: 120, friction: 9, useNativeDriver: true }).start();
|
|
1014
|
+
}, [enter, animateOnMount]);
|
|
1015
|
+
const bubble = /* @__PURE__ */ jsxs9(
|
|
1016
|
+
Pressable4,
|
|
1017
|
+
{
|
|
1018
|
+
onLongPress,
|
|
1019
|
+
delayLongPress: 300,
|
|
1020
|
+
style: [
|
|
1021
|
+
styles6.bubble,
|
|
1022
|
+
{ maxWidth },
|
|
1023
|
+
isUser ? { backgroundColor: theme.primary } : {
|
|
1024
|
+
backgroundColor: theme.card,
|
|
1025
|
+
shadowColor: theme.background,
|
|
1026
|
+
shadowOffset: { width: 0, height: 4 },
|
|
1027
|
+
shadowOpacity: 0.3,
|
|
1028
|
+
shadowRadius: 6,
|
|
1029
|
+
elevation: 3
|
|
1030
|
+
},
|
|
1031
|
+
style
|
|
1032
|
+
],
|
|
1033
|
+
children: [
|
|
1034
|
+
children,
|
|
1035
|
+
time ? /* @__PURE__ */ jsx17(
|
|
1036
|
+
Text7,
|
|
1037
|
+
{
|
|
1038
|
+
style: [
|
|
1039
|
+
styles6.time,
|
|
1040
|
+
{
|
|
1041
|
+
color: isUser ? theme.text.onAccent : theme.text.muted,
|
|
1042
|
+
fontFamily: fontFamily2,
|
|
1043
|
+
textAlign: isUser ? "right" : "left"
|
|
1044
|
+
}
|
|
1045
|
+
],
|
|
1046
|
+
children: time
|
|
1047
|
+
}
|
|
1048
|
+
) : null
|
|
1049
|
+
]
|
|
1050
|
+
}
|
|
1051
|
+
);
|
|
1052
|
+
return /* @__PURE__ */ jsxs9(
|
|
1053
|
+
Animated2.View,
|
|
1054
|
+
{
|
|
1055
|
+
style: [
|
|
1056
|
+
styles6.row,
|
|
1057
|
+
{ justifyContent: isUser ? "flex-end" : "flex-start" },
|
|
1058
|
+
{
|
|
1059
|
+
opacity: enter,
|
|
1060
|
+
transform: [
|
|
1061
|
+
{ translateY: enter.interpolate({ inputRange: [0, 1], outputRange: [14, 0] }) },
|
|
1062
|
+
{ translateX: enter.interpolate({ inputRange: [0, 1], outputRange: [isUser ? 22 : -22, 0] }) },
|
|
1063
|
+
{ scale: enter.interpolate({ inputRange: [0, 1], outputRange: [0.96, 1] }) }
|
|
1064
|
+
]
|
|
1065
|
+
}
|
|
1066
|
+
],
|
|
1067
|
+
children: [
|
|
1068
|
+
!isUser && avatar,
|
|
1069
|
+
bubble,
|
|
1070
|
+
isUser && avatar
|
|
1071
|
+
]
|
|
1072
|
+
}
|
|
1073
|
+
);
|
|
1074
|
+
}
|
|
1075
|
+
var styles6 = StyleSheet6.create({
|
|
1076
|
+
row: { flexDirection: "row", alignItems: "flex-end", width: "100%", marginBottom: 16 },
|
|
1077
|
+
bubble: { borderRadius: 24, padding: 16, overflow: "hidden" },
|
|
1078
|
+
time: { fontSize: 12, marginTop: 8, fontWeight: "500" }
|
|
1079
|
+
});
|
|
1080
|
+
|
|
994
1081
|
// src/native/components/mode-toggle.tsx
|
|
995
|
-
import { Pressable as
|
|
996
|
-
import { jsx as
|
|
1082
|
+
import { Pressable as Pressable5, View as View14 } from "react-native";
|
|
1083
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
997
1084
|
function ModeToggle({ icon, size = 40, onToggle }) {
|
|
998
1085
|
const { theme, mode, toggleMode } = useKaleidoTheme();
|
|
999
|
-
return /* @__PURE__ */
|
|
1000
|
-
|
|
1086
|
+
return /* @__PURE__ */ jsx18(
|
|
1087
|
+
Pressable5,
|
|
1001
1088
|
{
|
|
1002
1089
|
accessibilityRole: "switch",
|
|
1003
1090
|
accessibilityState: { checked: mode === "dark" },
|
|
@@ -1017,7 +1104,7 @@ function ModeToggle({ icon, size = 40, onToggle }) {
|
|
|
1017
1104
|
justifyContent: "center",
|
|
1018
1105
|
opacity: pressed ? 0.85 : 1
|
|
1019
1106
|
}),
|
|
1020
|
-
children: /* @__PURE__ */
|
|
1107
|
+
children: /* @__PURE__ */ jsx18(View14, { children: icon(mode, theme.text.primary, Math.round(size * 0.5)) })
|
|
1021
1108
|
}
|
|
1022
1109
|
);
|
|
1023
1110
|
}
|
|
@@ -1095,6 +1182,7 @@ export {
|
|
|
1095
1182
|
AssetSelector,
|
|
1096
1183
|
Balance,
|
|
1097
1184
|
BalanceCard,
|
|
1185
|
+
ChatBubble,
|
|
1098
1186
|
CryptoAddressInput,
|
|
1099
1187
|
EmptyState,
|
|
1100
1188
|
KButton,
|
package/package.json
CHANGED