@farmzone/fz-react-ui 1.0.11 → 1.0.12

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/index.cjs CHANGED
@@ -7238,9 +7238,13 @@ function SelectWithInputField(props) {
7238
7238
  }, [defaultPrefix, formValue, options]);
7239
7239
  const [selectedPrefix, setSelectedPrefix] = React6.useState(prefix);
7240
7240
  const [prevFormValue, setPrevFormValue] = React6.useState(formValue);
7241
+ const isUserInputChangeRef = React6.useRef(false);
7241
7242
  if (prevFormValue !== formValue) {
7242
7243
  setPrevFormValue(formValue);
7243
- setSelectedPrefix(formValue ? prefix : defaultPrefix);
7244
+ if (!isUserInputChangeRef.current) {
7245
+ setSelectedPrefix(formValue ? prefix : defaultPrefix);
7246
+ }
7247
+ isUserInputChangeRef.current = false;
7244
7248
  }
7245
7249
  React6.useLayoutEffect(() => {
7246
7250
  if (readOnly) return;
@@ -7249,9 +7253,7 @@ function SelectWithInputField(props) {
7249
7253
  }
7250
7254
  }, [formValue, normalizedFormValue, onChange, readOnly]);
7251
7255
  if (readOnly) {
7252
- const prefixLabel = options.find((o) => String(o.value) === prefix)?.label ?? prefix;
7253
- const displayText = inputPart ? `${prefixLabel} ${inputPart}` : prefix ? prefixLabel : "\u2014";
7254
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: fieldControlWrapClass(className), children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: FIELD_READONLY_TEXT_CLASS, children: displayText || "\u2014" }) });
7256
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: fieldControlWrapClass(className), children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: FIELD_READONLY_TEXT_CLASS, children: formValue }) });
7255
7257
  }
7256
7258
  const updateCombined = (nextPrefix, nextInput) => {
7257
7259
  onChange(combineSelectWithInputValue(nextPrefix, nextInput));
@@ -7265,6 +7267,7 @@ function SelectWithInputField(props) {
7265
7267
  if (normalized) {
7266
7268
  validationCtx?.markFieldHadValue(String(config.name));
7267
7269
  }
7270
+ isUserInputChangeRef.current = true;
7268
7271
  updateCombined(selectedPrefix, normalized);
7269
7272
  };
7270
7273
  const selectClass = resolveSelectClassNameProp(selectWithInputClassNames?.selectClassName, {
@@ -7303,6 +7306,7 @@ function SelectWithInputField(props) {
7303
7306
  },
7304
7307
  onBlur: (e) => {
7305
7308
  const normalized = normalizeInput(e.target.value.normalize("NFKC"));
7309
+ isUserInputChangeRef.current = true;
7306
7310
  updateCombined(selectedPrefix, normalized);
7307
7311
  onBlur();
7308
7312
  }