@kjaniec-dev/ui 0.4.1 → 0.5.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.d.ts CHANGED
@@ -292,4 +292,41 @@ interface PageHeaderProps {
292
292
  }
293
293
  declare const PageHeader: React.ForwardRefExoticComponent<PageHeaderProps & React.RefAttributes<HTMLElement>>;
294
294
 
295
- export { Accordion, AccordionContent, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, Alert, type AlertProps, Avatar, AvatarGroup, type AvatarProps, Badge, type BadgeProps, Breadcrumb, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbSeparator, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Checkbox, type CheckboxProps, DropdownMenu, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuSeparator, DropdownMenuTrigger, Field, Hint, type HintProps, Input, type InputProps, Label, type LabelProps, Modal, ModalActions, ModalDescription, type ModalProps, ModalTitle, PageHeader, type PageHeaderProps, Pagination, type PaginationProps, Progress, type ProgressProps, Radio, type RadioProps, Segmented, type SegmentedOption, type SegmentedProps, Select, type SelectProps, Slider, type SliderProps, Spinner, type SpinnerProps, Stat, type StatProps, Switch, type SwitchProps, Table, TableBody, TableCell, type TableCellProps, TableHead, TableHeader, TableRow, TableWrap, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsProps, TabsTrigger, type TabsTriggerProps, Textarea, type TextareaProps, type ToastOptions, ToastProvider, type ToastTone, Tooltip, type TooltipProps, badgeVariants, buttonVariants, cn, sliderThumbCSS, useToast };
295
+ interface EmptyStateProps extends React.HTMLAttributes<HTMLDivElement> {
296
+ icon?: React.ReactNode;
297
+ title: string;
298
+ description?: string;
299
+ action?: React.ReactNode;
300
+ }
301
+ declare const EmptyState: React.ForwardRefExoticComponent<EmptyStateProps & React.RefAttributes<HTMLDivElement>>;
302
+
303
+ interface MetricCardProps extends React.HTMLAttributes<HTMLDivElement> {
304
+ title: string;
305
+ value: string | number;
306
+ trend?: string;
307
+ trendDirection?: "up" | "down" | "neutral";
308
+ description?: string;
309
+ icon?: React.ReactNode;
310
+ }
311
+ declare const MetricCard: React.ForwardRefExoticComponent<MetricCardProps & React.RefAttributes<HTMLDivElement>>;
312
+
313
+ interface DataTableColumn<T> {
314
+ header: React.ReactNode;
315
+ accessor: (row: T) => React.ReactNode;
316
+ className?: string;
317
+ }
318
+ interface DataTableProps<T> extends React.HTMLAttributes<HTMLDivElement> {
319
+ columns: DataTableColumn<T>[];
320
+ data: T[];
321
+ loading?: boolean;
322
+ error?: string;
323
+ emptyTitle?: string;
324
+ emptyDescription?: string;
325
+ emptyAction?: React.ReactNode;
326
+ }
327
+ declare function DataTable<T>({ className, columns, data, loading, error, emptyTitle, emptyDescription, emptyAction, ...props }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
328
+ declare namespace DataTable {
329
+ var displayName: string;
330
+ }
331
+
332
+ export { Accordion, AccordionContent, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, Alert, type AlertProps, Avatar, AvatarGroup, type AvatarProps, Badge, type BadgeProps, Breadcrumb, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbSeparator, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Checkbox, type CheckboxProps, DataTable, type DataTableColumn, type DataTableProps, DropdownMenu, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuSeparator, DropdownMenuTrigger, EmptyState, type EmptyStateProps, Field, Hint, type HintProps, Input, type InputProps, Label, type LabelProps, MetricCard, type MetricCardProps, Modal, ModalActions, ModalDescription, type ModalProps, ModalTitle, PageHeader, type PageHeaderProps, Pagination, type PaginationProps, Progress, type ProgressProps, Radio, type RadioProps, Segmented, type SegmentedOption, type SegmentedProps, Select, type SelectProps, Slider, type SliderProps, Spinner, type SpinnerProps, Stat, type StatProps, Switch, type SwitchProps, Table, TableBody, TableCell, type TableCellProps, TableHead, TableHeader, TableRow, TableWrap, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsProps, TabsTrigger, type TabsTriggerProps, Textarea, type TextareaProps, type ToastOptions, ToastProvider, type ToastTone, Tooltip, type TooltipProps, badgeVariants, buttonVariants, cn, sliderThumbCSS, useToast };
package/dist/index.js CHANGED
@@ -1079,7 +1079,79 @@ var PageHeader = React17.forwardRef(
1079
1079
  ] }) })
1080
1080
  );
1081
1081
  PageHeader.displayName = "PageHeader";
1082
+ var EmptyState = React17.forwardRef(
1083
+ ({ className, icon, title, description, action, ...props }, ref) => /* @__PURE__ */ jsxs(
1084
+ "div",
1085
+ {
1086
+ ref,
1087
+ className: cn(
1088
+ "flex flex-col items-center justify-center text-center p-8 border border-dashed border-border rounded-kj-lg bg-muted/20 min-h-[300px]",
1089
+ className
1090
+ ),
1091
+ ...props,
1092
+ children: [
1093
+ icon && /* @__PURE__ */ jsx("div", { className: "flex h-12 w-12 items-center justify-center rounded-full bg-muted text-muted-foreground mb-4 [&_svg]:h-6 [&_svg]:w-6", children: icon }),
1094
+ /* @__PURE__ */ jsx("h3", { className: "text-base font-bold text-foreground mb-1", children: title }),
1095
+ description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground max-w-sm mb-6 leading-relaxed", children: description }),
1096
+ action && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-3", children: action })
1097
+ ]
1098
+ }
1099
+ )
1100
+ );
1101
+ EmptyState.displayName = "EmptyState";
1102
+ var MetricCard = React17.forwardRef(
1103
+ ({ className, title, value, trend, trendDirection = "neutral", description, icon, ...props }, ref) => {
1104
+ const trendColor = {
1105
+ up: "text-success bg-success-surface border-success/20",
1106
+ down: "text-danger bg-danger-surface border-danger/20",
1107
+ neutral: "text-muted-foreground bg-muted border-border/20"
1108
+ }[trendDirection];
1109
+ return /* @__PURE__ */ jsxs(Card, { ref, className: cn("p-6", className), ...props, children: [
1110
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-3", children: [
1111
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-mono font-semibold uppercase tracking-[0.1em] text-muted-foreground", children: title }),
1112
+ icon && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground shrink-0 [&_svg]:h-4 [&_svg]:w-4", children: icon })
1113
+ ] }),
1114
+ /* @__PURE__ */ jsxs("div", { className: "flex items-baseline gap-2.5 mb-1.5", children: [
1115
+ /* @__PURE__ */ jsx("span", { className: "text-3xl font-bold tracking-tight text-foreground", children: value }),
1116
+ trend && /* @__PURE__ */ jsx("span", { className: cn("text-[0.75rem] font-bold px-2 py-0.5 rounded-full border", trendColor), children: trend })
1117
+ ] }),
1118
+ description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: description })
1119
+ ] });
1120
+ }
1121
+ );
1122
+ MetricCard.displayName = "MetricCard";
1123
+ function DataTable({
1124
+ className,
1125
+ columns,
1126
+ data,
1127
+ loading = false,
1128
+ error,
1129
+ emptyTitle = "No data available",
1130
+ emptyDescription = "There are no records to display at this time.",
1131
+ emptyAction,
1132
+ ...props
1133
+ }) {
1134
+ return /* @__PURE__ */ jsxs(TableWrap, { className: cn("relative overflow-hidden", className), ...props, children: [
1135
+ /* @__PURE__ */ jsxs(Table, { children: [
1136
+ /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsx(TableRow, { children: columns.map((col, idx) => /* @__PURE__ */ jsx(TableHead, { className: col.className, children: col.header }, idx)) }) }),
1137
+ /* @__PURE__ */ jsx(TableBody, { children: loading && data.length === 0 ? /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: columns.length, className: "h-64 text-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center gap-3", children: [
1138
+ /* @__PURE__ */ jsx(Spinner, { size: 32 }),
1139
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: "Loading dataset..." })
1140
+ ] }) }) }) : error ? /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: columns.length, className: "p-8", children: /* @__PURE__ */ jsx(Alert, { variant: "danger", title: "Error loading data", children: error }) }) }) : data.length === 0 ? /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: columns.length, className: "p-0", children: /* @__PURE__ */ jsx(
1141
+ EmptyState,
1142
+ {
1143
+ title: emptyTitle,
1144
+ description: emptyDescription,
1145
+ action: emptyAction,
1146
+ className: "border-none bg-transparent rounded-none py-16"
1147
+ }
1148
+ ) }) }) : data.map((row, rowIdx) => /* @__PURE__ */ jsx(TableRow, { children: columns.map((col, colIdx) => /* @__PURE__ */ jsx(TableCell, { className: col.className, children: col.accessor(row) }, colIdx)) }, rowIdx)) })
1149
+ ] }),
1150
+ loading && data.length > 0 && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-background/50 backdrop-blur-[1px] grid place-items-center z-10 transition-opacity duration-150", children: /* @__PURE__ */ jsx(Spinner, { size: 36 }) })
1151
+ ] });
1152
+ }
1153
+ DataTable.displayName = "DataTable";
1082
1154
 
1083
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, Avatar, AvatarGroup, Badge, Breadcrumb, BreadcrumbItem, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, Field, Hint, Input, Label, Modal, ModalActions, ModalDescription, ModalTitle, PageHeader, Pagination, Progress, Radio, Segmented, Select, Slider, Spinner, Stat, Switch, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, TableWrap, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ToastProvider, Tooltip, badgeVariants, buttonVariants, cn, sliderThumbCSS, useToast };
1155
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, Avatar, AvatarGroup, Badge, Breadcrumb, BreadcrumbItem, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DataTable, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, EmptyState, Field, Hint, Input, Label, MetricCard, Modal, ModalActions, ModalDescription, ModalTitle, PageHeader, Pagination, Progress, Radio, Segmented, Select, Slider, Spinner, Stat, Switch, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, TableWrap, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ToastProvider, Tooltip, badgeVariants, buttonVariants, cn, sliderThumbCSS, useToast };
1084
1156
  //# sourceMappingURL=index.js.map
1085
1157
  //# sourceMappingURL=index.js.map