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,108 @@
1
1
  import { css } from 'lit';
2
- export const radioStyle = css `:host{position:relative;display:inline-flex;align-items:center;cursor:pointer;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none;touch-action:manipulation;zoom:1;-webkit-user-drag:none;border-radius:.125rem;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{display:flex;position:absolute;font-size:1.5rem}:not(.initial) .icon{transition-duration:var(--mdui-motion-duration-short4);transition-timing-function:var(--mdui-motion-easing-standard)}.unchecked-icon{transition-property:color;color:rgb(var(--mdui-color-on-surface-variant))}:host([focused]) .unchecked-icon,:host([hover]) .unchecked-icon,:host([pressed]) .unchecked-icon{color:rgb(var(--mdui-color-on-surface))}.checked-icon{opacity:0;transform:scale(.2);transition-property:color,opacity,transform;color:rgb(var(--mdui-color-primary))}.icon .i,::slotted([slot=checked-icon]),::slotted([slot=unchecked-icon]){color:inherit;font-size:inherit}i{position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden;border-radius:50%;width:2.5rem;min-width:2.5rem;height:2.5rem;--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}.label{display:flex;width:100%;padding-top:.625rem;padding-bottom:.625rem;color:rgb(var(--mdui-color-on-surface))}.label:not(.initial){transition:color var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}:host([checked]) i{--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([checked]) .icon{color:rgb(var(--mdui-color-primary))}:host([checked]) .checked-icon{opacity:1;transform:scale(.5)}i.invalid{--mdui-comp-ripple-state-layer-color:var(--mdui-color-error)}i.invalid .icon{color:rgb(var(--mdui-color-error))}.label.invalid{color:rgb(var(--mdui-color-error))}:host([disabled]),:host([group-disabled]){cursor:default;pointer-events:none}:host([disabled]) .icon,:host([group-disabled]) .icon{color:rgba(var(--mdui-color-on-surface),38%)}:host([disabled]) .label,:host([group-disabled]) .label{color:rgba(var(--mdui-color-on-surface),38%)}`;
2
+ export const radioStyle = css `
3
+ :host {
4
+ position: relative;
5
+ display: inline-flex;
6
+ align-items: center;
7
+ cursor: pointer;
8
+ -webkit-tap-highlight-color: transparent;
9
+ -webkit-user-select: none;
10
+ user-select: none;
11
+ touch-action: manipulation;
12
+ zoom: 1;
13
+ -webkit-user-drag: none;
14
+ border-radius: 0.125rem;
15
+ font-size: var(--mdui-typescale-label-large-size);
16
+ font-weight: var(--mdui-typescale-label-large-weight);
17
+ letter-spacing: var(--mdui-typescale-label-large-tracking);
18
+ line-height: var(--mdui-typescale-label-large-line-height);
19
+ }
20
+ .icon {
21
+ display: flex;
22
+ position: absolute;
23
+ font-size: 1.5rem;
24
+ }
25
+ :not(.initial) .icon {
26
+ transition-duration: var(--mdui-motion-duration-short4);
27
+ transition-timing-function: var(--mdui-motion-easing-standard);
28
+ }
29
+ .unchecked-icon {
30
+ transition-property: color;
31
+ color: rgb(var(--mdui-color-on-surface-variant));
32
+ }
33
+ :host([hover]) .unchecked-icon,
34
+ :host([focused]) .unchecked-icon,
35
+ :host([pressed]) .unchecked-icon {
36
+ color: rgb(var(--mdui-color-on-surface));
37
+ }
38
+ .checked-icon {
39
+ opacity: 0;
40
+ transform: scale(0.2);
41
+ transition-property: color, opacity, transform;
42
+ color: rgb(var(--mdui-color-primary));
43
+ }
44
+ .icon .i,
45
+ ::slotted([slot='unchecked-icon']),
46
+ ::slotted([slot='checked-icon']) {
47
+ color: inherit;
48
+ font-size: inherit;
49
+ }
50
+ i {
51
+ position: relative;
52
+ display: flex;
53
+ align-items: center;
54
+ justify-content: center;
55
+ overflow: hidden;
56
+ border-radius: 50%;
57
+ width: 2.5rem;
58
+ min-width: 2.5rem;
59
+ height: 2.5rem;
60
+ --mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
61
+ }
62
+ .label {
63
+ display: flex;
64
+ width: 100%;
65
+ padding-top: 0.625rem;
66
+ padding-bottom: 0.625rem;
67
+ color: rgb(var(--mdui-color-on-surface));
68
+ }
69
+ .label:not(.initial) {
70
+ transition: color var(--mdui-motion-duration-short4)
71
+ var(--mdui-motion-easing-standard);
72
+ }
73
+ /* 选中状态的图标 */
74
+ :host([checked]) i {
75
+ --mdui-comp-ripple-state-layer-color: var(--mdui-color-primary);
76
+ }
77
+ :host([checked]) .icon {
78
+ color: rgb(var(--mdui-color-primary));
79
+ }
80
+ :host([checked]) .checked-icon {
81
+ opacity: 1;
82
+ transform: scale(0.5);
83
+ }
84
+ /* 验证不通过状态 */
85
+ i.invalid {
86
+ --mdui-comp-ripple-state-layer-color: var(--mdui-color-error);
87
+ }
88
+ i.invalid .icon {
89
+ color: rgb(var(--mdui-color-error));
90
+ }
91
+ .label.invalid {
92
+ color: rgb(var(--mdui-color-error));
93
+ }
94
+ /* 禁用状态的图标 */
95
+ :host([disabled]),
96
+ :host([group-disabled]) {
97
+ cursor: default;
98
+ pointer-events: none;
99
+ }
100
+ :host([disabled]) .icon,
101
+ :host([group-disabled]) .icon {
102
+ color: rgba(var(--mdui-color-on-surface), 38%);
103
+ }
104
+ :host([disabled]) .label,
105
+ :host([group-disabled]) .label {
106
+ color: rgba(var(--mdui-color-on-surface), 38%);
107
+ }
108
+ `;
@@ -91,11 +91,29 @@ let Radio = class Radio extends RippleMixin(FocusableMixin(MduiElement)) {
91
91
  invalid: this.invalid,
92
92
  initial: this.isInitial,
93
93
  });
94
- return html `<i part="control" class="${className}"><mdui-ripple ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple><slot name="unchecked-icon" part="unchecked-icon" class="icon unchecked-icon">${this.uncheckedIcon
95
- ? html `<mdui-icon name="${this.uncheckedIcon}" class="i"></mdui-icon>`
96
- : html `<mdui-icon-radio-button-unchecked class="i"></mdui-icon-radio-button-unchecked>`}</slot><slot name="checked-icon" part="checked-icon" class="icon checked-icon">${this.checkedIcon
97
- ? html `<mdui-icon name="${this.checkedIcon}" class="i"></mdui-icon>`
98
- : html `<mdui-icon-circle class="i"></mdui-icon-circle>`}</slot></i><slot part="label" class="label ${className}"></slot>`;
94
+ return html `<i part="control" class=${className}>
95
+ <mdui-ripple
96
+ ${ref(this.rippleRef)}
97
+ .noRipple=${this.noRipple}
98
+ ></mdui-ripple>
99
+ <slot
100
+ name="unchecked-icon"
101
+ part="unchecked-icon"
102
+ class="icon unchecked-icon"
103
+ >
104
+ ${this.uncheckedIcon
105
+ ? html `<mdui-icon name=${this.uncheckedIcon} class="i"></mdui-icon>`
106
+ : html `<mdui-icon-radio-button-unchecked
107
+ class="i"
108
+ ></mdui-icon-radio-button-unchecked>`}
109
+ </slot>
110
+ <slot name="checked-icon" part="checked-icon" class="icon checked-icon">
111
+ ${this.checkedIcon
112
+ ? html `<mdui-icon name=${this.checkedIcon} class="i"></mdui-icon>`
113
+ : html `<mdui-icon-circle class="i"></mdui-icon-circle>`}
114
+ </slot>
115
+ </i>
116
+ <slot part="label" class="label ${className}"></slot>`;
99
117
  }
100
118
  isDisabled() {
101
119
  return this.disabled || this.groupDisabled;
@@ -54,7 +54,7 @@ export declare class RangeSlider extends SliderBase<RangeSliderEventMap> impleme
54
54
  * <input class="invalid" /> 用于提供 html5 自带的表单错误提示
55
55
  */
56
56
  protected render(): TemplateResult;
57
- protected getRippleIndex: () => 0 | 1;
57
+ protected getRippleIndex: () => 1 | 0;
58
58
  private updateStyle;
59
59
  private onInput;
60
60
  }
@@ -143,18 +143,66 @@ let RangeSlider = class RangeSlider extends SliderBase {
143
143
  * <input class="invalid" /> 用于提供 html5 自带的表单错误提示
144
144
  */
145
145
  render() {
146
- return html `<label class="${classMap({ invalid: this.invalid })}"><input ${ref(this.inputRef)} type="range" step="${this.step}" min="${this.min}" max="${this.max}" ?disabled="${this.disabled}" @input="${this.onInput}" @change="${this.onChange}"><div part="track-inactive" class="track-inactive"></div><div ${ref(this.trackActiveRef)} part="track-active" class="track-active"></div><div ${ref(this.handleStartRef)} part="handle" class="handle start" style="${styleMap({
146
+ return html `<label class=${classMap({ invalid: this.invalid })}>
147
+ <input
148
+ ${ref(this.inputRef)}
149
+ type="range"
150
+ step=${this.step}
151
+ min=${this.min}
152
+ max=${this.max}
153
+ ?disabled=${this.disabled}
154
+ @input=${this.onInput}
155
+ @change=${this.onChange}
156
+ />
157
+ <div part="track-inactive" class="track-inactive"></div>
158
+ <div
159
+ ${ref(this.trackActiveRef)}
160
+ part="track-active"
161
+ class="track-active"
162
+ ></div>
163
+ <div
164
+ ${ref(this.handleStartRef)}
165
+ part="handle"
166
+ class="handle start"
167
+ style=${styleMap({
147
168
  'z-index': this.currentHandle === 'start' ? '2' : '1',
148
- })}"><div class="elevation"></div><mdui-ripple ${ref(this.rippleStartRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.renderLabel(this.value[0])}</div><div ${ref(this.handleEndRef)} part="handle" class="handle end" style="${styleMap({
169
+ })}
170
+ >
171
+ <div class="elevation"></div>
172
+ <mdui-ripple
173
+ ${ref(this.rippleStartRef)}
174
+ .noRipple=${this.noRipple}
175
+ ></mdui-ripple>
176
+ ${this.renderLabel(this.value[0])}
177
+ </div>
178
+ <div
179
+ ${ref(this.handleEndRef)}
180
+ part="handle"
181
+ class="handle end"
182
+ style=${styleMap({
149
183
  'z-index': this.currentHandle === 'end' ? '2' : '1',
150
- })}"><div class="elevation"></div><mdui-ripple ${ref(this.rippleEndRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.renderLabel(this.value[1])}</div>${when(this.tickmarks, () => map(this.getCandidateValues(), (value) => html `<div part="tickmark" class="tickmark ${classMap({
184
+ })}
185
+ >
186
+ <div class="elevation"></div>
187
+ <mdui-ripple
188
+ ${ref(this.rippleEndRef)}
189
+ .noRipple=${this.noRipple}
190
+ ></mdui-ripple>
191
+ ${this.renderLabel(this.value[1])}
192
+ </div>
193
+ ${when(this.tickmarks, () => map(this.getCandidateValues(), (value) => html `<div
194
+ part="tickmark"
195
+ class="tickmark ${classMap({
151
196
  active: value > this.value[0] && value < this.value[1],
152
- })}" style="${styleMap({
197
+ })}"
198
+ style="${styleMap({
153
199
  left: `${((value - this.min) / this.max) * 100}%`,
154
200
  display: value === this.value[0] || value === this.value[1]
155
201
  ? 'none'
156
202
  : 'block',
157
- })}"></div>`))}</label>`;
203
+ })}"
204
+ ></div>`))}
205
+ </label>`;
158
206
  }
159
207
  updateStyle() {
160
208
  const getPercent = (value) => ((value - this.min) / (this.max - this.min)) * 100;
@@ -144,11 +144,14 @@ let Ripple = class Ripple extends MduiElement {
144
144
  this.dragged = false;
145
145
  }
146
146
  render() {
147
- return html `<div ${ref(this.surfaceRef)} class="surface ${classMap({
147
+ return html `<div
148
+ ${ref(this.surfaceRef)}
149
+ class="surface ${classMap({
148
150
  hover: this.hover,
149
151
  focused: this.focused,
150
152
  dragged: this.dragged,
151
- })}"></div>`;
153
+ })}"
154
+ ></div>`;
152
155
  }
153
156
  };
154
157
  Ripple.styles = [componentStyle, style];
@@ -1,2 +1,97 @@
1
1
  import { css } from 'lit';
2
- export const style = css `:host{position:absolute;top:0;left:0;display:block;width:100%;height:100%;overflow:hidden;pointer-events:none}.surface{position:absolute;top:0;left:0;width:100%;height:100%;transition-duration:280ms;transition-property:background-color;pointer-events:none;transition-timing-function:var(--mdui-motion-easing-standard)}.hover{background-color:rgba(var(--mdui-comp-ripple-state-layer-color,var(--mdui-color-on-surface)),var(--mdui-state-layer-hover))}:host-context([focus-visible]) .focused{background-color:rgba(var(--mdui-comp-ripple-state-layer-color,var(--mdui-color-on-surface)),var(--mdui-state-layer-focus))}.dragged{background-color:rgba(var(--mdui-comp-ripple-state-layer-color,var(--mdui-color-on-surface)),var(--mdui-state-layer-dragged))}.wave{position:absolute;z-index:1;background-color:rgb(var(--mdui-comp-ripple-state-layer-color,var(--mdui-color-on-surface)));border-radius:50%;transform:translate3d(0,0,0) scale(.4);opacity:0;animation:225ms ease 0s 1 normal forwards running mdui-comp-ripple-radius-in,75ms ease 0s 1 normal forwards running mdui-comp-ripple-opacity-in;pointer-events:none}.out{transform:translate3d(var(--mdui-comp-ripple-transition-x,0),var(--mdui-comp-ripple-transition-y,0),0) scale(1);animation:150ms ease 0s 1 normal none running mdui-comp-ripple-opacity-out}@keyframes mdui-comp-ripple-radius-in{from{transform:translate3d(0,0,0) scale(.4);animation-timing-function:var(--mdui-motion-easing-standard)}to{transform:translate3d(var(--mdui-comp-ripple-transition-x,0),var(--mdui-comp-ripple-transition-y,0),0) scale(1)}}@keyframes mdui-comp-ripple-opacity-in{from{opacity:0;animation-timing-function:linear}to{opacity:var(--mdui-state-layer-pressed)}}@keyframes mdui-comp-ripple-opacity-out{from{animation-timing-function:linear;opacity:var(--mdui-state-layer-pressed)}to{opacity:0}}`;
2
+ export const style = css `
3
+ :host {
4
+ position: absolute;
5
+ top: 0;
6
+ left: 0;
7
+ display: block;
8
+ width: 100%;
9
+ height: 100%;
10
+ overflow: hidden;
11
+ pointer-events: none;
12
+ }
13
+ .surface {
14
+ position: absolute;
15
+ top: 0;
16
+ left: 0;
17
+ width: 100%;
18
+ height: 100%;
19
+ transition-duration: 280ms;
20
+ transition-property: background-color;
21
+ pointer-events: none;
22
+ transition-timing-function: var(--mdui-motion-easing-standard);
23
+ }
24
+ .hover {
25
+ background-color: rgba(
26
+ var(--mdui-comp-ripple-state-layer-color, var(--mdui-color-on-surface)),
27
+ var(--mdui-state-layer-hover)
28
+ );
29
+ }
30
+ :host-context([focus-visible]) .focused {
31
+ background-color: rgba(
32
+ var(--mdui-comp-ripple-state-layer-color, var(--mdui-color-on-surface)),
33
+ var(--mdui-state-layer-focus)
34
+ );
35
+ }
36
+ .dragged {
37
+ background-color: rgba(
38
+ var(--mdui-comp-ripple-state-layer-color, var(--mdui-color-on-surface)),
39
+ var(--mdui-state-layer-dragged)
40
+ );
41
+ }
42
+ .wave {
43
+ position: absolute;
44
+ z-index: 1;
45
+ background-color: rgb(
46
+ var(--mdui-comp-ripple-state-layer-color, var(--mdui-color-on-surface))
47
+ );
48
+ border-radius: 50%;
49
+ transform: translate3d(0, 0, 0) scale(0.4);
50
+ opacity: 0;
51
+ animation:
52
+ 225ms ease 0s 1 normal forwards running mdui-comp-ripple-radius-in,
53
+ 75ms ease 0s 1 normal forwards running mdui-comp-ripple-opacity-in;
54
+ pointer-events: none;
55
+ }
56
+ .out {
57
+ transform: translate3d(
58
+ var(--mdui-comp-ripple-transition-x, 0),
59
+ var(--mdui-comp-ripple-transition-y, 0),
60
+ 0
61
+ )
62
+ scale(1);
63
+ animation: 150ms ease 0s 1 normal none running mdui-comp-ripple-opacity-out;
64
+ }
65
+ @keyframes mdui-comp-ripple-radius-in {
66
+ from {
67
+ transform: translate3d(0, 0, 0) scale(0.4);
68
+ animation-timing-function: var(--mdui-motion-easing-standard);
69
+ }
70
+ to {
71
+ transform: translate3d(
72
+ var(--mdui-comp-ripple-transition-x, 0),
73
+ var(--mdui-comp-ripple-transition-y, 0),
74
+ 0
75
+ )
76
+ scale(1);
77
+ }
78
+ }
79
+ @keyframes mdui-comp-ripple-opacity-in {
80
+ from {
81
+ opacity: 0;
82
+ animation-timing-function: linear;
83
+ }
84
+ to {
85
+ opacity: var(--mdui-state-layer-pressed);
86
+ }
87
+ }
88
+ @keyframes mdui-comp-ripple-opacity-out {
89
+ from {
90
+ animation-timing-function: linear;
91
+ opacity: var(--mdui-state-layer-pressed);
92
+ }
93
+ to {
94
+ opacity: 0;
95
+ }
96
+ }
97
+ `;
@@ -1,2 +1,29 @@
1
1
  import { css } from 'lit';
2
- export const segmentedButtonGroupStyle = css `:host{--shape-corner:var(--mdui-shape-corner-full);position:relative;display:inline-flex;vertical-align:middle;height:2.5rem;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);color:rgb(var(--mdui-color-on-surface));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([full-width]){display:flex;flex-wrap:nowrap}input,select{position:absolute;width:100%;height:100%;padding:0;opacity:0;pointer-events:none}`;
2
+ export const segmentedButtonGroupStyle = css `
3
+ :host {
4
+ --shape-corner: var(--mdui-shape-corner-full);
5
+ position: relative;
6
+ display: inline-flex;
7
+ vertical-align: middle;
8
+ height: 2.5rem;
9
+ font-size: var(--mdui-typescale-label-large-size);
10
+ font-weight: var(--mdui-typescale-label-large-weight);
11
+ letter-spacing: var(--mdui-typescale-label-large-tracking);
12
+ line-height: var(--mdui-typescale-label-large-line-height);
13
+ color: rgb(var(--mdui-color-on-surface));
14
+ --mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
15
+ }
16
+ :host([full-width]) {
17
+ display: flex;
18
+ flex-wrap: nowrap;
19
+ }
20
+ input,
21
+ select {
22
+ position: absolute;
23
+ width: 100%;
24
+ height: 100%;
25
+ padding: 0;
26
+ opacity: 0;
27
+ pointer-events: none;
28
+ }
29
+ `;
@@ -236,7 +236,27 @@ let SegmentedButtonGroup = class SegmentedButtonGroup extends MduiElement {
236
236
  this.invalid = !this.inputRef.value.checkValidity();
237
237
  }
238
238
  render() {
239
- return html `${when(this.isSelectable && this.isSingle, () => html `<input ${ref(this.inputRef)} type="radio" name="${ifDefined(this.name)}" value="1" .disabled="${this.disabled}" .required="${this.required}" .checked="${!!this.value}" tabindex="-1" @keydown="${this.onInputKeyDown}">`)}${when(this.isSelectable && this.isMultiple, () => html `<select ${ref(this.inputRef)} name="${ifDefined(this.name)}" .disabled="${this.disabled}" .required="${this.required}" multiple="multiple" tabindex="-1" @keydown="${this.onInputKeyDown}">${map(this.value, (value) => html `<option selected="selected" value="${value}"></option>`)}</select>`)}<slot @slotchange="${this.onSlotChange}" @click="${this.onClick}"></slot>`;
239
+ return html `${when(this.isSelectable && this.isSingle, () => html `<input
240
+ ${ref(this.inputRef)}
241
+ type="radio"
242
+ name=${ifDefined(this.name)}
243
+ value="1"
244
+ .disabled=${this.disabled}
245
+ .required=${this.required}
246
+ .checked=${!!this.value}
247
+ tabindex="-1"
248
+ @keydown=${this.onInputKeyDown}
249
+ />`)}${when(this.isSelectable && this.isMultiple, () => html `<select
250
+ ${ref(this.inputRef)}
251
+ name=${ifDefined(this.name)}
252
+ .disabled=${this.disabled}
253
+ .required=${this.required}
254
+ multiple
255
+ tabindex="-1"
256
+ @keydown=${this.onInputKeyDown}
257
+ >
258
+ ${map(this.value, (value) => html `<option selected value=${value}></option>`)}
259
+ </select>`)}<slot @slotchange=${this.onSlotChange} @click=${this.onClick}></slot>`;
240
260
  }
241
261
  // 切换一个元素的选中状态
242
262
  selectOne(item) {
@@ -1,4 +1,83 @@
1
1
  import { css } from 'lit';
2
- export const segmentedButtonStyle = css `:host{position:relative;display:inline-flex;flex-grow:1;flex-shrink:0;float:left;height:100%;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:transparent;border:.0625rem solid rgb(var(--mdui-color-outline))}.button{width:100%;padding:0 .75rem}:host([invalid]){color:rgb(var(--mdui-color-error));border-color:rgb(var(--mdui-color-error))}:host([invalid]) .button{background-color:rgb(var(--mdui-color-error-container))}:host([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 segmentedButtonStyle = css `
3
+ :host {
4
+ position: relative;
5
+ display: inline-flex;
6
+ flex-grow: 1;
7
+ flex-shrink: 0;
8
+ float: left;
9
+ height: 100%;
10
+ overflow: hidden;
11
+ cursor: pointer;
12
+ -webkit-tap-highlight-color: transparent;
13
+ border: 0.0625rem solid rgb(var(--mdui-color-outline));
14
+ }
15
+ .button {
16
+ width: 100%;
17
+ padding: 0rem 0.75rem;
18
+ }
19
+ :host([invalid]) {
20
+ color: rgb(var(--mdui-color-error));
21
+ border-color: rgb(var(--mdui-color-error));
22
+ }
23
+ :host([invalid]) .button {
24
+ background-color: rgb(var(--mdui-color-error-container));
25
+ }
26
+ :host([selected]) {
27
+ color: rgb(var(--mdui-color-on-secondary-container));
28
+ background-color: rgb(var(--mdui-color-secondary-container));
29
+ --mdui-comp-ripple-state-layer-color: var(
3
30
  --mdui-color-on-secondary-container
4
- )}:host([disabled]),:host([group-disabled]){cursor:default;pointer-events:none;color:rgba(var(--mdui-color-on-surface),38%);border-color:rgba(var(--mdui-color-on-surface),12%)}:host([loading]){cursor:default;pointer-events:none}:host(:not(.mdui-segmented-button-first)){margin-left:-.0625rem}:host(.mdui-segmented-button-first){border-radius:var(--shape-corner) 0 0 var(--shape-corner)}:host(.mdui-segmented-button-last){border-radius:0 var(--shape-corner) var(--shape-corner) 0}.end-icon,.icon,.selected-icon{display:inline-flex;font-size:1.28571429em}.end-icon .i,.icon .i,.selected-icon .i,::slotted([slot=end-icon]),::slotted([slot=icon]),::slotted([slot=selected-icon]){font-size:inherit}mdui-circular-progress{width:1.125rem;height:1.125rem}:host([disabled]) mdui-circular-progress{opacity:.38}.label{display:inline-flex}.has-icon .label{padding-left:.5rem}.has-end-icon .label{padding-right:.5rem}`;
31
+ );
32
+ }
33
+ :host([disabled]),
34
+ :host([group-disabled]) {
35
+ cursor: default;
36
+ pointer-events: none;
37
+ color: rgba(var(--mdui-color-on-surface), 38%);
38
+ border-color: rgba(var(--mdui-color-on-surface), 12%);
39
+ }
40
+ :host([loading]) {
41
+ cursor: default;
42
+ pointer-events: none;
43
+ }
44
+ :host(:not(.mdui-segmented-button-first)) {
45
+ margin-left: -0.0625rem;
46
+ }
47
+ :host(.mdui-segmented-button-first) {
48
+ border-radius: var(--shape-corner) 0 0 var(--shape-corner);
49
+ }
50
+ :host(.mdui-segmented-button-last) {
51
+ border-radius: 0 var(--shape-corner) var(--shape-corner) 0;
52
+ }
53
+ .icon,
54
+ .end-icon,
55
+ .selected-icon {
56
+ display: inline-flex;
57
+ font-size: 1.28571429em;
58
+ }
59
+ .icon .i,
60
+ .end-icon .i,
61
+ .selected-icon .i,
62
+ ::slotted([slot='icon']),
63
+ ::slotted([slot='end-icon']),
64
+ ::slotted([slot='selected-icon']) {
65
+ font-size: inherit;
66
+ }
67
+ mdui-circular-progress {
68
+ width: 1.125rem;
69
+ height: 1.125rem;
70
+ }
71
+ :host([disabled]) mdui-circular-progress {
72
+ opacity: 0.38;
73
+ }
74
+ .label {
75
+ display: inline-flex;
76
+ }
77
+ .has-icon .label {
78
+ padding-left: 0.5rem;
79
+ }
80
+ .has-end-icon .label {
81
+ padding-right: 0.5rem;
82
+ }
83
+ `;
@@ -74,14 +74,20 @@ let SegmentedButton = class SegmentedButton extends ButtonBase {
74
74
  this.hasSlotController.test('icon'),
75
75
  'has-end-icon': this.endIcon || this.hasSlotController.test('end-icon'),
76
76
  });
77
- return html `<mdui-ripple ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.isButton()
77
+ return html `<mdui-ripple
78
+ ${ref(this.rippleRef)}
79
+ .noRipple=${this.noRipple}
80
+ ></mdui-ripple>
81
+ ${this.isButton()
78
82
  ? this.renderButton({
79
83
  className,
80
84
  part: 'button',
81
85
  content: this.renderInner(),
82
86
  })
83
87
  : this.isDisabled() || this.loading
84
- ? html `<span part="button" class="_a ${className}">${this.renderInner()}</span>`
88
+ ? html `<span part="button" class="_a ${className}">
89
+ ${this.renderInner()}
90
+ </span>`
85
91
  : this.renderAnchor({
86
92
  className,
87
93
  part: 'button',
@@ -96,13 +102,21 @@ let SegmentedButton = class SegmentedButton extends ButtonBase {
96
102
  return this.renderLoading();
97
103
  }
98
104
  if (this.selected) {
99
- return html `<slot name="selected-icon" part="selected-icon" class="selected-icon">${this.selectedIcon
100
- ? html `<mdui-icon name="${this.selectedIcon}" class="i"></mdui-icon>`
101
- : html `<mdui-icon-check class="i"></mdui-icon-check>`}</slot>`;
105
+ return html `<slot
106
+ name="selected-icon"
107
+ part="selected-icon"
108
+ class="selected-icon"
109
+ >
110
+ ${this.selectedIcon
111
+ ? html `<mdui-icon name=${this.selectedIcon} class="i"></mdui-icon>`
112
+ : html `<mdui-icon-check class="i"></mdui-icon-check>`}
113
+ </slot>`;
102
114
  }
103
- return html `<slot name="icon" part="icon" class="icon">${this.icon
104
- ? html `<mdui-icon name="${this.icon}" class="i"></mdui-icon>`
105
- : nothingTemplate}</slot>`;
115
+ return html `<slot name="icon" part="icon" class="icon">
116
+ ${this.icon
117
+ ? html `<mdui-icon name=${this.icon} class="i"></mdui-icon>`
118
+ : nothingTemplate}
119
+ </slot>`;
106
120
  }
107
121
  renderLabel() {
108
122
  const hasLabel = this.hasSlotController.test('[default]');
@@ -112,9 +126,11 @@ let SegmentedButton = class SegmentedButton extends ButtonBase {
112
126
  return html `<slot part="label" class="label"></slot>`;
113
127
  }
114
128
  renderEndIcon() {
115
- return html `<slot name="end-icon" part="end-icon" class="end-icon">${this.endIcon
116
- ? html `<mdui-icon name="${this.endIcon}" class="i"></mdui-icon>`
117
- : nothingTemplate}</slot>`;
129
+ return html `<slot name="end-icon" part="end-icon" class="end-icon">
130
+ ${this.endIcon
131
+ ? html `<mdui-icon name=${this.endIcon} class="i"></mdui-icon>`
132
+ : nothingTemplate}
133
+ </slot>`;
118
134
  }
119
135
  renderInner() {
120
136
  return [this.renderIcon(), this.renderLabel(), this.renderEndIcon()];