@unif/react-native-chat 0.1.0 → 0.1.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.
Files changed (91) hide show
  1. package/README.md +156 -0
  2. package/lib/commonjs/bubble/Bubble.js +131 -0
  3. package/lib/commonjs/bubble/Bubble.js.map +1 -0
  4. package/lib/commonjs/bubble/BubbleList.js +73 -0
  5. package/lib/commonjs/bubble/BubbleList.js.map +1 -0
  6. package/lib/commonjs/bubble/index.md +111 -0
  7. package/lib/commonjs/card-wrapper/CardWrapper.js +65 -0
  8. package/lib/commonjs/card-wrapper/CardWrapper.js.map +1 -0
  9. package/lib/commonjs/card-wrapper/index.md +78 -0
  10. package/lib/commonjs/conversations/Conversations.js +184 -0
  11. package/lib/commonjs/conversations/Conversations.js.map +1 -0
  12. package/lib/commonjs/conversations/index.md +90 -0
  13. package/lib/commonjs/index.js +63 -0
  14. package/lib/commonjs/index.js.map +1 -0
  15. package/lib/commonjs/package.json +1 -0
  16. package/lib/commonjs/prompts/Prompts.js +87 -0
  17. package/lib/commonjs/prompts/Prompts.js.map +1 -0
  18. package/lib/commonjs/prompts/index.md +81 -0
  19. package/lib/commonjs/sender/Sender.js +354 -0
  20. package/lib/commonjs/sender/Sender.js.map +1 -0
  21. package/lib/commonjs/sender/index.md +131 -0
  22. package/lib/commonjs/theme/tokens.js +67 -0
  23. package/lib/commonjs/theme/tokens.js.map +1 -0
  24. package/lib/commonjs/welcome/Welcome.js +152 -0
  25. package/lib/commonjs/welcome/Welcome.js.map +1 -0
  26. package/lib/commonjs/welcome/index.md +95 -0
  27. package/lib/module/bubble/Bubble.js +126 -0
  28. package/lib/module/bubble/Bubble.js.map +1 -0
  29. package/lib/module/bubble/BubbleList.js +68 -0
  30. package/lib/module/bubble/BubbleList.js.map +1 -0
  31. package/lib/module/bubble/index.md +111 -0
  32. package/lib/module/card-wrapper/CardWrapper.js +60 -0
  33. package/lib/module/card-wrapper/CardWrapper.js.map +1 -0
  34. package/lib/module/card-wrapper/index.md +78 -0
  35. package/lib/module/conversations/Conversations.js +179 -0
  36. package/lib/module/conversations/Conversations.js.map +1 -0
  37. package/lib/module/conversations/index.md +90 -0
  38. package/lib/module/index.js +23 -0
  39. package/lib/module/index.js.map +1 -0
  40. package/lib/module/package.json +1 -0
  41. package/lib/module/prompts/Prompts.js +82 -0
  42. package/lib/module/prompts/Prompts.js.map +1 -0
  43. package/lib/module/prompts/index.md +81 -0
  44. package/lib/module/sender/Sender.js +349 -0
  45. package/lib/module/sender/Sender.js.map +1 -0
  46. package/lib/module/sender/index.md +131 -0
  47. package/lib/module/theme/tokens.js +63 -0
  48. package/lib/module/theme/tokens.js.map +1 -0
  49. package/lib/module/welcome/Welcome.js +147 -0
  50. package/lib/module/welcome/Welcome.js.map +1 -0
  51. package/lib/module/welcome/index.md +95 -0
  52. package/lib/typescript/commonjs/bubble/Bubble.d.ts +29 -0
  53. package/lib/typescript/commonjs/bubble/Bubble.d.ts.map +1 -0
  54. package/lib/typescript/commonjs/bubble/BubbleList.d.ts +20 -0
  55. package/lib/typescript/commonjs/bubble/BubbleList.d.ts.map +1 -0
  56. package/lib/typescript/commonjs/card-wrapper/CardWrapper.d.ts +22 -0
  57. package/lib/typescript/commonjs/card-wrapper/CardWrapper.d.ts.map +1 -0
  58. package/lib/typescript/commonjs/conversations/Conversations.d.ts +37 -0
  59. package/lib/typescript/commonjs/conversations/Conversations.d.ts.map +1 -0
  60. package/lib/typescript/commonjs/index.d.ts +20 -0
  61. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  62. package/lib/typescript/commonjs/package.json +1 -0
  63. package/lib/typescript/commonjs/prompts/Prompts.d.ts +27 -0
  64. package/lib/typescript/commonjs/prompts/Prompts.d.ts.map +1 -0
  65. package/lib/typescript/commonjs/sender/Sender.d.ts +58 -0
  66. package/lib/typescript/commonjs/sender/Sender.d.ts.map +1 -0
  67. package/lib/typescript/commonjs/theme/tokens.d.ts +52 -0
  68. package/lib/typescript/commonjs/theme/tokens.d.ts.map +1 -0
  69. package/lib/typescript/commonjs/welcome/Welcome.d.ts +39 -0
  70. package/lib/typescript/commonjs/welcome/Welcome.d.ts.map +1 -0
  71. package/lib/typescript/module/bubble/Bubble.d.ts +29 -0
  72. package/lib/typescript/module/bubble/Bubble.d.ts.map +1 -0
  73. package/lib/typescript/module/bubble/BubbleList.d.ts +20 -0
  74. package/lib/typescript/module/bubble/BubbleList.d.ts.map +1 -0
  75. package/lib/typescript/module/card-wrapper/CardWrapper.d.ts +22 -0
  76. package/lib/typescript/module/card-wrapper/CardWrapper.d.ts.map +1 -0
  77. package/lib/typescript/module/conversations/Conversations.d.ts +37 -0
  78. package/lib/typescript/module/conversations/Conversations.d.ts.map +1 -0
  79. package/lib/typescript/module/index.d.ts +20 -0
  80. package/lib/typescript/module/index.d.ts.map +1 -0
  81. package/lib/typescript/module/package.json +1 -0
  82. package/lib/typescript/module/prompts/Prompts.d.ts +27 -0
  83. package/lib/typescript/module/prompts/Prompts.d.ts.map +1 -0
  84. package/lib/typescript/module/sender/Sender.d.ts +58 -0
  85. package/lib/typescript/module/sender/Sender.d.ts.map +1 -0
  86. package/lib/typescript/module/theme/tokens.d.ts +52 -0
  87. package/lib/typescript/module/theme/tokens.d.ts.map +1 -0
  88. package/lib/typescript/module/welcome/Welcome.d.ts +39 -0
  89. package/lib/typescript/module/welcome/Welcome.d.ts.map +1 -0
  90. package/package.json +39 -8
  91. package/src/sender/Sender.tsx +2 -0
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Bubble.List — 消息列表
3
+ * 封装 inverted FlatList,自动滚动到底部
4
+ */
5
+ import React from 'react';
6
+ import { type ViewStyle } from 'react-native';
7
+ export interface BubbleListProps<T = unknown> {
8
+ items: T[];
9
+ renderBubble: (item: T) => React.ReactNode;
10
+ keyExtractor?: (item: T) => string;
11
+ onEndReached?: () => void;
12
+ header?: React.ReactNode;
13
+ footer?: React.ReactNode;
14
+ style?: ViewStyle;
15
+ testID?: string;
16
+ }
17
+ declare function BubbleListInner<T>(props: BubbleListProps<T>): import("react/jsx-runtime").JSX.Element;
18
+ declare const BubbleList: typeof BubbleListInner;
19
+ export default BubbleList;
20
+ //# sourceMappingURL=BubbleList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BubbleList.d.ts","sourceRoot":"","sources":["../../../../src/bubble/BubbleList.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAA6B,KAAK,SAAS,EAAC,MAAM,cAAc,CAAC;AAExE,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO;IAC1C,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IAC3C,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,iBAAS,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,2CAiDpD;AAcD,QAAA,MAAM,UAAU,EAAkC,OAAO,eAAe,CAAC;AACzE,eAAe,UAAU,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * CardWrapper — 通用卡片路由容器
3
+ * registry 通过 props 注入(而非全局 import),更灵活
4
+ */
5
+ import React from 'react';
6
+ import { type ViewStyle } from 'react-native';
7
+ export type CardComponentType = React.ComponentType<{
8
+ data: Record<string, unknown>;
9
+ actions: string[];
10
+ }>;
11
+ export interface CardWrapperProps {
12
+ cardType: string;
13
+ data: Record<string, unknown>;
14
+ actions: string[];
15
+ registry?: Record<string, CardComponentType>;
16
+ fallback?: React.ReactNode;
17
+ style?: ViewStyle;
18
+ testID?: string;
19
+ }
20
+ declare const _default: React.NamedExoticComponent<CardWrapperProps>;
21
+ export default _default;
22
+ //# sourceMappingURL=CardWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CardWrapper.d.ts","sourceRoot":"","sources":["../../../../src/card-wrapper/CardWrapper.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAyB,KAAK,SAAS,EAAC,MAAM,cAAc,CAAC;AAGpE,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAC;IAClD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC7C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;AAqDD,wBAAuC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Conversations — 会话列表
3
+ *
4
+ * SectionList + 日期分组(今天/昨天/更早)
5
+ * 基于 ListItem 模式渲染
6
+ */
7
+ import React from 'react';
8
+ import { type ViewStyle, type TextStyle } from 'react-native';
9
+ export interface ConversationItem {
10
+ id: string;
11
+ title: string;
12
+ lastMessage?: string;
13
+ timestamp: number;
14
+ messageCount?: number;
15
+ }
16
+ export interface ConversationsSemanticStyles {
17
+ root?: ViewStyle;
18
+ newButton?: ViewStyle;
19
+ sectionHeader?: TextStyle;
20
+ item?: ViewStyle;
21
+ itemActive?: ViewStyle;
22
+ }
23
+ export interface ConversationsProps {
24
+ items: ConversationItem[];
25
+ activeId?: string;
26
+ onSelect: (id: string) => void;
27
+ onDelete?: (id: string) => void;
28
+ onNew?: () => void;
29
+ groupByDate?: boolean;
30
+ header?: React.ReactNode;
31
+ style?: ViewStyle;
32
+ styles?: Partial<ConversationsSemanticStyles>;
33
+ testID?: string;
34
+ }
35
+ declare const _default: React.NamedExoticComponent<ConversationsProps>;
36
+ export default _default;
37
+ //# sourceMappingURL=Conversations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Conversations.d.ts","sourceRoot":"","sources":["../../../../src/conversations/Conversations.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAA6B,MAAM,OAAO,CAAC;AAClD,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;AA4LD,wBAAyC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @unif/react-native-chat
3
+ * AI 聊天 UI 组件库 — Bubble、Sender、Conversations、Prompts、Welcome、CardWrapper
4
+ */
5
+ export { default as Bubble } from './bubble/Bubble';
6
+ export type { BubbleProps, BubbleSemanticStyles } from './bubble/Bubble';
7
+ export { default as BubbleList } from './bubble/BubbleList';
8
+ export type { BubbleListProps } from './bubble/BubbleList';
9
+ export { default as Sender } from './sender/Sender';
10
+ export type { SenderProps, SenderSemanticStyles, ActionSheetOption } from './sender/Sender';
11
+ export { default as Conversations } from './conversations/Conversations';
12
+ export type { ConversationsProps, ConversationsSemanticStyles, ConversationItem, } from './conversations/Conversations';
13
+ export { default as Prompts } from './prompts/Prompts';
14
+ export type { PromptsProps, PromptsSemanticStyles, PromptItem } from './prompts/Prompts';
15
+ export { default as Welcome } from './welcome/Welcome';
16
+ export type { WelcomeProps, WelcomeSemanticStyles, WelcomeQuickStart, } from './welcome/Welcome';
17
+ export { default as CardWrapper } from './card-wrapper/CardWrapper';
18
+ export type { CardWrapperProps, CardComponentType } from './card-wrapper/CardWrapper';
19
+ export { chatTokens } from './theme/tokens';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAC,WAAW,EAAE,oBAAoB,EAAC,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAC,WAAW,EAAE,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAG1F,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,+BAA+B,CAAC;AACvE,YAAY,EACV,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAC,OAAO,IAAI,OAAO,EAAC,MAAM,mBAAmB,CAAC;AACrD,YAAY,EAAC,YAAY,EAAE,qBAAqB,EAAE,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAGvF,OAAO,EAAC,OAAO,IAAI,OAAO,EAAC,MAAM,mBAAmB,CAAC;AACrD,YAAY,EACV,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,4BAA4B,CAAC;AAClE,YAAY,EAAC,gBAAgB,EAAE,iBAAiB,EAAC,MAAM,4BAA4B,CAAC;AAGpF,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Prompts — 建议提示
3
+ * 水平 ScrollView + Chip 列表
4
+ */
5
+ import React from 'react';
6
+ import { type ViewStyle, type TextStyle } from 'react-native';
7
+ export interface PromptItem {
8
+ id: string;
9
+ label: string;
10
+ }
11
+ export interface PromptsSemanticStyles {
12
+ root?: ViewStyle;
13
+ chip?: ViewStyle;
14
+ chipText?: TextStyle;
15
+ }
16
+ export interface PromptsProps {
17
+ items: PromptItem[];
18
+ onSelect: (item: PromptItem) => void;
19
+ disabled?: boolean;
20
+ wrap?: boolean;
21
+ style?: ViewStyle;
22
+ styles?: Partial<PromptsSemanticStyles>;
23
+ testID?: string;
24
+ }
25
+ declare const _default: React.NamedExoticComponent<PromptsProps>;
26
+ export default _default;
27
+ //# sourceMappingURL=Prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Prompts.d.ts","sourceRoot":"","sources":["../../../../src/prompts/Prompts.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAML,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;AAsFD,wBAAmC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Sender — 输入发送器
3
+ *
4
+ * 完整状态机:collapsed → expanded → recording
5
+ * 基于 UI 库 Input + ActionSheet + WaveAnimation + Button 构建
6
+ */
7
+ import React from 'react';
8
+ import { type ViewStyle } from 'react-native';
9
+ export interface ActionSheetOption {
10
+ key: string;
11
+ label: string;
12
+ icon?: React.ReactNode;
13
+ }
14
+ export interface SenderSemanticStyles {
15
+ root?: ViewStyle;
16
+ collapsed?: ViewStyle;
17
+ expanded?: ViewStyle;
18
+ recording?: ViewStyle;
19
+ toolbar?: ViewStyle;
20
+ }
21
+ export interface SenderProps {
22
+ onSend: (text: string) => void;
23
+ onStop?: () => void;
24
+ onVoiceSend?: (audioUri: string) => void;
25
+ isRequesting?: boolean;
26
+ placeholder?: string;
27
+ maxLength?: number;
28
+ voiceEnabled?: boolean;
29
+ actionsEnabled?: boolean;
30
+ actions?: ActionSheetOption[];
31
+ onActionSelect?: (key: string) => void;
32
+ disabled?: boolean;
33
+ style?: ViewStyle;
34
+ styles?: Partial<SenderSemanticStyles>;
35
+ testID?: string;
36
+ renderInput?: (props: {
37
+ value: string;
38
+ onChangeText: (text: string) => void;
39
+ onSubmitEditing: () => void;
40
+ onBlur: () => void;
41
+ toolbar: React.ReactNode;
42
+ autoFocus: boolean;
43
+ maxLength: number;
44
+ }) => React.ReactNode;
45
+ renderActionSheet?: (props: {
46
+ visible: boolean;
47
+ onClose: () => void;
48
+ options: ActionSheetOption[];
49
+ onSelect: (key: string) => void;
50
+ }) => React.ReactNode;
51
+ renderWaveAnimation?: (props: {
52
+ active: boolean;
53
+ color: string;
54
+ }) => React.ReactNode;
55
+ }
56
+ declare const _default: React.NamedExoticComponent<SenderProps>;
57
+ export default _default;
58
+ //# sourceMappingURL=Sender.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sender.d.ts","sourceRoot":"","sources":["../../../../src/sender/Sender.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAA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ACtB,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC1B,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,MAAM,IAAI,CAAC;QACpB,OAAO,EAAE,iBAAiB,EAAE,CAAC;QAC7B,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;KACjC,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC5B,MAAM,EAAE,OAAO,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,KAAK,CAAC,SAAS,CAAC;CACvB;;AAgXD,wBAAkC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Chat 专属 Design Tokens
3
+ * 仅定义 Chat 特有的 token,通用 token 从 @unif/react-native-ui 引用
4
+ */
5
+ export declare const chatTokens: {
6
+ colorBgUserMsg: string;
7
+ colorBgAssistantMsg: string;
8
+ colorBgWelcomeStart: string;
9
+ colorBgWelcomeMid: string;
10
+ colorBgWelcomeEnd: string;
11
+ colorRecording: string;
12
+ colorPrimary: string;
13
+ colorError: string;
14
+ colorText: string;
15
+ colorTextSecondary: string;
16
+ colorTextPlaceholder: string;
17
+ colorBgElevated: string;
18
+ colorBorder: string;
19
+ colorLink: string;
20
+ spaceXs: number;
21
+ spaceSm: number;
22
+ space: number;
23
+ spaceMd: number;
24
+ fontSize: number;
25
+ fontSizeSm: number;
26
+ lineHeight: number;
27
+ radiusSm: number;
28
+ radiusMd: number;
29
+ radiusXl: number;
30
+ radiusFull: number;
31
+ shadow: {
32
+ shadowColor: string;
33
+ shadowOffset: {
34
+ width: number;
35
+ height: number;
36
+ };
37
+ shadowOpacity: number;
38
+ shadowRadius: number;
39
+ elevation: number;
40
+ };
41
+ shadowSm: {
42
+ shadowColor: string;
43
+ shadowOffset: {
44
+ width: number;
45
+ height: number;
46
+ };
47
+ shadowOpacity: number;
48
+ shadowRadius: number;
49
+ elevation: number;
50
+ };
51
+ };
52
+ //# sourceMappingURL=tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../../src/theme/tokens.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDtB,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Welcome — 欢迎页
3
+ * 渐变背景 + 装饰性光晕 + 2x2 快捷入口卡片网格
4
+ */
5
+ import React from 'react';
6
+ import { type ViewStyle, type TextStyle } from 'react-native';
7
+ export interface WelcomeQuickStart {
8
+ key: string;
9
+ icon: string;
10
+ title: string;
11
+ description: string;
12
+ }
13
+ export interface WelcomeSemanticStyles {
14
+ root?: ViewStyle;
15
+ title?: TextStyle;
16
+ subtitle?: TextStyle;
17
+ card?: ViewStyle;
18
+ cardTitle?: TextStyle;
19
+ cardDescription?: TextStyle;
20
+ }
21
+ export interface WelcomeProps {
22
+ title?: string;
23
+ subtitle?: string;
24
+ quickStarts?: WelcomeQuickStart[];
25
+ onQuickStart?: (key: string) => void;
26
+ gradientColors?: string[];
27
+ style?: ViewStyle;
28
+ styles?: Partial<WelcomeSemanticStyles>;
29
+ testID?: string;
30
+ renderIcon?: (name: string, size: number, color: string) => React.ReactNode;
31
+ renderGradient?: (props: {
32
+ colors: string[];
33
+ children: React.ReactNode;
34
+ style: ViewStyle;
35
+ }) => React.ReactNode;
36
+ }
37
+ declare const _default: React.NamedExoticComponent<WelcomeProps>;
38
+ export default _default;
39
+ //# sourceMappingURL=Welcome.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Welcome.d.ts","sourceRoot":"","sources":["../../../../src/welcome/Welcome.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAA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"description": "UNIF React Native Chat — AI 聊天 UI 组件(Bubble、Sender、Conversations 等)",
5
- "main": "./src/index.tsx",
6
- "types": "./src/index.tsx",
5
+ "main": "./lib/commonjs/index.js",
6
+ "module": "./lib/module/index.js",
7
+ "types": "./lib/typescript/commonjs/index.d.ts",
8
+ "react-native": "./src/index.tsx",
9
+ "source": "./src/index.tsx",
7
10
  "exports": {
8
11
  ".": {
9
12
  "source": "./src/index.tsx",
10
- "types": "./src/index.tsx",
11
- "default": "./src/index.tsx"
13
+ "react-native": "./src/index.tsx",
14
+ "import": {
15
+ "types": "./lib/typescript/module/index.d.ts",
16
+ "default": "./lib/module/index.js"
17
+ },
18
+ "require": {
19
+ "types": "./lib/typescript/commonjs/index.d.ts",
20
+ "default": "./lib/commonjs/index.js"
21
+ }
12
22
  },
13
23
  "./package.json": "./package.json"
14
24
  },
@@ -22,14 +32,24 @@
22
32
  "scripts": {
23
33
  "build": "bob build",
24
34
  "clean": "del-cli lib",
35
+ "prepublishOnly": "bob build",
25
36
  "typecheck": "tsc"
26
37
  },
27
- "keywords": ["react-native", "chat", "ui", "bubble", "sender"],
38
+ "keywords": [
39
+ "react-native",
40
+ "chat",
41
+ "ui",
42
+ "bubble",
43
+ "sender"
44
+ ],
28
45
  "author": "qq382724935 <liulijun@pec.com.cn>",
29
46
  "license": "MIT",
30
47
  "publishConfig": {
31
48
  "registry": "https://registry.npmjs.org/"
32
49
  },
50
+ "devDependencies": {
51
+ "typescript": "^5.9.2"
52
+ },
33
53
  "peerDependencies": {
34
54
  "react": "*",
35
55
  "react-native": "*"
@@ -38,8 +58,19 @@
38
58
  "source": "src",
39
59
  "output": "lib",
40
60
  "targets": [
41
- ["module", { "esm": true }],
42
- ["typescript", { "project": "tsconfig.build.json" }]
61
+ "commonjs",
62
+ [
63
+ "module",
64
+ {
65
+ "esm": true
66
+ }
67
+ ],
68
+ [
69
+ "typescript",
70
+ {
71
+ "project": "tsconfig.build.json"
72
+ }
73
+ ]
43
74
  ]
44
75
  }
45
76
  }
@@ -54,6 +54,7 @@ export interface SenderProps {
54
54
  onBlur: () => void;
55
55
  toolbar: React.ReactNode;
56
56
  autoFocus: boolean;
57
+ maxLength: number;
57
58
  }) => React.ReactNode;
58
59
  renderActionSheet?: (props: {
59
60
  visible: boolean;
@@ -239,6 +240,7 @@ const Sender: React.FC<SenderProps> = ({
239
240
  onBlur: handleCollapse,
240
241
  toolbar,
241
242
  autoFocus: true,
243
+ maxLength,
242
244
  })
243
245
  ) : (
244
246
  <View style={defaultStyles.expandedFallback}>