@megha-ui/react 1.2.180 → 1.2.181

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.
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  const Button = ({ text, color, icon, fontSize, fontWeight, onClick, gap = "0.5rem", borderWidth = 1, borderColor, borderRadius = "0.25rem", border = true, backgroundColor, borderStyle = "solid", cursor = "pointer", type, width, paddingBottom = "0.35rem", paddingLeft = "0.65rem", paddingRight = "0.65rem", paddingTop = "0.35rem", marginBottom, marginLeft, marginRight, marginTop, disabled = false, style, className, iconPosition = "before", textEleClass = "", }) => {
3
3
  const buttonStyle = Object.assign({ color,
4
4
  fontSize,
5
- fontWeight, display: "flex", alignItems: "center", justifyContent: "center", gap, cursor: disabled ? "not-allowed" : cursor, borderColor, backgroundColor: disabled ? "#D3D3D3" : backgroundColor, borderWidth, border: border ? `${borderWidth} ${borderStyle} ${borderColor}` : "none", borderRadius, fontFamily: "var(--font-family)", width,
5
+ fontWeight, display: "flex", alignItems: "center", justifyContent: "center", gap, cursor: disabled ? "not-allowed" : cursor, borderColor, backgroundColor: disabled ? "var(--disabled-bg)" : backgroundColor, borderWidth, border: border ? `${borderWidth} ${borderStyle} ${borderColor}` : "none", borderRadius, fontFamily: "var(--font-family)", width,
6
6
  paddingBottom,
7
7
  paddingLeft,
8
8
  paddingRight,
@@ -29,7 +29,7 @@ const ChatDetails = ({ selectedUser, currentUserId }) => {
29
29
  if (!selectedUser) {
30
30
  return _jsx("div", { className: "wk-chat-placeholder", style: { flex: 1, padding: 16 }, children: "Select a chat" });
31
31
  }
32
- return (_jsxs("div", { className: "wk-chat-details", style: { flex: 1, display: "flex", flexDirection: "column" }, children: [_jsxs("div", { className: "wk-chat-header", style: { display: "flex", alignItems: "center", padding: "8px", borderBottom: "1px solid #f5f5f5" }, children: [_jsx("div", { className: "wk-chat-user-icon", style: {
32
+ return (_jsxs("div", { className: "wk-chat-details", style: { flex: 1, display: "flex", flexDirection: "column" }, children: [_jsxs("div", { className: "wk-chat-header", style: { display: "flex", alignItems: "center", padding: "8px", borderBottom: "1px solid var(--divider, #f5f5f5)" }, children: [_jsx("div", { className: "wk-chat-user-icon", style: {
33
33
  width: 32,
34
34
  height: 32,
35
35
  borderRadius: "50%",
@@ -47,15 +47,15 @@ const ChatDetails = ({ selectedUser, currentUserId }) => {
47
47
  display: "flex",
48
48
  justifyContent: m.senderId === currentUserId ? "flex-end" : "flex-start",
49
49
  }, children: _jsx("div", { style: {
50
- background: m.senderId === currentUserId ? "#F9F9F9" : "#EAF2FA",
50
+ background: m.senderId === currentUserId ? "var(--background)" : "var(--background)",
51
51
  padding: "6px 8px",
52
52
  borderRadius: 4,
53
53
  maxWidth: "70%",
54
- }, children: m.text }) }, m.id))), _jsx("div", { ref: endRef })] }), _jsxs("div", { className: "wk-chat-input", style: { display: "flex", padding: 8, borderTop: "1px solid #f5f5f5" }, children: [_jsx("input", { type: "text", value: newMessage, onChange: (e) => setNewMessage(e.target.value), onKeyDown: (e) => {
54
+ }, children: m.text }) }, m.id))), _jsx("div", { ref: endRef })] }), _jsxs("div", { className: "wk-chat-input", style: { display: "flex", padding: 8, borderTop: "1px solid var(--divider, #f5f5f5)" }, children: [_jsx("input", { type: "text", value: newMessage, onChange: (e) => setNewMessage(e.target.value), onKeyDown: (e) => {
55
55
  if (e.key === "Enter") {
56
56
  e.preventDefault();
57
57
  handleSend();
58
58
  }
59
- }, style: { flex: 1, border: "1px solid #dbdfe9", borderRadius: 4, padding: "6px" } }), _jsx("button", { onClick: handleSend, style: { marginLeft: 8, background: "transparent", border: "none", cursor: "pointer" }, children: _jsx(VscSend, { size: 20 }) })] })] }));
59
+ }, style: { flex: 1, border: "1px solid var(--form-border-color, #dbdfe9)", borderRadius: 4, padding: "6px" } }), _jsx("button", { onClick: handleSend, style: { marginLeft: 8, background: "transparent", border: "none", cursor: "pointer" }, children: _jsx(VscSend, { size: 20 }) })] })] }));
60
60
  };
61
61
  export default ChatDetails;
@@ -27,7 +27,7 @@ const ChatList = ({ users, onSelectUser, selectedUserId, unreadCounts = {}, }) =
27
27
  padding: "8px",
28
28
  cursor: "pointer",
29
29
  display: "flex",
30
- borderBottom: "1px solid #f5f5f5",
30
+ borderBottom: "1px solid var(--divider, #f5f5f5)",
31
31
  }, children: [_jsx("div", { className: "wk-chat-user-icon", style: {
32
32
  width: 32,
33
33
  height: 32,
@@ -41,7 +41,7 @@ const ChatList = ({ users, onSelectUser, selectedUserId, unreadCounts = {}, }) =
41
41
  textTransform: "uppercase",
42
42
  }, children: user.isGroup ? (_jsx(FaUsers, {})) : (`${(_a = user.firstName) === null || _a === void 0 ? void 0 : _a[0]}${(_b = user.lastName) === null || _b === void 0 ? void 0 : _b[0]}`) }), _jsxs("div", { style: { flex: 1 }, children: [_jsx("div", { style: { fontWeight: "bold" }, children: user.isGroup
43
43
  ? user.firstName
44
- : `${user.firstName} ${user.lastName}` }), _jsx("div", { style: { fontSize: "0.8rem", color: "#555" }, children: user.latestMessageText || "No messages yet" })] }), unreadCounts[user.id] > 0 && (_jsx("span", { style: {
44
+ : `${user.firstName} ${user.lastName}` }), _jsx("div", { style: { fontSize: "0.8rem", color: "var(--foreground)" }, children: user.latestMessageText || "No messages yet" })] }), unreadCounts[user.id] > 0 && (_jsx("span", { style: {
45
45
  marginLeft: "auto",
46
46
  background: "#0096c7",
47
47
  color: "#fff",
@@ -52,7 +52,7 @@ const ChatList = ({ users, onSelectUser, selectedUserId, unreadCounts = {}, }) =
52
52
  alignItems: "center",
53
53
  justifyContent: "center",
54
54
  fontSize: "0.75rem",
55
- }, children: unreadCounts[user.id] })), _jsx("div", { style: { marginLeft: 8, fontSize: "0.75rem", color: "#888" }, children: formatTimestamp(user.latestMessageTimestamp) })] }, user.id));
55
+ }, children: unreadCounts[user.id] })), _jsx("div", { style: { marginLeft: 8, fontSize: "0.75rem", color: "var(--foreground)" }, children: formatTimestamp(user.latestMessageTimestamp) })] }, user.id));
56
56
  })) : (_jsx("div", { style: { padding: 16, textAlign: "center" }, children: _jsx(Loader, { size: 24 }) })) }));
57
57
  };
58
58
  export default ChatList;
@@ -4,6 +4,6 @@ import ChatList from "./components/ChatList";
4
4
  import ChatDetails from "./components/ChatDetails";
5
5
  const Chat = ({ users, currentUserId }) => {
6
6
  const [selectedUser, setSelectedUser] = useState(null);
7
- return (_jsxs("div", { className: "wk-chat-container", style: { display: "flex", border: "1px solid #dbdfe9", height: "400px" }, children: [_jsx(ChatList, { users: users, onSelectUser: setSelectedUser, selectedUserId: selectedUser === null || selectedUser === void 0 ? void 0 : selectedUser.id }), _jsx(ChatDetails, { selectedUser: selectedUser, currentUserId: currentUserId })] }));
7
+ return (_jsxs("div", { className: "wk-chat-container", style: { display: "flex", border: "1px solid var(--form-border-color, #dbdfe9)", height: "400px" }, children: [_jsx(ChatList, { users: users, onSelectUser: setSelectedUser, selectedUserId: selectedUser === null || selectedUser === void 0 ? void 0 : selectedUser.id }), _jsx(ChatDetails, { selectedUser: selectedUser, currentUserId: currentUserId })] }));
8
8
  };
9
9
  export default Chat;
@@ -238,7 +238,7 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
238
238
  paddingBottom: 6,
239
239
  paddingLeft: "1rem",
240
240
  paddingRight: "1rem",
241
- borderBottom: "1px solid #dddddd",
241
+ borderBottom: "1px solid var(--divider-strong, #dddddd)",
242
242
  cursor: "pointer",
243
243
  };
244
244
  const listItemDisabledStyle = {
@@ -26,8 +26,10 @@ const Pagination = ({ currentPage, totalPages, handleChangePage, rowsPerPage, ha
26
26
  }
27
27
  return pageNumbers;
28
28
  };
29
- return (_jsx("div", { className: "pagination text-sm px-2.5", children: _jsxs("div", { children: [_jsx("button", { onClick: () => handleChangePage(currentPage - 1), disabled: currentPage === 1, style: currentPage === 1 ? { cursor: "not-allowed", color: "#ccc" } : {}, children: "Prev" }), renderPageNumbers(), _jsx("button", { onClick: () => handleChangePage(currentPage + 1), disabled: currentPage >= totalPages, style: currentPage >= totalPages
30
- ? { cursor: "not-allowed", color: "#ccc" }
29
+ return (_jsx("div", { className: "pagination text-sm px-2.5", children: _jsxs("div", { children: [_jsx("button", { onClick: () => handleChangePage(currentPage - 1), disabled: currentPage === 1, style: currentPage === 1
30
+ ? { cursor: "not-allowed", color: "var(--muted, #ccc)" }
31
+ : {}, children: "Prev" }), renderPageNumbers(), _jsx("button", { onClick: () => handleChangePage(currentPage + 1), disabled: currentPage >= totalPages, style: currentPage >= totalPages
32
+ ? { cursor: "not-allowed", color: "var(--muted, #ccc)" }
31
33
  : {}, children: "Next" }), _jsx("select", { value: rowsPerPage, onChange: handleChangeRowsPerPage, children: rowsPerPageOptions.map((option) => (_jsx("option", { value: option, children: option }, option))) })] }) }));
32
34
  };
33
35
  export default Pagination;
@@ -14,8 +14,14 @@ const Shimmer = ({ style, width, height }) => {
14
14
  overflow: hidden;
15
15
  display: flex;
16
16
  align-items: center;
17
- background: #f6f7f8;
18
- background-image: linear-gradient(to right, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%);
17
+ background: var(--shimmer-base, #f6f7f8);
18
+ background-image: linear-gradient(
19
+ to right,
20
+ var(--shimmer-base, #f6f7f8) 0%,
21
+ var(--shimmer-highlight, #edeef1) 20%,
22
+ var(--shimmer-base, #f6f7f8) 40%,
23
+ var(--shimmer-base, #f6f7f8) 100%
24
+ );
19
25
  background-repeat: no-repeat;
20
26
  background-size: 1000px 100%;
21
27
  animation: shimmer 1.2s infinite;
@@ -17,7 +17,7 @@ const Spinner = styled.div `
17
17
  border-radius: 50%;
18
18
  animation: ${spin} 1s linear infinite;
19
19
  `;
20
- const Loader = ({ size = 40, color = "#3498db", className = "", }) => {
20
+ const Loader = ({ size = 24, color = "var(--accent, #3498db)", className = "", }) => {
21
21
  return _jsx(Spinner, { size: size, color: color, className: className });
22
22
  };
23
23
  export default Loader;
@@ -10,7 +10,7 @@ const Textarea = ({ value = "", onChange, onBlur = () => { }, placeholder = "",
10
10
  borderRadius,
11
11
  fontSize,
12
12
  resize,
13
- border: "1px solid #dbdfe9",
13
+ border: "1px solid var(--form-border-color, #dbdfe9)",
14
14
  fontFamily: "var(--font-family)",
15
15
  };
16
16
  const labelStyle = {
@@ -204,7 +204,7 @@ const TextEditor = ({ value, onChange, enabledTools = {
204
204
  };
205
205
  return (_jsxs("div", { style: {
206
206
  width: "100%",
207
- border: "1px solid #ccc",
207
+ border: "1px solid var(--divider, #ccc)",
208
208
  borderRadius: "0.25rem",
209
209
  padding: "0.65rem",
210
210
  position: "relative",
@@ -212,7 +212,7 @@ const TextEditor = ({ value, onChange, enabledTools = {
212
212
  display: "flex",
213
213
  gap: "0.65rem",
214
214
  marginBottom: "0.65rem",
215
- borderBottom: "1px solid #ccc",
215
+ borderBottom: "1px solid var(--divider, #ccc)",
216
216
  paddingBottom: "0.25rem",
217
217
  flexWrap: "wrap",
218
218
  }, children: [enabledTools.headingOptions && (_jsxs("select", { onChange: (e) => applyHeading(e.target.value), style: buttonStyle, children: [_jsx("option", { value: "p", children: "Normal" }), _jsx("option", { value: "h1", children: "H1" }), _jsx("option", { value: "h2", children: "H2" }), _jsx("option", { value: "h3", children: "H3" })] })), enabledTools.bold && (_jsx("button", { type: "button", onClick: () => toggleFormat("bold"), style: buttonStyle, children: _jsx(IconBold, {}) })), enabledTools.italic && (_jsx("button", { type: "button", onClick: () => toggleFormat("italic"), style: buttonStyle, children: _jsx(IconItalic, {}) })), enabledTools.underline && (_jsx("button", { type: "button", onClick: () => toggleFormat("underline"), style: buttonStyle, children: _jsx(IconUnderline, {}) })), enabledTools.strikeThrough && (_jsx("button", { type: "button", onClick: () => toggleFormat("strikeThrough"), style: buttonStyle, children: _jsx(IconStrikethrough, {}) })), enabledTools.bulletList && (_jsx("button", { type: "button", onClick: () => insertList("ul"), style: buttonStyle, children: _jsx(IconFormatListBulleted, {}) })), enabledTools.numberList && (_jsx("button", { type: "button", onClick: () => insertList("ol"), style: buttonStyle, children: _jsx(IconFormatListNumbered, {}) })), enabledTools.textAlign && (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", onClick: () => toggleFormat("justifyLeft"), style: buttonStyle, children: _jsx(IconAlignLeft, {}) }), _jsx("button", { type: "button", onClick: () => toggleFormat("justifyCenter"), style: buttonStyle, children: _jsx(IconAlignCenter, {}) }), _jsx("button", { type: "button", onClick: () => toggleFormat("justifyRight"), style: buttonStyle, children: _jsx(IconAlignRight, {}) })] })), enabledTools.textColor && (_jsx("input", { type: "color", onChange: (e) => toggleFormat("foreColor", e.target.value), style: Object.assign(Object.assign({}, buttonStyle), { width: 32, padding: 0 }) })), enabledTools.imageUpload && (_jsxs("div", { style: { position: "relative" }, children: [_jsx("button", { type: "button", onClick: toggleImageDropdown, style: buttonStyle, children: _jsx(IconImage, {}) }), showImageDropdown && (_jsxs("div", { style: dropdownStyle, children: [_jsx("button", { type: "button", onClick: () => {
@@ -223,14 +223,14 @@ const TextEditor = ({ value, onChange, enabledTools = {
223
223
  }, style: dropdownItemStyle, children: "Insert from URL" }), _jsxs("label", { style: Object.assign(Object.assign({}, dropdownItemStyle), { cursor: "pointer" }), children: ["Upload from Computer", _jsx("input", { type: "file", accept: "image/*", onChange: handleImageUpload, style: { display: "none" } })] })] }))] })), enabledTools.linkOptions && (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", onClick: insertLink, style: buttonStyle, children: _jsx(IconLink, {}) }), _jsx("button", { type: "button", onClick: removeLink, style: buttonStyle, children: _jsx(IconUnlink, {}) })] }))] }), _jsx("div", { ref: editorRef, contentEditable: true, onInput: updateContent, onClick: handleEditorClick, suppressContentEditableWarning: true, style: {
224
224
  minHeight: "10rem",
225
225
  padding: "0.65rem",
226
- border: "1px solid #ddd",
226
+ border: "1px solid var(--divider-strong, #ddd)",
227
227
  borderRadius: "0.25rem",
228
228
  outline: "none",
229
229
  } })] }));
230
230
  };
231
231
  const buttonStyle = {
232
232
  padding: "0.25rem 0.65rem",
233
- border: "1px solid #ccc",
233
+ border: "1px solid var(--divider, #ccc)",
234
234
  borderRadius: "3px",
235
235
  cursor: "pointer",
236
236
  background: "var(--editor-btn)",
@@ -241,7 +241,7 @@ const dropdownStyle = {
241
241
  top: "100%",
242
242
  left: 0,
243
243
  background: "var(--editor-btn)",
244
- border: "1px solid #ccc",
244
+ border: "1px solid var(--divider, #ccc)",
245
245
  borderRadius: "3px",
246
246
  boxShadow: "0px 2px 0.25rem rgba(0, 0, 0, 0.2)",
247
247
  padding: "0.25rem",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.180",
3
+ "version": "1.2.181",
4
4
  "description": "A collection of reusable UI components for React applications, built with TypeScript.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",