funuicss 3.7.0 → 3.7.2
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 +552 -71
- package/index.d.ts +1 -1
- package/index.js +6 -1
- package/package.json +1 -1
- package/ui/calendar/Calendar.js +1 -1
- package/ui/chart/Bar.d.ts +98 -12
- package/ui/chart/Bar.js +387 -40
- package/ui/chart/Line.js +246 -149
- package/ui/chart/Pie.d.ts +61 -7
- package/ui/chart/Pie.js +314 -38
- package/ui/drop/Dropdown.d.ts +4 -3
- package/ui/drop/Dropdown.js +24 -29
- package/ui/input/Input.js +46 -21
- package/ui/richtext/RichText.js +1 -1
- package/ui/specials/Circle.d.ts +2 -1
- package/ui/specials/Circle.js +2 -5
- package/ui/table/Table.d.ts +2 -1
- package/ui/table/Table.js +66 -63
- package/ui/text/Text.d.ts +1 -1
- package/ui/text/Text.js +50 -49
- package/ui/theme/theme.d.ts +34 -0
- package/ui/theme/theme.js +198 -18
- package/ui/vista/Vista.js +135 -49
- package/utils/componentUtils.js +27 -4
package/ui/input/Input.js
CHANGED
|
@@ -66,6 +66,7 @@ var Button_1 = __importDefault(require("../button/Button"));
|
|
|
66
66
|
var theme_1 = require("../theme/theme");
|
|
67
67
|
var componentUtils_1 = require("../../utils/componentUtils");
|
|
68
68
|
var getDynamicIcon_1 = require("../../utils/getDynamicIcon");
|
|
69
|
+
var Text_1 = __importDefault(require("../text/Text"));
|
|
69
70
|
// Status icons mapping
|
|
70
71
|
var statusIcons = {
|
|
71
72
|
success: react_1.default.createElement(pi_1.PiCheckCircle, null),
|
|
@@ -75,14 +76,16 @@ var statusIcons = {
|
|
|
75
76
|
};
|
|
76
77
|
// Utility function to generate CSS classes
|
|
77
78
|
var generateInputClasses = function (_a) {
|
|
78
|
-
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;
|
|
79
|
+
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, _c = _a.hasNoPrefix, hasNoPrefix = _c === void 0 ? false : _c, _d = _a.hasNoLabel, hasNoLabel = _d === void 0 ? false : _d;
|
|
79
80
|
var statusClass = status ? "".concat(status, "-input") : '';
|
|
80
81
|
var roundedClass = rounded ? 'rounded' : '';
|
|
81
82
|
var bgClass = bg || '';
|
|
82
83
|
var flatClass = flat ? 'flat' : '';
|
|
83
84
|
var cornerClass = leftRounded ? 'leftRounded' : rightRounded ? 'rightRounded' : '';
|
|
84
85
|
var borderClass = bordered ? 'borderedInput' : borderless ? 'borderless' : (!bordered && !borderless ? 'borderedInput' : '');
|
|
85
|
-
|
|
86
|
+
var noPrefixClass = hasNoPrefix ? 'no_prefix' : '';
|
|
87
|
+
var noLabelClass = hasNoLabel ? 'no_label' : '';
|
|
88
|
+
return "\n ".concat(statusClass, "\n ").concat(roundedClass, "\n ").concat(bgClass, "\n ").concat(funcss || '', "\n ").concat(flatClass, "\n ").concat(cornerClass, "\n ").concat(borderClass, "\n ").concat(additionalClasses, "\n ").concat(noPrefixClass, "\n ").concat(noLabelClass, "\n input\n ").trim().replace(/\s+/g, ' ');
|
|
86
89
|
};
|
|
87
90
|
// Iconic Input Wrapper Component
|
|
88
91
|
var IconicInputWrapper = function (_a) {
|
|
@@ -102,8 +105,9 @@ var IconicInputWrapper = function (_a) {
|
|
|
102
105
|
};
|
|
103
106
|
// Input Container with Floating Label
|
|
104
107
|
var InputContainer = function (_a) {
|
|
105
|
-
var label = _a.label, status = _a.status, helperText = _a.helperText, children = _a.children, isFocused = _a.isFocused, hasValue = _a.hasValue, fullWidth = _a.fullWidth, id = _a.id, startIcon = _a.startIcon, prefix = _a.prefix;
|
|
106
|
-
|
|
108
|
+
var label = _a.label, status = _a.status, helperText = _a.helperText, children = _a.children, isFocused = _a.isFocused, hasValue = _a.hasValue, fullWidth = _a.fullWidth, id = _a.id, startIcon = _a.startIcon, prefix = _a.prefix, _b = _a.isSelect, isSelect = _b === void 0 ? false : _b;
|
|
109
|
+
// For select inputs, label is always active
|
|
110
|
+
var showFloatingLabel = label && (isSelect || isFocused || hasValue);
|
|
107
111
|
return (react_1.default.createElement("div", { className: "input-wrapper ".concat(fullWidth ? 'full-width' : '') },
|
|
108
112
|
react_1.default.createElement("div", { className: "input-container-with-label" },
|
|
109
113
|
label && (react_1.default.createElement("label", { htmlFor: id, className: "floating-label ".concat(startIcon || prefix ? "label-left" : "", " ").concat(showFloatingLabel ? 'active' : '', " ").concat(status ? "label-".concat(status) : '') }, label)),
|
|
@@ -194,6 +198,13 @@ var TextInput = function (_a) {
|
|
|
194
198
|
}
|
|
195
199
|
}, [final.stringSuffix]);
|
|
196
200
|
var themeVariant = (0, theme_1.useVariant)().variant;
|
|
201
|
+
// Determine effective icons: stringPrefix/stringSuffix take priority, then local, then config
|
|
202
|
+
var effectivePrefix = prefixNode || final.prefix || final.startIcon;
|
|
203
|
+
var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
|
|
204
|
+
// Check if there's no start icon or prefix
|
|
205
|
+
var hasNoPrefix = !effectivePrefix;
|
|
206
|
+
// Check if there's no label
|
|
207
|
+
var hasNoLabel = !label;
|
|
197
208
|
var className = generateInputClasses({
|
|
198
209
|
status: final.status,
|
|
199
210
|
rounded: final.rounded,
|
|
@@ -204,6 +215,8 @@ var TextInput = function (_a) {
|
|
|
204
215
|
rightRounded: final.rightRounded,
|
|
205
216
|
bordered: final.bordered,
|
|
206
217
|
borderless: final.borderless,
|
|
218
|
+
hasNoPrefix: hasNoPrefix, // Add no_prefix class when no start icon/prefix
|
|
219
|
+
hasNoLabel: hasNoLabel,
|
|
207
220
|
});
|
|
208
221
|
var style = final.fullWidth ? { width: '100%' } : undefined;
|
|
209
222
|
var handleChange = function (e) {
|
|
@@ -222,9 +235,6 @@ var TextInput = function (_a) {
|
|
|
222
235
|
if (rest.onBlur)
|
|
223
236
|
rest.onBlur(e);
|
|
224
237
|
};
|
|
225
|
-
// Determine effective icons: stringPrefix/stringSuffix take priority, then local, then config
|
|
226
|
-
var effectivePrefix = prefixNode || final.prefix || final.startIcon;
|
|
227
|
-
var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
|
|
228
238
|
// Show placeholder only when label is active (focused or has value)
|
|
229
239
|
var showPlaceholder = placeholder && label && (isFocused || !!inputValue);
|
|
230
240
|
var inputElement = (react_1.default.createElement("input", __assign({ ref: inputRef, id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, defaultValue: defaultValue, type: type, placeholder: showPlaceholder ? placeholder : (!label ? placeholder : ''), style: style, value: inputValue }, rest)));
|
|
@@ -314,6 +324,13 @@ var SelectInput = function (_a) {
|
|
|
314
324
|
}, [final.stringSuffix]);
|
|
315
325
|
var selectHasValue = !!selectValue;
|
|
316
326
|
var themeVariant = (0, theme_1.useVariant)().variant;
|
|
327
|
+
// Determine effective icons
|
|
328
|
+
var effectivePrefix = prefixNode || final.prefix || final.startIcon;
|
|
329
|
+
var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
|
|
330
|
+
// Check if there's no start icon or prefix
|
|
331
|
+
var hasNoPrefix = !effectivePrefix;
|
|
332
|
+
// Check if there's no label
|
|
333
|
+
var hasNoLabel = !label;
|
|
317
334
|
var className = generateInputClasses({
|
|
318
335
|
status: final.status,
|
|
319
336
|
rounded: final.rounded,
|
|
@@ -324,6 +341,8 @@ var SelectInput = function (_a) {
|
|
|
324
341
|
rightRounded: final.rightRounded,
|
|
325
342
|
bordered: final.bordered,
|
|
326
343
|
borderless: final.borderless,
|
|
344
|
+
hasNoPrefix: hasNoPrefix, // Add no_prefix class when no start icon/prefix
|
|
345
|
+
hasNoLabel: hasNoLabel,
|
|
327
346
|
});
|
|
328
347
|
var style = final.fullWidth ? { width: '100%' } : undefined;
|
|
329
348
|
var handleChange = function (e) {
|
|
@@ -342,11 +361,9 @@ var SelectInput = function (_a) {
|
|
|
342
361
|
if (rest.onBlur)
|
|
343
362
|
rest.onBlur(e);
|
|
344
363
|
};
|
|
345
|
-
var effectivePrefix = prefixNode || final.prefix || final.startIcon;
|
|
346
|
-
var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
|
|
347
364
|
var selectElement = (react_1.default.createElement("select", __assign({ id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, defaultValue: defaultValue, value: selectValue, style: style }, rest), options.map(function (option) { return (react_1.default.createElement("option", { key: option.value, value: option.value }, option.text)); })));
|
|
348
365
|
var wrappedSelect = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: final.iconicBg, funcss: final.funcss }, selectElement));
|
|
349
|
-
return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: final.status, helperText: helperText, isFocused: isFocused, hasValue: selectHasValue, fullWidth: final.fullWidth, id: id }, wrappedSelect));
|
|
366
|
+
return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: final.status, helperText: helperText, isFocused: isFocused, hasValue: selectHasValue, fullWidth: final.fullWidth, id: id, isSelect: true }, wrappedSelect));
|
|
350
367
|
};
|
|
351
368
|
exports.SelectInput = SelectInput;
|
|
352
369
|
// Textarea Component
|
|
@@ -430,6 +447,13 @@ var TextareaInput = function (_a) {
|
|
|
430
447
|
}
|
|
431
448
|
}, [final.stringSuffix]);
|
|
432
449
|
var themeVariant = (0, theme_1.useVariant)().variant;
|
|
450
|
+
// Determine effective icons
|
|
451
|
+
var effectivePrefix = prefixNode || final.prefix || final.startIcon;
|
|
452
|
+
var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
|
|
453
|
+
// Check if there's no start icon or prefix
|
|
454
|
+
var hasNoPrefix = !effectivePrefix;
|
|
455
|
+
// Check if there's no label
|
|
456
|
+
var hasNoLabel = !label;
|
|
433
457
|
var className = generateInputClasses({
|
|
434
458
|
status: final.status,
|
|
435
459
|
rounded: final.rounded,
|
|
@@ -440,6 +464,8 @@ var TextareaInput = function (_a) {
|
|
|
440
464
|
rightRounded: final.rightRounded,
|
|
441
465
|
bordered: final.bordered,
|
|
442
466
|
borderless: final.borderless,
|
|
467
|
+
hasNoPrefix: hasNoPrefix, // Add no_prefix class when no start icon/prefix
|
|
468
|
+
hasNoLabel: hasNoLabel,
|
|
443
469
|
});
|
|
444
470
|
var style = final.fullWidth ? { width: '100%' } : undefined;
|
|
445
471
|
var handleChange = function (e) {
|
|
@@ -458,8 +484,6 @@ var TextareaInput = function (_a) {
|
|
|
458
484
|
if (rest.onBlur)
|
|
459
485
|
rest.onBlur(e);
|
|
460
486
|
};
|
|
461
|
-
var effectivePrefix = prefixNode || final.prefix || final.startIcon;
|
|
462
|
-
var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
|
|
463
487
|
// Show placeholder only when label is active (focused or has value)
|
|
464
488
|
var showPlaceholder = placeholder && label && (isFocused || !!textValue);
|
|
465
489
|
var textareaElement = (react_1.default.createElement("textarea", __assign({ id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, defaultValue: defaultValue, placeholder: showPlaceholder ? placeholder : (!label ? placeholder : ''), style: style, value: textValue, rows: rows }, rest)));
|
|
@@ -467,7 +491,7 @@ var TextareaInput = function (_a) {
|
|
|
467
491
|
return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: final.status, helperText: helperText, isFocused: isFocused, hasValue: !!textValue, fullWidth: final.fullWidth, id: id }, wrappedTextarea));
|
|
468
492
|
};
|
|
469
493
|
exports.TextareaInput = TextareaInput;
|
|
470
|
-
// File Input Component (
|
|
494
|
+
// File Input Component (updated with no_prefix and no_label logic)
|
|
471
495
|
var FileInput = function (_a) {
|
|
472
496
|
var _b = _a.id, id = _b === void 0 ? 'fileInput' : _b, name = _a.name, onChange = _a.onChange, status = _a.status, funcss = _a.funcss, bg = _a.bg, fullWidth = _a.fullWidth, flat = _a.flat, rounded = _a.rounded, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, startIcon = _a.startIcon, endIcon = _a.endIcon, prefix = _a.prefix, suffix = _a.suffix, stringPrefix = _a.stringPrefix, stringSuffix = _a.stringSuffix, iconicBg = _a.iconicBg, _c = _a.label, label = _c === void 0 ? 'Upload File' : _c, helperText = _a.helperText, icon = _a.icon, extra = _a.extra, button = _a.button, btn = _a.btn, value = _a.value, _d = _a.variant, variant = _d === void 0 ? '' : _d, rest = __rest(_a, ["id", "name", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "prefix", "suffix", "stringPrefix", "stringSuffix", "iconicBg", "label", "helperText", "icon", "extra", "button", "btn", "value", "variant"]);
|
|
473
497
|
var _e = (0, react_1.useState)(''), fileName = _e[0], setFileName = _e[1];
|
|
@@ -545,6 +569,10 @@ var FileInput = function (_a) {
|
|
|
545
569
|
};
|
|
546
570
|
var effectivePrefix = prefixNode || final.prefix || final.startIcon;
|
|
547
571
|
var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
|
|
572
|
+
// Check if there's no start icon or prefix
|
|
573
|
+
var hasNoPrefix = !effectivePrefix;
|
|
574
|
+
// Check if there's no label (file inputs typically don't have labels in the same way)
|
|
575
|
+
var hasNoLabel = true; // File inputs use their own label system
|
|
548
576
|
if (btn) {
|
|
549
577
|
var className = generateInputClasses({
|
|
550
578
|
status: final.status,
|
|
@@ -556,7 +584,9 @@ var FileInput = function (_a) {
|
|
|
556
584
|
rightRounded: final.rightRounded,
|
|
557
585
|
bordered: true,
|
|
558
586
|
borderless: false,
|
|
559
|
-
additionalClasses: 'filedInput'
|
|
587
|
+
additionalClasses: 'filedInput',
|
|
588
|
+
hasNoPrefix: hasNoPrefix, // Add no_prefix class when no start icon/prefix
|
|
589
|
+
hasNoLabel: hasNoLabel,
|
|
560
590
|
});
|
|
561
591
|
var style = final.fullWidth ? { width: '100%' } : undefined;
|
|
562
592
|
var fileInputElement = (react_1.default.createElement("div", { className: "fileInput" },
|
|
@@ -568,13 +598,8 @@ var FileInput = function (_a) {
|
|
|
568
598
|
var uploadElement = (react_1.default.createElement("div", { className: "_upload_container" },
|
|
569
599
|
react_1.default.createElement("label", { htmlFor: id, className: "_upload_label" },
|
|
570
600
|
react_1.default.createElement("div", { className: "_upload_icon" }, icon || react_1.default.createElement(pi_1.PiCloudArrowUp, null)),
|
|
571
|
-
react_1.default.createElement("div", { className: "_upload_text",
|
|
572
|
-
|
|
573
|
-
overflow: 'hidden',
|
|
574
|
-
textOverflow: 'ellipsis',
|
|
575
|
-
display: 'inline-block',
|
|
576
|
-
width: '100%',
|
|
577
|
-
} }, fileName || label),
|
|
601
|
+
react_1.default.createElement("div", { className: "_upload_text fit" },
|
|
602
|
+
react_1.default.createElement(Text_1.default, { text: fileName || label, truncate: 1, block: true })),
|
|
578
603
|
extra && react_1.default.createElement("div", { className: "text-small opacity-3" }, extra)),
|
|
579
604
|
react_1.default.createElement("input", __assign({ onChange: handleChange, type: "file", id: id, className: "_upload_input" }, rest))));
|
|
580
605
|
return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: undefined, status: final.status, helperText: helperText, isFocused: false, hasValue: !!fileName, fullWidth: final.fullWidth, id: id }, uploadElement));
|
package/ui/richtext/RichText.js
CHANGED
|
@@ -118,7 +118,7 @@ var RichText = function (_a) {
|
|
|
118
118
|
react_1.default.createElement(Flex_1.default, { justify: "space-between", gap: 1, alignItems: "center", width: "100%" },
|
|
119
119
|
(showEmojis || afterEmoji) ? (react_1.default.createElement("div", null,
|
|
120
120
|
react_1.default.createElement(Flex_1.default, { width: "100%", gap: 0.5, alignItems: "center" },
|
|
121
|
-
showEmojis && (react_1.default.createElement(Dropdown_1.default, { closableOnlyOutside: true,
|
|
121
|
+
showEmojis && (react_1.default.createElement(Dropdown_1.default, { closableOnlyOutside: true, openOnHover: false, button: react_1.default.createElement(ToolTip_1.default, null,
|
|
122
122
|
react_1.default.createElement(Circle_1.default, { size: 2, funcss: "bg border" },
|
|
123
123
|
react_1.default.createElement(md_1.MdOutlineEmojiEmotions, null)),
|
|
124
124
|
react_1.default.createElement(Tip_1.default, { tip: "top", animation: "ScaleUp", duration: 0.5, content: "Emojis" })), items: [
|
package/ui/specials/Circle.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ interface Circle_Props extends HTMLProps<HTMLDivElement> {
|
|
|
10
10
|
raised?: boolean;
|
|
11
11
|
bordered?: boolean;
|
|
12
12
|
key?: React.Key;
|
|
13
|
+
style?: React.CSSProperties;
|
|
13
14
|
onClick?: () => void;
|
|
14
15
|
}
|
|
15
|
-
export default function Circle({ size, funcss, bg, color, children, hoverable, raised, key, onClick, bordered, ...rest }: Circle_Props): React.JSX.Element;
|
|
16
|
+
export default function Circle({ size, funcss, bg, color, children, hoverable, raised, key, onClick, bordered, style, ...rest }: Circle_Props): React.JSX.Element;
|
|
16
17
|
export {};
|
package/ui/specials/Circle.js
CHANGED
|
@@ -59,10 +59,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
59
59
|
exports.default = Circle;
|
|
60
60
|
var React = __importStar(require("react"));
|
|
61
61
|
function Circle(_a) {
|
|
62
|
-
var _b = _a.size, size = _b === void 0 ? 2 : _b, funcss = _a.funcss, bg = _a.bg, color = _a.color, children = _a.children, hoverable = _a.hoverable, raised = _a.raised, key = _a.key, onClick = _a.onClick, bordered = _a.bordered, rest = __rest(_a, ["size", "funcss", "bg", "color", "children", "hoverable", "raised", "key", "onClick", "bordered"]);
|
|
63
|
-
return (React.createElement("div", __assign({ className: " animated fade-in ".concat(bordered ? "border" : "", " pointer avatar ").concat(funcss || '', " ").concat("text-" + (color === null || color === void 0 ? void 0 : color.trim()) || '', " ").concat(raised ? "raised" : '', " ").concat(bg || 'lighter', " ").concat(hoverable ? 'hoverable' : ''), style: {
|
|
64
|
-
width: "".concat(size + "rem" || '2.3rem'),
|
|
65
|
-
height: "".concat(size + "rem" || '2.3rem'),
|
|
66
|
-
}, key: key, onClick: onClick }, rest),
|
|
62
|
+
var _b = _a.size, size = _b === void 0 ? 2 : _b, funcss = _a.funcss, bg = _a.bg, color = _a.color, children = _a.children, hoverable = _a.hoverable, raised = _a.raised, key = _a.key, onClick = _a.onClick, bordered = _a.bordered, style = _a.style, rest = __rest(_a, ["size", "funcss", "bg", "color", "children", "hoverable", "raised", "key", "onClick", "bordered", "style"]);
|
|
63
|
+
return (React.createElement("div", __assign({ className: " animated fade-in ".concat(bordered ? "border" : "", " pointer avatar ").concat(funcss || '', " ").concat("text-" + (color === null || color === void 0 ? void 0 : color.trim()) || '', " ").concat(raised ? "raised" : '', " ").concat(bg || 'lighter', " ").concat(hoverable ? 'hoverable' : ''), style: __assign({ width: "".concat(size + "rem" || '2.3rem'), height: "".concat(size + "rem" || '2.3rem') }, style), key: key, onClick: onClick }, rest),
|
|
67
64
|
React.createElement(React.Fragment, null, children)));
|
|
68
65
|
}
|
package/ui/table/Table.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
type TableProps = {
|
|
3
3
|
children?: React.ReactNode;
|
|
4
4
|
funcss?: string;
|
|
5
|
+
trCss?: string;
|
|
5
6
|
title?: string;
|
|
6
7
|
bordered?: boolean;
|
|
7
8
|
noStripped?: boolean;
|
|
@@ -40,5 +41,5 @@ type TableProps = {
|
|
|
40
41
|
};
|
|
41
42
|
export default function Table({ children, funcss, bordered, noStripped, hoverable, title, showTotal, light, dark, head, body, data, isLoading, right, hideExport, height, pageSize, // Default page size,
|
|
42
43
|
customColumns, filterableFields, // New prop
|
|
43
|
-
emptyResponse, filterOnchange, clearSearch, prioritizeSearchFields, onRowClick, ...rest }: TableProps): React.JSX.Element;
|
|
44
|
+
emptyResponse, filterOnchange, clearSearch, prioritizeSearchFields, onRowClick, trCss, ...rest }: TableProps): React.JSX.Element;
|
|
44
45
|
export {};
|
package/ui/table/Table.js
CHANGED
|
@@ -70,10 +70,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
70
70
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
71
71
|
exports.default = Table;
|
|
72
72
|
var React = __importStar(require("react"));
|
|
73
|
-
var Head_1 = __importDefault(require("./Head"));
|
|
74
|
-
var Body_1 = __importDefault(require("./Body"));
|
|
75
|
-
var Row_1 = __importDefault(require("./Row"));
|
|
76
|
-
var Data_1 = __importDefault(require("./Data"));
|
|
77
73
|
var Input_1 = __importDefault(require("../input/Input"));
|
|
78
74
|
var react_1 = require("react");
|
|
79
75
|
var RowFlex_1 = __importDefault(require("../specials/RowFlex"));
|
|
@@ -81,8 +77,6 @@ var Button_1 = __importDefault(require("../button/Button"));
|
|
|
81
77
|
var pi_1 = require("react-icons/pi");
|
|
82
78
|
var Circle_1 = __importDefault(require("../specials/Circle"));
|
|
83
79
|
var Text_1 = __importDefault(require("../text/Text"));
|
|
84
|
-
var View_1 = __importDefault(require("../view/View"));
|
|
85
|
-
var ScrollInView_1 = __importDefault(require("../ScrollInView/ScrollInView"));
|
|
86
80
|
var Select_1 = __importDefault(require("../select/Select"));
|
|
87
81
|
var Export_1 = require("./Export");
|
|
88
82
|
var ToolTip_1 = __importDefault(require("../tooltip/ToolTip"));
|
|
@@ -95,7 +89,7 @@ function Table(_a) {
|
|
|
95
89
|
var _b, _c;
|
|
96
90
|
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
91
|
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, 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"]);
|
|
92
|
+
emptyResponse = _a.emptyResponse, filterOnchange = _a.filterOnchange, clearSearch = _a.clearSearch, _g = _a.prioritizeSearchFields, prioritizeSearchFields = _g === void 0 ? [] : _g, onRowClick = _a.onRowClick, trCss = _a.trCss, 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", "trCss"]);
|
|
99
93
|
// Check if data is null or undefined before accessing its properties
|
|
100
94
|
// Replace this in your component
|
|
101
95
|
var _h = (0, react_1.useState)(''), search = _h[0], setSearch = _h[1];
|
|
@@ -188,28 +182,26 @@ function Table(_a) {
|
|
|
188
182
|
}, [selectedField, selectedValue]);
|
|
189
183
|
return (React.createElement("div", { className: "".concat(funcss ? funcss : '', " roundEdge") },
|
|
190
184
|
data &&
|
|
191
|
-
React.createElement("div", { className: "
|
|
185
|
+
React.createElement("div", { className: "pr-4 pl-4 pt-2 pb-2 lighter tableHeader mb-2", style: { overflow: "show" } },
|
|
192
186
|
React.createElement(RowFlex_1.default, { gap: 0.5, justify: 'space-between' },
|
|
193
187
|
title ?
|
|
194
188
|
React.createElement("div", null,
|
|
195
189
|
showTotal && data &&
|
|
196
190
|
React.createElement("div", null,
|
|
197
|
-
React.createElement(Text_1.default, { text:
|
|
198
|
-
React.createElement(Text_1.default, { text: filteredData.length, weight: 600 })),
|
|
191
|
+
React.createElement(Text_1.default, { text: "".concat(filteredData.length, " Records"), size: 'sm', weight: 500 })),
|
|
199
192
|
title &&
|
|
200
193
|
React.createElement("div", null,
|
|
201
|
-
React.createElement(Text_1.default, { text: title || "", size: 'h6' })))
|
|
194
|
+
React.createElement(Text_1.default, { text: title || "", size: 'h6', lineHeight: '0.8' })))
|
|
202
195
|
:
|
|
203
196
|
React.createElement(React.Fragment, null, showTotal && data &&
|
|
204
197
|
React.createElement("div", null,
|
|
205
|
-
React.createElement(Text_1.default, { text:
|
|
206
|
-
React.createElement(Text_1.default, { text: filteredData.length, weight: 600, color: 'primary' }))),
|
|
198
|
+
React.createElement(Text_1.default, { text: "".concat(filteredData.length, " Records"), size: 'sm', weight: 500 }))),
|
|
207
199
|
data ?
|
|
208
200
|
React.createElement("div", null,
|
|
209
201
|
React.createElement(Flex_1.default, { width: '100%', wrap: 'nowrap', alignItems: 'center', gap: 0.7 },
|
|
210
202
|
!selectedField && !showSearch && filterableFields &&
|
|
211
203
|
React.createElement("div", null,
|
|
212
|
-
React.createElement(Select_1.default, { fullWidth: true, searchable: true, funcss: 'min-w-300 w-full', rounded: true, value: selectedField || '', onChange: function (e) { return handleFieldChange(e); }, options: __spreadArray([
|
|
204
|
+
React.createElement(Select_1.default, { fullWidth: true, searchable: true, funcss: 'min-w-300 w-full bg', rounded: true, value: selectedField || '', onChange: function (e) { return handleFieldChange(e); }, options: __spreadArray([
|
|
213
205
|
{ text: '🔍 Filter', value: '' },
|
|
214
206
|
{ text: 'All*', value: '' }
|
|
215
207
|
], (filterableFields || []).map(function (field) { return ({
|
|
@@ -217,7 +209,7 @@ function Table(_a) {
|
|
|
217
209
|
value: field
|
|
218
210
|
}); }), true) })),
|
|
219
211
|
selectedField && !showSearch && filterableFields && (React.createElement("div", { className: '' },
|
|
220
|
-
React.createElement(Select_1.default, { rounded: true, searchable: true, funcss: 'min-w-300 w-full', fullWidth: true, value: selectedValue || '', onChange: function (e) {
|
|
212
|
+
React.createElement(Select_1.default, { rounded: true, searchable: true, funcss: 'min-w-300 w-full bg', fullWidth: true, value: selectedValue || '', onChange: function (e) {
|
|
221
213
|
if (e === 'clear_all') {
|
|
222
214
|
setSelectedField('');
|
|
223
215
|
}
|
|
@@ -238,72 +230,83 @@ function Table(_a) {
|
|
|
238
230
|
showSearch ?
|
|
239
231
|
React.createElement(Flex_1.default, { gap: 0.5, wrap: 'nowrap', alignItems: 'center' },
|
|
240
232
|
React.createElement("div", { className: 'animated slide-up' },
|
|
241
|
-
React.createElement(Input_1.default, { borderless: true, funcss: 'min-w-300', fullWidth: true, rounded: true, value: searchQuery, onChange: function (e) { return setsearchQuery(e.target.value); }, label: "Search..." })),
|
|
242
|
-
React.createElement("div",
|
|
233
|
+
React.createElement(Input_1.default, { borderless: true, funcss: 'min-w-300 bg', fullWidth: true, rounded: true, value: searchQuery, onChange: function (e) { return setsearchQuery(e.target.value); }, label: "Search..." })),
|
|
234
|
+
React.createElement("div", null,
|
|
243
235
|
React.createElement("div", { onClick: function () { return setshowSearch(false); } },
|
|
244
236
|
React.createElement(ToolTip_1.default, null,
|
|
245
237
|
filterableFields ? React.createElement(io5_1.IoFilterOutline, { className: 'pointer' })
|
|
246
238
|
:
|
|
247
239
|
React.createElement(pi_1.PiXThin, { className: 'pointer', size: 23, onClick: function () { return setshowSearch(false); } }),
|
|
248
|
-
React.createElement(Tip_1.default, { tip: "
|
|
240
|
+
React.createElement(Tip_1.default, { tip: "top", animation: "Opacity", duration: 1, content: filterableFields ? "Filter" : "Close Search" })))))
|
|
249
241
|
:
|
|
250
|
-
React.createElement("div",
|
|
242
|
+
React.createElement("div", null,
|
|
251
243
|
React.createElement(ToolTip_1.default, null,
|
|
252
244
|
React.createElement(ci_1.CiSearch, { className: 'pointer', size: 23, onClick: function () { return setshowSearch(true); } }),
|
|
253
|
-
React.createElement(Tip_1.default, { tip: "
|
|
245
|
+
React.createElement(Tip_1.default, { tip: "top", animation: "Opacity", duration: 1, content: "Search Data" })))))
|
|
254
246
|
: '',
|
|
255
|
-
React.createElement(React.Fragment, null,
|
|
247
|
+
React.createElement(React.Fragment, null, (right || !hideExport) &&
|
|
256
248
|
React.createElement(RowFlex_1.default, { gap: 0.5 },
|
|
257
249
|
right && right,
|
|
258
250
|
!hideExport &&
|
|
259
|
-
React.createElement("div",
|
|
251
|
+
React.createElement("div", null,
|
|
260
252
|
React.createElement(ToolTip_1.default, null,
|
|
261
253
|
React.createElement(Circle_1.default, { bg: 'lighter', bordered: true, onClick: Export },
|
|
262
254
|
React.createElement(pi_1.PiExportThin, null)),
|
|
263
|
-
React.createElement(Tip_1.default, { tip: "
|
|
255
|
+
React.createElement(Tip_1.default, { tip: "top", animation: "Opacity", duration: 1, content: "Export Data" }))))))),
|
|
264
256
|
React.createElement("main", { style: { overflow: "auto", width: "100%" } },
|
|
265
|
-
React.createElement("
|
|
257
|
+
React.createElement("div", __assign({ className: "table-grid ".concat(bordered ? 'bordered' : '', " ").concat(noStripped ? '' : 'stripped', " ").concat(hoverable ? 'hoverableTr' : '', " ").concat(light ? 'light' : '', " ").concat(dark ? 'dark' : ''), style: {
|
|
266
258
|
height: height ? height + "px" : "",
|
|
267
259
|
position: 'relative',
|
|
268
260
|
zIndex: 1
|
|
269
261
|
} }, rest),
|
|
270
|
-
data &&
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
React.createElement("div",
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
262
|
+
data && (data === null || data === void 0 ? void 0 : data.titles) && (React.createElement("div", { className: "table-head" }, data.titles.map(function (mdoc, index) { return (React.createElement("div", { key: mdoc, className: "table-header text-secondary ".concat(index === 0 ? "first_table_data" : "", " ").concat(index === data.titles.length - 1 ? "last_table_data" : ""), "data-label": mdoc }, mdoc)); }))),
|
|
263
|
+
head && React.createElement("div", { className: "table-head" }, head),
|
|
264
|
+
React.createElement("div", { className: "table-body" },
|
|
265
|
+
body && body,
|
|
266
|
+
data &&
|
|
267
|
+
(function () {
|
|
268
|
+
var results = (0, Query_1.getAdvancedFilteredData)(filteredData, searchQuery, data, getNestedValue, prioritizeSearchFields);
|
|
269
|
+
var shouldSlice = !searchQuery || results.length > 10;
|
|
270
|
+
return (shouldSlice ? results.slice(startIndex, endIndex) : results).map(function (mdoc, index) { return (React.createElement("div", { className: "table-row animated slide-up ".concat(trCss), key: index, onClick: onRowClick ? function () { return onRowClick(mdoc); } : undefined },
|
|
271
|
+
data.fields.map(function (fdoc, findex) {
|
|
272
|
+
var _a, _b;
|
|
273
|
+
return (React.createElement("div", { key: fdoc, className: "table-cell ".concat(data.funcss ? ((_a = data === null || data === void 0 ? void 0 : data.funcss) === null || _a === void 0 ? void 0 : _a[findex]) || "" : ""), "data-label": ((_b = data.titles) === null || _b === void 0 ? void 0 : _b[findex]) || fdoc, style: { overflow: "visible" } }, getNestedValue(mdoc, fdoc)));
|
|
274
|
+
}),
|
|
275
|
+
customColumns
|
|
276
|
+
? customColumns.map(function (column, columnIndex) { return (React.createElement("div", { key: columnIndex, className: "table-cell", "data-label": column.title || "Action", style: {
|
|
277
|
+
position: "relative",
|
|
278
|
+
overflow: "visible",
|
|
279
|
+
} },
|
|
280
|
+
React.createElement("div", { style: {
|
|
281
|
+
position: "relative",
|
|
282
|
+
overflow: "visible",
|
|
283
|
+
zIndex: 50,
|
|
284
|
+
} }, column.render && column.render(mdoc)),
|
|
285
|
+
column.onClick && (React.createElement(Button_1.default, { onClick: function () { return column.onClick && column.onClick(mdoc); } }, column.title)))); })
|
|
286
|
+
: "")); });
|
|
287
|
+
})(),
|
|
288
|
+
isLoading &&
|
|
289
|
+
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(function (_, index) { return (React.createElement("div", { key: index, className: "table-row skeleton" }, data === null || data === void 0 ? void 0 : data.fields.map(function (_, cellIndex) { return (React.createElement("div", { key: cellIndex, className: "table-cell" })); }))); }),
|
|
290
|
+
children ? children : ""),
|
|
291
|
+
filteredData.length === 0 && !isLoading && !children && (React.createElement("div", { className: "table-empty" },
|
|
292
|
+
React.createElement("div", { className: "empty-icon" }, (emptyResponse === null || emptyResponse === void 0 ? void 0 : emptyResponse.icon) || React.createElement(pi_1.PiEmpty, { size: 30, className: "text-error" })),
|
|
293
|
+
React.createElement("div", null, (emptyResponse === null || emptyResponse === void 0 ? void 0 : emptyResponse.title) || (React.createElement(Text_1.default, { text: "No Record Found!", size: "xl" }))),
|
|
294
|
+
React.createElement("div", null, (emptyResponse === null || emptyResponse === void 0 ? void 0 : emptyResponse.subtitle) || (React.createElement(Text_1.default, { text: "You can try reloading the page or check your query" }))))))),
|
|
295
|
+
data && pageSize && filteredData.length > pageSize && (React.createElement("div", { className: "padding bt" },
|
|
296
|
+
React.createElement(RowFlex_1.default, { gap: 1, justify: "center" },
|
|
297
|
+
React.createElement("div", { className: "pagination-container" },
|
|
298
|
+
React.createElement("div", { className: "pagination-nav ".concat(currentPage === 1 ? 'pagination-nav-disabled' : ''), onClick: function () { return currentPage > 1 && handleChangePage(1); }, title: "First page" },
|
|
299
|
+
React.createElement(Text_1.default, { text: "\u00AB\u00AB" })),
|
|
300
|
+
React.createElement("div", { className: "pagination-nav ".concat(currentPage === 1 ? 'pagination-nav-disabled' : ''), onClick: function () { return currentPage > 1 && handleChangePage(currentPage - 1); }, title: "Previous page" },
|
|
301
|
+
React.createElement(Text_1.default, { text: "\u2039" })),
|
|
302
|
+
React.createElement("div", { className: "pagination" }, Array.from({ length: endPage - startPage + 1 }, function (_, i) {
|
|
303
|
+
var pageNumber = startPage + i;
|
|
304
|
+
var isActive = currentPage === pageNumber;
|
|
305
|
+
return (React.createElement("div", { key: pageNumber, className: "pagination-item ".concat(isActive ? 'pagination-item-active' : ''), onClick: function () { return handleChangePage(pageNumber); } },
|
|
306
|
+
React.createElement(Text_1.default, { text: "".concat(pageNumber), bold: isActive })));
|
|
307
|
+
})),
|
|
308
|
+
React.createElement("div", { className: "pagination-nav ".concat(currentPage === totalPages ? 'pagination-nav-disabled' : ''), onClick: function () { return currentPage < totalPages && handleChangePage(currentPage + 1); }, title: "Next page" },
|
|
309
|
+
React.createElement(Text_1.default, { text: "\u203A" })),
|
|
310
|
+
React.createElement("div", { className: "pagination-nav ".concat(currentPage === totalPages ? 'pagination-nav-disabled' : ''), onClick: function () { return currentPage < totalPages && handleChangePage(totalPages); }, title: "Last page" },
|
|
311
|
+
React.createElement(Text_1.default, { text: "\u00BB\u00BB" }))))))));
|
|
309
312
|
}
|
package/ui/text/Text.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ type TypographyProps = {
|
|
|
42
42
|
variant?: string;
|
|
43
43
|
margin?: string;
|
|
44
44
|
padding?: string;
|
|
45
|
-
size?: "xs" | "sm" | "base" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl" | "8xl" | "9xl" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
45
|
+
size?: "xs" | "sm" | "base" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl" | "8xl" | "9xl" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | string;
|
|
46
46
|
};
|
|
47
47
|
declare const Text: React.FC<TypographyProps>;
|
|
48
48
|
export default Text;
|