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