@apexcura/ui-components 0.0.5 → 0.0.7

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
@@ -92,47 +92,31 @@ var PasswordElement = ({ inputData }) => {
92
92
  // src/Components/NumberElement.tsx
93
93
  var import_react3 = __toESM(require("react"));
94
94
  var import_antd3 = require("antd");
95
- var formatNumber = (value) => new Intl.NumberFormat().format(value);
96
- var NumericInput = (props) => {
97
- const { value, onChange } = props;
98
- const handleChange = (e) => {
99
- const { value: inputValue } = e.target;
100
- const reg = /^-?\d*(\.\d*)?$/;
101
- if (reg.test(inputValue) || inputValue === "" || inputValue === "-") {
102
- onChange(inputValue);
103
- }
104
- };
105
- const handleBlur = () => {
106
- let valueTemp = value;
107
- if (value.charAt(value.length - 1) === "." || value === "-") {
108
- valueTemp = value.slice(0, -1);
109
- }
110
- onChange(valueTemp.replace(/0*(\d+)/, "$1"));
95
+ var NumberElement = (props) => {
96
+ const handleInputChange = (e) => {
97
+ const newValue = e.target.value.replace(/[^0-9]/g, "");
98
+ props.onChange(newValue);
111
99
  };
112
- 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(
100
+ return /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, /* @__PURE__ */ import_react3.default.createElement("label", { htmlFor: props.name }, props.label), /* @__PURE__ */ import_react3.default.createElement(
114
101
  import_antd3.Input,
115
102
  {
116
- ...props,
117
- onChange: handleChange,
118
- onBlur: handleBlur,
119
- placeholder: "Input a number",
120
- maxLength: 16
103
+ placeholder: props.placeholder,
104
+ addonBefore: props.addonBefore,
105
+ allowClear: true,
106
+ defaultValue: props.defaultValue,
107
+ disabled: props.disabled,
108
+ id: props.name,
109
+ prefix: props.prefix,
110
+ type: props.type,
111
+ status: props.status,
112
+ style: props.styles,
113
+ className: props.classNames,
114
+ variant: props.variant,
115
+ name: props.name,
116
+ onChange: handleInputChange
121
117
  }
122
118
  ));
123
119
  };
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
120
 
137
121
  // src/Components/TextareaElement.tsx
138
122
  var import_react4 = __toESM(require("react"));
@@ -174,22 +158,30 @@ var labelRender = (props) => {
174
158
  }
175
159
  return /* @__PURE__ */ import_react5.default.createElement("span", null, "select gender");
176
160
  };
177
- var SelectElement = (props) => /* @__PURE__ */ import_react5.default.createElement(
178
- import_antd5.Select,
179
- {
180
- labelRender,
181
- options,
182
- placeholder: props.placeholder,
183
- allowClear: true,
184
- defaultValue: props.defaultValue,
185
- disabled: props.disabled,
186
- id: props.name,
187
- status: props.status,
188
- style: props.styles,
189
- className: props.classNames,
190
- variant: props.variant
191
- }
192
- );
161
+ var SelectElement = (props) => {
162
+ const handleChange = (value) => {
163
+ if (props.onChange) {
164
+ props.onChange(value);
165
+ }
166
+ };
167
+ return /* @__PURE__ */ import_react5.default.createElement(
168
+ import_antd5.Select,
169
+ {
170
+ labelRender,
171
+ options,
172
+ placeholder: props.placeholder,
173
+ allowClear: true,
174
+ defaultValue: props.defaultValue,
175
+ disabled: props.disabled,
176
+ id: props.name,
177
+ status: props.status,
178
+ style: props.styles,
179
+ className: props.classNames,
180
+ variant: props.variant,
181
+ onChange: handleChange
182
+ }
183
+ );
184
+ };
193
185
 
194
186
  // src/Components/Button.tsx
195
187
  var import_react6 = __toESM(require("react"));
package/dist/index.mjs CHANGED
@@ -49,54 +49,38 @@ var PasswordElement = ({ inputData }) => {
49
49
  };
50
50
 
51
51
  // src/Components/NumberElement.tsx
52
- import React3, { useState as useState2 } from "react";
53
- import { Input as Input2, Tooltip } from "antd";
54
- var formatNumber = (value) => new Intl.NumberFormat().format(value);
55
- var NumericInput = (props) => {
56
- const { value, onChange } = props;
57
- const handleChange = (e) => {
58
- const { value: inputValue } = e.target;
59
- const reg = /^-?\d*(\.\d*)?$/;
60
- if (reg.test(inputValue) || inputValue === "" || inputValue === "-") {
61
- onChange(inputValue);
62
- }
63
- };
64
- const handleBlur = () => {
65
- let valueTemp = value;
66
- if (value.charAt(value.length - 1) === "." || value === "-") {
67
- valueTemp = value.slice(0, -1);
68
- }
69
- onChange(valueTemp.replace(/0*(\d+)/, "$1"));
52
+ import React3 from "react";
53
+ import { Input as AntInput2 } from "antd";
54
+ var NumberElement = (props) => {
55
+ const handleInputChange = (e) => {
56
+ const newValue = e.target.value.replace(/[^0-9]/g, "");
57
+ props.onChange(newValue);
70
58
  };
71
- 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
- Input2,
59
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("label", { htmlFor: props.name }, props.label), /* @__PURE__ */ React3.createElement(
60
+ AntInput2,
74
61
  {
75
- ...props,
76
- onChange: handleChange,
77
- onBlur: handleBlur,
78
- placeholder: "Input a number",
79
- maxLength: 16
62
+ placeholder: props.placeholder,
63
+ addonBefore: props.addonBefore,
64
+ allowClear: true,
65
+ defaultValue: props.defaultValue,
66
+ disabled: props.disabled,
67
+ id: props.name,
68
+ prefix: props.prefix,
69
+ type: props.type,
70
+ status: props.status,
71
+ style: props.styles,
72
+ className: props.classNames,
73
+ variant: props.variant,
74
+ name: props.name,
75
+ onChange: handleInputChange
80
76
  }
81
77
  ));
82
78
  };
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
79
 
96
80
  // src/Components/TextareaElement.tsx
97
81
  import React4 from "react";
98
- import { Flex, Input as Input3 } from "antd";
99
- var { TextArea } = Input3;
82
+ import { Flex, Input as Input2 } from "antd";
83
+ var { TextArea } = Input2;
100
84
  var TextareaElement = (props) => {
101
85
  return /* @__PURE__ */ React4.createElement(Flex, { vertical: true, gap: 32 }, /* @__PURE__ */ React4.createElement(
102
86
  TextArea,
@@ -133,22 +117,30 @@ var labelRender = (props) => {
133
117
  }
134
118
  return /* @__PURE__ */ React5.createElement("span", null, "select gender");
135
119
  };
136
- var SelectElement = (props) => /* @__PURE__ */ React5.createElement(
137
- Select,
138
- {
139
- labelRender,
140
- options,
141
- placeholder: props.placeholder,
142
- allowClear: true,
143
- defaultValue: props.defaultValue,
144
- disabled: props.disabled,
145
- id: props.name,
146
- status: props.status,
147
- style: props.styles,
148
- className: props.classNames,
149
- variant: props.variant
150
- }
151
- );
120
+ var SelectElement = (props) => {
121
+ const handleChange = (value) => {
122
+ if (props.onChange) {
123
+ props.onChange(value);
124
+ }
125
+ };
126
+ return /* @__PURE__ */ React5.createElement(
127
+ Select,
128
+ {
129
+ labelRender,
130
+ options,
131
+ placeholder: props.placeholder,
132
+ allowClear: true,
133
+ defaultValue: props.defaultValue,
134
+ disabled: props.disabled,
135
+ id: props.name,
136
+ status: props.status,
137
+ style: props.styles,
138
+ className: props.classNames,
139
+ variant: props.variant,
140
+ onChange: handleChange
141
+ }
142
+ );
143
+ };
152
144
 
153
145
  // src/Components/Button.tsx
154
146
  import React6 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.7",
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/",