@longline/aqua-ui 1.0.217 → 1.0.218
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.
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ICircularProgressProps {
|
|
3
|
+
/** @ignore */
|
|
4
|
+
className?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Progress value. Will be clamped between 0 and 100.
|
|
7
|
+
* @example 75
|
|
8
|
+
*/
|
|
9
|
+
value: number;
|
|
10
|
+
/**
|
|
11
|
+
* Color of the progress arc.
|
|
12
|
+
* @default primary 1
|
|
13
|
+
*/
|
|
14
|
+
color?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Circle diameter in pixels.
|
|
17
|
+
* @default 100
|
|
18
|
+
*/
|
|
19
|
+
size?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Circle stroke width in pixels
|
|
22
|
+
* @default 2
|
|
23
|
+
*/
|
|
24
|
+
strokeWidth?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A reusable circular progress indicator component.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* <CircularProgress value={65} />
|
|
31
|
+
*/
|
|
32
|
+
declare const CircularProgress: ({ size, strokeWidth, ...props }: ICircularProgressProps) => React.JSX.Element;
|
|
33
|
+
export { CircularProgress };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
var __assign = (this && this.__assign) || function () {
|
|
6
|
+
__assign = Object.assign || function(t) {
|
|
7
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
+
s = arguments[i];
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
+
t[p] = s[p];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
17
|
+
var t = {};
|
|
18
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
19
|
+
t[p] = s[p];
|
|
20
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
21
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
23
|
+
t[p[i]] = s[p[i]];
|
|
24
|
+
}
|
|
25
|
+
return t;
|
|
26
|
+
};
|
|
27
|
+
import React from 'react';
|
|
28
|
+
import styled from 'styled-components';
|
|
29
|
+
var CircularProgressBase = function (props) {
|
|
30
|
+
// Clamp progress value between 0 and 100:
|
|
31
|
+
var value = Math.min(Math.max(props.value, 0), 100);
|
|
32
|
+
var radius = (props.size - props.strokeWidth) / 2;
|
|
33
|
+
var circumference = 2 * Math.PI * radius;
|
|
34
|
+
var offset = circumference * (1 - value / 100);
|
|
35
|
+
return (React.createElement("div", { className: props.className, role: "progressbar", "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": 100 },
|
|
36
|
+
React.createElement("svg", { width: props.size, height: props.size },
|
|
37
|
+
React.createElement("circle", { cx: props.size / 2, cy: props.size / 2, r: radius, fill: "none", strokeDasharray: circumference, strokeDashoffset: offset, strokeLinecap: "round", transform: "rotate(-90 ".concat(props.size / 2, " ").concat(props.size / 2, ")") })),
|
|
38
|
+
React.createElement(Text, null,
|
|
39
|
+
Math.round(value),
|
|
40
|
+
"%")));
|
|
41
|
+
};
|
|
42
|
+
/** Text label displayed at the center of the circle. */
|
|
43
|
+
var Text = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n z-index: 1;\n font: ", ";\n"], ["\n position: relative;\n z-index: 1;\n font: ", ";\n"
|
|
44
|
+
/**
|
|
45
|
+
* Styled version of CircularProgressBase.
|
|
46
|
+
* Handles sizing, positioning, and theming.
|
|
47
|
+
*/
|
|
48
|
+
])), function (p) { return p.theme.font.labelSmall; });
|
|
49
|
+
/**
|
|
50
|
+
* Styled version of CircularProgressBase.
|
|
51
|
+
* Handles sizing, positioning, and theming.
|
|
52
|
+
*/
|
|
53
|
+
var CircularProgressStyled = styled(CircularProgressBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n width: ", "px;\n height: ", "px;\n display: flex;\n justify-content: center;\n align-items: center;\n svg {\n position: absolute;\n inset: 0;\n stroke: ", ";\n stroke-width: ", ";\n }\n"], ["\n position: relative;\n width: ", "px;\n height: ", "px;\n display: flex;\n justify-content: center;\n align-items: center;\n svg {\n position: absolute;\n inset: 0;\n stroke: ", ";\n stroke-width: ", ";\n }\n"
|
|
54
|
+
/**
|
|
55
|
+
* A reusable circular progress indicator component.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* <CircularProgress value={65} />
|
|
59
|
+
*/
|
|
60
|
+
])), function (p) { return p.size; }, function (p) { return p.size; }, function (p) { var _a; return (_a = p.color) !== null && _a !== void 0 ? _a : p.theme.colors.primary[1]; }, function (p) { return p.strokeWidth; });
|
|
61
|
+
/**
|
|
62
|
+
* A reusable circular progress indicator component.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* <CircularProgress value={65} />
|
|
66
|
+
*/
|
|
67
|
+
var CircularProgress = function (_a) {
|
|
68
|
+
var _b = _a.size, size = _b === void 0 ? 100 : _b, _c = _a.strokeWidth, strokeWidth = _c === void 0 ? 2 : _c, props = __rest(_a, ["size", "strokeWidth"]);
|
|
69
|
+
return React.createElement(CircularProgressStyled, __assign({ size: size, strokeWidth: strokeWidth }, props));
|
|
70
|
+
};
|
|
71
|
+
export { CircularProgress };
|
|
72
|
+
var templateObject_1, templateObject_2;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CircularProgress } from './CircularProgress';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CircularProgress } from './CircularProgress';
|