mdui 2.0.3 → 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.d.ts +13 -13
- package/components/avatar/index.js +11 -6
- package/components/avatar/style.js +31 -1
- package/components/badge/index.d.ts +7 -6
- package/components/badge/index.js +6 -5
- package/components/badge/style.js +25 -1
- package/components/bottom-app-bar/index.d.ts +4 -3
- package/components/bottom-app-bar/index.js +3 -3
- package/components/bottom-app-bar/style.js +92 -1
- package/components/button/button-base-style.js +28 -1
- package/components/button/button-base.d.ts +43 -44
- package/components/button/button-base.js +28 -21
- package/components/button/index.d.ts +13 -13
- package/components/button/index.js +30 -20
- package/components/button/style.js +111 -2
- package/components/button-icon/index.d.ts +8 -8
- package/components/button-icon/index.js +29 -12
- package/components/button-icon/style.js +103 -2
- package/components/card/index.d.ts +8 -8
- package/components/card/index.js +12 -8
- package/components/card/style.js +72 -1
- package/components/checkbox/index.d.ts +20 -20
- package/components/checkbox/index.js +68 -25
- package/components/checkbox/style.js +131 -1
- package/components/chip/index.d.ts +19 -19
- package/components/chip/index.js +49 -25
- package/components/chip/style.js +205 -2
- package/components/circular-progress/index.d.ts +2 -2
- package/components/circular-progress/index.js +40 -6
- package/components/circular-progress/style.js +136 -1
- package/components/collapse/collapse-item-style.js +21 -1
- package/components/collapse/collapse-item.d.ts +4 -4
- package/components/collapse/collapse-item.js +12 -4
- package/components/collapse/collapse-style.js +5 -1
- package/components/collapse/collapse.d.ts +6 -9
- package/components/collapse/collapse.js +8 -5
- package/components/dialog/index.d.ts +13 -13
- package/components/dialog/index.js +48 -20
- package/components/dialog/style.js +116 -1
- package/components/divider/index.d.ts +3 -3
- package/components/divider/index.js +3 -3
- package/components/divider/style.js +18 -1
- package/components/dropdown/index.d.ts +35 -35
- package/components/dropdown/index.js +41 -34
- package/components/dropdown/style.js +11 -1
- package/components/fab/index.d.ts +6 -6
- package/components/fab/index.js +19 -11
- 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-item.d.ts +7 -7
- package/components/layout/layout-item.js +6 -6
- package/components/layout/layout-main-style.js +7 -1
- package/components/layout/layout-main.d.ts +2 -2
- package/components/layout/layout-main.js +2 -2
- package/components/layout/layout-style.js +11 -1
- package/components/layout/layout.d.ts +2 -2
- package/components/layout/layout.js +2 -2
- package/components/linear-progress/index.d.ts +4 -4
- package/components/linear-progress/index.js +9 -5
- package/components/linear-progress/style.js +73 -1
- package/components/list/list-item-style.js +153 -2
- package/components/list/list-item.d.ts +17 -17
- package/components/list/list-item.js +34 -15
- package/components/list/list-style.js +10 -1
- package/components/list/list-subheader-style.js +19 -1
- package/components/list/list-subheader.d.ts +2 -2
- package/components/list/list-subheader.js +2 -2
- package/components/list/list.d.ts +1 -1
- package/components/list/list.js +1 -1
- package/components/menu/menu-item-style.js +125 -1
- package/components/menu/menu-item.d.ts +4 -4
- package/components/menu/menu-item.js +57 -15
- package/components/menu/menu-style.js +19 -1
- package/components/menu/menu.d.ts +15 -18
- package/components/menu/menu.js +13 -9
- package/components/navigation-bar/navigation-bar-item-style.js +132 -1
- package/components/navigation-bar/navigation-bar-item.d.ts +5 -5
- package/components/navigation-bar/navigation-bar-item.js +27 -11
- package/components/navigation-bar/navigation-bar-style.js +28 -1
- package/components/navigation-bar/navigation-bar.d.ts +9 -8
- package/components/navigation-bar/navigation-bar.js +10 -7
- package/components/navigation-drawer/index.d.ts +19 -20
- package/components/navigation-drawer/index.js +56 -31
- 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.d.ts +6 -6
- package/components/navigation-rail/navigation-rail-item.js +30 -11
- package/components/navigation-rail/navigation-rail-style.js +79 -1
- package/components/navigation-rail/navigation-rail.d.ts +10 -11
- package/components/navigation-rail/navigation-rail.js +19 -11
- package/components/radio/radio-group-style.js +20 -1
- package/components/radio/radio-group.d.ts +13 -13
- package/components/radio/radio-group.js +30 -12
- package/components/radio/radio-style.js +107 -1
- package/components/radio/radio.d.ts +3 -3
- package/components/radio/radio.js +26 -8
- package/components/range-slider/index.d.ts +5 -6
- package/components/range-slider/index.js +57 -10
- 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.d.ts +17 -20
- package/components/segmented-button/segmented-button-group.js +32 -15
- package/components/segmented-button/segmented-button-style.js +81 -2
- package/components/segmented-button/segmented-button.d.ts +3 -3
- package/components/segmented-button/segmented-button.js +30 -14
- package/components/select/index.d.ts +31 -32
- package/components/select/index.js +106 -26
- package/components/select/style.js +27 -1
- package/components/slider/index.d.ts +1 -1
- package/components/slider/index.js +34 -3
- package/components/slider/slider-base-style.js +173 -1
- package/components/slider/slider-base.d.ts +15 -15
- package/components/slider/slider-base.js +19 -14
- package/components/slider/style.js +7 -1
- package/components/snackbar/index.d.ts +21 -21
- package/components/snackbar/index.js +47 -20
- package/components/snackbar/style.js +100 -1
- package/components/switch/index.d.ts +14 -14
- package/components/switch/index.js +51 -17
- package/components/switch/style.js +202 -1
- package/components/tabs/tab-panel-style.js +10 -1
- package/components/tabs/tab-panel.d.ts +3 -3
- package/components/tabs/tab-panel.js +2 -2
- package/components/tabs/tab-style.js +85 -1
- package/components/tabs/tab.d.ts +6 -6
- package/components/tabs/tab.js +29 -9
- package/components/tabs/tabs-style.js +138 -1
- package/components/tabs/tabs.d.ts +19 -19
- package/components/tabs/tabs.js +26 -18
- package/components/text-field/index.d.ts +51 -51
- package/components/text-field/index.js +185 -57
- package/components/text-field/style.js +362 -1
- package/components/tooltip/index.d.ts +31 -31
- package/components/tooltip/index.js +38 -29
- 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.d.ts +4 -4
- package/components/top-app-bar/top-app-bar-title.js +21 -7
- package/components/top-app-bar/top-app-bar.d.ts +5 -5
- package/components/top-app-bar/top-app-bar.js +4 -4
- package/css-data.en.json +2826 -0
- package/css-data.zh-cn.json +374 -367
- package/custom-elements.json +2049 -2049
- package/html-data.en.json +6560 -0
- package/html-data.zh-cn.json +1427 -1433
- package/jsx.en.d.ts +3303 -0
- package/jsx.zh-cn.d.ts +3351 -0
- package/package.json +6 -5
- package/web-types.en.json +11734 -0
- package/web-types.zh-cn.json +3227 -3221
- package/mdui.esm.js +0 -22
- package/mdui.global.js +0 -22
|
@@ -30,72 +30,72 @@ import { style } from './style.js';
|
|
|
30
30
|
* </mdui-dropdown>
|
|
31
31
|
* ```
|
|
32
32
|
*
|
|
33
|
-
* @event open -
|
|
34
|
-
* @event opened -
|
|
35
|
-
* @event close -
|
|
36
|
-
* @event closed -
|
|
33
|
+
* @event open - 下拉组件开始打开时,事件被触发。可以通过调用 `event.preventDefault()` 阻止下拉组件打开
|
|
34
|
+
* @event opened - 下拉组件打开动画完成时,事件被触发
|
|
35
|
+
* @event close - 下拉组件开始关闭时,事件被触发。可以通过调用 `event.preventDefault()` 阻止下拉组件关闭
|
|
36
|
+
* @event closed - 下拉组件关闭动画完成时,事件被触发
|
|
37
37
|
*
|
|
38
|
-
* @slot -
|
|
39
|
-
* @slot trigger -
|
|
38
|
+
* @slot - 下拉组件的内容
|
|
39
|
+
* @slot trigger - 触发下拉组件的元素,例如 [`<mdui-button>`](/docs/2/components/button) 元素
|
|
40
40
|
*
|
|
41
|
-
* @csspart trigger -
|
|
42
|
-
* @csspart panel -
|
|
41
|
+
* @csspart trigger - 触发下拉组件的元素的容器,即 `trigger` slot 的容器
|
|
42
|
+
* @csspart panel - 下拉组件内容的容器
|
|
43
43
|
*
|
|
44
|
-
* @cssprop --z-index - 组件的 CSS
|
|
44
|
+
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
45
45
|
*/
|
|
46
46
|
let Dropdown = class Dropdown extends MduiElement {
|
|
47
47
|
constructor() {
|
|
48
48
|
super();
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* 是否打开下拉组件
|
|
51
51
|
*/
|
|
52
52
|
this.open = false;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* 是否禁用下拉组件
|
|
55
55
|
*/
|
|
56
56
|
this.disabled = false;
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* 下拉组件的触发方式,支持多个值,用空格分隔。可选值包括:
|
|
59
59
|
*
|
|
60
|
-
* * `click
|
|
60
|
+
* * `click`:点击触发
|
|
61
61
|
* * `hover`:鼠标悬浮触发
|
|
62
|
-
* * `focus
|
|
63
|
-
* * `contextmenu
|
|
64
|
-
* * `manual
|
|
62
|
+
* * `focus`:聚焦触发
|
|
63
|
+
* * `contextmenu`:鼠标右键点击、或触摸长按触发
|
|
64
|
+
* * `manual`:仅能通过编程方式打开和关闭下拉组件,不能再指定其他触发方式
|
|
65
65
|
*/
|
|
66
66
|
this.trigger = 'click';
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* 下拉组件内容的位置。可选值包括:
|
|
69
69
|
*
|
|
70
70
|
* * `auto`:自动判断位置
|
|
71
|
-
* * `top-start
|
|
72
|
-
* * `top
|
|
73
|
-
* * `top-end
|
|
74
|
-
* * `bottom-start
|
|
75
|
-
* * `bottom
|
|
76
|
-
* * `bottom-end
|
|
77
|
-
* * `left-start
|
|
78
|
-
* * `left
|
|
79
|
-
* * `left-end
|
|
80
|
-
* * `right-start
|
|
81
|
-
* * `right
|
|
82
|
-
* * `right-end
|
|
71
|
+
* * `top-start`:上方左对齐
|
|
72
|
+
* * `top`:上方居中
|
|
73
|
+
* * `top-end`:上方右对齐
|
|
74
|
+
* * `bottom-start`:下方左对齐
|
|
75
|
+
* * `bottom`:下方居中
|
|
76
|
+
* * `bottom-end`:下方右对齐
|
|
77
|
+
* * `left-start`:左侧顶部对齐
|
|
78
|
+
* * `left`:左侧居中
|
|
79
|
+
* * `left-end`:左侧底部对齐
|
|
80
|
+
* * `right-start`:右侧顶部对齐
|
|
81
|
+
* * `right`:右侧居中
|
|
82
|
+
* * `right-end`:右侧底部对齐
|
|
83
83
|
*/
|
|
84
84
|
this.placement = 'auto';
|
|
85
85
|
/**
|
|
86
|
-
*
|
|
86
|
+
* 点击 [`<mdui-menu-item>`](/docs/2/components/menu#menu-item-api) 后,下拉组件是否保持打开状态
|
|
87
87
|
*/
|
|
88
88
|
this.stayOpenOnClick = false;
|
|
89
89
|
/**
|
|
90
|
-
*
|
|
90
|
+
* 鼠标悬浮触发下拉组件打开的延时,单位为毫秒
|
|
91
91
|
*/
|
|
92
92
|
this.openDelay = 150;
|
|
93
93
|
/**
|
|
94
|
-
*
|
|
94
|
+
* 鼠标悬浮触发下拉组件关闭的延时,单位为毫秒
|
|
95
95
|
*/
|
|
96
96
|
this.closeDelay = 150;
|
|
97
97
|
/**
|
|
98
|
-
*
|
|
98
|
+
* 是否在触发下拉组件的光标位置打开下拉组件,常用于打开鼠标右键菜单
|
|
99
99
|
*/
|
|
100
100
|
this.openOnPointer = false;
|
|
101
101
|
this.panelRef = createRef();
|
|
@@ -234,7 +234,14 @@ let Dropdown = class Dropdown extends MduiElement {
|
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
236
|
render() {
|
|
237
|
-
return html `<slot name="trigger" part="trigger" class="trigger"></slot
|
|
237
|
+
return html `<slot name="trigger" part="trigger" class="trigger"></slot>
|
|
238
|
+
<slot
|
|
239
|
+
${ref(this.panelRef)}
|
|
240
|
+
part="panel"
|
|
241
|
+
class="panel"
|
|
242
|
+
hidden
|
|
243
|
+
@click=${this.onPanelClick}
|
|
244
|
+
></slot>`;
|
|
238
245
|
}
|
|
239
246
|
/**
|
|
240
247
|
* 获取 dropdown 打开、关闭动画的 CSS scaleX 或 scaleY
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
2
|
+
export const style = css `
|
|
3
|
+
:host {
|
|
4
|
+
--z-index: 2100;
|
|
5
|
+
display: contents;
|
|
6
|
+
}
|
|
7
|
+
.panel {
|
|
8
|
+
display: block;
|
|
9
|
+
position: fixed;
|
|
10
|
+
z-index: var(--z-index);
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
@@ -16,19 +16,19 @@ import type { TemplateResult, CSSResultGroup } from 'lit';
|
|
|
16
16
|
* @slot - 文本
|
|
17
17
|
* @slot icon - 图标
|
|
18
18
|
*
|
|
19
|
-
* @csspart button - 内部的
|
|
19
|
+
* @csspart button - 内部的 `<button>` 或 `<a>` 元素
|
|
20
20
|
* @csspart label - 右侧的文本
|
|
21
21
|
* @csspart icon - 左侧的图标
|
|
22
22
|
* @csspart loading - 加载中状态的 `<mdui-circular-progress>` 元素
|
|
23
23
|
*
|
|
24
|
-
* @cssprop --shape-corner-small - `size="small"`
|
|
25
|
-
* @cssprop --shape-corner-normal - `size="normal"`
|
|
26
|
-
* @cssprop --shape-corner-large - `size="large"`
|
|
24
|
+
* @cssprop --shape-corner-small - `size="small"` 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
25
|
+
* @cssprop --shape-corner-normal - `size="normal"` 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
26
|
+
* @cssprop --shape-corner-large - `size="large"` 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
27
27
|
*/
|
|
28
28
|
export declare class Fab extends ButtonBase<FabEventMap> {
|
|
29
29
|
static styles: CSSResultGroup;
|
|
30
30
|
/**
|
|
31
|
-
* FAB
|
|
31
|
+
* FAB 的形状,此组件的不同形状之间只有颜色不一样。可选值包括:
|
|
32
32
|
*
|
|
33
33
|
* * `primary`:使用 Primary container 背景色
|
|
34
34
|
* * `surface`:使用 Surface container high 背景色
|
|
@@ -37,7 +37,7 @@ export declare class Fab extends ButtonBase<FabEventMap> {
|
|
|
37
37
|
*/
|
|
38
38
|
variant: /*使用 Primary container 背景色*/ 'primary' | /*使用 Surface container high 背景色*/ 'surface' | /*使用 Secondary container 背景色*/ 'secondary' | /*使用 Tertiary container 背景色*/ 'tertiary';
|
|
39
39
|
/**
|
|
40
|
-
* FAB
|
|
40
|
+
* FAB 的大小。可选值包括:
|
|
41
41
|
* * `normal`:普通大小 FAB
|
|
42
42
|
* * `small`:小型 FAB
|
|
43
43
|
* * `large`:大型 FAB
|
package/components/fab/index.js
CHANGED
|
@@ -26,20 +26,20 @@ import { style } from './style.js';
|
|
|
26
26
|
* @slot - 文本
|
|
27
27
|
* @slot icon - 图标
|
|
28
28
|
*
|
|
29
|
-
* @csspart button - 内部的
|
|
29
|
+
* @csspart button - 内部的 `<button>` 或 `<a>` 元素
|
|
30
30
|
* @csspart label - 右侧的文本
|
|
31
31
|
* @csspart icon - 左侧的图标
|
|
32
32
|
* @csspart loading - 加载中状态的 `<mdui-circular-progress>` 元素
|
|
33
33
|
*
|
|
34
|
-
* @cssprop --shape-corner-small - `size="small"`
|
|
35
|
-
* @cssprop --shape-corner-normal - `size="normal"`
|
|
36
|
-
* @cssprop --shape-corner-large - `size="large"`
|
|
34
|
+
* @cssprop --shape-corner-small - `size="small"` 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
35
|
+
* @cssprop --shape-corner-normal - `size="normal"` 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
36
|
+
* @cssprop --shape-corner-large - `size="large"` 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
37
37
|
*/
|
|
38
38
|
let Fab = class Fab extends ButtonBase {
|
|
39
39
|
constructor() {
|
|
40
40
|
super(...arguments);
|
|
41
41
|
/**
|
|
42
|
-
* FAB
|
|
42
|
+
* FAB 的形状,此组件的不同形状之间只有颜色不一样。可选值包括:
|
|
43
43
|
*
|
|
44
44
|
* * `primary`:使用 Primary container 背景色
|
|
45
45
|
* * `surface`:使用 Surface container high 背景色
|
|
@@ -48,7 +48,7 @@ let Fab = class Fab extends ButtonBase {
|
|
|
48
48
|
*/
|
|
49
49
|
this.variant = 'primary';
|
|
50
50
|
/**
|
|
51
|
-
* FAB
|
|
51
|
+
* FAB 的大小。可选值包括:
|
|
52
52
|
* * `normal`:普通大小 FAB
|
|
53
53
|
* * `small`:小型 FAB
|
|
54
54
|
* * `large`:大型 FAB
|
|
@@ -94,14 +94,20 @@ let Fab = class Fab extends ButtonBase {
|
|
|
94
94
|
button: true,
|
|
95
95
|
'has-icon': this.icon || this.hasSlotController.test('icon'),
|
|
96
96
|
});
|
|
97
|
-
return html `<mdui-ripple
|
|
97
|
+
return html `<mdui-ripple
|
|
98
|
+
${ref(this.rippleRef)}
|
|
99
|
+
.noRipple=${this.noRipple}
|
|
100
|
+
></mdui-ripple>
|
|
101
|
+
${this.isButton()
|
|
98
102
|
? this.renderButton({
|
|
99
103
|
className,
|
|
100
104
|
part: 'button',
|
|
101
105
|
content: this.renderInner(),
|
|
102
106
|
})
|
|
103
107
|
: this.disabled || this.loading
|
|
104
|
-
? html `<span part="button" class="_a ${className}"
|
|
108
|
+
? html `<span part="button" class="_a ${className}">
|
|
109
|
+
${this.renderInner()}
|
|
110
|
+
</span>`
|
|
105
111
|
: this.renderAnchor({
|
|
106
112
|
className,
|
|
107
113
|
part: 'button',
|
|
@@ -115,9 +121,11 @@ let Fab = class Fab extends ButtonBase {
|
|
|
115
121
|
if (this.loading) {
|
|
116
122
|
return this.renderLoading();
|
|
117
123
|
}
|
|
118
|
-
return html `<slot name="icon" part="icon" class="icon"
|
|
119
|
-
|
|
120
|
-
|
|
124
|
+
return html `<slot name="icon" part="icon" class="icon">
|
|
125
|
+
${this.icon
|
|
126
|
+
? html `<mdui-icon name=${this.icon}></mdui-icon>`
|
|
127
|
+
: nothingTemplate}
|
|
128
|
+
</slot>`;
|
|
121
129
|
}
|
|
122
130
|
renderInner() {
|
|
123
131
|
return [this.renderIcon(), this.renderLabel()];
|
package/components/fab/style.js
CHANGED
|
@@ -1,8 +1,157 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
2
|
+
export const style = css `
|
|
3
|
+
/**
|
|
4
|
+
* mdui-fab 组件。默认为 variant="primary" size="normal"
|
|
5
|
+
*/
|
|
6
|
+
:host {
|
|
7
|
+
--shape-corner-small: var(--mdui-shape-corner-small);
|
|
8
|
+
--shape-corner-normal: var(--mdui-shape-corner-large);
|
|
9
|
+
--shape-corner-large: var(--mdui-shape-corner-extra-large);
|
|
10
|
+
position: relative;
|
|
11
|
+
display: inline-block;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
text-align: center;
|
|
14
|
+
border-radius: var(--shape-corner-normal);
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
-webkit-tap-highlight-color: transparent;
|
|
17
|
+
transition-property: box-shadow;
|
|
18
|
+
transition-timing-function: var(--mdui-motion-easing-emphasized);
|
|
19
|
+
transition-duration: var(--mdui-motion-duration-medium4);
|
|
20
|
+
width: 3.5rem;
|
|
21
|
+
height: 3.5rem;
|
|
22
|
+
box-shadow: var(--mdui-elevation-level3);
|
|
23
|
+
font-size: var(--mdui-typescale-label-large-size);
|
|
24
|
+
font-weight: var(--mdui-typescale-label-large-weight);
|
|
25
|
+
letter-spacing: var(--mdui-typescale-label-large-tracking);
|
|
26
|
+
line-height: var(--mdui-typescale-label-large-line-height);
|
|
27
|
+
}
|
|
28
|
+
.button {
|
|
29
|
+
padding: 0rem 1rem;
|
|
30
|
+
}
|
|
31
|
+
:host([size='small']) .button {
|
|
32
|
+
padding: 0rem 0.5rem;
|
|
33
|
+
}
|
|
34
|
+
:host([size='large']) .button {
|
|
35
|
+
padding: 0rem 1.875rem;
|
|
36
|
+
}
|
|
37
|
+
:host([lowered]) {
|
|
38
|
+
box-shadow: var(--mdui-elevation-level1);
|
|
39
|
+
}
|
|
40
|
+
:host([focus-visible]) {
|
|
41
|
+
box-shadow: var(--mdui-elevation-level3);
|
|
42
|
+
}
|
|
43
|
+
:host([lowered][focus-visible]) {
|
|
44
|
+
box-shadow: var(--mdui-elevation-level1);
|
|
45
|
+
}
|
|
46
|
+
:host([pressed]) {
|
|
47
|
+
box-shadow: var(--mdui-elevation-level3);
|
|
48
|
+
}
|
|
49
|
+
:host([lowered][pressed]) {
|
|
50
|
+
box-shadow: var(--mdui-elevation-level1);
|
|
51
|
+
}
|
|
52
|
+
:host([hover]) {
|
|
53
|
+
box-shadow: var(--mdui-elevation-level4);
|
|
54
|
+
}
|
|
55
|
+
:host([lowered][hover]) {
|
|
56
|
+
box-shadow: var(--mdui-elevation-level2);
|
|
57
|
+
}
|
|
58
|
+
:host([variant='primary']) {
|
|
59
|
+
color: rgb(var(--mdui-color-on-primary-container));
|
|
60
|
+
background-color: rgb(var(--mdui-color-primary-container));
|
|
61
|
+
--mdui-comp-ripple-state-layer-color: var(
|
|
3
62
|
--mdui-color-on-primary-container
|
|
4
|
-
)
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
:host([variant='surface']) {
|
|
66
|
+
color: rgb(var(--mdui-color-primary));
|
|
67
|
+
background-color: rgb(var(--mdui-color-surface-container-high));
|
|
68
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-primary);
|
|
69
|
+
}
|
|
70
|
+
:host([variant='surface'][lowered]) {
|
|
71
|
+
background-color: rgb(var(--mdui-color-surface-container-low));
|
|
72
|
+
}
|
|
73
|
+
:host([variant='secondary']) {
|
|
74
|
+
color: rgb(var(--mdui-color-on-secondary-container));
|
|
75
|
+
background-color: rgb(var(--mdui-color-secondary-container));
|
|
76
|
+
--mdui-comp-ripple-state-layer-color: var(
|
|
5
77
|
--mdui-color-on-secondary-container
|
|
6
|
-
)
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
:host([variant='tertiary']) {
|
|
81
|
+
color: rgb(var(--mdui-color-on-tertiary-container));
|
|
82
|
+
background-color: rgb(var(--mdui-color-tertiary-container));
|
|
83
|
+
--mdui-comp-ripple-state-layer-color: var(
|
|
7
84
|
--mdui-color-on-tertiary-container
|
|
8
|
-
)
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
:host([size='small']) {
|
|
88
|
+
border-radius: var(--shape-corner-small);
|
|
89
|
+
width: 2.5rem;
|
|
90
|
+
height: 2.5rem;
|
|
91
|
+
}
|
|
92
|
+
:host([size='large']) {
|
|
93
|
+
border-radius: var(--shape-corner-large);
|
|
94
|
+
width: 6rem;
|
|
95
|
+
height: 6rem;
|
|
96
|
+
}
|
|
97
|
+
:host([disabled]),
|
|
98
|
+
:host([loading]) {
|
|
99
|
+
cursor: default;
|
|
100
|
+
pointer-events: none;
|
|
101
|
+
}
|
|
102
|
+
:host([disabled]) {
|
|
103
|
+
color: rgba(var(--mdui-color-on-surface), 38%);
|
|
104
|
+
background-color: rgba(var(--mdui-color-on-surface), 12%);
|
|
105
|
+
box-shadow: var(--mdui-elevation-level0);
|
|
106
|
+
}
|
|
107
|
+
:host([extended]) {
|
|
108
|
+
width: auto;
|
|
109
|
+
}
|
|
110
|
+
.label {
|
|
111
|
+
display: inline-flex;
|
|
112
|
+
transition: opacity var(--mdui-motion-duration-short2)
|
|
113
|
+
var(--mdui-motion-easing-linear) var(--mdui-motion-duration-short2);
|
|
114
|
+
padding-left: 0.25rem;
|
|
115
|
+
padding-right: 0.25rem;
|
|
116
|
+
}
|
|
117
|
+
.has-icon .label {
|
|
118
|
+
margin-left: 0.5rem;
|
|
119
|
+
}
|
|
120
|
+
:host([size='small']) .has-icon .label {
|
|
121
|
+
margin-left: 0.25rem;
|
|
122
|
+
}
|
|
123
|
+
:host([size='large']) .has-icon .label {
|
|
124
|
+
margin-left: 1rem;
|
|
125
|
+
}
|
|
126
|
+
:host(:not([extended])) .label {
|
|
127
|
+
opacity: 0;
|
|
128
|
+
transition-delay: 0ms;
|
|
129
|
+
transition-duration: var(--mdui-motion-duration-short1);
|
|
130
|
+
}
|
|
131
|
+
:host([size='large']) .label {
|
|
132
|
+
font-size: 1.5em;
|
|
133
|
+
}
|
|
134
|
+
.icon {
|
|
135
|
+
display: inline-flex;
|
|
136
|
+
font-size: 1.71428571em;
|
|
137
|
+
}
|
|
138
|
+
:host([size='large']) .icon {
|
|
139
|
+
font-size: 2.57142857em;
|
|
140
|
+
}
|
|
141
|
+
.icon mdui-icon,
|
|
142
|
+
::slotted([slot='icon']) {
|
|
143
|
+
font-size: inherit;
|
|
144
|
+
}
|
|
145
|
+
mdui-circular-progress {
|
|
146
|
+
display: inline-flex;
|
|
147
|
+
width: 1.5rem;
|
|
148
|
+
height: 1.5rem;
|
|
149
|
+
}
|
|
150
|
+
:host([size='large']) mdui-circular-progress {
|
|
151
|
+
width: 2.25rem;
|
|
152
|
+
height: 2.25rem;
|
|
153
|
+
}
|
|
154
|
+
:host([disabled]) mdui-circular-progress {
|
|
155
|
+
stroke: rgba(var(--mdui-color-on-surface), 38%);
|
|
156
|
+
}
|
|
157
|
+
`;
|
package/components/icon/index.js
CHANGED
|
@@ -34,7 +34,11 @@ let Icon = class Icon extends MduiElement {
|
|
|
34
34
|
['sharp', 'Material Icons Sharp'],
|
|
35
35
|
['two-tone', 'Material Icons Two Tone'],
|
|
36
36
|
]);
|
|
37
|
-
return html `<span
|
|
37
|
+
return html `<span
|
|
38
|
+
style=${styleMap({ fontFamily: familyMap.get(variant) })}
|
|
39
|
+
>
|
|
40
|
+
${name}
|
|
41
|
+
</span>`;
|
|
38
42
|
}
|
|
39
43
|
if (this.src) {
|
|
40
44
|
return html `${until(ajax({ url: this.src }).then(unsafeSVG))}`;
|
package/components/icon/style.js
CHANGED
|
@@ -1,2 +1,30 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
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
|
+
`;
|
|
@@ -12,19 +12,19 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
12
12
|
* </mdui-layout>
|
|
13
13
|
* ```
|
|
14
14
|
*
|
|
15
|
-
* @slot -
|
|
15
|
+
* @slot - 可以包含任意内容
|
|
16
16
|
*/
|
|
17
17
|
export declare class LayoutItem extends LayoutItemBase<LayoutItemEventMap> {
|
|
18
18
|
static styles: CSSResultGroup;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* 组件的位置。可选值包括:
|
|
21
21
|
*
|
|
22
|
-
* * `top
|
|
23
|
-
* * `bottom
|
|
24
|
-
* * `left
|
|
25
|
-
* * `right
|
|
22
|
+
* * `top`:上方
|
|
23
|
+
* * `bottom`:下方
|
|
24
|
+
* * `left`:左侧
|
|
25
|
+
* * `right`:右侧
|
|
26
26
|
*/
|
|
27
|
-
placement:
|
|
27
|
+
placement: /*上方*/ 'top' | /*下方*/ 'bottom' | /*左侧*/ 'left' | /*右侧*/ 'right';
|
|
28
28
|
protected get layoutPlacement(): LayoutPlacement;
|
|
29
29
|
private onPlacementChange;
|
|
30
30
|
protected render(): TemplateResult;
|
|
@@ -16,18 +16,18 @@ import { layoutItemStyle } from './layout-item-style.js';
|
|
|
16
16
|
* </mdui-layout>
|
|
17
17
|
* ```
|
|
18
18
|
*
|
|
19
|
-
* @slot -
|
|
19
|
+
* @slot - 可以包含任意内容
|
|
20
20
|
*/
|
|
21
21
|
let LayoutItem = class LayoutItem extends LayoutItemBase {
|
|
22
22
|
constructor() {
|
|
23
23
|
super(...arguments);
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* 组件的位置。可选值包括:
|
|
26
26
|
*
|
|
27
|
-
* * `top
|
|
28
|
-
* * `bottom
|
|
29
|
-
* * `left
|
|
30
|
-
* * `right
|
|
27
|
+
* * `top`:上方
|
|
28
|
+
* * `bottom`:下方
|
|
29
|
+
* * `left`:左侧
|
|
30
|
+
* * `right`:右侧
|
|
31
31
|
*/
|
|
32
32
|
this.placement = 'top';
|
|
33
33
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
2
|
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
3
3
|
/**
|
|
4
|
-
* @summary
|
|
4
|
+
* @summary 布局主体内容组件
|
|
5
5
|
*
|
|
6
6
|
* ```html
|
|
7
7
|
* <mdui-layout>
|
|
@@ -11,7 +11,7 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
11
11
|
* </mdui-layout>
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
14
|
-
* @slot -
|
|
14
|
+
* @slot - 可以包含任意内容
|
|
15
15
|
*/
|
|
16
16
|
export declare class LayoutMain extends MduiElement<LayoutMainEventMap> {
|
|
17
17
|
static styles: CSSResultGroup;
|
|
@@ -7,7 +7,7 @@ import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
|
7
7
|
import { getLayout } from './helper.js';
|
|
8
8
|
import { layoutMainStyle } from './layout-main-style.js';
|
|
9
9
|
/**
|
|
10
|
-
* @summary
|
|
10
|
+
* @summary 布局主体内容组件
|
|
11
11
|
*
|
|
12
12
|
* ```html
|
|
13
13
|
* <mdui-layout>
|
|
@@ -17,7 +17,7 @@ import { layoutMainStyle } from './layout-main-style.js';
|
|
|
17
17
|
* </mdui-layout>
|
|
18
18
|
* ```
|
|
19
19
|
*
|
|
20
|
-
* @slot -
|
|
20
|
+
* @slot - 可以包含任意内容
|
|
21
21
|
*/
|
|
22
22
|
let LayoutMain = class LayoutMain extends MduiElement {
|
|
23
23
|
connectedCallback() {
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const layoutStyle = css
|
|
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
|
+
`;
|
|
@@ -11,12 +11,12 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
11
11
|
* </mdui-layout>
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
14
|
-
* @slot -
|
|
14
|
+
* @slot - 可以包含 [`<mdui-top-app-bar>`](/docs/2/components/top-app-bar)、[`<mdui-bottom-app-bar>`](/docs/2/components/bottom-app-bar)、[`<mdui-navigation-bar>`](/docs/2/components/navigation-bar)、[`<mdui-navigation-drawer>`](/docs/2/components/navigation-drawer)、[`<mdui-navigation-rail>`](/docs/2/components/navigation-rail)、`<mdui-layout-item>`、`<mdui-layout-main>` 元素
|
|
15
15
|
*/
|
|
16
16
|
export declare class Layout extends MduiElement<LayoutEventMap> {
|
|
17
17
|
static styles: CSSResultGroup;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* 设置当前布局的高度为 100%
|
|
20
20
|
*/
|
|
21
21
|
fullHeight: boolean;
|
|
22
22
|
protected render(): TemplateResult;
|
|
@@ -16,13 +16,13 @@ import { layoutStyle } from './layout-style.js';
|
|
|
16
16
|
* </mdui-layout>
|
|
17
17
|
* ```
|
|
18
18
|
*
|
|
19
|
-
* @slot -
|
|
19
|
+
* @slot - 可以包含 [`<mdui-top-app-bar>`](/docs/2/components/top-app-bar)、[`<mdui-bottom-app-bar>`](/docs/2/components/bottom-app-bar)、[`<mdui-navigation-bar>`](/docs/2/components/navigation-bar)、[`<mdui-navigation-drawer>`](/docs/2/components/navigation-drawer)、[`<mdui-navigation-rail>`](/docs/2/components/navigation-rail)、`<mdui-layout-item>`、`<mdui-layout-main>` 元素
|
|
20
20
|
*/
|
|
21
21
|
let Layout = class Layout extends MduiElement {
|
|
22
22
|
constructor() {
|
|
23
23
|
super(...arguments);
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* 设置当前布局的高度为 100%
|
|
26
26
|
*/
|
|
27
27
|
this.fullHeight = false;
|
|
28
28
|
}
|
|
@@ -7,18 +7,18 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
7
7
|
* <mdui-linear-progress></mdui-linear-progress>
|
|
8
8
|
* ```
|
|
9
9
|
*
|
|
10
|
-
* @csspart indicator -
|
|
10
|
+
* @csspart indicator - 指示器部分
|
|
11
11
|
*
|
|
12
|
-
* @cssprop --shape-corner -
|
|
12
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
13
13
|
*/
|
|
14
14
|
export declare class LinearProgress extends MduiElement<LinearProgressEventMap> {
|
|
15
15
|
static styles: CSSResultGroup;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* 进度指示器的最大值。默认为 `1`
|
|
18
18
|
*/
|
|
19
19
|
max: number;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* 进度指示器的当前值。如果未指定该值,则处于不确定状态
|
|
22
22
|
*/
|
|
23
23
|
value?: number;
|
|
24
24
|
protected render(): TemplateResult;
|