@facter/ds-core 1.17.0 → 1.18.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.mjs CHANGED
@@ -5,7 +5,7 @@ import { cva } from 'class-variance-authority';
5
5
  import { clsx } from 'clsx';
6
6
  import { twMerge } from 'tailwind-merge';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
- import { ChevronDown, Check, Inbox, ChevronsLeft, ChevronLeft, ChevronRight, ChevronsRight, X, Circle, PinOff, Pin, ArrowDown, ArrowUp, ChevronsUpDown, FileText, FileSpreadsheet, Download, Rows4, Rows3, LayoutList, SlidersHorizontal, Info, AlertTriangle, XCircle, CheckCircle2, Building2, Star, ArrowRight, Search, User, LogOut, Menu, Loader2, AlertCircle, TrendingUp, TrendingDown, Sun, Moon, Bell, MoreHorizontal, Settings } from 'lucide-react';
8
+ import { ChevronDown, Check, Inbox, Search, ChevronsLeft, ChevronLeft, ChevronRight, ChevronsRight, X, Circle, PinOff, Pin, ArrowDown, ArrowUp, ChevronsUpDown, FileText, FileSpreadsheet, Download, Rows4, Rows3, LayoutList, SlidersHorizontal, Info, AlertTriangle, XCircle, CheckCircle2, Building2, Star, ArrowRight, User, LogOut, Menu, Loader2, AlertCircle, TrendingUp, TrendingDown, Sun, Moon, Bell, MoreHorizontal, Settings } from 'lucide-react';
9
9
  import { AnimatePresence, motion } from 'framer-motion';
10
10
  import * as SelectPrimitive from '@radix-ui/react-select';
11
11
  import * as TabsPrimitive from '@radix-ui/react-tabs';
@@ -1620,32 +1620,38 @@ var DataTableSearch = React10.memo(function DataTableSearch2({
1620
1620
  className
1621
1621
  }) {
1622
1622
  const table = useDataTableInstance();
1623
- const columnInstance = table.getColumn(column);
1623
+ const columnInstance = column ? table.getColumn(column) : null;
1624
1624
  const [value, setValue] = React10.useState(
1625
1625
  columnInstance?.getFilterValue() ?? ""
1626
1626
  );
1627
1627
  const debouncedValue = useDebounce(value, debounce);
1628
1628
  React10.useEffect(() => {
1629
- columnInstance?.setFilterValue(debouncedValue);
1629
+ if (columnInstance) {
1630
+ columnInstance.setFilterValue(debouncedValue || void 0);
1631
+ }
1630
1632
  if (onSearch) {
1631
1633
  onSearch(debouncedValue);
1632
1634
  }
1633
1635
  }, [debouncedValue, columnInstance, onSearch]);
1634
1636
  React10.useEffect(() => {
1635
- const filterValue = columnInstance?.getFilterValue() ?? "";
1637
+ if (!columnInstance) return;
1638
+ const filterValue = columnInstance.getFilterValue() ?? "";
1636
1639
  if (filterValue !== value) {
1637
1640
  setValue(filterValue);
1638
1641
  }
1639
1642
  }, [columnInstance?.getFilterValue()]);
1640
- return /* @__PURE__ */ jsx(
1641
- Input,
1642
- {
1643
- placeholder,
1644
- value,
1645
- onChange: (e) => setValue(e.target.value),
1646
- className: cn("h-9 w-[150px] lg:w-[250px]", className)
1647
- }
1648
- );
1643
+ return /* @__PURE__ */ jsxs("div", { className: cn("relative w-[150px] lg:w-[250px]", className), children: [
1644
+ /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none" }),
1645
+ /* @__PURE__ */ jsx(
1646
+ Input,
1647
+ {
1648
+ placeholder,
1649
+ value,
1650
+ onChange: (e) => setValue(e.target.value),
1651
+ className: "h-9 pl-9"
1652
+ }
1653
+ )
1654
+ ] });
1649
1655
  });
1650
1656
  var DataTableFilters = React10.memo(function DataTableFilters2({
1651
1657
  onChange,
@@ -1667,21 +1673,26 @@ var DataTableFilter = React10.memo(function DataTableFilter2({
1667
1673
  column: columnId,
1668
1674
  title,
1669
1675
  options,
1676
+ onValueChange: onServerValueChange,
1670
1677
  className
1671
1678
  }) {
1672
1679
  const table = useDataTableInstance();
1673
- const column = table.getColumn(columnId);
1680
+ const column = columnId ? table.getColumn(columnId) : null;
1674
1681
  const filterValue = column?.getFilterValue() ?? [];
1675
- const currentValue = filterValue.length > 0 ? filterValue[0] : "all";
1682
+ const [localValue, setLocalValue] = React10.useState("all");
1683
+ const currentValue = column ? filterValue.length > 0 ? filterValue[0] : "all" : localValue;
1676
1684
  const handleValueChange = React10.useCallback(
1677
1685
  (value) => {
1678
- if (value === "all") {
1679
- column?.setFilterValue(void 0);
1680
- } else {
1681
- column?.setFilterValue([value]);
1686
+ const resolvedValue = value === "all" ? void 0 : value;
1687
+ if (column) {
1688
+ column.setFilterValue(resolvedValue ? [resolvedValue] : void 0);
1689
+ }
1690
+ if (onServerValueChange) {
1691
+ onServerValueChange(resolvedValue);
1682
1692
  }
1693
+ setLocalValue(value);
1683
1694
  },
1684
- [column]
1695
+ [column, onServerValueChange]
1685
1696
  );
1686
1697
  return /* @__PURE__ */ jsxs(
1687
1698
  Select,