@proximus/lavender-button-icon 1.0.0-alpha.13 → 1.0.0-alpha.14
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.js +26 -26
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { PxElement as a, transferAccessibilityAttributes as
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
const
|
|
1
|
+
import { PxElement as a, transferAccessibilityAttributes as s } from "@proximus/lavender-common";
|
|
2
|
+
const d = ".btn-icon{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: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)}: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: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--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: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: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(d);
|
|
4
|
+
const c = ["", "default", "small"], l = ["", "default", "secondary", "naked"], r = class r extends a {
|
|
5
5
|
constructor() {
|
|
6
|
-
super(
|
|
6
|
+
super(n), this.template = () => "<slot></slot>";
|
|
7
7
|
const t = document.createElement(this.nativeName);
|
|
8
8
|
t.classList.add("btn-icon"), t.innerHTML = this.template(), this.shadowRoot.appendChild(t);
|
|
9
9
|
}
|
|
@@ -20,44 +20,44 @@ const d = ["", "default", "small"], l = ["", "default", "secondary", "naked"], n
|
|
|
20
20
|
super.connectedCallback();
|
|
21
21
|
const t = this.querySelector("px-icon");
|
|
22
22
|
if (t) {
|
|
23
|
-
const
|
|
23
|
+
const e = t.getAttribute("size"), o = t.getAttribute("color");
|
|
24
24
|
t.addEventListener("click", () => {
|
|
25
25
|
this.$el.focus();
|
|
26
|
-
}),
|
|
26
|
+
}), e || t.setAttribute("size", "s"), this.size === "small" && t.setAttribute("size", "2xs"), o || t.setAttribute("color", "inherit");
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
s(this, this.$el);
|
|
29
29
|
}
|
|
30
|
-
attributeChangedCallback(t,
|
|
31
|
-
if (
|
|
30
|
+
attributeChangedCallback(t, e, o) {
|
|
31
|
+
if (e !== o)
|
|
32
32
|
switch (t) {
|
|
33
33
|
case "loading":
|
|
34
34
|
this.updateLoading();
|
|
35
35
|
break;
|
|
36
36
|
case "size":
|
|
37
|
-
this.updateSize(
|
|
37
|
+
this.updateSize(e, o, c);
|
|
38
38
|
break;
|
|
39
39
|
case "variant":
|
|
40
|
-
this.updateVariant(
|
|
40
|
+
this.updateVariant(e, o, l);
|
|
41
41
|
break;
|
|
42
42
|
default:
|
|
43
|
-
super.attributeChangedCallback(t,
|
|
43
|
+
super.attributeChangedCallback(t, e, o);
|
|
44
44
|
break;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
checkName(t,
|
|
48
|
-
return t.includes(
|
|
47
|
+
checkName(t, e) {
|
|
48
|
+
return t.includes(e);
|
|
49
49
|
}
|
|
50
|
-
_toggleClass(t,
|
|
51
|
-
t !== null && t !== "" && t !== "default" && this.$el.classList.toggle(t),
|
|
50
|
+
_toggleClass(t, e) {
|
|
51
|
+
t !== null && t !== "" && t !== "default" && this.$el.classList.toggle(t), e !== null && e !== "" && e !== "default" && this.$el.classList.toggle(e);
|
|
52
52
|
}
|
|
53
53
|
updateLoading() {
|
|
54
54
|
this.$el.classList.toggle("btn-icon--state-loading");
|
|
55
55
|
}
|
|
56
|
-
updateSize(t,
|
|
57
|
-
this.checkName(
|
|
56
|
+
updateSize(t, e, o) {
|
|
57
|
+
this.checkName(o, 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}`)) : console.error("Bad size value for", this.$el);
|
|
58
58
|
}
|
|
59
|
-
updateVariant(t,
|
|
60
|
-
this.checkName(
|
|
59
|
+
updateVariant(t, e, o) {
|
|
60
|
+
this.checkName(o, 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}`)) : console.error(`Bad "variant" value for ${this.$el}`);
|
|
61
61
|
}
|
|
62
62
|
get inverted() {
|
|
63
63
|
return this.getAttribute("inverted");
|
|
@@ -84,11 +84,11 @@ const d = ["", "default", "small"], l = ["", "default", "secondary", "naked"], n
|
|
|
84
84
|
this.setAttribute("variant", t);
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
|
-
|
|
88
|
-
let
|
|
89
|
-
customElements.get("px-button-icon") || customElements.define("px-button-icon",
|
|
87
|
+
r.nativeName = "button";
|
|
88
|
+
let i = r;
|
|
89
|
+
customElements.get("px-button-icon") || customElements.define("px-button-icon", i);
|
|
90
90
|
export {
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
i as ButtonIcon,
|
|
92
|
+
c as buttonIconSizeValues,
|
|
93
93
|
l as buttonIconVariantValues
|
|
94
94
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proximus/lavender-button-icon",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.14",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "7683b6952d1da07fe58b0f4ddef292e3954ab85d"
|
|
46
46
|
}
|