funuicss 3.6.18 → 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
@@ -116,35 +116,23 @@ var InputContainer = function (_a) {
116
116
  var TextInput = function (_a) {
117
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,49 +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;
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;
195
228
  // Show placeholder only when label is active (focused or has value)
196
229
  var showPlaceholder = placeholder && label && (isFocused || !!inputValue);
197
- 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: value }, rest)));
198
- var wrappedInput = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, inputElement));
199
- 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));
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));
200
233
  };
201
234
  exports.TextInput = TextInput;
202
235
  // Select Component
203
236
  var SelectInput = function (_a) {
204
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"]);
205
238
  var _d = (0, react_1.useState)(false), isFocused = _d[0], setIsFocused = _d[1];
206
- 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];
207
240
  var _f = (0, react_1.useState)(null), prefixNode = _f[0], setPrefixNode = _f[1];
208
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)
209
243
  (0, react_1.useEffect)(function () {
210
- if (value !== undefined) {
211
- setSelectValue(value);
244
+ if (value !== undefined && value !== '') {
245
+ setSelectValue(String(value));
212
246
  }
213
- }, [value]);
214
- // Handle stringPrefix
215
- (0, react_1.useEffect)(function () {
216
- if (stringPrefix) {
217
- (0, getDynamicIcon_1.getDynamicIcon)(stringPrefix).then(function (node) { return setPrefixNode(node); });
218
- }
219
- else {
220
- setPrefixNode(null);
221
- }
222
- }, [stringPrefix]);
223
- // Handle stringSuffix
224
- (0, react_1.useEffect)(function () {
225
- if (stringSuffix) {
226
- (0, getDynamicIcon_1.getDynamicIcon)(stringSuffix).then(function (node) { return setSuffixNode(node); });
227
- }
228
- else {
229
- setSuffixNode(null);
247
+ else if (value === '') {
248
+ // Allow empty string to clear the select
249
+ setSelectValue('');
230
250
  }
231
- }, [stringSuffix]);
232
- var selectHasValue = true;
251
+ }, [value]);
233
252
  var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
234
- var mergedProps = mergeWithLocal({
253
+ // Create local props object including stringPrefix/stringSuffix
254
+ var localProps = {
235
255
  status: status,
236
256
  funcss: funcss,
237
257
  bg: bg,
@@ -247,22 +267,68 @@ var SelectInput = function (_a) {
247
267
  prefix: prefix,
248
268
  suffix: suffix,
249
269
  iconicBg: iconicBg,
250
- }).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;
251
316
  var themeVariant = (0, theme_1.useVariant)().variant;
252
317
  var className = generateInputClasses({
253
- status: mergedProps.status,
254
- rounded: mergedProps.rounded,
255
- bg: mergedProps.bg,
256
- funcss: mergedProps.funcss,
257
- flat: mergedProps.flat,
258
- leftRounded: mergedProps.leftRounded,
259
- rightRounded: mergedProps.rightRounded,
260
- bordered: mergedProps.bordered,
261
- 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,
262
327
  });
263
- var style = mergedProps.fullWidth ? { width: '100%' } : undefined;
328
+ var style = final.fullWidth ? { width: '100%' } : undefined;
264
329
  var handleChange = function (e) {
265
- setSelectValue(e.target.value);
330
+ var newValue = e.target.value;
331
+ setSelectValue(newValue);
266
332
  if (onChange)
267
333
  onChange(e);
268
334
  };
@@ -276,45 +342,33 @@ var SelectInput = function (_a) {
276
342
  if (rest.onBlur)
277
343
  rest.onBlur(e);
278
344
  };
279
- var effectivePrefix = prefixNode || mergedProps.prefix || mergedProps.startIcon;
280
- var effectiveSuffix = suffixNode || mergedProps.suffix || mergedProps.endIcon;
281
- 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)); })));
282
- var wrappedSelect = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, selectElement));
283
- 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));
284
350
  };
285
351
  exports.SelectInput = SelectInput;
286
352
  // Textarea Component
287
353
  var TextareaInput = function (_a) {
288
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"]);
289
355
  var _d = (0, react_1.useState)(false), isFocused = _d[0], setIsFocused = _d[1];
290
- 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];
291
357
  var _f = (0, react_1.useState)(null), prefixNode = _f[0], setPrefixNode = _f[1];
292
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)
293
360
  (0, react_1.useEffect)(function () {
294
- if (value !== undefined) {
295
- setTextValue(value);
361
+ if (value !== undefined && value !== '') {
362
+ setTextValue(String(value));
296
363
  }
297
- }, [value]);
298
- // Handle stringPrefix
299
- (0, react_1.useEffect)(function () {
300
- if (stringPrefix) {
301
- (0, getDynamicIcon_1.getDynamicIcon)(stringPrefix).then(function (node) { return setPrefixNode(node); });
302
- }
303
- else {
304
- setPrefixNode(null);
305
- }
306
- }, [stringPrefix]);
307
- // Handle stringSuffix
308
- (0, react_1.useEffect)(function () {
309
- if (stringSuffix) {
310
- (0, getDynamicIcon_1.getDynamicIcon)(stringSuffix).then(function (node) { return setSuffixNode(node); });
311
- }
312
- else {
313
- setSuffixNode(null);
364
+ else if (value === '') {
365
+ // Allow empty string to clear the textarea
366
+ setTextValue('');
314
367
  }
315
- }, [stringSuffix]);
368
+ }, [value]);
316
369
  var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
317
- var mergedProps = mergeWithLocal({
370
+ // Create local props object including stringPrefix/stringSuffix
371
+ var localProps = {
318
372
  status: status,
319
373
  funcss: funcss,
320
374
  bg: bg,
@@ -330,22 +384,67 @@ var TextareaInput = function (_a) {
330
384
  prefix: prefix,
331
385
  suffix: suffix,
332
386
  iconicBg: iconicBg,
333
- }).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]);
334
432
  var themeVariant = (0, theme_1.useVariant)().variant;
335
433
  var className = generateInputClasses({
336
- status: mergedProps.status,
337
- rounded: mergedProps.rounded,
338
- bg: mergedProps.bg,
339
- funcss: mergedProps.funcss,
340
- flat: mergedProps.flat,
341
- leftRounded: mergedProps.leftRounded,
342
- rightRounded: mergedProps.rightRounded,
343
- bordered: mergedProps.bordered,
344
- 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,
345
443
  });
346
- var style = mergedProps.fullWidth ? { width: '100%' } : undefined;
444
+ var style = final.fullWidth ? { width: '100%' } : undefined;
347
445
  var handleChange = function (e) {
348
- setTextValue(e.target.value);
446
+ var newValue = e.target.value;
447
+ setTextValue(newValue);
349
448
  if (onChange)
350
449
  onChange(e);
351
450
  };
@@ -359,41 +458,24 @@ var TextareaInput = function (_a) {
359
458
  if (rest.onBlur)
360
459
  rest.onBlur(e);
361
460
  };
362
- var effectivePrefix = prefixNode || mergedProps.prefix || mergedProps.startIcon;
363
- var effectiveSuffix = suffixNode || mergedProps.suffix || mergedProps.endIcon;
461
+ var effectivePrefix = prefixNode || final.prefix || final.startIcon;
462
+ var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
364
463
  // Show placeholder only when label is active (focused or has value)
365
464
  var showPlaceholder = placeholder && label && (isFocused || !!textValue);
366
- 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: value, rows: rows }, rest)));
367
- var wrappedTextarea = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, textareaElement));
368
- 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));
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));
369
468
  };
370
469
  exports.TextareaInput = TextareaInput;
371
- // File Input Component
470
+ // File Input Component (unchanged as it doesn't have the same value issue)
372
471
  var FileInput = function (_a) {
373
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"]);
374
473
  var _e = (0, react_1.useState)(''), fileName = _e[0], setFileName = _e[1];
375
474
  var _f = (0, react_1.useState)(null), prefixNode = _f[0], setPrefixNode = _f[1];
376
475
  var _g = (0, react_1.useState)(null), suffixNode = _g[0], setSuffixNode = _g[1];
377
- // Handle stringPrefix
378
- (0, react_1.useEffect)(function () {
379
- if (stringPrefix) {
380
- (0, getDynamicIcon_1.getDynamicIcon)(stringPrefix).then(function (node) { return setPrefixNode(node); });
381
- }
382
- else {
383
- setPrefixNode(null);
384
- }
385
- }, [stringPrefix]);
386
- // Handle stringSuffix
387
- (0, react_1.useEffect)(function () {
388
- if (stringSuffix) {
389
- (0, getDynamicIcon_1.getDynamicIcon)(stringSuffix).then(function (node) { return setSuffixNode(node); });
390
- }
391
- else {
392
- setSuffixNode(null);
393
- }
394
- }, [stringSuffix]);
395
476
  var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
396
- var mergedProps = mergeWithLocal({
477
+ // Create local props object including stringPrefix/stringSuffix
478
+ var localProps = {
397
479
  status: status,
398
480
  funcss: funcss,
399
481
  bg: bg,
@@ -407,10 +489,51 @@ var FileInput = function (_a) {
407
489
  prefix: prefix,
408
490
  suffix: suffix,
409
491
  iconicBg: iconicBg,
492
+ stringPrefix: stringPrefix, // Include in local props
493
+ stringSuffix: stringSuffix, // Include in local props
410
494
  bordered: rest.bordered,
411
495
  borderless: rest.borderless,
412
- }).props;
413
- 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]);
414
537
  var handleChange = function (e) {
415
538
  var _a;
416
539
  var file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
@@ -420,27 +543,27 @@ var FileInput = function (_a) {
420
543
  if (onChange)
421
544
  onChange(e);
422
545
  };
423
- var effectivePrefix = prefixNode || mergedProps.prefix || mergedProps.startIcon;
424
- var effectiveSuffix = suffixNode || mergedProps.suffix || mergedProps.endIcon;
546
+ var effectivePrefix = prefixNode || final.prefix || final.startIcon;
547
+ var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
425
548
  if (btn) {
426
549
  var className = generateInputClasses({
427
- status: mergedProps.status,
428
- rounded: mergedProps.rounded,
429
- bg: mergedProps.bg,
430
- funcss: mergedProps.funcss,
431
- flat: mergedProps.flat,
432
- leftRounded: mergedProps.leftRounded,
433
- 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,
434
557
  bordered: true,
435
558
  borderless: false,
436
559
  additionalClasses: 'filedInput'
437
560
  });
438
- var style = mergedProps.fullWidth ? { width: '100%' } : undefined;
561
+ var style = final.fullWidth ? { width: '100%' } : undefined;
439
562
  var fileInputElement = (react_1.default.createElement("div", { className: "fileInput" },
440
- 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)),
441
564
  react_1.default.createElement("input", __assign({ id: id, name: name, className: className, onChange: handleChange, type: "file", style: style, value: value }, rest))));
442
- var wrappedFileInput = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, fileInputElement));
443
- 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));
444
567
  }
445
568
  var uploadElement = (react_1.default.createElement("div", { className: "_upload_container" },
446
569
  react_1.default.createElement("label", { htmlFor: id, className: "_upload_label" },
@@ -454,14 +577,17 @@ var FileInput = function (_a) {
454
577
  } }, fileName || label),
455
578
  extra && react_1.default.createElement("div", { className: "text-small opacity-3" }, extra)),
456
579
  react_1.default.createElement("input", __assign({ onChange: handleChange, type: "file", id: id, className: "_upload_input" }, rest))));
457
- 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));
458
581
  };
459
582
  exports.FileInput = FileInput;
460
583
  var Input = function (_a) {
461
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"]);
462
585
  var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
463
- var mergedProps = mergeWithLocal(__assign(__assign({}, props), { startIcon: startIcon, endIcon: endIcon, prefix: prefix, suffix: suffix, iconicBg: iconicBg })).props;
464
- 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) });
465
591
  if (select) {
466
592
  return react_1.default.createElement(exports.SelectInput, __assign({}, inputProps));
467
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;