@megha-ui/react 1.2.180 → 1.2.182
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/dist/components/button/index.js +1 -1
- package/dist/components/chat/components/ChatDetails.js +4 -4
- package/dist/components/chat/components/ChatList.js +3 -3
- package/dist/components/chat/index.js +1 -1
- package/dist/components/dropdown/index.js +1 -1
- package/dist/components/grid/utils/pagination.js +4 -2
- package/dist/components/grid/utils/shimmer.js +8 -2
- package/dist/components/loader/index.js +1 -1
- package/dist/components/modal/index.js +13 -1
- package/dist/components/textarea/index.js +1 -1
- package/dist/components/texteditor/index.js +5 -5
- package/package.json +1 -1
|
@@ -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 ? "
|
|
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 ? "
|
|
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: "
|
|
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: "
|
|
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
|
|
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(
|
|
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 =
|
|
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;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState, useRef } from "react";
|
|
3
|
+
import { MdClose } from "react-icons/md";
|
|
3
4
|
const Modal = ({ isOpen, onClose, title, subTitle, titleAlign = "left", children, footer, className = "", width, minHeight = 300, padding = "1rem", borderRadius = 6, backgroundColor = "var(--modal-bg)", paddingBottom = "1rem", paddingLeft = "1rem", paddingRight = "1rem", paddingTop = "1rem", contentHeight = "calc(100vh - 180)", overlayClose = false, alignItems, justifyContent, modalContentClass, bodyOverflow = "auto", }) => {
|
|
4
5
|
const [removelHeight, setRemovalHeight] = useState(0);
|
|
5
6
|
const footerRef = useRef(null);
|
|
@@ -58,7 +59,18 @@ const Modal = ({ isOpen, onClose, title, subTitle, titleAlign = "left", children
|
|
|
58
59
|
position: "relative",
|
|
59
60
|
marginBottom: 0,
|
|
60
61
|
padding: "1rem",
|
|
61
|
-
}, children: [_jsxs("div", { style: { textAlign: titleAlign }, children: [_jsx("h4", { style: { fontSize: "1.25rem" }, children: title }), _jsx("p", { style: { margin: 0 }, children: subTitle })] }), _jsx("button", {
|
|
62
|
+
}, children: [_jsxs("div", { style: { textAlign: titleAlign }, children: [_jsx("h4", { style: { fontSize: "1.25rem" }, children: title }), _jsx("p", { style: { margin: 0 }, children: subTitle })] }), _jsx("button", { type: "button", "aria-label": "Close", style: {
|
|
63
|
+
position: "absolute",
|
|
64
|
+
top: 10,
|
|
65
|
+
right: 10,
|
|
66
|
+
background: "transparent",
|
|
67
|
+
border: "none",
|
|
68
|
+
cursor: "pointer",
|
|
69
|
+
display: "flex",
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
justifyContent: "center",
|
|
72
|
+
padding: 4,
|
|
73
|
+
}, onClick: onClose, children: _jsx(MdClose, { size: 18 }) })] })), _jsx("div", { style: {
|
|
62
74
|
overflowY: bodyOverflow,
|
|
63
75
|
height: `calc(${contentHeight} - ${removelHeight}px)`,
|
|
64
76
|
paddingLeft: "1rem",
|
|
@@ -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