@ozen-ui/kit 0.23.0 → 0.23.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.
@@ -13,7 +13,7 @@ export type AvatarProps = {
13
13
  size?: AvatarSizeVariant;
14
14
  /** Если {true} отобразит индикатор онлайна */
15
15
  online?: boolean;
16
- /** Url изображения */
16
+ /** url изображения */
17
17
  src?: string;
18
18
  /** Имя пользователя */
19
19
  name?: string;
@@ -23,6 +23,7 @@ export type AvatarProps = {
23
23
  className?: string;
24
24
  /** Свойства компонента Indicator */
25
25
  indicatorProps?: IndicatorProps;
26
+ /** Содержимое компонента – иконка */
26
27
  children?: ReactNode;
27
28
  } & ComponentPropsWithRef<typeof avatarEl>;
28
29
  export declare const cnAvatar: import("@bem-react/classname").ClassNameFormatter;
@@ -4,7 +4,6 @@ exports.Avatar = exports.cnAvatar = exports.avatarHueVariant = exports.avatarSiz
4
4
  var tslib_1 = require("tslib");
5
5
  require("./Avatar.css");
6
6
  var react_1 = tslib_1.__importStar(require("react"));
7
- var useBoolean_1 = require("../../hooks/useBoolean");
8
7
  var useThemeProps_1 = require("../../hooks/useThemeProps");
9
8
  var classname_1 = require("../../utils/classname");
10
9
  var Indicator_1 = require("../Indicator");
@@ -28,20 +27,19 @@ exports.Avatar = (0, react_1.forwardRef)(function (inProps, ref) {
28
27
  var props = (0, useThemeProps_1.useThemeProps)({ props: inProps, name: 'Avatar' });
29
28
  var _a = props.size, size = _a === void 0 ? constants_1.AVATAR_DEFAULT_SIZE : _a, _b = props.online, online = _b === void 0 ? constants_1.AVATAR_DEFAULT_ONLINE : _b, _c = props.hue, hue = _c === void 0 ? constants_1.AVATAR_DEFAULT_HUE : _c, src = props.src, nameProp = props.name, className = props.className, indicatorProps = props.indicatorProps, children = props.children, other = tslib_1.__rest(props, ["size", "online", "hue", "src", "name", "className", "indicatorProps", "children"]);
30
29
  var name = nameProp || '';
31
- var _d = tslib_1.__read((0, useBoolean_1.useBoolean)(!!src), 2), showImage = _d[0], off = _d[1].off;
32
30
  var indicatorSize = utils_1.matchSizeIndicatorToAvatar[size];
33
31
  var colorShades = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
34
32
  var color = "".concat(colorShades[(0, get_hash_number_1.getHashNumber)(name, colorShades.length)]).concat(hue);
35
33
  var renderContent = function () {
34
+ if (src) {
35
+ return react_1.default.createElement("img", { src: src, alt: name, className: (0, exports.cnAvatar)('Image') });
36
+ }
36
37
  if (children) {
37
38
  return children;
38
39
  }
39
- if (src && showImage) {
40
- return (react_1.default.createElement("img", { src: src, alt: name, className: (0, exports.cnAvatar)('Image'), onError: off }));
41
- }
42
40
  return (0, utils_1.getInitials)(name);
43
41
  };
44
- return (react_1.default.createElement("div", tslib_1.__assign({ className: (0, exports.cnAvatar)({ size: size, color: !showImage && color }, [className]) }, other, { ref: ref }),
42
+ return (react_1.default.createElement("div", tslib_1.__assign({ className: (0, exports.cnAvatar)({ size: size, color: !src && color }, [className]) }, other, { ref: ref }),
45
43
  renderContent(),
46
44
  online && (react_1.default.createElement(Indicator_1.Indicator, tslib_1.__assign({ variant: "success", size: indicatorSize, border: true }, indicatorProps, { className: (0, exports.cnAvatar)('Online', indicatorProps === null || indicatorProps === void 0 ? void 0 : indicatorProps.className) })))));
47
45
  });
@@ -67,7 +67,7 @@
67
67
  }
68
68
  .Badge-Content_color_neutralDark {
69
69
  color: var(--color-content-action-on);
70
- background-color: var(--color-space-space-95);
70
+ background-color: var(--color-content-primary);
71
71
  }
72
72
  .Badge-Content_color_neutralLight {
73
73
  color: var(--color-content-primary);
@@ -6,8 +6,7 @@
6
6
  .Drawer .Modal-Window {
7
7
  inline-size: 100%;
8
8
  max-inline-size: var(--drawer-width);
9
- /* stylelint-disable-next-line plugin/use-logical-units */
10
- block-size: 100vh;
9
+ block-size: 100%;
11
10
  border-radius: var(--drawer-border-radius);
12
11
  display: flex;
13
12
  flex-direction: column;
@@ -13,7 +13,7 @@ export type AvatarProps = {
13
13
  size?: AvatarSizeVariant;
14
14
  /** Если {true} отобразит индикатор онлайна */
15
15
  online?: boolean;
16
- /** Url изображения */
16
+ /** url изображения */
17
17
  src?: string;
18
18
  /** Имя пользователя */
19
19
  name?: string;
@@ -23,6 +23,7 @@ export type AvatarProps = {
23
23
  className?: string;
24
24
  /** Свойства компонента Indicator */
25
25
  indicatorProps?: IndicatorProps;
26
+ /** Содержимое компонента – иконка */
26
27
  children?: ReactNode;
27
28
  } & ComponentPropsWithRef<typeof avatarEl>;
28
29
  export declare const cnAvatar: import("@bem-react/classname").ClassNameFormatter;
@@ -1,7 +1,6 @@
1
- import { __assign, __read, __rest } from "tslib";
1
+ import { __assign, __rest } from "tslib";
2
2
  import './Avatar.css';
3
3
  import React, { forwardRef } from 'react';
4
- import { useBoolean } from '../../hooks/useBoolean';
5
4
  import { useThemeProps } from '../../hooks/useThemeProps';
6
5
  import { cn } from '../../utils/classname';
7
6
  import { Indicator } from '../Indicator';
@@ -25,20 +24,19 @@ export var Avatar = forwardRef(function (inProps, ref) {
25
24
  var props = useThemeProps({ props: inProps, name: 'Avatar' });
26
25
  var _a = props.size, size = _a === void 0 ? AVATAR_DEFAULT_SIZE : _a, _b = props.online, online = _b === void 0 ? AVATAR_DEFAULT_ONLINE : _b, _c = props.hue, hue = _c === void 0 ? AVATAR_DEFAULT_HUE : _c, src = props.src, nameProp = props.name, className = props.className, indicatorProps = props.indicatorProps, children = props.children, other = __rest(props, ["size", "online", "hue", "src", "name", "className", "indicatorProps", "children"]);
27
26
  var name = nameProp || '';
28
- var _d = __read(useBoolean(!!src), 2), showImage = _d[0], off = _d[1].off;
29
27
  var indicatorSize = matchSizeIndicatorToAvatar[size];
30
28
  var colorShades = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
31
29
  var color = "".concat(colorShades[getHashNumber(name, colorShades.length)]).concat(hue);
32
30
  var renderContent = function () {
31
+ if (src) {
32
+ return React.createElement("img", { src: src, alt: name, className: cnAvatar('Image') });
33
+ }
33
34
  if (children) {
34
35
  return children;
35
36
  }
36
- if (src && showImage) {
37
- return (React.createElement("img", { src: src, alt: name, className: cnAvatar('Image'), onError: off }));
38
- }
39
37
  return getInitials(name);
40
38
  };
41
- return (React.createElement("div", __assign({ className: cnAvatar({ size: size, color: !showImage && color }, [className]) }, other, { ref: ref }),
39
+ return (React.createElement("div", __assign({ className: cnAvatar({ size: size, color: !src && color }, [className]) }, other, { ref: ref }),
42
40
  renderContent(),
43
41
  online && (React.createElement(Indicator, __assign({ variant: "success", size: indicatorSize, border: true }, indicatorProps, { className: cnAvatar('Online', indicatorProps === null || indicatorProps === void 0 ? void 0 : indicatorProps.className) })))));
44
42
  });
@@ -67,7 +67,7 @@
67
67
  }
68
68
  .Badge-Content_color_neutralDark {
69
69
  color: var(--color-content-action-on);
70
- background-color: var(--color-space-space-95);
70
+ background-color: var(--color-content-primary);
71
71
  }
72
72
  .Badge-Content_color_neutralLight {
73
73
  color: var(--color-content-primary);
@@ -6,8 +6,7 @@
6
6
  .Drawer .Modal-Window {
7
7
  inline-size: 100%;
8
8
  max-inline-size: var(--drawer-width);
9
- /* stylelint-disable-next-line plugin/use-logical-units */
10
- block-size: 100vh;
9
+ block-size: 100%;
11
10
  border-radius: var(--drawer-border-radius);
12
11
  display: flex;
13
12
  flex-direction: column;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ozen-ui/kit",
3
- "version": "0.23.0",
3
+ "version": "0.23.2",
4
4
  "description": "React component library",
5
5
  "files": [
6
6
  "*"