@wistia/vhs 2.77.1-beta.6dfc2b0b.82b18ea → 2.77.1-beta.febfe4c4.f8469ef

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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/vhs v2.77.1-beta.6dfc2b0b.82b18ea
3
+ * @license @wistia/vhs v2.77.1-beta.febfe4c4.f8469ef
4
4
  *
5
5
  * Copyright (c) 2021-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -1626,7 +1626,7 @@ var OO=Object.create;var _u=Object.defineProperty;var MO=Object.getOwnPropertyDe
1626
1626
  `,lq=Yl(HS)`
1627
1627
  cursor: pointer;
1628
1628
  text-decoration: underline;
1629
- `,uq=e=>{let t="error";return e>1&&(t+="s"),`${e} ${t} found on page`},cq=e=>{document.getElementById(`fieldset-${e}`)?.scrollIntoView({behavior:"smooth"})},fq=({errors:e={},statusError:t})=>jS(sq,{children:[ve(t)?Xl(HS,{children:t}):null,Object.keys(e).map(r=>Xl("li",{children:Xl(lq,{"data-testid":`form-global-error-${r}`,onClick:n=>{n.preventDefault(),cq(r)},children:e[r]})},r))]}),kp=oq((e,t)=>{let r=Ci(),{status:n,errors:o}=r,a=Object.keys(o).length;F(n)&&n.length>0&&(a+=1);let s=F(n)&&!n.success||a;return Dn(s)?jS(iq,{ref:t,children:[Xl(aq,{children:uq(a)}),Xl(fq,{errors:o,statusError:n})]}):null});kp.displayName="FormGlobalError_VHS";i();i();import{useContext as pq}from"react";var Jl=()=>pq(Df);i();i();import{useEffect as dq}from"react";i();i();import{useCallback as Hh,useEffect as WS,useRef as jh}from"react";var Wh=(e,t=0)=>{let r=jh(!1),n=jh(),o=jh(e),a=Hh(()=>r.current,[]),s=Hh(()=>{r.current=!1,n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{r.current=!0,o.current()},t)},[t]),l=Hh(()=>{r.current=null,n.current&&clearTimeout(n.current)},[]);return WS(()=>{o.current=e},[e]),WS(()=>(s(),l),[t]),[a,l,s]};var _h=(e,t=0,r=[])=>{let[n,o,a]=Wh(e,t);return dq(a,r),[n,o]};import{jsx as KS,jsxs as hq}from"react/jsx-runtime";var US=(e,t)=>JSON.stringify(e)!==JSON.stringify(t),mq=(e,t)=>{let r={};return Object.keys(e).forEach(n=>{e[n]===null?Q(t)&&Q(t.fields)&&Q(t.fields[n])&&t.fields[n]._type==="boolean"?r[n]=!1:r[n]=void 0:r[n]=e[n]}),r},qS=({children:e,className:t,formId:r,initialValues:n,onSubmit:o,scrollToFormErrorsOnSubmit:a=!0,shareFormContext:s,style:l,submitOnChange:u=!1,validate:c,validateOnBlur:p=!1,validateOnChange:d=!1,validationSchema:m,globalErrorRef:g,showGlobalError:v=!0,innerRef:h})=>{let[b,y]=Vp(),[x,w]=Vp(),[D,T]=Vp(0),S=Jl(),E=(H,I)=>{let V={};Object.keys(H).forEach(N=>{let G=H[N],Z=Q(m)&&Q(m.fields[N])&&m.fields[N]._type==="string";if(G==null){V[N]=null;return}if(typeof G=="number"){V[N]=G;return}G===!1&&(V[N]=!1),Z&&!G&&(V[N]=null),G&&(V[N]=Z?G.trim():G)}),o(V,I)},R=a&&(dt(b)||!b)&&(dt(x)||!x)&&Q(g.current?.scrollIntoView);_S(()=>{let H=document.querySelector(`form[data-testid="${r}"]`);if((dt(b)||!b)&&Q(x)&&x&&H?.contains(document.activeElement)&&document.activeElement.blur(),R){let I=D>1?`there are ${D} errors`:"there's an error!";S({variant:"error",message:`Uh oh, ${I}`}),g.current.scrollIntoView({behavior:"smooth"})}},[D,g,b,x,R,S,r]);let B=mq(n,m),k=750;return KS(Pw,{enableReinitialize:!0,initialValues:B,innerRef:F(h)?h:()=>{},onSubmit:E,validate:F(c)?c:()=>{},validateOnBlur:p,validateOnChange:d,validationSchema:m,children:H=>{let[I,V]=Vp(H.values);if(_S(()=>{Q(s)&&s(H),y(H.isSubmitting),w(H.isValid),T(Object.keys(H.errors).length),u&&US(H.values,I)&&V(H.values)},[H,I]),u){let[,]=_h(()=>{US(n,I)&&H.submitForm()},k,[I])}return hq(gh,{className:t,"data-testid":r,noValidate:!0,style:l,children:[v?KS(kp,{ref:g}):null,e]})}})};qS.displayName="Form_VHS";i();i();i();i();import{jsx as gq}from"react/jsx-runtime";var Np=({type:e="submit",isSubmitting:t=!1,children:r,disabled:n=!1,...o})=>gq(nt,{disabled:t||n,type:e,...o,children:r});Np.displayName="FormConnectorButton_VHS";import{jsx as XS}from"react/jsx-runtime";var vq=e=>e.preventDefault(),YS=({buttons:e,align:t="left",...r})=>{let{isSubmitting:n}=Ci();return XS(Bo,{align:t,...r,children:e.map(({name:o,type:a,...s})=>XS(Np,{isSubmitting:n,type:a,...s,onMouseDown:vq,children:o},o))})};YS.displayName="FormButtons_VHS";i();i();import{forwardRef as kte}from"react";import qP from"styled-components";i();var JS={checkbox:{component:"FormConnectorCheckboxGroup",inputType:null},custom:{component:"FormConnectorCustomField",inputType:null},email:{component:"FormConnectorInput",inputType:"email"},hidden:{component:"FormConnectorHidden",inputType:"hidden"},multiline:{component:"FormConnectorInput",inputType:null},number:{component:"FormConnectorInput",inputType:"number"},password:{component:"FormConnectorInput",inputType:"password"},phone:{component:"FormConnectorInput",inputType:"tel"},radio:{component:"FormConnectorRadioGroup",inputType:null},search:{component:"FormConnectorInput",inputType:"search"},select:{component:"FormConnectorSelect",inputType:null},text:{component:"FormConnectorInput",inputType:"text"},time:{component:"FormConnectorInput",inputType:"time"},timePosition:{component:"FormConnectorInput",inputType:"text"},url:{component:"FormConnectorInput",inputType:"url"},richTextEditor:{component:"FormConnectorRichTextEditor",inputType:null}};i();i();import{jsx as yq}from"react/jsx-runtime";var Lp=({direction:e="column",disabled:t=!1,field:{name:r,value:n},form:{errors:o,setFieldValue:a},label:s,labelDescription:l,labelProps:u={},onChangeCustom:c,options:p=[]})=>{let d=(h,b)=>{a(b,h.target.checked)},m=(h,b)=>{let y=n;if(bn(y))if(h.target.checked)y.push(b);else{let x=y.indexOf(b);x>-1&&y.splice(x,1)}a(b,y)},g=Array.isArray(n)&&p.length>1?m:d,v=Array.isArray(p)?p:[p];return yq(Fp,{direction:e,disabled:t,error:F(o)?o[r]:void 0,label:s,labelDescription:l,labelProps:u,name:r,onChange:(h,b)=>{g(h,b),c&&c(h.target.checked)},options:v,value:n})};Lp.displayName="FormConnectorCheckboxGroup_VHS";i();i();import{jsx as ZS}from"react/jsx-runtime";var $p=({customComponent:e,field:t,form:r,label:n="",labelDescription:o,labelProps:a={},...s})=>{let{name:l}=t,{errors:u}=r;return ZS(Zt,{error:Q(u)?u[l]:void 0,label:n,labelDescription:o,labelProps:a,name:l,children:ZS(e,{field:t,form:r,...s})})};$p.displayName="FormConnectorCustomField_VHS";i();i();i();i();import{forwardRef as $q,useEffect as zq,useRef as Gq}from"react";import Hq from"styled-components";i();import bq,{css as Di}from"styled-components";var QS=Di`
1629
+ `,uq=e=>{let t="error";return e>1&&(t+="s"),`${e} ${t} found on page`},cq=e=>{document.getElementById(`fieldset-${e}`)?.scrollIntoView({behavior:"smooth"})},fq=({errors:e={},statusError:t})=>jS(sq,{children:[ve(t)?Xl(HS,{children:t}):null,Object.keys(e).map(r=>Xl("li",{children:Xl(lq,{"data-testid":`form-global-error-${r}`,onClick:n=>{n.preventDefault(),cq(r)},children:e[r]})},r))]}),kp=oq((e,t)=>{let r=Ci(),{status:n,errors:o}=r,a=Object.keys(o).length;F(n)&&n.length>0&&(a+=1);let s=F(n)&&!n.success||a;return Dn(s)?jS(iq,{ref:t,children:[Xl(aq,{children:uq(a)}),Xl(fq,{errors:o,statusError:n})]}):null});kp.displayName="FormGlobalError_VHS";i();i();import{useContext as pq}from"react";var Jl=()=>pq(Df);i();i();import{useEffect as dq}from"react";i();i();import{useCallback as Hh,useEffect as WS,useRef as jh}from"react";var Wh=(e,t=0)=>{let r=jh(!1),n=jh(),o=jh(e),a=Hh(()=>r.current,[]),s=Hh(()=>{r.current=!1,n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{r.current=!0,o.current()},t)},[t]),l=Hh(()=>{r.current=null,n.current&&clearTimeout(n.current)},[]);return WS(()=>{o.current=e},[e]),WS(()=>(s(),l),[t]),[a,l,s]};var _h=(e,t=0,r=[])=>{let[n,o,a]=Wh(e,t);return dq(a,r),[n,o]};import{jsx as KS,jsxs as hq}from"react/jsx-runtime";var US=(e,t)=>JSON.stringify(e)!==JSON.stringify(t),mq=(e,t)=>{let r={};return Object.keys(e).forEach(n=>{e[n]===null?Q(t)&&Q(t.fields)&&Q(t.fields[n])&&t.fields[n]._type==="boolean"?r[n]=!1:r[n]=void 0:r[n]=e[n]}),r},qS=({children:e,className:t,formId:r,initialValues:n,onSubmit:o,scrollToFormErrorsOnSubmit:a=!0,shareFormContext:s,style:l,submitOnChange:u=!1,validate:c,validateOnBlur:p=!1,validateOnChange:d=!1,validationSchema:m,globalErrorRef:g,showGlobalError:v=!0,innerRef:h})=>{let[b,y]=Vp(),[x,w]=Vp(),[D,T]=Vp(0),S=Jl(),E=(H,I)=>{let V={};Object.keys(H).forEach(N=>{let G=H[N],Z=Q(m)&&Q(m.fields[N])&&m.fields[N]._type==="string";if(G==null){V[N]=null;return}if(typeof G=="number"){V[N]=G;return}G===!1&&(V[N]=!1),Z&&!G&&(V[N]=null),G&&(V[N]=Z?G.trim():G)}),o(V,I)},R=a&&(dt(b)||!b)&&(dt(x)||!x)&&Q(g.current?.scrollIntoView);_S(()=>{let H=document.querySelector(`form[data-testid="${r}"]`);if((dt(b)||!b)&&Q(x)&&x&&H?.contains(document.activeElement)&&document.activeElement.blur(),R){let I=D>1?`there are ${D} errors`:"there's an error!";S({variant:"error",message:`Uh oh, ${I}`}),g.current&&g.current.scrollIntoView({behavior:"smooth"})}},[D,g,b,x,R,S,r]);let B=mq(n,m),k=750;return KS(Pw,{enableReinitialize:!0,initialValues:B,innerRef:F(h)?h:()=>{},onSubmit:E,validate:F(c)?c:()=>{},validateOnBlur:p,validateOnChange:d,validationSchema:m,children:H=>{let[I,V]=Vp(H.values);if(_S(()=>{Q(s)&&s(H),y(H.isSubmitting),w(H.isValid),T(Object.keys(H.errors).length),u&&US(H.values,I)&&V(H.values)},[H,I]),u){let[,]=_h(()=>{US(n,I)&&H.submitForm()},k,[I])}return hq(gh,{className:t,"data-testid":r,noValidate:!0,style:l,children:[v?KS(kp,{ref:g}):null,e]})}})};qS.displayName="Form_VHS";i();i();i();i();import{jsx as gq}from"react/jsx-runtime";var Np=({type:e="submit",isSubmitting:t=!1,children:r,disabled:n=!1,...o})=>gq(nt,{disabled:t||n,type:e,...o,children:r});Np.displayName="FormConnectorButton_VHS";import{jsx as XS}from"react/jsx-runtime";var vq=e=>e.preventDefault(),YS=({buttons:e,align:t="left",...r})=>{let{isSubmitting:n}=Ci();return XS(Bo,{align:t,...r,children:e.map(({name:o,type:a,...s})=>XS(Np,{isSubmitting:n,type:a,...s,onMouseDown:vq,children:o},o))})};YS.displayName="FormButtons_VHS";i();i();import{forwardRef as kte}from"react";import qP from"styled-components";i();var JS={checkbox:{component:"FormConnectorCheckboxGroup",inputType:null},custom:{component:"FormConnectorCustomField",inputType:null},email:{component:"FormConnectorInput",inputType:"email"},hidden:{component:"FormConnectorHidden",inputType:"hidden"},multiline:{component:"FormConnectorInput",inputType:null},number:{component:"FormConnectorInput",inputType:"number"},password:{component:"FormConnectorInput",inputType:"password"},phone:{component:"FormConnectorInput",inputType:"tel"},radio:{component:"FormConnectorRadioGroup",inputType:null},search:{component:"FormConnectorInput",inputType:"search"},select:{component:"FormConnectorSelect",inputType:null},text:{component:"FormConnectorInput",inputType:"text"},time:{component:"FormConnectorInput",inputType:"time"},timePosition:{component:"FormConnectorInput",inputType:"text"},url:{component:"FormConnectorInput",inputType:"url"},richTextEditor:{component:"FormConnectorRichTextEditor",inputType:null}};i();i();import{jsx as yq}from"react/jsx-runtime";var Lp=({direction:e="column",disabled:t=!1,field:{name:r,value:n},form:{errors:o,setFieldValue:a},label:s,labelDescription:l,labelProps:u={},onChangeCustom:c,options:p=[]})=>{let d=(h,b)=>{a(b,h.target.checked)},m=(h,b)=>{let y=n;if(bn(y))if(h.target.checked)y.push(b);else{let x=y.indexOf(b);x>-1&&y.splice(x,1)}a(b,y)},g=Array.isArray(n)&&p.length>1?m:d,v=Array.isArray(p)?p:[p];return yq(Fp,{direction:e,disabled:t,error:F(o)?o[r]:void 0,label:s,labelDescription:l,labelProps:u,name:r,onChange:(h,b)=>{g(h,b),c&&c(h.target.checked)},options:v,value:n})};Lp.displayName="FormConnectorCheckboxGroup_VHS";i();i();import{jsx as ZS}from"react/jsx-runtime";var $p=({customComponent:e,field:t,form:r,label:n="",labelDescription:o,labelProps:a={},...s})=>{let{name:l}=t,{errors:u}=r;return ZS(Zt,{error:Q(u)?u[l]:void 0,label:n,labelDescription:o,labelProps:a,name:l,children:ZS(e,{field:t,form:r,...s})})};$p.displayName="FormConnectorCustomField_VHS";i();i();i();i();import{forwardRef as $q,useEffect as zq,useRef as Gq}from"react";import Hq from"styled-components";i();import bq,{css as Di}from"styled-components";var QS=Di`
1630
1630
  border-color: ${({theme:e})=>e.color.brandBlue500};
1631
1631
  outline: none;
1632
1632
  `,Cq=Di`