mdui 2.1.2 → 2.1.4

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 (122) hide show
  1. package/components/bottom-app-bar/style.js +1 -1
  2. package/components/button/style.js +2 -2
  3. package/components/button-icon/style.js +2 -2
  4. package/components/card/style.js +1 -1
  5. package/components/checkbox/style.js +1 -1
  6. package/components/chip/style.js +2 -2
  7. package/components/collapse/collapse-item.js +1 -0
  8. package/components/dialog/style.js +1 -1
  9. package/components/divider/style.js +1 -1
  10. package/components/dropdown/index.js +9 -4
  11. package/components/fab/style.js +1 -1
  12. package/components/icon/index.js +1 -1
  13. package/components/layout/layout-style.js +1 -1
  14. package/components/list/list-item-style.js +2 -2
  15. package/components/list/list-item.js +5 -4
  16. package/components/menu/menu-item-style.js +1 -1
  17. package/components/navigation-bar/navigation-bar-style.js +1 -1
  18. package/components/navigation-drawer/index.d.ts +1 -0
  19. package/components/navigation-drawer/index.js +17 -11
  20. package/components/navigation-drawer/style.js +1 -1
  21. package/components/navigation-rail/navigation-rail-style.js +1 -1
  22. package/components/radio/radio-style.js +1 -1
  23. package/components/segmented-button/segmented-button-group-style.js +1 -1
  24. package/components/segmented-button/segmented-button-style.js +1 -1
  25. package/components/select/index.d.ts +0 -2
  26. package/components/select/index.js +4 -5
  27. package/components/slider/slider-base-style.js +1 -1
  28. package/components/snackbar/index.d.ts +12 -0
  29. package/components/snackbar/index.js +105 -46
  30. package/components/snackbar/style.js +1 -1
  31. package/components/switch/style.js +1 -1
  32. package/components/tabs/tab-style.js +1 -1
  33. package/components/tabs/tabs-style.js +1 -1
  34. package/components/tabs/tabs.d.ts +2 -2
  35. package/components/tabs/tabs.js +6 -4
  36. package/components/text-field/index.d.ts +5 -7
  37. package/components/text-field/index.js +32 -36
  38. package/components/text-field/style.js +1 -1
  39. package/components/tooltip/index.d.ts +1 -1
  40. package/components/tooltip/index.js +10 -8
  41. package/components/top-app-bar/top-app-bar-style.js +1 -1
  42. package/components/top-app-bar/top-app-bar.d.ts +1 -0
  43. package/components/top-app-bar/top-app-bar.js +7 -1
  44. package/custom-elements.json +246 -153
  45. package/functions/alert.js +10 -3
  46. package/functions/confirm.js +10 -3
  47. package/functions/dialog.js +8 -3
  48. package/functions/prompt.js +10 -3
  49. package/functions/snackbar.js +8 -2
  50. package/html-data.en.json +12 -22
  51. package/html-data.zh-cn.json +2 -12
  52. package/jsx.en.d.ts +2079 -2080
  53. package/jsx.zh-cn.d.ts +2062 -2063
  54. package/locales/ar-eg.js +0 -2
  55. package/locales/az-az.js +0 -2
  56. package/locales/be-by.js +0 -2
  57. package/locales/bg-bg.js +0 -2
  58. package/locales/bn-bd.js +0 -2
  59. package/locales/ca-es.js +0 -2
  60. package/locales/cs-cz.js +0 -2
  61. package/locales/da-dk.js +0 -2
  62. package/locales/de-de.js +0 -2
  63. package/locales/el-gr.js +0 -2
  64. package/locales/en-gb.js +0 -2
  65. package/locales/es-es.js +0 -2
  66. package/locales/et-ee.js +0 -2
  67. package/locales/fa-ir.js +0 -2
  68. package/locales/fi-fi.js +0 -2
  69. package/locales/fr-be.js +0 -2
  70. package/locales/fr-ca.js +0 -2
  71. package/locales/fr-fr.js +0 -2
  72. package/locales/ga-ie.js +0 -2
  73. package/locales/gl-es.js +0 -2
  74. package/locales/he-il.js +0 -2
  75. package/locales/hi-in.js +0 -2
  76. package/locales/hr-hr.js +0 -2
  77. package/locales/hu-hu.js +0 -2
  78. package/locales/hy-am.js +0 -2
  79. package/locales/id-id.js +0 -2
  80. package/locales/is-is.js +0 -2
  81. package/locales/it-it.js +0 -2
  82. package/locales/ja-jp.js +0 -2
  83. package/locales/ka-ge.js +0 -2
  84. package/locales/kk-kz.js +0 -2
  85. package/locales/km-kh.js +0 -2
  86. package/locales/kmr-iq.js +0 -2
  87. package/locales/kn-in.js +0 -2
  88. package/locales/ko-kr.js +0 -2
  89. package/locales/lt-lt.js +0 -2
  90. package/locales/lv-lv.js +0 -2
  91. package/locales/mk-mk.js +0 -2
  92. package/locales/ml-in.js +0 -2
  93. package/locales/mn-mn.js +0 -2
  94. package/locales/ms-my.js +0 -2
  95. package/locales/nb-no.js +0 -2
  96. package/locales/ne-np.js +0 -2
  97. package/locales/nl-be.js +0 -2
  98. package/locales/nl-nl.js +0 -2
  99. package/locales/pl-pl.js +0 -2
  100. package/locales/pt-br.js +0 -2
  101. package/locales/pt-pt.js +0 -2
  102. package/locales/ro-ro.js +0 -2
  103. package/locales/ru-ru.js +0 -2
  104. package/locales/sk-sk.js +0 -2
  105. package/locales/sl-si.js +0 -2
  106. package/locales/sr-rs.js +0 -2
  107. package/locales/sv-se.js +0 -2
  108. package/locales/ta-in.js +0 -2
  109. package/locales/th-th.js +0 -2
  110. package/locales/tr-tr.js +0 -2
  111. package/locales/uk-ua.js +0 -2
  112. package/locales/ur-pk.js +0 -2
  113. package/locales/vi-vn.js +0 -2
  114. package/locales/zh-cn.js +0 -2
  115. package/locales/zh-hk.js +0 -2
  116. package/locales/zh-tw.js +0 -2
  117. package/mdui.css +1 -1
  118. package/mdui.esm.js +9 -9
  119. package/mdui.global.js +9 -9
  120. package/package.json +9 -10
  121. package/web-types.en.json +17 -23
  122. package/web-types.zh-cn.json +7 -13
@@ -62,7 +62,7 @@ let Tooltip = class Tooltip extends MduiElement {
62
62
  /**
63
63
  * tooltip 的位置。默认为 `auto`。可选值包括:
64
64
  *
65
- * * `auto`:自动判断位置。`variant="plan"` 时,优先使用 `top`;`variant="rich"` 时,优先使用 `bottom-right`
65
+ * * `auto`:自动判断位置。`variant="plain"` 时,优先使用 `top`;`variant="rich"` 时,优先使用 `bottom-right`
66
66
  * * `top-left`:位于左上方
67
67
  * * `top-start`:位于上方,左对齐
68
68
  * * `top`:位于上方,居中对齐
@@ -182,9 +182,15 @@ let Tooltip = class Tooltip extends MduiElement {
182
182
  connectedCallback() {
183
183
  super.connectedCallback();
184
184
  document.addEventListener('pointerdown', this.onDocumentClick);
185
- this.overflowAncestors = getOverflowAncestors(this.target);
186
- this.overflowAncestors.forEach((ancestor) => {
187
- ancestor.addEventListener('scroll', this.onWindowScroll);
185
+ this.definedController.whenDefined().then(() => {
186
+ this.overflowAncestors = getOverflowAncestors(this.target);
187
+ this.overflowAncestors.forEach((ancestor) => {
188
+ ancestor.addEventListener('scroll', this.onWindowScroll);
189
+ });
190
+ // trigger 尺寸变化时,重新调整 tooltip 的位置
191
+ this.observeResize = observeResize(this.target, () => {
192
+ this.updatePositioner();
193
+ });
188
194
  });
189
195
  }
190
196
  disconnectedCallback() {
@@ -205,10 +211,6 @@ let Tooltip = class Tooltip extends MduiElement {
205
211
  target.addEventListener('keydown', this.onKeydown);
206
212
  target.addEventListener('mouseenter', this.onMouseEnter);
207
213
  target.addEventListener('mouseleave', this.onMouseLeave);
208
- // trigger 尺寸变化时,重新调整 tooltip 的位置
209
- this.observeResize = observeResize(target, () => {
210
- this.updatePositioner();
211
- });
212
214
  });
213
215
  }
214
216
  render() {
@@ -1,2 +1,2 @@
1
1
  import { css } from 'lit';
2
- export const topAppBarStyle = css `:host{--shape-corner:var(--mdui-shape-corner-none);--z-index:2000;position:fixed;top:0;right:0;left:0;display:flex;flex:0 0 auto;align-items:flex-start;justify-content:flex-start;border-bottom-left-radius:var(--shape-corner);border-bottom-right-radius:var(--shape-corner);z-index:var(--z-index);transition:top var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard),height var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard),box-shadow var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear),background-color var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);padding:.75rem .5rem;height:4rem;background-color:rgb(var(--mdui-color-surface))}:host([scroll-target]:not([scroll-target=''])){position:absolute}:host([scroll-behavior~=shrink]){transition-duration:var(--mdui-motion-duration-short4)}:host([scrolling]){background-color:rgb(var(--mdui-color-surface-container));box-shadow:var(--mdui-elevation-level2)}::slotted(mdui-button-icon){color:rgb(var(--mdui-color-on-surface-variant));font-size:1.5rem}::slotted(mdui-button-icon:first-child){color:rgb(var(--mdui-color-on-surface))}::slotted(mdui-avatar){width:1.875rem;height:1.875rem;margin-top:.3125rem;margin-bottom:.3125rem}::slotted(*){flex-shrink:0}::slotted(:not(:last-child)){margin-right:.5rem}:host([variant=medium]){height:7rem}:host([variant=large]){height:9.5rem}:host([hide]){transition-duration:var(--mdui-motion-duration-short4);top:-4.625rem}:host([hide][variant=medium]){top:-7.625rem}:host([hide][variant=large]){top:-10.125rem}:host([shrink][variant=large]),:host([shrink][variant=medium]){transition-duration:var(--mdui-motion-duration-short4);height:4rem}`;
2
+ export const topAppBarStyle = css `:host{--shape-corner:var(--mdui-shape-corner-none);--z-index:2000;position:fixed;top:0;right:0;left:0;display:flex;flex:0 0 auto;align-items:flex-start;justify-content:flex-start;border-bottom-left-radius:var(--shape-corner);border-bottom-right-radius:var(--shape-corner);z-index:var(--z-index);transition:top var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard),height var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard),box-shadow var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear),background-color var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);padding:.75rem .5rem;height:4rem;background-color:rgb(var(--mdui-color-surface))}:host([scroll-target]:not([scroll-target=''])){position:absolute}:host([scroll-behavior~=shrink]){transition-duration:var(--mdui-motion-duration-short4)}:host([scrolling]){background-color:rgb(var(--mdui-color-surface-container));box-shadow:var(--mdui-elevation-level2)}::slotted(mdui-button-icon){color:rgb(var(--mdui-color-on-surface-variant));font-size:1.5rem}::slotted(mdui-button-icon:first-child){color:rgb(var(--mdui-color-on-surface))}::slotted(mdui-avatar){width:1.875rem;height:1.875rem;margin-top:.3125rem;margin-bottom:.3125rem}::slotted(*){flex-shrink:0}::slotted(:not(:last-child)){margin-right:.5rem}:host([variant=medium]){height:7rem}:host([variant=large]){height:9.5rem}:host([hide]:not([hide=false i])){transition-duration:var(--mdui-motion-duration-short4);top:-4.625rem}:host([hide][variant=medium]:not([hide=false i])){top:-7.625rem}:host([hide][variant=large]:not([hide=false i])){top:-10.125rem}:host([shrink][variant=large]:not([shrink=false i])),:host([shrink][variant=medium]:not([shrink=false i])){transition-duration:var(--mdui-motion-duration-short4);height:4rem}`;
@@ -57,6 +57,7 @@ export declare class TopAppBar extends TopAppBar_base<TopAppBarEventMap> {
57
57
  */
58
58
  private scrolling;
59
59
  private readonly titleElements;
60
+ private definedController;
60
61
  protected get scrollPaddingPosition(): ScrollPaddingPosition;
61
62
  protected get layoutPlacement(): LayoutPlacement;
62
63
  private onVariantChange;
@@ -1,6 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { html } from 'lit';
3
3
  import { customElement, property, queryAssignedElements, } from 'lit/decorators.js';
4
+ import { DefinedController } from '@mdui/shared/controllers/defined.js';
4
5
  import { watch } from '@mdui/shared/decorators/watch.js';
5
6
  import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
6
7
  import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
@@ -53,6 +54,9 @@ let TopAppBar = class TopAppBar extends ScrollBehaviorMixin(LayoutItemBase) {
53
54
  * 滚动条是否不位于顶部
54
55
  */
55
56
  this.scrolling = false;
57
+ this.definedController = new DefinedController(this, {
58
+ relatedElements: ['mdui-top-app-bar-title'],
59
+ });
56
60
  }
57
61
  get scrollPaddingPosition() {
58
62
  return 'top';
@@ -65,12 +69,13 @@ let TopAppBar = class TopAppBar extends ScrollBehaviorMixin(LayoutItemBase) {
65
69
  // variant 变更时,重新为 scrollTargetContainer 元素添加 padding-top。避免 top-app-bar 覆盖内容
66
70
  this.addEventListener('transitionend', async () => {
67
71
  await this.scrollBehaviorDefinedController.whenDefined();
68
- this.updateContainerPadding();
72
+ this.setContainerPadding('update', this.scrollTarget);
69
73
  }, { once: true });
70
74
  }
71
75
  else {
72
76
  await this.updateComplete;
73
77
  }
78
+ await this.definedController.whenDefined();
74
79
  this.titleElements.forEach((titleElement) => {
75
80
  titleElement.variant = this.variant;
76
81
  });
@@ -79,6 +84,7 @@ let TopAppBar = class TopAppBar extends ScrollBehaviorMixin(LayoutItemBase) {
79
84
  if (!this.hasUpdated) {
80
85
  await this.updateComplete;
81
86
  }
87
+ await this.definedController.whenDefined();
82
88
  this.titleElements.forEach((titleElement) => {
83
89
  titleElement.shrink = this.shrink;
84
90
  });