@apexcura/ui-components 0.0.7 → 0.0.8-Beta0
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 +27 -11
- package/dist/index.d.ts +27 -11
- package/dist/index.js +198 -10
- package/dist/index.mjs +193 -10
- package/package.json +16 -7
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 | number | boolean |
|
|
10
|
+
value?: string | number | boolean | any[];
|
|
11
11
|
status?: "error" | "warning";
|
|
12
12
|
styles?: React.CSSProperties;
|
|
13
13
|
classNames?: string;
|
|
@@ -16,13 +16,16 @@ type ElementType = {
|
|
|
16
16
|
name?: string;
|
|
17
17
|
suffix?: React.ReactNode;
|
|
18
18
|
maxLength?: number;
|
|
19
|
-
|
|
19
|
+
fieldNames?: any[];
|
|
20
|
+
onChange?: (value: string | number | boolean | any[]) => void;
|
|
21
|
+
options: any[];
|
|
22
|
+
onFocusHandler: () => void;
|
|
20
23
|
};
|
|
21
24
|
|
|
22
|
-
interface ElementExecuterProps$
|
|
23
|
-
onChange: (value: string | number | boolean) => void;
|
|
25
|
+
interface ElementExecuterProps$3 extends ElementType {
|
|
26
|
+
onChange: (value: string | number | boolean | any[]) => void;
|
|
24
27
|
}
|
|
25
|
-
declare const TextElement: (props: ElementExecuterProps$
|
|
28
|
+
declare const TextElement: (props: ElementExecuterProps$3) => React$1.JSX.Element;
|
|
26
29
|
|
|
27
30
|
interface InputData {
|
|
28
31
|
placeholder?: string;
|
|
@@ -36,18 +39,31 @@ interface PasswordProps {
|
|
|
36
39
|
}
|
|
37
40
|
declare const PasswordElement: React$1.FC<PasswordProps>;
|
|
38
41
|
|
|
42
|
+
interface ElementExecuterProps$2 extends ElementType {
|
|
43
|
+
onChange: (value: string | number | boolean | any[]) => void;
|
|
44
|
+
}
|
|
45
|
+
declare const NumberElement: (props: ElementExecuterProps$2) => React$1.JSX.Element;
|
|
46
|
+
|
|
39
47
|
interface ElementExecuterProps$1 extends ElementType {
|
|
40
|
-
onChange: (value: string | number | boolean) => void;
|
|
48
|
+
onChange: (value: string | number | boolean | any[]) => void;
|
|
41
49
|
}
|
|
42
|
-
declare const
|
|
50
|
+
declare const TextareaElement: (props: ElementExecuterProps$1) => React$1.JSX.Element;
|
|
51
|
+
|
|
52
|
+
declare const SelectElement: (props: ElementType) => React$1.JSX.Element;
|
|
53
|
+
|
|
54
|
+
declare const RadioElement: (props: ElementType) => React$1.JSX.Element;
|
|
55
|
+
|
|
56
|
+
declare const CheckboxElement: (props: ElementType) => React$1.JSX.Element;
|
|
43
57
|
|
|
44
58
|
interface ElementExecuterProps extends ElementType {
|
|
45
|
-
onChange: (value: string | number | boolean) => void;
|
|
59
|
+
onChange: (value: string | number | boolean | any[]) => void;
|
|
46
60
|
}
|
|
47
|
-
declare const
|
|
61
|
+
declare const CkEditor: (props: ElementExecuterProps) => React$1.JSX.Element;
|
|
48
62
|
|
|
49
|
-
declare const
|
|
63
|
+
declare const SingleSelectElement: (props: ElementType) => React$1.JSX.Element;
|
|
64
|
+
|
|
65
|
+
declare const MultipleSelectElement: () => React$1.JSX.Element;
|
|
50
66
|
|
|
51
67
|
declare const ButtonElement: () => React$1.JSX.Element;
|
|
52
68
|
|
|
53
|
-
export { ButtonElement, NumberElement, PasswordElement, SelectElement, TextElement, TextareaElement };
|
|
69
|
+
export { ButtonElement, CheckboxElement, CkEditor, MultipleSelectElement, NumberElement, PasswordElement, RadioElement, SelectElement, SingleSelectElement, 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 | number | boolean |
|
|
10
|
+
value?: string | number | boolean | any[];
|
|
11
11
|
status?: "error" | "warning";
|
|
12
12
|
styles?: React.CSSProperties;
|
|
13
13
|
classNames?: string;
|
|
@@ -16,13 +16,16 @@ type ElementType = {
|
|
|
16
16
|
name?: string;
|
|
17
17
|
suffix?: React.ReactNode;
|
|
18
18
|
maxLength?: number;
|
|
19
|
-
|
|
19
|
+
fieldNames?: any[];
|
|
20
|
+
onChange?: (value: string | number | boolean | any[]) => void;
|
|
21
|
+
options: any[];
|
|
22
|
+
onFocusHandler: () => void;
|
|
20
23
|
};
|
|
21
24
|
|
|
22
|
-
interface ElementExecuterProps$
|
|
23
|
-
onChange: (value: string | number | boolean) => void;
|
|
25
|
+
interface ElementExecuterProps$3 extends ElementType {
|
|
26
|
+
onChange: (value: string | number | boolean | any[]) => void;
|
|
24
27
|
}
|
|
25
|
-
declare const TextElement: (props: ElementExecuterProps$
|
|
28
|
+
declare const TextElement: (props: ElementExecuterProps$3) => React$1.JSX.Element;
|
|
26
29
|
|
|
27
30
|
interface InputData {
|
|
28
31
|
placeholder?: string;
|
|
@@ -36,18 +39,31 @@ interface PasswordProps {
|
|
|
36
39
|
}
|
|
37
40
|
declare const PasswordElement: React$1.FC<PasswordProps>;
|
|
38
41
|
|
|
42
|
+
interface ElementExecuterProps$2 extends ElementType {
|
|
43
|
+
onChange: (value: string | number | boolean | any[]) => void;
|
|
44
|
+
}
|
|
45
|
+
declare const NumberElement: (props: ElementExecuterProps$2) => React$1.JSX.Element;
|
|
46
|
+
|
|
39
47
|
interface ElementExecuterProps$1 extends ElementType {
|
|
40
|
-
onChange: (value: string | number | boolean) => void;
|
|
48
|
+
onChange: (value: string | number | boolean | any[]) => void;
|
|
41
49
|
}
|
|
42
|
-
declare const
|
|
50
|
+
declare const TextareaElement: (props: ElementExecuterProps$1) => React$1.JSX.Element;
|
|
51
|
+
|
|
52
|
+
declare const SelectElement: (props: ElementType) => React$1.JSX.Element;
|
|
53
|
+
|
|
54
|
+
declare const RadioElement: (props: ElementType) => React$1.JSX.Element;
|
|
55
|
+
|
|
56
|
+
declare const CheckboxElement: (props: ElementType) => React$1.JSX.Element;
|
|
43
57
|
|
|
44
58
|
interface ElementExecuterProps extends ElementType {
|
|
45
|
-
onChange: (value: string | number | boolean) => void;
|
|
59
|
+
onChange: (value: string | number | boolean | any[]) => void;
|
|
46
60
|
}
|
|
47
|
-
declare const
|
|
61
|
+
declare const CkEditor: (props: ElementExecuterProps) => React$1.JSX.Element;
|
|
48
62
|
|
|
49
|
-
declare const
|
|
63
|
+
declare const SingleSelectElement: (props: ElementType) => React$1.JSX.Element;
|
|
64
|
+
|
|
65
|
+
declare const MultipleSelectElement: () => React$1.JSX.Element;
|
|
50
66
|
|
|
51
67
|
declare const ButtonElement: () => React$1.JSX.Element;
|
|
52
68
|
|
|
53
|
-
export { ButtonElement, NumberElement, PasswordElement, SelectElement, TextElement, TextareaElement };
|
|
69
|
+
export { ButtonElement, CheckboxElement, CkEditor, MultipleSelectElement, NumberElement, PasswordElement, RadioElement, SelectElement, SingleSelectElement, TextElement, TextareaElement };
|
package/dist/index.js
CHANGED
|
@@ -31,9 +31,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
ButtonElement: () => ButtonElement,
|
|
34
|
+
CheckboxElement: () => CheckboxElement,
|
|
35
|
+
CkEditor: () => CkEditor,
|
|
36
|
+
MultipleSelectElement: () => MultipleSelectElement,
|
|
34
37
|
NumberElement: () => NumberElement,
|
|
35
38
|
PasswordElement: () => PasswordElement,
|
|
39
|
+
RadioElement: () => RadioElement,
|
|
36
40
|
SelectElement: () => SelectElement,
|
|
41
|
+
SingleSelectElement: () => SingleSelectElement,
|
|
37
42
|
TextElement: () => TextElement,
|
|
38
43
|
TextareaElement: () => TextareaElement
|
|
39
44
|
});
|
|
@@ -146,11 +151,6 @@ var TextareaElement = (props) => {
|
|
|
146
151
|
// src/Components/SelectElement.tsx
|
|
147
152
|
var import_react5 = __toESM(require("react"));
|
|
148
153
|
var import_antd5 = require("antd");
|
|
149
|
-
var options = [
|
|
150
|
-
{ label: "female", value: "female" },
|
|
151
|
-
{ label: "male", value: "male" },
|
|
152
|
-
{ label: "other", value: "other" }
|
|
153
|
-
];
|
|
154
154
|
var labelRender = (props) => {
|
|
155
155
|
const { label, value } = props;
|
|
156
156
|
if (label) {
|
|
@@ -159,7 +159,7 @@ var labelRender = (props) => {
|
|
|
159
159
|
return /* @__PURE__ */ import_react5.default.createElement("span", null, "select gender");
|
|
160
160
|
};
|
|
161
161
|
var SelectElement = (props) => {
|
|
162
|
-
const
|
|
162
|
+
const handleChange3 = (value) => {
|
|
163
163
|
if (props.onChange) {
|
|
164
164
|
props.onChange(value);
|
|
165
165
|
}
|
|
@@ -168,7 +168,7 @@ var SelectElement = (props) => {
|
|
|
168
168
|
import_antd5.Select,
|
|
169
169
|
{
|
|
170
170
|
labelRender,
|
|
171
|
-
options,
|
|
171
|
+
options: props.fieldNames,
|
|
172
172
|
placeholder: props.placeholder,
|
|
173
173
|
allowClear: true,
|
|
174
174
|
defaultValue: props.defaultValue,
|
|
@@ -178,21 +178,209 @@ var SelectElement = (props) => {
|
|
|
178
178
|
style: props.styles,
|
|
179
179
|
className: props.classNames,
|
|
180
180
|
variant: props.variant,
|
|
181
|
-
onChange:
|
|
181
|
+
onChange: handleChange3
|
|
182
182
|
}
|
|
183
183
|
);
|
|
184
184
|
};
|
|
185
185
|
|
|
186
|
-
// src/Components/
|
|
186
|
+
// src/Components/RadioElement.tsx
|
|
187
187
|
var import_react6 = __toESM(require("react"));
|
|
188
188
|
var import_antd6 = require("antd");
|
|
189
|
-
var
|
|
189
|
+
var RadioElement = (props) => {
|
|
190
|
+
const handleChange3 = (e) => {
|
|
191
|
+
if (props && props.onChange) {
|
|
192
|
+
props.onChange(e.target.value);
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio.Group, { name: "radiogroup", defaultValue: 1 }, /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 1, onChange: handleChange3 }, "A"), /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 2, onChange: handleChange3 }, "B"), /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 3, onChange: handleChange3 }, "C"), /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 4, onChange: handleChange3 }, "D"));
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
// src/Components/Checkbox.tsx
|
|
199
|
+
var import_react7 = __toESM(require("react"));
|
|
200
|
+
var import_antd7 = require("antd");
|
|
201
|
+
var CheckboxGroup = import_antd7.Checkbox.Group;
|
|
202
|
+
var plainOptions = ["Apple", "Pear", "Orange"];
|
|
203
|
+
var defaultCheckedList = [];
|
|
204
|
+
var CheckboxElement = (props) => {
|
|
205
|
+
const [checkedList, setCheckedList] = (0, import_react7.useState)(defaultCheckedList);
|
|
206
|
+
const checkAll = plainOptions.length === checkedList.length;
|
|
207
|
+
const handleChange3 = (list) => {
|
|
208
|
+
setCheckedList(list);
|
|
209
|
+
if (props.onChange) {
|
|
210
|
+
props.onChange(list);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
const onHandleAllChanges = (e) => {
|
|
214
|
+
const newList = e.target.checked ? plainOptions : [];
|
|
215
|
+
setCheckedList(newList);
|
|
216
|
+
if (props.onChange) {
|
|
217
|
+
props.onChange(newList);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, /* @__PURE__ */ import_react7.default.createElement(
|
|
221
|
+
import_antd7.Checkbox,
|
|
222
|
+
{
|
|
223
|
+
disabled: props.disabled,
|
|
224
|
+
id: props.name,
|
|
225
|
+
style: props.styles,
|
|
226
|
+
className: props.classNames,
|
|
227
|
+
onChange: onHandleAllChanges,
|
|
228
|
+
checked: checkAll
|
|
229
|
+
},
|
|
230
|
+
"Check all"
|
|
231
|
+
), /* @__PURE__ */ import_react7.default.createElement(import_antd7.Divider, null), /* @__PURE__ */ import_react7.default.createElement(
|
|
232
|
+
CheckboxGroup,
|
|
233
|
+
{
|
|
234
|
+
disabled: props.disabled,
|
|
235
|
+
style: props.styles,
|
|
236
|
+
className: props.classNames,
|
|
237
|
+
options: plainOptions,
|
|
238
|
+
value: checkedList,
|
|
239
|
+
onChange: handleChange3
|
|
240
|
+
}
|
|
241
|
+
));
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
// src/Components/CkEditor.tsx
|
|
245
|
+
var import_react8 = require("react");
|
|
246
|
+
var import_tinymce_react = require("@tinymce/tinymce-react");
|
|
247
|
+
var import_react9 = __toESM(require("react"));
|
|
248
|
+
var CkEditor = (props) => {
|
|
249
|
+
const editorRef = (0, import_react8.useRef)(null);
|
|
250
|
+
const log = () => {
|
|
251
|
+
if (editorRef.current) {
|
|
252
|
+
let content = editorRef.current.getContent();
|
|
253
|
+
if (props.onChange) {
|
|
254
|
+
props.onChange(content);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
return /* @__PURE__ */ import_react9.default.createElement("div", null, /* @__PURE__ */ import_react9.default.createElement(
|
|
259
|
+
import_tinymce_react.Editor,
|
|
260
|
+
{
|
|
261
|
+
apiKey: "rwpgt7maa54n0pe5mglhkl686p7h57sg6z636n6gf2mio1b9",
|
|
262
|
+
onInit: (_evt, editor) => {
|
|
263
|
+
if (editor)
|
|
264
|
+
editorRef.current = editor;
|
|
265
|
+
},
|
|
266
|
+
initialValue: "<p>This is the initial content of the editor.</p>",
|
|
267
|
+
init: {
|
|
268
|
+
height: 500,
|
|
269
|
+
menubar: false,
|
|
270
|
+
plugins: [
|
|
271
|
+
"advlist",
|
|
272
|
+
"autolink",
|
|
273
|
+
"lists",
|
|
274
|
+
"link",
|
|
275
|
+
"image",
|
|
276
|
+
"charmap",
|
|
277
|
+
"preview",
|
|
278
|
+
"anchor",
|
|
279
|
+
"searchreplace",
|
|
280
|
+
"visualblocks",
|
|
281
|
+
"code",
|
|
282
|
+
"fullscreen",
|
|
283
|
+
"insertdatetime",
|
|
284
|
+
"media",
|
|
285
|
+
"table",
|
|
286
|
+
"code",
|
|
287
|
+
"help",
|
|
288
|
+
"wordcount"
|
|
289
|
+
],
|
|
290
|
+
toolbar: "undo redo | blocks | bold italic forecolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help",
|
|
291
|
+
content_style: "body { font-family:Helvetica,Arial,sans-serif; font-size:14px }"
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
), /* @__PURE__ */ import_react9.default.createElement("button", { onClick: log }, "Log editor content"));
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
// src/Components/Select/SingleSelectElement.tsx
|
|
298
|
+
var import_react10 = __toESM(require("react"));
|
|
299
|
+
var import_antd8 = require("antd");
|
|
300
|
+
var onSearch = (value) => {
|
|
301
|
+
console.log("search:", value);
|
|
302
|
+
};
|
|
303
|
+
var filterOption = (input, option) => (option?.label ?? "").toLowerCase().includes(input.toLowerCase());
|
|
304
|
+
var handleChange = () => {
|
|
305
|
+
};
|
|
306
|
+
var SingleSelectElement = (props) => {
|
|
307
|
+
return /* @__PURE__ */ import_react10.default.createElement(
|
|
308
|
+
import_antd8.Select,
|
|
309
|
+
{
|
|
310
|
+
showSearch: true,
|
|
311
|
+
placeholder: props.placeholder,
|
|
312
|
+
optionFilterProp: "children",
|
|
313
|
+
onChange: handleChange,
|
|
314
|
+
onSearch,
|
|
315
|
+
filterOption,
|
|
316
|
+
onFocus: props.onFocusHandler,
|
|
317
|
+
options: props.options
|
|
318
|
+
}
|
|
319
|
+
);
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
// src/Components/Select/MultipleSelectElement.tsx
|
|
323
|
+
var import_react11 = __toESM(require("react"));
|
|
324
|
+
var import_antd9 = require("antd");
|
|
325
|
+
var handleChange2 = (value) => {
|
|
326
|
+
console.log(`selected ${value}`);
|
|
327
|
+
};
|
|
328
|
+
var options = [
|
|
329
|
+
{
|
|
330
|
+
label: "China",
|
|
331
|
+
value: "china",
|
|
332
|
+
emoji: "\u{1F1E8}\u{1F1F3}",
|
|
333
|
+
desc: "China (\u4E2D\u56FD)"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
label: "USA",
|
|
337
|
+
value: "usa",
|
|
338
|
+
emoji: "\u{1F1FA}\u{1F1F8}",
|
|
339
|
+
desc: "USA (\u7F8E\u56FD)"
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
label: "Japan",
|
|
343
|
+
value: "japan",
|
|
344
|
+
emoji: "\u{1F1EF}\u{1F1F5}",
|
|
345
|
+
desc: "Japan (\u65E5\u672C)"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
label: "Korea",
|
|
349
|
+
value: "korea",
|
|
350
|
+
emoji: "\u{1F1F0}\u{1F1F7}",
|
|
351
|
+
desc: "Korea (\u97E9\u56FD)"
|
|
352
|
+
}
|
|
353
|
+
];
|
|
354
|
+
var MultipleSelectElement = () => {
|
|
355
|
+
return /* @__PURE__ */ import_react11.default.createElement(
|
|
356
|
+
import_antd9.Select,
|
|
357
|
+
{
|
|
358
|
+
mode: "multiple",
|
|
359
|
+
style: { width: "100%" },
|
|
360
|
+
placeholder: "select one country",
|
|
361
|
+
defaultValue: ["china"],
|
|
362
|
+
onChange: handleChange2,
|
|
363
|
+
options,
|
|
364
|
+
optionRender: (option) => /* @__PURE__ */ import_react11.default.createElement(import_antd9.Space, null, /* @__PURE__ */ import_react11.default.createElement("span", { role: "img", "aria-label": option.data.label }, option.data.emoji), option.data.desc)
|
|
365
|
+
}
|
|
366
|
+
);
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
// src/Components/Button.tsx
|
|
370
|
+
var import_react12 = __toESM(require("react"));
|
|
371
|
+
var import_antd10 = require("antd");
|
|
372
|
+
var ButtonElement = () => /* @__PURE__ */ import_react12.default.createElement(import_antd10.Flex, { gap: "small" }, /* @__PURE__ */ import_react12.default.createElement(import_antd10.Button, { type: "primary" }, "Primary Button"));
|
|
190
373
|
// Annotate the CommonJS export names for ESM import in node:
|
|
191
374
|
0 && (module.exports = {
|
|
192
375
|
ButtonElement,
|
|
376
|
+
CheckboxElement,
|
|
377
|
+
CkEditor,
|
|
378
|
+
MultipleSelectElement,
|
|
193
379
|
NumberElement,
|
|
194
380
|
PasswordElement,
|
|
381
|
+
RadioElement,
|
|
195
382
|
SelectElement,
|
|
383
|
+
SingleSelectElement,
|
|
196
384
|
TextElement,
|
|
197
385
|
TextareaElement
|
|
198
386
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -105,11 +105,6 @@ var TextareaElement = (props) => {
|
|
|
105
105
|
// src/Components/SelectElement.tsx
|
|
106
106
|
import React5 from "react";
|
|
107
107
|
import { Select } from "antd";
|
|
108
|
-
var options = [
|
|
109
|
-
{ label: "female", value: "female" },
|
|
110
|
-
{ label: "male", value: "male" },
|
|
111
|
-
{ label: "other", value: "other" }
|
|
112
|
-
];
|
|
113
108
|
var labelRender = (props) => {
|
|
114
109
|
const { label, value } = props;
|
|
115
110
|
if (label) {
|
|
@@ -118,7 +113,7 @@ var labelRender = (props) => {
|
|
|
118
113
|
return /* @__PURE__ */ React5.createElement("span", null, "select gender");
|
|
119
114
|
};
|
|
120
115
|
var SelectElement = (props) => {
|
|
121
|
-
const
|
|
116
|
+
const handleChange3 = (value) => {
|
|
122
117
|
if (props.onChange) {
|
|
123
118
|
props.onChange(value);
|
|
124
119
|
}
|
|
@@ -127,7 +122,7 @@ var SelectElement = (props) => {
|
|
|
127
122
|
Select,
|
|
128
123
|
{
|
|
129
124
|
labelRender,
|
|
130
|
-
options,
|
|
125
|
+
options: props.fieldNames,
|
|
131
126
|
placeholder: props.placeholder,
|
|
132
127
|
allowClear: true,
|
|
133
128
|
defaultValue: props.defaultValue,
|
|
@@ -137,20 +132,208 @@ var SelectElement = (props) => {
|
|
|
137
132
|
style: props.styles,
|
|
138
133
|
className: props.classNames,
|
|
139
134
|
variant: props.variant,
|
|
140
|
-
onChange:
|
|
135
|
+
onChange: handleChange3
|
|
141
136
|
}
|
|
142
137
|
);
|
|
143
138
|
};
|
|
144
139
|
|
|
145
|
-
// src/Components/
|
|
140
|
+
// src/Components/RadioElement.tsx
|
|
146
141
|
import React6 from "react";
|
|
142
|
+
import { Radio } from "antd";
|
|
143
|
+
var RadioElement = (props) => {
|
|
144
|
+
const handleChange3 = (e) => {
|
|
145
|
+
if (props && props.onChange) {
|
|
146
|
+
props.onChange(e.target.value);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
return /* @__PURE__ */ React6.createElement(Radio.Group, { name: "radiogroup", defaultValue: 1 }, /* @__PURE__ */ React6.createElement(Radio, { value: 1, onChange: handleChange3 }, "A"), /* @__PURE__ */ React6.createElement(Radio, { value: 2, onChange: handleChange3 }, "B"), /* @__PURE__ */ React6.createElement(Radio, { value: 3, onChange: handleChange3 }, "C"), /* @__PURE__ */ React6.createElement(Radio, { value: 4, onChange: handleChange3 }, "D"));
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// src/Components/Checkbox.tsx
|
|
153
|
+
import React7, { useState as useState2 } from "react";
|
|
154
|
+
import { Checkbox, Divider } from "antd";
|
|
155
|
+
var CheckboxGroup = Checkbox.Group;
|
|
156
|
+
var plainOptions = ["Apple", "Pear", "Orange"];
|
|
157
|
+
var defaultCheckedList = [];
|
|
158
|
+
var CheckboxElement = (props) => {
|
|
159
|
+
const [checkedList, setCheckedList] = useState2(defaultCheckedList);
|
|
160
|
+
const checkAll = plainOptions.length === checkedList.length;
|
|
161
|
+
const handleChange3 = (list) => {
|
|
162
|
+
setCheckedList(list);
|
|
163
|
+
if (props.onChange) {
|
|
164
|
+
props.onChange(list);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const onHandleAllChanges = (e) => {
|
|
168
|
+
const newList = e.target.checked ? plainOptions : [];
|
|
169
|
+
setCheckedList(newList);
|
|
170
|
+
if (props.onChange) {
|
|
171
|
+
props.onChange(newList);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
|
|
175
|
+
Checkbox,
|
|
176
|
+
{
|
|
177
|
+
disabled: props.disabled,
|
|
178
|
+
id: props.name,
|
|
179
|
+
style: props.styles,
|
|
180
|
+
className: props.classNames,
|
|
181
|
+
onChange: onHandleAllChanges,
|
|
182
|
+
checked: checkAll
|
|
183
|
+
},
|
|
184
|
+
"Check all"
|
|
185
|
+
), /* @__PURE__ */ React7.createElement(Divider, null), /* @__PURE__ */ React7.createElement(
|
|
186
|
+
CheckboxGroup,
|
|
187
|
+
{
|
|
188
|
+
disabled: props.disabled,
|
|
189
|
+
style: props.styles,
|
|
190
|
+
className: props.classNames,
|
|
191
|
+
options: plainOptions,
|
|
192
|
+
value: checkedList,
|
|
193
|
+
onChange: handleChange3
|
|
194
|
+
}
|
|
195
|
+
));
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
// src/Components/CkEditor.tsx
|
|
199
|
+
import { useRef } from "react";
|
|
200
|
+
import { Editor } from "@tinymce/tinymce-react";
|
|
201
|
+
import React8 from "react";
|
|
202
|
+
var CkEditor = (props) => {
|
|
203
|
+
const editorRef = useRef(null);
|
|
204
|
+
const log = () => {
|
|
205
|
+
if (editorRef.current) {
|
|
206
|
+
let content = editorRef.current.getContent();
|
|
207
|
+
if (props.onChange) {
|
|
208
|
+
props.onChange(content);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
return /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement(
|
|
213
|
+
Editor,
|
|
214
|
+
{
|
|
215
|
+
apiKey: "rwpgt7maa54n0pe5mglhkl686p7h57sg6z636n6gf2mio1b9",
|
|
216
|
+
onInit: (_evt, editor) => {
|
|
217
|
+
if (editor)
|
|
218
|
+
editorRef.current = editor;
|
|
219
|
+
},
|
|
220
|
+
initialValue: "<p>This is the initial content of the editor.</p>",
|
|
221
|
+
init: {
|
|
222
|
+
height: 500,
|
|
223
|
+
menubar: false,
|
|
224
|
+
plugins: [
|
|
225
|
+
"advlist",
|
|
226
|
+
"autolink",
|
|
227
|
+
"lists",
|
|
228
|
+
"link",
|
|
229
|
+
"image",
|
|
230
|
+
"charmap",
|
|
231
|
+
"preview",
|
|
232
|
+
"anchor",
|
|
233
|
+
"searchreplace",
|
|
234
|
+
"visualblocks",
|
|
235
|
+
"code",
|
|
236
|
+
"fullscreen",
|
|
237
|
+
"insertdatetime",
|
|
238
|
+
"media",
|
|
239
|
+
"table",
|
|
240
|
+
"code",
|
|
241
|
+
"help",
|
|
242
|
+
"wordcount"
|
|
243
|
+
],
|
|
244
|
+
toolbar: "undo redo | blocks | bold italic forecolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help",
|
|
245
|
+
content_style: "body { font-family:Helvetica,Arial,sans-serif; font-size:14px }"
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
), /* @__PURE__ */ React8.createElement("button", { onClick: log }, "Log editor content"));
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
// src/Components/Select/SingleSelectElement.tsx
|
|
252
|
+
import React9 from "react";
|
|
253
|
+
import { Select as Select2 } from "antd";
|
|
254
|
+
var onSearch = (value) => {
|
|
255
|
+
console.log("search:", value);
|
|
256
|
+
};
|
|
257
|
+
var filterOption = (input, option) => (option?.label ?? "").toLowerCase().includes(input.toLowerCase());
|
|
258
|
+
var handleChange = () => {
|
|
259
|
+
};
|
|
260
|
+
var SingleSelectElement = (props) => {
|
|
261
|
+
return /* @__PURE__ */ React9.createElement(
|
|
262
|
+
Select2,
|
|
263
|
+
{
|
|
264
|
+
showSearch: true,
|
|
265
|
+
placeholder: props.placeholder,
|
|
266
|
+
optionFilterProp: "children",
|
|
267
|
+
onChange: handleChange,
|
|
268
|
+
onSearch,
|
|
269
|
+
filterOption,
|
|
270
|
+
onFocus: props.onFocusHandler,
|
|
271
|
+
options: props.options
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
// src/Components/Select/MultipleSelectElement.tsx
|
|
277
|
+
import React10 from "react";
|
|
278
|
+
import { Select as Select3, Space as Space2 } from "antd";
|
|
279
|
+
var handleChange2 = (value) => {
|
|
280
|
+
console.log(`selected ${value}`);
|
|
281
|
+
};
|
|
282
|
+
var options = [
|
|
283
|
+
{
|
|
284
|
+
label: "China",
|
|
285
|
+
value: "china",
|
|
286
|
+
emoji: "\u{1F1E8}\u{1F1F3}",
|
|
287
|
+
desc: "China (\u4E2D\u56FD)"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
label: "USA",
|
|
291
|
+
value: "usa",
|
|
292
|
+
emoji: "\u{1F1FA}\u{1F1F8}",
|
|
293
|
+
desc: "USA (\u7F8E\u56FD)"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
label: "Japan",
|
|
297
|
+
value: "japan",
|
|
298
|
+
emoji: "\u{1F1EF}\u{1F1F5}",
|
|
299
|
+
desc: "Japan (\u65E5\u672C)"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
label: "Korea",
|
|
303
|
+
value: "korea",
|
|
304
|
+
emoji: "\u{1F1F0}\u{1F1F7}",
|
|
305
|
+
desc: "Korea (\u97E9\u56FD)"
|
|
306
|
+
}
|
|
307
|
+
];
|
|
308
|
+
var MultipleSelectElement = () => {
|
|
309
|
+
return /* @__PURE__ */ React10.createElement(
|
|
310
|
+
Select3,
|
|
311
|
+
{
|
|
312
|
+
mode: "multiple",
|
|
313
|
+
style: { width: "100%" },
|
|
314
|
+
placeholder: "select one country",
|
|
315
|
+
defaultValue: ["china"],
|
|
316
|
+
onChange: handleChange2,
|
|
317
|
+
options,
|
|
318
|
+
optionRender: (option) => /* @__PURE__ */ React10.createElement(Space2, null, /* @__PURE__ */ React10.createElement("span", { role: "img", "aria-label": option.data.label }, option.data.emoji), option.data.desc)
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
// src/Components/Button.tsx
|
|
324
|
+
import React11 from "react";
|
|
147
325
|
import { Button as Button2, Flex as Flex2 } from "antd";
|
|
148
|
-
var ButtonElement = () => /* @__PURE__ */
|
|
326
|
+
var ButtonElement = () => /* @__PURE__ */ React11.createElement(Flex2, { gap: "small" }, /* @__PURE__ */ React11.createElement(Button2, { type: "primary" }, "Primary Button"));
|
|
149
327
|
export {
|
|
150
328
|
ButtonElement,
|
|
329
|
+
CheckboxElement,
|
|
330
|
+
CkEditor,
|
|
331
|
+
MultipleSelectElement,
|
|
151
332
|
NumberElement,
|
|
152
333
|
PasswordElement,
|
|
334
|
+
RadioElement,
|
|
153
335
|
SelectElement,
|
|
336
|
+
SingleSelectElement,
|
|
154
337
|
TextElement,
|
|
155
338
|
TextareaElement
|
|
156
339
|
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apexcura/ui-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8-Beta0",
|
|
4
4
|
"description": "Apex cura React components library",
|
|
5
|
-
"keywords"
|
|
5
|
+
"keywords": [
|
|
6
|
+
"apex cura",
|
|
7
|
+
"input",
|
|
8
|
+
"ui",
|
|
9
|
+
"react",
|
|
10
|
+
"react-component"
|
|
11
|
+
],
|
|
6
12
|
"homepage": "https://www.apexcura.com/",
|
|
7
13
|
"bugs": {
|
|
8
14
|
"url": "https://github.com/apexcura/ui-components/issues"
|
|
@@ -11,7 +17,7 @@
|
|
|
11
17
|
"type": "git",
|
|
12
18
|
"url": "git+https://github.com/apexcura/ui-components.git",
|
|
13
19
|
"directory": "packages/ui-components"
|
|
14
|
-
},
|
|
20
|
+
},
|
|
15
21
|
"author": "Apex Cura <hello@apexcura.com>",
|
|
16
22
|
"license": "ISC",
|
|
17
23
|
"main": "./dist/index.js",
|
|
@@ -24,21 +30,24 @@
|
|
|
24
30
|
"devDependencies": {
|
|
25
31
|
"@testing-library/jest-dom": "^6.4.2",
|
|
26
32
|
"@testing-library/react": "^15.0.6",
|
|
27
|
-
"@types/react-global-configuration": "^1.3.3",
|
|
28
33
|
"@types/jest": "^29.5.12",
|
|
29
34
|
"@types/react": "^18.3.1",
|
|
30
35
|
"@types/react-dom": "18.2.18",
|
|
36
|
+
"@types/react-global-configuration": "^1.3.3",
|
|
31
37
|
"@types/testing-library__react": "^10.2.0",
|
|
32
38
|
"antd": "^5.16.5",
|
|
33
|
-
"react": "^18.3.1",
|
|
34
|
-
"react-dom": "^18.3.1",
|
|
35
|
-
"tsup": "^8.0.2",
|
|
36
39
|
"jest": "^29.7.0",
|
|
37
40
|
"jest-environment-jsdom": "^29.7.0",
|
|
41
|
+
"react": "^18.3.1",
|
|
42
|
+
"react-dom": "^18.3.1",
|
|
38
43
|
"ts-jest": "^29.1.2",
|
|
44
|
+
"tsup": "^8.0.2",
|
|
39
45
|
"typescript": "^5.4.5"
|
|
40
46
|
},
|
|
41
47
|
"engines": {
|
|
42
48
|
"node": ">=18.0.0"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@tinymce/tinymce-react": "^5.0.1"
|
|
43
52
|
}
|
|
44
53
|
}
|