mdui 2.0.4 → 2.0.5
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/components/avatar/index.js +7 -2
- package/components/avatar/style.js +31 -1
- package/components/badge/style.js +25 -1
- package/components/bottom-app-bar/style.js +92 -1
- package/components/button/button-base-style.js +28 -1
- package/components/button/button-base.js +8 -1
- package/components/button/index.js +18 -8
- package/components/button/style.js +111 -2
- package/components/button-icon/index.js +22 -5
- package/components/button-icon/style.js +103 -2
- package/components/card/index.js +5 -1
- package/components/card/style.js +72 -1
- package/components/checkbox/index.js +50 -7
- package/components/checkbox/style.js +131 -1
- package/components/chip/index.js +33 -9
- package/components/chip/style.js +205 -2
- package/components/circular-progress/index.js +39 -5
- package/components/circular-progress/style.js +136 -1
- package/components/collapse/collapse-item-style.js +21 -1
- package/components/collapse/collapse-item.js +10 -2
- package/components/collapse/collapse-style.js +5 -1
- package/components/collapse/collapse.js +4 -1
- package/components/dialog/index.js +35 -7
- package/components/dialog/style.js +116 -1
- package/components/divider/style.js +18 -1
- package/components/dropdown/index.js +8 -1
- package/components/dropdown/style.js +11 -1
- package/components/fab/index.js +13 -5
- package/components/fab/style.js +153 -4
- package/components/icon/index.js +5 -1
- package/components/icon/style.js +29 -1
- package/components/layout/layout-item-style.js +6 -1
- package/components/layout/layout-main-style.js +7 -1
- package/components/layout/layout-style.js +11 -1
- package/components/linear-progress/index.js +6 -2
- package/components/linear-progress/style.js +73 -1
- package/components/list/list-item-style.js +153 -2
- package/components/list/list-item.js +27 -8
- package/components/list/list-style.js +10 -1
- package/components/list/list-subheader-style.js +19 -1
- package/components/menu/menu-item-style.js +125 -1
- package/components/menu/menu-item.js +55 -13
- package/components/menu/menu-style.js +19 -1
- package/components/menu/menu.js +5 -1
- package/components/navigation-bar/navigation-bar-item-style.js +132 -1
- package/components/navigation-bar/navigation-bar-item.js +23 -7
- package/components/navigation-bar/navigation-bar-style.js +28 -1
- package/components/navigation-bar/navigation-bar.js +4 -1
- package/components/navigation-drawer/index.js +12 -1
- package/components/navigation-drawer/style.js +66 -1
- package/components/navigation-rail/navigation-rail-item-style.js +122 -1
- package/components/navigation-rail/navigation-rail-item.js +26 -7
- package/components/navigation-rail/navigation-rail-style.js +79 -1
- package/components/navigation-rail/navigation-rail.js +10 -1
- package/components/radio/radio-group-style.js +20 -1
- package/components/radio/radio-group.js +19 -1
- package/components/radio/radio-style.js +107 -1
- package/components/radio/radio.js +23 -5
- package/components/range-slider/index.d.ts +1 -1
- package/components/range-slider/index.js +53 -5
- package/components/ripple/index.js +5 -2
- package/components/ripple/style.js +96 -1
- package/components/segmented-button/segmented-button-group-style.js +28 -1
- package/components/segmented-button/segmented-button-group.js +21 -1
- package/components/segmented-button/segmented-button-style.js +81 -2
- package/components/segmented-button/segmented-button.js +27 -11
- package/components/select/index.js +87 -6
- package/components/select/style.js +27 -1
- package/components/slider/index.js +33 -2
- package/components/slider/slider-base-style.js +173 -1
- package/components/slider/slider-base.js +6 -1
- package/components/slider/style.js +7 -1
- package/components/snackbar/index.js +32 -5
- package/components/snackbar/style.js +100 -1
- package/components/switch/index.js +40 -6
- package/components/switch/style.js +202 -1
- package/components/tabs/tab-panel-style.js +10 -1
- package/components/tabs/tab-style.js +85 -1
- package/components/tabs/tab.js +24 -4
- package/components/tabs/tabs-style.js +138 -1
- package/components/tabs/tabs.js +9 -1
- package/components/text-field/index.js +160 -32
- package/components/text-field/style.js +362 -1
- package/components/tooltip/index.js +10 -1
- package/components/tooltip/style.js +57 -1
- package/components/top-app-bar/top-app-bar-style.js +78 -1
- package/components/top-app-bar/top-app-bar-title-style.js +81 -1
- package/components/top-app-bar/top-app-bar-title.js +17 -3
- package/custom-elements.json +1144 -1101
- package/html-data.en.json +15 -6
- package/html-data.zh-cn.json +15 -6
- package/jsx.en.d.ts +2 -2
- package/jsx.zh-cn.d.ts +2 -2
- package/package.json +2 -2
- package/web-types.en.json +20 -4
- package/web-types.zh-cn.json +20 -4
- package/mdui.esm.js +0 -22
- package/mdui.global.js +0 -22
|
@@ -1,2 +1,137 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
2
|
+
export const style = css `
|
|
3
|
+
:host {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: inline-block;
|
|
6
|
+
width: 2.5rem;
|
|
7
|
+
height: 2.5rem;
|
|
8
|
+
stroke: rgb(var(--mdui-color-primary));
|
|
9
|
+
}
|
|
10
|
+
.progress {
|
|
11
|
+
position: relative;
|
|
12
|
+
display: inline-block;
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 100%;
|
|
15
|
+
text-align: left;
|
|
16
|
+
transition: opacity var(--mdui-motion-duration-medium1)
|
|
17
|
+
var(--mdui-motion-easing-linear);
|
|
18
|
+
}
|
|
19
|
+
.determinate svg {
|
|
20
|
+
transform: rotate(-90deg);
|
|
21
|
+
fill: transparent;
|
|
22
|
+
}
|
|
23
|
+
.determinate .track {
|
|
24
|
+
stroke: transparent;
|
|
25
|
+
}
|
|
26
|
+
.determinate .circle {
|
|
27
|
+
stroke: inherit;
|
|
28
|
+
transition: stroke-dashoffset var(--mdui-motion-duration-long2)
|
|
29
|
+
var(--mdui-motion-easing-standard);
|
|
30
|
+
}
|
|
31
|
+
.indeterminate {
|
|
32
|
+
font-size: 0;
|
|
33
|
+
letter-spacing: 0;
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
animation: mdui-comp-circular-progress-rotate 1568ms
|
|
36
|
+
var(--mdui-motion-easing-linear) infinite;
|
|
37
|
+
}
|
|
38
|
+
.indeterminate .layer,
|
|
39
|
+
.indeterminate .circle {
|
|
40
|
+
position: absolute;
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
}
|
|
44
|
+
.indeterminate .layer {
|
|
45
|
+
animation: mdui-comp-circular-progress-layer-rotate 5332ms
|
|
46
|
+
var(--mdui-motion-easing-standard) infinite both;
|
|
47
|
+
}
|
|
48
|
+
.indeterminate .circle {
|
|
49
|
+
fill: transparent;
|
|
50
|
+
stroke: inherit;
|
|
51
|
+
}
|
|
52
|
+
.indeterminate .gap-patch {
|
|
53
|
+
position: absolute;
|
|
54
|
+
top: 0;
|
|
55
|
+
left: 47.5%;
|
|
56
|
+
width: 5%;
|
|
57
|
+
height: 100%;
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
}
|
|
60
|
+
.indeterminate .gap-patch .circle {
|
|
61
|
+
left: -900%;
|
|
62
|
+
width: 2000%;
|
|
63
|
+
transform: rotate(180deg);
|
|
64
|
+
}
|
|
65
|
+
.indeterminate .clipper {
|
|
66
|
+
position: relative;
|
|
67
|
+
display: inline-block;
|
|
68
|
+
width: 50%;
|
|
69
|
+
height: 100%;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
}
|
|
72
|
+
.indeterminate .clipper .circle {
|
|
73
|
+
width: 200%;
|
|
74
|
+
}
|
|
75
|
+
.indeterminate .clipper.left .circle {
|
|
76
|
+
animation: mdui-comp-circular-progress-left-spin 1333ms
|
|
77
|
+
var(--mdui-motion-easing-standard) infinite both;
|
|
78
|
+
}
|
|
79
|
+
.indeterminate .clipper.right .circle {
|
|
80
|
+
left: -100%;
|
|
81
|
+
animation: mdui-comp-circular-progress-right-spin 1333ms
|
|
82
|
+
var(--mdui-motion-easing-standard) infinite both;
|
|
83
|
+
}
|
|
84
|
+
@keyframes mdui-comp-circular-progress-rotate {
|
|
85
|
+
to {
|
|
86
|
+
transform: rotate(360deg);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
@keyframes mdui-comp-circular-progress-layer-rotate {
|
|
90
|
+
12.5% {
|
|
91
|
+
transform: rotate(135deg);
|
|
92
|
+
}
|
|
93
|
+
25% {
|
|
94
|
+
transform: rotate(270deg);
|
|
95
|
+
}
|
|
96
|
+
37.5% {
|
|
97
|
+
transform: rotate(405deg);
|
|
98
|
+
}
|
|
99
|
+
50% {
|
|
100
|
+
transform: rotate(540deg);
|
|
101
|
+
}
|
|
102
|
+
62.5% {
|
|
103
|
+
transform: rotate(675deg);
|
|
104
|
+
}
|
|
105
|
+
75% {
|
|
106
|
+
transform: rotate(810deg);
|
|
107
|
+
}
|
|
108
|
+
87.5% {
|
|
109
|
+
transform: rotate(945deg);
|
|
110
|
+
}
|
|
111
|
+
100% {
|
|
112
|
+
transform: rotate(1080deg);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
@keyframes mdui-comp-circular-progress-left-spin {
|
|
116
|
+
0% {
|
|
117
|
+
transform: rotate(265deg);
|
|
118
|
+
}
|
|
119
|
+
50% {
|
|
120
|
+
transform: rotate(130deg);
|
|
121
|
+
}
|
|
122
|
+
100% {
|
|
123
|
+
transform: rotate(265deg);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
@keyframes mdui-comp-circular-progress-right-spin {
|
|
127
|
+
0% {
|
|
128
|
+
transform: rotate(-265deg);
|
|
129
|
+
}
|
|
130
|
+
50% {
|
|
131
|
+
transform: rotate(-130deg);
|
|
132
|
+
}
|
|
133
|
+
100% {
|
|
134
|
+
transform: rotate(-265deg);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
@@ -1,2 +1,22 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const collapseItemStyle = css
|
|
2
|
+
export const collapseItemStyle = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
}
|
|
7
|
+
.header {
|
|
8
|
+
display: block;
|
|
9
|
+
}
|
|
10
|
+
.body {
|
|
11
|
+
display: block;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
transition: height var(--mdui-motion-duration-short4)
|
|
14
|
+
var(--mdui-motion-easing-emphasized);
|
|
15
|
+
}
|
|
16
|
+
.body.opened {
|
|
17
|
+
overflow: visible;
|
|
18
|
+
}
|
|
19
|
+
.body.active {
|
|
20
|
+
transition-duration: var(--mdui-motion-duration-medium4);
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
@@ -68,10 +68,18 @@ let CollapseItem = class CollapseItem extends MduiElement {
|
|
|
68
68
|
this.updateBodyHeight();
|
|
69
69
|
}
|
|
70
70
|
render() {
|
|
71
|
-
return html `<slot name="header" part="header" class="header"
|
|
71
|
+
return html `<slot name="header" part="header" class="header">
|
|
72
|
+
${this.header}
|
|
73
|
+
</slot>
|
|
74
|
+
<slot
|
|
75
|
+
part="body"
|
|
76
|
+
class="body ${classMap({
|
|
72
77
|
opened: this.state === 'opened',
|
|
73
78
|
active: this.active,
|
|
74
|
-
})}"
|
|
79
|
+
})}"
|
|
80
|
+
${ref(this.bodyRef)}
|
|
81
|
+
@transitionend=${this.onTransitionEnd}
|
|
82
|
+
></slot>`;
|
|
75
83
|
}
|
|
76
84
|
onTransitionEnd(event) {
|
|
77
85
|
if (event.target === this.bodyRef.value) {
|
|
@@ -85,7 +85,10 @@ let Collapse = class Collapse extends MduiElement {
|
|
|
85
85
|
this.updateItems();
|
|
86
86
|
}
|
|
87
87
|
render() {
|
|
88
|
-
return html `<slot
|
|
88
|
+
return html `<slot
|
|
89
|
+
@slotchange=${this.onSlotChange}
|
|
90
|
+
@click=${this.onClick}
|
|
91
|
+
></slot>`;
|
|
89
92
|
}
|
|
90
93
|
setActiveKeys(activeKeys) {
|
|
91
94
|
if (!arraysEqualIgnoreOrder(this.activeKeys, activeKeys)) {
|
|
@@ -218,11 +218,33 @@ let Dialog = class Dialog extends MduiElement {
|
|
|
218
218
|
const hasDescription = !!this.description || this.hasSlotController.test('description');
|
|
219
219
|
const hasHeader = hasIcon || hasHeadline || this.hasSlotController.test('header');
|
|
220
220
|
const hasBody = hasDescription || hasDefaultSlot;
|
|
221
|
-
return html `<div
|
|
221
|
+
return html `<div
|
|
222
|
+
${ref(this.overlayRef)}
|
|
223
|
+
part="overlay"
|
|
224
|
+
class="overlay"
|
|
225
|
+
@click=${this.onOverlayClick}
|
|
226
|
+
tabindex="-1"
|
|
227
|
+
></div>
|
|
228
|
+
<div
|
|
229
|
+
${ref(this.panelRef)}
|
|
230
|
+
part="panel"
|
|
231
|
+
class="panel ${classMap({
|
|
222
232
|
'has-icon': hasIcon,
|
|
223
233
|
'has-description': hasDescription,
|
|
224
234
|
'has-default': hasDefaultSlot,
|
|
225
|
-
})}"
|
|
235
|
+
})}"
|
|
236
|
+
tabindex="0"
|
|
237
|
+
>
|
|
238
|
+
${when(hasHeader, () => html `<slot name="header" part="header" class="header">
|
|
239
|
+
${when(hasIcon, () => this.renderIcon())}
|
|
240
|
+
${when(hasHeadline, () => this.renderHeadline())}
|
|
241
|
+
</slot>`)}
|
|
242
|
+
${when(hasBody, () => html `<div ${ref(this.bodyRef)} part="body" class="body">
|
|
243
|
+
${when(hasDescription, () => this.renderDescription())}
|
|
244
|
+
<slot></slot>
|
|
245
|
+
</div>`)}
|
|
246
|
+
${when(hasActionSlot, () => html `<slot name="action" part="action" class="action"></slot>`)}
|
|
247
|
+
</div>`;
|
|
226
248
|
}
|
|
227
249
|
onOverlayClick() {
|
|
228
250
|
this.emit('overlay-click');
|
|
@@ -232,15 +254,21 @@ let Dialog = class Dialog extends MduiElement {
|
|
|
232
254
|
this.open = false;
|
|
233
255
|
}
|
|
234
256
|
renderIcon() {
|
|
235
|
-
return html `<slot name="icon" part="icon" class="icon"
|
|
236
|
-
|
|
237
|
-
|
|
257
|
+
return html `<slot name="icon" part="icon" class="icon">
|
|
258
|
+
${this.icon
|
|
259
|
+
? html `<mdui-icon name=${this.icon}></mdui-icon>`
|
|
260
|
+
: nothingTemplate}
|
|
261
|
+
</slot>`;
|
|
238
262
|
}
|
|
239
263
|
renderHeadline() {
|
|
240
|
-
return html `<slot name="headline" part="headline" class="headline"
|
|
264
|
+
return html `<slot name="headline" part="headline" class="headline">
|
|
265
|
+
${this.headline}
|
|
266
|
+
</slot>`;
|
|
241
267
|
}
|
|
242
268
|
renderDescription() {
|
|
243
|
-
return html `<slot name="description" part="description" class="description"
|
|
269
|
+
return html `<slot name="description" part="description" class="description">
|
|
270
|
+
${this.description}
|
|
271
|
+
</slot>`;
|
|
244
272
|
}
|
|
245
273
|
};
|
|
246
274
|
Dialog.styles = [componentStyle, style];
|
|
@@ -1,2 +1,117 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
2
|
+
export const style = css `
|
|
3
|
+
:host {
|
|
4
|
+
--shape-corner: var(--mdui-shape-corner-extra-large);
|
|
5
|
+
--z-index: 2300;
|
|
6
|
+
position: fixed;
|
|
7
|
+
z-index: var(--z-index);
|
|
8
|
+
display: none;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
inset: 0;
|
|
12
|
+
padding: 3rem;
|
|
13
|
+
}
|
|
14
|
+
::slotted(mdui-top-app-bar[slot='header']) {
|
|
15
|
+
position: absolute;
|
|
16
|
+
border-top-left-radius: var(--mdui-shape-corner-extra-large);
|
|
17
|
+
border-top-right-radius: var(--mdui-shape-corner-extra-large);
|
|
18
|
+
background-color: rgb(var(--mdui-color-surface-container-high));
|
|
19
|
+
}
|
|
20
|
+
:host([fullscreen]) {
|
|
21
|
+
--shape-corner: var(--mdui-shape-corner-none);
|
|
22
|
+
padding: 0;
|
|
23
|
+
}
|
|
24
|
+
:host([fullscreen]) ::slotted(mdui-top-app-bar[slot='header']) {
|
|
25
|
+
border-top-left-radius: var(--mdui-shape-corner-none);
|
|
26
|
+
border-top-right-radius: var(--mdui-shape-corner-none);
|
|
27
|
+
}
|
|
28
|
+
.overlay {
|
|
29
|
+
position: fixed;
|
|
30
|
+
inset: 0;
|
|
31
|
+
background-color: rgba(var(--mdui-color-scrim), 0.4);
|
|
32
|
+
}
|
|
33
|
+
.panel {
|
|
34
|
+
position: relative;
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
max-height: 100%;
|
|
38
|
+
border-radius: var(--shape-corner);
|
|
39
|
+
outline: none;
|
|
40
|
+
transform-origin: top;
|
|
41
|
+
min-width: 17.5rem;
|
|
42
|
+
max-width: 35rem;
|
|
43
|
+
padding: 1.5rem;
|
|
44
|
+
background-color: rgb(var(--mdui-color-surface-container-high));
|
|
45
|
+
box-shadow: var(--mdui-elevation-level3);
|
|
46
|
+
}
|
|
47
|
+
:host([fullscreen]) .panel {
|
|
48
|
+
width: 100%;
|
|
49
|
+
max-width: 100%;
|
|
50
|
+
height: 100%;
|
|
51
|
+
max-height: 100%;
|
|
52
|
+
box-shadow: var(--mdui-elevation-level0);
|
|
53
|
+
}
|
|
54
|
+
.header {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
}
|
|
58
|
+
.has-icon .header {
|
|
59
|
+
align-items: center;
|
|
60
|
+
}
|
|
61
|
+
.icon {
|
|
62
|
+
display: flex;
|
|
63
|
+
color: rgb(var(--mdui-color-secondary));
|
|
64
|
+
font-size: 1.5rem;
|
|
65
|
+
}
|
|
66
|
+
.icon mdui-icon,
|
|
67
|
+
::slotted([slot='icon']) {
|
|
68
|
+
font-size: inherit;
|
|
69
|
+
}
|
|
70
|
+
.headline {
|
|
71
|
+
display: flex;
|
|
72
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
73
|
+
font-size: var(--mdui-typescale-headline-small-size);
|
|
74
|
+
font-weight: var(--mdui-typescale-headline-small-weight);
|
|
75
|
+
letter-spacing: var(--mdui-typescale-headline-small-tracking);
|
|
76
|
+
line-height: var(--mdui-typescale-headline-small-line-height);
|
|
77
|
+
}
|
|
78
|
+
.icon + .headline {
|
|
79
|
+
padding-top: 1rem;
|
|
80
|
+
}
|
|
81
|
+
.body {
|
|
82
|
+
overflow: auto;
|
|
83
|
+
}
|
|
84
|
+
.header + .body {
|
|
85
|
+
margin-top: 1rem;
|
|
86
|
+
}
|
|
87
|
+
.description {
|
|
88
|
+
display: flex;
|
|
89
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
90
|
+
font-size: var(--mdui-typescale-body-medium-size);
|
|
91
|
+
font-weight: var(--mdui-typescale-body-medium-weight);
|
|
92
|
+
letter-spacing: var(--mdui-typescale-body-medium-tracking);
|
|
93
|
+
line-height: var(--mdui-typescale-body-medium-line-height);
|
|
94
|
+
}
|
|
95
|
+
:host([fullscreen]) .description {
|
|
96
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
97
|
+
}
|
|
98
|
+
.has-description.has-default .description {
|
|
99
|
+
margin-bottom: 1rem;
|
|
100
|
+
}
|
|
101
|
+
.action {
|
|
102
|
+
display: flex;
|
|
103
|
+
justify-content: flex-end;
|
|
104
|
+
padding-top: 1.5rem;
|
|
105
|
+
}
|
|
106
|
+
.action::slotted(:not(:first-child)) {
|
|
107
|
+
margin-left: 0.5rem;
|
|
108
|
+
}
|
|
109
|
+
:host([stacked-actions]) .action {
|
|
110
|
+
flex-direction: column;
|
|
111
|
+
align-items: end;
|
|
112
|
+
}
|
|
113
|
+
:host([stacked-actions]) .action::slotted(:not(:first-child)) {
|
|
114
|
+
margin-left: 0rem;
|
|
115
|
+
margin-top: 0.5rem;
|
|
116
|
+
}
|
|
117
|
+
`;
|
|
@@ -1,2 +1,19 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
2
|
+
export const style = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
height: 0.0625rem;
|
|
6
|
+
background-color: rgb(var(--mdui-color-surface-variant));
|
|
7
|
+
}
|
|
8
|
+
:host([inset]) {
|
|
9
|
+
margin-left: 1rem;
|
|
10
|
+
}
|
|
11
|
+
:host([middle]) {
|
|
12
|
+
margin-left: 1rem;
|
|
13
|
+
margin-right: 1rem;
|
|
14
|
+
}
|
|
15
|
+
:host([vertical]) {
|
|
16
|
+
height: 100%;
|
|
17
|
+
width: 0.0625rem;
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
@@ -234,7 +234,14 @@ let Dropdown = class Dropdown extends MduiElement {
|
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
236
|
render() {
|
|
237
|
-
return html `<slot name="trigger" part="trigger" class="trigger"></slot
|
|
237
|
+
return html `<slot name="trigger" part="trigger" class="trigger"></slot>
|
|
238
|
+
<slot
|
|
239
|
+
${ref(this.panelRef)}
|
|
240
|
+
part="panel"
|
|
241
|
+
class="panel"
|
|
242
|
+
hidden
|
|
243
|
+
@click=${this.onPanelClick}
|
|
244
|
+
></slot>`;
|
|
238
245
|
}
|
|
239
246
|
/**
|
|
240
247
|
* 获取 dropdown 打开、关闭动画的 CSS scaleX 或 scaleY
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
2
|
+
export const style = css `
|
|
3
|
+
:host {
|
|
4
|
+
--z-index: 2100;
|
|
5
|
+
display: contents;
|
|
6
|
+
}
|
|
7
|
+
.panel {
|
|
8
|
+
display: block;
|
|
9
|
+
position: fixed;
|
|
10
|
+
z-index: var(--z-index);
|
|
11
|
+
}
|
|
12
|
+
`;
|
package/components/fab/index.js
CHANGED
|
@@ -94,14 +94,20 @@ let Fab = class Fab extends ButtonBase {
|
|
|
94
94
|
button: true,
|
|
95
95
|
'has-icon': this.icon || this.hasSlotController.test('icon'),
|
|
96
96
|
});
|
|
97
|
-
return html `<mdui-ripple
|
|
97
|
+
return html `<mdui-ripple
|
|
98
|
+
${ref(this.rippleRef)}
|
|
99
|
+
.noRipple=${this.noRipple}
|
|
100
|
+
></mdui-ripple>
|
|
101
|
+
${this.isButton()
|
|
98
102
|
? this.renderButton({
|
|
99
103
|
className,
|
|
100
104
|
part: 'button',
|
|
101
105
|
content: this.renderInner(),
|
|
102
106
|
})
|
|
103
107
|
: this.disabled || this.loading
|
|
104
|
-
? html `<span part="button" class="_a ${className}"
|
|
108
|
+
? html `<span part="button" class="_a ${className}">
|
|
109
|
+
${this.renderInner()}
|
|
110
|
+
</span>`
|
|
105
111
|
: this.renderAnchor({
|
|
106
112
|
className,
|
|
107
113
|
part: 'button',
|
|
@@ -115,9 +121,11 @@ let Fab = class Fab extends ButtonBase {
|
|
|
115
121
|
if (this.loading) {
|
|
116
122
|
return this.renderLoading();
|
|
117
123
|
}
|
|
118
|
-
return html `<slot name="icon" part="icon" class="icon"
|
|
119
|
-
|
|
120
|
-
|
|
124
|
+
return html `<slot name="icon" part="icon" class="icon">
|
|
125
|
+
${this.icon
|
|
126
|
+
? html `<mdui-icon name=${this.icon}></mdui-icon>`
|
|
127
|
+
: nothingTemplate}
|
|
128
|
+
</slot>`;
|
|
121
129
|
}
|
|
122
130
|
renderInner() {
|
|
123
131
|
return [this.renderIcon(), this.renderLabel()];
|
package/components/fab/style.js
CHANGED
|
@@ -1,8 +1,157 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
2
|
+
export const style = css `
|
|
3
|
+
/**
|
|
4
|
+
* mdui-fab 组件。默认为 variant="primary" size="normal"
|
|
5
|
+
*/
|
|
6
|
+
:host {
|
|
7
|
+
--shape-corner-small: var(--mdui-shape-corner-small);
|
|
8
|
+
--shape-corner-normal: var(--mdui-shape-corner-large);
|
|
9
|
+
--shape-corner-large: var(--mdui-shape-corner-extra-large);
|
|
10
|
+
position: relative;
|
|
11
|
+
display: inline-block;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
text-align: center;
|
|
14
|
+
border-radius: var(--shape-corner-normal);
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
-webkit-tap-highlight-color: transparent;
|
|
17
|
+
transition-property: box-shadow;
|
|
18
|
+
transition-timing-function: var(--mdui-motion-easing-emphasized);
|
|
19
|
+
transition-duration: var(--mdui-motion-duration-medium4);
|
|
20
|
+
width: 3.5rem;
|
|
21
|
+
height: 3.5rem;
|
|
22
|
+
box-shadow: var(--mdui-elevation-level3);
|
|
23
|
+
font-size: var(--mdui-typescale-label-large-size);
|
|
24
|
+
font-weight: var(--mdui-typescale-label-large-weight);
|
|
25
|
+
letter-spacing: var(--mdui-typescale-label-large-tracking);
|
|
26
|
+
line-height: var(--mdui-typescale-label-large-line-height);
|
|
27
|
+
}
|
|
28
|
+
.button {
|
|
29
|
+
padding: 0rem 1rem;
|
|
30
|
+
}
|
|
31
|
+
:host([size='small']) .button {
|
|
32
|
+
padding: 0rem 0.5rem;
|
|
33
|
+
}
|
|
34
|
+
:host([size='large']) .button {
|
|
35
|
+
padding: 0rem 1.875rem;
|
|
36
|
+
}
|
|
37
|
+
:host([lowered]) {
|
|
38
|
+
box-shadow: var(--mdui-elevation-level1);
|
|
39
|
+
}
|
|
40
|
+
:host([focus-visible]) {
|
|
41
|
+
box-shadow: var(--mdui-elevation-level3);
|
|
42
|
+
}
|
|
43
|
+
:host([lowered][focus-visible]) {
|
|
44
|
+
box-shadow: var(--mdui-elevation-level1);
|
|
45
|
+
}
|
|
46
|
+
:host([pressed]) {
|
|
47
|
+
box-shadow: var(--mdui-elevation-level3);
|
|
48
|
+
}
|
|
49
|
+
:host([lowered][pressed]) {
|
|
50
|
+
box-shadow: var(--mdui-elevation-level1);
|
|
51
|
+
}
|
|
52
|
+
:host([hover]) {
|
|
53
|
+
box-shadow: var(--mdui-elevation-level4);
|
|
54
|
+
}
|
|
55
|
+
:host([lowered][hover]) {
|
|
56
|
+
box-shadow: var(--mdui-elevation-level2);
|
|
57
|
+
}
|
|
58
|
+
:host([variant='primary']) {
|
|
59
|
+
color: rgb(var(--mdui-color-on-primary-container));
|
|
60
|
+
background-color: rgb(var(--mdui-color-primary-container));
|
|
61
|
+
--mdui-comp-ripple-state-layer-color: var(
|
|
3
62
|
--mdui-color-on-primary-container
|
|
4
|
-
)
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
:host([variant='surface']) {
|
|
66
|
+
color: rgb(var(--mdui-color-primary));
|
|
67
|
+
background-color: rgb(var(--mdui-color-surface-container-high));
|
|
68
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-primary);
|
|
69
|
+
}
|
|
70
|
+
:host([variant='surface'][lowered]) {
|
|
71
|
+
background-color: rgb(var(--mdui-color-surface-container-low));
|
|
72
|
+
}
|
|
73
|
+
:host([variant='secondary']) {
|
|
74
|
+
color: rgb(var(--mdui-color-on-secondary-container));
|
|
75
|
+
background-color: rgb(var(--mdui-color-secondary-container));
|
|
76
|
+
--mdui-comp-ripple-state-layer-color: var(
|
|
5
77
|
--mdui-color-on-secondary-container
|
|
6
|
-
)
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
:host([variant='tertiary']) {
|
|
81
|
+
color: rgb(var(--mdui-color-on-tertiary-container));
|
|
82
|
+
background-color: rgb(var(--mdui-color-tertiary-container));
|
|
83
|
+
--mdui-comp-ripple-state-layer-color: var(
|
|
7
84
|
--mdui-color-on-tertiary-container
|
|
8
|
-
)
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
:host([size='small']) {
|
|
88
|
+
border-radius: var(--shape-corner-small);
|
|
89
|
+
width: 2.5rem;
|
|
90
|
+
height: 2.5rem;
|
|
91
|
+
}
|
|
92
|
+
:host([size='large']) {
|
|
93
|
+
border-radius: var(--shape-corner-large);
|
|
94
|
+
width: 6rem;
|
|
95
|
+
height: 6rem;
|
|
96
|
+
}
|
|
97
|
+
:host([disabled]),
|
|
98
|
+
:host([loading]) {
|
|
99
|
+
cursor: default;
|
|
100
|
+
pointer-events: none;
|
|
101
|
+
}
|
|
102
|
+
:host([disabled]) {
|
|
103
|
+
color: rgba(var(--mdui-color-on-surface), 38%);
|
|
104
|
+
background-color: rgba(var(--mdui-color-on-surface), 12%);
|
|
105
|
+
box-shadow: var(--mdui-elevation-level0);
|
|
106
|
+
}
|
|
107
|
+
:host([extended]) {
|
|
108
|
+
width: auto;
|
|
109
|
+
}
|
|
110
|
+
.label {
|
|
111
|
+
display: inline-flex;
|
|
112
|
+
transition: opacity var(--mdui-motion-duration-short2)
|
|
113
|
+
var(--mdui-motion-easing-linear) var(--mdui-motion-duration-short2);
|
|
114
|
+
padding-left: 0.25rem;
|
|
115
|
+
padding-right: 0.25rem;
|
|
116
|
+
}
|
|
117
|
+
.has-icon .label {
|
|
118
|
+
margin-left: 0.5rem;
|
|
119
|
+
}
|
|
120
|
+
:host([size='small']) .has-icon .label {
|
|
121
|
+
margin-left: 0.25rem;
|
|
122
|
+
}
|
|
123
|
+
:host([size='large']) .has-icon .label {
|
|
124
|
+
margin-left: 1rem;
|
|
125
|
+
}
|
|
126
|
+
:host(:not([extended])) .label {
|
|
127
|
+
opacity: 0;
|
|
128
|
+
transition-delay: 0ms;
|
|
129
|
+
transition-duration: var(--mdui-motion-duration-short1);
|
|
130
|
+
}
|
|
131
|
+
:host([size='large']) .label {
|
|
132
|
+
font-size: 1.5em;
|
|
133
|
+
}
|
|
134
|
+
.icon {
|
|
135
|
+
display: inline-flex;
|
|
136
|
+
font-size: 1.71428571em;
|
|
137
|
+
}
|
|
138
|
+
:host([size='large']) .icon {
|
|
139
|
+
font-size: 2.57142857em;
|
|
140
|
+
}
|
|
141
|
+
.icon mdui-icon,
|
|
142
|
+
::slotted([slot='icon']) {
|
|
143
|
+
font-size: inherit;
|
|
144
|
+
}
|
|
145
|
+
mdui-circular-progress {
|
|
146
|
+
display: inline-flex;
|
|
147
|
+
width: 1.5rem;
|
|
148
|
+
height: 1.5rem;
|
|
149
|
+
}
|
|
150
|
+
:host([size='large']) mdui-circular-progress {
|
|
151
|
+
width: 2.25rem;
|
|
152
|
+
height: 2.25rem;
|
|
153
|
+
}
|
|
154
|
+
:host([disabled]) mdui-circular-progress {
|
|
155
|
+
stroke: rgba(var(--mdui-color-on-surface), 38%);
|
|
156
|
+
}
|
|
157
|
+
`;
|
package/components/icon/index.js
CHANGED
|
@@ -34,7 +34,11 @@ let Icon = class Icon extends MduiElement {
|
|
|
34
34
|
['sharp', 'Material Icons Sharp'],
|
|
35
35
|
['two-tone', 'Material Icons Two Tone'],
|
|
36
36
|
]);
|
|
37
|
-
return html `<span
|
|
37
|
+
return html `<span
|
|
38
|
+
style=${styleMap({ fontFamily: familyMap.get(variant) })}
|
|
39
|
+
>
|
|
40
|
+
${name}
|
|
41
|
+
</span>`;
|
|
38
42
|
}
|
|
39
43
|
if (this.src) {
|
|
40
44
|
return html `${until(ajax({ url: this.src }).then(unsafeSVG))}`;
|