Package Exports
- blip-cards-react-components
- blip-cards-react-components/package.json
- blip-cards-react-components/style.css
Readme
BLiP Cards React Components
โจ Features
- ๐ Modern Stack: Built with React 18, TypeScript 5, and Vite
- ๐ฑ Multi-Channel Support: WhatsApp interactive components and more
- ๐จ Design System: Powered by
@lucasmiqueias/blip-tokensfor consistent theming - ๐งฉ Interactive Elements: Quick replies, lists, buttons, and carousels
- ๐งช Well Tested: Comprehensive test suite with Vitest and Testing Library
- ๐ฆ Tree Shakeable: Optimized bundle size with ESM support
- ๐ง Developer Experience: TypeScript, hot reload, and comprehensive tooling
- ๐ Theme Support: Light/dark mode compatible
- โก Performance: Optimized rendering and minimal bundle size
- ๐ React Port: Based on official blip-cards-vue-componentsion](https://badge.fury.io/js/blip-cards-react-components.svg)](https://badge.fury.io/js/blip-cards-react-components)
Unofficial React port of [blip-cards-vue-componen## ## ๐ Support & Community
- ๐ Report Issues
- ๐ฌ Discussions
๐ Related Projectsport & Community
- ๐ Report Issues
- ๐ฌ Discussionshttps://github.com/takenet/blip-cards-vue-components). A comprehensive React component library for rendering BLiP conversational messages with support for multiple channels, interactive elements, and modern TypeScript development.
โ ๏ธ Note: This is an unofficial community project and is not maintained by Take/BLiP team. For official components, please use blip-cards-vue-components.
๐ About This Project
This project is a React port of the official blip-cards-vue-components library. It aims to provide React developers with the same powerful BLiP message rendering capabilities that Vue developers enjoy.
Why This Port?
- React Ecosystem: Bring BLiP Cards to React applications
- Component Parity: Match the functionality of the original Vue components
- Modern React: Built with React 18, hooks, and modern patterns
- TypeScript First: Full TypeScript support for better developer experience
- Community Driven: Open for contributions and improvements
โจ Features
- ๐ Modern Stack: Built with React 18, TypeScript 5, and Vite
- ๐ฑ Multi-Channel Support: WhatsApp interactive components and more
- ๐จ Customizable Design: CSS variables and themes support
- ๐งฉ Interactive Elements: Quick replies, lists, buttons, and carousels
- ๐งช Well Tested: Comprehensive test suite with Vitest and Testing Library
- ๐ฆ Tree Shakeable: Optimized bundle size with ESM support
- ๐ง Developer Experience: TypeScript, hot reload, and comprehensive tooling
- ๏ฟฝ Theme Support: Light/dark mode compatible
- โก Performance: Optimized rendering and minimal bundle size
- ๏ฟฝ React Port: Based on official blip-cards-vue-components
๐ฎ Demo
๐ง Coming Soon: Live demo will be available soon. For now, you can run the development server locally to see the components in action.
git clone https://github.com/lucasmiqueias/blip-cards-react-components.git
cd blip-cards-react-components
npm install
npm run dev๐ฆ Installation
npm install blip-cards-react-componentsOr with other package managers:
# Yarn
yarn add blip-cards-react-components
# pnpm
pnpm add blip-cards-react-components
# Bun
bun add blip-cards-react-componentsDesign Tokens
This library uses @lucasmiqueias/blip-tokens for consistent design tokens. It's automatically installed as a dependency, providing:
- CSS custom properties for theming
- TypeScript theme utilities
- Consistent spacing, colors, and typography
Peer Dependencies
Make sure you have the required peer dependencies installed:
npm install react react-dom๐ Quick Start
import React from "react";
import { BlipCard } from "blip-cards-react-components";
import "blip-cards-react-components/dist/style.css";
function App() {
const message = {
id: "1",
type: "text/plain",
content: "Hello! Welcome to BLiP Cards React Components ๐",
date: new Date().toISOString(),
};
return (
<BlipCard
document={message}
position="left"
date={new Date().toLocaleTimeString()}
status="received"
memberInfo={{
name: "BLiP Assistant",
photo: "https://example.com/avatar.png",
}}
/>
);
}
export default App;๐ Components
BlipCard
Main component for rendering BLiP messages with automatic type detection.
import { BlipCard } from "blip-cards-react-components";
<BlipCard
document={{
id: "1",
type: "text/plain",
content: "Hello World!",
date: "2024-01-01T10:00:00Z",
}}
position="left"
date="10:00 AM"
status="received"
editable={true}
onSave={(doc) => console.log("Saved:", doc)}
/>;PlainText
Component for rendering plain text messages with advanced features.
import { PlainText } from "blip-cards-react-components";
<PlainText
document="This is a plain text message with long content that can be truncated..."
position="right"
editable={true}
deletable={true}
showMoreText="Read more"
onSave={(doc) => handleSave(doc)}
onDelete={(doc) => handleDelete(doc)}
/>;QuickReply
Interactive quick reply buttons for user selections.
const quickReplyDoc = {
type: "application/vnd.lime.select+json",
content: {
text: "Choose an option:",
options: [
{ text: "Option 1", value: { action: "option1" } },
{ text: "Option 2", value: { action: "option2" } },
],
},
};
<BlipCard document={quickReplyDoc} position="left" />;WhatsApp Interactive
Support for WhatsApp Business API interactive messages.
const whatsappList = {
type: "application/json",
content: {
type: "interactive",
interactive: {
type: "list",
body: { text: "Select an option from the list:" },
action: {
button: "View Options",
sections: [
{
rows: [
{ id: "1", title: "Option 1", description: "Description 1" },
{ id: "2", title: "Option 2", description: "Description 2" },
],
},
],
},
},
},
};
<BlipCard document={whatsappList} position="left" />;๐จ Styling & Theming
The library uses CSS custom properties for easy customization:
:root {
/* Colors */
--surface-0: #ffffff;
--surface-1: #f8f9fa;
--surface-2: #e9ecef;
--surface-3: #dee2e6;
/* Content */
--content-default: #212529;
--content-muted: #6c757d;
/* Spacing */
--spacing-1: 0.25rem;
--spacing-2: 0.5rem;
--spacing-3: 1rem;
/* Typography */
--font-size-xs: 0.75rem;
--font-size-sm: 0.875rem;
--font-size-base: 1rem;
/* Border */
--radius-sm: 0.25rem;
--radius-lg: 0.5rem;
--radius-full: 9999px;
}Dark Theme
[data-theme="dark"] {
--surface-0: #1a1a1a;
--surface-1: #2d2d2d;
--content-default: #ffffff;
--content-muted: #a0a0a0;
}๐ API Reference
BlipDocument Interface
interface BlipDocument {
id?: string;
to?: string;
type: string;
direction?: "sent" | "received";
content?: any;
date: string;
status?: "received";
metadata?: Record<string, any>;
}BlipCardProps Interface
interface BlipCardProps {
document: BlipDocument;
position: "left" | "right";
date?: string;
status?: "sending" | "sent" | "received" | "failed";
editable?: boolean;
deletable?: boolean;
memberInfo?: MemberInfo;
photo?: string;
editing?: boolean;
externalMessage?: boolean;
translations?: {
externalMessageText?: string;
messageDeleted?: string;
showMoreText?: string;
};
onSave?: (document: BlipDocument) => void;
onDelete?: (document: BlipDocument) => void;
onCancel?: () => void;
onEdit?: () => void;
}๐ ๏ธ Development
Prerequisites
- Node.js 18+
- npm, yarn, pnpm, or bun
Setup
# Clone the repository
git clone https://github.com/lucasmiqueias/blip-cards-react-components.git
cd blip-cards-react-components
# Install dependencies
npm install
# Start development server
npm run dev
# Run tests
npm test
# Build library
npm run build:libAvailable Scripts
| Script | Description |
|---|---|
npm run dev |
Start development server with Vite |
npm run build |
Build for production |
npm run build:lib |
Build library for distribution |
npm run test |
Run tests with Vitest |
npm run test:ui |
Run tests with UI interface |
npm run test:coverage |
Run tests with coverage report |
npm run lint |
Run ESLint |
npm run lint:fix |
Fix ESLint issues automatically |
npm run type-check |
Run TypeScript type checking |
Publishing to NPM
This project includes automated publishing via GitHub Actions. To publish a new version:
Update version:
npm version patch # or minor, major
Create a GitHub release:
- Go to GitHub repository
- Create a new release with the version tag
- This will automatically trigger the publish workflow
Manual publishing (if needed):
npm run prepublishOnly # Run all checks npm publish # Publish to NPM
NPM Scripts for Publishing
npm run prepublishOnly- Runs all checks before publishingnpm run version- Builds and stages dist filesnpm run postversion- Pushes tags to GitHub
Docker Development
# Start development environment
docker-compose up dev
# Run tests
docker-compose up test
# Build production
docker-compose up build๐งช Testing
We maintain high test coverage with comprehensive unit and integration tests:
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Generate coverage report
npm run test:coverage
# Run tests with UI
npm run test:uiTest Structure
src/
โโโ components/
โ โโโ __tests__/
โ โ โโโ BlipCard.test.tsx
โ โ โโโ PlainText.test.tsx
โ โ โโโ Reply.test.tsx
โ โโโ WhatsApp/
โ โโโ Interactive/
โ โโโ List/
โ โโโ __tests__/
โ โโโ WhatsAppList.test.tsx๐ค Contributing
We welcome contributions! This is a community-driven project.
Development Workflow
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Run tests:
npm test - Run linting:
npm run lint:fix - Commit your changes:
git commit -m 'feat: add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
Commit Convention
This project follows Conventional Commits:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changesstyle:- Code style changes (formatting, etc)refactor:- Code refactoringtest:- Adding or updating testschore:- Build process or auxiliary tool changes
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Support & Community
- ๏ฟฝ Report Issues
- ๏ฟฝ Discussions
๏ฟฝ Related Projects
- blip-cards-vue-components - Official Vue.js components (original project)
- BLiP Platform - Conversational AI platform
- BLiP SDK for JavaScript
๐ข Official Support
For official BLiP support and enterprise features, please contact Take team directly:
Community project inspired by blip-cards-vue-components
Original BLiP Cards made with โค๏ธ by the Take Team