@syscore/ui-library 2.0.0-beta-publish-workflow-beta.11 → 2.0.0-beta-publish-workflow-beta.13

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.d.ts CHANGED
@@ -190,6 +190,11 @@ import { ContextMenuSubTrigger } from '../client/components/ui/context-menu';
190
190
  import { ContextMenuTrigger } from '../client/components/ui/context-menu';
191
191
  import { Copy } from '../client/components/ui/copy';
192
192
  import { CreditCardPreview } from '../client/components/ui/credit-card-preview';
193
+ import { DataGrid } from '../client/components/ui/data-grid';
194
+ import { DataGridAlign } from '../client/components/ui/data-grid';
195
+ import { DataGridColumn } from '../client/components/ui/data-grid';
196
+ import { DataGridProps } from '../client/components/ui/data-grid';
197
+ import { DataGridSort } from '../client/components/ui/data-grid';
193
198
  import { DatePicker } from '../client/components/ui/date-picker';
194
199
  import { DatePickerProps } from '../client/components/ui/date-picker';
195
200
  import { DateRange } from '../client/components/ui/date-picker';
@@ -477,6 +482,8 @@ import { SidebarMenuSubItem } from '../client/components/ui/sidebar';
477
482
  import { SidebarProvider } from '../client/components/ui/sidebar';
478
483
  import { SidebarTrigger } from '../client/components/ui/sidebar';
479
484
  import { SideNav } from '../client/components/ui/side-nav';
485
+ import { SideNavBranch } from '../client/components/ui/side-nav';
486
+ import { SideNavBranchProps } from '../client/components/ui/side-nav';
480
487
  import { SideNavGroup } from '../client/components/ui/side-nav';
481
488
  import { SideNavGroupProps } from '../client/components/ui/side-nav';
482
489
  import { SideNavItem } from '../client/components/ui/side-nav';
@@ -504,6 +511,7 @@ import { StatusPill } from '../client/components/ui/status-pill';
504
511
  import { StepItem } from '../client/components/ui/stepper';
505
512
  import { Stepper } from '../client/components/ui/stepper';
506
513
  import { StepperProps } from '../client/components/ui/stepper';
514
+ import { Swatch } from '../client/components/ui/card';
507
515
  import { Switch } from '../client/components/ui/switch';
508
516
  import { SwitchV01 } from '../client/components/ui/switch-v01';
509
517
  import { SwitchV01Props } from '../client/components/ui/switch-v01';
@@ -1015,6 +1023,16 @@ export { Copy }
1015
1023
 
1016
1024
  export { CreditCardPreview }
1017
1025
 
1026
+ export { DataGrid }
1027
+
1028
+ export { DataGridAlign }
1029
+
1030
+ export { DataGridColumn }
1031
+
1032
+ export { DataGridProps }
1033
+
1034
+ export { DataGridSort }
1035
+
1018
1036
  export { DatePicker }
1019
1037
 
1020
1038
  export { DatePickerProps }
@@ -1589,6 +1607,10 @@ export { SidebarTrigger }
1589
1607
 
1590
1608
  export { SideNav }
1591
1609
 
1610
+ export { SideNavBranch }
1611
+
1612
+ export { SideNavBranchProps }
1613
+
1592
1614
  export { SideNavGroup }
1593
1615
 
1594
1616
  export { SideNavGroupProps }
@@ -1643,6 +1665,8 @@ export { Stepper }
1643
1665
 
1644
1666
  export { StepperProps }
1645
1667
 
1668
+ export { Swatch }
1669
+
1646
1670
  export { Switch }
1647
1671
 
1648
1672
  export { SwitchV01 }
package/dist/index.es.js CHANGED
@@ -39,6 +39,8 @@ import * as ToastPrimitives from "@radix-ui/react-toast";
39
39
  import * as RechartsPrimitive from "recharts";
40
40
  import { format } from "date-fns";
41
41
  import { Text as Text$1 } from "@syscore/ui-library";
42
+ import { AgGridReact } from "ag-grid-react";
43
+ import { ModuleRegistry, AllCommunityModule, themeQuartz } from "ag-grid-community";
42
44
  function cn(...inputs) {
43
45
  return twMerge(clsx(inputs));
44
46
  }
@@ -708,10 +710,18 @@ const buttonVariants = cva(
708
710
  "primary-dark": "button--primary-dark",
709
711
  "secondary-light": "button--secondary-light",
710
712
  "tertiary-light": "button--tertiary-light",
713
+ // Same pill shape as tertiary-light, red instead of blue — for a
714
+ // destructive inline action (e.g. "Remove" on an applied discount
715
+ // code) that isn't severe enough for a confirm dialog but shouldn't
716
+ // read as a neutral/affirmative action either.
717
+ "tertiary-danger": "button--tertiary-danger",
711
718
  // Utility variants
712
719
  "general-primary": "button--general-primary",
713
720
  "general-secondary": "button--general-secondary",
714
721
  "general-tertiary": "button--general-tertiary",
722
+ // Destructive actions: delete, remove, deactivate, void. `primary` confirms, `secondary` starts the action.
723
+ "danger-primary": "button--danger-primary",
724
+ "danger-secondary": "button--danger-secondary",
715
725
  "transparent-tertiary": "button--transparent-tertiary",
716
726
  "tooltip-primary": "button--tooltip-primary",
717
727
  "tooltip-secondary": "button--tooltip-secondary",
@@ -1143,10 +1153,12 @@ const Text = React.forwardRef(
1143
1153
  className,
1144
1154
  variant = "body-base",
1145
1155
  as,
1156
+ loose = false,
1146
1157
  tone = "default",
1147
1158
  strong = false,
1148
1159
  align,
1149
1160
  leading = "default",
1161
+ family = "default",
1150
1162
  ...props
1151
1163
  }, ref) => {
1152
1164
  const Component = as || defaultElementMap[variant];
@@ -1156,10 +1168,12 @@ const Text = React.forwardRef(
1156
1168
  ref,
1157
1169
  className: cn(
1158
1170
  typographyVariants({ variant }),
1171
+ loose && "typography--loose",
1159
1172
  tone === "muted" && "typo--muted",
1160
1173
  strong && "typo--strong",
1161
1174
  align === "center" && "typo--center",
1162
1175
  leading === "relaxed" && "typo--relaxed",
1176
+ family === "sans" && "typo--sans",
1163
1177
  className
1164
1178
  ),
1165
1179
  ...props
@@ -1211,6 +1225,10 @@ const cardVariants = cva("card", {
1211
1225
  elevated: "card--elevated",
1212
1226
  filled: "card--filled",
1213
1227
  interactive: "card--interactive",
1228
+ // A dark, colored promo banner (e.g. the WELL AP credentials page's
1229
+ // "WELL Forum" callout) — content on it needs the inverse text tone,
1230
+ // same as any other dark surface in the app.
1231
+ gradient: "card--gradient",
1214
1232
  /** A bordered 16px-radius panel for a side summary. */
1215
1233
  panel: "card--panel",
1216
1234
  /** A bordered 12px-radius box nested inside a form or another card. */
@@ -1218,7 +1236,8 @@ const cardVariants = cva("card", {
1218
1236
  },
1219
1237
  padding: {
1220
1238
  default: "",
1221
- spacious: "card--padding-spacious"
1239
+ spacious: "card--padding-spacious",
1240
+ compact: "card--padding-compact"
1222
1241
  },
1223
1242
  /** `relaxed` — more air between heading, description and content (dense back-office pages). */
1224
1243
  spacing: {
@@ -1247,7 +1266,14 @@ const Card = React.forwardRef(
1247
1266
  )
1248
1267
  );
1249
1268
  Card.displayName = "Card";
1250
- const CardHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("card-header", className), ...props }));
1269
+ const CardHeader = React.forwardRef(({ className, tinted = false, ...props }, ref) => /* @__PURE__ */ jsx(
1270
+ "div",
1271
+ {
1272
+ ref,
1273
+ className: cn("card-header", tinted && "card-header--tinted", className),
1274
+ ...props
1275
+ }
1276
+ ));
1251
1277
  CardHeader.displayName = "CardHeader";
1252
1278
  const CardTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1253
1279
  "h3",
@@ -1307,6 +1333,17 @@ const CardBadge = React.forwardRef(
1307
1333
  CardBadge.displayName = "CardBadge";
1308
1334
  const CardActions = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("card-actions", className), ...props }));
1309
1335
  CardActions.displayName = "CardActions";
1336
+ const Swatch = React.forwardRef(
1337
+ ({ className, tone = "primary", size = "md", ...props }, ref) => /* @__PURE__ */ jsx(
1338
+ "div",
1339
+ {
1340
+ ref,
1341
+ className: cn("swatch", `swatch--${tone}`, `swatch--${size}`, className),
1342
+ ...props
1343
+ }
1344
+ )
1345
+ );
1346
+ Swatch.displayName = "Swatch";
1310
1347
  const CardMetric = React.forwardRef(
1311
1348
  ({ className, value, label, trend, trendValue, ...props }, ref) => /* @__PURE__ */ jsxs("div", { ref, className: cn("card-metric", className), ...props, children: [
1312
1349
  /* @__PURE__ */ jsx("span", { className: "card-metric__value", children: value }),
@@ -3622,7 +3659,11 @@ const alertVariants = cva(
3622
3659
  variants: {
3623
3660
  variant: {
3624
3661
  default: "alert--default",
3625
- destructive: "alert--destructive"
3662
+ destructive: "alert--destructive",
3663
+ // Neutral help/explainer callout — e.g. the activity-type guidance
3664
+ // text on the WELL AP "Report CE hours" form. Blue, not red/coral:
3665
+ // informational, not a warning or error.
3666
+ info: "alert--info"
3626
3667
  }
3627
3668
  },
3628
3669
  defaultVariants: {
@@ -4742,53 +4783,68 @@ function DialogContent({
4742
4783
  className: cn(
4743
4784
  "dialog-content",
4744
4785
  size === "fullscreen" && "dialog-content--fullscreen",
4786
+ size === "lg" && "dialog-content--lg",
4745
4787
  appearance === "form" && "dialog-content--form",
4746
4788
  className
4747
4789
  ),
4748
4790
  ...props,
4749
- children: /* @__PURE__ */ jsxs("div", { className: "dialog-content-wrapper", children: [
4750
- /* @__PURE__ */ jsx(
4751
- "div",
4752
- {
4753
- className: cn(
4754
- "dialog-content-inner",
4755
- size === "fullscreen" && "dialog-content-inner--fullscreen",
4756
- innerClassName
4791
+ children: /* @__PURE__ */ jsxs(
4792
+ "div",
4793
+ {
4794
+ className: cn(
4795
+ "dialog-content-wrapper",
4796
+ size === "lg" && "dialog-content-wrapper--lg"
4797
+ ),
4798
+ children: [
4799
+ /* @__PURE__ */ jsx(
4800
+ "div",
4801
+ {
4802
+ className: cn(
4803
+ "dialog-content-inner",
4804
+ size === "fullscreen" && "dialog-content-inner--fullscreen",
4805
+ size === "lg" && "dialog-content-inner--lg",
4806
+ innerClassName
4807
+ ),
4808
+ children
4809
+ }
4757
4810
  ),
4758
- children
4759
- }
4760
- ),
4761
- showCloseButton && /* @__PURE__ */ jsxs(
4762
- SheetPrimitive.Close,
4763
- {
4764
- "data-slot": "dialog-close",
4765
- className: "dialog-close",
4766
- children: [
4767
- /* @__PURE__ */ jsx(
4768
- UtilityClose,
4769
- {
4770
- className: cn(
4771
- "dialog-close-icon text-gray-400 hover:text-gray-600 transition-colors duration-200 ",
4772
- closeClassName
4773
- )
4774
- }
4775
- ),
4776
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
4777
- ]
4778
- }
4779
- )
4780
- ] })
4811
+ showCloseButton && /* @__PURE__ */ jsxs(
4812
+ SheetPrimitive.Close,
4813
+ {
4814
+ "data-slot": "dialog-close",
4815
+ className: "dialog-close",
4816
+ children: [
4817
+ /* @__PURE__ */ jsx(
4818
+ UtilityClose,
4819
+ {
4820
+ className: cn(
4821
+ "dialog-close-icon text-gray-400 hover:text-gray-600 transition-colors duration-200 ",
4822
+ closeClassName
4823
+ )
4824
+ }
4825
+ ),
4826
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
4827
+ ]
4828
+ }
4829
+ )
4830
+ ]
4831
+ }
4832
+ )
4781
4833
  }
4782
4834
  )
4783
4835
  }
4784
4836
  ) });
4785
4837
  }
4786
- function DialogHeader({ className, ...props }) {
4838
+ function DialogHeader({
4839
+ className,
4840
+ spacious = false,
4841
+ ...props
4842
+ }) {
4787
4843
  return /* @__PURE__ */ jsx(
4788
4844
  "div",
4789
4845
  {
4790
4846
  "data-slot": "dialog-header",
4791
- className: cn("dialog-header", className),
4847
+ className: cn("dialog-header", spacious && "dialog-header--spacious", className),
4792
4848
  ...props
4793
4849
  }
4794
4850
  );
@@ -4805,13 +4861,15 @@ function DialogFooter({ className, ...props }) {
4805
4861
  }
4806
4862
  function DialogTitle({
4807
4863
  className,
4864
+ size = "default",
4808
4865
  ...props
4809
4866
  }) {
4867
+ const sizeClass2 = size === "lg" ? "heading-small" : size === "md" ? "heading-xsmall" : "heading-xxsmall";
4810
4868
  return /* @__PURE__ */ jsx(
4811
4869
  SheetPrimitive.Title,
4812
4870
  {
4813
4871
  "data-slot": "dialog-title",
4814
- className: cn("dialog-title heading-xxsmall text-center", className),
4872
+ className: cn("dialog-title text-center", sizeClass2, className),
4815
4873
  ...props
4816
4874
  }
4817
4875
  );
@@ -5361,9 +5419,13 @@ const Grid = React.forwardRef(
5361
5419
  ),
5362
5420
  style: {
5363
5421
  gridTemplateColumns: template,
5364
- gap: rowGap === void 0 && resolvedColumnGap === void 0 ? gapCss(gap) : void 0,
5365
- rowGap: gapCss(rowGap),
5366
- columnGap: gapCss(resolvedColumnGap),
5422
+ // Never emit the `gap` shorthand alongside `rowGap`/`columnGap` —
5423
+ // React warns on mixing a shorthand and its longhands in the same
5424
+ // style object across re-renders, even when one side is
5425
+ // `undefined`. Decomposing into the two longhands always, with
5426
+ // `gap` as their shared fallback, avoids the shorthand entirely.
5427
+ rowGap: gapCss(rowGap ?? gap),
5428
+ columnGap: gapCss(resolvedColumnGap ?? gap),
5367
5429
  width: toCssSize(width),
5368
5430
  height: toCssSize(height),
5369
5431
  maxWidth: toCssSize(maxWidth),
@@ -5433,9 +5495,10 @@ const Columns = React.forwardRef(
5433
5495
  ),
5434
5496
  style: {
5435
5497
  gridTemplateColumns: template ?? ColumnsPresetMap[preset],
5436
- gap: rowGap === void 0 && resolvedColumnGap === void 0 ? gapCss(gap) : void 0,
5437
- rowGap: gapCss(rowGap),
5438
- columnGap: gapCss(resolvedColumnGap),
5498
+ // See Grid's identical comment — never mix the `gap` shorthand
5499
+ // with `rowGap`/`columnGap` longhands in the same style object.
5500
+ rowGap: gapCss(rowGap ?? gap),
5501
+ columnGap: gapCss(resolvedColumnGap ?? gap),
5439
5502
  ...style
5440
5503
  },
5441
5504
  ...props
@@ -17976,9 +18039,47 @@ const SideNav = React.forwardRef(
17976
18039
  ) })
17977
18040
  );
17978
18041
  SideNav.displayName = "SideNav";
18042
+ function useDisclosure(open, defaultOpen, onOpenChange) {
18043
+ const [inner, setInner] = React.useState(defaultOpen);
18044
+ const isOpen = open ?? inner;
18045
+ const setOpen = (next) => {
18046
+ if (open === void 0) setInner(next);
18047
+ onOpenChange == null ? void 0 : onOpenChange(next);
18048
+ };
18049
+ return [isOpen, setOpen];
18050
+ }
17979
18051
  const SideNavGroup = React.forwardRef(
17980
- ({ className, label, children, ...props }, ref) => {
18052
+ ({
18053
+ className,
18054
+ label,
18055
+ collapsible = false,
18056
+ open,
18057
+ defaultOpen = true,
18058
+ onOpenChange,
18059
+ children,
18060
+ ...props
18061
+ }, ref) => {
18062
+ const { collapsed } = React.useContext(SideNavContext);
17981
18063
  const headingId = React.useId();
18064
+ const itemsId = React.useId();
18065
+ const [isOpen, setOpen] = useDisclosure(open, defaultOpen, onOpenChange);
18066
+ if (!collapsible) {
18067
+ return /* @__PURE__ */ jsxs(
18068
+ "div",
18069
+ {
18070
+ ref,
18071
+ role: "group",
18072
+ "aria-labelledby": label ? headingId : void 0,
18073
+ className: cn("side-nav__group", className),
18074
+ ...props,
18075
+ children: [
18076
+ label ? /* @__PURE__ */ jsx("span", { id: headingId, className: "side-nav__heading", children: label }) : null,
18077
+ children
18078
+ ]
18079
+ }
18080
+ );
18081
+ }
18082
+ const shown = collapsed || isOpen;
17982
18083
  return /* @__PURE__ */ jsxs(
17983
18084
  "div",
17984
18085
  {
@@ -17988,8 +18089,22 @@ const SideNavGroup = React.forwardRef(
17988
18089
  className: cn("side-nav__group", className),
17989
18090
  ...props,
17990
18091
  children: [
17991
- label ? /* @__PURE__ */ jsx("span", { id: headingId, className: "side-nav__heading", children: label }) : null,
17992
- children
18092
+ label ? /* @__PURE__ */ jsxs(
18093
+ "button",
18094
+ {
18095
+ type: "button",
18096
+ id: headingId,
18097
+ className: "side-nav__heading side-nav__heading--toggle",
18098
+ "aria-expanded": shown,
18099
+ "aria-controls": itemsId,
18100
+ onClick: () => setOpen(!isOpen),
18101
+ children: [
18102
+ /* @__PURE__ */ jsx("span", { children: label }),
18103
+ /* @__PURE__ */ jsx(ChevronDown, { className: "side-nav__chevron", "aria-hidden": "true" })
18104
+ ]
18105
+ }
18106
+ ) : null,
18107
+ /* @__PURE__ */ jsx("div", { id: itemsId, className: "side-nav__items", hidden: !shown, children })
17993
18108
  ]
17994
18109
  }
17995
18110
  );
@@ -18024,6 +18139,52 @@ const SideNavItem = React.forwardRef(
18024
18139
  }
18025
18140
  );
18026
18141
  SideNavItem.displayName = "SideNavItem";
18142
+ const SideNavBranch = React.forwardRef(
18143
+ ({
18144
+ className,
18145
+ icon,
18146
+ label,
18147
+ active = false,
18148
+ open,
18149
+ defaultOpen = false,
18150
+ onOpenChange,
18151
+ onClick,
18152
+ children,
18153
+ ...props
18154
+ }, ref) => {
18155
+ const { collapsed } = React.useContext(SideNavContext);
18156
+ const subId = React.useId();
18157
+ const [isOpen, setOpen] = useDisclosure(open, defaultOpen, onOpenChange);
18158
+ return /* @__PURE__ */ jsxs("div", { ref, className: cn("side-nav__branch", className), ...props, children: [
18159
+ /* @__PURE__ */ jsxs(
18160
+ "button",
18161
+ {
18162
+ type: "button",
18163
+ className: cn(
18164
+ "side-nav__item",
18165
+ "side-nav__item--branch",
18166
+ active && "side-nav__item--branch-active"
18167
+ ),
18168
+ "aria-expanded": collapsed ? void 0 : isOpen,
18169
+ "aria-controls": subId,
18170
+ "aria-label": collapsed ? label : void 0,
18171
+ title: collapsed ? label : void 0,
18172
+ onClick: (event) => {
18173
+ if (collapsed) onClick == null ? void 0 : onClick(event);
18174
+ else setOpen(!isOpen);
18175
+ },
18176
+ children: [
18177
+ icon ? /* @__PURE__ */ jsx("span", { className: "side-nav__icon", "aria-hidden": "true", children: icon }) : null,
18178
+ /* @__PURE__ */ jsx("span", { className: "side-nav__label", children: label }),
18179
+ /* @__PURE__ */ jsx(ChevronDown, { className: "side-nav__chevron", "aria-hidden": "true" })
18180
+ ]
18181
+ }
18182
+ ),
18183
+ /* @__PURE__ */ jsx("div", { id: subId, className: "side-nav__sub", hidden: collapsed || !isOpen, children })
18184
+ ] });
18185
+ }
18186
+ );
18187
+ SideNavBranch.displayName = "SideNavBranch";
18027
18188
  const RadioCardGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
18028
18189
  RadioGroupPrimitive.Root,
18029
18190
  {
@@ -18114,6 +18275,154 @@ const CenteredPage = React.forwardRef(
18114
18275
  ({ as: Component = "main", className, children, ...props }, ref) => /* @__PURE__ */ jsx(Component, { ref, className: cn("centered-page", className), ...props, children: /* @__PURE__ */ jsx("div", { className: "centered-page__body", children }) })
18115
18276
  );
18116
18277
  CenteredPage.displayName = "CenteredPage";
18278
+ ModuleRegistry.registerModules([AllCommunityModule]);
18279
+ const dataGridTheme = themeQuartz.withParams({
18280
+ fontFamily: "var(--font-mazzard, 'Mazzard Soft M'), sans-serif",
18281
+ fontSize: 14,
18282
+ foregroundColor: "#1f2430",
18283
+ backgroundColor: "#ffffff",
18284
+ accentColor: "#0f748a",
18285
+ borderColor: "#e3e8ef",
18286
+ wrapperBorderRadius: 16,
18287
+ headerBackgroundColor: "#f6f8fb",
18288
+ headerTextColor: "#6b7280",
18289
+ headerFontSize: 12,
18290
+ headerFontWeight: 600,
18291
+ // The pinned (action) column joins the rest of the row; no divider line.
18292
+ pinnedColumnBorder: false,
18293
+ rowHoverColor: "#f4f9fd",
18294
+ columnBorder: false,
18295
+ headerColumnBorder: false,
18296
+ // The resize handle stays (the column still drags) but is drawn as a faint tick, not a separator line.
18297
+ headerColumnResizeHandleColor: "transparent",
18298
+ spacing: 8
18299
+ });
18300
+ const ALIGN_CLASS = {
18301
+ left: void 0,
18302
+ center: "data-grid__cell--center",
18303
+ right: "data-grid__cell--right"
18304
+ };
18305
+ function shapeOf(columns) {
18306
+ return JSON.stringify(
18307
+ columns.map((c) => [
18308
+ c.key,
18309
+ c.header,
18310
+ c.sortable ?? false,
18311
+ c.filter ?? false,
18312
+ c.resizable ?? true,
18313
+ c.width ?? null,
18314
+ c.minWidth ?? null,
18315
+ c.flex ?? null,
18316
+ c.align ?? null,
18317
+ c.pinned ?? null,
18318
+ c.wrap ?? false,
18319
+ Boolean(c.value),
18320
+ Boolean(c.cell)
18321
+ ])
18322
+ );
18323
+ }
18324
+ function DataGrid({
18325
+ columns,
18326
+ rows,
18327
+ getRowId,
18328
+ loading = false,
18329
+ emptyText = "Nothing to show.",
18330
+ quickFilter,
18331
+ sort,
18332
+ onSortChange,
18333
+ onRowClick,
18334
+ className,
18335
+ "aria-label": ariaLabel
18336
+ }) {
18337
+ const serverSorted = onSortChange !== void 0;
18338
+ const latest = React.useRef(columns);
18339
+ latest.current = columns;
18340
+ const shape = shapeOf(columns);
18341
+ const sortKey = (sort == null ? void 0 : sort.key) ?? null;
18342
+ const sortDirection = (sort == null ? void 0 : sort.direction) ?? null;
18343
+ const columnDefs = React.useMemo(
18344
+ () => latest.current.map((column) => {
18345
+ const fixed = column.width !== void 0;
18346
+ const find = () => latest.current.find((c) => c.key === column.key);
18347
+ return {
18348
+ colId: column.key,
18349
+ headerName: column.header,
18350
+ valueGetter: column.value ? (params) => {
18351
+ var _a, _b;
18352
+ return params.data ? (_b = (_a = find()) == null ? void 0 : _a.value) == null ? void 0 : _b.call(_a, params.data) : void 0;
18353
+ } : void 0,
18354
+ cellRenderer: column.cell ? (params) => {
18355
+ var _a, _b;
18356
+ return params.data ? (_b = (_a = find()) == null ? void 0 : _a.cell) == null ? void 0 : _b.call(_a, params.data) : null;
18357
+ } : void 0,
18358
+ sortable: column.sortable ?? false,
18359
+ filter: column.filter ?? false,
18360
+ resizable: column.resizable ?? true,
18361
+ suppressMovable: true,
18362
+ width: column.width,
18363
+ minWidth: column.minWidth ?? (fixed ? column.width : 96),
18364
+ flex: fixed ? void 0 : column.flex ?? 1,
18365
+ pinned: column.pinned,
18366
+ wrapText: column.wrap ?? false,
18367
+ autoHeight: column.wrap ?? false,
18368
+ cellClass: column.align ? ALIGN_CLASS[column.align] : void 0,
18369
+ headerClass: column.align ? ALIGN_CLASS[column.align] : void 0,
18370
+ // Server-sorted data keeps the order it arrived in; the grid only draws the indicator.
18371
+ ...serverSorted ? {
18372
+ comparator: () => 0,
18373
+ // Server-side sort has no "no sort": clicking again flips the direction.
18374
+ sortingOrder: ["asc", "desc"],
18375
+ sort: sortKey === column.key ? sortDirection : null
18376
+ } : {}
18377
+ };
18378
+ }),
18379
+ // `shape` stands for the column list; the list itself is a new array on most renders.
18380
+ // eslint-disable-next-line react-hooks/exhaustive-deps
18381
+ [shape, serverSorted, sortKey, sortDirection]
18382
+ );
18383
+ const handleSortChanged = React.useCallback(
18384
+ (event) => {
18385
+ if (!serverSorted) return;
18386
+ const active = event.api.getColumnState().find((state) => state.sort);
18387
+ const next = (active == null ? void 0 : active.colId) ? { key: active.colId, direction: active.sort === "desc" ? "desc" : "asc" } : null;
18388
+ if ((next == null ? void 0 : next.key) === (sort == null ? void 0 : sort.key) && (next == null ? void 0 : next.direction) === (sort == null ? void 0 : sort.direction)) return;
18389
+ if (!next && !sort) return;
18390
+ onSortChange == null ? void 0 : onSortChange(next);
18391
+ },
18392
+ [serverSorted, sort, onSortChange]
18393
+ );
18394
+ return /* @__PURE__ */ jsx(
18395
+ "div",
18396
+ {
18397
+ role: "region",
18398
+ "aria-label": ariaLabel,
18399
+ className: cn(
18400
+ "data-grid",
18401
+ rows.length === 0 && "data-grid--empty",
18402
+ onRowClick && "data-grid--clickable",
18403
+ className
18404
+ ),
18405
+ children: /* @__PURE__ */ jsx(
18406
+ AgGridReact,
18407
+ {
18408
+ theme: dataGridTheme,
18409
+ rowData: rows,
18410
+ columnDefs,
18411
+ domLayout: "autoHeight",
18412
+ rowHeight: 64,
18413
+ headerHeight: 48,
18414
+ loading,
18415
+ quickFilterText: quickFilter,
18416
+ getRowId: getRowId ? (params) => getRowId(params.data) : void 0,
18417
+ onSortChanged: handleSortChanged,
18418
+ onRowClicked: onRowClick ? (event) => event.data && onRowClick(event.data) : void 0,
18419
+ suppressCellFocus: true,
18420
+ localeText: { noRowsToShow: emptyText }
18421
+ }
18422
+ )
18423
+ }
18424
+ );
18425
+ }
18117
18426
  const iconButtonVariants = cva("icon-button", {
18118
18427
  variants: {
18119
18428
  size: {
@@ -18283,6 +18592,7 @@ export {
18283
18592
  ContextMenuTrigger,
18284
18593
  Copy,
18285
18594
  CreditCardPreview,
18595
+ DataGrid,
18286
18596
  DatePicker,
18287
18597
  DateRangePicker,
18288
18598
  Dialog,
@@ -18523,6 +18833,7 @@ export {
18523
18833
  SheetTrigger,
18524
18834
  Show,
18525
18835
  SideNav,
18836
+ SideNavBranch,
18526
18837
  SideNavGroup,
18527
18838
  SideNavItem,
18528
18839
  Sidebar,
@@ -18551,6 +18862,7 @@ export {
18551
18862
  StandardNavigation,
18552
18863
  StatusPill,
18553
18864
  Stepper,
18865
+ Swatch,
18554
18866
  Switch,
18555
18867
  SwitchV01,
18556
18868
  SystemBar,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syscore/ui-library",
3
- "version": "2.0.0-beta-publish-workflow-beta.11",
3
+ "version": "2.0.0-beta-publish-workflow-beta.13",
4
4
  "description": "A comprehensive React component library built with Radix UI, Tailwind CSS, and TypeScript",
5
5
  "private": false,
6
6
  "type": "module",
@@ -70,6 +70,8 @@
70
70
  "@radix-ui/react-toggle": "^1.1.9",
71
71
  "@radix-ui/react-toggle-group": "^1.1.10",
72
72
  "@radix-ui/react-tooltip": "^1.2.8",
73
+ "ag-grid-community": "35.3.0",
74
+ "ag-grid-react": "35.3.0",
73
75
  "class-variance-authority": "^0.7.1",
74
76
  "clsx": "^2.1.1",
75
77
  "cmdk": "^1.1.1",