@dile/ui 2.4.2 → 2.5.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/components/floating-menu/floating-menu-item.js +2 -0
- package/components/floating-menu/floating-menu.js +2 -0
- package/components/floating-menu/index.js +2 -0
- package/components/floating-menu/src/DileFloatingMenu.js +167 -0
- package/components/floating-menu/src/DileFloatingMenuItem.js +58 -0
- package/components/tooltip/src/DileTooltip.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import './DileFloatingMenuItem.js';
|
|
3
|
+
|
|
4
|
+
export class DileFloatingMenu extends LitElement {
|
|
5
|
+
static styles = [
|
|
6
|
+
css`
|
|
7
|
+
:host {
|
|
8
|
+
--dile-floating-menu-margin: 1.5rem;
|
|
9
|
+
--dile-floating-menu-margin-bottom: var(--dile-floating-menu-margin-bottom);
|
|
10
|
+
--dile-floating-menu-margin-top: var(--dile-floating-menu-margin-top);
|
|
11
|
+
--dile-floating-menu-margin-left: var(--dile-floating-menu-margin-left);
|
|
12
|
+
--dile-floating-menu-margin-right: var(--dile-floating-menu-margin-right);
|
|
13
|
+
--dile-floating-menu-background-color: navy;
|
|
14
|
+
--dile-floating-menu-background-color-hover: mediumblue;
|
|
15
|
+
--dile-floating-menu-icon-background-color: aliceblue;
|
|
16
|
+
|
|
17
|
+
position: absolute;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
align-items: flex-start;
|
|
22
|
+
gap: 1rem;
|
|
23
|
+
top: var(--dile-floating-menu-margin-top, var(--dile-floating-menu-margin));
|
|
24
|
+
left: var(--dile-floating-menu-margin-left, var(--dile-floating-menu-margin));
|
|
25
|
+
}
|
|
26
|
+
:host([bottom]) {
|
|
27
|
+
bottom: var(--dile-floating-menu-margin-bottom, var(--dile-floating-menu-margin));
|
|
28
|
+
flex-direction: column-reverse;
|
|
29
|
+
top: inherit;
|
|
30
|
+
}
|
|
31
|
+
:host([right]) {
|
|
32
|
+
right: var(--dile-floating-menu-margin-right, var(--dile-floating-menu-margin));
|
|
33
|
+
align-items: flex-end;
|
|
34
|
+
left: inherit;
|
|
35
|
+
}
|
|
36
|
+
:host([left]) {
|
|
37
|
+
left: var(--dile-floating-menu-margin-left, var(--dile-floating-menu-margin));
|
|
38
|
+
right: inherit;
|
|
39
|
+
}
|
|
40
|
+
:host([top]) {
|
|
41
|
+
top: var(--dile-floating-menu-margin-top, var(--dile-floating-menu-margin));
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
bottom: inherit;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:host([opened]) #topline {
|
|
47
|
+
transform: rotate(45deg) translate(2px, 2px);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:host([opened]) #bottomline {
|
|
51
|
+
transform: rotate(-45deg) translate(2px, -2px);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.line {
|
|
55
|
+
background-color: var(--dile-floating-menu-icon-background-color);
|
|
56
|
+
width: 24px;
|
|
57
|
+
height: 2px;
|
|
58
|
+
transition: transform 0.2s ease-in-out;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
button {
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
align-items: center;
|
|
66
|
+
gap: 4px;
|
|
67
|
+
background-color: var(--dile-floating-menu-background-color);
|
|
68
|
+
border-radius: 50%;
|
|
69
|
+
width: 48px;
|
|
70
|
+
height: 48px;
|
|
71
|
+
border: none;
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
transition: background-color 1s, gap 0.5s;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
button:hover {
|
|
77
|
+
background-color: var(--dile-floating-menu-background-color-hover);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@keyframes opacity {
|
|
81
|
+
from {opacity: 0; scale: 90%;}
|
|
82
|
+
to {opacity: 1; scale:100%;}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.opened {
|
|
86
|
+
display: block
|
|
87
|
+
animation: opacity;
|
|
88
|
+
animation-duration: 0.5s;
|
|
89
|
+
background-color: var(--dile-floating-menu-background-color);
|
|
90
|
+
border-radius: 4px;
|
|
91
|
+
padding: 24px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.closed {
|
|
95
|
+
display: none;
|
|
96
|
+
}
|
|
97
|
+
`
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
static properties = {
|
|
101
|
+
|
|
102
|
+
opened: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
reflect: true,
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
top: {
|
|
108
|
+
type: Boolean,
|
|
109
|
+
reflect: true,
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
bottom: {
|
|
113
|
+
type: Boolean,
|
|
114
|
+
reflect: true,
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
right: {
|
|
118
|
+
type: Boolean,
|
|
119
|
+
reflect: true,
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
left: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
reflect: true,
|
|
125
|
+
},
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
constructor() {
|
|
129
|
+
super();
|
|
130
|
+
this.opened = false;
|
|
131
|
+
this.top = false;
|
|
132
|
+
this.left = false;
|
|
133
|
+
this.right = false;
|
|
134
|
+
this.bottom = false;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
render() {
|
|
138
|
+
return html`
|
|
139
|
+
<button @click="${this.toggle}" type="button">
|
|
140
|
+
${this._menuIconTpl}
|
|
141
|
+
</button>
|
|
142
|
+
${this._listTpl}
|
|
143
|
+
`;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
toggle(e) {
|
|
147
|
+
this.opened = !this.opened;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
get _listTpl() {
|
|
151
|
+
return html`
|
|
152
|
+
<div class="${this.opened ? 'opened' : 'closed'}">
|
|
153
|
+
<slot name="content-top"></slot>
|
|
154
|
+
<slot></slot>
|
|
155
|
+
<slot name="content-bottom"></slot>
|
|
156
|
+
</div>
|
|
157
|
+
`;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
get _menuIconTpl() {
|
|
161
|
+
return html`
|
|
162
|
+
<div id="topline" class="line"></div>
|
|
163
|
+
<div id="bottomline" class="line"></div>
|
|
164
|
+
`
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
|
|
3
|
+
export class DileFloatingMenuItem extends LitElement {
|
|
4
|
+
static styles = [
|
|
5
|
+
css`
|
|
6
|
+
:host {
|
|
7
|
+
|
|
8
|
+
--dile-floating-menu-item-color: aliceblue;
|
|
9
|
+
--dile-floating-menu-item-color-hover: lightblue;
|
|
10
|
+
--dile-floating-menu-item-margin: 0.5rem 0;
|
|
11
|
+
|
|
12
|
+
display: block;
|
|
13
|
+
margin: var(--dile-floating-menu-item-margin);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
a {
|
|
17
|
+
text-decoration: none;
|
|
18
|
+
color: var(--dile-floating-menu-item-color);
|
|
19
|
+
margin: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
a:hover {
|
|
23
|
+
color: var(--dile-floating-menu-item-color-hover);
|
|
24
|
+
}
|
|
25
|
+
`
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
static properties = {
|
|
29
|
+
|
|
30
|
+
href: {
|
|
31
|
+
type: String,
|
|
32
|
+
reflect: true,
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
target: {
|
|
36
|
+
type: String,
|
|
37
|
+
reflect: true,
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
constructor() {
|
|
42
|
+
super();
|
|
43
|
+
this.href = '';
|
|
44
|
+
this.target = '';
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
connectedCallback() {
|
|
49
|
+
super.connectedCallback && super.connectedCallback();
|
|
50
|
+
this.setAttribute('role', 'listitem');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
render() {
|
|
54
|
+
return html`
|
|
55
|
+
<a href="${this.href}" target="${this.target}" ><slot></slot></a>
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "UI Core components from dile-components.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "7bd1b40c0ddf11ddb1da8b5109f98a77fe5adb31"
|
|
30
30
|
}
|