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
|
@@ -1,2 +1,101 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
2
|
+
export const style = css `
|
|
3
|
+
:host {
|
|
4
|
+
--shape-corner: var(--mdui-shape-corner-extra-small);
|
|
5
|
+
--z-index: 2400;
|
|
6
|
+
position: fixed;
|
|
7
|
+
z-index: var(--z-index);
|
|
8
|
+
display: none;
|
|
9
|
+
align-items: center;
|
|
10
|
+
flex-wrap: wrap;
|
|
11
|
+
border-radius: var(--shape-corner);
|
|
12
|
+
min-width: 20rem;
|
|
13
|
+
max-width: 36rem;
|
|
14
|
+
padding: 0.25rem 0rem;
|
|
15
|
+
box-shadow: var(--mdui-elevation-level3);
|
|
16
|
+
background-color: rgb(var(--mdui-color-inverse-surface));
|
|
17
|
+
color: rgb(var(--mdui-color-inverse-on-surface));
|
|
18
|
+
font-size: var(--mdui-typescale-body-medium-size);
|
|
19
|
+
font-weight: var(--mdui-typescale-body-medium-weight);
|
|
20
|
+
letter-spacing: var(--mdui-typescale-body-medium-tracking);
|
|
21
|
+
line-height: var(--mdui-typescale-body-medium-line-height);
|
|
22
|
+
}
|
|
23
|
+
:host([placement^='top']) {
|
|
24
|
+
transform-origin: top;
|
|
25
|
+
top: 1rem;
|
|
26
|
+
}
|
|
27
|
+
:host([placement^='bottom']) {
|
|
28
|
+
transform-origin: bottom;
|
|
29
|
+
bottom: 1rem;
|
|
30
|
+
}
|
|
31
|
+
:host([placement='top-start']),
|
|
32
|
+
:host([placement='bottom-start']) {
|
|
33
|
+
left: 1rem;
|
|
34
|
+
}
|
|
35
|
+
:host([placement='top-end']),
|
|
36
|
+
:host([placement='bottom-end']) {
|
|
37
|
+
right: 1rem;
|
|
38
|
+
}
|
|
39
|
+
.message {
|
|
40
|
+
display: block;
|
|
41
|
+
margin: 0.625rem 1rem;
|
|
42
|
+
}
|
|
43
|
+
:host([message-line='1']) .message {
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
white-space: nowrap;
|
|
46
|
+
text-overflow: ellipsis;
|
|
47
|
+
}
|
|
48
|
+
:host([message-line='2']) .message {
|
|
49
|
+
display: -webkit-box;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
text-overflow: ellipsis;
|
|
52
|
+
-webkit-box-orient: vertical;
|
|
53
|
+
-webkit-line-clamp: 2;
|
|
54
|
+
}
|
|
55
|
+
.action-group {
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
margin-left: auto;
|
|
59
|
+
padding-right: 0.5rem;
|
|
60
|
+
}
|
|
61
|
+
.action,
|
|
62
|
+
.close-button {
|
|
63
|
+
display: inline-flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
}
|
|
67
|
+
.action {
|
|
68
|
+
color: rgb(var(--mdui-color-inverse-primary));
|
|
69
|
+
font-size: var(--mdui-typescale-label-large-size);
|
|
70
|
+
font-weight: var(--mdui-typescale-label-large-weight);
|
|
71
|
+
letter-spacing: var(--mdui-typescale-label-large-tracking);
|
|
72
|
+
}
|
|
73
|
+
.action mdui-button,
|
|
74
|
+
::slotted(mdui-button[slot='action'][variant='text']),
|
|
75
|
+
::slotted(mdui-button[slot='action'][variant='outlined']) {
|
|
76
|
+
color: inherit;
|
|
77
|
+
font-size: inherit;
|
|
78
|
+
font-weight: inherit;
|
|
79
|
+
letter-spacing: inherit;
|
|
80
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-inverse-primary);
|
|
81
|
+
}
|
|
82
|
+
.action mdui-button::part(button) {
|
|
83
|
+
padding: 0rem 0.5rem;
|
|
84
|
+
}
|
|
85
|
+
.close-button {
|
|
86
|
+
margin: 0rem -0.25rem 0rem 0.25rem;
|
|
87
|
+
font-size: 1.5rem;
|
|
88
|
+
color: rgb(var(--mdui-color-inverse-on-surface));
|
|
89
|
+
}
|
|
90
|
+
.close-button mdui-button-icon,
|
|
91
|
+
::slotted(mdui-button-icon[slot='close-button'][variant='standard']),
|
|
92
|
+
::slotted(mdui-button-icon[slot='close-button'][variant='outlined']) {
|
|
93
|
+
font-size: inherit;
|
|
94
|
+
color: inherit;
|
|
95
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-inverse-on-surface);
|
|
96
|
+
}
|
|
97
|
+
.close-button .i,
|
|
98
|
+
::slotted([slot='close-icon']) {
|
|
99
|
+
font-size: inherit;
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
@@ -26,8 +26,8 @@ declare const Switch_base: import("@open-wc/dedupe-mixin").Constructor<import(".
|
|
|
26
26
|
* @csspart unchecked-icon - 未选中状态的图标
|
|
27
27
|
* @csspart checked-icon 选中状态的图标
|
|
28
28
|
*
|
|
29
|
-
* @cssprop --shape-corner -
|
|
30
|
-
* @cssprop --shape-corner-thumb -
|
|
29
|
+
* @cssprop --shape-corner - 组件轨道的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
30
|
+
* @cssprop --shape-corner-thumb - 组件图标容器的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
31
31
|
*/
|
|
32
32
|
export declare class Switch extends Switch_base<SwitchEventMap> implements FormControl {
|
|
33
33
|
static styles: CSSResultGroup;
|
|
@@ -40,7 +40,7 @@ export declare class Switch extends Switch_base<SwitchEventMap> implements FormC
|
|
|
40
40
|
*/
|
|
41
41
|
checked: boolean;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* 默认选中状态。在重置表单时,将重置为此状态。此属性只能通过 JavaScript 属性设置
|
|
44
44
|
*/
|
|
45
45
|
defaultChecked: boolean;
|
|
46
46
|
/**
|
|
@@ -50,17 +50,17 @@ export declare class Switch extends Switch_base<SwitchEventMap> implements FormC
|
|
|
50
50
|
/**
|
|
51
51
|
* 选中状态的 Material Icons 图标名。也可以通过 `slot="checked-icon"` 设置
|
|
52
52
|
*
|
|
53
|
-
* 默认为 check 图标,可传入空字符串移除默认图标
|
|
53
|
+
* 默认为 `check` 图标,可传入空字符串移除默认图标
|
|
54
54
|
*/
|
|
55
55
|
checkedIcon?: string;
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* 提交表单时,是否必须选中此开关
|
|
58
58
|
*/
|
|
59
59
|
required: boolean;
|
|
60
60
|
/**
|
|
61
|
-
* 关联的
|
|
61
|
+
* 关联的 `<form>` 元素。此属性值应为同一页面中的一个 `<form>` 元素的 `id`。
|
|
62
62
|
*
|
|
63
|
-
*
|
|
63
|
+
* 如果未指定此属性,则该元素必须是 `<form>` 元素的子元素。通过此属性,你可以将元素放置在页面的任何位置,而不仅仅是 `<form>` 元素的子元素。
|
|
64
64
|
*/
|
|
65
65
|
form?: string;
|
|
66
66
|
/**
|
|
@@ -80,11 +80,11 @@ export declare class Switch extends Switch_base<SwitchEventMap> implements FormC
|
|
|
80
80
|
private readonly formController;
|
|
81
81
|
private readonly hasSlotController;
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* 表单验证状态对象,具体参见 [`ValidityState`](https://developer.mozilla.org/zh-CN/docs/Web/API/ValidityState)
|
|
84
84
|
*/
|
|
85
85
|
get validity(): ValidityState;
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
87
|
+
* 如果表单验证未通过,此属性将包含提示信息。如果验证通过,此属性将为空字符串
|
|
88
88
|
*/
|
|
89
89
|
get validationMessage(): string;
|
|
90
90
|
protected get rippleElement(): Ripple;
|
|
@@ -94,19 +94,19 @@ export declare class Switch extends Switch_base<SwitchEventMap> implements FormC
|
|
|
94
94
|
private onDisabledChange;
|
|
95
95
|
private onCheckedChange;
|
|
96
96
|
/**
|
|
97
|
-
*
|
|
97
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`
|
|
98
98
|
*/
|
|
99
99
|
checkValidity(): boolean;
|
|
100
100
|
/**
|
|
101
|
-
*
|
|
101
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`。
|
|
102
102
|
*
|
|
103
|
-
*
|
|
103
|
+
* 如果验证未通过,还会在组件上显示验证失败的提示。
|
|
104
104
|
*/
|
|
105
105
|
reportValidity(): boolean;
|
|
106
106
|
/**
|
|
107
|
-
*
|
|
107
|
+
* 设置自定义的错误提示文本。只要这个文本不为空,就表示字段未通过验证
|
|
108
108
|
*
|
|
109
|
-
* @param message
|
|
109
|
+
* @param message 自定义的错误提示文本
|
|
110
110
|
*/
|
|
111
111
|
setCustomValidity(message: string): void;
|
|
112
112
|
protected render(): TemplateResult;
|
|
@@ -39,8 +39,8 @@ import { style } from './style.js';
|
|
|
39
39
|
* @csspart unchecked-icon - 未选中状态的图标
|
|
40
40
|
* @csspart checked-icon 选中状态的图标
|
|
41
41
|
*
|
|
42
|
-
* @cssprop --shape-corner -
|
|
43
|
-
* @cssprop --shape-corner-thumb -
|
|
42
|
+
* @cssprop --shape-corner - 组件轨道的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
43
|
+
* @cssprop --shape-corner-thumb - 组件图标容器的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
44
44
|
*/
|
|
45
45
|
let Switch = class Switch extends RippleMixin(FocusableMixin(MduiElement)) {
|
|
46
46
|
constructor() {
|
|
@@ -54,11 +54,11 @@ let Switch = class Switch extends RippleMixin(FocusableMixin(MduiElement)) {
|
|
|
54
54
|
*/
|
|
55
55
|
this.checked = false;
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* 默认选中状态。在重置表单时,将重置为此状态。此属性只能通过 JavaScript 属性设置
|
|
58
58
|
*/
|
|
59
59
|
this.defaultChecked = false;
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
61
|
+
* 提交表单时,是否必须选中此开关
|
|
62
62
|
*/
|
|
63
63
|
this.required = false;
|
|
64
64
|
/**
|
|
@@ -83,13 +83,13 @@ let Switch = class Switch extends RippleMixin(FocusableMixin(MduiElement)) {
|
|
|
83
83
|
this.hasSlotController = new HasSlotController(this, 'unchecked-icon');
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
|
-
*
|
|
86
|
+
* 表单验证状态对象,具体参见 [`ValidityState`](https://developer.mozilla.org/zh-CN/docs/Web/API/ValidityState)
|
|
87
87
|
*/
|
|
88
88
|
get validity() {
|
|
89
89
|
return this.inputRef.value.validity;
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
|
-
*
|
|
92
|
+
* 如果表单验证未通过,此属性将包含提示信息。如果验证通过,此属性将为空字符串
|
|
93
93
|
*/
|
|
94
94
|
get validationMessage() {
|
|
95
95
|
return this.inputRef.value.validationMessage;
|
|
@@ -123,7 +123,7 @@ let Switch = class Switch extends RippleMixin(FocusableMixin(MduiElement)) {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
|
-
*
|
|
126
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`
|
|
127
127
|
*/
|
|
128
128
|
checkValidity() {
|
|
129
129
|
const valid = this.inputRef.value.checkValidity();
|
|
@@ -137,9 +137,9 @@ let Switch = class Switch extends RippleMixin(FocusableMixin(MduiElement)) {
|
|
|
137
137
|
return valid;
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
|
-
*
|
|
140
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`。
|
|
141
141
|
*
|
|
142
|
-
*
|
|
142
|
+
* 如果验证未通过,还会在组件上显示验证失败的提示。
|
|
143
143
|
*/
|
|
144
144
|
reportValidity() {
|
|
145
145
|
this.invalid = !this.inputRef.value.reportValidity();
|
|
@@ -158,25 +158,59 @@ let Switch = class Switch extends RippleMixin(FocusableMixin(MduiElement)) {
|
|
|
158
158
|
return !this.invalid;
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
|
-
*
|
|
161
|
+
* 设置自定义的错误提示文本。只要这个文本不为空,就表示字段未通过验证
|
|
162
162
|
*
|
|
163
|
-
* @param message
|
|
163
|
+
* @param message 自定义的错误提示文本
|
|
164
164
|
*/
|
|
165
165
|
setCustomValidity(message) {
|
|
166
166
|
this.inputRef.value.setCustomValidity(message);
|
|
167
167
|
this.invalid = !this.inputRef.value.checkValidity();
|
|
168
168
|
}
|
|
169
169
|
render() {
|
|
170
|
-
return html `<label
|
|
170
|
+
return html `<label
|
|
171
|
+
class=${classMap({
|
|
171
172
|
invalid: this.invalid,
|
|
172
173
|
'has-unchecked-icon': this.uncheckedIcon || this.hasSlotController.test('unchecked-icon'),
|
|
173
|
-
})}
|
|
174
|
-
|
|
174
|
+
})}
|
|
175
|
+
>
|
|
176
|
+
<input
|
|
177
|
+
${ref(this.inputRef)}
|
|
178
|
+
type="checkbox"
|
|
179
|
+
name=${ifDefined(this.name)}
|
|
180
|
+
value=${ifDefined(this.value)}
|
|
181
|
+
.disabled=${this.disabled}
|
|
182
|
+
.checked=${live(this.checked)}
|
|
183
|
+
.required=${this.required}
|
|
184
|
+
@change=${this.onChange}
|
|
185
|
+
/>
|
|
186
|
+
<div part="track" class="track">
|
|
187
|
+
<div part="thumb" class="thumb">
|
|
188
|
+
<mdui-ripple
|
|
189
|
+
${ref(this.rippleRef)}
|
|
190
|
+
.noRipple=${this.noRipple}
|
|
191
|
+
></mdui-ripple>
|
|
192
|
+
<slot name="checked-icon" part="checked-icon" class="checked-icon">
|
|
193
|
+
${this.checkedIcon
|
|
194
|
+
? html `<mdui-icon name=${this.checkedIcon} class="i"></mdui-icon>`
|
|
175
195
|
: this.checkedIcon === ''
|
|
176
196
|
? nothingTemplate
|
|
177
|
-
: html `<mdui-icon-check class="i"></mdui-icon-check>`}
|
|
178
|
-
|
|
179
|
-
|
|
197
|
+
: html `<mdui-icon-check class="i"></mdui-icon-check>`}
|
|
198
|
+
</slot>
|
|
199
|
+
<slot
|
|
200
|
+
name="unchecked-icon"
|
|
201
|
+
part="unchecked-icon"
|
|
202
|
+
class="unchecked-icon"
|
|
203
|
+
>
|
|
204
|
+
${this.uncheckedIcon
|
|
205
|
+
? html `<mdui-icon
|
|
206
|
+
name=${this.uncheckedIcon}
|
|
207
|
+
class="i"
|
|
208
|
+
></mdui-icon>`
|
|
209
|
+
: nothingTemplate}
|
|
210
|
+
</slot>
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
</label>`;
|
|
180
214
|
}
|
|
181
215
|
/**
|
|
182
216
|
* input[type="checkbox"] 的 change 事件无法冒泡越过 shadow dom
|
|
@@ -1,2 +1,203 @@
|
|
|
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
|
+
--shape-corner-thumb: var(--mdui-shape-corner-full);
|
|
6
|
+
position: relative;
|
|
7
|
+
display: inline-block;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
-webkit-tap-highlight-color: transparent;
|
|
10
|
+
height: 2.5rem;
|
|
11
|
+
}
|
|
12
|
+
:host([disabled]) {
|
|
13
|
+
cursor: default;
|
|
14
|
+
pointer-events: none;
|
|
15
|
+
}
|
|
16
|
+
label {
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
white-space: nowrap;
|
|
22
|
+
cursor: inherit;
|
|
23
|
+
-webkit-user-select: none;
|
|
24
|
+
user-select: none;
|
|
25
|
+
touch-action: manipulation;
|
|
26
|
+
zoom: 1;
|
|
27
|
+
-webkit-user-drag: none;
|
|
28
|
+
}
|
|
29
|
+
/* 轨道 */
|
|
30
|
+
.track {
|
|
31
|
+
position: relative;
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
border-radius: var(--shape-corner);
|
|
35
|
+
transition-property: background-color, border-width;
|
|
36
|
+
transition-duration: var(--mdui-motion-duration-short4);
|
|
37
|
+
transition-timing-function: var(--mdui-motion-easing-standard);
|
|
38
|
+
height: 2rem;
|
|
39
|
+
width: 3.25rem;
|
|
40
|
+
border: 0.125rem solid rgb(var(--mdui-color-outline));
|
|
41
|
+
background-color: rgb(var(--mdui-color-surface-container-highest));
|
|
42
|
+
}
|
|
43
|
+
:host([checked]) .track {
|
|
44
|
+
background-color: rgb(var(--mdui-color-primary));
|
|
45
|
+
border-width: 0rem;
|
|
46
|
+
}
|
|
47
|
+
.invalid .track {
|
|
48
|
+
background-color: rgb(var(--mdui-color-error-container));
|
|
49
|
+
border-color: rgb(var(--mdui-color-error));
|
|
50
|
+
}
|
|
51
|
+
:host([disabled]) .track {
|
|
52
|
+
background-color: rgba(var(--mdui-color-surface-container-highest), 0.12);
|
|
53
|
+
border-color: rgba(var(--mdui-color-on-surface), 0.12);
|
|
54
|
+
}
|
|
55
|
+
:host([disabled][checked]) .track {
|
|
56
|
+
background-color: rgba(var(--mdui-color-on-surface), 0.12);
|
|
57
|
+
}
|
|
58
|
+
/* 隐藏系统 input 标签,用自定义的图标代替 */
|
|
59
|
+
input {
|
|
60
|
+
position: absolute;
|
|
61
|
+
padding: 0;
|
|
62
|
+
opacity: 0;
|
|
63
|
+
pointer-events: none;
|
|
64
|
+
width: 1.25rem;
|
|
65
|
+
height: 1.25rem;
|
|
66
|
+
margin: 0rem 0rem 0rem 0.625rem;
|
|
67
|
+
}
|
|
68
|
+
mdui-ripple {
|
|
69
|
+
border-radius: 50%;
|
|
70
|
+
transition-property: left, top;
|
|
71
|
+
transition-duration: var(--mdui-motion-duration-short4);
|
|
72
|
+
transition-timing-function: var(--mdui-motion-easing-standard);
|
|
73
|
+
width: 2.5rem;
|
|
74
|
+
height: 2.5rem;
|
|
75
|
+
}
|
|
76
|
+
.thumb {
|
|
77
|
+
position: absolute;
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
border-radius: var(--shape-corner-thumb);
|
|
82
|
+
transition-property: width, height, left, background-color;
|
|
83
|
+
transition-duration: var(--mdui-motion-duration-short4);
|
|
84
|
+
transition-timing-function: var(--mdui-motion-easing-standard);
|
|
85
|
+
height: 1rem;
|
|
86
|
+
width: 1rem;
|
|
87
|
+
left: 0.375rem;
|
|
88
|
+
background-color: rgb(var(--mdui-color-outline));
|
|
89
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
|
|
90
|
+
}
|
|
91
|
+
.thumb mdui-ripple {
|
|
92
|
+
left: -0.75rem;
|
|
93
|
+
top: -0.75rem;
|
|
94
|
+
}
|
|
95
|
+
.has-unchecked-icon .thumb {
|
|
96
|
+
height: 1.5rem;
|
|
97
|
+
width: 1.5rem;
|
|
98
|
+
left: 0.125rem;
|
|
99
|
+
}
|
|
100
|
+
.has-unchecked-icon .thumb mdui-ripple {
|
|
101
|
+
left: -0.5rem;
|
|
102
|
+
top: -0.5rem;
|
|
103
|
+
}
|
|
104
|
+
:host([hover]) .thumb,
|
|
105
|
+
:host([focus-visible]) .thumb,
|
|
106
|
+
:host([pressed]) .thumb {
|
|
107
|
+
background-color: rgb(var(--mdui-color-on-surface-variant));
|
|
108
|
+
}
|
|
109
|
+
:host([checked]) .thumb {
|
|
110
|
+
height: 1.5rem;
|
|
111
|
+
width: 1.5rem;
|
|
112
|
+
left: 1.5rem;
|
|
113
|
+
background-color: rgb(var(--mdui-color-on-primary));
|
|
114
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-primary);
|
|
115
|
+
}
|
|
116
|
+
:host([checked]) .thumb mdui-ripple {
|
|
117
|
+
left: -0.5rem;
|
|
118
|
+
top: -0.5rem;
|
|
119
|
+
}
|
|
120
|
+
:host([pressed]) .thumb {
|
|
121
|
+
height: 1.75rem;
|
|
122
|
+
width: 1.75rem;
|
|
123
|
+
left: 0rem;
|
|
124
|
+
}
|
|
125
|
+
:host([pressed]) .thumb mdui-ripple {
|
|
126
|
+
left: -0.375rem;
|
|
127
|
+
top: -0.375rem;
|
|
128
|
+
}
|
|
129
|
+
:host([pressed][checked]) .thumb {
|
|
130
|
+
left: 1.375rem;
|
|
131
|
+
}
|
|
132
|
+
:host([hover][checked]) .thumb,
|
|
133
|
+
:host([focus-visible][checked]) .thumb,
|
|
134
|
+
:host([pressed][checked]) .thumb {
|
|
135
|
+
background-color: rgb(var(--mdui-color-primary-container));
|
|
136
|
+
}
|
|
137
|
+
.invalid .thumb {
|
|
138
|
+
background-color: rgb(var(--mdui-color-error));
|
|
139
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-error);
|
|
140
|
+
}
|
|
141
|
+
:host([hover]) .invalid .thumb,
|
|
142
|
+
:host([focus-visible]) .invalid .thumb,
|
|
143
|
+
:host([pressed]) .invalid .thumb {
|
|
144
|
+
background-color: rgb(var(--mdui-color-error));
|
|
145
|
+
}
|
|
146
|
+
:host([disabled]) .thumb {
|
|
147
|
+
background-color: rgba(var(--mdui-color-on-surface), 0.38);
|
|
148
|
+
}
|
|
149
|
+
:host([disabled][checked]) .thumb {
|
|
150
|
+
background-color: rgb(var(--mdui-color-surface));
|
|
151
|
+
}
|
|
152
|
+
.unchecked-icon,
|
|
153
|
+
.checked-icon {
|
|
154
|
+
display: flex;
|
|
155
|
+
position: absolute;
|
|
156
|
+
transition-property: opacity, transform;
|
|
157
|
+
font-size: 1rem;
|
|
158
|
+
}
|
|
159
|
+
.unchecked-icon {
|
|
160
|
+
opacity: 1;
|
|
161
|
+
transform: scale(1);
|
|
162
|
+
transition-delay: var(--mdui-motion-duration-short1);
|
|
163
|
+
transition-duration: var(--mdui-motion-duration-short3);
|
|
164
|
+
transition-timing-function: var(--mdui-motion-easing-linear);
|
|
165
|
+
color: rgb(var(--mdui-color-surface-container-highest));
|
|
166
|
+
}
|
|
167
|
+
:host([checked]) .unchecked-icon {
|
|
168
|
+
opacity: 0;
|
|
169
|
+
transform: scale(0.92);
|
|
170
|
+
transition-delay: 0ms;
|
|
171
|
+
transition-duration: var(--mdui-motion-duration-short1);
|
|
172
|
+
}
|
|
173
|
+
:host([disabled]) .unchecked-icon {
|
|
174
|
+
color: rgba(var(--mdui-color-surface-container-highest), 0.38);
|
|
175
|
+
}
|
|
176
|
+
.checked-icon {
|
|
177
|
+
opacity: 0;
|
|
178
|
+
transform: scale(0.92);
|
|
179
|
+
transition-delay: 0ms;
|
|
180
|
+
transition-duration: var(--mdui-motion-duration-short1);
|
|
181
|
+
transition-timing-function: var(--mdui-motion-easing-linear);
|
|
182
|
+
color: rgb(var(--mdui-color-on-primary-container));
|
|
183
|
+
}
|
|
184
|
+
:host([checked]) .checked-icon {
|
|
185
|
+
opacity: 1;
|
|
186
|
+
transform: scale(1);
|
|
187
|
+
transition-delay: var(--mdui-motion-duration-short1);
|
|
188
|
+
transition-duration: var(--mdui-motion-duration-short3);
|
|
189
|
+
}
|
|
190
|
+
.invalid .checked-icon {
|
|
191
|
+
color: rgb(var(--mdui-color-error-container));
|
|
192
|
+
}
|
|
193
|
+
:host([disabled]) .checked-icon {
|
|
194
|
+
color: rgba(var(--mdui-color-on-surface), 0.38);
|
|
195
|
+
}
|
|
196
|
+
.unchecked-icon .i,
|
|
197
|
+
.checked-icon .i,
|
|
198
|
+
::slotted([slot='unchecked-icon']),
|
|
199
|
+
::slotted([slot='checked-icon']) {
|
|
200
|
+
font-size: inherit;
|
|
201
|
+
color: inherit;
|
|
202
|
+
}
|
|
203
|
+
`;
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const tabPanelStyle = css
|
|
2
|
+
export const tabPanelStyle = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
overflow-y: auto;
|
|
6
|
+
flex: 1 1 auto;
|
|
7
|
+
}
|
|
8
|
+
:host(:not([active])) {
|
|
9
|
+
display: none;
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
@@ -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 选项卡面板项组件。需配合 `<mdui-tabs>` 和 `<mdui-tab>` 组件使用
|
|
5
5
|
*
|
|
6
6
|
* ```html
|
|
7
7
|
* <mdui-tabs value="tab-1">
|
|
@@ -15,12 +15,12 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
15
15
|
* </mdui-tabs>
|
|
16
16
|
* ```
|
|
17
17
|
*
|
|
18
|
-
* @slot -
|
|
18
|
+
* @slot - 选项卡面板项内容
|
|
19
19
|
*/
|
|
20
20
|
export declare class TabPanel extends MduiElement<TabPanelEventMap> {
|
|
21
21
|
static styles: CSSResultGroup;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* 选项卡面板项的值
|
|
24
24
|
*/
|
|
25
25
|
value?: string;
|
|
26
26
|
/**
|
|
@@ -6,7 +6,7 @@ import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
|
6
6
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
7
7
|
import { tabPanelStyle } from './tab-panel-style.js';
|
|
8
8
|
/**
|
|
9
|
-
* @summary
|
|
9
|
+
* @summary 选项卡面板项组件。需配合 `<mdui-tabs>` 和 `<mdui-tab>` 组件使用
|
|
10
10
|
*
|
|
11
11
|
* ```html
|
|
12
12
|
* <mdui-tabs value="tab-1">
|
|
@@ -20,7 +20,7 @@ import { tabPanelStyle } from './tab-panel-style.js';
|
|
|
20
20
|
* </mdui-tabs>
|
|
21
21
|
* ```
|
|
22
22
|
*
|
|
23
|
-
* @slot -
|
|
23
|
+
* @slot - 选项卡面板项内容
|
|
24
24
|
*/
|
|
25
25
|
let TabPanel = class TabPanel extends MduiElement {
|
|
26
26
|
constructor() {
|
|
@@ -1,2 +1,86 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const tabStyle = css
|
|
2
|
+
export const tabStyle = css `
|
|
3
|
+
:host {
|
|
4
|
+
position: relative;
|
|
5
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
|
|
6
|
+
}
|
|
7
|
+
:host([active]) {
|
|
8
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-primary);
|
|
9
|
+
}
|
|
10
|
+
.container {
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
-webkit-user-select: none;
|
|
16
|
+
user-select: none;
|
|
17
|
+
-webkit-tap-highlight-color: transparent;
|
|
18
|
+
height: 100%;
|
|
19
|
+
}
|
|
20
|
+
.preset {
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
min-height: 3rem;
|
|
23
|
+
padding: 0.625rem 1rem;
|
|
24
|
+
}
|
|
25
|
+
:host([inline]) .preset {
|
|
26
|
+
flex-direction: row;
|
|
27
|
+
}
|
|
28
|
+
.icon-container,
|
|
29
|
+
.label-container {
|
|
30
|
+
position: relative;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
}
|
|
35
|
+
.icon-container ::slotted([slot='badge']) {
|
|
36
|
+
position: absolute;
|
|
37
|
+
transform: translate(50%, -50%);
|
|
38
|
+
}
|
|
39
|
+
.icon-container ::slotted([slot='badge'][variant='small']) {
|
|
40
|
+
transform: translate(0.5625rem, -0.5625rem);
|
|
41
|
+
}
|
|
42
|
+
.label-container ::slotted([slot='badge']) {
|
|
43
|
+
position: absolute;
|
|
44
|
+
left: 100%;
|
|
45
|
+
bottom: 100%;
|
|
46
|
+
transform: translate(-0.75rem, 0.625rem);
|
|
47
|
+
}
|
|
48
|
+
.label-container ::slotted([slot='badge'][variant='small']) {
|
|
49
|
+
transform: translate(-0.375rem, 0.375rem);
|
|
50
|
+
}
|
|
51
|
+
.icon,
|
|
52
|
+
.label {
|
|
53
|
+
display: flex;
|
|
54
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
55
|
+
}
|
|
56
|
+
:host([hover]) .icon,
|
|
57
|
+
:host([hover]) .label,
|
|
58
|
+
:host([focused]) .icon,
|
|
59
|
+
:host([focused]) .label,
|
|
60
|
+
:host([pressed]) .icon,
|
|
61
|
+
:host([pressed]) .label {
|
|
62
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
63
|
+
}
|
|
64
|
+
:host([active]) .icon,
|
|
65
|
+
:host([active]) .label {
|
|
66
|
+
color: rgb(var(--mdui-color-primary));
|
|
67
|
+
}
|
|
68
|
+
:host([active]) .variant-secondary .icon,
|
|
69
|
+
:host([active]) .variant-secondary .label {
|
|
70
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
71
|
+
}
|
|
72
|
+
.icon {
|
|
73
|
+
font-size: 1.5rem;
|
|
74
|
+
}
|
|
75
|
+
.label {
|
|
76
|
+
font-size: var(--mdui-typescale-title-small-size);
|
|
77
|
+
font-weight: var(--mdui-typescale-title-small-weight);
|
|
78
|
+
letter-spacing: var(--mdui-typescale-title-small-tracking);
|
|
79
|
+
line-height: var(--mdui-typescale-title-small-line-height);
|
|
80
|
+
}
|
|
81
|
+
.icon mdui-icon,
|
|
82
|
+
::slotted([slot='icon']) {
|
|
83
|
+
font-size: inherit;
|
|
84
|
+
color: inherit;
|
|
85
|
+
}
|
|
86
|
+
`;
|