@cloud-ru/uikit-product-load-status 0.0.54 → 0.0.55

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cjs/components/LoadStatus.d.ts +13 -0
  3. package/dist/cjs/components/LoadStatus.js +34 -0
  4. package/dist/cjs/components/constants.d.ts +3 -0
  5. package/dist/cjs/components/constants.js +12 -0
  6. package/dist/cjs/components/index.d.ts +1 -0
  7. package/dist/cjs/components/index.js +17 -0
  8. package/dist/cjs/components/styles.module.css +29 -0
  9. package/dist/cjs/components/types.d.ts +9 -0
  10. package/dist/cjs/components/types.js +2 -0
  11. package/dist/cjs/components/utils/getProgressBarColor.d.ts +3 -0
  12. package/dist/cjs/components/utils/getProgressBarColor.js +38 -0
  13. package/dist/cjs/components/utils/index.d.ts +1 -0
  14. package/dist/cjs/components/utils/index.js +17 -0
  15. package/dist/cjs/index.d.ts +1 -0
  16. package/dist/cjs/index.js +17 -0
  17. package/dist/esm/components/LoadStatus.d.ts +13 -0
  18. package/dist/esm/components/LoadStatus.js +28 -0
  19. package/dist/esm/components/constants.d.ts +3 -0
  20. package/dist/esm/components/constants.js +9 -0
  21. package/dist/esm/components/index.d.ts +1 -0
  22. package/dist/esm/components/index.js +1 -0
  23. package/dist/esm/components/styles.module.css +29 -0
  24. package/dist/esm/components/types.d.ts +9 -0
  25. package/dist/esm/components/types.js +1 -0
  26. package/dist/esm/components/utils/getProgressBarColor.d.ts +3 -0
  27. package/dist/esm/components/utils/getProgressBarColor.js +34 -0
  28. package/dist/esm/components/utils/index.d.ts +1 -0
  29. package/dist/esm/components/utils/index.js +1 -0
  30. package/dist/esm/index.d.ts +1 -0
  31. package/dist/esm/index.js +1 -0
  32. package/package.json +5 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 0.0.55 (2025-11-12)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **PD-3377:** contributors update to publish all packages ([719fd3e](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/719fd3e1249e247443b125c47ea408d92c8395c3))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 0.0.54 (2025-11-12)
7
18
 
8
19
  ### Only dependencies have been changed
@@ -0,0 +1,13 @@
1
+ import { WithSupportProps } from '@sbercloud/uikit-product-utils';
2
+ import { ProgressBarProps } from '@snack-uikit/progress-bar';
3
+ import { LoadValueType, ProgressLimitList } from './types';
4
+ export type LoadStatusProps = WithSupportProps<{
5
+ label?: string;
6
+ value?: string;
7
+ hint?: string;
8
+ valueType?: LoadValueType;
9
+ appearanceByProgress?: ProgressLimitList;
10
+ showErrorIcon?: boolean;
11
+ className?: string;
12
+ } & 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;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.LoadStatus = LoadStatus;
18
+ const jsx_runtime_1 = require("react/jsx-runtime");
19
+ const classnames_1 = __importDefault(require("classnames"));
20
+ const figma_tokens_cloud_platform_1 = require("@sbercloud/figma-tokens-cloud-platform");
21
+ const uikit_product_icons_1 = require("@sbercloud/uikit-product-icons");
22
+ const uikit_product_utils_1 = require("@sbercloud/uikit-product-utils");
23
+ const progress_bar_1 = require("@snack-uikit/progress-bar");
24
+ const typography_1 = require("@snack-uikit/typography");
25
+ const constants_1 = require("./constants");
26
+ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
27
+ const utils_1 = require("./utils");
28
+ function LoadStatus(_a) {
29
+ 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
+ const progressAppearance = (0, utils_1.getProgressBarColor)(progress, appearanceByProgress);
31
+ const isShowHeader = label || value || valueType !== 'none';
32
+ 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_cloud_platform_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
+ }
@@ -0,0 +1,3 @@
1
+ import { LoadValueType, ProgressLimitList } from './types';
2
+ export declare const DEFAULT_APPEARANCE_BY_PROGRESS: ProgressLimitList;
3
+ export declare const SYMBOL_BY_TYPE: Record<LoadValueType, string>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SYMBOL_BY_TYPE = exports.DEFAULT_APPEARANCE_BY_PROGRESS = void 0;
4
+ exports.DEFAULT_APPEARANCE_BY_PROGRESS = [
5
+ { appearance: 'green', condition: 'lte', limit: 70 },
6
+ { appearance: 'yellow', condition: 'lte', limit: 90 },
7
+ { appearance: 'red', condition: 'lte', limit: 100 },
8
+ ];
9
+ exports.SYMBOL_BY_TYPE = {
10
+ none: '',
11
+ percent: '%',
12
+ };
@@ -0,0 +1 @@
1
+ export * from './LoadStatus';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./LoadStatus"), exports);
@@ -0,0 +1,29 @@
1
+ .loadStatus{
2
+ display:flex;
3
+ flex-direction:column;
4
+ gap:4px;
5
+ }
6
+
7
+ .header{
8
+ display:flex;
9
+ justify-content:space-between;
10
+ }
11
+
12
+ .labelValue{
13
+ margin-left:4px;
14
+ color:var(--sys-neutral-text-light, #8b8e9b);
15
+ }
16
+
17
+ .valueSymbol{
18
+ color:var(--sys-neutral-text-light, #8b8e9b);
19
+ }
20
+
21
+ .hint{
22
+ color:var(--sys-neutral-text-light, #8b8e9b);
23
+ }
24
+
25
+ .hintWrapper{
26
+ display:flex;
27
+ align-items:center;
28
+ gap:2px;
29
+ }
@@ -0,0 +1,9 @@
1
+ import { ProgressBarProps } from '@snack-uikit/progress-bar';
2
+ export type LoadValueType = 'none' | 'percent';
3
+ type ProgressLimit = {
4
+ condition: 'eq' | 'gt' | 'gte' | 'lt' | 'lte';
5
+ limit: number;
6
+ appearance: ProgressBarProps['appearance'];
7
+ };
8
+ export type ProgressLimitList = ProgressLimit[];
9
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { ProgressBarProps } from '@snack-uikit/progress-bar';
2
+ import { ProgressLimitList } from '../types';
3
+ export declare const getProgressBarColor: (progress: number, limits: ProgressLimitList) => ProgressBarProps["appearance"];
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProgressBarColor = void 0;
4
+ const getProgressBarColor = (progress, limits) => {
5
+ for (const limit of limits) {
6
+ switch (limit.condition) {
7
+ case 'eq':
8
+ if (progress === limit.limit) {
9
+ return limit.appearance;
10
+ }
11
+ break;
12
+ case 'gt':
13
+ if (progress > limit.limit) {
14
+ return limit.appearance;
15
+ }
16
+ break;
17
+ case 'gte':
18
+ if (progress >= limit.limit) {
19
+ return limit.appearance;
20
+ }
21
+ break;
22
+ case 'lt':
23
+ if (progress < limit.limit) {
24
+ return limit.appearance;
25
+ }
26
+ break;
27
+ case 'lte':
28
+ if (progress <= limit.limit) {
29
+ return limit.appearance;
30
+ }
31
+ break;
32
+ default:
33
+ return 'neutral';
34
+ }
35
+ }
36
+ return 'neutral';
37
+ };
38
+ exports.getProgressBarColor = getProgressBarColor;
@@ -0,0 +1 @@
1
+ export * from './getProgressBarColor';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./getProgressBarColor"), exports);
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./components"), exports);
@@ -0,0 +1,13 @@
1
+ import { WithSupportProps } from '@sbercloud/uikit-product-utils';
2
+ import { ProgressBarProps } from '@snack-uikit/progress-bar';
3
+ import { LoadValueType, ProgressLimitList } from './types';
4
+ export type LoadStatusProps = WithSupportProps<{
5
+ label?: string;
6
+ value?: string;
7
+ hint?: string;
8
+ valueType?: LoadValueType;
9
+ appearanceByProgress?: ProgressLimitList;
10
+ showErrorIcon?: boolean;
11
+ className?: string;
12
+ } & 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;
@@ -0,0 +1,28 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import cn from 'classnames';
14
+ import { themeVars } from '@sbercloud/figma-tokens-cloud-platform';
15
+ import { CrossFilledSVG } from '@sbercloud/uikit-product-icons';
16
+ import { extractSupportProps } from '@sbercloud/uikit-product-utils';
17
+ import { ProgressBar } from '@snack-uikit/progress-bar';
18
+ import { Typography } from '@snack-uikit/typography';
19
+ import { DEFAULT_APPEARANCE_BY_PROGRESS, SYMBOL_BY_TYPE } from './constants';
20
+ import styles from './styles.module.css';
21
+ import { getProgressBarColor } from './utils';
22
+ export function LoadStatus(_a) {
23
+ 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
+ const progressAppearance = getProgressBarColor(progress, appearanceByProgress);
25
+ const isShowHeader = label || value || valueType !== 'none';
26
+ 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
+ }
@@ -0,0 +1,3 @@
1
+ import { LoadValueType, ProgressLimitList } from './types';
2
+ export declare const DEFAULT_APPEARANCE_BY_PROGRESS: ProgressLimitList;
3
+ export declare const SYMBOL_BY_TYPE: Record<LoadValueType, string>;
@@ -0,0 +1,9 @@
1
+ export const DEFAULT_APPEARANCE_BY_PROGRESS = [
2
+ { appearance: 'green', condition: 'lte', limit: 70 },
3
+ { appearance: 'yellow', condition: 'lte', limit: 90 },
4
+ { appearance: 'red', condition: 'lte', limit: 100 },
5
+ ];
6
+ export const SYMBOL_BY_TYPE = {
7
+ none: '',
8
+ percent: '%',
9
+ };
@@ -0,0 +1 @@
1
+ export * from './LoadStatus';
@@ -0,0 +1 @@
1
+ export * from './LoadStatus';
@@ -0,0 +1,29 @@
1
+ .loadStatus{
2
+ display:flex;
3
+ flex-direction:column;
4
+ gap:4px;
5
+ }
6
+
7
+ .header{
8
+ display:flex;
9
+ justify-content:space-between;
10
+ }
11
+
12
+ .labelValue{
13
+ margin-left:4px;
14
+ color:var(--sys-neutral-text-light, #8b8e9b);
15
+ }
16
+
17
+ .valueSymbol{
18
+ color:var(--sys-neutral-text-light, #8b8e9b);
19
+ }
20
+
21
+ .hint{
22
+ color:var(--sys-neutral-text-light, #8b8e9b);
23
+ }
24
+
25
+ .hintWrapper{
26
+ display:flex;
27
+ align-items:center;
28
+ gap:2px;
29
+ }
@@ -0,0 +1,9 @@
1
+ import { ProgressBarProps } from '@snack-uikit/progress-bar';
2
+ export type LoadValueType = 'none' | 'percent';
3
+ type ProgressLimit = {
4
+ condition: 'eq' | 'gt' | 'gte' | 'lt' | 'lte';
5
+ limit: number;
6
+ appearance: ProgressBarProps['appearance'];
7
+ };
8
+ export type ProgressLimitList = ProgressLimit[];
9
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { ProgressBarProps } from '@snack-uikit/progress-bar';
2
+ import { ProgressLimitList } from '../types';
3
+ export declare const getProgressBarColor: (progress: number, limits: ProgressLimitList) => ProgressBarProps["appearance"];
@@ -0,0 +1,34 @@
1
+ export const getProgressBarColor = (progress, limits) => {
2
+ for (const limit of limits) {
3
+ switch (limit.condition) {
4
+ case 'eq':
5
+ if (progress === limit.limit) {
6
+ return limit.appearance;
7
+ }
8
+ break;
9
+ case 'gt':
10
+ if (progress > limit.limit) {
11
+ return limit.appearance;
12
+ }
13
+ break;
14
+ case 'gte':
15
+ if (progress >= limit.limit) {
16
+ return limit.appearance;
17
+ }
18
+ break;
19
+ case 'lt':
20
+ if (progress < limit.limit) {
21
+ return limit.appearance;
22
+ }
23
+ break;
24
+ case 'lte':
25
+ if (progress <= limit.limit) {
26
+ return limit.appearance;
27
+ }
28
+ break;
29
+ default:
30
+ return 'neutral';
31
+ }
32
+ }
33
+ return 'neutral';
34
+ };
@@ -0,0 +1 @@
1
+ export * from './getProgressBarColor';
@@ -0,0 +1 @@
1
+ export * from './getProgressBarColor';
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1 @@
1
+ export * from './components';
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": "0.0.54",
4
+ "version": "0.0.55",
5
5
  "sideEffects": [
6
6
  "*.css",
7
7
  "*.woff",
@@ -30,17 +30,18 @@
30
30
  "name": "Akhremenko Grigorii",
31
31
  "url": "https://github.com/AGrigorii"
32
32
  },
33
+ "contributors": [],
33
34
  "license": "Apache-2.0",
34
35
  "publishConfig": {
35
36
  "access": "public"
36
37
  },
37
38
  "scripts": {},
38
39
  "dependencies": {
39
- "@cloud-ru/uikit-product-icons": "15.1.1",
40
- "@cloud-ru/uikit-product-utils": "7.0.0",
40
+ "@cloud-ru/uikit-product-icons": "15.1.2",
41
+ "@cloud-ru/uikit-product-utils": "7.0.1",
41
42
  "@snack-uikit/progress-bar": "0.1.3",
42
43
  "@snack-uikit/typography": "0.8.4",
43
44
  "classnames": "2.5.1"
44
45
  },
45
- "gitHead": "e8bd79bc92b26a8f52611972eec98a867536ccd3"
46
+ "gitHead": "9c11b1e33e716c874534a1c162266c8591f2ed03"
46
47
  }