@helpdice/ui 2.5.4 → 2.5.8

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 (141) hide show
  1. package/dist/auto-complete/index.js +1273 -404
  2. package/dist/avatar/index.js +88 -49
  3. package/dist/badge/index.js +69 -27
  4. package/dist/breadcrumbs/index.js +107 -56
  5. package/dist/button/button.icon.d.ts +3 -16
  6. package/dist/button/button.small.d.ts +3 -16
  7. package/dist/button/index.js +143 -157
  8. package/dist/button-dropdown/index.js +96 -83
  9. package/dist/button-group/index.js +61 -21
  10. package/dist/capacity/index.js +61 -22
  11. package/dist/card/index.js +147 -123
  12. package/dist/carousal/index.js +349 -330
  13. package/dist/checkbox/index.js +72 -67
  14. package/dist/circular-progress/CircularProgress.d.ts +17 -0
  15. package/dist/circular-progress/index.d.ts +3 -4
  16. package/dist/circular-progress/index.js +713 -336
  17. package/dist/circular-progress/useCircularProgress.d.ts +12 -0
  18. package/dist/code/index.js +70 -26
  19. package/dist/col/index.js +61 -24
  20. package/dist/collapse/index.js +102 -52
  21. package/dist/container/index.js +187 -190
  22. package/dist/copy-to-clipboard/index.js +158 -210
  23. package/dist/description/index.js +64 -23
  24. package/dist/display/index.js +64 -23
  25. package/dist/divider/index.js +62 -22
  26. package/dist/dot/index.js +63 -23
  27. package/dist/drawer/index.js +74 -61
  28. package/dist/fieldset/index.js +127 -63
  29. package/dist/form/index.js +15 -40
  30. package/dist/grid/index.js +74 -29
  31. package/dist/html-renderer/index.js +3 -2
  32. package/dist/image/index.js +163 -104
  33. package/dist/index.d.ts +2 -1
  34. package/dist/index.js +5240 -4755
  35. package/dist/input/index.js +1183 -277
  36. package/dist/keyboard/index.js +73 -29
  37. package/dist/linear-progress/index.js +27 -24
  38. package/dist/link/index.js +78 -36
  39. package/dist/list/index.js +118 -63
  40. package/dist/loadable/index.js +76 -27
  41. package/dist/loading/index.js +70 -29
  42. package/dist/menu/index.js +53 -47
  43. package/dist/modal/index.js +225 -178
  44. package/dist/note/index.js +64 -23
  45. package/dist/notetip/index.js +54 -45
  46. package/dist/notetip/note-tip.d.ts +2 -0
  47. package/dist/page/index.js +102 -51
  48. package/dist/pagination/index.js +181 -124
  49. package/dist/placeholder/index.js +554 -538
  50. package/dist/popover/index.js +94 -81
  51. package/dist/progress/index.js +66 -27
  52. package/dist/radio/index.js +94 -48
  53. package/dist/rating/index.js +78 -38
  54. package/dist/row/index.js +62 -25
  55. package/dist/search-bar/index.js +172 -162
  56. package/dist/select/index.js +1098 -163
  57. package/dist/select/select.d.ts +2 -0
  58. package/dist/slider/index.js +91 -47
  59. package/dist/snippet/index.js +39 -39
  60. package/dist/spacer/index.js +58 -19
  61. package/dist/spinner/index.js +69 -28
  62. package/dist/swipe/index.js +28 -13
  63. package/dist/table/index.js +4162 -3863
  64. package/dist/table/table-body.d.ts +4 -3
  65. package/dist/table/table-cell.d.ts +4 -2
  66. package/dist/table/table-types.d.ts +2 -0
  67. package/dist/table/table.d.ts +5 -1
  68. package/dist/tabs/index.js +61 -59
  69. package/dist/tag/index.js +16 -20
  70. package/dist/text/index.js +187 -184
  71. package/dist/text/text.d.ts +3 -0
  72. package/dist/textarea/index.js +916 -36
  73. package/dist/textarea/textarea.d.ts +3 -0
  74. package/dist/toggle/index.js +75 -33
  75. package/dist/tooltip/index.d.ts +1 -2
  76. package/dist/tooltip/index.js +59 -53
  77. package/dist/tooltip/tooltip-content.d.ts +1 -1
  78. package/dist/tooltip/tooltip-small.d.ts +2 -5
  79. package/dist/tooltip/tooltip.d.ts +2 -1
  80. package/dist/tree/index.js +176 -115
  81. package/dist/use-scale/index.js +50 -13
  82. package/dist/user/index.js +152 -100
  83. package/esm/avatar/avatar.js +8 -6
  84. package/esm/button/button.icon.d.ts +3 -16
  85. package/esm/button/button.icon.js +22 -22
  86. package/esm/button/button.js +5 -5
  87. package/esm/button/button.small.d.ts +3 -16
  88. package/esm/button/button.small.js +20 -23
  89. package/esm/circular-progress/CircularProgress.d.ts +17 -0
  90. package/esm/circular-progress/CircularProgress.js +110 -0
  91. package/esm/circular-progress/index.d.ts +3 -4
  92. package/esm/circular-progress/index.js +3 -4
  93. package/esm/circular-progress/useCircularProgress.d.ts +12 -0
  94. package/esm/circular-progress/useCircularProgress.js +35 -0
  95. package/esm/index.d.ts +2 -1
  96. package/esm/index.js +1 -1
  97. package/esm/input/input-field.js +11 -9
  98. package/esm/list/list-item.js +11 -11
  99. package/esm/notetip/note-tip.d.ts +2 -0
  100. package/esm/notetip/note-tip.js +8 -5
  101. package/esm/pagination/pagination-item.js +6 -6
  102. package/esm/select/select.d.ts +2 -0
  103. package/esm/select/select.js +15 -2
  104. package/esm/skeleton/index.js +9 -4
  105. package/esm/table/table-body.d.ts +4 -3
  106. package/esm/table/table-body.js +25 -15
  107. package/esm/table/table-cell.d.ts +4 -2
  108. package/esm/table/table-cell.js +19 -3
  109. package/esm/table/table-types.d.ts +2 -0
  110. package/esm/table/table.d.ts +5 -1
  111. package/esm/table/table.js +52 -25
  112. package/esm/text/text.d.ts +3 -0
  113. package/esm/text/text.js +9 -2
  114. package/esm/textarea/textarea.d.ts +3 -0
  115. package/esm/textarea/textarea.js +19 -2
  116. package/esm/tooltip/index.d.ts +1 -2
  117. package/esm/tooltip/tooltip-content.d.ts +1 -1
  118. package/esm/tooltip/tooltip-content.js +5 -5
  119. package/esm/tooltip/tooltip-small.d.ts +2 -5
  120. package/esm/tooltip/tooltip-small.js +0 -1
  121. package/esm/tooltip/tooltip.d.ts +2 -1
  122. package/esm/tooltip/tooltip.js +6 -5
  123. package/package.json +3 -3
  124. package/dist/circular-progress/CircularProgressbar.d.ts +0 -10
  125. package/dist/circular-progress/CircularProgressbarWithChildren.d.ts +0 -7
  126. package/dist/circular-progress/Path.d.ts +0 -9
  127. package/dist/circular-progress/buildStyles.d.ts +0 -12
  128. package/dist/circular-progress/constants.d.ts +0 -5
  129. package/dist/circular-progress/types.d.ts +0 -50
  130. package/esm/circular-progress/CircularProgressbar.d.ts +0 -10
  131. package/esm/circular-progress/CircularProgressbar.js +0 -118
  132. package/esm/circular-progress/CircularProgressbarWithChildren.d.ts +0 -7
  133. package/esm/circular-progress/CircularProgressbarWithChildren.js +0 -32
  134. package/esm/circular-progress/Path.d.ts +0 -9
  135. package/esm/circular-progress/Path.js +0 -52
  136. package/esm/circular-progress/buildStyles.d.ts +0 -12
  137. package/esm/circular-progress/buildStyles.js +0 -45
  138. package/esm/circular-progress/constants.d.ts +0 -5
  139. package/esm/circular-progress/constants.js +0 -5
  140. package/esm/circular-progress/types.d.ts +0 -50
  141. package/esm/circular-progress/types.js +0 -1
@@ -1,364 +1,741 @@
1
1
  'use strict';
2
2
 
3
- var React$1 = require('react');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- function _interopNamespaceDefault(e) {
6
- var n = Object.create(null);
7
- if (e) {
8
- Object.keys(e).forEach(function (k) {
9
- if (k !== 'default') {
10
- var d = Object.getOwnPropertyDescriptor(e, k);
11
- Object.defineProperty(n, k, d.get ? d : {
12
- enumerable: true,
13
- get: function () { return e[k]; }
14
- });
15
- }
16
- });
17
- }
18
- n.default = e;
19
- return Object.freeze(n);
5
+ var require$$1 = require('react');
6
+ var framerMotion = require('framer-motion');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+
9
+ function getDefaultExportFromCjs (x) {
10
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
20
11
  }
21
12
 
22
- var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React$1);
13
+ var index = {};
23
14
 
24
- function _assertThisInitialized(e) {
25
- if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
26
- return e;
27
- }
28
- function _callSuper(t, o, e) {
29
- return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
30
- }
31
- function _classCallCheck(a, n) {
32
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
33
- }
34
- function _defineProperties(e, r) {
35
- for (var t = 0; t < r.length; t++) {
36
- var o = r[t];
37
- o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
38
- }
15
+ var hasRequiredIndex;
16
+
17
+ function requireIndex () {
18
+ if (hasRequiredIndex) return index;
19
+ hasRequiredIndex = 1;
20
+ var React = require$$1;
21
+
22
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
23
+
24
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
25
+
26
+ /*
27
+ Based on Glamor's sheet
28
+ https://github.com/threepointone/glamor/blob/667b480d31b3721a905021b26e1290ce92ca2879/src/sheet.js
29
+ */ function _defineProperties(target, props) {
30
+ for(var i = 0; i < props.length; i++){
31
+ var descriptor = props[i];
32
+ descriptor.enumerable = descriptor.enumerable || false;
33
+ descriptor.configurable = true;
34
+ if ("value" in descriptor) descriptor.writable = true;
35
+ Object.defineProperty(target, descriptor.key, descriptor);
36
+ }
37
+ }
38
+ function _createClass(Constructor, protoProps, staticProps) {
39
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
40
+ return Constructor;
41
+ }
42
+ var isProd = typeof process !== "undefined" && process.env && process.env.NODE_ENV === "production";
43
+ var isString = function(o) {
44
+ return Object.prototype.toString.call(o) === "[object String]";
45
+ };
46
+ var StyleSheet = /*#__PURE__*/ function() {
47
+ function StyleSheet(param) {
48
+ var ref = param === void 0 ? {} : param, _name = ref.name, name = _name === void 0 ? "stylesheet" : _name, _optimizeForSpeed = ref.optimizeForSpeed, optimizeForSpeed = _optimizeForSpeed === void 0 ? isProd : _optimizeForSpeed;
49
+ invariant$1(isString(name), "`name` must be a string");
50
+ this._name = name;
51
+ this._deletedRulePlaceholder = "#" + name + "-deleted-rule____{}";
52
+ invariant$1(typeof optimizeForSpeed === "boolean", "`optimizeForSpeed` must be a boolean");
53
+ this._optimizeForSpeed = optimizeForSpeed;
54
+ this._serverSheet = undefined;
55
+ this._tags = [];
56
+ this._injected = false;
57
+ this._rulesCount = 0;
58
+ var node = typeof window !== "undefined" && document.querySelector('meta[property="csp-nonce"]');
59
+ this._nonce = node ? node.getAttribute("content") : null;
60
+ }
61
+ var _proto = StyleSheet.prototype;
62
+ _proto.setOptimizeForSpeed = function setOptimizeForSpeed(bool) {
63
+ invariant$1(typeof bool === "boolean", "`setOptimizeForSpeed` accepts a boolean");
64
+ invariant$1(this._rulesCount === 0, "optimizeForSpeed cannot be when rules have already been inserted");
65
+ this.flush();
66
+ this._optimizeForSpeed = bool;
67
+ this.inject();
68
+ };
69
+ _proto.isOptimizeForSpeed = function isOptimizeForSpeed() {
70
+ return this._optimizeForSpeed;
71
+ };
72
+ _proto.inject = function inject() {
73
+ var _this = this;
74
+ invariant$1(!this._injected, "sheet already injected");
75
+ this._injected = true;
76
+ if (typeof window !== "undefined" && this._optimizeForSpeed) {
77
+ this._tags[0] = this.makeStyleTag(this._name);
78
+ this._optimizeForSpeed = "insertRule" in this.getSheet();
79
+ if (!this._optimizeForSpeed) {
80
+ if (!isProd) {
81
+ console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode.");
82
+ }
83
+ this.flush();
84
+ this._injected = true;
85
+ }
86
+ return;
87
+ }
88
+ this._serverSheet = {
89
+ cssRules: [],
90
+ insertRule: function(rule, index) {
91
+ if (typeof index === "number") {
92
+ _this._serverSheet.cssRules[index] = {
93
+ cssText: rule
94
+ };
95
+ } else {
96
+ _this._serverSheet.cssRules.push({
97
+ cssText: rule
98
+ });
99
+ }
100
+ return index;
101
+ },
102
+ deleteRule: function(index) {
103
+ _this._serverSheet.cssRules[index] = null;
104
+ }
105
+ };
106
+ };
107
+ _proto.getSheetForTag = function getSheetForTag(tag) {
108
+ if (tag.sheet) {
109
+ return tag.sheet;
110
+ }
111
+ // this weirdness brought to you by firefox
112
+ for(var i = 0; i < document.styleSheets.length; i++){
113
+ if (document.styleSheets[i].ownerNode === tag) {
114
+ return document.styleSheets[i];
115
+ }
116
+ }
117
+ };
118
+ _proto.getSheet = function getSheet() {
119
+ return this.getSheetForTag(this._tags[this._tags.length - 1]);
120
+ };
121
+ _proto.insertRule = function insertRule(rule, index) {
122
+ invariant$1(isString(rule), "`insertRule` accepts only strings");
123
+ if (typeof window === "undefined") {
124
+ if (typeof index !== "number") {
125
+ index = this._serverSheet.cssRules.length;
126
+ }
127
+ this._serverSheet.insertRule(rule, index);
128
+ return this._rulesCount++;
129
+ }
130
+ if (this._optimizeForSpeed) {
131
+ var sheet = this.getSheet();
132
+ if (typeof index !== "number") {
133
+ index = sheet.cssRules.length;
134
+ }
135
+ // this weirdness for perf, and chrome's weird bug
136
+ // https://stackoverflow.com/questions/20007992/chrome-suddenly-stopped-accepting-insertrule
137
+ try {
138
+ sheet.insertRule(rule, index);
139
+ } catch (error) {
140
+ if (!isProd) {
141
+ console.warn("StyleSheet: illegal rule: \n\n" + rule + "\n\nSee https://stackoverflow.com/q/20007992 for more info");
142
+ }
143
+ return -1;
144
+ }
145
+ } else {
146
+ var insertionPoint = this._tags[index];
147
+ this._tags.push(this.makeStyleTag(this._name, rule, insertionPoint));
148
+ }
149
+ return this._rulesCount++;
150
+ };
151
+ _proto.replaceRule = function replaceRule(index, rule) {
152
+ if (this._optimizeForSpeed || typeof window === "undefined") {
153
+ var sheet = typeof window !== "undefined" ? this.getSheet() : this._serverSheet;
154
+ if (!rule.trim()) {
155
+ rule = this._deletedRulePlaceholder;
156
+ }
157
+ if (!sheet.cssRules[index]) {
158
+ // @TBD Should we throw an error?
159
+ return index;
160
+ }
161
+ sheet.deleteRule(index);
162
+ try {
163
+ sheet.insertRule(rule, index);
164
+ } catch (error) {
165
+ if (!isProd) {
166
+ console.warn("StyleSheet: illegal rule: \n\n" + rule + "\n\nSee https://stackoverflow.com/q/20007992 for more info");
167
+ }
168
+ // In order to preserve the indices we insert a deleteRulePlaceholder
169
+ sheet.insertRule(this._deletedRulePlaceholder, index);
170
+ }
171
+ } else {
172
+ var tag = this._tags[index];
173
+ invariant$1(tag, "old rule at index `" + index + "` not found");
174
+ tag.textContent = rule;
175
+ }
176
+ return index;
177
+ };
178
+ _proto.deleteRule = function deleteRule(index) {
179
+ if (typeof window === "undefined") {
180
+ this._serverSheet.deleteRule(index);
181
+ return;
182
+ }
183
+ if (this._optimizeForSpeed) {
184
+ this.replaceRule(index, "");
185
+ } else {
186
+ var tag = this._tags[index];
187
+ invariant$1(tag, "rule at index `" + index + "` not found");
188
+ tag.parentNode.removeChild(tag);
189
+ this._tags[index] = null;
190
+ }
191
+ };
192
+ _proto.flush = function flush() {
193
+ this._injected = false;
194
+ this._rulesCount = 0;
195
+ if (typeof window !== "undefined") {
196
+ this._tags.forEach(function(tag) {
197
+ return tag && tag.parentNode.removeChild(tag);
198
+ });
199
+ this._tags = [];
200
+ } else {
201
+ // simpler on server
202
+ this._serverSheet.cssRules = [];
203
+ }
204
+ };
205
+ _proto.cssRules = function cssRules() {
206
+ var _this = this;
207
+ if (typeof window === "undefined") {
208
+ return this._serverSheet.cssRules;
209
+ }
210
+ return this._tags.reduce(function(rules, tag) {
211
+ if (tag) {
212
+ rules = rules.concat(Array.prototype.map.call(_this.getSheetForTag(tag).cssRules, function(rule) {
213
+ return rule.cssText === _this._deletedRulePlaceholder ? null : rule;
214
+ }));
215
+ } else {
216
+ rules.push(null);
217
+ }
218
+ return rules;
219
+ }, []);
220
+ };
221
+ _proto.makeStyleTag = function makeStyleTag(name, cssString, relativeToTag) {
222
+ if (cssString) {
223
+ invariant$1(isString(cssString), "makeStyleTag accepts only strings as second parameter");
224
+ }
225
+ var tag = document.createElement("style");
226
+ if (this._nonce) tag.setAttribute("nonce", this._nonce);
227
+ tag.type = "text/css";
228
+ tag.setAttribute("data-" + name, "");
229
+ if (cssString) {
230
+ tag.appendChild(document.createTextNode(cssString));
231
+ }
232
+ var head = document.head || document.getElementsByTagName("head")[0];
233
+ if (relativeToTag) {
234
+ head.insertBefore(tag, relativeToTag);
235
+ } else {
236
+ head.appendChild(tag);
237
+ }
238
+ return tag;
239
+ };
240
+ _createClass(StyleSheet, [
241
+ {
242
+ key: "length",
243
+ get: function get() {
244
+ return this._rulesCount;
245
+ }
246
+ }
247
+ ]);
248
+ return StyleSheet;
249
+ }();
250
+ function invariant$1(condition, message) {
251
+ if (!condition) {
252
+ throw new Error("StyleSheet: " + message + ".");
253
+ }
254
+ }
255
+
256
+ function hash(str) {
257
+ var _$hash = 5381, i = str.length;
258
+ while(i){
259
+ _$hash = _$hash * 33 ^ str.charCodeAt(--i);
260
+ }
261
+ /* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
262
+ * integers. Since we want the results to be always positive, convert the
263
+ * signed int to an unsigned by doing an unsigned bitshift. */ return _$hash >>> 0;
264
+ }
265
+ var stringHash = hash;
266
+
267
+ var sanitize = function(rule) {
268
+ return rule.replace(/\/style/gi, "\\/style");
269
+ };
270
+ var cache = {};
271
+ /**
272
+ * computeId
273
+ *
274
+ * Compute and memoize a jsx id from a basedId and optionally props.
275
+ */ function computeId(baseId, props) {
276
+ if (!props) {
277
+ return "jsx-" + baseId;
278
+ }
279
+ var propsToString = String(props);
280
+ var key = baseId + propsToString;
281
+ if (!cache[key]) {
282
+ cache[key] = "jsx-" + stringHash(baseId + "-" + propsToString);
283
+ }
284
+ return cache[key];
285
+ }
286
+ /**
287
+ * computeSelector
288
+ *
289
+ * Compute and memoize dynamic selectors.
290
+ */ function computeSelector(id, css) {
291
+ var selectoPlaceholderRegexp = /__jsx-style-dynamic-selector/g;
292
+ // Sanitize SSR-ed CSS.
293
+ // Client side code doesn't need to be sanitized since we use
294
+ // document.createTextNode (dev) and the CSSOM api sheet.insertRule (prod).
295
+ if (typeof window === "undefined") {
296
+ css = sanitize(css);
297
+ }
298
+ var idcss = id + css;
299
+ if (!cache[idcss]) {
300
+ cache[idcss] = css.replace(selectoPlaceholderRegexp, id);
301
+ }
302
+ return cache[idcss];
303
+ }
304
+
305
+ function mapRulesToStyle(cssRules, options) {
306
+ if (options === void 0) options = {};
307
+ return cssRules.map(function(args) {
308
+ var id = args[0];
309
+ var css = args[1];
310
+ return /*#__PURE__*/ React__default["default"].createElement("style", {
311
+ id: "__" + id,
312
+ // Avoid warnings upon render with a key
313
+ key: "__" + id,
314
+ nonce: options.nonce ? options.nonce : undefined,
315
+ dangerouslySetInnerHTML: {
316
+ __html: css
317
+ }
318
+ });
319
+ });
320
+ }
321
+ var StyleSheetRegistry = /*#__PURE__*/ function() {
322
+ function StyleSheetRegistry(param) {
323
+ var ref = param === void 0 ? {} : param, _styleSheet = ref.styleSheet, styleSheet = _styleSheet === void 0 ? null : _styleSheet, _optimizeForSpeed = ref.optimizeForSpeed, optimizeForSpeed = _optimizeForSpeed === void 0 ? false : _optimizeForSpeed;
324
+ this._sheet = styleSheet || new StyleSheet({
325
+ name: "styled-jsx",
326
+ optimizeForSpeed: optimizeForSpeed
327
+ });
328
+ this._sheet.inject();
329
+ if (styleSheet && typeof optimizeForSpeed === "boolean") {
330
+ this._sheet.setOptimizeForSpeed(optimizeForSpeed);
331
+ this._optimizeForSpeed = this._sheet.isOptimizeForSpeed();
332
+ }
333
+ this._fromServer = undefined;
334
+ this._indices = {};
335
+ this._instancesCounts = {};
336
+ }
337
+ var _proto = StyleSheetRegistry.prototype;
338
+ _proto.add = function add(props) {
339
+ var _this = this;
340
+ if (undefined === this._optimizeForSpeed) {
341
+ this._optimizeForSpeed = Array.isArray(props.children);
342
+ this._sheet.setOptimizeForSpeed(this._optimizeForSpeed);
343
+ this._optimizeForSpeed = this._sheet.isOptimizeForSpeed();
344
+ }
345
+ if (typeof window !== "undefined" && !this._fromServer) {
346
+ this._fromServer = this.selectFromServer();
347
+ this._instancesCounts = Object.keys(this._fromServer).reduce(function(acc, tagName) {
348
+ acc[tagName] = 0;
349
+ return acc;
350
+ }, {});
351
+ }
352
+ var ref = this.getIdAndRules(props), styleId = ref.styleId, rules = ref.rules;
353
+ // Deduping: just increase the instances count.
354
+ if (styleId in this._instancesCounts) {
355
+ this._instancesCounts[styleId] += 1;
356
+ return;
357
+ }
358
+ var indices = rules.map(function(rule) {
359
+ return _this._sheet.insertRule(rule);
360
+ })// Filter out invalid rules
361
+ .filter(function(index) {
362
+ return index !== -1;
363
+ });
364
+ this._indices[styleId] = indices;
365
+ this._instancesCounts[styleId] = 1;
366
+ };
367
+ _proto.remove = function remove(props) {
368
+ var _this = this;
369
+ var styleId = this.getIdAndRules(props).styleId;
370
+ invariant(styleId in this._instancesCounts, "styleId: `" + styleId + "` not found");
371
+ this._instancesCounts[styleId] -= 1;
372
+ if (this._instancesCounts[styleId] < 1) {
373
+ var tagFromServer = this._fromServer && this._fromServer[styleId];
374
+ if (tagFromServer) {
375
+ tagFromServer.parentNode.removeChild(tagFromServer);
376
+ delete this._fromServer[styleId];
377
+ } else {
378
+ this._indices[styleId].forEach(function(index) {
379
+ return _this._sheet.deleteRule(index);
380
+ });
381
+ delete this._indices[styleId];
382
+ }
383
+ delete this._instancesCounts[styleId];
384
+ }
385
+ };
386
+ _proto.update = function update(props, nextProps) {
387
+ this.add(nextProps);
388
+ this.remove(props);
389
+ };
390
+ _proto.flush = function flush() {
391
+ this._sheet.flush();
392
+ this._sheet.inject();
393
+ this._fromServer = undefined;
394
+ this._indices = {};
395
+ this._instancesCounts = {};
396
+ };
397
+ _proto.cssRules = function cssRules() {
398
+ var _this = this;
399
+ var fromServer = this._fromServer ? Object.keys(this._fromServer).map(function(styleId) {
400
+ return [
401
+ styleId,
402
+ _this._fromServer[styleId]
403
+ ];
404
+ }) : [];
405
+ var cssRules = this._sheet.cssRules();
406
+ return fromServer.concat(Object.keys(this._indices).map(function(styleId) {
407
+ return [
408
+ styleId,
409
+ _this._indices[styleId].map(function(index) {
410
+ return cssRules[index].cssText;
411
+ }).join(_this._optimizeForSpeed ? "" : "\n")
412
+ ];
413
+ })// filter out empty rules
414
+ .filter(function(rule) {
415
+ return Boolean(rule[1]);
416
+ }));
417
+ };
418
+ _proto.styles = function styles(options) {
419
+ return mapRulesToStyle(this.cssRules(), options);
420
+ };
421
+ _proto.getIdAndRules = function getIdAndRules(props) {
422
+ var css = props.children, dynamic = props.dynamic, id = props.id;
423
+ if (dynamic) {
424
+ var styleId = computeId(id, dynamic);
425
+ return {
426
+ styleId: styleId,
427
+ rules: Array.isArray(css) ? css.map(function(rule) {
428
+ return computeSelector(styleId, rule);
429
+ }) : [
430
+ computeSelector(styleId, css)
431
+ ]
432
+ };
433
+ }
434
+ return {
435
+ styleId: computeId(id),
436
+ rules: Array.isArray(css) ? css : [
437
+ css
438
+ ]
439
+ };
440
+ };
441
+ /**
442
+ * selectFromServer
443
+ *
444
+ * Collects style tags from the document with id __jsx-XXX
445
+ */ _proto.selectFromServer = function selectFromServer() {
446
+ var elements = Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]'));
447
+ return elements.reduce(function(acc, element) {
448
+ var id = element.id.slice(2);
449
+ acc[id] = element;
450
+ return acc;
451
+ }, {});
452
+ };
453
+ return StyleSheetRegistry;
454
+ }();
455
+ function invariant(condition, message) {
456
+ if (!condition) {
457
+ throw new Error("StyleSheetRegistry: " + message + ".");
458
+ }
459
+ }
460
+ var StyleSheetContext = /*#__PURE__*/ React.createContext(null);
461
+ StyleSheetContext.displayName = "StyleSheetContext";
462
+ function createStyleRegistry() {
463
+ return new StyleSheetRegistry();
464
+ }
465
+ function StyleRegistry(param) {
466
+ var configuredRegistry = param.registry, children = param.children;
467
+ var rootRegistry = React.useContext(StyleSheetContext);
468
+ var ref = React.useState(function() {
469
+ return rootRegistry || configuredRegistry || createStyleRegistry();
470
+ }), registry = ref[0];
471
+ return /*#__PURE__*/ React__default["default"].createElement(StyleSheetContext.Provider, {
472
+ value: registry
473
+ }, children);
474
+ }
475
+ function useStyleRegistry() {
476
+ return React.useContext(StyleSheetContext);
477
+ }
478
+
479
+ // Opt-into the new `useInsertionEffect` API in React 18, fallback to `useLayoutEffect`.
480
+ // https://github.com/reactwg/react-18/discussions/110
481
+ var useInsertionEffect = React__default["default"].useInsertionEffect || React.useLayoutEffect;
482
+ var defaultRegistry = typeof window !== "undefined" ? createStyleRegistry() : undefined;
483
+ function JSXStyle(props) {
484
+ var registry = defaultRegistry ? defaultRegistry : useStyleRegistry();
485
+ var insertionEffectCalled = React.useRef(false);
486
+ // `registry` might not exist while server-side rendering
487
+ if (!registry) {
488
+ return null;
489
+ }
490
+ if (typeof window === "undefined") {
491
+ registry.add(props);
492
+ return null;
493
+ }
494
+ useInsertionEffect(function() {
495
+ // ReactDOM removes all DOM during hydration in certain cases
496
+ if (!document.head) {
497
+ return;
498
+ }
499
+ registry.add(props);
500
+ insertionEffectCalled.current = true;
501
+ return function() {
502
+ insertionEffectCalled.current = false;
503
+ registry.remove(props);
504
+ };
505
+ }, [
506
+ props.id,
507
+ String(props.dynamic)
508
+ ]);
509
+ React.useLayoutEffect(function() {
510
+ if (!document.head || insertionEffectCalled.current) {
511
+ return;
512
+ }
513
+ registry.add(props);
514
+ return function() {
515
+ registry.remove(props);
516
+ };
517
+ // props.children can be string[], will be striped since id is identical
518
+ }, [
519
+ props.id,
520
+ String(props.dynamic)
521
+ ]);
522
+ return null;
523
+ }
524
+ JSXStyle.dynamic = function(info) {
525
+ return info.map(function(tagInfo) {
526
+ var baseId = tagInfo[0];
527
+ var props = tagInfo[1];
528
+ return computeId(baseId, props);
529
+ }).join(" ");
530
+ };
531
+
532
+ index.StyleRegistry = StyleRegistry;
533
+ index.createStyleRegistry = createStyleRegistry;
534
+ index.style = JSXStyle;
535
+ index.useStyleRegistry = useStyleRegistry;
536
+ return index;
39
537
  }
40
- function _createClass(e, r, t) {
41
- return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
42
- writable: false
43
- }), e;
538
+
539
+ var style;
540
+ var hasRequiredStyle;
541
+
542
+ function requireStyle () {
543
+ if (hasRequiredStyle) return style;
544
+ hasRequiredStyle = 1;
545
+ style = requireIndex().style;
546
+ return style;
44
547
  }
45
- function _defineProperty(e, r, t) {
46
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
47
- value: t,
48
- enumerable: true,
49
- configurable: true,
50
- writable: true
51
- }) : e[r] = t, e;
548
+
549
+ var styleExports = requireStyle();
550
+ var _JSXStyle = /*@__PURE__*/getDefaultExportFromCjs(styleExports);
551
+
552
+ function _arrayLikeToArray(r, a) {
553
+ (null == a || a > r.length) && (a = r.length);
554
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
555
+ return n;
52
556
  }
53
- function _getPrototypeOf(t) {
54
- return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
55
- return t.__proto__ || Object.getPrototypeOf(t);
56
- }, _getPrototypeOf(t);
557
+ function _arrayWithHoles(r) {
558
+ if (Array.isArray(r)) return r;
57
559
  }
58
- function _inherits(t, e) {
59
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
60
- t.prototype = Object.create(e && e.prototype, {
61
- constructor: {
62
- value: t,
63
- writable: true,
64
- configurable: true
560
+ function _iterableToArrayLimit(r, l) {
561
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
562
+ if (null != t) {
563
+ var e,
564
+ n,
565
+ i,
566
+ u,
567
+ a = [],
568
+ f = true,
569
+ o = false;
570
+ try {
571
+ if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
572
+ } catch (r) {
573
+ o = true, n = r;
574
+ } finally {
575
+ try {
576
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
577
+ } finally {
578
+ if (o) throw n;
579
+ }
65
580
  }
66
- }), Object.defineProperty(t, "prototype", {
67
- writable: false
68
- }), e && _setPrototypeOf(t, e);
69
- }
70
- function _isNativeReflectConstruct() {
71
- try {
72
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
73
- } catch (t) {}
74
- return (_isNativeReflectConstruct = function () {
75
- return !!t;
76
- })();
77
- }
78
- function _objectWithoutProperties(e, t) {
79
- if (null == e) return {};
80
- var o,
81
- r,
82
- i = _objectWithoutPropertiesLoose(e, t);
83
- if (Object.getOwnPropertySymbols) {
84
- var n = Object.getOwnPropertySymbols(e);
85
- for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
86
- }
87
- return i;
88
- }
89
- function _objectWithoutPropertiesLoose(r, e) {
90
- if (null == r) return {};
91
- var t = {};
92
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
93
- if (-1 !== e.indexOf(n)) continue;
94
- t[n] = r[n];
581
+ return a;
95
582
  }
96
- return t;
97
583
  }
98
- function _possibleConstructorReturn(t, e) {
99
- if (e && ("object" == typeof e || "function" == typeof e)) return e;
100
- if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
101
- return _assertThisInitialized(t);
584
+ function _nonIterableRest() {
585
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
102
586
  }
103
- function _setPrototypeOf(t, e) {
104
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
105
- return t.__proto__ = e, t;
106
- }, _setPrototypeOf(t, e);
587
+ function _slicedToArray(r, e) {
588
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
107
589
  }
108
- function _toPrimitive(t, r) {
109
- if ("object" != typeof t || !t) return t;
110
- var e = t[Symbol.toPrimitive];
111
- if (void 0 !== e) {
112
- var i = e.call(t, r);
113
- if ("object" != typeof i) return i;
114
- throw new TypeError("@@toPrimitive must return a primitive value.");
590
+ function _unsupportedIterableToArray(r, a) {
591
+ if (r) {
592
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
593
+ var t = {}.toString.call(r).slice(8, -1);
594
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
115
595
  }
116
- return (String )(t);
117
- }
118
- function _toPropertyKey(t) {
119
- var i = _toPrimitive(t, "string");
120
- return "symbol" == typeof i ? i : i + "";
121
- }
122
-
123
- var VIEWBOX_WIDTH = 100;
124
- var VIEWBOX_HEIGHT = 100;
125
- var VIEWBOX_HEIGHT_HALF = 50;
126
- var VIEWBOX_CENTER_X = 50;
127
- var VIEWBOX_CENTER_Y = 50;
128
-
129
- // import * as React from 'react';
130
- function Path(_ref) {
131
- var className = _ref.className,
132
- counterClockwise = _ref.counterClockwise,
133
- dashRatio = _ref.dashRatio,
134
- pathRadius = _ref.pathRadius,
135
- strokeWidth = _ref.strokeWidth,
136
- style = _ref.style;
137
- return /*#__PURE__*/React.createElement("path", {
138
- className: className,
139
- style: Object.assign({}, style, getDashStyle({
140
- pathRadius: pathRadius,
141
- dashRatio: dashRatio,
142
- counterClockwise: counterClockwise
143
- })),
144
- d: getPathDescription({
145
- pathRadius: pathRadius,
146
- counterClockwise: counterClockwise
147
- }),
148
- strokeWidth: strokeWidth,
149
- fillOpacity: 0
150
- });
151
596
  }
152
597
 
153
- // SVG path description specifies how the path should be drawn
154
- function getPathDescription(_ref2) {
155
- var pathRadius = _ref2.pathRadius,
156
- counterClockwise = _ref2.counterClockwise;
157
- var radius = pathRadius;
158
- var rotation = counterClockwise ? 1 : 0;
598
+ function useCircularProgress(_ref) {
599
+ var _ref$value = _ref.value,
600
+ value = _ref$value === void 0 ? 0 : _ref$value,
601
+ _ref$min = _ref.min,
602
+ min = _ref$min === void 0 ? 0 : _ref$min,
603
+ _ref$max = _ref.max,
604
+ max = _ref$max === void 0 ? 100 : _ref$max,
605
+ _ref$variant = _ref.variant,
606
+ variant = _ref$variant === void 0 ? "determinate" : _ref$variant;
607
+ var normalizedValue = require$$1.useMemo(function () {
608
+ if (variant !== "determinate") return 0;
609
+ return Math.min(Math.max(value, min), max);
610
+ }, [value, min, max, variant]);
611
+ var percentage = require$$1.useMemo(function () {
612
+ if (variant !== "determinate") return 0;
613
+ return (normalizedValue - min) / (max - min) * 100;
614
+ }, [normalizedValue, min, max, variant]);
159
615
 
160
- // Move to center of canvas
161
- // Relative move to top canvas
162
- // Relative arc to bottom of canvas
163
- // Relative arc to top of canvas
164
- return "\n M ".concat(VIEWBOX_CENTER_X, ",").concat(VIEWBOX_CENTER_Y, "\n m 0,-").concat(radius, "\n a ").concat(radius, ",").concat(radius, " ").concat(rotation, " 1 1 0,").concat(2 * radius, "\n a ").concat(radius, ",").concat(radius, " ").concat(rotation, " 1 1 0,-").concat(2 * radius, "\n ");
165
- }
166
- function getDashStyle(_ref3) {
167
- var counterClockwise = _ref3.counterClockwise,
168
- dashRatio = _ref3.dashRatio,
169
- pathRadius = _ref3.pathRadius;
170
- var diameter = Math.PI * 2 * pathRadius;
171
- var gapLength = (1 - dashRatio) * diameter;
616
+ // SSR-safe animated number
617
+ var _useState = require$$1.useState(normalizedValue),
618
+ _useState2 = _slicedToArray(_useState, 2),
619
+ displayValue = _useState2[0],
620
+ setDisplayValue = _useState2[1];
621
+ require$$1.useEffect(function () {
622
+ setDisplayValue(normalizedValue);
623
+ }, [normalizedValue]);
172
624
  return {
173
- // Have dash be full diameter, and gap be full diameter
174
- strokeDasharray: "".concat(diameter, "px ").concat(diameter, "px"),
175
- // Shift dash backward by gapLength, so gap starts appearing at correct distance
176
- strokeDashoffset: "".concat(counterClockwise ? -gapLength : gapLength, "px")
625
+ percentage: percentage,
626
+ displayValue: displayValue
177
627
  };
178
628
  }
179
629
 
180
- var CircularProgressbar = /*#__PURE__*/function (_React$Component) {
181
- function CircularProgressbar() {
182
- _classCallCheck(this, CircularProgressbar);
183
- return _callSuper(this, CircularProgressbar, arguments);
184
- }
185
- _inherits(CircularProgressbar, _React$Component);
186
- return _createClass(CircularProgressbar, [{
187
- key: "getBackgroundPadding",
188
- value: function getBackgroundPadding() {
189
- if (!this.props.background) {
190
- // Don't add padding if not displaying background
191
- return 0;
192
- }
193
- return this.props.backgroundPadding;
194
- }
195
- }, {
196
- key: "getPathRadius",
197
- value: function getPathRadius() {
198
- // The radius of the path is defined to be in the middle, so in order for the path to
199
- // fit perfectly inside the 100x100 viewBox, need to subtract half the strokeWidth
200
- return VIEWBOX_HEIGHT_HALF - this.props.strokeWidth / 2 - this.getBackgroundPadding();
201
- }
630
+ var statusColors = {
631
+ "default": "#3b82f6",
632
+ success: "#10b981",
633
+ warning: "#f59e0b",
634
+ error: "#ef4444"
635
+ };
636
+ var CircularProgress = /*#__PURE__*/require$$1.forwardRef(function (_ref, ref) {
637
+ var _ref$size = _ref.size,
638
+ size = _ref$size === void 0 ? 140 : _ref$size,
639
+ _ref$strokeWidth = _ref.strokeWidth,
640
+ strokeWidth = _ref$strokeWidth === void 0 ? 12 : _ref$strokeWidth,
641
+ _ref$value = _ref.value,
642
+ value = _ref$value === void 0 ? 0 : _ref$value,
643
+ _ref$min = _ref.min,
644
+ min = _ref$min === void 0 ? 0 : _ref$min,
645
+ _ref$max = _ref.max,
646
+ max = _ref$max === void 0 ? 100 : _ref$max,
647
+ _ref$variant = _ref.variant,
648
+ variant = _ref$variant === void 0 ? "determinate" : _ref$variant,
649
+ _ref$status = _ref.status,
650
+ status = _ref$status === void 0 ? "default" : _ref$status,
651
+ _ref$gradient = _ref.gradient,
652
+ gradient = _ref$gradient === void 0 ? true : _ref$gradient,
653
+ _ref$showPercentage = _ref.showPercentage,
654
+ showPercentage = _ref$showPercentage === void 0 ? true : _ref$showPercentage,
655
+ label = _ref.label;
656
+ var _useCircularProgress = useCircularProgress({
657
+ value: value,
658
+ min: min,
659
+ max: max,
660
+ variant: variant
661
+ }),
662
+ percentage = _useCircularProgress.percentage,
663
+ displayValue = _useCircularProgress.displayValue;
664
+ var radius = (size - strokeWidth) / 2;
665
+ var circumference = 2 * Math.PI * radius;
666
+ var strokeDashoffset = circumference - percentage / 100 * circumference;
667
+ var baseColor = statusColors[status];
202
668
 
203
- // Ratio of path length to trail length, as a value between 0 and 1
204
- }, {
205
- key: "getPathRatio",
206
- value: function getPathRatio() {
207
- var _this$props = this.props,
208
- value = _this$props.value,
209
- minValue = _this$props.minValue,
210
- maxValue = _this$props.maxValue;
211
- var boundedValue = Math.min(Math.max(value, minValue), maxValue);
212
- return (boundedValue - minValue) / (maxValue - minValue);
213
- }
214
- }, {
215
- key: "render",
216
- value: function render() {
217
- var _this$props2 = this.props,
218
- circleRatio = _this$props2.circleRatio,
219
- className = _this$props2.className,
220
- classes = _this$props2.classes,
221
- counterClockwise = _this$props2.counterClockwise,
222
- styles = _this$props2.styles,
223
- strokeWidth = _this$props2.strokeWidth,
224
- text = _this$props2.text;
225
- var pathRadius = this.getPathRadius();
226
- var pathRatio = this.getPathRatio();
227
- return /*#__PURE__*/React__namespace.createElement("svg", {
228
- className: "".concat(classes.root, " ").concat(className),
229
- style: styles.root,
230
- viewBox: "0 0 ".concat(VIEWBOX_WIDTH, " ").concat(VIEWBOX_HEIGHT),
231
- "data-test-id": "CircularProgressbar"
232
- }, this.props.background ? /*#__PURE__*/React__namespace.createElement("circle", {
233
- className: classes.background,
234
- style: styles.background,
235
- cx: VIEWBOX_CENTER_X,
236
- cy: VIEWBOX_CENTER_Y,
237
- r: VIEWBOX_HEIGHT_HALF
238
- }) : null, /*#__PURE__*/React__namespace.createElement(Path, {
239
- className: classes.trail,
240
- counterClockwise: counterClockwise,
241
- dashRatio: circleRatio,
242
- pathRadius: pathRadius,
669
+ // SSR-SAFE ID
670
+ var gradientId = require$$1.useId();
671
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
672
+ ref: ref,
673
+ role: "progressbar",
674
+ "aria-valuemin": min,
675
+ "aria-valuemax": max,
676
+ "aria-valuenow": variant === "determinate" ? value : undefined,
677
+ className: _JSXStyle.dynamic([["4042284457", [size * 0.18]]]) + " " + "wrapper",
678
+ children: [/*#__PURE__*/jsxRuntime.jsxs("svg", {
679
+ width: size,
680
+ height: size,
681
+ className: _JSXStyle.dynamic([["4042284457", [size * 0.18]]]),
682
+ children: [gradient && /*#__PURE__*/jsxRuntime.jsx("defs", {
683
+ className: _JSXStyle.dynamic([["4042284457", [size * 0.18]]]),
684
+ children: /*#__PURE__*/jsxRuntime.jsxs("linearGradient", {
685
+ id: gradientId,
686
+ className: _JSXStyle.dynamic([["4042284457", [size * 0.18]]]),
687
+ children: [/*#__PURE__*/jsxRuntime.jsx("stop", {
688
+ offset: "0%",
689
+ stopColor: baseColor,
690
+ className: _JSXStyle.dynamic([["4042284457", [size * 0.18]]])
691
+ }), /*#__PURE__*/jsxRuntime.jsx("stop", {
692
+ offset: "100%",
693
+ stopColor: "#9333ea",
694
+ className: _JSXStyle.dynamic([["4042284457", [size * 0.18]]])
695
+ })]
696
+ })
697
+ }), /*#__PURE__*/jsxRuntime.jsx("circle", {
698
+ stroke: "#e5e7eb",
699
+ fill: "none",
243
700
  strokeWidth: strokeWidth,
244
- style: styles.trail
245
- }), /*#__PURE__*/React__namespace.createElement(Path, {
246
- className: classes.path,
247
- counterClockwise: counterClockwise,
248
- dashRatio: pathRatio * circleRatio,
249
- pathRadius: pathRadius,
701
+ r: radius,
702
+ cx: size / 2,
703
+ cy: size / 2,
704
+ className: _JSXStyle.dynamic([["4042284457", [size * 0.18]]])
705
+ }), /*#__PURE__*/jsxRuntime.jsx(framerMotion.motion.circle, {
706
+ fill: "none",
707
+ stroke: gradient ? "url(#".concat(gradientId, ")") : baseColor,
250
708
  strokeWidth: strokeWidth,
251
- style: styles.path
252
- }), text ? /*#__PURE__*/React__namespace.createElement("text", {
253
- className: classes.text,
254
- style: styles.text,
255
- x: VIEWBOX_CENTER_X,
256
- y: VIEWBOX_CENTER_Y
257
- }, text) : null);
258
- }
259
- }]);
260
- }(React__namespace.Component);
261
- _defineProperty(CircularProgressbar, "defaultProps", {
262
- background: false,
263
- backgroundPadding: 0,
264
- circleRatio: 1,
265
- classes: {
266
- root: 'CircularProgressbar',
267
- trail: 'CircularProgressbar-trail',
268
- path: 'CircularProgressbar-path',
269
- text: 'CircularProgressbar-text',
270
- background: 'CircularProgressbar-background'
271
- },
272
- counterClockwise: false,
273
- className: '',
274
- maxValue: 100,
275
- minValue: 0,
276
- strokeWidth: 8,
277
- styles: {
278
- root: {},
279
- trail: {},
280
- path: {},
281
- text: {},
282
- background: {}
283
- },
284
- text: ''
285
- });
286
-
287
- var _excluded = ["children"];
288
- // This is a wrapper around CircularProgressbar that allows passing children,
289
- // which will be vertically and horizontally centered inside the progressbar automatically.
290
- function CircularProgressbarWithChildren(props) {
291
- props.children;
292
- var circularProgressbarProps = _objectWithoutProperties(props, _excluded);
293
- return /*#__PURE__*/React__namespace.createElement("div", {
294
- "data-test-id": "CircularProgressbarWithChildren"
295
- }, /*#__PURE__*/React__namespace.createElement("div", {
296
- style: {
297
- position: 'relative',
298
- width: '100%',
299
- height: '100%'
300
- }
301
- }, /*#__PURE__*/React__namespace.createElement(CircularProgressbar, circularProgressbarProps), props.children ? /*#__PURE__*/React__namespace.createElement("div", {
302
- "data-test-id": "CircularProgressbarWithChildren__children",
303
- style: {
304
- position: 'absolute',
305
- width: '100%',
306
- height: '100%',
307
- marginTop: '-100%',
308
- display: 'flex',
309
- flexDirection: 'column',
310
- justifyContent: 'center',
311
- alignItems: 'center'
312
- }
313
- }, props.children) : null));
314
- }
315
-
316
- function buildStyles(_ref) {
317
- var rotation = _ref.rotation,
318
- strokeLinecap = _ref.strokeLinecap,
319
- textColor = _ref.textColor,
320
- textSize = _ref.textSize,
321
- pathColor = _ref.pathColor,
322
- pathTransition = _ref.pathTransition,
323
- pathTransitionDuration = _ref.pathTransitionDuration,
324
- trailColor = _ref.trailColor,
325
- backgroundColor = _ref.backgroundColor;
326
- var rotationTransform = rotation == null ? undefined : "rotate(".concat(rotation, "turn)");
327
- var rotationTransformOrigin = rotation == null ? undefined : 'center center';
328
- return {
329
- root: {},
330
- path: removeUndefinedValues({
331
- stroke: pathColor,
332
- strokeLinecap: strokeLinecap,
333
- transform: rotationTransform,
334
- transformOrigin: rotationTransformOrigin,
335
- transition: pathTransition,
336
- transitionDuration: pathTransitionDuration == null ? undefined : "".concat(pathTransitionDuration, "s")
337
- }),
338
- trail: removeUndefinedValues({
339
- stroke: trailColor,
340
- strokeLinecap: strokeLinecap,
341
- transform: rotationTransform,
342
- transformOrigin: rotationTransformOrigin
343
- }),
344
- text: removeUndefinedValues({
345
- fill: textColor,
346
- fontSize: textSize
347
- }),
348
- background: removeUndefinedValues({
349
- fill: backgroundColor
350
- })
351
- };
352
- }
353
- function removeUndefinedValues(obj) {
354
- Object.keys(obj).forEach(function (key) {
355
- if (obj[key] == null) {
356
- delete obj[key];
357
- }
709
+ strokeLinecap: "round",
710
+ strokeDasharray: circumference,
711
+ r: radius,
712
+ cx: size / 2,
713
+ cy: size / 2,
714
+ initial: false,
715
+ animate: {
716
+ strokeDashoffset: variant === "determinate" ? strokeDashoffset : circumference * 0.4,
717
+ rotate: variant === "indeterminate" ? 360 : 0
718
+ },
719
+ transition: variant === "indeterminate" ? {
720
+ repeat: Infinity,
721
+ duration: 1.2,
722
+ ease: "linear"
723
+ } : {
724
+ duration: 0.6,
725
+ ease: "easeOut"
726
+ }
727
+ })]
728
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
729
+ className: _JSXStyle.dynamic([["4042284457", [size * 0.18]]]) + " " + "label",
730
+ children: label !== null && label !== void 0 ? label : showPercentage && variant === "determinate" ? "".concat(Math.round(displayValue), "%") : null
731
+ }), /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
732
+ id: "4042284457",
733
+ dynamic: [size * 0.18],
734
+ children: ".wrapper.__jsx-style-dynamic-selector{position:relative;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}svg.__jsx-style-dynamic-selector{-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);}.label.__jsx-style-dynamic-selector{position:absolute;font-weight:700;font-size:".concat(size * 0.18, "px;}")
735
+ })]
358
736
  });
359
- return obj;
360
- }
737
+ });
738
+ CircularProgress.displayName = "CircularProgress";
361
739
 
362
- exports.CircularProgress = CircularProgressbarWithChildren;
363
- exports.CircularProgressBar = CircularProgressbar;
364
- exports.buildStyles = buildStyles;
740
+ exports.default = CircularProgress;
741
+ exports.useCircularProgress = useCircularProgress;