funuicss 3.6.15 → 3.6.17
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 +556 -419
- package/package.json +1 -1
- package/ui/button/Button.js +27 -16
- package/ui/card/Card.js +12 -10
- package/ui/input/Input.d.ts +7 -5
- package/ui/input/Input.js +215 -39
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.6.
|
|
2
|
+
"version": "3.6.17",
|
|
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/button/Button.js
CHANGED
|
@@ -62,8 +62,7 @@ var pi_1 = require("react-icons/pi");
|
|
|
62
62
|
var componentUtils_1 = require("../../utils/componentUtils");
|
|
63
63
|
var getDynamicIcon_1 = require("../../utils/getDynamicIcon");
|
|
64
64
|
function Button(_a) {
|
|
65
|
-
var _b;
|
|
66
|
-
var _c = _a.variant, variant = _c === void 0 ? '' : _c, color = _a.color, bg = _a.bg, funcss = _a.funcss, startIcon = _a.startIcon, endIcon = _a.endIcon, stringPrefix = _a.stringPrefix, stringSuffix = _a.stringSuffix, prefix = _a.prefix, suffix = _a.suffix, iconSize = _a.iconSize, _d = _a.iconLineHeight, iconLineHeight = _d === void 0 ? 0 : _d, text = _a.text, rounded = _a.rounded, raised = _a.raised, height = _a.height, width = _a.width, float = _a.float, hoverUp = _a.hoverUp, fullWidth = _a.fullWidth, outlined = _a.outlined, small = _a.small, hoverless = _a.hoverless, smaller = _a.smaller, big = _a.big, bigger = _a.bigger, jumbo = _a.jumbo, flat = _a.flat, hoverNone = _a.hoverNone, fillAnimation = _a.fillAnimation, fillDirection = _a.fillDirection, fillTextColor = _a.fillTextColor, outlineSize = _a.outlineSize, isLoading = _a.isLoading, status = _a.status, bold = _a.bold, children = _a.children, style = _a.style, url = _a.url, onClick = _a.onClick, rest = __rest(_a, ["variant", "color", "bg", "funcss", "startIcon", "endIcon", "stringPrefix", "stringSuffix", "prefix", "suffix", "iconSize", "iconLineHeight", "text", "rounded", "raised", "height", "width", "float", "hoverUp", "fullWidth", "outlined", "small", "hoverless", "smaller", "big", "bigger", "jumbo", "flat", "hoverNone", "fillAnimation", "fillDirection", "fillTextColor", "outlineSize", "isLoading", "status", "bold", "children", "style", "url", "onClick"]);
|
|
65
|
+
var _b = _a.variant, variant = _b === void 0 ? '' : _b, color = _a.color, bg = _a.bg, funcss = _a.funcss, startIcon = _a.startIcon, endIcon = _a.endIcon, stringPrefix = _a.stringPrefix, stringSuffix = _a.stringSuffix, prefix = _a.prefix, suffix = _a.suffix, iconSize = _a.iconSize, _c = _a.iconLineHeight, iconLineHeight = _c === void 0 ? 0 : _c, text = _a.text, rounded = _a.rounded, raised = _a.raised, height = _a.height, width = _a.width, float = _a.float, hoverUp = _a.hoverUp, fullWidth = _a.fullWidth, outlined = _a.outlined, small = _a.small, hoverless = _a.hoverless, smaller = _a.smaller, big = _a.big, bigger = _a.bigger, jumbo = _a.jumbo, flat = _a.flat, hoverNone = _a.hoverNone, fillAnimation = _a.fillAnimation, fillDirection = _a.fillDirection, fillTextColor = _a.fillTextColor, outlineSize = _a.outlineSize, isLoading = _a.isLoading, status = _a.status, bold = _a.bold, children = _a.children, style = _a.style, url = _a.url, onClick = _a.onClick, rest = __rest(_a, ["variant", "color", "bg", "funcss", "startIcon", "endIcon", "stringPrefix", "stringSuffix", "prefix", "suffix", "iconSize", "iconLineHeight", "text", "rounded", "raised", "height", "width", "float", "hoverUp", "fullWidth", "outlined", "small", "hoverless", "smaller", "big", "bigger", "jumbo", "flat", "hoverNone", "fillAnimation", "fillDirection", "fillTextColor", "outlineSize", "isLoading", "status", "bold", "children", "style", "url", "onClick"]);
|
|
67
66
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Button', variant).mergeWithLocal;
|
|
68
67
|
var mergedProps = mergeWithLocal(__assign({ color: color, bg: bg, funcss: funcss, text: text, rounded: rounded, raised: raised, height: height, width: width, float: float, hoverUp: hoverUp, fullWidth: fullWidth, outlined: outlined, small: small, hoverless: hoverless, smaller: smaller, big: big, bigger: bigger, jumbo: jumbo, flat: flat, hoverNone: hoverNone, fillAnimation: fillAnimation, fillDirection: fillDirection, fillTextColor: fillTextColor, outlineSize: outlineSize, isLoading: isLoading, status: status, bold: bold }, rest)).props;
|
|
69
68
|
var final = {
|
|
@@ -91,17 +90,28 @@ function Button(_a) {
|
|
|
91
90
|
fillTextColor: mergedProps.fillTextColor,
|
|
92
91
|
funcss: mergedProps.funcss,
|
|
93
92
|
};
|
|
94
|
-
var
|
|
95
|
-
var
|
|
93
|
+
var _d = (0, react_1.useState)(null), prefixNode = _d[0], setPrefixNode = _d[1];
|
|
94
|
+
var _e = (0, react_1.useState)(null), suffixNode = _e[0], setSuffixNode = _e[1];
|
|
96
95
|
function isReactElement(node) {
|
|
97
96
|
return react_1.default.isValidElement(node);
|
|
98
97
|
}
|
|
98
|
+
// FIX: Clear icons when stringPrefix/stringSuffix are empty or undefined
|
|
99
99
|
(0, react_1.useEffect)(function () {
|
|
100
|
-
if (stringPrefix)
|
|
100
|
+
if (stringPrefix) {
|
|
101
101
|
(0, getDynamicIcon_1.getDynamicIcon)(stringPrefix).then(function (node) { return setPrefixNode(node); });
|
|
102
|
-
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
setPrefixNode(null); // Clear when empty
|
|
105
|
+
}
|
|
106
|
+
}, [stringPrefix]);
|
|
107
|
+
(0, react_1.useEffect)(function () {
|
|
108
|
+
if (stringSuffix) {
|
|
103
109
|
(0, getDynamicIcon_1.getDynamicIcon)(stringSuffix).then(function (node) { return setSuffixNode(node); });
|
|
104
|
-
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
setSuffixNode(null); // Clear when empty
|
|
113
|
+
}
|
|
114
|
+
}, [stringSuffix]);
|
|
105
115
|
var textColorClass = final.bg
|
|
106
116
|
? final.color
|
|
107
117
|
? final.color
|
|
@@ -111,6 +121,8 @@ function Button(_a) {
|
|
|
111
121
|
? 'white'
|
|
112
122
|
: final.bg.replace(/[0-9]/g, '')
|
|
113
123
|
: final.color;
|
|
124
|
+
// Determine background: status takes priority over bg prop
|
|
125
|
+
var effectiveBg = final.status ? final.status : final.bg;
|
|
114
126
|
var classNames = [
|
|
115
127
|
'button',
|
|
116
128
|
"text-".concat(textColorClass),
|
|
@@ -128,8 +140,8 @@ function Button(_a) {
|
|
|
128
140
|
final.bigger ? 'biggerBtn' : '',
|
|
129
141
|
final.jumbo ? 'jumboBtn' : '',
|
|
130
142
|
final.outlined
|
|
131
|
-
? "outlined outline-".concat(
|
|
132
|
-
:
|
|
143
|
+
? "outlined outline-".concat(effectiveBg || '', " text-").concat(final.color ? final.color : effectiveBg === null || effectiveBg === void 0 ? void 0 : effectiveBg.replace(/[0-9]/g, ''))
|
|
144
|
+
: effectiveBg || '',
|
|
133
145
|
"".concat(final.fillAnimation ? "".concat(final.fillTextColor ? "hover-text-".concat(final.fillTextColor) : '', " button-fill fill-").concat(final.fillDirection || 'left') : ''),
|
|
134
146
|
].join(' ');
|
|
135
147
|
var iconWrapperStyle = {
|
|
@@ -140,19 +152,18 @@ function Button(_a) {
|
|
|
140
152
|
};
|
|
141
153
|
return (react_1.default.createElement("span", null,
|
|
142
154
|
react_1.default.createElement("button", __assign({ className: "".concat(classNames, " ").concat((startIcon || endIcon || prefix || suffix || prefixNode || suffixNode || final.status || final.isLoading) ? 'iconic' : ''), style: __assign({ height: mergedProps.height || '', width: mergedProps.fullWidth ? '100%' : mergedProps.width || '', borderRadius: final.flat ? '0rem' : '' }, style), onClick: onClick || (url ? function () { return (window.location.href = url); } : undefined) }, mergedProps),
|
|
143
|
-
final.isLoading
|
|
144
|
-
react_1.default.createElement(pi_1.PiSpinner, { size: iconSize }))),
|
|
145
|
-
final.status && (react_1.default.createElement("span", { className: "btn_left_icon", style: iconWrapperStyle },
|
|
155
|
+
final.isLoading ? (react_1.default.createElement("span", { className: "btn_left_icon rotate", style: iconWrapperStyle },
|
|
156
|
+
react_1.default.createElement(pi_1.PiSpinner, { size: iconSize }))) : (react_1.default.createElement(react_1.default.Fragment, null, final.status ? (react_1.default.createElement("span", { className: "btn_left_icon", style: iconWrapperStyle },
|
|
146
157
|
final.status === 'success' && react_1.default.createElement(pi_1.PiCheck, { size: iconSize }),
|
|
147
158
|
final.status === 'info' && react_1.default.createElement(pi_1.PiInfo, { size: iconSize }),
|
|
148
159
|
final.status === 'warning' && react_1.default.createElement(pi_1.PiWarning, { size: iconSize }),
|
|
149
|
-
final.status === 'danger' && react_1.default.createElement(pi_1.PiX, { size: iconSize })))
|
|
150
|
-
|
|
160
|
+
final.status === 'danger' && react_1.default.createElement(pi_1.PiX, { size: iconSize }))) : (
|
|
161
|
+
/* Otherwise show regular start icons */
|
|
151
162
|
(prefix || startIcon || prefixNode) && (react_1.default.createElement("span", { className: "btn_left_icon", style: iconWrapperStyle }, isReactElement(startIcon) ? react_1.default.cloneElement(startIcon, { size: iconSize })
|
|
152
163
|
: isReactElement(prefix) ? react_1.default.cloneElement(prefix, { size: iconSize })
|
|
153
164
|
: isReactElement(prefixNode) ? react_1.default.cloneElement(prefixNode, { size: iconSize })
|
|
154
|
-
: prefix || startIcon || prefixNode
|
|
155
|
-
)),
|
|
165
|
+
: prefix || startIcon || prefixNode))))),
|
|
166
|
+
final.fillAnimation && react_1.default.createElement("span", { className: "button_fill_span ".concat(effectiveBg) }),
|
|
156
167
|
final.text ? final.text : children,
|
|
157
168
|
(suffix || endIcon || suffixNode) && (react_1.default.createElement("span", { className: "btn_right_icon", style: iconWrapperStyle }, isReactElement(endIcon) ? react_1.default.cloneElement(endIcon, { size: iconSize })
|
|
158
169
|
: isReactElement(suffix) ? react_1.default.cloneElement(suffix, { size: iconSize })
|
package/ui/card/Card.js
CHANGED
|
@@ -36,6 +36,7 @@ var componentUtils_1 = require("../../utils/componentUtils");
|
|
|
36
36
|
var Button_1 = __importDefault(require("../button/Button"));
|
|
37
37
|
var Flex_1 = __importDefault(require("../flex/Flex"));
|
|
38
38
|
var Text_1 = __importDefault(require("../text/Text"));
|
|
39
|
+
var View_1 = __importDefault(require("../view/View"));
|
|
39
40
|
function Card(_a) {
|
|
40
41
|
var
|
|
41
42
|
// Original Props
|
|
@@ -210,14 +211,15 @@ function Card(_a) {
|
|
|
210
211
|
mergedProps.image,
|
|
211
212
|
" ",
|
|
212
213
|
mergedProps.fab ? mergedProps.fab : '') : ''),
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
214
|
+
react_1.default.createElement(View_1.default, { funcss: hasImageContent ? 'p' : '' },
|
|
215
|
+
hasEnhancedContent ? (react_1.default.createElement(CardHeader_1.default, { style: mergedProps.headerStyle, className: mergedProps.headerClass }, EnhancedTextContent)) : (mergedProps.header && !mergedProps.horizontal ? (react_1.default.createElement(CardHeader_1.default, { style: mergedProps.headerStyle, className: mergedProps.headerClass }, renderContent(mergedProps.header))) : ''),
|
|
216
|
+
mergedProps.body ?
|
|
217
|
+
react_1.default.createElement("div", null,
|
|
218
|
+
mergedProps.horizontal && !hasEnhancedContent ? (react_1.default.createElement(CardHeader_1.default, { style: mergedProps.headerStyle, className: mergedProps.headerClass }, renderContent(mergedProps.header))) : '',
|
|
219
|
+
react_1.default.createElement(CardBody_1.default, { style: mergedProps.bodyStyle, className: mergedProps.bodyClass }, hasEnhancedContent ? EnhancedTextContent : renderContent(mergedProps.body)),
|
|
220
|
+
mergedProps.horizontal && !hasEnhancedFooter ? (react_1.default.createElement(CardFooter_1.default, { style: mergedProps.footerStyle, className: mergedProps.footerClass }, renderContent(mergedProps.footer))) : '')
|
|
221
|
+
: '',
|
|
222
|
+
mergedProps.children && (react_1.default.createElement(CardBody_1.default, { style: mergedProps.bodyStyle, className: mergedProps.bodyClass }, renderContent(mergedProps.children))),
|
|
223
|
+
hasEnhancedFooter ? (react_1.default.createElement(CardFooter_1.default, { style: mergedProps.footerStyle, className: mergedProps.footerClass },
|
|
224
|
+
react_1.default.createElement(CTAButtons, null))) : (mergedProps.footer && !mergedProps.horizontal ? (react_1.default.createElement(CardFooter_1.default, { style: mergedProps.footerStyle, className: mergedProps.footerClass }, renderContent(mergedProps.footer))) : ''))));
|
|
223
225
|
}
|
package/ui/input/Input.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ interface BaseInputProps {
|
|
|
5
5
|
value?: any;
|
|
6
6
|
defaultValue?: string;
|
|
7
7
|
onChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => void;
|
|
8
|
-
status?: 'success' | 'warning' | 'danger' | '';
|
|
8
|
+
status?: 'success' | 'warning' | 'danger' | 'info' | '';
|
|
9
9
|
funcss?: string;
|
|
10
10
|
bg?: string;
|
|
11
11
|
fullWidth?: boolean;
|
|
@@ -17,8 +17,14 @@ interface BaseInputProps {
|
|
|
17
17
|
rightRounded?: boolean;
|
|
18
18
|
startIcon?: React.ReactNode;
|
|
19
19
|
endIcon?: React.ReactNode;
|
|
20
|
+
prefix?: React.ReactNode;
|
|
21
|
+
suffix?: React.ReactNode;
|
|
22
|
+
stringPrefix?: string;
|
|
23
|
+
stringSuffix?: string;
|
|
20
24
|
iconicBg?: string;
|
|
21
25
|
variant?: string;
|
|
26
|
+
label?: string;
|
|
27
|
+
helperText?: string;
|
|
22
28
|
}
|
|
23
29
|
interface SelectOption {
|
|
24
30
|
value: string;
|
|
@@ -26,17 +32,14 @@ interface SelectOption {
|
|
|
26
32
|
}
|
|
27
33
|
interface TextInputProps extends BaseInputProps {
|
|
28
34
|
type?: string;
|
|
29
|
-
label?: string;
|
|
30
35
|
}
|
|
31
36
|
interface SelectProps extends BaseInputProps {
|
|
32
37
|
options?: SelectOption[];
|
|
33
38
|
}
|
|
34
39
|
interface TextareaProps extends BaseInputProps {
|
|
35
|
-
label?: string;
|
|
36
40
|
rows?: number;
|
|
37
41
|
}
|
|
38
42
|
interface FileInputProps extends BaseInputProps {
|
|
39
|
-
label?: string;
|
|
40
43
|
icon?: React.ReactNode;
|
|
41
44
|
extra?: React.ReactNode;
|
|
42
45
|
button?: React.ReactNode;
|
|
@@ -56,7 +59,6 @@ interface InputProps extends BaseInputProps {
|
|
|
56
59
|
button?: React.ReactNode;
|
|
57
60
|
btn?: boolean;
|
|
58
61
|
type?: string;
|
|
59
|
-
label?: string;
|
|
60
62
|
options?: SelectOption[];
|
|
61
63
|
rows?: number;
|
|
62
64
|
}
|
package/ui/input/Input.js
CHANGED
|
@@ -65,6 +65,14 @@ var pi_1 = require("react-icons/pi");
|
|
|
65
65
|
var Button_1 = __importDefault(require("../button/Button"));
|
|
66
66
|
var theme_1 = require("../theme/theme");
|
|
67
67
|
var componentUtils_1 = require("../../utils/componentUtils");
|
|
68
|
+
var getDynamicIcon_1 = require("../../utils/getDynamicIcon");
|
|
69
|
+
// Status icons mapping
|
|
70
|
+
var statusIcons = {
|
|
71
|
+
success: react_1.default.createElement(pi_1.PiCheckCircle, null),
|
|
72
|
+
warning: react_1.default.createElement(pi_1.PiWarning, null),
|
|
73
|
+
danger: react_1.default.createElement(pi_1.PiX, null),
|
|
74
|
+
info: react_1.default.createElement(pi_1.PiInfo, null)
|
|
75
|
+
};
|
|
68
76
|
// Utility function to generate CSS classes
|
|
69
77
|
var generateInputClasses = function (_a) {
|
|
70
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;
|
|
@@ -78,24 +86,64 @@ var generateInputClasses = function (_a) {
|
|
|
78
86
|
};
|
|
79
87
|
// Iconic Input Wrapper Component
|
|
80
88
|
var IconicInputWrapper = function (_a) {
|
|
81
|
-
var startIcon = _a.startIcon, endIcon = _a.endIcon, iconicBg = _a.iconicBg, funcss = _a.funcss, children = _a.children;
|
|
82
|
-
|
|
89
|
+
var startIcon = _a.startIcon, endIcon = _a.endIcon, prefix = _a.prefix, suffix = _a.suffix, iconicBg = _a.iconicBg, funcss = _a.funcss, children = _a.children;
|
|
90
|
+
var effectiveStartIcon = prefix !== undefined ? prefix : startIcon;
|
|
91
|
+
var effectiveEndIcon = suffix !== undefined ? suffix : endIcon;
|
|
92
|
+
if (!effectiveStartIcon && !effectiveEndIcon) {
|
|
83
93
|
return react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
84
94
|
}
|
|
85
|
-
return (react_1.default.createElement("div", { className: "icon-container ".concat(funcss || '') },
|
|
86
|
-
|
|
95
|
+
return (react_1.default.createElement("div", { className: "icon-container ".concat(effectiveStartIcon ? 'has-left-icon' : '', " ").concat(funcss || '') },
|
|
96
|
+
effectiveStartIcon && (react_1.default.createElement("div", { className: "leftIcon", style: {
|
|
87
97
|
backgroundColor: iconicBg || '',
|
|
88
98
|
border: iconicBg ? "0.1rem ".concat(iconicBg, " solid") : '',
|
|
89
|
-
} },
|
|
90
|
-
|
|
91
|
-
|
|
99
|
+
} }, effectiveStartIcon)),
|
|
100
|
+
children,
|
|
101
|
+
effectiveEndIcon && (react_1.default.createElement("div", { className: "rightIcon", style: { backgroundColor: iconicBg || '' } }, effectiveEndIcon))));
|
|
102
|
+
};
|
|
103
|
+
// Input Container with Floating Label
|
|
104
|
+
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
|
+
var showFloatingLabel = label && (isFocused || hasValue);
|
|
107
|
+
return (react_1.default.createElement("div", { className: "input-wrapper ".concat(fullWidth ? 'full-width' : '') },
|
|
108
|
+
react_1.default.createElement("div", { className: "input-container-with-label" },
|
|
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)),
|
|
110
|
+
children),
|
|
111
|
+
(helperText || status) && (react_1.default.createElement("div", { className: "input-helper-text ".concat(status ? "helper-".concat(status) : '') },
|
|
112
|
+
status && statusIcons[status] && (react_1.default.createElement("span", { className: "helper-icon" }, statusIcons[status])),
|
|
113
|
+
react_1.default.createElement("span", null, helperText)))));
|
|
92
114
|
};
|
|
93
115
|
// Text Input Component
|
|
94
116
|
var TextInput = function (_a) {
|
|
95
|
-
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, _d = _a.variant, variant = _d === void 0 ? '' : _d, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "iconicBg", "type", "label", "variant"]);
|
|
96
|
-
|
|
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, _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, prefix = _a.prefix, suffix = _a.suffix, stringPrefix = _a.stringPrefix, stringSuffix = _a.stringSuffix, iconicBg = _a.iconicBg, _c = _a.type, type = _c === void 0 ? 'text' : _c, label = _a.label, helperText = _a.helperText, _d = _a.variant, variant = _d === void 0 ? '' : _d, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "prefix", "suffix", "stringPrefix", "stringSuffix", "iconicBg", "type", "label", "helperText", "variant"]);
|
|
118
|
+
var _e = (0, react_1.useState)(false), isFocused = _e[0], setIsFocused = _e[1];
|
|
119
|
+
var _f = (0, react_1.useState)(value || defaultValue || ''), inputValue = _f[0], setInputValue = _f[1];
|
|
120
|
+
var _g = (0, react_1.useState)(null), prefixNode = _g[0], setPrefixNode = _g[1];
|
|
121
|
+
var _h = (0, react_1.useState)(null), suffixNode = _h[0], setSuffixNode = _h[1];
|
|
122
|
+
var inputRef = (0, react_1.useRef)(null);
|
|
123
|
+
(0, react_1.useEffect)(function () {
|
|
124
|
+
if (value !== undefined) {
|
|
125
|
+
setInputValue(value);
|
|
126
|
+
}
|
|
127
|
+
}, [value]);
|
|
128
|
+
// Handle stringPrefix
|
|
129
|
+
(0, react_1.useEffect)(function () {
|
|
130
|
+
if (stringPrefix) {
|
|
131
|
+
(0, getDynamicIcon_1.getDynamicIcon)(stringPrefix).then(function (node) { return setPrefixNode(node); });
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
setPrefixNode(null);
|
|
135
|
+
}
|
|
136
|
+
}, [stringPrefix]);
|
|
137
|
+
// Handle stringSuffix
|
|
138
|
+
(0, react_1.useEffect)(function () {
|
|
139
|
+
if (stringSuffix) {
|
|
140
|
+
(0, getDynamicIcon_1.getDynamicIcon)(stringSuffix).then(function (node) { return setSuffixNode(node); });
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
setSuffixNode(null);
|
|
144
|
+
}
|
|
145
|
+
}, [stringSuffix]);
|
|
97
146
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
|
|
98
|
-
// Merge config with local props - local props override config
|
|
99
147
|
var mergedProps = mergeWithLocal({
|
|
100
148
|
status: status,
|
|
101
149
|
funcss: funcss,
|
|
@@ -109,9 +157,10 @@ var TextInput = function (_a) {
|
|
|
109
157
|
rightRounded: rightRounded,
|
|
110
158
|
startIcon: startIcon,
|
|
111
159
|
endIcon: endIcon,
|
|
160
|
+
prefix: prefix,
|
|
161
|
+
suffix: suffix,
|
|
112
162
|
iconicBg: iconicBg,
|
|
113
163
|
}).props;
|
|
114
|
-
// Use theme variant for fallback
|
|
115
164
|
var themeVariant = (0, theme_1.useVariant)().variant;
|
|
116
165
|
var className = generateInputClasses({
|
|
117
166
|
status: mergedProps.status,
|
|
@@ -125,16 +174,61 @@ var TextInput = function (_a) {
|
|
|
125
174
|
borderless: mergedProps.borderless,
|
|
126
175
|
});
|
|
127
176
|
var style = mergedProps.fullWidth ? { width: '100%' } : undefined;
|
|
128
|
-
var
|
|
129
|
-
|
|
177
|
+
var handleChange = function (e) {
|
|
178
|
+
setInputValue(e.target.value);
|
|
179
|
+
if (onChange)
|
|
180
|
+
onChange(e);
|
|
181
|
+
};
|
|
182
|
+
var handleFocus = function (e) {
|
|
183
|
+
setIsFocused(true);
|
|
184
|
+
if (rest.onFocus)
|
|
185
|
+
rest.onFocus(e);
|
|
186
|
+
};
|
|
187
|
+
var handleBlur = function (e) {
|
|
188
|
+
setIsFocused(false);
|
|
189
|
+
if (rest.onBlur)
|
|
190
|
+
rest.onBlur(e);
|
|
191
|
+
};
|
|
192
|
+
// Determine effective icons: stringPrefix/stringSuffix take priority
|
|
193
|
+
var effectivePrefix = prefixNode || mergedProps.prefix || mergedProps.startIcon;
|
|
194
|
+
var effectiveSuffix = suffixNode || mergedProps.suffix || mergedProps.endIcon;
|
|
195
|
+
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: !label ? rest.placeholder : '', style: style, value: value }, rest)));
|
|
196
|
+
var wrappedInput = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, inputElement));
|
|
197
|
+
return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: mergedProps.status, helperText: helperText, isFocused: isFocused, hasValue: !!inputValue, fullWidth: mergedProps.fullWidth, id: id }, wrappedInput));
|
|
130
198
|
};
|
|
131
199
|
exports.TextInput = TextInput;
|
|
132
200
|
// Select Component
|
|
133
201
|
var SelectInput = function (_a) {
|
|
134
|
-
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, _c = _a.variant, variant = _c === void 0 ? '' : _c, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "iconicBg", "options", "variant"]);
|
|
135
|
-
|
|
202
|
+
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, prefix = _a.prefix, suffix = _a.suffix, stringPrefix = _a.stringPrefix, stringSuffix = _a.stringSuffix, iconicBg = _a.iconicBg, _b = _a.options, options = _b === void 0 ? [] : _b, label = _a.label, helperText = _a.helperText, _c = _a.variant, variant = _c === void 0 ? '' : _c, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "prefix", "suffix", "stringPrefix", "stringSuffix", "iconicBg", "options", "label", "helperText", "variant"]);
|
|
203
|
+
var _d = (0, react_1.useState)(false), isFocused = _d[0], setIsFocused = _d[1];
|
|
204
|
+
var _e = (0, react_1.useState)(value || defaultValue || ''), selectValue = _e[0], setSelectValue = _e[1];
|
|
205
|
+
var _f = (0, react_1.useState)(null), prefixNode = _f[0], setPrefixNode = _f[1];
|
|
206
|
+
var _g = (0, react_1.useState)(null), suffixNode = _g[0], setSuffixNode = _g[1];
|
|
207
|
+
(0, react_1.useEffect)(function () {
|
|
208
|
+
if (value !== undefined) {
|
|
209
|
+
setSelectValue(value);
|
|
210
|
+
}
|
|
211
|
+
}, [value]);
|
|
212
|
+
// Handle stringPrefix
|
|
213
|
+
(0, react_1.useEffect)(function () {
|
|
214
|
+
if (stringPrefix) {
|
|
215
|
+
(0, getDynamicIcon_1.getDynamicIcon)(stringPrefix).then(function (node) { return setPrefixNode(node); });
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
setPrefixNode(null);
|
|
219
|
+
}
|
|
220
|
+
}, [stringPrefix]);
|
|
221
|
+
// Handle stringSuffix
|
|
222
|
+
(0, react_1.useEffect)(function () {
|
|
223
|
+
if (stringSuffix) {
|
|
224
|
+
(0, getDynamicIcon_1.getDynamicIcon)(stringSuffix).then(function (node) { return setSuffixNode(node); });
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
setSuffixNode(null);
|
|
228
|
+
}
|
|
229
|
+
}, [stringSuffix]);
|
|
230
|
+
var selectHasValue = true;
|
|
136
231
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
|
|
137
|
-
// Merge config with local props
|
|
138
232
|
var mergedProps = mergeWithLocal({
|
|
139
233
|
status: status,
|
|
140
234
|
funcss: funcss,
|
|
@@ -148,9 +242,10 @@ var SelectInput = function (_a) {
|
|
|
148
242
|
rightRounded: rightRounded,
|
|
149
243
|
startIcon: startIcon,
|
|
150
244
|
endIcon: endIcon,
|
|
245
|
+
prefix: prefix,
|
|
246
|
+
suffix: suffix,
|
|
151
247
|
iconicBg: iconicBg,
|
|
152
248
|
}).props;
|
|
153
|
-
// Use theme variant for fallback
|
|
154
249
|
var themeVariant = (0, theme_1.useVariant)().variant;
|
|
155
250
|
var className = generateInputClasses({
|
|
156
251
|
status: mergedProps.status,
|
|
@@ -164,16 +259,59 @@ var SelectInput = function (_a) {
|
|
|
164
259
|
borderless: mergedProps.borderless,
|
|
165
260
|
});
|
|
166
261
|
var style = mergedProps.fullWidth ? { width: '100%' } : undefined;
|
|
167
|
-
var
|
|
168
|
-
|
|
262
|
+
var handleChange = function (e) {
|
|
263
|
+
setSelectValue(e.target.value);
|
|
264
|
+
if (onChange)
|
|
265
|
+
onChange(e);
|
|
266
|
+
};
|
|
267
|
+
var handleFocus = function (e) {
|
|
268
|
+
setIsFocused(true);
|
|
269
|
+
if (rest.onFocus)
|
|
270
|
+
rest.onFocus(e);
|
|
271
|
+
};
|
|
272
|
+
var handleBlur = function (e) {
|
|
273
|
+
setIsFocused(false);
|
|
274
|
+
if (rest.onBlur)
|
|
275
|
+
rest.onBlur(e);
|
|
276
|
+
};
|
|
277
|
+
var effectivePrefix = prefixNode || mergedProps.prefix || mergedProps.startIcon;
|
|
278
|
+
var effectiveSuffix = suffixNode || mergedProps.suffix || mergedProps.endIcon;
|
|
279
|
+
var selectElement = (react_1.default.createElement("select", __assign({ id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, 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)); })));
|
|
280
|
+
var wrappedSelect = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, selectElement));
|
|
281
|
+
return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: mergedProps.status, helperText: helperText, isFocused: isFocused, hasValue: selectHasValue, fullWidth: mergedProps.fullWidth, id: id }, wrappedSelect));
|
|
169
282
|
};
|
|
170
283
|
exports.SelectInput = SelectInput;
|
|
171
284
|
// Textarea Component
|
|
172
285
|
var TextareaInput = function (_a) {
|
|
173
|
-
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, _c = _a.variant, variant = _c === void 0 ? '' : _c, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "iconicBg", "label", "rows", "variant"]);
|
|
174
|
-
|
|
286
|
+
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, prefix = _a.prefix, suffix = _a.suffix, stringPrefix = _a.stringPrefix, stringSuffix = _a.stringSuffix, iconicBg = _a.iconicBg, label = _a.label, helperText = _a.helperText, _b = _a.rows, rows = _b === void 0 ? 2 : _b, _c = _a.variant, variant = _c === void 0 ? '' : _c, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "prefix", "suffix", "stringPrefix", "stringSuffix", "iconicBg", "label", "helperText", "rows", "variant"]);
|
|
287
|
+
var _d = (0, react_1.useState)(false), isFocused = _d[0], setIsFocused = _d[1];
|
|
288
|
+
var _e = (0, react_1.useState)(value || defaultValue || ''), textValue = _e[0], setTextValue = _e[1];
|
|
289
|
+
var _f = (0, react_1.useState)(null), prefixNode = _f[0], setPrefixNode = _f[1];
|
|
290
|
+
var _g = (0, react_1.useState)(null), suffixNode = _g[0], setSuffixNode = _g[1];
|
|
291
|
+
(0, react_1.useEffect)(function () {
|
|
292
|
+
if (value !== undefined) {
|
|
293
|
+
setTextValue(value);
|
|
294
|
+
}
|
|
295
|
+
}, [value]);
|
|
296
|
+
// Handle stringPrefix
|
|
297
|
+
(0, react_1.useEffect)(function () {
|
|
298
|
+
if (stringPrefix) {
|
|
299
|
+
(0, getDynamicIcon_1.getDynamicIcon)(stringPrefix).then(function (node) { return setPrefixNode(node); });
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
setPrefixNode(null);
|
|
303
|
+
}
|
|
304
|
+
}, [stringPrefix]);
|
|
305
|
+
// Handle stringSuffix
|
|
306
|
+
(0, react_1.useEffect)(function () {
|
|
307
|
+
if (stringSuffix) {
|
|
308
|
+
(0, getDynamicIcon_1.getDynamicIcon)(stringSuffix).then(function (node) { return setSuffixNode(node); });
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
setSuffixNode(null);
|
|
312
|
+
}
|
|
313
|
+
}, [stringSuffix]);
|
|
175
314
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
|
|
176
|
-
// Merge config with local props
|
|
177
315
|
var mergedProps = mergeWithLocal({
|
|
178
316
|
status: status,
|
|
179
317
|
funcss: funcss,
|
|
@@ -187,9 +325,10 @@ var TextareaInput = function (_a) {
|
|
|
187
325
|
rightRounded: rightRounded,
|
|
188
326
|
startIcon: startIcon,
|
|
189
327
|
endIcon: endIcon,
|
|
328
|
+
prefix: prefix,
|
|
329
|
+
suffix: suffix,
|
|
190
330
|
iconicBg: iconicBg,
|
|
191
331
|
}).props;
|
|
192
|
-
// Use theme variant for fallback
|
|
193
332
|
var themeVariant = (0, theme_1.useVariant)().variant;
|
|
194
333
|
var className = generateInputClasses({
|
|
195
334
|
status: mergedProps.status,
|
|
@@ -203,17 +342,53 @@ var TextareaInput = function (_a) {
|
|
|
203
342
|
borderless: mergedProps.borderless,
|
|
204
343
|
});
|
|
205
344
|
var style = mergedProps.fullWidth ? { width: '100%' } : undefined;
|
|
206
|
-
var
|
|
207
|
-
|
|
345
|
+
var handleChange = function (e) {
|
|
346
|
+
setTextValue(e.target.value);
|
|
347
|
+
if (onChange)
|
|
348
|
+
onChange(e);
|
|
349
|
+
};
|
|
350
|
+
var handleFocus = function (e) {
|
|
351
|
+
setIsFocused(true);
|
|
352
|
+
if (rest.onFocus)
|
|
353
|
+
rest.onFocus(e);
|
|
354
|
+
};
|
|
355
|
+
var handleBlur = function (e) {
|
|
356
|
+
setIsFocused(false);
|
|
357
|
+
if (rest.onBlur)
|
|
358
|
+
rest.onBlur(e);
|
|
359
|
+
};
|
|
360
|
+
var effectivePrefix = prefixNode || mergedProps.prefix || mergedProps.startIcon;
|
|
361
|
+
var effectiveSuffix = suffixNode || mergedProps.suffix || mergedProps.endIcon;
|
|
362
|
+
var textareaElement = (react_1.default.createElement("textarea", __assign({ id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, defaultValue: defaultValue, placeholder: !label ? rest.placeholder : '', style: style, value: value, rows: rows }, rest)));
|
|
363
|
+
var wrappedTextarea = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, textareaElement));
|
|
364
|
+
return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: mergedProps.status, helperText: helperText, isFocused: isFocused, hasValue: !!textValue, fullWidth: mergedProps.fullWidth, id: id }, wrappedTextarea));
|
|
208
365
|
};
|
|
209
366
|
exports.TextareaInput = TextareaInput;
|
|
210
367
|
// File Input Component
|
|
211
368
|
var FileInput = function (_a) {
|
|
212
|
-
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, _d = _a.variant, variant = _d === void 0 ? '' : _d, rest = __rest(_a, ["id", "name", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "iconicBg", "label", "icon", "extra", "button", "btn", "value", "variant"]);
|
|
369
|
+
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"]);
|
|
213
370
|
var _e = (0, react_1.useState)(''), fileName = _e[0], setFileName = _e[1];
|
|
214
|
-
|
|
371
|
+
var _f = (0, react_1.useState)(null), prefixNode = _f[0], setPrefixNode = _f[1];
|
|
372
|
+
var _g = (0, react_1.useState)(null), suffixNode = _g[0], setSuffixNode = _g[1];
|
|
373
|
+
// Handle stringPrefix
|
|
374
|
+
(0, react_1.useEffect)(function () {
|
|
375
|
+
if (stringPrefix) {
|
|
376
|
+
(0, getDynamicIcon_1.getDynamicIcon)(stringPrefix).then(function (node) { return setPrefixNode(node); });
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
setPrefixNode(null);
|
|
380
|
+
}
|
|
381
|
+
}, [stringPrefix]);
|
|
382
|
+
// Handle stringSuffix
|
|
383
|
+
(0, react_1.useEffect)(function () {
|
|
384
|
+
if (stringSuffix) {
|
|
385
|
+
(0, getDynamicIcon_1.getDynamicIcon)(stringSuffix).then(function (node) { return setSuffixNode(node); });
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
setSuffixNode(null);
|
|
389
|
+
}
|
|
390
|
+
}, [stringSuffix]);
|
|
215
391
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
|
|
216
|
-
// Merge config with local props
|
|
217
392
|
var mergedProps = mergeWithLocal({
|
|
218
393
|
status: status,
|
|
219
394
|
funcss: funcss,
|
|
@@ -225,11 +400,12 @@ var FileInput = function (_a) {
|
|
|
225
400
|
rightRounded: rightRounded,
|
|
226
401
|
startIcon: startIcon,
|
|
227
402
|
endIcon: endIcon,
|
|
403
|
+
prefix: prefix,
|
|
404
|
+
suffix: suffix,
|
|
228
405
|
iconicBg: iconicBg,
|
|
229
406
|
bordered: rest.bordered,
|
|
230
407
|
borderless: rest.borderless,
|
|
231
408
|
}).props;
|
|
232
|
-
// Use theme variant for fallback
|
|
233
409
|
var themeVariant = (0, theme_1.useVariant)().variant;
|
|
234
410
|
var handleChange = function (e) {
|
|
235
411
|
var _a;
|
|
@@ -240,6 +416,8 @@ var FileInput = function (_a) {
|
|
|
240
416
|
if (onChange)
|
|
241
417
|
onChange(e);
|
|
242
418
|
};
|
|
419
|
+
var effectivePrefix = prefixNode || mergedProps.prefix || mergedProps.startIcon;
|
|
420
|
+
var effectiveSuffix = suffixNode || mergedProps.suffix || mergedProps.endIcon;
|
|
243
421
|
if (btn) {
|
|
244
422
|
var className = generateInputClasses({
|
|
245
423
|
status: mergedProps.status,
|
|
@@ -256,8 +434,9 @@ var FileInput = function (_a) {
|
|
|
256
434
|
var style = mergedProps.fullWidth ? { width: '100%' } : undefined;
|
|
257
435
|
var fileInputElement = (react_1.default.createElement("div", { className: "fileInput" },
|
|
258
436
|
button || (react_1.default.createElement(Button_1.default, { funcss: mergedProps.funcss, startIcon: icon || react_1.default.createElement(pi_1.PiCloudArrowUp, null), bg: "primary", fullWidth: true, raised: true }, fileName || label)),
|
|
259
|
-
react_1.default.createElement("input", __assign({ id: id, name: name, className: className, onChange: handleChange, type: "file", style: style, value: value }, rest
|
|
260
|
-
|
|
437
|
+
react_1.default.createElement("input", __assign({ id: id, name: name, className: className, onChange: handleChange, type: "file", style: style, value: value }, rest))));
|
|
438
|
+
var wrappedFileInput = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, fileInputElement));
|
|
439
|
+
return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: undefined, status: mergedProps.status, helperText: helperText, isFocused: false, hasValue: !!fileName, fullWidth: mergedProps.fullWidth, id: id }, wrappedFileInput));
|
|
261
440
|
}
|
|
262
441
|
var uploadElement = (react_1.default.createElement("div", { className: "_upload_container" },
|
|
263
442
|
react_1.default.createElement("label", { htmlFor: id, className: "_upload_label" },
|
|
@@ -270,18 +449,15 @@ var FileInput = function (_a) {
|
|
|
270
449
|
width: '100%',
|
|
271
450
|
} }, fileName || label),
|
|
272
451
|
extra && react_1.default.createElement("div", { className: "text-small opacity-3" }, extra)),
|
|
273
|
-
react_1.default.createElement("input", __assign({ onChange: handleChange, type: "file", id: id, className: "_upload_input" }, rest
|
|
274
|
-
return (react_1.default.createElement(
|
|
452
|
+
react_1.default.createElement("input", __assign({ onChange: handleChange, type: "file", id: id, className: "_upload_input" }, rest))));
|
|
453
|
+
return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: undefined, status: mergedProps.status, helperText: helperText, isFocused: false, hasValue: !!fileName, fullWidth: mergedProps.fullWidth, id: id }, uploadElement));
|
|
275
454
|
};
|
|
276
455
|
exports.FileInput = FileInput;
|
|
277
456
|
var Input = function (_a) {
|
|
278
|
-
var select = _a.select, multiline = _a.multiline, file = _a.file, noBorder = _a.noBorder, startIcon = _a.startIcon, endIcon = _a.endIcon, iconicBg = _a.iconicBg, _b = _a.variant, variant = _b === void 0 ? '' : _b, props = __rest(_a, ["select", "multiline", "file", "noBorder", "startIcon", "endIcon", "iconicBg", "variant"]);
|
|
279
|
-
// Use the component config hook for the main Input component
|
|
457
|
+
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"]);
|
|
280
458
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
|
|
281
|
-
|
|
282
|
-
var
|
|
283
|
-
// Handle legacy noBorder prop
|
|
284
|
-
var inputProps = __assign(__assign(__assign({}, props), mergedProps), { variant: variant, borderless: noBorder !== undefined ? noBorder : (props.borderless !== undefined ? props.borderless : mergedProps.borderless) });
|
|
459
|
+
var mergedProps = mergeWithLocal(__assign(__assign({}, props), { startIcon: startIcon, endIcon: endIcon, prefix: prefix, suffix: suffix, iconicBg: iconicBg })).props;
|
|
460
|
+
var inputProps = __assign(__assign(__assign({}, props), mergedProps), { variant: variant, stringPrefix: stringPrefix, stringSuffix: stringSuffix, borderless: noBorder !== undefined ? noBorder : (props.borderless !== undefined ? props.borderless : mergedProps.borderless) });
|
|
285
461
|
if (select) {
|
|
286
462
|
return react_1.default.createElement(exports.SelectInput, __assign({}, inputProps));
|
|
287
463
|
}
|