'use strict';

var index = require('./index-DuCXzb-X.js');

const spwBoxCss = () => `@charset "UTF-8";html{line-height:1.3;-webkit-text-size-adjust:100%;}h1,h2,h3,h4,h5,h6,p,ul,li{padding:0;margin:0}ul{list-style:none}:host{box-sizing:border-box;line-height:1.3;-webkit-text-size-adjust:100%;font-size:100%}:host *,:host *::before,:host *::after{box-sizing:inherit;font-family:var(--spw-ds-font-main)}body{margin:0}hr{box-sizing:content-box;height:0;overflow:visible;}pre{font-family:monospace, monospace;font-size:1em;}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted;}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em;}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0;}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal;}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0;}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px;}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit;}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}:root{--spw-ds-container-xl:1232px;--spw-ds-container-lg:1024px;--spw-ds-container-md:768px;--spw-ds-container-sm:640px}.spw-ds-container{width:100%;padding-left:16px;padding-right:16px;margin-left:auto;margin-right:auto}@media (min-width: 460px){.spw-ds-container{max-width:var(--spw-ds-container-sm)}}@media (min-width: 768px){.spw-ds-container{max-width:var(--spw-ds-container-md)}}@media (min-width: 1024px){.spw-ds-container{max-width:var(--spw-ds-container-lg)}}@media (min-width: 1350px){.spw-ds-container{max-width:var(--spw-ds-container-xl)}}:host{display:block;--spw-box-shadow:var(--spw-effect-elevation-7);--spw-box-radius:8px;--spw-box-sticky-top:32px;--spw-box-padding-small:16px;--spw-box-padding-medium:24px;--spw-box-padding-large:48px;--spw-box-collapse-duration:0.3s;--spw-box-background:white}@media (min-width: 1024px){:host(.spw-box--is-sticky){position:sticky;top:var(--spw-box-sticky-top);align-self:flex-start}}.spw-box{background:var(--spw-box-background)}.spw-box--has-shadow{box-shadow:var(--spw-box-shadow)}.spw-box--has-radius{border-radius:var(--spw-box-radius)}.spw-box--padding-small{padding:var(--spw-box-padding-small)}.spw-box--padding-medium{padding:var(--spw-box-padding-medium)}.spw-box--padding-large{padding:var(--spw-box-padding-large)}.spw-box__header{display:flex;align-items:center;justify-content:space-between;gap:12px}.spw-box__header--collapsible{cursor:pointer}.spw-box__header-icon--open{transform:rotate(180deg)}.spw-box spw-icon{transition:transform var(--spw-box-collapse-duration) ease}.spw-box__content--collapsed{overflow:hidden;transition:height var(--spw-box-collapse-duration) ease}:host(.spw-box--collapsible-sm) .spw-box__header{display:flex}@media (min-width: 460px){:host(.spw-box--collapsible-sm) .spw-box__header{display:none}:host(.spw-box--collapsible-sm) .spw-box__content--collapsed{height:auto !important}}:host(.spw-box--collapsible-md) .spw-box__header{display:flex}@media (min-width: 768px){:host(.spw-box--collapsible-md) .spw-box__header{display:none}:host(.spw-box--collapsible-md) .spw-box__content--collapsed{height:auto !important}}:host(.spw-box--collapsible-lg) .spw-box__header{display:flex}@media (min-width: 1024px){:host(.spw-box--collapsible-lg) .spw-box__header{display:none}:host(.spw-box--collapsible-lg) .spw-box__content--collapsed{height:auto !important}}:host(.spw-box--collapsible-xl) .spw-box__header{display:flex}@media (min-width: 1350px){:host(.spw-box--collapsible-xl) .spw-box__header{display:none}:host(.spw-box--collapsible-xl) .spw-box__content--collapsed{height:auto !important}}:host(.spw-box--collapsible-xxl) .spw-box__header{display:flex}@media (min-width: 1770px){:host(.spw-box--collapsible-xxl) .spw-box__header{display:none}:host(.spw-box--collapsible-xxl) .spw-box__content--collapsed{height:auto !important}}:host(.spw-box--collapsible-always) .spw-box__header{display:flex}`;

const SpwBox = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        /** Permet d'appliquer un border-radius sur la box */
        this.hasRadius = false;
        /** Permet d'appliquer un box-shadow sur la box */
        this.hasShadow = false;
        /** Permet de rendre la box sticky */
        this.isSticky = false;
        /** Définit le padding de la box */
        this.padding = 'none';
        /** Permet de rendre le contenu de la box collapsible sur un breakpoint donné */
        this.isCollapsible = false;
        /** Définit le breakpoint en dessous duquel la box est collapsible (sm: 460px, md: 768px, lg: 1024px, xl: 1350px,
        xxl: 1770px, always: toujours collapsible) */
        this.collapsibleBreakpoint = 'md';
        this.isOpen = false;
        this.toggle = () => {
            if (!this.isCollapsibleActive)
                return;
            this.isOpen = !this.isOpen;
        };
    }
    get isCollapsibleActive() {
        if (!this.isCollapsible)
            return false;
        if (this.collapsibleBreakpoint === 'always')
            return true;
        const breakpoints = { sm: 460, md: 768, lg: 1024, xl: 1350, xxl: 1770 };
        return window.innerWidth <= breakpoints[this.collapsibleBreakpoint];
    }
    get hostClass() {
        return {
            'spw-box--is-sticky': this.isSticky,
            [`spw-box--collapsible-${this.collapsibleBreakpoint}`]: this.isCollapsible,
        };
    }
    get elementClass() {
        return {
            'spw-box': true,
            'spw-box--has-radius': this.hasRadius,
            'spw-box--has-shadow': this.hasShadow,
            [`spw-box--padding-${this.padding}`]: this.padding !== 'none',
        };
    }
    render() {
        var _a, _b;
        const hostStyle = this.stickyTop ? { '--spw-box-sticky-top': this.stickyTop } : undefined;
        const contentStyle = this.isCollapsible ? { height: this.isOpen || !this.isCollapsibleActive ? `${(_b = (_a = this.contentRef) === null || _a === void 0 ? void 0 : _a.scrollHeight) !== null && _b !== void 0 ? _b : 0}px` : '0px' } : undefined;
        return (index.h(index.Host, { key: '71f0ca883b24d20c68e415905b9a7adfe4817268', class: this.hostClass, style: hostStyle }, index.h("div", { key: '370a502d2df32122bb1dbddd1e77fbb809f503e3', class: this.elementClass }, index.h("div", { key: '8fce2c39ca9fb109f5b76583c84afe17d53f7a99', class: { 'spw-box__header': true, 'spw-box__header--collapsible': this.isCollapsible }, onClick: this.toggle }, index.h("slot", { key: '838b378e976f8f567e31bca92190581356d6e6ba', name: "header" }), this.isCollapsible && (index.h("spw-icon", { key: '4bd92026ce4f1dcd353f7ccd75f23c958a1ff6ae', icon: "fa-chevron-down", class: { 'spw-box__header-icon--open': this.isOpen } }))), index.h("div", { key: '08d4138fcc99855e95c27d99d1aadeb33f5aa836', class: { 'spw-box__content': true, 'spw-box__content--collapsed': this.isCollapsible }, style: contentStyle, ref: el => (this.contentRef = el) }, index.h("slot", { key: 'f8990c3198f4058bf836f4496aac3af4bf8fe005' })))));
    }
    get el() { return index.getElement(this); }
};
SpwBox.style = spwBoxCss();

exports.spw_box = SpwBox;
