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
|
@@ -32,9 +32,14 @@ let Avatar = class Avatar extends MduiElement {
|
|
|
32
32
|
return this.hasSlotController.test('[default]')
|
|
33
33
|
? html `<slot></slot>`
|
|
34
34
|
: this.src
|
|
35
|
-
? html `<img
|
|
35
|
+
? html `<img
|
|
36
|
+
part="image"
|
|
37
|
+
alt=${ifDefined(this.label)}
|
|
38
|
+
src=${this.src}
|
|
39
|
+
style=${styleMap({ objectFit: this.fit })}
|
|
40
|
+
/>`
|
|
36
41
|
: this.icon
|
|
37
|
-
? html `<mdui-icon part="icon" name
|
|
42
|
+
? html `<mdui-icon part="icon" name=${this.icon}></mdui-icon>`
|
|
38
43
|
: nothingTemplate;
|
|
39
44
|
}
|
|
40
45
|
};
|
|
@@ -1,2 +1,32 @@
|
|
|
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-full);
|
|
5
|
+
position: relative;
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
white-space: nowrap;
|
|
11
|
+
vertical-align: middle;
|
|
12
|
+
border-radius: var(--shape-corner);
|
|
13
|
+
-webkit-user-select: none;
|
|
14
|
+
user-select: none;
|
|
15
|
+
width: 2.5rem;
|
|
16
|
+
height: 2.5rem;
|
|
17
|
+
background-color: rgb(var(--mdui-color-primary-container));
|
|
18
|
+
color: rgb(var(--mdui-color-on-primary-container));
|
|
19
|
+
font-size: var(--mdui-typescale-title-medium-size);
|
|
20
|
+
font-weight: var(--mdui-typescale-title-medium-weight);
|
|
21
|
+
letter-spacing: var(--mdui-typescale-title-medium-tracking);
|
|
22
|
+
line-height: var(--mdui-typescale-title-medium-line-height);
|
|
23
|
+
}
|
|
24
|
+
img {
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
}
|
|
28
|
+
mdui-icon,
|
|
29
|
+
::slotted(mdui-icon) {
|
|
30
|
+
font-size: 1.5em;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
@@ -1,2 +1,26 @@
|
|
|
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-full);
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
border-radius: var(--shape-corner);
|
|
9
|
+
padding-left: 0.25rem;
|
|
10
|
+
padding-right: 0.25rem;
|
|
11
|
+
color: rgb(var(--mdui-color-on-error));
|
|
12
|
+
background-color: rgb(var(--mdui-color-error));
|
|
13
|
+
height: 1rem;
|
|
14
|
+
min-width: 1rem;
|
|
15
|
+
font-size: var(--mdui-typescale-label-small-size);
|
|
16
|
+
font-weight: var(--mdui-typescale-label-small-weight);
|
|
17
|
+
letter-spacing: var(--mdui-typescale-label-small-tracking);
|
|
18
|
+
line-height: var(--mdui-typescale-label-small-line-height);
|
|
19
|
+
}
|
|
20
|
+
:host([variant='small']) {
|
|
21
|
+
min-width: 0;
|
|
22
|
+
padding: 0;
|
|
23
|
+
width: 0.375rem;
|
|
24
|
+
height: 0.375rem;
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
@@ -1,2 +1,93 @@
|
|
|
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-none);
|
|
5
|
+
--z-index: 2000;
|
|
6
|
+
position: fixed;
|
|
7
|
+
right: 0;
|
|
8
|
+
bottom: 0;
|
|
9
|
+
left: 0;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex: 0 0 auto;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: flex-start;
|
|
14
|
+
border-radius: var(--shape-corner) var(--shape-corner) 0 0;
|
|
15
|
+
z-index: var(--z-index);
|
|
16
|
+
transition: bottom var(--mdui-motion-duration-long2)
|
|
17
|
+
var(--mdui-motion-easing-emphasized);
|
|
18
|
+
padding: 0rem 1rem;
|
|
19
|
+
height: 5rem;
|
|
20
|
+
background-color: rgb(var(--mdui-color-surface-container));
|
|
21
|
+
box-shadow: var(--mdui-elevation-level2);
|
|
22
|
+
}
|
|
23
|
+
:host([scroll-target]:not([scroll-target=''])) {
|
|
24
|
+
position: absolute;
|
|
25
|
+
}
|
|
26
|
+
:host([hide]) {
|
|
27
|
+
transition-duration: var(--mdui-motion-duration-short4);
|
|
28
|
+
bottom: -5.625rem;
|
|
29
|
+
}
|
|
30
|
+
::slotted(:not(:first-child)) {
|
|
31
|
+
margin-left: 0.5rem;
|
|
32
|
+
}
|
|
33
|
+
::slotted(mdui-fab) {
|
|
34
|
+
box-shadow: var(--mdui-elevation-level0);
|
|
35
|
+
}
|
|
36
|
+
:host([fab-detach]) ::slotted(mdui-fab) {
|
|
37
|
+
position: absolute;
|
|
38
|
+
transition: bottom var(--mdui-motion-duration-long2)
|
|
39
|
+
var(--mdui-motion-easing-standard);
|
|
40
|
+
right: 1rem;
|
|
41
|
+
bottom: 0.75rem;
|
|
42
|
+
}
|
|
43
|
+
:host([fab-detach][hide][scroll-behavior~='hide']) ::slotted(mdui-fab) {
|
|
44
|
+
transition-duration: var(--mdui-motion-duration-short4);
|
|
45
|
+
bottom: 1rem;
|
|
46
|
+
box-shadow: var(--mdui-elevation-level2);
|
|
47
|
+
}
|
|
48
|
+
:host(
|
|
49
|
+
[fab-detach][hide][scroll-behavior~='hide'][scroll-target]:not(
|
|
50
|
+
[scroll-target='']
|
|
51
|
+
)
|
|
52
|
+
)
|
|
53
|
+
::slotted(mdui-fab) {
|
|
54
|
+
bottom: 6.625rem;
|
|
55
|
+
}
|
|
56
|
+
:host([hide]) ::slotted(:not(mdui-fab)),
|
|
57
|
+
:host([hide]:not([fab-detach])) ::slotted(mdui-fab) {
|
|
58
|
+
transform: translateY(8.75rem);
|
|
59
|
+
transition: transform var(--mdui-motion-duration-0)
|
|
60
|
+
var(--mdui-motion-easing-emphasized-accelerate)
|
|
61
|
+
var(--mdui-motion-duration-short4);
|
|
62
|
+
}
|
|
63
|
+
::slotted(:first-child) {
|
|
64
|
+
transition: transform var(--mdui-motion-duration-short3)
|
|
65
|
+
var(--mdui-motion-easing-emphasized-decelerate)
|
|
66
|
+
var(--mdui-motion-duration-short1);
|
|
67
|
+
}
|
|
68
|
+
::slotted(:nth-child(2)) {
|
|
69
|
+
transition: transform var(--mdui-motion-duration-short3)
|
|
70
|
+
var(--mdui-motion-easing-emphasized-decelerate)
|
|
71
|
+
var(--mdui-motion-duration-short3);
|
|
72
|
+
}
|
|
73
|
+
::slotted(:nth-child(3)) {
|
|
74
|
+
transition: transform var(--mdui-motion-duration-short3)
|
|
75
|
+
var(--mdui-motion-easing-emphasized-decelerate)
|
|
76
|
+
var(--mdui-motion-duration-short4);
|
|
77
|
+
}
|
|
78
|
+
::slotted(:nth-child(4)) {
|
|
79
|
+
transition: transform var(--mdui-motion-duration-short3)
|
|
80
|
+
var(--mdui-motion-easing-emphasized-decelerate)
|
|
81
|
+
var(--mdui-motion-duration-medium1);
|
|
82
|
+
}
|
|
83
|
+
::slotted(:nth-child(5)) {
|
|
84
|
+
transition: transform var(--mdui-motion-duration-short3)
|
|
85
|
+
var(--mdui-motion-easing-emphasized-decelerate)
|
|
86
|
+
var(--mdui-motion-duration-medium2);
|
|
87
|
+
}
|
|
88
|
+
::slotted(:nth-child(6)) {
|
|
89
|
+
transition: transform var(--mdui-motion-duration-short3)
|
|
90
|
+
var(--mdui-motion-easing-emphasized-decelerate)
|
|
91
|
+
var(--mdui-motion-duration-medium3);
|
|
92
|
+
}
|
|
93
|
+
`;
|
|
@@ -1,2 +1,29 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const buttonBaseStyle = css
|
|
2
|
+
export const buttonBaseStyle = css `
|
|
3
|
+
.button {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
height: 100%;
|
|
9
|
+
padding: 0;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
color: inherit;
|
|
12
|
+
font-size: inherit;
|
|
13
|
+
font-family: inherit;
|
|
14
|
+
font-weight: inherit;
|
|
15
|
+
letter-spacing: inherit;
|
|
16
|
+
white-space: nowrap;
|
|
17
|
+
text-align: center;
|
|
18
|
+
text-decoration: none;
|
|
19
|
+
vertical-align: middle;
|
|
20
|
+
background: transparent;
|
|
21
|
+
border: none;
|
|
22
|
+
outline: none;
|
|
23
|
+
cursor: inherit;
|
|
24
|
+
user-select: none;
|
|
25
|
+
touch-action: manipulation;
|
|
26
|
+
zoom: 1;
|
|
27
|
+
-webkit-user-drag: none;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
@@ -151,7 +151,14 @@ export class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(MduiEleme
|
|
|
151
151
|
: nothingTemplate;
|
|
152
152
|
}
|
|
153
153
|
renderButton({ id, className, part, content = html `<slot></slot>`, }) {
|
|
154
|
-
return html `<button
|
|
154
|
+
return html `<button
|
|
155
|
+
id=${ifDefined(id)}
|
|
156
|
+
class=${cc(['_button', className])}
|
|
157
|
+
part=${ifDefined(part)}
|
|
158
|
+
?disabled=${this.rippleDisabled || this.focusDisabled}
|
|
159
|
+
>
|
|
160
|
+
${content}
|
|
161
|
+
</button>`;
|
|
155
162
|
}
|
|
156
163
|
isButton() {
|
|
157
164
|
return !this.href;
|
|
@@ -53,14 +53,20 @@ let Button = class Button extends ButtonBase {
|
|
|
53
53
|
return this.rippleRef.value;
|
|
54
54
|
}
|
|
55
55
|
render() {
|
|
56
|
-
return html `<mdui-ripple
|
|
56
|
+
return html `<mdui-ripple
|
|
57
|
+
${ref(this.rippleRef)}
|
|
58
|
+
.noRipple=${this.noRipple}
|
|
59
|
+
></mdui-ripple>
|
|
60
|
+
${this.isButton()
|
|
57
61
|
? this.renderButton({
|
|
58
62
|
className: 'button',
|
|
59
63
|
part: 'button',
|
|
60
64
|
content: this.renderInner(),
|
|
61
65
|
})
|
|
62
66
|
: this.disabled || this.loading
|
|
63
|
-
? html `<span part="button" class="button _a"
|
|
67
|
+
? html `<span part="button" class="button _a">
|
|
68
|
+
${this.renderInner()}
|
|
69
|
+
</span>`
|
|
64
70
|
: this.renderAnchor({
|
|
65
71
|
className: 'button',
|
|
66
72
|
part: 'button',
|
|
@@ -71,17 +77,21 @@ let Button = class Button extends ButtonBase {
|
|
|
71
77
|
if (this.loading) {
|
|
72
78
|
return this.renderLoading();
|
|
73
79
|
}
|
|
74
|
-
return html `<slot name="icon" part="icon" class="icon"
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
return html `<slot name="icon" part="icon" class="icon">
|
|
81
|
+
${this.icon
|
|
82
|
+
? html `<mdui-icon name=${this.icon}></mdui-icon>`
|
|
83
|
+
: nothingTemplate}
|
|
84
|
+
</slot>`;
|
|
77
85
|
}
|
|
78
86
|
renderLabel() {
|
|
79
87
|
return html `<slot part="label" class="label"></slot>`;
|
|
80
88
|
}
|
|
81
89
|
renderEndIcon() {
|
|
82
|
-
return html `<slot name="end-icon" part="end-icon" class="end-icon"
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
return html `<slot name="end-icon" part="end-icon" class="end-icon">
|
|
91
|
+
${this.endIcon
|
|
92
|
+
? html `<mdui-icon name=${this.endIcon}></mdui-icon>`
|
|
93
|
+
: nothingTemplate}
|
|
94
|
+
</slot>`;
|
|
85
95
|
}
|
|
86
96
|
renderInner() {
|
|
87
97
|
return [this.renderIcon(), this.renderLabel(), this.renderEndIcon()];
|
|
@@ -1,4 +1,113 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
2
|
+
export const style = css `
|
|
3
|
+
/**
|
|
4
|
+
* mdui-button 组件。默认为 variant="text"
|
|
5
|
+
*/
|
|
6
|
+
:host {
|
|
7
|
+
--shape-corner: var(--mdui-shape-corner-full);
|
|
8
|
+
position: relative;
|
|
9
|
+
display: inline-block;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
text-align: center;
|
|
12
|
+
border-radius: var(--shape-corner);
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
-webkit-tap-highlight-color: transparent;
|
|
15
|
+
transition: box-shadow var(--mdui-motion-duration-short4)
|
|
16
|
+
var(--mdui-motion-easing-linear);
|
|
17
|
+
min-width: 3rem;
|
|
18
|
+
height: 2.5rem;
|
|
19
|
+
color: rgb(var(--mdui-color-primary));
|
|
20
|
+
font-size: var(--mdui-typescale-label-large-size);
|
|
21
|
+
font-weight: var(--mdui-typescale-label-large-weight);
|
|
22
|
+
letter-spacing: var(--mdui-typescale-label-large-tracking);
|
|
23
|
+
line-height: var(--mdui-typescale-label-large-line-height);
|
|
24
|
+
}
|
|
25
|
+
.button {
|
|
26
|
+
width: 100%;
|
|
27
|
+
padding: 0rem 1rem;
|
|
28
|
+
}
|
|
29
|
+
:host([full-width]) {
|
|
30
|
+
display: block;
|
|
31
|
+
}
|
|
32
|
+
:host([variant='elevated']) {
|
|
33
|
+
box-shadow: var(--mdui-elevation-level1);
|
|
34
|
+
background-color: rgb(var(--mdui-color-surface-container-low));
|
|
35
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-primary);
|
|
36
|
+
}
|
|
37
|
+
:host([variant='filled']) {
|
|
38
|
+
color: rgb(var(--mdui-color-on-primary));
|
|
39
|
+
background-color: rgb(var(--mdui-color-primary));
|
|
40
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-primary);
|
|
41
|
+
}
|
|
42
|
+
:host([variant='tonal']) {
|
|
43
|
+
color: rgb(var(--mdui-color-on-secondary-container));
|
|
44
|
+
background-color: rgb(var(--mdui-color-secondary-container));
|
|
45
|
+
--mdui-comp-ripple-state-layer-color: var(
|
|
3
46
|
--mdui-color-on-secondary-container
|
|
4
|
-
)
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
:host([variant='outlined']) {
|
|
50
|
+
border: 0.0625rem solid rgb(var(--mdui-color-outline));
|
|
51
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-primary);
|
|
52
|
+
}
|
|
53
|
+
:host([variant='text']) {
|
|
54
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-primary);
|
|
55
|
+
}
|
|
56
|
+
:host([variant='outlined'][focus-visible]) {
|
|
57
|
+
border-color: rgb(var(--mdui-color-primary));
|
|
58
|
+
}
|
|
59
|
+
:host([variant='elevated'][hover]) {
|
|
60
|
+
box-shadow: var(--mdui-elevation-level2);
|
|
61
|
+
}
|
|
62
|
+
:host([variant='filled'][hover]),
|
|
63
|
+
:host([variant='tonal'][hover]) {
|
|
64
|
+
box-shadow: var(--mdui-elevation-level1);
|
|
65
|
+
}
|
|
66
|
+
:host([disabled]),
|
|
67
|
+
:host([loading]) {
|
|
68
|
+
cursor: default;
|
|
69
|
+
pointer-events: none;
|
|
70
|
+
}
|
|
71
|
+
:host([disabled]) {
|
|
72
|
+
color: rgba(var(--mdui-color-on-surface), 38%);
|
|
73
|
+
box-shadow: var(--mdui-elevation-level0);
|
|
74
|
+
}
|
|
75
|
+
:host([variant='elevated'][disabled]),
|
|
76
|
+
:host([variant='filled'][disabled]),
|
|
77
|
+
:host([variant='tonal'][disabled]) {
|
|
78
|
+
background-color: rgba(var(--mdui-color-on-surface), 12%);
|
|
79
|
+
}
|
|
80
|
+
:host([variant='outlined'][disabled]) {
|
|
81
|
+
border-color: rgba(var(--mdui-color-on-surface), 12%);
|
|
82
|
+
}
|
|
83
|
+
.label {
|
|
84
|
+
display: inline-flex;
|
|
85
|
+
padding-right: 0.5rem;
|
|
86
|
+
padding-left: 0.5rem;
|
|
87
|
+
}
|
|
88
|
+
.icon,
|
|
89
|
+
.end-icon {
|
|
90
|
+
display: inline-flex;
|
|
91
|
+
font-size: 1.28571429em;
|
|
92
|
+
}
|
|
93
|
+
.icon mdui-icon,
|
|
94
|
+
.end-icon mdui-icon,
|
|
95
|
+
::slotted([slot='icon']),
|
|
96
|
+
::slotted([slot='end-icon']) {
|
|
97
|
+
font-size: inherit;
|
|
98
|
+
}
|
|
99
|
+
mdui-circular-progress {
|
|
100
|
+
display: inline-flex;
|
|
101
|
+
width: 1.125rem;
|
|
102
|
+
height: 1.125rem;
|
|
103
|
+
}
|
|
104
|
+
:host([variant='filled']) mdui-circular-progress {
|
|
105
|
+
stroke: rgb(var(--mdui-color-on-primary));
|
|
106
|
+
}
|
|
107
|
+
:host([variant='tonal']) mdui-circular-progress {
|
|
108
|
+
stroke: rgb(var(--mdui-color-on-secondary-container));
|
|
109
|
+
}
|
|
110
|
+
:host([disabled]) mdui-circular-progress {
|
|
111
|
+
stroke: rgba(var(--mdui-color-on-surface), 38%);
|
|
112
|
+
}
|
|
113
|
+
`;
|
|
@@ -70,28 +70,45 @@ let ButtonIcon = class ButtonIcon extends ButtonBase {
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
render() {
|
|
73
|
-
return html `<mdui-ripple
|
|
73
|
+
return html `<mdui-ripple
|
|
74
|
+
${ref(this.rippleRef)}
|
|
75
|
+
.noRipple=${this.noRipple}
|
|
76
|
+
></mdui-ripple>
|
|
77
|
+
${this.isButton()
|
|
74
78
|
? this.renderButton({
|
|
75
79
|
className: 'button',
|
|
76
80
|
part: 'button',
|
|
77
81
|
content: this.renderIcon(),
|
|
78
82
|
})
|
|
79
83
|
: this.disabled || this.loading
|
|
80
|
-
? html `<span part="button" class="button _a"
|
|
84
|
+
? html `<span part="button" class="button _a">
|
|
85
|
+
${this.renderIcon()}
|
|
86
|
+
</span>`
|
|
81
87
|
: this.renderAnchor({
|
|
82
88
|
className: 'button',
|
|
83
89
|
part: 'button',
|
|
84
90
|
content: this.renderIcon(),
|
|
85
|
-
})}
|
|
91
|
+
})}
|
|
92
|
+
${this.renderLoading()}`;
|
|
86
93
|
}
|
|
87
94
|
renderIcon() {
|
|
88
95
|
const icon = () => this.hasSlotController.test('[default]')
|
|
89
96
|
? html `<slot></slot>`
|
|
90
97
|
: this.icon
|
|
91
|
-
? html `<mdui-icon
|
|
98
|
+
? html `<mdui-icon
|
|
99
|
+
part="icon"
|
|
100
|
+
class="icon"
|
|
101
|
+
name=${this.icon}
|
|
102
|
+
></mdui-icon>`
|
|
92
103
|
: nothingTemplate;
|
|
93
104
|
const selectedIcon = () => this.hasSlotController.test('selected-icon') || this.selectedIcon
|
|
94
|
-
? html `<slot
|
|
105
|
+
? html `<slot
|
|
106
|
+
name="selected-icon"
|
|
107
|
+
part="selected-icon"
|
|
108
|
+
class="selected-icon"
|
|
109
|
+
>
|
|
110
|
+
<mdui-icon name=${this.selectedIcon}></mdui-icon>
|
|
111
|
+
</slot>`
|
|
95
112
|
: icon();
|
|
96
113
|
return this.selected ? selectedIcon() : icon();
|
|
97
114
|
}
|
|
@@ -1,4 +1,105 @@
|
|
|
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-full);
|
|
5
|
+
position: relative;
|
|
6
|
+
display: inline-block;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
text-align: center;
|
|
9
|
+
border-radius: var(--shape-corner);
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
-webkit-tap-highlight-color: transparent;
|
|
12
|
+
font-size: 1.5rem;
|
|
13
|
+
width: 2.5rem;
|
|
14
|
+
min-width: 2.5rem;
|
|
15
|
+
height: 2.5rem;
|
|
16
|
+
}
|
|
17
|
+
:host([variant='standard']) {
|
|
18
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
19
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface-variant);
|
|
20
|
+
}
|
|
21
|
+
:host([variant='filled']) {
|
|
22
|
+
color: rgb(var(--mdui-color-primary));
|
|
23
|
+
background-color: rgb(var(--mdui-color-surface-container-highest));
|
|
24
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-primary);
|
|
25
|
+
}
|
|
26
|
+
:host([variant='tonal']) {
|
|
27
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
28
|
+
background-color: rgb(var(--mdui-color-surface-container-highest));
|
|
29
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface-variant);
|
|
30
|
+
}
|
|
31
|
+
:host([variant='outlined']) {
|
|
32
|
+
border: 0.0625rem solid rgb(var(--mdui-color-outline));
|
|
33
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
34
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface-variant);
|
|
35
|
+
}
|
|
36
|
+
:host([variant='outlined'][pressed]) {
|
|
37
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
38
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
|
|
39
|
+
}
|
|
40
|
+
:host([variant='standard'][selected]) {
|
|
41
|
+
color: rgb(var(--mdui-color-primary));
|
|
42
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-primary);
|
|
43
|
+
}
|
|
44
|
+
:host([variant='filled'][selected]),
|
|
45
|
+
:host([variant='filled']:not([selectable])) {
|
|
46
|
+
color: rgb(var(--mdui-color-on-primary));
|
|
47
|
+
background-color: rgb(var(--mdui-color-primary));
|
|
48
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-primary);
|
|
49
|
+
}
|
|
50
|
+
:host([variant='tonal'][selected]),
|
|
51
|
+
:host([variant='tonal']:not([selectable])) {
|
|
52
|
+
color: rgb(var(--mdui-color-on-secondary-container));
|
|
53
|
+
background-color: rgb(var(--mdui-color-secondary-container));
|
|
54
|
+
--mdui-comp-ripple-state-layer-color: var(
|
|
3
55
|
--mdui-color-on-secondary-container
|
|
4
|
-
)
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
:host([variant='outlined'][selected]) {
|
|
59
|
+
border: none;
|
|
60
|
+
color: rgb(var(--mdui-color-inverse-on-surface));
|
|
61
|
+
background-color: rgb(var(--mdui-color-inverse-surface));
|
|
62
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-inverse-on-surface);
|
|
63
|
+
}
|
|
64
|
+
:host([variant='filled'][disabled]),
|
|
65
|
+
:host([variant='tonal'][disabled]),
|
|
66
|
+
:host([variant='outlined'][disabled]) {
|
|
67
|
+
background-color: rgba(var(--mdui-color-on-surface), 0.12);
|
|
68
|
+
border-color: rgba(var(--mdui-color-on-surface), 0.12);
|
|
69
|
+
}
|
|
70
|
+
:host([disabled]),
|
|
71
|
+
:host([loading]) {
|
|
72
|
+
cursor: default;
|
|
73
|
+
pointer-events: none;
|
|
74
|
+
}
|
|
75
|
+
:host([disabled]) {
|
|
76
|
+
color: rgba(var(--mdui-color-on-surface), 0.38) !important;
|
|
77
|
+
}
|
|
78
|
+
:host([loading]) mdui-ripple,
|
|
79
|
+
:host([loading]) .button {
|
|
80
|
+
opacity: 0;
|
|
81
|
+
}
|
|
82
|
+
.button {
|
|
83
|
+
float: left;
|
|
84
|
+
width: 100%;
|
|
85
|
+
}
|
|
86
|
+
.icon,
|
|
87
|
+
.selected-icon mdui-icon,
|
|
88
|
+
::slotted(*) {
|
|
89
|
+
font-size: inherit;
|
|
90
|
+
}
|
|
91
|
+
mdui-circular-progress {
|
|
92
|
+
display: flex;
|
|
93
|
+
position: absolute;
|
|
94
|
+
top: calc(50% - 1.5rem / 2);
|
|
95
|
+
left: calc(50% - 1.5rem / 2);
|
|
96
|
+
width: 1.5rem;
|
|
97
|
+
height: 1.5rem;
|
|
98
|
+
}
|
|
99
|
+
:host([variant='filled']:not([disabled])) mdui-circular-progress {
|
|
100
|
+
stroke: rgb(var(--mdui-color-on-primary));
|
|
101
|
+
}
|
|
102
|
+
:host([disabled]) mdui-circular-progress {
|
|
103
|
+
stroke: rgba(var(--mdui-color-on-surface), 38%);
|
|
104
|
+
}
|
|
105
|
+
`;
|
package/components/card/index.js
CHANGED
|
@@ -59,7 +59,11 @@ let Card = class Card extends AnchorMixin(RippleMixin(FocusableMixin(MduiElement
|
|
|
59
59
|
return this.rippleDisabled;
|
|
60
60
|
}
|
|
61
61
|
render() {
|
|
62
|
-
return html `<mdui-ripple
|
|
62
|
+
return html `<mdui-ripple
|
|
63
|
+
${ref(this.rippleRef)}
|
|
64
|
+
.noRipple=${this.noRipple}
|
|
65
|
+
></mdui-ripple
|
|
66
|
+
>${this.href && !this.disabled
|
|
63
67
|
? this.renderAnchor({
|
|
64
68
|
className: 'link',
|
|
65
69
|
content: html `<slot></slot>`,
|
package/components/card/style.js
CHANGED
|
@@ -1,2 +1,73 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
2
|
+
export const style = css `
|
|
3
|
+
/**
|
|
4
|
+
* mdui-card 组件。默认为 variant="elevated"
|
|
5
|
+
*/
|
|
6
|
+
:host {
|
|
7
|
+
--shape-corner: var(--mdui-shape-corner-medium);
|
|
8
|
+
position: relative;
|
|
9
|
+
display: inline-block;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
border-radius: var(--shape-corner);
|
|
12
|
+
-webkit-tap-highlight-color: transparent;
|
|
13
|
+
transition: box-shadow var(--mdui-motion-duration-short4)
|
|
14
|
+
var(--mdui-motion-easing-linear);
|
|
15
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
|
|
16
|
+
}
|
|
17
|
+
:host([clickable]) {
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
}
|
|
20
|
+
:host([variant='elevated']) {
|
|
21
|
+
background-color: rgb(var(--mdui-color-surface-container-low));
|
|
22
|
+
box-shadow: var(--mdui-elevation-level1);
|
|
23
|
+
}
|
|
24
|
+
:host([variant='filled']) {
|
|
25
|
+
background-color: rgb(var(--mdui-color-surface-container-highest));
|
|
26
|
+
}
|
|
27
|
+
:host([variant='outlined']) {
|
|
28
|
+
background-color: rgb(var(--mdui-color-surface));
|
|
29
|
+
border: 0.0625rem solid rgb(var(--mdui-color-outline));
|
|
30
|
+
}
|
|
31
|
+
:host([variant='elevated'][hover]) {
|
|
32
|
+
box-shadow: var(--mdui-elevation-level2);
|
|
33
|
+
}
|
|
34
|
+
:host([variant='filled'][hover]),
|
|
35
|
+
:host([variant='outlined'][hover]) {
|
|
36
|
+
box-shadow: var(--mdui-elevation-level1);
|
|
37
|
+
}
|
|
38
|
+
:host([variant='elevated'][dragged]),
|
|
39
|
+
:host([variant='filled'][dragged]),
|
|
40
|
+
:host([variant='outlined'][dragged]) {
|
|
41
|
+
box-shadow: var(--mdui-elevation-level3);
|
|
42
|
+
}
|
|
43
|
+
:host([disabled]) {
|
|
44
|
+
opacity: 0.38;
|
|
45
|
+
cursor: default;
|
|
46
|
+
-webkit-user-select: none;
|
|
47
|
+
user-select: none;
|
|
48
|
+
}
|
|
49
|
+
:host([variant='elevated'][disabled]) {
|
|
50
|
+
background-color: rgb(var(--mdui-color-surface-variant));
|
|
51
|
+
box-shadow: var(--mdui-elevation-level0);
|
|
52
|
+
}
|
|
53
|
+
:host([variant='filled'][disabled]) {
|
|
54
|
+
background-color: rgb(var(--mdui-color-surface));
|
|
55
|
+
box-shadow: var(--mdui-elevation-level1);
|
|
56
|
+
}
|
|
57
|
+
:host([variant='outlined'][disabled]) {
|
|
58
|
+
box-shadow: var(--mdui-elevation-level0);
|
|
59
|
+
border-color: rgba(var(--mdui-color-outline), 0.32);
|
|
60
|
+
}
|
|
61
|
+
.link {
|
|
62
|
+
position: relative;
|
|
63
|
+
display: inline-block;
|
|
64
|
+
width: 100%;
|
|
65
|
+
height: 100%;
|
|
66
|
+
color: inherit;
|
|
67
|
+
font-size: inherit;
|
|
68
|
+
letter-spacing: inherit;
|
|
69
|
+
text-decoration: none;
|
|
70
|
+
touch-action: manipulation;
|
|
71
|
+
-webkit-user-drag: none;
|
|
72
|
+
}
|
|
73
|
+
`;
|