@unif/react-native-chat 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +48 -0
- package/lib/module/actions/index.js +2 -0
- package/lib/module/actions/index.js.map +1 -0
- package/lib/module/actions/types.js +4 -0
- package/lib/module/actions/types.js.map +1 -0
- package/lib/module/components/Attachments/AttachmentItem.js +108 -0
- package/lib/module/components/Attachments/AttachmentItem.js.map +1 -0
- package/lib/module/components/Attachments/Attachments.js +60 -0
- package/lib/module/components/Attachments/Attachments.js.map +1 -0
- package/lib/module/components/Attachments/constants.js +18 -0
- package/lib/module/components/Attachments/constants.js.map +1 -0
- package/lib/module/components/Attachments/index.js +4 -0
- package/lib/module/components/Attachments/index.js.map +1 -0
- package/lib/module/components/Attachments/styles.js +83 -0
- package/lib/module/components/Attachments/styles.js.map +1 -0
- package/lib/module/components/Attachments/types.js +4 -0
- package/lib/module/components/Attachments/types.js.map +1 -0
- package/lib/module/components/Chat/Chat.js +29 -0
- package/lib/module/components/Chat/Chat.js.map +1 -0
- package/lib/module/components/Chat/index.js +4 -0
- package/lib/module/components/Chat/index.js.map +1 -0
- package/lib/module/components/Chat/styles.js +17 -0
- package/lib/module/components/Chat/styles.js.map +1 -0
- package/lib/module/components/Chat/types.js +4 -0
- package/lib/module/components/Chat/types.js.map +1 -0
- package/lib/module/components/Citation/Citation.js +32 -0
- package/lib/module/components/Citation/Citation.js.map +1 -0
- package/lib/module/components/Citation/index.js +4 -0
- package/lib/module/components/Citation/index.js.map +1 -0
- package/lib/module/components/Citation/styles.js +15 -0
- package/lib/module/components/Citation/styles.js.map +1 -0
- package/lib/module/components/Citation/types.js +2 -0
- package/lib/module/components/Citation/types.js.map +1 -0
- package/lib/module/components/Composer/Composer.js +149 -0
- package/lib/module/components/Composer/Composer.js.map +1 -0
- package/lib/module/components/Composer/constants.js +14 -0
- package/lib/module/components/Composer/constants.js.map +1 -0
- package/lib/module/components/Composer/index.js +4 -0
- package/lib/module/components/Composer/index.js.map +1 -0
- package/lib/module/components/Composer/styles.js +43 -0
- package/lib/module/components/Composer/styles.js.map +1 -0
- package/lib/module/components/Composer/types.js +4 -0
- package/lib/module/components/Composer/types.js.map +1 -0
- package/lib/module/components/Confirmation/Confirmation.js +56 -0
- package/lib/module/components/Confirmation/Confirmation.js.map +1 -0
- package/lib/module/components/Confirmation/constants.js +10 -0
- package/lib/module/components/Confirmation/constants.js.map +1 -0
- package/lib/module/components/Confirmation/index.js +4 -0
- package/lib/module/components/Confirmation/index.js.map +1 -0
- package/lib/module/components/Confirmation/styles.js +34 -0
- package/lib/module/components/Confirmation/styles.js.map +1 -0
- package/lib/module/components/Confirmation/types.js +4 -0
- package/lib/module/components/Confirmation/types.js.map +1 -0
- package/lib/module/components/Feedback/Feedback.js +82 -0
- package/lib/module/components/Feedback/Feedback.js.map +1 -0
- package/lib/module/components/Feedback/constants.js +15 -0
- package/lib/module/components/Feedback/constants.js.map +1 -0
- package/lib/module/components/Feedback/index.js +4 -0
- package/lib/module/components/Feedback/index.js.map +1 -0
- package/lib/module/components/Feedback/styles.js +30 -0
- package/lib/module/components/Feedback/styles.js.map +1 -0
- package/lib/module/components/Feedback/types.js +4 -0
- package/lib/module/components/Feedback/types.js.map +1 -0
- package/lib/module/components/Message/MarkdownContent/MarkdownContent.js +68 -0
- package/lib/module/components/Message/MarkdownContent/MarkdownContent.js.map +1 -0
- package/lib/module/components/Message/MarkdownContent/MarkdownImage/MarkdownImage.js +53 -0
- package/lib/module/components/Message/MarkdownContent/MarkdownImage/MarkdownImage.js.map +1 -0
- package/lib/module/components/Message/MarkdownContent/MarkdownImage/styles.js +10 -0
- package/lib/module/components/Message/MarkdownContent/MarkdownImage/styles.js.map +1 -0
- package/lib/module/components/Message/MarkdownContent/MarkdownImage/types.js +2 -0
- package/lib/module/components/Message/MarkdownContent/MarkdownImage/types.js.map +1 -0
- package/lib/module/components/Message/MarkdownContent/styles.js +85 -0
- package/lib/module/components/Message/MarkdownContent/styles.js.map +1 -0
- package/lib/module/components/Message/MarkdownContent/types.js +2 -0
- package/lib/module/components/Message/MarkdownContent/types.js.map +1 -0
- package/lib/module/components/Message/Message.js +87 -0
- package/lib/module/components/Message/Message.js.map +1 -0
- package/lib/module/components/Message/constants.js +4 -0
- package/lib/module/components/Message/constants.js.map +1 -0
- package/lib/module/components/Message/index.js +4 -0
- package/lib/module/components/Message/index.js.map +1 -0
- package/lib/module/components/Message/isNestedAction.js +14 -0
- package/lib/module/components/Message/isNestedAction.js.map +1 -0
- package/lib/module/components/Message/styles.js +73 -0
- package/lib/module/components/Message/styles.js.map +1 -0
- package/lib/module/components/Message/types.js +4 -0
- package/lib/module/components/Message/types.js.map +1 -0
- package/lib/module/components/MessageList/MessageList.js +223 -0
- package/lib/module/components/MessageList/MessageList.js.map +1 -0
- package/lib/module/components/MessageList/constants.js +4 -0
- package/lib/module/components/MessageList/constants.js.map +1 -0
- package/lib/module/components/MessageList/index.js +4 -0
- package/lib/module/components/MessageList/index.js.map +1 -0
- package/lib/module/components/MessageList/styles.js +20 -0
- package/lib/module/components/MessageList/styles.js.map +1 -0
- package/lib/module/components/MessageList/types.js +4 -0
- package/lib/module/components/MessageList/types.js.map +1 -0
- package/lib/module/components/MessageList/webPrependAnchor/constants.js +4 -0
- package/lib/module/components/MessageList/webPrependAnchor/constants.js.map +1 -0
- package/lib/module/components/MessageList/webPrependAnchor/index.js +4 -0
- package/lib/module/components/MessageList/webPrependAnchor/index.js.map +1 -0
- package/lib/module/components/MessageList/webPrependAnchor/types.js +4 -0
- package/lib/module/components/MessageList/webPrependAnchor/types.js.map +1 -0
- package/lib/module/components/MessageList/webPrependAnchor/useWebPrependAnchor.js +19 -0
- package/lib/module/components/MessageList/webPrependAnchor/useWebPrependAnchor.js.map +1 -0
- package/lib/module/components/MessageList/webPrependAnchor/useWebPrependAnchor.web.js +208 -0
- package/lib/module/components/MessageList/webPrependAnchor/useWebPrependAnchor.web.js.map +1 -0
- package/lib/module/components/Process/Process.js +121 -0
- package/lib/module/components/Process/Process.js.map +1 -0
- package/lib/module/components/Process/constants.js +17 -0
- package/lib/module/components/Process/constants.js.map +1 -0
- package/lib/module/components/Process/index.js +4 -0
- package/lib/module/components/Process/index.js.map +1 -0
- package/lib/module/components/Process/styles.js +77 -0
- package/lib/module/components/Process/styles.js.map +1 -0
- package/lib/module/components/Process/types.js +4 -0
- package/lib/module/components/Process/types.js.map +1 -0
- package/lib/module/components/Sources/Sources.js +64 -0
- package/lib/module/components/Sources/Sources.js.map +1 -0
- package/lib/module/components/Sources/constants.js +4 -0
- package/lib/module/components/Sources/constants.js.map +1 -0
- package/lib/module/components/Sources/index.js +4 -0
- package/lib/module/components/Sources/index.js.map +1 -0
- package/lib/module/components/Sources/styles.js +52 -0
- package/lib/module/components/Sources/styles.js.map +1 -0
- package/lib/module/components/Sources/types.js +4 -0
- package/lib/module/components/Sources/types.js.map +1 -0
- package/lib/module/components/Suggestions/Suggestions.js +31 -0
- package/lib/module/components/Suggestions/Suggestions.js.map +1 -0
- package/lib/module/components/Suggestions/index.js +4 -0
- package/lib/module/components/Suggestions/index.js.map +1 -0
- package/lib/module/components/Suggestions/styles.js +18 -0
- package/lib/module/components/Suggestions/styles.js.map +1 -0
- package/lib/module/components/Suggestions/types.js +4 -0
- package/lib/module/components/Suggestions/types.js.map +1 -0
- package/lib/module/index.js +14 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/actions/index.d.ts +2 -0
- package/lib/typescript/src/actions/index.d.ts.map +1 -0
- package/lib/typescript/src/actions/types.d.ts +11 -0
- package/lib/typescript/src/actions/types.d.ts.map +1 -0
- package/lib/typescript/src/components/Attachments/AttachmentItem.d.ts +3 -0
- package/lib/typescript/src/components/Attachments/AttachmentItem.d.ts.map +1 -0
- package/lib/typescript/src/components/Attachments/Attachments.d.ts +3 -0
- package/lib/typescript/src/components/Attachments/Attachments.d.ts.map +1 -0
- package/lib/typescript/src/components/Attachments/constants.d.ts +13 -0
- package/lib/typescript/src/components/Attachments/constants.d.ts.map +1 -0
- package/lib/typescript/src/components/Attachments/index.d.ts +3 -0
- package/lib/typescript/src/components/Attachments/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Attachments/styles.d.ts +80 -0
- package/lib/typescript/src/components/Attachments/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Attachments/types.d.ts +34 -0
- package/lib/typescript/src/components/Attachments/types.d.ts.map +1 -0
- package/lib/typescript/src/components/Chat/Chat.d.ts +3 -0
- package/lib/typescript/src/components/Chat/Chat.d.ts.map +1 -0
- package/lib/typescript/src/components/Chat/index.d.ts +3 -0
- package/lib/typescript/src/components/Chat/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Chat/styles.d.ts +15 -0
- package/lib/typescript/src/components/Chat/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Chat/types.d.ts +12 -0
- package/lib/typescript/src/components/Chat/types.d.ts.map +1 -0
- package/lib/typescript/src/components/Citation/Citation.d.ts +3 -0
- package/lib/typescript/src/components/Citation/Citation.d.ts.map +1 -0
- package/lib/typescript/src/components/Citation/index.d.ts +3 -0
- package/lib/typescript/src/components/Citation/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Citation/styles.d.ts +12 -0
- package/lib/typescript/src/components/Citation/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Citation/types.d.ts +8 -0
- package/lib/typescript/src/components/Citation/types.d.ts.map +1 -0
- package/lib/typescript/src/components/Composer/Composer.d.ts +4 -0
- package/lib/typescript/src/components/Composer/Composer.d.ts.map +1 -0
- package/lib/typescript/src/components/Composer/constants.d.ts +12 -0
- package/lib/typescript/src/components/Composer/constants.d.ts.map +1 -0
- package/lib/typescript/src/components/Composer/index.d.ts +3 -0
- package/lib/typescript/src/components/Composer/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Composer/styles.d.ts +40 -0
- package/lib/typescript/src/components/Composer/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Composer/types.d.ts +53 -0
- package/lib/typescript/src/components/Composer/types.d.ts.map +1 -0
- package/lib/typescript/src/components/Confirmation/Confirmation.d.ts +3 -0
- package/lib/typescript/src/components/Confirmation/Confirmation.d.ts.map +1 -0
- package/lib/typescript/src/components/Confirmation/constants.d.ts +5 -0
- package/lib/typescript/src/components/Confirmation/constants.d.ts.map +1 -0
- package/lib/typescript/src/components/Confirmation/index.d.ts +3 -0
- package/lib/typescript/src/components/Confirmation/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Confirmation/styles.d.ts +31 -0
- package/lib/typescript/src/components/Confirmation/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Confirmation/types.d.ts +19 -0
- package/lib/typescript/src/components/Confirmation/types.d.ts.map +1 -0
- package/lib/typescript/src/components/Feedback/Feedback.d.ts +3 -0
- package/lib/typescript/src/components/Feedback/Feedback.d.ts.map +1 -0
- package/lib/typescript/src/components/Feedback/constants.d.ts +5 -0
- package/lib/typescript/src/components/Feedback/constants.d.ts.map +1 -0
- package/lib/typescript/src/components/Feedback/index.d.ts +3 -0
- package/lib/typescript/src/components/Feedback/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Feedback/styles.d.ts +27 -0
- package/lib/typescript/src/components/Feedback/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Feedback/types.d.ts +12 -0
- package/lib/typescript/src/components/Feedback/types.d.ts.map +1 -0
- package/lib/typescript/src/components/Message/MarkdownContent/MarkdownContent.d.ts +3 -0
- package/lib/typescript/src/components/Message/MarkdownContent/MarkdownContent.d.ts.map +1 -0
- package/lib/typescript/src/components/Message/MarkdownContent/MarkdownImage/MarkdownImage.d.ts +3 -0
- package/lib/typescript/src/components/Message/MarkdownContent/MarkdownImage/MarkdownImage.d.ts.map +1 -0
- package/lib/typescript/src/components/Message/MarkdownContent/MarkdownImage/styles.d.ts +7 -0
- package/lib/typescript/src/components/Message/MarkdownContent/MarkdownImage/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Message/MarkdownContent/MarkdownImage/types.d.ts +9 -0
- package/lib/typescript/src/components/Message/MarkdownContent/MarkdownImage/types.d.ts.map +1 -0
- package/lib/typescript/src/components/Message/MarkdownContent/styles.d.ts +92 -0
- package/lib/typescript/src/components/Message/MarkdownContent/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Message/MarkdownContent/types.d.ts +5 -0
- package/lib/typescript/src/components/Message/MarkdownContent/types.d.ts.map +1 -0
- package/lib/typescript/src/components/Message/Message.d.ts +3 -0
- package/lib/typescript/src/components/Message/Message.d.ts.map +1 -0
- package/lib/typescript/src/components/Message/constants.d.ts +2 -0
- package/lib/typescript/src/components/Message/constants.d.ts.map +1 -0
- package/lib/typescript/src/components/Message/index.d.ts +3 -0
- package/lib/typescript/src/components/Message/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Message/isNestedAction.d.ts +3 -0
- package/lib/typescript/src/components/Message/isNestedAction.d.ts.map +1 -0
- package/lib/typescript/src/components/Message/styles.d.ts +70 -0
- package/lib/typescript/src/components/Message/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Message/types.d.ts +44 -0
- package/lib/typescript/src/components/Message/types.d.ts.map +1 -0
- package/lib/typescript/src/components/MessageList/MessageList.d.ts +4 -0
- package/lib/typescript/src/components/MessageList/MessageList.d.ts.map +1 -0
- package/lib/typescript/src/components/MessageList/constants.d.ts +2 -0
- package/lib/typescript/src/components/MessageList/constants.d.ts.map +1 -0
- package/lib/typescript/src/components/MessageList/index.d.ts +3 -0
- package/lib/typescript/src/components/MessageList/index.d.ts.map +1 -0
- package/lib/typescript/src/components/MessageList/styles.d.ts +16 -0
- package/lib/typescript/src/components/MessageList/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/MessageList/types.d.ts +36 -0
- package/lib/typescript/src/components/MessageList/types.d.ts.map +1 -0
- package/lib/typescript/src/components/MessageList/webPrependAnchor/constants.d.ts +2 -0
- package/lib/typescript/src/components/MessageList/webPrependAnchor/constants.d.ts.map +1 -0
- package/lib/typescript/src/components/MessageList/webPrependAnchor/index.d.ts +3 -0
- package/lib/typescript/src/components/MessageList/webPrependAnchor/index.d.ts.map +1 -0
- package/lib/typescript/src/components/MessageList/webPrependAnchor/types.d.ts +72 -0
- package/lib/typescript/src/components/MessageList/webPrependAnchor/types.d.ts.map +1 -0
- package/lib/typescript/src/components/MessageList/webPrependAnchor/useWebPrependAnchor.d.ts +3 -0
- package/lib/typescript/src/components/MessageList/webPrependAnchor/useWebPrependAnchor.d.ts.map +1 -0
- package/lib/typescript/src/components/MessageList/webPrependAnchor/useWebPrependAnchor.web.d.ts +3 -0
- package/lib/typescript/src/components/MessageList/webPrependAnchor/useWebPrependAnchor.web.d.ts.map +1 -0
- package/lib/typescript/src/components/Process/Process.d.ts +3 -0
- package/lib/typescript/src/components/Process/Process.d.ts.map +1 -0
- package/lib/typescript/src/components/Process/constants.d.ts +5 -0
- package/lib/typescript/src/components/Process/constants.d.ts.map +1 -0
- package/lib/typescript/src/components/Process/index.d.ts +3 -0
- package/lib/typescript/src/components/Process/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Process/styles.d.ts +74 -0
- package/lib/typescript/src/components/Process/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Process/types.d.ts +32 -0
- package/lib/typescript/src/components/Process/types.d.ts.map +1 -0
- package/lib/typescript/src/components/Sources/Sources.d.ts +3 -0
- package/lib/typescript/src/components/Sources/Sources.d.ts.map +1 -0
- package/lib/typescript/src/components/Sources/constants.d.ts +2 -0
- package/lib/typescript/src/components/Sources/constants.d.ts.map +1 -0
- package/lib/typescript/src/components/Sources/index.d.ts +3 -0
- package/lib/typescript/src/components/Sources/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Sources/styles.d.ts +49 -0
- package/lib/typescript/src/components/Sources/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Sources/types.d.ts +16 -0
- package/lib/typescript/src/components/Sources/types.d.ts.map +1 -0
- package/lib/typescript/src/components/Suggestions/Suggestions.d.ts +3 -0
- package/lib/typescript/src/components/Suggestions/Suggestions.d.ts.map +1 -0
- package/lib/typescript/src/components/Suggestions/index.d.ts +3 -0
- package/lib/typescript/src/components/Suggestions/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Suggestions/styles.d.ts +14 -0
- package/lib/typescript/src/components/Suggestions/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Suggestions/types.d.ts +18 -0
- package/lib/typescript/src/components/Suggestions/types.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +24 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +178 -0
- package/src/actions/index.ts +1 -0
- package/src/actions/types.ts +11 -0
- package/src/components/Attachments/AttachmentItem.tsx +139 -0
- package/src/components/Attachments/Attachments.tsx +72 -0
- package/src/components/Attachments/constants.ts +21 -0
- package/src/components/Attachments/index.ts +6 -0
- package/src/components/Attachments/styles.ts +54 -0
- package/src/components/Attachments/types.ts +38 -0
- package/src/components/Chat/Chat.tsx +26 -0
- package/src/components/Chat/index.ts +2 -0
- package/src/components/Chat/styles.ts +12 -0
- package/src/components/Chat/types.ts +11 -0
- package/src/components/Citation/Citation.tsx +33 -0
- package/src/components/Citation/index.ts +2 -0
- package/src/components/Citation/styles.ts +15 -0
- package/src/components/Citation/types.ts +7 -0
- package/src/components/Composer/Composer.tsx +208 -0
- package/src/components/Composer/constants.ts +11 -0
- package/src/components/Composer/index.ts +11 -0
- package/src/components/Composer/styles.ts +25 -0
- package/src/components/Composer/types.ts +61 -0
- package/src/components/Confirmation/Confirmation.tsx +63 -0
- package/src/components/Confirmation/constants.ts +12 -0
- package/src/components/Confirmation/index.ts +2 -0
- package/src/components/Confirmation/styles.ts +39 -0
- package/src/components/Confirmation/types.ts +21 -0
- package/src/components/Feedback/Feedback.tsx +87 -0
- package/src/components/Feedback/constants.ts +16 -0
- package/src/components/Feedback/index.ts +2 -0
- package/src/components/Feedback/styles.ts +30 -0
- package/src/components/Feedback/types.ts +13 -0
- package/src/components/Message/MarkdownContent/MarkdownContent.tsx +70 -0
- package/src/components/Message/MarkdownContent/MarkdownImage/MarkdownImage.tsx +52 -0
- package/src/components/Message/MarkdownContent/MarkdownImage/styles.ts +4 -0
- package/src/components/Message/MarkdownContent/MarkdownImage/types.ts +8 -0
- package/src/components/Message/MarkdownContent/styles.ts +61 -0
- package/src/components/Message/MarkdownContent/types.ts +4 -0
- package/src/components/Message/Message.tsx +137 -0
- package/src/components/Message/constants.ts +2 -0
- package/src/components/Message/index.ts +10 -0
- package/src/components/Message/isNestedAction.ts +22 -0
- package/src/components/Message/styles.ts +42 -0
- package/src/components/Message/types.ts +45 -0
- package/src/components/MessageList/MessageList.tsx +238 -0
- package/src/components/MessageList/constants.ts +1 -0
- package/src/components/MessageList/index.ts +6 -0
- package/src/components/MessageList/styles.ts +7 -0
- package/src/components/MessageList/types.ts +36 -0
- package/src/components/MessageList/webPrependAnchor/constants.ts +6 -0
- package/src/components/MessageList/webPrependAnchor/index.ts +7 -0
- package/src/components/MessageList/webPrependAnchor/types.ts +92 -0
- package/src/components/MessageList/webPrependAnchor/useWebPrependAnchor.ts +27 -0
- package/src/components/MessageList/webPrependAnchor/useWebPrependAnchor.web.ts +293 -0
- package/src/components/Process/Process.tsx +160 -0
- package/src/components/Process/constants.ts +22 -0
- package/src/components/Process/index.ts +9 -0
- package/src/components/Process/styles.ts +77 -0
- package/src/components/Process/types.ts +39 -0
- package/src/components/Sources/Sources.tsx +70 -0
- package/src/components/Sources/constants.ts +1 -0
- package/src/components/Sources/index.ts +2 -0
- package/src/components/Sources/styles.ts +59 -0
- package/src/components/Sources/types.ts +17 -0
- package/src/components/Suggestions/Suggestions.tsx +34 -0
- package/src/components/Suggestions/index.ts +2 -0
- package/src/components/Suggestions/styles.ts +16 -0
- package/src/components/Suggestions/types.ts +19 -0
- package/src/index.tsx +61 -0
package/package.json
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@unif/react-native-chat",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "基于 Unif Design 的独立 React Native 聊天组件",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
6
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"unif-react-native-chat-source": "./src/index.tsx",
|
|
10
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"lib",
|
|
18
|
+
"!**/__tests__",
|
|
19
|
+
"!**/__fixtures__",
|
|
20
|
+
"!**/__mocks__",
|
|
21
|
+
"!**/*.test.*",
|
|
22
|
+
"!**/*.spec.*",
|
|
23
|
+
"!**/.*"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"example": "yarn workspace @unif/react-native-chat-example",
|
|
27
|
+
"clean": "del-cli example/android/build example/android/app/build example/ios/build lib",
|
|
28
|
+
"prepare": "bob build",
|
|
29
|
+
"typecheck": "tsc --noEmit",
|
|
30
|
+
"test": "jest",
|
|
31
|
+
"release": "release-it --only-version",
|
|
32
|
+
"web": "yarn example web",
|
|
33
|
+
"build:web": "yarn example build:web",
|
|
34
|
+
"lint": "eslint \"**/*.{js,jsx,mjs,ts,tsx}\"",
|
|
35
|
+
"format:check": "prettier --check ."
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"react-native",
|
|
39
|
+
"ios",
|
|
40
|
+
"android"
|
|
41
|
+
],
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/unif-design/react-native-chat.git"
|
|
45
|
+
},
|
|
46
|
+
"author": "unif-design <382724935@qq.com> (https://github.com/unif-design)",
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/unif-design/react-native-chat/issues"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/unif-design/react-native-chat#readme",
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"registry": "https://registry.npmjs.org/",
|
|
54
|
+
"access": "public"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@babel/core": "^7.29.7",
|
|
58
|
+
"@commitlint/config-conventional": "^21.2.0",
|
|
59
|
+
"@eslint/compat": "^2.1.0",
|
|
60
|
+
"@eslint/eslintrc": "^3.3.6",
|
|
61
|
+
"@eslint/js": "^9.39.5",
|
|
62
|
+
"@jest/globals": "^30.3.0",
|
|
63
|
+
"@react-native/babel-preset": "0.86.3",
|
|
64
|
+
"@react-native/eslint-config": "0.86.3",
|
|
65
|
+
"@react-native/jest-preset": "0.86.3",
|
|
66
|
+
"@react-native/metro-config": "0.86.3",
|
|
67
|
+
"@release-it/conventional-changelog": "^12.0.0",
|
|
68
|
+
"@sbaiahmed1/react-native-blur": "6.0.1",
|
|
69
|
+
"@testing-library/react-native": "13.3.3",
|
|
70
|
+
"@types/react": "^19.2.0",
|
|
71
|
+
"@unif/react-native-design": "0.32.0",
|
|
72
|
+
"commitlint": "^21.2.1",
|
|
73
|
+
"del-cli": "^7.0.0",
|
|
74
|
+
"eslint": "^9.39.5",
|
|
75
|
+
"eslint-config-prettier": "^10.1.8",
|
|
76
|
+
"eslint-plugin-ft-flow": "^3.0.11",
|
|
77
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
78
|
+
"hermes-eslint": "0.37.0",
|
|
79
|
+
"jest": "^30.3.0",
|
|
80
|
+
"lefthook": "^2.1.10",
|
|
81
|
+
"prettier": "^3.9.6",
|
|
82
|
+
"react": "19.2.3",
|
|
83
|
+
"react-dom": "19.2.3",
|
|
84
|
+
"react-native": "0.86.3",
|
|
85
|
+
"react-native-builder-bob": "^0.43.0",
|
|
86
|
+
"react-native-gesture-handler": "3.1.0",
|
|
87
|
+
"react-native-reanimated": "4.6.0",
|
|
88
|
+
"react-native-reanimated-carousel": "5.0.0",
|
|
89
|
+
"react-native-safe-area-context": "5.8.0",
|
|
90
|
+
"react-native-svg": "15.15.5",
|
|
91
|
+
"react-native-web": "~0.21.2",
|
|
92
|
+
"react-native-worklets": "0.12.1",
|
|
93
|
+
"react-test-renderer": "19.2.3",
|
|
94
|
+
"release-it": "^21.0.1",
|
|
95
|
+
"turbo": "^2.10.8",
|
|
96
|
+
"typescript": "^6.0.3"
|
|
97
|
+
},
|
|
98
|
+
"peerDependencies": {
|
|
99
|
+
"@unif/react-native-design": "^0.32.0",
|
|
100
|
+
"react": ">=19.2.3 <20.0.0",
|
|
101
|
+
"react-native": ">=0.86.0",
|
|
102
|
+
"react-native-svg": ">=15"
|
|
103
|
+
},
|
|
104
|
+
"workspaces": [
|
|
105
|
+
"example"
|
|
106
|
+
],
|
|
107
|
+
"packageManager": "yarn@4.11.0",
|
|
108
|
+
"react-native-builder-bob": {
|
|
109
|
+
"source": "src",
|
|
110
|
+
"output": "lib",
|
|
111
|
+
"targets": [
|
|
112
|
+
[
|
|
113
|
+
"module",
|
|
114
|
+
{
|
|
115
|
+
"esm": true
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
[
|
|
119
|
+
"typescript",
|
|
120
|
+
{
|
|
121
|
+
"project": "tsconfig.build.json"
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
"commitlint": {
|
|
127
|
+
"extends": [
|
|
128
|
+
"@commitlint/config-conventional"
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
"release-it": {
|
|
132
|
+
"git": {
|
|
133
|
+
"commitMessage": "chore: release ${version} [skip ci]",
|
|
134
|
+
"tagName": "v${version}",
|
|
135
|
+
"requireCommits": true
|
|
136
|
+
},
|
|
137
|
+
"npm": {
|
|
138
|
+
"publish": true,
|
|
139
|
+
"skipChecks": true
|
|
140
|
+
},
|
|
141
|
+
"github": {
|
|
142
|
+
"release": true
|
|
143
|
+
},
|
|
144
|
+
"plugins": {
|
|
145
|
+
"@release-it/conventional-changelog": {
|
|
146
|
+
"preset": {
|
|
147
|
+
"name": "angular"
|
|
148
|
+
},
|
|
149
|
+
"infile": "CHANGELOG.md"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"prettier": {
|
|
154
|
+
"quoteProps": "consistent",
|
|
155
|
+
"singleQuote": true,
|
|
156
|
+
"tabWidth": 2,
|
|
157
|
+
"trailingComma": "es5",
|
|
158
|
+
"useTabs": false
|
|
159
|
+
},
|
|
160
|
+
"create-react-native-library": {
|
|
161
|
+
"type": "library",
|
|
162
|
+
"languages": "js",
|
|
163
|
+
"tools": [
|
|
164
|
+
"jest",
|
|
165
|
+
"lefthook",
|
|
166
|
+
"release-it",
|
|
167
|
+
"vite",
|
|
168
|
+
"eslint"
|
|
169
|
+
],
|
|
170
|
+
"version": "0.63.1"
|
|
171
|
+
},
|
|
172
|
+
"engines": {
|
|
173
|
+
"node": "^20.19.4 || ^22.13.0 || ^24.3.0 || >=25.0.0"
|
|
174
|
+
},
|
|
175
|
+
"dependencies": {
|
|
176
|
+
"react-native-marked": "8.2.0"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ChatAction } from './types';
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { Text, View } from 'react-native';
|
|
2
|
+
import {
|
|
3
|
+
BorderBeam,
|
|
4
|
+
Button,
|
|
5
|
+
CircularProgress,
|
|
6
|
+
Icon,
|
|
7
|
+
IconButton,
|
|
8
|
+
radius,
|
|
9
|
+
Spinner,
|
|
10
|
+
useThemedStyles,
|
|
11
|
+
} from '@unif/react-native-design';
|
|
12
|
+
import { ATTACHMENT_ICONS, STATUS_LABELS } from './constants';
|
|
13
|
+
import { createStyles } from './styles';
|
|
14
|
+
import { Thumbnail } from '@unif/react-native-design';
|
|
15
|
+
import type { AttachmentItemProps } from './types';
|
|
16
|
+
|
|
17
|
+
export function AttachmentItem({
|
|
18
|
+
item,
|
|
19
|
+
width,
|
|
20
|
+
imageSize,
|
|
21
|
+
row,
|
|
22
|
+
showProgressLabel = false,
|
|
23
|
+
onPreview,
|
|
24
|
+
onRemove,
|
|
25
|
+
}: AttachmentItemProps) {
|
|
26
|
+
const styles = useThemedStyles(createStyles);
|
|
27
|
+
const name = item.name || '未命名附件';
|
|
28
|
+
const status = item.status ?? 'idle';
|
|
29
|
+
const loadingVisual = item.loadingVisual ?? 'center';
|
|
30
|
+
const busy = status === 'uploading' || status === 'processing';
|
|
31
|
+
const progress =
|
|
32
|
+
status === 'uploading' &&
|
|
33
|
+
typeof item.progress === 'number' &&
|
|
34
|
+
Number.isFinite(item.progress) &&
|
|
35
|
+
item.progress >= 0 &&
|
|
36
|
+
item.progress <= 1
|
|
37
|
+
? item.progress
|
|
38
|
+
: undefined;
|
|
39
|
+
const statusText = item.statusText ?? STATUS_LABELS[status];
|
|
40
|
+
const icon = <Icon name={ATTACHMENT_ICONS[item.kind ?? 'file']} size={28} />;
|
|
41
|
+
const media = (
|
|
42
|
+
<View style={[styles.media, { minWidth: imageSize, minHeight: imageSize }]}>
|
|
43
|
+
<View pointerEvents="none" style={styles.imageLayer}>
|
|
44
|
+
{item.thumbnail ? (
|
|
45
|
+
<Thumbnail
|
|
46
|
+
source={item.thumbnail}
|
|
47
|
+
size={{
|
|
48
|
+
width: imageSize,
|
|
49
|
+
height: imageSize,
|
|
50
|
+
borderRadius: radius.sm,
|
|
51
|
+
}}
|
|
52
|
+
fallback={icon}
|
|
53
|
+
/>
|
|
54
|
+
) : (
|
|
55
|
+
<View
|
|
56
|
+
style={[
|
|
57
|
+
styles.media,
|
|
58
|
+
styles.placeholder,
|
|
59
|
+
{ width: imageSize, height: imageSize },
|
|
60
|
+
]}
|
|
61
|
+
>
|
|
62
|
+
{icon}
|
|
63
|
+
</View>
|
|
64
|
+
)}
|
|
65
|
+
</View>
|
|
66
|
+
{busy && loadingVisual === 'center' ? (
|
|
67
|
+
<View pointerEvents="none" style={styles.progress}>
|
|
68
|
+
{progress !== undefined ? (
|
|
69
|
+
<CircularProgress
|
|
70
|
+
value={progress}
|
|
71
|
+
showLabel={showProgressLabel}
|
|
72
|
+
accessibilityLabel={`${name}上传进度`}
|
|
73
|
+
/>
|
|
74
|
+
) : (
|
|
75
|
+
<Spinner />
|
|
76
|
+
)}
|
|
77
|
+
</View>
|
|
78
|
+
) : null}
|
|
79
|
+
</View>
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<View style={[styles.item, row ? styles.row : { width }]}>
|
|
84
|
+
{busy && loadingVisual === 'border' ? (
|
|
85
|
+
<BorderBeam>{media}</BorderBeam>
|
|
86
|
+
) : (
|
|
87
|
+
media
|
|
88
|
+
)}
|
|
89
|
+
<View style={[styles.content, row && styles.rowContent]}>
|
|
90
|
+
<Text style={styles.name}>{name}</Text>
|
|
91
|
+
{item.meta ? <Text style={styles.meta}>{item.meta}</Text> : null}
|
|
92
|
+
{statusText ? (
|
|
93
|
+
<Text
|
|
94
|
+
style={[styles.meta, status === 'failed' && styles.failed]}
|
|
95
|
+
accessibilityLiveRegion="polite"
|
|
96
|
+
>
|
|
97
|
+
{statusText}
|
|
98
|
+
</Text>
|
|
99
|
+
) : null}
|
|
100
|
+
{busy &&
|
|
101
|
+
loadingVisual !== 'center' &&
|
|
102
|
+
showProgressLabel &&
|
|
103
|
+
progress !== undefined ? (
|
|
104
|
+
<Text style={styles.meta}>{`${Math.round(progress * 100)}%`}</Text>
|
|
105
|
+
) : null}
|
|
106
|
+
<View style={styles.actions}>
|
|
107
|
+
{item.previewable && onPreview ? (
|
|
108
|
+
<IconButton
|
|
109
|
+
icon="eye"
|
|
110
|
+
accessibilityLabel={`预览${name}`}
|
|
111
|
+
onPress={() => onPreview(item)}
|
|
112
|
+
/>
|
|
113
|
+
) : null}
|
|
114
|
+
{item.removable && onRemove ? (
|
|
115
|
+
<IconButton
|
|
116
|
+
icon="close"
|
|
117
|
+
accessibilityLabel={`移除${name}`}
|
|
118
|
+
disabled={item.removeDisabled}
|
|
119
|
+
onPress={() => onRemove(item)}
|
|
120
|
+
/>
|
|
121
|
+
) : null}
|
|
122
|
+
{item.actions?.map((action) => (
|
|
123
|
+
<Button
|
|
124
|
+
key={action.id}
|
|
125
|
+
label={action.label}
|
|
126
|
+
leftIcon={action.icon}
|
|
127
|
+
variant="secondary"
|
|
128
|
+
style={styles.action}
|
|
129
|
+
disabled={action.disabled}
|
|
130
|
+
loading={action.loading}
|
|
131
|
+
accessibilityHint={action.accessibilityHint}
|
|
132
|
+
onPress={action.onPress}
|
|
133
|
+
/>
|
|
134
|
+
))}
|
|
135
|
+
</View>
|
|
136
|
+
</View>
|
|
137
|
+
</View>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { ScrollView, View } from 'react-native';
|
|
3
|
+
import { space, useThemedStyles } from '@unif/react-native-design';
|
|
4
|
+
import { CARD_WIDTH, ROW_IMAGE_SIZE } from './constants';
|
|
5
|
+
import { createStyles } from './styles';
|
|
6
|
+
import { AttachmentItem } from './AttachmentItem';
|
|
7
|
+
import type { AttachmentsProps } from './types';
|
|
8
|
+
|
|
9
|
+
export function Attachments({
|
|
10
|
+
items,
|
|
11
|
+
layout = 'grid',
|
|
12
|
+
showProgressLabel = false,
|
|
13
|
+
onPreview,
|
|
14
|
+
onRemove,
|
|
15
|
+
style,
|
|
16
|
+
testID,
|
|
17
|
+
}: AttachmentsProps) {
|
|
18
|
+
const styles = useThemedStyles(createStyles);
|
|
19
|
+
const [availableWidth, setAvailableWidth] = useState(0);
|
|
20
|
+
const columns = Math.max(
|
|
21
|
+
1,
|
|
22
|
+
Math.floor((availableWidth + space[2]) / (CARD_WIDTH + space[2]))
|
|
23
|
+
);
|
|
24
|
+
const cardWidth =
|
|
25
|
+
layout === 'grid' && availableWidth > 0
|
|
26
|
+
? (availableWidth - space[2] * (columns - 1)) / columns
|
|
27
|
+
: Math.min(CARD_WIDTH, availableWidth || CARD_WIDTH);
|
|
28
|
+
const content = items.map((item) => {
|
|
29
|
+
const row =
|
|
30
|
+
layout === 'list' || (layout === 'mixed' && item.kind !== 'image');
|
|
31
|
+
return (
|
|
32
|
+
<AttachmentItem
|
|
33
|
+
key={item.id}
|
|
34
|
+
item={item}
|
|
35
|
+
row={row}
|
|
36
|
+
width={cardWidth}
|
|
37
|
+
imageSize={
|
|
38
|
+
row ? ROW_IMAGE_SIZE : Math.max(1, cardWidth - space[2] * 2 - 2)
|
|
39
|
+
}
|
|
40
|
+
showProgressLabel={showProgressLabel}
|
|
41
|
+
onPreview={onPreview}
|
|
42
|
+
onRemove={onRemove}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
return (
|
|
47
|
+
<View style={[styles.root, style]} testID={testID}>
|
|
48
|
+
{layout === 'carousel' ? (
|
|
49
|
+
<ScrollView
|
|
50
|
+
horizontal
|
|
51
|
+
keyboardShouldPersistTaps="handled"
|
|
52
|
+
contentContainerStyle={styles.carousel}
|
|
53
|
+
onLayout={({ nativeEvent: { layout: measured } }) =>
|
|
54
|
+
setAvailableWidth(measured.width)
|
|
55
|
+
}
|
|
56
|
+
>
|
|
57
|
+
{content}
|
|
58
|
+
</ScrollView>
|
|
59
|
+
) : (
|
|
60
|
+
<View
|
|
61
|
+
testID={testID ? `${testID}-content` : undefined}
|
|
62
|
+
style={styles.collection}
|
|
63
|
+
onLayout={({ nativeEvent: { layout: measured } }) =>
|
|
64
|
+
setAvailableWidth(measured.width)
|
|
65
|
+
}
|
|
66
|
+
>
|
|
67
|
+
{content}
|
|
68
|
+
</View>
|
|
69
|
+
)}
|
|
70
|
+
</View>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IconName } from '@unif/react-native-design';
|
|
2
|
+
import type { ChatAttachmentItem } from './types';
|
|
3
|
+
|
|
4
|
+
export const CARD_WIDTH = 144;
|
|
5
|
+
export const ROW_IMAGE_SIZE = 56;
|
|
6
|
+
export const ATTACHMENT_ICONS: Record<
|
|
7
|
+
NonNullable<ChatAttachmentItem['kind']>,
|
|
8
|
+
IconName
|
|
9
|
+
> = {
|
|
10
|
+
image: 'image',
|
|
11
|
+
file: 'file',
|
|
12
|
+
audio: 'sound',
|
|
13
|
+
video: 'play',
|
|
14
|
+
};
|
|
15
|
+
export const STATUS_LABELS = {
|
|
16
|
+
idle: '',
|
|
17
|
+
uploading: '正在上传',
|
|
18
|
+
processing: '正在处理',
|
|
19
|
+
ready: '',
|
|
20
|
+
failed: '处理失败',
|
|
21
|
+
} as const;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { radius, space, type } from '@unif/react-native-design';
|
|
3
|
+
import type { ColorTokens } from '@unif/react-native-design';
|
|
4
|
+
|
|
5
|
+
export const createStyles = (colors: ColorTokens) =>
|
|
6
|
+
StyleSheet.create({
|
|
7
|
+
root: { minWidth: 0 },
|
|
8
|
+
collection: {
|
|
9
|
+
flexDirection: 'row',
|
|
10
|
+
flexWrap: 'wrap',
|
|
11
|
+
alignItems: 'flex-start',
|
|
12
|
+
gap: space[2],
|
|
13
|
+
},
|
|
14
|
+
carousel: { gap: space[2], alignItems: 'flex-start' },
|
|
15
|
+
item: {
|
|
16
|
+
gap: space[2],
|
|
17
|
+
padding: space[2],
|
|
18
|
+
borderWidth: 1,
|
|
19
|
+
borderColor: colors.outline,
|
|
20
|
+
borderRadius: radius.md,
|
|
21
|
+
backgroundColor: colors.surface,
|
|
22
|
+
},
|
|
23
|
+
row: { width: '100%', flexDirection: 'row', alignItems: 'center' },
|
|
24
|
+
content: { minWidth: 0, flexShrink: 1, gap: space[1] },
|
|
25
|
+
rowContent: { flex: 1 },
|
|
26
|
+
media: {
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
alignSelf: 'center',
|
|
30
|
+
},
|
|
31
|
+
imageLayer: {
|
|
32
|
+
position: 'absolute',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
top: 0,
|
|
36
|
+
bottom: 0,
|
|
37
|
+
left: 0,
|
|
38
|
+
right: 0,
|
|
39
|
+
},
|
|
40
|
+
placeholder: {
|
|
41
|
+
backgroundColor: colors.surfaceContainer,
|
|
42
|
+
borderRadius: radius.sm,
|
|
43
|
+
},
|
|
44
|
+
progress: {
|
|
45
|
+
padding: space[1],
|
|
46
|
+
borderRadius: radius.sm,
|
|
47
|
+
backgroundColor: colors.surface,
|
|
48
|
+
},
|
|
49
|
+
name: { color: colors.foreground, fontSize: type.body },
|
|
50
|
+
meta: { color: colors.foregroundMuted, fontSize: type.sm },
|
|
51
|
+
failed: { color: colors.error },
|
|
52
|
+
action: { maxWidth: '100%' },
|
|
53
|
+
actions: { flexDirection: 'row', flexWrap: 'wrap', gap: space[1] },
|
|
54
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ImageSourcePropType, StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import type { ChatAction } from '../../actions';
|
|
3
|
+
|
|
4
|
+
export type ChatAttachmentStatus =
|
|
5
|
+
'idle' | 'uploading' | 'processing' | 'ready' | 'failed';
|
|
6
|
+
export interface ChatAttachmentItem {
|
|
7
|
+
id: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
kind?: 'image' | 'file' | 'audio' | 'video';
|
|
10
|
+
thumbnail?: ImageSourcePropType;
|
|
11
|
+
meta?: string;
|
|
12
|
+
status?: ChatAttachmentStatus;
|
|
13
|
+
statusText?: string;
|
|
14
|
+
progress?: number;
|
|
15
|
+
loadingVisual?: 'center' | 'border' | 'caption';
|
|
16
|
+
previewable?: boolean;
|
|
17
|
+
removable?: boolean;
|
|
18
|
+
removeDisabled?: boolean;
|
|
19
|
+
actions?: readonly ChatAction[];
|
|
20
|
+
}
|
|
21
|
+
export interface AttachmentsProps {
|
|
22
|
+
items: readonly ChatAttachmentItem[];
|
|
23
|
+
layout?: 'grid' | 'mixed' | 'carousel' | 'list';
|
|
24
|
+
showProgressLabel?: boolean;
|
|
25
|
+
onPreview?(item: ChatAttachmentItem): void;
|
|
26
|
+
onRemove?(item: ChatAttachmentItem): void;
|
|
27
|
+
style?: StyleProp<ViewStyle>;
|
|
28
|
+
testID?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface AttachmentItemProps extends Pick<
|
|
31
|
+
AttachmentsProps,
|
|
32
|
+
'showProgressLabel' | 'onPreview' | 'onRemove'
|
|
33
|
+
> {
|
|
34
|
+
item: ChatAttachmentItem;
|
|
35
|
+
width?: number;
|
|
36
|
+
imageSize: number;
|
|
37
|
+
row: boolean;
|
|
38
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import { useThemedStyles } from '@unif/react-native-design';
|
|
3
|
+
import { createStyles } from './styles';
|
|
4
|
+
import type { ChatProps } from './types';
|
|
5
|
+
export function Chat({
|
|
6
|
+
children,
|
|
7
|
+
composer,
|
|
8
|
+
header,
|
|
9
|
+
footer,
|
|
10
|
+
bottomInset = 0,
|
|
11
|
+
style,
|
|
12
|
+
testID,
|
|
13
|
+
}: ChatProps) {
|
|
14
|
+
const styles = useThemedStyles(createStyles);
|
|
15
|
+
const paddingBottom = Number.isFinite(bottomInset)
|
|
16
|
+
? Math.max(0, bottomInset)
|
|
17
|
+
: 0;
|
|
18
|
+
return (
|
|
19
|
+
<View style={[styles.root, { paddingBottom }, style]} testID={testID}>
|
|
20
|
+
{header}
|
|
21
|
+
<View style={styles.messages}>{children}</View>
|
|
22
|
+
{composer}
|
|
23
|
+
{footer}
|
|
24
|
+
</View>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import type { ColorTokens } from '@unif/react-native-design';
|
|
3
|
+
export const createStyles = (colors: ColorTokens) =>
|
|
4
|
+
StyleSheet.create({
|
|
5
|
+
root: {
|
|
6
|
+
flex: 1,
|
|
7
|
+
minHeight: 0,
|
|
8
|
+
minWidth: 0,
|
|
9
|
+
backgroundColor: colors.background,
|
|
10
|
+
},
|
|
11
|
+
messages: { flex: 1, minHeight: 0, minWidth: 0 },
|
|
12
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export interface ChatProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
composer?: ReactNode;
|
|
6
|
+
header?: ReactNode;
|
|
7
|
+
footer?: ReactNode;
|
|
8
|
+
bottomInset?: number;
|
|
9
|
+
style?: StyleProp<ViewStyle>;
|
|
10
|
+
testID?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Text } from 'react-native';
|
|
2
|
+
import type { GestureResponderEvent } from 'react-native';
|
|
3
|
+
import { useThemedStyles } from '@unif/react-native-design';
|
|
4
|
+
import { createStyles } from './styles';
|
|
5
|
+
import type { CitationProps } from './types';
|
|
6
|
+
|
|
7
|
+
export function Citation({
|
|
8
|
+
label,
|
|
9
|
+
onPress,
|
|
10
|
+
disabled = false,
|
|
11
|
+
accessibilityLabel = `引用${label}`,
|
|
12
|
+
testID,
|
|
13
|
+
}: CitationProps): React.JSX.Element {
|
|
14
|
+
const styles = useThemedStyles(createStyles);
|
|
15
|
+
const handlePress = (event: GestureResponderEvent) => {
|
|
16
|
+
event.stopPropagation();
|
|
17
|
+
onPress?.();
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Text
|
|
22
|
+
style={[styles.citation, disabled && styles.disabled]}
|
|
23
|
+
onPress={disabled || !onPress ? undefined : handlePress}
|
|
24
|
+
accessibilityRole={onPress ? 'link' : undefined}
|
|
25
|
+
accessibilityLabel={accessibilityLabel}
|
|
26
|
+
accessibilityState={{ disabled }}
|
|
27
|
+
suppressHighlighting={disabled || !onPress}
|
|
28
|
+
testID={testID}
|
|
29
|
+
>
|
|
30
|
+
[{label}]
|
|
31
|
+
</Text>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { fw, type } from '@unif/react-native-design';
|
|
3
|
+
import type { ColorTokens } from '@unif/react-native-design';
|
|
4
|
+
|
|
5
|
+
export const createStyles = (colors: ColorTokens) =>
|
|
6
|
+
StyleSheet.create({
|
|
7
|
+
citation: {
|
|
8
|
+
color: colors.primary,
|
|
9
|
+
fontSize: type.xxs,
|
|
10
|
+
fontWeight: fw.semi,
|
|
11
|
+
},
|
|
12
|
+
disabled: {
|
|
13
|
+
color: colors.foregroundSubtle,
|
|
14
|
+
},
|
|
15
|
+
});
|