@wistia/vhs 2.74.0-beta.c9f0ef33.7e9273d → 2.74.1

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.74.0-beta.c9f0ef33.7e9273d
3
+ * @license @wistia/vhs v2.74.1
4
4
  *
5
5
  * Copyright (c) 2021-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -1606,7 +1606,7 @@ var DM=Object.create;var jl=Object.defineProperty;var SM=Object.getOwnPropertyDe
1606
1606
  `,TX=_u(yS)`
1607
1607
  cursor: pointer;
1608
1608
  text-decoration: underline;
1609
- `,AX=e=>{let t="error";return e>1&&(t+="s"),`${e} ${t} found on page`},RX=e=>{document.getElementById(`fieldset-${e}`)?.scrollIntoView({behavior:"smooth"})},FX=({errors:e={},statusError:t})=>bS(PX,{children:[(0,Wu.isNonEmptyString)(t)?ju(yS,{children:t}):null,Object.keys(e).map(r=>ju("li",{children:ju(TX,{"data-testid":`form-global-error-${r}`,onClick:()=>RX(r),children:e[r]})},r))]}),Up=DX((e,t)=>{let r=mi(),{status:n,errors:o}=r,a=Object.keys(o).length;(0,Wu.isNotNil)(n)&&n.length>0&&(a+=1);let s=(0,Wu.isNotNil)(n)&&!n.success||a;return Sn(s)?bS(SX,{ref:t,children:[ju(EX,{children:AX(a)}),ju(FX,{errors:o,statusError:n})]}):null});Up.displayName="FormGlobalError_VHS";i();i();import{useContext as BX}from"react";var Uu=()=>BX(If);i();i();import{useEffect as OX}from"react";i();i();import{useCallback as _h,useEffect as CS,useRef as Uh}from"react";var Kh=(e,t=0)=>{let r=Uh(!1),n=Uh(),o=Uh(e),a=_h(()=>r.current,[]),s=_h(()=>{r.current=!1,n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{r.current=!0,o.current()},t)},[t]),u=_h(()=>{r.current=null,n.current&&clearTimeout(n.current)},[]);return CS(()=>{o.current=e},[e]),CS(()=>(s(),u),[t]),[a,u,s]};var qh=(e,t=0,r=[])=>{let[n,o,a]=Kh(e,t);return OX(a,r),[n,o]};import{jsx as DS,jsxs as IX}from"react/jsx-runtime";var wS=(e,t)=>JSON.stringify(e)!==JSON.stringify(t),MX=(e,t)=>{let r={};return Object.keys(e).forEach(n=>{e[n]===null?(0,Ft.isNotUndefined)(t)&&(0,Ft.isNotUndefined)(t.fields)&&(0,Ft.isNotUndefined)(t.fields[n])&&t.fields[n]._type==="boolean"?r[n]=!1:r[n]=void 0:r[n]=e[n]}),r},SS=({children:e,className:t,formId:r,initialValues:n,onSubmit:o,scrollToFormErrorsOnSubmit:a=!0,shareFormContext:s,style:u,submitOnChange:l=!1,validate:c,validateOnBlur:p=!1,validateOnChange:d=!1,validationSchema:h,globalErrorRef:g,showGlobalError:v=!0,innerRef:m})=>{let[b,y]=Kp(),[x,w]=Kp(),[S,E]=Kp(0),D=Uu(),P=(H,I)=>{let k={};Object.keys(H).forEach(V=>{let z=H[V],ee=(0,Ft.isNotUndefined)(h)&&(0,Ft.isNotUndefined)(h.fields[V])&&h.fields[V]._type==="string";if(z==null){k[V]=null;return}if(typeof z=="number"){k[V]=z;return}z===!1&&(k[V]=!1),ee&&!z&&(k[V]=null),z&&(k[V]=ee?z.trim():z)}),o(k,I)},A=a&&((0,Ft.isUndefined)(b)||!b)&&((0,Ft.isUndefined)(x)||!x)&&(0,Ft.isNotUndefined)(g.current?.scrollIntoView);xS(()=>{if(((0,Ft.isUndefined)(b)||!b)&&(0,Ft.isNotUndefined)(x)&&x&&document.activeElement&&document.activeElement.blur(),A){let H=S>1?`there are ${S} errors`:"there's an error!";D({variant:"error",message:`Uh oh, ${H}`}),g.current.scrollIntoView({behavior:"smooth"})}},[S,g,b,x,A,D]);let F=MX(n,h),M=750;return DS(Ww,{enableReinitialize:!0,initialValues:F,innerRef:(0,Ft.isNotNil)(m)?m:()=>{},onSubmit:P,validate:(0,Ft.isNotNil)(c)?c:()=>{},validateOnBlur:p,validateOnChange:d,validationSchema:h,children:H=>{let[I,k]=Kp(H.values);if(xS(()=>{(0,Ft.isNotUndefined)(s)&&s(H),y(H.isSubmitting),w(H.isValid),E(Object.keys(H.errors).length),l&&wS(H.values,I)&&k(H.values)},[H,I]),l){let[,]=qh(()=>{wS(n,I)&&H.submitForm()},M,[I])}return IX(gh,{className:t,"data-testid":r,noValidate:!0,style:u,children:[v?DS(Up,{ref:g}):null,e]})}})};SS.displayName="Form_VHS";i();i();i();i();import{jsx as kX}from"react/jsx-runtime";var qp=({type:e="submit",isSubmitting:t=!1,children:r,disabled:n=!1,...o})=>kX(nt,{disabled:t||n,type:e,...o,children:r});qp.displayName="FormConnectorButton_VHS";import{jsx as ES}from"react/jsx-runtime";var NX=e=>e.preventDefault(),PS=({buttons:e,align:t="left",...r})=>{let{isSubmitting:n}=mi();return ES(Fo,{align:t,...r,children:e.map(({name:o,type:a,...s})=>ES(qp,{isSubmitting:n,type:a,...s,onMouseDown:NX,children:o},o))})};PS.displayName="FormButtons_VHS";i();i();import{forwardRef as ene}from"react";import OA from"styled-components";i();var TS={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();var Xp=K(Q());import{jsx as VX}from"react/jsx-runtime";var Yp=({direction:e="column",disabled:t=!1,field:{name:r,value:n},form:{errors:o,setFieldValue:a},label:s,labelDescription:u,labelProps:l={},onChangeCustom:c,options:p=[]})=>{let d=(m,b)=>{a(b,m.target.checked)},h=(m,b)=>{let y=n;if((0,Xp.isArray)(y))if(m.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?h:d,v=Array.isArray(p)?p:[p];return VX(Hp,{direction:e,disabled:t,error:(0,Xp.isNotNil)(o)?o[r]:void 0,label:s,labelDescription:u,labelProps:l,name:r,onChange:(m,b)=>{g(m,b),c&&c(m.target.checked)},options:v,value:n})};Yp.displayName="FormConnectorCheckboxGroup_VHS";i();i();var RS=K(Q());import{jsx as AS}from"react/jsx-runtime";var Jp=({customComponent:e,field:t,form:r,label:n="",labelDescription:o,labelProps:a={},...s})=>{let{name:u}=t,{errors:l}=r;return AS(Zt,{error:(0,RS.isNotUndefined)(l)?l[u]:void 0,label:n,labelDescription:o,labelProps:a,name:u,children:AS(e,{field:t,form:r,...s})})};Jp.displayName="FormConnectorCustomField_VHS";i();i();var kS=K(Q());i();i();var Ku=K(Q());import{forwardRef as oY,useEffect as iY,useRef as aY}from"react";import sY from"styled-components";i();import LX,{css as bi}from"styled-components";var FS=bi`
1609
+ `,AX=e=>{let t="error";return e>1&&(t+="s"),`${e} ${t} found on page`},RX=e=>{document.getElementById(`fieldset-${e}`)?.scrollIntoView({behavior:"smooth"})},FX=({errors:e={},statusError:t})=>bS(PX,{children:[(0,Wu.isNonEmptyString)(t)?ju(yS,{children:t}):null,Object.keys(e).map(r=>ju("li",{children:ju(TX,{"data-testid":`form-global-error-${r}`,onClick:n=>{n.preventDefault(),RX(r)},children:e[r]})},r))]}),Up=DX((e,t)=>{let r=mi(),{status:n,errors:o}=r,a=Object.keys(o).length;(0,Wu.isNotNil)(n)&&n.length>0&&(a+=1);let s=(0,Wu.isNotNil)(n)&&!n.success||a;return Sn(s)?bS(SX,{ref:t,children:[ju(EX,{children:AX(a)}),ju(FX,{errors:o,statusError:n})]}):null});Up.displayName="FormGlobalError_VHS";i();i();import{useContext as BX}from"react";var Uu=()=>BX(If);i();i();import{useEffect as OX}from"react";i();i();import{useCallback as _h,useEffect as CS,useRef as Uh}from"react";var Kh=(e,t=0)=>{let r=Uh(!1),n=Uh(),o=Uh(e),a=_h(()=>r.current,[]),s=_h(()=>{r.current=!1,n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{r.current=!0,o.current()},t)},[t]),u=_h(()=>{r.current=null,n.current&&clearTimeout(n.current)},[]);return CS(()=>{o.current=e},[e]),CS(()=>(s(),u),[t]),[a,u,s]};var qh=(e,t=0,r=[])=>{let[n,o,a]=Kh(e,t);return OX(a,r),[n,o]};import{jsx as DS,jsxs as IX}from"react/jsx-runtime";var wS=(e,t)=>JSON.stringify(e)!==JSON.stringify(t),MX=(e,t)=>{let r={};return Object.keys(e).forEach(n=>{e[n]===null?(0,Ft.isNotUndefined)(t)&&(0,Ft.isNotUndefined)(t.fields)&&(0,Ft.isNotUndefined)(t.fields[n])&&t.fields[n]._type==="boolean"?r[n]=!1:r[n]=void 0:r[n]=e[n]}),r},SS=({children:e,className:t,formId:r,initialValues:n,onSubmit:o,scrollToFormErrorsOnSubmit:a=!0,shareFormContext:s,style:u,submitOnChange:l=!1,validate:c,validateOnBlur:p=!1,validateOnChange:d=!1,validationSchema:h,globalErrorRef:g,showGlobalError:v=!0,innerRef:m})=>{let[b,y]=Kp(),[x,w]=Kp(),[S,E]=Kp(0),D=Uu(),P=(H,I)=>{let k={};Object.keys(H).forEach(V=>{let z=H[V],ee=(0,Ft.isNotUndefined)(h)&&(0,Ft.isNotUndefined)(h.fields[V])&&h.fields[V]._type==="string";if(z==null){k[V]=null;return}if(typeof z=="number"){k[V]=z;return}z===!1&&(k[V]=!1),ee&&!z&&(k[V]=null),z&&(k[V]=ee?z.trim():z)}),o(k,I)},A=a&&((0,Ft.isUndefined)(b)||!b)&&((0,Ft.isUndefined)(x)||!x)&&(0,Ft.isNotUndefined)(g.current?.scrollIntoView);xS(()=>{if(((0,Ft.isUndefined)(b)||!b)&&(0,Ft.isNotUndefined)(x)&&x&&document.activeElement&&document.activeElement.blur(),A){let H=S>1?`there are ${S} errors`:"there's an error!";D({variant:"error",message:`Uh oh, ${H}`}),g.current.scrollIntoView({behavior:"smooth"})}},[S,g,b,x,A,D]);let F=MX(n,h),M=750;return DS(Ww,{enableReinitialize:!0,initialValues:F,innerRef:(0,Ft.isNotNil)(m)?m:()=>{},onSubmit:P,validate:(0,Ft.isNotNil)(c)?c:()=>{},validateOnBlur:p,validateOnChange:d,validationSchema:h,children:H=>{let[I,k]=Kp(H.values);if(xS(()=>{(0,Ft.isNotUndefined)(s)&&s(H),y(H.isSubmitting),w(H.isValid),E(Object.keys(H.errors).length),l&&wS(H.values,I)&&k(H.values)},[H,I]),l){let[,]=qh(()=>{wS(n,I)&&H.submitForm()},M,[I])}return IX(gh,{className:t,"data-testid":r,noValidate:!0,style:u,children:[v?DS(Up,{ref:g}):null,e]})}})};SS.displayName="Form_VHS";i();i();i();i();import{jsx as kX}from"react/jsx-runtime";var qp=({type:e="submit",isSubmitting:t=!1,children:r,disabled:n=!1,...o})=>kX(nt,{disabled:t||n,type:e,...o,children:r});qp.displayName="FormConnectorButton_VHS";import{jsx as ES}from"react/jsx-runtime";var NX=e=>e.preventDefault(),PS=({buttons:e,align:t="left",...r})=>{let{isSubmitting:n}=mi();return ES(Fo,{align:t,...r,children:e.map(({name:o,type:a,...s})=>ES(qp,{isSubmitting:n,type:a,...s,onMouseDown:NX,children:o},o))})};PS.displayName="FormButtons_VHS";i();i();import{forwardRef as ene}from"react";import OA from"styled-components";i();var TS={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();var Xp=K(Q());import{jsx as VX}from"react/jsx-runtime";var Yp=({direction:e="column",disabled:t=!1,field:{name:r,value:n},form:{errors:o,setFieldValue:a},label:s,labelDescription:u,labelProps:l={},onChangeCustom:c,options:p=[]})=>{let d=(m,b)=>{a(b,m.target.checked)},h=(m,b)=>{let y=n;if((0,Xp.isArray)(y))if(m.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?h:d,v=Array.isArray(p)?p:[p];return VX(Hp,{direction:e,disabled:t,error:(0,Xp.isNotNil)(o)?o[r]:void 0,label:s,labelDescription:u,labelProps:l,name:r,onChange:(m,b)=>{g(m,b),c&&c(m.target.checked)},options:v,value:n})};Yp.displayName="FormConnectorCheckboxGroup_VHS";i();i();var RS=K(Q());import{jsx as AS}from"react/jsx-runtime";var Jp=({customComponent:e,field:t,form:r,label:n="",labelDescription:o,labelProps:a={},...s})=>{let{name:u}=t,{errors:l}=r;return AS(Zt,{error:(0,RS.isNotUndefined)(l)?l[u]:void 0,label:n,labelDescription:o,labelProps:a,name:u,children:AS(e,{field:t,form:r,...s})})};Jp.displayName="FormConnectorCustomField_VHS";i();i();var kS=K(Q());i();i();var Ku=K(Q());import{forwardRef as oY,useEffect as iY,useRef as aY}from"react";import sY from"styled-components";i();import LX,{css as bi}from"styled-components";var FS=bi`
1610
1610
  border-color: ${({theme:e})=>e.color.brandBlue500};
1611
1611
  outline: none;
1612
1612
  `,$X=bi`