@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.d.ts
CHANGED
|
@@ -3282,16 +3282,17 @@ type GearIconProps = SVGIconProps & {
|
|
|
3282
3282
|
declare function GearIcon({ color, filled, size, altText, ...props }: GearIconProps): React__default.JSX.Element;
|
|
3283
3283
|
|
|
3284
3284
|
type CircleProgressIconProps = SVGIconProps & {
|
|
3285
|
-
sqSize?: number;
|
|
3286
3285
|
strokeWidth?: number;
|
|
3287
3286
|
percentage?: number;
|
|
3288
3287
|
strokeColor?: string;
|
|
3289
3288
|
textColor?: string;
|
|
3290
3289
|
text?: string;
|
|
3291
|
-
viewBox?: string;
|
|
3292
3290
|
textStyle?: React__default.CSSProperties;
|
|
3291
|
+
showCheckMarkOnComplete?: boolean;
|
|
3292
|
+
size?: "tiny" | "small" | "medium" | "large" | "huge";
|
|
3293
|
+
altText?: string;
|
|
3293
3294
|
};
|
|
3294
|
-
declare function CircleProgressIcon({
|
|
3295
|
+
declare function CircleProgressIcon({ strokeWidth, percentage, strokeColor, textColor, text, textStyle, showCheckMarkOnComplete, size, altText, ...props }: CircleProgressIconProps): React__default.JSX.Element;
|
|
3295
3296
|
|
|
3296
3297
|
declare function Loading({ height, width, animationDuration, barWidth, barRadius, colorful, bars, viewBox, rotate, startColor, endColor, ...props }: {
|
|
3297
3298
|
height?: number;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _, { map, pick, keys, isUndefined, get, uniqueId, assign, range as range$1, isEmpty, tail, toNumber, isString, filter, round, partial, debounce } from 'lodash';
|
|
2
2
|
import styled, { css, createGlobalStyle, ThemeProvider, keyframes } from 'styled-components';
|
|
3
|
-
import React, { useMemo, Fragment, useState, useEffect, useRef,
|
|
3
|
+
import React, { useCallback, useMemo, Fragment, useState, useEffect, useRef, useImperativeHandle, Component, useLayoutEffect, forwardRef, createContext, memo } from 'react';
|
|
4
4
|
import { useDropzone } from 'react-dropzone';
|
|
5
5
|
import BaseSelect from 'react-select';
|
|
6
6
|
export { components, createFilter, mergeStyles } from 'react-select';
|
|
@@ -1421,58 +1421,86 @@ var Theme = function (_a) {
|
|
|
1421
1421
|
children));
|
|
1422
1422
|
};
|
|
1423
1423
|
|
|
1424
|
+
var iconSizes$9 = {
|
|
1425
|
+
tiny: {
|
|
1426
|
+
width: 32,
|
|
1427
|
+
height: 32,
|
|
1428
|
+
viewBox: "0 0 32 32",
|
|
1429
|
+
fontSize: ".6em",
|
|
1430
|
+
defaultStrokeWidth: 3,
|
|
1431
|
+
},
|
|
1432
|
+
small: {
|
|
1433
|
+
width: 40,
|
|
1434
|
+
height: 40,
|
|
1435
|
+
viewBox: "0 0 40 40",
|
|
1436
|
+
fontSize: ".6em",
|
|
1437
|
+
defaultStrokeWidth: 3,
|
|
1438
|
+
},
|
|
1439
|
+
medium: {
|
|
1440
|
+
width: 48,
|
|
1441
|
+
height: 48,
|
|
1442
|
+
viewBox: "0 0 48 48",
|
|
1443
|
+
fontSize: ".8em",
|
|
1444
|
+
defaultStrokeWidth: 5,
|
|
1445
|
+
},
|
|
1446
|
+
large: {
|
|
1447
|
+
width: 72,
|
|
1448
|
+
height: 72,
|
|
1449
|
+
viewBox: "0 0 72 72",
|
|
1450
|
+
fontSize: "1em",
|
|
1451
|
+
defaultStrokeWidth: 5,
|
|
1452
|
+
},
|
|
1453
|
+
huge: {
|
|
1454
|
+
width: 96,
|
|
1455
|
+
height: 96,
|
|
1456
|
+
viewBox: "0 0 96 96",
|
|
1457
|
+
fontSize: "1em",
|
|
1458
|
+
defaultStrokeWidth: 5,
|
|
1459
|
+
},
|
|
1460
|
+
default: {
|
|
1461
|
+
height: 48,
|
|
1462
|
+
width: 48,
|
|
1463
|
+
viewBox: "0 0 48 48",
|
|
1464
|
+
fontSize: ".8em",
|
|
1465
|
+
defaultStrokeWidth: 5,
|
|
1466
|
+
},
|
|
1467
|
+
};
|
|
1424
1468
|
function CircleProgressIcon(_a) {
|
|
1425
|
-
var
|
|
1426
|
-
var iconSizes =
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
viewBox: "0 0 32 32",
|
|
1431
|
-
},
|
|
1432
|
-
small: {
|
|
1433
|
-
width: 40,
|
|
1434
|
-
height: 40,
|
|
1435
|
-
viewBox: "0 0 40 40",
|
|
1436
|
-
},
|
|
1437
|
-
medium: {
|
|
1438
|
-
width: 48,
|
|
1439
|
-
height: 48,
|
|
1440
|
-
viewBox: "0 0 48 48",
|
|
1441
|
-
},
|
|
1442
|
-
large: {
|
|
1443
|
-
width: 72,
|
|
1444
|
-
height: 72,
|
|
1445
|
-
viewBox: "0 0 72 72",
|
|
1446
|
-
},
|
|
1447
|
-
huge: {
|
|
1448
|
-
width: 96,
|
|
1449
|
-
height: 96,
|
|
1450
|
-
viewBox: "0 0 96 96",
|
|
1451
|
-
},
|
|
1452
|
-
default: {
|
|
1453
|
-
height: 48,
|
|
1454
|
-
width: 48,
|
|
1455
|
-
viewBox: "0 0 48 48",
|
|
1456
|
-
},
|
|
1457
|
-
};
|
|
1458
|
-
sqSize = iconSizes[size]["width"];
|
|
1459
|
-
strokeWidth = size === "tiny" || size === "small" ? 3 : 5;
|
|
1460
|
-
var radius = (sqSize - strokeWidth) / 2;
|
|
1461
|
-
// const viewBox = `0 0 ${sqSize} ${sqSize}`;
|
|
1469
|
+
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"]);
|
|
1470
|
+
var _k = iconSizes$9[size], width = _k.width, defaultStrokeWidth = _k.defaultStrokeWidth, fontSize = _k.fontSize; _k.viewBox;
|
|
1471
|
+
strokeWidth = strokeWidth || defaultStrokeWidth;
|
|
1472
|
+
var squareSize = width;
|
|
1473
|
+
var radius = (squareSize - strokeWidth) / 2;
|
|
1462
1474
|
var dashArray = radius * Math.PI * 2;
|
|
1463
|
-
var dashOffset = dashArray - dashArray * percentage / 100;
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1475
|
+
var dashOffset = dashArray - (dashArray * percentage) / 100;
|
|
1476
|
+
var isComplete = percentage === 100;
|
|
1477
|
+
var renderInnerText = useCallback(function () { return (React.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]);
|
|
1478
|
+
var renderCheckMark = useCallback(function () {
|
|
1479
|
+
var preferredViewBox = 40;
|
|
1480
|
+
var scale = squareSize / preferredViewBox;
|
|
1481
|
+
var scaledPath = [
|
|
1482
|
+
{ x: 12.0006 * scale, y: 21.599 * scale },
|
|
1483
|
+
{ x: 17.5629 * scale, y: 27.1617 * scale },
|
|
1484
|
+
{ x: 29.1621 * scale, y: 15.5625 * scale },
|
|
1485
|
+
]
|
|
1486
|
+
.map(function (p) { return "".concat(p.x, ",").concat(p.y); })
|
|
1487
|
+
.join(" L");
|
|
1488
|
+
return (React.createElement("path", { d: "M".concat(scaledPath), stroke: strokeColor, strokeWidth: "".concat(strokeWidth, "px"), fill: "none" }));
|
|
1489
|
+
}, [squareSize, strokeColor, strokeWidth]);
|
|
1490
|
+
return (React.createElement(SVG$1, __assign({ size: size, iconSizes: iconSizes$9, "aria-labelledby": "CircleProgressIcon" }, props),
|
|
1491
|
+
React.createElement("title", { id: "CircleProgressIcon" }, altText || (text ? "".concat(text, " stage") : "".concat(percentage, "% completed"))),
|
|
1492
|
+
React.createElement("circle", { className: "circle-background", cx: squareSize / 2, cy: squareSize / 2, r: radius, strokeWidth: "".concat(strokeWidth, "px"), style: { fill: "none", stroke: colors$1.disabledButtonBorder } }),
|
|
1493
|
+
React.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: {
|
|
1468
1494
|
strokeDasharray: dashArray,
|
|
1469
1495
|
strokeDashoffset: dashOffset,
|
|
1470
|
-
fill:
|
|
1496
|
+
fill: "none",
|
|
1471
1497
|
stroke: strokeColor,
|
|
1472
|
-
strokeLinecap:
|
|
1473
|
-
strokeLinejoin:
|
|
1498
|
+
strokeLinecap: "round",
|
|
1499
|
+
strokeLinejoin: "round",
|
|
1474
1500
|
} }),
|
|
1475
|
-
|
|
1501
|
+
showCheckMarkOnComplete && isComplete
|
|
1502
|
+
? renderCheckMark()
|
|
1503
|
+
: renderInnerText()));
|
|
1476
1504
|
}
|
|
1477
1505
|
|
|
1478
1506
|
var SVG = styled.svg(templateObject_1$Y || (templateObject_1$Y = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), SharedStyles);
|