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
@@ -1,2 +1,126 @@
1
1
  import { css } from 'lit';
2
- export const menuItemStyle = css `:host{position:relative;display:block}:host([selected]){background-color:rgba(var(--mdui-color-primary),12%)}:host([disabled]){pointer-events:none}.container{cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}:host([disabled]) .container{cursor:default;opacity:.38}.preset{display:flex;align-items:center;text-decoration:none;height:3rem;padding:0 .75rem}.preset.dense{height:2rem}.label-container{flex:1 1 100%;min-width:0}.label{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:rgb(var(--mdui-color-on-surface));font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking)}.end-icon,.end-text,.icon,.selected-icon{display:none;flex:0 0 auto;color:rgb(var(--mdui-color-on-surface-variant))}.has-end-icon .end-icon,.has-end-text .end-text,.has-icon .icon,.has-icon .selected-icon{display:flex}.end-icon,.icon,.selected-icon{font-size:1.5rem}.end-icon::slotted(mdui-avatar),.icon::slotted(mdui-avatar),.selected-icon::slotted(mdui-avatar){width:1.5rem;height:1.5rem}.dense .end-icon,.dense .icon,.dense .selected-icon{font-size:1.125rem}.dense .end-icon::slotted(mdui-avatar),.dense .icon::slotted(mdui-avatar),.dense .selected-icon::slotted(mdui-avatar){width:1.125rem;height:1.125rem}.end-icon .i,.icon .i,.selected-icon .i,::slotted([slot=end-icon]),::slotted([slot=icon]),::slotted([slot=selected-icon]){font-size:inherit}.end-text{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)}.icon,.selected-icon{margin-right:.75rem}.end-icon,.end-text{margin-left:.75rem}.arrow-right{color:rgb(var(--mdui-color-on-surface))}.submenu{--shape-corner:var(--mdui-shape-corner-extra-small);display:block;position:absolute;z-index:1;border-radius:var(--shape-corner);background-color:rgb(var(--mdui-color-surface-container));box-shadow:var(--mdui-elevation-level2);min-width:7rem;max-width:17.5rem;padding-top:.5rem;padding-bottom:.5rem;--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}.submenu::slotted(mdui-divider){margin-top:.5rem;margin-bottom:.5rem}`;
2
+ export const menuItemStyle = css `
3
+ :host {
4
+ position: relative;
5
+ display: block;
6
+ }
7
+ :host([selected]) {
8
+ background-color: rgba(var(--mdui-color-primary), 12%);
9
+ }
10
+ :host([disabled]) {
11
+ pointer-events: none;
12
+ }
13
+ .container {
14
+ cursor: pointer;
15
+ -webkit-user-select: none;
16
+ user-select: none;
17
+ -webkit-tap-highlight-color: transparent;
18
+ }
19
+ :host([disabled]) .container {
20
+ cursor: default;
21
+ opacity: 0.38;
22
+ }
23
+ .preset {
24
+ display: flex;
25
+ align-items: center;
26
+ text-decoration: none;
27
+ height: 3rem;
28
+ padding: 0rem 0.75rem;
29
+ }
30
+ .preset.dense {
31
+ height: 2rem;
32
+ }
33
+ .label-container {
34
+ flex: 1 1 100%;
35
+ min-width: 0;
36
+ }
37
+ .label {
38
+ display: block;
39
+ overflow: hidden;
40
+ white-space: nowrap;
41
+ text-overflow: ellipsis;
42
+ color: rgb(var(--mdui-color-on-surface));
43
+ font-size: var(--mdui-typescale-label-large-size);
44
+ font-weight: var(--mdui-typescale-label-large-weight);
45
+ letter-spacing: var(--mdui-typescale-label-large-tracking);
46
+ }
47
+ .icon,
48
+ .selected-icon,
49
+ .end-icon,
50
+ .end-text {
51
+ display: none;
52
+ flex: 0 0 auto;
53
+ color: rgb(var(--mdui-color-on-surface-variant));
54
+ }
55
+ .has-icon .icon,
56
+ .has-icon .selected-icon,
57
+ .has-end-icon .end-icon,
58
+ .has-end-text .end-text {
59
+ display: flex;
60
+ }
61
+ .icon,
62
+ .selected-icon,
63
+ .end-icon {
64
+ font-size: 1.5rem;
65
+ }
66
+ .icon::slotted(mdui-avatar),
67
+ .selected-icon::slotted(mdui-avatar),
68
+ .end-icon::slotted(mdui-avatar) {
69
+ width: 1.5rem;
70
+ height: 1.5rem;
71
+ }
72
+ .dense .icon,
73
+ .dense .selected-icon,
74
+ .dense .end-icon {
75
+ font-size: 1.125rem;
76
+ }
77
+ .dense .icon::slotted(mdui-avatar),
78
+ .dense .selected-icon::slotted(mdui-avatar),
79
+ .dense .end-icon::slotted(mdui-avatar) {
80
+ width: 1.125rem;
81
+ height: 1.125rem;
82
+ }
83
+ .icon .i,
84
+ .selected-icon .i,
85
+ .end-icon .i,
86
+ ::slotted([slot='icon']),
87
+ ::slotted([slot='selected-icon']),
88
+ ::slotted([slot='end-icon']) {
89
+ font-size: inherit;
90
+ }
91
+ .end-text {
92
+ font-size: var(--mdui-typescale-label-large-size);
93
+ font-weight: var(--mdui-typescale-label-large-weight);
94
+ letter-spacing: var(--mdui-typescale-label-large-tracking);
95
+ line-height: var(--mdui-typescale-label-large-line-height);
96
+ }
97
+ .icon,
98
+ .selected-icon {
99
+ margin-right: 0.75rem;
100
+ }
101
+ .end-icon,
102
+ .end-text {
103
+ margin-left: 0.75rem;
104
+ }
105
+ .arrow-right {
106
+ color: rgb(var(--mdui-color-on-surface));
107
+ }
108
+ .submenu {
109
+ --shape-corner: var(--mdui-shape-corner-extra-small);
110
+ display: block;
111
+ position: absolute;
112
+ z-index: 1;
113
+ border-radius: var(--shape-corner);
114
+ background-color: rgb(var(--mdui-color-surface-container));
115
+ box-shadow: var(--mdui-elevation-level2);
116
+ min-width: 7rem;
117
+ max-width: 17.5rem;
118
+ padding-top: 0.5rem;
119
+ padding-bottom: 0.5rem;
120
+ --mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
121
+ }
122
+ .submenu::slotted(mdui-divider) {
123
+ margin-top: 0.5rem;
124
+ margin-bottom: 0.5rem;
125
+ }
126
+ `;
@@ -12,7 +12,7 @@ import type { Ripple } from '../ripple/index.js';
12
12
  import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
13
13
  declare const MenuItem_base: import("@open-wc/dedupe-mixin").Constructor<import("@mdui/shared/mixins/anchor.js").AnchorMixinInterface> & import("@open-wc/dedupe-mixin").Constructor<import("../ripple/ripple-mixin.js").RippleMixinInterface> & import("@open-wc/dedupe-mixin").Constructor<import("@mdui/shared/mixins/focusable.js").FocusableMixinInterface> & typeof MduiElement;
14
14
  /**
15
- * @summary 菜单项组件
15
+ * @summary 菜单项组件。需配合 `<mdui-menu>` 组件使用
16
16
  *
17
17
  * ```html
18
18
  * <mdui-menu>
@@ -47,17 +47,17 @@ declare const MenuItem_base: import("@open-wc/dedupe-mixin").Constructor<import(
47
47
  export declare class MenuItem extends MenuItem_base<MenuItemEventMap> {
48
48
  static styles: CSSResultGroup;
49
49
  /**
50
- * 该菜单项的值
50
+ * 菜单项的值
51
51
  */
52
52
  value?: string;
53
53
  /**
54
- * 是否禁用该菜单项
54
+ * 是否禁用菜单项
55
55
  */
56
56
  disabled: boolean;
57
57
  /**
58
58
  * 左侧的 Material Icons 图标名。也可以通过 `slot="icon"` 设置
59
59
  *
60
- * 如果需要在左侧留出一个图标的位置,可以传入空字符串进行占位
60
+ * 如果左侧不需要显示图标,但需要预留一个图标的位置,可传入空字符串进行占位
61
61
  */
62
62
  icon?: string;
63
63
  /**
@@ -30,7 +30,7 @@ import '../icon.js';
30
30
  import { RippleMixin } from '../ripple/ripple-mixin.js';
31
31
  import { menuItemStyle } from './menu-item-style.js';
32
32
  /**
33
- * @summary 菜单项组件
33
+ * @summary 菜单项组件。需配合 `<mdui-menu>` 组件使用
34
34
  *
35
35
  * ```html
36
36
  * <mdui-menu>
@@ -66,7 +66,7 @@ let MenuItem = class MenuItem extends AnchorMixin(RippleMixin(FocusableMixin(Mdu
66
66
  constructor() {
67
67
  super();
68
68
  /**
69
- * 是否禁用该菜单项
69
+ * 是否禁用菜单项
70
70
  */
71
71
  this.disabled = false;
72
72
  /**
@@ -208,7 +208,11 @@ let MenuItem = class MenuItem extends AnchorMixin(RippleMixin(FocusableMixin(Mdu
208
208
  'has-end-text': hasEndText,
209
209
  'has-end-icon': hasEndIcon,
210
210
  });
211
- return html `<mdui-ripple ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.href && !this.disabled
211
+ return html `<mdui-ripple
212
+ ${ref(this.rippleRef)}
213
+ .noRipple=${this.noRipple}
214
+ ></mdui-ripple>
215
+ ${this.href && !this.disabled
212
216
  ? this.renderAnchor({
213
217
  part: 'container',
214
218
  className,
@@ -216,7 +220,20 @@ let MenuItem = class MenuItem extends AnchorMixin(RippleMixin(FocusableMixin(Mdu
216
220
  refDirective: ref(this.containerRef),
217
221
  tabIndex: this.focusable ? 0 : -1,
218
222
  })
219
- : html `<div part="container" ${ref(this.containerRef)} class="${className}">${this.renderInner(useDefaultEndIcon, hasIcon)}</div>`} ${when(hasSubmenu, () => html `<slot name="submenu" ${ref(this.submenuRef)} part="submenu" class="submenu" hidden></slot>`)}`;
223
+ : html `<div
224
+ part="container"
225
+ ${ref(this.containerRef)}
226
+ class=${className}
227
+ >
228
+ ${this.renderInner(useDefaultEndIcon, hasIcon)}
229
+ </div>`}
230
+ ${when(hasSubmenu, () => html `<slot
231
+ name="submenu"
232
+ ${ref(this.submenuRef)}
233
+ part="submenu"
234
+ class="submenu"
235
+ hidden
236
+ ></slot>`)}`;
220
237
  }
221
238
  /**
222
239
  * 点击子菜单外面的区域,关闭子菜单
@@ -344,17 +361,42 @@ let MenuItem = class MenuItem extends AnchorMixin(RippleMixin(FocusableMixin(Mdu
344
361
  });
345
362
  }
346
363
  renderInner(useDefaultEndIcon, hasIcon) {
347
- return html `<slot name="custom">${this.selected
348
- ? html `<slot name="selected-icon" part="selected-icon" class="selected-icon">${this.selectedIcon
349
- ? html `<mdui-icon name="${this.selectedIcon}" class="i"></mdui-icon>`
350
- : html `<mdui-icon-check class="i"></mdui-icon-check>`}</slot>`
351
- : html `<slot name="icon" part="icon" class="icon">${hasIcon
352
- ? html `<mdui-icon name="${this.icon}" class="i"></mdui-icon>`
353
- : nothingTemplate}</slot>`}<div class="label-container"><slot part="label" class="label"></slot></div><slot name="end-text" part="end-text" class="end-text">${this.endText}</slot>${useDefaultEndIcon
354
- ? html `<mdui-icon-arrow-right part="end-icon" class="end-icon arrow-right"></mdui-icon-arrow-right>`
355
- : html `<slot name="end-icon" part="end-icon" class="end-icon">${this.endIcon
356
- ? html `<mdui-icon name="${this.endIcon}"></mdui-icon>`
357
- : nothingTemplate}</slot>`}</slot>`;
364
+ return html `<slot name="custom">
365
+ ${this.selected
366
+ ? html `<slot
367
+ name="selected-icon"
368
+ part="selected-icon"
369
+ class="selected-icon"
370
+ >
371
+ ${this.selectedIcon
372
+ ? html `<mdui-icon
373
+ name=${this.selectedIcon}
374
+ class="i"
375
+ ></mdui-icon>`
376
+ : html `<mdui-icon-check class="i"></mdui-icon-check>`}
377
+ </slot>`
378
+ : html `<slot name="icon" part="icon" class="icon">
379
+ ${hasIcon
380
+ ? html `<mdui-icon name=${this.icon} class="i"></mdui-icon>`
381
+ : nothingTemplate}
382
+ </slot>`}
383
+ <div class="label-container">
384
+ <slot part="label" class="label"></slot>
385
+ </div>
386
+ <slot name="end-text" part="end-text" class="end-text">
387
+ ${this.endText}
388
+ </slot>
389
+ ${useDefaultEndIcon
390
+ ? html `<mdui-icon-arrow-right
391
+ part="end-icon"
392
+ class="end-icon arrow-right"
393
+ ></mdui-icon-arrow-right>`
394
+ : html `<slot name="end-icon" part="end-icon" class="end-icon">
395
+ ${this.endIcon
396
+ ? html `<mdui-icon name=${this.endIcon}></mdui-icon>`
397
+ : nothingTemplate}
398
+ </slot>`}
399
+ </slot>`;
358
400
  }
359
401
  };
360
402
  MenuItem.styles = [
@@ -1,2 +1,20 @@
1
1
  import { css } from 'lit';
2
- export const menuStyle = css `:host{--shape-corner:var(--mdui-shape-corner-extra-small);position:relative;display:block;border-radius:var(--shape-corner);background-color:rgb(var(--mdui-color-surface-container));box-shadow:var(--mdui-elevation-level2);min-width:7rem;max-width:17.5rem;padding-top:.5rem;padding-bottom:.5rem;--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}::slotted(mdui-divider){margin-top:.5rem;margin-bottom:.5rem}`;
2
+ export const menuStyle = css `
3
+ :host {
4
+ --shape-corner: var(--mdui-shape-corner-extra-small);
5
+ position: relative;
6
+ display: block;
7
+ border-radius: var(--shape-corner);
8
+ background-color: rgb(var(--mdui-color-surface-container));
9
+ box-shadow: var(--mdui-elevation-level2);
10
+ min-width: 7rem;
11
+ max-width: 17.5rem;
12
+ padding-top: 0.5rem;
13
+ padding-bottom: 0.5rem;
14
+ --mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
15
+ }
16
+ ::slotted(mdui-divider) {
17
+ margin-top: 0.5rem;
18
+ margin-bottom: 0.5rem;
19
+ }
20
+ `;
@@ -15,7 +15,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
15
15
  * * `Enter` - 包含子菜单时,打开子菜单;为链接时,跳转链接
16
16
  * * `Escape` - 子菜单已打开时,关闭子菜单
17
17
  *
18
- * @summary 菜单组件。需与 `<mdui-menu-item>` 组件配合使用
18
+ * @summary 菜单组件。需配合 `<mdui-menu-item>` 组件使用
19
19
  *
20
20
  * ```html
21
21
  * <mdui-menu>
@@ -24,49 +24,46 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
24
24
  * </mdui-menu>
25
25
  * ```
26
26
  *
27
- * @event change - 菜单项的选中状态变化时触发
27
+ * @event change - 菜单项选中状态变化时触发
28
28
  *
29
29
  * @slot - 子菜单项(`<mdui-menu-item>`)、分割线([`<mdui-divider>`](/docs/2/components/divider))等元素
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
  export declare class Menu extends MduiElement<MenuEventMap> {
34
34
  static styles: CSSResultGroup;
35
35
  /**
36
- * 菜单项的可选中状态。默认为不可选中。可选值为:
36
+ * 菜单项的可选状态。默认不可选。可选值包括:
37
37
  *
38
- * * `single`:最多只能选中一个
39
- * * `multiple`:可以选中多个
38
+ * * `single`:单选
39
+ * * `multiple`:多选
40
40
  */
41
- selects?: /*最多只能选中一个*/ 'single' | /*可以选中多个*/ 'multiple';
41
+ selects?: /*单选*/ 'single' | /*多选*/ 'multiple';
42
42
  /**
43
- * 当前选中的 `<mdui-menu-item>` 的值
43
+ * 当前选中的 `<mdui-menu-item>` 的值。
44
44
  *
45
- * Note:
46
- * 该属性的 HTML 属性始终为字符串,且仅在 `selects="single"` 时可以通过 HTML 属性设置初始值;
47
- * 该属性的 JavaScript 属性值在 `selects="single"` 时为字符串、在 `selects="multiple"` 时为字符串数组。
48
- * 所以,在 `selects="multiple"` 时,如果要修改该值,只能通过修改 JavaScript 属性值实现。
45
+ * **Note**:该属性的 HTML 属性始终为字符串,仅在 `selects="single"` 时可通过 HTML 属性设置初始值;该属性的 JavaScript 属性值在 `selects="single"` 时为字符串,在 `selects="multiple"` 时为字符串数组。因此,在 `selects="multiple"` 时,若要修改该值,只能通过修改 JavaScript 属性值实现。
49
46
  */
50
47
  value?: string | string[];
51
48
  /**
52
- * 菜单项是否使用更紧凑的布局
49
+ * 菜单项是否使用紧凑布局
53
50
  */
54
51
  dense: boolean;
55
52
  /**
56
- * 子菜单的触发方式,支持传入多个值,用空格分隔。可选值为:
53
+ * 子菜单的触发方式,支持多个值,用空格分隔。可选值包括:
57
54
  *
58
55
  * * `click`:点击菜单项时打开子菜单
59
56
  * * `hover`:鼠标悬浮到菜单项上时打开子菜单
60
57
  * * `focus`:聚焦到菜单项上时打开子菜单
61
- * * `manual`:使用了该值时,只能使用编程方式打开和关闭子菜单,且不能再指定其他触发方式
58
+ * * `manual`:仅能通过编程方式打开和关闭子菜单,不能再指定其他触发方式
62
59
  */
63
- submenuTrigger: /*点击菜单项时打开子菜单*/ 'click' | /*鼠标悬浮到菜单项上时打开子菜单*/ 'hover' | /*聚焦到菜单项上时打开子菜单*/ 'focus' | /*使用了该值时,只能使用编程方式打开和关闭子菜单,且不能再指定其他触发方式*/ 'manual' | string;
60
+ submenuTrigger: /*点击菜单项时打开子菜单*/ 'click' | /*鼠标悬浮到菜单项上时打开子菜单*/ 'hover' | /*聚焦到菜单项上时打开子菜单*/ 'focus' | /*仅能通过编程方式打开和关闭子菜单,不能再指定其他触发方式*/ 'manual' | string;
64
61
  /**
65
- * 通过 hover 触发子菜单打开时的延时,单位为毫秒
62
+ * 鼠标悬浮触发子菜单打开的延时,单位毫秒
66
63
  */
67
64
  submenuOpenDelay: number;
68
65
  /**
69
- * 通过 hover 触发子菜单关闭时的延时,单位为毫秒
66
+ * 鼠标悬浮触发子菜单关闭的延时,单位毫秒
70
67
  */
71
68
  submenuCloseDelay: number;
72
69
  private selectedKeys;
@@ -26,7 +26,7 @@ import { menuStyle } from './menu-style.js';
26
26
  * * `Enter` - 包含子菜单时,打开子菜单;为链接时,跳转链接
27
27
  * * `Escape` - 子菜单已打开时,关闭子菜单
28
28
  *
29
- * @summary 菜单组件。需与 `<mdui-menu-item>` 组件配合使用
29
+ * @summary 菜单组件。需配合 `<mdui-menu-item>` 组件使用
30
30
  *
31
31
  * ```html
32
32
  * <mdui-menu>
@@ -35,34 +35,34 @@ import { menuStyle } from './menu-style.js';
35
35
  * </mdui-menu>
36
36
  * ```
37
37
  *
38
- * @event change - 菜单项的选中状态变化时触发
38
+ * @event change - 菜单项选中状态变化时触发
39
39
  *
40
40
  * @slot - 子菜单项(`<mdui-menu-item>`)、分割线([`<mdui-divider>`](/docs/2/components/divider))等元素
41
41
  *
42
- * @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
42
+ * @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
43
43
  */
44
44
  let Menu = class Menu extends MduiElement {
45
45
  constructor() {
46
46
  super(...arguments);
47
47
  /**
48
- * 菜单项是否使用更紧凑的布局
48
+ * 菜单项是否使用紧凑布局
49
49
  */
50
50
  this.dense = false;
51
51
  /**
52
- * 子菜单的触发方式,支持传入多个值,用空格分隔。可选值为:
52
+ * 子菜单的触发方式,支持多个值,用空格分隔。可选值包括:
53
53
  *
54
54
  * * `click`:点击菜单项时打开子菜单
55
55
  * * `hover`:鼠标悬浮到菜单项上时打开子菜单
56
56
  * * `focus`:聚焦到菜单项上时打开子菜单
57
- * * `manual`:使用了该值时,只能使用编程方式打开和关闭子菜单,且不能再指定其他触发方式
57
+ * * `manual`:仅能通过编程方式打开和关闭子菜单,不能再指定其他触发方式
58
58
  */
59
59
  this.submenuTrigger = 'click hover';
60
60
  /**
61
- * 通过 hover 触发子菜单打开时的延时,单位为毫秒
61
+ * 鼠标悬浮触发子菜单打开的延时,单位毫秒
62
62
  */
63
63
  this.submenuOpenDelay = 200;
64
64
  /**
65
- * 通过 hover 触发子菜单关闭时的延时,单位为毫秒
65
+ * 鼠标悬浮触发子菜单关闭的延时,单位毫秒
66
66
  */
67
67
  this.submenuCloseDelay = 200;
68
68
  // 因为 menu-item 的 value 可能会重复,所有在每一个 menu-item 元素上都加了一个唯一的 key 属性,通过 selectedKeys 来记录选中状态的 key
@@ -226,7 +226,11 @@ let Menu = class Menu extends MduiElement {
226
226
  });
227
227
  }
228
228
  render() {
229
- return html `<slot @slotchange="${this.onSlotChange}" @click="${this.onClick}" @keydown="${this.onKeyDown}"></slot>`;
229
+ return html `<slot
230
+ @slotchange=${this.onSlotChange}
231
+ @click=${this.onClick}
232
+ @keydown=${this.onKeyDown}
233
+ ></slot>`;
230
234
  }
231
235
  setSelectedKeys(selectedKeys) {
232
236
  if (!arraysEqualIgnoreOrder(this.selectedKeys, selectedKeys)) {
@@ -1,2 +1,133 @@
1
1
  import { css } from 'lit';
2
- export const navigationBarItemStyle = css `:host{--shape-corner-indicator:var(--mdui-shape-corner-full);position:relative;z-index:0;flex:1;overflow:hidden;min-width:3rem;--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface-variant)}.container{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;text-decoration:none;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;padding-top:.75rem;padding-bottom:.75rem}.container:not(.initial){transition:padding var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}mdui-ripple{z-index:1;left:50%;transform:translateX(-50%);width:4rem;height:2rem;margin-top:.75rem;border-radius:var(--mdui-shape-corner-full)}mdui-ripple:not(.initial){transition:margin-top var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}.indicator{position:relative;display:flex;align-items:center;justify-content:center;background-color:transparent;border-radius:var(--shape-corner-indicator);height:2rem;width:2rem}:not(.initial) .indicator{transition:background-color var(--mdui-motion-duration-short1) var(--mdui-motion-easing-standard),width var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}::slotted([slot=badge]){position:absolute;transform:translate(50%,-50%)}::slotted([slot=badge][variant=small]){transform:translate(.5625rem,-.5625rem)}.active-icon,.icon{color:rgb(var(--mdui-color-on-surface-variant));font-size:1.5rem}.active-icon mdui-icon,.icon mdui-icon,::slotted([slot=active]),::slotted([slot=icon]){font-size:inherit}.icon{display:flex}.active-icon{display:none}.label{display:flex;align-items:center;height:1rem;color:rgb(var(--mdui-color-on-surface-variant));margin-top:.25rem;margin-bottom:.25rem;font-size:var(--mdui-typescale-label-medium-size);font-weight:var(--mdui-typescale-label-medium-weight);letter-spacing:var(--mdui-typescale-label-medium-tracking);line-height:var(--mdui-typescale-label-medium-line-height)}:not(.initial) .label{transition:opacity var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear)}:host(:not([active])) mdui-ripple.label-visibility-selected,mdui-ripple.label-visibility-unlabeled{margin-top:1.5rem}.container.label-visibility-unlabeled,:host(:not([active])) .container.label-visibility-selected{padding-top:1.5rem;padding-bottom:0}.container.label-visibility-unlabeled .label,:host(:not([active])) .container.label-visibility-selected .label{opacity:0}:host([active]){--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([active]) .indicator{width:4rem;background-color:rgb(var(--mdui-color-secondary-container))}:host([active]) .active-icon,:host([active]) .icon{color:rgb(var(--mdui-color-on-secondary-container))}:host([active]) .has-active-icon .active-icon{display:flex}:host([active]) .has-active-icon .icon{display:none}:host([active]) .label{color:rgb(var(--mdui-color-on-surface))}`;
2
+ export const navigationBarItemStyle = css `
3
+ :host {
4
+ --shape-corner-indicator: var(--mdui-shape-corner-full);
5
+ position: relative;
6
+ z-index: 0;
7
+ flex: 1;
8
+ overflow: hidden;
9
+ min-width: 3rem;
10
+ --mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface-variant);
11
+ }
12
+ .container {
13
+ display: flex;
14
+ flex-direction: column;
15
+ align-items: center;
16
+ justify-content: center;
17
+ height: 100%;
18
+ text-decoration: none;
19
+ cursor: pointer;
20
+ -webkit-user-select: none;
21
+ user-select: none;
22
+ -webkit-tap-highlight-color: transparent;
23
+ padding-top: 0.75rem;
24
+ padding-bottom: 0.75rem;
25
+ }
26
+ .container:not(.initial) {
27
+ transition: padding var(--mdui-motion-duration-short4)
28
+ var(--mdui-motion-easing-standard);
29
+ }
30
+ mdui-ripple {
31
+ z-index: 1;
32
+ left: 50%;
33
+ transform: translateX(-50%);
34
+ width: 4rem;
35
+ height: 2rem;
36
+ margin-top: 0.75rem;
37
+ border-radius: var(--mdui-shape-corner-full);
38
+ }
39
+ mdui-ripple:not(.initial) {
40
+ transition: margin-top var(--mdui-motion-duration-short4)
41
+ var(--mdui-motion-easing-standard);
42
+ }
43
+ .indicator {
44
+ position: relative;
45
+ display: flex;
46
+ align-items: center;
47
+ justify-content: center;
48
+ background-color: transparent;
49
+ border-radius: var(--shape-corner-indicator);
50
+ height: 2rem;
51
+ width: 2rem;
52
+ }
53
+ :not(.initial) .indicator {
54
+ transition:
55
+ background-color var(--mdui-motion-duration-short1)
56
+ var(--mdui-motion-easing-standard),
57
+ width var(--mdui-motion-duration-short4)
58
+ var(--mdui-motion-easing-standard);
59
+ }
60
+ ::slotted([slot='badge']) {
61
+ position: absolute;
62
+ transform: translate(50%, -50%);
63
+ }
64
+ ::slotted([slot='badge'][variant='small']) {
65
+ transform: translate(0.5625rem, -0.5625rem);
66
+ }
67
+ .icon,
68
+ .active-icon {
69
+ color: rgb(var(--mdui-color-on-surface-variant));
70
+ font-size: 1.5rem;
71
+ }
72
+ .icon mdui-icon,
73
+ .active-icon mdui-icon,
74
+ ::slotted([slot='icon']),
75
+ ::slotted([slot='active']) {
76
+ font-size: inherit;
77
+ }
78
+ .icon {
79
+ display: flex;
80
+ }
81
+ .active-icon {
82
+ display: none;
83
+ }
84
+ .label {
85
+ display: flex;
86
+ align-items: center;
87
+ height: 1rem;
88
+ color: rgb(var(--mdui-color-on-surface-variant));
89
+ margin-top: 0.25rem;
90
+ margin-bottom: 0.25rem;
91
+ font-size: var(--mdui-typescale-label-medium-size);
92
+ font-weight: var(--mdui-typescale-label-medium-weight);
93
+ letter-spacing: var(--mdui-typescale-label-medium-tracking);
94
+ line-height: var(--mdui-typescale-label-medium-line-height);
95
+ }
96
+ :not(.initial) .label {
97
+ transition: opacity var(--mdui-motion-duration-short4)
98
+ var(--mdui-motion-easing-linear);
99
+ }
100
+ mdui-ripple.label-visibility-unlabeled,
101
+ :host(:not([active])) mdui-ripple.label-visibility-selected {
102
+ margin-top: 1.5rem;
103
+ }
104
+ .container.label-visibility-unlabeled,
105
+ :host(:not([active])) .container.label-visibility-selected {
106
+ padding-top: 1.5rem;
107
+ padding-bottom: 0rem;
108
+ }
109
+ .container.label-visibility-unlabeled .label,
110
+ :host(:not([active])) .container.label-visibility-selected .label {
111
+ opacity: 0;
112
+ }
113
+ :host([active]) {
114
+ --mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
115
+ }
116
+ :host([active]) .indicator {
117
+ width: 4rem;
118
+ background-color: rgb(var(--mdui-color-secondary-container));
119
+ }
120
+ :host([active]) .icon,
121
+ :host([active]) .active-icon {
122
+ color: rgb(var(--mdui-color-on-secondary-container));
123
+ }
124
+ :host([active]) .has-active-icon .active-icon {
125
+ display: flex;
126
+ }
127
+ :host([active]) .has-active-icon .icon {
128
+ display: none;
129
+ }
130
+ :host([active]) .label {
131
+ color: rgb(var(--mdui-color-on-surface));
132
+ }
133
+ `;
@@ -4,7 +4,7 @@ import type { Ripple } from '../ripple/index.js';
4
4
  import type { CSSResultGroup, TemplateResult } from 'lit';
5
5
  declare const NavigationBarItem_base: import("@open-wc/dedupe-mixin").Constructor<import("@mdui/shared/mixins/anchor.js").AnchorMixinInterface> & import("@open-wc/dedupe-mixin").Constructor<import("../ripple/ripple-mixin.js").RippleMixinInterface> & import("@open-wc/dedupe-mixin").Constructor<import("@mdui/shared/mixins/focusable.js").FocusableMixinInterface> & typeof MduiElement;
6
6
  /**
7
- * @summary 底部导航栏项组件。需与 `<mdui-navigation-bar>` 组件配合使用
7
+ * @summary 底部导航栏项组件。需配合 `<mdui-navigation-bar>` 组件使用
8
8
  *
9
9
  * ```html
10
10
  * <mdui-navigation-bar>
@@ -14,7 +14,7 @@ declare const NavigationBarItem_base: import("@open-wc/dedupe-mixin").Constructo
14
14
  * </mdui-navigation-bar>
15
15
  * ```
16
16
  *
17
- * @slot - 文本
17
+ * @slot - 导航项文本
18
18
  * @slot icon - 图标
19
19
  * @slot active-icon - 激活状态的图标元素
20
20
  * @slot badge - 徽标
@@ -27,9 +27,9 @@ declare const NavigationBarItem_base: import("@open-wc/dedupe-mixin").Constructo
27
27
  * @csspart badge - 徽标
28
28
  * @csspart icon - 图标
29
29
  * @csspart active-icon - 激活状态的图标
30
- * @csspart label - 文本
30
+ * @csspart label - 导航项文本
31
31
  *
32
- * @cssprop --shape-corner-indicator - 指示器的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
32
+ * @cssprop --shape-corner-indicator - 指示器的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
33
33
  */
34
34
  export declare class NavigationBarItem extends NavigationBarItem_base<NavigationBarItemEventMap> {
35
35
  static styles: CSSResultGroup;
@@ -42,7 +42,7 @@ export declare class NavigationBarItem extends NavigationBarItem_base<Navigation
42
42
  */
43
43
  activeIcon?: string;
44
44
  /**
45
- * 该导航项的值
45
+ * 导航项的值
46
46
  */
47
47
  value?: string;
48
48
  /**