New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@fremtind/jkl-accordion-react

Package Overview
Dependencies
Maintainers
3
Versions
307
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fremtind/jkl-accordion-react - npm Package Compare versions

Comparing version 4.0.7 to 4.0.8

4

build/AccordionItem.d.ts

@@ -1,2 +0,2 @@

import { ReactNode } from "react";
import { FC, ReactNode } from "react";
interface Props {

@@ -8,3 +8,3 @@ title: string;

}
export declare function AccordionItem({ children, title, className, startExpanded }: Props): JSX.Element;
export declare const AccordionItem: FC<Props>;
export {};

@@ -657,3 +657,3 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';

function AccordionItem(_ref) {
var AccordionItem = function AccordionItem(_ref) {
var children = _ref.children,

@@ -706,3 +706,3 @@ title = _ref.title,

}, children)));
}
};

@@ -709,0 +709,0 @@ var Accordion = function Accordion(_ref) {

import t from"@babel/runtime/helpers/slicedToArray";import e from"@babel/runtime/helpers/typeof";import n,{useState as o}from"react";import{useAnimatedHeight as r}from"@fremtind/jkl-react-hooks";import i from"classnames";
/*! @nrk/core-toggle v3.1.0 - Copyright (c) 2017-2021 NRK */function s(t){return t&&"object"===e(t)&&"default"in t?t:{default:t}}var a=s(require("react"));function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,e){return(p=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function d(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function f(t,e,n){return(f=d()?Reflect.construct:function(t,e,n){var o=[null];o.push.apply(o,e);var r=new(Function.bind.apply(t,o));return n&&p(r,n.prototype),r}).apply(null,arguments)}function h(t){var e="function"==typeof Map?new Map:void 0;return(h=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,o)}function o(){return f(t,arguments,l(this).constructor)}return o.prototype=Object.create(t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),p(o,t)})(t)}function m(t,n){return!n||"object"!==e(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}var v="undefined"!=typeof window,b=v&&/(android)/i.test(navigator.userAgent),w=v&&/iPad|iPhone|iPod/.test(String(navigator.platform));v||global.HTMLElement||(global.HTMLElement=function(){return function t(){u(this,t)}}());var g,y,E=(g="undefined"==typeof window?{}:window.Element.prototype,y=g.matches||g.msMatchesSelector||g.webkitMatchesSelector,g.closest?function(t,e){return t.closest(e)}:function(t,e){for(t.correspondingUseElement&&(t=t.correspondingUseElement);t;t=t.parentElement)if(y.call(t,e))return t;return null});function _(t,e){var n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r="prevent_recursive_dispatch_maximum_callstack".concat(e);if(t[r])return!0;t[r]=!0,"function"==typeof window.CustomEvent?n=new window.CustomEvent(e,{bubbles:!0,cancelable:!0,detail:o}):(n=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,o);var i=t.dispatchEvent(n);return t[r]=null,i}function k(){return Date.now().toString(36)+Math.random().toString(36).slice(2,5)}function x(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:!this.hasAttribute(e);return!n===t.hasAttribute(e)&&t[n?"setAttribute":"removeAttribute"](e,""),n}var L=v&&document.createElement("div"),j=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&p(t,e)}(a,h(HTMLElement));var e,n,o,r,i,s=(e=a,n=d(),function(){var t,o=l(e);if(n){var r=l(this).constructor;t=Reflect.construct(o,arguments,r)}else t=o.apply(this,arguments);return m(this,t)});function a(){return u(this,a),s.apply(this,arguments)}return o=a,i=[{key:"observedAttributes",get:function(){return["hidden","autoposition"]}}],(r=[{key:"connectedCallback",value:function(){w&&(document.documentElement.style.cursor="pointer"),b||this.setAttribute("aria-labelledby",this.button.id=this.button.id||k()),this.value=this.button.textContent,this.setAttribute("role","group"),this.button.setAttribute("aria-expanded",this._open=!this.hidden),this.button.setAttribute("aria-controls",this.id=this.id||k()),document.addEventListener("keydown",this,!0),document.addEventListener("click",this)}},{key:"disconnectedCallback",value:function(){this._button=null,document.removeEventListener("keydown",this,!0),document.removeEventListener("click",this),A(this,!0)}},{key:"attributeChangedCallback",value:function(){if(this._open===this.hidden){this.button.setAttribute("aria-expanded",this._open=!this.hidden);try{this.querySelector("[autofocus]").focus()}catch(t){}A(this,this.hidden),_(this,"toggle")}}},{key:"handleEvent",value:function(t){if(!t.defaultPrevented){if("resize"===t.type||"scroll"===t.type)return this.updatePosition();if("keydown"===t.type&&27===t.keyCode&&(t.target.getAttribute&&"true"===t.target.getAttribute("aria-expanded")?t.target===this.button:E(t.target,this.nodeName)===this))return this.hidden=!0,this.button.focus(),t.preventDefault();if("click"===t.type){var e=E(t.target,"a,button");e&&!e.hasAttribute("aria-expanded")&&E(t.target,this.nodeName)===this?_(this,"toggle.select",e):e&&e.getAttribute("aria-controls")===this.id?this.hidden=!this.hidden:this.popup&&!this.contains(t.target)&&(this.hidden=!0)}}}},{key:"updatePosition",value:function(){var t=this;if(!this._skipPosition&&this.button){this._skipPosition=!0,this.style.position="fixed";var e=this.button.getBoundingClientRect(),n=this.getBoundingClientRect(),o=e.left+n.width<window.innerWidth,r=e.bottom+n.height<window.innerHeight,i=e.top-n.height>0,s=r||!i,a=s?window.pageYOffset+e.bottom+n.height+30:0;this.style.left="".concat(Math.round(o?e.left:e.right-n.width),"px"),this.style.top="".concat(Math.round(s?e.bottom:e.top-n.height),"px"),L.style.cssText="position:absolute;padding:1px;top:".concat(Math.round(a),"px"),setTimeout((function(){return t._skipPosition=null}))}}},{key:"button",get:function(){return this._button&&(this._button.getAttribute("data-for")||this._button.getAttribute("for"))===this.id?this._button:(this._button=this.id&&document.querySelector('[for="'.concat(this.id,'"],[data-for="').concat(this.id,'"]')))||this.previousElementSibling}},{key:"popup",get:function(){return"true"===this.getAttribute("popup")||this.getAttribute("popup")||this.hasAttribute("popup")},set:function(t){this[!1===t?"removeAttribute":"setAttribute"]("popup",t)}},{key:"autoposition",get:function(){return this.hasAttribute("autoposition")},set:function(t){x(this,"autoposition",t)}},{key:"hidden",get:function(){return this.hasAttribute("hidden")},set:function(t){x(this,"hidden",t)}},{key:"value",get:function(){return this.button.value||this.button.textContent},set:function(t){if(void 0===t&&(t=!1),this.button&&this.popup.length){var e=this.button,n=(e.getAttribute("aria-label")||",".concat(this.popup)).split(",")[1],o=t.textContent||t||"";if(n===this.popup){var r=e.querySelector("span")||e;e.value=t.value||o,r[t.innerHTML?"innerHTML":"textContent"]=t.innerHTML||o,e.setAttribute("aria-label","".concat(e.textContent,",").concat(this.popup))}}}}])&&c(o.prototype,r),i&&c(o,i),a}();function A(t,e){e?(t._positionObserver&&t._positionObserver.disconnect(),L.parentNode&&L.parentNode.removeChild(L),t.style.position=t._positionObserver=null,window.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t)):t.autoposition&&(t._positionObserver||(t._positionObserver=window.MutationObserver&&new window.MutationObserver(t.updatePosition.bind(t))),t._positionObserver&&t._positionObserver.observe(t,{childList:!0,subtree:!0,attributes:!0}),document.body.appendChild(L),window.addEventListener("scroll",t,!0),window.addEventListener("resize",t),t.updatePosition())}var O=function(){var t="undefined"==typeof window?{}:window.Element.prototype,e=t.matches||t.msMatchesSelector||t.webkitMatchesSelector;return t.closest?function(t,e){return t.closest(e)}:function(t,n){for(;t;t=t.parentElement)if(e.call(t,n))return t;return null}}();var C=function(t,e){void 0===e&&(e={});var n=((e.name||t.name||String(t).match(/function ([^(]+)/)[1])+"-"+k()).replace(/.[A-Z]/g,(function(t){return t[0]+"-"+t[1]})),o=e.props||[],r=e.customEvents||[],i=r.reduce((function(t,e){return t[e]="on"+e.replace(/(^|\.)./g,(function(t){return t.slice(-1).toUpperCase()})),t}),{}),s=o.concat("forwardRef",Object.keys(i).map((function(t){return i[t]}))),u=(n+"-"+(e.suffix||"react")).replace(/\W+/g,"-").toLowerCase();return function(e){function n(t){var n=this;e.call(this,t),this.ref=function(t){return"function"==typeof n.props.forwardRef?n.props.forwardRef(t):n.props.forwardRef&&(n.props.forwardRef.current=t),n.el=t},Object.keys(i).forEach((function(t){var e=i[t];n[t]=function(t){n.props[e]&&O(t.target,n.el.nodeName)===n.el&&n.props[e](t)}}))}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.componentDidMount=function(){var e=this;window.customElements.get(u)||window.customElements.define(u,t),o.forEach((function(t){t in e.props&&(e.el[t]=e.props[t])})),r.forEach((function(t){e.el.addEventListener(t,e[t])}))},n.prototype.componentDidUpdate=function(t){var e=this;o.forEach((function(n){t[n]!==e.props[n]&&(e.el[n]=e.props[n])}))},n.prototype.componentWillUnmount=function(){var t=this;r.forEach((function(e){t.el.removeEventListener(e,t[e])}))},n.prototype.render=function(){var t=this;return a.default.createElement(u,Object.keys(this.props).reduce((function(e,n){return-1===s.indexOf(n)&&("className"===n?e.class=t.props[n]:!0===t.props[n]?e[n]="":!1!==t.props[n]&&(e[n]=t.props[n])),e}),{ref:this.ref}))},n}(a.default.Component)}(j,{name:"CoreToggle",customEvents:["toggle","toggle.select"],suffix:"3.1.0"}),M=function(t){var e=t.expanded,o=void 0!==e&&e,r=t.className,s=i({"jkl-expand-arrow":!0,"jkl-expand-arrow--expanded":o},r);return n.createElement("span",{className:s},n.createElement("svg",{className:"jkl-expand-arrow__down",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n.createElement("path",{d:"M6.90762 13.8828L11.9272 8.86326L12.7093 9.64537L6.35463 16L-1.68645e-06 9.64536L0.782101 8.86326L5.80156 13.8827L5.80156 1.01438e-06L6.90762 1.20777e-06L6.90762 13.8828Z",fill:"currentColor"})),n.createElement("svg",{className:"jkl-expand-arrow__up",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n.createElement("path",{d:"M5.80163 2.1172L0.78209 7.13674L-1.29938e-05 6.35464L6.35462 5.14415e-08L12.7093 6.35464L11.9272 7.13674L6.90769 2.11728L6.9077 16L5.80163 16L5.80163 2.1172Z",fill:"currentColor"})))};function N(e){var s=e.children,a=e.title,u=e.className,c=e.startExpanded,l=o(void 0!==c&&c),p=t(l,2),d=p[0],f=p[1],h=r(d),m=t(h,1)[0],v=i("jkl-accordion-item",u,{"jkl-accordion-item--expanded":d});return n.createElement("div",{"data-testid":"jkl-accordion-item",className:v},n.createElement("button",{className:"jkl-accordion-item__title",type:"button"},n.createElement("span",{className:"jkl-accordion-item__title-text"},a),n.createElement(M,{className:"jkl-accordion-item__title__arrow",expanded:d})),n.createElement(C,{ref:m,"data-testid":"jkl-accordion-item__content-wrapper",className:"jkl-accordion-item__content-wrapper",hidden:!d,onToggle:function(t){t.defaultPrevented||f(!d)}},n.createElement("div",{className:"jkl-accordion-item__content"},s)))}var P=function(t){var e=t.children,o=t.inverted,r=t.className,i=void 0===r?"":r;return n.createElement("div",{"data-testid":"jkl-accordion",className:"jkl-accordion ".concat(o?"jkl-accordion--inverted":""," ").concat(i)},e)};export{P as Accordion,N as AccordionItem};
/*! @nrk/core-toggle v3.1.0 - Copyright (c) 2017-2021 NRK */function s(t){return t&&"object"===e(t)&&"default"in t?t:{default:t}}var a=s(require("react"));function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,e){return(p=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function d(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function f(t,e,n){return(f=d()?Reflect.construct:function(t,e,n){var o=[null];o.push.apply(o,e);var r=new(Function.bind.apply(t,o));return n&&p(r,n.prototype),r}).apply(null,arguments)}function h(t){var e="function"==typeof Map?new Map:void 0;return(h=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,o)}function o(){return f(t,arguments,l(this).constructor)}return o.prototype=Object.create(t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),p(o,t)})(t)}function m(t,n){return!n||"object"!==e(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}var v="undefined"!=typeof window,b=v&&/(android)/i.test(navigator.userAgent),w=v&&/iPad|iPhone|iPod/.test(String(navigator.platform));v||global.HTMLElement||(global.HTMLElement=function(){return function t(){u(this,t)}}());var g,y,E=(g="undefined"==typeof window?{}:window.Element.prototype,y=g.matches||g.msMatchesSelector||g.webkitMatchesSelector,g.closest?function(t,e){return t.closest(e)}:function(t,e){for(t.correspondingUseElement&&(t=t.correspondingUseElement);t;t=t.parentElement)if(y.call(t,e))return t;return null});function _(t,e){var n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r="prevent_recursive_dispatch_maximum_callstack".concat(e);if(t[r])return!0;t[r]=!0,"function"==typeof window.CustomEvent?n=new window.CustomEvent(e,{bubbles:!0,cancelable:!0,detail:o}):(n=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,o);var i=t.dispatchEvent(n);return t[r]=null,i}function k(){return Date.now().toString(36)+Math.random().toString(36).slice(2,5)}function x(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:!this.hasAttribute(e);return!n===t.hasAttribute(e)&&t[n?"setAttribute":"removeAttribute"](e,""),n}var L=v&&document.createElement("div"),j=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&p(t,e)}(a,h(HTMLElement));var e,n,o,r,i,s=(e=a,n=d(),function(){var t,o=l(e);if(n){var r=l(this).constructor;t=Reflect.construct(o,arguments,r)}else t=o.apply(this,arguments);return m(this,t)});function a(){return u(this,a),s.apply(this,arguments)}return o=a,i=[{key:"observedAttributes",get:function(){return["hidden","autoposition"]}}],(r=[{key:"connectedCallback",value:function(){w&&(document.documentElement.style.cursor="pointer"),b||this.setAttribute("aria-labelledby",this.button.id=this.button.id||k()),this.value=this.button.textContent,this.setAttribute("role","group"),this.button.setAttribute("aria-expanded",this._open=!this.hidden),this.button.setAttribute("aria-controls",this.id=this.id||k()),document.addEventListener("keydown",this,!0),document.addEventListener("click",this)}},{key:"disconnectedCallback",value:function(){this._button=null,document.removeEventListener("keydown",this,!0),document.removeEventListener("click",this),A(this,!0)}},{key:"attributeChangedCallback",value:function(){if(this._open===this.hidden){this.button.setAttribute("aria-expanded",this._open=!this.hidden);try{this.querySelector("[autofocus]").focus()}catch(t){}A(this,this.hidden),_(this,"toggle")}}},{key:"handleEvent",value:function(t){if(!t.defaultPrevented){if("resize"===t.type||"scroll"===t.type)return this.updatePosition();if("keydown"===t.type&&27===t.keyCode&&(t.target.getAttribute&&"true"===t.target.getAttribute("aria-expanded")?t.target===this.button:E(t.target,this.nodeName)===this))return this.hidden=!0,this.button.focus(),t.preventDefault();if("click"===t.type){var e=E(t.target,"a,button");e&&!e.hasAttribute("aria-expanded")&&E(t.target,this.nodeName)===this?_(this,"toggle.select",e):e&&e.getAttribute("aria-controls")===this.id?this.hidden=!this.hidden:this.popup&&!this.contains(t.target)&&(this.hidden=!0)}}}},{key:"updatePosition",value:function(){var t=this;if(!this._skipPosition&&this.button){this._skipPosition=!0,this.style.position="fixed";var e=this.button.getBoundingClientRect(),n=this.getBoundingClientRect(),o=e.left+n.width<window.innerWidth,r=e.bottom+n.height<window.innerHeight,i=e.top-n.height>0,s=r||!i,a=s?window.pageYOffset+e.bottom+n.height+30:0;this.style.left="".concat(Math.round(o?e.left:e.right-n.width),"px"),this.style.top="".concat(Math.round(s?e.bottom:e.top-n.height),"px"),L.style.cssText="position:absolute;padding:1px;top:".concat(Math.round(a),"px"),setTimeout((function(){return t._skipPosition=null}))}}},{key:"button",get:function(){return this._button&&(this._button.getAttribute("data-for")||this._button.getAttribute("for"))===this.id?this._button:(this._button=this.id&&document.querySelector('[for="'.concat(this.id,'"],[data-for="').concat(this.id,'"]')))||this.previousElementSibling}},{key:"popup",get:function(){return"true"===this.getAttribute("popup")||this.getAttribute("popup")||this.hasAttribute("popup")},set:function(t){this[!1===t?"removeAttribute":"setAttribute"]("popup",t)}},{key:"autoposition",get:function(){return this.hasAttribute("autoposition")},set:function(t){x(this,"autoposition",t)}},{key:"hidden",get:function(){return this.hasAttribute("hidden")},set:function(t){x(this,"hidden",t)}},{key:"value",get:function(){return this.button.value||this.button.textContent},set:function(t){if(void 0===t&&(t=!1),this.button&&this.popup.length){var e=this.button,n=(e.getAttribute("aria-label")||",".concat(this.popup)).split(",")[1],o=t.textContent||t||"";if(n===this.popup){var r=e.querySelector("span")||e;e.value=t.value||o,r[t.innerHTML?"innerHTML":"textContent"]=t.innerHTML||o,e.setAttribute("aria-label","".concat(e.textContent,",").concat(this.popup))}}}}])&&c(o.prototype,r),i&&c(o,i),a}();function A(t,e){e?(t._positionObserver&&t._positionObserver.disconnect(),L.parentNode&&L.parentNode.removeChild(L),t.style.position=t._positionObserver=null,window.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t)):t.autoposition&&(t._positionObserver||(t._positionObserver=window.MutationObserver&&new window.MutationObserver(t.updatePosition.bind(t))),t._positionObserver&&t._positionObserver.observe(t,{childList:!0,subtree:!0,attributes:!0}),document.body.appendChild(L),window.addEventListener("scroll",t,!0),window.addEventListener("resize",t),t.updatePosition())}var O=function(){var t="undefined"==typeof window?{}:window.Element.prototype,e=t.matches||t.msMatchesSelector||t.webkitMatchesSelector;return t.closest?function(t,e){return t.closest(e)}:function(t,n){for(;t;t=t.parentElement)if(e.call(t,n))return t;return null}}();var C=function(t,e){void 0===e&&(e={});var n=((e.name||t.name||String(t).match(/function ([^(]+)/)[1])+"-"+k()).replace(/.[A-Z]/g,(function(t){return t[0]+"-"+t[1]})),o=e.props||[],r=e.customEvents||[],i=r.reduce((function(t,e){return t[e]="on"+e.replace(/(^|\.)./g,(function(t){return t.slice(-1).toUpperCase()})),t}),{}),s=o.concat("forwardRef",Object.keys(i).map((function(t){return i[t]}))),u=(n+"-"+(e.suffix||"react")).replace(/\W+/g,"-").toLowerCase();return function(e){function n(t){var n=this;e.call(this,t),this.ref=function(t){return"function"==typeof n.props.forwardRef?n.props.forwardRef(t):n.props.forwardRef&&(n.props.forwardRef.current=t),n.el=t},Object.keys(i).forEach((function(t){var e=i[t];n[t]=function(t){n.props[e]&&O(t.target,n.el.nodeName)===n.el&&n.props[e](t)}}))}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.componentDidMount=function(){var e=this;window.customElements.get(u)||window.customElements.define(u,t),o.forEach((function(t){t in e.props&&(e.el[t]=e.props[t])})),r.forEach((function(t){e.el.addEventListener(t,e[t])}))},n.prototype.componentDidUpdate=function(t){var e=this;o.forEach((function(n){t[n]!==e.props[n]&&(e.el[n]=e.props[n])}))},n.prototype.componentWillUnmount=function(){var t=this;r.forEach((function(e){t.el.removeEventListener(e,t[e])}))},n.prototype.render=function(){var t=this;return a.default.createElement(u,Object.keys(this.props).reduce((function(e,n){return-1===s.indexOf(n)&&("className"===n?e.class=t.props[n]:!0===t.props[n]?e[n]="":!1!==t.props[n]&&(e[n]=t.props[n])),e}),{ref:this.ref}))},n}(a.default.Component)}(j,{name:"CoreToggle",customEvents:["toggle","toggle.select"],suffix:"3.1.0"}),M=function(t){var e=t.expanded,o=void 0!==e&&e,r=t.className,s=i({"jkl-expand-arrow":!0,"jkl-expand-arrow--expanded":o},r);return n.createElement("span",{className:s},n.createElement("svg",{className:"jkl-expand-arrow__down",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n.createElement("path",{d:"M6.90762 13.8828L11.9272 8.86326L12.7093 9.64537L6.35463 16L-1.68645e-06 9.64536L0.782101 8.86326L5.80156 13.8827L5.80156 1.01438e-06L6.90762 1.20777e-06L6.90762 13.8828Z",fill:"currentColor"})),n.createElement("svg",{className:"jkl-expand-arrow__up",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n.createElement("path",{d:"M5.80163 2.1172L0.78209 7.13674L-1.29938e-05 6.35464L6.35462 5.14415e-08L12.7093 6.35464L11.9272 7.13674L6.90769 2.11728L6.9077 16L5.80163 16L5.80163 2.1172Z",fill:"currentColor"})))},N=function(e){var s=e.children,a=e.title,u=e.className,c=e.startExpanded,l=o(void 0!==c&&c),p=t(l,2),d=p[0],f=p[1],h=r(d),m=t(h,1)[0],v=i("jkl-accordion-item",u,{"jkl-accordion-item--expanded":d});return n.createElement("div",{"data-testid":"jkl-accordion-item",className:v},n.createElement("button",{className:"jkl-accordion-item__title",type:"button"},n.createElement("span",{className:"jkl-accordion-item__title-text"},a),n.createElement(M,{className:"jkl-accordion-item__title__arrow",expanded:d})),n.createElement(C,{ref:m,"data-testid":"jkl-accordion-item__content-wrapper",className:"jkl-accordion-item__content-wrapper",hidden:!d,onToggle:function(t){t.defaultPrevented||f(!d)}},n.createElement("div",{className:"jkl-accordion-item__content"},s)))},P=function(t){var e=t.children,o=t.inverted,r=t.className,i=void 0===r?"":r;return n.createElement("div",{"data-testid":"jkl-accordion",className:"jkl-accordion ".concat(o?"jkl-accordion--inverted":""," ").concat(i)},e)};export{P as Accordion,N as AccordionItem};

@@ -668,3 +668,3 @@ 'use strict';

function AccordionItem(_ref) {
var AccordionItem = function AccordionItem(_ref) {
var children = _ref.children,

@@ -717,3 +717,3 @@ title = _ref.title,

}, children)));
}
};

@@ -720,0 +720,0 @@ var Accordion = function Accordion(_ref) {

@@ -657,3 +657,3 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';

function AccordionItem(_ref) {
var AccordionItem = function AccordionItem(_ref) {
var children = _ref.children,

@@ -706,3 +706,3 @@ title = _ref.title,

}, children)));
}
};

@@ -709,0 +709,0 @@ var Accordion = function Accordion(_ref) {

import t from"@babel/runtime/helpers/slicedToArray";import e from"@babel/runtime/helpers/typeof";import n,{useState as o}from"react";import{useAnimatedHeight as r}from"@fremtind/jkl-react-hooks";import i from"classnames";
/*! @nrk/core-toggle v3.1.0 - Copyright (c) 2017-2021 NRK */function s(t){return t&&"object"===e(t)&&"default"in t?t:{default:t}}var a=s(require("react"));function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,e){return(p=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function d(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function f(t,e,n){return(f=d()?Reflect.construct:function(t,e,n){var o=[null];o.push.apply(o,e);var r=new(Function.bind.apply(t,o));return n&&p(r,n.prototype),r}).apply(null,arguments)}function h(t){var e="function"==typeof Map?new Map:void 0;return(h=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,o)}function o(){return f(t,arguments,l(this).constructor)}return o.prototype=Object.create(t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),p(o,t)})(t)}function m(t,n){return!n||"object"!==e(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}var v="undefined"!=typeof window,b=v&&/(android)/i.test(navigator.userAgent),w=v&&/iPad|iPhone|iPod/.test(String(navigator.platform));v||global.HTMLElement||(global.HTMLElement=function(){return function t(){u(this,t)}}());var g,y,E=(g="undefined"==typeof window?{}:window.Element.prototype,y=g.matches||g.msMatchesSelector||g.webkitMatchesSelector,g.closest?function(t,e){return t.closest(e)}:function(t,e){for(t.correspondingUseElement&&(t=t.correspondingUseElement);t;t=t.parentElement)if(y.call(t,e))return t;return null});function _(t,e){var n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r="prevent_recursive_dispatch_maximum_callstack".concat(e);if(t[r])return!0;t[r]=!0,"function"==typeof window.CustomEvent?n=new window.CustomEvent(e,{bubbles:!0,cancelable:!0,detail:o}):(n=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,o);var i=t.dispatchEvent(n);return t[r]=null,i}function k(){return Date.now().toString(36)+Math.random().toString(36).slice(2,5)}function x(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:!this.hasAttribute(e);return!n===t.hasAttribute(e)&&t[n?"setAttribute":"removeAttribute"](e,""),n}var L=v&&document.createElement("div"),j=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&p(t,e)}(a,h(HTMLElement));var e,n,o,r,i,s=(e=a,n=d(),function(){var t,o=l(e);if(n){var r=l(this).constructor;t=Reflect.construct(o,arguments,r)}else t=o.apply(this,arguments);return m(this,t)});function a(){return u(this,a),s.apply(this,arguments)}return o=a,i=[{key:"observedAttributes",get:function(){return["hidden","autoposition"]}}],(r=[{key:"connectedCallback",value:function(){w&&(document.documentElement.style.cursor="pointer"),b||this.setAttribute("aria-labelledby",this.button.id=this.button.id||k()),this.value=this.button.textContent,this.setAttribute("role","group"),this.button.setAttribute("aria-expanded",this._open=!this.hidden),this.button.setAttribute("aria-controls",this.id=this.id||k()),document.addEventListener("keydown",this,!0),document.addEventListener("click",this)}},{key:"disconnectedCallback",value:function(){this._button=null,document.removeEventListener("keydown",this,!0),document.removeEventListener("click",this),A(this,!0)}},{key:"attributeChangedCallback",value:function(){if(this._open===this.hidden){this.button.setAttribute("aria-expanded",this._open=!this.hidden);try{this.querySelector("[autofocus]").focus()}catch(t){}A(this,this.hidden),_(this,"toggle")}}},{key:"handleEvent",value:function(t){if(!t.defaultPrevented){if("resize"===t.type||"scroll"===t.type)return this.updatePosition();if("keydown"===t.type&&27===t.keyCode&&(t.target.getAttribute&&"true"===t.target.getAttribute("aria-expanded")?t.target===this.button:E(t.target,this.nodeName)===this))return this.hidden=!0,this.button.focus(),t.preventDefault();if("click"===t.type){var e=E(t.target,"a,button");e&&!e.hasAttribute("aria-expanded")&&E(t.target,this.nodeName)===this?_(this,"toggle.select",e):e&&e.getAttribute("aria-controls")===this.id?this.hidden=!this.hidden:this.popup&&!this.contains(t.target)&&(this.hidden=!0)}}}},{key:"updatePosition",value:function(){var t=this;if(!this._skipPosition&&this.button){this._skipPosition=!0,this.style.position="fixed";var e=this.button.getBoundingClientRect(),n=this.getBoundingClientRect(),o=e.left+n.width<window.innerWidth,r=e.bottom+n.height<window.innerHeight,i=e.top-n.height>0,s=r||!i,a=s?window.pageYOffset+e.bottom+n.height+30:0;this.style.left="".concat(Math.round(o?e.left:e.right-n.width),"px"),this.style.top="".concat(Math.round(s?e.bottom:e.top-n.height),"px"),L.style.cssText="position:absolute;padding:1px;top:".concat(Math.round(a),"px"),setTimeout((function(){return t._skipPosition=null}))}}},{key:"button",get:function(){return this._button&&(this._button.getAttribute("data-for")||this._button.getAttribute("for"))===this.id?this._button:(this._button=this.id&&document.querySelector('[for="'.concat(this.id,'"],[data-for="').concat(this.id,'"]')))||this.previousElementSibling}},{key:"popup",get:function(){return"true"===this.getAttribute("popup")||this.getAttribute("popup")||this.hasAttribute("popup")},set:function(t){this[!1===t?"removeAttribute":"setAttribute"]("popup",t)}},{key:"autoposition",get:function(){return this.hasAttribute("autoposition")},set:function(t){x(this,"autoposition",t)}},{key:"hidden",get:function(){return this.hasAttribute("hidden")},set:function(t){x(this,"hidden",t)}},{key:"value",get:function(){return this.button.value||this.button.textContent},set:function(t){if(void 0===t&&(t=!1),this.button&&this.popup.length){var e=this.button,n=(e.getAttribute("aria-label")||",".concat(this.popup)).split(",")[1],o=t.textContent||t||"";if(n===this.popup){var r=e.querySelector("span")||e;e.value=t.value||o,r[t.innerHTML?"innerHTML":"textContent"]=t.innerHTML||o,e.setAttribute("aria-label","".concat(e.textContent,",").concat(this.popup))}}}}])&&c(o.prototype,r),i&&c(o,i),a}();function A(t,e){e?(t._positionObserver&&t._positionObserver.disconnect(),L.parentNode&&L.parentNode.removeChild(L),t.style.position=t._positionObserver=null,window.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t)):t.autoposition&&(t._positionObserver||(t._positionObserver=window.MutationObserver&&new window.MutationObserver(t.updatePosition.bind(t))),t._positionObserver&&t._positionObserver.observe(t,{childList:!0,subtree:!0,attributes:!0}),document.body.appendChild(L),window.addEventListener("scroll",t,!0),window.addEventListener("resize",t),t.updatePosition())}var O=function(){var t="undefined"==typeof window?{}:window.Element.prototype,e=t.matches||t.msMatchesSelector||t.webkitMatchesSelector;return t.closest?function(t,e){return t.closest(e)}:function(t,n){for(;t;t=t.parentElement)if(e.call(t,n))return t;return null}}();var C=function(t,e){void 0===e&&(e={});var n=((e.name||t.name||String(t).match(/function ([^(]+)/)[1])+"-"+k()).replace(/.[A-Z]/g,(function(t){return t[0]+"-"+t[1]})),o=e.props||[],r=e.customEvents||[],i=r.reduce((function(t,e){return t[e]="on"+e.replace(/(^|\.)./g,(function(t){return t.slice(-1).toUpperCase()})),t}),{}),s=o.concat("forwardRef",Object.keys(i).map((function(t){return i[t]}))),u=(n+"-"+(e.suffix||"react")).replace(/\W+/g,"-").toLowerCase();return function(e){function n(t){var n=this;e.call(this,t),this.ref=function(t){return"function"==typeof n.props.forwardRef?n.props.forwardRef(t):n.props.forwardRef&&(n.props.forwardRef.current=t),n.el=t},Object.keys(i).forEach((function(t){var e=i[t];n[t]=function(t){n.props[e]&&O(t.target,n.el.nodeName)===n.el&&n.props[e](t)}}))}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.componentDidMount=function(){var e=this;window.customElements.get(u)||window.customElements.define(u,t),o.forEach((function(t){t in e.props&&(e.el[t]=e.props[t])})),r.forEach((function(t){e.el.addEventListener(t,e[t])}))},n.prototype.componentDidUpdate=function(t){var e=this;o.forEach((function(n){t[n]!==e.props[n]&&(e.el[n]=e.props[n])}))},n.prototype.componentWillUnmount=function(){var t=this;r.forEach((function(e){t.el.removeEventListener(e,t[e])}))},n.prototype.render=function(){var t=this;return a.default.createElement(u,Object.keys(this.props).reduce((function(e,n){return-1===s.indexOf(n)&&("className"===n?e.class=t.props[n]:!0===t.props[n]?e[n]="":!1!==t.props[n]&&(e[n]=t.props[n])),e}),{ref:this.ref}))},n}(a.default.Component)}(j,{name:"CoreToggle",customEvents:["toggle","toggle.select"],suffix:"3.1.0"}),M=function(t){var e=t.expanded,o=void 0!==e&&e,r=t.className,s=i({"jkl-expand-arrow":!0,"jkl-expand-arrow--expanded":o},r);return n.createElement("span",{className:s},n.createElement("svg",{className:"jkl-expand-arrow__down",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n.createElement("path",{d:"M6.90762 13.8828L11.9272 8.86326L12.7093 9.64537L6.35463 16L-1.68645e-06 9.64536L0.782101 8.86326L5.80156 13.8827L5.80156 1.01438e-06L6.90762 1.20777e-06L6.90762 13.8828Z",fill:"currentColor"})),n.createElement("svg",{className:"jkl-expand-arrow__up",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n.createElement("path",{d:"M5.80163 2.1172L0.78209 7.13674L-1.29938e-05 6.35464L6.35462 5.14415e-08L12.7093 6.35464L11.9272 7.13674L6.90769 2.11728L6.9077 16L5.80163 16L5.80163 2.1172Z",fill:"currentColor"})))};function N(e){var s=e.children,a=e.title,u=e.className,c=e.startExpanded,l=o(void 0!==c&&c),p=t(l,2),d=p[0],f=p[1],h=r(d),m=t(h,1)[0],v=i("jkl-accordion-item",u,{"jkl-accordion-item--expanded":d});return n.createElement("div",{"data-testid":"jkl-accordion-item",className:v},n.createElement("button",{className:"jkl-accordion-item__title",type:"button"},n.createElement("span",{className:"jkl-accordion-item__title-text"},a),n.createElement(M,{className:"jkl-accordion-item__title__arrow",expanded:d})),n.createElement(C,{ref:m,"data-testid":"jkl-accordion-item__content-wrapper",className:"jkl-accordion-item__content-wrapper",hidden:!d,onToggle:function(t){t.defaultPrevented||f(!d)}},n.createElement("div",{className:"jkl-accordion-item__content"},s)))}var P=function(t){var e=t.children,o=t.inverted,r=t.className,i=void 0===r?"":r;return n.createElement("div",{"data-testid":"jkl-accordion",className:"jkl-accordion ".concat(o?"jkl-accordion--inverted":""," ").concat(i)},e)};export{P as Accordion,N as AccordionItem};
/*! @nrk/core-toggle v3.1.0 - Copyright (c) 2017-2021 NRK */function s(t){return t&&"object"===e(t)&&"default"in t?t:{default:t}}var a=s(require("react"));function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,e){return(p=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function d(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function f(t,e,n){return(f=d()?Reflect.construct:function(t,e,n){var o=[null];o.push.apply(o,e);var r=new(Function.bind.apply(t,o));return n&&p(r,n.prototype),r}).apply(null,arguments)}function h(t){var e="function"==typeof Map?new Map:void 0;return(h=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,o)}function o(){return f(t,arguments,l(this).constructor)}return o.prototype=Object.create(t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),p(o,t)})(t)}function m(t,n){return!n||"object"!==e(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}var v="undefined"!=typeof window,b=v&&/(android)/i.test(navigator.userAgent),w=v&&/iPad|iPhone|iPod/.test(String(navigator.platform));v||global.HTMLElement||(global.HTMLElement=function(){return function t(){u(this,t)}}());var g,y,E=(g="undefined"==typeof window?{}:window.Element.prototype,y=g.matches||g.msMatchesSelector||g.webkitMatchesSelector,g.closest?function(t,e){return t.closest(e)}:function(t,e){for(t.correspondingUseElement&&(t=t.correspondingUseElement);t;t=t.parentElement)if(y.call(t,e))return t;return null});function _(t,e){var n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r="prevent_recursive_dispatch_maximum_callstack".concat(e);if(t[r])return!0;t[r]=!0,"function"==typeof window.CustomEvent?n=new window.CustomEvent(e,{bubbles:!0,cancelable:!0,detail:o}):(n=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,o);var i=t.dispatchEvent(n);return t[r]=null,i}function k(){return Date.now().toString(36)+Math.random().toString(36).slice(2,5)}function x(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:!this.hasAttribute(e);return!n===t.hasAttribute(e)&&t[n?"setAttribute":"removeAttribute"](e,""),n}var L=v&&document.createElement("div"),j=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&p(t,e)}(a,h(HTMLElement));var e,n,o,r,i,s=(e=a,n=d(),function(){var t,o=l(e);if(n){var r=l(this).constructor;t=Reflect.construct(o,arguments,r)}else t=o.apply(this,arguments);return m(this,t)});function a(){return u(this,a),s.apply(this,arguments)}return o=a,i=[{key:"observedAttributes",get:function(){return["hidden","autoposition"]}}],(r=[{key:"connectedCallback",value:function(){w&&(document.documentElement.style.cursor="pointer"),b||this.setAttribute("aria-labelledby",this.button.id=this.button.id||k()),this.value=this.button.textContent,this.setAttribute("role","group"),this.button.setAttribute("aria-expanded",this._open=!this.hidden),this.button.setAttribute("aria-controls",this.id=this.id||k()),document.addEventListener("keydown",this,!0),document.addEventListener("click",this)}},{key:"disconnectedCallback",value:function(){this._button=null,document.removeEventListener("keydown",this,!0),document.removeEventListener("click",this),A(this,!0)}},{key:"attributeChangedCallback",value:function(){if(this._open===this.hidden){this.button.setAttribute("aria-expanded",this._open=!this.hidden);try{this.querySelector("[autofocus]").focus()}catch(t){}A(this,this.hidden),_(this,"toggle")}}},{key:"handleEvent",value:function(t){if(!t.defaultPrevented){if("resize"===t.type||"scroll"===t.type)return this.updatePosition();if("keydown"===t.type&&27===t.keyCode&&(t.target.getAttribute&&"true"===t.target.getAttribute("aria-expanded")?t.target===this.button:E(t.target,this.nodeName)===this))return this.hidden=!0,this.button.focus(),t.preventDefault();if("click"===t.type){var e=E(t.target,"a,button");e&&!e.hasAttribute("aria-expanded")&&E(t.target,this.nodeName)===this?_(this,"toggle.select",e):e&&e.getAttribute("aria-controls")===this.id?this.hidden=!this.hidden:this.popup&&!this.contains(t.target)&&(this.hidden=!0)}}}},{key:"updatePosition",value:function(){var t=this;if(!this._skipPosition&&this.button){this._skipPosition=!0,this.style.position="fixed";var e=this.button.getBoundingClientRect(),n=this.getBoundingClientRect(),o=e.left+n.width<window.innerWidth,r=e.bottom+n.height<window.innerHeight,i=e.top-n.height>0,s=r||!i,a=s?window.pageYOffset+e.bottom+n.height+30:0;this.style.left="".concat(Math.round(o?e.left:e.right-n.width),"px"),this.style.top="".concat(Math.round(s?e.bottom:e.top-n.height),"px"),L.style.cssText="position:absolute;padding:1px;top:".concat(Math.round(a),"px"),setTimeout((function(){return t._skipPosition=null}))}}},{key:"button",get:function(){return this._button&&(this._button.getAttribute("data-for")||this._button.getAttribute("for"))===this.id?this._button:(this._button=this.id&&document.querySelector('[for="'.concat(this.id,'"],[data-for="').concat(this.id,'"]')))||this.previousElementSibling}},{key:"popup",get:function(){return"true"===this.getAttribute("popup")||this.getAttribute("popup")||this.hasAttribute("popup")},set:function(t){this[!1===t?"removeAttribute":"setAttribute"]("popup",t)}},{key:"autoposition",get:function(){return this.hasAttribute("autoposition")},set:function(t){x(this,"autoposition",t)}},{key:"hidden",get:function(){return this.hasAttribute("hidden")},set:function(t){x(this,"hidden",t)}},{key:"value",get:function(){return this.button.value||this.button.textContent},set:function(t){if(void 0===t&&(t=!1),this.button&&this.popup.length){var e=this.button,n=(e.getAttribute("aria-label")||",".concat(this.popup)).split(",")[1],o=t.textContent||t||"";if(n===this.popup){var r=e.querySelector("span")||e;e.value=t.value||o,r[t.innerHTML?"innerHTML":"textContent"]=t.innerHTML||o,e.setAttribute("aria-label","".concat(e.textContent,",").concat(this.popup))}}}}])&&c(o.prototype,r),i&&c(o,i),a}();function A(t,e){e?(t._positionObserver&&t._positionObserver.disconnect(),L.parentNode&&L.parentNode.removeChild(L),t.style.position=t._positionObserver=null,window.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t)):t.autoposition&&(t._positionObserver||(t._positionObserver=window.MutationObserver&&new window.MutationObserver(t.updatePosition.bind(t))),t._positionObserver&&t._positionObserver.observe(t,{childList:!0,subtree:!0,attributes:!0}),document.body.appendChild(L),window.addEventListener("scroll",t,!0),window.addEventListener("resize",t),t.updatePosition())}var O=function(){var t="undefined"==typeof window?{}:window.Element.prototype,e=t.matches||t.msMatchesSelector||t.webkitMatchesSelector;return t.closest?function(t,e){return t.closest(e)}:function(t,n){for(;t;t=t.parentElement)if(e.call(t,n))return t;return null}}();var C=function(t,e){void 0===e&&(e={});var n=((e.name||t.name||String(t).match(/function ([^(]+)/)[1])+"-"+k()).replace(/.[A-Z]/g,(function(t){return t[0]+"-"+t[1]})),o=e.props||[],r=e.customEvents||[],i=r.reduce((function(t,e){return t[e]="on"+e.replace(/(^|\.)./g,(function(t){return t.slice(-1).toUpperCase()})),t}),{}),s=o.concat("forwardRef",Object.keys(i).map((function(t){return i[t]}))),u=(n+"-"+(e.suffix||"react")).replace(/\W+/g,"-").toLowerCase();return function(e){function n(t){var n=this;e.call(this,t),this.ref=function(t){return"function"==typeof n.props.forwardRef?n.props.forwardRef(t):n.props.forwardRef&&(n.props.forwardRef.current=t),n.el=t},Object.keys(i).forEach((function(t){var e=i[t];n[t]=function(t){n.props[e]&&O(t.target,n.el.nodeName)===n.el&&n.props[e](t)}}))}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.componentDidMount=function(){var e=this;window.customElements.get(u)||window.customElements.define(u,t),o.forEach((function(t){t in e.props&&(e.el[t]=e.props[t])})),r.forEach((function(t){e.el.addEventListener(t,e[t])}))},n.prototype.componentDidUpdate=function(t){var e=this;o.forEach((function(n){t[n]!==e.props[n]&&(e.el[n]=e.props[n])}))},n.prototype.componentWillUnmount=function(){var t=this;r.forEach((function(e){t.el.removeEventListener(e,t[e])}))},n.prototype.render=function(){var t=this;return a.default.createElement(u,Object.keys(this.props).reduce((function(e,n){return-1===s.indexOf(n)&&("className"===n?e.class=t.props[n]:!0===t.props[n]?e[n]="":!1!==t.props[n]&&(e[n]=t.props[n])),e}),{ref:this.ref}))},n}(a.default.Component)}(j,{name:"CoreToggle",customEvents:["toggle","toggle.select"],suffix:"3.1.0"}),M=function(t){var e=t.expanded,o=void 0!==e&&e,r=t.className,s=i({"jkl-expand-arrow":!0,"jkl-expand-arrow--expanded":o},r);return n.createElement("span",{className:s},n.createElement("svg",{className:"jkl-expand-arrow__down",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n.createElement("path",{d:"M6.90762 13.8828L11.9272 8.86326L12.7093 9.64537L6.35463 16L-1.68645e-06 9.64536L0.782101 8.86326L5.80156 13.8827L5.80156 1.01438e-06L6.90762 1.20777e-06L6.90762 13.8828Z",fill:"currentColor"})),n.createElement("svg",{className:"jkl-expand-arrow__up",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n.createElement("path",{d:"M5.80163 2.1172L0.78209 7.13674L-1.29938e-05 6.35464L6.35462 5.14415e-08L12.7093 6.35464L11.9272 7.13674L6.90769 2.11728L6.9077 16L5.80163 16L5.80163 2.1172Z",fill:"currentColor"})))},N=function(e){var s=e.children,a=e.title,u=e.className,c=e.startExpanded,l=o(void 0!==c&&c),p=t(l,2),d=p[0],f=p[1],h=r(d),m=t(h,1)[0],v=i("jkl-accordion-item",u,{"jkl-accordion-item--expanded":d});return n.createElement("div",{"data-testid":"jkl-accordion-item",className:v},n.createElement("button",{className:"jkl-accordion-item__title",type:"button"},n.createElement("span",{className:"jkl-accordion-item__title-text"},a),n.createElement(M,{className:"jkl-accordion-item__title__arrow",expanded:d})),n.createElement(C,{ref:m,"data-testid":"jkl-accordion-item__content-wrapper",className:"jkl-accordion-item__content-wrapper",hidden:!d,onToggle:function(t){t.defaultPrevented||f(!d)}},n.createElement("div",{className:"jkl-accordion-item__content"},s)))},P=function(t){var e=t.children,o=t.inverted,r=t.className,i=void 0===r?"":r;return n.createElement("div",{"data-testid":"jkl-accordion",className:"jkl-accordion ".concat(o?"jkl-accordion--inverted":""," ").concat(i)},e)};export{P as Accordion,N as AccordionItem};
{
"name": "@fremtind/jkl-accordion-react",
"version": "4.0.7",
"version": "4.0.8",
"publishConfig": {

@@ -37,4 +37,4 @@ "access": "public"

"@babel/runtime": "^7.9.0",
"@fremtind/jkl-accordion": "^4.0.4",
"@fremtind/jkl-react-hooks": "^5.0.4",
"@fremtind/jkl-accordion": "^4.0.5",
"@fremtind/jkl-react-hooks": "^5.0.5",
"classnames": "^2.2.6"

@@ -58,3 +58,3 @@ },

},
"gitHead": "42d5287a4ba69cd9026bae593750eb09ad635d18"
"gitHead": "66215cf11d93a541959ce307b3c91161b2bea57c"
}

@@ -1,10 +0,10 @@

# [`@fremtind/jkl-accordion-react`](https://fremtind.github.io/jokul/komponenter/accordion)
# [`@fremtind/jkl-accordion-react`](https://jokul.fremtind.no/komponenter/accordion)
## Beskrivelse
Se portalen for [bruk og prinsipper](https://fremtind.github.io/jokul/komponenter/accordion).
Se portalen for [bruk og prinsipper](https://jokul.fremtind.no/komponenter/accordion).
## Kom i gang
[Lær hvordan du kan ta i bruk Jøkul](https://fremtind.github.io/jokul/developer/getting-started/)
[Lær hvordan du kan ta i bruk Jøkul](https://jokul.fremtind.no/developer/getting-started/)

@@ -11,0 +11,0 @@ ## Bruk av React-pakken

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc