@qiwi/pijma-desktop 1.158.1 → 1.159.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qiwi/pijma-desktop",
3
- "version": "1.158.1",
3
+ "version": "1.159.1",
4
4
  "type": "module",
5
5
  "main": "./target/es5/index.js",
6
6
  "module": "./target/es6/index.js",
@@ -5,6 +5,7 @@ export interface ExtendedProgressBarProps {
5
5
  titleStart?: string;
6
6
  titleEnd?: string;
7
7
  stub?: boolean;
8
+ disabled?: boolean;
8
9
  formatValue?: (value: number) => string;
9
10
  }
10
11
  export declare const ExtendedProgressBar: FC<ExtendedProgressBarProps>;
@@ -14,14 +14,16 @@ var _pijmaCore = require("@qiwi/pijma-core");
14
14
  var _react = /*#__PURE__*/ _interopRequireDefault(require("react"));
15
15
  var _typography = require("../typography/index.js");
16
16
  var ExtendedProgressBar = function(param) {
17
- var value = param.value, _maxValue = param.maxValue, maxValue = _maxValue === void 0 ? 1 : _maxValue, titleStart = param.titleStart, titleEnd = param.titleEnd, _stub = param.stub, stub = _stub === void 0 ? false : _stub, formatValue = param.formatValue;
17
+ var value = param.value, _maxValue = param.maxValue, maxValue = _maxValue === void 0 ? 1 : _maxValue, titleStart = param.titleStart, titleEnd = param.titleEnd, _stub = param.stub, stub = _stub === void 0 ? false : _stub, _disabled = param.disabled, disabled = _disabled === void 0 ? false : _disabled, _formatValue = param.formatValue, formatValue = _formatValue === void 0 ? function(v) {
18
+ return v;
19
+ } : _formatValue;
18
20
  return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_pijmaCore.Spacer, {
19
21
  size: "xs",
20
22
  children: [
21
23
  /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_pijmaCore.Flex, {
22
24
  children: [
23
25
  /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pijmaCore.FlexItem, {
24
- width: stub ? 1 : value / maxValue,
26
+ width: stub || disabled || maxValue === 0 || value >= maxValue ? 1 : value / maxValue,
25
27
  minWidth: 2,
26
28
  transition: "width 300ms cubic-bezier(0.4, 0.0, 0.2, 1)",
27
29
  children: stub ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pijmaCore.Stub, {
@@ -32,10 +34,10 @@ var ExtendedProgressBar = function(param) {
32
34
  height: 2,
33
35
  width: 1,
34
36
  r: 4,
35
- bg: "#FF8C00"
37
+ bg: disabled ? "#E6E6E6" : maxValue === 0 ? "#F5F5F5" : "#FF8C00"
36
38
  })
37
39
  }),
38
- !stub && value < maxValue ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pijmaCore.FlexItem, {
40
+ !stub && !disabled && value < maxValue ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pijmaCore.FlexItem, {
39
41
  ml: 1,
40
42
  grow: 1,
41
43
  minWidth: 2,
@@ -57,20 +59,22 @@ var ExtendedProgressBar = function(param) {
57
59
  children: stub && titleStart ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_typography.Text, {
58
60
  size: "s",
59
61
  display: "block",
62
+ compact: true,
60
63
  stub: true
61
64
  }) : titleStart ? /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_typography.Paragraph, {
62
65
  size: "s",
66
+ compact: true,
63
67
  children: [
64
68
  /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_typography.Text, {
65
69
  color: "support",
66
70
  children: [
67
71
  titleStart,
68
- ": "
72
+ value !== undefined ? ": " : ""
69
73
  ]
70
74
  }),
71
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_typography.Text, {
72
- children: formatValue !== undefined ? formatValue(value) : value
73
- })
75
+ value !== undefined ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_typography.Text, {
76
+ children: formatValue(value)
77
+ }) : null
74
78
  ]
75
79
  }) : null
76
80
  }),
@@ -79,20 +83,22 @@ var ExtendedProgressBar = function(param) {
79
83
  children: stub && titleEnd ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_typography.Text, {
80
84
  size: "s",
81
85
  display: "block",
86
+ compact: true,
82
87
  stub: true
83
88
  }) : titleEnd ? /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_typography.Paragraph, {
84
89
  size: "s",
90
+ compact: true,
85
91
  children: [
86
92
  /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_typography.Text, {
87
93
  color: "support",
88
94
  children: [
89
95
  titleEnd,
90
- ": "
96
+ value !== undefined && maxValue !== undefined ? ": " : ""
91
97
  ]
92
98
  }),
93
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_typography.Text, {
94
- children: formatValue !== undefined ? formatValue(maxValue - value) : maxValue - value
95
- })
99
+ value !== undefined && maxValue !== undefined ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_typography.Text, {
100
+ children: formatValue(Math.max(maxValue - value, 0))
101
+ }) : null
96
102
  ]
97
103
  }) : null
98
104
  })
@@ -2,13 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Card, Flex, FlexItem, Spacer, Stub } from '@qiwi/pijma-core';
3
3
  import React from 'react';
4
4
  import { Paragraph, Text } from '../typography/index.js';
5
- export const ExtendedProgressBar = ({ value , maxValue =1 , titleStart , titleEnd , stub =false , formatValue , })=>/*#__PURE__*/ _jsxs(Spacer, {
5
+ export const ExtendedProgressBar = ({ value , maxValue =1 , titleStart , titleEnd , stub =false , disabled =false , formatValue =(v)=>v , })=>/*#__PURE__*/ _jsxs(Spacer, {
6
6
  size: "xs",
7
7
  children: [
8
8
  /*#__PURE__*/ _jsxs(Flex, {
9
9
  children: [
10
10
  /*#__PURE__*/ _jsx(FlexItem, {
11
- width: stub ? 1 : value / maxValue,
11
+ width: stub || disabled || maxValue === 0 || value >= maxValue ? 1 : value / maxValue,
12
12
  minWidth: 2,
13
13
  transition: "width 300ms cubic-bezier(0.4, 0.0, 0.2, 1)",
14
14
  children: stub ? /*#__PURE__*/ _jsx(Stub, {
@@ -19,10 +19,10 @@ export const ExtendedProgressBar = ({ value , maxValue =1 , titleStart , titleEn
19
19
  height: 2,
20
20
  width: 1,
21
21
  r: 4,
22
- bg: "#FF8C00"
22
+ bg: disabled ? '#E6E6E6' : maxValue === 0 ? '#F5F5F5' : '#FF8C00'
23
23
  })
24
24
  }),
25
- !stub && value < maxValue ? /*#__PURE__*/ _jsx(FlexItem, {
25
+ !stub && !disabled && value < maxValue ? /*#__PURE__*/ _jsx(FlexItem, {
26
26
  ml: 1,
27
27
  grow: 1,
28
28
  minWidth: 2,
@@ -44,20 +44,22 @@ export const ExtendedProgressBar = ({ value , maxValue =1 , titleStart , titleEn
44
44
  children: stub && titleStart ? /*#__PURE__*/ _jsx(Text, {
45
45
  size: "s",
46
46
  display: "block",
47
+ compact: true,
47
48
  stub: true
48
49
  }) : titleStart ? /*#__PURE__*/ _jsxs(Paragraph, {
49
50
  size: "s",
51
+ compact: true,
50
52
  children: [
51
53
  /*#__PURE__*/ _jsxs(Text, {
52
54
  color: "support",
53
55
  children: [
54
56
  titleStart,
55
- ": "
57
+ value !== undefined ? ': ' : ''
56
58
  ]
57
59
  }),
58
- /*#__PURE__*/ _jsx(Text, {
59
- children: formatValue !== undefined ? formatValue(value) : value
60
- })
60
+ value !== undefined ? /*#__PURE__*/ _jsx(Text, {
61
+ children: formatValue(value)
62
+ }) : null
61
63
  ]
62
64
  }) : null
63
65
  }),
@@ -66,20 +68,22 @@ export const ExtendedProgressBar = ({ value , maxValue =1 , titleStart , titleEn
66
68
  children: stub && titleEnd ? /*#__PURE__*/ _jsx(Text, {
67
69
  size: "s",
68
70
  display: "block",
71
+ compact: true,
69
72
  stub: true
70
73
  }) : titleEnd ? /*#__PURE__*/ _jsxs(Paragraph, {
71
74
  size: "s",
75
+ compact: true,
72
76
  children: [
73
77
  /*#__PURE__*/ _jsxs(Text, {
74
78
  color: "support",
75
79
  children: [
76
80
  titleEnd,
77
- ": "
81
+ value !== undefined && maxValue !== undefined ? ': ' : ''
78
82
  ]
79
83
  }),
80
- /*#__PURE__*/ _jsx(Text, {
81
- children: formatValue !== undefined ? formatValue(maxValue - value) : maxValue - value
82
- })
84
+ value !== undefined && maxValue !== undefined ? /*#__PURE__*/ _jsx(Text, {
85
+ children: formatValue(Math.max(maxValue - value, 0))
86
+ }) : null
83
87
  ]
84
88
  }) : null
85
89
  })