mdui 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/components/avatar/index.js +7 -2
  2. package/components/avatar/style.js +31 -1
  3. package/components/badge/style.js +25 -1
  4. package/components/bottom-app-bar/style.js +92 -1
  5. package/components/button/button-base-style.js +28 -1
  6. package/components/button/button-base.js +8 -1
  7. package/components/button/index.js +18 -8
  8. package/components/button/style.js +111 -2
  9. package/components/button-icon/index.js +22 -5
  10. package/components/button-icon/style.js +103 -2
  11. package/components/card/index.js +5 -1
  12. package/components/card/style.js +72 -1
  13. package/components/checkbox/index.js +50 -7
  14. package/components/checkbox/style.js +131 -1
  15. package/components/chip/index.js +33 -9
  16. package/components/chip/style.js +205 -2
  17. package/components/circular-progress/index.js +39 -5
  18. package/components/circular-progress/style.js +136 -1
  19. package/components/collapse/collapse-item-style.js +21 -1
  20. package/components/collapse/collapse-item.js +10 -2
  21. package/components/collapse/collapse-style.js +5 -1
  22. package/components/collapse/collapse.js +4 -1
  23. package/components/dialog/index.js +35 -7
  24. package/components/dialog/style.js +116 -1
  25. package/components/divider/style.js +18 -1
  26. package/components/dropdown/index.js +8 -1
  27. package/components/dropdown/style.js +11 -1
  28. package/components/fab/index.js +13 -5
  29. package/components/fab/style.js +153 -4
  30. package/components/icon/index.js +5 -1
  31. package/components/icon/style.js +29 -1
  32. package/components/layout/layout-item-style.js +6 -1
  33. package/components/layout/layout-main-style.js +7 -1
  34. package/components/layout/layout-style.js +11 -1
  35. package/components/linear-progress/index.js +6 -2
  36. package/components/linear-progress/style.js +73 -1
  37. package/components/list/list-item-style.js +153 -2
  38. package/components/list/list-item.js +27 -8
  39. package/components/list/list-style.js +10 -1
  40. package/components/list/list-subheader-style.js +19 -1
  41. package/components/menu/menu-item-style.js +125 -1
  42. package/components/menu/menu-item.js +55 -13
  43. package/components/menu/menu-style.js +19 -1
  44. package/components/menu/menu.js +5 -1
  45. package/components/navigation-bar/navigation-bar-item-style.js +132 -1
  46. package/components/navigation-bar/navigation-bar-item.js +23 -7
  47. package/components/navigation-bar/navigation-bar-style.js +28 -1
  48. package/components/navigation-bar/navigation-bar.js +4 -1
  49. package/components/navigation-drawer/index.js +12 -1
  50. package/components/navigation-drawer/style.js +66 -1
  51. package/components/navigation-rail/navigation-rail-item-style.js +122 -1
  52. package/components/navigation-rail/navigation-rail-item.js +26 -7
  53. package/components/navigation-rail/navigation-rail-style.js +79 -1
  54. package/components/navigation-rail/navigation-rail.js +10 -1
  55. package/components/radio/radio-group-style.js +20 -1
  56. package/components/radio/radio-group.js +19 -1
  57. package/components/radio/radio-style.js +107 -1
  58. package/components/radio/radio.js +23 -5
  59. package/components/range-slider/index.d.ts +1 -1
  60. package/components/range-slider/index.js +53 -5
  61. package/components/ripple/index.js +5 -2
  62. package/components/ripple/style.js +96 -1
  63. package/components/segmented-button/segmented-button-group-style.js +28 -1
  64. package/components/segmented-button/segmented-button-group.js +21 -1
  65. package/components/segmented-button/segmented-button-style.js +81 -2
  66. package/components/segmented-button/segmented-button.js +27 -11
  67. package/components/select/index.js +87 -6
  68. package/components/select/style.js +27 -1
  69. package/components/slider/index.js +33 -2
  70. package/components/slider/slider-base-style.js +173 -1
  71. package/components/slider/slider-base.js +6 -1
  72. package/components/slider/style.js +7 -1
  73. package/components/snackbar/index.js +32 -5
  74. package/components/snackbar/style.js +100 -1
  75. package/components/switch/index.js +40 -6
  76. package/components/switch/style.js +202 -1
  77. package/components/tabs/tab-panel-style.js +10 -1
  78. package/components/tabs/tab-style.js +85 -1
  79. package/components/tabs/tab.js +24 -4
  80. package/components/tabs/tabs-style.js +138 -1
  81. package/components/tabs/tabs.js +9 -1
  82. package/components/text-field/index.js +160 -32
  83. package/components/text-field/style.js +362 -1
  84. package/components/tooltip/index.js +10 -1
  85. package/components/tooltip/style.js +57 -1
  86. package/components/top-app-bar/top-app-bar-style.js +78 -1
  87. package/components/top-app-bar/top-app-bar-title-style.js +81 -1
  88. package/components/top-app-bar/top-app-bar-title.js +17 -3
  89. package/custom-elements.json +1144 -1101
  90. package/html-data.en.json +15 -6
  91. package/html-data.zh-cn.json +15 -6
  92. package/jsx.en.d.ts +2 -2
  93. package/jsx.zh-cn.d.ts +2 -2
  94. package/package.json +2 -2
  95. package/web-types.en.json +20 -4
  96. package/web-types.zh-cn.json +20 -4
  97. package/mdui.esm.js +0 -22
  98. package/mdui.global.js +0 -22
@@ -1,2 +1,30 @@
1
1
  import { css } from 'lit';
2
- export const style = css `:host{display:inline-block;width:1em;height:1em;font-weight:400;font-family:'Material Icons';font-style:normal;line-height:1;direction:ltr;letter-spacing:normal;white-space:nowrap;text-transform:none;word-wrap:normal;-webkit-font-smoothing:antialiased;text-rendering:optimizelegibility;-moz-osx-font-smoothing:grayscale;font-size:1.5rem}::slotted(svg),svg{width:100%;height:100%;fill:currentcolor}`;
2
+ export const style = css `
3
+ :host {
4
+ display: inline-block;
5
+ width: 1em;
6
+ height: 1em;
7
+ font-weight: normal;
8
+ font-family: 'Material Icons';
9
+ font-style: normal;
10
+ line-height: 1;
11
+ direction: ltr;
12
+ letter-spacing: normal;
13
+ white-space: nowrap;
14
+ text-transform: none;
15
+ word-wrap: normal;
16
+ /* Support for all WebKit browsers. */
17
+ -webkit-font-smoothing: antialiased;
18
+ /* Support for Safari and Chrome. */
19
+ text-rendering: optimizelegibility;
20
+ /* Support for Firefox. */
21
+ -moz-osx-font-smoothing: grayscale;
22
+ font-size: 1.5rem;
23
+ }
24
+ svg,
25
+ ::slotted(svg) {
26
+ width: 100%;
27
+ height: 100%;
28
+ fill: currentcolor;
29
+ }
30
+ `;
@@ -1,2 +1,7 @@
1
1
  import { css } from 'lit';
2
- export const layoutItemStyle = css `:host{display:flex;z-index:1}`;
2
+ export const layoutItemStyle = css `
3
+ :host {
4
+ display: flex;
5
+ z-index: 1;
6
+ }
7
+ `;
@@ -1,2 +1,8 @@
1
1
  import { css } from 'lit';
2
- export const layoutMainStyle = css `:host{flex:1 0 auto;max-width:100%;overflow:auto}`;
2
+ export const layoutMainStyle = css `
3
+ :host {
4
+ flex: 1 0 auto;
5
+ max-width: 100%;
6
+ overflow: auto;
7
+ }
8
+ `;
@@ -1,2 +1,12 @@
1
1
  import { css } from 'lit';
2
- export const layoutStyle = css `:host{position:relative;display:flex;flex:1 1 auto;overflow:hidden}:host([full-height]){height:100%}`;
2
+ export const layoutStyle = css `
3
+ :host {
4
+ position: relative;
5
+ display: flex;
6
+ flex: 1 1 auto;
7
+ overflow: hidden;
8
+ }
9
+ :host([full-height]) {
10
+ height: 100%;
11
+ }
12
+ `;
@@ -29,9 +29,13 @@ let LinearProgress = class LinearProgress extends MduiElement {
29
29
  const isDeterminate = !isUndefined(this.value);
30
30
  if (isDeterminate) {
31
31
  const value = this.value;
32
- return html `<div part="indicator" class="determinate" style="${styleMap({
32
+ return html `<div
33
+ part="indicator"
34
+ class="determinate"
35
+ style="${styleMap({
33
36
  width: `${(value / Math.max(this.max ?? value, value)) * 100}%`,
34
- })}"></div>`;
37
+ })}"
38
+ ></div>`;
35
39
  }
36
40
  return html `<div part="indicator" class="indeterminate"></div>`;
37
41
  }
@@ -1,2 +1,74 @@
1
1
  import { css } from 'lit';
2
- export const style = css `:host{--shape-corner:var(--mdui-shape-corner-none);position:relative;display:inline-block;width:100%;overflow:hidden;border-radius:var(--shape-corner);background-color:rgb(var(--mdui-color-surface-container-highest));height:.25rem}.determinate,.indeterminate{background-color:rgb(var(--mdui-color-primary))}.determinate{height:100%;transition:width var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard)}.indeterminate::before{position:absolute;top:0;bottom:0;left:0;background-color:inherit;animation:mdui-comp-progress-indeterminate 2s var(--mdui-motion-easing-linear) infinite;content:' '}.indeterminate::after{position:absolute;top:0;bottom:0;left:0;background-color:inherit;animation:mdui-comp-progress-indeterminate-short 2s var(--mdui-motion-easing-linear) infinite;content:' '}@keyframes mdui-comp-progress-indeterminate{0%{left:0;width:0}50%{left:30%;width:70%}75%{left:100%;width:0}}@keyframes mdui-comp-progress-indeterminate-short{0%{left:0;width:0}50%{left:0;width:0}75%{left:0;width:25%}100%{left:100%;width:0}}`;
2
+ export const style = css `
3
+ :host {
4
+ --shape-corner: var(--mdui-shape-corner-none);
5
+ position: relative;
6
+ display: inline-block;
7
+ width: 100%;
8
+ overflow: hidden;
9
+ border-radius: var(--shape-corner);
10
+ background-color: rgb(var(--mdui-color-surface-container-highest));
11
+ height: 0.25rem;
12
+ }
13
+ .determinate,
14
+ .indeterminate {
15
+ background-color: rgb(var(--mdui-color-primary));
16
+ }
17
+ .determinate {
18
+ height: 100%;
19
+ transition: width var(--mdui-motion-duration-long2)
20
+ var(--mdui-motion-easing-standard);
21
+ }
22
+ .indeterminate::before {
23
+ position: absolute;
24
+ top: 0;
25
+ bottom: 0;
26
+ left: 0;
27
+ background-color: inherit;
28
+ animation: mdui-comp-progress-indeterminate 2s
29
+ var(--mdui-motion-easing-linear) infinite;
30
+ content: ' ';
31
+ }
32
+ .indeterminate::after {
33
+ position: absolute;
34
+ top: 0;
35
+ bottom: 0;
36
+ left: 0;
37
+ background-color: inherit;
38
+ animation: mdui-comp-progress-indeterminate-short 2s
39
+ var(--mdui-motion-easing-linear) infinite;
40
+ content: ' ';
41
+ }
42
+ @keyframes mdui-comp-progress-indeterminate {
43
+ 0% {
44
+ left: 0;
45
+ width: 0;
46
+ }
47
+ 50% {
48
+ left: 30%;
49
+ width: 70%;
50
+ }
51
+ 75% {
52
+ left: 100%;
53
+ width: 0;
54
+ }
55
+ }
56
+ @keyframes mdui-comp-progress-indeterminate-short {
57
+ 0% {
58
+ left: 0;
59
+ width: 0;
60
+ }
61
+ 50% {
62
+ left: 0;
63
+ width: 0;
64
+ }
65
+ 75% {
66
+ left: 0;
67
+ width: 25%;
68
+ }
69
+ 100% {
70
+ left: 100%;
71
+ width: 0;
72
+ }
73
+ }
74
+ `;
@@ -1,4 +1,155 @@
1
1
  import { css } from 'lit';
2
- export const listItemStyle = css `:host{--shape-corner:var(--mdui-shape-corner-none);--shape-corner-rounded:var(--mdui-shape-corner-extra-large);position:relative;display:block;border-radius:var(--shape-corner);--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([rounded]),:host([rounded]) mdui-ripple{border-radius:var(--shape-corner-rounded)}:host([active]){background-color:rgb(var(--mdui-color-secondary-container));--mdui-comp-ripple-state-layer-color:var(
2
+ export const listItemStyle = css `
3
+ :host {
4
+ --shape-corner: var(--mdui-shape-corner-none);
5
+ --shape-corner-rounded: var(--mdui-shape-corner-extra-large);
6
+ position: relative;
7
+ display: block;
8
+ border-radius: var(--shape-corner);
9
+ --mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
10
+ }
11
+ :host([rounded]),
12
+ :host([rounded]) mdui-ripple {
13
+ border-radius: var(--shape-corner-rounded);
14
+ }
15
+ :host([active]) {
16
+ background-color: rgb(var(--mdui-color-secondary-container));
17
+ --mdui-comp-ripple-state-layer-color: var(
3
18
  --mdui-color-on-secondary-container
4
- )}:host([disabled]){pointer-events:none}.container{cursor:pointer;-webkit-user-select:none;user-select:none;text-decoration:none;color:inherit;-webkit-tap-highlight-color:transparent}:host([disabled]) .container{cursor:default;opacity:.38}:host([nonclickable]:not([href])) .container{cursor:auto;-webkit-user-select:auto;user-select:auto}.preset{display:flex;align-items:center;padding:.5rem 1.5rem .5rem 1rem;min-height:3.5rem}:host([alignment=start]) .preset{align-items:flex-start}:host([alignment=end]) .preset{align-items:flex-end}.body{display:flex;flex:1 1 100%;flex-direction:column;justify-content:center;min-width:0}.headline{display:block;color:rgb(var(--mdui-color-on-surface));font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height)}:host([active]) .headline{color:rgb(var(--mdui-color-on-secondary-container))}.description{display:none;color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-body-medium-size);font-weight:var(--mdui-typescale-body-medium-weight);letter-spacing:var(--mdui-typescale-body-medium-tracking);line-height:var(--mdui-typescale-body-medium-line-height)}:host([disabled]) .description,:host([focused]) .description,:host([hover]) .description,:host([pressed]) .description{color:rgb(var(--mdui-color-on-surface))}.has-description .description{display:block}:host([description-line='1']) .description,:host([headline-line='1']) .headline{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host([description-line='2']) .description,:host([description-line='3']) .description,:host([headline-line='2']) .headline,:host([headline-line='3']) .headline{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}:host([description-line='2']) .description,:host([headline-line='2']) .headline{-webkit-line-clamp:2}:host([description-line='3']) .description,:host([headline-line='3']) .headline{-webkit-line-clamp:3}.end-icon,.icon{display:flex;flex:0 0 auto;font-size:var(--mdui-typescale-label-small-size);font-weight:var(--mdui-typescale-label-small-weight);letter-spacing:var(--mdui-typescale-label-small-tracking);line-height:var(--mdui-typescale-label-small-line-height);color:rgb(var(--mdui-color-on-surface-variant))}:host([disabled]) .end-icon,:host([disabled]) .icon,:host([focused]) .end-icon,:host([focused]) .icon,:host([hover]) .end-icon,:host([hover]) .icon,:host([pressed]) .end-icon,:host([pressed]) .icon{color:rgb(var(--mdui-color-on-surface))}:host([active]) .end-icon,:host([active]) .icon{color:rgb(var(--mdui-color-on-secondary-container))}.end-icon mdui-icon,.icon mdui-icon,.is-end-icon ::slotted([slot=end-icon]),.is-icon ::slotted([slot=icon]){font-size:1.5rem}.has-icon .icon{margin-right:1rem}.has-icon ::slotted(mdui-checkbox[slot=icon]),.has-icon ::slotted(mdui-radio[slot=icon]){margin-left:-.5rem}.has-end-icon .end-icon{margin-left:1rem}.has-end-icon ::slotted(mdui-checkbox[slot=end-icon]),.has-end-icon ::slotted(mdui-radio[slot=end-icon]){margin-right:-.5rem}`;
19
+ );
20
+ }
21
+ :host([disabled]) {
22
+ pointer-events: none;
23
+ }
24
+ .container {
25
+ cursor: pointer;
26
+ -webkit-user-select: none;
27
+ user-select: none;
28
+ text-decoration: none;
29
+ color: inherit;
30
+ -webkit-tap-highlight-color: transparent;
31
+ }
32
+ :host([disabled]) .container {
33
+ cursor: default;
34
+ opacity: 0.38;
35
+ }
36
+ :host([nonclickable]:not([href])) .container {
37
+ cursor: auto;
38
+ -webkit-user-select: auto;
39
+ user-select: auto;
40
+ }
41
+ .preset {
42
+ display: flex;
43
+ align-items: center;
44
+ padding: 0.5rem 1.5rem 0.5rem 1rem;
45
+ min-height: 3.5rem;
46
+ }
47
+ :host([alignment='start']) .preset {
48
+ align-items: flex-start;
49
+ }
50
+ :host([alignment='end']) .preset {
51
+ align-items: flex-end;
52
+ }
53
+ .body {
54
+ display: flex;
55
+ flex: 1 1 100%;
56
+ flex-direction: column;
57
+ justify-content: center;
58
+ min-width: 0;
59
+ }
60
+ .headline {
61
+ display: block;
62
+ color: rgb(var(--mdui-color-on-surface));
63
+ font-size: var(--mdui-typescale-body-large-size);
64
+ font-weight: var(--mdui-typescale-body-large-weight);
65
+ letter-spacing: var(--mdui-typescale-body-large-tracking);
66
+ line-height: var(--mdui-typescale-body-large-line-height);
67
+ }
68
+ :host([active]) .headline {
69
+ color: rgb(var(--mdui-color-on-secondary-container));
70
+ }
71
+ .description {
72
+ display: none;
73
+ color: rgb(var(--mdui-color-on-surface-variant));
74
+ font-size: var(--mdui-typescale-body-medium-size);
75
+ font-weight: var(--mdui-typescale-body-medium-weight);
76
+ letter-spacing: var(--mdui-typescale-body-medium-tracking);
77
+ line-height: var(--mdui-typescale-body-medium-line-height);
78
+ }
79
+ :host([disabled]) .description,
80
+ :host([hover]) .description,
81
+ :host([focused]) .description,
82
+ :host([pressed]) .description {
83
+ color: rgb(var(--mdui-color-on-surface));
84
+ }
85
+ .has-description .description {
86
+ display: block;
87
+ }
88
+ :host([headline-line='1']) .headline,
89
+ :host([description-line='1']) .description {
90
+ overflow: hidden;
91
+ white-space: nowrap;
92
+ text-overflow: ellipsis;
93
+ }
94
+ :host([headline-line='2']) .headline,
95
+ :host([description-line='2']) .description,
96
+ :host([headline-line='3']) .headline,
97
+ :host([description-line='3']) .description {
98
+ display: -webkit-box;
99
+ overflow: hidden;
100
+ text-overflow: ellipsis;
101
+ -webkit-box-orient: vertical;
102
+ }
103
+ :host([headline-line='2']) .headline,
104
+ :host([description-line='2']) .description {
105
+ -webkit-line-clamp: 2;
106
+ }
107
+ :host([headline-line='3']) .headline,
108
+ :host([description-line='3']) .description {
109
+ -webkit-line-clamp: 3;
110
+ }
111
+ .icon,
112
+ .end-icon {
113
+ display: flex;
114
+ flex: 0 0 auto;
115
+ font-size: var(--mdui-typescale-label-small-size);
116
+ font-weight: var(--mdui-typescale-label-small-weight);
117
+ letter-spacing: var(--mdui-typescale-label-small-tracking);
118
+ line-height: var(--mdui-typescale-label-small-line-height);
119
+ color: rgb(var(--mdui-color-on-surface-variant));
120
+ }
121
+ :host([disabled]) .icon,
122
+ :host([disabled]) .end-icon,
123
+ :host([hover]) .icon,
124
+ :host([hover]) .end-icon,
125
+ :host([focused]) .icon,
126
+ :host([focused]) .end-icon,
127
+ :host([pressed]) .icon,
128
+ :host([pressed]) .end-icon {
129
+ color: rgb(var(--mdui-color-on-surface));
130
+ }
131
+ :host([active]) .icon,
132
+ :host([active]) .end-icon {
133
+ color: rgb(var(--mdui-color-on-secondary-container));
134
+ }
135
+ .icon mdui-icon,
136
+ .end-icon mdui-icon,
137
+ .is-icon ::slotted([slot='icon']),
138
+ .is-end-icon ::slotted([slot='end-icon']) {
139
+ font-size: 1.5rem;
140
+ }
141
+ .has-icon .icon {
142
+ margin-right: 1rem;
143
+ }
144
+ .has-icon ::slotted(mdui-checkbox[slot='icon']),
145
+ .has-icon ::slotted(mdui-radio[slot='icon']) {
146
+ margin-left: -0.5rem;
147
+ }
148
+ .has-end-icon .end-icon {
149
+ margin-left: 1rem;
150
+ }
151
+ .has-end-icon ::slotted(mdui-checkbox[slot='end-icon']),
152
+ .has-end-icon ::slotted(mdui-radio[slot='end-icon']) {
153
+ margin-right: -0.5rem;
154
+ }
155
+ `;
@@ -103,24 +103,43 @@ let ListItem = class ListItem extends AnchorMixin(RippleMixin(FocusableMixin(Mdu
103
103
  // end-icon slot 中的元素是否为 mdui-icon 或 mdui-icon-* 组件
104
104
  'is-end-icon': getNodeName(this.endIconElements[0]).startsWith('mdui-icon-'),
105
105
  });
106
- return html `<mdui-ripple ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.href && !this.disabled
106
+ return html `<mdui-ripple
107
+ ${ref(this.rippleRef)}
108
+ .noRipple=${this.noRipple}
109
+ ></mdui-ripple>
110
+ ${this.href && !this.disabled
107
111
  ? this.renderAnchor({
108
112
  className,
109
113
  content: this.renderInner(),
110
114
  part: 'container',
111
115
  refDirective: ref(this.itemRef),
112
116
  })
113
- : html `<div part="container" class="${className}" ${ref(this.itemRef)}>${this.renderInner()}</div>`}`;
117
+ : html `<div part="container" class="${className}" ${ref(this.itemRef)}>
118
+ ${this.renderInner()}
119
+ </div>`}`;
114
120
  }
115
121
  renderInner() {
116
122
  const hasDefaultSlot = this.hasSlotController.test('[default]');
117
- return html `<slot name="custom"><slot name="icon" part="icon" class="icon">${this.icon
118
- ? html `<mdui-icon name="${this.icon}"></mdui-icon>`
119
- : nothingTemplate}</slot><div part="body" class="body">${hasDefaultSlot
123
+ return html `<slot name="custom">
124
+ <slot name="icon" part="icon" class="icon">
125
+ ${this.icon
126
+ ? html `<mdui-icon name=${this.icon}></mdui-icon>`
127
+ : nothingTemplate}
128
+ </slot>
129
+ <div part="body" class="body">
130
+ ${hasDefaultSlot
120
131
  ? html `<slot part="headline" class="headline"></slot>`
121
- : html `<div part="headline" class="headline">${this.headline}</div>`}<slot name="description" part="description" class="description">${this.description}</slot></div><slot name="end-icon" part="end-icon" class="end-icon">${this.endIcon
122
- ? html `<mdui-icon name="${this.endIcon}"></mdui-icon>`
123
- : nothingTemplate}</slot></slot>`;
132
+ : html `<div part="headline" class="headline">${this.headline}</div>`}
133
+ <slot name="description" part="description" class="description">
134
+ ${this.description}
135
+ </slot>
136
+ </div>
137
+ <slot name="end-icon" part="end-icon" class="end-icon">
138
+ ${this.endIcon
139
+ ? html `<mdui-icon name=${this.endIcon}></mdui-icon>`
140
+ : nothingTemplate}
141
+ </slot>
142
+ </slot>`;
124
143
  }
125
144
  };
126
145
  ListItem.styles = [
@@ -1,2 +1,11 @@
1
1
  import { css } from 'lit';
2
- export const listStyle = css `:host{display:block;padding:.5rem 0}::slotted(mdui-divider[middle]){margin-left:1rem;margin-right:1.5rem}`;
2
+ export const listStyle = css `
3
+ :host {
4
+ display: block;
5
+ padding: 0.5rem 0rem;
6
+ }
7
+ ::slotted(mdui-divider[middle]) {
8
+ margin-left: 1rem;
9
+ margin-right: 1.5rem;
10
+ }
11
+ `;
@@ -1,2 +1,20 @@
1
1
  import { css } from 'lit';
2
- export const listSubheaderStyle = css `:host{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;cursor:default;color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-label-small-size);font-weight:var(--mdui-typescale-label-small-weight);letter-spacing:var(--mdui-typescale-label-small-tracking);line-height:var(--mdui-typescale-label-small-line-height);padding-left:1rem;padding-right:1.5rem;height:3.5rem;line-height:3.5rem}`;
2
+ export const listSubheaderStyle = css `
3
+ /* 规范中没有该描述 */
4
+ :host {
5
+ display: block;
6
+ overflow: hidden;
7
+ white-space: nowrap;
8
+ text-overflow: ellipsis;
9
+ cursor: default;
10
+ color: rgb(var(--mdui-color-on-surface-variant));
11
+ font-size: var(--mdui-typescale-label-small-size);
12
+ font-weight: var(--mdui-typescale-label-small-weight);
13
+ letter-spacing: var(--mdui-typescale-label-small-tracking);
14
+ line-height: var(--mdui-typescale-label-small-line-height);
15
+ padding-left: 1rem;
16
+ padding-right: 1.5rem;
17
+ height: 3.5rem;
18
+ line-height: 3.5rem;
19
+ }
20
+ `;
@@ -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
+ `;
@@ -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
+ `;
@@ -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)) {