@nswds/app 1.54.7 → 1.56.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/globals.css CHANGED
@@ -438,6 +438,9 @@
438
438
  .bottom-0 {
439
439
  bottom: calc(var(--spacing) * 0);
440
440
  }
441
+ .bottom-2 {
442
+ bottom: calc(var(--spacing) * 2);
443
+ }
441
444
  .-left-12 {
442
445
  left: calc(var(--spacing) * -12);
443
446
  }
@@ -1078,6 +1081,9 @@
1078
1081
  .mb-4 {
1079
1082
  margin-bottom: calc(var(--spacing) * 4);
1080
1083
  }
1084
+ .mb-8 {
1085
+ margin-bottom: calc(var(--spacing) * 8);
1086
+ }
1081
1087
  .mb-12 {
1082
1088
  margin-bottom: calc(var(--spacing) * 12);
1083
1089
  }
@@ -1093,6 +1099,9 @@
1093
1099
  .-ml-1 {
1094
1100
  margin-left: calc(var(--spacing) * -1);
1095
1101
  }
1102
+ .-ml-3 {
1103
+ margin-left: calc(var(--spacing) * -3);
1104
+ }
1096
1105
  .-ml-4 {
1097
1106
  margin-left: calc(var(--spacing) * -4);
1098
1107
  }
@@ -1267,6 +1276,9 @@
1267
1276
  .h-3 {
1268
1277
  height: calc(var(--spacing) * 3);
1269
1278
  }
1279
+ .h-3\.5 {
1280
+ height: calc(var(--spacing) * 3.5);
1281
+ }
1270
1282
  .h-4 {
1271
1283
  height: calc(var(--spacing) * 4);
1272
1284
  }
@@ -1498,12 +1510,24 @@
1498
1510
  .w-\[50vw\] {
1499
1511
  width: 50vw;
1500
1512
  }
1513
+ .w-\[80px\] {
1514
+ width: 80px;
1515
+ }
1501
1516
  .w-\[100px\] {
1502
1517
  width: 100px;
1503
1518
  }
1519
+ .w-\[160px\] {
1520
+ width: 160px;
1521
+ }
1504
1522
  .w-\[180px\] {
1505
1523
  width: 180px;
1506
1524
  }
1525
+ .w-\[184px\] {
1526
+ width: 184px;
1527
+ }
1528
+ .w-\[200px\] {
1529
+ width: 200px;
1530
+ }
1507
1531
  .w-\[260px\] {
1508
1532
  width: 260px;
1509
1533
  }
@@ -1549,6 +1573,9 @@
1549
1573
  .max-w-60 {
1550
1574
  max-width: calc(var(--spacing) * 60);
1551
1575
  }
1576
+ .max-w-\[500px\] {
1577
+ max-width: 500px;
1578
+ }
1552
1579
  .max-w-\[600px\] {
1553
1580
  max-width: 600px;
1554
1581
  }
@@ -1729,6 +1756,10 @@
1729
1756
  --tw-translate-y: -50%;
1730
1757
  translate: var(--tw-translate-x) var(--tw-translate-y);
1731
1758
  }
1759
+ .translate-y-\[2px\] {
1760
+ --tw-translate-y: 2px;
1761
+ translate: var(--tw-translate-x) var(--tw-translate-y);
1762
+ }
1732
1763
  .translate-y-\[calc\(-50\%_-_2px\)\] {
1733
1764
  --tw-translate-y: calc(-50% - 2px);
1734
1765
  translate: var(--tw-translate-x) var(--tw-translate-y);
@@ -2008,6 +2039,13 @@
2008
2039
  .gap-x-12 {
2009
2040
  column-gap: calc(var(--spacing) * 12);
2010
2041
  }
2042
+ .space-x-1 {
2043
+ :where(& > :not(:last-child)) {
2044
+ --tw-space-x-reverse: 0;
2045
+ margin-inline-start: calc(calc(var(--spacing) * 1) * var(--tw-space-x-reverse));
2046
+ margin-inline-end: calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-x-reverse)));
2047
+ }
2048
+ }
2011
2049
  .space-x-2 {
2012
2050
  :where(& > :not(:last-child)) {
2013
2051
  --tw-space-x-reverse: 0;
@@ -2493,6 +2531,9 @@
2493
2531
  .bg-grey-100 {
2494
2532
  background-color: oklch(0.9700350548225147 0 0);
2495
2533
  }
2534
+ .bg-grey-150 {
2535
+ background-color: oklch(0.9550525822337722 0 0);
2536
+ }
2496
2537
  .bg-grey-200 {
2497
2538
  background-color: oklch(0.9400701096450296 0 0);
2498
2539
  }
@@ -2547,6 +2588,9 @@
2547
2588
  .bg-primary-500 {
2548
2589
  background-color: oklch(0.719602022988773 0.1609881523353869 242.17574150873253);
2549
2590
  }
2591
+ .bg-primary-600 {
2592
+ background-color: oklch(0.5751126532766045 0.2298336295034379 260.75633298199585);
2593
+ }
2550
2594
  .bg-primary-800 {
2551
2595
  background-color: oklch(0.2899986864508513 0.11729574451023282 259.841936589881);
2552
2596
  }
@@ -3398,6 +3442,12 @@
3398
3442
  .text-muted-foreground {
3399
3443
  color: var(--muted-foreground);
3400
3444
  }
3445
+ .text-muted-foreground\/70 {
3446
+ color: var(--muted-foreground);
3447
+ @supports (color: color-mix(in lab, red, red)) {
3448
+ color: color-mix(in oklab, var(--muted-foreground) 70%, transparent);
3449
+ }
3450
+ }
3401
3451
  .text-pink-500 {
3402
3452
  color: var(--color-pink-500);
3403
3453
  }
@@ -4374,6 +4424,13 @@
4374
4424
  }
4375
4425
  }
4376
4426
  }
4427
+ .group-hover\:text-grey-900 {
4428
+ &:is(:where(.group):hover *) {
4429
+ @media (hover: hover) {
4430
+ color: oklch(0.17511812981113217 0.007251980042076026 242.08383926925922);
4431
+ }
4432
+ }
4433
+ }
4377
4434
  .group-hover\:text-white {
4378
4435
  &:is(:where(.group):hover *) {
4379
4436
  @media (hover: hover) {
@@ -7295,6 +7352,16 @@
7295
7352
  color: var(--color-white);
7296
7353
  }
7297
7354
  }
7355
+ .data-\[state\=open\]\:bg-accent {
7356
+ &[data-state="open"] {
7357
+ background-color: var(--accent);
7358
+ }
7359
+ }
7360
+ .data-\[state\=open\]\:bg-muted {
7361
+ &[data-state="open"] {
7362
+ background-color: var(--muted);
7363
+ }
7364
+ }
7298
7365
  .data-\[state\=open\]\:bg-primary-800\/10 {
7299
7366
  &[data-state="open"] {
7300
7367
  background-color: color-mix(in oklab, oklch(0.2899986864508513 0.11729574451023282 259.841936589881) 10%, transparent);
@@ -8382,6 +8449,11 @@
8382
8449
  width: calc(var(--spacing) * 80);
8383
8450
  }
8384
8451
  }
8452
+ .lg\:w-\[280px\] {
8453
+ @media (width >= 64rem) {
8454
+ width: 280px;
8455
+ }
8456
+ }
8385
8457
  .lg\:max-w-none {
8386
8458
  @media (width >= 64rem) {
8387
8459
  max-width: none;
@@ -8446,6 +8518,15 @@
8446
8518
  }
8447
8519
  }
8448
8520
  }
8521
+ .lg\:space-x-8 {
8522
+ @media (width >= 64rem) {
8523
+ :where(& > :not(:last-child)) {
8524
+ --tw-space-x-reverse: 0;
8525
+ margin-inline-start: calc(calc(var(--spacing) * 8) * var(--tw-space-x-reverse));
8526
+ margin-inline-end: calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-x-reverse)));
8527
+ }
8528
+ }
8529
+ }
8449
8530
  .lg\:rounded-sm {
8450
8531
  @media (width >= 64rem) {
8451
8532
  border-radius: var(--radius-sm);
@@ -8645,6 +8726,11 @@
8645
8726
  border-color: oklch(0.426426783985819 0.011202235626284581 232.61715023407646);
8646
8727
  }
8647
8728
  }
8729
+ .dark\:border-grey-700 {
8730
+ &:where([data-theme=dark], [data-theme=dark] *) {
8731
+ border-color: oklch(0.3479196456937804 0.010781103557482309 237.35049475166784);
8732
+ }
8733
+ }
8648
8734
  .dark\:border-grey-800 {
8649
8735
  &:where([data-theme=dark], [data-theme=dark] *) {
8650
8736
  border-color: oklch(0.26941250740174183 0.010359971488680036 242.08383926925922);
@@ -8655,6 +8741,11 @@
8655
8741
  border-color: var(--input);
8656
8742
  }
8657
8743
  }
8744
+ .dark\:border-primary-600 {
8745
+ &:where([data-theme=dark], [data-theme=dark] *) {
8746
+ border-color: oklch(0.5751126532766045 0.2298336295034379 260.75633298199585);
8747
+ }
8748
+ }
8658
8749
  .dark\:border-slate-800 {
8659
8750
  &:where([data-theme=dark], [data-theme=dark] *) {
8660
8751
  border-color: var(--color-slate-800);
@@ -9073,6 +9164,11 @@
9073
9164
  color: oklch(0.6447616500965888 0.009489236713901311 230.74294411759388);
9074
9165
  }
9075
9166
  }
9167
+ .dark\:text-grey-700 {
9168
+ &:where([data-theme=dark], [data-theme=dark] *) {
9169
+ color: oklch(0.3479196456937804 0.010781103557482309 237.35049475166784);
9170
+ }
9171
+ }
9076
9172
  .dark\:text-muted-foreground {
9077
9173
  &:where([data-theme=dark], [data-theme=dark] *) {
9078
9174
  color: var(--muted-foreground);
@@ -9083,6 +9179,11 @@
9083
9179
  color: oklch(0.719602022988773 0.1609881523353869 242.17574150873253);
9084
9180
  }
9085
9181
  }
9182
+ .dark\:text-primary-600 {
9183
+ &:where([data-theme=dark], [data-theme=dark] *) {
9184
+ color: oklch(0.5751126532766045 0.2298336295034379 260.75633298199585);
9185
+ }
9186
+ }
9086
9187
  .dark\:text-red-500 {
9087
9188
  &:where([data-theme=dark], [data-theme=dark] *) {
9088
9189
  color: var(--color-red-500);
@@ -9406,6 +9507,15 @@
9406
9507
  }
9407
9508
  }
9408
9509
  }
9510
+ .dark\:group-hover\:text-grey-400 {
9511
+ &:where([data-theme=dark], [data-theme=dark] *) {
9512
+ &:is(:where(.group):hover *) {
9513
+ @media (hover: hover) {
9514
+ color: oklch(0.8630965162073586 0.007776237801518043 228.8687380011113);
9515
+ }
9516
+ }
9517
+ }
9518
+ }
9409
9519
  .dark\:group-data-active\:border-white\/20 {
9410
9520
  &:where([data-theme=dark], [data-theme=dark] *) {
9411
9521
  &:is(:where(.group)[data-active] *) {
@@ -10568,6 +10678,11 @@
10568
10678
  pointer-events: none;
10569
10679
  }
10570
10680
  }
10681
+ .\[\&_svg\]\:invisible {
10682
+ & svg {
10683
+ visibility: hidden;
10684
+ }
10685
+ }
10571
10686
  .\[\&_svg\]\:shrink-0 {
10572
10687
  & svg {
10573
10688
  flex-shrink: 0;
package/dist/index.cjs CHANGED
@@ -56,6 +56,7 @@ var AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
56
56
  var reactDayPicker = require('react-day-picker');
57
57
  var useEmblaCarousel = require('embla-carousel-react');
58
58
  var inputOtp = require('input-otp');
59
+ var reactTable = require('@tanstack/react-table');
59
60
  var slugify = require('@sindresorhus/slugify');
60
61
  var zustand = require('zustand');
61
62
  var middleware = require('zustand/middleware');
@@ -7871,7 +7872,7 @@ function Heading({
7871
7872
 
7872
7873
  // package.json
7873
7874
  var package_default = {
7874
- version: "1.54.4"};
7875
+ version: "1.54.7"};
7875
7876
  function Logo(props) {
7876
7877
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7877
7878
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "NSW Government" }),
@@ -16458,7 +16459,13 @@ function NavigationMenuList({
16458
16459
  NavigationMenuPrimitive__namespace.List,
16459
16460
  {
16460
16461
  "data-slot": "navigation-menu-list",
16461
- className: cn("group flex flex-1 list-none items-center justify-center gap-1", className),
16462
+ className: cn(
16463
+ "group flex flex-1 list-none items-center justify-center gap-1",
16464
+ "flex items-center justify-start border-b whitespace-nowrap [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
16465
+ // border color
16466
+ "border-gray-200 dark:border-gray-800",
16467
+ className
16468
+ ),
16462
16469
  ...props
16463
16470
  }
16464
16471
  );
@@ -16477,7 +16484,7 @@ function NavigationMenuItem({
16477
16484
  );
16478
16485
  }
16479
16486
  var navigationMenuTriggerStyle = classVarianceAuthority.cva(
16480
- "group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium hover:bg-primary-800/10 hover:text-accent-foreground focus:bg-primary-800/10 focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-primary-800/10 data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-primary-800/10 data-[state=open]:bg-primary-800/10 focus-visible:ring-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1"
16487
+ "mb-2 group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium hover:bg-primary-800/10 hover:text-accent-foreground focus:bg-primary-800/10 focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-primary-800/10 data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-primary-800/10 data-[state=open]:bg-primary-800/10 focus-visible:ring-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1"
16481
16488
  );
16482
16489
  function NavigationMenuTrigger({
16483
16490
  className,
@@ -16496,7 +16503,7 @@ function NavigationMenuTrigger({
16496
16503
  /* @__PURE__ */ jsxRuntime.jsx(
16497
16504
  Icons.chevron_down,
16498
16505
  {
16499
- className: "relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180",
16506
+ className: "relative top-[1px] ml-1 size-5 transition duration-300 group-data-[state=open]:rotate-180",
16500
16507
  "aria-hidden": "true"
16501
16508
  }
16502
16509
  )
@@ -24149,6 +24156,319 @@ function SidebarMenuSubButton({
24149
24156
  }
24150
24157
  );
24151
24158
  }
24159
+ function DataTablePagination({ table }) {
24160
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-2", children: [
24161
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-muted-foreground flex-1 text-sm", children: [
24162
+ table.getFilteredSelectedRowModel().rows.length,
24163
+ " of",
24164
+ " ",
24165
+ table.getFilteredRowModel().rows.length,
24166
+ " row(s) selected."
24167
+ ] }),
24168
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-6 lg:space-x-8", children: [
24169
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
24170
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "flex-1 text-sm font-medium", children: "Rows per page" }),
24171
+ /* @__PURE__ */ jsxRuntime.jsxs(
24172
+ Select,
24173
+ {
24174
+ value: `${table.getState().pagination.pageSize}`,
24175
+ onValueChange: (value) => {
24176
+ table.setPageSize(Number(value));
24177
+ },
24178
+ children: [
24179
+ /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-[80px]", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: table.getState().pagination.pageSize }) }),
24180
+ /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { side: "top", children: [10, 20, 30, 40, 50].map((pageSize) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize)) })
24181
+ ]
24182
+ }
24183
+ )
24184
+ ] }),
24185
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: [
24186
+ "Page ",
24187
+ table.getState().pagination.pageIndex + 1,
24188
+ " of ",
24189
+ table.getPageCount()
24190
+ ] }),
24191
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
24192
+ /* @__PURE__ */ jsxRuntime.jsxs(
24193
+ Button2,
24194
+ {
24195
+ variant: "outline",
24196
+ size: "icon",
24197
+ className: "hidden p-0 lg:flex",
24198
+ onClick: () => table.setPageIndex(0),
24199
+ disabled: !table.getCanPreviousPage(),
24200
+ children: [
24201
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Go to first page" }),
24202
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.chevron_left, {})
24203
+ ]
24204
+ }
24205
+ ),
24206
+ /* @__PURE__ */ jsxRuntime.jsxs(
24207
+ Button2,
24208
+ {
24209
+ variant: "outline",
24210
+ size: "icon",
24211
+ className: "p-0",
24212
+ onClick: () => table.previousPage(),
24213
+ disabled: !table.getCanPreviousPage(),
24214
+ children: [
24215
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Go to previous page" }),
24216
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.chevron_left, {})
24217
+ ]
24218
+ }
24219
+ ),
24220
+ /* @__PURE__ */ jsxRuntime.jsxs(
24221
+ Button2,
24222
+ {
24223
+ variant: "outline",
24224
+ size: "icon",
24225
+ className: "p-0",
24226
+ onClick: () => table.nextPage(),
24227
+ disabled: !table.getCanNextPage(),
24228
+ children: [
24229
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Go to next page" }),
24230
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.chevron_right, {})
24231
+ ]
24232
+ }
24233
+ ),
24234
+ /* @__PURE__ */ jsxRuntime.jsxs(
24235
+ Button2,
24236
+ {
24237
+ variant: "outline",
24238
+ size: "icon",
24239
+ className: "hidden p-0 lg:flex",
24240
+ onClick: () => table.setPageIndex(table.getPageCount() - 1),
24241
+ disabled: !table.getCanNextPage(),
24242
+ children: [
24243
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Go to last page" }),
24244
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.chevron_right, {})
24245
+ ]
24246
+ }
24247
+ )
24248
+ ] })
24249
+ ] })
24250
+ ] });
24251
+ }
24252
+ function DataTableFacetedFilter({
24253
+ column,
24254
+ title,
24255
+ options
24256
+ }) {
24257
+ const facets = column?.getFacetedUniqueValues();
24258
+ const selectedValues = new Set(column?.getFilterValue());
24259
+ return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
24260
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button2, { variant: "outline", size: "sm", className: "border-dashed", children: [
24261
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.add, {}),
24262
+ title,
24263
+ selectedValues?.size > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
24264
+ /* @__PURE__ */ jsxRuntime.jsx(Separator4, { orientation: "vertical", className: "mx-2 h-4" }),
24265
+ /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "soft", className: "hidden lg:block", children: selectedValues.size }),
24266
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "hidden space-x-1 lg:flex", children: selectedValues.size > 2 ? /* @__PURE__ */ jsxRuntime.jsxs(Badge, { variant: "soft", className: "rounded-sm px-1 font-normal", children: [
24267
+ selectedValues.size,
24268
+ " selected"
24269
+ ] }) : options.filter((option) => selectedValues.has(option.value)).map((option) => /* @__PURE__ */ jsxRuntime.jsx(
24270
+ Badge,
24271
+ {
24272
+ variant: "soft",
24273
+ className: "rounded-sm px-1 font-normal",
24274
+ children: option.label
24275
+ },
24276
+ option.value
24277
+ )) })
24278
+ ] })
24279
+ ] }) }),
24280
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-[200px] p-0", align: "start", children: /* @__PURE__ */ jsxRuntime.jsxs(Command, { children: [
24281
+ /* @__PURE__ */ jsxRuntime.jsx(CommandInput, { placeholder: title }),
24282
+ /* @__PURE__ */ jsxRuntime.jsxs(CommandList, { children: [
24283
+ /* @__PURE__ */ jsxRuntime.jsx(CommandEmpty, { children: "No results found." }),
24284
+ /* @__PURE__ */ jsxRuntime.jsx(CommandGroup, { children: options.map((option) => {
24285
+ const isSelected = selectedValues.has(option.value);
24286
+ return /* @__PURE__ */ jsxRuntime.jsxs(
24287
+ CommandItem,
24288
+ {
24289
+ onSelect: () => {
24290
+ if (isSelected) {
24291
+ selectedValues.delete(option.value);
24292
+ } else {
24293
+ selectedValues.add(option.value);
24294
+ }
24295
+ const filterValues = Array.from(selectedValues);
24296
+ column?.setFilterValue(filterValues.length ? filterValues : void 0);
24297
+ },
24298
+ children: [
24299
+ /* @__PURE__ */ jsxRuntime.jsx(
24300
+ "div",
24301
+ {
24302
+ className: cn(
24303
+ "border-grey-600 mr-2 flex h-4 w-4 items-center justify-center rounded-sm border",
24304
+ isSelected ? "bg-primary-600 border-primary-600 text-primary-foreground" : "opacity-50 [&_svg]:invisible"
24305
+ ),
24306
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icons.check, { className: "text-white" })
24307
+ }
24308
+ ),
24309
+ option.icon && /* @__PURE__ */ jsxRuntime.jsx(option.icon, { className: "text-muted-foreground mr-2 h-4 w-4" }),
24310
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: option.label }),
24311
+ facets?.get(option.value) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs", children: facets.get(option.value) })
24312
+ ]
24313
+ },
24314
+ option.value
24315
+ );
24316
+ }) }),
24317
+ selectedValues.size > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
24318
+ /* @__PURE__ */ jsxRuntime.jsx(CommandSeparator, {}),
24319
+ /* @__PURE__ */ jsxRuntime.jsx(CommandGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(
24320
+ CommandItem,
24321
+ {
24322
+ onSelect: () => column?.setFilterValue(void 0),
24323
+ className: "justify-center text-center",
24324
+ children: "Clear filters"
24325
+ }
24326
+ ) })
24327
+ ] })
24328
+ ] })
24329
+ ] }) })
24330
+ ] });
24331
+ }
24332
+ function DataTableViewOptions({ table }) {
24333
+ return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
24334
+ /* @__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: [
24335
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.tune, {}),
24336
+ "View"
24337
+ ] }) }),
24338
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuContent, { align: "end", className: "nsw:w-[150px]", children: [
24339
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuLabel, { children: "Toggle columns" }),
24340
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
24341
+ table.getAllColumns().filter((column) => typeof column.accessorFn !== "undefined" && column.getCanHide()).map((column) => {
24342
+ return /* @__PURE__ */ jsxRuntime.jsx(
24343
+ DropdownMenuCheckboxItem,
24344
+ {
24345
+ className: "nsw:capitalize",
24346
+ checked: column.getIsVisible(),
24347
+ onCheckedChange: (value) => column.toggleVisibility(!!value),
24348
+ children: column.id
24349
+ },
24350
+ column.id
24351
+ );
24352
+ })
24353
+ ] })
24354
+ ] });
24355
+ }
24356
+ function DataTableToolbar({ search, toolbar, table }) {
24357
+ const isFiltered = table.getState().columnFilters.length > 0;
24358
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
24359
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 items-center space-x-2", children: [
24360
+ /* @__PURE__ */ jsxRuntime.jsx(
24361
+ Input,
24362
+ {
24363
+ type: "search",
24364
+ name: "global-filter",
24365
+ placeholder: search?.placeholder ?? `Filter...`,
24366
+ value: table.getState().globalFilter ?? "",
24367
+ onChange: (event) => table.setGlobalFilter(event.target.value),
24368
+ className: "h-10 w-[184px] lg:w-[280px]"
24369
+ }
24370
+ ),
24371
+ toolbar && toolbar.map((group) => /* @__PURE__ */ jsxRuntime.jsx(
24372
+ DataTableFacetedFilter,
24373
+ {
24374
+ column: table.getColumn(group.id),
24375
+ title: group.title,
24376
+ options: group.values
24377
+ },
24378
+ group.id
24379
+ )),
24380
+ isFiltered && /* @__PURE__ */ jsxRuntime.jsxs(Button2, { variant: "ghost", onClick: () => table.resetColumnFilters(), children: [
24381
+ "Reset",
24382
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.close, {})
24383
+ ] })
24384
+ ] }),
24385
+ /* @__PURE__ */ jsxRuntime.jsx(DataTableViewOptions, { table })
24386
+ ] });
24387
+ }
24388
+ function DataTable({
24389
+ search,
24390
+ toolbar,
24391
+ columns,
24392
+ data
24393
+ }) {
24394
+ const [rowSelection, setRowSelection] = React18__namespace.useState({});
24395
+ const [columnVisibility, setColumnVisibility] = React18__namespace.useState({});
24396
+ const [columnFilters, setColumnFilters] = React18__namespace.useState([]);
24397
+ const [sorting, setSorting] = React18__namespace.useState([]);
24398
+ const [globalFilter, setGlobalFilter] = React18__namespace.useState("");
24399
+ const table = reactTable.useReactTable({
24400
+ data,
24401
+ columns,
24402
+ state: {
24403
+ globalFilter,
24404
+ sorting,
24405
+ columnVisibility,
24406
+ rowSelection,
24407
+ columnFilters
24408
+ },
24409
+ enableRowSelection: true,
24410
+ onRowSelectionChange: setRowSelection,
24411
+ onSortingChange: setSorting,
24412
+ onColumnFiltersChange: setColumnFilters,
24413
+ onColumnVisibilityChange: setColumnVisibility,
24414
+ onGlobalFilterChange: setGlobalFilter,
24415
+ globalFilterFn: "includesString",
24416
+ getCoreRowModel: reactTable.getCoreRowModel(),
24417
+ getFilteredRowModel: reactTable.getFilteredRowModel(),
24418
+ getPaginationRowModel: reactTable.getPaginationRowModel(),
24419
+ getSortedRowModel: reactTable.getSortedRowModel(),
24420
+ getFacetedRowModel: reactTable.getFacetedRowModel(),
24421
+ getFacetedUniqueValues: reactTable.getFacetedUniqueValues()
24422
+ });
24423
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 p-1", children: [
24424
+ /* @__PURE__ */ jsxRuntime.jsx(DataTableToolbar, { table, search, toolbar }),
24425
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
24426
+ /* @__PURE__ */ jsxRuntime.jsx(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: headerGroup.headers.map((header) => {
24427
+ return /* @__PURE__ */ jsxRuntime.jsx(TableHead, { colSpan: header.colSpan, children: header.isPlaceholder ? null : reactTable.flexRender(header.column.columnDef.header, header.getContext()) }, header.id);
24428
+ }) }, headerGroup.id)) }),
24429
+ /* @__PURE__ */ jsxRuntime.jsx(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(
24430
+ TableRow,
24431
+ {
24432
+ "data-state": row.getIsSelected() && "selected",
24433
+ className: "relative",
24434
+ children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(TableCell, { children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))
24435
+ },
24436
+ row.id
24437
+ )) : /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "No results." }) }) })
24438
+ ] }) }),
24439
+ /* @__PURE__ */ jsxRuntime.jsx(DataTablePagination, { table })
24440
+ ] });
24441
+ }
24442
+ function DataTableColumnHeader({
24443
+ column,
24444
+ title,
24445
+ className
24446
+ }) {
24447
+ if (!column.getCanSort()) {
24448
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(className), children: title });
24449
+ }
24450
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex items-center space-x-2", className), children: /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
24451
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button2, { variant: "ghost", size: "sm", className: "data-[state=open]:bg-accent -ml-3", children: [
24452
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: title }),
24453
+ column.getIsSorted() === "desc" ? /* @__PURE__ */ jsxRuntime.jsx(Icons.south, {}) : column.getIsSorted() === "asc" ? /* @__PURE__ */ jsxRuntime.jsx(Icons.north, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icons.unfold_more, {})
24454
+ ] }) }),
24455
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuContent, { align: "start", children: [
24456
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { onClick: () => column.toggleSorting(false), children: [
24457
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.south, { className: "text-muted-foreground/70 h-3.5 w-3.5" }),
24458
+ "Asc"
24459
+ ] }),
24460
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { onClick: () => column.toggleSorting(true), children: [
24461
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.north, { className: "text-muted-foreground/70 h-3.5 w-3.5" }),
24462
+ "Desc"
24463
+ ] }),
24464
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
24465
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { onClick: () => column.toggleVisibility(false), children: [
24466
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.eye_off, { className: "text-muted-foreground/70 h-3.5 w-3.5" }),
24467
+ "Hide"
24468
+ ] })
24469
+ ] })
24470
+ ] }) });
24471
+ }
24152
24472
  var useIsomorphicLayoutEffect2 = typeof window !== "undefined" ? React18.useLayoutEffect : React18.useEffect;
24153
24473
  function useDisableToc() {
24154
24474
  const { setToc } = useToc();
@@ -24386,6 +24706,12 @@ exports.ContextMenuSub = ContextMenuSub;
24386
24706
  exports.ContextMenuSubContent = ContextMenuSubContent;
24387
24707
  exports.ContextMenuSubTrigger = ContextMenuSubTrigger;
24388
24708
  exports.ContextMenuTrigger = ContextMenuTrigger;
24709
+ exports.DataTable = DataTable;
24710
+ exports.DataTableColumnHeader = DataTableColumnHeader;
24711
+ exports.DataTableFacetedFilter = DataTableFacetedFilter;
24712
+ exports.DataTablePagination = DataTablePagination;
24713
+ exports.DataTableToolbar = DataTableToolbar;
24714
+ exports.DataTableViewOptions = DataTableViewOptions;
24389
24715
  exports.Description = Description3;
24390
24716
  exports.DescriptionDetails = DescriptionDetails;
24391
24717
  exports.DescriptionList = DescriptionList;