@highlight-ui/circular-progress
Advanced tools
Comparing version 2.0.1 to 2.0.2
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
var React = require('react'); | ||
var colorTokens = require('@highlight-ui/tokens/dist/colors.json'); | ||
var utilsCommons = require('@highlight-ui/utils-commons'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
function _interopDefaultLegacy(e) { | ||
return e && typeof e === 'object' && 'default' in e ? e : { | ||
'default': e | ||
}; | ||
} | ||
function _interopNamespace(e) { | ||
if (e && e.__esModule) return e; | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
if (e && e.__esModule) return e; | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { | ||
return e[k]; | ||
} | ||
}); | ||
} | ||
n["default"] = e; | ||
return Object.freeze(n); | ||
} | ||
}); | ||
} | ||
n["default"] = e; | ||
return Object.freeze(n); | ||
} | ||
var React__namespace = /*#__PURE__*/_interopNamespace(React); | ||
var colorTokens__default = /*#__PURE__*/_interopDefaultLegacy(colorTokens); | ||
/*! ***************************************************************************** | ||
@@ -47,15 +59,21 @@ Copyright (c) Microsoft Corporation. | ||
var __assign = function() { | ||
__assign = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
var __assign = function () { | ||
__assign = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var styles = {"circle":"CircularProgress-module__3NB5eWuu__v2-0-1","progressIndicator":"CircularProgress-module__He07toFd__v2-0-1"}; | ||
var styles = { | ||
"circle": "CircularProgress-module__3NB5eWuu__v2-0-2", | ||
"progressIndicator": "CircularProgress-module__He07toFd__v2-0-2" | ||
}; | ||
var WIDTH = 22; | ||
@@ -66,20 +84,47 @@ var STROKE_WIDTH = 3; | ||
var CIRCUMFERENCE = RADIUS * Math.PI * 2; // dashlength should cover the whole circumference of the circle | ||
function CircularProgressWithRef(_a, ref) { | ||
var metadata = _a.metadata, percentage = _a.percentage, color = _a.color; | ||
var percentageNum = Math.abs(Number(percentage)); | ||
var finalPercentage = percentageNum > 100 ? 100 : percentageNum; | ||
var dashOffset = CIRCUMFERENCE - (CIRCUMFERENCE * finalPercentage) / 100; // Scale 100% coverage overlay with the actual percent | ||
var halfWidth = WIDTH / 2; | ||
return (React__namespace.createElement("div", { "aria-valuemax": 100, "aria-valuemin": 0, "aria-valuenow": percentageNum, role: "progressbar", ref: ref }, | ||
React__namespace.createElement("svg", __assign({}, utilsCommons.parseMetadata(metadata), { width: WIDTH, height: WIDTH, viewBox: VIEWBOX }), | ||
React__namespace.createElement("circle", { className: styles.circle, cx: halfWidth, cy: halfWidth, r: RADIUS, strokeWidth: STROKE_WIDTH + "px", fill: "none" }), | ||
React__namespace.createElement("circle", { className: styles.progressIndicator, cx: halfWidth, cy: halfWidth, r: RADIUS, fill: "none", strokeWidth: STROKE_WIDTH + "px", transform: "rotate(-90 " + halfWidth + " " + halfWidth + ")", style: { | ||
stroke: color && colorTokens__default["default"][color], | ||
strokeDasharray: CIRCUMFERENCE, | ||
strokeDashoffset: dashOffset, | ||
} })))); | ||
var metadata = _a.metadata, | ||
percentage = _a.percentage, | ||
color = _a.color; | ||
var percentageNum = Math.abs(Number(percentage)); | ||
var finalPercentage = percentageNum > 100 ? 100 : percentageNum; | ||
var dashOffset = CIRCUMFERENCE - CIRCUMFERENCE * finalPercentage / 100; // Scale 100% coverage overlay with the actual percent | ||
var halfWidth = WIDTH / 2; | ||
return React__namespace.createElement("div", { | ||
"aria-valuemax": 100, | ||
"aria-valuemin": 0, | ||
"aria-valuenow": percentageNum, | ||
role: "progressbar", | ||
ref: ref | ||
}, React__namespace.createElement("svg", __assign({}, utilsCommons.parseMetadata(metadata), { | ||
width: WIDTH, | ||
height: WIDTH, | ||
viewBox: VIEWBOX | ||
}), React__namespace.createElement("circle", { | ||
className: styles.circle, | ||
cx: halfWidth, | ||
cy: halfWidth, | ||
r: RADIUS, | ||
strokeWidth: STROKE_WIDTH + "px", | ||
fill: "none" | ||
}), React__namespace.createElement("circle", { | ||
className: styles.progressIndicator, | ||
cx: halfWidth, | ||
cy: halfWidth, | ||
r: RADIUS, | ||
fill: "none", | ||
strokeWidth: STROKE_WIDTH + "px", | ||
transform: "rotate(-90 " + halfWidth + " " + halfWidth + ")", | ||
style: { | ||
stroke: color && colorTokens__default["default"][color], | ||
strokeDasharray: CIRCUMFERENCE, | ||
strokeDashoffset: dashOffset | ||
} | ||
}))); | ||
} | ||
var CircularProgress = React__namespace.forwardRef(CircularProgressWithRef); | ||
exports.CircularProgress = CircularProgress; | ||
//# sourceMappingURL=index.js.map |
@@ -1,56 +0,2 @@ | ||
import * as React from 'react'; | ||
import colorTokens from '@highlight-ui/tokens/dist/colors.json'; | ||
import { parseMetadata } from '@highlight-ui/utils-commons'; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
var __assign = function() { | ||
__assign = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var styles = {"circle":"CircularProgress-module__3NB5eWuu__v2-0-1","progressIndicator":"CircularProgress-module__He07toFd__v2-0-1"}; | ||
var WIDTH = 22; | ||
var STROKE_WIDTH = 3; | ||
var RADIUS = (WIDTH - STROKE_WIDTH * 2) / 2; | ||
var VIEWBOX = "0 0 " + WIDTH + " " + WIDTH; | ||
var CIRCUMFERENCE = RADIUS * Math.PI * 2; // dashlength should cover the whole circumference of the circle | ||
function CircularProgressWithRef(_a, ref) { | ||
var metadata = _a.metadata, percentage = _a.percentage, color = _a.color; | ||
var percentageNum = Math.abs(Number(percentage)); | ||
var finalPercentage = percentageNum > 100 ? 100 : percentageNum; | ||
var dashOffset = CIRCUMFERENCE - (CIRCUMFERENCE * finalPercentage) / 100; // Scale 100% coverage overlay with the actual percent | ||
var halfWidth = WIDTH / 2; | ||
return (React.createElement("div", { "aria-valuemax": 100, "aria-valuemin": 0, "aria-valuenow": percentageNum, role: "progressbar", ref: ref }, | ||
React.createElement("svg", __assign({}, parseMetadata(metadata), { width: WIDTH, height: WIDTH, viewBox: VIEWBOX }), | ||
React.createElement("circle", { className: styles.circle, cx: halfWidth, cy: halfWidth, r: RADIUS, strokeWidth: STROKE_WIDTH + "px", fill: "none" }), | ||
React.createElement("circle", { className: styles.progressIndicator, cx: halfWidth, cy: halfWidth, r: RADIUS, fill: "none", strokeWidth: STROKE_WIDTH + "px", transform: "rotate(-90 " + halfWidth + " " + halfWidth + ")", style: { | ||
stroke: color && colorTokens[color], | ||
strokeDasharray: CIRCUMFERENCE, | ||
strokeDashoffset: dashOffset, | ||
} })))); | ||
} | ||
var CircularProgress = React.forwardRef(CircularProgressWithRef); | ||
export { CircularProgress }; | ||
export { default as CircularProgress } from './src/CircularProgress.js'; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@highlight-ui/circular-progress", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"author": "Personio GmbH", | ||
@@ -14,2 +14,5 @@ "main": "dist/cjs/index.js", | ||
], | ||
"sideEffects": [ | ||
"*.css" | ||
], | ||
"description": "", | ||
@@ -29,3 +32,3 @@ "license": "MIT", | ||
"@highlight-ui/configs-base-tsconfig": "^3.0.0", | ||
"@highlight-ui/configs-scripts": "^2.0.2", | ||
"@highlight-ui/configs-scripts": "^3.0.0", | ||
"@highlight-ui/theme": "^9.0.0", | ||
@@ -42,3 +45,3 @@ "@highlight-ui/tokens": "^1.0.0", | ||
"dependencies": { | ||
"@highlight-ui/utils-commons": "^2.0.0" | ||
"@highlight-ui/utils-commons": "^2.0.1" | ||
}, | ||
@@ -49,3 +52,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "361a91cf452ef26cb47c4f7c7297cd4f5a492cf8" | ||
"gitHead": "474df2a9e71b9adb4c972cf23341809d7abfd2e5" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
19
272
52403