@dile/ui 2.25.7 → 2.26.0
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { html, css, LitElement } from "lit";
|
|
2
|
+
import '../../spinner/spinner-icon.js';
|
|
2
3
|
|
|
3
4
|
export class DileButton extends LitElement {
|
|
4
5
|
|
|
@@ -7,6 +8,7 @@ export class DileButton extends LitElement {
|
|
|
7
8
|
static get properties() {
|
|
8
9
|
return {
|
|
9
10
|
disabled: { type: Boolean },
|
|
11
|
+
loading: { type: Boolean, reflect: true },
|
|
10
12
|
name: { type: String },
|
|
11
13
|
type: { type: String },
|
|
12
14
|
};
|
|
@@ -15,6 +17,7 @@ export class DileButton extends LitElement {
|
|
|
15
17
|
constructor() {
|
|
16
18
|
super();
|
|
17
19
|
this.disabled = false;
|
|
20
|
+
this.loading = false;
|
|
18
21
|
this.type = "button";
|
|
19
22
|
this._internals = this.attachInternals();
|
|
20
23
|
}
|
|
@@ -78,6 +81,35 @@ export class DileButton extends LitElement {
|
|
|
78
81
|
:host([disabled]) {
|
|
79
82
|
pointer-events: none;
|
|
80
83
|
}
|
|
84
|
+
|
|
85
|
+
:host([loading]) button {
|
|
86
|
+
cursor: auto;
|
|
87
|
+
background-color: var(--dile-button-disabled-background-color, var(--dile-button-background-color, #ccc));
|
|
88
|
+
color: var(--dile-button-disabled-text-color, var(--dile-button-text-color, #999));
|
|
89
|
+
border-color: var(--dile-button-disabled-border-color, var(--dile-button-border-color, #bbb));
|
|
90
|
+
}
|
|
91
|
+
:host([loading]) button:focus {
|
|
92
|
+
outline: none;
|
|
93
|
+
box-shadow: none;
|
|
94
|
+
}
|
|
95
|
+
:host([loading]) button:active {
|
|
96
|
+
outline: none;
|
|
97
|
+
border-color: #aaa;
|
|
98
|
+
box-shadow: none;
|
|
99
|
+
}
|
|
100
|
+
:host([loading]) {
|
|
101
|
+
pointer-events: none;
|
|
102
|
+
}
|
|
103
|
+
button {
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
justify-content: center;
|
|
107
|
+
gap: var(--dile-button-spinner-gap, 0.5rem);
|
|
108
|
+
}
|
|
109
|
+
dile-spinner-icon {
|
|
110
|
+
--dile-icon-size: var(--dile-button-spinner-size, calc(var(--dile-button-font-size, 1rem) * 0.8));
|
|
111
|
+
--dile-icon-color: var(--dile-on-primary-color, #fff);
|
|
112
|
+
}
|
|
81
113
|
`;
|
|
82
114
|
}
|
|
83
115
|
|
|
@@ -85,14 +117,17 @@ export class DileButton extends LitElement {
|
|
|
85
117
|
return html`
|
|
86
118
|
<button
|
|
87
119
|
@click=${this._onClick}
|
|
88
|
-
?disabled=${this.disabled}
|
|
120
|
+
?disabled=${this.disabled || this.loading}
|
|
89
121
|
type=${this.type || "button"}
|
|
90
|
-
|
|
122
|
+
>
|
|
123
|
+
${this.loading ? html`<dile-spinner-icon active></dile-spinner-icon>` : ''}
|
|
124
|
+
<slot></slot>
|
|
125
|
+
</button>
|
|
91
126
|
`;
|
|
92
127
|
}
|
|
93
128
|
|
|
94
129
|
_onClick(e) {
|
|
95
|
-
if (this.disabled) {
|
|
130
|
+
if (this.disabled || this.loading) {
|
|
96
131
|
e.preventDefault();
|
|
97
132
|
e.stopPropagation();
|
|
98
133
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.26.0",
|
|
4
4
|
"description": "UI Core components from dile-components.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "90ebde5b908aab4093afeee3bda87ef3ad85904e"
|
|
30
30
|
}
|