@osdk/react-components 0.1.0-rc.7 → 0.2.0-beta.2
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 +7 -9
- package/README.md +21 -5
- package/build/browser/base-components/checkbox/Checkbox.js +27 -32
- package/build/browser/base-components/checkbox/Checkbox.module.css +79 -0
- package/build/browser/base-components/checkbox/Checkbox.module.css.js +7 -0
- package/build/browser/object-table/CellContextMenu.js +23 -20
- package/build/browser/object-table/CellContextMenu.module.css +20 -0
- package/build/browser/object-table/CellContextMenu.module.css.js +6 -0
- package/build/browser/object-table/LoadingCell.js +24 -29
- package/build/browser/object-table/LoadingCell.module.css +48 -0
- package/build/browser/object-table/LoadingCell.module.css.js +8 -0
- package/build/browser/object-table/LoadingRow.js +24 -50
- package/build/browser/object-table/LoadingStateTable.js +46 -340
- package/build/browser/object-table/NonIdealState.js +23 -20
- package/build/browser/object-table/NonIdealState.module.css +28 -0
- package/build/browser/object-table/NonIdealState.module.css.js +7 -0
- package/build/browser/object-table/Table.js +51 -933
- package/build/browser/object-table/Table.js.map +1 -1
- package/build/browser/object-table/Table.module.css +22 -0
- package/build/browser/object-table/Table.module.css.js +6 -0
- package/build/browser/object-table/TableBody.js +36 -260
- package/build/browser/object-table/TableBody.module.css +20 -0
- package/build/browser/object-table/TableBody.module.css.js +6 -0
- package/build/browser/object-table/TableCell.js +31 -111
- package/build/browser/object-table/TableCell.module.css +62 -0
- package/build/browser/object-table/TableCell.module.css.js +7 -0
- package/build/browser/object-table/TableHeader.js +38 -215
- package/build/browser/object-table/TableHeader.module.css +101 -0
- package/build/browser/object-table/TableHeader.module.css.js +10 -0
- package/build/browser/object-table/TableHeaderContent.js +21 -18
- package/build/browser/object-table/TableHeaderContent.module.css +30 -0
- package/build/browser/object-table/TableHeaderContent.module.css.js +6 -0
- package/build/browser/object-table/TableHeaderWithPopover.js +66 -80
- package/build/browser/object-table/TableHeaderWithPopover.module.css +110 -0
- package/build/browser/object-table/TableHeaderWithPopover.module.css.js +15 -0
- package/build/browser/object-table/TableRow.js +26 -144
- package/build/browser/object-table/TableRow.module.css +60 -0
- package/build/browser/object-table/TableRow.module.css.js +6 -0
- package/build/browser/styles.css +615 -0
- package/build/cjs/public/experimental.cjs +5 -5
- package/build/cjs/public/experimental.cjs.map +1 -1
- package/build/esm/object-table/Table.js +5 -5
- package/build/esm/object-table/Table.js.map +1 -1
- package/package.json +11 -8
|
@@ -1,53 +1,41 @@
|
|
|
1
|
-
|
|
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
|
+
|
|
2
17
|
import { Menu } from "@base-ui/react/menu";
|
|
3
18
|
import { ChevronDown, Pin, Remove, SortAlphabetical, SortAlphabeticalDesc, Unpin, VerticalDistribution } from "@blueprintjs/icons";
|
|
4
19
|
import classNames from "classnames";
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { flexRender } from "@tanstack/react-table";
|
|
9
|
-
import React from "react";
|
|
10
|
-
var css = '/*\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\n.osdkHeaderContent {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n line-clamp: 2;\n text-align: left;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.osdkHeaderContent:has([role="checkbox"]) {\n display: flex;\n justify-content: center;\n}\n';
|
|
11
|
-
if (typeof document !== "undefined") {
|
|
12
|
-
const style = document.createElement("style");
|
|
13
|
-
style.textContent = css;
|
|
14
|
-
document.head.appendChild(style);
|
|
15
|
-
}
|
|
16
|
-
var TableHeaderContent_default = { "osdkHeaderContent": "osdkHeaderContent" };
|
|
17
|
-
function TableHeaderContent({
|
|
18
|
-
header
|
|
19
|
-
}) {
|
|
20
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
21
|
-
className: TableHeaderContent_default.osdkHeaderContent
|
|
22
|
-
}, flexRender(header.column.columnDef.header, header.getContext()));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// build/browser/object-table/TableHeaderWithPopover.module.css
|
|
26
|
-
var css2 = '/*\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\n.osdkCenterContainer {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.osdkContentGap {\n display: flex;\n gap: var(--osdk-surface-spacing);\n}\n\n.osdkHeaderContainer {\n justify-content: space-between;\n flex: 1;\n min-width: 0;\n align-self: stretch;\n}\n\n.osdkHeaderContentLeft {\n min-width: 0;\n flex-shrink: 1;\n}\n\n.osdkHeaderContentRight {\n flex-shrink: 0;\n}\n\n.osdkHeaderPopoverTrigger {\n padding: 0;\n flex-shrink: 0;\n flex-grow: 0;\n border: var(--osdk-surface-border-width) solid\n var(--osdk-surface-border-color-default);\n border-radius: var(--osdk-surface-border-radius);\n color: var(--osdk-intent-default-foreground);\n user-select: none;\n outline: none;\n\n &:hover {\n background-color: var(--osdk-intent-default-hover);\n }\n\n &[data-popup-open] {\n background-color: var(--osdk-intent-primary-rest);\n }\n\n &:focus-visible {\n outline: var(--osdk-focus-visible-outline);\n outline-offset: var(--osdk-focus-visible-outline-offset);\n }\n}\n\n.osdkHeaderIcon {\n width: var(--osdk-iconography-size-small);\n height: var(--osdk-iconography-size-small);\n}\n\n.osdkHeaderPopup {\n box-sizing: border-box;\n padding: var(--osdk-surface-spacing);\n border-radius: var(--osdk-surface-border-radius);\n border: var(--osdk-surface-border-width) solid\n var(--osdk-surface-border-color-default);\n background-color: var(--osdk-surface-background-color-default);\n color: var(--osdk-typography-color-default-rest);\n box-shadow: var(--osdk-surface-shadow-2);\n font-size: var(--osdk-typography-size-body-medium);\n outline: none;\n}\n\n.osdkHeaderMenuItem {\n justify-content: flex-start;\n padding: var(--osdk-surface-spacing);\n cursor: pointer;\n}\n\n.osdkHeaderMenuItem:hover {\n outline: none;\n background-color: var(--osdk-surface-background-color-default-hover);\n border-radius: var(--osdk-surface-border-radius);\n}\n\n.osdkHeaderActiveMenuItem {\n background-color: var(--osdk-intent-primary-rest);\n color: var(--osdk-intent-primary-foreground);\n}\n\n.osdkHeaderActiveMenuItem:hover {\n background-color: var(--osdk-intent-primary-hover);\n}\n\n.osdkHeaderActiveMenuItem:active {\n background-color: var(--osdk-intent-primary-active);\n}\n';
|
|
27
|
-
if (typeof document !== "undefined") {
|
|
28
|
-
const style = document.createElement("style");
|
|
29
|
-
style.textContent = css2;
|
|
30
|
-
document.head.appendChild(style);
|
|
31
|
-
}
|
|
32
|
-
var TableHeaderWithPopover_default = { "osdkCenterContainer": "osdkCenterContainer", "osdkContentGap": "osdkContentGap", "osdkHeaderContainer": "osdkHeaderContainer", "osdkHeaderContentLeft": "osdkHeaderContentLeft", "osdkHeaderContentRight": "osdkHeaderContentRight", "osdkHeaderPopoverTrigger": "osdkHeaderPopoverTrigger", "osdkHeaderIcon": "osdkHeaderIcon", "osdkHeaderPopup": "osdkHeaderPopup", "osdkHeaderMenuItem": "osdkHeaderMenuItem", "osdkHeaderActiveMenuItem": "osdkHeaderActiveMenuItem" };
|
|
33
|
-
|
|
34
|
-
// build/browser/object-table/TableHeaderWithPopover.js
|
|
20
|
+
import React, { useCallback, useState } from "react";
|
|
21
|
+
import { TableHeaderContent } from "./TableHeaderContent.js";
|
|
22
|
+
import styles from "./TableHeaderWithPopover.module.css.js";
|
|
35
23
|
function HeaderMenuItem({
|
|
36
24
|
onClick,
|
|
37
25
|
icon: Icon,
|
|
38
26
|
label,
|
|
39
27
|
active = false
|
|
40
28
|
}) {
|
|
41
|
-
return
|
|
29
|
+
return /*#__PURE__*/React.createElement(Menu.Item, {
|
|
42
30
|
closeOnClick: true,
|
|
43
|
-
className: classNames(
|
|
44
|
-
onClick
|
|
45
|
-
},
|
|
46
|
-
className:
|
|
31
|
+
className: classNames(styles.osdkCenterContainer, styles.osdkContentGap, styles.osdkHeaderMenuItem, active && styles.osdkHeaderActiveMenuItem),
|
|
32
|
+
onClick: onClick
|
|
33
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
34
|
+
className: styles.osdkHeaderIcon,
|
|
47
35
|
color: "currentColor"
|
|
48
|
-
}),
|
|
36
|
+
}), /*#__PURE__*/React.createElement("span", null, label));
|
|
49
37
|
}
|
|
50
|
-
function TableHeaderWithPopover({
|
|
38
|
+
export function TableHeaderWithPopover({
|
|
51
39
|
header,
|
|
52
40
|
isColumnPinned,
|
|
53
41
|
setColumnPinning,
|
|
@@ -56,18 +44,18 @@ function TableHeaderWithPopover({
|
|
|
56
44
|
}) {
|
|
57
45
|
const [isOpen, setIsOpen] = useState(false);
|
|
58
46
|
const handlePinLeft = useCallback(() => {
|
|
59
|
-
setColumnPinning(
|
|
47
|
+
setColumnPinning(prev => {
|
|
60
48
|
return {
|
|
61
|
-
left: [...prev.left || [], header.column.id],
|
|
62
|
-
right: prev.right?.filter(
|
|
49
|
+
left: [...(prev.left || []), header.column.id],
|
|
50
|
+
right: prev.right?.filter(id => id !== header.column.id) || []
|
|
63
51
|
};
|
|
64
52
|
});
|
|
65
53
|
}, [header.column.id, setColumnPinning]);
|
|
66
54
|
const handleUnpin = useCallback(() => {
|
|
67
|
-
setColumnPinning(
|
|
55
|
+
setColumnPinning(prev => {
|
|
68
56
|
return {
|
|
69
|
-
left: prev.left?.filter(
|
|
70
|
-
right: prev.right?.filter(
|
|
57
|
+
left: prev.left?.filter(id => id !== header.column.id) || [],
|
|
58
|
+
right: prev.right?.filter(id => id !== header.column.id) || []
|
|
71
59
|
};
|
|
72
60
|
});
|
|
73
61
|
}, [header.column.id, setColumnPinning]);
|
|
@@ -95,75 +83,73 @@ function TableHeaderWithPopover({
|
|
|
95
83
|
onResetSize();
|
|
96
84
|
}
|
|
97
85
|
}, [header.column, onResetSize]);
|
|
98
|
-
const handleInteraction = useCallback(
|
|
86
|
+
const handleInteraction = useCallback(e => {
|
|
99
87
|
e.preventDefault();
|
|
100
|
-
setIsOpen(
|
|
88
|
+
setIsOpen(prev => !prev);
|
|
101
89
|
}, []);
|
|
102
90
|
const isSorted = header.column.getIsSorted();
|
|
103
91
|
const isSortable = header.column.getCanSort();
|
|
104
|
-
return
|
|
92
|
+
return /*#__PURE__*/React.createElement(Menu.Root, {
|
|
105
93
|
open: isOpen,
|
|
106
94
|
onOpenChange: setIsOpen
|
|
107
|
-
},
|
|
108
|
-
className: classNames(
|
|
95
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
96
|
+
className: classNames(styles.osdkCenterContainer, styles.osdkContentGap, styles.osdkHeaderContainer),
|
|
109
97
|
onContextMenu: handleInteraction
|
|
110
|
-
},
|
|
111
|
-
className: classNames(
|
|
112
|
-
}, isColumnPinned &&
|
|
113
|
-
className:
|
|
98
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
className: classNames(styles.osdkCenterContainer, styles.osdkContentGap, styles.osdkHeaderContentLeft)
|
|
100
|
+
}, isColumnPinned && /*#__PURE__*/React.createElement(Pin, {
|
|
101
|
+
className: styles.osdkHeaderIcon,
|
|
114
102
|
color: "currentColor"
|
|
115
|
-
}),
|
|
116
|
-
header
|
|
117
|
-
})),
|
|
118
|
-
className: classNames(
|
|
119
|
-
}, isSorted &&
|
|
120
|
-
className:
|
|
121
|
-
}, isSorted === "asc" ?
|
|
122
|
-
className:
|
|
103
|
+
}), /*#__PURE__*/React.createElement(TableHeaderContent, {
|
|
104
|
+
header: header
|
|
105
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
className: classNames(styles.osdkCenterContainer, styles.osdkContentGap, styles.osdkHeaderContentRight)
|
|
107
|
+
}, isSorted && /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: styles.osdkCenterContainer
|
|
109
|
+
}, isSorted === "asc" ? /*#__PURE__*/React.createElement(SortAlphabetical, {
|
|
110
|
+
className: styles.osdkHeaderIcon,
|
|
123
111
|
color: "currentColor"
|
|
124
|
-
}) :
|
|
125
|
-
className:
|
|
112
|
+
}) : /*#__PURE__*/React.createElement(SortAlphabeticalDesc, {
|
|
113
|
+
className: styles.osdkHeaderIcon,
|
|
126
114
|
color: "currentColor"
|
|
127
|
-
})),
|
|
115
|
+
})), /*#__PURE__*/React.createElement(Menu.Trigger, {
|
|
128
116
|
"aria-label": `Open header menu for column with id=${header.column.id}`,
|
|
129
|
-
className: classNames(
|
|
130
|
-
},
|
|
131
|
-
className:
|
|
132
|
-
}))),
|
|
117
|
+
className: classNames(styles.osdkCenterContainer, styles.osdkHeaderPopoverTrigger)
|
|
118
|
+
}, /*#__PURE__*/React.createElement(ChevronDown, {
|
|
119
|
+
className: styles.osdkHeaderIcon
|
|
120
|
+
}))), /*#__PURE__*/React.createElement(Menu.Portal, {
|
|
133
121
|
container: document.body
|
|
134
|
-
},
|
|
122
|
+
}, /*#__PURE__*/React.createElement(Menu.Positioner, {
|
|
135
123
|
sideOffset: 4
|
|
136
|
-
},
|
|
137
|
-
className:
|
|
138
|
-
}, !isColumnPinned &&
|
|
124
|
+
}, /*#__PURE__*/React.createElement(Menu.Popup, {
|
|
125
|
+
className: styles.osdkHeaderPopup
|
|
126
|
+
}, !isColumnPinned && /*#__PURE__*/React.createElement(HeaderMenuItem, {
|
|
139
127
|
onClick: handlePinLeft,
|
|
140
128
|
icon: Pin,
|
|
141
129
|
label: "Pin column"
|
|
142
|
-
}), isColumnPinned &&
|
|
130
|
+
}), isColumnPinned && /*#__PURE__*/React.createElement(HeaderMenuItem, {
|
|
143
131
|
onClick: handleUnpin,
|
|
144
132
|
icon: Unpin,
|
|
145
133
|
label: "Unpin Column",
|
|
146
134
|
active: true
|
|
147
|
-
}), isSortable &&
|
|
135
|
+
}), isSortable && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HeaderMenuItem, {
|
|
148
136
|
onClick: handleSortAscending,
|
|
149
137
|
icon: SortAlphabetical,
|
|
150
138
|
label: "Sort ascending",
|
|
151
139
|
active: isSorted === "asc"
|
|
152
|
-
}),
|
|
140
|
+
}), /*#__PURE__*/React.createElement(HeaderMenuItem, {
|
|
153
141
|
onClick: handleSortDescending,
|
|
154
142
|
icon: SortAlphabeticalDesc,
|
|
155
143
|
label: "Sort descending",
|
|
156
144
|
active: isSorted === "desc"
|
|
157
|
-
})), !!isSorted &&
|
|
145
|
+
})), !!isSorted && /*#__PURE__*/React.createElement(HeaderMenuItem, {
|
|
158
146
|
onClick: handleClearAllSorts,
|
|
159
147
|
icon: Remove,
|
|
160
148
|
label: "Clear all sorts"
|
|
161
|
-
}),
|
|
149
|
+
}), /*#__PURE__*/React.createElement(HeaderMenuItem, {
|
|
162
150
|
onClick: handleResetSize,
|
|
163
151
|
icon: VerticalDistribution,
|
|
164
152
|
label: "Reset Column Size"
|
|
165
153
|
}))))));
|
|
166
154
|
}
|
|
167
|
-
|
|
168
|
-
TableHeaderWithPopover
|
|
169
|
-
};
|
|
155
|
+
//# sourceMappingURL=TableHeaderWithPopover.js.map
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
.osdkCenterContainer {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.osdkContentGap {
|
|
24
|
+
display: flex;
|
|
25
|
+
gap: var(--osdk-surface-spacing);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.osdkHeaderContainer {
|
|
29
|
+
justify-content: space-between;
|
|
30
|
+
flex: 1;
|
|
31
|
+
min-width: 0;
|
|
32
|
+
align-self: stretch;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.osdkHeaderContentLeft {
|
|
36
|
+
min-width: 0;
|
|
37
|
+
flex-shrink: 1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.osdkHeaderContentRight {
|
|
41
|
+
flex-shrink: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.osdkHeaderPopoverTrigger {
|
|
45
|
+
padding: 0;
|
|
46
|
+
flex-shrink: 0;
|
|
47
|
+
flex-grow: 0;
|
|
48
|
+
border: var(--osdk-surface-border-width) solid
|
|
49
|
+
var(--osdk-surface-border-color-default);
|
|
50
|
+
border-radius: var(--osdk-surface-border-radius);
|
|
51
|
+
color: var(--osdk-intent-default-foreground);
|
|
52
|
+
user-select: none;
|
|
53
|
+
outline: none;
|
|
54
|
+
|
|
55
|
+
&:hover {
|
|
56
|
+
background-color: var(--osdk-intent-default-hover);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&[data-popup-open] {
|
|
60
|
+
background-color: var(--osdk-intent-primary-rest);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&:focus-visible {
|
|
64
|
+
outline: var(--osdk-focus-visible-outline);
|
|
65
|
+
outline-offset: var(--osdk-focus-visible-outline-offset);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.osdkHeaderIcon {
|
|
70
|
+
width: var(--osdk-iconography-size-small);
|
|
71
|
+
height: var(--osdk-iconography-size-small);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.osdkHeaderPopup {
|
|
75
|
+
box-sizing: border-box;
|
|
76
|
+
padding: var(--osdk-surface-spacing);
|
|
77
|
+
border-radius: var(--osdk-surface-border-radius);
|
|
78
|
+
border: var(--osdk-surface-border-width) solid
|
|
79
|
+
var(--osdk-surface-border-color-default);
|
|
80
|
+
background-color: var(--osdk-surface-background-color-default);
|
|
81
|
+
color: var(--osdk-typography-color-default-rest);
|
|
82
|
+
box-shadow: var(--osdk-surface-shadow-2);
|
|
83
|
+
font-size: var(--osdk-typography-size-body-medium);
|
|
84
|
+
outline: none;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.osdkHeaderMenuItem {
|
|
88
|
+
justify-content: flex-start;
|
|
89
|
+
padding: var(--osdk-surface-spacing);
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.osdkHeaderMenuItem:hover {
|
|
94
|
+
outline: none;
|
|
95
|
+
background-color: var(--osdk-surface-background-color-default-hover);
|
|
96
|
+
border-radius: var(--osdk-surface-border-radius);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.osdkHeaderActiveMenuItem {
|
|
100
|
+
background-color: var(--osdk-intent-primary-rest);
|
|
101
|
+
color: var(--osdk-intent-primary-foreground);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.osdkHeaderActiveMenuItem:hover {
|
|
105
|
+
background-color: var(--osdk-intent-primary-hover);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.osdkHeaderActiveMenuItem:active {
|
|
109
|
+
background-color: var(--osdk-intent-primary-active);
|
|
110
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// CSS Module proxy for TableHeaderWithPopover.module.css
|
|
2
|
+
const styles = {
|
|
3
|
+
"osdkCenterContainer": "TableHeaderWithPopover-module__osdkCenterContainer___7EQ0efaV",
|
|
4
|
+
"osdkContentGap": "TableHeaderWithPopover-module__osdkContentGap___ydRnh6Gk",
|
|
5
|
+
"osdkHeaderContainer": "TableHeaderWithPopover-module__osdkHeaderContainer___Yp1FKb-z",
|
|
6
|
+
"osdkHeaderContentLeft": "TableHeaderWithPopover-module__osdkHeaderContentLeft___PpdFKG5D",
|
|
7
|
+
"osdkHeaderContentRight": "TableHeaderWithPopover-module__osdkHeaderContentRight___-cSZMBVb",
|
|
8
|
+
"osdkHeaderPopoverTrigger": "TableHeaderWithPopover-module__osdkHeaderPopoverTrigger___Y5Q22NIE",
|
|
9
|
+
"osdkHeaderIcon": "TableHeaderWithPopover-module__osdkHeaderIcon___lgyu9GmV",
|
|
10
|
+
"osdkHeaderPopup": "TableHeaderWithPopover-module__osdkHeaderPopup___TMO39wLW",
|
|
11
|
+
"osdkHeaderMenuItem": "TableHeaderWithPopover-module__osdkHeaderMenuItem___f-D5iGwi",
|
|
12
|
+
"osdkHeaderActiveMenuItem": "TableHeaderWithPopover-module__osdkHeaderActiveMenuItem___K007KHkr"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default styles;
|
|
@@ -1,161 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
+
*/
|
|
3
16
|
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import { createPortal } from "react-dom";
|
|
9
|
-
import { useCallback, useState } from "react";
|
|
10
|
-
var css = '/*\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\n.osdkCellContextMenu {\n position: fixed;\n z-index: var(--osdk-surface-z-index-2);\n}\n';
|
|
11
|
-
if (typeof document !== "undefined") {
|
|
12
|
-
const style = document.createElement("style");
|
|
13
|
-
style.textContent = css;
|
|
14
|
-
document.head.appendChild(style);
|
|
15
|
-
}
|
|
16
|
-
var CellContextMenu_default = { "osdkCellContextMenu": "osdkCellContextMenu" };
|
|
17
|
-
function CellContextMenu({
|
|
18
|
-
cell,
|
|
19
|
-
position,
|
|
20
|
-
onClose,
|
|
21
|
-
renderContent
|
|
22
|
-
}) {
|
|
23
|
-
const ref = useRef(null);
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
const handleClickOutside = (event) => {
|
|
26
|
-
if (ref.current && !ref.current.contains(event.target)) {
|
|
27
|
-
onClose();
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
31
|
-
return () => {
|
|
32
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
33
|
-
};
|
|
34
|
-
}, [onClose]);
|
|
35
|
-
return /* @__PURE__ */ createPortal(/* @__PURE__ */ React.createElement("div", {
|
|
36
|
-
ref,
|
|
37
|
-
className: CellContextMenu_default.osdkCellContextMenu,
|
|
38
|
-
style: {
|
|
39
|
-
left: position.left,
|
|
40
|
-
top: position.top,
|
|
41
|
-
minWidth: position.width
|
|
42
|
-
}
|
|
43
|
-
}, renderContent(cell.row.original, cell)), document.body);
|
|
44
|
-
}
|
|
45
|
-
var useCellContextMenu = ({
|
|
46
|
-
tdRef
|
|
47
|
-
}) => {
|
|
48
|
-
const [popoverPosition, setPopoverPosition] = useState(null);
|
|
49
|
-
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false);
|
|
50
|
-
const handleOpenContextMenu = useCallback((event) => {
|
|
51
|
-
event.preventDefault();
|
|
52
|
-
event.stopPropagation();
|
|
53
|
-
if (tdRef.current) {
|
|
54
|
-
const rect = tdRef.current.getBoundingClientRect();
|
|
55
|
-
const position = {
|
|
56
|
-
left: rect.left,
|
|
57
|
-
top: rect.bottom,
|
|
58
|
-
width: rect.width
|
|
59
|
-
};
|
|
60
|
-
setPopoverPosition(position);
|
|
61
|
-
setIsContextMenuOpen(true);
|
|
62
|
-
}
|
|
63
|
-
}, [tdRef]);
|
|
64
|
-
const handleCloseContextMenu = useCallback(() => {
|
|
65
|
-
setIsContextMenuOpen(false);
|
|
66
|
-
setPopoverPosition(null);
|
|
67
|
-
}, []);
|
|
68
|
-
return {
|
|
69
|
-
isContextMenuOpen,
|
|
70
|
-
handleOpenContextMenu,
|
|
71
|
-
handleCloseContextMenu,
|
|
72
|
-
popoverPosition
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
var css2 = '/*\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\n.osdkTableCell {\n display: flex;\n align-items: center;\n text-align: left;\n position: relative;\n padding: var(--osdk-table-cell-padding);\n font-size: var(--osdk-table-cell-fontSize);\n color: var(--osdk-table-cell-color);\n background-color: inherit;\n border-right: var(--osdk-table-cell-divider);\n\n &:first-child {\n border-left: var(--osdk-table-border);\n }\n\n &:last-child {\n border-right: var(--osdk-table-border);\n }\n}\n\n.osdkTableCell[data-pinned="left"],\n.osdkTableCell[data-pinned="right"] {\n position: sticky;\n z-index: var(--osdk-surface-z-index-1);\n}\n\n/* Last left-pinned column - no left-pinned siblings after it */\n.osdkTableCell[data-pinned="left"]:not(:has(~ [data-pinned="left"])) {\n border-right: var(--osdk-table-pinned-column-border);\n}\n\n/* First right-pinned column - no right-pinned siblings before it */\n.osdkTableCell[data-pinned="right"]:not(:has(~ [data-pinned="right"]):nth-child(n+2)) {\n border-left: var(--osdk-table-pinned-column-border);\n}\n\n.osdkTableCell:has([role="checkbox"]) {\n justify-content: center;\n}\n\n.osdkTableCellContent:not(:has([role="checkbox"])) {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n text-align: left;\n}\n';
|
|
76
|
-
if (typeof document !== "undefined") {
|
|
77
|
-
const style = document.createElement("style");
|
|
78
|
-
style.textContent = css2;
|
|
79
|
-
document.head.appendChild(style);
|
|
80
|
-
}
|
|
81
|
-
var TableCell_default = { "osdkTableCell": "osdkTableCell", "osdkTableCellContent": "osdkTableCellContent" };
|
|
82
|
-
var SELECTION_COLUMN_ID = "__selection__";
|
|
83
|
-
function getColumnPinningStyles(column) {
|
|
84
|
-
const isPinned = column.getIsPinned();
|
|
85
|
-
return {
|
|
86
|
-
columnStyles: {
|
|
87
|
-
left: isPinned === "left" ? `${column.getStart("left")}px` : void 0,
|
|
88
|
-
right: isPinned === "right" ? `${column.getAfter("right")}px` : void 0,
|
|
89
|
-
width: column.getSize()
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
function TableCell({
|
|
94
|
-
cell,
|
|
95
|
-
renderCellContextMenu
|
|
96
|
-
}) {
|
|
97
|
-
const tdRef = useRef2(null);
|
|
98
|
-
const isSelectColumn = cell.column.id === SELECTION_COLUMN_ID;
|
|
99
|
-
const {
|
|
100
|
-
isContextMenuOpen,
|
|
101
|
-
handleOpenContextMenu,
|
|
102
|
-
handleCloseContextMenu,
|
|
103
|
-
popoverPosition
|
|
104
|
-
} = useCellContextMenu({
|
|
105
|
-
tdRef
|
|
106
|
-
});
|
|
107
|
-
const {
|
|
108
|
-
columnStyles
|
|
109
|
-
} = getColumnPinningStyles(cell.column);
|
|
110
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("td", {
|
|
111
|
-
ref: tdRef,
|
|
112
|
-
"data-pinned": cell.column.getIsPinned(),
|
|
113
|
-
className: TableCell_default.osdkTableCell,
|
|
114
|
-
style: columnStyles,
|
|
115
|
-
onContextMenu: handleOpenContextMenu
|
|
116
|
-
}, /* @__PURE__ */ React2.createElement("div", {
|
|
117
|
-
className: TableCell_default.osdkTableCellContent
|
|
118
|
-
}, flexRender(cell.column.columnDef.cell, cell.getContext()))), !isSelectColumn && isContextMenuOpen && !!popoverPosition && !!renderCellContextMenu && /* @__PURE__ */ React2.createElement(CellContextMenu, {
|
|
119
|
-
cell,
|
|
120
|
-
position: popoverPosition,
|
|
121
|
-
onClose: handleCloseContextMenu,
|
|
122
|
-
renderContent: renderCellContextMenu
|
|
123
|
-
}));
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// build/browser/object-table/TableRow.module.css
|
|
127
|
-
var css3 = '/*\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\n.osdkTableRow {\n position: absolute;\n display: flex;\n background-color: var(--osdk-table-row-bg-default);\n border-top: var(--osdk-table-row-divider);\n border-bottom: var(--osdk-table-border-width) solid transparent;\n\n &:last-child {\n border-bottom: var(--osdk-table-border);\n }\n\n /* Zebra rows */\n &:nth-child(even) {\n background-color: var(\n --osdk-table-row-bg-alternate,\n var(--osdk-table-row-bg-default)\n );\n }\n\n &:hover {\n z-index: 1;\n background-color: var(\n --osdk-table-row-bg-hover,\n var(--osdk-surface-background-color-default-hover)\n );\n border-top-color: var(--osdk-table-row-border-color-hover);\n border-bottom-color: var(--osdk-table-row-border-color-hover);\n }\n\n &[data-selected="true"] {\n z-index: 2;\n background-color: var(--osdk-table-row-bg-active);\n border-top-color: var(--osdk-table-row-border-color-active);\n border-bottom-color: var(--osdk-table-row-border-color-active);\n }\n\n &[data-selected="true"] + &[data-selected="true"] {\n border-top-color: transparent;\n }\n\n &[data-selected="true"]:has(+ &[data-selected="true"]) {\n border-bottom-color: transparent;\n }\n}\n';
|
|
128
|
-
if (typeof document !== "undefined") {
|
|
129
|
-
const style = document.createElement("style");
|
|
130
|
-
style.textContent = css3;
|
|
131
|
-
document.head.appendChild(style);
|
|
132
|
-
}
|
|
133
|
-
var TableRow_default = { "osdkTableRow": "osdkTableRow" };
|
|
134
|
-
|
|
135
|
-
// build/browser/object-table/TableRow.js
|
|
136
|
-
function TableRow({
|
|
17
|
+
import React, { useCallback } from "react";
|
|
18
|
+
import { TableCell } from "./TableCell.js";
|
|
19
|
+
import styles from "./TableRow.module.css.js";
|
|
20
|
+
export function TableRow({
|
|
137
21
|
row,
|
|
138
22
|
virtualRow,
|
|
139
23
|
onRowClick,
|
|
140
24
|
renderCellContextMenu
|
|
141
25
|
}) {
|
|
142
|
-
const handleClick =
|
|
26
|
+
const handleClick = useCallback(() => {
|
|
143
27
|
onRowClick?.(row.original);
|
|
144
28
|
}, [onRowClick, row.original]);
|
|
145
|
-
return
|
|
29
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
146
30
|
"data-selected": row.getIsSelected(),
|
|
147
|
-
className:
|
|
31
|
+
className: styles.osdkTableRow,
|
|
148
32
|
style: {
|
|
149
33
|
height: `${virtualRow.size}px`,
|
|
150
34
|
transform: `translateY(${virtualRow.start}px)`
|
|
151
35
|
},
|
|
152
36
|
onClick: handleClick
|
|
153
|
-
}, row.getVisibleCells().map(
|
|
37
|
+
}, row.getVisibleCells().map(cell => /*#__PURE__*/React.createElement(TableCell, {
|
|
154
38
|
key: cell.id,
|
|
155
|
-
cell,
|
|
156
|
-
renderCellContextMenu
|
|
39
|
+
cell: cell,
|
|
40
|
+
renderCellContextMenu: renderCellContextMenu
|
|
157
41
|
})));
|
|
158
42
|
}
|
|
159
|
-
|
|
160
|
-
TableRow
|
|
161
|
-
};
|
|
43
|
+
//# sourceMappingURL=TableRow.js.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
.osdkTableRow {
|
|
18
|
+
position: absolute;
|
|
19
|
+
display: flex;
|
|
20
|
+
background-color: var(--osdk-table-row-bg-default);
|
|
21
|
+
border-top: var(--osdk-table-row-divider);
|
|
22
|
+
border-bottom: var(--osdk-table-border-width) solid transparent;
|
|
23
|
+
|
|
24
|
+
&:last-child {
|
|
25
|
+
border-bottom: var(--osdk-table-border);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Zebra rows */
|
|
29
|
+
&:nth-child(even) {
|
|
30
|
+
background-color: var(
|
|
31
|
+
--osdk-table-row-bg-alternate,
|
|
32
|
+
var(--osdk-table-row-bg-default)
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:hover {
|
|
37
|
+
z-index: 1;
|
|
38
|
+
background-color: var(
|
|
39
|
+
--osdk-table-row-bg-hover,
|
|
40
|
+
var(--osdk-surface-background-color-default-hover)
|
|
41
|
+
);
|
|
42
|
+
border-top-color: var(--osdk-table-row-border-color-hover);
|
|
43
|
+
border-bottom-color: var(--osdk-table-row-border-color-hover);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&[data-selected="true"] {
|
|
47
|
+
z-index: 2;
|
|
48
|
+
background-color: var(--osdk-table-row-bg-active);
|
|
49
|
+
border-top-color: var(--osdk-table-row-border-color-active);
|
|
50
|
+
border-bottom-color: var(--osdk-table-row-border-color-active);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&[data-selected="true"] + &[data-selected="true"] {
|
|
54
|
+
border-top-color: transparent;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&[data-selected="true"]:has(+ &[data-selected="true"]) {
|
|
58
|
+
border-bottom-color: transparent;
|
|
59
|
+
}
|
|
60
|
+
}
|