@kjaniec-dev/ui 0.5.0 → 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 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-[1.1rem] text-[0.85rem] text-muted-foreground", className), children }) })
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
  }
@@ -1173,6 +1173,94 @@ function DataTable({
1173
1173
  ] });
1174
1174
  }
1175
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";
1176
1264
 
1177
1265
  exports.Accordion = Accordion;
1178
1266
  exports.AccordionContent = AccordionContent;
@@ -1193,6 +1281,7 @@ exports.CardFooter = CardFooter;
1193
1281
  exports.CardHeader = CardHeader;
1194
1282
  exports.CardTitle = CardTitle;
1195
1283
  exports.Checkbox = Checkbox;
1284
+ exports.DashboardShell = DashboardShell;
1196
1285
  exports.DataTable = DataTable;
1197
1286
  exports.DropdownMenu = DropdownMenu;
1198
1287
  exports.DropdownMenuContent = DropdownMenuContent;
@@ -1200,7 +1289,9 @@ exports.DropdownMenuItem = DropdownMenuItem;
1200
1289
  exports.DropdownMenuSeparator = DropdownMenuSeparator;
1201
1290
  exports.DropdownMenuTrigger = DropdownMenuTrigger;
1202
1291
  exports.EmptyState = EmptyState;
1292
+ exports.ErrorState = ErrorState;
1203
1293
  exports.Field = Field;
1294
+ exports.FormField = FormField;
1204
1295
  exports.Hint = Hint;
1205
1296
  exports.Input = Input;
1206
1297
  exports.Label = Label;
@@ -1215,6 +1306,7 @@ exports.Progress = Progress;
1215
1306
  exports.Radio = Radio;
1216
1307
  exports.Segmented = Segmented;
1217
1308
  exports.Select = Select;
1309
+ exports.Skeleton = Skeleton;
1218
1310
  exports.Slider = Slider;
1219
1311
  exports.Spinner = Spinner;
1220
1312
  exports.Stat = Stat;