@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.cjs CHANGED
@@ -1101,6 +1101,78 @@ var PageHeader = React17__namespace.forwardRef(
1101
1101
  ] }) })
1102
1102
  );
1103
1103
  PageHeader.displayName = "PageHeader";
1104
+ var EmptyState = React17__namespace.forwardRef(
1105
+ ({ className, icon, title, description, action, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
1106
+ "div",
1107
+ {
1108
+ ref,
1109
+ className: cn(
1110
+ "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]",
1111
+ className
1112
+ ),
1113
+ ...props,
1114
+ children: [
1115
+ icon && /* @__PURE__ */ jsxRuntime.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 }),
1116
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-base font-bold text-foreground mb-1", children: title }),
1117
+ description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground max-w-sm mb-6 leading-relaxed", children: description }),
1118
+ action && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-3", children: action })
1119
+ ]
1120
+ }
1121
+ )
1122
+ );
1123
+ EmptyState.displayName = "EmptyState";
1124
+ var MetricCard = React17__namespace.forwardRef(
1125
+ ({ className, title, value, trend, trendDirection = "neutral", description, icon, ...props }, ref) => {
1126
+ const trendColor = {
1127
+ up: "text-success bg-success-surface border-success/20",
1128
+ down: "text-danger bg-danger-surface border-danger/20",
1129
+ neutral: "text-muted-foreground bg-muted border-border/20"
1130
+ }[trendDirection];
1131
+ return /* @__PURE__ */ jsxRuntime.jsxs(Card, { ref, className: cn("p-6", className), ...props, children: [
1132
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-3", children: [
1133
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-mono font-semibold uppercase tracking-[0.1em] text-muted-foreground", children: title }),
1134
+ icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground shrink-0 [&_svg]:h-4 [&_svg]:w-4", children: icon })
1135
+ ] }),
1136
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline gap-2.5 mb-1.5", children: [
1137
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-3xl font-bold tracking-tight text-foreground", children: value }),
1138
+ trend && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-[0.75rem] font-bold px-2 py-0.5 rounded-full border", trendColor), children: trend })
1139
+ ] }),
1140
+ description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: description })
1141
+ ] });
1142
+ }
1143
+ );
1144
+ MetricCard.displayName = "MetricCard";
1145
+ function DataTable({
1146
+ className,
1147
+ columns,
1148
+ data,
1149
+ loading = false,
1150
+ error,
1151
+ emptyTitle = "No data available",
1152
+ emptyDescription = "There are no records to display at this time.",
1153
+ emptyAction,
1154
+ ...props
1155
+ }) {
1156
+ return /* @__PURE__ */ jsxRuntime.jsxs(TableWrap, { className: cn("relative overflow-hidden", className), ...props, children: [
1157
+ /* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
1158
+ /* @__PURE__ */ jsxRuntime.jsx(TableHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: columns.map((col, idx) => /* @__PURE__ */ jsxRuntime.jsx(TableHead, { className: col.className, children: col.header }, idx)) }) }),
1159
+ /* @__PURE__ */ jsxRuntime.jsx(TableBody, { children: loading && data.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(TableCell, { colSpan: columns.length, className: "h-64 text-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center gap-3", children: [
1160
+ /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 32 }),
1161
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: "Loading dataset..." })
1162
+ ] }) }) }) : error ? /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(TableCell, { colSpan: columns.length, className: "p-8", children: /* @__PURE__ */ jsxRuntime.jsx(Alert, { variant: "danger", title: "Error loading data", children: error }) }) }) : data.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(TableCell, { colSpan: columns.length, className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
1163
+ EmptyState,
1164
+ {
1165
+ title: emptyTitle,
1166
+ description: emptyDescription,
1167
+ action: emptyAction,
1168
+ className: "border-none bg-transparent rounded-none py-16"
1169
+ }
1170
+ ) }) }) : data.map((row, rowIdx) => /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: columns.map((col, colIdx) => /* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: col.className, children: col.accessor(row) }, colIdx)) }, rowIdx)) })
1171
+ ] }),
1172
+ loading && data.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 bg-background/50 backdrop-blur-[1px] grid place-items-center z-10 transition-opacity duration-150", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 36 }) })
1173
+ ] });
1174
+ }
1175
+ DataTable.displayName = "DataTable";
1104
1176
 
1105
1177
  exports.Accordion = Accordion;
1106
1178
  exports.AccordionContent = AccordionContent;
@@ -1121,15 +1193,18 @@ exports.CardFooter = CardFooter;
1121
1193
  exports.CardHeader = CardHeader;
1122
1194
  exports.CardTitle = CardTitle;
1123
1195
  exports.Checkbox = Checkbox;
1196
+ exports.DataTable = DataTable;
1124
1197
  exports.DropdownMenu = DropdownMenu;
1125
1198
  exports.DropdownMenuContent = DropdownMenuContent;
1126
1199
  exports.DropdownMenuItem = DropdownMenuItem;
1127
1200
  exports.DropdownMenuSeparator = DropdownMenuSeparator;
1128
1201
  exports.DropdownMenuTrigger = DropdownMenuTrigger;
1202
+ exports.EmptyState = EmptyState;
1129
1203
  exports.Field = Field;
1130
1204
  exports.Hint = Hint;
1131
1205
  exports.Input = Input;
1132
1206
  exports.Label = Label;
1207
+ exports.MetricCard = MetricCard;
1133
1208
  exports.Modal = Modal;
1134
1209
  exports.ModalActions = ModalActions;
1135
1210
  exports.ModalDescription = ModalDescription;