@ozen-ui/kit 0.84.3 → 0.84.5
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/Container/__sands__/__shared__/style.css +7 -0
- package/__inner__/cjs/components/Drawer/__sands__/__shared__/UserInfo.css +21 -0
- package/__inner__/cjs/components/FileIcon/FileIcon.js +1 -1
- package/__inner__/cjs/components/Menu/Menu.css +10 -2
- package/__inner__/cjs/components/Menu/Menu.js +18 -2
- package/__inner__/cjs/components/Menu/constants.js +5 -1
- package/__inner__/esm/components/Container/__sands__/__shared__/style.css +7 -0
- package/__inner__/esm/components/Drawer/__sands__/__shared__/UserInfo.css +21 -0
- package/__inner__/esm/components/FileIcon/FileIcon.js +2 -2
- package/__inner__/esm/components/Menu/Menu.css +10 -2
- package/__inner__/esm/components/Menu/Menu.js +19 -3
- package/__inner__/esm/components/Menu/constants.js +4 -0
- package/__inner__/types/components/Menu/constants.d.ts +4 -0
- package/__inner__/types/components/Menu/types.d.ts +3 -0
- package/package.json +4 -4
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.UserInfo {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
max-inline-size: 400px;
|
|
5
|
+
margin-block-end: var(--spacing-m);
|
|
6
|
+
padding: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.UserInfo-Heading {
|
|
10
|
+
padding: var(--spacing-s);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.UserInfo-Field {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
padding: var(--spacing-s);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.UserInfo-Field span {
|
|
20
|
+
color: var(--color-content-secondary);
|
|
21
|
+
}
|
|
@@ -24,7 +24,7 @@ exports.FileIcon = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef
|
|
|
24
24
|
return react_1.default.createElement(Loader_1.Loader, { color: "currentcolor", size: iconSize });
|
|
25
25
|
}
|
|
26
26
|
if (status === 'error') {
|
|
27
|
-
return react_1.default.createElement(icons_1.
|
|
27
|
+
return react_1.default.createElement(icons_1.WarningCircleIcon, { size: iconSize });
|
|
28
28
|
}
|
|
29
29
|
if (status === 'unknown') {
|
|
30
30
|
return react_1.default.createElement(icons_1.QuestionCircleIcon, { size: iconSize });
|
|
@@ -28,6 +28,14 @@
|
|
|
28
28
|
}
|
|
29
29
|
.Menu {
|
|
30
30
|
overflow: hidden auto;
|
|
31
|
-
max-block-size:
|
|
32
|
-
background-color:
|
|
31
|
+
max-block-size: var(--menu-max-height);
|
|
32
|
+
background-color: var(--menu-bg-color);
|
|
33
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
|
-
|
|
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 }),
|
|
22
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,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MENU_DEFAULT_COLOR = 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
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
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.UserInfo {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
max-inline-size: 400px;
|
|
5
|
+
margin-block-end: var(--spacing-m);
|
|
6
|
+
padding: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.UserInfo-Heading {
|
|
10
|
+
padding: var(--spacing-s);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.UserInfo-Field {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
padding: var(--spacing-s);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.UserInfo-Field span {
|
|
20
|
+
color: var(--color-content-secondary);
|
|
21
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
2
|
import './FileIcon.css';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { QuestionCircleIcon,
|
|
4
|
+
import { QuestionCircleIcon, WarningCircleIcon } from '@ozen-ui/icons';
|
|
5
5
|
import { useThemeProps } from '../../hooks/useThemeProps';
|
|
6
6
|
import { cn } from '../../utils/classname';
|
|
7
7
|
import { polymorphicComponentWithRef } from '../../utils/polymorphicComponentWithRef';
|
|
@@ -21,7 +21,7 @@ export var FileIcon = polymorphicComponentWithRef(function (inProps, ref) {
|
|
|
21
21
|
return React.createElement(Loader, { color: "currentcolor", size: iconSize });
|
|
22
22
|
}
|
|
23
23
|
if (status === 'error') {
|
|
24
|
-
return React.createElement(
|
|
24
|
+
return React.createElement(WarningCircleIcon, { size: iconSize });
|
|
25
25
|
}
|
|
26
26
|
if (status === 'unknown') {
|
|
27
27
|
return React.createElement(QuestionCircleIcon, { size: iconSize });
|
|
@@ -28,6 +28,14 @@
|
|
|
28
28
|
}
|
|
29
29
|
.Menu {
|
|
30
30
|
overflow: hidden auto;
|
|
31
|
-
max-block-size:
|
|
32
|
-
background-color:
|
|
31
|
+
max-block-size: var(--menu-max-height);
|
|
32
|
+
background-color: var(--menu-bg-color);
|
|
33
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_COLOR, 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
|
-
|
|
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 }),
|
|
19
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';
|
|
@@ -4,6 +4,7 @@ import type { PopoverBaseProps } from '../Popover';
|
|
|
4
4
|
import type { MenuListProps } from './components';
|
|
5
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'>;
|
|
@@ -16,4 +17,6 @@ export type MenuProps = ExtendableComponentPropsWithRef<{
|
|
|
16
17
|
size?: MenuSizeVariant;
|
|
17
18
|
/** Цвет компонента */
|
|
18
19
|
color?: MenuColorVariant;
|
|
20
|
+
/** Свойство максимальной высоты меню */
|
|
21
|
+
maxHeight?: MenuMaxHeight;
|
|
19
22
|
} & Omit<PopoverBaseProps, 'disableEnforceFocus'>, 'div'>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ozen-ui/kit",
|
|
3
|
-
"version": "0.84.
|
|
3
|
+
"version": "0.84.5",
|
|
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/
|
|
33
|
-
"@ozen-ui/
|
|
34
|
-
"@ozen-ui/icons": "0.84.
|
|
32
|
+
"@ozen-ui/fonts": "0.84.5",
|
|
33
|
+
"@ozen-ui/logger": "0.84.5",
|
|
34
|
+
"@ozen-ui/icons": "0.84.5"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/lodash.isequal": "^4.5.0"
|