@helsenorge/designsystem-react 1.0.1 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Button-0917df8e.js +2 -0
- package/Button-0917df8e.js.map +1 -0
- package/HorizontalScroll-a4634c75.js +2 -0
- package/HorizontalScroll-a4634c75.js.map +1 -0
- package/{Modal-eebb821b.js → Modal-055c753d.js} +2 -2
- package/Modal-055c753d.js.map +1 -0
- package/{Panel-1ce6fe37.js → Panel-f52d1b19.js} +2 -2
- package/Panel-f52d1b19.js.map +1 -0
- package/{TableExpandedRow-44b09912.js → TableExpandedRow-9c134fef.js} +2 -2
- package/TableExpandedRow-9c134fef.js.map +1 -0
- package/{TableExpanderCell-015d3db2.js → TableExpanderCell-c1819f4b.js} +2 -2
- package/TableExpanderCell-c1819f4b.js.map +1 -0
- package/{TableRow-692099ee.js → TableRow-f413aebe.js} +2 -2
- package/TableRow-f413aebe.js.map +1 -0
- package/components/Button/Button.d.ts.map +1 -1
- package/components/Button/index.js +1 -1
- package/components/Button/styles.module.scss +7 -7
- package/components/ButtonWithModal/index.js +1 -1
- package/components/Dropdown/index.js +1 -1
- package/components/Expander/index.js +1 -1
- package/components/FormExample/index.js +1 -1
- package/components/HighlightBox/HighlightBox.d.ts +2 -0
- package/components/HighlightBox/HighlightBox.d.ts.map +1 -1
- package/components/HighlightBox/componentdata.json +19 -0
- package/components/HighlightBox/index.js +1 -1
- package/components/HorizontalScroll/index.js +1 -1
- package/components/HorizontalScroll/styles.module.scss +2 -0
- package/components/Modal/index.js +1 -1
- package/components/NotificationPanel/NotificationPanel.d.ts +7 -19
- package/components/NotificationPanel/NotificationPanel.d.ts.map +1 -1
- package/components/NotificationPanel/componentdata.json +8 -212
- package/components/NotificationPanel/index.js +1 -1
- package/components/Panel/Panel.d.ts.map +1 -1
- package/components/Panel/index.js +1 -1
- package/components/Panel/styles.module.scss +38 -38
- package/components/Panel/styles.module.scss.d.ts +2 -1
- package/components/PanelList/index.js +1 -1
- package/components/Table/TableExpandedRow.js +1 -1
- package/components/Table/TableExpanderCell.js +1 -1
- package/components/Table/TableRow.js +1 -1
- package/components/Table/index.js +1 -1
- package/hooks/useIsVisible.d.ts +2 -1
- package/hooks/useIsVisible.d.ts.map +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/{useIsVisible-27ff4012.js → useIsVisible-2ffbdea2.js} +2 -2
- package/useIsVisible-2ffbdea2.js.map +1 -0
- package/Button-78f848e6.js +0 -2
- package/Button-78f848e6.js.map +0 -1
- package/HorizontalScroll-d65b118a.js +0 -2
- package/HorizontalScroll-d65b118a.js.map +0 -1
- package/Modal-eebb821b.js.map +0 -1
- package/Panel-1ce6fe37.js.map +0 -1
- package/TableExpandedRow-44b09912.js.map +0 -1
- package/TableExpanderCell-015d3db2.js.map +0 -1
- package/TableRow-692099ee.js.map +0 -1
- package/useIsVisible-27ff4012.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as t,d as e}from"./_rollupPluginBabelHelpers-0f007973.js";import{_ as n}from"./_tslib-b219470a.js";import o from"react";import{A as r,I as l}from"./constants-dbdea596.js";import{g as i}from"./color-e7d082c1.js";import"./Icon-d69d65b3.js";import{L as a}from"./Loader-06293a27.js";import{u as s}from"./useHover-18479690.js";import{u as d}from"./useBreakpoint-a74f5af5.js";import{b as u}from"./grid-c105cad1.js";import{c}from"./index-d1c0552c.js";import m from"./components/Button/styles.module.scss";var b={primary:"blueberry",warning:"banana",danger:"cherry"},f=function(t,e){return e<u.md&&t?l.Small:t?l.Medium:l.XSmall},p=o.forwardRef((function(u,p){var v,_,g,h=u.id,j=u.children,y=u.className,w=void 0===y?"":y,E=u.fluid,I=void 0!==E&&E,k=u.intent,N=void 0===k?"primary":k,x=u.inverted,B=void 0!==x&&x,C=u.htmlMarkup,H=void 0===C?"button":C,O=u.type,F=void 0===O?"button":O,M=u.onClick,S=u.large,z=void 0!==S&&S,A=u.loading,L=void 0!==A&&A,R=u.variant,X=void 0===R?"fill":R,P=u.disabled,q=void 0!==P&&P,D=u.ellipsis,G=void 0!==D&&D,J=u.tabIndex,K=u.testId,Q=u.href,T=u.target,U=n(u,["id","children","className","fluid","intent","inverted","htmlMarkup","type","onClick","large","loading","variant","disabled","ellipsis","tabIndex","testId","href","target"]),V=function(t){var e,n,o,r,l=null,i=null;void 0!==(null===(n=null===(e=t[0])||void 0===e?void 0:e.props)||void 0===n?void 0:n.svgIcon)&&(l=t.shift()),void 0!==(null===(r=null===(o=t[t.length-1])||void 0===o?void 0:o.props)||void 0===r?void 0:r.svgIcon)&&(i=t.pop());var a=t.filter((function(t){return t}));return[l,i,a.length>0?a:null]}(o.Children.toArray(j)),W=t(V,3),Y=W[0],Z=W[1],$=W[2],tt=s(p),et=tt.hoverRef,nt=tt.isHovered,ot=function(t,e,n,o,r){return e?i("neutral",600):t&&!o||!t&&o?"white":i(b[n],"warning"!==n||o?r?700:600:r?800:700)}("fill"===X,q,N,B,nt),rt=d(),lt="fill"===X,it="outline"===X,at="borderless"===X,st="warning"===N,dt="danger"===N,ut=!(!Y&&!Z||L),ct=Object.assign({},U),mt=c(m.button,(e(v={},m["button--fluid"],I),e(v,m["button--large"],z),e(v,m["button--warning"],st),e(v,m["button--danger"],dt),e(v,m["button--inverted"],B),e(v,m["button--fill"],lt),e(v,m["button--outline"],it),e(v,m["button--borderless"],at),e(v,m["button--with-icon"],ut),e(v,m["button--ellipsis"],G),v),w),bt=c(m.button__content,(e(_={},m["button__content--warning"],st),e(_,m["button__content--danger"],dt),e(_,m["button__content--fill"],lt),e(_,m["button__content--borderless"],at),e(_,m["button__content--outline"],it),e(_,m["button__content--with-icon"],ut&&!at),e(_,m["button__content--large"],z),e(_,m["button__content--ellipsis"],G),e(_,m["button__content--inverted"],B),e(_,m["button__content--fluid"],I),_)),ft=c(m["button__left-fluid-content"],(e(g={},m["button__left-fluid-content--with-icon"],ut),e(g,m["button__left-fluid-content--large"],z),g));function pt(t,e,n,r){var l=t&&t.props&&t.props.color?t.props.color:n;return t&&Object.keys(t).length>0?o.cloneElement(t,{size:e,color:l,isHovered:r}):null}var vt=function(){return $?o.createElement("span",{className:bt},$):null},_t=function(){return o.createElement("span",{className:m["content-wrapper"]},L?o.createElement("div",{className:m["button__left-fluid-content"]},o.createElement(a,{testId:"test-id-loader",color:"fill"!==X||B?b[N]:"white",size:"tiny"})):o.createElement(o.Fragment,null,I?o.createElement("div",{className:ft},pt(Y,f(z,rt),ot,nt),vt()):o.createElement(o.Fragment,null,pt(Y,f(z,rt),ot,nt),vt()),pt(Z,l.XSmall,ot,nt)))};return o.createElement(o.Fragment,null,"button"===H&&o.createElement("button",Object.assign({id:h,onClick:M,disabled:q,"data-testid":K,"data-analyticsid":r.Button,className:mt,ref:et,tabIndex:J,type:F},ct),_t()),"a"===H&&o.createElement("a",Object.assign({id:h,onClick:M,"data-testid":K,"data-analyticsid":r.Button,className:mt,href:Q,target:T,rel:"_blank"===T?"noopener noreferrer":u.rel,ref:et,tabIndex:J},U),_t()))}));export{p as B,b as i};
|
|
2
|
+
//# sourceMappingURL=Button-0917df8e.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button-0917df8e.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import r,{useRef as o}from"react";import{c as l}from"./index-d1c0552c.js";import{a as e}from"./useIsVisible-2ffbdea2.js";import i from"./components/HorizontalScroll/styles.module.scss";var t=function(t){var a=t.children,n=o(null),c=o(null),s=o(null),m=e(c,1,{root:null==n?void 0:n.current,rootMargin:"3px"},!0),d=e(s,1,{root:null==n?void 0:n.current,rootMargin:"3px"},!0);return r.createElement("div",{className:i.horizontalscroll},r.createElement("div",{className:i.horizontalscroll__viewport,ref:n},r.createElement("div",{className:l(i.horizontalscroll__indicator,i["horizontalscroll__indicator--left"],!m&&i["horizontalscroll__indicator--visible"])}),r.createElement("div",{className:l(i.horizontalscroll__indicator,i["horizontalscroll__indicator--right"],!d&&i["horizontalscroll__indicator--visible"])}),r.createElement("div",{ref:c}),a,r.createElement("div",{ref:s})))};export{t as H};
|
|
2
|
+
//# sourceMappingURL=HorizontalScroll-a4634c75.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HorizontalScroll-a4634c75.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,d as a}from"./_rollupPluginBabelHelpers-0f007973.js";import t,{useEffect as r}from"react";import{c as l}from"./index-d1c0552c.js";import{p as o}from"./palette-f206f488.js";import{B as n}from"./Button-
|
|
2
|
-
//# sourceMappingURL=Modal-
|
|
1
|
+
import{_ as e,d as a}from"./_rollupPluginBabelHelpers-0f007973.js";import t,{useEffect as r}from"react";import{c as l}from"./index-d1c0552c.js";import{p as o}from"./palette-f206f488.js";import{B as n}from"./Button-0917df8e.js";import{I as s}from"./Icon-d69d65b3.js";import{Z as i,A as c,I as m}from"./constants-dbdea596.js";import d from"./components/Modal/styles.module.scss";import{A as u}from"./AlertSignStroke-32f09751.js";import{A as p}from"./AlertSignFill-5df5b7c7.js";import{a as _}from"./useFocusTrap-4a5fb65d.js";import{a as v}from"./useIsVisible-2ffbdea2.js";import{T as f}from"./Title-01820508.js";import{u as E}from"./uuid-11037462.js";import{C as g}from"./Close-08d48540.js";import{C as b}from"./CheckOutline-86cddefd.js";import{P as y}from"./index-28ed5ede.js";var h,N;!function(e){e.normal="normal",e.warning="warning",e.error="error",e.success="success",e.image="image"}(h||(h={})),function(e){e.large="large",e.medium="medium"}(N||(N={}));var C={variant:h.normal,primaryButtonText:"OK",titleId:E(),className:"",size:N.large,zIndex:i.Modal},w=function(e,a){var r=function(e){return e===h.error?t.createElement(s,{size:m.Small,svgIcon:p,color:o.cherry500}):e===h.warning?t.createElement(s,{size:m.Small,svgIcon:u,color:o.black}):e===h.success?t.createElement(s,{size:m.Small,svgIcon:b,color:o.kiwi900}):null}(e);return r?t.createElement("div",{className:d.modal__iconWrapper},r):a?t.createElement("div",{className:d.modal__iconWrapper},t.cloneElement(a,{size:m.Small})):null},B=function(o){var s,i,m,u=t.useState(0),p=e(u,2),E=p[0],b=p[1],N=t.useRef(null),C=t.useRef(null),B=t.useRef(null),j=v(C),I=t.useRef(null),x=v(I),k=B.current&&B.current.scrollHeight>B.current.clientHeight;function T(e){"Escape"===e.key&&o.onClose&&(e.stopPropagation(),o.onClose())}function W(e){e.target&&L.current===e.target&&o.onClose&&(e.stopPropagation(),o.onClose())}var z=o.variant===h.image,L=t.useRef(null),S=o.secondaryButtonText&&(null===(i=o.secondaryButtonText)||void 0===i?void 0:i.length)>0||o.onSuccess,P=o.ariaLabelledBy?void 0:o.ariaLabel,A=o.ariaLabelledBy?o.ariaLabelledBy:o.ariaLabel?void 0:o.titleId;r((function(){var e,a=L.current;return null===(e=N.current)||void 0===e||e.focus(),document.body.style.overflow="hidden",o.disableCloseEvents||!a||S||(a.addEventListener("keydown",T),a.addEventListener("click",W)),function(){document.body.style.removeProperty("overflow"),o.disableCloseEvents||!a||S||(a.removeEventListener("keydown",T),a.removeEventListener("click",W))}}),[]);var M=l(o.className,d.modal,d["modal--".concat(o.variant)],d["modal--".concat(o.size)],k&&!S&&d["modal--no-actions"]),R=l((a(s={},d["modal__title--error"],o.variant===h.error),a(s,d["modal__title--success"],o.variant===h.success),s)),H=t.createElement("div",{"data-testid":"dialog-container"},t.createElement("div",{ref:L,className:d["modal-overlay"],"data-testid":o.testId,"data-analyticsid":c.Modal,style:{zIndex:o.zIndex}},t.createElement("div",{className:d.align,ref:_()},t.createElement("div",{className:M,role:"dialog","aria-label":P,"aria-labelledby":A},t.createElement("div",{tabIndex:E,ref:N,onBlur:function(){return b(-1)}}),t.createElement("div",{className:l(d.modal__shadow,d["modal__shadow--top"],a({},d["modal__shadow--show"],!j&&k))}),t.createElement("div",{className:l(d.modal__contentWrapper,a({},d["modal__contentWrapper--image"],z)),ref:B},!o.noCloseButton&&t.createElement("div",{className:d.modal__closeWrapper},t.createElement("div",{className:l(d.modal__closeWrapper__close)},t.createElement(g,{onClick:o.onClose,ariaLabel:o.ariaLabelCloseBtn}))),t.createElement("div",{className:l(d["modal__contentWrapper__scroll--".concat(o.size)],a({},d["modal__contentWrapper__scroll--image"],z))},t.createElement("div",{ref:C}),t.createElement("div",{className:d.modal__contentWrapper__title},w(o.variant,o.icon),t.createElement(f,{id:A,htmlMarkup:"h3",appearance:"title3",className:R},o.title),o.afterTitleChildren&&t.createElement("div",{className:d.modal__afterTitleChildren},o.afterTitleChildren)),z&&t.createElement("div",null,t.createElement("div",{className:d.modal__contentWrapper__imageWrapper},o.children),t.createElement("span",{className:d.modal__contentWrapper__imageDescription},o.description)),!z&&o.children&&t.createElement("div",null,o.children),!z&&!o.children&&t.createElement("p",{className:d.modal__description},o.description),t.createElement("div",{ref:I}))),t.createElement("div",{className:l(d.modal__shadow,d["modal__shadow--bottom"],a({},d["modal__shadow--show"],!x&&k))}),S&&t.createElement("div",{className:l(d["modal__call-to-action"],d["modal__call-to-action--".concat(o.size)])},o.onSuccess&&t.createElement(n,{onClick:o.onSuccess},o.primaryButtonText),o.secondaryButtonText&&(null===(m=o.secondaryButtonText)||void 0===m?void 0:m.length)>0&&t.createElement(n,{variant:"borderless",onClick:o.onClose},o.secondaryButtonText))))));if(o.printable){var F="print-modal";return t.createElement(y,{className:F,testId:"print-modal"},t.createElement("style",{media:"print"},"body > *:not(.".concat(F,") {display: none;}")),H)}return H};B.defaultProps=C;export{B as M,h as a,N as b};
|
|
2
|
+
//# sourceMappingURL=Modal-055c753d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal-055c753d.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,d as t}from"./_rollupPluginBabelHelpers-0f007973.js";import{_ as a}from"./_tslib-b219470a.js";import n,{useState as l,useRef as o,useEffect as r}from"react";import{c as i}from"./index-d1c0552c.js";import s from"./components/Panel/styles.module.scss";import{T as c}from"./Title-01820508.js";import{B as d}from"./Button-
|
|
2
|
-
//# sourceMappingURL=Panel-
|
|
1
|
+
import{_ as e,d as t}from"./_rollupPluginBabelHelpers-0f007973.js";import{_ as a}from"./_tslib-b219470a.js";import n,{useState as l,useRef as o,useEffect as r}from"react";import{c as i}from"./index-d1c0552c.js";import s from"./components/Panel/styles.module.scss";import{T as c}from"./Title-01820508.js";import{B as d}from"./Button-0917df8e.js";import{A as u,I as m}from"./constants-dbdea596.js";import{I as p}from"./Icon-d69d65b3.js";import{C as f}from"./ChevronDown-2b3daace.js";import{C as v}from"./ChevronUp-dfafe27b.js";import{A as b}from"./ArrowRight-43c97f7a.js";import{A as y}from"./AlertSignFill-5df5b7c7.js";import{p as E}from"./palette-f206f488.js";import{P as g}from"./Pencil-dd3fe667.js";import{C as _}from"./Calendar-a9aa98de.js";import{W as h}from"./Watch-3d5fc351.js";import{u as j,B as k}from"./useBreakpoint-a74f5af5.js";import{u as w}from"./useUuid-3b1e73f2.js";import{u as x}from"./usePrevious-ae293b10.js";import{B as C}from"./Badge-eebcb720.js";var N,I,B;!function(e){e.normal="normal",e.new="new",e.error="error",e.draft="draft"}(N||(N={})),function(e){e.fill="fill",e.white="white",e.stroke="stroke",e.line="line"}(I||(I={})),function(e){e.layout1="layout1",e.layout2="layout2",e.layout3a="layout3a",e.layout3b="layout3b",e.layout3c="layout3c"}(B||(B={}));var T=function(e){var a=e.status,l=e.statusMessage,o=i(s["status-message"],t({},s["status-message--new"],a===N.new));return a!==N.error&&a!==N.draft||!l?null:n.createElement("div",{className:o,"data-testid":"display-status"},n.createElement(p,Object.assign({},a===N.error?{color:E.cherry500,svgIcon:y}:{color:E.black,svgIcon:g},{size:m.XSmall}))," ",n.createElement("span",null,l))},A=function(e){var t=e.date,a=e.time;return t||a?n.createElement("div",{className:s["datetime-container"],"data-testid":"datetime"},t&&n.createElement("div",{className:s["datetime-container__icon"]},n.createElement(p,{svgIcon:_,size:m.XSmall}),n.createElement("span",null,t)),a&&n.createElement("div",{className:s["datetime-container__icon"]},n.createElement(p,{svgIcon:h,size:m.XSmall}),n.createElement("span",null,a))):null},M=n.forwardRef((function(e,t){var l=e.buttonText,o=e.buttonTextClose,r=e.url,i=e.target,s=e.onClick,c=e.renderAsExpander,u=e.isExpanded,m=e.buttonHtmlMarkup,y=void 0===m?"a":m,E=a(e,["buttonText","buttonTextClose","url","target","onClick","renderAsExpander","isExpanded","buttonHtmlMarkup"]);return c?n.createElement(d,Object.assign({testId:"expand",ref:t,onClick:s},E,{"aria-expanded":u}),u?o:l,n.createElement(p,{svgIcon:u?v:f})):n.createElement(d,Object.assign({testId:"url",ref:t,htmlMarkup:y,onClick:s,href:r,target:i},E),l,n.createElement(p,{svgIcon:b}))})),S=n.forwardRef((function(a,d){var m,p,f,v,b,y,E,g=a.children,_=a.contentA,h=a.contentB,S=a.className,P=a.testId,H=a.title,O=a.titleHtmlMarkup,R=void 0===O?"h2":O,z=a.url,D=a.target,X=void 0===D?"_self":D,U=a.icon,W=a.iconRight,F=void 0!==W&&W,K=a.variant,q=void 0===K?I.fill:K,G=a.status,J=void 0===G?N.normal:G,L=a.statusMessage,Q=a.buttonText,V=void 0===Q?"Se detaljer":Q,Y=a.buttonTextClose,Z=void 0===Y?"Skjul detaljer":Y,$=a.showCloseButtonInExpand,ee=void 0===$||$,te=a.layout,ae=void 0===te?B.layout2:te,ne=a.containerAsButton,le=void 0!==ne&&ne,oe=a.date,re=a.time,ie=a.noTopBorder,se=a.buttonOnClick,ce=a.buttonHtmlMarkup,de=a.expanded,ue=void 0!==de&&de,me=a.onExpand,pe=l(ue),fe=e(pe,2),ve=fe[0],be=fe[1],ye=x(ve),Ee=o(null),ge=w(),_e=j();r((function(){ue!==ve&&be(ue)}),[ue]),r((function(){me&&ve!==!!ye&&me(ve)}),[ve,me]);var he=[B.layout3a.toString(),B.layout3b.toString(),B.layout3c.toString()].includes(ae),je=i(s["panel-wrapper"],S),ke=i(s.panel,(t(m={},s["panel--fill"],q===I.fill),t(m,s["panel--stroke"],q===I.stroke),t(m,s["panel--white"],q===I.white),t(m,s["panel--line"],q===I.line),t(m,s["panel--no-top-border"],q===I.line&&ie),t(m,s["panel--selected"],ve),t(m,s["panel--new"],J===N.new),t(m,s["panel--draft"],J===N.draft),t(m,s["panel--error"],J===N.error),t(m,s["panel--status"],J&&J!==N.normal),t(m,s["panel--with-icon"],U),t(m,s["panel--button"],le),t(m,s["panel--clickable"],g||z||me||se||le),m)),we=i((t(p={},s.panel__container,ae===B.layout2&&h),t(p,s["panel__container--layout3"],he&&h),t(p,s["panel__container--grow"],U),p)),xe=i((t(f={},s["panel-content-a"],ae===B.layout2),t(f,s["panel-content-a--layout3a"],ae===B.layout3a),t(f,s["panel-content-a--layout3b"],ae===B.layout3b),t(f,s["panel-content-a--layout3c"],ae===B.layout3c),f)),Ce=i((t(v={},s["panel__content-right--layout1"],h&&ae===B.layout1),t(v,s["panel__content-right--layout2"],h&&ae===B.layout2),t(v,s["panel__content-right--layout3"],h&&he),t(v,s["panel__content-right--layout3a"],h&&ae===B.layout3a),t(v,s["panel__content-right--layout3b"],h&&ae===B.layout3b),t(v,s["panel__content-right--layout3c"],h&&ae===B.layout3c),v)),Ne=i(s["panel-details"],(t(b={},s["panel-details--open"],ve),t(b,s["panel-details--line"],q===I.line),t(b,s["panel-details--white"],q===I.white),t(b,s["panel-details--with-icon"],U),b)),Ie=i(s["panel-content-b"],(t(y={},s["panel-content-b--layout1"],ae===B.layout1),t(y,s["panel-content-b--layout3"],he),y)),Be=i(s["panel__details-btn"]),Te=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1?arguments[1]:void 0,a={id:t,tabIndex:e?void 0:-1,variant:"borderless",ellipsis:!0};return n.createElement(M,Object.assign({renderAsExpander:!!g,onClick:se||function(){return be(!ve)},isExpanded:ve,buttonText:V,url:z,target:X,buttonTextClose:Z,ref:t?Ee:void 0,buttonHtmlMarkup:ce},a))},Ae=i(s["panel__btn-container"],(t(E={},s["panel__btn-container--layout3"],he),t(E,s["panel__btn-container--padding-top"],h),E));return n.createElement("div",{ref:d,"data-testid":P,className:je,"data-analyticsid":u.Panel},n.createElement("div",{className:ke,tabIndex:le?0:void 0,onClick:function(){var e;le&&(null===(e=Ee.current)||void 0===e||e.click())},onKeyDown:function(e){var t,a=e.key;!le||"Enter"!==a&&" "!==a||(e.preventDefault(),null===(t=Ee.current)||void 0===t||t.click())},"aria-labelledby":le?ge:void 0,role:le?"button":void 0},U&&!F&&n.createElement("div",{className:s.panel__icon},U),n.createElement("div",{className:we},n.createElement("div",{className:xe},n.createElement(T,{status:J,statusMessage:L}),H&&n.createElement("div",{className:s["panel-content-a__title-container"]},n.createElement(c,{appearance:"title3",htmlMarkup:R},H),L&&J===N.new&&n.createElement("div",null,n.createElement(C,{color:"blueberry",testId:"badge-status"},L))),_,_e>=k.lg&&n.createElement(A,{date:oe,time:re})),n.createElement("div",{className:Ce},h&&n.createElement("div",{className:Ie},h),(g||z||oe||re||se)&&n.createElement("div",{className:Ae},_e<k.lg&&n.createElement(A,{date:oe,time:re}),(g||z||se)&&n.createElement("div",{className:Be},Te(!le,ge))))),U&&F&&n.createElement("div",{className:s["panel__icon--right"]},U)),g&&n.createElement("div",{className:Ne,"data-testid":"panel-details"},n.createElement("div",null,g),ee&&n.createElement("div",{className:Be},Te())))}));export{S as P,N as a,I as b,B as c};
|
|
2
|
+
//# sourceMappingURL=Panel-f52d1b19.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Panel-f52d1b19.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as e}from"./_rollupPluginBabelHelpers-0f007973.js";import a from"react";import{c as t}from"./index-d1c0552c.js";import r from"./components/Table/styles.module.scss";import{B as o}from"./Button-
|
|
2
|
-
//# sourceMappingURL=TableExpandedRow-
|
|
1
|
+
import{d as e}from"./_rollupPluginBabelHelpers-0f007973.js";import a from"react";import{c as t}from"./index-d1c0552c.js";import r from"./components/Table/styles.module.scss";import{B as o}from"./Button-0917df8e.js";import{I as n}from"./Icon-d69d65b3.js";import"./constants-dbdea596.js";import{C as s}from"./ChevronUp-dfafe27b.js";var l=function(l){var d=l.numberOfColumns,m=l.expanded,c=l.hideDetailsText,p=l.toggleClick,i=l.children,b=l.className,f=t(r["table__expanded-row"],e({},r["table__expanded-row--expanded"],m),b),_=t(r.table__cell,b),x=t(r["table__expanded-row-container"],e({},r["table__expanded-row-container--expanded"],m));return a.createElement("tr",{className:f},a.createElement("td",{colSpan:d,className:_},a.createElement("div",{className:x},i,a.createElement(o,{className:r["table__expanded-row-button"],variant:"borderless",onClick:p,tabIndex:m?0:-1},c,a.createElement(n,{svgIcon:s})))))};export{l as T};
|
|
2
|
+
//# sourceMappingURL=TableExpandedRow-9c134fef.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableExpandedRow-9c134fef.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import{c as a}from"./index-d1c0552c.js";import r from"./components/Table/styles.module.scss";import{I as o}from"./Icon-d69d65b3.js";import"./constants-dbdea596.js";import{B as t}from"./Button-
|
|
2
|
-
//# sourceMappingURL=TableExpanderCell-
|
|
1
|
+
import e from"react";import{c as a}from"./index-d1c0552c.js";import r from"./components/Table/styles.module.scss";import{I as o}from"./Icon-d69d65b3.js";import"./constants-dbdea596.js";import{B as t}from"./Button-0917df8e.js";import{C as s}from"./ChevronDown-2b3daace.js";import{C as l}from"./ChevronUp-dfafe27b.js";import{p as m}from"./palette-f206f488.js";var n=function(n){var c=n.expandableRowId,d=n.hideDetailsText,i=n.showDetailsText,p=n.expanded,f=n.className,b=a(r.table__cell,r["table__cell-expander"],f),x=p?l:s;return e.createElement("td",{className:b,"aria-controls":c,"aria-label":p?d:i},e.createElement(t,{variant:"borderless","aria-expanded":p,"aria-controls":c,"aria-label":p?d:i},e.createElement(o,{svgIcon:x,color:m.blueberry500})))};export{n as T};
|
|
2
|
+
//# sourceMappingURL=TableExpanderCell-c1819f4b.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableExpanderCell-c1819f4b.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as e}from"./_rollupPluginBabelHelpers-0f007973.js";import a from"react";import{c as l}from"./index-d1c0552c.js";import o from"./components/Table/styles.module.scss";import{B as t}from"./Button-
|
|
2
|
-
//# sourceMappingURL=TableRow-
|
|
1
|
+
import{d as e}from"./_rollupPluginBabelHelpers-0f007973.js";import a from"react";import{c as l}from"./index-d1c0552c.js";import o from"./components/Table/styles.module.scss";import{B as t}from"./Button-0917df8e.js";import{I as r}from"./Icon-d69d65b3.js";import"./constants-dbdea596.js";import{C as n}from"./ChevronUp-dfafe27b.js";import{C as s}from"./ChevronDown-2b3daace.js";var d=function(d){var m,i=d.rowKey,c=d.hideDetailsText,p=d.showDetailsText,b=d.expandable,x=d.expanded,f=d.onClick,_=d.className,u=d.children,j=l(o["table-row"],(e(m={},o["table__row--expandable"],b),e(m,o["table__row--expanded"],x),m),_),v=null;if(b){var C=l(o.table__cell,o["table__expander-cell-mobile"],e({},o["table__expander-cell-mobile--expanded"],x)),w=l(o["table__expander-button-mobile"],e({},o["table__expander-button-mobile--expanded"],x));v=a.createElement("td",{key:"expandableMobile",className:C},a.createElement(t,{"aria-expanded":x,variant:"borderless",className:w,onClick:function(){f&&f()}},a.createElement(r,{svgIcon:x?n:s})," ",x?c:p))}return a.createElement("tr",{className:j,onClick:f,key:i},u,v)};export{d as T};
|
|
2
|
+
//# sourceMappingURL=TableRow-f413aebe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableRow-f413aebe.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAe,MAAM,iBAAiB,CAAC;AAahF,oBAAY,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC7D,oBAAY,mBAAmB,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAC1F,oBAAY,UAAU,GAAG,QAAQ,GAAG,GAAG,CAAC;AACxC,oBAAY,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,YAAY,CAAC;AAE/D,UAAU,aAAa;IACrB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,OAAO,EAAE,mBAAmB,CAAC;IAC7B,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED,eAAO,MAAM,aAAa,EAAE,aAI3B,CAAC;AAEF,MAAM,WAAW,WAAY,SAAQ,eAAe,EAAE,eAAe;IACnE,sCAAsC;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,sCAAsC;IACtC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oDAAoD;IACpD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,mCAAmC;IACnC,IAAI,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7D,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IACvI,uDAAuD;IACvD,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAe,MAAM,iBAAiB,CAAC;AAahF,oBAAY,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC7D,oBAAY,mBAAmB,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAC1F,oBAAY,UAAU,GAAG,QAAQ,GAAG,GAAG,CAAC;AACxC,oBAAY,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,YAAY,CAAC;AAE/D,UAAU,aAAa;IACrB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,OAAO,EAAE,mBAAmB,CAAC;IAC7B,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED,eAAO,MAAM,aAAa,EAAE,aAI3B,CAAC;AAEF,MAAM,WAAW,WAAY,SAAQ,eAAe,EAAE,eAAe;IACnE,sCAAsC;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,sCAAsC;IACtC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oDAAoD;IACpD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,mCAAmC;IACnC,IAAI,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7D,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IACvI,uDAAuD;IACvD,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAgBD,QAAA,MAAM,MAAM,2GAmKV,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{B as default,i as intentToColor}from"../../Button-
|
|
1
|
+
export{B as default,i as intentToColor}from"../../Button-0917df8e.js";import"../../_rollupPluginBabelHelpers-0f007973.js";import"../../_tslib-b219470a.js";import"react";import"../../constants-dbdea596.js";import"../../color-e7d082c1.js";import"../../index-d1c9177a.js";import"../../palette-f206f488.js";import"../../grid-c105cad1.js";import"../../Icon-d69d65b3.js";import"../../index-d1c0552c.js";import"../../useUuid-3b1e73f2.js";import"../../uuid-11037462.js";import"../../Loader-06293a27.js";import"../Loader/styles.module.scss";import"../../useHover-18479690.js";import"../../useBreakpoint-a74f5af5.js";import"./styles.module.scss";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -193,8 +193,8 @@ $invertedHoverColor: #ffffff0d; //$white + '0D';
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
&--outline#{&}--warning {
|
|
196
|
-
border-color: $
|
|
197
|
-
color: $
|
|
196
|
+
border-color: $banana700;
|
|
197
|
+
color: $banana800;
|
|
198
198
|
|
|
199
199
|
&:hover,
|
|
200
200
|
&:active,
|
|
@@ -269,7 +269,7 @@ $invertedHoverColor: #ffffff0d; //$white + '0D';
|
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
&--borderless#{&}--warning {
|
|
272
|
-
color: $
|
|
272
|
+
color: $banana800;
|
|
273
273
|
}
|
|
274
274
|
&--borderless#{&}--danger {
|
|
275
275
|
color: $cherry600;
|
|
@@ -367,7 +367,7 @@ $invertedHoverColor: #ffffff0d; //$white + '0D';
|
|
|
367
367
|
}
|
|
368
368
|
|
|
369
369
|
&--borderless {
|
|
370
|
-
color: $
|
|
370
|
+
color: $blueberry600;
|
|
371
371
|
border-bottom: 1px solid transparent;
|
|
372
372
|
|
|
373
373
|
#{$button}:hover &,
|
|
@@ -377,7 +377,7 @@ $invertedHoverColor: #ffffff0d; //$white + '0D';
|
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
&--borderless#{&}--warning {
|
|
380
|
-
color: $
|
|
380
|
+
color: $banana800;
|
|
381
381
|
|
|
382
382
|
#{$button}:hover &,
|
|
383
383
|
#{$button}:active &,
|
|
@@ -405,10 +405,10 @@ $invertedHoverColor: #ffffff0d; //$white + '0D';
|
|
|
405
405
|
}
|
|
406
406
|
|
|
407
407
|
&--outline {
|
|
408
|
-
color: $
|
|
408
|
+
color: $blueberry600;
|
|
409
409
|
}
|
|
410
410
|
&--outline#{&}--warning {
|
|
411
|
-
color: $
|
|
411
|
+
color: $banana800;
|
|
412
412
|
}
|
|
413
413
|
&--outline#{&}--danger {
|
|
414
414
|
color: $cherry500;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as t}from"../../_rollupPluginBabelHelpers-0f007973.js";import s,{useState as e}from"react";import{B as o}from"../../Button-
|
|
1
|
+
import{_ as t}from"../../_rollupPluginBabelHelpers-0f007973.js";import s,{useState as e}from"react";import{B as o}from"../../Button-0917df8e.js";import{M as r}from"../../Modal-055c753d.js";import"../../_tslib-b219470a.js";import"../../constants-dbdea596.js";import"../../color-e7d082c1.js";import"../../index-d1c9177a.js";import"../../palette-f206f488.js";import"../../grid-c105cad1.js";import"../../Icon-d69d65b3.js";import"../../index-d1c0552c.js";import"../../useUuid-3b1e73f2.js";import"../../uuid-11037462.js";import"../../Loader-06293a27.js";import"../Loader/styles.module.scss";import"../../useHover-18479690.js";import"../../useBreakpoint-a74f5af5.js";import"../Button/styles.module.scss";import"../Modal/styles.module.scss";import"../../AlertSignStroke-32f09751.js";import"../../AlertSignFill-5df5b7c7.js";import"../../useFocusTrap-4a5fb65d.js";import"../../useIsVisible-2ffbdea2.js";import"../../Title-01820508.js";import"../Title/styles.module.scss";import"../../Close-08d48540.js";import"../../X-867957f2.js";import"../Close/styles.module.scss";import"../../CheckOutline-86cddefd.js";import"../../index-28ed5ede.js";import"react-dom";var i=s.forwardRef((function(i,m){var d=e(!1),p=t(d,2),l=p[0],a=p[1];return s.createElement("div",{"data-testid":i.testId},s.createElement(o,{onClick:function(){return a(!0)}},i.buttonText),l&&s.createElement(r,Object.assign({},i,{onClose:function(){return a(!1)}})))}));export{i as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,d as o}from"../../_rollupPluginBabelHelpers-0f007973.js";import r,{useRef as t,useState as n}from"react";import{c as a}from"../../index-d1c0552c.js";import{I as l}from"../../Icon-d69d65b3.js";import{K as d,A as s,I as i}from"../../constants-dbdea596.js";import{t as c}from"../../index-d1c9177a.js";import"../../useBreakpoint-a74f5af5.js";import{u}from"../../useHover-18479690.js";import{a as p,u as m,b as f,c as _}from"../../useOutsideEvent-fb86686d.js";import{u as v}from"../../useUuid-3b1e73f2.js";import b from"./styles.module.scss";import{P as g}from"../../PlusSmall-430bf03a.js";import{B as w}from"../../Button-
|
|
1
|
+
import{_ as e,d as o}from"../../_rollupPluginBabelHelpers-0f007973.js";import r,{useRef as t,useState as n}from"react";import{c as a}from"../../index-d1c0552c.js";import{I as l}from"../../Icon-d69d65b3.js";import{K as d,A as s,I as i}from"../../constants-dbdea596.js";import{t as c}from"../../index-d1c9177a.js";import"../../useBreakpoint-a74f5af5.js";import{u}from"../../useHover-18479690.js";import{a as p,u as m,b as f,c as _}from"../../useOutsideEvent-fb86686d.js";import{u as v}from"../../useUuid-3b1e73f2.js";import b from"./styles.module.scss";import{P as g}from"../../PlusSmall-430bf03a.js";import{B as w}from"../../Button-0917df8e.js";import"../../_tslib-b219470a.js";import"../../palette-f206f488.js";import"../../grid-c105cad1.js";import"../../usePrevious-ae293b10.js";import"../../uuid-11037462.js";import"../../color-e7d082c1.js";import"../../Loader-06293a27.js";import"../Loader/styles.module.scss";import"../Button/styles.module.scss";var y;!function(e){e.onwhite="onwhite",e.ongrey="ongrey",e.onblueberry="onblueberry",e.oncherry="oncherry"}(y||(y={}));var h=function(h){var j,E=h.label,k=h.placeholder,x=h.closeText,N=void 0===x?"Lukk":x,I=h.noCloseButton,B=void 0!==I&&I,H=h.onToggle,A=h.open,C=void 0!==A&&A,D=h.children,P=h.mode,L=void 0===P?y.onwhite:P,U=h.transparent,R=void 0!==U&&U,S=h.fluid,T=void 0!==S&&S,z=h.testId,K=h.disabled,O=t(null),V=t(null),X=u(),q=X.hoverRef,F=X.isHovered,G=p(!K&&C,H),J=G.value,M=G.toggleValue,Q=t(r.Children.map(D,(function(){return r.createRef()}))),W=n(),Y=e(W,2),Z=Y[0],$=Y[1],ee=(m(q)||{}).width,oe=v(),re=v(),te=v(),ne=function(){var e;M(),null===(e=V.current)||void 0===e||e.focus()},ae=function(){var e;M(),null===(e=q.current)||void 0===e||e.focus()};f("keydown",O,[d.ArrowDown,d.ArrowUp,d.End,d.Enter,d.Escape,d.Home],(function(e){var o;if(e.preventDefault(),Q.current)if(J)if(e.key===d.Escape&&J)ae();else{var r=Q.current.findIndex((function(o){return o.current===e.target})),t=r;e.key===d.Home?t=0:e.key===d.End?t=Q.current.length-1:e.key===d.ArrowDown&&r<Q.current.length-1?t=r+1:e.key===d.ArrowUp&&r>0?t=r-1:e.key===d.Enter&&-1!==r&&(t=r),-1!==t&&(null===(o=Q.current[t].current)||void 0===o||o.focus(),$(t))}else ne()})),_(O,(function(){return J&&ae()}));var le=a(b.dropdown__toggle,!K&&(o(j={},b["dropdown__toggle--on-white"],L===y.onwhite),o(j,b["dropdown__toggle--on-grey"],L===y.ongrey),o(j,b["dropdown__toggle--on-blueberry"],L===y.onblueberry),o(j,b["dropdown__toggle--on-cherry"],L===y.oncherry),o(j,b["dropdown__toggle--transparent"],R),o(j,b["dropdown__toggle--fluid"],T),o(j,b["dropdown__toggle--open"],J),j)),de=a(b.dropdown__content,J&&b["dropdown__content--open"]);return r.createElement("div",{className:b.dropdown,ref:O},r.createElement("span",{id:oe,className:b.dropdown__label},E),r.createElement("button",{type:"button",onClick:function(){return!J&&ne()},className:le,ref:q,"data-testid":z,"data-analyticsid":s.Dropdown,disabled:K,"aria-labelledby":re,"aria-haspopup":"listbox","aria-expanded":J},r.createElement("span",{id:re,className:b.dropdown__toggle__label},k),r.createElement(l,{color:K?c.palette.neutral500:c.palette.blueberry600,svgIcon:g,className:b.dropdown__icon,isHovered:F,size:i.XSmall})),r.createElement("div",{className:de,style:{width:T?"100%":"".concat(ee,"px")}},r.createElement("ul",{className:b.dropdown__options,role:"listbox","aria-labelledby":oe,tabIndex:-1,"aria-activedescendant":void 0!==Z?"".concat(te,"-").concat(Z):void 0,ref:V},r.Children.map(D,(function(e,o){var t;return r.createElement("li",{className:b.dropdown__input,role:"option",id:"".concat(te,"-").concat(o)},r.cloneElement(e,{ref:null===(t=Q.current)||void 0===t?void 0:t[o]}))}))),!B&&r.createElement("div",{className:b.dropdown__close},r.createElement(w,{onClick:ae,fluid:!0,"aria-expanded":J},N))))};export{y as DropdownMode,h as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e}from"../../_rollupPluginBabelHelpers-0f007973.js";import t,{useState as a,useRef as r,useEffect as n}from"react";import{I as o}from"../../Icon-d69d65b3.js";import{Z as s,A as i,I as d}from"../../constants-dbdea596.js";import{u as c}from"../../useHover-18479690.js";import{u as l}from"../../usePrevious-ae293b10.js";import p from"./styles.module.scss";import{c as m}from"../../index-d1c0552c.js";import{C as _}from"../../ChevronDown-2b3daace.js";import{C as u}from"../../ChevronUp-dfafe27b.js";import{B as x}from"../../Button-
|
|
1
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-0f007973.js";import t,{useState as a,useRef as r,useEffect as n}from"react";import{I as o}from"../../Icon-d69d65b3.js";import{Z as s,A as i,I as d}from"../../constants-dbdea596.js";import{u as c}from"../../useHover-18479690.js";import{u as l}from"../../usePrevious-ae293b10.js";import p from"./styles.module.scss";import{c as m}from"../../index-d1c0552c.js";import{C as _}from"../../ChevronDown-2b3daace.js";import{C as u}from"../../ChevronUp-dfafe27b.js";import{B as x}from"../../Button-0917df8e.js";import{a as f}from"../../useSticky-432642c9.js";import"../../_tslib-b219470a.js";import"../../useUuid-3b1e73f2.js";import"../../uuid-11037462.js";import"../../color-e7d082c1.js";import"../../index-d1c9177a.js";import"../../palette-f206f488.js";import"../../grid-c105cad1.js";import"../../Loader-06293a27.js";import"../Loader/styles.module.scss";import"../../useBreakpoint-a74f5af5.js";import"../Button/styles.module.scss";var g;!function(e){e.small="small",e.large="large"}(g||(g={}));var v=function(v){var j=v.title,b=v.children,E=v.size,y=void 0===E?g.small:E,I=v.color,h=v.svgIcon,k=v.expanded,N=void 0!==k&&k,C=v.noNestedLine,H=void 0!==C&&C,z=v.sticky,B=void 0!==z&&z,w=v.testId,L=v.onExpand,S=a(N),W=e(S,2),X=W[0],P=W[1],T=l(X),U=r(null),A=r(null),D=r(null),O=c(A).isHovered,Z=f(U,A),q=Z.isOutsideWindow,F=Z.isLeavingWindow,G=Z.offsetHeight,J=Z.contentWidth,K=B&&X&&q;n((function(){N!==X&&P(N)}),[N]),n((function(){L&&X!==!!T&&L(X)}),[X,L]);var M=function(e){return t.createElement("span",{className:m(p.expander__icon,p["expander__icon--".concat(e)])},t.createElement(o,{svgIcon:X?u:_,size:d.XSmall,isHovered:O}))},Q=m(p.expander__trigger,p["expander__trigger--".concat(y)],y===g.large&&p["expander__trigger--".concat(I||"neutral")],y===g.large&&h&&p["expander__trigger--icon"],X&&p["expander__trigger--expanded"],K&&!F&&p["expander__trigger--sticky"],K&&F&&p["expander__trigger--absolute"]),R=m(p.expander__button,X&&p["expander__button--expanded"],K&&!F&&p["expander__button--sticky"],K&&F&&p["expander__button--absolute"]),V=m(p.expander__content,p["expander__content--".concat(y)],y===g.large&&p["expander__content--".concat(I||"neutral")],y===g.large&&h&&p["expander__content--icon"],X&&p["expander__content--expanded"],y===g.small&&!H&&p["expander__content--nested-line"]);return t.createElement("div",{className:p.expander,ref:U,style:{paddingTop:K&&G?"".concat(G,"px"):void 0}},y===g.large?t.createElement("button",{type:"button",className:Q,style:{zIndex:O||K?s.ExpanderTrigger:void 0,width:K&&J?"".concat(J,"px"):void 0},"aria-expanded":X,ref:A,onClick:function(){return P(!X)},"data-testid":w,"data-analyticsid":i.Expander},y===g.small&&M("left"),h&&t.createElement("span",{className:m(p.expander__icon,p["expander__icon--left"])},t.createElement(o,{svgIcon:h,size:d.XSmall,isHovered:O})),j,y===g.large&&M("right")):t.createElement(x,{variant:"borderless",className:R,"aria-expanded":X,ref:A,onClick:function(){return P(!X)},testId:w,"data-analyticsid":i.Expander},t.createElement(o,{svgIcon:X?u:_,size:d.XSmall}),j),t.createElement("div",{className:V,ref:D},b))};export{g as ExpanderSize,v as default};
|
|
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 a,useMemo as u,isValidElement as o}from"react";import{V as s}from"../../Validation-087d9955.js";import{F as c}from"../../FormGroup-c32db99d.js";import{C as l}from"../../Checkbox-b0815d04.js";import{B as f}from"../../Button-78f848e6.js";import{R as d}from"../../RadioButton-3ce7a88d.js";import{T as v}from"../../Textarea-56a24cb9.js";import{I as m}from"../../Input-9ccf3867.js";import{H as g}from"../../Hospital-e9e6a0b3.js";import{F as p,a as b}from"../../FormLayout-1a6866fe.js";import"../../index-d1c0552c.js";import"../Validation/styles.module.scss";import"../../constants-dbdea596.js";import"../../_rollupPluginBabelHelpers-0f007973.js";import"../FormGroup/styles.module.scss";import"../../Title-01820508.js";import"../Title/styles.module.scss";import"../../uuid-11037462.js";import"../../Check-fdf95f67.js";import"../../Icon-d69d65b3.js";import"../../_tslib-b219470a.js";import"../../useUuid-3b1e73f2.js";import"../../color-e7d082c1.js";import"../../index-d1c9177a.js";import"../../palette-f206f488.js";import"../../grid-c105cad1.js";import"../Checkbox/styles.module.scss";import"../../Loader-06293a27.js";import"../Loader/styles.module.scss";import"../../useHover-18479690.js";import"../../useBreakpoint-a74f5af5.js";import"../Button/styles.module.scss";import"../RadioButton/styles.module.scss";import"../Textarea/styles.module.scss";import"../Input/styles.module.scss";import"../FormLayout/styles.module.scss";var y=function(r){return r instanceof HTMLElement},h="blur",j="change",O="input",V="onBlur",k="onChange",E="onSubmit",A="onTouched",x="all",w="max",S="min",D="maxLength",F="minLength",R="pattern",C="required",N="validate";var B=function(r){return null==r},L=function(r){return"object"==typeof r},I=function(r){return!B(r)&&!Array.isArray(r)&&L(r)&&!(r instanceof Date)},T=function(r){return/^\w*$/.test(r)},q=function(r){return r.filter(Boolean)},M=function(r){return q(r.replace(/["|']/g,"").replace(/\[/g,".").replace(/\]/g,"").split("."))};function H(r,e,t){for(var n=-1,i=T(e)?[e]:M(e),a=i.length,u=a-1;++n<a;){var o=i[n],s=t;if(n!==u){var c=r[o];s=I(c)||Array.isArray(c)?c:isNaN(+i[n+1])?{}:[]}r[o]=s,r=r[o]}return r}var W=function(r,e){for(var t in void 0===e&&(e={}),r)T(t)?e[t]=r[t]:H(e,t,r[t]);return e},_=function(r){return void 0===r},P=function(r,e,t){void 0===r&&(r={});var n=q(e.split(/[,[\].]+?/)).reduce((function(r,e){return B(r)?r:r[e]}),r);return _(n)||n===r?_(r[e])?t:r[e]:n},U=function(r,e){y(r)&&r.removeEventListener&&(r.removeEventListener(O,e),r.removeEventListener(j,e),r.removeEventListener(h,e))},G={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}),G):G},z=function(r){return"radio"===r.type},J=function(r){return"file"===r.type},K=function(r){return"checkbox"===r.type},Q=function(r){return"select-multiple"===r.type},X={value:!1,isValid:!1},Y={value:!0,isValid:!0},Z=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&&!_(a.value)?_(i)||""===i?Y:{value:i,isValid:!0}:Y:X}return X};function rr(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,d=u.valueAsDate,v=u.setValueAs;if(c&&n)return;return J(l)?l.files:z(l)?$(u.options).value:Q(l)?(a=l.options,[].concat(a).filter((function(r){return r.selected})).map((function(r){return r.value}))):K(l)?Z(u.options).value:i?s:f?""===s?NaN:+s:d?l.valueAsDate:v?v(s):s}if(t)return P(t.current,e)}function er(r){return!r||r instanceof HTMLElement&&r.nodeType!==Node.DOCUMENT_NODE&&er(r.parentNode)}var tr=function(r){return I(r)&&!Object.keys(r).length},nr=function(r){return"boolean"==typeof r};function ir(r,e){var t,n=T(e)?[e]:M(e),i=1==n.length?r:function(r,e){for(var t=e.slice(0,-1).length,n=0;n<t;)r=_(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&&(I(s)&&tr(s)||Array.isArray(s)&&!s.filter((function(r){return I(r)&&!tr(r)||nr(r)})).length)&&(t?delete t[f]:delete r[f]),t=s}}return r}var ar=function(r,e){return r&&r.ref===e};var ur=function(r){return B(r)||!L(r)};function or(r,e){if(ur(r)||ur(e))return e;for(var t in e){var n=r[t],i=e[t];try{r[t]=I(n)&&I(i)||Array.isArray(n)&&Array.isArray(i)?or(n,i):i}catch(r){}}return r}function sr(r,e,t){if(ur(r)||ur(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((I(c)||Array.isArray(c))&&(I(l)||Array.isArray(l))?!sr(c,l,t):c!==l)return!1}}}return!0}function cr(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]=[],cr(r[u][o],P(e[u]||{},o,[]),t[u][o],t[u],o)):sr(P(e[u]||{},o),r[u][o])?H(t[u]||{},o):t[u]=Object.assign(Object.assign({},t[u]),((a={})[o]=!0,a));n&&!t.length&&delete n[i]}return t}var lr=function(r){return"string"==typeof r},fr=function(r,e,t,n,i){var a={},u=function(e){(_(i)||(lr(i)?e.startsWith(i):Array.isArray(i)&&i.find((function(r){return e.startsWith(r)}))))&&(a[e]=rr(r,e,void 0,n))};for(var o in r.current)u(o);return t?W(a):or(e,W(a))},dr=function(r){return r instanceof RegExp},vr=function(r){return I(r)&&!dr(r)?r:{value:r,message:""}},mr=function(r){return"function"==typeof r},gr=function(r){return lr(r)||o(r)};function pr(r,e,t){if(void 0===t&&(t="validate"),gr(r)||nr(r)&&!r)return{type:t,message:gr(r)?r:"",ref:e}}var br=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))}):{}},yr=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,d=t.pattern,v=t.validate,m=i.name,g={},p=z(i),b=K(i),y=p||b,h=""===a,j=br.bind(null,m,e,g),O=function(r,e,t,n,a){void 0===n&&(n=D),void 0===a&&(a=F);var u=r?e:t;g[m]=Object.assign({type:r?n:a,message:u,ref:i},j(r?n:a,u))};if(o&&(!p&&!b&&(h||B(a))||nr(a)&&!a||b&&!Z(u).isValid||p&&!$(u).isValid)){var V=gr(o)?{value:!!o,message:o}:vr(o),k=V.value,E=V.message;if(k&&(g[m]=Object.assign({type:C,message:E,ref:y?((r.current[m].options||[])[0]||{}).ref:i},j(C,E)),!e))return g}if(!(B(l)&&B(f)||""===a)){var A,x,L=vr(f),T=vr(l);if(isNaN(a)){var q=i.valueAsDate||new Date(a);lr(L.value)&&(A=q>new Date(L.value)),lr(T.value)&&(x=q<new Date(T.value))}else{var M=i.valueAsNumber||parseFloat(a);B(L.value)||(A=M>L.value),B(T.value)||(x=M<T.value)}if((A||x)&&(O(!!A,L.message,T.message,w,S),!e))return g}if(lr(a)&&!h&&(s||c)){var H=vr(s),W=vr(c),_=!B(H.value)&&a.length>H.value,P=!B(W.value)&&a.length<W.value;if((_||P)&&(O(_,H.message,W.message),!e))return g}if(lr(a)&&d&&!h){var U=vr(d),G=U.value,J=U.message;if(dr(G)&&!G.test(a)&&(g[m]=Object.assign({type:R,message:J,ref:i},j(R,J)),!e))return g}if(v){var Q=rr(r,m,n,!1,!0),X=y&&u?u[0].ref:i;if(mr(v)){var Y=pr(await v(Q),X);if(Y&&(g[m]=Object.assign(Object.assign({},Y),j(N,Y.message)),!e))return g}else if(I(v)){for(var er={},ir=0,ar=Object.entries(v);ir<ar.length;ir+=1){var ur=ar[ir],or=ur[0],sr=ur[1];if(!tr(er)&&!e)break;var cr=pr(await sr(Q),X,or);cr&&(er=Object.assign(Object.assign({},cr),j(or,cr.message)),e&&(g[m]=er))}if(!tr(er)&&(g[m]=Object.assign({ref:X},er),!e))return g}}return g},hr=function(r,e,t){for(var n in void 0===t&&(t=[]),e){var i=r+(I(e)?"."+n:"["+n+"]");ur(e[n])?t.push(i):hr(i,e[n],t)}return t},jr=function(r,e,t,n,i){var a=void 0;return t.add(e),tr(r)||(a=P(r,e),(I(a)||Array.isArray(a))&&hr(e,a).forEach((function(r){return t.add(r)}))),_(a)?i?n:P(n,e):a},Or=function(r){return r.substring(0,r.indexOf("["))},Vr=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 kr="undefined"!=typeof window&&"undefined"!=typeof document;function Er(r){var e,t;if(ur(r)||kr&&(r instanceof File||y(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,Er(r.get(s)))}return t}for(var c in t=Array.isArray(r)?[]:{},r)t[c]=Er(r[c]);return t}var Ar,xr=function(r){return{isOnSubmit:!r||r===E,isOnBlur:r===V,isOnChange:r===k,isOnAll:r===x,isOnTouch:r===A}},wr=function(r){return z(r)||K(r)},Sr="undefined"==typeof window,Dr=kr?"Proxy"in window:"undefined"!=typeof Proxy;function Fr(r){void 0===r&&(r={});var e=r.mode;void 0===e&&(e=E);var o=r.reValidateMode;void 0===o&&(o=k);var s=r.resolver,c=r.context,l=r.defaultValues;void 0===l&&(l={});var f=r.shouldFocusError;void 0===f&&(f=!0);var d=r.shouldUnregister;void 0===d&&(d=!0);var v=r.criteriaMode,m=n({}),g=n({}),p=n({}),b=n(new Set),V=n({}),A=n({}),w=n({}),S=n({}),D=n(l),F=n(!1),R=n(!1),C=n(),N=n({}),L=n({}),M=n(c),G=n(s),$=n(new Set),X=n(xr(e)),Y=X.current,Z=Y.isOnSubmit,nr=Y.isOnTouch,dr=v===x,vr=i({isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touched:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!Z,errors:{}}),gr=vr[0],pr=vr[1],br=n({isDirty:!Dr,dirtyFields:!Dr,touched:!Dr||nr,isValidating:!Dr,isSubmitting:!Dr,isValid:!Dr}),Ar=n(gr),Fr=n(),Rr=n(xr(o)).current,Cr=Rr.isOnBlur,Nr=Rr.isOnChange;M.current=c,G.current=s,Ar.current=gr,N.current=d?{}:tr(N.current)?Er(l):N.current;var Br=t((function(r){void 0===r&&(r={}),F.current||(Ar.current=Object.assign(Object.assign({},Ar.current),r),pr(Ar.current))}),[]),Lr=function(){return br.current.isValidating&&Br({isValidating:!0})},Ir=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=_(n),o=P(e,t);return u&&!!o||!u&&!sr(o,n,!0)||u&&P(a,t)&&!P(i,t)}({errors:Ar.current.errors,error:e,name:r,validFields:S.current,fieldsWithValidation:w.current}),u=P(Ar.current.errors,r);e?(ir(S.current,r),a=a||!u||!sr(u,e,!0),H(Ar.current.errors,r,e)):((P(w.current,r)||G.current)&&(H(S.current,r,!0),a=a||u),ir(Ar.current.errors,r)),(a&&!B(t)||!tr(n)||br.current.isValidating)&&Br(Object.assign(Object.assign(Object.assign({},n),G.current?{isValid:!!i}:{}),{isValidating:!1}))}),[]),Tr=t((function(r,e){var t=m.current[r],n=t.ref,i=t.options,a=kr&&y(n)&&B(e)?"":e;z(n)?(i||[]).forEach((function(r){var e=r.ref;return e.checked=e.value===a})):J(n)&&!lr(a)?n.files=a:Q(n)?[].concat(n.options).forEach((function(r){return r.selected=a.includes(r.value)})):K(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}),[]),qr=t((function(r,e){if(br.current.isDirty){var t=Jr();return r&&e&&H(t,r,e),!sr(t,D.current)}return!1}),[]),Mr=t((function(r,e){if(void 0===e&&(e=!0),br.current.isDirty||br.current.dirtyFields){var t=!sr(P(D.current,r),rr(m,r,N)),n=P(Ar.current.dirtyFields,r),i=Ar.current.isDirty;t?H(Ar.current.dirtyFields,r,!0):ir(Ar.current.dirtyFields,r);var a={isDirty:qr(),dirtyFields:Ar.current.dirtyFields},u=br.current.isDirty&&i!==a.isDirty||br.current.dirtyFields&&n!==P(Ar.current.dirtyFields,r);return u&&e&&Br(a),u?a:{}}return{}}),[]),Hr=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 yr(m,dr,m.current[r],N))[r];return Ir(r,t,e),_(t)}),[Ir,dr]),Wr=t((async function(r){var e=(await G.current(Jr(),M.current,dr)).errors,t=Ar.current.isValid;if(Array.isArray(r)){var n=r.map((function(r){var t=P(e,r);return t?H(Ar.current.errors,r,t):ir(Ar.current.errors,r),!t})).every(Boolean);return Br({isValid:tr(e),isValidating:!1}),n}var i=P(e,r);return Ir(r,i,t!==tr(e),{},tr(e)),!i}),[Ir,dr]),_r=t((async function(r){var e=r||Object.keys(m.current);if(Lr(),G.current)return Wr(e);if(Array.isArray(e)){!r&&(Ar.current.errors={});var t=await Promise.all(e.map((async function(r){return await Hr(r,null)})));return Br({isValidating:!1}),t.every(Boolean)}return await Hr(e)}),[Wr,Hr]),Pr=t((function(r,e,t){var n=t.shouldDirty,i=t.shouldValidate,a={};H(a,r,e);for(var u=0,o=hr(r,e);u<o.length;u+=1){var s=o[u];m.current[s]&&(Tr(s,P(a,s)),n&&Mr(s),i&&_r(s))}}),[_r,Tr,Mr]),Ur=t((function(r,e,t){var n,i;if(!d&&!ur(e)&&H(N.current,r,Array.isArray(e)?[].concat(e):Object.assign({},e)),m.current[r])Tr(r,e),t.shouldDirty&&Mr(r),t.shouldValidate&&_r(r);else if(!ur(e)&&(Pr(r,e,t),$.current.has(r))){var a=Or(r)||r;H(g.current,r,e),L.current[a](((n={})[a]=P(g.current,a),n)),(br.current.isDirty||br.current.dirtyFields)&&t.shouldDirty&&(H(Ar.current.dirtyFields,r,function(r,e,t){return or(cr(r,e,t.slice(0,r.length)),cr(e,r,t.slice(0,r.length)))}(e,P(D.current,r,[]),P(Ar.current.dirtyFields,r,[]))),Br({isDirty:!sr(Object.assign(Object.assign({},Jr()),(i={},i[r]=e,i)),D.current)}))}!d&&H(N.current,r,e)}),[Mr,Tr,Pr]),Gr=function(r){return R.current||b.current.has(r)||b.current.has((r.match(/\w+/)||[])[0])},$r=function(r){var e=!0;if(!tr(V.current))for(var t in V.current)r&&V.current[t].size&&!V.current[t].has(r)&&!V.current[t].has(Or(r))||(A.current[t](),e=!1);return e};function zr(r){var e;if(!d){for(var t=Er(r),n=0,i=$.current;n<i.length;n+=1){var a=i[n];T(a)&&!t[a]&&(t=Object.assign(Object.assign({},t),((e={})[a]=[],e)))}return t}return r}function Jr(r){if(lr(r))return rr(m,r,N);if(Array.isArray(r)){for(var e={},t=0,n=r;t<n.length;t+=1){var i=n[t];H(e,i,rr(m,i,N))}return e}return zr(fr(m,Er(N.current),d))}C.current=C.current?C.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===h,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:Nr,isReValidateOnBlur:Cr,isTouched:!!P(Ar.current.touched,a),isSubmitted:Ar.current.isSubmitted},X.current)),c=Mr(a,!1),l=!tr(c)||!o&&Gr(a);if(o&&!P(Ar.current.touched,a)&&br.current.touched&&(H(Ar.current.touched,a,!0),c=Object.assign(Object.assign({},c),{touched:Ar.current.touched})),!d&&K(i)&&H(N.current,a,rr(m,a)),s)return!o&&$r(a),(!tr(c)||l&&tr(c))&&Br(c);if(Lr(),G.current){var f=(await G.current(Jr(),M.current,dr)).errors,v=Ar.current.isValid;if(e=P(f,a),K(i)&&!e&&G.current){var g=Or(a),p=P(f,g,{});p.type&&p.message&&(e=p),g&&(p||P(Ar.current.errors,g))&&(a=g)}v!==(t=tr(f))&&(l=!0)}else e=(await yr(m,dr,u,N))[a];!o&&$r(a),Ir(a,e,l,c,t)}};var Kr=t((async function(r){void 0===r&&(r={});var e=tr(m.current)?D.current:{},t=(await G.current(Object.assign(Object.assign(Object.assign({},e),Jr()),r),M.current,dr)||{}).errors,n=tr(t);Ar.current.isValid!==n&&Br({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=rr(r,o,n);!_(c)&&H(n.current,o,c)}u.type&&s?z(u)||K(u)?Array.isArray(s.options)&&s.options.length?(q(s.options).forEach((function(r,t){void 0===r&&(r={}),(er(r.ref)&&ar(r,r.ref)||a)&&(U(r.ref,e),ir(s.options,"["+t+"]"))})),s.options&&!q(s.options).length&&delete r.current[o]):delete r.current[o]:(er(u)&&ar(s,u)||a)&&(U(u,e),delete r.current[o]):delete r.current[o]}(m,C.current,r,N,d,e),d&&(ir(S.current,r.ref.name),ir(w.current,r.ref.name))}),[d]),Xr=t((function(r){if(R.current)Br();else{for(var e=0,t=b.current;e<t.length;e+=1){if(t[e].startsWith(r)){Br();break}}$r(r)}}),[]),Yr=t((function(r,e){r&&(Qr(r,e),d&&!q(r.options||[]).length&&(ir(Ar.current.errors,r.ref.name),H(Ar.current.dirtyFields,r.ref.name,!0),Br({isDirty:qr()}),br.current.isValid&&G.current&&Kr(),Xr(r.ref.name)))}),[Kr,Qr]);var Zr=t((function(r,e,t){var n=t?V.current[t]:b.current,i=fr(m,Er(N.current),d,!1,r);if(lr(r)){var a=Or(r)||r;return $.current.has(a)&&(i=Object.assign(Object.assign({},p.current),i)),jr(i,r,n,_(P(D.current,r))?e:P(D.current,r),!0)}var u=_(e)?D.current:e;return Array.isArray(r)?r.reduce((function(r,e){var t;return Object.assign(Object.assign({},r),((t={})[e]=jr(i,e,n,u),t))}),{}):(R.current=_(t),W(!tr(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($.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=wr(r),c=Vr($.current,n),l=function(e){return kr&&(!y(r)||e===r)},f=o[n],v=!0;if(f&&(s?Array.isArray(f.options)&&q(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:q(f&&f.options||[]).concat([{ref:r}]),ref:{type:i,name:n}},e):Object.assign({},u):u,o[n]=f;var g=_(P(N.current,n));tr(D.current)&&g||(t=P(g?D.current:N.current,n),(v=_(t))||c||Tr(n,t)),tr(e)||(H(w.current,n,!0),!Z&&br.current.isValid&&yr(m,dr,f,N).then((function(r){var e=Ar.current.isValid;tr(r)?H(S.current,n,!0):ir(S.current,n),e!==tr(r)&&Br()}))),!d||c&&v||!c&&ir(Ar.current.dirtyFields,n),i&&function(r,e,t){var n=r.ref;y(n)&&t&&(n.addEventListener(e?j:O,t),n.addEventListener(h,t))}(s&&f.options?f.options[f.options.length-1]:f,s||"select-one"===r.type,C.current)}}var ee=t((function(r,e){return async function(t){t&&t.preventDefault&&(t.preventDefault(),t.persist());var n={},i=zr(fr(m,Er(N.current),d,!0));br.current.isSubmitting&&Br({isSubmitting:!0});try{if(G.current){var a=await G.current(i,M.current,dr),u=a.errors,o=a.values;Ar.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 v=l.ref.name,g=await yr(m,dr,l,N);g[v]?(H(n,v,g[v]),ir(S.current,v)):P(w.current,v)&&(ir(Ar.current.errors,v),H(S.current,v,!0))}}tr(n)&&Object.keys(Ar.current.errors).every((function(r){return r in m.current}))?(Br({errors:{},isSubmitting:!0}),await r(i,t)):(Ar.current.errors=Object.assign(Object.assign({},Ar.current.errors),n),e&&await e(Ar.current.errors,t),f&&function(r,e){for(var t in r)if(P(e,t)){var n=r[t];if(n){if(n.ref.focus&&_(n.ref.focus()))break;if(n.options){n.options[0].ref.focus();break}}}}(m.current,Ar.current.errors))}finally{Ar.current.isSubmitting=!1,Br({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:tr(Ar.current.errors),submitCount:Ar.current.submitCount+1})}}}),[f,dr]);a((function(){s&&br.current.isValid&&Kr(),Fr.current=Fr.current||!kr?Fr.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&&er(o.ref)&&e(i)}else i&&er(i.ref)&&e(i)}}));return t.observe(window.document,{childList:!0,subtree:!0}),t}(m,Yr)}),[Yr,D.current]),a((function(){return function(){Fr.current&&Fr.current.disconnect(),F.current=!0,"production"===process.env.NODE_ENV&&Object.values(m.current).forEach((function(r){return Yr(r,!0)}))}}),[]),!s&&br.current.isValid&&(gr.isValid=sr(S.current,w.current)&&tr(Ar.current.errors));var te={trigger:_r,setValue:t((function(r,e,t){Ur(r,e,t||{}),Gr(r)&&Br(),$r(r)}),[Ur,_r]),getValues:t(Jr,[]),register:t((function(r,e){if(!Sr)if(lr(r))re({name:r},e);else{if(!I(r)||!("name"in r))return function(e){return e&&re(e,r)};re(r,e)}}),[D.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:Dr?new Proxy(gr,{get:function(r,e){if("production"!==process.env.NODE_ENV&&"isValid"===e&&Z&&console.warn("📋 `formState.isValid` is applicable with `onTouched`, `onChange` or `onBlur` mode. https://react-hook-form.com/api#formState"),e in r)return br.current[e]=!0,r[e]}}):gr},ne=u((function(){return Object.assign({isFormDirty:qr,updateWatchedValue:Xr,shouldUnregister:d,updateFormState:Br,removeFieldEventListener:Qr,watchInternal:Zr,mode:X.current,reValidateMode:{isReValidateOnBlur:Cr,isReValidateOnChange:Nr},validateResolver:s?Kr:void 0,fieldsRef:m,resetFieldArrayFunctionRef:L,useWatchFieldsRef:V,useWatchRenderFunctionsRef:A,fieldArrayDefaultValuesRef:g,validFieldsRef:S,fieldsWithValidationRef:w,fieldArrayNamesRef:$,readFormStateRef:br,formStateRef:Ar,defaultValuesRef:D,shallowFieldsStateRef:N,fieldArrayValuesRef:p},te)}),[D.current,Xr,d,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={}),kr)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=wr(a)&&Array.isArray(u)?u[0].ref:a;if(y(o))try{o.closest("form").reset();break}catch(r){}}}m.current={},D.current=Object.assign({},r||D.current),r&&$r(""),Object.values(L.current).forEach((function(r){return mr(r)&&r()})),N.current=d?{}:Er(r||D.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||(S.current={},w.current={}),g.current={},b.current=new Set,R.current=!1,Br({submitCount:u?Ar.current.submitCount:0,isDirty:!!t&&Ar.current.isDirty,isSubmitted:!!n&&Ar.current.isSubmitted,isValid:!!a&&Ar.current.isValid,dirtyFields:o?Ar.current.dirtyFields:{},touched:i?Ar.current.touched:{},errors:e?Ar.current.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})}(e)}),[]),clearErrors:t((function(r){r&&(Array.isArray(r)?r:[r]).forEach((function(r){return m.current[r]&&T(r)?delete Ar.current.errors[r]:ir(Ar.current.errors,r)})),Br({errors:r?Ar.current.errors:{}})}),[]),setError:t((function(r,e){var t=(m.current[r]||{}).ref;H(Ar.current.errors,r,Object.assign(Object.assign({},e),{ref:t})),Br({isValid:!1}),e.shouldFocus&&t&&t.focus&&t.focus()}),[]),errors:gr.errors},te)}e(null).displayName="RHFContext",function(r){r.formgroup="formgroup",r.checkbox="checkbox",r.radiobutton="radiobutton",r.textarea="textarea",r.input="input"}(Ar||(Ar={}));var Rr=function(e){var t=e.exampleType,n=void 0===t?Ar.formgroup:t,i=Fr(),a=i.register,u=i.handleSubmit,o=i.errors,y="formgroup1",h="formgroup2",j="formgroup3",O="formgroup4",V="formgroup5",k=o.formgroup1||o.formgroup2||o.formgroup3||o.formgroup4||o.formgroup5,E="Du må velge et alternativ",A="Det kan ikke legges inn mer enn 40 tegn",x="Du må skrive noe her",w=[r.createElement(l,{key:0,inputId:"checkbox1",label:"Checkbox 1",ref:a({required:E})}),r.createElement(l,{key:1,inputId:"checkbox2",label:"Checkbox 2",ref:a({required:E})}),r.createElement(l,{key:2,inputId:"checkbox3",label:"Checkbox 3",ref:a({required:E})})],S=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:k?"Sjekk at alt er riktig utfylt":void 0},n===Ar.formgroup?[r.createElement(c,{key:0,title:"Gruppe tittel",legend:"Velg minst en",error:o.formgroup1?o.formgroup1.message:void 0,variant:e.variant,name:y},r.createElement(p,{maxColumns:b.two},w.map((function(r){return r})))),r.createElement(c,{key:1,legend:"Velg minst to",error:o.formgroup2?o.formgroup2.message:void 0,variant:e.variant,name:h},r.createElement(l,{inputId:"checkbox4",label:"Checkbox 4",ref:a({validate:S})}),r.createElement(l,{inputId:"checkbox5",label:"Checkbox 5",ref:a({validate:S})}),r.createElement(l,{inputId:"checkbox6",label:"Checkbox 6",ref:a({validate:S})})),r.createElement(c,{key:2,legend:"Velg en",error:o.formgroup3?o.formgroup3.message:void 0,variant:e.variant,name:j},r.createElement(d,{inputId:"radiobutton1",label:"Radiobutton 1",ref:a({required:E})}),r.createElement(d,{inputId:"radiobutton2",label:"Radiobutton 2",ref:a({required:E})}),r.createElement(d,{inputId:"radiobutton3",label:"Radiobutton 3",ref:a({required:E})})),r.createElement(c,{key:3,error:o.formgroup4?o.formgroup4.message:void 0},r.createElement(v,{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:O,ref:a({maxLength:{value:40,message:A}})})),r.createElement(c,{name:V,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:g,ref:a({required:x})}))]:n===Ar.checkbox?r.createElement(c,{name:y,error:o.formgroup1?o.formgroup1.message:void 0},r.createElement(l,{name:y,inputId:"checkbox1",label:"Checkbox 1",error:o.formgroup1,variant:e.variant,ref:a({required:E})})):n===Ar.radiobutton?r.createElement(c,{name:j,error:o.formgroup3?o.formgroup3.message:void 0},r.createElement(d,{name:j,inputId:"radiobutton1",label:"Radiobutton 1",error:o.formgroup3,variant:e.variant,ref:a({required:E})})):n===Ar.textarea?r.createElement(c,{error:o.formgroup4?o.formgroup4.message:void 0},r.createElement(v,{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:O,ref:a({maxLength:{value:40,message:A}})})):n===Ar.input?r.createElement(c,{name:V,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:g,ref:a({required:x})})):void 0),r.createElement(f,{type:"submit"},"Send inn"))};export{Rr as FormExample,Ar as FormExampleVariants,Rr as default};
|
|
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-087d9955.js";import{F as c}from"../../FormGroup-c32db99d.js";import{C as l}from"../../Checkbox-b0815d04.js";import{B as f}from"../../Button-0917df8e.js";import{R as d}from"../../RadioButton-3ce7a88d.js";import{T as v}from"../../Textarea-56a24cb9.js";import{I as m}from"../../Input-9ccf3867.js";import{H as g}from"../../Hospital-e9e6a0b3.js";import{F as p,a as b}from"../../FormLayout-1a6866fe.js";import"../../index-d1c0552c.js";import"../Validation/styles.module.scss";import"../../constants-dbdea596.js";import"../../_rollupPluginBabelHelpers-0f007973.js";import"../FormGroup/styles.module.scss";import"../../Title-01820508.js";import"../Title/styles.module.scss";import"../../uuid-11037462.js";import"../../Check-fdf95f67.js";import"../../Icon-d69d65b3.js";import"../../_tslib-b219470a.js";import"../../useUuid-3b1e73f2.js";import"../../color-e7d082c1.js";import"../../index-d1c9177a.js";import"../../palette-f206f488.js";import"../../grid-c105cad1.js";import"../Checkbox/styles.module.scss";import"../../Loader-06293a27.js";import"../Loader/styles.module.scss";import"../../useHover-18479690.js";import"../../useBreakpoint-a74f5af5.js";import"../Button/styles.module.scss";import"../RadioButton/styles.module.scss";import"../Textarea/styles.module.scss";import"../Input/styles.module.scss";import"../FormLayout/styles.module.scss";var y=function(r){return r instanceof HTMLElement},h="blur",j="change",O="input",V="onBlur",k="onChange",E="onSubmit",A="onTouched",x="all",w="max",S="min",D="maxLength",F="minLength",R="pattern",C="required",N="validate";var B=function(r){return null==r},L=function(r){return"object"==typeof r},I=function(r){return!B(r)&&!Array.isArray(r)&&L(r)&&!(r instanceof Date)},T=function(r){return/^\w*$/.test(r)},q=function(r){return r.filter(Boolean)},M=function(r){return q(r.replace(/["|']/g,"").replace(/\[/g,".").replace(/\]/g,"").split("."))};function H(r,e,t){for(var n=-1,i=T(e)?[e]:M(e),a=i.length,u=a-1;++n<a;){var o=i[n],s=t;if(n!==u){var c=r[o];s=I(c)||Array.isArray(c)?c:isNaN(+i[n+1])?{}:[]}r[o]=s,r=r[o]}return r}var W=function(r,e){for(var t in void 0===e&&(e={}),r)T(t)?e[t]=r[t]:H(e,t,r[t]);return e},_=function(r){return void 0===r},P=function(r,e,t){void 0===r&&(r={});var n=q(e.split(/[,[\].]+?/)).reduce((function(r,e){return B(r)?r:r[e]}),r);return _(n)||n===r?_(r[e])?t:r[e]:n},U=function(r,e){y(r)&&r.removeEventListener&&(r.removeEventListener(O,e),r.removeEventListener(j,e),r.removeEventListener(h,e))},G={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}),G):G},z=function(r){return"radio"===r.type},J=function(r){return"file"===r.type},K=function(r){return"checkbox"===r.type},Q=function(r){return"select-multiple"===r.type},X={value:!1,isValid:!1},Y={value:!0,isValid:!0},Z=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&&!_(a.value)?_(i)||""===i?Y:{value:i,isValid:!0}:Y:X}return X};function rr(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,d=u.valueAsDate,v=u.setValueAs;if(c&&n)return;return J(l)?l.files:z(l)?$(u.options).value:Q(l)?(a=l.options,[].concat(a).filter((function(r){return r.selected})).map((function(r){return r.value}))):K(l)?Z(u.options).value:i?s:f?""===s?NaN:+s:d?l.valueAsDate:v?v(s):s}if(t)return P(t.current,e)}function er(r){return!r||r instanceof HTMLElement&&r.nodeType!==Node.DOCUMENT_NODE&&er(r.parentNode)}var tr=function(r){return I(r)&&!Object.keys(r).length},nr=function(r){return"boolean"==typeof r};function ir(r,e){var t,n=T(e)?[e]:M(e),i=1==n.length?r:function(r,e){for(var t=e.slice(0,-1).length,n=0;n<t;)r=_(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&&(I(s)&&tr(s)||Array.isArray(s)&&!s.filter((function(r){return I(r)&&!tr(r)||nr(r)})).length)&&(t?delete t[f]:delete r[f]),t=s}}return r}var ar=function(r,e){return r&&r.ref===e};var ur=function(r){return B(r)||!L(r)};function or(r,e){if(ur(r)||ur(e))return e;for(var t in e){var n=r[t],i=e[t];try{r[t]=I(n)&&I(i)||Array.isArray(n)&&Array.isArray(i)?or(n,i):i}catch(r){}}return r}function sr(r,e,t){if(ur(r)||ur(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((I(c)||Array.isArray(c))&&(I(l)||Array.isArray(l))?!sr(c,l,t):c!==l)return!1}}}return!0}function cr(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]=[],cr(r[u][o],P(e[u]||{},o,[]),t[u][o],t[u],o)):sr(P(e[u]||{},o),r[u][o])?H(t[u]||{},o):t[u]=Object.assign(Object.assign({},t[u]),((a={})[o]=!0,a));n&&!t.length&&delete n[i]}return t}var lr=function(r){return"string"==typeof r},fr=function(r,e,t,n,i){var a={},u=function(e){(_(i)||(lr(i)?e.startsWith(i):Array.isArray(i)&&i.find((function(r){return e.startsWith(r)}))))&&(a[e]=rr(r,e,void 0,n))};for(var o in r.current)u(o);return t?W(a):or(e,W(a))},dr=function(r){return r instanceof RegExp},vr=function(r){return I(r)&&!dr(r)?r:{value:r,message:""}},mr=function(r){return"function"==typeof r},gr=function(r){return lr(r)||o(r)};function pr(r,e,t){if(void 0===t&&(t="validate"),gr(r)||nr(r)&&!r)return{type:t,message:gr(r)?r:"",ref:e}}var br=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))}):{}},yr=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,d=t.pattern,v=t.validate,m=i.name,g={},p=z(i),b=K(i),y=p||b,h=""===a,j=br.bind(null,m,e,g),O=function(r,e,t,n,a){void 0===n&&(n=D),void 0===a&&(a=F);var u=r?e:t;g[m]=Object.assign({type:r?n:a,message:u,ref:i},j(r?n:a,u))};if(o&&(!p&&!b&&(h||B(a))||nr(a)&&!a||b&&!Z(u).isValid||p&&!$(u).isValid)){var V=gr(o)?{value:!!o,message:o}:vr(o),k=V.value,E=V.message;if(k&&(g[m]=Object.assign({type:C,message:E,ref:y?((r.current[m].options||[])[0]||{}).ref:i},j(C,E)),!e))return g}if(!(B(l)&&B(f)||""===a)){var A,x,L=vr(f),T=vr(l);if(isNaN(a)){var q=i.valueAsDate||new Date(a);lr(L.value)&&(A=q>new Date(L.value)),lr(T.value)&&(x=q<new Date(T.value))}else{var M=i.valueAsNumber||parseFloat(a);B(L.value)||(A=M>L.value),B(T.value)||(x=M<T.value)}if((A||x)&&(O(!!A,L.message,T.message,w,S),!e))return g}if(lr(a)&&!h&&(s||c)){var H=vr(s),W=vr(c),_=!B(H.value)&&a.length>H.value,P=!B(W.value)&&a.length<W.value;if((_||P)&&(O(_,H.message,W.message),!e))return g}if(lr(a)&&d&&!h){var U=vr(d),G=U.value,J=U.message;if(dr(G)&&!G.test(a)&&(g[m]=Object.assign({type:R,message:J,ref:i},j(R,J)),!e))return g}if(v){var Q=rr(r,m,n,!1,!0),X=y&&u?u[0].ref:i;if(mr(v)){var Y=pr(await v(Q),X);if(Y&&(g[m]=Object.assign(Object.assign({},Y),j(N,Y.message)),!e))return g}else if(I(v)){for(var er={},ir=0,ar=Object.entries(v);ir<ar.length;ir+=1){var ur=ar[ir],or=ur[0],sr=ur[1];if(!tr(er)&&!e)break;var cr=pr(await sr(Q),X,or);cr&&(er=Object.assign(Object.assign({},cr),j(or,cr.message)),e&&(g[m]=er))}if(!tr(er)&&(g[m]=Object.assign({ref:X},er),!e))return g}}return g},hr=function(r,e,t){for(var n in void 0===t&&(t=[]),e){var i=r+(I(e)?"."+n:"["+n+"]");ur(e[n])?t.push(i):hr(i,e[n],t)}return t},jr=function(r,e,t,n,i){var a=void 0;return t.add(e),tr(r)||(a=P(r,e),(I(a)||Array.isArray(a))&&hr(e,a).forEach((function(r){return t.add(r)}))),_(a)?i?n:P(n,e):a},Or=function(r){return r.substring(0,r.indexOf("["))},Vr=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 kr="undefined"!=typeof window&&"undefined"!=typeof document;function Er(r){var e,t;if(ur(r)||kr&&(r instanceof File||y(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,Er(r.get(s)))}return t}for(var c in t=Array.isArray(r)?[]:{},r)t[c]=Er(r[c]);return t}var Ar,xr=function(r){return{isOnSubmit:!r||r===E,isOnBlur:r===V,isOnChange:r===k,isOnAll:r===x,isOnTouch:r===A}},wr=function(r){return z(r)||K(r)},Sr="undefined"==typeof window,Dr=kr?"Proxy"in window:"undefined"!=typeof Proxy;function Fr(r){void 0===r&&(r={});var e=r.mode;void 0===e&&(e=E);var o=r.reValidateMode;void 0===o&&(o=k);var s=r.resolver,c=r.context,l=r.defaultValues;void 0===l&&(l={});var f=r.shouldFocusError;void 0===f&&(f=!0);var d=r.shouldUnregister;void 0===d&&(d=!0);var v=r.criteriaMode,m=n({}),g=n({}),p=n({}),b=n(new Set),V=n({}),A=n({}),w=n({}),S=n({}),D=n(l),F=n(!1),R=n(!1),C=n(),N=n({}),L=n({}),M=n(c),G=n(s),$=n(new Set),X=n(xr(e)),Y=X.current,Z=Y.isOnSubmit,nr=Y.isOnTouch,dr=v===x,vr=i({isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touched:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!Z,errors:{}}),gr=vr[0],pr=vr[1],br=n({isDirty:!Dr,dirtyFields:!Dr,touched:!Dr||nr,isValidating:!Dr,isSubmitting:!Dr,isValid:!Dr}),Ar=n(gr),Fr=n(),Rr=n(xr(o)).current,Cr=Rr.isOnBlur,Nr=Rr.isOnChange;M.current=c,G.current=s,Ar.current=gr,N.current=d?{}:tr(N.current)?Er(l):N.current;var Br=t((function(r){void 0===r&&(r={}),F.current||(Ar.current=Object.assign(Object.assign({},Ar.current),r),pr(Ar.current))}),[]),Lr=function(){return br.current.isValidating&&Br({isValidating:!0})},Ir=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=_(n),o=P(e,t);return u&&!!o||!u&&!sr(o,n,!0)||u&&P(a,t)&&!P(i,t)}({errors:Ar.current.errors,error:e,name:r,validFields:S.current,fieldsWithValidation:w.current}),u=P(Ar.current.errors,r);e?(ir(S.current,r),a=a||!u||!sr(u,e,!0),H(Ar.current.errors,r,e)):((P(w.current,r)||G.current)&&(H(S.current,r,!0),a=a||u),ir(Ar.current.errors,r)),(a&&!B(t)||!tr(n)||br.current.isValidating)&&Br(Object.assign(Object.assign(Object.assign({},n),G.current?{isValid:!!i}:{}),{isValidating:!1}))}),[]),Tr=t((function(r,e){var t=m.current[r],n=t.ref,i=t.options,a=kr&&y(n)&&B(e)?"":e;z(n)?(i||[]).forEach((function(r){var e=r.ref;return e.checked=e.value===a})):J(n)&&!lr(a)?n.files=a:Q(n)?[].concat(n.options).forEach((function(r){return r.selected=a.includes(r.value)})):K(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}),[]),qr=t((function(r,e){if(br.current.isDirty){var t=Jr();return r&&e&&H(t,r,e),!sr(t,D.current)}return!1}),[]),Mr=t((function(r,e){if(void 0===e&&(e=!0),br.current.isDirty||br.current.dirtyFields){var t=!sr(P(D.current,r),rr(m,r,N)),n=P(Ar.current.dirtyFields,r),i=Ar.current.isDirty;t?H(Ar.current.dirtyFields,r,!0):ir(Ar.current.dirtyFields,r);var a={isDirty:qr(),dirtyFields:Ar.current.dirtyFields},u=br.current.isDirty&&i!==a.isDirty||br.current.dirtyFields&&n!==P(Ar.current.dirtyFields,r);return u&&e&&Br(a),u?a:{}}return{}}),[]),Hr=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 yr(m,dr,m.current[r],N))[r];return Ir(r,t,e),_(t)}),[Ir,dr]),Wr=t((async function(r){var e=(await G.current(Jr(),M.current,dr)).errors,t=Ar.current.isValid;if(Array.isArray(r)){var n=r.map((function(r){var t=P(e,r);return t?H(Ar.current.errors,r,t):ir(Ar.current.errors,r),!t})).every(Boolean);return Br({isValid:tr(e),isValidating:!1}),n}var i=P(e,r);return Ir(r,i,t!==tr(e),{},tr(e)),!i}),[Ir,dr]),_r=t((async function(r){var e=r||Object.keys(m.current);if(Lr(),G.current)return Wr(e);if(Array.isArray(e)){!r&&(Ar.current.errors={});var t=await Promise.all(e.map((async function(r){return await Hr(r,null)})));return Br({isValidating:!1}),t.every(Boolean)}return await Hr(e)}),[Wr,Hr]),Pr=t((function(r,e,t){var n=t.shouldDirty,i=t.shouldValidate,a={};H(a,r,e);for(var u=0,o=hr(r,e);u<o.length;u+=1){var s=o[u];m.current[s]&&(Tr(s,P(a,s)),n&&Mr(s),i&&_r(s))}}),[_r,Tr,Mr]),Ur=t((function(r,e,t){var n,i;if(!d&&!ur(e)&&H(N.current,r,Array.isArray(e)?[].concat(e):Object.assign({},e)),m.current[r])Tr(r,e),t.shouldDirty&&Mr(r),t.shouldValidate&&_r(r);else if(!ur(e)&&(Pr(r,e,t),$.current.has(r))){var a=Or(r)||r;H(g.current,r,e),L.current[a](((n={})[a]=P(g.current,a),n)),(br.current.isDirty||br.current.dirtyFields)&&t.shouldDirty&&(H(Ar.current.dirtyFields,r,function(r,e,t){return or(cr(r,e,t.slice(0,r.length)),cr(e,r,t.slice(0,r.length)))}(e,P(D.current,r,[]),P(Ar.current.dirtyFields,r,[]))),Br({isDirty:!sr(Object.assign(Object.assign({},Jr()),(i={},i[r]=e,i)),D.current)}))}!d&&H(N.current,r,e)}),[Mr,Tr,Pr]),Gr=function(r){return R.current||b.current.has(r)||b.current.has((r.match(/\w+/)||[])[0])},$r=function(r){var e=!0;if(!tr(V.current))for(var t in V.current)r&&V.current[t].size&&!V.current[t].has(r)&&!V.current[t].has(Or(r))||(A.current[t](),e=!1);return e};function zr(r){var e;if(!d){for(var t=Er(r),n=0,i=$.current;n<i.length;n+=1){var a=i[n];T(a)&&!t[a]&&(t=Object.assign(Object.assign({},t),((e={})[a]=[],e)))}return t}return r}function Jr(r){if(lr(r))return rr(m,r,N);if(Array.isArray(r)){for(var e={},t=0,n=r;t<n.length;t+=1){var i=n[t];H(e,i,rr(m,i,N))}return e}return zr(fr(m,Er(N.current),d))}C.current=C.current?C.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===h,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:Nr,isReValidateOnBlur:Cr,isTouched:!!P(Ar.current.touched,a),isSubmitted:Ar.current.isSubmitted},X.current)),c=Mr(a,!1),l=!tr(c)||!o&&Gr(a);if(o&&!P(Ar.current.touched,a)&&br.current.touched&&(H(Ar.current.touched,a,!0),c=Object.assign(Object.assign({},c),{touched:Ar.current.touched})),!d&&K(i)&&H(N.current,a,rr(m,a)),s)return!o&&$r(a),(!tr(c)||l&&tr(c))&&Br(c);if(Lr(),G.current){var f=(await G.current(Jr(),M.current,dr)).errors,v=Ar.current.isValid;if(e=P(f,a),K(i)&&!e&&G.current){var g=Or(a),p=P(f,g,{});p.type&&p.message&&(e=p),g&&(p||P(Ar.current.errors,g))&&(a=g)}v!==(t=tr(f))&&(l=!0)}else e=(await yr(m,dr,u,N))[a];!o&&$r(a),Ir(a,e,l,c,t)}};var Kr=t((async function(r){void 0===r&&(r={});var e=tr(m.current)?D.current:{},t=(await G.current(Object.assign(Object.assign(Object.assign({},e),Jr()),r),M.current,dr)||{}).errors,n=tr(t);Ar.current.isValid!==n&&Br({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=rr(r,o,n);!_(c)&&H(n.current,o,c)}u.type&&s?z(u)||K(u)?Array.isArray(s.options)&&s.options.length?(q(s.options).forEach((function(r,t){void 0===r&&(r={}),(er(r.ref)&&ar(r,r.ref)||a)&&(U(r.ref,e),ir(s.options,"["+t+"]"))})),s.options&&!q(s.options).length&&delete r.current[o]):delete r.current[o]:(er(u)&&ar(s,u)||a)&&(U(u,e),delete r.current[o]):delete r.current[o]}(m,C.current,r,N,d,e),d&&(ir(S.current,r.ref.name),ir(w.current,r.ref.name))}),[d]),Xr=t((function(r){if(R.current)Br();else{for(var e=0,t=b.current;e<t.length;e+=1){if(t[e].startsWith(r)){Br();break}}$r(r)}}),[]),Yr=t((function(r,e){r&&(Qr(r,e),d&&!q(r.options||[]).length&&(ir(Ar.current.errors,r.ref.name),H(Ar.current.dirtyFields,r.ref.name,!0),Br({isDirty:qr()}),br.current.isValid&&G.current&&Kr(),Xr(r.ref.name)))}),[Kr,Qr]);var Zr=t((function(r,e,t){var n=t?V.current[t]:b.current,i=fr(m,Er(N.current),d,!1,r);if(lr(r)){var a=Or(r)||r;return $.current.has(a)&&(i=Object.assign(Object.assign({},p.current),i)),jr(i,r,n,_(P(D.current,r))?e:P(D.current,r),!0)}var u=_(e)?D.current:e;return Array.isArray(r)?r.reduce((function(r,e){var t;return Object.assign(Object.assign({},r),((t={})[e]=jr(i,e,n,u),t))}),{}):(R.current=_(t),W(!tr(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($.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=wr(r),c=Vr($.current,n),l=function(e){return kr&&(!y(r)||e===r)},f=o[n],v=!0;if(f&&(s?Array.isArray(f.options)&&q(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:q(f&&f.options||[]).concat([{ref:r}]),ref:{type:i,name:n}},e):Object.assign({},u):u,o[n]=f;var g=_(P(N.current,n));tr(D.current)&&g||(t=P(g?D.current:N.current,n),(v=_(t))||c||Tr(n,t)),tr(e)||(H(w.current,n,!0),!Z&&br.current.isValid&&yr(m,dr,f,N).then((function(r){var e=Ar.current.isValid;tr(r)?H(S.current,n,!0):ir(S.current,n),e!==tr(r)&&Br()}))),!d||c&&v||!c&&ir(Ar.current.dirtyFields,n),i&&function(r,e,t){var n=r.ref;y(n)&&t&&(n.addEventListener(e?j:O,t),n.addEventListener(h,t))}(s&&f.options?f.options[f.options.length-1]:f,s||"select-one"===r.type,C.current)}}var ee=t((function(r,e){return async function(t){t&&t.preventDefault&&(t.preventDefault(),t.persist());var n={},i=zr(fr(m,Er(N.current),d,!0));br.current.isSubmitting&&Br({isSubmitting:!0});try{if(G.current){var a=await G.current(i,M.current,dr),u=a.errors,o=a.values;Ar.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 v=l.ref.name,g=await yr(m,dr,l,N);g[v]?(H(n,v,g[v]),ir(S.current,v)):P(w.current,v)&&(ir(Ar.current.errors,v),H(S.current,v,!0))}}tr(n)&&Object.keys(Ar.current.errors).every((function(r){return r in m.current}))?(Br({errors:{},isSubmitting:!0}),await r(i,t)):(Ar.current.errors=Object.assign(Object.assign({},Ar.current.errors),n),e&&await e(Ar.current.errors,t),f&&function(r,e){for(var t in r)if(P(e,t)){var n=r[t];if(n){if(n.ref.focus&&_(n.ref.focus()))break;if(n.options){n.options[0].ref.focus();break}}}}(m.current,Ar.current.errors))}finally{Ar.current.isSubmitting=!1,Br({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:tr(Ar.current.errors),submitCount:Ar.current.submitCount+1})}}}),[f,dr]);a((function(){s&&br.current.isValid&&Kr(),Fr.current=Fr.current||!kr?Fr.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&&er(o.ref)&&e(i)}else i&&er(i.ref)&&e(i)}}));return t.observe(window.document,{childList:!0,subtree:!0}),t}(m,Yr)}),[Yr,D.current]),a((function(){return function(){Fr.current&&Fr.current.disconnect(),F.current=!0,"production"===process.env.NODE_ENV&&Object.values(m.current).forEach((function(r){return Yr(r,!0)}))}}),[]),!s&&br.current.isValid&&(gr.isValid=sr(S.current,w.current)&&tr(Ar.current.errors));var te={trigger:_r,setValue:t((function(r,e,t){Ur(r,e,t||{}),Gr(r)&&Br(),$r(r)}),[Ur,_r]),getValues:t(Jr,[]),register:t((function(r,e){if(!Sr)if(lr(r))re({name:r},e);else{if(!I(r)||!("name"in r))return function(e){return e&&re(e,r)};re(r,e)}}),[D.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:Dr?new Proxy(gr,{get:function(r,e){if("production"!==process.env.NODE_ENV&&"isValid"===e&&Z&&console.warn("📋 `formState.isValid` is applicable with `onTouched`, `onChange` or `onBlur` mode. https://react-hook-form.com/api#formState"),e in r)return br.current[e]=!0,r[e]}}):gr},ne=u((function(){return Object.assign({isFormDirty:qr,updateWatchedValue:Xr,shouldUnregister:d,updateFormState:Br,removeFieldEventListener:Qr,watchInternal:Zr,mode:X.current,reValidateMode:{isReValidateOnBlur:Cr,isReValidateOnChange:Nr},validateResolver:s?Kr:void 0,fieldsRef:m,resetFieldArrayFunctionRef:L,useWatchFieldsRef:V,useWatchRenderFunctionsRef:A,fieldArrayDefaultValuesRef:g,validFieldsRef:S,fieldsWithValidationRef:w,fieldArrayNamesRef:$,readFormStateRef:br,formStateRef:Ar,defaultValuesRef:D,shallowFieldsStateRef:N,fieldArrayValuesRef:p},te)}),[D.current,Xr,d,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={}),kr)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=wr(a)&&Array.isArray(u)?u[0].ref:a;if(y(o))try{o.closest("form").reset();break}catch(r){}}}m.current={},D.current=Object.assign({},r||D.current),r&&$r(""),Object.values(L.current).forEach((function(r){return mr(r)&&r()})),N.current=d?{}:Er(r||D.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||(S.current={},w.current={}),g.current={},b.current=new Set,R.current=!1,Br({submitCount:u?Ar.current.submitCount:0,isDirty:!!t&&Ar.current.isDirty,isSubmitted:!!n&&Ar.current.isSubmitted,isValid:!!a&&Ar.current.isValid,dirtyFields:o?Ar.current.dirtyFields:{},touched:i?Ar.current.touched:{},errors:e?Ar.current.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})}(e)}),[]),clearErrors:t((function(r){r&&(Array.isArray(r)?r:[r]).forEach((function(r){return m.current[r]&&T(r)?delete Ar.current.errors[r]:ir(Ar.current.errors,r)})),Br({errors:r?Ar.current.errors:{}})}),[]),setError:t((function(r,e){var t=(m.current[r]||{}).ref;H(Ar.current.errors,r,Object.assign(Object.assign({},e),{ref:t})),Br({isValid:!1}),e.shouldFocus&&t&&t.focus&&t.focus()}),[]),errors:gr.errors},te)}e(null).displayName="RHFContext",function(r){r.formgroup="formgroup",r.checkbox="checkbox",r.radiobutton="radiobutton",r.textarea="textarea",r.input="input"}(Ar||(Ar={}));var Rr=function(e){var t=e.exampleType,n=void 0===t?Ar.formgroup:t,i=Fr(),a=i.register,u=i.handleSubmit,o=i.errors,y="formgroup1",h="formgroup2",j="formgroup3",O="formgroup4",V="formgroup5",k=o.formgroup1||o.formgroup2||o.formgroup3||o.formgroup4||o.formgroup5,E="Du må velge et alternativ",A="Det kan ikke legges inn mer enn 40 tegn",x="Du må skrive noe her",w=[r.createElement(l,{key:0,inputId:"checkbox1",label:"Checkbox 1",ref:a({required:E})}),r.createElement(l,{key:1,inputId:"checkbox2",label:"Checkbox 2",ref:a({required:E})}),r.createElement(l,{key:2,inputId:"checkbox3",label:"Checkbox 3",ref:a({required:E})})],S=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:k?"Sjekk at alt er riktig utfylt":void 0},n===Ar.formgroup?[r.createElement(c,{key:0,title:"Gruppe tittel",legend:"Velg minst en",error:o.formgroup1?o.formgroup1.message:void 0,variant:e.variant,name:y},r.createElement(p,{maxColumns:b.two},w.map((function(r){return r})))),r.createElement(c,{key:1,legend:"Velg minst to",error:o.formgroup2?o.formgroup2.message:void 0,variant:e.variant,name:h},r.createElement(l,{inputId:"checkbox4",label:"Checkbox 4",ref:a({validate:S})}),r.createElement(l,{inputId:"checkbox5",label:"Checkbox 5",ref:a({validate:S})}),r.createElement(l,{inputId:"checkbox6",label:"Checkbox 6",ref:a({validate:S})})),r.createElement(c,{key:2,legend:"Velg en",error:o.formgroup3?o.formgroup3.message:void 0,variant:e.variant,name:j},r.createElement(d,{inputId:"radiobutton1",label:"Radiobutton 1",ref:a({required:E})}),r.createElement(d,{inputId:"radiobutton2",label:"Radiobutton 2",ref:a({required:E})}),r.createElement(d,{inputId:"radiobutton3",label:"Radiobutton 3",ref:a({required:E})})),r.createElement(c,{key:3,error:o.formgroup4?o.formgroup4.message:void 0},r.createElement(v,{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:O,ref:a({maxLength:{value:40,message:A}})})),r.createElement(c,{name:V,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:g,ref:a({required:x})}))]:n===Ar.checkbox?r.createElement(c,{name:y,error:o.formgroup1?o.formgroup1.message:void 0},r.createElement(l,{name:y,inputId:"checkbox1",label:"Checkbox 1",error:o.formgroup1,variant:e.variant,ref:a({required:E})})):n===Ar.radiobutton?r.createElement(c,{name:j,error:o.formgroup3?o.formgroup3.message:void 0},r.createElement(d,{name:j,inputId:"radiobutton1",label:"Radiobutton 1",error:o.formgroup3,variant:e.variant,ref:a({required:E})})):n===Ar.textarea?r.createElement(c,{error:o.formgroup4?o.formgroup4.message:void 0},r.createElement(v,{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:O,ref:a({maxLength:{value:40,message:A}})})):n===Ar.input?r.createElement(c,{name:V,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:g,ref:a({required:x})})):void 0),r.createElement(f,{type:"submit"},"Send inn"))};export{Rr as FormExample,Ar as FormExampleVariants,Rr as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -19,6 +19,8 @@ interface HighlightBoxProps {
|
|
|
19
19
|
svgIcon?: SvgIcon;
|
|
20
20
|
/** Changes the underlying element. Default: div */
|
|
21
21
|
htmlMarkup?: HighlightBoxTags;
|
|
22
|
+
/** Adds custom classes to the element. */
|
|
23
|
+
className?: string;
|
|
22
24
|
/** Sets the data-testid attribute. */
|
|
23
25
|
testId?: string;
|
|
24
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HighlightBox.d.ts","sourceRoot":"","sources":["../../../src/components/HighlightBox/HighlightBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAInD,OAAa,EAAE,OAAO,EAAY,MAAM,UAAU,CAAC;AAGnD,oBAAY,kBAAkB,GAAG,OAAO,CAAC,YAAY,EAAE,OAAO,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC;AAEvH,oBAAY,gBAAgB;IAC1B,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED,oBAAY,gBAAgB,GAAG,OAAO,CACpC,MAAM,qBAAqB,EAC3B,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,CAC1E,CAAC;AAEF,UAAU,iBAAiB;IACzB,yBAAyB;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,mDAAmD;IACnD,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,OAAO,gBAAgB,CAAC;IACrC,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mDAAmD;IACnD,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAuBD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"HighlightBox.d.ts","sourceRoot":"","sources":["../../../src/components/HighlightBox/HighlightBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAInD,OAAa,EAAE,OAAO,EAAY,MAAM,UAAU,CAAC;AAGnD,oBAAY,kBAAkB,GAAG,OAAO,CAAC,YAAY,EAAE,OAAO,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC;AAEvH,oBAAY,gBAAgB;IAC1B,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED,oBAAY,gBAAgB,GAAG,OAAO,CACpC,MAAM,qBAAqB,EAC3B,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,CAC1E,CAAC;AAEF,UAAU,iBAAiB;IACzB,yBAAyB;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,mDAAmD;IACnD,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,OAAO,gBAAgB,CAAC;IACrC,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mDAAmD;IACnD,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAuBD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAkF7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -480,6 +480,25 @@
|
|
|
480
480
|
]
|
|
481
481
|
}
|
|
482
482
|
},
|
|
483
|
+
"className": {
|
|
484
|
+
"defaultValue": null,
|
|
485
|
+
"description": "Adds custom classes to the element.",
|
|
486
|
+
"name": "className",
|
|
487
|
+
"parent": {
|
|
488
|
+
"fileName": "src/components/HighlightBox/HighlightBox.tsx",
|
|
489
|
+
"name": "HighlightBoxProps"
|
|
490
|
+
},
|
|
491
|
+
"declarations": [
|
|
492
|
+
{
|
|
493
|
+
"fileName": "src/components/HighlightBox/HighlightBox.tsx",
|
|
494
|
+
"name": "HighlightBoxProps"
|
|
495
|
+
}
|
|
496
|
+
],
|
|
497
|
+
"required": false,
|
|
498
|
+
"type": {
|
|
499
|
+
"name": "string"
|
|
500
|
+
}
|
|
501
|
+
},
|
|
483
502
|
"testId": {
|
|
484
503
|
"defaultValue": null,
|
|
485
504
|
"description": "Sets the data-testid attribute.",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import{c as t}from"../../index-d1c0552c.js";import
|
|
1
|
+
import e from"react";import{c as t}from"../../index-d1c0552c.js";import a from"./styles.module.scss";import{A as i,I as l}from"../../constants-dbdea596.js";import{I as r}from"../../Icon-d69d65b3.js";import"../../palette-f206f488.js";import"../../grid-c105cad1.js";import{u as s,B as o}from"../../useBreakpoint-a74f5af5.js";import"../../_tslib-b219470a.js";import"../../useUuid-3b1e73f2.js";import"../../_rollupPluginBabelHelpers-0f007973.js";import"../../uuid-11037462.js";var c;!function(e){e.medium="medium",e.large="large",e.fluid="fluid"}(c||(c={}));var m=function(i){var l=i.className,r=i.size,s=i.children;return e.createElement("div",{className:l,"data-testid":"highlightbox-wrapper"},e.createElement("div",{className:a.highlightbox__row},e.createElement("div",{className:t(a.highlightbox__col,r===c.medium&&a["highlightbox__col--offset"])},s)))},n=function(i){var l=i.children;return e.createElement("div",{className:a["highlightbox__content-wrapper"]},e.createElement("div",{className:t(a.highlightbox__row)},l))},h=function(h){var d=h.children,g=h.color,u=void 0===g?"white":g,f=h.size,_=void 0===f?c.medium:f,p=h.testId,b=h.svgIcon,x=h.htmlMarkup,v=void 0===x?"div":x,E=h.className,N=s(),j=t(a.highlightbox,a["highlightbox--".concat(u)],a["highlightbox--".concat(_)],b&&a["highlightbox--has-icon"],{container:"medium"===_||"large"===_},E),w=function(){if(b){var t=_===c.large&&N&&N>=o.md?l.Medium:l.Small;return e.createElement(e.Fragment,null,e.createElement("div",{className:a.highlightbox__icon},e.createElement(r,{svgIcon:b,size:t})),e.createElement("div",{className:a.highlightbox__content},d))}return d},z=v;return _===c.medium?e.createElement(m,{className:j,size:_},e.createElement(z,{className:a["highlightbox__content-wrapper"],"data-testid":p,"data-analyticsid":i.HighlightBox},w())):_===c.large&&b?e.createElement(m,{className:j,size:_},e.createElement(n,null,e.createElement(z,{className:t(a.highlightbox__col,a["highlightbox__col--large-with-icon"]),"data-testid":p,"data-analyticsid":i.HighlightBox},w()))):_===c.large?e.createElement(m,{className:j,size:_},e.createElement(n,null,e.createElement(z,{className:t(a.highlightbox__col,a["highlightbox__col--offset"]),"data-testid":p,"data-analyticsid":i.HighlightBox},w()))):_===c.fluid?e.createElement(z,{className:j,"data-testid":p},w()):null};export{c as HighlightBoxSize,h as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{H as HorizontalScroll,H as default}from"../../HorizontalScroll-
|
|
1
|
+
export{H as HorizontalScroll,H as default}from"../../HorizontalScroll-a4634c75.js";import"react";import"../../index-d1c0552c.js";import"../../useIsVisible-2ffbdea2.js";import"../../_rollupPluginBabelHelpers-0f007973.js";import"./styles.module.scss";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{b as ModalSize,a as ModalVariants,M as default}from"../../Modal-
|
|
1
|
+
export{b as ModalSize,a as ModalVariants,M as default}from"../../Modal-055c753d.js";import"../../_rollupPluginBabelHelpers-0f007973.js";import"react";import"../../index-d1c0552c.js";import"../../palette-f206f488.js";import"../../Button-0917df8e.js";import"../../_tslib-b219470a.js";import"../../constants-dbdea596.js";import"../../color-e7d082c1.js";import"../../index-d1c9177a.js";import"../../grid-c105cad1.js";import"../../Icon-d69d65b3.js";import"../../useUuid-3b1e73f2.js";import"../../uuid-11037462.js";import"../../Loader-06293a27.js";import"../Loader/styles.module.scss";import"../../useHover-18479690.js";import"../../useBreakpoint-a74f5af5.js";import"../Button/styles.module.scss";import"./styles.module.scss";import"../../AlertSignStroke-32f09751.js";import"../../AlertSignFill-5df5b7c7.js";import"../../useFocusTrap-4a5fb65d.js";import"../../useIsVisible-2ffbdea2.js";import"../../Title-01820508.js";import"../Title/styles.module.scss";import"../../Close-08d48540.js";import"../../X-867957f2.js";import"../Close/styles.module.scss";import"../../CheckOutline-86cddefd.js";import"../../index-28ed5ede.js";import"react-dom";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { AriaAttributes } from 'react';
|
|
2
2
|
export declare type NotificationPanelVariants = 'info' | 'warn' | 'alert' | 'crisis';
|
|
3
3
|
export declare type NotificationPanelSizes = 'small' | 'medium' | 'large';
|
|
4
|
+
interface AriaLabelAttributesConfig {
|
|
5
|
+
label?: string;
|
|
6
|
+
id?: string;
|
|
7
|
+
}
|
|
8
|
+
declare type AriaLabelAttributes = Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'>;
|
|
9
|
+
export declare const getAriaLabelAttributes: (config: AriaLabelAttributesConfig) => AriaLabelAttributes | undefined;
|
|
4
10
|
interface NotificationPanelProps {
|
|
5
11
|
/** Adds custom classes to the element. */
|
|
6
12
|
className?: string;
|
|
@@ -25,24 +31,6 @@ interface NotificationPanelProps {
|
|
|
25
31
|
/** Sets the data-testid attribute. */
|
|
26
32
|
testId?: string;
|
|
27
33
|
}
|
|
28
|
-
export declare const variantToColorMap: {
|
|
29
|
-
info: {
|
|
30
|
-
color: string;
|
|
31
|
-
depth: number;
|
|
32
|
-
};
|
|
33
|
-
warn: {
|
|
34
|
-
color: string;
|
|
35
|
-
depth: number;
|
|
36
|
-
};
|
|
37
|
-
alert: {
|
|
38
|
-
color: string;
|
|
39
|
-
depth: number;
|
|
40
|
-
};
|
|
41
|
-
crisis: {
|
|
42
|
-
color: string;
|
|
43
|
-
depth: number;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
34
|
declare const NotificationPanel: React.ForwardRefExoticComponent<NotificationPanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
47
35
|
export default NotificationPanel;
|
|
48
36
|
//# sourceMappingURL=NotificationPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationPanel.d.ts","sourceRoot":"","sources":["../../../src/components/NotificationPanel/NotificationPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NotificationPanel.d.ts","sourceRoot":"","sources":["../../../src/components/NotificationPanel/NotificationPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAa9C,oBAAY,yBAAyB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAC7E,oBAAY,sBAAsB,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAUlE,UAAU,yBAAyB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,aAAK,mBAAmB,GAAG,IAAI,CAAC,cAAc,EAAE,YAAY,GAAG,iBAAiB,CAAC,CAAC;AAElF,eAAO,MAAM,sBAAsB,WAAY,yBAAyB,KAAG,mBAAmB,GAAG,SAahG,CAAC;AAEF,UAAU,sBAAsB;IAC9B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,mEAAmE;IACnE,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,0DAA0D;IAC1D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mDAAmD;IACnD,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAC9B,sFAAsF;IACtF,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IAClE,8FAA8F;IAC9F,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAiBD,QAAA,MAAM,iBAAiB,+FAqDrB,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
|