@kodiak-ui/progress
Advanced tools
Comparing version 0.2.8 to 0.2.9
@@ -1,11 +0,1 @@ | ||
// are you seeing an error that a default export doesn't exist but your source file has a default export? | ||
// you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook | ||
// curious why you need to? | ||
// this file exists so that you can import from the entrypoint normally | ||
// except that it points to your source file and you don't need to run build constantly | ||
// which means we need to re-export all of the modules from your source file | ||
// and since export * doesn't include default exports, we need to read your source file | ||
// to check for a default export and re-export it if it exists | ||
// it's not ideal, but it works pretty well ¯\_(ツ)_/¯ | ||
export * from "../src/index"; | ||
export * from "./declarations/src/index"; |
@@ -1,16 +0,7 @@ | ||
"use strict"; | ||
// this file might look strange and you might be wondering what it's for | ||
// it's lets you import your source files by importing this entrypoint | ||
// as you would import it if it was built with preconstruct build | ||
// this file is slightly different to some others though | ||
// it has a require hook which compiles your code with Babel | ||
// this means that you don't have to set up @babel/register or anything like that | ||
// but you can still require this module and it'll be compiled | ||
'use strict'; | ||
// this bit of code imports the require hook and registers it | ||
let unregister = require("../../../node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../..", ".."); | ||
// this re-exports the source file | ||
module.exports = require("../src/index.ts"); | ||
unregister(); | ||
if (process.env.NODE_ENV === "production") { | ||
module.exports = require("./progress.cjs.prod.js"); | ||
} else { | ||
module.exports = require("./progress.cjs.dev.js"); | ||
} |
@@ -1,15 +0,191 @@ | ||
// 👋 hey!! | ||
// you might be reading this and seeing .esm in the filename | ||
// and being confused why there is commonjs below this filename | ||
// DON'T WORRY! | ||
// this is intentional | ||
// it's only commonjs with `preconstruct dev` | ||
// when you run `preconstruct build`, it will be ESM | ||
// why is it commonjs? | ||
// we need to re-export every export from the source file | ||
// but we can't do that with ESM without knowing what the exports are (because default exports aren't included in export/import *) | ||
// and they could change after running `preconstruct dev` so we can't look at the file without forcing people to | ||
// run preconstruct dev again which wouldn't be ideal | ||
// this solution could change but for now, it's working | ||
import { createElement } from 'react'; | ||
import { Box } from '@kodiak-ui/primitives/box'; | ||
import { useMeasure } from '@kodiak-ui/hooks/use-measure'; | ||
module.exports = require("../src/index.ts") | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
return target; | ||
} | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _objectWithoutPropertiesLoose(source, excluded); | ||
var key, i; | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) { | ||
key = sourceSymbolKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; | ||
target[key] = source[key]; | ||
} | ||
} | ||
return target; | ||
} | ||
function Progress(_ref) { | ||
var value = _ref.value, | ||
_ref$min = _ref.min, | ||
min = _ref$min === void 0 ? 0 : _ref$min, | ||
_ref$max = _ref.max, | ||
max = _ref$max === void 0 ? 100 : _ref$max, | ||
_ref$color = _ref.color, | ||
color = _ref$color === void 0 ? 'primary' : _ref$color, | ||
_ref$containerVariant = _ref.containerVariant, | ||
containerVariant = _ref$containerVariant === void 0 ? 'container' : _ref$containerVariant, | ||
_ref$barVariant = _ref.barVariant, | ||
barVariant = _ref$barVariant === void 0 ? 'bar' : _ref$barVariant, | ||
children = _ref.children, | ||
progressSx = _ref.progressSx, | ||
props = _objectWithoutProperties(_ref, ["value", "min", "max", "color", "containerVariant", "barVariant", "children", "progressSx"]); | ||
var progressWidth = (value - min) * 100 / (max - min); | ||
return /*#__PURE__*/createElement(Box, _extends({ | ||
__base: { | ||
bg: 'muted', | ||
borderRadius: 'default', | ||
height: '12px' | ||
}, | ||
variant: containerVariant, | ||
variantKey: "progresses" | ||
}, props), /*#__PURE__*/createElement(Box, { | ||
__base: { | ||
bg: color, | ||
height: '100%', | ||
transition: 'all 0.2s ease-in-out 0s', | ||
position: 'relative', | ||
width: "".concat(progressWidth > 100 ? 100 : progressWidth < 0 ? 0 : progressWidth, "%") | ||
}, | ||
role: "progressbar", | ||
"aria-valuenow": value, | ||
"aria-valuemin": min, | ||
"aria-valuemax": max, | ||
variant: barVariant, | ||
variantKey: "progresses", | ||
sx: progressSx | ||
}, children)); | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
try { | ||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"] != null) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
} | ||
function ProgressThumb(_ref) { | ||
var value = _ref.value, | ||
min = _ref.min, | ||
max = _ref.max, | ||
_ref$variant = _ref.variant, | ||
variant = _ref$variant === void 0 ? 'thumb' : _ref$variant, | ||
_ref$variantKey = _ref.variantKey, | ||
variantKey = _ref$variantKey === void 0 ? 'progresses' : _ref$variantKey, | ||
children = _ref.children, | ||
props = _objectWithoutProperties(_ref, ["value", "min", "max", "variant", "variantKey", "children"]); | ||
var _useMeasure = useMeasure(), | ||
_useMeasure2 = _slicedToArray(_useMeasure, 2), | ||
bind = _useMeasure2[0], | ||
width = _useMeasure2[1].width; | ||
return /*#__PURE__*/createElement(Box, _extends({}, bind, { | ||
__base: { | ||
bg: 'white', | ||
border: '1px solid', | ||
borderColor: 'muted', | ||
borderRadius: 'default', | ||
left: min && value <= min ? 0 : max && value >= max ? 'auto' : "calc(100% - ".concat(width / 2, "px)"), | ||
lineHeight: 1, | ||
p: 2, | ||
position: 'absolute', | ||
right: max && value >= max ? '0' : 'auto', | ||
top: '50%', | ||
transform: 'translateY(-50%)' | ||
}, | ||
variant: variant, | ||
variantKey: variantKey | ||
}, props), children ? children : value); | ||
} | ||
export { Progress, ProgressThumb }; |
{ | ||
"name": "@kodiak-ui/progress", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"description": "Kodiak UI's progress bar component", | ||
@@ -28,4 +28,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@kodiak-ui/hooks": "^0.14.19", | ||
"@kodiak-ui/primitives": "^0.20.3" | ||
"@kodiak-ui/hooks": "^0.14.20", | ||
"@kodiak-ui/primitives": "^0.20.4" | ||
}, | ||
@@ -36,3 +36,3 @@ "repository": { | ||
}, | ||
"gitHead": "8d3eb8dda094293a4dcc5c808d1d55e64093517e" | ||
"gitHead": "b0bef5c41d50bc778da04233f0f02b1fc63b2f0c" | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
20348
11
483
1
Updated@kodiak-ui/hooks@^0.14.20