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.
Files changed (156) hide show
  1. package/components/avatar/index.d.ts +13 -13
  2. package/components/avatar/index.js +11 -6
  3. package/components/avatar/style.js +31 -1
  4. package/components/badge/index.d.ts +7 -6
  5. package/components/badge/index.js +6 -5
  6. package/components/badge/style.js +25 -1
  7. package/components/bottom-app-bar/index.d.ts +4 -3
  8. package/components/bottom-app-bar/index.js +3 -3
  9. package/components/bottom-app-bar/style.js +92 -1
  10. package/components/button/button-base-style.js +28 -1
  11. package/components/button/button-base.d.ts +43 -44
  12. package/components/button/button-base.js +28 -21
  13. package/components/button/index.d.ts +13 -13
  14. package/components/button/index.js +30 -20
  15. package/components/button/style.js +111 -2
  16. package/components/button-icon/index.d.ts +8 -8
  17. package/components/button-icon/index.js +29 -12
  18. package/components/button-icon/style.js +103 -2
  19. package/components/card/index.d.ts +8 -8
  20. package/components/card/index.js +12 -8
  21. package/components/card/style.js +72 -1
  22. package/components/checkbox/index.d.ts +20 -20
  23. package/components/checkbox/index.js +68 -25
  24. package/components/checkbox/style.js +131 -1
  25. package/components/chip/index.d.ts +19 -19
  26. package/components/chip/index.js +49 -25
  27. package/components/chip/style.js +205 -2
  28. package/components/circular-progress/index.d.ts +2 -2
  29. package/components/circular-progress/index.js +40 -6
  30. package/components/circular-progress/style.js +136 -1
  31. package/components/collapse/collapse-item-style.js +21 -1
  32. package/components/collapse/collapse-item.d.ts +4 -4
  33. package/components/collapse/collapse-item.js +12 -4
  34. package/components/collapse/collapse-style.js +5 -1
  35. package/components/collapse/collapse.d.ts +6 -9
  36. package/components/collapse/collapse.js +8 -5
  37. package/components/dialog/index.d.ts +13 -13
  38. package/components/dialog/index.js +48 -20
  39. package/components/dialog/style.js +116 -1
  40. package/components/divider/index.d.ts +3 -3
  41. package/components/divider/index.js +3 -3
  42. package/components/divider/style.js +18 -1
  43. package/components/dropdown/index.d.ts +35 -35
  44. package/components/dropdown/index.js +41 -34
  45. package/components/dropdown/style.js +11 -1
  46. package/components/fab/index.d.ts +6 -6
  47. package/components/fab/index.js +19 -11
  48. package/components/fab/style.js +153 -4
  49. package/components/icon/index.js +5 -1
  50. package/components/icon/style.js +29 -1
  51. package/components/layout/layout-item-style.js +6 -1
  52. package/components/layout/layout-item.d.ts +7 -7
  53. package/components/layout/layout-item.js +6 -6
  54. package/components/layout/layout-main-style.js +7 -1
  55. package/components/layout/layout-main.d.ts +2 -2
  56. package/components/layout/layout-main.js +2 -2
  57. package/components/layout/layout-style.js +11 -1
  58. package/components/layout/layout.d.ts +2 -2
  59. package/components/layout/layout.js +2 -2
  60. package/components/linear-progress/index.d.ts +4 -4
  61. package/components/linear-progress/index.js +9 -5
  62. package/components/linear-progress/style.js +73 -1
  63. package/components/list/list-item-style.js +153 -2
  64. package/components/list/list-item.d.ts +17 -17
  65. package/components/list/list-item.js +34 -15
  66. package/components/list/list-style.js +10 -1
  67. package/components/list/list-subheader-style.js +19 -1
  68. package/components/list/list-subheader.d.ts +2 -2
  69. package/components/list/list-subheader.js +2 -2
  70. package/components/list/list.d.ts +1 -1
  71. package/components/list/list.js +1 -1
  72. package/components/menu/menu-item-style.js +125 -1
  73. package/components/menu/menu-item.d.ts +4 -4
  74. package/components/menu/menu-item.js +57 -15
  75. package/components/menu/menu-style.js +19 -1
  76. package/components/menu/menu.d.ts +15 -18
  77. package/components/menu/menu.js +13 -9
  78. package/components/navigation-bar/navigation-bar-item-style.js +132 -1
  79. package/components/navigation-bar/navigation-bar-item.d.ts +5 -5
  80. package/components/navigation-bar/navigation-bar-item.js +27 -11
  81. package/components/navigation-bar/navigation-bar-style.js +28 -1
  82. package/components/navigation-bar/navigation-bar.d.ts +9 -8
  83. package/components/navigation-bar/navigation-bar.js +10 -7
  84. package/components/navigation-drawer/index.d.ts +19 -20
  85. package/components/navigation-drawer/index.js +56 -31
  86. package/components/navigation-drawer/style.js +66 -1
  87. package/components/navigation-rail/navigation-rail-item-style.js +122 -1
  88. package/components/navigation-rail/navigation-rail-item.d.ts +6 -6
  89. package/components/navigation-rail/navigation-rail-item.js +30 -11
  90. package/components/navigation-rail/navigation-rail-style.js +79 -1
  91. package/components/navigation-rail/navigation-rail.d.ts +10 -11
  92. package/components/navigation-rail/navigation-rail.js +19 -11
  93. package/components/radio/radio-group-style.js +20 -1
  94. package/components/radio/radio-group.d.ts +13 -13
  95. package/components/radio/radio-group.js +30 -12
  96. package/components/radio/radio-style.js +107 -1
  97. package/components/radio/radio.d.ts +3 -3
  98. package/components/radio/radio.js +26 -8
  99. package/components/range-slider/index.d.ts +5 -6
  100. package/components/range-slider/index.js +57 -10
  101. package/components/ripple/index.js +5 -2
  102. package/components/ripple/style.js +96 -1
  103. package/components/segmented-button/segmented-button-group-style.js +28 -1
  104. package/components/segmented-button/segmented-button-group.d.ts +17 -20
  105. package/components/segmented-button/segmented-button-group.js +32 -15
  106. package/components/segmented-button/segmented-button-style.js +81 -2
  107. package/components/segmented-button/segmented-button.d.ts +3 -3
  108. package/components/segmented-button/segmented-button.js +30 -14
  109. package/components/select/index.d.ts +31 -32
  110. package/components/select/index.js +106 -26
  111. package/components/select/style.js +27 -1
  112. package/components/slider/index.d.ts +1 -1
  113. package/components/slider/index.js +34 -3
  114. package/components/slider/slider-base-style.js +173 -1
  115. package/components/slider/slider-base.d.ts +15 -15
  116. package/components/slider/slider-base.js +19 -14
  117. package/components/slider/style.js +7 -1
  118. package/components/snackbar/index.d.ts +21 -21
  119. package/components/snackbar/index.js +47 -20
  120. package/components/snackbar/style.js +100 -1
  121. package/components/switch/index.d.ts +14 -14
  122. package/components/switch/index.js +51 -17
  123. package/components/switch/style.js +202 -1
  124. package/components/tabs/tab-panel-style.js +10 -1
  125. package/components/tabs/tab-panel.d.ts +3 -3
  126. package/components/tabs/tab-panel.js +2 -2
  127. package/components/tabs/tab-style.js +85 -1
  128. package/components/tabs/tab.d.ts +6 -6
  129. package/components/tabs/tab.js +29 -9
  130. package/components/tabs/tabs-style.js +138 -1
  131. package/components/tabs/tabs.d.ts +19 -19
  132. package/components/tabs/tabs.js +26 -18
  133. package/components/text-field/index.d.ts +51 -51
  134. package/components/text-field/index.js +185 -57
  135. package/components/text-field/style.js +362 -1
  136. package/components/tooltip/index.d.ts +31 -31
  137. package/components/tooltip/index.js +38 -29
  138. package/components/tooltip/style.js +57 -1
  139. package/components/top-app-bar/top-app-bar-style.js +78 -1
  140. package/components/top-app-bar/top-app-bar-title-style.js +81 -1
  141. package/components/top-app-bar/top-app-bar-title.d.ts +4 -4
  142. package/components/top-app-bar/top-app-bar-title.js +21 -7
  143. package/components/top-app-bar/top-app-bar.d.ts +5 -5
  144. package/components/top-app-bar/top-app-bar.js +4 -4
  145. package/css-data.en.json +2826 -0
  146. package/css-data.zh-cn.json +374 -367
  147. package/custom-elements.json +2049 -2049
  148. package/html-data.en.json +6560 -0
  149. package/html-data.zh-cn.json +1427 -1433
  150. package/jsx.en.d.ts +3303 -0
  151. package/jsx.zh-cn.d.ts +3351 -0
  152. package/package.json +6 -5
  153. package/web-types.en.json +11734 -0
  154. package/web-types.zh-cn.json +3227 -3221
  155. package/mdui.esm.js +0 -22
  156. package/mdui.global.js +0 -22
@@ -21,43 +21,43 @@ export class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(MduiEleme
21
21
  */
22
22
  this.disabled = false;
23
23
  /**
24
- * 是否为加载中状态
24
+ * 是否处于加载中状态
25
25
  */
26
26
  this.loading = false;
27
27
  /**
28
- * 按钮的名称,将与表单数据一起提交
28
+ * 按钮的名称,将与表单数据一起提交。
29
29
  *
30
- * **Note**:仅在未指定 `href` 属性时可用
30
+ * **Note**:仅在未设置 `href` 属性时,此属性才有效。
31
31
  */
32
32
  this.name = '';
33
33
  /**
34
- * 按钮的初始值,将与表单数据一起提交
34
+ * 按钮的初始值,将与表单数据一起提交。
35
35
  *
36
- * **Note**:仅在未指定 `href` 属性时可用
36
+ * **Note**:仅在未设置 `href` 属性时,此属性才有效。
37
37
  */
38
38
  this.value = '';
39
39
  /**
40
- * 按钮的类型。默认值为 `button`。可选值为:
40
+ * 按钮的类型。默认类型为 `button`。可选类型包括:
41
41
  *
42
- * * `submit`:点击按钮将表单数据提交给服务器
43
- * * `reset`:点击按钮将表单中所有组件重置为初始值
44
- * * `button`:按钮没有默认行为
42
+ * * `submit`:点击按钮会提交表单数据到服务器
43
+ * * `reset`:点击按钮会将表单中的所有字段重置为初始值
44
+ * * `button`:此类型的按钮没有默认行为
45
45
  *
46
- * **Note**:仅在未指定 `href` 属性时可用
46
+ * **Note**:仅在未指定 `href` 属性时,此属性才有效。
47
47
  */
48
48
  this.type = 'button';
49
49
  /**
50
- * 指定了该属性时,表示当表单被提交时不需要验证。
50
+ * 如果设置了此属性,表单提交时将不执行表单验证。
51
51
  *
52
- * 指定了该属性时,将覆盖 `form` 元素的 `novalidate` 属性。
52
+ * 如果设置了此属性,将覆盖 `<form>` 元素的 `novalidate` 属性。
53
53
  *
54
- * **Note**:仅在未指定 `href` 属性、且 `type="submit"` 时可用。
54
+ * **Note**:仅在未设置 `href` 属性且 `type="submit"` 时,此属性才有效。
55
55
  */
56
56
  this.formNoValidate = false;
57
57
  this.formController = new FormController(this);
58
58
  }
59
59
  /**
60
- * 表单验证状态对象
60
+ * 表单验证状态对象,具体参见 [`ValidityState`](https://developer.mozilla.org/zh-CN/docs/Web/API/ValidityState)
61
61
  */
62
62
  get validity() {
63
63
  if (this.isButton()) {
@@ -65,7 +65,7 @@ export class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(MduiEleme
65
65
  }
66
66
  }
67
67
  /**
68
- * 表单验证的错误提示信息
68
+ * 如果表单验证未通过,此属性将包含提示信息。如果验证通过,此属性将为空字符串
69
69
  */
70
70
  get validationMessage() {
71
71
  if (this.isButton()) {
@@ -86,7 +86,7 @@ export class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(MduiEleme
86
86
  return this.disabled || this.loading;
87
87
  }
88
88
  /**
89
- * 检查表单字段是否验证通过。若未通过则返回 `false`,并触发 `invalid` 事件;若验证通过,则返回 `true`
89
+ * 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`
90
90
  */
91
91
  checkValidity() {
92
92
  if (this.isButton()) {
@@ -104,9 +104,9 @@ export class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(MduiEleme
104
104
  return true;
105
105
  }
106
106
  /**
107
- * 检查表单字段是否验证通过。若未通过则返回 `false`,并触发 `invalid` 事件;若验证通过,则返回 `true`。
107
+ * 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`。
108
108
  *
109
- * 验证未通过时,还将在组件上显示未通过的提示。
109
+ * 如果验证未通过,还会在组件上显示验证失败的提示。
110
110
  */
111
111
  reportValidity() {
112
112
  if (this.isButton()) {
@@ -125,9 +125,9 @@ export class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(MduiEleme
125
125
  return true;
126
126
  }
127
127
  /**
128
- * 设置自定义的错误提示文本。只要文本不为空,则表示字段验证未通过
128
+ * 设置自定义的错误提示文本。只要这个文本不为空,就表示字段未通过验证
129
129
  *
130
- * @param message 自定义的提示文本
130
+ * @param message 自定义的错误提示文本
131
131
  */
132
132
  setCustomValidity(message) {
133
133
  if (this.isButton()) {
@@ -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 id="${ifDefined(id)}" class="${cc(['_button', className])}" part="${ifDefined(part)}" ?disabled="${this.rippleDisabled || this.focusDisabled}">${content}</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;
@@ -14,29 +14,29 @@ import type { TemplateResult, CSSResultGroup } from 'lit';
14
14
  * @event invalid - 表单字段验证未通过时触发
15
15
  *
16
16
  * @slot - 按钮的文本
17
- * @slot icon - 按钮左侧元素
18
- * @slot end-icon - 按钮右侧元素
17
+ * @slot icon - 按钮左侧的元素
18
+ * @slot end-icon - 按钮右侧的元素
19
19
  *
20
20
  * @csspart button - 内部的 `<button>` 或 `<a>` 元素
21
- * @csspart label - 按钮文本
22
- * @csspart icon - 按钮左侧图标
23
- * @csspart end-icon - 按钮右侧图标
21
+ * @csspart label - 按钮的文本
22
+ * @csspart icon - 按钮左侧的图标
23
+ * @csspart end-icon - 按钮右侧的图标
24
24
  * @csspart loading - 加载中状态的 `<mdui-circular-progress>` 元素
25
25
  *
26
- * @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
26
+ * @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
27
27
  */
28
28
  export declare class Button extends ButtonBase<ButtonEventMap> {
29
29
  static styles: CSSResultGroup;
30
30
  /**
31
- * 按钮形状。可选值为:
31
+ * 按钮的形状。可选值包括:
32
32
  *
33
- * * `elevated`:带阴影的按钮,在需要把按钮和背景进行视觉分离时使用
34
- * * `filled`:视觉效果仅次于 FAB,用于重要流程的最终操作,如“保存”、“确认”等
35
- * * `tonal`:视觉效果介于 `filled` 和 `outlined` 之间,用于中高优先级的操作,如流程中的“下一步”
36
- * * `outlined`:带边框的按钮,用于中等优先级,且次要的操作,如“返回”
37
- * * `text`:文本按钮,用于最低优先级的操作
33
+ * * `elevated`:带阴影的按钮,适用于需要将按钮与背景视觉分离的场景
34
+ * * `filled`:视觉效果强烈,适用于重要流程的最终操作,如“保存”、“确认”等
35
+ * * `tonal`:视觉效果介于 `filled` 和 `outlined` 之间,适用于中高优先级的操作,如流程中的“下一步”
36
+ * * `outlined`:带边框的按钮,适用于中等优先级,且次要的操作,如“返回”
37
+ * * `text`:文本按钮,适用于最低优先级的操作
38
38
  */
39
- variant: /*带阴影的按钮,在需要把按钮和背景进行视觉分离时使用*/ 'elevated' | /*视觉效果仅次于 FAB,用于重要流程的最终操作,如“保存”、“确认”等*/ 'filled' | /*视觉效果介于 `filled` 和 `outlined` 之间,用于中等偏高优先级的场景,如流程中的“下一步”*/ 'tonal' | /*带边框的按钮,用于中等优先级,且次要操作的场景,如“返回”*/ 'outlined' | /*文本按钮,用于最低优先级的操作*/ 'text';
39
+ variant: /*带阴影的按钮,适用于需要将按钮与背景视觉分离的场景*/ 'elevated' | /*视觉效果强烈,适用于重要流程的最终操作,如“保存”、“确认”等*/ 'filled' | /*视觉效果介于 `filled` 和 `outlined` 之间,适用于中高优先级的操作,如流程中的“下一步”*/ 'tonal' | /*带边框的按钮,适用于中等优先级,且次要的操作,如“返回”*/ 'outlined' | /*文本按钮,适用于最低优先级的操作*/ 'text';
40
40
  /**
41
41
  * 是否填满父元素宽度
42
42
  */
@@ -19,28 +19,28 @@ import { style } from './style.js';
19
19
  * @event invalid - 表单字段验证未通过时触发
20
20
  *
21
21
  * @slot - 按钮的文本
22
- * @slot icon - 按钮左侧元素
23
- * @slot end-icon - 按钮右侧元素
22
+ * @slot icon - 按钮左侧的元素
23
+ * @slot end-icon - 按钮右侧的元素
24
24
  *
25
25
  * @csspart button - 内部的 `<button>` 或 `<a>` 元素
26
- * @csspart label - 按钮文本
27
- * @csspart icon - 按钮左侧图标
28
- * @csspart end-icon - 按钮右侧图标
26
+ * @csspart label - 按钮的文本
27
+ * @csspart icon - 按钮左侧的图标
28
+ * @csspart end-icon - 按钮右侧的图标
29
29
  * @csspart loading - 加载中状态的 `<mdui-circular-progress>` 元素
30
30
  *
31
- * @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
31
+ * @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
32
32
  */
33
33
  let Button = class Button extends ButtonBase {
34
34
  constructor() {
35
35
  super(...arguments);
36
36
  /**
37
- * 按钮形状。可选值为:
37
+ * 按钮的形状。可选值包括:
38
38
  *
39
- * * `elevated`:带阴影的按钮,在需要把按钮和背景进行视觉分离时使用
40
- * * `filled`:视觉效果仅次于 FAB,用于重要流程的最终操作,如“保存”、“确认”等
41
- * * `tonal`:视觉效果介于 `filled` 和 `outlined` 之间,用于中高优先级的操作,如流程中的“下一步”
42
- * * `outlined`:带边框的按钮,用于中等优先级,且次要的操作,如“返回”
43
- * * `text`:文本按钮,用于最低优先级的操作
39
+ * * `elevated`:带阴影的按钮,适用于需要将按钮与背景视觉分离的场景
40
+ * * `filled`:视觉效果强烈,适用于重要流程的最终操作,如“保存”、“确认”等
41
+ * * `tonal`:视觉效果介于 `filled` 和 `outlined` 之间,适用于中高优先级的操作,如流程中的“下一步”
42
+ * * `outlined`:带边框的按钮,适用于中等优先级,且次要的操作,如“返回”
43
+ * * `text`:文本按钮,适用于最低优先级的操作
44
44
  */
45
45
  this.variant = 'filled';
46
46
  /**
@@ -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 ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.isButton()
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">${this.renderInner()}</span>`
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">${this.icon
75
- ? html `<mdui-icon name="${this.icon}"></mdui-icon>`
76
- : nothingTemplate}</slot>`;
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">${this.endIcon
83
- ? html `<mdui-icon name="${this.endIcon}"></mdui-icon>`
84
- : nothingTemplate}</slot>`;
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 `:host{--shape-corner:var(--mdui-shape-corner-full);position:relative;display:inline-block;overflow:hidden;text-align:center;border-radius:var(--shape-corner);cursor:pointer;-webkit-tap-highlight-color:transparent;transition:box-shadow var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);min-width:3rem;height:2.5rem;color:rgb(var(--mdui-color-primary));font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking);line-height:var(--mdui-typescale-label-large-line-height)}.button{width:100%;padding:0 1rem}:host([full-width]){display:block}:host([variant=elevated]){box-shadow:var(--mdui-elevation-level1);background-color:rgb(var(--mdui-color-surface-container-low));--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=filled]){color:rgb(var(--mdui-color-on-primary));background-color:rgb(var(--mdui-color-primary));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-primary)}:host([variant=tonal]){color:rgb(var(--mdui-color-on-secondary-container));background-color:rgb(var(--mdui-color-secondary-container));--mdui-comp-ripple-state-layer-color:var(
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
- )}:host([variant=outlined]){border:.0625rem solid rgb(var(--mdui-color-outline));--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=text]){--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=outlined][focus-visible]){border-color:rgb(var(--mdui-color-primary))}:host([variant=elevated][hover]){box-shadow:var(--mdui-elevation-level2)}:host([variant=filled][hover]),:host([variant=tonal][hover]){box-shadow:var(--mdui-elevation-level1)}:host([disabled]),:host([loading]){cursor:default;pointer-events:none}:host([disabled]){color:rgba(var(--mdui-color-on-surface),38%);box-shadow:var(--mdui-elevation-level0)}:host([variant=elevated][disabled]),:host([variant=filled][disabled]),:host([variant=tonal][disabled]){background-color:rgba(var(--mdui-color-on-surface),12%)}:host([variant=outlined][disabled]){border-color:rgba(var(--mdui-color-on-surface),12%)}.label{display:inline-flex;padding-right:.5rem;padding-left:.5rem}.end-icon,.icon{display:inline-flex;font-size:1.28571429em}.end-icon mdui-icon,.icon mdui-icon,::slotted([slot=end-icon]),::slotted([slot=icon]){font-size:inherit}mdui-circular-progress{display:inline-flex;width:1.125rem;height:1.125rem}:host([variant=filled]) mdui-circular-progress{stroke:rgb(var(--mdui-color-on-primary))}:host([variant=tonal]) mdui-circular-progress{stroke:rgb(var(--mdui-color-on-secondary-container))}:host([disabled]) mdui-circular-progress{stroke:rgba(var(--mdui-color-on-surface),38%)}`;
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
+ `;
@@ -22,19 +22,19 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
22
22
  * @csspart selected-icon 选中状态的图标
23
23
  * @csspart loading - 加载中状态的 `<mdui-circular-progress>` 元素
24
24
  *
25
- * @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
25
+ * @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
26
26
  */
27
27
  export declare class ButtonIcon extends ButtonBase<ButtonIconEventMap> {
28
28
  static styles: CSSResultGroup;
29
29
  /**
30
- * 图标按钮的形状。可选值为:
30
+ * 图标按钮的形状。可选值包括:
31
31
  *
32
- * * `standard`:用于最低优先级的操作
33
- * * `filled`:具有最强视觉效果,用于高优先级的操作
34
- * * `tonal`:视觉效果介于 `filled` 和 `outlined` 之间,用于中高优先级的操作
35
- * * `outlined`:用于中等优先级的操作
32
+ * * `standard`:适用于最低优先级的操作
33
+ * * `filled`:视觉效果强烈,适用于高优先级的操作
34
+ * * `tonal`:视觉效果介于 `filled` 和 `outlined` 之间,适用于中高优先级的操作
35
+ * * `outlined`:适用于中等优先级的操作
36
36
  */
37
- variant: /*用于最低优先级的操作*/ 'standard' | /*具有最强视觉效果,用于高优先级的操作*/ 'filled' | /*视觉效果介于 `filled` 和 `outlined` 之间,用于中高优先级的操作*/ 'tonal' | /*用于中等优先级的操作*/ 'outlined';
37
+ variant: /*适用于最低优先级的操作*/ 'standard' | /*视觉效果强烈,适用于高优先级的操作*/ 'filled' | /*视觉效果介于 `filled` 和 `outlined` 之间,适用于中高优先级的操作*/ 'tonal' | /*适用于中等优先级的操作*/ 'outlined';
38
38
  /**
39
39
  * Material Icons 图标名。也可以通过 default slot 设置
40
40
  */
@@ -48,7 +48,7 @@ export declare class ButtonIcon extends ButtonBase<ButtonIconEventMap> {
48
48
  */
49
49
  selectable: boolean;
50
50
  /**
51
- * 是否已选中
51
+ * 是否已被选中
52
52
  */
53
53
  selected: boolean;
54
54
  private readonly rippleRef;
@@ -29,18 +29,18 @@ import { style } from './style.js';
29
29
  * @csspart selected-icon 选中状态的图标
30
30
  * @csspart loading - 加载中状态的 `<mdui-circular-progress>` 元素
31
31
  *
32
- * @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
32
+ * @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
33
33
  */
34
34
  let ButtonIcon = class ButtonIcon extends ButtonBase {
35
35
  constructor() {
36
36
  super(...arguments);
37
37
  /**
38
- * 图标按钮的形状。可选值为:
38
+ * 图标按钮的形状。可选值包括:
39
39
  *
40
- * * `standard`:用于最低优先级的操作
41
- * * `filled`:具有最强视觉效果,用于高优先级的操作
42
- * * `tonal`:视觉效果介于 `filled` 和 `outlined` 之间,用于中高优先级的操作
43
- * * `outlined`:用于中等优先级的操作
40
+ * * `standard`:适用于最低优先级的操作
41
+ * * `filled`:视觉效果强烈,适用于高优先级的操作
42
+ * * `tonal`:视觉效果介于 `filled` 和 `outlined` 之间,适用于中高优先级的操作
43
+ * * `outlined`:适用于中等优先级的操作
44
44
  */
45
45
  this.variant = 'standard';
46
46
  /**
@@ -48,7 +48,7 @@ let ButtonIcon = class ButtonIcon extends ButtonBase {
48
48
  */
49
49
  this.selectable = false;
50
50
  /**
51
- * 是否已选中
51
+ * 是否已被选中
52
52
  */
53
53
  this.selected = false;
54
54
  this.rippleRef = createRef();
@@ -70,28 +70,45 @@ let ButtonIcon = class ButtonIcon extends ButtonBase {
70
70
  });
71
71
  }
72
72
  render() {
73
- return html `<mdui-ripple ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.isButton()
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">${this.renderIcon()}</span>`
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
- })} ${this.renderLoading()}`;
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 part="icon" class="icon" name="${this.icon}"></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 name="selected-icon" part="selected-icon" class="selected-icon"><mdui-icon name="${this.selectedIcon}"></mdui-icon></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 `:host{--shape-corner:var(--mdui-shape-corner-full);position:relative;display:inline-block;overflow:hidden;text-align:center;border-radius:var(--shape-corner);cursor:pointer;-webkit-tap-highlight-color:transparent;font-size:1.5rem;width:2.5rem;min-width:2.5rem;height:2.5rem}:host([variant=standard]){color:rgb(var(--mdui-color-on-surface-variant));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface-variant)}:host([variant=filled]){color:rgb(var(--mdui-color-primary));background-color:rgb(var(--mdui-color-surface-container-highest));--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=tonal]){color:rgb(var(--mdui-color-on-surface-variant));background-color:rgb(var(--mdui-color-surface-container-highest));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface-variant)}:host([variant=outlined]){border:.0625rem solid rgb(var(--mdui-color-outline));color:rgb(var(--mdui-color-on-surface-variant));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface-variant)}:host([variant=outlined][pressed]){color:rgb(var(--mdui-color-on-surface));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([variant=standard][selected]){color:rgb(var(--mdui-color-primary));--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=filled]:not([selectable])),:host([variant=filled][selected]){color:rgb(var(--mdui-color-on-primary));background-color:rgb(var(--mdui-color-primary));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-primary)}:host([variant=tonal]:not([selectable])),:host([variant=tonal][selected]){color:rgb(var(--mdui-color-on-secondary-container));background-color:rgb(var(--mdui-color-secondary-container));--mdui-comp-ripple-state-layer-color:var(
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
- )}:host([variant=outlined][selected]){border:none;color:rgb(var(--mdui-color-inverse-on-surface));background-color:rgb(var(--mdui-color-inverse-surface));--mdui-comp-ripple-state-layer-color:var(--mdui-color-inverse-on-surface)}:host([variant=filled][disabled]),:host([variant=outlined][disabled]),:host([variant=tonal][disabled]){background-color:rgba(var(--mdui-color-on-surface),.12);border-color:rgba(var(--mdui-color-on-surface),.12)}:host([disabled]),:host([loading]){cursor:default;pointer-events:none}:host([disabled]){color:rgba(var(--mdui-color-on-surface),.38)!important}:host([loading]) .button,:host([loading]) mdui-ripple{opacity:0}.button{float:left;width:100%}.icon,.selected-icon mdui-icon,::slotted(*){font-size:inherit}mdui-circular-progress{display:flex;position:absolute;top:calc(50% - 1.5rem / 2);left:calc(50% - 1.5rem / 2);width:1.5rem;height:1.5rem}:host([variant=filled]:not([disabled])) mdui-circular-progress{stroke:rgb(var(--mdui-color-on-primary))}:host([disabled]) mdui-circular-progress{stroke:rgba(var(--mdui-color-on-surface),38%)}`;
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
+ `;
@@ -12,22 +12,22 @@ declare const Card_base: import("@open-wc/dedupe-mixin").Constructor<import("@md
12
12
  * @event focus - 获得焦点时触发
13
13
  * @event blur - 失去焦点时触发
14
14
  *
15
- * @slot - 卡片内容
15
+ * @slot - 卡片的内容
16
16
  *
17
- * @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
17
+ * @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
18
18
  */
19
19
  export declare class Card extends Card_base<CardEventMap> {
20
20
  static styles: CSSResultGroup;
21
21
  /**
22
- * 卡片形状。可选值为:
22
+ * 卡片的形状。可选值包括:
23
23
  *
24
- * * `elevated`:具有阴影,与背景的分离度比 `filled` 更高,但小于 `outlined`
25
- * * `filled`:与背景的分离度最小
26
- * * `outlined`:具有边框,与背景的分离度最大
24
+ * * `elevated`:带阴影的卡片,与背景的视觉分离度较高
25
+ * * `filled`:带填充色的卡片,与背景的视觉分离度较低
26
+ * * `outlined`:带边框的卡片,与背景的视觉分离度最高
27
27
  */
28
- variant: /*具有阴影,与背景的分离度比 `filled` 更高,但小于 `outlined`*/ 'elevated' | /*与背景的分离度最小*/ 'filled' | /*具有边框,与背景的分离度最大*/ 'outlined';
28
+ variant: /*带阴影的卡片,与背景的视觉分离度较高*/ 'elevated' | /*带填充色的卡片,与背景的视觉分离度较低*/ 'filled' | /*带边框的卡片,与背景的视觉分离度最高*/ 'outlined';
29
29
  /**
30
- * 是否可点击。为 `true` 时,会添加鼠标悬浮效果、及点击涟漪效果
30
+ * 是否可点击。为 `true` 时,卡片将具有鼠标悬浮效果和点击涟漪效果
31
31
  */
32
32
  clickable: boolean;
33
33
  /**