@discuss-ds/ui 0.33.0 → 0.35.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.js CHANGED
@@ -39,6 +39,9 @@ var twMerge = extendTailwindMerge({
39
39
  function cn(...inputs) {
40
40
  return twMerge(clsx(inputs));
41
41
  }
42
+ function lengthOutOfRange(text, min, max) {
43
+ return min !== void 0 && text.trim().length < min || max !== void 0 && text.length > max;
44
+ }
42
45
 
43
46
  // src/components/Buttons & Actions/Button.tsx
44
47
  import { jsx } from "react/jsx-runtime";
@@ -1681,6 +1684,7 @@ var InlineEdit = React25.forwardRef(
1681
1684
  const [draft, setDraft] = React25.useState(value);
1682
1685
  const [error, setError] = React25.useState(null);
1683
1686
  const errorId = React25.useId();
1687
+ const limitsVisible = !!showLimits && (!!error || lengthOutOfRange(draft, minLength, maxLength));
1684
1688
  const fieldRef = React25.useRef(null);
1685
1689
  const [scroll, setScroll] = React25.useState(0);
1686
1690
  const [draftMarks, setDraftMarks] = React25.useState([]);
@@ -1737,7 +1741,7 @@ var InlineEdit = React25.forwardRef(
1737
1741
  "div",
1738
1742
  {
1739
1743
  ref,
1740
- className: cn(fill ? "flex w-full min-w-0" : "inline-flex min-w-0 max-w-full", editing && (error || showLimits) && "flex-col gap-1.5", className),
1744
+ className: cn(fill ? "flex w-full min-w-0" : "inline-flex min-w-0 max-w-full", editing && (error || limitsVisible) && "flex-col gap-1.5", className),
1741
1745
  ...props,
1742
1746
  children: editing ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
1743
1747
  /* @__PURE__ */ jsxs18("div", { className: cn("relative flex w-full min-w-0", draftMarks.length > 0 && !question && "rounded-md bg-surface"), children: [
@@ -1758,7 +1762,7 @@ var InlineEdit = React25.forwardRef(
1758
1762
  maxLength,
1759
1763
  "aria-label": ariaLabel,
1760
1764
  "aria-invalid": error ? true : void 0,
1761
- "aria-describedby": error || showLimits ? errorId : void 0,
1765
+ "aria-describedby": error || limitsVisible ? errorId : void 0,
1762
1766
  ...multiline ? { rows: 1 } : { type: "text" },
1763
1767
  className: cn(
1764
1768
  "relative w-full px-3 py-1 outline-none",
@@ -1802,7 +1806,7 @@ var InlineEdit = React25.forwardRef(
1802
1806
  }
1803
1807
  )
1804
1808
  ] }),
1805
- (error || showLimits) && /* @__PURE__ */ jsxs18(
1809
+ (error || limitsVisible) && /* @__PURE__ */ jsxs18(
1806
1810
  "p",
1807
1811
  {
1808
1812
  id: errorId,
@@ -1811,10 +1815,10 @@ var InlineEdit = React25.forwardRef(
1811
1815
  children: [
1812
1816
  /* @__PURE__ */ jsxs18("span", { className: "flex items-start gap-2", children: [
1813
1817
  error && /* @__PURE__ */ jsx26(WarningCircle2, { size: 16, "aria-hidden": true, className: "shrink-0" }),
1814
- showLimits ? limitsText(minLength, maxLength) : error,
1815
- showLimits && error && /* @__PURE__ */ jsx26("span", { className: "sr-only", children: error })
1818
+ limitsVisible ? limitsText(minLength, maxLength) : error,
1819
+ limitsVisible && error && /* @__PURE__ */ jsx26("span", { className: "sr-only", children: error })
1816
1820
  ] }),
1817
- showLimits && /* @__PURE__ */ jsxs18("span", { "aria-hidden": true, className: "shrink-0 tabular-nums", children: [
1821
+ limitsVisible && /* @__PURE__ */ jsxs18("span", { "aria-hidden": true, className: "shrink-0 tabular-nums", children: [
1818
1822
  draft.length,
1819
1823
  maxLength !== void 0 && `/${maxLength}`
1820
1824
  ] })
@@ -3023,7 +3027,7 @@ var QuestionHeader = React42.forwardRef(
3023
3027
  }
3024
3028
  ),
3025
3029
  long && titleRecommendedNote != null && /* @__PURE__ */ jsx43("p", { className: "text-ui-caption text-secondary-muted-foreground", children: titleRecommendedNote }),
3026
- showCounter && titleMinLength === void 0 && /* @__PURE__ */ jsxs30("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
3030
+ showCounter && titleMinLength === void 0 && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ jsxs30("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
3027
3031
  count,
3028
3032
  "/",
3029
3033
  maxLength,
@@ -3217,12 +3221,13 @@ QuestionEditorCard.displayName = "QuestionEditorCard";
3217
3221
 
3218
3222
  // src/components/Question Types/QuestionNavItem.tsx
3219
3223
  import * as React44 from "react";
3220
- import { DotsSixVertical as DotsSixVertical2, Warning as Warning3 } from "@phosphor-icons/react";
3224
+ import { DotsSixVertical as DotsSixVertical2, Warning as Warning3, WarningCircle as WarningCircle4 } from "@phosphor-icons/react";
3221
3225
  import { Slot as Slot3 } from "radix-ui";
3222
3226
  import { jsx as jsx45, jsxs as jsxs32 } from "react/jsx-runtime";
3223
3227
  var QuestionNavItem = React44.forwardRef(
3224
- ({ className, questionType = "select-one", selected, error, asChild, showDragHandle = true, hovered, children, ...props }, ref) => {
3228
+ ({ className, questionType = "select-one", selected, error, warning, asChild, showDragHandle = true, hovered, children, ...props }, ref) => {
3225
3229
  const Comp = asChild ? Slot3.Root : "button";
3230
+ const warn = !error && !!warning;
3226
3231
  return /* @__PURE__ */ jsxs32(
3227
3232
  Comp,
3228
3233
  {
@@ -3232,19 +3237,19 @@ var QuestionNavItem = React44.forwardRef(
3232
3237
  "data-hovered": hovered ? "" : void 0,
3233
3238
  className: cn(
3234
3239
  "group/nav flex h-9.5 w-full max-w-106.5 items-center gap-2 rounded-sm border bg-surface p-2 text-left text-body-small text-surface-foreground transition-colors focus-visible:outline-none",
3235
- error ? ["hover:bg-destructive-soft focus-visible:border-destructive", selected ? "border-destructive" : "border-border"] : [
3240
+ error ? ["hover:bg-destructive-soft focus-visible:border-destructive", selected ? "border-destructive" : "border-border"] : warn ? ["hover:bg-warning-soft focus-visible:border-warning-foreground", selected ? "border-warning-foreground" : "border-border"] : [
3236
3241
  // Hover only changes the fill; the border stays as it is (default grey, or accent when selected).
3237
3242
  "hover:bg-accent-soft focus-visible:border-input-accent",
3238
3243
  selected ? "border-input-accent" : "border-border"
3239
3244
  ],
3240
- hovered && (error ? "bg-destructive-soft" : "bg-accent-soft"),
3245
+ hovered && (error ? "bg-destructive-soft" : warn ? "bg-warning-soft" : "bg-accent-soft"),
3241
3246
  className
3242
3247
  ),
3243
3248
  ...props,
3244
3249
  children: [
3245
3250
  /* @__PURE__ */ jsxs32("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
3246
3251
  showDragHandle && /* @__PURE__ */ jsx45(DotsSixVertical2, { size: 16, className: "hidden group-hover/nav:block group-data-[hovered]/nav:block" }),
3247
- /* @__PURE__ */ jsx45("span", { className: showDragHandle ? "group-hover/nav:hidden group-data-[hovered]/nav:hidden" : void 0, children: error ? /* @__PURE__ */ jsx45(Warning3, { size: 16, className: "text-destructive-foreground" }) : /* @__PURE__ */ jsx45(
3252
+ /* @__PURE__ */ jsx45("span", { className: showDragHandle ? "group-hover/nav:hidden group-data-[hovered]/nav:hidden" : void 0, children: error ? /* @__PURE__ */ jsx45(WarningCircle4, { size: 16, className: "text-destructive-foreground" }) : warn ? /* @__PURE__ */ jsx45(Warning3, { size: 16, className: "text-warning-foreground" }) : /* @__PURE__ */ jsx45(
3248
3253
  QuestionTypeIcon,
3249
3254
  {
3250
3255
  type: questionType,
@@ -3254,7 +3259,8 @@ var QuestionNavItem = React44.forwardRef(
3254
3259
  ) })
3255
3260
  ] }),
3256
3261
  /* @__PURE__ */ jsx45("span", { className: "min-w-0 flex-1 truncate", children }),
3257
- error && /* @__PURE__ */ jsx45("span", { className: "sr-only", children: ", has errors" })
3262
+ error && /* @__PURE__ */ jsx45("span", { className: "sr-only", children: ", has errors" }),
3263
+ warn && /* @__PURE__ */ jsx45("span", { className: "sr-only", children: ", has warnings" })
3258
3264
  ]
3259
3265
  }
3260
3266
  );
@@ -3264,7 +3270,7 @@ QuestionNavItem.displayName = "QuestionNavItem";
3264
3270
 
3265
3271
  // src/components/Question Types/QuestionOption.tsx
3266
3272
  import * as React45 from "react";
3267
- import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as Trash5, WarningCircle as WarningCircle4 } from "@phosphor-icons/react";
3273
+ import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as Trash5, WarningCircle as WarningCircle5 } from "@phosphor-icons/react";
3268
3274
  import { Fragment as Fragment11, jsx as jsx46, jsxs as jsxs33 } from "react/jsx-runtime";
3269
3275
  var optionClasses = "flex w-full max-w-150 cursor-pointer items-center gap-2 rounded-md border border-border bg-surface px-4 py-2 text-body-base text-surface-foreground transition-colors hover:bg-accent-soft hover:shadow-md has-[[data-state=checked]]:border-accent-foreground has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50";
3270
3276
  function QuestionOption(props) {
@@ -3467,7 +3473,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
3467
3473
  (piece, i) => piece.mark ? /* @__PURE__ */ jsx46(MarkedText, { mark: piece.mark, text: piece.text, onApply: onMarkApply, onDismiss: onMarkDismiss }, `${piece.mark.start}:${piece.text}`) : /* @__PURE__ */ jsx46("span", { children: piece.text }, i)
3468
3474
  ) })
3469
3475
  ] }),
3470
- guarded && draft !== null && /* @__PURE__ */ jsxs33(
3476
+ guarded && draft !== null && (error || lengthOutOfRange(draft, minLength, maxLength)) && /* @__PURE__ */ jsxs33(
3471
3477
  "p",
3472
3478
  {
3473
3479
  id: helperId,
@@ -3475,7 +3481,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
3475
3481
  className: cn("flex items-start justify-between gap-2 text-ui-caption", error ? "text-destructive" : "text-secondary-muted-foreground"),
3476
3482
  children: [
3477
3483
  /* @__PURE__ */ jsxs33("span", { className: "flex items-start gap-2", children: [
3478
- error && /* @__PURE__ */ jsx46(WarningCircle4, { size: 16, "aria-hidden": true, className: "shrink-0" }),
3484
+ error && /* @__PURE__ */ jsx46(WarningCircle5, { size: 16, "aria-hidden": true, className: "shrink-0" }),
3479
3485
  limitsText2(minLength, maxLength),
3480
3486
  error && /* @__PURE__ */ jsx46("span", { className: "sr-only", children: error })
3481
3487
  ] }),
@@ -3725,7 +3731,7 @@ var StimulusCard = React48.forwardRef(
3725
3731
  textClassName: "text-body-base"
3726
3732
  }
3727
3733
  ) : /* @__PURE__ */ jsx49("p", { className: "w-full text-body-base [word-break:break-word]", children: caption }),
3728
- onCaptionChange && showCounter && maxLength !== void 0 && /* @__PURE__ */ jsxs36("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
3734
+ onCaptionChange && showCounter && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ jsxs36("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
3729
3735
  count,
3730
3736
  "/",
3731
3737
  maxLength,
@@ -3785,7 +3791,7 @@ import * as React50 from "react";
3785
3791
  import { CaretDown as CaretDown4, CaretUp } from "@phosphor-icons/react";
3786
3792
  import { jsx as jsx51, jsxs as jsxs38 } from "react/jsx-runtime";
3787
3793
  var Table = React50.forwardRef(
3788
- ({ className, containerClassName, striped, ...props }, ref) => /* @__PURE__ */ jsx51("div", { className: cn("relative w-full overflow-auto rounded-lg border border-border bg-surface", containerClassName), children: /* @__PURE__ */ jsx51(
3794
+ ({ className, containerClassName, containerRef, striped, ...props }, ref) => /* @__PURE__ */ jsx51("div", { ref: containerRef, className: cn("relative w-full overflow-auto rounded-lg border border-border bg-surface", containerClassName), children: /* @__PURE__ */ jsx51(
3789
3795
  "table",
3790
3796
  {
3791
3797
  ref,
@@ -3800,6 +3806,10 @@ var TableHeader = React50.forwardRef(
3800
3806
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx51("thead", { ref, className, ...props })
3801
3807
  );
3802
3808
  TableHeader.displayName = "TableHeader";
3809
+ var TableFooter = React50.forwardRef(
3810
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx51("tfoot", { ref, className: cn("border-t border-border bg-background text-ui-label", className), ...props })
3811
+ );
3812
+ TableFooter.displayName = "TableFooter";
3803
3813
  var TableBody = React50.forwardRef(
3804
3814
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx51("tbody", { ref, className, ...props })
3805
3815
  );
@@ -3823,9 +3833,9 @@ var TableRow = React50.forwardRef(
3823
3833
  TableRow.displayName = "TableRow";
3824
3834
  var ariaSort = { none: "none", asc: "ascending", desc: "descending" };
3825
3835
  var TableHead = React50.forwardRef(
3826
- ({ className, align = "left", sortable, sort = "none", onSort, checkbox, children, ...props }, ref) => {
3836
+ ({ className, align = "left", sortable, sort = "none", onSort, checkbox, resizer, children, ...props }, ref) => {
3827
3837
  const caret = sort === "asc" ? /* @__PURE__ */ jsx51(CaretUp, { size: 16, "aria-hidden": true, className: "shrink-0" }) : /* @__PURE__ */ jsx51(CaretDown4, { size: 16, "aria-hidden": true, className: "shrink-0" });
3828
- return /* @__PURE__ */ jsx51(
3838
+ return /* @__PURE__ */ jsxs38(
3829
3839
  "th",
3830
3840
  {
3831
3841
  ref,
@@ -3835,21 +3845,25 @@ var TableHead = React50.forwardRef(
3835
3845
  "h-10 border-b border-border text-ui-label whitespace-nowrap",
3836
3846
  checkbox ? "w-13 px-0 text-center" : "px-4 py-3",
3837
3847
  align === "right" ? "text-right" : "text-left",
3848
+ resizer && "relative",
3838
3849
  className
3839
3850
  ),
3840
3851
  ...props,
3841
- children: sortable ? /* @__PURE__ */ jsxs38(
3842
- "button",
3843
- {
3844
- type: "button",
3845
- onClick: onSort,
3846
- className: cn("inline-flex items-center gap-1 rounded-xs", align === "right" && "flex-row-reverse"),
3847
- children: [
3848
- children,
3849
- caret
3850
- ]
3851
- }
3852
- ) : checkbox ? /* @__PURE__ */ jsx51("div", { className: "flex items-center justify-center", children }) : children
3852
+ children: [
3853
+ sortable ? /* @__PURE__ */ jsxs38(
3854
+ "button",
3855
+ {
3856
+ type: "button",
3857
+ onClick: onSort,
3858
+ className: cn("inline-flex items-center gap-1 rounded-xs", align === "right" && "flex-row-reverse"),
3859
+ children: [
3860
+ children,
3861
+ caret
3862
+ ]
3863
+ }
3864
+ ) : checkbox ? /* @__PURE__ */ jsx51("div", { className: "flex items-center justify-center", children }) : children,
3865
+ resizer
3866
+ ]
3853
3867
  }
3854
3868
  );
3855
3869
  }
@@ -3884,10 +3898,951 @@ function TableCellTwoLines({ primary, secondary, avatar, className, ...props })
3884
3898
  ] });
3885
3899
  }
3886
3900
 
3887
- // src/components/Data Display/StatCard.tsx
3901
+ // src/components/Data Display/DataTable.tsx
3902
+ import * as React52 from "react";
3903
+ import { CaretDown as CaretDown5, CaretRight as CaretRight4, PushPin, PushPinSlash, Rows, Sliders, Stack } from "@phosphor-icons/react";
3904
+ import {
3905
+ aggregationFn_count,
3906
+ aggregationFn_extent,
3907
+ aggregationFn_max,
3908
+ aggregationFn_mean,
3909
+ aggregationFn_median,
3910
+ aggregationFn_min,
3911
+ aggregationFn_sum,
3912
+ aggregationFn_unique,
3913
+ aggregationFn_uniqueCount,
3914
+ cellSelectionFeature,
3915
+ cellSpanningFeature,
3916
+ columnFacetingFeature,
3917
+ columnFilteringFeature,
3918
+ columnGroupingFeature,
3919
+ columnOrderingFeature,
3920
+ columnPinningFeature,
3921
+ columnResizingFeature,
3922
+ columnSizingFeature,
3923
+ columnVisibilityFeature,
3924
+ createExpandedRowModel,
3925
+ createFacetedMinMaxValues,
3926
+ createFacetedRowModel,
3927
+ createFacetedUniqueValues,
3928
+ createFilteredRowModel,
3929
+ createGroupedRowModel,
3930
+ createPaginatedRowModel,
3931
+ createSortedRowModel,
3932
+ filterFn_arrIncludesSome,
3933
+ filterFn_equals,
3934
+ filterFn_equalsString,
3935
+ filterFn_inNumberRange,
3936
+ filterFn_includesString,
3937
+ flexRender,
3938
+ globalFilteringFeature,
3939
+ rowAggregationFeature,
3940
+ rowExpandingFeature,
3941
+ rowPaginationFeature,
3942
+ rowPinningFeature,
3943
+ rowSelectionFeature,
3944
+ rowSortingFeature,
3945
+ sortFn_alphanumeric,
3946
+ sortFn_basic,
3947
+ sortFn_datetime,
3948
+ sortFn_text,
3949
+ tableFeatures,
3950
+ useTable
3951
+ } from "@tanstack/react-table";
3952
+ import { useVirtualizer } from "@tanstack/react-virtual";
3953
+
3954
+ // src/components/Utility/Pagination.tsx
3888
3955
  import * as React51 from "react";
3889
- import { cva as cva6 } from "class-variance-authority";
3956
+ import { ArrowLeft, ArrowRight, DotsThree as DotsThree2 } from "@phosphor-icons/react";
3890
3957
  import { jsx as jsx52, jsxs as jsxs39 } from "react/jsx-runtime";
3958
+ function getPaginationItems(page, pageCount, siblings = 1) {
3959
+ const keep = /* @__PURE__ */ new Set([1, pageCount]);
3960
+ for (let p = page - siblings; p <= page + siblings; p++) if (p >= 1 && p <= pageCount) keep.add(p);
3961
+ const sorted = [...keep].sort((a, b) => a - b);
3962
+ const items = [];
3963
+ sorted.forEach((p, index) => {
3964
+ const previous = sorted[index - 1];
3965
+ if (previous !== void 0 && p - previous === 2) items.push(previous + 1);
3966
+ else if (previous !== void 0 && p - previous > 2) items.push("ellipsis");
3967
+ items.push(p);
3968
+ });
3969
+ return items;
3970
+ }
3971
+ var Pagination = React51.forwardRef(
3972
+ ({ className, page, pageCount, onPageChange, variant = "full", siblings = 1, ...props }, ref) => {
3973
+ const go = (next2) => onPageChange(Math.min(pageCount, Math.max(1, next2)));
3974
+ const previous = /* @__PURE__ */ jsx52(
3975
+ Button,
3976
+ {
3977
+ type: "button",
3978
+ variant: "outline",
3979
+ size: "icon-sm",
3980
+ "aria-label": "Previous page",
3981
+ disabled: page <= 1,
3982
+ onClick: () => go(page - 1),
3983
+ children: /* @__PURE__ */ jsx52(ArrowLeft, { size: 16, "aria-hidden": true })
3984
+ }
3985
+ );
3986
+ const next = /* @__PURE__ */ jsx52(
3987
+ Button,
3988
+ {
3989
+ type: "button",
3990
+ variant: "outline",
3991
+ size: "icon-sm",
3992
+ "aria-label": "Next page",
3993
+ disabled: page >= pageCount,
3994
+ onClick: () => go(page + 1),
3995
+ children: /* @__PURE__ */ jsx52(ArrowRight, { size: 16, "aria-hidden": true })
3996
+ }
3997
+ );
3998
+ return /* @__PURE__ */ jsxs39(
3999
+ "nav",
4000
+ {
4001
+ ref,
4002
+ "aria-label": "Pagination",
4003
+ className: cn("flex items-center", variant === "compact" ? "w-35 justify-between" : "gap-2", className),
4004
+ ...props,
4005
+ children: [
4006
+ previous,
4007
+ variant === "compact" ? /* @__PURE__ */ jsxs39("span", { className: "text-body-small text-surface-foreground", "aria-live": "polite", children: [
4008
+ page,
4009
+ "/",
4010
+ pageCount
4011
+ ] }) : /* @__PURE__ */ jsx52("ul", { className: "flex items-center gap-2", children: getPaginationItems(page, pageCount, siblings).map((item, index) => /* @__PURE__ */ jsx52("li", { children: item === "ellipsis" ? /* @__PURE__ */ jsxs39("span", { className: "inline-flex size-8 items-center justify-center rounded-sm border border-border bg-surface text-surface-foreground", children: [
4012
+ /* @__PURE__ */ jsx52(DotsThree2, { size: 16, "aria-hidden": true }),
4013
+ /* @__PURE__ */ jsx52("span", { className: "sr-only", children: "More pages" })
4014
+ ] }) : /* @__PURE__ */ jsx52(
4015
+ Button,
4016
+ {
4017
+ type: "button",
4018
+ variant: item === page ? "subtle" : "outline",
4019
+ size: "sm",
4020
+ "aria-label": `Page ${item}`,
4021
+ "aria-current": item === page ? "page" : void 0,
4022
+ onClick: () => go(item),
4023
+ children: item
4024
+ }
4025
+ ) }, item === "ellipsis" ? `ellipsis-${index}` : item)) }),
4026
+ next
4027
+ ]
4028
+ }
4029
+ );
4030
+ }
4031
+ );
4032
+ Pagination.displayName = "Pagination";
4033
+
4034
+ // src/components/Data Display/DataTable.tsx
4035
+ import { Fragment as Fragment14, jsx as jsx53, jsxs as jsxs40 } from "react/jsx-runtime";
4036
+ var features = tableFeatures({
4037
+ rowSortingFeature,
4038
+ rowPaginationFeature,
4039
+ rowSelectionFeature,
4040
+ rowExpandingFeature,
4041
+ rowPinningFeature,
4042
+ rowAggregationFeature,
4043
+ columnVisibilityFeature,
4044
+ columnOrderingFeature,
4045
+ columnPinningFeature,
4046
+ columnSizingFeature,
4047
+ columnResizingFeature,
4048
+ columnFilteringFeature,
4049
+ globalFilteringFeature,
4050
+ columnFacetingFeature,
4051
+ columnGroupingFeature,
4052
+ cellSelectionFeature,
4053
+ cellSpanningFeature,
4054
+ // Row-model pipeline order: filter → group → sort → expand → paginate.
4055
+ facetedRowModel: createFacetedRowModel(),
4056
+ facetedUniqueValues: createFacetedUniqueValues(),
4057
+ facetedMinMaxValues: createFacetedMinMaxValues(),
4058
+ filteredRowModel: createFilteredRowModel(),
4059
+ groupedRowModel: createGroupedRowModel(),
4060
+ sortedRowModel: createSortedRowModel(),
4061
+ expandedRowModel: createExpandedRowModel(),
4062
+ paginatedRowModel: createPaginatedRowModel(),
4063
+ sortFns: {
4064
+ alphanumeric: sortFn_alphanumeric,
4065
+ basic: sortFn_basic,
4066
+ datetime: sortFn_datetime,
4067
+ text: sortFn_text
4068
+ },
4069
+ filterFns: {
4070
+ arrIncludesSome: filterFn_arrIncludesSome,
4071
+ equals: filterFn_equals,
4072
+ equalsString: filterFn_equalsString,
4073
+ includesString: filterFn_includesString,
4074
+ inNumberRange: filterFn_inNumberRange
4075
+ },
4076
+ aggregationFns: {
4077
+ count: aggregationFn_count,
4078
+ extent: aggregationFn_extent,
4079
+ max: aggregationFn_max,
4080
+ mean: aggregationFn_mean,
4081
+ median: aggregationFn_median,
4082
+ min: aggregationFn_min,
4083
+ sum: aggregationFn_sum,
4084
+ unique: aggregationFn_unique,
4085
+ uniqueCount: aggregationFn_uniqueCount
4086
+ }
4087
+ });
4088
+ var getMeta = (meta) => meta ?? {};
4089
+ function useControllable(value, initial, onChange) {
4090
+ const [internal, setInternal] = React52.useState(initial);
4091
+ const current = value ?? internal;
4092
+ const update = React52.useCallback(
4093
+ (updater) => {
4094
+ const next = typeof updater === "function" ? updater(current) : updater;
4095
+ if (value === void 0) setInternal(next);
4096
+ onChange?.(next);
4097
+ },
4098
+ [current, value, onChange]
4099
+ );
4100
+ return [current, update];
4101
+ }
4102
+ var ALL = "__all__";
4103
+ var labelOf = (column) => getMeta(column.columnDef.meta).label ?? (typeof column.columnDef.header === "string" ? column.columnDef.header : column.id);
4104
+ function pinning(column, sized, header = false) {
4105
+ const side = column.getIsPinned();
4106
+ const style = {};
4107
+ if (sized) {
4108
+ style.width = column.getSize();
4109
+ style.minWidth = column.getSize();
4110
+ style.maxWidth = column.getSize();
4111
+ }
4112
+ if (side) {
4113
+ style.position = "sticky";
4114
+ if (side === "start") style.insetInlineStart = column.getStart("start");
4115
+ else style.insetInlineEnd = column.getAfter("end");
4116
+ }
4117
+ const className = side ? cn(
4118
+ header ? "z-30" : "z-10",
4119
+ "bg-surface",
4120
+ side === "start" && column.getIsLastColumn("start") && "border-r border-border",
4121
+ side === "end" && column.getIsFirstColumn("end") && "border-l border-border"
4122
+ ) : void 0;
4123
+ return { style, className };
4124
+ }
4125
+ function ColumnFilter({ column }) {
4126
+ const variant = getMeta(column.columnDef.meta).filterVariant ?? "text";
4127
+ const label = labelOf(column);
4128
+ const value = column.getFilterValue();
4129
+ if (variant === "select") {
4130
+ const options = [...column.getFacetedUniqueValues().entries()].sort((a, b) => String(a[0]).localeCompare(String(b[0])));
4131
+ return /* @__PURE__ */ jsxs40(
4132
+ Select,
4133
+ {
4134
+ value: typeof value === "string" ? value : ALL,
4135
+ onValueChange: (next) => column.setFilterValue(next === ALL ? void 0 : next),
4136
+ children: [
4137
+ /* @__PURE__ */ jsx53(SelectTrigger, { "aria-label": `Filter ${label}`, className: "h-8 text-body-small", children: /* @__PURE__ */ jsx53(SelectValue, {}) }),
4138
+ /* @__PURE__ */ jsxs40(SelectContent, { children: [
4139
+ /* @__PURE__ */ jsx53(SelectItem, { value: ALL, children: "All" }),
4140
+ options.map(([option, count]) => /* @__PURE__ */ jsxs40(SelectItem, { value: String(option), children: [
4141
+ String(option),
4142
+ " (",
4143
+ count,
4144
+ ")"
4145
+ ] }, String(option)))
4146
+ ] })
4147
+ ]
4148
+ }
4149
+ );
4150
+ }
4151
+ if (variant === "range") {
4152
+ const [min, max] = column.getFacetedMinMaxValues() ?? [];
4153
+ const range = Array.isArray(value) ? value : [];
4154
+ const update = (index, raw) => {
4155
+ const next = [range[0], range[1]];
4156
+ next[index] = raw === "" ? void 0 : Number(raw);
4157
+ column.setFilterValue(next[0] === void 0 && next[1] === void 0 ? void 0 : next);
4158
+ };
4159
+ return /* @__PURE__ */ jsxs40("div", { className: "flex gap-1", children: [
4160
+ /* @__PURE__ */ jsx53(
4161
+ Input,
4162
+ {
4163
+ type: "number",
4164
+ "aria-label": `${label} minimum`,
4165
+ placeholder: min !== void 0 ? String(min) : "Min",
4166
+ value: range[0] ?? "",
4167
+ onChange: (event) => update(0, event.target.value),
4168
+ className: "h-8 text-body-small"
4169
+ }
4170
+ ),
4171
+ /* @__PURE__ */ jsx53(
4172
+ Input,
4173
+ {
4174
+ type: "number",
4175
+ "aria-label": `${label} maximum`,
4176
+ placeholder: max !== void 0 ? String(max) : "Max",
4177
+ value: range[1] ?? "",
4178
+ onChange: (event) => update(1, event.target.value),
4179
+ className: "h-8 text-body-small"
4180
+ }
4181
+ )
4182
+ ] });
4183
+ }
4184
+ return /* @__PURE__ */ jsx53(
4185
+ Input,
4186
+ {
4187
+ "aria-label": `Filter ${label}`,
4188
+ placeholder: "Filter\u2026",
4189
+ value: typeof value === "string" ? value : "",
4190
+ onChange: (event) => column.setFilterValue(event.target.value || void 0),
4191
+ className: "h-8 text-body-small"
4192
+ }
4193
+ );
4194
+ }
4195
+ function EditableCell({ value, label, type, onCommit }) {
4196
+ const initial = value == null ? "" : String(value);
4197
+ const [draft, setDraft] = React52.useState(null);
4198
+ const cancelled = React52.useRef(false);
4199
+ return /* @__PURE__ */ jsx53(
4200
+ Input,
4201
+ {
4202
+ type,
4203
+ "aria-label": label,
4204
+ value: draft ?? initial,
4205
+ onChange: (event) => setDraft(event.target.value),
4206
+ onBlur: () => {
4207
+ if (!cancelled.current && draft !== null && draft !== initial) onCommit(draft);
4208
+ cancelled.current = false;
4209
+ setDraft(null);
4210
+ },
4211
+ onKeyDown: (event) => {
4212
+ if (event.key === "Enter") event.currentTarget.blur();
4213
+ if (event.key === "Escape") {
4214
+ cancelled.current = true;
4215
+ event.currentTarget.blur();
4216
+ }
4217
+ },
4218
+ className: cn("h-8 border-transparent bg-transparent text-body-small", type === "number" && "text-right")
4219
+ }
4220
+ );
4221
+ }
4222
+ function DataTableInner({
4223
+ columns,
4224
+ data,
4225
+ getRowId,
4226
+ initialState,
4227
+ enableSorting = false,
4228
+ enableRowSelection = false,
4229
+ enableColumnVisibility = false,
4230
+ enableColumnPinning = false,
4231
+ enableColumnSizing = false,
4232
+ enableColumnResizing = false,
4233
+ columnResizeMode = "onChange",
4234
+ enableColumnOrdering = false,
4235
+ enableColumnFilters = false,
4236
+ enableGlobalFilter = false,
4237
+ globalFilterPlaceholder = "Search",
4238
+ enableGrouping = false,
4239
+ enableExpanding = false,
4240
+ enableRowPinning = false,
4241
+ enableCellSelection = false,
4242
+ showFooter = false,
4243
+ enableDensityToggle = false,
4244
+ density: densityProp,
4245
+ onDensityChange,
4246
+ getSubRows,
4247
+ getRowCanExpand,
4248
+ renderSubComponent,
4249
+ pageSize = 10,
4250
+ serverSide = false,
4251
+ rowCount,
4252
+ sorting: sortingProp,
4253
+ onSortingChange,
4254
+ rowSelection: rowSelectionProp,
4255
+ onRowSelectionChange,
4256
+ pagination: paginationProp,
4257
+ onPaginationChange,
4258
+ columnVisibility: columnVisibilityProp,
4259
+ onColumnVisibilityChange,
4260
+ columnPinning: columnPinningProp,
4261
+ onColumnPinningChange,
4262
+ columnOrder: columnOrderProp,
4263
+ onColumnOrderChange,
4264
+ columnFilters: columnFiltersProp,
4265
+ onColumnFiltersChange,
4266
+ globalFilter: globalFilterProp,
4267
+ onGlobalFilterChange,
4268
+ grouping: groupingProp,
4269
+ onGroupingChange,
4270
+ expanded: expandedProp,
4271
+ onExpandedChange,
4272
+ rowPinning: rowPinningProp,
4273
+ onRowPinningChange,
4274
+ onCellSelectionChange,
4275
+ onCellEdit,
4276
+ virtualized = false,
4277
+ estimateRowHeight = 40,
4278
+ onLoadMore,
4279
+ hasMore = false,
4280
+ loadingMore = false,
4281
+ stickyHeader,
4282
+ loading = false,
4283
+ emptyState,
4284
+ onRowClick,
4285
+ toolbar,
4286
+ wrapperClassName,
4287
+ striped,
4288
+ containerClassName,
4289
+ containerRef,
4290
+ style: tableStyle,
4291
+ ...tableProps
4292
+ }, ref) {
4293
+ const [sorting, setSorting] = useControllable(sortingProp, initialState?.sorting ?? [], onSortingChange);
4294
+ const [rowSelection, setRowSelection] = useControllable(
4295
+ rowSelectionProp,
4296
+ initialState?.rowSelection ?? {},
4297
+ onRowSelectionChange
4298
+ );
4299
+ const [columnVisibility, setColumnVisibility] = useControllable(
4300
+ columnVisibilityProp,
4301
+ initialState?.columnVisibility ?? {},
4302
+ onColumnVisibilityChange
4303
+ );
4304
+ const [columnPinning, setColumnPinning] = useControllable(
4305
+ columnPinningProp,
4306
+ { start: initialState?.columnPinning?.start ?? [], end: initialState?.columnPinning?.end ?? [] },
4307
+ onColumnPinningChange
4308
+ );
4309
+ const [columnOrder, setColumnOrder] = useControllable(
4310
+ columnOrderProp,
4311
+ initialState?.columnOrder ?? [],
4312
+ onColumnOrderChange
4313
+ );
4314
+ const [columnFilters, setColumnFilters] = useControllable(
4315
+ columnFiltersProp,
4316
+ initialState?.columnFilters ?? [],
4317
+ onColumnFiltersChange
4318
+ );
4319
+ const [globalFilter, setGlobalFilter] = useControllable(
4320
+ globalFilterProp,
4321
+ initialState?.globalFilter ?? "",
4322
+ onGlobalFilterChange
4323
+ );
4324
+ const [grouping, setGrouping] = useControllable(groupingProp, initialState?.grouping ?? [], onGroupingChange);
4325
+ const [expanded, setExpanded] = useControllable(expandedProp, initialState?.expanded ?? {}, onExpandedChange);
4326
+ const [rowPinning, setRowPinning] = useControllable(
4327
+ rowPinningProp,
4328
+ { top: initialState?.rowPinning?.top ?? [], bottom: initialState?.rowPinning?.bottom ?? [] },
4329
+ onRowPinningChange
4330
+ );
4331
+ const [pagination, setPagination] = useControllable(
4332
+ paginationProp,
4333
+ initialState?.pagination ?? { pageIndex: 0, pageSize },
4334
+ onPaginationChange
4335
+ );
4336
+ const [density, setDensity] = useControllable(densityProp, "default", onDensityChange);
4337
+ const [cellSelection, setCellSelection] = React52.useState([]);
4338
+ const infinite = Boolean(onLoadMore);
4339
+ const paginate = !virtualized && !infinite;
4340
+ const compact = density === "compact";
4341
+ const sized = enableColumnSizing || enableColumnResizing || enableColumnPinning;
4342
+ const sticky = stickyHeader ?? (enableRowPinning || virtualized);
4343
+ const table = useTable({
4344
+ features,
4345
+ columns,
4346
+ data,
4347
+ getRowId,
4348
+ getSubRows,
4349
+ getRowCanExpand: getRowCanExpand ?? (renderSubComponent ? () => true : void 0),
4350
+ enableSorting,
4351
+ enableRowSelection,
4352
+ enableColumnResizing,
4353
+ enableColumnPinning,
4354
+ enableColumnFilters,
4355
+ enableGlobalFilter,
4356
+ enableGrouping,
4357
+ enableRowPinning,
4358
+ enableCellSelection,
4359
+ columnResizeMode,
4360
+ globalFilterFn: "includesString",
4361
+ manualSorting: serverSide,
4362
+ manualFiltering: serverSide,
4363
+ manualPagination: serverSide || !paginate,
4364
+ rowCount: serverSide ? rowCount : void 0,
4365
+ autoResetPageIndex: !serverSide,
4366
+ state: {
4367
+ sorting,
4368
+ rowSelection,
4369
+ columnVisibility,
4370
+ columnPinning,
4371
+ columnOrder,
4372
+ columnFilters,
4373
+ globalFilter,
4374
+ grouping,
4375
+ expanded,
4376
+ rowPinning,
4377
+ cellSelection,
4378
+ pagination: { ...pagination, pageSize: paginationProp ? pagination.pageSize : pageSize }
4379
+ },
4380
+ onSortingChange: setSorting,
4381
+ onRowSelectionChange: setRowSelection,
4382
+ onColumnVisibilityChange: setColumnVisibility,
4383
+ onColumnPinningChange: setColumnPinning,
4384
+ onColumnOrderChange: setColumnOrder,
4385
+ onColumnFiltersChange: setColumnFilters,
4386
+ onGlobalFilterChange: setGlobalFilter,
4387
+ onGroupingChange: setGrouping,
4388
+ onExpandedChange: setExpanded,
4389
+ onRowPinningChange: setRowPinning,
4390
+ onCellSelectionChange: (updater) => {
4391
+ const next = typeof updater === "function" ? updater(cellSelection) : updater;
4392
+ setCellSelection(next);
4393
+ onCellSelectionChange?.(next);
4394
+ },
4395
+ onPaginationChange: setPagination
4396
+ });
4397
+ const headerGroups = table.getHeaderGroups();
4398
+ const leafColumns = table.getVisibleLeafColumns();
4399
+ const hasExpander = enableExpanding;
4400
+ const leadingCount = (enableRowSelection ? 1 : 0) + (hasExpander ? 1 : 0) + (enableRowPinning ? 1 : 0);
4401
+ const columnSpan = leafColumns.length + leadingCount;
4402
+ const pageCount = table.getPageCount();
4403
+ const selectedCount = Object.values(rowSelection).filter(Boolean).length;
4404
+ const hideableColumns = table.getAllLeafColumns().filter((column) => column.getCanHide());
4405
+ const groupableColumns = table.getAllLeafColumns().filter((column) => column.getCanGroup());
4406
+ const showToolbar = Boolean(toolbar) || enableColumnVisibility || enableGlobalFilter || enableGrouping || enableDensityToggle;
4407
+ const cellDensity = compact ? "h-8 py-1.5" : void 0;
4408
+ const allSelected = table.getIsAllPageRowsSelected();
4409
+ const someSelected = table.getIsSomePageRowsSelected();
4410
+ const dragged = React52.useRef(null);
4411
+ const topRows = enableRowPinning ? table.getTopRows() : [];
4412
+ const bottomRows = enableRowPinning ? table.getBottomRows() : [];
4413
+ const bodyRows = enableRowPinning ? table.getCenterRows() : table.getRowModel().rows;
4414
+ const scrollRef = React52.useRef(null);
4415
+ const setScrollRef = React52.useCallback(
4416
+ (node) => {
4417
+ scrollRef.current = node;
4418
+ if (typeof containerRef === "function") containerRef(node);
4419
+ else if (containerRef) containerRef.current = node;
4420
+ },
4421
+ [containerRef]
4422
+ );
4423
+ const virtualizer = useVirtualizer({
4424
+ count: bodyRows.length,
4425
+ getScrollElement: () => scrollRef.current,
4426
+ estimateSize: () => estimateRowHeight,
4427
+ overscan: 8,
4428
+ enabled: virtualized,
4429
+ initialRect: { width: 0, height: estimateRowHeight * 10 }
4430
+ });
4431
+ const virtualItems = virtualized ? virtualizer.getVirtualItems() : [];
4432
+ const paddingTop = virtualItems.length > 0 ? virtualItems[0]?.start ?? 0 : 0;
4433
+ const paddingBottom = virtualItems.length > 0 ? virtualizer.getTotalSize() - (virtualItems.at(-1)?.end ?? 0) : 0;
4434
+ const sentinelRef = React52.useRef(null);
4435
+ React52.useEffect(() => {
4436
+ const node = sentinelRef.current;
4437
+ if (!node || !onLoadMore || !hasMore || loadingMore || typeof IntersectionObserver === "undefined") return;
4438
+ const container = scrollRef.current;
4439
+ const root = container && container.scrollHeight > container.clientHeight ? container : null;
4440
+ const observer = new IntersectionObserver(
4441
+ (entries) => {
4442
+ if (entries.some((entry) => entry.isIntersecting)) onLoadMore();
4443
+ },
4444
+ { root, rootMargin: "0px 0px 160px 0px" }
4445
+ );
4446
+ observer.observe(node);
4447
+ return () => observer.disconnect();
4448
+ }, [onLoadMore, hasMore, loadingMore, bodyRows.length]);
4449
+ const reorder = (activeId, overId) => {
4450
+ if (activeId === overId) return;
4451
+ const ids = table.getAllLeafColumns().map((column) => column.id);
4452
+ const next = ids.filter((id) => id !== activeId);
4453
+ const at = next.indexOf(overId);
4454
+ next.splice(at === -1 ? next.length : at, 0, activeId);
4455
+ table.setColumnOrder(next);
4456
+ };
4457
+ const onGridKeyDown = (event) => {
4458
+ const directions = {
4459
+ ArrowUp: "up",
4460
+ ArrowDown: "down",
4461
+ ArrowLeft: "left",
4462
+ ArrowRight: "right"
4463
+ };
4464
+ const direction = directions[event.key];
4465
+ if (direction) {
4466
+ event.preventDefault();
4467
+ if (event.shiftKey) table.extendCellSelection(direction);
4468
+ else table.moveCellSelection(direction);
4469
+ } else if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "a") {
4470
+ event.preventDefault();
4471
+ table.selectAllCells();
4472
+ } else if (event.key === "Escape") {
4473
+ table.resetCellSelection(true);
4474
+ }
4475
+ };
4476
+ const skeletonRow = (rowKey) => /* @__PURE__ */ jsx53(TableRow, { className: "hover:bg-transparent", children: Array.from({ length: columnSpan }, (_, cell) => /* @__PURE__ */ jsx53(TableCell, { checkbox: enableRowSelection && cell === 0, className: cellDensity, children: /* @__PURE__ */ jsx53("span", { "aria-hidden": true, className: "block h-4 w-3/4 animate-pulse rounded-xs bg-border" }) }, cell)) }, rowKey);
4477
+ const renderRow = (row, options = {}) => {
4478
+ const { pinned, pinnedIndex = 0, pinnedCount = 1, virtualIndex } = options;
4479
+ const grouped = row.getIsGrouped();
4480
+ const rowUnits = compact ? 8 : 10;
4481
+ const pinStyle = pinned ? pinned === "top" ? { position: "sticky", top: `calc(var(--spacing) * ${rowUnits * (pinnedIndex + 1)})` } : { position: "sticky", bottom: `calc(var(--spacing) * ${rowUnits * (pinnedCount - 1 - pinnedIndex)})` } : void 0;
4482
+ const cells = row.getVisibleCells();
4483
+ return /* @__PURE__ */ jsxs40(React52.Fragment, { children: [
4484
+ /* @__PURE__ */ jsxs40(
4485
+ TableRow,
4486
+ {
4487
+ ref: virtualized && virtualIndex !== void 0 ? virtualizer.measureElement : void 0,
4488
+ "data-index": virtualIndex,
4489
+ selected: row.getIsSelected(),
4490
+ style: pinStyle,
4491
+ onClick: onRowClick && !grouped ? () => onRowClick(row.original) : void 0,
4492
+ className: cn(pinned && "z-20 bg-surface", grouped && "bg-background", onRowClick && !grouped && "cursor-pointer"),
4493
+ children: [
4494
+ enableRowSelection && /* @__PURE__ */ jsx53(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && /* @__PURE__ */ jsx53(
4495
+ Checkbox,
4496
+ {
4497
+ "aria-label": "Select row",
4498
+ checked: row.getIsSelected(),
4499
+ disabled: !row.getCanSelect(),
4500
+ onCheckedChange: (checked) => row.toggleSelected(Boolean(checked))
4501
+ }
4502
+ ) }),
4503
+ hasExpander && /* @__PURE__ */ jsx53(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && row.getCanExpand() && /* @__PURE__ */ jsx53(
4504
+ Button,
4505
+ {
4506
+ type: "button",
4507
+ variant: "ghost",
4508
+ size: "icon-sm",
4509
+ "aria-label": row.getIsExpanded() ? "Collapse row" : "Expand row",
4510
+ "aria-expanded": row.getIsExpanded(),
4511
+ onClick: () => row.toggleExpanded(),
4512
+ children: row.getIsExpanded() ? /* @__PURE__ */ jsx53(CaretDown5, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx53(CaretRight4, { size: 16, "aria-hidden": true })
4513
+ }
4514
+ ) }),
4515
+ enableRowPinning && /* @__PURE__ */ jsx53(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && /* @__PURE__ */ jsx53(
4516
+ Button,
4517
+ {
4518
+ type: "button",
4519
+ variant: "ghost",
4520
+ size: "icon-sm",
4521
+ "aria-label": row.getIsPinned() ? "Unpin row" : "Pin row to top",
4522
+ "aria-pressed": Boolean(row.getIsPinned()),
4523
+ onClick: () => row.pin(row.getIsPinned() ? false : "top"),
4524
+ children: row.getIsPinned() ? /* @__PURE__ */ jsx53(PushPinSlash, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx53(PushPin, { size: 16, "aria-hidden": true })
4525
+ }
4526
+ ) }),
4527
+ cells.map((cell, index) => {
4528
+ if (cell.getIsCovered()) return null;
4529
+ const meta = getMeta(cell.column.columnDef.meta);
4530
+ const pin = pinning(cell.column, sized);
4531
+ const rowSpan = cell.getRowSpan();
4532
+ const colSpan = cell.getColSpan();
4533
+ const edges = enableCellSelection && cell.getIsSelected() ? cell.getSelectionEdges() : void 0;
4534
+ const indent = index === 0 && hasExpander && row.depth > 0 ? row.depth * 4 : 0;
4535
+ let content;
4536
+ if (cell.getIsGrouped()) {
4537
+ content = /* @__PURE__ */ jsxs40(
4538
+ "button",
4539
+ {
4540
+ type: "button",
4541
+ className: "inline-flex items-center gap-1 rounded-xs text-ui-label",
4542
+ "aria-expanded": row.getIsExpanded(),
4543
+ onClick: row.getToggleExpandedHandler(),
4544
+ children: [
4545
+ row.getIsExpanded() ? /* @__PURE__ */ jsx53(CaretDown5, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx53(CaretRight4, { size: 16, "aria-hidden": true }),
4546
+ flexRender(cell.column.columnDef.cell, cell.getContext()),
4547
+ /* @__PURE__ */ jsxs40("span", { className: "text-secondary-muted-foreground", children: [
4548
+ "(",
4549
+ row.subRows.length,
4550
+ ")"
4551
+ ] })
4552
+ ]
4553
+ }
4554
+ );
4555
+ } else if (cell.getIsAggregated()) {
4556
+ content = flexRender(cell.column.columnDef.aggregatedCell ?? cell.column.columnDef.cell, cell.getContext());
4557
+ } else if (cell.getIsPlaceholder()) {
4558
+ content = null;
4559
+ } else if (meta.editable) {
4560
+ content = /* @__PURE__ */ jsx53(
4561
+ EditableCell,
4562
+ {
4563
+ value: cell.getValue(),
4564
+ label: `${labelOf(cell.column)}, row ${row.index + 1}`,
4565
+ type: meta.editType ?? "text",
4566
+ onCommit: (value) => onCellEdit?.({ row: row.original, rowId: row.id, columnId: cell.column.id, value })
4567
+ }
4568
+ );
4569
+ } else {
4570
+ content = flexRender(cell.column.columnDef.cell, cell.getContext());
4571
+ }
4572
+ return /* @__PURE__ */ jsx53(
4573
+ TableCell,
4574
+ {
4575
+ align: meta.align,
4576
+ muted: meta.muted && !grouped,
4577
+ rowSpan: rowSpan > 1 ? rowSpan : void 0,
4578
+ colSpan: colSpan > 1 ? colSpan : void 0,
4579
+ style: {
4580
+ ...pin.style,
4581
+ ...indent ? { paddingInlineStart: `calc(var(--spacing) * ${indent + 4})` } : null
4582
+ },
4583
+ "data-selected": edges ? "" : void 0,
4584
+ onMouseDown: enableCellSelection ? cell.getSelectionStartHandler() : void 0,
4585
+ onMouseEnter: enableCellSelection ? cell.getSelectionExtendHandler() : void 0,
4586
+ className: cn(
4587
+ cellDensity,
4588
+ pin.className,
4589
+ enableCellSelection && "select-none",
4590
+ edges && "bg-accent-soft",
4591
+ edges?.top && "border-t-2 border-t-input-accent",
4592
+ edges?.bottom && "border-b-2 border-b-input-accent",
4593
+ edges?.left && "border-l-2 border-l-input-accent",
4594
+ edges?.right && "border-r-2 border-r-input-accent",
4595
+ meta.editable && "py-1"
4596
+ ),
4597
+ children: content
4598
+ },
4599
+ cell.id
4600
+ );
4601
+ })
4602
+ ]
4603
+ }
4604
+ ),
4605
+ renderSubComponent && !grouped && row.getIsExpanded() && /* @__PURE__ */ jsx53(TableRow, { className: "bg-background hover:bg-background", children: /* @__PURE__ */ jsx53(TableCell, { colSpan: columnSpan, children: renderSubComponent(row.original) }) })
4606
+ ] }, row.id);
4607
+ };
4608
+ const renderHeaderCell = (header) => {
4609
+ const { column } = header;
4610
+ const { align } = getMeta(column.columnDef.meta);
4611
+ const leaf = header.subHeaders.length === 0;
4612
+ const sortState = column.getIsSorted();
4613
+ const pin = pinning(column, sized, true);
4614
+ const reorderable = enableColumnOrdering && leaf && !column.getIsPinned();
4615
+ const label = labelOf(column);
4616
+ return /* @__PURE__ */ jsx53(
4617
+ TableHead,
4618
+ {
4619
+ colSpan: header.colSpan > 1 ? header.colSpan : void 0,
4620
+ align: leaf ? align : void 0,
4621
+ sortable: leaf && column.getCanSort(),
4622
+ sort: sortState === false ? "none" : sortState,
4623
+ onSort: () => column.toggleSorting(sortState === "asc"),
4624
+ style: pin.style,
4625
+ draggable: reorderable || void 0,
4626
+ tabIndex: reorderable ? 0 : void 0,
4627
+ title: reorderable ? "Drag, or press Alt + arrow keys, to reorder" : void 0,
4628
+ onDragStart: reorderable ? () => dragged.current = column.id : void 0,
4629
+ onDragOver: reorderable ? (event) => event.preventDefault() : void 0,
4630
+ onDrop: reorderable ? (event) => {
4631
+ event.preventDefault();
4632
+ if (dragged.current) reorder(dragged.current, column.id);
4633
+ dragged.current = null;
4634
+ } : void 0,
4635
+ onKeyDown: reorderable ? (event) => {
4636
+ if (!event.altKey || event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
4637
+ event.preventDefault();
4638
+ const ids = table.getAllLeafColumns().map((item) => item.id);
4639
+ const at = ids.indexOf(column.id);
4640
+ const target = ids[at + (event.key === "ArrowLeft" ? -1 : 2)];
4641
+ if (event.key === "ArrowLeft" && ids[at - 1]) reorder(column.id, ids[at - 1]);
4642
+ else if (event.key === "ArrowRight" && at < ids.length - 1) reorder(column.id, target ?? "__end__");
4643
+ } : void 0,
4644
+ className: cn(
4645
+ pin.className,
4646
+ cellDensity,
4647
+ sticky && !column.getIsPinned() && "sticky top-0 z-20 bg-surface",
4648
+ sticky && column.getIsPinned() && "top-0",
4649
+ reorderable && "cursor-grab",
4650
+ !leaf && "text-center"
4651
+ ),
4652
+ resizer: enableColumnResizing && column.getCanResize() ? /* @__PURE__ */ jsx53(
4653
+ "div",
4654
+ {
4655
+ role: "separator",
4656
+ "aria-orientation": "vertical",
4657
+ "aria-label": `Resize ${label}`,
4658
+ onMouseDown: header.getResizeHandler(),
4659
+ onTouchStart: header.getResizeHandler(),
4660
+ onClick: (event) => event.stopPropagation(),
4661
+ className: cn(
4662
+ "absolute inset-y-0 end-0 w-1 cursor-col-resize touch-none select-none hover:bg-input-accent",
4663
+ column.getIsResizing() && "bg-input-accent"
4664
+ )
4665
+ }
4666
+ ) : void 0,
4667
+ children: header.isPlaceholder ? null : /* @__PURE__ */ jsx53(table.FlexRender, { header })
4668
+ },
4669
+ header.id
4670
+ );
4671
+ };
4672
+ const stickyLeading = cn(cellDensity, sticky && "sticky top-0 z-20 bg-surface");
4673
+ const leadingHeaderCells = (rowSpan) => /* @__PURE__ */ jsxs40(Fragment14, { children: [
4674
+ enableRowSelection && /* @__PURE__ */ jsx53(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ jsx53(
4675
+ Checkbox,
4676
+ {
4677
+ "aria-label": "Select all rows",
4678
+ checked: allSelected ? true : someSelected ? "indeterminate" : false,
4679
+ disabled: loading,
4680
+ onCheckedChange: (checked) => table.toggleAllPageRowsSelected(Boolean(checked))
4681
+ }
4682
+ ) }),
4683
+ hasExpander && /* @__PURE__ */ jsx53(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ jsx53("span", { className: "sr-only", children: "Expand" }) }),
4684
+ enableRowPinning && /* @__PURE__ */ jsx53(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ jsx53("span", { className: "sr-only", children: "Pin" }) })
4685
+ ] });
4686
+ const rowsToRender = virtualized ? virtualItems.map((item) => ({ row: bodyRows[item.index], index: item.index })) : null;
4687
+ const totalRows = topRows.length + bodyRows.length + bottomRows.length;
4688
+ return /* @__PURE__ */ jsxs40("div", { className: cn("flex w-full flex-col gap-2", wrapperClassName), children: [
4689
+ showToolbar && /* @__PURE__ */ jsxs40("div", { className: "flex items-center justify-between gap-2", children: [
4690
+ /* @__PURE__ */ jsxs40("div", { className: "flex items-center gap-2", children: [
4691
+ enableGlobalFilter && /* @__PURE__ */ jsx53(
4692
+ SearchBar,
4693
+ {
4694
+ "aria-label": "Search table",
4695
+ placeholder: globalFilterPlaceholder,
4696
+ value: globalFilter,
4697
+ onChange: (event) => table.setGlobalFilter(event.target.value),
4698
+ onClear: () => table.setGlobalFilter(""),
4699
+ className: "w-64"
4700
+ }
4701
+ ),
4702
+ toolbar
4703
+ ] }),
4704
+ /* @__PURE__ */ jsxs40("div", { className: "flex items-center gap-2", children: [
4705
+ enableDensityToggle && /* @__PURE__ */ jsxs40(
4706
+ Button,
4707
+ {
4708
+ type: "button",
4709
+ variant: "outline",
4710
+ size: "sm",
4711
+ "aria-pressed": compact,
4712
+ onClick: () => setDensity(compact ? "default" : "compact"),
4713
+ children: [
4714
+ /* @__PURE__ */ jsx53(Rows, { size: 16, "aria-hidden": true }),
4715
+ "Compact"
4716
+ ]
4717
+ }
4718
+ ),
4719
+ enableGrouping && /* @__PURE__ */ jsxs40(DropdownMenu, { children: [
4720
+ /* @__PURE__ */ jsx53(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs40(Button, { type: "button", variant: "outline", size: "sm", children: [
4721
+ /* @__PURE__ */ jsx53(Stack, { size: 16, "aria-hidden": true }),
4722
+ "Group by"
4723
+ ] }) }),
4724
+ /* @__PURE__ */ jsxs40(DropdownMenuContent, { align: "end", children: [
4725
+ /* @__PURE__ */ jsx53(DropdownMenuLabel, { children: "Group rows by" }),
4726
+ /* @__PURE__ */ jsx53(DropdownMenuSeparator, {}),
4727
+ groupableColumns.map((column) => /* @__PURE__ */ jsx53(
4728
+ DropdownMenuCheckboxItem,
4729
+ {
4730
+ checked: column.getIsGrouped(),
4731
+ onCheckedChange: () => column.toggleGrouping(),
4732
+ children: labelOf(column)
4733
+ },
4734
+ column.id
4735
+ ))
4736
+ ] })
4737
+ ] }),
4738
+ enableColumnVisibility && /* @__PURE__ */ jsxs40(DropdownMenu, { children: [
4739
+ /* @__PURE__ */ jsx53(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs40(Button, { type: "button", variant: "outline", size: "sm", children: [
4740
+ /* @__PURE__ */ jsx53(Sliders, { size: 16, "aria-hidden": true }),
4741
+ "Columns"
4742
+ ] }) }),
4743
+ /* @__PURE__ */ jsxs40(DropdownMenuContent, { align: "end", children: [
4744
+ /* @__PURE__ */ jsx53(DropdownMenuLabel, { children: "Toggle columns" }),
4745
+ /* @__PURE__ */ jsx53(DropdownMenuSeparator, {}),
4746
+ hideableColumns.map((column) => /* @__PURE__ */ jsx53(
4747
+ DropdownMenuCheckboxItem,
4748
+ {
4749
+ checked: column.getIsVisible(),
4750
+ onCheckedChange: (checked) => column.toggleVisibility(Boolean(checked)),
4751
+ children: labelOf(column)
4752
+ },
4753
+ column.id
4754
+ ))
4755
+ ] })
4756
+ ] })
4757
+ ] })
4758
+ ] }),
4759
+ /* @__PURE__ */ jsxs40(
4760
+ Table,
4761
+ {
4762
+ ref,
4763
+ containerRef: setScrollRef,
4764
+ containerClassName,
4765
+ striped,
4766
+ "aria-busy": loading || loadingMore || void 0,
4767
+ style: sized ? { width: table.getTotalSize(), minWidth: "100%", tableLayout: "fixed", ...tableStyle } : tableStyle,
4768
+ onKeyDown: enableCellSelection ? onGridKeyDown : void 0,
4769
+ tabIndex: enableCellSelection ? 0 : void 0,
4770
+ ...tableProps,
4771
+ children: [
4772
+ /* @__PURE__ */ jsxs40(TableHeader, { children: [
4773
+ headerGroups.map((group, groupIndex) => /* @__PURE__ */ jsxs40(TableRow, { className: "hover:bg-transparent", children: [
4774
+ groupIndex === 0 && leadingHeaderCells(headerGroups.length + (enableColumnFilters ? 1 : 0)),
4775
+ group.headers.map(renderHeaderCell)
4776
+ ] }, group.id)),
4777
+ enableColumnFilters && /* @__PURE__ */ jsx53(TableRow, { className: "hover:bg-transparent", children: leafColumns.map((column) => {
4778
+ const pin = pinning(column, sized, true);
4779
+ return /* @__PURE__ */ jsx53(
4780
+ TableHead,
4781
+ {
4782
+ style: pin.style,
4783
+ className: cn("h-auto py-2 font-normal", pin.className, sticky && !column.getIsPinned() && "bg-surface"),
4784
+ children: column.getCanFilter() ? /* @__PURE__ */ jsx53(ColumnFilter, { column }) : null
4785
+ },
4786
+ column.id
4787
+ );
4788
+ }) })
4789
+ ] }),
4790
+ /* @__PURE__ */ jsxs40(TableBody, { children: [
4791
+ loading ? Array.from({ length: pageSize }, (_, index) => skeletonRow(`loading-${index}`)) : totalRows === 0 ? /* @__PURE__ */ jsx53(TableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ jsx53(TableCell, { colSpan: columnSpan, muted: true, className: "h-24 text-center", children: emptyState ?? "No results." }) }) : /* @__PURE__ */ jsxs40(Fragment14, { children: [
4792
+ topRows.map((row, index) => renderRow(row, { pinned: "top", pinnedIndex: index, pinnedCount: topRows.length })),
4793
+ virtualized && paddingTop > 0 && /* @__PURE__ */ jsx53("tr", { "aria-hidden": true, children: /* @__PURE__ */ jsx53("td", { colSpan: columnSpan, style: { height: paddingTop } }) }),
4794
+ rowsToRender ? rowsToRender.map(({ row, index }) => renderRow(row, { virtualIndex: index })) : bodyRows.map((row) => renderRow(row)),
4795
+ virtualized && paddingBottom > 0 && /* @__PURE__ */ jsx53("tr", { "aria-hidden": true, children: /* @__PURE__ */ jsx53("td", { colSpan: columnSpan, style: { height: paddingBottom } }) }),
4796
+ bottomRows.map(
4797
+ (row, index) => renderRow(row, { pinned: "bottom", pinnedIndex: index, pinnedCount: bottomRows.length })
4798
+ )
4799
+ ] }),
4800
+ infinite && /* @__PURE__ */ jsxs40(Fragment14, { children: [
4801
+ loadingMore && Array.from({ length: 3 }, (_, index) => skeletonRow(`more-${index}`)),
4802
+ /* @__PURE__ */ jsx53("tr", { ref: sentinelRef, "aria-hidden": true, children: /* @__PURE__ */ jsx53("td", { colSpan: columnSpan, className: "h-px p-0" }) })
4803
+ ] })
4804
+ ] }),
4805
+ showFooter && /* @__PURE__ */ jsx53(TableFooter, { children: table.getFooterGroups().map((group) => /* @__PURE__ */ jsxs40(TableRow, { className: "hover:bg-transparent", children: [
4806
+ leadingCount > 0 && /* @__PURE__ */ jsx53(TableCell, { colSpan: leadingCount, className: cellDensity }),
4807
+ group.headers.map((header) => {
4808
+ const { align } = getMeta(header.column.columnDef.meta);
4809
+ const pin = pinning(header.column, sized);
4810
+ return /* @__PURE__ */ jsx53(
4811
+ TableCell,
4812
+ {
4813
+ align,
4814
+ colSpan: header.colSpan > 1 ? header.colSpan : void 0,
4815
+ style: pin.style,
4816
+ className: cn("text-ui-label", pin.className, cellDensity),
4817
+ children: header.isPlaceholder ? null : /* @__PURE__ */ jsx53(table.FlexRender, { footer: header })
4818
+ },
4819
+ header.id
4820
+ );
4821
+ })
4822
+ ] }, group.id)) })
4823
+ ]
4824
+ }
4825
+ ),
4826
+ (enableRowSelection || paginate && pageCount > 1) && /* @__PURE__ */ jsxs40("div", { className: "flex items-center justify-between gap-2", children: [
4827
+ /* @__PURE__ */ jsx53("span", { className: "text-body-small text-secondary-muted-foreground", "aria-live": "polite", children: enableRowSelection ? `${selectedCount} of ${table.getCoreRowModel().rows.length} row(s) selected` : null }),
4828
+ paginate && pageCount > 1 && /* @__PURE__ */ jsx53(
4829
+ Pagination,
4830
+ {
4831
+ page: pagination.pageIndex + 1,
4832
+ pageCount,
4833
+ onPageChange: (page) => table.setPageIndex(page - 1)
4834
+ }
4835
+ )
4836
+ ] })
4837
+ ] });
4838
+ }
4839
+ var DataTable = React52.forwardRef(DataTableInner);
4840
+ DataTable.displayName = "DataTable";
4841
+
4842
+ // src/components/Data Display/StatCard.tsx
4843
+ import * as React53 from "react";
4844
+ import { cva as cva6 } from "class-variance-authority";
4845
+ import { jsx as jsx54, jsxs as jsxs41 } from "react/jsx-runtime";
3891
4846
  var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3", {
3892
4847
  variants: {
3893
4848
  variant: {
@@ -3901,26 +4856,26 @@ var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3",
3901
4856
  },
3902
4857
  defaultVariants: { variant: "default" }
3903
4858
  });
3904
- var StatCard = React51.forwardRef(
3905
- ({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */ jsxs39("div", { ref, className: cn(statCardVariants({ variant }), className), ...props, children: [
3906
- /* @__PURE__ */ jsx52("p", { className: "truncate text-ui-caption text-secondary-muted-foreground", children: label }),
3907
- /* @__PURE__ */ jsxs39("p", { className: "flex items-center gap-2 text-body-base text-surface-foreground", children: [
3908
- icon && /* @__PURE__ */ jsx52("span", { "aria-hidden": "true", className: "inline-flex size-6 shrink-0 items-center justify-center", children: icon }),
4859
+ var StatCard = React53.forwardRef(
4860
+ ({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */ jsxs41("div", { ref, className: cn(statCardVariants({ variant }), className), ...props, children: [
4861
+ /* @__PURE__ */ jsx54("p", { className: "truncate text-ui-caption text-secondary-muted-foreground", children: label }),
4862
+ /* @__PURE__ */ jsxs41("p", { className: "flex items-center gap-2 text-body-base text-surface-foreground", children: [
4863
+ icon && /* @__PURE__ */ jsx54("span", { "aria-hidden": "true", className: "inline-flex size-6 shrink-0 items-center justify-center", children: icon }),
3909
4864
  value
3910
4865
  ] }),
3911
- caption && /* @__PURE__ */ jsx52("p", { className: "text-ui-caption text-secondary-muted-foreground", children: caption })
4866
+ caption && /* @__PURE__ */ jsx54("p", { className: "text-ui-caption text-secondary-muted-foreground", children: caption })
3912
4867
  ] })
3913
4868
  );
3914
4869
  StatCard.displayName = "StatCard";
3915
4870
 
3916
4871
  // src/components/Research-Specific/ActivityStructure.tsx
3917
- import * as React53 from "react";
4872
+ import * as React55 from "react";
3918
4873
 
3919
4874
  // src/components/Tags & Badges/EditableTag.tsx
3920
- import * as React52 from "react";
4875
+ import * as React54 from "react";
3921
4876
  import { Crown, Plus as Plus5, X as X6 } from "@phosphor-icons/react";
3922
4877
  import { cva as cva7 } from "class-variance-authority";
3923
- import { jsx as jsx53, jsxs as jsxs40 } from "react/jsx-runtime";
4878
+ import { jsx as jsx55, jsxs as jsxs42 } from "react/jsx-runtime";
3924
4879
  var editableTagVariants = cva7(
3925
4880
  "inline-flex h-6.5 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
3926
4881
  {
@@ -3935,27 +4890,27 @@ var editableTagVariants = cva7(
3935
4890
  defaultVariants: { type: "default" }
3936
4891
  }
3937
4892
  );
3938
- var EditableTag = React52.forwardRef(
4893
+ var EditableTag = React54.forwardRef(
3939
4894
  ({ className, type = "default", icon, onRemove, onClick, children, ...props }, ref) => {
3940
4895
  const classes = cn(editableTagVariants({ type }), className);
3941
- const leading = type === "add" ? /* @__PURE__ */ jsx53(Plus5, { size: 12, "aria-hidden": true }) : icon !== void 0 ? icon : type === "default" ? /* @__PURE__ */ jsx53(Crown, { size: 12, weight: "fill", "aria-hidden": true }) : null;
4896
+ const leading = type === "add" ? /* @__PURE__ */ jsx55(Plus5, { size: 12, "aria-hidden": true }) : icon !== void 0 ? icon : type === "default" ? /* @__PURE__ */ jsx55(Crown, { size: 12, weight: "fill", "aria-hidden": true }) : null;
3942
4897
  if (type === "add" || type === "multiple" && onClick) {
3943
- return /* @__PURE__ */ jsxs40("button", { ref, type: "button", className: classes, onClick, ...props, children: [
4898
+ return /* @__PURE__ */ jsxs42("button", { ref, type: "button", className: classes, onClick, ...props, children: [
3944
4899
  leading,
3945
4900
  children
3946
4901
  ] });
3947
4902
  }
3948
- return /* @__PURE__ */ jsxs40("span", { ref, className: classes, ...props, children: [
4903
+ return /* @__PURE__ */ jsxs42("span", { ref, className: classes, ...props, children: [
3949
4904
  leading,
3950
4905
  children,
3951
- onRemove && /* @__PURE__ */ jsx53(
4906
+ onRemove && /* @__PURE__ */ jsx55(
3952
4907
  "button",
3953
4908
  {
3954
4909
  type: "button",
3955
4910
  "aria-label": typeof children === "string" ? `Remove ${children}` : "Remove",
3956
4911
  onClick: onRemove,
3957
4912
  className: "inline-flex size-3 items-center justify-center rounded-xs",
3958
- children: /* @__PURE__ */ jsx53(X6, { size: 12, "aria-hidden": true })
4913
+ children: /* @__PURE__ */ jsx55(X6, { size: 12, "aria-hidden": true })
3959
4914
  }
3960
4915
  )
3961
4916
  ] });
@@ -3964,26 +4919,26 @@ var EditableTag = React52.forwardRef(
3964
4919
  EditableTag.displayName = "EditableTag";
3965
4920
 
3966
4921
  // src/components/Research-Specific/ActivityStructure.tsx
3967
- import { jsx as jsx54, jsxs as jsxs41 } from "react/jsx-runtime";
3968
- var ActivityStructure = React53.forwardRef(
3969
- ({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */ jsxs41(
4922
+ import { jsx as jsx56, jsxs as jsxs43 } from "react/jsx-runtime";
4923
+ var ActivityStructure = React55.forwardRef(
4924
+ ({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */ jsxs43(
3970
4925
  "section",
3971
4926
  {
3972
4927
  ref,
3973
4928
  className: cn("flex w-full max-w-96.5 flex-col gap-4 rounded-xl bg-surface p-4", className),
3974
4929
  ...props,
3975
4930
  children: [
3976
- /* @__PURE__ */ jsxs41("div", { className: "flex items-center justify-between gap-2", children: [
3977
- /* @__PURE__ */ jsx54("h3", { className: "text-body-section text-surface-foreground", children: title }),
4931
+ /* @__PURE__ */ jsxs43("div", { className: "flex items-center justify-between gap-2", children: [
4932
+ /* @__PURE__ */ jsx56("h3", { className: "text-body-section text-surface-foreground", children: title }),
3978
4933
  action
3979
4934
  ] }),
3980
- stats.length > 0 && /* @__PURE__ */ jsx54("div", { className: "grid grid-cols-2 gap-3", children: stats.map(({ id, ...stat }) => /* @__PURE__ */ jsx54(StatCard, { ...stat }, id)) }),
3981
- sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ jsxs41("div", { className: "flex flex-col gap-2", children: [
3982
- /* @__PURE__ */ jsx54("h4", { className: "text-heading-h4 text-surface-foreground", children: heading }),
3983
- /* @__PURE__ */ jsx54("div", { className: "text-body-base text-surface-foreground", children: body }),
3984
- (tags?.length || onAddTag) && /* @__PURE__ */ jsxs41("div", { className: "flex flex-wrap items-center gap-2", children: [
3985
- tags?.map((tag) => /* @__PURE__ */ jsx54(EditableTag, { type: "editable", onRemove: onRemoveTag && (() => onRemoveTag(id, tag)), children: tag }, tag)),
3986
- onAddTag && /* @__PURE__ */ jsx54(EditableTag, { type: "add", onClick: () => onAddTag(id), children: addTagLabel })
4935
+ stats.length > 0 && /* @__PURE__ */ jsx56("div", { className: "grid grid-cols-2 gap-3", children: stats.map(({ id, ...stat }) => /* @__PURE__ */ jsx56(StatCard, { ...stat }, id)) }),
4936
+ sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ jsxs43("div", { className: "flex flex-col gap-2", children: [
4937
+ /* @__PURE__ */ jsx56("h4", { className: "text-heading-h4 text-surface-foreground", children: heading }),
4938
+ /* @__PURE__ */ jsx56("div", { className: "text-body-base text-surface-foreground", children: body }),
4939
+ (tags?.length || onAddTag) && /* @__PURE__ */ jsxs43("div", { className: "flex flex-wrap items-center gap-2", children: [
4940
+ tags?.map((tag) => /* @__PURE__ */ jsx56(EditableTag, { type: "editable", onRemove: onRemoveTag && (() => onRemoveTag(id, tag)), children: tag }, tag)),
4941
+ onAddTag && /* @__PURE__ */ jsx56(EditableTag, { type: "add", onClick: () => onAddTag(id), children: addTagLabel })
3987
4942
  ] })
3988
4943
  ] }, id)),
3989
4944
  children
@@ -3994,10 +4949,10 @@ var ActivityStructure = React53.forwardRef(
3994
4949
  ActivityStructure.displayName = "ActivityStructure";
3995
4950
 
3996
4951
  // src/components/Tags & Badges/Badge.tsx
3997
- import * as React54 from "react";
4952
+ import * as React56 from "react";
3998
4953
  import { DotsSixVertical as DotsSixVertical5, RadioButton as RadioButton2 } from "@phosphor-icons/react";
3999
4954
  import { cva as cva8 } from "class-variance-authority";
4000
- import { jsx as jsx55, jsxs as jsxs42 } from "react/jsx-runtime";
4955
+ import { jsx as jsx57, jsxs as jsxs44 } from "react/jsx-runtime";
4001
4956
  var roleTagVariants = cva8(
4002
4957
  "group inline-flex h-6 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
4003
4958
  {
@@ -4023,11 +4978,11 @@ var roleTagVariants = cva8(
4023
4978
  defaultVariants: { type: "primary", selected: false }
4024
4979
  }
4025
4980
  );
4026
- var Badge = React54.forwardRef(
4981
+ var Badge = React56.forwardRef(
4027
4982
  ({ className, type = "primary", selected = false, onClick, children, ...props }, ref) => {
4028
4983
  const classes = cn(roleTagVariants({ type, selected: type === "interactable" ? selected : false }), className);
4029
4984
  if (type === "interactable") {
4030
- return /* @__PURE__ */ jsxs42(
4985
+ return /* @__PURE__ */ jsxs44(
4031
4986
  "button",
4032
4987
  {
4033
4988
  ref,
@@ -4037,100 +4992,20 @@ var Badge = React54.forwardRef(
4037
4992
  onClick,
4038
4993
  ...props,
4039
4994
  children: [
4040
- /* @__PURE__ */ jsx55(DotsSixVertical5, { size: 16, "aria-hidden": true, className: "hidden shrink-0 group-hover:block" }),
4995
+ /* @__PURE__ */ jsx57(DotsSixVertical5, { size: 16, "aria-hidden": true, className: "hidden shrink-0 group-hover:block" }),
4041
4996
  children
4042
4997
  ]
4043
4998
  }
4044
4999
  );
4045
5000
  }
4046
- return /* @__PURE__ */ jsxs42("span", { ref, className: classes, ...props, children: [
4047
- type === "question" && /* @__PURE__ */ jsx55(RadioButton2, { size: 16, weight: "fill", "aria-hidden": true }),
4048
- type === "id" && /* @__PURE__ */ jsx55("span", { className: "text-secondary-muted-foreground", children: "ID" }),
5001
+ return /* @__PURE__ */ jsxs44("span", { ref, className: classes, ...props, children: [
5002
+ type === "question" && /* @__PURE__ */ jsx57(RadioButton2, { size: 16, weight: "fill", "aria-hidden": true }),
5003
+ type === "id" && /* @__PURE__ */ jsx57("span", { className: "text-secondary-muted-foreground", children: "ID" }),
4049
5004
  children
4050
5005
  ] });
4051
5006
  }
4052
5007
  );
4053
5008
  Badge.displayName = "Badge";
4054
-
4055
- // src/components/Utility/Pagination.tsx
4056
- import * as React55 from "react";
4057
- import { ArrowLeft, ArrowRight, DotsThree as DotsThree2 } from "@phosphor-icons/react";
4058
- import { jsx as jsx56, jsxs as jsxs43 } from "react/jsx-runtime";
4059
- function getPaginationItems(page, pageCount, siblings = 1) {
4060
- const keep = /* @__PURE__ */ new Set([1, pageCount]);
4061
- for (let p = page - siblings; p <= page + siblings; p++) if (p >= 1 && p <= pageCount) keep.add(p);
4062
- const sorted = [...keep].sort((a, b) => a - b);
4063
- const items = [];
4064
- sorted.forEach((p, index) => {
4065
- const previous = sorted[index - 1];
4066
- if (previous !== void 0 && p - previous === 2) items.push(previous + 1);
4067
- else if (previous !== void 0 && p - previous > 2) items.push("ellipsis");
4068
- items.push(p);
4069
- });
4070
- return items;
4071
- }
4072
- var Pagination = React55.forwardRef(
4073
- ({ className, page, pageCount, onPageChange, variant = "full", siblings = 1, ...props }, ref) => {
4074
- const go = (next2) => onPageChange(Math.min(pageCount, Math.max(1, next2)));
4075
- const previous = /* @__PURE__ */ jsx56(
4076
- Button,
4077
- {
4078
- type: "button",
4079
- variant: "outline",
4080
- size: "icon-sm",
4081
- "aria-label": "Previous page",
4082
- disabled: page <= 1,
4083
- onClick: () => go(page - 1),
4084
- children: /* @__PURE__ */ jsx56(ArrowLeft, { size: 16, "aria-hidden": true })
4085
- }
4086
- );
4087
- const next = /* @__PURE__ */ jsx56(
4088
- Button,
4089
- {
4090
- type: "button",
4091
- variant: "outline",
4092
- size: "icon-sm",
4093
- "aria-label": "Next page",
4094
- disabled: page >= pageCount,
4095
- onClick: () => go(page + 1),
4096
- children: /* @__PURE__ */ jsx56(ArrowRight, { size: 16, "aria-hidden": true })
4097
- }
4098
- );
4099
- return /* @__PURE__ */ jsxs43(
4100
- "nav",
4101
- {
4102
- ref,
4103
- "aria-label": "Pagination",
4104
- className: cn("flex items-center", variant === "compact" ? "w-35 justify-between" : "gap-2", className),
4105
- ...props,
4106
- children: [
4107
- previous,
4108
- variant === "compact" ? /* @__PURE__ */ jsxs43("span", { className: "text-body-small text-surface-foreground", "aria-live": "polite", children: [
4109
- page,
4110
- "/",
4111
- pageCount
4112
- ] }) : /* @__PURE__ */ jsx56("ul", { className: "flex items-center gap-2", children: getPaginationItems(page, pageCount, siblings).map((item, index) => /* @__PURE__ */ jsx56("li", { children: item === "ellipsis" ? /* @__PURE__ */ jsxs43("span", { className: "inline-flex size-8 items-center justify-center rounded-sm border border-border bg-surface text-surface-foreground", children: [
4113
- /* @__PURE__ */ jsx56(DotsThree2, { size: 16, "aria-hidden": true }),
4114
- /* @__PURE__ */ jsx56("span", { className: "sr-only", children: "More pages" })
4115
- ] }) : /* @__PURE__ */ jsx56(
4116
- Button,
4117
- {
4118
- type: "button",
4119
- variant: item === page ? "subtle" : "outline",
4120
- size: "sm",
4121
- "aria-label": `Page ${item}`,
4122
- "aria-current": item === page ? "page" : void 0,
4123
- onClick: () => go(item),
4124
- children: item
4125
- }
4126
- ) }, item === "ellipsis" ? `ellipsis-${index}` : item)) }),
4127
- next
4128
- ]
4129
- }
4130
- );
4131
- }
4132
- );
4133
- Pagination.displayName = "Pagination";
4134
5009
  export {
4135
5010
  AIMiniAvatar,
4136
5011
  AIResponseContainer,
@@ -4145,6 +5020,7 @@ export {
4145
5020
  ChatOption,
4146
5021
  Checkbox,
4147
5022
  CheckboxField,
5023
+ DataTable,
4148
5024
  DatePicker,
4149
5025
  DateTimePicker,
4150
5026
  Dialog,
@@ -4225,6 +5101,7 @@ export {
4225
5101
  TableBody,
4226
5102
  TableCell,
4227
5103
  TableCellTwoLines,
5104
+ TableFooter,
4228
5105
  TableHead,
4229
5106
  TableHeader,
4230
5107
  TableRow,