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.
- package/components/avatar/index.d.ts +13 -13
- package/components/avatar/index.js +11 -6
- package/components/avatar/style.js +31 -1
- package/components/badge/index.d.ts +7 -6
- package/components/badge/index.js +6 -5
- package/components/badge/style.js +25 -1
- package/components/bottom-app-bar/index.d.ts +4 -3
- package/components/bottom-app-bar/index.js +3 -3
- package/components/bottom-app-bar/style.js +92 -1
- package/components/button/button-base-style.js +28 -1
- package/components/button/button-base.d.ts +43 -44
- package/components/button/button-base.js +28 -21
- package/components/button/index.d.ts +13 -13
- package/components/button/index.js +30 -20
- package/components/button/style.js +111 -2
- package/components/button-icon/index.d.ts +8 -8
- package/components/button-icon/index.js +29 -12
- package/components/button-icon/style.js +103 -2
- package/components/card/index.d.ts +8 -8
- package/components/card/index.js +12 -8
- package/components/card/style.js +72 -1
- package/components/checkbox/index.d.ts +20 -20
- package/components/checkbox/index.js +68 -25
- package/components/checkbox/style.js +131 -1
- package/components/chip/index.d.ts +19 -19
- package/components/chip/index.js +49 -25
- package/components/chip/style.js +205 -2
- package/components/circular-progress/index.d.ts +2 -2
- package/components/circular-progress/index.js +40 -6
- package/components/circular-progress/style.js +136 -1
- package/components/collapse/collapse-item-style.js +21 -1
- package/components/collapse/collapse-item.d.ts +4 -4
- package/components/collapse/collapse-item.js +12 -4
- package/components/collapse/collapse-style.js +5 -1
- package/components/collapse/collapse.d.ts +6 -9
- package/components/collapse/collapse.js +8 -5
- package/components/dialog/index.d.ts +13 -13
- package/components/dialog/index.js +48 -20
- package/components/dialog/style.js +116 -1
- package/components/divider/index.d.ts +3 -3
- package/components/divider/index.js +3 -3
- package/components/divider/style.js +18 -1
- package/components/dropdown/index.d.ts +35 -35
- package/components/dropdown/index.js +41 -34
- package/components/dropdown/style.js +11 -1
- package/components/fab/index.d.ts +6 -6
- package/components/fab/index.js +19 -11
- package/components/fab/style.js +153 -4
- package/components/icon/index.js +5 -1
- package/components/icon/style.js +29 -1
- package/components/layout/layout-item-style.js +6 -1
- package/components/layout/layout-item.d.ts +7 -7
- package/components/layout/layout-item.js +6 -6
- package/components/layout/layout-main-style.js +7 -1
- package/components/layout/layout-main.d.ts +2 -2
- package/components/layout/layout-main.js +2 -2
- package/components/layout/layout-style.js +11 -1
- package/components/layout/layout.d.ts +2 -2
- package/components/layout/layout.js +2 -2
- package/components/linear-progress/index.d.ts +4 -4
- package/components/linear-progress/index.js +9 -5
- package/components/linear-progress/style.js +73 -1
- package/components/list/list-item-style.js +153 -2
- package/components/list/list-item.d.ts +17 -17
- package/components/list/list-item.js +34 -15
- package/components/list/list-style.js +10 -1
- package/components/list/list-subheader-style.js +19 -1
- package/components/list/list-subheader.d.ts +2 -2
- package/components/list/list-subheader.js +2 -2
- package/components/list/list.d.ts +1 -1
- package/components/list/list.js +1 -1
- package/components/menu/menu-item-style.js +125 -1
- package/components/menu/menu-item.d.ts +4 -4
- package/components/menu/menu-item.js +57 -15
- package/components/menu/menu-style.js +19 -1
- package/components/menu/menu.d.ts +15 -18
- package/components/menu/menu.js +13 -9
- package/components/navigation-bar/navigation-bar-item-style.js +132 -1
- package/components/navigation-bar/navigation-bar-item.d.ts +5 -5
- package/components/navigation-bar/navigation-bar-item.js +27 -11
- package/components/navigation-bar/navigation-bar-style.js +28 -1
- package/components/navigation-bar/navigation-bar.d.ts +9 -8
- package/components/navigation-bar/navigation-bar.js +10 -7
- package/components/navigation-drawer/index.d.ts +19 -20
- package/components/navigation-drawer/index.js +56 -31
- package/components/navigation-drawer/style.js +66 -1
- package/components/navigation-rail/navigation-rail-item-style.js +122 -1
- package/components/navigation-rail/navigation-rail-item.d.ts +6 -6
- package/components/navigation-rail/navigation-rail-item.js +30 -11
- package/components/navigation-rail/navigation-rail-style.js +79 -1
- package/components/navigation-rail/navigation-rail.d.ts +10 -11
- package/components/navigation-rail/navigation-rail.js +19 -11
- package/components/radio/radio-group-style.js +20 -1
- package/components/radio/radio-group.d.ts +13 -13
- package/components/radio/radio-group.js +30 -12
- package/components/radio/radio-style.js +107 -1
- package/components/radio/radio.d.ts +3 -3
- package/components/radio/radio.js +26 -8
- package/components/range-slider/index.d.ts +5 -6
- package/components/range-slider/index.js +57 -10
- package/components/ripple/index.js +5 -2
- package/components/ripple/style.js +96 -1
- package/components/segmented-button/segmented-button-group-style.js +28 -1
- package/components/segmented-button/segmented-button-group.d.ts +17 -20
- package/components/segmented-button/segmented-button-group.js +32 -15
- package/components/segmented-button/segmented-button-style.js +81 -2
- package/components/segmented-button/segmented-button.d.ts +3 -3
- package/components/segmented-button/segmented-button.js +30 -14
- package/components/select/index.d.ts +31 -32
- package/components/select/index.js +106 -26
- package/components/select/style.js +27 -1
- package/components/slider/index.d.ts +1 -1
- package/components/slider/index.js +34 -3
- package/components/slider/slider-base-style.js +173 -1
- package/components/slider/slider-base.d.ts +15 -15
- package/components/slider/slider-base.js +19 -14
- package/components/slider/style.js +7 -1
- package/components/snackbar/index.d.ts +21 -21
- package/components/snackbar/index.js +47 -20
- package/components/snackbar/style.js +100 -1
- package/components/switch/index.d.ts +14 -14
- package/components/switch/index.js +51 -17
- package/components/switch/style.js +202 -1
- package/components/tabs/tab-panel-style.js +10 -1
- package/components/tabs/tab-panel.d.ts +3 -3
- package/components/tabs/tab-panel.js +2 -2
- package/components/tabs/tab-style.js +85 -1
- package/components/tabs/tab.d.ts +6 -6
- package/components/tabs/tab.js +29 -9
- package/components/tabs/tabs-style.js +138 -1
- package/components/tabs/tabs.d.ts +19 -19
- package/components/tabs/tabs.js +26 -18
- package/components/text-field/index.d.ts +51 -51
- package/components/text-field/index.js +185 -57
- package/components/text-field/style.js +362 -1
- package/components/tooltip/index.d.ts +31 -31
- package/components/tooltip/index.js +38 -29
- package/components/tooltip/style.js +57 -1
- package/components/top-app-bar/top-app-bar-style.js +78 -1
- package/components/top-app-bar/top-app-bar-title-style.js +81 -1
- package/components/top-app-bar/top-app-bar-title.d.ts +4 -4
- package/components/top-app-bar/top-app-bar-title.js +21 -7
- package/components/top-app-bar/top-app-bar.d.ts +5 -5
- package/components/top-app-bar/top-app-bar.js +4 -4
- package/css-data.en.json +2826 -0
- package/css-data.zh-cn.json +374 -367
- package/custom-elements.json +2049 -2049
- package/html-data.en.json +6560 -0
- package/html-data.zh-cn.json +1427 -1433
- package/jsx.en.d.ts +3303 -0
- package/jsx.zh-cn.d.ts +3351 -0
- package/package.json +6 -5
- package/web-types.en.json +11734 -0
- package/web-types.zh-cn.json +3227 -3221
- package/mdui.esm.js +0 -22
- package/mdui.global.js +0 -22
|
@@ -1,2 +1,363 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css `:host{display:inline-block;width:100%}:host([disabled]){pointer-events:none}:host([type=hidden]){display:none}.container{position:relative;display:flex;align-items:center;transition:box-shadow var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard);padding:0 1rem}.container.has-icon{padding-left:.75rem}.container.has-end-icon,.container.has-error-icon{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]) .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]) .container{box-shadow:inset 0 0 0 .125rem rgba(var(--mdui-color-on-surface),12%)}.icon,.prefix,.right-icon,.suffix{display:flex;-webkit-user-select:none;user-select:none;color:rgb(var(--mdui-color-on-surface-variant))}:host([disabled]) .icon,:host([disabled]) .prefix,:host([disabled]) .right-icon,:host([disabled]) .suffix{color:rgba(var(--mdui-color-on-surface),38%)}.invalid .right-icon,.invalid .suffix,.invalid-style .right-icon,.invalid-style .suffix{color:rgb(var(--mdui-color-error))}:host(:hover) .invalid .right-icon,:host(:hover) .invalid .suffix,:host(:hover) .invalid-style .right-icon,:host(:hover) .invalid-style .suffix{color:rgb(var(--mdui-color-on-error-container))}:host([focused-style]) .invalid .right-icon,:host([focused-style]) .invalid .suffix,:host([focused-style]) .invalid-style .right-icon,:host([focused-style]) .invalid-style .suffix,:host([focused]) .invalid .right-icon,:host([focused]) .invalid .suffix,:host([focused]) .invalid-style .right-icon,:host([focused]) .invalid-style .suffix{color:rgb(var(--mdui-color-error))}.icon,.right-icon{font-size:1.5rem}.icon mdui-button-icon,.right-icon mdui-button-icon,::slotted(mdui-button-icon[slot]){margin-left:-.5rem;margin-right:-.5rem}.icon .i,.right-icon .i,::slotted([slot$=icon]){font-size:inherit}.has-icon .icon{margin-right:1rem}.has-end-icon .end-icon,.right-icon:not(.end-icon){margin-left:1rem}.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}.prefix{padding-right:.125rem}.suffix{padding-left:.125rem}.input-container{width: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;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]) .label,:host([variant=outlined][disabled]) .label{color:rgba(var(--mdui-color-on-surface),38%)}.input{display:flex;flex-wrap:wrap;width:100%;border:none;outline:0;background:0 0;-webkit-appearance:none;appearance:none;resize:none;cursor:inherit;font-family:inherit;padding:1rem 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))}.input.hide-input{opacity:0;height: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]) .input{color:rgba(var(--mdui-color-on-surface),38%)}:host([end-aligned]) .input{text-align:right}:host([variant=filled]) .label+.input{padding:1.5rem 0 .5rem 0}.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]) .helper{color:rgba(var(--mdui-color-on-surface),38%)}:host([helper-on-focus]) .helper{opacity:0}:host([helper-on-focus][focused-style]) .helper,:host([helper-on-focus][focused]) .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}.is-firefox .input[type=date],.is-firefox .input[type=datetime-local],.is-firefox .input[type=time]{-webkit-clip-path:inset(0 2em 0 0);clip-path:inset(0 2em 0 0)}.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 `
|
|
3
|
+
:host {
|
|
4
|
+
display: inline-block;
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
:host([disabled]) {
|
|
8
|
+
pointer-events: none;
|
|
9
|
+
}
|
|
10
|
+
:host([type='hidden']) {
|
|
11
|
+
display: none;
|
|
12
|
+
}
|
|
13
|
+
.container {
|
|
14
|
+
position: relative;
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
transition: box-shadow var(--mdui-motion-duration-short4)
|
|
18
|
+
var(--mdui-motion-easing-standard);
|
|
19
|
+
padding: 0rem 1rem;
|
|
20
|
+
}
|
|
21
|
+
.container.has-icon {
|
|
22
|
+
padding-left: 0.75rem;
|
|
23
|
+
}
|
|
24
|
+
.container.has-end-icon,
|
|
25
|
+
.container.has-error-icon {
|
|
26
|
+
padding-right: 0.75rem;
|
|
27
|
+
}
|
|
28
|
+
:host([variant='filled']) .container {
|
|
29
|
+
box-shadow: inset 0 -0.0625rem 0 0 rgb(var(--mdui-color-on-surface-variant));
|
|
30
|
+
background-color: rgb(var(--mdui-color-surface-container-highest));
|
|
31
|
+
border-radius: var(--mdui-shape-corner-extra-small)
|
|
32
|
+
var(--mdui-shape-corner-extra-small) 0 0;
|
|
33
|
+
}
|
|
34
|
+
:host([variant='filled']) .container.invalid,
|
|
35
|
+
:host([variant='filled']) .container.invalid-style {
|
|
36
|
+
box-shadow: inset 0 -0.0625rem 0 0 rgb(var(--mdui-color-error));
|
|
37
|
+
}
|
|
38
|
+
:host([variant='filled']:hover) .container {
|
|
39
|
+
box-shadow: inset 0 -0.0625rem 0 0 rgb(var(--mdui-color-on-surface));
|
|
40
|
+
}
|
|
41
|
+
:host([variant='filled']:hover) .container.invalid,
|
|
42
|
+
:host([variant='filled']:hover) .container.invalid-style {
|
|
43
|
+
box-shadow: inset 0 -0.0625rem 0 0 rgb(var(--mdui-color-on-error-container));
|
|
44
|
+
}
|
|
45
|
+
:host([variant='filled'][focused]) .container,
|
|
46
|
+
:host([variant='filled'][focused-style]) .container {
|
|
47
|
+
box-shadow: inset 0 -0.125rem 0 0 rgb(var(--mdui-color-primary));
|
|
48
|
+
}
|
|
49
|
+
:host([variant='filled'][focused]) .container.invalid,
|
|
50
|
+
:host([variant='filled'][focused-style]) .container.invalid,
|
|
51
|
+
:host([variant='filled'][focused]) .container.invalid-style,
|
|
52
|
+
:host([variant='filled'][focused-style]) .container.invalid-style {
|
|
53
|
+
box-shadow: inset 0 -0.125rem 0 0 rgb(var(--mdui-color-error));
|
|
54
|
+
}
|
|
55
|
+
:host([variant='filled'][disabled]) .container {
|
|
56
|
+
box-shadow: inset 0 -0.0625rem 0 0 rgba(var(--mdui-color-on-surface), 38%);
|
|
57
|
+
background-color: rgba(var(--mdui-color-on-surface), 4%);
|
|
58
|
+
}
|
|
59
|
+
:host([variant='outlined']) .container {
|
|
60
|
+
box-shadow: inset 0 0 0 0.0625rem rgb(var(--mdui-color-outline));
|
|
61
|
+
border-radius: var(--mdui-shape-corner-extra-small);
|
|
62
|
+
}
|
|
63
|
+
:host([variant='outlined']) .container.invalid,
|
|
64
|
+
:host([variant='outlined']) .container.invalid-style {
|
|
65
|
+
box-shadow: inset 0 0 0 0.0625rem rgb(var(--mdui-color-error));
|
|
66
|
+
}
|
|
67
|
+
:host([variant='outlined']:hover) .container {
|
|
68
|
+
box-shadow: inset 0 0 0 0.0625rem rgb(var(--mdui-color-on-surface));
|
|
69
|
+
}
|
|
70
|
+
:host([variant='outlined']:hover) .container.invalid,
|
|
71
|
+
:host([variant='outlined']:hover) .container.invalid-style {
|
|
72
|
+
box-shadow: inset 0 0 0 0.0625rem rgb(var(--mdui-color-on-error-container));
|
|
73
|
+
}
|
|
74
|
+
:host([variant='outlined'][focused]) .container,
|
|
75
|
+
:host([variant='outlined'][focused-style]) .container {
|
|
76
|
+
box-shadow: inset 0 0 0 0.125rem rgb(var(--mdui-color-primary));
|
|
77
|
+
}
|
|
78
|
+
:host([variant='outlined'][focused]) .container.invalid,
|
|
79
|
+
:host([variant='outlined'][focused-style]) .container.invalid,
|
|
80
|
+
:host([variant='outlined'][focused]) .container.invalid-style,
|
|
81
|
+
:host([variant='outlined'][focused-style]) .container.invalid-style {
|
|
82
|
+
box-shadow: inset 0 0 0 0.125rem rgb(var(--mdui-color-error));
|
|
83
|
+
}
|
|
84
|
+
:host([variant='outlined'][disabled]) .container {
|
|
85
|
+
box-shadow: inset 0 0 0 0.125rem rgba(var(--mdui-color-on-surface), 12%);
|
|
86
|
+
}
|
|
87
|
+
.icon,
|
|
88
|
+
.right-icon,
|
|
89
|
+
.prefix,
|
|
90
|
+
.suffix {
|
|
91
|
+
display: flex;
|
|
92
|
+
-webkit-user-select: none;
|
|
93
|
+
user-select: none;
|
|
94
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
95
|
+
}
|
|
96
|
+
:host([disabled]) .icon,
|
|
97
|
+
:host([disabled]) .right-icon,
|
|
98
|
+
:host([disabled]) .prefix,
|
|
99
|
+
:host([disabled]) .suffix {
|
|
100
|
+
color: rgba(var(--mdui-color-on-surface), 38%);
|
|
101
|
+
}
|
|
102
|
+
.invalid .right-icon,
|
|
103
|
+
.invalid .suffix,
|
|
104
|
+
.invalid-style .right-icon,
|
|
105
|
+
.invalid-style .suffix {
|
|
106
|
+
color: rgb(var(--mdui-color-error));
|
|
107
|
+
}
|
|
108
|
+
:host(:hover) .invalid .right-icon,
|
|
109
|
+
:host(:hover) .invalid .suffix,
|
|
110
|
+
:host(:hover) .invalid-style .right-icon,
|
|
111
|
+
:host(:hover) .invalid-style .suffix {
|
|
112
|
+
color: rgb(var(--mdui-color-on-error-container));
|
|
113
|
+
}
|
|
114
|
+
:host([focused]) .invalid .right-icon,
|
|
115
|
+
:host([focused]) .invalid .suffix,
|
|
116
|
+
:host([focused-style]) .invalid .right-icon,
|
|
117
|
+
:host([focused-style]) .invalid .suffix,
|
|
118
|
+
:host([focused]) .invalid-style .right-icon,
|
|
119
|
+
:host([focused]) .invalid-style .suffix,
|
|
120
|
+
:host([focused-style]) .invalid-style .right-icon,
|
|
121
|
+
:host([focused-style]) .invalid-style .suffix {
|
|
122
|
+
color: rgb(var(--mdui-color-error));
|
|
123
|
+
}
|
|
124
|
+
.icon,
|
|
125
|
+
.right-icon {
|
|
126
|
+
font-size: 1.5rem;
|
|
127
|
+
}
|
|
128
|
+
.icon mdui-button-icon,
|
|
129
|
+
.right-icon mdui-button-icon,
|
|
130
|
+
::slotted(mdui-button-icon[slot]) {
|
|
131
|
+
margin-left: -0.5rem;
|
|
132
|
+
margin-right: -0.5rem;
|
|
133
|
+
}
|
|
134
|
+
.icon .i,
|
|
135
|
+
.right-icon .i,
|
|
136
|
+
::slotted([slot$='icon']) {
|
|
137
|
+
font-size: inherit;
|
|
138
|
+
}
|
|
139
|
+
.has-icon .icon {
|
|
140
|
+
margin-right: 1rem;
|
|
141
|
+
}
|
|
142
|
+
.right-icon:not(.end-icon),
|
|
143
|
+
.has-end-icon .end-icon {
|
|
144
|
+
margin-left: 1rem;
|
|
145
|
+
}
|
|
146
|
+
.prefix,
|
|
147
|
+
.suffix {
|
|
148
|
+
display: none;
|
|
149
|
+
font-size: var(--mdui-typescale-body-large-size);
|
|
150
|
+
font-weight: var(--mdui-typescale-body-large-weight);
|
|
151
|
+
letter-spacing: var(--mdui-typescale-body-large-tracking);
|
|
152
|
+
line-height: var(--mdui-typescale-body-large-line-height);
|
|
153
|
+
}
|
|
154
|
+
:host([variant='filled'][label]) .prefix,
|
|
155
|
+
:host([variant='filled'][label]) .suffix {
|
|
156
|
+
padding-top: 1rem;
|
|
157
|
+
}
|
|
158
|
+
:host([focused]) .prefix,
|
|
159
|
+
:host([focused]) .suffix,
|
|
160
|
+
:host([focused-style]) .prefix,
|
|
161
|
+
:host([focused-style]) .suffix,
|
|
162
|
+
.has-value .prefix,
|
|
163
|
+
.has-value .suffix {
|
|
164
|
+
display: flex;
|
|
165
|
+
}
|
|
166
|
+
.prefix {
|
|
167
|
+
padding-right: 0.125rem;
|
|
168
|
+
}
|
|
169
|
+
.suffix {
|
|
170
|
+
padding-left: 0.125rem;
|
|
171
|
+
}
|
|
172
|
+
.input-container {
|
|
173
|
+
width: 100%;
|
|
174
|
+
}
|
|
175
|
+
.label {
|
|
176
|
+
position: absolute;
|
|
177
|
+
pointer-events: none;
|
|
178
|
+
max-width: calc(100% - 1rem);
|
|
179
|
+
display: -webkit-box;
|
|
180
|
+
overflow: hidden;
|
|
181
|
+
-webkit-box-orient: vertical;
|
|
182
|
+
-webkit-line-clamp: 1;
|
|
183
|
+
top: 1rem;
|
|
184
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
185
|
+
font-size: var(--mdui-typescale-body-large-size);
|
|
186
|
+
font-weight: var(--mdui-typescale-body-large-weight);
|
|
187
|
+
letter-spacing: var(--mdui-typescale-body-large-tracking);
|
|
188
|
+
line-height: var(--mdui-typescale-body-large-line-height);
|
|
189
|
+
}
|
|
190
|
+
.invalid .label,
|
|
191
|
+
.invalid-style .label {
|
|
192
|
+
color: rgb(var(--mdui-color-error));
|
|
193
|
+
}
|
|
194
|
+
:host([variant='outlined']) .label {
|
|
195
|
+
padding: 0rem 0.25rem;
|
|
196
|
+
margin: 0rem -0.25rem;
|
|
197
|
+
}
|
|
198
|
+
:host([variant='outlined']:hover) .label {
|
|
199
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
200
|
+
}
|
|
201
|
+
:host([variant='filled']:hover) .invalid .label,
|
|
202
|
+
:host([variant='outlined']:hover) .invalid .label,
|
|
203
|
+
:host([variant='filled']:hover) .invalid-style .label,
|
|
204
|
+
:host([variant='outlined']:hover) .invalid-style .label {
|
|
205
|
+
color: rgb(var(--mdui-color-on-error-container));
|
|
206
|
+
}
|
|
207
|
+
:host([variant='filled'][focused]) .label,
|
|
208
|
+
:host([variant='filled'][focused-style]) .label,
|
|
209
|
+
:host([variant='outlined'][focused]) .label,
|
|
210
|
+
:host([variant='outlined'][focused-style]) .label {
|
|
211
|
+
color: rgb(var(--mdui-color-primary));
|
|
212
|
+
}
|
|
213
|
+
:host([variant='filled'][focused]) .label,
|
|
214
|
+
:host([variant='filled'][focused-style]) .label,
|
|
215
|
+
:host([variant='filled']) .has-value .label,
|
|
216
|
+
:host([variant='filled'][type='date']) .label,
|
|
217
|
+
:host([variant='filled'][type='datetime-local']) .label,
|
|
218
|
+
:host([variant='filled'][type='month']) .label,
|
|
219
|
+
:host([variant='filled'][type='time']) .label,
|
|
220
|
+
:host([variant='filled'][type='week']) .label {
|
|
221
|
+
font-size: var(--mdui-typescale-body-small-size);
|
|
222
|
+
font-weight: var(--mdui-typescale-body-small-weight);
|
|
223
|
+
letter-spacing: var(--mdui-typescale-body-small-tracking);
|
|
224
|
+
line-height: var(--mdui-typescale-body-small-line-height);
|
|
225
|
+
top: 0.25rem;
|
|
226
|
+
}
|
|
227
|
+
:host([variant='outlined'][focused]) .label,
|
|
228
|
+
:host([variant='outlined'][focused-style]) .label,
|
|
229
|
+
:host([variant='outlined']) .has-value .label,
|
|
230
|
+
:host([variant='outlined'][type='date']) .label,
|
|
231
|
+
:host([variant='outlined'][type='datetime-local']) .label,
|
|
232
|
+
:host([variant='outlined'][type='month']) .label,
|
|
233
|
+
:host([variant='outlined'][type='time']) .label,
|
|
234
|
+
:host([variant='outlined'][type='week']) .label {
|
|
235
|
+
font-size: var(--mdui-typescale-body-small-size);
|
|
236
|
+
font-weight: var(--mdui-typescale-body-small-weight);
|
|
237
|
+
letter-spacing: var(--mdui-typescale-body-small-tracking);
|
|
238
|
+
line-height: var(--mdui-typescale-body-small-line-height);
|
|
239
|
+
top: -0.5rem;
|
|
240
|
+
left: 0.75rem;
|
|
241
|
+
background-color: rgb(var(--mdui-color-background));
|
|
242
|
+
}
|
|
243
|
+
:host([variant='filled'][focused]) .invalid .label,
|
|
244
|
+
:host([variant='filled'][focused-style]) .invalid .label,
|
|
245
|
+
:host([variant='outlined'][focused]) .invalid .label,
|
|
246
|
+
:host([variant='outlined'][focused-style]) .invalid .label,
|
|
247
|
+
:host([variant='filled'][focused]) .invalid-style .label,
|
|
248
|
+
:host([variant='filled'][focused-style]) .invalid-style .label,
|
|
249
|
+
:host([variant='outlined'][focused]) .invalid-style .label,
|
|
250
|
+
:host([variant='outlined'][focused-style]) .invalid-style .label {
|
|
251
|
+
color: rgb(var(--mdui-color-error));
|
|
252
|
+
}
|
|
253
|
+
:host([variant='filled'][disabled]) .label,
|
|
254
|
+
:host([variant='outlined'][disabled]) .label {
|
|
255
|
+
color: rgba(var(--mdui-color-on-surface), 38%);
|
|
256
|
+
}
|
|
257
|
+
.input {
|
|
258
|
+
display: flex;
|
|
259
|
+
flex-wrap: wrap;
|
|
260
|
+
width: 100%;
|
|
261
|
+
border: none;
|
|
262
|
+
outline: none;
|
|
263
|
+
background: none;
|
|
264
|
+
-webkit-appearance: none;
|
|
265
|
+
appearance: none;
|
|
266
|
+
resize: none;
|
|
267
|
+
cursor: inherit;
|
|
268
|
+
font-family: inherit;
|
|
269
|
+
padding: 1rem 0rem;
|
|
270
|
+
font-size: var(--mdui-typescale-body-large-size);
|
|
271
|
+
font-weight: var(--mdui-typescale-body-large-weight);
|
|
272
|
+
letter-spacing: var(--mdui-typescale-body-large-tracking);
|
|
273
|
+
line-height: var(--mdui-typescale-body-large-line-height);
|
|
274
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
275
|
+
caret-color: rgb(var(--mdui-color-primary));
|
|
276
|
+
}
|
|
277
|
+
.input.hide-input {
|
|
278
|
+
opacity: 0;
|
|
279
|
+
height: 0;
|
|
280
|
+
padding: 0 !important;
|
|
281
|
+
overflow: hidden;
|
|
282
|
+
}
|
|
283
|
+
.input::placeholder {
|
|
284
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
285
|
+
}
|
|
286
|
+
.invalid .input,
|
|
287
|
+
.invalid-style .input {
|
|
288
|
+
caret-color: rgb(var(--mdui-color-error));
|
|
289
|
+
}
|
|
290
|
+
:host([disabled]) .input {
|
|
291
|
+
color: rgba(var(--mdui-color-on-surface), 38%);
|
|
292
|
+
}
|
|
293
|
+
:host([end-aligned]) .input {
|
|
294
|
+
text-align: right;
|
|
295
|
+
}
|
|
296
|
+
:host([variant='filled']) .label + .input {
|
|
297
|
+
padding: 1.5rem 0rem 0.5rem 0rem;
|
|
298
|
+
}
|
|
299
|
+
.supporting {
|
|
300
|
+
display: flex;
|
|
301
|
+
justify-content: space-between;
|
|
302
|
+
padding: 0.25rem 1rem;
|
|
303
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
304
|
+
}
|
|
305
|
+
.supporting.invalid,
|
|
306
|
+
.supporting.invalid-style {
|
|
307
|
+
color: rgb(var(--mdui-color-error));
|
|
308
|
+
}
|
|
309
|
+
.helper {
|
|
310
|
+
display: block;
|
|
311
|
+
opacity: 1;
|
|
312
|
+
transition: opacity var(--mdui-motion-duration-short4)
|
|
313
|
+
var(--mdui-motion-easing-linear);
|
|
314
|
+
font-size: var(--mdui-typescale-body-small-size);
|
|
315
|
+
font-weight: var(--mdui-typescale-body-small-weight);
|
|
316
|
+
letter-spacing: var(--mdui-typescale-body-small-tracking);
|
|
317
|
+
line-height: var(--mdui-typescale-body-small-line-height);
|
|
318
|
+
}
|
|
319
|
+
:host([disabled]) .helper {
|
|
320
|
+
color: rgba(var(--mdui-color-on-surface), 38%);
|
|
321
|
+
}
|
|
322
|
+
:host([helper-on-focus]) .helper {
|
|
323
|
+
opacity: 0;
|
|
324
|
+
}
|
|
325
|
+
:host([helper-on-focus][focused]) .helper,
|
|
326
|
+
:host([helper-on-focus][focused-style]) .helper {
|
|
327
|
+
opacity: 1;
|
|
328
|
+
}
|
|
329
|
+
.error {
|
|
330
|
+
font-size: var(--mdui-typescale-body-small-size);
|
|
331
|
+
font-weight: var(--mdui-typescale-body-small-weight);
|
|
332
|
+
letter-spacing: var(--mdui-typescale-body-small-tracking);
|
|
333
|
+
line-height: var(--mdui-typescale-body-small-line-height);
|
|
334
|
+
}
|
|
335
|
+
.counter {
|
|
336
|
+
flex-wrap: nowrap;
|
|
337
|
+
padding-left: 1rem;
|
|
338
|
+
font-size: var(--mdui-typescale-body-small-size);
|
|
339
|
+
font-weight: var(--mdui-typescale-body-small-weight);
|
|
340
|
+
letter-spacing: var(--mdui-typescale-body-small-tracking);
|
|
341
|
+
line-height: var(--mdui-typescale-body-small-line-height);
|
|
342
|
+
}
|
|
343
|
+
::-ms-reveal {
|
|
344
|
+
display: none;
|
|
345
|
+
}
|
|
346
|
+
.is-firefox .input[type='date'],
|
|
347
|
+
.is-firefox .input[type='datetime-local'],
|
|
348
|
+
.is-firefox .input[type='time'] {
|
|
349
|
+
-webkit-clip-path: inset(0 2em 0 0);
|
|
350
|
+
clip-path: inset(0 2em 0 0);
|
|
351
|
+
}
|
|
352
|
+
.input[type='number']::-webkit-outer-spin-button,
|
|
353
|
+
.input[type='number']::-webkit-inner-spin-button {
|
|
354
|
+
-webkit-appearance: none;
|
|
355
|
+
display: none;
|
|
356
|
+
}
|
|
357
|
+
.input[type='number'] {
|
|
358
|
+
-moz-appearance: textfield;
|
|
359
|
+
}
|
|
360
|
+
.input[type='search']::-webkit-search-cancel-button {
|
|
361
|
+
-webkit-appearance: none;
|
|
362
|
+
}
|
|
363
|
+
`;
|
|
@@ -19,57 +19,57 @@ import type { CSSResultGroup, TemplateResult, PropertyValues } from 'lit';
|
|
|
19
19
|
* @event close - tooltip 开始隐藏时,事件被触发。可以通过调用 `event.preventDefault()` 阻止 tooltip 关闭
|
|
20
20
|
* @event closed - tooltip 隐藏动画完成时,事件被触发
|
|
21
21
|
*
|
|
22
|
-
* @slot - tooltip
|
|
23
|
-
* @slot headline - tooltip
|
|
22
|
+
* @slot - tooltip 触发的目标元素,只有 `default` slot 中的第一个元素会作为目标元素
|
|
23
|
+
* @slot headline - tooltip 的标题,只有当 `variant="rich"` 时,此 slot 才有效
|
|
24
24
|
* @slot content - tooltip 的内容,可以包含 HTML。若只包含纯文本,可以使用 `content` 属性代替
|
|
25
|
-
* @slot action - tooltip
|
|
25
|
+
* @slot action - tooltip 底部的按钮,只有当 `variant="rich"` 时,此 slot 才有效
|
|
26
26
|
*
|
|
27
|
-
* @csspart popup -
|
|
27
|
+
* @csspart popup - tooltip 的容器
|
|
28
28
|
* @csspart headline - 标题
|
|
29
29
|
* @csspart content - 正文
|
|
30
30
|
* @csspart action - 操作按钮
|
|
31
31
|
*
|
|
32
|
-
* @cssprop --shape-corner-plain - variant="plain"
|
|
33
|
-
* @cssprop --shape-corner-rich - variant="rich"
|
|
34
|
-
* @cssprop --z-index - 组件的 CSS
|
|
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)
|
|
34
|
+
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
35
35
|
*/
|
|
36
36
|
export declare class Tooltip extends MduiElement<TooltipEventMap> {
|
|
37
37
|
static styles: CSSResultGroup;
|
|
38
38
|
/**
|
|
39
|
-
* tooltip 的形状。默认为 `plain
|
|
39
|
+
* tooltip 的形状。默认为 `plain`。可选值包括:
|
|
40
40
|
*
|
|
41
|
-
* * `plain
|
|
42
|
-
* * `rich
|
|
41
|
+
* * `plain`:纯文本,适用于简单的单行文本
|
|
42
|
+
* * `rich`:富文本,可以包含标题、正文和操作按钮
|
|
43
43
|
*/
|
|
44
|
-
variant:
|
|
44
|
+
variant: /*纯文本,适用于简单的单行文本*/ 'plain' | /*富文本,可以包含标题、正文和操作按钮*/ 'rich';
|
|
45
45
|
/**
|
|
46
|
-
* tooltip 的位置。默认为 `auto
|
|
46
|
+
* tooltip 的位置。默认为 `auto`。可选值包括:
|
|
47
47
|
*
|
|
48
48
|
* * `auto`:自动判断位置。`variant="plan"` 时,优先使用 `top`;`variant="rich"` 时,优先使用 `bottom-right`
|
|
49
49
|
* * `top-left`:位于左上方
|
|
50
|
-
* * `top-start
|
|
51
|
-
* * `top
|
|
52
|
-
* * `top-end
|
|
50
|
+
* * `top-start`:位于上方,左对齐
|
|
51
|
+
* * `top`:位于上方,居中对齐
|
|
52
|
+
* * `top-end`:位于上方,右对齐
|
|
53
53
|
* * `top-right`:位于右上方
|
|
54
54
|
* * `bottom-left`:位于左下方
|
|
55
|
-
* * `bottom-start
|
|
56
|
-
* * `bottom
|
|
57
|
-
* * `bottom-end
|
|
55
|
+
* * `bottom-start`:位于下方,左对齐
|
|
56
|
+
* * `bottom`:位于下方,居中对齐
|
|
57
|
+
* * `bottom-end`:位于下方,右对齐
|
|
58
58
|
* * `bottom-right`:位于右下方
|
|
59
|
-
* * `left-start
|
|
60
|
-
* * `left
|
|
61
|
-
* * `left-end
|
|
62
|
-
* * `right-start
|
|
63
|
-
* * `right
|
|
64
|
-
* * `right-end
|
|
59
|
+
* * `left-start`:位于左侧,顶部对齐
|
|
60
|
+
* * `left`:位于左侧,居中对齐
|
|
61
|
+
* * `left-end`:位于左侧,底部对齐
|
|
62
|
+
* * `right-start`:位于右侧,顶部对齐
|
|
63
|
+
* * `right`:位于右侧,居中对齐
|
|
64
|
+
* * `right-end`:位于右侧,底部对齐
|
|
65
65
|
*/
|
|
66
|
-
placement: /*自动判断位置*/ 'auto' | /*位于左上方*/ 'top-left' |
|
|
66
|
+
placement: /*自动判断位置*/ 'auto' | /*位于左上方*/ 'top-left' | /*位于上方,左对齐*/ 'top-start' | /*位于上方,居中对齐*/ 'top' | /*位于上方,右对齐*/ 'top-end' | /*位于右上方*/ 'top-right' | /*位于左下方*/ 'bottom-left' | /*位于下方,左对齐*/ 'bottom-start' | /*位于下方,居中对齐*/ 'bottom' | /*位于下方,右对齐*/ 'bottom-end' | /*位于右下方*/ 'bottom-right' | /*位于左侧,顶部对齐*/ 'left-start' | /*位于左侧,居中对齐*/ 'left' | /*位于左侧,底部对齐*/ 'left-end' | /*位于右侧,顶部对齐*/ 'right-start' | /*位于右侧,居中对齐*/ 'right' | /*位于右侧,底部对齐*/ 'right-end';
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* 鼠标悬浮触发显示的延时,单位为毫秒
|
|
69
69
|
*/
|
|
70
70
|
openDelay: number;
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* 鼠标悬浮触发隐藏的延时,单位为毫秒
|
|
73
73
|
*/
|
|
74
74
|
closeDelay: number;
|
|
75
75
|
/**
|
|
@@ -81,14 +81,14 @@ export declare class Tooltip extends MduiElement<TooltipEventMap> {
|
|
|
81
81
|
*/
|
|
82
82
|
content?: string;
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
84
|
+
* 触发方式,支持多个值,用空格分隔。可选值包括:
|
|
85
85
|
*
|
|
86
86
|
* * `click`:点击时触发
|
|
87
|
-
* * `hover
|
|
87
|
+
* * `hover`:鼠标悬浮时触发
|
|
88
88
|
* * `focus`:聚焦时触发
|
|
89
|
-
* * `manual
|
|
89
|
+
* * `manual`:只能通过编程方式打开和关闭 tooltip,不能再指定其他触发方式
|
|
90
90
|
*/
|
|
91
|
-
trigger: /*点击时触发*/ 'click' |
|
|
91
|
+
trigger: /*点击时触发*/ 'click' | /*鼠标悬浮时触发*/ 'hover' | /*聚焦时触发*/ 'focus' | /*只能通过编程方式打开和关闭 tooltip,不能再指定其他触发方式*/ 'manual' | string;
|
|
92
92
|
/**
|
|
93
93
|
* 是否禁用 tooltip
|
|
94
94
|
*/
|
|
@@ -35,67 +35,67 @@ import { style } from './style.js';
|
|
|
35
35
|
* @event close - tooltip 开始隐藏时,事件被触发。可以通过调用 `event.preventDefault()` 阻止 tooltip 关闭
|
|
36
36
|
* @event closed - tooltip 隐藏动画完成时,事件被触发
|
|
37
37
|
*
|
|
38
|
-
* @slot - tooltip
|
|
39
|
-
* @slot headline - tooltip
|
|
38
|
+
* @slot - tooltip 触发的目标元素,只有 `default` slot 中的第一个元素会作为目标元素
|
|
39
|
+
* @slot headline - tooltip 的标题,只有当 `variant="rich"` 时,此 slot 才有效
|
|
40
40
|
* @slot content - tooltip 的内容,可以包含 HTML。若只包含纯文本,可以使用 `content` 属性代替
|
|
41
|
-
* @slot action - tooltip
|
|
41
|
+
* @slot action - tooltip 底部的按钮,只有当 `variant="rich"` 时,此 slot 才有效
|
|
42
42
|
*
|
|
43
|
-
* @csspart popup -
|
|
43
|
+
* @csspart popup - tooltip 的容器
|
|
44
44
|
* @csspart headline - 标题
|
|
45
45
|
* @csspart content - 正文
|
|
46
46
|
* @csspart action - 操作按钮
|
|
47
47
|
*
|
|
48
|
-
* @cssprop --shape-corner-plain - variant="plain"
|
|
49
|
-
* @cssprop --shape-corner-rich - variant="rich"
|
|
50
|
-
* @cssprop --z-index - 组件的 CSS
|
|
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)
|
|
50
|
+
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
51
51
|
*/
|
|
52
52
|
let Tooltip = class Tooltip extends MduiElement {
|
|
53
53
|
constructor() {
|
|
54
54
|
super();
|
|
55
55
|
/**
|
|
56
|
-
* tooltip 的形状。默认为 `plain
|
|
56
|
+
* tooltip 的形状。默认为 `plain`。可选值包括:
|
|
57
57
|
*
|
|
58
|
-
* * `plain
|
|
59
|
-
* * `rich
|
|
58
|
+
* * `plain`:纯文本,适用于简单的单行文本
|
|
59
|
+
* * `rich`:富文本,可以包含标题、正文和操作按钮
|
|
60
60
|
*/
|
|
61
61
|
this.variant = 'plain';
|
|
62
62
|
/**
|
|
63
|
-
* tooltip 的位置。默认为 `auto
|
|
63
|
+
* tooltip 的位置。默认为 `auto`。可选值包括:
|
|
64
64
|
*
|
|
65
65
|
* * `auto`:自动判断位置。`variant="plan"` 时,优先使用 `top`;`variant="rich"` 时,优先使用 `bottom-right`
|
|
66
66
|
* * `top-left`:位于左上方
|
|
67
|
-
* * `top-start
|
|
68
|
-
* * `top
|
|
69
|
-
* * `top-end
|
|
67
|
+
* * `top-start`:位于上方,左对齐
|
|
68
|
+
* * `top`:位于上方,居中对齐
|
|
69
|
+
* * `top-end`:位于上方,右对齐
|
|
70
70
|
* * `top-right`:位于右上方
|
|
71
71
|
* * `bottom-left`:位于左下方
|
|
72
|
-
* * `bottom-start
|
|
73
|
-
* * `bottom
|
|
74
|
-
* * `bottom-end
|
|
72
|
+
* * `bottom-start`:位于下方,左对齐
|
|
73
|
+
* * `bottom`:位于下方,居中对齐
|
|
74
|
+
* * `bottom-end`:位于下方,右对齐
|
|
75
75
|
* * `bottom-right`:位于右下方
|
|
76
|
-
* * `left-start
|
|
77
|
-
* * `left
|
|
78
|
-
* * `left-end
|
|
79
|
-
* * `right-start
|
|
80
|
-
* * `right
|
|
81
|
-
* * `right-end
|
|
76
|
+
* * `left-start`:位于左侧,顶部对齐
|
|
77
|
+
* * `left`:位于左侧,居中对齐
|
|
78
|
+
* * `left-end`:位于左侧,底部对齐
|
|
79
|
+
* * `right-start`:位于右侧,顶部对齐
|
|
80
|
+
* * `right`:位于右侧,居中对齐
|
|
81
|
+
* * `right-end`:位于右侧,底部对齐
|
|
82
82
|
*/
|
|
83
83
|
this.placement = 'auto';
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
85
|
+
* 鼠标悬浮触发显示的延时,单位为毫秒
|
|
86
86
|
*/
|
|
87
87
|
this.openDelay = 150;
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
89
|
+
* 鼠标悬浮触发隐藏的延时,单位为毫秒
|
|
90
90
|
*/
|
|
91
91
|
this.closeDelay = 150;
|
|
92
92
|
/**
|
|
93
|
-
*
|
|
93
|
+
* 触发方式,支持多个值,用空格分隔。可选值包括:
|
|
94
94
|
*
|
|
95
95
|
* * `click`:点击时触发
|
|
96
|
-
* * `hover
|
|
96
|
+
* * `hover`:鼠标悬浮时触发
|
|
97
97
|
* * `focus`:聚焦时触发
|
|
98
|
-
* * `manual
|
|
98
|
+
* * `manual`:只能通过编程方式打开和关闭 tooltip,不能再指定其他触发方式
|
|
99
99
|
*/
|
|
100
100
|
this.trigger = 'hover focus';
|
|
101
101
|
/**
|
|
@@ -215,7 +215,16 @@ let Tooltip = class Tooltip extends MduiElement {
|
|
|
215
215
|
const hasHeadline = this.isRich() &&
|
|
216
216
|
(this.headline || this.hasSlotController.test('headline'));
|
|
217
217
|
const hasAction = this.isRich() && this.hasSlotController.test('action');
|
|
218
|
-
return html `<slot></slot
|
|
218
|
+
return html `<slot></slot>
|
|
219
|
+
<div ${ref(this.popupRef)} part="popup" class="popup" hidden>
|
|
220
|
+
${when(hasHeadline, () => html `<slot name="headline" part="headline" class="headline">
|
|
221
|
+
${this.headline}
|
|
222
|
+
</slot>`)}
|
|
223
|
+
<slot name="content" part="content" class="content">
|
|
224
|
+
${this.content}
|
|
225
|
+
</slot>
|
|
226
|
+
${when(hasAction, () => html `<slot name="action" part="action" class="action"></slot>`)}
|
|
227
|
+
</div>`;
|
|
219
228
|
}
|
|
220
229
|
isRich() {
|
|
221
230
|
return this.variant === 'rich';
|
|
@@ -1,2 +1,58 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
2
|
+
export const style = css `
|
|
3
|
+
:host {
|
|
4
|
+
--shape-corner-plain: var(--mdui-shape-corner-extra-small);
|
|
5
|
+
--shape-corner-rich: var(--mdui-shape-corner-medium);
|
|
6
|
+
--z-index: 2500;
|
|
7
|
+
display: contents;
|
|
8
|
+
}
|
|
9
|
+
.popup {
|
|
10
|
+
position: fixed;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
z-index: var(--z-index);
|
|
14
|
+
border-radius: var(--shape-corner-plain);
|
|
15
|
+
background-color: rgb(var(--mdui-color-inverse-surface));
|
|
16
|
+
padding: 0rem 0.5rem;
|
|
17
|
+
min-width: 1.75rem;
|
|
18
|
+
max-width: 20rem;
|
|
19
|
+
}
|
|
20
|
+
:host([variant='rich']) .popup {
|
|
21
|
+
border-radius: var(--shape-corner-rich);
|
|
22
|
+
background-color: rgb(var(--mdui-color-surface-container));
|
|
23
|
+
box-shadow: var(--mdui-elevation-level2);
|
|
24
|
+
padding: 0.75rem 1rem 0.5rem 1rem;
|
|
25
|
+
}
|
|
26
|
+
.headline {
|
|
27
|
+
display: flex;
|
|
28
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
29
|
+
font-size: var(--mdui-typescale-title-small-size);
|
|
30
|
+
font-weight: var(--mdui-typescale-title-small-weight);
|
|
31
|
+
letter-spacing: var(--mdui-typescale-title-small-tracking);
|
|
32
|
+
line-height: var(--mdui-typescale-title-small-line-height);
|
|
33
|
+
}
|
|
34
|
+
.content {
|
|
35
|
+
display: flex;
|
|
36
|
+
padding: 0.25rem 0rem;
|
|
37
|
+
color: rgb(var(--mdui-color-inverse-on-surface));
|
|
38
|
+
font-size: var(--mdui-typescale-body-small-size);
|
|
39
|
+
font-weight: var(--mdui-typescale-body-small-weight);
|
|
40
|
+
letter-spacing: var(--mdui-typescale-body-small-tracking);
|
|
41
|
+
line-height: var(--mdui-typescale-body-small-line-height);
|
|
42
|
+
}
|
|
43
|
+
:host([variant='rich']) .content {
|
|
44
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
45
|
+
font-size: var(--mdui-typescale-body-medium-size);
|
|
46
|
+
font-weight: var(--mdui-typescale-body-medium-weight);
|
|
47
|
+
letter-spacing: var(--mdui-typescale-body-medium-tracking);
|
|
48
|
+
line-height: var(--mdui-typescale-body-medium-line-height);
|
|
49
|
+
}
|
|
50
|
+
.action {
|
|
51
|
+
display: flex;
|
|
52
|
+
justify-content: flex-start;
|
|
53
|
+
padding-top: 0.5rem;
|
|
54
|
+
}
|
|
55
|
+
.action ::slotted(:not(:last-child)) {
|
|
56
|
+
margin-right: 0.5rem;
|
|
57
|
+
}
|
|
58
|
+
`;
|