funuicss 3.5.7 → 3.5.9
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/css/fun.css +163 -45
- package/index.d.ts +2 -0
- package/index.js +5 -1
- package/js/firebase/Auth.d.ts +191 -0
- package/js/firebase/Auth.js +746 -0
- package/js/firebase/FireStore.d.ts +54 -0
- package/js/firebase/FireStore.js +285 -0
- package/package.json +2 -1
- package/ui/card/Card.js +3 -1
- package/ui/input/Input.js +4 -1
- package/ui/select/Select.js +4 -2
- package/ui/sidebar/SideBar.d.ts +2 -1
- package/ui/sidebar/SideBar.js +16 -7
- package/ui/table/Table.d.ts +2 -1
- package/ui/table/Table.js +2 -2
- package/ui/text/Text.js +3 -1
- package/ui/theme/theme.d.ts +11 -3
- package/ui/theme/theme.js +54 -10
- package/utils/FireStore.d.ts +10 -0
- package/utils/FireStore.js +273 -0
- package/utils/Firebase.d.ts +2 -0
- package/utils/Firebase.js +16 -0
- package/utils/applyThemeConfig.d.ts +8 -0
- package/utils/applyThemeConfig.js +19 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { DocumentData, QueryConstraint, DocumentReference, Firestore } from 'firebase/firestore';
|
|
2
|
+
export interface DocWithId extends Record<string, any> {
|
|
3
|
+
id: string;
|
|
4
|
+
}
|
|
5
|
+
export interface QueryResponse {
|
|
6
|
+
message?: string;
|
|
7
|
+
data: DocWithId[];
|
|
8
|
+
}
|
|
9
|
+
export interface SingleDocResponse {
|
|
10
|
+
message?: string;
|
|
11
|
+
data: DocumentData | string;
|
|
12
|
+
id?: string;
|
|
13
|
+
}
|
|
14
|
+
type CollectionName = string;
|
|
15
|
+
type DocumentId = string;
|
|
16
|
+
/**
|
|
17
|
+
* Recursively formats Firestore Timestamps into ISO strings.
|
|
18
|
+
*/
|
|
19
|
+
export declare const formatTimestamps: (data: DocumentData) => DocumentData;
|
|
20
|
+
export declare const FunFireStore: {
|
|
21
|
+
/**
|
|
22
|
+
* 📥 Fetch all documents from a collection
|
|
23
|
+
*/
|
|
24
|
+
getDocs: (db: Firestore, collectionName: CollectionName, docsLimit?: number, extraQueries?: QueryConstraint[]) => Promise<DocWithId[]>;
|
|
25
|
+
/**
|
|
26
|
+
* 👀 Real-time listener for a single document
|
|
27
|
+
*/
|
|
28
|
+
getDoc: (db: Firestore, collectionName: CollectionName, id: DocumentId) => Promise<SingleDocResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* 📄 Fetch a single document (no listener)
|
|
31
|
+
*/
|
|
32
|
+
getDocOnce: (db: Firestore, collectionName: CollectionName, id: DocumentId) => Promise<SingleDocResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* 🔎 Custom query with constraints
|
|
35
|
+
*/
|
|
36
|
+
query: (db: Firestore, collectionName: CollectionName, queries?: QueryConstraint[], docsLimit?: number) => Promise<QueryResponse>;
|
|
37
|
+
/**
|
|
38
|
+
* ➕ Add new document (auto ID)
|
|
39
|
+
*/
|
|
40
|
+
addDocument: (db: Firestore, collectionName: CollectionName, data: DocumentData) => Promise<DocumentReference>;
|
|
41
|
+
/**
|
|
42
|
+
* 🧩 Set or merge a document with a custom ID
|
|
43
|
+
*/
|
|
44
|
+
setDoc: (db: Firestore, collectionName: CollectionName, id: DocumentId, data: DocumentData) => Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* 🔄 Update a document
|
|
47
|
+
*/
|
|
48
|
+
update: (db: Firestore, collectionName: CollectionName, id: DocumentId, data: Partial<DocumentData>) => Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* ❌ Delete a document
|
|
51
|
+
*/
|
|
52
|
+
delete: (db: Firestore, collectionName: CollectionName, id: DocumentId) => Promise<string>;
|
|
53
|
+
};
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
50
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
51
|
+
if (ar || !(i in from)) {
|
|
52
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
53
|
+
ar[i] = from[i];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
57
|
+
};
|
|
58
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
+
exports.FunFireStore = exports.formatTimestamps = void 0;
|
|
60
|
+
var firestore_1 = require("firebase/firestore");
|
|
61
|
+
/* -------------------------------------------------------------------------- */
|
|
62
|
+
/* 🔧 Timestamp Formatting Helper */
|
|
63
|
+
/* -------------------------------------------------------------------------- */
|
|
64
|
+
/**
|
|
65
|
+
* Recursively formats Firestore Timestamps into ISO strings.
|
|
66
|
+
*/
|
|
67
|
+
var formatTimestamps = function (data) {
|
|
68
|
+
if (!data || typeof data !== 'object')
|
|
69
|
+
return data;
|
|
70
|
+
var formatted = Array.isArray(data) ? [] : {};
|
|
71
|
+
for (var key in data) {
|
|
72
|
+
var value = data[key];
|
|
73
|
+
if (value instanceof firestore_1.Timestamp) {
|
|
74
|
+
formatted[key] = value.toDate().toISOString();
|
|
75
|
+
}
|
|
76
|
+
else if (Array.isArray(value)) {
|
|
77
|
+
formatted[key] = value.map(function (v) { return (0, exports.formatTimestamps)(v); });
|
|
78
|
+
}
|
|
79
|
+
else if (value && typeof value === 'object') {
|
|
80
|
+
formatted[key] = (0, exports.formatTimestamps)(value);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
formatted[key] = value;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return formatted;
|
|
87
|
+
};
|
|
88
|
+
exports.formatTimestamps = formatTimestamps;
|
|
89
|
+
/* -------------------------------------------------------------------------- */
|
|
90
|
+
/* ⚡ Firestore Utilities */
|
|
91
|
+
/* -------------------------------------------------------------------------- */
|
|
92
|
+
exports.FunFireStore = {
|
|
93
|
+
/**
|
|
94
|
+
* 📥 Fetch all documents from a collection
|
|
95
|
+
*/
|
|
96
|
+
getDocs: function (db_1, collectionName_1, docsLimit_1) {
|
|
97
|
+
var args_1 = [];
|
|
98
|
+
for (var _i = 3; _i < arguments.length; _i++) {
|
|
99
|
+
args_1[_i - 3] = arguments[_i];
|
|
100
|
+
}
|
|
101
|
+
return __awaiter(void 0, __spreadArray([db_1, collectionName_1, docsLimit_1], args_1, true), void 0, function (db, collectionName, docsLimit, extraQueries) {
|
|
102
|
+
var constraints, q, snapshot, err_1, error;
|
|
103
|
+
if (extraQueries === void 0) { extraQueries = []; }
|
|
104
|
+
return __generator(this, function (_a) {
|
|
105
|
+
switch (_a.label) {
|
|
106
|
+
case 0:
|
|
107
|
+
_a.trys.push([0, 2, , 3]);
|
|
108
|
+
constraints = __spreadArray([], extraQueries, true);
|
|
109
|
+
if (docsLimit)
|
|
110
|
+
constraints.push((0, firestore_1.limit)(docsLimit));
|
|
111
|
+
q = firestore_1.query.apply(void 0, __spreadArray([(0, firestore_1.collection)(db, collectionName)], constraints, false));
|
|
112
|
+
return [4 /*yield*/, (0, firestore_1.getDocs)(q)];
|
|
113
|
+
case 1:
|
|
114
|
+
snapshot = _a.sent();
|
|
115
|
+
return [2 /*return*/, snapshot.docs.map(function (d) { return (__assign({ id: d.id }, (0, exports.formatTimestamps)(d.data()))); })];
|
|
116
|
+
case 2:
|
|
117
|
+
err_1 = _a.sent();
|
|
118
|
+
error = err_1;
|
|
119
|
+
throw new Error("Error fetching documents from ".concat(collectionName, ": ").concat(error.message));
|
|
120
|
+
case 3: return [2 /*return*/];
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
/**
|
|
126
|
+
* 👀 Real-time listener for a single document
|
|
127
|
+
*/
|
|
128
|
+
getDoc: function (db, collectionName, id) {
|
|
129
|
+
return new Promise(function (resolve, reject) {
|
|
130
|
+
var unsub = (0, firestore_1.onSnapshot)((0, firestore_1.doc)(db, collectionName, id), function (snap) {
|
|
131
|
+
var data = snap.data();
|
|
132
|
+
resolve(data
|
|
133
|
+
? { id: snap.id, data: (0, exports.formatTimestamps)(data) }
|
|
134
|
+
: { message: 'No data found', data: '' });
|
|
135
|
+
}, function (err) { return reject(new Error("Error fetching document: ".concat(err.message))); });
|
|
136
|
+
// ✅ Auto-unsubscribe after first snapshot to avoid memory leaks
|
|
137
|
+
setTimeout(function () { return unsub(); }, 10000);
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
/**
|
|
141
|
+
* 📄 Fetch a single document (no listener)
|
|
142
|
+
*/
|
|
143
|
+
getDocOnce: function (db, collectionName, id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
144
|
+
var snap, data, err_2, error;
|
|
145
|
+
return __generator(this, function (_a) {
|
|
146
|
+
switch (_a.label) {
|
|
147
|
+
case 0:
|
|
148
|
+
_a.trys.push([0, 2, , 3]);
|
|
149
|
+
return [4 /*yield*/, (0, firestore_1.getDoc)((0, firestore_1.doc)(db, collectionName, id))];
|
|
150
|
+
case 1:
|
|
151
|
+
snap = _a.sent();
|
|
152
|
+
data = snap.data();
|
|
153
|
+
return [2 /*return*/, data
|
|
154
|
+
? { id: snap.id, data: (0, exports.formatTimestamps)(data) }
|
|
155
|
+
: { message: 'No data found', data: '' }];
|
|
156
|
+
case 2:
|
|
157
|
+
err_2 = _a.sent();
|
|
158
|
+
error = err_2;
|
|
159
|
+
throw new Error("Error fetching document: ".concat(error.message));
|
|
160
|
+
case 3: return [2 /*return*/];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}); },
|
|
164
|
+
/**
|
|
165
|
+
* 🔎 Custom query with constraints
|
|
166
|
+
*/
|
|
167
|
+
query: function (db_1, collectionName_1) {
|
|
168
|
+
var args_1 = [];
|
|
169
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
170
|
+
args_1[_i - 2] = arguments[_i];
|
|
171
|
+
}
|
|
172
|
+
return __awaiter(void 0, __spreadArray([db_1, collectionName_1], args_1, true), void 0, function (db, collectionName, queries, docsLimit) {
|
|
173
|
+
var constraints, q, snapshot, data, err_3, error;
|
|
174
|
+
if (queries === void 0) { queries = []; }
|
|
175
|
+
return __generator(this, function (_a) {
|
|
176
|
+
switch (_a.label) {
|
|
177
|
+
case 0:
|
|
178
|
+
_a.trys.push([0, 2, , 3]);
|
|
179
|
+
constraints = __spreadArray([], queries, true);
|
|
180
|
+
if (docsLimit)
|
|
181
|
+
constraints.push((0, firestore_1.limit)(docsLimit));
|
|
182
|
+
q = firestore_1.query.apply(void 0, __spreadArray([(0, firestore_1.collection)(db, collectionName)], constraints, false));
|
|
183
|
+
return [4 /*yield*/, (0, firestore_1.getDocs)(q)];
|
|
184
|
+
case 1:
|
|
185
|
+
snapshot = _a.sent();
|
|
186
|
+
if (!snapshot.empty) {
|
|
187
|
+
data = snapshot.docs.map(function (d) { return (__assign({ id: d.id }, (0, exports.formatTimestamps)(d.data()))); });
|
|
188
|
+
return [2 /*return*/, { data: data }];
|
|
189
|
+
}
|
|
190
|
+
return [2 /*return*/, { message: 'No data', data: [] }];
|
|
191
|
+
case 2:
|
|
192
|
+
err_3 = _a.sent();
|
|
193
|
+
error = err_3;
|
|
194
|
+
throw new Error("Error querying ".concat(collectionName, ": ").concat(error.message));
|
|
195
|
+
case 3: return [2 /*return*/];
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
},
|
|
200
|
+
/**
|
|
201
|
+
* ➕ Add new document (auto ID)
|
|
202
|
+
*/
|
|
203
|
+
addDocument: function (db, collectionName, data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
204
|
+
var docRef, err_4, error;
|
|
205
|
+
return __generator(this, function (_a) {
|
|
206
|
+
switch (_a.label) {
|
|
207
|
+
case 0:
|
|
208
|
+
_a.trys.push([0, 2, , 3]);
|
|
209
|
+
return [4 /*yield*/, (0, firestore_1.addDoc)((0, firestore_1.collection)(db, collectionName), __assign(__assign({}, data), { createdAt: (0, firestore_1.serverTimestamp)(), updatedAt: (0, firestore_1.serverTimestamp)() }))];
|
|
210
|
+
case 1:
|
|
211
|
+
docRef = _a.sent();
|
|
212
|
+
// await updateDoc(docRef, { [assignKey]: docRef.id });
|
|
213
|
+
return [2 /*return*/, docRef];
|
|
214
|
+
case 2:
|
|
215
|
+
err_4 = _a.sent();
|
|
216
|
+
error = err_4;
|
|
217
|
+
throw new Error("Error adding document: ".concat(error.message));
|
|
218
|
+
case 3: return [2 /*return*/];
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}); },
|
|
222
|
+
/**
|
|
223
|
+
* 🧩 Set or merge a document with a custom ID
|
|
224
|
+
*/
|
|
225
|
+
setDoc: function (db, collectionName, id, data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
226
|
+
var err_5, error;
|
|
227
|
+
return __generator(this, function (_a) {
|
|
228
|
+
switch (_a.label) {
|
|
229
|
+
case 0:
|
|
230
|
+
_a.trys.push([0, 2, , 3]);
|
|
231
|
+
return [4 /*yield*/, (0, firestore_1.setDoc)((0, firestore_1.doc)(db, collectionName, id), __assign(__assign({}, data), { updatedAt: (0, firestore_1.serverTimestamp)(), createdAt: (0, firestore_1.serverTimestamp)() }), { merge: true })];
|
|
232
|
+
case 1:
|
|
233
|
+
_a.sent();
|
|
234
|
+
return [3 /*break*/, 3];
|
|
235
|
+
case 2:
|
|
236
|
+
err_5 = _a.sent();
|
|
237
|
+
error = err_5;
|
|
238
|
+
throw new Error("Error setting document: ".concat(error.message));
|
|
239
|
+
case 3: return [2 /*return*/];
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
}); },
|
|
243
|
+
/**
|
|
244
|
+
* 🔄 Update a document
|
|
245
|
+
*/
|
|
246
|
+
update: function (db, collectionName, id, data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
247
|
+
var err_6, error;
|
|
248
|
+
return __generator(this, function (_a) {
|
|
249
|
+
switch (_a.label) {
|
|
250
|
+
case 0:
|
|
251
|
+
_a.trys.push([0, 2, , 3]);
|
|
252
|
+
return [4 /*yield*/, (0, firestore_1.updateDoc)((0, firestore_1.doc)(db, collectionName, id), __assign(__assign({}, data), { updatedAt: (0, firestore_1.serverTimestamp)() }))];
|
|
253
|
+
case 1:
|
|
254
|
+
_a.sent();
|
|
255
|
+
return [3 /*break*/, 3];
|
|
256
|
+
case 2:
|
|
257
|
+
err_6 = _a.sent();
|
|
258
|
+
error = err_6;
|
|
259
|
+
throw new Error("Error updating document: ".concat(error.message));
|
|
260
|
+
case 3: return [2 /*return*/];
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}); },
|
|
264
|
+
/**
|
|
265
|
+
* ❌ Delete a document
|
|
266
|
+
*/
|
|
267
|
+
delete: function (db, collectionName, id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
268
|
+
var err_7, error;
|
|
269
|
+
return __generator(this, function (_a) {
|
|
270
|
+
switch (_a.label) {
|
|
271
|
+
case 0:
|
|
272
|
+
_a.trys.push([0, 2, , 3]);
|
|
273
|
+
return [4 /*yield*/, (0, firestore_1.deleteDoc)((0, firestore_1.doc)(db, collectionName, id))];
|
|
274
|
+
case 1:
|
|
275
|
+
_a.sent();
|
|
276
|
+
return [2 /*return*/, "\u2705 Document \"".concat(id, "\" successfully deleted")];
|
|
277
|
+
case 2:
|
|
278
|
+
err_7 = _a.sent();
|
|
279
|
+
error = err_7;
|
|
280
|
+
throw new Error("Error deleting document: ".concat(error.message));
|
|
281
|
+
case 3: return [2 /*return*/];
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
}); },
|
|
285
|
+
};
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.5.
|
|
2
|
+
"version": "3.5.9",
|
|
3
3
|
"name": "funuicss",
|
|
4
4
|
"description": "React and Next.js component UI Library for creating Easy and good looking websites with fewer lines of code. Elevate your web development experience with our cutting-edge React/Next.js component UI Library. Craft stunning websites effortlessly, boasting both seamless functionality and aesthetic appeal—all achieved with minimal lines of code. Unleash the power of simplicity and style in your projects!",
|
|
5
5
|
"main": "index.js",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"aos": "^2.3.4",
|
|
46
46
|
"dayjs": "^1.11.13",
|
|
47
|
+
"firebase": "^12.3.0",
|
|
47
48
|
"framer-motion": "^12.23.6",
|
|
48
49
|
"hls.js": "^1.6.5",
|
|
49
50
|
"next": "^13.4.4",
|
package/ui/card/Card.js
CHANGED
|
@@ -31,9 +31,11 @@ var react_1 = __importDefault(require("react"));
|
|
|
31
31
|
var CardHeader_1 = __importDefault(require("./CardHeader"));
|
|
32
32
|
var CardBody_1 = __importDefault(require("./CardBody"));
|
|
33
33
|
var CardFooter_1 = __importDefault(require("./CardFooter"));
|
|
34
|
+
var theme_1 = require("../theme/theme");
|
|
34
35
|
function Card(_a) {
|
|
35
36
|
var color = _a.color, bg = _a.bg, width = _a.width, height = _a.height, minHeight = _a.minHeight, minWidth = _a.minWidth, margin = _a.margin, padding = _a.padding, funcss = _a.funcss, children = _a.children, roundEdge = _a.roundEdge, maxHeight = _a.maxHeight, maxWidth = _a.maxWidth, horizontal = _a.horizontal, id = _a.id, header = _a.header, body = _a.body, footer = _a.footer, noGap = _a.noGap, fab = _a.fab, image = _a.image, shadowless = _a.shadowless, flat = _a.flat, responsiveMedium = _a.responsiveMedium, xl = _a.xl, responsiveSmall = _a.responsiveSmall, style = _a.style, rest = __rest(_a, ["color", "bg", "width", "height", "minHeight", "minWidth", "margin", "padding", "funcss", "children", "roundEdge", "maxHeight", "maxWidth", "horizontal", "id", "header", "body", "footer", "noGap", "fab", "image", "shadowless", "flat", "responsiveMedium", "xl", "responsiveSmall", "style"]);
|
|
36
|
-
|
|
37
|
+
var variant = (0, theme_1.useVariant)().variant;
|
|
38
|
+
return (react_1.default.createElement("div", __assign({ id: id || '', className: "\n card \n card_flex\n ".concat(noGap ? 'no-gap' : '', " \n ").concat(xl ? 'xl' : '', " \n text-").concat(color || '', " \n ").concat(bg || '', " \n ").concat(funcss || '', " \n ").concat(roundEdge ? 'round-edge' : '', " \n ").concat(shadowless ? 'shadowless' : '', " \n ").concat(flat ? 'flat' : '', " \n ").concat(horizontal ? 'horizontalCard' : '', "\n ").concat(responsiveMedium ? 'responsiveMedium' : '', "\n ").concat(responsiveSmall ? 'responsiveSmall' : '', "\n ").concat(variant === "standard" ? "border" : "", "\n \n "), style: __assign({ width: "".concat(width || ''), height: "".concat(height || ''), minHeight: "".concat(minHeight || ''), minWidth: "".concat(minWidth || ''), maxHeight: maxHeight || '', maxWidth: maxWidth || '', margin: "".concat(margin || ''), padding: "".concat(padding || '') }, style) }, rest),
|
|
37
39
|
image ? react_1.default.createElement("div", { className: "".concat(fab ? 'relative' : '') },
|
|
38
40
|
image,
|
|
39
41
|
" ",
|
package/ui/input/Input.js
CHANGED
|
@@ -63,6 +63,7 @@ exports.FileInput = exports.TextareaInput = exports.SelectInput = exports.TextIn
|
|
|
63
63
|
var react_1 = __importStar(require("react"));
|
|
64
64
|
var pi_1 = require("react-icons/pi");
|
|
65
65
|
var Button_1 = __importDefault(require("../button/Button"));
|
|
66
|
+
var theme_1 = require("../theme/theme");
|
|
66
67
|
// Utility function to generate CSS classes
|
|
67
68
|
var generateInputClasses = function (_a) {
|
|
68
69
|
var status = _a.status, rounded = _a.rounded, bg = _a.bg, funcss = _a.funcss, flat = _a.flat, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, bordered = _a.bordered, borderless = _a.borderless, _b = _a.additionalClasses, additionalClasses = _b === void 0 ? '' : _b;
|
|
@@ -89,6 +90,7 @@ var TextInput = function (_a) {
|
|
|
89
90
|
borderless: borderless
|
|
90
91
|
});
|
|
91
92
|
var style = fullWidth ? { width: '100%' } : undefined;
|
|
93
|
+
"";
|
|
92
94
|
return (react_1.default.createElement("input", __assign({ id: id, name: name, className: className, onChange: onChange, defaultValue: defaultValue, type: type, placeholder: label, style: style, value: value }, rest)));
|
|
93
95
|
};
|
|
94
96
|
exports.TextInput = TextInput;
|
|
@@ -176,7 +178,8 @@ exports.FileInput = FileInput;
|
|
|
176
178
|
var Input = function (_a) {
|
|
177
179
|
var select = _a.select, multiline = _a.multiline, file = _a.file, noBorder = _a.noBorder, props = __rest(_a, ["select", "multiline", "file", "noBorder"]);
|
|
178
180
|
// Handle legacy noBorder prop
|
|
179
|
-
var
|
|
181
|
+
var variant = (0, theme_1.useVariant)().variant;
|
|
182
|
+
var inputProps = __assign(__assign({}, props), { bordered: variant === 'standard' ? true : props.bordered, borderless: variant === 'minimal' ? true : noBorder || props.borderless });
|
|
180
183
|
if (select) {
|
|
181
184
|
return react_1.default.createElement(exports.SelectInput, __assign({}, inputProps));
|
|
182
185
|
}
|
package/ui/select/Select.js
CHANGED
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
var react_1 = __importStar(require("react"));
|
|
37
|
+
var theme_1 = require("../theme/theme");
|
|
37
38
|
var Select = function (_a) {
|
|
38
39
|
var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, _b = _a.label, label = _b === void 0 ? 'Select an option' : _b, _c = _a.options, options = _c === void 0 ? [] : _c, onChange = _a.onChange, onBlur = _a.onBlur, _d = _a.searchable, searchable = _d === void 0 ? true : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.bordered, bordered = _f === void 0 ? false : _f, _g = _a.borderless, borderless = _g === void 0 ? false : _g, _h = _a.rounded, rounded = _h === void 0 ? false : _h, _j = _a.flat, flat = _j === void 0 ? false : _j, _k = _a.fullWidth, fullWidth = _k === void 0 ? false : _k, _l = _a.status, status = _l === void 0 ? '' : _l, _m = _a.className, className = _m === void 0 ? '' : _m, _o = _a.funcss, funcss = _o === void 0 ? '' : _o, _p = _a.style, style = _p === void 0 ? {} : _p, _q = _a.searchAutoFocus, searchAutoFocus = _q === void 0 ? false : _q;
|
|
39
40
|
var _r = (0, react_1.useState)(false), isOpen = _r[0], setIsOpen = _r[1];
|
|
@@ -44,6 +45,7 @@ var Select = function (_a) {
|
|
|
44
45
|
var containerRef = (0, react_1.useRef)(null);
|
|
45
46
|
var triggerRef = (0, react_1.useRef)(null);
|
|
46
47
|
var searchInputRef = (0, react_1.useRef)(null);
|
|
48
|
+
var variant = (0, theme_1.useVariant)().variant;
|
|
47
49
|
// Initialize selected option
|
|
48
50
|
(0, react_1.useEffect)(function () {
|
|
49
51
|
var initialValue = value || defaultValue;
|
|
@@ -161,8 +163,8 @@ var Select = function (_a) {
|
|
|
161
163
|
var classes = [
|
|
162
164
|
'select-trigger',
|
|
163
165
|
isOpen && 'open',
|
|
164
|
-
bordered && 'bordered',
|
|
165
|
-
borderless && 'borderless',
|
|
166
|
+
variant === 'standard' ? 'bordered' : bordered && 'bordered',
|
|
167
|
+
variant === 'minimal' ? 'borderless' : borderless && 'borderless',
|
|
166
168
|
flat && 'flat',
|
|
167
169
|
status && status,
|
|
168
170
|
disabled && 'disabled'
|
package/ui/sidebar/SideBar.d.ts
CHANGED
package/ui/sidebar/SideBar.js
CHANGED
|
@@ -42,7 +42,7 @@ var react_1 = __importStar(require("react"));
|
|
|
42
42
|
var RowFlex_1 = __importDefault(require("../specials/RowFlex"));
|
|
43
43
|
var Text_1 = __importDefault(require("../text/Text"));
|
|
44
44
|
var navigation_1 = require("next/navigation");
|
|
45
|
-
var
|
|
45
|
+
var theme_1 = require("../theme/theme");
|
|
46
46
|
function SideBar(_a) {
|
|
47
47
|
var _b;
|
|
48
48
|
var _c = _a.funcss, funcss = _c === void 0 ? '' : _c, _d = _a.position, position = _d === void 0 ? 'left' : _d, _e = _a.open, open = _e === void 0 ? false : _e, header = _a.header, content = _a.content, footer = _a.footer, _f = _a.top, top = _f === void 0 ? 0 : _f, _g = _a.sidebarWidth, sidebarWidth = _g === void 0 ? 250 : _g, _h = _a.iconCSS, iconCSS = _h === void 0 ? '' : _h, _j = _a.sidebarCss, sidebarCss = _j === void 0 ? '' : _j, activeCss = _a.activeCss, _k = _a.bodyCss, bodyCss = _k === void 0 ? '' : _k, _l = _a.popIcon, popIcon = _l === void 0 ? false : _l, _m = _a.dividers, dividers = _m === void 0 ? false : _m, _o = _a.links, links = _o === void 0 ? [] : _o, children = _a.children, onClose = _a.onClose;
|
|
@@ -51,6 +51,8 @@ function SideBar(_a) {
|
|
|
51
51
|
var _r = (0, react_1.useState)('0px'), appBarHeight = _r[0], setAppBarHeight = _r[1];
|
|
52
52
|
var pathname = (0, navigation_1.usePathname)();
|
|
53
53
|
var sidebarRef = (0, react_1.useRef)(null);
|
|
54
|
+
var variant = (0, theme_1.useVariant)().variant;
|
|
55
|
+
var _s = (0, react_1.useState)(""), selectedOption = _s[0], setselectedOption = _s[1];
|
|
54
56
|
var updateIsMobile = (0, react_1.useCallback)(function () {
|
|
55
57
|
setIsMobile(window.innerWidth <= 992);
|
|
56
58
|
}, []);
|
|
@@ -110,15 +112,22 @@ function SideBar(_a) {
|
|
|
110
112
|
var section = _a[0], sectionLinks = _a[1];
|
|
111
113
|
return (react_1.default.createElement("div", { key: section, className: "sidebar-section ".concat(dividers ? "bt" : "", " pt-2 pb-2") },
|
|
112
114
|
react_1.default.createElement(Text_1.default, { size: "sm", funcss: "opacity-6 p-1 pl-2 pr-2" }, section),
|
|
113
|
-
sectionLinks.map(function (link) {
|
|
114
|
-
var isActive = pathname === link.uri;
|
|
115
|
-
return (react_1.default.createElement(
|
|
115
|
+
sectionLinks.map(function (link, index) {
|
|
116
|
+
var isActive = link.onClick ? index.toString() === selectedOption : pathname === link.uri;
|
|
117
|
+
return (react_1.default.createElement("div", { onClick: function () {
|
|
116
118
|
if (isMobile) {
|
|
117
119
|
handleClose();
|
|
118
120
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
if (link === null || link === void 0 ? void 0 : link.onClick) {
|
|
122
|
+
link.onClick();
|
|
123
|
+
setselectedOption(index.toString());
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
window.location.href = link.uri;
|
|
127
|
+
}
|
|
128
|
+
}, key: link.uri },
|
|
129
|
+
react_1.default.createElement("div", { className: "p-1 pl-2 pr-2 button sidebar-link ".concat(isActive ? "primary ".concat(activeCss || '') : 'hoverable') },
|
|
130
|
+
react_1.default.createElement("span", { className: "".concat(iconCSS || '', " \n ").concat((variant === 'standard' || popIcon) ? "p-1 ".concat(isActive ? "primary" : "lighter border", " central") : (variant === "minimal" && !isActive) ? "p1 central lighter " : ""), style: { lineHeight: 0, borderRadius: "0.4rem" } }, link.icon),
|
|
122
131
|
react_1.default.createElement(Text_1.default, { text: link.text, size: "sm", weight: 400 }))));
|
|
123
132
|
})));
|
|
124
133
|
}))),
|
package/ui/table/Table.d.ts
CHANGED
|
@@ -36,8 +36,9 @@ type TableProps = {
|
|
|
36
36
|
}[];
|
|
37
37
|
filterableFields?: string[];
|
|
38
38
|
prioritizeSearchFields?: string[];
|
|
39
|
+
onRowClick?: (data: any) => void;
|
|
39
40
|
};
|
|
40
41
|
export default function Table({ children, funcss, bordered, noStripped, hoverable, title, showTotal, light, dark, head, body, data, isLoading, right, hideExport, height, pageSize, // Default page size,
|
|
41
42
|
customColumns, filterableFields, // New prop
|
|
42
|
-
emptyResponse, filterOnchange, clearSearch, prioritizeSearchFields, ...rest }: TableProps): React.JSX.Element;
|
|
43
|
+
emptyResponse, filterOnchange, clearSearch, prioritizeSearchFields, onRowClick, ...rest }: TableProps): React.JSX.Element;
|
|
43
44
|
export {};
|
package/ui/table/Table.js
CHANGED
|
@@ -95,7 +95,7 @@ function Table(_a) {
|
|
|
95
95
|
var _b, _c;
|
|
96
96
|
var children = _a.children, funcss = _a.funcss, bordered = _a.bordered, noStripped = _a.noStripped, hoverable = _a.hoverable, _d = _a.title, title = _d === void 0 ? "" : _d, showTotal = _a.showTotal, light = _a.light, dark = _a.dark, head = _a.head, body = _a.body, data = _a.data, _e = _a.isLoading, isLoading = _e === void 0 ? false : _e, right = _a.right, hideExport = _a.hideExport, height = _a.height, _f = _a.pageSize, pageSize = _f === void 0 ? data ? 10 : 0 : _f, // Default page size,
|
|
97
97
|
customColumns = _a.customColumns, filterableFields = _a.filterableFields, // New prop
|
|
98
|
-
emptyResponse = _a.emptyResponse, filterOnchange = _a.filterOnchange, clearSearch = _a.clearSearch, _g = _a.prioritizeSearchFields, prioritizeSearchFields = _g === void 0 ? [] : _g, rest = __rest(_a, ["children", "funcss", "bordered", "noStripped", "hoverable", "title", "showTotal", "light", "dark", "head", "body", "data", "isLoading", "right", "hideExport", "height", "pageSize", "customColumns", "filterableFields", "emptyResponse", "filterOnchange", "clearSearch", "prioritizeSearchFields"]);
|
|
98
|
+
emptyResponse = _a.emptyResponse, filterOnchange = _a.filterOnchange, clearSearch = _a.clearSearch, _g = _a.prioritizeSearchFields, prioritizeSearchFields = _g === void 0 ? [] : _g, onRowClick = _a.onRowClick, rest = __rest(_a, ["children", "funcss", "bordered", "noStripped", "hoverable", "title", "showTotal", "light", "dark", "head", "body", "data", "isLoading", "right", "hideExport", "height", "pageSize", "customColumns", "filterableFields", "emptyResponse", "filterOnchange", "clearSearch", "prioritizeSearchFields", "onRowClick"]);
|
|
99
99
|
// Check if data is null or undefined before accessing its properties
|
|
100
100
|
// Replace this in your component
|
|
101
101
|
var _h = (0, react_1.useState)(''), search = _h[0], setSearch = _h[1];
|
|
@@ -278,7 +278,7 @@ function Table(_a) {
|
|
|
278
278
|
var results = (0, Query_1.getAdvancedFilteredData)(filteredData, searchQuery, data, getNestedValue, prioritizeSearchFields);
|
|
279
279
|
var shouldSlice = !searchQuery || results.length > 10;
|
|
280
280
|
return (shouldSlice ? results.slice(startIndex, endIndex) : results)
|
|
281
|
-
.map(function (mdoc, index) { return (React.createElement("tr", { className: 'animated slide-up', key: index },
|
|
281
|
+
.map(function (mdoc, index) { return (React.createElement("tr", { className: 'animated slide-up', key: index, onClick: onRowClick ? function () { return onRowClick(mdoc); } : undefined },
|
|
282
282
|
data.fields.map(function (fdoc, findex) {
|
|
283
283
|
var _a;
|
|
284
284
|
return (React.createElement(Data_1.default, { key: fdoc, funcss: data.funcss ? ((_a = data === null || data === void 0 ? void 0 : data.funcss) === null || _a === void 0 ? void 0 : _a[findex]) || '' : '' }, getNestedValue(mdoc, fdoc)));
|
package/ui/text/Text.js
CHANGED
|
@@ -27,6 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
var react_1 = __importDefault(require("react"));
|
|
29
29
|
var pi_1 = require("react-icons/pi");
|
|
30
|
+
var getCssVariable_1 = require("../../utils/getCssVariable");
|
|
30
31
|
var Text = function (_a) {
|
|
31
32
|
var id = _a.id, bg = _a.bg, color = _a.color, children = _a.children, hoverBg = _a.hoverBg, hoverText = _a.hoverText, text = _a.text, funcss = _a.funcss, emp = _a.emp, bold = _a.bold, block = _a.block, body = _a.body, article = _a.article, light = _a.light, lighter = _a.lighter, italic = _a.italic, weight = _a.weight, underline = _a.underline, align = _a.align, lineHeight = _a.lineHeight, letterSpacing = _a.letterSpacing, uppercase = _a.uppercase, lowercase = _a.lowercase, capitalize = _a.capitalize, textDecoration = _a.textDecoration, textTransform = _a.textTransform, whiteSpace = _a.whiteSpace, wordBreak = _a.wordBreak, fontFamily = _a.fontFamily, truncate = _a.truncate, textShadow = _a.textShadow, textAlign = _a.textAlign, customStyles = _a.customStyles, monospace = _a.monospace, quote = _a.quote, opacity = _a.opacity, _b = _a.size, size = _b === void 0 ? 'base' : _b, // default
|
|
32
33
|
rest = __rest(_a, ["id", "bg", "color", "children", "hoverBg", "hoverText", "text", "funcss", "emp", "bold", "block", "body", "article", "light", "lighter", "italic", "weight", "underline", "align", "lineHeight", "letterSpacing", "uppercase", "lowercase", "capitalize", "textDecoration", "textTransform", "whiteSpace", "wordBreak", "fontFamily", "truncate", "textShadow", "textAlign", "customStyles", "monospace", "quote", "opacity", "size"]);
|
|
@@ -38,7 +39,8 @@ var Text = function (_a) {
|
|
|
38
39
|
size === 'h5' ? "h5" :
|
|
39
40
|
size === 'h6' ? "h6" :
|
|
40
41
|
"text-".concat(size));
|
|
41
|
-
var
|
|
42
|
+
var bdFontWeight = (0, getCssVariable_1.getCssVariableValue)('bd-font-weight');
|
|
43
|
+
var mergedStyles = __assign(__assign({ display: block ? 'block' : undefined, fontWeight: bold ? 'bold' : weight ? weight : Number(bdFontWeight), lineHeight: lineHeight, letterSpacing: letterSpacing, textTransform: textTransform, textDecoration: textDecoration, fontFamily: fontFamily, textShadow: textShadow, textAlign: textAlign, whiteSpace: whiteSpace, wordBreak: wordBreak, transform: customStyles === null || customStyles === void 0 ? void 0 : customStyles.transform }, customStyles), (truncate
|
|
42
44
|
? {
|
|
43
45
|
display: '-webkit-box',
|
|
44
46
|
WebkitBoxOrient: 'vertical',
|
package/ui/theme/theme.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
export type ThemeVariant = 'standard' | 'minimal';
|
|
3
|
+
export type ThemeName = 'light' | 'dark' | 'dark-blue' | 'light-gray' | 'pastel-green' | 'warm-orange' | 'frosted-glass' | 'midnight-purple' | 'cyber-metal';
|
|
2
4
|
interface ThemeProviderProps {
|
|
3
|
-
theme:
|
|
4
|
-
|
|
5
|
+
theme: ThemeName;
|
|
6
|
+
projectId: string;
|
|
7
|
+
children: ReactNode;
|
|
5
8
|
}
|
|
9
|
+
interface VariantContextType {
|
|
10
|
+
variant: ThemeVariant;
|
|
11
|
+
setVariant: React.Dispatch<React.SetStateAction<ThemeVariant>>;
|
|
12
|
+
}
|
|
13
|
+
export declare const useVariant: () => VariantContextType;
|
|
6
14
|
declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
7
15
|
export default ThemeProvider;
|