/*!
 * Built with Stencil
 * By PostNord.
 */
'use strict';

var index = require('./index-CfUQZtlH.js');
var colors = require('./colors-Dzlq0FRO.js');

const pnIconCss = () => `${index.transformTag("pn-icon")}{display:inline-block;vertical-align:top;--pn-icon-color:main.$gray900}${index.transformTag("pn-icon")}[small] svg{height:1em;width:1em}${index.transformTag("pn-icon")} svg{display:block;height:1.5em;width:1.5em}${index.transformTag("pn-icon")} .pn-icon-svg>circle,${index.transformTag("pn-icon")} .pn-icon-svg>path{fill:var(--pn-icon-color);transition-property:fill;transition-duration:0.2s;transition-timing-function:cubic-bezier(0.7, 0, 0.3, 1)}@media (prefers-reduced-motion: reduce){${index.transformTag("pn-icon")} .pn-icon-svg>circle,${index.transformTag("pn-icon")} .pn-icon-svg>path{transition-duration:0s;transition-delay:0s}}`;

const PnIcon = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
    }
    get hostElement() { return index.getElement(this); }
    /**
     * The SVG content of the icon you want to use.
     *
     * Flags cannot be colored.
     *
     * @see {@link https://portal.postnord.com/web-components/?path=/docs/components-design-tokens-icon--docs|PostNord Icons (Storybook)}
     * @see {@link https://portal.postnord.com/web-components/?path=/docs/components-design-tokens-flag--docs|PostNord Flags (Storybook)}
     **/
    icon = '';
    /** Make the icon small (16 instead of 24px). */
    small = false;
    /**
     * Color the icon with one of the follwing colors from our library.
     * @see {@link https://portal.postnord.com/web-components/?path=/docs/components-design-tokens-colors--docs|PostNord Colors (Storybook)}
     **/
    color = 'gray900';
    handleColor() {
        const color = colors.colors[this.color] || colors.gray900;
        this.hostElement.style.setProperty('--pn-icon-color', color);
    }
    componentWillLoad() {
        this.handleColor();
    }
    render() {
        return index.h(index.Host, { key: 'f63d0b1e54fe91f9fcf33811f6694e604e09929d', role: "presentation", class: "pn-icon", innerHTML: this.icon });
    }
    static get watchers() { return {
        "color": [{
                "handleColor": 0
            }]
    }; }
};
PnIcon.style = pnIconCss();

const pnTagCss = () => `${index.transformTag("pn-tag")}{display:inline-block}${index.transformTag("pn-tag")} .pn-tag{display:inline-flex;flex-direction:row;gap:0.5em;justify-content:center;align-items:center;border-radius:0.5em;padding:0.5em 1em}${index.transformTag("pn-tag")} .pn-tag[data-icon]{padding-left:0.75em}${index.transformTag("pn-tag")} .pn-tag{background-color:rgba(142, 221, 249, 0.3);color:#0d234b}${index.transformTag("pn-tag")} .pn-tag[data-dark]{background-color:#8eddf9}${index.transformTag("pn-tag")} .pn-tag ${index.transformTag("pn-icon")} .pn-icon-svg path{fill:#0d234b}${index.transformTag("pn-tag")} .pn-tag-label{line-height:1.5em;font-weight:400}${index.transformTag("pn-tag")} .pn-tag{}${index.transformTag("pn-tag")} .pn-tag[data-xsmall]{padding:0 0.5em}${index.transformTag("pn-tag")} .pn-tag[data-xsmall] .pn-tag-label{font-size:0.875em;line-height:1.715em}${index.transformTag("pn-tag")} .pn-tag{}${index.transformTag("pn-tag")} .pn-tag[data-small]{padding:0.125em 0.5em}${index.transformTag("pn-tag")} .pn-tag[data-small] .pn-tag-label{font-size:0.875em;line-height:1.715em}${index.transformTag("pn-tag")} .pn-tag[data-small][data-icon]{padding-left:0.5em}${index.transformTag("pn-tag")} .pn-tag{}${index.transformTag("pn-tag")} .pn-tag[data-large]{padding:0.75em 1.25em}${index.transformTag("pn-tag")} .pn-tag{}${index.transformTag("pn-tag")} .pn-tag[data-appearance=discrete]{background-color:rgba(211, 206, 203, 0.3);color:#2d2013}${index.transformTag("pn-tag")} .pn-tag[data-appearance=discrete][data-dark]{background-color:#d3cecb}${index.transformTag("pn-tag")} .pn-tag[data-appearance=discrete] ${index.transformTag("pn-icon")} .pn-icon-svg path{fill:#2d2013}${index.transformTag("pn-tag")} .pn-tag[data-appearance=positive]{background-color:rgba(171, 227, 187, 0.3);color:#002f24}${index.transformTag("pn-tag")} .pn-tag[data-appearance=positive][data-dark]{background-color:#abe3bb}${index.transformTag("pn-tag")} .pn-tag[data-appearance=positive] ${index.transformTag("pn-icon")} .pn-icon-svg path{fill:#002f24}${index.transformTag("pn-tag")} .pn-tag[data-appearance=warning]{background-color:rgba(255, 200, 163, 0.3);color:#99290a}${index.transformTag("pn-tag")} .pn-tag[data-appearance=warning][data-dark]{background-color:#ffc8a3}${index.transformTag("pn-tag")} .pn-tag[data-appearance=warning] ${index.transformTag("pn-icon")} .pn-icon-svg path{fill:#99290a}${index.transformTag("pn-tag")} .pn-tag[data-appearance=error]{background-color:rgba(251, 194, 193, 0.3);color:#a70707}${index.transformTag("pn-tag")} .pn-tag[data-appearance=error][data-dark]{background-color:#fbc2c1}${index.transformTag("pn-tag")} .pn-tag[data-appearance=error] ${index.transformTag("pn-icon")} .pn-icon-svg path{fill:#a70707}${index.transformTag("pn-tag")} .pn-tag{}`;

const PnTag = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
    }
    /** The label of the tag. */
    label;
    /**
     * Select icon from out `pn-design-assets` list. Works with any SVG content.
     *
     * **Please note**: Can not be used with the `xsmall` prop due to the small size.
     *
     * @see {@link https://portal.postnord.com/web-components/?path=/docs/docs-assets--docs Get started with PostNord assets.}
     */
    icon;
    /** Set tag appearance: `discrete`, `positive`, `warning` & `error`. @category Visual */
    appearance = '';
    /**
     * Set darker background-color on the tag.
     *
     * This is intended for better tag visibility on colored background.
     *
     * @category Visual
     * @deprecated Will be removed in v8.0.0
     */
    dark = false;
    /** Set larger tag. @category Size */
    large = false;
    /** Set smaller tag. @category Size */
    small = false;
    /** Set extra small tag. @since v7.11.0 @category Size */
    xsmall = false;
    componentWillRender() {
        if (!!this.icon && this.xsmall)
            console.warn(`pn-tag: Icon was not rendered because tag size is set to xsmall`);
    }
    showIcon() {
        return !!this.icon && !this.xsmall;
    }
    render() {
        return (index.h(index.Host, { key: '25baf496ed00dccf72f5eb7cb8f8623814c67452' }, index.h("div", { key: 'beee7ac3dc693e1c8cb5653e2fce3af01566c4e9', class: "pn-tag", "data-appearance": this.appearance, "data-icon": !!this.icon, "data-dark": this.dark, "data-small": this.small, "data-xsmall": this.xsmall, "data-large": this.large }, this.showIcon() && index.h("pn-icon", { key: '64f9df4e0906c8897045a08edce51f8015a1be56', icon: this.icon }), index.h("span", { key: 'a43a26db7b5e7b28eb49f8ac76eab9ebd8b7ee25', class: "pn-tag-label" }, this.label))));
    }
};
PnTag.style = pnTagCss();

exports.pn_icon = PnIcon;
exports.pn_tag = PnTag;
