mdui 2.0.5 → 2.0.6

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 (94) hide show
  1. package/components/avatar/index.js +2 -7
  2. package/components/avatar/style.js +1 -31
  3. package/components/badge/style.js +1 -25
  4. package/components/bottom-app-bar/style.js +1 -92
  5. package/components/button/button-base-style.js +1 -28
  6. package/components/button/button-base.js +1 -8
  7. package/components/button/index.js +8 -18
  8. package/components/button/style.js +2 -111
  9. package/components/button-icon/index.js +5 -22
  10. package/components/button-icon/style.js +2 -103
  11. package/components/card/index.js +1 -5
  12. package/components/card/style.js +1 -72
  13. package/components/checkbox/index.js +7 -50
  14. package/components/checkbox/style.js +1 -131
  15. package/components/chip/index.js +9 -33
  16. package/components/chip/style.js +2 -205
  17. package/components/circular-progress/index.js +5 -39
  18. package/components/circular-progress/style.js +1 -136
  19. package/components/collapse/collapse-item-style.js +1 -21
  20. package/components/collapse/collapse-item.js +2 -10
  21. package/components/collapse/collapse-style.js +1 -5
  22. package/components/collapse/collapse.js +1 -4
  23. package/components/dialog/index.js +7 -35
  24. package/components/dialog/style.js +1 -116
  25. package/components/divider/style.js +1 -18
  26. package/components/dropdown/index.js +1 -8
  27. package/components/dropdown/style.js +1 -11
  28. package/components/fab/index.js +5 -13
  29. package/components/fab/style.js +4 -153
  30. package/components/icon/index.js +1 -5
  31. package/components/icon/style.js +1 -29
  32. package/components/layout/layout-item-style.js +1 -6
  33. package/components/layout/layout-main-style.js +1 -7
  34. package/components/layout/layout-style.js +1 -11
  35. package/components/linear-progress/index.js +2 -6
  36. package/components/linear-progress/style.js +1 -73
  37. package/components/list/list-item-style.js +2 -153
  38. package/components/list/list-item.js +8 -27
  39. package/components/list/list-style.js +1 -10
  40. package/components/list/list-subheader-style.js +1 -19
  41. package/components/menu/menu-item-style.js +1 -125
  42. package/components/menu/menu-item.js +13 -55
  43. package/components/menu/menu-style.js +1 -19
  44. package/components/menu/menu.js +1 -5
  45. package/components/navigation-bar/navigation-bar-item-style.js +1 -132
  46. package/components/navigation-bar/navigation-bar-item.js +7 -23
  47. package/components/navigation-bar/navigation-bar-style.js +1 -28
  48. package/components/navigation-bar/navigation-bar.js +1 -4
  49. package/components/navigation-drawer/index.js +1 -12
  50. package/components/navigation-drawer/style.js +1 -66
  51. package/components/navigation-rail/navigation-rail-item-style.js +1 -122
  52. package/components/navigation-rail/navigation-rail-item.js +7 -26
  53. package/components/navigation-rail/navigation-rail-style.js +1 -79
  54. package/components/navigation-rail/navigation-rail.js +1 -10
  55. package/components/radio/radio-group-style.js +1 -20
  56. package/components/radio/radio-group.js +1 -19
  57. package/components/radio/radio-style.js +1 -107
  58. package/components/radio/radio.js +5 -23
  59. package/components/range-slider/index.d.ts +1 -1
  60. package/components/range-slider/index.js +5 -53
  61. package/components/ripple/index.js +2 -5
  62. package/components/ripple/style.js +1 -96
  63. package/components/segmented-button/segmented-button-group-style.js +1 -28
  64. package/components/segmented-button/segmented-button-group.js +1 -21
  65. package/components/segmented-button/segmented-button-style.js +2 -81
  66. package/components/segmented-button/segmented-button.js +11 -27
  67. package/components/select/index.js +6 -87
  68. package/components/select/style.js +1 -27
  69. package/components/slider/index.js +2 -33
  70. package/components/slider/slider-base-style.js +1 -173
  71. package/components/slider/slider-base.js +1 -6
  72. package/components/slider/style.js +1 -7
  73. package/components/snackbar/index.js +5 -32
  74. package/components/snackbar/style.js +1 -100
  75. package/components/switch/index.js +6 -40
  76. package/components/switch/style.js +1 -202
  77. package/components/tabs/tab-panel-style.js +1 -10
  78. package/components/tabs/tab-style.js +1 -85
  79. package/components/tabs/tab.js +4 -24
  80. package/components/tabs/tabs-style.js +1 -138
  81. package/components/tabs/tabs.js +1 -9
  82. package/components/text-field/index.js +32 -160
  83. package/components/text-field/style.js +1 -362
  84. package/components/tooltip/index.js +1 -10
  85. package/components/tooltip/style.js +1 -57
  86. package/components/top-app-bar/top-app-bar-style.js +1 -78
  87. package/components/top-app-bar/top-app-bar-title-style.js +1 -81
  88. package/components/top-app-bar/top-app-bar-title.js +3 -17
  89. package/custom-elements.json +1105 -1105
  90. package/mdui.esm.js +22 -0
  91. package/mdui.global.js +22 -0
  92. package/package.json +1 -1
  93. package/web-types.en.json +1 -1
  94. package/web-types.zh-cn.json +1 -1
@@ -1,108 +1,2 @@
1
1
  import { css } from 'lit';
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
- `;
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%)}`;
@@ -91,29 +91,11 @@ 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}>
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>`;
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>`;
117
99
  }
118
100
  isDisabled() {
119
101
  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: () => 1 | 0;
57
+ protected getRippleIndex: () => 0 | 1;
58
58
  private updateStyle;
59
59
  private onInput;
60
60
  }
@@ -143,66 +143,18 @@ 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 })}>
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({
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({
168
147
  'z-index': this.currentHandle === 'start' ? '2' : '1',
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({
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({
183
149
  'z-index': this.currentHandle === 'end' ? '2' : '1',
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({
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({
196
151
  active: value > this.value[0] && value < this.value[1],
197
- })}"
198
- style="${styleMap({
152
+ })}" style="${styleMap({
199
153
  left: `${((value - this.min) / this.max) * 100}%`,
200
154
  display: value === this.value[0] || value === this.value[1]
201
155
  ? 'none'
202
156
  : 'block',
203
- })}"
204
- ></div>`))}
205
- </label>`;
157
+ })}"></div>`))}</label>`;
206
158
  }
207
159
  updateStyle() {
208
160
  const getPercent = (value) => ((value - this.min) / (this.max - this.min)) * 100;
@@ -144,14 +144,11 @@ let Ripple = class Ripple extends MduiElement {
144
144
  this.dragged = false;
145
145
  }
146
146
  render() {
147
- return html `<div
148
- ${ref(this.surfaceRef)}
149
- class="surface ${classMap({
147
+ return html `<div ${ref(this.surfaceRef)} class="surface ${classMap({
150
148
  hover: this.hover,
151
149
  focused: this.focused,
152
150
  dragged: this.dragged,
153
- })}"
154
- ></div>`;
151
+ })}"></div>`;
155
152
  }
156
153
  };
157
154
  Ripple.styles = [componentStyle, style];
@@ -1,97 +1,2 @@
1
1
  import { css } from 'lit';
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
- `;
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}}`;
@@ -1,29 +1,2 @@
1
1
  import { css } from 'lit';
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
- `;
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}`;
@@ -236,27 +236,7 @@ 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
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>`;
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>`;
260
240
  }
261
241
  // 切换一个元素的选中状态
262
242
  selectOne(item) {
@@ -1,83 +1,4 @@
1
1
  import { css } from 'lit';
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(
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(
30
3
  --mdui-color-on-secondary-container
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
- `;
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}`;
@@ -74,20 +74,14 @@ 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
78
- ${ref(this.rippleRef)}
79
- .noRipple=${this.noRipple}
80
- ></mdui-ripple>
81
- ${this.isButton()
77
+ return html `<mdui-ripple ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.isButton()
82
78
  ? this.renderButton({
83
79
  className,
84
80
  part: 'button',
85
81
  content: this.renderInner(),
86
82
  })
87
83
  : this.isDisabled() || this.loading
88
- ? html `<span part="button" class="_a ${className}">
89
- ${this.renderInner()}
90
- </span>`
84
+ ? html `<span part="button" class="_a ${className}">${this.renderInner()}</span>`
91
85
  : this.renderAnchor({
92
86
  className,
93
87
  part: 'button',
@@ -102,21 +96,13 @@ let SegmentedButton = class SegmentedButton extends ButtonBase {
102
96
  return this.renderLoading();
103
97
  }
104
98
  if (this.selected) {
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>`;
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>`;
114
102
  }
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>`;
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>`;
120
106
  }
121
107
  renderLabel() {
122
108
  const hasLabel = this.hasSlotController.test('[default]');
@@ -126,11 +112,9 @@ let SegmentedButton = class SegmentedButton extends ButtonBase {
126
112
  return html `<slot part="label" class="label"></slot>`;
127
113
  }
128
114
  renderEndIcon() {
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>`;
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>`;
134
118
  }
135
119
  renderInner() {
136
120
  return [this.renderIcon(), this.renderLabel(), this.renderEndIcon()];