funuicss 3.8.6 → 3.8.8

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/ui/input/Input.js CHANGED
@@ -115,11 +115,13 @@ var IconicInputWrapper = function (_a) {
115
115
  };
116
116
  // Input Container with Floating Label
117
117
  var InputContainer = function (_a) {
118
- 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;
118
+ 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, _c = _a.required, required = _c === void 0 ? false : _c;
119
119
  var showFloatingLabel = label && (alwaysActiveLabel || isFocused || hasValue);
120
120
  return (react_1.default.createElement("div", { className: "input-wrapper ".concat(fullWidth ? 'full-width' : '') },
121
121
  react_1.default.createElement("div", { className: "input-container-with-label" },
122
- 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)),
122
+ label && (react_1.default.createElement("label", { htmlFor: id, className: "floating-label ".concat(startIcon || prefix ? "label-left" : "", " ").concat(showFloatingLabel ? 'active' : '', " ").concat(status ? "label-".concat(status) : '') },
123
+ label,
124
+ required && react_1.default.createElement("span", { className: "required-indicator" }, "*"))),
123
125
  children),
124
126
  (helperText || status) && (react_1.default.createElement("div", { className: "input-helper-text ".concat(status ? "helper-".concat(status) : '') },
125
127
  status && statusIcons[status] && (react_1.default.createElement("span", { className: "helper-icon" }, statusIcons[status])),
@@ -127,13 +129,17 @@ var InputContainer = function (_a) {
127
129
  };
128
130
  // Text Input Component
129
131
  var TextInput = function (_a) {
130
- 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, placeholder = _a.placeholder, 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", "placeholder"]);
131
- var _e = (0, react_1.useState)(false), isFocused = _e[0], setIsFocused = _e[1];
132
- var _f = (0, react_1.useState)(value !== undefined ? String(value) : defaultValue || ''), inputValue = _f[0], setInputValue = _f[1];
133
- var _g = (0, react_1.useState)(null), prefixNode = _g[0], setPrefixNode = _g[1];
134
- var _h = (0, react_1.useState)(null), suffixNode = _h[0], setSuffixNode = _h[1];
135
- var _j = (0, react_1.useState)(false), hasValidStringPrefix = _j[0], setHasValidStringPrefix = _j[1];
136
- var _k = (0, react_1.useState)(false), hasValidStringSuffix = _k[0], setHasValidStringSuffix = _k[1];
132
+ var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, onClick = _a.onClick, onKeyDown = _a.onKeyDown, onKeyUp = _a.onKeyUp, onKeyPress = _a.onKeyPress, onSubmit = _a.onSubmit, 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, placeholder = _a.placeholder,
133
+ // HTML Input Attributes
134
+ _e = _a.disabled,
135
+ // HTML Input Attributes
136
+ disabled = _e === void 0 ? false : _e, _f = _a.readOnly, readOnly = _f === void 0 ? false : _f, _g = _a.required, required = _g === void 0 ? false : _g, _h = _a.autoFocus, autoFocus = _h === void 0 ? false : _h, autoComplete = _a.autoComplete, pattern = _a.pattern, minLength = _a.minLength, maxLength = _a.maxLength, min = _a.min, max = _a.max, step = _a.step, multiple = _a.multiple, accept = _a.accept, size = _a.size, form = _a.form, formNoValidate = _a.formNoValidate, formTarget = _a.formTarget, list = _a.list, autoCapitalize = _a.autoCapitalize, autoCorrect = _a.autoCorrect, spellCheck = _a.spellCheck, inputMode = _a.inputMode, dirname = _a.dirname, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "onBlur", "onFocus", "onClick", "onKeyDown", "onKeyUp", "onKeyPress", "onSubmit", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "prefix", "suffix", "stringPrefix", "stringSuffix", "iconicBg", "type", "label", "helperText", "variant", "placeholder", "disabled", "readOnly", "required", "autoFocus", "autoComplete", "pattern", "minLength", "maxLength", "min", "max", "step", "multiple", "accept", "size", "form", "formNoValidate", "formTarget", "list", "autoCapitalize", "autoCorrect", "spellCheck", "inputMode", "dirname"]);
137
+ var _j = (0, react_1.useState)(false), isFocused = _j[0], setIsFocused = _j[1];
138
+ var _k = (0, react_1.useState)(value !== undefined ? String(value) : defaultValue || ''), inputValue = _k[0], setInputValue = _k[1];
139
+ var _l = (0, react_1.useState)(null), prefixNode = _l[0], setPrefixNode = _l[1];
140
+ var _m = (0, react_1.useState)(null), suffixNode = _m[0], setSuffixNode = _m[1];
141
+ var _o = (0, react_1.useState)(false), hasValidStringPrefix = _o[0], setHasValidStringPrefix = _o[1];
142
+ var _p = (0, react_1.useState)(false), hasValidStringSuffix = _p[0], setHasValidStringSuffix = _p[1];
137
143
  var inputRef = (0, react_1.useRef)(null);
138
144
  var isDateTimeInput = ['date', 'time', 'month', 'week', 'datetime-local'].includes(type || '');
139
145
  (0, react_1.useEffect)(function () {
@@ -290,30 +296,36 @@ var TextInput = function (_a) {
290
296
  };
291
297
  var handleFocus = function (e) {
292
298
  setIsFocused(true);
293
- if (rest.onFocus)
294
- rest.onFocus(e);
299
+ if (onFocus)
300
+ onFocus(e);
295
301
  };
296
302
  var handleBlur = function (e) {
297
303
  setIsFocused(false);
298
- if (rest.onBlur)
299
- rest.onBlur(e);
304
+ if (onBlur)
305
+ onBlur(e);
300
306
  };
301
307
  var showPlaceholder = placeholder && label && (isFocused || !!inputValue);
302
- 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)));
308
+ var inputElement = (react_1.default.createElement("input", __assign({ ref: inputRef, id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, onClick: onClick, onKeyDown: onKeyDown, onKeyUp: onKeyUp, onKeyPress: onKeyPress, onSubmit: onSubmit, defaultValue: defaultValue, type: type, placeholder: showPlaceholder ? placeholder : (!label ? placeholder : ''), style: style, value: inputValue,
309
+ // HTML Input Attributes
310
+ disabled: disabled, readOnly: readOnly, required: required, autoFocus: autoFocus, autoComplete: autoComplete, pattern: pattern, minLength: minLength, maxLength: maxLength, min: min, max: max, step: step, multiple: multiple, accept: accept, size: size, form: form, formNoValidate: formNoValidate, formTarget: formTarget, list: list, autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, spellCheck: spellCheck, inputMode: inputMode }, rest)));
303
311
  // Only use iconic wrapper when we have icons, matching Button's pattern
304
312
  var wrappedInput = showPrefix || showSuffix ? (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: final.iconicBg, funcss: final.funcss, stringPrefix: stringPrefix, stringSuffix: stringSuffix }, inputElement)) : (inputElement);
305
- 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));
313
+ 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, required: required }, wrappedInput));
306
314
  };
307
315
  exports.TextInput = TextInput;
308
316
  // Select Component - UPDATED to match pattern
309
317
  var SelectInput = function (_a) {
310
- 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"]);
311
- var _d = (0, react_1.useState)(false), isFocused = _d[0], setIsFocused = _d[1];
312
- var _e = (0, react_1.useState)(value !== undefined ? String(value) : defaultValue || ''), selectValue = _e[0], setSelectValue = _e[1];
313
- var _f = (0, react_1.useState)(null), prefixNode = _f[0], setPrefixNode = _f[1];
314
- var _g = (0, react_1.useState)(null), suffixNode = _g[0], setSuffixNode = _g[1];
315
- var _h = (0, react_1.useState)(false), hasValidStringPrefix = _h[0], setHasValidStringPrefix = _h[1];
316
- var _j = (0, react_1.useState)(false), hasValidStringSuffix = _j[0], setHasValidStringSuffix = _j[1];
318
+ var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, onClick = _a.onClick, onKeyDown = _a.onKeyDown, onKeyUp = _a.onKeyUp, onKeyPress = _a.onKeyPress, onSubmit = _a.onSubmit, 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,
319
+ // HTML Select Attributes
320
+ _d = _a.disabled,
321
+ // HTML Select Attributes
322
+ disabled = _d === void 0 ? false : _d, _e = _a.required, required = _e === void 0 ? false : _e, _f = _a.autoFocus, autoFocus = _f === void 0 ? false : _f, form = _a.form, formNoValidate = _a.formNoValidate, formTarget = _a.formTarget, size = _a.size, multiple = _a.multiple, autoComplete = _a.autoComplete, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "onBlur", "onFocus", "onClick", "onKeyDown", "onKeyUp", "onKeyPress", "onSubmit", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "prefix", "suffix", "stringPrefix", "stringSuffix", "iconicBg", "options", "label", "helperText", "variant", "disabled", "required", "autoFocus", "form", "formNoValidate", "formTarget", "size", "multiple", "autoComplete"]);
323
+ var _g = (0, react_1.useState)(false), isFocused = _g[0], setIsFocused = _g[1];
324
+ var _h = (0, react_1.useState)(value !== undefined ? String(value) : defaultValue || ''), selectValue = _h[0], setSelectValue = _h[1];
325
+ var _j = (0, react_1.useState)(null), prefixNode = _j[0], setPrefixNode = _j[1];
326
+ var _k = (0, react_1.useState)(null), suffixNode = _k[0], setSuffixNode = _k[1];
327
+ var _l = (0, react_1.useState)(false), hasValidStringPrefix = _l[0], setHasValidStringPrefix = _l[1];
328
+ var _m = (0, react_1.useState)(false), hasValidStringSuffix = _m[0], setHasValidStringSuffix = _m[1];
317
329
  (0, react_1.useEffect)(function () {
318
330
  if (value !== undefined && value !== '') {
319
331
  setSelectValue(String(value));
@@ -469,29 +481,38 @@ var SelectInput = function (_a) {
469
481
  };
470
482
  var handleFocus = function (e) {
471
483
  setIsFocused(true);
472
- if (rest.onFocus)
473
- rest.onFocus(e);
484
+ if (onFocus)
485
+ onFocus(e);
474
486
  };
475
487
  var handleBlur = function (e) {
476
488
  setIsFocused(false);
477
- if (rest.onBlur)
478
- rest.onBlur(e);
489
+ if (onBlur)
490
+ onBlur(e);
479
491
  };
480
- 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)); })));
492
+ var selectElement = (react_1.default.createElement("select", __assign({ id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, onClick: onClick, onKeyDown: onKeyDown, onKeyUp: onKeyUp, onKeyPress: onKeyPress, onSubmit: onSubmit, defaultValue: defaultValue, value: selectValue, style: style,
493
+ // HTML Select Attributes
494
+ disabled: disabled, required: required, autoFocus: autoFocus, form: form,
495
+ // formNoValidate={formNoValidate}
496
+ // formTarget={formTarget}
497
+ size: size, multiple: multiple, autoComplete: autoComplete }, rest), options.map(function (option) { return (react_1.default.createElement("option", { key: option.value, value: option.value }, option.text)); })));
481
498
  // Only use iconic wrapper when we have icons, matching Button's pattern
482
499
  var wrappedSelect = showPrefix || showSuffix ? (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: final.iconicBg, funcss: final.funcss, stringPrefix: stringPrefix, stringSuffix: stringSuffix }, selectElement)) : (selectElement);
483
- 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));
500
+ 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, required: required }, wrappedSelect));
484
501
  };
485
502
  exports.SelectInput = SelectInput;
486
503
  // Textarea Component - UPDATED to match pattern
487
504
  var TextareaInput = function (_a) {
488
- 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, placeholder = _a.placeholder, 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", "placeholder"]);
489
- var _d = (0, react_1.useState)(false), isFocused = _d[0], setIsFocused = _d[1];
490
- var _e = (0, react_1.useState)(value !== undefined ? String(value) : defaultValue || ''), textValue = _e[0], setTextValue = _e[1];
491
- var _f = (0, react_1.useState)(null), prefixNode = _f[0], setPrefixNode = _f[1];
492
- var _g = (0, react_1.useState)(null), suffixNode = _g[0], setSuffixNode = _g[1];
493
- var _h = (0, react_1.useState)(false), hasValidStringPrefix = _h[0], setHasValidStringPrefix = _h[1];
494
- var _j = (0, react_1.useState)(false), hasValidStringSuffix = _j[0], setHasValidStringSuffix = _j[1];
505
+ var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, onClick = _a.onClick, onKeyDown = _a.onKeyDown, onKeyUp = _a.onKeyUp, onKeyPress = _a.onKeyPress, onSubmit = _a.onSubmit, 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, cols = _a.cols, wrap = _a.wrap, _c = _a.variant, variant = _c === void 0 ? '' : _c, placeholder = _a.placeholder,
506
+ // HTML Textarea Attributes
507
+ _d = _a.disabled,
508
+ // HTML Textarea Attributes
509
+ disabled = _d === void 0 ? false : _d, _e = _a.readOnly, readOnly = _e === void 0 ? false : _e, _f = _a.required, required = _f === void 0 ? false : _f, _g = _a.autoFocus, autoFocus = _g === void 0 ? false : _g, autoComplete = _a.autoComplete, minLength = _a.minLength, maxLength = _a.maxLength, form = _a.form, formNoValidate = _a.formNoValidate, formTarget = _a.formTarget, dirname = _a.dirname, autoCapitalize = _a.autoCapitalize, autoCorrect = _a.autoCorrect, spellCheck = _a.spellCheck, inputMode = _a.inputMode, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "onBlur", "onFocus", "onClick", "onKeyDown", "onKeyUp", "onKeyPress", "onSubmit", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "prefix", "suffix", "stringPrefix", "stringSuffix", "iconicBg", "label", "helperText", "rows", "cols", "wrap", "variant", "placeholder", "disabled", "readOnly", "required", "autoFocus", "autoComplete", "minLength", "maxLength", "form", "formNoValidate", "formTarget", "dirname", "autoCapitalize", "autoCorrect", "spellCheck", "inputMode"]);
510
+ var _h = (0, react_1.useState)(false), isFocused = _h[0], setIsFocused = _h[1];
511
+ var _j = (0, react_1.useState)(value !== undefined ? String(value) : defaultValue || ''), textValue = _j[0], setTextValue = _j[1];
512
+ var _k = (0, react_1.useState)(null), prefixNode = _k[0], setPrefixNode = _k[1];
513
+ var _l = (0, react_1.useState)(null), suffixNode = _l[0], setSuffixNode = _l[1];
514
+ var _m = (0, react_1.useState)(false), hasValidStringPrefix = _m[0], setHasValidStringPrefix = _m[1];
515
+ var _o = (0, react_1.useState)(false), hasValidStringSuffix = _o[0], setHasValidStringSuffix = _o[1];
495
516
  (0, react_1.useEffect)(function () {
496
517
  if (value !== undefined && value !== '') {
497
518
  setTextValue(String(value));
@@ -646,19 +667,25 @@ var TextareaInput = function (_a) {
646
667
  };
647
668
  var handleFocus = function (e) {
648
669
  setIsFocused(true);
649
- if (rest.onFocus)
650
- rest.onFocus(e);
670
+ if (onFocus)
671
+ onFocus(e);
651
672
  };
652
673
  var handleBlur = function (e) {
653
674
  setIsFocused(false);
654
- if (rest.onBlur)
655
- rest.onBlur(e);
675
+ if (onBlur)
676
+ onBlur(e);
656
677
  };
657
678
  var showPlaceholder = placeholder && label && (isFocused || !!textValue);
658
- var textareaElement = (react_1.default.createElement("textarea", __assign({ id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, defaultValue: defaultValue, placeholder: showPlaceholder ? placeholder : (!label ? placeholder : ''), style: style, value: textValue, rows: rows }, rest)));
679
+ var textareaElement = (react_1.default.createElement("textarea", __assign({ id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, onClick: onClick, onKeyDown: onKeyDown, onKeyUp: onKeyUp, onKeyPress: onKeyPress, onSubmit: onSubmit, defaultValue: defaultValue, placeholder: showPlaceholder ? placeholder : (!label ? placeholder : ''), style: style, value: textValue, rows: rows, cols: cols, wrap: wrap,
680
+ // HTML Textarea Attributes
681
+ disabled: disabled, readOnly: readOnly, required: required, autoFocus: autoFocus, autoComplete: autoComplete, minLength: minLength, maxLength: maxLength, form: form,
682
+ // formNoValidate={formNoValidate}
683
+ // formTarget={formTarget}
684
+ // dirname={dirname}
685
+ autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, spellCheck: spellCheck, inputMode: inputMode }, rest)));
659
686
  // Only use iconic wrapper when we have icons, matching Button's pattern
660
687
  var wrappedTextarea = showPrefix || showSuffix ? (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: final.iconicBg, funcss: final.funcss, stringPrefix: stringPrefix, stringSuffix: stringSuffix }, textareaElement)) : (textareaElement);
661
- 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));
688
+ return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: final.status, helperText: helperText, isFocused: isFocused, hasValue: !!textValue, fullWidth: final.fullWidth, id: id, required: required }, wrappedTextarea));
662
689
  };
663
690
  exports.TextareaInput = TextareaInput;
664
691
  var Input = function (_a) {
@@ -679,3 +706,976 @@ var Input = function (_a) {
679
706
  return react_1.default.createElement(exports.TextInput, __assign({}, inputProps));
680
707
  };
681
708
  exports.default = Input;
709
+ // 'use client'
710
+ // import React, { useState, useEffect, useRef } from 'react';
711
+ // import { PiCheck, PiCloudArrowUp, PiInfo, PiWarning, PiX, PiCheckCircle } from 'react-icons/pi';
712
+ // import Button from '../button/Button';
713
+ // import { useVariant } from '../theme/theme';
714
+ // import { useComponentConfiguration } from '../../utils/componentUtils';
715
+ // import { getDynamicIcon } from '../../utils/getDynamicIcon';
716
+ // import Text from '../text/Text';
717
+ // import { FileUpload } from './FileUpload';
718
+ // // Base types and interfaces
719
+ // interface BaseInputProps {
720
+ // id?: string;
721
+ // name?: string;
722
+ // value?: any;
723
+ // defaultValue?: string;
724
+ // onChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => void;
725
+ // status?: 'success' | 'warning' | 'danger' | 'info' ;
726
+ // funcss?: string;
727
+ // bg?: string;
728
+ // fullWidth?: boolean;
729
+ // flat?: boolean;
730
+ // bordered?: boolean;
731
+ // borderless?: boolean;
732
+ // rounded?: boolean;
733
+ // leftRounded?: boolean;
734
+ // rightRounded?: boolean;
735
+ // startIcon?: React.ReactNode;
736
+ // endIcon?: React.ReactNode;
737
+ // prefix?: React.ReactNode;
738
+ // suffix?: React.ReactNode;
739
+ // stringPrefix?: string;
740
+ // stringSuffix?: string;
741
+ // iconicBg?: string;
742
+ // variant?: string;
743
+ // label?: string;
744
+ // helperText?: string;
745
+ // }
746
+ // interface SelectOption {
747
+ // value: string;
748
+ // text: string;
749
+ // }
750
+ // interface TextInputProps extends BaseInputProps {
751
+ // type?: string;
752
+ // }
753
+ // interface SelectProps extends BaseInputProps {
754
+ // options?: SelectOption[];
755
+ // }
756
+ // interface TextareaProps extends BaseInputProps {
757
+ // rows?: number;
758
+ // }
759
+ // interface FileInputProps extends BaseInputProps {
760
+ // icon?: React.ReactNode;
761
+ // extra?: React.ReactNode;
762
+ // button?: React.ReactNode;
763
+ // btn?: boolean;
764
+ // }
765
+ // // Status icons mapping
766
+ // const statusIcons = {
767
+ // success: <PiCheckCircle />,
768
+ // warning: <PiWarning />,
769
+ // danger: <PiX />,
770
+ // info: <PiInfo />
771
+ // };
772
+ // // Utility function to generate CSS classes
773
+ // const generateInputClasses = ({
774
+ // status,
775
+ // rounded,
776
+ // bg,
777
+ // funcss,
778
+ // flat,
779
+ // leftRounded,
780
+ // rightRounded,
781
+ // bordered,
782
+ // borderless,
783
+ // additionalClasses = '',
784
+ // hasNoPrefix = false,
785
+ // hasNoLabel = false
786
+ // }: {
787
+ // status?: string;
788
+ // rounded?: boolean;
789
+ // bg?: string;
790
+ // funcss?: string;
791
+ // flat?: boolean;
792
+ // leftRounded?: boolean;
793
+ // rightRounded?: boolean;
794
+ // bordered?: boolean;
795
+ // borderless?: boolean;
796
+ // additionalClasses?: string;
797
+ // hasNoPrefix?: boolean;
798
+ // hasNoLabel?: boolean;
799
+ // }) => {
800
+ // const statusClass = status ? `${status}-input` : '';
801
+ // const roundedClass = rounded ? 'rounded' : '';
802
+ // const bgClass = bg || '';
803
+ // const flatClass = flat ? 'flat' : '';
804
+ // const cornerClass = leftRounded ? 'leftRounded' : rightRounded ? 'rightRounded' : '';
805
+ // const borderClass = bordered ? 'borderedInput' : borderless ? 'borderless' : (!bordered && !borderless ? 'borderedInput' : '');
806
+ // const noPrefixClass = hasNoPrefix ? 'no_prefix' : '';
807
+ // const noLabelClass = hasNoLabel ? 'no_label' : '';
808
+ // return `
809
+ // ${statusClass}
810
+ // ${roundedClass}
811
+ // ${bgClass}
812
+ // ${funcss || ''}
813
+ // ${flatClass}
814
+ // ${cornerClass}
815
+ // ${borderClass}
816
+ // ${additionalClasses}
817
+ // ${noPrefixClass}
818
+ // ${noLabelClass}
819
+ // input
820
+ // `.trim().replace(/\s+/g, ' ');
821
+ // };
822
+ // // Iconic Input Wrapper Component - UPDATED to match Button's pattern
823
+ // const IconicInputWrapper: React.FC<{
824
+ // startIcon?: React.ReactNode;
825
+ // endIcon?: React.ReactNode;
826
+ // prefix?: React.ReactNode;
827
+ // suffix?: React.ReactNode;
828
+ // iconicBg?: string;
829
+ // funcss?: string;
830
+ // stringPrefix?: string;
831
+ // stringSuffix?: string;
832
+ // children: React.ReactNode;
833
+ // }> = ({
834
+ // startIcon,
835
+ // endIcon,
836
+ // prefix,
837
+ // suffix,
838
+ // iconicBg,
839
+ // funcss,
840
+ // stringPrefix,
841
+ // stringSuffix,
842
+ // children
843
+ // }) => {
844
+ // // Match Button's pattern exactly - use proper priority
845
+ // const effectiveStartIcon = startIcon !== undefined ? startIcon : prefix;
846
+ // const effectiveEndIcon = endIcon !== undefined ? endIcon : suffix;
847
+ // // Determine which icons to show - MATCH BUTTON'S PATTERN EXACTLY
848
+ // const showPrefix = effectiveStartIcon !== undefined && effectiveStartIcon !== null;
849
+ // const showSuffix = effectiveEndIcon !== undefined && effectiveEndIcon !== null;
850
+ // if (!showPrefix && !showSuffix) {
851
+ // return <>{children}</>;
852
+ // }
853
+ // // Helper function to check if element is a React element
854
+ // function isReactElement(node: any): node is React.ReactElement {
855
+ // return React.isValidElement(node);
856
+ // }
857
+ // return (
858
+ // <div className={`icon-container ${showPrefix ? 'has-left-icon' : ''} ${funcss || ''}`}>
859
+ // {/* LEFT ICON - Match Button's exact conditional pattern */}
860
+ // {showPrefix && (
861
+ // <div
862
+ // className="leftIcon"
863
+ // style={{
864
+ // backgroundColor: iconicBg || '',
865
+ // border: iconicBg ? `0.1rem ${iconicBg} solid` : '',
866
+ // }}
867
+ // >
868
+ // {isReactElement(startIcon) ? startIcon
869
+ // : isReactElement(prefix) ? prefix
870
+ // : isReactElement(effectiveStartIcon) ? effectiveStartIcon
871
+ // : stringPrefix ? effectiveStartIcon : ''
872
+ // }
873
+ // </div>
874
+ // )}
875
+ // {children}
876
+ // {/* RIGHT ICON - Match Button's exact conditional pattern */}
877
+ // {showSuffix && (
878
+ // <div className="rightIcon" style={{ backgroundColor: iconicBg || '' }}>
879
+ // {isReactElement(endIcon) ? endIcon
880
+ // : isReactElement(suffix) ? suffix
881
+ // : isReactElement(effectiveEndIcon) ? effectiveEndIcon
882
+ // : stringSuffix ? effectiveEndIcon : ""
883
+ // }
884
+ // </div>
885
+ // )}
886
+ // </div>
887
+ // );
888
+ // };
889
+ // // Input Container with Floating Label
890
+ // const InputContainer: React.FC<{
891
+ // label?: string;
892
+ // status?: string;
893
+ // helperText?: string;
894
+ // children: React.ReactNode;
895
+ // isFocused: boolean;
896
+ // hasValue: boolean;
897
+ // fullWidth?: boolean;
898
+ // id?: string;
899
+ // startIcon?: React.ReactNode;
900
+ // prefix?: React.ReactNode;
901
+ // alwaysActiveLabel?: boolean;
902
+ // }> = ({ label, status, helperText, children, isFocused, hasValue, fullWidth, id, startIcon, prefix, alwaysActiveLabel = false }) => {
903
+ // const showFloatingLabel = label && (alwaysActiveLabel || isFocused || hasValue);
904
+ // return (
905
+ // <div className={`input-wrapper ${fullWidth ? 'full-width' : ''}`}>
906
+ // <div className="input-container-with-label">
907
+ // {label && (
908
+ // <label
909
+ // htmlFor={id}
910
+ // className={`floating-label ${startIcon || prefix ? "label-left" : ""} ${showFloatingLabel ? 'active' : ''} ${status ? `label-${status}` : ''}`}
911
+ // >
912
+ // {label}
913
+ // </label>
914
+ // )}
915
+ // {children}
916
+ // </div>
917
+ // {(helperText || status) && (
918
+ // <div className={`input-helper-text ${status ? `helper-${status}` : ''}`}>
919
+ // {status && statusIcons[status as keyof typeof statusIcons] && (
920
+ // <span className="helper-icon">{statusIcons[status as keyof typeof statusIcons]}</span>
921
+ // )}
922
+ // <span>{helperText}</span>
923
+ // </div>
924
+ // )}
925
+ // </div>
926
+ // );
927
+ // };
928
+ // // Text Input Component
929
+ // export const TextInput: React.FC<TextInputProps & React.InputHTMLAttributes<HTMLInputElement>> = ({
930
+ // id,
931
+ // name,
932
+ // value,
933
+ // defaultValue,
934
+ // onChange,
935
+ // status,
936
+ // funcss,
937
+ // bg,
938
+ // fullWidth = true,
939
+ // flat,
940
+ // bordered,
941
+ // borderless,
942
+ // rounded,
943
+ // leftRounded,
944
+ // rightRounded,
945
+ // startIcon,
946
+ // endIcon,
947
+ // prefix,
948
+ // suffix,
949
+ // stringPrefix,
950
+ // stringSuffix,
951
+ // iconicBg,
952
+ // type = 'text',
953
+ // label,
954
+ // helperText,
955
+ // variant = '',
956
+ // placeholder,
957
+ // ...rest
958
+ // }) => {
959
+ // const [isFocused, setIsFocused] = useState(false);
960
+ // const [inputValue, setInputValue] = useState<string>(value !== undefined ? String(value) : defaultValue || '');
961
+ // const [prefixNode, setPrefixNode] = useState<React.ReactNode>(null);
962
+ // const [suffixNode, setSuffixNode] = useState<React.ReactNode>(null);
963
+ // const [hasValidStringPrefix, setHasValidStringPrefix] = useState(false);
964
+ // const [hasValidStringSuffix, setHasValidStringSuffix] = useState(false);
965
+ // const inputRef = useRef<HTMLInputElement>(null);
966
+ // const isDateTimeInput = ['date', 'time', 'month', 'week', 'datetime-local'].includes(type || '');
967
+ // useEffect(() => {
968
+ // if (value !== undefined && value !== '') {
969
+ // setInputValue(String(value));
970
+ // } else if (value === '') {
971
+ // setInputValue('');
972
+ // }
973
+ // }, [value]);
974
+ // const { mergeWithLocal } = useComponentConfiguration('Input', variant);
975
+ // const localProps = {
976
+ // status,
977
+ // funcss,
978
+ // bg,
979
+ // fullWidth,
980
+ // flat,
981
+ // bordered,
982
+ // borderless,
983
+ // rounded,
984
+ // leftRounded,
985
+ // rightRounded,
986
+ // startIcon,
987
+ // endIcon,
988
+ // prefix,
989
+ // suffix,
990
+ // iconicBg,
991
+ // stringPrefix,
992
+ // stringSuffix,
993
+ // };
994
+ // const { props: mergedProps } = mergeWithLocal(localProps);
995
+ // const final = {
996
+ // status: status !== undefined ? status : mergedProps.status,
997
+ // funcss: funcss !== undefined ? funcss : mergedProps.funcss,
998
+ // bg: bg !== undefined ? bg : mergedProps.bg,
999
+ // fullWidth: fullWidth !== undefined ? fullWidth : mergedProps.fullWidth,
1000
+ // flat: flat !== undefined ? flat : mergedProps.flat,
1001
+ // bordered: bordered !== undefined ? bordered : mergedProps.bordered,
1002
+ // borderless: borderless !== undefined ? borderless : mergedProps.borderless,
1003
+ // rounded: rounded !== undefined ? rounded : mergedProps.rounded,
1004
+ // leftRounded: leftRounded !== undefined ? leftRounded : mergedProps.leftRounded,
1005
+ // rightRounded: rightRounded !== undefined ? rightRounded : mergedProps.rightRounded,
1006
+ // startIcon: startIcon !== undefined ? startIcon : mergedProps.startIcon,
1007
+ // endIcon: endIcon !== undefined ? endIcon : mergedProps.endIcon,
1008
+ // prefix: prefix !== undefined ? prefix : mergedProps.prefix,
1009
+ // suffix: suffix !== undefined ? suffix : mergedProps.suffix,
1010
+ // iconicBg: iconicBg !== undefined ? iconicBg : mergedProps.iconicBg,
1011
+ // stringPrefix: stringPrefix !== undefined ? stringPrefix : mergedProps.stringPrefix,
1012
+ // stringSuffix: stringSuffix !== undefined ? stringSuffix : mergedProps.stringSuffix,
1013
+ // };
1014
+ // // Handle stringPrefix - MATCH BUTTON'S PATTERN EXACTLY
1015
+ // useEffect(() => {
1016
+ // const effectiveStringPrefix = final.stringPrefix;
1017
+ // if (!effectiveStringPrefix || effectiveStringPrefix.trim() === '') {
1018
+ // setPrefixNode(null);
1019
+ // setHasValidStringPrefix(false);
1020
+ // return;
1021
+ // }
1022
+ // getDynamicIcon(effectiveStringPrefix).then((node) => {
1023
+ // if (node) {
1024
+ // setPrefixNode(node);
1025
+ // setHasValidStringPrefix(true);
1026
+ // } else {
1027
+ // setPrefixNode(null);
1028
+ // setHasValidStringPrefix(false);
1029
+ // }
1030
+ // });
1031
+ // }, [final.stringPrefix]);
1032
+ // // Handle stringSuffix - MATCH BUTTON'S PATTERN EXACTLY
1033
+ // useEffect(() => {
1034
+ // const effectiveStringSuffix = final.stringSuffix;
1035
+ // if (!effectiveStringSuffix || effectiveStringSuffix.trim() === '') {
1036
+ // setSuffixNode(null);
1037
+ // setHasValidStringSuffix(false);
1038
+ // return;
1039
+ // }
1040
+ // getDynamicIcon(effectiveStringSuffix).then((node) => {
1041
+ // if (node) {
1042
+ // setSuffixNode(node);
1043
+ // setHasValidStringSuffix(true);
1044
+ // } else {
1045
+ // setSuffixNode(null);
1046
+ // setHasValidStringSuffix(false);
1047
+ // }
1048
+ // });
1049
+ // }, [final.stringSuffix]);
1050
+ // const { variant: themeVariant } = useVariant();
1051
+ // // Determine which prefix to show with proper priority - MATCH BUTTON'S PATTERN
1052
+ // const showPrefix = React.useMemo(() => {
1053
+ // // Priority order: startIcon (local) > prefix (local) > stringPrefix (dynamic)
1054
+ // if (final.startIcon) return true;
1055
+ // if (final.prefix) return true;
1056
+ // if (hasValidStringPrefix && prefixNode) return true;
1057
+ // return false;
1058
+ // }, [final.startIcon, final.prefix, hasValidStringPrefix, prefixNode]);
1059
+ // // Determine which suffix to show with proper priority - MATCH BUTTON'S PATTERN
1060
+ // const showSuffix = React.useMemo(() => {
1061
+ // // Priority order: endIcon (local) > suffix (local) > stringSuffix (dynamic)
1062
+ // if (final.endIcon) return true;
1063
+ // if (final.suffix) return true;
1064
+ // if (hasValidStringSuffix && suffixNode) return true;
1065
+ // return false;
1066
+ // }, [final.endIcon, final.suffix, hasValidStringSuffix, suffixNode]);
1067
+ // // Get effective icons following Button's priority pattern
1068
+ // const effectivePrefix = React.useMemo(() => {
1069
+ // // Priority: startIcon > prefix > stringPrefix
1070
+ // if (final.startIcon) return final.startIcon;
1071
+ // if (final.prefix) return final.prefix;
1072
+ // if (hasValidStringPrefix) return prefixNode;
1073
+ // return null;
1074
+ // }, [final.startIcon, final.prefix, hasValidStringPrefix, prefixNode]);
1075
+ // const effectiveSuffix = React.useMemo(() => {
1076
+ // // Priority: endIcon > suffix > stringSuffix
1077
+ // if (final.endIcon) return final.endIcon;
1078
+ // if (final.suffix) return final.suffix;
1079
+ // if (hasValidStringSuffix) return suffixNode;
1080
+ // return null;
1081
+ // }, [final.endIcon, final.suffix, hasValidStringSuffix, suffixNode]);
1082
+ // const hasNoPrefix = !effectivePrefix;
1083
+ // const hasNoLabel = !label;
1084
+ // const className = generateInputClasses({
1085
+ // status: final.status,
1086
+ // rounded: final.rounded,
1087
+ // bg: final.bg,
1088
+ // funcss: final.funcss,
1089
+ // flat: final.flat,
1090
+ // leftRounded: final.leftRounded,
1091
+ // rightRounded: final.rightRounded,
1092
+ // bordered: final.bordered,
1093
+ // borderless: final.borderless,
1094
+ // hasNoPrefix,
1095
+ // hasNoLabel,
1096
+ // });
1097
+ // const style = final.fullWidth ? { width: '100%' } : undefined;
1098
+ // const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
1099
+ // const newValue = e.target.value;
1100
+ // setInputValue(newValue);
1101
+ // if (onChange) onChange(e);
1102
+ // };
1103
+ // const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {
1104
+ // setIsFocused(true);
1105
+ // if (rest.onFocus) rest.onFocus(e);
1106
+ // };
1107
+ // const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {
1108
+ // setIsFocused(false);
1109
+ // if (rest.onBlur) rest.onBlur(e);
1110
+ // };
1111
+ // const showPlaceholder = placeholder && label && (isFocused || !!inputValue);
1112
+ // const inputElement = (
1113
+ // <input
1114
+ // ref={inputRef}
1115
+ // id={id}
1116
+ // name={name}
1117
+ // className={className}
1118
+ // onChange={handleChange}
1119
+ // onFocus={handleFocus}
1120
+ // onBlur={handleBlur}
1121
+ // defaultValue={defaultValue}
1122
+ // type={type}
1123
+ // placeholder={showPlaceholder ? placeholder : (!label ? placeholder : '')}
1124
+ // style={style}
1125
+ // value={inputValue}
1126
+ // {...rest}
1127
+ // />
1128
+ // );
1129
+ // // Only use iconic wrapper when we have icons, matching Button's pattern
1130
+ // const wrappedInput = showPrefix || showSuffix ? (
1131
+ // <IconicInputWrapper
1132
+ // startIcon={effectivePrefix}
1133
+ // endIcon={effectiveSuffix}
1134
+ // iconicBg={final.iconicBg}
1135
+ // funcss={final.funcss}
1136
+ // stringPrefix={stringPrefix}
1137
+ // stringSuffix={stringSuffix}
1138
+ // >
1139
+ // {inputElement}
1140
+ // </IconicInputWrapper>
1141
+ // ) : (
1142
+ // inputElement
1143
+ // );
1144
+ // return (
1145
+ // <InputContainer
1146
+ // startIcon={effectivePrefix}
1147
+ // label={label}
1148
+ // status={final.status}
1149
+ // helperText={helperText}
1150
+ // isFocused={isFocused}
1151
+ // hasValue={!!inputValue}
1152
+ // fullWidth={final.fullWidth}
1153
+ // id={id}
1154
+ // alwaysActiveLabel={isDateTimeInput}
1155
+ // >
1156
+ // {wrappedInput}
1157
+ // </InputContainer>
1158
+ // );
1159
+ // };
1160
+ // // Select Component - UPDATED to match pattern
1161
+ // export const SelectInput: React.FC<SelectProps & React.SelectHTMLAttributes<HTMLSelectElement>> = ({
1162
+ // id,
1163
+ // name,
1164
+ // value,
1165
+ // defaultValue,
1166
+ // onChange,
1167
+ // status,
1168
+ // funcss,
1169
+ // bg,
1170
+ // fullWidth,
1171
+ // flat,
1172
+ // bordered,
1173
+ // borderless,
1174
+ // rounded,
1175
+ // leftRounded,
1176
+ // rightRounded,
1177
+ // startIcon,
1178
+ // endIcon,
1179
+ // prefix,
1180
+ // suffix,
1181
+ // stringPrefix,
1182
+ // stringSuffix,
1183
+ // iconicBg,
1184
+ // options = [],
1185
+ // label,
1186
+ // helperText,
1187
+ // variant = '',
1188
+ // ...rest
1189
+ // }) => {
1190
+ // const [isFocused, setIsFocused] = useState(false);
1191
+ // const [selectValue, setSelectValue] = useState<string>(value !== undefined ? String(value) : defaultValue || '');
1192
+ // const [prefixNode, setPrefixNode] = useState<React.ReactNode>(null);
1193
+ // const [suffixNode, setSuffixNode] = useState<React.ReactNode>(null);
1194
+ // const [hasValidStringPrefix, setHasValidStringPrefix] = useState(false);
1195
+ // const [hasValidStringSuffix, setHasValidStringSuffix] = useState(false);
1196
+ // useEffect(() => {
1197
+ // if (value !== undefined && value !== '') {
1198
+ // setSelectValue(String(value));
1199
+ // } else if (value === '') {
1200
+ // setSelectValue('');
1201
+ // }
1202
+ // }, [value]);
1203
+ // const { mergeWithLocal } = useComponentConfiguration('Input', variant);
1204
+ // const localProps = {
1205
+ // status,
1206
+ // funcss,
1207
+ // bg,
1208
+ // fullWidth,
1209
+ // flat,
1210
+ // bordered,
1211
+ // borderless,
1212
+ // rounded,
1213
+ // leftRounded,
1214
+ // rightRounded,
1215
+ // startIcon,
1216
+ // endIcon,
1217
+ // prefix,
1218
+ // suffix,
1219
+ // iconicBg,
1220
+ // stringPrefix,
1221
+ // stringSuffix,
1222
+ // };
1223
+ // const { props: mergedProps } = mergeWithLocal(localProps);
1224
+ // const final = {
1225
+ // status: status !== undefined ? status : mergedProps.status,
1226
+ // funcss: funcss !== undefined ? funcss : mergedProps.funcss,
1227
+ // bg: bg !== undefined ? bg : mergedProps.bg,
1228
+ // fullWidth: fullWidth !== undefined ? fullWidth : mergedProps.fullWidth,
1229
+ // flat: flat !== undefined ? flat : mergedProps.flat,
1230
+ // bordered: bordered !== undefined ? bordered : mergedProps.bordered,
1231
+ // borderless: borderless !== undefined ? borderless : mergedProps.borderless,
1232
+ // rounded: rounded !== undefined ? rounded : mergedProps.rounded,
1233
+ // leftRounded: leftRounded !== undefined ? leftRounded : mergedProps.leftRounded,
1234
+ // rightRounded: rightRounded !== undefined ? rightRounded : mergedProps.rightRounded,
1235
+ // startIcon: startIcon !== undefined ? startIcon : mergedProps.startIcon,
1236
+ // endIcon: endIcon !== undefined ? endIcon : mergedProps.endIcon,
1237
+ // prefix: prefix !== undefined ? prefix : mergedProps.prefix,
1238
+ // suffix: suffix !== undefined ? suffix : mergedProps.suffix,
1239
+ // iconicBg: iconicBg !== undefined ? iconicBg : mergedProps.iconicBg,
1240
+ // stringPrefix: stringPrefix !== undefined ? stringPrefix : mergedProps.stringPrefix,
1241
+ // stringSuffix: stringSuffix !== undefined ? stringSuffix : mergedProps.stringSuffix,
1242
+ // };
1243
+ // // Handle stringPrefix - MATCH BUTTON'S PATTERN EXACTLY
1244
+ // useEffect(() => {
1245
+ // const effectiveStringPrefix = final.stringPrefix;
1246
+ // if (!effectiveStringPrefix || effectiveStringPrefix.trim() === '') {
1247
+ // setPrefixNode(null);
1248
+ // setHasValidStringPrefix(false);
1249
+ // return;
1250
+ // }
1251
+ // getDynamicIcon(effectiveStringPrefix).then((node) => {
1252
+ // if (node) {
1253
+ // setPrefixNode(node);
1254
+ // setHasValidStringPrefix(true);
1255
+ // } else {
1256
+ // setPrefixNode(null);
1257
+ // setHasValidStringPrefix(false);
1258
+ // }
1259
+ // });
1260
+ // }, [final.stringPrefix]);
1261
+ // // Handle stringSuffix - MATCH BUTTON'S PATTERN EXACTLY
1262
+ // useEffect(() => {
1263
+ // const effectiveStringSuffix = final.stringSuffix;
1264
+ // if (!effectiveStringSuffix || effectiveStringSuffix.trim() === '') {
1265
+ // setSuffixNode(null);
1266
+ // setHasValidStringSuffix(false);
1267
+ // return;
1268
+ // }
1269
+ // getDynamicIcon(effectiveStringSuffix).then((node) => {
1270
+ // if (node) {
1271
+ // setSuffixNode(node);
1272
+ // setHasValidStringSuffix(true);
1273
+ // } else {
1274
+ // setSuffixNode(null);
1275
+ // setHasValidStringSuffix(false);
1276
+ // }
1277
+ // });
1278
+ // }, [final.stringSuffix]);
1279
+ // const selectHasValue = !!selectValue;
1280
+ // const { variant: themeVariant } = useVariant();
1281
+ // // Determine which prefix to show with proper priority - MATCH BUTTON'S PATTERN
1282
+ // const showPrefix = React.useMemo(() => {
1283
+ // // Priority order: startIcon (local) > prefix (local) > stringPrefix (dynamic)
1284
+ // if (final.startIcon) return true;
1285
+ // if (final.prefix) return true;
1286
+ // if (hasValidStringPrefix && prefixNode) return true;
1287
+ // return false;
1288
+ // }, [final.startIcon, final.prefix, hasValidStringPrefix, prefixNode]);
1289
+ // // Determine which suffix to show with proper priority - MATCH BUTTON'S PATTERN
1290
+ // const showSuffix = React.useMemo(() => {
1291
+ // // Priority order: endIcon (local) > suffix (local) > stringSuffix (dynamic)
1292
+ // if (final.endIcon) return true;
1293
+ // if (final.suffix) return true;
1294
+ // if (hasValidStringSuffix && suffixNode) return true;
1295
+ // return false;
1296
+ // }, [final.endIcon, final.suffix, hasValidStringSuffix, suffixNode]);
1297
+ // // Get effective icons following Button's priority pattern
1298
+ // const effectivePrefix = React.useMemo(() => {
1299
+ // // Priority: startIcon > prefix > stringPrefix
1300
+ // if (final.startIcon) return final.startIcon;
1301
+ // if (final.prefix) return final.prefix;
1302
+ // if (hasValidStringPrefix) return prefixNode;
1303
+ // return null;
1304
+ // }, [final.startIcon, final.prefix, hasValidStringPrefix, prefixNode]);
1305
+ // const effectiveSuffix = React.useMemo(() => {
1306
+ // // Priority: endIcon > suffix > stringSuffix
1307
+ // if (final.endIcon) return final.endIcon;
1308
+ // if (final.suffix) return final.suffix;
1309
+ // if (hasValidStringSuffix) return suffixNode;
1310
+ // return null;
1311
+ // }, [final.endIcon, final.suffix, hasValidStringSuffix, suffixNode]);
1312
+ // const hasNoPrefix = !effectivePrefix;
1313
+ // const hasNoLabel = !label;
1314
+ // const className = generateInputClasses({
1315
+ // status: final.status,
1316
+ // rounded: final.rounded,
1317
+ // bg: final.bg,
1318
+ // funcss: final.funcss,
1319
+ // flat: final.flat,
1320
+ // leftRounded: final.leftRounded,
1321
+ // rightRounded: final.rightRounded,
1322
+ // bordered: final.bordered,
1323
+ // borderless: final.borderless,
1324
+ // hasNoPrefix,
1325
+ // hasNoLabel,
1326
+ // });
1327
+ // const style = final.fullWidth ? { width: '100%' } : undefined;
1328
+ // const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
1329
+ // const newValue = e.target.value;
1330
+ // setSelectValue(newValue);
1331
+ // if (onChange) onChange(e);
1332
+ // };
1333
+ // const handleFocus = (e: React.FocusEvent<HTMLSelectElement>) => {
1334
+ // setIsFocused(true);
1335
+ // if (rest.onFocus) rest.onFocus(e);
1336
+ // };
1337
+ // const handleBlur = (e: React.FocusEvent<HTMLSelectElement>) => {
1338
+ // setIsFocused(false);
1339
+ // if (rest.onBlur) rest.onBlur(e);
1340
+ // };
1341
+ // const selectElement = (
1342
+ // <select
1343
+ // id={id}
1344
+ // name={name}
1345
+ // className={className}
1346
+ // onChange={handleChange}
1347
+ // onFocus={handleFocus}
1348
+ // onBlur={handleBlur}
1349
+ // defaultValue={defaultValue}
1350
+ // value={selectValue}
1351
+ // style={style}
1352
+ // {...rest}
1353
+ // >
1354
+ // {options.map((option) => (
1355
+ // <option key={option.value} value={option.value}>
1356
+ // {option.text}
1357
+ // </option>
1358
+ // ))}
1359
+ // </select>
1360
+ // );
1361
+ // // Only use iconic wrapper when we have icons, matching Button's pattern
1362
+ // const wrappedSelect = showPrefix || showSuffix ? (
1363
+ // <IconicInputWrapper
1364
+ // startIcon={effectivePrefix}
1365
+ // endIcon={effectiveSuffix}
1366
+ // iconicBg={final.iconicBg}
1367
+ // funcss={final.funcss}
1368
+ // stringPrefix={stringPrefix}
1369
+ // stringSuffix={stringSuffix}
1370
+ // >
1371
+ // {selectElement}
1372
+ // </IconicInputWrapper>
1373
+ // ) : (
1374
+ // selectElement
1375
+ // );
1376
+ // return (
1377
+ // <InputContainer
1378
+ // startIcon={effectivePrefix}
1379
+ // label={label}
1380
+ // status={final.status}
1381
+ // helperText={helperText}
1382
+ // isFocused={isFocused}
1383
+ // hasValue={selectHasValue}
1384
+ // fullWidth={final.fullWidth}
1385
+ // id={id}
1386
+ // alwaysActiveLabel={true}
1387
+ // >
1388
+ // {wrappedSelect}
1389
+ // </InputContainer>
1390
+ // );
1391
+ // };
1392
+ // // Textarea Component - UPDATED to match pattern
1393
+ // export const TextareaInput: React.FC<TextareaProps & React.TextareaHTMLAttributes<HTMLTextAreaElement>> = ({
1394
+ // id,
1395
+ // name,
1396
+ // value,
1397
+ // defaultValue,
1398
+ // onChange,
1399
+ // status,
1400
+ // funcss,
1401
+ // bg,
1402
+ // fullWidth,
1403
+ // flat,
1404
+ // bordered,
1405
+ // borderless,
1406
+ // rounded,
1407
+ // leftRounded,
1408
+ // rightRounded,
1409
+ // startIcon,
1410
+ // endIcon,
1411
+ // prefix,
1412
+ // suffix,
1413
+ // stringPrefix,
1414
+ // stringSuffix,
1415
+ // iconicBg,
1416
+ // label,
1417
+ // helperText,
1418
+ // rows = 2,
1419
+ // variant = '',
1420
+ // placeholder,
1421
+ // ...rest
1422
+ // }) => {
1423
+ // const [isFocused, setIsFocused] = useState(false);
1424
+ // const [textValue, setTextValue] = useState<string>(value !== undefined ? String(value) : defaultValue || '');
1425
+ // const [prefixNode, setPrefixNode] = useState<React.ReactNode>(null);
1426
+ // const [suffixNode, setSuffixNode] = useState<React.ReactNode>(null);
1427
+ // const [hasValidStringPrefix, setHasValidStringPrefix] = useState(false);
1428
+ // const [hasValidStringSuffix, setHasValidStringSuffix] = useState(false);
1429
+ // useEffect(() => {
1430
+ // if (value !== undefined && value !== '') {
1431
+ // setTextValue(String(value));
1432
+ // } else if (value === '') {
1433
+ // setTextValue('');
1434
+ // }
1435
+ // }, [value]);
1436
+ // const { mergeWithLocal } = useComponentConfiguration('Input', variant);
1437
+ // const localProps = {
1438
+ // status,
1439
+ // funcss,
1440
+ // bg,
1441
+ // fullWidth,
1442
+ // flat,
1443
+ // bordered,
1444
+ // borderless,
1445
+ // rounded,
1446
+ // leftRounded,
1447
+ // rightRounded,
1448
+ // startIcon,
1449
+ // endIcon,
1450
+ // prefix,
1451
+ // suffix,
1452
+ // iconicBg,
1453
+ // stringPrefix,
1454
+ // stringSuffix,
1455
+ // };
1456
+ // const { props: mergedProps } = mergeWithLocal(localProps);
1457
+ // const final = {
1458
+ // status: status !== undefined ? status : mergedProps.status,
1459
+ // funcss: funcss !== undefined ? funcss : mergedProps.funcss,
1460
+ // bg: bg !== undefined ? bg : mergedProps.bg,
1461
+ // fullWidth: fullWidth !== undefined ? fullWidth : mergedProps.fullWidth,
1462
+ // flat: flat !== undefined ? flat : mergedProps.flat,
1463
+ // bordered: bordered !== undefined ? bordered : mergedProps.bordered,
1464
+ // borderless: borderless !== undefined ? borderless : mergedProps.borderless,
1465
+ // rounded: rounded !== undefined ? rounded : mergedProps.rounded,
1466
+ // leftRounded: leftRounded !== undefined ? leftRounded : mergedProps.leftRounded,
1467
+ // rightRounded: rightRounded !== undefined ? rightRounded : mergedProps.rightRounded,
1468
+ // startIcon: startIcon !== undefined ? startIcon : mergedProps.startIcon,
1469
+ // endIcon: endIcon !== undefined ? endIcon : mergedProps.endIcon,
1470
+ // prefix: prefix !== undefined ? prefix : mergedProps.prefix,
1471
+ // suffix: suffix !== undefined ? suffix : mergedProps.suffix,
1472
+ // iconicBg: iconicBg !== undefined ? iconicBg : mergedProps.iconicBg,
1473
+ // stringPrefix: stringPrefix !== undefined ? stringPrefix : mergedProps.stringPrefix,
1474
+ // stringSuffix: stringSuffix !== undefined ? stringSuffix : mergedProps.stringSuffix,
1475
+ // };
1476
+ // // Handle stringPrefix - MATCH BUTTON'S PATTERN EXACTLY
1477
+ // useEffect(() => {
1478
+ // const effectiveStringPrefix = final.stringPrefix;
1479
+ // if (!effectiveStringPrefix || effectiveStringPrefix.trim() === '') {
1480
+ // setPrefixNode(null);
1481
+ // setHasValidStringPrefix(false);
1482
+ // return;
1483
+ // }
1484
+ // getDynamicIcon(effectiveStringPrefix).then((node) => {
1485
+ // if (node) {
1486
+ // setPrefixNode(node);
1487
+ // setHasValidStringPrefix(true);
1488
+ // } else {
1489
+ // setPrefixNode(null);
1490
+ // setHasValidStringPrefix(false);
1491
+ // }
1492
+ // });
1493
+ // }, [final.stringPrefix]);
1494
+ // // Handle stringSuffix - MATCH BUTTON'S PATTERN EXACTLY
1495
+ // useEffect(() => {
1496
+ // const effectiveStringSuffix = final.stringSuffix;
1497
+ // if (!effectiveStringSuffix || effectiveStringSuffix.trim() === '') {
1498
+ // setSuffixNode(null);
1499
+ // setHasValidStringSuffix(false);
1500
+ // return;
1501
+ // }
1502
+ // getDynamicIcon(effectiveStringSuffix).then((node) => {
1503
+ // if (node) {
1504
+ // setSuffixNode(node);
1505
+ // setHasValidStringSuffix(true);
1506
+ // } else {
1507
+ // setSuffixNode(null);
1508
+ // setHasValidStringSuffix(false);
1509
+ // }
1510
+ // });
1511
+ // }, [final.stringSuffix]);
1512
+ // const { variant: themeVariant } = useVariant();
1513
+ // // Determine which prefix to show with proper priority - MATCH BUTTON'S PATTERN
1514
+ // const showPrefix = React.useMemo(() => {
1515
+ // // Priority order: startIcon (local) > prefix (local) > stringPrefix (dynamic)
1516
+ // if (final.startIcon) return true;
1517
+ // if (final.prefix) return true;
1518
+ // if (hasValidStringPrefix && prefixNode) return true;
1519
+ // return false;
1520
+ // }, [final.startIcon, final.prefix, hasValidStringPrefix, prefixNode]);
1521
+ // // Determine which suffix to show with proper priority - MATCH BUTTON'S PATTERN
1522
+ // const showSuffix = React.useMemo(() => {
1523
+ // // Priority order: endIcon (local) > suffix (local) > stringSuffix (dynamic)
1524
+ // if (final.endIcon) return true;
1525
+ // if (final.suffix) return true;
1526
+ // if (hasValidStringSuffix && suffixNode) return true;
1527
+ // return false;
1528
+ // }, [final.endIcon, final.suffix, hasValidStringSuffix, suffixNode]);
1529
+ // // Get effective icons following Button's priority pattern
1530
+ // const effectivePrefix = React.useMemo(() => {
1531
+ // // Priority: startIcon > prefix > stringPrefix
1532
+ // if (final.startIcon) return final.startIcon;
1533
+ // if (final.prefix) return final.prefix;
1534
+ // if (hasValidStringPrefix) return prefixNode;
1535
+ // return null;
1536
+ // }, [final.startIcon, final.prefix, hasValidStringPrefix, prefixNode]);
1537
+ // const effectiveSuffix = React.useMemo(() => {
1538
+ // // Priority: endIcon > suffix > stringSuffix
1539
+ // if (final.endIcon) return final.endIcon;
1540
+ // if (final.suffix) return final.suffix;
1541
+ // if (hasValidStringSuffix) return suffixNode;
1542
+ // return null;
1543
+ // }, [final.endIcon, final.suffix, hasValidStringSuffix, suffixNode]);
1544
+ // const hasNoPrefix = !effectivePrefix;
1545
+ // const hasNoLabel = !label;
1546
+ // const className = generateInputClasses({
1547
+ // status: final.status,
1548
+ // rounded: final.rounded,
1549
+ // bg: final.bg,
1550
+ // funcss: final.funcss,
1551
+ // flat: final.flat,
1552
+ // leftRounded: final.leftRounded,
1553
+ // rightRounded: final.rightRounded,
1554
+ // bordered: final.bordered,
1555
+ // borderless: final.borderless,
1556
+ // hasNoPrefix,
1557
+ // hasNoLabel,
1558
+ // });
1559
+ // const style = final.fullWidth ? { width: '100%' } : undefined;
1560
+ // const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
1561
+ // const newValue = e.target.value;
1562
+ // setTextValue(newValue);
1563
+ // if (onChange) onChange(e);
1564
+ // };
1565
+ // const handleFocus = (e: React.FocusEvent<HTMLTextAreaElement>) => {
1566
+ // setIsFocused(true);
1567
+ // if (rest.onFocus) rest.onFocus(e);
1568
+ // };
1569
+ // const handleBlur = (e: React.FocusEvent<HTMLTextAreaElement>) => {
1570
+ // setIsFocused(false);
1571
+ // if (rest.onBlur) rest.onBlur(e);
1572
+ // };
1573
+ // const showPlaceholder = placeholder && label && (isFocused || !!textValue);
1574
+ // const textareaElement = (
1575
+ // <textarea
1576
+ // id={id}
1577
+ // name={name}
1578
+ // className={className}
1579
+ // onChange={handleChange}
1580
+ // onFocus={handleFocus}
1581
+ // onBlur={handleBlur}
1582
+ // defaultValue={defaultValue}
1583
+ // placeholder={showPlaceholder ? placeholder : (!label ? placeholder : '')}
1584
+ // style={style}
1585
+ // value={textValue}
1586
+ // rows={rows}
1587
+ // {...rest}
1588
+ // />
1589
+ // );
1590
+ // // Only use iconic wrapper when we have icons, matching Button's pattern
1591
+ // const wrappedTextarea = showPrefix || showSuffix ? (
1592
+ // <IconicInputWrapper
1593
+ // startIcon={effectivePrefix}
1594
+ // endIcon={effectiveSuffix}
1595
+ // iconicBg={final.iconicBg}
1596
+ // funcss={final.funcss}
1597
+ // stringPrefix={stringPrefix}
1598
+ // stringSuffix={stringSuffix}
1599
+ // >
1600
+ // {textareaElement}
1601
+ // </IconicInputWrapper>
1602
+ // ) : (
1603
+ // textareaElement
1604
+ // );
1605
+ // return (
1606
+ // <InputContainer
1607
+ // startIcon={effectivePrefix}
1608
+ // label={label}
1609
+ // status={final.status}
1610
+ // helperText={helperText}
1611
+ // isFocused={isFocused}
1612
+ // hasValue={!!textValue}
1613
+ // fullWidth={final.fullWidth}
1614
+ // id={id}
1615
+ // >
1616
+ // {wrappedTextarea}
1617
+ // </InputContainer>
1618
+ // );
1619
+ // };
1620
+ // // Main Input Component (backwards compatibility)
1621
+ // interface InputProps extends BaseInputProps {
1622
+ // select?: boolean;
1623
+ // multiline?: boolean;
1624
+ // file?: boolean;
1625
+ // noBorder?: boolean;
1626
+ // icon?: React.ReactNode;
1627
+ // extra?: React.ReactNode;
1628
+ // button?: React.ReactNode;
1629
+ // btn?: boolean;
1630
+ // type?: string;
1631
+ // options?: SelectOption[];
1632
+ // rows?: number;
1633
+ // }
1634
+ // const Input: React.FC<InputProps> = ({
1635
+ // select,
1636
+ // multiline,
1637
+ // file,
1638
+ // noBorder,
1639
+ // startIcon,
1640
+ // endIcon,
1641
+ // prefix,
1642
+ // suffix,
1643
+ // stringPrefix,
1644
+ // stringSuffix,
1645
+ // iconicBg,
1646
+ // type,
1647
+ // variant = '',
1648
+ // ...props
1649
+ // }) => {
1650
+ // const { mergeWithLocal } = useComponentConfiguration('Input', variant);
1651
+ // const localProps = {
1652
+ // ...props,
1653
+ // startIcon,
1654
+ // endIcon,
1655
+ // prefix,
1656
+ // suffix,
1657
+ // iconicBg,
1658
+ // stringPrefix,
1659
+ // stringSuffix,
1660
+ // type,
1661
+ // };
1662
+ // const { props: mergedProps } = mergeWithLocal(localProps);
1663
+ // const inputProps = {
1664
+ // ...props,
1665
+ // ...mergedProps,
1666
+ // variant,
1667
+ // borderless: noBorder !== undefined ? noBorder : (props.borderless !== undefined ? props.borderless : mergedProps.borderless),
1668
+ // type,
1669
+ // };
1670
+ // if (file || type === 'file') {
1671
+ // return <FileUpload {...inputProps} />;
1672
+ // }
1673
+ // if (select) {
1674
+ // return <SelectInput {...inputProps} />;
1675
+ // }
1676
+ // if (multiline) {
1677
+ // return <TextareaInput {...inputProps} />;
1678
+ // }
1679
+ // return <TextInput {...inputProps} />;
1680
+ // };
1681
+ // export default Input;