@wistia/vhs 2.35.0-beta.e1cb7d2b.28c5520 → 2.35.0-beta.eecf5b90.055b407

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license VHS v2.35.0-beta.e1cb7d2b.28c5520
3
+ * @license VHS v2.35.0-beta.eecf5b90.055b407
4
4
  *
5
5
  * Copyright (c) 2021-2024, Wistia, Inc. and its affiliates.
6
6
  *
@@ -504,7 +504,7 @@
504
504
  max-height: ${({size:e})=>e};
505
505
  max-width: ${({size:e})=>e};
506
506
  }
507
- `,D9=Object.freeze({lg:"md",md:"md",sm:"sm"}),uI={lg:"16px",md:"16px",sm:"12px"},nc=({children:e,icon:t,iconName:r,iconPosition:n,isLoading:o,size:a,textAlign:s})=>{let u=()=>{if(O(t)&&O(r))throw new Error("Do not use both icon and iconName props. If you are using a VHS icon, pass its type as a string to iconName. If you are using a custom icon, pass it as a component to the icon prop. ");return O(t)?(0,Nt.jsx)(sI,{"data-testid":"icon-container",size:uI[a],children:t}):O(r)?(0,Nt.jsx)(De,{"data-testid":"iconName-icon",size:D9[a],type:r}):null};return(0,Nt.jsxs)(Nt.Fragment,{children:[o?(0,Nt.jsxs)(oI,{"data-testid":"button-content-loading",textAlign:s,children:[(0,Nt.jsx)(qs,{"aria-live":"assertive",message:"Button has been disabled while action is in progress"}),(0,Nt.jsx)(De,{size:D9[a],type:"spinner"})]}):null,(0,Nt.jsxs)(aI,{iconPosition:n,isLoading:o,size:a,children:[(0,Nt.jsx)(Nt.Fragment,{children:u()}),O(e)?(0,Nt.jsx)(iI,{"data-testid":"button-content-label",textAlign:s,children:e}):null]})]})};i();var oc=(e,t,r)=>ye(e)?e:t==="primary"?r.brandBlue500:t==="secondary"||t==="tertiary"?r.grey900:t==="dangerous"?r.red600:r.brandBlue500;var ym=require("react/jsx-runtime"),qe=(0,S9.forwardRef)(({children:e,disabled:t=!1,forceState:r,colorOverride:n,fullWidth:o=!1,icon:a,iconName:s,iconPosition:u="start",label:l,labelWrap:c=!1,isLoading:d=!1,noStyle:m=!1,onClick:h,size:g="lg",square:v=!1,textAlign:p="center",type:b="button",variant:C="primary",...x},D)=>{let E=()=>d||t,P=F=>{if(E()){F.preventDefault();return}O(h)&&h(F)},w=oc(n,C,Be()),T=()=>O(e)?e:O(l)?l:null;return(0,ym.jsx)(d6,{ref:D,"aria-disabled":E()||void 0,buttonColor:w,disabled:!1,forceState:r,fullWidth:o,iconPosition:u,isLoading:d,labelWrap:c,noStyle:m,onClick:P,size:g,square:v,textAlign:p,type:b,variant:C,...x,children:(0,ym.jsx)(nc,{icon:a,iconName:s,iconPosition:u,isLoading:d,size:g,textAlign:p,children:T()})})});qe.displayName="Button_VHS";i();var T9=()=>typeof window>"u"||typeof document>"u";var ro=require("react/jsx-runtime"),lI=["success","warning","error","dangerous"],xm="success",wm="Dismiss",Em=3e3,cI=(e,t,r)=>{if(ye(e))return e;if(!lI.includes(t))throw new Error(`Variant "${t}" not supported, please update variant prop in Toast component.`);return t==="dangerous"||t==="error"?r.error600:t==="warning"?r.warning500:r.brandBlue500},fI="8px",ac="24px",pI=Cm.default.div`
507
+ `,D9=Object.freeze({lg:"md",md:"md",sm:"sm"}),uI={lg:"16px",md:"16px",sm:"12px"},nc=({children:e,icon:t,iconName:r,iconPosition:n,isLoading:o,size:a,textAlign:s})=>{let u=()=>{if(O(t)&&O(r))throw new Error("Do not use both icon and iconName props. If you are using a VHS icon, pass its type as a string to iconName. If you are using a custom icon, pass it as a component to the icon prop. ");return O(t)?(0,Nt.jsx)(sI,{"data-testid":"icon-container",size:uI[a],children:t}):O(r)?(0,Nt.jsx)(De,{"data-testid":"iconName-icon",size:D9[a],type:r}):null};return(0,Nt.jsxs)(Nt.Fragment,{children:[o?(0,Nt.jsxs)(oI,{"data-testid":"button-content-loading",textAlign:s,children:[(0,Nt.jsx)(qs,{"aria-live":"assertive",message:"Button has been disabled while action is in progress"}),(0,Nt.jsx)(De,{size:D9[a],type:"spinner"})]}):null,(0,Nt.jsxs)(aI,{iconPosition:n,isLoading:o,size:a,children:[(0,Nt.jsx)(Nt.Fragment,{children:u()}),O(e)?(0,Nt.jsx)(iI,{"data-testid":"button-content-label",textAlign:s,children:e}):null]})]})};i();var oc=(e,t,r)=>ye(e)?e:t==="primary"?r.brandBlue500:t==="secondary"||t==="tertiary"?r.grey900:t==="dangerous"?r.red600:r.brandBlue500;var ym=require("react/jsx-runtime"),qe=(0,S9.forwardRef)(({children:e,disabled:t=!1,forceState:r,colorOverride:n,fullWidth:o=!1,icon:a,iconName:s,iconPosition:u="start",label:l,labelWrap:c=!1,isLoading:d=!1,noStyle:m=!1,onClick:h,size:g="lg",square:v=!1,textAlign:p="center",type:b="button",variant:C="primary",...x},D)=>{let E=()=>d||t,P=F=>{if(E()){F.preventDefault();return}O(h)&&h(F)},w=oc(n,C,Be()),T=()=>O(e)?e:O(l)?l:null;return(0,ym.jsx)(d6,{ref:D,"aria-disabled":E()||void 0,buttonColor:w,disabled:!1,forceState:r,fullWidth:o,iconPosition:u,isLoading:d,labelWrap:c,noStyle:m,onClick:P,size:g,square:v,textAlign:p,type:b,variant:C,...x,children:(0,ym.jsx)(nc,{icon:a,iconName:s,iconPosition:u,isLoading:d,size:g,textAlign:p,children:T()})})});qe.displayName="Button_VHS";i();var T9=()=>typeof window>"u"||typeof document>"u";var ro=require("react/jsx-runtime"),lI=["success","warning","error","dangerous"],xm="success",wm="Dismiss",Em=3e3,cI=(e,t,r)=>{if(ye(e))return e;if(!lI.includes(t))throw new Error(`Variant "${t}" not supported, please update variant prop in Toast component.`);return t==="dangerous"||t==="error"?r.red600:t==="warning"?r.yellow500:r.brandBlue500},fI="8px",ac="24px",pI=Cm.default.div`
508
508
  align-items: center;
509
509
  background: white;
510
510
  border-left-color: ${({accentColor:e})=>e};
@@ -1385,8 +1385,8 @@
1385
1385
  `,tH=ur.css`
1386
1386
  border-color: transparent;
1387
1387
  `,HC=ur.css``,rH=ur.css`
1388
- background-color: ${({theme:e})=>e.color.error100};
1389
- border: 1px solid ${({theme:e})=>e.color.error500};
1388
+ background-color: ${({theme:e})=>e.color.red100};
1389
+ border: 1px solid ${({theme:e})=>e.color.red500};
1390
1390
 
1391
1391
  &:hover,
1392
1392
  &:focus,
@@ -1451,8 +1451,8 @@
1451
1451
  ${({required:e})=>e&&nH}
1452
1452
  `,Oi=({renderAs:e="label",children:t,disabled:r=!1,htmlFor:n,required:o=!1,screenReaderOnly:a=!1,...s})=>(0,ZC.jsx)(aH,{as:e,disabled:r,htmlFor:e==="label"?n:"",renderAs:e,required:o,screenReaderOnly:a,...s,children:t});Oi.displayName="Label_VHS";i();i();var WC=G(require("styled-components"));var UC=require("react/jsx-runtime"),iH=WC.default.div`
1453
1453
  align-items: center;
1454
- border-left: 4px solid ${({theme:e})=>e.color.error500};
1455
- color: ${({theme:e})=>e.color.error600};
1454
+ border-left: 4px solid ${({theme:e})=>e.color.red500};
1455
+ color: ${({theme:e})=>e.color.red600};
1456
1456
  font-size: 12px;
1457
1457
  line-height: 16px;
1458
1458
  margin-top: ${({theme:e})=>e.spacing.space02};
@@ -1617,7 +1617,7 @@
1617
1617
  }
1618
1618
  `,C1=(0,lx.forwardRef)(({accept:e,children:t,disabled:r=!1,id:n,maxSize:o=TH,multiple:a=!1,name:s="file-upload",onClick:u,onChange:l,onError:c,...d},m)=>(0,x1.jsxs)(PH,{ariaControls:"filename",disabled:r,htmlFor:n,...d,children:[t,(0,x1.jsx)("input",{ref:m,accept:e,"data-testid":"file-select-input",disabled:r,id:n,multiple:a,name:s,onChange:g=>{let{files:v}=g.target;if(o&&v){let p=o*1024*1024;if(Array.from(v).some(C=>C.size>p))return c&&c(new Error(`File not accepted. Please choose a file under ${o}MB.`)),!1}return l&&l(g),!0},onClick:u,tabIndex:-1,type:"file"})]}));C1.displayName="FileSelect_VHS";i();i();var mo=require("react");i();i();var fx=require("react");var ki=G(require("styled-components"));var Sn=require("react/jsx-runtime"),AH=ki.default.div`
1619
1619
  border-left: 4px solid;
1620
- border-left-color: ${({theme:e})=>e.color.error500};
1620
+ border-left-color: ${({theme:e})=>e.color.red500};
1621
1621
  margin-bottom: ${({theme:e})=>e.spacing.space07};
1622
1622
  padding-left: ${({theme:e})=>e.spacing.space02};
1623
1623
  `,$H=ki.default.p`
@@ -1630,7 +1630,7 @@
1630
1630
  margin: 0;
1631
1631
  padding-left: 0;
1632
1632
  `,px=ki.default.span`
1633
- color: ${({theme:e})=>e.color.error600};
1633
+ color: ${({theme:e})=>e.color.red600};
1634
1634
  line-height: 1.5;
1635
1635
  `,MH=(0,ki.default)(px)`
1636
1636
  cursor: pointer;
@@ -1639,10 +1639,10 @@
1639
1639
  border-color: ${({theme:e})=>e.color.brandBlue500};
1640
1640
  outline: none;
1641
1641
  `,NH=Ur.css`
1642
- border-color: ${({theme:e})=>e.color.error500};
1642
+ border-color: ${({theme:e})=>e.color.red500};
1643
1643
 
1644
1644
  &:focus {
1645
- border-color: ${({theme:e})=>e.color.error600};
1645
+ border-color: ${({theme:e})=>e.color.red600};
1646
1646
  }
1647
1647
  `,LH=Ur.css`
1648
1648
  -webkit-opacity: 0.5;
@@ -1787,7 +1787,7 @@
1787
1787
  border-color: ${({theme:e})=>e.color.grey300};
1788
1788
  }
1789
1789
  `,aG=Gi.css`
1790
- border: 1px solid ${({theme:e})=>e.color.error500};
1790
+ border: 1px solid ${({theme:e})=>e.color.red500};
1791
1791
  `,g3=Gi.default.select`
1792
1792
  ${zt}
1793
1793
  appearance: none;
@@ -2530,7 +2530,7 @@
2530
2530
  margin: 0;
2531
2531
  padding: 0;
2532
2532
  `,IW=wh.default.li`
2533
- color: ${e=>e.theme.color.error600};
2533
+ color: ${e=>e.theme.color.red600};
2534
2534
  font-size: 12px;
2535
2535
  `,UD=({messages:e=[]})=>(0,xh.jsx)(RW,{children:e.map(t=>(0,xh.jsx)(IW,{children:t},t))});i();var To=" - ",Bn=`mm/dd/yyyy${To}mm/dd/yyyy`,kW=[{type:"month",id:"month1"},{type:"day",id:"day1"},{type:"year",id:"year1"},{type:"skip"},{type:"month",id:"month2"},{type:"day",id:"day2"},{type:"year",id:"year2"}],NW=e=>{let t={month:2,day:2,year:4,skip:To.length-2},r=0;return e.map(({type:n,id:o},a)=>{let s=r+(a===0?0:1),u=s+t[n];return r=u,{start:s,end:u,type:n,id:o}})},Po=NW(kW);i();var LW=new Set(["Enter","Backspace","Tab","ArrowRight","ArrowLeft","ArrowUp","ArrowDown","/"]),Gf=e=>/^[0-9]$/i.test(e.key),VW=e=>LW.has(e.key),KD=e=>Gf(e)||VW(e),Eh=({key:e,shiftKey:t})=>e==="Tab"&&!t||e==="/"||e==="ArrowRight",Dh=({key:e,shiftKey:t})=>e==="ArrowLeft"||e==="Tab"&&t,Sh=e=>e.key==="ArrowUp"||e.key==="ArrowDown",Th=e=>e.key==="Backspace",qD=e=>Gf(e)||Sh(e)||Th(e),XD=e=>Dh(e)||Eh(e);i();var tn=e=>{let[t,r]=e.split(To),n="",o="",a="",s="",u="",l="";O(t)&&([n,o,a]=t.split("/")),O(r)&&([s,u,l]=r.split("/"));let c=ye(n)?n:"",d=ye(o)?o:"",m=ye(a)?a:"",h=ye(s)?s:"",g=ye(u)?u:"",v=ye(l)?l:"";return{month1:c,day1:d,year1:m,month2:h,day2:g,year2:v}},ju=e=>{if(!zs(e))return"";try{return new Intl.DateTimeFormat(["en-US"],{year:"numeric",month:"2-digit",day:"2-digit",timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone}).format(e)}catch{return""}},jf=e=>{let{month1:t,day1:r,year1:n,month2:o,day2:a,year2:s}=e;return`${t}/${r}/${n}${To}${o}/${a}/${s}`},Zf=e=>{let{month1:t,day1:r,year1:n,month2:o,day2:a,year2:s}=tn(e);try{let u=Cr(new Date(Number(n),Number(t)-1,Number(r))),l=ri(new Date(Number(s),Number(o)-1,Number(a)));return{start:u,end:l}}catch{return}},Ph=({start:e,end:t})=>{let r={month:"2-digit",day:"2-digit",year:"numeric"},n=e.toLocaleDateString("en-US",r),o=t.toLocaleDateString("en-US",r);return`${n}${To}${o}`};i();var Ah=G(Nl());i();var is,YD=e=>{O(is)&&(e.preventDefault(),clearTimeout(is),is=void 0),is=setTimeout(()=>{clearTimeout(is),is=void 0},200)},JD=({start:e,end:t})=>zs(e)&&zs(t),QD=([e],t)=>{let r=t.find(n=>n.start===e);return O(r)&&O(r.id)?r.id:""},Zu=(e,t)=>{let r=t.substring(0,t.length-1),n=t.charAt(t.length-1),o=12,a=31;switch(r){case"month":return o;case"year":return l0(new Date);case"day":if(e[`month${n}`]!=="mm"){let u=e[`month${n}`]-1;if(e[`year${n}`]!=="yyyy"){let l=e[`year${n}`];return u0(new Date(l,u))}return u0(new Date(l0(new Date),u))}return a;default:return 0}},eS=({range:e,maxDate:t,minDate:r})=>{let n=ju(e.start),o=ju(e.end),a=[];if(O(t)){let s=ju(t);kr(t,e.start)&&a.push(`${n} is after maximum of ${s}`),kr(t,e.end)&&a.push(`${o} is after maximum of ${s}`)}if(r){let s=ju(r);kr(e.start,r)&&a.push(`${n} is before minimum of ${s}`),kr(e.end,r)&&a.push(`${o} is before minimum of ${s}`)}return(kr(e.end,e.start)||qt(e.end,e.start))&&a.push("start date must come before end date"),a},tS=e=>{let[t,r]=[e.start,e.end].sort(Kl);return{start:t,end:r}};i();var zW=e=>{let t=e.current?.selectionStart,r=e.current?.selectionEnd;return{startPos:t,endPos:r}},rS=(e,t,r)=>{let n=e.current;n&&n.setSelectionRange(t,r)},Wu=(e,t,r)=>{let n=r.findIndex(a=>a.start===e[0]),o=r[n+t];return o&&o.type==="skip"&&(o=r[n+t*2]),o?[o.start,o.end]:e},nS=(e,t)=>{let r=zW(e);for(let n=0;n<t.length;n++){if(lt(t[n]))return[];let{start:o,end:a,type:s}=t[n];if(O(r.startPos)&&r.startPos>o-1&&r.startPos<=a)return s==="skip"&&te(t[n+1])?[t[n+1].start,t[n+1].end]:[o,a]}return[]},oS=e=>{let t=tn(e),r=tn(Bn),n=["month1","day1","year1","month2","day2","year2"];for(let o=0;o<n.length;o++){if(lt(n[o]))return-1;if(t[n[o]]===r[n[o]])return o}return-1},aS=([,e])=>{let t=Bn.indexOf(To);return e===-1?"":te(e)&&e<=t?"start":"end"};var iS=e=>{let t={...e},r=n=>`${n}`.padStart(2,"0");return e.day1!=="dd"&&(t.day1=r(Math.min(Number(e.day1),Zu(e,"day1")))),e.day2!=="dd"&&(t.day2=r(Math.min(Number(e.day2),Zu(e,"day2")))),t},_W=(e,t,r,n,o)=>{let a=tn(Bn)[t],s=a.length,u=p=>`${p}`.padStart(s,"0"),l=p=>({...e,[t]:u(p)}),c=e[t],d=c===a;if(o===0)return l(u(n));let m=Zu(e,t),h=`${Number.parseInt(c,10)}`,g=`${h}${n}`,v=h.length===s;return d&&r!=="year"||v?l(n):Number.parseInt(g,10)>m?l(m):l(g)},HW=(e,t,r)=>{let n=Number.parseInt(e,10);Number.isNaN(n)&&(n=0);let o=n+r;return o<=0||o>t?n:o},GW=(e,t,r)=>{let o=tn(Bn)[t].length,a=c=>`${c}`.padStart(o,"0"),s=c=>({...e,[t]:a(c)}),u=e[t],l=Zu(e,t);return s(a(HW(u,l,r)))},sS=({event:e,currentSelection:t,keyCount:r,valueParts:n,selectionLength:o})=>{let a="",s=r,u=!1,l=QD(t,Po),c=l.substring(0,l.length-1);if(Gf(e)){e.preventDefault();let d=_W(n,l,c,e.key,r),m=iS(d);a=jf(m),s+=1,u=o===s}if(Sh(e)){e.preventDefault();let d=e.key==="ArrowUp"?1:-1,m=GW(n,l,d),h=iS(m);a=jf(h),s=0,u=!0}if(Th(e)){e.preventDefault();let d=tn(Bn);a=jf({...n,[l]:d[l]}),s=0}return{nextValue:a,nextKeyCount:s,shouldApply:u}},uS=({event:e,currentSelection:t})=>{let r;return Eh(e)&&(r=Wu(t,1,Po),(0,Ah.default)(r,t)||e.preventDefault()),Dh(e)&&(r=Wu(t,-1,Po),(0,Ah.default)(r,t)||e.preventDefault()),{nextSelection:r,nextKeyCount:0}};var Uu=require("react/jsx-runtime"),jW=lS.default.input`
2536
2536
  border: 1px solid ${e=>e.theme.color.grey400};
@@ -2699,8 +2699,8 @@
2699
2699
  }
2700
2700
 
2701
2701
  &[aria-checked='true'] {
2702
- background-color: ${({colorOverride:e,theme:t})=>e??t.color.success600};
2703
- border-color: ${({colorOverride:e,theme:t})=>e??t.color.success600};
2702
+ background-color: ${({colorOverride:e,theme:t})=>e??t.color.green600};
2703
+ border-color: ${({colorOverride:e,theme:t})=>e??t.color.green600};
2704
2704
  color: white;
2705
2705
  }
2706
2706