@helsenorge/designsystem-react 1.0.0-beta100 → 1.0.0-beta104
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/{Button-a0423474.js → Button-d5147e38.js} +2 -2
- package/Button-d5147e38.js.map +1 -0
- package/{Checkbox-9e4f3440.js → Checkbox-798282e4.js} +2 -2
- package/Checkbox-798282e4.js.map +1 -0
- package/{Close-007fca15.js → Close-35ad7d35.js} +2 -2
- package/Close-35ad7d35.js.map +1 -0
- package/{FormGroup-8d31ac79.js → FormGroup-0577b07f.js} +2 -2
- package/FormGroup-0577b07f.js.map +1 -0
- package/{Input-de356c23.js → Input-19650c24.js} +2 -2
- package/Input-19650c24.js.map +1 -0
- package/Loader-fa16a352.js +2 -0
- package/Loader-fa16a352.js.map +1 -0
- package/Modal-ad02991b.js +2 -0
- package/Modal-ad02991b.js.map +1 -0
- package/RadioButton-fe4bbd36.js +2 -0
- package/RadioButton-fe4bbd36.js.map +1 -0
- package/Textarea-e1d1144c.js +2 -0
- package/Textarea-e1d1144c.js.map +1 -0
- package/Title-af53f589.js +2 -0
- package/Title-af53f589.js.map +1 -0
- package/{Validation-f096092a.js → Validation-fd3f7f58.js} +2 -2
- package/Validation-fd3f7f58.js.map +1 -0
- package/{_rollupPluginBabelHelpers-d0752906.js → _rollupPluginBabelHelpers-b8ef6dd9.js} +2 -2
- package/_rollupPluginBabelHelpers-b8ef6dd9.js.map +1 -0
- package/color-a10c7892.js +2 -0
- package/color-a10c7892.js.map +1 -0
- package/components/AnchorLink/index.js +1 -1
- package/components/Badge/index.js +1 -1
- package/components/Button/index.js +1 -1
- package/components/Button/styles.module.scss +14 -3
- package/components/ButtonWithModal/index.js +1 -1
- package/components/Checkbox/index.js +1 -1
- package/components/Checkbox/styles.module.scss +8 -8
- package/components/Close/index.js +1 -1
- package/components/Expander/index.js +1 -1
- package/components/Expander/styles.module.scss +5 -5
- package/components/ExpanderList/index.js +1 -1
- package/components/ExpanderList/styles.module.scss +7 -7
- package/components/FormExample/index.js +1 -1
- package/components/FormGroup/index.js +1 -1
- package/components/FormGroup/styles.module.scss +7 -7
- package/components/Input/index.js +1 -1
- package/components/Input/styles.module.scss +4 -0
- package/components/LinkList/index.js +1 -1
- package/components/LinkList/styles.module.scss +11 -11
- package/components/Loader/index.js +1 -1
- package/components/Loader/styles.module.scss +2 -1
- package/components/Logo/index.js +1 -1
- package/components/Modal/index.js +1 -1
- package/components/Modal/styles.module.scss +19 -17
- package/components/NotificationPanel/index.js +1 -1
- package/components/NotificationPanel/styles.module.scss +3 -3
- package/components/RadioButton/index.js +1 -1
- package/components/RadioButton/styles.module.scss +10 -10
- package/components/Slider/index.js +1 -1
- package/components/Spacer/Spacer.d.ts.map +1 -1
- package/components/Spacer/componentdata.json +4 -1
- package/components/Spacer/index.js +1 -1
- package/components/Spacer/styles.module.scss +19 -11
- package/components/Spacer/styles.module.scss.d.ts +2 -0
- package/components/Textarea/index.js +1 -1
- package/components/Textarea/styles.module.scss +1 -1
- package/components/Tile/index.js +1 -1
- package/components/Title/index.js +1 -1
- package/components/Validation/index.js +1 -1
- package/components/__mocks__/index.js +1 -1
- package/hooks/useBreakpoint.d.ts +9 -5
- package/hooks/useBreakpoint.d.ts.map +1 -1
- package/hooks/useFocusTrap.d.ts +2 -1
- package/hooks/useFocusTrap.d.ts.map +1 -1
- package/index-0e78dfa0.js +2 -0
- package/index-0e78dfa0.js.map +1 -0
- package/index.d.ts +10 -3
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/package.json +4 -8
- package/scss/_input.scss +5 -4
- package/scss/_spacers.scss +26 -24
- package/theme/currys/spacing.d.ts.map +1 -1
- package/theme/index.d.ts +1 -0
- package/theme/index.d.ts.map +1 -1
- package/theme/spacers.d.ts +2 -1
- package/theme/spacers.d.ts.map +1 -1
- package/useBreakpoint-552af2b9.js +2 -0
- package/useBreakpoint-552af2b9.js.map +1 -0
- package/{useHover-037be19d.js → useHover-9710204a.js} +2 -2
- package/useHover-9710204a.js.map +1 -0
- package/useIsVisible-a1f67a11.js +2 -0
- package/useIsVisible-a1f67a11.js.map +1 -0
- package/useSticky-194f2b78.js +2 -0
- package/useSticky-194f2b78.js.map +1 -0
- package/useWindowSize-750f9b68.js +2 -0
- package/useWindowSize-750f9b68.js.map +1 -0
- package/Button-a0423474.js.map +0 -1
- package/Checkbox-9e4f3440.js.map +0 -1
- package/Close-007fca15.js.map +0 -1
- package/FormGroup-8d31ac79.js.map +0 -1
- package/Input-de356c23.js.map +0 -1
- package/Loader-b7486541.js +0 -2
- package/Loader-b7486541.js.map +0 -1
- package/Modal-8ba60dd4.js +0 -2
- package/Modal-8ba60dd4.js.map +0 -1
- package/RadioButton-d3ed3858.js +0 -2
- package/RadioButton-d3ed3858.js.map +0 -1
- package/Textarea-e48685fc.js +0 -2
- package/Textarea-e48685fc.js.map +0 -1
- package/Title-fab4097d.js +0 -2
- package/Title-fab4097d.js.map +0 -1
- package/Validation-f096092a.js.map +0 -1
- package/_rollupPluginBabelHelpers-d0752906.js.map +0 -1
- package/color-acb834c6.js +0 -2
- package/color-acb834c6.js.map +0 -1
- package/index-19b48c51.js +0 -2
- package/index-19b48c51.js.map +0 -1
- package/useBreakpoint-324a9b14.js +0 -2
- package/useBreakpoint-324a9b14.js.map +0 -1
- package/useHover-037be19d.js.map +0 -1
- package/useWindowSize-73b47451.js +0 -2
- package/useWindowSize-73b47451.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import r,{createContext as e,useCallback as t,useRef as n,useState as i,useEffect as a,useMemo as u,isValidElement as o}from"react";import{V as s}from"../../Validation-f096092a.js";import{F as c}from"../../FormGroup-8d31ac79.js";import{C as l}from"../../Checkbox-9e4f3440.js";import{B as f}from"../../Button-a0423474.js";import{R as v}from"../../RadioButton-d3ed3858.js";import{T as d}from"../../Textarea-e48685fc.js";import{I as m}from"../../Input-de356c23.js";import"../../index-9b84fabc.js";import"../Validation/styles.module.scss";import"../../constants-ad6c82db.js";import"../../_rollupPluginBabelHelpers-d0752906.js";import"../FormGroup/styles.module.scss";import"../../Title-fab4097d.js";import"../Title/styles.module.scss";import"../../uuid-fe7442b7.js";import"../../Check-6291ad09.js";import"../../Icon-89da8de4.js";import"../../_tslib-51c8a283.js";import"../../color-acb834c6.js";import"../../index-19b48c51.js";import"../../palette-f206f488.js";import"../../grid-11a70eb7.js";import"../Checkbox/styles.module.scss";import"../../Loader-b7486541.js";import"../Loader/styles.module.scss";import"../../useHover-037be19d.js";import"../../useWindowSize-73b47451.js";import"../Button/styles.module.scss";import"../RadioButton/styles.module.scss";import"../Textarea/styles.module.scss";import"../../useBreakpoint-324a9b14.js";import"../Input/styles.module.scss";var h=function(r){return r instanceof HTMLElement},g="blur",p="change",b="input",y="onBlur",V="onChange",O="onSubmit",j="onTouched",k="all",E="max",A="min",x="maxLength",S="minLength",z="pattern",w="required",D="validate";var F=function(r){return null==r},R=function(r){return"object"==typeof r},C=function(r){return!F(r)&&!Array.isArray(r)&&R(r)&&!(r instanceof Date)},H=function(r){return/^\w*$/.test(r)},N=function(r){return r.filter(Boolean)},B=function(r){return N(r.replace(/["|']/g,"").replace(/\[/g,".").replace(/\]/g,"").split("."))};function I(r,e,t){for(var n=-1,i=H(e)?[e]:B(e),a=i.length,u=a-1;++n<a;){var o=i[n],s=t;if(n!==u){var c=r[o];s=C(c)||Array.isArray(c)?c:isNaN(+i[n+1])?{}:[]}r[o]=s,r=r[o]}return r}var L=function(r,e){for(var t in void 0===e&&(e={}),r)H(t)?e[t]=r[t]:I(e,t,r[t]);return e},M=function(r){return void 0===r},T=function(r,e,t){void 0===r&&(r={});var n=N(e.split(/[,[\].]+?/)).reduce((function(r,e){return F(r)?r:r[e]}),r);return M(n)||n===r?M(r[e])?t:r[e]:n},q=function(r,e){h(r)&&r.removeEventListener&&(r.removeEventListener(b,e),r.removeEventListener(p,e),r.removeEventListener(g,e))},W={isValid:!1,value:null},_=function(r){return Array.isArray(r)?r.reduce((function(r,e){return e&&e.ref.checked?{isValid:!0,value:e.ref.value}:r}),W):W},P=function(r){return"radio"===r.type},U=function(r){return"file"===r.type},$=function(r){return"checkbox"===r.type},G=function(r){return"select-multiple"===r.type},J={value:!1,isValid:!1},K={value:!0,isValid:!0},Q=function(r){if(Array.isArray(r)){if(r.length>1){var e=r.filter((function(r){return r&&r.ref.checked})).map((function(r){return r.ref.value}));return{value:e,isValid:!!e.length}}var t=r[0].ref,n=t.checked,i=t.value,a=t.attributes;return n?a&&!M(a.value)?M(i)||""===i?K:{value:i,isValid:!0}:K:J}return J};function X(r,e,t,n,i){var a,u=r.current[e];if(u){var o=u.ref,s=o.value,c=o.disabled,l=u.ref,f=u.valueAsNumber,v=u.valueAsDate,d=u.setValueAs;if(c&&n)return;return U(l)?l.files:P(l)?_(u.options).value:G(l)?(a=l.options,[].concat(a).filter((function(r){return r.selected})).map((function(r){return r.value}))):$(l)?Q(u.options).value:i?s:f?""===s?NaN:+s:v?l.valueAsDate:d?d(s):s}if(t)return T(t.current,e)}function Y(r){return!r||r instanceof HTMLElement&&r.nodeType!==Node.DOCUMENT_NODE&&Y(r.parentNode)}var Z=function(r){return C(r)&&!Object.keys(r).length},rr=function(r){return"boolean"==typeof r};function er(r,e){var t,n=H(e)?[e]:B(e),i=1==n.length?r:function(r,e){for(var t=e.slice(0,-1).length,n=0;n<t;)r=M(r)?n++:r[e[n++]];return r}(r,n),a=n[n.length-1];i&&delete i[a];for(var u=0;u<n.slice(0,-1).length;u++){var o=-1,s=void 0,c=n.slice(0,-(u+1)),l=c.length-1;for(u>0&&(t=r);++o<c.length;){var f=c[o];s=s?s[f]:r[f],l===o&&(C(s)&&Z(s)||Array.isArray(s)&&!s.filter((function(r){return C(r)&&!Z(r)||rr(r)})).length)&&(t?delete t[f]:delete r[f]),t=s}}return r}var tr=function(r,e){return r&&r.ref===e};var nr=function(r){return F(r)||!R(r)};function ir(r,e){if(nr(r)||nr(e))return e;for(var t in e){var n=r[t],i=e[t];try{r[t]=C(n)&&C(i)||Array.isArray(n)&&Array.isArray(i)?ir(n,i):i}catch(r){}}return r}function ar(r,e,t){if(nr(r)||nr(e)||r instanceof Date||e instanceof Date)return r===e;if(!o(r)){var n=Object.keys(r),i=Object.keys(e);if(n.length!==i.length)return!1;for(var a=0,u=n;a<u.length;a+=1){var s=u[a],c=r[s];if(!t||"ref"!==s){var l=e[s];if((C(c)||Array.isArray(c))&&(C(l)||Array.isArray(l))?!ar(c,l,t):c!==l)return!1}}}return!0}function ur(r,e,t,n,i){for(var a,u=-1;++u<r.length;){for(var o in r[u])Array.isArray(r[u][o])?(!t[u]&&(t[u]={}),t[u][o]=[],ur(r[u][o],T(e[u]||{},o,[]),t[u][o],t[u],o)):ar(T(e[u]||{},o),r[u][o])?I(t[u]||{},o):t[u]=Object.assign(Object.assign({},t[u]),((a={})[o]=!0,a));n&&!t.length&&delete n[i]}return t}var or=function(r){return"string"==typeof r},sr=function(r,e,t,n,i){var a={},u=function(e){(M(i)||(or(i)?e.startsWith(i):Array.isArray(i)&&i.find((function(r){return e.startsWith(r)}))))&&(a[e]=X(r,e,void 0,n))};for(var o in r.current)u(o);return t?L(a):ir(e,L(a))},cr=function(r){return r instanceof RegExp},lr=function(r){return C(r)&&!cr(r)?r:{value:r,message:""}},fr=function(r){return"function"==typeof r},vr=function(r){return or(r)||o(r)};function dr(r,e,t){if(void 0===t&&(t="validate"),vr(r)||rr(r)&&!r)return{type:t,message:vr(r)?r:"",ref:e}}var mr=function(r,e,t,n,i){var a;return e?Object.assign(Object.assign({},t[r]),{types:Object.assign(Object.assign({},t[r]&&t[r].types?t[r].types:{}),(a={},a[n]=i||!0,a))}):{}},hr=async function(r,e,t,n){var i=t.ref,a=t.ref.value,u=t.options,o=t.required,s=t.maxLength,c=t.minLength,l=t.min,f=t.max,v=t.pattern,d=t.validate,m=i.name,h={},g=P(i),p=$(i),b=g||p,y=""===a,V=mr.bind(null,m,e,h),O=function(r,e,t,n,a){void 0===n&&(n=x),void 0===a&&(a=S);var u=r?e:t;h[m]=Object.assign({type:r?n:a,message:u,ref:i},V(r?n:a,u))};if(o&&(!g&&!p&&(y||F(a))||rr(a)&&!a||p&&!Q(u).isValid||g&&!_(u).isValid)){var j=vr(o)?{value:!!o,message:o}:lr(o),k=j.value,R=j.message;if(k&&(h[m]=Object.assign({type:w,message:R,ref:b?((r.current[m].options||[])[0]||{}).ref:i},V(w,R)),!e))return h}if(!(F(l)&&F(f)||""===a)){var H,N,B=lr(f),I=lr(l);if(isNaN(a)){var L=i.valueAsDate||new Date(a);or(B.value)&&(H=L>new Date(B.value)),or(I.value)&&(N=L<new Date(I.value))}else{var M=i.valueAsNumber||parseFloat(a);F(B.value)||(H=M>B.value),F(I.value)||(N=M<I.value)}if((H||N)&&(O(!!H,B.message,I.message,E,A),!e))return h}if(or(a)&&!y&&(s||c)){var T=lr(s),q=lr(c),W=!F(T.value)&&a.length>T.value,U=!F(q.value)&&a.length<q.value;if((W||U)&&(O(W,T.message,q.message),!e))return h}if(or(a)&&v&&!y){var G=lr(v),J=G.value,K=G.message;if(cr(J)&&!J.test(a)&&(h[m]=Object.assign({type:z,message:K,ref:i},V(z,K)),!e))return h}if(d){var Y=X(r,m,n,!1,!0),er=b&&u?u[0].ref:i;if(fr(d)){var tr=dr(await d(Y),er);if(tr&&(h[m]=Object.assign(Object.assign({},tr),V(D,tr.message)),!e))return h}else if(C(d)){for(var nr={},ir=0,ar=Object.entries(d);ir<ar.length;ir+=1){var ur=ar[ir],sr=ur[0],hr=ur[1];if(!Z(nr)&&!e)break;var gr=dr(await hr(Y),er,sr);gr&&(nr=Object.assign(Object.assign({},gr),V(sr,gr.message)),e&&(h[m]=nr))}if(!Z(nr)&&(h[m]=Object.assign({ref:er},nr),!e))return h}}return h},gr=function(r,e,t){for(var n in void 0===t&&(t=[]),e){var i=r+(C(e)?"."+n:"["+n+"]");nr(e[n])?t.push(i):gr(i,e[n],t)}return t},pr=function(r,e,t,n,i){var a=void 0;return t.add(e),Z(r)||(a=T(r,e),(C(a)||Array.isArray(a))&&gr(e,a).forEach((function(r){return t.add(r)}))),M(a)?i?n:T(n,e):a},br=function(r){return r.substring(0,r.indexOf("["))},yr=function(r,e){return[].concat(r).some((function(r){return function(r,e){return RegExp(("^"+e+"([|.)\\d+").replace(/\[/g,"\\[").replace(/\]/g,"\\]")).test(r)}(e,r)}))};var Vr="undefined"!=typeof window&&"undefined"!=typeof document;function Or(r){var e,t;if(nr(r)||Vr&&(r instanceof File||h(r)))return r;if(!["Set","Map","Object","Date","Array"].includes(null===(e=r.constructor)||void 0===e?void 0:e.name))return r;if(r instanceof Date)return t=new Date(r.getTime());if(r instanceof Set){t=new Set;for(var n=0,i=r;n<i.length;n+=1){var a=i[n];t.add(a)}return t}if(r instanceof Map){t=new Map;for(var u=0,o=r.keys();u<o.length;u+=1){var s=o[u];t.set(s,Or(r.get(s)))}return t}for(var c in t=Array.isArray(r)?[]:{},r)t[c]=Or(r[c]);return t}var jr=function(r){return{isOnSubmit:!r||r===O,isOnBlur:r===y,isOnChange:r===V,isOnAll:r===k,isOnTouch:r===j}},kr=function(r){return P(r)||$(r)},Er="undefined"==typeof window,Ar=Vr?"Proxy"in window:"undefined"!=typeof Proxy;function xr(r){void 0===r&&(r={});var e=r.mode;void 0===e&&(e=O);var o=r.reValidateMode;void 0===o&&(o=V);var s=r.resolver,c=r.context,l=r.defaultValues;void 0===l&&(l={});var f=r.shouldFocusError;void 0===f&&(f=!0);var v=r.shouldUnregister;void 0===v&&(v=!0);var d=r.criteriaMode,m=n({}),y=n({}),j=n({}),E=n(new Set),A=n({}),x=n({}),S=n({}),z=n({}),w=n(l),D=n(!1),R=n(!1),B=n(),W=n({}),_=n({}),J=n(c),K=n(s),Q=n(new Set),rr=n(jr(e)),cr=rr.current,lr=cr.isOnSubmit,vr=cr.isOnTouch,dr=d===k,mr=i({isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touched:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!lr,errors:{}}),xr=mr[0],Sr=mr[1],zr=n({isDirty:!Ar,dirtyFields:!Ar,touched:!Ar||vr,isValidating:!Ar,isSubmitting:!Ar,isValid:!Ar}),wr=n(xr),Dr=n(),Fr=n(jr(o)).current,Rr=Fr.isOnBlur,Cr=Fr.isOnChange;J.current=c,K.current=s,wr.current=xr,W.current=v?{}:Z(W.current)?Or(l):W.current;var Hr=t((function(r){void 0===r&&(r={}),D.current||(wr.current=Object.assign(Object.assign({},wr.current),r),Sr(wr.current))}),[]),Nr=function(){return zr.current.isValidating&&Hr({isValidating:!0})},Br=t((function(r,e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n={});var a=t||function(r){var e=r.errors,t=r.name,n=r.error,i=r.validFields,a=r.fieldsWithValidation,u=M(n),o=T(e,t);return u&&!!o||!u&&!ar(o,n,!0)||u&&T(a,t)&&!T(i,t)}({errors:wr.current.errors,error:e,name:r,validFields:z.current,fieldsWithValidation:S.current}),u=T(wr.current.errors,r);e?(er(z.current,r),a=a||!u||!ar(u,e,!0),I(wr.current.errors,r,e)):((T(S.current,r)||K.current)&&(I(z.current,r,!0),a=a||u),er(wr.current.errors,r)),(a&&!F(t)||!Z(n)||zr.current.isValidating)&&Hr(Object.assign(Object.assign(Object.assign({},n),K.current?{isValid:!!i}:{}),{isValidating:!1}))}),[]),Ir=t((function(r,e){var t=m.current[r],n=t.ref,i=t.options,a=Vr&&h(n)&&F(e)?"":e;P(n)?(i||[]).forEach((function(r){var e=r.ref;return e.checked=e.value===a})):U(n)&&!or(a)?n.files=a:G(n)?[].concat(n.options).forEach((function(r){return r.selected=a.includes(r.value)})):$(n)&&i?i.length>1?i.forEach((function(r){var e=r.ref;return e.checked=Array.isArray(a)?!!a.find((function(r){return r===e.value})):a===e.value})):i[0].ref.checked=!!a:n.value=a}),[]),Lr=t((function(r,e){if(zr.current.isDirty){var t=Jr();return r&&e&&I(t,r,e),!ar(t,w.current)}return!1}),[]),Mr=t((function(r,e){if(void 0===e&&(e=!0),zr.current.isDirty||zr.current.dirtyFields){var t=!ar(T(w.current,r),X(m,r,W)),n=T(wr.current.dirtyFields,r),i=wr.current.isDirty;t?I(wr.current.dirtyFields,r,!0):er(wr.current.dirtyFields,r);var a={isDirty:Lr(),dirtyFields:wr.current.dirtyFields},u=zr.current.isDirty&&i!==a.isDirty||zr.current.dirtyFields&&n!==T(wr.current.dirtyFields,r);return u&&e&&Hr(a),u?a:{}}return{}}),[]),Tr=t((async function(r,e){if("production"!==process.env.NODE_ENV&&!m.current[r])return console.warn("📋 Field is missing with `name` attribute: ",r),!1;var t=(await hr(m,dr,m.current[r],W))[r];return Br(r,t,e),M(t)}),[Br,dr]),qr=t((async function(r){var e=(await K.current(Jr(),J.current,dr)).errors,t=wr.current.isValid;if(Array.isArray(r)){var n=r.map((function(r){var t=T(e,r);return t?I(wr.current.errors,r,t):er(wr.current.errors,r),!t})).every(Boolean);return Hr({isValid:Z(e),isValidating:!1}),n}var i=T(e,r);return Br(r,i,t!==Z(e),{},Z(e)),!i}),[Br,dr]),Wr=t((async function(r){var e=r||Object.keys(m.current);if(Nr(),K.current)return qr(e);if(Array.isArray(e)){!r&&(wr.current.errors={});var t=await Promise.all(e.map((async function(r){return await Tr(r,null)})));return Hr({isValidating:!1}),t.every(Boolean)}return await Tr(e)}),[qr,Tr]),_r=t((function(r,e,t){var n=t.shouldDirty,i=t.shouldValidate,a={};I(a,r,e);for(var u=0,o=gr(r,e);u<o.length;u+=1){var s=o[u];m.current[s]&&(Ir(s,T(a,s)),n&&Mr(s),i&&Wr(s))}}),[Wr,Ir,Mr]),Pr=t((function(r,e,t){var n,i;if(!v&&!nr(e)&&I(W.current,r,Array.isArray(e)?[].concat(e):Object.assign({},e)),m.current[r])Ir(r,e),t.shouldDirty&&Mr(r),t.shouldValidate&&Wr(r);else if(!nr(e)&&(_r(r,e,t),Q.current.has(r))){var a=br(r)||r;I(y.current,r,e),_.current[a](((n={})[a]=T(y.current,a),n)),(zr.current.isDirty||zr.current.dirtyFields)&&t.shouldDirty&&(I(wr.current.dirtyFields,r,function(r,e,t){return ir(ur(r,e,t.slice(0,r.length)),ur(e,r,t.slice(0,r.length)))}(e,T(w.current,r,[]),T(wr.current.dirtyFields,r,[]))),Hr({isDirty:!ar(Object.assign(Object.assign({},Jr()),(i={},i[r]=e,i)),w.current)}))}!v&&I(W.current,r,e)}),[Mr,Ir,_r]),Ur=function(r){return R.current||E.current.has(r)||E.current.has((r.match(/\w+/)||[])[0])},$r=function(r){var e=!0;if(!Z(A.current))for(var t in A.current)r&&A.current[t].size&&!A.current[t].has(r)&&!A.current[t].has(br(r))||(x.current[t](),e=!1);return e};function Gr(r){var e;if(!v){for(var t=Or(r),n=0,i=Q.current;n<i.length;n+=1){var a=i[n];H(a)&&!t[a]&&(t=Object.assign(Object.assign({},t),((e={})[a]=[],e)))}return t}return r}function Jr(r){if(or(r))return X(m,r,W);if(Array.isArray(r)){for(var e={},t=0,n=r;t<n.length;t+=1){var i=n[t];I(e,i,X(m,i,W))}return e}return Gr(sr(m,Or(W.current),v))}B.current=B.current?B.current:async function(r){var e,t,n=r.type,i=r.target,a=i.name,u=m.current[a];if(u){var o=n===g,s=function(r){var e=r.isOnBlur,t=r.isOnChange,n=r.isOnTouch,i=r.isTouched,a=r.isReValidateOnBlur,u=r.isReValidateOnChange,o=r.isBlurEvent,s=r.isSubmitted;return!r.isOnAll&&(!s&&n?!(i||o):(s?a:e)?!o:!(s?u:t)||o)}(Object.assign({isBlurEvent:o,isReValidateOnChange:Cr,isReValidateOnBlur:Rr,isTouched:!!T(wr.current.touched,a),isSubmitted:wr.current.isSubmitted},rr.current)),c=Mr(a,!1),l=!Z(c)||!o&&Ur(a);if(o&&!T(wr.current.touched,a)&&zr.current.touched&&(I(wr.current.touched,a,!0),c=Object.assign(Object.assign({},c),{touched:wr.current.touched})),!v&&$(i)&&I(W.current,a,X(m,a)),s)return!o&&$r(a),(!Z(c)||l&&Z(c))&&Hr(c);if(Nr(),K.current){var f=(await K.current(Jr(),J.current,dr)).errors,d=wr.current.isValid;if(e=T(f,a),$(i)&&!e&&K.current){var h=br(a),p=T(f,h,{});p.type&&p.message&&(e=p),h&&(p||T(wr.current.errors,h))&&(a=h)}d!==(t=Z(f))&&(l=!0)}else e=(await hr(m,dr,u,W))[a];!o&&$r(a),Br(a,e,l,c,t)}};var Kr=t((async function(r){void 0===r&&(r={});var e=Z(m.current)?w.current:{},t=(await K.current(Object.assign(Object.assign(Object.assign({},e),Jr()),r),J.current,dr)||{}).errors,n=Z(t);wr.current.isValid!==n&&Hr({isValid:n})}),[dr]),Qr=t((function(r,e){!function(r,e,t,n,i,a){var u=t.ref,o=t.ref.name,s=r.current[o];if(!i){var c=X(r,o,n);!M(c)&&I(n.current,o,c)}u.type&&s?P(u)||$(u)?Array.isArray(s.options)&&s.options.length?(N(s.options).forEach((function(r,t){void 0===r&&(r={}),(Y(r.ref)&&tr(r,r.ref)||a)&&(q(r.ref,e),er(s.options,"["+t+"]"))})),s.options&&!N(s.options).length&&delete r.current[o]):delete r.current[o]:(Y(u)&&tr(s,u)||a)&&(q(u,e),delete r.current[o]):delete r.current[o]}(m,B.current,r,W,v,e),v&&(er(z.current,r.ref.name),er(S.current,r.ref.name))}),[v]),Xr=t((function(r){if(R.current)Hr();else{for(var e=0,t=E.current;e<t.length;e+=1){if(t[e].startsWith(r)){Hr();break}}$r(r)}}),[]),Yr=t((function(r,e){r&&(Qr(r,e),v&&!N(r.options||[]).length&&(er(wr.current.errors,r.ref.name),I(wr.current.dirtyFields,r.ref.name,!0),Hr({isDirty:Lr()}),zr.current.isValid&&K.current&&Kr(),Xr(r.ref.name)))}),[Kr,Qr]);var Zr=t((function(r,e,t){var n=t?A.current[t]:E.current,i=sr(m,Or(W.current),v,!1,r);if(or(r)){var a=br(r)||r;return Q.current.has(a)&&(i=Object.assign(Object.assign({},j.current),i)),pr(i,r,n,M(T(w.current,r))?e:T(w.current,r),!0)}var u=M(e)?w.current:e;return Array.isArray(r)?r.reduce((function(r,e){var t;return Object.assign(Object.assign({},r),((t={})[e]=pr(i,e,n,u),t))}),{}):(R.current=M(t),L(!Z(i)&&i||u))}),[]);function re(r,e){if(void 0===e&&(e={}),"production"!==process.env.NODE_ENV){if(!r.name)return console.warn("📋 Field is missing `name` attribute",r,"https://react-hook-form.com/api#useForm");if(Q.current.has(r.name.split(/\[\d+\]$/)[0])&&!RegExp(("^"+r.name.split(/\[\d+\]$/)[0]+"[\\d+].\\w+").replace(/\[/g,"\\[").replace(/\]/g,"\\]")).test(r.name))return console.warn('📋 `name` prop should be in object shape: name="test[index].name"',r,"https://react-hook-form.com/api#useFieldArray")}var t,n=r.name,i=r.type,a=r.value,u=Object.assign({ref:r},e),o=m.current,s=kr(r),c=yr(Q.current,n),l=function(e){return Vr&&(!h(r)||e===r)},f=o[n],d=!0;if(f&&(s?Array.isArray(f.options)&&N(f.options).find((function(r){return a===r.ref.value&&l(r.ref)})):l(f.ref)))o[n]=Object.assign(Object.assign({},f),e);else{f=i?s?Object.assign({options:N(f&&f.options||[]).concat([{ref:r}]),ref:{type:i,name:n}},e):Object.assign({},u):u,o[n]=f;var y=M(T(W.current,n));Z(w.current)&&y||(t=T(y?w.current:W.current,n),(d=M(t))||c||Ir(n,t)),Z(e)||(I(S.current,n,!0),!lr&&zr.current.isValid&&hr(m,dr,f,W).then((function(r){var e=wr.current.isValid;Z(r)?I(z.current,n,!0):er(z.current,n),e!==Z(r)&&Hr()}))),!v||c&&d||!c&&er(wr.current.dirtyFields,n),i&&function(r,e,t){var n=r.ref;h(n)&&t&&(n.addEventListener(e?p:b,t),n.addEventListener(g,t))}(s&&f.options?f.options[f.options.length-1]:f,s||"select-one"===r.type,B.current)}}var ee=t((function(r,e){return async function(t){t&&t.preventDefault&&(t.preventDefault(),t.persist());var n={},i=Gr(sr(m,Or(W.current),v,!0));zr.current.isSubmitting&&Hr({isSubmitting:!0});try{if(K.current){var a=await K.current(i,J.current,dr),u=a.errors,o=a.values;wr.current.errors=n=u,i=o}else for(var s=0,c=Object.values(m.current);s<c.length;s+=1){var l=c[s];if(l){var d=l.ref.name,h=await hr(m,dr,l,W);h[d]?(I(n,d,h[d]),er(z.current,d)):T(S.current,d)&&(er(wr.current.errors,d),I(z.current,d,!0))}}Z(n)&&Object.keys(wr.current.errors).every((function(r){return r in m.current}))?(Hr({errors:{},isSubmitting:!0}),await r(i,t)):(wr.current.errors=Object.assign(Object.assign({},wr.current.errors),n),e&&await e(wr.current.errors,t),f&&function(r,e){for(var t in r)if(T(e,t)){var n=r[t];if(n){if(n.ref.focus&&M(n.ref.focus()))break;if(n.options){n.options[0].ref.focus();break}}}}(m.current,wr.current.errors))}finally{wr.current.isSubmitting=!1,Hr({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Z(wr.current.errors),submitCount:wr.current.submitCount+1})}}}),[f,dr]);a((function(){s&&zr.current.isValid&&Kr(),Dr.current=Dr.current||!Vr?Dr.current:function(r,e){var t=new MutationObserver((function(){for(var t=0,n=Object.values(r.current);t<n.length;t+=1){var i=n[t];if(i&&i.options)for(var a=0,u=i.options;a<u.length;a+=1){var o=u[a];o&&o.ref&&Y(o.ref)&&e(i)}else i&&Y(i.ref)&&e(i)}}));return t.observe(window.document,{childList:!0,subtree:!0}),t}(m,Yr)}),[Yr,w.current]),a((function(){return function(){Dr.current&&Dr.current.disconnect(),D.current=!0,"production"===process.env.NODE_ENV&&Object.values(m.current).forEach((function(r){return Yr(r,!0)}))}}),[]),!s&&zr.current.isValid&&(xr.isValid=ar(z.current,S.current)&&Z(wr.current.errors));var te={trigger:Wr,setValue:t((function(r,e,t){Pr(r,e,t||{}),Ur(r)&&Hr(),$r(r)}),[Pr,Wr]),getValues:t(Jr,[]),register:t((function(r,e){if(!Er)if(or(r))re({name:r},e);else{if(!C(r)||!("name"in r))return function(e){return e&&re(e,r)};re(r,e)}}),[w.current]),unregister:t((function(r){for(var e=0,t=Array.isArray(r)?r:[r];e<t.length;e+=1){var n=t[e];Yr(m.current[n],!0)}}),[]),formState:Ar?new Proxy(xr,{get:function(r,e){if("production"!==process.env.NODE_ENV&&"isValid"===e&&lr&&console.warn("📋 `formState.isValid` is applicable with `onTouched`, `onChange` or `onBlur` mode. https://react-hook-form.com/api#formState"),e in r)return zr.current[e]=!0,r[e]}}):xr},ne=u((function(){return Object.assign({isFormDirty:Lr,updateWatchedValue:Xr,shouldUnregister:v,updateFormState:Hr,removeFieldEventListener:Qr,watchInternal:Zr,mode:rr.current,reValidateMode:{isReValidateOnBlur:Rr,isReValidateOnChange:Cr},validateResolver:s?Kr:void 0,fieldsRef:m,resetFieldArrayFunctionRef:_,useWatchFieldsRef:A,useWatchRenderFunctionsRef:x,fieldArrayDefaultValuesRef:y,validFieldsRef:z,fieldsWithValidationRef:S,fieldArrayNamesRef:Q,readFormStateRef:zr,formStateRef:wr,defaultValuesRef:w,shallowFieldsStateRef:W,fieldArrayValuesRef:j},te)}),[w.current,Xr,v,Qr,Zr]);return Object.assign({watch:function(r,e){return Zr(r,e)},control:ne,handleSubmit:ee,reset:t((function(r,e){if(void 0===e&&(e={}),Vr)for(var t=0,n=Object.values(m.current);t<n.length;t+=1){var i=n[t];if(i){var a=i.ref,u=i.options,o=kr(a)&&Array.isArray(u)?u[0].ref:a;if(h(o))try{o.closest("form").reset();break}catch(r){}}}m.current={},w.current=Object.assign({},r||w.current),r&&$r(""),Object.values(_.current).forEach((function(r){return fr(r)&&r()})),W.current=v?{}:Or(r||w.current),function(r){var e=r.errors,t=r.isDirty,n=r.isSubmitted,i=r.touched,a=r.isValid,u=r.submitCount,o=r.dirtyFields;a||(z.current={},S.current={}),y.current={},E.current=new Set,R.current=!1,Hr({submitCount:u?wr.current.submitCount:0,isDirty:!!t&&wr.current.isDirty,isSubmitted:!!n&&wr.current.isSubmitted,isValid:!!a&&wr.current.isValid,dirtyFields:o?wr.current.dirtyFields:{},touched:i?wr.current.touched:{},errors:e?wr.current.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})}(e)}),[]),clearErrors:t((function(r){r&&(Array.isArray(r)?r:[r]).forEach((function(r){return m.current[r]&&H(r)?delete wr.current.errors[r]:er(wr.current.errors,r)})),Hr({errors:r?wr.current.errors:{}})}),[]),setError:t((function(r,e){var t=(m.current[r]||{}).ref;I(wr.current.errors,r,Object.assign(Object.assign({},e),{ref:t})),Hr({isValid:!1}),e.shouldFocus&&t&&t.focus&&t.focus()}),[]),errors:xr.errors},te)}e(null).displayName="RHFContext";var Sr,zr=function(e){var t=e.isExtraSmall,n=e.isHovered,i=r.createElement("path",{fillRule:"evenodd",d:"M13.554 28.445h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm1 6.312h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm5.986-16.908h1v-3.158h3.159v-1H19.54v-3.159h-1v3.159h-3.159v1h3.159v3.158zM30.791 39.72h8.37V20.682h-8.37V39.72zm-22.202 0h20.903V10.547H8.589V39.72zm22.203-20.338V9.247H7.289V41.02h33.173V19.382h-9.67zm-9.139 9.063h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm1 6.312h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zM10.869 7.702h16.343v-1.3H10.869v1.3z"}),a=r.createElement("path",{fillRule:"evenodd",d:"M13.554 28.445h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm1 6.312h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm5.986-15.908h1v-4.158h4.159v-1H19.54v-4.159h-1v4.159h-4.159v1h4.159v4.158zM30.791 39.72h8.37V20.682h-8.37V39.72zm-22.202 0h20.903V10.547H8.589V39.72zm22.203-20.338V9.247H7.289V41.02h33.173V19.382h-9.67zm-9.139 9.063h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm1 6.312h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zM10.869 7.702h16.343v-1.3H10.869v1.3z"}),u=r.createElement("path",{fillRule:"evenodd",d:"M21.527 35.62h2.862v-3.233h-2.862v3.234zm-1.01 1.01H25.4v-5.254h-4.884v5.254zm-7.09-1.01h2.863v-3.233h-2.863v3.234zm-1.01 1.01H17.3v-5.254h-4.883v5.254zm9.11-8.322h2.862v-3.232h-2.862v3.232zm-1.01 1.01H25.4v-5.254h-4.884v5.254zm-7.09-1.01h2.863v-3.232h-2.863v3.232zm-1.01 1.01H17.3v-5.253h-4.883v5.254zm5.86-9.6h1.264V16.69h3.027v-1.263H19.54V12.4h-1.263v3.027H15.25v1.263h3.028v3.028zm12.365 19.888h8.406V20.53h-8.406v19.075zm-22.204 0h20.94V9.132H8.439v30.474zm22.204-20.338V7.87H7.175v33H40.31V19.267h-9.67z"});return t?n?r.createElement("path",{fillRule:"evenodd",d:"M22.158 35.62h2.863v-3.233h-2.863v3.234zm-1.01 1.01h4.883v-5.254h-4.883v5.254zm-7.09-1.01h2.863v-3.233H14.06v3.234zm-1.01 1.01h4.884v-5.254h-4.884v5.254zm9.11-8.322h2.863v-3.232h-2.863v3.232zm-1.01 1.01h4.883v-5.254h-4.883v5.254zm-7.09-1.01h2.863v-3.232H14.06v3.232zm-1.01 1.01h4.884v-5.253h-4.884v5.254zm5.861-9.6h1.264V16.69h3.026v-1.263h-3.026V12.4h-1.264v3.027h-3.027v1.263h3.027v3.028zm12.364 19.888h8.407V20.53h-8.407v19.075zm-22.204 0H30.01V9.132H9.07v30.474zm22.204-20.338V7.87H7.806v33h33.137V19.267h-9.67z"}):u:n?a:i};!function(r){r.formgroup="formgroup",r.checkbox="checkbox",r.radiobutton="radiobutton",r.textarea="textarea",r.input="input"}(Sr||(Sr={}));var wr=function(e){var t=e.exampleType,n=void 0===t?Sr.formgroup:t,i=xr(),a=i.register,u=i.handleSubmit,o=i.errors,h=o.formgroup1||o.formgroup2||o.formgroup3||o.formgroup4||o.formgroup5,g="Du må velge et alternativ",p=function(r){return r.length>=2||"Du må velge to alternativ"};return r.createElement("form",{onSubmit:u((function(r){console.log(r)}))},r.createElement(s,{variant:e.variant,errorSummary:h?"Sjekk at alt er riktig utfylt":void 0},n===Sr.formgroup?[r.createElement(c,{key:0,title:"One amazing title",legend:"Check out these checkboxes!",error:o.formgroup1?o.formgroup1.message:void 0,variant:e.variant,name:"formgroup1"},r.createElement(l,{inputId:"checkbox1",label:"Checkbox 1",ref:a({required:g})}),r.createElement(l,{inputId:"checkbox2",label:"Checkbox 2",ref:a({required:g})}),r.createElement(l,{inputId:"checkbox3",label:"Checkbox 3",ref:a({required:g})})),r.createElement(c,{key:1,legend:"Select two options!",error:o.formgroup2?o.formgroup2.message:void 0,variant:e.variant,name:"formgroup2"},r.createElement(l,{inputId:"checkbox4",label:"Checkbox 4",ref:a({validate:p})}),r.createElement(l,{inputId:"checkbox5",label:"Checkbox 5",ref:a({validate:p})}),r.createElement(l,{inputId:"checkbox6",label:"Checkbox 6",ref:a({validate:p})})),r.createElement(c,{key:2,legend:"Select two options!",error:o.formgroup3?o.formgroup3.message:void 0,variant:e.variant,name:"formgroup3"},r.createElement(v,{inputId:"radiobutton1",label:"Radiobutton 1",ref:a({required:g})}),r.createElement(v,{inputId:"radiobutton2",label:"Radiobutton 2",ref:a({required:g})}),r.createElement(v,{inputId:"radiobutton3",label:"Radiobutton 3",ref:a({required:g})})),r.createElement(c,{key:3,error:o.formgroup4?o.formgroup4.message:void 0},r.createElement(d,{defaultValue:"Dette er en test \n\n Hello \n\n test \n\n test test",grow:!0,maxCharacters:40,minRows:5,label:"Skriv din historie her",textareaId:"textarea1",name:"formgroup4",ref:a({maxLength:{value:40,message:"Det kan ikke legges inn mer enn 40 tegn"}})})),r.createElement(c,{name:"formgroup5",key:4,variant:e.variant,error:o.formgroup5?o.formgroup5.message:void 0},r.createElement(m,{label:"Skriv inn din tekst",placeholder:"Skriv noe!",icon:zr,ref:a({required:"Du må skrive noe her"})}))]:n===Sr.checkbox?r.createElement(c,{name:"formgroup1",error:o.formgroup1?o.formgroup1.message:void 0},r.createElement(l,{name:"formgroup1",inputId:"checkbox1",label:"Checkbox 1",error:o.formgroup1,variant:e.variant,ref:a({required:g})})):n===Sr.radiobutton?r.createElement(c,{name:"formgroup3",error:o.formgroup3?o.formgroup3.message:void 0},r.createElement(v,{name:"formgroup3",inputId:"radiobutton1",label:"Radiobutton 1",error:o.formgroup3,variant:e.variant,ref:a({required:g})})):n===Sr.textarea?r.createElement(c,{error:o.formgroup4?o.formgroup4.message:void 0},r.createElement(d,{defaultValue:"Dette er min historie \n\n Hello \n\n test",grow:!0,maxCharacters:40,minRows:5,label:"Skriv din historie her",textareaId:"textarea1",name:"formgroup4",ref:a({maxLength:{value:40,message:"Det kan ikke legges inn mer enn 40 tegn"}})})):n===Sr.input?r.createElement(c,{name:"formgroup5",key:4,variant:e.variant,error:o.formgroup5?o.formgroup5.message:void 0},r.createElement(m,{inputId:"input1",label:"Skriv inn din tekst",placeholder:"Skriv noe!",icon:zr,ref:a({required:"Du må skrive noe her"})})):void 0),r.createElement(f,null,"Submit"))};export default wr;export{wr as FormExample,Sr as FormExampleVariants};
|
|
1
|
+
import r,{createContext as e,useCallback as t,useRef as n,useState as i,useEffect as a,useMemo as u,isValidElement as o}from"react";import{V as s}from"../../Validation-fd3f7f58.js";import{F as c}from"../../FormGroup-0577b07f.js";import{C as l}from"../../Checkbox-798282e4.js";import{B as f}from"../../Button-d5147e38.js";import{R as v}from"../../RadioButton-fe4bbd36.js";import{T as d}from"../../Textarea-e1d1144c.js";import{I as m}from"../../Input-19650c24.js";import"../../index-9b84fabc.js";import"../Validation/styles.module.scss";import"../../constants-ad6c82db.js";import"../../_rollupPluginBabelHelpers-b8ef6dd9.js";import"../FormGroup/styles.module.scss";import"../../Title-af53f589.js";import"../Title/styles.module.scss";import"../../uuid-fe7442b7.js";import"../../Check-6291ad09.js";import"../../Icon-89da8de4.js";import"../../_tslib-51c8a283.js";import"../../color-a10c7892.js";import"../../index-0e78dfa0.js";import"../../palette-f206f488.js";import"../../grid-11a70eb7.js";import"../Checkbox/styles.module.scss";import"../../Loader-fa16a352.js";import"../Loader/styles.module.scss";import"../../useHover-9710204a.js";import"../../useWindowSize-750f9b68.js";import"../Button/styles.module.scss";import"../RadioButton/styles.module.scss";import"../Textarea/styles.module.scss";import"../../useBreakpoint-552af2b9.js";import"../Input/styles.module.scss";var h=function(r){return r instanceof HTMLElement},g="blur",p="change",b="input",y="onBlur",V="onChange",O="onSubmit",j="onTouched",k="all",E="max",A="min",x="maxLength",S="minLength",z="pattern",w="required",D="validate";var F=function(r){return null==r},R=function(r){return"object"==typeof r},C=function(r){return!F(r)&&!Array.isArray(r)&&R(r)&&!(r instanceof Date)},H=function(r){return/^\w*$/.test(r)},N=function(r){return r.filter(Boolean)},B=function(r){return N(r.replace(/["|']/g,"").replace(/\[/g,".").replace(/\]/g,"").split("."))};function I(r,e,t){for(var n=-1,i=H(e)?[e]:B(e),a=i.length,u=a-1;++n<a;){var o=i[n],s=t;if(n!==u){var c=r[o];s=C(c)||Array.isArray(c)?c:isNaN(+i[n+1])?{}:[]}r[o]=s,r=r[o]}return r}var L=function(r,e){for(var t in void 0===e&&(e={}),r)H(t)?e[t]=r[t]:I(e,t,r[t]);return e},M=function(r){return void 0===r},T=function(r,e,t){void 0===r&&(r={});var n=N(e.split(/[,[\].]+?/)).reduce((function(r,e){return F(r)?r:r[e]}),r);return M(n)||n===r?M(r[e])?t:r[e]:n},q=function(r,e){h(r)&&r.removeEventListener&&(r.removeEventListener(b,e),r.removeEventListener(p,e),r.removeEventListener(g,e))},W={isValid:!1,value:null},_=function(r){return Array.isArray(r)?r.reduce((function(r,e){return e&&e.ref.checked?{isValid:!0,value:e.ref.value}:r}),W):W},P=function(r){return"radio"===r.type},U=function(r){return"file"===r.type},$=function(r){return"checkbox"===r.type},G=function(r){return"select-multiple"===r.type},J={value:!1,isValid:!1},K={value:!0,isValid:!0},Q=function(r){if(Array.isArray(r)){if(r.length>1){var e=r.filter((function(r){return r&&r.ref.checked})).map((function(r){return r.ref.value}));return{value:e,isValid:!!e.length}}var t=r[0].ref,n=t.checked,i=t.value,a=t.attributes;return n?a&&!M(a.value)?M(i)||""===i?K:{value:i,isValid:!0}:K:J}return J};function X(r,e,t,n,i){var a,u=r.current[e];if(u){var o=u.ref,s=o.value,c=o.disabled,l=u.ref,f=u.valueAsNumber,v=u.valueAsDate,d=u.setValueAs;if(c&&n)return;return U(l)?l.files:P(l)?_(u.options).value:G(l)?(a=l.options,[].concat(a).filter((function(r){return r.selected})).map((function(r){return r.value}))):$(l)?Q(u.options).value:i?s:f?""===s?NaN:+s:v?l.valueAsDate:d?d(s):s}if(t)return T(t.current,e)}function Y(r){return!r||r instanceof HTMLElement&&r.nodeType!==Node.DOCUMENT_NODE&&Y(r.parentNode)}var Z=function(r){return C(r)&&!Object.keys(r).length},rr=function(r){return"boolean"==typeof r};function er(r,e){var t,n=H(e)?[e]:B(e),i=1==n.length?r:function(r,e){for(var t=e.slice(0,-1).length,n=0;n<t;)r=M(r)?n++:r[e[n++]];return r}(r,n),a=n[n.length-1];i&&delete i[a];for(var u=0;u<n.slice(0,-1).length;u++){var o=-1,s=void 0,c=n.slice(0,-(u+1)),l=c.length-1;for(u>0&&(t=r);++o<c.length;){var f=c[o];s=s?s[f]:r[f],l===o&&(C(s)&&Z(s)||Array.isArray(s)&&!s.filter((function(r){return C(r)&&!Z(r)||rr(r)})).length)&&(t?delete t[f]:delete r[f]),t=s}}return r}var tr=function(r,e){return r&&r.ref===e};var nr=function(r){return F(r)||!R(r)};function ir(r,e){if(nr(r)||nr(e))return e;for(var t in e){var n=r[t],i=e[t];try{r[t]=C(n)&&C(i)||Array.isArray(n)&&Array.isArray(i)?ir(n,i):i}catch(r){}}return r}function ar(r,e,t){if(nr(r)||nr(e)||r instanceof Date||e instanceof Date)return r===e;if(!o(r)){var n=Object.keys(r),i=Object.keys(e);if(n.length!==i.length)return!1;for(var a=0,u=n;a<u.length;a+=1){var s=u[a],c=r[s];if(!t||"ref"!==s){var l=e[s];if((C(c)||Array.isArray(c))&&(C(l)||Array.isArray(l))?!ar(c,l,t):c!==l)return!1}}}return!0}function ur(r,e,t,n,i){for(var a,u=-1;++u<r.length;){for(var o in r[u])Array.isArray(r[u][o])?(!t[u]&&(t[u]={}),t[u][o]=[],ur(r[u][o],T(e[u]||{},o,[]),t[u][o],t[u],o)):ar(T(e[u]||{},o),r[u][o])?I(t[u]||{},o):t[u]=Object.assign(Object.assign({},t[u]),((a={})[o]=!0,a));n&&!t.length&&delete n[i]}return t}var or=function(r){return"string"==typeof r},sr=function(r,e,t,n,i){var a={},u=function(e){(M(i)||(or(i)?e.startsWith(i):Array.isArray(i)&&i.find((function(r){return e.startsWith(r)}))))&&(a[e]=X(r,e,void 0,n))};for(var o in r.current)u(o);return t?L(a):ir(e,L(a))},cr=function(r){return r instanceof RegExp},lr=function(r){return C(r)&&!cr(r)?r:{value:r,message:""}},fr=function(r){return"function"==typeof r},vr=function(r){return or(r)||o(r)};function dr(r,e,t){if(void 0===t&&(t="validate"),vr(r)||rr(r)&&!r)return{type:t,message:vr(r)?r:"",ref:e}}var mr=function(r,e,t,n,i){var a;return e?Object.assign(Object.assign({},t[r]),{types:Object.assign(Object.assign({},t[r]&&t[r].types?t[r].types:{}),(a={},a[n]=i||!0,a))}):{}},hr=async function(r,e,t,n){var i=t.ref,a=t.ref.value,u=t.options,o=t.required,s=t.maxLength,c=t.minLength,l=t.min,f=t.max,v=t.pattern,d=t.validate,m=i.name,h={},g=P(i),p=$(i),b=g||p,y=""===a,V=mr.bind(null,m,e,h),O=function(r,e,t,n,a){void 0===n&&(n=x),void 0===a&&(a=S);var u=r?e:t;h[m]=Object.assign({type:r?n:a,message:u,ref:i},V(r?n:a,u))};if(o&&(!g&&!p&&(y||F(a))||rr(a)&&!a||p&&!Q(u).isValid||g&&!_(u).isValid)){var j=vr(o)?{value:!!o,message:o}:lr(o),k=j.value,R=j.message;if(k&&(h[m]=Object.assign({type:w,message:R,ref:b?((r.current[m].options||[])[0]||{}).ref:i},V(w,R)),!e))return h}if(!(F(l)&&F(f)||""===a)){var H,N,B=lr(f),I=lr(l);if(isNaN(a)){var L=i.valueAsDate||new Date(a);or(B.value)&&(H=L>new Date(B.value)),or(I.value)&&(N=L<new Date(I.value))}else{var M=i.valueAsNumber||parseFloat(a);F(B.value)||(H=M>B.value),F(I.value)||(N=M<I.value)}if((H||N)&&(O(!!H,B.message,I.message,E,A),!e))return h}if(or(a)&&!y&&(s||c)){var T=lr(s),q=lr(c),W=!F(T.value)&&a.length>T.value,U=!F(q.value)&&a.length<q.value;if((W||U)&&(O(W,T.message,q.message),!e))return h}if(or(a)&&v&&!y){var G=lr(v),J=G.value,K=G.message;if(cr(J)&&!J.test(a)&&(h[m]=Object.assign({type:z,message:K,ref:i},V(z,K)),!e))return h}if(d){var Y=X(r,m,n,!1,!0),er=b&&u?u[0].ref:i;if(fr(d)){var tr=dr(await d(Y),er);if(tr&&(h[m]=Object.assign(Object.assign({},tr),V(D,tr.message)),!e))return h}else if(C(d)){for(var nr={},ir=0,ar=Object.entries(d);ir<ar.length;ir+=1){var ur=ar[ir],sr=ur[0],hr=ur[1];if(!Z(nr)&&!e)break;var gr=dr(await hr(Y),er,sr);gr&&(nr=Object.assign(Object.assign({},gr),V(sr,gr.message)),e&&(h[m]=nr))}if(!Z(nr)&&(h[m]=Object.assign({ref:er},nr),!e))return h}}return h},gr=function(r,e,t){for(var n in void 0===t&&(t=[]),e){var i=r+(C(e)?"."+n:"["+n+"]");nr(e[n])?t.push(i):gr(i,e[n],t)}return t},pr=function(r,e,t,n,i){var a=void 0;return t.add(e),Z(r)||(a=T(r,e),(C(a)||Array.isArray(a))&&gr(e,a).forEach((function(r){return t.add(r)}))),M(a)?i?n:T(n,e):a},br=function(r){return r.substring(0,r.indexOf("["))},yr=function(r,e){return[].concat(r).some((function(r){return function(r,e){return RegExp(("^"+e+"([|.)\\d+").replace(/\[/g,"\\[").replace(/\]/g,"\\]")).test(r)}(e,r)}))};var Vr="undefined"!=typeof window&&"undefined"!=typeof document;function Or(r){var e,t;if(nr(r)||Vr&&(r instanceof File||h(r)))return r;if(!["Set","Map","Object","Date","Array"].includes(null===(e=r.constructor)||void 0===e?void 0:e.name))return r;if(r instanceof Date)return t=new Date(r.getTime());if(r instanceof Set){t=new Set;for(var n=0,i=r;n<i.length;n+=1){var a=i[n];t.add(a)}return t}if(r instanceof Map){t=new Map;for(var u=0,o=r.keys();u<o.length;u+=1){var s=o[u];t.set(s,Or(r.get(s)))}return t}for(var c in t=Array.isArray(r)?[]:{},r)t[c]=Or(r[c]);return t}var jr=function(r){return{isOnSubmit:!r||r===O,isOnBlur:r===y,isOnChange:r===V,isOnAll:r===k,isOnTouch:r===j}},kr=function(r){return P(r)||$(r)},Er="undefined"==typeof window,Ar=Vr?"Proxy"in window:"undefined"!=typeof Proxy;function xr(r){void 0===r&&(r={});var e=r.mode;void 0===e&&(e=O);var o=r.reValidateMode;void 0===o&&(o=V);var s=r.resolver,c=r.context,l=r.defaultValues;void 0===l&&(l={});var f=r.shouldFocusError;void 0===f&&(f=!0);var v=r.shouldUnregister;void 0===v&&(v=!0);var d=r.criteriaMode,m=n({}),y=n({}),j=n({}),E=n(new Set),A=n({}),x=n({}),S=n({}),z=n({}),w=n(l),D=n(!1),R=n(!1),B=n(),W=n({}),_=n({}),J=n(c),K=n(s),Q=n(new Set),rr=n(jr(e)),cr=rr.current,lr=cr.isOnSubmit,vr=cr.isOnTouch,dr=d===k,mr=i({isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touched:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!lr,errors:{}}),xr=mr[0],Sr=mr[1],zr=n({isDirty:!Ar,dirtyFields:!Ar,touched:!Ar||vr,isValidating:!Ar,isSubmitting:!Ar,isValid:!Ar}),wr=n(xr),Dr=n(),Fr=n(jr(o)).current,Rr=Fr.isOnBlur,Cr=Fr.isOnChange;J.current=c,K.current=s,wr.current=xr,W.current=v?{}:Z(W.current)?Or(l):W.current;var Hr=t((function(r){void 0===r&&(r={}),D.current||(wr.current=Object.assign(Object.assign({},wr.current),r),Sr(wr.current))}),[]),Nr=function(){return zr.current.isValidating&&Hr({isValidating:!0})},Br=t((function(r,e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n={});var a=t||function(r){var e=r.errors,t=r.name,n=r.error,i=r.validFields,a=r.fieldsWithValidation,u=M(n),o=T(e,t);return u&&!!o||!u&&!ar(o,n,!0)||u&&T(a,t)&&!T(i,t)}({errors:wr.current.errors,error:e,name:r,validFields:z.current,fieldsWithValidation:S.current}),u=T(wr.current.errors,r);e?(er(z.current,r),a=a||!u||!ar(u,e,!0),I(wr.current.errors,r,e)):((T(S.current,r)||K.current)&&(I(z.current,r,!0),a=a||u),er(wr.current.errors,r)),(a&&!F(t)||!Z(n)||zr.current.isValidating)&&Hr(Object.assign(Object.assign(Object.assign({},n),K.current?{isValid:!!i}:{}),{isValidating:!1}))}),[]),Ir=t((function(r,e){var t=m.current[r],n=t.ref,i=t.options,a=Vr&&h(n)&&F(e)?"":e;P(n)?(i||[]).forEach((function(r){var e=r.ref;return e.checked=e.value===a})):U(n)&&!or(a)?n.files=a:G(n)?[].concat(n.options).forEach((function(r){return r.selected=a.includes(r.value)})):$(n)&&i?i.length>1?i.forEach((function(r){var e=r.ref;return e.checked=Array.isArray(a)?!!a.find((function(r){return r===e.value})):a===e.value})):i[0].ref.checked=!!a:n.value=a}),[]),Lr=t((function(r,e){if(zr.current.isDirty){var t=Jr();return r&&e&&I(t,r,e),!ar(t,w.current)}return!1}),[]),Mr=t((function(r,e){if(void 0===e&&(e=!0),zr.current.isDirty||zr.current.dirtyFields){var t=!ar(T(w.current,r),X(m,r,W)),n=T(wr.current.dirtyFields,r),i=wr.current.isDirty;t?I(wr.current.dirtyFields,r,!0):er(wr.current.dirtyFields,r);var a={isDirty:Lr(),dirtyFields:wr.current.dirtyFields},u=zr.current.isDirty&&i!==a.isDirty||zr.current.dirtyFields&&n!==T(wr.current.dirtyFields,r);return u&&e&&Hr(a),u?a:{}}return{}}),[]),Tr=t((async function(r,e){if("production"!==process.env.NODE_ENV&&!m.current[r])return console.warn("📋 Field is missing with `name` attribute: ",r),!1;var t=(await hr(m,dr,m.current[r],W))[r];return Br(r,t,e),M(t)}),[Br,dr]),qr=t((async function(r){var e=(await K.current(Jr(),J.current,dr)).errors,t=wr.current.isValid;if(Array.isArray(r)){var n=r.map((function(r){var t=T(e,r);return t?I(wr.current.errors,r,t):er(wr.current.errors,r),!t})).every(Boolean);return Hr({isValid:Z(e),isValidating:!1}),n}var i=T(e,r);return Br(r,i,t!==Z(e),{},Z(e)),!i}),[Br,dr]),Wr=t((async function(r){var e=r||Object.keys(m.current);if(Nr(),K.current)return qr(e);if(Array.isArray(e)){!r&&(wr.current.errors={});var t=await Promise.all(e.map((async function(r){return await Tr(r,null)})));return Hr({isValidating:!1}),t.every(Boolean)}return await Tr(e)}),[qr,Tr]),_r=t((function(r,e,t){var n=t.shouldDirty,i=t.shouldValidate,a={};I(a,r,e);for(var u=0,o=gr(r,e);u<o.length;u+=1){var s=o[u];m.current[s]&&(Ir(s,T(a,s)),n&&Mr(s),i&&Wr(s))}}),[Wr,Ir,Mr]),Pr=t((function(r,e,t){var n,i;if(!v&&!nr(e)&&I(W.current,r,Array.isArray(e)?[].concat(e):Object.assign({},e)),m.current[r])Ir(r,e),t.shouldDirty&&Mr(r),t.shouldValidate&&Wr(r);else if(!nr(e)&&(_r(r,e,t),Q.current.has(r))){var a=br(r)||r;I(y.current,r,e),_.current[a](((n={})[a]=T(y.current,a),n)),(zr.current.isDirty||zr.current.dirtyFields)&&t.shouldDirty&&(I(wr.current.dirtyFields,r,function(r,e,t){return ir(ur(r,e,t.slice(0,r.length)),ur(e,r,t.slice(0,r.length)))}(e,T(w.current,r,[]),T(wr.current.dirtyFields,r,[]))),Hr({isDirty:!ar(Object.assign(Object.assign({},Jr()),(i={},i[r]=e,i)),w.current)}))}!v&&I(W.current,r,e)}),[Mr,Ir,_r]),Ur=function(r){return R.current||E.current.has(r)||E.current.has((r.match(/\w+/)||[])[0])},$r=function(r){var e=!0;if(!Z(A.current))for(var t in A.current)r&&A.current[t].size&&!A.current[t].has(r)&&!A.current[t].has(br(r))||(x.current[t](),e=!1);return e};function Gr(r){var e;if(!v){for(var t=Or(r),n=0,i=Q.current;n<i.length;n+=1){var a=i[n];H(a)&&!t[a]&&(t=Object.assign(Object.assign({},t),((e={})[a]=[],e)))}return t}return r}function Jr(r){if(or(r))return X(m,r,W);if(Array.isArray(r)){for(var e={},t=0,n=r;t<n.length;t+=1){var i=n[t];I(e,i,X(m,i,W))}return e}return Gr(sr(m,Or(W.current),v))}B.current=B.current?B.current:async function(r){var e,t,n=r.type,i=r.target,a=i.name,u=m.current[a];if(u){var o=n===g,s=function(r){var e=r.isOnBlur,t=r.isOnChange,n=r.isOnTouch,i=r.isTouched,a=r.isReValidateOnBlur,u=r.isReValidateOnChange,o=r.isBlurEvent,s=r.isSubmitted;return!r.isOnAll&&(!s&&n?!(i||o):(s?a:e)?!o:!(s?u:t)||o)}(Object.assign({isBlurEvent:o,isReValidateOnChange:Cr,isReValidateOnBlur:Rr,isTouched:!!T(wr.current.touched,a),isSubmitted:wr.current.isSubmitted},rr.current)),c=Mr(a,!1),l=!Z(c)||!o&&Ur(a);if(o&&!T(wr.current.touched,a)&&zr.current.touched&&(I(wr.current.touched,a,!0),c=Object.assign(Object.assign({},c),{touched:wr.current.touched})),!v&&$(i)&&I(W.current,a,X(m,a)),s)return!o&&$r(a),(!Z(c)||l&&Z(c))&&Hr(c);if(Nr(),K.current){var f=(await K.current(Jr(),J.current,dr)).errors,d=wr.current.isValid;if(e=T(f,a),$(i)&&!e&&K.current){var h=br(a),p=T(f,h,{});p.type&&p.message&&(e=p),h&&(p||T(wr.current.errors,h))&&(a=h)}d!==(t=Z(f))&&(l=!0)}else e=(await hr(m,dr,u,W))[a];!o&&$r(a),Br(a,e,l,c,t)}};var Kr=t((async function(r){void 0===r&&(r={});var e=Z(m.current)?w.current:{},t=(await K.current(Object.assign(Object.assign(Object.assign({},e),Jr()),r),J.current,dr)||{}).errors,n=Z(t);wr.current.isValid!==n&&Hr({isValid:n})}),[dr]),Qr=t((function(r,e){!function(r,e,t,n,i,a){var u=t.ref,o=t.ref.name,s=r.current[o];if(!i){var c=X(r,o,n);!M(c)&&I(n.current,o,c)}u.type&&s?P(u)||$(u)?Array.isArray(s.options)&&s.options.length?(N(s.options).forEach((function(r,t){void 0===r&&(r={}),(Y(r.ref)&&tr(r,r.ref)||a)&&(q(r.ref,e),er(s.options,"["+t+"]"))})),s.options&&!N(s.options).length&&delete r.current[o]):delete r.current[o]:(Y(u)&&tr(s,u)||a)&&(q(u,e),delete r.current[o]):delete r.current[o]}(m,B.current,r,W,v,e),v&&(er(z.current,r.ref.name),er(S.current,r.ref.name))}),[v]),Xr=t((function(r){if(R.current)Hr();else{for(var e=0,t=E.current;e<t.length;e+=1){if(t[e].startsWith(r)){Hr();break}}$r(r)}}),[]),Yr=t((function(r,e){r&&(Qr(r,e),v&&!N(r.options||[]).length&&(er(wr.current.errors,r.ref.name),I(wr.current.dirtyFields,r.ref.name,!0),Hr({isDirty:Lr()}),zr.current.isValid&&K.current&&Kr(),Xr(r.ref.name)))}),[Kr,Qr]);var Zr=t((function(r,e,t){var n=t?A.current[t]:E.current,i=sr(m,Or(W.current),v,!1,r);if(or(r)){var a=br(r)||r;return Q.current.has(a)&&(i=Object.assign(Object.assign({},j.current),i)),pr(i,r,n,M(T(w.current,r))?e:T(w.current,r),!0)}var u=M(e)?w.current:e;return Array.isArray(r)?r.reduce((function(r,e){var t;return Object.assign(Object.assign({},r),((t={})[e]=pr(i,e,n,u),t))}),{}):(R.current=M(t),L(!Z(i)&&i||u))}),[]);function re(r,e){if(void 0===e&&(e={}),"production"!==process.env.NODE_ENV){if(!r.name)return console.warn("📋 Field is missing `name` attribute",r,"https://react-hook-form.com/api#useForm");if(Q.current.has(r.name.split(/\[\d+\]$/)[0])&&!RegExp(("^"+r.name.split(/\[\d+\]$/)[0]+"[\\d+].\\w+").replace(/\[/g,"\\[").replace(/\]/g,"\\]")).test(r.name))return console.warn('📋 `name` prop should be in object shape: name="test[index].name"',r,"https://react-hook-form.com/api#useFieldArray")}var t,n=r.name,i=r.type,a=r.value,u=Object.assign({ref:r},e),o=m.current,s=kr(r),c=yr(Q.current,n),l=function(e){return Vr&&(!h(r)||e===r)},f=o[n],d=!0;if(f&&(s?Array.isArray(f.options)&&N(f.options).find((function(r){return a===r.ref.value&&l(r.ref)})):l(f.ref)))o[n]=Object.assign(Object.assign({},f),e);else{f=i?s?Object.assign({options:N(f&&f.options||[]).concat([{ref:r}]),ref:{type:i,name:n}},e):Object.assign({},u):u,o[n]=f;var y=M(T(W.current,n));Z(w.current)&&y||(t=T(y?w.current:W.current,n),(d=M(t))||c||Ir(n,t)),Z(e)||(I(S.current,n,!0),!lr&&zr.current.isValid&&hr(m,dr,f,W).then((function(r){var e=wr.current.isValid;Z(r)?I(z.current,n,!0):er(z.current,n),e!==Z(r)&&Hr()}))),!v||c&&d||!c&&er(wr.current.dirtyFields,n),i&&function(r,e,t){var n=r.ref;h(n)&&t&&(n.addEventListener(e?p:b,t),n.addEventListener(g,t))}(s&&f.options?f.options[f.options.length-1]:f,s||"select-one"===r.type,B.current)}}var ee=t((function(r,e){return async function(t){t&&t.preventDefault&&(t.preventDefault(),t.persist());var n={},i=Gr(sr(m,Or(W.current),v,!0));zr.current.isSubmitting&&Hr({isSubmitting:!0});try{if(K.current){var a=await K.current(i,J.current,dr),u=a.errors,o=a.values;wr.current.errors=n=u,i=o}else for(var s=0,c=Object.values(m.current);s<c.length;s+=1){var l=c[s];if(l){var d=l.ref.name,h=await hr(m,dr,l,W);h[d]?(I(n,d,h[d]),er(z.current,d)):T(S.current,d)&&(er(wr.current.errors,d),I(z.current,d,!0))}}Z(n)&&Object.keys(wr.current.errors).every((function(r){return r in m.current}))?(Hr({errors:{},isSubmitting:!0}),await r(i,t)):(wr.current.errors=Object.assign(Object.assign({},wr.current.errors),n),e&&await e(wr.current.errors,t),f&&function(r,e){for(var t in r)if(T(e,t)){var n=r[t];if(n){if(n.ref.focus&&M(n.ref.focus()))break;if(n.options){n.options[0].ref.focus();break}}}}(m.current,wr.current.errors))}finally{wr.current.isSubmitting=!1,Hr({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Z(wr.current.errors),submitCount:wr.current.submitCount+1})}}}),[f,dr]);a((function(){s&&zr.current.isValid&&Kr(),Dr.current=Dr.current||!Vr?Dr.current:function(r,e){var t=new MutationObserver((function(){for(var t=0,n=Object.values(r.current);t<n.length;t+=1){var i=n[t];if(i&&i.options)for(var a=0,u=i.options;a<u.length;a+=1){var o=u[a];o&&o.ref&&Y(o.ref)&&e(i)}else i&&Y(i.ref)&&e(i)}}));return t.observe(window.document,{childList:!0,subtree:!0}),t}(m,Yr)}),[Yr,w.current]),a((function(){return function(){Dr.current&&Dr.current.disconnect(),D.current=!0,"production"===process.env.NODE_ENV&&Object.values(m.current).forEach((function(r){return Yr(r,!0)}))}}),[]),!s&&zr.current.isValid&&(xr.isValid=ar(z.current,S.current)&&Z(wr.current.errors));var te={trigger:Wr,setValue:t((function(r,e,t){Pr(r,e,t||{}),Ur(r)&&Hr(),$r(r)}),[Pr,Wr]),getValues:t(Jr,[]),register:t((function(r,e){if(!Er)if(or(r))re({name:r},e);else{if(!C(r)||!("name"in r))return function(e){return e&&re(e,r)};re(r,e)}}),[w.current]),unregister:t((function(r){for(var e=0,t=Array.isArray(r)?r:[r];e<t.length;e+=1){var n=t[e];Yr(m.current[n],!0)}}),[]),formState:Ar?new Proxy(xr,{get:function(r,e){if("production"!==process.env.NODE_ENV&&"isValid"===e&&lr&&console.warn("📋 `formState.isValid` is applicable with `onTouched`, `onChange` or `onBlur` mode. https://react-hook-form.com/api#formState"),e in r)return zr.current[e]=!0,r[e]}}):xr},ne=u((function(){return Object.assign({isFormDirty:Lr,updateWatchedValue:Xr,shouldUnregister:v,updateFormState:Hr,removeFieldEventListener:Qr,watchInternal:Zr,mode:rr.current,reValidateMode:{isReValidateOnBlur:Rr,isReValidateOnChange:Cr},validateResolver:s?Kr:void 0,fieldsRef:m,resetFieldArrayFunctionRef:_,useWatchFieldsRef:A,useWatchRenderFunctionsRef:x,fieldArrayDefaultValuesRef:y,validFieldsRef:z,fieldsWithValidationRef:S,fieldArrayNamesRef:Q,readFormStateRef:zr,formStateRef:wr,defaultValuesRef:w,shallowFieldsStateRef:W,fieldArrayValuesRef:j},te)}),[w.current,Xr,v,Qr,Zr]);return Object.assign({watch:function(r,e){return Zr(r,e)},control:ne,handleSubmit:ee,reset:t((function(r,e){if(void 0===e&&(e={}),Vr)for(var t=0,n=Object.values(m.current);t<n.length;t+=1){var i=n[t];if(i){var a=i.ref,u=i.options,o=kr(a)&&Array.isArray(u)?u[0].ref:a;if(h(o))try{o.closest("form").reset();break}catch(r){}}}m.current={},w.current=Object.assign({},r||w.current),r&&$r(""),Object.values(_.current).forEach((function(r){return fr(r)&&r()})),W.current=v?{}:Or(r||w.current),function(r){var e=r.errors,t=r.isDirty,n=r.isSubmitted,i=r.touched,a=r.isValid,u=r.submitCount,o=r.dirtyFields;a||(z.current={},S.current={}),y.current={},E.current=new Set,R.current=!1,Hr({submitCount:u?wr.current.submitCount:0,isDirty:!!t&&wr.current.isDirty,isSubmitted:!!n&&wr.current.isSubmitted,isValid:!!a&&wr.current.isValid,dirtyFields:o?wr.current.dirtyFields:{},touched:i?wr.current.touched:{},errors:e?wr.current.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})}(e)}),[]),clearErrors:t((function(r){r&&(Array.isArray(r)?r:[r]).forEach((function(r){return m.current[r]&&H(r)?delete wr.current.errors[r]:er(wr.current.errors,r)})),Hr({errors:r?wr.current.errors:{}})}),[]),setError:t((function(r,e){var t=(m.current[r]||{}).ref;I(wr.current.errors,r,Object.assign(Object.assign({},e),{ref:t})),Hr({isValid:!1}),e.shouldFocus&&t&&t.focus&&t.focus()}),[]),errors:xr.errors},te)}e(null).displayName="RHFContext";var Sr,zr=function(e){var t=e.isExtraSmall,n=e.isHovered,i=r.createElement("path",{fillRule:"evenodd",d:"M13.554 28.445h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm1 6.312h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm5.986-16.908h1v-3.158h3.159v-1H19.54v-3.159h-1v3.159h-3.159v1h3.159v3.158zM30.791 39.72h8.37V20.682h-8.37V39.72zm-22.202 0h20.903V10.547H8.589V39.72zm22.203-20.338V9.247H7.289V41.02h33.173V19.382h-9.67zm-9.139 9.063h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm1 6.312h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zM10.869 7.702h16.343v-1.3H10.869v1.3z"}),a=r.createElement("path",{fillRule:"evenodd",d:"M13.554 28.445h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm1 6.312h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm5.986-15.908h1v-4.158h4.159v-1H19.54v-4.159h-1v4.159h-4.159v1h4.159v4.158zM30.791 39.72h8.37V20.682h-8.37V39.72zm-22.202 0h20.903V10.547H8.589V39.72zm22.203-20.338V9.247H7.289V41.02h33.173V19.382h-9.67zm-9.139 9.063h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm1 6.312h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zM10.869 7.702h16.343v-1.3H10.869v1.3z"}),u=r.createElement("path",{fillRule:"evenodd",d:"M21.527 35.62h2.862v-3.233h-2.862v3.234zm-1.01 1.01H25.4v-5.254h-4.884v5.254zm-7.09-1.01h2.863v-3.233h-2.863v3.234zm-1.01 1.01H17.3v-5.254h-4.883v5.254zm9.11-8.322h2.862v-3.232h-2.862v3.232zm-1.01 1.01H25.4v-5.254h-4.884v5.254zm-7.09-1.01h2.863v-3.232h-2.863v3.232zm-1.01 1.01H17.3v-5.253h-4.883v5.254zm5.86-9.6h1.264V16.69h3.027v-1.263H19.54V12.4h-1.263v3.027H15.25v1.263h3.028v3.028zm12.365 19.888h8.406V20.53h-8.406v19.075zm-22.204 0h20.94V9.132H8.439v30.474zm22.204-20.338V7.87H7.175v33H40.31V19.267h-9.67z"});return t?n?r.createElement("path",{fillRule:"evenodd",d:"M22.158 35.62h2.863v-3.233h-2.863v3.234zm-1.01 1.01h4.883v-5.254h-4.883v5.254zm-7.09-1.01h2.863v-3.233H14.06v3.234zm-1.01 1.01h4.884v-5.254h-4.884v5.254zm9.11-8.322h2.863v-3.232h-2.863v3.232zm-1.01 1.01h4.883v-5.254h-4.883v5.254zm-7.09-1.01h2.863v-3.232H14.06v3.232zm-1.01 1.01h4.884v-5.253h-4.884v5.254zm5.861-9.6h1.264V16.69h3.026v-1.263h-3.026V12.4h-1.264v3.027h-3.027v1.263h3.027v3.028zm12.364 19.888h8.407V20.53h-8.407v19.075zm-22.204 0H30.01V9.132H9.07v30.474zm22.204-20.338V7.87H7.806v33h33.137V19.267h-9.67z"}):u:n?a:i};!function(r){r.formgroup="formgroup",r.checkbox="checkbox",r.radiobutton="radiobutton",r.textarea="textarea",r.input="input"}(Sr||(Sr={}));var wr=function(e){var t=e.exampleType,n=void 0===t?Sr.formgroup:t,i=xr(),a=i.register,u=i.handleSubmit,o=i.errors,h=o.formgroup1||o.formgroup2||o.formgroup3||o.formgroup4||o.formgroup5,g="Du må velge et alternativ",p=function(r){return r.length>=2||"Du må velge to alternativ"};return r.createElement("form",{onSubmit:u((function(r){console.log(r)}))},r.createElement(s,{variant:e.variant,errorSummary:h?"Sjekk at alt er riktig utfylt":void 0},n===Sr.formgroup?[r.createElement(c,{key:0,title:"One amazing title",legend:"Check out these checkboxes!",error:o.formgroup1?o.formgroup1.message:void 0,variant:e.variant,name:"formgroup1"},r.createElement(l,{inputId:"checkbox1",label:"Checkbox 1",ref:a({required:g})}),r.createElement(l,{inputId:"checkbox2",label:"Checkbox 2",ref:a({required:g})}),r.createElement(l,{inputId:"checkbox3",label:"Checkbox 3",ref:a({required:g})})),r.createElement(c,{key:1,legend:"Select two options!",error:o.formgroup2?o.formgroup2.message:void 0,variant:e.variant,name:"formgroup2"},r.createElement(l,{inputId:"checkbox4",label:"Checkbox 4",ref:a({validate:p})}),r.createElement(l,{inputId:"checkbox5",label:"Checkbox 5",ref:a({validate:p})}),r.createElement(l,{inputId:"checkbox6",label:"Checkbox 6",ref:a({validate:p})})),r.createElement(c,{key:2,legend:"Select two options!",error:o.formgroup3?o.formgroup3.message:void 0,variant:e.variant,name:"formgroup3"},r.createElement(v,{inputId:"radiobutton1",label:"Radiobutton 1",ref:a({required:g})}),r.createElement(v,{inputId:"radiobutton2",label:"Radiobutton 2",ref:a({required:g})}),r.createElement(v,{inputId:"radiobutton3",label:"Radiobutton 3",ref:a({required:g})})),r.createElement(c,{key:3,error:o.formgroup4?o.formgroup4.message:void 0},r.createElement(d,{defaultValue:"Dette er en test \n\n Hello \n\n test \n\n test test",grow:!0,maxCharacters:40,minRows:5,label:"Skriv din historie her",textareaId:"textarea1",name:"formgroup4",ref:a({maxLength:{value:40,message:"Det kan ikke legges inn mer enn 40 tegn"}})})),r.createElement(c,{name:"formgroup5",key:4,variant:e.variant,error:o.formgroup5?o.formgroup5.message:void 0},r.createElement(m,{label:"Skriv inn din tekst",placeholder:"Skriv noe!",icon:zr,ref:a({required:"Du må skrive noe her"})}))]:n===Sr.checkbox?r.createElement(c,{name:"formgroup1",error:o.formgroup1?o.formgroup1.message:void 0},r.createElement(l,{name:"formgroup1",inputId:"checkbox1",label:"Checkbox 1",error:o.formgroup1,variant:e.variant,ref:a({required:g})})):n===Sr.radiobutton?r.createElement(c,{name:"formgroup3",error:o.formgroup3?o.formgroup3.message:void 0},r.createElement(v,{name:"formgroup3",inputId:"radiobutton1",label:"Radiobutton 1",error:o.formgroup3,variant:e.variant,ref:a({required:g})})):n===Sr.textarea?r.createElement(c,{error:o.formgroup4?o.formgroup4.message:void 0},r.createElement(d,{defaultValue:"Dette er min historie \n\n Hello \n\n test",grow:!0,maxCharacters:40,minRows:5,label:"Skriv din historie her",textareaId:"textarea1",name:"formgroup4",ref:a({maxLength:{value:40,message:"Det kan ikke legges inn mer enn 40 tegn"}})})):n===Sr.input?r.createElement(c,{name:"formgroup5",key:4,variant:e.variant,error:o.formgroup5?o.formgroup5.message:void 0},r.createElement(m,{inputId:"input1",label:"Skriv inn din tekst",placeholder:"Skriv noe!",icon:zr,ref:a({required:"Du må skrive noe her"})})):void 0),r.createElement(f,null,"Submit"))};export default wr;export{wr as FormExample,Sr as FormExampleVariants};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{F as s}from"../../FormGroup-
|
|
1
|
+
import{F as s}from"../../FormGroup-0577b07f.js";export{F as FormGroup,F as default}from"../../FormGroup-0577b07f.js";import"../../_rollupPluginBabelHelpers-b8ef6dd9.js";import"react";import"../../index-9b84fabc.js";import"./styles.module.scss";import"../../Checkbox-798282e4.js";import"../../uuid-fe7442b7.js";import"../../Check-6291ad09.js";import"../../Icon-89da8de4.js";import"../../_tslib-51c8a283.js";import"../../constants-ad6c82db.js";import"../../color-a10c7892.js";import"../../index-0e78dfa0.js";import"../../palette-f206f488.js";import"../../grid-11a70eb7.js";import"../Checkbox/styles.module.scss";import"../../RadioButton-fe4bbd36.js";import"../RadioButton/styles.module.scss";import"../../Input-19650c24.js";import"../../useBreakpoint-552af2b9.js";import"../Input/styles.module.scss";import"../../Title-af53f589.js";import"../Title/styles.module.scss";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
&--invalid {
|
|
37
|
-
margin-left: -
|
|
38
|
-
margin-right: -
|
|
39
|
-
padding-left: getSpacer(
|
|
40
|
-
padding-right:
|
|
37
|
+
margin-left: getSpacer(xs) * -1;
|
|
38
|
+
margin-right: getSpacer(xs) * -1;
|
|
39
|
+
padding-left: getSpacer(2xs);
|
|
40
|
+
padding-right: getSpacer(xs);
|
|
41
41
|
background-color: $cherry100;
|
|
42
|
-
border-left:
|
|
42
|
+
border-left: getSpacer(3xs) solid $cherry500;
|
|
43
43
|
|
|
44
44
|
@media (min-width: map-get($grid-breakpoints, md)) {
|
|
45
|
-
margin-left:
|
|
46
|
-
margin-right:
|
|
45
|
+
margin-left: (getSpacer(m) + 0.25rem) * -1;
|
|
46
|
+
margin-right: (getSpacer(m) + 0.25rem) * -1;
|
|
47
47
|
padding-left: getSpacer(m);
|
|
48
48
|
padding-right: getSpacer(m);
|
|
49
49
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{I as s}from"../../Input-
|
|
1
|
+
import{I as s}from"../../Input-19650c24.js";export{a as InputTypes,I as default}from"../../Input-19650c24.js";import"../../_rollupPluginBabelHelpers-b8ef6dd9.js";import"../../_tslib-51c8a283.js";import"react";import"../../index-9b84fabc.js";import"../../constants-ad6c82db.js";import"../../uuid-fe7442b7.js";import"../../Icon-89da8de4.js";import"../../color-a10c7892.js";import"../../index-0e78dfa0.js";import"../../palette-f206f488.js";import"../../grid-11a70eb7.js";import"../../useBreakpoint-552af2b9.js";import"./styles.module.scss";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as e}from"../../_rollupPluginBabelHelpers-b8ef6dd9.js";import{_ as t}from"../../_tslib-51c8a283.js";import r from"react";import{c as a}from"../../index-9b84fabc.js";import{I as l}from"../../Icon-89da8de4.js";import{A as i,I as o}from"../../constants-ad6c82db.js";import{u as s,B as n}from"../../useBreakpoint-552af2b9.js";import{u as m}from"../../useHover-9710204a.js";import c from"./styles.module.scss";import"../../grid-11a70eb7.js";var d=function(e){var t=e.isExtraSmall,a=e.isHovered,l=r.createElement("path",{d:"M19.171 32.951l1.409 1.42L31.031 24 20.58 13.63l-1.409 1.42 9.02 8.95z"}),i=r.createElement("path",{d:"M24.479 11.63L36.93 23.999 24.479 36.37l-1.409-1.419L33.083 25H13v-2h20.085L23.07 13.049z"}),o=r.createElement("path",{d:"M17.885 32.577l1.779 1.793 10.451-10.371L19.664 13.63l-1.779 1.793 8.644 8.576z"});return t?a?r.createElement("path",{d:"M25.98 11.103l12.977 12.896L25.98 36.897l-1.78-1.794 9.899-9.841-20.204.001v-2.526l20.204-.001-9.899-9.839z"}):o:a?i:l},p=r.forwardRef((function(p,v){var f,u=p.children,h=p.className,_=void 0===h?"":h,k=p.color,b=void 0===k?"neutral":k,E=p.icon,L=p.size,z=void 0===L?"medium":L,g=p.chevron,j=void 0!==g&&g,N=p.testId,H=p.target,I=t(p,["children","className","color","icon","size","chevron","testId","target"]),x=m(),y=x.hoverRef,B=x.isHovered,M=s(),S="small"!==z&&!(!j&&!E);return r.createElement("li",{ref:v,"data-testid":N,"data-analyticsid":i.Link},r.createElement("a",Object.assign({className:a(c["link-list__anchor"],c["link-list__anchor--"+b],(f={},e(f,c["link-list__anchor--small"],"small"===z),e(f,c["link-list__anchor--medium"],"medium"===z),e(f,c["link-list__anchor--large"],"large"===z),f),_),ref:y,rel:"_blank"===H?"noopener noreferrer":void 0,target:H},I),S&&E&&r.createElement("span",{className:c["link-list__icon"]},r.cloneElement(E,{size:M===n.xs?o.XSmall:o.Small,isHovered:B})),r.createElement("span",{className:c["link-list__content"]},u),S&&j&&r.createElement("span",{className:c["link-list__chevron"]},r.createElement(l,{svgIcon:d,isHovered:B,size:o.XSmall}))))})),v=r.forwardRef((function(t,l){var o,s=t.children,n=t.className,m=void 0===n?"":n,d=t.chevron,v=void 0!==d&&d,f=t.size,u=void 0===f?"medium":f,h=t.color,_=t.topBorder,k=void 0===_||_,b=t.bottomBorder,E=void 0===b||b,L=t.testId;return r.createElement("ul",{ref:l,className:a(c["link-list"],(o={},e(o,c["link-list--hastopborder"],k),e(o,c["link-list--nobottomborder"],!E),o),m||""),"data-testid":L,"data-analyticsid":i.LinkList},r.Children.map(s,(function(e){if(e.type===p)return r.cloneElement(e,{color:h,size:u,chevron:v})})))}));v.Link=p,p.displayName="LinkList.Link";export default v;export{v as LinkList};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -32,36 +32,36 @@
|
|
|
32
32
|
cursor: pointer;
|
|
33
33
|
|
|
34
34
|
&--small {
|
|
35
|
-
padding: getSpacer(
|
|
35
|
+
padding: getSpacer(2xs) 0 getSpacer(2xs) 0;
|
|
36
36
|
font-size: $font-size-xs;
|
|
37
37
|
line-height: $lineheight-size-xs;
|
|
38
38
|
}
|
|
39
39
|
&--medium {
|
|
40
|
-
padding: getSpacer(
|
|
40
|
+
padding: getSpacer(2xs) 0 getSpacer(2xs) 0;
|
|
41
41
|
font-size: $font-size-sm;
|
|
42
42
|
line-height: $lineheight-size-sm;
|
|
43
43
|
}
|
|
44
44
|
&--large {
|
|
45
|
-
padding: getSpacer(
|
|
45
|
+
padding: getSpacer(2xs) 0 getSpacer(2xs) 0;
|
|
46
46
|
font-size: $font-size-md;
|
|
47
47
|
line-height: $lineheight-size-md;
|
|
48
48
|
}
|
|
49
49
|
@media (min-width: map-get($grid-breakpoints, md)) {
|
|
50
50
|
&--small {
|
|
51
|
-
padding-left: getSpacer(
|
|
52
|
-
padding-right: getSpacer(
|
|
51
|
+
padding-left: getSpacer(2xs);
|
|
52
|
+
padding-right: getSpacer(2xs);
|
|
53
53
|
font-size: $font-size-sm;
|
|
54
54
|
line-height: $lineheight-size-sm;
|
|
55
55
|
}
|
|
56
56
|
&--medium {
|
|
57
|
-
padding-left: getSpacer(
|
|
58
|
-
padding-right: getSpacer(
|
|
57
|
+
padding-left: getSpacer(2xs);
|
|
58
|
+
padding-right: getSpacer(2xs);
|
|
59
59
|
font-size: $font-size-md;
|
|
60
60
|
line-height: $lineheight-size-md;
|
|
61
61
|
}
|
|
62
62
|
&--large {
|
|
63
|
-
padding-left: getSpacer(
|
|
64
|
-
padding-right: getSpacer(
|
|
63
|
+
padding-left: getSpacer(2xs);
|
|
64
|
+
padding-right: getSpacer(2xs);
|
|
65
65
|
font-size: $font-size-lg;
|
|
66
66
|
line-height: $lineheight-size-lg;
|
|
67
67
|
}
|
|
@@ -135,13 +135,13 @@
|
|
|
135
135
|
&__icon {
|
|
136
136
|
display: flex;
|
|
137
137
|
align-items: center;
|
|
138
|
-
margin-right: getSpacer(
|
|
138
|
+
margin-right: getSpacer(2xs);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
&__chevron {
|
|
142
142
|
display: flex;
|
|
143
143
|
align-items: center;
|
|
144
144
|
margin-left: auto;
|
|
145
|
-
padding-left: getSpacer(
|
|
145
|
+
padding-left: getSpacer(2xs);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{L as s}from"../../Loader-
|
|
1
|
+
import{L as s}from"../../Loader-fa16a352.js";export{O as Overlay,L as default}from"../../Loader-fa16a352.js";import"../../_rollupPluginBabelHelpers-b8ef6dd9.js";import"react";import"../../index-9b84fabc.js";import"../../uuid-fe7442b7.js";import"./styles.module.scss";import"../../constants-ad6c82db.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@import '../../scss/_spacers.scss';
|
|
1
2
|
@import '../../scss/_palette.scss';
|
|
2
3
|
@import 'bootstrap/scss/mixins/_screen-reader.scss';
|
|
3
4
|
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
|
|
44
45
|
&--inline {
|
|
45
46
|
align-self: center;
|
|
46
|
-
padding-left:
|
|
47
|
+
padding-left: getSpacer(2xs);
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
&--overlay {
|
package/components/Logo/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e}from"../../_tslib-51c8a283.js";import t from"react";import{A as c}from"../../constants-ad6c82db.js";import{g as l}from"../../color-
|
|
1
|
+
import{_ as e}from"../../_tslib-51c8a283.js";import t from"react";import{A as c}from"../../constants-ad6c82db.js";import{g as l}from"../../color-a10c7892.js";import"../../index-0e78dfa0.js";import"../../palette-f206f488.js";import"../../grid-11a70eb7.js";var a=function(e){var a=e.size,s=void 0===a?300:a,v=e.color,h=void 0===v?"black":v,i=e.className,o=void 0===i?"":i,r=e.testId;return t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,role:"img","aria-labelledby":"logo-title",viewBox:"0 0 502 220",className:o,"data-testid":r,"data-analyticsid":c.Logo},t.createElement("title",{id:"logo-title"},"Helsenorge"),t.createElement("g",{fill:l(h,500)},t.createElement("path",{d:"M39.8 2.5v26.9H17V2.5H1v69.9h16V43.6h22.8v28.8h16.1V2.5zM250.3 58.6V2.5h-16v69.9h43.5V58.6zM142.9 122.5c-16.1 0-27.4 13.6-27.4 33.1s11.2 33.1 27.4 33.1 27.4-13.6 27.4-33.1-11.3-33.1-27.4-33.1zm19 33.1c0 11.9-5 25.9-19 25.9s-19-13.9-19-25.9c0-11.9 5-25.9 19-25.9s19 14 19 25.9zM501 40c0-19.1-11.1-32.4-27-32.4-16.4 0-27.4 13.3-27.4 33.1 0 19.5 11.5 33.1 28 33.1 12.2 0 21.4-6 24.7-16.2l.5-1.6h-8.3l-.3.7c-2.8 6.2-8.8 9.8-16.6 9.8-12.9 0-18.5-11.5-19.5-22.7H501V40zm-8.3-3.2h-37.6c1-10.8 6.5-21.9 18.9-21.9 13.2 0 18.3 12.6 18.7 21.9zM30.4 122.4c-10.8 0-16.6 6.7-19.5 11.8v-9.9H3.3v62.6h8.1v-31.4c0-8.4 4.4-25.7 18.1-25.7 14 0 15.9 12 15.9 25v32.1h8.1v-32.1c.1-16.1-2.7-32.4-23.1-32.4zM134.3 59V43H157V30h-22.7V15.9H165V2.5h-46.4v69.9h47.3V59zM466.7 173.4v-16h22.7v-13h-22.7v-14.1h30.7v-13.4H451v69.9h47.3v-13.4zM246.7 140.5v-16.3h-7.6v62.6h8.1v-37.6l27.3-19.6v-9zM393.5 120.6l-14.7 10.5c-4.4-5.6-11.2-8.7-18.8-8.7-13.6 0-23.6 9.8-23.6 23.3 0 10.6 6.2 19.1 16 22.2l-16 17.5c-4 4.6-5.7 8.3-5.7 12.7 0 12.6 11.1 20.7 28.2 20.7 16.9 0 28.3-8.3 28.3-20.7 0-12.5-11.1-20.6-28.3-20.6-1.7 0-3.9.2-5.6.5l8-9c12.9-.7 22.2-10.4 22.2-23.3 0-2.8-.4-5.5-1.2-7.8 0-.1-.1-.2-.1-.3l11.2-8.1v-8.9zm-34.4 64.2c12.1 0 20 5.2 20 13.4s-7.8 13.5-20 13.5c-12.1 0-19.9-5.3-19.9-13.5 0-7.8 8.3-13.4 19.9-13.4zm.9-23c-8.8 0-15.2-6.8-15.2-16 0-9.3 6.4-16 15.2-16s15.2 6.7 15.2 16c0 9.2-6.4 16-15.2 16zM366.7 30.3c-6.6-2.3-13.5-4.7-13.5-9.2 0-4.8 4.2-7 9.3-7 5.4 0 9 4.5 9 8.5v.8h16.2v-.6c0-13-10.2-21.7-25.4-21.7-15.3 0-24.9 7.8-24.9 20.4 0 14.7 13.1 18.4 22.9 21.9 6.5 2.4 13.6 4.3 13.6 8.7 0 4.6-3.4 8-10.6 8-6.5 0-10.9-3.8-10.9-9.4v-.8h-16.7v.8c0 14.5 10.3 23.1 27.5 23.1 16.5 0 26-7.6 26-21.5 0-14.4-12.5-18.5-22.5-22z"})))},s=function(e){var c=e.size,a=void 0===c?300:c,s=e.color,v=void 0===s?"black":s,h=e.className,i=void 0===h?"":h,o=e.testId;return t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:a,role:"img","aria-labelledby":"logo-title",viewBox:"0 0 87 12",className:i,"data-testid":o},t.createElement("title",{id:"logo-title"},"Helsenorge"),t.createElement("g",{fill:l(v,500)},t.createElement("path",{d:"M5 .8v2.8H2.6V.8H1V8h1.6V5.1H5V8h1.6V.8zM20.9 6.6V.8h-1.6V8h4.5V6.6zM57.9 1.4c-1.7 0-2.8 1.4-2.8 3.4s1.2 3.4 2.8 3.4 2.8-1.4 2.8-3.4-1.1-3.4-2.8-3.4zm2 3.4c0 1.2-.5 2.7-2 2.7-1.4 0-2-1.4-2-2.7s.5-2.7 2-2.7 2 1.5 2 2.7zM86 4.7c0-2-1.1-3.3-2.8-3.3-1.7 0-2.8 1.4-2.8 3.4s1.2 3.4 2.9 3.4c1.2 0 2.2-.6 2.5-1.7l.1-.2H85v.1c-.3.6-.9 1-1.7 1-1.3 0-1.9-1.2-2-2.3H86v-.4zm-.9-.3h-3.9c.1-1.1.7-2.3 1.9-2.3 1.5 0 2 1.3 2 2.3zM49.2 1.4c-1.1 0-1.7.7-2 1.2v-1h-.8V8h.8V4.8c0-.9.5-2.6 1.9-2.6s1.6 1.2 1.6 2.6V8h.8V4.7c0-1.6-.2-3.3-2.3-3.3zM12.1 6.6V5h2.4V3.7h-2.4V2.2h3.2V.8h-4.8V8h4.9V6.6zM38.3 6.6V5h2.3V3.7h-2.3V2.2h3.2V.8h-4.8V8h4.9V6.6zM65.5 3.3V1.6h-.8V8h.8V4.1l2.8-2v-.9zM77.6 1.2l-1.5 1.1c-.5-.6-1.1-.9-1.9-.9-1.4 0-2.4 1-2.4 2.4 0 1.1.6 2 1.6 2.3l-1.6 1.8c-.4.5-.6.9-.6 1.3 0 1.3 1.1 2.1 2.9 2.1 1.7 0 2.9-.9 2.9-2.1 0-1.3-1.1-2.1-2.9-2.1h-.6l.8-.9c1.3-.1 2.3-1.1 2.3-2.4 0-.3 0-.6-.1-.8l1.2-.8v-1zM74 7.8c1.2 0 2.1.5 2.1 1.4 0 .8-.8 1.4-2.1 1.4-1.2 0-2-.5-2-1.4 0-.8.8-1.4 2-1.4zm.1-2.4c-.9 0-1.6-.7-1.6-1.7s.7-1.6 1.6-1.6c.9 0 1.6.7 1.6 1.6 0 1-.7 1.7-1.6 1.7zM30.4 3.7c-.7-.2-1.4-.5-1.4-1s.4-.7 1-.7.9.5.9.9V3h1.7v-.1c0-1.3-1.1-2.2-2.6-2.2-1.6 0-2.6.8-2.6 2.1 0 1.5 1.3 1.9 2.4 2.3.7.2 1.4.4 1.4.9s-.3.8-1.1.8c-.7 0-1.1-.4-1.1-1v-.1h-1.7v.1c0 1.5 1.1 2.4 2.8 2.4 1.7 0 2.7-.8 2.7-2.2-.1-1.5-1.4-2-2.4-2.3z"})))};export default function(c){var l=c.byline,v=void 0!==l&&l,h=e(c,["byline"]);return v?t.createElement(s,Object.assign({},h)):t.createElement(a,Object.assign({},h))}
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{M as s}from"../../Modal-
|
|
1
|
+
import{M as s}from"../../Modal-ad02991b.js";export{b as ModalSize,a as ModalVariants,M as default}from"../../Modal-ad02991b.js";import"../../_rollupPluginBabelHelpers-b8ef6dd9.js";import"react";import"../../index-9b84fabc.js";import"../../palette-f206f488.js";import"../../Button-d5147e38.js";import"../../_tslib-51c8a283.js";import"../../constants-ad6c82db.js";import"../../color-a10c7892.js";import"../../index-0e78dfa0.js";import"../../grid-11a70eb7.js";import"../../Icon-89da8de4.js";import"../../Loader-fa16a352.js";import"../../uuid-fe7442b7.js";import"../Loader/styles.module.scss";import"../../useHover-9710204a.js";import"../../useWindowSize-750f9b68.js";import"../Button/styles.module.scss";import"./styles.module.scss";import"../../AlertSignFill-e607ff43.js";import"../../useIsVisible-a1f67a11.js";import"../../Title-af53f589.js";import"../Title/styles.module.scss";import"../../Close-35ad7d35.js";import"../Close/styles.module.scss";import"../../useBreakpoint-552af2b9.js";import"react-dom";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
&__iconWrapper {
|
|
50
|
-
padding-right:
|
|
50
|
+
padding-right: getSpacer(xs);
|
|
51
51
|
}
|
|
52
52
|
&__afterTitleChildren {
|
|
53
|
-
padding-left:
|
|
53
|
+
padding-left: getSpacer(xs);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
p {
|
|
@@ -72,13 +72,14 @@
|
|
|
72
72
|
|
|
73
73
|
&--large {
|
|
74
74
|
width: calc(100vw - 0.75rem);
|
|
75
|
+
padding-bottom: getSpacer(l);
|
|
75
76
|
@media (max-width: map-get($grid-breakpoints, sm)) {
|
|
76
77
|
p {
|
|
77
78
|
font-size: 1.125rem;
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
|
-
|
|
81
81
|
@media (min-width: map-get($grid-breakpoints, md)) {
|
|
82
|
+
padding-bottom: getSpacer(xl);
|
|
82
83
|
width: 612px;
|
|
83
84
|
}
|
|
84
85
|
@media (min-width: map-get($grid-breakpoints, lg)) {
|
|
@@ -88,7 +89,7 @@
|
|
|
88
89
|
|
|
89
90
|
&--medium {
|
|
90
91
|
width: calc(100vw - 0.75rem);
|
|
91
|
-
|
|
92
|
+
padding-bottom: getSpacer(m);
|
|
92
93
|
@media (min-width: map-get($grid-breakpoints, md)) {
|
|
93
94
|
width: 335px;
|
|
94
95
|
}
|
|
@@ -98,6 +99,7 @@
|
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
&--image {
|
|
102
|
+
padding: 0;
|
|
101
103
|
@media (min-width: map-get($grid-breakpoints, md)) {
|
|
102
104
|
max-height: calc(100vh - 24px);
|
|
103
105
|
max-width: calc(100vw - 24px);
|
|
@@ -138,8 +140,8 @@
|
|
|
138
140
|
|
|
139
141
|
&__close {
|
|
140
142
|
position: absolute;
|
|
141
|
-
right: getSpacer(
|
|
142
|
-
top: getSpacer(
|
|
143
|
+
right: getSpacer(3xs);
|
|
144
|
+
top: getSpacer(3xs);
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
|
|
@@ -158,19 +160,19 @@
|
|
|
158
160
|
|
|
159
161
|
&__scroll {
|
|
160
162
|
&--large {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
+
padding: getSpacer(xl) getSpacer(m) getSpacer(2xs) getSpacer(m);
|
|
164
|
+
@media (min-width: map-get($grid-breakpoints, md)) {
|
|
165
|
+
padding: getSpacer(xl) getSpacer(xl) getSpacer(2xs) getSpacer(xl);
|
|
163
166
|
}
|
|
164
|
-
padding: getSpacer(xl) getSpacer(xl) getSpacer(xs) getSpacer(xl);
|
|
165
167
|
}
|
|
166
168
|
&--medium {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
+
padding: getSpacer(l) getSpacer(m) getSpacer(2xs) getSpacer(m);
|
|
170
|
+
@media (min-width: map-get($grid-breakpoints, md)) {
|
|
171
|
+
padding: getSpacer(xl) getSpacer(m) getSpacer(2xs) getSpacer(m);
|
|
169
172
|
}
|
|
170
|
-
padding: getSpacer(l) getSpacer(m) getSpacer(xs) getSpacer(m);
|
|
171
173
|
}
|
|
172
174
|
&--large#{&}--image {
|
|
173
|
-
padding: getSpacer(xl) getSpacer(
|
|
175
|
+
padding: getSpacer(xl) getSpacer(2xs) getSpacer(l) getSpacer(2xs);
|
|
174
176
|
}
|
|
175
177
|
}
|
|
176
178
|
|
|
@@ -212,13 +214,13 @@
|
|
|
212
214
|
}
|
|
213
215
|
|
|
214
216
|
&--large {
|
|
215
|
-
padding: getSpacer(l) getSpacer(
|
|
216
|
-
@media (
|
|
217
|
-
padding: getSpacer(l) getSpacer(
|
|
217
|
+
padding: getSpacer(l) getSpacer(m) 0 getSpacer(m);
|
|
218
|
+
@media (min-width: map-get($grid-breakpoints, md)) {
|
|
219
|
+
padding: getSpacer(l) getSpacer(xl) 0 getSpacer(xl);
|
|
218
220
|
}
|
|
219
221
|
}
|
|
220
222
|
&--medium {
|
|
221
|
-
padding: getSpacer(m) getSpacer(m)
|
|
223
|
+
padding: getSpacer(m) getSpacer(m) 0 getSpacer(m);
|
|
222
224
|
}
|
|
223
225
|
}
|
|
224
226
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
import{b as a}from"../../_rollupPluginBabelHelpers-b8ef6dd9.js";import e from"react";import{c as t}from"../../index-9b84fabc.js";import{p as o}from"../../palette-f206f488.js";import{I as n}from"../../Icon-89da8de4.js";import{A as i}from"../../constants-ad6c82db.js";import{a as r,A as l}from"../../AlertSignFill-e607ff43.js";import c from"./styles.module.scss";import{C as s}from"../../Close-35ad7d35.js";import"../../_tslib-51c8a283.js";import"../Close/styles.module.scss";import"../../useBreakpoint-552af2b9.js";import"../../grid-11a70eb7.js";var m={info:{color:"kiwi",depth:50},warn:{color:"banana",depth:50},alert:{color:"cherry",depth:100},crisis:{color:"black",depth:0}},p={info:e.createElement(n,{svgIcon:function(a){var t=a.isExtraSmall,o=a.isHovered,n=e.createElement("path",{d:"M25.672 30.501a.682.682 0 01-.322-.272.835.835 0 01-.11-.443v-7.917l-.112-.112-3.651.194v.544c.148.015.314.05.495.104.18.055.316.112.406.172a.994.994 0 01.299.316.88.88 0 01.119.459v6.337a.879.879 0 01-.098.443.623.623 0 01-.335.257c-.09.035-.197.06-.32.074a8.883 8.883 0 01-.38.038v.544h4.709v-.544a2.45 2.45 0 01-.7-.194M24 37.604c-7.5 0-13.604-6.103-13.604-13.604 0-7.501 6.104-13.603 13.604-13.603 7.502 0 13.602 6.102 13.602 13.603 0 7.501-6.1 13.604-13.601 13.604m0-28.909C15.56 8.695 8.694 15.562 8.694 24c0 8.438 6.867 15.305 15.305 15.305 8.438 0 15.304-6.867 15.304-15.305 0-8.438-6.866-15.305-15.304-15.305m-.274 10.632a1.559 1.559 0 100-3.118 1.559 1.559 0 000 3.118"}),i=e.createElement("path",{d:"M25.672 30.501a.682.682 0 01-.322-.272.835.835 0 01-.11-.443v-7.917l-.112-.112-3.651.194v.544c.148.015.314.05.495.104.18.055.316.112.406.172a.994.994 0 01.299.316.88.88 0 01.119.459v6.337a.879.879 0 01-.098.443.623.623 0 01-.335.257c-.09.035-.197.06-.32.074a8.883 8.883 0 01-.38.038v.544h4.709v-.544a2.45 2.45 0 01-.7-.194M24 37.604c-7.5 0-13.604-6.103-13.604-13.604 0-7.501 6.104-13.603 13.604-13.603 7.502 0 13.602 6.102 13.602 13.603 0 7.501-6.1 13.604-13.601 13.604m0-28.909C15.56 8.695 8.694 15.562 8.694 24c0 8.438 6.867 15.305 15.305 15.305 8.438 0 15.304-6.867 15.304-15.305 0-8.438-6.866-15.305-15.304-15.305m-.274 8.632a1.559 1.559 0 100-3.118 1.559 1.559 0 000 3.118"}),r=e.createElement("path",{d:"M25.668 30.487a.68.68 0 01-.32-.271.833.833 0 01-.111-.442v-7.9l-.112-.112-3.643.193v.543c.148.015.313.05.495.104.18.055.315.112.405.172a.991.991 0 01.297.315.877.877 0 01.119.458v6.324c0 .182-.032.33-.097.442a.622.622 0 01-.334.256c-.09.035-.197.06-.32.074-.124.015-.25.028-.38.038v.543h4.7v-.543a2.445 2.445 0 01-.699-.194M24 37.575c-7.485 0-13.575-6.09-13.575-13.575 0-7.485 6.09-13.574 13.575-13.574 7.486 0 13.574 6.089 13.574 13.574 0 7.485-6.088 13.575-13.574 13.575m0-28.848C15.58 8.727 8.728 15.58 8.728 24S15.579 39.273 24 39.273c8.42 0 15.272-6.853 15.272-15.273S32.421 8.727 24 8.727m-.274 10.61a1.556 1.556 0 100-3.112 1.556 1.556 0 000 3.112"});return t?o?e.createElement("path",{d:"M25.668 30.487a.68.68 0 01-.32-.271.833.833 0 01-.111-.442v-7.9l-.112-.112-3.643.193v.543c.148.015.313.05.495.104.18.055.315.112.405.172a.991.991 0 01.297.315.877.877 0 01.119.458v6.324c0 .182-.032.33-.097.442a.622.622 0 01-.334.256c-.09.035-.197.06-.32.074-.124.015-.25.028-.38.038v.543h4.7v-.543a2.445 2.445 0 01-.699-.194M24 37.575c-7.485 0-13.575-6.09-13.575-13.575 0-7.485 6.09-13.574 13.575-13.574 7.486 0 13.574 6.089 13.574 13.574 0 7.485-6.088 13.575-13.574 13.575m0-28.848C15.58 8.727 8.728 15.58 8.728 24S15.579 39.273 24 39.273c8.42 0 15.272-6.853 15.272-15.273S32.421 8.727 24 8.727m-.274 8.084a1.556 1.556 0 100-3.112 1.556 1.556 0 000 3.112"}):r:o?i:n},color:o.kiwi900,hoverColor:o.kiwi900}),warn:e.createElement(n,{svgIcon:r,color:"black",hoverColor:"black"}),alert:e.createElement(n,{svgIcon:l,color:o.cherry500,hoverColor:o.cherry500}),alertLabel:e.createElement(n,{svgIcon:r,color:o.cherry500,hoverColor:o.cherry500}),crisis:e.createElement(n,{svgIcon:l,color:o.banana200,hoverColor:o.banana200})},f=e.forwardRef((function(o,n){var r,l,m=o.children,f=o.variant,d=void 0===f?"info":f,v=o.shadow,h=void 0!==v&&v,b=o.dismissable,_=void 0!==b&&b,u=o.onClick,E=o.label,C=o.fluid,w=void 0!==C&&C,g=o.size,j=o.className,y=o.testId;var k;return k=e.createElement("div",{ref:n,"data-testid":y,"data-analyticsid":i.NotificationPanel,className:t(c["notification-panel"],c["notification-panel--"+g],c["notification-panel--"+d],(r={},a(r,c["notification-panel--shadow"],!w&&h),a(r,c["notification-panel--haslabel"],!!E&&!m),a(r,c["notification-panel--dismissable"],_),r),j||"")},e.createElement("span",{className:c["notification-panel__icon"]},p["alert"===d&&E&&!m?"alertLabel":d]),e.createElement("section",{"aria-label":function(){if(m){var a="";return e.Children.map(m,(function(e){"string"==typeof e&&(a+=e)})),a}return""}(),className:t(c["notification-panel__content"],(l={},a(l,c["notification-panel__content--crisis"],"crisis"===d),a(l,c["notification-panel__content--haslabel"],!!E&&!m),a(l,c["notification-panel__content--isred"],"alert"===d&&!!E&&!m),l))},E?e.createElement("h1",{className:c["notification-panel__label"],dangerouslySetInnerHTML:{__html:E}}):null,m),_?e.createElement("span",{className:c["notification-panel__action-column"]},e.createElement(s,{ariaLabel:o.ariaLabelCloseBtn,onClick:u})):null),w?e.createElement("div",{className:t(c["notification-panel__fluidwrapper"],c["notification-panel__fluidwrapper--"+d],a({},c["notification-panel__fluidwrapper--shadow"],h))},k):k}));export default f;export{m as variantToColorMap};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
background-color: $black;
|
|
39
39
|
}
|
|
40
40
|
&--shadow {
|
|
41
|
-
box-shadow: 0 0.3rem getSpacer(
|
|
41
|
+
box-shadow: 0 0.3rem getSpacer(2xs) -0.1rem rgba(0, 0, 0, 0.15);
|
|
42
42
|
}
|
|
43
43
|
&--haslabel {
|
|
44
44
|
padding: getSpacer(l) $spacer;
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
background-color: $black;
|
|
63
63
|
}
|
|
64
64
|
&--shadow {
|
|
65
|
-
box-shadow: 0 0.3rem getSpacer(
|
|
65
|
+
box-shadow: 0 0.3rem getSpacer(2xs) -0.1rem rgba(0, 0, 0, 0.15);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
|
|
73
73
|
&__content {
|
|
74
74
|
grid-area: 'content';
|
|
75
|
-
margin: getSpacer(
|
|
75
|
+
margin: getSpacer(2xs) getSpacer(m);
|
|
76
76
|
|
|
77
77
|
p {
|
|
78
78
|
margin: 0;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{R as o}from"../../RadioButton-
|
|
1
|
+
import{R as o}from"../../RadioButton-fe4bbd36.js";export{R as RadioButton,R as default}from"../../RadioButton-fe4bbd36.js";import"../../_rollupPluginBabelHelpers-b8ef6dd9.js";import"react";import"../../index-9b84fabc.js";import"../../uuid-fe7442b7.js";import"./styles.module.scss";import"../../constants-ad6c82db.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
margin: getSpacer(s) 0;
|
|
16
16
|
|
|
17
17
|
&--with-error {
|
|
18
|
-
padding: getSpacer(s) getSpacer(
|
|
18
|
+
padding: getSpacer(s) getSpacer(2xs) getSpacer(m);
|
|
19
19
|
background-color: $cherry100;
|
|
20
20
|
margin-left: -0.75rem;
|
|
21
21
|
border-left: 0.25rem solid $cherry500;
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
&--bigform {
|
|
33
|
-
margin: getSpacer(
|
|
33
|
+
margin: getSpacer(2xs) 0 getSpacer(2xs) 0;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
min-width: auto !important;
|
|
106
106
|
min-height: auto !important;
|
|
107
107
|
color: $neutral700;
|
|
108
|
-
box-shadow: 0 0 0 getSpacer(
|
|
108
|
+
box-shadow: 0 0 0 getSpacer(4xs);
|
|
109
109
|
|
|
110
110
|
&:checked {
|
|
111
111
|
color: $blueberry500;
|
|
@@ -116,17 +116,17 @@
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
&:focus {
|
|
119
|
-
box-shadow: 0 0 0 getSpacer(
|
|
119
|
+
box-shadow: 0 0 0 getSpacer(3xs);
|
|
120
120
|
color: $black;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
&:hover {
|
|
124
|
-
box-shadow: 0 0 0 getSpacer(
|
|
124
|
+
box-shadow: 0 0 0 getSpacer(3xs);
|
|
125
125
|
background-color: $neutral100;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
:active > & {
|
|
129
|
-
box-shadow: 0 0 0 getSpacer(
|
|
129
|
+
box-shadow: 0 0 0 getSpacer(3xs);
|
|
130
130
|
color: $black;
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
|
|
144
144
|
&:hover {
|
|
145
145
|
background-color: $inverted-hover;
|
|
146
|
-
box-shadow: 0 0 0 getSpacer(
|
|
146
|
+
box-shadow: 0 0 0 getSpacer(3xs);
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
&:checked {
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
:active > & {
|
|
158
|
-
box-shadow: 0 0 0 getSpacer(
|
|
158
|
+
box-shadow: 0 0 0 getSpacer(3xs);
|
|
159
159
|
color: $white;
|
|
160
160
|
}
|
|
161
161
|
|
|
@@ -196,12 +196,12 @@
|
|
|
196
196
|
color: $neutral400;
|
|
197
197
|
|
|
198
198
|
&:hover {
|
|
199
|
-
box-shadow: 0 0 0 getSpacer(
|
|
199
|
+
box-shadow: 0 0 0 getSpacer(4xs);
|
|
200
200
|
background-color: transparent;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
&:hover {
|
|
204
|
-
box-shadow: 0 0 0 getSpacer(
|
|
204
|
+
box-shadow: 0 0 0 getSpacer(4xs);
|
|
205
205
|
background-color: transparent;
|
|
206
206
|
}
|
|
207
207
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-
|
|
1
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-b8ef6dd9.js";import t,{useState as n,useRef as r,useEffect as a}from"react";import{c as o}from"../../index-9b84fabc.js";import{T as i}from"../../Title-af53f589.js";import c from"./styles.module.scss";import{A as u}from"../../constants-ad6c82db.js";import"../Title/styles.module.scss";var s=function(e){return e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),!1},l=function(e){return m(e)?e.touches[0].pageX:e.pageX},d=function(e){var t=e?e.getBoundingClientRect():void 0;return t?t.right-t.left:0},m=function(e){return("touchcancel"===e.type||"touchend"===e.type||"touchenter"===e.type||"touchleave"===e.type||"touchmove"===e.type||"touchstart"===e.type)&&!(0===e.touches.length)},f=function(e,t,n){var r=e-e%t,a=Math.floor(n/t)*t;e>a&&(e>a+(n-a)/2&&(r=n));return Math.round(r)},v=t.forwardRef((function(m,v){var p=m.title,h=m.labelLeft,_=m.labelRight,g=m.disabled,E=void 0!==g&&g,y=m.step,b=void 0===y?1:y,w=m.onChange,k=m.testId,L=n(50),x=e(L,2),N=x[0],A=x[1],D=n(!1),M=e(D,2),R=M[0],j=M[1],T=n(0),B=e(T,2),C=B[0],P=B[1],I=n(0),S=e(I,2),X=S[0],H=S[1],K=n(0),U=e(K,2),q=U[0],z=U[1],F=n(0),G=e(F,2),J=G[0],O=G[1],Q=v||r(null),V=r(null),W=function(e){ne(e)},Y=function(e){te(e)},Z=function(e){ne(e)},$=function(e){te(e)};a((function(){var e=d(Q.current),t=d(V.current);z(function(e,t,n,r,a){return(t-n)/(a-r)*e}(N,e,t,0,100)),P(e),H(t)}),[]),a((function(){R&&(function(e,t){document.addEventListener("mousemove",e,!1),document.addEventListener("mouseup",t,!1)}(W,Y),function(e,t){document.addEventListener("touchmove",e,!1),document.addEventListener("touchend",t,!1)}(Z,$))}),[R]),a((function(){!E&&w&&w(N)}),[N]);var ee=function(e){var t;if(!E){var n=d(Q.current),r=d(V.current),a=l(e);!function(e,t,n,r){var a=t?t.getBoundingClientRect():void 0,o=a?a.left:0;r(o?e-(o+n/2):0)}(a,V.current,r,re),j(!0),O(a),P(n),H(r),null===(t=V.current)||void 0===t||t.focus(),s(e)}},te=function(e){E||(j(!1),function(e,t){document.removeEventListener("mousemove",e,!1),document.removeEventListener("mouseup",t,!1)}(W,Y),function(e,t){document.removeEventListener("touchmove",e,!1),document.removeEventListener("touchend",t,!1)}(Z,$),s(e))},ne=function(e){if(!E&&R){var t=l(e);re(t-J),s(e)}},re=function(e){if(0!==e){var t=function(e,t,n,r){var a=r+e;return a<0&&(a=0),a>t-n&&(a=t-n),a}(e,C,X,q);z(t),O(t+e),A(function(e,t,n,r,a,o){var i=(t-n)/(o-a),c=Math.round(e/i);return f(c,r,o)}(t,C,X,b,0,100))}};return t.createElement("div",{className:c.slider,"data-testid":k,"data-analyticsid":u.Slider},p&&t.createElement(i,{htmlMarkup:"h3",margin:1.5,appearance:"title3"},p),t.createElement("div",{ref:Q,className:o(c["slider__track-wrapper"],E?c["slider__track-wrapper--disabled"]:""),onMouseDown:ee,onTouchStart:ee,"data-testid":"tracker"},t.createElement("div",{className:o(c.slider__track,E?c["slider__track--disabled"]:"")}),t.createElement("div",{ref:V,className:o(c.slider__trigger,E?c["slider__trigger--disabled"]:""),style:{left:"".concat(q,"px")},onKeyDown:function(e){if(!E){var t=(C-X)/100;"ArrowRight"!==e.key&&"ArrowDown"!==e.key||re(b*t),"ArrowLeft"!==e.key&&"ArrowUp"!==e.key||re(-b*t)}},role:"slider","aria-valuenow":N,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"".concat(p?p+" ":"").concat(h?h+" ":"").concat(_?_+" ":""),tabIndex:E?-1:0},t.createElement("div",{className:o(c["slider__trigger-inner"],E?c["slider__trigger-inner--disabled"]:"")}))),(h||_)&&t.createElement("span",{className:c.slider__options},t.createElement("p",{className:c.slider__text,"aria-hidden":!0},h),t.createElement("p",{className:c.slider__text,"aria-hidden":!0},_)))}));export default v;export{v as Slider};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spacer.d.ts","sourceRoot":"","sources":["../../../src/components/Spacer/Spacer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKpD,UAAU,WAAW;IACnB,mCAAmC;IACnC,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,QAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"Spacer.d.ts","sourceRoot":"","sources":["../../../src/components/Spacer/Spacer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKpD,UAAU,WAAW;IACnB,mCAAmC;IACnC,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,QAAA,MAAM,MAAM,iFAuBV,CAAC;AAEH,eAAe,MAAM,CAAC"}
|