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
@@ -170,13 +170,56 @@ let Checkbox = class Checkbox extends RippleMixin(FocusableMixin(MduiElement)) {
170
170
  this.invalid = !this.inputRef.value.checkValidity();
171
171
  }
172
172
  render() {
173
- return html `<label class="${classMap({ invalid: this.invalid })}"><input ${ref(this.inputRef)} type="checkbox" name="${ifDefined(this.name)}" value="${ifDefined(this.value)}" .indeterminate="${live(this.indeterminate)}" .disabled="${this.disabled}" .checked="${live(this.checked)}" .required="${this.required}" @change="${this.onChange}"> <i part="control"><mdui-ripple ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple><slot name="unchecked-icon" part="unchecked-icon" class="icon unchecked-icon">${this.uncheckedIcon
174
- ? html `<mdui-icon name="${this.uncheckedIcon}" class="i"></mdui-icon>`
175
- : html `<mdui-icon-check-box-outline-blank class="i"></mdui-icon-check-box-outline-blank>`}</slot><slot name="checked-icon" part="checked-icon" class="icon checked-icon">${this.checkedIcon
176
- ? html `<mdui-icon name="${this.checkedIcon}" class="i"></mdui-icon>`
177
- : html `<mdui-icon-check-box class="i"></mdui-icon-check-box>`}</slot><slot name="indeterminate-icon" part="indeterminate-icon" class="icon indeterminate-icon">${this.indeterminateIcon
178
- ? html `<mdui-icon name="${this.indeterminateIcon}" class="i"></mdui-icon>`
179
- : html `<mdui-icon-indeterminate-check-box class="i"></mdui-icon-indeterminate-check-box>`}</slot></i><slot part="label" class="label"></slot></label>`;
173
+ return html `<label class="${classMap({ invalid: this.invalid })}">
174
+ <input
175
+ ${ref(this.inputRef)}
176
+ type="checkbox"
177
+ name=${ifDefined(this.name)}
178
+ value=${ifDefined(this.value)}
179
+ .indeterminate=${live(this.indeterminate)}
180
+ .disabled=${this.disabled}
181
+ .checked=${live(this.checked)}
182
+ .required=${this.required}
183
+ @change=${this.onChange}
184
+ />
185
+ <i part="control">
186
+ <mdui-ripple
187
+ ${ref(this.rippleRef)}
188
+ .noRipple=${this.noRipple}
189
+ ></mdui-ripple>
190
+ <slot
191
+ name="unchecked-icon"
192
+ part="unchecked-icon"
193
+ class="icon unchecked-icon"
194
+ >
195
+ ${this.uncheckedIcon
196
+ ? html `<mdui-icon name=${this.uncheckedIcon} class="i"></mdui-icon>`
197
+ : html `<mdui-icon-check-box-outline-blank
198
+ class="i"
199
+ ></mdui-icon-check-box-outline-blank>`}
200
+ </slot>
201
+ <slot name="checked-icon" part="checked-icon" class="icon checked-icon">
202
+ ${this.checkedIcon
203
+ ? html `<mdui-icon name=${this.checkedIcon} class="i"></mdui-icon>`
204
+ : html `<mdui-icon-check-box class="i"></mdui-icon-check-box>`}
205
+ </slot>
206
+ <slot
207
+ name="indeterminate-icon"
208
+ part="indeterminate-icon"
209
+ class="icon indeterminate-icon"
210
+ >
211
+ ${this.indeterminateIcon
212
+ ? html `<mdui-icon
213
+ name=${this.indeterminateIcon}
214
+ class="i"
215
+ ></mdui-icon>`
216
+ : html `<mdui-icon-indeterminate-check-box
217
+ class="i"
218
+ ></mdui-icon-indeterminate-check-box>`}
219
+ </slot>
220
+ </i>
221
+ <slot part="label" class="label"></slot>
222
+ </label>`;
180
223
  }
181
224
  /**
182
225
  * input[type="checkbox"] 的 change 事件无法冒泡越过 shadow dom
@@ -1,2 +1,132 @@
1
1
  import { css } from 'lit';
2
- export const style = css `:host{position:relative;display:inline-flex;cursor:pointer;-webkit-tap-highlight-color:transparent;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)}label{display:inline-flex;align-items:center;width:100%;cursor:inherit;-webkit-user-select:none;user-select:none;touch-action:manipulation;zoom:1;-webkit-user-drag:none}input{position:absolute;padding:0;opacity:0;pointer-events:none;width:1.125rem;height:1.125rem;margin:0 0 0 .6875rem}.icon{display:flex;position:absolute;opacity:1;transform:scale(1);color:rgb(var(--mdui-color-on-surface));font-size:1.5rem;transition:color var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}.checked-icon,.indeterminate-icon{opacity:0;transform:scale(.5);transition-property:color,opacity,transform;transition-duration:var(--mdui-motion-duration-short4);transition-timing-function:var(--mdui-motion-easing-standard)}.icon .i,::slotted([slot=checked-icon]),::slotted([slot=indeterminate-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));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]) .indeterminate-icon{opacity:0;transform:scale(.5)}:host([checked]) .checked-icon{opacity:1;transform:scale(1)}:host([indeterminate]) i{--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([indeterminate]) .icon{color:rgb(var(--mdui-color-primary))}:host([indeterminate]) .checked-icon{opacity:0;transform:scale(.5)}:host([indeterminate]) .indeterminate-icon{opacity:1;transform:scale(1)}.invalid i{--mdui-comp-ripple-state-layer-color:var(--mdui-color-error)}.invalid .icon{color:rgb(var(--mdui-color-error))}.invalid .label{color:rgb(var(--mdui-color-error))}:host([disabled]){cursor:default;pointer-events:none}:host([disabled]) .icon{color:rgba(var(--mdui-color-on-surface),38%)}:host([disabled]) .label{color:rgba(var(--mdui-color-on-surface),38%)}:host([disabled][checked]) .unchecked-icon,:host([disabled][indeterminate]) .unchecked-icon{opacity:0}`;
2
+ export const style = css `
3
+ :host {
4
+ position: relative;
5
+ display: inline-flex;
6
+ cursor: pointer;
7
+ -webkit-tap-highlight-color: transparent;
8
+ border-radius: 0.125rem;
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
+ }
14
+ label {
15
+ display: inline-flex;
16
+ align-items: center;
17
+ width: 100%;
18
+ cursor: inherit;
19
+ -webkit-user-select: none;
20
+ user-select: none;
21
+ touch-action: manipulation;
22
+ zoom: 1;
23
+ -webkit-user-drag: none;
24
+ }
25
+ /* 隐藏系统 input 标签,用自定义的图标代替 */
26
+ input {
27
+ position: absolute;
28
+ padding: 0;
29
+ opacity: 0;
30
+ pointer-events: none;
31
+ width: 1.125rem;
32
+ height: 1.125rem;
33
+ margin: 0rem 0rem 0rem 0.6875rem;
34
+ }
35
+ .icon {
36
+ display: flex;
37
+ position: absolute;
38
+ opacity: 1;
39
+ transform: scale(1);
40
+ color: rgb(var(--mdui-color-on-surface));
41
+ font-size: 1.5rem;
42
+ transition: color var(--mdui-motion-duration-short4)
43
+ var(--mdui-motion-easing-standard);
44
+ }
45
+ .checked-icon,
46
+ .indeterminate-icon {
47
+ opacity: 0;
48
+ transform: scale(0.5);
49
+ transition-property: color, opacity, transform;
50
+ transition-duration: var(--mdui-motion-duration-short4);
51
+ transition-timing-function: var(--mdui-motion-easing-standard);
52
+ }
53
+ .icon .i,
54
+ ::slotted([slot='unchecked-icon']),
55
+ ::slotted([slot='checked-icon']),
56
+ ::slotted([slot='indeterminate-icon']) {
57
+ color: inherit;
58
+ font-size: inherit;
59
+ }
60
+ i {
61
+ position: relative;
62
+ display: flex;
63
+ align-items: center;
64
+ justify-content: center;
65
+ overflow: hidden;
66
+ border-radius: 50%;
67
+ width: 2.5rem;
68
+ min-width: 2.5rem;
69
+ height: 2.5rem;
70
+ --mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
71
+ }
72
+ .label {
73
+ display: flex;
74
+ width: 100%;
75
+ padding-top: 0.625rem;
76
+ padding-bottom: 0.625rem;
77
+ color: rgb(var(--mdui-color-on-surface));
78
+ transition: color var(--mdui-motion-duration-short4)
79
+ var(--mdui-motion-easing-standard);
80
+ }
81
+ :host([checked]) i {
82
+ --mdui-comp-ripple-state-layer-color: var(--mdui-color-primary);
83
+ }
84
+ :host([checked]) .icon {
85
+ color: rgb(var(--mdui-color-primary));
86
+ }
87
+ :host([checked]) .indeterminate-icon {
88
+ opacity: 0;
89
+ transform: scale(0.5);
90
+ }
91
+ :host([checked]) .checked-icon {
92
+ opacity: 1;
93
+ transform: scale(1);
94
+ }
95
+ :host([indeterminate]) i {
96
+ --mdui-comp-ripple-state-layer-color: var(--mdui-color-primary);
97
+ }
98
+ :host([indeterminate]) .icon {
99
+ color: rgb(var(--mdui-color-primary));
100
+ }
101
+ :host([indeterminate]) .checked-icon {
102
+ opacity: 0;
103
+ transform: scale(0.5);
104
+ }
105
+ :host([indeterminate]) .indeterminate-icon {
106
+ opacity: 1;
107
+ transform: scale(1);
108
+ }
109
+ .invalid i {
110
+ --mdui-comp-ripple-state-layer-color: var(--mdui-color-error);
111
+ }
112
+ .invalid .icon {
113
+ color: rgb(var(--mdui-color-error));
114
+ }
115
+ .invalid .label {
116
+ color: rgb(var(--mdui-color-error));
117
+ }
118
+ :host([disabled]) {
119
+ cursor: default;
120
+ pointer-events: none;
121
+ }
122
+ :host([disabled]) .icon {
123
+ color: rgba(var(--mdui-color-on-surface), 38%);
124
+ }
125
+ :host([disabled]) .label {
126
+ color: rgba(var(--mdui-color-on-surface), 38%);
127
+ }
128
+ :host([disabled][checked]) .unchecked-icon,
129
+ :host([disabled][indeterminate]) .unchecked-icon {
130
+ opacity: 0;
131
+ }
132
+ `;
@@ -99,14 +99,20 @@ let Chip = class Chip extends ButtonBase {
99
99
  (this.selected && hasSelectedIcon),
100
100
  'has-end-icon': hasEndIcon,
101
101
  });
102
- return html `<mdui-ripple ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.isButton()
102
+ return html `<mdui-ripple
103
+ ${ref(this.rippleRef)}
104
+ .noRipple=${this.noRipple}
105
+ ></mdui-ripple>
106
+ ${this.isButton()
103
107
  ? this.renderButton({
104
108
  className,
105
109
  part: 'button',
106
110
  content: this.renderInner(),
107
111
  })
108
112
  : this.disabled || this.loading
109
- ? html `<span part="button" class="${className} _a">${this.renderInner()}</span>`
113
+ ? html `<span part="button" class="${className} _a">
114
+ ${this.renderInner()}
115
+ </span>`
110
116
  : this.renderAnchor({
111
117
  className,
112
118
  part: 'button',
@@ -149,12 +155,15 @@ let Chip = class Chip extends ButtonBase {
149
155
  }
150
156
  const icon = () => {
151
157
  return this.icon
152
- ? html `<mdui-icon name="${this.icon}" class="i"></mdui-icon>`
158
+ ? html `<mdui-icon name=${this.icon} class="i"></mdui-icon>`
153
159
  : nothingTemplate;
154
160
  };
155
161
  const selectedIcon = () => {
156
162
  if (this.selectedIcon) {
157
- return html `<mdui-icon name="${this.selectedIcon}" class="i"></mdui-icon>`;
163
+ return html `<mdui-icon
164
+ name="${this.selectedIcon}"
165
+ class="i"
166
+ ></mdui-icon>`;
158
167
  }
159
168
  if (this.variant === 'assist' || this.variant === 'filter') {
160
169
  return html `<mdui-icon-check class="i"></mdui-icon-check>`;
@@ -163,23 +172,38 @@ let Chip = class Chip extends ButtonBase {
163
172
  };
164
173
  return !this.selected
165
174
  ? html `<slot name="icon" part="icon" class="icon">${icon()}</slot>`
166
- : html `<slot name="selected-icon" part="selected-icon" class="selected-icon">${selectedIcon()}</slot>`;
175
+ : html `<slot
176
+ name="selected-icon"
177
+ part="selected-icon"
178
+ class="selected-icon"
179
+ >
180
+ ${selectedIcon()}
181
+ </slot>`;
167
182
  }
168
183
  renderLabel() {
169
184
  return html `<slot part="label" class="label"></slot>`;
170
185
  }
171
186
  renderEndIcon() {
172
- return html `<slot name="end-icon" part="end-icon" class="end-icon">${this.endIcon
187
+ return html `<slot name="end-icon" part="end-icon" class="end-icon">
188
+ ${this.endIcon
173
189
  ? html `<mdui-icon name="${this.endIcon}" class="i"></mdui-icon>`
174
- : nothingTemplate}</slot>`;
190
+ : nothingTemplate}
191
+ </slot>`;
175
192
  }
176
193
  renderDeleteIcon() {
177
194
  if (!this.deletable) {
178
195
  return nothingTemplate;
179
196
  }
180
- return html `<slot name="delete-icon" part="delete-icon" class="delete-icon" @click="${this.onDelete}">${this.deleteIcon
197
+ return html `<slot
198
+ name="delete-icon"
199
+ part="delete-icon"
200
+ class="delete-icon"
201
+ @click=${this.onDelete}
202
+ >
203
+ ${this.deleteIcon
181
204
  ? html `<mdui-icon name="${this.deleteIcon}" class="i"></mdui-icon>`
182
- : html `<mdui-icon-clear class="i"></mdui-icon-clear>`}</slot>`;
205
+ : html `<mdui-icon-clear class="i"></mdui-icon-clear>`}
206
+ </slot>`;
183
207
  }
184
208
  renderInner() {
185
209
  return [
@@ -1,4 +1,207 @@
1
1
  import { css } from 'lit';
2
- export const style = css `:host{--shape-corner:var(--mdui-shape-corner-small);position:relative;display:inline-block;overflow:hidden;border-radius:var(--shape-corner);cursor:pointer;-webkit-tap-highlight-color:transparent;transition:box-shadow var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);height:2rem;background-color:rgb(var(--mdui-color-surface));border:.0625rem solid rgb(var(--mdui-color-outline));color:rgb(var(--mdui-color-on-surface-variant));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);--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface-variant)}.button{padding-right:.4375rem;padding-left:.4375rem}:host([variant=input]) .button{padding-right:.1875rem;padding-left:.1875rem}:host([selected]) .button{padding-right:.5rem;padding-left:.5rem}:host([selected][variant=input]) .button{padding-right:.25rem;padding-left:.25rem}:host([elevated]) .button{padding-right:.5rem;padding-left:.5rem}:host([variant=assist]){color:rgb(var(--mdui-color-on-surface));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([elevated]){border-width:0;background-color:rgb(var(--mdui-color-surface-container-low));box-shadow:var(--mdui-elevation-level1)}:host([selected]){color:rgb(var(--mdui-color-on-secondary-container));background-color:rgb(var(--mdui-color-secondary-container));border-width:0;--mdui-comp-ripple-state-layer-color:var(
2
+ export const style = css `
3
+ /**
4
+ * mdui-chip 组件。默认为 variant="assist"
5
+ */
6
+ :host {
7
+ --shape-corner: var(--mdui-shape-corner-small);
8
+ position: relative;
9
+ display: inline-block;
10
+ overflow: hidden;
11
+ border-radius: var(--shape-corner);
12
+ cursor: pointer;
13
+ -webkit-tap-highlight-color: transparent;
14
+ transition: box-shadow var(--mdui-motion-duration-short4)
15
+ var(--mdui-motion-easing-linear);
16
+ height: 2rem;
17
+ background-color: rgb(var(--mdui-color-surface));
18
+ border: 0.0625rem solid rgb(var(--mdui-color-outline));
19
+ color: rgb(var(--mdui-color-on-surface-variant));
20
+ font-size: var(--mdui-typescale-label-large-size);
21
+ font-weight: var(--mdui-typescale-label-large-weight);
22
+ letter-spacing: var(--mdui-typescale-label-large-tracking);
23
+ line-height: var(--mdui-typescale-label-large-line-height);
24
+ --mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface-variant);
25
+ }
26
+ .button {
27
+ padding-right: 0.4375rem;
28
+ padding-left: 0.4375rem;
29
+ }
30
+ :host([variant='input']) .button {
31
+ padding-right: 0.1875rem;
32
+ padding-left: 0.1875rem;
33
+ }
34
+ :host([selected]) .button {
35
+ padding-right: 0.5rem;
36
+ padding-left: 0.5rem;
37
+ }
38
+ :host([selected][variant='input']) .button {
39
+ padding-right: 0.25rem;
40
+ padding-left: 0.25rem;
41
+ }
42
+ :host([elevated]) .button {
43
+ padding-right: 0.5rem;
44
+ padding-left: 0.5rem;
45
+ }
46
+ :host([variant='assist']) {
47
+ color: rgb(var(--mdui-color-on-surface));
48
+ --mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
49
+ }
50
+ :host([elevated]) {
51
+ border-width: 0;
52
+ background-color: rgb(var(--mdui-color-surface-container-low));
53
+ box-shadow: var(--mdui-elevation-level1);
54
+ }
55
+ :host([selected]) {
56
+ color: rgb(var(--mdui-color-on-secondary-container));
57
+ background-color: rgb(var(--mdui-color-secondary-container));
58
+ border-width: 0rem;
59
+ --mdui-comp-ripple-state-layer-color: var(
3
60
  --mdui-color-on-secondary-container
4
- )}:host([disabled]),:host([loading]){cursor:default;pointer-events:none}:host([disabled]){border-color:rgba(var(--mdui-color-on-surface),12%);color:rgba(var(--mdui-color-on-surface),38%);box-shadow:var(--mdui-elevation-level0)}:host([disabled][elevated]),:host([disabled][selected]){background-color:rgba(var(--mdui-color-on-surface),12%)}:host([selected][hover]){box-shadow:var(--mdui-elevation-level1)}:host([elevated][hover]){color:rgb(var(--mdui-color-on-secondary-container));box-shadow:var(--mdui-elevation-level2)}:host([variant=filter][hover]),:host([variant=input][hover]),:host([variant=suggestion][hover]){color:rgb(var(--mdui-color-on-surface-variant))}:host([variant=filter][focus-visible]),:host([variant=input][focus-visible]),:host([variant=suggestion][focus-visible]){border-color:rgb(var(--mdui-color-on-surface-variant))}:host([dragged]),:host([dragged][hover]){box-shadow:var(--mdui-elevation-level4)}.button{overflow:visible}.label{display:inline-flex;padding-right:.5rem;padding-left:.5rem}.end-icon,.icon,.selected-icon{display:inline-flex;font-size:1.28571429em;color:rgb(var(--mdui-color-on-surface-variant))}:host([variant=assist]) .end-icon,:host([variant=assist]) .icon,:host([variant=assist]) .selected-icon{color:rgb(var(--mdui-color-primary))}:host([selected]) .end-icon,:host([selected]) .icon,:host([selected]) .selected-icon{color:rgb(var(--mdui-color-on-secondary-container))}:host([disabled]) .end-icon,:host([disabled]) .icon,:host([disabled]) .selected-icon{opacity:.38;color:rgb(var(--mdui-color-on-surface))}.end-icon .i,.icon .i,.selected-icon .i,::slotted([slot=end-icon]),::slotted([slot=icon]),::slotted([slot=selected-icon]){font-size:inherit}:host([variant=input]) .has-icon .icon,:host([variant=input]) .has-icon .selected-icon,:host([variant=input]) .has-icon mdui-circular-progress{margin-left:.25rem}:host([variant=input]) .has-end-icon .end-icon{margin-right:.25rem}mdui-circular-progress{display:inline-flex;width:1.125rem;height:1.125rem}:host([disabled]) mdui-circular-progress{stroke:rgba(var(--mdui-color-on-surface),38%)}::slotted(mdui-avatar[slot=end-icon]),::slotted(mdui-avatar[slot=icon]),::slotted(mdui-avatar[slot=selected-icon]){width:1.5rem;height:1.5rem}:host([disabled]) ::slotted(mdui-avatar[slot=end-icon]),:host([disabled]) ::slotted(mdui-avatar[slot=icon]),:host([disabled]) ::slotted(mdui-avatar[slot=selected-icon]){opacity:.38}::slotted(mdui-avatar[slot=icon]),::slotted(mdui-avatar[slot=selected-icon]){margin-left:-.25rem;margin-right:-.125rem}::slotted(mdui-avatar[slot=end-icon]){margin-right:-.25rem;margin-left:-.125rem}.delete-icon{display:inline-flex;font-size:1.28571429em;transition:background-color var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);border-radius:var(--mdui-shape-corner-full);margin-right:-.25rem;margin-left:-.25rem;padding:.25rem;color:rgb(var(--mdui-color-on-surface-variant))}.delete-icon:hover{background-color:rgba(var(--mdui-color-on-surface-variant),12%)}.has-end-icon .delete-icon{margin-left:.25rem}:host([variant=assiat]) .delete-icon{color:rgb(var(--mdui-color-primary))}:host([variant=input]) .delete-icon{margin-right:.0625rem}:host([disabled]) .delete-icon{color:rgba(var(--mdui-color-on-surface),38%)}.delete-icon .i,::slotted([slot=delete-icon]){font-size:inherit}::slotted(mdui-avatar[slot=delete-icon]){width:1.125rem;height:1.125rem}`;
61
+ );
62
+ }
63
+ :host([disabled]),
64
+ :host([loading]) {
65
+ cursor: default;
66
+ pointer-events: none;
67
+ }
68
+ :host([disabled]) {
69
+ border-color: rgba(var(--mdui-color-on-surface), 12%);
70
+ color: rgba(var(--mdui-color-on-surface), 38%);
71
+ box-shadow: var(--mdui-elevation-level0);
72
+ }
73
+ :host([disabled][elevated]),
74
+ :host([disabled][selected]) {
75
+ background-color: rgba(var(--mdui-color-on-surface), 12%);
76
+ }
77
+ :host([selected][hover]) {
78
+ box-shadow: var(--mdui-elevation-level1);
79
+ }
80
+ :host([elevated][hover]) {
81
+ color: rgb(var(--mdui-color-on-secondary-container));
82
+ box-shadow: var(--mdui-elevation-level2);
83
+ }
84
+ :host([variant='filter'][hover]),
85
+ :host([variant='input'][hover]),
86
+ :host([variant='suggestion'][hover]) {
87
+ color: rgb(var(--mdui-color-on-surface-variant));
88
+ }
89
+ :host([variant='filter'][focus-visible]),
90
+ :host([variant='input'][focus-visible]),
91
+ :host([variant='suggestion'][focus-visible]) {
92
+ border-color: rgb(var(--mdui-color-on-surface-variant));
93
+ }
94
+ :host([dragged]),
95
+ :host([dragged][hover]) {
96
+ box-shadow: var(--mdui-elevation-level4);
97
+ }
98
+ .button {
99
+ overflow: visible;
100
+ }
101
+ .label {
102
+ display: inline-flex;
103
+ padding-right: 0.5rem;
104
+ padding-left: 0.5rem;
105
+ }
106
+ .icon,
107
+ .selected-icon,
108
+ .end-icon {
109
+ display: inline-flex;
110
+ font-size: 1.28571429em;
111
+ color: rgb(var(--mdui-color-on-surface-variant));
112
+ }
113
+ :host([variant='assist']) .icon,
114
+ :host([variant='assist']) .selected-icon,
115
+ :host([variant='assist']) .end-icon {
116
+ color: rgb(var(--mdui-color-primary));
117
+ }
118
+ :host([selected]) .icon,
119
+ :host([selected]) .selected-icon,
120
+ :host([selected]) .end-icon {
121
+ color: rgb(var(--mdui-color-on-secondary-container));
122
+ }
123
+ :host([disabled]) .icon,
124
+ :host([disabled]) .selected-icon,
125
+ :host([disabled]) .end-icon {
126
+ opacity: 0.38;
127
+ color: rgb(var(--mdui-color-on-surface));
128
+ }
129
+ .icon .i,
130
+ .selected-icon .i,
131
+ .end-icon .i,
132
+ ::slotted([slot='icon']),
133
+ ::slotted([slot='selected-icon']),
134
+ ::slotted([slot='end-icon']) {
135
+ font-size: inherit;
136
+ }
137
+ :host([variant='input']) .has-icon .icon,
138
+ :host([variant='input']) .has-icon .selected-icon,
139
+ :host([variant='input']) .has-icon mdui-circular-progress {
140
+ margin-left: 0.25rem;
141
+ }
142
+ :host([variant='input']) .has-end-icon .end-icon {
143
+ margin-right: 0.25rem;
144
+ }
145
+ mdui-circular-progress {
146
+ display: inline-flex;
147
+ width: 1.125rem;
148
+ height: 1.125rem;
149
+ }
150
+ :host([disabled]) mdui-circular-progress {
151
+ stroke: rgba(var(--mdui-color-on-surface), 38%);
152
+ }
153
+ ::slotted(mdui-avatar[slot='icon']),
154
+ ::slotted(mdui-avatar[slot='end-icon']),
155
+ ::slotted(mdui-avatar[slot='selected-icon']) {
156
+ width: 1.5rem;
157
+ height: 1.5rem;
158
+ }
159
+ :host([disabled]) ::slotted(mdui-avatar[slot='icon']),
160
+ :host([disabled]) ::slotted(mdui-avatar[slot='end-icon']),
161
+ :host([disabled]) ::slotted(mdui-avatar[slot='selected-icon']) {
162
+ opacity: 0.38;
163
+ }
164
+ ::slotted(mdui-avatar[slot='icon']),
165
+ ::slotted(mdui-avatar[slot='selected-icon']) {
166
+ margin-left: -0.25rem;
167
+ margin-right: -0.125rem;
168
+ }
169
+ ::slotted(mdui-avatar[slot='end-icon']) {
170
+ margin-right: -0.25rem;
171
+ margin-left: -0.125rem;
172
+ }
173
+ .delete-icon {
174
+ display: inline-flex;
175
+ font-size: 1.28571429em;
176
+ transition: background-color var(--mdui-motion-duration-short4)
177
+ var(--mdui-motion-easing-linear);
178
+ border-radius: var(--mdui-shape-corner-full);
179
+ margin-right: -0.25rem;
180
+ margin-left: -0.25rem;
181
+ padding: 0.25rem;
182
+ color: rgb(var(--mdui-color-on-surface-variant));
183
+ }
184
+ .delete-icon:hover {
185
+ background-color: rgba(var(--mdui-color-on-surface-variant), 12%);
186
+ }
187
+ .has-end-icon .delete-icon {
188
+ margin-left: 0.25rem;
189
+ }
190
+ :host([variant='assiat']) .delete-icon {
191
+ color: rgb(var(--mdui-color-primary));
192
+ }
193
+ :host([variant='input']) .delete-icon {
194
+ margin-right: 0.0625rem;
195
+ }
196
+ :host([disabled]) .delete-icon {
197
+ color: rgba(var(--mdui-color-on-surface), 38%);
198
+ }
199
+ .delete-icon .i,
200
+ ::slotted([slot='delete-icon']) {
201
+ font-size: inherit;
202
+ }
203
+ ::slotted(mdui-avatar[slot='delete-icon']) {
204
+ width: 1.125rem;
205
+ height: 1.125rem;
206
+ }
207
+ `;
@@ -23,10 +23,14 @@ let CircularProgress = class CircularProgress extends MduiElement {
23
23
  }
24
24
  render() {
25
25
  const isDeterminate = !isUndefined(this.value);
26
- return html `<div class="progress ${classMap({
26
+ return html `<div
27
+ class="progress ${classMap({
27
28
  determinate: isDeterminate,
28
29
  indeterminate: !isDeterminate,
29
- })}">${isDeterminate ? this.renderDeterminate() : this.renderInDeterminate()}</div>`;
30
+ })}"
31
+ >
32
+ ${isDeterminate ? this.renderDeterminate() : this.renderInDeterminate()}
33
+ </div>`;
30
34
  }
31
35
  renderDeterminate() {
32
36
  const value = this.value;
@@ -36,7 +40,24 @@ let CircularProgress = class CircularProgress extends MduiElement {
36
40
  const center = circleRadius + strokeWidth / 2;
37
41
  const circumference = 2 * π * circleRadius;
38
42
  const determinateStrokeDashOffset = (1 - value / Math.max(this.max ?? value, value)) * circumference;
39
- return html `<svg viewBox="0 0 ${center * 2} ${center * 2}"><circle class="track" cx="${center}" cy="${center}" r="${circleRadius}" stroke-width="${strokeWidth}"></circle><circle class="circle" cx="${center}" cy="${center}" r="${circleRadius}" stroke-dasharray="${2 * π * circleRadius}" stroke-dashoffset="${determinateStrokeDashOffset}" stroke-width="${strokeWidth}"></circle></svg>`;
43
+ return html `<svg viewBox="0 0 ${center * 2} ${center * 2}">
44
+ <circle
45
+ class="track"
46
+ cx="${center}"
47
+ cy="${center}"
48
+ r="${circleRadius}"
49
+ stroke-width="${strokeWidth}"
50
+ ></circle>
51
+ <circle
52
+ class="circle"
53
+ cx="${center}"
54
+ cy="${center}"
55
+ r="${circleRadius}"
56
+ stroke-dasharray="${2 * π * circleRadius}"
57
+ stroke-dashoffset="${determinateStrokeDashOffset}"
58
+ stroke-width="${strokeWidth}"
59
+ ></circle>
60
+ </svg>`;
40
61
  }
41
62
  renderInDeterminate() {
42
63
  const strokeWidth = 4; // 圆环宽度
@@ -45,8 +66,21 @@ let CircularProgress = class CircularProgress extends MduiElement {
45
66
  const center = circleRadius + strokeWidth / 2;
46
67
  const circumference = 2 * π * circleRadius;
47
68
  const halfCircumference = 0.5 * circumference;
48
- const circle = (thisStrokeWidth) => html `<svg class="circle" viewBox="0 0 ${center * 2} ${center * 2}"><circle cx="${center}" cy="${center}" r="${circleRadius}" stroke-dasharray="${circumference}" stroke-dashoffset="${halfCircumference}" stroke-width="${thisStrokeWidth}"></circle></svg>`;
49
- return html `<div class="layer"><div class="clipper left">${circle(strokeWidth)}</div><div class="gap-patch">${circle(strokeWidth * 0.8)}</div><div class="clipper right">${circle(strokeWidth)}</div></div>`;
69
+ const circle = (thisStrokeWidth) => html `<svg class="circle" viewBox="0 0 ${center * 2} ${center * 2}">
70
+ <circle
71
+ cx="${center}"
72
+ cy="${center}"
73
+ r="${circleRadius}"
74
+ stroke-dasharray="${circumference}"
75
+ stroke-dashoffset="${halfCircumference}"
76
+ stroke-width="${thisStrokeWidth}"
77
+ ></circle>
78
+ </svg>`;
79
+ return html `<div class="layer">
80
+ <div class="clipper left">${circle(strokeWidth)}</div>
81
+ <div class="gap-patch">${circle(strokeWidth * 0.8)}</div>
82
+ <div class="clipper right">${circle(strokeWidth)}</div>
83
+ </div>`;
50
84
  }
51
85
  };
52
86
  CircularProgress.styles = [componentStyle, style];