Gazebo_simulation-Frontend/node_modules/.cache/babel-loader/2795c86975bbe5f006a0827cbb63cd3c.json
2020-12-31 20:18:50 +00:00

1 line
4.2 KiB
JSON

{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport React, { cloneElement } from 'react';\nimport { useBootstrapPrefix } from './ThemeProvider';\nimport { map } from './ElementChildren';\nvar ROUND_PRECISION = 1000;\n/**\n * Validate that children, if any, are instances of `<ProgressBar>`.\n */\n\nfunction onlyProgressBar(props, propName, componentName) {\n var children = props[propName];\n\n if (!children) {\n return null;\n }\n\n var error = null;\n React.Children.forEach(children, function (child) {\n if (error) {\n return;\n }\n /**\n * Compare types in a way that works with libraries that patch and proxy\n * components like react-hot-loader.\n *\n * see https://github.com/gaearon/react-hot-loader#checking-element-types\n */\n\n\n var element = React.createElement(ProgressBar, null);\n if (child.type === element.type) return;\n var childIdentifier = React.isValidElement(child) ? child.type.displayName || child.type.name || child.type : child;\n error = new Error(\"Children of \" + componentName + \" can contain only ProgressBar \" + (\"components. Found \" + childIdentifier + \".\"));\n });\n return error;\n}\n\nvar defaultProps = {\n min: 0,\n max: 100,\n animated: false,\n isChild: false,\n srOnly: false,\n striped: false\n};\n\nfunction getPercentage(now, min, max) {\n var percentage = (now - min) / (max - min) * 100;\n return Math.round(percentage * ROUND_PRECISION) / ROUND_PRECISION;\n}\n\nfunction renderProgressBar(_ref, ref) {\n var _classNames;\n\n var min = _ref.min,\n now = _ref.now,\n max = _ref.max,\n label = _ref.label,\n srOnly = _ref.srOnly,\n striped = _ref.striped,\n animated = _ref.animated,\n className = _ref.className,\n style = _ref.style,\n variant = _ref.variant,\n bsPrefix = _ref.bsPrefix,\n props = _objectWithoutPropertiesLoose(_ref, [\"min\", \"now\", \"max\", \"label\", \"srOnly\", \"striped\", \"animated\", \"className\", \"style\", \"variant\", \"bsPrefix\"]);\n\n return React.createElement(\"div\", _extends({\n ref: ref\n }, props, {\n role: \"progressbar\",\n className: classNames(className, bsPrefix + \"-bar\", (_classNames = {}, _classNames[\"bg-\" + variant] = variant, _classNames[bsPrefix + \"-bar-animated\"] = animated, _classNames[bsPrefix + \"-bar-striped\"] = animated || striped, _classNames)),\n style: _extends({\n width: getPercentage(now, min, max) + \"%\"\n }, style),\n \"aria-valuenow\": now,\n \"aria-valuemin\": min,\n \"aria-valuemax\": max\n }), srOnly ? React.createElement(\"span\", {\n className: \"sr-only\"\n }, label) : label);\n}\n\nvar ProgressBar = React.forwardRef(function (_ref2, ref) {\n var isChild = _ref2.isChild,\n props = _objectWithoutPropertiesLoose(_ref2, [\"isChild\"]);\n\n props.bsPrefix = useBootstrapPrefix(props.bsPrefix, 'progress');\n\n if (isChild) {\n return renderProgressBar(props, ref);\n }\n\n var min = props.min,\n now = props.now,\n max = props.max,\n label = props.label,\n srOnly = props.srOnly,\n striped = props.striped,\n animated = props.animated,\n bsPrefix = props.bsPrefix,\n variant = props.variant,\n className = props.className,\n children = props.children,\n wrapperProps = _objectWithoutPropertiesLoose(props, [\"min\", \"now\", \"max\", \"label\", \"srOnly\", \"striped\", \"animated\", \"bsPrefix\", \"variant\", \"className\", \"children\"]);\n\n return React.createElement(\"div\", _extends({\n ref: ref\n }, wrapperProps, {\n className: classNames(className, bsPrefix)\n }), children ? map(children, function (child) {\n return cloneElement(child, {\n isChild: true\n });\n }) : renderProgressBar({\n min: min,\n now: now,\n max: max,\n label: label,\n srOnly: srOnly,\n striped: striped,\n animated: animated,\n bsPrefix: bsPrefix,\n variant: variant\n }, ref));\n});\nProgressBar.displayName = 'ProgressBar';\nProgressBar.defaultProps = defaultProps;\nexport default ProgressBar;","map":null,"metadata":{},"sourceType":"module"}