funuicss 3.7.1 → 3.7.3
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 +619 -75
- package/index.d.ts +2 -1
- package/index.js +8 -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 +235 -42
- package/ui/chart/Line.js +19 -124
- package/ui/chart/Pie.d.ts +61 -7
- package/ui/chart/Pie.js +204 -41
- package/ui/drop/Dropdown.d.ts +4 -3
- package/ui/drop/Dropdown.js +24 -29
- package/ui/input/FileUpload.d.ts +21 -0
- package/ui/input/FileUpload.js +235 -0
- package/ui/input/Input.d.ts +0 -7
- package/ui/input/Input.js +16 -136
- 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.js +55 -49
- package/ui/text/Text.d.ts +2 -1
- package/ui/text/Text.js +51 -50
- package/ui/theme/theme.d.ts +34 -0
- package/ui/theme/theme.js +198 -18
- package/ui/vista/Vista.js +58 -141
- package/utils/componentUtils.js +27 -4
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface FileUploadProps {
|
|
3
|
+
id?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
6
|
+
onDrop?: (files: FileList) => void;
|
|
7
|
+
status?: 'success' | 'warning' | 'danger' | 'info' | '';
|
|
8
|
+
label?: string;
|
|
9
|
+
helperText?: string;
|
|
10
|
+
icon?: React.ReactNode;
|
|
11
|
+
extra?: React.ReactNode;
|
|
12
|
+
button?: React.ReactNode;
|
|
13
|
+
btn?: boolean;
|
|
14
|
+
value?: any;
|
|
15
|
+
fullWidth?: boolean;
|
|
16
|
+
accept?: string;
|
|
17
|
+
multiple?: boolean;
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
export declare const FileUpload: React.FC<FileUploadProps & React.InputHTMLAttributes<HTMLInputElement>>;
|
|
21
|
+
export default FileUpload;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
48
|
+
var t = {};
|
|
49
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
50
|
+
t[p] = s[p];
|
|
51
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
52
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
53
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
54
|
+
t[p[i]] = s[p[i]];
|
|
55
|
+
}
|
|
56
|
+
return t;
|
|
57
|
+
};
|
|
58
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
59
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
|
+
};
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
exports.FileUpload = void 0;
|
|
63
|
+
var react_1 = __importStar(require("react"));
|
|
64
|
+
var pi_1 = require("react-icons/pi");
|
|
65
|
+
var Button_1 = __importDefault(require("../button/Button"));
|
|
66
|
+
var Text_1 = __importDefault(require("../text/Text"));
|
|
67
|
+
var FileUpload = function (_a) {
|
|
68
|
+
var _b = _a.id, id = _b === void 0 ? 'fileInput' : _b, name = _a.name, onChange = _a.onChange, onDrop = _a.onDrop, status = _a.status, _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.fullWidth, fullWidth = _d === void 0 ? true : _d, accept = _a.accept, multiple = _a.multiple, rest = __rest(_a, ["id", "name", "onChange", "onDrop", "status", "label", "helperText", "icon", "extra", "button", "btn", "value", "fullWidth", "accept", "multiple"]);
|
|
69
|
+
var _e = (0, react_1.useState)(''), fileName = _e[0], setFileName = _e[1];
|
|
70
|
+
var _f = (0, react_1.useState)(false), isDragging = _f[0], setIsDragging = _f[1];
|
|
71
|
+
var _g = (0, react_1.useState)(false), isDragOver = _g[0], setIsDragOver = _g[1];
|
|
72
|
+
var inputRef = (0, react_1.useRef)(null);
|
|
73
|
+
var handleChange = function (e) {
|
|
74
|
+
var files = e.target.files;
|
|
75
|
+
if (files && files.length > 0) {
|
|
76
|
+
var file = files[0];
|
|
77
|
+
setFileName(file.name);
|
|
78
|
+
}
|
|
79
|
+
if (onChange)
|
|
80
|
+
onChange(e);
|
|
81
|
+
};
|
|
82
|
+
var handleDragEnter = function (e) {
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
e.stopPropagation();
|
|
85
|
+
setIsDragging(true);
|
|
86
|
+
setIsDragOver(true);
|
|
87
|
+
};
|
|
88
|
+
var handleDragLeave = function (e) {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
e.stopPropagation();
|
|
91
|
+
setIsDragOver(false);
|
|
92
|
+
// Only set dragging to false if we're leaving the actual drop zone
|
|
93
|
+
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
94
|
+
setIsDragging(false);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
var handleDragOver = function (e) {
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
e.stopPropagation();
|
|
100
|
+
setIsDragOver(true);
|
|
101
|
+
};
|
|
102
|
+
var handleDrop = function (e) {
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
e.stopPropagation();
|
|
105
|
+
setIsDragging(false);
|
|
106
|
+
setIsDragOver(false);
|
|
107
|
+
var files = e.dataTransfer.files;
|
|
108
|
+
if (files && files.length > 0) {
|
|
109
|
+
var file = files[0];
|
|
110
|
+
setFileName(file.name);
|
|
111
|
+
// Update the input element's files
|
|
112
|
+
if (inputRef.current) {
|
|
113
|
+
var dataTransfer = new DataTransfer();
|
|
114
|
+
for (var i = 0; i < files.length; i++) {
|
|
115
|
+
dataTransfer.items.add(files[i]);
|
|
116
|
+
}
|
|
117
|
+
inputRef.current.files = dataTransfer.files;
|
|
118
|
+
// Trigger onChange if provided
|
|
119
|
+
if (onChange) {
|
|
120
|
+
var event_1 = {
|
|
121
|
+
target: inputRef.current,
|
|
122
|
+
currentTarget: inputRef.current,
|
|
123
|
+
};
|
|
124
|
+
onChange(event_1);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// Call onDrop callback if provided
|
|
128
|
+
if (onDrop) {
|
|
129
|
+
onDrop(files);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
var handleClick = function () {
|
|
134
|
+
if (inputRef.current) {
|
|
135
|
+
inputRef.current.click();
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
// Enhanced drag and drop styles
|
|
139
|
+
var getContainerStyles = function () {
|
|
140
|
+
var baseStyles = {
|
|
141
|
+
border: '0.17rem dashed var(--borderColor)',
|
|
142
|
+
borderRadius: '16px',
|
|
143
|
+
padding: 'var(--space-5)',
|
|
144
|
+
textAlign: 'center',
|
|
145
|
+
transition: 'all 0.3s ease',
|
|
146
|
+
cursor: 'pointer',
|
|
147
|
+
margin: 'auto',
|
|
148
|
+
color: 'var(--text-color)',
|
|
149
|
+
position: 'relative',
|
|
150
|
+
};
|
|
151
|
+
if (isDragOver) {
|
|
152
|
+
return __assign(__assign({}, baseStyles), { borderColor: 'var(--primary)', backgroundColor: 'var(--lighter)', transform: 'scale(1.02)', boxShadow: '0 4px 12px rgba(0, 0, 0, 0.1)' });
|
|
153
|
+
}
|
|
154
|
+
if (isDragging) {
|
|
155
|
+
return __assign(__assign({}, baseStyles), { borderColor: 'var(--primary600)', backgroundColor: 'var(--lighter)' });
|
|
156
|
+
}
|
|
157
|
+
return baseStyles;
|
|
158
|
+
};
|
|
159
|
+
var getButtonStyles = function () {
|
|
160
|
+
if (isDragOver) {
|
|
161
|
+
return {
|
|
162
|
+
opacity: 0.8,
|
|
163
|
+
transform: 'scale(1.05)',
|
|
164
|
+
transition: 'all 0.2s ease',
|
|
165
|
+
backgroundColor: 'var(--primary600)',
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
return {};
|
|
169
|
+
};
|
|
170
|
+
// Render file info when file is selected
|
|
171
|
+
var renderFileInfo = function () {
|
|
172
|
+
if (!fileName)
|
|
173
|
+
return null;
|
|
174
|
+
return (react_1.default.createElement("div", { className: "file-info", style: {
|
|
175
|
+
marginTop: 'var(--space-3)',
|
|
176
|
+
padding: 'var(--space-3)',
|
|
177
|
+
backgroundColor: 'var(--light)',
|
|
178
|
+
borderRadius: '8px',
|
|
179
|
+
border: '1px solid var(--borderColor)',
|
|
180
|
+
display: 'flex',
|
|
181
|
+
alignItems: 'center',
|
|
182
|
+
gap: 'var(--space-3)',
|
|
183
|
+
justifyContent: 'center'
|
|
184
|
+
} },
|
|
185
|
+
react_1.default.createElement(pi_1.PiFile, { style: { color: 'var(--primary)', fontSize: '1.2rem' } }),
|
|
186
|
+
react_1.default.createElement(Text_1.default, { text: fileName, truncate: 1, block: true, size: 'sm' })));
|
|
187
|
+
};
|
|
188
|
+
if (btn) {
|
|
189
|
+
return (react_1.default.createElement("div", { className: "fileInput", style: { width: fullWidth ? '100%' : 'fit-content' } },
|
|
190
|
+
button || (react_1.default.createElement("div", { onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, onDragOver: handleDragOver, onDrop: handleDrop, onClick: handleClick, style: { position: 'relative' } },
|
|
191
|
+
react_1.default.createElement(Button_1.default, { startIcon: icon || react_1.default.createElement(pi_1.PiCloudArrowUp, null), bg: isDragOver ? "primary600" : "primary", fullWidth: fullWidth, raised: true, style: getButtonStyles() }, isDragOver ? 'Drop files here' : fileName || label))),
|
|
192
|
+
react_1.default.createElement("input", __assign({ ref: inputRef, id: id, name: name, onChange: handleChange, type: "file", value: value, accept: accept, multiple: multiple, className: "filedInput" }, rest)),
|
|
193
|
+
renderFileInfo(),
|
|
194
|
+
helperText && (react_1.default.createElement("div", { className: "input-helper-text ".concat(status ? "helper-".concat(status) : ''), style: { marginTop: 'var(--space-3)' } },
|
|
195
|
+
react_1.default.createElement("span", null, helperText)))));
|
|
196
|
+
}
|
|
197
|
+
return (react_1.default.createElement("div", { className: "_upload_container", style: getContainerStyles(), onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, onDragOver: handleDragOver, onDrop: handleDrop, onClick: handleClick },
|
|
198
|
+
react_1.default.createElement("div", { className: "_upload_label" },
|
|
199
|
+
react_1.default.createElement("div", { className: "_upload_icon", style: {
|
|
200
|
+
fontSize: '2.4rem',
|
|
201
|
+
color: isDragOver ? 'var(--primary600)' : 'var(--primary)',
|
|
202
|
+
marginBottom: '0.5rem',
|
|
203
|
+
transition: 'color 0.3s ease',
|
|
204
|
+
transform: isDragOver ? 'translateY(-2px)' : 'none'
|
|
205
|
+
} }, icon || react_1.default.createElement(pi_1.PiCloudArrowUp, null)),
|
|
206
|
+
react_1.default.createElement("div", { className: "_upload_text fit" },
|
|
207
|
+
react_1.default.createElement(Text_1.default, { text: isDragOver ? 'Drop files to upload' : fileName || label, truncate: 1, block: true, style: {
|
|
208
|
+
color: isDragOver ? 'var(--primary600)' : 'var(--text-color)',
|
|
209
|
+
fontWeight: isDragOver ? '600' : '400'
|
|
210
|
+
} })),
|
|
211
|
+
isDragOver && (react_1.default.createElement("div", { style: {
|
|
212
|
+
position: 'absolute',
|
|
213
|
+
top: 0,
|
|
214
|
+
left: 0,
|
|
215
|
+
right: 0,
|
|
216
|
+
bottom: 0,
|
|
217
|
+
backgroundColor: 'var(--primary)',
|
|
218
|
+
opacity: 0.1,
|
|
219
|
+
borderRadius: '14px',
|
|
220
|
+
pointerEvents: 'none'
|
|
221
|
+
} })),
|
|
222
|
+
!fileName && !isDragOver && (react_1.default.createElement("div", { style: {
|
|
223
|
+
marginTop: 'var(--space-3)',
|
|
224
|
+
fontSize: '0.8rem',
|
|
225
|
+
color: 'var(--text-muted)',
|
|
226
|
+
opacity: 0.7
|
|
227
|
+
} }, "Click or drag files to upload")),
|
|
228
|
+
extra && react_1.default.createElement("div", { className: "text-small opacity-3", style: { marginTop: 'var(--space-2)' } }, extra)),
|
|
229
|
+
react_1.default.createElement("input", __assign({ ref: inputRef, onChange: handleChange, type: "file", id: id, name: name, className: "_upload_input", value: value, accept: accept, multiple: multiple }, rest)),
|
|
230
|
+
renderFileInfo(),
|
|
231
|
+
helperText && (react_1.default.createElement("div", { className: "input-helper-text ".concat(status ? "helper-".concat(status) : ''), style: { marginTop: 'var(--space-3)' } },
|
|
232
|
+
react_1.default.createElement("span", null, helperText)))));
|
|
233
|
+
};
|
|
234
|
+
exports.FileUpload = FileUpload;
|
|
235
|
+
exports.default = exports.FileUpload;
|
package/ui/input/Input.d.ts
CHANGED
|
@@ -39,16 +39,9 @@ interface SelectProps extends BaseInputProps {
|
|
|
39
39
|
interface TextareaProps extends BaseInputProps {
|
|
40
40
|
rows?: number;
|
|
41
41
|
}
|
|
42
|
-
interface FileInputProps extends BaseInputProps {
|
|
43
|
-
icon?: React.ReactNode;
|
|
44
|
-
extra?: React.ReactNode;
|
|
45
|
-
button?: React.ReactNode;
|
|
46
|
-
btn?: boolean;
|
|
47
|
-
}
|
|
48
42
|
export declare const TextInput: React.FC<TextInputProps & React.InputHTMLAttributes<HTMLInputElement>>;
|
|
49
43
|
export declare const SelectInput: React.FC<SelectProps & React.SelectHTMLAttributes<HTMLSelectElement>>;
|
|
50
44
|
export declare const TextareaInput: React.FC<TextareaProps & React.TextareaHTMLAttributes<HTMLTextAreaElement>>;
|
|
51
|
-
export declare const FileInput: React.FC<FileInputProps & React.InputHTMLAttributes<HTMLInputElement>>;
|
|
52
45
|
interface InputProps extends BaseInputProps {
|
|
53
46
|
select?: boolean;
|
|
54
47
|
multiline?: boolean;
|
package/ui/input/Input.js
CHANGED
|
@@ -55,17 +55,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
55
55
|
}
|
|
56
56
|
return t;
|
|
57
57
|
};
|
|
58
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
59
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
|
-
};
|
|
61
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
-
exports.
|
|
59
|
+
exports.TextareaInput = exports.SelectInput = exports.TextInput = void 0;
|
|
63
60
|
var react_1 = __importStar(require("react"));
|
|
64
61
|
var pi_1 = require("react-icons/pi");
|
|
65
|
-
var Button_1 = __importDefault(require("../button/Button"));
|
|
66
62
|
var theme_1 = require("../theme/theme");
|
|
67
63
|
var componentUtils_1 = require("../../utils/componentUtils");
|
|
68
64
|
var getDynamicIcon_1 = require("../../utils/getDynamicIcon");
|
|
65
|
+
var FileUpload_1 = require("./FileUpload"); // Import the FileUpload component
|
|
69
66
|
// Status icons mapping
|
|
70
67
|
var statusIcons = {
|
|
71
68
|
success: react_1.default.createElement(pi_1.PiCheckCircle, null),
|
|
@@ -104,9 +101,9 @@ var IconicInputWrapper = function (_a) {
|
|
|
104
101
|
};
|
|
105
102
|
// Input Container with Floating Label
|
|
106
103
|
var InputContainer = function (_a) {
|
|
107
|
-
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.
|
|
108
|
-
// For select inputs, label is always active
|
|
109
|
-
var showFloatingLabel = label && (
|
|
104
|
+
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.alwaysActiveLabel, alwaysActiveLabel = _b === void 0 ? false : _b;
|
|
105
|
+
// For select inputs and date/time inputs, label is always active
|
|
106
|
+
var showFloatingLabel = label && (alwaysActiveLabel || isFocused || hasValue);
|
|
110
107
|
return (react_1.default.createElement("div", { className: "input-wrapper ".concat(fullWidth ? 'full-width' : '') },
|
|
111
108
|
react_1.default.createElement("div", { className: "input-container-with-label" },
|
|
112
109
|
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)),
|
|
@@ -123,6 +120,8 @@ var TextInput = function (_a) {
|
|
|
123
120
|
var _g = (0, react_1.useState)(null), prefixNode = _g[0], setPrefixNode = _g[1];
|
|
124
121
|
var _h = (0, react_1.useState)(null), suffixNode = _h[0], setSuffixNode = _h[1];
|
|
125
122
|
var inputRef = (0, react_1.useRef)(null);
|
|
123
|
+
// Check if this is a date/time input type for always active label
|
|
124
|
+
var isDateTimeInput = ['date', 'time', 'month', 'week', 'datetime-local'].includes(type || '');
|
|
126
125
|
// Handle value changes - only update if value is truly defined (not empty string)
|
|
127
126
|
(0, react_1.useEffect)(function () {
|
|
128
127
|
if (value !== undefined && value !== '') {
|
|
@@ -238,7 +237,7 @@ var TextInput = function (_a) {
|
|
|
238
237
|
var showPlaceholder = placeholder && label && (isFocused || !!inputValue);
|
|
239
238
|
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)));
|
|
240
239
|
var wrappedInput = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: final.iconicBg, funcss: final.funcss }, inputElement));
|
|
241
|
-
return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: final.status, helperText: helperText, isFocused: isFocused, hasValue: !!inputValue, fullWidth: final.fullWidth, id: id }, wrappedInput));
|
|
240
|
+
return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: final.status, helperText: helperText, isFocused: isFocused, hasValue: !!inputValue, fullWidth: final.fullWidth, id: id, alwaysActiveLabel: isDateTimeInput }, wrappedInput));
|
|
242
241
|
};
|
|
243
242
|
exports.TextInput = TextInput;
|
|
244
243
|
// Select Component
|
|
@@ -362,7 +361,7 @@ var SelectInput = function (_a) {
|
|
|
362
361
|
};
|
|
363
362
|
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)); })));
|
|
364
363
|
var wrappedSelect = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: final.iconicBg, funcss: final.funcss }, selectElement));
|
|
365
|
-
return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: final.status, helperText: helperText, isFocused: isFocused, hasValue: selectHasValue, fullWidth: final.fullWidth, id: id,
|
|
364
|
+
return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: final.status, helperText: helperText, isFocused: isFocused, hasValue: selectHasValue, fullWidth: final.fullWidth, id: id, alwaysActiveLabel: true }, wrappedSelect));
|
|
366
365
|
};
|
|
367
366
|
exports.SelectInput = SelectInput;
|
|
368
367
|
// Textarea Component
|
|
@@ -490,142 +489,23 @@ var TextareaInput = function (_a) {
|
|
|
490
489
|
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));
|
|
491
490
|
};
|
|
492
491
|
exports.TextareaInput = TextareaInput;
|
|
493
|
-
// File Input Component (updated with no_prefix and no_label logic)
|
|
494
|
-
var FileInput = function (_a) {
|
|
495
|
-
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"]);
|
|
496
|
-
var _e = (0, react_1.useState)(''), fileName = _e[0], setFileName = _e[1];
|
|
497
|
-
var _f = (0, react_1.useState)(null), prefixNode = _f[0], setPrefixNode = _f[1];
|
|
498
|
-
var _g = (0, react_1.useState)(null), suffixNode = _g[0], setSuffixNode = _g[1];
|
|
499
|
-
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
|
|
500
|
-
// Create local props object including stringPrefix/stringSuffix
|
|
501
|
-
var localProps = {
|
|
502
|
-
status: status,
|
|
503
|
-
funcss: funcss,
|
|
504
|
-
bg: bg,
|
|
505
|
-
fullWidth: fullWidth,
|
|
506
|
-
flat: flat,
|
|
507
|
-
rounded: rounded,
|
|
508
|
-
leftRounded: leftRounded,
|
|
509
|
-
rightRounded: rightRounded,
|
|
510
|
-
startIcon: startIcon,
|
|
511
|
-
endIcon: endIcon,
|
|
512
|
-
prefix: prefix,
|
|
513
|
-
suffix: suffix,
|
|
514
|
-
iconicBg: iconicBg,
|
|
515
|
-
stringPrefix: stringPrefix, // Include in local props
|
|
516
|
-
stringSuffix: stringSuffix, // Include in local props
|
|
517
|
-
bordered: rest.bordered,
|
|
518
|
-
borderless: rest.borderless,
|
|
519
|
-
};
|
|
520
|
-
// Merge with config - LOCAL PROPS OVERRIDE CONFIG
|
|
521
|
-
var mergedProps = mergeWithLocal(localProps).props;
|
|
522
|
-
// Extract final values - local props take precedence
|
|
523
|
-
var final = {
|
|
524
|
-
status: status !== undefined ? status : mergedProps.status,
|
|
525
|
-
funcss: funcss !== undefined ? funcss : mergedProps.funcss,
|
|
526
|
-
bg: bg !== undefined ? bg : mergedProps.bg,
|
|
527
|
-
fullWidth: fullWidth !== undefined ? fullWidth : mergedProps.fullWidth,
|
|
528
|
-
flat: flat !== undefined ? flat : mergedProps.flat,
|
|
529
|
-
rounded: rounded !== undefined ? rounded : mergedProps.rounded,
|
|
530
|
-
leftRounded: leftRounded !== undefined ? leftRounded : mergedProps.leftRounded,
|
|
531
|
-
rightRounded: rightRounded !== undefined ? rightRounded : mergedProps.rightRounded,
|
|
532
|
-
startIcon: startIcon !== undefined ? startIcon : mergedProps.startIcon,
|
|
533
|
-
endIcon: endIcon !== undefined ? endIcon : mergedProps.endIcon,
|
|
534
|
-
prefix: prefix !== undefined ? prefix : mergedProps.prefix,
|
|
535
|
-
suffix: suffix !== undefined ? suffix : mergedProps.suffix,
|
|
536
|
-
iconicBg: iconicBg !== undefined ? iconicBg : mergedProps.iconicBg,
|
|
537
|
-
stringPrefix: stringPrefix !== undefined ? stringPrefix : mergedProps.stringPrefix, // Handle both local and config
|
|
538
|
-
stringSuffix: stringSuffix !== undefined ? stringSuffix : mergedProps.stringSuffix, // Handle both local and config
|
|
539
|
-
};
|
|
540
|
-
// Handle stringPrefix - use final value (local or config)
|
|
541
|
-
(0, react_1.useEffect)(function () {
|
|
542
|
-
var effectiveStringPrefix = final.stringPrefix;
|
|
543
|
-
if (effectiveStringPrefix) {
|
|
544
|
-
(0, getDynamicIcon_1.getDynamicIcon)(effectiveStringPrefix).then(function (node) { return setPrefixNode(node); });
|
|
545
|
-
}
|
|
546
|
-
else {
|
|
547
|
-
setPrefixNode(null);
|
|
548
|
-
}
|
|
549
|
-
}, [final.stringPrefix]);
|
|
550
|
-
// Handle stringSuffix - use final value (local or config)
|
|
551
|
-
(0, react_1.useEffect)(function () {
|
|
552
|
-
var effectiveStringSuffix = final.stringSuffix;
|
|
553
|
-
if (effectiveStringSuffix) {
|
|
554
|
-
(0, getDynamicIcon_1.getDynamicIcon)(effectiveStringSuffix).then(function (node) { return setSuffixNode(node); });
|
|
555
|
-
}
|
|
556
|
-
else {
|
|
557
|
-
setSuffixNode(null);
|
|
558
|
-
}
|
|
559
|
-
}, [final.stringSuffix]);
|
|
560
|
-
var handleChange = function (e) {
|
|
561
|
-
var _a;
|
|
562
|
-
var file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
563
|
-
if (file) {
|
|
564
|
-
setFileName(file.name);
|
|
565
|
-
}
|
|
566
|
-
if (onChange)
|
|
567
|
-
onChange(e);
|
|
568
|
-
};
|
|
569
|
-
var effectivePrefix = prefixNode || final.prefix || final.startIcon;
|
|
570
|
-
var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
|
|
571
|
-
// Check if there's no start icon or prefix
|
|
572
|
-
var hasNoPrefix = !effectivePrefix;
|
|
573
|
-
// Check if there's no label (file inputs typically don't have labels in the same way)
|
|
574
|
-
var hasNoLabel = true; // File inputs use their own label system
|
|
575
|
-
if (btn) {
|
|
576
|
-
var className = generateInputClasses({
|
|
577
|
-
status: final.status,
|
|
578
|
-
rounded: final.rounded,
|
|
579
|
-
bg: final.bg,
|
|
580
|
-
funcss: final.funcss,
|
|
581
|
-
flat: final.flat,
|
|
582
|
-
leftRounded: final.leftRounded,
|
|
583
|
-
rightRounded: final.rightRounded,
|
|
584
|
-
bordered: true,
|
|
585
|
-
borderless: false,
|
|
586
|
-
additionalClasses: 'filedInput',
|
|
587
|
-
hasNoPrefix: hasNoPrefix, // Add no_prefix class when no start icon/prefix
|
|
588
|
-
hasNoLabel: hasNoLabel,
|
|
589
|
-
});
|
|
590
|
-
var style = final.fullWidth ? { width: '100%' } : undefined;
|
|
591
|
-
var fileInputElement = (react_1.default.createElement("div", { className: "fileInput" },
|
|
592
|
-
button || (react_1.default.createElement(Button_1.default, { funcss: final.funcss, startIcon: icon || react_1.default.createElement(pi_1.PiCloudArrowUp, null), bg: "primary", fullWidth: true, raised: true }, fileName || label)),
|
|
593
|
-
react_1.default.createElement("input", __assign({ id: id, name: name, className: className, onChange: handleChange, type: "file", style: style, value: value }, rest))));
|
|
594
|
-
var wrappedFileInput = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: final.iconicBg, funcss: final.funcss }, fileInputElement));
|
|
595
|
-
return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: undefined, status: final.status, helperText: helperText, isFocused: false, hasValue: !!fileName, fullWidth: final.fullWidth, id: id }, wrappedFileInput));
|
|
596
|
-
}
|
|
597
|
-
var uploadElement = (react_1.default.createElement("div", { className: "_upload_container" },
|
|
598
|
-
react_1.default.createElement("label", { htmlFor: id, className: "_upload_label" },
|
|
599
|
-
react_1.default.createElement("div", { className: "_upload_icon" }, icon || react_1.default.createElement(pi_1.PiCloudArrowUp, null)),
|
|
600
|
-
react_1.default.createElement("div", { className: "_upload_text", style: {
|
|
601
|
-
whiteSpace: 'nowrap',
|
|
602
|
-
overflow: 'hidden',
|
|
603
|
-
textOverflow: 'ellipsis',
|
|
604
|
-
display: 'inline-block',
|
|
605
|
-
width: '100%',
|
|
606
|
-
} }, fileName || label),
|
|
607
|
-
extra && react_1.default.createElement("div", { className: "text-small opacity-3" }, extra)),
|
|
608
|
-
react_1.default.createElement("input", __assign({ onChange: handleChange, type: "file", id: id, className: "_upload_input" }, rest))));
|
|
609
|
-
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));
|
|
610
|
-
};
|
|
611
|
-
exports.FileInput = FileInput;
|
|
612
492
|
var Input = function (_a) {
|
|
613
|
-
var select = _a.select, multiline = _a.multiline, file = _a.file, noBorder = _a.noBorder, startIcon = _a.startIcon, endIcon = _a.endIcon, prefix = _a.prefix, suffix = _a.suffix, stringPrefix = _a.stringPrefix, stringSuffix = _a.stringSuffix, iconicBg = _a.iconicBg, _b = _a.variant, variant = _b === void 0 ? '' : _b, props = __rest(_a, ["select", "multiline", "file", "noBorder", "startIcon", "endIcon", "prefix", "suffix", "stringPrefix", "stringSuffix", "iconicBg", "variant"]);
|
|
493
|
+
var select = _a.select, multiline = _a.multiline, file = _a.file, noBorder = _a.noBorder, startIcon = _a.startIcon, endIcon = _a.endIcon, prefix = _a.prefix, suffix = _a.suffix, stringPrefix = _a.stringPrefix, stringSuffix = _a.stringSuffix, iconicBg = _a.iconicBg, type = _a.type, _b = _a.variant, variant = _b === void 0 ? '' : _b, props = __rest(_a, ["select", "multiline", "file", "noBorder", "startIcon", "endIcon", "prefix", "suffix", "stringPrefix", "stringSuffix", "iconicBg", "type", "variant"]);
|
|
614
494
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
|
|
615
495
|
// Create local props object including stringPrefix/stringSuffix
|
|
616
|
-
var localProps = __assign(__assign({}, props), { startIcon: startIcon, endIcon: endIcon, prefix: prefix, suffix: suffix, iconicBg: iconicBg, stringPrefix: stringPrefix,
|
|
617
|
-
stringSuffix: stringSuffix });
|
|
496
|
+
var localProps = __assign(__assign({}, props), { startIcon: startIcon, endIcon: endIcon, prefix: prefix, suffix: suffix, iconicBg: iconicBg, stringPrefix: stringPrefix, stringSuffix: stringSuffix, type: type });
|
|
618
497
|
var mergedProps = mergeWithLocal(localProps).props;
|
|
619
|
-
var inputProps = __assign(__assign(__assign({}, props), mergedProps), { variant: variant, borderless: noBorder !== undefined ? noBorder : (props.borderless !== undefined ? props.borderless : mergedProps.borderless) });
|
|
498
|
+
var inputProps = __assign(__assign(__assign({}, props), mergedProps), { variant: variant, borderless: noBorder !== undefined ? noBorder : (props.borderless !== undefined ? props.borderless : mergedProps.borderless), type: type });
|
|
499
|
+
// If type is file or file prop is true, use FileUpload component
|
|
500
|
+
if (file || type === 'file') {
|
|
501
|
+
return react_1.default.createElement(FileUpload_1.FileUpload, __assign({}, inputProps));
|
|
502
|
+
}
|
|
620
503
|
if (select) {
|
|
621
504
|
return react_1.default.createElement(exports.SelectInput, __assign({}, inputProps));
|
|
622
505
|
}
|
|
623
506
|
if (multiline) {
|
|
624
507
|
return react_1.default.createElement(exports.TextareaInput, __assign({}, inputProps));
|
|
625
508
|
}
|
|
626
|
-
if (file) {
|
|
627
|
-
return react_1.default.createElement(exports.FileInput, __assign({}, inputProps));
|
|
628
|
-
}
|
|
629
509
|
return react_1.default.createElement(exports.TextInput, __assign({}, inputProps));
|
|
630
510
|
};
|
|
631
511
|
exports.default = Input;
|
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
|
}
|