@m4l/components 9.86.0 → 9.87.1
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/components/SideBar/SideBar.d.ts +2 -7
- package/components/SideBar/SideBar.d.ts.map +1 -1
- package/components/SideBar/SideBar.js +54 -48
- package/components/SideBar/constants.d.ts +21 -0
- package/components/SideBar/constants.d.ts.map +1 -1
- package/components/SideBar/constants.js +34 -14
- package/components/SideBar/dictionaryDefaults.d.ts +4 -0
- package/components/SideBar/dictionaryDefaults.d.ts.map +1 -0
- package/components/SideBar/dictionaryDefaults.js +35 -0
- package/components/SideBar/helpers/getMenuDataWithState/index.js +4 -4
- package/components/SideBar/helpers/resolveSidebarWidth.d.ts +3 -0
- package/components/SideBar/helpers/resolveSidebarWidth.d.ts.map +1 -0
- package/components/SideBar/helpers/resolveSidebarWidth.js +7 -0
- package/components/SideBar/hooks/useSideBarPreferences.d.ts +4 -0
- package/components/SideBar/hooks/useSideBarPreferences.d.ts.map +1 -0
- package/components/SideBar/hooks/useSideBarPreferences.js +71 -0
- package/components/SideBar/index.d.ts +4 -1
- package/components/SideBar/index.d.ts.map +1 -1
- package/components/SideBar/slots/SideBarSlots.js +1 -1
- package/components/SideBar/subcomponents/SideBarNavigation/SideBarNavigation.d.ts +4 -0
- package/components/SideBar/subcomponents/SideBarNavigation/SideBarNavigation.d.ts.map +1 -0
- package/components/SideBar/subcomponents/SideBarNavigation/SideBarNavigation.js +257 -0
- package/components/SideBar/subcomponents/SideBarNavigation/SidebarBranding.d.ts +6 -0
- package/components/SideBar/subcomponents/SideBarNavigation/SidebarBranding.d.ts.map +1 -0
- package/components/SideBar/subcomponents/SideBarNavigation/SidebarBranding.js +44 -0
- package/components/SideBar/subcomponents/SideBarNavigation/SidebarInstances.d.ts +4 -0
- package/components/SideBar/subcomponents/SideBarNavigation/SidebarInstances.d.ts.map +1 -0
- package/components/SideBar/subcomponents/SideBarNavigation/SidebarInstances.js +77 -0
- package/components/SideBar/subcomponents/SideBarNavigation/SidebarItemIcon.d.ts +4 -0
- package/components/SideBar/subcomponents/SideBarNavigation/SidebarItemIcon.d.ts.map +1 -0
- package/components/SideBar/subcomponents/SideBarNavigation/SidebarItemIcon.js +40 -0
- package/components/SideBar/subcomponents/SideBarNavigation/SidebarLabelTooltip.d.ts +4 -0
- package/components/SideBar/subcomponents/SideBarNavigation/SidebarLabelTooltip.d.ts.map +1 -0
- package/components/SideBar/subcomponents/SideBarNavigation/SidebarLabelTooltip.js +21 -0
- package/components/SideBar/subcomponents/SideBarNavigation/SidebarRow.d.ts +4 -0
- package/components/SideBar/subcomponents/SideBarNavigation/SidebarRow.d.ts.map +1 -0
- package/components/SideBar/subcomponents/SideBarNavigation/SidebarRow.js +62 -0
- package/components/SideBar/subcomponents/SideBarNavigation/assets/sidebar-texture.jpg.js +4 -0
- package/components/SideBar/subcomponents/SideBarNavigation/constants.d.ts +32 -0
- package/components/SideBar/subcomponents/SideBarNavigation/constants.d.ts.map +1 -0
- package/components/SideBar/subcomponents/SideBarNavigation/constants.js +17 -0
- package/components/SideBar/subcomponents/SideBarNavigation/helpers.d.ts +17 -0
- package/components/SideBar/subcomponents/SideBarNavigation/helpers.d.ts.map +1 -0
- package/components/SideBar/subcomponents/SideBarNavigation/helpers.js +61 -0
- package/components/SideBar/subcomponents/SideBarNavigation/slots/styled.d.ts +75 -0
- package/components/SideBar/subcomponents/SideBarNavigation/slots/styled.d.ts.map +1 -0
- package/components/SideBar/subcomponents/SideBarNavigation/slots/styled.js +508 -0
- package/components/SideBar/subcomponents/SideBarNavigation/types.d.ts +108 -0
- package/components/SideBar/subcomponents/SideBarNavigation/types.d.ts.map +1 -0
- package/components/SideBar/subcomponents/SideBarNavigation/useSidebarResize.d.ts +16 -0
- package/components/SideBar/subcomponents/SideBarNavigation/useSidebarResize.d.ts.map +1 -0
- package/components/SideBar/subcomponents/SideBarNavigation/useSidebarResize.js +42 -0
- package/components/SideBar/types.d.ts +70 -60
- package/components/SideBar/types.d.ts.map +1 -1
- package/index.js +200 -194
- package/package.json +9 -9
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
import { BASE_OPACITY_COLORS as h, BASE_LINE_HEIGHT as l, BASE_COLORS as y, BASE_LETTER_SPACING as f, BASE_WEIGHT as k, TYPOGRAPHY_SIZES_DESKTOP as S } from "@m4l/styles";
|
|
2
|
+
import { Drawer as $, Popover as I } from "@mui/material";
|
|
3
|
+
import { styled as i } from "@mui/material/styles";
|
|
4
|
+
import { Image as m } from "../../../../Image/Image.js";
|
|
5
|
+
import { SIDEBAR_WIDTH as O } from "../../../constants.js";
|
|
6
|
+
import R from "../assets/sidebar-texture.jpg.js";
|
|
7
|
+
import { SIDEBAR_TYPOGRAPHY as d, DARK_MODE_LOGO_FILTER as x, LIGHT_MODE_LOGO_FILTER as v, SIDEBAR_ATTRIBUTION_SIZE as C } from "../constants.js";
|
|
8
|
+
import { Stack as T } from "../../../../extended/mui/Stack/Stack.js";
|
|
9
|
+
import { Divider as w } from "../../../../extended/mui/Divider/Divider.js";
|
|
10
|
+
import { Chip as E } from "../../../../Chip/Chip.js";
|
|
11
|
+
const s = "260ms cubic-bezier(.2,.8,.2,1)", A = {
|
|
12
|
+
minWidth: 0,
|
|
13
|
+
overflow: "hidden",
|
|
14
|
+
textOverflow: "ellipsis",
|
|
15
|
+
whiteSpace: "nowrap"
|
|
16
|
+
}, c = {
|
|
17
|
+
appearance: "none",
|
|
18
|
+
background: "none",
|
|
19
|
+
border: 0,
|
|
20
|
+
color: "inherit",
|
|
21
|
+
cursor: "pointer",
|
|
22
|
+
font: "inherit",
|
|
23
|
+
padding: 0,
|
|
24
|
+
textAlign: "start"
|
|
25
|
+
}, D = {
|
|
26
|
+
display: "flex",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
width: "100%",
|
|
29
|
+
height: l.lh28,
|
|
30
|
+
gap: 2,
|
|
31
|
+
padding: "4px 8px 4px 2px",
|
|
32
|
+
...d.heading
|
|
33
|
+
};
|
|
34
|
+
function p(e) {
|
|
35
|
+
const { background: t } = e.vars.palette;
|
|
36
|
+
return e.palette.mode === "dark" ? t.neutral : t.default;
|
|
37
|
+
}
|
|
38
|
+
const N = i("aside")(
|
|
39
|
+
({ ownerState: e, theme: t }) => ({
|
|
40
|
+
flex: "none",
|
|
41
|
+
minHeight: 0,
|
|
42
|
+
position: "relative",
|
|
43
|
+
zIndex: 2,
|
|
44
|
+
width: e.expanded ? e.width : 0,
|
|
45
|
+
transition: e.resizing ? "none" : `width ${s}`,
|
|
46
|
+
...e.resizing && { cursor: "col-resize", userSelect: "none" },
|
|
47
|
+
"& > [data-sidebar-panel]": {
|
|
48
|
+
width: e.width,
|
|
49
|
+
transform: e.expanded ? "none" : "translateX(-100%)",
|
|
50
|
+
visibility: e.expanded ? "visible" : "hidden",
|
|
51
|
+
transition: e.resizing ? "none" : `transform ${s}, visibility ${s}`
|
|
52
|
+
},
|
|
53
|
+
'& > [role="separator"]::after': {
|
|
54
|
+
backgroundColor: e.resizing ? t.vars.palette.primary.selectedOpacity : "transparent"
|
|
55
|
+
},
|
|
56
|
+
"@media (prefers-reduced-motion: reduce)": {
|
|
57
|
+
transition: "none",
|
|
58
|
+
"& > [data-sidebar-panel]": { transition: "none" }
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
), q = i($)(({ theme: e }) => ({
|
|
62
|
+
"& .MuiDrawer-paper": {
|
|
63
|
+
width: `min(${O.default}px, 100vw)`,
|
|
64
|
+
overflow: "hidden",
|
|
65
|
+
backgroundColor: e.vars.palette.background.base
|
|
66
|
+
}
|
|
67
|
+
})), K = i("div")(({ theme: e }) => {
|
|
68
|
+
const { background: t, common: r, text: n } = e.vars.palette, o = p(e), a = e.palette.mode === "dark" ? t.base : h.marble[40];
|
|
69
|
+
return {
|
|
70
|
+
position: "relative",
|
|
71
|
+
display: "flex",
|
|
72
|
+
flexDirection: "column",
|
|
73
|
+
width: "100%",
|
|
74
|
+
height: "100%",
|
|
75
|
+
overflow: "hidden",
|
|
76
|
+
paddingBottom: 16,
|
|
77
|
+
color: n.primary,
|
|
78
|
+
backgroundImage: `linear-gradient(to right, ${o} 16.5%, ${a})`,
|
|
79
|
+
boxShadow: `2px 0 0 ${o}, ${e.vars.customShadows.z1}, inset 4px 0 16px ${o}`,
|
|
80
|
+
isolation: "isolate",
|
|
81
|
+
"&::before, &::after": {
|
|
82
|
+
content: '""',
|
|
83
|
+
position: "absolute",
|
|
84
|
+
inset: -40,
|
|
85
|
+
zIndex: -1,
|
|
86
|
+
pointerEvents: "none",
|
|
87
|
+
backgroundImage: `url(${R})`,
|
|
88
|
+
backgroundPosition: "center",
|
|
89
|
+
backgroundSize: "cover",
|
|
90
|
+
opacity: 0.06
|
|
91
|
+
},
|
|
92
|
+
"&::before": { filter: "blur(10px)", maskImage: `linear-gradient(${r.black}, transparent)` },
|
|
93
|
+
"&::after": { filter: "blur(4px)", maskImage: `linear-gradient(transparent, ${r.black})` },
|
|
94
|
+
...e.applyStyles("dark", {
|
|
95
|
+
"&::before, &::after": { opacity: 0.025 }
|
|
96
|
+
})
|
|
97
|
+
};
|
|
98
|
+
}), Z = i("button")(({ theme: e }) => ({
|
|
99
|
+
...c,
|
|
100
|
+
position: "absolute",
|
|
101
|
+
zIndex: 2,
|
|
102
|
+
top: 0,
|
|
103
|
+
right: -4,
|
|
104
|
+
width: 8,
|
|
105
|
+
height: "100%",
|
|
106
|
+
touchAction: "none",
|
|
107
|
+
cursor: "col-resize",
|
|
108
|
+
"&::after": {
|
|
109
|
+
content: '""',
|
|
110
|
+
position: "absolute",
|
|
111
|
+
inset: "0 3px",
|
|
112
|
+
transition: "background-color 150ms"
|
|
113
|
+
},
|
|
114
|
+
"&&:hover::after, &&:focus-visible::after": { backgroundColor: e.vars.palette.primary.selectedOpacity }
|
|
115
|
+
})), U = i("header")(({ theme: e }) => ({
|
|
116
|
+
display: "flex",
|
|
117
|
+
alignItems: "center",
|
|
118
|
+
height: 54,
|
|
119
|
+
padding: "0 8px 6px",
|
|
120
|
+
flexShrink: 0,
|
|
121
|
+
borderBottom: `1px solid ${p(e)}`
|
|
122
|
+
})), X = i(T)({
|
|
123
|
+
flexDirection: "row",
|
|
124
|
+
justifyContent: "space-between",
|
|
125
|
+
alignItems: "center",
|
|
126
|
+
gap: 8,
|
|
127
|
+
height: 48,
|
|
128
|
+
width: "100%",
|
|
129
|
+
overflow: "hidden"
|
|
130
|
+
}), J = i(m)(({ ownerState: e }) => ({
|
|
131
|
+
filter: e.themeMode === "dark" ? x : v,
|
|
132
|
+
objectFit: "contain",
|
|
133
|
+
borderRadius: 6
|
|
134
|
+
})), Q = i(E)(({ theme: e, color: t }) => ({
|
|
135
|
+
"&&": {
|
|
136
|
+
height: 16,
|
|
137
|
+
minHeight: 16,
|
|
138
|
+
borderRadius: 6,
|
|
139
|
+
padding: "0 8px",
|
|
140
|
+
flexShrink: 0,
|
|
141
|
+
boxShadow: e.vars.customShadows.z1
|
|
142
|
+
},
|
|
143
|
+
"&& .MuiTypography-root": {
|
|
144
|
+
...d.control,
|
|
145
|
+
lineHeight: l.lh16,
|
|
146
|
+
letterSpacing: f["normal0-5"],
|
|
147
|
+
...t === "aqua" && e.palette.mode === "dark" && { color: y.aqua[20] }
|
|
148
|
+
}
|
|
149
|
+
})), V = i("div")(({ ownerState: e, theme: t }) => ({
|
|
150
|
+
display: "flex",
|
|
151
|
+
flexDirection: "column",
|
|
152
|
+
flex: 1,
|
|
153
|
+
minHeight: 0,
|
|
154
|
+
gap: e.showHeading ? 8 : 12,
|
|
155
|
+
overflow: "hidden auto",
|
|
156
|
+
padding: "12px 8px 0",
|
|
157
|
+
scrollbarWidth: "thin",
|
|
158
|
+
scrollbarColor: `${t.vars.palette.border.secondary} transparent`
|
|
159
|
+
})), ee = i("label")(({ theme: e }) => ({
|
|
160
|
+
display: "flex",
|
|
161
|
+
flex: "0 0 24px",
|
|
162
|
+
alignItems: "center",
|
|
163
|
+
paddingLeft: 4,
|
|
164
|
+
borderRadius: 6,
|
|
165
|
+
backgroundColor: e.palette.mode === "dark" ? h.mint[5] : e.vars.palette.default.enabledOpacity,
|
|
166
|
+
"&:focus-within": { outline: `${e.vars.size.borderStroke.container} ${e.vars.palette.primary.enabled}` }
|
|
167
|
+
})), te = i("input")(({ theme: e }) => ({
|
|
168
|
+
flex: 1,
|
|
169
|
+
minWidth: 0,
|
|
170
|
+
border: 0,
|
|
171
|
+
background: "none",
|
|
172
|
+
padding: "0 4px",
|
|
173
|
+
outline: 0,
|
|
174
|
+
fontFamily: "inherit",
|
|
175
|
+
...d.control,
|
|
176
|
+
color: "inherit",
|
|
177
|
+
"&::placeholder": { color: e.vars.palette.text.disabled, opacity: 1 }
|
|
178
|
+
})), ie = i("div")(() => ({
|
|
179
|
+
display: "flex",
|
|
180
|
+
flexDirection: "column",
|
|
181
|
+
gap: 8
|
|
182
|
+
})), re = i("section")(() => ({
|
|
183
|
+
display: "flex",
|
|
184
|
+
flexDirection: "column",
|
|
185
|
+
gap: 2
|
|
186
|
+
})), oe = i("h2")({
|
|
187
|
+
...D,
|
|
188
|
+
margin: 0
|
|
189
|
+
}), ne = i("div")(
|
|
190
|
+
({ ownerState: e }) => ({
|
|
191
|
+
display: "grid",
|
|
192
|
+
gridTemplateRows: e.expanded ? "1fr" : "0fr",
|
|
193
|
+
transition: `grid-template-rows ${s}`,
|
|
194
|
+
"& > *": {
|
|
195
|
+
opacity: e.expanded ? 1 : 0,
|
|
196
|
+
transition: `opacity ${s}`
|
|
197
|
+
},
|
|
198
|
+
"@media (prefers-reduced-motion: reduce)": {
|
|
199
|
+
transition: "none",
|
|
200
|
+
"& > *": { transition: "none" }
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
), ae = i("div")({
|
|
204
|
+
minHeight: 0,
|
|
205
|
+
overflow: "hidden"
|
|
206
|
+
}), de = i("div")(() => ({
|
|
207
|
+
display: "flex",
|
|
208
|
+
flexDirection: "column",
|
|
209
|
+
gap: 4
|
|
210
|
+
})), se = i("section")(
|
|
211
|
+
({ ownerState: e, theme: t }) => {
|
|
212
|
+
const { primary: r, common: n } = t.vars.palette, { borderRadius: o } = t.vars.size, a = p(t);
|
|
213
|
+
return {
|
|
214
|
+
position: "relative",
|
|
215
|
+
borderRadius: e.current && !e.nested ? o.r3 : o.r2,
|
|
216
|
+
...e.nested && { paddingLeft: 6 },
|
|
217
|
+
...!e.nested && e.current && {
|
|
218
|
+
overflow: "hidden",
|
|
219
|
+
background: `linear-gradient(${a}, transparent)`,
|
|
220
|
+
boxShadow: `0 4px 8px -4px ${r.enabledOpacity}, 0 2px 27px 2px ${r.opacity}`,
|
|
221
|
+
"&::before": {
|
|
222
|
+
content: '""',
|
|
223
|
+
position: "absolute",
|
|
224
|
+
inset: 0,
|
|
225
|
+
padding: 1,
|
|
226
|
+
borderRadius: "inherit",
|
|
227
|
+
backgroundImage: `linear-gradient(to bottom, ${r.selectedOpacity}, ${r.enabledOpacity})`,
|
|
228
|
+
mask: `linear-gradient(${n.white} 0 0) content-box, linear-gradient(${n.white} 0 0)`,
|
|
229
|
+
maskComposite: "exclude",
|
|
230
|
+
pointerEvents: "none"
|
|
231
|
+
},
|
|
232
|
+
"&:has(> button:focus-visible)": {
|
|
233
|
+
"&::before": {
|
|
234
|
+
backgroundImage: `linear-gradient(to bottom, ${r.semanticText}, ${r.enabledOpacity})`
|
|
235
|
+
},
|
|
236
|
+
"& > button:focus-visible": { outline: "none" }
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
), le = i("button")(
|
|
242
|
+
({ ownerState: e, theme: t }) => {
|
|
243
|
+
const { primary: r, default: n, text: o } = t.vars.palette;
|
|
244
|
+
return {
|
|
245
|
+
...c,
|
|
246
|
+
display: "flex",
|
|
247
|
+
alignItems: "center",
|
|
248
|
+
width: "100%",
|
|
249
|
+
height: e.nested ? 28 : 32,
|
|
250
|
+
padding: e.nested ? "0 4px 0 8px" : "0 8px 0 4px",
|
|
251
|
+
gap: e.nested ? 10 : 8,
|
|
252
|
+
borderRadius: 8,
|
|
253
|
+
color: e.current ? r.semanticText : "inherit",
|
|
254
|
+
...e.nested ? d.item : d.section,
|
|
255
|
+
"& > :last-child": { color: e.current ? "inherit" : o.secondary },
|
|
256
|
+
"&:hover": { backgroundColor: n.hoverOpacity },
|
|
257
|
+
"&:focus-visible": { outline: `1px solid ${r.focus}`, outlineOffset: -1 }
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
), ce = i("span")(() => ({
|
|
261
|
+
...A,
|
|
262
|
+
flex: 1
|
|
263
|
+
})), u = i("span")({
|
|
264
|
+
display: "inline-flex",
|
|
265
|
+
alignItems: "center",
|
|
266
|
+
justifyContent: "center",
|
|
267
|
+
flex: "none",
|
|
268
|
+
width: 16,
|
|
269
|
+
height: 16,
|
|
270
|
+
"& svg, & img": { width: 16, height: 16, display: "block" },
|
|
271
|
+
"& > .M4LIcon-root": {
|
|
272
|
+
width: 16,
|
|
273
|
+
height: 16,
|
|
274
|
+
"& .M4LIcon-icon": {
|
|
275
|
+
backgroundColor: "currentColor",
|
|
276
|
+
maskPosition: "center",
|
|
277
|
+
maskRepeat: "no-repeat",
|
|
278
|
+
maskSize: "contain"
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
'& svg:not([fill="none"]), & svg [fill]:not([fill="none"], defs *, mask *, clipPath *)': { fill: "currentColor" },
|
|
282
|
+
'& svg[stroke]:not([stroke="none"]), & svg [stroke]:not([stroke="none"], defs *, mask *, clipPath *)': { stroke: "currentColor" }
|
|
283
|
+
}), pe = i(u)({
|
|
284
|
+
"& svg": { width: 11, height: 11 }
|
|
285
|
+
}), be = i(u)(
|
|
286
|
+
({ ownerState: e, theme: t }) => ({
|
|
287
|
+
...e.nested ? { color: e.current ? "inherit" : t.vars.palette.text.secondary } : {
|
|
288
|
+
width: 24,
|
|
289
|
+
height: 24,
|
|
290
|
+
borderRadius: 8,
|
|
291
|
+
backgroundColor: e.current ? t.vars.palette.primary.enabledOpacity : t.vars.palette.default.hoverOpacity
|
|
292
|
+
}
|
|
293
|
+
})
|
|
294
|
+
), ue = i(u)(
|
|
295
|
+
({ ownerState: e }) => ({
|
|
296
|
+
transform: e.expanded ? "none" : "rotate(180deg)",
|
|
297
|
+
transition: `transform ${s}`,
|
|
298
|
+
"@media (prefers-reduced-motion: reduce)": { transition: "none" }
|
|
299
|
+
})
|
|
300
|
+
), ge = i("div")(
|
|
301
|
+
({ ownerState: e, theme: t }) => {
|
|
302
|
+
const { baseSpacings: r } = t.vars.size, { disabled: n, secondary: o } = t.vars.palette.border, a = e.nested ? r.sp3 : r["sp3-5"], b = r["sp1-5"], g = `min(${r["sp5-5"]}, 50%)`;
|
|
303
|
+
return {
|
|
304
|
+
padding: e.nested ? `0 0 0 ${a}` : `0 ${r.sp2} ${r.sp2} ${a}`,
|
|
305
|
+
...e.withGuide && {
|
|
306
|
+
position: "relative",
|
|
307
|
+
// Draw the guide for the whole group so selected rows and injected style tags cannot split it.
|
|
308
|
+
"&::before": {
|
|
309
|
+
content: '""',
|
|
310
|
+
position: "absolute",
|
|
311
|
+
top: b,
|
|
312
|
+
bottom: e.nested ? b : `calc(${r.sp2} + ${b})`,
|
|
313
|
+
left: a,
|
|
314
|
+
width: 1,
|
|
315
|
+
pointerEvents: "none",
|
|
316
|
+
backgroundImage: `linear-gradient(to bottom, ${n}, ${o} ${g},
|
|
317
|
+
${o} calc(100% - ${g}), ${n})`
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
), he = i("div")(
|
|
323
|
+
({ ownerState: e, theme: t }) => {
|
|
324
|
+
const { primary: r } = t.vars.palette;
|
|
325
|
+
return {
|
|
326
|
+
position: "relative",
|
|
327
|
+
paddingLeft: e.nested ? 6 : 0,
|
|
328
|
+
...e.nested && e.selected && {
|
|
329
|
+
"&::after": {
|
|
330
|
+
content: '""',
|
|
331
|
+
position: "absolute",
|
|
332
|
+
width: 5,
|
|
333
|
+
height: 5,
|
|
334
|
+
left: -2,
|
|
335
|
+
top: 13,
|
|
336
|
+
borderRadius: 2,
|
|
337
|
+
background: r.focus,
|
|
338
|
+
boxShadow: `0 0 4px ${r.activeOpacity}`
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
), B = i("div")(
|
|
344
|
+
({ ownerState: e, theme: t }) => {
|
|
345
|
+
const { primary: r, default: n, text: o } = t.vars.palette;
|
|
346
|
+
return {
|
|
347
|
+
display: "flex",
|
|
348
|
+
alignItems: "center",
|
|
349
|
+
height: l.lh28,
|
|
350
|
+
borderRadius: 8,
|
|
351
|
+
paddingRight: 4,
|
|
352
|
+
background: e.selected ? `linear-gradient(to right, ${r.selected}, ${r.enabled})` : "transparent",
|
|
353
|
+
color: e.selected ? r.contrastText : o.primary,
|
|
354
|
+
...!e.selected && { "&:hover, &:focus-within": { background: n.hoverOpacity } },
|
|
355
|
+
"&:hover > [data-sidebar-actions], &:focus-within > [data-sidebar-actions]": { display: "flex" }
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
), _ = i("button")(({ theme: e }) => ({
|
|
359
|
+
...c,
|
|
360
|
+
display: "flex",
|
|
361
|
+
alignItems: "center",
|
|
362
|
+
height: l.lh28,
|
|
363
|
+
flex: 1,
|
|
364
|
+
minWidth: 0,
|
|
365
|
+
borderRadius: 8,
|
|
366
|
+
gap: 10,
|
|
367
|
+
padding: "0 6px 0 8px",
|
|
368
|
+
...d.item,
|
|
369
|
+
"& > [data-sidebar-icon]": { color: e.vars.palette.text.secondary },
|
|
370
|
+
'&[aria-current="page"] > [data-sidebar-icon], &[aria-checked="true"] > [data-sidebar-icon]': {
|
|
371
|
+
color: "inherit"
|
|
372
|
+
},
|
|
373
|
+
"&:focus-visible": { outline: `1px solid ${e.vars.palette.primary.focus}`, outlineOffset: -1 }
|
|
374
|
+
})), fe = i("span")(() => ({
|
|
375
|
+
display: "none",
|
|
376
|
+
alignItems: "center",
|
|
377
|
+
flex: "none",
|
|
378
|
+
gap: 2,
|
|
379
|
+
"@media (hover: none)": { display: "flex" }
|
|
380
|
+
})), me = i("button")(
|
|
381
|
+
({ theme: e, ownerState: t }) => {
|
|
382
|
+
const { primary: r, default: n, text: o, error: a } = e.vars.palette;
|
|
383
|
+
return {
|
|
384
|
+
...c,
|
|
385
|
+
display: "inline-flex",
|
|
386
|
+
justifyContent: "center",
|
|
387
|
+
alignItems: "center",
|
|
388
|
+
width: 20,
|
|
389
|
+
height: 20,
|
|
390
|
+
borderRadius: 6,
|
|
391
|
+
flex: "none",
|
|
392
|
+
background: t.pinned ? r.enabledOpacity : n.enabled,
|
|
393
|
+
color: t.pinned ? r.semanticText : t.destructive ? a.semanticText : o.secondary,
|
|
394
|
+
"&:hover": { background: n.hover },
|
|
395
|
+
"&:focus-visible": { outline: `1px solid ${r.focus}` },
|
|
396
|
+
...t.selected && {
|
|
397
|
+
background: t.pinned ? r.selected : r.enabled,
|
|
398
|
+
color: r.contrastText,
|
|
399
|
+
"&:hover": { background: r.hover },
|
|
400
|
+
"&:active": { background: r.active }
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
), xe = i("div")(({ theme: e }) => ({
|
|
405
|
+
padding: "8px 4px",
|
|
406
|
+
color: e.vars.palette.text.disabled,
|
|
407
|
+
...d.hint
|
|
408
|
+
})), ve = i("footer")(({ theme: e }) => ({
|
|
409
|
+
marginTop: 1,
|
|
410
|
+
flexShrink: 0,
|
|
411
|
+
padding: "12px 8px 0",
|
|
412
|
+
minHeight: 22,
|
|
413
|
+
borderTop: `1px solid ${e.vars.palette.border.disabled}`
|
|
414
|
+
})), ye = i(_)(({ theme: e }) => ({
|
|
415
|
+
width: "100%",
|
|
416
|
+
justifyContent: "center",
|
|
417
|
+
marginBottom: 8,
|
|
418
|
+
backgroundColor: e.vars.palette.primary.enabledOpacity,
|
|
419
|
+
color: e.vars.palette.primary.semanticText
|
|
420
|
+
})), ke = i("div")({
|
|
421
|
+
display: "flex",
|
|
422
|
+
alignItems: "center",
|
|
423
|
+
justifyContent: "center",
|
|
424
|
+
flexShrink: 0,
|
|
425
|
+
gap: 6,
|
|
426
|
+
height: 9,
|
|
427
|
+
"&&& .MuiTypography-root": {
|
|
428
|
+
...S.small.microStandard,
|
|
429
|
+
fontWeight: k.semibold600,
|
|
430
|
+
letterSpacing: f["dens0-8"],
|
|
431
|
+
whiteSpace: "nowrap",
|
|
432
|
+
textOverflow: "ellipsis",
|
|
433
|
+
overflow: "hidden"
|
|
434
|
+
}
|
|
435
|
+
}), Se = i(w)(({ theme: e }) => ({
|
|
436
|
+
"&&&": { width: 1, height: 9, flexShrink: 0, borderColor: e.vars.palette.border.secondary }
|
|
437
|
+
})), $e = i(m)(({ ownerState: e }) => ({
|
|
438
|
+
filter: e.themeMode === "dark" ? x : v
|
|
439
|
+
})), Ie = i("span")(({ theme: e }) => ({
|
|
440
|
+
...C,
|
|
441
|
+
display: "inline-flex",
|
|
442
|
+
flexShrink: 0,
|
|
443
|
+
color: e.vars.palette.text.disabled,
|
|
444
|
+
"& > svg": { width: "100%", height: "100%" }
|
|
445
|
+
})), Oe = i(I)(({ theme: e }) => {
|
|
446
|
+
const t = p(e);
|
|
447
|
+
return {
|
|
448
|
+
"& .MuiPopover-paper": {
|
|
449
|
+
display: "flex",
|
|
450
|
+
flexDirection: "column",
|
|
451
|
+
gap: 2,
|
|
452
|
+
padding: 12,
|
|
453
|
+
minWidth: 223,
|
|
454
|
+
maxWidth: 300,
|
|
455
|
+
borderRadius: 12,
|
|
456
|
+
border: `2px solid ${t}`,
|
|
457
|
+
backgroundColor: e.vars.palette.background.blur,
|
|
458
|
+
backdropFilter: "blur(8px)",
|
|
459
|
+
boxShadow: `inset 0 0 16px ${t}, ${e.vars.customShadows.z3}`
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
}), Re = i(B)(({ theme: e, ownerState: t }) => ({
|
|
463
|
+
background: t.selected ? e.vars.palette.primary.enabledOpacity : "transparent",
|
|
464
|
+
color: t.selected ? e.vars.palette.primary.semanticText : e.vars.palette.text.primary,
|
|
465
|
+
"& [data-sidebar-actions]": { display: t.selected ? "flex" : void 0 },
|
|
466
|
+
'& button[role="menuitemradio"]': d.control
|
|
467
|
+
}));
|
|
468
|
+
export {
|
|
469
|
+
me as SidebarAction,
|
|
470
|
+
fe as SidebarActions,
|
|
471
|
+
Se as SidebarAttributionDivider,
|
|
472
|
+
$e as SidebarAttributionLogo,
|
|
473
|
+
Ie as SidebarAttributionMark,
|
|
474
|
+
ke as SidebarAttributionRoot,
|
|
475
|
+
se as SidebarBranch,
|
|
476
|
+
be as SidebarBranchGlyph,
|
|
477
|
+
le as SidebarBranchToggle,
|
|
478
|
+
de as SidebarBranches,
|
|
479
|
+
Q as SidebarBrandBadge,
|
|
480
|
+
X as SidebarBrandHeader,
|
|
481
|
+
J as SidebarBrandLogo,
|
|
482
|
+
ue as SidebarChevron,
|
|
483
|
+
ge as SidebarChildren,
|
|
484
|
+
ve as SidebarChromeFooter,
|
|
485
|
+
U as SidebarChromeHeader,
|
|
486
|
+
ne as SidebarDisclosure,
|
|
487
|
+
ae as SidebarDisclosureClip,
|
|
488
|
+
q as SidebarDrawer,
|
|
489
|
+
xe as SidebarEmpty,
|
|
490
|
+
ye as SidebarFooterAction,
|
|
491
|
+
N as SidebarFrame,
|
|
492
|
+
u as SidebarGlyph,
|
|
493
|
+
re as SidebarGroup,
|
|
494
|
+
oe as SidebarGroupHeading,
|
|
495
|
+
Oe as SidebarInstancePopover,
|
|
496
|
+
Re as SidebarInstanceRow,
|
|
497
|
+
ce as SidebarLabel,
|
|
498
|
+
ie as SidebarMenu,
|
|
499
|
+
K as SidebarPanel,
|
|
500
|
+
_ as SidebarPrimaryAction,
|
|
501
|
+
Z as SidebarResizeHandle,
|
|
502
|
+
B as SidebarRowBody,
|
|
503
|
+
he as SidebarRowFrame,
|
|
504
|
+
V as SidebarScroll,
|
|
505
|
+
ee as SidebarSearch,
|
|
506
|
+
te as SidebarSearchInput,
|
|
507
|
+
pe as SidebarSmallGlyph
|
|
508
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { GetLabelType, HostThemeMode } from '@m4l/core';
|
|
2
|
+
import { MouseEvent as ReactMouseEvent, ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { AreasStoreStateWithActions } from '../../../areas/contexts/AreasContext/types';
|
|
4
|
+
import { MenuDataType, SideBarNavigationOptions, SideBarProps } from '../../types';
|
|
5
|
+
export interface SidebarNavigationProps extends SideBarProps {
|
|
6
|
+
navigation: SideBarNavigationOptions;
|
|
7
|
+
}
|
|
8
|
+
export interface SidebarAreas {
|
|
9
|
+
activeAreaId: string;
|
|
10
|
+
activeWindowId?: string;
|
|
11
|
+
windows: AreasStoreStateWithActions['hashWindows'];
|
|
12
|
+
selectArea: AreasStoreStateWithActions['areasActions']['selectArea'];
|
|
13
|
+
selectLayout: AreasStoreStateWithActions['areaActions']['selectLayout'];
|
|
14
|
+
closeWindow: AreasStoreStateWithActions['windowActions']['close'];
|
|
15
|
+
}
|
|
16
|
+
export interface SidebarNavigationPanelProps extends SidebarNavigationProps {
|
|
17
|
+
areas?: SidebarAreas;
|
|
18
|
+
}
|
|
19
|
+
export interface SidebarBrandingProps {
|
|
20
|
+
logo: SideBarProps['companyLogoSmallUrl'];
|
|
21
|
+
title: string;
|
|
22
|
+
badgeColor: SideBarNavigationOptions['badgeColor'];
|
|
23
|
+
}
|
|
24
|
+
export interface SidebarAttributionProps {
|
|
25
|
+
logo: string | ReactElement;
|
|
26
|
+
label: string;
|
|
27
|
+
}
|
|
28
|
+
export interface SidebarLogoState {
|
|
29
|
+
themeMode: HostThemeMode;
|
|
30
|
+
}
|
|
31
|
+
export interface SidebarEntry {
|
|
32
|
+
id: string;
|
|
33
|
+
item: MenuDataType;
|
|
34
|
+
children?: SidebarEntry[];
|
|
35
|
+
}
|
|
36
|
+
export interface SidebarInstance {
|
|
37
|
+
windowId: string;
|
|
38
|
+
areaId: string;
|
|
39
|
+
moduleId: string;
|
|
40
|
+
title: string;
|
|
41
|
+
moduleCount?: number;
|
|
42
|
+
}
|
|
43
|
+
export interface SidebarSelection {
|
|
44
|
+
entryId: string;
|
|
45
|
+
areaId?: string;
|
|
46
|
+
favoriteId?: string;
|
|
47
|
+
windowId?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface SidebarInstanceMenu {
|
|
50
|
+
entry: SidebarEntry;
|
|
51
|
+
anchor: HTMLElement;
|
|
52
|
+
}
|
|
53
|
+
export interface SidebarLabelTooltipProps {
|
|
54
|
+
title: string;
|
|
55
|
+
children: (label: ReactElement) => ReactElement;
|
|
56
|
+
}
|
|
57
|
+
export interface SidebarRowProps {
|
|
58
|
+
title: string;
|
|
59
|
+
icon: ReactNode;
|
|
60
|
+
selected: boolean;
|
|
61
|
+
pinned: boolean;
|
|
62
|
+
favoriteShortcut?: boolean;
|
|
63
|
+
nested?: boolean;
|
|
64
|
+
onSelect: (event: ReactMouseEvent<HTMLButtonElement>) => void;
|
|
65
|
+
onPin: () => void;
|
|
66
|
+
onAdd?: (event: ReactMouseEvent<HTMLButtonElement>) => void;
|
|
67
|
+
getLabel: GetLabelType;
|
|
68
|
+
}
|
|
69
|
+
export interface SidebarInstancesProps {
|
|
70
|
+
menu: SidebarInstanceMenu;
|
|
71
|
+
instances: SidebarInstance[];
|
|
72
|
+
selectedWindowId?: string;
|
|
73
|
+
favorites: string[];
|
|
74
|
+
icon: ReactNode;
|
|
75
|
+
getLabel: GetLabelType;
|
|
76
|
+
onSelect: (instance: SidebarInstance) => void;
|
|
77
|
+
onToggleFavorite: (id: string) => void;
|
|
78
|
+
onCloseInstance: (windowId: string) => void;
|
|
79
|
+
onDismiss: () => void;
|
|
80
|
+
}
|
|
81
|
+
export interface SidebarSizeState {
|
|
82
|
+
width: number;
|
|
83
|
+
expanded: boolean;
|
|
84
|
+
resizing: boolean;
|
|
85
|
+
}
|
|
86
|
+
export interface SidebarResizeDrag {
|
|
87
|
+
pointerId: number;
|
|
88
|
+
startX: number;
|
|
89
|
+
startWidth: number;
|
|
90
|
+
width: number;
|
|
91
|
+
}
|
|
92
|
+
export interface SidebarDisclosureState {
|
|
93
|
+
expanded: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface SidebarBranchState {
|
|
96
|
+
current: boolean;
|
|
97
|
+
nested: boolean;
|
|
98
|
+
}
|
|
99
|
+
export interface SidebarRowState {
|
|
100
|
+
selected: boolean;
|
|
101
|
+
nested: boolean;
|
|
102
|
+
}
|
|
103
|
+
export interface SidebarActionState {
|
|
104
|
+
pinned?: boolean;
|
|
105
|
+
selected?: boolean;
|
|
106
|
+
destructive?: boolean;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/SideBar/subcomponents/SideBarNavigation/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { KeyboardEvent as ReactKeyboardEvent, PointerEvent as ReactPointerEvent } from 'react';
|
|
2
|
+
/** Preview a drag within the prototype's desktop limits and save the completed adjustment. */
|
|
3
|
+
export declare function useSidebarResize(savedWidth: number, onWidthChange: (width: number) => void): {
|
|
4
|
+
width: number;
|
|
5
|
+
resizing: boolean;
|
|
6
|
+
handle: {
|
|
7
|
+
onPointerDown: (event: ReactPointerEvent<HTMLButtonElement>) => void;
|
|
8
|
+
onPointerMove: (event: ReactPointerEvent<HTMLButtonElement>) => void;
|
|
9
|
+
onPointerUp: (event: ReactPointerEvent<HTMLButtonElement>) => void;
|
|
10
|
+
onPointerCancel: (event: ReactPointerEvent<HTMLButtonElement>) => void;
|
|
11
|
+
onLostPointerCapture: (event: ReactPointerEvent<HTMLButtonElement>) => void;
|
|
12
|
+
onDoubleClick: () => void;
|
|
13
|
+
onKeyDown: (event: ReactKeyboardEvent<HTMLButtonElement>) => void;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=useSidebarResize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSidebarResize.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/SideBar/subcomponents/SideBarNavigation/useSidebarResize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,IAAI,kBAAkB,EAAE,KAAK,YAAY,IAAI,iBAAiB,EAAoB,MAAM,OAAO,CAAC;AAM3H,8FAA8F;AAC9F,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;;;;+BAK3D,iBAAiB,CAAC,iBAAiB,CAAC;+BAepC,iBAAiB,CAAC,iBAAiB,CAAC;6BASrC,iBAAiB,CAAC,iBAAiB,CAAC;iCAApC,iBAAiB,CAAC,iBAAiB,CAAC;sCAApC,iBAAiB,CAAC,iBAAiB,CAAC;;2BAcvC,kBAAkB,CAAC,iBAAiB,CAAC;;EAqBhE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useState as p, useRef as f } from "react";
|
|
2
|
+
import { SIDEBAR_WIDTH as w } from "../../constants.js";
|
|
3
|
+
import { resolveSidebarWidth as s } from "../../helpers/resolveSidebarWidth.js";
|
|
4
|
+
import { SIDEBAR_KEYBOARD_RESIZE_STEP as D } from "./constants.js";
|
|
5
|
+
function R(o, n) {
|
|
6
|
+
const [d, e] = p(), i = f(void 0), u = (t) => {
|
|
7
|
+
t.button !== 0 || i.current || (t.currentTarget.setPointerCapture(t.pointerId), i.current = {
|
|
8
|
+
pointerId: t.pointerId,
|
|
9
|
+
startX: t.clientX,
|
|
10
|
+
startWidth: o,
|
|
11
|
+
width: o
|
|
12
|
+
}, e(o));
|
|
13
|
+
}, a = (t) => {
|
|
14
|
+
const r = i.current;
|
|
15
|
+
r?.pointerId === t.pointerId && (r.width = s(r.startWidth + t.clientX - r.startX), e(r.width));
|
|
16
|
+
}, c = (t) => {
|
|
17
|
+
const r = i.current;
|
|
18
|
+
r?.pointerId === t.pointerId && (i.current = void 0, r.width !== r.startWidth && n(r.width), e(void 0));
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
width: d ?? o,
|
|
22
|
+
resizing: d !== void 0,
|
|
23
|
+
handle: {
|
|
24
|
+
onPointerDown: u,
|
|
25
|
+
onPointerMove: a,
|
|
26
|
+
onPointerUp: c,
|
|
27
|
+
onPointerCancel: c,
|
|
28
|
+
onLostPointerCapture: c,
|
|
29
|
+
onDoubleClick: () => n(w.default),
|
|
30
|
+
onKeyDown: (t) => {
|
|
31
|
+
if (t.key === "ArrowLeft" || t.key === "ArrowRight") {
|
|
32
|
+
t.preventDefault();
|
|
33
|
+
const r = t.key === "ArrowLeft" ? -1 : 1;
|
|
34
|
+
n(s(o + r * D));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
R as useSidebarResize
|
|
42
|
+
};
|