@osdk/react-components 0.1.0-beta.2 → 0.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +51 -1
- package/build/browser/base-components/checkbox/Checkbox.js +40 -0
- package/build/browser/base-components/checkbox/Checkbox.js.map +1 -0
- package/build/browser/base-components/checkbox/Checkbox.module.css +71 -0
- package/build/browser/css-modules.d.ts +20 -0
- package/build/browser/object-table/SelectionCells.js +11 -33
- package/build/browser/object-table/SelectionCells.js.map +1 -1
- package/build/browser/object-table/TableCell.js.map +1 -1
- package/build/browser/object-table/TableHeader.js.map +1 -1
- package/build/cjs/public/experimental.cjs +100 -3663
- package/build/cjs/public/experimental.cjs.map +1 -1
- package/build/cjs/public/experimental.css +48 -0
- package/build/cjs/public/experimental.css.map +1 -0
- package/build/esm/base-components/checkbox/Checkbox.js +40 -0
- package/build/esm/base-components/checkbox/Checkbox.js.map +1 -0
- package/build/esm/base-components/checkbox/Checkbox.module.css +71 -0
- package/build/esm/css-modules.d.ts +20 -0
- package/build/esm/object-table/SelectionCells.js +11 -33
- package/build/esm/object-table/SelectionCells.js.map +1 -1
- package/build/esm/object-table/TableCell.js.map +1 -1
- package/build/esm/object-table/TableHeader.js.map +1 -1
- package/build/types/base-components/checkbox/Checkbox.d.ts +10 -0
- package/build/types/base-components/checkbox/Checkbox.d.ts.map +1 -0
- package/build/types/css-modules.d.d.ts +6 -0
- package/build/types/css-modules.d.d.ts.map +1 -0
- package/build/types/object-table/SelectionCells.d.ts.map +1 -1
- package/build/types/object-table/TableCell.d.ts.map +1 -1
- package/build/types/object-table/TableHeader.d.ts.map +1 -1
- package/package.json +11 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @osdk/react-components
|
|
2
2
|
|
|
3
|
+
## 0.1.0-beta.3
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9cd0b26: Add base UI component and css module
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [acf6331]
|
|
12
|
+
- Updated dependencies [6cfe14a]
|
|
13
|
+
- Updated dependencies [ec6ad57]
|
|
14
|
+
- Updated dependencies [38d5958]
|
|
15
|
+
- Updated dependencies [56ba08f]
|
|
16
|
+
- Updated dependencies [d5cfc38]
|
|
17
|
+
- @osdk/react@0.9.0-beta.7
|
|
18
|
+
- @osdk/client@2.7.0-beta.11
|
|
19
|
+
- @osdk/api@2.7.0-beta.11
|
|
20
|
+
|
|
3
21
|
## 0.1.0-beta.2
|
|
4
22
|
|
|
5
23
|
### 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,71 @@
|
|
|
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(var(--osdk-checkbox-icon-size) + var(--osdk-checkbox-padding) * 2);
|
|
22
|
+
min-height: calc(var(--osdk-checkbox-icon-size) + var(--osdk-checkbox-padding) * 2);
|
|
23
|
+
padding: var(--osdk-checkbox-padding);
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
border-radius: var(--bp-surface-borderRadius);
|
|
27
|
+
|
|
28
|
+
&[data-unchecked] {
|
|
29
|
+
background-color: var(--osdk-checkbox-bg);
|
|
30
|
+
border: var(--osdk-checkbox-border);
|
|
31
|
+
|
|
32
|
+
&:hover {
|
|
33
|
+
background-color: var(--osdk-checkbox-bg-hover);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:active {
|
|
37
|
+
background-color: var(--osdk-checkbox-bg-active);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&[data-checked], &[data-indeterminate] {
|
|
42
|
+
background-color: var(--osdk-checkbox-bg-checked);
|
|
43
|
+
|
|
44
|
+
&:hover {
|
|
45
|
+
background-color: var(--osdk-checkbox-bg-checked-hover);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&:active {
|
|
49
|
+
background-color: var(--osdk-checkbox-bg-checked-active);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&:focus-visible {
|
|
54
|
+
outline: var(--bp-emphasis-focusWidth) solid var(--bp-emphasis-focusColor);
|
|
55
|
+
outline-offset: var(--bp-emphasis-focusOffset);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.osdkCheckboxIndicator {
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
color: var(--osdk-checkbox-checked-foreground);
|
|
64
|
+
width: var(--osdk-checkbox-icon-size);
|
|
65
|
+
height: var(--osdk-checkbox-icon-size);
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
&[data-unchecked] {
|
|
69
|
+
display: none;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -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(
|
|
24
|
-
|
|
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
|
-
|
|
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
|
|
46
|
-
|
|
47
|
-
|
|
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(
|
|
52
|
-
|
|
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","
|
|
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":[]}
|
|
@@ -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;
|
|
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 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\";\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()) as\n | ReactNode\n | React.JSX.Element}\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;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,CAGvD,CAAC,EAlBuB,CAACjB,cAAc,IAAIG,iBAAiB,IAC/D,CAAC,CAACG,eAAe,IACjB,CAAC,CAACR,qBAAqB,iBAmBpBP,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 +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;
|
|
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 type { ReactNode } from \"react\";\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 ) as ReactNode | React.JSX.Element}\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;AAElD,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,CAAkC,EACnCR,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":[]}
|