@apexcura/ui-components 0.0.4 → 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 +16 -5
- package/dist/index.d.ts +16 -5
- package/dist/index.js +25 -53
- package/dist/index.mjs +31 -60
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ type ElementType = {
|
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
prefix?: React.ReactNode;
|
|
9
9
|
type?: string;
|
|
10
|
-
value?: string;
|
|
10
|
+
value?: string | number | boolean | undefined;
|
|
11
11
|
status?: "error" | "warning";
|
|
12
12
|
styles?: React.CSSProperties;
|
|
13
13
|
classNames?: string;
|
|
@@ -19,7 +19,10 @@ type ElementType = {
|
|
|
19
19
|
onChange?: (value: string | number | boolean) => void;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
interface ElementExecuterProps$2 extends ElementType {
|
|
23
|
+
onChange: (value: string | number | boolean) => void;
|
|
24
|
+
}
|
|
25
|
+
declare const TextElement: (props: ElementExecuterProps$2) => React$1.JSX.Element;
|
|
23
26
|
|
|
24
27
|
interface InputData {
|
|
25
28
|
placeholder?: string;
|
|
@@ -33,10 +36,18 @@ interface PasswordProps {
|
|
|
33
36
|
}
|
|
34
37
|
declare const PasswordElement: React$1.FC<PasswordProps>;
|
|
35
38
|
|
|
36
|
-
|
|
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;
|
|
37
43
|
|
|
38
|
-
|
|
44
|
+
interface ElementExecuterProps extends ElementType {
|
|
45
|
+
onChange: (value: string | number | boolean) => void;
|
|
46
|
+
}
|
|
47
|
+
declare const TextareaElement: (props: ElementExecuterProps) => React$1.JSX.Element;
|
|
39
48
|
|
|
40
49
|
declare const SelectElement: (props: ElementType) => React$1.JSX.Element;
|
|
41
50
|
|
|
42
|
-
|
|
51
|
+
declare const ButtonElement: () => React$1.JSX.Element;
|
|
52
|
+
|
|
53
|
+
export { ButtonElement, NumberElement, PasswordElement, SelectElement, TextElement, TextareaElement };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ type ElementType = {
|
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
prefix?: React.ReactNode;
|
|
9
9
|
type?: string;
|
|
10
|
-
value?: string;
|
|
10
|
+
value?: string | number | boolean | undefined;
|
|
11
11
|
status?: "error" | "warning";
|
|
12
12
|
styles?: React.CSSProperties;
|
|
13
13
|
classNames?: string;
|
|
@@ -19,7 +19,10 @@ type ElementType = {
|
|
|
19
19
|
onChange?: (value: string | number | boolean) => void;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
interface ElementExecuterProps$2 extends ElementType {
|
|
23
|
+
onChange: (value: string | number | boolean) => void;
|
|
24
|
+
}
|
|
25
|
+
declare const TextElement: (props: ElementExecuterProps$2) => React$1.JSX.Element;
|
|
23
26
|
|
|
24
27
|
interface InputData {
|
|
25
28
|
placeholder?: string;
|
|
@@ -33,10 +36,18 @@ interface PasswordProps {
|
|
|
33
36
|
}
|
|
34
37
|
declare const PasswordElement: React$1.FC<PasswordProps>;
|
|
35
38
|
|
|
36
|
-
|
|
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;
|
|
37
43
|
|
|
38
|
-
|
|
44
|
+
interface ElementExecuterProps extends ElementType {
|
|
45
|
+
onChange: (value: string | number | boolean) => void;
|
|
46
|
+
}
|
|
47
|
+
declare const TextareaElement: (props: ElementExecuterProps) => React$1.JSX.Element;
|
|
39
48
|
|
|
40
49
|
declare const SelectElement: (props: ElementType) => React$1.JSX.Element;
|
|
41
50
|
|
|
42
|
-
|
|
51
|
+
declare const ButtonElement: () => React$1.JSX.Element;
|
|
52
|
+
|
|
53
|
+
export { ButtonElement, NumberElement, PasswordElement, SelectElement, TextElement, TextareaElement };
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
ButtonElement: () => ButtonElement,
|
|
33
34
|
NumberElement: () => NumberElement,
|
|
34
35
|
PasswordElement: () => PasswordElement,
|
|
35
36
|
SelectElement: () => SelectElement,
|
|
@@ -42,13 +43,6 @@ module.exports = __toCommonJS(src_exports);
|
|
|
42
43
|
var import_react = __toESM(require("react"));
|
|
43
44
|
var import_antd = require("antd");
|
|
44
45
|
var TextElement = (props) => {
|
|
45
|
-
const [text, setText] = (0, import_react.useState)(props.value || "");
|
|
46
|
-
const onHandleChange = (e) => {
|
|
47
|
-
setText(e.target.value);
|
|
48
|
-
if (props.onChange) {
|
|
49
|
-
props.onChange(text);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
46
|
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("label", { htmlFor: props.name }, props.label), /* @__PURE__ */ import_react.default.createElement(
|
|
53
47
|
import_antd.Input,
|
|
54
48
|
{
|
|
@@ -60,13 +54,12 @@ var TextElement = (props) => {
|
|
|
60
54
|
id: props.name,
|
|
61
55
|
prefix: props.prefix,
|
|
62
56
|
type: props.type,
|
|
63
|
-
value: props.value,
|
|
64
57
|
status: props.status,
|
|
65
58
|
style: props.styles,
|
|
66
59
|
className: props.classNames,
|
|
67
60
|
variant: props.variant,
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
name: props.name,
|
|
62
|
+
onChange: (e) => props.onChange(e.target.value)
|
|
70
63
|
}
|
|
71
64
|
));
|
|
72
65
|
};
|
|
@@ -100,7 +93,7 @@ var PasswordElement = ({ inputData }) => {
|
|
|
100
93
|
var import_react3 = __toESM(require("react"));
|
|
101
94
|
var import_antd3 = require("antd");
|
|
102
95
|
var formatNumber = (value) => new Intl.NumberFormat().format(value);
|
|
103
|
-
var
|
|
96
|
+
var NumberElement = (props) => {
|
|
104
97
|
const { value, onChange } = props;
|
|
105
98
|
const handleChange = (e) => {
|
|
106
99
|
const { value: inputValue } = e.target;
|
|
@@ -110,49 +103,29 @@ var NumericInput = (props) => {
|
|
|
110
103
|
}
|
|
111
104
|
};
|
|
112
105
|
const handleBlur = () => {
|
|
113
|
-
let
|
|
114
|
-
|
|
115
|
-
|
|
106
|
+
let val = String({ value });
|
|
107
|
+
let valueTemp = val;
|
|
108
|
+
if (val.charAt(val.length - 1) === "." || value === "-") {
|
|
109
|
+
valueTemp = val.slice(0, -1);
|
|
116
110
|
}
|
|
117
111
|
onChange(valueTemp.replace(/0*(\d+)/, "$1"));
|
|
118
112
|
};
|
|
119
113
|
const title = value ? /* @__PURE__ */ import_react3.default.createElement("span", { className: "numeric-input-title" }, value !== "-" ? formatNumber(Number(value)) : "-") : "Input a number";
|
|
120
|
-
return /* @__PURE__ */ import_react3.default.createElement(import_antd3.Tooltip, {
|
|
114
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_antd3.Tooltip, { title }, /* @__PURE__ */ import_react3.default.createElement(
|
|
121
115
|
import_antd3.Input,
|
|
122
116
|
{
|
|
123
|
-
...props,
|
|
124
117
|
onChange: handleChange,
|
|
125
118
|
onBlur: handleBlur,
|
|
126
|
-
placeholder: "Input a number",
|
|
127
119
|
maxLength: 16
|
|
128
120
|
}
|
|
129
121
|
));
|
|
130
122
|
};
|
|
131
|
-
var NumberElement = (props) => {
|
|
132
|
-
const [value, setValue] = (0, import_react3.useState)("");
|
|
133
|
-
return /* @__PURE__ */ import_react3.default.createElement(
|
|
134
|
-
NumericInput,
|
|
135
|
-
{
|
|
136
|
-
...props,
|
|
137
|
-
style: { width: 120 },
|
|
138
|
-
value,
|
|
139
|
-
onChange: setValue
|
|
140
|
-
}
|
|
141
|
-
);
|
|
142
|
-
};
|
|
143
123
|
|
|
144
124
|
// src/Components/TextareaElement.tsx
|
|
145
125
|
var import_react4 = __toESM(require("react"));
|
|
146
126
|
var import_antd4 = require("antd");
|
|
147
127
|
var { TextArea } = import_antd4.Input;
|
|
148
128
|
var TextareaElement = (props) => {
|
|
149
|
-
const [textarea, setTextarea] = (0, import_react4.useState)(props.value || "");
|
|
150
|
-
const onHandleChange = (e) => {
|
|
151
|
-
setTextarea(e.target.value);
|
|
152
|
-
if (props.onChange) {
|
|
153
|
-
props.onChange(textarea);
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
129
|
return /* @__PURE__ */ import_react4.default.createElement(import_antd4.Flex, { vertical: true, gap: 32 }, /* @__PURE__ */ import_react4.default.createElement(
|
|
157
130
|
TextArea,
|
|
158
131
|
{
|
|
@@ -161,7 +134,6 @@ var TextareaElement = (props) => {
|
|
|
161
134
|
defaultValue: props.defaultValue,
|
|
162
135
|
disabled: props.disabled,
|
|
163
136
|
id: props.name,
|
|
164
|
-
value: props.value,
|
|
165
137
|
status: props.status,
|
|
166
138
|
style: props.styles,
|
|
167
139
|
className: props.classNames,
|
|
@@ -169,7 +141,7 @@ var TextareaElement = (props) => {
|
|
|
169
141
|
name: props.name,
|
|
170
142
|
showCount: true,
|
|
171
143
|
maxLength: props.maxLength,
|
|
172
|
-
onChange:
|
|
144
|
+
onChange: (e) => props.onChange(e.target.value)
|
|
173
145
|
}
|
|
174
146
|
));
|
|
175
147
|
};
|
|
@@ -178,41 +150,41 @@ var TextareaElement = (props) => {
|
|
|
178
150
|
var import_react5 = __toESM(require("react"));
|
|
179
151
|
var import_antd5 = require("antd");
|
|
180
152
|
var options = [
|
|
181
|
-
{
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
value: "female",
|
|
187
|
-
label: "female"
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
value: "other",
|
|
191
|
-
label: "other"
|
|
192
|
-
}
|
|
153
|
+
{ label: "female", value: "female" },
|
|
154
|
+
{ label: "male", value: "male" },
|
|
155
|
+
{ label: "other", value: "other" }
|
|
193
156
|
];
|
|
157
|
+
var labelRender = (props) => {
|
|
158
|
+
const { label, value } = props;
|
|
159
|
+
if (label) {
|
|
160
|
+
return value;
|
|
161
|
+
}
|
|
162
|
+
return /* @__PURE__ */ import_react5.default.createElement("span", null, "select gender");
|
|
163
|
+
};
|
|
194
164
|
var SelectElement = (props) => /* @__PURE__ */ import_react5.default.createElement(
|
|
195
165
|
import_antd5.Select,
|
|
196
166
|
{
|
|
167
|
+
labelRender,
|
|
168
|
+
options,
|
|
197
169
|
placeholder: props.placeholder,
|
|
198
170
|
allowClear: true,
|
|
199
171
|
defaultValue: props.defaultValue,
|
|
200
172
|
disabled: props.disabled,
|
|
201
173
|
id: props.name,
|
|
202
|
-
value: props.value,
|
|
203
174
|
status: props.status,
|
|
204
175
|
style: props.styles,
|
|
205
176
|
className: props.classNames,
|
|
206
|
-
variant: props.variant
|
|
207
|
-
options
|
|
177
|
+
variant: props.variant
|
|
208
178
|
}
|
|
209
179
|
);
|
|
210
180
|
|
|
211
181
|
// src/Components/Button.tsx
|
|
212
182
|
var import_react6 = __toESM(require("react"));
|
|
213
183
|
var import_antd6 = require("antd");
|
|
184
|
+
var ButtonElement = () => /* @__PURE__ */ import_react6.default.createElement(import_antd6.Flex, { gap: "small" }, /* @__PURE__ */ import_react6.default.createElement(import_antd6.Button, { type: "primary" }, "Primary Button"));
|
|
214
185
|
// Annotate the CommonJS export names for ESM import in node:
|
|
215
186
|
0 && (module.exports = {
|
|
187
|
+
ButtonElement,
|
|
216
188
|
NumberElement,
|
|
217
189
|
PasswordElement,
|
|
218
190
|
SelectElement,
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
// src/Components/TextElement.tsx
|
|
2
|
-
import React
|
|
2
|
+
import React from "react";
|
|
3
3
|
import { Input as AntInput } from "antd";
|
|
4
4
|
var TextElement = (props) => {
|
|
5
|
-
const [text, setText] = useState(props.value || "");
|
|
6
|
-
const onHandleChange = (e) => {
|
|
7
|
-
setText(e.target.value);
|
|
8
|
-
if (props.onChange) {
|
|
9
|
-
props.onChange(text);
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
5
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("label", { htmlFor: props.name }, props.label), /* @__PURE__ */ React.createElement(
|
|
13
6
|
AntInput,
|
|
14
7
|
{
|
|
@@ -20,23 +13,22 @@ var TextElement = (props) => {
|
|
|
20
13
|
id: props.name,
|
|
21
14
|
prefix: props.prefix,
|
|
22
15
|
type: props.type,
|
|
23
|
-
value: props.value,
|
|
24
16
|
status: props.status,
|
|
25
17
|
style: props.styles,
|
|
26
18
|
className: props.classNames,
|
|
27
19
|
variant: props.variant,
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
name: props.name,
|
|
21
|
+
onChange: (e) => props.onChange(e.target.value)
|
|
30
22
|
}
|
|
31
23
|
));
|
|
32
24
|
};
|
|
33
25
|
|
|
34
26
|
// src/Components/PasswordElement.tsx
|
|
35
|
-
import React2, { useState
|
|
27
|
+
import React2, { useState } from "react";
|
|
36
28
|
import { EyeInvisibleOutlined, EyeTwoTone } from "@ant-design/icons";
|
|
37
29
|
import { Button, Input, Space } from "antd";
|
|
38
30
|
var PasswordElement = ({ inputData }) => {
|
|
39
|
-
const [passwordVisible, setPasswordVisible] =
|
|
31
|
+
const [passwordVisible, setPasswordVisible] = useState(false);
|
|
40
32
|
const handleVisibilityToggle = () => {
|
|
41
33
|
setPasswordVisible((prev) => !prev);
|
|
42
34
|
};
|
|
@@ -57,10 +49,10 @@ var PasswordElement = ({ inputData }) => {
|
|
|
57
49
|
};
|
|
58
50
|
|
|
59
51
|
// src/Components/NumberElement.tsx
|
|
60
|
-
import React3
|
|
52
|
+
import React3 from "react";
|
|
61
53
|
import { Input as Input2, Tooltip } from "antd";
|
|
62
54
|
var formatNumber = (value) => new Intl.NumberFormat().format(value);
|
|
63
|
-
var
|
|
55
|
+
var NumberElement = (props) => {
|
|
64
56
|
const { value, onChange } = props;
|
|
65
57
|
const handleChange = (e) => {
|
|
66
58
|
const { value: inputValue } = e.target;
|
|
@@ -70,49 +62,29 @@ var NumericInput = (props) => {
|
|
|
70
62
|
}
|
|
71
63
|
};
|
|
72
64
|
const handleBlur = () => {
|
|
73
|
-
let
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
let val = String({ value });
|
|
66
|
+
let valueTemp = val;
|
|
67
|
+
if (val.charAt(val.length - 1) === "." || value === "-") {
|
|
68
|
+
valueTemp = val.slice(0, -1);
|
|
76
69
|
}
|
|
77
70
|
onChange(valueTemp.replace(/0*(\d+)/, "$1"));
|
|
78
71
|
};
|
|
79
72
|
const title = value ? /* @__PURE__ */ React3.createElement("span", { className: "numeric-input-title" }, value !== "-" ? formatNumber(Number(value)) : "-") : "Input a number";
|
|
80
|
-
return /* @__PURE__ */ React3.createElement(Tooltip, {
|
|
73
|
+
return /* @__PURE__ */ React3.createElement(Tooltip, { title }, /* @__PURE__ */ React3.createElement(
|
|
81
74
|
Input2,
|
|
82
75
|
{
|
|
83
|
-
...props,
|
|
84
76
|
onChange: handleChange,
|
|
85
77
|
onBlur: handleBlur,
|
|
86
|
-
placeholder: "Input a number",
|
|
87
78
|
maxLength: 16
|
|
88
79
|
}
|
|
89
80
|
));
|
|
90
81
|
};
|
|
91
|
-
var NumberElement = (props) => {
|
|
92
|
-
const [value, setValue] = useState3("");
|
|
93
|
-
return /* @__PURE__ */ React3.createElement(
|
|
94
|
-
NumericInput,
|
|
95
|
-
{
|
|
96
|
-
...props,
|
|
97
|
-
style: { width: 120 },
|
|
98
|
-
value,
|
|
99
|
-
onChange: setValue
|
|
100
|
-
}
|
|
101
|
-
);
|
|
102
|
-
};
|
|
103
82
|
|
|
104
83
|
// src/Components/TextareaElement.tsx
|
|
105
|
-
import React4
|
|
84
|
+
import React4 from "react";
|
|
106
85
|
import { Flex, Input as Input3 } from "antd";
|
|
107
86
|
var { TextArea } = Input3;
|
|
108
87
|
var TextareaElement = (props) => {
|
|
109
|
-
const [textarea, setTextarea] = useState4(props.value || "");
|
|
110
|
-
const onHandleChange = (e) => {
|
|
111
|
-
setTextarea(e.target.value);
|
|
112
|
-
if (props.onChange) {
|
|
113
|
-
props.onChange(textarea);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
88
|
return /* @__PURE__ */ React4.createElement(Flex, { vertical: true, gap: 32 }, /* @__PURE__ */ React4.createElement(
|
|
117
89
|
TextArea,
|
|
118
90
|
{
|
|
@@ -121,7 +93,6 @@ var TextareaElement = (props) => {
|
|
|
121
93
|
defaultValue: props.defaultValue,
|
|
122
94
|
disabled: props.disabled,
|
|
123
95
|
id: props.name,
|
|
124
|
-
value: props.value,
|
|
125
96
|
status: props.status,
|
|
126
97
|
style: props.styles,
|
|
127
98
|
className: props.classNames,
|
|
@@ -129,49 +100,49 @@ var TextareaElement = (props) => {
|
|
|
129
100
|
name: props.name,
|
|
130
101
|
showCount: true,
|
|
131
102
|
maxLength: props.maxLength,
|
|
132
|
-
onChange:
|
|
103
|
+
onChange: (e) => props.onChange(e.target.value)
|
|
133
104
|
}
|
|
134
105
|
));
|
|
135
106
|
};
|
|
136
107
|
|
|
137
108
|
// src/Components/SelectElement.tsx
|
|
138
109
|
import React5 from "react";
|
|
139
|
-
import { Select
|
|
110
|
+
import { Select } from "antd";
|
|
140
111
|
var options = [
|
|
141
|
-
{
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
value: "female",
|
|
147
|
-
label: "female"
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
value: "other",
|
|
151
|
-
label: "other"
|
|
152
|
-
}
|
|
112
|
+
{ label: "female", value: "female" },
|
|
113
|
+
{ label: "male", value: "male" },
|
|
114
|
+
{ label: "other", value: "other" }
|
|
153
115
|
];
|
|
116
|
+
var labelRender = (props) => {
|
|
117
|
+
const { label, value } = props;
|
|
118
|
+
if (label) {
|
|
119
|
+
return value;
|
|
120
|
+
}
|
|
121
|
+
return /* @__PURE__ */ React5.createElement("span", null, "select gender");
|
|
122
|
+
};
|
|
154
123
|
var SelectElement = (props) => /* @__PURE__ */ React5.createElement(
|
|
155
|
-
|
|
124
|
+
Select,
|
|
156
125
|
{
|
|
126
|
+
labelRender,
|
|
127
|
+
options,
|
|
157
128
|
placeholder: props.placeholder,
|
|
158
129
|
allowClear: true,
|
|
159
130
|
defaultValue: props.defaultValue,
|
|
160
131
|
disabled: props.disabled,
|
|
161
132
|
id: props.name,
|
|
162
|
-
value: props.value,
|
|
163
133
|
status: props.status,
|
|
164
134
|
style: props.styles,
|
|
165
135
|
className: props.classNames,
|
|
166
|
-
variant: props.variant
|
|
167
|
-
options
|
|
136
|
+
variant: props.variant
|
|
168
137
|
}
|
|
169
138
|
);
|
|
170
139
|
|
|
171
140
|
// src/Components/Button.tsx
|
|
172
141
|
import React6 from "react";
|
|
173
142
|
import { Button as Button2, Flex as Flex2 } from "antd";
|
|
143
|
+
var ButtonElement = () => /* @__PURE__ */ React6.createElement(Flex2, { gap: "small" }, /* @__PURE__ */ React6.createElement(Button2, { type: "primary" }, "Primary Button"));
|
|
174
144
|
export {
|
|
145
|
+
ButtonElement,
|
|
175
146
|
NumberElement,
|
|
176
147
|
PasswordElement,
|
|
177
148
|
SelectElement,
|
package/package.json
CHANGED