import { r as registerInstance, h, H as Host } from './index-Co4V4Zk-.js';

const spwTagCss = () => `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:inline-block;--spw-tag-padding-extra-small:6px 8px;--spw-tag-padding-small:6px 10px;--spw-tag-padding-medium:6px 10px;--spw-tag-padding-large:6px 10px}.spw-tag{text-decoration:none;display:inline-flex;align-items:center;justify-content:center;gap:6px;line-height:1;border-radius:999px;border:1px solid transparent;white-space:nowrap}.spw-tag--hoverable{position:relative;transition:all linear 0.2s}.spw-tag--hoverable:hover{transform:translateY(-3px)}.spw-tag--default{background:#fff;color:var(--spw-colors-support-grey-grey-900);border-color:var(--spw-colors-support-grey-grey-300)}.spw-tag--grey{background:var(--spw-colors-support-grey-grey-100);color:var(--spw-colors-support-grey-grey-800)}.spw-tag--blue{background:#e6f3ff;color:#002e6b}.spw-tag--green{background:#e2fde3;color:#026100}.spw-tag--orange{background:#ffeee0;color:#702000}.spw-tag--red{background:#ffebed;color:#70000d}.spw-tag--purple{background:#f7ebff;color:#45036d}.spw-tag--surface-dark{box-shadow:0px 2px 3px 0px rgba(0, 0, 0, 0.15)}.spw-tag--size-extra-small{font-size:12px;line-height:11px;padding:var(--spw-tag-padding-extra-small);gap:4px}.spw-tag--size-small{font-size:14px;line-height:13px;padding:var(--spw-tag-padding-small);gap:4px}.spw-tag--size-medium{font-size:16px;line-height:15px;padding:var(--spw-tag-padding-medium)}.spw-tag--size-large{font-size:18px;line-height:17px;padding:var(--spw-tag-padding-large)}`;

const SpwTag = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        /** Type de variante de tag */
        this.variant = 'default';
        /** Type de surface sur laquelle le tag est positionné */
        this.surface = 'light';
        /** Présence ou pas de l'icône */
        this.hasIcon = true;
        /** Attribut target, s'applique uniquement si href est rempli */
        this.target = '_self';
        /** Définit la taille du tag */
        this.size = 'medium';
        /** Permet de spécifier une variante de Font Awesome */
        this.iconVariant = 'fa-solid';
        /** Position de l'icône à l'intérieur du tag */
        this.iconPosition = 'left';
        this.getIcon = variant => {
            const icons = {
                default: 'fa-bell',
                grey: 'fa-ellipsis',
                blue: 'fa-loader',
                green: 'fa-check',
                orange: 'fa-triangle-exclamation',
                red: 'fa-octagon-xmark',
                purple: 'fa-sparkles',
            };
            return icons[variant] || icons['default'];
        };
    }
    get elementClass() {
        return {
            'spw-tag': true,
            'spw-tag--hoverable': !!this.href,
            'spw-tag--icon': this.hasIcon,
            [`spw-tag--${this.variant}`]: true,
            [`spw-tag--size-${this.size}`]: true,
            [`spw-tag--surface-${this.surface}`]: true,
        };
    }
    render() {
        const { href, target } = this;
        const TagType = this.href === undefined ? 'div' : 'a';
        const attrs = TagType === 'div'
            ? {}
            : {
                href,
                target,
            };
        const iconToDisplay = this.icon || this.getIcon(this.variant);
        const iconElement = this.hasIcon ? h("spw-icon", { variant: this.iconVariant, icon: iconToDisplay }) : null;
        return (h(Host, { key: '66fefcbc20cb9c4a48fc12a274db74e7eed9fe9e' }, h(TagType, Object.assign({ key: '0359073291695253e18cb626cfdd97de3b14ca37' }, attrs, { class: this.elementClass }), this.iconPosition === 'left' && iconElement, h("slot", { key: 'ed3d5252033a336f38eb9f9bf5e9a5417b857f18' }), this.iconPosition === 'right' && iconElement)));
    }
};
SpwTag.style = spwTagCss();

export { SpwTag as spw_tag };
