@ozen-ui/kit 0.84.0 → 0.84.2
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/__inner__/cjs/components/List/List.css +4 -4
- package/__inner__/cjs/components/Sidebar/Sidebar.css +1 -0
- package/__inner__/cjs/components/Sidebar/Sidebar.js +2 -4
- package/__inner__/cjs/components/Sidebar/modules/SidebarCollapsibleItem/SidebarCollapsibleItem.css +12 -6
- package/__inner__/cjs/components/Sidebar/modules/SidebarCollapsibleItem/SidebarCollapsibleItem.js +12 -5
- package/__inner__/cjs/components/Sidebar/modules/SidebarHeaderLogo/SidebarHeaderLogo.css +0 -1
- package/__inner__/cjs/components/Sidebar/modules/SidebarHeaderLogo/SidebarHeaderLogo.js +4 -1
- package/__inner__/cjs/components/Sidebar/modules/SidebarItem/SidebarItem.css +1 -2
- package/__inner__/cjs/components/Sidebar/modules/SidebarItem/SidebarItem.js +4 -1
- package/__inner__/cjs/components/Sidebar/modules/SidebarUser/SidebarUser.css +27 -6
- package/__inner__/cjs/components/Sidebar/modules/SidebarUser/SidebarUser.js +11 -5
- package/__inner__/cjs/components/Sidebar/modules/SidebarUserMenu/SidebarUserMenu.css +22 -11
- package/__inner__/cjs/components/Sidebar/modules/SidebarUserMenu/SidebarUserMenu.js +13 -7
- package/__inner__/cjs/components/Sidebar/modules/SidebarUserMenu/constants.js +4 -1
- package/__inner__/esm/components/List/List.css +4 -4
- package/__inner__/esm/components/Sidebar/Sidebar.css +1 -0
- package/__inner__/esm/components/Sidebar/Sidebar.js +2 -4
- package/__inner__/esm/components/Sidebar/modules/SidebarCollapsibleItem/SidebarCollapsibleItem.css +12 -6
- package/__inner__/esm/components/Sidebar/modules/SidebarCollapsibleItem/SidebarCollapsibleItem.js +13 -6
- package/__inner__/esm/components/Sidebar/modules/SidebarHeaderLogo/SidebarHeaderLogo.css +0 -1
- package/__inner__/esm/components/Sidebar/modules/SidebarHeaderLogo/SidebarHeaderLogo.js +4 -1
- package/__inner__/esm/components/Sidebar/modules/SidebarItem/SidebarItem.css +1 -2
- package/__inner__/esm/components/Sidebar/modules/SidebarItem/SidebarItem.js +4 -1
- package/__inner__/esm/components/Sidebar/modules/SidebarUser/SidebarUser.css +27 -6
- package/__inner__/esm/components/Sidebar/modules/SidebarUser/SidebarUser.js +11 -5
- package/__inner__/esm/components/Sidebar/modules/SidebarUserMenu/SidebarUserMenu.css +22 -11
- package/__inner__/esm/components/Sidebar/modules/SidebarUserMenu/SidebarUserMenu.js +15 -9
- package/__inner__/esm/components/Sidebar/modules/SidebarUserMenu/constants.js +3 -0
- package/__inner__/types/components/Sidebar/modules/SidebarCollapsibleItem/types.d.ts +5 -0
- package/__inner__/types/components/Sidebar/modules/SidebarUser/types.d.ts +2 -0
- package/__inner__/types/components/Sidebar/modules/SidebarUserMenu/constants.d.ts +3 -0
- package/__inner__/types/components/Sidebar/modules/SidebarUserMenu/types.d.ts +6 -1
- package/__inner__/types/components/Sidebar/types.d.ts +2 -0
- package/package.json +4 -4
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
--list-item-avatar-min-width: 24px;
|
|
47
47
|
--list-item-padding: 4px 8px;
|
|
48
48
|
--list-item-children-margin-right: 8px;
|
|
49
|
-
--list-pipka-height:
|
|
50
|
-
--list-pipka-width:
|
|
49
|
+
--list-pipka-height: 32px;
|
|
50
|
+
--list-pipka-width: 2px;
|
|
51
51
|
--list-item-border-radius: var(--border-radius-m);
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
--list-item-avatar-min-width: 32px;
|
|
59
59
|
--list-item-padding: 6px 12px;
|
|
60
60
|
--list-item-children-margin-right: 12px;
|
|
61
|
-
--list-pipka-height:
|
|
62
|
-
--list-pipka-width:
|
|
61
|
+
--list-pipka-height: 32px;
|
|
62
|
+
--list-pipka-width: 2px;
|
|
63
63
|
--list-item-border-radius: var(--border-radius-l);
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -27,7 +27,7 @@ exports.Sidebar = (0, utils_1.polymorphicComponentWithRef)(function (inProps, re
|
|
|
27
27
|
name: 'Sidebar',
|
|
28
28
|
props: inProps,
|
|
29
29
|
});
|
|
30
|
-
var children = props.children, className = props.className, _b = props.as, Tag = _b === void 0 ? constants_1.SIDEBAR_DEFAULT_TAG : _b, _c = props.variant, variant = _c === void 0 ? constants_1.SIDEBAR_DEFAULT_VARIANT : _c, _d = props.rounded, rounded = _d === void 0 ? constants_1.SIDEBAR_DEFAULT_ROUNDED : _d, _e = props.size, size = _e === void 0 ? constants_1.SIDEBAR_DEFAULT_SIZE : _e, _f = props.color, color = _f === void 0 ? constants_1.SIDEBAR_DEFAULT_COLOR : _f, sizer = props.sizer, sizerWrapperProps = props.sizerWrapperProps, style = props.style, other = tslib_1.__rest(props, ["children", "className", "as", "variant", "rounded", "size", "color", "sizer", "sizerWrapperProps", "style"]);
|
|
30
|
+
var children = props.children, className = props.className, _b = props.as, Tag = _b === void 0 ? constants_1.SIDEBAR_DEFAULT_TAG : _b, _c = props.variant, variant = _c === void 0 ? constants_1.SIDEBAR_DEFAULT_VARIANT : _c, _d = props.rounded, rounded = _d === void 0 ? constants_1.SIDEBAR_DEFAULT_ROUNDED : _d, _e = props.size, size = _e === void 0 ? constants_1.SIDEBAR_DEFAULT_SIZE : _e, _f = props.color, color = _f === void 0 ? constants_1.SIDEBAR_DEFAULT_COLOR : _f, sizer = props.sizer, sizerWrapperProps = props.sizerWrapperProps, style = props.style, forceShowSizer = props.forceShowSizer, other = tslib_1.__rest(props, ["children", "className", "as", "variant", "rounded", "size", "color", "sizer", "sizerWrapperProps", "style", "forceShowSizer"]);
|
|
31
31
|
var memoizedContextValue = (0, react_1.useMemo)(function () { return ({ variant: variant, size: size, color: color }); }, [variant, size, color]);
|
|
32
32
|
var width = constants_1.SIDEBAR_WIDTH_BY_VARIANT[size][variant];
|
|
33
33
|
return (react_1.default.createElement(SidebarContext_1.SidebarContext.Provider, { value: memoizedContextValue },
|
|
@@ -35,8 +35,6 @@ exports.Sidebar = (0, utils_1.polymorphicComponentWithRef)(function (inProps, re
|
|
|
35
35
|
_a[constants_1.SIDEBAR_CSS_VARIABLE.WIDTH] = "".concat(width, "px"),
|
|
36
36
|
_a))), className: (0, exports.cnSidebar)({ variant: variant, rounded: rounded, size: size, color: color }, [className]) }),
|
|
37
37
|
children,
|
|
38
|
-
sizer && (react_1.default.createElement("div", tslib_1.__assign({}, sizerWrapperProps, { className: (0, exports.cnSidebar)('SizerWrapper', [
|
|
39
|
-
sizerWrapperProps === null || sizerWrapperProps === void 0 ? void 0 : sizerWrapperProps.className,
|
|
40
|
-
]) }),
|
|
38
|
+
sizer && (react_1.default.createElement("div", tslib_1.__assign({}, sizerWrapperProps, { className: (0, exports.cnSidebar)('SizerWrapper', { forceShow: forceShowSizer }, [sizerWrapperProps === null || sizerWrapperProps === void 0 ? void 0 : sizerWrapperProps.className]) }),
|
|
41
39
|
react_1.default.createElement("div", { className: (0, exports.cnSidebar)('Sizer') }, sizer))))));
|
|
42
40
|
});
|
package/__inner__/cjs/components/Sidebar/modules/SidebarCollapsibleItem/SidebarCollapsibleItem.css
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
z-index: 0;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
.SidebarCollapsibleItem_collapsed .SidebarCollapsibleItem-
|
|
6
|
+
.SidebarCollapsibleItem_collapsed .SidebarCollapsibleItem-ContentWrapper {
|
|
7
7
|
opacity: 0;
|
|
8
8
|
max-inline-size: 0;
|
|
9
9
|
margin-inline-start: 0;
|
|
@@ -14,26 +14,32 @@
|
|
|
14
14
|
z-index: 1;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.SidebarCollapsibleItem-
|
|
17
|
+
.SidebarCollapsibleItem-ContentWrapper {
|
|
18
18
|
display: flex;
|
|
19
19
|
flex-shrink: 0;
|
|
20
20
|
margin-inline-start: var(--sidebar-collapsible-item-gap);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
.SidebarCollapsibleItem-Content
|
|
24
|
-
|
|
23
|
+
.SidebarCollapsibleItem-Content {
|
|
24
|
+
box-sizing: border-box;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.SidebarCollapsibleItem_center {
|
|
28
28
|
margin-inline: auto;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.
|
|
31
|
+
.Sidebar_variant_full .SidebarCollapsibleItem-Content, .Sidebar_variant_mini .SidebarCollapsibleItem-Content {
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
inline-size: var(--sidebar-collapsible-item-content-width);
|
|
34
|
+
min-inline-size: var(--sidebar-collapsible-item-content-width);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.SidebarCollapsibleItem_animated .SidebarCollapsibleItem-ContentWrapper {
|
|
32
38
|
transition: var(--transition-default);
|
|
33
39
|
transition-property: opacity, transform, max-inline-size, margin-inline;
|
|
34
40
|
}
|
|
35
41
|
|
|
36
|
-
.SidebarCollapsibleItem_animated.SidebarCollapsibleItem_collapsed .SidebarCollapsibleItem-
|
|
42
|
+
.SidebarCollapsibleItem_animated.SidebarCollapsibleItem_collapsed .SidebarCollapsibleItem-ContentWrapper {
|
|
37
43
|
transform: translateX(calc(var(--sidebar-collapsible-item-gap) * -1));
|
|
38
44
|
transition-duration: 100ms;
|
|
39
45
|
}
|
package/__inner__/cjs/components/Sidebar/modules/SidebarCollapsibleItem/SidebarCollapsibleItem.js
CHANGED
|
@@ -17,8 +17,8 @@ exports.SidebarCollapsibleItem = (0, utils_1.polymorphicComponentWithRef)(functi
|
|
|
17
17
|
props: inProps,
|
|
18
18
|
name: 'SidebarCollapsibleItem',
|
|
19
19
|
});
|
|
20
|
-
var _a = props.as, as = _a === void 0 ? constants_1.SIDEBAR_COLLAPSIBLE_ITEM_DEFAULT_TAG : _a, className = props.className, fixed = props.fixed, classNames = props.classNames, _b = props.justify, justify = _b === void 0 ? constants_1.SIDEBAR_COLLAPSIBLE_ITEM_DEFAULT_JUSTIFY : _b, _c = props.animated, animated = _c === void 0 ? true : _c, children = props.children, collapsed = props.collapsed, _d = props.autoCenter, autoCenter = _d === void 0 ? constants_1.SIDEBAR_COLLAPSIBLE_ITEM_AUTO_CENTER : _d, other = tslib_1.__rest(props, ["as", "className", "fixed", "classNames", "justify", "animated", "children", "collapsed", "autoCenter"]);
|
|
21
|
-
var
|
|
20
|
+
var _a = props.as, as = _a === void 0 ? constants_1.SIDEBAR_COLLAPSIBLE_ITEM_DEFAULT_TAG : _a, className = props.className, fixed = props.fixed, classNames = props.classNames, _b = props.justify, justify = _b === void 0 ? constants_1.SIDEBAR_COLLAPSIBLE_ITEM_DEFAULT_JUSTIFY : _b, _c = props.animated, animated = _c === void 0 ? true : _c, children = props.children, collapsed = props.collapsed, _d = props.autoCenter, autoCenter = _d === void 0 ? constants_1.SIDEBAR_COLLAPSIBLE_ITEM_AUTO_CENTER : _d, contentFullWidth = props.contentFullWidth, other = tslib_1.__rest(props, ["as", "className", "fixed", "classNames", "justify", "animated", "children", "collapsed", "autoCenter", "contentFullWidth"]);
|
|
21
|
+
var _e = (0, SidebarContext_1.useSidebarContext)(), variant = _e.variant, size = _e.size;
|
|
22
22
|
var isCollapsed = collapsed !== null && collapsed !== void 0 ? collapsed : variant === 'mini';
|
|
23
23
|
var internalRef = (0, react_1.useRef)(null);
|
|
24
24
|
var itemRef = (0, useMultiRef_1.useMultiRef)([ref, internalRef]);
|
|
@@ -29,15 +29,22 @@ exports.SidebarCollapsibleItem = (0, utils_1.polymorphicComponentWithRef)(functi
|
|
|
29
29
|
props: { collapsed: isCollapsed },
|
|
30
30
|
})
|
|
31
31
|
: fixed;
|
|
32
|
-
var
|
|
32
|
+
var _f = (0, hooks_1.useSidebarCollapsibleItemAnimation)({
|
|
33
33
|
autoCenter: autoCenter,
|
|
34
34
|
ref: internalRef,
|
|
35
35
|
fixedRef: fixedRef,
|
|
36
36
|
isCollapsed: isCollapsed,
|
|
37
|
-
}), onExit =
|
|
37
|
+
}), onExit = _f.onExit, onEnter = _f.onEnter, onTransitionEnd = _f.onTransitionEnd, hasMarginAutoClass = _f.hasMarginAutoClass;
|
|
38
38
|
return (react_1.default.createElement(react_transition_group_1.CSSTransition, { nodeRef: internalRef, in: isCollapsed, timeout: { enter: 120, exit: 120 }, appear: true, onEnter: onEnter, onExit: onExit, onEntered: onTransitionEnd, onExited: onTransitionEnd },
|
|
39
39
|
react_1.default.createElement(Stack_1.Stack, tslib_1.__assign({}, other, { ref: itemRef, as: as, className: (0, exports.cnSidebarCollapsibleItem)({ collapsed: isCollapsed, animated: animated, center: hasMarginAutoClass }, [className]), justify: justify }),
|
|
40
40
|
react_1.default.createElement("div", { ref: fixedRef, className: (0, exports.cnSidebarCollapsibleItem)('Fixed', [classNames === null || classNames === void 0 ? void 0 : classNames.fixed]) }, fixedRendered),
|
|
41
|
-
react_1.default.createElement("div", { className: (0, exports.cnSidebarCollapsibleItem)('
|
|
41
|
+
react_1.default.createElement("div", { className: (0, exports.cnSidebarCollapsibleItem)('ContentWrapper', [
|
|
42
|
+
classNames === null || classNames === void 0 ? void 0 : classNames.contentWrapper,
|
|
43
|
+
]), style: (0, utils_1.generateCSSVariables)({
|
|
44
|
+
'sidebar-collapsible-item-content-width': "".concat(contentFullWidth[size], "px"),
|
|
45
|
+
}) },
|
|
46
|
+
react_1.default.createElement("div", { className: (0, exports.cnSidebarCollapsibleItem)('Content', [
|
|
47
|
+
classNames === null || classNames === void 0 ? void 0 : classNames.content,
|
|
48
|
+
]) }, children)))));
|
|
42
49
|
});
|
|
43
50
|
exports.SidebarCollapsibleItem.displayName = 'SidebarCollapsibleItem';
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
letter-spacing: var(--typography-text-m_1-letter_spacing, 0);
|
|
21
21
|
text-transform: var(--typography-text-m_1-text_transform, none);
|
|
22
22
|
color: var(--sidebar-content-primary-color);
|
|
23
|
-
white-space: nowrap;
|
|
24
23
|
}
|
|
25
24
|
.SidebarHeaderLogo-Icon {
|
|
26
25
|
background-color: var(--sidebar-header-icon-background);
|
|
@@ -17,6 +17,9 @@ exports.SidebarHeaderLogo = (0, utils_1.polymorphicComponentWithRef)(function (i
|
|
|
17
17
|
});
|
|
18
18
|
var _a = props.as, as = _a === void 0 ? constants_1.SIDEBAR_HEADER_LOGO_DEFAULT_TAG : _a, className = props.className, children = props.children, icon = props.icon, other = tslib_1.__rest(props, ["as", "className", "children", "icon"]);
|
|
19
19
|
var _b = (0, SidebarContext_1.useSidebarContext)(), color = _b.color, variant = _b.variant, size = _b.size;
|
|
20
|
-
return (react_1.default.createElement(SidebarCollapsibleItem_1.SidebarCollapsibleItem, tslib_1.__assign({}, other, { as: as, fixed: react_1.default.createElement(Stack_1.Stack, { className: (0, exports.cnSidebarHeaderLogo)('Icon'), justify: "center", align: "center" }, icon), collapsed: variant !== 'full', classNames: { content: (0, exports.cnSidebarHeaderLogo)('Text') }, ref: ref, className: (0, exports.cnSidebarHeaderLogo)({ color: color, size: size }, [className]), align: "center"
|
|
20
|
+
return (react_1.default.createElement(SidebarCollapsibleItem_1.SidebarCollapsibleItem, tslib_1.__assign({}, other, { as: as, fixed: react_1.default.createElement(Stack_1.Stack, { className: (0, exports.cnSidebarHeaderLogo)('Icon'), justify: "center", align: "center" }, icon), collapsed: variant !== 'full', classNames: { content: (0, exports.cnSidebarHeaderLogo)('Text') }, ref: ref, className: (0, exports.cnSidebarHeaderLogo)({ color: color, size: size }, [className]), align: "center", contentFullWidth: {
|
|
21
|
+
s: 184,
|
|
22
|
+
m: 200,
|
|
23
|
+
} }), children));
|
|
21
24
|
});
|
|
22
25
|
exports.SidebarHeaderLogo.displayName = 'SidebarHeaderLogo';
|
|
@@ -54,7 +54,10 @@ exports.SidebarItem = (0, utils_1.polymorphicComponentWithRef)(function (inProps
|
|
|
54
54
|
react_1.default.createElement(SidebarCollapsibleItem_1.SidebarCollapsibleItem, tslib_1.__assign({}, other, { as: as, onClick: function (event) {
|
|
55
55
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
56
56
|
setIsOpenSubItems(!isOpenSubitems);
|
|
57
|
-
}, collapsed: isCollapsed, className: (0, exports.cnSidebarItem)('Item'),
|
|
57
|
+
}, collapsed: isCollapsed, className: (0, exports.cnSidebarItem)('Item'), contentFullWidth: {
|
|
58
|
+
s: 180,
|
|
59
|
+
m: 196,
|
|
60
|
+
}, autoCenter: false, fixed: function (props) {
|
|
58
61
|
var badge = (0, utils_1.isFunction)(badgeProp)
|
|
59
62
|
? badgeProp({ collapsed: props.collapsed })
|
|
60
63
|
: badgeProp;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
.SidebarUser {
|
|
2
2
|
--sidebar-collapsible-item-gap: var(--spacing-2xs);
|
|
3
|
+
inline-size: 100%;
|
|
4
|
+
box-sizing: border-box;
|
|
3
5
|
}
|
|
4
6
|
|
|
5
7
|
.SidebarUser-Indicator {
|
|
@@ -8,17 +10,36 @@
|
|
|
8
10
|
|
|
9
11
|
.SidebarUser-Name {
|
|
10
12
|
color: var(--sidebar-content-primary-color);
|
|
13
|
+
white-space: nowrap;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
text-overflow: ellipsis;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.SidebarUser-Fixed {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
11
21
|
}
|
|
12
22
|
|
|
13
23
|
.SidebarUser-Content {
|
|
14
24
|
display: flex;
|
|
15
|
-
|
|
16
|
-
justify-content:
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: var(--spacing-xs)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.SidebarUser-Info {
|
|
32
|
+
flex: 1;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.SidebarUser-After {
|
|
17
37
|
flex-shrink: 0;
|
|
18
|
-
|
|
38
|
+
transition: var(--transition-slow) opacity;
|
|
39
|
+
opacity: 1;
|
|
19
40
|
}
|
|
20
41
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
42
|
+
.SidebarCollapsibleItem_collapsed .SidebarUser-After {
|
|
43
|
+
opacity: 0;
|
|
44
|
+
transition-duration: 0ms;
|
|
24
45
|
}
|
|
@@ -6,6 +6,7 @@ var react_1 = tslib_1.__importDefault(require("react"));
|
|
|
6
6
|
var useThemeProps_1 = require("../../../../hooks/useThemeProps");
|
|
7
7
|
var utils_1 = require("../../../../utils");
|
|
8
8
|
var Avatar_1 = require("../../../Avatar");
|
|
9
|
+
var Stack_1 = require("../../../Stack");
|
|
9
10
|
var Typography_1 = require("../../../Typography");
|
|
10
11
|
var SidebarContext_1 = require("../../SidebarContext");
|
|
11
12
|
var SidebarCollapsibleItem_1 = require("../SidebarCollapsibleItem");
|
|
@@ -17,17 +18,22 @@ exports.SidebarUser = (0, utils_1.polymorphicComponentWithRef)(function (inProps
|
|
|
17
18
|
props: inProps,
|
|
18
19
|
name: 'SidebarUser',
|
|
19
20
|
});
|
|
20
|
-
var _b = props.as, as = _b === void 0 ? constants_1.SIDEBAR_USER_DEFAULT_TAG : _b, className = props.className, avatarProps = props.avatarProps, name = props.name, online = props.online, status = props.status, other = tslib_1.__rest(props, ["as", "className", "avatarProps", "name", "online", "status"]);
|
|
21
|
+
var _b = props.as, as = _b === void 0 ? constants_1.SIDEBAR_USER_DEFAULT_TAG : _b, className = props.className, avatarProps = props.avatarProps, name = props.name, online = props.online, status = props.status, after = props.after, other = tslib_1.__rest(props, ["as", "className", "avatarProps", "name", "online", "status", "after"]);
|
|
21
22
|
var _c = (0, SidebarContext_1.useSidebarContext)(), variant = _c.variant, size = _c.size;
|
|
22
|
-
var hasStatus = !!status;
|
|
23
23
|
var isCollapsed = variant !== 'full';
|
|
24
24
|
return (react_1.default.createElement(SidebarCollapsibleItem_1.SidebarCollapsibleItem, tslib_1.__assign({}, other, { ref: ref, as: as, className: (0, exports.cnSidebarUser)('', [className]), fixed: react_1.default.createElement(Avatar_1.Avatar, tslib_1.__assign({}, avatarProps, { online: (0, utils_1.isFunction)(online) ? online({ collapsed: isCollapsed }) : online, name: (_a = avatarProps === null || avatarProps === void 0 ? void 0 : avatarProps.name) !== null && _a !== void 0 ? _a : name, size: constants_1.SIDEBAR_USER_SIZE_TO_AVATAR[size], indicatorProps: { className: (0, exports.cnSidebarUser)('Indicator') }, className: (0, exports.cnSidebarUser)('Avatar', [avatarProps === null || avatarProps === void 0 ? void 0 : avatarProps.className]), colorScheme: {
|
|
25
25
|
text: 'content-primary',
|
|
26
26
|
background: 'background-tertiary',
|
|
27
27
|
} })), collapsed: isCollapsed, classNames: {
|
|
28
|
-
content: (0, exports.cnSidebarUser)('Content'
|
|
28
|
+
content: (0, exports.cnSidebarUser)('Content'),
|
|
29
|
+
fixed: (0, exports.cnSidebarUser)('Fixed'),
|
|
30
|
+
}, contentFullWidth: {
|
|
31
|
+
s: 184,
|
|
32
|
+
m: 200,
|
|
29
33
|
} }),
|
|
30
|
-
react_1.default.createElement(
|
|
31
|
-
|
|
34
|
+
react_1.default.createElement(Stack_1.Stack, { direction: "column", className: (0, exports.cnSidebarUser)('Info') },
|
|
35
|
+
react_1.default.createElement(Typography_1.Typography, { variant: "text-s", as: "span", className: (0, exports.cnSidebarUser)('Name') }, name),
|
|
36
|
+
status),
|
|
37
|
+
after && (react_1.default.createElement(Stack_1.Stack, { display: "block", align: "center", justify: "center", className: (0, exports.cnSidebarUser)('After') }, after))));
|
|
32
38
|
});
|
|
33
39
|
exports.SidebarUser.displayName = 'SidebarUser';
|
|
@@ -1,34 +1,45 @@
|
|
|
1
|
-
/* stylelint-disable */
|
|
2
1
|
.SidebarUserMenu-Button_color_main.ButtonNext {
|
|
3
2
|
--button-font-color: var(--color-content-primary);
|
|
4
3
|
--button-font-color-hover: var(--color-content-primary);
|
|
5
4
|
--button-font-color-active: var(--color-content-primary);
|
|
6
5
|
--button-font-color-focus: var(--color-content-primary);
|
|
7
6
|
}
|
|
8
|
-
.SidebarUserMenu-Button_color_accent.ButtonNext {
|
|
7
|
+
.SidebarUserMenu-Button_color_accent.ButtonNext {
|
|
9
8
|
--button-font-color: var(--color-content-primary-inverse);
|
|
10
9
|
--button-font-color-hover: var(--color-content-primary-inverse);
|
|
11
10
|
--button-font-color-active: var(--color-content-primary-inverse);
|
|
12
11
|
--button-font-color-focus: var(--color-content-primary-inverse);
|
|
13
12
|
}
|
|
14
|
-
.SidebarUserMenu-Chevron {
|
|
13
|
+
.SidebarUserMenu-Chevron {
|
|
15
14
|
transform: rotate(0deg);
|
|
16
15
|
transition: var(--transition-default) transform;
|
|
16
|
+
flex-shrink: 0;
|
|
17
17
|
}
|
|
18
|
-
.SidebarUserMenu-Button.ButtonNext {
|
|
18
|
+
.SidebarUserMenu-Button.ButtonNext {
|
|
19
19
|
inline-size: -moz-fit-content;
|
|
20
20
|
inline-size: fit-content;
|
|
21
|
+
max-inline-size: 100%;
|
|
21
22
|
justify-content: flex-start;
|
|
22
23
|
}
|
|
23
|
-
.SidebarUserMenu-Button .ButtonNext-Content {
|
|
24
|
+
.SidebarUserMenu-Button .ButtonNext-Content {
|
|
24
25
|
flex-grow: initial;
|
|
25
26
|
gap: var(--spacing-3xs);
|
|
26
27
|
}
|
|
27
|
-
.SidebarUserMenu-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
.SidebarUserMenu-Button_open .SidebarUserMenu-Chevron {
|
|
28
|
+
.SidebarUserMenu-Button_manyLines .SidebarUserMenu-Label {
|
|
29
|
+
white-space: normal;
|
|
30
|
+
}
|
|
31
|
+
.SidebarUserMenu-Button_open .SidebarUserMenu-Chevron {
|
|
33
32
|
transform: rotate(180deg);
|
|
34
33
|
}
|
|
34
|
+
.SidebarUserMenu-Button .SidebarUserMenu-LabelWrapper {
|
|
35
|
+
overflow: initial;
|
|
36
|
+
text-overflow: initial;
|
|
37
|
+
white-space: initial;
|
|
38
|
+
}
|
|
39
|
+
.SidebarUserMenu-Label {
|
|
40
|
+
display: -webkit-box;
|
|
41
|
+
-webkit-box-orient: block-axis;
|
|
42
|
+
-webkit-line-clamp: var(--sidebar-user-menu-ellipsis);
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
text-align: start;
|
|
45
|
+
}
|
|
@@ -10,35 +10,41 @@ var useThemeProps_1 = require("../../../../hooks/useThemeProps");
|
|
|
10
10
|
var utils_1 = require("../../../../utils");
|
|
11
11
|
var ButtonNext_1 = require("../../../ButtonNext");
|
|
12
12
|
var Menu_1 = require("../../../Menu");
|
|
13
|
+
var Typography_1 = require("../../../Typography");
|
|
13
14
|
var SidebarContext_1 = require("../../SidebarContext");
|
|
14
15
|
var constants_1 = require("./constants");
|
|
15
16
|
exports.cnSidebarUserMenu = (0, utils_1.cn)('SidebarUserMenu');
|
|
16
17
|
exports.SidebarUserMenu = (0, utils_1.polymorphicComponentWithRef)(function (inProps, ref) {
|
|
18
|
+
var _a;
|
|
17
19
|
var props = (0, useThemeProps_1.useThemeProps)({
|
|
18
20
|
props: inProps,
|
|
19
21
|
name: 'SidebarUserMenu',
|
|
20
22
|
});
|
|
21
|
-
var
|
|
23
|
+
var _b = props.as, as = _b === void 0 ? constants_1.SIDEBAR_USER_MENU_DEFAULT_TAG : _b, className = props.className, children = props.children, label = props.label, _c = props.labelVariant, labelVariant = _c === void 0 ? constants_1.SIDEBAR_USER_MENU_DEFAULT_LABEL_VARIANT : _c, open = props.open, onOpenChange = props.onOpenChange, menuProps = props.menuProps, onClick = props.onClick, _d = props.maxLines, maxLines = _d === void 0 ? constants_1.SIDEBAR_USER_MENU_DEFAULT_MAX_LINES : _d, other = tslib_1.__rest(props, ["as", "className", "children", "label", "labelVariant", "open", "onOpenChange", "menuProps", "onClick", "maxLines"]);
|
|
22
24
|
var color = (0, SidebarContext_1.useSidebarContext)().color;
|
|
23
25
|
var buttonRef = (0, react_1.useRef)(null);
|
|
24
|
-
var
|
|
26
|
+
var _e = tslib_1.__read((0, useControlled_1.useControlled)({
|
|
25
27
|
name: 'SidebarUserMenu',
|
|
26
28
|
value: open,
|
|
27
29
|
defaultValue: false,
|
|
28
30
|
state: 'isOpen',
|
|
29
|
-
}), 2), isOpen =
|
|
31
|
+
}), 2), isOpen = _e[0], setIsOpenState = _e[1];
|
|
30
32
|
var setIsOpen = function (isOpen) {
|
|
31
33
|
setIsOpenState(isOpen);
|
|
32
34
|
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange({ open: isOpen });
|
|
33
35
|
};
|
|
36
|
+
var isManyLines = maxLines > 1;
|
|
34
37
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
35
38
|
react_1.default.createElement(ButtonNext_1.Button, tslib_1.__assign({}, other, { as: as, ref: (0, useMultiRef_1.useMultiRef)([ref, buttonRef]), variant: "function", onClick: function (event) {
|
|
36
39
|
setIsOpen(!isOpen);
|
|
37
40
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
}, style: (0, utils_1.generateCSSVariables)({
|
|
42
|
+
'sidebar-user-menu-ellipsis': maxLines.toString(),
|
|
43
|
+
}), className: (0, exports.cnSidebarUserMenu)('Button', { color: color, open: isOpen, manyLines: isManyLines }, [className]), labelProps: {
|
|
44
|
+
className: (0, exports.cnSidebarUserMenu)('LabelWrapper'),
|
|
45
|
+
}, size: "2xs", iconRight: react_1.default.createElement(icons_1.ChevronDownSmallIcon, { className: (0, exports.cnSidebarUserMenu)('Chevron') }) }),
|
|
46
|
+
react_1.default.createElement(Typography_1.Typography, { variant: labelVariant, className: (0, exports.cnSidebarUserMenu)('Label'), color: "inherit", as: "span" }, label)),
|
|
47
|
+
react_1.default.createElement(Menu_1.Menu, tslib_1.__assign({ placement: "right-end" }, menuProps, { size: (_a = menuProps === null || menuProps === void 0 ? void 0 : menuProps.size) !== null && _a !== void 0 ? _a : constants_1.SIDEBAR_USER_MENU_DEFAULT_MENU_SIZE, anchorRef: buttonRef, open: isOpen, className: (0, exports.cnSidebarUserMenu)('Menu', [menuProps === null || menuProps === void 0 ? void 0 : menuProps.className]), onClose: function () {
|
|
42
48
|
var _a;
|
|
43
49
|
setIsOpen(false);
|
|
44
50
|
(_a = menuProps === null || menuProps === void 0 ? void 0 : menuProps.onClose) === null || _a === void 0 ? void 0 : _a.call(menuProps);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SIDEBAR_USER_MENU_DEFAULT_TAG = void 0;
|
|
3
|
+
exports.SIDEBAR_USER_MENU_DEFAULT_MENU_SIZE = exports.SIDEBAR_USER_MENU_DEFAULT_LABEL_VARIANT = exports.SIDEBAR_USER_MENU_DEFAULT_MAX_LINES = exports.SIDEBAR_USER_MENU_DEFAULT_TAG = void 0;
|
|
4
4
|
var ButtonNext_1 = require("../../../ButtonNext");
|
|
5
5
|
exports.SIDEBAR_USER_MENU_DEFAULT_TAG = ButtonNext_1.BUTTON_DEFAULT_TAG;
|
|
6
|
+
exports.SIDEBAR_USER_MENU_DEFAULT_MAX_LINES = 1;
|
|
7
|
+
exports.SIDEBAR_USER_MENU_DEFAULT_LABEL_VARIANT = 'text-2xs_1';
|
|
8
|
+
exports.SIDEBAR_USER_MENU_DEFAULT_MENU_SIZE = 'xs';
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
--list-item-avatar-min-width: 24px;
|
|
47
47
|
--list-item-padding: 4px 8px;
|
|
48
48
|
--list-item-children-margin-right: 8px;
|
|
49
|
-
--list-pipka-height:
|
|
50
|
-
--list-pipka-width:
|
|
49
|
+
--list-pipka-height: 32px;
|
|
50
|
+
--list-pipka-width: 2px;
|
|
51
51
|
--list-item-border-radius: var(--border-radius-m);
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
--list-item-avatar-min-width: 32px;
|
|
59
59
|
--list-item-padding: 6px 12px;
|
|
60
60
|
--list-item-children-margin-right: 12px;
|
|
61
|
-
--list-pipka-height:
|
|
62
|
-
--list-pipka-width:
|
|
61
|
+
--list-pipka-height: 32px;
|
|
62
|
+
--list-pipka-width: 2px;
|
|
63
63
|
--list-item-border-radius: var(--border-radius-l);
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -24,7 +24,7 @@ export var Sidebar = polymorphicComponentWithRef(function (inProps, ref) {
|
|
|
24
24
|
name: 'Sidebar',
|
|
25
25
|
props: inProps,
|
|
26
26
|
});
|
|
27
|
-
var children = props.children, className = props.className, _b = props.as, Tag = _b === void 0 ? SIDEBAR_DEFAULT_TAG : _b, _c = props.variant, variant = _c === void 0 ? SIDEBAR_DEFAULT_VARIANT : _c, _d = props.rounded, rounded = _d === void 0 ? SIDEBAR_DEFAULT_ROUNDED : _d, _e = props.size, size = _e === void 0 ? SIDEBAR_DEFAULT_SIZE : _e, _f = props.color, color = _f === void 0 ? SIDEBAR_DEFAULT_COLOR : _f, sizer = props.sizer, sizerWrapperProps = props.sizerWrapperProps, style = props.style, other = __rest(props, ["children", "className", "as", "variant", "rounded", "size", "color", "sizer", "sizerWrapperProps", "style"]);
|
|
27
|
+
var children = props.children, className = props.className, _b = props.as, Tag = _b === void 0 ? SIDEBAR_DEFAULT_TAG : _b, _c = props.variant, variant = _c === void 0 ? SIDEBAR_DEFAULT_VARIANT : _c, _d = props.rounded, rounded = _d === void 0 ? SIDEBAR_DEFAULT_ROUNDED : _d, _e = props.size, size = _e === void 0 ? SIDEBAR_DEFAULT_SIZE : _e, _f = props.color, color = _f === void 0 ? SIDEBAR_DEFAULT_COLOR : _f, sizer = props.sizer, sizerWrapperProps = props.sizerWrapperProps, style = props.style, forceShowSizer = props.forceShowSizer, other = __rest(props, ["children", "className", "as", "variant", "rounded", "size", "color", "sizer", "sizerWrapperProps", "style", "forceShowSizer"]);
|
|
28
28
|
var memoizedContextValue = useMemo(function () { return ({ variant: variant, size: size, color: color }); }, [variant, size, color]);
|
|
29
29
|
var width = SIDEBAR_WIDTH_BY_VARIANT[size][variant];
|
|
30
30
|
return (React.createElement(SidebarContext.Provider, { value: memoizedContextValue },
|
|
@@ -32,8 +32,6 @@ export var Sidebar = polymorphicComponentWithRef(function (inProps, ref) {
|
|
|
32
32
|
_a[SIDEBAR_CSS_VARIABLE.WIDTH] = "".concat(width, "px"),
|
|
33
33
|
_a))), className: cnSidebar({ variant: variant, rounded: rounded, size: size, color: color }, [className]) }),
|
|
34
34
|
children,
|
|
35
|
-
sizer && (React.createElement("div", __assign({}, sizerWrapperProps, { className: cnSidebar('SizerWrapper', [
|
|
36
|
-
sizerWrapperProps === null || sizerWrapperProps === void 0 ? void 0 : sizerWrapperProps.className,
|
|
37
|
-
]) }),
|
|
35
|
+
sizer && (React.createElement("div", __assign({}, sizerWrapperProps, { className: cnSidebar('SizerWrapper', { forceShow: forceShowSizer }, [sizerWrapperProps === null || sizerWrapperProps === void 0 ? void 0 : sizerWrapperProps.className]) }),
|
|
38
36
|
React.createElement("div", { className: cnSidebar('Sizer') }, sizer))))));
|
|
39
37
|
});
|
package/__inner__/esm/components/Sidebar/modules/SidebarCollapsibleItem/SidebarCollapsibleItem.css
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
z-index: 0;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
.SidebarCollapsibleItem_collapsed .SidebarCollapsibleItem-
|
|
6
|
+
.SidebarCollapsibleItem_collapsed .SidebarCollapsibleItem-ContentWrapper {
|
|
7
7
|
opacity: 0;
|
|
8
8
|
max-inline-size: 0;
|
|
9
9
|
margin-inline-start: 0;
|
|
@@ -14,26 +14,32 @@
|
|
|
14
14
|
z-index: 1;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.SidebarCollapsibleItem-
|
|
17
|
+
.SidebarCollapsibleItem-ContentWrapper {
|
|
18
18
|
display: flex;
|
|
19
19
|
flex-shrink: 0;
|
|
20
20
|
margin-inline-start: var(--sidebar-collapsible-item-gap);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
.SidebarCollapsibleItem-Content
|
|
24
|
-
|
|
23
|
+
.SidebarCollapsibleItem-Content {
|
|
24
|
+
box-sizing: border-box;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.SidebarCollapsibleItem_center {
|
|
28
28
|
margin-inline: auto;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.
|
|
31
|
+
.Sidebar_variant_full .SidebarCollapsibleItem-Content, .Sidebar_variant_mini .SidebarCollapsibleItem-Content {
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
inline-size: var(--sidebar-collapsible-item-content-width);
|
|
34
|
+
min-inline-size: var(--sidebar-collapsible-item-content-width);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.SidebarCollapsibleItem_animated .SidebarCollapsibleItem-ContentWrapper {
|
|
32
38
|
transition: var(--transition-default);
|
|
33
39
|
transition-property: opacity, transform, max-inline-size, margin-inline;
|
|
34
40
|
}
|
|
35
41
|
|
|
36
|
-
.SidebarCollapsibleItem_animated.SidebarCollapsibleItem_collapsed .SidebarCollapsibleItem-
|
|
42
|
+
.SidebarCollapsibleItem_animated.SidebarCollapsibleItem_collapsed .SidebarCollapsibleItem-ContentWrapper {
|
|
37
43
|
transform: translateX(calc(var(--sidebar-collapsible-item-gap) * -1));
|
|
38
44
|
transition-duration: 100ms;
|
|
39
45
|
}
|
package/__inner__/esm/components/Sidebar/modules/SidebarCollapsibleItem/SidebarCollapsibleItem.js
CHANGED
|
@@ -3,7 +3,7 @@ import React, { useRef } from 'react';
|
|
|
3
3
|
import { CSSTransition } from 'react-transition-group';
|
|
4
4
|
import { useMultiRef } from '../../../../hooks/useMultiRef';
|
|
5
5
|
import { useThemeProps } from '../../../../hooks/useThemeProps';
|
|
6
|
-
import { cn, isFunction, polymorphicComponentWithRef, renderContent, } from '../../../../utils';
|
|
6
|
+
import { cn, generateCSSVariables, isFunction, polymorphicComponentWithRef, renderContent, } from '../../../../utils';
|
|
7
7
|
import { Stack } from '../../../Stack';
|
|
8
8
|
import { useSidebarContext } from '../../SidebarContext';
|
|
9
9
|
import { SIDEBAR_COLLAPSIBLE_ITEM_DEFAULT_TAG, SIDEBAR_COLLAPSIBLE_ITEM_DEFAULT_JUSTIFY, SIDEBAR_COLLAPSIBLE_ITEM_AUTO_CENTER, } from './constants';
|
|
@@ -14,8 +14,8 @@ export var SidebarCollapsibleItem = polymorphicComponentWithRef(function (inProp
|
|
|
14
14
|
props: inProps,
|
|
15
15
|
name: 'SidebarCollapsibleItem',
|
|
16
16
|
});
|
|
17
|
-
var _a = props.as, as = _a === void 0 ? SIDEBAR_COLLAPSIBLE_ITEM_DEFAULT_TAG : _a, className = props.className, fixed = props.fixed, classNames = props.classNames, _b = props.justify, justify = _b === void 0 ? SIDEBAR_COLLAPSIBLE_ITEM_DEFAULT_JUSTIFY : _b, _c = props.animated, animated = _c === void 0 ? true : _c, children = props.children, collapsed = props.collapsed, _d = props.autoCenter, autoCenter = _d === void 0 ? SIDEBAR_COLLAPSIBLE_ITEM_AUTO_CENTER : _d, other = __rest(props, ["as", "className", "fixed", "classNames", "justify", "animated", "children", "collapsed", "autoCenter"]);
|
|
18
|
-
var
|
|
17
|
+
var _a = props.as, as = _a === void 0 ? SIDEBAR_COLLAPSIBLE_ITEM_DEFAULT_TAG : _a, className = props.className, fixed = props.fixed, classNames = props.classNames, _b = props.justify, justify = _b === void 0 ? SIDEBAR_COLLAPSIBLE_ITEM_DEFAULT_JUSTIFY : _b, _c = props.animated, animated = _c === void 0 ? true : _c, children = props.children, collapsed = props.collapsed, _d = props.autoCenter, autoCenter = _d === void 0 ? SIDEBAR_COLLAPSIBLE_ITEM_AUTO_CENTER : _d, contentFullWidth = props.contentFullWidth, other = __rest(props, ["as", "className", "fixed", "classNames", "justify", "animated", "children", "collapsed", "autoCenter", "contentFullWidth"]);
|
|
18
|
+
var _e = useSidebarContext(), variant = _e.variant, size = _e.size;
|
|
19
19
|
var isCollapsed = collapsed !== null && collapsed !== void 0 ? collapsed : variant === 'mini';
|
|
20
20
|
var internalRef = useRef(null);
|
|
21
21
|
var itemRef = useMultiRef([ref, internalRef]);
|
|
@@ -26,15 +26,22 @@ export var SidebarCollapsibleItem = polymorphicComponentWithRef(function (inProp
|
|
|
26
26
|
props: { collapsed: isCollapsed },
|
|
27
27
|
})
|
|
28
28
|
: fixed;
|
|
29
|
-
var
|
|
29
|
+
var _f = useSidebarCollapsibleItemAnimation({
|
|
30
30
|
autoCenter: autoCenter,
|
|
31
31
|
ref: internalRef,
|
|
32
32
|
fixedRef: fixedRef,
|
|
33
33
|
isCollapsed: isCollapsed,
|
|
34
|
-
}), onExit =
|
|
34
|
+
}), onExit = _f.onExit, onEnter = _f.onEnter, onTransitionEnd = _f.onTransitionEnd, hasMarginAutoClass = _f.hasMarginAutoClass;
|
|
35
35
|
return (React.createElement(CSSTransition, { nodeRef: internalRef, in: isCollapsed, timeout: { enter: 120, exit: 120 }, appear: true, onEnter: onEnter, onExit: onExit, onEntered: onTransitionEnd, onExited: onTransitionEnd },
|
|
36
36
|
React.createElement(Stack, __assign({}, other, { ref: itemRef, as: as, className: cnSidebarCollapsibleItem({ collapsed: isCollapsed, animated: animated, center: hasMarginAutoClass }, [className]), justify: justify }),
|
|
37
37
|
React.createElement("div", { ref: fixedRef, className: cnSidebarCollapsibleItem('Fixed', [classNames === null || classNames === void 0 ? void 0 : classNames.fixed]) }, fixedRendered),
|
|
38
|
-
React.createElement("div", { className: cnSidebarCollapsibleItem('
|
|
38
|
+
React.createElement("div", { className: cnSidebarCollapsibleItem('ContentWrapper', [
|
|
39
|
+
classNames === null || classNames === void 0 ? void 0 : classNames.contentWrapper,
|
|
40
|
+
]), style: generateCSSVariables({
|
|
41
|
+
'sidebar-collapsible-item-content-width': "".concat(contentFullWidth[size], "px"),
|
|
42
|
+
}) },
|
|
43
|
+
React.createElement("div", { className: cnSidebarCollapsibleItem('Content', [
|
|
44
|
+
classNames === null || classNames === void 0 ? void 0 : classNames.content,
|
|
45
|
+
]) }, children)))));
|
|
39
46
|
});
|
|
40
47
|
SidebarCollapsibleItem.displayName = 'SidebarCollapsibleItem';
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
letter-spacing: var(--typography-text-m_1-letter_spacing, 0);
|
|
21
21
|
text-transform: var(--typography-text-m_1-text_transform, none);
|
|
22
22
|
color: var(--sidebar-content-primary-color);
|
|
23
|
-
white-space: nowrap;
|
|
24
23
|
}
|
|
25
24
|
.SidebarHeaderLogo-Icon {
|
|
26
25
|
background-color: var(--sidebar-header-icon-background);
|
|
@@ -14,6 +14,9 @@ export var SidebarHeaderLogo = polymorphicComponentWithRef(function (inProps, re
|
|
|
14
14
|
});
|
|
15
15
|
var _a = props.as, as = _a === void 0 ? SIDEBAR_HEADER_LOGO_DEFAULT_TAG : _a, className = props.className, children = props.children, icon = props.icon, other = __rest(props, ["as", "className", "children", "icon"]);
|
|
16
16
|
var _b = useSidebarContext(), color = _b.color, variant = _b.variant, size = _b.size;
|
|
17
|
-
return (React.createElement(SidebarCollapsibleItem, __assign({}, other, { as: as, fixed: React.createElement(Stack, { className: cnSidebarHeaderLogo('Icon'), justify: "center", align: "center" }, icon), collapsed: variant !== 'full', classNames: { content: cnSidebarHeaderLogo('Text') }, ref: ref, className: cnSidebarHeaderLogo({ color: color, size: size }, [className]), align: "center"
|
|
17
|
+
return (React.createElement(SidebarCollapsibleItem, __assign({}, other, { as: as, fixed: React.createElement(Stack, { className: cnSidebarHeaderLogo('Icon'), justify: "center", align: "center" }, icon), collapsed: variant !== 'full', classNames: { content: cnSidebarHeaderLogo('Text') }, ref: ref, className: cnSidebarHeaderLogo({ color: color, size: size }, [className]), align: "center", contentFullWidth: {
|
|
18
|
+
s: 184,
|
|
19
|
+
m: 200,
|
|
20
|
+
} }), children));
|
|
18
21
|
});
|
|
19
22
|
SidebarHeaderLogo.displayName = 'SidebarHeaderLogo';
|
|
@@ -51,7 +51,10 @@ export var SidebarItem = polymorphicComponentWithRef(function (inProps, ref) {
|
|
|
51
51
|
React.createElement(SidebarCollapsibleItem, __assign({}, other, { as: as, onClick: function (event) {
|
|
52
52
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
53
53
|
setIsOpenSubItems(!isOpenSubitems);
|
|
54
|
-
}, collapsed: isCollapsed, className: cnSidebarItem('Item'),
|
|
54
|
+
}, collapsed: isCollapsed, className: cnSidebarItem('Item'), contentFullWidth: {
|
|
55
|
+
s: 180,
|
|
56
|
+
m: 196,
|
|
57
|
+
}, autoCenter: false, fixed: function (props) {
|
|
55
58
|
var badge = isFunction(badgeProp)
|
|
56
59
|
? badgeProp({ collapsed: props.collapsed })
|
|
57
60
|
: badgeProp;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
.SidebarUser {
|
|
2
2
|
--sidebar-collapsible-item-gap: var(--spacing-2xs);
|
|
3
|
+
inline-size: 100%;
|
|
4
|
+
box-sizing: border-box;
|
|
3
5
|
}
|
|
4
6
|
|
|
5
7
|
.SidebarUser-Indicator {
|
|
@@ -8,17 +10,36 @@
|
|
|
8
10
|
|
|
9
11
|
.SidebarUser-Name {
|
|
10
12
|
color: var(--sidebar-content-primary-color);
|
|
13
|
+
white-space: nowrap;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
text-overflow: ellipsis;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.SidebarUser-Fixed {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
11
21
|
}
|
|
12
22
|
|
|
13
23
|
.SidebarUser-Content {
|
|
14
24
|
display: flex;
|
|
15
|
-
|
|
16
|
-
justify-content:
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: var(--spacing-xs)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.SidebarUser-Info {
|
|
32
|
+
flex: 1;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.SidebarUser-After {
|
|
17
37
|
flex-shrink: 0;
|
|
18
|
-
|
|
38
|
+
transition: var(--transition-slow) opacity;
|
|
39
|
+
opacity: 1;
|
|
19
40
|
}
|
|
20
41
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
42
|
+
.SidebarCollapsibleItem_collapsed .SidebarUser-After {
|
|
43
|
+
opacity: 0;
|
|
44
|
+
transition-duration: 0ms;
|
|
24
45
|
}
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { useThemeProps } from '../../../../hooks/useThemeProps';
|
|
4
4
|
import { cn, isFunction, polymorphicComponentWithRef } from '../../../../utils';
|
|
5
5
|
import { Avatar } from '../../../Avatar';
|
|
6
|
+
import { Stack } from '../../../Stack';
|
|
6
7
|
import { Typography } from '../../../Typography';
|
|
7
8
|
import { useSidebarContext } from '../../SidebarContext';
|
|
8
9
|
import { SidebarCollapsibleItem } from '../SidebarCollapsibleItem';
|
|
@@ -14,17 +15,22 @@ export var SidebarUser = polymorphicComponentWithRef(function (inProps, ref) {
|
|
|
14
15
|
props: inProps,
|
|
15
16
|
name: 'SidebarUser',
|
|
16
17
|
});
|
|
17
|
-
var _b = props.as, as = _b === void 0 ? SIDEBAR_USER_DEFAULT_TAG : _b, className = props.className, avatarProps = props.avatarProps, name = props.name, online = props.online, status = props.status, other = __rest(props, ["as", "className", "avatarProps", "name", "online", "status"]);
|
|
18
|
+
var _b = props.as, as = _b === void 0 ? SIDEBAR_USER_DEFAULT_TAG : _b, className = props.className, avatarProps = props.avatarProps, name = props.name, online = props.online, status = props.status, after = props.after, other = __rest(props, ["as", "className", "avatarProps", "name", "online", "status", "after"]);
|
|
18
19
|
var _c = useSidebarContext(), variant = _c.variant, size = _c.size;
|
|
19
|
-
var hasStatus = !!status;
|
|
20
20
|
var isCollapsed = variant !== 'full';
|
|
21
21
|
return (React.createElement(SidebarCollapsibleItem, __assign({}, other, { ref: ref, as: as, className: cnSidebarUser('', [className]), fixed: React.createElement(Avatar, __assign({}, avatarProps, { online: isFunction(online) ? online({ collapsed: isCollapsed }) : online, name: (_a = avatarProps === null || avatarProps === void 0 ? void 0 : avatarProps.name) !== null && _a !== void 0 ? _a : name, size: SIDEBAR_USER_SIZE_TO_AVATAR[size], indicatorProps: { className: cnSidebarUser('Indicator') }, className: cnSidebarUser('Avatar', [avatarProps === null || avatarProps === void 0 ? void 0 : avatarProps.className]), colorScheme: {
|
|
22
22
|
text: 'content-primary',
|
|
23
23
|
background: 'background-tertiary',
|
|
24
24
|
} })), collapsed: isCollapsed, classNames: {
|
|
25
|
-
content: cnSidebarUser('Content'
|
|
25
|
+
content: cnSidebarUser('Content'),
|
|
26
|
+
fixed: cnSidebarUser('Fixed'),
|
|
27
|
+
}, contentFullWidth: {
|
|
28
|
+
s: 184,
|
|
29
|
+
m: 200,
|
|
26
30
|
} }),
|
|
27
|
-
React.createElement(
|
|
28
|
-
|
|
31
|
+
React.createElement(Stack, { direction: "column", className: cnSidebarUser('Info') },
|
|
32
|
+
React.createElement(Typography, { variant: "text-s", as: "span", className: cnSidebarUser('Name') }, name),
|
|
33
|
+
status),
|
|
34
|
+
after && (React.createElement(Stack, { display: "block", align: "center", justify: "center", className: cnSidebarUser('After') }, after))));
|
|
29
35
|
});
|
|
30
36
|
SidebarUser.displayName = 'SidebarUser';
|
|
@@ -1,34 +1,45 @@
|
|
|
1
|
-
/* stylelint-disable */
|
|
2
1
|
.SidebarUserMenu-Button_color_main.ButtonNext {
|
|
3
2
|
--button-font-color: var(--color-content-primary);
|
|
4
3
|
--button-font-color-hover: var(--color-content-primary);
|
|
5
4
|
--button-font-color-active: var(--color-content-primary);
|
|
6
5
|
--button-font-color-focus: var(--color-content-primary);
|
|
7
6
|
}
|
|
8
|
-
.SidebarUserMenu-Button_color_accent.ButtonNext {
|
|
7
|
+
.SidebarUserMenu-Button_color_accent.ButtonNext {
|
|
9
8
|
--button-font-color: var(--color-content-primary-inverse);
|
|
10
9
|
--button-font-color-hover: var(--color-content-primary-inverse);
|
|
11
10
|
--button-font-color-active: var(--color-content-primary-inverse);
|
|
12
11
|
--button-font-color-focus: var(--color-content-primary-inverse);
|
|
13
12
|
}
|
|
14
|
-
.SidebarUserMenu-Chevron {
|
|
13
|
+
.SidebarUserMenu-Chevron {
|
|
15
14
|
transform: rotate(0deg);
|
|
16
15
|
transition: var(--transition-default) transform;
|
|
16
|
+
flex-shrink: 0;
|
|
17
17
|
}
|
|
18
|
-
.SidebarUserMenu-Button.ButtonNext {
|
|
18
|
+
.SidebarUserMenu-Button.ButtonNext {
|
|
19
19
|
inline-size: -moz-fit-content;
|
|
20
20
|
inline-size: fit-content;
|
|
21
|
+
max-inline-size: 100%;
|
|
21
22
|
justify-content: flex-start;
|
|
22
23
|
}
|
|
23
|
-
.SidebarUserMenu-Button .ButtonNext-Content {
|
|
24
|
+
.SidebarUserMenu-Button .ButtonNext-Content {
|
|
24
25
|
flex-grow: initial;
|
|
25
26
|
gap: var(--spacing-3xs);
|
|
26
27
|
}
|
|
27
|
-
.SidebarUserMenu-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
.SidebarUserMenu-Button_open .SidebarUserMenu-Chevron {
|
|
28
|
+
.SidebarUserMenu-Button_manyLines .SidebarUserMenu-Label {
|
|
29
|
+
white-space: normal;
|
|
30
|
+
}
|
|
31
|
+
.SidebarUserMenu-Button_open .SidebarUserMenu-Chevron {
|
|
33
32
|
transform: rotate(180deg);
|
|
34
33
|
}
|
|
34
|
+
.SidebarUserMenu-Button .SidebarUserMenu-LabelWrapper {
|
|
35
|
+
overflow: initial;
|
|
36
|
+
text-overflow: initial;
|
|
37
|
+
white-space: initial;
|
|
38
|
+
}
|
|
39
|
+
.SidebarUserMenu-Label {
|
|
40
|
+
display: -webkit-box;
|
|
41
|
+
-webkit-box-orient: block-axis;
|
|
42
|
+
-webkit-line-clamp: var(--sidebar-user-menu-ellipsis);
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
text-align: start;
|
|
45
|
+
}
|
|
@@ -4,38 +4,44 @@ import { ChevronDownSmallIcon } from '@ozen-ui/icons';
|
|
|
4
4
|
import { useControlled } from '../../../../hooks/useControlled';
|
|
5
5
|
import { useMultiRef } from '../../../../hooks/useMultiRef';
|
|
6
6
|
import { useThemeProps } from '../../../../hooks/useThemeProps';
|
|
7
|
-
import { cn, polymorphicComponentWithRef } from '../../../../utils';
|
|
7
|
+
import { cn, generateCSSVariables, polymorphicComponentWithRef, } from '../../../../utils';
|
|
8
8
|
import { Button } from '../../../ButtonNext';
|
|
9
9
|
import { Menu } from '../../../Menu';
|
|
10
|
+
import { Typography } from '../../../Typography';
|
|
10
11
|
import { useSidebarContext } from '../../SidebarContext';
|
|
11
|
-
import { SIDEBAR_USER_MENU_DEFAULT_TAG } from './constants';
|
|
12
|
+
import { SIDEBAR_USER_MENU_DEFAULT_LABEL_VARIANT, SIDEBAR_USER_MENU_DEFAULT_MAX_LINES, SIDEBAR_USER_MENU_DEFAULT_MENU_SIZE, SIDEBAR_USER_MENU_DEFAULT_TAG, } from './constants';
|
|
12
13
|
export var cnSidebarUserMenu = cn('SidebarUserMenu');
|
|
13
14
|
export var SidebarUserMenu = polymorphicComponentWithRef(function (inProps, ref) {
|
|
15
|
+
var _a;
|
|
14
16
|
var props = useThemeProps({
|
|
15
17
|
props: inProps,
|
|
16
18
|
name: 'SidebarUserMenu',
|
|
17
19
|
});
|
|
18
|
-
var
|
|
20
|
+
var _b = props.as, as = _b === void 0 ? SIDEBAR_USER_MENU_DEFAULT_TAG : _b, className = props.className, children = props.children, label = props.label, _c = props.labelVariant, labelVariant = _c === void 0 ? SIDEBAR_USER_MENU_DEFAULT_LABEL_VARIANT : _c, open = props.open, onOpenChange = props.onOpenChange, menuProps = props.menuProps, onClick = props.onClick, _d = props.maxLines, maxLines = _d === void 0 ? SIDEBAR_USER_MENU_DEFAULT_MAX_LINES : _d, other = __rest(props, ["as", "className", "children", "label", "labelVariant", "open", "onOpenChange", "menuProps", "onClick", "maxLines"]);
|
|
19
21
|
var color = useSidebarContext().color;
|
|
20
22
|
var buttonRef = useRef(null);
|
|
21
|
-
var
|
|
23
|
+
var _e = __read(useControlled({
|
|
22
24
|
name: 'SidebarUserMenu',
|
|
23
25
|
value: open,
|
|
24
26
|
defaultValue: false,
|
|
25
27
|
state: 'isOpen',
|
|
26
|
-
}), 2), isOpen =
|
|
28
|
+
}), 2), isOpen = _e[0], setIsOpenState = _e[1];
|
|
27
29
|
var setIsOpen = function (isOpen) {
|
|
28
30
|
setIsOpenState(isOpen);
|
|
29
31
|
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange({ open: isOpen });
|
|
30
32
|
};
|
|
33
|
+
var isManyLines = maxLines > 1;
|
|
31
34
|
return (React.createElement(React.Fragment, null,
|
|
32
35
|
React.createElement(Button, __assign({}, other, { as: as, ref: useMultiRef([ref, buttonRef]), variant: "function", onClick: function (event) {
|
|
33
36
|
setIsOpen(!isOpen);
|
|
34
37
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
}, style: generateCSSVariables({
|
|
39
|
+
'sidebar-user-menu-ellipsis': maxLines.toString(),
|
|
40
|
+
}), className: cnSidebarUserMenu('Button', { color: color, open: isOpen, manyLines: isManyLines }, [className]), labelProps: {
|
|
41
|
+
className: cnSidebarUserMenu('LabelWrapper'),
|
|
42
|
+
}, size: "2xs", iconRight: React.createElement(ChevronDownSmallIcon, { className: cnSidebarUserMenu('Chevron') }) }),
|
|
43
|
+
React.createElement(Typography, { variant: labelVariant, className: cnSidebarUserMenu('Label'), color: "inherit", as: "span" }, label)),
|
|
44
|
+
React.createElement(Menu, __assign({ placement: "right-end" }, menuProps, { size: (_a = menuProps === null || menuProps === void 0 ? void 0 : menuProps.size) !== null && _a !== void 0 ? _a : SIDEBAR_USER_MENU_DEFAULT_MENU_SIZE, anchorRef: buttonRef, open: isOpen, className: cnSidebarUserMenu('Menu', [menuProps === null || menuProps === void 0 ? void 0 : menuProps.className]), onClose: function () {
|
|
39
45
|
var _a;
|
|
40
46
|
setIsOpen(false);
|
|
41
47
|
(_a = menuProps === null || menuProps === void 0 ? void 0 : menuProps.onClose) === null || _a === void 0 ? void 0 : _a.call(menuProps);
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { BUTTON_DEFAULT_TAG } from '../../../ButtonNext';
|
|
2
2
|
export var SIDEBAR_USER_MENU_DEFAULT_TAG = BUTTON_DEFAULT_TAG;
|
|
3
|
+
export var SIDEBAR_USER_MENU_DEFAULT_MAX_LINES = 1;
|
|
4
|
+
export var SIDEBAR_USER_MENU_DEFAULT_LABEL_VARIANT = 'text-2xs_1';
|
|
5
|
+
export var SIDEBAR_USER_MENU_DEFAULT_MENU_SIZE = 'xs';
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import type { ComponentRef, ElementType, ReactNode } from 'react';
|
|
2
2
|
import type { PolymorphicComponentPropsWithRef, RenderContentType } from '../../../../utils';
|
|
3
3
|
import type { StackBaseProps } from '../../../Stack';
|
|
4
|
+
import type { SidebarSizeVariant } from '../../entities';
|
|
4
5
|
import type { SIDEBAR_COLLAPSIBLE_ITEM_DEFAULT_TAG } from './constants';
|
|
5
6
|
export type SidebarCollapsibleItemClassNames = {
|
|
6
7
|
content?: string;
|
|
8
|
+
contentWrapper?: string;
|
|
7
9
|
fixed?: string;
|
|
8
10
|
};
|
|
9
11
|
export type SidebarCollapsibleItemFixedProps = {
|
|
10
12
|
collapsed: boolean;
|
|
11
13
|
};
|
|
12
14
|
export type SidebarCollapsibleItemFixed = RenderContentType<SidebarCollapsibleItemFixedProps>['content'];
|
|
15
|
+
export type SidebarCollapsibleItemContentFullWidth = Record<SidebarSizeVariant, number>;
|
|
13
16
|
export type SidebarCollapsibleItemBaseProps = {
|
|
14
17
|
/** Фиксированная часть */
|
|
15
18
|
fixed: SidebarCollapsibleItemFixed;
|
|
19
|
+
/** Полная ширина контента для full-варианта */
|
|
20
|
+
contentFullWidth: SidebarCollapsibleItemContentFullWidth;
|
|
16
21
|
/** Кастомный класс */
|
|
17
22
|
className?: string;
|
|
18
23
|
/** Кастомный классы блоков */
|
|
@@ -15,6 +15,8 @@ export type SidebarUserBaseProps = {
|
|
|
15
15
|
avatarProps?: Omit<AvatarProps, 'size' | 'online'>;
|
|
16
16
|
/** Компонент статуса */
|
|
17
17
|
status?: ReactNode;
|
|
18
|
+
/** Компонент справа */
|
|
19
|
+
after?: ReactNode;
|
|
18
20
|
/** Идентификатор компонента для тестов */
|
|
19
21
|
'data-testid'?: string;
|
|
20
22
|
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { ComponentRef, ElementType, ReactNode } from 'react';
|
|
2
2
|
import type { PolymorphicComponentPropsWithRef } from '../../../../utils';
|
|
3
3
|
import type { MenuProps } from '../../../Menu';
|
|
4
|
+
import type { TypographyVariant } from '../../../Typography';
|
|
4
5
|
import type { SIDEBAR_USER_MENU_DEFAULT_TAG } from './constants';
|
|
5
6
|
export type SidebarUserMenuBaseProps = {
|
|
6
7
|
/** Кастомный класс */
|
|
7
8
|
className?: string;
|
|
8
9
|
/** Текст кнопки открытия */
|
|
9
10
|
label?: string;
|
|
11
|
+
/** Вариант текста кнопки открытия */
|
|
12
|
+
labelVariant?: TypographyVariant;
|
|
10
13
|
/** Контент меню */
|
|
11
14
|
children: ReactNode;
|
|
12
15
|
/** Текущее состояние списка. Если `true`, список отображается */
|
|
@@ -16,7 +19,9 @@ export type SidebarUserMenuBaseProps = {
|
|
|
16
19
|
open: boolean;
|
|
17
20
|
}) => void;
|
|
18
21
|
/** Свойства компонента Menu */
|
|
19
|
-
menuProps?: Omit<MenuProps, '
|
|
22
|
+
menuProps?: Omit<MenuProps, 'anchorRef' | 'open'>;
|
|
23
|
+
/** Максимальное количество строк */
|
|
24
|
+
maxLines?: number;
|
|
20
25
|
/** Идентификатор компонента для тестов */
|
|
21
26
|
'data-testid'?: string;
|
|
22
27
|
};
|
|
@@ -19,6 +19,8 @@ export type SidebarBaseProps = {
|
|
|
19
19
|
sizer?: ReactNode;
|
|
20
20
|
/** Параметры обертки кнопки изменения размера */
|
|
21
21
|
sizerWrapperProps?: ComponentProps<'div'>;
|
|
22
|
+
/** Флаг принудительного отображения sizer, если `true`, то отображает sizer всегда */
|
|
23
|
+
forceShowSizer?: boolean;
|
|
22
24
|
/** Идентификатор компонента для тестов */
|
|
23
25
|
'data-testid'?: string;
|
|
24
26
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ozen-ui/kit",
|
|
3
|
-
"version": "0.84.
|
|
3
|
+
"version": "0.84.2",
|
|
4
4
|
"description": "React component library",
|
|
5
5
|
"files": [
|
|
6
6
|
"*"
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"react-popper": "^2.3.0",
|
|
30
30
|
"react-transition-group": "^4.4.5",
|
|
31
31
|
"tslib": "^2.6.3",
|
|
32
|
-
"@ozen-ui/fonts": "0.84.
|
|
33
|
-
"@ozen-ui/
|
|
34
|
-
"@ozen-ui/
|
|
32
|
+
"@ozen-ui/fonts": "0.84.2",
|
|
33
|
+
"@ozen-ui/logger": "0.84.2",
|
|
34
|
+
"@ozen-ui/icons": "0.84.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/lodash.isequal": "^4.5.0"
|