funuicss 3.6.4 → 3.6.6
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/package.json +1 -1
- package/ui/input/Input.d.ts +3 -0
- package/ui/input/Input.js +30 -12
- package/ui/theme/theme.js +12 -9
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.6.
|
|
2
|
+
"version": "3.6.6",
|
|
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",
|
package/ui/input/Input.d.ts
CHANGED
package/ui/input/Input.js
CHANGED
|
@@ -75,9 +75,23 @@ var generateInputClasses = function (_a) {
|
|
|
75
75
|
var borderClass = bordered ? 'borderedInput' : borderless ? 'borderless' : '';
|
|
76
76
|
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 input\n ").trim().replace(/\s+/g, ' ');
|
|
77
77
|
};
|
|
78
|
+
// Iconic Input Wrapper Component
|
|
79
|
+
var IconicInputWrapper = function (_a) {
|
|
80
|
+
var startIcon = _a.startIcon, endIcon = _a.endIcon, iconicBg = _a.iconicBg, funcss = _a.funcss, children = _a.children;
|
|
81
|
+
if (!startIcon && !endIcon) {
|
|
82
|
+
return react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
83
|
+
}
|
|
84
|
+
return (react_1.default.createElement("div", { className: "icon-container ".concat(funcss || '') },
|
|
85
|
+
startIcon && (react_1.default.createElement("div", { className: "leftIcon", style: {
|
|
86
|
+
backgroundColor: iconicBg || '',
|
|
87
|
+
border: iconicBg ? "0.1rem ".concat(iconicBg, " solid") : '',
|
|
88
|
+
} }, startIcon)),
|
|
89
|
+
react_1.default.createElement("div", { className: "icon_input_wrapper ".concat(startIcon ? 'lefticon' : '', " ").concat(endIcon ? 'righticon' : '') }, children),
|
|
90
|
+
endIcon && (react_1.default.createElement("div", { className: "rightIcon", style: { backgroundColor: iconicBg || '' } }, endIcon))));
|
|
91
|
+
};
|
|
78
92
|
// Text Input Component
|
|
79
93
|
var TextInput = function (_a) {
|
|
80
|
-
var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, status = _a.status, funcss = _a.funcss, bg = _a.bg,
|
|
94
|
+
var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, status = _a.status, funcss = _a.funcss, bg = _a.bg, _b = _a.fullWidth, fullWidth = _b === void 0 ? true : _b, flat = _a.flat, bordered = _a.bordered, borderless = _a.borderless, rounded = _a.rounded, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, startIcon = _a.startIcon, endIcon = _a.endIcon, iconicBg = _a.iconicBg, _c = _a.type, type = _c === void 0 ? 'text' : _c, label = _a.label, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "iconicBg", "type", "label"]);
|
|
81
95
|
var className = generateInputClasses({
|
|
82
96
|
status: status,
|
|
83
97
|
rounded: rounded,
|
|
@@ -90,13 +104,13 @@ var TextInput = function (_a) {
|
|
|
90
104
|
borderless: borderless
|
|
91
105
|
});
|
|
92
106
|
var style = fullWidth ? { width: '100%' } : undefined;
|
|
93
|
-
"";
|
|
94
|
-
return (react_1.default.createElement(
|
|
107
|
+
var inputElement = (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)));
|
|
108
|
+
return (react_1.default.createElement(IconicInputWrapper, { startIcon: startIcon, endIcon: endIcon, iconicBg: iconicBg, funcss: funcss }, inputElement));
|
|
95
109
|
};
|
|
96
110
|
exports.TextInput = TextInput;
|
|
97
111
|
// Select Component
|
|
98
112
|
var SelectInput = function (_a) {
|
|
99
|
-
var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, status = _a.status, funcss = _a.funcss, bg = _a.bg, fullWidth = _a.fullWidth, flat = _a.flat, bordered = _a.bordered, borderless = _a.borderless, rounded = _a.rounded, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, _b = _a.options, options = _b === void 0 ? [] : _b, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "options"]);
|
|
113
|
+
var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, status = _a.status, funcss = _a.funcss, bg = _a.bg, fullWidth = _a.fullWidth, flat = _a.flat, bordered = _a.bordered, borderless = _a.borderless, rounded = _a.rounded, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, startIcon = _a.startIcon, endIcon = _a.endIcon, iconicBg = _a.iconicBg, _b = _a.options, options = _b === void 0 ? [] : _b, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "iconicBg", "options"]);
|
|
100
114
|
var className = generateInputClasses({
|
|
101
115
|
status: status,
|
|
102
116
|
rounded: rounded,
|
|
@@ -109,12 +123,13 @@ var SelectInput = function (_a) {
|
|
|
109
123
|
borderless: borderless
|
|
110
124
|
});
|
|
111
125
|
var style = fullWidth ? { width: '100%' } : undefined;
|
|
112
|
-
|
|
126
|
+
var selectElement = (react_1.default.createElement("select", __assign({ id: id, name: name, className: className, onChange: onChange, defaultValue: defaultValue, value: value, style: style }, rest), options.map(function (option) { return (react_1.default.createElement("option", { key: option.value, value: option.value }, option.text)); })));
|
|
127
|
+
return (react_1.default.createElement(IconicInputWrapper, { startIcon: startIcon, endIcon: endIcon, iconicBg: iconicBg, funcss: funcss }, selectElement));
|
|
113
128
|
};
|
|
114
129
|
exports.SelectInput = SelectInput;
|
|
115
130
|
// Textarea Component
|
|
116
131
|
var TextareaInput = function (_a) {
|
|
117
|
-
var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, status = _a.status, funcss = _a.funcss, bg = _a.bg, fullWidth = _a.fullWidth, flat = _a.flat, bordered = _a.bordered, borderless = _a.borderless, rounded = _a.rounded, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, label = _a.label, _b = _a.rows, rows = _b === void 0 ? 2 : _b, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "label", "rows"]);
|
|
132
|
+
var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, status = _a.status, funcss = _a.funcss, bg = _a.bg, fullWidth = _a.fullWidth, flat = _a.flat, bordered = _a.bordered, borderless = _a.borderless, rounded = _a.rounded, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, startIcon = _a.startIcon, endIcon = _a.endIcon, iconicBg = _a.iconicBg, label = _a.label, _b = _a.rows, rows = _b === void 0 ? 2 : _b, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "iconicBg", "label", "rows"]);
|
|
118
133
|
var className = generateInputClasses({
|
|
119
134
|
status: status,
|
|
120
135
|
rounded: rounded,
|
|
@@ -127,12 +142,13 @@ var TextareaInput = function (_a) {
|
|
|
127
142
|
borderless: borderless
|
|
128
143
|
});
|
|
129
144
|
var style = fullWidth ? { width: '100%' } : undefined;
|
|
130
|
-
|
|
145
|
+
var textareaElement = (react_1.default.createElement("textarea", __assign({ id: id, name: name, className: className, onChange: onChange, defaultValue: defaultValue, placeholder: label, style: style, value: value, rows: rows }, rest)));
|
|
146
|
+
return (react_1.default.createElement(IconicInputWrapper, { startIcon: startIcon, endIcon: endIcon, iconicBg: iconicBg, funcss: funcss }, textareaElement));
|
|
131
147
|
};
|
|
132
148
|
exports.TextareaInput = TextareaInput;
|
|
133
149
|
// File Input Component
|
|
134
150
|
var FileInput = function (_a) {
|
|
135
|
-
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, _c = _a.label, label = _c === void 0 ? 'Upload File' : _c, icon = _a.icon, extra = _a.extra, button = _a.button, btn = _a.btn, value = _a.value, rest = __rest(_a, ["id", "name", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "rounded", "leftRounded", "rightRounded", "label", "icon", "extra", "button", "btn", "value"]);
|
|
151
|
+
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, iconicBg = _a.iconicBg, _c = _a.label, label = _c === void 0 ? 'Upload File' : _c, icon = _a.icon, extra = _a.extra, button = _a.button, btn = _a.btn, value = _a.value, rest = __rest(_a, ["id", "name", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "iconicBg", "label", "icon", "extra", "button", "btn", "value"]);
|
|
136
152
|
var _d = (0, react_1.useState)(''), fileName = _d[0], setFileName = _d[1];
|
|
137
153
|
var handleChange = function (e) {
|
|
138
154
|
var _a;
|
|
@@ -157,11 +173,12 @@ var FileInput = function (_a) {
|
|
|
157
173
|
additionalClasses: 'filedInput'
|
|
158
174
|
});
|
|
159
175
|
var style = fullWidth ? { width: '100%' } : undefined;
|
|
160
|
-
|
|
176
|
+
var fileInputElement = (react_1.default.createElement("div", { className: "fileInput" },
|
|
161
177
|
button || (react_1.default.createElement(Button_1.default, { funcss: funcss, startIcon: icon || react_1.default.createElement(pi_1.PiCloudArrowUp, null), bg: "primary", fullWidth: true, raised: true }, fileName || label)),
|
|
162
178
|
react_1.default.createElement("input", __assign({ id: id, name: name, className: className, onChange: handleChange, type: "file", style: style, value: value }, rest))));
|
|
179
|
+
return (react_1.default.createElement(IconicInputWrapper, { startIcon: startIcon, endIcon: endIcon, iconicBg: iconicBg, funcss: funcss }, fileInputElement));
|
|
163
180
|
}
|
|
164
|
-
|
|
181
|
+
var uploadElement = (react_1.default.createElement("div", { className: "_upload_container" },
|
|
165
182
|
react_1.default.createElement("label", { htmlFor: id, className: "_upload_label" },
|
|
166
183
|
react_1.default.createElement("div", { className: "_upload_icon" }, icon || react_1.default.createElement(pi_1.PiCloudArrowUp, null)),
|
|
167
184
|
react_1.default.createElement("div", { className: "_upload_text", style: {
|
|
@@ -173,13 +190,14 @@ var FileInput = function (_a) {
|
|
|
173
190
|
} }, fileName || label),
|
|
174
191
|
extra && react_1.default.createElement("div", { className: "text-small opacity-3" }, extra)),
|
|
175
192
|
react_1.default.createElement("input", __assign({ onChange: handleChange, type: "file", id: id, className: "_upload_input" }, rest))));
|
|
193
|
+
return (react_1.default.createElement(IconicInputWrapper, { startIcon: startIcon, endIcon: endIcon, iconicBg: iconicBg, funcss: funcss }, uploadElement));
|
|
176
194
|
};
|
|
177
195
|
exports.FileInput = FileInput;
|
|
178
196
|
var Input = function (_a) {
|
|
179
|
-
var select = _a.select, multiline = _a.multiline, file = _a.file, noBorder = _a.noBorder, props = __rest(_a, ["select", "multiline", "file", "noBorder"]);
|
|
197
|
+
var select = _a.select, multiline = _a.multiline, file = _a.file, noBorder = _a.noBorder, startIcon = _a.startIcon, endIcon = _a.endIcon, iconicBg = _a.iconicBg, props = __rest(_a, ["select", "multiline", "file", "noBorder", "startIcon", "endIcon", "iconicBg"]);
|
|
180
198
|
// Handle legacy noBorder prop
|
|
181
199
|
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 });
|
|
200
|
+
var inputProps = __assign(__assign({}, props), { startIcon: startIcon, endIcon: endIcon, iconicBg: iconicBg, bordered: variant === 'standard' ? true : props.bordered, borderless: variant === 'minimal' ? true : noBorder || props.borderless });
|
|
183
201
|
if (select) {
|
|
184
202
|
return react_1.default.createElement(exports.SelectInput, __assign({}, inputProps));
|
|
185
203
|
}
|
package/ui/theme/theme.js
CHANGED
|
@@ -33,16 +33,16 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
return result;
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
37
|
exports.useVariant = void 0;
|
|
41
38
|
var react_1 = __importStar(require("react"));
|
|
42
39
|
var themes_1 = require("./themes");
|
|
43
40
|
var darkenUtils_1 = require("./darkenUtils");
|
|
44
41
|
var firestore_1 = require("firebase/firestore");
|
|
45
|
-
var
|
|
42
|
+
var db;
|
|
43
|
+
if (typeof window !== 'undefined') {
|
|
44
|
+
db = require('../../utils/Firebase').default;
|
|
45
|
+
}
|
|
46
46
|
var VariantContext = (0, react_1.createContext)({
|
|
47
47
|
variant: 'standard',
|
|
48
48
|
setVariant: function () {
|
|
@@ -57,6 +57,7 @@ exports.useVariant = useVariant;
|
|
|
57
57
|
var ThemeProvider = function (_a) {
|
|
58
58
|
var theme = _a.theme, children = _a.children, projectId = _a.projectId;
|
|
59
59
|
var _b = (0, react_1.useState)('standard'), variant = _b[0], setVariant = _b[1];
|
|
60
|
+
var _c = (0, react_1.useState)(false), projectLoaded = _c[0], setprojectLoaded = _c[1];
|
|
60
61
|
/* -------------------------- Apply base theme --------------------------- */
|
|
61
62
|
(0, react_1.useEffect)(function () {
|
|
62
63
|
var root = document.documentElement;
|
|
@@ -80,12 +81,12 @@ var ThemeProvider = function (_a) {
|
|
|
80
81
|
}, [theme]);
|
|
81
82
|
/* ---------------------- Real-time Firestore sync ----------------------- */
|
|
82
83
|
(0, react_1.useEffect)(function () {
|
|
83
|
-
if (typeof window === 'undefined')
|
|
84
|
-
|
|
85
|
-
if (!projectId)
|
|
84
|
+
if (typeof window === 'undefined' || !projectId) {
|
|
85
|
+
setprojectLoaded(true);
|
|
86
86
|
return;
|
|
87
|
+
}
|
|
87
88
|
var root = document.documentElement;
|
|
88
|
-
var docRef = (0, firestore_1.doc)(
|
|
89
|
+
var docRef = (0, firestore_1.doc)(db, 'Projects', projectId);
|
|
89
90
|
var unsubscribe = (0, firestore_1.onSnapshot)(docRef, function (snapshot) {
|
|
90
91
|
var _a;
|
|
91
92
|
var data = snapshot.data();
|
|
@@ -98,8 +99,10 @@ var ThemeProvider = function (_a) {
|
|
|
98
99
|
var key = _a[0], value = _a[1];
|
|
99
100
|
root.style.setProperty(key.startsWith('--') ? key : "--".concat(key), String(value));
|
|
100
101
|
});
|
|
102
|
+
setprojectLoaded(true);
|
|
101
103
|
}, function (error) {
|
|
102
104
|
console.error('Realtime theme listener error:', error);
|
|
105
|
+
setprojectLoaded(true);
|
|
103
106
|
});
|
|
104
107
|
return function () { return unsubscribe(); };
|
|
105
108
|
}, [projectId]);
|
|
@@ -109,6 +112,6 @@ var ThemeProvider = function (_a) {
|
|
|
109
112
|
backgroundColor: 'var(--page-bg)',
|
|
110
113
|
color: 'var(--text-color)',
|
|
111
114
|
minHeight: '100vh',
|
|
112
|
-
} }, children)));
|
|
115
|
+
} }, projectLoaded ? children : "")));
|
|
113
116
|
};
|
|
114
117
|
exports.default = ThemeProvider;
|