@fremtind/jokul 4.3.0 → 4.4.0

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.
Files changed (55) hide show
  1. package/build/build-stats.html +1 -1
  2. package/build/cjs/components/checkbox/Checkbox.cjs +1 -1
  3. package/build/cjs/components/checkbox/Checkbox.cjs.map +1 -1
  4. package/build/cjs/components/cookie-consent/CookieConsent.cjs +1 -1
  5. package/build/cjs/components/cookie-consent/CookieConsent.cjs.map +1 -1
  6. package/build/cjs/components/cookie-consent/CookieConsent.d.cts +1 -1
  7. package/build/cjs/components/cookie-consent/types.d.cts +4 -0
  8. package/build/cjs/components/radio-button/BaseRadioButton.cjs +1 -1
  9. package/build/cjs/components/radio-button/BaseRadioButton.cjs.map +1 -1
  10. package/build/es/components/checkbox/Checkbox.js +1 -1
  11. package/build/es/components/checkbox/Checkbox.js.map +1 -1
  12. package/build/es/components/cookie-consent/CookieConsent.d.ts +1 -1
  13. package/build/es/components/cookie-consent/CookieConsent.js +1 -1
  14. package/build/es/components/cookie-consent/CookieConsent.js.map +1 -1
  15. package/build/es/components/cookie-consent/types.d.ts +4 -0
  16. package/build/es/components/radio-button/BaseRadioButton.js +1 -1
  17. package/build/es/components/radio-button/BaseRadioButton.js.map +1 -1
  18. package/package.json +1 -1
  19. package/styles/components/checkbox/checkbox.css +13 -9
  20. package/styles/components/checkbox/checkbox.min.css +1 -1
  21. package/styles/components/checkbox/checkbox.scss +25 -22
  22. package/styles/components/checkbox-panel/checkbox-panel.css +28 -22
  23. package/styles/components/checkbox-panel/checkbox-panel.min.css +1 -1
  24. package/styles/components/countdown/countdown.css +2 -2
  25. package/styles/components/countdown/countdown.min.css +1 -1
  26. package/styles/components/feedback/feedback.css +2 -2
  27. package/styles/components/feedback/feedback.min.css +1 -1
  28. package/styles/components/file-input/file-input.css +9 -9
  29. package/styles/components/file-input/file-input.min.css +1 -1
  30. package/styles/components/input-group/input-group.css +2 -2
  31. package/styles/components/input-group/input-group.min.css +1 -1
  32. package/styles/components/input-panel/input-panel.css +15 -13
  33. package/styles/components/input-panel/input-panel.min.css +1 -1
  34. package/styles/components/input-panel/input-panel.scss +17 -15
  35. package/styles/components/loader/loader.css +6 -6
  36. package/styles/components/loader/loader.min.css +1 -1
  37. package/styles/components/loader/skeleton-loader.css +3 -3
  38. package/styles/components/loader/skeleton-loader.min.css +1 -1
  39. package/styles/components/message/message.css +2 -2
  40. package/styles/components/message/message.min.css +1 -1
  41. package/styles/components/progress-bar/progress-bar.css +1 -1
  42. package/styles/components/progress-bar/progress-bar.min.css +1 -1
  43. package/styles/components/radio-button/radio-button.css +12 -8
  44. package/styles/components/radio-button/radio-button.min.css +1 -1
  45. package/styles/components/radio-button/radio-button.scss +20 -17
  46. package/styles/components/radio-panel/radio-panel.css +15 -13
  47. package/styles/components/radio-panel/radio-panel.min.css +1 -1
  48. package/styles/components/segmented-control/segmented-control.css +14 -10
  49. package/styles/components/segmented-control/segmented-control.min.css +1 -1
  50. package/styles/components/system-message/system-message.css +2 -2
  51. package/styles/components/system-message/system-message.min.css +1 -1
  52. package/styles/components/toast/toast.css +4 -4
  53. package/styles/components/toast/toast.min.css +1 -1
  54. package/styles/styles.css +64 -54
  55. package/styles/styles.min.css +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("../../../clsx-E3yX_9sL.cjs"),t=require("react"),r=require("../../hooks/useId/useId.cjs"),a=t.forwardRef((a,i)=>{const{id:n,children:s,invalid:l,className:o,inline:d=!1,"data-testautoid":u,checked:k,indeterminate:h,...x}=a,b=t.useRef(null);t.useImperativeHandle(i,()=>b.current,[]);const j=r.useId(n||"jkl-checkbox",{generateSuffix:!n});return t.useEffect(()=>{!0===k&&!0===h&&"production"!==process.env.NODE_ENV&&console.warn("A Checkbox can not be both checked and indeterminate, and will be treated as checked"),b.current&&(b.current.indeterminate=!k&&!!h)},[k,h]),e.jsxs("div",{className:c.clsx("jkl-checkbox",o,{"jkl-checkbox--inline":d,"jkl-checkbox--error":l}),children:[e.jsx("label",{htmlFor:j,className:"jkl-checkbox__label",children:s}),e.jsx("input",{id:j,ref:b,className:"jkl-checkbox__input","data-testid":"jkl-checkbox-input","aria-invalid":l,type:"checkbox","data-testautoid":u,checked:k,...x})]})});a.displayName="Checkbox",exports.Checkbox=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("../../../clsx-E3yX_9sL.cjs"),t=require("react"),r=require("../../hooks/useId/useId.cjs"),a=t.forwardRef((a,i)=>{const{id:n,children:s,invalid:l,className:o,inline:d=!1,"data-testautoid":u,checked:k,indeterminate:h,...x}=a,b=t.useRef(null);t.useImperativeHandle(i,()=>b.current,[]);const j=r.useId(n||"jkl-checkbox",{generateSuffix:!n});return t.useEffect(()=>{!0===k&&!0===h&&"production"!==process.env.NODE_ENV&&console.warn("A Checkbox can not be both checked and indeterminate, and will be treated as checked"),b.current&&(b.current.indeterminate=!k&&!!h)},[k,h]),e.jsxs("div",{className:c.clsx("jkl-checkbox",o,{"jkl-checkbox--inline":d,"jkl-checkbox--error":l}),children:[e.jsx("input",{id:j,ref:b,className:"jkl-checkbox__input","data-testid":"jkl-checkbox-input","aria-invalid":l,type:"checkbox","data-testautoid":u,checked:k,...x}),e.jsx("label",{htmlFor:j,className:"jkl-checkbox__label",children:s})]})});a.displayName="Checkbox",exports.Checkbox=a;
2
2
  //# sourceMappingURL=Checkbox.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.cjs","sources":["../../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, useEffect, useImperativeHandle, useRef } from \"react\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport type { CheckboxProps } from \"./types.js\";\n\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n (props, ref) => {\n const {\n id,\n children,\n invalid,\n className,\n inline = false,\n \"data-testautoid\": testAutoId,\n checked,\n indeterminate,\n ...rest\n } = props;\n\n const inputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(\n ref,\n () => inputRef.current as HTMLInputElement,\n [],\n );\n\n const inputId = useId(id || \"jkl-checkbox\", { generateSuffix: !id });\n\n useEffect(() => {\n if (\n checked === true &&\n indeterminate === true &&\n process.env.NODE_ENV !== \"production\"\n ) {\n console.warn(\n \"A Checkbox can not be both checked and indeterminate, and will be treated as checked\",\n );\n }\n if (inputRef.current) {\n inputRef.current.indeterminate = !checked && !!indeterminate;\n }\n }, [checked, indeterminate]);\n\n return (\n <div\n className={clsx(\"jkl-checkbox\", className, {\n \"jkl-checkbox--inline\": inline,\n \"jkl-checkbox--error\": invalid,\n })}\n >\n <label htmlFor={inputId} className=\"jkl-checkbox__label\">\n {children}\n </label>\n <input\n id={inputId}\n ref={inputRef}\n className=\"jkl-checkbox__input\"\n data-testid=\"jkl-checkbox-input\"\n aria-invalid={invalid}\n type=\"checkbox\"\n data-testautoid={testAutoId}\n checked={checked}\n {...rest}\n />\n </div>\n );\n },\n);\n\nCheckbox.displayName = \"Checkbox\";\n"],"names":["Checkbox","forwardRef","props","ref","id","children","invalid","className","inline","testAutoId","checked","indeterminate","rest","inputRef","useRef","useImperativeHandle","current","inputId","useId","generateSuffix","useEffect","process","env","NODE_ENV","console","warn","jsxs","clsx","jsx","htmlFor","type","displayName"],"mappings":"yNAKaA,EAAWC,EAAAA,WACpB,CAACC,EAAOC,KACJ,MACIC,GAAAA,EACAC,SAAAA,EACAC,QAAAA,EACAC,UAAAA,EACAC,OAAAA,GAAS,EACT,kBAAmBC,EACnBC,QAAAA,EACAC,cAAAA,KACGC,GACHV,EAEEW,EAAWC,EAAAA,OAAyB,MAC1CC,EAAAA,oBACIZ,EACA,IAAMU,EAASG,QACf,IAGJ,MAAMC,EAAUC,EAAAA,MAAMd,GAAM,eAAgB,CAAEe,gBAAiBf,IAE/DgB,OAAAA,EAAAA,UAAU,MAEU,IAAZV,IACkB,IAAlBC,GACyB,eAAzBU,QAAQC,IAAIC,UAEZC,QAAQC,KACJ,wFAGJZ,EAASG,UACTH,EAASG,QAAQL,eAAiBD,KAAaC,IAEpD,CAACD,EAASC,IAGTe,EAAAA,KAAC,MAAA,CACGnB,UAAWoB,EAAAA,KAAK,eAAgBpB,EAAW,CACvC,uBAAwBC,EACxB,sBAAuBF,IAG3BD,SAAA,CAAAuB,EAAAA,IAAC,QAAA,CAAMC,QAASZ,EAASV,UAAU,sBAC9BF,SAAAA,IAELuB,EAAAA,IAAC,QAAA,CACGxB,GAAIa,EACJd,IAAKU,EACLN,UAAU,sBACV,cAAY,qBACZ,eAAcD,EACdwB,KAAK,WACL,kBAAiBrB,EACjBC,QAAAA,KACIE,SAOxBZ,EAAS+B,YAAc"}
1
+ {"version":3,"file":"Checkbox.cjs","sources":["../../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, useEffect, useImperativeHandle, useRef } from \"react\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport type { CheckboxProps } from \"./types.js\";\n\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n (props, ref) => {\n const {\n id,\n children,\n invalid,\n className,\n inline = false,\n \"data-testautoid\": testAutoId,\n checked,\n indeterminate,\n ...rest\n } = props;\n\n const inputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(\n ref,\n () => inputRef.current as HTMLInputElement,\n [],\n );\n\n const inputId = useId(id || \"jkl-checkbox\", { generateSuffix: !id });\n\n useEffect(() => {\n if (\n checked === true &&\n indeterminate === true &&\n process.env.NODE_ENV !== \"production\"\n ) {\n console.warn(\n \"A Checkbox can not be both checked and indeterminate, and will be treated as checked\",\n );\n }\n if (inputRef.current) {\n inputRef.current.indeterminate = !checked && !!indeterminate;\n }\n }, [checked, indeterminate]);\n\n return (\n <div\n className={clsx(\"jkl-checkbox\", className, {\n \"jkl-checkbox--inline\": inline,\n \"jkl-checkbox--error\": invalid,\n })}\n >\n <input\n id={inputId}\n ref={inputRef}\n className=\"jkl-checkbox__input\"\n data-testid=\"jkl-checkbox-input\"\n aria-invalid={invalid}\n type=\"checkbox\"\n data-testautoid={testAutoId}\n checked={checked}\n {...rest}\n />\n <label htmlFor={inputId} className=\"jkl-checkbox__label\">\n {children}\n </label>\n </div>\n );\n },\n);\n\nCheckbox.displayName = \"Checkbox\";\n"],"names":["Checkbox","forwardRef","props","ref","id","children","invalid","className","inline","testAutoId","checked","indeterminate","rest","inputRef","useRef","useImperativeHandle","current","inputId","useId","generateSuffix","useEffect","process","env","NODE_ENV","console","warn","jsxs","clsx","jsx","type","htmlFor","displayName"],"mappings":"yNAKaA,EAAWC,EAAAA,WACpB,CAACC,EAAOC,KACJ,MACIC,GAAAA,EACAC,SAAAA,EACAC,QAAAA,EACAC,UAAAA,EACAC,OAAAA,GAAS,EACT,kBAAmBC,EACnBC,QAAAA,EACAC,cAAAA,KACGC,GACHV,EAEEW,EAAWC,EAAAA,OAAyB,MAC1CC,EAAAA,oBACIZ,EACA,IAAMU,EAASG,QACf,IAGJ,MAAMC,EAAUC,EAAAA,MAAMd,GAAM,eAAgB,CAAEe,gBAAiBf,IAE/DgB,OAAAA,EAAAA,UAAU,MAEU,IAAZV,IACkB,IAAlBC,GACyB,eAAzBU,QAAQC,IAAIC,UAEZC,QAAQC,KACJ,wFAGJZ,EAASG,UACTH,EAASG,QAAQL,eAAiBD,KAAaC,IAEpD,CAACD,EAASC,IAGTe,EAAAA,KAAC,MAAA,CACGnB,UAAWoB,EAAAA,KAAK,eAAgBpB,EAAW,CACvC,uBAAwBC,EACxB,sBAAuBF,IAG3BD,SAAA,CAAAuB,EAAAA,IAAC,QAAA,CACGxB,GAAIa,EACJd,IAAKU,EACLN,UAAU,sBACV,cAAY,qBACZ,eAAcD,EACduB,KAAK,WACL,kBAAiBpB,EACjBC,QAAAA,KACIE,UAEP,QAAA,CAAMkB,QAASb,EAASV,UAAU,sBAC9BF,SAAAA,SAOrBL,EAAS+B,YAAc"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),o=require("react-dom"),t=require("../button/Button.cjs"),r=require("../flex/Flex.cjs"),i=require("../link/Link.cjs"),s=require("../modal/Modal.cjs"),a=require("../modal/useModal.cjs"),l=require("./CookieConsentContext.cjs"),d=require("./cookieConsentUtils.cjs");exports.CookieConsent=({blocking:c,onAccept:u,aboutPage:k="https://www.fremtind.no/informasjonskapsler",...j})=>{const{currentConsent:m,cookieName:h,cookieDomain:f,cookiePath:p,isOpen:g,setIsOpen:x,updateCurrentConsents:b}=l.useInternalState(),[v,C]=a.useModal({id:`jkl-cookie-modal-${n.useId()}`,role:c?"alertdialog":"dialog",title:"Informasjonskapsler"});if(n.useEffect(()=>{g?v?.show():v?.hide()},[v,g]),n.useEffect(()=>{const e=()=>x(!1);return v?.on("hide",e),()=>{v?.off("hide",e)}},[v,x]),typeof document>"u")return null;if(typeof navigator<"u"&&!navigator.cookieEnabled)return u?.({functional:"denied",statistics:"denied",marketing:"denied"}),null;const y=e=>{const n={...m,functional:e,statistics:e,marketing:"denied"};d.setConsentCookie({consent:n,name:h,domain:f,path:p}),u?.(n),b(),v?.hide()};return o.createPortal(e.jsxs(s.ModalContainer,{...C.container,...j,"data-cookie-consent-open":g,children:[e.jsx(s.ModalOverlay,{...C.overlay}),e.jsxs(s.Modal,{...C.modal,children:[e.jsx(s.ModalHeader,{children:e.jsx(s.ModalTitle,{...C.title,children:"Får vi bruke valgfrie informasjonskapsler?"})}),e.jsx(s.ModalBody,{children:e.jsxs(r.Flex,{direction:"column",gap:"m",children:[e.jsx("p",{children:"Vi ønsker å samle anonym statistikk for å forstå hvordan nettsidene våre brukes. Det hjelper oss til å gjøre innhold og løsninger bedre og mer brukervennlige."}),e.jsxs("p",{children:[e.jsx(i.Link,{href:k,target:"_blank",children:"Les mer om hvilke informasjonskapsler vi lagrer her"}),"."]})]})}),e.jsxs(s.ModalActions,{children:[e.jsx(t.Button,{variant:"secondary","data-testid":"jkl-cookie-consent-godta",type:"button",onClick:()=>y("accepted"),children:"Ja, det er greit"}),e.jsx(t.Button,{variant:"secondary","data-testid":"jkl-cookie-consent-nekt",type:"button",onClick:()=>y("denied"),children:"Nei takk"})]})]})]}),document.body)};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),t=require("react-dom"),o=require("../button/Button.cjs"),r=require("../flex/Flex.cjs"),i=require("../link/Link.cjs"),s=require("../modal/Modal.cjs"),a=require("../modal/useModal.cjs"),l=require("./CookieConsentContext.cjs"),d=require("./cookieConsentUtils.cjs");exports.CookieConsent=({blocking:c,onAccept:u,aboutPage:k="https://www.fremtind.no/informasjonskapsler",aboutPageLinkText:j="Les mer om hvilke informasjons­kapsler vi lagrer her",...m})=>{const{currentConsent:h,cookieName:f,cookieDomain:p,cookiePath:g,isOpen:x,setIsOpen:b,updateCurrentConsents:v}=l.useInternalState(),[C,y]=a.useModal({id:`jkl-cookie-modal-${n.useId()}`,role:c?"alertdialog":"dialog",title:"Informasjonskapsler"});if(n.useEffect(()=>{x?C?.show():C?.hide()},[C,x]),n.useEffect(()=>{const e=()=>b(!1);return C?.on("hide",e),()=>{C?.off("hide",e)}},[C,b]),typeof document>"u")return null;if(typeof navigator<"u"&&!navigator.cookieEnabled)return u?.({functional:"denied",statistics:"denied",marketing:"denied"}),null;const M=e=>{const n={...h,functional:e,statistics:e,marketing:"denied"};d.setConsentCookie({consent:n,name:f,domain:p,path:g}),u?.(n),v(),C?.hide()};return t.createPortal(e.jsxs(s.ModalContainer,{...y.container,...m,"data-cookie-consent-open":x,children:[e.jsx(s.ModalOverlay,{...y.overlay}),e.jsxs(s.Modal,{...y.modal,children:[e.jsx(s.ModalHeader,{children:e.jsx(s.ModalTitle,{...y.title,children:"Får vi bruke valgfrie informasjons­kapsler?"})}),e.jsx(s.ModalBody,{children:e.jsxs(r.Flex,{direction:"column",gap:"m",children:[e.jsx("p",{children:"Fremtind ønsker å samle anonym statistikk for å forstå hvordan nettsidene våre brukes. Det hjelper oss til å gjøre innhold og løsninger bedre og mer brukervennlige."}),e.jsxs("p",{children:[e.jsx(i.Link,{href:k,target:"_blank",children:j}),"."]})]})}),e.jsxs(s.ModalActions,{children:[e.jsx(o.Button,{variant:"secondary","data-testid":"jkl-cookie-consent-godta",type:"button",onClick:()=>M("accepted"),children:"Ja, det er greit"}),e.jsx(o.Button,{variant:"secondary","data-testid":"jkl-cookie-consent-nekt",type:"button",onClick:()=>M("denied"),children:"Nei takk"})]})]})]}),document.body)};
2
2
  //# sourceMappingURL=CookieConsent.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CookieConsent.cjs","sources":["../../../../src/components/cookie-consent/CookieConsent.tsx"],"sourcesContent":["import React, { useEffect, useId } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { Button } from \"../button/Button.js\";\nimport { Flex } from \"../flex/index.js\";\nimport { Link } from \"../link/index.js\";\nimport {\n Modal,\n ModalActions,\n ModalBody,\n ModalContainer,\n ModalHeader,\n ModalOverlay,\n ModalTitle,\n} from \"../modal/Modal.js\";\nimport { useModal } from \"../modal/useModal.js\";\nimport { useInternalState } from \"./CookieConsentContext.js\";\nimport { setConsentCookie } from \"./cookieConsentUtils.js\";\nimport type { Consent, ConsentState, CookieConsentProps } from \"./types.js\";\n\nexport const CookieConsent = ({\n blocking,\n onAccept,\n aboutPage = \"https://www.fremtind.no/informasjonskapsler\",\n ...rest\n}: CookieConsentProps): JSX.Element | null => {\n const {\n currentConsent,\n cookieName,\n cookieDomain,\n cookiePath,\n isOpen,\n setIsOpen,\n updateCurrentConsents,\n } = useInternalState();\n\n const [instance, modalConfig] = useModal({\n id: `jkl-cookie-modal-${useId()}`,\n // The optional `role` attribute of the dialog element, either `dialog`\n // (default) or `alertdialog` to make it a modal (preventing closing on\n // click outside of ESC key).\n role: blocking ? \"alertdialog\" : \"dialog\",\n // The required dialog title, mandatory in the document\n // to provide context to assistive technology.\n title: \"Informasjonskapsler\",\n });\n useEffect(() => {\n if (isOpen) {\n instance?.show();\n } else {\n instance?.hide();\n }\n }, [instance, isOpen]);\n\n useEffect(() => {\n const onHide = () => setIsOpen(false);\n instance?.on(\"hide\", onHide);\n return () => {\n instance?.off(\"hide\", onHide);\n };\n }, [instance, setIsOpen]);\n\n if (typeof document === \"undefined\") {\n return null;\n }\n\n // Cookies are disabled in the browser\n if (typeof navigator !== \"undefined\" && !navigator.cookieEnabled) {\n onAccept?.({\n functional: \"denied\",\n statistics: \"denied\",\n marketing: \"denied\",\n });\n\n return null;\n }\n\n const updateCookies = (state: ConsentState) => {\n const updatedConsent: Consent = {\n ...currentConsent,\n functional: state,\n statistics: state,\n marketing: \"denied\",\n };\n\n setConsentCookie({\n consent: updatedConsent,\n name: cookieName,\n domain: cookieDomain,\n path: cookiePath,\n });\n\n onAccept?.(updatedConsent);\n\n updateCurrentConsents();\n\n instance?.hide();\n };\n\n return ReactDOM.createPortal(\n <ModalContainer\n {...modalConfig.container}\n {...rest}\n data-cookie-consent-open={isOpen}\n >\n <ModalOverlay {...modalConfig.overlay} />\n <Modal {...modalConfig.modal}>\n <ModalHeader>\n <ModalTitle {...modalConfig.title}>\n Får vi bruke valgfrie informasjonskapsler?\n </ModalTitle>\n </ModalHeader>\n <ModalBody>\n <Flex direction=\"column\" gap=\"m\">\n <p>\n Vi ønsker å samle anonym statistikk for å forstå\n hvordan nettsidene våre brukes. Det hjelper oss til\n å gjøre innhold og løsninger bedre og mer\n brukervennlige.\n </p>\n <p>\n <Link href={aboutPage} target=\"_blank\">\n Les mer om hvilke informasjonskapsler vi lagrer\n her\n </Link>\n .\n </p>\n </Flex>\n </ModalBody>\n <ModalActions>\n <Button\n variant=\"secondary\"\n data-testid=\"jkl-cookie-consent-godta\"\n type=\"button\"\n onClick={() => updateCookies(\"accepted\")}\n >\n Ja, det er greit\n </Button>\n <Button\n variant=\"secondary\"\n data-testid=\"jkl-cookie-consent-nekt\"\n type=\"button\"\n onClick={() => updateCookies(\"denied\")}\n >\n Nei takk\n </Button>\n </ModalActions>\n </Modal>\n </ModalContainer>,\n document.body,\n );\n};\n"],"names":["blocking","onAccept","aboutPage","rest","currentConsent","cookieName","cookieDomain","cookiePath","isOpen","setIsOpen","updateCurrentConsents","useInternalState","instance","modalConfig","useModal","id","useId","role","title","useEffect","show","hide","onHide","on","off","document","navigator","cookieEnabled","functional","statistics","marketing","updateCookies","state","updatedConsent","setConsentCookie","consent","name","domain","path","ReactDOM","createPortal","jsxs","ModalContainer","container","children","jsx","ModalOverlay","overlay","Modal","modal","ModalHeader","ModalTitle","ModalBody","Flex","direction","gap","Link","href","target","ModalActions","Button","variant","type","onClick","body"],"mappings":"oaAmB6B,EACzBA,SAAAA,EACAC,SAAAA,EACAC,UAAAA,EAAY,iDACTC,MAEH,MACIC,eAAAA,EACAC,WAAAA,EACAC,aAAAA,EACAC,WAAAA,EACAC,OAAAA,EACAC,UAAAA,EACAC,sBAAAA,GACAC,sBAEGC,EAAUC,GAAeC,WAAS,CACrCC,GAAI,oBAAoBC,EAAAA,UAIxBC,KAAMjB,EAAW,cAAgB,SAGjCkB,MAAO,wBAkBX,GAhBAC,EAAAA,UAAU,KACFX,EACAI,GAAUQ,OAEVR,GAAUS,QAEf,CAACT,EAAUJ,IAEdW,EAAAA,UAAU,KACN,MAAMG,EAAS,IAAMb,GAAU,GAC/B,OAAAG,GAAUW,GAAG,OAAQD,GACd,KACHV,GAAUY,IAAI,OAAQF,KAE3B,CAACV,EAAUH,WAEHgB,SAAa,IACpB,OAAO,KAIX,UAAWC,UAAc,MAAgBA,UAAUC,cAC/C,OAAA1B,IAAW,CACP2B,WAAY,SACZC,WAAY,SACZC,UAAW,WAGR,KAGX,MAAMC,EAAiBC,IACnB,MAAMC,EAA0B,IACzB7B,EACHwB,WAAYI,EACZH,WAAYG,EACZF,UAAW,UAGfI,mBAAiB,CACbC,QAASF,EACTG,KAAM/B,EACNgC,OAAQ/B,EACRgC,KAAM/B,IAGVN,IAAWgC,GAEXvB,IAEAE,GAAUS,QAGd,OAAOkB,EAASC,aACZC,EAAAA,KAACC,EAAAA,eAAA,IACO7B,EAAY8B,aACZxC,EACJ,2BAA0BK,EAE1BoC,SAAA,CAAAC,EAAAA,IAACC,EAAAA,aAAA,IAAiBjC,EAAYkC,UAC9BN,EAAAA,KAACO,EAAAA,MAAA,IAAUnC,EAAYoC,MACnBL,SAAA,CAAAC,EAAAA,IAACK,EAAAA,aACGN,SAAAC,EAAAA,IAACM,EAAAA,WAAA,IAAetC,EAAYK,MAAO0B,gEAItCQ,EAAAA,UAAA,CACGR,SAAAH,OAACY,EAAAA,MAAKC,UAAU,SAASC,IAAI,IACzBX,SAAA,CAAAC,EAAAA,IAAC,KAAED,SAAA,0KAMF,IAAA,CACGA,SAAA,CAAAC,MAACW,EAAAA,KAAA,CAAKC,KAAMvD,EAAWwD,OAAO,SAASd,SAAA,wDAGhC,mBAKlBe,EAAAA,aAAA,CACGf,SAAA,CAAAC,EAAAA,IAACe,EAAAA,OAAA,CACGC,QAAQ,YACR,cAAY,2BACZC,KAAK,SACLC,QAAS,IAAMhC,EAAc,YAChCa,SAAA,qBAGDC,EAAAA,IAACe,EAAAA,OAAA,CACGC,QAAQ,YACR,cAAY,0BACZC,KAAK,SACLC,QAAS,IAAMhC,EAAc,UAChCa,SAAA,sBAMbnB,SAASuC"}
1
+ {"version":3,"file":"CookieConsent.cjs","sources":["../../../../src/components/cookie-consent/CookieConsent.tsx"],"sourcesContent":["import React, { useEffect, useId } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { Button } from \"../button/Button.js\";\nimport { Flex } from \"../flex/index.js\";\nimport { Link } from \"../link/index.js\";\nimport {\n Modal,\n ModalActions,\n ModalBody,\n ModalContainer,\n ModalHeader,\n ModalOverlay,\n ModalTitle,\n} from \"../modal/Modal.js\";\nimport { useModal } from \"../modal/useModal.js\";\nimport { useInternalState } from \"./CookieConsentContext.js\";\nimport { setConsentCookie } from \"./cookieConsentUtils.js\";\nimport type { Consent, ConsentState, CookieConsentProps } from \"./types.js\";\n\nexport const CookieConsent = ({\n blocking,\n onAccept,\n aboutPage = \"https://www.fremtind.no/informasjonskapsler\",\n aboutPageLinkText = \"Les mer om hvilke informasjons­kapsler vi lagrer her\",\n ...rest\n}: CookieConsentProps): JSX.Element | null => {\n const {\n currentConsent,\n cookieName,\n cookieDomain,\n cookiePath,\n isOpen,\n setIsOpen,\n updateCurrentConsents,\n } = useInternalState();\n\n const [instance, modalConfig] = useModal({\n id: `jkl-cookie-modal-${useId()}`,\n // The optional `role` attribute of the dialog element, either `dialog`\n // (default) or `alertdialog` to make it a modal (preventing closing on\n // click outside of ESC key).\n role: blocking ? \"alertdialog\" : \"dialog\",\n // The required dialog title, mandatory in the document\n // to provide context to assistive technology.\n title: \"Informasjonskapsler\",\n });\n useEffect(() => {\n if (isOpen) {\n instance?.show();\n } else {\n instance?.hide();\n }\n }, [instance, isOpen]);\n\n useEffect(() => {\n const onHide = () => setIsOpen(false);\n instance?.on(\"hide\", onHide);\n return () => {\n instance?.off(\"hide\", onHide);\n };\n }, [instance, setIsOpen]);\n\n if (typeof document === \"undefined\") {\n return null;\n }\n\n // Cookies are disabled in the browser\n if (typeof navigator !== \"undefined\" && !navigator.cookieEnabled) {\n onAccept?.({\n functional: \"denied\",\n statistics: \"denied\",\n marketing: \"denied\",\n });\n\n return null;\n }\n\n const updateCookies = (state: ConsentState) => {\n const updatedConsent: Consent = {\n ...currentConsent,\n functional: state,\n statistics: state,\n marketing: \"denied\",\n };\n\n setConsentCookie({\n consent: updatedConsent,\n name: cookieName,\n domain: cookieDomain,\n path: cookiePath,\n });\n\n onAccept?.(updatedConsent);\n\n updateCurrentConsents();\n\n instance?.hide();\n };\n\n return ReactDOM.createPortal(\n <ModalContainer\n {...modalConfig.container}\n {...rest}\n data-cookie-consent-open={isOpen}\n >\n <ModalOverlay {...modalConfig.overlay} />\n <Modal {...modalConfig.modal}>\n <ModalHeader>\n <ModalTitle {...modalConfig.title}>\n Får vi bruke valgfrie informasjons&shy;kapsler?\n </ModalTitle>\n </ModalHeader>\n <ModalBody>\n <Flex direction=\"column\" gap=\"m\">\n <p>\n Fremtind ønsker å samle anonym statistikk for å\n forstå hvordan nettsidene våre brukes. Det hjelper\n oss til å gjøre innhold og løsninger bedre og mer\n brukervennlige.\n </p>\n <p>\n <Link href={aboutPage} target=\"_blank\">\n {aboutPageLinkText}\n </Link>\n .\n </p>\n </Flex>\n </ModalBody>\n <ModalActions>\n <Button\n variant=\"secondary\"\n data-testid=\"jkl-cookie-consent-godta\"\n type=\"button\"\n onClick={() => updateCookies(\"accepted\")}\n >\n Ja, det er greit\n </Button>\n <Button\n variant=\"secondary\"\n data-testid=\"jkl-cookie-consent-nekt\"\n type=\"button\"\n onClick={() => updateCookies(\"denied\")}\n >\n Nei takk\n </Button>\n </ModalActions>\n </Modal>\n </ModalContainer>,\n document.body,\n );\n};\n"],"names":["blocking","onAccept","aboutPage","aboutPageLinkText","rest","currentConsent","cookieName","cookieDomain","cookiePath","isOpen","setIsOpen","updateCurrentConsents","useInternalState","instance","modalConfig","useModal","id","useId","role","title","useEffect","show","hide","onHide","on","off","document","navigator","cookieEnabled","functional","statistics","marketing","updateCookies","state","updatedConsent","setConsentCookie","consent","name","domain","path","ReactDOM","createPortal","jsxs","ModalContainer","container","children","jsx","ModalOverlay","overlay","Modal","modal","ModalHeader","ModalTitle","ModalBody","Flex","direction","gap","Link","href","target","ModalActions","Button","variant","type","onClick","body"],"mappings":"oaAmB6B,EACzBA,SAAAA,EACAC,SAAAA,EACAC,UAAAA,EAAY,8CACZC,kBAAAA,EAAoB,0DACjBC,MAEH,MACIC,eAAAA,EACAC,WAAAA,EACAC,aAAAA,EACAC,WAAAA,EACAC,OAAAA,EACAC,UAAAA,EACAC,sBAAAA,GACAC,sBAEGC,EAAUC,GAAeC,WAAS,CACrCC,GAAI,oBAAoBC,EAAAA,UAIxBC,KAAMlB,EAAW,cAAgB,SAGjCmB,MAAO,wBAkBX,GAhBAC,EAAAA,UAAU,KACFX,EACAI,GAAUQ,OAEVR,GAAUS,QAEf,CAACT,EAAUJ,IAEdW,EAAAA,UAAU,KACN,MAAMG,EAAS,IAAMb,GAAU,GAC/B,OAAAG,GAAUW,GAAG,OAAQD,GACd,KACHV,GAAUY,IAAI,OAAQF,KAE3B,CAACV,EAAUH,WAEHgB,SAAa,IACpB,OAAO,KAIX,UAAWC,UAAc,MAAgBA,UAAUC,cAC/C,OAAA3B,IAAW,CACP4B,WAAY,SACZC,WAAY,SACZC,UAAW,WAGR,KAGX,MAAMC,EAAiBC,IACnB,MAAMC,EAA0B,IACzB7B,EACHwB,WAAYI,EACZH,WAAYG,EACZF,UAAW,UAGfI,mBAAiB,CACbC,QAASF,EACTG,KAAM/B,EACNgC,OAAQ/B,EACRgC,KAAM/B,IAGVP,IAAWiC,GAEXvB,IAEAE,GAAUS,QAGd,OAAOkB,EAASC,aACZC,EAAAA,KAACC,EAAAA,eAAA,IACO7B,EAAY8B,aACZxC,EACJ,2BAA0BK,EAE1BoC,SAAA,CAAAC,EAAAA,IAACC,EAAAA,aAAA,IAAiBjC,EAAYkC,UAC9BN,EAAAA,KAACO,EAAAA,MAAA,IAAUnC,EAAYoC,MACnBL,SAAA,CAAAC,EAAAA,IAACK,EAAAA,aACGN,SAAAC,EAAAA,IAACM,EAAAA,WAAA,IAAetC,EAAYK,MAAO0B,iEAItCQ,EAAAA,UAAA,CACGR,SAAAH,OAACY,EAAAA,MAAKC,UAAU,SAASC,IAAI,IACzBX,SAAA,CAAAC,EAAAA,IAAC,KAAED,SAAA,gLAMF,IAAA,CACGA,SAAA,CAAAC,MAACW,EAAAA,KAAA,CAAKC,KAAMxD,EAAWyD,OAAO,SACzBd,SAAA1C,IACE,mBAKlByD,EAAAA,aAAA,CACGf,SAAA,CAAAC,EAAAA,IAACe,EAAAA,OAAA,CACGC,QAAQ,YACR,cAAY,2BACZC,KAAK,SACLC,QAAS,IAAMhC,EAAc,YAChCa,SAAA,qBAGDC,EAAAA,IAACe,EAAAA,OAAA,CACGC,QAAQ,YACR,cAAY,0BACZC,KAAK,SACLC,QAAS,IAAMhC,EAAc,UAChCa,SAAA,sBAMbnB,SAASuC"}
@@ -1,2 +1,2 @@
1
1
  import { CookieConsentProps } from './types.cjs';
2
- export declare const CookieConsent: ({ blocking, onAccept, aboutPage, ...rest }: CookieConsentProps) => JSX.Element | null;
2
+ export declare const CookieConsent: ({ blocking, onAccept, aboutPage, aboutPageLinkText, ...rest }: CookieConsentProps) => JSX.Element | null;
@@ -13,6 +13,10 @@ export interface CookieConsentProps {
13
13
  * Lenke til informasjonssiden til cookiene i løsningen din.
14
14
  */
15
15
  aboutPage: string;
16
+ /**
17
+ * Tekst for lenken til informasjonssiden.
18
+ */
19
+ aboutPageLinkText?: string;
16
20
  }
17
21
  export type AcceptConsentCallback = (consent: Consent) => void;
18
22
  export type ConsentComponentBaseProps = {
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("../../../clsx-E3yX_9sL.cjs"),i=require("react"),t=require("../../hooks/useId/useId.cjs"),r=i.forwardRef((i,r)=>{const{id:l,className:n,checked:o,children:s,label:d,inline:u,invalid:c,name:j,value:b,onChange:k,...m}=i,h=t.useId(l||"jkl-radio-button",{generateSuffix:!l});return e.jsxs("div",{className:a.clsx("jkl-radio-button",n,{"jkl-radio-button--inline":u,"jkl-radio-button--error":c}),children:[e.jsx("label",{"data-testid":"jkl-radio-button__label-tag",htmlFor:h,className:"jkl-radio-button__label",children:d||s}),e.jsx("input",{name:j,ref:r,...m,id:h,className:"jkl-radio-button__input",type:"radio",onChange:k,value:b,checked:o,"aria-invalid":c||m["aria-invalid"]})]})});r.displayName="BaseRadioButton",exports.BaseRadioButton=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("../../../clsx-E3yX_9sL.cjs"),i=require("react"),t=require("../../hooks/useId/useId.cjs"),r=i.forwardRef((i,r)=>{const{id:l,className:n,checked:o,children:s,label:d,inline:u,invalid:c,name:j,value:b,onChange:k,...m}=i,h=t.useId(l||"jkl-radio-button",{generateSuffix:!l});return e.jsxs("div",{className:a.clsx("jkl-radio-button",n,{"jkl-radio-button--inline":u,"jkl-radio-button--error":c}),children:[e.jsx("input",{name:j,ref:r,...m,id:h,className:"jkl-radio-button__input",type:"radio",onChange:k,value:b,checked:o,"aria-invalid":c||m["aria-invalid"]}),e.jsx("label",{"data-testid":"jkl-radio-button__label-tag",htmlFor:h,className:"jkl-radio-button__label",children:d||s})]})});r.displayName="BaseRadioButton",exports.BaseRadioButton=r;
2
2
  //# sourceMappingURL=BaseRadioButton.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseRadioButton.cjs","sources":["../../../../src/components/radio-button/BaseRadioButton.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef } from \"react\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport type { BaseRadioButtonProps } from \"./types.js\";\n\nexport const BaseRadioButton = forwardRef<\n HTMLInputElement,\n BaseRadioButtonProps\n>((props, ref) => {\n const {\n id,\n className,\n checked,\n children,\n label,\n inline,\n invalid,\n name,\n value,\n onChange,\n ...rest\n } = props;\n\n const inputId = useId(id || \"jkl-radio-button\", { generateSuffix: !id });\n\n return (\n <div\n className={clsx(\"jkl-radio-button\", className, {\n \"jkl-radio-button--inline\": inline,\n \"jkl-radio-button--error\": invalid,\n })}\n >\n <label\n data-testid=\"jkl-radio-button__label-tag\"\n htmlFor={inputId}\n className=\"jkl-radio-button__label\"\n >\n {label || children}\n </label>\n <input\n name={name}\n ref={ref}\n {...rest}\n id={inputId}\n className=\"jkl-radio-button__input\"\n type=\"radio\"\n onChange={onChange}\n value={value}\n checked={checked}\n aria-invalid={invalid || rest[\"aria-invalid\"]}\n />\n </div>\n );\n});\n\nBaseRadioButton.displayName = \"BaseRadioButton\";\n"],"names":["BaseRadioButton","forwardRef","props","ref","id","className","checked","children","label","inline","invalid","name","value","onChange","rest","inputId","useId","generateSuffix","jsxs","clsx","jsx","htmlFor","type","displayName"],"mappings":"yNAKaA,EAAkBC,EAAAA,WAG7B,CAACC,EAAOC,KACN,MACIC,GAAAA,EACAC,UAAAA,EACAC,QAAAA,EACAC,SAAAA,EACAC,MAAAA,EACAC,OAAAA,EACAC,QAAAA,EACAC,KAAAA,EACAC,MAAAA,EACAC,SAAAA,KACGC,GACHZ,EAEEa,EAAUC,EAAAA,MAAMZ,GAAM,mBAAoB,CAAEa,gBAAiBb,IAEnE,OACIc,EAAAA,KAAC,MAAA,CACGb,UAAWc,EAAAA,KAAK,mBAAoBd,EAAW,CAC3C,2BAA4BI,EAC5B,0BAA2BC,IAG/BH,SAAA,CAAAa,EAAAA,IAAC,QAAA,CACG,cAAY,8BACZC,QAASN,EACTV,UAAU,0BAETE,SAAAC,GAASD,IAEda,EAAAA,IAAC,QAAA,CACGT,KAAAA,EACAR,IAAAA,KACIW,EACJV,GAAIW,EACJV,UAAU,0BACViB,KAAK,QACLT,SAAAA,EACAD,MAAAA,EACAN,QAAAA,EACA,eAAcI,GAAWI,EAAK,uBAM9Cd,EAAgBuB,YAAc"}
1
+ {"version":3,"file":"BaseRadioButton.cjs","sources":["../../../../src/components/radio-button/BaseRadioButton.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef } from \"react\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport type { BaseRadioButtonProps } from \"./types.js\";\n\nexport const BaseRadioButton = forwardRef<\n HTMLInputElement,\n BaseRadioButtonProps\n>((props, ref) => {\n const {\n id,\n className,\n checked,\n children,\n label,\n inline,\n invalid,\n name,\n value,\n onChange,\n ...rest\n } = props;\n\n const inputId = useId(id || \"jkl-radio-button\", { generateSuffix: !id });\n\n return (\n <div\n className={clsx(\"jkl-radio-button\", className, {\n \"jkl-radio-button--inline\": inline,\n \"jkl-radio-button--error\": invalid,\n })}\n >\n <input\n name={name}\n ref={ref}\n {...rest}\n id={inputId}\n className=\"jkl-radio-button__input\"\n type=\"radio\"\n onChange={onChange}\n value={value}\n checked={checked}\n aria-invalid={invalid || rest[\"aria-invalid\"]}\n />\n <label\n data-testid=\"jkl-radio-button__label-tag\"\n htmlFor={inputId}\n className=\"jkl-radio-button__label\"\n >\n {label || children}\n </label>\n </div>\n );\n});\n\nBaseRadioButton.displayName = \"BaseRadioButton\";\n"],"names":["BaseRadioButton","forwardRef","props","ref","id","className","checked","children","label","inline","invalid","name","value","onChange","rest","inputId","useId","generateSuffix","jsxs","clsx","jsx","type","htmlFor","displayName"],"mappings":"yNAKaA,EAAkBC,EAAAA,WAG7B,CAACC,EAAOC,KACN,MACIC,GAAAA,EACAC,UAAAA,EACAC,QAAAA,EACAC,SAAAA,EACAC,MAAAA,EACAC,OAAAA,EACAC,QAAAA,EACAC,KAAAA,EACAC,MAAAA,EACAC,SAAAA,KACGC,GACHZ,EAEEa,EAAUC,EAAAA,MAAMZ,GAAM,mBAAoB,CAAEa,gBAAiBb,IAEnE,OACIc,EAAAA,KAAC,MAAA,CACGb,UAAWc,EAAAA,KAAK,mBAAoBd,EAAW,CAC3C,2BAA4BI,EAC5B,0BAA2BC,IAG/BH,SAAA,CAAAa,EAAAA,IAAC,QAAA,CACGT,KAAAA,EACAR,IAAAA,KACIW,EACJV,GAAIW,EACJV,UAAU,0BACVgB,KAAK,QACLR,SAAAA,EACAD,MAAAA,EACAN,QAAAA,EACA,eAAcI,GAAWI,EAAK,kBAElCM,EAAAA,IAAC,QAAA,CACG,cAAY,8BACZE,QAASP,EACTV,UAAU,0BAETE,SAAAC,GAASD,SAM1BP,EAAgBuB,YAAc"}
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as c}from"react/jsx-runtime";import{c as a}from"../../../clsx-BeLtu-UY.js";import{forwardRef as t,useRef as s,useImperativeHandle as r,useEffect as i}from"react";import{useId as n}from"../../hooks/useId/useId.js";const o=t((t,o)=>{const{id:d,children:l,invalid:k,className:h,inline:m=!1,"data-testautoid":u,checked:x,indeterminate:b,...p}=t,f=s(null);r(o,()=>f.current,[]);const j=n(d||"jkl-checkbox",{generateSuffix:!d});return i(()=>{!0===x&&!0===b&&"production"!==process.env.NODE_ENV&&console.warn("A Checkbox can not be both checked and indeterminate, and will be treated as checked"),f.current&&(f.current.indeterminate=!x&&!!b)},[x,b]),e("div",{className:a("jkl-checkbox",h,{"jkl-checkbox--inline":m,"jkl-checkbox--error":k}),children:[c("label",{htmlFor:j,className:"jkl-checkbox__label",children:l}),c("input",{id:j,ref:f,className:"jkl-checkbox__input","data-testid":"jkl-checkbox-input","aria-invalid":k,type:"checkbox","data-testautoid":u,checked:x,...p})]})});o.displayName="Checkbox";export{o as Checkbox};
1
+ import{jsxs as e,jsx as c}from"react/jsx-runtime";import{c as a}from"../../../clsx-BeLtu-UY.js";import{forwardRef as t,useRef as s,useImperativeHandle as r,useEffect as i}from"react";import{useId as n}from"../../hooks/useId/useId.js";const o=t((t,o)=>{const{id:d,children:l,invalid:k,className:h,inline:m=!1,"data-testautoid":u,checked:x,indeterminate:b,...p}=t,f=s(null);r(o,()=>f.current,[]);const j=n(d||"jkl-checkbox",{generateSuffix:!d});return i(()=>{!0===x&&!0===b&&"production"!==process.env.NODE_ENV&&console.warn("A Checkbox can not be both checked and indeterminate, and will be treated as checked"),f.current&&(f.current.indeterminate=!x&&!!b)},[x,b]),e("div",{className:a("jkl-checkbox",h,{"jkl-checkbox--inline":m,"jkl-checkbox--error":k}),children:[c("input",{id:j,ref:f,className:"jkl-checkbox__input","data-testid":"jkl-checkbox-input","aria-invalid":k,type:"checkbox","data-testautoid":u,checked:x,...p}),c("label",{htmlFor:j,className:"jkl-checkbox__label",children:l})]})});o.displayName="Checkbox";export{o as Checkbox};
2
2
  //# sourceMappingURL=Checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sources":["../../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, useEffect, useImperativeHandle, useRef } from \"react\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport type { CheckboxProps } from \"./types.js\";\n\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n (props, ref) => {\n const {\n id,\n children,\n invalid,\n className,\n inline = false,\n \"data-testautoid\": testAutoId,\n checked,\n indeterminate,\n ...rest\n } = props;\n\n const inputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(\n ref,\n () => inputRef.current as HTMLInputElement,\n [],\n );\n\n const inputId = useId(id || \"jkl-checkbox\", { generateSuffix: !id });\n\n useEffect(() => {\n if (\n checked === true &&\n indeterminate === true &&\n process.env.NODE_ENV !== \"production\"\n ) {\n console.warn(\n \"A Checkbox can not be both checked and indeterminate, and will be treated as checked\",\n );\n }\n if (inputRef.current) {\n inputRef.current.indeterminate = !checked && !!indeterminate;\n }\n }, [checked, indeterminate]);\n\n return (\n <div\n className={clsx(\"jkl-checkbox\", className, {\n \"jkl-checkbox--inline\": inline,\n \"jkl-checkbox--error\": invalid,\n })}\n >\n <label htmlFor={inputId} className=\"jkl-checkbox__label\">\n {children}\n </label>\n <input\n id={inputId}\n ref={inputRef}\n className=\"jkl-checkbox__input\"\n data-testid=\"jkl-checkbox-input\"\n aria-invalid={invalid}\n type=\"checkbox\"\n data-testautoid={testAutoId}\n checked={checked}\n {...rest}\n />\n </div>\n );\n },\n);\n\nCheckbox.displayName = \"Checkbox\";\n"],"names":["Checkbox","forwardRef","props","ref","id","children","invalid","className","inline","testAutoId","checked","indeterminate","rest","inputRef","useRef","useImperativeHandle","current","inputId","useId","generateSuffix","useEffect","process","env","NODE_ENV","console","warn","jsxs","clsx","jsx","htmlFor","type","displayName"],"mappings":"0OAKO,MAAMA,EAAWC,EACpB,CAACC,EAAOC,KACJ,MACIC,GAAAA,EACAC,SAAAA,EACAC,QAAAA,EACAC,UAAAA,EACAC,OAAAA,GAAS,EACT,kBAAmBC,EACnBC,QAAAA,EACAC,cAAAA,KACGC,GACHV,EAEEW,EAAWC,EAAyB,MAC1CC,EACIZ,EACA,IAAMU,EAASG,QACf,IAGJ,MAAMC,EAAUC,EAAMd,GAAM,eAAgB,CAAEe,gBAAiBf,IAE/D,OAAAgB,EAAU,MAEU,IAAZV,IACkB,IAAlBC,GACyB,eAAzBU,QAAQC,IAAIC,UAEZC,QAAQC,KACJ,wFAGJZ,EAASG,UACTH,EAASG,QAAQL,eAAiBD,KAAaC,IAEpD,CAACD,EAASC,IAGTe,EAAC,MAAA,CACGnB,UAAWoB,EAAK,eAAgBpB,EAAW,CACvC,uBAAwBC,EACxB,sBAAuBF,IAG3BD,SAAA,CAAAuB,EAAC,QAAA,CAAMC,QAASZ,EAASV,UAAU,sBAC9BF,SAAAA,IAELuB,EAAC,QAAA,CACGxB,GAAIa,EACJd,IAAKU,EACLN,UAAU,sBACV,cAAY,qBACZ,eAAcD,EACdwB,KAAK,WACL,kBAAiBrB,EACjBC,QAAAA,KACIE,SAOxBZ,EAAS+B,YAAc"}
1
+ {"version":3,"file":"Checkbox.js","sources":["../../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, useEffect, useImperativeHandle, useRef } from \"react\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport type { CheckboxProps } from \"./types.js\";\n\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n (props, ref) => {\n const {\n id,\n children,\n invalid,\n className,\n inline = false,\n \"data-testautoid\": testAutoId,\n checked,\n indeterminate,\n ...rest\n } = props;\n\n const inputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(\n ref,\n () => inputRef.current as HTMLInputElement,\n [],\n );\n\n const inputId = useId(id || \"jkl-checkbox\", { generateSuffix: !id });\n\n useEffect(() => {\n if (\n checked === true &&\n indeterminate === true &&\n process.env.NODE_ENV !== \"production\"\n ) {\n console.warn(\n \"A Checkbox can not be both checked and indeterminate, and will be treated as checked\",\n );\n }\n if (inputRef.current) {\n inputRef.current.indeterminate = !checked && !!indeterminate;\n }\n }, [checked, indeterminate]);\n\n return (\n <div\n className={clsx(\"jkl-checkbox\", className, {\n \"jkl-checkbox--inline\": inline,\n \"jkl-checkbox--error\": invalid,\n })}\n >\n <input\n id={inputId}\n ref={inputRef}\n className=\"jkl-checkbox__input\"\n data-testid=\"jkl-checkbox-input\"\n aria-invalid={invalid}\n type=\"checkbox\"\n data-testautoid={testAutoId}\n checked={checked}\n {...rest}\n />\n <label htmlFor={inputId} className=\"jkl-checkbox__label\">\n {children}\n </label>\n </div>\n );\n },\n);\n\nCheckbox.displayName = \"Checkbox\";\n"],"names":["Checkbox","forwardRef","props","ref","id","children","invalid","className","inline","testAutoId","checked","indeterminate","rest","inputRef","useRef","useImperativeHandle","current","inputId","useId","generateSuffix","useEffect","process","env","NODE_ENV","console","warn","jsxs","clsx","jsx","type","htmlFor","displayName"],"mappings":"0OAKO,MAAMA,EAAWC,EACpB,CAACC,EAAOC,KACJ,MACIC,GAAAA,EACAC,SAAAA,EACAC,QAAAA,EACAC,UAAAA,EACAC,OAAAA,GAAS,EACT,kBAAmBC,EACnBC,QAAAA,EACAC,cAAAA,KACGC,GACHV,EAEEW,EAAWC,EAAyB,MAC1CC,EACIZ,EACA,IAAMU,EAASG,QACf,IAGJ,MAAMC,EAAUC,EAAMd,GAAM,eAAgB,CAAEe,gBAAiBf,IAE/D,OAAAgB,EAAU,MAEU,IAAZV,IACkB,IAAlBC,GACyB,eAAzBU,QAAQC,IAAIC,UAEZC,QAAQC,KACJ,wFAGJZ,EAASG,UACTH,EAASG,QAAQL,eAAiBD,KAAaC,IAEpD,CAACD,EAASC,IAGTe,EAAC,MAAA,CACGnB,UAAWoB,EAAK,eAAgBpB,EAAW,CACvC,uBAAwBC,EACxB,sBAAuBF,IAG3BD,SAAA,CAAAuB,EAAC,QAAA,CACGxB,GAAIa,EACJd,IAAKU,EACLN,UAAU,sBACV,cAAY,qBACZ,eAAcD,EACduB,KAAK,WACL,kBAAiBpB,EACjBC,QAAAA,KACIE,MAEP,QAAA,CAAMkB,QAASb,EAASV,UAAU,sBAC9BF,SAAAA,SAOrBL,EAAS+B,YAAc"}
@@ -1,2 +1,2 @@
1
1
  import { CookieConsentProps } from './types.js';
2
- export declare const CookieConsent: ({ blocking, onAccept, aboutPage, ...rest }: CookieConsentProps) => JSX.Element | null;
2
+ export declare const CookieConsent: ({ blocking, onAccept, aboutPage, aboutPageLinkText, ...rest }: CookieConsentProps) => JSX.Element | null;
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useId as n,useEffect as t}from"react";import r from"react-dom";import{Button as a}from"../button/Button.js";import{Flex as i}from"../flex/Flex.js";import{Link as s}from"../link/Link.js";import{ModalContainer as l,ModalOverlay as d,Modal as c,ModalHeader as m,ModalTitle as k,ModalBody as p,ModalActions as u}from"../modal/Modal.js";import{useModal as f}from"../modal/useModal.js";import{useInternalState as h}from"./CookieConsentContext.js";import{setConsentCookie as g}from"./cookieConsentUtils.js";const j=({blocking:j,onAccept:C,aboutPage:v="https://www.fremtind.no/informasjonskapsler",...b})=>{const{currentConsent:y,cookieName:M,cookieDomain:x,cookiePath:w,isOpen:I,setIsOpen:B,updateCurrentConsents:F}=h(),[L,O]=f({id:`jkl-cookie-modal-${n()}`,role:j?"alertdialog":"dialog",title:"Informasjonskapsler"});if(t(()=>{I?L?.show():L?.hide()},[L,I]),t(()=>{const e=()=>B(!1);return L?.on("hide",e),()=>{L?.off("hide",e)}},[L,B]),typeof document>"u")return null;if(typeof navigator<"u"&&!navigator.cookieEnabled)return C?.({functional:"denied",statistics:"denied",marketing:"denied"}),null;const P=e=>{const o={...y,functional:e,statistics:e,marketing:"denied"};g({consent:o,name:M,domain:x,path:w}),C?.(o),F(),L?.hide()};return r.createPortal(e(l,{...O.container,...b,"data-cookie-consent-open":I,children:[o(d,{...O.overlay}),e(c,{...O.modal,children:[o(m,{children:o(k,{...O.title,children:"Får vi bruke valgfrie informasjonskapsler?"})}),o(p,{children:e(i,{direction:"column",gap:"m",children:[o("p",{children:"Vi ønsker å samle anonym statistikk for å forstå hvordan nettsidene våre brukes. Det hjelper oss til å gjøre innhold og løsninger bedre og mer brukervennlige."}),e("p",{children:[o(s,{href:v,target:"_blank",children:"Les mer om hvilke informasjonskapsler vi lagrer her"}),"."]})]})}),e(u,{children:[o(a,{variant:"secondary","data-testid":"jkl-cookie-consent-godta",type:"button",onClick:()=>P("accepted"),children:"Ja, det er greit"}),o(a,{variant:"secondary","data-testid":"jkl-cookie-consent-nekt",type:"button",onClick:()=>P("denied"),children:"Nei takk"})]})]})]}),document.body)};export{j as CookieConsent};
1
+ import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useId as n,useEffect as t}from"react";import a from"react-dom";import{Button as r}from"../button/Button.js";import{Flex as i}from"../flex/Flex.js";import{Link as s}from"../link/Link.js";import{ModalContainer as d,ModalOverlay as l,Modal as c,ModalHeader as m,ModalTitle as k,ModalBody as u,ModalActions as p}from"../modal/Modal.js";import{useModal as f}from"../modal/useModal.js";import{useInternalState as h}from"./CookieConsentContext.js";import{setConsentCookie as g}from"./cookieConsentUtils.js";const j=({blocking:j,onAccept:C,aboutPage:b="https://www.fremtind.no/informasjonskapsler",aboutPageLinkText:v="Les mer om hvilke informasjons­kapsler vi lagrer her",...y})=>{const{currentConsent:M,cookieName:x,cookieDomain:w,cookiePath:F,isOpen:I,setIsOpen:L,updateCurrentConsents:P}=h(),[B,O]=f({id:`jkl-cookie-modal-${n()}`,role:j?"alertdialog":"dialog",title:"Informasjonskapsler"});if(t(()=>{I?B?.show():B?.hide()},[B,I]),t(()=>{const e=()=>L(!1);return B?.on("hide",e),()=>{B?.off("hide",e)}},[B,L]),typeof document>"u")return null;if(typeof navigator<"u"&&!navigator.cookieEnabled)return C?.({functional:"denied",statistics:"denied",marketing:"denied"}),null;const A=e=>{const o={...M,functional:e,statistics:e,marketing:"denied"};g({consent:o,name:x,domain:w,path:F}),C?.(o),P(),B?.hide()};return a.createPortal(e(d,{...O.container,...y,"data-cookie-consent-open":I,children:[o(l,{...O.overlay}),e(c,{...O.modal,children:[o(m,{children:o(k,{...O.title,children:"Får vi bruke valgfrie informasjons­kapsler?"})}),o(u,{children:e(i,{direction:"column",gap:"m",children:[o("p",{children:"Fremtind ønsker å samle anonym statistikk for å forstå hvordan nettsidene våre brukes. Det hjelper oss til å gjøre innhold og løsninger bedre og mer brukervennlige."}),e("p",{children:[o(s,{href:b,target:"_blank",children:v}),"."]})]})}),e(p,{children:[o(r,{variant:"secondary","data-testid":"jkl-cookie-consent-godta",type:"button",onClick:()=>A("accepted"),children:"Ja, det er greit"}),o(r,{variant:"secondary","data-testid":"jkl-cookie-consent-nekt",type:"button",onClick:()=>A("denied"),children:"Nei takk"})]})]})]}),document.body)};export{j as CookieConsent};
2
2
  //# sourceMappingURL=CookieConsent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CookieConsent.js","sources":["../../../../src/components/cookie-consent/CookieConsent.tsx"],"sourcesContent":["import React, { useEffect, useId } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { Button } from \"../button/Button.js\";\nimport { Flex } from \"../flex/index.js\";\nimport { Link } from \"../link/index.js\";\nimport {\n Modal,\n ModalActions,\n ModalBody,\n ModalContainer,\n ModalHeader,\n ModalOverlay,\n ModalTitle,\n} from \"../modal/Modal.js\";\nimport { useModal } from \"../modal/useModal.js\";\nimport { useInternalState } from \"./CookieConsentContext.js\";\nimport { setConsentCookie } from \"./cookieConsentUtils.js\";\nimport type { Consent, ConsentState, CookieConsentProps } from \"./types.js\";\n\nexport const CookieConsent = ({\n blocking,\n onAccept,\n aboutPage = \"https://www.fremtind.no/informasjonskapsler\",\n ...rest\n}: CookieConsentProps): JSX.Element | null => {\n const {\n currentConsent,\n cookieName,\n cookieDomain,\n cookiePath,\n isOpen,\n setIsOpen,\n updateCurrentConsents,\n } = useInternalState();\n\n const [instance, modalConfig] = useModal({\n id: `jkl-cookie-modal-${useId()}`,\n // The optional `role` attribute of the dialog element, either `dialog`\n // (default) or `alertdialog` to make it a modal (preventing closing on\n // click outside of ESC key).\n role: blocking ? \"alertdialog\" : \"dialog\",\n // The required dialog title, mandatory in the document\n // to provide context to assistive technology.\n title: \"Informasjonskapsler\",\n });\n useEffect(() => {\n if (isOpen) {\n instance?.show();\n } else {\n instance?.hide();\n }\n }, [instance, isOpen]);\n\n useEffect(() => {\n const onHide = () => setIsOpen(false);\n instance?.on(\"hide\", onHide);\n return () => {\n instance?.off(\"hide\", onHide);\n };\n }, [instance, setIsOpen]);\n\n if (typeof document === \"undefined\") {\n return null;\n }\n\n // Cookies are disabled in the browser\n if (typeof navigator !== \"undefined\" && !navigator.cookieEnabled) {\n onAccept?.({\n functional: \"denied\",\n statistics: \"denied\",\n marketing: \"denied\",\n });\n\n return null;\n }\n\n const updateCookies = (state: ConsentState) => {\n const updatedConsent: Consent = {\n ...currentConsent,\n functional: state,\n statistics: state,\n marketing: \"denied\",\n };\n\n setConsentCookie({\n consent: updatedConsent,\n name: cookieName,\n domain: cookieDomain,\n path: cookiePath,\n });\n\n onAccept?.(updatedConsent);\n\n updateCurrentConsents();\n\n instance?.hide();\n };\n\n return ReactDOM.createPortal(\n <ModalContainer\n {...modalConfig.container}\n {...rest}\n data-cookie-consent-open={isOpen}\n >\n <ModalOverlay {...modalConfig.overlay} />\n <Modal {...modalConfig.modal}>\n <ModalHeader>\n <ModalTitle {...modalConfig.title}>\n Får vi bruke valgfrie informasjonskapsler?\n </ModalTitle>\n </ModalHeader>\n <ModalBody>\n <Flex direction=\"column\" gap=\"m\">\n <p>\n Vi ønsker å samle anonym statistikk for å forstå\n hvordan nettsidene våre brukes. Det hjelper oss til\n å gjøre innhold og løsninger bedre og mer\n brukervennlige.\n </p>\n <p>\n <Link href={aboutPage} target=\"_blank\">\n Les mer om hvilke informasjonskapsler vi lagrer\n her\n </Link>\n .\n </p>\n </Flex>\n </ModalBody>\n <ModalActions>\n <Button\n variant=\"secondary\"\n data-testid=\"jkl-cookie-consent-godta\"\n type=\"button\"\n onClick={() => updateCookies(\"accepted\")}\n >\n Ja, det er greit\n </Button>\n <Button\n variant=\"secondary\"\n data-testid=\"jkl-cookie-consent-nekt\"\n type=\"button\"\n onClick={() => updateCookies(\"denied\")}\n >\n Nei takk\n </Button>\n </ModalActions>\n </Modal>\n </ModalContainer>,\n document.body,\n );\n};\n"],"names":["CookieConsent","blocking","onAccept","aboutPage","rest","currentConsent","cookieName","cookieDomain","cookiePath","isOpen","setIsOpen","updateCurrentConsents","useInternalState","instance","modalConfig","useModal","id","useId","role","title","useEffect","show","hide","onHide","on","off","document","navigator","cookieEnabled","functional","statistics","marketing","updateCookies","state","updatedConsent","setConsentCookie","consent","name","domain","path","ReactDOM","createPortal","jsxs","ModalContainer","container","children","jsx","ModalOverlay","overlay","Modal","modal","ModalHeader","ModalTitle","ModalBody","Flex","direction","gap","Link","href","target","ModalActions","Button","variant","type","onClick","body"],"mappings":"6iBAmBO,MAAMA,EAAgB,EACzBC,SAAAA,EACAC,SAAAA,EACAC,UAAAA,EAAY,iDACTC,MAEH,MACIC,eAAAA,EACAC,WAAAA,EACAC,aAAAA,EACAC,WAAAA,EACAC,OAAAA,EACAC,UAAAA,EACAC,sBAAAA,GACAC,KAEGC,EAAUC,GAAeC,EAAS,CACrCC,GAAI,oBAAoBC,MAIxBC,KAAMjB,EAAW,cAAgB,SAGjCkB,MAAO,wBAkBX,GAhBAC,EAAU,KACFX,EACAI,GAAUQ,OAEVR,GAAUS,QAEf,CAACT,EAAUJ,IAEdW,EAAU,KACN,MAAMG,EAAS,IAAMb,GAAU,GAC/B,OAAAG,GAAUW,GAAG,OAAQD,GACd,KACHV,GAAUY,IAAI,OAAQF,KAE3B,CAACV,EAAUH,WAEHgB,SAAa,IACpB,OAAO,KAIX,UAAWC,UAAc,MAAgBA,UAAUC,cAC/C,OAAA1B,IAAW,CACP2B,WAAY,SACZC,WAAY,SACZC,UAAW,WAGR,KAGX,MAAMC,EAAiBC,IACnB,MAAMC,EAA0B,IACzB7B,EACHwB,WAAYI,EACZH,WAAYG,EACZF,UAAW,UAGfI,EAAiB,CACbC,QAASF,EACTG,KAAM/B,EACNgC,OAAQ/B,EACRgC,KAAM/B,IAGVN,IAAWgC,GAEXvB,IAEAE,GAAUS,QAGd,OAAOkB,EAASC,aACZC,EAACC,EAAA,IACO7B,EAAY8B,aACZxC,EACJ,2BAA0BK,EAE1BoC,SAAA,CAAAC,EAACC,EAAA,IAAiBjC,EAAYkC,UAC9BN,EAACO,EAAA,IAAUnC,EAAYoC,MACnBL,SAAA,CAAAC,EAACK,GACGN,SAAAC,EAACM,EAAA,IAAetC,EAAYK,MAAO0B,4DAItCQ,EAAA,CACGR,SAAAH,EAACY,GAAKC,UAAU,SAASC,IAAI,IACzBX,SAAA,CAAAC,EAAC,KAAED,SAAA,qKAMF,IAAA,CACGA,SAAA,CAAAC,EAACW,EAAA,CAAKC,KAAMvD,EAAWwD,OAAO,SAASd,SAAA,wDAGhC,cAKlBe,EAAA,CACGf,SAAA,CAAAC,EAACe,EAAA,CACGC,QAAQ,YACR,cAAY,2BACZC,KAAK,SACLC,QAAS,IAAMhC,EAAc,YAChCa,SAAA,qBAGDC,EAACe,EAAA,CACGC,QAAQ,YACR,cAAY,0BACZC,KAAK,SACLC,QAAS,IAAMhC,EAAc,UAChCa,SAAA,sBAMbnB,SAASuC"}
1
+ {"version":3,"file":"CookieConsent.js","sources":["../../../../src/components/cookie-consent/CookieConsent.tsx"],"sourcesContent":["import React, { useEffect, useId } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { Button } from \"../button/Button.js\";\nimport { Flex } from \"../flex/index.js\";\nimport { Link } from \"../link/index.js\";\nimport {\n Modal,\n ModalActions,\n ModalBody,\n ModalContainer,\n ModalHeader,\n ModalOverlay,\n ModalTitle,\n} from \"../modal/Modal.js\";\nimport { useModal } from \"../modal/useModal.js\";\nimport { useInternalState } from \"./CookieConsentContext.js\";\nimport { setConsentCookie } from \"./cookieConsentUtils.js\";\nimport type { Consent, ConsentState, CookieConsentProps } from \"./types.js\";\n\nexport const CookieConsent = ({\n blocking,\n onAccept,\n aboutPage = \"https://www.fremtind.no/informasjonskapsler\",\n aboutPageLinkText = \"Les mer om hvilke informasjons­kapsler vi lagrer her\",\n ...rest\n}: CookieConsentProps): JSX.Element | null => {\n const {\n currentConsent,\n cookieName,\n cookieDomain,\n cookiePath,\n isOpen,\n setIsOpen,\n updateCurrentConsents,\n } = useInternalState();\n\n const [instance, modalConfig] = useModal({\n id: `jkl-cookie-modal-${useId()}`,\n // The optional `role` attribute of the dialog element, either `dialog`\n // (default) or `alertdialog` to make it a modal (preventing closing on\n // click outside of ESC key).\n role: blocking ? \"alertdialog\" : \"dialog\",\n // The required dialog title, mandatory in the document\n // to provide context to assistive technology.\n title: \"Informasjonskapsler\",\n });\n useEffect(() => {\n if (isOpen) {\n instance?.show();\n } else {\n instance?.hide();\n }\n }, [instance, isOpen]);\n\n useEffect(() => {\n const onHide = () => setIsOpen(false);\n instance?.on(\"hide\", onHide);\n return () => {\n instance?.off(\"hide\", onHide);\n };\n }, [instance, setIsOpen]);\n\n if (typeof document === \"undefined\") {\n return null;\n }\n\n // Cookies are disabled in the browser\n if (typeof navigator !== \"undefined\" && !navigator.cookieEnabled) {\n onAccept?.({\n functional: \"denied\",\n statistics: \"denied\",\n marketing: \"denied\",\n });\n\n return null;\n }\n\n const updateCookies = (state: ConsentState) => {\n const updatedConsent: Consent = {\n ...currentConsent,\n functional: state,\n statistics: state,\n marketing: \"denied\",\n };\n\n setConsentCookie({\n consent: updatedConsent,\n name: cookieName,\n domain: cookieDomain,\n path: cookiePath,\n });\n\n onAccept?.(updatedConsent);\n\n updateCurrentConsents();\n\n instance?.hide();\n };\n\n return ReactDOM.createPortal(\n <ModalContainer\n {...modalConfig.container}\n {...rest}\n data-cookie-consent-open={isOpen}\n >\n <ModalOverlay {...modalConfig.overlay} />\n <Modal {...modalConfig.modal}>\n <ModalHeader>\n <ModalTitle {...modalConfig.title}>\n Får vi bruke valgfrie informasjons&shy;kapsler?\n </ModalTitle>\n </ModalHeader>\n <ModalBody>\n <Flex direction=\"column\" gap=\"m\">\n <p>\n Fremtind ønsker å samle anonym statistikk for å\n forstå hvordan nettsidene våre brukes. Det hjelper\n oss til å gjøre innhold og løsninger bedre og mer\n brukervennlige.\n </p>\n <p>\n <Link href={aboutPage} target=\"_blank\">\n {aboutPageLinkText}\n </Link>\n .\n </p>\n </Flex>\n </ModalBody>\n <ModalActions>\n <Button\n variant=\"secondary\"\n data-testid=\"jkl-cookie-consent-godta\"\n type=\"button\"\n onClick={() => updateCookies(\"accepted\")}\n >\n Ja, det er greit\n </Button>\n <Button\n variant=\"secondary\"\n data-testid=\"jkl-cookie-consent-nekt\"\n type=\"button\"\n onClick={() => updateCookies(\"denied\")}\n >\n Nei takk\n </Button>\n </ModalActions>\n </Modal>\n </ModalContainer>,\n document.body,\n );\n};\n"],"names":["CookieConsent","blocking","onAccept","aboutPage","aboutPageLinkText","rest","currentConsent","cookieName","cookieDomain","cookiePath","isOpen","setIsOpen","updateCurrentConsents","useInternalState","instance","modalConfig","useModal","id","useId","role","title","useEffect","show","hide","onHide","on","off","document","navigator","cookieEnabled","functional","statistics","marketing","updateCookies","state","updatedConsent","setConsentCookie","consent","name","domain","path","ReactDOM","createPortal","jsxs","ModalContainer","container","children","jsx","ModalOverlay","overlay","Modal","modal","ModalHeader","ModalTitle","ModalBody","Flex","direction","gap","Link","href","target","ModalActions","Button","variant","type","onClick","body"],"mappings":"6iBAmBO,MAAMA,EAAgB,EACzBC,SAAAA,EACAC,SAAAA,EACAC,UAAAA,EAAY,8CACZC,kBAAAA,EAAoB,0DACjBC,MAEH,MACIC,eAAAA,EACAC,WAAAA,EACAC,aAAAA,EACAC,WAAAA,EACAC,OAAAA,EACAC,UAAAA,EACAC,sBAAAA,GACAC,KAEGC,EAAUC,GAAeC,EAAS,CACrCC,GAAI,oBAAoBC,MAIxBC,KAAMlB,EAAW,cAAgB,SAGjCmB,MAAO,wBAkBX,GAhBAC,EAAU,KACFX,EACAI,GAAUQ,OAEVR,GAAUS,QAEf,CAACT,EAAUJ,IAEdW,EAAU,KACN,MAAMG,EAAS,IAAMb,GAAU,GAC/B,OAAAG,GAAUW,GAAG,OAAQD,GACd,KACHV,GAAUY,IAAI,OAAQF,KAE3B,CAACV,EAAUH,WAEHgB,SAAa,IACpB,OAAO,KAIX,UAAWC,UAAc,MAAgBA,UAAUC,cAC/C,OAAA3B,IAAW,CACP4B,WAAY,SACZC,WAAY,SACZC,UAAW,WAGR,KAGX,MAAMC,EAAiBC,IACnB,MAAMC,EAA0B,IACzB7B,EACHwB,WAAYI,EACZH,WAAYG,EACZF,UAAW,UAGfI,EAAiB,CACbC,QAASF,EACTG,KAAM/B,EACNgC,OAAQ/B,EACRgC,KAAM/B,IAGVP,IAAWiC,GAEXvB,IAEAE,GAAUS,QAGd,OAAOkB,EAASC,aACZC,EAACC,EAAA,IACO7B,EAAY8B,aACZxC,EACJ,2BAA0BK,EAE1BoC,SAAA,CAAAC,EAACC,EAAA,IAAiBjC,EAAYkC,UAC9BN,EAACO,EAAA,IAAUnC,EAAYoC,MACnBL,SAAA,CAAAC,EAACK,GACGN,SAAAC,EAACM,EAAA,IAAetC,EAAYK,MAAO0B,6DAItCQ,EAAA,CACGR,SAAAH,EAACY,GAAKC,UAAU,SAASC,IAAI,IACzBX,SAAA,CAAAC,EAAC,KAAED,SAAA,2KAMF,IAAA,CACGA,SAAA,CAAAC,EAACW,EAAA,CAAKC,KAAMxD,EAAWyD,OAAO,SACzBd,SAAA1C,IACE,cAKlByD,EAAA,CACGf,SAAA,CAAAC,EAACe,EAAA,CACGC,QAAQ,YACR,cAAY,2BACZC,KAAK,SACLC,QAAS,IAAMhC,EAAc,YAChCa,SAAA,qBAGDC,EAACe,EAAA,CACGC,QAAQ,YACR,cAAY,0BACZC,KAAK,SACLC,QAAS,IAAMhC,EAAc,UAChCa,SAAA,sBAMbnB,SAASuC"}
@@ -13,6 +13,10 @@ export interface CookieConsentProps {
13
13
  * Lenke til informasjonssiden til cookiene i løsningen din.
14
14
  */
15
15
  aboutPage: string;
16
+ /**
17
+ * Tekst for lenken til informasjonssiden.
18
+ */
19
+ aboutPageLinkText?: string;
16
20
  }
17
21
  export type AcceptConsentCallback = (consent: Consent) => void;
18
22
  export type ConsentComponentBaseProps = {
@@ -1,2 +1,2 @@
1
- import{jsxs as a,jsx as e}from"react/jsx-runtime";import{c as i}from"../../../clsx-BeLtu-UY.js";import{forwardRef as t}from"react";import{useId as o}from"../../hooks/useId/useId.js";const r=t((t,r)=>{const{id:l,className:n,checked:s,children:d,label:u,inline:c,invalid:m,name:j,value:b,onChange:k,...f}=t,h=o(l||"jkl-radio-button",{generateSuffix:!l});return a("div",{className:i("jkl-radio-button",n,{"jkl-radio-button--inline":c,"jkl-radio-button--error":m}),children:[e("label",{"data-testid":"jkl-radio-button__label-tag",htmlFor:h,className:"jkl-radio-button__label",children:u||d}),e("input",{name:j,ref:r,...f,id:h,className:"jkl-radio-button__input",type:"radio",onChange:k,value:b,checked:s,"aria-invalid":m||f["aria-invalid"]})]})});r.displayName="BaseRadioButton";export{r as BaseRadioButton};
1
+ import{jsxs as a,jsx as e}from"react/jsx-runtime";import{c as i}from"../../../clsx-BeLtu-UY.js";import{forwardRef as t}from"react";import{useId as o}from"../../hooks/useId/useId.js";const r=t((t,r)=>{const{id:l,className:n,checked:s,children:d,label:u,inline:c,invalid:m,name:j,value:b,onChange:k,...f}=t,h=o(l||"jkl-radio-button",{generateSuffix:!l});return a("div",{className:i("jkl-radio-button",n,{"jkl-radio-button--inline":c,"jkl-radio-button--error":m}),children:[e("input",{name:j,ref:r,...f,id:h,className:"jkl-radio-button__input",type:"radio",onChange:k,value:b,checked:s,"aria-invalid":m||f["aria-invalid"]}),e("label",{"data-testid":"jkl-radio-button__label-tag",htmlFor:h,className:"jkl-radio-button__label",children:u||d})]})});r.displayName="BaseRadioButton";export{r as BaseRadioButton};
2
2
  //# sourceMappingURL=BaseRadioButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseRadioButton.js","sources":["../../../../src/components/radio-button/BaseRadioButton.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef } from \"react\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport type { BaseRadioButtonProps } from \"./types.js\";\n\nexport const BaseRadioButton = forwardRef<\n HTMLInputElement,\n BaseRadioButtonProps\n>((props, ref) => {\n const {\n id,\n className,\n checked,\n children,\n label,\n inline,\n invalid,\n name,\n value,\n onChange,\n ...rest\n } = props;\n\n const inputId = useId(id || \"jkl-radio-button\", { generateSuffix: !id });\n\n return (\n <div\n className={clsx(\"jkl-radio-button\", className, {\n \"jkl-radio-button--inline\": inline,\n \"jkl-radio-button--error\": invalid,\n })}\n >\n <label\n data-testid=\"jkl-radio-button__label-tag\"\n htmlFor={inputId}\n className=\"jkl-radio-button__label\"\n >\n {label || children}\n </label>\n <input\n name={name}\n ref={ref}\n {...rest}\n id={inputId}\n className=\"jkl-radio-button__input\"\n type=\"radio\"\n onChange={onChange}\n value={value}\n checked={checked}\n aria-invalid={invalid || rest[\"aria-invalid\"]}\n />\n </div>\n );\n});\n\nBaseRadioButton.displayName = \"BaseRadioButton\";\n"],"names":["BaseRadioButton","forwardRef","props","ref","id","className","checked","children","label","inline","invalid","name","value","onChange","rest","inputId","useId","generateSuffix","jsxs","clsx","jsx","htmlFor","type","displayName"],"mappings":"sLAKO,MAAMA,EAAkBC,EAG7B,CAACC,EAAOC,KACN,MACIC,GAAAA,EACAC,UAAAA,EACAC,QAAAA,EACAC,SAAAA,EACAC,MAAAA,EACAC,OAAAA,EACAC,QAAAA,EACAC,KAAAA,EACAC,MAAAA,EACAC,SAAAA,KACGC,GACHZ,EAEEa,EAAUC,EAAMZ,GAAM,mBAAoB,CAAEa,gBAAiBb,IAEnE,OACIc,EAAC,MAAA,CACGb,UAAWc,EAAK,mBAAoBd,EAAW,CAC3C,2BAA4BI,EAC5B,0BAA2BC,IAG/BH,SAAA,CAAAa,EAAC,QAAA,CACG,cAAY,8BACZC,QAASN,EACTV,UAAU,0BAETE,SAAAC,GAASD,IAEda,EAAC,QAAA,CACGT,KAAAA,EACAR,IAAAA,KACIW,EACJV,GAAIW,EACJV,UAAU,0BACViB,KAAK,QACLT,SAAAA,EACAD,MAAAA,EACAN,QAAAA,EACA,eAAcI,GAAWI,EAAK,uBAM9Cd,EAAgBuB,YAAc"}
1
+ {"version":3,"file":"BaseRadioButton.js","sources":["../../../../src/components/radio-button/BaseRadioButton.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef } from \"react\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport type { BaseRadioButtonProps } from \"./types.js\";\n\nexport const BaseRadioButton = forwardRef<\n HTMLInputElement,\n BaseRadioButtonProps\n>((props, ref) => {\n const {\n id,\n className,\n checked,\n children,\n label,\n inline,\n invalid,\n name,\n value,\n onChange,\n ...rest\n } = props;\n\n const inputId = useId(id || \"jkl-radio-button\", { generateSuffix: !id });\n\n return (\n <div\n className={clsx(\"jkl-radio-button\", className, {\n \"jkl-radio-button--inline\": inline,\n \"jkl-radio-button--error\": invalid,\n })}\n >\n <input\n name={name}\n ref={ref}\n {...rest}\n id={inputId}\n className=\"jkl-radio-button__input\"\n type=\"radio\"\n onChange={onChange}\n value={value}\n checked={checked}\n aria-invalid={invalid || rest[\"aria-invalid\"]}\n />\n <label\n data-testid=\"jkl-radio-button__label-tag\"\n htmlFor={inputId}\n className=\"jkl-radio-button__label\"\n >\n {label || children}\n </label>\n </div>\n );\n});\n\nBaseRadioButton.displayName = \"BaseRadioButton\";\n"],"names":["BaseRadioButton","forwardRef","props","ref","id","className","checked","children","label","inline","invalid","name","value","onChange","rest","inputId","useId","generateSuffix","jsxs","clsx","jsx","type","htmlFor","displayName"],"mappings":"sLAKO,MAAMA,EAAkBC,EAG7B,CAACC,EAAOC,KACN,MACIC,GAAAA,EACAC,UAAAA,EACAC,QAAAA,EACAC,SAAAA,EACAC,MAAAA,EACAC,OAAAA,EACAC,QAAAA,EACAC,KAAAA,EACAC,MAAAA,EACAC,SAAAA,KACGC,GACHZ,EAEEa,EAAUC,EAAMZ,GAAM,mBAAoB,CAAEa,gBAAiBb,IAEnE,OACIc,EAAC,MAAA,CACGb,UAAWc,EAAK,mBAAoBd,EAAW,CAC3C,2BAA4BI,EAC5B,0BAA2BC,IAG/BH,SAAA,CAAAa,EAAC,QAAA,CACGT,KAAAA,EACAR,IAAAA,KACIW,EACJV,GAAIW,EACJV,UAAU,0BACVgB,KAAK,QACLR,SAAAA,EACAD,MAAAA,EACAN,QAAAA,EACA,eAAcI,GAAWI,EAAK,kBAElCM,EAAC,QAAA,CACG,cAAY,8BACZE,QAASP,EACTV,UAAU,0BAETE,SAAAC,GAASD,SAM1BP,EAAgBuB,YAAc"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fremtind/jokul",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -35,9 +35,13 @@
35
35
  .jkl-checkbox__input {
36
36
  position: absolute;
37
37
  opacity: 0;
38
- pointer-events: none;
39
- inset: 0 auto 0 0;
40
- width: 1lh;
38
+ inset-block-start: 0;
39
+ inset-inline-start: 0;
40
+ block-size: 1lh;
41
+ inline-size: 1lh;
42
+ margin: 0;
43
+ cursor: pointer;
44
+ z-index: 1;
41
45
  }
42
46
  .jkl-checkbox__label {
43
47
  cursor: pointer;
@@ -50,9 +54,6 @@
50
54
  font-weight: 400;
51
55
  --jkl-icon-weight: 300;
52
56
  }
53
- .jkl-checkbox__label:hover, .jkl-checkbox__label:active {
54
- --jkl-icon-weight: 400;
55
- }
56
57
  .jkl-checkbox__label::before {
57
58
  content: "check_box_outline_blank";
58
59
  margin-inline-end: 0.25em;
@@ -69,15 +70,18 @@
69
70
  transition-duration: 75ms;
70
71
  transition-property: font-variation-settings, transform;
71
72
  }
72
- .jkl-checkbox__label:has(+ :checked)::before {
73
+ .jkl-checkbox__input:is(:hover, :active) + .jkl-checkbox__label, .jkl-checkbox__label:hover, .jkl-checkbox__label:active {
74
+ --jkl-icon-weight: 400;
75
+ }
76
+ .jkl-checkbox__input:checked + .jkl-checkbox__label::before {
73
77
  content: "check_box";
74
78
  --jkl-icon-fill: 1;
75
79
  }
76
- .jkl-checkbox__label:has(+ :indeterminate:not(:checked))::before {
80
+ .jkl-checkbox__input:indeterminate:not(:checked) + .jkl-checkbox__label::before {
77
81
  content: "indeterminate_check_box";
78
82
  --jkl-icon-fill: 1;
79
83
  }
80
- .jkl-checkbox__label:has(+ [aria-invalid=true])::before {
84
+ .jkl-checkbox__input[aria-invalid=true] + .jkl-checkbox__label::before {
81
85
  color: var(--jkl-checkbox-error-color);
82
86
  }
83
87
  .jkl-checkbox + .jkl-checkbox {
@@ -1 +1 @@
1
- @layer jokul.components{@media screen and (prefers-color-scheme:light){:root{--jkl-checkbox-error-color:#ab2e43}}[data-theme=light]{--jkl-checkbox-error-color:#ab2e43}@media screen and (prefers-color-scheme:dark){:root{--jkl-checkbox-error-color:#d79ba5}}[data-theme=dark]{--jkl-checkbox-error-color:#d79ba5}.jkl-checkbox{--box-color:var(--jkl-color-border-action);--check-color:var(--jkl-color-border-action);--text-color:var(--jkl-color-text-default);--background-color:transparent;font-size:var(--jkl-font-size-3);font-weight:400;line-height:var(--jkl-line-height-tight);--jkl-icon-weight:300;color:var(--text-color);display:flex;flex-wrap:wrap;position:relative}.jkl-checkbox__input{inset:0 auto 0 0;opacity:0;pointer-events:none;position:absolute;width:1lh}.jkl-checkbox__label{cursor:pointer;display:flex;font-size:var(--jkl-font-size-3);font-weight:400;line-height:var(--jkl-line-height-tight);transition-duration:.15s;transition-property:color;transition-timing-function:ease;--jkl-icon-weight:300}.jkl-checkbox__label:active,.jkl-checkbox__label:hover{--jkl-icon-weight:400}.jkl-checkbox__label:before{content:"check_box_outline_blank";-webkit-margin-end:.25em;display:inline-block;font-family:Fremtind Material Symbols,Fremtind Material Symbols Fallback,sans-serif;font-feature-settings:"liga";-webkit-font-feature-settings:"liga";font-size:1.3em;font-variation-settings:"FILL" var(--jkl-icon-fill,0),"GRAD" var(--jkl-icon-grade,0),"opsz" var(--jkl-icon-opsz,24);font-weight:var(--jkl-icon-weight,300);line-height:1;margin-inline-end:.25em;-webkit-font-smoothing:antialiased;transition-duration:75ms;transition-property:font-variation-settings,transform;transition-timing-function:ease}.jkl-checkbox__label:has(+:checked):before{content:"check_box";--jkl-icon-fill:1}.jkl-checkbox__label:has(+:indeterminate:not(:checked)):before{content:"indeterminate_check_box";--jkl-icon-fill:1}.jkl-checkbox__label:has(+[aria-invalid=true]):before{color:var(--jkl-checkbox-error-color)}.jkl-checkbox+.jkl-checkbox{margin-top:.75em}.jkl-checkbox--inline{display:inline-flex}.jkl-checkbox--inline:not(:last-of-type){margin-right:var(--jkl-unit-30)}}
1
+ @layer jokul.components{@media screen and (prefers-color-scheme:light){:root{--jkl-checkbox-error-color:#ab2e43}}[data-theme=light]{--jkl-checkbox-error-color:#ab2e43}@media screen and (prefers-color-scheme:dark){:root{--jkl-checkbox-error-color:#d79ba5}}[data-theme=dark]{--jkl-checkbox-error-color:#d79ba5}.jkl-checkbox{--box-color:var(--jkl-color-border-action);--check-color:var(--jkl-color-border-action);--text-color:var(--jkl-color-text-default);--background-color:transparent;font-size:var(--jkl-font-size-3);font-weight:400;line-height:var(--jkl-line-height-tight);--jkl-icon-weight:300;color:var(--text-color);display:flex;flex-wrap:wrap;position:relative}.jkl-checkbox__input{block-size:1lh;cursor:pointer;inline-size:1lh;inset-block-start:0;inset-inline-start:0;margin:0;opacity:0;position:absolute;z-index:1}.jkl-checkbox__label{cursor:pointer;display:flex;font-size:var(--jkl-font-size-3);font-weight:400;line-height:var(--jkl-line-height-tight);transition-duration:.15s;transition-property:color;transition-timing-function:ease;--jkl-icon-weight:300}.jkl-checkbox__label:before{content:"check_box_outline_blank";-webkit-margin-end:.25em;display:inline-block;font-family:Fremtind Material Symbols,Fremtind Material Symbols Fallback,sans-serif;font-feature-settings:"liga";-webkit-font-feature-settings:"liga";font-size:1.3em;font-variation-settings:"FILL" var(--jkl-icon-fill,0),"GRAD" var(--jkl-icon-grade,0),"opsz" var(--jkl-icon-opsz,24);font-weight:var(--jkl-icon-weight,300);line-height:1;margin-inline-end:.25em;-webkit-font-smoothing:antialiased;transition-duration:75ms;transition-property:font-variation-settings,transform;transition-timing-function:ease}.jkl-checkbox__input:is(:hover,:active)+.jkl-checkbox__label,.jkl-checkbox__label:active,.jkl-checkbox__label:hover{--jkl-icon-weight:400}.jkl-checkbox__input:checked+.jkl-checkbox__label:before{content:"check_box";--jkl-icon-fill:1}.jkl-checkbox__input:indeterminate:not(:checked)+.jkl-checkbox__label:before{content:"indeterminate_check_box";--jkl-icon-fill:1}.jkl-checkbox__input[aria-invalid=true]+.jkl-checkbox__label:before{color:var(--jkl-checkbox-error-color)}.jkl-checkbox+.jkl-checkbox{margin-top:.75em}.jkl-checkbox--inline{display:inline-flex}.jkl-checkbox--inline:not(:last-of-type){margin-right:var(--jkl-unit-30)}}
@@ -27,14 +27,16 @@
27
27
  position: relative;
28
28
 
29
29
  &__input {
30
- // Hide native checkbox
30
+ // Keep the real input on top of the icon so automation tools can target it.
31
31
  position: absolute;
32
32
  opacity: 0;
33
- pointer-events: none;
34
- // Make sure that when the browser scrolls here because of focus, the control
35
- // is positioned below the label so that the label becomes visible.
36
- inset: 0 auto 0 0;
37
- width: 1lh;
33
+ inset-block-start: 0;
34
+ inset-inline-start: 0;
35
+ block-size: 1lh;
36
+ inline-size: 1lh;
37
+ margin: 0;
38
+ cursor: pointer;
39
+ z-index: 1;
38
40
  }
39
41
 
40
42
  &__label {
@@ -46,33 +48,34 @@
46
48
 
47
49
  @include jkl.text-style("text-medium");
48
50
 
49
- &:hover,
50
- &:active {
51
- --jkl-icon-weight: #{jkl.$icon-weight-bold};
52
- }
53
-
54
51
  &::before {
55
52
  content: "check_box_outline_blank";
56
53
  margin-inline-end: 0.25em;
57
54
 
58
55
  @include icon.base-styles;
59
56
  }
57
+ }
60
58
 
61
- &:has(+ :checked)::before {
62
- content: "check_box";
59
+ &__input:is(:hover, :active) + &__label,
60
+ &__label:hover,
61
+ &__label:active {
62
+ --jkl-icon-weight: #{jkl.$icon-weight-bold};
63
+ }
63
64
 
64
- --jkl-icon-fill: 1;
65
- }
65
+ &__input:checked + &__label::before {
66
+ content: "check_box";
66
67
 
67
- &:has(+ :indeterminate:not(:checked))::before {
68
- content: "indeterminate_check_box";
68
+ --jkl-icon-fill: 1;
69
+ }
69
70
 
70
- --jkl-icon-fill: 1;
71
- }
71
+ &__input:indeterminate:not(:checked) + &__label::before {
72
+ content: "indeterminate_check_box";
72
73
 
73
- &:has(+ [aria-invalid="true"])::before {
74
- color: var(--jkl-checkbox-error-color);
75
- }
74
+ --jkl-icon-fill: 1;
75
+ }
76
+
77
+ &__input[aria-invalid="true"] + &__label::before {
78
+ color: var(--jkl-checkbox-error-color);
76
79
  }
77
80
 
78
81
  & + & {
@@ -26,29 +26,31 @@
26
26
  position: relative;
27
27
  padding: var(--jkl-unit-20) var(--padding-inline);
28
28
  }
29
+ .jkl-input-panel__header .jkl-radio-button,
30
+ .jkl-input-panel__header .jkl-checkbox {
31
+ grid-column: 1/-1;
32
+ grid-row: 1;
33
+ inline-size: 100%;
34
+ }
35
+ .jkl-input-panel__header label {
36
+ inline-size: 100%;
37
+ }
29
38
  .jkl-input-panel__header__amount {
30
39
  display: flex;
31
40
  height: 100%;
32
41
  align-items: center;
42
+ grid-column: 2;
43
+ grid-row: 1;
44
+ justify-self: end;
45
+ pointer-events: none;
46
+ position: relative;
47
+ z-index: 1;
33
48
  font-size: var(--jkl-font-size-3);
34
49
  line-height: var(--jkl-line-height-tight);
35
50
  font-weight: 400;
36
51
  --jkl-icon-weight: 300;
37
52
  font-weight: 700;
38
53
  }
39
- .jkl-input-panel__header label,
40
- .jkl-input-panel__header .jkl-radio-button,
41
- .jkl-input-panel__header .jkl-checkbox {
42
- position: unset;
43
- }
44
- .jkl-input-panel__header label::after {
45
- content: "";
46
- position: absolute;
47
- top: 0;
48
- left: 0;
49
- inline-size: 100%;
50
- block-size: 100%;
51
- }
52
54
  .jkl-input-panel__description {
53
55
  height: 0;
54
56
  overflow: hidden;
@@ -114,9 +116,13 @@
114
116
  .jkl-checkbox__input {
115
117
  position: absolute;
116
118
  opacity: 0;
117
- pointer-events: none;
118
- inset: 0 auto 0 0;
119
- width: 1lh;
119
+ inset-block-start: 0;
120
+ inset-inline-start: 0;
121
+ block-size: 1lh;
122
+ inline-size: 1lh;
123
+ margin: 0;
124
+ cursor: pointer;
125
+ z-index: 1;
120
126
  }
121
127
  .jkl-checkbox__label {
122
128
  cursor: pointer;
@@ -129,9 +135,6 @@
129
135
  font-weight: 400;
130
136
  --jkl-icon-weight: 300;
131
137
  }
132
- .jkl-checkbox__label:hover, .jkl-checkbox__label:active {
133
- --jkl-icon-weight: 400;
134
- }
135
138
  .jkl-checkbox__label::before {
136
139
  content: "check_box_outline_blank";
137
140
  margin-inline-end: 0.25em;
@@ -148,15 +151,18 @@
148
151
  transition-duration: 75ms;
149
152
  transition-property: font-variation-settings, transform;
150
153
  }
151
- .jkl-checkbox__label:has(+ :checked)::before {
154
+ .jkl-checkbox__input:is(:hover, :active) + .jkl-checkbox__label, .jkl-checkbox__label:hover, .jkl-checkbox__label:active {
155
+ --jkl-icon-weight: 400;
156
+ }
157
+ .jkl-checkbox__input:checked + .jkl-checkbox__label::before {
152
158
  content: "check_box";
153
159
  --jkl-icon-fill: 1;
154
160
  }
155
- .jkl-checkbox__label:has(+ :indeterminate:not(:checked))::before {
161
+ .jkl-checkbox__input:indeterminate:not(:checked) + .jkl-checkbox__label::before {
156
162
  content: "indeterminate_check_box";
157
163
  --jkl-icon-fill: 1;
158
164
  }
159
- .jkl-checkbox__label:has(+ [aria-invalid=true])::before {
165
+ .jkl-checkbox__input[aria-invalid=true] + .jkl-checkbox__label::before {
160
166
  color: var(--jkl-checkbox-error-color);
161
167
  }
162
168
  .jkl-checkbox + .jkl-checkbox {
@@ -1 +1 @@
1
- @layer jokul.components{.jkl-input-panel{--outer-border-color:var(--jkl-color-border-input);--outer-border-thickness:0.0625rem;--background-color:transparent;--padding-inline:var(--jkl-unit-25);background-color:var(--background-color);border-radius:var(--jkl-border-radius-s);box-shadow:inset 0 0 0 var(--outer-border-thickness) var(--outer-border-color);display:flex;flex-direction:column;interpolate-size:allow-keywords;transition-duration:.15s;transition-property:box-shadow;transition-timing-function:ease}.jkl-input-panel__header{align-items:center;cursor:pointer;display:grid;gap:.5rem;grid-template-columns:1fr -webkit-max-content;grid-template-columns:1fr max-content;padding:var(--jkl-unit-20) var(--padding-inline);position:relative}.jkl-input-panel__header__amount{align-items:center;display:flex;font-size:var(--jkl-font-size-3);font-weight:400;height:100%;line-height:var(--jkl-line-height-tight);--jkl-icon-weight:300;font-weight:700}.jkl-input-panel__header .jkl-checkbox,.jkl-input-panel__header .jkl-radio-button,.jkl-input-panel__header label{position:unset}.jkl-input-panel__header label:after{block-size:100%;content:"";inline-size:100%;left:0;position:absolute;top:0}.jkl-input-panel__description{height:0;overflow:hidden;padding-inline:var(--padding-inline);-webkit-padding-after:var(--jkl-spacing-none);font-size:var(--jkl-font-size-3);font-weight:400;line-height:normal;line-height:var(--jkl-line-height-relaxed);padding-block-end:var(--jkl-spacing-none);--jkl-icon-weight:300;transition-duration:.15s;transition-property:height;transition-timing-function:ease}.jkl-input-panel:has(:focus-visible){outline:3px solid var(--jkl-color-border-action);outline-offset:3px}.jkl-input-panel:has(:checked),.jkl-input-panel:not([data-always-open]),.jkl-input-panel[data-always-open=true]{--background-color:var(--jkl-color-background-container-high)}.jkl-input-panel:has(:checked) .jkl-input-panel__description,.jkl-input-panel:not([data-always-open]) .jkl-input-panel__description,.jkl-input-panel[data-always-open=true] .jkl-input-panel__description{height:auto;-webkit-padding-after:var(--jkl-unit-20);padding-block-end:var(--jkl-unit-20)}.jkl-input-panel:has(input:hover){--outer-border-color:var(--jkl-color-border-separator-hover);--outer-border-thickness:0.125rem;cursor:pointer}}@layer jokul.components{@media screen and (prefers-color-scheme:light){:root{--jkl-checkbox-error-color:#ab2e43}}[data-theme=light]{--jkl-checkbox-error-color:#ab2e43}@media screen and (prefers-color-scheme:dark){:root{--jkl-checkbox-error-color:#d79ba5}}[data-theme=dark]{--jkl-checkbox-error-color:#d79ba5}.jkl-checkbox{--box-color:var(--jkl-color-border-action);--check-color:var(--jkl-color-border-action);--text-color:var(--jkl-color-text-default);--background-color:transparent;font-size:var(--jkl-font-size-3);font-weight:400;line-height:var(--jkl-line-height-tight);--jkl-icon-weight:300;color:var(--text-color);display:flex;flex-wrap:wrap;position:relative}.jkl-checkbox__input{inset:0 auto 0 0;opacity:0;pointer-events:none;position:absolute;width:1lh}.jkl-checkbox__label{cursor:pointer;display:flex;font-size:var(--jkl-font-size-3);font-weight:400;line-height:var(--jkl-line-height-tight);transition-duration:.15s;transition-property:color;transition-timing-function:ease;--jkl-icon-weight:300}.jkl-checkbox__label:active,.jkl-checkbox__label:hover{--jkl-icon-weight:400}.jkl-checkbox__label:before{content:"check_box_outline_blank";-webkit-margin-end:.25em;display:inline-block;font-family:Fremtind Material Symbols,Fremtind Material Symbols Fallback,sans-serif;font-feature-settings:"liga";-webkit-font-feature-settings:"liga";font-size:1.3em;font-variation-settings:"FILL" var(--jkl-icon-fill,0),"GRAD" var(--jkl-icon-grade,0),"opsz" var(--jkl-icon-opsz,24);font-weight:var(--jkl-icon-weight,300);line-height:1;margin-inline-end:.25em;-webkit-font-smoothing:antialiased;transition-duration:75ms;transition-property:font-variation-settings,transform;transition-timing-function:ease}.jkl-checkbox__label:has(+:checked):before{content:"check_box";--jkl-icon-fill:1}.jkl-checkbox__label:has(+:indeterminate:not(:checked)):before{content:"indeterminate_check_box";--jkl-icon-fill:1}.jkl-checkbox__label:has(+[aria-invalid=true]):before{color:var(--jkl-checkbox-error-color)}.jkl-checkbox+.jkl-checkbox{margin-top:.75em}.jkl-checkbox--inline{display:inline-flex}.jkl-checkbox--inline:not(:last-of-type){margin-right:var(--jkl-unit-30)}}@layer jokul.components{.jkl-checkbox-panel .jkl-checkbox{-webkit-margin-start:-.1em;margin-inline-start:-.1em}}
1
+ @layer jokul.components{.jkl-input-panel{--outer-border-color:var(--jkl-color-border-input);--outer-border-thickness:0.0625rem;--background-color:transparent;--padding-inline:var(--jkl-unit-25);background-color:var(--background-color);border-radius:var(--jkl-border-radius-s);box-shadow:inset 0 0 0 var(--outer-border-thickness) var(--outer-border-color);display:flex;flex-direction:column;interpolate-size:allow-keywords;transition-duration:.15s;transition-property:box-shadow;transition-timing-function:ease}.jkl-input-panel__header{align-items:center;cursor:pointer;display:grid;gap:.5rem;grid-template-columns:1fr -webkit-max-content;grid-template-columns:1fr max-content;padding:var(--jkl-unit-20) var(--padding-inline);position:relative}.jkl-input-panel__header .jkl-checkbox,.jkl-input-panel__header .jkl-radio-button{grid-column:1/-1;grid-row:1;inline-size:100%}.jkl-input-panel__header label{inline-size:100%}.jkl-input-panel__header__amount{align-items:center;display:flex;font-size:var(--jkl-font-size-3);font-weight:400;grid-column:2;grid-row:1;height:100%;justify-self:end;line-height:var(--jkl-line-height-tight);pointer-events:none;position:relative;z-index:1;--jkl-icon-weight:300;font-weight:700}.jkl-input-panel__description{height:0;overflow:hidden;padding-inline:var(--padding-inline);-webkit-padding-after:var(--jkl-spacing-none);font-size:var(--jkl-font-size-3);font-weight:400;line-height:normal;line-height:var(--jkl-line-height-relaxed);padding-block-end:var(--jkl-spacing-none);--jkl-icon-weight:300;transition-duration:.15s;transition-property:height;transition-timing-function:ease}.jkl-input-panel:has(:focus-visible){outline:3px solid var(--jkl-color-border-action);outline-offset:3px}.jkl-input-panel:has(:checked),.jkl-input-panel:not([data-always-open]),.jkl-input-panel[data-always-open=true]{--background-color:var(--jkl-color-background-container-high)}.jkl-input-panel:has(:checked) .jkl-input-panel__description,.jkl-input-panel:not([data-always-open]) .jkl-input-panel__description,.jkl-input-panel[data-always-open=true] .jkl-input-panel__description{height:auto;-webkit-padding-after:var(--jkl-unit-20);padding-block-end:var(--jkl-unit-20)}.jkl-input-panel:has(input:hover){--outer-border-color:var(--jkl-color-border-separator-hover);--outer-border-thickness:0.125rem;cursor:pointer}}@layer jokul.components{@media screen and (prefers-color-scheme:light){:root{--jkl-checkbox-error-color:#ab2e43}}[data-theme=light]{--jkl-checkbox-error-color:#ab2e43}@media screen and (prefers-color-scheme:dark){:root{--jkl-checkbox-error-color:#d79ba5}}[data-theme=dark]{--jkl-checkbox-error-color:#d79ba5}.jkl-checkbox{--box-color:var(--jkl-color-border-action);--check-color:var(--jkl-color-border-action);--text-color:var(--jkl-color-text-default);--background-color:transparent;font-size:var(--jkl-font-size-3);font-weight:400;line-height:var(--jkl-line-height-tight);--jkl-icon-weight:300;color:var(--text-color);display:flex;flex-wrap:wrap;position:relative}.jkl-checkbox__input{block-size:1lh;cursor:pointer;inline-size:1lh;inset-block-start:0;inset-inline-start:0;margin:0;opacity:0;position:absolute;z-index:1}.jkl-checkbox__label{cursor:pointer;display:flex;font-size:var(--jkl-font-size-3);font-weight:400;line-height:var(--jkl-line-height-tight);transition-duration:.15s;transition-property:color;transition-timing-function:ease;--jkl-icon-weight:300}.jkl-checkbox__label:before{content:"check_box_outline_blank";-webkit-margin-end:.25em;display:inline-block;font-family:Fremtind Material Symbols,Fremtind Material Symbols Fallback,sans-serif;font-feature-settings:"liga";-webkit-font-feature-settings:"liga";font-size:1.3em;font-variation-settings:"FILL" var(--jkl-icon-fill,0),"GRAD" var(--jkl-icon-grade,0),"opsz" var(--jkl-icon-opsz,24);font-weight:var(--jkl-icon-weight,300);line-height:1;margin-inline-end:.25em;-webkit-font-smoothing:antialiased;transition-duration:75ms;transition-property:font-variation-settings,transform;transition-timing-function:ease}.jkl-checkbox__input:is(:hover,:active)+.jkl-checkbox__label,.jkl-checkbox__label:active,.jkl-checkbox__label:hover{--jkl-icon-weight:400}.jkl-checkbox__input:checked+.jkl-checkbox__label:before{content:"check_box";--jkl-icon-fill:1}.jkl-checkbox__input:indeterminate:not(:checked)+.jkl-checkbox__label:before{content:"indeterminate_check_box";--jkl-icon-fill:1}.jkl-checkbox__input[aria-invalid=true]+.jkl-checkbox__label:before{color:var(--jkl-checkbox-error-color)}.jkl-checkbox+.jkl-checkbox{margin-top:.75em}.jkl-checkbox--inline{display:inline-flex}.jkl-checkbox--inline:not(:last-of-type){margin-right:var(--jkl-unit-30)}}@layer jokul.components{.jkl-checkbox-panel .jkl-checkbox{-webkit-margin-start:-.1em;margin-inline-start:-.1em}}
@@ -26,10 +26,10 @@
26
26
  }
27
27
  }
28
28
  .jkl-countdown__tracker {
29
- animation: jkl-downcount-unots5l var(--duration) linear forwards;
29
+ animation: jkl-downcount-ujh7hux var(--duration) linear forwards;
30
30
  animation-play-state: var(--play-state, running);
31
31
  }
32
- @keyframes jkl-downcount-unots5l {
32
+ @keyframes jkl-downcount-ujh7hux {
33
33
  from {
34
34
  width: 100%;
35
35
  }
@@ -1 +1 @@
1
- @layer jokul.components{.jkl-countdown{--track-color:var(--jkl-color-border-separator);--bar-color:var(--jkl-color-border-input-focus);--bar-height:0.25rem;background-color:var(--track-color);border-radius:6.25rem;height:var(--bar-height);overflow:hidden;width:100%}.jkl-countdown__tracker{background-color:var(--bar-color);display:block;height:var(--bar-height)}@media screen and (forced-colors:active){.jkl-countdown{background-color:Canvas}.jkl-countdown__tracker{background-color:CanvasText}}.jkl-countdown__tracker{animation:jkl-downcount-unots5l var(--duration) linear forwards;animation-play-state:var(--play-state,running)}@keyframes jkl-downcount-unots5l{0%{width:100%}to{width:0}}}
1
+ @layer jokul.components{.jkl-countdown{--track-color:var(--jkl-color-border-separator);--bar-color:var(--jkl-color-border-input-focus);--bar-height:0.25rem;background-color:var(--track-color);border-radius:6.25rem;height:var(--bar-height);overflow:hidden;width:100%}.jkl-countdown__tracker{background-color:var(--bar-color);display:block;height:var(--bar-height)}@media screen and (forced-colors:active){.jkl-countdown{background-color:Canvas}.jkl-countdown__tracker{background-color:CanvasText}}.jkl-countdown__tracker{animation:jkl-downcount-ujh7hux var(--duration) linear forwards;animation-play-state:var(--play-state,running)}@keyframes jkl-downcount-ujh7hux{0%{width:100%}to{width:0}}}
@@ -24,12 +24,12 @@
24
24
  --jkl-icon-size: 1.2em;
25
25
  }
26
26
  .jkl-feedback__fade-in {
27
- animation: jkl-show-u73j7jk 0.25s ease-out;
27
+ animation: jkl-show-uit2odr 0.25s ease-out;
28
28
  }
29
29
  .jkl-feedback__buttons {
30
30
  display: flex;
31
31
  }
32
- @keyframes jkl-show-u73j7jk {
32
+ @keyframes jkl-show-uit2odr {
33
33
  from {
34
34
  transform: translate3d(0, 0.5rem, 0);
35
35
  opacity: 0;
@@ -1 +1 @@
1
- @layer jokul.components{.jkl-feedback{max-width:34.375rem}.jkl-feedback__submit-wrapper{transition-duration:.25s;transition-property:height;transition-timing-function:ease;width:100%}.jkl-feedback__submit-wrapper--hidden{display:none}.jkl-feedback__step-counter{color:var(--jkl-color-text-subdued);font-size:var(--jkl-font-size-2);font-weight:400;line-height:var(--jkl-line-height-relaxed);margin-bottom:var(--jkl-unit-20);--jkl-icon-weight:300;--jkl-icon-size:1.2em}.jkl-feedback__fade-in{animation:jkl-show-u73j7jk .25s ease-out}.jkl-feedback__buttons{display:flex}@keyframes jkl-show-u73j7jk{0%{opacity:0;transform:translate3d(0,.5rem,0)}}.jkl-feedback-smileys{display:flex;flex-wrap:nowrap;gap:.75rem;justify-content:space-between;margin-top:var(--jkl-unit-10);max-width:22.5rem;width:100%}.jkl-feedback-smiley-option{color:var(--jkl-color-text-subdued);cursor:pointer;display:inline-block;height:2.5rem;position:relative;transform:translateZ(0);transition-duration:.15s;transition-property:transform,color;transition-timing-function:ease;width:2.5rem}@media screen and (forced-colors:active){.jkl-feedback-smiley-option,.jkl-feedback-smiley-option path,.jkl-feedback-smiley-option svg{fill:ButtonText;stroke:ButtonFace}}.jkl-feedback-smiley-option:after,.jkl-feedback-smiley-option:before{border-radius:50%;content:"";opacity:0;position:absolute;transition-duration:.15s;transition-property:opacity;transition-timing-function:ease}.jkl-feedback-smiley-option:after{box-shadow:0 0 0 .125rem currentColor;inset:-.125rem -.125rem -.125rem -.125rem}.jkl-feedback-smiley-option:before{box-shadow:0 .125rem 1.875rem rgba(0,0,0,.1);inset:0}.jkl-feedback-smiley-option:hover{color:var(--jkl-color-text-default)}input:checked+.jkl-feedback-smiley-option{color:var(--jkl-color-text-default);transform:translate3d(0,-20%,0)}input:checked+.jkl-feedback-smiley-option:before{opacity:1}html:not([data-mousenavigation]):not([data-touchnavigation]) input:focus+.jkl-feedback-smiley-option:after{opacity:1}}
1
+ @layer jokul.components{.jkl-feedback{max-width:34.375rem}.jkl-feedback__submit-wrapper{transition-duration:.25s;transition-property:height;transition-timing-function:ease;width:100%}.jkl-feedback__submit-wrapper--hidden{display:none}.jkl-feedback__step-counter{color:var(--jkl-color-text-subdued);font-size:var(--jkl-font-size-2);font-weight:400;line-height:var(--jkl-line-height-relaxed);margin-bottom:var(--jkl-unit-20);--jkl-icon-weight:300;--jkl-icon-size:1.2em}.jkl-feedback__fade-in{animation:jkl-show-uit2odr .25s ease-out}.jkl-feedback__buttons{display:flex}@keyframes jkl-show-uit2odr{0%{opacity:0;transform:translate3d(0,.5rem,0)}}.jkl-feedback-smileys{display:flex;flex-wrap:nowrap;gap:.75rem;justify-content:space-between;margin-top:var(--jkl-unit-10);max-width:22.5rem;width:100%}.jkl-feedback-smiley-option{color:var(--jkl-color-text-subdued);cursor:pointer;display:inline-block;height:2.5rem;position:relative;transform:translateZ(0);transition-duration:.15s;transition-property:transform,color;transition-timing-function:ease;width:2.5rem}@media screen and (forced-colors:active){.jkl-feedback-smiley-option,.jkl-feedback-smiley-option path,.jkl-feedback-smiley-option svg{fill:ButtonText;stroke:ButtonFace}}.jkl-feedback-smiley-option:after,.jkl-feedback-smiley-option:before{border-radius:50%;content:"";opacity:0;position:absolute;transition-duration:.15s;transition-property:opacity;transition-timing-function:ease}.jkl-feedback-smiley-option:after{box-shadow:0 0 0 .125rem currentColor;inset:-.125rem -.125rem -.125rem -.125rem}.jkl-feedback-smiley-option:before{box-shadow:0 .125rem 1.875rem rgba(0,0,0,.1);inset:0}.jkl-feedback-smiley-option:hover{color:var(--jkl-color-text-default)}input:checked+.jkl-feedback-smiley-option{color:var(--jkl-color-text-default);transform:translate3d(0,-20%,0)}input:checked+.jkl-feedback-smiley-option:before{opacity:1}html:not([data-mousenavigation]):not([data-touchnavigation]) input:focus+.jkl-feedback-smiley-option:after{opacity:1}}