funuicss 3.6.16 → 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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.6.16",
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",
@@ -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 _e = (0, react_1.useState)(null), prefixNode = _e[0], setPrefixNode = _e[1];
95
- var _f = (0, react_1.useState)(null), suffixNode = _f[0], setSuffixNode = _f[1];
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
- if (stringSuffix)
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
- }, [stringPrefix, stringSuffix]);
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(final.bg || '', " text-").concat(final.color ? final.color : (_b = final.bg) === null || _b === void 0 ? void 0 : _b.replace(/[0-9]/g, ''))
132
- : final.bg || '',
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 && (react_1.default.createElement("span", { className: "btn_left_icon rotate", style: iconWrapperStyle },
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
- final.fillAnimation && react_1.default.createElement("span", { className: "button_fill_span ".concat(final.bg) }),
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 // fallback for string/number, rendered as-is
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 })
@@ -19,6 +19,8 @@ interface BaseInputProps {
19
19
  endIcon?: React.ReactNode;
20
20
  prefix?: React.ReactNode;
21
21
  suffix?: React.ReactNode;
22
+ stringPrefix?: string;
23
+ stringSuffix?: string;
22
24
  iconicBg?: string;
23
25
  variant?: string;
24
26
  label?: string;
package/ui/input/Input.js CHANGED
@@ -65,6 +65,7 @@ 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");
68
69
  // Status icons mapping
69
70
  var statusIcons = {
70
71
  success: react_1.default.createElement(pi_1.PiCheckCircle, null),
@@ -83,10 +84,9 @@ var generateInputClasses = function (_a) {
83
84
  var borderClass = bordered ? 'borderedInput' : borderless ? 'borderless' : (!bordered && !borderless ? 'borderedInput' : '');
84
85
  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, ' ');
85
86
  };
86
- // Iconic Input Wrapper Component - Updated to support both prefix/suffix and startIcon/endIcon
87
+ // Iconic Input Wrapper Component
87
88
  var IconicInputWrapper = function (_a) {
88
89
  var startIcon = _a.startIcon, endIcon = _a.endIcon, prefix = _a.prefix, suffix = _a.suffix, iconicBg = _a.iconicBg, funcss = _a.funcss, children = _a.children;
89
- // Use prefix/suffix if provided, otherwise fall back to startIcon/endIcon
90
90
  var effectiveStartIcon = prefix !== undefined ? prefix : startIcon;
91
91
  var effectiveEndIcon = suffix !== undefined ? suffix : endIcon;
92
92
  if (!effectiveStartIcon && !effectiveEndIcon) {
@@ -114,15 +114,35 @@ var InputContainer = function (_a) {
114
114
  };
115
115
  // Text Input Component
116
116
  var TextInput = 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, _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, 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", "iconicBg", "type", "label", "helperText", "variant"]);
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
118
  var _e = (0, react_1.useState)(false), isFocused = _e[0], setIsFocused = _e[1];
119
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];
120
122
  var inputRef = (0, react_1.useRef)(null);
121
123
  (0, react_1.useEffect)(function () {
122
124
  if (value !== undefined) {
123
125
  setInputValue(value);
124
126
  }
125
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]);
126
146
  var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
127
147
  var mergedProps = mergeWithLocal({
128
148
  status: status,
@@ -169,23 +189,45 @@ var TextInput = function (_a) {
169
189
  if (rest.onBlur)
170
190
  rest.onBlur(e);
171
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;
172
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)));
173
- var wrappedInput = (react_1.default.createElement(IconicInputWrapper, { startIcon: mergedProps.startIcon, endIcon: mergedProps.endIcon, prefix: mergedProps.prefix, suffix: mergedProps.suffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, inputElement));
174
- return (react_1.default.createElement(InputContainer, { startIcon: startIcon, prefix: prefix, label: label, status: mergedProps.status, helperText: helperText, isFocused: isFocused, hasValue: !!inputValue, fullWidth: mergedProps.fullWidth, id: id }, wrappedInput));
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));
175
198
  };
176
199
  exports.TextInput = TextInput;
177
200
  // Select Component
178
201
  var SelectInput = function (_a) {
179
- 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, 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", "iconicBg", "options", "label", "helperText", "variant"]);
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"]);
180
203
  var _d = (0, react_1.useState)(false), isFocused = _d[0], setIsFocused = _d[1];
181
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];
182
207
  (0, react_1.useEffect)(function () {
183
208
  if (value !== undefined) {
184
209
  setSelectValue(value);
185
210
  }
186
211
  }, [value]);
187
- // For select inputs, label should always be active when there's a label
188
- var selectHasValue = true; // Always true for select to keep label at top
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;
189
231
  var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
190
232
  var mergedProps = mergeWithLocal({
191
233
  status: status,
@@ -232,21 +274,43 @@ var SelectInput = function (_a) {
232
274
  if (rest.onBlur)
233
275
  rest.onBlur(e);
234
276
  };
277
+ var effectivePrefix = prefixNode || mergedProps.prefix || mergedProps.startIcon;
278
+ var effectiveSuffix = suffixNode || mergedProps.suffix || mergedProps.endIcon;
235
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)); })));
236
- var wrappedSelect = (react_1.default.createElement(IconicInputWrapper, { startIcon: mergedProps.startIcon, endIcon: mergedProps.endIcon, prefix: mergedProps.prefix, suffix: mergedProps.suffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, selectElement));
237
- return (react_1.default.createElement(InputContainer, { startIcon: startIcon, prefix: prefix, label: label, status: mergedProps.status, helperText: helperText, isFocused: isFocused, hasValue: selectHasValue, fullWidth: mergedProps.fullWidth, id: id }, wrappedSelect));
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));
238
282
  };
239
283
  exports.SelectInput = SelectInput;
240
284
  // Textarea Component
241
285
  var TextareaInput = function (_a) {
242
- 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, 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", "iconicBg", "label", "helperText", "rows", "variant"]);
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"]);
243
287
  var _d = (0, react_1.useState)(false), isFocused = _d[0], setIsFocused = _d[1];
244
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];
245
291
  (0, react_1.useEffect)(function () {
246
292
  if (value !== undefined) {
247
293
  setTextValue(value);
248
294
  }
249
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]);
250
314
  var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
251
315
  var mergedProps = mergeWithLocal({
252
316
  status: status,
@@ -293,15 +357,37 @@ var TextareaInput = function (_a) {
293
357
  if (rest.onBlur)
294
358
  rest.onBlur(e);
295
359
  };
360
+ var effectivePrefix = prefixNode || mergedProps.prefix || mergedProps.startIcon;
361
+ var effectiveSuffix = suffixNode || mergedProps.suffix || mergedProps.endIcon;
296
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)));
297
- var wrappedTextarea = (react_1.default.createElement(IconicInputWrapper, { startIcon: mergedProps.startIcon, endIcon: mergedProps.endIcon, prefix: mergedProps.prefix, suffix: mergedProps.suffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, textareaElement));
298
- return (react_1.default.createElement(InputContainer, { startIcon: startIcon, prefix: prefix, label: label, status: mergedProps.status, helperText: helperText, isFocused: isFocused, hasValue: !!textValue, fullWidth: mergedProps.fullWidth, id: id }, wrappedTextarea));
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));
299
365
  };
300
366
  exports.TextareaInput = TextareaInput;
301
367
  // File Input Component
302
368
  var FileInput = function (_a) {
303
- 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, 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", "iconicBg", "label", "helperText", "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"]);
304
370
  var _e = (0, react_1.useState)(''), fileName = _e[0], setFileName = _e[1];
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]);
305
391
  var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
306
392
  var mergedProps = mergeWithLocal({
307
393
  status: status,
@@ -330,6 +416,8 @@ var FileInput = function (_a) {
330
416
  if (onChange)
331
417
  onChange(e);
332
418
  };
419
+ var effectivePrefix = prefixNode || mergedProps.prefix || mergedProps.startIcon;
420
+ var effectiveSuffix = suffixNode || mergedProps.suffix || mergedProps.endIcon;
333
421
  if (btn) {
334
422
  var className = generateInputClasses({
335
423
  status: mergedProps.status,
@@ -347,8 +435,8 @@ var FileInput = function (_a) {
347
435
  var fileInputElement = (react_1.default.createElement("div", { className: "fileInput" },
348
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)),
349
437
  react_1.default.createElement("input", __assign({ id: id, name: name, className: className, onChange: handleChange, type: "file", style: style, value: value }, rest))));
350
- var wrappedFileInput = (react_1.default.createElement(IconicInputWrapper, { startIcon: mergedProps.startIcon, endIcon: mergedProps.endIcon, prefix: mergedProps.prefix, suffix: mergedProps.suffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, fileInputElement));
351
- return (react_1.default.createElement(InputContainer, { startIcon: startIcon, prefix: prefix, label: undefined, status: mergedProps.status, helperText: helperText, isFocused: false, hasValue: !!fileName, fullWidth: mergedProps.fullWidth, id: id }, wrappedFileInput));
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));
352
440
  }
353
441
  var uploadElement = (react_1.default.createElement("div", { className: "_upload_container" },
354
442
  react_1.default.createElement("label", { htmlFor: id, className: "_upload_label" },
@@ -362,14 +450,14 @@ var FileInput = function (_a) {
362
450
  } }, fileName || label),
363
451
  extra && react_1.default.createElement("div", { className: "text-small opacity-3" }, extra)),
364
452
  react_1.default.createElement("input", __assign({ onChange: handleChange, type: "file", id: id, className: "_upload_input" }, rest))));
365
- return (react_1.default.createElement(InputContainer, { startIcon: startIcon, prefix: prefix, label: undefined, status: mergedProps.status, helperText: helperText, isFocused: false, hasValue: !!fileName, fullWidth: mergedProps.fullWidth, id: id }, uploadElement));
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));
366
454
  };
367
455
  exports.FileInput = FileInput;
368
456
  var Input = function (_a) {
369
- 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, iconicBg = _a.iconicBg, _b = _a.variant, variant = _b === void 0 ? '' : _b, props = __rest(_a, ["select", "multiline", "file", "noBorder", "startIcon", "endIcon", "prefix", "suffix", "iconicBg", "variant"]);
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"]);
370
458
  var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
371
459
  var mergedProps = mergeWithLocal(__assign(__assign({}, props), { startIcon: startIcon, endIcon: endIcon, prefix: prefix, suffix: suffix, iconicBg: iconicBg })).props;
372
- var inputProps = __assign(__assign(__assign({}, props), mergedProps), { variant: variant, borderless: noBorder !== undefined ? noBorder : (props.borderless !== undefined ? props.borderless : mergedProps.borderless) });
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) });
373
461
  if (select) {
374
462
  return react_1.default.createElement(exports.SelectInput, __assign({}, inputProps));
375
463
  }