@proximus/lavender-action-button 2.0.0-alpha.97
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/ActionButton.d.ts +20 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +76 -0
- package/package.json +23 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import '@proximus/lavender-layout';
|
|
2
|
+
import '@proximus/lavender-icon';
|
|
3
|
+
import '@proximus/lavender-span';
|
|
4
|
+
import { PxElement } from '@proximus/lavender-common';
|
|
5
|
+
export declare class ActionButton extends PxElement<HTMLButtonElement> {
|
|
6
|
+
static nativeName: string;
|
|
7
|
+
template: () => string;
|
|
8
|
+
constructor();
|
|
9
|
+
static get observedAttributes(): string[];
|
|
10
|
+
connectedCallback(): void;
|
|
11
|
+
attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
|
|
12
|
+
get $icon(): HTMLElement;
|
|
13
|
+
get $dropdown(): HTMLElement;
|
|
14
|
+
get iconName(): string;
|
|
15
|
+
set iconName(value: string);
|
|
16
|
+
get iconFrom(): string;
|
|
17
|
+
set iconFrom(value: string);
|
|
18
|
+
get promoted(): boolean;
|
|
19
|
+
set promoted(value: boolean);
|
|
20
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ActionButton';
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import "@proximus/lavender-layout";
|
|
2
|
+
import "@proximus/lavender-icon";
|
|
3
|
+
import "@proximus/lavender-span";
|
|
4
|
+
import { PxElement as a, transferAccessibilityAttributes as p } from "@proximus/lavender-common";
|
|
5
|
+
const d = "button{border-radius:var(--px-radius-pill);background-color:var(--px-color-background-container-secondary-default);border:var(--px-size-border-m) solid transparent;width:var(--px-size-l);height:var(--px-size-l)}button:hover{background-color:transparent;border-color:var(--px-color-border-state-hover-default)}@media only screen and (min-width: 48rem){button{border-radius:var(--px-radius-main);width:inherit;height:inherit}}", l = ":host{display:block}:host *{box-sizing:border-box}:host(:not([promoted])){display:none}a,button{display:block;padding:var(--px-padding-xs-mobile);cursor:pointer;border-radius:var(--px-radius-main);text-decoration:none;color:var(--px-color-text-brand-default);--btn-transition: all .2s ease-in-out 0s;transition:var(--btn-transition)}a px-span,button px-span{font-size:var(--px-text-size-label-s-mobile)}a:hover,button:hover{background-color:var(--px-color-background-container-secondary-default)}a:focus-visible,button:focus-visible{outline-offset:var(--px-focus-offset-mobile);outline:var(--px-focus-outline-mobile) solid var(--px-color-border-focus-outline-default)}@media only screen and (min-width: 48rem){a,button{padding:var(--px-padding-xs-tablet) var(--px-padding-2xs-tablet);min-width:65px}a px-span,button px-span{font-size:var(--px-text-size-label-s-tablet)}a:focus-visible,button:focus-visible{outline-offset:var(--px-focus-offset-tablet);outline-width:var(--px-focus-outline-tablet)}:host(:not([promoted])){display:block}}@media only screen and (min-width: 64.0625rem){a,button{padding:var(--px-padding-xs-laptop) var(--px-padding-2xs-laptop)}a px-span,button px-span{font-size:var(--px-text-size-label-s-laptop)}a:focus-visible,button:focus-visible{outline-offset:var(--px-focus-offset-laptop);outline-width:var(--px-focus-outline-laptop)}}@media only screen and (min-width: 90.0625rem){a,button{padding:var(--px-padding-xs-desktop) var(--px-padding-2xs-desktop)}a px-span,button px-span{font-size:var(--px-text-size-label-s-desktop)}a:focus-visible,button:focus-visible{outline-offset:var(--px-focus-offset-desktop);outline-width:var(--px-focus-outline-desktop)}}", s = new CSSStyleSheet(), r = new CSSStyleSheet();
|
|
6
|
+
s.replaceSync(d);
|
|
7
|
+
r.replaceSync(l);
|
|
8
|
+
const i = class i extends a {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(r, s), this.template = () => `
|
|
11
|
+
<button class="action-button">
|
|
12
|
+
<px-vstack gap="none" align-items="center" justify-content="center">
|
|
13
|
+
<px-icon
|
|
14
|
+
name="${this.getAttribute("icon-name")}"
|
|
15
|
+
from="${this.getAttribute("icon-from")}"
|
|
16
|
+
size="s"
|
|
17
|
+
hidden--mobile
|
|
18
|
+
>
|
|
19
|
+
</px-icon>
|
|
20
|
+
<px-span color="brand"><slot></slot></px-span>
|
|
21
|
+
</px-vstack>
|
|
22
|
+
</button>
|
|
23
|
+
`, this.shadowRoot.innerHTML = this.template();
|
|
24
|
+
}
|
|
25
|
+
static get observedAttributes() {
|
|
26
|
+
return [...super.observedAttributes, "icon-name", "icon-from", "promoted"];
|
|
27
|
+
}
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
var t;
|
|
30
|
+
((t = this.parentElement) == null ? void 0 : t.localName) === "px-header" && this.setAttribute("slot", "header-actions"), p(this, this.$el, !1);
|
|
31
|
+
}
|
|
32
|
+
attributeChangedCallback(t, n, e) {
|
|
33
|
+
if (n !== e)
|
|
34
|
+
switch (t) {
|
|
35
|
+
case "icon-name":
|
|
36
|
+
this.$icon.setAttribute("name", e);
|
|
37
|
+
break;
|
|
38
|
+
case "icon-from":
|
|
39
|
+
this.$icon.setAttribute("from", e);
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
super.attributeChangedCallback(t, n, e);
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
get $icon() {
|
|
47
|
+
return this.shadowRoot.querySelector("px-icon");
|
|
48
|
+
}
|
|
49
|
+
get $dropdown() {
|
|
50
|
+
return this.shadowRoot.querySelector("px-dropdown");
|
|
51
|
+
}
|
|
52
|
+
get iconName() {
|
|
53
|
+
return this.getAttribute("icon-name");
|
|
54
|
+
}
|
|
55
|
+
set iconName(t) {
|
|
56
|
+
this.setAttribute("icon-name", t);
|
|
57
|
+
}
|
|
58
|
+
get iconFrom() {
|
|
59
|
+
return this.getAttribute("icon-from");
|
|
60
|
+
}
|
|
61
|
+
set iconFrom(t) {
|
|
62
|
+
this.setAttribute("icon-from", t);
|
|
63
|
+
}
|
|
64
|
+
get promoted() {
|
|
65
|
+
return this.hasAttribute("promoted");
|
|
66
|
+
}
|
|
67
|
+
set promoted(t) {
|
|
68
|
+
t ? this.setAttribute("promoted", "") : this.removeAttribute("promoted");
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
i.nativeName = "button";
|
|
72
|
+
let o = i;
|
|
73
|
+
customElements.get("px-action-button") || customElements.define("px-action-button", o);
|
|
74
|
+
export {
|
|
75
|
+
o as ActionButton
|
|
76
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@proximus/lavender-action-button",
|
|
3
|
+
"version": "2.0.0-alpha.97",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.es.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"type": "module",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"transform-package-json": "node ../../../scripts/tranformPackageJson.js package.json dist/far/away",
|
|
13
|
+
"clean": "rm -rf dist",
|
|
14
|
+
"build": "npm run clean && NODE_ENV=development vite build && tsc && npm run transform-package-json && npm run wc-manifest",
|
|
15
|
+
"test": "vitest run --coverage",
|
|
16
|
+
"wc-manifest": "cem analyze --globs \"src/*\" --config ../../custom-elements-manifest.config.js --outdir dist"
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"customElements": "dist/custom-elements.json",
|
|
22
|
+
"web-types": "./dist/web-types.json"
|
|
23
|
+
}
|