@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @osdk/react-components
2
2
 
3
+ ## 0.1.0-beta.4
4
+
5
+ ### Minor Changes
6
+
7
+ - 476604f: Apply table styling
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [fb83808]
12
+ - @osdk/client@2.7.0-beta.13
13
+ - @osdk/api@2.7.0-beta.13
14
+ - @osdk/react@0.9.0-beta.8
15
+
16
+ ## 0.1.0-beta.3
17
+
18
+ ### Minor Changes
19
+
20
+ - 9cd0b26: Add base UI component and css module
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies [acf6331]
25
+ - Updated dependencies [6cfe14a]
26
+ - Updated dependencies [ec6ad57]
27
+ - Updated dependencies [38d5958]
28
+ - Updated dependencies [56ba08f]
29
+ - Updated dependencies [d5cfc38]
30
+ - @osdk/react@0.9.0-beta.7
31
+ - @osdk/client@2.7.0-beta.11
32
+ - @osdk/api@2.7.0-beta.11
33
+
3
34
  ## 0.1.0-beta.2
4
35
 
5
36
  ### Minor Changes
package/README.md CHANGED
@@ -6,8 +6,14 @@ Built on top of [@osdk/react](../react), these components use OSDK hooks interna
6
6
 
7
7
  ## Installation
8
8
 
9
+ Run the command to install:
10
+
11
+ - @osdk/react-components - The unstyled components from this package
12
+ - @osdk/react - The react toolkit for data-handling
13
+ - @osdk/react-components-styles - The default styles for the components
14
+
9
15
  ```sh
10
- npm install @osdk/react-components @osdk/react
16
+ npm install @osdk/react-components @osdk/react @osdk/react-components-styles
11
17
  ```
12
18
 
13
19
  **Prerequisites:**
@@ -16,6 +22,17 @@ npm install @osdk/react-components @osdk/react
16
22
  - A configured OSDK client
17
23
  - An OsdkProvider wrapping your application
18
24
 
25
+ ## Setup
26
+
27
+ Add this to your application layout root as we are using Base UI portals. See https://base-ui.com/react/overview/quick-start#portals
28
+
29
+ ```css
30
+ /* index.css */
31
+ .root {
32
+ isolation: isolate;
33
+ }
34
+ ```
35
+
19
36
  ## Components
20
37
 
21
38
  > **Note:** This package is under active development. Not all components listed below are available yet.
@@ -28,6 +45,10 @@ The components that this package will provide are:
28
45
  | `FilterList` | Visualize a high-level summary of objects data to allow users to filter that data. |
29
46
  | `ActionForm` | Auto-generated form for executing Ontology Actions |
30
47
 
48
+ ## Custom Styling
49
+
50
+ See `@osdk/react-components-styles` README on how to apply custom themes and styling to the components.
51
+
31
52
  ## Example Usage
32
53
 
33
54
  ### Object Table
@@ -48,6 +69,35 @@ function EmployeeDirectory() {
48
69
  }
49
70
  ```
50
71
 
72
+ ### Running the Example People App
73
+
74
+ The examples are added to `packages/e2e.sandbox.peopleapp`, so we need to run the example app.
75
+
76
+ #### Steps:
77
+
78
+ 1. Create a .env.local file with the content below in packages/e2e.sandbox.peopleapp:
79
+
80
+ ```
81
+ VITE_FOUNDRY_URL=https://swirl.palantirfoundry.com
82
+ VITE_FOUNDRY_CLIENT_ID=<insert_client_id>
83
+ VITE_FOUNDRY_CLIENT_SECRET=<insert_token>
84
+ VITE_FOUNDRY_REDIRECT_URL=http://localhost:8080/auth/callback
85
+ ```
86
+
87
+ 2. Get VITE_FOUNDRY_CLIENT_ID from "https://swirl.palantirfoundry.com/workspace/developer-console/app/ri.third-party-applications.main.application.91b973ac-e504-4322-95b4-4962b60495fe/oauth" under App Credentials > Client ID.
88
+
89
+ 3. Transpile @osdk/react-components and its dependencies
90
+
91
+ ```
92
+ pnpm --filter @osdk/react-components transpileAllDeps && pnpm --filter @osdk/react-components transpileBrowser
93
+ ```
94
+
95
+ 4. Run the people app
96
+
97
+ ```
98
+ pnpm --filter @osdk/e2e.sandbox.peopleapp dev
99
+ ```
100
+
51
101
  ## Why this package?
52
102
 
53
103
  **OSDK-native.** These components understand Foundry concepts like Objects, Object Sets, and Actions. They are purpose-built for Ontology data.
@@ -0,0 +1,40 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ /*
3
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import { Checkbox as BaseUICheckbox } from "@base-ui/react/checkbox";
19
+ import { Minus, Tick } from "@blueprintjs/icons";
20
+ import classnames from "classnames";
21
+ import React from "react";
22
+ import styles from "./Checkbox.module.css";
23
+ export function Checkbox({
24
+ indeterminate,
25
+ className,
26
+ indicatorProps,
27
+ ...rest
28
+ }) {
29
+ return /*#__PURE__*/React.createElement(BaseUICheckbox.Root, _extends({
30
+ className: classnames(styles.osdkCheckboxRoot, className),
31
+ indeterminate: indeterminate
32
+ }, rest), /*#__PURE__*/React.createElement(BaseUICheckbox.Indicator, _extends({}, indicatorProps, {
33
+ className: classnames(styles.osdkCheckboxIndicator, indicatorProps?.className)
34
+ }), indeterminate ? /*#__PURE__*/React.createElement(Minus, {
35
+ color: "currentColor"
36
+ }) : /*#__PURE__*/React.createElement(Tick, {
37
+ color: "currentColor"
38
+ })));
39
+ }
40
+ //# sourceMappingURL=Checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkbox.js","names":["Checkbox","BaseUICheckbox","Minus","Tick","classnames","React","styles","indeterminate","className","indicatorProps","rest","createElement","Root","_extends","osdkCheckboxRoot","Indicator","osdkCheckboxIndicator","color"],"sources":["Checkbox.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 {\n Checkbox as BaseUICheckbox,\n type CheckboxIndicatorProps,\n type CheckboxRootProps,\n} from \"@base-ui/react/checkbox\";\nimport { Minus, Tick } from \"@blueprintjs/icons\";\nimport classnames from \"classnames\";\nimport React from \"react\";\nimport styles from \"./Checkbox.module.css\";\n\ninterface CheckboxProps extends Omit<CheckboxRootProps, \"className\"> {\n className?: string;\n indicatorProps?: Omit<CheckboxIndicatorProps, \"className\"> & {\n className?: string;\n };\n}\n\nexport function Checkbox(\n {\n indeterminate,\n className,\n indicatorProps,\n ...rest\n }: CheckboxProps,\n): React.ReactElement {\n return (\n <BaseUICheckbox.Root\n className={classnames(styles.osdkCheckboxRoot, className)}\n indeterminate={indeterminate}\n {...rest}\n >\n <BaseUICheckbox.Indicator\n {...indicatorProps}\n className={classnames(\n styles.osdkCheckboxIndicator,\n indicatorProps?.className,\n )}\n >\n {/* Color is used as the \"fill\" attribute on the svg */}\n {indeterminate\n ? (\n <Minus\n color={\"currentColor\"}\n />\n )\n : <Tick color={\"currentColor\"} />}\n </BaseUICheckbox.Indicator>\n </BaseUICheckbox.Root>\n );\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,QAAQ,IAAIC,cAAc,QAGrB,yBAAyB;AAChC,SAASC,KAAK,EAAEC,IAAI,QAAQ,oBAAoB;AAChD,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,MAAM,MAAM,uBAAuB;AAS1C,OAAO,SAASN,QAAQA,CACtB;EACEO,aAAa;EACbC,SAAS;EACTC,cAAc;EACd,GAAGC;AACU,CAAC,EACI;EACpB,oBACEL,KAAA,CAAAM,aAAA,CAACV,cAAc,CAACW,IAAI,EAAAC,QAAA;IAClBL,SAAS,EAAEJ,UAAU,CAACE,MAAM,CAACQ,gBAAgB,EAAEN,SAAS,CAAE;IAC1DD,aAAa,EAAEA;EAAc,GACzBG,IAAI,gBAERL,KAAA,CAAAM,aAAA,CAACV,cAAc,CAACc,SAAS,EAAAF,QAAA,KACnBJ,cAAc;IAClBD,SAAS,EAAEJ,UAAU,CACnBE,MAAM,CAACU,qBAAqB,EAC5BP,cAAc,EAAED,SAClB;EAAE,IAGDD,aAAa,gBAEVF,KAAA,CAAAM,aAAA,CAACT,KAAK;IACJe,KAAK,EAAE;EAAe,CACvB,CAAC,gBAEFZ,KAAA,CAAAM,aAAA,CAACR,IAAI;IAACc,KAAK,EAAE;EAAe,CAAE,CACV,CACP,CAAC;AAE1B","ignoreList":[]}
@@ -0,0 +1,73 @@
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
+ .osdkCheckboxRoot {
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ min-width: calc(
22
+ var(--osdk-checkbox-icon-size) + var(--osdk-checkbox-padding) * 2
23
+ );
24
+ min-height: calc(
25
+ var(--osdk-checkbox-icon-size) + var(--osdk-checkbox-padding) * 2
26
+ );
27
+ padding: var(--osdk-checkbox-padding);
28
+ box-sizing: border-box;
29
+ cursor: pointer;
30
+ border-radius: var(--bp-surface-borderRadius);
31
+ border: var(--osdk-checkbox-border);
32
+
33
+ &[data-unchecked] {
34
+ background-color: var(--osdk-checkbox-bg);
35
+
36
+ &:hover {
37
+ background-color: var(--osdk-checkbox-bg-hover);
38
+ }
39
+
40
+ &:active {
41
+ background-color: var(--osdk-checkbox-bg-active);
42
+ }
43
+ }
44
+
45
+ &[data-checked],
46
+ &[data-indeterminate] {
47
+ background-color: var(--osdk-checkbox-bg-checked);
48
+
49
+ &:hover {
50
+ background-color: var(--osdk-checkbox-bg-checked-hover);
51
+ }
52
+
53
+ &:active {
54
+ background-color: var(--osdk-checkbox-bg-checked-active);
55
+ }
56
+ }
57
+
58
+ &:focus-visible {
59
+ outline: var(--bp-emphasis-focusWidth) solid var(--bp-emphasis-focusColor);
60
+ outline-offset: var(--bp-emphasis-focusOffset);
61
+ }
62
+ }
63
+
64
+ .osdkCheckboxIndicator {
65
+ color: var(--osdk-checkbox-checked-foreground);
66
+ width: var(--osdk-checkbox-icon-size);
67
+ height: var(--osdk-checkbox-icon-size);
68
+
69
+
70
+ &[data-unchecked] {
71
+ display: none;
72
+ }
73
+ }
@@ -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
+ declare module "*.module.css" {
18
+ const classes: { readonly [key: string]: string };
19
+ export default classes;
20
+ }
@@ -16,6 +16,7 @@
16
16
 
17
17
  import React, { useEffect, useRef } from "react";
18
18
  import { createPortal } from "react-dom";
19
+ import styles from "./CellContextMenu.module.css";
19
20
  export function CellContextMenu({
20
21
  cell,
21
22
  position,
@@ -36,9 +37,8 @@ export function CellContextMenu({
36
37
  }, [onClose]);
37
38
  return /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement("div", {
38
39
  ref: ref,
40
+ className: styles.osdkCellContextMenu,
39
41
  style: {
40
- position: "fixed",
41
- zIndex: 9999,
42
42
  left: position.left,
43
43
  top: position.top,
44
44
  minWidth: position.width
@@ -1 +1 @@
1
- {"version":3,"file":"CellContextMenu.js","names":["React","useEffect","useRef","createPortal","CellContextMenu","cell","position","onClose","renderContent","ref","handleClickOutside","event","current","contains","target","document","addEventListener","removeEventListener","createElement","style","zIndex","left","top","minWidth","width","row","original","body"],"sources":["CellContextMenu.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 React, { useEffect, useRef } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport type { PopoverPosition } from \"./hooks/useCellContextMenu.js\";\n\ninterface CellContextMenuProps<TData extends RowData> {\n cell: Cell<TData, unknown>;\n position: PopoverPosition;\n onClose: () => void;\n renderContent: (row: TData, cell: Cell<TData, unknown>) => React.ReactNode;\n}\n\nexport function CellContextMenu<TData extends RowData>({\n cell,\n position,\n onClose,\n renderContent,\n}: CellContextMenuProps<TData>): React.ReactElement {\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (ref.current && !ref.current.contains(event.target as Node)) {\n onClose();\n }\n };\n\n document.addEventListener(\"mousedown\", handleClickOutside);\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [onClose]);\n\n return createPortal(\n <div\n ref={ref}\n style={{\n position: \"fixed\",\n zIndex: 9999,\n left: position.left,\n top: position.top,\n minWidth: position.width,\n }}\n >\n {renderContent(cell.row.original, cell)}\n </div>,\n document.body,\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SAASC,YAAY,QAAQ,WAAW;AAUxC,OAAO,SAASC,eAAeA,CAAwB;EACrDC,IAAI;EACJC,QAAQ;EACRC,OAAO;EACPC;AAC2B,CAAC,EAAsB;EAClD,MAAMC,GAAG,GAAGP,MAAM,CAAiB,IAAI,CAAC;EAExCD,SAAS,CAAC,MAAM;IACd,MAAMS,kBAAkB,GAAIC,KAAiB,IAAK;MAChD,IAAIF,GAAG,CAACG,OAAO,IAAI,CAACH,GAAG,CAACG,OAAO,CAACC,QAAQ,CAACF,KAAK,CAACG,MAAc,CAAC,EAAE;QAC9DP,OAAO,CAAC,CAAC;MACX;IACF,CAAC;IAEDQ,QAAQ,CAACC,gBAAgB,CAAC,WAAW,EAAEN,kBAAkB,CAAC;IAE1D,OAAO,MAAM;MACXK,QAAQ,CAACE,mBAAmB,CAAC,WAAW,EAAEP,kBAAkB,CAAC;IAC/D,CAAC;EACH,CAAC,EAAE,CAACH,OAAO,CAAC,CAAC;EAEb,oBAAOJ,YAAY,cACjBH,KAAA,CAAAkB,aAAA;IACET,GAAG,EAAEA,GAAI;IACTU,KAAK,EAAE;MACLb,QAAQ,EAAE,OAAO;MACjBc,MAAM,EAAE,IAAI;MACZC,IAAI,EAAEf,QAAQ,CAACe,IAAI;MACnBC,GAAG,EAAEhB,QAAQ,CAACgB,GAAG;MACjBC,QAAQ,EAAEjB,QAAQ,CAACkB;IACrB;EAAE,GAEDhB,aAAa,CAACH,IAAI,CAACoB,GAAG,CAACC,QAAQ,EAAErB,IAAI,CACnC,CAAC,EACNU,QAAQ,CAACY,IACX,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"CellContextMenu.js","names":["React","useEffect","useRef","createPortal","styles","CellContextMenu","cell","position","onClose","renderContent","ref","handleClickOutside","event","current","contains","target","document","addEventListener","removeEventListener","createElement","className","osdkCellContextMenu","style","left","top","minWidth","width","row","original","body"],"sources":["CellContextMenu.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 React, { useEffect, useRef } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport styles from \"./CellContextMenu.module.css\";\nimport type { PopoverPosition } from \"./hooks/useCellContextMenu.js\";\n\ninterface CellContextMenuProps<TData extends RowData> {\n cell: Cell<TData, unknown>;\n position: PopoverPosition;\n onClose: () => void;\n renderContent: (row: TData, cell: Cell<TData, unknown>) => React.ReactNode;\n}\n\nexport function CellContextMenu<TData extends RowData>({\n cell,\n position,\n onClose,\n renderContent,\n}: CellContextMenuProps<TData>): React.ReactElement {\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (ref.current && !ref.current.contains(event.target as Node)) {\n onClose();\n }\n };\n\n document.addEventListener(\"mousedown\", handleClickOutside);\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [onClose]);\n\n return createPortal(\n <div\n ref={ref}\n className={styles.osdkCellContextMenu}\n style={{\n left: position.left,\n top: position.top,\n minWidth: position.width,\n }}\n >\n {renderContent(cell.row.original, cell)}\n </div>,\n document.body,\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SAASC,YAAY,QAAQ,WAAW;AACxC,OAAOC,MAAM,MAAM,8BAA8B;AAUjD,OAAO,SAASC,eAAeA,CAAwB;EACrDC,IAAI;EACJC,QAAQ;EACRC,OAAO;EACPC;AAC2B,CAAC,EAAsB;EAClD,MAAMC,GAAG,GAAGR,MAAM,CAAiB,IAAI,CAAC;EAExCD,SAAS,CAAC,MAAM;IACd,MAAMU,kBAAkB,GAAIC,KAAiB,IAAK;MAChD,IAAIF,GAAG,CAACG,OAAO,IAAI,CAACH,GAAG,CAACG,OAAO,CAACC,QAAQ,CAACF,KAAK,CAACG,MAAc,CAAC,EAAE;QAC9DP,OAAO,CAAC,CAAC;MACX;IACF,CAAC;IAEDQ,QAAQ,CAACC,gBAAgB,CAAC,WAAW,EAAEN,kBAAkB,CAAC;IAE1D,OAAO,MAAM;MACXK,QAAQ,CAACE,mBAAmB,CAAC,WAAW,EAAEP,kBAAkB,CAAC;IAC/D,CAAC;EACH,CAAC,EAAE,CAACH,OAAO,CAAC,CAAC;EAEb,oBAAOL,YAAY,cACjBH,KAAA,CAAAmB,aAAA;IACET,GAAG,EAAEA,GAAI;IACTU,SAAS,EAAEhB,MAAM,CAACiB,mBAAoB;IACtCC,KAAK,EAAE;MACLC,IAAI,EAAEhB,QAAQ,CAACgB,IAAI;MACnBC,GAAG,EAAEjB,QAAQ,CAACiB,GAAG;MACjBC,QAAQ,EAAElB,QAAQ,CAACmB;IACrB;EAAE,GAEDjB,aAAa,CAACH,IAAI,CAACqB,GAAG,CAACC,QAAQ,EAAEtB,IAAI,CACnC,CAAC,EACNU,QAAQ,CAACa,IACX,CAAC;AACH","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
+ .osdkCellContextMenu {
18
+ position: fixed;
19
+ z-index: var(--bp-surface-zIndex-2);
20
+ }
@@ -108,7 +108,8 @@ export function ObjectTable({
108
108
  fetchNextPage: fetchMore,
109
109
  onRowClick: props.onRowClick,
110
110
  rowHeight: props.rowHeight,
111
- renderCellContextMenu: onRenderCellContextMenu
111
+ renderCellContextMenu: onRenderCellContextMenu,
112
+ className: props.className
112
113
  });
113
114
  }
114
115
  //# sourceMappingURL=ObjectTable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectTable.js","names":["getCoreRowModel","useReactTable","React","useCallback","useMemo","useState","useColumnDefs","useDefaultTableStates","useObjectTableData","useRowSelection","useSelectionColumn","Table","getRowId","ObjectTable","objectSet","objectType","columnDefinitions","filter","onRowSelection","renderCellContextMenu","selectionMode","selectedRows","props","data","fetchMore","isLoading","columns","loading","isColumnsLoading","columnVisibility","columnSizing","setColumnSizing","rowSelection","isAllSelected","hasSelection","onToggleAll","onToggleRow","selectionColumn","allColumns","table","state","onColumnSizingChange","enableRowSelection","columnResizeMode","columnResizeDirection","defaultColumn","minSize","onRenderCellContextMenu","row","cell","getValue","createElement","fetchNextPage","onRowClick","rowHeight"],"sources":["ObjectTable.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 {\n ObjectTypeDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport {\n type Cell,\n type ColumnSizingState,\n getCoreRowModel,\n useReactTable,\n} from \"@tanstack/react-table\";\nimport React, { useCallback, useMemo, useState } from \"react\";\nimport { useColumnDefs } from \"./hooks/useColumnDefs.js\";\nimport { useDefaultTableStates } from \"./hooks/useDefaultTableStates.js\";\nimport { useObjectTableData } from \"./hooks/useObjectTableData.js\";\nimport { useRowSelection } from \"./hooks/useRowSelection.js\";\nimport { useSelectionColumn } from \"./hooks/useSelectionColumn.js\";\nimport type { ObjectTableProps } from \"./ObjectTableApi.js\";\nimport { Table } from \"./Table.js\";\nimport { getRowId } from \"./utils/getRowId.js\";\n\n/**\n * ObjectTable - A headless table component for displaying OSDK object sets\n *\n * @example\n * ```tsx\n * <ObjectTable objectSet={myObjectSet} objectType={MyObjectType} />\n * ```\n */\n\nexport function ObjectTable<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>({\n objectSet,\n objectType,\n columnDefinitions,\n filter,\n onRowSelection,\n renderCellContextMenu,\n selectionMode = \"none\",\n selectedRows,\n ...props\n}: ObjectTableProps<Q, RDPs, FunctionColumns>): React.ReactElement {\n const { data, fetchMore, isLoading } = useObjectTableData<\n Q,\n RDPs,\n FunctionColumns\n >(\n objectSet,\n columnDefinitions,\n filter,\n );\n\n const { columns, loading: isColumnsLoading } = useColumnDefs<\n Q,\n RDPs,\n FunctionColumns\n >(\n objectType,\n columnDefinitions,\n );\n\n const { columnVisibility } = useDefaultTableStates({ columnDefinitions });\n\n const [columnSizing, setColumnSizing] = useState<ColumnSizingState>({});\n\n const {\n rowSelection,\n isAllSelected,\n hasSelection,\n onToggleAll,\n onToggleRow,\n } = useRowSelection<Q, RDPs>({\n selectionMode,\n selectedRows,\n onRowSelection,\n data,\n });\n\n const selectionColumn = useSelectionColumn<Q, RDPs>(\n { selectionMode, isAllSelected, hasSelection, onToggleAll, onToggleRow },\n );\n\n const allColumns = useMemo(() => {\n return selectionColumn ? [selectionColumn, ...columns] : columns;\n }, [selectionColumn, columns]);\n\n const table = useReactTable<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>\n >({\n data: data ?? [],\n columns: allColumns,\n getCoreRowModel: getCoreRowModel(),\n state: {\n columnVisibility,\n rowSelection,\n columnSizing,\n },\n onColumnSizingChange: setColumnSizing,\n enableRowSelection: selectionMode !== \"none\",\n columnResizeMode: \"onChange\",\n columnResizeDirection: \"ltr\",\n defaultColumn: {\n minSize: 80,\n },\n getRowId,\n });\n\n const onRenderCellContextMenu = useCallback(\n (\n row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n cell: Cell<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >,\n ) => {\n return renderCellContextMenu?.(row, cell.getValue());\n },\n [renderCellContextMenu],\n );\n\n const isTableLoading = isLoading || isColumnsLoading;\n\n return (\n <Table\n table={table}\n isLoading={isTableLoading}\n fetchNextPage={fetchMore}\n onRowClick={props.onRowClick}\n rowHeight={props.rowHeight}\n renderCellContextMenu={onRenderCellContextMenu}\n />\n );\n}\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"ObjectTable.js","names":["getCoreRowModel","useReactTable","React","useCallback","useMemo","useState","useColumnDefs","useDefaultTableStates","useObjectTableData","useRowSelection","useSelectionColumn","Table","getRowId","ObjectTable","objectSet","objectType","columnDefinitions","filter","onRowSelection","renderCellContextMenu","selectionMode","selectedRows","props","data","fetchMore","isLoading","columns","loading","isColumnsLoading","columnVisibility","columnSizing","setColumnSizing","rowSelection","isAllSelected","hasSelection","onToggleAll","onToggleRow","selectionColumn","allColumns","table","state","onColumnSizingChange","enableRowSelection","columnResizeMode","columnResizeDirection","defaultColumn","minSize","onRenderCellContextMenu","row","cell","getValue","createElement","fetchNextPage","onRowClick","rowHeight","className"],"sources":["ObjectTable.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 {\n ObjectTypeDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport {\n type Cell,\n type ColumnSizingState,\n getCoreRowModel,\n useReactTable,\n} from \"@tanstack/react-table\";\nimport React, { useCallback, useMemo, useState } from \"react\";\nimport { useColumnDefs } from \"./hooks/useColumnDefs.js\";\nimport { useDefaultTableStates } from \"./hooks/useDefaultTableStates.js\";\nimport { useObjectTableData } from \"./hooks/useObjectTableData.js\";\nimport { useRowSelection } from \"./hooks/useRowSelection.js\";\nimport { useSelectionColumn } from \"./hooks/useSelectionColumn.js\";\nimport type { ObjectTableProps } from \"./ObjectTableApi.js\";\nimport { Table } from \"./Table.js\";\nimport { getRowId } from \"./utils/getRowId.js\";\n\n/**\n * ObjectTable - A headless table component for displaying OSDK object sets\n *\n * @example\n * ```tsx\n * <ObjectTable objectSet={myObjectSet} objectType={MyObjectType} />\n * ```\n */\n\nexport function ObjectTable<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>({\n objectSet,\n objectType,\n columnDefinitions,\n filter,\n onRowSelection,\n renderCellContextMenu,\n selectionMode = \"none\",\n selectedRows,\n ...props\n}: ObjectTableProps<Q, RDPs, FunctionColumns>): React.ReactElement {\n const { data, fetchMore, isLoading } = useObjectTableData<\n Q,\n RDPs,\n FunctionColumns\n >(\n objectSet,\n columnDefinitions,\n filter,\n );\n\n const { columns, loading: isColumnsLoading } = useColumnDefs<\n Q,\n RDPs,\n FunctionColumns\n >(\n objectType,\n columnDefinitions,\n );\n\n const { columnVisibility } = useDefaultTableStates({ columnDefinitions });\n\n const [columnSizing, setColumnSizing] = useState<ColumnSizingState>({});\n\n const {\n rowSelection,\n isAllSelected,\n hasSelection,\n onToggleAll,\n onToggleRow,\n } = useRowSelection<Q, RDPs>({\n selectionMode,\n selectedRows,\n onRowSelection,\n data,\n });\n\n const selectionColumn = useSelectionColumn<Q, RDPs>(\n { selectionMode, isAllSelected, hasSelection, onToggleAll, onToggleRow },\n );\n\n const allColumns = useMemo(() => {\n return selectionColumn ? [selectionColumn, ...columns] : columns;\n }, [selectionColumn, columns]);\n\n const table = useReactTable<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>\n >({\n data: data ?? [],\n columns: allColumns,\n getCoreRowModel: getCoreRowModel(),\n state: {\n columnVisibility,\n rowSelection,\n columnSizing,\n },\n onColumnSizingChange: setColumnSizing,\n enableRowSelection: selectionMode !== \"none\",\n columnResizeMode: \"onChange\",\n columnResizeDirection: \"ltr\",\n defaultColumn: {\n minSize: 80,\n },\n getRowId,\n });\n\n const onRenderCellContextMenu = useCallback(\n (\n row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n cell: Cell<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >,\n ) => {\n return renderCellContextMenu?.(row, cell.getValue());\n },\n [renderCellContextMenu],\n );\n\n const isTableLoading = isLoading || isColumnsLoading;\n\n return (\n <Table\n table={table}\n isLoading={isTableLoading}\n fetchNextPage={fetchMore}\n onRowClick={props.onRowClick}\n rowHeight={props.rowHeight}\n renderCellContextMenu={onRenderCellContextMenu}\n className={props.className}\n />\n );\n}\n"],"mappings":"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","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectTableApi.js","names":[],"sources":["ObjectTableApi.ts"],"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 {\n DerivedProperty,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport type * as React from \"react\";\n\nexport type ColumnDefinition<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> = {\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>;\n\n /**\n * @default true\n */\n isVisible?: boolean;\n\n /**\n * @default none\n */\n pinned?: \"left\" | \"right\" | \"none\";\n width?: number;\n minWidth?: number;\n maxWidth?: number;\n resizable?: boolean;\n orderable?: boolean;\n filterable?: boolean;\n renderCell?: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>,\n ) => React.ReactNode;\n renderHeader?: () => React.ReactNode;\n};\n\nexport type ColumnDefinitionLocator<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> =\n | {\n type: \"property\";\n id: PropertyKeys<Q>;\n }\n | {\n type: \"function\";\n id: keyof FunctionColumns;\n }\n | {\n type: \"rdp\";\n id: keyof RDPs;\n creator: DerivedProperty.Creator<Q, RDPs[keyof RDPs]>;\n };\n\nexport interface ObjectTableProps<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n /**\n * The set of objects to show in the table\n */\n objectSet: ObjectSet<Q>;\n\n /**\n * The object type of the object\n */\n objectType: Q;\n\n /**\n * Ordered list of column definitions to show in the table\n *\n * If not provided, all of the properties of the object type will be shown in default order.\n */\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>;\n\n /**\n * Whether the table is filterable by the user.\n *\n * @default true\n */\n filterable?: boolean;\n\n /**\n * The current where clause to filter the objects in the table.\n * If provided, the filter is controlled.\n */\n filter?: WhereClause<Q, RDPs>;\n\n /**\n * Called when the where clause is changed.\n * Required when filter is controlled.\n *\n * @param newWhere The new where clause\n */\n onFilterChanged?: (newWhere: WhereClause<Q, RDPs>) => void;\n\n /**\n * Whether the table is sortable by the user.\n *\n * @default true\n */\n orderable?: boolean;\n\n /**\n * The current order by clause to sort the objects in the table.\n * If provided, the sorting is controlled.\n */\n orderBy?: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>;\n\n /**\n * Called when the order by clause is changed.\n * Required when sorting is controlled.\n *\n * @param newOrderBy The new order by clause\n */\n onOrderByChanged?: (\n newOrderBy: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>,\n ) => void;\n\n /**\n * Called when the visible columns change.\n *\n * If provided, the table will allow the user to show/hide columns.\n *\n * @param newStates The new list of column visibility states\n */\n onColumnVisibilityChanged?: (\n newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n isVisible: boolean;\n }>,\n ) => void;\n\n /**\n * Called when the pinned columns change.\n *\n * If provided, the table will allow the user to pin/unpin columns.\n *\n * @param newStates The new list of column pin states\n */\n onColumnsPinnedChanged?: (\n newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n pinned: \"left\" | \"right\" | \"none\";\n }>,\n ) => void;\n\n /**\n * Called when a column is resized.\n *\n * @param columnId The ID of the resized column\n * @param newWidth The new width of the column\n */\n onColumnResize?: (\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns,\n newWidth: number,\n ) => void;\n\n /**\n * Called when a row is clicked.\n *\n * @param object The object representing the clicked row\n */\n onRowClick?: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => void;\n\n /**\n * Selection mode for the table rows.\n *\n * If multiple, a checkbox will be shown for each row to allow selecting multiple rows\n * as well as a top-level checkbox in the header to select all rows.\n *\n * @default \"none\"\n */\n selectionMode?: \"single\" | \"multiple\" | \"none\";\n\n /**\n * The currently selected rows in the table.\n * If provided, the row selection is controlled.\n */\n selectedRows?: PrimaryKeyType<Q>[];\n\n /**\n * Called when the row selection changes.\n * Required when row selection is controlled.\n *\n * @param selectedRowIds The primary keys of currently selected rows\n */\n\n onRowSelection?: (selectedRowIds: PrimaryKeyType<Q>[]) => void;\n\n /**\n * If provided, will render this context menu when right clicking on a cell\n */\n renderCellContextMenu?: (\n row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n cellValue: unknown,\n ) => React.ReactNode;\n\n /**\n * The height of each row in pixels.\n *\n * @default 40\n */\n rowHeight?: number;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"ObjectTableApi.js","names":[],"sources":["ObjectTableApi.ts"],"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 {\n DerivedProperty,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport type * as React from \"react\";\n\nexport type ColumnDefinition<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> = {\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>;\n\n /**\n * @default true\n */\n isVisible?: boolean;\n\n /**\n * @default none\n */\n pinned?: \"left\" | \"right\" | \"none\";\n width?: number;\n minWidth?: number;\n maxWidth?: number;\n resizable?: boolean;\n orderable?: boolean;\n filterable?: boolean;\n renderCell?: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>,\n ) => React.ReactNode;\n renderHeader?: () => React.ReactNode;\n};\n\nexport type ColumnDefinitionLocator<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> =\n | {\n type: \"property\";\n id: PropertyKeys<Q>;\n }\n | {\n type: \"function\";\n id: keyof FunctionColumns;\n }\n | {\n type: \"rdp\";\n id: keyof RDPs;\n creator: DerivedProperty.Creator<Q, RDPs[keyof RDPs]>;\n };\n\nexport interface ObjectTableProps<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n /**\n * The set of objects to show in the table\n */\n objectSet: ObjectSet<Q>;\n\n /**\n * The object type of the object\n */\n objectType: Q;\n\n /**\n * Ordered list of column definitions to show in the table\n *\n * If not provided, all of the properties of the object type will be shown in default order.\n */\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>;\n\n /**\n * Whether the table is filterable by the user.\n *\n * @default true\n */\n filterable?: boolean;\n\n /**\n * The current where clause to filter the objects in the table.\n * If provided, the filter is controlled.\n */\n filter?: WhereClause<Q, RDPs>;\n\n /**\n * Called when the where clause is changed.\n * Required when filter is controlled.\n *\n * @param newWhere The new where clause\n */\n onFilterChanged?: (newWhere: WhereClause<Q, RDPs>) => void;\n\n /**\n * Whether the table is sortable by the user.\n *\n * @default true\n */\n orderable?: boolean;\n\n /**\n * The current order by clause to sort the objects in the table.\n * If provided, the sorting is controlled.\n */\n orderBy?: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>;\n\n /**\n * Called when the order by clause is changed.\n * Required when sorting is controlled.\n *\n * @param newOrderBy The new order by clause\n */\n onOrderByChanged?: (\n newOrderBy: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>,\n ) => void;\n\n /**\n * Called when the visible columns change.\n *\n * If provided, the table will allow the user to show/hide columns.\n *\n * @param newStates The new list of column visibility states\n */\n onColumnVisibilityChanged?: (\n newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n isVisible: boolean;\n }>,\n ) => void;\n\n /**\n * Called when the pinned columns change.\n *\n * If provided, the table will allow the user to pin/unpin columns.\n *\n * @param newStates The new list of column pin states\n */\n onColumnsPinnedChanged?: (\n newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n pinned: \"left\" | \"right\" | \"none\";\n }>,\n ) => void;\n\n /**\n * Called when a column is resized.\n *\n * @param columnId The ID of the resized column\n * @param newWidth The new width of the column\n */\n onColumnResize?: (\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns,\n newWidth: number,\n ) => void;\n\n /**\n * Called when a row is clicked.\n *\n * @param object The object representing the clicked row\n */\n onRowClick?: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => void;\n\n /**\n * Selection mode for the table rows.\n *\n * If multiple, a checkbox will be shown for each row to allow selecting multiple rows\n * as well as a top-level checkbox in the header to select all rows.\n *\n * @default \"none\"\n */\n selectionMode?: \"single\" | \"multiple\" | \"none\";\n\n /**\n * The currently selected rows in the table.\n * If provided, the row selection is controlled.\n */\n selectedRows?: PrimaryKeyType<Q>[];\n\n /**\n * Called when the row selection changes.\n * Required when row selection is controlled.\n *\n * @param selectedRowIds The primary keys of currently selected rows\n */\n\n onRowSelection?: (selectedRowIds: PrimaryKeyType<Q>[]) => void;\n\n /**\n * If provided, will render this context menu when right clicking on a cell\n */\n renderCellContextMenu?: (\n row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n cellValue: unknown,\n ) => React.ReactNode;\n\n /**\n * The height of each row in pixels.\n *\n * @default 40\n */\n rowHeight?: number;\n\n className?: string;\n}\n"],"mappings":"","ignoreList":[]}
@@ -15,53 +15,31 @@
15
15
  */
16
16
 
17
17
  import React, { useCallback } from "react";
18
+ import { Checkbox } from "../base-components/checkbox/Checkbox.js";
18
19
  export function SelectionHeaderCell({
19
20
  isAllSelected,
20
21
  hasSelection,
21
22
  onToggleAll
22
23
  }) {
23
- return /*#__PURE__*/React.createElement("div", {
24
- style: {
25
- display: "flex",
26
- alignItems: "center",
27
- justifyContent: "center",
28
- width: "100%"
29
- }
30
- }, /*#__PURE__*/React.createElement("input", {
31
- type: "checkbox",
24
+ return /*#__PURE__*/React.createElement(Checkbox, {
25
+ indeterminate: hasSelection && !isAllSelected,
32
26
  checked: isAllSelected,
33
- ref: input => {
34
- if (input) input.indeterminate = hasSelection && !isAllSelected;
35
- },
36
- onChange: onToggleAll,
27
+ onCheckedChange: onToggleAll,
37
28
  "aria-label": "Select all rows"
38
- }));
29
+ });
39
30
  }
40
- const noop = () => {};
41
31
  export function SelectionCell({
42
32
  row,
43
33
  onToggleRow
44
34
  }) {
45
- const isSelected = row.getIsSelected();
46
- const handleClick = useCallback(e => {
47
- // Prevent onRowClick call
48
- e.stopPropagation();
49
- onToggleRow(row.id, row.index, e.shiftKey);
35
+ const handleClick = useCallback(event => {
36
+ const isShiftClick = event.shiftKey;
37
+ onToggleRow(row.id, row.index, isShiftClick);
50
38
  }, [row, onToggleRow]);
51
- return /*#__PURE__*/React.createElement("div", {
52
- style: {
53
- display: "flex",
54
- alignItems: "center",
55
- justifyContent: "center",
56
- width: "100%"
57
- }
58
- }, /*#__PURE__*/React.createElement("input", {
59
- type: "checkbox",
60
- checked: isSelected,
39
+ return /*#__PURE__*/React.createElement(Checkbox, {
40
+ checked: row.getIsSelected(),
61
41
  onClick: handleClick,
62
- onChange: noop // Using onClick here
63
- ,
64
42
  "aria-label": `Select row ${row.index + 1}`
65
- }));
43
+ });
66
44
  }
67
45
  //# sourceMappingURL=SelectionCells.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionCells.js","names":["React","useCallback","SelectionHeaderCell","isAllSelected","hasSelection","onToggleAll","createElement","style","display","alignItems","justifyContent","width","type","checked","ref","input","indeterminate","onChange","noop","SelectionCell","row","onToggleRow","isSelected","getIsSelected","handleClick","e","stopPropagation","id","index","shiftKey","onClick"],"sources":["SelectionCells.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 { Row, RowData } from \"@tanstack/react-table\";\nimport React, { useCallback } from \"react\";\n\ninterface SelectionHeaderCellProps {\n isAllSelected: boolean;\n hasSelection: boolean;\n onToggleAll: () => void;\n}\n\nexport function SelectionHeaderCell({\n isAllSelected,\n hasSelection,\n onToggleAll,\n}: SelectionHeaderCellProps): React.ReactElement {\n return (\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: \"100%\",\n }}\n >\n <input\n type=\"checkbox\"\n checked={isAllSelected}\n ref={(input) => {\n if (input) input.indeterminate = hasSelection && !isAllSelected;\n }}\n onChange={onToggleAll}\n aria-label=\"Select all rows\"\n />\n </div>\n );\n}\n\ninterface SelectionCellProps<TData extends RowData> {\n row: Row<TData>;\n onToggleRow: (rowId: string, rowIndex: number, isShiftClick: boolean) => void;\n}\n\nconst noop = () => {};\nexport function SelectionCell<TData extends RowData>({\n row,\n onToggleRow,\n}: SelectionCellProps<TData>): React.ReactElement {\n const isSelected = row.getIsSelected();\n\n const handleClick = useCallback(\n (e: React.MouseEvent<HTMLInputElement>) => {\n // Prevent onRowClick call\n e.stopPropagation();\n\n onToggleRow(row.id, row.index, e.shiftKey);\n },\n [row, onToggleRow],\n );\n\n return (\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: \"100%\",\n }}\n >\n <input\n type=\"checkbox\"\n checked={isSelected}\n onClick={handleClick}\n onChange={noop} // Using onClick here\n aria-label={`Select row ${row.index + 1}`}\n />\n </div>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAQ1C,OAAO,SAASC,mBAAmBA,CAAC;EAClCC,aAAa;EACbC,YAAY;EACZC;AACwB,CAAC,EAAsB;EAC/C,oBACEL,KAAA,CAAAM,aAAA;IACEC,KAAK,EAAE;MACLC,OAAO,EAAE,MAAM;MACfC,UAAU,EAAE,QAAQ;MACpBC,cAAc,EAAE,QAAQ;MACxBC,KAAK,EAAE;IACT;EAAE,gBAEFX,KAAA,CAAAM,aAAA;IACEM,IAAI,EAAC,UAAU;IACfC,OAAO,EAAEV,aAAc;IACvBW,GAAG,EAAGC,KAAK,IAAK;MACd,IAAIA,KAAK,EAAEA,KAAK,CAACC,aAAa,GAAGZ,YAAY,IAAI,CAACD,aAAa;IACjE,CAAE;IACFc,QAAQ,EAAEZ,WAAY;IACtB,cAAW;EAAiB,CAC7B,CACE,CAAC;AAEV;AAOA,MAAMa,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB,OAAO,SAASC,aAAaA,CAAwB;EACnDC,GAAG;EACHC;AACyB,CAAC,EAAsB;EAChD,MAAMC,UAAU,GAAGF,GAAG,CAACG,aAAa,CAAC,CAAC;EAEtC,MAAMC,WAAW,GAAGvB,WAAW,CAC5BwB,CAAqC,IAAK;IACzC;IACAA,CAAC,CAACC,eAAe,CAAC,CAAC;IAEnBL,WAAW,CAACD,GAAG,CAACO,EAAE,EAAEP,GAAG,CAACQ,KAAK,EAAEH,CAAC,CAACI,QAAQ,CAAC;EAC5C,CAAC,EACD,CAACT,GAAG,EAAEC,WAAW,CACnB,CAAC;EAED,oBACErB,KAAA,CAAAM,aAAA;IACEC,KAAK,EAAE;MACLC,OAAO,EAAE,MAAM;MACfC,UAAU,EAAE,QAAQ;MACpBC,cAAc,EAAE,QAAQ;MACxBC,KAAK,EAAE;IACT;EAAE,gBAEFX,KAAA,CAAAM,aAAA;IACEM,IAAI,EAAC,UAAU;IACfC,OAAO,EAAES,UAAW;IACpBQ,OAAO,EAAEN,WAAY;IACrBP,QAAQ,EAAEC,IAAK,CAAC;IAAA;IAChB,cAAY,cAAcE,GAAG,CAACQ,KAAK,GAAG,CAAC;EAAG,CAC3C,CACE,CAAC;AAEV","ignoreList":[]}
1
+ {"version":3,"file":"SelectionCells.js","names":["React","useCallback","Checkbox","SelectionHeaderCell","isAllSelected","hasSelection","onToggleAll","createElement","indeterminate","checked","onCheckedChange","SelectionCell","row","onToggleRow","handleClick","event","isShiftClick","shiftKey","id","index","getIsSelected","onClick"],"sources":["SelectionCells.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 { Row, RowData } from \"@tanstack/react-table\";\nimport React, { useCallback } from \"react\";\nimport { Checkbox } from \"../base-components/checkbox/Checkbox.js\";\n\ninterface SelectionHeaderCellProps {\n isAllSelected: boolean;\n hasSelection: boolean;\n onToggleAll: () => void;\n}\n\nexport function SelectionHeaderCell({\n isAllSelected,\n hasSelection,\n onToggleAll,\n}: SelectionHeaderCellProps): React.ReactElement {\n return (\n <Checkbox\n indeterminate={hasSelection && !isAllSelected}\n checked={isAllSelected}\n onCheckedChange={onToggleAll}\n aria-label={\"Select all rows\"}\n />\n );\n}\n\ninterface SelectionCellProps<TData extends RowData> {\n row: Row<TData>;\n onToggleRow: (rowId: string, rowIndex: number, isShiftClick: boolean) => void;\n}\n\nexport function SelectionCell<TData extends RowData>({\n row,\n onToggleRow,\n}: SelectionCellProps<TData>): React.ReactElement {\n const handleClick = useCallback(\n (event: React.MouseEvent<HTMLSpanElement, MouseEvent>) => {\n const isShiftClick = event.shiftKey;\n onToggleRow(row.id, row.index, isShiftClick);\n },\n [row, onToggleRow],\n );\n\n return (\n <Checkbox\n checked={row.getIsSelected()}\n onClick={handleClick}\n aria-label={`Select row ${row.index + 1}`}\n />\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,SAASC,QAAQ,QAAQ,yCAAyC;AAQlE,OAAO,SAASC,mBAAmBA,CAAC;EAClCC,aAAa;EACbC,YAAY;EACZC;AACwB,CAAC,EAAsB;EAC/C,oBACEN,KAAA,CAAAO,aAAA,CAACL,QAAQ;IACPM,aAAa,EAAEH,YAAY,IAAI,CAACD,aAAc;IAC9CK,OAAO,EAAEL,aAAc;IACvBM,eAAe,EAAEJ,WAAY;IAC7B,cAAY;EAAkB,CAC/B,CAAC;AAEN;AAOA,OAAO,SAASK,aAAaA,CAAwB;EACnDC,GAAG;EACHC;AACyB,CAAC,EAAsB;EAChD,MAAMC,WAAW,GAAGb,WAAW,CAC5Bc,KAAoD,IAAK;IACxD,MAAMC,YAAY,GAAGD,KAAK,CAACE,QAAQ;IACnCJ,WAAW,CAACD,GAAG,CAACM,EAAE,EAAEN,GAAG,CAACO,KAAK,EAAEH,YAAY,CAAC;EAC9C,CAAC,EACD,CAACJ,GAAG,EAAEC,WAAW,CACnB,CAAC;EAED,oBACEb,KAAA,CAAAO,aAAA,CAACL,QAAQ;IACPO,OAAO,EAAEG,GAAG,CAACQ,aAAa,CAAC,CAAE;IAC7BC,OAAO,EAAEP,WAAY;IACrB,cAAY,cAAcF,GAAG,CAACO,KAAK,GAAG,CAAC;EAAG,CAC3C,CAAC;AAEN","ignoreList":[]}
@@ -14,7 +14,9 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
+ import classNames from "classnames";
17
18
  import React, { useCallback, useRef } from "react";
19
+ import styles from "./Table.module.css";
18
20
  import { TableBody } from "./TableBody.js";
19
21
  import { TableHeader } from "./TableHeader.js";
20
22
  export function Table({
@@ -23,7 +25,8 @@ export function Table({
23
25
  fetchNextPage,
24
26
  onRowClick,
25
27
  rowHeight,
26
- renderCellContextMenu
28
+ renderCellContextMenu,
29
+ className
27
30
  }) {
28
31
  const tableContainerRef = useRef(null);
29
32
 
@@ -54,21 +57,9 @@ export function Table({
54
57
 
55
58
  return /*#__PURE__*/React.createElement("div", {
56
59
  ref: tableContainerRef,
57
- style: {
58
- position: "relative",
59
- // needed for sticky header
60
- height: "100%",
61
- // needed for scrolling
62
- overflow: "auto",
63
- cursor: table.getState().columnSizingInfo?.isResizingColumn ? "col-resize" : "default",
64
- userSelect: table.getState().columnSizingInfo?.isResizingColumn ? "none" : "auto"
65
- },
60
+ className: classNames(styles.osdkTableContainer, className),
66
61
  onScroll: handleScroll
67
- }, /*#__PURE__*/React.createElement("table", {
68
- style: {
69
- display: "grid"
70
- }
71
- }, /*#__PURE__*/React.createElement(TableHeader, {
62
+ }, /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement(TableHeader, {
72
63
  table: table
73
64
  }), /*#__PURE__*/React.createElement(TableBody, {
74
65
  rows: table.getRowModel().rows,
@@ -1 +1 @@
1
- {"version":3,"file":"Table.js","names":["React","useCallback","useRef","TableBody","TableHeader","Table","table","isLoading","fetchNextPage","onRowClick","rowHeight","renderCellContextMenu","tableContainerRef","fetchingRef","fetchMoreOnEndReached","containerRefElement","current","scrollHeight","scrollTop","clientHeight","handleScroll","e","currentTarget","createElement","ref","style","position","height","overflow","cursor","getState","columnSizingInfo","isResizingColumn","userSelect","onScroll","display","rows","getRowModel"],"sources":["Table.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, Table } from \"@tanstack/react-table\";\nimport React, { type ReactElement, useCallback, useRef } from \"react\";\nimport { TableBody } from \"./TableBody.js\";\nimport { TableHeader } from \"./TableHeader.js\";\n\ninterface TableProps<TData extends RowData> {\n table: Table<TData>;\n isLoading?: boolean;\n fetchNextPage?: () => Promise<void>;\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 Table<TData extends RowData>(\n {\n table,\n isLoading,\n fetchNextPage,\n onRowClick,\n rowHeight,\n renderCellContextMenu,\n }: TableProps<TData>,\n): ReactElement {\n const tableContainerRef = useRef<HTMLDivElement>(null);\n\n // Using a ref to prevent duplicate fetches from rapid scroll events while a fetch is in-flight\n const fetchingRef = useRef(false);\n\n const fetchMoreOnEndReached = useCallback(\n async (containerRefElement?: HTMLDivElement | null) => {\n if (containerRefElement && !fetchingRef.current) {\n const { scrollHeight, scrollTop, clientHeight } = containerRefElement;\n if (\n scrollHeight - scrollTop - clientHeight < 100\n && !isLoading\n ) {\n fetchingRef.current = true;\n try {\n await fetchNextPage?.();\n } finally {\n fetchingRef.current = false;\n }\n }\n }\n },\n [fetchNextPage, isLoading],\n );\n\n const handleScroll = useCallback(\n async (e: React.UIEvent<HTMLDivElement>) => {\n await fetchMoreOnEndReached(e.currentTarget);\n },\n [fetchMoreOnEndReached],\n );\n\n // TODO: Handle error, loading and empty states\n\n return (\n <div\n ref={tableContainerRef}\n style={{\n position: \"relative\", // needed for sticky header\n height: \"100%\", // needed for scrolling\n overflow: \"auto\",\n cursor: table.getState().columnSizingInfo?.isResizingColumn\n ? \"col-resize\"\n : \"default\",\n userSelect: table.getState().columnSizingInfo?.isResizingColumn\n ? \"none\"\n : \"auto\",\n }}\n onScroll={handleScroll}\n >\n <table\n style={{ display: \"grid\" }}\n >\n <TableHeader table={table} />\n <TableBody\n rows={table.getRowModel().rows}\n tableContainerRef={tableContainerRef}\n onRowClick={onRowClick}\n rowHeight={rowHeight}\n renderCellContextMenu={renderCellContextMenu}\n />\n </table>\n </div>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,KAAK,IAAuBC,WAAW,EAAEC,MAAM,QAAQ,OAAO;AACrE,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,WAAW,QAAQ,kBAAkB;AAc9C,OAAO,SAASC,KAAKA,CACnB;EACEC,KAAK;EACLC,SAAS;EACTC,aAAa;EACbC,UAAU;EACVC,SAAS;EACTC;AACiB,CAAC,EACN;EACd,MAAMC,iBAAiB,GAAGV,MAAM,CAAiB,IAAI,CAAC;;EAEtD;EACA,MAAMW,WAAW,GAAGX,MAAM,CAAC,KAAK,CAAC;EAEjC,MAAMY,qBAAqB,GAAGb,WAAW,CACvC,MAAOc,mBAA2C,IAAK;IACrD,IAAIA,mBAAmB,IAAI,CAACF,WAAW,CAACG,OAAO,EAAE;MAC/C,MAAM;QAAEC,YAAY;QAAEC,SAAS;QAAEC;MAAa,CAAC,GAAGJ,mBAAmB;MACrE,IACEE,YAAY,GAAGC,SAAS,GAAGC,YAAY,GAAG,GAAG,IAC1C,CAACZ,SAAS,EACb;QACAM,WAAW,CAACG,OAAO,GAAG,IAAI;QAC1B,IAAI;UACF,MAAMR,aAAa,GAAG,CAAC;QACzB,CAAC,SAAS;UACRK,WAAW,CAACG,OAAO,GAAG,KAAK;QAC7B;MACF;IACF;EACF,CAAC,EACD,CAACR,aAAa,EAAED,SAAS,CAC3B,CAAC;EAED,MAAMa,YAAY,GAAGnB,WAAW,CAC9B,MAAOoB,CAAgC,IAAK;IAC1C,MAAMP,qBAAqB,CAACO,CAAC,CAACC,aAAa,CAAC;EAC9C,CAAC,EACD,CAACR,qBAAqB,CACxB,CAAC;;EAED;;EAEA,oBACEd,KAAA,CAAAuB,aAAA;IACEC,GAAG,EAAEZ,iBAAkB;IACvBa,KAAK,EAAE;MACLC,QAAQ,EAAE,UAAU;MAAE;MACtBC,MAAM,EAAE,MAAM;MAAE;MAChBC,QAAQ,EAAE,MAAM;MAChBC,MAAM,EAAEvB,KAAK,CAACwB,QAAQ,CAAC,CAAC,CAACC,gBAAgB,EAAEC,gBAAgB,GACvD,YAAY,GACZ,SAAS;MACbC,UAAU,EAAE3B,KAAK,CAACwB,QAAQ,CAAC,CAAC,CAACC,gBAAgB,EAAEC,gBAAgB,GAC3D,MAAM,GACN;IACN,CAAE;IACFE,QAAQ,EAAEd;EAAa,gBAEvBpB,KAAA,CAAAuB,aAAA;IACEE,KAAK,EAAE;MAAEU,OAAO,EAAE;IAAO;EAAE,gBAE3BnC,KAAA,CAAAuB,aAAA,CAACnB,WAAW;IAACE,KAAK,EAAEA;EAAM,CAAE,CAAC,eAC7BN,KAAA,CAAAuB,aAAA,CAACpB,SAAS;IACRiC,IAAI,EAAE9B,KAAK,CAAC+B,WAAW,CAAC,CAAC,CAACD,IAAK;IAC/BxB,iBAAiB,EAAEA,iBAAkB;IACrCH,UAAU,EAAEA,UAAW;IACvBC,SAAS,EAAEA,SAAU;IACrBC,qBAAqB,EAAEA;EAAsB,CAC9C,CACI,CACJ,CAAC;AAEV","ignoreList":[]}
1
+ {"version":3,"file":"Table.js","names":["classNames","React","useCallback","useRef","styles","TableBody","TableHeader","Table","table","isLoading","fetchNextPage","onRowClick","rowHeight","renderCellContextMenu","className","tableContainerRef","fetchingRef","fetchMoreOnEndReached","containerRefElement","current","scrollHeight","scrollTop","clientHeight","handleScroll","e","currentTarget","createElement","ref","osdkTableContainer","onScroll","rows","getRowModel"],"sources":["Table.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, Table } from \"@tanstack/react-table\";\nimport classNames from \"classnames\";\nimport React, { type ReactElement, useCallback, useRef } from \"react\";\nimport styles from \"./Table.module.css\";\nimport { TableBody } from \"./TableBody.js\";\nimport { TableHeader } from \"./TableHeader.js\";\n\ninterface TableProps<TData extends RowData> {\n table: Table<TData>;\n isLoading?: boolean;\n fetchNextPage?: () => Promise<void>;\n onRowClick?: (row: TData) => void;\n rowHeight?: number;\n renderCellContextMenu?: (\n row: TData,\n cell: Cell<TData, unknown>,\n ) => React.ReactNode;\n className?: string;\n}\n\nexport function Table<TData extends RowData>(\n {\n table,\n isLoading,\n fetchNextPage,\n onRowClick,\n rowHeight,\n renderCellContextMenu,\n className,\n }: TableProps<TData>,\n): ReactElement {\n const tableContainerRef = useRef<HTMLDivElement>(null);\n\n // Using a ref to prevent duplicate fetches from rapid scroll events while a fetch is in-flight\n const fetchingRef = useRef(false);\n\n const fetchMoreOnEndReached = useCallback(\n async (containerRefElement?: HTMLDivElement | null) => {\n if (containerRefElement && !fetchingRef.current) {\n const { scrollHeight, scrollTop, clientHeight } = containerRefElement;\n if (\n scrollHeight - scrollTop - clientHeight < 100\n && !isLoading\n ) {\n fetchingRef.current = true;\n try {\n await fetchNextPage?.();\n } finally {\n fetchingRef.current = false;\n }\n }\n }\n },\n [fetchNextPage, isLoading],\n );\n\n const handleScroll = useCallback(\n async (e: React.UIEvent<HTMLDivElement>) => {\n await fetchMoreOnEndReached(e.currentTarget);\n },\n [fetchMoreOnEndReached],\n );\n\n // TODO: Handle error, loading and empty states\n\n return (\n <div\n ref={tableContainerRef}\n className={classNames(styles.osdkTableContainer, className)}\n onScroll={handleScroll}\n >\n <table>\n <TableHeader table={table} />\n <TableBody\n rows={table.getRowModel().rows}\n tableContainerRef={tableContainerRef}\n onRowClick={onRowClick}\n rowHeight={rowHeight}\n renderCellContextMenu={renderCellContextMenu}\n />\n </table>\n </div>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,IAAuBC,WAAW,EAAEC,MAAM,QAAQ,OAAO;AACrE,OAAOC,MAAM,MAAM,oBAAoB;AACvC,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,WAAW,QAAQ,kBAAkB;AAe9C,OAAO,SAASC,KAAKA,CACnB;EACEC,KAAK;EACLC,SAAS;EACTC,aAAa;EACbC,UAAU;EACVC,SAAS;EACTC,qBAAqB;EACrBC;AACiB,CAAC,EACN;EACd,MAAMC,iBAAiB,GAAGZ,MAAM,CAAiB,IAAI,CAAC;;EAEtD;EACA,MAAMa,WAAW,GAAGb,MAAM,CAAC,KAAK,CAAC;EAEjC,MAAMc,qBAAqB,GAAGf,WAAW,CACvC,MAAOgB,mBAA2C,IAAK;IACrD,IAAIA,mBAAmB,IAAI,CAACF,WAAW,CAACG,OAAO,EAAE;MAC/C,MAAM;QAAEC,YAAY;QAAEC,SAAS;QAAEC;MAAa,CAAC,GAAGJ,mBAAmB;MACrE,IACEE,YAAY,GAAGC,SAAS,GAAGC,YAAY,GAAG,GAAG,IAC1C,CAACb,SAAS,EACb;QACAO,WAAW,CAACG,OAAO,GAAG,IAAI;QAC1B,IAAI;UACF,MAAMT,aAAa,GAAG,CAAC;QACzB,CAAC,SAAS;UACRM,WAAW,CAACG,OAAO,GAAG,KAAK;QAC7B;MACF;IACF;EACF,CAAC,EACD,CAACT,aAAa,EAAED,SAAS,CAC3B,CAAC;EAED,MAAMc,YAAY,GAAGrB,WAAW,CAC9B,MAAOsB,CAAgC,IAAK;IAC1C,MAAMP,qBAAqB,CAACO,CAAC,CAACC,aAAa,CAAC;EAC9C,CAAC,EACD,CAACR,qBAAqB,CACxB,CAAC;;EAED;;EAEA,oBACEhB,KAAA,CAAAyB,aAAA;IACEC,GAAG,EAAEZ,iBAAkB;IACvBD,SAAS,EAAEd,UAAU,CAACI,MAAM,CAACwB,kBAAkB,EAAEd,SAAS,CAAE;IAC5De,QAAQ,EAAEN;EAAa,gBAEvBtB,KAAA,CAAAyB,aAAA,6BACEzB,KAAA,CAAAyB,aAAA,CAACpB,WAAW;IAACE,KAAK,EAAEA;EAAM,CAAE,CAAC,eAC7BP,KAAA,CAAAyB,aAAA,CAACrB,SAAS;IACRyB,IAAI,EAAEtB,KAAK,CAACuB,WAAW,CAAC,CAAC,CAACD,IAAK;IAC/Bf,iBAAiB,EAAEA,iBAAkB;IACrCJ,UAAU,EAAEA,UAAW;IACvBC,SAAS,EAAEA,SAAU;IACrBC,qBAAqB,EAAEA;EAAsB,CAC9C,CACI,CACJ,CAAC;AAEV","ignoreList":[]}
@@ -0,0 +1,21 @@
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
+ .osdkTableContainer {
18
+ position: relative; /* needed for sticky header */
19
+ height: 100%; /* needed for scrolling */
20
+ overflow: auto;
21
+ }
@@ -16,6 +16,7 @@
16
16
 
17
17
  import { useVirtualizer } from "@tanstack/react-virtual";
18
18
  import React, { useLayoutEffect } from "react";
19
+ import styles from "./TableBody.module.css";
19
20
  import { TableRow } from "./TableRow.js";
20
21
  export function TableBody({
21
22
  rows,
@@ -37,9 +38,8 @@ export function TableBody({
37
38
  rowVirtualizer.measure();
38
39
  }, [rowVirtualizer, rows.length]);
39
40
  return /*#__PURE__*/React.createElement("tbody", {
41
+ className: styles.osdkTableBody,
40
42
  style: {
41
- display: "grid",
42
- position: "relative",
43
43
  height: `${rowVirtualizer.getTotalSize()}px`
44
44
  }
45
45
  }, rowVirtualizer.getVirtualItems().map(virtualRow => {