@helsenorge/designsystem-react 1.0.0-beta86 → 1.0.0-beta90
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/AlertSignFill-e607ff43.js +2 -0
- package/AlertSignFill-e607ff43.js.map +1 -0
- package/{Button-3f327b66.js → Button-48132cc3.js} +2 -2
- package/Button-48132cc3.js.map +1 -0
- package/Close-591125bb.js +2 -0
- package/Close-591125bb.js.map +1 -0
- package/{FormGroup-b874ae21.js → FormGroup-56d60079.js} +2 -2
- package/FormGroup-56d60079.js.map +1 -0
- package/Loader-6ff0d481.js +2 -0
- package/Loader-6ff0d481.js.map +1 -0
- package/Modal-145869ba.js +2 -0
- package/Modal-145869ba.js.map +1 -0
- package/Title-72851d51.js +2 -0
- package/Title-72851d51.js.map +1 -0
- package/{Validation-b902407e.js → Validation-372a97b9.js} +2 -2
- package/Validation-372a97b9.js.map +1 -0
- package/components/AnchorLink/AnchorLink.d.ts +2 -0
- package/components/AnchorLink/AnchorLink.d.ts.map +1 -1
- package/components/AnchorLink/componentdata.json +19 -0
- package/components/AnchorLink/index.js +1 -1
- package/components/Avatar/Avatar.d.ts +2 -0
- package/components/Avatar/Avatar.d.ts.map +1 -1
- package/components/Avatar/componentdata.json +19 -0
- package/components/Avatar/index.js +1 -1
- package/components/Badge/Badge.d.ts +2 -0
- package/components/Badge/Badge.d.ts.map +1 -1
- package/components/Badge/componentdata.json +19 -0
- package/components/Badge/index.js +1 -1
- package/components/Button/Button.d.ts.map +1 -1
- package/components/Button/index.js +1 -1
- package/components/ButtonWithModal/ButtonWithModal.d.ts +2 -0
- package/components/ButtonWithModal/ButtonWithModal.d.ts.map +1 -1
- package/components/ButtonWithModal/componentdata.json +50 -9
- package/components/ButtonWithModal/index.js +1 -1
- package/components/Close/Close.d.ts +12 -0
- package/components/Close/Close.d.ts.map +1 -0
- package/components/Close/componentdata.json +61 -0
- package/components/Close/index.d.ts +3 -0
- package/components/Close/index.d.ts.map +1 -0
- package/components/Close/index.js +2 -0
- package/components/Close/index.js.map +1 -0
- package/components/Close/styles.module.scss +32 -0
- package/components/Close/styles.module.scss.d.ts +9 -0
- package/components/ExpanderList/ExpanderList.d.ts +2 -0
- package/components/ExpanderList/ExpanderList.d.ts.map +1 -1
- package/components/ExpanderList/componentdata.json +19 -0
- package/components/ExpanderList/index.js +1 -1
- package/components/FormExample/index.js +1 -1
- package/components/FormGroup/index.js +1 -1
- package/components/LinkList/LinkList.d.ts +6 -0
- package/components/LinkList/LinkList.d.ts.map +1 -1
- package/components/LinkList/componentdata.json +19 -0
- package/components/LinkList/index.js +1 -1
- package/components/List/List.d.ts +2 -0
- package/components/List/List.d.ts.map +1 -1
- package/components/List/componentdata.json +19 -0
- package/components/List/index.js +1 -1
- package/components/Loader/index.js +1 -1
- package/components/Logo/Logo.d.ts +2 -0
- package/components/Logo/Logo.d.ts.map +1 -1
- package/components/Logo/componentdata.json +19 -0
- package/components/Logo/index.js +1 -1
- package/components/Modal/Modal.d.ts +5 -0
- package/components/Modal/Modal.d.ts.map +1 -1
- package/components/Modal/componentdata.json +42 -1
- package/components/Modal/index.js +1 -1
- package/components/Modal/styles.module.scss +14 -23
- package/components/Modal/styles.module.scss.d.ts +3 -1
- package/components/NotificationPanel/NotificationPanel.d.ts +2 -0
- package/components/NotificationPanel/NotificationPanel.d.ts.map +1 -1
- package/components/NotificationPanel/componentdata.json +19 -0
- package/components/NotificationPanel/index.js +1 -1
- package/components/NotificationPanel/styles.module.scss +0 -51
- package/components/NotificationPanel/styles.module.scss.d.ts +0 -2
- package/components/Slider/Slider.d.ts +2 -0
- package/components/Slider/Slider.d.ts.map +1 -1
- package/components/Slider/componentdata.json +19 -0
- package/components/Slider/index.js +1 -1
- package/components/Spacer/Spacer.d.ts +2 -0
- package/components/Spacer/Spacer.d.ts.map +1 -1
- package/components/Spacer/componentdata.json +19 -0
- package/components/Spacer/index.js +1 -1
- package/components/Tile/Tile.d.ts +2 -0
- package/components/Tile/Tile.d.ts.map +1 -1
- package/components/Tile/componentdata.json +19 -0
- package/components/Tile/index.js +1 -1
- package/components/Title/Title.d.ts +2 -0
- package/components/Title/Title.d.ts.map +1 -1
- package/components/Title/index.js +1 -1
- package/components/Validation/index.js +1 -1
- package/hooks/useFocusTrap.d.ts.map +1 -1
- package/package.json +1 -1
- package/AlertSignFill-64bfef57.js +0 -2
- package/AlertSignFill-64bfef57.js.map +0 -1
- package/Button-3f327b66.js.map +0 -1
- package/FormGroup-b874ae21.js.map +0 -1
- package/Loader-cf365332.js +0 -2
- package/Loader-cf365332.js.map +0 -1
- package/Modal-3dc1bb47.js +0 -2
- package/Modal-3dc1bb47.js.map +0 -1
- package/Title-7c829525.js +0 -2
- package/Title-7c829525.js.map +0 -1
- package/Validation-b902407e.js.map +0 -1
|
@@ -200,6 +200,25 @@
|
|
|
200
200
|
"type": {
|
|
201
201
|
"name": "boolean"
|
|
202
202
|
}
|
|
203
|
+
},
|
|
204
|
+
"testId": {
|
|
205
|
+
"defaultValue": null,
|
|
206
|
+
"description": "Sets the data-testid attribute.",
|
|
207
|
+
"name": "testId",
|
|
208
|
+
"parent": {
|
|
209
|
+
"fileName": "src/components/ExpanderList/ExpanderList.tsx",
|
|
210
|
+
"name": "ExpanderListProps"
|
|
211
|
+
},
|
|
212
|
+
"declarations": [
|
|
213
|
+
{
|
|
214
|
+
"fileName": "src/components/ExpanderList/ExpanderList.tsx",
|
|
215
|
+
"name": "ExpanderListProps"
|
|
216
|
+
}
|
|
217
|
+
],
|
|
218
|
+
"required": false,
|
|
219
|
+
"type": {
|
|
220
|
+
"name": "string"
|
|
221
|
+
}
|
|
203
222
|
}
|
|
204
223
|
}
|
|
205
224
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,a as t}from"../../_rollupPluginBabelHelpers-d0752906.js";import n,{useState as a,useEffect as r}from"react";import{a as i,I as l}from"../../constants-d919236e.js";import{u as
|
|
1
|
+
import{_ as e,a as t}from"../../_rollupPluginBabelHelpers-d0752906.js";import n,{useState as a,useEffect as r}from"react";import{a as i,I as l}from"../../constants-d919236e.js";import{u as d}from"../../useHover-037be19d.js";import{u as o,B as s}from"../../useBreakpoint-324a9b14.js";import{c}from"../../index-9b84fabc.js";import m from"./styles.module.scss";import"../../_tslib-51c8a283.js";import"../../useWindowSize-73b47451.js";import"../../grid-11a70eb7.js";var p=function(e){var t=e.isExtraSmall,a=e.isHovered,r=n.createElement("path",{d:"M15.049 30.277l-1.419-1.409 10.371-10.451L34.37 28.868l-1.419 1.409L24 21.257z"}),i=n.createElement("path",{d:"M24.001 10.14L36.37 22.591 34.951 24 25 13.985V35h-2V13.985L13.049 24l-1.419-1.409z"}),l=n.createElement("path",{d:"M32.577 30.115l1.793-1.779-10.371-10.451L13.63 28.336l1.793 1.779 8.576-8.644z"});return t?a?n.createElement("path",{d:"M23.999 9.043L36.897 22.02l-1.794 1.78-9.841-9.9.001 20.205h-2.526L22.736 13.9l-9.839 9.9-1.794-1.78z"}):l:a?i:r},u=function(e){var t=e.isExtraSmall,a=e.isHovered,r=n.createElement("path",{d:"M32.951 18.788l1.419 1.409-10.371 10.451L13.63 20.197l1.419-1.409L24 27.809z"}),i=n.createElement("path",{d:"M25 13v20.083l9.951-10.013 1.419 1.409L23.999 36.93 11.63 24.479l1.419-1.409L23 33.085V13z"}),l=n.createElement("path",{d:"M32.577 17.885l1.793 1.779-10.371 10.451L13.63 19.664l1.793-1.779 8.576 8.644z"});return t?a?n.createElement("path",{d:"M25 13v20.083l9.951-10.013 1.419 1.409L23.999 36.93 11.63 24.479l1.419-1.409L23 33.085V13z"}):l:a?i:r},f=n.forwardRef((function(e,a){var r,f=e.id,v=e.children,x=e.padding,E=void 0===x||x,h=e.color,g=void 0===h?"neutral":h,_=e.className,b=void 0===_?"":_,L=e.icon,k=e.large,j=void 0!==k&&k,z=e.title,N=e.isExpanded,H=void 0!==N&&N,w=e.testId,M=e.handleExpanderClick,B=d(),C=B.hoverRef,S=B.isHovered,I=o(),O=c(m["expander-list-link"],m["expander-list-link--".concat(g)],(t(r={},m["expander-list-link--closed"],!H),t(r,m["expander-list-link--large"],j),r)),V=c(m["expander-list-link__main-content"],E?m["expander-list-link__main-content--padding"]:"");return n.createElement("li",{className:b,ref:a},n.createElement("button",{id:f,onClick:M,"data-testid":w,className:O,ref:C},L&&n.createElement("span",{className:m["expander-list-link__icon"]},n.cloneElement(L,{size:I===s.Xs?i.XSmall:i.Small,isHovered:S})),n.createElement("span",{className:m["expander-list-link__title"]},z),n.createElement("span",{className:m["expander-list-link__chevron"]},n.createElement(l,{size:i.XSmall,svgIcon:H?p:u,isHovered:S}))),H?n.createElement("div",{className:V},v):null)})),v=n.forwardRef((function(i,l){var d=i.children,o=i.childPadding,s=void 0===o||o,p=i.large,u=i.isOpen,v=void 0!==u&&u,x=i.color,E=i.className,h=void 0===E?"":E,g=i.accordion,_=void 0!==g&&g,b=i.topBorder,L=void 0===b||b,k=i.bottomBorder,j=void 0===k||k,z=i.testId,N=a({}),H=e(N,2),w=H[0],M=H[1],B=a(),C=e(B,2),S=C[0],I=C[1],O=n.Children.count(d),V=c(m["expander-list"],h);return r((function(){var e,t,n,a,r;!_||!S||(e=S.getBoundingClientRect(),t=e.top,n=e.left,a=e.bottom,r=e.right,t>=0&&n>=0&&a<=(window.innerHeight||document.documentElement.clientHeight)&&r<=(window.innerWidth||document.documentElement.clientWidth))||S.scrollIntoView()}),[_,S]),r((function(){if(v){var e="expander-0";M((function(n){return _?t({},e,!n[e]):Object.assign(Object.assign({},n),t({},e,!n[e]))}))}}),[v]),n.createElement("ul",{className:V,ref:l,"data-testid":z},n.Children.map(d,(function(e,a){if(e.type===f){var r=w["expander-".concat(a)],i=function(e){var n;return c(m["expander-list__item"],(t(n={},m["expander-list__item--top"],0===e&&L),t(n,m["expander-list__item--no-bottom"],e===O-1&&!j),n))}(a);return n.cloneElement(e,{id:"expander-".concat(a),key:"expander-".concat(a),isExpanded:r,padding:s,color:x,large:p,"aria-expanded":r,className:i,handleExpanderClick:function(e){return function(e,n){M((function(e){return _?t({},n,!e[n]):Object.assign(Object.assign({},e),t({},n,!e[n]))})),I(e.currentTarget)}(e,"expander-".concat(a))}})}return e})))}));v.Expander=f,f.displayName="ExpanderList.Expander";export default v;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import r,{createContext as e,useCallback as t,useRef as n,useState as i,useEffect as u,useMemo as a,isValidElement as s}from"react";import{V as c}from"../../Validation-b902407e.js";import{F as o}from"../../FormGroup-b874ae21.js";import{C as f}from"../../Checkbox-46666e69.js";import{B as l}from"../../Button-3f327b66.js";import"../../index-9b84fabc.js";import"../Validation/styles.module.scss";import"../../_rollupPluginBabelHelpers-d0752906.js";import"../FormGroup/styles.module.scss";import"../../Title-7c829525.js";import"../Title/styles.module.scss";import"../../uuid-8870ab4b.js";import"../../Check-6291ad09.js";import"../../constants-d919236e.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-cf365332.js";import"../Loader/styles.module.scss";import"../../useHover-037be19d.js";import"../../useWindowSize-73b47451.js";import"../Button/styles.module.scss";var d=function(r){return r instanceof HTMLElement},v="blur",m="change",g="input",p="onBlur",y="onChange",b="onSubmit",h="onTouched",O="all",j="max",V="min",A="maxLength",w="minLength",E="pattern",S="required",F="validate";var k=function(r){return null==r},D=function(r){return"object"==typeof r},x=function(r){return!k(r)&&!Array.isArray(r)&&D(r)&&!(r instanceof Date)},C=function(r){return/^\w*$/.test(r)},R=function(r){return r.filter(Boolean)},N=function(r){return R(r.replace(/["|']/g,"").replace(/\[/g,".").replace(/\]/g,"").split("."))};function B(r,e,t){for(var n=-1,i=C(e)?[e]:N(e),u=i.length,a=u-1;++n<u;){var s=i[n],c=t;if(n!==a){var o=r[s];c=x(o)||Array.isArray(o)?o:isNaN(+i[n+1])?{}:[]}r[s]=c,r=r[s]}return r}var L=function(r,e){for(var t in void 0===e&&(e={}),r)C(t)?e[t]=r[t]:B(e,t,r[t]);return e},T=function(r){return void 0===r},M=function(r,e,t){void 0===r&&(r={});var n=R(e.split(/[,[\].]+?/)).reduce((function(r,e){return k(r)?r:r[e]}),r);return T(n)||n===r?T(r[e])?t:r[e]:n},W=function(r,e){d(r)&&r.removeEventListener&&(r.removeEventListener(g,e),r.removeEventListener(m,e),r.removeEventListener(v,e))},_={isValid:!1,value:null},q=function(r){return Array.isArray(r)?r.reduce((function(r,e){return e&&e.ref.checked?{isValid:!0,value:e.ref.value}:r}),_):_},H=function(r){return"radio"===r.type},P=function(r){return"file"===r.type},z=function(r){return"checkbox"===r.type},U=function(r){return"select-multiple"===r.type},$={value:!1,isValid:!1},G={value:!0,isValid:!0},I=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,u=t.attributes;return n?u&&!T(u.value)?T(i)||""===i?G:{value:i,isValid:!0}:G:$}return $};function J(r,e,t,n,i){var u,a=r.current[e];if(a){var s=a.ref,c=s.value,o=s.disabled,f=a.ref,l=a.valueAsNumber,d=a.valueAsDate,v=a.setValueAs;if(o&&n)return;return P(f)?f.files:H(f)?q(a.options).value:U(f)?(u=f.options,[].concat(u).filter((function(r){return r.selected})).map((function(r){return r.value}))):z(f)?I(a.options).value:i?c:l?""===c?NaN:+c:d?f.valueAsDate:v?v(c):c}if(t)return M(t.current,e)}function K(r){return!r||r instanceof HTMLElement&&r.nodeType!==Node.DOCUMENT_NODE&&K(r.parentNode)}var Q=function(r){return x(r)&&!Object.keys(r).length},X=function(r){return"boolean"==typeof r};function Y(r,e){var t,n=C(e)?[e]:N(e),i=1==n.length?r:function(r,e){for(var t=e.slice(0,-1).length,n=0;n<t;)r=T(r)?n++:r[e[n++]];return r}(r,n),u=n[n.length-1];i&&delete i[u];for(var a=0;a<n.slice(0,-1).length;a++){var s=-1,c=void 0,o=n.slice(0,-(a+1)),f=o.length-1;for(a>0&&(t=r);++s<o.length;){var l=o[s];c=c?c[l]:r[l],f===s&&(x(c)&&Q(c)||Array.isArray(c)&&!c.filter((function(r){return x(r)&&!Q(r)||X(r)})).length)&&(t?delete t[l]:delete r[l]),t=c}}return r}var Z=function(r,e){return r&&r.ref===e};var rr=function(r){return k(r)||!D(r)};function er(r,e){if(rr(r)||rr(e))return e;for(var t in e){var n=r[t],i=e[t];try{r[t]=x(n)&&x(i)||Array.isArray(n)&&Array.isArray(i)?er(n,i):i}catch(r){}}return r}function tr(r,e,t){if(rr(r)||rr(e)||r instanceof Date||e instanceof Date)return r===e;if(!s(r)){var n=Object.keys(r),i=Object.keys(e);if(n.length!==i.length)return!1;for(var u=0,a=n;u<a.length;u+=1){var c=a[u],o=r[c];if(!t||"ref"!==c){var f=e[c];if((x(o)||Array.isArray(o))&&(x(f)||Array.isArray(f))?!tr(o,f,t):o!==f)return!1}}}return!0}function nr(r,e,t,n,i){for(var u,a=-1;++a<r.length;){for(var s in r[a])Array.isArray(r[a][s])?(!t[a]&&(t[a]={}),t[a][s]=[],nr(r[a][s],M(e[a]||{},s,[]),t[a][s],t[a],s)):tr(M(e[a]||{},s),r[a][s])?B(t[a]||{},s):t[a]=Object.assign(Object.assign({},t[a]),((u={})[s]=!0,u));n&&!t.length&&delete n[i]}return t}var ir=function(r){return"string"==typeof r},ur=function(r,e,t,n,i){var u={},a=function(e){(T(i)||(ir(i)?e.startsWith(i):Array.isArray(i)&&i.find((function(r){return e.startsWith(r)}))))&&(u[e]=J(r,e,void 0,n))};for(var s in r.current)a(s);return t?L(u):er(e,L(u))},ar=function(r){return r instanceof RegExp},sr=function(r){return x(r)&&!ar(r)?r:{value:r,message:""}},cr=function(r){return"function"==typeof r},or=function(r){return ir(r)||s(r)};function fr(r,e,t){if(void 0===t&&(t="validate"),or(r)||X(r)&&!r)return{type:t,message:or(r)?r:"",ref:e}}var lr=function(r,e,t,n,i){var u;return e?Object.assign(Object.assign({},t[r]),{types:Object.assign(Object.assign({},t[r]&&t[r].types?t[r].types:{}),(u={},u[n]=i||!0,u))}):{}},dr=async function(r,e,t,n){var i=t.ref,u=t.ref.value,a=t.options,s=t.required,c=t.maxLength,o=t.minLength,f=t.min,l=t.max,d=t.pattern,v=t.validate,m=i.name,g={},p=H(i),y=z(i),b=p||y,h=""===u,O=lr.bind(null,m,e,g),D=function(r,e,t,n,u){void 0===n&&(n=A),void 0===u&&(u=w);var a=r?e:t;g[m]=Object.assign({type:r?n:u,message:a,ref:i},O(r?n:u,a))};if(s&&(!p&&!y&&(h||k(u))||X(u)&&!u||y&&!I(a).isValid||p&&!q(a).isValid)){var C=or(s)?{value:!!s,message:s}:sr(s),R=C.value,N=C.message;if(R&&(g[m]=Object.assign({type:S,message:N,ref:b?((r.current[m].options||[])[0]||{}).ref:i},O(S,N)),!e))return g}if(!(k(f)&&k(l)||""===u)){var B,L,T=sr(l),M=sr(f);if(isNaN(u)){var W=i.valueAsDate||new Date(u);ir(T.value)&&(B=W>new Date(T.value)),ir(M.value)&&(L=W<new Date(M.value))}else{var _=i.valueAsNumber||parseFloat(u);k(T.value)||(B=_>T.value),k(M.value)||(L=_<M.value)}if((B||L)&&(D(!!B,T.message,M.message,j,V),!e))return g}if(ir(u)&&!h&&(c||o)){var P=sr(c),U=sr(o),$=!k(P.value)&&u.length>P.value,G=!k(U.value)&&u.length<U.value;if(($||G)&&(D($,P.message,U.message),!e))return g}if(ir(u)&&d&&!h){var K=sr(d),Y=K.value,Z=K.message;if(ar(Y)&&!Y.test(u)&&(g[m]=Object.assign({type:E,message:Z,ref:i},O(E,Z)),!e))return g}if(v){var rr=J(r,m,n,!1,!0),er=b&&a?a[0].ref:i;if(cr(v)){var tr=fr(await v(rr),er);if(tr&&(g[m]=Object.assign(Object.assign({},tr),O(F,tr.message)),!e))return g}else if(x(v)){for(var nr={},ur=0,dr=Object.entries(v);ur<dr.length;ur+=1){var vr=dr[ur],mr=vr[0],gr=vr[1];if(!Q(nr)&&!e)break;var pr=fr(await gr(rr),er,mr);pr&&(nr=Object.assign(Object.assign({},pr),O(mr,pr.message)),e&&(g[m]=nr))}if(!Q(nr)&&(g[m]=Object.assign({ref:er},nr),!e))return g}}return g},vr=function(r,e,t){for(var n in void 0===t&&(t=[]),e){var i=r+(x(e)?"."+n:"["+n+"]");rr(e[n])?t.push(i):vr(i,e[n],t)}return t},mr=function(r,e,t,n,i){var u=void 0;return t.add(e),Q(r)||(u=M(r,e),(x(u)||Array.isArray(u))&&vr(e,u).forEach((function(r){return t.add(r)}))),T(u)?i?n:M(n,e):u},gr=function(r){return r.substring(0,r.indexOf("["))},pr=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 yr="undefined"!=typeof window&&"undefined"!=typeof document;function br(r){var e,t;if(rr(r)||yr&&(r instanceof File||d(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 u=i[n];t.add(u)}return t}if(r instanceof Map){t=new Map;for(var a=0,s=r.keys();a<s.length;a+=1){var c=s[a];t.set(c,br(r.get(c)))}return t}for(var o in t=Array.isArray(r)?[]:{},r)t[o]=br(r[o]);return t}var hr,Or=function(r){return{isOnSubmit:!r||r===b,isOnBlur:r===p,isOnChange:r===y,isOnAll:r===O,isOnTouch:r===h}},jr=function(r){return H(r)||z(r)},Vr="undefined"==typeof window,Ar=yr?"Proxy"in window:"undefined"!=typeof Proxy;function wr(r){void 0===r&&(r={});var e=r.mode;void 0===e&&(e=b);var s=r.reValidateMode;void 0===s&&(s=y);var c=r.resolver,o=r.context,f=r.defaultValues;void 0===f&&(f={});var l=r.shouldFocusError;void 0===l&&(l=!0);var p=r.shouldUnregister;void 0===p&&(p=!0);var h=r.criteriaMode,j=n({}),V=n({}),A=n({}),w=n(new Set),E=n({}),S=n({}),F=n({}),D=n({}),N=n(f),_=n(!1),q=n(!1),$=n(),G=n({}),I=n({}),X=n(o),ar=n(c),sr=n(new Set),or=n(Or(e)),fr=or.current,lr=fr.isOnSubmit,hr=fr.isOnTouch,wr=h===O,Er=i({isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touched:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!lr,errors:{}}),Sr=Er[0],Fr=Er[1],kr=n({isDirty:!Ar,dirtyFields:!Ar,touched:!Ar||hr,isValidating:!Ar,isSubmitting:!Ar,isValid:!Ar}),Dr=n(Sr),xr=n(),Cr=n(Or(s)).current,Rr=Cr.isOnBlur,Nr=Cr.isOnChange;X.current=o,ar.current=c,Dr.current=Sr,G.current=p?{}:Q(G.current)?br(f):G.current;var Br=t((function(r){void 0===r&&(r={}),_.current||(Dr.current=Object.assign(Object.assign({},Dr.current),r),Fr(Dr.current))}),[]),Lr=function(){return kr.current.isValidating&&Br({isValidating:!0})},Tr=t((function(r,e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n={});var u=t||function(r){var e=r.errors,t=r.name,n=r.error,i=r.validFields,u=r.fieldsWithValidation,a=T(n),s=M(e,t);return a&&!!s||!a&&!tr(s,n,!0)||a&&M(u,t)&&!M(i,t)}({errors:Dr.current.errors,error:e,name:r,validFields:D.current,fieldsWithValidation:F.current}),a=M(Dr.current.errors,r);e?(Y(D.current,r),u=u||!a||!tr(a,e,!0),B(Dr.current.errors,r,e)):((M(F.current,r)||ar.current)&&(B(D.current,r,!0),u=u||a),Y(Dr.current.errors,r)),(u&&!k(t)||!Q(n)||kr.current.isValidating)&&Br(Object.assign(Object.assign(Object.assign({},n),ar.current?{isValid:!!i}:{}),{isValidating:!1}))}),[]),Mr=t((function(r,e){var t=j.current[r],n=t.ref,i=t.options,u=yr&&d(n)&&k(e)?"":e;H(n)?(i||[]).forEach((function(r){var e=r.ref;return e.checked=e.value===u})):P(n)&&!ir(u)?n.files=u:U(n)?[].concat(n.options).forEach((function(r){return r.selected=u.includes(r.value)})):z(n)&&i?i.length>1?i.forEach((function(r){var e=r.ref;return e.checked=Array.isArray(u)?!!u.find((function(r){return r===e.value})):u===e.value})):i[0].ref.checked=!!u:n.value=u}),[]),Wr=t((function(r,e){if(kr.current.isDirty){var t=Jr();return r&&e&&B(t,r,e),!tr(t,N.current)}return!1}),[]),_r=t((function(r,e){if(void 0===e&&(e=!0),kr.current.isDirty||kr.current.dirtyFields){var t=!tr(M(N.current,r),J(j,r,G)),n=M(Dr.current.dirtyFields,r),i=Dr.current.isDirty;t?B(Dr.current.dirtyFields,r,!0):Y(Dr.current.dirtyFields,r);var u={isDirty:Wr(),dirtyFields:Dr.current.dirtyFields},a=kr.current.isDirty&&i!==u.isDirty||kr.current.dirtyFields&&n!==M(Dr.current.dirtyFields,r);return a&&e&&Br(u),a?u:{}}return{}}),[]),qr=t((async function(r,e){if("production"!==process.env.NODE_ENV&&!j.current[r])return console.warn("📋 Field is missing with `name` attribute: ",r),!1;var t=(await dr(j,wr,j.current[r],G))[r];return Tr(r,t,e),T(t)}),[Tr,wr]),Hr=t((async function(r){var e=(await ar.current(Jr(),X.current,wr)).errors,t=Dr.current.isValid;if(Array.isArray(r)){var n=r.map((function(r){var t=M(e,r);return t?B(Dr.current.errors,r,t):Y(Dr.current.errors,r),!t})).every(Boolean);return Br({isValid:Q(e),isValidating:!1}),n}var i=M(e,r);return Tr(r,i,t!==Q(e),{},Q(e)),!i}),[Tr,wr]),Pr=t((async function(r){var e=r||Object.keys(j.current);if(Lr(),ar.current)return Hr(e);if(Array.isArray(e)){!r&&(Dr.current.errors={});var t=await Promise.all(e.map((async function(r){return await qr(r,null)})));return Br({isValidating:!1}),t.every(Boolean)}return await qr(e)}),[Hr,qr]),zr=t((function(r,e,t){var n=t.shouldDirty,i=t.shouldValidate,u={};B(u,r,e);for(var a=0,s=vr(r,e);a<s.length;a+=1){var c=s[a];j.current[c]&&(Mr(c,M(u,c)),n&&_r(c),i&&Pr(c))}}),[Pr,Mr,_r]),Ur=t((function(r,e,t){var n,i;if(!p&&!rr(e)&&B(G.current,r,Array.isArray(e)?[].concat(e):Object.assign({},e)),j.current[r])Mr(r,e),t.shouldDirty&&_r(r),t.shouldValidate&&Pr(r);else if(!rr(e)&&(zr(r,e,t),sr.current.has(r))){var u=gr(r)||r;B(V.current,r,e),I.current[u](((n={})[u]=M(V.current,u),n)),(kr.current.isDirty||kr.current.dirtyFields)&&t.shouldDirty&&(B(Dr.current.dirtyFields,r,function(r,e,t){return er(nr(r,e,t.slice(0,r.length)),nr(e,r,t.slice(0,r.length)))}(e,M(N.current,r,[]),M(Dr.current.dirtyFields,r,[]))),Br({isDirty:!tr(Object.assign(Object.assign({},Jr()),(i={},i[r]=e,i)),N.current)}))}!p&&B(G.current,r,e)}),[_r,Mr,zr]),$r=function(r){return q.current||w.current.has(r)||w.current.has((r.match(/\w+/)||[])[0])},Gr=function(r){var e=!0;if(!Q(E.current))for(var t in E.current)r&&E.current[t].size&&!E.current[t].has(r)&&!E.current[t].has(gr(r))||(S.current[t](),e=!1);return e};function Ir(r){var e;if(!p){for(var t=br(r),n=0,i=sr.current;n<i.length;n+=1){var u=i[n];C(u)&&!t[u]&&(t=Object.assign(Object.assign({},t),((e={})[u]=[],e)))}return t}return r}function Jr(r){if(ir(r))return J(j,r,G);if(Array.isArray(r)){for(var e={},t=0,n=r;t<n.length;t+=1){var i=n[t];B(e,i,J(j,i,G))}return e}return Ir(ur(j,br(G.current),p))}$.current=$.current?$.current:async function(r){var e,t,n=r.type,i=r.target,u=i.name,a=j.current[u];if(a){var s=n===v,c=function(r){var e=r.isOnBlur,t=r.isOnChange,n=r.isOnTouch,i=r.isTouched,u=r.isReValidateOnBlur,a=r.isReValidateOnChange,s=r.isBlurEvent,c=r.isSubmitted;return!r.isOnAll&&(!c&&n?!(i||s):(c?u:e)?!s:!(c?a:t)||s)}(Object.assign({isBlurEvent:s,isReValidateOnChange:Nr,isReValidateOnBlur:Rr,isTouched:!!M(Dr.current.touched,u),isSubmitted:Dr.current.isSubmitted},or.current)),o=_r(u,!1),f=!Q(o)||!s&&$r(u);if(s&&!M(Dr.current.touched,u)&&kr.current.touched&&(B(Dr.current.touched,u,!0),o=Object.assign(Object.assign({},o),{touched:Dr.current.touched})),!p&&z(i)&&B(G.current,u,J(j,u)),c)return!s&&Gr(u),(!Q(o)||f&&Q(o))&&Br(o);if(Lr(),ar.current){var l=(await ar.current(Jr(),X.current,wr)).errors,d=Dr.current.isValid;if(e=M(l,u),z(i)&&!e&&ar.current){var m=gr(u),g=M(l,m,{});g.type&&g.message&&(e=g),m&&(g||M(Dr.current.errors,m))&&(u=m)}d!==(t=Q(l))&&(f=!0)}else e=(await dr(j,wr,a,G))[u];!s&&Gr(u),Tr(u,e,f,o,t)}};var Kr=t((async function(r){void 0===r&&(r={});var e=Q(j.current)?N.current:{},t=(await ar.current(Object.assign(Object.assign(Object.assign({},e),Jr()),r),X.current,wr)||{}).errors,n=Q(t);Dr.current.isValid!==n&&Br({isValid:n})}),[wr]),Qr=t((function(r,e){!function(r,e,t,n,i,u){var a=t.ref,s=t.ref.name,c=r.current[s];if(!i){var o=J(r,s,n);!T(o)&&B(n.current,s,o)}a.type&&c?H(a)||z(a)?Array.isArray(c.options)&&c.options.length?(R(c.options).forEach((function(r,t){void 0===r&&(r={}),(K(r.ref)&&Z(r,r.ref)||u)&&(W(r.ref,e),Y(c.options,"["+t+"]"))})),c.options&&!R(c.options).length&&delete r.current[s]):delete r.current[s]:(K(a)&&Z(c,a)||u)&&(W(a,e),delete r.current[s]):delete r.current[s]}(j,$.current,r,G,p,e),p&&(Y(D.current,r.ref.name),Y(F.current,r.ref.name))}),[p]),Xr=t((function(r){if(q.current)Br();else{for(var e=0,t=w.current;e<t.length;e+=1){if(t[e].startsWith(r)){Br();break}}Gr(r)}}),[]),Yr=t((function(r,e){r&&(Qr(r,e),p&&!R(r.options||[]).length&&(Y(Dr.current.errors,r.ref.name),B(Dr.current.dirtyFields,r.ref.name,!0),Br({isDirty:Wr()}),kr.current.isValid&&ar.current&&Kr(),Xr(r.ref.name)))}),[Kr,Qr]);var Zr=t((function(r,e,t){var n=t?E.current[t]:w.current,i=ur(j,br(G.current),p,!1,r);if(ir(r)){var u=gr(r)||r;return sr.current.has(u)&&(i=Object.assign(Object.assign({},A.current),i)),mr(i,r,n,T(M(N.current,r))?e:M(N.current,r),!0)}var a=T(e)?N.current:e;return Array.isArray(r)?r.reduce((function(r,e){var t;return Object.assign(Object.assign({},r),((t={})[e]=mr(i,e,n,a),t))}),{}):(q.current=T(t),L(!Q(i)&&i||a))}),[]);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(sr.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,u=r.value,a=Object.assign({ref:r},e),s=j.current,c=jr(r),o=pr(sr.current,n),f=function(e){return yr&&(!d(r)||e===r)},l=s[n],y=!0;if(l&&(c?Array.isArray(l.options)&&R(l.options).find((function(r){return u===r.ref.value&&f(r.ref)})):f(l.ref)))s[n]=Object.assign(Object.assign({},l),e);else{l=i?c?Object.assign({options:R(l&&l.options||[]).concat([{ref:r}]),ref:{type:i,name:n}},e):Object.assign({},a):a,s[n]=l;var b=T(M(G.current,n));Q(N.current)&&b||(t=M(b?N.current:G.current,n),(y=T(t))||o||Mr(n,t)),Q(e)||(B(F.current,n,!0),!lr&&kr.current.isValid&&dr(j,wr,l,G).then((function(r){var e=Dr.current.isValid;Q(r)?B(D.current,n,!0):Y(D.current,n),e!==Q(r)&&Br()}))),!p||o&&y||!o&&Y(Dr.current.dirtyFields,n),i&&function(r,e,t){var n=r.ref;d(n)&&t&&(n.addEventListener(e?m:g,t),n.addEventListener(v,t))}(c&&l.options?l.options[l.options.length-1]:l,c||"select-one"===r.type,$.current)}}var ee=t((function(r,e){return async function(t){t&&t.preventDefault&&(t.preventDefault(),t.persist());var n={},i=Ir(ur(j,br(G.current),p,!0));kr.current.isSubmitting&&Br({isSubmitting:!0});try{if(ar.current){var u=await ar.current(i,X.current,wr),a=u.errors,s=u.values;Dr.current.errors=n=a,i=s}else for(var c=0,o=Object.values(j.current);c<o.length;c+=1){var f=o[c];if(f){var d=f.ref.name,v=await dr(j,wr,f,G);v[d]?(B(n,d,v[d]),Y(D.current,d)):M(F.current,d)&&(Y(Dr.current.errors,d),B(D.current,d,!0))}}Q(n)&&Object.keys(Dr.current.errors).every((function(r){return r in j.current}))?(Br({errors:{},isSubmitting:!0}),await r(i,t)):(Dr.current.errors=Object.assign(Object.assign({},Dr.current.errors),n),e&&await e(Dr.current.errors,t),l&&function(r,e){for(var t in r)if(M(e,t)){var n=r[t];if(n){if(n.ref.focus&&T(n.ref.focus()))break;if(n.options){n.options[0].ref.focus();break}}}}(j.current,Dr.current.errors))}finally{Dr.current.isSubmitting=!1,Br({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Q(Dr.current.errors),submitCount:Dr.current.submitCount+1})}}}),[l,wr]);u((function(){c&&kr.current.isValid&&Kr(),xr.current=xr.current||!yr?xr.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 u=0,a=i.options;u<a.length;u+=1){var s=a[u];s&&s.ref&&K(s.ref)&&e(i)}else i&&K(i.ref)&&e(i)}}));return t.observe(window.document,{childList:!0,subtree:!0}),t}(j,Yr)}),[Yr,N.current]),u((function(){return function(){xr.current&&xr.current.disconnect(),_.current=!0,"production"===process.env.NODE_ENV&&Object.values(j.current).forEach((function(r){return Yr(r,!0)}))}}),[]),!c&&kr.current.isValid&&(Sr.isValid=tr(D.current,F.current)&&Q(Dr.current.errors));var te={trigger:Pr,setValue:t((function(r,e,t){Ur(r,e,t||{}),$r(r)&&Br(),Gr(r)}),[Ur,Pr]),getValues:t(Jr,[]),register:t((function(r,e){if(!Vr)if(ir(r))re({name:r},e);else{if(!x(r)||!("name"in r))return function(e){return e&&re(e,r)};re(r,e)}}),[N.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(j.current[n],!0)}}),[]),formState:Ar?new Proxy(Sr,{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 kr.current[e]=!0,r[e]}}):Sr},ne=a((function(){return Object.assign({isFormDirty:Wr,updateWatchedValue:Xr,shouldUnregister:p,updateFormState:Br,removeFieldEventListener:Qr,watchInternal:Zr,mode:or.current,reValidateMode:{isReValidateOnBlur:Rr,isReValidateOnChange:Nr},validateResolver:c?Kr:void 0,fieldsRef:j,resetFieldArrayFunctionRef:I,useWatchFieldsRef:E,useWatchRenderFunctionsRef:S,fieldArrayDefaultValuesRef:V,validFieldsRef:D,fieldsWithValidationRef:F,fieldArrayNamesRef:sr,readFormStateRef:kr,formStateRef:Dr,defaultValuesRef:N,shallowFieldsStateRef:G,fieldArrayValuesRef:A},te)}),[N.current,Xr,p,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={}),yr)for(var t=0,n=Object.values(j.current);t<n.length;t+=1){var i=n[t];if(i){var u=i.ref,a=i.options,s=jr(u)&&Array.isArray(a)?a[0].ref:u;if(d(s))try{s.closest("form").reset();break}catch(r){}}}j.current={},N.current=Object.assign({},r||N.current),r&&Gr(""),Object.values(I.current).forEach((function(r){return cr(r)&&r()})),G.current=p?{}:br(r||N.current),function(r){var e=r.errors,t=r.isDirty,n=r.isSubmitted,i=r.touched,u=r.isValid,a=r.submitCount,s=r.dirtyFields;u||(D.current={},F.current={}),V.current={},w.current=new Set,q.current=!1,Br({submitCount:a?Dr.current.submitCount:0,isDirty:!!t&&Dr.current.isDirty,isSubmitted:!!n&&Dr.current.isSubmitted,isValid:!!u&&Dr.current.isValid,dirtyFields:s?Dr.current.dirtyFields:{},touched:i?Dr.current.touched:{},errors:e?Dr.current.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})}(e)}),[]),clearErrors:t((function(r){r&&(Array.isArray(r)?r:[r]).forEach((function(r){return j.current[r]&&C(r)?delete Dr.current.errors[r]:Y(Dr.current.errors,r)})),Br({errors:r?Dr.current.errors:{}})}),[]),setError:t((function(r,e){var t=(j.current[r]||{}).ref;B(Dr.current.errors,r,Object.assign(Object.assign({},e),{ref:t})),Br({isValid:!1}),e.shouldFocus&&t&&t.focus&&t.focus()}),[]),errors:Sr.errors},te)}e(null).displayName="RHFContext",function(r){r.formgroup="formgroup",r.checkbox="checkbox"}(hr||(hr={}));var Er=r.forwardRef((function(e,t){var n=e.exampleType,i=void 0===n?hr.formgroup:n,u=wr(),a=u.register,s=u.handleSubmit,d=u.errors,v=d.formgroup1||d.formgroup2,m="Du må velge et alternativ",g=function(r){return r.length>=2||"Du må velge to alternativ"};return r.createElement("form",{onSubmit:s((function(r){console.log(r)}))},r.createElement(c,{variant:e.variant,errorSummary:v?"Sjekk at alt er riktig utfylt":void 0},i===hr.formgroup?[r.createElement(o,{key:0,title:"One amazing title",legend:"Check out these checkboxes!",error:d.formgroup1?d.formgroup1.message:void 0,variant:e.variant},r.createElement(f,{name:"formgroup1",label:"Checkbox 1",ref:a({required:m})}),r.createElement(f,{name:"formgroup1",label:"Checkbox 2",ref:a({required:m})}),r.createElement(f,{name:"formgroup1",label:"Checkbox 3",ref:a({required:m})})),r.createElement(o,{key:1,legend:"Select two options!",error:d.formgroup2?d.formgroup2.message:void 0,variant:e.variant},r.createElement(f,{name:"formgroup2",label:"Checkbox 4",ref:a({validate:g})}),r.createElement(f,{name:"formgroup2",label:"Checkbox 5",ref:a({validate:g})}),r.createElement(f,{name:"formgroup2",label:"Checkbox 6",ref:a({validate:g})}))]:i===hr.checkbox?r.createElement(r.Fragment,null,r.createElement(f,{name:"formgroup1",label:"Checkbox 1",error:d.formgroup1,errorText:d.formgroup1?d.formgroup1.message:void 0,variant:e.variant,ref:a({required:m})})):void 0),r.createElement(l,null,"Submit"))}));export default Er;
|
|
1
|
+
import r,{createContext as e,useCallback as t,useRef as n,useState as i,useEffect as u,useMemo as a,isValidElement as s}from"react";import{V as c}from"../../Validation-372a97b9.js";import{F as o}from"../../FormGroup-56d60079.js";import{C as f}from"../../Checkbox-46666e69.js";import{B as l}from"../../Button-48132cc3.js";import"../../index-9b84fabc.js";import"../Validation/styles.module.scss";import"../../_rollupPluginBabelHelpers-d0752906.js";import"../FormGroup/styles.module.scss";import"../../Title-72851d51.js";import"../Title/styles.module.scss";import"../../uuid-8870ab4b.js";import"../../Check-6291ad09.js";import"../../constants-d919236e.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-6ff0d481.js";import"../Loader/styles.module.scss";import"../../useHover-037be19d.js";import"../../useWindowSize-73b47451.js";import"../Button/styles.module.scss";var d=function(r){return r instanceof HTMLElement},v="blur",m="change",g="input",p="onBlur",y="onChange",h="onSubmit",b="onTouched",O="all",j="max",V="min",A="maxLength",w="minLength",E="pattern",S="required",F="validate";var k=function(r){return null==r},D=function(r){return"object"==typeof r},x=function(r){return!k(r)&&!Array.isArray(r)&&D(r)&&!(r instanceof Date)},C=function(r){return/^\w*$/.test(r)},R=function(r){return r.filter(Boolean)},N=function(r){return R(r.replace(/["|']/g,"").replace(/\[/g,".").replace(/\]/g,"").split("."))};function B(r,e,t){for(var n=-1,i=C(e)?[e]:N(e),u=i.length,a=u-1;++n<u;){var s=i[n],c=t;if(n!==a){var o=r[s];c=x(o)||Array.isArray(o)?o:isNaN(+i[n+1])?{}:[]}r[s]=c,r=r[s]}return r}var L=function(r,e){for(var t in void 0===e&&(e={}),r)C(t)?e[t]=r[t]:B(e,t,r[t]);return e},T=function(r){return void 0===r},M=function(r,e,t){void 0===r&&(r={});var n=R(e.split(/[,[\].]+?/)).reduce((function(r,e){return k(r)?r:r[e]}),r);return T(n)||n===r?T(r[e])?t:r[e]:n},W=function(r,e){d(r)&&r.removeEventListener&&(r.removeEventListener(g,e),r.removeEventListener(m,e),r.removeEventListener(v,e))},_={isValid:!1,value:null},q=function(r){return Array.isArray(r)?r.reduce((function(r,e){return e&&e.ref.checked?{isValid:!0,value:e.ref.value}:r}),_):_},H=function(r){return"radio"===r.type},P=function(r){return"file"===r.type},z=function(r){return"checkbox"===r.type},U=function(r){return"select-multiple"===r.type},$={value:!1,isValid:!1},G={value:!0,isValid:!0},I=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,u=t.attributes;return n?u&&!T(u.value)?T(i)||""===i?G:{value:i,isValid:!0}:G:$}return $};function J(r,e,t,n,i){var u,a=r.current[e];if(a){var s=a.ref,c=s.value,o=s.disabled,f=a.ref,l=a.valueAsNumber,d=a.valueAsDate,v=a.setValueAs;if(o&&n)return;return P(f)?f.files:H(f)?q(a.options).value:U(f)?(u=f.options,[].concat(u).filter((function(r){return r.selected})).map((function(r){return r.value}))):z(f)?I(a.options).value:i?c:l?""===c?NaN:+c:d?f.valueAsDate:v?v(c):c}if(t)return M(t.current,e)}function K(r){return!r||r instanceof HTMLElement&&r.nodeType!==Node.DOCUMENT_NODE&&K(r.parentNode)}var Q=function(r){return x(r)&&!Object.keys(r).length},X=function(r){return"boolean"==typeof r};function Y(r,e){var t,n=C(e)?[e]:N(e),i=1==n.length?r:function(r,e){for(var t=e.slice(0,-1).length,n=0;n<t;)r=T(r)?n++:r[e[n++]];return r}(r,n),u=n[n.length-1];i&&delete i[u];for(var a=0;a<n.slice(0,-1).length;a++){var s=-1,c=void 0,o=n.slice(0,-(a+1)),f=o.length-1;for(a>0&&(t=r);++s<o.length;){var l=o[s];c=c?c[l]:r[l],f===s&&(x(c)&&Q(c)||Array.isArray(c)&&!c.filter((function(r){return x(r)&&!Q(r)||X(r)})).length)&&(t?delete t[l]:delete r[l]),t=c}}return r}var Z=function(r,e){return r&&r.ref===e};var rr=function(r){return k(r)||!D(r)};function er(r,e){if(rr(r)||rr(e))return e;for(var t in e){var n=r[t],i=e[t];try{r[t]=x(n)&&x(i)||Array.isArray(n)&&Array.isArray(i)?er(n,i):i}catch(r){}}return r}function tr(r,e,t){if(rr(r)||rr(e)||r instanceof Date||e instanceof Date)return r===e;if(!s(r)){var n=Object.keys(r),i=Object.keys(e);if(n.length!==i.length)return!1;for(var u=0,a=n;u<a.length;u+=1){var c=a[u],o=r[c];if(!t||"ref"!==c){var f=e[c];if((x(o)||Array.isArray(o))&&(x(f)||Array.isArray(f))?!tr(o,f,t):o!==f)return!1}}}return!0}function nr(r,e,t,n,i){for(var u,a=-1;++a<r.length;){for(var s in r[a])Array.isArray(r[a][s])?(!t[a]&&(t[a]={}),t[a][s]=[],nr(r[a][s],M(e[a]||{},s,[]),t[a][s],t[a],s)):tr(M(e[a]||{},s),r[a][s])?B(t[a]||{},s):t[a]=Object.assign(Object.assign({},t[a]),((u={})[s]=!0,u));n&&!t.length&&delete n[i]}return t}var ir=function(r){return"string"==typeof r},ur=function(r,e,t,n,i){var u={},a=function(e){(T(i)||(ir(i)?e.startsWith(i):Array.isArray(i)&&i.find((function(r){return e.startsWith(r)}))))&&(u[e]=J(r,e,void 0,n))};for(var s in r.current)a(s);return t?L(u):er(e,L(u))},ar=function(r){return r instanceof RegExp},sr=function(r){return x(r)&&!ar(r)?r:{value:r,message:""}},cr=function(r){return"function"==typeof r},or=function(r){return ir(r)||s(r)};function fr(r,e,t){if(void 0===t&&(t="validate"),or(r)||X(r)&&!r)return{type:t,message:or(r)?r:"",ref:e}}var lr=function(r,e,t,n,i){var u;return e?Object.assign(Object.assign({},t[r]),{types:Object.assign(Object.assign({},t[r]&&t[r].types?t[r].types:{}),(u={},u[n]=i||!0,u))}):{}},dr=async function(r,e,t,n){var i=t.ref,u=t.ref.value,a=t.options,s=t.required,c=t.maxLength,o=t.minLength,f=t.min,l=t.max,d=t.pattern,v=t.validate,m=i.name,g={},p=H(i),y=z(i),h=p||y,b=""===u,O=lr.bind(null,m,e,g),D=function(r,e,t,n,u){void 0===n&&(n=A),void 0===u&&(u=w);var a=r?e:t;g[m]=Object.assign({type:r?n:u,message:a,ref:i},O(r?n:u,a))};if(s&&(!p&&!y&&(b||k(u))||X(u)&&!u||y&&!I(a).isValid||p&&!q(a).isValid)){var C=or(s)?{value:!!s,message:s}:sr(s),R=C.value,N=C.message;if(R&&(g[m]=Object.assign({type:S,message:N,ref:h?((r.current[m].options||[])[0]||{}).ref:i},O(S,N)),!e))return g}if(!(k(f)&&k(l)||""===u)){var B,L,T=sr(l),M=sr(f);if(isNaN(u)){var W=i.valueAsDate||new Date(u);ir(T.value)&&(B=W>new Date(T.value)),ir(M.value)&&(L=W<new Date(M.value))}else{var _=i.valueAsNumber||parseFloat(u);k(T.value)||(B=_>T.value),k(M.value)||(L=_<M.value)}if((B||L)&&(D(!!B,T.message,M.message,j,V),!e))return g}if(ir(u)&&!b&&(c||o)){var P=sr(c),U=sr(o),$=!k(P.value)&&u.length>P.value,G=!k(U.value)&&u.length<U.value;if(($||G)&&(D($,P.message,U.message),!e))return g}if(ir(u)&&d&&!b){var K=sr(d),Y=K.value,Z=K.message;if(ar(Y)&&!Y.test(u)&&(g[m]=Object.assign({type:E,message:Z,ref:i},O(E,Z)),!e))return g}if(v){var rr=J(r,m,n,!1,!0),er=h&&a?a[0].ref:i;if(cr(v)){var tr=fr(await v(rr),er);if(tr&&(g[m]=Object.assign(Object.assign({},tr),O(F,tr.message)),!e))return g}else if(x(v)){for(var nr={},ur=0,dr=Object.entries(v);ur<dr.length;ur+=1){var vr=dr[ur],mr=vr[0],gr=vr[1];if(!Q(nr)&&!e)break;var pr=fr(await gr(rr),er,mr);pr&&(nr=Object.assign(Object.assign({},pr),O(mr,pr.message)),e&&(g[m]=nr))}if(!Q(nr)&&(g[m]=Object.assign({ref:er},nr),!e))return g}}return g},vr=function(r,e,t){for(var n in void 0===t&&(t=[]),e){var i=r+(x(e)?"."+n:"["+n+"]");rr(e[n])?t.push(i):vr(i,e[n],t)}return t},mr=function(r,e,t,n,i){var u=void 0;return t.add(e),Q(r)||(u=M(r,e),(x(u)||Array.isArray(u))&&vr(e,u).forEach((function(r){return t.add(r)}))),T(u)?i?n:M(n,e):u},gr=function(r){return r.substring(0,r.indexOf("["))},pr=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 yr="undefined"!=typeof window&&"undefined"!=typeof document;function hr(r){var e,t;if(rr(r)||yr&&(r instanceof File||d(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 u=i[n];t.add(u)}return t}if(r instanceof Map){t=new Map;for(var a=0,s=r.keys();a<s.length;a+=1){var c=s[a];t.set(c,hr(r.get(c)))}return t}for(var o in t=Array.isArray(r)?[]:{},r)t[o]=hr(r[o]);return t}var br,Or=function(r){return{isOnSubmit:!r||r===h,isOnBlur:r===p,isOnChange:r===y,isOnAll:r===O,isOnTouch:r===b}},jr=function(r){return H(r)||z(r)},Vr="undefined"==typeof window,Ar=yr?"Proxy"in window:"undefined"!=typeof Proxy;function wr(r){void 0===r&&(r={});var e=r.mode;void 0===e&&(e=h);var s=r.reValidateMode;void 0===s&&(s=y);var c=r.resolver,o=r.context,f=r.defaultValues;void 0===f&&(f={});var l=r.shouldFocusError;void 0===l&&(l=!0);var p=r.shouldUnregister;void 0===p&&(p=!0);var b=r.criteriaMode,j=n({}),V=n({}),A=n({}),w=n(new Set),E=n({}),S=n({}),F=n({}),D=n({}),N=n(f),_=n(!1),q=n(!1),$=n(),G=n({}),I=n({}),X=n(o),ar=n(c),sr=n(new Set),or=n(Or(e)),fr=or.current,lr=fr.isOnSubmit,br=fr.isOnTouch,wr=b===O,Er=i({isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touched:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!lr,errors:{}}),Sr=Er[0],Fr=Er[1],kr=n({isDirty:!Ar,dirtyFields:!Ar,touched:!Ar||br,isValidating:!Ar,isSubmitting:!Ar,isValid:!Ar}),Dr=n(Sr),xr=n(),Cr=n(Or(s)).current,Rr=Cr.isOnBlur,Nr=Cr.isOnChange;X.current=o,ar.current=c,Dr.current=Sr,G.current=p?{}:Q(G.current)?hr(f):G.current;var Br=t((function(r){void 0===r&&(r={}),_.current||(Dr.current=Object.assign(Object.assign({},Dr.current),r),Fr(Dr.current))}),[]),Lr=function(){return kr.current.isValidating&&Br({isValidating:!0})},Tr=t((function(r,e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n={});var u=t||function(r){var e=r.errors,t=r.name,n=r.error,i=r.validFields,u=r.fieldsWithValidation,a=T(n),s=M(e,t);return a&&!!s||!a&&!tr(s,n,!0)||a&&M(u,t)&&!M(i,t)}({errors:Dr.current.errors,error:e,name:r,validFields:D.current,fieldsWithValidation:F.current}),a=M(Dr.current.errors,r);e?(Y(D.current,r),u=u||!a||!tr(a,e,!0),B(Dr.current.errors,r,e)):((M(F.current,r)||ar.current)&&(B(D.current,r,!0),u=u||a),Y(Dr.current.errors,r)),(u&&!k(t)||!Q(n)||kr.current.isValidating)&&Br(Object.assign(Object.assign(Object.assign({},n),ar.current?{isValid:!!i}:{}),{isValidating:!1}))}),[]),Mr=t((function(r,e){var t=j.current[r],n=t.ref,i=t.options,u=yr&&d(n)&&k(e)?"":e;H(n)?(i||[]).forEach((function(r){var e=r.ref;return e.checked=e.value===u})):P(n)&&!ir(u)?n.files=u:U(n)?[].concat(n.options).forEach((function(r){return r.selected=u.includes(r.value)})):z(n)&&i?i.length>1?i.forEach((function(r){var e=r.ref;return e.checked=Array.isArray(u)?!!u.find((function(r){return r===e.value})):u===e.value})):i[0].ref.checked=!!u:n.value=u}),[]),Wr=t((function(r,e){if(kr.current.isDirty){var t=Jr();return r&&e&&B(t,r,e),!tr(t,N.current)}return!1}),[]),_r=t((function(r,e){if(void 0===e&&(e=!0),kr.current.isDirty||kr.current.dirtyFields){var t=!tr(M(N.current,r),J(j,r,G)),n=M(Dr.current.dirtyFields,r),i=Dr.current.isDirty;t?B(Dr.current.dirtyFields,r,!0):Y(Dr.current.dirtyFields,r);var u={isDirty:Wr(),dirtyFields:Dr.current.dirtyFields},a=kr.current.isDirty&&i!==u.isDirty||kr.current.dirtyFields&&n!==M(Dr.current.dirtyFields,r);return a&&e&&Br(u),a?u:{}}return{}}),[]),qr=t((async function(r,e){if("production"!==process.env.NODE_ENV&&!j.current[r])return console.warn("📋 Field is missing with `name` attribute: ",r),!1;var t=(await dr(j,wr,j.current[r],G))[r];return Tr(r,t,e),T(t)}),[Tr,wr]),Hr=t((async function(r){var e=(await ar.current(Jr(),X.current,wr)).errors,t=Dr.current.isValid;if(Array.isArray(r)){var n=r.map((function(r){var t=M(e,r);return t?B(Dr.current.errors,r,t):Y(Dr.current.errors,r),!t})).every(Boolean);return Br({isValid:Q(e),isValidating:!1}),n}var i=M(e,r);return Tr(r,i,t!==Q(e),{},Q(e)),!i}),[Tr,wr]),Pr=t((async function(r){var e=r||Object.keys(j.current);if(Lr(),ar.current)return Hr(e);if(Array.isArray(e)){!r&&(Dr.current.errors={});var t=await Promise.all(e.map((async function(r){return await qr(r,null)})));return Br({isValidating:!1}),t.every(Boolean)}return await qr(e)}),[Hr,qr]),zr=t((function(r,e,t){var n=t.shouldDirty,i=t.shouldValidate,u={};B(u,r,e);for(var a=0,s=vr(r,e);a<s.length;a+=1){var c=s[a];j.current[c]&&(Mr(c,M(u,c)),n&&_r(c),i&&Pr(c))}}),[Pr,Mr,_r]),Ur=t((function(r,e,t){var n,i;if(!p&&!rr(e)&&B(G.current,r,Array.isArray(e)?[].concat(e):Object.assign({},e)),j.current[r])Mr(r,e),t.shouldDirty&&_r(r),t.shouldValidate&&Pr(r);else if(!rr(e)&&(zr(r,e,t),sr.current.has(r))){var u=gr(r)||r;B(V.current,r,e),I.current[u](((n={})[u]=M(V.current,u),n)),(kr.current.isDirty||kr.current.dirtyFields)&&t.shouldDirty&&(B(Dr.current.dirtyFields,r,function(r,e,t){return er(nr(r,e,t.slice(0,r.length)),nr(e,r,t.slice(0,r.length)))}(e,M(N.current,r,[]),M(Dr.current.dirtyFields,r,[]))),Br({isDirty:!tr(Object.assign(Object.assign({},Jr()),(i={},i[r]=e,i)),N.current)}))}!p&&B(G.current,r,e)}),[_r,Mr,zr]),$r=function(r){return q.current||w.current.has(r)||w.current.has((r.match(/\w+/)||[])[0])},Gr=function(r){var e=!0;if(!Q(E.current))for(var t in E.current)r&&E.current[t].size&&!E.current[t].has(r)&&!E.current[t].has(gr(r))||(S.current[t](),e=!1);return e};function Ir(r){var e;if(!p){for(var t=hr(r),n=0,i=sr.current;n<i.length;n+=1){var u=i[n];C(u)&&!t[u]&&(t=Object.assign(Object.assign({},t),((e={})[u]=[],e)))}return t}return r}function Jr(r){if(ir(r))return J(j,r,G);if(Array.isArray(r)){for(var e={},t=0,n=r;t<n.length;t+=1){var i=n[t];B(e,i,J(j,i,G))}return e}return Ir(ur(j,hr(G.current),p))}$.current=$.current?$.current:async function(r){var e,t,n=r.type,i=r.target,u=i.name,a=j.current[u];if(a){var s=n===v,c=function(r){var e=r.isOnBlur,t=r.isOnChange,n=r.isOnTouch,i=r.isTouched,u=r.isReValidateOnBlur,a=r.isReValidateOnChange,s=r.isBlurEvent,c=r.isSubmitted;return!r.isOnAll&&(!c&&n?!(i||s):(c?u:e)?!s:!(c?a:t)||s)}(Object.assign({isBlurEvent:s,isReValidateOnChange:Nr,isReValidateOnBlur:Rr,isTouched:!!M(Dr.current.touched,u),isSubmitted:Dr.current.isSubmitted},or.current)),o=_r(u,!1),f=!Q(o)||!s&&$r(u);if(s&&!M(Dr.current.touched,u)&&kr.current.touched&&(B(Dr.current.touched,u,!0),o=Object.assign(Object.assign({},o),{touched:Dr.current.touched})),!p&&z(i)&&B(G.current,u,J(j,u)),c)return!s&&Gr(u),(!Q(o)||f&&Q(o))&&Br(o);if(Lr(),ar.current){var l=(await ar.current(Jr(),X.current,wr)).errors,d=Dr.current.isValid;if(e=M(l,u),z(i)&&!e&&ar.current){var m=gr(u),g=M(l,m,{});g.type&&g.message&&(e=g),m&&(g||M(Dr.current.errors,m))&&(u=m)}d!==(t=Q(l))&&(f=!0)}else e=(await dr(j,wr,a,G))[u];!s&&Gr(u),Tr(u,e,f,o,t)}};var Kr=t((async function(r){void 0===r&&(r={});var e=Q(j.current)?N.current:{},t=(await ar.current(Object.assign(Object.assign(Object.assign({},e),Jr()),r),X.current,wr)||{}).errors,n=Q(t);Dr.current.isValid!==n&&Br({isValid:n})}),[wr]),Qr=t((function(r,e){!function(r,e,t,n,i,u){var a=t.ref,s=t.ref.name,c=r.current[s];if(!i){var o=J(r,s,n);!T(o)&&B(n.current,s,o)}a.type&&c?H(a)||z(a)?Array.isArray(c.options)&&c.options.length?(R(c.options).forEach((function(r,t){void 0===r&&(r={}),(K(r.ref)&&Z(r,r.ref)||u)&&(W(r.ref,e),Y(c.options,"["+t+"]"))})),c.options&&!R(c.options).length&&delete r.current[s]):delete r.current[s]:(K(a)&&Z(c,a)||u)&&(W(a,e),delete r.current[s]):delete r.current[s]}(j,$.current,r,G,p,e),p&&(Y(D.current,r.ref.name),Y(F.current,r.ref.name))}),[p]),Xr=t((function(r){if(q.current)Br();else{for(var e=0,t=w.current;e<t.length;e+=1){if(t[e].startsWith(r)){Br();break}}Gr(r)}}),[]),Yr=t((function(r,e){r&&(Qr(r,e),p&&!R(r.options||[]).length&&(Y(Dr.current.errors,r.ref.name),B(Dr.current.dirtyFields,r.ref.name,!0),Br({isDirty:Wr()}),kr.current.isValid&&ar.current&&Kr(),Xr(r.ref.name)))}),[Kr,Qr]);var Zr=t((function(r,e,t){var n=t?E.current[t]:w.current,i=ur(j,hr(G.current),p,!1,r);if(ir(r)){var u=gr(r)||r;return sr.current.has(u)&&(i=Object.assign(Object.assign({},A.current),i)),mr(i,r,n,T(M(N.current,r))?e:M(N.current,r),!0)}var a=T(e)?N.current:e;return Array.isArray(r)?r.reduce((function(r,e){var t;return Object.assign(Object.assign({},r),((t={})[e]=mr(i,e,n,a),t))}),{}):(q.current=T(t),L(!Q(i)&&i||a))}),[]);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(sr.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,u=r.value,a=Object.assign({ref:r},e),s=j.current,c=jr(r),o=pr(sr.current,n),f=function(e){return yr&&(!d(r)||e===r)},l=s[n],y=!0;if(l&&(c?Array.isArray(l.options)&&R(l.options).find((function(r){return u===r.ref.value&&f(r.ref)})):f(l.ref)))s[n]=Object.assign(Object.assign({},l),e);else{l=i?c?Object.assign({options:R(l&&l.options||[]).concat([{ref:r}]),ref:{type:i,name:n}},e):Object.assign({},a):a,s[n]=l;var h=T(M(G.current,n));Q(N.current)&&h||(t=M(h?N.current:G.current,n),(y=T(t))||o||Mr(n,t)),Q(e)||(B(F.current,n,!0),!lr&&kr.current.isValid&&dr(j,wr,l,G).then((function(r){var e=Dr.current.isValid;Q(r)?B(D.current,n,!0):Y(D.current,n),e!==Q(r)&&Br()}))),!p||o&&y||!o&&Y(Dr.current.dirtyFields,n),i&&function(r,e,t){var n=r.ref;d(n)&&t&&(n.addEventListener(e?m:g,t),n.addEventListener(v,t))}(c&&l.options?l.options[l.options.length-1]:l,c||"select-one"===r.type,$.current)}}var ee=t((function(r,e){return async function(t){t&&t.preventDefault&&(t.preventDefault(),t.persist());var n={},i=Ir(ur(j,hr(G.current),p,!0));kr.current.isSubmitting&&Br({isSubmitting:!0});try{if(ar.current){var u=await ar.current(i,X.current,wr),a=u.errors,s=u.values;Dr.current.errors=n=a,i=s}else for(var c=0,o=Object.values(j.current);c<o.length;c+=1){var f=o[c];if(f){var d=f.ref.name,v=await dr(j,wr,f,G);v[d]?(B(n,d,v[d]),Y(D.current,d)):M(F.current,d)&&(Y(Dr.current.errors,d),B(D.current,d,!0))}}Q(n)&&Object.keys(Dr.current.errors).every((function(r){return r in j.current}))?(Br({errors:{},isSubmitting:!0}),await r(i,t)):(Dr.current.errors=Object.assign(Object.assign({},Dr.current.errors),n),e&&await e(Dr.current.errors,t),l&&function(r,e){for(var t in r)if(M(e,t)){var n=r[t];if(n){if(n.ref.focus&&T(n.ref.focus()))break;if(n.options){n.options[0].ref.focus();break}}}}(j.current,Dr.current.errors))}finally{Dr.current.isSubmitting=!1,Br({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Q(Dr.current.errors),submitCount:Dr.current.submitCount+1})}}}),[l,wr]);u((function(){c&&kr.current.isValid&&Kr(),xr.current=xr.current||!yr?xr.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 u=0,a=i.options;u<a.length;u+=1){var s=a[u];s&&s.ref&&K(s.ref)&&e(i)}else i&&K(i.ref)&&e(i)}}));return t.observe(window.document,{childList:!0,subtree:!0}),t}(j,Yr)}),[Yr,N.current]),u((function(){return function(){xr.current&&xr.current.disconnect(),_.current=!0,"production"===process.env.NODE_ENV&&Object.values(j.current).forEach((function(r){return Yr(r,!0)}))}}),[]),!c&&kr.current.isValid&&(Sr.isValid=tr(D.current,F.current)&&Q(Dr.current.errors));var te={trigger:Pr,setValue:t((function(r,e,t){Ur(r,e,t||{}),$r(r)&&Br(),Gr(r)}),[Ur,Pr]),getValues:t(Jr,[]),register:t((function(r,e){if(!Vr)if(ir(r))re({name:r},e);else{if(!x(r)||!("name"in r))return function(e){return e&&re(e,r)};re(r,e)}}),[N.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(j.current[n],!0)}}),[]),formState:Ar?new Proxy(Sr,{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 kr.current[e]=!0,r[e]}}):Sr},ne=a((function(){return Object.assign({isFormDirty:Wr,updateWatchedValue:Xr,shouldUnregister:p,updateFormState:Br,removeFieldEventListener:Qr,watchInternal:Zr,mode:or.current,reValidateMode:{isReValidateOnBlur:Rr,isReValidateOnChange:Nr},validateResolver:c?Kr:void 0,fieldsRef:j,resetFieldArrayFunctionRef:I,useWatchFieldsRef:E,useWatchRenderFunctionsRef:S,fieldArrayDefaultValuesRef:V,validFieldsRef:D,fieldsWithValidationRef:F,fieldArrayNamesRef:sr,readFormStateRef:kr,formStateRef:Dr,defaultValuesRef:N,shallowFieldsStateRef:G,fieldArrayValuesRef:A},te)}),[N.current,Xr,p,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={}),yr)for(var t=0,n=Object.values(j.current);t<n.length;t+=1){var i=n[t];if(i){var u=i.ref,a=i.options,s=jr(u)&&Array.isArray(a)?a[0].ref:u;if(d(s))try{s.closest("form").reset();break}catch(r){}}}j.current={},N.current=Object.assign({},r||N.current),r&&Gr(""),Object.values(I.current).forEach((function(r){return cr(r)&&r()})),G.current=p?{}:hr(r||N.current),function(r){var e=r.errors,t=r.isDirty,n=r.isSubmitted,i=r.touched,u=r.isValid,a=r.submitCount,s=r.dirtyFields;u||(D.current={},F.current={}),V.current={},w.current=new Set,q.current=!1,Br({submitCount:a?Dr.current.submitCount:0,isDirty:!!t&&Dr.current.isDirty,isSubmitted:!!n&&Dr.current.isSubmitted,isValid:!!u&&Dr.current.isValid,dirtyFields:s?Dr.current.dirtyFields:{},touched:i?Dr.current.touched:{},errors:e?Dr.current.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})}(e)}),[]),clearErrors:t((function(r){r&&(Array.isArray(r)?r:[r]).forEach((function(r){return j.current[r]&&C(r)?delete Dr.current.errors[r]:Y(Dr.current.errors,r)})),Br({errors:r?Dr.current.errors:{}})}),[]),setError:t((function(r,e){var t=(j.current[r]||{}).ref;B(Dr.current.errors,r,Object.assign(Object.assign({},e),{ref:t})),Br({isValid:!1}),e.shouldFocus&&t&&t.focus&&t.focus()}),[]),errors:Sr.errors},te)}e(null).displayName="RHFContext",function(r){r.formgroup="formgroup",r.checkbox="checkbox"}(br||(br={}));var Er=r.forwardRef((function(e,t){var n=e.exampleType,i=void 0===n?br.formgroup:n,u=wr(),a=u.register,s=u.handleSubmit,d=u.errors,v=d.formgroup1||d.formgroup2,m="Du må velge et alternativ",g=function(r){return r.length>=2||"Du må velge to alternativ"};return r.createElement("form",{onSubmit:s((function(r){console.log(r)}))},r.createElement(c,{variant:e.variant,errorSummary:v?"Sjekk at alt er riktig utfylt":void 0},i===br.formgroup?[r.createElement(o,{key:0,title:"One amazing title",legend:"Check out these checkboxes!",error:d.formgroup1?d.formgroup1.message:void 0,variant:e.variant},r.createElement(f,{name:"formgroup1",label:"Checkbox 1",ref:a({required:m})}),r.createElement(f,{name:"formgroup1",label:"Checkbox 2",ref:a({required:m})}),r.createElement(f,{name:"formgroup1",label:"Checkbox 3",ref:a({required:m})})),r.createElement(o,{key:1,legend:"Select two options!",error:d.formgroup2?d.formgroup2.message:void 0,variant:e.variant},r.createElement(f,{name:"formgroup2",label:"Checkbox 4",ref:a({validate:g})}),r.createElement(f,{name:"formgroup2",label:"Checkbox 5",ref:a({validate:g})}),r.createElement(f,{name:"formgroup2",label:"Checkbox 6",ref:a({validate:g})}))]:i===br.checkbox?r.createElement(r.Fragment,null,r.createElement(f,{name:"formgroup1",label:"Checkbox 1",error:d.formgroup1,errorText:d.formgroup1?d.formgroup1.message:void 0,variant:e.variant,ref:a({required:m})})):void 0),r.createElement(l,null,"Submit"))}));export default Er;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{F as s}from"../../FormGroup-
|
|
1
|
+
import{F as s}from"../../FormGroup-56d60079.js";export{F as default}from"../../FormGroup-56d60079.js";import"../../_rollupPluginBabelHelpers-d0752906.js";import"react";import"../../index-9b84fabc.js";import"./styles.module.scss";import"../../Checkbox-46666e69.js";import"../../uuid-8870ab4b.js";import"../../Check-6291ad09.js";import"../../constants-d919236e.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"../../Title-72851d51.js";import"../Title/styles.module.scss";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PaletteNames } from '../../theme/palette';
|
|
3
3
|
export declare type LinkListSize = 'small' | 'medium' | 'large';
|
|
4
|
+
export declare type LinkAnchorTargets = '_self' | '_blank' | '_parent';
|
|
4
5
|
export declare type LinkListColors = PaletteNames;
|
|
5
6
|
export declare type LinkType = React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLLIElement>>;
|
|
6
7
|
export interface CompoundComponent extends React.ForwardRefExoticComponent<LinkListProps & React.RefAttributes<HTMLUListElement>> {
|
|
@@ -21,6 +22,8 @@ interface LinkListProps {
|
|
|
21
22
|
topBorder?: boolean;
|
|
22
23
|
/** Changes size of the LinkList. */
|
|
23
24
|
size?: LinkListSize;
|
|
25
|
+
/** Sets the data-testid attribute. */
|
|
26
|
+
testId?: string;
|
|
24
27
|
}
|
|
25
28
|
export interface LinkProps extends React.HTMLAttributes<HTMLAnchorElement> {
|
|
26
29
|
children: React.ReactNode;
|
|
@@ -30,6 +33,9 @@ export interface LinkProps extends React.HTMLAttributes<HTMLAnchorElement> {
|
|
|
30
33
|
className?: string;
|
|
31
34
|
icon?: React.ReactElement;
|
|
32
35
|
href?: string;
|
|
36
|
+
target?: LinkAnchorTargets;
|
|
37
|
+
/** Sets the data-testid attribute. */
|
|
38
|
+
testId?: string;
|
|
33
39
|
}
|
|
34
40
|
export declare const LinkList: CompoundComponent;
|
|
35
41
|
export default LinkList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkList.d.ts","sourceRoot":"","sources":["../../../src/components/LinkList/LinkList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQnD,oBAAY,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAExD,oBAAY,cAAc,GAAG,YAAY,CAAC;AAC1C,oBAAY,QAAQ,GAAG,KAAK,CAAC,yBAAyB,CAAC,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC;AACvG,MAAM,WAAW,iBAAkB,SAAQ,KAAK,CAAC,yBAAyB,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC/H,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,UAAU,aAAa;IACrB,4BAA4B;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,KAAK,EAAE,cAAc,CAAC;IACtB,sCAAsC;IACtC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,yDAAyD;IACzD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oCAAoC;IACpC,IAAI,CAAC,EAAE,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"LinkList.d.ts","sourceRoot":"","sources":["../../../src/components/LinkList/LinkList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQnD,oBAAY,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAExD,oBAAY,iBAAiB,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE/D,oBAAY,cAAc,GAAG,YAAY,CAAC;AAC1C,oBAAY,QAAQ,GAAG,KAAK,CAAC,yBAAyB,CAAC,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC;AACvG,MAAM,WAAW,iBAAkB,SAAQ,KAAK,CAAC,yBAAyB,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC/H,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,UAAU,aAAa;IACrB,4BAA4B;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,KAAK,EAAE,cAAc,CAAC;IACtB,sCAAsC;IACtC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,yDAAyD;IACzD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oCAAoC;IACpC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAU,SAAQ,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC;IACxE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA8CD,eAAO,MAAM,QAAQ,mBAsBE,CAAC;AAKxB,eAAe,QAAQ,CAAC"}
|
|
@@ -174,6 +174,25 @@
|
|
|
174
174
|
}
|
|
175
175
|
]
|
|
176
176
|
}
|
|
177
|
+
},
|
|
178
|
+
"testId": {
|
|
179
|
+
"defaultValue": null,
|
|
180
|
+
"description": "Sets the data-testid attribute.",
|
|
181
|
+
"name": "testId",
|
|
182
|
+
"parent": {
|
|
183
|
+
"fileName": "src/components/LinkList/LinkList.tsx",
|
|
184
|
+
"name": "LinkListProps"
|
|
185
|
+
},
|
|
186
|
+
"declarations": [
|
|
187
|
+
{
|
|
188
|
+
"fileName": "src/components/LinkList/LinkList.tsx",
|
|
189
|
+
"name": "LinkListProps"
|
|
190
|
+
}
|
|
191
|
+
],
|
|
192
|
+
"required": false,
|
|
193
|
+
"type": {
|
|
194
|
+
"name": "string"
|
|
195
|
+
}
|
|
177
196
|
}
|
|
178
197
|
}
|
|
179
198
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"../../_rollupPluginBabelHelpers-d0752906.js";import{_ as
|
|
1
|
+
import{a as e}from"../../_rollupPluginBabelHelpers-d0752906.js";import{_ as r}from"../../_tslib-51c8a283.js";import t from"react";import{c as l}from"../../index-9b84fabc.js";import{a,I as i}from"../../constants-d919236e.js";import{u as o,B as s}from"../../useBreakpoint-324a9b14.js";import{u as n}from"../../useHover-037be19d.js";import m from"./styles.module.scss";import"../../useWindowSize-73b47451.js";import"../../grid-11a70eb7.js";var c=function(e){var r=e.isExtraSmall,l=e.isHovered,a=t.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=t.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=t.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 r?l?t.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:l?i:a},d=t.forwardRef((function(d,v){var p,f=d.children,u=d.className,h=void 0===u?"":u,_=d.color,k=void 0===_?"neutral":_,b=d.icon,E=d.size,z=void 0===E?"medium":E,L=d.chevron,g=void 0!==L&&L,j=d.testId,N=d.target,H=r(d,["children","className","color","icon","size","chevron","testId","target"]),B=n(),I=B.hoverRef,S=B.isHovered,M=o(),w="small"!==z&&!(!g&&!b);return t.createElement("li",{ref:v,"data-testid":j},t.createElement("a",Object.assign({className:l(m["link-list__anchor"],m["link-list__anchor--"+k],(p={},e(p,m["link-list__anchor--small"],"small"===z),e(p,m["link-list__anchor--medium"],"medium"===z),e(p,m["link-list__anchor--large"],"large"===z),p),h),ref:I,rel:"_blank"===N?"noopener noreferrer":void 0,target:N},H),w&&b&&t.createElement("span",{className:m["link-list__icon"]},t.cloneElement(b,{size:M===s.Xs?a.XSmall:a.Small,isHovered:S})),t.createElement("span",{className:m["link-list__content"]},f),w&&g&&t.createElement("span",{className:m["link-list__chevron"]},t.createElement(i,{svgIcon:c,isHovered:S,size:a.XSmall}))))})),v=t.forwardRef((function(r,a){var i,o=r.children,s=r.className,n=void 0===s?"":s,c=r.chevron,v=void 0!==c&&c,p=r.size,f=void 0===p?"medium":p,u=r.color,h=r.topBorder,_=void 0===h||h,k=r.bottomBorder,b=void 0===k||k,E=r.testId;return t.createElement("ul",{ref:a,className:l(m["link-list"],(i={},e(i,m["link-list--hastopborder"],_),e(i,m["link-list--nobottomborder"],!b),i),n||""),"data-testid":E},t.Children.map(o,(function(e){if(e.type===d)return t.cloneElement(e,{color:u,size:f,chevron:v})})))}));v.Link=d,d.displayName="LinkList.Link";export default v;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../src/components/List/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,UAAU,SAAS;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../src/components/List/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,UAAU,SAAS;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,iBAAS,IAAI,CAAC,KAAK,EAAE,SAAS,eAa7B;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -18,6 +18,25 @@
|
|
|
18
18
|
"type": {
|
|
19
19
|
"name": "string"
|
|
20
20
|
}
|
|
21
|
+
},
|
|
22
|
+
"testId": {
|
|
23
|
+
"defaultValue": null,
|
|
24
|
+
"description": "Sets the data-testid attribute.",
|
|
25
|
+
"name": "testId",
|
|
26
|
+
"parent": {
|
|
27
|
+
"fileName": "src/components/List/List.tsx",
|
|
28
|
+
"name": "ListProps"
|
|
29
|
+
},
|
|
30
|
+
"declarations": [
|
|
31
|
+
{
|
|
32
|
+
"fileName": "src/components/List/List.tsx",
|
|
33
|
+
"name": "ListProps"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"required": false,
|
|
37
|
+
"type": {
|
|
38
|
+
"name": "string"
|
|
39
|
+
}
|
|
21
40
|
}
|
|
22
41
|
}
|
|
23
42
|
}
|
package/components/List/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import{c as t}from"../../index-9b84fabc.js";import
|
|
1
|
+
import e from"react";import{c as t}from"../../index-9b84fabc.js";import s from"./styles.module.scss";export default function(a){var r=a.children,m=a.className,l=a.testId;return e.createElement("ul",{className:t(s.list,m),"data-testid":l},r.map((function(t,a){return e.createElement("li",{className:s.list__item,key:a},t)})))}
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{L as r}from"../../Loader-
|
|
1
|
+
import{L as r}from"../../Loader-6ff0d481.js";export{L as default}from"../../Loader-6ff0d481.js";import"../../_rollupPluginBabelHelpers-d0752906.js";import"react";import"../../index-9b84fabc.js";import"../../uuid-8870ab4b.js";import"./styles.module.scss";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -10,6 +10,8 @@ interface LogoProps {
|
|
|
10
10
|
color?: LogoColor;
|
|
11
11
|
/** Changes to the byline variant of the logo. */
|
|
12
12
|
byline?: boolean;
|
|
13
|
+
/** Sets the data-testid attribute. */
|
|
14
|
+
testId?: string;
|
|
13
15
|
}
|
|
14
16
|
declare function Logo(props: LogoProps): JSX.Element;
|
|
15
17
|
export default Logo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logo.d.ts","sourceRoot":"","sources":["../../../src/components/Logo/Logo.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,aAAK,SAAS,GAAG,YAAY,CAAC;AAE9B,UAAU,SAAS;IACjB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,iDAAiD;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Logo.d.ts","sourceRoot":"","sources":["../../../src/components/Logo/Logo.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,aAAK,SAAS,GAAG,YAAY,CAAC;AAE9B,UAAU,SAAS;IACjB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,iDAAiD;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAwDD,iBAAS,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAG3C;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -111,6 +111,25 @@
|
|
|
111
111
|
"type": {
|
|
112
112
|
"name": "boolean"
|
|
113
113
|
}
|
|
114
|
+
},
|
|
115
|
+
"testId": {
|
|
116
|
+
"defaultValue": null,
|
|
117
|
+
"description": "Sets the data-testid attribute.",
|
|
118
|
+
"name": "testId",
|
|
119
|
+
"parent": {
|
|
120
|
+
"fileName": "src/components/Logo/Logo.tsx",
|
|
121
|
+
"name": "LogoProps"
|
|
122
|
+
},
|
|
123
|
+
"declarations": [
|
|
124
|
+
{
|
|
125
|
+
"fileName": "src/components/Logo/Logo.tsx",
|
|
126
|
+
"name": "LogoProps"
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
"required": false,
|
|
130
|
+
"type": {
|
|
131
|
+
"name": "string"
|
|
132
|
+
}
|
|
114
133
|
}
|
|
115
134
|
}
|
|
116
135
|
}
|
package/components/Logo/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e}from"../../_tslib-51c8a283.js";import
|
|
1
|
+
import{_ as e}from"../../_tslib-51c8a283.js";import t from"react";import{g as c}from"../../color-acb834c6.js";import"../../index-19b48c51.js";import"../../palette-f206f488.js";import"../../grid-11a70eb7.js";var l=function(e){var l=e.size,v=void 0===l?300:l,h=e.color,a=void 0===h?"black":h,s=e.className,i=void 0===s?"":s,r=e.testId;return t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:v,role:"img","aria-labelledby":"logo-title",viewBox:"0 0 502 220",className:i,"data-testid":r},t.createElement("title",{id:"logo-title"},"Helsenorge"),t.createElement("g",{fill:c(a,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"})))},v=function(e){var l=e.size,v=void 0===l?300:l,h=e.color,a=void 0===h?"black":h,s=e.className,i=void 0===s?"":s,r=e.testId;return t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:v,role:"img","aria-labelledby":"logo-title",viewBox:"0 0 87 12",className:i,"data-testid":r},t.createElement("title",{id:"logo-title"},"Helsenorge"),t.createElement("g",{fill:c(a,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 h=c.byline,a=void 0!==h&&h,s=e(c,["byline"]);return a?t.createElement(v,Object.assign({},s)):t.createElement(l,Object.assign({},s))}
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,6 +3,7 @@ export declare enum ModalVariants {
|
|
|
3
3
|
normal = "normal",
|
|
4
4
|
warning = "warning",
|
|
5
5
|
error = "error",
|
|
6
|
+
success = "success",
|
|
6
7
|
image = "image"
|
|
7
8
|
}
|
|
8
9
|
export declare enum ModalSize {
|
|
@@ -20,6 +21,8 @@ export interface ModalProps {
|
|
|
20
21
|
variant?: keyof typeof ModalVariants;
|
|
21
22
|
/** Change width of the modal (default: large) */
|
|
22
23
|
size?: keyof typeof ModalSize;
|
|
24
|
+
/** Icon displayed in title */
|
|
25
|
+
icon?: React.ReactElement;
|
|
23
26
|
/** Hides the close button */
|
|
24
27
|
noCloseButton?: boolean;
|
|
25
28
|
/** Sets the data-testid attribute. */
|
|
@@ -36,6 +39,8 @@ export interface ModalProps {
|
|
|
36
39
|
ariaLabelCloseBtn?: string;
|
|
37
40
|
/** Alternative component to modal */
|
|
38
41
|
children?: React.ReactNode;
|
|
42
|
+
/** Component shown after title */
|
|
43
|
+
afterTitleChildren?: React.ReactNode;
|
|
39
44
|
/** Adds custom classes to the element. */
|
|
40
45
|
className?: string;
|
|
41
46
|
/** Function is called when user clicks primary button */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAkBzC,oBAAY,aAAa;IACvB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAED,oBAAY,SAAS;IACnB,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+GAA+G;IAC/G,OAAO,CAAC,EAAE,MAAM,OAAO,aAAa,CAAC;IACrC,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,OAAO,SAAS,CAAC;IAC9B,8BAA8B;IAC9B,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC1B,6BAA6B;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,2BAA2B;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,8BAA8B;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qCAAqC;IACrC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,kCAAkC;IAClC,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACrC,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAsCD,QAAA,MAAM,KAAK;;;;;;;;;CA4IV,CAAC;AAIF,eAAe,KAAK,CAAC"}
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"required": false,
|
|
77
77
|
"type": {
|
|
78
78
|
"name": "enum",
|
|
79
|
-
"raw": "\"normal\" | \"warning\" | \"error\" | \"image\" | undefined",
|
|
79
|
+
"raw": "\"normal\" | \"warning\" | \"error\" | \"success\" | \"image\" | undefined",
|
|
80
80
|
"value": [
|
|
81
81
|
{
|
|
82
82
|
"value": "undefined"
|
|
@@ -90,6 +90,9 @@
|
|
|
90
90
|
{
|
|
91
91
|
"value": "\"error\""
|
|
92
92
|
},
|
|
93
|
+
{
|
|
94
|
+
"value": "\"success\""
|
|
95
|
+
},
|
|
93
96
|
{
|
|
94
97
|
"value": "\"image\""
|
|
95
98
|
}
|
|
@@ -129,6 +132,25 @@
|
|
|
129
132
|
]
|
|
130
133
|
}
|
|
131
134
|
},
|
|
135
|
+
"icon": {
|
|
136
|
+
"defaultValue": null,
|
|
137
|
+
"description": "Icon displayed in title",
|
|
138
|
+
"name": "icon",
|
|
139
|
+
"parent": {
|
|
140
|
+
"fileName": "src/components/Modal/Modal.tsx",
|
|
141
|
+
"name": "ModalProps"
|
|
142
|
+
},
|
|
143
|
+
"declarations": [
|
|
144
|
+
{
|
|
145
|
+
"fileName": "src/components/Modal/Modal.tsx",
|
|
146
|
+
"name": "ModalProps"
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"required": false,
|
|
150
|
+
"type": {
|
|
151
|
+
"name": "ReactElement<any, string | ((props: any) => ReactElement<any, any> | null) | (new (props: any) => Component<any, any, any>)>"
|
|
152
|
+
}
|
|
153
|
+
},
|
|
132
154
|
"noCloseButton": {
|
|
133
155
|
"defaultValue": null,
|
|
134
156
|
"description": "Hides the close button",
|
|
@@ -283,6 +305,25 @@
|
|
|
283
305
|
"name": "ReactNode"
|
|
284
306
|
}
|
|
285
307
|
},
|
|
308
|
+
"afterTitleChildren": {
|
|
309
|
+
"defaultValue": null,
|
|
310
|
+
"description": "Component shown after title",
|
|
311
|
+
"name": "afterTitleChildren",
|
|
312
|
+
"parent": {
|
|
313
|
+
"fileName": "src/components/Modal/Modal.tsx",
|
|
314
|
+
"name": "ModalProps"
|
|
315
|
+
},
|
|
316
|
+
"declarations": [
|
|
317
|
+
{
|
|
318
|
+
"fileName": "src/components/Modal/Modal.tsx",
|
|
319
|
+
"name": "ModalProps"
|
|
320
|
+
}
|
|
321
|
+
],
|
|
322
|
+
"required": false,
|
|
323
|
+
"type": {
|
|
324
|
+
"name": "ReactNode"
|
|
325
|
+
}
|
|
326
|
+
},
|
|
286
327
|
"className": {
|
|
287
328
|
"defaultValue": {
|
|
288
329
|
"value": ""
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{M as s}from"../../Modal-
|
|
1
|
+
import{M as s}from"../../Modal-145869ba.js";export{M as default}from"../../Modal-145869ba.js";import"../../_rollupPluginBabelHelpers-d0752906.js";import"react";import"../../index-9b84fabc.js";import"../../palette-f206f488.js";import"../../Button-48132cc3.js";import"../../_tslib-51c8a283.js";import"../../color-acb834c6.js";import"../../index-19b48c51.js";import"../../grid-11a70eb7.js";import"../../constants-d919236e.js";import"../../Loader-6ff0d481.js";import"../../uuid-8870ab4b.js";import"../Loader/styles.module.scss";import"../../useHover-037be19d.js";import"../../useWindowSize-73b47451.js";import"../Button/styles.module.scss";import"./styles.module.scss";import"../../AlertSignFill-e607ff43.js";import"../../Title-72851d51.js";import"../Title/styles.module.scss";import"../../Close-591125bb.js";import"../Close/styles.module.scss";import"../../useBreakpoint-324a9b14.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -31,13 +31,21 @@
|
|
|
31
31
|
background-color: $white;
|
|
32
32
|
animation: open 200ms 1;
|
|
33
33
|
|
|
34
|
-
&__title
|
|
35
|
-
|
|
34
|
+
&__title {
|
|
35
|
+
&--error {
|
|
36
|
+
color: $cherry600;
|
|
37
|
+
}
|
|
38
|
+
&--success {
|
|
39
|
+
color: $kiwi900;
|
|
40
|
+
}
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
&__iconWrapper {
|
|
39
44
|
padding-right: 0.75rem;
|
|
40
45
|
}
|
|
46
|
+
&__afterTitleChildren {
|
|
47
|
+
padding-left: 0.75rem;
|
|
48
|
+
}
|
|
41
49
|
|
|
42
50
|
p {
|
|
43
51
|
font-size: 1.125rem;
|
|
@@ -52,6 +60,9 @@
|
|
|
52
60
|
&--warning {
|
|
53
61
|
background-color: $banana50;
|
|
54
62
|
}
|
|
63
|
+
&--success {
|
|
64
|
+
background-color: $kiwi50;
|
|
65
|
+
}
|
|
55
66
|
|
|
56
67
|
&--large {
|
|
57
68
|
width: calc(100vw - 0.75rem);
|
|
@@ -150,6 +161,7 @@
|
|
|
150
161
|
|
|
151
162
|
&__title {
|
|
152
163
|
display: flex;
|
|
164
|
+
align-items: center;
|
|
153
165
|
div {
|
|
154
166
|
display: flex;
|
|
155
167
|
justify-content: center;
|
|
@@ -177,27 +189,6 @@
|
|
|
177
189
|
white-space: pre-line;
|
|
178
190
|
}
|
|
179
191
|
|
|
180
|
-
&__lukkekryss {
|
|
181
|
-
height: 42px;
|
|
182
|
-
width: 42px;
|
|
183
|
-
padding: 0;
|
|
184
|
-
border: 0;
|
|
185
|
-
background-color: transparent;
|
|
186
|
-
cursor: pointer;
|
|
187
|
-
|
|
188
|
-
&:hover,
|
|
189
|
-
&:active {
|
|
190
|
-
background-color: rgba(88, 171, 187, 0.1);
|
|
191
|
-
}
|
|
192
|
-
&:focus {
|
|
193
|
-
box-shadow: 0px 0px 0px 2px $black;
|
|
194
|
-
background-color: rgba(88, 171, 187, 0.1);
|
|
195
|
-
border-radius: 0;
|
|
196
|
-
border: 0;
|
|
197
|
-
outline: none;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
192
|
&__call-to-action {
|
|
202
193
|
display: flex;
|
|
203
194
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type Styles = {
|
|
2
2
|
align: string;
|
|
3
3
|
modal: string;
|
|
4
|
+
modal__afterTitleChildren: string;
|
|
4
5
|
'modal__call-to-action': string;
|
|
5
6
|
'modal__call-to-action--large': string;
|
|
6
7
|
'modal__call-to-action--medium': string;
|
|
@@ -16,17 +17,18 @@ export type Styles = {
|
|
|
16
17
|
'modal__contentWrapper--image': string;
|
|
17
18
|
modal__description: string;
|
|
18
19
|
modal__iconWrapper: string;
|
|
19
|
-
modal__lukkekryss: string;
|
|
20
20
|
modal__shadow: string;
|
|
21
21
|
'modal__shadow--bottom': string;
|
|
22
22
|
'modal__shadow--show': string;
|
|
23
23
|
'modal__shadow--top': string;
|
|
24
24
|
'modal__title--error': string;
|
|
25
|
+
'modal__title--success': string;
|
|
25
26
|
'modal--error': string;
|
|
26
27
|
'modal--image': string;
|
|
27
28
|
'modal--large': string;
|
|
28
29
|
'modal--medium': string;
|
|
29
30
|
'modal--normal': string;
|
|
31
|
+
'modal--success': string;
|
|
30
32
|
'modal--warning': string;
|
|
31
33
|
'modal-overlay': string;
|
|
32
34
|
open: string;
|