@volvo-cars/react-forms
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -1,2 +0,2 @@ | ||
import{useState as $}from"react";import{jsx as K}from"react/jsx-runtime";function v({children:e,id:a,className:o=""}){return K("p",{id:a,className:`micro text-feedback-red empty:hidden ${o}`.trim(),role:"alert",children:e})}import{jsx as O}from"react/jsx-runtime";function c({children:e,id:a,className:o=""}){return O("p",{id:a,className:`micro text-secondary ${o}`.trim(),children:e})}import{useId as _}from"react";function m(e){let a=_();return{inputId:e||a+"-input",errorId:a+"-error",hintId:a+"-hint"}}import{jsx as L,jsxs as Q}from"react/jsx-runtime";function J({hint:e,id:a,label:o,hidden:P,dir:f,errorMessage:r,lang:g,translate:x,slot:s,value:d,defaultValue:n,isValid:i,...l}){let[t,p]=$(!d&&!n);function C(u){let{validity:H}=u.currentTarget,T=u.currentTarget.required;T||(u.currentTarget.required=!0),p(H.valueMissing&&!H.badInput),T||(u.currentTarget.required=!1)}let{inputId:I,errorId:h,hintId:y}=m(a),b=l["aria-invalid"]||i===!1||!!r;return Q("div",{className:"v-input-floating-label",hidden:P,dir:f,lang:g,translate:x,slot:s,children:[L("label",{htmlFor:I,children:o}),L("input",{...l,type:"date",id:I,value:d,defaultValue:n,onBlur:u=>{l.onBlur?.(u),C(u)},onChange:u=>{l.onChange?.(u),C(u)},"data-blank":t?"":void 0,"aria-invalid":b?!0:void 0,"aria-errormessage":r?h:void 0,"aria-describedby":e?y:void 0}),L(v,{id:h,className:"mt-4",children:r}),e&&L(c,{id:y,className:"mt-4",children:e})]})}import{useState as W}from"react";import{jsx as M,jsxs as G}from"react/jsx-runtime";function X({hint:e,id:a,label:o,hidden:P,dir:f,errorMessage:r,lang:g,translate:x,slot:s,defaultPasswordVisible:d=!1,showPasswordLabel:n,hidePasswordLabel:i,isValid:l,...t}){let[p,C]=W(d),{inputId:I,errorId:h,hintId:y}=m(a),b=t["aria-invalid"]||!!r;return G("div",{className:"v-input-floating-label",hidden:P,dir:f,lang:g,translate:x,slot:s,children:[M("label",{htmlFor:I,children:o}),G("div",{className:"v-input","data-input-delegate":!0,"aria-invalid":b?!0:void 0,children:[M("input",{...t,id:I,autoCorrect:"off",spellCheck:"false",autoCapitalize:"none",className:"bg-transparent",type:p?"text":"password","aria-invalid":b?!0:void 0,"aria-errormessage":b?h:void 0,"aria-describedby":e?y:void 0}),M("button",{type:"button",className:"v-input__password-visibility-control",...n&&i?{"aria-label":p?i:n,"aria-controls":I}:{"aria-hidden":!0,tabIndex:-1},onClick:()=>C(u=>!u)})]}),M(v,{id:h,className:"mt-4",children:r}),e&&M(c,{id:y,className:"mt-4",children:e})]})}import{jsx as U,jsxs as Z}from"react/jsx-runtime";function Y(e){return U(R,{...e,type:"text"})}function R({hint:e,id:a,label:o,hidden:P,dir:f,errorMessage:r,lang:g,translate:x,slot:s,isValid:d,...n}){let{inputId:i,errorId:l,hintId:t}=m(a),p=n["aria-invalid"]||d===!1||!!r;return Z("div",{className:"v-input-floating-label",hidden:P,dir:f,lang:g,translate:x,slot:s,children:[U("label",{htmlFor:i,children:o}),U("input",{placeholder:" ",...n,id:i,"aria-invalid":p?!0:void 0,"aria-errormessage":r?l:void 0,"aria-describedby":e?t:void 0}),U(v,{id:l,className:"mt-4",children:r}),e&&U(c,{id:t,className:"mt-4",children:e})]})}import{jsx as ee}from"react/jsx-runtime";function j(e){return ee(R,{...e,type:"email",inputMode:"email"})}import{jsx as te}from"react/jsx-runtime";function re(e){return te(R,{...e,type:"tel"})}import{jsx as ne}from"react/jsx-runtime";function oe(e){return ne(R,{...e,type:"url",inputMode:"url"})}import{Children as ae,isValidElement as le,useState as se}from"react";import{jsx as B,jsxs as S}from"react/jsx-runtime";function ie({hint:e,id:a,label:o,hidden:P,dir:f,errorMessage:r,lang:g,translate:x,slot:s,value:d,defaultValue:n,children:i,isValid:l,...t}){let p=!1;ae.forEach(i,E=>{le(E)&&E.type==="option"&&E.props.value===""&&(p=!0)});let[C,I]=se(!n),h=typeof d=="string",{inputId:y,errorId:b,hintId:u}=m(a),H=t["aria-invalid"]||l===!1||!!r,T=!p&&(h?!d:C);return S("div",{className:"v-input-floating-label",hidden:P,dir:f,lang:g,translate:x,slot:s,children:[B("label",{htmlFor:y,children:o}),S("select",{...t,id:y,onChange:h||p?t.onChange:E=>{t.onChange?.(E),I(!E.target.value)},value:d,defaultValue:n,"data-blank":T?"":void 0,"aria-invalid":H?"true":void 0,"aria-errormessage":r?b:void 0,"aria-describedby":e?u:void 0,children:[!n&&!p&&B("option",{value:"",hidden:!T,disabled:!T}),i]}),B(v,{id:b,className:"mt-4",children:r}),e&&B(c,{id:u,className:"mt-4",children:e})]})}import{jsx as k,jsxs as D}from"react/jsx-runtime";function pe({label:e,id:a,hint:o,hidden:P,dir:f,lang:r,translate:g,slot:x,errorMessage:s,isValid:d,...n}){let{inputId:i,hintId:l,errorId:t}=m(a),p=n["aria-invalid"]||d===!1||!!s;return D("div",{className:"flex-row",hidden:P,dir:f,lang:r,translate:g,slot:x,children:[k("input",{...n,type:"checkbox",id:i,"aria-invalid":p?!0:void 0,"aria-errormessage":s?t:void 0,"aria-describedby":o?l:void 0}),D("div",{className:"flex-col stack-4 ml-8",children:[k("label",{htmlFor:i,children:e}),k(v,{id:t,children:s}),o&&k(c,{id:l,children:o})]})]})}import{useContext as ce}from"react";import{createContext as de}from"react";import{jsx as N,jsxs as F}from"react/jsx-runtime";function ue({legend:e,id:a,hint:o,name:P,children:f,required:r,defaultValue:g,value:x,hidden:s,dir:d,lang:n,translate:i,slot:l,errorMessage:t,onChange:p,form:C,enterKeyHint:I,readOnly:h,isValid:y,...b}){let{inputId:u,hintId:H,errorId:T}=m(a),E=b["aria-invalid"]||y===!1||!!t;return F("fieldset",{...b,hidden:s,dir:d,lang:n,translate:i,slot:l,form:C,id:u,role:"radiogroup","aria-invalid":E?!0:void 0,"aria-errormessage":t?T:void 0,"aria-describedby":o?H:void 0,"aria-required":r?!0:void 0,children:[N("legend",{className:"mb-4",children:e}),o&&N(c,{id:H,className:"mb-16",children:o}),F("div",{className:"stack-8",hidden:s,children:[N(v,{id:T,className:"mb-16",children:t}),N(q,{value:{defaultValue:g,enterKeyHint:I,form:C,name:P,onChange:p,readOnly:h,required:r,value:x},children:f})]})]})}var A=de({}),q=A.Provider;import{jsx as V,jsxs as z}from"react/jsx-runtime";function me({label:e,id:a,hint:o,hidden:P,dir:f,lang:r,translate:g,slot:x,value:s,...d}){let{inputId:n,hintId:i}=m(a),{value:l,defaultValue:t,...p}=ce(A),C,I;return typeof l<"u"?C=s===l:typeof t<"u"&&s===t&&(I=!0),z("div",{className:"flex-row",hidden:P,dir:f,lang:r,translate:g,slot:x,children:[V("input",{...d,...p,checked:C,defaultChecked:I,type:"radio",id:n,value:s}),o?z("div",{className:"flex-col stack-4 ml-8",children:[V("label",{htmlFor:n,children:e}),V(c,{id:i,children:o})]}):V("label",{htmlFor:n,className:"ml-8",children:e})]})}import{jsx as w,jsxs as fe}from"react/jsx-runtime";function Pe({hint:e,id:a,label:o,hidden:P,dir:f,errorMessage:r,lang:g,translate:x,slot:s,isValid:d,...n}){let{inputId:i,errorId:l,hintId:t}=m(a),p=n["aria-invalid"]||d===!1||!!r;return fe("div",{className:"v-input-floating-label",hidden:P,dir:f,lang:g,translate:x,slot:s,children:[w("label",{htmlFor:i,children:o}),w("textarea",{placeholder:" ",...n,id:i,"aria-invalid":p?!0:void 0,"aria-errormessage":r?l:void 0,"aria-describedby":e?t:void 0}),w(v,{id:l,className:"mb-4",children:r}),e&&w(c,{id:t,className:"mt-4",children:e})]})}export{pe as Checkbox,J as DateInput,j as EmailInput,v as ErrorMessage,c as Hint,X as PasswordInput,me as Radio,q as RadioContextProvider,ue as RadioGroup,ie as Select,re as TelInput,Pe as TextArea,Y as TextInput,oe as UrlInput}; | ||
import{useState as $}from"react";import{jsx as K}from"react/jsx-runtime";function v({children:e,id:a,className:o=""}){return K("p",{id:a,className:`micro text-feedback-red empty:hidden ${o}`.trim(),role:"alert",children:e})}import{jsx as O}from"react/jsx-runtime";function c({children:e,id:a,className:o=""}){return O("p",{id:a,className:`micro text-secondary ${o}`.trim(),children:e})}import{useId as _}from"react";function m(e){let a=_();return{inputId:e||a+"-input",errorId:a+"-error",hintId:a+"-hint"}}import{jsx as L,jsxs as Q}from"react/jsx-runtime";function J({hint:e,id:a,label:o,hidden:P,dir:f,errorMessage:r,lang:g,translate:x,slot:s,value:d,defaultValue:n,isValid:i,...l}){let[t,p]=$(!d&&!n);function C(u){let{validity:H}=u.currentTarget,T=u.currentTarget.required;T||(u.currentTarget.required=!0),p(H.valueMissing&&!H.badInput),T||(u.currentTarget.required=!1)}let{inputId:I,errorId:h,hintId:y}=m(a),b=l["aria-invalid"]||i===!1||!!r;return Q("div",{className:"v-input-floating-label",hidden:P,dir:f,lang:g,translate:x,slot:s,children:[L("label",{htmlFor:I,children:o}),L("input",{...l,type:"date",id:I,value:d,defaultValue:n,onBlur:u=>{l.onBlur?.(u),C(u)},onChange:u=>{l.onChange?.(u),C(u)},"data-blank":t?"":void 0,"aria-invalid":b?!0:void 0,"aria-errormessage":r?h:void 0,"aria-describedby":e?y:void 0}),L(v,{id:h,className:"mt-4",children:r}),e&&L(c,{id:y,className:"mt-4",children:e})]})}import{useState as W}from"react";import{jsx as M,jsxs as S}from"react/jsx-runtime";function X({hint:e,id:a,label:o,hidden:P,dir:f,errorMessage:r,lang:g,translate:x,slot:s,defaultPasswordVisible:d=!1,showPasswordLabel:n,hidePasswordLabel:i,isValid:l,...t}){let[p,C]=W(d),{inputId:I,errorId:h,hintId:y}=m(a),b=t["aria-invalid"]||!!r;return S("div",{className:"v-input-floating-label",hidden:P,dir:f,lang:g,translate:x,slot:s,children:[M("label",{htmlFor:I,children:o}),S("div",{className:"v-input","data-input-delegate":!0,"aria-invalid":b?!0:void 0,children:[M("input",{placeholder:" ",...t,id:I,autoCorrect:"off",spellCheck:"false",autoCapitalize:"none",className:"bg-transparent",type:p?"text":"password","aria-invalid":b?!0:void 0,"aria-errormessage":b?h:void 0,"aria-describedby":e?y:void 0}),M("button",{type:"button",className:"v-input__password-visibility-control",...n&&i?{"aria-label":p?i:n,"aria-controls":I}:{"aria-hidden":!0,tabIndex:-1},onClick:()=>C(u=>!u)})]}),M(v,{id:h,className:"mt-4",children:r}),e&&M(c,{id:y,className:"mt-4",children:e})]})}import{jsx as U,jsxs as Z}from"react/jsx-runtime";function Y(e){return U(R,{...e,type:"text"})}function R({hint:e,id:a,label:o,hidden:P,dir:f,errorMessage:r,lang:g,translate:x,slot:s,isValid:d,...n}){let{inputId:i,errorId:l,hintId:t}=m(a),p=n["aria-invalid"]||d===!1||!!r;return Z("div",{className:"v-input-floating-label",hidden:P,dir:f,lang:g,translate:x,slot:s,children:[U("label",{htmlFor:i,children:o}),U("input",{placeholder:" ",...n,id:i,"aria-invalid":p?!0:void 0,"aria-errormessage":r?l:void 0,"aria-describedby":e?t:void 0}),U(v,{id:l,className:"mt-4",children:r}),e&&U(c,{id:t,className:"mt-4",children:e})]})}import{jsx as ee}from"react/jsx-runtime";function j(e){return ee(R,{...e,type:"email",inputMode:"email"})}import{jsx as te}from"react/jsx-runtime";function re(e){return te(R,{...e,type:"tel"})}import{jsx as ne}from"react/jsx-runtime";function oe(e){return ne(R,{...e,type:"url",inputMode:"url"})}import{Children as ae,isValidElement as le,useState as se}from"react";import{jsx as B,jsxs as G}from"react/jsx-runtime";function ie({hint:e,id:a,label:o,hidden:P,dir:f,errorMessage:r,lang:g,translate:x,slot:s,value:d,defaultValue:n,children:i,isValid:l,...t}){let p=!1;ae.forEach(i,E=>{le(E)&&E.type==="option"&&E.props.value===""&&(p=!0)});let[C,I]=se(!n),h=typeof d=="string",{inputId:y,errorId:b,hintId:u}=m(a),H=t["aria-invalid"]||l===!1||!!r,T=!p&&(h?!d:C);return G("div",{className:"v-input-floating-label",hidden:P,dir:f,lang:g,translate:x,slot:s,children:[B("label",{htmlFor:y,children:o}),G("select",{...t,id:y,onChange:h||p?t.onChange:E=>{t.onChange?.(E),I(!E.target.value)},value:d,defaultValue:n,"data-blank":T?"":void 0,"aria-invalid":H?"true":void 0,"aria-errormessage":r?b:void 0,"aria-describedby":e?u:void 0,children:[!n&&!p&&B("option",{value:"",hidden:!T,disabled:!T}),i]}),B(v,{id:b,className:"mt-4",children:r}),e&&B(c,{id:u,className:"mt-4",children:e})]})}import{jsx as k,jsxs as D}from"react/jsx-runtime";function pe({label:e,id:a,hint:o,hidden:P,dir:f,lang:r,translate:g,slot:x,errorMessage:s,isValid:d,...n}){let{inputId:i,hintId:l,errorId:t}=m(a),p=n["aria-invalid"]||d===!1||!!s;return D("div",{className:"flex-row",hidden:P,dir:f,lang:r,translate:g,slot:x,children:[k("input",{...n,type:"checkbox",id:i,"aria-invalid":p?!0:void 0,"aria-errormessage":s?t:void 0,"aria-describedby":o?l:void 0}),D("div",{className:"flex-col stack-4 ml-8",children:[k("label",{htmlFor:i,children:e}),k(v,{id:t,children:s}),o&&k(c,{id:l,children:o})]})]})}import{useContext as ce}from"react";import{createContext as de}from"react";import{jsx as N,jsxs as F}from"react/jsx-runtime";function ue({legend:e,id:a,hint:o,name:P,children:f,required:r,defaultValue:g,value:x,hidden:s,dir:d,lang:n,translate:i,slot:l,errorMessage:t,onChange:p,form:C,enterKeyHint:I,readOnly:h,isValid:y,...b}){let{inputId:u,hintId:H,errorId:T}=m(a),E=b["aria-invalid"]||y===!1||!!t;return F("fieldset",{...b,hidden:s,dir:d,lang:n,translate:i,slot:l,form:C,id:u,role:"radiogroup","aria-invalid":E?!0:void 0,"aria-errormessage":t?T:void 0,"aria-describedby":o?H:void 0,"aria-required":r?!0:void 0,children:[N("legend",{className:"mb-4",children:e}),o&&N(c,{id:H,className:"mb-16",children:o}),F("div",{className:"stack-8",hidden:s,children:[N(v,{id:T,className:"mb-16",children:t}),N(q,{value:{defaultValue:g,enterKeyHint:I,form:C,name:P,onChange:p,readOnly:h,required:r,value:x},children:f})]})]})}var A=de({}),q=A.Provider;import{jsx as w,jsxs as z}from"react/jsx-runtime";function me({label:e,id:a,hint:o,hidden:P,dir:f,lang:r,translate:g,slot:x,value:s,...d}){let{inputId:n,hintId:i}=m(a),{value:l,defaultValue:t,...p}=ce(A),C,I;return typeof l<"u"?C=s===l:typeof t<"u"&&s===t&&(I=!0),z("div",{className:"flex-row",hidden:P,dir:f,lang:r,translate:g,slot:x,children:[w("input",{...d,...p,checked:C,defaultChecked:I,type:"radio",id:n,value:s}),o?z("div",{className:"flex-col stack-4 ml-8",children:[w("label",{htmlFor:n,children:e}),w(c,{id:i,children:o})]}):w("label",{htmlFor:n,className:"ml-8",children:e})]})}import{jsx as V,jsxs as fe}from"react/jsx-runtime";function Pe({hint:e,id:a,label:o,hidden:P,dir:f,errorMessage:r,lang:g,translate:x,slot:s,isValid:d,...n}){let{inputId:i,errorId:l,hintId:t}=m(a),p=n["aria-invalid"]||d===!1||!!r;return fe("div",{className:"v-input-floating-label",hidden:P,dir:f,lang:g,translate:x,slot:s,children:[V("label",{htmlFor:i,children:o}),V("textarea",{placeholder:" ",...n,id:i,"aria-invalid":p?!0:void 0,"aria-errormessage":r?l:void 0,"aria-describedby":e?t:void 0}),V(v,{id:l,className:"mb-4",children:r}),e&&V(c,{id:t,className:"mt-4",children:e})]})}export{pe as Checkbox,J as DateInput,j as EmailInput,v as ErrorMessage,c as Hint,X as PasswordInput,me as Radio,q as RadioContextProvider,ue as RadioGroup,ie as Select,re as TelInput,Pe as TextArea,Y as TextInput,oe as UrlInput}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
var G=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var pe=Object.prototype.hasOwnProperty;var de=(e,r)=>{for(var t in r)G(e,t,{get:r[t],enumerable:!0})},ue=(e,r,t,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of ie(r))!pe.call(e,l)&&l!==t&&G(e,l,{get:()=>r[l],enumerable:!(u=se(r,l))||u.enumerable});return e};var ce=e=>ue(G({},"__esModule",{value:!0}),e);var me={};de(me,{Checkbox:()=>re,DateInput:()=>O,EmailInput:()=>Q,ErrorMessage:()=>f,Hint:()=>m,PasswordInput:()=>$,Radio:()=>ae,RadioContextProvider:()=>D,RadioGroup:()=>oe,Select:()=>ee,TelInput:()=>X,TextArea:()=>le,TextInput:()=>J,UrlInput:()=>Z});module.exports=ce(me);var K=require("react");var F=require("react/jsx-runtime");function f({children:e,id:r,className:t=""}){return(0,F.jsx)("p",{id:r,className:`micro text-feedback-red empty:hidden ${t}`.trim(),role:"alert",children:e})}var q=require("react/jsx-runtime");function m({children:e,id:r,className:t=""}){return(0,q.jsx)("p",{id:r,className:`micro text-secondary ${t}`.trim(),children:e})}var z=require("react");function g(e){let r=(0,z.useId)();return{inputId:e||r+"-input",errorId:r+"-error",hintId:r+"-hint"}}var N=require("react/jsx-runtime");function O({hint:e,id:r,label:t,hidden:u,dir:l,errorMessage:o,lang:x,translate:v,slot:i,value:c,defaultValue:a,isValid:p,...s}){let[n,d]=(0,K.useState)(!c&&!a);function C(P){let{validity:k}=P.currentTarget,T=P.currentTarget.required;T||(P.currentTarget.required=!0),d(k.valueMissing&&!k.badInput),T||(P.currentTarget.required=!1)}let{inputId:I,errorId:h,hintId:y}=g(r),b=s["aria-invalid"]||p===!1||!!o;return(0,N.jsxs)("div",{className:"v-input-floating-label",hidden:u,dir:l,lang:x,translate:v,slot:i,children:[(0,N.jsx)("label",{htmlFor:I,children:t}),(0,N.jsx)("input",{...s,type:"date",id:I,value:c,defaultValue:a,onBlur:P=>{s.onBlur?.(P),C(P)},onChange:P=>{s.onChange?.(P),C(P)},"data-blank":n?"":void 0,"aria-invalid":b?!0:void 0,"aria-errormessage":o?h:void 0,"aria-describedby":e?y:void 0}),(0,N.jsx)(f,{id:h,className:"mt-4",children:o}),e&&(0,N.jsx)(m,{id:y,className:"mt-4",children:e})]})}var _=require("react");var E=require("react/jsx-runtime");function $({hint:e,id:r,label:t,hidden:u,dir:l,errorMessage:o,lang:x,translate:v,slot:i,defaultPasswordVisible:c=!1,showPasswordLabel:a,hidePasswordLabel:p,isValid:s,...n}){let[d,C]=(0,_.useState)(c),{inputId:I,errorId:h,hintId:y}=g(r),b=n["aria-invalid"]||!!o;return(0,E.jsxs)("div",{className:"v-input-floating-label",hidden:u,dir:l,lang:x,translate:v,slot:i,children:[(0,E.jsx)("label",{htmlFor:I,children:t}),(0,E.jsxs)("div",{className:"v-input","data-input-delegate":!0,"aria-invalid":b?!0:void 0,children:[(0,E.jsx)("input",{...n,id:I,autoCorrect:"off",spellCheck:"false",autoCapitalize:"none",className:"bg-transparent",type:d?"text":"password","aria-invalid":b?!0:void 0,"aria-errormessage":b?h:void 0,"aria-describedby":e?y:void 0}),(0,E.jsx)("button",{type:"button",className:"v-input__password-visibility-control",...a&&p?{"aria-label":d?p:a,"aria-controls":I}:{"aria-hidden":!0,tabIndex:-1},onClick:()=>C(P=>!P)})]}),(0,E.jsx)(f,{id:h,className:"mt-4",children:o}),e&&(0,E.jsx)(m,{id:y,className:"mt-4",children:e})]})}var R=require("react/jsx-runtime");function J(e){return(0,R.jsx)(V,{...e,type:"text"})}function V({hint:e,id:r,label:t,hidden:u,dir:l,errorMessage:o,lang:x,translate:v,slot:i,isValid:c,...a}){let{inputId:p,errorId:s,hintId:n}=g(r),d=a["aria-invalid"]||c===!1||!!o;return(0,R.jsxs)("div",{className:"v-input-floating-label",hidden:u,dir:l,lang:x,translate:v,slot:i,children:[(0,R.jsx)("label",{htmlFor:p,children:t}),(0,R.jsx)("input",{placeholder:" ",...a,id:p,"aria-invalid":d?!0:void 0,"aria-errormessage":o?s:void 0,"aria-describedby":e?n:void 0}),(0,R.jsx)(f,{id:s,className:"mt-4",children:o}),e&&(0,R.jsx)(m,{id:n,className:"mt-4",children:e})]})}var W=require("react/jsx-runtime");function Q(e){return(0,W.jsx)(V,{...e,type:"email",inputMode:"email"})}var Y=require("react/jsx-runtime");function X(e){return(0,Y.jsx)(V,{...e,type:"tel"})}var j=require("react/jsx-runtime");function Z(e){return(0,j.jsx)(V,{...e,type:"url",inputMode:"url"})}var A=require("react");var M=require("react/jsx-runtime");function ee({hint:e,id:r,label:t,hidden:u,dir:l,errorMessage:o,lang:x,translate:v,slot:i,value:c,defaultValue:a,children:p,isValid:s,...n}){let d=!1;A.Children.forEach(p,H=>{(0,A.isValidElement)(H)&&H.type==="option"&&H.props.value===""&&(d=!0)});let[C,I]=(0,A.useState)(!a),h=typeof c=="string",{inputId:y,errorId:b,hintId:P}=g(r),k=n["aria-invalid"]||s===!1||!!o,T=!d&&(h?!c:C);return(0,M.jsxs)("div",{className:"v-input-floating-label",hidden:u,dir:l,lang:x,translate:v,slot:i,children:[(0,M.jsx)("label",{htmlFor:y,children:t}),(0,M.jsxs)("select",{...n,id:y,onChange:h||d?n.onChange:H=>{n.onChange?.(H),I(!H.target.value)},value:c,defaultValue:a,"data-blank":T?"":void 0,"aria-invalid":k?"true":void 0,"aria-errormessage":o?b:void 0,"aria-describedby":e?P:void 0,children:[!a&&!d&&(0,M.jsx)("option",{value:"",hidden:!T,disabled:!T}),p]}),(0,M.jsx)(f,{id:b,className:"mt-4",children:o}),e&&(0,M.jsx)(m,{id:P,className:"mt-4",children:e})]})}var U=require("react/jsx-runtime");function re({label:e,id:r,hint:t,hidden:u,dir:l,lang:o,translate:x,slot:v,errorMessage:i,isValid:c,...a}){let{inputId:p,hintId:s,errorId:n}=g(r),d=a["aria-invalid"]||c===!1||!!i;return(0,U.jsxs)("div",{className:"flex-row",hidden:u,dir:l,lang:o,translate:x,slot:v,children:[(0,U.jsx)("input",{...a,type:"checkbox",id:p,"aria-invalid":d?!0:void 0,"aria-errormessage":i?n:void 0,"aria-describedby":t?s:void 0}),(0,U.jsxs)("div",{className:"flex-col stack-4 ml-8",children:[(0,U.jsx)("label",{htmlFor:p,children:e}),(0,U.jsx)(f,{id:n,children:i}),t&&(0,U.jsx)(m,{id:s,children:t})]})]})}var ne=require("react");var te=require("react");var L=require("react/jsx-runtime");function oe({legend:e,id:r,hint:t,name:u,children:l,required:o,defaultValue:x,value:v,hidden:i,dir:c,lang:a,translate:p,slot:s,errorMessage:n,onChange:d,form:C,enterKeyHint:I,readOnly:h,isValid:y,...b}){let{inputId:P,hintId:k,errorId:T}=g(r),H=b["aria-invalid"]||y===!1||!!n;return(0,L.jsxs)("fieldset",{...b,hidden:i,dir:c,lang:a,translate:p,slot:s,form:C,id:P,role:"radiogroup","aria-invalid":H?!0:void 0,"aria-errormessage":n?T:void 0,"aria-describedby":t?k:void 0,"aria-required":o?!0:void 0,children:[(0,L.jsx)("legend",{className:"mb-4",children:e}),t&&(0,L.jsx)(m,{id:k,className:"mb-16",children:t}),(0,L.jsxs)("div",{className:"stack-8",hidden:i,children:[(0,L.jsx)(f,{id:T,className:"mb-16",children:n}),(0,L.jsx)(D,{value:{defaultValue:x,enterKeyHint:I,form:C,name:u,onChange:d,readOnly:h,required:o,value:v},children:l})]})]})}var S=(0,te.createContext)({}),D=S.Provider;var B=require("react/jsx-runtime");function ae({label:e,id:r,hint:t,hidden:u,dir:l,lang:o,translate:x,slot:v,value:i,...c}){let{inputId:a,hintId:p}=g(r),{value:s,defaultValue:n,...d}=(0,ne.useContext)(S),C,I;return typeof s<"u"?C=i===s:typeof n<"u"&&i===n&&(I=!0),(0,B.jsxs)("div",{className:"flex-row",hidden:u,dir:l,lang:o,translate:x,slot:v,children:[(0,B.jsx)("input",{...c,...d,checked:C,defaultChecked:I,type:"radio",id:a,value:i}),t?(0,B.jsxs)("div",{className:"flex-col stack-4 ml-8",children:[(0,B.jsx)("label",{htmlFor:a,children:e}),(0,B.jsx)(m,{id:p,children:t})]}):(0,B.jsx)("label",{htmlFor:a,className:"ml-8",children:e})]})}var w=require("react/jsx-runtime");function le({hint:e,id:r,label:t,hidden:u,dir:l,errorMessage:o,lang:x,translate:v,slot:i,isValid:c,...a}){let{inputId:p,errorId:s,hintId:n}=g(r),d=a["aria-invalid"]||c===!1||!!o;return(0,w.jsxs)("div",{className:"v-input-floating-label",hidden:u,dir:l,lang:x,translate:v,slot:i,children:[(0,w.jsx)("label",{htmlFor:p,children:t}),(0,w.jsx)("textarea",{placeholder:" ",...a,id:p,"aria-invalid":d?!0:void 0,"aria-errormessage":o?s:void 0,"aria-describedby":e?n:void 0}),(0,w.jsx)(f,{id:s,className:"mb-4",children:o}),e&&(0,w.jsx)(m,{id:n,className:"mt-4",children:e})]})}0&&(module.exports={Checkbox,DateInput,EmailInput,ErrorMessage,Hint,PasswordInput,Radio,RadioContextProvider,RadioGroup,Select,TelInput,TextArea,TextInput,UrlInput}); | ||
var S=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var pe=Object.prototype.hasOwnProperty;var de=(e,r)=>{for(var t in r)S(e,t,{get:r[t],enumerable:!0})},ue=(e,r,t,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of ie(r))!pe.call(e,l)&&l!==t&&S(e,l,{get:()=>r[l],enumerable:!(u=se(r,l))||u.enumerable});return e};var ce=e=>ue(S({},"__esModule",{value:!0}),e);var me={};de(me,{Checkbox:()=>re,DateInput:()=>O,EmailInput:()=>Q,ErrorMessage:()=>f,Hint:()=>m,PasswordInput:()=>$,Radio:()=>ae,RadioContextProvider:()=>D,RadioGroup:()=>oe,Select:()=>ee,TelInput:()=>X,TextArea:()=>le,TextInput:()=>J,UrlInput:()=>Z});module.exports=ce(me);var K=require("react");var F=require("react/jsx-runtime");function f({children:e,id:r,className:t=""}){return(0,F.jsx)("p",{id:r,className:`micro text-feedback-red empty:hidden ${t}`.trim(),role:"alert",children:e})}var q=require("react/jsx-runtime");function m({children:e,id:r,className:t=""}){return(0,q.jsx)("p",{id:r,className:`micro text-secondary ${t}`.trim(),children:e})}var z=require("react");function g(e){let r=(0,z.useId)();return{inputId:e||r+"-input",errorId:r+"-error",hintId:r+"-hint"}}var N=require("react/jsx-runtime");function O({hint:e,id:r,label:t,hidden:u,dir:l,errorMessage:o,lang:x,translate:v,slot:i,value:c,defaultValue:a,isValid:p,...s}){let[n,d]=(0,K.useState)(!c&&!a);function C(P){let{validity:k}=P.currentTarget,T=P.currentTarget.required;T||(P.currentTarget.required=!0),d(k.valueMissing&&!k.badInput),T||(P.currentTarget.required=!1)}let{inputId:I,errorId:h,hintId:y}=g(r),b=s["aria-invalid"]||p===!1||!!o;return(0,N.jsxs)("div",{className:"v-input-floating-label",hidden:u,dir:l,lang:x,translate:v,slot:i,children:[(0,N.jsx)("label",{htmlFor:I,children:t}),(0,N.jsx)("input",{...s,type:"date",id:I,value:c,defaultValue:a,onBlur:P=>{s.onBlur?.(P),C(P)},onChange:P=>{s.onChange?.(P),C(P)},"data-blank":n?"":void 0,"aria-invalid":b?!0:void 0,"aria-errormessage":o?h:void 0,"aria-describedby":e?y:void 0}),(0,N.jsx)(f,{id:h,className:"mt-4",children:o}),e&&(0,N.jsx)(m,{id:y,className:"mt-4",children:e})]})}var _=require("react");var E=require("react/jsx-runtime");function $({hint:e,id:r,label:t,hidden:u,dir:l,errorMessage:o,lang:x,translate:v,slot:i,defaultPasswordVisible:c=!1,showPasswordLabel:a,hidePasswordLabel:p,isValid:s,...n}){let[d,C]=(0,_.useState)(c),{inputId:I,errorId:h,hintId:y}=g(r),b=n["aria-invalid"]||!!o;return(0,E.jsxs)("div",{className:"v-input-floating-label",hidden:u,dir:l,lang:x,translate:v,slot:i,children:[(0,E.jsx)("label",{htmlFor:I,children:t}),(0,E.jsxs)("div",{className:"v-input","data-input-delegate":!0,"aria-invalid":b?!0:void 0,children:[(0,E.jsx)("input",{placeholder:" ",...n,id:I,autoCorrect:"off",spellCheck:"false",autoCapitalize:"none",className:"bg-transparent",type:d?"text":"password","aria-invalid":b?!0:void 0,"aria-errormessage":b?h:void 0,"aria-describedby":e?y:void 0}),(0,E.jsx)("button",{type:"button",className:"v-input__password-visibility-control",...a&&p?{"aria-label":d?p:a,"aria-controls":I}:{"aria-hidden":!0,tabIndex:-1},onClick:()=>C(P=>!P)})]}),(0,E.jsx)(f,{id:h,className:"mt-4",children:o}),e&&(0,E.jsx)(m,{id:y,className:"mt-4",children:e})]})}var R=require("react/jsx-runtime");function J(e){return(0,R.jsx)(w,{...e,type:"text"})}function w({hint:e,id:r,label:t,hidden:u,dir:l,errorMessage:o,lang:x,translate:v,slot:i,isValid:c,...a}){let{inputId:p,errorId:s,hintId:n}=g(r),d=a["aria-invalid"]||c===!1||!!o;return(0,R.jsxs)("div",{className:"v-input-floating-label",hidden:u,dir:l,lang:x,translate:v,slot:i,children:[(0,R.jsx)("label",{htmlFor:p,children:t}),(0,R.jsx)("input",{placeholder:" ",...a,id:p,"aria-invalid":d?!0:void 0,"aria-errormessage":o?s:void 0,"aria-describedby":e?n:void 0}),(0,R.jsx)(f,{id:s,className:"mt-4",children:o}),e&&(0,R.jsx)(m,{id:n,className:"mt-4",children:e})]})}var W=require("react/jsx-runtime");function Q(e){return(0,W.jsx)(w,{...e,type:"email",inputMode:"email"})}var Y=require("react/jsx-runtime");function X(e){return(0,Y.jsx)(w,{...e,type:"tel"})}var j=require("react/jsx-runtime");function Z(e){return(0,j.jsx)(w,{...e,type:"url",inputMode:"url"})}var A=require("react");var M=require("react/jsx-runtime");function ee({hint:e,id:r,label:t,hidden:u,dir:l,errorMessage:o,lang:x,translate:v,slot:i,value:c,defaultValue:a,children:p,isValid:s,...n}){let d=!1;A.Children.forEach(p,H=>{(0,A.isValidElement)(H)&&H.type==="option"&&H.props.value===""&&(d=!0)});let[C,I]=(0,A.useState)(!a),h=typeof c=="string",{inputId:y,errorId:b,hintId:P}=g(r),k=n["aria-invalid"]||s===!1||!!o,T=!d&&(h?!c:C);return(0,M.jsxs)("div",{className:"v-input-floating-label",hidden:u,dir:l,lang:x,translate:v,slot:i,children:[(0,M.jsx)("label",{htmlFor:y,children:t}),(0,M.jsxs)("select",{...n,id:y,onChange:h||d?n.onChange:H=>{n.onChange?.(H),I(!H.target.value)},value:c,defaultValue:a,"data-blank":T?"":void 0,"aria-invalid":k?"true":void 0,"aria-errormessage":o?b:void 0,"aria-describedby":e?P:void 0,children:[!a&&!d&&(0,M.jsx)("option",{value:"",hidden:!T,disabled:!T}),p]}),(0,M.jsx)(f,{id:b,className:"mt-4",children:o}),e&&(0,M.jsx)(m,{id:P,className:"mt-4",children:e})]})}var U=require("react/jsx-runtime");function re({label:e,id:r,hint:t,hidden:u,dir:l,lang:o,translate:x,slot:v,errorMessage:i,isValid:c,...a}){let{inputId:p,hintId:s,errorId:n}=g(r),d=a["aria-invalid"]||c===!1||!!i;return(0,U.jsxs)("div",{className:"flex-row",hidden:u,dir:l,lang:o,translate:x,slot:v,children:[(0,U.jsx)("input",{...a,type:"checkbox",id:p,"aria-invalid":d?!0:void 0,"aria-errormessage":i?n:void 0,"aria-describedby":t?s:void 0}),(0,U.jsxs)("div",{className:"flex-col stack-4 ml-8",children:[(0,U.jsx)("label",{htmlFor:p,children:e}),(0,U.jsx)(f,{id:n,children:i}),t&&(0,U.jsx)(m,{id:s,children:t})]})]})}var ne=require("react");var te=require("react");var L=require("react/jsx-runtime");function oe({legend:e,id:r,hint:t,name:u,children:l,required:o,defaultValue:x,value:v,hidden:i,dir:c,lang:a,translate:p,slot:s,errorMessage:n,onChange:d,form:C,enterKeyHint:I,readOnly:h,isValid:y,...b}){let{inputId:P,hintId:k,errorId:T}=g(r),H=b["aria-invalid"]||y===!1||!!n;return(0,L.jsxs)("fieldset",{...b,hidden:i,dir:c,lang:a,translate:p,slot:s,form:C,id:P,role:"radiogroup","aria-invalid":H?!0:void 0,"aria-errormessage":n?T:void 0,"aria-describedby":t?k:void 0,"aria-required":o?!0:void 0,children:[(0,L.jsx)("legend",{className:"mb-4",children:e}),t&&(0,L.jsx)(m,{id:k,className:"mb-16",children:t}),(0,L.jsxs)("div",{className:"stack-8",hidden:i,children:[(0,L.jsx)(f,{id:T,className:"mb-16",children:n}),(0,L.jsx)(D,{value:{defaultValue:x,enterKeyHint:I,form:C,name:u,onChange:d,readOnly:h,required:o,value:v},children:l})]})]})}var G=(0,te.createContext)({}),D=G.Provider;var B=require("react/jsx-runtime");function ae({label:e,id:r,hint:t,hidden:u,dir:l,lang:o,translate:x,slot:v,value:i,...c}){let{inputId:a,hintId:p}=g(r),{value:s,defaultValue:n,...d}=(0,ne.useContext)(G),C,I;return typeof s<"u"?C=i===s:typeof n<"u"&&i===n&&(I=!0),(0,B.jsxs)("div",{className:"flex-row",hidden:u,dir:l,lang:o,translate:x,slot:v,children:[(0,B.jsx)("input",{...c,...d,checked:C,defaultChecked:I,type:"radio",id:a,value:i}),t?(0,B.jsxs)("div",{className:"flex-col stack-4 ml-8",children:[(0,B.jsx)("label",{htmlFor:a,children:e}),(0,B.jsx)(m,{id:p,children:t})]}):(0,B.jsx)("label",{htmlFor:a,className:"ml-8",children:e})]})}var V=require("react/jsx-runtime");function le({hint:e,id:r,label:t,hidden:u,dir:l,errorMessage:o,lang:x,translate:v,slot:i,isValid:c,...a}){let{inputId:p,errorId:s,hintId:n}=g(r),d=a["aria-invalid"]||c===!1||!!o;return(0,V.jsxs)("div",{className:"v-input-floating-label",hidden:u,dir:l,lang:x,translate:v,slot:i,children:[(0,V.jsx)("label",{htmlFor:p,children:t}),(0,V.jsx)("textarea",{placeholder:" ",...a,id:p,"aria-invalid":d?!0:void 0,"aria-errormessage":o?s:void 0,"aria-describedby":e?n:void 0}),(0,V.jsx)(f,{id:s,className:"mb-4",children:o}),e&&(0,V.jsx)(m,{id:n,className:"mt-4",children:e})]})}0&&(module.exports={Checkbox,DateInput,EmailInput,ErrorMessage,Hint,PasswordInput,Radio,RadioContextProvider,RadioGroup,Select,TelInput,TextArea,TextInput,UrlInput}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@volvo-cars/react-forms", | ||
"description": "React form components", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"license": "UNLICENSED", | ||
@@ -6,0 +6,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
158514