@vandeurenglenn/lite-elements 0.3.57 → 0.3.59
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/exports/bundle/button.js +61 -10
- package/exports/bundle/icon-button.js +47 -7
- package/exports/button.js +58 -7
- package/exports/icon-button.js +44 -4
- package/package.json +9 -9
package/exports/bundle/button.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import{_ as e,a as t}from"./tslib.es6-B87RQr7F.js";import{r as
|
|
1
|
+
import{_ as e,a as t}from"./tslib.es6-B87RQr7F.js";import{r as o,i as a,x as s,s as r}from"./property-COFqvTC-.js";import{e as l}from"./custom-element-B_TPyPQO.js";import"./elevation.js";let n=(()=>{let n,i,c,h,d,y,p=[l("custom-button")],v=[],b=r,m=[],u=[],g=[],f=[],_=[],x=[],k=[],L=[];return class extends b{static{i=this}static{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(b[Symbol.metadata]??null):void 0;c=[o({attribute:"has-icon",reflect:!0})],h=[o({attribute:"has-label",reflect:!0})],d=[o({attribute:"type",reflect:!0})],y=[o({attribute:!0})],e(this,null,c,{kind:"accessor",name:"hasIcon",static:!1,private:!1,access:{has:e=>"hasIcon"in e,get:e=>e.hasIcon,set:(e,t)=>{e.hasIcon=t}},metadata:t},m,u),e(this,null,h,{kind:"accessor",name:"hasLabel",static:!1,private:!1,access:{has:e=>"hasLabel"in e,get:e=>e.hasLabel,set:(e,t)=>{e.hasLabel=t}},metadata:t},g,f),e(this,null,d,{kind:"accessor",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:t},_,x),e(this,null,y,{kind:"accessor",name:"label",static:!1,private:!1,access:{has:e=>"label"in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:t},k,L),e(null,n={value:i},p,{kind:"class",name:i.name,metadata:t},null,v),i=n.value,t&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}#e=t(this,m,void 0);get hasIcon(){return this.#e}set hasIcon(e){this.#e=e}#t=(t(this,u),t(this,g,void 0));get hasLabel(){return this.#t}set hasLabel(e){this.#t=e}#o=(t(this,f),t(this,_,"text"));get type(){return this.#o}set type(e){this.#o=e}#a=(t(this,x),t(this,k,void 0));get label(){return this.#a}set label(e){this.#a=e}static styles=[a`
|
|
2
2
|
:host {
|
|
3
|
+
--custom-button-border-radius: var(--md-sys-shape-corner-large);
|
|
3
4
|
color: var(--custom-button-color, --md-sys-color-on-background);
|
|
4
5
|
display: flex;
|
|
5
6
|
|
|
6
7
|
height: 40px;
|
|
7
|
-
border-radius:
|
|
8
|
+
border-radius: var(--custom-button-border-radius);
|
|
8
9
|
position: relative;
|
|
9
10
|
pointer-events: auto;
|
|
10
11
|
cursor: pointer;
|
|
@@ -23,10 +24,11 @@ import{_ as e,a as t}from"./tslib.es6-B87RQr7F.js";import{r as a,i as s,x as o,s
|
|
|
23
24
|
outline: none;
|
|
24
25
|
cursor: pointer;
|
|
25
26
|
border-radius: inherit;
|
|
26
|
-
padding:
|
|
27
|
+
padding: 0;
|
|
27
28
|
width: inherit;
|
|
28
29
|
height: inherit;
|
|
29
30
|
display: flex;
|
|
31
|
+
position: relative;
|
|
30
32
|
pointer-events: none;
|
|
31
33
|
}
|
|
32
34
|
|
|
@@ -80,8 +82,8 @@ import{_ as e,a as t}from"./tslib.es6-B87RQr7F.js";import{r as a,i as s,x as o,s
|
|
|
80
82
|
:host([type='tonal']),
|
|
81
83
|
:host([type='tonal']) ::slotted(*) {
|
|
82
84
|
background: var(--md-sys-color-secondary-container);
|
|
83
|
-
color: var(--md-sys-color-on-
|
|
84
|
-
fill: var(--md-sys-color-on-
|
|
85
|
+
color: var(--md-sys-color-on-secondary-container);
|
|
86
|
+
fill: var(--md-sys-color-on-secondary-container);
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
custom-elevation {
|
|
@@ -121,15 +123,15 @@ import{_ as e,a as t}from"./tslib.es6-B87RQr7F.js";import{r as a,i as s,x as o,s
|
|
|
121
123
|
|
|
122
124
|
:host([disabled]) .label,
|
|
123
125
|
:host([disabled]) slot[name='icon']::slotted(*) {
|
|
124
|
-
opacity: 0.
|
|
126
|
+
opacity: 0.28;
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
::slotted(*) {
|
|
128
130
|
pointer-events: none;
|
|
129
131
|
}
|
|
130
132
|
|
|
131
|
-
:host(:focus),
|
|
132
|
-
:host(:hover) {
|
|
133
|
+
:host([type='elevated']:focus),
|
|
134
|
+
:host([type='elevated']:hover) {
|
|
133
135
|
--elevation-level: 2;
|
|
134
136
|
}
|
|
135
137
|
|
|
@@ -140,10 +142,59 @@ import{_ as e,a as t}from"./tslib.es6-B87RQr7F.js";import{r as a,i as s,x as o,s
|
|
|
140
142
|
button * {
|
|
141
143
|
pointer-events: none;
|
|
142
144
|
}
|
|
143
|
-
|
|
145
|
+
.hover {
|
|
146
|
+
position: absolute;
|
|
147
|
+
inset: 0;
|
|
148
|
+
background-color: var(--md-sys-color-primary);
|
|
149
|
+
opacity: 0;
|
|
150
|
+
transition: opacity 200ms;
|
|
151
|
+
border-radius: var(--custom-button-border-radius);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
:host(:focus) .hover,
|
|
155
|
+
:host(:hover) .hover {
|
|
156
|
+
opacity: 0.1;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
:host(:active) .hover {
|
|
160
|
+
opacity: 0.2;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
:host([type='filled']:focus) .hover,
|
|
164
|
+
:host([type='filled']:hover) .hover {
|
|
165
|
+
background-color: var(--md-sys-color-on-primary);
|
|
166
|
+
opacity: 0.1;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
:host([type='filled']:active) .hover {
|
|
170
|
+
opacity: 0.2;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
:host([type='tertiary']:focus) .hover,
|
|
174
|
+
:host([type='tertiary']:hover) .hover {
|
|
175
|
+
background-color: var(--md-sys-color-on-tertiary);
|
|
176
|
+
opacity: 0.1;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
:host([type='tertiary']:active) .hover {
|
|
180
|
+
opacity: 0.2;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
:host([type='tonal']:focus) .hover,
|
|
184
|
+
:host([type='tonal']:hover) .hover {
|
|
185
|
+
background-color: var(--md-sys-color-on-secondary-container);
|
|
186
|
+
opacity: 0.1;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
:host([type='tonal']:active) .hover {
|
|
190
|
+
opacity: 0.2;
|
|
191
|
+
}
|
|
192
|
+
`];connectedCallback(){const e=Array.from(this.shadowRoot.querySelectorAll("slot"));for(const t of e)t.addEventListener("slotchange",(()=>this.#s(t)));this.#s(e[0])}onChange(e,t){"label"===e&&(this.hasLabel=!!t)}#s=(t(this,L),e=>{"icon"===e.getAttribute("name")&&(this.hasIcon=0!==Array.from(e?.assignedNodes()||[]).length)});render(){return s`
|
|
144
193
|
<button label=${this.label}>
|
|
145
194
|
<custom-elevation></custom-elevation>
|
|
146
195
|
<slot name="icon"></slot>
|
|
147
196
|
<span class="label">${this.label}</span>
|
|
197
|
+
|
|
198
|
+
<span class="hover"></span>
|
|
148
199
|
</button>
|
|
149
|
-
`}static{t(i,
|
|
200
|
+
`}static{t(i,v)}},i})();export{n as CustomButton};
|
|
@@ -1,13 +1,53 @@
|
|
|
1
|
-
import{_ as t,a as o}from"./tslib.es6-B87RQr7F.js";import{r as
|
|
1
|
+
import{_ as t,a as o}from"./tslib.es6-B87RQr7F.js";import{r as e,i as s,x as i,s as a}from"./property-COFqvTC-.js";import{e as r}from"./custom-element-B_TPyPQO.js";import"./button.js";import"./icon.js";import"./elevation.js";let c=(()=>{let c,n,l,m=[r("custom-icon-button")],u=[],v=a,d=[],p=[];return class extends v{static{n=this}static{const o="function"==typeof Symbol&&Symbol.metadata?Object.create(v[Symbol.metadata]??null):void 0;l=[e({type:String})],t(this,null,l,{kind:"accessor",name:"icon",static:!1,private:!1,access:{has:t=>"icon"in t,get:t=>t.icon,set:(t,o)=>{t.icon=o}},metadata:o},d,p),t(null,c={value:n},m,{kind:"class",name:n.name,metadata:o},null,u),n=c.value,o&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}#t=o(this,d,void 0);get icon(){return this.#t}set icon(t){this.#t=t}static styles=[s`
|
|
2
2
|
:host {
|
|
3
|
-
|
|
3
|
+
--custom-button-border-radius: var(--md-sys-shape-corner-medium);
|
|
4
|
+
position: relative;
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
border-radius: var(--custom-button-border-radius);
|
|
9
|
+
width: 40px;
|
|
10
|
+
height: 40px;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.hover {
|
|
15
|
+
position: absolute;
|
|
16
|
+
inset: 0;
|
|
17
|
+
background-color: var(--md-sys-color-primary);
|
|
18
|
+
opacity: 0;
|
|
19
|
+
transition: opacity 200ms;
|
|
20
|
+
border-radius: var(--custom-button-border-radius);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:host(:focus) .hover,
|
|
24
|
+
:host(:hover) .hover {
|
|
25
|
+
opacity: 0.1;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host(:active) .hover {
|
|
29
|
+
opacity: 0.2;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
custom-elevation {
|
|
33
|
+
--md-elevation-level: var(--elevation-level);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
:host([type='elevated']) custom-elevation {
|
|
37
|
+
--elevation-level: 1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:host(:active) {
|
|
41
|
+
--elevation-level: 0;
|
|
4
42
|
}
|
|
5
43
|
|
|
6
44
|
custom-icon {
|
|
7
45
|
--custom-icon-color: var(--md-sys-color-on-surface);
|
|
8
46
|
}
|
|
9
|
-
`];render(){return
|
|
10
|
-
<custom-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
47
|
+
`];render(){return i`
|
|
48
|
+
<custom-elevation></custom-elevation>
|
|
49
|
+
|
|
50
|
+
<custom-icon slot="icon" .icon=${this.icon}></custom-icon>
|
|
51
|
+
|
|
52
|
+
<span class="hover"></span>
|
|
53
|
+
`}constructor(){super(...arguments),o(this,p)}static{o(n,u)}},n})();export{c as CustomIconButton};
|
package/exports/button.js
CHANGED
|
@@ -51,11 +51,12 @@ let CustomButton = (() => {
|
|
|
51
51
|
static styles = [
|
|
52
52
|
css `
|
|
53
53
|
:host {
|
|
54
|
+
--custom-button-border-radius: var(--md-sys-shape-corner-large);
|
|
54
55
|
color: var(--custom-button-color, --md-sys-color-on-background);
|
|
55
56
|
display: flex;
|
|
56
57
|
|
|
57
58
|
height: 40px;
|
|
58
|
-
border-radius:
|
|
59
|
+
border-radius: var(--custom-button-border-radius);
|
|
59
60
|
position: relative;
|
|
60
61
|
pointer-events: auto;
|
|
61
62
|
cursor: pointer;
|
|
@@ -74,10 +75,11 @@ let CustomButton = (() => {
|
|
|
74
75
|
outline: none;
|
|
75
76
|
cursor: pointer;
|
|
76
77
|
border-radius: inherit;
|
|
77
|
-
padding:
|
|
78
|
+
padding: 0;
|
|
78
79
|
width: inherit;
|
|
79
80
|
height: inherit;
|
|
80
81
|
display: flex;
|
|
82
|
+
position: relative;
|
|
81
83
|
pointer-events: none;
|
|
82
84
|
}
|
|
83
85
|
|
|
@@ -131,8 +133,8 @@ let CustomButton = (() => {
|
|
|
131
133
|
:host([type='tonal']),
|
|
132
134
|
:host([type='tonal']) ::slotted(*) {
|
|
133
135
|
background: var(--md-sys-color-secondary-container);
|
|
134
|
-
color: var(--md-sys-color-on-
|
|
135
|
-
fill: var(--md-sys-color-on-
|
|
136
|
+
color: var(--md-sys-color-on-secondary-container);
|
|
137
|
+
fill: var(--md-sys-color-on-secondary-container);
|
|
136
138
|
}
|
|
137
139
|
|
|
138
140
|
custom-elevation {
|
|
@@ -172,15 +174,15 @@ let CustomButton = (() => {
|
|
|
172
174
|
|
|
173
175
|
:host([disabled]) .label,
|
|
174
176
|
:host([disabled]) slot[name='icon']::slotted(*) {
|
|
175
|
-
opacity: 0.
|
|
177
|
+
opacity: 0.28;
|
|
176
178
|
}
|
|
177
179
|
|
|
178
180
|
::slotted(*) {
|
|
179
181
|
pointer-events: none;
|
|
180
182
|
}
|
|
181
183
|
|
|
182
|
-
:host(:focus),
|
|
183
|
-
:host(:hover) {
|
|
184
|
+
:host([type='elevated']:focus),
|
|
185
|
+
:host([type='elevated']:hover) {
|
|
184
186
|
--elevation-level: 2;
|
|
185
187
|
}
|
|
186
188
|
|
|
@@ -191,6 +193,53 @@ let CustomButton = (() => {
|
|
|
191
193
|
button * {
|
|
192
194
|
pointer-events: none;
|
|
193
195
|
}
|
|
196
|
+
.hover {
|
|
197
|
+
position: absolute;
|
|
198
|
+
inset: 0;
|
|
199
|
+
background-color: var(--md-sys-color-primary);
|
|
200
|
+
opacity: 0;
|
|
201
|
+
transition: opacity 200ms;
|
|
202
|
+
border-radius: var(--custom-button-border-radius);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
:host(:focus) .hover,
|
|
206
|
+
:host(:hover) .hover {
|
|
207
|
+
opacity: 0.1;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
:host(:active) .hover {
|
|
211
|
+
opacity: 0.2;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
:host([type='filled']:focus) .hover,
|
|
215
|
+
:host([type='filled']:hover) .hover {
|
|
216
|
+
background-color: var(--md-sys-color-on-primary);
|
|
217
|
+
opacity: 0.1;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
:host([type='filled']:active) .hover {
|
|
221
|
+
opacity: 0.2;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
:host([type='tertiary']:focus) .hover,
|
|
225
|
+
:host([type='tertiary']:hover) .hover {
|
|
226
|
+
background-color: var(--md-sys-color-on-tertiary);
|
|
227
|
+
opacity: 0.1;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
:host([type='tertiary']:active) .hover {
|
|
231
|
+
opacity: 0.2;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
:host([type='tonal']:focus) .hover,
|
|
235
|
+
:host([type='tonal']:hover) .hover {
|
|
236
|
+
background-color: var(--md-sys-color-on-secondary-container);
|
|
237
|
+
opacity: 0.1;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
:host([type='tonal']:active) .hover {
|
|
241
|
+
opacity: 0.2;
|
|
242
|
+
}
|
|
194
243
|
`
|
|
195
244
|
];
|
|
196
245
|
connectedCallback() {
|
|
@@ -219,6 +268,8 @@ let CustomButton = (() => {
|
|
|
219
268
|
<custom-elevation></custom-elevation>
|
|
220
269
|
<slot name="icon"></slot>
|
|
221
270
|
<span class="label">${this.label}</span>
|
|
271
|
+
|
|
272
|
+
<span class="hover"></span>
|
|
222
273
|
</button>
|
|
223
274
|
`;
|
|
224
275
|
}
|
package/exports/icon-button.js
CHANGED
|
@@ -30,7 +30,45 @@ let CustomIconButton = (() => {
|
|
|
30
30
|
static styles = [
|
|
31
31
|
css `
|
|
32
32
|
:host {
|
|
33
|
-
|
|
33
|
+
--custom-button-border-radius: var(--md-sys-shape-corner-medium);
|
|
34
|
+
position: relative;
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
border-radius: var(--custom-button-border-radius);
|
|
39
|
+
width: 40px;
|
|
40
|
+
height: 40px;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.hover {
|
|
45
|
+
position: absolute;
|
|
46
|
+
inset: 0;
|
|
47
|
+
background-color: var(--md-sys-color-primary);
|
|
48
|
+
opacity: 0;
|
|
49
|
+
transition: opacity 200ms;
|
|
50
|
+
border-radius: var(--custom-button-border-radius);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:host(:focus) .hover,
|
|
54
|
+
:host(:hover) .hover {
|
|
55
|
+
opacity: 0.1;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:host(:active) .hover {
|
|
59
|
+
opacity: 0.2;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
custom-elevation {
|
|
63
|
+
--md-elevation-level: var(--elevation-level);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
:host([type='elevated']) custom-elevation {
|
|
67
|
+
--elevation-level: 1;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
:host(:active) {
|
|
71
|
+
--elevation-level: 0;
|
|
34
72
|
}
|
|
35
73
|
|
|
36
74
|
custom-icon {
|
|
@@ -40,9 +78,11 @@ let CustomIconButton = (() => {
|
|
|
40
78
|
];
|
|
41
79
|
render() {
|
|
42
80
|
return html `
|
|
43
|
-
<custom-
|
|
44
|
-
|
|
45
|
-
|
|
81
|
+
<custom-elevation></custom-elevation>
|
|
82
|
+
|
|
83
|
+
<custom-icon slot="icon" .icon=${this.icon}></custom-icon>
|
|
84
|
+
|
|
85
|
+
<span class="hover"></span>
|
|
46
86
|
`;
|
|
47
87
|
}
|
|
48
88
|
constructor() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vandeurenglenn/lite-elements",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.59",
|
|
4
4
|
"description": "set of lite elements following Material Design 3 spec",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -23,26 +23,26 @@
|
|
|
23
23
|
"@material/web": "^2.2.0",
|
|
24
24
|
"@vandeurenglenn/custom-shared-styles": "^0.0.20",
|
|
25
25
|
"@vandeurenglenn/flex-elements": "^1.3.2",
|
|
26
|
-
"@vandeurenglenn/lite": "^0.2.
|
|
26
|
+
"@vandeurenglenn/lite": "^0.2.55",
|
|
27
27
|
"custom-element-decorator": "^0.6.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@rollup/plugin-commonjs": "^28.0.
|
|
30
|
+
"@rollup/plugin-commonjs": "^28.0.2",
|
|
31
31
|
"@rollup/plugin-json": "^6.1.0",
|
|
32
|
-
"@rollup/plugin-node-resolve": "^
|
|
32
|
+
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
33
33
|
"@rollup/plugin-terser": "^0.4.4",
|
|
34
|
-
"@rollup/plugin-typescript": "^12.1.
|
|
34
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
35
35
|
"@types/html": "^1.0.4",
|
|
36
|
-
"@types/node": "^22.10.
|
|
36
|
+
"@types/node": "^22.10.2",
|
|
37
37
|
"@web/rollup-plugin-html": "^2.3.0",
|
|
38
38
|
"chrome-launcher": "^1.1.2",
|
|
39
39
|
"globby": "^14.0.2",
|
|
40
|
-
"lighthouse": "^12.
|
|
40
|
+
"lighthouse": "^12.3.0",
|
|
41
41
|
"material-symbols": "^0.27.2",
|
|
42
42
|
"rimraf": "^6.0.1",
|
|
43
|
-
"rollup": "^4.
|
|
43
|
+
"rollup": "^4.29.1",
|
|
44
44
|
"rollup-plugin-auto-exports": "^1.0.8",
|
|
45
|
-
"rollup-plugin-material-symbols": "^2.1.
|
|
45
|
+
"rollup-plugin-material-symbols": "^2.1.6",
|
|
46
46
|
"tslib": "^2.8.1",
|
|
47
47
|
"typescript": "^5.7.2"
|
|
48
48
|
},
|