mdui 2.0.5 → 2.0.6
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 +2 -7
- package/components/avatar/style.js +1 -31
- package/components/badge/style.js +1 -25
- package/components/bottom-app-bar/style.js +1 -92
- package/components/button/button-base-style.js +1 -28
- package/components/button/button-base.js +1 -8
- package/components/button/index.js +8 -18
- package/components/button/style.js +2 -111
- package/components/button-icon/index.js +5 -22
- package/components/button-icon/style.js +2 -103
- package/components/card/index.js +1 -5
- package/components/card/style.js +1 -72
- package/components/checkbox/index.js +7 -50
- package/components/checkbox/style.js +1 -131
- package/components/chip/index.js +9 -33
- package/components/chip/style.js +2 -205
- package/components/circular-progress/index.js +5 -39
- package/components/circular-progress/style.js +1 -136
- package/components/collapse/collapse-item-style.js +1 -21
- package/components/collapse/collapse-item.js +2 -10
- package/components/collapse/collapse-style.js +1 -5
- package/components/collapse/collapse.js +1 -4
- package/components/dialog/index.js +7 -35
- package/components/dialog/style.js +1 -116
- package/components/divider/style.js +1 -18
- package/components/dropdown/index.js +1 -8
- package/components/dropdown/style.js +1 -11
- package/components/fab/index.js +5 -13
- package/components/fab/style.js +4 -153
- package/components/icon/index.js +1 -5
- package/components/icon/style.js +1 -29
- package/components/layout/layout-item-style.js +1 -6
- package/components/layout/layout-main-style.js +1 -7
- package/components/layout/layout-style.js +1 -11
- package/components/linear-progress/index.js +2 -6
- package/components/linear-progress/style.js +1 -73
- package/components/list/list-item-style.js +2 -153
- package/components/list/list-item.js +8 -27
- package/components/list/list-style.js +1 -10
- package/components/list/list-subheader-style.js +1 -19
- package/components/menu/menu-item-style.js +1 -125
- package/components/menu/menu-item.js +13 -55
- package/components/menu/menu-style.js +1 -19
- package/components/menu/menu.js +1 -5
- package/components/navigation-bar/navigation-bar-item-style.js +1 -132
- package/components/navigation-bar/navigation-bar-item.js +7 -23
- package/components/navigation-bar/navigation-bar-style.js +1 -28
- package/components/navigation-bar/navigation-bar.js +1 -4
- package/components/navigation-drawer/index.js +1 -12
- package/components/navigation-drawer/style.js +1 -66
- package/components/navigation-rail/navigation-rail-item-style.js +1 -122
- package/components/navigation-rail/navigation-rail-item.js +7 -26
- package/components/navigation-rail/navigation-rail-style.js +1 -79
- package/components/navigation-rail/navigation-rail.js +1 -10
- package/components/radio/radio-group-style.js +1 -20
- package/components/radio/radio-group.js +1 -19
- package/components/radio/radio-style.js +1 -107
- package/components/radio/radio.js +5 -23
- package/components/range-slider/index.d.ts +1 -1
- package/components/range-slider/index.js +5 -53
- package/components/ripple/index.js +2 -5
- package/components/ripple/style.js +1 -96
- package/components/segmented-button/segmented-button-group-style.js +1 -28
- package/components/segmented-button/segmented-button-group.js +1 -21
- package/components/segmented-button/segmented-button-style.js +2 -81
- package/components/segmented-button/segmented-button.js +11 -27
- package/components/select/index.js +6 -87
- package/components/select/style.js +1 -27
- package/components/slider/index.js +2 -33
- package/components/slider/slider-base-style.js +1 -173
- package/components/slider/slider-base.js +1 -6
- package/components/slider/style.js +1 -7
- package/components/snackbar/index.js +5 -32
- package/components/snackbar/style.js +1 -100
- package/components/switch/index.js +6 -40
- package/components/switch/style.js +1 -202
- package/components/tabs/tab-panel-style.js +1 -10
- package/components/tabs/tab-style.js +1 -85
- package/components/tabs/tab.js +4 -24
- package/components/tabs/tabs-style.js +1 -138
- package/components/tabs/tabs.js +1 -9
- package/components/text-field/index.js +32 -160
- package/components/text-field/style.js +1 -362
- package/components/tooltip/index.js +1 -10
- package/components/tooltip/style.js +1 -57
- package/components/top-app-bar/top-app-bar-style.js +1 -78
- package/components/top-app-bar/top-app-bar-title-style.js +1 -81
- package/components/top-app-bar/top-app-bar-title.js +3 -17
- package/custom-elements.json +1105 -1105
- package/mdui.esm.js +22 -0
- package/mdui.global.js +22 -0
- package/package.json +1 -1
- package/web-types.en.json +1 -1
- package/web-types.zh-cn.json +1 -1
package/components/icon/style.js
CHANGED
|
@@ -1,30 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
3
|
-
:host {
|
|
4
|
-
display: inline-block;
|
|
5
|
-
width: 1em;
|
|
6
|
-
height: 1em;
|
|
7
|
-
font-weight: normal;
|
|
8
|
-
font-family: 'Material Icons';
|
|
9
|
-
font-style: normal;
|
|
10
|
-
line-height: 1;
|
|
11
|
-
direction: ltr;
|
|
12
|
-
letter-spacing: normal;
|
|
13
|
-
white-space: nowrap;
|
|
14
|
-
text-transform: none;
|
|
15
|
-
word-wrap: normal;
|
|
16
|
-
/* Support for all WebKit browsers. */
|
|
17
|
-
-webkit-font-smoothing: antialiased;
|
|
18
|
-
/* Support for Safari and Chrome. */
|
|
19
|
-
text-rendering: optimizelegibility;
|
|
20
|
-
/* Support for Firefox. */
|
|
21
|
-
-moz-osx-font-smoothing: grayscale;
|
|
22
|
-
font-size: 1.5rem;
|
|
23
|
-
}
|
|
24
|
-
svg,
|
|
25
|
-
::slotted(svg) {
|
|
26
|
-
width: 100%;
|
|
27
|
-
height: 100%;
|
|
28
|
-
fill: currentcolor;
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
2
|
+
export const style = css `:host{display:inline-block;width:1em;height:1em;font-weight:400;font-family:'Material Icons';font-style:normal;line-height:1;direction:ltr;letter-spacing:normal;white-space:nowrap;text-transform:none;word-wrap:normal;-webkit-font-smoothing:antialiased;text-rendering:optimizelegibility;-moz-osx-font-smoothing:grayscale;font-size:1.5rem}::slotted(svg),svg{width:100%;height:100%;fill:currentcolor}`;
|
|
@@ -1,12 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const layoutStyle = css
|
|
3
|
-
:host {
|
|
4
|
-
position: relative;
|
|
5
|
-
display: flex;
|
|
6
|
-
flex: 1 1 auto;
|
|
7
|
-
overflow: hidden;
|
|
8
|
-
}
|
|
9
|
-
:host([full-height]) {
|
|
10
|
-
height: 100%;
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
2
|
+
export const layoutStyle = css `:host{position:relative;display:flex;flex:1 1 auto;overflow:hidden}:host([full-height]){height:100%}`;
|
|
@@ -29,13 +29,9 @@ let LinearProgress = class LinearProgress extends MduiElement {
|
|
|
29
29
|
const isDeterminate = !isUndefined(this.value);
|
|
30
30
|
if (isDeterminate) {
|
|
31
31
|
const value = this.value;
|
|
32
|
-
return html `<div
|
|
33
|
-
part="indicator"
|
|
34
|
-
class="determinate"
|
|
35
|
-
style="${styleMap({
|
|
32
|
+
return html `<div part="indicator" class="determinate" style="${styleMap({
|
|
36
33
|
width: `${(value / Math.max(this.max ?? value, value)) * 100}%`,
|
|
37
|
-
})}"
|
|
38
|
-
></div>`;
|
|
34
|
+
})}"></div>`;
|
|
39
35
|
}
|
|
40
36
|
return html `<div part="indicator" class="indeterminate"></div>`;
|
|
41
37
|
}
|
|
@@ -1,74 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
3
|
-
:host {
|
|
4
|
-
--shape-corner: var(--mdui-shape-corner-none);
|
|
5
|
-
position: relative;
|
|
6
|
-
display: inline-block;
|
|
7
|
-
width: 100%;
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
border-radius: var(--shape-corner);
|
|
10
|
-
background-color: rgb(var(--mdui-color-surface-container-highest));
|
|
11
|
-
height: 0.25rem;
|
|
12
|
-
}
|
|
13
|
-
.determinate,
|
|
14
|
-
.indeterminate {
|
|
15
|
-
background-color: rgb(var(--mdui-color-primary));
|
|
16
|
-
}
|
|
17
|
-
.determinate {
|
|
18
|
-
height: 100%;
|
|
19
|
-
transition: width var(--mdui-motion-duration-long2)
|
|
20
|
-
var(--mdui-motion-easing-standard);
|
|
21
|
-
}
|
|
22
|
-
.indeterminate::before {
|
|
23
|
-
position: absolute;
|
|
24
|
-
top: 0;
|
|
25
|
-
bottom: 0;
|
|
26
|
-
left: 0;
|
|
27
|
-
background-color: inherit;
|
|
28
|
-
animation: mdui-comp-progress-indeterminate 2s
|
|
29
|
-
var(--mdui-motion-easing-linear) infinite;
|
|
30
|
-
content: ' ';
|
|
31
|
-
}
|
|
32
|
-
.indeterminate::after {
|
|
33
|
-
position: absolute;
|
|
34
|
-
top: 0;
|
|
35
|
-
bottom: 0;
|
|
36
|
-
left: 0;
|
|
37
|
-
background-color: inherit;
|
|
38
|
-
animation: mdui-comp-progress-indeterminate-short 2s
|
|
39
|
-
var(--mdui-motion-easing-linear) infinite;
|
|
40
|
-
content: ' ';
|
|
41
|
-
}
|
|
42
|
-
@keyframes mdui-comp-progress-indeterminate {
|
|
43
|
-
0% {
|
|
44
|
-
left: 0;
|
|
45
|
-
width: 0;
|
|
46
|
-
}
|
|
47
|
-
50% {
|
|
48
|
-
left: 30%;
|
|
49
|
-
width: 70%;
|
|
50
|
-
}
|
|
51
|
-
75% {
|
|
52
|
-
left: 100%;
|
|
53
|
-
width: 0;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
@keyframes mdui-comp-progress-indeterminate-short {
|
|
57
|
-
0% {
|
|
58
|
-
left: 0;
|
|
59
|
-
width: 0;
|
|
60
|
-
}
|
|
61
|
-
50% {
|
|
62
|
-
left: 0;
|
|
63
|
-
width: 0;
|
|
64
|
-
}
|
|
65
|
-
75% {
|
|
66
|
-
left: 0;
|
|
67
|
-
width: 25%;
|
|
68
|
-
}
|
|
69
|
-
100% {
|
|
70
|
-
left: 100%;
|
|
71
|
-
width: 0;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
`;
|
|
2
|
+
export const style = css `:host{--shape-corner:var(--mdui-shape-corner-none);position:relative;display:inline-block;width:100%;overflow:hidden;border-radius:var(--shape-corner);background-color:rgb(var(--mdui-color-surface-container-highest));height:.25rem}.determinate,.indeterminate{background-color:rgb(var(--mdui-color-primary))}.determinate{height:100%;transition:width var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard)}.indeterminate::before{position:absolute;top:0;bottom:0;left:0;background-color:inherit;animation:mdui-comp-progress-indeterminate 2s var(--mdui-motion-easing-linear) infinite;content:' '}.indeterminate::after{position:absolute;top:0;bottom:0;left:0;background-color:inherit;animation:mdui-comp-progress-indeterminate-short 2s var(--mdui-motion-easing-linear) infinite;content:' '}@keyframes mdui-comp-progress-indeterminate{0%{left:0;width:0}50%{left:30%;width:70%}75%{left:100%;width:0}}@keyframes mdui-comp-progress-indeterminate-short{0%{left:0;width:0}50%{left:0;width:0}75%{left:0;width:25%}100%{left:100%;width:0}}`;
|
|
@@ -1,155 +1,4 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const listItemStyle = css
|
|
3
|
-
:host {
|
|
4
|
-
--shape-corner: var(--mdui-shape-corner-none);
|
|
5
|
-
--shape-corner-rounded: var(--mdui-shape-corner-extra-large);
|
|
6
|
-
position: relative;
|
|
7
|
-
display: block;
|
|
8
|
-
border-radius: var(--shape-corner);
|
|
9
|
-
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
|
|
10
|
-
}
|
|
11
|
-
:host([rounded]),
|
|
12
|
-
:host([rounded]) mdui-ripple {
|
|
13
|
-
border-radius: var(--shape-corner-rounded);
|
|
14
|
-
}
|
|
15
|
-
:host([active]) {
|
|
16
|
-
background-color: rgb(var(--mdui-color-secondary-container));
|
|
17
|
-
--mdui-comp-ripple-state-layer-color: var(
|
|
2
|
+
export const listItemStyle = css `:host{--shape-corner:var(--mdui-shape-corner-none);--shape-corner-rounded:var(--mdui-shape-corner-extra-large);position:relative;display:block;border-radius:var(--shape-corner);--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([rounded]),:host([rounded]) mdui-ripple{border-radius:var(--shape-corner-rounded)}:host([active]){background-color:rgb(var(--mdui-color-secondary-container));--mdui-comp-ripple-state-layer-color:var(
|
|
18
3
|
--mdui-color-on-secondary-container
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
:host([disabled]) {
|
|
22
|
-
pointer-events: none;
|
|
23
|
-
}
|
|
24
|
-
.container {
|
|
25
|
-
cursor: pointer;
|
|
26
|
-
-webkit-user-select: none;
|
|
27
|
-
user-select: none;
|
|
28
|
-
text-decoration: none;
|
|
29
|
-
color: inherit;
|
|
30
|
-
-webkit-tap-highlight-color: transparent;
|
|
31
|
-
}
|
|
32
|
-
:host([disabled]) .container {
|
|
33
|
-
cursor: default;
|
|
34
|
-
opacity: 0.38;
|
|
35
|
-
}
|
|
36
|
-
:host([nonclickable]:not([href])) .container {
|
|
37
|
-
cursor: auto;
|
|
38
|
-
-webkit-user-select: auto;
|
|
39
|
-
user-select: auto;
|
|
40
|
-
}
|
|
41
|
-
.preset {
|
|
42
|
-
display: flex;
|
|
43
|
-
align-items: center;
|
|
44
|
-
padding: 0.5rem 1.5rem 0.5rem 1rem;
|
|
45
|
-
min-height: 3.5rem;
|
|
46
|
-
}
|
|
47
|
-
:host([alignment='start']) .preset {
|
|
48
|
-
align-items: flex-start;
|
|
49
|
-
}
|
|
50
|
-
:host([alignment='end']) .preset {
|
|
51
|
-
align-items: flex-end;
|
|
52
|
-
}
|
|
53
|
-
.body {
|
|
54
|
-
display: flex;
|
|
55
|
-
flex: 1 1 100%;
|
|
56
|
-
flex-direction: column;
|
|
57
|
-
justify-content: center;
|
|
58
|
-
min-width: 0;
|
|
59
|
-
}
|
|
60
|
-
.headline {
|
|
61
|
-
display: block;
|
|
62
|
-
color: rgb(var(--mdui-color-on-surface));
|
|
63
|
-
font-size: var(--mdui-typescale-body-large-size);
|
|
64
|
-
font-weight: var(--mdui-typescale-body-large-weight);
|
|
65
|
-
letter-spacing: var(--mdui-typescale-body-large-tracking);
|
|
66
|
-
line-height: var(--mdui-typescale-body-large-line-height);
|
|
67
|
-
}
|
|
68
|
-
:host([active]) .headline {
|
|
69
|
-
color: rgb(var(--mdui-color-on-secondary-container));
|
|
70
|
-
}
|
|
71
|
-
.description {
|
|
72
|
-
display: none;
|
|
73
|
-
color: rgb(var(--mdui-color-on-surface-variant));
|
|
74
|
-
font-size: var(--mdui-typescale-body-medium-size);
|
|
75
|
-
font-weight: var(--mdui-typescale-body-medium-weight);
|
|
76
|
-
letter-spacing: var(--mdui-typescale-body-medium-tracking);
|
|
77
|
-
line-height: var(--mdui-typescale-body-medium-line-height);
|
|
78
|
-
}
|
|
79
|
-
:host([disabled]) .description,
|
|
80
|
-
:host([hover]) .description,
|
|
81
|
-
:host([focused]) .description,
|
|
82
|
-
:host([pressed]) .description {
|
|
83
|
-
color: rgb(var(--mdui-color-on-surface));
|
|
84
|
-
}
|
|
85
|
-
.has-description .description {
|
|
86
|
-
display: block;
|
|
87
|
-
}
|
|
88
|
-
:host([headline-line='1']) .headline,
|
|
89
|
-
:host([description-line='1']) .description {
|
|
90
|
-
overflow: hidden;
|
|
91
|
-
white-space: nowrap;
|
|
92
|
-
text-overflow: ellipsis;
|
|
93
|
-
}
|
|
94
|
-
:host([headline-line='2']) .headline,
|
|
95
|
-
:host([description-line='2']) .description,
|
|
96
|
-
:host([headline-line='3']) .headline,
|
|
97
|
-
:host([description-line='3']) .description {
|
|
98
|
-
display: -webkit-box;
|
|
99
|
-
overflow: hidden;
|
|
100
|
-
text-overflow: ellipsis;
|
|
101
|
-
-webkit-box-orient: vertical;
|
|
102
|
-
}
|
|
103
|
-
:host([headline-line='2']) .headline,
|
|
104
|
-
:host([description-line='2']) .description {
|
|
105
|
-
-webkit-line-clamp: 2;
|
|
106
|
-
}
|
|
107
|
-
:host([headline-line='3']) .headline,
|
|
108
|
-
:host([description-line='3']) .description {
|
|
109
|
-
-webkit-line-clamp: 3;
|
|
110
|
-
}
|
|
111
|
-
.icon,
|
|
112
|
-
.end-icon {
|
|
113
|
-
display: flex;
|
|
114
|
-
flex: 0 0 auto;
|
|
115
|
-
font-size: var(--mdui-typescale-label-small-size);
|
|
116
|
-
font-weight: var(--mdui-typescale-label-small-weight);
|
|
117
|
-
letter-spacing: var(--mdui-typescale-label-small-tracking);
|
|
118
|
-
line-height: var(--mdui-typescale-label-small-line-height);
|
|
119
|
-
color: rgb(var(--mdui-color-on-surface-variant));
|
|
120
|
-
}
|
|
121
|
-
:host([disabled]) .icon,
|
|
122
|
-
:host([disabled]) .end-icon,
|
|
123
|
-
:host([hover]) .icon,
|
|
124
|
-
:host([hover]) .end-icon,
|
|
125
|
-
:host([focused]) .icon,
|
|
126
|
-
:host([focused]) .end-icon,
|
|
127
|
-
:host([pressed]) .icon,
|
|
128
|
-
:host([pressed]) .end-icon {
|
|
129
|
-
color: rgb(var(--mdui-color-on-surface));
|
|
130
|
-
}
|
|
131
|
-
:host([active]) .icon,
|
|
132
|
-
:host([active]) .end-icon {
|
|
133
|
-
color: rgb(var(--mdui-color-on-secondary-container));
|
|
134
|
-
}
|
|
135
|
-
.icon mdui-icon,
|
|
136
|
-
.end-icon mdui-icon,
|
|
137
|
-
.is-icon ::slotted([slot='icon']),
|
|
138
|
-
.is-end-icon ::slotted([slot='end-icon']) {
|
|
139
|
-
font-size: 1.5rem;
|
|
140
|
-
}
|
|
141
|
-
.has-icon .icon {
|
|
142
|
-
margin-right: 1rem;
|
|
143
|
-
}
|
|
144
|
-
.has-icon ::slotted(mdui-checkbox[slot='icon']),
|
|
145
|
-
.has-icon ::slotted(mdui-radio[slot='icon']) {
|
|
146
|
-
margin-left: -0.5rem;
|
|
147
|
-
}
|
|
148
|
-
.has-end-icon .end-icon {
|
|
149
|
-
margin-left: 1rem;
|
|
150
|
-
}
|
|
151
|
-
.has-end-icon ::slotted(mdui-checkbox[slot='end-icon']),
|
|
152
|
-
.has-end-icon ::slotted(mdui-radio[slot='end-icon']) {
|
|
153
|
-
margin-right: -0.5rem;
|
|
154
|
-
}
|
|
155
|
-
`;
|
|
4
|
+
)}:host([disabled]){pointer-events:none}.container{cursor:pointer;-webkit-user-select:none;user-select:none;text-decoration:none;color:inherit;-webkit-tap-highlight-color:transparent}:host([disabled]) .container{cursor:default;opacity:.38}:host([nonclickable]:not([href])) .container{cursor:auto;-webkit-user-select:auto;user-select:auto}.preset{display:flex;align-items:center;padding:.5rem 1.5rem .5rem 1rem;min-height:3.5rem}:host([alignment=start]) .preset{align-items:flex-start}:host([alignment=end]) .preset{align-items:flex-end}.body{display:flex;flex:1 1 100%;flex-direction:column;justify-content:center;min-width:0}.headline{display:block;color:rgb(var(--mdui-color-on-surface));font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height)}:host([active]) .headline{color:rgb(var(--mdui-color-on-secondary-container))}.description{display:none;color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-body-medium-size);font-weight:var(--mdui-typescale-body-medium-weight);letter-spacing:var(--mdui-typescale-body-medium-tracking);line-height:var(--mdui-typescale-body-medium-line-height)}:host([disabled]) .description,:host([focused]) .description,:host([hover]) .description,:host([pressed]) .description{color:rgb(var(--mdui-color-on-surface))}.has-description .description{display:block}:host([description-line='1']) .description,:host([headline-line='1']) .headline{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host([description-line='2']) .description,:host([description-line='3']) .description,:host([headline-line='2']) .headline,:host([headline-line='3']) .headline{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}:host([description-line='2']) .description,:host([headline-line='2']) .headline{-webkit-line-clamp:2}:host([description-line='3']) .description,:host([headline-line='3']) .headline{-webkit-line-clamp:3}.end-icon,.icon{display:flex;flex:0 0 auto;font-size:var(--mdui-typescale-label-small-size);font-weight:var(--mdui-typescale-label-small-weight);letter-spacing:var(--mdui-typescale-label-small-tracking);line-height:var(--mdui-typescale-label-small-line-height);color:rgb(var(--mdui-color-on-surface-variant))}:host([disabled]) .end-icon,:host([disabled]) .icon,:host([focused]) .end-icon,:host([focused]) .icon,:host([hover]) .end-icon,:host([hover]) .icon,:host([pressed]) .end-icon,:host([pressed]) .icon{color:rgb(var(--mdui-color-on-surface))}:host([active]) .end-icon,:host([active]) .icon{color:rgb(var(--mdui-color-on-secondary-container))}.end-icon mdui-icon,.icon mdui-icon,.is-end-icon ::slotted([slot=end-icon]),.is-icon ::slotted([slot=icon]){font-size:1.5rem}.has-icon .icon{margin-right:1rem}.has-icon ::slotted(mdui-checkbox[slot=icon]),.has-icon ::slotted(mdui-radio[slot=icon]){margin-left:-.5rem}.has-end-icon .end-icon{margin-left:1rem}.has-end-icon ::slotted(mdui-checkbox[slot=end-icon]),.has-end-icon ::slotted(mdui-radio[slot=end-icon]){margin-right:-.5rem}`;
|
|
@@ -103,43 +103,24 @@ let ListItem = class ListItem extends AnchorMixin(RippleMixin(FocusableMixin(Mdu
|
|
|
103
103
|
// end-icon slot 中的元素是否为 mdui-icon 或 mdui-icon-* 组件
|
|
104
104
|
'is-end-icon': getNodeName(this.endIconElements[0]).startsWith('mdui-icon-'),
|
|
105
105
|
});
|
|
106
|
-
return html `<mdui-ripple
|
|
107
|
-
${ref(this.rippleRef)}
|
|
108
|
-
.noRipple=${this.noRipple}
|
|
109
|
-
></mdui-ripple>
|
|
110
|
-
${this.href && !this.disabled
|
|
106
|
+
return html `<mdui-ripple ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.href && !this.disabled
|
|
111
107
|
? this.renderAnchor({
|
|
112
108
|
className,
|
|
113
109
|
content: this.renderInner(),
|
|
114
110
|
part: 'container',
|
|
115
111
|
refDirective: ref(this.itemRef),
|
|
116
112
|
})
|
|
117
|
-
: html `<div part="container" class="${className}" ${ref(this.itemRef)}
|
|
118
|
-
${this.renderInner()}
|
|
119
|
-
</div>`}`;
|
|
113
|
+
: html `<div part="container" class="${className}" ${ref(this.itemRef)}>${this.renderInner()}</div>`}`;
|
|
120
114
|
}
|
|
121
115
|
renderInner() {
|
|
122
116
|
const hasDefaultSlot = this.hasSlotController.test('[default]');
|
|
123
|
-
return html `<slot name="custom"
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
? html `<mdui-icon name=${this.icon}></mdui-icon>`
|
|
127
|
-
: nothingTemplate}
|
|
128
|
-
</slot>
|
|
129
|
-
<div part="body" class="body">
|
|
130
|
-
${hasDefaultSlot
|
|
117
|
+
return html `<slot name="custom"><slot name="icon" part="icon" class="icon">${this.icon
|
|
118
|
+
? html `<mdui-icon name="${this.icon}"></mdui-icon>`
|
|
119
|
+
: nothingTemplate}</slot><div part="body" class="body">${hasDefaultSlot
|
|
131
120
|
? html `<slot part="headline" class="headline"></slot>`
|
|
132
|
-
: html `<div part="headline" class="headline">${this.headline}</div>`}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
</slot>
|
|
136
|
-
</div>
|
|
137
|
-
<slot name="end-icon" part="end-icon" class="end-icon">
|
|
138
|
-
${this.endIcon
|
|
139
|
-
? html `<mdui-icon name=${this.endIcon}></mdui-icon>`
|
|
140
|
-
: nothingTemplate}
|
|
141
|
-
</slot>
|
|
142
|
-
</slot>`;
|
|
121
|
+
: html `<div part="headline" class="headline">${this.headline}</div>`}<slot name="description" part="description" class="description">${this.description}</slot></div><slot name="end-icon" part="end-icon" class="end-icon">${this.endIcon
|
|
122
|
+
? html `<mdui-icon name="${this.endIcon}"></mdui-icon>`
|
|
123
|
+
: nothingTemplate}</slot></slot>`;
|
|
143
124
|
}
|
|
144
125
|
};
|
|
145
126
|
ListItem.styles = [
|
|
@@ -1,11 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const listStyle = css
|
|
3
|
-
:host {
|
|
4
|
-
display: block;
|
|
5
|
-
padding: 0.5rem 0rem;
|
|
6
|
-
}
|
|
7
|
-
::slotted(mdui-divider[middle]) {
|
|
8
|
-
margin-left: 1rem;
|
|
9
|
-
margin-right: 1.5rem;
|
|
10
|
-
}
|
|
11
|
-
`;
|
|
2
|
+
export const listStyle = css `:host{display:block;padding:.5rem 0}::slotted(mdui-divider[middle]){margin-left:1rem;margin-right:1.5rem}`;
|
|
@@ -1,20 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const listSubheaderStyle = css
|
|
3
|
-
/* 规范中没有该描述 */
|
|
4
|
-
:host {
|
|
5
|
-
display: block;
|
|
6
|
-
overflow: hidden;
|
|
7
|
-
white-space: nowrap;
|
|
8
|
-
text-overflow: ellipsis;
|
|
9
|
-
cursor: default;
|
|
10
|
-
color: rgb(var(--mdui-color-on-surface-variant));
|
|
11
|
-
font-size: var(--mdui-typescale-label-small-size);
|
|
12
|
-
font-weight: var(--mdui-typescale-label-small-weight);
|
|
13
|
-
letter-spacing: var(--mdui-typescale-label-small-tracking);
|
|
14
|
-
line-height: var(--mdui-typescale-label-small-line-height);
|
|
15
|
-
padding-left: 1rem;
|
|
16
|
-
padding-right: 1.5rem;
|
|
17
|
-
height: 3.5rem;
|
|
18
|
-
line-height: 3.5rem;
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
2
|
+
export const listSubheaderStyle = css `:host{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;cursor:default;color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-label-small-size);font-weight:var(--mdui-typescale-label-small-weight);letter-spacing:var(--mdui-typescale-label-small-tracking);line-height:var(--mdui-typescale-label-small-line-height);padding-left:1rem;padding-right:1.5rem;height:3.5rem;line-height:3.5rem}`;
|
|
@@ -1,126 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const menuItemStyle = css
|
|
3
|
-
:host {
|
|
4
|
-
position: relative;
|
|
5
|
-
display: block;
|
|
6
|
-
}
|
|
7
|
-
:host([selected]) {
|
|
8
|
-
background-color: rgba(var(--mdui-color-primary), 12%);
|
|
9
|
-
}
|
|
10
|
-
:host([disabled]) {
|
|
11
|
-
pointer-events: none;
|
|
12
|
-
}
|
|
13
|
-
.container {
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
-webkit-user-select: none;
|
|
16
|
-
user-select: none;
|
|
17
|
-
-webkit-tap-highlight-color: transparent;
|
|
18
|
-
}
|
|
19
|
-
:host([disabled]) .container {
|
|
20
|
-
cursor: default;
|
|
21
|
-
opacity: 0.38;
|
|
22
|
-
}
|
|
23
|
-
.preset {
|
|
24
|
-
display: flex;
|
|
25
|
-
align-items: center;
|
|
26
|
-
text-decoration: none;
|
|
27
|
-
height: 3rem;
|
|
28
|
-
padding: 0rem 0.75rem;
|
|
29
|
-
}
|
|
30
|
-
.preset.dense {
|
|
31
|
-
height: 2rem;
|
|
32
|
-
}
|
|
33
|
-
.label-container {
|
|
34
|
-
flex: 1 1 100%;
|
|
35
|
-
min-width: 0;
|
|
36
|
-
}
|
|
37
|
-
.label {
|
|
38
|
-
display: block;
|
|
39
|
-
overflow: hidden;
|
|
40
|
-
white-space: nowrap;
|
|
41
|
-
text-overflow: ellipsis;
|
|
42
|
-
color: rgb(var(--mdui-color-on-surface));
|
|
43
|
-
font-size: var(--mdui-typescale-label-large-size);
|
|
44
|
-
font-weight: var(--mdui-typescale-label-large-weight);
|
|
45
|
-
letter-spacing: var(--mdui-typescale-label-large-tracking);
|
|
46
|
-
}
|
|
47
|
-
.icon,
|
|
48
|
-
.selected-icon,
|
|
49
|
-
.end-icon,
|
|
50
|
-
.end-text {
|
|
51
|
-
display: none;
|
|
52
|
-
flex: 0 0 auto;
|
|
53
|
-
color: rgb(var(--mdui-color-on-surface-variant));
|
|
54
|
-
}
|
|
55
|
-
.has-icon .icon,
|
|
56
|
-
.has-icon .selected-icon,
|
|
57
|
-
.has-end-icon .end-icon,
|
|
58
|
-
.has-end-text .end-text {
|
|
59
|
-
display: flex;
|
|
60
|
-
}
|
|
61
|
-
.icon,
|
|
62
|
-
.selected-icon,
|
|
63
|
-
.end-icon {
|
|
64
|
-
font-size: 1.5rem;
|
|
65
|
-
}
|
|
66
|
-
.icon::slotted(mdui-avatar),
|
|
67
|
-
.selected-icon::slotted(mdui-avatar),
|
|
68
|
-
.end-icon::slotted(mdui-avatar) {
|
|
69
|
-
width: 1.5rem;
|
|
70
|
-
height: 1.5rem;
|
|
71
|
-
}
|
|
72
|
-
.dense .icon,
|
|
73
|
-
.dense .selected-icon,
|
|
74
|
-
.dense .end-icon {
|
|
75
|
-
font-size: 1.125rem;
|
|
76
|
-
}
|
|
77
|
-
.dense .icon::slotted(mdui-avatar),
|
|
78
|
-
.dense .selected-icon::slotted(mdui-avatar),
|
|
79
|
-
.dense .end-icon::slotted(mdui-avatar) {
|
|
80
|
-
width: 1.125rem;
|
|
81
|
-
height: 1.125rem;
|
|
82
|
-
}
|
|
83
|
-
.icon .i,
|
|
84
|
-
.selected-icon .i,
|
|
85
|
-
.end-icon .i,
|
|
86
|
-
::slotted([slot='icon']),
|
|
87
|
-
::slotted([slot='selected-icon']),
|
|
88
|
-
::slotted([slot='end-icon']) {
|
|
89
|
-
font-size: inherit;
|
|
90
|
-
}
|
|
91
|
-
.end-text {
|
|
92
|
-
font-size: var(--mdui-typescale-label-large-size);
|
|
93
|
-
font-weight: var(--mdui-typescale-label-large-weight);
|
|
94
|
-
letter-spacing: var(--mdui-typescale-label-large-tracking);
|
|
95
|
-
line-height: var(--mdui-typescale-label-large-line-height);
|
|
96
|
-
}
|
|
97
|
-
.icon,
|
|
98
|
-
.selected-icon {
|
|
99
|
-
margin-right: 0.75rem;
|
|
100
|
-
}
|
|
101
|
-
.end-icon,
|
|
102
|
-
.end-text {
|
|
103
|
-
margin-left: 0.75rem;
|
|
104
|
-
}
|
|
105
|
-
.arrow-right {
|
|
106
|
-
color: rgb(var(--mdui-color-on-surface));
|
|
107
|
-
}
|
|
108
|
-
.submenu {
|
|
109
|
-
--shape-corner: var(--mdui-shape-corner-extra-small);
|
|
110
|
-
display: block;
|
|
111
|
-
position: absolute;
|
|
112
|
-
z-index: 1;
|
|
113
|
-
border-radius: var(--shape-corner);
|
|
114
|
-
background-color: rgb(var(--mdui-color-surface-container));
|
|
115
|
-
box-shadow: var(--mdui-elevation-level2);
|
|
116
|
-
min-width: 7rem;
|
|
117
|
-
max-width: 17.5rem;
|
|
118
|
-
padding-top: 0.5rem;
|
|
119
|
-
padding-bottom: 0.5rem;
|
|
120
|
-
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
|
|
121
|
-
}
|
|
122
|
-
.submenu::slotted(mdui-divider) {
|
|
123
|
-
margin-top: 0.5rem;
|
|
124
|
-
margin-bottom: 0.5rem;
|
|
125
|
-
}
|
|
126
|
-
`;
|
|
2
|
+
export const menuItemStyle = css `:host{position:relative;display:block}:host([selected]){background-color:rgba(var(--mdui-color-primary),12%)}:host([disabled]){pointer-events:none}.container{cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}:host([disabled]) .container{cursor:default;opacity:.38}.preset{display:flex;align-items:center;text-decoration:none;height:3rem;padding:0 .75rem}.preset.dense{height:2rem}.label-container{flex:1 1 100%;min-width:0}.label{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:rgb(var(--mdui-color-on-surface));font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking)}.end-icon,.end-text,.icon,.selected-icon{display:none;flex:0 0 auto;color:rgb(var(--mdui-color-on-surface-variant))}.has-end-icon .end-icon,.has-end-text .end-text,.has-icon .icon,.has-icon .selected-icon{display:flex}.end-icon,.icon,.selected-icon{font-size:1.5rem}.end-icon::slotted(mdui-avatar),.icon::slotted(mdui-avatar),.selected-icon::slotted(mdui-avatar){width:1.5rem;height:1.5rem}.dense .end-icon,.dense .icon,.dense .selected-icon{font-size:1.125rem}.dense .end-icon::slotted(mdui-avatar),.dense .icon::slotted(mdui-avatar),.dense .selected-icon::slotted(mdui-avatar){width:1.125rem;height:1.125rem}.end-icon .i,.icon .i,.selected-icon .i,::slotted([slot=end-icon]),::slotted([slot=icon]),::slotted([slot=selected-icon]){font-size:inherit}.end-text{font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking);line-height:var(--mdui-typescale-label-large-line-height)}.icon,.selected-icon{margin-right:.75rem}.end-icon,.end-text{margin-left:.75rem}.arrow-right{color:rgb(var(--mdui-color-on-surface))}.submenu{--shape-corner:var(--mdui-shape-corner-extra-small);display:block;position:absolute;z-index:1;border-radius:var(--shape-corner);background-color:rgb(var(--mdui-color-surface-container));box-shadow:var(--mdui-elevation-level2);min-width:7rem;max-width:17.5rem;padding-top:.5rem;padding-bottom:.5rem;--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}.submenu::slotted(mdui-divider){margin-top:.5rem;margin-bottom:.5rem}`;
|
|
@@ -208,11 +208,7 @@ let MenuItem = class MenuItem extends AnchorMixin(RippleMixin(FocusableMixin(Mdu
|
|
|
208
208
|
'has-end-text': hasEndText,
|
|
209
209
|
'has-end-icon': hasEndIcon,
|
|
210
210
|
});
|
|
211
|
-
return html `<mdui-ripple
|
|
212
|
-
${ref(this.rippleRef)}
|
|
213
|
-
.noRipple=${this.noRipple}
|
|
214
|
-
></mdui-ripple>
|
|
215
|
-
${this.href && !this.disabled
|
|
211
|
+
return html `<mdui-ripple ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.href && !this.disabled
|
|
216
212
|
? this.renderAnchor({
|
|
217
213
|
part: 'container',
|
|
218
214
|
className,
|
|
@@ -220,20 +216,7 @@ let MenuItem = class MenuItem extends AnchorMixin(RippleMixin(FocusableMixin(Mdu
|
|
|
220
216
|
refDirective: ref(this.containerRef),
|
|
221
217
|
tabIndex: this.focusable ? 0 : -1,
|
|
222
218
|
})
|
|
223
|
-
: html `<div
|
|
224
|
-
part="container"
|
|
225
|
-
${ref(this.containerRef)}
|
|
226
|
-
class=${className}
|
|
227
|
-
>
|
|
228
|
-
${this.renderInner(useDefaultEndIcon, hasIcon)}
|
|
229
|
-
</div>`}
|
|
230
|
-
${when(hasSubmenu, () => html `<slot
|
|
231
|
-
name="submenu"
|
|
232
|
-
${ref(this.submenuRef)}
|
|
233
|
-
part="submenu"
|
|
234
|
-
class="submenu"
|
|
235
|
-
hidden
|
|
236
|
-
></slot>`)}`;
|
|
219
|
+
: html `<div part="container" ${ref(this.containerRef)} class="${className}">${this.renderInner(useDefaultEndIcon, hasIcon)}</div>`} ${when(hasSubmenu, () => html `<slot name="submenu" ${ref(this.submenuRef)} part="submenu" class="submenu" hidden></slot>`)}`;
|
|
237
220
|
}
|
|
238
221
|
/**
|
|
239
222
|
* 点击子菜单外面的区域,关闭子菜单
|
|
@@ -361,42 +344,17 @@ let MenuItem = class MenuItem extends AnchorMixin(RippleMixin(FocusableMixin(Mdu
|
|
|
361
344
|
});
|
|
362
345
|
}
|
|
363
346
|
renderInner(useDefaultEndIcon, hasIcon) {
|
|
364
|
-
return html `<slot name="custom"
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
part="
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
></mdui-icon>`
|
|
376
|
-
: html `<mdui-icon-check class="i"></mdui-icon-check>`}
|
|
377
|
-
</slot>`
|
|
378
|
-
: html `<slot name="icon" part="icon" class="icon">
|
|
379
|
-
${hasIcon
|
|
380
|
-
? html `<mdui-icon name=${this.icon} class="i"></mdui-icon>`
|
|
381
|
-
: nothingTemplate}
|
|
382
|
-
</slot>`}
|
|
383
|
-
<div class="label-container">
|
|
384
|
-
<slot part="label" class="label"></slot>
|
|
385
|
-
</div>
|
|
386
|
-
<slot name="end-text" part="end-text" class="end-text">
|
|
387
|
-
${this.endText}
|
|
388
|
-
</slot>
|
|
389
|
-
${useDefaultEndIcon
|
|
390
|
-
? html `<mdui-icon-arrow-right
|
|
391
|
-
part="end-icon"
|
|
392
|
-
class="end-icon arrow-right"
|
|
393
|
-
></mdui-icon-arrow-right>`
|
|
394
|
-
: html `<slot name="end-icon" part="end-icon" class="end-icon">
|
|
395
|
-
${this.endIcon
|
|
396
|
-
? html `<mdui-icon name=${this.endIcon}></mdui-icon>`
|
|
397
|
-
: nothingTemplate}
|
|
398
|
-
</slot>`}
|
|
399
|
-
</slot>`;
|
|
347
|
+
return html `<slot name="custom">${this.selected
|
|
348
|
+
? html `<slot name="selected-icon" part="selected-icon" class="selected-icon">${this.selectedIcon
|
|
349
|
+
? html `<mdui-icon name="${this.selectedIcon}" class="i"></mdui-icon>`
|
|
350
|
+
: html `<mdui-icon-check class="i"></mdui-icon-check>`}</slot>`
|
|
351
|
+
: html `<slot name="icon" part="icon" class="icon">${hasIcon
|
|
352
|
+
? html `<mdui-icon name="${this.icon}" class="i"></mdui-icon>`
|
|
353
|
+
: nothingTemplate}</slot>`}<div class="label-container"><slot part="label" class="label"></slot></div><slot name="end-text" part="end-text" class="end-text">${this.endText}</slot>${useDefaultEndIcon
|
|
354
|
+
? html `<mdui-icon-arrow-right part="end-icon" class="end-icon arrow-right"></mdui-icon-arrow-right>`
|
|
355
|
+
: html `<slot name="end-icon" part="end-icon" class="end-icon">${this.endIcon
|
|
356
|
+
? html `<mdui-icon name="${this.endIcon}"></mdui-icon>`
|
|
357
|
+
: nothingTemplate}</slot>`}</slot>`;
|
|
400
358
|
}
|
|
401
359
|
};
|
|
402
360
|
MenuItem.styles = [
|
|
@@ -1,20 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const menuStyle = css
|
|
3
|
-
:host {
|
|
4
|
-
--shape-corner: var(--mdui-shape-corner-extra-small);
|
|
5
|
-
position: relative;
|
|
6
|
-
display: block;
|
|
7
|
-
border-radius: var(--shape-corner);
|
|
8
|
-
background-color: rgb(var(--mdui-color-surface-container));
|
|
9
|
-
box-shadow: var(--mdui-elevation-level2);
|
|
10
|
-
min-width: 7rem;
|
|
11
|
-
max-width: 17.5rem;
|
|
12
|
-
padding-top: 0.5rem;
|
|
13
|
-
padding-bottom: 0.5rem;
|
|
14
|
-
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
|
|
15
|
-
}
|
|
16
|
-
::slotted(mdui-divider) {
|
|
17
|
-
margin-top: 0.5rem;
|
|
18
|
-
margin-bottom: 0.5rem;
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
2
|
+
export const menuStyle = css `:host{--shape-corner:var(--mdui-shape-corner-extra-small);position:relative;display:block;border-radius:var(--shape-corner);background-color:rgb(var(--mdui-color-surface-container));box-shadow:var(--mdui-elevation-level2);min-width:7rem;max-width:17.5rem;padding-top:.5rem;padding-bottom:.5rem;--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}::slotted(mdui-divider){margin-top:.5rem;margin-bottom:.5rem}`;
|
package/components/menu/menu.js
CHANGED
|
@@ -226,11 +226,7 @@ let Menu = class Menu extends MduiElement {
|
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
228
|
render() {
|
|
229
|
-
return html `<slot
|
|
230
|
-
@slotchange=${this.onSlotChange}
|
|
231
|
-
@click=${this.onClick}
|
|
232
|
-
@keydown=${this.onKeyDown}
|
|
233
|
-
></slot>`;
|
|
229
|
+
return html `<slot @slotchange="${this.onSlotChange}" @click="${this.onClick}" @keydown="${this.onKeyDown}"></slot>`;
|
|
234
230
|
}
|
|
235
231
|
setSelectedKeys(selectedKeys) {
|
|
236
232
|
if (!arraysEqualIgnoreOrder(this.selectedKeys, selectedKeys)) {
|