@eturnity/eturnity_reusable_components 1.0.27 → 1.0.28

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -8,6 +8,7 @@
8
8
  <th>Column 2</th>
9
9
  <th>Column 3</th>
10
10
  <th>Column 4</th>
11
+ <div />
11
12
  </tr>
12
13
  </thead>
13
14
  <tbody>
@@ -16,15 +17,12 @@
16
17
  <td class="text">Body 2</td>
17
18
  <td class="text">Body 3</td>
18
19
  <td class="text">Body 4</td>
20
+ <div class="icons-container">
21
+ <three-dots :options="listOptions" />
22
+ </div>
19
23
  </tr>
20
24
  </tbody>
21
25
  </main-table>
22
- <toggle
23
- @on-toggle-change="isChecked = $event"
24
- :isChecked="isChecked"
25
- label="My Label Text"
26
- size="small"
27
- />
28
26
  </page-container>
29
27
  </ThemeProvider>
30
28
  </template>
@@ -34,7 +32,7 @@ import { ThemeProvider } from "vue-styled-components"
34
32
  import theme from "./assets/theme"
35
33
  import styled from "vue-styled-components"
36
34
  import MainTable from "@/components/tables/mainTable"
37
- import Toggle from "@/components/inputs/toggle"
35
+ import ThreeDots from "@/components/threeDots"
38
36
 
39
37
  const PageContainer = styled.div`
40
38
  padding: 40px;
@@ -46,7 +44,7 @@ export default {
46
44
  ThemeProvider,
47
45
  PageContainer,
48
46
  MainTable,
49
- Toggle,
47
+ ThreeDots,
50
48
  },
51
49
  data() {
52
50
  return {
@@ -59,6 +57,38 @@ export default {
59
57
  unit_short_name: "cm",
60
58
  },
61
59
  isChecked: false,
60
+ listOptions: [
61
+ {
62
+ name: "Option 1",
63
+ value: "option_1",
64
+ children: [
65
+ {
66
+ name: "Option 1 Child",
67
+ value: "option_1_child",
68
+ },
69
+ {
70
+ name: "Option 2 Child",
71
+ value: "option_2_child",
72
+ },
73
+ {
74
+ name: "Option 3 Child",
75
+ value: "option_3_child",
76
+ },
77
+ ],
78
+ },
79
+ {
80
+ name: "Option 2",
81
+ value: "option_2",
82
+ },
83
+ {
84
+ name: "Option 3",
85
+ value: "option_3",
86
+ },
87
+ {
88
+ name: "Option 4",
89
+ value: "option_4",
90
+ },
91
+ ],
62
92
  }
63
93
  },
64
94
  methods: {
@@ -6,6 +6,7 @@
6
6
  :isError="isError"
7
7
  :rows="rowHeight"
8
8
  :value="value"
9
+ :disabled="isDisabled"
9
10
  @input="onChangeHandler"
10
11
  />
11
12
  </input-wrapper>
@@ -96,6 +97,10 @@ export default {
96
97
  errorText: {
97
98
  required: false,
98
99
  },
100
+ isDisabled: {
101
+ required: false,
102
+ default: false,
103
+ },
99
104
  },
100
105
  methods: {
101
106
  onChangeHandler($event) {
@@ -154,7 +154,7 @@ const TableContainer = styled.table`
154
154
  }
155
155
 
156
156
  .icons-container {
157
- width: 100%;
157
+ width: auto;
158
158
  display: table-cell;
159
159
  flex-wrap: nowrap;
160
160
  background-color: #fff;
@@ -7,13 +7,22 @@
7
7
  </button-container>
8
8
  <options-container v-if="isOpen">
9
9
  <option-item
10
- v-for="item in options"
10
+ v-for="(item, index) in options"
11
11
  :key="item.value"
12
12
  tabindex="0"
13
13
  @click="onSelect(item.value)"
14
14
  @keyup.enter="onSelect(item.value)"
15
+ @mouseover="onItemHover(index)"
15
16
  >
16
17
  {{ item.name }}
18
+ <children-container
19
+ class="child"
20
+ v-if="item.children && item.children.length && hoverItem === index"
21
+ >
22
+ <option-child v-for="child in item.children" :key="child.value">
23
+ {{ child.name }}
24
+ </option-child>
25
+ </children-container>
17
26
  </option-item>
18
27
  </options-container>
19
28
  </page-container>
@@ -84,9 +93,7 @@ const OptionsContainer = styled.div`
84
93
  z-index: 99;
85
94
  position: fixed;
86
95
  right: 60px;
87
- border: 1px solid
88
- ${(props) =>
89
- props.buttonColor ? props.buttonColor : props.theme.colors.grey3};
96
+ border: 1px solid ${(props) => props.theme.colors.grey3};
90
97
  display: grid;
91
98
  grid-template-columns: 1fr;
92
99
  min-width: 200px;
@@ -102,6 +109,22 @@ const OptionItem = styled.div`
102
109
  padding: 12px;
103
110
  cursor: pointer;
104
111
  font-size: 13px;
112
+ position: relative;
113
+
114
+ &:hover {
115
+ background-color: #ebeef4;
116
+ }
117
+
118
+ &:focus-visible {
119
+ outline: none;
120
+ background-color: #ebeef4;
121
+ }
122
+ `
123
+ const OptionChild = styled.div`
124
+ padding: 12px;
125
+ cursor: pointer;
126
+ font-size: 13px;
127
+ position: relative;
105
128
 
106
129
  &:hover {
107
130
  background-color: #ebeef4;
@@ -113,6 +136,22 @@ const OptionItem = styled.div`
113
136
  }
114
137
  `
115
138
 
139
+ const ChildrenContainer = styled.div`
140
+ position: fixed;
141
+ right: 262px;
142
+ border: 1px solid ${(props) => props.theme.colors.grey3};
143
+ border-right: none;
144
+ display: grid;
145
+ grid-template-columns: 1fr;
146
+ min-width: 200px;
147
+ width: max-content;
148
+ border-radius: 4px;
149
+ background-color: #fff;
150
+ margin-top: 8px;
151
+ max-height: 220px;
152
+ overflow: auto;
153
+ `
154
+
116
155
  export default {
117
156
  name: "three-dots",
118
157
  components: {
@@ -121,6 +160,8 @@ export default {
121
160
  DotItem,
122
161
  OptionsContainer,
123
162
  OptionItem,
163
+ ChildrenContainer,
164
+ OptionChild,
124
165
  },
125
166
  props: {
126
167
  options: {
@@ -130,6 +171,7 @@ export default {
130
171
  data() {
131
172
  return {
132
173
  isOpen: false,
174
+ hoverItem: null,
133
175
  }
134
176
  },
135
177
  methods: {
@@ -142,6 +184,10 @@ export default {
142
184
  document.removeEventListener("click", this.clickOutside)
143
185
  }
144
186
  },
187
+ onItemHover(index) {
188
+ debugger // eslint-disable-line
189
+ this.hoverItem = index
190
+ },
145
191
  onSelect(value) {
146
192
  this.$emit("on-select", value)
147
193
  this.isOpen = false