@hitachivantara/uikit-react-pentaho 0.2.0 → 0.4.0
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/cjs/Canvas/BottomPanel/BottomPanel.cjs +66 -27
- package/dist/cjs/Canvas/BottomPanel/BottomPanel.styles.cjs +15 -8
- package/dist/cjs/Canvas/SidePanel/SidePanel.cjs +5 -11
- package/dist/cjs/Canvas/SidePanel/SidePanel.styles.cjs +0 -10
- package/dist/cjs/Canvas/ToolbarTabs/ToolbarTabs.cjs +262 -0
- package/dist/cjs/Canvas/ToolbarTabs/ToolbarTabs.styles.cjs +123 -0
- package/dist/cjs/Card/Card.cjs +18 -0
- package/dist/cjs/Card/Card.styles.cjs +16 -0
- package/dist/cjs/Card/CardMedia/CardMedia.cjs +33 -0
- package/dist/cjs/Card/CardMedia/CardMedia.styles.cjs +12 -0
- package/dist/cjs/Card/CardSection/CardSection.cjs +19 -0
- package/dist/cjs/Card/CardSection/CardSection.styles.cjs +10 -0
- package/dist/cjs/index.cjs +16 -0
- package/dist/esm/Canvas/BottomPanel/BottomPanel.js +67 -28
- package/dist/esm/Canvas/BottomPanel/BottomPanel.js.map +1 -1
- package/dist/esm/Canvas/BottomPanel/BottomPanel.styles.js +16 -9
- package/dist/esm/Canvas/BottomPanel/BottomPanel.styles.js.map +1 -1
- package/dist/esm/Canvas/SidePanel/SidePanel.js +7 -13
- package/dist/esm/Canvas/SidePanel/SidePanel.js.map +1 -1
- package/dist/esm/Canvas/SidePanel/SidePanel.styles.js +1 -11
- package/dist/esm/Canvas/SidePanel/SidePanel.styles.js.map +1 -1
- package/dist/esm/Canvas/ToolbarTabs/ToolbarTabs.js +263 -0
- package/dist/esm/Canvas/ToolbarTabs/ToolbarTabs.js.map +1 -0
- package/dist/esm/Canvas/ToolbarTabs/ToolbarTabs.styles.js +123 -0
- package/dist/esm/Canvas/ToolbarTabs/ToolbarTabs.styles.js.map +1 -0
- package/dist/esm/Card/Card.js +19 -0
- package/dist/esm/Card/Card.js.map +1 -0
- package/dist/esm/Card/Card.styles.js +16 -0
- package/dist/esm/Card/Card.styles.js.map +1 -0
- package/dist/esm/Card/CardMedia/CardMedia.js +34 -0
- package/dist/esm/Card/CardMedia/CardMedia.js.map +1 -0
- package/dist/esm/Card/CardMedia/CardMedia.styles.js +12 -0
- package/dist/esm/Card/CardMedia/CardMedia.styles.js.map +1 -0
- package/dist/esm/Card/CardSection/CardSection.js +20 -0
- package/dist/esm/Card/CardSection/CardSection.js.map +1 -0
- package/dist/esm/Card/CardSection/CardSection.styles.js +10 -0
- package/dist/esm/Card/CardSection/CardSection.styles.js.map +1 -0
- package/dist/esm/index.js +17 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +201 -9
- package/package.json +4 -4
|
@@ -17,7 +17,8 @@ const HvCanvasBottomPanel = react.forwardRef((props, ref) => {
|
|
|
17
17
|
minimize,
|
|
18
18
|
leftActions,
|
|
19
19
|
rightActions,
|
|
20
|
-
|
|
20
|
+
overflowActions,
|
|
21
|
+
selectedTabId: selectedTabIdProp,
|
|
21
22
|
classes: classesProp,
|
|
22
23
|
onTabChange,
|
|
23
24
|
onAction,
|
|
@@ -48,11 +49,11 @@ const HvCanvasBottomPanel = react.forwardRef((props, ref) => {
|
|
|
48
49
|
}
|
|
49
50
|
});
|
|
50
51
|
const overflowing = react.useMemo(() => {
|
|
51
|
-
const
|
|
52
|
-
return
|
|
53
|
-
}, [
|
|
52
|
+
const availableWidth = tabWidth - (leftActions ? leftActionWidth : 0) - (rightActions ? rightActionWidth : 0);
|
|
53
|
+
return availableWidth < 60;
|
|
54
|
+
}, [leftActionWidth, leftActions, rightActionWidth, rightActions, tabWidth]);
|
|
54
55
|
const [selectedTab, setSelectedTab] = uikitReactCore.useControlled(
|
|
55
|
-
|
|
56
|
+
selectedTabIdProp,
|
|
56
57
|
tabs[0].id
|
|
57
58
|
);
|
|
58
59
|
const handleTabChange = (event, tabId) => {
|
|
@@ -82,8 +83,8 @@ const HvCanvasBottomPanel = react.forwardRef((props, ref) => {
|
|
|
82
83
|
{
|
|
83
84
|
style: {
|
|
84
85
|
// @ts-ignore
|
|
85
|
-
"--left-actions-width":
|
|
86
|
-
"--right-actions-width":
|
|
86
|
+
"--left-actions-width": overflowing || !leftActions ? uikitReactCore.theme.space.sm : `calc(${leftActionWidth}px + ${uikitReactCore.theme.space.xs})`,
|
|
87
|
+
"--right-actions-width": !rightActions || overflowing && !overflowActions ? uikitReactCore.theme.space.sm : `calc(${overflowing ? 32 : rightActionWidth}px + ${uikitReactCore.theme.space.xs})`
|
|
87
88
|
},
|
|
88
89
|
onChange: handleTabChange,
|
|
89
90
|
value: selectedTab,
|
|
@@ -94,13 +95,14 @@ const HvCanvasBottomPanel = react.forwardRef((props, ref) => {
|
|
|
94
95
|
id: `${id}-${tab.id}`,
|
|
95
96
|
value: tab.id,
|
|
96
97
|
className: classes.tab,
|
|
97
|
-
|
|
98
|
+
tabIndex: 0,
|
|
99
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes.tabTitle, children: typeof tab.title === "function" ? tab.title(overflowing) : tab.title })
|
|
98
100
|
},
|
|
99
101
|
tab.id
|
|
100
102
|
))
|
|
101
103
|
}
|
|
102
104
|
),
|
|
103
|
-
|
|
105
|
+
leftActions || rightActions || overflowActions ? tabs.map((tab, index) => {
|
|
104
106
|
const btnsDisabled = selectedTab !== tab.id && !minimize;
|
|
105
107
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
106
108
|
"div",
|
|
@@ -112,28 +114,65 @@ const HvCanvasBottomPanel = react.forwardRef((props, ref) => {
|
|
|
112
114
|
"--left": `calc(${index} * var(--tab-width))`
|
|
113
115
|
},
|
|
114
116
|
children: [
|
|
115
|
-
leftActions &&
|
|
116
|
-
|
|
117
|
+
leftActions && !overflowing && /* @__PURE__ */ jsxRuntime.jsx(
|
|
118
|
+
"div",
|
|
117
119
|
{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
ref: leftActionRef,
|
|
121
|
+
className: cx(classes.leftActions, {
|
|
122
|
+
[classes.actionsDisabled]: btnsDisabled
|
|
123
|
+
}),
|
|
124
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
125
|
+
uikitReactCore.HvActionsGeneric,
|
|
126
|
+
{
|
|
127
|
+
maxVisibleActions: 1,
|
|
128
|
+
actions: leftActions,
|
|
129
|
+
disabled: btnsDisabled,
|
|
130
|
+
onAction: (event, action) => onAction?.(event, action, tab.id),
|
|
131
|
+
variant: "secondaryGhost",
|
|
132
|
+
iconOnly: true
|
|
133
|
+
}
|
|
134
|
+
)
|
|
124
135
|
}
|
|
125
|
-
)
|
|
126
|
-
rightActions &&
|
|
127
|
-
|
|
136
|
+
),
|
|
137
|
+
rightActions && !overflowing && /* @__PURE__ */ jsxRuntime.jsx(
|
|
138
|
+
"div",
|
|
128
139
|
{
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
140
|
+
ref: rightActionRef,
|
|
141
|
+
className: cx(classes.rightActions, {
|
|
142
|
+
[classes.actionsDisabled]: btnsDisabled
|
|
143
|
+
}),
|
|
144
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
145
|
+
uikitReactCore.HvActionsGeneric,
|
|
146
|
+
{
|
|
147
|
+
maxVisibleActions: 2,
|
|
148
|
+
actions: rightActions,
|
|
149
|
+
disabled: btnsDisabled,
|
|
150
|
+
onAction: (event, action) => onAction?.(event, action, tab.id),
|
|
151
|
+
variant: "secondaryGhost",
|
|
152
|
+
iconOnly: true
|
|
153
|
+
}
|
|
154
|
+
)
|
|
135
155
|
}
|
|
136
|
-
)
|
|
156
|
+
),
|
|
157
|
+
overflowActions && overflowing && /* @__PURE__ */ jsxRuntime.jsx(
|
|
158
|
+
"div",
|
|
159
|
+
{
|
|
160
|
+
className: cx(classes.rightActions, {
|
|
161
|
+
[classes.actionsDisabled]: btnsDisabled
|
|
162
|
+
}),
|
|
163
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
164
|
+
uikitReactCore.HvActionsGeneric,
|
|
165
|
+
{
|
|
166
|
+
maxVisibleActions: 0,
|
|
167
|
+
actions: overflowActions,
|
|
168
|
+
disabled: btnsDisabled,
|
|
169
|
+
onAction: (event, action) => onAction?.(event, action, tab.id),
|
|
170
|
+
variant: "secondaryGhost",
|
|
171
|
+
iconOnly: true
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
)
|
|
137
176
|
]
|
|
138
177
|
},
|
|
139
178
|
tab.id
|
|
@@ -34,12 +34,7 @@ const { staticClasses, useClasses } = uikitReactCore.createClasses(
|
|
|
34
34
|
right: `calc(100% - var(--right) + ${uikitReactCore.theme.space.xs})`
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
-
overflowing: {
|
|
38
|
-
"& $tabTitle": {
|
|
39
|
-
paddingLeft: uikitReactCore.theme.space.sm,
|
|
40
|
-
paddingRight: uikitReactCore.theme.space.sm
|
|
41
|
-
}
|
|
42
|
-
},
|
|
37
|
+
overflowing: {},
|
|
43
38
|
tab: {
|
|
44
39
|
display: "flex",
|
|
45
40
|
alignItems: "center",
|
|
@@ -50,8 +45,8 @@ const { staticClasses, useClasses } = uikitReactCore.createClasses(
|
|
|
50
45
|
display: "flex",
|
|
51
46
|
width: "100%",
|
|
52
47
|
padding: uikitReactCore.theme.space.sm,
|
|
53
|
-
paddingLeft:
|
|
54
|
-
paddingRight:
|
|
48
|
+
paddingLeft: "var(--left-actions-width)",
|
|
49
|
+
paddingRight: "var(--right-actions-width)"
|
|
55
50
|
},
|
|
56
51
|
tabsRoot: {
|
|
57
52
|
position: "relative"
|
|
@@ -66,6 +61,18 @@ const { staticClasses, useClasses } = uikitReactCore.createClasses(
|
|
|
66
61
|
right: uikitReactCore.theme.space.xs,
|
|
67
62
|
top: 8
|
|
68
63
|
},
|
|
64
|
+
actionsDisabled: {
|
|
65
|
+
pointerEvents: "none",
|
|
66
|
+
[`&& .${uikitReactCore.buttonClasses.disabled}`]: {
|
|
67
|
+
pointerEvents: "none",
|
|
68
|
+
backgroundColor: "transparent",
|
|
69
|
+
borderColor: "transparent",
|
|
70
|
+
":hover": {
|
|
71
|
+
backgroundColor: "transparent",
|
|
72
|
+
borderColor: "transparent"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
69
76
|
content: { borderTopRightRadius: "var(--right-border-radius)" }
|
|
70
77
|
}
|
|
71
78
|
);
|
|
@@ -85,22 +85,16 @@ const HvCanvasSidePanel = react.forwardRef((props, ref) => {
|
|
|
85
85
|
}
|
|
86
86
|
),
|
|
87
87
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
88
|
-
|
|
88
|
+
uikitReactCore.HvIconButton,
|
|
89
89
|
{
|
|
90
|
+
variant: "primaryGhost",
|
|
91
|
+
title: open ? labels.close : labels.open,
|
|
92
|
+
onClick: handleTogglePanel,
|
|
90
93
|
className: cx(classes.handle, {
|
|
91
94
|
[classes.handleOpen]: open,
|
|
92
95
|
[classes.handleClose]: !open
|
|
93
96
|
}),
|
|
94
|
-
|
|
95
|
-
role: "button",
|
|
96
|
-
tabIndex: 0,
|
|
97
|
-
onKeyDown: (e) => {
|
|
98
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
99
|
-
handleTogglePanel(e);
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
"aria-label": open ? labels.close : labels.open,
|
|
103
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes.handleButton, children: open ? /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Start, { color: ["primary"] }) : /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.End, { color: ["primary"] }) })
|
|
97
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.End, { style: { rotate: open ? "180deg" : void 0 } })
|
|
104
98
|
}
|
|
105
99
|
)
|
|
106
100
|
] });
|
|
@@ -42,18 +42,8 @@ const { staticClasses, useClasses } = uikitReactCore.createClasses(
|
|
|
42
42
|
},
|
|
43
43
|
"&$handleClose": {
|
|
44
44
|
left: 0
|
|
45
|
-
},
|
|
46
|
-
"&:hover": {
|
|
47
|
-
cursor: "pointer"
|
|
48
|
-
},
|
|
49
|
-
"&:focus-visible": {
|
|
50
|
-
...uikitReactCore.outlineStyles
|
|
51
45
|
}
|
|
52
46
|
},
|
|
53
|
-
handleButton: {
|
|
54
|
-
top: "calc(50% - 16px)",
|
|
55
|
-
position: "absolute"
|
|
56
|
-
},
|
|
57
47
|
open: {},
|
|
58
48
|
close: {},
|
|
59
49
|
handleOpen: {},
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const react = require("react");
|
|
5
|
+
const reactResizeDetector = require("react-resize-detector");
|
|
6
|
+
const uikitReactCore = require("@hitachivantara/uikit-react-core");
|
|
7
|
+
const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
|
|
8
|
+
const ToolbarTabs_styles = require("./ToolbarTabs.styles.cjs");
|
|
9
|
+
const PanelTabs = require("../PanelTabs/PanelTabs.cjs");
|
|
10
|
+
const PanelTab = require("../PanelTab/PanelTab.cjs");
|
|
11
|
+
const DEFAULT_LABELS = {
|
|
12
|
+
create: "Create new",
|
|
13
|
+
undefined: "Undefined",
|
|
14
|
+
close: "Close",
|
|
15
|
+
dropdownMenu: "Dropdown menu"
|
|
16
|
+
};
|
|
17
|
+
const DROPDOWN_MENU_WIDTH = 64;
|
|
18
|
+
const BORDER_WIDTH = 2;
|
|
19
|
+
const HvCanvasToolbarTabs = react.forwardRef((props, ref) => {
|
|
20
|
+
const {
|
|
21
|
+
children,
|
|
22
|
+
className,
|
|
23
|
+
selectedTabId: selectedTabIdProp,
|
|
24
|
+
icon: iconProp,
|
|
25
|
+
tabs: tabsProp,
|
|
26
|
+
defaultTabs: defaultTabsProp = [],
|
|
27
|
+
labels: labelsProp,
|
|
28
|
+
classes: classesProp,
|
|
29
|
+
onTabChange: onTabChangeProp,
|
|
30
|
+
onChange: onChangeProp,
|
|
31
|
+
...others
|
|
32
|
+
} = uikitReactCore.useDefaultProps("HvCanvasToolbarTabs", props);
|
|
33
|
+
const { classes, cx } = ToolbarTabs_styles.useClasses(classesProp);
|
|
34
|
+
const labels = uikitReactCore.useLabels(DEFAULT_LABELS, labelsProp);
|
|
35
|
+
const { width: tabWidth = 0, ref: tabRef } = reactResizeDetector.useResizeDetector({
|
|
36
|
+
handleHeight: false,
|
|
37
|
+
refreshMode: "debounce",
|
|
38
|
+
refreshOptions: {
|
|
39
|
+
leading: true
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
const { width: actionsWidth = 0, ref: actionsRef } = reactResizeDetector.useResizeDetector({
|
|
43
|
+
handleHeight: false
|
|
44
|
+
});
|
|
45
|
+
const { width: rootWidth = 0, ref: rootRef } = reactResizeDetector.useResizeDetector({
|
|
46
|
+
handleHeight: false
|
|
47
|
+
});
|
|
48
|
+
const [tabs, setTabs] = uikitReactCore.useControlled(tabsProp, defaultTabsProp);
|
|
49
|
+
const [selectedTab, setSelectedTab] = uikitReactCore.useControlled(
|
|
50
|
+
selectedTabIdProp,
|
|
51
|
+
tabs?.[0]?.id ?? "none"
|
|
52
|
+
);
|
|
53
|
+
const rootWidthLimitReached = react.useRef(false);
|
|
54
|
+
const groupTabs = react.useCallback(
|
|
55
|
+
(allTabs) => {
|
|
56
|
+
let fullTabWidth = ToolbarTabs_styles.MIN_TAB_WIDTH;
|
|
57
|
+
const rootScrollWidth = rootRef.current?.scrollWidth ?? 0;
|
|
58
|
+
if (rootScrollWidth - rootWidth >= 1 || rootWidthLimitReached.current) {
|
|
59
|
+
fullTabWidth = tabWidth + BORDER_WIDTH;
|
|
60
|
+
rootWidthLimitReached.current = true;
|
|
61
|
+
}
|
|
62
|
+
const totalWidth = allTabs.length * fullTabWidth + DROPDOWN_MENU_WIDTH;
|
|
63
|
+
if (tabWidth > 0 && totalWidth > rootWidth - actionsWidth) {
|
|
64
|
+
const visibleCount = Math.floor(
|
|
65
|
+
(rootWidth - actionsWidth - DROPDOWN_MENU_WIDTH) / fullTabWidth
|
|
66
|
+
);
|
|
67
|
+
const temporaryHiddenTabs = allTabs.slice(visibleCount);
|
|
68
|
+
const selectedTabHiddenIndex = temporaryHiddenTabs.findIndex(
|
|
69
|
+
(tab) => tab.id === selectedTab
|
|
70
|
+
);
|
|
71
|
+
const excludedTabIndex = visibleCount - 1;
|
|
72
|
+
const shouldShuffle = selectedTabHiddenIndex !== -1 && visibleCount > 0;
|
|
73
|
+
if (shouldShuffle) {
|
|
74
|
+
return {
|
|
75
|
+
visibleTabs: [
|
|
76
|
+
...tabs.slice(0, excludedTabIndex),
|
|
77
|
+
temporaryHiddenTabs[selectedTabHiddenIndex]
|
|
78
|
+
].filter((tab) => tab),
|
|
79
|
+
hiddenTabs: [
|
|
80
|
+
tabs[excludedTabIndex],
|
|
81
|
+
...temporaryHiddenTabs.filter(
|
|
82
|
+
(tab, i) => i !== selectedTabHiddenIndex
|
|
83
|
+
)
|
|
84
|
+
].filter((tab) => tab)
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
visibleTabs: tabs.slice(0, visibleCount),
|
|
89
|
+
hiddenTabs: temporaryHiddenTabs
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
visibleTabs: allTabs,
|
|
94
|
+
hiddenTabs: []
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
[actionsWidth, rootRef, rootWidth, selectedTab, tabWidth, tabs]
|
|
98
|
+
);
|
|
99
|
+
const { hiddenTabs, visibleTabs } = react.useMemo(
|
|
100
|
+
() => groupTabs(tabs),
|
|
101
|
+
[groupTabs, tabs]
|
|
102
|
+
);
|
|
103
|
+
const rootForkedRef = uikitReactCore.useForkRef(ref, rootRef);
|
|
104
|
+
const handleChangeTabs = (event, newTabs) => {
|
|
105
|
+
setTabs(newTabs);
|
|
106
|
+
onChangeProp?.(event, newTabs);
|
|
107
|
+
};
|
|
108
|
+
const handleChangeSelectedTab = (event, value) => {
|
|
109
|
+
setSelectedTab(String(value));
|
|
110
|
+
onTabChangeProp?.(event, String(value));
|
|
111
|
+
};
|
|
112
|
+
const handleCreateNew = (event) => {
|
|
113
|
+
const newTabs = [...tabs];
|
|
114
|
+
const newTab = {
|
|
115
|
+
id: uikitReactCore.uniqueId(),
|
|
116
|
+
label: `${labels.undefined} ${newTabs.length + 1}`,
|
|
117
|
+
icon: iconProp
|
|
118
|
+
};
|
|
119
|
+
newTabs.push(newTab);
|
|
120
|
+
handleChangeSelectedTab(event, newTab.id);
|
|
121
|
+
handleChangeTabs?.(event, newTabs);
|
|
122
|
+
};
|
|
123
|
+
const handleClose = (event, tabId) => {
|
|
124
|
+
const newTabs = tabs.filter((tab) => tab.id !== tabId);
|
|
125
|
+
if (tabId === selectedTab) {
|
|
126
|
+
const currentIndex = tabs.findIndex((tab) => tab.id === tabId);
|
|
127
|
+
const newIndex = currentIndex - 1 < 0 ? 0 : currentIndex - 1;
|
|
128
|
+
handleChangeSelectedTab(event, newTabs[newIndex]?.id ?? "none");
|
|
129
|
+
}
|
|
130
|
+
if (hiddenTabs.length === 1) rootWidthLimitReached.current = false;
|
|
131
|
+
handleChangeTabs(event, newTabs);
|
|
132
|
+
};
|
|
133
|
+
const handleEdit = (event, value, tabId) => handleChangeTabs(
|
|
134
|
+
event,
|
|
135
|
+
tabs.map((tab) => tab.id === tabId ? { ...tab, label: value } : tab)
|
|
136
|
+
);
|
|
137
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
ref: rootForkedRef,
|
|
141
|
+
className: cx(classes.root, className),
|
|
142
|
+
...others,
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes.tabsContainer, children: [
|
|
145
|
+
visibleTabs.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
146
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
147
|
+
PanelTabs.HvCanvasPanelTabs,
|
|
148
|
+
{
|
|
149
|
+
classes: { list: classes.tabsList },
|
|
150
|
+
value: selectedTab,
|
|
151
|
+
onChange: handleChangeSelectedTab,
|
|
152
|
+
children: visibleTabs.map((tab, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
153
|
+
PanelTab.HvCanvasPanelTab,
|
|
154
|
+
{
|
|
155
|
+
ref: index === 0 ? tabRef : void 0,
|
|
156
|
+
id: String(tab.id),
|
|
157
|
+
className: classes.tab,
|
|
158
|
+
value: tab.id,
|
|
159
|
+
tabIndex: 0,
|
|
160
|
+
"aria-label": tab.label,
|
|
161
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes.tabContent, children: [
|
|
162
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
163
|
+
"div",
|
|
164
|
+
{
|
|
165
|
+
className: cx({
|
|
166
|
+
[classes.tabIcon]: !!tab.icon
|
|
167
|
+
}),
|
|
168
|
+
children: tab.icon
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { role: "none", children: tab.label }),
|
|
172
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { role: "none", children: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Close, {}) }),
|
|
173
|
+
selectedTab !== tab.id && visibleTabs[index + 1]?.id !== selectedTab && /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes.tabDivider })
|
|
174
|
+
] })
|
|
175
|
+
},
|
|
176
|
+
tab.id
|
|
177
|
+
))
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
visibleTabs.map((tab, index) => {
|
|
181
|
+
const btnDisabled = selectedTab !== tab.id;
|
|
182
|
+
const num = index + 1;
|
|
183
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
184
|
+
"div",
|
|
185
|
+
{
|
|
186
|
+
style: {
|
|
187
|
+
// @ts-ignore
|
|
188
|
+
"--full-tab-width": `calc(${tabWidth}px + ${BORDER_WIDTH}px)`,
|
|
189
|
+
"--right": `calc(${num} * var(--full-tab-width))`,
|
|
190
|
+
"--editor-width": `calc(var(--full-tab-width) - ${tab.icon ? 2 : 1} * ${ToolbarTabs_styles.ICON_WIDTH}px - ${uikitReactCore.theme.space.xs})`
|
|
191
|
+
},
|
|
192
|
+
children: [
|
|
193
|
+
btnDisabled ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
+
"button",
|
|
195
|
+
{
|
|
196
|
+
type: "button",
|
|
197
|
+
className: classes.tabLabel,
|
|
198
|
+
onClick: (event) => handleChangeSelectedTab(event, tab.id),
|
|
199
|
+
"aria-label": tab.label,
|
|
200
|
+
tabIndex: -1,
|
|
201
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(uikitReactCore.HvOverflowTooltip, { data: tab.label })
|
|
202
|
+
}
|
|
203
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
204
|
+
uikitReactCore.HvInlineEditor,
|
|
205
|
+
{
|
|
206
|
+
className: cx(classes.tabLabel, classes.activeTabLabel),
|
|
207
|
+
"aria-label": tab.label,
|
|
208
|
+
value: tab.label,
|
|
209
|
+
buttonProps: { size: "sm" },
|
|
210
|
+
onChange: (event, value) => handleEdit(event, value, tab.id)
|
|
211
|
+
}
|
|
212
|
+
),
|
|
213
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
214
|
+
uikitReactCore.HvIconButton,
|
|
215
|
+
{
|
|
216
|
+
style: {
|
|
217
|
+
// @ts-ignore
|
|
218
|
+
"--close-color": btnDisabled ? uikitReactCore.theme.colors.secondary_60 : uikitReactCore.theme.colors.primary
|
|
219
|
+
},
|
|
220
|
+
className: classes.closeButton,
|
|
221
|
+
title: labels.close,
|
|
222
|
+
variant: "primaryGhost",
|
|
223
|
+
onClick: (event) => handleClose(event, tab.id),
|
|
224
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.CloseXS, {})
|
|
225
|
+
},
|
|
226
|
+
tab.id
|
|
227
|
+
)
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
tab.id
|
|
231
|
+
);
|
|
232
|
+
})
|
|
233
|
+
] }),
|
|
234
|
+
hiddenTabs.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
235
|
+
uikitReactCore.HvDropDownMenu,
|
|
236
|
+
{
|
|
237
|
+
className: classes.dropdownMenu,
|
|
238
|
+
dataList: hiddenTabs,
|
|
239
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.MoreOptionsHorizontal, {}),
|
|
240
|
+
labels: { dropdownMenu: labels.dropdownMenu },
|
|
241
|
+
onClick: (event, value) => handleChangeSelectedTab(event, value.id ?? "none")
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
] }),
|
|
245
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { ref: actionsRef, className: classes.actionsContainer, children: [
|
|
246
|
+
children,
|
|
247
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
248
|
+
uikitReactCore.HvButton,
|
|
249
|
+
{
|
|
250
|
+
variant: "primaryGhost",
|
|
251
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.AddAlt, {}),
|
|
252
|
+
onClick: handleCreateNew,
|
|
253
|
+
children: labels.create
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
] })
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
);
|
|
260
|
+
});
|
|
261
|
+
exports.canvasToolbarTabsClasses = ToolbarTabs_styles.staticClasses;
|
|
262
|
+
exports.HvCanvasToolbarTabs = HvCanvasToolbarTabs;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const Tab = require("@mui/base/Tab");
|
|
4
|
+
const uikitReactCore = require("@hitachivantara/uikit-react-core");
|
|
5
|
+
const ICON_WIDTH = 32;
|
|
6
|
+
const MIN_TAB_WIDTH = 120;
|
|
7
|
+
const MAX_TAB_WIDTH = 220;
|
|
8
|
+
const TAB_HEIGHT = 32;
|
|
9
|
+
const TAB_LABEL_HEIGHT = 24;
|
|
10
|
+
const { staticClasses, useClasses } = uikitReactCore.createClasses(
|
|
11
|
+
"HvCanvasToolbarTabs",
|
|
12
|
+
{
|
|
13
|
+
root: {
|
|
14
|
+
display: "flex",
|
|
15
|
+
justifyContent: "space-between",
|
|
16
|
+
alignItems: "center",
|
|
17
|
+
width: "100%",
|
|
18
|
+
backgroundColor: uikitReactCore.theme.colors.atmo1,
|
|
19
|
+
boxShadow: uikitReactCore.theme.colors.shadow,
|
|
20
|
+
borderRadius: `0px 0px ${uikitReactCore.theme.radii.base} ${uikitReactCore.theme.radii.base}`,
|
|
21
|
+
gap: uikitReactCore.theme.space.sm,
|
|
22
|
+
transition: "width 0.3s ease"
|
|
23
|
+
},
|
|
24
|
+
tabsContainer: {
|
|
25
|
+
position: "relative",
|
|
26
|
+
display: "flex"
|
|
27
|
+
},
|
|
28
|
+
tabsList: {
|
|
29
|
+
height: TAB_HEIGHT,
|
|
30
|
+
background: uikitReactCore.theme.colors.atmo1
|
|
31
|
+
},
|
|
32
|
+
tab: {
|
|
33
|
+
width: `clamp(${MIN_TAB_WIDTH}px, 100%, ${MAX_TAB_WIDTH}px)`,
|
|
34
|
+
border: `1px solid ${uikitReactCore.theme.colors.atmo1}`,
|
|
35
|
+
borderBottom: "none",
|
|
36
|
+
borderRadius: "10px 10px 0 0",
|
|
37
|
+
boxShadow: "none",
|
|
38
|
+
backgroundColor: uikitReactCore.theme.colors.atmo1,
|
|
39
|
+
[`&.${Tab.tabClasses.selected}`]: {
|
|
40
|
+
color: uikitReactCore.theme.colors.primary,
|
|
41
|
+
backgroundColor: uikitReactCore.theme.colors.containerBackgroundHover,
|
|
42
|
+
borderColor: uikitReactCore.theme.colors.atmo4
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
tabContent: {
|
|
46
|
+
height: TAB_HEIGHT,
|
|
47
|
+
display: "flex",
|
|
48
|
+
justifyContent: "space-between",
|
|
49
|
+
position: "relative",
|
|
50
|
+
width: "100%",
|
|
51
|
+
padding: uikitReactCore.theme.space.xs,
|
|
52
|
+
"& > div:first-of-type:not($tabIcon)": {
|
|
53
|
+
visibility: "hidden"
|
|
54
|
+
},
|
|
55
|
+
"& > div:nth-of-type(2)": {
|
|
56
|
+
visibility: "hidden",
|
|
57
|
+
minWidth: `calc(${MIN_TAB_WIDTH}px - ${uikitReactCore.theme.space.xs} - 2 * ${ICON_WIDTH}px)`,
|
|
58
|
+
maxWidth: `calc(${MAX_TAB_WIDTH}px - ${uikitReactCore.theme.space.xs} - 2 * ${ICON_WIDTH}px)`
|
|
59
|
+
},
|
|
60
|
+
"& > div:nth-of-type(3)": {
|
|
61
|
+
visibility: "hidden",
|
|
62
|
+
marginRight: `calc(-1 * ${uikitReactCore.theme.space.xs})`
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
tabIcon: {
|
|
66
|
+
display: "flex",
|
|
67
|
+
justifyContent: "center",
|
|
68
|
+
alignItems: "center"
|
|
69
|
+
},
|
|
70
|
+
closeButton: {
|
|
71
|
+
position: "absolute",
|
|
72
|
+
top: 0,
|
|
73
|
+
right: "calc(100% - var(--right))",
|
|
74
|
+
color: "var(--close-color)"
|
|
75
|
+
},
|
|
76
|
+
tabLabel: {
|
|
77
|
+
position: "absolute",
|
|
78
|
+
width: "var(--editor-width)",
|
|
79
|
+
right: `calc(100% - var(--right) + ${ICON_WIDTH}px)`,
|
|
80
|
+
height: TAB_LABEL_HEIGHT,
|
|
81
|
+
top: 4.5,
|
|
82
|
+
"&:not($activeTabLabel)": {
|
|
83
|
+
...uikitReactCore.theme.typography.body,
|
|
84
|
+
color: uikitReactCore.theme.colors.secondary_60,
|
|
85
|
+
background: "none",
|
|
86
|
+
cursor: "pointer"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
activeTabLabel: {
|
|
90
|
+
"& button": {
|
|
91
|
+
height: TAB_LABEL_HEIGHT,
|
|
92
|
+
minHeight: TAB_LABEL_HEIGHT,
|
|
93
|
+
backgroundColor: "transparent",
|
|
94
|
+
"& p": { ...uikitReactCore.theme.typography.label, color: uikitReactCore.theme.colors.primary },
|
|
95
|
+
"& span": { display: "none" }
|
|
96
|
+
},
|
|
97
|
+
[`&& .${uikitReactCore.baseInputClasses.inputRoot}`]: {
|
|
98
|
+
height: TAB_LABEL_HEIGHT,
|
|
99
|
+
minHeight: TAB_LABEL_HEIGHT
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
tabDivider: {
|
|
103
|
+
position: "absolute",
|
|
104
|
+
height: 18,
|
|
105
|
+
width: 1,
|
|
106
|
+
backgroundColor: uikitReactCore.theme.colors.atmo3,
|
|
107
|
+
right: 0
|
|
108
|
+
},
|
|
109
|
+
actionsContainer: {
|
|
110
|
+
display: "flex",
|
|
111
|
+
justifyContent: "flex-end",
|
|
112
|
+
alignItems: "center",
|
|
113
|
+
gap: uikitReactCore.theme.space.sm
|
|
114
|
+
},
|
|
115
|
+
dropdownMenu: {
|
|
116
|
+
margin: uikitReactCore.theme.spacing(0, "sm")
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
exports.ICON_WIDTH = ICON_WIDTH;
|
|
121
|
+
exports.MIN_TAB_WIDTH = MIN_TAB_WIDTH;
|
|
122
|
+
exports.staticClasses = staticClasses;
|
|
123
|
+
exports.useClasses = useClasses;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const uikitReactCore = require("@hitachivantara/uikit-react-core");
|
|
5
|
+
const Card_styles = require("./Card.styles.cjs");
|
|
6
|
+
const HvCard = uikitReactCore.fixedForwardRef(function HvCard2(props, ref) {
|
|
7
|
+
const {
|
|
8
|
+
classes: classesProp,
|
|
9
|
+
className,
|
|
10
|
+
component: Component = "div",
|
|
11
|
+
children,
|
|
12
|
+
...others
|
|
13
|
+
} = uikitReactCore.useDefaultProps("HvCard", props);
|
|
14
|
+
const { classes, cx } = Card_styles.useClasses(classesProp);
|
|
15
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, className: cx(classes.root, className), ...others, children });
|
|
16
|
+
});
|
|
17
|
+
exports.cardClasses = Card_styles.staticClasses;
|
|
18
|
+
exports.HvCard = HvCard;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const uikitReactCore = require("@hitachivantara/uikit-react-core");
|
|
4
|
+
const { staticClasses, useClasses } = uikitReactCore.createClasses("HvCard", {
|
|
5
|
+
root: {
|
|
6
|
+
position: "relative",
|
|
7
|
+
display: "block",
|
|
8
|
+
overflow: "hidden",
|
|
9
|
+
backgroundColor: uikitReactCore.theme.colors.atmo1,
|
|
10
|
+
borderRadius: uikitReactCore.theme.space.sm,
|
|
11
|
+
border: `1px solid ${uikitReactCore.theme.colors.atmo3}`,
|
|
12
|
+
boxShadow: "0 4px 6px 0 rgba(65,65,65,0.06)"
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
exports.staticClasses = staticClasses;
|
|
16
|
+
exports.useClasses = useClasses;
|