@commonsku/styles 1.17.22 → 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 +97 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -13
- package/dist/index.mjs +98 -54
- 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/dist/styles/tables/VirtualTable.d.ts +2 -5
- package/dist/styles/tables/VirtualTable.d.ts.map +1 -1
- package/dist/styles/tables/types.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);
|
|
@@ -7175,7 +7203,7 @@ function InputStepper(props) {
|
|
|
7175
7203
|
var templateObject_1$c, templateObject_2$1, templateObject_3, templateObject_4;
|
|
7176
7204
|
|
|
7177
7205
|
var VirtualTable = function (props) {
|
|
7178
|
-
var columns = props.columns, data = props.data, itemSize = props.itemSize, _a = props.height, height = _a === void 0 ? 500 : _a, _b = props.minWidth, minWidth = _b === void 0 ? 140 : _b, _c = props.maxWidth, maxWidth = _c === void 0 ? 500 : _c, defaultSort = props.defaultSort, onClickRow = props.onClickRow, onScroll = props.onScroll, onUpdateData = props.onUpdateData, _d = props.useTableProps, useTableProps = _d === void 0 ? {} : _d, _e = props.tableHeaderProps, tableHeaderProps = _e === void 0 ? {} : _e, _f = props.tableFooterProps, tableFooterProps = _f === void 0 ? {} : _f, _g = props.hideFooter, hideFooter = _g === void 0 ? true : _g, _h = props.hideHeader, hideHeader = _h === void 0 ? false : _h, _j = props.className, className = _j === void 0 ? '' : _j, NoRowsFound = props.NoRowsFound, renderRowSubComponent = props.renderRowSubComponent
|
|
7206
|
+
var columns = props.columns, data = props.data, itemSize = props.itemSize, _a = props.height, height = _a === void 0 ? 500 : _a, _b = props.minWidth, minWidth = _b === void 0 ? 140 : _b, _c = props.maxWidth, maxWidth = _c === void 0 ? 500 : _c, defaultSort = props.defaultSort, onClickRow = props.onClickRow, onScroll = props.onScroll, onUpdateData = props.onUpdateData, _d = props.useTableProps, useTableProps = _d === void 0 ? {} : _d, _e = props.tableHeaderProps, tableHeaderProps = _e === void 0 ? {} : _e, _f = props.tableFooterProps, tableFooterProps = _f === void 0 ? {} : _f, _g = props.hideFooter, hideFooter = _g === void 0 ? true : _g, _h = props.hideHeader, hideHeader = _h === void 0 ? false : _h, _j = props.className, className = _j === void 0 ? '' : _j, NoRowsFound = props.NoRowsFound, renderRowSubComponent = props.renderRowSubComponent; props.onResize; var rowGroupStyles = props.rowGroupStyles, rowStyles = props.rowStyles, _k = props.gutterSize, gutterSize = _k === void 0 ? 0 : _k, _l = props.customTableFooterProps, customTableFooterProps = _l === void 0 ? {} : _l, TableFooter = props.TableFooter, onSortChange = props.onSortChange;
|
|
7179
7207
|
var defaultColumn = React.useMemo(function () { return ({
|
|
7180
7208
|
minWidth: minWidth,
|
|
7181
7209
|
maxWidth: maxWidth,
|
|
@@ -7190,6 +7218,7 @@ var VirtualTable = function (props) {
|
|
|
7190
7218
|
var footerRef = React.useRef(null);
|
|
7191
7219
|
var rowsRef = React.useRef(null);
|
|
7192
7220
|
var listRef = React.useRef(null);
|
|
7221
|
+
var sortBy = tableData.state.sortBy;
|
|
7193
7222
|
function resetList(index) {
|
|
7194
7223
|
if (index === void 0) { index = 0; }
|
|
7195
7224
|
listRef.current && listRef.current.resetAfterIndex(index);
|
|
@@ -7205,8 +7234,7 @@ var VirtualTable = function (props) {
|
|
|
7205
7234
|
var _a;
|
|
7206
7235
|
listRef.current && listRef.current.resetAfterIndex(0);
|
|
7207
7236
|
(_a = column.toggleSortBy) === null || _a === void 0 ? void 0 : _a.call(column);
|
|
7208
|
-
|
|
7209
|
-
}, [onSort]);
|
|
7237
|
+
}, []);
|
|
7210
7238
|
function onListScroll(e) {
|
|
7211
7239
|
if (headerRef.current && e && e.target) {
|
|
7212
7240
|
var target = e.target;
|
|
@@ -7284,11 +7312,27 @@ var VirtualTable = function (props) {
|
|
|
7284
7312
|
setScrolledToBottom(Math.round(rows.scrollTop) >= rows.scrollHeight - rows.offsetHeight);
|
|
7285
7313
|
}
|
|
7286
7314
|
}, [onScroll]);
|
|
7287
|
-
|
|
7288
|
-
|
|
7315
|
+
var renderTableHeader = React.useCallback(function () {
|
|
7316
|
+
var sortIconDirection = function (column) { return column.isSorted
|
|
7317
|
+
? sortDirection(column)
|
|
7318
|
+
: "updown"; };
|
|
7319
|
+
return (React__default.default.createElement("div", __assign({}, tableHeaderProps, { className: "thead ".concat(tableHeaderProps.className || ""), style: __assign(__assign({}, (tableHeaderProps.style || {})), (hideHeader ? { display: "none" } : {})) }), headerGroups.map(function (headerGroup) { return (React__default.default.createElement("div", __assign({}, getHeaderGroupProps(headerGroup, false), { ref: headerRef, style: { width: tableWidth } }), headerGroup.headers.map(function (column) { return (React__default.default.createElement("div", __assign({}, getHeaderProps(column, false), { className: "th", onClick: function () { return handleSort(column); } }),
|
|
7289
7320
|
column.render("Header"),
|
|
7290
|
-
React__default.default.createElement("span", null, column.canSort &&
|
|
7291
|
-
|
|
7321
|
+
React__default.default.createElement("span", null, column.canSort && (React__default.default.createElement(FilledChevronIcon, { direction: sortIconDirection(column), size: "medium", style: { verticalAlign: "middle" } }))))); }))); })));
|
|
7322
|
+
}, [
|
|
7323
|
+
getHeaderGroupProps,
|
|
7324
|
+
getHeaderProps,
|
|
7325
|
+
handleSort,
|
|
7326
|
+
headerGroups,
|
|
7327
|
+
hideHeader,
|
|
7328
|
+
tableHeaderProps,
|
|
7329
|
+
tableWidth,
|
|
7330
|
+
]);
|
|
7331
|
+
React.useEffect(function () {
|
|
7332
|
+
onSortChange && onSortChange({ sortBy: sortBy });
|
|
7333
|
+
}, [sortBy]);
|
|
7334
|
+
return (React__default.default.createElement("div", __assign({}, getTableProps(), { className: "table ".concat(className || '') }),
|
|
7335
|
+
renderTableHeader(),
|
|
7292
7336
|
React__default.default.createElement("div", __assign({ className: "tbody" }, getTableBodyProps()), rows.length === 0 && NoRowsFound ? React__default.default.createElement(NoRowsFound, null) :
|
|
7293
7337
|
React__default.default.createElement("div", { className: "scroll-container" },
|
|
7294
7338
|
!scrolledToTop &&
|