godown 3.11.2 → 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 +9 -8
- package/build/godown.iife.js.map +1 -0
- package/build/godown.js +7 -7
- package/build/godown.js.map +1 -1
- package/build/godown.umd.js +8 -8
- 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 -4
- 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 +3 -4
- 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 +6 -34
- 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 -33
- package/src/internal/utils.ts +10 -0
- package/src/popover.ts +1 -0
- package/src/web-components/alert/component.ts +5 -4
- package/src/web-components/avatar/component.ts +1 -0
- package/src/web-components/button/component.ts +22 -18
- 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 +28 -17
- package/src/web-components/dialog/component.ts +51 -67
- package/src/web-components/heading/component.ts +0 -1
- package/src/web-components/input/component.ts +38 -30
- package/src/web-components/layout/component.ts +1 -0
- 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/text/component.ts +47 -52
- package/src/web-components/time/component.ts +5 -15
- package/src/web-components/tooltip/component.ts +44 -111
- 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 +3 -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/layout/component.d.ts.map +1 -1
- package/web-components/layout/component.js +1 -1
- package/web-components/layout/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/text/component.d.ts +4 -7
- package/web-components/text/component.d.ts.map +1 -1
- package/web-components/text/component.js +1 -1
- package/web-components/text/component.js.map +1 -1
- package/web-components/time/component.d.ts +2 -2
- package/web-components/time/component.d.ts.map +1 -1
- package/web-components/time/component.js +1 -1
- package/web-components/time/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
@@ -61,6 +61,8 @@ const cssScope = scopePrefix(protoName);
|
|
61
61
|
padding: 0.25em 0.75em;
|
62
62
|
position: relative;
|
63
63
|
user-select: none;
|
64
|
+
display: grid;
|
65
|
+
place-content: center;
|
64
66
|
}
|
65
67
|
|
66
68
|
i {
|
@@ -73,21 +75,7 @@ const cssScope = scopePrefix(protoName);
|
|
73
75
|
visibility: visible;
|
74
76
|
pointer-events: none;
|
75
77
|
transform-origin: 0 0;
|
76
|
-
background:
|
77
|
-
animation-duration: var(${cssScope}--modal-animation-duration);
|
78
|
-
}
|
79
|
-
|
80
|
-
@keyframes kf {
|
81
|
-
0% {
|
82
|
-
transform: scale(0) translate(-50%, -50%);
|
83
|
-
opacity: var(${cssScope}--modal-opacity, 0.1);
|
84
|
-
}
|
85
|
-
80% {
|
86
|
-
transform: scale(1) translate(-50%, -50%);
|
87
|
-
}
|
88
|
-
to {
|
89
|
-
opacity: 0;
|
90
|
-
}
|
78
|
+
background: currentColor;
|
91
79
|
}
|
92
80
|
`,
|
93
81
|
)
|
@@ -133,7 +121,7 @@ class Button extends GlobalStyle {
|
|
133
121
|
part="root"
|
134
122
|
${attr(this.observedRecord)}
|
135
123
|
>
|
136
|
-
${this.content
|
124
|
+
${htmlSlot("", this.content)}
|
137
125
|
<span part="modal-root"></span>
|
138
126
|
</div>
|
139
127
|
`;
|
@@ -154,7 +142,7 @@ class Button extends GlobalStyle {
|
|
154
142
|
|
155
143
|
connectedCallback(): void {
|
156
144
|
super.connectedCallback();
|
157
|
-
this.events.add(this, "click", this._handelClick
|
145
|
+
this.events.add(this, "click", this._handelClick);
|
158
146
|
}
|
159
147
|
|
160
148
|
protected _handelClick(e: MouseEvent): void {
|
@@ -177,8 +165,24 @@ class Button extends GlobalStyle {
|
|
177
165
|
modal.style.width = size;
|
178
166
|
modal.style.left = `${e.x - x}px`;
|
179
167
|
modal.style.top = `${e.y - y}px`;
|
180
|
-
modal.style.animationName = "kf";
|
181
168
|
this._modalRoot.appendChild(modal);
|
169
|
+
const keyframes = [
|
170
|
+
{
|
171
|
+
transform: "scale(0) translate(-50%, -50%)",
|
172
|
+
opacity: 0.1,
|
173
|
+
},
|
174
|
+
{
|
175
|
+
transform: "scale(1) translate(-50%, -50%)",
|
176
|
+
offset: 0.8,
|
177
|
+
},
|
178
|
+
{
|
179
|
+
opacity: 0,
|
180
|
+
},
|
181
|
+
];
|
182
|
+
modal.animate(keyframes, {
|
183
|
+
duration: 800,
|
184
|
+
iterations: 1,
|
185
|
+
});
|
182
186
|
modal.addEventListener("animationend", () => modal.remove(), { once: true });
|
183
187
|
}
|
184
188
|
}
|
@@ -4,7 +4,7 @@ import { property } from "lit/decorators.js";
|
|
4
4
|
|
5
5
|
import { GlobalStyle, cssGlobalVars, scopePrefix } from "../../internal/global-style.js";
|
6
6
|
import type Layout from "../layout/component.js";
|
7
|
-
import { RingBuilder, type RingType } from "../../internal/ring.js";
|
7
|
+
import { RingBuilder, ringTypeAttribute, type RingType } from "../../internal/ring.js";
|
8
8
|
|
9
9
|
const protoName = "card";
|
10
10
|
const cssScope = scopePrefix(protoName);
|
@@ -25,6 +25,7 @@ const cssScope = scopePrefix(protoName);
|
|
25
25
|
:host {
|
26
26
|
${cssScope}--padding: .75em;
|
27
27
|
background: var(${cssGlobalVars.background});
|
28
|
+
color: var(${cssGlobalVars.foreground});
|
28
29
|
display: block;
|
29
30
|
flex-shrink: 0;
|
30
31
|
}
|
@@ -52,7 +53,7 @@ class Card extends GlobalStyle {
|
|
52
53
|
new StyleController(this, () => new RingBuilder({ type: this.ringType }).css);
|
53
54
|
}
|
54
55
|
|
55
|
-
@property({ attribute:
|
56
|
+
@property({ attribute: ringTypeAttribute })
|
56
57
|
ringType: RingType = "border";
|
57
58
|
|
58
59
|
/**
|
@@ -3,7 +3,6 @@ import { type TemplateResult, css, html } from "lit";
|
|
3
3
|
import { property } from "lit/decorators.js";
|
4
4
|
|
5
5
|
import { GlobalStyle, cssGlobalVars, scopePrefix } from "../../internal/global-style.js";
|
6
|
-
import type { DirectionCorner } from "../../internal/direction.js";
|
7
6
|
|
8
7
|
const protoName = "chip";
|
9
8
|
const cssScope = scopePrefix(protoName);
|
@@ -69,10 +68,9 @@ const cssScope = scopePrefix(protoName);
|
|
69
68
|
class Chip extends GlobalStyle {
|
70
69
|
/**
|
71
70
|
* The position of the chip relative to its parent element.
|
72
|
-
* Possible values are `"top-left"`, `"top-right"`, `"bottom-left"`, and `"bottom-right"`.
|
73
71
|
*/
|
74
72
|
@property()
|
75
|
-
position:
|
73
|
+
position: "top-left" | "top-right" | "bottom-left" | "bottom-right" = "top-right";
|
76
74
|
|
77
75
|
@property({ type: Number })
|
78
76
|
value = 0;
|
@@ -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
|
|
@@ -104,8 +96,8 @@ class Details extends SuperOpenable {
|
|
104
96
|
part="title"
|
105
97
|
@click="${() => this.toggle()}"
|
106
98
|
>
|
107
|
-
<span part="summary">${
|
108
|
-
<span part="icon">${svgCaretDown()}</span>
|
99
|
+
<span part="summary">${htmlSlot("summary", this.summary)}</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,25 +28,17 @@ const splitKeysRegexp = /[\s,]+/;
|
|
27
28
|
${cssScope}--opacity-modal: 0.2;
|
28
29
|
width: fit-content;
|
29
30
|
display: block;
|
30
|
-
margin: auto;
|
31
31
|
background: none;
|
32
|
-
left: 50%;
|
33
|
-
top: 50%;
|
34
|
-
position: fixed;
|
35
|
-
transform: translate(-50%, -50%);
|
36
|
-
}
|
37
|
-
|
38
|
-
:host(:not([open])) {
|
39
|
-
visibility: hidden;
|
40
|
-
}
|
41
|
-
|
42
|
-
:host([contents]) dialog {
|
43
|
-
position: fixed;
|
44
32
|
}
|
45
33
|
|
46
34
|
dialog {
|
47
35
|
position: relative;
|
48
|
-
background:
|
36
|
+
background: none;
|
37
|
+
z-index: 1;
|
38
|
+
left: 50%;
|
39
|
+
top: 50%;
|
40
|
+
position: fixed;
|
41
|
+
transform: translate(-50%, -50%);
|
49
42
|
}
|
50
43
|
|
51
44
|
::backdrop {
|
@@ -53,40 +46,34 @@ const splitKeysRegexp = /[\s,]+/;
|
|
53
46
|
opacity: var(${cssScope}--opacity-modal);
|
54
47
|
}
|
55
48
|
`)
|
56
|
-
class Dialog extends
|
57
|
-
/**
|
58
|
-
* Indicates whether the dialog should be displayed as a modal.
|
59
|
-
*/
|
49
|
+
class Dialog extends GlobalStyle {
|
60
50
|
@property({ type: Boolean, reflect: true })
|
61
|
-
|
62
|
-
this.contents = value;
|
63
|
-
}
|
51
|
+
open = false;
|
64
52
|
|
65
|
-
|
66
|
-
|
67
|
-
}
|
68
|
-
|
69
|
-
/**
|
70
|
-
* The keys will close the dialog when pressed.
|
71
|
-
*/
|
72
|
-
@property()
|
73
|
-
key = "Escape";
|
53
|
+
@property({ type: Boolean, reflect: true })
|
54
|
+
modal = false;
|
74
55
|
|
75
56
|
/**
|
76
57
|
* Indicates whether the modal has been invoked.
|
77
58
|
*/
|
78
59
|
private __modalInvoke = false;
|
79
60
|
|
80
|
-
@
|
61
|
+
@queryPart("dialog")
|
81
62
|
protected _dialog: HTMLDialogElement;
|
82
63
|
|
83
64
|
protected render(): TemplateResult<1> {
|
84
65
|
return html`
|
85
|
-
<
|
66
|
+
<div
|
86
67
|
part="root"
|
87
|
-
|
68
|
+
@click=${this.show}
|
88
69
|
>
|
89
|
-
${htmlSlot()}
|
70
|
+
${htmlSlot("trigger")}
|
71
|
+
</div>
|
72
|
+
<dialog
|
73
|
+
part="dialog"
|
74
|
+
role="dialog"
|
75
|
+
>
|
76
|
+
${htmlSlot("dialog")}${htmlSlot()}
|
90
77
|
</dialog>
|
91
78
|
`;
|
92
79
|
}
|
@@ -97,19 +84,16 @@ class Dialog extends SuperOpenable {
|
|
97
84
|
this.show();
|
98
85
|
}
|
99
86
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
this._dialog.close();
|
111
|
-
}
|
112
|
-
}
|
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;
|
113
97
|
}
|
114
98
|
|
115
99
|
private __submitEvent: EventListenerOrEventListenerObject;
|
@@ -118,11 +102,20 @@ class Dialog extends SuperOpenable {
|
|
118
102
|
protected updated(changedProperties: PropertyValues): void {
|
119
103
|
if (changedProperties.has("open")) {
|
120
104
|
if (this.open) {
|
121
|
-
|
122
|
-
|
123
|
-
|
105
|
+
if (this.modal) {
|
106
|
+
this._dialog.showModal();
|
107
|
+
} else {
|
108
|
+
this._dialog.show();
|
124
109
|
}
|
110
|
+
this.__submitEvent = this.events.add(this, "submit", this._handelSubmit);
|
111
|
+
|
112
|
+
this.__keydownEvent = this.events.add(document, "keydown", this._handleKeydown.bind(this));
|
125
113
|
} else {
|
114
|
+
if (this.__modalInvoke) {
|
115
|
+
this.modal = false;
|
116
|
+
this.__modalInvoke = false;
|
117
|
+
}
|
118
|
+
this._dialog.close();
|
126
119
|
this.events.remove(this, "submit", this.__submitEvent);
|
127
120
|
this.events.remove(document, "keydown", this.__keydownEvent);
|
128
121
|
}
|
@@ -130,8 +123,7 @@ class Dialog extends SuperOpenable {
|
|
130
123
|
}
|
131
124
|
|
132
125
|
protected _handleKeydown(e: KeyboardEvent): void {
|
133
|
-
|
134
|
-
if (keys.includes(e.key) || keys.includes(e.code)) {
|
126
|
+
if (e.key === "Escape") {
|
135
127
|
e.preventDefault();
|
136
128
|
this.close();
|
137
129
|
}
|
@@ -143,14 +135,6 @@ class Dialog extends SuperOpenable {
|
|
143
135
|
this.close();
|
144
136
|
}
|
145
137
|
}
|
146
|
-
|
147
|
-
close(): void {
|
148
|
-
if (this.__modalInvoke) {
|
149
|
-
this.modal = false;
|
150
|
-
this.__modalInvoke = false;
|
151
|
-
}
|
152
|
-
this.open = false;
|
153
|
-
}
|
154
138
|
}
|
155
139
|
|
156
140
|
export default Dialog;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { attr, godown, queryPart, styles, StyleController } from "@godown/element";
|
1
|
+
import { attr, godown, queryPart, styles, StyleController, htmlSlot } from "@godown/element";
|
2
2
|
import iconEyeSlash from "../../internal/icons/eye-slash.js";
|
3
3
|
import { type TemplateResult, css, html, nothing } from "lit";
|
4
4
|
import { property } from "lit/decorators.js";
|
@@ -7,6 +7,25 @@ import { cssGlobalVars } from "../../internal/global-style.js";
|
|
7
7
|
import { SuperInput } from "../../internal/super-input.js";
|
8
8
|
import { RingBuilder } from "../../internal/ring.js";
|
9
9
|
|
10
|
+
type InputType =
|
11
|
+
| "text"
|
12
|
+
| "search"
|
13
|
+
| "tel"
|
14
|
+
| "url"
|
15
|
+
| "email"
|
16
|
+
| "password"
|
17
|
+
| "datetime"
|
18
|
+
| "date"
|
19
|
+
| "month"
|
20
|
+
| "week"
|
21
|
+
| "time"
|
22
|
+
| "datetime-local"
|
23
|
+
| "number"
|
24
|
+
| "range"
|
25
|
+
| "color"
|
26
|
+
| "file"
|
27
|
+
| "image";
|
28
|
+
|
10
29
|
const protoName = "input";
|
11
30
|
|
12
31
|
/**
|
@@ -30,7 +49,7 @@ const protoName = "input";
|
|
30
49
|
${cssGlobalVars.input}-icon-color: currentColor;
|
31
50
|
}
|
32
51
|
|
33
|
-
[part
|
52
|
+
[part="root"] {
|
34
53
|
padding: 0.4em 0.5em;
|
35
54
|
display: flex;
|
36
55
|
position: relative;
|
@@ -42,45 +61,28 @@ const protoName = "input";
|
|
42
61
|
width: 100%;
|
43
62
|
height: 100%;
|
44
63
|
flex-grow: 1;
|
45
|
-
color: currentColor;
|
46
|
-
background: none;
|
47
64
|
}
|
48
65
|
|
49
|
-
[part
|
66
|
+
[part="prefix"],
|
67
|
+
[part="suffix"] {
|
68
|
+
height: 100%;
|
50
69
|
display: flex;
|
51
70
|
align-items: center;
|
52
71
|
justify-content: center;
|
53
72
|
color: var(${cssGlobalVars.input}-icon-color);
|
54
73
|
}
|
55
74
|
|
56
|
-
[part
|
57
|
-
|
58
|
-
height: 100%;
|
59
|
-
display: flex;
|
75
|
+
[part="suffix"] slot svg {
|
76
|
+
margin-inline-start: var(${cssGlobalVars.input}-space);
|
60
77
|
}
|
61
78
|
|
62
|
-
[part
|
63
|
-
|
64
|
-
}
|
65
|
-
|
66
|
-
[part~="prefix"][part~="icon"] {
|
67
|
-
padding-inline-end: var(${cssGlobalVars.input}-space);
|
79
|
+
[part="prefix"] slot svg {
|
80
|
+
margin-inline-end: var(${cssGlobalVars.input}-space);
|
68
81
|
}
|
69
82
|
`)
|
70
83
|
class Input extends SuperInput {
|
71
|
-
|
72
|
-
|
73
|
-
| "search"
|
74
|
-
| "tel"
|
75
|
-
| "url"
|
76
|
-
| "email"
|
77
|
-
| "password"
|
78
|
-
| "number"
|
79
|
-
| "date"
|
80
|
-
| "time"
|
81
|
-
| "datetime-local"
|
82
|
-
| "month"
|
83
|
-
| "week" = "text";
|
84
|
+
@property({ reflect: true })
|
85
|
+
type: InputType = "text";
|
84
86
|
|
85
87
|
value: string;
|
86
88
|
|
@@ -136,17 +138,23 @@ class Input extends SuperInput {
|
|
136
138
|
if (this.type === PASSWORD) {
|
137
139
|
return html`
|
138
140
|
<i
|
139
|
-
part="suffix
|
141
|
+
part="suffix"
|
140
142
|
@mousedown="${() => this._changeInputType("text")}"
|
141
143
|
@mouseup="${() => this._changeInputType(PASSWORD)}"
|
142
144
|
@mouseleave="${() => this._changeInputType(PASSWORD)}"
|
143
145
|
>
|
144
|
-
${iconEyeSlash()}
|
146
|
+
${htmlSlot("suffix", iconEyeSlash())}
|
145
147
|
</i>
|
146
148
|
`;
|
147
149
|
}
|
148
150
|
return super._renderSuffix();
|
149
151
|
}
|
152
|
+
|
153
|
+
protected _changeInputType(t: typeof this.type): void {
|
154
|
+
if (this._input) {
|
155
|
+
this._input.type = t;
|
156
|
+
}
|
157
|
+
}
|
150
158
|
}
|
151
159
|
|
152
160
|
export default Input;
|
@@ -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
|
`)
|