funuicss 3.6.17 → 3.6.19

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
@@ -114,37 +114,25 @@ 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, 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"]);
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, 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"]);
118
118
  var _e = (0, react_1.useState)(false), isFocused = _e[0], setIsFocused = _e[1];
119
- var _f = (0, react_1.useState)(value || defaultValue || ''), inputValue = _f[0], setInputValue = _f[1];
119
+ var _f = (0, react_1.useState)(value !== undefined ? String(value) : defaultValue || ''), inputValue = _f[0], setInputValue = _f[1];
120
120
  var _g = (0, react_1.useState)(null), prefixNode = _g[0], setPrefixNode = _g[1];
121
121
  var _h = (0, react_1.useState)(null), suffixNode = _h[0], setSuffixNode = _h[1];
122
122
  var inputRef = (0, react_1.useRef)(null);
123
+ // Handle value changes - only update if value is truly defined (not empty string)
123
124
  (0, react_1.useEffect)(function () {
124
- if (value !== undefined) {
125
- setInputValue(value);
125
+ if (value !== undefined && value !== '') {
126
+ setInputValue(String(value));
126
127
  }
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);
128
+ else if (value === '') {
129
+ // Allow empty string to clear the input
130
+ setInputValue('');
144
131
  }
145
- }, [stringSuffix]);
132
+ }, [value]);
146
133
  var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
147
- var mergedProps = mergeWithLocal({
134
+ // Create local props object including stringPrefix/stringSuffix
135
+ var localProps = {
148
136
  status: status,
149
137
  funcss: funcss,
150
138
  bg: bg,
@@ -160,22 +148,67 @@ var TextInput = function (_a) {
160
148
  prefix: prefix,
161
149
  suffix: suffix,
162
150
  iconicBg: iconicBg,
163
- }).props;
151
+ stringPrefix: stringPrefix, // Include in local props
152
+ stringSuffix: stringSuffix,
153
+ };
154
+ // Merge with config - LOCAL PROPS OVERRIDE CONFIG
155
+ var mergedProps = mergeWithLocal(localProps).props;
156
+ // Extract final values - local props take precedence, but handle empty strings properly
157
+ var final = {
158
+ status: status !== undefined ? status : mergedProps.status,
159
+ funcss: funcss !== undefined ? funcss : mergedProps.funcss,
160
+ bg: bg !== undefined ? bg : mergedProps.bg,
161
+ fullWidth: fullWidth !== undefined ? fullWidth : mergedProps.fullWidth,
162
+ flat: flat !== undefined ? flat : mergedProps.flat,
163
+ bordered: bordered !== undefined ? bordered : mergedProps.bordered,
164
+ borderless: borderless !== undefined ? borderless : mergedProps.borderless,
165
+ rounded: rounded !== undefined ? rounded : mergedProps.rounded,
166
+ leftRounded: leftRounded !== undefined ? leftRounded : mergedProps.leftRounded,
167
+ rightRounded: rightRounded !== undefined ? rightRounded : mergedProps.rightRounded,
168
+ startIcon: startIcon !== undefined ? startIcon : mergedProps.startIcon,
169
+ endIcon: endIcon !== undefined ? endIcon : mergedProps.endIcon,
170
+ prefix: prefix !== undefined ? prefix : mergedProps.prefix,
171
+ suffix: suffix !== undefined ? suffix : mergedProps.suffix,
172
+ iconicBg: iconicBg !== undefined ? iconicBg : mergedProps.iconicBg,
173
+ stringPrefix: stringPrefix !== undefined ? stringPrefix : mergedProps.stringPrefix, // Handle both local and config
174
+ stringSuffix: stringSuffix !== undefined ? stringSuffix : mergedProps.stringSuffix, // Handle both local and config
175
+ };
176
+ // Handle stringPrefix - use final value (local or config)
177
+ (0, react_1.useEffect)(function () {
178
+ var effectiveStringPrefix = final.stringPrefix;
179
+ if (effectiveStringPrefix) {
180
+ (0, getDynamicIcon_1.getDynamicIcon)(effectiveStringPrefix).then(function (node) { return setPrefixNode(node); });
181
+ }
182
+ else {
183
+ setPrefixNode(null);
184
+ }
185
+ }, [final.stringPrefix]);
186
+ // Handle stringSuffix - use final value (local or config)
187
+ (0, react_1.useEffect)(function () {
188
+ var effectiveStringSuffix = final.stringSuffix;
189
+ if (effectiveStringSuffix) {
190
+ (0, getDynamicIcon_1.getDynamicIcon)(effectiveStringSuffix).then(function (node) { return setSuffixNode(node); });
191
+ }
192
+ else {
193
+ setSuffixNode(null);
194
+ }
195
+ }, [final.stringSuffix]);
164
196
  var themeVariant = (0, theme_1.useVariant)().variant;
165
197
  var className = generateInputClasses({
166
- status: mergedProps.status,
167
- rounded: mergedProps.rounded,
168
- bg: mergedProps.bg,
169
- funcss: mergedProps.funcss,
170
- flat: mergedProps.flat,
171
- leftRounded: mergedProps.leftRounded,
172
- rightRounded: mergedProps.rightRounded,
173
- bordered: mergedProps.bordered,
174
- borderless: mergedProps.borderless,
198
+ status: final.status,
199
+ rounded: final.rounded,
200
+ bg: final.bg,
201
+ funcss: final.funcss,
202
+ flat: final.flat,
203
+ leftRounded: final.leftRounded,
204
+ rightRounded: final.rightRounded,
205
+ bordered: final.bordered,
206
+ borderless: final.borderless,
175
207
  });
176
- var style = mergedProps.fullWidth ? { width: '100%' } : undefined;
208
+ var style = final.fullWidth ? { width: '100%' } : undefined;
177
209
  var handleChange = function (e) {
178
- setInputValue(e.target.value);
210
+ var newValue = e.target.value;
211
+ setInputValue(newValue);
179
212
  if (onChange)
180
213
  onChange(e);
181
214
  };
@@ -189,47 +222,36 @@ var TextInput = function (_a) {
189
222
  if (rest.onBlur)
190
223
  rest.onBlur(e);
191
224
  };
192
- // Determine effective icons: stringPrefix/stringSuffix take priority
193
- var effectivePrefix = prefixNode || mergedProps.prefix || mergedProps.startIcon;
194
- var effectiveSuffix = suffixNode || mergedProps.suffix || mergedProps.endIcon;
195
- var inputElement = (react_1.default.createElement("input", __assign({ ref: inputRef, id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, defaultValue: defaultValue, type: type, placeholder: !label ? rest.placeholder : '', style: style, value: value }, rest)));
196
- var wrappedInput = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, inputElement));
197
- return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: mergedProps.status, helperText: helperText, isFocused: isFocused, hasValue: !!inputValue, fullWidth: mergedProps.fullWidth, id: id }, wrappedInput));
225
+ // Determine effective icons: stringPrefix/stringSuffix take priority, then local, then config
226
+ var effectivePrefix = prefixNode || final.prefix || final.startIcon;
227
+ var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
228
+ // Show placeholder only when label is active (focused or has value)
229
+ var showPlaceholder = placeholder && label && (isFocused || !!inputValue);
230
+ 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)));
231
+ var wrappedInput = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: final.iconicBg, funcss: final.funcss }, inputElement));
232
+ return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: final.status, helperText: helperText, isFocused: isFocused, hasValue: !!inputValue, fullWidth: final.fullWidth, id: id }, wrappedInput));
198
233
  };
199
234
  exports.TextInput = TextInput;
200
235
  // Select Component
201
236
  var SelectInput = function (_a) {
202
237
  var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, status = _a.status, funcss = _a.funcss, bg = _a.bg, fullWidth = _a.fullWidth, flat = _a.flat, bordered = _a.bordered, borderless = _a.borderless, rounded = _a.rounded, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, startIcon = _a.startIcon, endIcon = _a.endIcon, prefix = _a.prefix, suffix = _a.suffix, stringPrefix = _a.stringPrefix, stringSuffix = _a.stringSuffix, iconicBg = _a.iconicBg, _b = _a.options, options = _b === void 0 ? [] : _b, label = _a.label, helperText = _a.helperText, _c = _a.variant, variant = _c === void 0 ? '' : _c, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "prefix", "suffix", "stringPrefix", "stringSuffix", "iconicBg", "options", "label", "helperText", "variant"]);
203
238
  var _d = (0, react_1.useState)(false), isFocused = _d[0], setIsFocused = _d[1];
204
- var _e = (0, react_1.useState)(value || defaultValue || ''), selectValue = _e[0], setSelectValue = _e[1];
239
+ var _e = (0, react_1.useState)(value !== undefined ? String(value) : defaultValue || ''), selectValue = _e[0], setSelectValue = _e[1];
205
240
  var _f = (0, react_1.useState)(null), prefixNode = _f[0], setPrefixNode = _f[1];
206
241
  var _g = (0, react_1.useState)(null), suffixNode = _g[0], setSuffixNode = _g[1];
242
+ // Handle value changes - only update if value is truly defined (not empty string)
207
243
  (0, react_1.useEffect)(function () {
208
- if (value !== undefined) {
209
- setSelectValue(value);
244
+ if (value !== undefined && value !== '') {
245
+ setSelectValue(String(value));
210
246
  }
211
- }, [value]);
212
- // Handle stringPrefix
213
- (0, react_1.useEffect)(function () {
214
- if (stringPrefix) {
215
- (0, getDynamicIcon_1.getDynamicIcon)(stringPrefix).then(function (node) { return setPrefixNode(node); });
216
- }
217
- else {
218
- setPrefixNode(null);
219
- }
220
- }, [stringPrefix]);
221
- // Handle stringSuffix
222
- (0, react_1.useEffect)(function () {
223
- if (stringSuffix) {
224
- (0, getDynamicIcon_1.getDynamicIcon)(stringSuffix).then(function (node) { return setSuffixNode(node); });
225
- }
226
- else {
227
- setSuffixNode(null);
247
+ else if (value === '') {
248
+ // Allow empty string to clear the select
249
+ setSelectValue('');
228
250
  }
229
- }, [stringSuffix]);
230
- var selectHasValue = true;
251
+ }, [value]);
231
252
  var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
232
- var mergedProps = mergeWithLocal({
253
+ // Create local props object including stringPrefix/stringSuffix
254
+ var localProps = {
233
255
  status: status,
234
256
  funcss: funcss,
235
257
  bg: bg,
@@ -245,22 +267,68 @@ var SelectInput = function (_a) {
245
267
  prefix: prefix,
246
268
  suffix: suffix,
247
269
  iconicBg: iconicBg,
248
- }).props;
270
+ stringPrefix: stringPrefix, // Include in local props
271
+ stringSuffix: stringSuffix,
272
+ };
273
+ // Merge with config - LOCAL PROPS OVERRIDE CONFIG
274
+ var mergedProps = mergeWithLocal(localProps).props;
275
+ // Extract final values - local props take precedence, but handle empty strings properly
276
+ var final = {
277
+ status: status !== undefined ? status : mergedProps.status,
278
+ funcss: funcss !== undefined ? funcss : mergedProps.funcss,
279
+ bg: bg !== undefined ? bg : mergedProps.bg,
280
+ fullWidth: fullWidth !== undefined ? fullWidth : mergedProps.fullWidth,
281
+ flat: flat !== undefined ? flat : mergedProps.flat,
282
+ bordered: bordered !== undefined ? bordered : mergedProps.bordered,
283
+ borderless: borderless !== undefined ? borderless : mergedProps.borderless,
284
+ rounded: rounded !== undefined ? rounded : mergedProps.rounded,
285
+ leftRounded: leftRounded !== undefined ? leftRounded : mergedProps.leftRounded,
286
+ rightRounded: rightRounded !== undefined ? rightRounded : mergedProps.rightRounded,
287
+ startIcon: startIcon !== undefined ? startIcon : mergedProps.startIcon,
288
+ endIcon: endIcon !== undefined ? endIcon : mergedProps.endIcon,
289
+ prefix: prefix !== undefined ? prefix : mergedProps.prefix,
290
+ suffix: suffix !== undefined ? suffix : mergedProps.suffix,
291
+ iconicBg: iconicBg !== undefined ? iconicBg : mergedProps.iconicBg,
292
+ stringPrefix: stringPrefix !== undefined ? stringPrefix : mergedProps.stringPrefix, // Handle both local and config
293
+ stringSuffix: stringSuffix !== undefined ? stringSuffix : mergedProps.stringSuffix, // Handle both local and config
294
+ };
295
+ // Handle stringPrefix - use final value (local or config)
296
+ (0, react_1.useEffect)(function () {
297
+ var effectiveStringPrefix = final.stringPrefix;
298
+ if (effectiveStringPrefix) {
299
+ (0, getDynamicIcon_1.getDynamicIcon)(effectiveStringPrefix).then(function (node) { return setPrefixNode(node); });
300
+ }
301
+ else {
302
+ setPrefixNode(null);
303
+ }
304
+ }, [final.stringPrefix]);
305
+ // Handle stringSuffix - use final value (local or config)
306
+ (0, react_1.useEffect)(function () {
307
+ var effectiveStringSuffix = final.stringSuffix;
308
+ if (effectiveStringSuffix) {
309
+ (0, getDynamicIcon_1.getDynamicIcon)(effectiveStringSuffix).then(function (node) { return setSuffixNode(node); });
310
+ }
311
+ else {
312
+ setSuffixNode(null);
313
+ }
314
+ }, [final.stringSuffix]);
315
+ var selectHasValue = !!selectValue;
249
316
  var themeVariant = (0, theme_1.useVariant)().variant;
250
317
  var className = generateInputClasses({
251
- status: mergedProps.status,
252
- rounded: mergedProps.rounded,
253
- bg: mergedProps.bg,
254
- funcss: mergedProps.funcss,
255
- flat: mergedProps.flat,
256
- leftRounded: mergedProps.leftRounded,
257
- rightRounded: mergedProps.rightRounded,
258
- bordered: mergedProps.bordered,
259
- borderless: mergedProps.borderless,
318
+ status: final.status,
319
+ rounded: final.rounded,
320
+ bg: final.bg,
321
+ funcss: final.funcss,
322
+ flat: final.flat,
323
+ leftRounded: final.leftRounded,
324
+ rightRounded: final.rightRounded,
325
+ bordered: final.bordered,
326
+ borderless: final.borderless,
260
327
  });
261
- var style = mergedProps.fullWidth ? { width: '100%' } : undefined;
328
+ var style = final.fullWidth ? { width: '100%' } : undefined;
262
329
  var handleChange = function (e) {
263
- setSelectValue(e.target.value);
330
+ var newValue = e.target.value;
331
+ setSelectValue(newValue);
264
332
  if (onChange)
265
333
  onChange(e);
266
334
  };
@@ -274,45 +342,33 @@ var SelectInput = function (_a) {
274
342
  if (rest.onBlur)
275
343
  rest.onBlur(e);
276
344
  };
277
- var effectivePrefix = prefixNode || mergedProps.prefix || mergedProps.startIcon;
278
- var effectiveSuffix = suffixNode || mergedProps.suffix || mergedProps.endIcon;
279
- var selectElement = (react_1.default.createElement("select", __assign({ id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, defaultValue: defaultValue, value: value, style: style }, rest), options.map(function (option) { return (react_1.default.createElement("option", { key: option.value, value: option.value }, option.text)); })));
280
- var wrappedSelect = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, selectElement));
281
- return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: mergedProps.status, helperText: helperText, isFocused: isFocused, hasValue: selectHasValue, fullWidth: mergedProps.fullWidth, id: id }, wrappedSelect));
345
+ var effectivePrefix = prefixNode || final.prefix || final.startIcon;
346
+ var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
347
+ 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)); })));
348
+ var wrappedSelect = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: final.iconicBg, funcss: final.funcss }, selectElement));
349
+ return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: final.status, helperText: helperText, isFocused: isFocused, hasValue: selectHasValue, fullWidth: final.fullWidth, id: id }, wrappedSelect));
282
350
  };
283
351
  exports.SelectInput = SelectInput;
284
352
  // Textarea Component
285
353
  var TextareaInput = function (_a) {
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"]);
354
+ 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"]);
287
355
  var _d = (0, react_1.useState)(false), isFocused = _d[0], setIsFocused = _d[1];
288
- var _e = (0, react_1.useState)(value || defaultValue || ''), textValue = _e[0], setTextValue = _e[1];
356
+ var _e = (0, react_1.useState)(value !== undefined ? String(value) : defaultValue || ''), textValue = _e[0], setTextValue = _e[1];
289
357
  var _f = (0, react_1.useState)(null), prefixNode = _f[0], setPrefixNode = _f[1];
290
358
  var _g = (0, react_1.useState)(null), suffixNode = _g[0], setSuffixNode = _g[1];
359
+ // Handle value changes - only update if value is truly defined (not empty string)
291
360
  (0, react_1.useEffect)(function () {
292
- if (value !== undefined) {
293
- setTextValue(value);
361
+ if (value !== undefined && value !== '') {
362
+ setTextValue(String(value));
294
363
  }
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);
364
+ else if (value === '') {
365
+ // Allow empty string to clear the textarea
366
+ setTextValue('');
312
367
  }
313
- }, [stringSuffix]);
368
+ }, [value]);
314
369
  var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
315
- var mergedProps = mergeWithLocal({
370
+ // Create local props object including stringPrefix/stringSuffix
371
+ var localProps = {
316
372
  status: status,
317
373
  funcss: funcss,
318
374
  bg: bg,
@@ -328,22 +384,67 @@ var TextareaInput = function (_a) {
328
384
  prefix: prefix,
329
385
  suffix: suffix,
330
386
  iconicBg: iconicBg,
331
- }).props;
387
+ stringPrefix: stringPrefix, // Include in local props
388
+ stringSuffix: stringSuffix,
389
+ };
390
+ // Merge with config - LOCAL PROPS OVERRIDE CONFIG
391
+ var mergedProps = mergeWithLocal(localProps).props;
392
+ // Extract final values - local props take precedence, but handle empty strings properly
393
+ var final = {
394
+ status: status !== undefined ? status : mergedProps.status,
395
+ funcss: funcss !== undefined ? funcss : mergedProps.funcss,
396
+ bg: bg !== undefined ? bg : mergedProps.bg,
397
+ fullWidth: fullWidth !== undefined ? fullWidth : mergedProps.fullWidth,
398
+ flat: flat !== undefined ? flat : mergedProps.flat,
399
+ bordered: bordered !== undefined ? bordered : mergedProps.bordered,
400
+ borderless: borderless !== undefined ? borderless : mergedProps.borderless,
401
+ rounded: rounded !== undefined ? rounded : mergedProps.rounded,
402
+ leftRounded: leftRounded !== undefined ? leftRounded : mergedProps.leftRounded,
403
+ rightRounded: rightRounded !== undefined ? rightRounded : mergedProps.rightRounded,
404
+ startIcon: startIcon !== undefined ? startIcon : mergedProps.startIcon,
405
+ endIcon: endIcon !== undefined ? endIcon : mergedProps.endIcon,
406
+ prefix: prefix !== undefined ? prefix : mergedProps.prefix,
407
+ suffix: suffix !== undefined ? suffix : mergedProps.suffix,
408
+ iconicBg: iconicBg !== undefined ? iconicBg : mergedProps.iconicBg,
409
+ stringPrefix: stringPrefix !== undefined ? stringPrefix : mergedProps.stringPrefix, // Handle both local and config
410
+ stringSuffix: stringSuffix !== undefined ? stringSuffix : mergedProps.stringSuffix, // Handle both local and config
411
+ };
412
+ // Handle stringPrefix - use final value (local or config)
413
+ (0, react_1.useEffect)(function () {
414
+ var effectiveStringPrefix = final.stringPrefix;
415
+ if (effectiveStringPrefix) {
416
+ (0, getDynamicIcon_1.getDynamicIcon)(effectiveStringPrefix).then(function (node) { return setPrefixNode(node); });
417
+ }
418
+ else {
419
+ setPrefixNode(null);
420
+ }
421
+ }, [final.stringPrefix]);
422
+ // Handle stringSuffix - use final value (local or config)
423
+ (0, react_1.useEffect)(function () {
424
+ var effectiveStringSuffix = final.stringSuffix;
425
+ if (effectiveStringSuffix) {
426
+ (0, getDynamicIcon_1.getDynamicIcon)(effectiveStringSuffix).then(function (node) { return setSuffixNode(node); });
427
+ }
428
+ else {
429
+ setSuffixNode(null);
430
+ }
431
+ }, [final.stringSuffix]);
332
432
  var themeVariant = (0, theme_1.useVariant)().variant;
333
433
  var className = generateInputClasses({
334
- status: mergedProps.status,
335
- rounded: mergedProps.rounded,
336
- bg: mergedProps.bg,
337
- funcss: mergedProps.funcss,
338
- flat: mergedProps.flat,
339
- leftRounded: mergedProps.leftRounded,
340
- rightRounded: mergedProps.rightRounded,
341
- bordered: mergedProps.bordered,
342
- borderless: mergedProps.borderless,
434
+ status: final.status,
435
+ rounded: final.rounded,
436
+ bg: final.bg,
437
+ funcss: final.funcss,
438
+ flat: final.flat,
439
+ leftRounded: final.leftRounded,
440
+ rightRounded: final.rightRounded,
441
+ bordered: final.bordered,
442
+ borderless: final.borderless,
343
443
  });
344
- var style = mergedProps.fullWidth ? { width: '100%' } : undefined;
444
+ var style = final.fullWidth ? { width: '100%' } : undefined;
345
445
  var handleChange = function (e) {
346
- setTextValue(e.target.value);
446
+ var newValue = e.target.value;
447
+ setTextValue(newValue);
347
448
  if (onChange)
348
449
  onChange(e);
349
450
  };
@@ -357,39 +458,24 @@ var TextareaInput = function (_a) {
357
458
  if (rest.onBlur)
358
459
  rest.onBlur(e);
359
460
  };
360
- var effectivePrefix = prefixNode || mergedProps.prefix || mergedProps.startIcon;
361
- var effectiveSuffix = suffixNode || mergedProps.suffix || mergedProps.endIcon;
362
- var textareaElement = (react_1.default.createElement("textarea", __assign({ id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, defaultValue: defaultValue, placeholder: !label ? rest.placeholder : '', style: style, value: value, rows: rows }, rest)));
363
- var wrappedTextarea = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, textareaElement));
364
- return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: mergedProps.status, helperText: helperText, isFocused: isFocused, hasValue: !!textValue, fullWidth: mergedProps.fullWidth, id: id }, wrappedTextarea));
461
+ var effectivePrefix = prefixNode || final.prefix || final.startIcon;
462
+ var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
463
+ // Show placeholder only when label is active (focused or has value)
464
+ var showPlaceholder = placeholder && label && (isFocused || !!textValue);
465
+ 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)));
466
+ var wrappedTextarea = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: final.iconicBg, funcss: final.funcss }, textareaElement));
467
+ 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));
365
468
  };
366
469
  exports.TextareaInput = TextareaInput;
367
- // File Input Component
470
+ // File Input Component (unchanged as it doesn't have the same value issue)
368
471
  var FileInput = function (_a) {
369
472
  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"]);
370
473
  var _e = (0, react_1.useState)(''), fileName = _e[0], setFileName = _e[1];
371
474
  var _f = (0, react_1.useState)(null), prefixNode = _f[0], setPrefixNode = _f[1];
372
475
  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]);
391
476
  var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
392
- var mergedProps = mergeWithLocal({
477
+ // Create local props object including stringPrefix/stringSuffix
478
+ var localProps = {
393
479
  status: status,
394
480
  funcss: funcss,
395
481
  bg: bg,
@@ -403,10 +489,51 @@ var FileInput = function (_a) {
403
489
  prefix: prefix,
404
490
  suffix: suffix,
405
491
  iconicBg: iconicBg,
492
+ stringPrefix: stringPrefix, // Include in local props
493
+ stringSuffix: stringSuffix, // Include in local props
406
494
  bordered: rest.bordered,
407
495
  borderless: rest.borderless,
408
- }).props;
409
- var themeVariant = (0, theme_1.useVariant)().variant;
496
+ };
497
+ // Merge with config - LOCAL PROPS OVERRIDE CONFIG
498
+ var mergedProps = mergeWithLocal(localProps).props;
499
+ // Extract final values - local props take precedence
500
+ var final = {
501
+ status: status !== undefined ? status : mergedProps.status,
502
+ funcss: funcss !== undefined ? funcss : mergedProps.funcss,
503
+ bg: bg !== undefined ? bg : mergedProps.bg,
504
+ fullWidth: fullWidth !== undefined ? fullWidth : mergedProps.fullWidth,
505
+ flat: flat !== undefined ? flat : mergedProps.flat,
506
+ rounded: rounded !== undefined ? rounded : mergedProps.rounded,
507
+ leftRounded: leftRounded !== undefined ? leftRounded : mergedProps.leftRounded,
508
+ rightRounded: rightRounded !== undefined ? rightRounded : mergedProps.rightRounded,
509
+ startIcon: startIcon !== undefined ? startIcon : mergedProps.startIcon,
510
+ endIcon: endIcon !== undefined ? endIcon : mergedProps.endIcon,
511
+ prefix: prefix !== undefined ? prefix : mergedProps.prefix,
512
+ suffix: suffix !== undefined ? suffix : mergedProps.suffix,
513
+ iconicBg: iconicBg !== undefined ? iconicBg : mergedProps.iconicBg,
514
+ stringPrefix: stringPrefix !== undefined ? stringPrefix : mergedProps.stringPrefix, // Handle both local and config
515
+ stringSuffix: stringSuffix !== undefined ? stringSuffix : mergedProps.stringSuffix, // Handle both local and config
516
+ };
517
+ // Handle stringPrefix - use final value (local or config)
518
+ (0, react_1.useEffect)(function () {
519
+ var effectiveStringPrefix = final.stringPrefix;
520
+ if (effectiveStringPrefix) {
521
+ (0, getDynamicIcon_1.getDynamicIcon)(effectiveStringPrefix).then(function (node) { return setPrefixNode(node); });
522
+ }
523
+ else {
524
+ setPrefixNode(null);
525
+ }
526
+ }, [final.stringPrefix]);
527
+ // Handle stringSuffix - use final value (local or config)
528
+ (0, react_1.useEffect)(function () {
529
+ var effectiveStringSuffix = final.stringSuffix;
530
+ if (effectiveStringSuffix) {
531
+ (0, getDynamicIcon_1.getDynamicIcon)(effectiveStringSuffix).then(function (node) { return setSuffixNode(node); });
532
+ }
533
+ else {
534
+ setSuffixNode(null);
535
+ }
536
+ }, [final.stringSuffix]);
410
537
  var handleChange = function (e) {
411
538
  var _a;
412
539
  var file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
@@ -416,27 +543,27 @@ var FileInput = function (_a) {
416
543
  if (onChange)
417
544
  onChange(e);
418
545
  };
419
- var effectivePrefix = prefixNode || mergedProps.prefix || mergedProps.startIcon;
420
- var effectiveSuffix = suffixNode || mergedProps.suffix || mergedProps.endIcon;
546
+ var effectivePrefix = prefixNode || final.prefix || final.startIcon;
547
+ var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
421
548
  if (btn) {
422
549
  var className = generateInputClasses({
423
- status: mergedProps.status,
424
- rounded: mergedProps.rounded,
425
- bg: mergedProps.bg,
426
- funcss: mergedProps.funcss,
427
- flat: mergedProps.flat,
428
- leftRounded: mergedProps.leftRounded,
429
- rightRounded: mergedProps.rightRounded,
550
+ status: final.status,
551
+ rounded: final.rounded,
552
+ bg: final.bg,
553
+ funcss: final.funcss,
554
+ flat: final.flat,
555
+ leftRounded: final.leftRounded,
556
+ rightRounded: final.rightRounded,
430
557
  bordered: true,
431
558
  borderless: false,
432
559
  additionalClasses: 'filedInput'
433
560
  });
434
- var style = mergedProps.fullWidth ? { width: '100%' } : undefined;
561
+ var style = final.fullWidth ? { width: '100%' } : undefined;
435
562
  var fileInputElement = (react_1.default.createElement("div", { className: "fileInput" },
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)),
563
+ button || (react_1.default.createElement(Button_1.default, { funcss: final.funcss, startIcon: icon || react_1.default.createElement(pi_1.PiCloudArrowUp, null), bg: "primary", fullWidth: true, raised: true }, fileName || label)),
437
564
  react_1.default.createElement("input", __assign({ id: id, name: name, className: className, onChange: handleChange, type: "file", style: style, value: value }, rest))));
438
- var wrappedFileInput = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, fileInputElement));
439
- return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: undefined, status: mergedProps.status, helperText: helperText, isFocused: false, hasValue: !!fileName, fullWidth: mergedProps.fullWidth, id: id }, wrappedFileInput));
565
+ var wrappedFileInput = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: final.iconicBg, funcss: final.funcss }, fileInputElement));
566
+ return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: undefined, status: final.status, helperText: helperText, isFocused: false, hasValue: !!fileName, fullWidth: final.fullWidth, id: id }, wrappedFileInput));
440
567
  }
441
568
  var uploadElement = (react_1.default.createElement("div", { className: "_upload_container" },
442
569
  react_1.default.createElement("label", { htmlFor: id, className: "_upload_label" },
@@ -450,14 +577,17 @@ var FileInput = function (_a) {
450
577
  } }, fileName || label),
451
578
  extra && react_1.default.createElement("div", { className: "text-small opacity-3" }, extra)),
452
579
  react_1.default.createElement("input", __assign({ onChange: handleChange, type: "file", id: id, className: "_upload_input" }, rest))));
453
- return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: undefined, status: mergedProps.status, helperText: helperText, isFocused: false, hasValue: !!fileName, fullWidth: mergedProps.fullWidth, id: id }, uploadElement));
580
+ return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: undefined, status: final.status, helperText: helperText, isFocused: false, hasValue: !!fileName, fullWidth: final.fullWidth, id: id }, uploadElement));
454
581
  };
455
582
  exports.FileInput = FileInput;
456
583
  var Input = function (_a) {
457
584
  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"]);
458
585
  var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
459
- var mergedProps = mergeWithLocal(__assign(__assign({}, props), { startIcon: startIcon, endIcon: endIcon, prefix: prefix, suffix: suffix, iconicBg: iconicBg })).props;
460
- var inputProps = __assign(__assign(__assign({}, props), mergedProps), { variant: variant, stringPrefix: stringPrefix, stringSuffix: stringSuffix, borderless: noBorder !== undefined ? noBorder : (props.borderless !== undefined ? props.borderless : mergedProps.borderless) });
586
+ // Create local props object including stringPrefix/stringSuffix
587
+ var localProps = __assign(__assign({}, props), { startIcon: startIcon, endIcon: endIcon, prefix: prefix, suffix: suffix, iconicBg: iconicBg, stringPrefix: stringPrefix, // Include in local props
588
+ stringSuffix: stringSuffix });
589
+ var mergedProps = mergeWithLocal(localProps).props;
590
+ var inputProps = __assign(__assign(__assign({}, props), mergedProps), { variant: variant, borderless: noBorder !== undefined ? noBorder : (props.borderless !== undefined ? props.borderless : mergedProps.borderless) });
461
591
  if (select) {
462
592
  return react_1.default.createElement(exports.SelectInput, __assign({}, inputProps));
463
593
  }
@@ -5,12 +5,17 @@ interface ThemeConfig {
5
5
  [key: string]: any;
6
6
  }
7
7
  interface ProjectData {
8
- theme_config?: ThemeConfig;
8
+ theme_config?: {
9
+ colors?: Record<string, string>;
10
+ typography?: Record<string, string>;
11
+ [key: string]: any;
12
+ };
13
+ components?: Record<string, any>;
9
14
  default_variation?: ThemeVariant;
10
15
  name?: string;
11
- colors?: any;
12
- global?: any;
13
- components?: any;
16
+ project_id?: string;
17
+ version?: number;
18
+ updated_at?: string;
14
19
  }
15
20
  interface ThemeProviderProps {
16
21
  theme: ThemeName;
@@ -37,5 +42,10 @@ declare const ThemeProvider: React.FC<ThemeProviderProps>;
37
42
  export default ThemeProvider;
38
43
  export declare const useThemeValue: (key: string) => string | undefined;
39
44
  export declare const useComponentConfig: (componentName: string) => any;
40
- export declare const useColors: () => any;
41
- export declare const useGlobalConfig: () => any;
45
+ export declare const useColors: () => Record<string, string>;
46
+ export declare const useTypography: () => Record<string, string>;
47
+ export declare const useThemeConfig: () => Record<string, any>;
48
+ export declare const useProjectData: () => ProjectData | null;
49
+ export declare const useColor: (colorName: string) => string | undefined;
50
+ export declare const useTypographyValue: (property: string) => string | undefined;
51
+ export declare const useComponentVariant: (componentName: string, variantName?: string) => any;