@hitachivantara/uikit-react-pentaho 6.0.13 → 6.0.14
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/dist/Canvas/BottomPanel/BottomPanel.js +116 -179
- package/dist/Canvas/BottomPanel/BottomPanel.styles.js +43 -55
- package/dist/Canvas/CanvasContext.js +39 -43
- package/dist/Canvas/PanelTab/PanelTab.js +31 -39
- package/dist/Canvas/PanelTab/PanelTab.styles.js +39 -46
- package/dist/Canvas/PanelTabs/PanelTabs.js +22 -27
- package/dist/Canvas/PanelTabs/PanelTabs.styles.js +11 -15
- package/dist/Canvas/SidePanel/SidePanel.js +102 -148
- package/dist/Canvas/SidePanel/SidePanel.styles.js +55 -73
- package/dist/Canvas/SidePanel/useResizable.js +67 -66
- package/dist/Canvas/Toolbar/Toolbar.js +51 -58
- package/dist/Canvas/Toolbar/Toolbar.styles.js +37 -38
- package/dist/Canvas/ToolbarTabs/ToolbarTabEditor.js +126 -151
- package/dist/Canvas/ToolbarTabs/ToolbarTabs.js +174 -228
- package/dist/Canvas/ToolbarTabs/ToolbarTabs.styles.js +98 -129
- package/dist/index.js +8 -24
- package/package.json +5 -5
|
@@ -1,183 +1,120 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useCanvasContext } from "../CanvasContext.js";
|
|
2
|
+
import { HvCanvasPanelTab } from "../PanelTab/PanelTab.js";
|
|
3
|
+
import { HvCanvasPanelTabs } from "../PanelTabs/PanelTabs.js";
|
|
4
|
+
import { staticClasses, useClasses } from "./BottomPanel.styles.js";
|
|
2
5
|
import { forwardRef, useRef, useState } from "react";
|
|
3
6
|
import { useResizeDetector } from "react-resize-detector";
|
|
4
|
-
import {
|
|
7
|
+
import { HvActionsGeneric, HvPanel, theme, useControlled, useDefaultProps, useUniqueId } from "@hitachivantara/uikit-react-core";
|
|
5
8
|
import { mergeStyles } from "@hitachivantara/uikit-react-utils";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
[classes.closed]: !open,
|
|
116
|
-
[classes.minimized]: minimize,
|
|
117
|
-
[classes.multipleTabs]: tabs.length > 1,
|
|
118
|
-
[classes.overflowing]: overflowing
|
|
119
|
-
},
|
|
120
|
-
className
|
|
121
|
-
),
|
|
122
|
-
style: {
|
|
123
|
-
width: `calc(100% - ${sidePanelWidth}px - 2 * ${theme.space.sm})`,
|
|
124
|
-
right: theme.space.sm,
|
|
125
|
-
transition: canvasContext?.sidePanelDragging ? "height 0.3s ease, opacity 0.3s ease" : "width 0.3s ease"
|
|
126
|
-
},
|
|
127
|
-
...others,
|
|
128
|
-
children: [
|
|
129
|
-
/* @__PURE__ */ jsx(
|
|
130
|
-
HvCanvasPanelTabs,
|
|
131
|
-
{
|
|
132
|
-
onChange: handleTabChange,
|
|
133
|
-
value: selectedTab,
|
|
134
|
-
className: classes.tabsRoot,
|
|
135
|
-
children: tabs.map((tab, index) => /* @__PURE__ */ jsx(
|
|
136
|
-
HvCanvasPanelTab,
|
|
137
|
-
{
|
|
138
|
-
ref: index === 0 ? tabRef : void 0,
|
|
139
|
-
id: `${id}-${tab.id}`,
|
|
140
|
-
value: tab.id,
|
|
141
|
-
className: classes.tab,
|
|
142
|
-
startActions: leftActions && !overflowing && /* @__PURE__ */ jsx(
|
|
143
|
-
HvActionsGeneric,
|
|
144
|
-
{
|
|
145
|
-
maxVisibleActions: 1,
|
|
146
|
-
actions: leftActions,
|
|
147
|
-
disabled: selectedTab !== tab.id && !minimize,
|
|
148
|
-
className: cx(classes.leftActions, {
|
|
149
|
-
[classes.actionsDisabled]: selectedTab !== tab.id && !minimize
|
|
150
|
-
}),
|
|
151
|
-
onAction: (event, action) => onAction?.(event, action, tab.id),
|
|
152
|
-
variant: "secondaryGhost",
|
|
153
|
-
iconOnly: true
|
|
154
|
-
}
|
|
155
|
-
),
|
|
156
|
-
endActions: renderEndActions(tab),
|
|
157
|
-
children: typeof tab.title === "function" ? tab.title(overflowing) : tab.title
|
|
158
|
-
},
|
|
159
|
-
tab.id
|
|
160
|
-
))
|
|
161
|
-
}
|
|
162
|
-
),
|
|
163
|
-
/* @__PURE__ */ jsx(
|
|
164
|
-
HvPanel,
|
|
165
|
-
{
|
|
166
|
-
ref: panelRef,
|
|
167
|
-
role: "tabpanel",
|
|
168
|
-
"aria-labelledby": `${id}-${selectedTab}`,
|
|
169
|
-
className: classes.content,
|
|
170
|
-
style: mergeStyles(void 0, {
|
|
171
|
-
"--right-border-radius": isTabsFullWidth ? 0 : `${PANEL_RADIUS}px`
|
|
172
|
-
}),
|
|
173
|
-
children
|
|
174
|
-
}
|
|
175
|
-
)
|
|
176
|
-
]
|
|
177
|
-
}
|
|
178
|
-
);
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/Canvas/BottomPanel/BottomPanel.tsx
|
|
11
|
+
var PANEL_RADIUS = 16;
|
|
12
|
+
/**
|
|
13
|
+
* A bottom panel component to use in a canvas context.
|
|
14
|
+
*/
|
|
15
|
+
var HvCanvasBottomPanel = forwardRef(function HvCanvasBottomPanel(props, ref) {
|
|
16
|
+
const { id: idProp, className, children, open, tabs, minimize, leftActions, rightActions, overflowActions, selectedTabId: selectedTabIdProp, classes: classesProp, onTabChange, onAction, ...others } = useDefaultProps("HvCanvasBottomPanel", props);
|
|
17
|
+
const { classes, cx } = useClasses(classesProp);
|
|
18
|
+
const canvasContext = useCanvasContext();
|
|
19
|
+
const sidePanelWidth = canvasContext?.sidePanelWidth ?? 0;
|
|
20
|
+
const id = useUniqueId(idProp);
|
|
21
|
+
const buttonsWidthRef = useRef(0);
|
|
22
|
+
const [isTabsFullWidth, setIsTabsFullWidth] = useState(false);
|
|
23
|
+
const [overflowing, setOverflowing] = useState(false);
|
|
24
|
+
const { ref: tabRef } = useResizeDetector({
|
|
25
|
+
handleHeight: false,
|
|
26
|
+
disableRerender: true,
|
|
27
|
+
onResize({ width, entry }) {
|
|
28
|
+
if (!overflowing && !buttonsWidthRef.current) {
|
|
29
|
+
const tabContainer = entry?.target;
|
|
30
|
+
buttonsWidthRef.current = (tabContainer?.querySelector(`.${staticClasses.leftActions}`)?.clientWidth ?? 0) + (tabContainer?.querySelector(`.${staticClasses.rightActions}`)?.clientWidth ?? 0);
|
|
31
|
+
}
|
|
32
|
+
setOverflowing(!((width || 0) - buttonsWidthRef.current > 60));
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const { ref: panelRef } = useResizeDetector({
|
|
36
|
+
handleHeight: false,
|
|
37
|
+
disableRerender: true,
|
|
38
|
+
onResize({ entry }) {
|
|
39
|
+
const panelEl = entry?.target;
|
|
40
|
+
if (!panelEl) return;
|
|
41
|
+
const panelWidth = panelEl.clientWidth;
|
|
42
|
+
const tabWidth = (panelEl.previousElementSibling?.firstElementChild?.firstElementChild)?.clientWidth || 0;
|
|
43
|
+
setIsTabsFullWidth(tabs.length * tabWidth + PANEL_RADIUS >= panelWidth);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const [selectedTab, setSelectedTab] = useControlled(selectedTabIdProp, tabs[0].id);
|
|
47
|
+
const handleTabChange = (event, tabId) => {
|
|
48
|
+
setSelectedTab(tabId);
|
|
49
|
+
onTabChange?.(event, tabId);
|
|
50
|
+
};
|
|
51
|
+
const renderEndActions = (tab) => {
|
|
52
|
+
const btnsDisabled = selectedTab !== tab.id && !minimize;
|
|
53
|
+
if (rightActions && !overflowing) return /* @__PURE__ */ jsx(HvActionsGeneric, {
|
|
54
|
+
maxVisibleActions: 2,
|
|
55
|
+
actions: rightActions,
|
|
56
|
+
disabled: btnsDisabled,
|
|
57
|
+
className: cx(classes.rightActions, { [classes.actionsDisabled]: btnsDisabled }),
|
|
58
|
+
onAction: (event, action) => onAction?.(event, action, tab.id),
|
|
59
|
+
variant: "secondaryGhost",
|
|
60
|
+
iconOnly: true
|
|
61
|
+
});
|
|
62
|
+
if (overflowActions && overflowing) return /* @__PURE__ */ jsx(HvActionsGeneric, {
|
|
63
|
+
maxVisibleActions: 0,
|
|
64
|
+
actions: overflowActions,
|
|
65
|
+
disabled: btnsDisabled,
|
|
66
|
+
className: cx(classes.rightActions, { [classes.actionsDisabled]: btnsDisabled }),
|
|
67
|
+
onAction: (event, action) => onAction?.(event, action, tab.id),
|
|
68
|
+
variant: "secondaryGhost",
|
|
69
|
+
iconOnly: true
|
|
70
|
+
});
|
|
71
|
+
return null;
|
|
72
|
+
};
|
|
73
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
74
|
+
id,
|
|
75
|
+
ref,
|
|
76
|
+
className: cx(classes.root, {
|
|
77
|
+
[classes.closed]: !open,
|
|
78
|
+
[classes.minimized]: minimize,
|
|
79
|
+
[classes.multipleTabs]: tabs.length > 1,
|
|
80
|
+
[classes.overflowing]: overflowing
|
|
81
|
+
}, className),
|
|
82
|
+
style: {
|
|
83
|
+
width: `calc(100% - ${sidePanelWidth}px - 2 * ${theme.space.sm})`,
|
|
84
|
+
right: theme.space.sm,
|
|
85
|
+
transition: canvasContext?.sidePanelDragging ? "height 0.3s ease, opacity 0.3s ease" : "width 0.3s ease"
|
|
86
|
+
},
|
|
87
|
+
...others,
|
|
88
|
+
children: [/* @__PURE__ */ jsx(HvCanvasPanelTabs, {
|
|
89
|
+
onChange: handleTabChange,
|
|
90
|
+
value: selectedTab,
|
|
91
|
+
className: classes.tabsRoot,
|
|
92
|
+
children: tabs.map((tab, index) => /* @__PURE__ */ jsx(HvCanvasPanelTab, {
|
|
93
|
+
ref: index === 0 ? tabRef : void 0,
|
|
94
|
+
id: `${id}-${tab.id}`,
|
|
95
|
+
value: tab.id,
|
|
96
|
+
className: classes.tab,
|
|
97
|
+
startActions: leftActions && !overflowing && /* @__PURE__ */ jsx(HvActionsGeneric, {
|
|
98
|
+
maxVisibleActions: 1,
|
|
99
|
+
actions: leftActions,
|
|
100
|
+
disabled: selectedTab !== tab.id && !minimize,
|
|
101
|
+
className: cx(classes.leftActions, { [classes.actionsDisabled]: selectedTab !== tab.id && !minimize }),
|
|
102
|
+
onAction: (event, action) => onAction?.(event, action, tab.id),
|
|
103
|
+
variant: "secondaryGhost",
|
|
104
|
+
iconOnly: true
|
|
105
|
+
}),
|
|
106
|
+
endActions: renderEndActions(tab),
|
|
107
|
+
children: typeof tab.title === "function" ? tab.title(overflowing) : tab.title
|
|
108
|
+
}, tab.id))
|
|
109
|
+
}), /* @__PURE__ */ jsx(HvPanel, {
|
|
110
|
+
ref: panelRef,
|
|
111
|
+
role: "tabpanel",
|
|
112
|
+
"aria-labelledby": `${id}-${selectedTab}`,
|
|
113
|
+
className: classes.content,
|
|
114
|
+
style: mergeStyles(void 0, { "--right-border-radius": isTabsFullWidth ? 0 : `${PANEL_RADIUS}px` }),
|
|
115
|
+
children
|
|
116
|
+
})]
|
|
117
|
+
});
|
|
179
118
|
});
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
staticClasses as canvasBottomPanelClasses
|
|
183
|
-
};
|
|
119
|
+
//#endregion
|
|
120
|
+
export { HvCanvasBottomPanel };
|
|
@@ -1,56 +1,44 @@
|
|
|
1
1
|
import { createClasses, theme } from "@hitachivantara/uikit-react-core";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
backgroundColor: "transparent",
|
|
46
|
-
borderColor: "transparent"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
content: { borderTopRightRadius: "var(--right-border-radius)" }
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
export {
|
|
54
|
-
staticClasses,
|
|
55
|
-
useClasses
|
|
56
|
-
};
|
|
2
|
+
//#region src/Canvas/BottomPanel/BottomPanel.styles.tsx
|
|
3
|
+
var { staticClasses, useClasses } = createClasses("HvCanvasBottomPanel", {
|
|
4
|
+
root: {
|
|
5
|
+
position: "absolute",
|
|
6
|
+
display: "flex",
|
|
7
|
+
flexDirection: "column",
|
|
8
|
+
right: 0,
|
|
9
|
+
bottom: 0,
|
|
10
|
+
width: "100%",
|
|
11
|
+
maxHeight: "500px",
|
|
12
|
+
visibility: "visible"
|
|
13
|
+
},
|
|
14
|
+
closed: {
|
|
15
|
+
maxHeight: 0,
|
|
16
|
+
visibility: "hidden"
|
|
17
|
+
},
|
|
18
|
+
minimized: {
|
|
19
|
+
"& $content": { display: "none" },
|
|
20
|
+
"& $tab": {
|
|
21
|
+
backgroundColor: theme.colors.bgContainer,
|
|
22
|
+
...theme.typography.label
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
multipleTabs: { "& $tab": { maxWidth: "288px" } },
|
|
26
|
+
overflowing: {},
|
|
27
|
+
tab: { padding: theme.space.xs },
|
|
28
|
+
tabsRoot: { position: "relative" },
|
|
29
|
+
leftActions: {},
|
|
30
|
+
rightActions: {},
|
|
31
|
+
actionsDisabled: {
|
|
32
|
+
pointerEvents: "none",
|
|
33
|
+
"&&& button": {
|
|
34
|
+
pointerEvents: "none",
|
|
35
|
+
"&,&:hover": {
|
|
36
|
+
backgroundColor: "transparent",
|
|
37
|
+
borderColor: "transparent"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
content: { borderTopRightRadius: "var(--right-border-radius)" }
|
|
42
|
+
});
|
|
43
|
+
//#endregion
|
|
44
|
+
export { staticClasses, useClasses };
|
|
@@ -1,46 +1,42 @@
|
|
|
1
|
+
import { createContext, useCallback, useContext, useMemo, useState } from "react";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
);
|
|
37
|
-
return /* @__PURE__ */ jsx(HvCanvasContext.Provider, { value, children });
|
|
3
|
+
//#region src/Canvas/CanvasContext.tsx
|
|
4
|
+
var HvCanvasContext = createContext(null);
|
|
5
|
+
var HvCanvasProvider = ({ children }) => {
|
|
6
|
+
const [sidePanelOpen, setSidePanelOpen] = useState(false);
|
|
7
|
+
const [width, setWidth] = useState(0);
|
|
8
|
+
const [sidePanelDragging, setSidePanelDragging] = useState(false);
|
|
9
|
+
const handleSidePanelWidth = useCallback((newWidth) => {
|
|
10
|
+
setWidth(newWidth);
|
|
11
|
+
}, []);
|
|
12
|
+
const handleSidePanelOpen = useCallback((open) => {
|
|
13
|
+
setSidePanelOpen(open);
|
|
14
|
+
}, []);
|
|
15
|
+
const handleSidePanelDragging = useCallback((dragging) => {
|
|
16
|
+
setSidePanelDragging(dragging);
|
|
17
|
+
}, []);
|
|
18
|
+
const value = useMemo(() => ({
|
|
19
|
+
sidePanelOpen,
|
|
20
|
+
handleSidePanelOpen,
|
|
21
|
+
sidePanelWidth: sidePanelOpen ? width : 0,
|
|
22
|
+
handleSidePanelWidth,
|
|
23
|
+
sidePanelDragging,
|
|
24
|
+
handleSidePanelDragging
|
|
25
|
+
}), [
|
|
26
|
+
sidePanelOpen,
|
|
27
|
+
handleSidePanelOpen,
|
|
28
|
+
width,
|
|
29
|
+
handleSidePanelWidth,
|
|
30
|
+
sidePanelDragging,
|
|
31
|
+
handleSidePanelDragging
|
|
32
|
+
]);
|
|
33
|
+
return /* @__PURE__ */ jsx(HvCanvasContext.Provider, {
|
|
34
|
+
value,
|
|
35
|
+
children
|
|
36
|
+
});
|
|
38
37
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
export {
|
|
43
|
-
HvCanvasContext,
|
|
44
|
-
HvCanvasProvider,
|
|
45
|
-
useCanvasContext
|
|
38
|
+
var useCanvasContext = () => {
|
|
39
|
+
return useContext(HvCanvasContext);
|
|
46
40
|
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { HvCanvasContext, HvCanvasProvider, useCanvasContext };
|
|
@@ -1,42 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useClasses } from "./PanelTab.styles.js";
|
|
2
2
|
import { forwardRef, useRef } from "react";
|
|
3
|
-
import { Tab } from "@mui/base";
|
|
4
3
|
import { useDefaultProps } from "@hitachivantara/uikit-react-core";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
endActions
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
)
|
|
37
|
-
);
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Tab } from "@mui/base";
|
|
6
|
+
//#region src/Canvas/PanelTab/PanelTab.tsx
|
|
7
|
+
/**
|
|
8
|
+
* The tab component to use inside `HvCanvasPanelTabs`.
|
|
9
|
+
*/
|
|
10
|
+
var HvCanvasPanelTab = forwardRef(function HvCanvasPanelTab(props, ref) {
|
|
11
|
+
const { classes: classesProp, className, style, startActions, endActions, ...others } = useDefaultProps("HvCanvasPanelTab", props);
|
|
12
|
+
const tabRef = useRef(null);
|
|
13
|
+
const { classes, cx } = useClasses(classesProp);
|
|
14
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
15
|
+
ref,
|
|
16
|
+
style,
|
|
17
|
+
className: cx(classes.root, className),
|
|
18
|
+
onClick: (evt) => {
|
|
19
|
+
if (evt.target === tabRef.current) return;
|
|
20
|
+
tabRef.current?.click();
|
|
21
|
+
},
|
|
22
|
+
children: [
|
|
23
|
+
startActions,
|
|
24
|
+
/* @__PURE__ */ jsx(Tab, {
|
|
25
|
+
ref: tabRef,
|
|
26
|
+
className: classes.tab,
|
|
27
|
+
...others
|
|
28
|
+
}),
|
|
29
|
+
endActions
|
|
30
|
+
]
|
|
31
|
+
});
|
|
38
32
|
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
staticClasses as canvasPanelTabClasses
|
|
42
|
-
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { HvCanvasPanelTab };
|
|
@@ -1,48 +1,41 @@
|
|
|
1
|
+
import { createClasses, outlineStyles, theme } from "@hitachivantara/uikit-react-core";
|
|
1
2
|
import { tabClasses } from "@mui/base";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
paddingInlineStart: 0,
|
|
39
|
-
[`&.${tabClasses.selected}`]: {
|
|
40
|
-
color: theme.colors.text,
|
|
41
|
-
fontWeight: theme.fontWeights.semibold
|
|
42
|
-
}
|
|
43
|
-
}
|
|
3
|
+
//#region src/Canvas/PanelTab/PanelTab.styles.tsx
|
|
4
|
+
var { staticClasses, useClasses } = createClasses("HvCanvasPanelTab", {
|
|
5
|
+
root: {
|
|
6
|
+
height: "100%",
|
|
7
|
+
display: "flex",
|
|
8
|
+
position: "relative",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
justifyContent: "center",
|
|
11
|
+
borderRadius: `${theme.radii.large} ${theme.radii.large} 0 0`,
|
|
12
|
+
backgroundColor: theme.colors.bgPage,
|
|
13
|
+
overflow: "hidden",
|
|
14
|
+
width: "100%",
|
|
15
|
+
boxShadow: "0px -2px 8px 0px #4141410F",
|
|
16
|
+
color: theme.colors.textDisabled,
|
|
17
|
+
"&:hover": { cursor: "pointer" },
|
|
18
|
+
"&:has(:focus)": { backgroundColor: theme.colors.bgContainer },
|
|
19
|
+
[`:has(.${tabClasses.selected})`]: {
|
|
20
|
+
color: theme.colors.text,
|
|
21
|
+
backgroundColor: theme.colors.bgContainer
|
|
22
|
+
},
|
|
23
|
+
"&:has(:focus-visible)": { ...outlineStyles }
|
|
24
|
+
},
|
|
25
|
+
tab: {
|
|
26
|
+
appearance: "none",
|
|
27
|
+
color: theme.colors.textSubtle,
|
|
28
|
+
backgroundColor: "inherit",
|
|
29
|
+
cursor: "inherit",
|
|
30
|
+
textAlign: "initial",
|
|
31
|
+
flex: 1,
|
|
32
|
+
paddingInlineEnd: 0,
|
|
33
|
+
paddingInlineStart: 0,
|
|
34
|
+
[`&.${tabClasses.selected}`]: {
|
|
35
|
+
color: theme.colors.text,
|
|
36
|
+
fontWeight: theme.fontWeights.semibold
|
|
37
|
+
}
|
|
38
|
+
}
|
|
44
39
|
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
useClasses
|
|
48
|
-
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { staticClasses, useClasses };
|