@osdk/react-components 0.1.0-beta.2 → 0.1.0-beta.4

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.
Files changed (76) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +51 -1
  3. package/build/browser/base-components/checkbox/Checkbox.js +40 -0
  4. package/build/browser/base-components/checkbox/Checkbox.js.map +1 -0
  5. package/build/browser/base-components/checkbox/Checkbox.module.css +73 -0
  6. package/build/browser/css-modules.d.ts +20 -0
  7. package/build/browser/object-table/CellContextMenu.js +2 -2
  8. package/build/browser/object-table/CellContextMenu.js.map +1 -1
  9. package/build/browser/object-table/CellContextMenu.module.css +20 -0
  10. package/build/browser/object-table/ObjectTable.js +2 -1
  11. package/build/browser/object-table/ObjectTable.js.map +1 -1
  12. package/build/browser/object-table/ObjectTableApi.js.map +1 -1
  13. package/build/browser/object-table/SelectionCells.js +11 -33
  14. package/build/browser/object-table/SelectionCells.js.map +1 -1
  15. package/build/browser/object-table/Table.js +6 -15
  16. package/build/browser/object-table/Table.js.map +1 -1
  17. package/build/browser/object-table/Table.module.css +21 -0
  18. package/build/browser/object-table/TableBody.js +2 -2
  19. package/build/browser/object-table/TableBody.js.map +1 -1
  20. package/build/browser/object-table/TableBody.module.css +20 -0
  21. package/build/browser/object-table/TableCell.js +5 -3
  22. package/build/browser/object-table/TableCell.js.map +1 -1
  23. package/build/browser/object-table/TableCell.module.css +46 -0
  24. package/build/browser/object-table/TableHeader.js +12 -30
  25. package/build/browser/object-table/TableHeader.js.map +1 -1
  26. package/build/browser/object-table/TableHeader.module.css +78 -0
  27. package/build/browser/object-table/TableRow.js +4 -3
  28. package/build/browser/object-table/TableRow.js.map +1 -1
  29. package/build/browser/object-table/TableRow.module.css +60 -0
  30. package/build/cjs/public/experimental.cjs +143 -3716
  31. package/build/cjs/public/experimental.cjs.map +1 -1
  32. package/build/cjs/public/experimental.css +180 -0
  33. package/build/cjs/public/experimental.css.map +1 -0
  34. package/build/cjs/public/experimental.d.cts +1 -0
  35. package/build/esm/base-components/checkbox/Checkbox.js +40 -0
  36. package/build/esm/base-components/checkbox/Checkbox.js.map +1 -0
  37. package/build/esm/base-components/checkbox/Checkbox.module.css +73 -0
  38. package/build/esm/css-modules.d.ts +20 -0
  39. package/build/esm/object-table/CellContextMenu.js +2 -2
  40. package/build/esm/object-table/CellContextMenu.js.map +1 -1
  41. package/build/esm/object-table/CellContextMenu.module.css +20 -0
  42. package/build/esm/object-table/ObjectTable.js +2 -1
  43. package/build/esm/object-table/ObjectTable.js.map +1 -1
  44. package/build/esm/object-table/ObjectTableApi.js.map +1 -1
  45. package/build/esm/object-table/SelectionCells.js +11 -33
  46. package/build/esm/object-table/SelectionCells.js.map +1 -1
  47. package/build/esm/object-table/Table.js +6 -15
  48. package/build/esm/object-table/Table.js.map +1 -1
  49. package/build/esm/object-table/Table.module.css +21 -0
  50. package/build/esm/object-table/TableBody.js +2 -2
  51. package/build/esm/object-table/TableBody.js.map +1 -1
  52. package/build/esm/object-table/TableBody.module.css +20 -0
  53. package/build/esm/object-table/TableCell.js +5 -3
  54. package/build/esm/object-table/TableCell.js.map +1 -1
  55. package/build/esm/object-table/TableCell.module.css +46 -0
  56. package/build/esm/object-table/TableHeader.js +12 -30
  57. package/build/esm/object-table/TableHeader.js.map +1 -1
  58. package/build/esm/object-table/TableHeader.module.css +78 -0
  59. package/build/esm/object-table/TableRow.js +4 -3
  60. package/build/esm/object-table/TableRow.js.map +1 -1
  61. package/build/esm/object-table/TableRow.module.css +60 -0
  62. package/build/types/base-components/checkbox/Checkbox.d.ts +10 -0
  63. package/build/types/base-components/checkbox/Checkbox.d.ts.map +1 -0
  64. package/build/types/css-modules.d.d.ts +6 -0
  65. package/build/types/css-modules.d.d.ts.map +1 -0
  66. package/build/types/object-table/CellContextMenu.d.ts.map +1 -1
  67. package/build/types/object-table/ObjectTableApi.d.ts +1 -0
  68. package/build/types/object-table/ObjectTableApi.d.ts.map +1 -1
  69. package/build/types/object-table/SelectionCells.d.ts.map +1 -1
  70. package/build/types/object-table/Table.d.ts +2 -1
  71. package/build/types/object-table/Table.d.ts.map +1 -1
  72. package/build/types/object-table/TableBody.d.ts.map +1 -1
  73. package/build/types/object-table/TableCell.d.ts.map +1 -1
  74. package/build/types/object-table/TableHeader.d.ts.map +1 -1
  75. package/build/types/object-table/TableRow.d.ts.map +1 -1
  76. package/package.json +13 -8
@@ -1 +1 @@
1
- {"version":3,"file":"TableBody.js","names":["useVirtualizer","React","useLayoutEffect","TableRow","TableBody","rows","tableContainerRef","onRowClick","renderCellContextMenu","rowHeight","rowVirtualizer","count","length","estimateSize","getScrollElement","current","overscan","measure","createElement","style","display","position","height","getTotalSize","getVirtualItems","map","virtualRow","row","index","key","id"],"sources":["TableBody.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Cell, Row, RowData } from \"@tanstack/react-table\";\nimport { useVirtualizer } from \"@tanstack/react-virtual\";\nimport React, { useLayoutEffect } from \"react\";\nimport { TableRow } from \"./TableRow.js\";\n\ninterface TableBodyProps<TData extends RowData> {\n rows: Array<Row<TData>>;\n tableContainerRef: React.RefObject<HTMLDivElement>;\n onRowClick?: (row: TData) => void;\n rowHeight?: number;\n renderCellContextMenu?: (\n row: TData,\n cell: Cell<TData, unknown>,\n ) => React.ReactNode;\n}\n\nexport function TableBody<TData extends RowData>({\n rows,\n tableContainerRef,\n onRowClick,\n renderCellContextMenu,\n rowHeight = 40,\n}: TableBodyProps<TData>): React.ReactElement {\n // Important: Keep the row virtualizer in the lowest component possible to avoid unnecessary re-renders.\n const rowVirtualizer = useVirtualizer<HTMLDivElement, HTMLTableRowElement>({\n count: rows.length,\n estimateSize: () => rowHeight,\n getScrollElement: () => tableContainerRef.current,\n overscan: 5,\n });\n\n // Measure the virtualizer after the DOM has been laid out to ensure proper dimensions\n useLayoutEffect(() => {\n rowVirtualizer.measure();\n }, [rowVirtualizer, rows.length]);\n\n return (\n <tbody\n style={{\n display: \"grid\",\n position: \"relative\",\n height: `${rowVirtualizer.getTotalSize()}px`,\n }}\n >\n {rowVirtualizer.getVirtualItems().map((virtualRow) => {\n const row = rows[virtualRow.index];\n\n return (\n <TableRow\n key={row.id}\n row={row}\n virtualRow={virtualRow}\n onRowClick={onRowClick}\n renderCellContextMenu={renderCellContextMenu}\n />\n );\n })}\n </tbody>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,cAAc,QAAQ,yBAAyB;AACxD,OAAOC,KAAK,IAAIC,eAAe,QAAQ,OAAO;AAC9C,SAASC,QAAQ,QAAQ,eAAe;AAaxC,OAAO,SAASC,SAASA,CAAwB;EAC/CC,IAAI;EACJC,iBAAiB;EACjBC,UAAU;EACVC,qBAAqB;EACrBC,SAAS,GAAG;AACS,CAAC,EAAsB;EAC5C;EACA,MAAMC,cAAc,GAAGV,cAAc,CAAsC;IACzEW,KAAK,EAAEN,IAAI,CAACO,MAAM;IAClBC,YAAY,EAAEA,CAAA,KAAMJ,SAAS;IAC7BK,gBAAgB,EAAEA,CAAA,KAAMR,iBAAiB,CAACS,OAAO;IACjDC,QAAQ,EAAE;EACZ,CAAC,CAAC;;EAEF;EACAd,eAAe,CAAC,MAAM;IACpBQ,cAAc,CAACO,OAAO,CAAC,CAAC;EAC1B,CAAC,EAAE,CAACP,cAAc,EAAEL,IAAI,CAACO,MAAM,CAAC,CAAC;EAEjC,oBACEX,KAAA,CAAAiB,aAAA;IACEC,KAAK,EAAE;MACLC,OAAO,EAAE,MAAM;MACfC,QAAQ,EAAE,UAAU;MACpBC,MAAM,EAAE,GAAGZ,cAAc,CAACa,YAAY,CAAC,CAAC;IAC1C;EAAE,GAEDb,cAAc,CAACc,eAAe,CAAC,CAAC,CAACC,GAAG,CAAEC,UAAU,IAAK;IACpD,MAAMC,GAAG,GAAGtB,IAAI,CAACqB,UAAU,CAACE,KAAK,CAAC;IAElC,oBACE3B,KAAA,CAAAiB,aAAA,CAACf,QAAQ;MACP0B,GAAG,EAAEF,GAAG,CAACG,EAAG;MACZH,GAAG,EAAEA,GAAI;MACTD,UAAU,EAAEA,UAAW;MACvBnB,UAAU,EAAEA,UAAW;MACvBC,qBAAqB,EAAEA;IAAsB,CAC9C,CAAC;EAEN,CAAC,CACI,CAAC;AAEZ","ignoreList":[]}
1
+ {"version":3,"file":"TableBody.js","names":["useVirtualizer","React","useLayoutEffect","styles","TableRow","TableBody","rows","tableContainerRef","onRowClick","renderCellContextMenu","rowHeight","rowVirtualizer","count","length","estimateSize","getScrollElement","current","overscan","measure","createElement","className","osdkTableBody","style","height","getTotalSize","getVirtualItems","map","virtualRow","row","index","key","id"],"sources":["TableBody.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Cell, Row, RowData } from \"@tanstack/react-table\";\nimport { useVirtualizer } from \"@tanstack/react-virtual\";\nimport React, { useLayoutEffect } from \"react\";\nimport styles from \"./TableBody.module.css\";\nimport { TableRow } from \"./TableRow.js\";\n\ninterface TableBodyProps<TData extends RowData> {\n rows: Array<Row<TData>>;\n tableContainerRef: React.RefObject<HTMLDivElement>;\n onRowClick?: (row: TData) => void;\n rowHeight?: number;\n renderCellContextMenu?: (\n row: TData,\n cell: Cell<TData, unknown>,\n ) => React.ReactNode;\n}\n\nexport function TableBody<TData extends RowData>({\n rows,\n tableContainerRef,\n onRowClick,\n renderCellContextMenu,\n rowHeight = 40,\n}: TableBodyProps<TData>): React.ReactElement {\n // Important: Keep the row virtualizer in the lowest component possible to avoid unnecessary re-renders.\n const rowVirtualizer = useVirtualizer<HTMLDivElement, HTMLTableRowElement>({\n count: rows.length,\n estimateSize: () => rowHeight,\n getScrollElement: () => tableContainerRef.current,\n overscan: 5,\n });\n\n // Measure the virtualizer after the DOM has been laid out to ensure proper dimensions\n useLayoutEffect(() => {\n rowVirtualizer.measure();\n }, [rowVirtualizer, rows.length]);\n\n return (\n <tbody\n className={styles.osdkTableBody}\n style={{\n height: `${rowVirtualizer.getTotalSize()}px`,\n }}\n >\n {rowVirtualizer.getVirtualItems().map((virtualRow) => {\n const row = rows[virtualRow.index];\n\n return (\n <TableRow\n key={row.id}\n row={row}\n virtualRow={virtualRow}\n onRowClick={onRowClick}\n renderCellContextMenu={renderCellContextMenu}\n />\n );\n })}\n </tbody>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,cAAc,QAAQ,yBAAyB;AACxD,OAAOC,KAAK,IAAIC,eAAe,QAAQ,OAAO;AAC9C,OAAOC,MAAM,MAAM,wBAAwB;AAC3C,SAASC,QAAQ,QAAQ,eAAe;AAaxC,OAAO,SAASC,SAASA,CAAwB;EAC/CC,IAAI;EACJC,iBAAiB;EACjBC,UAAU;EACVC,qBAAqB;EACrBC,SAAS,GAAG;AACS,CAAC,EAAsB;EAC5C;EACA,MAAMC,cAAc,GAAGX,cAAc,CAAsC;IACzEY,KAAK,EAAEN,IAAI,CAACO,MAAM;IAClBC,YAAY,EAAEA,CAAA,KAAMJ,SAAS;IAC7BK,gBAAgB,EAAEA,CAAA,KAAMR,iBAAiB,CAACS,OAAO;IACjDC,QAAQ,EAAE;EACZ,CAAC,CAAC;;EAEF;EACAf,eAAe,CAAC,MAAM;IACpBS,cAAc,CAACO,OAAO,CAAC,CAAC;EAC1B,CAAC,EAAE,CAACP,cAAc,EAAEL,IAAI,CAACO,MAAM,CAAC,CAAC;EAEjC,oBACEZ,KAAA,CAAAkB,aAAA;IACEC,SAAS,EAAEjB,MAAM,CAACkB,aAAc;IAChCC,KAAK,EAAE;MACLC,MAAM,EAAE,GAAGZ,cAAc,CAACa,YAAY,CAAC,CAAC;IAC1C;EAAE,GAEDb,cAAc,CAACc,eAAe,CAAC,CAAC,CAACC,GAAG,CAAEC,UAAU,IAAK;IACpD,MAAMC,GAAG,GAAGtB,IAAI,CAACqB,UAAU,CAACE,KAAK,CAAC;IAElC,oBACE5B,KAAA,CAAAkB,aAAA,CAACf,QAAQ;MACP0B,GAAG,EAAEF,GAAG,CAACG,EAAG;MACZH,GAAG,EAAEA,GAAI;MACTD,UAAU,EAAEA,UAAW;MACvBnB,UAAU,EAAEA,UAAW;MACvBC,qBAAqB,EAAEA;IAAsB,CAC9C,CAAC;EAEN,CAAC,CACI,CAAC;AAEZ","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ .osdkTableBody {
18
+ display: grid;
19
+ position: relative;
20
+ }
@@ -19,6 +19,7 @@ import React, { useRef } from "react";
19
19
  import { CellContextMenu } from "./CellContextMenu.js";
20
20
  import { useCellContextMenu } from "./hooks/useCellContextMenu.js";
21
21
  import { SELECTION_COLUMN_ID } from "./hooks/useSelectionColumn.js";
22
+ import styles from "./TableCell.module.css";
22
23
  export function TableCell({
23
24
  cell,
24
25
  renderCellContextMenu
@@ -35,13 +36,14 @@ export function TableCell({
35
36
  });
36
37
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("td", {
37
38
  ref: tdRef,
39
+ className: styles.osdkTableCell,
38
40
  style: {
39
- display: "flex",
40
- alignItems: "center",
41
41
  width: cell.column.getSize()
42
42
  },
43
43
  onContextMenu: handleOpenContextMenu
44
- }, flexRender(cell.column.columnDef.cell, cell.getContext())), !isSelectColumn && isContextMenuOpen && !!popoverPosition && !!renderCellContextMenu && /*#__PURE__*/React.createElement(CellContextMenu, {
44
+ }, /*#__PURE__*/React.createElement("div", {
45
+ className: styles.osdkTableCellContent
46
+ }, flexRender(cell.column.columnDef.cell, cell.getContext()))), !isSelectColumn && isContextMenuOpen && !!popoverPosition && !!renderCellContextMenu && /*#__PURE__*/React.createElement(CellContextMenu, {
45
47
  cell: cell,
46
48
  position: popoverPosition,
47
49
  onClose: handleCloseContextMenu,
@@ -1 +1 @@
1
- {"version":3,"file":"TableCell.js","names":["flexRender","React","useRef","CellContextMenu","useCellContextMenu","SELECTION_COLUMN_ID","TableCell","cell","renderCellContextMenu","tdRef","isSelectColumn","column","id","isContextMenuOpen","handleOpenContextMenu","handleCloseContextMenu","popoverPosition","createElement","Fragment","ref","style","display","alignItems","width","getSize","onContextMenu","columnDef","getContext","position","onClose","renderContent"],"sources":["TableCell.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Cell, RowData } from \"@tanstack/react-table\";\nimport { flexRender } from \"@tanstack/react-table\";\nimport React, { useRef } from \"react\";\nimport { CellContextMenu } from \"./CellContextMenu.js\";\nimport { useCellContextMenu } from \"./hooks/useCellContextMenu.js\";\nimport { SELECTION_COLUMN_ID } from \"./hooks/useSelectionColumn.js\";\n\ninterface TableCellProps<TData extends RowData> {\n cell: Cell<TData, unknown>;\n renderCellContextMenu?: (\n row: TData,\n cell: Cell<TData, unknown>,\n ) => React.ReactNode;\n}\n\nexport function TableCell<TData extends RowData>(\n { cell, renderCellContextMenu }: TableCellProps<TData>,\n): React.ReactElement {\n const tdRef = useRef<HTMLTableCellElement>(null);\n const isSelectColumn = cell.column.id === SELECTION_COLUMN_ID;\n\n const {\n isContextMenuOpen,\n handleOpenContextMenu,\n handleCloseContextMenu,\n popoverPosition,\n } = useCellContextMenu({\n tdRef,\n });\n\n const shouldRenderContextMenu = !isSelectColumn && isContextMenuOpen\n && !!popoverPosition\n && !!renderCellContextMenu;\n\n return (\n <>\n <td\n ref={tdRef}\n style={{\n display: \"flex\",\n alignItems: \"center\",\n width: cell.column.getSize(),\n }}\n onContextMenu={handleOpenContextMenu}\n >\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </td>\n {shouldRenderContextMenu\n && (\n <CellContextMenu\n cell={cell}\n position={popoverPosition}\n onClose={handleCloseContextMenu}\n renderContent={renderCellContextMenu}\n />\n )}\n </>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,UAAU,QAAQ,uBAAuB;AAClD,OAAOC,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,mBAAmB,QAAQ,+BAA+B;AAUnE,OAAO,SAASC,SAASA,CACvB;EAAEC,IAAI;EAAEC;AAA6C,CAAC,EAClC;EACpB,MAAMC,KAAK,GAAGP,MAAM,CAAuB,IAAI,CAAC;EAChD,MAAMQ,cAAc,GAAGH,IAAI,CAACI,MAAM,CAACC,EAAE,KAAKP,mBAAmB;EAE7D,MAAM;IACJQ,iBAAiB;IACjBC,qBAAqB;IACrBC,sBAAsB;IACtBC;EACF,CAAC,GAAGZ,kBAAkB,CAAC;IACrBK;EACF,CAAC,CAAC;EAMF,oBACER,KAAA,CAAAgB,aAAA,CAAAhB,KAAA,CAAAiB,QAAA,qBACEjB,KAAA,CAAAgB,aAAA;IACEE,GAAG,EAAEV,KAAM;IACXW,KAAK,EAAE;MACLC,OAAO,EAAE,MAAM;MACfC,UAAU,EAAE,QAAQ;MACpBC,KAAK,EAAEhB,IAAI,CAACI,MAAM,CAACa,OAAO,CAAC;IAC7B,CAAE;IACFC,aAAa,EAAEX;EAAsB,GAEpCd,UAAU,CAACO,IAAI,CAACI,MAAM,CAACe,SAAS,CAACnB,IAAI,EAAEA,IAAI,CAACoB,UAAU,CAAC,CAAC,CACvD,CAAC,EAhBuB,CAACjB,cAAc,IAAIG,iBAAiB,IAC/D,CAAC,CAACG,eAAe,IACjB,CAAC,CAACR,qBAAqB,iBAiBpBP,KAAA,CAAAgB,aAAA,CAACd,eAAe;IACdI,IAAI,EAAEA,IAAK;IACXqB,QAAQ,EAAEZ,eAAgB;IAC1Ba,OAAO,EAAEd,sBAAuB;IAChCe,aAAa,EAAEtB;EAAsB,CACtC,CAEL,CAAC;AAEP","ignoreList":[]}
1
+ {"version":3,"file":"TableCell.js","names":["flexRender","React","useRef","CellContextMenu","useCellContextMenu","SELECTION_COLUMN_ID","styles","TableCell","cell","renderCellContextMenu","tdRef","isSelectColumn","column","id","isContextMenuOpen","handleOpenContextMenu","handleCloseContextMenu","popoverPosition","createElement","Fragment","ref","className","osdkTableCell","style","width","getSize","onContextMenu","osdkTableCellContent","columnDef","getContext","position","onClose","renderContent"],"sources":["TableCell.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Cell, RowData } from \"@tanstack/react-table\";\nimport { flexRender } from \"@tanstack/react-table\";\nimport type { ReactNode } from \"react\";\nimport React, { useRef } from \"react\";\nimport { CellContextMenu } from \"./CellContextMenu.js\";\nimport { useCellContextMenu } from \"./hooks/useCellContextMenu.js\";\nimport { SELECTION_COLUMN_ID } from \"./hooks/useSelectionColumn.js\";\nimport styles from \"./TableCell.module.css\";\n\ninterface TableCellProps<TData extends RowData> {\n cell: Cell<TData, unknown>;\n renderCellContextMenu?: (\n row: TData,\n cell: Cell<TData, unknown>,\n ) => React.ReactNode;\n}\n\nexport function TableCell<TData extends RowData>(\n { cell, renderCellContextMenu }: TableCellProps<TData>,\n): React.ReactElement {\n const tdRef = useRef<HTMLTableCellElement>(null);\n const isSelectColumn = cell.column.id === SELECTION_COLUMN_ID;\n\n const {\n isContextMenuOpen,\n handleOpenContextMenu,\n handleCloseContextMenu,\n popoverPosition,\n } = useCellContextMenu({\n tdRef,\n });\n\n const shouldRenderContextMenu = !isSelectColumn && isContextMenuOpen\n && !!popoverPosition\n && !!renderCellContextMenu;\n\n return (\n <>\n <td\n ref={tdRef}\n className={styles.osdkTableCell}\n style={{\n width: cell.column.getSize(),\n }}\n onContextMenu={handleOpenContextMenu}\n >\n <div className={styles.osdkTableCellContent}>\n {flexRender(cell.column.columnDef.cell, cell.getContext()) as\n | ReactNode\n | React.JSX.Element}\n </div>\n </td>\n {shouldRenderContextMenu\n && (\n <CellContextMenu\n cell={cell}\n position={popoverPosition}\n onClose={handleCloseContextMenu}\n renderContent={renderCellContextMenu}\n />\n )}\n </>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,UAAU,QAAQ,uBAAuB;AAElD,OAAOC,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,mBAAmB,QAAQ,+BAA+B;AACnE,OAAOC,MAAM,MAAM,wBAAwB;AAU3C,OAAO,SAASC,SAASA,CACvB;EAAEC,IAAI;EAAEC;AAA6C,CAAC,EAClC;EACpB,MAAMC,KAAK,GAAGR,MAAM,CAAuB,IAAI,CAAC;EAChD,MAAMS,cAAc,GAAGH,IAAI,CAACI,MAAM,CAACC,EAAE,KAAKR,mBAAmB;EAE7D,MAAM;IACJS,iBAAiB;IACjBC,qBAAqB;IACrBC,sBAAsB;IACtBC;EACF,CAAC,GAAGb,kBAAkB,CAAC;IACrBM;EACF,CAAC,CAAC;EAMF,oBACET,KAAA,CAAAiB,aAAA,CAAAjB,KAAA,CAAAkB,QAAA,qBACElB,KAAA,CAAAiB,aAAA;IACEE,GAAG,EAAEV,KAAM;IACXW,SAAS,EAAEf,MAAM,CAACgB,aAAc;IAChCC,KAAK,EAAE;MACLC,KAAK,EAAEhB,IAAI,CAACI,MAAM,CAACa,OAAO,CAAC;IAC7B,CAAE;IACFC,aAAa,EAAEX;EAAsB,gBAErCd,KAAA,CAAAiB,aAAA;IAAKG,SAAS,EAAEf,MAAM,CAACqB;EAAqB,GACzC3B,UAAU,CAACQ,IAAI,CAACI,MAAM,CAACgB,SAAS,CAACpB,IAAI,EAAEA,IAAI,CAACqB,UAAU,CAAC,CAAC,CAGtD,CACH,CAAC,EAnBuB,CAAClB,cAAc,IAAIG,iBAAiB,IAC/D,CAAC,CAACG,eAAe,IACjB,CAAC,CAACR,qBAAqB,iBAoBpBR,KAAA,CAAAiB,aAAA,CAACf,eAAe;IACdK,IAAI,EAAEA,IAAK;IACXsB,QAAQ,EAAEb,eAAgB;IAC1Bc,OAAO,EAAEf,sBAAuB;IAChCgB,aAAa,EAAEvB;EAAsB,CACtC,CAEL,CAAC;AAEP","ignoreList":[]}
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ .osdkTableCell {
18
+ display: flex;
19
+ align-items: center;
20
+ text-align: left;
21
+ position: relative;
22
+ padding: var(--osdk-table-cell-padding);
23
+ font-size: var(--osdk-table-cell-fontSize);
24
+ color: var(--osdk-table-cell-color);
25
+ background-color: inherit;
26
+ border-right: var(--osdk-table-cell-divider);
27
+
28
+ &:first-child {
29
+ border-left: var(--osdk-table-border);
30
+ }
31
+
32
+ &:last-child {
33
+ border-right: var(--osdk-table-border);
34
+ }
35
+ }
36
+
37
+ .osdkTableCell:has([role="checkbox"]) {
38
+ justify-content: center;
39
+ }
40
+
41
+ .osdkTableCellContent {
42
+ overflow: hidden;
43
+ text-overflow: ellipsis;
44
+ white-space: nowrap;
45
+ text-align: left;
46
+ }
@@ -16,48 +16,30 @@
16
16
 
17
17
  import { flexRender } from "@tanstack/react-table";
18
18
  import React from "react";
19
+ import styles from "./TableHeader.module.css";
19
20
  export function TableHeader({
20
21
  table
21
22
  }) {
23
+ // TODO: If value is number type, right align header
24
+
25
+ const isResizing = !!table.getState().columnSizingInfo?.isResizingColumn;
22
26
  return /*#__PURE__*/React.createElement("thead", {
23
- style: {
24
- display: "grid",
25
- position: "sticky",
26
- top: 0,
27
- zIndex: 1
28
- }
27
+ className: styles.osdkTableHeader,
28
+ "data-resizing": isResizing
29
29
  }, table.getHeaderGroups().map(headerGroup => /*#__PURE__*/React.createElement("tr", {
30
30
  key: headerGroup.id,
31
- style: {
32
- display: "flex"
33
- }
34
- }, headerGroup.headers.map(header =>
35
- /*#__PURE__*/
36
- // TODO: Move inline styling to CSS file
37
- React.createElement("th", {
31
+ className: styles.osdkTableHeaderRow
32
+ }, headerGroup.headers.map(header => /*#__PURE__*/React.createElement("th", {
38
33
  key: header.id,
34
+ className: styles.osdkTableHeaderCell,
39
35
  style: {
40
- display: "flex",
41
- width: header.getSize(),
42
- justifyContent: "flex-start",
43
- alignItems: "center",
44
- position: "relative"
36
+ width: header.getSize()
45
37
  }
46
38
  }, header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()), header.column.getCanResize() && /*#__PURE__*/React.createElement("div", {
39
+ className: styles.osdkTableHeaderResizer,
47
40
  onDoubleClick: () => header.column.resetSize(),
48
41
  onMouseDown: header.getResizeHandler(),
49
- onTouchStart: header.getResizeHandler(),
50
- style: {
51
- position: "absolute",
52
- right: 0,
53
- top: 0,
54
- height: "100%",
55
- width: "3px",
56
- cursor: "col-resize",
57
- touchAction: "none",
58
- zIndex: 11,
59
- transform: header.column.getIsResizing() ? `translateX(${table.getState().columnSizingInfo.deltaOffset ?? 0}px)` : ""
60
- }
42
+ onTouchStart: header.getResizeHandler()
61
43
  }))))));
62
44
  }
63
45
  //# sourceMappingURL=TableHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableHeader.js","names":["flexRender","React","TableHeader","table","createElement","style","display","position","top","zIndex","getHeaderGroups","map","headerGroup","key","id","headers","header","width","getSize","justifyContent","alignItems","isPlaceholder","column","columnDef","getContext","getCanResize","onDoubleClick","resetSize","onMouseDown","getResizeHandler","onTouchStart","right","height","cursor","touchAction","transform","getIsResizing","getState","columnSizingInfo","deltaOffset"],"sources":["TableHeader.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { RowData, Table } from \"@tanstack/react-table\";\nimport { flexRender } from \"@tanstack/react-table\";\nimport React from \"react\";\n\ninterface TableHeaderProps<TData extends RowData> {\n table: Table<TData>;\n}\n\nexport function TableHeader<TData extends RowData>({\n table,\n}: TableHeaderProps<TData>): React.ReactElement {\n return (\n <thead\n style={{\n display: \"grid\",\n position: \"sticky\",\n top: 0,\n zIndex: 1,\n }}\n >\n {table.getHeaderGroups().map((headerGroup) => (\n <tr\n key={headerGroup.id}\n style={{\n display: \"flex\",\n }}\n >\n {headerGroup.headers.map((header) => (\n // TODO: Move inline styling to CSS file\n <th\n key={header.id}\n style={{\n display: \"flex\",\n width: header.getSize(),\n justifyContent: \"flex-start\",\n alignItems: \"center\",\n position: \"relative\",\n }}\n >\n {header.isPlaceholder\n ? null\n : flexRender(\n header.column.columnDef.header,\n header.getContext(),\n )}\n {header.column.getCanResize() && (\n <div\n onDoubleClick={() => header.column.resetSize()}\n onMouseDown={header.getResizeHandler()}\n onTouchStart={header.getResizeHandler()}\n style={{\n position: \"absolute\",\n right: 0,\n top: 0,\n height: \"100%\",\n width: \"3px\",\n cursor: \"col-resize\",\n touchAction: \"none\",\n zIndex: 11,\n transform: header.column.getIsResizing()\n ? `translateX(${\n table.getState().columnSizingInfo.deltaOffset ?? 0\n }px)`\n : \"\",\n }}\n />\n )}\n </th>\n ))}\n </tr>\n ))}\n </thead>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,UAAU,QAAQ,uBAAuB;AAClD,OAAOC,KAAK,MAAM,OAAO;AAMzB,OAAO,SAASC,WAAWA,CAAwB;EACjDC;AACuB,CAAC,EAAsB;EAC9C,oBACEF,KAAA,CAAAG,aAAA;IACEC,KAAK,EAAE;MACLC,OAAO,EAAE,MAAM;MACfC,QAAQ,EAAE,QAAQ;MAClBC,GAAG,EAAE,CAAC;MACNC,MAAM,EAAE;IACV;EAAE,GAEDN,KAAK,CAACO,eAAe,CAAC,CAAC,CAACC,GAAG,CAAEC,WAAW,iBACvCX,KAAA,CAAAG,aAAA;IACES,GAAG,EAAED,WAAW,CAACE,EAAG;IACpBT,KAAK,EAAE;MACLC,OAAO,EAAE;IACX;EAAE,GAEDM,WAAW,CAACG,OAAO,CAACJ,GAAG,CAAEK,MAAM;EAAA;EAC9B;EACAf,KAAA,CAAAG,aAAA;IACES,GAAG,EAAEG,MAAM,CAACF,EAAG;IACfT,KAAK,EAAE;MACLC,OAAO,EAAE,MAAM;MACfW,KAAK,EAAED,MAAM,CAACE,OAAO,CAAC,CAAC;MACvBC,cAAc,EAAE,YAAY;MAC5BC,UAAU,EAAE,QAAQ;MACpBb,QAAQ,EAAE;IACZ;EAAE,GAEDS,MAAM,CAACK,aAAa,GACjB,IAAI,GACJrB,UAAU,CACVgB,MAAM,CAACM,MAAM,CAACC,SAAS,CAACP,MAAM,EAC9BA,MAAM,CAACQ,UAAU,CAAC,CACpB,CAAC,EACFR,MAAM,CAACM,MAAM,CAACG,YAAY,CAAC,CAAC,iBAC3BxB,KAAA,CAAAG,aAAA;IACEsB,aAAa,EAAEA,CAAA,KAAMV,MAAM,CAACM,MAAM,CAACK,SAAS,CAAC,CAAE;IAC/CC,WAAW,EAAEZ,MAAM,CAACa,gBAAgB,CAAC,CAAE;IACvCC,YAAY,EAAEd,MAAM,CAACa,gBAAgB,CAAC,CAAE;IACxCxB,KAAK,EAAE;MACLE,QAAQ,EAAE,UAAU;MACpBwB,KAAK,EAAE,CAAC;MACRvB,GAAG,EAAE,CAAC;MACNwB,MAAM,EAAE,MAAM;MACdf,KAAK,EAAE,KAAK;MACZgB,MAAM,EAAE,YAAY;MACpBC,WAAW,EAAE,MAAM;MACnBzB,MAAM,EAAE,EAAE;MACV0B,SAAS,EAAEnB,MAAM,CAACM,MAAM,CAACc,aAAa,CAAC,CAAC,GACpC,cACAjC,KAAK,CAACkC,QAAQ,CAAC,CAAC,CAACC,gBAAgB,CAACC,WAAW,IAAI,CAAC,KAC/C,GACH;IACN;EAAE,CACH,CAED,CACL,CACC,CACL,CACI,CAAC;AAEZ","ignoreList":[]}
1
+ {"version":3,"file":"TableHeader.js","names":["flexRender","React","styles","TableHeader","table","isResizing","getState","columnSizingInfo","isResizingColumn","createElement","className","osdkTableHeader","getHeaderGroups","map","headerGroup","key","id","osdkTableHeaderRow","headers","header","osdkTableHeaderCell","style","width","getSize","isPlaceholder","column","columnDef","getContext","getCanResize","osdkTableHeaderResizer","onDoubleClick","resetSize","onMouseDown","getResizeHandler","onTouchStart"],"sources":["TableHeader.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { RowData, Table } from \"@tanstack/react-table\";\nimport { flexRender } from \"@tanstack/react-table\";\nimport type { ReactNode } from \"react\";\nimport React from \"react\";\nimport styles from \"./TableHeader.module.css\";\n\ninterface TableHeaderProps<TData extends RowData> {\n table: Table<TData>;\n}\n\nexport function TableHeader<TData extends RowData>({\n table,\n}: TableHeaderProps<TData>): React.ReactElement {\n // TODO: If value is number type, right align header\n\n const isResizing = !!table.getState().columnSizingInfo?.isResizingColumn;\n\n return (\n <thead className={styles.osdkTableHeader} data-resizing={isResizing}>\n {table.getHeaderGroups().map((headerGroup) => (\n <tr\n key={headerGroup.id}\n className={styles.osdkTableHeaderRow}\n >\n {headerGroup.headers.map((header) => (\n <th\n key={header.id}\n className={styles.osdkTableHeaderCell}\n style={{\n width: header.getSize(),\n }}\n >\n {header.isPlaceholder\n ? null\n : flexRender(\n header.column.columnDef.header,\n header.getContext(),\n ) as ReactNode | React.JSX.Element}\n {header.column.getCanResize() && (\n <div\n className={styles.osdkTableHeaderResizer}\n onDoubleClick={() => header.column.resetSize()}\n onMouseDown={header.getResizeHandler()}\n onTouchStart={header.getResizeHandler()}\n />\n )}\n </th>\n ))}\n </tr>\n ))}\n </thead>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,UAAU,QAAQ,uBAAuB;AAElD,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,MAAM,MAAM,0BAA0B;AAM7C,OAAO,SAASC,WAAWA,CAAwB;EACjDC;AACuB,CAAC,EAAsB;EAC9C;;EAEA,MAAMC,UAAU,GAAG,CAAC,CAACD,KAAK,CAACE,QAAQ,CAAC,CAAC,CAACC,gBAAgB,EAAEC,gBAAgB;EAExE,oBACEP,KAAA,CAAAQ,aAAA;IAAOC,SAAS,EAAER,MAAM,CAACS,eAAgB;IAAC,iBAAeN;EAAW,GACjED,KAAK,CAACQ,eAAe,CAAC,CAAC,CAACC,GAAG,CAAEC,WAAW,iBACvCb,KAAA,CAAAQ,aAAA;IACEM,GAAG,EAAED,WAAW,CAACE,EAAG;IACpBN,SAAS,EAAER,MAAM,CAACe;EAAmB,GAEpCH,WAAW,CAACI,OAAO,CAACL,GAAG,CAAEM,MAAM,iBAC9BlB,KAAA,CAAAQ,aAAA;IACEM,GAAG,EAAEI,MAAM,CAACH,EAAG;IACfN,SAAS,EAAER,MAAM,CAACkB,mBAAoB;IACtCC,KAAK,EAAE;MACLC,KAAK,EAAEH,MAAM,CAACI,OAAO,CAAC;IACxB;EAAE,GAEDJ,MAAM,CAACK,aAAa,GACjB,IAAI,GACJxB,UAAU,CACVmB,MAAM,CAACM,MAAM,CAACC,SAAS,CAACP,MAAM,EAC9BA,MAAM,CAACQ,UAAU,CAAC,CACpB,CAAkC,EACnCR,MAAM,CAACM,MAAM,CAACG,YAAY,CAAC,CAAC,iBAC3B3B,KAAA,CAAAQ,aAAA;IACEC,SAAS,EAAER,MAAM,CAAC2B,sBAAuB;IACzCC,aAAa,EAAEA,CAAA,KAAMX,MAAM,CAACM,MAAM,CAACM,SAAS,CAAC,CAAE;IAC/CC,WAAW,EAAEb,MAAM,CAACc,gBAAgB,CAAC,CAAE;IACvCC,YAAY,EAAEf,MAAM,CAACc,gBAAgB,CAAC;EAAE,CACzC,CAED,CACL,CACC,CACL,CACI,CAAC;AAEZ","ignoreList":[]}
@@ -0,0 +1,78 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ .osdkTableHeader {
18
+ display: grid;
19
+ position: sticky;
20
+ top: 0;
21
+ z-index: var(--bp-surface-zIndex-1);
22
+ background-color: var(--osdk-table-header-bg);
23
+ }
24
+
25
+ .osdkTableHeader[data-resizing="true"] {
26
+ cursor: col-resize;
27
+ user-select: none;
28
+ }
29
+
30
+ .osdkTableHeaderRow {
31
+ display: flex;
32
+ }
33
+
34
+ .osdkTableHeaderCell {
35
+ display: flex;
36
+ align-items: center;
37
+ text-align: left;
38
+ position: relative;
39
+ padding: var(--osdk-table-cell-padding);
40
+ font-weight: var(--osdk-table-header-fontWeight);
41
+ font-size: var(--osdk-table-header-fontSize);
42
+ color: var(--osdk-table-header-color);
43
+ border-top: var(--osdk-table-border);
44
+ border-right: var(--osdk-table-header-divider);
45
+ background-color: inherit;
46
+
47
+ &:first-child {
48
+ border-left: var(--osdk-table-border);
49
+ }
50
+
51
+ &:last-child {
52
+ border-right: var(--osdk-table-border);
53
+ }
54
+ }
55
+
56
+ .osdkTableHeaderCell:has([role="checkbox"]) {
57
+ justify-content: center;
58
+ }
59
+
60
+ .osdkTableHeaderResizer {
61
+ background: none;
62
+ cursor: col-resize;
63
+ height: 100%;
64
+ position: absolute;
65
+ right: calc(-1 * var(--osdk-table-border-width));
66
+ top: 0;
67
+ touch-action: none;
68
+ width: 3px;
69
+ z-index: var(--bp-surface-zIndex-2);
70
+
71
+ &:hover {
72
+ background: var(--bp-intent-primary-hover);
73
+ }
74
+
75
+ &:active {
76
+ background: var(--bp-intent-primary-active);
77
+ }
78
+ }
@@ -16,6 +16,7 @@
16
16
 
17
17
  import React, { useCallback } from "react";
18
18
  import { TableCell } from "./TableCell.js";
19
+ import styles from "./TableRow.module.css";
19
20
  export function TableRow({
20
21
  row,
21
22
  virtualRow,
@@ -26,11 +27,11 @@ export function TableRow({
26
27
  onRowClick?.(row.original);
27
28
  }, [onRowClick, row.original]);
28
29
  return /*#__PURE__*/React.createElement("tr", {
30
+ "data-selected": row.getIsSelected(),
31
+ className: styles.osdkTableRow,
29
32
  style: {
30
- position: "absolute",
31
33
  height: `${virtualRow.size}px`,
32
- transform: `translateY(${virtualRow.start}px)`,
33
- display: "flex"
34
+ transform: `translateY(${virtualRow.start}px)`
34
35
  },
35
36
  onClick: handleClick
36
37
  }, row.getVisibleCells().map(cell => /*#__PURE__*/React.createElement(TableCell, {
@@ -1 +1 @@
1
- {"version":3,"file":"TableRow.js","names":["React","useCallback","TableCell","TableRow","row","virtualRow","onRowClick","renderCellContextMenu","handleClick","original","createElement","style","position","height","size","transform","start","display","onClick","getVisibleCells","map","cell","key","id"],"sources":["TableRow.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Cell, Row, RowData } from \"@tanstack/react-table\";\nimport type { VirtualItem } from \"@tanstack/react-virtual\";\nimport React, { useCallback } from \"react\";\nimport { TableCell } from \"./TableCell.js\";\n\ninterface TableRowProps<TData extends RowData> {\n row: Row<TData>;\n virtualRow: VirtualItem;\n onRowClick?: (row: TData) => void;\n renderCellContextMenu?: (\n row: TData,\n cell: Cell<TData, unknown>,\n ) => React.ReactNode;\n}\n\nexport function TableRow<TData extends RowData>({\n row,\n virtualRow,\n onRowClick,\n renderCellContextMenu,\n}: TableRowProps<TData>): React.ReactElement {\n const handleClick = useCallback(() => {\n onRowClick?.(row.original);\n }, [onRowClick, row.original]);\n\n return (\n <tr\n style={{\n position: \"absolute\",\n height: `${virtualRow.size}px`,\n transform: `translateY(${virtualRow.start}px)`,\n display: \"flex\",\n }}\n onClick={handleClick}\n >\n {row.getVisibleCells().map((cell) => (\n <TableCell\n key={cell.id}\n cell={cell}\n renderCellContextMenu={renderCellContextMenu}\n />\n ))}\n </tr>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,SAASC,SAAS,QAAQ,gBAAgB;AAY1C,OAAO,SAASC,QAAQA,CAAwB;EAC9CC,GAAG;EACHC,UAAU;EACVC,UAAU;EACVC;AACoB,CAAC,EAAsB;EAC3C,MAAMC,WAAW,GAAGP,WAAW,CAAC,MAAM;IACpCK,UAAU,GAAGF,GAAG,CAACK,QAAQ,CAAC;EAC5B,CAAC,EAAE,CAACH,UAAU,EAAEF,GAAG,CAACK,QAAQ,CAAC,CAAC;EAE9B,oBACET,KAAA,CAAAU,aAAA;IACEC,KAAK,EAAE;MACLC,QAAQ,EAAE,UAAU;MACpBC,MAAM,EAAE,GAAGR,UAAU,CAACS,IAAI,IAAI;MAC9BC,SAAS,EAAE,cAAcV,UAAU,CAACW,KAAK,KAAK;MAC9CC,OAAO,EAAE;IACX,CAAE;IACFC,OAAO,EAAEV;EAAY,GAEpBJ,GAAG,CAACe,eAAe,CAAC,CAAC,CAACC,GAAG,CAAEC,IAAI,iBAC9BrB,KAAA,CAAAU,aAAA,CAACR,SAAS;IACRoB,GAAG,EAAED,IAAI,CAACE,EAAG;IACbF,IAAI,EAAEA,IAAK;IACXd,qBAAqB,EAAEA;EAAsB,CAC9C,CACF,CACC,CAAC;AAET","ignoreList":[]}
1
+ {"version":3,"file":"TableRow.js","names":["React","useCallback","TableCell","styles","TableRow","row","virtualRow","onRowClick","renderCellContextMenu","handleClick","original","createElement","getIsSelected","className","osdkTableRow","style","height","size","transform","start","onClick","getVisibleCells","map","cell","key","id"],"sources":["TableRow.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Cell, Row, RowData } from \"@tanstack/react-table\";\nimport type { VirtualItem } from \"@tanstack/react-virtual\";\nimport React, { useCallback } from \"react\";\nimport { TableCell } from \"./TableCell.js\";\nimport styles from \"./TableRow.module.css\";\n\ninterface TableRowProps<TData extends RowData> {\n row: Row<TData>;\n virtualRow: VirtualItem;\n onRowClick?: (row: TData) => void;\n renderCellContextMenu?: (\n row: TData,\n cell: Cell<TData, unknown>,\n ) => React.ReactNode;\n}\n\nexport function TableRow<TData extends RowData>({\n row,\n virtualRow,\n onRowClick,\n renderCellContextMenu,\n}: TableRowProps<TData>): React.ReactElement {\n const handleClick = useCallback(() => {\n onRowClick?.(row.original);\n }, [onRowClick, row.original]);\n\n return (\n <tr\n data-selected={row.getIsSelected()}\n className={styles.osdkTableRow}\n style={{\n height: `${virtualRow.size}px`,\n transform: `translateY(${virtualRow.start}px)`,\n }}\n onClick={handleClick}\n >\n {row.getVisibleCells().map((cell) => (\n <TableCell\n key={cell.id}\n cell={cell}\n renderCellContextMenu={renderCellContextMenu}\n />\n ))}\n </tr>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,OAAOC,MAAM,MAAM,uBAAuB;AAY1C,OAAO,SAASC,QAAQA,CAAwB;EAC9CC,GAAG;EACHC,UAAU;EACVC,UAAU;EACVC;AACoB,CAAC,EAAsB;EAC3C,MAAMC,WAAW,GAAGR,WAAW,CAAC,MAAM;IACpCM,UAAU,GAAGF,GAAG,CAACK,QAAQ,CAAC;EAC5B,CAAC,EAAE,CAACH,UAAU,EAAEF,GAAG,CAACK,QAAQ,CAAC,CAAC;EAE9B,oBACEV,KAAA,CAAAW,aAAA;IACE,iBAAeN,GAAG,CAACO,aAAa,CAAC,CAAE;IACnCC,SAAS,EAAEV,MAAM,CAACW,YAAa;IAC/BC,KAAK,EAAE;MACLC,MAAM,EAAE,GAAGV,UAAU,CAACW,IAAI,IAAI;MAC9BC,SAAS,EAAE,cAAcZ,UAAU,CAACa,KAAK;IAC3C,CAAE;IACFC,OAAO,EAAEX;EAAY,GAEpBJ,GAAG,CAACgB,eAAe,CAAC,CAAC,CAACC,GAAG,CAAEC,IAAI,iBAC9BvB,KAAA,CAAAW,aAAA,CAACT,SAAS;IACRsB,GAAG,EAAED,IAAI,CAACE,EAAG;IACbF,IAAI,EAAEA,IAAK;IACXf,qBAAqB,EAAEA;EAAsB,CAC9C,CACF,CACC,CAAC;AAET","ignoreList":[]}
@@ -0,0 +1,60 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ .osdkTableRow {
18
+ position: absolute;
19
+ display: flex;
20
+ background-color: var(--osdk-table-row-bg-default);
21
+ border-top: var(--osdk-table-row-divider);
22
+ border-bottom: var(--osdk-table-border-width) solid transparent;
23
+
24
+ &:last-child {
25
+ border-bottom: var(--osdk-table-border);
26
+ }
27
+
28
+ /* Zebra rows */
29
+ &:nth-child(even) {
30
+ background-color: var(
31
+ --osdk-table-row-bg-alternate,
32
+ var(--osdk-table-row-bg-default)
33
+ );
34
+ }
35
+
36
+ &:hover {
37
+ z-index: 1;
38
+ background-color: var(
39
+ --osdk-table-row-bg-hover,
40
+ var(--bp-surface-colorHover-default)
41
+ );
42
+ border-top-color: var(--osdk-table-row-border-color-hover);
43
+ border-bottom-color: var(--osdk-table-row-border-color-hover);
44
+ }
45
+
46
+ &[data-selected="true"] {
47
+ z-index: 2;
48
+ background-color: var(--osdk-table-row-bg-active);
49
+ border-top-color: var(--osdk-table-row-border-color-active);
50
+ border-bottom-color: var(--osdk-table-row-border-color-active);
51
+ }
52
+
53
+ &[data-selected="true"] + &[data-selected="true"] {
54
+ border-top-color: transparent;
55
+ }
56
+
57
+ &[data-selected="true"]:has(+ &[data-selected="true"]) {
58
+ border-bottom-color: transparent;
59
+ }
60
+ }