@salutejs/plasma-new-hope 0.338.0-canary.2280.18389973911.0 → 0.338.0-canary.2280.18409919038.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.
Files changed (83) hide show
  1. package/cjs/components/ProgressBarCircular/ProgressBarCircular.css +5 -0
  2. package/cjs/components/ProgressBarCircular/ProgressBarCircular.js +108 -0
  3. package/cjs/components/ProgressBarCircular/ProgressBarCircular.js.map +1 -0
  4. package/cjs/components/ProgressBarCircular/ProgressBarCircular.styles.js +54 -0
  5. package/cjs/components/ProgressBarCircular/ProgressBarCircular.styles.js.map +1 -0
  6. package/cjs/components/ProgressBarCircular/ProgressBarCircular.styles_m8m7d7.css +5 -0
  7. package/cjs/components/ProgressBarCircular/ProgressBarCircular.tokens.js +29 -0
  8. package/cjs/components/ProgressBarCircular/ProgressBarCircular.tokens.js.map +1 -0
  9. package/cjs/components/ProgressBarCircular/variations/_size/base.js +9 -0
  10. package/cjs/components/ProgressBarCircular/variations/_size/base.js.map +1 -0
  11. package/cjs/components/ProgressBarCircular/variations/_size/base_x642ct.css +1 -0
  12. package/cjs/components/ProgressBarCircular/variations/_view/base.js +9 -0
  13. package/cjs/components/ProgressBarCircular/variations/_view/base.js.map +1 -0
  14. package/cjs/components/ProgressBarCircular/variations/_view/base_x642ct.css +1 -0
  15. package/cjs/index.css +6 -0
  16. package/cjs/index.js +7 -0
  17. package/cjs/index.js.map +1 -1
  18. package/cjs/utils/getTokenValueInPixels.js +31 -0
  19. package/cjs/utils/getTokenValueInPixels.js.map +1 -0
  20. package/cjs/utils/index.js.map +1 -1
  21. package/emotion/cjs/components/ProgressBarCircular/ProgressBarCircular.js +74 -8
  22. package/emotion/cjs/components/ProgressBarCircular/ProgressBarCircular.styles.js +49 -4
  23. package/emotion/cjs/examples/components/Combobox/Combobox.js +0 -15
  24. package/emotion/cjs/examples/components/ProgressBarCircular/ProgressBarCircular.config.js +13 -12
  25. package/emotion/cjs/index.js +1 -0
  26. package/emotion/cjs/utils/getTokenValueInPixels.js +76 -0
  27. package/emotion/cjs/utils/index.js +4 -0
  28. package/emotion/es/components/ProgressBarCircular/ProgressBarCircular.js +78 -12
  29. package/emotion/es/components/ProgressBarCircular/ProgressBarCircular.styles.js +25 -2
  30. package/emotion/es/examples/components/Combobox/Combobox.js +0 -7
  31. package/emotion/es/examples/components/ProgressBarCircular/ProgressBarCircular.config.js +13 -12
  32. package/emotion/es/index.js +1 -0
  33. package/emotion/es/utils/getTokenValueInPixels.js +66 -0
  34. package/emotion/es/utils/index.js +1 -0
  35. package/es/components/ProgressBarCircular/ProgressBarCircular.css +5 -0
  36. package/es/components/ProgressBarCircular/ProgressBarCircular.js +99 -0
  37. package/es/components/ProgressBarCircular/ProgressBarCircular.js.map +1 -0
  38. package/es/components/ProgressBarCircular/ProgressBarCircular.styles.js +46 -0
  39. package/es/components/ProgressBarCircular/ProgressBarCircular.styles.js.map +1 -0
  40. package/es/components/ProgressBarCircular/ProgressBarCircular.styles_m8m7d7.css +5 -0
  41. package/es/components/ProgressBarCircular/ProgressBarCircular.tokens.js +24 -0
  42. package/es/components/ProgressBarCircular/ProgressBarCircular.tokens.js.map +1 -0
  43. package/es/components/ProgressBarCircular/variations/_size/base.js +5 -0
  44. package/es/components/ProgressBarCircular/variations/_size/base.js.map +1 -0
  45. package/es/components/ProgressBarCircular/variations/_size/base_x642ct.css +1 -0
  46. package/es/components/ProgressBarCircular/variations/_view/base.js +5 -0
  47. package/es/components/ProgressBarCircular/variations/_view/base.js.map +1 -0
  48. package/es/components/ProgressBarCircular/variations/_view/base_x642ct.css +1 -0
  49. package/es/index.css +6 -0
  50. package/es/index.js +3 -0
  51. package/es/index.js.map +1 -1
  52. package/es/utils/getTokenValueInPixels.js +27 -0
  53. package/es/utils/getTokenValueInPixels.js.map +1 -0
  54. package/es/utils/index.js.map +1 -1
  55. package/package.json +2 -2
  56. package/styled-components/cjs/components/ProgressBarCircular/ProgressBarCircular.js +74 -8
  57. package/styled-components/cjs/components/ProgressBarCircular/ProgressBarCircular.styles.js +99 -15
  58. package/styled-components/cjs/examples/components/Combobox/Combobox.js +15 -0
  59. package/styled-components/cjs/examples/components/ProgressBarCircular/ProgressBarCircular.config.js +16 -3
  60. package/styled-components/cjs/index.js +1 -0
  61. package/styled-components/cjs/utils/getTokenValueInPixels.js +76 -0
  62. package/styled-components/cjs/utils/index.js +4 -0
  63. package/styled-components/es/components/ProgressBarCircular/ProgressBarCircular.js +78 -12
  64. package/styled-components/es/components/ProgressBarCircular/ProgressBarCircular.styles.js +39 -12
  65. package/styled-components/es/examples/components/ProgressBarCircular/ProgressBarCircular.config.js +16 -3
  66. package/styled-components/es/index.js +1 -0
  67. package/styled-components/es/utils/getTokenValueInPixels.js +66 -0
  68. package/styled-components/es/utils/index.js +1 -0
  69. package/types/components/ProgressBarCircular/ProgressBarCircular.d.ts.map +1 -1
  70. package/types/components/ProgressBarCircular/ProgressBarCircular.styles.d.ts +8 -0
  71. package/types/components/ProgressBarCircular/ProgressBarCircular.styles.d.ts.map +1 -1
  72. package/types/components/ProgressBarCircular/ProgressBarCircular.types.d.ts +4 -0
  73. package/types/components/ProgressBarCircular/ProgressBarCircular.types.d.ts.map +1 -1
  74. package/types/examples/components/ProgressBarCircular/ProgressBarCircular.config.d.ts +1 -0
  75. package/types/examples/components/ProgressBarCircular/ProgressBarCircular.config.d.ts.map +1 -1
  76. package/types/examples/components/ProgressBarCircular/ProgressBarCircular.d.ts +1 -0
  77. package/types/examples/components/ProgressBarCircular/ProgressBarCircular.d.ts.map +1 -1
  78. package/types/index.d.ts +1 -0
  79. package/types/index.d.ts.map +1 -1
  80. package/types/utils/getTokenValueInPixels.d.ts +2 -0
  81. package/types/utils/getTokenValueInPixels.d.ts.map +1 -0
  82. package/types/utils/index.d.ts +1 -0
  83. package/types/utils/index.d.ts.map +1 -1
@@ -2,31 +2,115 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "base", {
6
- enumerable: true,
7
- get: function() {
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get StyledBackgroundCircle () {
13
+ return StyledBackgroundCircle;
14
+ },
15
+ get StyledContent () {
16
+ return StyledContent;
17
+ },
18
+ get StyledProgressCircle () {
19
+ return StyledProgressCircle;
20
+ },
21
+ get StyledSVG () {
22
+ return StyledSVG;
23
+ },
24
+ get base () {
8
25
  return base;
9
26
  }
10
27
  });
11
- var _styledcomponents = require("styled-components");
28
+ var _styledcomponents = /*#__PURE__*/ _interop_require_wildcard(require("styled-components"));
12
29
  var _ProgressBarCirculartokens = require("./ProgressBarCircular.tokens");
30
+ function _getRequireWildcardCache(nodeInterop) {
31
+ if (typeof WeakMap !== "function") return null;
32
+ var cacheBabelInterop = new WeakMap();
33
+ var cacheNodeInterop = new WeakMap();
34
+ return (_getRequireWildcardCache = function(nodeInterop) {
35
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
36
+ })(nodeInterop);
37
+ }
38
+ function _interop_require_wildcard(obj, nodeInterop) {
39
+ if (!nodeInterop && obj && obj.__esModule) {
40
+ return obj;
41
+ }
42
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
43
+ return {
44
+ default: obj
45
+ };
46
+ }
47
+ var cache = _getRequireWildcardCache(nodeInterop);
48
+ if (cache && cache.has(obj)) {
49
+ return cache.get(obj);
50
+ }
51
+ var newObj = {
52
+ __proto__: null
53
+ };
54
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
55
+ for(var key in obj){
56
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
57
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
58
+ if (desc && (desc.get || desc.set)) {
59
+ Object.defineProperty(newObj, key, desc);
60
+ } else {
61
+ newObj[key] = obj[key];
62
+ }
63
+ }
64
+ }
65
+ newObj.default = obj;
66
+ if (cache) {
67
+ cache.set(obj, newObj);
68
+ }
69
+ return newObj;
70
+ }
13
71
  var base = (0, _styledcomponents.css)([
14
72
  "position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(",
15
73
  ");height:var(",
16
- ");.",
17
- "{width:100%;height:100%;}.",
18
- "{fill:none;stroke:var(",
19
- ");stroke-width:var(",
20
- ");}.",
21
- "{fill:none;stroke:var(",
22
- ");stroke-width:var(",
23
- ");stroke-linecap:round;transition:stroke-dashoffset 0.3s ease-in-out;}.",
24
- "{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:var(",
74
+ ");"
75
+ ], _ProgressBarCirculartokens.tokens.width, _ProgressBarCirculartokens.tokens.height);
76
+ var StyledSVG = _styledcomponents.default.svg.withConfig({
77
+ displayName: "ProgressBarCircular.styles__StyledSVG",
78
+ componentId: "sc-d5c5c64b-0"
79
+ })([
80
+ "width:100%;height:100%;"
81
+ ]);
82
+ var StyledBackgroundCircle = _styledcomponents.default.circle.withConfig({
83
+ displayName: "ProgressBarCircular.styles__StyledBackgroundCircle",
84
+ componentId: "sc-d5c5c64b-1"
85
+ })([
86
+ "fill:none;stroke:var(",
87
+ ");stroke-width:",
88
+ ";"
89
+ ], _ProgressBarCirculartokens.tokens.backgroundStroke, function(param) {
90
+ var customStrokeWidth = param.customStrokeWidth;
91
+ return customStrokeWidth ? "".concat(customStrokeWidth, "px") : "var(".concat(_ProgressBarCirculartokens.tokens.backgroundStrokeWidth, ")");
92
+ });
93
+ var StyledProgressCircle = _styledcomponents.default.circle.withConfig({
94
+ displayName: "ProgressBarCircular.styles__StyledProgressCircle",
95
+ componentId: "sc-d5c5c64b-2"
96
+ })([
97
+ "fill:none;stroke:var(",
98
+ ");stroke-width:",
99
+ ";stroke-linecap:round;transition:stroke-dashoffset 0.3s ease-in-out;"
100
+ ], _ProgressBarCirculartokens.tokens.progressStroke, function(param) {
101
+ var customStrokeWidth = param.customStrokeWidth;
102
+ return customStrokeWidth ? "".concat(customStrokeWidth, "px") : "var(".concat(_ProgressBarCirculartokens.tokens.progressStrokeWidth, ")");
103
+ });
104
+ var StyledContent = _styledcomponents.default.div.withConfig({
105
+ displayName: "ProgressBarCircular.styles__StyledContent",
106
+ componentId: "sc-d5c5c64b-3"
107
+ })([
108
+ "position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:var(",
25
109
  ");font-family:var(",
26
110
  ");font-size:var(",
27
111
  ");font-style:var(",
28
112
  ");font-weight:var(",
29
113
  ");letter-spacing:var(",
30
114
  ");line-height:var(",
31
- ");display:flex;align-items:center;justify-content:center;}"
32
- ], _ProgressBarCirculartokens.tokens.width, _ProgressBarCirculartokens.tokens.height, _ProgressBarCirculartokens.classes.svg, _ProgressBarCirculartokens.classes.backgroundCircle, _ProgressBarCirculartokens.tokens.backgroundStroke, _ProgressBarCirculartokens.tokens.backgroundStrokeWidth, _ProgressBarCirculartokens.classes.progressCircle, _ProgressBarCirculartokens.tokens.progressStroke, _ProgressBarCirculartokens.tokens.progressStrokeWidth, _ProgressBarCirculartokens.classes.content, _ProgressBarCirculartokens.tokens.contentColor, _ProgressBarCirculartokens.tokens.contentFontFamily, _ProgressBarCirculartokens.tokens.contentFontSize, _ProgressBarCirculartokens.tokens.contentFontStyle, _ProgressBarCirculartokens.tokens.contentFontWeight, _ProgressBarCirculartokens.tokens.contentLetterSpacing, _ProgressBarCirculartokens.tokens.contentLineHeight);
115
+ ");display:flex;align-items:center;justify-content:center;"
116
+ ], _ProgressBarCirculartokens.tokens.contentColor, _ProgressBarCirculartokens.tokens.contentFontFamily, _ProgressBarCirculartokens.tokens.contentFontSize, _ProgressBarCirculartokens.tokens.contentFontStyle, _ProgressBarCirculartokens.tokens.contentFontWeight, _ProgressBarCirculartokens.tokens.contentLetterSpacing, _ProgressBarCirculartokens.tokens.contentLineHeight);
@@ -1 +1,16 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "Combobox", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return Combobox;
9
+ }
10
+ });
11
+ var _engines = require("../../../engines");
12
+ var _ = require("../../..");
13
+ var _Comboboxconfig = require("./Combobox.config");
14
+ var mergedConfig = (0, _engines.mergeConfig)(_.comboboxNewConfig, _Comboboxconfig.config);
15
+ var ComboboxComponent = (0, _engines.component)(mergedConfig);
16
+ var Combobox = ComboboxComponent;
@@ -55,7 +55,7 @@ var config = {
55
55
  ], _ProgressBarCircular.progressBarCircularTokens.backgroundStroke, _ProgressBarCircular.progressBarCircularTokens.progressStroke, _ProgressBarCircular.progressBarCircularTokens.contentColor)
56
56
  },
57
57
  size: {
58
- xl: (0, _styledcomponents.css)([
58
+ xxl: (0, _styledcomponents.css)([
59
59
  "",
60
60
  ":8rem;",
61
61
  ":8rem;",
@@ -68,7 +68,7 @@ var config = {
68
68
  ":var(--plasma-typo-h2-letter-spacing);",
69
69
  ":var(--plasma-typo-h2-line-height);"
70
70
  ], _ProgressBarCircular.progressBarCircularTokens.width, _ProgressBarCircular.progressBarCircularTokens.height, _ProgressBarCircular.progressBarCircularTokens.backgroundStrokeWidth, _ProgressBarCircular.progressBarCircularTokens.progressStrokeWidth, _ProgressBarCircular.progressBarCircularTokens.contentFontFamily, _ProgressBarCircular.progressBarCircularTokens.contentFontSize, _ProgressBarCircular.progressBarCircularTokens.contentFontStyle, _ProgressBarCircular.progressBarCircularTokens.contentFontWeight, _ProgressBarCircular.progressBarCircularTokens.contentLetterSpacing, _ProgressBarCircular.progressBarCircularTokens.contentLineHeight),
71
- l: (0, _styledcomponents.css)([
71
+ xl: (0, _styledcomponents.css)([
72
72
  "",
73
73
  ":5.5rem;",
74
74
  ":5.5rem;",
@@ -81,12 +81,25 @@ var config = {
81
81
  ":var(--plasma-typo-h5-letter-spacing);",
82
82
  ":var(--plasma-typo-h5-line-height);"
83
83
  ], _ProgressBarCircular.progressBarCircularTokens.width, _ProgressBarCircular.progressBarCircularTokens.height, _ProgressBarCircular.progressBarCircularTokens.backgroundStrokeWidth, _ProgressBarCircular.progressBarCircularTokens.progressStrokeWidth, _ProgressBarCircular.progressBarCircularTokens.contentFontFamily, _ProgressBarCircular.progressBarCircularTokens.contentFontSize, _ProgressBarCircular.progressBarCircularTokens.contentFontStyle, _ProgressBarCircular.progressBarCircularTokens.contentFontWeight, _ProgressBarCircular.progressBarCircularTokens.contentLetterSpacing, _ProgressBarCircular.progressBarCircularTokens.contentLineHeight),
84
- m: (0, _styledcomponents.css)([
84
+ l: (0, _styledcomponents.css)([
85
85
  "",
86
86
  ":3.5rem;",
87
87
  ":3.5rem;",
88
88
  ":0.125rem;",
89
89
  ":0.125rem;",
90
+ ":var(--plasma-typo-body-l-font-family);",
91
+ ":var(--plasma-typo-body-l-font-size);",
92
+ ":var(--plasma-typo-body-l-font-style);",
93
+ ":var(--plasma-typo-body-l-body-font-weight);",
94
+ ":var(--plasma-typo-body-l-letter-spacing);",
95
+ ":var(--plasma-typo-body-l-line-height);"
96
+ ], _ProgressBarCircular.progressBarCircularTokens.width, _ProgressBarCircular.progressBarCircularTokens.height, _ProgressBarCircular.progressBarCircularTokens.backgroundStrokeWidth, _ProgressBarCircular.progressBarCircularTokens.progressStrokeWidth, _ProgressBarCircular.progressBarCircularTokens.contentFontFamily, _ProgressBarCircular.progressBarCircularTokens.contentFontSize, _ProgressBarCircular.progressBarCircularTokens.contentFontStyle, _ProgressBarCircular.progressBarCircularTokens.contentFontWeight, _ProgressBarCircular.progressBarCircularTokens.contentLetterSpacing, _ProgressBarCircular.progressBarCircularTokens.contentLineHeight),
97
+ m: (0, _styledcomponents.css)([
98
+ "",
99
+ ":3rem;",
100
+ ":3rem;",
101
+ ":0.125rem;",
102
+ ":0.125rem;",
90
103
  ":var(--plasma-typo-body-m-font-family);",
91
104
  ":var(--plasma-typo-body-m-font-size);",
92
105
  ":var(--plasma-typo-body-m-font-style);",
@@ -86,6 +86,7 @@ _export_star(require("./components/Tour"), exports);
86
86
  _export_star(require("./components/EmbedIconButton"), exports);
87
87
  _export_star(require("./components/InformationWrapper"), exports);
88
88
  _export_star(require("./components/NavigationDrawer"), exports);
89
+ _export_star(require("./components/ProgressBarCircular"), exports);
89
90
  _export_star(require("./components/TimePicker"), exports);
90
91
  function _export_star(from, to) {
91
92
  Object.keys(from).forEach(function(k) {
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getTokenValueInPixels", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return getTokenValueInPixels;
9
+ }
10
+ });
11
+ function _array_like_to_array(arr, len) {
12
+ if (len == null || len > arr.length) len = arr.length;
13
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
14
+ return arr2;
15
+ }
16
+ function _array_with_holes(arr) {
17
+ if (Array.isArray(arr)) return arr;
18
+ }
19
+ function _iterable_to_array_limit(arr, i) {
20
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
21
+ if (_i == null) return;
22
+ var _arr = [];
23
+ var _n = true;
24
+ var _d = false;
25
+ var _s, _e;
26
+ try {
27
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
28
+ _arr.push(_s.value);
29
+ if (i && _arr.length === i) break;
30
+ }
31
+ } catch (err) {
32
+ _d = true;
33
+ _e = err;
34
+ } finally{
35
+ try {
36
+ if (!_n && _i["return"] != null) _i["return"]();
37
+ } finally{
38
+ if (_d) throw _e;
39
+ }
40
+ }
41
+ return _arr;
42
+ }
43
+ function _non_iterable_rest() {
44
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
45
+ }
46
+ function _sliced_to_array(arr, i) {
47
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
48
+ }
49
+ function _unsupported_iterable_to_array(o, minLen) {
50
+ if (!o) return;
51
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
52
+ var n = Object.prototype.toString.call(o).slice(8, -1);
53
+ if (n === "Object" && o.constructor) n = o.constructor.name;
54
+ if (n === "Map" || n === "Set") return Array.from(n);
55
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
56
+ }
57
+ var getTokenValueInPixels = function(tokenName, element) {
58
+ var tokenValue = getComputedStyle(element).getPropertyValue(tokenName).trim();
59
+ if (!tokenValue) {
60
+ return undefined;
61
+ }
62
+ var valueMatch = tokenValue.match(/^([\d.]+)(rem|px)$/);
63
+ if (!valueMatch) {
64
+ return undefined;
65
+ }
66
+ var _valueMatch = _sliced_to_array(valueMatch, 3), number = _valueMatch[1], unit = _valueMatch[2];
67
+ var numericValue = parseFloat(number);
68
+ if (unit === 'px') {
69
+ return numericValue;
70
+ }
71
+ if (unit === 'rem') {
72
+ var rootFontSize = parseFloat(getComputedStyle(element).fontSize);
73
+ return numericValue * rootFontSize;
74
+ }
75
+ return undefined;
76
+ };
@@ -42,6 +42,9 @@ _export(exports, {
42
42
  get getSizeValueFromProp () {
43
43
  return _getSizeValueFromProp.getSizeValueFromProp;
44
44
  },
45
+ get getTokenValueInPixels () {
46
+ return _getTokenValueInPixels.getTokenValueInPixels;
47
+ },
45
48
  get isEmpty () {
46
49
  return _isEmpty.isEmpty;
47
50
  },
@@ -75,6 +78,7 @@ _export_star(require("./initialValuesHelper"), exports);
75
78
  var _noop = require("./noop");
76
79
  var _getHeightAsNumber = require("./getHeightAsNumber");
77
80
  var _createConditionalComponent = require("./createConditionalComponent");
81
+ var _getTokenValueInPixels = require("./getTokenValueInPixels");
78
82
  var _fixedForwardRef = require("./fixedForwardRef");
79
83
  function _export_star(from, to) {
80
84
  Object.keys(from).forEach(function(k) {
@@ -1,3 +1,11 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_with_holes(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
1
9
  function _define_property(obj, key, value) {
2
10
  if (key in obj) {
3
11
  Object.defineProperty(obj, key, {
@@ -11,6 +19,33 @@ function _define_property(obj, key, value) {
11
19
  }
12
20
  return obj;
13
21
  }
22
+ function _iterable_to_array_limit(arr, i) {
23
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
24
+ if (_i == null) return;
25
+ var _arr = [];
26
+ var _n = true;
27
+ var _d = false;
28
+ var _s, _e;
29
+ try {
30
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
31
+ _arr.push(_s.value);
32
+ if (i && _arr.length === i) break;
33
+ }
34
+ } catch (err) {
35
+ _d = true;
36
+ _e = err;
37
+ } finally{
38
+ try {
39
+ if (!_n && _i["return"] != null) _i["return"]();
40
+ } finally{
41
+ if (_d) throw _e;
42
+ }
43
+ }
44
+ return _arr;
45
+ }
46
+ function _non_iterable_rest() {
47
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
48
+ }
14
49
  function _object_spread(target) {
15
50
  for(var i = 1; i < arguments.length; i++){
16
51
  var source = arguments[i] != null ? arguments[i] : {};
@@ -53,52 +88,83 @@ function _object_without_properties_loose(source, excluded) {
53
88
  }
54
89
  return target;
55
90
  }
56
- import React, { forwardRef } from "react";
57
- import { cx } from "../../utils";
91
+ function _sliced_to_array(arr, i) {
92
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
93
+ }
94
+ function _unsupported_iterable_to_array(o, minLen) {
95
+ if (!o) return;
96
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
97
+ var n = Object.prototype.toString.call(o).slice(8, -1);
98
+ if (n === "Object" && o.constructor) n = o.constructor.name;
99
+ if (n === "Map" || n === "Set") return Array.from(n);
100
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
101
+ }
102
+ import React, { forwardRef, useState, useRef, useLayoutEffect } from "react";
103
+ import { useForkRef } from "@salutejs/plasma-core";
104
+ import { cx, getTokenValueInPixels } from "../../utils";
58
105
  import { base as viewCSS } from "./variations/_view/base";
59
106
  import { base as sizeCSS } from "./variations/_size/base";
60
- import { base } from "./ProgressBarCircular.styles";
61
- import { classes } from "./ProgressBarCircular.tokens";
107
+ import { base, StyledSVG, StyledBackgroundCircle, StyledProgressCircle, StyledContent } from "./ProgressBarCircular.styles";
108
+ import { classes, tokens } from "./ProgressBarCircular.tokens";
62
109
  export var progressBarCircularRoot = function(Root) {
63
110
  return /*#__PURE__*/ forwardRef(function(props, ref) {
64
- var _props_value = props.value, value = _props_value === void 0 ? 0 : _props_value, _props_maxValue = props.maxValue, maxValue = _props_maxValue === void 0 ? 100 : _props_maxValue, size = props.size, view = props.view, children = props.children, className = props.className, rest = _object_without_properties(props, [
111
+ var _props_value = props.value, value = _props_value === void 0 ? 0 : _props_value, _props_maxValue = props.maxValue, maxValue = _props_maxValue === void 0 ? 100 : _props_maxValue, size = props.size, view = props.view, children = props.children, className = props.className, strokeWidthProp = props.strokeWidth, rest = _object_without_properties(props, [
65
112
  "value",
66
113
  "maxValue",
67
114
  "size",
68
115
  "view",
69
116
  "children",
70
- "className"
117
+ "className",
118
+ "strokeWidth"
71
119
  ]);
120
+ var _useState = _sliced_to_array(useState(0), 2), strokeWidthCSS = _useState[0], setStrokeWidthCSS = _useState[1];
121
+ var _useState1 = _sliced_to_array(useState(0), 2), widthCSS = _useState1[0], setWidthCSS = _useState1[1];
122
+ var rootRef = useRef(null);
123
+ var rootForkRef = useForkRef(rootRef, ref);
72
124
  var clampedValue = Math.min(Math.max(value, 0), maxValue);
73
125
  var percentage = clampedValue / maxValue * 100;
126
+ var strokeWidth = (strokeWidthProp !== null && strokeWidthProp !== void 0 ? strokeWidthProp : strokeWidthCSS) * 2;
74
127
  var center = 50;
75
- var radius = 46;
128
+ var radius = center - 50 / widthCSS * (strokeWidth / 2);
76
129
  var circumference = 2 * Math.PI * radius;
77
130
  var strokeDashoffset = circumference - percentage / 100 * circumference;
131
+ useLayoutEffect(function() {
132
+ if (rootRef.current) {
133
+ var strokeWidthFromCSS = getTokenValueInPixels(tokens.progressStrokeWidth, rootRef.current);
134
+ var widthFromCSS = getTokenValueInPixels(tokens.width, rootRef.current);
135
+ setStrokeWidthCSS(strokeWidthFromCSS !== null && strokeWidthFromCSS !== void 0 ? strokeWidthFromCSS : 0);
136
+ setWidthCSS(widthFromCSS !== null && widthFromCSS !== void 0 ? widthFromCSS : 0);
137
+ }
138
+ }, [
139
+ rootRef,
140
+ size
141
+ ]);
78
142
  return /*#__PURE__*/ React.createElement(Root, _object_spread({
79
- ref: ref,
143
+ ref: rootForkRef,
80
144
  view: view,
81
145
  size: size,
82
146
  className: cx(className)
83
- }, rest), /*#__PURE__*/ React.createElement("svg", {
147
+ }, rest), /*#__PURE__*/ React.createElement(StyledSVG, {
84
148
  width: "100%",
85
149
  height: "100%",
86
150
  viewBox: "0 0 100 100",
87
151
  className: classes.svg
88
- }, /*#__PURE__*/ React.createElement("circle", {
152
+ }, /*#__PURE__*/ React.createElement(StyledBackgroundCircle, {
153
+ customStrokeWidth: 50 / widthCSS * strokeWidth,
89
154
  cx: center,
90
155
  cy: center,
91
156
  r: radius,
92
157
  className: classes.backgroundCircle
93
- }), /*#__PURE__*/ React.createElement("circle", {
158
+ }), /*#__PURE__*/ React.createElement(StyledProgressCircle, {
94
159
  cx: center,
95
160
  cy: center,
96
161
  r: radius,
162
+ customStrokeWidth: 50 / widthCSS * strokeWidth,
97
163
  className: classes.progressCircle,
98
164
  strokeDasharray: circumference,
99
165
  strokeDashoffset: strokeDashoffset,
100
166
  transform: "rotate(-90 50 50)"
101
- })), children && /*#__PURE__*/ React.createElement("div", {
167
+ })), children && /*#__PURE__*/ React.createElement(StyledContent, {
102
168
  className: classes.content
103
169
  }, children));
104
170
  });
@@ -1,22 +1,49 @@
1
1
  import { css } from "styled-components";
2
- import { classes, tokens } from "./ProgressBarCircular.tokens";
2
+ import styled from "styled-components";
3
+ import { tokens } from "./ProgressBarCircular.tokens";
3
4
  export var base = css([
4
5
  "position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(",
5
6
  ");height:var(",
6
- ");.",
7
- "{width:100%;height:100%;}.",
8
- "{fill:none;stroke:var(",
9
- ");stroke-width:var(",
10
- ");}.",
11
- "{fill:none;stroke:var(",
12
- ");stroke-width:var(",
13
- ");stroke-linecap:round;transition:stroke-dashoffset 0.3s ease-in-out;}.",
14
- "{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:var(",
7
+ ");"
8
+ ], tokens.width, tokens.height);
9
+ export var StyledSVG = styled.svg.withConfig({
10
+ displayName: "ProgressBarCircular.styles__StyledSVG",
11
+ componentId: "sc-d5c5c64b-0"
12
+ })([
13
+ "width:100%;height:100%;"
14
+ ]);
15
+ export var StyledBackgroundCircle = styled.circle.withConfig({
16
+ displayName: "ProgressBarCircular.styles__StyledBackgroundCircle",
17
+ componentId: "sc-d5c5c64b-1"
18
+ })([
19
+ "fill:none;stroke:var(",
20
+ ");stroke-width:",
21
+ ";"
22
+ ], tokens.backgroundStroke, function(param) {
23
+ var customStrokeWidth = param.customStrokeWidth;
24
+ return customStrokeWidth ? "".concat(customStrokeWidth, "px") : "var(".concat(tokens.backgroundStrokeWidth, ")");
25
+ });
26
+ export var StyledProgressCircle = styled.circle.withConfig({
27
+ displayName: "ProgressBarCircular.styles__StyledProgressCircle",
28
+ componentId: "sc-d5c5c64b-2"
29
+ })([
30
+ "fill:none;stroke:var(",
31
+ ");stroke-width:",
32
+ ";stroke-linecap:round;transition:stroke-dashoffset 0.3s ease-in-out;"
33
+ ], tokens.progressStroke, function(param) {
34
+ var customStrokeWidth = param.customStrokeWidth;
35
+ return customStrokeWidth ? "".concat(customStrokeWidth, "px") : "var(".concat(tokens.progressStrokeWidth, ")");
36
+ });
37
+ export var StyledContent = styled.div.withConfig({
38
+ displayName: "ProgressBarCircular.styles__StyledContent",
39
+ componentId: "sc-d5c5c64b-3"
40
+ })([
41
+ "position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:var(",
15
42
  ");font-family:var(",
16
43
  ");font-size:var(",
17
44
  ");font-style:var(",
18
45
  ");font-weight:var(",
19
46
  ");letter-spacing:var(",
20
47
  ");line-height:var(",
21
- ");display:flex;align-items:center;justify-content:center;}"
22
- ], tokens.width, tokens.height, classes.svg, classes.backgroundCircle, tokens.backgroundStroke, tokens.backgroundStrokeWidth, classes.progressCircle, tokens.progressStroke, tokens.progressStrokeWidth, classes.content, tokens.contentColor, tokens.contentFontFamily, tokens.contentFontSize, tokens.contentFontStyle, tokens.contentFontWeight, tokens.contentLetterSpacing, tokens.contentLineHeight);
48
+ ");display:flex;align-items:center;justify-content:center;"
49
+ ], tokens.contentColor, tokens.contentFontFamily, tokens.contentFontSize, tokens.contentFontStyle, tokens.contentFontWeight, tokens.contentLetterSpacing, tokens.contentLineHeight);
@@ -45,7 +45,7 @@ export var config = {
45
45
  ], progressBarCircularTokens.backgroundStroke, progressBarCircularTokens.progressStroke, progressBarCircularTokens.contentColor)
46
46
  },
47
47
  size: {
48
- xl: css([
48
+ xxl: css([
49
49
  "",
50
50
  ":8rem;",
51
51
  ":8rem;",
@@ -58,7 +58,7 @@ export var config = {
58
58
  ":var(--plasma-typo-h2-letter-spacing);",
59
59
  ":var(--plasma-typo-h2-line-height);"
60
60
  ], progressBarCircularTokens.width, progressBarCircularTokens.height, progressBarCircularTokens.backgroundStrokeWidth, progressBarCircularTokens.progressStrokeWidth, progressBarCircularTokens.contentFontFamily, progressBarCircularTokens.contentFontSize, progressBarCircularTokens.contentFontStyle, progressBarCircularTokens.contentFontWeight, progressBarCircularTokens.contentLetterSpacing, progressBarCircularTokens.contentLineHeight),
61
- l: css([
61
+ xl: css([
62
62
  "",
63
63
  ":5.5rem;",
64
64
  ":5.5rem;",
@@ -71,12 +71,25 @@ export var config = {
71
71
  ":var(--plasma-typo-h5-letter-spacing);",
72
72
  ":var(--plasma-typo-h5-line-height);"
73
73
  ], progressBarCircularTokens.width, progressBarCircularTokens.height, progressBarCircularTokens.backgroundStrokeWidth, progressBarCircularTokens.progressStrokeWidth, progressBarCircularTokens.contentFontFamily, progressBarCircularTokens.contentFontSize, progressBarCircularTokens.contentFontStyle, progressBarCircularTokens.contentFontWeight, progressBarCircularTokens.contentLetterSpacing, progressBarCircularTokens.contentLineHeight),
74
- m: css([
74
+ l: css([
75
75
  "",
76
76
  ":3.5rem;",
77
77
  ":3.5rem;",
78
78
  ":0.125rem;",
79
79
  ":0.125rem;",
80
+ ":var(--plasma-typo-body-l-font-family);",
81
+ ":var(--plasma-typo-body-l-font-size);",
82
+ ":var(--plasma-typo-body-l-font-style);",
83
+ ":var(--plasma-typo-body-l-body-font-weight);",
84
+ ":var(--plasma-typo-body-l-letter-spacing);",
85
+ ":var(--plasma-typo-body-l-line-height);"
86
+ ], progressBarCircularTokens.width, progressBarCircularTokens.height, progressBarCircularTokens.backgroundStrokeWidth, progressBarCircularTokens.progressStrokeWidth, progressBarCircularTokens.contentFontFamily, progressBarCircularTokens.contentFontSize, progressBarCircularTokens.contentFontStyle, progressBarCircularTokens.contentFontWeight, progressBarCircularTokens.contentLetterSpacing, progressBarCircularTokens.contentLineHeight),
87
+ m: css([
88
+ "",
89
+ ":3rem;",
90
+ ":3rem;",
91
+ ":0.125rem;",
92
+ ":0.125rem;",
80
93
  ":var(--plasma-typo-body-m-font-family);",
81
94
  ":var(--plasma-typo-body-m-font-size);",
82
95
  ":var(--plasma-typo-body-m-font-style);",
@@ -84,4 +84,5 @@ export * from "./components/Tour";
84
84
  export * from "./components/EmbedIconButton";
85
85
  export * from "./components/InformationWrapper";
86
86
  export * from "./components/NavigationDrawer";
87
+ export * from "./components/ProgressBarCircular";
87
88
  export * from "./components/TimePicker";
@@ -0,0 +1,66 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_with_holes(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
9
+ function _iterable_to_array_limit(arr, i) {
10
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
11
+ if (_i == null) return;
12
+ var _arr = [];
13
+ var _n = true;
14
+ var _d = false;
15
+ var _s, _e;
16
+ try {
17
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
18
+ _arr.push(_s.value);
19
+ if (i && _arr.length === i) break;
20
+ }
21
+ } catch (err) {
22
+ _d = true;
23
+ _e = err;
24
+ } finally{
25
+ try {
26
+ if (!_n && _i["return"] != null) _i["return"]();
27
+ } finally{
28
+ if (_d) throw _e;
29
+ }
30
+ }
31
+ return _arr;
32
+ }
33
+ function _non_iterable_rest() {
34
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
35
+ }
36
+ function _sliced_to_array(arr, i) {
37
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
38
+ }
39
+ function _unsupported_iterable_to_array(o, minLen) {
40
+ if (!o) return;
41
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
42
+ var n = Object.prototype.toString.call(o).slice(8, -1);
43
+ if (n === "Object" && o.constructor) n = o.constructor.name;
44
+ if (n === "Map" || n === "Set") return Array.from(n);
45
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
46
+ }
47
+ export var getTokenValueInPixels = function(tokenName, element) {
48
+ var tokenValue = getComputedStyle(element).getPropertyValue(tokenName).trim();
49
+ if (!tokenValue) {
50
+ return undefined;
51
+ }
52
+ var valueMatch = tokenValue.match(/^([\d.]+)(rem|px)$/);
53
+ if (!valueMatch) {
54
+ return undefined;
55
+ }
56
+ var _valueMatch = _sliced_to_array(valueMatch, 3), number = _valueMatch[1], unit = _valueMatch[2];
57
+ var numericValue = parseFloat(number);
58
+ if (unit === 'px') {
59
+ return numericValue;
60
+ }
61
+ if (unit === 'rem') {
62
+ var rootFontSize = parseFloat(getComputedStyle(element).fontSize);
63
+ return numericValue * rootFontSize;
64
+ }
65
+ return undefined;
66
+ };
@@ -13,6 +13,7 @@ export * from "./initialValuesHelper";
13
13
  export { noop } from "./noop";
14
14
  export { getHeightAsNumber } from "./getHeightAsNumber";
15
15
  export { createConditionalComponent } from "./createConditionalComponent";
16
+ export { getTokenValueInPixels } from "./getTokenValueInPixels";
16
17
  export var cx = function() {
17
18
  for(var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++){
18
19
  classes[_key] = arguments[_key];
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressBarCircular.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressBarCircular/ProgressBarCircular.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAK/C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAI5E,eAAO,MAAM,uBAAuB,SAAU,SAAS,CAAC,cAAc,EAAE,wBAAwB,CAAC,uLA+B3F,CAAC;AAEP,eAAO,MAAM,yBAAyB;;;mBAjCQ,SAAS,CAAC,cAAc,EAAE,wBAAwB,CAAC;;;;;;;;;;;;;;CAkDhG,CAAC"}
1
+ {"version":3,"file":"ProgressBarCircular.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressBarCircular/ProgressBarCircular.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwD,MAAM,OAAO,CAAC;AAG7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAK/C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAU5E,eAAO,MAAM,uBAAuB,SAAU,SAAS,CAAC,cAAc,EAAE,wBAAwB,CAAC,uLA+D3F,CAAC;AAEP,eAAO,MAAM,yBAAyB;;;mBAjEQ,SAAS,CAAC,cAAc,EAAE,wBAAwB,CAAC;;;;;;;;;;;;;;CAkFhG,CAAC"}
@@ -1,2 +1,10 @@
1
1
  export declare const base: import("@linaria/core").LinariaClassName;
2
+ export declare const StyledSVG: import("@linaria/react").StyledComponent<import("react").SVGProps<SVGSVGElement> & Record<never, unknown>>;
3
+ export declare const StyledBackgroundCircle: import("@linaria/react").StyledComponent<import("react").SVGProps<SVGCircleElement> & {
4
+ customStrokeWidth?: number;
5
+ }>;
6
+ export declare const StyledProgressCircle: import("@linaria/react").StyledComponent<import("react").SVGProps<SVGCircleElement> & {
7
+ customStrokeWidth?: number;
8
+ }>;
9
+ export declare const StyledContent: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
2
10
  //# sourceMappingURL=ProgressBarCircular.styles.d.ts.map