twico-ui 1.18.2 → 1.19.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.mjs CHANGED
@@ -7875,11 +7875,15 @@ function Tooltip({
7875
7875
  placement = "top",
7876
7876
  delay = 120,
7877
7877
  className = "",
7878
+ open: openProp,
7879
+ anchor,
7878
7880
  ...rest
7879
7881
  }) {
7880
7882
  const __twcStyles = useScopedStyles("twc-tooltip-styles", TOOLTIP_CSS);
7883
+ const anchored = anchor !== void 0;
7881
7884
  const id = React51__default.useId();
7882
- const [show, setShow] = React51__default.useState(false);
7885
+ const [showU, setShowU] = React51__default.useState(false);
7886
+ const show = anchored ? !!openProp : showU;
7883
7887
  const [coords, setCoords] = React51__default.useState(null);
7884
7888
  const timer = React51__default.useRef(null);
7885
7889
  const closeTimer = React51__default.useRef(null);
@@ -7888,12 +7892,12 @@ function Tooltip({
7888
7892
  const open = () => {
7889
7893
  clearTimeout(closeTimer.current);
7890
7894
  clearTimeout(timer.current);
7891
- timer.current = setTimeout(() => setShow(true), delay);
7895
+ timer.current = setTimeout(() => setShowU(true), delay);
7892
7896
  };
7893
7897
  const close = () => {
7894
7898
  clearTimeout(timer.current);
7895
7899
  clearTimeout(closeTimer.current);
7896
- closeTimer.current = setTimeout(() => setShow(false), 120);
7900
+ closeTimer.current = setTimeout(() => setShowU(false), 120);
7897
7901
  };
7898
7902
  const cancelClose = () => {
7899
7903
  clearTimeout(closeTimer.current);
@@ -7903,8 +7907,8 @@ function Tooltip({
7903
7907
  clearTimeout(closeTimer.current);
7904
7908
  }, []);
7905
7909
  const place = React51__default.useCallback(() => {
7906
- const el = wrapRef.current;
7907
- if (!el) return;
7910
+ const el = anchored ? anchor : wrapRef.current;
7911
+ if (!el || !el.getBoundingClientRect) return;
7908
7912
  const r2 = el.getBoundingClientRect();
7909
7913
  const cx = Math.round(r2.left + r2.width / 2), cy = Math.round(r2.top + r2.height / 2);
7910
7914
  const vw = window.innerWidth, vh = window.innerHeight, gap = 8, margin = 8;
@@ -7936,7 +7940,7 @@ function Tooltip({
7936
7940
  const c = clampX(cx);
7937
7941
  setCoords({ ...base, left: c, bottom: Math.round(vh - r2.top + gap), arrowX: arrowX(c) });
7938
7942
  }
7939
- }, [placement]);
7943
+ }, [placement, anchored, anchor]);
7940
7944
  React51__default.useEffect(() => {
7941
7945
  place();
7942
7946
  }, [place]);
@@ -7952,16 +7956,50 @@ function Tooltip({
7952
7956
  };
7953
7957
  }, [show, place]);
7954
7958
  React51__default.useEffect(() => {
7955
- if (!show) return;
7959
+ if (!show || anchored) return;
7956
7960
  const onKeyDown = (e) => {
7957
7961
  if (e.key === "Escape") {
7958
7962
  clearTimeout(timer.current);
7959
- setShow(false);
7963
+ setShowU(false);
7960
7964
  }
7961
7965
  };
7962
7966
  document.addEventListener("keydown", onKeyDown);
7963
7967
  return () => document.removeEventListener("keydown", onKeyDown);
7964
- }, [show]);
7968
+ }, [show, anchored]);
7969
+ const bubble = coords && (!anchored || anchor) ? createPortal(
7970
+ /* @__PURE__ */ jsxs(
7971
+ "span",
7972
+ {
7973
+ ref: tipRef,
7974
+ id,
7975
+ className: "twc-tooltip",
7976
+ "data-place": coords.place || placement,
7977
+ "data-show": show || void 0,
7978
+ role: "tooltip",
7979
+ "aria-hidden": show ? void 0 : "true",
7980
+ onMouseEnter: anchored ? void 0 : cancelClose,
7981
+ onMouseLeave: anchored ? void 0 : close,
7982
+ style: {
7983
+ position: "fixed",
7984
+ left: coords.left,
7985
+ right: coords.right,
7986
+ top: coords.top,
7987
+ bottom: coords.bottom,
7988
+ "--_tw-arrow-x": coords.arrowX != null ? `${coords.arrowX}px` : void 0,
7989
+ "--_tw-arrow-y": coords.arrowY != null ? `${coords.arrowY}px` : void 0
7990
+ },
7991
+ children: [
7992
+ label,
7993
+ /* @__PURE__ */ jsx("span", { className: "twc-tooltip__arrow", "aria-hidden": "true" })
7994
+ ]
7995
+ }
7996
+ ),
7997
+ document.body
7998
+ ) : null;
7999
+ if (anchored) return /* @__PURE__ */ jsxs(Fragment, { children: [
8000
+ __twcStyles,
8001
+ bubble
8002
+ ] });
7965
8003
  const describedBy = show ? id : void 0;
7966
8004
  const trigger = React51__default.isValidElement(children) && children.type !== React51__default.Fragment ? React51__default.cloneElement(children, {
7967
8005
  "aria-describedby": [children.props["aria-describedby"], describedBy].filter(Boolean).join(" ") || void 0
@@ -7979,36 +8017,7 @@ function Tooltip({
7979
8017
  children: [
7980
8018
  __twcStyles,
7981
8019
  trigger,
7982
- coords ? createPortal(
7983
- /* @__PURE__ */ jsxs(
7984
- "span",
7985
- {
7986
- ref: tipRef,
7987
- id,
7988
- className: "twc-tooltip",
7989
- "data-place": coords.place || placement,
7990
- "data-show": show || void 0,
7991
- role: "tooltip",
7992
- "aria-hidden": show ? void 0 : "true",
7993
- onMouseEnter: cancelClose,
7994
- onMouseLeave: close,
7995
- style: {
7996
- position: "fixed",
7997
- left: coords.left,
7998
- right: coords.right,
7999
- top: coords.top,
8000
- bottom: coords.bottom,
8001
- "--_tw-arrow-x": coords.arrowX != null ? `${coords.arrowX}px` : void 0,
8002
- "--_tw-arrow-y": coords.arrowY != null ? `${coords.arrowY}px` : void 0
8003
- },
8004
- children: [
8005
- label,
8006
- /* @__PURE__ */ jsx("span", { className: "twc-tooltip__arrow", "aria-hidden": "true" })
8007
- ]
8008
- }
8009
- ),
8010
- document.body
8011
- ) : null
8020
+ bubble
8012
8021
  ]
8013
8022
  }
8014
8023
  );
@@ -9243,6 +9252,40 @@ function Datatable({
9243
9252
  const scrollRef = React51__default.useRef(null);
9244
9253
  const [scrollTop, setScrollTop] = React51__default.useState(0);
9245
9254
  const [viewportH, setViewportH] = React51__default.useState(0);
9255
+ const [ovTip, setOvTip] = React51__default.useState(null);
9256
+ const ovTimer = React51__default.useRef(null);
9257
+ const hideOverflowTip = () => {
9258
+ clearTimeout(ovTimer.current);
9259
+ setOvTip((t) => t ? null : t);
9260
+ };
9261
+ const onOverflowOver = (e) => {
9262
+ const el = e.target.closest?.("[data-ovtext]");
9263
+ if (!el) return;
9264
+ if (ovTip && ovTip.anchor === el) return;
9265
+ clearTimeout(ovTimer.current);
9266
+ if (el.scrollWidth > el.clientWidth + 1) {
9267
+ const text = el.getAttribute("data-ovtext");
9268
+ ovTimer.current = setTimeout(() => setOvTip({ anchor: el, text }), 120);
9269
+ } else if (ovTip) setOvTip(null);
9270
+ };
9271
+ const onOverflowOut = (e) => {
9272
+ const el = e.target.closest?.("[data-ovtext]");
9273
+ if (el && !el.contains(e.relatedTarget)) hideOverflowTip();
9274
+ };
9275
+ const onOverflowFocus = (e) => {
9276
+ const el = e.target.closest?.("[data-ovtext]");
9277
+ if (el && el.scrollWidth > el.clientWidth + 1) setOvTip({ anchor: el, text: el.getAttribute("data-ovtext") });
9278
+ else hideOverflowTip();
9279
+ };
9280
+ React51__default.useEffect(() => () => clearTimeout(ovTimer.current), []);
9281
+ React51__default.useEffect(() => {
9282
+ if (!ovTip) return void 0;
9283
+ const onKey = (e) => {
9284
+ if (e.key === "Escape") setOvTip(null);
9285
+ };
9286
+ document.addEventListener("keydown", onKey);
9287
+ return () => document.removeEventListener("keydown", onKey);
9288
+ }, [ovTip]);
9246
9289
  const [pivotOn, setPivotOn] = React51__default.useState(pivotMode);
9247
9290
  const [aggConfig, setAggConfig] = React51__default.useState(() => {
9248
9291
  const m = {};
@@ -10408,7 +10451,7 @@ function Datatable({
10408
10451
  "data-pin": st.pin,
10409
10452
  "data-pin-edge": st.edge,
10410
10453
  style: { width: widthOf(c), ...st.style },
10411
- title: cellTitle,
10454
+ "data-ovtext": cellTitle,
10412
10455
  onClick: selectionMode === "cell" ? (e) => handleCellClick(e, k, row, c) : void 0,
10413
10456
  onFocus: () => setFocus((f) => f.r === ri && f.c === ci ? f : { r: ri, c: ci }),
10414
10457
  onDoubleClick: editable ? () => beginEdit(k, c, row) : void 0,
@@ -10749,233 +10792,247 @@ function Datatable({
10749
10792
  /* @__PURE__ */ jsx("button", { type: "button", className: "twc-dt__groupbar-clear", onClick: () => setGroupBy([]), children: "Clear all" })
10750
10793
  ] }) : null,
10751
10794
  /* @__PURE__ */ jsx("div", { className: "twc-dt__sr", role: "status", "aria-live": "polite", children: reorderMsg }),
10752
- pivotActive ? renderPivot() : /* @__PURE__ */ jsx("div", { className: "twc-dt__scroll", style: { maxHeight: height }, ref: scrollRef, onScroll: virtualizing ? onScrollVirtual : void 0, children: /* @__PURE__ */ jsxs(
10753
- "table",
10795
+ pivotActive ? renderPivot() : /* @__PURE__ */ jsx(
10796
+ "div",
10754
10797
  {
10755
- className: "twc-dt__table",
10756
- style: { width: tableMinWidth, minWidth: "100%" },
10757
- ref: gridRef,
10758
- role: "grid",
10759
- "aria-label": ariaLabelAttr || ariaLabel,
10760
- "aria-rowcount": totalRows + 1,
10761
- "aria-colcount": ordered.length + (checkboxSelection ? 1 : 0),
10762
- "aria-busy": loading || void 0,
10763
- onKeyDown: onGridKeyDown,
10764
- children: [
10765
- /* @__PURE__ */ jsx("thead", { ref: theadRef, children: /* @__PURE__ */ jsxs("tr", { role: "row", "aria-rowindex": 1, children: [
10766
- checkboxSelection ? /* @__PURE__ */ jsx("th", { className: "twc-dt__th", role: "columnheader", "aria-label": "Select", "data-pin": "left", "data-pin-edge": pins.left.length || showRowNum ? void 0 : "left", style: { insetInlineStart: 0, width: CHK_W, minWidth: CHK_W }, children: /* @__PURE__ */ jsx("div", { className: "twc-dt__th-inner", style: { justifyContent: "center", padding: 0 }, children: /* @__PURE__ */ jsx(
10767
- "span",
10768
- {
10769
- className: "twc-dt__check",
10770
- "data-checked": allSel || void 0,
10771
- "data-indeterminate": !allSel && someSel || void 0,
10772
- onClick: toggleAll,
10773
- role: "checkbox",
10774
- "aria-checked": allSel ? true : someSel ? "mixed" : false,
10775
- "aria-label": "Select all rows",
10776
- tabIndex: 0,
10777
- onKeyDown: (e) => {
10778
- if (e.key === " " || e.key === "Enter") {
10779
- e.preventDefault();
10780
- toggleAll();
10798
+ className: "twc-dt__scroll",
10799
+ style: { maxHeight: height },
10800
+ ref: scrollRef,
10801
+ onScroll: virtualizing ? onScrollVirtual : void 0,
10802
+ onMouseOver: onOverflowOver,
10803
+ onMouseOut: onOverflowOut,
10804
+ onFocus: onOverflowFocus,
10805
+ onBlur: hideOverflowTip,
10806
+ children: /* @__PURE__ */ jsxs(
10807
+ "table",
10808
+ {
10809
+ className: "twc-dt__table",
10810
+ style: { width: tableMinWidth, minWidth: "100%" },
10811
+ ref: gridRef,
10812
+ role: "grid",
10813
+ "aria-label": ariaLabelAttr || ariaLabel,
10814
+ "aria-rowcount": totalRows + 1,
10815
+ "aria-colcount": ordered.length + (checkboxSelection ? 1 : 0),
10816
+ "aria-busy": loading || void 0,
10817
+ onKeyDown: onGridKeyDown,
10818
+ children: [
10819
+ /* @__PURE__ */ jsx("thead", { ref: theadRef, children: /* @__PURE__ */ jsxs("tr", { role: "row", "aria-rowindex": 1, children: [
10820
+ checkboxSelection ? /* @__PURE__ */ jsx("th", { className: "twc-dt__th", role: "columnheader", "aria-label": "Select", "data-pin": "left", "data-pin-edge": pins.left.length || showRowNum ? void 0 : "left", style: { insetInlineStart: 0, width: CHK_W, minWidth: CHK_W }, children: /* @__PURE__ */ jsx("div", { className: "twc-dt__th-inner", style: { justifyContent: "center", padding: 0 }, children: /* @__PURE__ */ jsx(
10821
+ "span",
10822
+ {
10823
+ className: "twc-dt__check",
10824
+ "data-checked": allSel || void 0,
10825
+ "data-indeterminate": !allSel && someSel || void 0,
10826
+ onClick: toggleAll,
10827
+ role: "checkbox",
10828
+ "aria-checked": allSel ? true : someSel ? "mixed" : false,
10829
+ "aria-label": "Select all rows",
10830
+ tabIndex: 0,
10831
+ onKeyDown: (e) => {
10832
+ if (e.key === " " || e.key === "Enter") {
10833
+ e.preventDefault();
10834
+ toggleAll();
10835
+ }
10836
+ },
10837
+ children: /* @__PURE__ */ jsx(Svg, { d: allSel ? I.check : I.minus })
10781
10838
  }
10782
- },
10783
- children: /* @__PURE__ */ jsx(Svg, { d: allSel ? I.check : I.minus })
10784
- }
10785
- ) }) }) : null,
10786
- showRowNum ? /* @__PURE__ */ jsx("th", { className: "twc-dt__th twc-dt__rownum", role: "columnheader", "aria-label": "Row number", "data-pin": "left", "data-pin-edge": pins.left.length ? void 0 : "left", style: { insetInlineStart: numLeft, width: NUM_W, minWidth: NUM_W }, children: /* @__PURE__ */ jsxs("div", { className: "twc-dt__th-inner", children: [
10787
- /* @__PURE__ */ jsx("span", { className: "twc-dt__th-label", style: { flex: "none", cursor: "default" }, children: "#" }),
10788
- /* @__PURE__ */ jsx(
10789
- "button",
10790
- {
10791
- type: "button",
10792
- className: "twc-dt__menu-btn",
10793
- "aria-label": "Row number column menu",
10794
- "aria-haspopup": "menu",
10795
- "aria-expanded": colMenu?.field === "__rownum__" || void 0,
10796
- onClick: (e) => {
10797
- e.stopPropagation();
10798
- menuTriggerRef.current = e.currentTarget;
10799
- setPanel(null);
10800
- closePanel();
10801
- setRowMenu(null);
10802
- closeRowMenu();
10803
- setExportOpen(false);
10804
- closeExport();
10805
- setColMenu({ field: "__rownum__" });
10806
- openMenu(e.currentTarget, "right", 180);
10807
- },
10808
- children: /* @__PURE__ */ jsx(Svg, { d: I.more })
10809
- }
10810
- )
10811
- ] }) }) : null,
10812
- ordered.map((c) => {
10813
- const st = stickyOf(c.field);
10814
- const sorted = sort && sort.field === c.field ? sort.dir : void 0;
10815
- const w = widthOf(c);
10816
- const reorderable = !disableColumnReorder && st.pin == null && c.type !== "actions" && c.reorderable !== false;
10817
- const resizable = !disableColumnResize && c.resizable !== false;
10818
- const hasMenu = !c.disableColumnMenu && (c.sortable || c.filterable || c.pinnable || c.hideable);
10819
- return /* @__PURE__ */ jsxs(
10820
- "th",
10821
- {
10822
- className: "twc-dt__th",
10823
- role: "columnheader",
10824
- scope: "col",
10825
- "aria-sort": sorted ? sorted === "asc" ? "ascending" : "descending" : c.sortable ? "none" : void 0,
10826
- "data-num": c.type === "number" || void 0,
10827
- "data-actions-col": c.type === "actions" || void 0,
10828
- "data-sorted": sorted,
10829
- "data-pin": st.pin,
10830
- "data-pin-edge": st.edge,
10831
- "data-dragging": drag.from === c.field || void 0,
10832
- "data-dropbefore": drag.over === c.field && !drag.after || void 0,
10833
- "data-dropafter": drag.over === c.field && drag.after || void 0,
10834
- style: { width: w, minWidth: w, ...st.style },
10835
- onDragOver: reorderable && drag.from ? (e) => {
10836
- e.preventDefault();
10837
- const r2 = e.currentTarget.getBoundingClientRect();
10838
- const after = e.clientX > r2.left + r2.width / 2;
10839
- setDrag((d) => d.over === c.field && d.after === after ? d : { ...d, over: c.field, after });
10840
- } : void 0,
10841
- onDrop: reorderable && drag.from ? (e) => {
10842
- e.preventDefault();
10843
- onColDrop(c.field);
10844
- } : void 0,
10845
- children: [
10846
- /* @__PURE__ */ jsxs("div", { className: "twc-dt__th-inner", children: [
10847
- /* @__PURE__ */ jsxs(
10848
- "span",
10849
- {
10850
- className: "twc-dt__th-label",
10851
- role: c.sortable ? "button" : void 0,
10852
- tabIndex: c.sortable ? 0 : void 0,
10853
- title: typeof c.headerName === "string" ? c.headerName : void 0,
10854
- "aria-label": c.sortable ? `${c.headerName}, sort` : void 0,
10855
- draggable: reorderable || void 0,
10856
- onDragStart: reorderable ? (e) => {
10857
- setDrag({ from: c.field, over: null, after: false });
10858
- e.dataTransfer.effectAllowed = "move";
10859
- e.dataTransfer.setData("text/plain", c.field);
10860
- } : void 0,
10861
- onDragEnd: reorderable ? () => setDrag({ from: null, over: null, after: false }) : void 0,
10862
- onClick: () => c.sortable && cycleSort(c.field),
10863
- onKeyDown: c.sortable ? (e) => {
10864
- if (e.key === "Enter" || e.key === " ") {
10865
- e.preventDefault();
10866
- cycleSort(c.field);
10839
+ ) }) }) : null,
10840
+ showRowNum ? /* @__PURE__ */ jsx("th", { className: "twc-dt__th twc-dt__rownum", role: "columnheader", "aria-label": "Row number", "data-pin": "left", "data-pin-edge": pins.left.length ? void 0 : "left", style: { insetInlineStart: numLeft, width: NUM_W, minWidth: NUM_W }, children: /* @__PURE__ */ jsxs("div", { className: "twc-dt__th-inner", children: [
10841
+ /* @__PURE__ */ jsx("span", { className: "twc-dt__th-label", style: { flex: "none", cursor: "default" }, children: "#" }),
10842
+ /* @__PURE__ */ jsx(
10843
+ "button",
10844
+ {
10845
+ type: "button",
10846
+ className: "twc-dt__menu-btn",
10847
+ "aria-label": "Row number column menu",
10848
+ "aria-haspopup": "menu",
10849
+ "aria-expanded": colMenu?.field === "__rownum__" || void 0,
10850
+ onClick: (e) => {
10851
+ e.stopPropagation();
10852
+ menuTriggerRef.current = e.currentTarget;
10853
+ setPanel(null);
10854
+ closePanel();
10855
+ setRowMenu(null);
10856
+ closeRowMenu();
10857
+ setExportOpen(false);
10858
+ closeExport();
10859
+ setColMenu({ field: "__rownum__" });
10860
+ openMenu(e.currentTarget, "right", 180);
10861
+ },
10862
+ children: /* @__PURE__ */ jsx(Svg, { d: I.more })
10863
+ }
10864
+ )
10865
+ ] }) }) : null,
10866
+ ordered.map((c) => {
10867
+ const st = stickyOf(c.field);
10868
+ const sorted = sort && sort.field === c.field ? sort.dir : void 0;
10869
+ const w = widthOf(c);
10870
+ const reorderable = !disableColumnReorder && st.pin == null && c.type !== "actions" && c.reorderable !== false;
10871
+ const resizable = !disableColumnResize && c.resizable !== false;
10872
+ const hasMenu = !c.disableColumnMenu && (c.sortable || c.filterable || c.pinnable || c.hideable);
10873
+ return /* @__PURE__ */ jsxs(
10874
+ "th",
10875
+ {
10876
+ className: "twc-dt__th",
10877
+ role: "columnheader",
10878
+ scope: "col",
10879
+ "aria-sort": sorted ? sorted === "asc" ? "ascending" : "descending" : c.sortable ? "none" : void 0,
10880
+ "data-num": c.type === "number" || void 0,
10881
+ "data-actions-col": c.type === "actions" || void 0,
10882
+ "data-sorted": sorted,
10883
+ "data-pin": st.pin,
10884
+ "data-pin-edge": st.edge,
10885
+ "data-dragging": drag.from === c.field || void 0,
10886
+ "data-dropbefore": drag.over === c.field && !drag.after || void 0,
10887
+ "data-dropafter": drag.over === c.field && drag.after || void 0,
10888
+ style: { width: w, minWidth: w, ...st.style },
10889
+ onDragOver: reorderable && drag.from ? (e) => {
10890
+ e.preventDefault();
10891
+ const r2 = e.currentTarget.getBoundingClientRect();
10892
+ const after = e.clientX > r2.left + r2.width / 2;
10893
+ setDrag((d) => d.over === c.field && d.after === after ? d : { ...d, over: c.field, after });
10894
+ } : void 0,
10895
+ onDrop: reorderable && drag.from ? (e) => {
10896
+ e.preventDefault();
10897
+ onColDrop(c.field);
10898
+ } : void 0,
10899
+ children: [
10900
+ /* @__PURE__ */ jsxs("div", { className: "twc-dt__th-inner", children: [
10901
+ /* @__PURE__ */ jsxs(
10902
+ "span",
10903
+ {
10904
+ className: "twc-dt__th-label",
10905
+ role: c.sortable ? "button" : void 0,
10906
+ tabIndex: c.sortable ? 0 : void 0,
10907
+ "data-ovtext": typeof c.headerName === "string" ? c.headerName : void 0,
10908
+ "aria-label": c.sortable ? `${c.headerName}, sort` : void 0,
10909
+ draggable: reorderable || void 0,
10910
+ onDragStart: reorderable ? (e) => {
10911
+ setDrag({ from: c.field, over: null, after: false });
10912
+ e.dataTransfer.effectAllowed = "move";
10913
+ e.dataTransfer.setData("text/plain", c.field);
10914
+ } : void 0,
10915
+ onDragEnd: reorderable ? () => setDrag({ from: null, over: null, after: false }) : void 0,
10916
+ onClick: () => c.sortable && cycleSort(c.field),
10917
+ onKeyDown: c.sortable ? (e) => {
10918
+ if (e.key === "Enter" || e.key === " ") {
10919
+ e.preventDefault();
10920
+ cycleSort(c.field);
10921
+ }
10922
+ } : void 0,
10923
+ children: [
10924
+ reorderable ? /* @__PURE__ */ jsx("span", { className: "twc-dt__grip", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Svg, { d: I.grip }) }) : null,
10925
+ filteredFields.has(c.field) ? /* @__PURE__ */ jsx("span", { className: "twc-dt__filterdot" }) : null,
10926
+ c.headerName,
10927
+ c.sortable ? /* @__PURE__ */ jsx("span", { className: "twc-dt__sort", children: /* @__PURE__ */ jsx(Svg, { d: I.arrow }) }) : null
10928
+ ]
10867
10929
  }
10868
- } : void 0,
10869
- children: [
10870
- reorderable ? /* @__PURE__ */ jsx("span", { className: "twc-dt__grip", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Svg, { d: I.grip }) }) : null,
10871
- filteredFields.has(c.field) ? /* @__PURE__ */ jsx("span", { className: "twc-dt__filterdot" }) : null,
10872
- c.headerName,
10873
- c.sortable ? /* @__PURE__ */ jsx("span", { className: "twc-dt__sort", children: /* @__PURE__ */ jsx(Svg, { d: I.arrow }) }) : null
10874
- ]
10875
- }
10876
- ),
10877
- hasMenu ? /* @__PURE__ */ jsx(
10878
- "button",
10879
- {
10880
- type: "button",
10881
- className: "twc-dt__menu-btn",
10882
- "aria-label": "Column menu",
10883
- "aria-haspopup": "menu",
10884
- "aria-expanded": colMenu?.field === c.field || void 0,
10885
- onClick: (e) => {
10886
- e.stopPropagation();
10887
- menuTriggerRef.current = e.currentTarget;
10888
- setPanel(null);
10889
- closePanel();
10890
- setRowMenu(null);
10891
- closeRowMenu();
10892
- setExportOpen(false);
10893
- closeExport();
10894
- setColMenu({ field: c.field });
10895
- openMenu(e.currentTarget, "right", 230);
10896
- },
10897
- children: /* @__PURE__ */ jsx(Svg, { d: I.more })
10898
- }
10899
- ) : null
10900
- ] }),
10901
- resizable ? /* @__PURE__ */ jsx(
10902
- "span",
10903
- {
10904
- className: "twc-dt__resizer",
10905
- "data-active": resizing || void 0,
10906
- role: "separator",
10907
- "aria-orientation": "vertical",
10908
- "aria-label": `Resize ${c.headerName} column (double-click to fit content)`,
10909
- "aria-valuenow": w,
10910
- "aria-valuemin": 72,
10911
- tabIndex: 0,
10912
- onPointerDown: (e) => startResize(e, c.field),
10913
- onClick: (e) => e.stopPropagation(),
10914
- onDoubleClick: (e) => {
10915
- e.preventDefault();
10916
- e.stopPropagation();
10917
- autoFitColumn(c.field, e.currentTarget.closest("th"));
10918
- },
10919
- onKeyDown: (e) => {
10920
- if (e.key === "Enter" || e.key === " ") {
10921
- e.preventDefault();
10922
- e.stopPropagation();
10923
- autoFitColumn(c.field, e.currentTarget.closest("th"));
10924
- return;
10930
+ ),
10931
+ hasMenu ? /* @__PURE__ */ jsx(
10932
+ "button",
10933
+ {
10934
+ type: "button",
10935
+ className: "twc-dt__menu-btn",
10936
+ "aria-label": "Column menu",
10937
+ "aria-haspopup": "menu",
10938
+ "aria-expanded": colMenu?.field === c.field || void 0,
10939
+ onClick: (e) => {
10940
+ e.stopPropagation();
10941
+ menuTriggerRef.current = e.currentTarget;
10942
+ setPanel(null);
10943
+ closePanel();
10944
+ setRowMenu(null);
10945
+ closeRowMenu();
10946
+ setExportOpen(false);
10947
+ closeExport();
10948
+ setColMenu({ field: c.field });
10949
+ openMenu(e.currentTarget, "right", 230);
10950
+ },
10951
+ children: /* @__PURE__ */ jsx(Svg, { d: I.more })
10952
+ }
10953
+ ) : null
10954
+ ] }),
10955
+ resizable ? /* @__PURE__ */ jsx(
10956
+ "span",
10957
+ {
10958
+ className: "twc-dt__resizer",
10959
+ "data-active": resizing || void 0,
10960
+ role: "separator",
10961
+ "aria-orientation": "vertical",
10962
+ "aria-label": `Resize ${c.headerName} column (double-click to fit content)`,
10963
+ "aria-valuenow": w,
10964
+ "aria-valuemin": 72,
10965
+ tabIndex: 0,
10966
+ onPointerDown: (e) => startResize(e, c.field),
10967
+ onClick: (e) => e.stopPropagation(),
10968
+ onDoubleClick: (e) => {
10969
+ e.preventDefault();
10970
+ e.stopPropagation();
10971
+ autoFitColumn(c.field, e.currentTarget.closest("th"));
10972
+ },
10973
+ onKeyDown: (e) => {
10974
+ if (e.key === "Enter" || e.key === " ") {
10975
+ e.preventDefault();
10976
+ e.stopPropagation();
10977
+ autoFitColumn(c.field, e.currentTarget.closest("th"));
10978
+ return;
10979
+ }
10980
+ if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
10981
+ e.preventDefault();
10982
+ e.stopPropagation();
10983
+ const delta = e.key === "ArrowRight" ? 10 : -10;
10984
+ setWidths((m) => ({ ...m, [c.field]: Math.max(72, (m[c.field] ?? intrinsicWidth(c)) + delta) }));
10985
+ },
10986
+ title: "Drag to resize \xB7 double-click to fit content"
10925
10987
  }
10926
- if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
10927
- e.preventDefault();
10928
- e.stopPropagation();
10929
- const delta = e.key === "ArrowRight" ? 10 : -10;
10930
- setWidths((m) => ({ ...m, [c.field]: Math.max(72, (m[c.field] ?? intrinsicWidth(c)) + delta) }));
10931
- },
10932
- title: "Drag to resize \xB7 double-click to fit content"
10933
- }
10934
- ) : null
10935
- ]
10936
- },
10937
- c.field
10938
- );
10939
- })
10940
- ] }) }),
10941
- /* @__PURE__ */ jsx("tbody", { children: loading ? Array.from({ length: paginated ? Math.min(sizeVal, 8) : 8 }).map((_, ri) => /* @__PURE__ */ jsxs("tr", { className: "twc-dt__row", role: "row", children: [
10942
- checkboxSelection ? /* @__PURE__ */ jsx("td", { className: "twc-dt__td", role: "gridcell", "data-pin": "left", style: { insetInlineStart: 0, width: CHK_W }, children: /* @__PURE__ */ jsx("span", { className: "twc-dt__sk", "aria-hidden": "true", style: { "--_w": "18px", height: 18, borderRadius: 4 } }) }) : null,
10943
- showRowNum ? /* @__PURE__ */ jsx("td", { className: "twc-dt__td twc-dt__rownum", role: "gridcell", "aria-hidden": "true", "data-pin": "left", style: { insetInlineStart: numLeft, width: NUM_W }, children: /* @__PURE__ */ jsx("span", { className: "twc-dt__sk", "aria-hidden": "true", style: { "--_w": "16px", height: 14, borderRadius: 4 } }) }) : null,
10944
- ordered.map((c, ci) => {
10945
- const st = stickyOf(c.field);
10946
- return /* @__PURE__ */ jsx("td", { className: "twc-dt__td", role: "gridcell", "data-num": c.type === "number" || void 0, "data-pin": st.pin, "data-pin-edge": st.edge, style: { width: widthOf(c), ...st.style }, children: /* @__PURE__ */ jsx("span", { className: "twc-dt__sk", "aria-hidden": "true", style: { "--_w": `${45 + (ri * 13 + ci * 29) % 45}%` } }) }, c.field);
10947
- })
10948
- ] }, ri)) : (displayItems ? displayItems.length === 0 : paged.length === 0) ? (
10949
- // #121: customizable, filter-aware empty state. #122: grid roles on the empty row.
10950
- /* @__PURE__ */ jsx("tr", { role: "row", "aria-rowindex": 2, children: /* @__PURE__ */ jsx("td", { className: "twc-dt__td", role: "gridcell", colSpan: totalCols, style: { maxWidth: "none" }, children: /* @__PURE__ */ jsx("div", { className: "twc-dt__empty", children: renderEmpty ? renderEmpty() : emptyMessage ?? (filters.length > 0 || quick.trim() !== "" ? "No rows match your filters" : "No rows") }) }) })
10951
- ) : displayItems ? (() => {
10952
- let li = -1;
10953
- return displayItems.map((item) => item.kind === "group" ? renderGroupRow(item) : renderLeaf(item.row, ++li));
10954
- })() : /* @__PURE__ */ jsxs(Fragment, { children: [
10955
- pinnedTopRows.map((row) => renderLeaf(row, keyIndex.get(keyOf(row)), "top")),
10956
- vWindow ? /* @__PURE__ */ jsxs(Fragment, { children: [
10957
- vWindow.padTop > 0 ? /* @__PURE__ */ jsx("tr", { "aria-hidden": "true", className: "twc-dt__vspacer", children: /* @__PURE__ */ jsx("td", { colSpan: totalCols, style: { height: vWindow.padTop, padding: 0, border: "none", maxWidth: "none" } }) }) : null,
10958
- middleRows.slice(vWindow.start, vWindow.end).map((row, i) => renderLeaf(row, keyIndex.get(keyOf(row)), void 0, vWindow.start + i)),
10959
- vWindow.padBottom > 0 ? /* @__PURE__ */ jsx("tr", { "aria-hidden": "true", className: "twc-dt__vspacer", children: /* @__PURE__ */ jsx("td", { colSpan: totalCols, style: { height: vWindow.padBottom, padding: 0, border: "none", maxWidth: "none" } }) }) : null
10960
- ] }) : middleRows.map((row, i) => renderLeaf(row, keyIndex.get(keyOf(row)), void 0, i)),
10961
- pinnedBottomRows.map((row) => renderLeaf(row, keyIndex.get(keyOf(row)), "bottom"))
10962
- ] }) }),
10963
- hasAggregation && aggOn && !loading && paged.length > 0 ? /* @__PURE__ */ jsx("tfoot", { children: /* @__PURE__ */ jsxs("tr", { role: "row", children: [
10964
- checkboxSelection ? /* @__PURE__ */ jsx("td", { role: "gridcell", "data-pin": "left", "data-pin-edge": pins.left.length || showRowNum ? void 0 : "left", style: { insetInlineStart: 0, width: CHK_W } }) : null,
10965
- showRowNum ? /* @__PURE__ */ jsx("td", { className: "twc-dt__rownum", role: "gridcell", "aria-hidden": "true", "data-pin": "left", "data-pin-edge": pins.left.length ? void 0 : "left", style: { insetInlineStart: numLeft, width: NUM_W } }) : null,
10966
- ordered.map((c) => {
10967
- const st = stickyOf(c.field);
10968
- const v = aggregate(c);
10969
- const display = v == null ? null : c.aggregationFormatter ? c.aggregationFormatter(v) : c.valueFormatter ? c.valueFormatter(v, null) : typeof v === "number" ? v.toLocaleString() : v;
10970
- return /* @__PURE__ */ jsx("td", { role: "gridcell", "data-num": c.type === "number" || void 0, "data-pin": st.pin, "data-pin-edge": st.edge, style: { width: widthOf(c), ...st.style }, children: v == null ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
10971
- typeof aggOf(c) === "string" ? /* @__PURE__ */ jsx("span", { className: "twc-dt__agg-label", children: aggLabels[aggOf(c)] }) : null,
10972
- /* @__PURE__ */ jsx("span", { className: "twc-dt__agg-val", children: display })
10973
- ] }) }, c.field);
10974
- })
10975
- ] }) }) : null
10976
- ]
10988
+ ) : null
10989
+ ]
10990
+ },
10991
+ c.field
10992
+ );
10993
+ })
10994
+ ] }) }),
10995
+ /* @__PURE__ */ jsx("tbody", { children: loading ? Array.from({ length: paginated ? Math.min(sizeVal, 8) : 8 }).map((_, ri) => /* @__PURE__ */ jsxs("tr", { className: "twc-dt__row", role: "row", children: [
10996
+ checkboxSelection ? /* @__PURE__ */ jsx("td", { className: "twc-dt__td", role: "gridcell", "data-pin": "left", style: { insetInlineStart: 0, width: CHK_W }, children: /* @__PURE__ */ jsx("span", { className: "twc-dt__sk", "aria-hidden": "true", style: { "--_w": "18px", height: 18, borderRadius: 4 } }) }) : null,
10997
+ showRowNum ? /* @__PURE__ */ jsx("td", { className: "twc-dt__td twc-dt__rownum", role: "gridcell", "aria-hidden": "true", "data-pin": "left", style: { insetInlineStart: numLeft, width: NUM_W }, children: /* @__PURE__ */ jsx("span", { className: "twc-dt__sk", "aria-hidden": "true", style: { "--_w": "16px", height: 14, borderRadius: 4 } }) }) : null,
10998
+ ordered.map((c, ci) => {
10999
+ const st = stickyOf(c.field);
11000
+ return /* @__PURE__ */ jsx("td", { className: "twc-dt__td", role: "gridcell", "data-num": c.type === "number" || void 0, "data-pin": st.pin, "data-pin-edge": st.edge, style: { width: widthOf(c), ...st.style }, children: /* @__PURE__ */ jsx("span", { className: "twc-dt__sk", "aria-hidden": "true", style: { "--_w": `${45 + (ri * 13 + ci * 29) % 45}%` } }) }, c.field);
11001
+ })
11002
+ ] }, ri)) : (displayItems ? displayItems.length === 0 : paged.length === 0) ? (
11003
+ // #121: customizable, filter-aware empty state. #122: grid roles on the empty row.
11004
+ /* @__PURE__ */ jsx("tr", { role: "row", "aria-rowindex": 2, children: /* @__PURE__ */ jsx("td", { className: "twc-dt__td", role: "gridcell", colSpan: totalCols, style: { maxWidth: "none" }, children: /* @__PURE__ */ jsx("div", { className: "twc-dt__empty", children: renderEmpty ? renderEmpty() : emptyMessage ?? (filters.length > 0 || quick.trim() !== "" ? "No rows match your filters" : "No rows") }) }) })
11005
+ ) : displayItems ? (() => {
11006
+ let li = -1;
11007
+ return displayItems.map((item) => item.kind === "group" ? renderGroupRow(item) : renderLeaf(item.row, ++li));
11008
+ })() : /* @__PURE__ */ jsxs(Fragment, { children: [
11009
+ pinnedTopRows.map((row) => renderLeaf(row, keyIndex.get(keyOf(row)), "top")),
11010
+ vWindow ? /* @__PURE__ */ jsxs(Fragment, { children: [
11011
+ vWindow.padTop > 0 ? /* @__PURE__ */ jsx("tr", { "aria-hidden": "true", className: "twc-dt__vspacer", children: /* @__PURE__ */ jsx("td", { colSpan: totalCols, style: { height: vWindow.padTop, padding: 0, border: "none", maxWidth: "none" } }) }) : null,
11012
+ middleRows.slice(vWindow.start, vWindow.end).map((row, i) => renderLeaf(row, keyIndex.get(keyOf(row)), void 0, vWindow.start + i)),
11013
+ vWindow.padBottom > 0 ? /* @__PURE__ */ jsx("tr", { "aria-hidden": "true", className: "twc-dt__vspacer", children: /* @__PURE__ */ jsx("td", { colSpan: totalCols, style: { height: vWindow.padBottom, padding: 0, border: "none", maxWidth: "none" } }) }) : null
11014
+ ] }) : middleRows.map((row, i) => renderLeaf(row, keyIndex.get(keyOf(row)), void 0, i)),
11015
+ pinnedBottomRows.map((row) => renderLeaf(row, keyIndex.get(keyOf(row)), "bottom"))
11016
+ ] }) }),
11017
+ hasAggregation && aggOn && !loading && paged.length > 0 ? /* @__PURE__ */ jsx("tfoot", { children: /* @__PURE__ */ jsxs("tr", { role: "row", children: [
11018
+ checkboxSelection ? /* @__PURE__ */ jsx("td", { role: "gridcell", "data-pin": "left", "data-pin-edge": pins.left.length || showRowNum ? void 0 : "left", style: { insetInlineStart: 0, width: CHK_W } }) : null,
11019
+ showRowNum ? /* @__PURE__ */ jsx("td", { className: "twc-dt__rownum", role: "gridcell", "aria-hidden": "true", "data-pin": "left", "data-pin-edge": pins.left.length ? void 0 : "left", style: { insetInlineStart: numLeft, width: NUM_W } }) : null,
11020
+ ordered.map((c) => {
11021
+ const st = stickyOf(c.field);
11022
+ const v = aggregate(c);
11023
+ const display = v == null ? null : c.aggregationFormatter ? c.aggregationFormatter(v) : c.valueFormatter ? c.valueFormatter(v, null) : typeof v === "number" ? v.toLocaleString() : v;
11024
+ return /* @__PURE__ */ jsx("td", { role: "gridcell", "data-num": c.type === "number" || void 0, "data-pin": st.pin, "data-pin-edge": st.edge, style: { width: widthOf(c), ...st.style }, children: v == null ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
11025
+ typeof aggOf(c) === "string" ? /* @__PURE__ */ jsx("span", { className: "twc-dt__agg-label", children: aggLabels[aggOf(c)] }) : null,
11026
+ /* @__PURE__ */ jsx("span", { className: "twc-dt__agg-val", children: display })
11027
+ ] }) }, c.field);
11028
+ })
11029
+ ] }) }) : null
11030
+ ]
11031
+ }
11032
+ )
10977
11033
  }
10978
- ) }),
11034
+ ),
11035
+ /* @__PURE__ */ jsx(Tooltip, { anchor: ovTip ? ovTip.anchor : null, open: !!ovTip, label: ovTip ? ovTip.text : null, placement: "top" }),
10979
11036
  !pivotActive ? /* @__PURE__ */ jsxs("div", { className: "twc-dt__footer", children: [
10980
11037
  /* @__PURE__ */ jsxs("div", { className: "twc-dt__footer-row", "data-bottom": "true", children: [
10981
11038
  /* @__PURE__ */ jsx("span", { className: "twc-dt__status", children: loading ? "Loading\u2026" : (() => {