@apexcura/ui-components 0.0.11-Beta21 → 0.0.11-Beta211
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 +437 -0
- package/dist/index.d.mts +46 -9
- package/dist/index.d.ts +46 -9
- package/dist/index.js +369 -85
- package/dist/index.mjs +369 -89
- package/package.json +11 -3
- package/postcss.config.js +6 -0
- package/tailwind.config.js +10 -0
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Input as AntInput } from "antd";
|
|
4
4
|
var TextElement = (props) => {
|
|
5
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("label", { htmlFor: props.name }, props.label), /* @__PURE__ */ React.createElement(
|
|
5
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, props.label && /* @__PURE__ */ React.createElement("label", { htmlFor: props.name }, props.label), /* @__PURE__ */ React.createElement(
|
|
6
6
|
AntInput,
|
|
7
7
|
{
|
|
8
8
|
placeholder: props.placeholder,
|
|
@@ -15,7 +15,7 @@ var TextElement = (props) => {
|
|
|
15
15
|
type: props.type,
|
|
16
16
|
status: props.status,
|
|
17
17
|
style: props.styles,
|
|
18
|
-
className: props.
|
|
18
|
+
className: props.className,
|
|
19
19
|
variant: props.variant,
|
|
20
20
|
name: props.name,
|
|
21
21
|
onChange: (e) => props.onChange(e.target.value)
|
|
@@ -56,7 +56,7 @@ var NumberElement = (props) => {
|
|
|
56
56
|
const newValue = e.target.value.replace(/[^0-9]/g, "");
|
|
57
57
|
props.onChange(newValue);
|
|
58
58
|
};
|
|
59
|
-
return /* @__PURE__ */ React3.createElement(
|
|
59
|
+
return /* @__PURE__ */ React3.createElement(
|
|
60
60
|
AntInput2,
|
|
61
61
|
{
|
|
62
62
|
placeholder: props.placeholder,
|
|
@@ -68,13 +68,12 @@ var NumberElement = (props) => {
|
|
|
68
68
|
prefix: props.prefix,
|
|
69
69
|
type: props.type,
|
|
70
70
|
status: props.status,
|
|
71
|
-
|
|
72
|
-
className: props.classNames,
|
|
71
|
+
className: props.className,
|
|
73
72
|
variant: props.variant,
|
|
74
73
|
name: props.name,
|
|
75
74
|
onChange: handleInputChange
|
|
76
75
|
}
|
|
77
|
-
)
|
|
76
|
+
);
|
|
78
77
|
};
|
|
79
78
|
|
|
80
79
|
// src/Components/TextareaElement.tsx
|
|
@@ -82,7 +81,7 @@ import React4 from "react";
|
|
|
82
81
|
import { Flex, Input as Input2 } from "antd";
|
|
83
82
|
var { TextArea } = Input2;
|
|
84
83
|
var TextareaElement = (props) => {
|
|
85
|
-
return /* @__PURE__ */ React4.createElement(Flex,
|
|
84
|
+
return /* @__PURE__ */ React4.createElement(Flex, null, /* @__PURE__ */ React4.createElement(
|
|
86
85
|
TextArea,
|
|
87
86
|
{
|
|
88
87
|
placeholder: props.placeholder,
|
|
@@ -91,8 +90,7 @@ var TextareaElement = (props) => {
|
|
|
91
90
|
disabled: props.disabled,
|
|
92
91
|
id: props.name,
|
|
93
92
|
status: props.status,
|
|
94
|
-
|
|
95
|
-
className: props.classNames,
|
|
93
|
+
className: props.className,
|
|
96
94
|
variant: props.variant,
|
|
97
95
|
name: props.name,
|
|
98
96
|
showCount: true,
|
|
@@ -130,7 +128,7 @@ var SelectElement = (props) => {
|
|
|
130
128
|
id: props.name,
|
|
131
129
|
status: props.status,
|
|
132
130
|
style: props.styles,
|
|
133
|
-
className: props.
|
|
131
|
+
className: props.className,
|
|
134
132
|
variant: props.variant,
|
|
135
133
|
onChange: handleChange
|
|
136
134
|
}
|
|
@@ -138,27 +136,58 @@ var SelectElement = (props) => {
|
|
|
138
136
|
};
|
|
139
137
|
|
|
140
138
|
// src/Components/RadioElement.tsx
|
|
141
|
-
import React6 from "react";
|
|
139
|
+
import React6, { useState as useState2 } from "react";
|
|
142
140
|
import { Radio } from "antd";
|
|
141
|
+
var radioDefaultStyle = "bg-[#F2F2F2] border border-[#919191] rounded-[8px] m-[10px] hover:bg-[#F2F2F2] text-center text-black shadow-[0px_0px_1px_1px_#919191]";
|
|
142
|
+
var radioSelectedDefaultStyle = "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]";
|
|
143
143
|
var RadioElement = (props) => {
|
|
144
|
+
const [isDisabled, setIsDisabled] = useState2(props.disabled);
|
|
145
|
+
const [selectedValue, setSelectedValue] = useState2(props.value);
|
|
146
|
+
const optionType = props.optionType === "button" ? "button" : void 0;
|
|
144
147
|
const handleChange = (e) => {
|
|
148
|
+
console.log(e);
|
|
149
|
+
const selectedVal = e.target.value;
|
|
150
|
+
const selectedLabel = props.options ? props.options.find((f) => f.value === selectedVal)?.label : "";
|
|
151
|
+
const selectedOptions = { label: selectedLabel, value: selectedVal };
|
|
152
|
+
setSelectedValue(selectedVal);
|
|
153
|
+
setIsDisabled(true);
|
|
145
154
|
if (props.onChange) {
|
|
146
|
-
const selectedVal = e.target.value;
|
|
147
|
-
const selectedOptions = [{ id: selectedVal, value: selectedVal }];
|
|
148
155
|
props.onChange(selectedOptions);
|
|
149
156
|
}
|
|
150
157
|
};
|
|
151
|
-
|
|
158
|
+
const getButtonStyle = (option) => {
|
|
159
|
+
return selectedValue === option.value ? `${radioSelectedDefaultStyle} ${props.activeClassName}` : `${radioDefaultStyle} ${props.className}`;
|
|
160
|
+
};
|
|
161
|
+
return /* @__PURE__ */ React6.createElement("div", { className: props.containerClassName }, props.label && /* @__PURE__ */ React6.createElement("p", { className: props.labelClassName }, props.label), /* @__PURE__ */ React6.createElement(
|
|
162
|
+
Radio.Group,
|
|
163
|
+
{
|
|
164
|
+
onChange: handleChange,
|
|
165
|
+
optionType,
|
|
166
|
+
className: props.radioGroupClassName,
|
|
167
|
+
value: selectedValue
|
|
168
|
+
},
|
|
169
|
+
props.options && props.options.map((option) => /* @__PURE__ */ React6.createElement(
|
|
170
|
+
Radio,
|
|
171
|
+
{
|
|
172
|
+
key: option.value,
|
|
173
|
+
value: option.value,
|
|
174
|
+
disabled: isDisabled && selectedValue !== option.value,
|
|
175
|
+
className: getButtonStyle(option),
|
|
176
|
+
style: { pointerEvents: isDisabled && selectedValue !== option.value ? "none" : "auto" }
|
|
177
|
+
},
|
|
178
|
+
option.label
|
|
179
|
+
))
|
|
180
|
+
));
|
|
152
181
|
};
|
|
153
182
|
|
|
154
183
|
// src/Components/Checkbox.tsx
|
|
155
|
-
import React7, { useState as
|
|
184
|
+
import React7, { useState as useState3 } from "react";
|
|
156
185
|
import { Checkbox, Divider } from "antd";
|
|
157
186
|
var CheckboxGroup = Checkbox.Group;
|
|
158
187
|
var plainOptions = ["Apple", "Pear", "Orange"];
|
|
159
188
|
var defaultCheckedList = [];
|
|
160
189
|
var CheckboxElement = (props) => {
|
|
161
|
-
const [checkedList, setCheckedList] =
|
|
190
|
+
const [checkedList, setCheckedList] = useState3(defaultCheckedList);
|
|
162
191
|
const checkAll = plainOptions.length === checkedList.length;
|
|
163
192
|
const handleChange = (list) => {
|
|
164
193
|
setCheckedList(list);
|
|
@@ -182,7 +211,7 @@ var CheckboxElement = (props) => {
|
|
|
182
211
|
disabled: props.disabled,
|
|
183
212
|
id: props.name,
|
|
184
213
|
style: props.styles,
|
|
185
|
-
className: props.
|
|
214
|
+
className: props.className,
|
|
186
215
|
onChange: onHandleAllChanges,
|
|
187
216
|
checked: checkAll
|
|
188
217
|
},
|
|
@@ -192,7 +221,7 @@ var CheckboxElement = (props) => {
|
|
|
192
221
|
{
|
|
193
222
|
disabled: props.disabled,
|
|
194
223
|
style: props.styles,
|
|
195
|
-
className: props.
|
|
224
|
+
className: props.className,
|
|
196
225
|
options: plainOptions,
|
|
197
226
|
value: checkedList,
|
|
198
227
|
onChange: handleChange
|
|
@@ -219,8 +248,7 @@ var CkEditor = (props) => {
|
|
|
219
248
|
{
|
|
220
249
|
apiKey: "rwpgt7maa54n0pe5mglhkl686p7h57sg6z636n6gf2mio1b9",
|
|
221
250
|
onInit: (_evt, editor) => {
|
|
222
|
-
if (editor)
|
|
223
|
-
editorRef.current = editor;
|
|
251
|
+
if (editor) editorRef.current = editor;
|
|
224
252
|
},
|
|
225
253
|
initialValue: "<p>This is the initial content of the editor.</p>",
|
|
226
254
|
init: {
|
|
@@ -308,116 +336,368 @@ var MultipleSelectElement = (props) => {
|
|
|
308
336
|
|
|
309
337
|
// src/Components/Button.tsx
|
|
310
338
|
import React11 from "react";
|
|
311
|
-
|
|
312
|
-
|
|
339
|
+
var ButtonElement = (props) => {
|
|
340
|
+
const handleClick = typeof props.action === "string" ? () => {
|
|
341
|
+
console.log("Performing action:", props.action);
|
|
342
|
+
} : props.action;
|
|
343
|
+
return /* @__PURE__ */ React11.createElement(
|
|
344
|
+
"button",
|
|
345
|
+
{
|
|
346
|
+
onClick: handleClick,
|
|
347
|
+
className: `${props.className ? props.className : ""}`
|
|
348
|
+
},
|
|
349
|
+
props.icon && /* @__PURE__ */ React11.createElement("img", { src: props.icon }),
|
|
350
|
+
props.label
|
|
351
|
+
);
|
|
352
|
+
};
|
|
313
353
|
|
|
314
354
|
// src/Components/AddMoreTable.tsx
|
|
315
|
-
import React12, { useState as
|
|
316
|
-
import { Table } from "antd";
|
|
355
|
+
import React12, { useEffect, useState as useState4 } from "react";
|
|
356
|
+
import { Table, Button as Button2 } from "antd";
|
|
317
357
|
import { PlusOutlined, DeleteOutlined } from "@ant-design/icons";
|
|
318
358
|
var AddMoreTable = (props) => {
|
|
319
359
|
const { thead, tbody } = props;
|
|
320
|
-
const [
|
|
321
|
-
const [rows, setRows] = useState3(tbody || []);
|
|
322
|
-
function isColumnType(column) {
|
|
323
|
-
return column.dataIndex !== void 0;
|
|
324
|
-
}
|
|
325
|
-
const onHandleChange = (name, value) => {
|
|
326
|
-
setTableData((prev) => ({ ...prev, [name]: value }));
|
|
327
|
-
console.log(tableData);
|
|
328
|
-
};
|
|
360
|
+
const [rows, setRows] = useState4(tbody || []);
|
|
329
361
|
const onHandleRows = () => {
|
|
330
|
-
const
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
362
|
+
const newId = rows.length > 0 ? rows[rows.length - 1].id + 1 : 1;
|
|
363
|
+
let newRow = {
|
|
364
|
+
id: newId,
|
|
365
|
+
label: "Medicine",
|
|
366
|
+
name: "Medicine",
|
|
367
|
+
type: "text",
|
|
368
|
+
element: "single-select",
|
|
369
|
+
variable_data: [
|
|
370
|
+
{
|
|
371
|
+
id: 1,
|
|
372
|
+
Route: { label: "Route", element: "single-select", type: "text" },
|
|
373
|
+
Dose: { label: "Dose", element: "single-select", type: "text" },
|
|
374
|
+
Frequency: { label: "Frequency", element: "single-select", type: "text" },
|
|
375
|
+
When: { label: "When", element: "textarea", type: "text" },
|
|
376
|
+
Duration: { label: "Duration", element: "textarea", type: "text" },
|
|
377
|
+
Instructions: { label: "Instructions", element: "textarea", type: "text" },
|
|
378
|
+
SubRows: { delete: "delete", add: "plus" }
|
|
379
|
+
}
|
|
380
|
+
]
|
|
335
381
|
};
|
|
336
382
|
setRows((prevData) => [...prevData, newRow]);
|
|
337
383
|
};
|
|
338
|
-
const onHandleDelete = (
|
|
339
|
-
|
|
340
|
-
setRows(remainingRows);
|
|
384
|
+
const onHandleDelete = (id) => {
|
|
385
|
+
setRows((prevRows) => prevRows.filter((row) => row.id !== id));
|
|
341
386
|
};
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
387
|
+
const onHandleSubRowsAdd = (rowIndex) => {
|
|
388
|
+
setRows((prevRows) => {
|
|
389
|
+
return prevRows.map((row, index) => {
|
|
390
|
+
if (index === rowIndex) {
|
|
391
|
+
const newSubRow = {
|
|
392
|
+
id: row.variable_data.length + 1,
|
|
393
|
+
Route: { label: "Route", element: "single-select", type: "text" },
|
|
394
|
+
Dose: { label: "Dose", element: "single-select", type: "text" },
|
|
395
|
+
Frequency: { label: "Frequency", element: "single-select", type: "text" },
|
|
396
|
+
When: { label: "When", element: "textarea", type: "text" },
|
|
397
|
+
Duration: { label: "Duration", element: "textarea", type: "text" },
|
|
398
|
+
Instructions: { label: "Instructions", element: "textarea", type: "text" },
|
|
399
|
+
SubRows: { delete: "delete", add: "plus" }
|
|
400
|
+
};
|
|
401
|
+
const updatedVariableData = [...row.variable_data, newSubRow];
|
|
402
|
+
return {
|
|
403
|
+
...row,
|
|
404
|
+
variable_data: updatedVariableData
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
return row;
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
};
|
|
411
|
+
const onHandleSubRowsDelete = (rowIndex, subIndex) => {
|
|
412
|
+
setRows((prevRows) => {
|
|
413
|
+
return prevRows.map((row, index) => {
|
|
414
|
+
if (index === rowIndex) {
|
|
415
|
+
const updatedVariableData = row.variable_data.filter((_, i) => i !== subIndex);
|
|
416
|
+
return {
|
|
417
|
+
...row,
|
|
418
|
+
variable_data: updatedVariableData
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
return row;
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
};
|
|
425
|
+
useEffect(() => {
|
|
426
|
+
console.log(rows);
|
|
427
|
+
}, [rows]);
|
|
428
|
+
const renderInputElement = (element, value) => {
|
|
429
|
+
if (!element) return null;
|
|
348
430
|
const { element: type, label } = element;
|
|
349
431
|
if (type === "single-select") {
|
|
350
|
-
return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (
|
|
432
|
+
return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false });
|
|
351
433
|
} else if (type === "textarea") {
|
|
352
|
-
return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (
|
|
434
|
+
return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false });
|
|
353
435
|
} else {
|
|
354
436
|
return null;
|
|
355
437
|
}
|
|
356
438
|
};
|
|
357
|
-
const dataSource = rows.map((eachRow,
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
if (value && value.element && value.label) {
|
|
366
|
-
rowElements[value.label] = renderInputElement(value);
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
});
|
|
370
|
-
if (eachRow.variable_data.length > 0) {
|
|
371
|
-
const addIconObject = {
|
|
372
|
-
id: { id: eachRow.variable_data.length + 1 },
|
|
373
|
-
Route: { label: "Route", element: "single-select", type: "text" },
|
|
374
|
-
Dose: { label: "Dose", element: "single-select", type: "text" },
|
|
375
|
-
Frequency: { label: "Frequency", element: "single-select", type: "text" },
|
|
376
|
-
When: { label: "When", element: "textarea", type: "text" },
|
|
377
|
-
Duration: { label: "Duration", element: "textarea", type: "text" },
|
|
378
|
-
Instructions: { label: "Instructions", element: "textarea", type: "text" },
|
|
379
|
-
addIcon: /* @__PURE__ */ React12.createElement("button", { onClick: () => console.log("Add more clicked") }, /* @__PURE__ */ React12.createElement(PlusOutlined, null))
|
|
380
|
-
};
|
|
381
|
-
console.log("eachrow----------", eachRow);
|
|
382
|
-
rowElements["AddMoreIcon"] = addIconObject.addIcon;
|
|
383
|
-
}
|
|
384
|
-
console.log("RowElement", rowElements);
|
|
385
|
-
}
|
|
386
|
-
return {
|
|
387
|
-
key: index.toString(),
|
|
388
|
-
"#": index + 1,
|
|
389
|
-
...eachRow,
|
|
390
|
-
...rowElements,
|
|
391
|
-
actions: /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement("button", { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), index === rows.length - 1 && /* @__PURE__ */ React12.createElement("button", { onClick: onHandleRows }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)))
|
|
439
|
+
const dataSource = rows.map((eachRow, rowIndex) => {
|
|
440
|
+
const rowData = {
|
|
441
|
+
key: eachRow.id,
|
|
442
|
+
"#": rowIndex + 1,
|
|
443
|
+
"Medicine": renderInputElement({
|
|
444
|
+
element: eachRow.element,
|
|
445
|
+
label: eachRow.label
|
|
446
|
+
})
|
|
392
447
|
};
|
|
448
|
+
eachRow.variable_data.forEach((variable, subIndex) => {
|
|
449
|
+
Object.keys(variable).forEach((key) => {
|
|
450
|
+
if (key === "SubRows") {
|
|
451
|
+
rowData[`${key}`] = /* @__PURE__ */ React12.createElement("div", { key: subIndex }, eachRow.variable_data.length > 1 && /* @__PURE__ */ React12.createElement(Button2, { onClick: () => onHandleSubRowsDelete(rowIndex, subIndex) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), subIndex === eachRow.variable_data.length - 1 && /* @__PURE__ */ React12.createElement(Button2, { onClick: () => onHandleSubRowsAdd(rowIndex) }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)));
|
|
452
|
+
} else {
|
|
453
|
+
rowData[`${key}`] = renderInputElement(variable[key]);
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
});
|
|
457
|
+
rowData.actions = /* @__PURE__ */ React12.createElement("div", null, /* @__PURE__ */ React12.createElement(Button2, { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), rowIndex === rows.length - 1 && /* @__PURE__ */ React12.createElement(Button2, { onClick: onHandleRows }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)));
|
|
458
|
+
console.log("=====rowdata", rowData);
|
|
459
|
+
return rowData;
|
|
393
460
|
});
|
|
394
|
-
|
|
461
|
+
const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
|
|
462
|
+
title: eachHeadEl.label,
|
|
463
|
+
dataIndex: eachHeadEl.name,
|
|
464
|
+
key: eachHeadEl.id
|
|
465
|
+
})) : [];
|
|
466
|
+
if (!columns.some((col) => col.dataIndex === "actions")) {
|
|
395
467
|
columns.push({
|
|
396
468
|
title: "Actions",
|
|
397
469
|
dataIndex: "actions",
|
|
398
470
|
key: "actions"
|
|
399
471
|
});
|
|
400
472
|
}
|
|
401
|
-
return /* @__PURE__ */ React12.createElement(
|
|
473
|
+
return /* @__PURE__ */ React12.createElement(
|
|
402
474
|
Table,
|
|
403
475
|
{
|
|
404
476
|
columns,
|
|
405
|
-
|
|
406
|
-
|
|
477
|
+
dataSource,
|
|
478
|
+
pagination: false,
|
|
479
|
+
bordered: true
|
|
407
480
|
}
|
|
408
|
-
)
|
|
481
|
+
);
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
// src/Components/Sidebar.tsx
|
|
485
|
+
import React13 from "react";
|
|
486
|
+
var Sidebar = (props) => {
|
|
487
|
+
const handleChange = (item) => {
|
|
488
|
+
if (props.onChange) {
|
|
489
|
+
props.onChange(item);
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
return /* @__PURE__ */ React13.createElement("div", { className: props.className, key: props.name }, /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("img", { src: props.img, alt: "logo" })), /* @__PURE__ */ React13.createElement("ul", { className: props.listClassName }, props.items?.map((item) => {
|
|
493
|
+
return /* @__PURE__ */ React13.createElement("li", { onClick: () => {
|
|
494
|
+
handleChange(item);
|
|
495
|
+
}, key: item.label, className: `${props.listItemClassName} ${item.active && props.activeClassName}` }, /* @__PURE__ */ React13.createElement("img", { src: item.icon, className: props.className }), /* @__PURE__ */ React13.createElement("p", null, item.label));
|
|
496
|
+
})));
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
// src/Components/Navbar.tsx
|
|
500
|
+
import React17 from "react";
|
|
501
|
+
|
|
502
|
+
// src/Components/Notification.tsx
|
|
503
|
+
import React14 from "react";
|
|
504
|
+
import { Popover, Badge, Button as Button3, Avatar, List } from "antd";
|
|
505
|
+
import { IoIosNotifications } from "react-icons/io";
|
|
506
|
+
var popoverContentStyle = {
|
|
507
|
+
minWidth: "300px",
|
|
508
|
+
maxWidth: "100%"
|
|
509
|
+
};
|
|
510
|
+
var Notification = (props) => /* @__PURE__ */ React14.createElement(
|
|
511
|
+
Popover,
|
|
512
|
+
{
|
|
513
|
+
className: props.className,
|
|
514
|
+
content: /* @__PURE__ */ React14.createElement("div", { style: popoverContentStyle }, " ", /* @__PURE__ */ React14.createElement(
|
|
515
|
+
List,
|
|
516
|
+
{
|
|
517
|
+
itemLayout: "horizontal",
|
|
518
|
+
dataSource: props.items,
|
|
519
|
+
renderItem: (item, index) => /* @__PURE__ */ React14.createElement(List.Item, { key: item.text }, /* @__PURE__ */ React14.createElement(
|
|
520
|
+
List.Item.Meta,
|
|
521
|
+
{
|
|
522
|
+
avatar: /* @__PURE__ */ React14.createElement(Avatar, { src: `https://api.dicebear.com/7.x/miniavs/svg?seed=${index}` }),
|
|
523
|
+
title: item.text,
|
|
524
|
+
description: item.time
|
|
525
|
+
}
|
|
526
|
+
))
|
|
527
|
+
}
|
|
528
|
+
)),
|
|
529
|
+
trigger: "focus",
|
|
530
|
+
placement: "bottomRight"
|
|
531
|
+
},
|
|
532
|
+
/* @__PURE__ */ React14.createElement(Button3, { className: props.buttonClassName }, /* @__PURE__ */ React14.createElement(Badge, { size: "small", count: props.count }, /* @__PURE__ */ React14.createElement("span", { className: props.iconsClassName }, /* @__PURE__ */ React14.createElement(IoIosNotifications, null))))
|
|
533
|
+
);
|
|
534
|
+
|
|
535
|
+
// src/Components/SpanElement.tsx
|
|
536
|
+
import React15 from "react";
|
|
537
|
+
var SpanElement = (props) => /* @__PURE__ */ React15.createElement("span", { className: props.className }, props.label);
|
|
538
|
+
|
|
539
|
+
// src/Components/Profile.tsx
|
|
540
|
+
import React16 from "react";
|
|
541
|
+
import { Avatar as Avatar2 } from "antd";
|
|
542
|
+
import { UserOutlined } from "@ant-design/icons";
|
|
543
|
+
var Profile = (props) => /* @__PURE__ */ React16.createElement("div", { className: props.className }, /* @__PURE__ */ React16.createElement(Avatar2, { style: { backgroundColor: "#87d068", marginRight: "10px" }, icon: /* @__PURE__ */ React16.createElement(UserOutlined, null) }), /* @__PURE__ */ React16.createElement("div", { className: props.profileSubClassName }, /* @__PURE__ */ React16.createElement("p", null, props.primaryText), /* @__PURE__ */ React16.createElement("p", { className: props.secondTextClassName }, " ", props.secondaryText)));
|
|
544
|
+
|
|
545
|
+
// src/Components/Navbar.tsx
|
|
546
|
+
var Navbar = (props) => {
|
|
547
|
+
return /* @__PURE__ */ React17.createElement("div", { className: `${props.className}`, key: props.name }, props.items && props.items.map((item) => {
|
|
548
|
+
if (item.element === "span") {
|
|
549
|
+
return /* @__PURE__ */ React17.createElement(SpanElement, { ...item });
|
|
550
|
+
} else if (item.element === "notifications") {
|
|
551
|
+
return /* @__PURE__ */ React17.createElement(Notification, { ...item });
|
|
552
|
+
} else if (item.name === "profile") {
|
|
553
|
+
return /* @__PURE__ */ React17.createElement(Profile, { ...item });
|
|
554
|
+
}
|
|
555
|
+
return null;
|
|
556
|
+
}));
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
// src/Components/TableElement.tsx
|
|
560
|
+
import React19, { useState as useState5 } from "react";
|
|
561
|
+
import { Table as Table2 } from "antd";
|
|
562
|
+
|
|
563
|
+
// src/Components/Model.tsx
|
|
564
|
+
import React18 from "react";
|
|
565
|
+
import { Modal } from "antd";
|
|
566
|
+
var ModelElement = (props) => {
|
|
567
|
+
const { onCancel, model, selectedRecord } = props;
|
|
568
|
+
console.log("selectedRecord in model", selectedRecord);
|
|
569
|
+
console.log("model", model);
|
|
570
|
+
return /* @__PURE__ */ React18.createElement(
|
|
571
|
+
Modal,
|
|
572
|
+
{
|
|
573
|
+
open: model,
|
|
574
|
+
onCancel,
|
|
575
|
+
footer: null,
|
|
576
|
+
title: selectedRecord.map((eachRecord) => /* @__PURE__ */ React18.createElement("div", null, /* @__PURE__ */ React18.createElement("p", null, eachRecord)))
|
|
577
|
+
},
|
|
578
|
+
/* @__PURE__ */ React18.createElement("p", null, "Model opened")
|
|
579
|
+
);
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
// src/Components/TableElement.tsx
|
|
583
|
+
var TableElement = (props) => {
|
|
584
|
+
const { thead, tbody } = props;
|
|
585
|
+
const [selectedRecord, setSelectedRecord] = useState5({});
|
|
586
|
+
const [model, setModel] = useState5(false);
|
|
587
|
+
console.log("selectedRecord", selectedRecord);
|
|
588
|
+
let columns = [];
|
|
589
|
+
if (thead) {
|
|
590
|
+
columns = [
|
|
591
|
+
{
|
|
592
|
+
title: "#",
|
|
593
|
+
dataIndex: "#",
|
|
594
|
+
key: "#"
|
|
595
|
+
},
|
|
596
|
+
...thead.map((col, ind) => ({
|
|
597
|
+
title: col.label,
|
|
598
|
+
dataIndex: col.name,
|
|
599
|
+
key: col.key,
|
|
600
|
+
sorter: {
|
|
601
|
+
compare: (a, b) => {
|
|
602
|
+
if (typeof a[col.key] === "number" && typeof a[col.key] === "number") {
|
|
603
|
+
return a[col.key] - b[col.key];
|
|
604
|
+
} else if (typeof a[col.key] === "string" && typeof a[col.key] === "string") {
|
|
605
|
+
return a[col.key].localeCompare(b[col.key]);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}))
|
|
610
|
+
];
|
|
611
|
+
}
|
|
612
|
+
const dataSource = tbody && tbody.map((row, index) => ({
|
|
613
|
+
...row,
|
|
614
|
+
[columns[0].key]: index + 1
|
|
615
|
+
}));
|
|
616
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
|
|
617
|
+
Table2,
|
|
618
|
+
{
|
|
619
|
+
dataSource,
|
|
620
|
+
columns,
|
|
621
|
+
bordered: true,
|
|
622
|
+
size: props.size && props.size,
|
|
623
|
+
onRow: (record) => {
|
|
624
|
+
return {
|
|
625
|
+
onClick: () => {
|
|
626
|
+
setSelectedRecord(record);
|
|
627
|
+
setModel(true);
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
), model && /* @__PURE__ */ React19.createElement(ModelElement, { selectedStyle: false, style: false, className: void 0, selectedRecord, model, onCancel: () => setModel(false) }));
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
// src/Components/DatePicker.tsx
|
|
636
|
+
import React20, { useState as useState6 } from "react";
|
|
637
|
+
import { DatePicker } from "antd";
|
|
638
|
+
import { LeftOutlined, RightOutlined } from "@ant-design/icons";
|
|
639
|
+
import moment from "moment";
|
|
640
|
+
var DatePickerElement = (props) => {
|
|
641
|
+
const [date, setDate] = useState6(null);
|
|
642
|
+
const handleChange = (date2, dateString) => {
|
|
643
|
+
console.log("date---------", date2);
|
|
644
|
+
console.log("datestring", dateString);
|
|
645
|
+
if (date2) {
|
|
646
|
+
const formattedDate = dateString;
|
|
647
|
+
console.log("formattedDate-----------------", formattedDate);
|
|
648
|
+
setDate(date2);
|
|
649
|
+
console.log("changedDate------------", date2);
|
|
650
|
+
if (props.onChange) {
|
|
651
|
+
props.onChange(formattedDate);
|
|
652
|
+
}
|
|
653
|
+
} else {
|
|
654
|
+
setDate(null);
|
|
655
|
+
if (props.onChange) {
|
|
656
|
+
props.onChange("");
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
const onHandleDecrement = () => {
|
|
661
|
+
const currentDate = date || moment();
|
|
662
|
+
const newDate = moment(currentDate).subtract(1, "days");
|
|
663
|
+
setDate(newDate);
|
|
664
|
+
if (props.onChange) {
|
|
665
|
+
props.onChange(newDate.format("lll"));
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
const onHandleIncrement = () => {
|
|
669
|
+
const currentDate = date || moment();
|
|
670
|
+
const newDate = moment(currentDate).add(1, "days");
|
|
671
|
+
setDate(newDate);
|
|
672
|
+
if (props.onChange) {
|
|
673
|
+
props.onChange(newDate.format("lll"));
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
return /* @__PURE__ */ React20.createElement("div", null, /* @__PURE__ */ React20.createElement("button", { onClick: onHandleDecrement }, /* @__PURE__ */ React20.createElement(LeftOutlined, null)), /* @__PURE__ */ React20.createElement(
|
|
677
|
+
DatePicker,
|
|
678
|
+
{
|
|
679
|
+
placeholder: props.placeholder,
|
|
680
|
+
value: date,
|
|
681
|
+
variant: "borderless",
|
|
682
|
+
onChange: handleChange
|
|
683
|
+
}
|
|
684
|
+
), /* @__PURE__ */ React20.createElement("button", { onClick: onHandleIncrement }, /* @__PURE__ */ React20.createElement(RightOutlined, null)));
|
|
409
685
|
};
|
|
410
686
|
export {
|
|
411
687
|
AddMoreTable,
|
|
412
688
|
ButtonElement,
|
|
413
689
|
CheckboxElement,
|
|
414
690
|
CkEditor,
|
|
691
|
+
DatePickerElement,
|
|
415
692
|
MultipleSelectElement,
|
|
693
|
+
Navbar,
|
|
416
694
|
NumberElement,
|
|
417
695
|
PasswordElement,
|
|
418
696
|
RadioElement,
|
|
419
697
|
SelectElement,
|
|
698
|
+
Sidebar,
|
|
420
699
|
SingleSelectElement,
|
|
700
|
+
TableElement,
|
|
421
701
|
TextElement,
|
|
422
702
|
TextareaElement
|
|
423
703
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apexcura/ui-components",
|
|
3
|
-
"version": "0.0.11-
|
|
3
|
+
"version": "0.0.11-Beta211",
|
|
4
4
|
"description": "Apex cura React components library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"apex cura",
|
|
@@ -41,13 +41,21 @@
|
|
|
41
41
|
"react": "^18.3.1",
|
|
42
42
|
"react-dom": "^18.3.1",
|
|
43
43
|
"ts-jest": "^29.1.2",
|
|
44
|
-
"tsup": "^8.0
|
|
44
|
+
"tsup": "^8.1.0",
|
|
45
45
|
"typescript": "^5.4.5"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=18.0.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@tinymce/tinymce-react": "^5.0.1"
|
|
51
|
+
"@tinymce/tinymce-react": "^5.0.1",
|
|
52
|
+
"autoprefixer": "^10.4.19",
|
|
53
|
+
"date-fns": "^3.6.0",
|
|
54
|
+
"esbuild": "^0.21.4",
|
|
55
|
+
"moment": "^2.30.1",
|
|
56
|
+
"postcss": "^8.4.38",
|
|
57
|
+
"postcss-import": "^16.1.0",
|
|
58
|
+
"react-icons": "^5.2.1",
|
|
59
|
+
"tailwindcss": "^3.4.3"
|
|
52
60
|
}
|
|
53
61
|
}
|