@ozen-ui/kit 0.84.2 → 0.84.4
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/DataList/entities/index.js +4 -0
- package/__inner__/cjs/components/DataList/entities/size.js +5 -0
- package/__inner__/cjs/components/DataList/index.js +1 -0
- package/__inner__/cjs/components/List/List.css +32 -7
- package/__inner__/cjs/components/List/List.js +2 -2
- package/__inner__/cjs/components/List/components/ListItemButton/ListItemButton.css +5 -1
- package/__inner__/cjs/components/List/components/ListItemText/ListItemText.css +8 -0
- package/__inner__/cjs/components/List/constants.js +2 -1
- package/__inner__/cjs/components/List/entities/color.js +4 -0
- package/__inner__/cjs/components/List/entities/index.js +5 -0
- package/__inner__/cjs/components/List/entities/size.js +5 -0
- package/__inner__/cjs/components/List/index.js +1 -0
- package/__inner__/cjs/components/Menu/Menu.css +10 -1
- package/__inner__/cjs/components/Menu/Menu.js +19 -3
- package/__inner__/cjs/components/Menu/constants.js +6 -1
- package/__inner__/cjs/components/Menu/entities/color.js +5 -0
- package/__inner__/cjs/components/Menu/entities/index.js +5 -0
- package/__inner__/cjs/components/Menu/entities/size.js +5 -0
- package/__inner__/cjs/components/Menu/index.js +1 -0
- package/__inner__/cjs/components/Sidebar/modules/SidebarUserMenu/SidebarUserMenu.js +1 -1
- package/__inner__/esm/components/DataList/entities/index.js +1 -0
- package/__inner__/esm/components/DataList/entities/size.js +2 -0
- package/__inner__/esm/components/DataList/index.js +1 -0
- package/__inner__/esm/components/List/List.css +32 -7
- package/__inner__/esm/components/List/List.js +3 -3
- package/__inner__/esm/components/List/components/ListItemButton/ListItemButton.css +5 -1
- package/__inner__/esm/components/List/components/ListItemText/ListItemText.css +8 -0
- package/__inner__/esm/components/List/constants.js +1 -0
- package/__inner__/esm/components/List/entities/color.js +1 -0
- package/__inner__/esm/components/List/entities/index.js +2 -0
- package/__inner__/esm/components/List/entities/size.js +2 -0
- package/__inner__/esm/components/List/index.js +1 -0
- package/__inner__/esm/components/Menu/Menu.css +10 -1
- package/__inner__/esm/components/Menu/Menu.js +20 -4
- package/__inner__/esm/components/Menu/constants.js +5 -0
- package/__inner__/esm/components/Menu/entities/color.js +2 -0
- package/__inner__/esm/components/Menu/entities/index.js +2 -0
- package/__inner__/esm/components/Menu/entities/size.js +2 -0
- package/__inner__/esm/components/Menu/index.js +1 -0
- package/__inner__/esm/components/Sidebar/modules/SidebarUserMenu/SidebarUserMenu.js +1 -1
- package/__inner__/types/components/AutocompleteNext/components/AutocompleteDropdown/types.d.ts +1 -1
- package/__inner__/types/components/DataList/entities/index.d.ts +1 -0
- package/__inner__/types/components/DataList/entities/size.d.ts +2 -0
- package/__inner__/types/components/DataList/index.d.ts +1 -0
- package/__inner__/types/components/DataList/types.d.ts +3 -3
- package/__inner__/types/components/List/ListContext.d.ts +4 -1
- package/__inner__/types/components/List/constants.d.ts +1 -0
- package/__inner__/types/components/List/entities/color.d.ts +2 -0
- package/__inner__/types/components/List/entities/index.d.ts +2 -0
- package/__inner__/types/components/List/entities/size.d.ts +2 -0
- package/__inner__/types/components/List/index.d.ts +2 -0
- package/__inner__/types/components/List/types.d.ts +3 -5
- package/__inner__/types/components/Menu/constants.d.ts +5 -0
- package/__inner__/types/components/Menu/entities/color.d.ts +2 -0
- package/__inner__/types/components/Menu/entities/index.d.ts +2 -0
- package/__inner__/types/components/Menu/entities/size.d.ts +2 -0
- package/__inner__/types/components/Menu/index.d.ts +1 -0
- package/__inner__/types/components/Menu/types.d.ts +7 -2
- package/__inner__/types/components/Sidebar/modules/SidebarUserMenu/types.d.ts +1 -1
- package/package.json +4 -4
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./entities"), exports);
|
|
4
5
|
tslib_1.__exportStar(require("./DataList"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./components"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./types"), exports);
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
.List {
|
|
2
2
|
--list-item-bg-color: transparent;
|
|
3
|
-
--list-
|
|
4
|
-
--list-pipka-bg-color: var(--color-content-action);
|
|
5
|
-
--list-item-bg-color-disabled: var(--color-content-tertiary);
|
|
6
|
-
--list-item-bg-color-hover: var(--color-background-main-hover);
|
|
7
|
-
--list-item-bg-color-active: var(--color-background-main-pressed);
|
|
8
|
-
--list-pipka-border-radius: 0 var(--border-radius-xs) var(--border-radius-xs)
|
|
9
|
-
0;
|
|
3
|
+
--list-pipka-border-radius: 0 var(--border-radius-xs) var(--border-radius-xs) 0;
|
|
10
4
|
display: flex;
|
|
11
5
|
flex-direction: column;
|
|
12
6
|
gap: var(--list-gap);
|
|
@@ -14,8 +8,35 @@
|
|
|
14
8
|
margin: 0;
|
|
15
9
|
position: relative;
|
|
16
10
|
outline: none;
|
|
11
|
+
background-color: var(--list-bg-color);
|
|
17
12
|
}
|
|
18
13
|
|
|
14
|
+
.List_color_main {
|
|
15
|
+
--list-bg-color: var(--color-background-main);
|
|
16
|
+
--list-item-color: var(--color-content-primary);
|
|
17
|
+
--list-item-secondary-color: var(--color-content-secondary);
|
|
18
|
+
--list-item-disabled-color: var(--color-content-tertiary);
|
|
19
|
+
--list-pipka-bg-color: var(--color-content-action);
|
|
20
|
+
--list-item-bg-color-disabled: var(--color-content-tertiary);
|
|
21
|
+
--list-item-bg-color-hover: var(--color-background-main-hover);
|
|
22
|
+
--list-item-bg-color-active: var(--color-background-main-pressed);
|
|
23
|
+
--list-item-bg-color-selected: transparent;
|
|
24
|
+
--list-divider-color: var(--color-border-secondary);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.List_color_accent {
|
|
28
|
+
--list-bg-color: var(--color-accent-main);
|
|
29
|
+
--list-item-color: var(--color-content-accent-primary);
|
|
30
|
+
--list-item-secondary-color: var(--color-content-accent-secondary);
|
|
31
|
+
--list-item-disabled-color: var(--color-content-accent-disabled);
|
|
32
|
+
--list-pipka-bg-color: var(--color-content-accent-primary);
|
|
33
|
+
--list-item-bg-color-disabled: var(--color-content-accent-disabled);
|
|
34
|
+
--list-item-bg-color-hover: var(--color-accent-primary-hover);
|
|
35
|
+
--list-item-bg-color-active: var(--color-accent-primary-pressed);
|
|
36
|
+
--list-item-bg-color-selected: var(--color-accent-primary);
|
|
37
|
+
--list-divider-color: var(--color-accent-primary);
|
|
38
|
+
}
|
|
39
|
+
|
|
19
40
|
.List_size_2xs,
|
|
20
41
|
.List_size_xs,
|
|
21
42
|
.List_size_s {
|
|
@@ -91,3 +112,7 @@
|
|
|
91
112
|
.List:empty {
|
|
92
113
|
--list-gutter: 0;
|
|
93
114
|
}
|
|
115
|
+
|
|
116
|
+
.List .Divider {
|
|
117
|
+
--divider-color: var(--list-divider-color);
|
|
118
|
+
}
|
|
@@ -12,8 +12,8 @@ var ListContext_1 = require("./ListContext");
|
|
|
12
12
|
exports.cnList = (0, classname_1.cn)('List');
|
|
13
13
|
exports.List = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(function (inProps, ref) {
|
|
14
14
|
var props = (0, useThemeProps_1.useThemeProps)({ props: inProps, name: 'List' });
|
|
15
|
-
var _a = props.as, Tag = _a === void 0 ? constants_1.LIST_DEFAULT_TAG : _a, _b = props.size, size = _b === void 0 ? constants_1.LIST_DEFAULT_SIZE : _b, _c = props.disablePadding, disablePadding = _c === void 0 ? constants_1.LIST_DEFAULT_DISABLE_PADDING : _c, children = props.children, className = props.className, other = tslib_1.__rest(props, ["as", "size", "disablePadding", "children", "className"]);
|
|
15
|
+
var _a = props.as, Tag = _a === void 0 ? constants_1.LIST_DEFAULT_TAG : _a, _b = props.size, size = _b === void 0 ? constants_1.LIST_DEFAULT_SIZE : _b, _c = props.disablePadding, disablePadding = _c === void 0 ? constants_1.LIST_DEFAULT_DISABLE_PADDING : _c, children = props.children, className = props.className, _d = props.color, color = _d === void 0 ? constants_1.LIST_DEFAULT_COLOR : _d, other = tslib_1.__rest(props, ["as", "size", "disablePadding", "children", "className", "color"]);
|
|
16
16
|
return (react_1.default.createElement(ListContext_1.ListContext.Provider, { value: { size: size } },
|
|
17
|
-
react_1.default.createElement(Tag, tslib_1.__assign({ className: (0, exports.cnList)({ size: size, disablePadding: disablePadding }, [className]) }, other, { ref: ref }), children)));
|
|
17
|
+
react_1.default.createElement(Tag, tslib_1.__assign({ className: (0, exports.cnList)({ size: size, disablePadding: disablePadding, color: color }, [className]) }, other, { ref: ref }), children)));
|
|
18
18
|
});
|
|
19
19
|
exports.List.displayName = 'List';
|
|
@@ -50,9 +50,13 @@
|
|
|
50
50
|
|
|
51
51
|
.ListItemButton_disabled .ListItemText-TextPrimary,
|
|
52
52
|
.ListItemButton_disabled .ListItemText-TextSecondary {
|
|
53
|
-
color: var(--
|
|
53
|
+
color: var(--list-item-disabled-color);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
.ListItemButton_selected {
|
|
57
|
+
background-color: var(--list-item-bg-color-selected);
|
|
58
|
+
}
|
|
59
|
+
|
|
56
60
|
.ListItemButton_selected::after {
|
|
57
61
|
content: '';
|
|
58
62
|
inline-size: var(--list-pipka-width);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LIST_ITEM_BUTTON_DEFAULT_ALIGN = exports.LIST_ITEM_BUTTON_DEFAULT_TAG = exports.LIST_ITEM_DEFAULT_ALIGN = exports.LIST_ITEM_DEFAULT_TAG = exports.LIST_DEFAULT_TAG = exports.LIST_DEFAULT_DISABLE_PADDING = exports.LIST_DEFAULT_SIZE = void 0;
|
|
3
|
+
exports.LIST_ITEM_BUTTON_DEFAULT_ALIGN = exports.LIST_ITEM_BUTTON_DEFAULT_TAG = exports.LIST_ITEM_DEFAULT_ALIGN = exports.LIST_ITEM_DEFAULT_TAG = exports.LIST_DEFAULT_COLOR = exports.LIST_DEFAULT_TAG = exports.LIST_DEFAULT_DISABLE_PADDING = exports.LIST_DEFAULT_SIZE = void 0;
|
|
4
4
|
exports.LIST_DEFAULT_SIZE = 'm';
|
|
5
5
|
exports.LIST_DEFAULT_DISABLE_PADDING = false;
|
|
6
6
|
exports.LIST_DEFAULT_TAG = 'ul';
|
|
7
|
+
exports.LIST_DEFAULT_COLOR = 'main';
|
|
7
8
|
exports.LIST_ITEM_DEFAULT_TAG = 'li';
|
|
8
9
|
exports.LIST_ITEM_DEFAULT_ALIGN = 'center';
|
|
9
10
|
exports.LIST_ITEM_BUTTON_DEFAULT_TAG = 'div';
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useListContext = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
+
tslib_1.__exportStar(require("./entities"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./List"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./components"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./types"), exports);
|
|
@@ -28,5 +28,14 @@
|
|
|
28
28
|
}
|
|
29
29
|
.Menu {
|
|
30
30
|
overflow: hidden auto;
|
|
31
|
-
max-block-size:
|
|
31
|
+
max-block-size: var(--menu-max-height);
|
|
32
|
+
background-color: var(--menu-bg-color);
|
|
32
33
|
}
|
|
34
|
+
|
|
35
|
+
.Menu_color_main {
|
|
36
|
+
--menu-bg-color: var(--color-background-main);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.Menu_color_accent {
|
|
40
|
+
--menu-bg-color: var(--color-accent-main);
|
|
41
|
+
}
|
|
@@ -6,6 +6,7 @@ require("./Menu.css");
|
|
|
6
6
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
7
7
|
var useDeprecated_1 = require("../../hooks/useDeprecated");
|
|
8
8
|
var useThemeProps_1 = require("../../hooks/useThemeProps");
|
|
9
|
+
var utils_1 = require("../../utils");
|
|
9
10
|
var classname_1 = require("../../utils/classname");
|
|
10
11
|
var getPaperSizeToFormElement_1 = require("../../utils/getPaperSizeToFormElement");
|
|
11
12
|
var Paper_1 = require("../Paper");
|
|
@@ -14,11 +15,26 @@ var components_1 = require("./components");
|
|
|
14
15
|
var constants_1 = require("./constants");
|
|
15
16
|
exports.cnMenu = (0, classname_1.cn)('Menu');
|
|
16
17
|
exports.Menu = (0, react_1.forwardRef)(function (inProps, ref) {
|
|
18
|
+
var _a;
|
|
17
19
|
var props = (0, useThemeProps_1.useThemeProps)({ props: inProps, name: 'Menu' });
|
|
18
|
-
var
|
|
20
|
+
var _b = props.size, size = _b === void 0 ? constants_1.MENU_DEFAULT_SIZE : _b, open = props.open, menuListProps = props.menuListProps, menuListRef = props.menuListRef, onClose = props.onClose, children = props.children, className = props.className, _c = props.color, color = _c === void 0 ? constants_1.MENU_DEFAULT_COLOR : _c, _d = props.maxHeight, maxHeightProp = _d === void 0 ? constants_1.MENU_DEFAULT_MAX_HEIGHT : _d, other = tslib_1.__rest(props, ["size", "open", "menuListProps", "menuListRef", "onClose", "children", "className", "color", "maxHeight"]);
|
|
19
21
|
var radius = (0, getPaperSizeToFormElement_1.getPaperSizeToFormElement)(size);
|
|
20
22
|
(0, useDeprecated_1.useDeprecatedProperty)(!!menuListRef, 'menuListRef', 'menuListProps.ref');
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
var maxHeight = (function () {
|
|
24
|
+
if ((0, utils_1.isString)(maxHeightProp)) {
|
|
25
|
+
return maxHeightProp;
|
|
26
|
+
}
|
|
27
|
+
if ((0, utils_1.isNumber)(maxHeightProp)) {
|
|
28
|
+
return "".concat(maxHeightProp, "px");
|
|
29
|
+
}
|
|
30
|
+
if (maxHeightProp) {
|
|
31
|
+
return constants_1.MENU_DEFAULT_MAX_HEIGHT;
|
|
32
|
+
}
|
|
33
|
+
return 'initial';
|
|
34
|
+
})();
|
|
35
|
+
return (react_1.default.createElement(Popover_1.Popover, tslib_1.__assign({ as: Paper_1.Paper, offset: [0, 4], radius: radius }, other, { style: tslib_1.__assign(tslib_1.__assign({}, other.style), (0, utils_1.generateCSSVariables)((_a = {},
|
|
36
|
+
_a[constants_1.MENU_CSS_VARIABLES.MAX_HEIGHT] = maxHeight,
|
|
37
|
+
_a))), open: open, onClose: onClose, className: (0, exports.cnMenu)({ color: color }, [className]), disableEnforceFocus: true, ref: ref }),
|
|
38
|
+
react_1.default.createElement(components_1.MenuContextConsumer, { onClose: onClose, menuListRef: menuListRef, menuListProps: tslib_1.__assign(tslib_1.__assign({ size: size, color: color }, menuListProps), { ref: menuListRef || (menuListProps === null || menuListProps === void 0 ? void 0 : menuListProps.ref) }) }, children)));
|
|
23
39
|
});
|
|
24
40
|
exports.Menu.displayName = 'Menu';
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MENU_DEFAULT_SIZE = void 0;
|
|
3
|
+
exports.MENU_CSS_VARIABLES = exports.MENU_DEFAULT_MAX_HEIGHT = exports.MENU_DEFAULT_COLOR = exports.MENU_DEFAULT_SIZE = void 0;
|
|
4
4
|
exports.MENU_DEFAULT_SIZE = 'm';
|
|
5
|
+
exports.MENU_DEFAULT_COLOR = 'main';
|
|
6
|
+
exports.MENU_DEFAULT_MAX_HEIGHT = '40vh';
|
|
7
|
+
exports.MENU_CSS_VARIABLES = {
|
|
8
|
+
MAX_HEIGHT: 'menu-max-height',
|
|
9
|
+
};
|
|
@@ -5,6 +5,7 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
var List_1 = require("../List");
|
|
6
6
|
Object.defineProperty(exports, "MenuItemText", { enumerable: true, get: function () { return List_1.ListItemText; } });
|
|
7
7
|
Object.defineProperty(exports, "MenuItemIcon", { enumerable: true, get: function () { return List_1.ListItemIcon; } });
|
|
8
|
+
tslib_1.__exportStar(require("./entities"), exports);
|
|
8
9
|
tslib_1.__exportStar(require("./Menu"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("./components"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./types"), exports);
|
|
@@ -44,7 +44,7 @@ exports.SidebarUserMenu = (0, utils_1.polymorphicComponentWithRef)(function (inP
|
|
|
44
44
|
className: (0, exports.cnSidebarUserMenu)('LabelWrapper'),
|
|
45
45
|
}, size: "2xs", iconRight: react_1.default.createElement(icons_1.ChevronDownSmallIcon, { className: (0, exports.cnSidebarUserMenu)('Chevron') }) }),
|
|
46
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,
|
|
47
|
+
react_1.default.createElement(Menu_1.Menu, tslib_1.__assign({ placement: "right-end", anchorRef: buttonRef, color: color }, 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, open: isOpen, className: (0, exports.cnSidebarUserMenu)('Menu', [menuProps === null || menuProps === void 0 ? void 0 : menuProps.className]), onClose: function () {
|
|
48
48
|
var _a;
|
|
49
49
|
setIsOpen(false);
|
|
50
50
|
(_a = menuProps === null || menuProps === void 0 ? void 0 : menuProps.onClose) === null || _a === void 0 ? void 0 : _a.call(menuProps);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './size';
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
.List {
|
|
2
2
|
--list-item-bg-color: transparent;
|
|
3
|
-
--list-
|
|
4
|
-
--list-pipka-bg-color: var(--color-content-action);
|
|
5
|
-
--list-item-bg-color-disabled: var(--color-content-tertiary);
|
|
6
|
-
--list-item-bg-color-hover: var(--color-background-main-hover);
|
|
7
|
-
--list-item-bg-color-active: var(--color-background-main-pressed);
|
|
8
|
-
--list-pipka-border-radius: 0 var(--border-radius-xs) var(--border-radius-xs)
|
|
9
|
-
0;
|
|
3
|
+
--list-pipka-border-radius: 0 var(--border-radius-xs) var(--border-radius-xs) 0;
|
|
10
4
|
display: flex;
|
|
11
5
|
flex-direction: column;
|
|
12
6
|
gap: var(--list-gap);
|
|
@@ -14,8 +8,35 @@
|
|
|
14
8
|
margin: 0;
|
|
15
9
|
position: relative;
|
|
16
10
|
outline: none;
|
|
11
|
+
background-color: var(--list-bg-color);
|
|
17
12
|
}
|
|
18
13
|
|
|
14
|
+
.List_color_main {
|
|
15
|
+
--list-bg-color: var(--color-background-main);
|
|
16
|
+
--list-item-color: var(--color-content-primary);
|
|
17
|
+
--list-item-secondary-color: var(--color-content-secondary);
|
|
18
|
+
--list-item-disabled-color: var(--color-content-tertiary);
|
|
19
|
+
--list-pipka-bg-color: var(--color-content-action);
|
|
20
|
+
--list-item-bg-color-disabled: var(--color-content-tertiary);
|
|
21
|
+
--list-item-bg-color-hover: var(--color-background-main-hover);
|
|
22
|
+
--list-item-bg-color-active: var(--color-background-main-pressed);
|
|
23
|
+
--list-item-bg-color-selected: transparent;
|
|
24
|
+
--list-divider-color: var(--color-border-secondary);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.List_color_accent {
|
|
28
|
+
--list-bg-color: var(--color-accent-main);
|
|
29
|
+
--list-item-color: var(--color-content-accent-primary);
|
|
30
|
+
--list-item-secondary-color: var(--color-content-accent-secondary);
|
|
31
|
+
--list-item-disabled-color: var(--color-content-accent-disabled);
|
|
32
|
+
--list-pipka-bg-color: var(--color-content-accent-primary);
|
|
33
|
+
--list-item-bg-color-disabled: var(--color-content-accent-disabled);
|
|
34
|
+
--list-item-bg-color-hover: var(--color-accent-primary-hover);
|
|
35
|
+
--list-item-bg-color-active: var(--color-accent-primary-pressed);
|
|
36
|
+
--list-item-bg-color-selected: var(--color-accent-primary);
|
|
37
|
+
--list-divider-color: var(--color-accent-primary);
|
|
38
|
+
}
|
|
39
|
+
|
|
19
40
|
.List_size_2xs,
|
|
20
41
|
.List_size_xs,
|
|
21
42
|
.List_size_s {
|
|
@@ -91,3 +112,7 @@
|
|
|
91
112
|
.List:empty {
|
|
92
113
|
--list-gutter: 0;
|
|
93
114
|
}
|
|
115
|
+
|
|
116
|
+
.List .Divider {
|
|
117
|
+
--divider-color: var(--list-divider-color);
|
|
118
|
+
}
|
|
@@ -4,13 +4,13 @@ import React from 'react';
|
|
|
4
4
|
import { useThemeProps } from '../../hooks/useThemeProps';
|
|
5
5
|
import { cn } from '../../utils/classname';
|
|
6
6
|
import { polymorphicComponentWithRef } from '../../utils/polymorphicComponentWithRef';
|
|
7
|
-
import { LIST_DEFAULT_SIZE, LIST_DEFAULT_TAG, LIST_DEFAULT_DISABLE_PADDING, } from './constants';
|
|
7
|
+
import { LIST_DEFAULT_SIZE, LIST_DEFAULT_TAG, LIST_DEFAULT_DISABLE_PADDING, LIST_DEFAULT_COLOR, } from './constants';
|
|
8
8
|
import { ListContext } from './ListContext';
|
|
9
9
|
export var cnList = cn('List');
|
|
10
10
|
export var List = polymorphicComponentWithRef(function (inProps, ref) {
|
|
11
11
|
var props = useThemeProps({ props: inProps, name: 'List' });
|
|
12
|
-
var _a = props.as, Tag = _a === void 0 ? LIST_DEFAULT_TAG : _a, _b = props.size, size = _b === void 0 ? LIST_DEFAULT_SIZE : _b, _c = props.disablePadding, disablePadding = _c === void 0 ? LIST_DEFAULT_DISABLE_PADDING : _c, children = props.children, className = props.className, other = __rest(props, ["as", "size", "disablePadding", "children", "className"]);
|
|
12
|
+
var _a = props.as, Tag = _a === void 0 ? LIST_DEFAULT_TAG : _a, _b = props.size, size = _b === void 0 ? LIST_DEFAULT_SIZE : _b, _c = props.disablePadding, disablePadding = _c === void 0 ? LIST_DEFAULT_DISABLE_PADDING : _c, children = props.children, className = props.className, _d = props.color, color = _d === void 0 ? LIST_DEFAULT_COLOR : _d, other = __rest(props, ["as", "size", "disablePadding", "children", "className", "color"]);
|
|
13
13
|
return (React.createElement(ListContext.Provider, { value: { size: size } },
|
|
14
|
-
React.createElement(Tag, __assign({ className: cnList({ size: size, disablePadding: disablePadding }, [className]) }, other, { ref: ref }), children)));
|
|
14
|
+
React.createElement(Tag, __assign({ className: cnList({ size: size, disablePadding: disablePadding, color: color }, [className]) }, other, { ref: ref }), children)));
|
|
15
15
|
});
|
|
16
16
|
List.displayName = 'List';
|
|
@@ -50,9 +50,13 @@
|
|
|
50
50
|
|
|
51
51
|
.ListItemButton_disabled .ListItemText-TextPrimary,
|
|
52
52
|
.ListItemButton_disabled .ListItemText-TextSecondary {
|
|
53
|
-
color: var(--
|
|
53
|
+
color: var(--list-item-disabled-color);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
.ListItemButton_selected {
|
|
57
|
+
background-color: var(--list-item-bg-color-selected);
|
|
58
|
+
}
|
|
59
|
+
|
|
56
60
|
.ListItemButton_selected::after {
|
|
57
61
|
content: '';
|
|
58
62
|
inline-size: var(--list-pipka-width);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export var LIST_DEFAULT_SIZE = 'm';
|
|
2
2
|
export var LIST_DEFAULT_DISABLE_PADDING = false;
|
|
3
3
|
export var LIST_DEFAULT_TAG = 'ul';
|
|
4
|
+
export var LIST_DEFAULT_COLOR = 'main';
|
|
4
5
|
export var LIST_ITEM_DEFAULT_TAG = 'li';
|
|
5
6
|
export var LIST_ITEM_DEFAULT_ALIGN = 'center';
|
|
6
7
|
export var LIST_ITEM_BUTTON_DEFAULT_TAG = 'div';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var listColorVariant = ['main', 'accent'];
|
|
@@ -28,5 +28,14 @@
|
|
|
28
28
|
}
|
|
29
29
|
.Menu {
|
|
30
30
|
overflow: hidden auto;
|
|
31
|
-
max-block-size:
|
|
31
|
+
max-block-size: var(--menu-max-height);
|
|
32
|
+
background-color: var(--menu-bg-color);
|
|
32
33
|
}
|
|
34
|
+
|
|
35
|
+
.Menu_color_main {
|
|
36
|
+
--menu-bg-color: var(--color-background-main);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.Menu_color_accent {
|
|
40
|
+
--menu-bg-color: var(--color-accent-main);
|
|
41
|
+
}
|
|
@@ -3,19 +3,35 @@ import './Menu.css';
|
|
|
3
3
|
import React, { forwardRef } from 'react';
|
|
4
4
|
import { useDeprecatedProperty } from '../../hooks/useDeprecated';
|
|
5
5
|
import { useThemeProps } from '../../hooks/useThemeProps';
|
|
6
|
+
import { generateCSSVariables, isNumber, isString } from '../../utils';
|
|
6
7
|
import { cn } from '../../utils/classname';
|
|
7
8
|
import { getPaperSizeToFormElement } from '../../utils/getPaperSizeToFormElement';
|
|
8
9
|
import { Paper } from '../Paper';
|
|
9
10
|
import { Popover } from '../Popover';
|
|
10
11
|
import { MenuContextConsumer } from './components';
|
|
11
|
-
import { MENU_DEFAULT_SIZE } from './constants';
|
|
12
|
+
import { MENU_CSS_VARIABLES, MENU_DEFAULT_COLOR, MENU_DEFAULT_SIZE, MENU_DEFAULT_MAX_HEIGHT, } from './constants';
|
|
12
13
|
export var cnMenu = cn('Menu');
|
|
13
14
|
export var Menu = forwardRef(function (inProps, ref) {
|
|
15
|
+
var _a;
|
|
14
16
|
var props = useThemeProps({ props: inProps, name: 'Menu' });
|
|
15
|
-
var
|
|
17
|
+
var _b = props.size, size = _b === void 0 ? MENU_DEFAULT_SIZE : _b, open = props.open, menuListProps = props.menuListProps, menuListRef = props.menuListRef, onClose = props.onClose, children = props.children, className = props.className, _c = props.color, color = _c === void 0 ? MENU_DEFAULT_COLOR : _c, _d = props.maxHeight, maxHeightProp = _d === void 0 ? MENU_DEFAULT_MAX_HEIGHT : _d, other = __rest(props, ["size", "open", "menuListProps", "menuListRef", "onClose", "children", "className", "color", "maxHeight"]);
|
|
16
18
|
var radius = getPaperSizeToFormElement(size);
|
|
17
19
|
useDeprecatedProperty(!!menuListRef, 'menuListRef', 'menuListProps.ref');
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
var maxHeight = (function () {
|
|
21
|
+
if (isString(maxHeightProp)) {
|
|
22
|
+
return maxHeightProp;
|
|
23
|
+
}
|
|
24
|
+
if (isNumber(maxHeightProp)) {
|
|
25
|
+
return "".concat(maxHeightProp, "px");
|
|
26
|
+
}
|
|
27
|
+
if (maxHeightProp) {
|
|
28
|
+
return MENU_DEFAULT_MAX_HEIGHT;
|
|
29
|
+
}
|
|
30
|
+
return 'initial';
|
|
31
|
+
})();
|
|
32
|
+
return (React.createElement(Popover, __assign({ as: Paper, offset: [0, 4], radius: radius }, other, { style: __assign(__assign({}, other.style), generateCSSVariables((_a = {},
|
|
33
|
+
_a[MENU_CSS_VARIABLES.MAX_HEIGHT] = maxHeight,
|
|
34
|
+
_a))), open: open, onClose: onClose, className: cnMenu({ color: color }, [className]), disableEnforceFocus: true, ref: ref }),
|
|
35
|
+
React.createElement(MenuContextConsumer, { onClose: onClose, menuListRef: menuListRef, menuListProps: __assign(__assign({ size: size, color: color }, menuListProps), { ref: menuListRef || (menuListProps === null || menuListProps === void 0 ? void 0 : menuListProps.ref) }) }, children)));
|
|
20
36
|
});
|
|
21
37
|
Menu.displayName = 'Menu';
|
|
@@ -41,7 +41,7 @@ export var SidebarUserMenu = polymorphicComponentWithRef(function (inProps, ref)
|
|
|
41
41
|
className: cnSidebarUserMenu('LabelWrapper'),
|
|
42
42
|
}, size: "2xs", iconRight: React.createElement(ChevronDownSmallIcon, { className: cnSidebarUserMenu('Chevron') }) }),
|
|
43
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,
|
|
44
|
+
React.createElement(Menu, __assign({ placement: "right-end", anchorRef: buttonRef, color: color }, menuProps, { size: (_a = menuProps === null || menuProps === void 0 ? void 0 : menuProps.size) !== null && _a !== void 0 ? _a : SIDEBAR_USER_MENU_DEFAULT_MENU_SIZE, open: isOpen, className: cnSidebarUserMenu('Menu', [menuProps === null || menuProps === void 0 ? void 0 : menuProps.className]), onClose: function () {
|
|
45
45
|
var _a;
|
|
46
46
|
setIsOpen(false);
|
|
47
47
|
(_a = menuProps === null || menuProps === void 0 ? void 0 : menuProps.onClose) === null || _a === void 0 ? void 0 : _a.call(menuProps);
|
package/__inner__/types/components/AutocompleteNext/components/AutocompleteDropdown/types.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export type AutocompleteDropdownProps<OPTION = AutocompleteDefaultOption, MULTIP
|
|
|
37
37
|
/** Свойства компонента Popover */
|
|
38
38
|
popoverProps?: Partial<Omit<PopoverProps, 'children' | 'open' | 'anchorRef' | 'onClose' | 'className'>>;
|
|
39
39
|
/** Свойства компонента List */
|
|
40
|
-
listProps?: Partial<Omit<ListProps, 'children'>>;
|
|
40
|
+
listProps?: Partial<Omit<ListProps, 'children' | 'color'>>;
|
|
41
41
|
loading?: boolean;
|
|
42
42
|
hasOptions?: boolean;
|
|
43
43
|
'data-testid'?: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './size';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ReactNode, ElementType, SyntheticEvent } from 'react';
|
|
2
2
|
import type React from 'react';
|
|
3
|
-
import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
|
|
4
3
|
import type { WithDisplayName } from '../../types/react';
|
|
5
4
|
import type { PolymorphicComponentPropsWithRef, PolymorphicComponentRef } from '../../utils/polymorphicComponentWithRef';
|
|
6
5
|
import type { ListProps } from '../List';
|
|
7
6
|
import type { PopoverBaseProps } from '../Popover';
|
|
8
7
|
import type { DATA_LIST_DEFAULT_TAG } from './constants';
|
|
8
|
+
import type { DataListSizeVariant } from './entities';
|
|
9
9
|
export type DataListValue = string | number;
|
|
10
10
|
export type DataListSelected<MULTIPLE extends boolean> = (MULTIPLE extends true ? DataListValue[] : DataListValue) | undefined;
|
|
11
11
|
export type DataListPayload<MULTIPLE extends boolean> = {
|
|
@@ -25,7 +25,7 @@ export type DataListBaseProps<MULTIPLE extends boolean = false> = {
|
|
|
25
25
|
/** Дополнительные CSS-классы */
|
|
26
26
|
className?: string;
|
|
27
27
|
/** Размер компонента */
|
|
28
|
-
size?:
|
|
28
|
+
size?: DataListSizeVariant;
|
|
29
29
|
/** Выбранная или выбранные опции */
|
|
30
30
|
selected?: DataListSelected<MULTIPLE>;
|
|
31
31
|
/** Выбранная опция по умолчанию */
|
|
@@ -33,7 +33,7 @@ export type DataListBaseProps<MULTIPLE extends boolean = false> = {
|
|
|
33
33
|
/** Функция обратного вызова для выбора значения */
|
|
34
34
|
onSelect?: DataListOnSelect<MULTIPLE>;
|
|
35
35
|
/** Свойства компонента List */
|
|
36
|
-
listProps?: ListProps
|
|
36
|
+
listProps?: Omit<ListProps, 'color'>;
|
|
37
37
|
} & Omit<PopoverBaseProps, 'onSelect'>;
|
|
38
38
|
export type DataListRef = PolymorphicComponentRef<typeof DATA_LIST_DEFAULT_TAG>;
|
|
39
39
|
export type DataListProps<As extends ElementType = typeof DATA_LIST_DEFAULT_TAG, MULTIPLE extends boolean = false> = PolymorphicComponentPropsWithRef<DataListBaseProps<MULTIPLE>, As>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ListSizeVariant } from './entities';
|
|
3
|
+
export type ListContextValue = {
|
|
4
|
+
size: ListSizeVariant;
|
|
5
|
+
};
|
|
3
6
|
export declare const ListContext: React.Context<ListContextValue>;
|
|
4
7
|
export declare const useListContext: () => ListContextValue;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const LIST_DEFAULT_SIZE = "m";
|
|
2
2
|
export declare const LIST_DEFAULT_DISABLE_PADDING = false;
|
|
3
3
|
export declare const LIST_DEFAULT_TAG = "ul";
|
|
4
|
+
export declare const LIST_DEFAULT_COLOR = "main";
|
|
4
5
|
export declare const LIST_ITEM_DEFAULT_TAG = "li";
|
|
5
6
|
export declare const LIST_ITEM_DEFAULT_ALIGN = "center";
|
|
6
7
|
export declare const LIST_ITEM_BUTTON_DEFAULT_TAG = "div";
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import type { ElementType, ReactNode } from 'react';
|
|
2
|
-
import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
|
|
3
2
|
import type { PolymorphicComponentPropsWithRef } from '../../utils/polymorphicComponentWithRef';
|
|
4
3
|
import type { LIST_DEFAULT_TAG } from './constants';
|
|
5
|
-
|
|
6
|
-
export type ListContextValue = {
|
|
7
|
-
size: ListSizeVariant;
|
|
8
|
-
};
|
|
4
|
+
import type { ListColorVariant, ListSizeVariant } from './entities';
|
|
9
5
|
export type ListBaseProps = {
|
|
10
6
|
/** Содержимое компонента */
|
|
11
7
|
children?: ReactNode;
|
|
12
8
|
/** Размер компонента */
|
|
13
9
|
size?: ListSizeVariant;
|
|
10
|
+
/** Цвет компонента */
|
|
11
|
+
color?: ListColorVariant;
|
|
14
12
|
/** Если `true` отключает боковые отступы */
|
|
15
13
|
disablePadding?: boolean;
|
|
16
14
|
/** Идентификатор компонента для тестов */
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ComponentRef, RefObject } from 'react';
|
|
2
2
|
import type { ExtendableComponentPropsWithRef } from '../../types/ExtendableComponentPropsWithRef';
|
|
3
|
-
import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
|
|
4
3
|
import type { PopoverBaseProps } from '../Popover';
|
|
5
4
|
import type { MenuListProps } from './components';
|
|
5
|
+
import type { MenuColorVariant, MenuSizeVariant } from './entities';
|
|
6
6
|
export type MenuRef = ComponentRef<'div'>;
|
|
7
|
+
export type MenuMaxHeight = boolean | number | string;
|
|
7
8
|
export type MenuProps = ExtendableComponentPropsWithRef<{
|
|
8
9
|
/** Свойства компонента MenuList */
|
|
9
10
|
menuListProps?: Omit<MenuListProps, 'children'>;
|
|
@@ -13,5 +14,9 @@ export type MenuProps = ExtendableComponentPropsWithRef<{
|
|
|
13
14
|
* */
|
|
14
15
|
menuListRef?: RefObject<HTMLDivElement>;
|
|
15
16
|
/** Размер компонента */
|
|
16
|
-
size?:
|
|
17
|
+
size?: MenuSizeVariant;
|
|
18
|
+
/** Цвет компонента */
|
|
19
|
+
color?: MenuColorVariant;
|
|
20
|
+
/** Свойство максимальной высоты меню */
|
|
21
|
+
maxHeight?: MenuMaxHeight;
|
|
17
22
|
} & Omit<PopoverBaseProps, 'disableEnforceFocus'>, 'div'>;
|
|
@@ -19,7 +19,7 @@ export type SidebarUserMenuBaseProps = {
|
|
|
19
19
|
open: boolean;
|
|
20
20
|
}) => void;
|
|
21
21
|
/** Свойства компонента Menu */
|
|
22
|
-
menuProps?: Omit<MenuProps, '
|
|
22
|
+
menuProps?: Omit<MenuProps, 'open'>;
|
|
23
23
|
/** Максимальное количество строк */
|
|
24
24
|
maxLines?: number;
|
|
25
25
|
/** Идентификатор компонента для тестов */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ozen-ui/kit",
|
|
3
|
-
"version": "0.84.
|
|
3
|
+
"version": "0.84.4",
|
|
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/logger": "0.84.
|
|
34
|
-
"@ozen-ui/icons": "0.84.
|
|
32
|
+
"@ozen-ui/fonts": "0.84.4",
|
|
33
|
+
"@ozen-ui/logger": "0.84.4",
|
|
34
|
+
"@ozen-ui/icons": "0.84.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/lodash.isequal": "^4.5.0"
|