@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,232 +1,178 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { HvCanvasPanelTab } from "../PanelTab/PanelTab.js";
|
|
2
|
+
import { HvCanvasPanelTabs } from "../PanelTabs/PanelTabs.js";
|
|
3
|
+
import { ToolbarTabEditor } from "./ToolbarTabEditor.js";
|
|
4
|
+
import { useClasses } from "./ToolbarTabs.styles.js";
|
|
5
|
+
import { forwardRef, useMemo, useState } from "react";
|
|
3
6
|
import { useResizeDetector } from "react-resize-detector";
|
|
4
|
-
import {
|
|
5
|
-
import { CloseXS, MoreOptionsHorizontal, AddAlt } from "@hitachivantara/uikit-react-icons";
|
|
7
|
+
import { HvButton, HvDropDownMenu, HvOverflowTooltip, isKey, uniqueId, useControlled, useDefaultProps, useForkRef, useLabels } from "@hitachivantara/uikit-react-core";
|
|
6
8
|
import { clamp } from "@hitachivantara/uikit-react-utils";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
undefined: "Undefined",
|
|
15
|
-
dropdownMenu: "Dropdown menu"
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { AddAlt, CloseXS, MoreOptionsHorizontal } from "@hitachivantara/uikit-react-icons";
|
|
11
|
+
//#region src/Canvas/ToolbarTabs/ToolbarTabs.tsx
|
|
12
|
+
var DEFAULT_LABELS = {
|
|
13
|
+
create: "Create new",
|
|
14
|
+
undefined: "Undefined",
|
|
15
|
+
dropdownMenu: "Dropdown menu"
|
|
16
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
onChange: (event, value) => handleEdit(event, value, tab.id),
|
|
177
|
-
onBlur: (event, value) => handleEdit(event, value, tab.id),
|
|
178
|
-
onKeyDown: (e) => e.stopPropagation()
|
|
179
|
-
}
|
|
180
|
-
),
|
|
181
|
-
removable && /* @__PURE__ */ jsx("div", { className: classes.closeIconContainer, children: /* @__PURE__ */ jsx(
|
|
182
|
-
CloseXS,
|
|
183
|
-
{
|
|
184
|
-
"aria-hidden": true,
|
|
185
|
-
size: "xs",
|
|
186
|
-
onClick: (event) => {
|
|
187
|
-
handleDeleteTab(event, tab.id);
|
|
188
|
-
event.stopPropagation();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
) }),
|
|
192
|
-
selectedTab !== tab.id && visibleTabs[index + 1]?.id !== selectedTab && /* @__PURE__ */ jsx("div", { className: classes.tabDivider })
|
|
193
|
-
]
|
|
194
|
-
},
|
|
195
|
-
tab.id
|
|
196
|
-
);
|
|
197
|
-
})
|
|
198
|
-
}
|
|
199
|
-
),
|
|
200
|
-
hiddenTabs.length > 0 && /* @__PURE__ */ jsx("div", { className: classes.dropdownMenuContainer, children: /* @__PURE__ */ jsx(
|
|
201
|
-
HvDropDownMenu,
|
|
202
|
-
{
|
|
203
|
-
classes: {
|
|
204
|
-
menuListRoot: classes.dropdownMenuListRoot
|
|
205
|
-
},
|
|
206
|
-
dataList: hiddenTabs,
|
|
207
|
-
icon: /* @__PURE__ */ jsx(MoreOptionsHorizontal, {}),
|
|
208
|
-
labels: { dropdownMenu: labels.dropdownMenu },
|
|
209
|
-
onClick: (event, value) => handleChangeSelectedTab(event, value.id ?? "none")
|
|
210
|
-
}
|
|
211
|
-
) })
|
|
212
|
-
] }),
|
|
213
|
-
/* @__PURE__ */ jsxs("div", { ref: actionsRef, className: classes.actionsContainer, children: [
|
|
214
|
-
children,
|
|
215
|
-
!hideCreateNew && /* @__PURE__ */ jsx(
|
|
216
|
-
HvButton,
|
|
217
|
-
{
|
|
218
|
-
variant: "primaryGhost",
|
|
219
|
-
startIcon: /* @__PURE__ */ jsx(AddAlt, {}),
|
|
220
|
-
onClick: handleCreateNew,
|
|
221
|
-
children: labels.create
|
|
222
|
-
}
|
|
223
|
-
)
|
|
224
|
-
] })
|
|
225
|
-
]
|
|
226
|
-
}
|
|
227
|
-
);
|
|
17
|
+
/**
|
|
18
|
+
* A toolbar tabs component to use in a canvas context.
|
|
19
|
+
*/
|
|
20
|
+
var HvCanvasToolbarTabs = forwardRef(function HvCanvasToolbarTabs(props, ref) {
|
|
21
|
+
const { children, className, selectedTabId: selectedTabIdProp, icon: iconProp, disableTabEdit = false, hideCreateNew = false, tabs: tabsProp, defaultTabs: defaultTabsProp = [], labels: labelsProp, classes: classesProp, onTabChange: onTabChangeProp, onChange: onChangeProp, ...others } = useDefaultProps("HvCanvasToolbarTabs", props);
|
|
22
|
+
const { classes, cx } = useClasses(classesProp);
|
|
23
|
+
const labels = useLabels(DEFAULT_LABELS, labelsProp);
|
|
24
|
+
const { width: actionsWidth = 0, ref: actionsRef } = useResizeDetector({ handleHeight: false });
|
|
25
|
+
const { width: rootWidth = 0, ref: rootRef } = useResizeDetector({ handleHeight: false });
|
|
26
|
+
const [tabs, setTabs] = useControlled(tabsProp, defaultTabsProp);
|
|
27
|
+
const [selectedTab, setSelectedTab] = useControlled(selectedTabIdProp, tabs?.[0]?.id ?? "none");
|
|
28
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
29
|
+
const rootForkedRef = useForkRef(ref, rootRef);
|
|
30
|
+
const handleChangeTabs = (event, newTabs) => {
|
|
31
|
+
setTabs(newTabs);
|
|
32
|
+
onChangeProp?.(event, newTabs);
|
|
33
|
+
};
|
|
34
|
+
const handleChangeSelectedTab = (event, value) => {
|
|
35
|
+
setSelectedTab(String(value));
|
|
36
|
+
onTabChangeProp?.(event, String(value));
|
|
37
|
+
};
|
|
38
|
+
const handleCreateNew = (event) => {
|
|
39
|
+
const newTabs = [...tabs];
|
|
40
|
+
const newTab = {
|
|
41
|
+
id: uniqueId(),
|
|
42
|
+
label: `${labels.undefined} ${newTabs.length + 1}`,
|
|
43
|
+
icon: iconProp
|
|
44
|
+
};
|
|
45
|
+
newTabs.push(newTab);
|
|
46
|
+
handleChangeSelectedTab(event, newTab.id);
|
|
47
|
+
handleChangeTabs?.(event, newTabs);
|
|
48
|
+
};
|
|
49
|
+
const handleEdit = (event, value, tabId) => handleChangeTabs(event, tabs.map((tab) => tab.id === tabId ? {
|
|
50
|
+
...tab,
|
|
51
|
+
label: value
|
|
52
|
+
} : tab));
|
|
53
|
+
const handleDeleteTab = (event, tabId) => {
|
|
54
|
+
const newTabs = tabs.filter((tab) => tab.id !== tabId);
|
|
55
|
+
if (tabId === selectedTab) {
|
|
56
|
+
const currentIndex = tabs.findIndex((tab) => tab.id === tabId);
|
|
57
|
+
handleChangeSelectedTab(event, newTabs[currentIndex - 1 < 0 ? 0 : currentIndex - 1]?.id ?? "none");
|
|
58
|
+
}
|
|
59
|
+
handleChangeTabs(event, newTabs);
|
|
60
|
+
};
|
|
61
|
+
const handleKeyDownTab = (event, tabId, removable) => {
|
|
62
|
+
if (removable && (isKey(event, "Delete") || isKey(event, "Backspace"))) {
|
|
63
|
+
handleDeleteTab(event, tabId);
|
|
64
|
+
event.stopPropagation();
|
|
65
|
+
} else if (isKey(event, "Enter")) setIsEditing(true);
|
|
66
|
+
};
|
|
67
|
+
const { tabWidth, hiddenTabs, visibleTabs } = useMemo(() => {
|
|
68
|
+
let availableWidth = rootWidth - actionsWidth;
|
|
69
|
+
let calculatedTabWidth = availableWidth / tabs.length;
|
|
70
|
+
let clamped = clamp(calculatedTabWidth, 220, 120);
|
|
71
|
+
if (calculatedTabWidth < 120) {
|
|
72
|
+
availableWidth -= 64;
|
|
73
|
+
const visibleCount = Math.floor(availableWidth / 120);
|
|
74
|
+
calculatedTabWidth = availableWidth / visibleCount;
|
|
75
|
+
clamped = clamp(calculatedTabWidth, 220, 120);
|
|
76
|
+
const temporaryHiddenTabs = tabs.slice(visibleCount);
|
|
77
|
+
const selectedTabHiddenIndex = temporaryHiddenTabs.findIndex((tab) => tab.id === selectedTab);
|
|
78
|
+
const excludedTabIndex = visibleCount - 1;
|
|
79
|
+
if (selectedTabHiddenIndex !== -1 && visibleCount > 0) return {
|
|
80
|
+
tabWidth: clamped,
|
|
81
|
+
visibleTabs: [...tabs.slice(0, excludedTabIndex), temporaryHiddenTabs[selectedTabHiddenIndex]].filter(Boolean),
|
|
82
|
+
hiddenTabs: [tabs[excludedTabIndex], ...temporaryHiddenTabs.filter((tab, i) => i !== selectedTabHiddenIndex)].filter(Boolean)
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
tabWidth: clamped,
|
|
86
|
+
visibleTabs: tabs.slice(0, visibleCount),
|
|
87
|
+
hiddenTabs: temporaryHiddenTabs
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
tabWidth: clamped,
|
|
92
|
+
visibleTabs: tabs,
|
|
93
|
+
hiddenTabs: []
|
|
94
|
+
};
|
|
95
|
+
}, [
|
|
96
|
+
actionsWidth,
|
|
97
|
+
rootWidth,
|
|
98
|
+
selectedTab,
|
|
99
|
+
tabs
|
|
100
|
+
]);
|
|
101
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
102
|
+
ref: rootForkedRef,
|
|
103
|
+
className: cx(classes.root, className),
|
|
104
|
+
...others,
|
|
105
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
106
|
+
className: classes.tabsContainer,
|
|
107
|
+
children: [visibleTabs.length > 0 && /* @__PURE__ */ jsx(HvCanvasPanelTabs, {
|
|
108
|
+
classes: { list: classes.tabsList },
|
|
109
|
+
value: selectedTab,
|
|
110
|
+
onChange: handleChangeSelectedTab,
|
|
111
|
+
children: visibleTabs.map((tab, index) => {
|
|
112
|
+
const btnSelected = selectedTab === tab.id;
|
|
113
|
+
const removable = !tab.fixed;
|
|
114
|
+
return /* @__PURE__ */ jsxs(HvCanvasPanelTab, {
|
|
115
|
+
style: { width: tabWidth },
|
|
116
|
+
id: String(tab.id),
|
|
117
|
+
classes: {
|
|
118
|
+
root: classes.tab,
|
|
119
|
+
tab: classes.tabContent
|
|
120
|
+
},
|
|
121
|
+
value: tab.id,
|
|
122
|
+
onKeyDown: (event) => handleKeyDownTab(event, tab.id, removable),
|
|
123
|
+
children: [
|
|
124
|
+
tab.icon && /* @__PURE__ */ jsx("div", {
|
|
125
|
+
className: classes.tabIconContainer,
|
|
126
|
+
children: tab.icon
|
|
127
|
+
}),
|
|
128
|
+
!btnSelected || disableTabEdit ? /* @__PURE__ */ jsx(HvOverflowTooltip, {
|
|
129
|
+
classes: { tooltipAnchor: classes.tabLabel },
|
|
130
|
+
data: tab.label
|
|
131
|
+
}) : /* @__PURE__ */ jsx(ToolbarTabEditor, {
|
|
132
|
+
classes: { label: cx(classes.tabLabel, classes.tabLabelEditor) },
|
|
133
|
+
value: tab.label,
|
|
134
|
+
edit: isEditing,
|
|
135
|
+
onEditChange: setIsEditing,
|
|
136
|
+
onChange: (event, value) => handleEdit(event, value, tab.id),
|
|
137
|
+
onBlur: (event, value) => handleEdit(event, value, tab.id),
|
|
138
|
+
onKeyDown: (e) => e.stopPropagation()
|
|
139
|
+
}),
|
|
140
|
+
removable && /* @__PURE__ */ jsx("div", {
|
|
141
|
+
className: classes.closeIconContainer,
|
|
142
|
+
children: /* @__PURE__ */ jsx(CloseXS, {
|
|
143
|
+
"aria-hidden": true,
|
|
144
|
+
size: "xs",
|
|
145
|
+
onClick: (event) => {
|
|
146
|
+
handleDeleteTab(event, tab.id);
|
|
147
|
+
event.stopPropagation();
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
}),
|
|
151
|
+
selectedTab !== tab.id && visibleTabs[index + 1]?.id !== selectedTab && /* @__PURE__ */ jsx("div", { className: classes.tabDivider })
|
|
152
|
+
]
|
|
153
|
+
}, tab.id);
|
|
154
|
+
})
|
|
155
|
+
}), hiddenTabs.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
156
|
+
className: classes.dropdownMenuContainer,
|
|
157
|
+
children: /* @__PURE__ */ jsx(HvDropDownMenu, {
|
|
158
|
+
classes: { menuListRoot: classes.dropdownMenuListRoot },
|
|
159
|
+
dataList: hiddenTabs,
|
|
160
|
+
icon: /* @__PURE__ */ jsx(MoreOptionsHorizontal, {}),
|
|
161
|
+
labels: { dropdownMenu: labels.dropdownMenu },
|
|
162
|
+
onClick: (event, value) => handleChangeSelectedTab(event, value.id ?? "none")
|
|
163
|
+
})
|
|
164
|
+
})]
|
|
165
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
166
|
+
ref: actionsRef,
|
|
167
|
+
className: classes.actionsContainer,
|
|
168
|
+
children: [children, !hideCreateNew && /* @__PURE__ */ jsx(HvButton, {
|
|
169
|
+
variant: "primaryGhost",
|
|
170
|
+
startIcon: /* @__PURE__ */ jsx(AddAlt, {}),
|
|
171
|
+
onClick: handleCreateNew,
|
|
172
|
+
children: labels.create
|
|
173
|
+
})]
|
|
174
|
+
})]
|
|
175
|
+
});
|
|
228
176
|
});
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
staticClasses as canvasToolbarTabsClasses
|
|
232
|
-
};
|
|
177
|
+
//#endregion
|
|
178
|
+
export { HvCanvasToolbarTabs };
|
|
@@ -1,130 +1,99 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { staticClasses as staticClasses$1 } from "./ToolbarTabEditor.js";
|
|
2
2
|
import { createClasses, theme } from "@hitachivantara/uikit-react-core";
|
|
3
|
-
import {
|
|
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
|
-
|
|
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
|
-
tabDivider: {
|
|
102
|
-
position: "absolute",
|
|
103
|
-
height: 18,
|
|
104
|
-
width: 1,
|
|
105
|
-
backgroundColor: theme.colors.bgPageSecondary,
|
|
106
|
-
right: 0
|
|
107
|
-
},
|
|
108
|
-
actionsContainer: {
|
|
109
|
-
display: "flex",
|
|
110
|
-
justifyContent: "flex-end",
|
|
111
|
-
alignItems: "center",
|
|
112
|
-
gap: theme.space.sm
|
|
113
|
-
},
|
|
114
|
-
dropdownMenuContainer: {
|
|
115
|
-
width: DROPDOWN_MENU_WIDTH,
|
|
116
|
-
display: "flex",
|
|
117
|
-
justifyContent: "center"
|
|
118
|
-
},
|
|
119
|
-
dropdownMenuListRoot: {
|
|
120
|
-
maxHeight: 220
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
);
|
|
124
|
-
export {
|
|
125
|
-
DROPDOWN_MENU_WIDTH,
|
|
126
|
-
MAX_TAB_WIDTH,
|
|
127
|
-
MIN_TAB_WIDTH,
|
|
128
|
-
staticClasses,
|
|
129
|
-
useClasses
|
|
130
|
-
};
|
|
3
|
+
import { tabClasses } from "@mui/base";
|
|
4
|
+
var TAB_HEIGHT = 32;
|
|
5
|
+
var CLOSE_ICON_SIZE = 32;
|
|
6
|
+
var TAB_ICON_SIZE = 16;
|
|
7
|
+
var TAB_COLOR = theme.mix("primaryDimmed", .5, "dimmer");
|
|
8
|
+
var { staticClasses, useClasses } = createClasses("HvCanvasToolbarTabs", {
|
|
9
|
+
root: {
|
|
10
|
+
display: "flex",
|
|
11
|
+
justifyContent: "space-between",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
width: "100%",
|
|
14
|
+
backgroundColor: theme.colors.bgContainer,
|
|
15
|
+
boxShadow: theme.colors.shadow,
|
|
16
|
+
borderRadius: `0px 0px ${theme.radii.base} ${theme.radii.base}`,
|
|
17
|
+
transition: "width 0.3s ease",
|
|
18
|
+
height: TAB_HEIGHT
|
|
19
|
+
},
|
|
20
|
+
tabsContainer: { display: "flex" },
|
|
21
|
+
tabsList: {
|
|
22
|
+
height: TAB_HEIGHT,
|
|
23
|
+
backgroundColor: theme.colors.bgContainer,
|
|
24
|
+
borderEndStartRadius: theme.radii.base
|
|
25
|
+
},
|
|
26
|
+
tab: {
|
|
27
|
+
boxSizing: "border-box",
|
|
28
|
+
border: `1px solid transparent`,
|
|
29
|
+
borderBottom: "none",
|
|
30
|
+
borderRadius: "10px 10px 0 0",
|
|
31
|
+
boxShadow: "none",
|
|
32
|
+
backgroundColor: "inherit",
|
|
33
|
+
"&:first-of-type": { borderEndStartRadius: theme.radii.base },
|
|
34
|
+
[`:has(.${tabClasses.selected})`]: {
|
|
35
|
+
color: theme.colors.primary,
|
|
36
|
+
backgroundColor: TAB_COLOR,
|
|
37
|
+
borderColor: theme.colors.border
|
|
38
|
+
},
|
|
39
|
+
[`:not(:has(.${tabClasses.selected}))`]: { "&:hover,&:focus": {
|
|
40
|
+
borderRadius: 0,
|
|
41
|
+
backgroundColor: TAB_COLOR,
|
|
42
|
+
borderColor: TAB_COLOR,
|
|
43
|
+
"&:first-of-type": { borderEndStartRadius: theme.radii.base }
|
|
44
|
+
} },
|
|
45
|
+
[`&:has($tabLabelEditor:hover) $tabIconContainer, &:has(.${staticClasses$1.edit}) $tabIconContainer`]: { display: "none" },
|
|
46
|
+
[`&:has(.${staticClasses$1.edit}) $closeIconContainer`]: { display: "none" }
|
|
47
|
+
},
|
|
48
|
+
tabLabel: { "&:not($tabLabelEditor)": { margin: theme.spacing(0, "xs") } },
|
|
49
|
+
tabLabelEditor: { color: theme.colors.primary },
|
|
50
|
+
tabContent: {
|
|
51
|
+
position: "relative",
|
|
52
|
+
height: TAB_HEIGHT,
|
|
53
|
+
display: "flex",
|
|
54
|
+
justifyContent: "flex-start",
|
|
55
|
+
alignItems: "center",
|
|
56
|
+
width: "100%",
|
|
57
|
+
padding: theme.space.xs,
|
|
58
|
+
[`&.${tabClasses.selected}`]: { color: theme.colors.primary }
|
|
59
|
+
},
|
|
60
|
+
tabIconContainer: {
|
|
61
|
+
display: "flex",
|
|
62
|
+
justifyContent: "center",
|
|
63
|
+
alignItems: "center",
|
|
64
|
+
width: TAB_ICON_SIZE
|
|
65
|
+
},
|
|
66
|
+
closeIconContainer: {
|
|
67
|
+
display: "flex",
|
|
68
|
+
justifyContent: "center",
|
|
69
|
+
alignItems: "center",
|
|
70
|
+
marginLeft: "auto",
|
|
71
|
+
marginRight: theme.spacing(-1),
|
|
72
|
+
width: CLOSE_ICON_SIZE,
|
|
73
|
+
"&:hover": {
|
|
74
|
+
backgroundColor: theme.colors.bgHover,
|
|
75
|
+
borderRadius: theme.radii.full
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
tabDivider: {
|
|
79
|
+
position: "absolute",
|
|
80
|
+
height: 18,
|
|
81
|
+
width: 1,
|
|
82
|
+
backgroundColor: theme.colors.bgPageSecondary,
|
|
83
|
+
right: 0
|
|
84
|
+
},
|
|
85
|
+
actionsContainer: {
|
|
86
|
+
display: "flex",
|
|
87
|
+
justifyContent: "flex-end",
|
|
88
|
+
alignItems: "center",
|
|
89
|
+
gap: theme.space.sm
|
|
90
|
+
},
|
|
91
|
+
dropdownMenuContainer: {
|
|
92
|
+
width: 64,
|
|
93
|
+
display: "flex",
|
|
94
|
+
justifyContent: "center"
|
|
95
|
+
},
|
|
96
|
+
dropdownMenuListRoot: { maxHeight: 220 }
|
|
97
|
+
});
|
|
98
|
+
//#endregion
|
|
99
|
+
export { staticClasses, useClasses };
|