@nccirtu/tablefy 0.9.1 → 0.9.3

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.js CHANGED
@@ -61,7 +61,7 @@ function DataTableHeader({ title, description, actions = [], search, searchValue
61
61
  !search?.enabled) {
62
62
  return null;
63
63
  }
64
- return (jsxRuntime.jsxs("div", { className: utils.cn("flex flex-col gap-4", className), children: [(title || description) && (jsxRuntime.jsxs("div", { className: "space-y-1", children: [title && (jsxRuntime.jsx("h2", { className: "text-xl font-semibold tracking-tight", children: title })), description && (jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: description }))] })), (search?.enabled || normalActions.length > 0 || showBulkActions) && (jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4 mb-4", children: [search?.enabled && (jsxRuntime.jsxs("div", { className: "relative max-w-sm flex-1", children: [jsxRuntime.jsx(lucideReact.Search, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }), jsxRuntime.jsx(input.Input, { placeholder: search.placeholder || "Suchen...", value: searchValue, onChange: (e) => onSearchChange?.(e.target.value), className: "pl-9 pr-9" }), searchValue && (jsxRuntime.jsx("button", { onClick: () => onSearchChange?.(""), className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground", children: jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }) }))] })), jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [showBulkActions && (jsxRuntime.jsxs("span", { className: "text-sm text-muted-foreground", children: [selectedCount, " ausgew\u00E4hlt"] })), showBulkActions &&
64
+ return (jsxRuntime.jsxs("div", { className: utils.cn("flex flex-col gap-4", className), children: [(title || description) && (jsxRuntime.jsxs("div", { className: "space-y-1", children: [title && (jsxRuntime.jsx("h2", { className: "text-xl font-semibold tracking-tight", children: title })), description && (jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: description }))] })), (search?.enabled || normalActions.length > 0 || showBulkActions) && (jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4 mb-4", children: [search?.enabled && (jsxRuntime.jsxs("div", { className: "relative max-w-sm flex-1", children: [jsxRuntime.jsx(lucideReact.Search, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }), jsxRuntime.jsx(input.Input, { placeholder: search.placeholder || "Suchen...", value: searchValue, onChange: (e) => onSearchChange?.(e.target.value), className: "pl-9 pr-9" }), searchValue && (jsxRuntime.jsx("button", { onClick: () => onSearchChange?.(""), className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground", children: jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }) }))] })), jsxRuntime.jsxs("div", { className: "hidden md:flex items-center gap-2", children: [showBulkActions && (jsxRuntime.jsxs("span", { className: "text-sm text-muted-foreground", children: [selectedCount, " ausgew\u00E4hlt"] })), showBulkActions &&
65
65
  bulkActions.map((action, index) => renderAction(action, index)), enableColumnVisibility && table && (jsxRuntime.jsxs(dropdownMenu.DropdownMenu, { children: [jsxRuntime.jsx(dropdownMenu.DropdownMenuTrigger, { asChild: true, children: jsxRuntime.jsxs(button.Button, { variant: "outline", size: "default", children: [jsxRuntime.jsx(lucideReact.Columns, { className: "h-4 w-4" }), jsxRuntime.jsx("span", { className: "ml-2", children: columnVisibilityLabel }), jsxRuntime.jsx(lucideReact.ChevronDown, { className: "ml-2 h-4 w-4" })] }) }), jsxRuntime.jsxs(dropdownMenu.DropdownMenuContent, { align: "end", className: "w-[200px]", children: [jsxRuntime.jsx(dropdownMenu.DropdownMenuLabel, { children: columnVisibilityLabel }), jsxRuntime.jsx(dropdownMenu.DropdownMenuSeparator, {}), table
66
66
  .getAllColumns()
67
67
  .filter((column) => column.getCanHide())
@@ -70,7 +70,21 @@ function DataTableHeader({ title, description, actions = [], search, searchValue
70
70
  const label = meta?.visibilityLabel || column.id;
71
71
  return (jsxRuntime.jsx(dropdownMenu.DropdownMenuCheckboxItem, { checked: column.getIsVisible(), onCheckedChange: (value) => column.toggleVisibility(!!value), children: label }, column.id));
72
72
  })] })] })), normalActions.length > 0 &&
73
- normalActions.map((action, index) => renderAction(action, index))] })] }))] }));
73
+ normalActions.map((action, index) => renderAction(action, index))] }), jsxRuntime.jsxs("div", { className: "flex md:hidden items-center gap-2", children: [showBulkActions && (jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: selectedCount })), enableColumnVisibility && table && (jsxRuntime.jsxs(dropdownMenu.DropdownMenu, { children: [jsxRuntime.jsx(dropdownMenu.DropdownMenuTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { variant: "outline", size: "icon", "aria-label": columnVisibilityLabel, children: jsxRuntime.jsx(lucideReact.Columns, { className: "h-4 w-4" }) }) }), jsxRuntime.jsxs(dropdownMenu.DropdownMenuContent, { align: "end", className: "w-[200px]", children: [jsxRuntime.jsx(dropdownMenu.DropdownMenuLabel, { children: columnVisibilityLabel }), jsxRuntime.jsx(dropdownMenu.DropdownMenuSeparator, {}), table
74
+ .getAllColumns()
75
+ .filter((column) => column.getCanHide())
76
+ .map((column) => {
77
+ const meta = column.columnDef.meta;
78
+ const label = meta?.visibilityLabel || column.id;
79
+ return (jsxRuntime.jsx(dropdownMenu.DropdownMenuCheckboxItem, { checked: column.getIsVisible(), onCheckedChange: (value) => column.toggleVisibility(!!value), onSelect: (e) => e.preventDefault(), children: label }, column.id));
80
+ })] })] })), (normalActions.length > 0 || showBulkActions) && (jsxRuntime.jsxs(dropdownMenu.DropdownMenu, { children: [jsxRuntime.jsx(dropdownMenu.DropdownMenuTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { variant: "outline", size: "icon", "aria-label": "Tabellen-Aktionen", children: jsxRuntime.jsx(lucideReact.MoreHorizontal, { className: "h-4 w-4" }) }) }), jsxRuntime.jsxs(dropdownMenu.DropdownMenuContent, { align: "end", className: "w-[240px]", children: [showBulkActions && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(dropdownMenu.DropdownMenuLabel, { children: [selectedCount, " ausgew\u00E4hlt"] }), jsxRuntime.jsx(dropdownMenu.DropdownMenuSeparator, {}), bulkActions.map((action, index) => (jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onClick: () => {
81
+ if (action.bulkOnClick)
82
+ action.bulkOnClick(getSelectedRows());
83
+ else
84
+ action.onClick?.();
85
+ }, disabled: action.disabled || action.loading, className: utils.cn(action.variant === "destructive" &&
86
+ "text-destructive focus:text-destructive"), children: [action.icon && jsxRuntime.jsx("span", { className: "mr-2", children: action.icon }), action.label] }, `bulk-${action.id || index}`))), normalActions.length > 0 && jsxRuntime.jsx(dropdownMenu.DropdownMenuSeparator, {})] })), normalActions.map((action, index) => action.href ? (jsxRuntime.jsx(dropdownMenu.DropdownMenuItem, { asChild: true, children: jsxRuntime.jsxs("a", { href: action.href, children: [action.icon && jsxRuntime.jsx("span", { className: "mr-2", children: action.icon }), action.label] }) }, action.id || index)) : (jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onClick: action.onClick, disabled: action.disabled || action.loading, className: utils.cn(action.variant === "destructive" &&
87
+ "text-destructive focus:text-destructive"), children: [action.icon && jsxRuntime.jsx("span", { className: "mr-2", children: action.icon }), action.label] }, action.id || index)))] })] }))] })] }))] }));
74
88
  }
75
89
 
76
90
  function DataTableEmpty({ config, colSpan, className, }) {
@@ -2777,6 +2791,7 @@ function WizardRenderer({ steps, fields, data, errors, onChange, onBlur, isField
2777
2791
  const currentStepConfig = steps[currentStep];
2778
2792
  const isLastStep = currentStep === steps.length - 1;
2779
2793
  const isFirstStep = currentStep === 0;
2794
+ const progressPercent = Math.round(((currentStep + 1) / steps.length) * 100);
2780
2795
  const canProceed = currentStepConfig?.canProceed
2781
2796
  ? currentStepConfig.canProceed(data)
2782
2797
  : true;
@@ -2799,12 +2814,7 @@ function WizardRenderer({ steps, fields, data, errors, onChange, onBlur, isField
2799
2814
  const stepFields = currentStepConfig?.fields
2800
2815
  ? fields.filter((f) => currentStepConfig.fields.includes(f.name))
2801
2816
  : [];
2802
- return (jsxRuntime.jsxs("div", { className: "space-y-6", children: [jsxRuntime.jsx("nav", { "aria-label": "Progress", children: jsxRuntime.jsx("ol", { className: "flex items-center", children: steps.map((step, index) => (jsxRuntime.jsxs("li", { className: utils.cn("flex items-center", index < steps.length - 1 && "flex-1"), children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("div", { className: utils.cn("flex h-8 w-8 items-center justify-center rounded-full border-2 text-sm font-medium", index < currentStep &&
2803
- "border-primary bg-primary text-primary-foreground", index === currentStep &&
2804
- "border-primary text-primary", index > currentStep &&
2805
- "border-muted-foreground/25 text-muted-foreground"), children: index < currentStep ? (jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" })) : (index + 1) }), jsxRuntime.jsxs("div", { className: "hidden sm:block", children: [jsxRuntime.jsx("p", { className: utils.cn("text-sm font-medium", index <= currentStep
2806
- ? "text-foreground"
2807
- : "text-muted-foreground"), children: step.label }), step.description && (jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: step.description }))] })] }), index < steps.length - 1 && (jsxRuntime.jsx("div", { className: utils.cn("mx-4 hidden h-0.5 flex-1 sm:block", index < currentStep ? "bg-primary" : "bg-muted") }))] }, step.id))) }) }), jsxRuntime.jsx("div", { children: currentStepConfig?.sections ? (jsxRuntime.jsx("div", { className: "space-y-4", children: currentStepConfig.sections.map((section) => (jsxRuntime.jsx(SectionRenderer, { section: section, fields: fields, data: data, errors: errors, onChange: onChange, onBlur: onBlur, isFieldVisible: isFieldVisible, isFieldDisabled: isFieldDisabled }, section.id))) })) : (jsxRuntime.jsx(GridLayout, { columns: columns, children: stepFields.map((field) => {
2817
+ return (jsxRuntime.jsxs("div", { className: "space-y-6", children: [jsxRuntime.jsxs("div", { className: "rounded-lg bg-muted/50 p-6", children: [jsxRuntime.jsxs("p", { className: "text-sm font-semibold uppercase tracking-wide text-muted-foreground", children: ["Step: ", currentStep + 1, " of ", steps.length] }), jsxRuntime.jsxs("div", { className: "mt-1 flex items-center justify-between gap-4", children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("h3", { className: "text-xl font-bold text-foreground", children: currentStepConfig?.label }), currentStepConfig?.description && (jsxRuntime.jsx("p", { className: "mt-0.5 text-sm text-muted-foreground", children: currentStepConfig.description }))] }), jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [jsxRuntime.jsx("div", { className: "h-3 w-40 overflow-hidden rounded-full bg-muted", children: jsxRuntime.jsx("div", { className: "h-full rounded-full bg-primary transition-all duration-300 ease-in-out", style: { width: `${progressPercent}%` } }) }), jsxRuntime.jsxs("span", { className: "text-sm font-medium text-muted-foreground", children: [progressPercent, "%"] })] })] })] }), jsxRuntime.jsx("div", { children: currentStepConfig?.sections ? (jsxRuntime.jsx("div", { className: "space-y-4", children: currentStepConfig.sections.map((section) => (jsxRuntime.jsx(SectionRenderer, { section: section, fields: fields, data: data, errors: errors, onChange: onChange, onBlur: onBlur, isFieldVisible: isFieldVisible, isFieldDisabled: isFieldDisabled }, section.id))) })) : (jsxRuntime.jsx(GridLayout, { columns: columns, children: stepFields.map((field) => {
2808
2818
  if (!isFieldVisible(field))
2809
2819
  return null;
2810
2820
  return (jsxRuntime.jsx(FieldRenderer, { field: field, value: data[field.name], error: errors[field.name], disabled: isFieldDisabled(field), data: data, onChange: (v) => onChange(field.name, v), onBlur: onBlur ? () => onBlur(field.name) : undefined }, field.name));