@proximus/lavender-button-icon 2.0.0-alpha.165 → 2.0.0-alpha.169
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/ButtonIcon.d.ts +10 -10
- package/dist/index.es.js +104 -108
- package/package.json +1 -1
package/dist/ButtonIcon.d.ts
CHANGED
|
@@ -21,14 +21,14 @@ export declare class ButtonIcon extends PxElement<HTMLButtonElement> {
|
|
|
21
21
|
updateLoading(): void;
|
|
22
22
|
updateSize(oldValue: string, newValue: string): void;
|
|
23
23
|
updateVariant(oldValue: string, newValue: string): void;
|
|
24
|
-
get inverted():
|
|
25
|
-
set inverted(value:
|
|
26
|
-
get loading():
|
|
27
|
-
set loading(value:
|
|
28
|
-
get size(): string;
|
|
29
|
-
set size(value: string);
|
|
30
|
-
get variant(): string;
|
|
31
|
-
set variant(value: string);
|
|
32
|
-
get ariaExpanded(): string;
|
|
33
|
-
set ariaExpanded(value: string);
|
|
24
|
+
get inverted(): boolean;
|
|
25
|
+
set inverted(value: boolean);
|
|
26
|
+
get loading(): boolean;
|
|
27
|
+
set loading(value: boolean);
|
|
28
|
+
get size(): string | null;
|
|
29
|
+
set size(value: string | null);
|
|
30
|
+
get variant(): string | null;
|
|
31
|
+
set variant(value: string | null);
|
|
32
|
+
get ariaExpanded(): string | null;
|
|
33
|
+
set ariaExpanded(value: string | null);
|
|
34
34
|
}
|
package/dist/index.es.js
CHANGED
|
@@ -1,109 +1,105 @@
|
|
|
1
|
-
import { PxElement as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
], o =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
o.nativeName = "button";
|
|
103
|
-
let r = o;
|
|
104
|
-
customElements.get("px-button-icon") || customElements.define("px-button-icon", r);
|
|
105
|
-
export {
|
|
106
|
-
r as ButtonIcon,
|
|
107
|
-
n as buttonIconSizeValues,
|
|
108
|
-
s as buttonIconVariantValues
|
|
1
|
+
import { PxElement as e, accessibilityAttributes as t, log as n } from "@proximus/lavender-common";
|
|
2
|
+
//#region src/buttonicon.css?inline
|
|
3
|
+
var r = ".btn-icon,.btn-icon *{box-sizing:border-box}.btn-icon{font-size:var(--px-font-size-base);width:var(--px-size-l);height:var(--px-size-l);vertical-align:middle;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;justify-content:center;align-items:center;display:inline-flex}.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{color:var(--px-color-icon-brand-default);background-color:#0000;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:#0000}:host([inverted]) .btn-icon.btn-icon--variant-naked{color:var(--px-color-icon-brand-inverted);background-color:#0000}:host([inverted]) .btn-icon--variant-secondary{background-color:var(--px-color-background-container-secondary-inverted);color:var(--px-color-icon-brand-inverted)}@media screen and (width>=48rem){.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 screen and (width>=64.0625rem){.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)}}", i = new CSSStyleSheet();
|
|
4
|
+
i.replaceSync(r);
|
|
5
|
+
var a = [
|
|
6
|
+
"",
|
|
7
|
+
"default",
|
|
8
|
+
"small"
|
|
9
|
+
], o = [
|
|
10
|
+
"",
|
|
11
|
+
"default",
|
|
12
|
+
"secondary",
|
|
13
|
+
"naked"
|
|
14
|
+
], s = class r extends e {
|
|
15
|
+
static {
|
|
16
|
+
this.nativeName = "button";
|
|
17
|
+
}
|
|
18
|
+
constructor() {
|
|
19
|
+
super(i), this.template = () => "<slot></slot>";
|
|
20
|
+
let e = document.createElement(r.nativeName);
|
|
21
|
+
e.classList.add("btn-icon"), e.innerHTML = this.template(), this.shadowRoot.appendChild(e);
|
|
22
|
+
}
|
|
23
|
+
static get observedAttributes() {
|
|
24
|
+
return [
|
|
25
|
+
...super.observedAttributes,
|
|
26
|
+
...t,
|
|
27
|
+
"inverted",
|
|
28
|
+
"loading",
|
|
29
|
+
"size",
|
|
30
|
+
"variant",
|
|
31
|
+
"aria-expanded"
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
let e = this.querySelector("px-icon");
|
|
36
|
+
if (e) {
|
|
37
|
+
let t = e.getAttribute("size"), n = e.getAttribute("color");
|
|
38
|
+
e.addEventListener("click", () => {
|
|
39
|
+
this.$el.focus();
|
|
40
|
+
}), t || e.setAttribute("size", "s"), this.size === "small" && e.setAttribute("size", "xs"), n || e.setAttribute("color", "inherit");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
attributeChangedCallback(e, t, n) {
|
|
44
|
+
if (t !== n) switch (e) {
|
|
45
|
+
case "loading":
|
|
46
|
+
this.updateLoading();
|
|
47
|
+
break;
|
|
48
|
+
case "size":
|
|
49
|
+
this.updateSize(t, n);
|
|
50
|
+
break;
|
|
51
|
+
case "variant":
|
|
52
|
+
this.updateVariant(t, n);
|
|
53
|
+
break;
|
|
54
|
+
case "aria-expanded":
|
|
55
|
+
n && (this.$el.setAttribute("aria-expanded", n), this.removeAttribute("aria-expanded"));
|
|
56
|
+
break;
|
|
57
|
+
default: super.attributeChangedCallback(e, t, n);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
_toggleClass(e, t) {
|
|
61
|
+
e !== null && e !== "" && e !== "default" && this.$el.classList.toggle(e), t !== null && t !== "" && t !== "default" && this.$el.classList.toggle(t);
|
|
62
|
+
}
|
|
63
|
+
updateLoading() {
|
|
64
|
+
this.$el.classList.toggle("btn-icon--state-loading");
|
|
65
|
+
}
|
|
66
|
+
updateSize(e, t) {
|
|
67
|
+
this.checkName(a, t) ? (e !== null && e !== "" && e !== "default" && this.$el.classList.toggle(`btn-icon--size-${e}`), t !== null && t !== "" && t !== "default" && this.$el.classList.toggle(`btn-icon--size-${t}`)) : n(`"${t}" is not a valid size value for ${this.tagName.toLowerCase()}. Allowed values are: "${a.join("\", \"")}".`);
|
|
68
|
+
}
|
|
69
|
+
updateVariant(e, t) {
|
|
70
|
+
this.checkName(o, t) ? (e !== null && e !== "" && e !== "default" && this.$el.classList.toggle(`btn-icon--variant-${e}`), t !== null && t !== "" && t !== "default" && this.$el.classList.toggle(`btn-icon--variant-${t}`)) : n(`"${t}" is not a valid variant value for ${this.tagName.toLowerCase()}. Allowed values are: "${o.join("\", \"")}".`);
|
|
71
|
+
}
|
|
72
|
+
get inverted() {
|
|
73
|
+
return this.hasAttribute("inverted");
|
|
74
|
+
}
|
|
75
|
+
set inverted(e) {
|
|
76
|
+
this._updateBooleanAttribute("inverted", e);
|
|
77
|
+
}
|
|
78
|
+
get loading() {
|
|
79
|
+
return this.hasAttribute("loading");
|
|
80
|
+
}
|
|
81
|
+
set loading(e) {
|
|
82
|
+
this._updateBooleanAttribute("loading", e);
|
|
83
|
+
}
|
|
84
|
+
get size() {
|
|
85
|
+
return this.getAttribute("size");
|
|
86
|
+
}
|
|
87
|
+
set size(e) {
|
|
88
|
+
this._updateAttribute("size", e);
|
|
89
|
+
}
|
|
90
|
+
get variant() {
|
|
91
|
+
return this.getAttribute("variant");
|
|
92
|
+
}
|
|
93
|
+
set variant(e) {
|
|
94
|
+
this._updateAttribute("variant", e);
|
|
95
|
+
}
|
|
96
|
+
get ariaExpanded() {
|
|
97
|
+
return this.getAttribute("aria-expanded");
|
|
98
|
+
}
|
|
99
|
+
set ariaExpanded(e) {
|
|
100
|
+
this._updateAttribute("aria-expanded", e);
|
|
101
|
+
}
|
|
109
102
|
};
|
|
103
|
+
customElements.get("px-button-icon") || customElements.define("px-button-icon", s);
|
|
104
|
+
//#endregion
|
|
105
|
+
export { s as ButtonIcon, a as buttonIconSizeValues, o as buttonIconVariantValues };
|