@apexcura/ui-components 0.0.11-Beta13 → 0.0.11-Beta131
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.css +496 -0
- package/dist/index.d.mts +29 -4
- package/dist/index.d.ts +29 -4
- package/dist/index.js +198 -48
- package/dist/index.mjs +202 -54
- package/package.json +8 -3
- package/postcss.config.js +6 -0
- package/tailwind.config.js +10 -0
package/dist/index.js
CHANGED
|
@@ -35,10 +35,12 @@ __export(src_exports, {
|
|
|
35
35
|
CheckboxElement: () => CheckboxElement,
|
|
36
36
|
CkEditor: () => CkEditor,
|
|
37
37
|
MultipleSelectElement: () => MultipleSelectElement,
|
|
38
|
+
Navbar: () => Navbar,
|
|
38
39
|
NumberElement: () => NumberElement,
|
|
39
40
|
PasswordElement: () => PasswordElement,
|
|
40
41
|
RadioElement: () => RadioElement,
|
|
41
42
|
SelectElement: () => SelectElement,
|
|
43
|
+
Sidebar: () => Sidebar,
|
|
42
44
|
SingleSelectElement: () => SingleSelectElement,
|
|
43
45
|
TextElement: () => TextElement,
|
|
44
46
|
TextareaElement: () => TextareaElement
|
|
@@ -62,7 +64,7 @@ var TextElement = (props) => {
|
|
|
62
64
|
type: props.type,
|
|
63
65
|
status: props.status,
|
|
64
66
|
style: props.styles,
|
|
65
|
-
className: props.
|
|
67
|
+
className: props.className,
|
|
66
68
|
variant: props.variant,
|
|
67
69
|
name: props.name,
|
|
68
70
|
onChange: (e) => props.onChange(e.target.value)
|
|
@@ -103,7 +105,7 @@ var NumberElement = (props) => {
|
|
|
103
105
|
const newValue = e.target.value.replace(/[^0-9]/g, "");
|
|
104
106
|
props.onChange(newValue);
|
|
105
107
|
};
|
|
106
|
-
return /* @__PURE__ */ import_react3.default.createElement(
|
|
108
|
+
return /* @__PURE__ */ import_react3.default.createElement(
|
|
107
109
|
import_antd3.Input,
|
|
108
110
|
{
|
|
109
111
|
placeholder: props.placeholder,
|
|
@@ -115,13 +117,12 @@ var NumberElement = (props) => {
|
|
|
115
117
|
prefix: props.prefix,
|
|
116
118
|
type: props.type,
|
|
117
119
|
status: props.status,
|
|
118
|
-
|
|
119
|
-
className: props.classNames,
|
|
120
|
+
className: props.className,
|
|
120
121
|
variant: props.variant,
|
|
121
122
|
name: props.name,
|
|
122
123
|
onChange: handleInputChange
|
|
123
124
|
}
|
|
124
|
-
)
|
|
125
|
+
);
|
|
125
126
|
};
|
|
126
127
|
|
|
127
128
|
// src/Components/TextareaElement.tsx
|
|
@@ -129,7 +130,7 @@ var import_react4 = __toESM(require("react"));
|
|
|
129
130
|
var import_antd4 = require("antd");
|
|
130
131
|
var { TextArea } = import_antd4.Input;
|
|
131
132
|
var TextareaElement = (props) => {
|
|
132
|
-
return /* @__PURE__ */ import_react4.default.createElement(import_antd4.Flex,
|
|
133
|
+
return /* @__PURE__ */ import_react4.default.createElement(import_antd4.Flex, null, /* @__PURE__ */ import_react4.default.createElement(
|
|
133
134
|
TextArea,
|
|
134
135
|
{
|
|
135
136
|
placeholder: props.placeholder,
|
|
@@ -138,8 +139,7 @@ var TextareaElement = (props) => {
|
|
|
138
139
|
disabled: props.disabled,
|
|
139
140
|
id: props.name,
|
|
140
141
|
status: props.status,
|
|
141
|
-
|
|
142
|
-
className: props.classNames,
|
|
142
|
+
className: props.className,
|
|
143
143
|
variant: props.variant,
|
|
144
144
|
name: props.name,
|
|
145
145
|
showCount: true,
|
|
@@ -177,7 +177,7 @@ var SelectElement = (props) => {
|
|
|
177
177
|
id: props.name,
|
|
178
178
|
status: props.status,
|
|
179
179
|
style: props.styles,
|
|
180
|
-
className: props.
|
|
180
|
+
className: props.className,
|
|
181
181
|
variant: props.variant,
|
|
182
182
|
onChange: handleChange
|
|
183
183
|
}
|
|
@@ -187,15 +187,45 @@ var SelectElement = (props) => {
|
|
|
187
187
|
// src/Components/RadioElement.tsx
|
|
188
188
|
var import_react6 = __toESM(require("react"));
|
|
189
189
|
var import_antd6 = require("antd");
|
|
190
|
+
var containerClassName = " ";
|
|
191
|
+
var className = "bg-[#F2F2F2] border border-[#919191] !rounded-[8px] !m-[10px] hover:bg-[#F2F2F2] !text-center !text-black !shadow-[0px_0px_1px_1px_#919191]";
|
|
192
|
+
var selectedClassName = "!bg-[#E2D6F8] !border !border-[#B8A4DE] rounded-[8px] p-[6px] m-[10px] shadow-[0px_0px_1px_1px_#B8A4DE] text-center !text-black shadow-[0px_0px_1px_1px_#919191]";
|
|
190
193
|
var RadioElement = (props) => {
|
|
194
|
+
const [isDisabled, setIsDisabled] = (0, import_react6.useState)(props.disabled);
|
|
195
|
+
const [selectedValue, setSelectedValue] = (0, import_react6.useState)(props.value);
|
|
196
|
+
const optionType = props.optionType === "button" ? "button" : void 0;
|
|
191
197
|
const handleChange = (e) => {
|
|
198
|
+
const selectedVal = e.target.value;
|
|
199
|
+
const selectedOptions = [{ id: selectedVal, value: selectedVal }];
|
|
200
|
+
setSelectedValue(selectedVal);
|
|
201
|
+
setIsDisabled(true);
|
|
192
202
|
if (props.onChange) {
|
|
193
|
-
const selectedVal = e.target.value;
|
|
194
|
-
const selectedOptions = [{ id: selectedVal, value: selectedVal }];
|
|
195
203
|
props.onChange(selectedOptions);
|
|
196
204
|
}
|
|
197
205
|
};
|
|
198
|
-
|
|
206
|
+
const getButtonStyle = (option) => {
|
|
207
|
+
return selectedValue === option.value ? `${selectedClassName} ${option.selectedClassName}` : `${className} ${option.className}`;
|
|
208
|
+
};
|
|
209
|
+
return /* @__PURE__ */ import_react6.default.createElement("div", { className: containerClassName }, /* @__PURE__ */ import_react6.default.createElement("p", null, props.label), /* @__PURE__ */ import_react6.default.createElement(
|
|
210
|
+
import_antd6.Radio.Group,
|
|
211
|
+
{
|
|
212
|
+
onChange: handleChange,
|
|
213
|
+
optionType,
|
|
214
|
+
className: props.className,
|
|
215
|
+
value: selectedValue
|
|
216
|
+
},
|
|
217
|
+
props.options && props.options.map((option) => /* @__PURE__ */ import_react6.default.createElement(
|
|
218
|
+
import_antd6.Radio,
|
|
219
|
+
{
|
|
220
|
+
key: option.value,
|
|
221
|
+
value: option.value,
|
|
222
|
+
disabled: isDisabled && selectedValue !== option.value,
|
|
223
|
+
className: getButtonStyle(option),
|
|
224
|
+
style: { pointerEvents: isDisabled && selectedValue !== option.value ? "none" : "auto" }
|
|
225
|
+
},
|
|
226
|
+
option.label
|
|
227
|
+
))
|
|
228
|
+
));
|
|
199
229
|
};
|
|
200
230
|
|
|
201
231
|
// src/Components/Checkbox.tsx
|
|
@@ -229,7 +259,7 @@ var CheckboxElement = (props) => {
|
|
|
229
259
|
disabled: props.disabled,
|
|
230
260
|
id: props.name,
|
|
231
261
|
style: props.styles,
|
|
232
|
-
className: props.
|
|
262
|
+
className: props.className,
|
|
233
263
|
onChange: onHandleAllChanges,
|
|
234
264
|
checked: checkAll
|
|
235
265
|
},
|
|
@@ -239,7 +269,7 @@ var CheckboxElement = (props) => {
|
|
|
239
269
|
{
|
|
240
270
|
disabled: props.disabled,
|
|
241
271
|
style: props.styles,
|
|
242
|
-
className: props.
|
|
272
|
+
className: props.className,
|
|
243
273
|
options: plainOptions,
|
|
244
274
|
value: checkedList,
|
|
245
275
|
onChange: handleChange
|
|
@@ -266,8 +296,7 @@ var CkEditor = (props) => {
|
|
|
266
296
|
{
|
|
267
297
|
apiKey: "rwpgt7maa54n0pe5mglhkl686p7h57sg6z636n6gf2mio1b9",
|
|
268
298
|
onInit: (_evt, editor) => {
|
|
269
|
-
if (editor)
|
|
270
|
-
editorRef.current = editor;
|
|
299
|
+
if (editor) editorRef.current = editor;
|
|
271
300
|
},
|
|
272
301
|
initialValue: "<p>This is the initial content of the editor.</p>",
|
|
273
302
|
init: {
|
|
@@ -356,57 +385,176 @@ var MultipleSelectElement = (props) => {
|
|
|
356
385
|
// src/Components/Button.tsx
|
|
357
386
|
var import_react12 = __toESM(require("react"));
|
|
358
387
|
var import_antd10 = require("antd");
|
|
359
|
-
var
|
|
388
|
+
var defaultClassName = "w-[126px] h-[40px] bg-purple-800 text-white rounded-full shadow-lg submit border-none";
|
|
389
|
+
var ButtonElement = (props) => {
|
|
390
|
+
const handleClick = typeof props.action === "string" ? () => {
|
|
391
|
+
console.log("Performing action:", props.action);
|
|
392
|
+
} : props.action;
|
|
393
|
+
return /* @__PURE__ */ import_react12.default.createElement(
|
|
394
|
+
import_antd10.Button,
|
|
395
|
+
{
|
|
396
|
+
onClick: handleClick,
|
|
397
|
+
className: `${defaultClassName} ${props.className ? props.className : ""}`
|
|
398
|
+
},
|
|
399
|
+
props.label
|
|
400
|
+
);
|
|
401
|
+
};
|
|
360
402
|
|
|
361
403
|
// src/Components/AddMoreTable.tsx
|
|
362
404
|
var import_react13 = __toESM(require("react"));
|
|
363
405
|
var import_antd11 = require("antd");
|
|
406
|
+
var import_icons2 = require("@ant-design/icons");
|
|
364
407
|
var AddMoreTable = (props) => {
|
|
365
408
|
const { thead, tbody } = props;
|
|
366
|
-
const [
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
409
|
+
const [rows, setRows] = (0, import_react13.useState)(tbody || []);
|
|
410
|
+
const onHandleRows = () => {
|
|
411
|
+
const newId = rows.length > 0 ? rows[rows.length - 1].id + 1 : 1;
|
|
412
|
+
let newRow = {
|
|
413
|
+
id: newId,
|
|
414
|
+
label: "Medicine",
|
|
415
|
+
name: "Medicine",
|
|
416
|
+
type: "text",
|
|
417
|
+
element: "single-select",
|
|
418
|
+
variable_data: [
|
|
419
|
+
{
|
|
420
|
+
id: 1,
|
|
421
|
+
Route: { label: "Route", element: "single-select", type: "text" },
|
|
422
|
+
Dose: { label: "Dose", element: "single-select", type: "text" },
|
|
423
|
+
Frequency: { label: "Frequency", element: "single-select", type: "text" },
|
|
424
|
+
When: { label: "When", element: "textarea", type: "text" },
|
|
425
|
+
Duration: { label: "Duration", element: "textarea", type: "text" },
|
|
426
|
+
Instructions: { label: "Instructions", element: "textarea", type: "text" },
|
|
427
|
+
SubRows: { delete: "delete", add: "plus" }
|
|
428
|
+
}
|
|
429
|
+
]
|
|
430
|
+
};
|
|
431
|
+
setRows((prevData) => [...prevData, newRow]);
|
|
371
432
|
};
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
433
|
+
const onHandleDelete = (id) => {
|
|
434
|
+
setRows((prevRows) => prevRows.filter((row) => row.id !== id));
|
|
435
|
+
};
|
|
436
|
+
const onHandleSubRowsAdd = (rowIndex) => {
|
|
437
|
+
setRows((prevRows) => {
|
|
438
|
+
return prevRows.map((row, index) => {
|
|
439
|
+
if (index === rowIndex) {
|
|
440
|
+
const newSubRow = {
|
|
441
|
+
id: row.variable_data.length + 1,
|
|
442
|
+
Route: { label: "Route", element: "single-select", type: "text" },
|
|
443
|
+
Dose: { label: "Dose", element: "single-select", type: "text" },
|
|
444
|
+
Frequency: { label: "Frequency", element: "single-select", type: "text" },
|
|
445
|
+
When: { label: "When", element: "textarea", type: "text" },
|
|
446
|
+
Duration: { label: "Duration", element: "textarea", type: "text" },
|
|
447
|
+
Instructions: { label: "Instructions", element: "textarea", type: "text" },
|
|
448
|
+
SubRows: { delete: "delete", add: "plus" }
|
|
449
|
+
};
|
|
450
|
+
const updatedVariableData = [...row.variable_data, newSubRow];
|
|
451
|
+
return {
|
|
452
|
+
...row,
|
|
453
|
+
variable_data: updatedVariableData
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
return row;
|
|
457
|
+
});
|
|
458
|
+
});
|
|
459
|
+
};
|
|
460
|
+
const onHandleSubRowsDelete = (rowIndex, subIndex) => {
|
|
461
|
+
setRows((prevRows) => {
|
|
462
|
+
return prevRows.map((row, index) => {
|
|
463
|
+
if (index === rowIndex) {
|
|
464
|
+
const updatedVariableData = row.variable_data.filter((_, i) => i !== subIndex);
|
|
465
|
+
return {
|
|
466
|
+
...row,
|
|
467
|
+
variable_data: updatedVariableData
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
return row;
|
|
471
|
+
});
|
|
472
|
+
});
|
|
473
|
+
};
|
|
474
|
+
(0, import_react13.useEffect)(() => {
|
|
475
|
+
console.log(rows);
|
|
476
|
+
}, [rows]);
|
|
477
|
+
const renderInputElement = (element, value) => {
|
|
478
|
+
if (!element) return null;
|
|
378
479
|
const { element: type, label } = element;
|
|
379
|
-
console.log("type....", type);
|
|
380
480
|
if (type === "single-select") {
|
|
381
|
-
return /* @__PURE__ */ import_react13.default.createElement(SingleSelectElement, { onChange: (
|
|
481
|
+
return /* @__PURE__ */ import_react13.default.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false });
|
|
382
482
|
} else if (type === "textarea") {
|
|
383
|
-
return /* @__PURE__ */ import_react13.default.createElement(TextareaElement, { onChange: (
|
|
483
|
+
return /* @__PURE__ */ import_react13.default.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false });
|
|
384
484
|
} else {
|
|
385
485
|
return null;
|
|
386
486
|
}
|
|
387
487
|
};
|
|
388
|
-
const dataSource =
|
|
389
|
-
const
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
key: index.toString(),
|
|
397
|
-
...eachRow,
|
|
398
|
-
...variableData
|
|
488
|
+
const dataSource = rows.map((eachRow, rowIndex) => {
|
|
489
|
+
const rowData = {
|
|
490
|
+
key: eachRow.id,
|
|
491
|
+
"#": rowIndex + 1,
|
|
492
|
+
"Medicine": renderInputElement({
|
|
493
|
+
element: eachRow.element,
|
|
494
|
+
label: eachRow.label
|
|
495
|
+
})
|
|
399
496
|
};
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
497
|
+
eachRow.variable_data.forEach((variable, subIndex) => {
|
|
498
|
+
Object.keys(variable).forEach((key) => {
|
|
499
|
+
if (key === "SubRows") {
|
|
500
|
+
rowData[`${key}`] = /* @__PURE__ */ import_react13.default.createElement("div", { key: subIndex }, eachRow.variable_data.length > 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: () => onHandleSubRowsDelete(rowIndex, subIndex) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.DeleteOutlined, null)), subIndex === eachRow.variable_data.length - 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: () => onHandleSubRowsAdd(rowIndex) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)));
|
|
501
|
+
} else {
|
|
502
|
+
rowData[`${key}`] = renderInputElement(variable[key]);
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
});
|
|
506
|
+
rowData.actions = /* @__PURE__ */ import_react13.default.createElement("div", null, /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.DeleteOutlined, null)), rowIndex === rows.length - 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: onHandleRows }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)));
|
|
507
|
+
console.log("=====rowdata", rowData);
|
|
508
|
+
return rowData;
|
|
509
|
+
});
|
|
510
|
+
const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
|
|
511
|
+
title: eachHeadEl.label,
|
|
512
|
+
dataIndex: eachHeadEl.name,
|
|
513
|
+
key: eachHeadEl.id
|
|
514
|
+
})) : [];
|
|
515
|
+
if (!columns.some((col) => col.dataIndex === "actions")) {
|
|
516
|
+
columns.push({
|
|
517
|
+
title: "Actions",
|
|
518
|
+
dataIndex: "actions",
|
|
519
|
+
key: "actions"
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
return /* @__PURE__ */ import_react13.default.createElement(
|
|
403
523
|
import_antd11.Table,
|
|
404
524
|
{
|
|
405
525
|
columns,
|
|
406
|
-
|
|
407
|
-
|
|
526
|
+
dataSource,
|
|
527
|
+
pagination: false,
|
|
528
|
+
bordered: true
|
|
408
529
|
}
|
|
409
|
-
)
|
|
530
|
+
);
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
// src/Components/Sidebar.tsx
|
|
534
|
+
var import_react14 = __toESM(require("react"));
|
|
535
|
+
var Sidebar = (props) => {
|
|
536
|
+
return /* @__PURE__ */ import_react14.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react14.default.createElement("div", null, /* @__PURE__ */ import_react14.default.createElement("img", { src: props.img, alt: "logo" })), /* @__PURE__ */ import_react14.default.createElement("ul", { className: props.listClassName }, props.items?.map((item) => {
|
|
537
|
+
return /* @__PURE__ */ import_react14.default.createElement("li", { key: item.label, className: props.listItemClassName }, /* @__PURE__ */ import_react14.default.createElement("span", null, item.icon), /* @__PURE__ */ import_react14.default.createElement("span", null, item.label));
|
|
538
|
+
})));
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
// src/Components/Navbar.tsx
|
|
542
|
+
var import_react17 = __toESM(require("react"));
|
|
543
|
+
|
|
544
|
+
// src/Components/Notofication.tsx
|
|
545
|
+
var import_react15 = __toESM(require("react"));
|
|
546
|
+
var import_antd12 = require("antd");
|
|
547
|
+
var Notification = (props) => /* @__PURE__ */ import_react15.default.createElement(import_antd12.Popover, { className: props.notification.className, content: props.notification.items?.map((eachItem) => {
|
|
548
|
+
return /* @__PURE__ */ import_react15.default.createElement("div", null, /* @__PURE__ */ import_react15.default.createElement("p", null, eachItem.text), /* @__PURE__ */ import_react15.default.createElement("p", null, eachItem.time));
|
|
549
|
+
}), trigger: "focus", placement: "bottomRight" }, /* @__PURE__ */ import_react15.default.createElement(import_antd12.Button, { className: props.notification.buttonClassName }, /* @__PURE__ */ import_react15.default.createElement("span", null, props.notification.icon), /* @__PURE__ */ import_react15.default.createElement("span", { className: props.notification.countClassName }, props.notification.count)));
|
|
550
|
+
|
|
551
|
+
// src/Components/Profile.tsx
|
|
552
|
+
var import_react16 = __toESM(require("react"));
|
|
553
|
+
var Profile = (props) => /* @__PURE__ */ import_react16.default.createElement("div", { className: props.profile.className }, /* @__PURE__ */ import_react16.default.createElement("img", { src: props.profile.profileImage, alt: "profile", className: props.profile.profileImageClassName }), /* @__PURE__ */ import_react16.default.createElement("div", { className: "flex flex-column space-x-4" }, /* @__PURE__ */ import_react16.default.createElement("span", null, props.profile.primaryText), /* @__PURE__ */ import_react16.default.createElement("span", { className: props.profile.className }, props.profile.secondaryText)));
|
|
554
|
+
|
|
555
|
+
// src/Components/Navbar.tsx
|
|
556
|
+
var Navbar = (props) => {
|
|
557
|
+
return /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex space-between" }, /* @__PURE__ */ import_react17.default.createElement("span", { className: props.dashboard.className }, props.dashboard.label), /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex flex-end items-center space-x-4" }, /* @__PURE__ */ import_react17.default.createElement(Notification, { ...props }), /* @__PURE__ */ import_react17.default.createElement(Profile, { ...props })));
|
|
410
558
|
};
|
|
411
559
|
// Annotate the CommonJS export names for ESM import in node:
|
|
412
560
|
0 && (module.exports = {
|
|
@@ -415,10 +563,12 @@ var AddMoreTable = (props) => {
|
|
|
415
563
|
CheckboxElement,
|
|
416
564
|
CkEditor,
|
|
417
565
|
MultipleSelectElement,
|
|
566
|
+
Navbar,
|
|
418
567
|
NumberElement,
|
|
419
568
|
PasswordElement,
|
|
420
569
|
RadioElement,
|
|
421
570
|
SelectElement,
|
|
571
|
+
Sidebar,
|
|
422
572
|
SingleSelectElement,
|
|
423
573
|
TextElement,
|
|
424
574
|
TextareaElement
|