mdui 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/components/avatar/index.d.ts +13 -13
  2. package/components/avatar/index.js +11 -6
  3. package/components/avatar/style.js +31 -1
  4. package/components/badge/index.d.ts +7 -6
  5. package/components/badge/index.js +6 -5
  6. package/components/badge/style.js +25 -1
  7. package/components/bottom-app-bar/index.d.ts +4 -3
  8. package/components/bottom-app-bar/index.js +3 -3
  9. package/components/bottom-app-bar/style.js +92 -1
  10. package/components/button/button-base-style.js +28 -1
  11. package/components/button/button-base.d.ts +43 -44
  12. package/components/button/button-base.js +28 -21
  13. package/components/button/index.d.ts +13 -13
  14. package/components/button/index.js +30 -20
  15. package/components/button/style.js +111 -2
  16. package/components/button-icon/index.d.ts +8 -8
  17. package/components/button-icon/index.js +29 -12
  18. package/components/button-icon/style.js +103 -2
  19. package/components/card/index.d.ts +8 -8
  20. package/components/card/index.js +12 -8
  21. package/components/card/style.js +72 -1
  22. package/components/checkbox/index.d.ts +20 -20
  23. package/components/checkbox/index.js +68 -25
  24. package/components/checkbox/style.js +131 -1
  25. package/components/chip/index.d.ts +19 -19
  26. package/components/chip/index.js +49 -25
  27. package/components/chip/style.js +205 -2
  28. package/components/circular-progress/index.d.ts +2 -2
  29. package/components/circular-progress/index.js +40 -6
  30. package/components/circular-progress/style.js +136 -1
  31. package/components/collapse/collapse-item-style.js +21 -1
  32. package/components/collapse/collapse-item.d.ts +4 -4
  33. package/components/collapse/collapse-item.js +12 -4
  34. package/components/collapse/collapse-style.js +5 -1
  35. package/components/collapse/collapse.d.ts +6 -9
  36. package/components/collapse/collapse.js +8 -5
  37. package/components/dialog/index.d.ts +13 -13
  38. package/components/dialog/index.js +48 -20
  39. package/components/dialog/style.js +116 -1
  40. package/components/divider/index.d.ts +3 -3
  41. package/components/divider/index.js +3 -3
  42. package/components/divider/style.js +18 -1
  43. package/components/dropdown/index.d.ts +35 -35
  44. package/components/dropdown/index.js +41 -34
  45. package/components/dropdown/style.js +11 -1
  46. package/components/fab/index.d.ts +6 -6
  47. package/components/fab/index.js +19 -11
  48. package/components/fab/style.js +153 -4
  49. package/components/icon/index.js +5 -1
  50. package/components/icon/style.js +29 -1
  51. package/components/layout/layout-item-style.js +6 -1
  52. package/components/layout/layout-item.d.ts +7 -7
  53. package/components/layout/layout-item.js +6 -6
  54. package/components/layout/layout-main-style.js +7 -1
  55. package/components/layout/layout-main.d.ts +2 -2
  56. package/components/layout/layout-main.js +2 -2
  57. package/components/layout/layout-style.js +11 -1
  58. package/components/layout/layout.d.ts +2 -2
  59. package/components/layout/layout.js +2 -2
  60. package/components/linear-progress/index.d.ts +4 -4
  61. package/components/linear-progress/index.js +9 -5
  62. package/components/linear-progress/style.js +73 -1
  63. package/components/list/list-item-style.js +153 -2
  64. package/components/list/list-item.d.ts +17 -17
  65. package/components/list/list-item.js +34 -15
  66. package/components/list/list-style.js +10 -1
  67. package/components/list/list-subheader-style.js +19 -1
  68. package/components/list/list-subheader.d.ts +2 -2
  69. package/components/list/list-subheader.js +2 -2
  70. package/components/list/list.d.ts +1 -1
  71. package/components/list/list.js +1 -1
  72. package/components/menu/menu-item-style.js +125 -1
  73. package/components/menu/menu-item.d.ts +4 -4
  74. package/components/menu/menu-item.js +57 -15
  75. package/components/menu/menu-style.js +19 -1
  76. package/components/menu/menu.d.ts +15 -18
  77. package/components/menu/menu.js +13 -9
  78. package/components/navigation-bar/navigation-bar-item-style.js +132 -1
  79. package/components/navigation-bar/navigation-bar-item.d.ts +5 -5
  80. package/components/navigation-bar/navigation-bar-item.js +27 -11
  81. package/components/navigation-bar/navigation-bar-style.js +28 -1
  82. package/components/navigation-bar/navigation-bar.d.ts +9 -8
  83. package/components/navigation-bar/navigation-bar.js +10 -7
  84. package/components/navigation-drawer/index.d.ts +19 -20
  85. package/components/navigation-drawer/index.js +56 -31
  86. package/components/navigation-drawer/style.js +66 -1
  87. package/components/navigation-rail/navigation-rail-item-style.js +122 -1
  88. package/components/navigation-rail/navigation-rail-item.d.ts +6 -6
  89. package/components/navigation-rail/navigation-rail-item.js +30 -11
  90. package/components/navigation-rail/navigation-rail-style.js +79 -1
  91. package/components/navigation-rail/navigation-rail.d.ts +10 -11
  92. package/components/navigation-rail/navigation-rail.js +19 -11
  93. package/components/radio/radio-group-style.js +20 -1
  94. package/components/radio/radio-group.d.ts +13 -13
  95. package/components/radio/radio-group.js +30 -12
  96. package/components/radio/radio-style.js +107 -1
  97. package/components/radio/radio.d.ts +3 -3
  98. package/components/radio/radio.js +26 -8
  99. package/components/range-slider/index.d.ts +5 -6
  100. package/components/range-slider/index.js +57 -10
  101. package/components/ripple/index.js +5 -2
  102. package/components/ripple/style.js +96 -1
  103. package/components/segmented-button/segmented-button-group-style.js +28 -1
  104. package/components/segmented-button/segmented-button-group.d.ts +17 -20
  105. package/components/segmented-button/segmented-button-group.js +32 -15
  106. package/components/segmented-button/segmented-button-style.js +81 -2
  107. package/components/segmented-button/segmented-button.d.ts +3 -3
  108. package/components/segmented-button/segmented-button.js +30 -14
  109. package/components/select/index.d.ts +31 -32
  110. package/components/select/index.js +106 -26
  111. package/components/select/style.js +27 -1
  112. package/components/slider/index.d.ts +1 -1
  113. package/components/slider/index.js +34 -3
  114. package/components/slider/slider-base-style.js +173 -1
  115. package/components/slider/slider-base.d.ts +15 -15
  116. package/components/slider/slider-base.js +19 -14
  117. package/components/slider/style.js +7 -1
  118. package/components/snackbar/index.d.ts +21 -21
  119. package/components/snackbar/index.js +47 -20
  120. package/components/snackbar/style.js +100 -1
  121. package/components/switch/index.d.ts +14 -14
  122. package/components/switch/index.js +51 -17
  123. package/components/switch/style.js +202 -1
  124. package/components/tabs/tab-panel-style.js +10 -1
  125. package/components/tabs/tab-panel.d.ts +3 -3
  126. package/components/tabs/tab-panel.js +2 -2
  127. package/components/tabs/tab-style.js +85 -1
  128. package/components/tabs/tab.d.ts +6 -6
  129. package/components/tabs/tab.js +29 -9
  130. package/components/tabs/tabs-style.js +138 -1
  131. package/components/tabs/tabs.d.ts +19 -19
  132. package/components/tabs/tabs.js +26 -18
  133. package/components/text-field/index.d.ts +51 -51
  134. package/components/text-field/index.js +185 -57
  135. package/components/text-field/style.js +362 -1
  136. package/components/tooltip/index.d.ts +31 -31
  137. package/components/tooltip/index.js +38 -29
  138. package/components/tooltip/style.js +57 -1
  139. package/components/top-app-bar/top-app-bar-style.js +78 -1
  140. package/components/top-app-bar/top-app-bar-title-style.js +81 -1
  141. package/components/top-app-bar/top-app-bar-title.d.ts +4 -4
  142. package/components/top-app-bar/top-app-bar-title.js +21 -7
  143. package/components/top-app-bar/top-app-bar.d.ts +5 -5
  144. package/components/top-app-bar/top-app-bar.js +4 -4
  145. package/css-data.en.json +2826 -0
  146. package/css-data.zh-cn.json +374 -367
  147. package/custom-elements.json +2049 -2049
  148. package/html-data.en.json +6560 -0
  149. package/html-data.zh-cn.json +1427 -1433
  150. package/jsx.en.d.ts +3303 -0
  151. package/jsx.zh-cn.d.ts +3351 -0
  152. package/package.json +6 -5
  153. package/web-types.en.json +11734 -0
  154. package/web-types.zh-cn.json +3227 -3221
  155. package/mdui.esm.js +0 -22
  156. package/mdui.global.js +0 -22
@@ -25,36 +25,36 @@ import { style } from './style.js';
25
25
  * @event change - 选中状态变更时触发
26
26
  * @event delete - 点击删除图标时触发
27
27
  *
28
- * @slot - 文本
28
+ * @slot - 纸片文本
29
29
  * @slot icon - 左侧元素
30
30
  * @slot end-icon - 右侧元素
31
- * @slot selected-icon - 选中状态的左侧元素
32
- * @slot delete-icon - 可删除时,右侧的删除元素
31
+ * @slot selected-icon - 选中状态下的左侧元素
32
+ * @slot delete-icon - 可删除时的右侧删除元素
33
33
  *
34
- * @csspart button - 内部的 `button``a` 元素
35
- * @csspart label - 文本
34
+ * @csspart button - 内部的 `<button>``<a>` 元素
35
+ * @csspart label - 纸片文本
36
36
  * @csspart icon - 左侧图标
37
37
  * @csspart end-icon - 右侧图标
38
- * @csspart selected-icon - 选中状态的左侧图标
39
- * @csspart delete-icon - 可删除时,右侧的删除图标
38
+ * @csspart selected-icon - 选中状态下的左侧图标
39
+ * @csspart delete-icon - 可删除时的右侧删除图标
40
40
  * @csspart loading - 加载中状态的 `<mdui-circular-progress>` 元素
41
41
  *
42
- * @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
42
+ * @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
43
43
  */
44
44
  let Chip = class Chip extends ButtonBase {
45
45
  constructor() {
46
46
  super();
47
47
  /**
48
- * 纸片形状。可选值为:
48
+ * 纸片的形状。可选值包括:
49
49
  *
50
- * * `assist`:用于显示和当前上下文相关的辅助操作。例如在点餐页面,提供分享,收藏等功能
51
- * * `filter`:用于对内容进行筛选。例如在搜索结果页,对搜索结果进行过滤
52
- * * `input`:用于表示用户输入的信息片段。例如 Gmail 中“收件人”字段中的联系人
53
- * * `suggestion`:用于提供动态生成的推荐信息,以简化用户操作。例如在聊天应用中猜测用户可能想发送的信息,供用户选择
50
+ * * `assist`:用于显示与当前上下文相关的辅助操作,如在点餐页面提供分享、收藏等功能
51
+ * * `filter`:用于对内容进行筛选,如在搜索结果页过滤搜索结果
52
+ * * `input`:用于表示用户输入的信息片段,如在 Gmail 的“收件人”字段中的联系人
53
+ * * `suggestion`:用于提供动态生成的推荐信息,以简化用户操作,如在聊天应用中预测用户可能想发送的信息
54
54
  */
55
55
  this.variant = 'assist';
56
56
  /**
57
- * 是否包含阴影
57
+ * 是否显示阴影
58
58
  */
59
59
  this.elevated = false;
60
60
  /**
@@ -62,11 +62,11 @@ let Chip = class Chip extends ButtonBase {
62
62
  */
63
63
  this.selectable = false;
64
64
  /**
65
- * 是否为选中状态
65
+ * 是否已选中
66
66
  */
67
67
  this.selected = false;
68
68
  /**
69
- * 是否可删除。为 `true` 时,在右侧会显示删除图标图标
69
+ * 是否可删除。为 `true` 时,纸片右侧会显示删除图标
70
70
  */
71
71
  this.deletable = false;
72
72
  this.rippleRef = createRef();
@@ -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
+ `;
@@ -10,11 +10,11 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
10
10
  export declare class CircularProgress extends MduiElement<CircularProgressEventMap> {
11
11
  static styles: CSSResultGroup;
12
12
  /**
13
- * 进度指示器的最大值,默认为 1
13
+ * 进度指示器的最大值。默认为 `1`
14
14
  */
15
15
  max: number;
16
16
  /**
17
- * 进度指示器的当前值。若未指定该值,则为不确定状态
17
+ * 进度指示器的当前值。如果未指定该值,则显示为不确定状态
18
18
  */
19
19
  value?: number;
20
20
  protected render(): TemplateResult;
@@ -17,16 +17,20 @@ let CircularProgress = class CircularProgress extends MduiElement {
17
17
  constructor() {
18
18
  super(...arguments);
19
19
  /**
20
- * 进度指示器的最大值,默认为 1
20
+ * 进度指示器的最大值。默认为 `1`
21
21
  */
22
22
  this.max = 1;
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];
@@ -1,2 +1,137 @@
1
1
  import { css } from 'lit';
2
- export const style = css `:host{position:relative;display:inline-block;width:2.5rem;height:2.5rem;stroke:rgb(var(--mdui-color-primary))}.progress{position:relative;display:inline-block;width:100%;height:100%;text-align:left;transition:opacity var(--mdui-motion-duration-medium1) var(--mdui-motion-easing-linear)}.determinate svg{transform:rotate(-90deg);fill:transparent}.determinate .track{stroke:transparent}.determinate .circle{stroke:inherit;transition:stroke-dashoffset var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard)}.indeterminate{font-size:0;letter-spacing:0;white-space:nowrap;animation:mdui-comp-circular-progress-rotate 1568ms var(--mdui-motion-easing-linear) infinite}.indeterminate .circle,.indeterminate .layer{position:absolute;width:100%;height:100%}.indeterminate .layer{animation:mdui-comp-circular-progress-layer-rotate 5332ms var(--mdui-motion-easing-standard) infinite both}.indeterminate .circle{fill:transparent;stroke:inherit}.indeterminate .gap-patch{position:absolute;top:0;left:47.5%;width:5%;height:100%;overflow:hidden}.indeterminate .gap-patch .circle{left:-900%;width:2000%;transform:rotate(180deg)}.indeterminate .clipper{position:relative;display:inline-block;width:50%;height:100%;overflow:hidden}.indeterminate .clipper .circle{width:200%}.indeterminate .clipper.left .circle{animation:mdui-comp-circular-progress-left-spin 1333ms var(--mdui-motion-easing-standard) infinite both}.indeterminate .clipper.right .circle{left:-100%;animation:mdui-comp-circular-progress-right-spin 1333ms var(--mdui-motion-easing-standard) infinite both}@keyframes mdui-comp-circular-progress-rotate{to{transform:rotate(360deg)}}@keyframes mdui-comp-circular-progress-layer-rotate{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes mdui-comp-circular-progress-left-spin{0%{transform:rotate(265deg)}50%{transform:rotate(130deg)}100%{transform:rotate(265deg)}}@keyframes mdui-comp-circular-progress-right-spin{0%{transform:rotate(-265deg)}50%{transform:rotate(-130deg)}100%{transform:rotate(-265deg)}}`;
2
+ export const style = css `
3
+ :host {
4
+ position: relative;
5
+ display: inline-block;
6
+ width: 2.5rem;
7
+ height: 2.5rem;
8
+ stroke: rgb(var(--mdui-color-primary));
9
+ }
10
+ .progress {
11
+ position: relative;
12
+ display: inline-block;
13
+ width: 100%;
14
+ height: 100%;
15
+ text-align: left;
16
+ transition: opacity var(--mdui-motion-duration-medium1)
17
+ var(--mdui-motion-easing-linear);
18
+ }
19
+ .determinate svg {
20
+ transform: rotate(-90deg);
21
+ fill: transparent;
22
+ }
23
+ .determinate .track {
24
+ stroke: transparent;
25
+ }
26
+ .determinate .circle {
27
+ stroke: inherit;
28
+ transition: stroke-dashoffset var(--mdui-motion-duration-long2)
29
+ var(--mdui-motion-easing-standard);
30
+ }
31
+ .indeterminate {
32
+ font-size: 0;
33
+ letter-spacing: 0;
34
+ white-space: nowrap;
35
+ animation: mdui-comp-circular-progress-rotate 1568ms
36
+ var(--mdui-motion-easing-linear) infinite;
37
+ }
38
+ .indeterminate .layer,
39
+ .indeterminate .circle {
40
+ position: absolute;
41
+ width: 100%;
42
+ height: 100%;
43
+ }
44
+ .indeterminate .layer {
45
+ animation: mdui-comp-circular-progress-layer-rotate 5332ms
46
+ var(--mdui-motion-easing-standard) infinite both;
47
+ }
48
+ .indeterminate .circle {
49
+ fill: transparent;
50
+ stroke: inherit;
51
+ }
52
+ .indeterminate .gap-patch {
53
+ position: absolute;
54
+ top: 0;
55
+ left: 47.5%;
56
+ width: 5%;
57
+ height: 100%;
58
+ overflow: hidden;
59
+ }
60
+ .indeterminate .gap-patch .circle {
61
+ left: -900%;
62
+ width: 2000%;
63
+ transform: rotate(180deg);
64
+ }
65
+ .indeterminate .clipper {
66
+ position: relative;
67
+ display: inline-block;
68
+ width: 50%;
69
+ height: 100%;
70
+ overflow: hidden;
71
+ }
72
+ .indeterminate .clipper .circle {
73
+ width: 200%;
74
+ }
75
+ .indeterminate .clipper.left .circle {
76
+ animation: mdui-comp-circular-progress-left-spin 1333ms
77
+ var(--mdui-motion-easing-standard) infinite both;
78
+ }
79
+ .indeterminate .clipper.right .circle {
80
+ left: -100%;
81
+ animation: mdui-comp-circular-progress-right-spin 1333ms
82
+ var(--mdui-motion-easing-standard) infinite both;
83
+ }
84
+ @keyframes mdui-comp-circular-progress-rotate {
85
+ to {
86
+ transform: rotate(360deg);
87
+ }
88
+ }
89
+ @keyframes mdui-comp-circular-progress-layer-rotate {
90
+ 12.5% {
91
+ transform: rotate(135deg);
92
+ }
93
+ 25% {
94
+ transform: rotate(270deg);
95
+ }
96
+ 37.5% {
97
+ transform: rotate(405deg);
98
+ }
99
+ 50% {
100
+ transform: rotate(540deg);
101
+ }
102
+ 62.5% {
103
+ transform: rotate(675deg);
104
+ }
105
+ 75% {
106
+ transform: rotate(810deg);
107
+ }
108
+ 87.5% {
109
+ transform: rotate(945deg);
110
+ }
111
+ 100% {
112
+ transform: rotate(1080deg);
113
+ }
114
+ }
115
+ @keyframes mdui-comp-circular-progress-left-spin {
116
+ 0% {
117
+ transform: rotate(265deg);
118
+ }
119
+ 50% {
120
+ transform: rotate(130deg);
121
+ }
122
+ 100% {
123
+ transform: rotate(265deg);
124
+ }
125
+ }
126
+ @keyframes mdui-comp-circular-progress-right-spin {
127
+ 0% {
128
+ transform: rotate(-265deg);
129
+ }
130
+ 50% {
131
+ transform: rotate(-130deg);
132
+ }
133
+ 100% {
134
+ transform: rotate(-265deg);
135
+ }
136
+ }
137
+ `;
@@ -1,2 +1,22 @@
1
1
  import { css } from 'lit';
2
- export const collapseItemStyle = css `:host{display:flex;flex-direction:column}.header{display:block}.body{display:block;overflow:hidden;transition:height var(--mdui-motion-duration-short4) var(--mdui-motion-easing-emphasized)}.body.opened{overflow:visible}.body.active{transition-duration:var(--mdui-motion-duration-medium4)}`;
2
+ export const collapseItemStyle = css `
3
+ :host {
4
+ display: flex;
5
+ flex-direction: column;
6
+ }
7
+ .header {
8
+ display: block;
9
+ }
10
+ .body {
11
+ display: block;
12
+ overflow: hidden;
13
+ transition: height var(--mdui-motion-duration-short4)
14
+ var(--mdui-motion-easing-emphasized);
15
+ }
16
+ .body.opened {
17
+ overflow: visible;
18
+ }
19
+ .body.active {
20
+ transition-duration: var(--mdui-motion-duration-medium4);
21
+ }
22
+ `;
@@ -3,7 +3,7 @@ import { MduiElement } from '@mdui/shared/base/mdui-element.js';
3
3
  import type { JQ } from '@mdui/jq/shared/core.js';
4
4
  import type { CSSResultGroup, TemplateResult, PropertyValues } from 'lit';
5
5
  /**
6
- * @summary 折叠面板项组件。需与 `<mdui-collapse>` 组件配合使用
6
+ * @summary 折叠面板项组件,需配合 `<mdui-collapse>` 组件使用
7
7
  *
8
8
  * ```html
9
9
  * <mdui-collapse>
@@ -26,15 +26,15 @@ import type { CSSResultGroup, TemplateResult, PropertyValues } from 'lit';
26
26
  export declare class CollapseItem extends MduiElement<CollapseItemEventMap> {
27
27
  static styles: CSSResultGroup;
28
28
  /**
29
- * 该折叠面板项的值
29
+ * 此折叠面板项的值
30
30
  */
31
31
  value?: string;
32
32
  /**
33
- * 该折叠面板项的头部文本
33
+ * 此折叠面板项的头部文本
34
34
  */
35
35
  header?: string;
36
36
  /**
37
- * 是否禁用该折叠面板项
37
+ * 是否禁用此折叠面板项
38
38
  */
39
39
  disabled: boolean;
40
40
  /**