@cloud-ru/uikit-product-load-status 1.1.10 → 1.1.11-preview-e99a99a6.0

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.
@@ -1,8 +1,9 @@
1
+ import { ReactNode } from 'react';
1
2
  import { WithSupportProps } from '@cloud-ru/uikit-product-utils';
2
3
  import { ProgressBarProps } from '@snack-uikit/progress-bar';
3
4
  import { LoadValueType, ProgressLimitList } from './types';
4
5
  export type LoadStatusProps = WithSupportProps<{
5
- label?: string;
6
+ label?: ReactNode;
6
7
  value?: string;
7
8
  hint?: string;
8
9
  valueType?: LoadValueType;
@@ -10,4 +11,14 @@ export type LoadStatusProps = WithSupportProps<{
10
11
  showErrorIcon?: boolean;
11
12
  className?: string;
12
13
  } & Pick<ProgressBarProps, 'progress' | 'size'>>;
13
- export declare function LoadStatus({ label, value, hint, valueType, progress, size, appearanceByProgress, showErrorIcon, className, ...props }: LoadStatusProps): import("react/jsx-runtime").JSX.Element;
14
+ export declare const LoadStatus: import("react").ForwardRefExoticComponent<{
15
+ 'data-test-id'?: string;
16
+ } & import("react").AriaAttributes & {
17
+ label?: ReactNode;
18
+ value?: string;
19
+ hint?: string;
20
+ valueType?: LoadValueType;
21
+ appearanceByProgress?: ProgressLimitList;
22
+ showErrorIcon?: boolean;
23
+ className?: string;
24
+ } & Pick<ProgressBarProps, "progress" | "size"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -14,9 +14,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.LoadStatus = LoadStatus;
17
+ exports.LoadStatus = void 0;
18
18
  const jsx_runtime_1 = require("react/jsx-runtime");
19
19
  const classnames_1 = __importDefault(require("classnames"));
20
+ const react_1 = require("react");
20
21
  const uikit_product_icons_1 = require("@cloud-ru/uikit-product-icons");
21
22
  const uikit_product_utils_1 = require("@cloud-ru/uikit-product-utils");
22
23
  const figma_tokens_1 = require("@snack-uikit/figma-tokens");
@@ -25,10 +26,10 @@ const typography_1 = require("@snack-uikit/typography");
25
26
  const constants_1 = require("./constants");
26
27
  const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
27
28
  const utils_1 = require("./utils");
28
- function LoadStatus(_a) {
29
+ exports.LoadStatus = (0, react_1.forwardRef)(function LoadStatus(_a, ref) {
29
30
  var { label, value, hint, valueType = 'none', progress, size = 's', appearanceByProgress = constants_1.DEFAULT_APPEARANCE_BY_PROGRESS, showErrorIcon, className } = _a, props = __rest(_a, ["label", "value", "hint", "valueType", "progress", "size", "appearanceByProgress", "showErrorIcon", "className"]);
30
31
  const progressAppearance = (0, utils_1.getProgressBarColor)(progress, appearanceByProgress);
31
32
  const isShowHeader = label || value || valueType !== 'none';
32
33
  const symbol = constants_1.SYMBOL_BY_TYPE[valueType];
33
- return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, classnames_1.default)(styles_module_scss_1.default.loadStatus, className) }, (0, uikit_product_utils_1.extractSupportProps)(props), { children: [isShowHeader && ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.header, children: [(0, jsx_runtime_1.jsxs)(typography_1.Typography.SansBodyS, { children: [label, (0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.labelValue, children: value })] }), symbol && ((0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyS, { className: styles_module_scss_1.default.valueSymbol, children: `${progress} ${symbol}` }))] })), (0, jsx_runtime_1.jsx)(progress_bar_1.ProgressBar, { progress: progress, size: size, appearance: progressAppearance }), hint && ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.hintWrapper, children: [showErrorIcon && (0, jsx_runtime_1.jsx)(uikit_product_icons_1.CrossFilledSVG, { color: figma_tokens_1.themeVars.sys.red.accentDefault, size: 16 }), (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyS, { className: styles_module_scss_1.default.hint, children: hint })] }))] })));
34
- }
34
+ return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, classnames_1.default)(styles_module_scss_1.default.loadStatus, className), ref: ref }, (0, uikit_product_utils_1.extractSupportProps)(props), { children: [isShowHeader && ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.header, children: [(0, jsx_runtime_1.jsxs)(typography_1.Typography.SansBodyS, { children: [label, (0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.labelValue, children: value })] }), symbol && ((0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyS, { className: styles_module_scss_1.default.valueSymbol, children: `${progress} ${symbol}` }))] })), (0, jsx_runtime_1.jsx)(progress_bar_1.ProgressBar, { progress: progress, size: size, appearance: progressAppearance }), hint && ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.hintWrapper, children: [showErrorIcon && (0, jsx_runtime_1.jsx)(uikit_product_icons_1.CrossFilledSVG, { color: figma_tokens_1.themeVars.sys.red.accentDefault, size: 16 }), (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyS, { className: styles_module_scss_1.default.hint, children: hint })] }))] })));
35
+ });
@@ -1,8 +1,9 @@
1
+ import { ReactNode } from 'react';
1
2
  import { WithSupportProps } from '@cloud-ru/uikit-product-utils';
2
3
  import { ProgressBarProps } from '@snack-uikit/progress-bar';
3
4
  import { LoadValueType, ProgressLimitList } from './types';
4
5
  export type LoadStatusProps = WithSupportProps<{
5
- label?: string;
6
+ label?: ReactNode;
6
7
  value?: string;
7
8
  hint?: string;
8
9
  valueType?: LoadValueType;
@@ -10,4 +11,14 @@ export type LoadStatusProps = WithSupportProps<{
10
11
  showErrorIcon?: boolean;
11
12
  className?: string;
12
13
  } & Pick<ProgressBarProps, 'progress' | 'size'>>;
13
- export declare function LoadStatus({ label, value, hint, valueType, progress, size, appearanceByProgress, showErrorIcon, className, ...props }: LoadStatusProps): import("react/jsx-runtime").JSX.Element;
14
+ export declare const LoadStatus: import("react").ForwardRefExoticComponent<{
15
+ 'data-test-id'?: string;
16
+ } & import("react").AriaAttributes & {
17
+ label?: ReactNode;
18
+ value?: string;
19
+ hint?: string;
20
+ valueType?: LoadValueType;
21
+ appearanceByProgress?: ProgressLimitList;
22
+ showErrorIcon?: boolean;
23
+ className?: string;
24
+ } & Pick<ProgressBarProps, "progress" | "size"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -11,6 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import cn from 'classnames';
14
+ import { forwardRef } from 'react';
14
15
  import { CrossFilledSVG } from '@cloud-ru/uikit-product-icons';
15
16
  import { extractSupportProps } from '@cloud-ru/uikit-product-utils';
16
17
  import { themeVars } from '@snack-uikit/figma-tokens';
@@ -19,10 +20,10 @@ import { Typography } from '@snack-uikit/typography';
19
20
  import { DEFAULT_APPEARANCE_BY_PROGRESS, SYMBOL_BY_TYPE } from './constants';
20
21
  import styles from './styles.module.css';
21
22
  import { getProgressBarColor } from './utils';
22
- export function LoadStatus(_a) {
23
+ export const LoadStatus = forwardRef(function LoadStatus(_a, ref) {
23
24
  var { label, value, hint, valueType = 'none', progress, size = 's', appearanceByProgress = DEFAULT_APPEARANCE_BY_PROGRESS, showErrorIcon, className } = _a, props = __rest(_a, ["label", "value", "hint", "valueType", "progress", "size", "appearanceByProgress", "showErrorIcon", "className"]);
24
25
  const progressAppearance = getProgressBarColor(progress, appearanceByProgress);
25
26
  const isShowHeader = label || value || valueType !== 'none';
26
27
  const symbol = SYMBOL_BY_TYPE[valueType];
27
- return (_jsxs("div", Object.assign({ className: cn(styles.loadStatus, className) }, extractSupportProps(props), { children: [isShowHeader && (_jsxs("div", { className: styles.header, children: [_jsxs(Typography.SansBodyS, { children: [label, _jsx("span", { className: styles.labelValue, children: value })] }), symbol && (_jsx(Typography.SansBodyS, { className: styles.valueSymbol, children: `${progress} ${symbol}` }))] })), _jsx(ProgressBar, { progress: progress, size: size, appearance: progressAppearance }), hint && (_jsxs("div", { className: styles.hintWrapper, children: [showErrorIcon && _jsx(CrossFilledSVG, { color: themeVars.sys.red.accentDefault, size: 16 }), _jsx(Typography.SansBodyS, { className: styles.hint, children: hint })] }))] })));
28
- }
28
+ return (_jsxs("div", Object.assign({ className: cn(styles.loadStatus, className), ref: ref }, extractSupportProps(props), { children: [isShowHeader && (_jsxs("div", { className: styles.header, children: [_jsxs(Typography.SansBodyS, { children: [label, _jsx("span", { className: styles.labelValue, children: value })] }), symbol && (_jsx(Typography.SansBodyS, { className: styles.valueSymbol, children: `${progress} ${symbol}` }))] })), _jsx(ProgressBar, { progress: progress, size: size, appearance: progressAppearance }), hint && (_jsxs("div", { className: styles.hintWrapper, children: [showErrorIcon && _jsx(CrossFilledSVG, { color: themeVars.sys.red.accentDefault, size: 16 }), _jsx(Typography.SansBodyS, { className: styles.hint, children: hint })] }))] })));
29
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloud-ru/uikit-product-load-status",
3
3
  "title": "Load Status",
4
- "version": "1.1.10",
4
+ "version": "1.1.11-preview-e99a99a6.0",
5
5
  "sideEffects": [
6
6
  "*.css",
7
7
  "*.woff",
@@ -45,5 +45,5 @@
45
45
  "peerDependencies": {
46
46
  "@snack-uikit/figma-tokens": "*"
47
47
  },
48
- "gitHead": "849cdd305b21bc8fea872e8645014d7fc4d3b2d6"
48
+ "gitHead": "e584fa2e3e9e6300502615ed545b67c1ac3beb7b"
49
49
  }
@@ -1,4 +1,5 @@
1
1
  import cn from 'classnames';
2
+ import { forwardRef, ReactNode } from 'react';
2
3
 
3
4
  import { CrossFilledSVG } from '@cloud-ru/uikit-product-icons';
4
5
  import { extractSupportProps, WithSupportProps } from '@cloud-ru/uikit-product-utils';
@@ -13,7 +14,7 @@ import { getProgressBarColor } from './utils';
13
14
 
14
15
  export type LoadStatusProps = WithSupportProps<
15
16
  {
16
- label?: string;
17
+ label?: ReactNode;
17
18
  value?: string;
18
19
  hint?: string;
19
20
  valueType?: LoadValueType;
@@ -23,18 +24,21 @@ export type LoadStatusProps = WithSupportProps<
23
24
  } & Pick<ProgressBarProps, 'progress' | 'size'>
24
25
  >;
25
26
 
26
- export function LoadStatus({
27
- label,
28
- value,
29
- hint,
30
- valueType = 'none',
31
- progress,
32
- size = 's',
33
- appearanceByProgress = DEFAULT_APPEARANCE_BY_PROGRESS,
34
- showErrorIcon,
35
- className,
36
- ...props
37
- }: LoadStatusProps) {
27
+ export const LoadStatus = forwardRef<HTMLDivElement, LoadStatusProps>(function LoadStatus(
28
+ {
29
+ label,
30
+ value,
31
+ hint,
32
+ valueType = 'none',
33
+ progress,
34
+ size = 's',
35
+ appearanceByProgress = DEFAULT_APPEARANCE_BY_PROGRESS,
36
+ showErrorIcon,
37
+ className,
38
+ ...props
39
+ },
40
+ ref,
41
+ ) {
38
42
  const progressAppearance = getProgressBarColor(progress, appearanceByProgress);
39
43
 
40
44
  const isShowHeader = label || value || valueType !== 'none';
@@ -42,7 +46,7 @@ export function LoadStatus({
42
46
  const symbol = SYMBOL_BY_TYPE[valueType];
43
47
 
44
48
  return (
45
- <div className={cn(styles.loadStatus, className)} {...extractSupportProps(props)}>
49
+ <div className={cn(styles.loadStatus, className)} ref={ref} {...extractSupportProps(props)}>
46
50
  {isShowHeader && (
47
51
  <div className={styles.header}>
48
52
  <Typography.SansBodyS>
@@ -65,4 +69,4 @@ export function LoadStatus({
65
69
  )}
66
70
  </div>
67
71
  );
68
- }
72
+ });