@sikka/hawa
Version:
Modern UI Kit made with Tailwind
1,381 lines (1,365 loc) • 69.5 kB
JavaScript
"use client";
// elements/dataTable/DataTable.tsx
import * as React11 from "react";
import {
flexRender,
getCoreRowModel,
getFilteredRowModel,
getPaginationRowModel,
getExpandedRowModel,
getSortedRowModel,
useReactTable
} from "@tanstack/react-table";
// util/index.ts
import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";
function cn(...inputs) {
return twMerge(clsx(inputs));
}
// elements/button/Button.tsx
import * as React5 from "react";
import { cva } from "class-variance-authority";
// elements/helperText/HelperText.tsx
import React from "react";
var HelperText = ({ helperText }) => /* @__PURE__ */ React.createElement(
"p",
{
className: cn(
"hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all",
helperText ? "hawa-h-4 hawa-opacity-100" : "hawa-h-0 hawa-opacity-0"
)
},
helperText
);
// elements/label/Label.tsx
import * as React3 from "react";
// elements/tooltip/Tooltip.tsx
import React2 from "react";
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
var TooltipContent = React2.forwardRef(({ className, sideOffset = 4, size = "default", ...props }, ref) => /* @__PURE__ */ React2.createElement(
TooltipPrimitive.Content,
{
ref,
sideOffset,
className: cn(
"hawa-z-50 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-text-popover-foreground hawa-shadow-md hawa-animate-in hawa-fade-in-0 hawa-zoom-in-95 data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=closed]:hawa-zoom-out-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2",
{
"hawa-text-xs": size === "small",
"hawa-text-xl": size === "large"
},
className
),
...props
}
));
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
var TooltipArrow = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React2.createElement(TooltipPrimitive.Arrow, { ref, className: cn(className), ...props }));
TooltipArrow.displayName = TooltipPrimitive.Arrow.displayName;
var Tooltip = ({
side,
size,
open,
content,
children,
disabled,
defaultOpen,
onOpenChange,
triggerProps,
contentProps,
providerProps,
delayDuration = 300,
...props
}) => {
return /* @__PURE__ */ React2.createElement(
TooltipPrimitive.TooltipProvider,
{
delayDuration,
...providerProps
},
/* @__PURE__ */ React2.createElement(
TooltipPrimitive.Root,
{
open: !disabled && open,
defaultOpen,
onOpenChange,
...props
},
/* @__PURE__ */ React2.createElement(TooltipPrimitive.Trigger, { ...triggerProps }, children),
/* @__PURE__ */ React2.createElement(
TooltipContent,
{
size,
side,
align: "center",
...contentProps,
style: {
...contentProps == null ? void 0 : contentProps.style,
maxWidth: "var(--radix-tooltip-content-available-width)",
maxHeight: "var(--radix-tooltip-content-available-height)"
}
},
content
)
)
);
};
// elements/label/Label.tsx
var Label = React3.forwardRef(({ className, hint, hintSide, required, children, ...props }, ref) => /* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-gap-1 hawa-transition-all" }, /* @__PURE__ */ React3.createElement(
"label",
{
ref,
className: cn(
"hawa-text-sm hawa-font-medium hawa-leading-none peer-disabled:hawa-cursor-not-allowed peer-disabled:hawa-opacity-70",
className
),
...props
},
children,
required && /* @__PURE__ */ React3.createElement("span", { className: "hawa-mx-0.5 hawa-text-red-500" }, "*")
), hint && /* @__PURE__ */ React3.createElement(
Tooltip,
{
content: hint,
side: hintSide,
triggerProps: {
tabIndex: -1,
onClick: (event) => event.preventDefault()
}
},
/* @__PURE__ */ React3.createElement("div", null, /* @__PURE__ */ React3.createElement(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
className: "hawa-h-[14px] hawa-w-[14px] hawa-cursor-help",
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
},
/* @__PURE__ */ React3.createElement("circle", { cx: "12", cy: "12", r: "10" }),
/* @__PURE__ */ React3.createElement("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
/* @__PURE__ */ React3.createElement("path", { d: "M12 17h.01" })
))
)));
Label.displayName = "Label";
// elements/loading/Loading.tsx
import React4 from "react";
var Loading = ({
design = "spinner",
size = "normal",
themeMode = "light",
classNames,
color,
...props
}) => {
let sizeStyles = {
button: "hawa-h-4 hawa-w-4",
xs: "hawa-h-1 hawa-w-1",
sm: "hawa-h-6 hawa-w-6",
normal: "hawa-h-8 hawa-w-8",
lg: "hawa-h-14 hawa-w-14",
xl: "hawa-h-24 hawa-w-24"
};
let progressSizes = {
button: "hawa-h-1",
xs: "hawa-h-1 hawa-w-1",
sm: "hawa-h-6 hawa-w-6",
normal: "",
lg: "hawa-h-6",
xl: "hawa-h-10 hawa-w-64"
};
let animationStyles = {
pulse: "hawa-animate-in hawa-fade-in hawa-duration-1000",
bounce: "hawa-animate-bounce"
};
switch (design.split("-")[0]) {
case "dots":
return /* @__PURE__ */ React4.createElement(
"div",
{
className: cn(
"hawa-flex hawa-flex-row hawa-gap-2",
classNames == null ? void 0 : classNames.container
)
},
/* @__PURE__ */ React4.createElement(
"div",
{
className: cn(
"hawa-animate-bounce hawa-rounded-full hawa-delay-100 hawa-repeat-infinite",
size === "button" ? "hawa-h-2 hawa-w-2" : sizeStyles[size],
animationStyles[design.split("-")[1]],
color ? color : "hawa-bg-primary"
)
}
),
/* @__PURE__ */ React4.createElement(
"div",
{
className: cn(
"hawa-animate-bounce hawa-rounded-full hawa-delay-200 hawa-repeat-infinite",
size === "button" ? "hawa-h-2 hawa-w-2" : sizeStyles[size],
animationStyles[design.split("-")[1]],
color ? color : "hawa-bg-primary"
)
}
),
/* @__PURE__ */ React4.createElement(
"div",
{
className: cn(
"hawa-animate-bounce hawa-rounded-full hawa-delay-300 hawa-repeat-infinite",
size === "button" ? "hawa-h-2 hawa-w-2" : sizeStyles[size],
animationStyles[design.split("-")[1]],
color ? color : "hawa-bg-primary"
)
}
)
);
case "square":
return /* @__PURE__ */ React4.createElement(
"svg",
{
className: cn(
"squircle-container",
sizeStyles[size],
classNames == null ? void 0 : classNames.container
),
viewBox: "0 0 35 35",
height: "35",
width: "35"
},
/* @__PURE__ */ React4.createElement(
"rect",
{
className: "squircle-track",
x: "2.5",
y: "2.5",
fill: "none",
strokeWidth: "5px",
width: "32.5",
height: "32.5"
}
),
/* @__PURE__ */ React4.createElement(
"rect",
{
className: "square-car",
x: "2.5",
y: "2.5",
fill: "none",
strokeWidth: "5px",
width: "32.5",
height: "32.5",
pathLength: "100"
}
)
);
case "squircle":
return /* @__PURE__ */ React4.createElement(
"svg",
{
x: "0px",
y: "0px",
viewBox: "0 0 37 37",
height: "37",
width: "37",
preserveAspectRatio: "xMidYMid meet",
className: cn(
"squircle-container",
sizeStyles[size],
classNames == null ? void 0 : classNames.container
)
},
/* @__PURE__ */ React4.createElement(
"path",
{
className: cn("squircle-track", classNames == null ? void 0 : classNames.track),
fill: "none",
strokeWidth: "5",
pathLength: "100",
d: "M0.37 18.5 C0.37 5.772 5.772 0.37 18.5 0.37 S36.63 5.772 36.63 18.5 S31.228 36.63 18.5 36.63 S0.37 31.228 0.37 18.5"
}
),
/* @__PURE__ */ React4.createElement(
"path",
{
className: cn("squircle-car", classNames == null ? void 0 : classNames.car),
fill: "none",
strokeWidth: "5",
pathLength: "100",
d: "M0.37 18.5 C0.37 5.772 5.772 0.37 18.5 0.37 S36.63 5.772 36.63 18.5 S31.228 36.63 18.5 36.63 S0.37 31.228 0.37 18.5"
}
)
);
case "progress":
return /* @__PURE__ */ React4.createElement(
"div",
{
className: cn(
"progress-loading after:hawa-rounded hawa-rounded",
progressSizes[size],
classNames == null ? void 0 : classNames.container
)
}
);
case "orbit":
return /* @__PURE__ */ React4.createElement("div", { className: cn("orbit-container", classNames == null ? void 0 : classNames.container) });
default:
return /* @__PURE__ */ React4.createElement(
"svg",
{
viewBox: "0 0 40 40",
height: "40",
width: "40",
className: cn(
"circle-container",
sizeStyles[size],
classNames == null ? void 0 : classNames.container
)
},
/* @__PURE__ */ React4.createElement(
"circle",
{
className: cn(
"circle-track",
{
"hawa-stroke-primary-foreground": themeMode === "dark",
"hawa-stroke-primary": themeMode === "light"
},
classNames == null ? void 0 : classNames.track
),
cx: "20",
cy: "20",
r: "17.5",
fill: "none",
strokeWidth: "5px",
pathLength: "100"
}
),
/* @__PURE__ */ React4.createElement(
"circle",
{
className: cn(
"circle-car",
{
"hawa-stroke-primary-foreground": themeMode === "dark",
"hawa-stroke-primary": themeMode === "light"
},
classNames == null ? void 0 : classNames.car
),
cx: "20",
cy: "20",
r: "17.5",
fill: "none",
pathLength: "100",
strokeWidth: "5px"
}
)
);
}
};
// elements/button/Button.tsx
var buttonVariants = cva(
"hawa-inline-flex hawa-items-center hawa-select-none hawa-rounded-md hawa-text-sm hawa-font-medium hawa-ring-offset-background hawa-transition-colors focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-2 disabled:hawa-pointer-events-none disabled:hawa-opacity-50",
{
variants: {
variant: {
default: "hawa-bg-primary hawa-text-primary-foreground hover:hawa-bg-primary/90",
light: "hawa-bg-primary/20 hawa-text-primary hover:hawa-bg-primary/40",
destructive: "hawa-bg-destructive hawa-text-destructive-foreground hover:hawa-bg-destructive/90",
outline: "hawa-border hawa-border-input hawa-bg-transparent hover:hawa-bg-accent hover:hawa-text-accent-foreground",
secondary: "hawa-bg-secondary hawa-text-secondary-foreground hover:hawa-bg-secondary/80",
ghost: "hover:hawa-bg-accent hover:hawa-text-accent-foreground",
link: "hawa-text-primary hawa-underline-offset-4 hover:hawa-underline",
combobox: "hawa-bg-background hawa-border",
neoBrutalism: "neo-brutalism"
// "hawa-cursor-pointer hawa-transition-all hawa-uppercase hawa-font-mono dark:hawa-bg-black hawa-font-bold hawa-py-2 hawa-px-4 hawa-rounded hawa-border-2 hawa-border-primary hawa-shadow-color-primary hawa-transition-[hawa-transform_50ms, hawa-box-shadow_50ms] active:hawa-translate-x-0.5 active:hawa-translate-y-0.5 active:hawa-shadow-color-primary-active shadow-color-primary active:shadow-color-primary-active",
},
size: {
default: "hawa-h-10 hawa-px-4 hawa-py-2",
heightless: "hawa-px-4 hawa-py-4",
xs: "hawa-h-fit hawa-min-h-[25px] hawa-py-1 hawa-text-[10px] hawa-px-2 ",
sm: "hawa-h-9 hawa-text-[11px] hawa-rounded-md hawa-px-3",
lg: "hawa-h-11 hawa-rounded-md hawa-px-8",
xl: "hawa-h-14 hawa-rounded-md hawa-px-10",
icon: "hawa-h-10 hawa-w-10",
smallIcon: "hawa-h-7 hawa-w-7"
}
},
defaultVariants: { variant: "default", size: "default" }
}
);
var Button = React5.forwardRef(
({
className,
label,
variant,
size,
asChild = false,
centered = true,
isLoading,
children,
labelProps,
showHelperText = false,
asInput = false,
...props
}, ref) => {
const Comp = "button";
const loadingColor = variant === "outline" || variant === "ghost" || variant === "neoBrutalism" ? "hawa-bg-primary" : "hawa-bg-primary-foreground";
if (asInput) {
return /* @__PURE__ */ React5.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2" }, label && /* @__PURE__ */ React5.createElement(Label, { ...labelProps }, label), /* @__PURE__ */ React5.createElement(
Comp,
{
className: cn(
buttonVariants({ variant, size, className }),
centered && "hawa-justify-center"
),
ref,
...props
},
isLoading ? /* @__PURE__ */ React5.createElement(
Loading,
{
design: size === "icon" || size === "smallIcon" ? "spinner" : "dots-pulse",
themeMode: variant === "outline" ? "light" : "dark",
color: loadingColor,
size: size === "sm" || size === "xs" ? "xs" : "button"
}
) : children
), showHelperText && /* @__PURE__ */ React5.createElement(HelperText, { helperText: props.helperText }));
} else {
return /* @__PURE__ */ React5.createElement(
Comp,
{
className: cn(
buttonVariants({ variant, size, className }),
centered && "hawa-justify-center"
),
ref,
...props
},
isLoading ? /* @__PURE__ */ React5.createElement(
Loading,
{
design: size === "icon" || size === "smallIcon" ? "spinner" : "dots-pulse",
themeMode: variant === "outline" ? "light" : "dark",
color: loadingColor,
size: size === "sm" || size === "xs" ? "xs" : "button"
}
) : children
);
}
}
);
Button.displayName = "Button";
// elements/checkbox/Checkbox.tsx
import * as React6 from "react";
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
var Checkbox = ({
id,
label,
sublabel,
helperText,
disabled,
size = "default",
radius = "inherit",
...props
}) => {
let labelLineHeightStyles = {
xs: sublabel || helperText ? 0.5 : 0.1,
sm: 0.6,
default: 1,
md: 0.8,
lg: 0.9,
xl: 1
};
return /* @__PURE__ */ React6.createElement(
"div",
{
className: cn(
"hawa-flex hawa-gap-2",
size === "default" ? "hawa-items-top" : "hawa-items-center"
)
},
/* @__PURE__ */ React6.createElement(
CheckboxElement,
{
...props,
size,
radius,
disabled,
id
}
),
(label || helperText) && /* @__PURE__ */ React6.createElement("div", { className: "hawa-grid hawa-gap-1.5" }, label && /* @__PURE__ */ React6.createElement(
"label",
{
htmlFor: id,
className: cn(
"hawa-w-fit hawa-select-none hawa-pt-0.5 hawa-text-sm hawa-font-medium",
disabled ? "hawa-cursor-not-allowed hawa-text-muted-foreground hawa-opacity-70" : "hawa-cursor-pointer"
),
style: {
// lineHeight: labelLineHeightStyles[size]
lineHeight: 1
}
},
label
), sublabel && /* @__PURE__ */ React6.createElement(
"label",
{
htmlFor: id,
className: cn(
"hawa-w-fit hawa-select-none hawa-text-sm hawa-text-muted-foreground",
disabled ? "hawa-cursor-not-allowed hawa-text-muted-foreground hawa-opacity-70" : "hawa-cursor-pointer"
)
},
sublabel
), helperText && !disabled && /* @__PURE__ */ React6.createElement(
"label",
{
htmlFor: id,
className: cn(
"hawa-w-fit hawa-select-none hawa-text-xs hawa-text-helper-color",
disabled && "hawa-cursor-not-allowed hawa-opacity-70"
)
},
helperText
))
);
};
var CheckboxElement = React6.forwardRef(({ radius = "inherit", size = "default", className, ...props }, ref) => {
let checkboxRadius = {
none: "hawa-rounded-none",
inherit: "hawa-rounded-sm",
full: "hawa-rounded-full"
};
let checkboxSizes = {
xs: "hawa-w-3 hawa-h-3",
sm: "hawa-w-6 hawa-h-6",
default: "hawa-icon",
md: "hawa-w-8 hawa-h-8",
lg: "hawa-w-10 hawa-h-10",
xl: "hawa-w-12 hawa-h-12"
};
let checkboxIndicatorSizes = {
xs: "0.5em",
default: "0.60em",
sm: "0.75em",
md: "0.875em",
lg: "1em",
xl: "1.25em"
};
return /* @__PURE__ */ React6.createElement(
CheckboxPrimitive.Root,
{
ref,
className: cn(
"hawa-peer hawa-shrink-0 hawa-border hawa-border-primary hawa-ring-offset-background focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-2 disabled:hawa-cursor-not-allowed disabled:hawa-opacity-50 data-[state=checked]:hawa-bg-primary data-[state=checked]:hawa-text-primary-foreground",
checkboxSizes[size],
checkboxRadius[radius],
className
),
...props
},
/* @__PURE__ */ React6.createElement(
CheckboxPrimitive.Indicator,
{
className: cn(
"hawa-flex hawa-items-center hawa-justify-center hawa-text-current"
)
},
/* @__PURE__ */ React6.createElement(
"svg",
{
"aria-label": "Check Mark",
stroke: "currentColor",
fill: "currentColor",
strokeWidth: "0",
viewBox: "0 0 512 512",
height: checkboxIndicatorSizes[size],
width: checkboxIndicatorSizes[size]
},
/* @__PURE__ */ React6.createElement("path", { d: "M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z" })
),
" "
)
);
});
CheckboxElement.displayName = CheckboxPrimitive.Root.displayName;
// elements/dropdownMenu/DropdownMenu.tsx
import * as React7 from "react";
import { Portal } from "@headlessui/react";
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
var DropdownMenuRoot = DropdownMenuPrimitive.Root;
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
var DropdownMenuSub = DropdownMenuPrimitive.Sub;
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
var DropdownMenuSubTrigger = React7.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ React7.createElement(
DropdownMenuPrimitive.SubTrigger,
{
ref,
className: cn(
"hawa-flex hawa-cursor-default hawa-select-none hawa-items-center hawa-justify-between hawa-rounded-sm hawa-text-sm hawa-outline-none focus:hawa-bg-accent data-[state=open]:hawa-bg-accent",
inset && "hawa-pl-8",
className
),
...props
},
/* @__PURE__ */ React7.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-gap-2" }, children),
" ",
/* @__PURE__ */ React7.createElement(
"svg",
{
"aria-label": "Chevron Right Icon",
stroke: "currentColor",
fill: "currentColor",
strokeWidth: "0",
viewBox: "0 0 16 16",
height: "1em",
width: "1em",
className: cn(props.dir === "rtl" ? "hawa-rotate-180" : "")
},
/* @__PURE__ */ React7.createElement(
"path",
{
fillRule: "evenodd",
d: "M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"
}
)
)
));
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
var DropdownMenuSubContent = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React7.createElement(
DropdownMenuPrimitive.SubContent,
{
ref,
className: cn(
"hawa-z-50 hawa-min-w-[8rem] hawa-gap-1 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-p-1 hawa-text-popover-foreground hawa-shadow-lg data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2",
className
),
...props
}
));
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
var DropdownMenuContent = React7.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React7.createElement(Portal, null, /* @__PURE__ */ React7.createElement(
DropdownMenuPrimitive.Content,
{
ref,
sideOffset,
className: cn(
"hawa-z-50 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-p-1 hawa-text-popover-foreground hawa-shadow-md data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2",
className
),
...props
}
)));
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
var DropdownMenuItem = React7.forwardRef(({ className, inset, badged, slug, LinkComponent = "a", ...props }, ref) => {
return /* @__PURE__ */ React7.createElement(LinkComponent, { href: slug }, /* @__PURE__ */ React7.createElement(
DropdownMenuPrimitive.Item,
{
disabled: props.disabled,
ref,
className: cn(
"hawa-relative hawa-flex hawa-cursor-pointer hawa-select-none hawa-items-center hawa-justify-between hawa-rounded-sm hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50",
inset && "hawa-pl-8",
props.end && Array.isArray(props.children) && props.children[1] && "hawa-gap-6",
className
),
...props
},
/* @__PURE__ */ React7.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-gap-2" }, props.children),
props.end && props.end,
!props.end && props.shortcut && /* @__PURE__ */ React7.createElement(DropdownMenuShortcut, null, props.shortcut),
!props.end && badged && /* @__PURE__ */ React7.createElement("div", { className: "hawa-h-3 hawa-w-3 hawa-rounded-full hawa-bg-red-500" })
));
});
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
var DropdownMenuCheckboxItem = React7.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ React7.createElement(
DropdownMenuPrimitive.CheckboxItem,
{
ref,
className: cn(
"hawa-relative hawa-flex hawa-cursor-default hawa-select-none hawa-items-center hawa-rounded-sm hawa-py-1.5 hawa-pl-8 hawa-pr-2 hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-bg-accent focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50",
className
),
checked,
...props
},
/* @__PURE__ */ React7.createElement("span", { className: "hawa-absolute hawa-left-2 hawa-flex hawa-h-3.5 hawa-w-3.5 hawa-items-center hawa-justify-center" }, /* @__PURE__ */ React7.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React7.createElement(
"svg",
{
"aria-label": "Check Mark",
stroke: "currentColor",
fill: "currentColor",
strokeWidth: "0",
viewBox: "0 0 512 512",
height: "0.60em",
width: "0.60em"
},
/* @__PURE__ */ React7.createElement("path", { d: "M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z" })
), " ")),
children
));
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
var DropdownMenuRadioItem = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ React7.createElement(
DropdownMenuPrimitive.RadioItem,
{
ref,
className: cn(
"hawa-relative hawa-flex hawa-cursor-pointer hawa-select-none hawa-items-center hawa-rounded-sm hawa-py-1.5 hawa-pl-8 hawa-pr-2 hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-bg-accent focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50",
className
),
...props
},
/* @__PURE__ */ React7.createElement("span", { className: "hawa-absolute hawa-left-2 hawa-flex hawa-h-3.5 hawa-w-3.5 hawa-items-center hawa-justify-center" }, /* @__PURE__ */ React7.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React7.createElement(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
width: "24",
"aria-label": "Circle",
height: "24",
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round",
className: "hawa-h-2 hawa-w-2 hawa-fill-current"
},
/* @__PURE__ */ React7.createElement("circle", { cx: "12", cy: "12", r: "10" })
))),
children
));
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
var DropdownMenuLabel = React7.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ React7.createElement(
DropdownMenuPrimitive.Label,
{
ref,
className: cn(
"hawa-px-2 hawa-py-1.5 hawa-text-sm hawa-font-semibold",
inset && "hawa-pl-8",
className
),
...props
}
));
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
var DropdownMenuSeparator = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React7.createElement(
DropdownMenuPrimitive.Separator,
{
ref,
className: cn("hawa--mx-1 hawa-my-1 hawa-h-px hawa-bg-muted", className),
...props
}
));
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
var DropdownMenuShortcut = ({
className,
...props
}) => {
return /* @__PURE__ */ React7.createElement(
"span",
{
className: cn(
"hawa-text-xs hawa-tracking-widest hawa-opacity-60",
className
),
...props
}
);
};
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
var DropdownMenu = ({
trigger,
items,
direction,
sideOffset,
side,
className,
classNames,
contentProps,
triggerClassname,
triggerProps,
align,
alignOffset,
onItemSelect,
size = "default",
width = "default",
header,
onOpenChange,
open,
LinkComponent
}) => {
const widthStyles = {
default: "hawa-min-w-[8rem]",
sm: "hawa-w-fit",
lg: "hawa-w-[200px]",
parent: "ddm-w-parent"
};
const sizeStyles = {
default: "hawa-px-2 hawa-py-3 ",
sm: "hawa-text-xs hawa-px-1.5 hawa-py-1.5 "
};
let [values, setValues] = React7.useState(
items.map((item) => item.currentOption)
);
return /* @__PURE__ */ React7.createElement(
DropdownMenuRoot,
{
onOpenChange,
open,
modal: false,
dir: direction
},
/* @__PURE__ */ React7.createElement(
DropdownMenuTrigger,
{
asChild: true,
className: cn(classNames == null ? void 0 : classNames.trigger, triggerClassname),
...triggerProps
},
trigger
),
/* @__PURE__ */ React7.createElement(Portal, null, /* @__PURE__ */ React7.createElement(
DropdownMenuContent,
{
side,
sideOffset,
align,
alignOffset,
className: cn(
className,
classNames == null ? void 0 : classNames.content,
widthStyles[width],
"hawa-flex hawa-flex-col hawa-gap-1 hawa-overflow-y-auto"
),
style: {
maxHeight: "var(--radix-dropdown-menu-content-available-height)"
},
...contentProps
},
header && header,
items && items.map((item, index) => {
var _a;
const ItemLinkComponent = item.slug ? LinkComponent : "a";
if (item.itemType === "separator") {
return /* @__PURE__ */ React7.createElement(
DropdownMenuSeparator,
{
key: index,
className: classNames == null ? void 0 : classNames.separator
}
);
} else if (item.itemType === "label") {
return /* @__PURE__ */ React7.createElement(DropdownMenuLabel, { key: index }, item.label);
} else if (item.itemType === "radio") {
let dd = item.currentOption;
return /* @__PURE__ */ React7.createElement(DropdownMenuSub, { key: index }, /* @__PURE__ */ React7.createElement(
DropdownMenuSubTrigger,
{
dir: direction,
className: cn(sizeStyles[size])
},
item.icon && item.icon,
item.label && item.label
), /* @__PURE__ */ React7.createElement(DropdownMenuSubContent, null, /* @__PURE__ */ React7.createElement(
DropdownMenuRadioGroup,
{
value: values[index],
onValueChange: (e) => {
let newValues = [...values];
newValues[index] = e;
setValues(newValues);
console.log("changing to ", e);
if (item.onOptionChange) {
item.onOptionChange(e);
}
}
},
(_a = item.options) == null ? void 0 : _a.map((opt, i) => /* @__PURE__ */ React7.createElement(DropdownMenuRadioItem, { key: i, value: opt.value }, opt.label))
)));
} else if (item.itemType === "custom") {
return /* @__PURE__ */ React7.createElement("div", { key: index }, item.content);
} else {
return item.subitems ? /* @__PURE__ */ React7.createElement(DropdownMenuSub, { key: index }, /* @__PURE__ */ React7.createElement(
DropdownMenuSubTrigger,
{
dir: direction,
className: cn(sizeStyles[size])
},
item.icon && item.icon,
item.label && item.label
), /* @__PURE__ */ React7.createElement(Portal, null, /* @__PURE__ */ React7.createElement(DropdownMenuSubContent, null, item.subitems.map((subitem, subIndex) => {
const SubitemLinkComponent = subitem.slug ? LinkComponent : "a";
return /* @__PURE__ */ React7.createElement(
DropdownMenuItem,
{
key: subIndex,
LinkComponent: SubitemLinkComponent,
slug: subitem.slug,
disabled: subitem.disabled,
className: cn(
sizeStyles[size],
!item.icon && !item.label ? "hawa-px-0 hawa-py-0 focus:hawa-bg-transparent" : "focus:hawa-bg-accent"
),
onMouseDown: (event) => {
if (event.button === 1 || event.button === 0 && event.ctrlKey) {
event.preventDefault();
if (subitem.onMiddleClick) {
subitem.onMiddleClick(item.value);
}
}
},
onSelect: () => {
subitem.action && subitem.action();
if (onItemSelect) {
onItemSelect(subitem.value);
}
}
},
subitem.icon && subitem.icon,
subitem.label && subitem.label
);
})))) : /* @__PURE__ */ React7.createElement(
DropdownMenuItem,
{
LinkComponent: ItemLinkComponent,
slug: item.slug,
key: index,
disabled: item.disabled,
onMouseDown: (event) => {
if (event.button === 1 || event.button === 0 && event.ctrlKey) {
event.preventDefault();
if (item.onMiddleClick) {
item.onMiddleClick(item.value);
}
}
},
onClick: (event) => {
if (item.onClick) {
item.onClick(item.value);
}
},
onSelect: (e) => {
if (item.presist) {
e.preventDefault();
}
if (item.action) {
item.action();
if (onItemSelect) {
onItemSelect(item.value);
}
} else {
if (onItemSelect) {
onItemSelect(item.value);
}
}
},
end: item.end,
shortcut: item.shortcut,
badged: item.badged,
className: cn(
sizeStyles[size],
!item.icon && !item.label ? "hawa-px-0 hawa-py-0 focus:hawa-bg-transparent" : "focus:hawa-bg-accent",
item.presist && "focus:hawa-bg-transparent",
classNames == null ? void 0 : classNames.item
)
},
item.icon && item.icon,
item.label && item.label
);
}
})
))
);
};
// elements/input/Input.tsx
import React9, { forwardRef as forwardRef5 } from "react";
// elements/skeleton/Skeleton.tsx
import React8 from "react";
function Skeleton({
className,
content,
animation = "pulse",
fade,
...props
}) {
const animationStyles = {
none: "hawa-rounded hawa-bg-muted",
pulse: "hawa-animate-pulse hawa-rounded hawa-bg-muted",
shimmer: "hawa-space-y-5 hawa-rounded hawa-bg-muted hawa-p-4 hawa-relative before:hawa-absolute before:hawa-inset-0 before:hawa--translate-x-full before:hawa-animate-[shimmer_2s_infinite] before:hawa-bg-gradient-to-r before:hawa-from-transparent before:hawa-via-gray-300/40 dark:before:hawa-via-white/10 before:hawa-to-transparent hawa-isolate hawa-overflow-hidden before:hawa-border-t before:hawa-border-rose-100/10"
};
const fadeStyle = {
bottom: "hawa-mask-fade-bottom",
top: "hawa-mask-fade-top",
right: "hawa-mask-fade-right",
left: "hawa-mask-fade-left "
};
return /* @__PURE__ */ React8.createElement(
"div",
{
className: cn(
animationStyles[animation],
content && "hawa-flex hawa-flex-col hawa-items-center hawa-justify-center",
fade && fadeStyle[fade],
className
),
...props
},
content && content
);
}
// elements/input/Input.tsx
var Input = forwardRef5(
({
margin = "none",
width = "full",
preview = false,
forceHideHelperText = false,
labelProps,
placeholder,
showCount,
inputProps,
countPosition = "bottom",
...props
}, ref) => {
var _a;
let marginStyles = {
none: "hawa-mb-0",
normal: "hawa-mb-3",
large: "hawa-mb-5"
};
let widthStyles = {
small: "hawa-w-full hawa-max-w-2xs",
normal: "hawa-w-1/2",
full: "hawa-w-full",
auto: ""
};
let defaultStyle = "hawa-flex hawa-max-h-fit hawa-h-fit hawa-relative hawa-flex-col hawa-justify-center hawa-gap-0";
let defaultInputStyle = "hawa-block hawa-w-full hawa-rounded hawa-border hawa-transition-all hawa-bg-background hawa-p-3 hawa-text-sm placeholder:hawa-text-muted-foreground";
const handleChange = (e) => {
let newValue = e.target.value;
if (props.prefixText) {
if (newValue.length < props.prefixText.length) {
newValue = props.prefixText;
} else {
const isSubstring = props.prefixText.startsWith(newValue);
if (!isSubstring && !newValue.startsWith(props.prefixText)) {
newValue = `${props.prefixText}${newValue}`;
}
}
}
if (props.onChange) {
const newEvent = { ...e, target: { ...e.target, value: newValue } };
props.onChange(newEvent);
}
};
return /* @__PURE__ */ React9.createElement(
"div",
{
className: cn(
defaultStyle,
marginStyles[margin],
widthStyles[width],
props.containerClassName,
"hawa-w-full hawa-gap-2"
)
},
props.label && /* @__PURE__ */ React9.createElement(Label, { ...labelProps }, props.label),
/* @__PURE__ */ React9.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ React9.createElement(
"span",
{
className: cn(
"hawa-me-2 hawa-opacity-90",
!forceHideHelperText && "hawa-mb-2"
)
},
props.outsidePrefix
), props.isLoading ? /* @__PURE__ */ React9.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React9.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" })) : props.isLoadingError ? /* @__PURE__ */ React9.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React9.createElement(
Skeleton,
{
animation: "none",
className: "hawa-h-[40px] hawa-w-full !hawa-bg-destructive/[0.3]",
content: /* @__PURE__ */ React9.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-2" }, /* @__PURE__ */ React9.createElement(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
width: "20",
height: "20",
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round",
className: "hawa-text-destructive"
},
/* @__PURE__ */ React9.createElement("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }),
/* @__PURE__ */ React9.createElement("path", { d: "M12 9v4" }),
/* @__PURE__ */ React9.createElement("path", { d: "M12 17h.01" })
), /* @__PURE__ */ React9.createElement("span", null, /* @__PURE__ */ React9.createElement("span", { className: "hawa-text-destructive" }, props.loadingErrorMesssage || "Error loading data")))
}
)) : /* @__PURE__ */ React9.createElement(React9.Fragment, null, !props.hideSeparator && /* @__PURE__ */ React9.createElement(
"div",
{
className: cn(
"hawa-absolute hawa-top-[22px] hawa-h-[0.8px] hawa-w-full hawa-bg-gray-200 hawa-transition-all dark:hawa-bg-gray-800",
preview ? "hawa-opacity-100" : "hawa-opacity-0"
)
}
), /* @__PURE__ */ React9.createElement("div", { className: "hawa-flex hawa-flex-col hawa-w-full hawa-gap-2" }, /* @__PURE__ */ React9.createElement("div", { className: "hawa-relative" }, props.startIcon && /* @__PURE__ */ React9.createElement("div", { className: "hawa-absolute hawa-start-3 hawa-top-1/2 hawa--translate-y-1/2" }, props.startIcon), props.endIcon && /* @__PURE__ */ React9.createElement(
"div",
{
className: cn(
"hawa-absolute hawa-end-3 hawa-top-1/2 hawa--translate-y-1/2",
(_a = props.endIconProps) == null ? void 0 : _a.className
)
},
props.endIcon
), /* @__PURE__ */ React9.createElement(
"input",
{
required: true,
dir: props.dir,
type: props.type,
value: props.value,
onChange: handleChange,
autoComplete: props.autoComplete,
defaultValue: props.defaultValue,
placeholder,
disabled: props.disabled || preview,
style: { height: 40 },
...inputProps,
className: cn(
defaultInputStyle,
"focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-0 dark:hawa-text-white",
{
"hawa-pe-9": props.endIcon,
"hawa-ps-9": props.startIcon,
"hawa-pe-[60px]": countPosition === "center"
},
preview && "hawa-border-transparent hawa-bg-transparent hawa-px-0",
inputProps == null ? void 0 : inputProps.className
)
}
)), !forceHideHelperText && /* @__PURE__ */ React9.createElement(HelperText, { helperText: props.helperText }), !props.disabled && forceHideHelperText && /* @__PURE__ */ React9.createElement(
"div",
{
className: cn(
"hawa-absolute hawa-end-0 hawa-top-[47px] hawa-z-20 hawa-translate-y-1/2 hawa-rounded hawa-bg-background hawa-text-start hawa-text-xs hawa-text-helper-color hawa-drop-shadow-md hawa-transition-all",
props.helperText ? "hawa-border hawa-p-1" : "hawa-border-none hawa-p-0"
)
},
props.helperText
), showCount && /* @__PURE__ */ React9.createElement(
"div",
{
className: cn(
"hawa-absolute hawa-translate-y-1/2 hawa-text-start hawa-text-xs hawa-transition-all",
{
"hawa-end-0 hawa-top-[62px]": countPosition === "bottom",
"hawa-bottom-[62px] hawa-end-0": countPosition === "top",
"hawa-end-2": countPosition === "center"
}
)
},
props.value ? String(props.value).length : 0,
"/",
props.maxLength
))))
);
}
);
// elements/table/Table.tsx
import * as React10 from "react";
var Table = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement("div", { className: "hawa-relative hawa-w-full hawa-overflow-auto hawa-rounded hawa-border" }, /* @__PURE__ */ React10.createElement(
"table",
{
ref,
className: cn("hawa-w-full hawa-caption-bottom hawa-text-sm", className),
...props
}
)));
var TableHeader = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
"thead",
{
ref,
className: cn("[&_tr]:hawa-border-b", "hawa-bg-muted/50", className),
...props
}
));
var TableHead = React10.forwardRef(
({ className, condensed, clickable, dir, ...props }, ref) => /* @__PURE__ */ React10.createElement(
"th",
{
ref,
className: cn(
"hawa-bg-muted/60 hawa-text-nowrap hawa-text-start hawa-align-middle hawa-font-medium hawa-text-muted-foreground dark:hawa-bg-muted/40 [&:has([role=checkbox])]:hawa-pr-0 [&:not(:last-child)&:not(:first-child)]:hawa-border-x",
dir === "rtl" ? "[&:not(:last-child)]:hawa-border-l" : "[&:not(:last-child)]:hawa-border-r",
condensed ? "hawa-h-8" : "hawa-h-12",
clickable ? "hawa-px-1" : "hawa-px-4",
//First and last columns
clickable ? "[&:not(:last-child)&:not(:first-child)]:hawa-p-1" : "hawa-px-4",
//Columns in between
className
),
...props
}
)
);
var TableBody = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement("tbody", { ref, className: cn("hawa-border-none", className), ...props }));
var TableFooter = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
"tfoot",
{
ref,
className: cn(
"hawa-bg-primary hawa-font-medium hawa-text-primary-foreground",
className
),
...props
}
));
var TableRow = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
"tr",
{
ref,
className: cn(
"hawa-bg-background hawa-transition-colors data-[state=selected]:hawa-bg-muted",
"[&:not(:last-child)&:not(:first-child)]:hawa-border-y",
"[&:not(:last-child)]:hawa-border-b",
className
),
...props
}
));
var TableCell = React10.forwardRef(
({ className, enablePadding = true, padding = "default", ...props }, ref) => {
let paddingStyles = {
condensed: "hawa-p-0 hawa-px-4",
default: "hawa-p-4",
noPadding: "hawa-p-0"
};
return /* @__PURE__ */ React10.createElement(
"td",
{
ref,
className: cn(
paddingStyles[padding],
// "border-x",
// enablePadding ? "hawa-p-4" : "hawa-p-0",
// props.disablePadding ? "hawa-p-0" : "hawa-p-4",
// props.condensed ? "hawa-p-0 hawa-px-4" : "hawa-p-4",
"hawa-align-middle [&:has([role=checkbox])]:hawa-pr-0",
"[&:not(:last-child)&:not(:first-child)]:hawa-border-x",
// "[&:not(:last-child)]:hawa-border-r",
props.dir === "rtl" ? "[&:not(:last-child)]:hawa-border-l" : "[&:not(:last-child)]:hawa-border-r",
className
),
...props
}
);
}
);
var TableCaption = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
"caption",
{
ref,
className: cn(
"hawa-mt-4 hawa-text-sm hawa-text-muted-foreground",
className
),
...props
}
));
Table.displayName = "Table";
TableRow.displayName = "TableRow";
TableBody.displayName = "TableBody";
TableHead.displayName = "TableHead";
TableCell.displayName = "TableCell";
TableFooter.displayName = "TableFooter";
TableHeader.displayName = "TableHeader";
TableCaption.displayName = "TableCaption";
// elements/dataTable/DataTable.tsx
var LOCAL_STORAGE_KEY = "@sikka/hawa/data-table-columns";
var DataTable = ({
columns,
data,
paginationPosition = "bottom",
translateFn,
resetSelection,
enableHideColumns,
enableSelection,
enableFiltering,
enableSearch,
enableGoTo,
...props
}) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
const [sorting, setSorting] = React11.useState(
props.defaultSort ? [{ id: props.defaultSort, desc: false }] : []
);
const [columnFilters, setColumnFilters] = React11.useState(
[]
);
const [globalFilter, setGlobalFilter] = React11.useState("");
const [expanded, setExpanded] = React11.useState({});
const [columnVisibility, setColumnVisibility] = React11.useState(() => {
const savedVisibility = localStorage.getItem(LOCAL_STORAGE_KEY);
return savedVisibility ? JSON.parse(savedVisibility) : {};
});
const [rowSelection, setRowSelection] = React11.useState({});
const [selectedFilters, setSelectedFilters] = React11.useState([]);
let mainColumns = enableSelection ? [
{
id: "select",
maxSize: 16,
minSize: 16,
size: 16,
header: ({ table: table2 }) => /* @__PURE__ */ React11.createElement(
Checkbox,
{
dir: props.direction,
id: "select_all",
"aria-label": "Select all",
className: props.direction === "rtl" ? "hawa-ms-4" : "hawa-me-0",
checked: table2.getIsAllPageRowsSelected() || table2.getIsSomePageRowsSelected() && "indeterminate",
onCheckedChange: (value) => table2.toggleAllPageRowsSelected(!!value)
}
),
cell: ({ row }) => /* @__PURE__ */ React11.createElement(
Checkbox,
{
dir: props.direction,
id: "select_row",
className: props.direction === "rtl" ? "hawa-ms-4" : "hawa-me-4",
checked: row.getIsSelected(),
onCheckedChange: (value) => row.toggleSelected(!!value),
"aria-label": "Select row"
}
),
enableSorting: false,
enableHiding: false
},
...columns
] : columns;
const table = useReactTable({
data,
columns: mainColumns,
onExpandedChange: setExpanded,
getExpandedRowModel: getExpandedRowModel(),
onGlobalFilterChange: setGlobalFilter,
onSortingChange: setSorting,
onColumnFiltersChange: setColumnFilters,
getCoreRowModel: getCoreRowModel(),
getPaginationRowModel: getPaginationRowModel(),
getSortedRowModel: getSortedRowModel(),
getFilteredRowModel: getFilteredRowModel(),
onColumnVisibilityChange: setColumnVisibility,
onRowSelectionChange: setRowSelection,
state: {
sortin