@qiwi/pijma-mobile 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-mobile",
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",
@@ -4,6 +4,7 @@ export interface ExtendedProgressBarProps {
4
4
  maxValue?: number;
5
5
  titleStart?: string;
6
6
  titleEnd?: string;
7
+ disabled?: boolean;
7
8
  stub?: boolean;
8
9
  formatValue?: (value: number) => string;
9
10
  }
@@ -14,7 +14,9 @@ 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, _disabled = param.disabled, disabled = _disabled === void 0 ? false : _disabled, _stub = param.stub, stub = _stub === void 0 ? false : _stub, _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: "xxs",
20
22
  children: [
@@ -23,23 +25,23 @@ var ExtendedProgressBar = function(param) {
23
25
  children: [
24
26
  /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pijmaCore.FlexItem, {
25
27
  width: stub ? 0.15 : undefined,
26
- children: titleStart ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_typography.Text, {
28
+ children: titleStart && value !== undefined ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_typography.Text, {
27
29
  size: "s",
28
30
  bold: false,
29
31
  stub: stub,
30
32
  display: stub ? "block" : undefined,
31
- children: stub ? undefined : formatValue !== undefined ? formatValue(value) : value,
33
+ children: stub ? undefined : formatValue(value),
32
34
  compact: true
33
35
  }) : null
34
36
  }),
35
37
  /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pijmaCore.FlexItem, {
36
38
  width: stub ? 0.15 : undefined,
37
- children: titleEnd ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_typography.Text, {
39
+ children: titleEnd && value !== undefined && maxValue !== undefined ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_typography.Text, {
38
40
  size: "s",
39
41
  bold: false,
40
42
  stub: stub,
41
43
  display: stub ? "block" : undefined,
42
- children: stub ? undefined : formatValue !== undefined ? formatValue(maxValue - value) : maxValue - value,
44
+ children: stub ? undefined : formatValue(Math.max(maxValue - value, 0)),
43
45
  compact: true
44
46
  }) : null
45
47
  })
@@ -48,7 +50,7 @@ var ExtendedProgressBar = function(param) {
48
50
  /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_pijmaCore.Flex, {
49
51
  children: [
50
52
  /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pijmaCore.FlexItem, {
51
- width: stub ? 1 : value / maxValue,
53
+ width: stub || disabled || maxValue === 0 || value >= maxValue ? 1 : value / maxValue,
52
54
  minWidth: "4px",
53
55
  transition: "width 300ms cubic-bezier(0.4, 0.0, 0.2, 1)",
54
56
  children: stub ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pijmaCore.Stub, {
@@ -59,11 +61,11 @@ var ExtendedProgressBar = function(param) {
59
61
  height: "4px",
60
62
  width: 1,
61
63
  r: 2,
62
- bg: "#FF8C00"
64
+ bg: disabled ? "#E6E6E6" : maxValue === 0 ? "#F5F5F5" : "#FF8C00"
63
65
  })
64
66
  }),
65
- !stub && value < maxValue ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pijmaCore.FlexItem, {
66
- ml: "2px",
67
+ !stub && !disabled && value < maxValue ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pijmaCore.FlexItem, {
68
+ ml: 1,
67
69
  grow: 1,
68
70
  minWidth: "4px",
69
71
  children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pijmaCore.Card, {
@@ -2,7 +2,7 @@ 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 { 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 , disabled =false , stub =false , formatValue =(v)=>v , })=>/*#__PURE__*/ _jsxs(Spacer, {
6
6
  size: "xxs",
7
7
  children: [
8
8
  titleStart || titleEnd ? /*#__PURE__*/ _jsxs(Flex, {
@@ -10,23 +10,23 @@ export const ExtendedProgressBar = ({ value , maxValue =1 , titleStart , titleEn
10
10
  children: [
11
11
  /*#__PURE__*/ _jsx(FlexItem, {
12
12
  width: stub ? 0.15 : undefined,
13
- children: titleStart ? /*#__PURE__*/ _jsx(Text, {
13
+ children: titleStart && value !== undefined ? /*#__PURE__*/ _jsx(Text, {
14
14
  size: "s",
15
15
  bold: false,
16
16
  stub: stub,
17
17
  display: stub ? 'block' : undefined,
18
- children: stub ? undefined : formatValue !== undefined ? formatValue(value) : value,
18
+ children: stub ? undefined : formatValue(value),
19
19
  compact: true
20
20
  }) : null
21
21
  }),
22
22
  /*#__PURE__*/ _jsx(FlexItem, {
23
23
  width: stub ? 0.15 : undefined,
24
- children: titleEnd ? /*#__PURE__*/ _jsx(Text, {
24
+ children: titleEnd && value !== undefined && maxValue !== undefined ? /*#__PURE__*/ _jsx(Text, {
25
25
  size: "s",
26
26
  bold: false,
27
27
  stub: stub,
28
28
  display: stub ? 'block' : undefined,
29
- children: stub ? undefined : formatValue !== undefined ? formatValue(maxValue - value) : maxValue - value,
29
+ children: stub ? undefined : formatValue(Math.max(maxValue - value, 0)),
30
30
  compact: true
31
31
  }) : null
32
32
  })
@@ -35,7 +35,7 @@ export const ExtendedProgressBar = ({ value , maxValue =1 , titleStart , titleEn
35
35
  /*#__PURE__*/ _jsxs(Flex, {
36
36
  children: [
37
37
  /*#__PURE__*/ _jsx(FlexItem, {
38
- width: stub ? 1 : value / maxValue,
38
+ width: stub || disabled || maxValue === 0 || value >= maxValue ? 1 : value / maxValue,
39
39
  minWidth: "4px",
40
40
  transition: "width 300ms cubic-bezier(0.4, 0.0, 0.2, 1)",
41
41
  children: stub ? /*#__PURE__*/ _jsx(Stub, {
@@ -46,11 +46,11 @@ export const ExtendedProgressBar = ({ value , maxValue =1 , titleStart , titleEn
46
46
  height: "4px",
47
47
  width: 1,
48
48
  r: 2,
49
- bg: "#FF8C00"
49
+ bg: disabled ? '#E6E6E6' : maxValue === 0 ? '#F5F5F5' : '#FF8C00'
50
50
  })
51
51
  }),
52
- !stub && value < maxValue ? /*#__PURE__*/ _jsx(FlexItem, {
53
- ml: "2px",
52
+ !stub && !disabled && value < maxValue ? /*#__PURE__*/ _jsx(FlexItem, {
53
+ ml: 1,
54
54
  grow: 1,
55
55
  minWidth: "4px",
56
56
  children: /*#__PURE__*/ _jsx(Card, {