@apexcura/ui-components 0.0.6 → 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.js CHANGED
@@ -92,31 +92,28 @@ 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
95
  var NumberElement = (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 val = String({ value });
107
- let valueTemp = val;
108
- if (val.charAt(val.length - 1) === "." || value === "-") {
109
- valueTemp = val.slice(0, -1);
110
- }
111
- onChange(valueTemp.replace(/0*(\d+)/, "$1"));
96
+ const handleInputChange = (e) => {
97
+ const newValue = e.target.value.replace(/[^0-9]/g, "");
98
+ props.onChange(newValue);
112
99
  };
113
- const title = value ? /* @__PURE__ */ import_react3.default.createElement("span", { className: "numeric-input-title" }, value !== "-" ? formatNumber(Number(value)) : "-") : "Input a number";
114
- return /* @__PURE__ */ import_react3.default.createElement(import_antd3.Tooltip, { title }, /* @__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(
115
101
  import_antd3.Input,
116
102
  {
117
- onChange: handleChange,
118
- onBlur: handleBlur,
119
- 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
120
117
  }
121
118
  ));
122
119
  };
@@ -161,22 +158,30 @@ var labelRender = (props) => {
161
158
  }
162
159
  return /* @__PURE__ */ import_react5.default.createElement("span", null, "select gender");
163
160
  };
164
- var SelectElement = (props) => /* @__PURE__ */ import_react5.default.createElement(
165
- import_antd5.Select,
166
- {
167
- labelRender,
168
- options,
169
- placeholder: props.placeholder,
170
- allowClear: true,
171
- defaultValue: props.defaultValue,
172
- disabled: props.disabled,
173
- id: props.name,
174
- status: props.status,
175
- style: props.styles,
176
- className: props.classNames,
177
- variant: props.variant
178
- }
179
- );
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
+ };
180
185
 
181
186
  // src/Components/Button.tsx
182
187
  var import_react6 = __toESM(require("react"));
package/dist/index.mjs CHANGED
@@ -50,40 +50,37 @@ var PasswordElement = ({ inputData }) => {
50
50
 
51
51
  // src/Components/NumberElement.tsx
52
52
  import React3 from "react";
53
- import { Input as Input2, Tooltip } from "antd";
54
- var formatNumber = (value) => new Intl.NumberFormat().format(value);
53
+ import { Input as AntInput2 } from "antd";
55
54
  var NumberElement = (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 val = String({ value });
66
- let valueTemp = val;
67
- if (val.charAt(val.length - 1) === "." || value === "-") {
68
- valueTemp = val.slice(0, -1);
69
- }
70
- onChange(valueTemp.replace(/0*(\d+)/, "$1"));
55
+ const handleInputChange = (e) => {
56
+ const newValue = e.target.value.replace(/[^0-9]/g, "");
57
+ props.onChange(newValue);
71
58
  };
72
- const title = value ? /* @__PURE__ */ React3.createElement("span", { className: "numeric-input-title" }, value !== "-" ? formatNumber(Number(value)) : "-") : "Input a number";
73
- return /* @__PURE__ */ React3.createElement(Tooltip, { title }, /* @__PURE__ */ React3.createElement(
74
- Input2,
59
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("label", { htmlFor: props.name }, props.label), /* @__PURE__ */ React3.createElement(
60
+ AntInput2,
75
61
  {
76
- onChange: handleChange,
77
- onBlur: handleBlur,
78
- 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
79
76
  }
80
77
  ));
81
78
  };
82
79
 
83
80
  // src/Components/TextareaElement.tsx
84
81
  import React4 from "react";
85
- import { Flex, Input as Input3 } from "antd";
86
- var { TextArea } = Input3;
82
+ import { Flex, Input as Input2 } from "antd";
83
+ var { TextArea } = Input2;
87
84
  var TextareaElement = (props) => {
88
85
  return /* @__PURE__ */ React4.createElement(Flex, { vertical: true, gap: 32 }, /* @__PURE__ */ React4.createElement(
89
86
  TextArea,
@@ -120,22 +117,30 @@ var labelRender = (props) => {
120
117
  }
121
118
  return /* @__PURE__ */ React5.createElement("span", null, "select gender");
122
119
  };
123
- var SelectElement = (props) => /* @__PURE__ */ React5.createElement(
124
- Select,
125
- {
126
- labelRender,
127
- options,
128
- placeholder: props.placeholder,
129
- allowClear: true,
130
- defaultValue: props.defaultValue,
131
- disabled: props.disabled,
132
- id: props.name,
133
- status: props.status,
134
- style: props.styles,
135
- className: props.classNames,
136
- variant: props.variant
137
- }
138
- );
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
+ };
139
144
 
140
145
  // src/Components/Button.tsx
141
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.6",
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/",