@sustaina/shared-ui 1.1.8 → 1.3.0

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.js CHANGED
@@ -1449,19 +1449,17 @@ function TooltipContent({
1449
1449
  ) });
1450
1450
  }
1451
1451
  function SortableRow({
1452
- itemId,
1453
- index,
1454
- control,
1455
1452
  availableColumns,
1456
1453
  currentColumns,
1457
- disableDrag = false,
1458
- disableEdit = false,
1459
- hideFormMessage,
1460
- removeColumn
1454
+ control,
1455
+ name,
1456
+ value,
1457
+ isDragging,
1458
+ onRemove
1461
1459
  }) {
1462
1460
  const { attributes, listeners, setNodeRef, transform, transition } = sortable.useSortable({
1463
- id: itemId,
1464
- disabled: disableDrag
1461
+ id: value,
1462
+ disabled: name == "columns.0.id"
1465
1463
  });
1466
1464
  const style = {
1467
1465
  transform: utilities.CSS.Transform.toString(transform),
@@ -1476,40 +1474,40 @@ function SortableRow({
1476
1474
  FormField2,
1477
1475
  {
1478
1476
  control,
1479
- name: `columns.${index}.id`,
1477
+ name,
1480
1478
  render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(FormItem2, { className: "flex-1", children: [
1481
1479
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
1482
1480
  /* @__PURE__ */ jsxRuntime.jsx(
1483
1481
  lucideReact.GripVertical,
1484
1482
  {
1483
+ ...attributes,
1484
+ ...listeners,
1485
1485
  className: cn(
1486
1486
  "h-5 w-5 text-[#B9B9B9] focus:outline-none cursor-grab",
1487
- index == 0 && "opacity-0 pointer-events-none"
1488
- ),
1489
- ...attributes,
1490
- ...listeners
1487
+ name == "columns.0.id" && "opacity-0 pointer-events-none"
1488
+ )
1491
1489
  }
1492
1490
  ),
1493
1491
  /* @__PURE__ */ jsxRuntime.jsxs(
1494
1492
  Select,
1495
1493
  {
1496
1494
  value: field.value,
1497
- onValueChange: (val) => {
1498
- field.onChange(val);
1499
- },
1500
- disabled: disableEdit || index == 0,
1495
+ onValueChange: field.onChange,
1496
+ disabled: name == "columns.0.id",
1501
1497
  children: [
1502
1498
  /* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsx(
1503
1499
  SelectTrigger,
1504
1500
  {
1505
1501
  className: cn(
1506
1502
  "w-full border-[#DDDDDD] data-[disabled]:opacity-100 aria-invalid:border-[#BB0B0E]",
1507
- index == 0 ? "text-[#8B8B8B] bg-[#EAEAEA] cursor-not-allowed" : ""
1503
+ name == "columns.0.id" ? "text-[#8B8B8B] bg-[#EAEAEA] cursor-not-allowed" : ""
1508
1504
  ),
1509
1505
  children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Choose column..." })
1510
1506
  }
1511
1507
  ) }),
1512
- /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: options.filter((i2) => i2.id === field.value || !currentColumns?.some((c) => c.id === i2.id)).sort(
1508
+ /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: options.filter(
1509
+ (i2) => i2.id === field.value || !currentColumns?.some((c, idx) => c.id === i2.id && idx !== index)
1510
+ ).sort(
1513
1511
  (a, b) => a.id === field.value ? -1 : b.id === field.value ? 1 : 0
1514
1512
  ).map((opt) => /* @__PURE__ */ jsxRuntime.jsx(
1515
1513
  SelectItem,
@@ -1526,7 +1524,7 @@ function SortableRow({
1526
1524
  ]
1527
1525
  }
1528
1526
  ),
1529
- index == 0 ? /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
1527
+ name == "columns.0.id" ? /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
1530
1528
  /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { className: "h-5 w-5", stroke: "white", fill: "#8B8B8B" }) }),
1531
1529
  /* @__PURE__ */ jsxRuntime.jsx(
1532
1530
  TooltipContent,
@@ -1541,14 +1539,14 @@ function SortableRow({
1541
1539
  ] }) }) : /* @__PURE__ */ jsxRuntime.jsx(
1542
1540
  lucideReact.CircleMinus,
1543
1541
  {
1544
- onClick: () => index > 0 && removeColumn(index),
1542
+ onClick: onRemove,
1545
1543
  className: "h-5 w-5 cursor-pointer",
1546
1544
  stroke: "white",
1547
1545
  fill: "#C32A2C"
1548
1546
  }
1549
1547
  )
1550
1548
  ] }),
1551
- /* @__PURE__ */ jsxRuntime.jsx(FormMessage, { className: cn("pl-6 text-[#BB0B0E]", hideFormMessage && "hidden") })
1549
+ !isDragging && /* @__PURE__ */ jsxRuntime.jsx(FormMessage, { className: cn("pl-6 text-[#BB0B0E]") })
1552
1550
  ] })
1553
1551
  }
1554
1552
  ) });
@@ -1623,18 +1621,31 @@ var GridSettingsModal = ({
1623
1621
  onClose,
1624
1622
  onSaveColumns
1625
1623
  }) => {
1626
- const [hideFormMessage, setHideFormMessage] = React3.useState(false);
1624
+ const [isDragging, setIsDragging] = React3.useState(false);
1627
1625
  const form = reactHookForm.useForm({
1628
1626
  resolver: t2(GridSettingsSchema),
1629
1627
  defaultValues: { columns: currentColumns },
1630
1628
  mode: "onChange"
1631
1629
  });
1630
+ const { control, trigger } = form;
1631
+ const { fields, append, remove, move } = reactHookForm.useFieldArray({
1632
+ control,
1633
+ name: "columns",
1634
+ keyName: "fieldId"
1635
+ });
1632
1636
  React3.useEffect(() => {
1633
1637
  if (isOpen) {
1634
1638
  form.reset({ columns: currentColumns });
1635
1639
  }
1636
1640
  }, [isOpen, currentColumns, form]);
1637
- const columns = form.watch("columns");
1641
+ const addColumn = async () => {
1642
+ const isValid2 = await trigger("columns");
1643
+ if (isValid2) {
1644
+ append({ id: "" });
1645
+ } else {
1646
+ return;
1647
+ }
1648
+ };
1638
1649
  const onSubmit = (data) => {
1639
1650
  const ordering = data.columns.map((i2) => i2.id);
1640
1651
  const visibility = Object.fromEntries(
@@ -1645,28 +1656,16 @@ var GridSettingsModal = ({
1645
1656
  onSaveColumns({ ordering, visibility, pinning });
1646
1657
  }
1647
1658
  };
1648
- const addColumn = async () => {
1649
- const isValid2 = await form.trigger("columns");
1650
- if (!isValid2) {
1651
- return;
1652
- }
1653
- form.setValue("columns", [...columns, { id: "" }], { shouldValidate: false });
1654
- };
1655
- const removeColumn = (index) => {
1656
- const newCols = [...columns];
1657
- newCols.splice(index, 1);
1658
- form.setValue("columns", newCols);
1659
- };
1660
1659
  const sensors = core.useSensors(core.useSensor(core.PointerSensor, { activationConstraint: { distance: 5 } }));
1661
- const handleDragEnd = (event) => {
1660
+ function handleDragEnd(event) {
1662
1661
  const { active, over } = event;
1663
1662
  if (!over || active.id === over.id) return;
1664
- const oldIndex = columns.findIndex((c) => c.id === active.id);
1665
- const newIndex = columns.findIndex((c) => c.id === over.id);
1666
- if (newIndex === 0) return;
1667
- const reordered = sortable.arrayMove(columns, oldIndex, newIndex);
1668
- form.setValue("columns", reordered, { shouldValidate: true });
1669
- };
1663
+ const oldIndex = fields.findIndex((f) => f.fieldId === active.id);
1664
+ const newIndex = fields.findIndex((f) => f.fieldId === over.id);
1665
+ if (oldIndex !== -1 && newIndex !== -1) {
1666
+ move(oldIndex, newIndex);
1667
+ }
1668
+ }
1670
1669
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "sm:max-w-xl p-0 border-0", showCloseButton: false, children: [
1671
1670
  /* @__PURE__ */ jsxRuntime.jsx(DialogClose, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1672
1671
  "button",
@@ -1698,43 +1697,42 @@ var GridSettingsModal = ({
1698
1697
  /* @__PURE__ */ jsxRuntime.jsx(
1699
1698
  SortableRow,
1700
1699
  {
1701
- itemId: columns[0]?.id,
1702
- index: 0,
1703
- control: form.control,
1700
+ value: fields[0]?.fieldId,
1701
+ control,
1702
+ name: `columns.0.id`,
1703
+ isDragging,
1704
1704
  availableColumns,
1705
- currentColumns: columns,
1706
- disableDrag: true,
1707
- disableEdit: true,
1708
- removeColumn
1709
- }
1705
+ currentColumns: fields
1706
+ },
1707
+ fields[0]?.fieldId
1710
1708
  ),
1711
1709
  /* @__PURE__ */ jsxRuntime.jsx(
1712
1710
  core.DndContext,
1713
1711
  {
1714
1712
  sensors,
1715
1713
  collisionDetection: core.closestCenter,
1716
- onDragStart: () => setHideFormMessage(true),
1714
+ onDragStart: () => setIsDragging(true),
1717
1715
  onDragEnd: (event) => {
1718
- setHideFormMessage(false);
1716
+ setIsDragging(false);
1719
1717
  handleDragEnd(event);
1720
1718
  },
1721
1719
  children: /* @__PURE__ */ jsxRuntime.jsx(
1722
1720
  sortable.SortableContext,
1723
1721
  {
1724
- items: columns?.slice(1).map((c) => c.id),
1722
+ items: fields?.slice(1).map((c) => c?.fieldId),
1725
1723
  strategy: sortable.verticalListSortingStrategy,
1726
- children: columns?.slice(1).map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
1724
+ children: fields?.slice(1).map((col, index2) => /* @__PURE__ */ jsxRuntime.jsx(
1727
1725
  SortableRow,
1728
1726
  {
1729
- itemId: item.id,
1730
- index: index + 1,
1731
- control: form.control,
1727
+ value: col?.fieldId,
1728
+ control,
1729
+ name: `columns.${index2 + 1}.id`,
1730
+ isDragging,
1732
1731
  availableColumns,
1733
- currentColumns: columns,
1734
- hideFormMessage,
1735
- removeColumn
1732
+ currentColumns: fields,
1733
+ onRemove: () => remove(index2 + 1)
1736
1734
  },
1737
- item.id + index
1735
+ col?.fieldId
1738
1736
  ))
1739
1737
  }
1740
1738
  )
@@ -1746,7 +1744,7 @@ var GridSettingsModal = ({
1746
1744
  type: "button",
1747
1745
  className: cn("bg-[#41875C99] text-white w-full rounded-t-lg", addButtonClassname),
1748
1746
  onClick: addColumn,
1749
- disabled: columns.length >= limit,
1747
+ disabled: fields.length >= limit,
1750
1748
  children: [
1751
1749
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "h-4 w-4 mr-1" }),
1752
1750
  " Add column"
@@ -1865,10 +1863,12 @@ var Navbar = ({
1865
1863
  subButtonDisable = false,
1866
1864
  onMainButtonClick,
1867
1865
  onSubButtonClick,
1866
+ separatorDisable = false,
1868
1867
  searchButton
1869
1868
  }) => {
1870
1869
  const { isMobile, isTablet, isDesktop } = useScreenSize_default();
1871
1870
  const Icon3 = lucideReact.CircleHelp;
1871
+ const shouldShowSeparator = !separatorDisable && React3.isValidElement(searchButton);
1872
1872
  return /* @__PURE__ */ jsxRuntime.jsxs(
1873
1873
  "nav",
1874
1874
  {
@@ -1964,7 +1964,7 @@ var Navbar = ({
1964
1964
  children: subButtonText
1965
1965
  }
1966
1966
  ),
1967
- React3.isValidElement(searchButton) ? /* @__PURE__ */ jsxRuntime.jsx("div", { role: "separator", className: "ml-1 w-[1px] h-10 bg-white" }) : "",
1967
+ shouldShowSeparator && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "separator", className: "ml-1 w-[1px] h-10 bg-white" }),
1968
1968
  React3.isValidElement(searchButton) ? searchButton : ""
1969
1969
  ] })
1970
1970
  ]
@@ -2617,8 +2617,8 @@ var TagsInput = ({ value = [], onChange, onClear, error }) => {
2617
2617
  onChange([...value, trimmed]);
2618
2618
  setInputValue("");
2619
2619
  };
2620
- const removeTag = (index) => {
2621
- const newTags = value.filter((_, i2) => i2 !== index);
2620
+ const removeTag = (index2) => {
2621
+ const newTags = value.filter((_, i2) => i2 !== index2);
2622
2622
  onChange(newTags);
2623
2623
  };
2624
2624
  const handleKeyDown = (e2) => {
@@ -2957,8 +2957,8 @@ function buildLocalizeFn(args) {
2957
2957
  const width = options?.width ? String(options.width) : args.defaultWidth;
2958
2958
  valuesArray = args.values[width] || args.values[defaultWidth];
2959
2959
  }
2960
- const index = args.argumentCallback ? args.argumentCallback(value) : value;
2961
- return valuesArray[index];
2960
+ const index2 = args.argumentCallback ? args.argumentCallback(value) : value;
2961
+ return valuesArray[index2];
2962
2962
  };
2963
2963
  }
2964
2964
 
@@ -3278,7 +3278,7 @@ var match = {
3278
3278
  defaultMatchWidth: "wide",
3279
3279
  parsePatterns: parseQuarterPatterns,
3280
3280
  defaultParseWidth: "any",
3281
- valueCallback: (index) => index + 1
3281
+ valueCallback: (index2) => index2 + 1
3282
3282
  }),
3283
3283
  month: buildMatchFn({
3284
3284
  matchPatterns: matchMonthPatterns,
@@ -4720,7 +4720,8 @@ var AdvanceSearch = ({
4720
4720
  portalId,
4721
4721
  iconColor = "#ffffff",
4722
4722
  limitRows = 4,
4723
- onSearch
4723
+ onSearch,
4724
+ onClear
4724
4725
  }) => {
4725
4726
  const fieldsData = React3.useMemo(() => fields || [], [fields]);
4726
4727
  const {
@@ -4763,6 +4764,8 @@ var AdvanceSearch = ({
4763
4764
  return { [r2.fieldName]: { startsWith: val1 } };
4764
4765
  case "endsWith":
4765
4766
  return { [r2.fieldName]: { endsWith: val1 } };
4767
+ case "equals":
4768
+ return { [r2.fieldName]: { equals: val1 } };
4766
4769
  case "notEquals":
4767
4770
  return { [r2.fieldName]: { not: val1 } };
4768
4771
  case "gt":
@@ -4789,8 +4792,12 @@ var AdvanceSearch = ({
4789
4792
  return { [r2.fieldName]: { hasEvery: String(val1).split(",") } };
4790
4793
  case "containsOnly":
4791
4794
  return { [r2.fieldName]: { equals: String(val1).split(",") } };
4792
- default:
4793
- return { [r2.fieldName]: val1 };
4795
+ case "on":
4796
+ return { [r2.fieldName]: { on: val1 } };
4797
+ case "after":
4798
+ return { [r2.fieldName]: { after: val1 } };
4799
+ case "before":
4800
+ return { [r2.fieldName]: { before: val1 } };
4794
4801
  }
4795
4802
  }).filter(Boolean)
4796
4803
  };
@@ -4846,6 +4853,7 @@ var AdvanceSearch = ({
4846
4853
  onClick: () => {
4847
4854
  clearAllRow();
4848
4855
  Object.keys(getValues()).forEach((k) => resetField(k));
4856
+ if (onClear) onClear();
4849
4857
  },
4850
4858
  children: "Clear Search"
4851
4859
  }
@@ -4865,10 +4873,180 @@ var AdvanceSearch = ({
4865
4873
  );
4866
4874
  };
4867
4875
  var AdvanceSearch_default = AdvanceSearch;
4876
+ function cn3(...inputs) {
4877
+ return tailwindMerge.twMerge(clsx3.clsx(inputs));
4878
+ }
4879
+ function Dialog2({ ...props }) {
4880
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Root, { "data-slot": "dialog", ...props });
4881
+ }
4882
+ function DialogPortal2({ ...props }) {
4883
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Portal, { "data-slot": "dialog-portal", ...props });
4884
+ }
4885
+ function DialogOverlay2({ className, ...props }) {
4886
+ return /* @__PURE__ */ jsxRuntime.jsx(
4887
+ DialogPrimitive__namespace.Overlay,
4888
+ {
4889
+ "data-slot": "dialog-overlay",
4890
+ className: cn3(
4891
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
4892
+ className
4893
+ ),
4894
+ ...props
4895
+ }
4896
+ );
4897
+ }
4898
+ function DialogContent2({
4899
+ className,
4900
+ children,
4901
+ showCloseButton = true,
4902
+ ...props
4903
+ }) {
4904
+ return /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal2, { "data-slot": "dialog-portal", children: [
4905
+ /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay2, {}),
4906
+ /* @__PURE__ */ jsxRuntime.jsxs(
4907
+ DialogPrimitive__namespace.Content,
4908
+ {
4909
+ "data-slot": "dialog-content",
4910
+ className: cn3(
4911
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
4912
+ className
4913
+ ),
4914
+ ...props,
4915
+ children: [
4916
+ children,
4917
+ showCloseButton && /* @__PURE__ */ jsxRuntime.jsxs(
4918
+ DialogPrimitive__namespace.Close,
4919
+ {
4920
+ "data-slot": "dialog-close",
4921
+ className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
4922
+ children: [
4923
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}),
4924
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
4925
+ ]
4926
+ }
4927
+ )
4928
+ ]
4929
+ }
4930
+ )
4931
+ ] });
4932
+ }
4933
+ function DialogHeader2({ className, ...props }) {
4934
+ return /* @__PURE__ */ jsxRuntime.jsx(
4935
+ "div",
4936
+ {
4937
+ "data-slot": "dialog-header",
4938
+ className: cn3("flex flex-col gap-2 text-center sm:text-left", className),
4939
+ ...props
4940
+ }
4941
+ );
4942
+ }
4943
+ function DialogTitle2({ className, ...props }) {
4944
+ return /* @__PURE__ */ jsxRuntime.jsx(
4945
+ DialogPrimitive__namespace.Title,
4946
+ {
4947
+ "data-slot": "dialog-title",
4948
+ className: cn3("text-lg leading-none font-semibold", className),
4949
+ ...props
4950
+ }
4951
+ );
4952
+ }
4953
+ function DialogDescription2({
4954
+ className,
4955
+ ...props
4956
+ }) {
4957
+ return /* @__PURE__ */ jsxRuntime.jsx(
4958
+ DialogPrimitive__namespace.Description,
4959
+ {
4960
+ "data-slot": "dialog-description",
4961
+ className: cn3("text-muted-foreground text-sm", className),
4962
+ ...props
4963
+ }
4964
+ );
4965
+ }
4966
+ var buttonVariants4 = classVarianceAuthority.cva(
4967
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer",
4968
+ {
4969
+ variants: {
4970
+ variant: {
4971
+ default: "bg-sus-primary-1 text-primary-foreground shadow-xs hover:bg-sus-primary/90",
4972
+ cancel: "border bg-[#8B8B8B] text-white shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:hover:bg-input/50",
4973
+ outlineLeave: "border border-[#BB0B0E] bg-background shadow-xs hover:bg-accent hover:text-accent-foreground text-[#BB0B0E]"
4974
+ },
4975
+ size: {
4976
+ default: "h-9 px-4 has-[>svg]:px-3",
4977
+ option: "py-5 h-9 px-4 has-[>svg]:px-3",
4978
+ sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
4979
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
4980
+ icon: "size-9",
4981
+ "icon-xs": "size-5",
4982
+ "icon-sm": "size-[22px]",
4983
+ "icon-md": "size-7",
4984
+ "icon-lg": "size-10"
4985
+ },
4986
+ active: {
4987
+ true: "bg-sus-primary-1 text-white",
4988
+ false: ""
4989
+ }
4990
+ },
4991
+ defaultVariants: {
4992
+ variant: "default",
4993
+ size: "default"
4994
+ }
4995
+ }
4996
+ );
4997
+ function Button4({
4998
+ className,
4999
+ variant,
5000
+ size,
5001
+ active,
5002
+ asChild = false,
5003
+ ...props
5004
+ }) {
5005
+ const Comp = asChild ? reactSlot.Slot : "button";
5006
+ return /* @__PURE__ */ jsxRuntime.jsx(
5007
+ Comp,
5008
+ {
5009
+ "data-slot": "button",
5010
+ className: cn3(buttonVariants4({ variant, size, className, active })),
5011
+ ...props
5012
+ }
5013
+ );
5014
+ }
5015
+ function ConfirmDialog({ dialogData, setDialog, onClose }) {
5016
+ const handleClose = () => {
5017
+ setDialog({ state: false });
5018
+ onClose?.();
5019
+ };
5020
+ const titleColor = {
5021
+ default: "text-[#000000]",
5022
+ success: "text-[#3f9e33]",
5023
+ error: "text-[#c63638]"
5024
+ };
5025
+ const showCloseBtn = dialogData.showCloseBtn ?? true;
5026
+ return /* @__PURE__ */ jsxRuntime.jsx(Dialog2, { open: dialogData.state, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent2, { children: [
5027
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader2, { children: [
5028
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle2, { className: cn3(titleColor[dialogData.variant || "default"], "font-bold"), children: dialogData.title || "" }),
5029
+ /* @__PURE__ */ jsxRuntime.jsx(DialogDescription2, { children: dialogData.description || "" })
5030
+ ] }),
5031
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex justify-center py-5 gap-5", children: [
5032
+ showCloseBtn && /* @__PURE__ */ jsxRuntime.jsx(Button4, { variant: "cancel", onClick: handleClose, children: "Close" }),
5033
+ dialogData.btn && /* @__PURE__ */ jsxRuntime.jsx(
5034
+ Button4,
5035
+ {
5036
+ variant: dialogData.variantBtn || "default",
5037
+ disabled: dialogData.btnState === false,
5038
+ onClick: dialogData.onClickBtn,
5039
+ children: dialogData.btn
5040
+ }
5041
+ )
5042
+ ] })
5043
+ ] }) });
5044
+ }
4868
5045
 
4869
5046
  exports.AdvanceSearch = AdvanceSearch_default;
4870
5047
  exports.Button = Button;
4871
5048
  exports.DataTable = DataTable_default;
5049
+ exports.Dialog = ConfirmDialog;
4872
5050
  exports.FormErrorMessage = FormErrorMessage;
4873
5051
  exports.FormField = FormField;
4874
5052
  exports.FormFieldContext = FormFieldContext;