@iqmo/browser
Version:
Browser Stlite
3 lines (2 loc) • 13.3 kB
JavaScript
import{c2 as p,cP as ke,cQ as E,R as V,r as u,c3 as P,ao as Le,j as je,cx as xe}from"./index-0xtYjrTa.js";var h={small:"small",medium:"medium",large:"large"},$;function B(){return B=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},B.apply(this,arguments)}function ne(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,t)}return n}function R(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?ne(Object(n),!0).forEach(function(t){w(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ne(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function w(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function oe(e){var r;return(r={},w(r,h.small,"2px"),w(r,h.medium,"4px"),w(r,h.large,"8px"),r)[e]}var A=p("div",function(e){return{width:"100%"}});A.displayName="StyledRoot",A.displayName="StyledRoot";var M=p("div",function(e){var r=e.$theme,n=r.sizing;return{display:"flex",marginLeft:n.scale500,marginRight:n.scale500,marginTop:n.scale500,marginBottom:n.scale500}});M.displayName="StyledBarContainer",M.displayName="StyledBarContainer";var _=p("div",function(e){var r=e.$theme,n=e.$size,t=e.$steps,o=r.colors,a=r.sizing,s=r.borders,i=s.useRoundedCorners?a.scale0:0;return R({borderTopLeftRadius:i,borderTopRightRadius:i,borderBottomRightRadius:i,borderBottomLeftRadius:i,backgroundColor:ke(o.progressbarTrackFill,"0.16"),height:oe(n),flex:1,overflow:"hidden"},t<2?{}:{marginLeft:a.scale300,":first-child":{marginLeft:"0"}})});_.displayName="StyledBar",_.displayName="StyledBar";var I=p("div",function(e){var r=e.$theme,n=e.$value,t=e.$successValue,o=e.$steps,a=e.$index,s=e.$maxValue,i=e.$minValue,c=i===void 0?0:i,d=s||t,O=r.colors,y=r.sizing,k=r.borders,T="".concat(100-(n-c)*100/(d-c),"%"),l={default:"default",awaits:"awaits",inProgress:"inProgress",completed:"completed"},b=l.default;if(o>1){var X=(d-c)/o,z=(n-c)/(d-c)*100,L=Math.floor(z/X);a<L?b=l.completed:a===L?b=l.inProgress:b=l.awaits}var g=k.useRoundedCorners?y.scale0:0,N={transform:"translateX(-".concat(T,")")},j=b===l.inProgress?{animationDuration:"2.1s",animationIterationCount:"infinite",animationTimingFunction:r.animation.linearCurve,animationName:{"0%":{transform:"translateX(-102%)",opacity:1},"50%":{transform:"translateX(0%)",opacity:1},"100%":{transform:"translateX(0%)",opacity:0}}}:b===l.completed?{transform:"translateX(0%)"}:{transform:"translateX(-102%)"};return R({borderTopLeftRadius:g,borderTopRightRadius:g,borderBottomRightRadius:g,borderBottomLeftRadius:g,backgroundColor:O.accent,height:"100%",width:"100%",transform:"translateX(-102%)",transition:"transform 0.5s"},o>1?j:N)});I.displayName="StyledBarProgress",I.displayName="StyledBarProgress";var D=p("div",function(e){var r=e.$theme,n=e.$isLeft,t=n===void 0?!1:n,o=e.$size,a=o===void 0?h.medium:o,s=r.colors,i=r.sizing,c=r.borders,d=c.useRoundedCorners?i.scale0:0,O=oe(a),y={display:"inline-block",flex:1,marginLeft:"auto",marginRight:"auto",transitionProperty:"background-position",animationDuration:"1.5s",animationIterationCount:"infinite",animationTimingFunction:r.animation.linearCurve,backgroundSize:"300% auto",backgroundRepeat:"no-repeat",backgroundPositionX:t?"-50%":"150%",backgroundImage:"linear-gradient(".concat(t?"90":"270","deg, transparent 0%, ").concat(s.accent," 25%, ").concat(s.accent," 75%, transparent 100%)"),animationName:t?{"0%":{backgroundPositionX:"-50%"},"33%":{backgroundPositionX:"50%"},"66%":{backgroundPositionX:"50%"},"100%":{backgroundPositionX:"150%"}}:{"0%":{backgroundPositionX:"150%"},"33%":{backgroundPositionX:"50%"},"66%":{backgroundPositionX:"50%"},"100%":{backgroundPositionX:"-50%"}}};return R(R({},t?{borderTopLeftRadius:d,borderBottomLeftRadius:d}:{borderTopRightRadius:d,borderBottomRightRadius:d}),{},{height:O},y)});D.displayName="StyledInfiniteBar",D.displayName="StyledInfiniteBar";var H=p("div",function(e){return R(R({textAlign:"center"},e.$theme.typography.font150),{},{color:e.$theme.colors.contentTertiary})});H.displayName="StyledLabel",H.displayName="StyledLabel";var f=($={},w($,h.large,{d:"M47.5 4H71.5529C82.2933 4 91 12.9543 91 24C91 35.0457 82.2933 44 71.5529 44H23.4471C12.7067 44 4 35.0457 4 24C4 12.9543 12.7067 4 23.4471 4H47.5195",width:95,height:48,strokeWidth:8,typography:"LabelLarge"}),w($,h.medium,{d:"M39 2H60.5833C69.0977 2 76 9.16344 76 18C76 26.8366 69.0977 34 60.5833 34H17.4167C8.90228 34 2 26.8366 2 18C2 9.16344 8.90228 2 17.4167 2H39.0195",width:78,height:36,strokeWidth:4,typography:"LabelMedium"}),w($,h.small,{d:"M32 1H51.6271C57.9082 1 63 6.37258 63 13C63 19.6274 57.9082 25 51.6271 25H12.3729C6.09181 25 1 19.6274 1 13C1 6.37258 6.09181 1 12.3729 1H32.0195",width:64,height:26,strokeWidth:2,typography:"LabelSmall"}),$),ae=p("div",function(e){var r=e.$size,n=e.$inline;return{width:f[r].width+"px",height:f[r].height+"px",position:"relative",display:n?"inline-flex":"flex",alignItems:"center",justifyContent:"center"}});ae.displayName="StyledProgressBarRoundedRoot",ae.displayName="StyledProgressBarRoundedRoot";var F=p("svg",function(e){var r=e.$size;return{width:f[r].width+"px",height:f[r].height+"px",position:"absolute",fill:"none"}});F.displayName="_StyledProgressBarRoundedSvg",F.displayName="_StyledProgressBarRoundedSvg",E(F,function(e){return function(r){return V.createElement(e,B({viewBox:"0 0 ".concat(f[r.$size].width," ").concat(f[r.$size].height),xmlns:"http://www.w3.org/2000/svg"},r))}});var W=p("path",function(e){var r=e.$theme,n=e.$size;return{stroke:r.colors.backgroundTertiary,strokeWidth:f[n].strokeWidth+"px"}});W.displayName="_StyledProgressBarRoundedTrackBackground",W.displayName="_StyledProgressBarRoundedTrackBackground",E(W,function(e){return function(r){return V.createElement(e,B({d:f[r.$size].d},r))}});var G=p("path",function(e){var r=e.$theme,n=e.$size,t=e.$visible,o=e.$pathLength,a=e.$pathProgress;return{visibility:t?"visible":"hidden",stroke:r.colors.borderAccent,strokeWidth:f[n].strokeWidth+"px",strokeDasharray:o,strokeDashoffset:o*(1-a)+""}});G.displayName="_StyledProgressBarRoundedTrackForeground",G.displayName="_StyledProgressBarRoundedTrackForeground",E(G,function(e){return function(r){return V.createElement(e,B({d:f[r.$size].d},r))}});var ie=p("div",function(e){var r=e.$theme,n=e.$size;return R({color:r.colors.contentPrimary},r.typography[f[n].typography])});ie.displayName="StyledProgressBarRoundedText",ie.displayName="StyledProgressBarRoundedText";function U(e){"@babel/helpers - typeof";return U=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},U(e)}var Ce=["overrides","getProgressLabel","value","size","steps","successValue","minValue","maxValue","showLabel","infinite","errorMessage","forwardedRef"];function m(){return m=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},m.apply(this,arguments)}function S(e,r){return Ne(e)||ze(e,r)||Xe(e,r)||Te()}function Te(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xe(e,r){if(e){if(typeof e=="string")return se(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return se(e,r)}}function se(e,r){(r==null||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function ze(e,r){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var t=[],o=!0,a=!1,s,i;try{for(n=n.call(e);!(o=(s=n.next()).done)&&(t.push(s.value),!(r&&t.length===r));o=!0);}catch(c){a=!0,i=c}finally{try{!o&&n.return!=null&&n.return()}finally{if(a)throw i}}return t}}function Ne(e){if(Array.isArray(e))return e}function Ee(e,r){if(e==null)return{};var n=Ve(e,r),t,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)t=a[o],!(r.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}function Ve(e,r){if(e==null)return{};var n={},t=Object.keys(e),o,a;for(a=0;a<t.length;a++)o=t[a],!(r.indexOf(o)>=0)&&(n[o]=e[o]);return n}function Ae(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function Me(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}function _e(e,r,n){return r&&Me(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ie(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&K(e,r)}function K(e,r){return K=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,t){return n.__proto__=t,n},K(e,r)}function De(e){var r=We();return function(){var n=C(e),t;if(r){var o=C(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return He(this,t)}}function He(e,r){if(r&&(U(r)==="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Fe(e)}function Fe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function We(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},C(e)}function Ge(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var le=function(e){Ie(n,e);var r=De(n);function n(){return Ae(this,n),r.apply(this,arguments)}return _e(n,[{key:"componentDidMount",value:function(){}},{key:"render",value:function(){var t=this.props,o=t.overrides,a=o===void 0?{}:o,s=t.getProgressLabel,i=t.value,c=t.size,d=t.steps,O=t.successValue,y=t.minValue,k=t.maxValue,T=t.showLabel,l=t.infinite,b=t.errorMessage,X=t.forwardedRef,z=Ee(t,Ce),L=this.props["aria-label"]||this.props.ariaLabel,g=k!==100?k:O,N=P(a.Root,A),j=S(N,2),de=j[0],pe=j[1],fe=P(a.BarContainer,M),Q=S(fe,2),ge=Q[0],me=Q[1],ye=P(a.Bar,_),q=S(ye,2),be=q[0],he=q[1],ve=P(a.BarProgress,I),J=S(ve,2),Re=J[0],we=J[1],Pe=P(a.Label,H),Y=S(Pe,2),Se=Y[0],Oe=Y[1],$e=P(a.InfiniteBar,D),Z=S($e,2),ee=Z[0],re=Z[1],v={$infinite:l,$size:c,$steps:d,$successValue:g,$minValue:y,$maxValue:g,$value:i};function Be(){for(var te=[],x=0;x<d;x++)te.push(u.createElement(be,m({key:x},v,he),u.createElement(Re,m({$index:x},v,we))));return te}return u.createElement(de,m({ref:X,"data-baseweb":"progress-bar",role:"progressbar","aria-label":L||s(i,g,y),"aria-valuenow":l?null:i,"aria-valuemin":l?null:y,"aria-valuemax":l?null:g,"aria-invalid":b?!0:null,"aria-errormessage":b},z,v,pe),u.createElement(ge,m({},v,me),l?u.createElement(u.Fragment,null,u.createElement(ee,m({$isLeft:!0,$size:v.$size},re)),u.createElement(ee,m({$size:v.$size},re))):Be()),T&&u.createElement(Se,m({},v,Oe),s(i,g,y)))}}]),n}(u.Component);Ge(le,"defaultProps",{getProgressLabel:function(e,r,n){return"".concat(Math.round((e-n)/(r-n)*100),"% Loaded")},infinite:!1,overrides:{},showLabel:!1,size:h.medium,steps:1,successValue:100,minValue:0,maxValue:100,value:0});var ue=u.forwardRef(function(e,r){return u.createElement(le,m({forwardedRef:r},e))});ue.displayName="ProgressBar";var ce=(e=>(e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl",e))(ce||{});function Ue({value:e,size:r="sm",overrides:n}){const t=Le(),o={xs:t.spacing.twoXS,sm:t.spacing.sm,md:t.spacing.lg,lg:t.spacing.xl,xl:t.spacing.twoXL},a={BarContainer:{style:{marginTop:t.spacing.none,marginBottom:t.spacing.none,marginRight:t.spacing.none,marginLeft:t.spacing.none}},Bar:{style:({$theme:s})=>({marginTop:t.spacing.none,marginBottom:t.spacing.none,marginRight:t.spacing.none,marginLeft:t.spacing.none,height:o[r],backgroundColor:s.colors.progressbarTrackFill,borderTopLeftRadius:t.spacing.twoXS,borderTopRightRadius:t.spacing.twoXS,borderBottomLeftRadius:t.spacing.twoXS,borderBottomRightRadius:t.spacing.twoXS})},BarProgress:{style:()=>({backgroundColor:t.colors.secondary,borderTopLeftRadius:t.spacing.twoXS,borderTopRightRadius:t.spacing.twoXS,borderBottomLeftRadius:t.spacing.twoXS,borderBottomRightRadius:t.spacing.twoXS})}};return je.jsx(ue,{value:e,overrides:xe(a,n)})}export{Ue as P,ce as S};