@fctc/sme-widget-ui 2.0.2 → 2.0.3

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.js CHANGED
@@ -17347,7 +17347,7 @@ var CharField = (props) => {
17347
17347
  required: !invisible && required,
17348
17348
  className: `w-full h-full ring-0 focus:ring-0 focus:!outline-none outline-0 px-3 py-[12px] text-sm font-normal gap-2 opacity-100 leading-[1.5] resize-none overflow-hidden
17349
17349
  ${readonly ? "cursor-not-allowed border border-[rgba(66,66,66,0.12)] text-[#5c5a5a]" : "cursor-pointer border border-[rgba(66,66,66,0.12)] text-[#525866]"}
17350
- ${!isEditTable ? isForm ? "bg-white border-input-primary rounded-[10px]" : "" : `border-transparent bg-transparent ${readonly ? "" : "border-b-primary"}`}
17350
+ ${!isEditTable ? isForm ? "bg-white border-input-primary rounded-[10px]" : "" : `border-transparent bg-transparent ${readonly ? "" : "border-b-primary w-fit max-w-[200px]"}`}
17351
17351
  ${error2 && isEditTable && "focus:border-b-[1px] focus:border-[#de4747] hover:border-b-[1px] hover:border-[#de4747]"}
17352
17352
  `
17353
17353
  }
@@ -31996,16 +31996,18 @@ var FloatField = (props) => {
31996
31996
  value !== void 0 && value !== null ? formatFloatNumber(value) : ""
31997
31997
  );
31998
31998
  (0, import_react58.useEffect)(() => {
31999
- if (propValue !== void 0 && propValue !== null && propValue !== parseFloat(inputValue?.replace(/,/g, ""))) {
31999
+ if (isDirtyRef.current) return;
32000
+ const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
32001
+ if (propValue !== void 0 && propValue !== null && !Number.isNaN(propValue) && propValue !== numericInput) {
32000
32002
  setInputValue(formatFloatNumber(propValue));
32001
32003
  clearErrors(name2);
32002
- } else if (value !== void 0 && value !== null && value !== parseFloat(inputValue?.replace(/,/g, ""))) {
32004
+ } else if (value !== void 0 && value !== null && !Number.isNaN(value) && value !== numericInput) {
32003
32005
  setInputValue(formatFloatNumber(value));
32004
32006
  clearErrors(name2);
32005
32007
  } else if (value === null || value === void 0) {
32006
32008
  setInputValue("");
32007
32009
  }
32008
- }, [value, name2, clearErrors, propValue]);
32010
+ }, [value, name2, clearErrors, propValue, inputValue]);
32009
32011
  const isDirtyRef = (0, import_react58.useRef)(false);
32010
32012
  const inputRef = (0, import_react58.useRef)(null);
32011
32013
  const lastCommittedValueRef = (0, import_react58.useRef)(null);
@@ -33272,7 +33274,7 @@ var IntegerField = (props) => {
33272
33274
  `
33273
33275
  }
33274
33276
  ),
33275
- error2 && isEditTable && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
33277
+ error2 && !isEditTable && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
33276
33278
  ] });
33277
33279
  }
33278
33280
  }
package/dist/index.mjs CHANGED
@@ -17222,7 +17222,7 @@ var CharField = (props) => {
17222
17222
  required: !invisible && required,
17223
17223
  className: `w-full h-full ring-0 focus:ring-0 focus:!outline-none outline-0 px-3 py-[12px] text-sm font-normal gap-2 opacity-100 leading-[1.5] resize-none overflow-hidden
17224
17224
  ${readonly ? "cursor-not-allowed border border-[rgba(66,66,66,0.12)] text-[#5c5a5a]" : "cursor-pointer border border-[rgba(66,66,66,0.12)] text-[#525866]"}
17225
- ${!isEditTable ? isForm ? "bg-white border-input-primary rounded-[10px]" : "" : `border-transparent bg-transparent ${readonly ? "" : "border-b-primary"}`}
17225
+ ${!isEditTable ? isForm ? "bg-white border-input-primary rounded-[10px]" : "" : `border-transparent bg-transparent ${readonly ? "" : "border-b-primary w-fit max-w-[200px]"}`}
17226
17226
  ${error2 && isEditTable && "focus:border-b-[1px] focus:border-[#de4747] hover:border-b-[1px] hover:border-[#de4747]"}
17227
17227
  `
17228
17228
  }
@@ -31871,16 +31871,18 @@ var FloatField = (props) => {
31871
31871
  value !== void 0 && value !== null ? formatFloatNumber(value) : ""
31872
31872
  );
31873
31873
  useEffect20(() => {
31874
- if (propValue !== void 0 && propValue !== null && propValue !== parseFloat(inputValue?.replace(/,/g, ""))) {
31874
+ if (isDirtyRef.current) return;
31875
+ const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
31876
+ if (propValue !== void 0 && propValue !== null && !Number.isNaN(propValue) && propValue !== numericInput) {
31875
31877
  setInputValue(formatFloatNumber(propValue));
31876
31878
  clearErrors(name2);
31877
- } else if (value !== void 0 && value !== null && value !== parseFloat(inputValue?.replace(/,/g, ""))) {
31879
+ } else if (value !== void 0 && value !== null && !Number.isNaN(value) && value !== numericInput) {
31878
31880
  setInputValue(formatFloatNumber(value));
31879
31881
  clearErrors(name2);
31880
31882
  } else if (value === null || value === void 0) {
31881
31883
  setInputValue("");
31882
31884
  }
31883
- }, [value, name2, clearErrors, propValue]);
31885
+ }, [value, name2, clearErrors, propValue, inputValue]);
31884
31886
  const isDirtyRef = useRef16(false);
31885
31887
  const inputRef = useRef16(null);
31886
31888
  const lastCommittedValueRef = useRef16(null);
@@ -33147,7 +33149,7 @@ var IntegerField = (props) => {
33147
33149
  `
33148
33150
  }
33149
33151
  ),
33150
- error2 && isEditTable && /* @__PURE__ */ jsx106("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
33152
+ error2 && !isEditTable && /* @__PURE__ */ jsx106("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
33151
33153
  ] });
33152
33154
  }
33153
33155
  }
package/dist/widgets.js CHANGED
@@ -16600,7 +16600,7 @@ var CharField = (props) => {
16600
16600
  required: !invisible && required,
16601
16601
  className: `w-full h-full ring-0 focus:ring-0 focus:!outline-none outline-0 px-3 py-[12px] text-sm font-normal gap-2 opacity-100 leading-[1.5] resize-none overflow-hidden
16602
16602
  ${readonly ? "cursor-not-allowed border border-[rgba(66,66,66,0.12)] text-[#5c5a5a]" : "cursor-pointer border border-[rgba(66,66,66,0.12)] text-[#525866]"}
16603
- ${!isEditTable ? isForm ? "bg-white border-input-primary rounded-[10px]" : "" : `border-transparent bg-transparent ${readonly ? "" : "border-b-primary"}`}
16603
+ ${!isEditTable ? isForm ? "bg-white border-input-primary rounded-[10px]" : "" : `border-transparent bg-transparent ${readonly ? "" : "border-b-primary w-fit max-w-[200px]"}`}
16604
16604
  ${error2 && isEditTable && "focus:border-b-[1px] focus:border-[#de4747] hover:border-b-[1px] hover:border-[#de4747]"}
16605
16605
  `
16606
16606
  }
@@ -31249,16 +31249,18 @@ var FloatField = (props) => {
31249
31249
  value !== void 0 && value !== null ? formatFloatNumber(value) : ""
31250
31250
  );
31251
31251
  (0, import_react58.useEffect)(() => {
31252
- if (propValue !== void 0 && propValue !== null && propValue !== parseFloat(inputValue?.replace(/,/g, ""))) {
31252
+ if (isDirtyRef.current) return;
31253
+ const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
31254
+ if (propValue !== void 0 && propValue !== null && !Number.isNaN(propValue) && propValue !== numericInput) {
31253
31255
  setInputValue(formatFloatNumber(propValue));
31254
31256
  clearErrors(name2);
31255
- } else if (value !== void 0 && value !== null && value !== parseFloat(inputValue?.replace(/,/g, ""))) {
31257
+ } else if (value !== void 0 && value !== null && !Number.isNaN(value) && value !== numericInput) {
31256
31258
  setInputValue(formatFloatNumber(value));
31257
31259
  clearErrors(name2);
31258
31260
  } else if (value === null || value === void 0) {
31259
31261
  setInputValue("");
31260
31262
  }
31261
- }, [value, name2, clearErrors, propValue]);
31263
+ }, [value, name2, clearErrors, propValue, inputValue]);
31262
31264
  const isDirtyRef = (0, import_react58.useRef)(false);
31263
31265
  const inputRef = (0, import_react58.useRef)(null);
31264
31266
  const lastCommittedValueRef = (0, import_react58.useRef)(null);
@@ -32525,7 +32527,7 @@ var IntegerField = (props) => {
32525
32527
  `
32526
32528
  }
32527
32529
  ),
32528
- error2 && isEditTable && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
32530
+ error2 && !isEditTable && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
32529
32531
  ] });
32530
32532
  }
32531
32533
  }
package/dist/widgets.mjs CHANGED
@@ -16538,7 +16538,7 @@ var CharField = (props) => {
16538
16538
  required: !invisible && required,
16539
16539
  className: `w-full h-full ring-0 focus:ring-0 focus:!outline-none outline-0 px-3 py-[12px] text-sm font-normal gap-2 opacity-100 leading-[1.5] resize-none overflow-hidden
16540
16540
  ${readonly ? "cursor-not-allowed border border-[rgba(66,66,66,0.12)] text-[#5c5a5a]" : "cursor-pointer border border-[rgba(66,66,66,0.12)] text-[#525866]"}
16541
- ${!isEditTable ? isForm ? "bg-white border-input-primary rounded-[10px]" : "" : `border-transparent bg-transparent ${readonly ? "" : "border-b-primary"}`}
16541
+ ${!isEditTable ? isForm ? "bg-white border-input-primary rounded-[10px]" : "" : `border-transparent bg-transparent ${readonly ? "" : "border-b-primary w-fit max-w-[200px]"}`}
16542
16542
  ${error2 && isEditTable && "focus:border-b-[1px] focus:border-[#de4747] hover:border-b-[1px] hover:border-[#de4747]"}
16543
16543
  `
16544
16544
  }
@@ -31187,16 +31187,18 @@ var FloatField = (props) => {
31187
31187
  value !== void 0 && value !== null ? formatFloatNumber(value) : ""
31188
31188
  );
31189
31189
  useEffect20(() => {
31190
- if (propValue !== void 0 && propValue !== null && propValue !== parseFloat(inputValue?.replace(/,/g, ""))) {
31190
+ if (isDirtyRef.current) return;
31191
+ const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
31192
+ if (propValue !== void 0 && propValue !== null && !Number.isNaN(propValue) && propValue !== numericInput) {
31191
31193
  setInputValue(formatFloatNumber(propValue));
31192
31194
  clearErrors(name2);
31193
- } else if (value !== void 0 && value !== null && value !== parseFloat(inputValue?.replace(/,/g, ""))) {
31195
+ } else if (value !== void 0 && value !== null && !Number.isNaN(value) && value !== numericInput) {
31194
31196
  setInputValue(formatFloatNumber(value));
31195
31197
  clearErrors(name2);
31196
31198
  } else if (value === null || value === void 0) {
31197
31199
  setInputValue("");
31198
31200
  }
31199
- }, [value, name2, clearErrors, propValue]);
31201
+ }, [value, name2, clearErrors, propValue, inputValue]);
31200
31202
  const isDirtyRef = useRef16(false);
31201
31203
  const inputRef = useRef16(null);
31202
31204
  const lastCommittedValueRef = useRef16(null);
@@ -32463,7 +32465,7 @@ var IntegerField = (props) => {
32463
32465
  `
32464
32466
  }
32465
32467
  ),
32466
- error2 && isEditTable && /* @__PURE__ */ jsx106("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
32468
+ error2 && !isEditTable && /* @__PURE__ */ jsx106("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
32467
32469
  ] });
32468
32470
  }
32469
32471
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/sme-widget-ui",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",