@elvia/elvis-accordion
Advanced tools
Comparing version 2.8.12 to 2.8.13
@@ -5,2 +5,14 @@ { | ||
{ | ||
"date": "08.12.22", | ||
"version": "2.8.13", | ||
"changelog": [ | ||
{ | ||
"type": "bug_fix", | ||
"changes": [ | ||
"Fixed an issue that caused the accordion to trigger rerenders when it was not supposed to. This caused, among other things, CSS animations to rerun." | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"date": "05.12.22", | ||
@@ -7,0 +19,0 @@ "version": "2.8.12", |
@@ -5,3 +5,3 @@ /* | ||
*/ | ||
"use strict";function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=_interopRequireWildcard(require("react")),_elvisToolbox=require("@elvia/elvis-toolbox"),_styledComponents=require("./styledComponents"),_expandCircleColor=_interopRequireDefault(require("@elvia/elvis-assets-icons/dist/icons/expandCircleColor")),_expandCircleFilledColor=_interopRequireDefault(require("@elvia/elvis-assets-icons/dist/icons/expandCircleFilledColor")),_excluded=["content","isOpen","isHovering","isFullWidth","openLabel","closeLabel","openDetailText","closeDetailText","openAriaLabel","closeAriaLabel","isStartAligned","hasBoldLabel","labelPosition","size","type","spacingAboveContent","spacingBelowContent","overflowHeight","typography","onOpen","onClose","className","inlineStyle","webcomponent"];function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||"object"!==_typeof(a)&&"function"!=typeof a)return{default:a};var c=_getRequireWildcardCache(b);if(c&&c.has(a))return c.get(a);var d={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a)if("default"!=f&&Object.prototype.hasOwnProperty.call(a,f)){var g=e?Object.getOwnPropertyDescriptor(a,f):null;g&&(g.get||g.set)?Object.defineProperty(d,f,g):d[f]=a[f]}return d.default=a,c&&c.set(a,d),d}function _extends(){return _extends=Object.assign?Object.assign.bind():function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _iterableToArrayLimit(a,b){var c=null==a?null:"undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=c){var d,e,f=[],g=!0,h=!1;try{for(c=c.call(a);!(g=(d=c.next()).done)&&(f.push(d.value),!(b&&f.length===b));g=!0);}catch(a){h=!0,e=a}finally{try{g||null==c["return"]||c["return"]()}finally{if(h)throw e}}return f}}function _arrayWithHoles(a){if(Array.isArray(a))return a}function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||Object.prototype.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c,d,e={},f=Object.keys(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||(e[c]=a[c]);return e}var Accordion=function(a){var b=a.content,c=a.isOpen,d=void 0!==c&&c,e=a.isHovering,f=void 0!==e&&e,g=a.isFullWidth,h=void 0!==g&&g,i=a.openLabel,j=a.closeLabel,k=a.openDetailText,l=a.closeDetailText,m=a.openAriaLabel,n=a.closeAriaLabel,o=a.isStartAligned,p=void 0!==o&&o,q=a.hasBoldLabel,r=a.labelPosition,s=void 0===r?"center":r,t=a.size,u=void 0===t?"medium":t,v=a.type,w=void 0===v?"normal":v,x=a.spacingAboveContent,y=void 0===x?"8px":x,z=a.spacingBelowContent,A=void 0===z?"16px":z,B=a.overflowHeight,C=a.typography,D=a.onOpen,E=a.onClose,F=a.className,G=a.inlineStyle,H=a.webcomponent,I=_objectWithoutProperties(a,_excluded),J=(0,_react.useState)(d),K=_slicedToArray(J,2),L=K[0],M=K[1],N=(0,_react.useState)(!1),O=_slicedToArray(N,2),P=O[0],Q=O[1],R=(0,_react.useState)(!1),S=_slicedToArray(R,2),T=S[0],U=S[1],V=(0,_react.useState)(0),W=_slicedToArray(V,2),X=W[0],Y=W[1],Z=(0,_react.useRef)(null);(0,_react.useEffect)(function(){return Z&&Z.current&&(0,_elvisToolbox.outlineListener)(Z.current),function(){Z&&Z.current&&(0,_elvisToolbox.outlineListener)(Z.current,!0)}},[]);var $=(0,_elvisToolbox.useSlot)("content",H,{callback:function callback(a){return U(a)},useEffectDependencies:[w]}),_=$.ref;(0,_react.useEffect)(function(){M(d)},[d]),(0,_react.useEffect)(function(){"single"===w?U(!1):U(!0)},[w]),(0,_react.useEffect)(function(){b&&U(!0)},[b]),(0,_react.useEffect)(function(){var a=_.current;if(a){var b=function(){Y(a.scrollHeight)},c=new MutationObserver(b);return c.observe(a,{childList:!0,subtree:!0}),b(),function(){c.disconnect()}}},[_,_.current]);var aa=function(){"single"===w||(L?!H&&E?E():H&&H.triggerEvent("onClose"):!H&&D?D():H&&H.triggerEvent("onOpen"),M(function(a){return!a}))};return/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionWrapper,{ref:Z},/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionArea,_extends({"aria-expanded":L,className:"".concat(F?F:""),style:G,"data-testid":"accordion-area"},I),"overflow"===w?/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionContent,{type:w,spacingAboveContent:y,spacingBelowContent:A,isOpenState:L,overflowHeight:B,contentHeight:X,hasContent:T,ref:_,"data-testid":"accordion-content-overflow"},b):null,/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionButtonArea,{labelPosition:s,type:w},/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionButton,{size:u,currType:w,isFullWidth:h,isOpenState:L,hasBoldLabel:!(void 0!==q)||q,openDetailText:k,openLabel:i?i:"",closeLabel:j?j:"",typography:C,onClick:function onClick(){return aa()},onMouseEnter:function onMouseEnter(){return Q(!0)},onMouseLeave:function onMouseLeave(){return Q(!1)},"data-testid":"accordion-button-label","aria-label":function decideButtonAriaLabel(){return L?n?n:j?j:"Lukk":m?m:i?i:"\xC5pne"}()},function shouldShowLeftIcon(){return p&&!h}()&&/*#__PURE__*/_react.default.createElement(_elvisToolbox.IconWrapper,{icon:P||f?_expandCircleFilledColor.default:_expandCircleColor.default,size:"small"===u?"xs":"sm"}),/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionLabel,{hasLabel:"single"!==w,openLabel:i?i:"",isStartAligned:p,isFullWidth:h},/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionLabelText,null,L?j:i),/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionDetailText,{size:u,openDetailText:k},L?l:k)),function shouldShowRightIcon(){return p&&h||!p}()&&/*#__PURE__*/_react.default.createElement(_elvisToolbox.IconWrapper,{icon:P||f?_expandCircleFilledColor.default:_expandCircleColor.default,size:"small"===u?"xs":"sm"}))),"normal"===w?/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionContent,{type:w,spacingAboveContent:y,spacingBelowContent:A,isOpenState:L,hasContent:T,contentHeight:X,overflowHeight:B,"data-testid":"accordion-content-normal",ref:_},b):null))},_default=Accordion;exports.default=_default; | ||
"use strict";function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=_interopRequireWildcard(require("react")),_elvisToolbox=require("@elvia/elvis-toolbox"),_styledComponents=require("./styledComponents"),_expandCircleColor=_interopRequireDefault(require("@elvia/elvis-assets-icons/dist/icons/expandCircleColor")),_expandCircleFilledColor=_interopRequireDefault(require("@elvia/elvis-assets-icons/dist/icons/expandCircleFilledColor")),_excluded=["content","isOpen","isHovering","isFullWidth","openLabel","closeLabel","openDetailText","closeDetailText","openAriaLabel","closeAriaLabel","isStartAligned","hasBoldLabel","labelPosition","size","type","spacingAboveContent","spacingBelowContent","overflowHeight","typography","onOpen","onClose","className","inlineStyle","webcomponent"];function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||"object"!==_typeof(a)&&"function"!=typeof a)return{default:a};var c=_getRequireWildcardCache(b);if(c&&c.has(a))return c.get(a);var d={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a)if("default"!=f&&Object.prototype.hasOwnProperty.call(a,f)){var g=e?Object.getOwnPropertyDescriptor(a,f):null;g&&(g.get||g.set)?Object.defineProperty(d,f,g):d[f]=a[f]}return d.default=a,c&&c.set(a,d),d}function _extends(){return _extends=Object.assign?Object.assign.bind():function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _iterableToArrayLimit(a,b){var c=null==a?null:"undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=c){var d,e,f=[],g=!0,h=!1;try{for(c=c.call(a);!(g=(d=c.next()).done)&&(f.push(d.value),!(b&&f.length===b));g=!0);}catch(a){h=!0,e=a}finally{try{g||null==c["return"]||c["return"]()}finally{if(h)throw e}}return f}}function _arrayWithHoles(a){if(Array.isArray(a))return a}function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||Object.prototype.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c,d,e={},f=Object.keys(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||(e[c]=a[c]);return e}var Accordion=function(a){var b=a.content,c=a.isOpen,d=void 0!==c&&c,e=a.isHovering,f=void 0!==e&&e,g=a.isFullWidth,h=void 0!==g&&g,i=a.openLabel,j=a.closeLabel,k=a.openDetailText,l=a.closeDetailText,m=a.openAriaLabel,n=a.closeAriaLabel,o=a.isStartAligned,p=void 0!==o&&o,q=a.hasBoldLabel,r=a.labelPosition,s=void 0===r?"center":r,t=a.size,u=void 0===t?"medium":t,v=a.type,w=void 0===v?"normal":v,x=a.spacingAboveContent,y=void 0===x?"8px":x,z=a.spacingBelowContent,A=void 0===z?"16px":z,B=a.overflowHeight,C=a.typography,D=a.onOpen,E=a.onClose,F=a.className,G=a.inlineStyle,H=a.webcomponent,I=_objectWithoutProperties(a,_excluded),J=(0,_react.useState)(d),K=_slicedToArray(J,2),L=K[0],M=K[1],N=(0,_react.useState)(!1),O=_slicedToArray(N,2),P=O[0],Q=O[1],R=(0,_react.useState)(!1),S=_slicedToArray(R,2),T=S[0],U=S[1],V=(0,_react.useState)(0),W=_slicedToArray(V,2),X=W[0],Y=W[1],Z=(0,_react.useRef)(null);(0,_react.useEffect)(function(){return Z&&Z.current&&(0,_elvisToolbox.outlineListener)(Z.current),function(){Z&&Z.current&&(0,_elvisToolbox.outlineListener)(Z.current,!0)}},[]);var $=(0,_elvisToolbox.useSlot)("content",H,{callback:(0,_react.useCallback)(function(a){return U(a)},[]),useEffectDependencies:(0,_react.useMemo)(function(){return[w]},[w])}),_=$.ref;(0,_react.useEffect)(function(){M(d)},[d]),(0,_react.useEffect)(function(){"single"===w?U(!1):U(!0)},[w]),(0,_react.useEffect)(function(){b&&U(!0)},[b]),(0,_react.useEffect)(function(){var a=_.current;if(a){var b=function(){Y(a.scrollHeight)},c=new MutationObserver(b);return c.observe(a,{childList:!0,subtree:!0}),b(),function(){c.disconnect()}}},[_,_.current]);var aa=function(){"single"===w||(L?!H&&E?E():H&&H.triggerEvent("onClose"):!H&&D?D():H&&H.triggerEvent("onOpen"),M(function(a){return!a}))};return/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionWrapper,{ref:Z},/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionArea,_extends({"aria-expanded":L,className:"".concat(F?F:""),style:G,"data-testid":"accordion-area"},I),"overflow"===w?/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionContent,{type:w,spacingAboveContent:y,spacingBelowContent:A,isOpenState:L,overflowHeight:B,contentHeight:X,hasContent:T,ref:_,"data-testid":"accordion-content-overflow"},b):null,/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionButtonArea,{labelPosition:s,type:w},/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionButton,{size:u,currType:w,isFullWidth:h,isOpenState:L,hasBoldLabel:!(void 0!==q)||q,openDetailText:k,openLabel:i?i:"",closeLabel:j?j:"",typography:C,onClick:function onClick(){return aa()},onMouseEnter:function onMouseEnter(){return Q(!0)},onMouseLeave:function onMouseLeave(){return Q(!1)},"data-testid":"accordion-button-label","aria-label":function decideButtonAriaLabel(){return L?n?n:j?j:"Lukk":m?m:i?i:"\xC5pne"}()},function shouldShowLeftIcon(){return p&&!h}()&&/*#__PURE__*/_react.default.createElement(_elvisToolbox.IconWrapper,{icon:P||f?_expandCircleFilledColor.default:_expandCircleColor.default,size:"small"===u?"xs":"sm"}),/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionLabel,{hasLabel:"single"!==w,openLabel:i?i:"",isStartAligned:p,isFullWidth:h},/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionLabelText,null,L?j:i),/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionDetailText,{size:u,openDetailText:k},L?l:k)),function shouldShowRightIcon(){return p&&h||!p}()&&/*#__PURE__*/_react.default.createElement(_elvisToolbox.IconWrapper,{icon:P||f?_expandCircleFilledColor.default:_expandCircleColor.default,size:"small"===u?"xs":"sm"}))),"normal"===w?/*#__PURE__*/_react.default.createElement(_styledComponents.AccordionContent,{type:w,spacingAboveContent:y,spacingBelowContent:A,isOpenState:L,hasContent:T,contentHeight:X,overflowHeight:B,"data-testid":"accordion-content-normal",ref:_},b):null))},_default=Accordion;exports.default=_default; | ||
//# sourceMappingURL=elvia-accordion.js.map |
{ | ||
"name": "@elvia/elvis-accordion", | ||
"version": "2.8.12", | ||
"version": "2.8.13", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "web_component.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66905
982