@plumile/ui 0.1.154 → 0.1.157

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.
@@ -1,4 +1,5 @@
1
1
  /* empty css */
2
+ /* empty css */
2
3
  /* empty css */
3
4
  //#region src/atomic/molecules/markdown/components/MarkdownArticleContainer.css.ts
4
5
  var e = "_7ez1431 _7ez1430 txvbqbfpn txvbqbh4x txvbqbheb";
@@ -1,5 +1,4 @@
1
1
  /* empty css */
2
- /* empty css */
3
2
  /* empty css */
4
3
  //#region src/atomic/molecules/markdown/components/MarkdownInlineCode.css.ts
5
4
  var e = "_12obj0m1 _12obj0m0 txvbqb11hm txvbqb12f7 txvbqb12hd txvbqbxtg txvbqb2t9 txvbqbh99 txvbqbu4k txvbqbws9 txvbqb1ax2 txvbqb1arn";
@@ -10,22 +10,23 @@ var f = u, p = (e, t, n, r = !1) => t == null ? typeof e.isActive == "boolean" ?
10
10
  let w = v.some((e) => e.to != null), T = b != null && !w, E = v.some((e) => typeof e.isActive == "boolean"), D = o({ variant: S });
11
11
  y === "nav" && (D = e(D, _));
12
12
  let O = v.map((e) => {
13
- let { disabled: t, id: n, label: i, to: a } = e, o = p(e, m, C, E), s = "default";
14
- t ? s = "disabled" : o && (s = "active");
15
- let l = r({
16
- state: s,
13
+ let { disabled: t, id: n, label: i, preloadOnMouseEnter: a, to: o } = e, s = p(e, m, C, E), l = "default";
14
+ t ? l = "disabled" : s && (l = "active");
15
+ let u = r({
16
+ state: l,
17
17
  variant: S
18
- }), u;
19
- t && (u = !0);
20
- let d;
21
- if (o && a != null && (d = "page"), a != null) {
18
+ }), d;
19
+ t && (d = !0);
20
+ let h;
21
+ if (s && o != null && (h = "page"), o != null) {
22
22
  let e;
23
23
  return t && (e = -1), /* @__PURE__ */ c(f, {
24
24
  exact: !0,
25
- "aria-current": d,
26
- "aria-disabled": u,
27
- className: l,
28
- to: a,
25
+ "aria-current": h,
26
+ "aria-disabled": d,
27
+ className: u,
28
+ to: o,
29
+ preloadOnMouseEnter: a,
29
30
  tabIndex: e,
30
31
  onClick: (e) => {
31
32
  t && e.preventDefault();
@@ -36,20 +37,20 @@ var f = u, p = (e, t, n, r = !1) => t == null ? typeof e.isActive == "boolean" ?
36
37
  if (b != null) return /* @__PURE__ */ c("button", {
37
38
  type: "button",
38
39
  role: "tab",
39
- "aria-selected": o,
40
- "aria-disabled": u,
41
- className: l,
40
+ "aria-selected": s,
41
+ "aria-disabled": d,
42
+ className: u,
42
43
  disabled: t,
43
44
  onClick: () => {
44
45
  t || b(n);
45
46
  },
46
47
  children: i
47
48
  }, n);
48
- let h;
49
- return o && (h = "page"), /* @__PURE__ */ c("span", {
50
- "aria-current": h,
51
- "aria-disabled": u,
52
- className: l,
49
+ let g;
50
+ return s && (g = "page"), /* @__PURE__ */ c("span", {
51
+ "aria-current": g,
52
+ "aria-disabled": d,
53
+ className: u,
53
54
  children: i
54
55
  }, n);
55
56
  }), k = T ? /* @__PURE__ */ c("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.js","names":[],"sources":["../../../../../src/atomic/molecules/tabs/Tabs.tsx"],"sourcesContent":["import {\n type AnchorHTMLAttributes,\n type ComponentPropsWithoutRef,\n type HTMLAttributes,\n type JSX,\n type MouseEvent,\n type ReactNode,\n} from 'react';\nimport Link from '@plumile/router/routing/Link.js';\nimport useLocation from '@plumile/router/routing/useLocation.js';\n\nimport * as styles from './tabs.css.js';\nimport { cx } from '../../../theme/tools.js';\n\nexport type TabsSelectEvent = MouseEvent<HTMLButtonElement | HTMLAnchorElement>;\n\ntype LinkComponentProps = ComponentPropsWithoutRef<typeof Link>;\ntype RouterLinkProps = LinkComponentProps &\n AnchorHTMLAttributes<HTMLAnchorElement>;\nconst RouterLink = Link as unknown as (props: RouterLinkProps) => JSX.Element;\n\nexport type TabItem = {\n id: string;\n label: ReactNode;\n to?: LinkComponentProps['to'];\n disabled?: boolean;\n isActive?: boolean;\n};\n\nexport type TabsVariant = 'line' | 'pill' | 'underline' | 'page';\n\nexport type TabsProps = {\n items: readonly TabItem[];\n activeId?: string;\n onChange?: (id: string) => void;\n ariaLabel?: string;\n children?: ReactNode;\n className?: string;\n layout?: 'nav' | 'content';\n panelClassName?: string;\n variant?: TabsVariant;\n};\n\nconst resolveItemIsActive = (\n item: TabItem,\n activeId: string | undefined,\n pathname: string | undefined,\n hasExplicitActiveItem = false,\n): boolean => {\n if (activeId != null) {\n return item.id === activeId;\n }\n\n if (typeof item.isActive === 'boolean') {\n return item.isActive;\n }\n\n if (hasExplicitActiveItem) {\n return false;\n }\n\n if (item.to != null && pathname != null) {\n return pathname === item.to;\n }\n\n return false;\n};\n\nexport const Tabs = (props: TabsProps): JSX.Element | null => {\n const {\n activeId,\n ariaLabel,\n children,\n className,\n items,\n layout = 'nav',\n onChange,\n panelClassName,\n variant = 'line',\n } = props;\n const { pathname } = useLocation();\n\n if (items.length === 0) {\n return null;\n }\n\n const hasNavigationItems = items.some((item) => {\n return item.to != null;\n });\n const isControlled = onChange != null && !hasNavigationItems;\n const hasExplicitActiveItem = items.some((item) => {\n return typeof item.isActive === 'boolean';\n });\n let rootClassName = styles.tabsRecipe({ variant });\n if (layout === 'nav') {\n rootClassName = cx(rootClassName, className);\n }\n\n const content = items.map((item) => {\n const { disabled, id, label, to } = item;\n const isActive = resolveItemIsActive(\n item,\n activeId,\n pathname,\n hasExplicitActiveItem,\n );\n\n type TabState = NonNullable<\n Parameters<typeof styles.tabRecipe>[0]\n >['state'];\n let tabState: TabState = 'default';\n if (disabled) {\n tabState = 'disabled';\n } else if (isActive) {\n tabState = 'active';\n }\n\n const tabClassName = styles.tabRecipe({ state: tabState, variant });\n let ariaDisabled: true | undefined;\n if (disabled) {\n ariaDisabled = true;\n }\n let ariaCurrent: 'page' | undefined;\n if (isActive && to != null) {\n ariaCurrent = 'page';\n }\n\n if (to != null) {\n let tabIndex: number | undefined;\n if (disabled) {\n tabIndex = -1;\n }\n\n const handleLinkClick = (event: MouseEvent<HTMLAnchorElement>) => {\n if (disabled) {\n event.preventDefault();\n }\n };\n\n return (\n <RouterLink\n key={id}\n exact\n aria-current={ariaCurrent}\n aria-disabled={ariaDisabled}\n className={tabClassName}\n to={to}\n tabIndex={tabIndex}\n onClick={handleLinkClick}\n >\n {label}\n </RouterLink>\n );\n }\n\n if (onChange != null) {\n return (\n <button\n key={id}\n type=\"button\"\n role=\"tab\"\n aria-selected={isActive}\n aria-disabled={ariaDisabled}\n className={tabClassName}\n disabled={disabled}\n onClick={() => {\n if (!disabled) {\n onChange(id);\n }\n }}\n >\n {label}\n </button>\n );\n }\n\n let staticAriaCurrent: 'page' | undefined;\n if (isActive) {\n staticAriaCurrent = 'page';\n }\n\n return (\n <span\n key={id}\n aria-current={staticAriaCurrent}\n aria-disabled={ariaDisabled}\n className={tabClassName}\n >\n {label}\n </span>\n );\n });\n\n const renderRoot = (): JSX.Element => {\n if (isControlled) {\n return (\n <div className={rootClassName} role=\"tablist\" aria-label={ariaLabel}>\n {content}\n </div>\n );\n }\n\n if (hasNavigationItems) {\n return (\n <nav aria-label={ariaLabel} className={rootClassName}>\n {content}\n </nav>\n );\n }\n\n return <div className={rootClassName}>{content}</div>;\n };\n\n const nav = renderRoot();\n\n if (layout !== 'content') {\n return nav;\n }\n\n const wrapperProps: HTMLAttributes<HTMLDivElement> = {\n className: cx(styles.wrapper, className),\n };\n\n return (\n <div {...wrapperProps}>\n <div className={styles.tabsBar}>\n <div className={styles.tabsInner}>{nav}</div>\n </div>\n <div className={styles.panels}>\n <section role=\"tabpanel\" className={cx(styles.panel, panelClassName)}>\n {children}\n </section>\n </div>\n </div>\n );\n};\n\nexport const __test = {\n resolveItemIsActive,\n} as const;\n"],"mappings":";;;;;;AAmBA,IAAM,IAAa,GAwBb,KACJ,GACA,GACA,GACA,IAAwB,OAEpB,KAAY,OAIZ,OAAO,EAAK,YAAa,YACpB,EAAK,WAGV,IACK,KAGL,EAAK,MAAM,QAAQ,KAAY,OAC1B,MAAa,EAAK,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,GAsBK,IAnBA,IAEA,kBAAC,OAAD;EAAK,WAAW;EAAe,MAAK;EAAU,cAAY;YACvD;CACE,CAAA,IAIL,IAEA,kBAAC,OAAD;EAAK,cAAY;EAAW,WAAW;YACpC;CACE,CAAA,IAIF,kBAAC,OAAD;EAAK,WAAW;YAAgB;CAAa,CAAA;CAatD,OARI,MAAW,YASb,kBAAC,OAAD;EAJA,WAAW,EAAG,GAAgB,CAAS;YAIvC,CACE,kBAAC,OAAD;GAAK,WAAW;aACd,kBAAC,OAAD;IAAK,WAAW;cAAmB;GAAS,CAAA;EACzC,CAAA,GACL,kBAAC,OAAD;GAAK,WAAW;aACd,kBAAC,WAAD;IAAS,MAAK;IAAW,WAAW,EAAG,GAAc,CAAc;IAChE;GACM,CAAA;EACN,CAAA,CACF;MAjBE;AAmBX,GAEa,IAAS,EACpB,uBACF"}
1
+ {"version":3,"file":"Tabs.js","names":[],"sources":["../../../../../src/atomic/molecules/tabs/Tabs.tsx"],"sourcesContent":["import {\n type AnchorHTMLAttributes,\n type ComponentPropsWithoutRef,\n type HTMLAttributes,\n type JSX,\n type MouseEvent,\n type ReactNode,\n} from 'react';\nimport Link from '@plumile/router/routing/Link.js';\nimport useLocation from '@plumile/router/routing/useLocation.js';\n\nimport * as styles from './tabs.css.js';\nimport { cx } from '../../../theme/tools.js';\n\nexport type TabsSelectEvent = MouseEvent<HTMLButtonElement | HTMLAnchorElement>;\n\ntype LinkComponentProps = ComponentPropsWithoutRef<typeof Link>;\ntype RouterLinkProps = LinkComponentProps &\n AnchorHTMLAttributes<HTMLAnchorElement>;\nconst RouterLink = Link as unknown as (props: RouterLinkProps) => JSX.Element;\n\nexport type TabItem = {\n id: string;\n label: ReactNode;\n to?: LinkComponentProps['to'];\n preloadOnMouseEnter?: LinkComponentProps['preloadOnMouseEnter'];\n disabled?: boolean;\n isActive?: boolean;\n};\n\nexport type TabsVariant = 'line' | 'pill' | 'underline' | 'page';\n\nexport type TabsProps = {\n items: readonly TabItem[];\n activeId?: string;\n onChange?: (id: string) => void;\n ariaLabel?: string;\n children?: ReactNode;\n className?: string;\n layout?: 'nav' | 'content';\n panelClassName?: string;\n variant?: TabsVariant;\n};\n\nconst resolveItemIsActive = (\n item: TabItem,\n activeId: string | undefined,\n pathname: string | undefined,\n hasExplicitActiveItem = false,\n): boolean => {\n if (activeId != null) {\n return item.id === activeId;\n }\n\n if (typeof item.isActive === 'boolean') {\n return item.isActive;\n }\n\n if (hasExplicitActiveItem) {\n return false;\n }\n\n if (item.to != null && pathname != null) {\n return pathname === item.to;\n }\n\n return false;\n};\n\nexport const Tabs = (props: TabsProps): JSX.Element | null => {\n const {\n activeId,\n ariaLabel,\n children,\n className,\n items,\n layout = 'nav',\n onChange,\n panelClassName,\n variant = 'line',\n } = props;\n const { pathname } = useLocation();\n\n if (items.length === 0) {\n return null;\n }\n\n const hasNavigationItems = items.some((item) => {\n return item.to != null;\n });\n const isControlled = onChange != null && !hasNavigationItems;\n const hasExplicitActiveItem = items.some((item) => {\n return typeof item.isActive === 'boolean';\n });\n let rootClassName = styles.tabsRecipe({ variant });\n if (layout === 'nav') {\n rootClassName = cx(rootClassName, className);\n }\n\n const content = items.map((item) => {\n const { disabled, id, label, preloadOnMouseEnter, to } = item;\n const isActive = resolveItemIsActive(\n item,\n activeId,\n pathname,\n hasExplicitActiveItem,\n );\n\n type TabState = NonNullable<\n Parameters<typeof styles.tabRecipe>[0]\n >['state'];\n let tabState: TabState = 'default';\n if (disabled) {\n tabState = 'disabled';\n } else if (isActive) {\n tabState = 'active';\n }\n\n const tabClassName = styles.tabRecipe({ state: tabState, variant });\n let ariaDisabled: true | undefined;\n if (disabled) {\n ariaDisabled = true;\n }\n let ariaCurrent: 'page' | undefined;\n if (isActive && to != null) {\n ariaCurrent = 'page';\n }\n\n if (to != null) {\n let tabIndex: number | undefined;\n if (disabled) {\n tabIndex = -1;\n }\n\n const handleLinkClick = (event: MouseEvent<HTMLAnchorElement>) => {\n if (disabled) {\n event.preventDefault();\n }\n };\n\n return (\n <RouterLink\n key={id}\n exact\n aria-current={ariaCurrent}\n aria-disabled={ariaDisabled}\n className={tabClassName}\n to={to}\n preloadOnMouseEnter={preloadOnMouseEnter}\n tabIndex={tabIndex}\n onClick={handleLinkClick}\n >\n {label}\n </RouterLink>\n );\n }\n\n if (onChange != null) {\n return (\n <button\n key={id}\n type=\"button\"\n role=\"tab\"\n aria-selected={isActive}\n aria-disabled={ariaDisabled}\n className={tabClassName}\n disabled={disabled}\n onClick={() => {\n if (!disabled) {\n onChange(id);\n }\n }}\n >\n {label}\n </button>\n );\n }\n\n let staticAriaCurrent: 'page' | undefined;\n if (isActive) {\n staticAriaCurrent = 'page';\n }\n\n return (\n <span\n key={id}\n aria-current={staticAriaCurrent}\n aria-disabled={ariaDisabled}\n className={tabClassName}\n >\n {label}\n </span>\n );\n });\n\n const renderRoot = (): JSX.Element => {\n if (isControlled) {\n return (\n <div className={rootClassName} role=\"tablist\" aria-label={ariaLabel}>\n {content}\n </div>\n );\n }\n\n if (hasNavigationItems) {\n return (\n <nav aria-label={ariaLabel} className={rootClassName}>\n {content}\n </nav>\n );\n }\n\n return <div className={rootClassName}>{content}</div>;\n };\n\n const nav = renderRoot();\n\n if (layout !== 'content') {\n return nav;\n }\n\n const wrapperProps: HTMLAttributes<HTMLDivElement> = {\n className: cx(styles.wrapper, className),\n };\n\n return (\n <div {...wrapperProps}>\n <div className={styles.tabsBar}>\n <div className={styles.tabsInner}>{nav}</div>\n </div>\n <div className={styles.panels}>\n <section role=\"tabpanel\" className={cx(styles.panel, panelClassName)}>\n {children}\n </section>\n </div>\n </div>\n );\n};\n\nexport const __test = {\n resolveItemIsActive,\n} as const;\n"],"mappings":";;;;;;AAmBA,IAAM,IAAa,GAyBb,KACJ,GACA,GACA,GACA,IAAwB,OAEpB,KAAY,OAIZ,OAAO,EAAK,YAAa,YACpB,EAAK,WAGV,IACK,KAGL,EAAK,MAAM,QAAQ,KAAY,OAC1B,MAAa,EAAK,KAGpB,KAfE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AC,GAsBK,IAnBA,IAEA,kBAAC,OAAD;EAAK,WAAW;EAAe,MAAK;EAAU,cAAY;YACvD;CACE,CAAA,IAIL,IAEA,kBAAC,OAAD;EAAK,cAAY;EAAW,WAAW;YACpC;CACE,CAAA,IAIF,kBAAC,OAAD;EAAK,WAAW;YAAgB;CAAa,CAAA;CAatD,OARI,MAAW,YASb,kBAAC,OAAD;EAJA,WAAW,EAAG,GAAgB,CAAS;YAIvC,CACE,kBAAC,OAAD;GAAK,WAAW;aACd,kBAAC,OAAD;IAAK,WAAW;cAAmB;GAAS,CAAA;EACzC,CAAA,GACL,kBAAC,OAAD;GAAK,WAAW;aACd,kBAAC,WAAD;IAAS,MAAK;IAAW,WAAW,EAAG,GAAc,CAAc;IAChE;GACM,CAAA;EACN,CAAA,CACF;MAjBE;AAmBX,GAEa,IAAS,EACpB,uBACF"}
@@ -5,7 +5,7 @@ import { clamp as ee, computeVirtualWindowBounds as te, isVerticallyScrollable a
5
5
  import { useCallback as d, useEffect as f, useLayoutEffect as p, useMemo as m, useRef as h, useState as re } from "react";
6
6
  import { Fragment as ie, jsx as g, jsxs as _ } from "react/jsx-runtime";
7
7
  //#region src/components/data-table/VirtualizedConnectionTable.tsx
8
- var v = (e) => {
8
+ var ae = (e) => {
9
9
  let t = e;
10
10
  for (; t != null;) {
11
11
  if (u({
@@ -16,73 +16,77 @@ var v = (e) => {
16
16
  t = t.parentElement;
17
17
  }
18
18
  return null;
19
- }, y = ({ columns: u, rows: y, getRowId: b, emptyState: ae, className: oe, headerClassName: se, bodyClassName: ce, rowClassName: x, gridTemplateClassName: S, gridTemplateColumns: C, kind: w, density: T, headerBehavior: le, rowState: E, classes: D, bodyScrollMode: O = "page", bodyFooterNode: ue, virtualization: k, infiniteScroll: A, hasNextPage: j = !1, isLoadingMore: M = !1, onLoadMore: N, ariaLabel: de, ariaLabelledBy: fe }) => {
20
- let P = h(null), F = h(null), I = h(null), L = h(null), R = h(null), z = h(null), B = h(!1), V = k?.enabled === !0, H = m(() => {
19
+ }, v = ({ columns: u, rows: v, getRowId: y, emptyState: oe, className: se, headerClassName: ce, bodyClassName: le, rowClassName: b, gridTemplateClassName: x, gridTemplateColumns: S, kind: C, density: w, headerBehavior: ue, rowState: T, classes: E, bodyScrollMode: D = "page", bodyFooterNode: de, virtualization: O, infiniteScroll: k, hasNextPage: A = !1, isLoadingMore: j = !1, onLoadMore: M, ariaLabel: fe, ariaLabelledBy: pe }) => {
20
+ let N = h(null), P = h(null), F = h(null), I = h(null), L = h(null), R = h(null), z = h(null), B = h(!1), V = O?.enabled === !0, H = m(() => {
21
21
  if (!V) return null;
22
- let e = k.rowHeightPx;
22
+ let e = O.rowHeightPx;
23
23
  return typeof e == "number" && Number.isFinite(e) && e > 0 ? e : 56;
24
- }, [V, k]), U = m(() => {
24
+ }, [V, O]), U = m(() => {
25
25
  if (!V) return 0;
26
- let e = 10, t = k.overscan;
26
+ let e = 10, t = O.overscan;
27
27
  return typeof t == "number" && Number.isFinite(t) && (e = t), Math.max(0, e);
28
- }, [V, k]), W = A?.thresholdPx ?? 800, G = A?.autoLoad ?? !0, K = A?.enabled === !0, q = O === "contained", J = K && j && !M && N != null, Y = d(() => {
29
- N?.();
30
- }, [N]), [pe, me] = re(() => ({
28
+ }, [V, O]), W = k?.thresholdPx ?? 800, G = k?.autoLoad ?? !0, K = k?.enabled === !0, q = D === "contained", J = K && A && !j && M != null, Y = d(() => {
29
+ M?.();
30
+ }, [M]), X = d(() => {
31
+ B.current = !0, z.current != null && window.clearTimeout(z.current), z.current = window.setTimeout(() => {
32
+ B.current = !1, z.current = null;
33
+ }, 250);
34
+ }, []), [me, he] = re(() => ({
31
35
  startIndex: 0,
32
- endIndex: Math.min(y.length, 50)
33
- })), X = d((e, t, n) => {
36
+ endIndex: Math.min(v.length, 50)
37
+ })), ge = d((e, t, n) => {
34
38
  let r = {};
35
39
  return typeof n == "number" && (r.height = n), /* @__PURE__ */ g(i, {
36
40
  row: e,
37
41
  index: t,
38
42
  columns: u,
39
- getRowId: b,
40
- kind: w,
41
- density: T,
42
- rowClassName: x,
43
- rowState: E,
44
- gridTemplateClassName: S,
45
- gridTemplateColumns: C,
46
- classes: D,
43
+ getRowId: y,
44
+ kind: C,
45
+ density: w,
46
+ rowClassName: b,
47
+ rowState: T,
48
+ gridTemplateClassName: x,
49
+ gridTemplateColumns: S,
50
+ classes: E,
47
51
  style: r,
48
52
  cellMode: "singleLine"
49
- }, b(e, t));
53
+ }, y(e, t));
50
54
  }, [
51
- D,
55
+ E,
52
56
  u,
53
- T,
54
- b,
55
- S,
56
- C,
57
57
  w,
58
+ y,
58
59
  x,
59
- E
60
- ]), Z = d(() => {
60
+ S,
61
+ C,
62
+ b,
63
+ T
64
+ ]), _e = d(() => {
61
65
  if (!V) return;
62
66
  let e = H;
63
67
  if (e == null) return;
64
- let t = I.current;
68
+ let t = F.current;
65
69
  if (t == null) return;
66
- let n = F.current, r = R.current, i = r?.clientHeight ?? window.innerHeight, a = 0;
70
+ let n = P.current, r = L.current, i = r?.clientHeight ?? window.innerHeight, a = 0;
67
71
  if (q && n != null) i = n.clientHeight, a = n.scrollTop;
68
72
  else {
69
73
  let e = r?.getBoundingClientRect().top ?? 0, n = t.getBoundingClientRect().top - e;
70
74
  a = Math.max(0, -n);
71
75
  }
72
- let s = a + i, c = y.length * e, l = ee(s, 0, c), { startIndex: u, endIndex: d } = te({
73
- rowCount: y.length,
76
+ let s = a + i, c = v.length * e, l = ee(s, 0, c), { startIndex: u, endIndex: d } = te({
77
+ rowCount: v.length,
74
78
  rowHeightPx: e,
75
79
  overscan: U,
76
80
  visibleTop: a,
77
81
  visibleBottom: s
78
82
  });
79
- me((e) => e.startIndex === u && e.endIndex === d ? e : {
83
+ he((e) => e.startIndex === u && e.endIndex === d ? e : {
80
84
  startIndex: u,
81
85
  endIndex: d
82
86
  }), o({
83
87
  enabled: K,
84
- hasNext: j,
85
- isLoading: M,
88
+ hasNext: A,
89
+ isLoading: j,
86
90
  autoLoad: G,
87
91
  isCoolingDown: B.current
88
92
  }) && J && ne({
@@ -92,64 +96,63 @@ var v = (e) => {
92
96
  visibleBottom: l,
93
97
  thresholdPx: W,
94
98
  isCoolingDown: B.current
95
- }) && (B.current = !0, Y(), window.setTimeout(() => {
96
- B.current = !1;
97
- }, 250));
99
+ }) && (X(), Y());
98
100
  }, [
99
101
  G,
100
102
  J,
101
- j,
103
+ A,
102
104
  q,
103
105
  V,
104
106
  K,
105
- M,
107
+ j,
106
108
  U,
107
109
  H,
108
- y.length,
110
+ v.length,
111
+ X,
109
112
  W,
110
113
  Y
111
- ]), Q = d(() => {
112
- z.current ??= window.requestAnimationFrame(() => {
113
- z.current = null, Z();
114
+ ]), Z = d(() => {
115
+ R.current ??= window.requestAnimationFrame(() => {
116
+ R.current = null, _e();
114
117
  });
115
- }, [Z]);
116
- p(() => {
118
+ }, [_e]);
119
+ f(() => () => {
120
+ R.current != null && (window.cancelAnimationFrame(R.current), R.current = null), z.current != null && (window.clearTimeout(z.current), z.current = null);
121
+ }, []), p(() => {
117
122
  if (!V) return;
118
- let e = P.current;
119
- e != null && (q ? R.current = F.current : R.current = v(e), Q());
123
+ let e = N.current;
124
+ e != null && (q ? L.current = P.current : L.current = ae(e), Z());
120
125
  }, [
121
126
  q,
122
127
  V,
123
- Q
128
+ Z
124
129
  ]), f(() => {
125
130
  if (!V) return;
126
- let e = R.current ?? window, t = () => {
127
- Q();
131
+ let e = L.current ?? window, t = () => {
132
+ Z();
128
133
  };
129
134
  return e.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), () => {
130
135
  e.removeEventListener("scroll", t), window.removeEventListener("resize", t);
131
136
  };
132
- }, [V, Q]), f(() => {
137
+ }, [V, Z]), f(() => {
133
138
  if (V || !o({
134
139
  enabled: K,
135
- hasNext: j,
136
- isLoading: M,
140
+ hasNext: A,
141
+ isLoading: j,
137
142
  autoLoad: G,
138
143
  isCoolingDown: !1
139
144
  }) || !J) return;
140
- let e = L.current;
145
+ let e = I.current;
141
146
  if (e == null || typeof window > "u" || typeof IntersectionObserver > "u") return;
142
- let t = R.current, n = new IntersectionObserver((e) => {
147
+ let t = L.current, n = new IntersectionObserver((e) => {
143
148
  let [t] = e;
144
149
  t != null && t.isIntersecting && o({
145
150
  enabled: K,
146
- hasNext: j,
147
- isLoading: M,
151
+ hasNext: A,
152
+ isLoading: j,
148
153
  autoLoad: G,
149
154
  isCoolingDown: B.current
150
- }) && (B.current = !0, Y(), window.setTimeout(() => {
151
- B.current = !1;
152
- }, 250));
155
+ }) && (X(), Y());
153
156
  }, {
154
157
  root: t,
155
158
  rootMargin: a({ thresholdPx: W })
@@ -160,77 +163,78 @@ var v = (e) => {
160
163
  }, [
161
164
  G,
162
165
  J,
163
- j,
166
+ A,
164
167
  K,
165
168
  V,
166
- M,
169
+ j,
170
+ X,
167
171
  W,
168
172
  Y
169
173
  ]), p(() => {
170
174
  if (V) return;
171
- let e = P.current;
172
- e != null && (q ? R.current = F.current : R.current = v(e));
175
+ let e = N.current;
176
+ e != null && (q ? L.current = P.current : L.current = ae(e));
173
177
  }, [q, V]);
174
- let $;
175
- if (y.length === 0) $ = /* @__PURE__ */ g(t, {
176
- emptyState: ae,
177
- density: T,
178
- classes: D
178
+ let Q;
179
+ if (v.length === 0) Q = /* @__PURE__ */ g(t, {
180
+ emptyState: oe,
181
+ density: w,
182
+ classes: E
179
183
  });
180
184
  else if (V && H != null) {
181
- let { startIndex: e, endIndex: t } = pe, n = e * H, r = (y.length - t) * H, i = y.slice(e, t);
182
- $ = /* @__PURE__ */ _("div", {
185
+ let { startIndex: e, endIndex: t } = me, n = e * H, r = (v.length - t) * H, i = v.slice(e, t);
186
+ Q = /* @__PURE__ */ _("div", {
183
187
  className: s,
184
- ref: I,
188
+ ref: F,
185
189
  children: [
186
190
  /* @__PURE__ */ g("div", {
187
191
  className: l,
188
192
  style: { height: n }
189
193
  }),
190
- i.map((t, n) => X(t, e + n, H)),
194
+ i.map((t, n) => ge(t, e + n, H)),
191
195
  /* @__PURE__ */ g("div", {
192
196
  className: l,
193
197
  style: { height: r }
194
198
  })
195
199
  ]
196
200
  });
197
- } else $ = /* @__PURE__ */ g(ie, { children: y.map((e, t) => X(e, t, null)) });
198
- let he = null;
199
- return !V && K && G && (he = /* @__PURE__ */ g("div", {
200
- ref: L,
201
+ } else Q = /* @__PURE__ */ g(ie, { children: v.map((e, t) => ge(e, t, null)) });
202
+ let $ = null;
203
+ return !V && K && G && ($ = /* @__PURE__ */ g("div", {
204
+ ref: I,
201
205
  className: c
202
206
  })), /* @__PURE__ */ _(r, {
203
- ref: P,
204
- className: oe,
205
- kind: w,
206
- bodyScrollMode: O,
207
- classes: D,
208
- ariaLabel: de,
209
- ariaLabelledBy: fe,
207
+ ref: N,
208
+ className: se,
209
+ kind: C,
210
+ bodyScrollMode: D,
211
+ classes: E,
212
+ ariaLabel: fe,
213
+ ariaLabelledBy: pe,
210
214
  children: [/* @__PURE__ */ g(n, {
211
215
  columns: u,
212
- kind: w,
213
- density: T,
214
- headerBehavior: le,
215
- headerClassName: se,
216
- gridTemplateClassName: S,
217
- gridTemplateColumns: C,
218
- classes: D
216
+ kind: C,
217
+ density: w,
218
+ headerBehavior: ue,
219
+ headerClassName: ce,
220
+ gridTemplateClassName: x,
221
+ gridTemplateColumns: S,
222
+ classes: E
219
223
  }), /* @__PURE__ */ _(e, {
220
- ref: F,
221
- className: ce,
222
- kind: w,
223
- bodyScrollMode: O,
224
- classes: D,
224
+ ref: P,
225
+ className: le,
226
+ kind: C,
227
+ bodyScrollMode: D,
228
+ classes: E,
225
229
  children: [
230
+ Q,
226
231
  $,
227
- he,
228
- ue
232
+ de
229
233
  ]
230
234
  })]
231
235
  });
232
236
  };
233
237
  //#endregion
234
- export { y as VirtualizedConnectionTable };
238
+ export { v as VirtualizedConnectionTable };
235
239
 
236
240
  //# sourceMappingURL=VirtualizedConnectionTable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizedConnectionTable.js","names":[],"sources":["../../../../src/components/data-table/VirtualizedConnectionTable.tsx"],"sourcesContent":["import {\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type JSX,\n type ReactNode,\n} from 'react';\n\nimport {\n DataTableBody,\n DataTableEmptyRow,\n DataTableHeader,\n DataTableRoot,\n DataTableRow,\n type DataTableBodyScrollMode,\n type DataTableColumn,\n type DataTableDensity,\n type DataTableHeaderBehavior,\n type DataTableKind,\n type DataTableRowState,\n type DataTableSlot,\n type GetRowId,\n} from './DataTable.js';\nimport * as styles from './VirtualizedConnectionTable.css.js';\n\nimport {\n clamp,\n computeVirtualWindowBounds,\n isVerticallyScrollable,\n shouldTriggerVirtualizedInfiniteLoad,\n type VirtualWindow,\n} from '../../internal/data-table/virtualization.js';\nimport {\n resolveInfiniteRootMargin,\n shouldTriggerInfiniteLoad,\n} from '../../internal/infinite/infiniteLoad.js';\nimport type { SlotClasses } from '../../styles/slots.js';\n\nexport type VirtualizationConfig = {\n enabled: boolean;\n rowHeightPx: number;\n overscan: number;\n};\n\nexport type InfiniteScrollConfig = {\n enabled: boolean;\n thresholdPx?: number;\n autoLoad?: boolean;\n};\n\nexport type VirtualizedConnectionTableProps<Row> = {\n columns: readonly DataTableColumn<Row>[];\n rows: readonly Row[];\n getRowId: GetRowId<Row>;\n emptyState?: JSX.Element;\n className?: string;\n headerClassName?: string;\n bodyClassName?: string;\n rowClassName?: (row: Row, index: number) => string | null | undefined;\n gridTemplateClassName?: string;\n gridTemplateColumns?: string;\n kind?: DataTableKind;\n density?: DataTableDensity;\n headerBehavior?: DataTableHeaderBehavior;\n rowState?: (row: Row, index: number) => DataTableRowState;\n classes?: SlotClasses<DataTableSlot>;\n bodyScrollMode?: DataTableBodyScrollMode;\n bodyFooterNode?: ReactNode;\n\n virtualization?: VirtualizationConfig;\n\n infiniteScroll?: InfiniteScrollConfig;\n hasNextPage?: boolean;\n isLoadingMore?: boolean;\n onLoadMore?: () => void;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n};\n\nconst findScrollParent = (el: HTMLElement | null): HTMLElement | null => {\n let current: HTMLElement | null = el;\n while (current != null) {\n const style = window.getComputedStyle(current);\n if (\n isVerticallyScrollable({\n overflowY: style.overflowY,\n scrollHeight: current.scrollHeight,\n clientHeight: current.clientHeight,\n })\n ) {\n return current;\n }\n current = current.parentElement;\n }\n return null;\n};\n\nexport const VirtualizedConnectionTable = <Row,>({\n columns,\n rows,\n getRowId,\n emptyState,\n className,\n headerClassName,\n bodyClassName,\n rowClassName,\n gridTemplateClassName,\n gridTemplateColumns,\n kind,\n density,\n headerBehavior,\n rowState,\n classes,\n bodyScrollMode = 'page',\n bodyFooterNode,\n virtualization,\n infiniteScroll,\n hasNextPage = false,\n isLoadingMore = false,\n onLoadMore,\n ariaLabel,\n ariaLabelledBy,\n}: VirtualizedConnectionTableProps<Row>): JSX.Element => {\n const containerRef = useRef<HTMLDivElement>(null);\n const bodyScrollerRef = useRef<HTMLDivElement>(null);\n const bodyRef = useRef<HTMLDivElement>(null);\n const sentinelRef = useRef<HTMLDivElement>(null);\n const scrollParentRef = useRef<HTMLElement | null>(null);\n const rafRef = useRef<number | null>(null);\n const loadMoreCooldownRef = useRef(false);\n\n const isVirtualized = virtualization?.enabled === true;\n const rowHeightPx = useMemo(() => {\n if (!isVirtualized) {\n return null;\n }\n\n const configuredRowHeight = virtualization.rowHeightPx;\n if (\n typeof configuredRowHeight === 'number' &&\n Number.isFinite(configuredRowHeight) &&\n configuredRowHeight > 0\n ) {\n return configuredRowHeight;\n }\n\n return 56;\n }, [isVirtualized, virtualization]);\n\n const overscan = useMemo(() => {\n if (!isVirtualized) {\n return 0;\n }\n\n let nextOverscan = 10;\n const configuredOverscan = virtualization.overscan;\n if (\n typeof configuredOverscan === 'number' &&\n Number.isFinite(configuredOverscan)\n ) {\n nextOverscan = configuredOverscan;\n }\n return Math.max(0, nextOverscan);\n }, [isVirtualized, virtualization]);\n\n const thresholdPx = infiniteScroll?.thresholdPx ?? 800;\n const autoLoad = infiniteScroll?.autoLoad ?? true;\n const infiniteEnabled = infiniteScroll?.enabled === true;\n const hasContainedBodyScroll = bodyScrollMode === 'contained';\n\n const canLoadMore =\n infiniteEnabled && hasNextPage && !isLoadingMore && onLoadMore != null;\n\n const triggerLoadMore = useCallback(() => {\n if (onLoadMore == null) {\n return;\n }\n onLoadMore();\n }, [onLoadMore]);\n\n const [windowState, setWindowState] = useState<VirtualWindow>(() => {\n return { startIndex: 0, endIndex: Math.min(rows.length, 50) };\n });\n\n const renderRow = useCallback(\n (row: Row, index: number, heightPx?: number | null): JSX.Element => {\n const rowStyle: CSSProperties = {};\n if (typeof heightPx === 'number') {\n rowStyle.height = heightPx;\n }\n return (\n <DataTableRow\n key={getRowId(row, index)}\n row={row}\n index={index}\n columns={columns}\n getRowId={getRowId}\n kind={kind}\n density={density}\n rowClassName={rowClassName}\n rowState={rowState}\n gridTemplateClassName={gridTemplateClassName}\n gridTemplateColumns={gridTemplateColumns}\n classes={classes}\n style={rowStyle}\n cellMode=\"singleLine\"\n />\n );\n },\n [\n classes,\n columns,\n density,\n getRowId,\n gridTemplateClassName,\n gridTemplateColumns,\n kind,\n rowClassName,\n rowState,\n ],\n );\n\n const computeVirtualWindow = useCallback(() => {\n if (!isVirtualized) {\n return;\n }\n const height = rowHeightPx;\n if (height == null) {\n return;\n }\n const bodyEl = bodyRef.current;\n if (bodyEl == null) {\n return;\n }\n\n const bodyScroller = bodyScrollerRef.current;\n const scrollParent = scrollParentRef.current;\n let viewportHeight = scrollParent?.clientHeight ?? window.innerHeight;\n let visibleTop = 0;\n if (hasContainedBodyScroll && bodyScroller != null) {\n viewportHeight = bodyScroller.clientHeight;\n visibleTop = bodyScroller.scrollTop;\n } else {\n const parentRectTop = scrollParent?.getBoundingClientRect().top ?? 0;\n const bodyRectTop = bodyEl.getBoundingClientRect().top;\n const relativeTop = bodyRectTop - parentRectTop;\n visibleTop = Math.max(0, -relativeTop);\n }\n const visibleBottom = visibleTop + viewportHeight;\n\n const totalHeight = rows.length * height;\n const clampedBottom = clamp(visibleBottom, 0, totalHeight);\n const { startIndex, endIndex } = computeVirtualWindowBounds({\n rowCount: rows.length,\n rowHeightPx: height,\n overscan,\n visibleTop,\n visibleBottom,\n });\n\n setWindowState((prev) => {\n if (prev.startIndex === startIndex && prev.endIndex === endIndex) {\n return prev;\n }\n return { startIndex, endIndex };\n });\n\n if (\n shouldTriggerInfiniteLoad({\n enabled: infiniteEnabled,\n hasNext: hasNextPage,\n isLoading: isLoadingMore,\n autoLoad,\n isCoolingDown: loadMoreCooldownRef.current,\n }) &&\n canLoadMore &&\n shouldTriggerVirtualizedInfiniteLoad({\n autoLoad,\n canLoadMore,\n totalHeight,\n visibleBottom: clampedBottom,\n thresholdPx,\n isCoolingDown: loadMoreCooldownRef.current,\n })\n ) {\n loadMoreCooldownRef.current = true;\n triggerLoadMore();\n window.setTimeout(() => {\n loadMoreCooldownRef.current = false;\n }, 250);\n }\n }, [\n autoLoad,\n canLoadMore,\n hasNextPage,\n hasContainedBodyScroll,\n isVirtualized,\n infiniteEnabled,\n isLoadingMore,\n overscan,\n rowHeightPx,\n rows.length,\n thresholdPx,\n triggerLoadMore,\n ]);\n\n const scheduleCompute = useCallback(() => {\n if (rafRef.current != null) {\n return;\n }\n rafRef.current = window.requestAnimationFrame(() => {\n rafRef.current = null;\n computeVirtualWindow();\n });\n }, [computeVirtualWindow]);\n\n useLayoutEffect(() => {\n if (!isVirtualized) {\n return;\n }\n const container = containerRef.current;\n if (container == null) {\n return;\n }\n if (hasContainedBodyScroll) {\n scrollParentRef.current = bodyScrollerRef.current;\n } else {\n scrollParentRef.current = findScrollParent(container);\n }\n scheduleCompute();\n }, [hasContainedBodyScroll, isVirtualized, scheduleCompute]);\n\n useEffect(() => {\n if (!isVirtualized) {\n return undefined;\n }\n const scrollParent = scrollParentRef.current;\n const target: HTMLElement | Window = scrollParent ?? window;\n\n const handler = () => {\n scheduleCompute();\n };\n\n target.addEventListener('scroll', handler, { passive: true });\n window.addEventListener('resize', handler);\n\n return () => {\n target.removeEventListener('scroll', handler);\n window.removeEventListener('resize', handler);\n };\n }, [isVirtualized, scheduleCompute]);\n\n useEffect(() => {\n if (isVirtualized) {\n return undefined;\n }\n if (\n !shouldTriggerInfiniteLoad({\n enabled: infiniteEnabled,\n hasNext: hasNextPage,\n isLoading: isLoadingMore,\n autoLoad,\n isCoolingDown: false,\n }) ||\n !canLoadMore\n ) {\n return undefined;\n }\n const sentinel = sentinelRef.current;\n if (sentinel == null) {\n return undefined;\n }\n if (\n typeof window === 'undefined' ||\n typeof IntersectionObserver === 'undefined'\n ) {\n return undefined;\n }\n\n const scrollParent = scrollParentRef.current;\n\n const observer = new IntersectionObserver(\n (entries) => {\n const [entry] = entries;\n if (entry == null) {\n return;\n }\n\n if (\n entry.isIntersecting &&\n shouldTriggerInfiniteLoad({\n enabled: infiniteEnabled,\n hasNext: hasNextPage,\n isLoading: isLoadingMore,\n autoLoad,\n isCoolingDown: loadMoreCooldownRef.current,\n })\n ) {\n loadMoreCooldownRef.current = true;\n triggerLoadMore();\n window.setTimeout(() => {\n loadMoreCooldownRef.current = false;\n }, 250);\n }\n },\n {\n root: scrollParent,\n rootMargin: resolveInfiniteRootMargin({ thresholdPx }),\n },\n );\n\n observer.observe(sentinel);\n return () => {\n observer.disconnect();\n };\n }, [\n autoLoad,\n canLoadMore,\n hasNextPage,\n infiniteEnabled,\n isVirtualized,\n isLoadingMore,\n thresholdPx,\n triggerLoadMore,\n ]);\n\n useLayoutEffect(() => {\n if (isVirtualized) {\n return;\n }\n const container = containerRef.current;\n if (container == null) {\n return;\n }\n if (hasContainedBodyScroll) {\n scrollParentRef.current = bodyScrollerRef.current;\n } else {\n scrollParentRef.current = findScrollParent(container);\n }\n }, [hasContainedBodyScroll, isVirtualized]);\n\n let bodyRows: JSX.Element;\n if (rows.length === 0) {\n bodyRows = (\n <DataTableEmptyRow\n emptyState={emptyState}\n density={density}\n classes={classes}\n />\n );\n } else if (isVirtualized && rowHeightPx != null) {\n const { startIndex, endIndex } = windowState;\n const topSpacerHeight = startIndex * rowHeightPx;\n const bottomSpacerHeight = (rows.length - endIndex) * rowHeightPx;\n const slice = rows.slice(startIndex, endIndex);\n bodyRows = (\n <div className={styles.bodyViewport} ref={bodyRef}>\n <div className={styles.spacer} style={{ height: topSpacerHeight }} />\n {slice.map((row, sliceIndex) => {\n const absoluteIndex = startIndex + sliceIndex;\n return renderRow(row, absoluteIndex, rowHeightPx);\n })}\n <div className={styles.spacer} style={{ height: bottomSpacerHeight }} />\n </div>\n );\n } else {\n bodyRows = (\n <>\n {rows.map((row, index) => {\n return renderRow(row, index, null);\n })}\n </>\n );\n }\n\n let sentinelNode: JSX.Element | null = null;\n if (!isVirtualized && infiniteEnabled && autoLoad) {\n sentinelNode = <div ref={sentinelRef} className={styles.sentinel} />;\n }\n\n return (\n <DataTableRoot\n ref={containerRef}\n className={className}\n kind={kind}\n bodyScrollMode={bodyScrollMode}\n classes={classes}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n >\n <DataTableHeader\n columns={columns}\n kind={kind}\n density={density}\n headerBehavior={headerBehavior}\n headerClassName={headerClassName}\n gridTemplateClassName={gridTemplateClassName}\n gridTemplateColumns={gridTemplateColumns}\n classes={classes}\n />\n <DataTableBody\n ref={bodyScrollerRef}\n className={bodyClassName}\n kind={kind}\n bodyScrollMode={bodyScrollMode}\n classes={classes}\n >\n {bodyRows}\n {sentinelNode}\n {bodyFooterNode}\n </DataTableBody>\n </DataTableRoot>\n );\n};\n"],"mappings":";;;;;;;AAmFA,IAAM,KAAoB,MAA+C;CACvE,IAAI,IAA8B;CAClC,OAAO,KAAW,OAAM;EAEtB,IACE,EAAuB;GACrB,WAHU,OAAO,iBAAiB,CAGvB,EAAM;GACjB,cAAc,EAAQ;GACtB,cAAc,EAAQ;EACxB,CAAC,GAED,OAAO;EAET,IAAU,EAAQ;CACpB;CACA,OAAO;AACT,GAEa,KAAoC,EAC/C,YACA,SACA,a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G;EACD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,GAED,QAAsB;EACpB,IAAI,GACF;EAEF,IAAM,IAAY,EAAa;EAC3B,KAAa,SAGb,IACF,EAAgB,UAAU,EAAgB,UAE1C,EAAgB,UAAU,EAAiB,CAAS;CAExD,GAAG,CAAC,GAAwB,CAAa,CAAC;CAE1C,IAAI;CACJ,IAAI,EAAK,WAAW,GAClB,IACE,kBAAC,GAAD;EACc;EACH;EACA;CACV,CAAA;MAEE,IAAI,KAAiB,KAAe,MAAM;EAC/C,IAAM,EAAE,eAAY,gBAAa,IAC3B,IAAkB,IAAa,GAC/B,KAAsB,EAAK,SAAS,KAAY,GAChD,IAAQ,EAAK,MAAM,GAAY,CAAQ;EAC7C,IACE,kBAAC,OAAD;GAAK,WAAW;GAAqB,KAAK;aAA1C;IACE,kBAAC,OAAD;KAAK,WAAW;KAAe,OAAO,EAAE,QAAQ,EAAgB;IAAI,CAAA;IACnE,EAAM,KAAK,GAAK,MAER,EAAU,GADK,IAAa,GACE,CAAW,CACjD;IACD,kBAAC,OAAD;KAAK,WAAW;KAAe,OAAO,EAAE,QAAQ,EAAmB;IAAI,CAAA;GACpE;;CAET,OACE,IACE,kBAAA,IAAA,EAAA,UACG,EAAK,KAAK,GAAK,MACP,EAAU,GAAK,GAAO,IAAI,CAClC,EACD,CAAA;CAIN,IAAI,KAAmC;CAKvC,OAJI,CAAC,KAAiB,KAAmB,MACvC,KAAe,kBAAC,OAAD;EAAK,KAAK;EAAa,WAAW;CAAkB,CAAA,IAInE,kBAAC,GAAD;EACE,KAAK;EACM;EACL;EACU;EACP;EACE;EACK;YAPlB,CASE,kBAAC,GAAD;GACW;GACH;GACG;GACO;GACC;GACM;GACF;GACZ;EACV,CAAA,GACD,kBAAC,GAAD;GACE,KAAK;GACL,WAAW;GACL;GACU;GACP;aALX;IAOG;IACA;IACA;GACY;IACF;;AAEnB"}
1
+ {"version":3,"file":"VirtualizedConnectionTable.js","names":[],"sources":["../../../../src/components/data-table/VirtualizedConnectionTable.tsx"],"sourcesContent":["import {\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type JSX,\n type ReactNode,\n} from 'react';\n\nimport {\n DataTableBody,\n DataTableEmptyRow,\n DataTableHeader,\n DataTableRoot,\n DataTableRow,\n type DataTableBodyScrollMode,\n type DataTableColumn,\n type DataTableDensity,\n type DataTableHeaderBehavior,\n type DataTableKind,\n type DataTableRowState,\n type DataTableSlot,\n type GetRowId,\n} from './DataTable.js';\nimport * as styles from './VirtualizedConnectionTable.css.js';\n\nimport {\n clamp,\n computeVirtualWindowBounds,\n isVerticallyScrollable,\n shouldTriggerVirtualizedInfiniteLoad,\n type VirtualWindow,\n} from '../../internal/data-table/virtualization.js';\nimport {\n resolveInfiniteRootMargin,\n shouldTriggerInfiniteLoad,\n} from '../../internal/infinite/infiniteLoad.js';\nimport type { SlotClasses } from '../../styles/slots.js';\n\nexport type VirtualizationConfig = {\n enabled: boolean;\n rowHeightPx: number;\n overscan: number;\n};\n\nexport type InfiniteScrollConfig = {\n enabled: boolean;\n thresholdPx?: number;\n autoLoad?: boolean;\n};\n\nexport type VirtualizedConnectionTableProps<Row> = {\n columns: readonly DataTableColumn<Row>[];\n rows: readonly Row[];\n getRowId: GetRowId<Row>;\n emptyState?: JSX.Element;\n className?: string;\n headerClassName?: string;\n bodyClassName?: string;\n rowClassName?: (row: Row, index: number) => string | null | undefined;\n gridTemplateClassName?: string;\n gridTemplateColumns?: string;\n kind?: DataTableKind;\n density?: DataTableDensity;\n headerBehavior?: DataTableHeaderBehavior;\n rowState?: (row: Row, index: number) => DataTableRowState;\n classes?: SlotClasses<DataTableSlot>;\n bodyScrollMode?: DataTableBodyScrollMode;\n bodyFooterNode?: ReactNode;\n\n virtualization?: VirtualizationConfig;\n\n infiniteScroll?: InfiniteScrollConfig;\n hasNextPage?: boolean;\n isLoadingMore?: boolean;\n onLoadMore?: () => void;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n};\n\nconst findScrollParent = (el: HTMLElement | null): HTMLElement | null => {\n let current: HTMLElement | null = el;\n while (current != null) {\n const style = window.getComputedStyle(current);\n if (\n isVerticallyScrollable({\n overflowY: style.overflowY,\n scrollHeight: current.scrollHeight,\n clientHeight: current.clientHeight,\n })\n ) {\n return current;\n }\n current = current.parentElement;\n }\n return null;\n};\n\nexport const VirtualizedConnectionTable = <Row,>({\n columns,\n rows,\n getRowId,\n emptyState,\n className,\n headerClassName,\n bodyClassName,\n rowClassName,\n gridTemplateClassName,\n gridTemplateColumns,\n kind,\n density,\n headerBehavior,\n rowState,\n classes,\n bodyScrollMode = 'page',\n bodyFooterNode,\n virtualization,\n infiniteScroll,\n hasNextPage = false,\n isLoadingMore = false,\n onLoadMore,\n ariaLabel,\n ariaLabelledBy,\n}: VirtualizedConnectionTableProps<Row>): JSX.Element => {\n const containerRef = useRef<HTMLDivElement>(null);\n const bodyScrollerRef = useRef<HTMLDivElement>(null);\n const bodyRef = useRef<HTMLDivElement>(null);\n const sentinelRef = useRef<HTMLDivElement>(null);\n const scrollParentRef = useRef<HTMLElement | null>(null);\n const rafRef = useRef<number | null>(null);\n const cooldownTimeoutRef = useRef<number | null>(null);\n const loadMoreCooldownRef = useRef(false);\n\n const isVirtualized = virtualization?.enabled === true;\n const rowHeightPx = useMemo(() => {\n if (!isVirtualized) {\n return null;\n }\n\n const configuredRowHeight = virtualization.rowHeightPx;\n if (\n typeof configuredRowHeight === 'number' &&\n Number.isFinite(configuredRowHeight) &&\n configuredRowHeight > 0\n ) {\n return configuredRowHeight;\n }\n\n return 56;\n }, [isVirtualized, virtualization]);\n\n const overscan = useMemo(() => {\n if (!isVirtualized) {\n return 0;\n }\n\n let nextOverscan = 10;\n const configuredOverscan = virtualization.overscan;\n if (\n typeof configuredOverscan === 'number' &&\n Number.isFinite(configuredOverscan)\n ) {\n nextOverscan = configuredOverscan;\n }\n return Math.max(0, nextOverscan);\n }, [isVirtualized, virtualization]);\n\n const thresholdPx = infiniteScroll?.thresholdPx ?? 800;\n const autoLoad = infiniteScroll?.autoLoad ?? true;\n const infiniteEnabled = infiniteScroll?.enabled === true;\n const hasContainedBodyScroll = bodyScrollMode === 'contained';\n\n const canLoadMore =\n infiniteEnabled && hasNextPage && !isLoadingMore && onLoadMore != null;\n\n const triggerLoadMore = useCallback(() => {\n if (onLoadMore == null) {\n return;\n }\n onLoadMore();\n }, [onLoadMore]);\n\n const startLoadMoreCooldown = useCallback(() => {\n loadMoreCooldownRef.current = true;\n if (cooldownTimeoutRef.current != null) {\n window.clearTimeout(cooldownTimeoutRef.current);\n }\n cooldownTimeoutRef.current = window.setTimeout(() => {\n loadMoreCooldownRef.current = false;\n cooldownTimeoutRef.current = null;\n }, 250);\n }, []);\n\n const [windowState, setWindowState] = useState<VirtualWindow>(() => {\n return { startIndex: 0, endIndex: Math.min(rows.length, 50) };\n });\n\n const renderRow = useCallback(\n (row: Row, index: number, heightPx?: number | null): JSX.Element => {\n const rowStyle: CSSProperties = {};\n if (typeof heightPx === 'number') {\n rowStyle.height = heightPx;\n }\n return (\n <DataTableRow\n key={getRowId(row, index)}\n row={row}\n index={index}\n columns={columns}\n getRowId={getRowId}\n kind={kind}\n density={density}\n rowClassName={rowClassName}\n rowState={rowState}\n gridTemplateClassName={gridTemplateClassName}\n gridTemplateColumns={gridTemplateColumns}\n classes={classes}\n style={rowStyle}\n cellMode=\"singleLine\"\n />\n );\n },\n [\n classes,\n columns,\n density,\n getRowId,\n gridTemplateClassName,\n gridTemplateColumns,\n kind,\n rowClassName,\n rowState,\n ],\n );\n\n const computeVirtualWindow = useCallback(() => {\n if (!isVirtualized) {\n return;\n }\n const height = rowHeightPx;\n if (height == null) {\n return;\n }\n const bodyEl = bodyRef.current;\n if (bodyEl == null) {\n return;\n }\n\n const bodyScroller = bodyScrollerRef.current;\n const scrollParent = scrollParentRef.current;\n let viewportHeight = scrollParent?.clientHeight ?? window.innerHeight;\n let visibleTop = 0;\n if (hasContainedBodyScroll && bodyScroller != null) {\n viewportHeight = bodyScroller.clientHeight;\n visibleTop = bodyScroller.scrollTop;\n } else {\n const parentRectTop = scrollParent?.getBoundingClientRect().top ?? 0;\n const bodyRectTop = bodyEl.getBoundingClientRect().top;\n const relativeTop = bodyRectTop - parentRectTop;\n visibleTop = Math.max(0, -relativeTop);\n }\n const visibleBottom = visibleTop + viewportHeight;\n\n const totalHeight = rows.length * height;\n const clampedBottom = clamp(visibleBottom, 0, totalHeight);\n const { startIndex, endIndex } = computeVirtualWindowBounds({\n rowCount: rows.length,\n rowHeightPx: height,\n overscan,\n visibleTop,\n visibleBottom,\n });\n\n setWindowState((prev) => {\n if (prev.startIndex === startIndex && prev.endIndex === endIndex) {\n return prev;\n }\n return { startIndex, endIndex };\n });\n\n if (\n shouldTriggerInfiniteLoad({\n enabled: infiniteEnabled,\n hasNext: hasNextPage,\n isLoading: isLoadingMore,\n autoLoad,\n isCoolingDown: loadMoreCooldownRef.current,\n }) &&\n canLoadMore &&\n shouldTriggerVirtualizedInfiniteLoad({\n autoLoad,\n canLoadMore,\n totalHeight,\n visibleBottom: clampedBottom,\n thresholdPx,\n isCoolingDown: loadMoreCooldownRef.current,\n })\n ) {\n startLoadMoreCooldown();\n triggerLoadMore();\n }\n }, [\n autoLoad,\n canLoadMore,\n hasNextPage,\n hasContainedBodyScroll,\n isVirtualized,\n infiniteEnabled,\n isLoadingMore,\n overscan,\n rowHeightPx,\n rows.length,\n startLoadMoreCooldown,\n thresholdPx,\n triggerLoadMore,\n ]);\n\n const scheduleCompute = useCallback(() => {\n if (rafRef.current != null) {\n return;\n }\n rafRef.current = window.requestAnimationFrame(() => {\n rafRef.current = null;\n computeVirtualWindow();\n });\n }, [computeVirtualWindow]);\n\n useEffect(() => {\n return () => {\n if (rafRef.current != null) {\n window.cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n if (cooldownTimeoutRef.current != null) {\n window.clearTimeout(cooldownTimeoutRef.current);\n cooldownTimeoutRef.current = null;\n }\n };\n }, []);\n\n useLayoutEffect(() => {\n if (!isVirtualized) {\n return;\n }\n const container = containerRef.current;\n if (container == null) {\n return;\n }\n if (hasContainedBodyScroll) {\n scrollParentRef.current = bodyScrollerRef.current;\n } else {\n scrollParentRef.current = findScrollParent(container);\n }\n scheduleCompute();\n }, [hasContainedBodyScroll, isVirtualized, scheduleCompute]);\n\n useEffect(() => {\n if (!isVirtualized) {\n return undefined;\n }\n const scrollParent = scrollParentRef.current;\n const target: HTMLElement | Window = scrollParent ?? window;\n\n const handler = () => {\n scheduleCompute();\n };\n\n target.addEventListener('scroll', handler, { passive: true });\n window.addEventListener('resize', handler);\n\n return () => {\n target.removeEventListener('scroll', handler);\n window.removeEventListener('resize', handler);\n };\n }, [isVirtualized, scheduleCompute]);\n\n useEffect(() => {\n if (isVirtualized) {\n return undefined;\n }\n if (\n !shouldTriggerInfiniteLoad({\n enabled: infiniteEnabled,\n hasNext: hasNextPage,\n isLoading: isLoadingMore,\n autoLoad,\n isCoolingDown: false,\n }) ||\n !canLoadMore\n ) {\n return undefined;\n }\n const sentinel = sentinelRef.current;\n if (sentinel == null) {\n return undefined;\n }\n if (\n typeof window === 'undefined' ||\n typeof IntersectionObserver === 'undefined'\n ) {\n return undefined;\n }\n\n const scrollParent = scrollParentRef.current;\n\n const observer = new IntersectionObserver(\n (entries) => {\n const [entry] = entries;\n if (entry == null) {\n return;\n }\n\n if (\n entry.isIntersecting &&\n shouldTriggerInfiniteLoad({\n enabled: infiniteEnabled,\n hasNext: hasNextPage,\n isLoading: isLoadingMore,\n autoLoad,\n isCoolingDown: loadMoreCooldownRef.current,\n })\n ) {\n startLoadMoreCooldown();\n triggerLoadMore();\n }\n },\n {\n root: scrollParent,\n rootMargin: resolveInfiniteRootMargin({ thresholdPx }),\n },\n );\n\n observer.observe(sentinel);\n return () => {\n observer.disconnect();\n };\n }, [\n autoLoad,\n canLoadMore,\n hasNextPage,\n infiniteEnabled,\n isVirtualized,\n isLoadingMore,\n startLoadMoreCooldown,\n thresholdPx,\n triggerLoadMore,\n ]);\n\n useLayoutEffect(() => {\n if (isVirtualized) {\n return;\n }\n const container = containerRef.current;\n if (container == null) {\n return;\n }\n if (hasContainedBodyScroll) {\n scrollParentRef.current = bodyScrollerRef.current;\n } else {\n scrollParentRef.current = findScrollParent(container);\n }\n }, [hasContainedBodyScroll, isVirtualized]);\n\n let bodyRows: JSX.Element;\n if (rows.length === 0) {\n bodyRows = (\n <DataTableEmptyRow\n emptyState={emptyState}\n density={density}\n classes={classes}\n />\n );\n } else if (isVirtualized && rowHeightPx != null) {\n const { startIndex, endIndex } = windowState;\n const topSpacerHeight = startIndex * rowHeightPx;\n const bottomSpacerHeight = (rows.length - endIndex) * rowHeightPx;\n const slice = rows.slice(startIndex, endIndex);\n bodyRows = (\n <div className={styles.bodyViewport} ref={bodyRef}>\n <div className={styles.spacer} style={{ height: topSpacerHeight }} />\n {slice.map((row, sliceIndex) => {\n const absoluteIndex = startIndex + sliceIndex;\n return renderRow(row, absoluteIndex, rowHeightPx);\n })}\n <div className={styles.spacer} style={{ height: bottomSpacerHeight }} />\n </div>\n );\n } else {\n bodyRows = (\n <>\n {rows.map((row, index) => {\n return renderRow(row, index, null);\n })}\n </>\n );\n }\n\n let sentinelNode: JSX.Element | null = null;\n if (!isVirtualized && infiniteEnabled && autoLoad) {\n sentinelNode = <div ref={sentinelRef} className={styles.sentinel} />;\n }\n\n return (\n <DataTableRoot\n ref={containerRef}\n className={className}\n kind={kind}\n bodyScrollMode={bodyScrollMode}\n classes={classes}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n >\n <DataTableHeader\n columns={columns}\n kind={kind}\n density={density}\n headerBehavior={headerBehavior}\n headerClassName={headerClassName}\n gridTemplateClassName={gridTemplateClassName}\n gridTemplateColumns={gridTemplateColumns}\n classes={classes}\n />\n <DataTableBody\n ref={bodyScrollerRef}\n className={bodyClassName}\n kind={kind}\n bodyScrollMode={bodyScrollMode}\n classes={classes}\n >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