@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.
@@ -1,232 +1,178 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { forwardRef, useState, useMemo } from "react";
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 { useDefaultProps, useLabels, useControlled, useForkRef, HvOverflowTooltip, HvDropDownMenu, HvButton, isKey, uniqueId } from "@hitachivantara/uikit-react-core";
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 { ToolbarTabEditor } from "./ToolbarTabEditor.js";
8
- import { useClasses, MAX_TAB_WIDTH, MIN_TAB_WIDTH, DROPDOWN_MENU_WIDTH } from "./ToolbarTabs.styles.js";
9
- import { staticClasses } from "./ToolbarTabs.styles.js";
10
- import { HvCanvasPanelTabs } from "../PanelTabs/PanelTabs.js";
11
- import { HvCanvasPanelTab } from "../PanelTab/PanelTab.js";
12
- const DEFAULT_LABELS = {
13
- create: "Create new",
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
- const HvCanvasToolbarTabs = forwardRef(function HvCanvasToolbarTabs2(props, ref) {
18
- const {
19
- children,
20
- className,
21
- selectedTabId: selectedTabIdProp,
22
- icon: iconProp,
23
- disableTabEdit = false,
24
- hideCreateNew = false,
25
- tabs: tabsProp,
26
- defaultTabs: defaultTabsProp = [],
27
- labels: labelsProp,
28
- classes: classesProp,
29
- onTabChange: onTabChangeProp,
30
- onChange: onChangeProp,
31
- ...others
32
- } = useDefaultProps("HvCanvasToolbarTabs", props);
33
- const { classes, cx } = useClasses(classesProp);
34
- const labels = useLabels(DEFAULT_LABELS, labelsProp);
35
- const { width: actionsWidth = 0, ref: actionsRef } = useResizeDetector({
36
- handleHeight: false
37
- });
38
- const { width: rootWidth = 0, ref: rootRef } = useResizeDetector({
39
- handleHeight: false
40
- });
41
- const [tabs, setTabs] = useControlled(tabsProp, defaultTabsProp);
42
- const [selectedTab, setSelectedTab] = useControlled(
43
- selectedTabIdProp,
44
- tabs?.[0]?.id ?? "none"
45
- );
46
- const [isEditing, setIsEditing] = useState(false);
47
- const rootForkedRef = useForkRef(ref, rootRef);
48
- const handleChangeTabs = (event, newTabs) => {
49
- setTabs(newTabs);
50
- onChangeProp?.(event, newTabs);
51
- };
52
- const handleChangeSelectedTab = (event, value) => {
53
- setSelectedTab(String(value));
54
- onTabChangeProp?.(event, String(value));
55
- };
56
- const handleCreateNew = (event) => {
57
- const newTabs = [...tabs];
58
- const newTab = {
59
- id: uniqueId(),
60
- label: `${labels.undefined} ${newTabs.length + 1}`,
61
- icon: iconProp
62
- };
63
- newTabs.push(newTab);
64
- handleChangeSelectedTab(event, newTab.id);
65
- handleChangeTabs?.(event, newTabs);
66
- };
67
- const handleEdit = (event, value, tabId) => handleChangeTabs(
68
- event,
69
- tabs.map((tab) => tab.id === tabId ? { ...tab, label: value } : tab)
70
- );
71
- const handleDeleteTab = (event, tabId) => {
72
- const newTabs = tabs.filter((tab) => tab.id !== tabId);
73
- if (tabId === selectedTab) {
74
- const currentIndex = tabs.findIndex((tab) => tab.id === tabId);
75
- const newIndex = currentIndex - 1 < 0 ? 0 : currentIndex - 1;
76
- handleChangeSelectedTab(event, newTabs[newIndex]?.id ?? "none");
77
- }
78
- handleChangeTabs(event, newTabs);
79
- };
80
- const handleKeyDownTab = (event, tabId, removable) => {
81
- if (removable && (isKey(event, "Delete") || isKey(event, "Backspace"))) {
82
- handleDeleteTab(event, tabId);
83
- event.stopPropagation();
84
- } else if (isKey(event, "Enter")) {
85
- setIsEditing(true);
86
- }
87
- };
88
- const { tabWidth, hiddenTabs, visibleTabs } = useMemo(() => {
89
- let availableWidth = rootWidth - actionsWidth;
90
- let calculatedTabWidth = availableWidth / tabs.length;
91
- let clamped = clamp(calculatedTabWidth, MAX_TAB_WIDTH, MIN_TAB_WIDTH);
92
- if (calculatedTabWidth < MIN_TAB_WIDTH) {
93
- availableWidth -= DROPDOWN_MENU_WIDTH;
94
- const visibleCount = Math.floor(availableWidth / MIN_TAB_WIDTH);
95
- calculatedTabWidth = availableWidth / visibleCount;
96
- clamped = clamp(calculatedTabWidth, MAX_TAB_WIDTH, MIN_TAB_WIDTH);
97
- const temporaryHiddenTabs = tabs.slice(visibleCount);
98
- const selectedTabHiddenIndex = temporaryHiddenTabs.findIndex(
99
- (tab) => tab.id === selectedTab
100
- );
101
- const excludedTabIndex = visibleCount - 1;
102
- const shouldShuffle = selectedTabHiddenIndex !== -1 && visibleCount > 0;
103
- if (shouldShuffle) {
104
- return {
105
- tabWidth: clamped,
106
- visibleTabs: [
107
- ...tabs.slice(0, excludedTabIndex),
108
- temporaryHiddenTabs[selectedTabHiddenIndex]
109
- ].filter(Boolean),
110
- hiddenTabs: [
111
- tabs[excludedTabIndex],
112
- ...temporaryHiddenTabs.filter(
113
- (tab, i) => i !== selectedTabHiddenIndex
114
- )
115
- ].filter(Boolean)
116
- };
117
- }
118
- return {
119
- tabWidth: clamped,
120
- visibleTabs: tabs.slice(0, visibleCount),
121
- hiddenTabs: temporaryHiddenTabs
122
- };
123
- }
124
- return {
125
- tabWidth: clamped,
126
- visibleTabs: tabs,
127
- hiddenTabs: []
128
- };
129
- }, [actionsWidth, rootWidth, selectedTab, tabs]);
130
- return /* @__PURE__ */ jsxs(
131
- "div",
132
- {
133
- ref: rootForkedRef,
134
- className: cx(classes.root, className),
135
- ...others,
136
- children: [
137
- /* @__PURE__ */ jsxs("div", { className: classes.tabsContainer, children: [
138
- visibleTabs.length > 0 && /* @__PURE__ */ jsx(
139
- HvCanvasPanelTabs,
140
- {
141
- classes: { list: classes.tabsList },
142
- value: selectedTab,
143
- onChange: handleChangeSelectedTab,
144
- children: visibleTabs.map((tab, index) => {
145
- const btnSelected = selectedTab === tab.id;
146
- const removable = !tab.fixed;
147
- return /* @__PURE__ */ jsxs(
148
- HvCanvasPanelTab,
149
- {
150
- style: {
151
- width: tabWidth
152
- },
153
- id: String(tab.id),
154
- classes: { root: classes.tab, tab: classes.tabContent },
155
- value: tab.id,
156
- onKeyDown: (event) => handleKeyDownTab(event, tab.id, removable),
157
- children: [
158
- tab.icon && /* @__PURE__ */ jsx("div", { className: classes.tabIconContainer, children: tab.icon }),
159
- !btnSelected || disableTabEdit ? /* @__PURE__ */ jsx(
160
- HvOverflowTooltip,
161
- {
162
- classes: {
163
- tooltipAnchor: classes.tabLabel
164
- },
165
- data: tab.label
166
- }
167
- ) : /* @__PURE__ */ jsx(
168
- ToolbarTabEditor,
169
- {
170
- classes: {
171
- label: cx(classes.tabLabel, classes.tabLabelEditor)
172
- },
173
- value: tab.label,
174
- edit: isEditing,
175
- onEditChange: setIsEditing,
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
- export {
230
- HvCanvasToolbarTabs,
231
- staticClasses as canvasToolbarTabsClasses
232
- };
177
+ //#endregion
178
+ export { HvCanvasToolbarTabs };
@@ -1,130 +1,99 @@
1
- import { tabClasses } from "@mui/base";
1
+ import { staticClasses as staticClasses$1 } from "./ToolbarTabEditor.js";
2
2
  import { createClasses, theme } from "@hitachivantara/uikit-react-core";
3
- import { toolbarTabEditorClasses as staticClasses$1 } from "./ToolbarTabEditor.js";
4
- const MIN_TAB_WIDTH = 120;
5
- const MAX_TAB_WIDTH = 220;
6
- const DROPDOWN_MENU_WIDTH = 64;
7
- const TAB_HEIGHT = 32;
8
- const CLOSE_ICON_SIZE = 32;
9
- const TAB_ICON_SIZE = 16;
10
- const TAB_COLOR = theme.mix("primaryDimmed", 0.5, "dimmer");
11
- const { staticClasses, useClasses } = createClasses(
12
- "HvCanvasToolbarTabs",
13
- {
14
- root: {
15
- display: "flex",
16
- justifyContent: "space-between",
17
- alignItems: "center",
18
- width: "100%",
19
- backgroundColor: theme.colors.bgContainer,
20
- boxShadow: theme.colors.shadow,
21
- borderRadius: `0px 0px ${theme.radii.base} ${theme.radii.base}`,
22
- transition: "width 0.3s ease",
23
- height: TAB_HEIGHT
24
- },
25
- tabsContainer: {
26
- display: "flex"
27
- },
28
- tabsList: {
29
- height: TAB_HEIGHT,
30
- backgroundColor: theme.colors.bgContainer,
31
- borderEndStartRadius: theme.radii.base
32
- },
33
- tab: {
34
- boxSizing: "border-box",
35
- border: `1px solid transparent`,
36
- borderBottom: "none",
37
- borderRadius: "10px 10px 0 0",
38
- boxShadow: "none",
39
- backgroundColor: "inherit",
40
- "&:first-of-type": { borderEndStartRadius: theme.radii.base },
41
- [`:has(.${tabClasses.selected})`]: {
42
- color: theme.colors.primary,
43
- backgroundColor: TAB_COLOR,
44
- borderColor: theme.colors.border
45
- },
46
- [`:not(:has(.${tabClasses.selected}))`]: {
47
- "&:hover,&:focus": {
48
- borderRadius: 0,
49
- backgroundColor: TAB_COLOR,
50
- borderColor: TAB_COLOR,
51
- "&:first-of-type": { borderEndStartRadius: theme.radii.base }
52
- }
53
- },
54
- // Hide icon when editor is hovered and focused
55
- [`&:has($tabLabelEditor:hover) $tabIconContainer, &:has(.${staticClasses$1.edit}) $tabIconContainer`]: {
56
- display: "none"
57
- },
58
- // Hide close when editor is focused
59
- [`&:has(.${staticClasses$1.edit}) $closeIconContainer`]: {
60
- display: "none"
61
- }
62
- },
63
- tabLabel: {
64
- "&:not($tabLabelEditor)": {
65
- margin: theme.spacing(0, "xs")
66
- }
67
- },
68
- tabLabelEditor: {
69
- color: theme.colors.primary
70
- },
71
- tabContent: {
72
- position: "relative",
73
- height: TAB_HEIGHT,
74
- display: "flex",
75
- justifyContent: "flex-start",
76
- alignItems: "center",
77
- width: "100%",
78
- padding: theme.space.xs,
79
- [`&.${tabClasses.selected}`]: {
80
- color: theme.colors.primary
81
- }
82
- },
83
- tabIconContainer: {
84
- display: "flex",
85
- justifyContent: "center",
86
- alignItems: "center",
87
- width: TAB_ICON_SIZE
88
- },
89
- closeIconContainer: {
90
- display: "flex",
91
- justifyContent: "center",
92
- alignItems: "center",
93
- marginLeft: "auto",
94
- marginRight: theme.spacing(-1),
95
- width: CLOSE_ICON_SIZE,
96
- "&:hover": {
97
- backgroundColor: theme.colors.bgHover,
98
- borderRadius: theme.radii.full
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 };