mdui 2.1.3 → 2.1.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.
- package/README.md +49 -49
- package/components/avatar/index.d.ts +2 -2
- package/components/avatar/index.js +1 -1
- package/components/badge/index.d.ts +1 -1
- package/components/badge/index.js +1 -1
- package/components/bottom-app-bar/index.d.ts +2 -2
- package/components/bottom-app-bar/index.js +2 -2
- package/components/bottom-app-bar/style.js +1 -1
- package/components/button/index.d.ts +1 -1
- package/components/button/index.js +1 -1
- package/components/button/style.js +1 -1
- package/components/button-icon/index.d.ts +1 -1
- package/components/button-icon/index.js +3 -2
- package/components/button-icon/style.js +1 -1
- package/components/card/index.d.ts +1 -1
- package/components/card/index.js +1 -1
- package/components/checkbox/index.d.ts +4 -4
- package/components/checkbox/index.js +4 -4
- package/components/chip/index.d.ts +8 -8
- package/components/chip/index.js +8 -8
- package/components/circular-progress/index.d.ts +3 -3
- package/components/circular-progress/index.js +2 -2
- package/components/collapse/collapse-item.d.ts +1 -1
- package/components/collapse/collapse-item.js +1 -0
- package/components/dialog/index.d.ts +1 -1
- package/components/dialog/index.js +1 -1
- package/components/divider/index.d.ts +2 -2
- package/components/divider/index.js +2 -2
- package/components/dropdown/index.d.ts +2 -2
- package/components/dropdown/index.js +10 -3
- package/components/fab/index.d.ts +3 -3
- package/components/fab/index.js +3 -3
- package/components/icon/index.js +1 -1
- package/components/layout/layout-item-base.d.ts +1 -1
- package/components/layout/layout.d.ts +1 -1
- package/components/layout/layout.js +1 -1
- package/components/linear-progress/index.d.ts +4 -4
- package/components/linear-progress/index.js +3 -3
- package/components/list/list-item.d.ts +4 -4
- package/components/list/list-item.js +9 -8
- package/components/menu/menu-item.d.ts +2 -2
- package/components/menu/menu-item.js +4 -3
- package/components/menu/menu.d.ts +2 -2
- package/components/menu/menu.js +2 -3
- package/components/navigation-bar/navigation-bar-item.d.ts +1 -1
- package/components/navigation-bar/navigation-bar-item.js +1 -1
- package/components/navigation-bar/navigation-bar-style.js +1 -1
- package/components/navigation-bar/navigation-bar.d.ts +1 -1
- package/components/navigation-bar/navigation-bar.js +1 -1
- package/components/navigation-drawer/index.d.ts +15 -15
- package/components/navigation-drawer/index.js +15 -16
- package/components/navigation-drawer/style.js +1 -1
- package/components/navigation-rail/navigation-rail-item.d.ts +1 -1
- package/components/navigation-rail/navigation-rail-item.js +1 -1
- package/components/navigation-rail/navigation-rail.d.ts +3 -3
- package/components/navigation-rail/navigation-rail.js +3 -4
- package/components/radio/radio-group.d.ts +1 -1
- package/components/radio/radio-group.js +1 -1
- package/components/radio/radio.d.ts +2 -2
- package/components/radio/radio.js +2 -2
- package/components/range-slider/index.d.ts +1 -1
- package/components/range-slider/index.js +1 -1
- package/components/segmented-button/segmented-button-group.d.ts +1 -1
- package/components/segmented-button/segmented-button-group.js +1 -2
- package/components/segmented-button/segmented-button.d.ts +1 -1
- package/components/segmented-button/segmented-button.js +1 -1
- package/components/select/index.d.ts +2 -2
- package/components/select/index.js +3 -3
- package/components/slider/index.d.ts +1 -1
- package/components/slider/index.js +1 -1
- package/components/snackbar/index.d.ts +2 -2
- package/components/snackbar/index.js +2 -3
- package/components/switch/index.d.ts +4 -4
- package/components/switch/index.js +4 -4
- package/components/text-field/index.d.ts +4 -4
- package/components/text-field/index.js +7 -11
- package/components/text-field/style.js +1 -1
- package/components/tooltip/index.d.ts +3 -3
- package/components/tooltip/index.js +8 -7
- package/components/top-app-bar/top-app-bar-style.js +1 -1
- package/components/top-app-bar/top-app-bar.d.ts +2 -1
- package/components/top-app-bar/top-app-bar.js +7 -1
- package/css-data.en.json +128 -128
- package/css-data.zh-cn.json +111 -111
- package/custom-elements.json +142 -136
- package/functions/alert.js +6 -1
- package/functions/confirm.js +6 -1
- package/functions/prompt.js +6 -1
- package/html-data.en.json +488 -488
- package/html-data.zh-cn.json +29 -29
- package/jsx.en.d.ts +2554 -2552
- package/jsx.zh-cn.d.ts +2062 -2060
- package/locales/ar-eg.js +0 -2
- package/locales/az-az.js +0 -2
- package/locales/be-by.js +0 -2
- package/locales/bg-bg.js +0 -2
- package/locales/bn-bd.js +0 -2
- package/locales/ca-es.js +0 -2
- package/locales/cs-cz.js +0 -2
- package/locales/da-dk.js +0 -2
- package/locales/de-de.js +0 -2
- package/locales/el-gr.js +0 -2
- package/locales/en-gb.js +0 -2
- package/locales/es-es.js +0 -2
- package/locales/et-ee.js +0 -2
- package/locales/fa-ir.js +0 -2
- package/locales/fi-fi.js +0 -2
- package/locales/fr-be.js +0 -2
- package/locales/fr-ca.js +0 -2
- package/locales/fr-fr.js +0 -2
- package/locales/ga-ie.js +0 -2
- package/locales/gl-es.js +0 -2
- package/locales/he-il.js +0 -2
- package/locales/hi-in.js +0 -2
- package/locales/hr-hr.js +0 -2
- package/locales/hu-hu.js +0 -2
- package/locales/hy-am.js +0 -2
- package/locales/id-id.js +0 -2
- package/locales/is-is.js +0 -2
- package/locales/it-it.js +0 -2
- package/locales/ja-jp.js +0 -2
- package/locales/ka-ge.js +0 -2
- package/locales/kk-kz.js +0 -2
- package/locales/km-kh.js +0 -2
- package/locales/kmr-iq.js +0 -2
- package/locales/kn-in.js +0 -2
- package/locales/ko-kr.js +0 -2
- package/locales/lt-lt.js +0 -2
- package/locales/lv-lv.js +0 -2
- package/locales/mk-mk.js +0 -2
- package/locales/ml-in.js +0 -2
- package/locales/mn-mn.js +0 -2
- package/locales/ms-my.js +0 -2
- package/locales/nb-no.js +0 -2
- package/locales/ne-np.js +0 -2
- package/locales/nl-be.js +0 -2
- package/locales/nl-nl.js +0 -2
- package/locales/pl-pl.js +0 -2
- package/locales/pt-br.js +0 -2
- package/locales/pt-pt.js +0 -2
- package/locales/ro-ro.js +0 -2
- package/locales/ru-ru.js +0 -2
- package/locales/sk-sk.js +0 -2
- package/locales/sl-si.js +0 -2
- package/locales/sr-rs.js +0 -2
- package/locales/sv-se.js +0 -2
- package/locales/ta-in.js +0 -2
- package/locales/th-th.js +0 -2
- package/locales/tr-tr.js +0 -2
- package/locales/uk-ua.js +0 -2
- package/locales/ur-pk.js +0 -2
- package/locales/vi-vn.js +0 -2
- package/locales/zh-cn.js +0 -2
- package/locales/zh-hk.js +0 -2
- package/locales/zh-tw.js +0 -2
- package/mdui.css +1 -1
- package/mdui.esm.js +9 -9
- package/mdui.global.js +9 -9
- package/package.json +10 -9
- package/web-types.en.json +696 -696
- package/web-types.zh-cn.json +181 -181
|
@@ -33,7 +33,7 @@ import { navigationRailStyle } from './navigation-rail-style.js';
|
|
|
33
33
|
* @csspart bottom - 底部元素的容器
|
|
34
34
|
* @csspart items - `<mdui-navigation-rail-item>` 组件的容器
|
|
35
35
|
*
|
|
36
|
-
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
36
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/zh-cn/docs/2/styles/design-tokens#shape-corner)
|
|
37
37
|
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
38
38
|
*/
|
|
39
39
|
let NavigationRail = class NavigationRail extends LayoutItemBase {
|
|
@@ -55,13 +55,13 @@ let NavigationRail = class NavigationRail extends LayoutItemBase {
|
|
|
55
55
|
*/
|
|
56
56
|
this.alignment = 'start';
|
|
57
57
|
/**
|
|
58
|
-
* 默认情况下,导航栏相对于 `body`
|
|
58
|
+
* 默认情况下,导航栏相对于 `body` 元素显示。当该属性设置为 `true` 时,导航栏将相对于其父元素显示。
|
|
59
59
|
*
|
|
60
60
|
* **Note**:设置该属性时,必须在父元素上手动设置样式 `position: relative;`。
|
|
61
61
|
*/
|
|
62
62
|
this.contained = false;
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* 是否在导航栏和页面内容之间添加分隔线
|
|
65
65
|
*/
|
|
66
66
|
this.divider = false;
|
|
67
67
|
// 因为 navigation-rail-item 的 value 可能会重复,所以在每个 navigation-rail-item 元素上都添加了一个唯一的 key,通过 activeKey 来记录激活状态的 key
|
|
@@ -192,7 +192,6 @@ __decorate([
|
|
|
192
192
|
], NavigationRail.prototype, "value", void 0);
|
|
193
193
|
__decorate([
|
|
194
194
|
property({ reflect: true })
|
|
195
|
-
// eslint-disable-next-line prettier/prettier
|
|
196
195
|
], NavigationRail.prototype, "placement", void 0);
|
|
197
196
|
__decorate([
|
|
198
197
|
property({ reflect: true })
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import '@mdui/icons-shared/circle.js';
|
|
2
|
+
import '@mdui/icons-shared/radio-button-unchecked.js';
|
|
1
3
|
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
|
-
import '@mdui/shared/icons/circle.js';
|
|
3
|
-
import '@mdui/shared/icons/radio-button-unchecked.js';
|
|
4
4
|
import '../icon.js';
|
|
5
5
|
import type { Ripple } from '../ripple/index.js';
|
|
6
6
|
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
@@ -3,11 +3,11 @@ import { html } from 'lit';
|
|
|
3
3
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
4
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
5
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
6
|
+
import '@mdui/icons-shared/circle.js';
|
|
7
|
+
import '@mdui/icons-shared/radio-button-unchecked.js';
|
|
6
8
|
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
7
9
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
8
10
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
9
|
-
import '@mdui/shared/icons/circle.js';
|
|
10
|
-
import '@mdui/shared/icons/radio-button-unchecked.js';
|
|
11
11
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
12
12
|
import { FocusableMixin } from '@mdui/shared/mixins/focusable.js';
|
|
13
13
|
import '../icon.js';
|
|
@@ -40,7 +40,7 @@ export declare class RangeSlider extends SliderBase<RangeSliderEventMap> impleme
|
|
|
40
40
|
private readonly formController;
|
|
41
41
|
private _value;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* 滑块的值,为数组格式,将与表单数据一起提交。
|
|
44
44
|
*
|
|
45
45
|
* **NOTE**:该属性无法通过 HTML 属性设置初始值,如果要修改该值,只能通过修改 JavaScript 属性值实现。
|
|
46
46
|
*/
|
|
@@ -19,7 +19,7 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
19
19
|
*
|
|
20
20
|
* @slot - `<mdui-segmented-button>` 组件
|
|
21
21
|
*
|
|
22
|
-
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
22
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/zh-cn/docs/2/styles/design-tokens#shape-corner)
|
|
23
23
|
*/
|
|
24
24
|
export declare class SegmentedButtonGroup extends MduiElement<SegmentedButtonGroupEventMap> implements FormControl {
|
|
25
25
|
static styles: CSSResultGroup;
|
|
@@ -34,7 +34,7 @@ import { segmentedButtonGroupStyle } from './segmented-button-group-style.js';
|
|
|
34
34
|
*
|
|
35
35
|
* @slot - `<mdui-segmented-button>` 组件
|
|
36
36
|
*
|
|
37
|
-
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
37
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/zh-cn/docs/2/styles/design-tokens#shape-corner)
|
|
38
38
|
*/
|
|
39
39
|
let SegmentedButtonGroup = class SegmentedButtonGroup extends MduiElement {
|
|
40
40
|
constructor() {
|
|
@@ -342,7 +342,6 @@ __decorate([
|
|
|
342
342
|
], SegmentedButtonGroup.prototype, "fullWidth", void 0);
|
|
343
343
|
__decorate([
|
|
344
344
|
property({ reflect: true })
|
|
345
|
-
// eslint-disable-next-line prettier/prettier
|
|
346
345
|
], SegmentedButtonGroup.prototype, "selects", void 0);
|
|
347
346
|
__decorate([
|
|
348
347
|
property({
|
|
@@ -2,12 +2,12 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { html } from 'lit';
|
|
3
3
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
4
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
5
|
+
import '@mdui/icons-shared/check.js';
|
|
5
6
|
import cc from 'classcat';
|
|
6
7
|
import { HasSlotController } from '@mdui/shared/controllers/has-slot.js';
|
|
7
8
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
8
9
|
import { nothingTemplate } from '@mdui/shared/helpers/template.js';
|
|
9
10
|
import { uniqueId } from '@mdui/shared/helpers/uniqueId.js';
|
|
10
|
-
import '@mdui/shared/icons/check.js';
|
|
11
11
|
import { ButtonBase } from '../button/button-base.js';
|
|
12
12
|
import '../icon.js';
|
|
13
13
|
import { segmentedButtonStyle } from './segmented-button-style.js';
|
|
@@ -37,7 +37,7 @@ declare const Select_base: import("@lit/reactive-element/decorators/base.js").Co
|
|
|
37
37
|
* @csspart chip__button - chip 内部的 `<button>` 元素
|
|
38
38
|
* @csspart chip__label - chip 内部的文本
|
|
39
39
|
* @csspart chip__delete-icon - chip 内部的删除图标
|
|
40
|
-
* @csspart text-field - 文本框,即 [`<mdui-text-field>`](/docs/2/components/text-field) 元素
|
|
40
|
+
* @csspart text-field - 文本框,即 [`<mdui-text-field>`](/zh-cn/docs/2/components/text-field) 元素
|
|
41
41
|
* @csspart text-field__container - text-field 内部的文本框容器
|
|
42
42
|
* @csspart text-field__icon - text-field 内部的左侧图标
|
|
43
43
|
* @csspart text-field__end-icon - text-field 内部的右侧图标
|
|
@@ -51,7 +51,7 @@ declare const Select_base: import("@lit/reactive-element/decorators/base.js").Co
|
|
|
51
51
|
* @csspart text-field__supporting - text-field 内部的底部辅助信息容器,包括 helper 和 error
|
|
52
52
|
* @csspart text-field__helper - text-field 内部的底部帮助文本
|
|
53
53
|
* @csspart text-field__error - text-field 内部的底部错误描述文本
|
|
54
|
-
* @csspart menu - 下拉菜单,即 [`<mdui-menu>`](/docs/2/components/menu) 元素
|
|
54
|
+
* @csspart menu - 下拉菜单,即 [`<mdui-menu>`](/zh-cn/docs/2/components/menu) 元素
|
|
55
55
|
*/
|
|
56
56
|
export declare class Select extends Select_base<SelectEventMap> implements FormControl {
|
|
57
57
|
static styles: CSSResultGroup;
|
|
@@ -51,7 +51,7 @@ import { style } from './style.js';
|
|
|
51
51
|
* @csspart chip__button - chip 内部的 `<button>` 元素
|
|
52
52
|
* @csspart chip__label - chip 内部的文本
|
|
53
53
|
* @csspart chip__delete-icon - chip 内部的删除图标
|
|
54
|
-
* @csspart text-field - 文本框,即 [`<mdui-text-field>`](/docs/2/components/text-field) 元素
|
|
54
|
+
* @csspart text-field - 文本框,即 [`<mdui-text-field>`](/zh-cn/docs/2/components/text-field) 元素
|
|
55
55
|
* @csspart text-field__container - text-field 内部的文本框容器
|
|
56
56
|
* @csspart text-field__icon - text-field 内部的左侧图标
|
|
57
57
|
* @csspart text-field__end-icon - text-field 内部的右侧图标
|
|
@@ -65,7 +65,7 @@ import { style } from './style.js';
|
|
|
65
65
|
* @csspart text-field__supporting - text-field 内部的底部辅助信息容器,包括 helper 和 error
|
|
66
66
|
* @csspart text-field__helper - text-field 内部的底部帮助文本
|
|
67
67
|
* @csspart text-field__error - text-field 内部的底部错误描述文本
|
|
68
|
-
* @csspart menu - 下拉菜单,即 [`<mdui-menu>`](/docs/2/components/menu) 元素
|
|
68
|
+
* @csspart menu - 下拉菜单,即 [`<mdui-menu>`](/zh-cn/docs/2/components/menu) 元素
|
|
69
69
|
*/
|
|
70
70
|
let Select = class Select extends FocusableMixin(MduiElement) {
|
|
71
71
|
constructor() {
|
|
@@ -291,7 +291,7 @@ let Select = class Select extends FocusableMixin(MduiElement) {
|
|
|
291
291
|
const menu = e.target;
|
|
292
292
|
this.value = this.multiple
|
|
293
293
|
? menu.value.map((v) => v ?? '')
|
|
294
|
-
: menu.value ?? '';
|
|
294
|
+
: (menu.value ?? '');
|
|
295
295
|
await this.updateComplete;
|
|
296
296
|
// reset 引起的值变更,不执行验证;直接修改值引起的变更,需要进行验证
|
|
297
297
|
const form = this.formController.getForm();
|
|
@@ -24,7 +24,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
|
24
24
|
export declare class Slider extends SliderBase<SliderEventMap> implements FormControl {
|
|
25
25
|
static styles: CSSResultGroup;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* 滑块的值,将与表单数据一起提交
|
|
28
28
|
*/
|
|
29
29
|
value: number;
|
|
30
30
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import '@mdui/icons-shared/clear.js';
|
|
1
2
|
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
|
-
import '@mdui/shared/icons/clear.js';
|
|
3
3
|
import '../button-icon.js';
|
|
4
4
|
import '../button.js';
|
|
5
5
|
import '../icon.js';
|
|
@@ -27,7 +27,7 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
27
27
|
* @csspart close-button - 关闭按钮
|
|
28
28
|
* @csspart close-icon - 关闭按钮中的图标
|
|
29
29
|
*
|
|
30
|
-
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
30
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/zh-cn/docs/2/styles/design-tokens#shape-corner)
|
|
31
31
|
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
32
32
|
*/
|
|
33
33
|
export declare class Snackbar extends MduiElement<SnackbarEventMap> {
|
|
@@ -2,6 +2,7 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { html } from 'lit';
|
|
3
3
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
4
|
import { when } from 'lit/directives/when.js';
|
|
5
|
+
import '@mdui/icons-shared/clear.js';
|
|
5
6
|
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
6
7
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
7
8
|
import { animateTo, stopAnimations } from '@mdui/shared/helpers/animate.js';
|
|
@@ -10,7 +11,6 @@ import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
|
10
11
|
import { getDuration, getEasing } from '@mdui/shared/helpers/motion.js';
|
|
11
12
|
import { observeResize } from '@mdui/shared/helpers/observeResize.js';
|
|
12
13
|
import { nothingTemplate } from '@mdui/shared/helpers/template.js';
|
|
13
|
-
import '@mdui/shared/icons/clear.js';
|
|
14
14
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
15
15
|
import '../button-icon.js';
|
|
16
16
|
import '../button.js';
|
|
@@ -43,7 +43,7 @@ let reordering = false;
|
|
|
43
43
|
* @csspart close-button - 关闭按钮
|
|
44
44
|
* @csspart close-icon - 关闭按钮中的图标
|
|
45
45
|
*
|
|
46
|
-
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
46
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/zh-cn/docs/2/styles/design-tokens#shape-corner)
|
|
47
47
|
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
48
48
|
*/
|
|
49
49
|
let Snackbar = class Snackbar extends MduiElement {
|
|
@@ -312,7 +312,6 @@ __decorate([
|
|
|
312
312
|
], Snackbar.prototype, "closeIcon", void 0);
|
|
313
313
|
__decorate([
|
|
314
314
|
property({ type: Number, reflect: true, attribute: 'message-line' })
|
|
315
|
-
// eslint-disable-next-line prettier/prettier
|
|
316
315
|
], Snackbar.prototype, "messageLine", void 0);
|
|
317
316
|
__decorate([
|
|
318
317
|
property({ type: Number, reflect: true, attribute: 'auto-close-delay' })
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import '@mdui/icons-shared/check.js';
|
|
1
2
|
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
|
-
import '@mdui/shared/icons/check.js';
|
|
3
3
|
import '../icon.js';
|
|
4
4
|
import type { Ripple } from '../ripple/index.js';
|
|
5
5
|
import type { FormControl } from '@mdui/jq/shared/form.js';
|
|
@@ -26,8 +26,8 @@ declare const Switch_base: import("@lit/reactive-element/decorators/base.js").Co
|
|
|
26
26
|
* @csspart unchecked-icon - 未选中状态的图标
|
|
27
27
|
* @csspart checked-icon 选中状态的图标
|
|
28
28
|
*
|
|
29
|
-
* @cssprop --shape-corner - 组件轨道的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
30
|
-
* @cssprop --shape-corner-thumb - 组件图标容器的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
29
|
+
* @cssprop --shape-corner - 组件轨道的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/zh-cn/docs/2/styles/design-tokens#shape-corner)
|
|
30
|
+
* @cssprop --shape-corner-thumb - 组件图标容器的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/zh-cn/docs/2/styles/design-tokens#shape-corner)
|
|
31
31
|
*/
|
|
32
32
|
export declare class Switch extends Switch_base<SwitchEventMap> implements FormControl {
|
|
33
33
|
static styles: CSSResultGroup;
|
|
@@ -68,7 +68,7 @@ export declare class Switch extends Switch_base<SwitchEventMap> implements FormC
|
|
|
68
68
|
*/
|
|
69
69
|
name: string;
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
71
|
+
* 开关的值,将与表单数据一起提交
|
|
72
72
|
*/
|
|
73
73
|
value: string;
|
|
74
74
|
/**
|
|
@@ -5,6 +5,7 @@ import { classMap } from 'lit/directives/class-map.js';
|
|
|
5
5
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
6
|
import { live } from 'lit/directives/live.js';
|
|
7
7
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
8
|
+
import '@mdui/icons-shared/check.js';
|
|
8
9
|
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
9
10
|
import { FormController, formResets } from '@mdui/shared/controllers/form.js';
|
|
10
11
|
import { HasSlotController } from '@mdui/shared/controllers/has-slot.js';
|
|
@@ -12,7 +13,6 @@ import { defaultValue } from '@mdui/shared/decorators/default-value.js';
|
|
|
12
13
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
13
14
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
14
15
|
import { nothingTemplate } from '@mdui/shared/helpers/template.js';
|
|
15
|
-
import '@mdui/shared/icons/check.js';
|
|
16
16
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
17
17
|
import { FocusableMixin } from '@mdui/shared/mixins/focusable.js';
|
|
18
18
|
import '../icon.js';
|
|
@@ -39,8 +39,8 @@ import { style } from './style.js';
|
|
|
39
39
|
* @csspart unchecked-icon - 未选中状态的图标
|
|
40
40
|
* @csspart checked-icon 选中状态的图标
|
|
41
41
|
*
|
|
42
|
-
* @cssprop --shape-corner - 组件轨道的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
43
|
-
* @cssprop --shape-corner-thumb - 组件图标容器的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
42
|
+
* @cssprop --shape-corner - 组件轨道的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/zh-cn/docs/2/styles/design-tokens#shape-corner)
|
|
43
|
+
* @cssprop --shape-corner-thumb - 组件图标容器的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/zh-cn/docs/2/styles/design-tokens#shape-corner)
|
|
44
44
|
*/
|
|
45
45
|
let Switch = class Switch extends RippleMixin(FocusableMixin(MduiElement)) {
|
|
46
46
|
constructor() {
|
|
@@ -66,7 +66,7 @@ let Switch = class Switch extends RippleMixin(FocusableMixin(MduiElement)) {
|
|
|
66
66
|
*/
|
|
67
67
|
this.name = '';
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
69
|
+
* 开关的值,将与表单数据一起提交
|
|
70
70
|
*/
|
|
71
71
|
this.value = 'on';
|
|
72
72
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import '@mdui/icons-shared/cancel--outlined.js';
|
|
2
|
+
import '@mdui/icons-shared/error.js';
|
|
3
|
+
import '@mdui/icons-shared/visibility-off.js';
|
|
4
|
+
import '@mdui/icons-shared/visibility.js';
|
|
1
5
|
import '@mdui/jq/methods/css.js';
|
|
2
6
|
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
3
|
-
import '@mdui/shared/icons/cancel--outlined.js';
|
|
4
|
-
import '@mdui/shared/icons/error.js';
|
|
5
|
-
import '@mdui/shared/icons/visibility-off.js';
|
|
6
|
-
import '@mdui/shared/icons/visibility.js';
|
|
7
7
|
import '../button-icon.js';
|
|
8
8
|
import '../icon.js';
|
|
9
9
|
import type { FormControl } from '@mdui/jq/shared/form.js';
|
|
@@ -7,6 +7,10 @@ import { live } from 'lit/directives/live.js';
|
|
|
7
7
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
8
8
|
import { when } from 'lit/directives/when.js';
|
|
9
9
|
import { msg } from '@lit/localize';
|
|
10
|
+
import '@mdui/icons-shared/cancel--outlined.js';
|
|
11
|
+
import '@mdui/icons-shared/error.js';
|
|
12
|
+
import '@mdui/icons-shared/visibility-off.js';
|
|
13
|
+
import '@mdui/icons-shared/visibility.js';
|
|
10
14
|
import { $ } from '@mdui/jq/$.js';
|
|
11
15
|
import '@mdui/jq/methods/css.js';
|
|
12
16
|
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
@@ -17,10 +21,6 @@ import { watch } from '@mdui/shared/decorators/watch.js';
|
|
|
17
21
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
18
22
|
import { observeResize } from '@mdui/shared/helpers/observeResize.js';
|
|
19
23
|
import { nothingTemplate } from '@mdui/shared/helpers/template.js';
|
|
20
|
-
import '@mdui/shared/icons/cancel--outlined.js';
|
|
21
|
-
import '@mdui/shared/icons/error.js';
|
|
22
|
-
import '@mdui/shared/icons/visibility-off.js';
|
|
23
|
-
import '@mdui/shared/icons/visibility.js';
|
|
24
24
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
25
25
|
import { FocusableMixin } from '@mdui/shared/mixins/focusable.js';
|
|
26
26
|
import { onLocaleReady, offLocaleReady } from '../../internal/localize.js';
|
|
@@ -519,16 +519,12 @@ let TextField = class TextField extends FocusableMixin(MduiElement) {
|
|
|
519
519
|
renderInput(hasInputSlot) {
|
|
520
520
|
return html `<input ${ref(this.inputRef)} part="input" class="input ${classMap({ 'hide-input': hasInputSlot })}" type="${this.type === 'password' && this.isPasswordVisible
|
|
521
521
|
? 'text'
|
|
522
|
-
: this.type}" name="${ifDefined(this.name)}" .value="${live(this.value)}" placeholder="${ifDefined(
|
|
523
|
-
// @ts-ignore
|
|
524
|
-
!this.label || this.isFocusedStyle || this.hasValue
|
|
522
|
+
: this.type}" name="${ifDefined(this.name)}" .value="${live(this.value)}" placeholder="${ifDefined(!this.label || this.isFocusedStyle || this.hasValue
|
|
525
523
|
? this.placeholder
|
|
526
|
-
: undefined)}" ?readonly="${this.readonly}" ?disabled="${this.disabled}" ?required="${this.required}" minlength="${ifDefined(this.minlength)}" maxlength="${ifDefined(this.maxlength)}" min="${ifDefined(this.min)}" max="${ifDefined(this.max)}" step="${ifDefined(this.step)}" autocapitalize="${ifDefined(this.type === 'password' ? 'off' : this.autocapitalize)}" autocomplete="${this.autocomplete}" autocorrect="${ifDefined(this.type === 'password' ? 'off' : this.autocorrect)}" spellcheck="${ifDefined(this.spellcheck)}" pattern="${ifDefined(this.pattern)}" enterkeyhint="${ifDefined(this.enterkeyhint)}" inputmode="${ifDefined(this.inputmode)}" @change="${this.onChange}" @input="${this.onInput}" @invalid="${this.onInvalid}" @keydown="${this.onKeyDown}">`;
|
|
524
|
+
: undefined)}" ?readonly="${this.readonly}" ?disabled="${this.disabled}" ?required="${this.required}" minlength="${ifDefined(this.minlength)}" maxlength="${ifDefined(this.maxlength)}" min="${ifDefined(this.min)}" max="${ifDefined(this.max)}" step="${ifDefined(this.step)}" autocapitalize="${ifDefined(this.type === 'password' ? 'off' : this.autocapitalize)}" autocomplete="${ifDefined(this.autocomplete)}" autocorrect="${ifDefined(this.type === 'password' ? 'off' : this.autocorrect)}" spellcheck="${ifDefined(this.spellcheck)}" pattern="${ifDefined(this.pattern)}" enterkeyhint="${ifDefined(this.enterkeyhint)}" inputmode="${ifDefined(this.inputmode)}" @change="${this.onChange}" @input="${this.onInput}" @invalid="${this.onInvalid}" @keydown="${this.onKeyDown}">`;
|
|
527
525
|
}
|
|
528
526
|
renderTextArea(hasInputSlot) {
|
|
529
|
-
return html `<textarea ${ref(this.inputRef)} part="input" class="input ${classMap({ 'hide-input': hasInputSlot })}" name="${ifDefined(this.name)}" .value="${live(this.value)}" placeholder="${ifDefined(
|
|
530
|
-
// @ts-ignore
|
|
531
|
-
!this.label || this.isFocusedStyle || this.hasValue
|
|
527
|
+
return html `<textarea ${ref(this.inputRef)} part="input" class="input ${classMap({ 'hide-input': hasInputSlot })}" name="${ifDefined(this.name)}" .value="${live(this.value)}" placeholder="${ifDefined(!this.label || this.isFocusedStyle || this.hasValue
|
|
532
528
|
? this.placeholder
|
|
533
529
|
: undefined)}" ?readonly="${this.readonly}" ?disabled="${this.disabled}" ?required="${this.required}" minlength="${ifDefined(this.minlength)}" maxlength="${ifDefined(this.maxlength)}" rows="${this.rows ?? 1}" autocapitalize="${ifDefined(this.autocapitalize)}" autocorrect="${ifDefined(this.autocorrect)}" spellcheck="${ifDefined(this.spellcheck)}" enterkeyhint="${ifDefined(this.enterkeyhint)}" inputmode="${ifDefined(this.inputmode)}" @change="${this.onChange}" @input="${this.onInput}" @invalid="${this.onInvalid}" @keydown="${this.onKeyDown}" @keyup="${this.onTextAreaKeyUp}"></textarea>`;
|
|
534
530
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css `:host{display:inline-block;width:100%}:host([disabled]:not([disabled=false i])){pointer-events:none}:host([type=hidden]){display:none}.container{position:relative;display:flex;align-items:center;height:100%;padding:.125rem .125rem .125rem 1rem;transition:box-shadow var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}.container.has-icon{padding-left:.75rem}.container.has-action,.container.has-right-icon,.container.has-suffix{padding-right:.75rem}:host([variant=filled]) .container{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-on-surface-variant));background-color:rgb(var(--mdui-color-surface-container-highest));border-radius:var(--mdui-shape-corner-extra-small) var(--mdui-shape-corner-extra-small) 0 0}:host([variant=filled]) .container.invalid,:host([variant=filled]) .container.invalid-style{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-error))}:host([variant=filled]:hover) .container{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-on-surface))}:host([variant=filled]:hover) .container.invalid,:host([variant=filled]:hover) .container.invalid-style{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-on-error-container))}:host([variant=filled][focused-style]) .container,:host([variant=filled][focused]) .container{box-shadow:inset 0 -.125rem 0 0 rgb(var(--mdui-color-primary))}:host([variant=filled][focused-style]) .container.invalid,:host([variant=filled][focused-style]) .container.invalid-style,:host([variant=filled][focused]) .container.invalid,:host([variant=filled][focused]) .container.invalid-style{box-shadow:inset 0 -.125rem 0 0 rgb(var(--mdui-color-error))}:host([variant=filled][disabled]:not([disabled=false i])) .container{box-shadow:inset 0 -.0625rem 0 0 rgba(var(--mdui-color-on-surface),38%);background-color:rgba(var(--mdui-color-on-surface),4%)}:host([variant=outlined]) .container{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-outline));border-radius:var(--mdui-shape-corner-extra-small)}:host([variant=outlined]) .container.invalid,:host([variant=outlined]) .container.invalid-style{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-error))}:host([variant=outlined]:hover) .container{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-on-surface))}:host([variant=outlined]:hover) .container.invalid,:host([variant=outlined]:hover) .container.invalid-style{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-on-error-container))}:host([variant=outlined][focused-style]) .container,:host([variant=outlined][focused]) .container{box-shadow:inset 0 0 0 .125rem rgb(var(--mdui-color-primary))}:host([variant=outlined][focused-style]) .container.invalid,:host([variant=outlined][focused-style]) .container.invalid-style,:host([variant=outlined][focused]) .container.invalid,:host([variant=outlined][focused]) .container.invalid-style{box-shadow:inset 0 0 0 .125rem rgb(var(--mdui-color-error))}:host([variant=outlined][disabled]:not([disabled=false i])) .container{box-shadow:inset 0 0 0 .125rem rgba(var(--mdui-color-on-surface),12%)}.action,.icon,.prefix,.right-icon,.suffix{display:flex;-webkit-user-select:none;user-select:none;color:rgb(var(--mdui-color-on-surface-variant))}:host([disabled]:not([disabled=false i])) .action,:host([disabled]:not([disabled=false i])) .icon,:host([disabled]:not([disabled=false i])) .prefix,:host([disabled]:not([disabled=false i])) .right-icon,:host([disabled]:not([disabled=false i])) .suffix{color:rgba(var(--mdui-color-on-surface),38%)}.invalid .right-icon,.invalid-style .right-icon{color:rgb(var(--mdui-color-error))}:host(:hover) .invalid .right-icon,:host(:hover) .invalid-style .right-icon{color:rgb(var(--mdui-color-on-error-container))}:host([focused-style]) .invalid .right-icon,:host([focused-style]) .invalid-style .right-icon,:host([focused]) .invalid .right-icon,:host([focused]) .invalid-style .right-icon{color:rgb(var(--mdui-color-error))}.action,.icon,.right-icon{font-size:1.5rem}.action mdui-button-icon,.icon mdui-button-icon,.right-icon mdui-button-icon,::slotted(mdui-button-icon[slot]){margin-left:-.5rem;margin-right:-.5rem}.action .i,.icon .i,.right-icon .i,::slotted([slot$=icon]){font-size:inherit}.has-icon .icon{margin-right:1rem}.has-prefix .prefix{padding-right:.125rem}.has-action .action{margin-left:.75rem}.has-suffix .suffix{padding-right:.25rem;padding-left:.125rem}.has-right-icon .right-icon{margin-left:.75rem}.prefix,.suffix{display:none;font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height)}:host([variant=filled][label]) .prefix,:host([variant=filled][label]) .suffix{padding-top:1rem}.has-value .prefix,.has-value .suffix,:host([focused-style]) .prefix,:host([focused-style]) .suffix,:host([focused]) .prefix,:host([focused]) .suffix{display:flex}.input-container{display:flex;width:100%;height:100%}.label{position:absolute;pointer-events:none;max-width:calc(100% - 1rem);display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1;transition:all var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard);top:1rem;color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height)}.invalid .label,.invalid-style .label{color:rgb(var(--mdui-color-error))}:host([variant=outlined]) .label{padding:0 .25rem;margin:0 -.25rem}:host([variant=outlined]:hover) .label{color:rgb(var(--mdui-color-on-surface))}:host([variant=filled]:hover) .invalid .label,:host([variant=filled]:hover) .invalid-style .label,:host([variant=outlined]:hover) .invalid .label,:host([variant=outlined]:hover) .invalid-style .label{color:rgb(var(--mdui-color-on-error-container))}:host([variant=filled][focused-style]) .label,:host([variant=filled][focused]) .label,:host([variant=outlined][focused-style]) .label,:host([variant=outlined][focused]) .label{color:rgb(var(--mdui-color-primary))}:host([variant=filled]) .has-value .label,:host([variant=filled][focused-style]) .label,:host([variant=filled][focused]) .label,:host([variant=filled][type=date]) .label,:host([variant=filled][type=datetime-local]) .label,:host([variant=filled][type=month]) .label,:host([variant=filled][type=time]) .label,:host([variant=filled][type=week]) .label{font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height);top:.25rem}:host([variant=outlined]) .has-value .label,:host([variant=outlined][focused-style]) .label,:host([variant=outlined][focused]) .label,:host([variant=outlined][type=date]) .label,:host([variant=outlined][type=datetime-local]) .label,:host([variant=outlined][type=month]) .label,:host([variant=outlined][type=time]) .label,:host([variant=outlined][type=week]) .label{font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height);top:-.5rem;left:.75rem;background-color:rgb(var(--mdui-color-background))}:host([variant=filled][focused-style]) .invalid .label,:host([variant=filled][focused-style]) .invalid-style .label,:host([variant=filled][focused]) .invalid .label,:host([variant=filled][focused]) .invalid-style .label,:host([variant=outlined][focused-style]) .invalid .label,:host([variant=outlined][focused-style]) .invalid-style .label,:host([variant=outlined][focused]) .invalid .label,:host([variant=outlined][focused]) .invalid-style .label{color:rgb(var(--mdui-color-error))}:host([variant=filled][disabled]:not([disabled=false i])) .label,:host([variant=outlined][disabled]:not([disabled=false i])) .label{color:rgba(var(--mdui-color-on-surface),38%)}.input{display:block;width:100%;border:none;outline:0;background:0 0;appearance:none;resize:none;cursor:inherit;font-family:inherit;padding:.875rem .875rem .875rem 0;font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height);color:rgb(var(--mdui-color-on-surface));caret-color:rgb(var(--mdui-color-primary))}.has-action .input,.has-right-icon .input{padding-right:.25rem}.has-suffix .input{padding-right:0}.input.hide-input{opacity:0;height:0;min-height:0;width:0;padding:0!important;overflow:hidden}.input::placeholder{color:rgb(var(--mdui-color-on-surface-variant))}.invalid .input,.invalid-style .input{caret-color:rgb(var(--mdui-color-error))}:host([disabled]:not([disabled=false i])) .input{color:rgba(var(--mdui-color-on-surface),38%)}:host([end-aligned]:not([end-aligned=false i])) .input{text-align:right}textarea.input{padding-top:0;margin-top:.875rem}:host([variant=filled]) .label+.input{padding-top:1.375rem;padding-bottom:.375rem}:host([variant=filled]) .label+textarea.input{padding-top:0;margin-top:1.375rem}.supporting{display:flex;justify-content:space-between;padding:.25rem 1rem;color:rgb(var(--mdui-color-on-surface-variant))}.supporting.invalid,.supporting.invalid-style{color:rgb(var(--mdui-color-error))}.helper{display:block;opacity:1;transition:opacity var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)}:host([disabled]:not([disabled=false i])) .helper{color:rgba(var(--mdui-color-on-surface),38%)}:host([helper-on-focus]:not([helper-on-focus=false i])) .helper{opacity:0}:host([helper-on-focus][focused-style]:not([helper-on-focus=false i])) .helper,:host([helper-on-focus][focused]:not([helper-on-focus=false i])) .helper{opacity:1}.error{font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)}.counter{flex-wrap:nowrap;padding-left:1rem;font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)}::-ms-reveal{display:none}.input[type=number]::-webkit-inner-spin-button,.input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;display:none}.input[type=number]{-moz-appearance:textfield}.input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none}`;
|
|
2
|
+
export const style = css `:host{display:inline-block;width:100%}:host([disabled]:not([disabled=false i])){pointer-events:none}:host([type=hidden]){display:none}.container{position:relative;display:flex;align-items:center;height:100%;padding:.125rem .125rem .125rem 1rem;transition:box-shadow var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}.container.has-icon{padding-left:.75rem}.container.has-action,.container.has-right-icon,.container.has-suffix{padding-right:.75rem}:host([variant=filled]) .container{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-on-surface-variant));background-color:rgb(var(--mdui-color-surface-container-highest));border-radius:var(--mdui-shape-corner-extra-small) var(--mdui-shape-corner-extra-small) 0 0}:host([variant=outlined]) .container{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-outline));border-radius:var(--mdui-shape-corner-extra-small)}:host([variant=filled]) .container.invalid,:host([variant=filled]) .container.invalid-style{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-error))}:host([variant=outlined]) .container.invalid,:host([variant=outlined]) .container.invalid-style{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-error))}:host([variant=filled]:hover) .container{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-on-surface))}:host([variant=outlined]:hover) .container{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-on-surface))}:host([variant=filled]:hover) .container.invalid,:host([variant=filled]:hover) .container.invalid-style{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-on-error-container))}:host([variant=outlined]:hover) .container.invalid,:host([variant=outlined]:hover) .container.invalid-style{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-on-error-container))}:host([variant=filled][focused-style]) .container,:host([variant=filled][focused]) .container{box-shadow:inset 0 -.125rem 0 0 rgb(var(--mdui-color-primary))}:host([variant=outlined][focused-style]) .container,:host([variant=outlined][focused]) .container{box-shadow:inset 0 0 0 .125rem rgb(var(--mdui-color-primary))}:host([variant=filled][focused-style]) .container.invalid,:host([variant=filled][focused-style]) .container.invalid-style,:host([variant=filled][focused]) .container.invalid,:host([variant=filled][focused]) .container.invalid-style{box-shadow:inset 0 -.125rem 0 0 rgb(var(--mdui-color-error))}:host([variant=outlined][focused-style]) .container.invalid,:host([variant=outlined][focused-style]) .container.invalid-style,:host([variant=outlined][focused]) .container.invalid,:host([variant=outlined][focused]) .container.invalid-style{box-shadow:inset 0 0 0 .125rem rgb(var(--mdui-color-error))}:host([variant=filled][disabled]:not([disabled=false i])) .container{box-shadow:inset 0 -.0625rem 0 0 rgba(var(--mdui-color-on-surface),38%);background-color:rgba(var(--mdui-color-on-surface),4%)}:host([variant=outlined][disabled]:not([disabled=false i])) .container{box-shadow:inset 0 0 0 .125rem rgba(var(--mdui-color-on-surface),12%)}.action,.icon,.prefix,.right-icon,.suffix{display:flex;-webkit-user-select:none;user-select:none;color:rgb(var(--mdui-color-on-surface-variant))}:host([disabled]:not([disabled=false i])) .action,:host([disabled]:not([disabled=false i])) .icon,:host([disabled]:not([disabled=false i])) .prefix,:host([disabled]:not([disabled=false i])) .right-icon,:host([disabled]:not([disabled=false i])) .suffix{color:rgba(var(--mdui-color-on-surface),38%)}.invalid .right-icon,.invalid-style .right-icon{color:rgb(var(--mdui-color-error))}:host(:hover) .invalid .right-icon,:host(:hover) .invalid-style .right-icon{color:rgb(var(--mdui-color-on-error-container))}:host([focused-style]) .invalid .right-icon,:host([focused-style]) .invalid-style .right-icon,:host([focused]) .invalid .right-icon,:host([focused]) .invalid-style .right-icon{color:rgb(var(--mdui-color-error))}.action,.icon,.right-icon{font-size:1.5rem}.action mdui-button-icon,.icon mdui-button-icon,.right-icon mdui-button-icon,::slotted(mdui-button-icon[slot]){margin-left:-.5rem;margin-right:-.5rem}.action .i,.icon .i,.right-icon .i,::slotted([slot$=icon]){font-size:inherit}.has-icon .icon{margin-right:1rem}.has-prefix .prefix{padding-right:.125rem}.has-action .action{margin-left:.75rem}.has-suffix .suffix{padding-right:.25rem;padding-left:.125rem}.has-right-icon .right-icon{margin-left:.75rem}.prefix,.suffix{display:none;font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height)}:host([variant=filled][label]) .prefix,:host([variant=filled][label]) .suffix{padding-top:1rem}.has-value .prefix,.has-value .suffix,:host([focused-style]) .prefix,:host([focused-style]) .suffix,:host([focused]) .prefix,:host([focused]) .suffix{display:flex}.input-container{display:flex;width:100%;height:100%}.label{position:absolute;pointer-events:none;max-width:calc(100% - 1rem);display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1;transition:all var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard);top:1rem;color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height)}.invalid .label,.invalid-style .label{color:rgb(var(--mdui-color-error))}:host([variant=outlined]) .label{padding:0 .25rem;margin:0 -.25rem}:host([variant=outlined]:hover) .label{color:rgb(var(--mdui-color-on-surface))}:host([variant=filled]:hover) .invalid .label,:host([variant=filled]:hover) .invalid-style .label,:host([variant=outlined]:hover) .invalid .label,:host([variant=outlined]:hover) .invalid-style .label{color:rgb(var(--mdui-color-on-error-container))}:host([variant=filled][focused-style]) .label,:host([variant=filled][focused]) .label,:host([variant=outlined][focused-style]) .label,:host([variant=outlined][focused]) .label{color:rgb(var(--mdui-color-primary))}:host([variant=filled]) .has-value .label,:host([variant=filled][focused-style]) .label,:host([variant=filled][focused]) .label,:host([variant=filled][type=date]) .label,:host([variant=filled][type=datetime-local]) .label,:host([variant=filled][type=month]) .label,:host([variant=filled][type=time]) .label,:host([variant=filled][type=week]) .label{font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height);top:.25rem}:host([variant=outlined]) .has-value .label,:host([variant=outlined][focused-style]) .label,:host([variant=outlined][focused]) .label,:host([variant=outlined][type=date]) .label,:host([variant=outlined][type=datetime-local]) .label,:host([variant=outlined][type=month]) .label,:host([variant=outlined][type=time]) .label,:host([variant=outlined][type=week]) .label{font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height);top:-.5rem;left:.75rem;background-color:rgb(var(--mdui-color-background))}:host([variant=filled][focused-style]) .invalid .label,:host([variant=filled][focused-style]) .invalid-style .label,:host([variant=filled][focused]) .invalid .label,:host([variant=filled][focused]) .invalid-style .label,:host([variant=outlined][focused-style]) .invalid .label,:host([variant=outlined][focused-style]) .invalid-style .label,:host([variant=outlined][focused]) .invalid .label,:host([variant=outlined][focused]) .invalid-style .label{color:rgb(var(--mdui-color-error))}:host([variant=filled][disabled]:not([disabled=false i])) .label,:host([variant=outlined][disabled]:not([disabled=false i])) .label{color:rgba(var(--mdui-color-on-surface),38%)}.input{display:block;width:100%;border:none;outline:0;background:0 0;appearance:none;resize:none;cursor:inherit;font-family:inherit;padding:.875rem .875rem .875rem 0;font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height);color:rgb(var(--mdui-color-on-surface));caret-color:rgb(var(--mdui-color-primary))}.has-action .input,.has-right-icon .input{padding-right:.25rem}.has-suffix .input{padding-right:0}.input.hide-input{opacity:0;height:0;min-height:0;width:0;padding:0!important;overflow:hidden}.input::placeholder{color:rgb(var(--mdui-color-on-surface-variant))}.invalid .input,.invalid-style .input{caret-color:rgb(var(--mdui-color-error))}:host([disabled]:not([disabled=false i])) .input{color:rgba(var(--mdui-color-on-surface),38%)}:host([end-aligned]:not([end-aligned=false i])) .input{text-align:right}textarea.input{padding-top:0;margin-top:.875rem}:host([variant=filled]) .label+.input{padding-top:1.375rem;padding-bottom:.375rem}:host([variant=filled]) .label+textarea.input{padding-top:0;margin-top:1.375rem}.supporting{display:flex;justify-content:space-between;padding:.25rem 1rem;color:rgb(var(--mdui-color-on-surface-variant))}.supporting.invalid,.supporting.invalid-style{color:rgb(var(--mdui-color-error))}.helper{display:block;opacity:1;transition:opacity var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)}:host([disabled]:not([disabled=false i])) .helper{color:rgba(var(--mdui-color-on-surface),38%)}:host([helper-on-focus]:not([helper-on-focus=false i])) .helper{opacity:0}:host([helper-on-focus][focused-style]:not([helper-on-focus=false i])) .helper,:host([helper-on-focus][focused]:not([helper-on-focus=false i])) .helper{opacity:1}.error{font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)}.counter{flex-wrap:nowrap;padding-left:1rem;font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)}::-ms-reveal{display:none}.input[type=number]::-webkit-inner-spin-button,.input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;display:none}.input[type=number]{-moz-appearance:textfield}.input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none}`;
|
|
@@ -29,8 +29,8 @@ import type { CSSResultGroup, TemplateResult, PropertyValues } from 'lit';
|
|
|
29
29
|
* @csspart content - 正文
|
|
30
30
|
* @csspart action - 操作按钮
|
|
31
31
|
*
|
|
32
|
-
* @cssprop --shape-corner-plain - 当 variant="plain" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
33
|
-
* @cssprop --shape-corner-rich - 当 variant="rich" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
32
|
+
* @cssprop --shape-corner-plain - 当 variant="plain" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/zh-cn/docs/2/styles/design-tokens#shape-corner)
|
|
33
|
+
* @cssprop --shape-corner-rich - 当 variant="rich" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/zh-cn/docs/2/styles/design-tokens#shape-corner)
|
|
34
34
|
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
35
35
|
*/
|
|
36
36
|
export declare class Tooltip extends MduiElement<TooltipEventMap> {
|
|
@@ -45,7 +45,7 @@ export declare class Tooltip extends MduiElement<TooltipEventMap> {
|
|
|
45
45
|
/**
|
|
46
46
|
* tooltip 的位置。默认为 `auto`。可选值包括:
|
|
47
47
|
*
|
|
48
|
-
* * `auto`:自动判断位置。`variant="
|
|
48
|
+
* * `auto`:自动判断位置。`variant="plain"` 时,优先使用 `top`;`variant="rich"` 时,优先使用 `bottom-right`
|
|
49
49
|
* * `top-left`:位于左上方
|
|
50
50
|
* * `top-start`:位于上方,左对齐
|
|
51
51
|
* * `top`:位于上方,居中对齐
|
|
@@ -3,6 +3,7 @@ import { html } from 'lit';
|
|
|
3
3
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
4
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
5
5
|
import { when } from 'lit/directives/when.js';
|
|
6
|
+
// eslint-disable-next-line import/extensions
|
|
6
7
|
import { getOverflowAncestors } from '@floating-ui/utils/dom';
|
|
7
8
|
import { $ } from '@mdui/jq/$.js';
|
|
8
9
|
import '@mdui/jq/methods/css.js';
|
|
@@ -45,8 +46,8 @@ import { style } from './style.js';
|
|
|
45
46
|
* @csspart content - 正文
|
|
46
47
|
* @csspart action - 操作按钮
|
|
47
48
|
*
|
|
48
|
-
* @cssprop --shape-corner-plain - 当 variant="plain" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
49
|
-
* @cssprop --shape-corner-rich - 当 variant="rich" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
49
|
+
* @cssprop --shape-corner-plain - 当 variant="plain" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/zh-cn/docs/2/styles/design-tokens#shape-corner)
|
|
50
|
+
* @cssprop --shape-corner-rich - 当 variant="rich" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/zh-cn/docs/2/styles/design-tokens#shape-corner)
|
|
50
51
|
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
51
52
|
*/
|
|
52
53
|
let Tooltip = class Tooltip extends MduiElement {
|
|
@@ -62,7 +63,7 @@ let Tooltip = class Tooltip extends MduiElement {
|
|
|
62
63
|
/**
|
|
63
64
|
* tooltip 的位置。默认为 `auto`。可选值包括:
|
|
64
65
|
*
|
|
65
|
-
* * `auto`:自动判断位置。`variant="
|
|
66
|
+
* * `auto`:自动判断位置。`variant="plain"` 时,优先使用 `top`;`variant="rich"` 时,优先使用 `bottom-right`
|
|
66
67
|
* * `top-left`:位于左上方
|
|
67
68
|
* * `top-start`:位于上方,左对齐
|
|
68
69
|
* * `top`:位于上方,居中对齐
|
|
@@ -182,11 +183,11 @@ let Tooltip = class Tooltip extends MduiElement {
|
|
|
182
183
|
connectedCallback() {
|
|
183
184
|
super.connectedCallback();
|
|
184
185
|
document.addEventListener('pointerdown', this.onDocumentClick);
|
|
185
|
-
this.overflowAncestors = getOverflowAncestors(this.target);
|
|
186
|
-
this.overflowAncestors.forEach((ancestor) => {
|
|
187
|
-
ancestor.addEventListener('scroll', this.onWindowScroll);
|
|
188
|
-
});
|
|
189
186
|
this.definedController.whenDefined().then(() => {
|
|
187
|
+
this.overflowAncestors = getOverflowAncestors(this.target);
|
|
188
|
+
this.overflowAncestors.forEach((ancestor) => {
|
|
189
|
+
ancestor.addEventListener('scroll', this.onWindowScroll);
|
|
190
|
+
});
|
|
190
191
|
// trigger 尺寸变化时,重新调整 tooltip 的位置
|
|
191
192
|
this.observeResize = observeResize(this.target, () => {
|
|
192
193
|
this.updatePositioner();
|
|
@@ -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:
|
|
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:transform 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);transform:translateY(-4.625rem)}:host([hide][variant=medium]:not([hide=false i])){transform:translateY(-7.625rem)}:host([hide][variant=large]:not([hide=false i])){transform:translateY(-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}`;
|
|
@@ -22,7 +22,7 @@ declare const TopAppBar_base: import("@lit/reactive-element/decorators/base.js")
|
|
|
22
22
|
*
|
|
23
23
|
* @slot - 顶部应用栏内部的元素
|
|
24
24
|
*
|
|
25
|
-
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
25
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/zh-cn/docs/2/styles/design-tokens#shape-corner)
|
|
26
26
|
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
27
27
|
*/
|
|
28
28
|
export declare class TopAppBar extends TopAppBar_base<TopAppBarEventMap> {
|
|
@@ -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';
|
|
@@ -26,7 +27,7 @@ import { topAppBarStyle } from './top-app-bar-style.js';
|
|
|
26
27
|
*
|
|
27
28
|
* @slot - 顶部应用栏内部的元素
|
|
28
29
|
*
|
|
29
|
-
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
30
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/zh-cn/docs/2/styles/design-tokens#shape-corner)
|
|
30
31
|
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
31
32
|
*/
|
|
32
33
|
let TopAppBar = class TopAppBar extends ScrollBehaviorMixin(LayoutItemBase) {
|
|
@@ -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';
|
|
@@ -71,6 +75,7 @@ let TopAppBar = class TopAppBar extends ScrollBehaviorMixin(LayoutItemBase) {
|
|
|
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
|
});
|