@apexcura/ui-components 0.0.4 → 0.0.5

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