@proximus/lavender-button-icon 2.0.0-alpha.5 → 2.0.0-alpha.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +20 -17
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { PxElement as
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
const
|
|
1
|
+
import { PxElement as s, transferAccessibilityAttributes as d, log as a } from "@proximus/lavender-common";
|
|
2
|
+
const c = ".btn-icon{font-size:var(--px-font-size-base);display:inline-flex;width:var(--px-size-l);height:var(--px-size-l);vertical-align:middle;align-items:center;justify-content:center;cursor:pointer;--btn-transition: all .2s ease-in-out 0s;transition:var(--btn-transition);background:var(--px-color-background-container-primary-default);color:var(--px-color-icon-brand-inverted);border-radius:var(--px-radius-pill);padding:var(--px-padding-xs-mobile);border:var(--px-size-border-m) solid transparent}.btn-icon,.btn-icon *{box-sizing:border-box}.btn-icon ::slotted(px-icon){line-height:0}.btn-icon:hover:not([disabled],[aria-disabled=true],.btn-icon--state-loading){background:var(--px-color-background-state-hover-bordered-default);color:var(--px-color-icon-brand-default);border-color:var(--px-color-border-state-hover-default)}.btn-icon:active:not([disabled],[aria-disabled=true],.btn-icon--state-loading){background:var(--px-color-background-state-active-inverted);color:var(--px-color-icon-state-active-default);border-color:var(--px-color-border-state-active-default)}.btn-icon:focus-visible:not([disabled],[aria-disabled=true]){outline-offset:var(--px-focus-offset-mobile);outline:var(--px-focus-outline-mobile) solid var(--px-color-border-focus-outline-default)}.btn-icon[disabled],.btn-icon[aria-disabled=true]{background:var(--px-color-background-state-disabled-default);color:var(--px-color-icon-state-disabled-default);cursor:default;pointer-events:none}.btn-icon.btn-icon--state-loading{background:var(--px-color-background-state-disabled-default);color:var(--px-color-icon-brand-default);cursor:inherit}.btn-icon--size-small{padding:var(--px-padding-2xs-mobile);width:var(--px-size-m);height:var(--px-size-m)}.btn-icon--variant-secondary{background-color:var(--px-color-background-container-secondary-default);color:var(--px-color-icon-brand-default)}.btn-icon--variant-naked{background-color:transparent;color:var(--px-color-icon-brand-default);width:auto;height:auto}:host([inverted]) .btn-icon{background:var(--px-color-background-container-primary-inverted);color:var(--px-color-icon-brand-default)}:host([inverted]) .btn-icon:hover:not([disabled],[aria-disabled=true],.btn-icon--state-loading){background:var(--px-color-background-state-hover-bordered-inverted);color:var(--px-color-icon-brand-inverted);border-color:var(--px-color-border-state-hover-inverted)}:host([inverted]) .btn-icon:active:not([disabled],[aria-disabled=true],.btn-icon--state-loading){background:var(--px-color-background-state-hover-default);color:var(--px-color-icon-state-active-inverted);border-color:var(--px-color-border-state-active-inverted)}:host([inverted]) .btn-icon:focus-visible:not([disabled],[aria-disabled=true]){outline-color:var(--px-color-border-focus-outline-inverted)}:host([inverted]) .btn-icon[disabled],:host([inverted]) .btn-icon[aria-disabled=true]{background:var(--px-color-background-state-disabled-inverted);color:var(--px-color-icon-state-disabled-inverted)}:host([inverted]) .btn-icon.btn-icon--state-loading{background:var(--px-color-background-state-disabled-inverted);color:var(--px-color-icon-brand-inverted);border-color:transparent}:host([inverted]) .btn-icon.btn-icon--variant-naked{background-color:transparent;color:var(--px-color-icon-brand-inverted)}:host([inverted]) .btn-icon--variant-secondary{background-color:var(--px-color-background-container-secondary-inverted);color:var(--px-color-icon-brand-inverted)}@media only screen and (min-width: 768px){.btn-icon{padding:var(--px-padding-xs-desktop)}.btn-icon:focus-visible:not([disabled],[aria-disabled=true]){outline-offset:var(--px-focus-offset-desktop);outline-width:var(--px-focus-outline-desktop)}.btn-icon--size-small{padding:var(--px-padding-2xs-desktop)}}@media only screen and (min-width: 1025px){.btn-icon{padding:var(--px-padding-xs-desktop)}.btn-icon:focus-visible:not([disabled],[aria-disabled=true]){outline-offset:var(--px-focus-offset-desktop);outline-width:var(--px-focus-outline-desktop)}.btn-icon--size-small{padding:var(--px-padding-2xs-desktop)}}", n = new CSSStyleSheet();
|
|
3
|
+
n.replaceSync(c);
|
|
4
|
+
const l = ["", "default", "small"], b = [
|
|
5
5
|
"",
|
|
6
6
|
"default",
|
|
7
7
|
"secondary",
|
|
8
8
|
"naked"
|
|
9
|
-
],
|
|
9
|
+
], o = class o extends s {
|
|
10
10
|
constructor() {
|
|
11
|
-
super(
|
|
12
|
-
const t = document.createElement(
|
|
11
|
+
super(n), this.template = () => "<slot></slot>";
|
|
12
|
+
const t = document.createElement(o.nativeName);
|
|
13
13
|
t.classList.add("btn-icon"), t.innerHTML = this.template(), this.shadowRoot.appendChild(t);
|
|
14
14
|
}
|
|
15
15
|
static get observedAttributes() {
|
|
@@ -23,7 +23,6 @@ const c = ["", "default", "small"], l = [
|
|
|
23
23
|
];
|
|
24
24
|
}
|
|
25
25
|
connectedCallback() {
|
|
26
|
-
super.connectedCallback();
|
|
27
26
|
const t = this.querySelector("px-icon");
|
|
28
27
|
if (t) {
|
|
29
28
|
const e = t.getAttribute("size"), i = t.getAttribute("color");
|
|
@@ -31,7 +30,7 @@ const c = ["", "default", "small"], l = [
|
|
|
31
30
|
this.$el.focus();
|
|
32
31
|
}), e || t.setAttribute("size", "s"), this.size === "small" && t.setAttribute("size", "xs"), i || t.setAttribute("color", "inherit");
|
|
33
32
|
}
|
|
34
|
-
|
|
33
|
+
d(this, this.$el, !1);
|
|
35
34
|
}
|
|
36
35
|
attributeChangedCallback(t, e, i) {
|
|
37
36
|
if (e !== i)
|
|
@@ -60,10 +59,14 @@ const c = ["", "default", "small"], l = [
|
|
|
60
59
|
this.$el.classList.toggle("btn-icon--state-loading");
|
|
61
60
|
}
|
|
62
61
|
updateSize(t, e) {
|
|
63
|
-
this.checkName(
|
|
62
|
+
this.checkName(l, e) ? (t !== null && t !== "" && t !== "default" && this.$el.classList.toggle(`btn-icon--size-${t}`), e !== null && e !== "" && e !== "default" && this.$el.classList.toggle(`btn-icon--size-${e}`)) : a(
|
|
63
|
+
`${e} is not a valid size value for ${this.tagName.toLowerCase()}`
|
|
64
|
+
);
|
|
64
65
|
}
|
|
65
66
|
updateVariant(t, e) {
|
|
66
|
-
this.checkName(
|
|
67
|
+
this.checkName(b, e) ? (t !== null && t !== "" && t !== "default" && this.$el.classList.toggle(`btn-icon--variant-${t}`), e !== null && e !== "" && e !== "default" && this.$el.classList.toggle(`btn-icon--variant-${e}`)) : a(
|
|
68
|
+
`${e} is not a valid variant value for ${this.tagName.toLowerCase()}`
|
|
69
|
+
);
|
|
67
70
|
}
|
|
68
71
|
get inverted() {
|
|
69
72
|
return this.getAttribute("inverted");
|
|
@@ -96,11 +99,11 @@ const c = ["", "default", "small"], l = [
|
|
|
96
99
|
t ? this.setAttribute("aria-expanded", t) : this.removeAttribute("aria-expanded");
|
|
97
100
|
}
|
|
98
101
|
};
|
|
99
|
-
|
|
100
|
-
let
|
|
101
|
-
customElements.get("px-button-icon") || customElements.define("px-button-icon",
|
|
102
|
+
o.nativeName = "button";
|
|
103
|
+
let r = o;
|
|
104
|
+
customElements.get("px-button-icon") || customElements.define("px-button-icon", r);
|
|
102
105
|
export {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
r as ButtonIcon,
|
|
107
|
+
l as buttonIconSizeValues,
|
|
108
|
+
b as buttonIconVariantValues
|
|
106
109
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proximus/lavender-button-icon",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.50",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"clean": "rm -rf dist",
|
|
14
14
|
"build": "npm run clean && NODE_ENV=development vite build && tsc && npm run transform-package-json && npm run wc-manifest",
|
|
15
15
|
"test": "vitest run --coverage",
|
|
16
|
-
"wc-manifest": "cem analyze --globs \"src/*\" --config
|
|
16
|
+
"wc-manifest": "cem analyze --globs \"src/*\" --config ../../custom-elements-manifest.config.js --outdir dist"
|
|
17
17
|
},
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"access": "public"
|