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,133 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const navigationBarItemStyle = css
|
|
2
|
+
export const navigationBarItemStyle = css `
|
|
3
|
+
:host {
|
|
4
|
+
--shape-corner-indicator: var(--mdui-shape-corner-full);
|
|
5
|
+
position: relative;
|
|
6
|
+
z-index: 0;
|
|
7
|
+
flex: 1;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
min-width: 3rem;
|
|
10
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface-variant);
|
|
11
|
+
}
|
|
12
|
+
.container {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
height: 100%;
|
|
18
|
+
text-decoration: none;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
-webkit-user-select: none;
|
|
21
|
+
user-select: none;
|
|
22
|
+
-webkit-tap-highlight-color: transparent;
|
|
23
|
+
padding-top: 0.75rem;
|
|
24
|
+
padding-bottom: 0.75rem;
|
|
25
|
+
}
|
|
26
|
+
.container:not(.initial) {
|
|
27
|
+
transition: padding var(--mdui-motion-duration-short4)
|
|
28
|
+
var(--mdui-motion-easing-standard);
|
|
29
|
+
}
|
|
30
|
+
mdui-ripple {
|
|
31
|
+
z-index: 1;
|
|
32
|
+
left: 50%;
|
|
33
|
+
transform: translateX(-50%);
|
|
34
|
+
width: 4rem;
|
|
35
|
+
height: 2rem;
|
|
36
|
+
margin-top: 0.75rem;
|
|
37
|
+
border-radius: var(--mdui-shape-corner-full);
|
|
38
|
+
}
|
|
39
|
+
mdui-ripple:not(.initial) {
|
|
40
|
+
transition: margin-top var(--mdui-motion-duration-short4)
|
|
41
|
+
var(--mdui-motion-easing-standard);
|
|
42
|
+
}
|
|
43
|
+
.indicator {
|
|
44
|
+
position: relative;
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
background-color: transparent;
|
|
49
|
+
border-radius: var(--shape-corner-indicator);
|
|
50
|
+
height: 2rem;
|
|
51
|
+
width: 2rem;
|
|
52
|
+
}
|
|
53
|
+
:not(.initial) .indicator {
|
|
54
|
+
transition:
|
|
55
|
+
background-color var(--mdui-motion-duration-short1)
|
|
56
|
+
var(--mdui-motion-easing-standard),
|
|
57
|
+
width var(--mdui-motion-duration-short4)
|
|
58
|
+
var(--mdui-motion-easing-standard);
|
|
59
|
+
}
|
|
60
|
+
::slotted([slot='badge']) {
|
|
61
|
+
position: absolute;
|
|
62
|
+
transform: translate(50%, -50%);
|
|
63
|
+
}
|
|
64
|
+
::slotted([slot='badge'][variant='small']) {
|
|
65
|
+
transform: translate(0.5625rem, -0.5625rem);
|
|
66
|
+
}
|
|
67
|
+
.icon,
|
|
68
|
+
.active-icon {
|
|
69
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
70
|
+
font-size: 1.5rem;
|
|
71
|
+
}
|
|
72
|
+
.icon mdui-icon,
|
|
73
|
+
.active-icon mdui-icon,
|
|
74
|
+
::slotted([slot='icon']),
|
|
75
|
+
::slotted([slot='active']) {
|
|
76
|
+
font-size: inherit;
|
|
77
|
+
}
|
|
78
|
+
.icon {
|
|
79
|
+
display: flex;
|
|
80
|
+
}
|
|
81
|
+
.active-icon {
|
|
82
|
+
display: none;
|
|
83
|
+
}
|
|
84
|
+
.label {
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
height: 1rem;
|
|
88
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
89
|
+
margin-top: 0.25rem;
|
|
90
|
+
margin-bottom: 0.25rem;
|
|
91
|
+
font-size: var(--mdui-typescale-label-medium-size);
|
|
92
|
+
font-weight: var(--mdui-typescale-label-medium-weight);
|
|
93
|
+
letter-spacing: var(--mdui-typescale-label-medium-tracking);
|
|
94
|
+
line-height: var(--mdui-typescale-label-medium-line-height);
|
|
95
|
+
}
|
|
96
|
+
:not(.initial) .label {
|
|
97
|
+
transition: opacity var(--mdui-motion-duration-short4)
|
|
98
|
+
var(--mdui-motion-easing-linear);
|
|
99
|
+
}
|
|
100
|
+
mdui-ripple.label-visibility-unlabeled,
|
|
101
|
+
:host(:not([active])) mdui-ripple.label-visibility-selected {
|
|
102
|
+
margin-top: 1.5rem;
|
|
103
|
+
}
|
|
104
|
+
.container.label-visibility-unlabeled,
|
|
105
|
+
:host(:not([active])) .container.label-visibility-selected {
|
|
106
|
+
padding-top: 1.5rem;
|
|
107
|
+
padding-bottom: 0rem;
|
|
108
|
+
}
|
|
109
|
+
.container.label-visibility-unlabeled .label,
|
|
110
|
+
:host(:not([active])) .container.label-visibility-selected .label {
|
|
111
|
+
opacity: 0;
|
|
112
|
+
}
|
|
113
|
+
:host([active]) {
|
|
114
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
|
|
115
|
+
}
|
|
116
|
+
:host([active]) .indicator {
|
|
117
|
+
width: 4rem;
|
|
118
|
+
background-color: rgb(var(--mdui-color-secondary-container));
|
|
119
|
+
}
|
|
120
|
+
:host([active]) .icon,
|
|
121
|
+
:host([active]) .active-icon {
|
|
122
|
+
color: rgb(var(--mdui-color-on-secondary-container));
|
|
123
|
+
}
|
|
124
|
+
:host([active]) .has-active-icon .active-icon {
|
|
125
|
+
display: flex;
|
|
126
|
+
}
|
|
127
|
+
:host([active]) .has-active-icon .icon {
|
|
128
|
+
display: none;
|
|
129
|
+
}
|
|
130
|
+
:host([active]) .label {
|
|
131
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
132
|
+
}
|
|
133
|
+
`;
|
|
@@ -86,20 +86,36 @@ let NavigationBarItem = class NavigationBarItem extends AnchorMixin(RippleMixin(
|
|
|
86
86
|
},
|
|
87
87
|
labelVisibilityClassName,
|
|
88
88
|
]);
|
|
89
|
-
return html `<mdui-ripple
|
|
89
|
+
return html `<mdui-ripple
|
|
90
|
+
.noRipple=${!this.active || this.noRipple}
|
|
91
|
+
class=${labelVisibilityClassName}
|
|
92
|
+
${ref(this.rippleRef)}
|
|
93
|
+
></mdui-ripple>
|
|
94
|
+
${this.href
|
|
90
95
|
? this.renderAnchor({
|
|
91
96
|
part: 'container',
|
|
92
97
|
className,
|
|
93
98
|
content: this.renderInner(),
|
|
94
99
|
})
|
|
95
|
-
: html `<div part="container" class
|
|
100
|
+
: html `<div part="container" class=${className}>
|
|
101
|
+
${this.renderInner()}
|
|
102
|
+
</div>`} `;
|
|
96
103
|
}
|
|
97
104
|
renderInner() {
|
|
98
|
-
return html `<div part="indicator" class="indicator"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
return html `<div part="indicator" class="indicator">
|
|
106
|
+
<slot name="badge" part="badge" class="badge"></slot>
|
|
107
|
+
<slot name="active-icon" part="active-icon" class="active-icon">
|
|
108
|
+
${this.activeIcon
|
|
109
|
+
? html `<mdui-icon name=${this.activeIcon}></mdui-icon>`
|
|
110
|
+
: nothingTemplate}
|
|
111
|
+
</slot>
|
|
112
|
+
<slot name="icon" part="icon" class="icon">
|
|
113
|
+
${this.icon
|
|
114
|
+
? html `<mdui-icon name=${this.icon}></mdui-icon>`
|
|
115
|
+
: nothingTemplate}
|
|
116
|
+
</slot>
|
|
117
|
+
</div>
|
|
118
|
+
<slot part="label" class="label"></slot>`;
|
|
103
119
|
}
|
|
104
120
|
};
|
|
105
121
|
NavigationBarItem.styles = [
|
|
@@ -1,2 +1,29 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const navigationBarStyle = css
|
|
2
|
+
export const navigationBarStyle = 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
|
+
overflow: hidden;
|
|
13
|
+
border-radius: var(--shape-corner) var(--shape-corner) 0 0;
|
|
14
|
+
z-index: var(--z-index);
|
|
15
|
+
transition-property: transform;
|
|
16
|
+
transition-duration: var(--mdui-motion-duration-long2);
|
|
17
|
+
transition-timing-function: var(--mdui-motion-easing-emphasized);
|
|
18
|
+
height: 5rem;
|
|
19
|
+
background-color: rgb(var(--mdui-color-surface));
|
|
20
|
+
box-shadow: var(--mdui-elevation-level2);
|
|
21
|
+
}
|
|
22
|
+
:host([scroll-target]:not([scroll-target=''])) {
|
|
23
|
+
position: absolute;
|
|
24
|
+
}
|
|
25
|
+
:host([hide]) {
|
|
26
|
+
transform: translateY(5.625rem);
|
|
27
|
+
transition-duration: var(--mdui-motion-duration-short4);
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
@@ -89,7 +89,10 @@ let NavigationBar = class NavigationBar extends ScrollBehaviorMixin(LayoutItemBa
|
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
render() {
|
|
92
|
-
return html `<slot
|
|
92
|
+
return html `<slot
|
|
93
|
+
@slotchange=${this.onSlotChange}
|
|
94
|
+
@click=${this.onClick}
|
|
95
|
+
></slot>`;
|
|
93
96
|
}
|
|
94
97
|
/**
|
|
95
98
|
* 滚动行为
|
|
@@ -310,7 +310,18 @@ let NavigationDrawer = class NavigationDrawer extends LayoutItemBase {
|
|
|
310
310
|
});
|
|
311
311
|
}
|
|
312
312
|
render() {
|
|
313
|
-
return html `${when(this.isModal, () => html `<div
|
|
313
|
+
return html `${when(this.isModal, () => html `<div
|
|
314
|
+
${ref(this.overlayRef)}
|
|
315
|
+
part="overlay"
|
|
316
|
+
class="overlay"
|
|
317
|
+
@click=${this.onOverlayClick}
|
|
318
|
+
></div>`)}
|
|
319
|
+
<slot
|
|
320
|
+
${ref(this.panelRef)}
|
|
321
|
+
part="panel"
|
|
322
|
+
class="panel"
|
|
323
|
+
tabindex="0"
|
|
324
|
+
></slot>`;
|
|
314
325
|
}
|
|
315
326
|
onOverlayClick() {
|
|
316
327
|
this.emit('overlay-click');
|
|
@@ -1,2 +1,67 @@
|
|
|
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-large);
|
|
5
|
+
--z-index: 2200;
|
|
6
|
+
display: none;
|
|
7
|
+
position: fixed;
|
|
8
|
+
top: 0;
|
|
9
|
+
bottom: 0;
|
|
10
|
+
left: 0;
|
|
11
|
+
z-index: 1;
|
|
12
|
+
width: 22.5rem;
|
|
13
|
+
}
|
|
14
|
+
:host([placement='right']) {
|
|
15
|
+
left: initial;
|
|
16
|
+
right: 0;
|
|
17
|
+
}
|
|
18
|
+
:host([modal]),
|
|
19
|
+
:host([mobile]) {
|
|
20
|
+
top: 0 !important;
|
|
21
|
+
right: 0;
|
|
22
|
+
bottom: 0 !important;
|
|
23
|
+
width: initial;
|
|
24
|
+
z-index: var(--z-index);
|
|
25
|
+
}
|
|
26
|
+
:host([placement='right'][modal]),
|
|
27
|
+
:host([placement='right'][mobile]) {
|
|
28
|
+
left: 0;
|
|
29
|
+
}
|
|
30
|
+
:host([contained]) {
|
|
31
|
+
position: absolute;
|
|
32
|
+
}
|
|
33
|
+
.overlay {
|
|
34
|
+
position: absolute;
|
|
35
|
+
inset: 0;
|
|
36
|
+
z-index: inherit;
|
|
37
|
+
background-color: rgba(var(--mdui-color-scrim), 0.4);
|
|
38
|
+
}
|
|
39
|
+
.panel {
|
|
40
|
+
display: block;
|
|
41
|
+
position: absolute;
|
|
42
|
+
top: 0;
|
|
43
|
+
bottom: 0;
|
|
44
|
+
left: 0;
|
|
45
|
+
width: 100%;
|
|
46
|
+
overflow: auto;
|
|
47
|
+
z-index: inherit;
|
|
48
|
+
background-color: rgb(var(--mdui-color-surface));
|
|
49
|
+
box-shadow: var(--mdui-elevation-level0);
|
|
50
|
+
}
|
|
51
|
+
:host([modal]) .panel,
|
|
52
|
+
:host([mobile]) .panel {
|
|
53
|
+
border-radius: 0 var(--shape-corner) var(--shape-corner) 0;
|
|
54
|
+
max-width: 80%;
|
|
55
|
+
width: 22.5rem;
|
|
56
|
+
background-color: rgb(var(--mdui-color-surface-container-low));
|
|
57
|
+
box-shadow: var(--mdui-elevation-level1);
|
|
58
|
+
}
|
|
59
|
+
:host([placement='right']) .panel {
|
|
60
|
+
left: initial;
|
|
61
|
+
right: 0;
|
|
62
|
+
}
|
|
63
|
+
:host([placement='right'][modal]) .panel,
|
|
64
|
+
:host([placement='right'][mobile]) .panel {
|
|
65
|
+
border-radius: var(--shape-corner) 0 0 var(--shape-corner);
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
@@ -1,2 +1,123 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const navigationRailItemStyle = css
|
|
2
|
+
export const navigationRailItemStyle = css `
|
|
3
|
+
:host {
|
|
4
|
+
--shape-corner-indicator: var(--mdui-shape-corner-full);
|
|
5
|
+
position: relative;
|
|
6
|
+
z-index: 0;
|
|
7
|
+
width: 100%;
|
|
8
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface-variant);
|
|
9
|
+
}
|
|
10
|
+
.container {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
text-decoration: none;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
-webkit-user-select: none;
|
|
18
|
+
user-select: none;
|
|
19
|
+
-webkit-tap-highlight-color: transparent;
|
|
20
|
+
height: 3.5rem;
|
|
21
|
+
}
|
|
22
|
+
.container:not(.initial) {
|
|
23
|
+
transition: padding var(--mdui-motion-duration-short4)
|
|
24
|
+
var(--mdui-motion-easing-standard);
|
|
25
|
+
}
|
|
26
|
+
mdui-ripple {
|
|
27
|
+
z-index: 1;
|
|
28
|
+
width: 3.5rem;
|
|
29
|
+
height: 2rem;
|
|
30
|
+
border-radius: var(--mdui-shape-corner-full);
|
|
31
|
+
}
|
|
32
|
+
.container:not(.has-label) + mdui-ripple {
|
|
33
|
+
height: 3.5rem;
|
|
34
|
+
}
|
|
35
|
+
.indicator {
|
|
36
|
+
position: relative;
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
background-color: transparent;
|
|
41
|
+
border-radius: var(--shape-corner-indicator);
|
|
42
|
+
height: 2rem;
|
|
43
|
+
width: 2rem;
|
|
44
|
+
}
|
|
45
|
+
:not(.initial) .indicator {
|
|
46
|
+
transition:
|
|
47
|
+
background-color var(--mdui-motion-duration-short1)
|
|
48
|
+
var(--mdui-motion-easing-standard),
|
|
49
|
+
width var(--mdui-motion-duration-short4)
|
|
50
|
+
var(--mdui-motion-easing-standard),
|
|
51
|
+
height var(--mdui-motion-duration-short4)
|
|
52
|
+
var(--mdui-motion-easing-standard);
|
|
53
|
+
}
|
|
54
|
+
::slotted([slot='badge']) {
|
|
55
|
+
position: absolute;
|
|
56
|
+
transform: translate(50%, -50%);
|
|
57
|
+
}
|
|
58
|
+
.placement-right::slotted([slot='badge']) {
|
|
59
|
+
transform: translate(-50%, -50%);
|
|
60
|
+
}
|
|
61
|
+
::slotted([slot='badge'][variant='small']) {
|
|
62
|
+
transform: translate(0.5625rem, -0.5625rem);
|
|
63
|
+
}
|
|
64
|
+
.placement-right::slotted([slot='badge'][variant='small']) {
|
|
65
|
+
transform: translate(-0.5625rem, -0.5625rem);
|
|
66
|
+
}
|
|
67
|
+
.icon,
|
|
68
|
+
.active-icon {
|
|
69
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
70
|
+
font-size: 1.5rem;
|
|
71
|
+
}
|
|
72
|
+
.icon mdui-icon,
|
|
73
|
+
.active-icon mdui-icon,
|
|
74
|
+
::slotted([slot='icon']),
|
|
75
|
+
::slotted([slot='active-icon']) {
|
|
76
|
+
font-size: inherit;
|
|
77
|
+
}
|
|
78
|
+
.icon {
|
|
79
|
+
display: flex;
|
|
80
|
+
}
|
|
81
|
+
.active-icon {
|
|
82
|
+
display: none;
|
|
83
|
+
}
|
|
84
|
+
.label {
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
height: 1rem;
|
|
88
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
89
|
+
margin-top: 0.25rem;
|
|
90
|
+
margin-bottom: 0.25rem;
|
|
91
|
+
font-size: var(--mdui-typescale-label-medium-size);
|
|
92
|
+
font-weight: var(--mdui-typescale-label-medium-weight);
|
|
93
|
+
letter-spacing: var(--mdui-typescale-label-medium-tracking);
|
|
94
|
+
line-height: var(--mdui-typescale-label-medium-line-height);
|
|
95
|
+
}
|
|
96
|
+
:not(.initial) .label {
|
|
97
|
+
transition: opacity var(--mdui-motion-duration-short4)
|
|
98
|
+
var(--mdui-motion-easing-linear);
|
|
99
|
+
}
|
|
100
|
+
:host([active]) {
|
|
101
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
|
|
102
|
+
}
|
|
103
|
+
:host([active]) .indicator {
|
|
104
|
+
width: 3.5rem;
|
|
105
|
+
background-color: rgb(var(--mdui-color-secondary-container));
|
|
106
|
+
}
|
|
107
|
+
:host([active]) :not(.has-label) .indicator {
|
|
108
|
+
height: 3.5rem;
|
|
109
|
+
}
|
|
110
|
+
:host([active]) .icon,
|
|
111
|
+
:host([active]) .active-icon {
|
|
112
|
+
color: rgb(var(--mdui-color-on-secondary-container));
|
|
113
|
+
}
|
|
114
|
+
:host([active]) .has-active-icon .active-icon {
|
|
115
|
+
display: flex;
|
|
116
|
+
}
|
|
117
|
+
:host([active]) .has-active-icon .icon {
|
|
118
|
+
display: none;
|
|
119
|
+
}
|
|
120
|
+
:host([active]) .label {
|
|
121
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
122
|
+
}
|
|
123
|
+
`;
|
|
@@ -91,17 +91,36 @@ let NavigationRailItem = class NavigationRailItem extends AnchorMixin(RippleMixi
|
|
|
91
91
|
className,
|
|
92
92
|
content: this.renderInner(hasDefaultSlot),
|
|
93
93
|
})
|
|
94
|
-
: html `<div part="container" class
|
|
94
|
+
: html `<div part="container" class=${className}>
|
|
95
|
+
${this.renderInner(hasDefaultSlot)}
|
|
96
|
+
</div>`}
|
|
97
|
+
<mdui-ripple
|
|
98
|
+
.noRipple=${!this.active || this.noRipple}
|
|
99
|
+
${ref(this.rippleRef)}
|
|
100
|
+
></mdui-ripple>`;
|
|
95
101
|
}
|
|
96
102
|
renderInner(hasDefaultSlot) {
|
|
97
|
-
return html `<div part="indicator" class="indicator"
|
|
103
|
+
return html `<div part="indicator" class="indicator">
|
|
104
|
+
<slot
|
|
105
|
+
name="badge"
|
|
106
|
+
part="badge"
|
|
107
|
+
class=${classMap({
|
|
98
108
|
badge: true,
|
|
99
109
|
'placement-right': this.placement === 'right',
|
|
100
|
-
})}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
110
|
+
})}
|
|
111
|
+
></slot>
|
|
112
|
+
<slot name="active-icon" part="active-icon" class="active-icon">
|
|
113
|
+
${this.activeIcon
|
|
114
|
+
? html `<mdui-icon name=${this.activeIcon}></mdui-icon>`
|
|
115
|
+
: nothingTemplate}
|
|
116
|
+
</slot>
|
|
117
|
+
<slot name="icon" part="icon" class="icon">
|
|
118
|
+
${this.icon
|
|
119
|
+
? html `<mdui-icon name=${this.icon}></mdui-icon>`
|
|
120
|
+
: nothingTemplate}
|
|
121
|
+
</slot>
|
|
122
|
+
</div>
|
|
123
|
+
${hasDefaultSlot
|
|
105
124
|
? html `<slot part="label" class="label"></slot>`
|
|
106
125
|
: nothing}`;
|
|
107
126
|
}
|
|
@@ -1,2 +1,80 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const navigationRailStyle = css
|
|
2
|
+
export const navigationRailStyle = css `
|
|
3
|
+
:host {
|
|
4
|
+
--shape-corner: var(--mdui-shape-corner-none);
|
|
5
|
+
--z-index: 2000;
|
|
6
|
+
position: fixed;
|
|
7
|
+
top: 0;
|
|
8
|
+
bottom: 0;
|
|
9
|
+
left: 0;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
align-items: center;
|
|
13
|
+
border-radius: 0 var(--shape-corner) var(--shape-corner) 0;
|
|
14
|
+
z-index: var(--z-index);
|
|
15
|
+
width: 5rem;
|
|
16
|
+
background-color: rgb(var(--mdui-color-surface));
|
|
17
|
+
padding: 0.375rem 0.75rem;
|
|
18
|
+
}
|
|
19
|
+
:host([contained]) {
|
|
20
|
+
position: absolute;
|
|
21
|
+
}
|
|
22
|
+
:host([divider]) {
|
|
23
|
+
border-right: 0.0625rem solid rgb(var(--mdui-color-surface-variant));
|
|
24
|
+
width: 5.0625rem;
|
|
25
|
+
}
|
|
26
|
+
:host([placement='right']) {
|
|
27
|
+
left: initial;
|
|
28
|
+
right: 0;
|
|
29
|
+
border-radius: var(--shape-corner) 0 0 var(--shape-corner);
|
|
30
|
+
}
|
|
31
|
+
:host([placement='right'][divider]) {
|
|
32
|
+
border-right: none;
|
|
33
|
+
border-left: 0.0625rem solid rgb(var(--mdui-color-surface-variant));
|
|
34
|
+
}
|
|
35
|
+
.top,
|
|
36
|
+
.items,
|
|
37
|
+
.bottom {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
align-items: center;
|
|
41
|
+
width: 100%;
|
|
42
|
+
}
|
|
43
|
+
.top {
|
|
44
|
+
margin-bottom: 1.75rem;
|
|
45
|
+
}
|
|
46
|
+
.bottom {
|
|
47
|
+
margin-top: 1.75rem;
|
|
48
|
+
}
|
|
49
|
+
::slotted(mdui-navigation-rail-item),
|
|
50
|
+
::slotted([slot='top']),
|
|
51
|
+
::slotted([slot='bottom']) {
|
|
52
|
+
margin-top: 0.375rem;
|
|
53
|
+
margin-bottom: 0.375rem;
|
|
54
|
+
}
|
|
55
|
+
:host([alignment='start']) .top-spacer {
|
|
56
|
+
flex-grow: 0;
|
|
57
|
+
}
|
|
58
|
+
:host([alignment='start']) .bottom-spacer {
|
|
59
|
+
flex-grow: 1;
|
|
60
|
+
}
|
|
61
|
+
:host([alignment='end']) .top-spacer {
|
|
62
|
+
flex-grow: 1;
|
|
63
|
+
}
|
|
64
|
+
:host([alignment='end']) .bottom-spacer {
|
|
65
|
+
flex-grow: 0;
|
|
66
|
+
}
|
|
67
|
+
:host([alignment='center']) {
|
|
68
|
+
justify-content: center;
|
|
69
|
+
}
|
|
70
|
+
:host([alignment='center']) .top,
|
|
71
|
+
:host([alignment='center']) .bottom {
|
|
72
|
+
position: absolute;
|
|
73
|
+
}
|
|
74
|
+
:host([alignment='center']) .top {
|
|
75
|
+
top: 0.375rem;
|
|
76
|
+
}
|
|
77
|
+
:host([alignment='center']) .bottom {
|
|
78
|
+
bottom: 0.375rem;
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
@@ -155,7 +155,16 @@ let NavigationRail = class NavigationRail extends LayoutItemBase {
|
|
|
155
155
|
render() {
|
|
156
156
|
const hasTopSlot = this.hasSlotController.test('top');
|
|
157
157
|
const hasBottomSlot = this.hasSlotController.test('bottom');
|
|
158
|
-
return html `${when(hasTopSlot, () => html `<slot name="top" part="top" class="top"></slot>`)}
|
|
158
|
+
return html `${when(hasTopSlot, () => html `<slot name="top" part="top" class="top"></slot>`)}
|
|
159
|
+
<span class="top-spacer"></span>
|
|
160
|
+
<slot
|
|
161
|
+
part="items"
|
|
162
|
+
class="items"
|
|
163
|
+
@slotchange=${this.onSlotChange}
|
|
164
|
+
@click=${this.onClick}
|
|
165
|
+
></slot>
|
|
166
|
+
<span class="bottom-spacer"></span>
|
|
167
|
+
${when(hasBottomSlot, () => html `<slot name="bottom" part="bottom" class="bottom"></slot>`)}`;
|
|
159
168
|
}
|
|
160
169
|
onClick(event) {
|
|
161
170
|
// event.button 为 0 时,为鼠标左键点击。忽略鼠标中键和右键
|
|
@@ -1,2 +1,21 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const radioGroupStyle = css
|
|
2
|
+
export const radioGroupStyle = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: inline-block;
|
|
5
|
+
}
|
|
6
|
+
fieldset {
|
|
7
|
+
border: none;
|
|
8
|
+
padding: 0;
|
|
9
|
+
margin: 0;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
}
|
|
12
|
+
input {
|
|
13
|
+
position: absolute;
|
|
14
|
+
padding: 0;
|
|
15
|
+
opacity: 0;
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
width: 1.25rem;
|
|
18
|
+
height: 1.25rem;
|
|
19
|
+
margin: 0rem 0rem 0rem 0.625rem;
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
@@ -154,7 +154,25 @@ let RadioGroup = class RadioGroup extends MduiElement {
|
|
|
154
154
|
this.invalid = !this.inputRef.value.checkValidity();
|
|
155
155
|
}
|
|
156
156
|
render() {
|
|
157
|
-
return html `<fieldset
|
|
157
|
+
return html `<fieldset>
|
|
158
|
+
<input
|
|
159
|
+
${ref(this.inputRef)}
|
|
160
|
+
type="radio"
|
|
161
|
+
class="input"
|
|
162
|
+
name=${ifDefined(this.name)}
|
|
163
|
+
value=${ifDefined(this.value)}
|
|
164
|
+
.checked=${!!this.value}
|
|
165
|
+
.required=${this.required}
|
|
166
|
+
tabindex="-1"
|
|
167
|
+
@keydown=${this.onKeyDown}
|
|
168
|
+
/>
|
|
169
|
+
<slot
|
|
170
|
+
@click=${this.onClick}
|
|
171
|
+
@keydown=${this.onKeyDown}
|
|
172
|
+
@slotchange=${this.onSlotChange}
|
|
173
|
+
@change=${this.onCheckedChange}
|
|
174
|
+
></slot>
|
|
175
|
+
</fieldset>`;
|
|
158
176
|
}
|
|
159
177
|
// 更新 mdui-radio 的 checked 后,需要更新可聚焦状态
|
|
160
178
|
// 同一个 mdui-radio-group 中的多个 mdui-radio,仅有一个可聚焦
|