UNPKG

primereact

Version:

PrimeReact is an open source UI library for React featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with Prime

2 lines (1 loc) 6.7 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("primereact/api"),n=require("primereact/componentbase"),t=require("primereact/hooks"),a=require("primereact/utils");function i(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}})),r.default=e,Object.freeze(r)}var o=i(e);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},s.apply(null,arguments)}function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function u(e,r){if("object"!=l(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var t=n.call(e,r||"default");if("object"!=l(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function p(e){var r=u(e,"string");return"symbol"==l(r)?r:r+""}function c(e,r,n){return(r=p(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var m=n.ComponentBase.extend({defaultProps:{__TYPE:"ProgressBar",__parentMetadata:null,id:null,value:null,showValue:!0,unit:"%",style:null,className:null,mode:"determinate",displayValueTemplate:null,color:null,children:void 0},css:{classes:{root:function(e){return a.classNames("indeterminate"===e.props.mode?"p-progressbar p-component p-progressbar-indeterminate":"p-progressbar p-component p-progressbar-determinate")},value:"p-progressbar-value p-progressbar-value-animate",label:"p-progressbar-label",container:"p-progressbar-indeterminate-container"},styles:"\n@layer primereact {\n .p-progressbar {\n position: relative;\n overflow: hidden;\n }\n \n .p-progressbar-determinate .p-progressbar-value {\n height: 100%;\n width: 0%;\n position: absolute;\n display: none;\n border: 0 none;\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n }\n \n .p-progressbar-determinate .p-progressbar-label {\n display: inline-flex;\n }\n \n .p-progressbar-determinate .p-progressbar-value-animate {\n transition: width 1s ease-in-out;\n }\n \n .p-progressbar-indeterminate .p-progressbar-value::before {\n content: '';\n position: absolute;\n background-color: inherit;\n top: 0;\n left: 0;\n bottom: 0;\n will-change: left, right;\n -webkit-animation: p-progressbar-indeterminate-anim 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;\n animation: p-progressbar-indeterminate-anim 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;\n }\n \n .p-progressbar-indeterminate .p-progressbar-value::after {\n content: '';\n position: absolute;\n background-color: inherit;\n top: 0;\n left: 0;\n bottom: 0;\n will-change: left, right;\n -webkit-animation: p-progressbar-indeterminate-anim-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;\n animation: p-progressbar-indeterminate-anim-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;\n -webkit-animation-delay: 1.15s;\n animation-delay: 1.15s;\n }\n}\n\n@-webkit-keyframes p-progressbar-indeterminate-anim {\n 0% {\n left: -35%;\n right: 100%; }\n 60% {\n left: 100%;\n right: -90%; }\n 100% {\n left: 100%;\n right: -90%; }\n}\n@keyframes p-progressbar-indeterminate-anim {\n 0% {\n left: -35%;\n right: 100%; }\n 60% {\n left: 100%;\n right: -90%; }\n 100% {\n left: 100%;\n right: -90%; }\n}\n\n@-webkit-keyframes p-progressbar-indeterminate-anim-short {\n 0% {\n left: -200%;\n right: 100%; }\n 60% {\n left: 107%;\n right: -8%; }\n 100% {\n left: 107%;\n right: -8%; }\n}\n@keyframes p-progressbar-indeterminate-anim-short {\n 0% {\n left: -200%;\n right: 100%; }\n 60% {\n left: 107%;\n right: -8%; }\n 100% {\n left: 107%;\n right: -8%; }\n}\n",inlineStyles:{value:function(e){var r=e.props,n=Math.max(r.value,2);return"indeterminate"===r.mode?{backgroundColor:r.color}:{width:n+"%",display:"flex",backgroundColor:r.value?r.color:"transparent"}}}}});function b(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function f(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?b(Object(n),!0).forEach((function(r){c(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}var d=o.memo(o.forwardRef((function(e,i){var l=t.useMergeProps(),u=o.useContext(r.PrimeReactContext),p=m.getProps(e,u),c=m.setMetaData(f({props:p},p.__parentMetadata)),b=c.ptm,d=c.cx;n.useHandleStyle(m.css.styles,c.isUnstyled,{name:"progressbar"});var g,v,y,h,w=o.useRef(null);if(o.useImperativeHandle(i,(function(){return{props:p,getElement:function(){return w.current}}})),"determinate"===p.mode)return g=p.showValue&&null!=p.value?p.displayValueTemplate?p.displayValueTemplate(p.value):p.value+p.unit:null,v=l({className:a.classNames(p.className,d("root")),style:p.style,role:"progressbar","aria-valuemin":"0","aria-valuenow":p.value,"aria-valuemax":"100"},m.getOtherProps(p),b("root")),y=l({className:d("value"),style:{width:p.value+"%",display:"flex",backgroundColor:p.color}},b("value")),h=l({className:d("label")},b("label")),o.createElement("div",s({id:p.id,ref:w},v),o.createElement("div",y,null!=g&&o.createElement("div",h,g)));if("indeterminate"===p.mode)return function(){var e=l({className:a.classNames(p.className,d("root")),style:p.style,role:"progressbar","aria-valuemin":"0","aria-valuenow":p.value,"aria-valuemax":"100"},m.getOtherProps(p),b("root")),r=l({className:d("container")},b("container")),n=l({className:d("value"),style:{backgroundColor:p.color}},b("value"));return o.createElement("div",s({id:p.id,ref:w},e),o.createElement("div",r,o.createElement("div",n)))}();throw new Error(p.mode+" is not a valid mode for the ProgressBar. Valid values are 'determinate' and 'indeterminate'")})));d.displayName="ProgressBar",exports.ProgressBar=d;