react-mail-inbox 1.0.2 → 1.0.4

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Gmail Inbox Component
1
+ # React Mail Inbox Component
2
2
 
3
3
  A fully customizable, Gmail-style inbox component built with React, featuring a rich text editor powered by Lexical.
4
4
 
@@ -15,11 +15,11 @@ A fully customizable, Gmail-style inbox component built with React, featuring a
15
15
  ## Installation
16
16
 
17
17
  ```bash
18
- npm install @your-org/gmail-inbox
18
+ npm install react-mail-inbox
19
19
  # or
20
- yarn add @your-org/gmail-inbox
20
+ yarn add react-mail-inbox
21
21
  # or
22
- pnpm add @your-org/gmail-inbox
22
+ pnpm add react-mail-inbox
23
23
  ```
24
24
 
25
25
  ### Peer Dependencies
@@ -38,8 +38,8 @@ This package requires the following peer dependencies:
38
38
  ### Basic Example
39
39
 
40
40
  ```tsx
41
- import GmailInbox, { type EmailData, type EmailOption } from '@your-org/gmail-inbox';
42
- import '@your-org/gmail-inbox/styles.css';
41
+ import GmailInbox, { type EmailData, type EmailOption } from "react-mail-inbox";
42
+ import "react-mail-inbox/styles.css";
43
43
 
44
44
  function App() {
45
45
  // Fetch email suggestions from your API
@@ -50,12 +50,12 @@ function App() {
50
50
 
51
51
  // Handle email submission
52
52
  const handleSendEmail = (emailData: EmailData) => {
53
- console.log('Sending email:', emailData);
53
+ console.log("Sending email:", emailData);
54
54
  // Send to your backend API
55
- fetch('/api/emails/send', {
56
- method: 'POST',
57
- headers: { 'Content-Type': 'application/json' },
58
- body: JSON.stringify(emailData)
55
+ fetch("/api/emails/send", {
56
+ method: "POST",
57
+ headers: { "Content-Type": "application/json" },
58
+ body: JSON.stringify(emailData),
59
59
  });
60
60
  };
61
61
 
@@ -72,21 +72,21 @@ function App() {
72
72
  ### With Theme Control
73
73
 
74
74
  ```tsx
75
- import GmailInbox, { useTheme, type Theme } from '@your-org/gmail-inbox';
75
+ import GmailInbox, { useTheme, type Theme } from "react-mail-inbox";
76
76
 
77
77
  function ThemeToggle() {
78
78
  const { theme, toggleTheme } = useTheme();
79
79
 
80
80
  return (
81
81
  <button onClick={toggleTheme}>
82
- {theme === 'dark' ? '☀️ Light' : '🌙 Dark'}
82
+ {theme === "dark" ? "☀️ Light" : "🌙 Dark"}
83
83
  </button>
84
84
  );
85
85
  }
86
86
 
87
87
  function App() {
88
88
  const handleThemeChange = (theme: Theme) => {
89
- console.log('Theme changed to:', theme);
89
+ console.log("Theme changed to:", theme);
90
90
  // Save to localStorage, etc.
91
91
  };
92
92
 
@@ -105,13 +105,13 @@ function App() {
105
105
  ### With Initial Data
106
106
 
107
107
  ```tsx
108
- import GmailInbox, { type EmailData } from '@your-org/gmail-inbox';
108
+ import GmailInbox, { type EmailData } from "react-mail-inbox";
109
109
 
110
110
  function ReplyToEmail() {
111
111
  const initialData: Partial<EmailData> = {
112
- to: [{ email: 'recipient@example.com', name: 'John Doe' }],
113
- subject: 'Re: Previous conversation',
114
- body: '<p>Thanks for your message!</p>',
112
+ to: [{ email: "recipient@example.com", name: "John Doe" }],
113
+ subject: "Re: Previous conversation",
114
+ body: "<p>Thanks for your message!</p>",
115
115
  };
116
116
 
117
117
  return (
@@ -128,15 +128,15 @@ function ReplyToEmail() {
128
128
 
129
129
  ### GmailInbox Props
130
130
 
131
- | Prop | Type | Required | Description |
132
- |------|------|----------|-------------|
133
- | `fetchEmailOptions` | `(query: string) => Promise<EmailOption[]>` | ✅ | Async function to fetch email suggestions |
134
- | `handleChange` | `(emailData: EmailData) => void` | ✅ | Callback fired when user sends email |
135
- | `initialData` | `Partial<EmailData>` | ❌ | Pre-populate email fields |
136
- | `initialTheme` | `'light' \| 'dark'` | ❌ | Initial theme (default: `'dark'`) |
137
- | `onThemeChange` | `(theme: Theme) => void` | ❌ | Callback when theme changes |
138
- | `leftChildren` | `ReactNode` | ❌ | Custom content for left side of header |
139
- | `rightChildren` | `ReactNode` | ❌ | Custom content for right side of header |
131
+ | Prop | Type | Required | Description |
132
+ | ------------------- | ------------------------------------------- | -------- | ----------------------------------------- |
133
+ | `fetchEmailOptions` | `(query: string) => Promise<EmailOption[]>` | ✅ | Async function to fetch email suggestions |
134
+ | `handleChange` | `(emailData: EmailData) => void` | ✅ | Callback fired when user sends email |
135
+ | `initialData` | `Partial<EmailData>` | ❌ | Pre-populate email fields |
136
+ | `initialTheme` | `'light' \| 'dark'` | ❌ | Initial theme (default: `'dark'`) |
137
+ | `onThemeChange` | `(theme: Theme) => void` | ❌ | Callback when theme changes |
138
+ | `leftChildren` | `ReactNode` | ❌ | Custom content for left side of header |
139
+ | `rightChildren` | `ReactNode` | ❌ | Custom content for right side of header |
140
140
 
141
141
  ### Types
142
142
 
@@ -148,7 +148,7 @@ interface EmailData {
148
148
  cc: EmailOption[];
149
149
  bcc: EmailOption[];
150
150
  subject: string;
151
- body: string; // HTML string
151
+ body: string; // HTML string
152
152
  attachments: File[];
153
153
  }
154
154
  ```
@@ -165,7 +165,7 @@ interface EmailOption {
165
165
  #### Theme
166
166
 
167
167
  ```typescript
168
- type Theme = 'light' | 'dark';
168
+ type Theme = "light" | "dark";
169
169
  ```
170
170
 
171
171
  ### useTheme Hook
@@ -181,7 +181,7 @@ const { theme, toggleTheme, setTheme } = useTheme();
181
181
  The component comes with default styles that you must import:
182
182
 
183
183
  ```tsx
184
- import '@your-org/gmail-inbox/styles.css';
184
+ import "react-mail-inbox/styles.css";
185
185
  ```
186
186
 
187
187
  ### CSS Custom Properties