@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/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 qq382724925
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @unif/react-native-chat
|
|
2
|
+
|
|
3
|
+
基于 `@unif/react-native-design` 的独立 TypeScript 聊天组件库。
|
|
4
|
+
|
|
5
|
+
工程由 create-react-native-library 0.63.1 的 library/js 模板生成,源码为 TS/TSX。example 使用 Community CLI,原生 iOS/Android 工程用于示例验证,Vite 提供 Web 入口。公开组件包括 Chat、Message、MessageList、Composer、Attachments、Suggestions、Confirmation、Process、Sources、Citation、Feedback。各组件可以独立使用,具体行为依据见[开发交接](docs/DEVELOPMENT.md)。
|
|
6
|
+
|
|
7
|
+
## 本地开始
|
|
8
|
+
|
|
9
|
+
仓库自带 Yarn 4.11.0;Node 基线见 .nvmrc,支持范围见 package.json。
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
yarn install --immutable --mode=skip-build
|
|
13
|
+
yarn typecheck
|
|
14
|
+
yarn example typecheck
|
|
15
|
+
yarn lint
|
|
16
|
+
yarn format:check
|
|
17
|
+
yarn test --runInBand --runTestsByPath example/src/__tests__/App.test.tsx
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
没有全局 Yarn 时,使用 `node .yarn/releases/yarn-4.11.0.cjs` 代替 yarn。示例服务使用 `yarn example start` 或 `yarn example web`。构建和全量测试遵循 AGENTS.md 的执行边界。
|
|
21
|
+
|
|
22
|
+
Design 开发和示例使用 npm 0.32.0,React 19.2.3、RN 0.86.3;公开依赖范围以 package.json 为准。已知上游 peer 声明差异见开发交接。
|
|
23
|
+
|
|
24
|
+
ESLint、Jest、Lefthook、Release It、Vite 已配置。跳过安装脚本时,使用 `yarn exec lefthook install` 安装 Git hooks;发布按明确授权执行。
|
|
25
|
+
|
|
26
|
+
## 使用与示例
|
|
27
|
+
|
|
28
|
+
应用根使用 Design 的 `ThemeProvider`,按应用需要接入手势与安全区宿主。组件从包根具名导入;公开类型由 `src/index.tsx` 导出,详细 props 以所属单元 `types.ts` 为准。
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { Composer } from '@unif/react-native-chat';
|
|
32
|
+
|
|
33
|
+
<Composer
|
|
34
|
+
value={text}
|
|
35
|
+
onChangeText={setText}
|
|
36
|
+
primaryAction={{ kind: 'send', onPress: handleSend }}
|
|
37
|
+
/>;
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`handleSend` 接收原始文字,调用方负责请求、结果采用以及更新 `text`。停止、附件操作、确认、来源与反馈按钮同样只交付事件。库不创建会话、上传文件、连接 Agent 或自行判断业务成功。
|
|
41
|
+
|
|
42
|
+
example 首页可切换 11 个组件的独立样例、主聊天与抽屉输入,并切换浅色/深色和应用字号。Message 包含真实 Markdown、图片和交互卡片;MessageList 提供长列表、前插与追加、流式增长和跟随设置。主聊天和抽屉样例分别持有草稿,通过 RN 键盘容器演示宿主责任;Chat 和 Composer 不额外抬升键盘。
|
|
43
|
+
|
|
44
|
+
MessageList 需要有界高度,不要放入同方向无界 ScrollView。列表采用 FlatList;RN Web 0.21 的纯前插通过可见消息的 DOM 位置保持锚点,持续处理后续尺寸变化;虚拟化仍由 FlatList 管理。切换会话使用 React key 重建列表。
|
|
45
|
+
|
|
46
|
+
Markdown 使用 react-native-marked 的公开解析和节点渲染;链接仅交付 onLinkPress。图片通过小型资源尺寸适配与 Design Thumbnail 呈现,避免当前第三方图片节点重复取尺寸,同时保留 Design 的加载与失败占位。Jest 配置沿用 Design preset,额外转换 Markdown 的 ESM 依赖。
|
|
47
|
+
|
|
48
|
+
定向交互测试不能代替真实平台验收。键盘、动态高度、滚动锚点、图片、嵌套触摸与大字号布局应在 Web、iOS、Android 分别检查;完整 Jest、库与 example 打包及原生构建由 CI 执行。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["actions/index.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["actions/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Text, View } from 'react-native';
|
|
4
|
+
import { BorderBeam, Button, CircularProgress, Icon, IconButton, radius, Spinner, useThemedStyles } from '@unif/react-native-design';
|
|
5
|
+
import { ATTACHMENT_ICONS, STATUS_LABELS } from "./constants.js";
|
|
6
|
+
import { createStyles } from "./styles.js";
|
|
7
|
+
import { Thumbnail } from '@unif/react-native-design';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
export function AttachmentItem({
|
|
10
|
+
item,
|
|
11
|
+
width,
|
|
12
|
+
imageSize,
|
|
13
|
+
row,
|
|
14
|
+
showProgressLabel = false,
|
|
15
|
+
onPreview,
|
|
16
|
+
onRemove
|
|
17
|
+
}) {
|
|
18
|
+
const styles = useThemedStyles(createStyles);
|
|
19
|
+
const name = item.name || '未命名附件';
|
|
20
|
+
const status = item.status ?? 'idle';
|
|
21
|
+
const loadingVisual = item.loadingVisual ?? 'center';
|
|
22
|
+
const busy = status === 'uploading' || status === 'processing';
|
|
23
|
+
const progress = status === 'uploading' && typeof item.progress === 'number' && Number.isFinite(item.progress) && item.progress >= 0 && item.progress <= 1 ? item.progress : undefined;
|
|
24
|
+
const statusText = item.statusText ?? STATUS_LABELS[status];
|
|
25
|
+
const icon = /*#__PURE__*/_jsx(Icon, {
|
|
26
|
+
name: ATTACHMENT_ICONS[item.kind ?? 'file'],
|
|
27
|
+
size: 28
|
|
28
|
+
});
|
|
29
|
+
const media = /*#__PURE__*/_jsxs(View, {
|
|
30
|
+
style: [styles.media, {
|
|
31
|
+
minWidth: imageSize,
|
|
32
|
+
minHeight: imageSize
|
|
33
|
+
}],
|
|
34
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
35
|
+
pointerEvents: "none",
|
|
36
|
+
style: styles.imageLayer,
|
|
37
|
+
children: item.thumbnail ? /*#__PURE__*/_jsx(Thumbnail, {
|
|
38
|
+
source: item.thumbnail,
|
|
39
|
+
size: {
|
|
40
|
+
width: imageSize,
|
|
41
|
+
height: imageSize,
|
|
42
|
+
borderRadius: radius.sm
|
|
43
|
+
},
|
|
44
|
+
fallback: icon
|
|
45
|
+
}) : /*#__PURE__*/_jsx(View, {
|
|
46
|
+
style: [styles.media, styles.placeholder, {
|
|
47
|
+
width: imageSize,
|
|
48
|
+
height: imageSize
|
|
49
|
+
}],
|
|
50
|
+
children: icon
|
|
51
|
+
})
|
|
52
|
+
}), busy && loadingVisual === 'center' ? /*#__PURE__*/_jsx(View, {
|
|
53
|
+
pointerEvents: "none",
|
|
54
|
+
style: styles.progress,
|
|
55
|
+
children: progress !== undefined ? /*#__PURE__*/_jsx(CircularProgress, {
|
|
56
|
+
value: progress,
|
|
57
|
+
showLabel: showProgressLabel,
|
|
58
|
+
accessibilityLabel: `${name}上传进度`
|
|
59
|
+
}) : /*#__PURE__*/_jsx(Spinner, {})
|
|
60
|
+
}) : null]
|
|
61
|
+
});
|
|
62
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
63
|
+
style: [styles.item, row ? styles.row : {
|
|
64
|
+
width
|
|
65
|
+
}],
|
|
66
|
+
children: [busy && loadingVisual === 'border' ? /*#__PURE__*/_jsx(BorderBeam, {
|
|
67
|
+
children: media
|
|
68
|
+
}) : media, /*#__PURE__*/_jsxs(View, {
|
|
69
|
+
style: [styles.content, row && styles.rowContent],
|
|
70
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
71
|
+
style: styles.name,
|
|
72
|
+
children: name
|
|
73
|
+
}), item.meta ? /*#__PURE__*/_jsx(Text, {
|
|
74
|
+
style: styles.meta,
|
|
75
|
+
children: item.meta
|
|
76
|
+
}) : null, statusText ? /*#__PURE__*/_jsx(Text, {
|
|
77
|
+
style: [styles.meta, status === 'failed' && styles.failed],
|
|
78
|
+
accessibilityLiveRegion: "polite",
|
|
79
|
+
children: statusText
|
|
80
|
+
}) : null, busy && loadingVisual !== 'center' && showProgressLabel && progress !== undefined ? /*#__PURE__*/_jsx(Text, {
|
|
81
|
+
style: styles.meta,
|
|
82
|
+
children: `${Math.round(progress * 100)}%`
|
|
83
|
+
}) : null, /*#__PURE__*/_jsxs(View, {
|
|
84
|
+
style: styles.actions,
|
|
85
|
+
children: [item.previewable && onPreview ? /*#__PURE__*/_jsx(IconButton, {
|
|
86
|
+
icon: "eye",
|
|
87
|
+
accessibilityLabel: `预览${name}`,
|
|
88
|
+
onPress: () => onPreview(item)
|
|
89
|
+
}) : null, item.removable && onRemove ? /*#__PURE__*/_jsx(IconButton, {
|
|
90
|
+
icon: "close",
|
|
91
|
+
accessibilityLabel: `移除${name}`,
|
|
92
|
+
disabled: item.removeDisabled,
|
|
93
|
+
onPress: () => onRemove(item)
|
|
94
|
+
}) : null, item.actions?.map(action => /*#__PURE__*/_jsx(Button, {
|
|
95
|
+
label: action.label,
|
|
96
|
+
leftIcon: action.icon,
|
|
97
|
+
variant: "secondary",
|
|
98
|
+
style: styles.action,
|
|
99
|
+
disabled: action.disabled,
|
|
100
|
+
loading: action.loading,
|
|
101
|
+
accessibilityHint: action.accessibilityHint,
|
|
102
|
+
onPress: action.onPress
|
|
103
|
+
}, action.id))]
|
|
104
|
+
})]
|
|
105
|
+
})]
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=AttachmentItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Text","View","BorderBeam","Button","CircularProgress","Icon","IconButton","radius","Spinner","useThemedStyles","ATTACHMENT_ICONS","STATUS_LABELS","createStyles","Thumbnail","jsx","_jsx","jsxs","_jsxs","AttachmentItem","item","width","imageSize","row","showProgressLabel","onPreview","onRemove","styles","name","status","loadingVisual","busy","progress","Number","isFinite","undefined","statusText","icon","kind","size","media","style","minWidth","minHeight","children","pointerEvents","imageLayer","thumbnail","source","height","borderRadius","sm","fallback","placeholder","value","showLabel","accessibilityLabel","content","rowContent","meta","failed","accessibilityLiveRegion","Math","round","actions","previewable","onPress","removable","disabled","removeDisabled","map","action","label","leftIcon","variant","loading","accessibilityHint","id"],"sourceRoot":"../../../../src","sources":["components/Attachments/AttachmentItem.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,IAAI,QAAQ,cAAc;AACzC,SACEC,UAAU,EACVC,MAAM,EACNC,gBAAgB,EAChBC,IAAI,EACJC,UAAU,EACVC,MAAM,EACNC,OAAO,EACPC,eAAe,QACV,2BAA2B;AAClC,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,gBAAa;AAC7D,SAASC,YAAY,QAAQ,aAAU;AACvC,SAASC,SAAS,QAAQ,2BA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T,UAAU;UACT8B,IAAI,EAAC,OAAO;UACZmB,kBAAkB,EAAE,KAAK5B,IAAI,EAAG;UAChCwC,QAAQ,EAAEhD,IAAI,CAACiD,cAAe;UAC9BH,OAAO,EAAEA,CAAA,KAAMxC,QAAQ,CAACN,IAAI;QAAE,CAC/B,CAAC,GACA,IAAI,EACPA,IAAI,CAAC4C,OAAO,EAAEM,GAAG,CAAEC,MAAM,iBACxBvD,IAAA,CAACZ,MAAM;UAELoE,KAAK,EAAED,MAAM,CAACC,KAAM;UACpBC,QAAQ,EAAEF,MAAM,CAAClC,IAAK;UACtBqC,OAAO,EAAC,WAAW;UACnBjC,KAAK,EAAEd,MAAM,CAAC4C,MAAO;UACrBH,QAAQ,EAAEG,MAAM,CAACH,QAAS;UAC1BO,OAAO,EAAEJ,MAAM,CAACI,OAAQ;UACxBC,iBAAiB,EAAEL,MAAM,CAACK,iBAAkB;UAC5CV,OAAO,EAAEK,MAAM,CAACL;QAAQ,GARnBK,MAAM,CAACM,EASb,CACF,CAAC;MAAA,CACE,CAAC;IAAA,CACH,CAAC;EAAA,CACH,CAAC;AAEX","ignoreList":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { ScrollView, View } from 'react-native';
|
|
5
|
+
import { space, useThemedStyles } from '@unif/react-native-design';
|
|
6
|
+
import { CARD_WIDTH, ROW_IMAGE_SIZE } from "./constants.js";
|
|
7
|
+
import { createStyles } from "./styles.js";
|
|
8
|
+
import { AttachmentItem } from "./AttachmentItem.js";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
export function Attachments({
|
|
11
|
+
items,
|
|
12
|
+
layout = 'grid',
|
|
13
|
+
showProgressLabel = false,
|
|
14
|
+
onPreview,
|
|
15
|
+
onRemove,
|
|
16
|
+
style,
|
|
17
|
+
testID
|
|
18
|
+
}) {
|
|
19
|
+
const styles = useThemedStyles(createStyles);
|
|
20
|
+
const [availableWidth, setAvailableWidth] = useState(0);
|
|
21
|
+
const columns = Math.max(1, Math.floor((availableWidth + space[2]) / (CARD_WIDTH + space[2])));
|
|
22
|
+
const cardWidth = layout === 'grid' && availableWidth > 0 ? (availableWidth - space[2] * (columns - 1)) / columns : Math.min(CARD_WIDTH, availableWidth || CARD_WIDTH);
|
|
23
|
+
const content = items.map(item => {
|
|
24
|
+
const row = layout === 'list' || layout === 'mixed' && item.kind !== 'image';
|
|
25
|
+
return /*#__PURE__*/_jsx(AttachmentItem, {
|
|
26
|
+
item: item,
|
|
27
|
+
row: row,
|
|
28
|
+
width: cardWidth,
|
|
29
|
+
imageSize: row ? ROW_IMAGE_SIZE : Math.max(1, cardWidth - space[2] * 2 - 2),
|
|
30
|
+
showProgressLabel: showProgressLabel,
|
|
31
|
+
onPreview: onPreview,
|
|
32
|
+
onRemove: onRemove
|
|
33
|
+
}, item.id);
|
|
34
|
+
});
|
|
35
|
+
return /*#__PURE__*/_jsx(View, {
|
|
36
|
+
style: [styles.root, style],
|
|
37
|
+
testID: testID,
|
|
38
|
+
children: layout === 'carousel' ? /*#__PURE__*/_jsx(ScrollView, {
|
|
39
|
+
horizontal: true,
|
|
40
|
+
keyboardShouldPersistTaps: "handled",
|
|
41
|
+
contentContainerStyle: styles.carousel,
|
|
42
|
+
onLayout: ({
|
|
43
|
+
nativeEvent: {
|
|
44
|
+
layout: measured
|
|
45
|
+
}
|
|
46
|
+
}) => setAvailableWidth(measured.width),
|
|
47
|
+
children: content
|
|
48
|
+
}) : /*#__PURE__*/_jsx(View, {
|
|
49
|
+
testID: testID ? `${testID}-content` : undefined,
|
|
50
|
+
style: styles.collection,
|
|
51
|
+
onLayout: ({
|
|
52
|
+
nativeEvent: {
|
|
53
|
+
layout: measured
|
|
54
|
+
}
|
|
55
|
+
}) => setAvailableWidth(measured.width),
|
|
56
|
+
children: content
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=Attachments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useState","ScrollView","View","space","useThemedStyles","CARD_WIDTH","ROW_IMAGE_SIZE","createStyles","AttachmentItem","jsx","_jsx","Attachments","items","layout","showProgressLabel","onPreview","onRemove","style","testID","styles","availableWidth","setAvailableWidth","columns","Math","max","floor","cardWidth","min","content","map","item","row","kind","width","imageSize","id","root","children","horizontal","keyboardShouldPersistTaps","contentContainerStyle","carousel","onLayout","nativeEvent","measured","undefined","collection"],"sourceRoot":"../../../../src","sources":["components/Attachments/Attachments.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,OAAO;AAChC,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SAASC,KAAK,EAAEC,eAAe,QAAQ,2BAA2B;AAClE,SAASC,UAAU,EAAEC,cAAc,QAAQ,gBAAa;AACxD,SAASC,YAAY,QAAQ,aAAU;AACvC,SAASC,cAAc,QAAQ,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGlD,OAAO,SAASC,WAAWA,CAAC;EAC1BC,KAAK;EACLC,MAAM,GAAG,MAAM;EACfC,iBAAiB,GAAG,KAAK;EACzBC,SAAS;EACTC,QAAQ;EACRC,KAAK;EACLC;AACgB,CAAC,EAAE;EACnB,MAAMC,MAAM,GAAGf,eAAe,CAACG,YAAY,CAAC;EAC5C,MAAM,CAACa,cAAc,EAAEC,iBAAiB,CAAC,GAAGrB,QAAQ,CAAC,CAAC,CAAC;EACvD,MAAMsB,OAAO,GAAGC,IAAI,CAACC,GAAG,CACtB,CAAC,EACDD,IAAI,CAACE,KAAK,CAAC,CAACL,cAAc,GAAGjB,KAAK,CAAC,CAAC,CAAC,KAAKE,UAAU,GAAGF,KAAK,CAAC,CAAC,CAAC,CAAC,CAClE,CAAC;EACD,MAAMuB,SAAS,GACbb,MAAM,KAAK,MAAM,IAAIO,cAAc,GAAG,CAAC,GACnC,CAACA,cAAc,GAAGjB,KA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AAU,GAAG2B,SAAU;MACjD5B,KAAK,EAAEE,MAAM,CAAC2B,UAAW;MACzBJ,QAAQ,EAAEA,CAAC;QAAEC,WAAW,EAAE;UAAE9B,MAAM,EAAE+B;QAAS;MAAE,CAAC,KAC9CvB,iBAAiB,CAACuB,QAAQ,CAACX,KAAK,CACjC;MAAAI,QAAA,EAEAT;IAAO,CACJ;EACP,CACG,CAAC;AAEX","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const CARD_WIDTH = 144;
|
|
4
|
+
export const ROW_IMAGE_SIZE = 56;
|
|
5
|
+
export const ATTACHMENT_ICONS = {
|
|
6
|
+
image: 'image',
|
|
7
|
+
file: 'file',
|
|
8
|
+
audio: 'sound',
|
|
9
|
+
video: 'play'
|
|
10
|
+
};
|
|
11
|
+
export const STATUS_LABELS = {
|
|
12
|
+
idle: '',
|
|
13
|
+
uploading: '正在上传',
|
|
14
|
+
processing: '正在处理',
|
|
15
|
+
ready: '',
|
|
16
|
+
failed: '处理失败'
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CARD_WIDTH","ROW_IMAGE_SIZE","ATTACHMENT_ICONS","image","file","audio","video","STATUS_LABELS","idle","uploading","processing","ready","failed"],"sourceRoot":"../../../../src","sources":["components/Attachments/constants.ts"],"mappings":";;AAGA,OAAO,MAAMA,UAAU,GAAG,GAAG;AAC7B,OAAO,MAAMC,cAAc,GAAG,EAAE;AAChC,OAAO,MAAMC,gBAGZ,GAAG;EACFC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE,OAAO;EACdC,KAAK,EAAE;AACT,CAAC;AACD,OAAO,MAAMC,aAAa,GAAG;EAC3BC,IAAI,EAAE,EAAE;EACRC,SAAS,EAAE,MAAM;EACjBC,UAAU,EAAE,MAAM;EAClBC,KAAK,EAAE,EAAE;EACTC,MAAM,EAAE;AACV,CAAU","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Attachments"],"sourceRoot":"../../../../src","sources":["components/Attachments/index.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,kBAAe","ignoreList":[]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
|
+
import { radius, space, type } from '@unif/react-native-design';
|
|
5
|
+
export const createStyles = colors => StyleSheet.create({
|
|
6
|
+
root: {
|
|
7
|
+
minWidth: 0
|
|
8
|
+
},
|
|
9
|
+
collection: {
|
|
10
|
+
flexDirection: 'row',
|
|
11
|
+
flexWrap: 'wrap',
|
|
12
|
+
alignItems: 'flex-start',
|
|
13
|
+
gap: space[2]
|
|
14
|
+
},
|
|
15
|
+
carousel: {
|
|
16
|
+
gap: space[2],
|
|
17
|
+
alignItems: 'flex-start'
|
|
18
|
+
},
|
|
19
|
+
item: {
|
|
20
|
+
gap: space[2],
|
|
21
|
+
padding: space[2],
|
|
22
|
+
borderWidth: 1,
|
|
23
|
+
borderColor: colors.outline,
|
|
24
|
+
borderRadius: radius.md,
|
|
25
|
+
backgroundColor: colors.surface
|
|
26
|
+
},
|
|
27
|
+
row: {
|
|
28
|
+
width: '100%',
|
|
29
|
+
flexDirection: 'row',
|
|
30
|
+
alignItems: 'center'
|
|
31
|
+
},
|
|
32
|
+
content: {
|
|
33
|
+
minWidth: 0,
|
|
34
|
+
flexShrink: 1,
|
|
35
|
+
gap: space[1]
|
|
36
|
+
},
|
|
37
|
+
rowContent: {
|
|
38
|
+
flex: 1
|
|
39
|
+
},
|
|
40
|
+
media: {
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
justifyContent: 'center',
|
|
43
|
+
alignSelf: 'center'
|
|
44
|
+
},
|
|
45
|
+
imageLayer: {
|
|
46
|
+
position: 'absolute',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
justifyContent: 'center',
|
|
49
|
+
top: 0,
|
|
50
|
+
bottom: 0,
|
|
51
|
+
left: 0,
|
|
52
|
+
right: 0
|
|
53
|
+
},
|
|
54
|
+
placeholder: {
|
|
55
|
+
backgroundColor: colors.surfaceContainer,
|
|
56
|
+
borderRadius: radius.sm
|
|
57
|
+
},
|
|
58
|
+
progress: {
|
|
59
|
+
padding: space[1],
|
|
60
|
+
borderRadius: radius.sm,
|
|
61
|
+
backgroundColor: colors.surface
|
|
62
|
+
},
|
|
63
|
+
name: {
|
|
64
|
+
color: colors.foreground,
|
|
65
|
+
fontSize: type.body
|
|
66
|
+
},
|
|
67
|
+
meta: {
|
|
68
|
+
color: colors.foregroundMuted,
|
|
69
|
+
fontSize: type.sm
|
|
70
|
+
},
|
|
71
|
+
failed: {
|
|
72
|
+
color: colors.error
|
|
73
|
+
},
|
|
74
|
+
action: {
|
|
75
|
+
maxWidth: '100%'
|
|
76
|
+
},
|
|
77
|
+
actions: {
|
|
78
|
+
flexDirection: 'row',
|
|
79
|
+
flexWrap: 'wrap',
|
|
80
|
+
gap: space[1]
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","radius","space","type","createStyles","colors","create","root","minWidth","collection","flexDirection","flexWrap","alignItems","gap","carousel","item","padding","borderWidth","borderColor","outline","borderRadius","md","backgroundColor","surface","row","width","content","flexShrink","rowContent","flex","media","justifyContent","alignSelf","imageLayer","position","top","bottom","left","right","placeholder","surfaceContainer","sm","progress","name","color","foreground","fontSize","body","meta","foregroundMuted","failed","error","action","maxWidth","actions"],"sourceRoot":"../../../../src","sources":["components/Attachments/styles.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,MAAM,EAAEC,KAAK,EAAEC,IAAI,QAAQ,2BAA2B;AAG/D,OAAO,MAAMC,YAAY,GAA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IACxCpB,YAAY,EAAEnB,MAAM,CAACwC;EACvB,CAAC;EACDC,QAAQ,EAAE;IACR1B,OAAO,EAAEd,KAAK,CAAC,CAAC,CAAC;IACjBkB,YAAY,EAAEnB,MAAM,CAACwC,EAAE;IACvBnB,eAAe,EAAEjB,MAAM,CAACkB;EAC1B,CAAC;EACDoB,IAAI,EAAE;IAAEC,KAAK,EAAEvC,MAAM,CAACwC,UAAU;IAAEC,QAAQ,EAAE3C,IAAI,CAAC4C;EAAK,CAAC;EACvDC,IAAI,EAAE;IAAEJ,KAAK,EAAEvC,MAAM,CAAC4C,eAAe;IAAEH,QAAQ,EAAE3C,IAAI,CAACsC;EAAG,CAAC;EAC1DS,MAAM,EAAE;IAAEN,KAAK,EAAEvC,MAAM,CAAC8C;EAAM,CAAC;EAC/BC,MAAM,EAAE;IAAEC,QAAQ,EAAE;EAAO,CAAC;EAC5BC,OAAO,EAAE;IAAE5C,aAAa,EAAE,KAAK;IAAEC,QAAQ,EAAE,MAAM;IAAEE,GAAG,EAAEX,KAAK,CAAC,CAAC;EAAE;AACnE,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/Attachments/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { useThemedStyles } from '@unif/react-native-design';
|
|
5
|
+
import { createStyles } from "./styles.js";
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
export function Chat({
|
|
8
|
+
children,
|
|
9
|
+
composer,
|
|
10
|
+
header,
|
|
11
|
+
footer,
|
|
12
|
+
bottomInset = 0,
|
|
13
|
+
style,
|
|
14
|
+
testID
|
|
15
|
+
}) {
|
|
16
|
+
const styles = useThemedStyles(createStyles);
|
|
17
|
+
const paddingBottom = Number.isFinite(bottomInset) ? Math.max(0, bottomInset) : 0;
|
|
18
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
19
|
+
style: [styles.root, {
|
|
20
|
+
paddingBottom
|
|
21
|
+
}, style],
|
|
22
|
+
testID: testID,
|
|
23
|
+
children: [header, /*#__PURE__*/_jsx(View, {
|
|
24
|
+
style: styles.messages,
|
|
25
|
+
children: children
|
|
26
|
+
}), composer, footer]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=Chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["View","useThemedStyles","createStyles","jsx","_jsx","jsxs","_jsxs","Chat","children","composer","header","footer","bottomInset","style","testID","styles","paddingBottom","Number","isFinite","Math","max","root","messages"],"sourceRoot":"../../../../src","sources":["components/Chat/Chat.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,cAAc;AACnC,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,YAAY,QAAQ,aAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAExC,OAAO,SAASC,IAAIA,CAAC;EACnBC,QAAQ;EACRC,QAAQ;EACRC,MAAM;EACNC,MAAM;EACNC,WAAW,GAAG,CAAC;EACfC,KAAK;EACLC;AACS,CAAC,EAAE;EACZ,MAAMC,MAAM,GAAGd,eAAe,CAACC,YAAY,CAAC;EAC5C,MAAMc,aAAa,GAAGC,MAAM,CAACC,QAAQ,CAACN,WAAW,CAAC,GAC9CO,IAAI,CAACC,GAAG,CAAC,CAAC,EAAER,WAAW,CAAC,GACxB,CAAC;EACL,oBACEN,KAAA,CAACN,IAAI;IAACa,KAAK,EAAE,CAACE,MAAM,CAACM,IAAI,EAAE;MAAEL;IAAc,CAAC,EAAEH,KAAK,CAAE;IAACC,MAAM,EAAEA,MAAO;IAAAN,QAAA,GAClEE,MAAM,eACPN,IAAA,CAACJ,IAAI;MAACa,KAAK,EAAEE,MAAM,CAACO,QAAS;MAAAd,QAAA,EAAEA;IAAQ,CAAO,CAAC,EAC9CC,QAAQ,EACRE,MAAM;EAAA,CACH,CAAC;AAEX","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Chat"],"sourceRoot":"../../../../src","sources":["components/Chat/index.ts"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,WAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
|
+
export const createStyles = colors => StyleSheet.create({
|
|
5
|
+
root: {
|
|
6
|
+
flex: 1,
|
|
7
|
+
minHeight: 0,
|
|
8
|
+
minWidth: 0,
|
|
9
|
+
backgroundColor: colors.background
|
|
10
|
+
},
|
|
11
|
+
messages: {
|
|
12
|
+
flex: 1,
|
|
13
|
+
minHeight: 0,
|
|
14
|
+
minWidth: 0
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","createStyles","colors","create","root","flex","minHeight","minWidth","backgroundColor","background","messages"],"sourceRoot":"../../../../src","sources":["components/Chat/styles.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AAEzC,OAAO,MAAMC,YAAY,GAAIC,MAAmB,IAC9CF,UAAU,CAACG,MAAM,CAAC;EAChBC,IAAI,EAAE;IACJC,IAAI,EAAE,CAAC;IACPC,SAAS,EAAE,CAAC;IACZC,QAAQ,EAAE,CAAC;IACXC,eAAe,EAAEN,MAAM,CAACO;EAC1B,CAAC;EACDC,QAAQ,EAAE;IAAEL,IAAI,EAAE,CAAC;IAAEC,SAAS,EAAE,CAAC;IAAEC,QAAQ,EAAE;EAAE;AACjD,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/Chat/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Text } from 'react-native';
|
|
4
|
+
import { useThemedStyles } from '@unif/react-native-design';
|
|
5
|
+
import { createStyles } from "./styles.js";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
export function Citation({
|
|
8
|
+
label,
|
|
9
|
+
onPress,
|
|
10
|
+
disabled = false,
|
|
11
|
+
accessibilityLabel = `引用${label}`,
|
|
12
|
+
testID
|
|
13
|
+
}) {
|
|
14
|
+
const styles = useThemedStyles(createStyles);
|
|
15
|
+
const handlePress = event => {
|
|
16
|
+
event.stopPropagation();
|
|
17
|
+
onPress?.();
|
|
18
|
+
};
|
|
19
|
+
return /*#__PURE__*/_jsxs(Text, {
|
|
20
|
+
style: [styles.citation, disabled && styles.disabled],
|
|
21
|
+
onPress: disabled || !onPress ? undefined : handlePress,
|
|
22
|
+
accessibilityRole: onPress ? 'link' : undefined,
|
|
23
|
+
accessibilityLabel: accessibilityLabel,
|
|
24
|
+
accessibilityState: {
|
|
25
|
+
disabled
|
|
26
|
+
},
|
|
27
|
+
suppressHighlighting: disabled || !onPress,
|
|
28
|
+
testID: testID,
|
|
29
|
+
children: ["[", label, "]"]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=Citation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Text","useThemedStyles","createStyles","jsxs","_jsxs","Citation","label","onPress","disabled","accessibilityLabel","testID","styles","handlePress","event","stopPropagation","style","citation","undefined","accessibilityRole","accessibilityState","suppressHighlighting","children"],"sourceRoot":"../../../../src","sources":["components/Citation/Citation.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,cAAc;AAEnC,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,YAAY,QAAQ,aAAU;AAAC,SAAAC,IAAA,IAAAC,KAAA;AAGxC,OAAO,SAASC,QAAQA,CAAC;EACvBC,KAAK;EACLC,OAAO;EACPC,QAAQ,GAAG,KAAK;EAChBC,kBAAkB,GAAG,KAAKH,KAAK,EAAE;EACjCI;AACa,CAAC,EAAqB;EACnC,MAAMC,MAAM,GAAGV,eAAe,CAACC,YAAY,CAAC;EAC5C,MAAMU,WAAW,GAAIC,KAA4B,IAAK;IACpDA,KAAK,CAACC,eAAe,CAAC,CAAC;IACvBP,OAAO,GAAG,CAAC;EACb,CAAC;EAED,oBACEH,KAAA,CAACJ,IAAI;IACHe,KAAK,EAAE,CAACJ,MAAM,CAACK,QAAQ,EAAER,QAAQ,IAAIG,MAAM,CAACH,QAAQ,CAAE;IACtDD,OAAO,EAAEC,QAAQ,IAAI,CAACD,OAAO,GAAGU,SAAS,GAAGL,WAAY;IACxDM,iBAAiB,EAAEX,OAAO,GAAG,MAAM,GAAGU,SAAU;IAChDR,kBAAkB,EAAEA,kBAAmB;IACvCU,kBAAkB,EAAE;MAAEX;IAAS,CAAE;IACjCY,oBAAoB,EAAEZ,QAAQ,IAAI,CAACD,OAAQ;IAC3CG,MAAM,EAAEA,MAAO;IAAAW,QAAA,GAChB,GACE,EAACf,KAAK,EAAC,GACV;EAAA,CAAM,CAAC;AAEX","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Citation"],"sourceRoot":"../../../../src","sources":["components/Citation/index.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,eAAY","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
|
+
import { fw, type } from '@unif/react-native-design';
|
|
5
|
+
export const createStyles = colors => StyleSheet.create({
|
|
6
|
+
citation: {
|
|
7
|
+
color: colors.primary,
|
|
8
|
+
fontSize: type.xxs,
|
|
9
|
+
fontWeight: fw.semi
|
|
10
|
+
},
|
|
11
|
+
disabled: {
|
|
12
|
+
color: colors.foregroundSubtle
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","fw","type","createStyles","colors","create","citation","color","primary","fontSize","xxs","fontWeight","semi","disabled","foregroundSubtle"],"sourceRoot":"../../../../src","sources":["components/Citation/styles.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,EAAE,EAAEC,IAAI,QAAQ,2BAA2B;AAGpD,OAAO,MAAMC,YAAY,GAAIC,MAAmB,IAC9CJ,UAAU,CAACK,MAAM,CAAC;EAChBC,QAAQ,EAAE;IACRC,KAAK,EAAEH,MAAM,CAACI,OAAO;IACrBC,QAAQ,EAAEP,IAAI,CAACQ,GAAG;IAClBC,UAAU,EAAEV,EAAE,CAACW;EACjB,CAAC;EACDC,QAAQ,EAAE;IACRN,KAAK,EAAEH,MAAM,CAACU;EAChB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/Citation/types.ts"],"mappings":"","ignoreList":[]}
|