ar-design 0.3.1 → 0.3.2

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.
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import React, { useMemo, useRef, useState } from "react";
2
+ import React, { useEffect, useMemo, useRef, useState } from "react";
3
3
  import Input from "../input";
4
4
  const InputNumber = ({ ...attributes }) => {
5
5
  // refs
@@ -7,7 +7,7 @@ const InputNumber = ({ ...attributes }) => {
7
7
  const _caretPosition = useRef(null);
8
8
  const _isInputTouch = useRef(false);
9
9
  // states
10
- const [value, setValue] = useState(null);
10
+ const [value, setValue] = useState("");
11
11
  // methods
12
12
  const handleChange = (event) => {
13
13
  let { value } = event.target;
@@ -59,6 +59,11 @@ const InputNumber = ({ ...attributes }) => {
59
59
  maximumFractionDigits: isDecimals ? 2 : 0,
60
60
  });
61
61
  }, []);
62
+ // useEffects
63
+ useEffect(() => {
64
+ if (attributes.value !== undefined)
65
+ setValue(attributes.value ?? "");
66
+ }, [attributes.value]);
62
67
  return (React.createElement(Input, { ref: _input, ...attributes, value: value ?? attributes.value, onChange: (event) => {
63
68
  // Disabled gelmesi durumunda işlem yapmasına izin verme...
64
69
  if (attributes.disabled)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",