@kjaniec-dev/ui 0.4.1 → 0.6.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 +168 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +69 -1
- package/dist/index.d.ts +69 -1
- package/dist/index.js +162 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -654,7 +654,7 @@ var AccordionContent = React17__namespace.forwardRef(
|
|
|
654
654
|
ref,
|
|
655
655
|
className: cn("grid transition-[grid-template-rows] duration-200 ease-out", isOpen ? "[grid-template-rows:1fr]" : "[grid-template-rows:0fr]"),
|
|
656
656
|
...props,
|
|
657
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-[1.2rem] pb-
|
|
657
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-[1.2rem] pt-3 pb-4 text-[0.85rem] text-muted-foreground", className), children }) })
|
|
658
658
|
}
|
|
659
659
|
);
|
|
660
660
|
}
|
|
@@ -1101,6 +1101,166 @@ 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";
|
|
1176
|
+
var FormField = React17__namespace.forwardRef(
|
|
1177
|
+
({ className, label, hint, error, required, children, ...props }, ref) => {
|
|
1178
|
+
const id = React17__namespace.useId();
|
|
1179
|
+
const hintId = `${id}-hint`;
|
|
1180
|
+
const errorId = `${id}-error`;
|
|
1181
|
+
const child = React17__namespace.Children.only(children);
|
|
1182
|
+
const clonedChild = React17__namespace.cloneElement(child, {
|
|
1183
|
+
id: child.props.id ?? id,
|
|
1184
|
+
"aria-describedby": cn(
|
|
1185
|
+
hint && hintId,
|
|
1186
|
+
error && errorId,
|
|
1187
|
+
child.props["aria-describedby"]
|
|
1188
|
+
) || void 0,
|
|
1189
|
+
"aria-invalid": error ? "true" : void 0,
|
|
1190
|
+
required: child.props.required ?? required
|
|
1191
|
+
});
|
|
1192
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: cn("flex flex-col gap-1.5 w-full", className), ...props, children: [
|
|
1193
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: id, required, children: label }),
|
|
1194
|
+
clonedChild,
|
|
1195
|
+
hint && !error && /* @__PURE__ */ jsxRuntime.jsx(Hint, { id: hintId, children: hint }),
|
|
1196
|
+
error && /* @__PURE__ */ jsxRuntime.jsx(Hint, { id: errorId, error: true, children: error })
|
|
1197
|
+
] });
|
|
1198
|
+
}
|
|
1199
|
+
);
|
|
1200
|
+
FormField.displayName = "FormField";
|
|
1201
|
+
var ErrorState = React17__namespace.forwardRef(
|
|
1202
|
+
({ className, title = "Wyst\u0105pi\u0142 b\u0142\u0105d", message, onRetry, retryLabel = "Spr\xF3buj ponownie", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1203
|
+
"div",
|
|
1204
|
+
{
|
|
1205
|
+
ref,
|
|
1206
|
+
className: cn(
|
|
1207
|
+
"flex flex-col items-center justify-center text-center p-8 border border-danger/25 rounded-kj-lg bg-danger-surface/20 min-h-[300px]",
|
|
1208
|
+
className
|
|
1209
|
+
),
|
|
1210
|
+
...props,
|
|
1211
|
+
children: [
|
|
1212
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-12 w-12 items-center justify-center rounded-full bg-danger-surface border border-danger/30 text-danger mb-4", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { fill: "none", stroke: "currentColor", strokeWidth: 2.5, viewBox: "0 0 24 24", className: "h-6 w-6", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z" }) }) }),
|
|
1213
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-base font-bold text-foreground mb-1", children: title }),
|
|
1214
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground max-w-sm mb-6 leading-relaxed", children: message }),
|
|
1215
|
+
onRetry && /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "sm", variant: "danger", onClick: onRetry, children: retryLabel })
|
|
1216
|
+
]
|
|
1217
|
+
}
|
|
1218
|
+
)
|
|
1219
|
+
);
|
|
1220
|
+
ErrorState.displayName = "ErrorState";
|
|
1221
|
+
var Skeleton = React17__namespace.forwardRef(
|
|
1222
|
+
({ className, variant = "rectangular", width, height, style, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1223
|
+
"div",
|
|
1224
|
+
{
|
|
1225
|
+
ref,
|
|
1226
|
+
className: cn(
|
|
1227
|
+
"animate-pulse bg-muted/40",
|
|
1228
|
+
variant === "text" && "h-3 w-4/5 rounded-sm my-1.5",
|
|
1229
|
+
variant === "circular" && "rounded-full",
|
|
1230
|
+
variant === "rectangular" && "rounded-kj-md",
|
|
1231
|
+
className
|
|
1232
|
+
),
|
|
1233
|
+
style: {
|
|
1234
|
+
width,
|
|
1235
|
+
height,
|
|
1236
|
+
...style
|
|
1237
|
+
},
|
|
1238
|
+
...props
|
|
1239
|
+
}
|
|
1240
|
+
)
|
|
1241
|
+
);
|
|
1242
|
+
Skeleton.displayName = "Skeleton";
|
|
1243
|
+
var DashboardShell = React17__namespace.forwardRef(
|
|
1244
|
+
({ className, sidebar, topbar, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1245
|
+
"div",
|
|
1246
|
+
{
|
|
1247
|
+
ref,
|
|
1248
|
+
className: cn(
|
|
1249
|
+
"min-h-screen bg-canvas text-foreground flex flex-col md:flex-row",
|
|
1250
|
+
className
|
|
1251
|
+
),
|
|
1252
|
+
...props,
|
|
1253
|
+
children: [
|
|
1254
|
+
sidebar && /* @__PURE__ */ jsxRuntime.jsx("aside", { className: "w-full md:w-64 border-r border-border bg-surface shrink-0 z-20", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sticky top-0 h-auto md:h-screen flex flex-col", children: sidebar }) }),
|
|
1255
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
1256
|
+
topbar && /* @__PURE__ */ jsxRuntime.jsx("header", { className: "sticky top-0 h-14 border-b border-border bg-surface flex items-center px-6 z-10 shrink-0", children: topbar }),
|
|
1257
|
+
/* @__PURE__ */ jsxRuntime.jsx("main", { className: "flex-1 p-6 md:p-8 max-w-7xl w-full mx-auto", children })
|
|
1258
|
+
] })
|
|
1259
|
+
]
|
|
1260
|
+
}
|
|
1261
|
+
)
|
|
1262
|
+
);
|
|
1263
|
+
DashboardShell.displayName = "DashboardShell";
|
|
1104
1264
|
|
|
1105
1265
|
exports.Accordion = Accordion;
|
|
1106
1266
|
exports.AccordionContent = AccordionContent;
|
|
@@ -1121,15 +1281,21 @@ exports.CardFooter = CardFooter;
|
|
|
1121
1281
|
exports.CardHeader = CardHeader;
|
|
1122
1282
|
exports.CardTitle = CardTitle;
|
|
1123
1283
|
exports.Checkbox = Checkbox;
|
|
1284
|
+
exports.DashboardShell = DashboardShell;
|
|
1285
|
+
exports.DataTable = DataTable;
|
|
1124
1286
|
exports.DropdownMenu = DropdownMenu;
|
|
1125
1287
|
exports.DropdownMenuContent = DropdownMenuContent;
|
|
1126
1288
|
exports.DropdownMenuItem = DropdownMenuItem;
|
|
1127
1289
|
exports.DropdownMenuSeparator = DropdownMenuSeparator;
|
|
1128
1290
|
exports.DropdownMenuTrigger = DropdownMenuTrigger;
|
|
1291
|
+
exports.EmptyState = EmptyState;
|
|
1292
|
+
exports.ErrorState = ErrorState;
|
|
1129
1293
|
exports.Field = Field;
|
|
1294
|
+
exports.FormField = FormField;
|
|
1130
1295
|
exports.Hint = Hint;
|
|
1131
1296
|
exports.Input = Input;
|
|
1132
1297
|
exports.Label = Label;
|
|
1298
|
+
exports.MetricCard = MetricCard;
|
|
1133
1299
|
exports.Modal = Modal;
|
|
1134
1300
|
exports.ModalActions = ModalActions;
|
|
1135
1301
|
exports.ModalDescription = ModalDescription;
|
|
@@ -1140,6 +1306,7 @@ exports.Progress = Progress;
|
|
|
1140
1306
|
exports.Radio = Radio;
|
|
1141
1307
|
exports.Segmented = Segmented;
|
|
1142
1308
|
exports.Select = Select;
|
|
1309
|
+
exports.Skeleton = Skeleton;
|
|
1143
1310
|
exports.Slider = Slider;
|
|
1144
1311
|
exports.Spinner = Spinner;
|
|
1145
1312
|
exports.Stat = Stat;
|