@nswds/app 3.0.2 → 4.0.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
@@ -12905,7 +12905,9 @@ function ContextMenuShortcut({ className, ...props }) {
12905
12905
  }
12906
12906
  );
12907
12907
  }
12908
- function DataTablePagination({ table }) {
12908
+ function DataTablePagination({
12909
+ table
12910
+ }) {
12909
12911
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-2", children: [
12910
12912
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 text-sm text-muted-foreground", children: [
12911
12913
  table.getFilteredSelectedRowModel().rows.length,
@@ -12920,12 +12922,12 @@ function DataTablePagination({ table }) {
12920
12922
  /* @__PURE__ */ jsxRuntime.jsxs(
12921
12923
  Select,
12922
12924
  {
12923
- value: `${table.getState().pagination.pageSize}`,
12925
+ value: `${table.state.pagination.pageSize}`,
12924
12926
  onValueChange: (value) => {
12925
12927
  table.setPageSize(Number(value));
12926
12928
  },
12927
12929
  children: [
12928
- /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-[80px]", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: table.getState().pagination.pageSize }) }),
12930
+ /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-[80px]", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: table.state.pagination.pageSize }) }),
12929
12931
  /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { side: "top", children: [10, 20, 30, 40, 50].map((pageSize) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize)) })
12930
12932
  ]
12931
12933
  }
@@ -12933,7 +12935,7 @@ function DataTablePagination({ table }) {
12933
12935
  ] }),
12934
12936
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: [
12935
12937
  "Page ",
12936
- table.getState().pagination.pageIndex + 1,
12938
+ table.state.pagination.pageIndex + 1,
12937
12939
  " of ",
12938
12940
  table.getPageCount()
12939
12941
  ] }),
@@ -13098,7 +13100,9 @@ function DataTableFacetedFilter({
13098
13100
  ] }) })
13099
13101
  ] });
13100
13102
  }
13101
- function DataTableViewOptions({ table }) {
13103
+ function DataTableViewOptions({
13104
+ table
13105
+ }) {
13102
13106
  return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
13103
13107
  /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button2, { variant: "outline", size: "sm", className: "nsw:ml-auto nsw:hidden nsw:lg:flex", children: [
13104
13108
  /* @__PURE__ */ jsxRuntime.jsx(Icons.tune, {}),
@@ -13151,8 +13155,12 @@ function Input({ className, type, ...props }) {
13151
13155
  }
13152
13156
  );
13153
13157
  }
13154
- function DataTableToolbar({ search, toolbar, table }) {
13155
- const isFiltered = table.getState().columnFilters.length > 0;
13158
+ function DataTableToolbar({
13159
+ search,
13160
+ toolbar,
13161
+ table
13162
+ }) {
13163
+ const isFiltered = table.state.columnFilters.length > 0;
13156
13164
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
13157
13165
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 items-center space-x-2", children: [
13158
13166
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -13161,7 +13169,7 @@ function DataTableToolbar({ search, toolbar, table }) {
13161
13169
  type: "search",
13162
13170
  name: "global-filter",
13163
13171
  placeholder: search?.placeholder ?? `Filter...`,
13164
- value: table.getState().globalFilter ?? "",
13172
+ value: table.state.globalFilter ?? "",
13165
13173
  onChange: (event) => table.setGlobalFilter(event.target.value),
13166
13174
  className: "h-10 w-[184px] lg:w-[280px]"
13167
13175
  }
@@ -13265,6 +13273,22 @@ function TableCaption({ className, ...props }) {
13265
13273
  }
13266
13274
  );
13267
13275
  }
13276
+ var dataTableFeatures = reactTable.tableFeatures({
13277
+ rowSortingFeature: reactTable.rowSortingFeature,
13278
+ columnFilteringFeature: reactTable.columnFilteringFeature,
13279
+ globalFilteringFeature: reactTable.globalFilteringFeature,
13280
+ columnVisibilityFeature: reactTable.columnVisibilityFeature,
13281
+ rowSelectionFeature: reactTable.rowSelectionFeature,
13282
+ rowPaginationFeature: reactTable.rowPaginationFeature,
13283
+ columnFacetingFeature: reactTable.columnFacetingFeature,
13284
+ sortedRowModel: reactTable.createSortedRowModel(),
13285
+ filteredRowModel: reactTable.createFilteredRowModel(),
13286
+ paginatedRowModel: reactTable.createPaginatedRowModel(),
13287
+ facetedRowModel: reactTable.createFacetedRowModel(),
13288
+ facetedUniqueValues: reactTable.createFacetedUniqueValues(),
13289
+ filterFns: reactTable.filterFns,
13290
+ sortFns: reactTable.sortFns
13291
+ });
13268
13292
  function DataTable({
13269
13293
  search,
13270
13294
  toolbar,
@@ -13277,7 +13301,8 @@ function DataTable({
13277
13301
  const [columnFilters, setColumnFilters] = React5__namespace.useState([]);
13278
13302
  const [sorting, setSorting] = React5__namespace.useState(initialSorting);
13279
13303
  const [globalFilter, setGlobalFilter] = React5__namespace.useState("");
13280
- const table = reactTable.useReactTable({
13304
+ const table = reactTable.useTable({
13305
+ features: dataTableFeatures,
13281
13306
  data,
13282
13307
  columns,
13283
13308
  state: {
@@ -13288,18 +13313,14 @@ function DataTable({
13288
13313
  columnFilters
13289
13314
  },
13290
13315
  enableRowSelection: true,
13316
+ // v9 enables shift-click range selection by default; keep v8 behavior
13317
+ enableRowRangeSelection: false,
13291
13318
  onRowSelectionChange: setRowSelection,
13292
13319
  onSortingChange: setSorting,
13293
13320
  onColumnFiltersChange: setColumnFilters,
13294
13321
  onColumnVisibilityChange: setColumnVisibility,
13295
13322
  onGlobalFilterChange: setGlobalFilter,
13296
- globalFilterFn: "includesString",
13297
- getCoreRowModel: reactTable.getCoreRowModel(),
13298
- getFilteredRowModel: reactTable.getFilteredRowModel(),
13299
- getPaginationRowModel: reactTable.getPaginationRowModel(),
13300
- getSortedRowModel: reactTable.getSortedRowModel(),
13301
- getFacetedRowModel: reactTable.getFacetedRowModel(),
13302
- getFacetedUniqueValues: reactTable.getFacetedUniqueValues()
13323
+ globalFilterFn: "includesString"
13303
13324
  });
13304
13325
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 p-1", children: [
13305
13326
  /* @__PURE__ */ jsxRuntime.jsx(DataTableToolbar, { table, search, toolbar }),
@@ -14469,7 +14490,7 @@ function FormatToggle({ format, setFormat }) {
14469
14490
 
14470
14491
  // package.json
14471
14492
  var package_default = {
14472
- version: "3.0.2"};
14493
+ version: "4.0.0"};
14473
14494
  var SluggerContext = React5__namespace.default.createContext(null);
14474
14495
  function flattenText(nodes) {
14475
14496
  if (nodes == null || typeof nodes === "boolean") return "";
@@ -32287,6 +32308,7 @@ exports.createColorArray = createColorArray;
32287
32308
  exports.createColorData = createColorData;
32288
32309
  exports.createFormStore = createFormStore;
32289
32310
  exports.darkenColor = darkenColor;
32311
+ exports.dataTableFeatures = dataTableFeatures;
32290
32312
  exports.diverging = diverging;
32291
32313
  exports.domToSimple = domToSimple;
32292
32314
  exports.focusInput = focusInput;