@eturnity/eturnity_reusable_components 1.0.30 → 1.0.34
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/package.json
CHANGED
|
@@ -87,7 +87,7 @@ const Container = styled("label", containerAttrs)`
|
|
|
87
87
|
&:after {
|
|
88
88
|
content: "";
|
|
89
89
|
position: absolute;
|
|
90
|
-
display: none;
|
|
90
|
+
display: ${(props) => (props.isChecked ? "block" : "none")};
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
@@ -124,10 +124,6 @@ const InputCheckbox = styled.input`
|
|
|
124
124
|
cursor: pointer;
|
|
125
125
|
height: 0;
|
|
126
126
|
width: 0;
|
|
127
|
-
|
|
128
|
-
&:checked ~ .checkmark:after {
|
|
129
|
-
display: block;
|
|
130
|
-
}
|
|
131
127
|
`
|
|
132
128
|
|
|
133
129
|
export default {
|
|
@@ -5,40 +5,49 @@
|
|
|
5
5
|
<dot-item />
|
|
6
6
|
<dot-item />
|
|
7
7
|
</button-container>
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
:
|
|
12
|
-
|
|
13
|
-
@click="onSelect({ value: item.value, hasChildren: hasChildren(item) })"
|
|
14
|
-
@keyup.enter="
|
|
15
|
-
onSelect({ value: item.value, hasChildren: hasChildren(item) })
|
|
16
|
-
"
|
|
17
|
-
@mouseover="onItemHover(index)"
|
|
8
|
+
<dropdown-container v-if="isOpen">
|
|
9
|
+
<children-container
|
|
10
|
+
class="child"
|
|
11
|
+
:isOpen="hoverItem !== null"
|
|
12
|
+
v-if="hoverItem !== null"
|
|
18
13
|
>
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
<option-child
|
|
15
|
+
v-for="child in childOpen"
|
|
16
|
+
:key="child.value"
|
|
17
|
+
@click.stop="
|
|
18
|
+
onSelect({
|
|
19
|
+
item: child,
|
|
20
|
+
hasChildren: hasChildren(child),
|
|
21
|
+
})
|
|
22
|
+
"
|
|
23
|
+
@keyup.enter.stop="
|
|
24
|
+
onSelect({
|
|
25
|
+
item: child,
|
|
26
|
+
hasChildren: hasChildren(child),
|
|
27
|
+
})
|
|
28
|
+
"
|
|
26
29
|
>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
{{ child.name }}
|
|
31
|
+
</option-child>
|
|
32
|
+
</children-container>
|
|
33
|
+
<options-container>
|
|
34
|
+
<option-item
|
|
35
|
+
v-for="(item, index) in options"
|
|
36
|
+
:key="item.value"
|
|
37
|
+
tabindex="0"
|
|
38
|
+
@click="onSelect({ item: item, hasChildren: hasChildren(item) })"
|
|
39
|
+
@keyup.enter="
|
|
40
|
+
onSelect({ item: item, hasChildren: hasChildren(item) })
|
|
41
|
+
"
|
|
42
|
+
@mouseover="onItemHover({ index, item })"
|
|
43
|
+
>
|
|
44
|
+
<arrow-left :hasChildren="hasChildren(item)" />
|
|
45
|
+
<span>
|
|
46
|
+
{{ item.name }}
|
|
47
|
+
</span>
|
|
48
|
+
</option-item>
|
|
49
|
+
</options-container>
|
|
50
|
+
</dropdown-container>
|
|
42
51
|
</page-container>
|
|
43
52
|
</template>
|
|
44
53
|
|
|
@@ -100,7 +109,6 @@
|
|
|
100
109
|
import styled from "vue-styled-components"
|
|
101
110
|
|
|
102
111
|
const PageContainer = styled.div`
|
|
103
|
-
position: relative;
|
|
104
112
|
display: grid;
|
|
105
113
|
align-items: center;
|
|
106
114
|
`
|
|
@@ -131,10 +139,15 @@ const DotItem = styled.div`
|
|
|
131
139
|
border-radius: 50%;
|
|
132
140
|
`
|
|
133
141
|
|
|
134
|
-
const
|
|
142
|
+
const DropdownContainer = styled.div`
|
|
135
143
|
z-index: 99;
|
|
136
|
-
position:
|
|
137
|
-
right:
|
|
144
|
+
position: absolute;
|
|
145
|
+
right: 20px;
|
|
146
|
+
display: grid;
|
|
147
|
+
grid-template-columns: auto auto;
|
|
148
|
+
`
|
|
149
|
+
|
|
150
|
+
const OptionsContainer = styled.div`
|
|
138
151
|
border: 1px solid ${(props) => props.theme.colors.grey3};
|
|
139
152
|
display: grid;
|
|
140
153
|
grid-template-columns: 1fr;
|
|
@@ -142,9 +155,9 @@ const OptionsContainer = styled.div`
|
|
|
142
155
|
width: max-content;
|
|
143
156
|
border-radius: 4px;
|
|
144
157
|
background-color: #fff;
|
|
145
|
-
margin-top: 8px;
|
|
146
158
|
max-height: 220px;
|
|
147
159
|
overflow: auto;
|
|
160
|
+
height: max-content;
|
|
148
161
|
`
|
|
149
162
|
|
|
150
163
|
const OptionItem = styled.div`
|
|
@@ -190,19 +203,18 @@ const ArrowLeft = styled("span", arrowAttrs)`
|
|
|
190
203
|
visibility: ${(props) => (props.hasChildren ? "visible" : "hidden")};
|
|
191
204
|
`
|
|
192
205
|
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
206
|
+
const childAttrs = { isOpen: Boolean }
|
|
207
|
+
const ChildrenContainer = styled("div", childAttrs)`
|
|
208
|
+
border: ${(props) =>
|
|
209
|
+
props.isOpen ? "1px solid" + props.theme.colors.grey3 : "none"};
|
|
197
210
|
display: grid;
|
|
198
211
|
grid-template-columns: 1fr;
|
|
199
212
|
min-width: 200px;
|
|
200
213
|
width: max-content;
|
|
201
214
|
border-radius: 4px;
|
|
202
215
|
background-color: #fff;
|
|
203
|
-
margin-top: -28px;
|
|
204
216
|
margin-right: -1px;
|
|
205
|
-
|
|
217
|
+
height: max-content;
|
|
206
218
|
overflow: auto;
|
|
207
219
|
`
|
|
208
220
|
|
|
@@ -217,6 +229,7 @@ export default {
|
|
|
217
229
|
ChildrenContainer,
|
|
218
230
|
OptionChild,
|
|
219
231
|
ArrowLeft,
|
|
232
|
+
DropdownContainer,
|
|
220
233
|
},
|
|
221
234
|
props: {
|
|
222
235
|
options: {
|
|
@@ -227,6 +240,7 @@ export default {
|
|
|
227
240
|
return {
|
|
228
241
|
isOpen: false,
|
|
229
242
|
hoverItem: null,
|
|
243
|
+
childOpen: null,
|
|
230
244
|
}
|
|
231
245
|
},
|
|
232
246
|
methods: {
|
|
@@ -242,14 +256,16 @@ export default {
|
|
|
242
256
|
hasChildren(item) {
|
|
243
257
|
return !!item.children && !!item.children.length
|
|
244
258
|
},
|
|
245
|
-
onItemHover(index) {
|
|
246
|
-
this.hoverItem = index
|
|
259
|
+
onItemHover({ index, item }) {
|
|
260
|
+
this.hoverItem = item.children && item.children.length ? index : null
|
|
261
|
+
this.childOpen =
|
|
262
|
+
item.children && item.children.length ? item.children : null
|
|
247
263
|
},
|
|
248
|
-
onSelect({
|
|
264
|
+
onSelect({ item, hasChildren }) {
|
|
249
265
|
if (hasChildren) {
|
|
250
266
|
return
|
|
251
267
|
}
|
|
252
|
-
this.$emit("on-select",
|
|
268
|
+
this.$emit("on-select", item)
|
|
253
269
|
this.isOpen = false
|
|
254
270
|
},
|
|
255
271
|
clickOutside(event) {
|