@wallarm-org/design-system 2.4.1-rc-fix-code-snippet-fullscreen-in-dialog.1 → 2.5.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.
@@ -2,18 +2,19 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useRef } from "react";
3
3
  import { cn } from "../../utils/cn.js";
4
4
  import { useStickyGroupParent } from "./hooks/index.js";
5
- import { TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_EXPAND_COLUMN_ID, TABLE_SELECT_COLUMN_ID, useTableValue, withTableState } from "./lib/index.js";
5
+ import { TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_EXPAND_COLUMN_ID, TABLE_SELECT_COLUMN_ID, useRenderEveryTime, useTableValue, withTableState } from "./lib/index.js";
6
6
  import { Td, Tr } from "./primitives/index.js";
7
7
  import { TableBodyCell } from "./TableBody/TableBodyCell.js";
8
8
  import { TableColGroup } from "./TableColGroup.js";
9
9
  import { useTableContext } from "./TableContext/index.js";
10
+ import { TableFullWidthCell } from "./TableRow.js";
10
11
  const SYSTEM_COLUMN_IDS = new Set([
11
12
  TABLE_EXPAND_COLUMN_ID,
12
13
  TABLE_SELECT_COLUMN_ID,
13
14
  TABLE_DRAG_HANDLE_COLUMN_ID
14
15
  ]);
15
16
  const StickyGroupParent = ({ tableWidth, headerHeight })=>{
16
- const { table, containerRef, tbodyRef, virtualizerRef, virtualized } = useTableContext();
17
+ const { table, containerRef, tbodyRef, virtualizerRef, virtualized, renderFullWidthGroupRow } = useTableContext();
17
18
  const useWindowScroll = 'window' === virtualized;
18
19
  const { stickyRow, pushUpOffset } = useStickyGroupParent({
19
20
  table,
@@ -64,6 +65,8 @@ const StickyGroupParent = ({ tableWidth, headerHeight })=>{
64
65
  const dataCells = cells?.filter((c)=>!SYSTEM_COLUMN_IDS.has(c.column.id));
65
66
  const firstDataCell = dataCells?.[0];
66
67
  const isSelected = useTableValue(()=>stickyRow?.getIsAllSubRowsSelected());
68
+ const fullWidthContent = useRenderEveryTime(()=>stickyRow ? renderFullWidthGroupRow?.(stickyRow) : void 0);
69
+ const isFullWidth = void 0 !== fullWidthContent;
67
70
  return /*#__PURE__*/ jsx("div", {
68
71
  className: "sticky z-[21] h-0 overflow-visible pointer-events-none",
69
72
  style: {
@@ -98,12 +101,16 @@ const StickyGroupParent = ({ tableWidth, headerHeight })=>{
98
101
  cell: cell,
99
102
  disablePinnedShadow: true
100
103
  }, cell.id)),
101
- firstDataCell && /*#__PURE__*/ jsx(TableBodyCell, {
104
+ isFullWidth && /*#__PURE__*/ jsx(TableFullWidthCell, {
105
+ colSpan: dataCells.length,
106
+ children: fullWidthContent
107
+ }),
108
+ !isFullWidth && firstDataCell && /*#__PURE__*/ jsx(TableBodyCell, {
102
109
  cell: firstDataCell,
103
110
  className: "border-r-0",
104
111
  disablePinnedShadow: true
105
112
  }),
106
- withTableState(table.state, ()=>dataCells.slice(1).map((cell)=>/*#__PURE__*/ jsx(Td, {
113
+ withTableState(table.state, ()=>(isFullWidth ? [] : dataCells).slice(1).map((cell)=>/*#__PURE__*/ jsx(Td, {
107
114
  className: cn('border-b border-border-primary-light bg-bg-surface-2 overlay', 'group-hover/row:overlay-states-primary-hover group-data-[selected]/row:overlay-states-primary-active', 'group-data-[preview-active]/row:overlay-states-primary-hover group-has-[[data-state=open]]/row:overlay-states-primary-hover'),
108
115
  style: {
109
116
  width: cell.column.getSize()
@@ -1,17 +1,25 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { c as compiler_runtime_c } from "react/compiler-runtime";
3
3
  import { flexRender } from "@tanstack/react-table";
4
4
  import { cn } from "../../../utils/cn.js";
5
- import { getAlignClass, withTableState } from "../lib/index.js";
5
+ import { getAlignClass, useRenderEveryTime, withTableState } from "../lib/index.js";
6
6
  import { Td, Tr } from "../primitives/index.js";
7
7
  import { useTableContext } from "../TableContext/index.js";
8
8
  const TableRowOverlayInner = (t0)=>{
9
- const $ = compiler_runtime_c(6);
9
+ const $ = compiler_runtime_c(10);
10
10
  const { row } = t0;
11
- const { table } = useTableContext();
11
+ const { table, renderFullWidthRow } = useTableContext();
12
12
  let t1;
13
- if ($[0] !== row || $[1] !== table) {
14
- t1 = ()=>{
13
+ if ($[0] !== renderFullWidthRow || $[1] !== row) {
14
+ t1 = ()=>renderFullWidthRow?.(row);
15
+ $[0] = renderFullWidthRow;
16
+ $[1] = row;
17
+ $[2] = t1;
18
+ } else t1 = $[2];
19
+ const fullWidthContent = useRenderEveryTime(t1);
20
+ let t2;
21
+ if ($[3] !== fullWidthContent || $[4] !== row || $[5] !== table) {
22
+ t2 = ()=>{
15
23
  const visibleColumns = table.getVisibleLeafColumns();
16
24
  return /*#__PURE__*/ jsx("table", {
17
25
  className: "w-full table-fixed border-collapse",
@@ -20,36 +28,44 @@ const TableRowOverlayInner = (t0)=>{
20
28
  cursor: "grabbing"
21
29
  },
22
30
  children: /*#__PURE__*/ jsx("tbody", {
23
- children: /*#__PURE__*/ jsx(Tr, {
31
+ children: /*#__PURE__*/ jsxs(Tr, {
24
32
  className: "pointer-events-none shadow-lg opacity-90 bg-bg-primary",
25
- children: row.getVisibleCells().map((cell)=>{
26
- const column = visibleColumns.find((c)=>c.id === cell.column.id);
27
- const meta = cell.column.columnDef.meta;
28
- return /*#__PURE__*/ jsx(Td, {
33
+ children: [
34
+ void 0 !== fullWidthContent && /*#__PURE__*/ jsx(Td, {
29
35
  pinned: false,
30
- className: cn(getAlignClass(meta), meta?.cellClassName),
31
- style: {
32
- width: column?.getSize()
33
- },
34
- children: flexRender(cell.column.columnDef.cell, cell.getContext())
35
- }, cell.id);
36
- })
36
+ colSpan: row.getVisibleCells().length,
37
+ children: fullWidthContent
38
+ }),
39
+ (void 0 === fullWidthContent ? row.getVisibleCells() : []).map((cell)=>{
40
+ const column = visibleColumns.find((c)=>c.id === cell.column.id);
41
+ const meta = cell.column.columnDef.meta;
42
+ return /*#__PURE__*/ jsx(Td, {
43
+ pinned: false,
44
+ className: cn(getAlignClass(meta), meta?.cellClassName),
45
+ style: {
46
+ width: column?.getSize()
47
+ },
48
+ children: flexRender(cell.column.columnDef.cell, cell.getContext())
49
+ }, cell.id);
50
+ })
51
+ ]
37
52
  })
38
53
  })
39
54
  });
40
55
  };
41
- $[0] = row;
42
- $[1] = table;
43
- $[2] = t1;
44
- } else t1 = $[2];
45
- let t2;
46
- if ($[3] !== t1 || $[4] !== table.state) {
47
- t2 = withTableState(table.state, t1);
48
- $[3] = t1;
49
- $[4] = table.state;
50
- $[5] = t2;
51
- } else t2 = $[5];
52
- return t2;
56
+ $[3] = fullWidthContent;
57
+ $[4] = row;
58
+ $[5] = table;
59
+ $[6] = t2;
60
+ } else t2 = $[6];
61
+ let t3;
62
+ if ($[7] !== t2 || $[8] !== table.state) {
63
+ t3 = withTableState(table.state, t2);
64
+ $[7] = t2;
65
+ $[8] = table.state;
66
+ $[9] = t3;
67
+ } else t3 = $[9];
68
+ return t3;
53
69
  };
54
70
  const TableRowOverlay = TableRowOverlayInner;
55
71
  TableRowOverlay.displayName = "TableRowOverlay";