@wistia/vhs 2.77.1-beta.6dfc2b0b.82b18ea → 2.77.1-beta.9f7e339d.a5c2ee7
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/components/Form/Form.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Form.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,SAAS,EAAE,SAAS,EAAO,MAAM,OAAO,CAAC;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAOvE,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAmC1C,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE7C,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAE5C,MAAM,MAAM,SAAS,GAAG;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,cAAc,EAAE,SAAS,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;IACnD;;OAEG;IACH,aAAa,EAAE,UAAU,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAChC;;OAEG;IACH,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,aAAa,CAAC,MAAM,CAAC,K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CAAC;AAEF,eAAO,MAAM,IAAI;8OAiBd,SAAS;;CAsKX,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/vhs v2.77.1-beta.
|
|
3
|
+
* @license @wistia/vhs v2.77.1-beta.9f7e339d.a5c2ee7
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2021-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -1626,7 +1626,7 @@
|
|
|
1626
1626
|
`,IU=(0,rl.default)(fT)`
|
|
1627
1627
|
cursor: pointer;
|
|
1628
1628
|
text-decoration: underline;
|
|
1629
|
-
`,kU=e=>{let t="error";return e>1&&(t+="s"),`${e} ${t} found on page`},VU=e=>{document.getElementById(`fieldset-${e}`)?.scrollIntoView({behavior:"smooth"})},NU=({errors:e={},statusError:t})=>(0,yo.jsxs)(MU,{children:[be(t)?(0,yo.jsx)(fT,{children:t}):null,Object.keys(e).map(r=>(0,yo.jsx)("li",{children:(0,yo.jsx)(IU,{"data-testid":`form-global-error-${r}`,onClick:n=>{n.preventDefault(),VU(r)},children:e[r]})},r))]}),yc=(0,cT.forwardRef)((e,t)=>{let r=ui(),{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 _n(s)?(0,yo.jsxs)(BU,{ref:t,children:[(0,yo.jsx)(OU,{children:kU(a)}),(0,yo.jsx)(NU,{errors:o,statusError:n})]}):null});yc.displayName="FormGlobalError_VHS";i();i();var pT=require("react");var nl=()=>(0,pT.useContext)(id);i();i();var dT=require("react");i();i();var sn=require("react"),f5=(e,t=0)=>{let r=(0,sn.useRef)(!1),n=(0,sn.useRef)(),o=(0,sn.useRef)(e),a=(0,sn.useCallback)(()=>r.current,[]),s=(0,sn.useCallback)(()=>{r.current=!1,n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{r.current=!0,o.current()},t)},[t]),l=(0,sn.useCallback)(()=>{r.current=null,n.current&&clearTimeout(n.current)},[]);return(0,sn.useEffect)(()=>{o.current=e},[e]),(0,sn.useEffect)(()=>(s(),l),[t]),[a,l,s]};var p5=(e,t=0,r=[])=>{let[n,o,a]=f5(e,t);return(0,dT.useEffect)(a,r),[n,o]};var bc=require("react/jsx-runtime"),mT=(e,t)=>JSON.stringify(e)!==JSON.stringify(t),LU=(e,t)=>{let r={};return Object.keys(e).forEach(n=>{e[n]===null?te(t)&&te(t.fields)&&te(t.fields[n])&&t.fields[n]._type==="boolean"?r[n]=!1:r[n]=void 0:r[n]=e[n]}),r},d5=({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]=(0,mi.useState)(),[x,w]=(0,mi.useState)(),[D,T]=(0,mi.useState)(0),S=nl(),E=(W,I)=>{let L={};Object.keys(W).forEach($=>{let j=W[$],ee=te(m)&&te(m.fields[$])&&m.fields[$]._type==="string";if(j==null){L[$]=null;return}if(typeof j=="number"){L[$]=j;return}j===!1&&(L[$]=!1),ee&&!j&&(L[$]=null),j&&(L[$]=ee?j.trim():j)}),o(L,I)},R=a&&(vt(b)||!b)&&(vt(x)||!x)&&te(g.current?.scrollIntoView);(0,mi.useEffect)(()=>{let W=document.querySelector(`form[data-testid="${r}"]`);if((vt(b)||!b)&&te(x)&&x&&W?.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=LU(n,m),k=750;return(0,bc.jsx)($D,{enableReinitialize:!0,initialValues:B,innerRef:F(h)?h:()=>{},onSubmit:E,validate:F(c)?c:()=>{},validateOnBlur:p,validateOnChange:d,validationSchema:m,children:W=>{let[I,L]=(0,mi.useState)(W.values);if((0,mi.useEffect)(()=>{te(s)&&s(W),y(W.isSubmitting),w(W.isValid),T(Object.keys(W.errors).length),u&&mT(W.values,I)&&L(W.values)},[W,I]),u){let[,]=p5(()=>{mT(n,I)&&W.submitForm()},k,[I])}return(0,bc.jsxs)(V3,{className:t,"data-testid":r,noValidate:!0,style:l,children:[v?(0,bc.jsx)(yc,{ref:g}):null,e]})}})};d5.displayName="Form_VHS";i();i();i();i();var hT=require("react/jsx-runtime"),E1=({type:e="submit",isSubmitting:t=!1,children:r,disabled:n=!1,...o})=>(0,hT.jsx)(nt,{disabled:t||n,type:e,...o,children:r});E1.displayName="FormConnectorButton_VHS";var m5=require("react/jsx-runtime"),$U=e=>e.preventDefault(),h5=({buttons:e,align:t="left",...r})=>{let{isSubmitting:n}=ui();return(0,m5.jsx)(po,{align:t,...r,children:e.map(({name:o,type:a,...s})=>(0,m5.jsx)(E1,{isSubmitting:n,type:a,...s,onMouseDown:$U,children:o},o))})};h5.displayName="FormButtons_VHS";i();i();var aF=require("react"),e6=V(require("styled-components"));i();var gT={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 vT=require("react/jsx-runtime"),T1=({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(zn(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(0,vT.jsx)(gc,{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})};T1.displayName="FormConnectorCheckboxGroup_VHS";i();i();var g5=require("react/jsx-runtime"),P1=({customComponent:e,field:t,form:r,label:n="",labelDescription:o,labelProps:a={},...s})=>{let{name:l}=t,{errors:u}=r;return(0,g5.jsx)(ar,{error:te(u)?u[l]:void 0,label:n,labelDescription:o,labelProps:a,name:l,children:(0,g5.jsx)(e,{field:t,form:r,...s})})};P1.displayName="FormConnectorCustomField_VHS";i();i();i();i();var il=require("react"),xT=V(require("styled-components"));i();var Rn=V(require("styled-components"));var yT=Rn.css`
|
|
1629
|
+
`,kU=e=>{let t="error";return e>1&&(t+="s"),`${e} ${t} found on page`},VU=e=>{document.getElementById(`fieldset-${e}`)?.scrollIntoView({behavior:"smooth"})},NU=({errors:e={},statusError:t})=>(0,yo.jsxs)(MU,{children:[be(t)?(0,yo.jsx)(fT,{children:t}):null,Object.keys(e).map(r=>(0,yo.jsx)("li",{children:(0,yo.jsx)(IU,{"data-testid":`form-global-error-${r}`,onClick:n=>{n.preventDefault(),VU(r)},children:e[r]})},r))]}),yc=(0,cT.forwardRef)((e,t)=>{let r=ui(),{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 _n(s)?(0,yo.jsxs)(BU,{ref:t,children:[(0,yo.jsx)(OU,{children:kU(a)}),(0,yo.jsx)(NU,{errors:o,statusError:n})]}):null});yc.displayName="FormGlobalError_VHS";i();i();var pT=require("react");var nl=()=>(0,pT.useContext)(id);i();i();var dT=require("react");i();i();var sn=require("react"),f5=(e,t=0)=>{let r=(0,sn.useRef)(!1),n=(0,sn.useRef)(),o=(0,sn.useRef)(e),a=(0,sn.useCallback)(()=>r.current,[]),s=(0,sn.useCallback)(()=>{r.current=!1,n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{r.current=!0,o.current()},t)},[t]),l=(0,sn.useCallback)(()=>{r.current=null,n.current&&clearTimeout(n.current)},[]);return(0,sn.useEffect)(()=>{o.current=e},[e]),(0,sn.useEffect)(()=>(s(),l),[t]),[a,l,s]};var p5=(e,t=0,r=[])=>{let[n,o,a]=f5(e,t);return(0,dT.useEffect)(a,r),[n,o]};var bc=require("react/jsx-runtime"),mT=(e,t)=>JSON.stringify(e)!==JSON.stringify(t),LU=(e,t)=>{let r={};return Object.keys(e).forEach(n=>{e[n]===null?te(t)&&te(t.fields)&&te(t.fields[n])&&t.fields[n]._type==="boolean"?r[n]=!1:r[n]=void 0:r[n]=e[n]}),r},d5=({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]=(0,mi.useState)(),[x,w]=(0,mi.useState)(),[D,T]=(0,mi.useState)(0),S=nl(),E=(W,I)=>{let L={};Object.keys(W).forEach($=>{let j=W[$],ee=te(m)&&te(m.fields[$])&&m.fields[$]._type==="string";if(j==null){L[$]=null;return}if(typeof j=="number"){L[$]=j;return}j===!1&&(L[$]=!1),ee&&!j&&(L[$]=null),j&&(L[$]=ee?j.trim():j)}),o(L,I)},R=a&&(vt(b)||!b)&&(vt(x)||!x)&&te(g.current?.scrollIntoView);(0,mi.useEffect)(()=>{let W=document.querySelector(`form[data-testid="${r}"]`);if((vt(b)||!b)&&te(x)&&x&&W?.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=LU(n,m),k=750;return(0,bc.jsx)($D,{enableReinitialize:!0,initialValues:B,innerRef:F(h)?h:()=>{},onSubmit:E,validate:F(c)?c:()=>{},validateOnBlur:p,validateOnChange:d,validationSchema:m,children:W=>{let[I,L]=(0,mi.useState)(W.values);if((0,mi.useEffect)(()=>{te(s)&&s(W),y(W.isSubmitting),w(W.isValid),T(Object.keys(W.errors).length),u&&mT(W.values,I)&&L(W.values)},[W,I]),u){let[,]=p5(()=>{mT(n,I)&&W.submitForm()},k,[I])}return(0,bc.jsxs)(V3,{className:t,"data-testid":r,noValidate:!0,style:l,children:[v?(0,bc.jsx)(yc,{ref:g}):null,e]})}})};d5.displayName="Form_VHS";i();i();i();i();var hT=require("react/jsx-runtime"),E1=({type:e="submit",isSubmitting:t=!1,children:r,disabled:n=!1,...o})=>(0,hT.jsx)(nt,{disabled:t||n,type:e,...o,children:r});E1.displayName="FormConnectorButton_VHS";var m5=require("react/jsx-runtime"),$U=e=>e.preventDefault(),h5=({buttons:e,align:t="left",...r})=>{let{isSubmitting:n}=ui();return(0,m5.jsx)(po,{align:t,...r,children:e.map(({name:o,type:a,...s})=>(0,m5.jsx)(E1,{isSubmitting:n,type:a,...s,onMouseDown:$U,children:o},o))})};h5.displayName="FormButtons_VHS";i();i();var aF=require("react"),e6=V(require("styled-components"));i();var gT={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 vT=require("react/jsx-runtime"),T1=({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(zn(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(0,vT.jsx)(gc,{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})};T1.displayName="FormConnectorCheckboxGroup_VHS";i();i();var g5=require("react/jsx-runtime"),P1=({customComponent:e,field:t,form:r,label:n="",labelDescription:o,labelProps:a={},...s})=>{let{name:l}=t,{errors:u}=r;return(0,g5.jsx)(ar,{error:te(u)?u[l]:void 0,label:n,labelDescription:o,labelProps:a,name:l,children:(0,g5.jsx)(e,{field:t,form:r,...s})})};P1.displayName="FormConnectorCustomField_VHS";i();i();i();i();var il=require("react"),xT=V(require("styled-components"));i();var Rn=V(require("styled-components"));var yT=Rn.css`
|
|
1630
1630
|
border-color: ${({theme:e})=>e.color.brandBlue500};
|
|
1631
1631
|
outline: none;
|
|
1632
1632
|
`,zU=Rn.css`
|