godown 3.12.0 → 3.13.0
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/build/godown+lit.iife.js +12 -13
- package/build/godown+lit.iife.js.map +1 -1
- package/build/godown+lit.js +11 -12
- package/build/godown+lit.js.map +1 -1
- package/build/godown+lit.umd.js +12 -13
- package/build/godown+lit.umd.js.map +1 -1
- package/build/godown.iife.js +7 -7
- package/build/godown.iife.js.map +1 -1
- package/build/godown.js +5 -5
- package/build/godown.js.map +1 -1
- package/build/godown.umd.js +7 -7
- package/build/godown.umd.js.map +1 -1
- package/custom-elements.json +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/internal/global-style.d.ts.map +1 -1
- package/internal/global-style.js +1 -1
- package/internal/global-style.js.map +1 -1
- package/internal/popover.d.ts +3 -0
- package/internal/popover.d.ts.map +1 -0
- package/internal/popover.js +2 -0
- package/internal/popover.js.map +1 -0
- package/internal/reset-style.d.ts +3 -0
- package/internal/reset-style.d.ts.map +1 -0
- package/internal/reset-style.js +2 -0
- package/internal/reset-style.js.map +1 -0
- package/internal/ring.d.ts +1 -0
- package/internal/ring.d.ts.map +1 -1
- package/internal/ring.js +1 -1
- package/internal/ring.js.map +1 -1
- package/internal/super-input.d.ts +1 -1
- package/internal/super-input.d.ts.map +1 -1
- package/internal/super-input.js +1 -1
- package/internal/super-input.js.map +1 -1
- package/internal/utils.d.ts +2 -0
- package/internal/utils.d.ts.map +1 -0
- package/internal/utils.js +2 -0
- package/internal/utils.js.map +1 -0
- package/package.json +2 -3
- package/popover.d.ts +2 -0
- package/popover.d.ts.map +1 -0
- package/popover.js +2 -0
- package/popover.js.map +1 -0
- package/src/index.ts +1 -0
- package/src/internal/global-style.ts +5 -33
- package/src/internal/popover.ts +64 -0
- package/src/internal/reset-style.ts +63 -0
- package/src/internal/ring.ts +3 -2
- package/src/internal/super-input.ts +2 -2
- package/src/internal/utils.ts +10 -0
- package/src/popover.ts +1 -0
- package/src/web-components/alert/component.ts +3 -2
- package/src/web-components/avatar/component.ts +1 -0
- package/src/web-components/button/component.ts +2 -0
- package/src/web-components/card/component.ts +3 -2
- package/src/web-components/chip/component.ts +1 -3
- package/src/web-components/details/component.ts +27 -16
- package/src/web-components/dialog/component.ts +50 -67
- package/src/web-components/heading/component.ts +0 -1
- package/src/web-components/input/component.ts +1 -3
- package/src/web-components/link/component.ts +0 -2
- package/src/web-components/popover/component.ts +172 -0
- package/src/web-components/popover/definition.ts +11 -0
- package/src/web-components/range/component.ts +2 -1
- package/src/web-components/rotate/component.ts +0 -1
- package/src/web-components/select/component.ts +109 -173
- package/src/web-components/split/component.ts +2 -2
- package/src/web-components/switch/component.ts +2 -1
- package/src/web-components/tabs/component.ts +99 -100
- package/src/web-components/tooltip/component.ts +44 -112
- package/vscode.css-custom-data.json +1 -1
- package/vscode.html-custom-data.json +1 -1
- package/web-components/alert/component.d.ts.map +1 -1
- package/web-components/alert/component.js +1 -1
- package/web-components/alert/component.js.map +1 -1
- package/web-components/avatar/component.d.ts.map +1 -1
- package/web-components/avatar/component.js +1 -1
- package/web-components/avatar/component.js.map +1 -1
- package/web-components/button/component.d.ts.map +1 -1
- package/web-components/button/component.js +1 -1
- package/web-components/button/component.js.map +1 -1
- package/web-components/card/component.d.ts.map +1 -1
- package/web-components/card/component.js +1 -1
- package/web-components/card/component.js.map +1 -1
- package/web-components/chip/component.d.ts +1 -3
- package/web-components/chip/component.d.ts.map +1 -1
- package/web-components/chip/component.js.map +1 -1
- package/web-components/details/component.d.ts +9 -13
- package/web-components/details/component.d.ts.map +1 -1
- package/web-components/details/component.js +1 -1
- package/web-components/details/component.js.map +1 -1
- package/web-components/dialog/component.d.ts +12 -14
- package/web-components/dialog/component.d.ts.map +1 -1
- package/web-components/dialog/component.js +1 -1
- package/web-components/dialog/component.js.map +1 -1
- package/web-components/heading/component.d.ts.map +1 -1
- package/web-components/heading/component.js +1 -1
- package/web-components/heading/component.js.map +1 -1
- package/web-components/input/component.d.ts.map +1 -1
- package/web-components/input/component.js +1 -1
- package/web-components/input/component.js.map +1 -1
- package/web-components/link/component.d.ts.map +1 -1
- package/web-components/link/component.js +1 -1
- package/web-components/link/component.js.map +1 -1
- package/web-components/popover/component.d.ts +35 -0
- package/web-components/popover/component.d.ts.map +1 -0
- package/web-components/popover/component.js +2 -0
- package/web-components/popover/component.js.map +1 -0
- package/web-components/popover/definition.d.ts +8 -0
- package/web-components/popover/definition.d.ts.map +1 -0
- package/web-components/popover/definition.js +2 -0
- package/web-components/popover/definition.js.map +1 -0
- package/web-components/range/component.d.ts.map +1 -1
- package/web-components/range/component.js +1 -1
- package/web-components/range/component.js.map +1 -1
- package/web-components/rotate/component.d.ts.map +1 -1
- package/web-components/rotate/component.js.map +1 -1
- package/web-components/select/component.d.ts +11 -27
- package/web-components/select/component.d.ts.map +1 -1
- package/web-components/select/component.js +1 -1
- package/web-components/select/component.js.map +1 -1
- package/web-components/split/component.js +1 -1
- package/web-components/split/component.js.map +1 -1
- package/web-components/switch/component.d.ts.map +1 -1
- package/web-components/switch/component.js +1 -1
- package/web-components/switch/component.js.map +1 -1
- package/web-components/tabs/component.d.ts +18 -25
- package/web-components/tabs/component.d.ts.map +1 -1
- package/web-components/tabs/component.js +1 -1
- package/web-components/tabs/component.js.map +1 -1
- package/web-components/tooltip/component.d.ts +15 -39
- package/web-components/tooltip/component.d.ts.map +1 -1
- package/web-components/tooltip/component.js +1 -1
- package/web-components/tooltip/component.js.map +1 -1
- package/web-types.json +1 -1
- package/internal/direction.d.ts +0 -27
- package/internal/direction.d.ts.map +0 -1
- package/internal/direction.js +0 -2
- package/internal/direction.js.map +0 -1
- package/internal/super-openable.d.ts +0 -15
- package/internal/super-openable.d.ts.map +0 -1
- package/internal/super-openable.js +0 -2
- package/internal/super-openable.js.map +0 -1
- package/src/internal/direction.ts +0 -65
- package/src/internal/super-openable.ts +0 -34
@@ -1,10 +1,9 @@
|
|
1
1
|
import { attr, godown, htmlSlot, styles } from "@godown/element";
|
2
2
|
import svgCaretDown from "../../internal/icons/caret-down.js";
|
3
|
-
import { type TemplateResult, css, html } from "lit";
|
3
|
+
import { type PropertyValueMap, type TemplateResult, css, html } from "lit";
|
4
4
|
import { property } from "lit/decorators.js";
|
5
5
|
|
6
|
-
import { scopePrefix } from "../../internal/global-style.js";
|
7
|
-
import { SuperOpenable } from "../../internal/super-openable.js";
|
6
|
+
import GlobalStyle, { scopePrefix } from "../../internal/global-style.js";
|
8
7
|
|
9
8
|
const protoName = "details";
|
10
9
|
|
@@ -13,7 +12,7 @@ const cssScope = scopePrefix(protoName);
|
|
13
12
|
/**
|
14
13
|
* {@linkcode Details} similar to `<details>`.
|
15
14
|
*
|
16
|
-
* @slot summary - Details summary
|
15
|
+
* @slot summary - Details summary (trigger).
|
17
16
|
* @slot - Details content.
|
18
17
|
* @fires change - Fires when the open changes.
|
19
18
|
* @category display
|
@@ -28,7 +27,6 @@ const cssScope = scopePrefix(protoName);
|
|
28
27
|
}
|
29
28
|
|
30
29
|
[part="root"] {
|
31
|
-
padding: 0.25em;
|
32
30
|
position: relative;
|
33
31
|
}
|
34
32
|
|
@@ -75,22 +73,16 @@ const cssScope = scopePrefix(protoName);
|
|
75
73
|
transform: rotate(var(${cssScope}--icon-deg-open));
|
76
74
|
}
|
77
75
|
`)
|
78
|
-
class Details extends
|
79
|
-
|
80
|
-
|
81
|
-
|
76
|
+
class Details extends GlobalStyle {
|
77
|
+
@property({ type: Boolean, reflect: true })
|
78
|
+
open = false;
|
79
|
+
|
82
80
|
@property({ type: Boolean })
|
83
81
|
float = false;
|
84
82
|
|
85
|
-
/**
|
86
|
-
* Determines whether the details component should fill the available space.
|
87
|
-
*/
|
88
83
|
@property({ type: Boolean })
|
89
84
|
fill = false;
|
90
85
|
|
91
|
-
/**
|
92
|
-
* The summary text to display in the details component.
|
93
|
-
*/
|
94
86
|
@property()
|
95
87
|
summary = "";
|
96
88
|
|
@@ -105,7 +97,7 @@ class Details extends SuperOpenable {
|
|
105
97
|
@click="${() => this.toggle()}"
|
106
98
|
>
|
107
99
|
<span part="summary">${htmlSlot("summary", this.summary)}</span>
|
108
|
-
<span part="icon">${svgCaretDown()}</span>
|
100
|
+
<span part="icon">${htmlSlot("icon", svgCaretDown())}</span>
|
109
101
|
</dt>
|
110
102
|
<dd
|
111
103
|
part="details"
|
@@ -116,6 +108,25 @@ class Details extends SuperOpenable {
|
|
116
108
|
</dl>
|
117
109
|
`;
|
118
110
|
}
|
111
|
+
|
112
|
+
protected updated(changedProperties: PropertyValueMap<this>): void {
|
113
|
+
const open = changedProperties.get("open");
|
114
|
+
if (open !== undefined) {
|
115
|
+
this.dispatchCustomEvent("change", open);
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
toggle(to?: boolean): void {
|
120
|
+
this.open = to ?? !this.open;
|
121
|
+
}
|
122
|
+
|
123
|
+
close(): void {
|
124
|
+
this.open = false;
|
125
|
+
}
|
126
|
+
|
127
|
+
show(): void {
|
128
|
+
this.open = true;
|
129
|
+
}
|
119
130
|
}
|
120
131
|
|
121
132
|
export default Details;
|
@@ -1,23 +1,24 @@
|
|
1
|
-
import { type HandlerEvent,
|
1
|
+
import { type HandlerEvent, godown, htmlSlot, queryPart, styles } from "@godown/element";
|
2
2
|
import { type PropertyValues, type TemplateResult, css, html } from "lit";
|
3
|
-
import { property
|
3
|
+
import { property } from "lit/decorators.js";
|
4
4
|
|
5
|
-
import { scopePrefix } from "../../internal/global-style.js";
|
6
|
-
import { SuperOpenable } from "../../internal/super-openable.js";
|
5
|
+
import GlobalStyle, { scopePrefix } from "../../internal/global-style.js";
|
7
6
|
|
8
7
|
const protoName = "dialog";
|
9
8
|
const cssScope = scopePrefix(protoName);
|
10
9
|
|
11
|
-
const splitKeysRegexp = /[\s,]+/;
|
12
|
-
|
13
10
|
/**
|
14
11
|
* {@linkcode Dialog} similar to `<dialog>`.
|
15
12
|
*
|
16
13
|
* Like dialog, it listens for submit events and closes itself when the target method is "dialog".
|
17
14
|
*
|
18
|
-
*
|
15
|
+
* Previous versions of Dialog did not contain triggers.
|
16
|
+
* Therefore, unlike Tooltip which uses the default slot as the trigger.
|
17
|
+
* Dialog needs to use slot="trigger" as the trigger instead of an element without a slot name.
|
19
18
|
*
|
20
19
|
* @fires change - Fires when the open changes.
|
20
|
+
* @slot trigger - The trigger element.
|
21
|
+
* @slot - The dialog content.
|
21
22
|
* @category feedback
|
22
23
|
*/
|
23
24
|
@godown(protoName)
|
@@ -27,7 +28,11 @@ const splitKeysRegexp = /[\s,]+/;
|
|
27
28
|
${cssScope}--opacity-modal: 0.2;
|
28
29
|
width: fit-content;
|
29
30
|
display: block;
|
30
|
-
|
31
|
+
background: none;
|
32
|
+
}
|
33
|
+
|
34
|
+
dialog {
|
35
|
+
position: relative;
|
31
36
|
background: none;
|
32
37
|
z-index: 1;
|
33
38
|
left: 50%;
|
@@ -36,58 +41,39 @@ const splitKeysRegexp = /[\s,]+/;
|
|
36
41
|
transform: translate(-50%, -50%);
|
37
42
|
}
|
38
43
|
|
39
|
-
:host(:not([open])) {
|
40
|
-
visibility: hidden;
|
41
|
-
}
|
42
|
-
|
43
|
-
:host([contents]) dialog {
|
44
|
-
position: fixed;
|
45
|
-
}
|
46
|
-
|
47
|
-
dialog {
|
48
|
-
position: relative;
|
49
|
-
background: inherit;
|
50
|
-
}
|
51
|
-
|
52
44
|
::backdrop {
|
53
45
|
background: var(${cssScope}--background-modal);
|
54
46
|
opacity: var(${cssScope}--opacity-modal);
|
55
47
|
}
|
56
48
|
`)
|
57
|
-
class Dialog extends
|
58
|
-
/**
|
59
|
-
* Indicates whether the dialog should be displayed as a modal.
|
60
|
-
*/
|
49
|
+
class Dialog extends GlobalStyle {
|
61
50
|
@property({ type: Boolean, reflect: true })
|
62
|
-
|
63
|
-
this.contents = value;
|
64
|
-
}
|
51
|
+
open = false;
|
65
52
|
|
66
|
-
|
67
|
-
|
68
|
-
}
|
69
|
-
|
70
|
-
/**
|
71
|
-
* The keys will close the dialog when pressed.
|
72
|
-
*/
|
73
|
-
@property()
|
74
|
-
key = "Escape";
|
53
|
+
@property({ type: Boolean, reflect: true })
|
54
|
+
modal = false;
|
75
55
|
|
76
56
|
/**
|
77
57
|
* Indicates whether the modal has been invoked.
|
78
58
|
*/
|
79
59
|
private __modalInvoke = false;
|
80
60
|
|
81
|
-
@
|
61
|
+
@queryPart("dialog")
|
82
62
|
protected _dialog: HTMLDialogElement;
|
83
63
|
|
84
64
|
protected render(): TemplateResult<1> {
|
85
65
|
return html`
|
86
|
-
<
|
66
|
+
<div
|
87
67
|
part="root"
|
88
|
-
|
68
|
+
@click=${this.show}
|
89
69
|
>
|
90
|
-
${htmlSlot()}
|
70
|
+
${htmlSlot("trigger")}
|
71
|
+
</div>
|
72
|
+
<dialog
|
73
|
+
part="dialog"
|
74
|
+
role="dialog"
|
75
|
+
>
|
76
|
+
${htmlSlot("dialog")}${htmlSlot()}
|
91
77
|
</dialog>
|
92
78
|
`;
|
93
79
|
}
|
@@ -98,19 +84,16 @@ class Dialog extends SuperOpenable {
|
|
98
84
|
this.show();
|
99
85
|
}
|
100
86
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
this._dialog.close();
|
112
|
-
}
|
113
|
-
}
|
87
|
+
show(): void {
|
88
|
+
this.open = true;
|
89
|
+
}
|
90
|
+
|
91
|
+
close(): void {
|
92
|
+
this.open = false;
|
93
|
+
}
|
94
|
+
|
95
|
+
toggle(to?: boolean): void {
|
96
|
+
this.open = to ?? !this.open;
|
114
97
|
}
|
115
98
|
|
116
99
|
private __submitEvent: EventListenerOrEventListenerObject;
|
@@ -119,11 +102,20 @@ class Dialog extends SuperOpenable {
|
|
119
102
|
protected updated(changedProperties: PropertyValues): void {
|
120
103
|
if (changedProperties.has("open")) {
|
121
104
|
if (this.open) {
|
122
|
-
|
123
|
-
|
124
|
-
|
105
|
+
if (this.modal) {
|
106
|
+
this._dialog.showModal();
|
107
|
+
} else {
|
108
|
+
this._dialog.show();
|
125
109
|
}
|
110
|
+
this.__submitEvent = this.events.add(this, "submit", this._handelSubmit);
|
111
|
+
|
112
|
+
this.__keydownEvent = this.events.add(document, "keydown", this._handleKeydown.bind(this));
|
126
113
|
} else {
|
114
|
+
if (this.__modalInvoke) {
|
115
|
+
this.modal = false;
|
116
|
+
this.__modalInvoke = false;
|
117
|
+
}
|
118
|
+
this._dialog.close();
|
127
119
|
this.events.remove(this, "submit", this.__submitEvent);
|
128
120
|
this.events.remove(document, "keydown", this.__keydownEvent);
|
129
121
|
}
|
@@ -131,8 +123,7 @@ class Dialog extends SuperOpenable {
|
|
131
123
|
}
|
132
124
|
|
133
125
|
protected _handleKeydown(e: KeyboardEvent): void {
|
134
|
-
|
135
|
-
if (keys.includes(e.key) || keys.includes(e.code)) {
|
126
|
+
if (e.key === "Escape") {
|
136
127
|
e.preventDefault();
|
137
128
|
this.close();
|
138
129
|
}
|
@@ -144,14 +135,6 @@ class Dialog extends SuperOpenable {
|
|
144
135
|
this.close();
|
145
136
|
}
|
146
137
|
}
|
147
|
-
|
148
|
-
close(): void {
|
149
|
-
if (this.__modalInvoke) {
|
150
|
-
this.modal = false;
|
151
|
-
this.__modalInvoke = false;
|
152
|
-
}
|
153
|
-
this.open = false;
|
154
|
-
}
|
155
138
|
}
|
156
139
|
|
157
140
|
export default Dialog;
|
@@ -49,7 +49,7 @@ const protoName = "input";
|
|
49
49
|
${cssGlobalVars.input}-icon-color: currentColor;
|
50
50
|
}
|
51
51
|
|
52
|
-
[part
|
52
|
+
[part="root"] {
|
53
53
|
padding: 0.4em 0.5em;
|
54
54
|
display: flex;
|
55
55
|
position: relative;
|
@@ -61,8 +61,6 @@ const protoName = "input";
|
|
61
61
|
width: 100%;
|
62
62
|
height: 100%;
|
63
63
|
flex-grow: 1;
|
64
|
-
color: currentColor;
|
65
|
-
background: none;
|
66
64
|
}
|
67
65
|
|
68
66
|
[part="prefix"],
|
@@ -39,7 +39,6 @@ type LinkType = keyof typeof linkTypes;
|
|
39
39
|
@styles(css`
|
40
40
|
:host {
|
41
41
|
display: inline-block;
|
42
|
-
color: currentColor;
|
43
42
|
cursor: default;
|
44
43
|
}
|
45
44
|
|
@@ -48,7 +47,6 @@ type LinkType = keyof typeof linkTypes;
|
|
48
47
|
}
|
49
48
|
|
50
49
|
a {
|
51
|
-
color: currentColor;
|
52
50
|
display: contents;
|
53
51
|
}
|
54
52
|
`)
|
@@ -0,0 +1,172 @@
|
|
1
|
+
import { property } from "lit/decorators.js";
|
2
|
+
import GlobalStyle from "../../internal/global-style.js";
|
3
|
+
import { css, html, type PropertyValues, type TemplateResult } from "lit";
|
4
|
+
import { godown, htmlSlot, joinRules, part, StyleController, styles } from "@godown/element";
|
5
|
+
import { hidePopover, showPopover } from "../../internal/popover.js";
|
6
|
+
|
7
|
+
const POPOVER = "popover";
|
8
|
+
const protoName = POPOVER;
|
9
|
+
|
10
|
+
/**
|
11
|
+
* {@link Popover} renders a popover.
|
12
|
+
*
|
13
|
+
* This requires the support of the popover API and CSS position-area.
|
14
|
+
*
|
15
|
+
* @fires toggle - Fired when the popover is toggled.
|
16
|
+
* @slot popover - Popover content.
|
17
|
+
* @slot - Popover trigger.
|
18
|
+
* @category display
|
19
|
+
*/
|
20
|
+
@godown(protoName)
|
21
|
+
@styles(css`
|
22
|
+
:host {
|
23
|
+
display: inline-block;
|
24
|
+
}
|
25
|
+
|
26
|
+
[part="trigger"] {
|
27
|
+
display: contents;
|
28
|
+
}
|
29
|
+
|
30
|
+
[part="root"] {
|
31
|
+
display: inherit;
|
32
|
+
}
|
33
|
+
|
34
|
+
[part="popover"] {
|
35
|
+
inset: unset;
|
36
|
+
z-index: 1;
|
37
|
+
overflow: visible;
|
38
|
+
position: absolute;
|
39
|
+
position-try-fallbacks: flip-block;
|
40
|
+
}
|
41
|
+
`)
|
42
|
+
class Popover extends GlobalStyle {
|
43
|
+
anchorName = `--${POPOVER}-${Math.random().toString(36).slice(2)}`;
|
44
|
+
|
45
|
+
@property({ type: Boolean, reflect: true })
|
46
|
+
open = false;
|
47
|
+
|
48
|
+
@property()
|
49
|
+
action: "hide" | "show" | "toggle" | "none" = "show";
|
50
|
+
|
51
|
+
@property()
|
52
|
+
span: "span" | "spread" | "isolated" = "span";
|
53
|
+
|
54
|
+
/**
|
55
|
+
* The position refers to the spatial location of the popover in relation to the trigger,
|
56
|
+
* rather than the alignment property between them.
|
57
|
+
*/
|
58
|
+
@property()
|
59
|
+
position:
|
60
|
+
| "center"
|
61
|
+
| "left"
|
62
|
+
| "left-top"
|
63
|
+
| "left-bottom"
|
64
|
+
| "right"
|
65
|
+
| "right-top"
|
66
|
+
| "right-bottom"
|
67
|
+
| "top"
|
68
|
+
| "top-left"
|
69
|
+
| "top-right"
|
70
|
+
| "bottom"
|
71
|
+
| "bottom-left"
|
72
|
+
| "bottom-right"
|
73
|
+
| "start"
|
74
|
+
| "start-start"
|
75
|
+
| "start-end"
|
76
|
+
| "end"
|
77
|
+
| "end-start"
|
78
|
+
| "end-end" = "bottom";
|
79
|
+
|
80
|
+
@part(POPOVER)
|
81
|
+
protected _popover: HTMLElement;
|
82
|
+
|
83
|
+
constructor() {
|
84
|
+
super();
|
85
|
+
new StyleController(this, () => {
|
86
|
+
return joinRules({
|
87
|
+
"[part=root],slot:not([name])::slotted(*)": {
|
88
|
+
"anchor-name": this.anchorName,
|
89
|
+
},
|
90
|
+
"[part=popover]": {
|
91
|
+
"position-anchor": this.anchorName,
|
92
|
+
"position-area": this.resolveArea(),
|
93
|
+
},
|
94
|
+
});
|
95
|
+
});
|
96
|
+
}
|
97
|
+
protected render(): TemplateResult<1> {
|
98
|
+
return html`
|
99
|
+
<div part="root">
|
100
|
+
<div
|
101
|
+
part="trigger"
|
102
|
+
@click=${this._handleClick}
|
103
|
+
>
|
104
|
+
${htmlSlot()}
|
105
|
+
</div>
|
106
|
+
<div
|
107
|
+
part="popover"
|
108
|
+
popover="manual"
|
109
|
+
>
|
110
|
+
${htmlSlot("popover")}
|
111
|
+
</div>
|
112
|
+
</div>
|
113
|
+
`;
|
114
|
+
}
|
115
|
+
|
116
|
+
protected _handleClick(): void {
|
117
|
+
const { action } = this;
|
118
|
+
switch (action) {
|
119
|
+
case "show":
|
120
|
+
case "hide":
|
121
|
+
case "toggle":
|
122
|
+
this[action]();
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
show(): void {
|
127
|
+
this.toggle(true);
|
128
|
+
}
|
129
|
+
|
130
|
+
hide(): void {
|
131
|
+
this.toggle(false);
|
132
|
+
}
|
133
|
+
|
134
|
+
toggle(force?: boolean): void {
|
135
|
+
this.open = force ?? !this.open;
|
136
|
+
}
|
137
|
+
|
138
|
+
protected updated(_changedProperties: PropertyValues): void {
|
139
|
+
if (_changedProperties.has("open")) {
|
140
|
+
this._openChange();
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
protected _openChange(): void {
|
145
|
+
const { open } = this;
|
146
|
+
if (open) {
|
147
|
+
showPopover.call(this, this._popover);
|
148
|
+
const listener = (e) => {
|
149
|
+
if (!this.contains(e.target)) {
|
150
|
+
this.events.remove(document, "click", listener);
|
151
|
+
this.open = false;
|
152
|
+
}
|
153
|
+
};
|
154
|
+
this.events.add(document, "click", listener);
|
155
|
+
} else {
|
156
|
+
hidePopover(this._popover);
|
157
|
+
}
|
158
|
+
this.dispatchCustomEvent("toggle", open);
|
159
|
+
}
|
160
|
+
|
161
|
+
resolveArea(): string {
|
162
|
+
const split = this.position.split("-");
|
163
|
+
const firstValue = this.span === "spread" ? `span-${split[0]}` : split[0];
|
164
|
+
if (split.length < 2) {
|
165
|
+
return `${firstValue} center`;
|
166
|
+
}
|
167
|
+
const secondValue = this.span === "isolated" ? split[1] : `span-${split[1]}`;
|
168
|
+
return `${firstValue} ${secondValue}`;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
172
|
+
export { Popover, Popover as default };
|
@@ -15,6 +15,7 @@ import { property, queryAll, state } from "lit/decorators.js";
|
|
15
15
|
|
16
16
|
import { cssGlobalVars, scopePrefix } from "../../internal/global-style.js";
|
17
17
|
import { SuperInput } from "../../internal/super-input.js";
|
18
|
+
import { ringTypeAttribute } from "../../internal/ring.js";
|
18
19
|
|
19
20
|
const protoName = "range";
|
20
21
|
const cssScope = scopePrefix(protoName);
|
@@ -203,7 +204,7 @@ class Range<V extends RangeValue = RangeValue> extends SuperInput<RangeValue> {
|
|
203
204
|
}
|
204
205
|
|
205
206
|
get observedRecord(): Record<string, any> {
|
206
|
-
return omit(super.observedRecord,
|
207
|
+
return omit(super.observedRecord, ringTypeAttribute);
|
207
208
|
}
|
208
209
|
|
209
210
|
protected render(): TemplateResult<1> {
|