@commonsku/styles 1.17.23 → 1.17.24
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/dist/index.cjs +74 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.mjs +75 -47
- package/dist/index.mjs.map +1 -1
- package/dist/styles/icons/CircleProgressIcon.d.ts +6 -5
- package/dist/styles/icons/CircleProgressIcon.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1452,58 +1452,86 @@ var Theme = function (_a) {
|
|
|
1452
1452
|
children));
|
|
1453
1453
|
};
|
|
1454
1454
|
|
|
1455
|
+
var iconSizes$9 = {
|
|
1456
|
+
tiny: {
|
|
1457
|
+
width: 32,
|
|
1458
|
+
height: 32,
|
|
1459
|
+
viewBox: "0 0 32 32",
|
|
1460
|
+
fontSize: ".6em",
|
|
1461
|
+
defaultStrokeWidth: 3,
|
|
1462
|
+
},
|
|
1463
|
+
small: {
|
|
1464
|
+
width: 40,
|
|
1465
|
+
height: 40,
|
|
1466
|
+
viewBox: "0 0 40 40",
|
|
1467
|
+
fontSize: ".6em",
|
|
1468
|
+
defaultStrokeWidth: 3,
|
|
1469
|
+
},
|
|
1470
|
+
medium: {
|
|
1471
|
+
width: 48,
|
|
1472
|
+
height: 48,
|
|
1473
|
+
viewBox: "0 0 48 48",
|
|
1474
|
+
fontSize: ".8em",
|
|
1475
|
+
defaultStrokeWidth: 5,
|
|
1476
|
+
},
|
|
1477
|
+
large: {
|
|
1478
|
+
width: 72,
|
|
1479
|
+
height: 72,
|
|
1480
|
+
viewBox: "0 0 72 72",
|
|
1481
|
+
fontSize: "1em",
|
|
1482
|
+
defaultStrokeWidth: 5,
|
|
1483
|
+
},
|
|
1484
|
+
huge: {
|
|
1485
|
+
width: 96,
|
|
1486
|
+
height: 96,
|
|
1487
|
+
viewBox: "0 0 96 96",
|
|
1488
|
+
fontSize: "1em",
|
|
1489
|
+
defaultStrokeWidth: 5,
|
|
1490
|
+
},
|
|
1491
|
+
default: {
|
|
1492
|
+
height: 48,
|
|
1493
|
+
width: 48,
|
|
1494
|
+
viewBox: "0 0 48 48",
|
|
1495
|
+
fontSize: ".8em",
|
|
1496
|
+
defaultStrokeWidth: 5,
|
|
1497
|
+
},
|
|
1498
|
+
};
|
|
1455
1499
|
function CircleProgressIcon(_a) {
|
|
1456
|
-
var
|
|
1457
|
-
var iconSizes =
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
viewBox: "0 0 32 32",
|
|
1462
|
-
},
|
|
1463
|
-
small: {
|
|
1464
|
-
width: 40,
|
|
1465
|
-
height: 40,
|
|
1466
|
-
viewBox: "0 0 40 40",
|
|
1467
|
-
},
|
|
1468
|
-
medium: {
|
|
1469
|
-
width: 48,
|
|
1470
|
-
height: 48,
|
|
1471
|
-
viewBox: "0 0 48 48",
|
|
1472
|
-
},
|
|
1473
|
-
large: {
|
|
1474
|
-
width: 72,
|
|
1475
|
-
height: 72,
|
|
1476
|
-
viewBox: "0 0 72 72",
|
|
1477
|
-
},
|
|
1478
|
-
huge: {
|
|
1479
|
-
width: 96,
|
|
1480
|
-
height: 96,
|
|
1481
|
-
viewBox: "0 0 96 96",
|
|
1482
|
-
},
|
|
1483
|
-
default: {
|
|
1484
|
-
height: 48,
|
|
1485
|
-
width: 48,
|
|
1486
|
-
viewBox: "0 0 48 48",
|
|
1487
|
-
},
|
|
1488
|
-
};
|
|
1489
|
-
sqSize = iconSizes[size]["width"];
|
|
1490
|
-
strokeWidth = size === "tiny" || size === "small" ? 3 : 5;
|
|
1491
|
-
var radius = (sqSize - strokeWidth) / 2;
|
|
1492
|
-
// const viewBox = `0 0 ${sqSize} ${sqSize}`;
|
|
1500
|
+
var strokeWidth = _a.strokeWidth, _b = _a.percentage, percentage = _b === void 0 ? 0 : _b, _c = _a.strokeColor, strokeColor = _c === void 0 ? teal.main : _c, _d = _a.textColor, textColor = _d === void 0 ? teal.main : _d, _e = _a.text, text = _e === void 0 ? "" : _e, _f = _a.textStyle, textStyle = _f === void 0 ? {} : _f, _g = _a.showCheckMarkOnComplete, showCheckMarkOnComplete = _g === void 0 ? false : _g, _h = _a.size, size = _h === void 0 ? "medium" : _h, _j = _a.altText, altText = _j === void 0 ? "Progress level" : _j, props = __rest(_a, ["strokeWidth", "percentage", "strokeColor", "textColor", "text", "textStyle", "showCheckMarkOnComplete", "size", "altText"]);
|
|
1501
|
+
var _k = iconSizes$9[size], width = _k.width, defaultStrokeWidth = _k.defaultStrokeWidth, fontSize = _k.fontSize; _k.viewBox;
|
|
1502
|
+
strokeWidth = strokeWidth || defaultStrokeWidth;
|
|
1503
|
+
var squareSize = width;
|
|
1504
|
+
var radius = (squareSize - strokeWidth) / 2;
|
|
1493
1505
|
var dashArray = radius * Math.PI * 2;
|
|
1494
|
-
var dashOffset = dashArray - dashArray * percentage / 100;
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1506
|
+
var dashOffset = dashArray - (dashArray * percentage) / 100;
|
|
1507
|
+
var isComplete = percentage === 100;
|
|
1508
|
+
var renderInnerText = React.useCallback(function () { return (React__default.default.createElement("text", { className: "circle-text", x: "50%", y: "50%", dy: ".3em", textAnchor: "middle", style: __assign({ fontSize: fontSize, fontWeight: "bold", fill: textColor }, textStyle) }, text || "".concat(percentage, "%"))); }, [fontSize, textColor, textStyle, text, percentage]);
|
|
1509
|
+
var renderCheckMark = React.useCallback(function () {
|
|
1510
|
+
var preferredViewBox = 40;
|
|
1511
|
+
var scale = squareSize / preferredViewBox;
|
|
1512
|
+
var scaledPath = [
|
|
1513
|
+
{ x: 12.0006 * scale, y: 21.599 * scale },
|
|
1514
|
+
{ x: 17.5629 * scale, y: 27.1617 * scale },
|
|
1515
|
+
{ x: 29.1621 * scale, y: 15.5625 * scale },
|
|
1516
|
+
]
|
|
1517
|
+
.map(function (p) { return "".concat(p.x, ",").concat(p.y); })
|
|
1518
|
+
.join(" L");
|
|
1519
|
+
return (React__default.default.createElement("path", { d: "M".concat(scaledPath), stroke: strokeColor, strokeWidth: "".concat(strokeWidth, "px"), fill: "none" }));
|
|
1520
|
+
}, [squareSize, strokeColor, strokeWidth]);
|
|
1521
|
+
return (React__default.default.createElement(SVG$1, __assign({ size: size, iconSizes: iconSizes$9, "aria-labelledby": "CircleProgressIcon" }, props),
|
|
1522
|
+
React__default.default.createElement("title", { id: "CircleProgressIcon" }, altText || (text ? "".concat(text, " stage") : "".concat(percentage, "% completed"))),
|
|
1523
|
+
React__default.default.createElement("circle", { className: "circle-background", cx: squareSize / 2, cy: squareSize / 2, r: radius, strokeWidth: "".concat(strokeWidth, "px"), style: { fill: "none", stroke: colors$1.disabledButtonBorder } }),
|
|
1524
|
+
React__default.default.createElement("circle", { className: "circle-progress", cx: squareSize / 2, cy: squareSize / 2, r: radius, strokeWidth: "".concat(strokeWidth, "px"), transform: "rotate(-90 ".concat(squareSize / 2, " ").concat(squareSize / 2, ")"), style: {
|
|
1499
1525
|
strokeDasharray: dashArray,
|
|
1500
1526
|
strokeDashoffset: dashOffset,
|
|
1501
|
-
fill:
|
|
1527
|
+
fill: "none",
|
|
1502
1528
|
stroke: strokeColor,
|
|
1503
|
-
strokeLinecap:
|
|
1504
|
-
strokeLinejoin:
|
|
1529
|
+
strokeLinecap: "round",
|
|
1530
|
+
strokeLinejoin: "round",
|
|
1505
1531
|
} }),
|
|
1506
|
-
|
|
1532
|
+
showCheckMarkOnComplete && isComplete
|
|
1533
|
+
? renderCheckMark()
|
|
1534
|
+
: renderInnerText()));
|
|
1507
1535
|
}
|
|
1508
1536
|
|
|
1509
1537
|
var SVG = styled__default.default.svg(templateObject_1$Y || (templateObject_1$Y = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), SharedStyles);
|