@northslopetech/altitude-ui 3.0.0-alpha.13 → 3.0.0-alpha.14

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
@@ -203,6 +203,7 @@ import { CaretDownIcon as PhosphorCaretDown } from "@phosphor-icons/react/CaretD
203
203
  import { CaretLeftIcon as PhosphorCaretLeft } from "@phosphor-icons/react/CaretLeft";
204
204
  import { CaretRightIcon as PhosphorCaretRight } from "@phosphor-icons/react/CaretRight";
205
205
  import { CaretUpIcon as PhosphorCaretUp } from "@phosphor-icons/react/CaretUp";
206
+ import { ArrowsDownUpIcon as PhosphorArrowsDownUp } from "@phosphor-icons/react/ArrowsDownUp";
206
207
  import { ChatCircleIcon as PhosphorChatCircle } from "@phosphor-icons/react/ChatCircle";
207
208
  import { CheckSquareIcon as PhosphorCheckSquare } from "@phosphor-icons/react/CheckSquare";
208
209
  import { XIcon as PhosphorX } from "@phosphor-icons/react/X";
@@ -284,6 +285,7 @@ var CaretDownIcon = createIcon(PhosphorCaretDown);
284
285
  var CaretLeftIcon = createIcon(PhosphorCaretLeft);
285
286
  var CaretRightIcon = createIcon(PhosphorCaretRight);
286
287
  var CaretUpIcon = createIcon(PhosphorCaretUp);
288
+ var ArrowsDownUpIcon = createIcon(PhosphorArrowsDownUp);
287
289
  var ChatIcon = createIcon(PhosphorChatCircle);
288
290
  var CheckmarkSquareIcon = createIcon(PhosphorCheckSquare);
289
291
  var CloseIcon = createIcon(PhosphorX);
@@ -404,15 +406,75 @@ import { Button as ButtonPrimitive } from "@base-ui/react/button";
404
406
  import { cva as cva3 } from "class-variance-authority";
405
407
  import { jsx as jsx4 } from "react/jsx-runtime";
406
408
  var buttonVariants = cva3(
407
- "inline-flex items-center justify-center gap-2 whitespace-nowrap transition-colors focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
409
+ [
410
+ // Base layout
411
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap",
412
+ // Transitions
413
+ "transition-colors",
414
+ // Focus
415
+ "focus-visible:outline-none",
416
+ // Disabled
417
+ "disabled:pointer-events-none disabled:opacity-50",
418
+ // SVG children
419
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0"
420
+ ],
408
421
  {
409
422
  variants: {
410
423
  variant: {
411
- default: "interactive-default interactive-default-fg border border-default shadow-sm hover:brightness-[90%] dark:hover:brightness-[130%] active:brightness-[80%] dark:active:brightness-[120%] focus-visible:ring-2 focus-visible:ring-focus-default focus-visible:border-strong",
412
- primary: "interactive-accent interactive-accent-fg hover:brightness-[90%] dark:hover:brightness-[130%] active:brightness-[80%] dark:active:brightness-[120%] focus-visible:ring-2 focus-visible:ring-focus-default",
413
- destructive: "interactive-destructive interactive-destructive-fg hover:brightness-[90%] dark:hover:brightness-[130%] active:brightness-[80%] dark:active:brightness-[120%] focus-visible:ring-3 focus-visible:ring-focus-error",
414
- ghost: "interactive-default interactive-default-fg hover:brightness-[90%] dark:hover:brightness-[130%] active:brightness-[80%] dark:active:brightness-[120%] focus-visible:ring-2 focus-visible:ring-focus-default",
415
- link: "h-6 px-0 py-0 rounded-sm text-default underline underline-offset-2 focus-visible:ring-2 focus-visible:ring-focus-default"
424
+ default: [
425
+ // Base
426
+ "interactive-default interactive-default-fg",
427
+ "border border-default shadow-xs",
428
+ // Hover & active
429
+ "hover:brightness-[90%] dark:hover:brightness-[130%]",
430
+ "active:brightness-[80%] dark:active:brightness-[120%]",
431
+ // Focus
432
+ "focus-visible:ring-2 focus-visible:ring-focus-default focus-visible:border-strong"
433
+ ],
434
+ primary: [
435
+ // Base
436
+ "interactive-accent interactive-accent-fg",
437
+ // Hover & active
438
+ "hover:brightness-[90%] dark:hover:brightness-[130%]",
439
+ "active:brightness-[80%] dark:active:brightness-[120%]",
440
+ // Focus
441
+ "focus-visible:ring-2 focus-visible:ring-focus-default"
442
+ ],
443
+ destructive: [
444
+ // Base
445
+ "interactive-destructive interactive-destructive-fg",
446
+ // Hover & active
447
+ "hover:brightness-[90%] dark:hover:brightness-[130%]",
448
+ "active:brightness-[80%] dark:active:brightness-[120%]",
449
+ // Focus
450
+ "focus-visible:ring-3 focus-visible:ring-focus-error"
451
+ ],
452
+ "destructive-subtle": [
453
+ // Base
454
+ "interactive-default text-error shadow-xs",
455
+ "border border-default",
456
+ // Hover & active
457
+ "hover:interactive-hover",
458
+ "active:brightness-[80%] dark:active:brightness-[120%]",
459
+ // Focus
460
+ "focus-visible:ring-3 focus-visible:ring-focus-error"
461
+ ],
462
+ ghost: [
463
+ // Base
464
+ "bg-transparent interactive-default-fg",
465
+ // Hover & active
466
+ "hover:interactive-hover",
467
+ "active:interactive-active",
468
+ // Focus
469
+ "focus-visible:ring-2 focus-visible:ring-focus-default"
470
+ ],
471
+ link: [
472
+ // Base
473
+ "h-6 px-0 py-0 rounded-sm",
474
+ "text-default underline underline-offset-2",
475
+ // Focus
476
+ "focus-visible:ring-2 focus-visible:ring-focus-default"
477
+ ]
416
478
  },
417
479
  size: {
418
480
  default: "h-9 rounded-md px-4 py-2 type-label-sm-medium",
@@ -425,17 +487,26 @@ var buttonVariants = cva3(
425
487
  {
426
488
  variant: "link",
427
489
  size: ["default", "sm"],
428
- className: "type-body-sm-regular hover:type-body-sm-semibold active:type-body-sm-semibold"
490
+ className: [
491
+ "type-body-sm-regular",
492
+ "hover:type-body-sm-semibold active:type-body-sm-semibold"
493
+ ]
429
494
  },
430
495
  {
431
496
  variant: "link",
432
497
  size: "lg",
433
- className: "type-body-md-regular hover:type-body-md-semibold active:type-body-md-semibold"
498
+ className: [
499
+ "type-body-md-regular",
500
+ "hover:type-body-md-semibold active:type-body-md-semibold"
501
+ ]
434
502
  },
435
503
  {
436
504
  variant: "link",
437
505
  size: "mini",
438
- className: "type-body-xs-regular hover:type-body-xs-semibold active:type-body-xs-semibold"
506
+ className: [
507
+ "type-body-xs-regular",
508
+ "hover:type-body-xs-semibold active:type-body-xs-semibold"
509
+ ]
439
510
  }
440
511
  ],
441
512
  defaultVariants: {
@@ -6125,162 +6196,420 @@ function PieChart({
6125
6196
  }
6126
6197
 
6127
6198
  // src/components/ui/table.tsx
6128
- import { useCallback as useCallback8 } from "react";
6199
+ import { jsx as jsx44 } from "react/jsx-runtime";
6200
+ function Table({ className, ref, ...props }) {
6201
+ return /* @__PURE__ */ jsx44(
6202
+ "div",
6203
+ {
6204
+ "data-slot": "table-container",
6205
+ className: "relative w-full overflow-x-auto",
6206
+ children: /* @__PURE__ */ jsx44(
6207
+ "table",
6208
+ {
6209
+ ref,
6210
+ "data-slot": "table",
6211
+ className: cn(
6212
+ // Layout
6213
+ "w-full caption-bottom",
6214
+ className
6215
+ ),
6216
+ ...props
6217
+ }
6218
+ )
6219
+ }
6220
+ );
6221
+ }
6222
+ function TableHeader({
6223
+ className,
6224
+ ref,
6225
+ ...props
6226
+ }) {
6227
+ return /* @__PURE__ */ jsx44(
6228
+ "thead",
6229
+ {
6230
+ ref,
6231
+ "data-slot": "table-header",
6232
+ className: cn(
6233
+ // Surface
6234
+ "surface-secondary",
6235
+ // Border
6236
+ "[&_tr]:border-b [&_tr]:border-default",
6237
+ className
6238
+ ),
6239
+ ...props
6240
+ }
6241
+ );
6242
+ }
6243
+ function TableBody({
6244
+ className,
6245
+ ref,
6246
+ ...props
6247
+ }) {
6248
+ return /* @__PURE__ */ jsx44("tbody", { ref, "data-slot": "table-body", className, ...props });
6249
+ }
6250
+ function TableFooter({
6251
+ className,
6252
+ ref,
6253
+ ...props
6254
+ }) {
6255
+ return /* @__PURE__ */ jsx44(
6256
+ "tfoot",
6257
+ {
6258
+ ref,
6259
+ "data-slot": "table-footer",
6260
+ className: cn(
6261
+ // Surface
6262
+ "surface-secondary",
6263
+ // Border
6264
+ "border-t border-t-[var(--color-border-default)] [&>tr]:last:border-b-0",
6265
+ // Typography — descendant selector overrides TableCell's type-label-md-regular
6266
+ "[&_td]:font-medium",
6267
+ className
6268
+ ),
6269
+ ...props
6270
+ }
6271
+ );
6272
+ }
6273
+ function TableRow({ className, ref, ...props }) {
6274
+ return /* @__PURE__ */ jsx44(
6275
+ "tr",
6276
+ {
6277
+ ref,
6278
+ "data-slot": "table-row",
6279
+ className: cn(
6280
+ // Border
6281
+ "border-b border-default",
6282
+ // Surface & states
6283
+ "hover:interactive-hover data-[state=selected]:bg-[var(--color-surface-secondary)]",
6284
+ // Transition
6285
+ "transition-colors",
6286
+ className
6287
+ ),
6288
+ ...props
6289
+ }
6290
+ );
6291
+ }
6292
+ function TableHead({
6293
+ className,
6294
+ ref,
6295
+ align = "left",
6296
+ ...props
6297
+ }) {
6298
+ return /* @__PURE__ */ jsx44(
6299
+ "th",
6300
+ {
6301
+ ref,
6302
+ scope: "col",
6303
+ "data-slot": "table-head",
6304
+ className: cn(
6305
+ // Layout
6306
+ "h-8 px-2 align-middle gap-2",
6307
+ // Alignment
6308
+ align === "right" && "text-right",
6309
+ align === "left" && "text-left",
6310
+ // Typography
6311
+ "text-default type-body-sm-medium whitespace-nowrap",
6312
+ // Checkbox alignment
6313
+ "[&:has([role=checkbox])]:pr-0",
6314
+ className
6315
+ ),
6316
+ ...props
6317
+ }
6318
+ );
6319
+ }
6320
+ function TableCell({
6321
+ className,
6322
+ ref,
6323
+ align = "left",
6324
+ ...props
6325
+ }) {
6326
+ return /* @__PURE__ */ jsx44(
6327
+ "td",
6328
+ {
6329
+ ref,
6330
+ "data-slot": "table-cell",
6331
+ className: cn(
6332
+ // Layout
6333
+ "h-8 p-2 align-middle gap-2",
6334
+ // Alignment
6335
+ align === "right" && "text-right",
6336
+ align === "left" && "text-left",
6337
+ // Typography
6338
+ "text-default type-body-sm-regular whitespace-nowrap",
6339
+ // Checkbox alignment
6340
+ "[&:has([role=checkbox])]:pr-0",
6341
+ className
6342
+ ),
6343
+ ...props
6344
+ }
6345
+ );
6346
+ }
6347
+ function TableCaption({
6348
+ className,
6349
+ ref,
6350
+ ...props
6351
+ }) {
6352
+ return /* @__PURE__ */ jsx44(
6353
+ "caption",
6354
+ {
6355
+ ref,
6356
+ "data-slot": "table-caption",
6357
+ className: cn(
6358
+ // Layout
6359
+ "mt-4",
6360
+ // Typography
6361
+ "text-secondary type-body-sm-regular",
6362
+ className
6363
+ ),
6364
+ ...props
6365
+ }
6366
+ );
6367
+ }
6368
+
6369
+ // src/components/ui/data-table/data-table-view.tsx
6129
6370
  import {
6130
6371
  flexRender
6131
6372
  } from "@tanstack/react-table";
6132
- import { Fragment as Fragment3, jsx as jsx44, jsxs as jsxs24 } from "react/jsx-runtime";
6133
- function Table({
6373
+ import { jsx as jsx45, jsxs as jsxs24 } from "react/jsx-runtime";
6374
+ function DataTableView({
6134
6375
  table,
6376
+ emptyState = "No results.",
6377
+ loading = false,
6378
+ getRowProps,
6135
6379
  className,
6136
- showPagination = false,
6137
- paginationClassName
6380
+ ...props
6138
6381
  }) {
6139
- const currentPage = table.getState().pagination.pageIndex;
6140
- const pageSize = table.getState().pagination.pageSize;
6141
- const totalPages = table.getPageCount();
6142
- const totalRows = table.getFilteredRowModel().rows.length;
6143
- const showingText = totalRows > 0 ? "Showing " + (currentPage * pageSize + 1) + "-" + Math.min((currentPage + 1) * pageSize, totalRows) + " of " + totalRows + " results" : "No results found";
6144
- const handlePreviousPage = useCallback8(() => {
6145
- table.previousPage();
6146
- }, [table]);
6147
- const handleNextPage = useCallback8(() => {
6148
- table.nextPage();
6149
- }, [table]);
6150
- const handlePageChange = useCallback8(
6151
- (pageIndex) => {
6152
- table.setPageIndex(pageIndex);
6153
- },
6154
- [table]
6382
+ return /* @__PURE__ */ jsx45(
6383
+ "div",
6384
+ {
6385
+ className: cn("relative", loading && "opacity-50 pointer-events-none"),
6386
+ "aria-busy": loading || void 0,
6387
+ children: /* @__PURE__ */ jsxs24(Table, { className, ...props, children: [
6388
+ /* @__PURE__ */ jsx45(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx45(TableRow, { children: headerGroup.headers.map((header) => {
6389
+ const sorted = header.column.getIsSorted();
6390
+ return /* @__PURE__ */ jsx45(
6391
+ TableHead,
6392
+ {
6393
+ colSpan: header.colSpan,
6394
+ "aria-sort": sorted === "asc" ? "ascending" : sorted === "desc" ? "descending" : void 0,
6395
+ children: header.isPlaceholder ? null : flexRender(
6396
+ header.column.columnDef.header,
6397
+ header.getContext()
6398
+ )
6399
+ },
6400
+ header.id
6401
+ );
6402
+ }) }, headerGroup.id)) }),
6403
+ /* @__PURE__ */ jsx45(TableBody, { children: table.getRowModel().rows.length > 0 ? table.getRowModel().rows.map((row) => {
6404
+ const rowProps = getRowProps?.(row);
6405
+ return /* @__PURE__ */ jsx45(
6406
+ TableRow,
6407
+ {
6408
+ "data-state": row.getIsSelected() ? "selected" : void 0,
6409
+ ...rowProps,
6410
+ children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx45(TableCell, { children: flexRender(
6411
+ cell.column.columnDef.cell,
6412
+ cell.getContext()
6413
+ ) }, cell.id))
6414
+ },
6415
+ row.id
6416
+ );
6417
+ }) : /* @__PURE__ */ jsx45(TableRow, { children: /* @__PURE__ */ jsx45(
6418
+ TableCell,
6419
+ {
6420
+ colSpan: table.getVisibleLeafColumns().length,
6421
+ className: "h-24 text-center text-secondary",
6422
+ children: emptyState
6423
+ }
6424
+ ) }) })
6425
+ ] })
6426
+ }
6155
6427
  );
6156
- const handlePageSizeChange = useCallback8(
6157
- (value) => {
6158
- table.setPageSize(Number(value));
6159
- },
6160
- [table]
6428
+ }
6429
+
6430
+ // src/components/ui/data-table/data-table-pagination.tsx
6431
+ import { jsx as jsx46, jsxs as jsxs25 } from "react/jsx-runtime";
6432
+ function DataTablePagination({
6433
+ table,
6434
+ pageSizeOptions = [10, 20, 50, 100],
6435
+ className,
6436
+ ...props
6437
+ }) {
6438
+ const { pageIndex, pageSize } = table.getState().pagination;
6439
+ const totalRows = table.getFilteredRowModel().rows.length;
6440
+ const from = totalRows > 0 ? pageIndex * pageSize + 1 : 0;
6441
+ const to = Math.min((pageIndex + 1) * pageSize, totalRows);
6442
+ const resolvedPageSizeOptions = pageSizeOptions.includes(pageSize) ? pageSizeOptions : [...pageSizeOptions, pageSize].sort((a, b) => a - b);
6443
+ return /* @__PURE__ */ jsxs25(
6444
+ "div",
6445
+ {
6446
+ className: cn(
6447
+ "flex flex-wrap items-center justify-between gap-4 px-2 py-3",
6448
+ className
6449
+ ),
6450
+ ...props,
6451
+ children: [
6452
+ /* @__PURE__ */ jsx46(
6453
+ Text,
6454
+ {
6455
+ variant: "body-sm",
6456
+ className: "text-secondary whitespace-nowrap",
6457
+ "aria-live": "polite",
6458
+ children: totalRows > 0 ? `Showing ${from}\u2013${to} of ${totalRows}` : "No results"
6459
+ }
6460
+ ),
6461
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-1", children: [
6462
+ /* @__PURE__ */ jsx46(
6463
+ Button,
6464
+ {
6465
+ variant: "ghost",
6466
+ size: "sm",
6467
+ onClick: () => table.firstPage(),
6468
+ disabled: !table.getCanPreviousPage(),
6469
+ "aria-label": "Go to first page",
6470
+ children: /* @__PURE__ */ jsx46(ArrowLeftIcon, { "aria-hidden": "true" })
6471
+ }
6472
+ ),
6473
+ /* @__PURE__ */ jsx46(
6474
+ Button,
6475
+ {
6476
+ variant: "ghost",
6477
+ size: "sm",
6478
+ onClick: () => table.previousPage(),
6479
+ disabled: !table.getCanPreviousPage(),
6480
+ "aria-label": "Go to previous page",
6481
+ children: /* @__PURE__ */ jsx46(CaretLeftIcon, { "aria-hidden": "true" })
6482
+ }
6483
+ ),
6484
+ /* @__PURE__ */ jsx46(Text, { as: "span", variant: "body-sm", className: "px-2 whitespace-nowrap", children: table.getPageCount() > 0 ? `Page ${pageIndex + 1} of ${table.getPageCount()}` : "No pages" }),
6485
+ /* @__PURE__ */ jsx46(
6486
+ Button,
6487
+ {
6488
+ variant: "ghost",
6489
+ size: "sm",
6490
+ onClick: () => table.nextPage(),
6491
+ disabled: !table.getCanNextPage(),
6492
+ "aria-label": "Go to next page",
6493
+ children: /* @__PURE__ */ jsx46(CaretRightIcon, { "aria-hidden": "true" })
6494
+ }
6495
+ ),
6496
+ /* @__PURE__ */ jsx46(
6497
+ Button,
6498
+ {
6499
+ variant: "ghost",
6500
+ size: "sm",
6501
+ onClick: () => table.lastPage(),
6502
+ disabled: !table.getCanNextPage(),
6503
+ "aria-label": "Go to last page",
6504
+ children: /* @__PURE__ */ jsx46(ArrowRightIcon, { "aria-hidden": "true" })
6505
+ }
6506
+ )
6507
+ ] }),
6508
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2", children: [
6509
+ /* @__PURE__ */ jsx46(
6510
+ Text,
6511
+ {
6512
+ as: "span",
6513
+ variant: "body-sm",
6514
+ className: "text-secondary whitespace-nowrap",
6515
+ children: "Rows per page"
6516
+ }
6517
+ ),
6518
+ /* @__PURE__ */ jsxs25(
6519
+ Select,
6520
+ {
6521
+ value: pageSize.toString(),
6522
+ onValueChange: (value) => table.setPageSize(Number(value)),
6523
+ children: [
6524
+ /* @__PURE__ */ jsx46(SelectTrigger, { className: "h-8 w-[70px]", children: /* @__PURE__ */ jsx46(SelectValue, {}) }),
6525
+ /* @__PURE__ */ jsx46(SelectContent, { children: resolvedPageSizeOptions.map((size) => /* @__PURE__ */ jsx46(SelectItem, { value: size.toString(), children: size }, size)) })
6526
+ ]
6527
+ }
6528
+ )
6529
+ ] })
6530
+ ]
6531
+ }
6161
6532
  );
6162
- return /* @__PURE__ */ jsxs24("div", { children: [
6163
- /* @__PURE__ */ jsx44("div", { className: cn("overflow-x-auto", className), children: /* @__PURE__ */ jsxs24("table", { className: "min-w-full divide-y divide-border", children: [
6164
- /* @__PURE__ */ jsx44("thead", { className: "bg-inverse text-inverse", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx44("tr", { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx44("th", { className: "px-6 py-3 text-left", children: /* @__PURE__ */ jsxs24(
6165
- "div",
6166
- {
6167
- className: `flex items-center space-x-1 ${header.column.getCanSort() ? "cursor-pointer select-none" : ""}`,
6168
- onClick: header.column.getToggleSortingHandler(),
6169
- children: [
6170
- /* @__PURE__ */ jsx44(
6171
- Text,
6172
- {
6173
- as: "span",
6174
- variant: "label-xs",
6175
- className: "text-inverse uppercase tracking-wider",
6176
- children: flexRender(
6177
- header.column.columnDef.header,
6178
- header.getContext()
6179
- )
6180
- }
6181
- ),
6182
- header.column.getCanSort() && /* @__PURE__ */ jsxs24("span", { className: "ml-1", children: [
6183
- header.column.getIsSorted() === "asc" && /* @__PURE__ */ jsx44(CaretUpIcon, { className: "text-inverse" }),
6184
- header.column.getIsSorted() === "desc" && /* @__PURE__ */ jsx44(CaretDownIcon, { className: "text-inverse" })
6185
- ] })
6186
- ]
6187
- }
6188
- ) }, header.id)) }, headerGroup.id)) }),
6189
- /* @__PURE__ */ jsx44("tbody", { className: "surface-default divide-y divide-border", children: table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx44("tr", { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx44("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsx44(Text, { variant: "body-sm", children: flexRender(
6190
- cell.column.columnDef.cell,
6191
- cell.getContext()
6192
- ) }) }, cell.id)) }, row.id)) })
6193
- ] }) }),
6194
- showPagination && /* @__PURE__ */ jsxs24(
6195
- "div",
6533
+ }
6534
+
6535
+ // src/components/ui/data-table/data-table-column-header.tsx
6536
+ import { jsx as jsx47, jsxs as jsxs26 } from "react/jsx-runtime";
6537
+ function DataTableColumnHeader({
6538
+ column,
6539
+ title,
6540
+ className,
6541
+ ...props
6542
+ }) {
6543
+ if (!column.getCanSort()) {
6544
+ return /* @__PURE__ */ jsx47(
6545
+ Text,
6196
6546
  {
6197
- className: cn(
6198
- "flex items-center justify-between px-6 py-3 surface-default border-t border-subtle",
6199
- paginationClassName
6200
- ),
6201
- children: [
6202
- /* @__PURE__ */ jsx44("div", { className: "flex items-center", children: /* @__PURE__ */ jsx44(Text, { variant: "body-sm", className: "text-secondary", children: showingText }) }),
6203
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center space-x-1", children: [
6204
- /* @__PURE__ */ jsx44(
6205
- Button,
6206
- {
6207
- variant: "ghost",
6208
- size: "sm",
6209
- onClick: handlePreviousPage,
6210
- disabled: !table.getCanPreviousPage(),
6211
- className: "p-2",
6212
- children: /* @__PURE__ */ jsx44(ArrowLeftIcon, {})
6213
- }
6214
- ),
6215
- Array.from(
6216
- { length: Math.min(5, table.getPageCount()) },
6217
- (_, i) => {
6218
- let pageNumber;
6219
- if (totalPages <= 5) {
6220
- pageNumber = i;
6221
- } else if (currentPage <= 2) {
6222
- pageNumber = i;
6223
- } else if (currentPage >= totalPages - 3) {
6224
- pageNumber = totalPages - 5 + i;
6225
- } else {
6226
- pageNumber = currentPage - 2 + i;
6227
- }
6228
- const isActive = pageNumber === currentPage;
6229
- return /* @__PURE__ */ jsx44(
6230
- Button,
6231
- {
6232
- variant: isActive ? "default" : "ghost",
6233
- size: "sm",
6234
- onClick: () => handlePageChange(pageNumber),
6235
- className: "min-w-8 h-8 p-0",
6236
- children: pageNumber + 1
6237
- },
6238
- pageNumber
6239
- );
6240
- }
6241
- ),
6242
- table.getPageCount() > 5 && currentPage < totalPages - 3 && /* @__PURE__ */ jsxs24(Fragment3, { children: [
6243
- /* @__PURE__ */ jsx44("span", { className: "px-1 text-secondary", children: "..." }),
6244
- /* @__PURE__ */ jsx44(Text, { variant: "body-sm", className: "text-secondary", children: totalPages })
6245
- ] }),
6246
- /* @__PURE__ */ jsx44(
6247
- Button,
6248
- {
6249
- variant: "ghost",
6250
- size: "sm",
6251
- onClick: handleNextPage,
6252
- disabled: !table.getCanNextPage(),
6253
- className: "p-2",
6254
- children: /* @__PURE__ */ jsx44(ArrowRightIcon, {})
6255
- }
6256
- )
6257
- ] }),
6258
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-3 w-48", children: [
6259
- /* @__PURE__ */ jsx44(
6260
- Text,
6261
- {
6262
- variant: "body-sm",
6263
- className: "text-secondary whitespace-nowrap",
6264
- children: "Rows per page:"
6265
- }
6266
- ),
6267
- /* @__PURE__ */ jsxs24(
6268
- Select,
6269
- {
6270
- value: table.getState().pagination.pageSize.toString(),
6271
- onValueChange: handlePageSizeChange,
6272
- children: [
6273
- /* @__PURE__ */ jsx44(SelectTrigger, { className: "min-w-0 h-8", children: /* @__PURE__ */ jsx44(SelectValue, {}) }),
6274
- /* @__PURE__ */ jsx44(SelectContent, { children: [10, 20, 50, 100].map((size) => /* @__PURE__ */ jsx44(SelectItem, { value: size.toString(), children: size }, size)) })
6275
- ]
6276
- }
6277
- )
6278
- ] })
6279
- ]
6547
+ as: "div",
6548
+ variant: "body-sm-medium",
6549
+ className: cn(className),
6550
+ ...props,
6551
+ children: title
6552
+ }
6553
+ );
6554
+ }
6555
+ const sorted = column.getIsSorted();
6556
+ return /* @__PURE__ */ jsxs26("div", { className: cn("flex items-center gap-2", className), ...props, children: [
6557
+ /* @__PURE__ */ jsx47(Text, { as: "span", variant: "body-sm-medium", children: title }),
6558
+ /* @__PURE__ */ jsx47(
6559
+ Button,
6560
+ {
6561
+ variant: "ghost",
6562
+ size: "mini",
6563
+ onClick: () => {
6564
+ setTimeout(() => {
6565
+ column.toggleSorting(sorted === "asc");
6566
+ }, 0);
6567
+ },
6568
+ "aria-label": `Sort by ${title}`,
6569
+ className: "text-secondary",
6570
+ children: sorted === "desc" ? /* @__PURE__ */ jsx47(CaretDownIcon, { "aria-hidden": "true" }) : sorted === "asc" ? /* @__PURE__ */ jsx47(CaretUpIcon, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx47(ArrowsDownUpIcon, { "aria-hidden": "true", size: 16 })
6280
6571
  }
6281
6572
  )
6282
6573
  ] });
6283
6574
  }
6575
+
6576
+ // src/components/ui/data-table/data-table-view-options.tsx
6577
+ import { jsx as jsx48, jsxs as jsxs27 } from "react/jsx-runtime";
6578
+ function DataTableViewOptions({
6579
+ table,
6580
+ ...props
6581
+ }) {
6582
+ return /* @__PURE__ */ jsxs27(DropdownMenu, { children: [
6583
+ /* @__PURE__ */ jsx48(
6584
+ DropdownMenuTrigger,
6585
+ {
6586
+ render: /* @__PURE__ */ jsx48(
6587
+ Button,
6588
+ {
6589
+ variant: "ghost",
6590
+ size: "sm",
6591
+ ...props,
6592
+ "aria-label": "Table options",
6593
+ children: /* @__PURE__ */ jsx48(CogIcon, { "aria-hidden": "true" })
6594
+ }
6595
+ )
6596
+ }
6597
+ ),
6598
+ /* @__PURE__ */ jsxs27(DropdownMenuContent, { align: "end", children: [
6599
+ /* @__PURE__ */ jsx48(DropdownMenuLabel, { children: "Toggle columns" }),
6600
+ /* @__PURE__ */ jsx48(DropdownMenuSeparator, {}),
6601
+ table.getAllColumns().filter((column) => column.getCanHide()).map((column) => /* @__PURE__ */ jsx48(
6602
+ DropdownMenuCheckboxItem,
6603
+ {
6604
+ checked: column.getIsVisible(),
6605
+ onCheckedChange: (value) => column.toggleVisibility(!!value),
6606
+ children: typeof column.columnDef.header === "string" ? column.columnDef.header : column.id
6607
+ },
6608
+ column.id
6609
+ ))
6610
+ ] })
6611
+ ] });
6612
+ }
6284
6613
  export {
6285
6614
  Accordion,
6286
6615
  AccordionContent,
@@ -6304,6 +6633,7 @@ export {
6304
6633
  ArrowLeftIcon,
6305
6634
  ArrowRightIcon,
6306
6635
  ArrowUpIcon,
6636
+ ArrowsDownUpIcon,
6307
6637
  Avatar,
6308
6638
  AvatarFallback,
6309
6639
  AvatarGroup,
@@ -6350,6 +6680,10 @@ export {
6350
6680
  CloseIcon,
6351
6681
  CogIcon,
6352
6682
  CredentialsIcon,
6683
+ DataTableColumnHeader,
6684
+ DataTablePagination,
6685
+ DataTableView,
6686
+ DataTableViewOptions,
6353
6687
  DatePicker,
6354
6688
  DatePickerTrigger,
6355
6689
  Dialog,
@@ -6479,7 +6813,14 @@ export {
6479
6813
  StatementIcon,
6480
6814
  Switch,
6481
6815
  Table,
6816
+ TableBody,
6817
+ TableCaption,
6818
+ TableCell,
6819
+ TableFooter,
6820
+ TableHead,
6821
+ TableHeader,
6482
6822
  TableIcon,
6823
+ TableRow,
6483
6824
  Tabs,
6484
6825
  TabsContent,
6485
6826
  TabsList,