@apexcura/ui-components 0.0.11-Beta21 → 0.0.11-Beta210

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.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.classNames,
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(React3.Fragment, null, /* @__PURE__ */ React3.createElement("label", { htmlFor: props.name }, props.label), /* @__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
- style: props.styles,
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, { vertical: true, gap: 32 }, /* @__PURE__ */ React4.createElement(
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
- style: props.styles,
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.classNames,
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
- return /* @__PURE__ */ React6.createElement(Radio.Group, { name: "radiogroup", defaultValue: 1 }, /* @__PURE__ */ React6.createElement(Radio, { value: 1, onChange: handleChange }, "A"), /* @__PURE__ */ React6.createElement(Radio, { value: 2, onChange: handleChange }, "B"), /* @__PURE__ */ React6.createElement(Radio, { value: 3, onChange: handleChange }, "C"), /* @__PURE__ */ React6.createElement(Radio, { value: 4, onChange: handleChange }, "D"));
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 useState2 } from "react";
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] = useState2(defaultCheckedList);
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.classNames,
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.classNames,
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,367 @@ var MultipleSelectElement = (props) => {
308
336
 
309
337
  // src/Components/Button.tsx
310
338
  import React11 from "react";
311
- import { Button as Button2, Flex as Flex2 } from "antd";
312
- var ButtonElement = () => /* @__PURE__ */ React11.createElement(Flex2, { gap: "small" }, /* @__PURE__ */ React11.createElement(Button2, { type: "primary" }, "Primary Button"));
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 useState3 } from "react";
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 [tableData, setTableData] = useState3({});
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 lastRow = rows[rows.length - 1];
331
- const newId = lastRow ? lastRow.id + 1 : lastRow.id;
332
- const newRow = {
333
- ...lastRow,
334
- id: newId
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 = (index) => {
339
- const remainingRows = rows.filter((eachRow) => eachRow.id !== index);
340
- setRows(remainingRows);
384
+ const onHandleDelete = (id) => {
385
+ setRows((prevRows) => prevRows.filter((row) => row.id !== id));
341
386
  };
342
- const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
343
- title: eachHeadEl.label,
344
- dataIndex: eachHeadEl.name,
345
- key: eachHeadEl.id
346
- })) : [];
347
- const renderInputElement = (element) => {
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: (value) => onHandleChange(label, value) });
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: (value) => onHandleChange(label, value) });
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, index) => {
358
- const rowElements = {};
359
- if (eachRow.element && eachRow.label) {
360
- rowElements[eachRow.label] = renderInputElement(eachRow);
361
- }
362
- if (eachRow.variable_data && Array.isArray(eachRow.variable_data)) {
363
- eachRow.variable_data.forEach((variable) => {
364
- Object.entries(variable).forEach(([key, value]) => {
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
- if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
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(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
473
+ return /* @__PURE__ */ React12.createElement(
402
474
  Table,
403
475
  {
404
476
  columns,
405
- expandable: { defaultExpandedRowKeys: ["0"] },
406
- dataSource
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
+ },
577
+ /* @__PURE__ */ React18.createElement("p", null, "Model opened")
578
+ );
579
+ };
580
+
581
+ // src/Components/TableElement.tsx
582
+ var TableElement = (props) => {
583
+ const { thead, tbody } = props;
584
+ const [selectedRecord, setSelectedRecord] = useState5({});
585
+ const [model, setModel] = useState5(false);
586
+ console.log("selectedRecord", selectedRecord);
587
+ let columns = [];
588
+ if (thead) {
589
+ columns = [
590
+ {
591
+ title: "#",
592
+ dataIndex: "#",
593
+ key: "#"
594
+ },
595
+ ...thead.map((col, ind) => ({
596
+ title: col.label,
597
+ dataIndex: col.name,
598
+ key: col.key,
599
+ sorter: {
600
+ compare: (a, b) => {
601
+ if (typeof a[col.key] === "number" && typeof a[col.key] === "number") {
602
+ return a[col.key] - b[col.key];
603
+ } else if (typeof a[col.key] === "string" && typeof a[col.key] === "string") {
604
+ return a[col.key].localeCompare(b[col.key]);
605
+ }
606
+ }
607
+ }
608
+ }))
609
+ ];
610
+ }
611
+ const dataSource = tbody && tbody.map((row, index) => ({
612
+ ...row,
613
+ [columns[0].key]: index + 1
614
+ }));
615
+ return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
616
+ Table2,
617
+ {
618
+ dataSource,
619
+ columns,
620
+ bordered: true,
621
+ size: props.size && props.size,
622
+ onRow: (record) => {
623
+ return {
624
+ onClick: () => {
625
+ setSelectedRecord(record);
626
+ setModel(true);
627
+ }
628
+ };
629
+ }
630
+ }
631
+ ), model && /* @__PURE__ */ React19.createElement(ModelElement, { selectedStyle: false, style: false, className: void 0, selectedRecord, model, onCancel: () => setModel(false) }));
632
+ };
633
+
634
+ // src/Components/DatePicker.tsx
635
+ import React20, { useState as useState6 } from "react";
636
+ import { DatePicker } from "antd";
637
+ import { LeftOutlined, RightOutlined } from "@ant-design/icons";
638
+ import moment from "moment";
639
+ var DatePickerElement = (props) => {
640
+ const [date, setDate] = useState6(null);
641
+ const handleChange = (date2, dateString) => {
642
+ console.log("date---------", date2);
643
+ console.log("datestring", dateString);
644
+ if (date2) {
645
+ const formattedDate = dateString;
646
+ console.log("formattedDate-----------------", formattedDate);
647
+ setDate(date2);
648
+ console.log("changedDate------------", date2);
649
+ if (props.onChange) {
650
+ props.onChange(formattedDate);
651
+ }
652
+ } else {
653
+ setDate(null);
654
+ if (props.onChange) {
655
+ props.onChange("");
656
+ }
657
+ }
658
+ };
659
+ const onHandleDecrement = () => {
660
+ const currentDate = date || moment();
661
+ const newDate = moment(currentDate).subtract(1, "days");
662
+ setDate(newDate);
663
+ if (props.onChange) {
664
+ props.onChange(newDate.format("lll"));
665
+ }
666
+ };
667
+ const onHandleIncrement = () => {
668
+ const currentDate = date || moment();
669
+ const newDate = moment(currentDate).add(1, "days");
670
+ setDate(newDate);
671
+ if (props.onChange) {
672
+ props.onChange(newDate.format("lll"));
673
+ }
674
+ };
675
+ return /* @__PURE__ */ React20.createElement("div", null, /* @__PURE__ */ React20.createElement("button", { onClick: onHandleDecrement }, /* @__PURE__ */ React20.createElement(LeftOutlined, null)), /* @__PURE__ */ React20.createElement(
676
+ DatePicker,
677
+ {
678
+ placeholder: props.placeholder,
679
+ value: date,
680
+ variant: "borderless",
681
+ onChange: handleChange
682
+ }
683
+ ), /* @__PURE__ */ React20.createElement("button", { onClick: onHandleIncrement }, /* @__PURE__ */ React20.createElement(RightOutlined, null)));
409
684
  };
410
685
  export {
411
686
  AddMoreTable,
412
687
  ButtonElement,
413
688
  CheckboxElement,
414
689
  CkEditor,
690
+ DatePickerElement,
415
691
  MultipleSelectElement,
692
+ Navbar,
416
693
  NumberElement,
417
694
  PasswordElement,
418
695
  RadioElement,
419
696
  SelectElement,
697
+ Sidebar,
420
698
  SingleSelectElement,
699
+ TableElement,
421
700
  TextElement,
422
701
  TextareaElement
423
702
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.11-Beta21",
3
+ "version": "0.0.11-Beta210",
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.2",
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
  }
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ }
@@ -0,0 +1,10 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ module.exports = {
3
+
4
+ content: ['./src/**/*.{js,jsx,ts,tsx}'],
5
+ theme: {
6
+ extend: {},
7
+ },
8
+ plugins: [],
9
+ }
10
+