fis-component 0.1.4 → 0.1.5

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/dist/cjs/index.js CHANGED
@@ -65351,7 +65351,7 @@ function mergeRefs(...refs) {
65351
65351
  }
65352
65352
 
65353
65353
  const FISInputText = React.forwardRef((props, ref) => {
65354
- const { className, typeSuffix, textLabel = "", iconLabel, required, iconPrefix, sizeInput, showCount, message, negative, positive, maxLength = 500, disabled, onChange, onEnter, onKeyDown, onClickIconLabel, onClickSuffix, ...rest } = props;
65354
+ const { className, typeSuffix, textLabel = "", iconLabel, required, iconPrefix, sizeInput, showCount, message, negative, positive, maxLength = 500, disabled, onChange, onEnter, onKeyDown, onClickIconLabel, onClickSuffix, isTrimValue = true, ...rest } = props;
65355
65355
  // Internal ref to access DOM element for character count
65356
65356
  const internalRef = React.useRef(null);
65357
65357
  const [internalValue, setInternalValue] = React.useState("");
@@ -65386,7 +65386,22 @@ const FISInputText = React.forwardRef((props, ref) => {
65386
65386
  }
65387
65387
  }
65388
65388
  }, [onEnter]);
65389
- return (jsxRuntime.jsxs(DivContainerSC$6, { className: className, children: [(textLabel || iconLabel) && (jsxRuntime.jsx(FISInputLabel, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsxRuntime.jsx(FISInputField, { ...rest, ref: mergeRefs(ref, internalRef), typeSuffix: typeSuffix, sizeInput: sizeInput, iconPrefix: iconPrefix, onKeyPress: handleKeyPress, onChange: handleChange, disabled: disabled, negative: negative, maxLength: maxLength, onClickSuffix: onClickSuffix }), (message || showCount) && (jsxRuntime.jsxs(DivHintWrapperSC$1, { children: [jsxRuntime.jsx(SpanHintSC$3, { className: classNames({
65389
+ const handleBlur = React.useCallback((event) => {
65390
+ if (!isTrimValue) {
65391
+ rest.onBlur?.(event);
65392
+ return;
65393
+ }
65394
+ const trimmedValue = event.target.value.trim();
65395
+ event.target.value = trimmedValue;
65396
+ if (rest.value === undefined) {
65397
+ setInternalValue(trimmedValue);
65398
+ }
65399
+ else {
65400
+ forceUpdate();
65401
+ }
65402
+ rest.onBlur?.(event);
65403
+ }, [isTrimValue, rest.value, rest.onBlur]);
65404
+ return (jsxRuntime.jsxs(DivContainerSC$6, { className: className, children: [(textLabel || iconLabel) && (jsxRuntime.jsx(FISInputLabel, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsxRuntime.jsx(FISInputField, { ...rest, ref: mergeRefs(ref, internalRef), typeSuffix: typeSuffix, sizeInput: sizeInput, iconPrefix: iconPrefix, onKeyPress: handleKeyPress, onChange: handleChange, onBlur: handleBlur, disabled: disabled, negative: negative, maxLength: maxLength, onClickSuffix: onClickSuffix }), (message || showCount) && (jsxRuntime.jsxs(DivHintWrapperSC$1, { children: [jsxRuntime.jsx(SpanHintSC$3, { className: classNames({
65390
65405
  disabled: disabled,
65391
65406
  negative: negative,
65392
65407
  positive: positive,