@apexcura/ui-components 0.0.2 → 0.0.4

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
@@ -16,6 +16,7 @@ type ElementType = {
16
16
  name?: string;
17
17
  suffix?: React.ReactNode;
18
18
  maxLength?: number;
19
+ onChange?: (value: string | number | boolean) => void;
19
20
  };
20
21
 
21
22
  declare const TextElement: (props: ElementType) => React$1.JSX.Element;
@@ -32,6 +33,10 @@ interface PasswordProps {
32
33
  }
33
34
  declare const PasswordElement: React$1.FC<PasswordProps>;
34
35
 
35
- declare const NumberInput: (props: ElementType) => React$1.JSX.Element;
36
+ declare const NumberElement: (props: ElementType) => React$1.JSX.Element;
36
37
 
37
- export { NumberInput, PasswordElement, TextElement };
38
+ declare const TextareaElement: (props: ElementType) => React$1.JSX.Element;
39
+
40
+ declare const SelectElement: (props: ElementType) => React$1.JSX.Element;
41
+
42
+ export { NumberElement, PasswordElement, SelectElement, TextElement, TextareaElement };
package/dist/index.d.ts CHANGED
@@ -16,6 +16,7 @@ type ElementType = {
16
16
  name?: string;
17
17
  suffix?: React.ReactNode;
18
18
  maxLength?: number;
19
+ onChange?: (value: string | number | boolean) => void;
19
20
  };
20
21
 
21
22
  declare const TextElement: (props: ElementType) => React$1.JSX.Element;
@@ -32,6 +33,10 @@ interface PasswordProps {
32
33
  }
33
34
  declare const PasswordElement: React$1.FC<PasswordProps>;
34
35
 
35
- declare const NumberInput: (props: ElementType) => React$1.JSX.Element;
36
+ declare const NumberElement: (props: ElementType) => React$1.JSX.Element;
36
37
 
37
- export { NumberInput, PasswordElement, TextElement };
38
+ declare const TextareaElement: (props: ElementType) => React$1.JSX.Element;
39
+
40
+ declare const SelectElement: (props: ElementType) => React$1.JSX.Element;
41
+
42
+ export { NumberElement, PasswordElement, SelectElement, TextElement, TextareaElement };
package/dist/index.js CHANGED
@@ -30,19 +30,25 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
- NumberInput: () => NumberInput,
33
+ NumberElement: () => NumberElement,
34
34
  PasswordElement: () => PasswordElement,
35
- TextElement: () => TextElement
35
+ SelectElement: () => SelectElement,
36
+ TextElement: () => TextElement,
37
+ TextareaElement: () => TextareaElement
36
38
  });
37
39
  module.exports = __toCommonJS(src_exports);
38
40
 
39
41
  // src/Components/TextElement.tsx
40
42
  var import_react = __toESM(require("react"));
41
43
  var import_antd = require("antd");
42
- var onHandleChange = ($event) => {
43
- console.log($event);
44
- };
45
44
  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
+ };
46
52
  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(
47
53
  import_antd.Input,
48
54
  {
@@ -122,7 +128,7 @@ var NumericInput = (props) => {
122
128
  }
123
129
  ));
124
130
  };
125
- var NumberInput = (props) => {
131
+ var NumberElement = (props) => {
126
132
  const [value, setValue] = (0, import_react3.useState)("");
127
133
  return /* @__PURE__ */ import_react3.default.createElement(
128
134
  NumericInput,
@@ -134,9 +140,82 @@ var NumberInput = (props) => {
134
140
  }
135
141
  );
136
142
  };
143
+
144
+ // src/Components/TextareaElement.tsx
145
+ var import_react4 = __toESM(require("react"));
146
+ var import_antd4 = require("antd");
147
+ var { TextArea } = import_antd4.Input;
148
+ 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
+ return /* @__PURE__ */ import_react4.default.createElement(import_antd4.Flex, { vertical: true, gap: 32 }, /* @__PURE__ */ import_react4.default.createElement(
157
+ TextArea,
158
+ {
159
+ placeholder: props.placeholder,
160
+ allowClear: true,
161
+ defaultValue: props.defaultValue,
162
+ disabled: props.disabled,
163
+ id: props.name,
164
+ value: props.value,
165
+ status: props.status,
166
+ style: props.styles,
167
+ className: props.classNames,
168
+ variant: props.variant,
169
+ name: props.name,
170
+ showCount: true,
171
+ maxLength: props.maxLength,
172
+ onChange: onHandleChange
173
+ }
174
+ ));
175
+ };
176
+
177
+ // src/Components/SelectElement.tsx
178
+ var import_react5 = __toESM(require("react"));
179
+ var import_antd5 = require("antd");
180
+ 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
+ }
193
+ ];
194
+ var SelectElement = (props) => /* @__PURE__ */ import_react5.default.createElement(
195
+ import_antd5.Select,
196
+ {
197
+ placeholder: props.placeholder,
198
+ allowClear: true,
199
+ defaultValue: props.defaultValue,
200
+ disabled: props.disabled,
201
+ id: props.name,
202
+ value: props.value,
203
+ status: props.status,
204
+ style: props.styles,
205
+ className: props.classNames,
206
+ variant: props.variant,
207
+ options
208
+ }
209
+ );
210
+
211
+ // src/Components/Button.tsx
212
+ var import_react6 = __toESM(require("react"));
213
+ var import_antd6 = require("antd");
137
214
  // Annotate the CommonJS export names for ESM import in node:
138
215
  0 && (module.exports = {
139
- NumberInput,
216
+ NumberElement,
140
217
  PasswordElement,
141
- TextElement
218
+ SelectElement,
219
+ TextElement,
220
+ TextareaElement
142
221
  });
package/dist/index.mjs CHANGED
@@ -1,10 +1,14 @@
1
1
  // src/Components/TextElement.tsx
2
- import React from "react";
2
+ import React, { useState } from "react";
3
3
  import { Input as AntInput } from "antd";
4
- var onHandleChange = ($event) => {
5
- console.log($event);
6
- };
7
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
+ };
8
12
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("label", { htmlFor: props.name }, props.label), /* @__PURE__ */ React.createElement(
9
13
  AntInput,
10
14
  {
@@ -28,11 +32,11 @@ var TextElement = (props) => {
28
32
  };
29
33
 
30
34
  // src/Components/PasswordElement.tsx
31
- import React2, { useState } from "react";
35
+ import React2, { useState as useState2 } from "react";
32
36
  import { EyeInvisibleOutlined, EyeTwoTone } from "@ant-design/icons";
33
37
  import { Button, Input, Space } from "antd";
34
38
  var PasswordElement = ({ inputData }) => {
35
- const [passwordVisible, setPasswordVisible] = useState(false);
39
+ const [passwordVisible, setPasswordVisible] = useState2(false);
36
40
  const handleVisibilityToggle = () => {
37
41
  setPasswordVisible((prev) => !prev);
38
42
  };
@@ -53,7 +57,7 @@ var PasswordElement = ({ inputData }) => {
53
57
  };
54
58
 
55
59
  // src/Components/NumberElement.tsx
56
- import React3, { useState as useState2 } from "react";
60
+ import React3, { useState as useState3 } from "react";
57
61
  import { Input as Input2, Tooltip } from "antd";
58
62
  var formatNumber = (value) => new Intl.NumberFormat().format(value);
59
63
  var NumericInput = (props) => {
@@ -84,8 +88,8 @@ var NumericInput = (props) => {
84
88
  }
85
89
  ));
86
90
  };
87
- var NumberInput = (props) => {
88
- const [value, setValue] = useState2("");
91
+ var NumberElement = (props) => {
92
+ const [value, setValue] = useState3("");
89
93
  return /* @__PURE__ */ React3.createElement(
90
94
  NumericInput,
91
95
  {
@@ -96,8 +100,81 @@ var NumberInput = (props) => {
96
100
  }
97
101
  );
98
102
  };
103
+
104
+ // src/Components/TextareaElement.tsx
105
+ import React4, { useState as useState4 } from "react";
106
+ import { Flex, Input as Input3 } from "antd";
107
+ var { TextArea } = Input3;
108
+ 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
+ return /* @__PURE__ */ React4.createElement(Flex, { vertical: true, gap: 32 }, /* @__PURE__ */ React4.createElement(
117
+ TextArea,
118
+ {
119
+ placeholder: props.placeholder,
120
+ allowClear: true,
121
+ defaultValue: props.defaultValue,
122
+ disabled: props.disabled,
123
+ id: props.name,
124
+ value: props.value,
125
+ status: props.status,
126
+ style: props.styles,
127
+ className: props.classNames,
128
+ variant: props.variant,
129
+ name: props.name,
130
+ showCount: true,
131
+ maxLength: props.maxLength,
132
+ onChange: onHandleChange
133
+ }
134
+ ));
135
+ };
136
+
137
+ // src/Components/SelectElement.tsx
138
+ import React5 from "react";
139
+ import { Select as AntSelect } from "antd";
140
+ 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
+ }
153
+ ];
154
+ var SelectElement = (props) => /* @__PURE__ */ React5.createElement(
155
+ AntSelect,
156
+ {
157
+ placeholder: props.placeholder,
158
+ allowClear: true,
159
+ defaultValue: props.defaultValue,
160
+ disabled: props.disabled,
161
+ id: props.name,
162
+ value: props.value,
163
+ status: props.status,
164
+ style: props.styles,
165
+ className: props.classNames,
166
+ variant: props.variant,
167
+ options
168
+ }
169
+ );
170
+
171
+ // src/Components/Button.tsx
172
+ import React6 from "react";
173
+ import { Button as Button2, Flex as Flex2 } from "antd";
99
174
  export {
100
- NumberInput,
175
+ NumberElement,
101
176
  PasswordElement,
102
- TextElement
177
+ SelectElement,
178
+ TextElement,
179
+ TextareaElement
103
180
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
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/",