@pnkx-lib/ui 1.9.258 → 1.9.260

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.
Files changed (2) hide show
  1. package/es/fields/Input.js +29 -18
  2. package/package.json +1 -1
@@ -1250,18 +1250,38 @@ const Input = (props) => {
1250
1250
  const errorMessage = get(errors, name)?.message;
1251
1251
  const inputRef = useRef(null);
1252
1252
  const [isComposing, setIsComposing] = useState(false);
1253
- console.log(" isComposing:", isComposing);
1254
1253
  //! Function
1255
- const handleCompositionStart = () => setIsComposing(true);
1256
- const handleCompositionEnd = () => {
1257
- setIsComposing(false);
1258
- const input = inputRef.current?.input;
1259
- if (input) {
1254
+ const handleChange = useCallback(
1255
+ (e) => {
1256
+ onChange?.(e);
1257
+ afterOnChange?.(e.target.value);
1258
+ },
1259
+ [onChange, afterOnChange, isComposing]
1260
+ );
1261
+ const handleCompositionStart = useCallback(() => {
1262
+ setIsComposing(true);
1263
+ }, []);
1264
+ const handleCompositionEnd = useCallback(
1265
+ (e) => {
1266
+ setIsComposing(false);
1267
+ const syntheticEvent = {
1268
+ target: {
1269
+ value: e.currentTarget.value,
1270
+ name
1271
+ }
1272
+ };
1260
1273
  setTimeout(() => {
1261
- input.scrollLeft = input.scrollWidth;
1274
+ handleChange(syntheticEvent);
1262
1275
  }, 0);
1263
- }
1264
- };
1276
+ const input = inputRef.current?.input;
1277
+ if (input) {
1278
+ setTimeout(() => {
1279
+ input.scrollLeft = input.scrollWidth;
1280
+ }, 0);
1281
+ }
1282
+ },
1283
+ [handleChange, name]
1284
+ );
1265
1285
  const renderErrorMessage = () => {
1266
1286
  if (!errorMessage) return null;
1267
1287
  return /* @__PURE__ */ jsx(
@@ -1288,15 +1308,6 @@ const Input = (props) => {
1288
1308
  }
1289
1309
  return node;
1290
1310
  };
1291
- const handleChange = useCallback(
1292
- (e) => {
1293
- console.log(" ccccc:", e.target.value);
1294
- if (isComposing) return;
1295
- onChange?.(e);
1296
- afterOnChange?.(e.target.value);
1297
- },
1298
- [onChange, afterOnChange, isComposing]
1299
- );
1300
1311
  const renderInput = () => {
1301
1312
  const isNumberInput = type === "number" || type === "money";
1302
1313
  if (isNumberInput) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pnkx-lib/ui",
3
3
  "private": false,
4
- "version": "1.9.258",
4
+ "version": "1.9.260",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
7
7
  "module": "./es/index.js",