{"version":3,"names":["faqItemCss","FaqItem","componentWillLoad","this","faqId","faqTitle","replace","window","location","hash","toLowerCase","open","toggleFaq","e","closeOtherFaqs","currentTarget","setAttribute","hoveredIn","target","closest","classList","add","hoveredOut","remove","faqs","document","querySelectorAll","forEach","faq","closeFaq","render","h","class","type","id","onClick","onKeyPress","key","onMouseEnter","onMouseLeave","onFocusin","onFocusout","icon","role"],"sources":["src/components/faq-item/faq-item.scss?tag=kdx-faq","src/components/faq-item/faq-item.tsx"],"sourcesContent":[".kdx-faq {\r\n\tbackground: $faqBackgroundColor;\r\n\tbox-shadow: $faqBoxShadow;\r\n\tborder-radius: 6px;\r\n\toverflow: hidden;\r\n\tmargin: 15px 0;\r\n\ttransition: transform 350ms;\r\n\t\t\r\n\t&:hover, &:focus, &.hover {\t\t\r\n\t\tbox-shadow: $faqBoxShadowHover;\r\n\t\t\r\n\t\t.accordion-trigger {\r\n\t\t\tcolor: $faqTitleHoverColor; \t\t\t\r\n\t\t}\r\n\t\t.icon {\r\n\t\t\ttransform: rotate(90deg);\r\n\t\t}\r\n\t}\r\n\t.accordion-trigger {\r\n\t\tpadding: 20px;\r\n\t\tmargin: 0;\r\n\t\twidth: 100%;\r\n\t\t@include text-size(18);\r\n\t\t@include line-height(24);\r\n\t\tfont-weight: 600;\r\n\t\ttext-align: left;\r\n\t\tcolor: $faqTitleColor;\r\n\t\tuser-select: none;\r\n\t\tdisplay: flex;\r\n\t\talign-items: center;\r\n\t\ttransition: all 350ms;\r\n\t\tbackground: none;\r\n\t\toutline: none;\r\n\t\tborder: none;\r\n\t\t\r\n\r\n\t\t.icon {\r\n\t\t\tdisplay: inline-block;\r\n\t\t\ttransition: transform 350ms;\r\n\t\t\tmargin-right: 10px;\r\n\t\t}\r\n\r\n\t\tsvg {\r\n\t\t\t@include svg-format(10px, 21px, currentColor);\r\n\t\t\ttransform: translateY(-2px);\r\n\t\t}\r\n\t}\r\n\r\n\t.kdx-faq-content {\r\n\t\tmax-height: 0;\r\n\t\toverflow: hidden;\r\n\t\ttransition: max-height 650ms;\r\n\t\t@include line-height(26);\r\n\t}\r\n\r\n\t.kdx-faq-content-inner {\r\n\t\tpadding: 0px 20px 30px 60px;\r\n\r\n\t\tp { padding-bottom: 20px; }\r\n\r\n\t\th4 { margin-bottom: 20px; }\r\n\r\n\t\tul li {\r\n\t\t\t&:last-child { padding-bottom: 10px !important; }\r\n\t\t}\r\n\t}\r\n\r\n\t&.open {\r\n\t\tcolor: $faqTitleHoverColor;\r\n\t\toutline: none;\r\n\t\tbox-shadow: $faqBoxShadowHover;\r\n\t\t\r\n\t\t.accordion-trigger {\r\n\t\t\tcolor: $faqTitleHoverColor;\r\n\r\n\t\t\t.icon {\r\n\t\t\t\ttransform: rotate(90deg);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.kdx-faq-content {\r\n\t\t\tmax-height: 100%;\r\n\t\t}\r\n\t}\r\n\r\n\t&:hover {\r\n\t\ttransform: translateY(-5px);\r\n\t}\r\n\r\n}\r\n\r\n\r\n\r\n\r\n\r\n@include media-breakpoint-down(md) {\r\n\t.kdx-faq {\r\n\t\t.accordion-trigger {\t\t\t\r\n\t\t\t@include text-size(15);\r\n\t\t\t@include line-height(19);\r\n\t\t\tpadding: 18px 20px 18px 20px;\r\n\r\n\t\t\tsvg {\r\n\t\t\t\t@include svg-format(8px, 15px, currentColor);\r\n\t\t\t\ttransform: translateY(0px);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t.kdx-faq-content-inner {\r\n\t\t\tpadding: 0px 20px 20px 38px;\r\n\t\t}\r\n\t}\r\n}\r\n","import { Component, h, Method, Prop, State } from '@stencil/core';\r\n\r\n@Component({\r\n\ttag: 'kdx-faq',\r\n\tstyleUrl: 'faq-item.scss',\r\n\tshadow: false,\r\n})\r\nexport class FaqItem {\r\n\r\n\t@Prop() faqTitle: string;\r\n\t@Prop({mutable: true}) faqId: string;\r\n\t@State() open: boolean = false;\r\n\r\n\tcomponentWillLoad() {\r\n\t\t// If not id is provided, generate one using the faq title.\r\n\t\tif (!this.faqId) {\r\n\t\t\tthis.faqId = this.faqTitle.replace(/[^A-Z0-9]/ig, \"-\");\r\n\t\t}\r\n\r\n\t\t// If hash matches this faq, start it open.\r\n\t\tif (window.location.hash && window.location.hash.toLowerCase() == '#' + this.faqId.toLowerCase()) {\r\n\t\t\tthis.open = true;\r\n\t\t}\r\n\t}\r\n\r\n\ttoggleFaq(e) {\r\n\t\tthis.closeOtherFaqs();\r\n\t\tthis.open = !this.open;\r\n\t\te.currentTarget.setAttribute(\"aria-expanded\", \"true\");\r\n\t}\r\n\r\n\thoveredIn(e) {\r\n\t\te.target.closest('.kdx-faq').classList.add('hover');\r\n\t}\r\n\t\r\n\thoveredOut(e) {\r\n\t\te.target.closest('.kdx-faq').classList.remove('hover');\r\n\t}\r\n\r\n\tcloseOtherFaqs() {\r\n\t\tconst faqs = document.querySelectorAll('kdx-faq');\r\n\r\n\t\tfaqs.forEach((faq) => {\r\n\t\t\tif (faq.faqId != this.faqId) {\r\n\t\t\t\tfaq.closeFaq();\r\n\t\t\t\tfaq.setAttribute(\"aria-expanded\", \"false\");\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\t@Method() async closeFaq() {\r\n\t\tthis.open = false;\t\t\r\n\t}\r\n\r\n\trender() {\r\n\t\treturn (\r\n\t\t\t