@classytic/fluid 0.2.0 → 0.2.4

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
@@ -13,11 +13,12 @@ import { Pagination, PaginationContent, PaginationItem, PaginationPrevious, Pagi
13
13
  import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '@/components/ui/card';
14
14
  import { Skeleton } from '@/components/ui/skeleton';
15
15
  import { Table, TableHeader, TableRow, TableHead, TableBody, TableCell } from '@/components/ui/table';
16
- import { Check, ChevronLeft, ChevronRight, ChevronUp, ChevronDown, AlertTriangle, Loader2, AlertCircle, RefreshCw, InboxIcon, SearchX, FileX2, CheckCircle2, Info, X, Copy, Search, ArrowUp, ArrowDown, ArrowUpDown, MoreHorizontal, Sun, Moon, MinusIcon, ChevronUpIcon, ChevronDownIcon, ArrowLeft, ArrowRight, CalendarIcon, Wand2, Tag, Plus } from 'lucide-react';
16
+ import { Check, ChevronLeft, ChevronRight, ChevronUp, ChevronDown, AlertTriangle, Loader2, AlertCircle, RefreshCw, InboxIcon, CheckCircle2, Info, X, Copy, Search, ArrowUp, ArrowDown, ArrowUpDown, MoreHorizontal, Sun, Moon, MinusIcon, ChevronUpIcon, ChevronDownIcon, ArrowLeft, ArrowRight, CalendarIcon, Wand2, Tag, Plus, FileX2, SearchX } from 'lucide-react';
17
17
  import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '@/components/ui/collapsible';
18
18
  import { Button } from '@/components/ui/button';
19
19
  import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction } from '@/components/ui/alert-dialog';
20
20
  import { Alert, AlertTitle, AlertDescription } from '@/components/ui/alert';
21
+ import { Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, EmptyContent } from '@/components/ui/empty';
21
22
  import { useReactTable, getSortedRowModel, getCoreRowModel, flexRender } from '@tanstack/react-table';
22
23
  import { ScrollArea, ScrollBar } from '@/components/ui/scroll-area';
23
24
  import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from '@/components/ui/dialog';
@@ -1444,17 +1445,17 @@ function ErrorStateInline({
1444
1445
  }
1445
1446
  var PRESETS = {
1446
1447
  noResults: {
1447
- icon: SearchX,
1448
+ icon: /* @__PURE__ */ jsx(SearchX, { className: "h-6 w-6" }),
1448
1449
  title: "No results found",
1449
1450
  description: "Try adjusting your search or filter criteria."
1450
1451
  },
1451
1452
  noData: {
1452
- icon: InboxIcon,
1453
+ icon: /* @__PURE__ */ jsx(InboxIcon, { className: "h-6 w-6" }),
1453
1454
  title: "No data yet",
1454
1455
  description: "Get started by creating your first item."
1455
1456
  },
1456
1457
  notFound: {
1457
- icon: FileX2,
1458
+ icon: /* @__PURE__ */ jsx(FileX2, { className: "h-6 w-6" }),
1458
1459
  title: "Not found",
1459
1460
  description: "The item you're looking for doesn't exist or has been removed."
1460
1461
  }
@@ -1462,35 +1463,24 @@ var PRESETS = {
1462
1463
  function EmptyState({
1463
1464
  title = "Nothing here",
1464
1465
  description,
1465
- icon: IconProp = InboxIcon,
1466
+ icon = /* @__PURE__ */ jsx(InboxIcon, { className: "h-6 w-6" }),
1466
1467
  action,
1467
1468
  secondaryAction,
1468
1469
  variant = "default",
1469
1470
  className,
1470
1471
  children
1471
1472
  }) {
1472
- const isLucideIcon = typeof IconProp === "function";
1473
- const Icon = IconProp;
1474
- const iconElement = isLucideIcon ? /* @__PURE__ */ jsx(
1475
- Icon,
1476
- {
1477
- className: cn(
1478
- "text-muted-foreground/60",
1479
- variant === "compact" ? "h-8 w-8" : "h-12 w-12"
1480
- ),
1481
- strokeWidth: 1.5
1482
- }
1483
- ) : IconProp;
1484
1473
  if (variant === "compact") {
1485
1474
  return /* @__PURE__ */ jsxs(
1486
1475
  "div",
1487
1476
  {
1477
+ "data-slot": "empty-state",
1488
1478
  className: cn(
1489
1479
  "flex items-center gap-3 py-6 px-4 text-muted-foreground",
1490
1480
  className
1491
1481
  ),
1492
1482
  children: [
1493
- iconElement,
1483
+ icon && /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0", children: icon }),
1494
1484
  /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1495
1485
  /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: title }),
1496
1486
  description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground/80 mt-0.5", children: description })
@@ -1501,50 +1491,23 @@ function EmptyState({
1501
1491
  );
1502
1492
  }
1503
1493
  return /* @__PURE__ */ jsxs(
1504
- "div",
1494
+ Empty,
1505
1495
  {
1506
1496
  className: cn(
1507
- "flex flex-col items-center justify-center text-center",
1508
- variant === "card" && "rounded-lg border border-dashed border-muted-foreground/25 bg-muted/30",
1509
- variant === "default" ? "py-16 px-6" : "py-12 px-8",
1497
+ variant === "card" && "border border-dashed",
1510
1498
  className
1511
1499
  ),
1512
1500
  children: [
1513
- /* @__PURE__ */ jsx(
1514
- "div",
1515
- {
1516
- className: cn(
1517
- "flex items-center justify-center rounded-full bg-muted/60",
1518
- variant === "default" ? "h-20 w-20 mb-6" : "h-16 w-16 mb-5"
1519
- ),
1520
- children: iconElement
1521
- }
1522
- ),
1523
- /* @__PURE__ */ jsx(
1524
- "h3",
1525
- {
1526
- className: cn(
1527
- "font-semibold tracking-tight",
1528
- variant === "default" ? "text-lg" : "text-base"
1529
- ),
1530
- children: title
1531
- }
1532
- ),
1533
- description && /* @__PURE__ */ jsx(
1534
- "p",
1535
- {
1536
- className: cn(
1537
- "text-muted-foreground max-w-sm mt-2",
1538
- variant === "default" ? "text-sm" : "text-xs"
1539
- ),
1540
- children: description
1541
- }
1542
- ),
1543
- children && /* @__PURE__ */ jsx("div", { className: "mt-4 w-full max-w-md", children }),
1544
- (action || secondaryAction) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mt-6", children: [
1501
+ /* @__PURE__ */ jsxs(EmptyHeader, { children: [
1502
+ icon && /* @__PURE__ */ jsx(EmptyMedia, { variant: "icon", children: icon }),
1503
+ /* @__PURE__ */ jsx(EmptyTitle, { children: title }),
1504
+ description && /* @__PURE__ */ jsx(EmptyDescription, { children: description })
1505
+ ] }),
1506
+ children && /* @__PURE__ */ jsx(EmptyContent, { children }),
1507
+ (action || secondaryAction) && /* @__PURE__ */ jsx(EmptyContent, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
1545
1508
  action,
1546
1509
  secondaryAction
1547
- ] })
1510
+ ] }) })
1548
1511
  ]
1549
1512
  }
1550
1513
  );
@@ -5276,10 +5239,9 @@ function ComboboxInput({
5276
5239
  onChange: propOnChange
5277
5240
  }) {
5278
5241
  const descriptionText = description || helperText;
5279
- const itemValues = useMemo(() => items.map((item) => item.value), [items]);
5280
5242
  const handleValueChange = useCallback(
5281
- (newValue, field) => {
5282
- const safeValue = newValue || "";
5243
+ (newItem, field) => {
5244
+ const safeValue = newItem?.value || "";
5283
5245
  if (field) {
5284
5246
  field.onChange(safeValue);
5285
5247
  } else if (propOnChange) {
@@ -5290,12 +5252,13 @@ function ComboboxInput({
5290
5252
  [propOnChange, onValueChange]
5291
5253
  );
5292
5254
  const renderCombobox = (currentValue, field, isDisabled) => {
5255
+ const selectedItem = currentValue ? items.find((item) => item.value === currentValue) ?? null : null;
5293
5256
  return /* @__PURE__ */ jsxs(
5294
5257
  Combobox,
5295
5258
  {
5296
- items: itemValues,
5297
- value: currentValue,
5298
- onValueChange: (value) => handleValueChange(value, field),
5259
+ items,
5260
+ value: selectedItem,
5261
+ onValueChange: (item) => handleValueChange(item, field),
5299
5262
  disabled: isDisabled,
5300
5263
  children: [
5301
5264
  /* @__PURE__ */ jsx(
@@ -5307,17 +5270,16 @@ function ComboboxInput({
5307
5270
  ),
5308
5271
  /* @__PURE__ */ jsxs(ComboboxContent, { children: [
5309
5272
  /* @__PURE__ */ jsx(ComboboxEmpty, { children: emptyText }),
5310
- /* @__PURE__ */ jsx(ComboboxList, { children: (itemValue) => {
5311
- const option = items.find((item) => item.value === itemValue);
5312
- if (!option) return null;
5273
+ /* @__PURE__ */ jsx(ComboboxList, { children: (item) => {
5274
+ if (!item) return null;
5313
5275
  return /* @__PURE__ */ jsx(
5314
5276
  ComboboxItem,
5315
5277
  {
5316
- value: option.value,
5317
- disabled: option.disabled,
5318
- children: renderOption ? renderOption(option) : option.label
5278
+ value: item,
5279
+ disabled: item.disabled,
5280
+ children: renderOption ? renderOption(item) : item.label
5319
5281
  },
5320
- option.value
5282
+ item.value
5321
5283
  );
5322
5284
  } })
5323
5285
  ] })