Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hig/progress-bar

Package Overview
Dependencies
Maintainers
5
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hig/progress-bar - npm Package Compare versions

Comparing version 0.2.0-alpha.2eb35b95 to 0.2.0-alpha.48865d3c

109

build/index.es.js

@@ -1,5 +0,110 @@

import { ProgressBar } from 'hig-react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
ProgressBar.displayName = "ProgressBar";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* @param {Number} percent, an integer or float
* @returns {Integer}
*/
var renderedBarWidth = function renderedBarWidth(percent) {
var percentageWidth = parseInt(percent, 10);
if (!percentageWidth) {
return null;
}
if (percentageWidth >= 100) {
return 101;
}
return percentageWidth;
};
var ProgressBar = function (_Component) {
_inherits(ProgressBar, _Component);
function ProgressBar() {
_classCallCheck(this, ProgressBar);
return _possibleConstructorReturn(this, (ProgressBar.__proto__ || Object.getPrototypeOf(ProgressBar)).apply(this, arguments));
}
_createClass(ProgressBar, [{
key: "fillBarStyles",
value: function fillBarStyles() {
var barWidth = renderedBarWidth(this.props.percentComplete);
return barWidth ? { width: barWidth + "%" } : {};
}
}, {
key: "render",
value: function render() {
var percentComplete = this.props.percentComplete;
var progressBarClasses = cx("hig__progress-bar", {
"hig__progress-bar--determinate": percentComplete
});
return React.createElement(
"div",
{
className: progressBarClasses,
role: "progressbar",
"aria-valuemin": "0",
"aria-valuemax": "100",
"aria-valuenow": percentComplete
},
React.createElement(
"div",
{ className: "hig__progress-bar__bar", style: this.fillBarStyles() },
React.createElement("div", { className: "hig__progress-bar__fill" }),
React.createElement(
"svg",
{
width: "3px",
height: "4px",
viewBox: "0 0 3 4",
version: "1.1",
xmlns: "http://www.w3.org/2000/svg",
xmlnsXlink: "http://www.w3.org/1999/xlink"
},
React.createElement("polygon", {
id: "end-right",
points: "0 0 2.68 0 1 4 0 4",
fill: "#0ED3BE"
})
)
)
);
}
}]);
return ProgressBar;
}(Component);
ProgressBar.propTypes = {
/**
* A number from 0 to 100 representing the percent the delayed operation has completed
*/
percentComplete: PropTypes.number
};
ProgressBar.__docgenInfo = {
"description": "",
"displayName": "ProgressBar",
"props": {
"percentComplete": {
"type": {
"name": "number"
},
"required": false,
"description": "A number from 0 to 100 representing the percent the delayed operation has completed"
}
}
};
export default ProgressBar;

@@ -5,6 +5,114 @@ 'use strict';

var higReact = require('hig-react');
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
higReact.ProgressBar.displayName = "ProgressBar";
var React = require('react');
var React__default = _interopDefault(React);
var PropTypes = _interopDefault(require('prop-types'));
var cx = _interopDefault(require('classnames'));
exports.default = higReact.ProgressBar;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* @param {Number} percent, an integer or float
* @returns {Integer}
*/
var renderedBarWidth = function renderedBarWidth(percent) {
var percentageWidth = parseInt(percent, 10);
if (!percentageWidth) {
return null;
}
if (percentageWidth >= 100) {
return 101;
}
return percentageWidth;
};
var ProgressBar = function (_Component) {
_inherits(ProgressBar, _Component);
function ProgressBar() {
_classCallCheck(this, ProgressBar);
return _possibleConstructorReturn(this, (ProgressBar.__proto__ || Object.getPrototypeOf(ProgressBar)).apply(this, arguments));
}
_createClass(ProgressBar, [{
key: "fillBarStyles",
value: function fillBarStyles() {
var barWidth = renderedBarWidth(this.props.percentComplete);
return barWidth ? { width: barWidth + "%" } : {};
}
}, {
key: "render",
value: function render() {
var percentComplete = this.props.percentComplete;
var progressBarClasses = cx("hig__progress-bar", {
"hig__progress-bar--determinate": percentComplete
});
return React__default.createElement(
"div",
{
className: progressBarClasses,
role: "progressbar",
"aria-valuemin": "0",
"aria-valuemax": "100",
"aria-valuenow": percentComplete
},
React__default.createElement(
"div",
{ className: "hig__progress-bar__bar", style: this.fillBarStyles() },
React__default.createElement("div", { className: "hig__progress-bar__fill" }),
React__default.createElement(
"svg",
{
width: "3px",
height: "4px",
viewBox: "0 0 3 4",
version: "1.1",
xmlns: "http://www.w3.org/2000/svg",
xmlnsXlink: "http://www.w3.org/1999/xlink"
},
React__default.createElement("polygon", {
id: "end-right",
points: "0 0 2.68 0 1 4 0 4",
fill: "#0ED3BE"
})
)
)
);
}
}]);
return ProgressBar;
}(React.Component);
ProgressBar.propTypes = {
/**
* A number from 0 to 100 representing the percent the delayed operation has completed
*/
percentComplete: PropTypes.number
};
ProgressBar.__docgenInfo = {
"description": "",
"displayName": "ProgressBar",
"props": {
"percentComplete": {
"type": {
"name": "number"
},
"required": false,
"description": "A number from 0 to 100 representing the percent the delayed operation has completed"
}
}
};
exports.default = ProgressBar;

16

package.json
{
"name": "@hig/progress-bar",
"version": "0.2.0-alpha.2eb35b95",
"version": "0.2.0-alpha.48865d3c",
"description": "HIG Progress Bar",

@@ -22,5 +22,3 @@ "author": "Autodesk Inc.",

"classnames": "^2.2.5",
"hig-react": "0.30.0-alpha.2eb35b95",
"prop-types": "^15.6.1",
"react-lifecycles-compat": "^3.0.2"
"prop-types": "^15.6.1"
},

@@ -31,7 +29,7 @@ "peerDependencies": {

"devDependencies": {
"@hig/babel-preset": "0.2.0-alpha.2eb35b95",
"@hig/eslint-config": "0.2.0-alpha.2eb35b95",
"@hig/scripts": "0.2.0-alpha.2eb35b95",
"@hig/semantic-release-config": "0.2.0-alpha.2eb35b95",
"@hig/styles": "0.2.0-alpha.2eb35b95"
"@hig/babel-preset": "0.2.0-alpha.48865d3c",
"@hig/eslint-config": "0.2.0-alpha.48865d3c",
"@hig/scripts": "0.2.0-alpha.48865d3c",
"@hig/semantic-release-config": "0.2.0-alpha.48865d3c",
"@hig/styles": "^0.1.1"
},

@@ -38,0 +36,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc