@shortstravelmgmt/component-lib 0.3.0-canary.70.g764f77e → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8576,6 +8576,14 @@ const rootStyle = {
8576
8576
  textTransform: 'none',
8577
8577
  color: 'var(--color-ink, #1b2a41)',
8578
8578
  },
8579
+ // The tab labels are bare spans too, so a host's span rule reaches them
8580
+ // directly (inheritance alone can't undo it): they take the tab's own type.
8581
+ // `:not([class])` leaves the classed icon and count spans their own sizes.
8582
+ '&& [role="tab"] > span:not([class])': {
8583
+ font: 'inherit',
8584
+ letterSpacing: 'inherit',
8585
+ textTransform: 'inherit',
8586
+ },
8579
8587
  };
8580
8588
  const tabRowStyle = {
8581
8589
  label: 'TeamPicker-tabRowStyle',
@@ -12613,16 +12621,16 @@ GridHeaderRow.displayName = 'GridHeaderRow';
12613
12621
  * where it wins on order, exactly as it did in the stylesheet.
12614
12622
  */
12615
12623
  const tableStyle$8 = {
12616
- label: "GridTable-tableStyle",
12617
- position: "relative",
12624
+ label: 'GridTable-tableStyle',
12625
+ position: 'relative',
12618
12626
  borderRadius: 12,
12619
- "@media (min-width: 768px)": {
12620
- border: "1px solid var(--color-subtle, #eff0f0)",
12627
+ '@media (min-width: 768px)': {
12628
+ border: '1px solid var(--color-subtle, #eff0f0)',
12621
12629
  },
12622
12630
  };
12623
12631
  const gridStyle$7 = {
12624
- label: "GridTable-gridStyle",
12625
- display: "grid",
12632
+ label: 'GridTable-gridStyle',
12633
+ display: 'grid',
12626
12634
  };
12627
12635
  /**
12628
12636
  * The always-visible banner row above the heading. Spans the full width and
@@ -12631,15 +12639,15 @@ const gridStyle$7 = {
12631
12639
  * Its background is left to the caller's node.
12632
12640
  */
12633
12641
  const bannerStyle$2 = {
12634
- label: "GridTable-bannerStyle",
12635
- width: "100%",
12642
+ label: 'GridTable-bannerStyle',
12643
+ width: '100%',
12636
12644
  borderTopLeftRadius: 12,
12637
12645
  borderTopRightRadius: 12,
12638
12646
  // The wrapper is transparent, so its own radius rounds nothing — the caller's
12639
12647
  // node paints the background. Round that direct child's top corners too, so a
12640
12648
  // full-width banner background follows the table's rounded top edge instead of
12641
12649
  // painting square corners over it. No overflow clip, so dropdowns still escape.
12642
- "& > *": {
12650
+ '& > *': {
12643
12651
  borderTopLeftRadius: 12,
12644
12652
  borderTopRightRadius: 12,
12645
12653
  },
@@ -12649,72 +12657,72 @@ const bannerStyle$2 = {
12649
12657
  * row becomes a card and every cell carries its own label instead.
12650
12658
  */
12651
12659
  const headerStyle$x = {
12652
- label: "GridTable-headerStyle",
12653
- display: "none",
12654
- width: "100%",
12660
+ label: 'GridTable-headerStyle',
12661
+ display: 'none',
12662
+ width: '100%',
12655
12663
  fontWeight: 500,
12656
12664
  /* Navy brand ground with rail foreground ink, matching the widget headers. */
12657
- background: "var(--color-primary, #19345f)",
12658
- color: "var(--nav-rail-fg, #8fa6c4)",
12659
- "@media (min-width: 768px)": {
12660
- display: "block",
12665
+ background: 'var(--color-primary, #19345f)',
12666
+ color: 'var(--nav-rail-fg, #8fa6c4)',
12667
+ '@media (min-width: 768px)': {
12668
+ display: 'block',
12661
12669
  },
12662
12670
  };
12663
12671
  const headingStyle$2 = {
12664
- label: "GridTable-headingStyle",
12665
- display: "flex",
12666
- alignItems: "flex-end",
12672
+ label: 'GridTable-headingStyle',
12673
+ display: 'flex',
12674
+ alignItems: 'flex-end',
12667
12675
  minWidth: 0,
12668
- padding: "12px 16px",
12676
+ padding: '12px 16px',
12669
12677
  fontSize: 14,
12670
12678
  fontWeight: 500,
12671
- color: "var(--nav-rail-fg, #8fa6c4)",
12672
- textAlign: "left",
12673
- background: "none",
12674
- border: "none",
12675
- fontFamily: "inherit",
12679
+ color: 'var(--nav-rail-fg, #8fa6c4)',
12680
+ textAlign: 'left',
12681
+ background: 'none',
12682
+ border: 'none',
12683
+ fontFamily: 'inherit',
12676
12684
  };
12677
12685
  /** Contests nothing in `headingStyle` — it sets neither cursor nor width. */
12678
12686
  const sortableStyle = {
12679
- label: "GridTable-sortableStyle",
12680
- cursor: "pointer",
12681
- width: "100%",
12687
+ label: 'GridTable-sortableStyle',
12688
+ cursor: 'pointer',
12689
+ width: '100%',
12682
12690
  };
12683
12691
  const headingInnerStyle = {
12684
- label: "GridTable-headingInnerStyle",
12685
- display: "flex",
12686
- alignItems: "center",
12687
- minWidth: "100%",
12692
+ label: 'GridTable-headingInnerStyle',
12693
+ display: 'flex',
12694
+ alignItems: 'center',
12695
+ minWidth: '100%',
12688
12696
  };
12689
12697
  const headingIconStyle = {
12690
- label: "GridTable-headingIconStyle",
12698
+ label: 'GridTable-headingIconStyle',
12691
12699
  marginRight: 8,
12692
12700
  flexShrink: 0,
12693
- display: "inline-flex",
12701
+ display: 'inline-flex',
12694
12702
  };
12695
12703
  const sortIconStyle$1 = {
12696
- label: "GridTable-sortIconStyle",
12704
+ label: 'GridTable-sortIconStyle',
12697
12705
  marginLeft: 8,
12698
12706
  flexShrink: 0,
12699
- display: "inline-flex",
12707
+ display: 'inline-flex',
12700
12708
  };
12701
12709
  const bodyStyle$5 = {
12702
- label: "GridTable-bodyStyle",
12703
- display: "flex",
12704
- flexDirection: "column",
12710
+ label: 'GridTable-bodyStyle',
12711
+ display: 'flex',
12712
+ flexDirection: 'column',
12705
12713
  gap: 16,
12706
- "@media (min-width: 768px)": {
12714
+ '@media (min-width: 768px)': {
12707
12715
  gap: 0,
12708
12716
  },
12709
12717
  };
12710
12718
  const rowStyle$5 = {
12711
- label: "GridTable-rowStyle",
12719
+ label: 'GridTable-rowStyle',
12712
12720
  padding: 8,
12713
12721
  fontSize: 14,
12714
- background: "#fff",
12722
+ background: '#fff',
12715
12723
  borderRadius: 12,
12716
- "@media (min-width: 768px)": {
12717
- display: "grid",
12724
+ '@media (min-width: 768px)': {
12725
+ display: 'grid',
12718
12726
  padding: 0,
12719
12727
  borderRadius: 0,
12720
12728
  },
@@ -12729,51 +12737,51 @@ const rowStyle$5 = {
12729
12737
  * over `.row.bordered` (0,2,0).
12730
12738
  */
12731
12739
  const borderedStyle = {
12732
- label: "GridTable-borderedStyle",
12733
- border: "1px solid var(--border-color-dark, #d5d5d5)",
12734
- "@media (min-width: 768px)": {
12735
- borderWidth: "0 0 1px 0",
12736
- "&:last-child": {
12740
+ label: 'GridTable-borderedStyle',
12741
+ border: '1px solid var(--border-color-dark, #d5d5d5)',
12742
+ '@media (min-width: 768px)': {
12743
+ borderWidth: '0 0 1px 0',
12744
+ '&:last-child': {
12737
12745
  borderBottomWidth: 0,
12738
12746
  },
12739
12747
  },
12740
12748
  };
12741
12749
  const cellWrapStyle = {
12742
- label: "GridTable-cellWrapStyle",
12750
+ label: 'GridTable-cellWrapStyle',
12743
12751
  minWidth: 0,
12744
- background: "#fff",
12745
- "@media (min-width: 768px)": {
12746
- display: "flex",
12747
- flexDirection: "column",
12752
+ background: '#fff',
12753
+ '@media (min-width: 768px)': {
12754
+ display: 'flex',
12755
+ flexDirection: 'column',
12748
12756
  },
12749
12757
  };
12750
12758
  const cellStyle$2 = {
12751
- label: "GridTable-cellStyle",
12752
- display: "flex",
12753
- alignItems: "center",
12754
- minHeight: "100%",
12755
- padding: "4px 8px",
12756
- "@media (min-width: 768px)": {
12757
- padding: "12px 16px",
12759
+ label: 'GridTable-cellStyle',
12760
+ display: 'flex',
12761
+ alignItems: 'center',
12762
+ minHeight: '100%',
12763
+ padding: '4px 8px',
12764
+ '@media (min-width: 768px)': {
12765
+ padding: '12px 16px',
12758
12766
  },
12759
12767
  };
12760
12768
  /** Top-aligns a cell's content; applied over `cellStyle` when `alignTop`. */
12761
12769
  const cellTopStyle = {
12762
- label: "GridTable-cellTopStyle",
12763
- alignItems: "flex-start",
12770
+ label: 'GridTable-cellTopStyle',
12771
+ alignItems: 'flex-start',
12764
12772
  };
12765
12773
  const valueStyle$2 = {
12766
- label: "GridTable-valueStyle",
12767
- display: "block",
12768
- overflow: "hidden",
12769
- overflowWrap: "break-word",
12774
+ label: 'GridTable-valueStyle',
12775
+ display: 'block',
12776
+ overflow: 'hidden',
12777
+ overflowWrap: 'break-word',
12770
12778
  };
12771
12779
  const stackedLabelStyle = {
12772
- label: "GridTable-stackedLabelStyle",
12780
+ label: 'GridTable-stackedLabelStyle',
12773
12781
  minWidth: 100,
12774
12782
  /* The heading row is visible again, so per-cell labels would duplicate it. */
12775
- "@media (min-width: 768px)": {
12776
- display: "none",
12783
+ '@media (min-width: 768px)': {
12784
+ display: 'none',
12777
12785
  },
12778
12786
  };
12779
12787
  /**
@@ -12781,11 +12789,21 @@ const stackedLabelStyle = {
12781
12789
  * the top; on the desktop grid it carries a bottom rule so it reads as a row above
12782
12790
  * the data. The caller styles and lays out the node inside it.
12783
12791
  */
12792
+ /**
12793
+ * The `editRow` slot: full width, and its borders are the row it replaces —
12794
+ * `borderedStyle` joins it only when the table is bordered, and that rule
12795
+ * already drops the last row's bottom border — unlike `draftRowStyle`, whose
12796
+ * separator is for a row pinned above the data.
12797
+ */
12798
+ const editRowStyle = {
12799
+ label: 'GridTable-editRowStyle',
12800
+ width: '100%',
12801
+ };
12784
12802
  const draftRowStyle = {
12785
- label: "GridTable-draftRowStyle",
12786
- width: "100%",
12787
- "@media (min-width: 768px)": {
12788
- borderBottom: "1px solid var(--border-color-dark, #d5d5d5)",
12803
+ label: 'GridTable-draftRowStyle',
12804
+ width: '100%',
12805
+ '@media (min-width: 768px)': {
12806
+ borderBottom: '1px solid var(--border-color-dark, #d5d5d5)',
12789
12807
  },
12790
12808
  };
12791
12809
  /**
@@ -12795,52 +12813,52 @@ const draftRowStyle = {
12795
12813
  * white so it settles cleanly when the caller clears `flashRowKey`.
12796
12814
  */
12797
12815
  const flashRowStyle = {
12798
- label: "GridTable-flashRowStyle",
12799
- "@keyframes gridtable-row-flash": {
12800
- from: { backgroundColor: "var(--color-alert-success-bg, #d1f0e0)" },
12801
- to: { backgroundColor: "#fff" },
12816
+ label: 'GridTable-flashRowStyle',
12817
+ '@keyframes gridtable-row-flash': {
12818
+ from: { backgroundColor: 'var(--color-alert-success-bg, #d1f0e0)' },
12819
+ to: { backgroundColor: '#fff' },
12802
12820
  },
12803
- "& > *": {
12804
- animation: "gridtable-row-flash 2.5s ease-out",
12821
+ '& > *': {
12822
+ animation: 'gridtable-row-flash 2.5s ease-out',
12805
12823
  },
12806
12824
  };
12807
12825
  const emptyStyle$d = {
12808
- label: "GridTable-emptyStyle",
12809
- padding: "12px 16px",
12810
- textAlign: "center",
12811
- color: "var(--color-slate, #5c5c5c)",
12826
+ label: 'GridTable-emptyStyle',
12827
+ padding: '12px 16px',
12828
+ textAlign: 'center',
12829
+ color: 'var(--color-slate, #5c5c5c)',
12812
12830
  };
12813
12831
  /** The leading control cell that holds a row's expand/collapse toggle. */
12814
12832
  const expandCellStyle = {
12815
- label: "GridTable-expandCellStyle",
12816
- display: "flex",
12817
- alignItems: "center",
12818
- justifyContent: "center",
12819
- padding: "4px",
12820
- "@media (min-width: 768px)": {
12833
+ label: 'GridTable-expandCellStyle',
12834
+ display: 'flex',
12835
+ alignItems: 'center',
12836
+ justifyContent: 'center',
12837
+ padding: '4px',
12838
+ '@media (min-width: 768px)': {
12821
12839
  // 10px, not the cells' 12px: the 28px toggle then centres on the 24px
12822
12840
  // first text line of the top-aligned cells beside it (10 + 14 = 12 + 12).
12823
- padding: "10px 4px",
12824
- alignItems: "flex-start",
12841
+ padding: '10px 4px',
12842
+ alignItems: 'flex-start',
12825
12843
  },
12826
12844
  };
12827
12845
  /** The toggle button itself: an icon-only target that inherits row ink. */
12828
12846
  const expandButtonStyle$1 = {
12829
- label: "GridTable-expandButtonStyle",
12830
- display: "inline-flex",
12831
- alignItems: "center",
12832
- justifyContent: "center",
12847
+ label: 'GridTable-expandButtonStyle',
12848
+ display: 'inline-flex',
12849
+ alignItems: 'center',
12850
+ justifyContent: 'center',
12833
12851
  width: 28,
12834
12852
  height: 28,
12835
12853
  padding: 0,
12836
- color: "var(--color-slate, #5c5c5c)",
12837
- background: "none",
12838
- border: "none",
12854
+ color: 'var(--color-slate, #5c5c5c)',
12855
+ background: 'none',
12856
+ border: 'none',
12839
12857
  borderRadius: 6,
12840
- cursor: "pointer",
12841
- "&:hover": {
12842
- color: "var(--color-primary, #19345f)",
12843
- background: "var(--color-subtle, #eff0f0)",
12858
+ cursor: 'pointer',
12859
+ '&:hover': {
12860
+ color: 'var(--color-primary, #19345f)',
12861
+ background: 'var(--color-subtle, #eff0f0)',
12844
12862
  },
12845
12863
  };
12846
12864
  /**
@@ -12854,46 +12872,46 @@ const expandButtonStyle$1 = {
12854
12872
  * Colour defaults to the brand success green.
12855
12873
  */
12856
12874
  const markerStyle = {
12857
- label: "GridTable-markerStyle",
12858
- position: "relative",
12875
+ label: 'GridTable-markerStyle',
12876
+ position: 'relative',
12859
12877
  height: 20,
12860
- "@media (min-width: 768px)": {
12878
+ '@media (min-width: 768px)': {
12861
12879
  height: 0,
12862
12880
  },
12863
12881
  };
12864
12882
  /** The rule itself: spans the full width, centred on the boundary. */
12865
12883
  const markerLineStyle = {
12866
- label: "GridTable-markerLineStyle",
12867
- position: "absolute",
12884
+ label: 'GridTable-markerLineStyle',
12885
+ position: 'absolute',
12868
12886
  left: 0,
12869
12887
  right: 0,
12870
- top: "50%",
12871
- transform: "translateY(-50%)",
12888
+ top: '50%',
12889
+ transform: 'translateY(-50%)',
12872
12890
  height: 2,
12873
- background: "var(--color-success, #138660)",
12891
+ background: 'var(--color-success, #138660)',
12874
12892
  };
12875
12893
  /** The label, overlaid at the left with a solid ground that masks the rule behind it. */
12876
12894
  const markerLabelStyle = {
12877
- label: "GridTable-markerLabelStyle",
12878
- position: "absolute",
12895
+ label: 'GridTable-markerLabelStyle',
12896
+ position: 'absolute',
12879
12897
  left: 16,
12880
- top: "50%",
12881
- transform: "translateY(-50%)",
12898
+ top: '50%',
12899
+ transform: 'translateY(-50%)',
12882
12900
  paddingRight: 8,
12883
- background: "#fff",
12901
+ background: '#fff',
12884
12902
  fontSize: 12,
12885
12903
  fontWeight: 700,
12886
12904
  lineHeight: 1,
12887
- color: "var(--color-success, #138660)",
12905
+ color: 'var(--color-success, #138660)',
12888
12906
  };
12889
12907
  const totalCellStyle = {
12890
- label: "GridTable-totalCellStyle",
12891
- padding: "12px 16px",
12908
+ label: 'GridTable-totalCellStyle',
12909
+ padding: '12px 16px',
12892
12910
  };
12893
12911
  const totalValueStyle = {
12894
- label: "GridTable-totalValueStyle",
12895
- padding: "12px 16px",
12896
- textAlign: "right",
12912
+ label: 'GridTable-totalValueStyle',
12913
+ padding: '12px 16px',
12914
+ textAlign: 'right',
12897
12915
  fontWeight: 600,
12898
12916
  };
12899
12917
  /**
@@ -12903,19 +12921,19 @@ const totalValueStyle = {
12903
12921
  * it keeps its (0,3,0) rank over the plain `.totalCell` rule without doubling.
12904
12922
  */
12905
12923
  const footerStyle$8 = {
12906
- label: "GridTable-footerStyle",
12907
- display: "none",
12908
- width: "100%",
12924
+ label: 'GridTable-footerStyle',
12925
+ display: 'none',
12926
+ width: '100%',
12909
12927
  fontWeight: 500,
12910
- background: "var(--color-subtle, #eff0f0)",
12911
- borderTop: "1px solid var(--border-color, #ededed)",
12912
- position: "sticky",
12928
+ background: 'var(--color-subtle, #eff0f0)',
12929
+ borderTop: '1px solid var(--border-color, #ededed)',
12930
+ position: 'sticky',
12913
12931
  bottom: 0,
12914
12932
  [`& .${sx(totalCellStyle)}:first-child`]: {
12915
12933
  fontWeight: 600,
12916
12934
  },
12917
- "@media (min-width: 768px)": {
12918
- display: "block",
12935
+ '@media (min-width: 768px)': {
12936
+ display: 'block',
12919
12937
  },
12920
12938
  };
12921
12939
 
@@ -12923,7 +12941,7 @@ const ChevronUp = () => (jsxRuntime.jsx("svg", { width: "16", height: "16", view
12923
12941
  const ChevronDown = () => (jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: jsxRuntime.jsx("polyline", { points: "6 9 12 15 18 9" }) }));
12924
12942
  const ChevronRight$3 = () => (jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: jsxRuntime.jsx("polyline", { points: "9 18 15 12 9 6" }) }));
12925
12943
  /** Width of the leading control column added when `expandable`. */
12926
- const EXPAND_COLUMN_WIDTH = "44px";
12944
+ const EXPAND_COLUMN_WIDTH = '44px';
12927
12945
  function defaultComparator(name) {
12928
12946
  return (a, b) => {
12929
12947
  const av = a[name];
@@ -12935,9 +12953,9 @@ function defaultComparator(name) {
12935
12953
  }
12936
12954
  /** Pulls a number out of a formatted value, so totals work on rendered text. */
12937
12955
  function toNumber(value) {
12938
- if (typeof value === "number")
12956
+ if (typeof value === 'number')
12939
12957
  return value;
12940
- const parsed = parseFloat(String(value).replace(/[^0-9.-]+/g, ""));
12958
+ const parsed = parseFloat(String(value).replace(/[^0-9.-]+/g, ''));
12941
12959
  return Number.isNaN(parsed) ? 0 : parsed;
12942
12960
  }
12943
12961
  /** The row's own key — `rowKey`, then `id` — or undefined when it has neither. */
@@ -12996,7 +13014,7 @@ function deriveKeys(rows, data, rowKey) {
12996
13014
  * again to reverse — and an optional total row sums a column into a sticky
12997
13015
  * footer.
12998
13016
  */
12999
- function GridTable({ columns, data, gridTemplateColumns = `repeat(${columns.length}, minmax(0, 1fr))`, rowKey, header = {}, initialSortColumn, initialSortAscending, secondarySortComparator, bordered = true, hideHeader = false, emptyMessage = "No data available.", totalRow, expandable = false, defaultExpandedRowKeys, expandAll, expandLabel = "row", banner, alignTop = false, rowMarker, draftRow, editRow, flashRowKey, className = "", }) {
13017
+ function GridTable({ columns, data, gridTemplateColumns = `repeat(${columns.length}, minmax(0, 1fr))`, rowKey, header = {}, initialSortColumn, initialSortAscending, secondarySortComparator, bordered = true, hideHeader = false, emptyMessage = 'No data available.', totalRow, expandable = false, defaultExpandedRowKeys, expandAll, expandLabel = 'row', banner, alignTop = false, rowMarker, draftRow, editRow, flashRowKey, className = '', }) {
13000
13018
  const [sortColumn, setSortColumn] = React.useState(initialSortColumn);
13001
13019
  // Ascending unless told otherwise: an omitted initial direction means the
13002
13020
  // first sort column reads ascending (matching the sort itself and the
@@ -13024,9 +13042,7 @@ function GridTable({ columns, data, gridTemplateColumns = `repeat(${columns.leng
13024
13042
  });
13025
13043
  // The control column is a fixed leading track prepended to the caller's
13026
13044
  // template, so every grid — heading, rows and footer — stays aligned.
13027
- const template = expandable
13028
- ? `${EXPAND_COLUMN_WIDTH} ${gridTemplateColumns}`
13029
- : gridTemplateColumns;
13045
+ const template = expandable ? `${EXPAND_COLUMN_WIDTH} ${gridTemplateColumns}` : gridTemplateColumns;
13030
13046
  const sorted = React.useMemo(() => {
13031
13047
  if (!sortColumn)
13032
13048
  return data;
@@ -13091,11 +13107,11 @@ function GridTable({ columns, data, gridTemplateColumns = `repeat(${columns.leng
13091
13107
  const heading = (column, { interactive }) => {
13092
13108
  const sortable = interactive && !!column.sortable && !!column.name;
13093
13109
  const isSorted = sortable && column.name === sortColumn;
13094
- const content = (jsxRuntime.jsxs("span", { className: sx(headingInnerStyle), children: [column.icon && (jsxRuntime.jsx("span", { className: sx(headingIconStyle), children: column.icon })), column.label, column.labelAs?.({ name: column.name }), isSorted && (jsxRuntime.jsx("span", { className: sx(sortIconStyle$1), children: ascending ? jsxRuntime.jsx(ChevronUp, {}) : jsxRuntime.jsx(ChevronDown, {}) }))] }));
13110
+ const content = (jsxRuntime.jsxs("span", { className: sx(headingInnerStyle), children: [column.icon && jsxRuntime.jsx("span", { className: sx(headingIconStyle), children: column.icon }), column.label, column.labelAs?.({ name: column.name }), isSorted && jsxRuntime.jsx("span", { className: sx(sortIconStyle$1), children: ascending ? jsxRuntime.jsx(ChevronUp, {}) : jsxRuntime.jsx(ChevronDown, {}) })] }));
13095
13111
  if (!sortable) {
13096
- return (jsxRuntime.jsx("div", { className: cx(sx(headingStyle$2), column.labelClassName ?? ""), children: content }));
13112
+ return jsxRuntime.jsx("div", { className: cx(sx(headingStyle$2), column.labelClassName ?? ''), children: content });
13097
13113
  }
13098
- return (jsxRuntime.jsx("button", { type: "button", className: cx(sx(headingStyle$2), sx(sortableStyle), column.labelClassName ?? ""), onClick: () => handleSort(column.name), "aria-sort": isSorted ? (ascending ? "ascending" : "descending") : "none", children: content }));
13114
+ return (jsxRuntime.jsx("button", { type: "button", className: cx(sx(headingStyle$2), sx(sortableStyle), column.labelClassName ?? ''), onClick: () => handleSort(column.name), "aria-sort": isSorted ? (ascending ? 'ascending' : 'descending') : 'none', children: content }));
13099
13115
  };
13100
13116
  const total = React.useMemo(() => {
13101
13117
  if (!totalRow)
@@ -13103,25 +13119,21 @@ function GridTable({ columns, data, gridTemplateColumns = `repeat(${columns.leng
13103
13119
  const column = columns.find((c) => c.name === totalRow.columnName);
13104
13120
  return data.reduce((sum, row) => {
13105
13121
  const raw = row[totalRow.columnName];
13106
- return (sum + toNumber(column?.format ? column.format(raw, row) : raw));
13122
+ return sum + toNumber(column?.format ? column.format(raw, row) : raw);
13107
13123
  }, 0);
13108
13124
  }, [columns, data, totalRow]);
13109
- const totalIndex = totalRow
13110
- ? columns.findIndex((c) => c.name === totalRow.columnName)
13111
- : -1;
13125
+ const totalIndex = totalRow ? columns.findIndex((c) => c.name === totalRow.columnName) : -1;
13112
13126
  // Only meaningful in a chronological order: shown when unsorted (the given
13113
13127
  // order) or sorted ascending by the nominated column.
13114
13128
  const markerActive = !!rowMarker &&
13115
- (rowMarker.showWhenSortedBy === undefined ||
13116
- sortColumn === undefined ||
13117
- (sortColumn === rowMarker.showWhenSortedBy && ascending !== false));
13118
- const marker = rowMarker && markerActive ? (jsxRuntime.jsxs("div", { className: sx(markerStyle), role: "separator", "aria-label": typeof rowMarker.label === "string" ? rowMarker.label : undefined, children: [jsxRuntime.jsx("span", { className: sx(markerLineStyle), "aria-hidden": "true" }), rowMarker.label != null && (jsxRuntime.jsx("span", { className: sx(markerLabelStyle), children: rowMarker.label }))] })) : null;
13129
+ (rowMarker.showWhenSortedBy === undefined || sortColumn === undefined || (sortColumn === rowMarker.showWhenSortedBy && ascending !== false));
13130
+ const marker = rowMarker && markerActive ? (jsxRuntime.jsxs("div", { className: sx(markerStyle), role: "separator", "aria-label": typeof rowMarker.label === 'string' ? rowMarker.label : undefined, children: [jsxRuntime.jsx("span", { className: sx(markerLineStyle), "aria-hidden": "true" }), rowMarker.label != null && jsxRuntime.jsx("span", { className: sx(markerLabelStyle), children: rowMarker.label })] })) : null;
13119
13131
  // `atEnd` is the fallback for when no row matches, so it must not also fire when
13120
13132
  // `beforeKey` does — otherwise a marker set with both would render twice. Test
13121
13133
  // membership rather than truthiness so a legitimate empty-string key still
13122
13134
  // counts as a match.
13123
13135
  const markerBeforeMatches = rowMarker?.beforeKey != null && allKeys.includes(rowMarker.beforeKey);
13124
- return (jsxRuntime.jsxs("div", { className: cx(sx(tableStyle$8), className), children: [banner && jsxRuntime.jsx("div", { className: sx(bannerStyle$2), children: banner }), !hideHeader && (jsxRuntime.jsxs("div", { className: sx(headerStyle$x), children: [header.above, jsxRuntime.jsxs("div", { className: sx(gridStyle$7), style: { gridTemplateColumns: template }, children: [expandable && (jsxRuntime.jsx("div", { className: sx(headingStyle$2), "aria-hidden": "true" })), columns.map((column, i) => (jsxRuntime.jsx(React.Fragment, { children: heading(column, { interactive: true }) }, i)))] }), header.below] })), !sorted.length && !draftRow ? (jsxRuntime.jsx("div", { className: sx(emptyStyle$d), children: emptyMessage })) : (jsxRuntime.jsxs("div", { className: sx(bodyStyle$5), children: [draftRow && jsxRuntime.jsx("div", { className: sx(draftRowStyle), children: draftRow }), sorted.map((row, rowIndex) => {
13136
+ return (jsxRuntime.jsxs("div", { className: cx(sx(tableStyle$8), className), children: [banner && jsxRuntime.jsx("div", { className: sx(bannerStyle$2), children: banner }), !hideHeader && (jsxRuntime.jsxs("div", { className: sx(headerStyle$x), children: [header.above, jsxRuntime.jsxs("div", { className: sx(gridStyle$7), style: { gridTemplateColumns: template }, children: [expandable && jsxRuntime.jsx("div", { className: sx(headingStyle$2), "aria-hidden": "true" }), columns.map((column, i) => (jsxRuntime.jsx(React.Fragment, { children: heading(column, { interactive: true }) }, i)))] }), header.below] })), !sorted.length && !draftRow ? (jsxRuntime.jsx("div", { className: sx(emptyStyle$d), children: emptyMessage })) : (jsxRuntime.jsxs("div", { className: sx(bodyStyle$5), children: [draftRow && jsxRuntime.jsx("div", { className: sx(draftRowStyle), children: draftRow }), sorted.map((row, rowIndex) => {
13125
13137
  const record = row;
13126
13138
  const key = allKeys[rowIndex];
13127
13139
  // Only an expandable table exposes expansion; without it, a lingering
@@ -13129,33 +13141,14 @@ function GridTable({ columns, data, gridTemplateColumns = `repeat(${columns.leng
13129
13141
  // after expandable was turned off) must not leak `expanded: true` to
13130
13142
  // renderers that have no toggle to collapse it.
13131
13143
  const expanded = expandable && expandedKeys.has(key);
13132
- return (jsxRuntime.jsxs(React.Fragment, { children: [marker && rowMarker?.beforeKey === key && marker, editRow?.key === key ? (jsxRuntime.jsx("div", { className: sx(draftRowStyle), "data-rowid": key, "data-testid": `row-${key}`, "data-editing": "true", children: editRow.content })) : (jsxRuntime.jsxs("div", { className: cx(sx(rowStyle$5), bordered ? sx(borderedStyle) : "", flashRowKey === key ? sx(flashRowStyle) : ""), style: { gridTemplateColumns: template }, "data-rowid": key, "data-testid": `row-${key}`, "data-flash": flashRowKey === key ? "true" : undefined, children: [expandable && (jsxRuntime.jsx("div", { className: sx(expandCellStyle), children: jsxRuntime.jsx("button", { type: "button", className: sx(expandButtonStyle$1), onClick: () => toggleRow(key), "aria-expanded": expanded, "aria-label": `${expanded ? "Collapse" : "Expand"} ${typeof expandLabel === "function" ? expandLabel(row, rowIndex) : expandLabel}`, children: expanded ? jsxRuntime.jsx(ChevronDown, {}) : jsxRuntime.jsx(ChevronRight$3, {}) }) })), columns.map((column, colIndex) => {
13133
- const value = column.name
13134
- ? record[column.name]
13135
- : undefined;
13136
- const formatted = column.format
13137
- ? column.format(value, row)
13138
- : value;
13139
- return (jsxRuntime.jsxs("div", { className: sx(cellWrapStyle), ...(column.name
13140
- ? { "data-colname": column.name }
13141
- : {}), children: [column.label && (jsxRuntime.jsx("div", { className: sx(stackedLabelStyle), children: heading(column, { interactive: false }) })), jsxRuntime.jsx("div", { className: cx(sx(cellStyle$2), alignTop ? sx(cellTopStyle) : "", column.className ?? ""), children: column.as ? (column.as({
13142
- row,
13143
- rowIndex,
13144
- name: column.name,
13145
- expanded,
13146
- })) : column.name ? (jsxRuntime.jsx("span", { className: sx(valueStyle$2), children: formatted || jsxRuntime.jsx(jsxRuntime.Fragment, { children: "\u2013" }) })) : null })] }, colIndex));
13144
+ return (jsxRuntime.jsxs(React.Fragment, { children: [marker && rowMarker?.beforeKey === key && marker, editRow?.key === key ? (jsxRuntime.jsx("div", { className: cx(sx(editRowStyle), bordered ? sx(borderedStyle) : ''), "data-rowid": key, "data-testid": `row-${key}`, "data-editing": "true", children: editRow.content })) : (jsxRuntime.jsxs("div", { className: cx(sx(rowStyle$5), bordered ? sx(borderedStyle) : '', flashRowKey === key ? sx(flashRowStyle) : ''), style: { gridTemplateColumns: template }, "data-rowid": key, "data-testid": `row-${key}`, "data-flash": flashRowKey === key ? 'true' : undefined, children: [expandable && (jsxRuntime.jsx("div", { className: sx(expandCellStyle), children: jsxRuntime.jsx("button", { type: "button", className: sx(expandButtonStyle$1), onClick: () => toggleRow(key), "aria-expanded": expanded, "aria-label": `${expanded ? 'Collapse' : 'Expand'} ${typeof expandLabel === 'function' ? expandLabel(row, rowIndex) : expandLabel}`, children: expanded ? jsxRuntime.jsx(ChevronDown, {}) : jsxRuntime.jsx(ChevronRight$3, {}) }) })), columns.map((column, colIndex) => {
13145
+ const value = column.name ? record[column.name] : undefined;
13146
+ const formatted = column.format ? column.format(value, row) : value;
13147
+ return (jsxRuntime.jsxs("div", { className: sx(cellWrapStyle), ...(column.name ? { 'data-colname': column.name } : {}), children: [column.label && jsxRuntime.jsx("div", { className: sx(stackedLabelStyle), children: heading(column, { interactive: false }) }), jsxRuntime.jsx("div", { className: cx(sx(cellStyle$2), alignTop ? sx(cellTopStyle) : '', column.className ?? ''), children: column.as ? (column.as({ row, rowIndex, name: column.name, expanded })) : column.name ? (jsxRuntime.jsx("span", { className: sx(valueStyle$2), children: formatted || jsxRuntime.jsx(jsxRuntime.Fragment, { children: "\u2013" }) })) : null })] }, colIndex));
13147
13148
  })] }, key))] }, key));
13148
- }), marker &&
13149
- rowMarker?.atEnd &&
13150
- !markerBeforeMatches &&
13151
- sorted.length > 0 &&
13152
- marker] })), totalRow && (jsxRuntime.jsx("div", { className: sx(footerStyle$8), children: jsxRuntime.jsxs("div", { className: sx(gridStyle$7), style: { gridTemplateColumns: template }, children: [expandable && (jsxRuntime.jsx("div", { className: sx(totalCellStyle), "aria-hidden": "true" })), columns.map((_, i) => (jsxRuntime.jsx("div", { className: i === totalIndex ? sx(totalValueStyle) : sx(totalCellStyle), children: i === 0
13153
- ? totalRow.label
13154
- : i === totalIndex
13155
- ? total.toLocaleString()
13156
- : null }, i)))] }) }))] }));
13157
- }
13158
- GridTable.displayName = "GridTable";
13149
+ }), marker && rowMarker?.atEnd && !markerBeforeMatches && sorted.length > 0 && marker] })), totalRow && (jsxRuntime.jsx("div", { className: sx(footerStyle$8), children: jsxRuntime.jsxs("div", { className: sx(gridStyle$7), style: { gridTemplateColumns: template }, children: [expandable && jsxRuntime.jsx("div", { className: sx(totalCellStyle), "aria-hidden": "true" }), columns.map((_, i) => (jsxRuntime.jsx("div", { className: i === totalIndex ? sx(totalValueStyle) : sx(totalCellStyle), children: i === 0 ? totalRow.label : i === totalIndex ? total.toLocaleString() : null }, i)))] }) }))] }));
13150
+ }
13151
+ GridTable.displayName = 'GridTable';
13159
13152
 
13160
13153
  /**
13161
13154
  * HubAppShell's compiled rules.