tabler-react-2 0.1.21 → 0.1.22

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.
@@ -27,7 +27,8 @@ var Input = exports.Input = function Input(_ref) {
27
27
  type = _ref$type === void 0 ? "text" : _ref$type,
28
28
  label = _ref.label,
29
29
  placeholder = _ref.placeholder,
30
- controlledValue = _ref.value,
30
+ _ref$value = _ref.value,
31
+ controlledValue = _ref$value === void 0 ? "" : _ref$value,
31
32
  onChange = _ref.onChange,
32
33
  onInput = _ref.onInput,
33
34
  icon = _ref.icon,
@@ -46,12 +47,16 @@ var Input = exports.Input = function Input(_ref) {
46
47
  size = _ref.size,
47
48
  props = _objectWithoutProperties(_ref, _excluded);
48
49
  // State for managing uncontrolled input value
49
- var _useState = (0, _react.useState)(controlledValue || ""),
50
+ var _useState = (0, _react.useState)(controlledValue),
50
51
  _useState2 = _slicedToArray(_useState, 2),
51
52
  value = _useState2[0],
52
53
  setValue = _useState2[1];
54
+
55
+ // Sync internal state with the controlled value prop
53
56
  (0, _react.useEffect)(function () {
54
- setValue(controlledValue);
57
+ if (controlledValue !== undefined) {
58
+ setValue(controlledValue);
59
+ }
55
60
  }, [controlledValue]);
56
61
  var handleInputChange = function handleInputChange(e) {
57
62
  setValue(e.target.value);
@@ -71,7 +76,8 @@ var Input = exports.Input = function Input(_ref) {
71
76
  type: type,
72
77
  className: (0, _classnames["default"])("form-control", variant && "border-".concat(variant), variant && "text-".concat(variant), variant && "bg-".concat(variant, "-lt"), size && "form-control-".concat(size)),
73
78
  placeholder: placeholder,
74
- value: value,
79
+ value: value !== null && value !== void 0 ? value : "" // Always ensure value is a string
80
+ ,
75
81
  onChange: handleInputChange,
76
82
  list: datalistItems.length > 0 ? "datalist-options" : undefined
77
83
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tabler-react-2",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "description": "A react implementation of Tabler ui",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {