@apexcura/ui-components 0.0.5 → 0.0.6

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.d.mts CHANGED
@@ -19,10 +19,10 @@ type ElementType = {
19
19
  onChange?: (value: string | number | boolean) => void;
20
20
  };
21
21
 
22
- interface ElementExecuterProps$1 extends ElementType {
22
+ interface ElementExecuterProps$2 extends ElementType {
23
23
  onChange: (value: string | number | boolean) => void;
24
24
  }
25
- declare const TextElement: (props: ElementExecuterProps$1) => React$1.JSX.Element;
25
+ declare const TextElement: (props: ElementExecuterProps$2) => React$1.JSX.Element;
26
26
 
27
27
  interface InputData {
28
28
  placeholder?: string;
@@ -36,7 +36,10 @@ interface PasswordProps {
36
36
  }
37
37
  declare const PasswordElement: React$1.FC<PasswordProps>;
38
38
 
39
- declare const NumberElement: (props: ElementType) => React$1.JSX.Element;
39
+ interface ElementExecuterProps$1 extends ElementType {
40
+ onChange: (value: string | number | boolean) => void;
41
+ }
42
+ declare const NumberElement: (props: ElementExecuterProps$1) => React$1.JSX.Element;
40
43
 
41
44
  interface ElementExecuterProps extends ElementType {
42
45
  onChange: (value: string | number | boolean) => void;
package/dist/index.d.ts CHANGED
@@ -19,10 +19,10 @@ type ElementType = {
19
19
  onChange?: (value: string | number | boolean) => void;
20
20
  };
21
21
 
22
- interface ElementExecuterProps$1 extends ElementType {
22
+ interface ElementExecuterProps$2 extends ElementType {
23
23
  onChange: (value: string | number | boolean) => void;
24
24
  }
25
- declare const TextElement: (props: ElementExecuterProps$1) => React$1.JSX.Element;
25
+ declare const TextElement: (props: ElementExecuterProps$2) => React$1.JSX.Element;
26
26
 
27
27
  interface InputData {
28
28
  placeholder?: string;
@@ -36,7 +36,10 @@ interface PasswordProps {
36
36
  }
37
37
  declare const PasswordElement: React$1.FC<PasswordProps>;
38
38
 
39
- declare const NumberElement: (props: ElementType) => React$1.JSX.Element;
39
+ interface ElementExecuterProps$1 extends ElementType {
40
+ onChange: (value: string | number | boolean) => void;
41
+ }
42
+ declare const NumberElement: (props: ElementExecuterProps$1) => React$1.JSX.Element;
40
43
 
41
44
  interface ElementExecuterProps extends ElementType {
42
45
  onChange: (value: string | number | boolean) => void;
package/dist/index.js CHANGED
@@ -93,7 +93,7 @@ var PasswordElement = ({ inputData }) => {
93
93
  var import_react3 = __toESM(require("react"));
94
94
  var import_antd3 = require("antd");
95
95
  var formatNumber = (value) => new Intl.NumberFormat().format(value);
96
- var NumericInput = (props) => {
96
+ var NumberElement = (props) => {
97
97
  const { value, onChange } = props;
98
98
  const handleChange = (e) => {
99
99
  const { value: inputValue } = e.target;
@@ -103,36 +103,23 @@ var NumericInput = (props) => {
103
103
  }
104
104
  };
105
105
  const handleBlur = () => {
106
- let valueTemp = value;
107
- if (value.charAt(value.length - 1) === "." || value === "-") {
108
- valueTemp = value.slice(0, -1);
106
+ let val = String({ value });
107
+ let valueTemp = val;
108
+ if (val.charAt(val.length - 1) === "." || value === "-") {
109
+ valueTemp = val.slice(0, -1);
109
110
  }
110
111
  onChange(valueTemp.replace(/0*(\d+)/, "$1"));
111
112
  };
112
113
  const title = value ? /* @__PURE__ */ import_react3.default.createElement("span", { className: "numeric-input-title" }, value !== "-" ? formatNumber(Number(value)) : "-") : "Input a number";
113
- return /* @__PURE__ */ import_react3.default.createElement(import_antd3.Tooltip, { trigger: ["focus"], title, placement: "topLeft", overlayClassName: "numeric-input" }, /* @__PURE__ */ import_react3.default.createElement(
114
+ return /* @__PURE__ */ import_react3.default.createElement(import_antd3.Tooltip, { title }, /* @__PURE__ */ import_react3.default.createElement(
114
115
  import_antd3.Input,
115
116
  {
116
- ...props,
117
117
  onChange: handleChange,
118
118
  onBlur: handleBlur,
119
- placeholder: "Input a number",
120
119
  maxLength: 16
121
120
  }
122
121
  ));
123
122
  };
124
- var NumberElement = (props) => {
125
- const [value, setValue] = (0, import_react3.useState)("");
126
- return /* @__PURE__ */ import_react3.default.createElement(
127
- NumericInput,
128
- {
129
- ...props,
130
- style: { width: 120 },
131
- value,
132
- onChange: setValue
133
- }
134
- );
135
- };
136
123
 
137
124
  // src/Components/TextareaElement.tsx
138
125
  var import_react4 = __toESM(require("react"));
package/dist/index.mjs CHANGED
@@ -49,10 +49,10 @@ var PasswordElement = ({ inputData }) => {
49
49
  };
50
50
 
51
51
  // src/Components/NumberElement.tsx
52
- import React3, { useState as useState2 } from "react";
52
+ import React3 from "react";
53
53
  import { Input as Input2, Tooltip } from "antd";
54
54
  var formatNumber = (value) => new Intl.NumberFormat().format(value);
55
- var NumericInput = (props) => {
55
+ var NumberElement = (props) => {
56
56
  const { value, onChange } = props;
57
57
  const handleChange = (e) => {
58
58
  const { value: inputValue } = e.target;
@@ -62,36 +62,23 @@ var NumericInput = (props) => {
62
62
  }
63
63
  };
64
64
  const handleBlur = () => {
65
- let valueTemp = value;
66
- if (value.charAt(value.length - 1) === "." || value === "-") {
67
- valueTemp = value.slice(0, -1);
65
+ let val = String({ value });
66
+ let valueTemp = val;
67
+ if (val.charAt(val.length - 1) === "." || value === "-") {
68
+ valueTemp = val.slice(0, -1);
68
69
  }
69
70
  onChange(valueTemp.replace(/0*(\d+)/, "$1"));
70
71
  };
71
72
  const title = value ? /* @__PURE__ */ React3.createElement("span", { className: "numeric-input-title" }, value !== "-" ? formatNumber(Number(value)) : "-") : "Input a number";
72
- return /* @__PURE__ */ React3.createElement(Tooltip, { trigger: ["focus"], title, placement: "topLeft", overlayClassName: "numeric-input" }, /* @__PURE__ */ React3.createElement(
73
+ return /* @__PURE__ */ React3.createElement(Tooltip, { title }, /* @__PURE__ */ React3.createElement(
73
74
  Input2,
74
75
  {
75
- ...props,
76
76
  onChange: handleChange,
77
77
  onBlur: handleBlur,
78
- placeholder: "Input a number",
79
78
  maxLength: 16
80
79
  }
81
80
  ));
82
81
  };
83
- var NumberElement = (props) => {
84
- const [value, setValue] = useState2("");
85
- return /* @__PURE__ */ React3.createElement(
86
- NumericInput,
87
- {
88
- ...props,
89
- style: { width: 120 },
90
- value,
91
- onChange: setValue
92
- }
93
- );
94
- };
95
82
 
96
83
  // src/Components/TextareaElement.tsx
97
84
  import React4 from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords" : ["apex cura", "input", "ui", "react", "react-component"],
6
6
  "homepage": "https://www.apexcura.com/",