@eturnity/eturnity_reusable_components 7.35.1-EPDM-10620.1 → 7.35.1-EPDM-10620.3

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": "7.35.1-EPDM-10620.1",
3
+ "version": "7.35.1-EPDM-10620.3",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -9,6 +9,7 @@
9
9
  <ListItem
10
10
  v-for="item in limitedOptions"
11
11
  :key="item.type"
12
+ :disabled="item.disabled || false"
12
13
  :hover-color="item.hoverColor"
13
14
  @click="$emit('on-' + item.type)"
14
15
  >
@@ -16,8 +17,8 @@
16
17
  </ListItem>
17
18
  <ButtonContainer
18
19
  v-if="optionsList.length > optionLimit || hasComponent"
19
- @click="expandOptions"
20
20
  name="more_options,_tool_tips"
21
+ @click="expandOptions"
21
22
  >
22
23
  <DotItem />
23
24
  <DotItem />
@@ -54,23 +55,33 @@
54
55
  <ExpandedListItem
55
56
  v-for="item in limitedOptions"
56
57
  :key="item.type"
58
+ :disabled="item.disabled || false"
57
59
  :hover-color="item.hoverColor"
58
- @click="item?.component ? '' : $emit('on-' + item.type)"
60
+ @click="!item?.component && $emit('on-' + item.type)"
59
61
  >
60
- {{ item.name }}
61
- <IconContainer
62
+ <ListItemWrapper
62
63
  v-if="item?.component"
63
- @click="toggleElement(item.type)"
64
+ @click="!item.disabled && toggleElement(item.type)"
64
65
  >
66
+ <ListItemTitle>
67
+ {{ item.name }}
68
+ <InfoText
69
+ v-if="item.disabled && item.disabledInfo"
70
+ :text="item.disabledInfo"
71
+ />
72
+ </ListItemTitle>
65
73
  <Icon
66
74
  color="white"
67
- cursor="pointer"
75
+ :cursor="item.disabled ? 'not-allowed' : 'pointer'"
68
76
  name="arrow_right"
69
- size="14px"
77
+ size="20px"
70
78
  />
71
- </IconContainer>
79
+ </ListItemWrapper>
80
+ <template v-else>
81
+ {{ item.name }}
82
+ </template>
72
83
  <OptionsContainer v-if="item?.component && item.open">
73
- <slot :name="item.component" />
84
+ <slot :name="item.component"></slot>
74
85
  </OptionsContainer>
75
86
  </ExpandedListItem>
76
87
  </CenterBox>
@@ -113,7 +124,7 @@
113
124
  // </template>
114
125
  // </SelectedOptions>
115
126
  import styled from 'vue3-styled-components'
116
- import MainButton from '../buttons/mainButton'
127
+ import InfoText from '../infoText'
117
128
  import Icon from '../icon'
118
129
 
119
130
  const PageWrapper = styled.div``
@@ -219,25 +230,24 @@
219
230
  `
220
231
 
221
232
  const ListAttrs = {
233
+ disabled: Boolean,
222
234
  hoverColor: String,
223
235
  }
236
+
224
237
  const ListItem = styled('div', ListAttrs)`
225
- cursor: pointer;
238
+ cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
239
+ color: ${(props) => props.disabled && props.theme.colors.grey3};
240
+
226
241
  &:hover {
227
242
  color: ${(props) =>
228
- props.hoverColor
243
+ props.disabled
244
+ ? props.theme.colors.grey3
245
+ : props.hoverColor
229
246
  ? props.theme.colors[props.hoverColor]
230
247
  : props.theme.colors.green};
231
248
  }
232
249
  `
233
250
 
234
- const ExpandedListItem = styled(ListItem)`
235
- display: flex;
236
- width: 100%;
237
- justify-content: space-between;
238
- align-items: center;
239
- `
240
-
241
251
  const IconContainer = styled.div`
242
252
  display: grid;
243
253
  align-items: center;
@@ -253,6 +263,26 @@
253
263
  }
254
264
  `
255
265
 
266
+ const ExpandedListItem = styled(ListItem)`
267
+ display: flex;
268
+ width: 100%;
269
+ justify-content: space-between;
270
+ align-items: center;
271
+ `
272
+
273
+ const ListItemWrapper = styled.div`
274
+ width: 100%;
275
+ display: flex;
276
+ align-items: center;
277
+ justify-content: space-between;
278
+ `
279
+
280
+ const ListItemTitle = styled.div`
281
+ display: flex;
282
+ align-items: center;
283
+ gap: 10px;
284
+ `
285
+
256
286
  const EmptyText = styled.div`
257
287
  color: ${(props) => props.theme.colors.white};
258
288
  font-size: 13px;
@@ -266,13 +296,15 @@
266
296
  BoxContainer,
267
297
  SelectedContainer,
268
298
  ListContainer,
269
- MainButton,
270
299
  ButtonContainer,
271
300
  DotItem,
272
301
  ListItem,
302
+ InfoText,
273
303
  CenterBox,
274
304
  Icon,
275
305
  CenterPageContainer,
306
+ ListItemWrapper,
307
+ ListItemTitle,
276
308
  PageWrapper,
277
309
  OptionsContainer,
278
310
  ExpandedListItem,
@@ -282,12 +314,48 @@
282
314
  BoxTitle,
283
315
  Divider,
284
316
  },
317
+ props: {
318
+ optionsList: {
319
+ type: Array,
320
+ required: true,
321
+ },
322
+ numberSelected: {
323
+ type: Number,
324
+ required: true,
325
+ default: 0,
326
+ },
327
+ },
328
+ data() {
329
+ return {
330
+ //maximum number of options to display, if more than 4, display a 'more' option
331
+ optionLimit: 4,
332
+ showOverlay: false,
333
+ expanded: false,
334
+ limitedOptions: [],
335
+ }
336
+ },
285
337
  computed: {
286
338
  hasComponent() {
287
339
  return this.optionsList.some((item) => item.component)
288
340
  },
289
341
  },
342
+ watch: {
343
+ optionsList() {
344
+ this.initializeOptions()
345
+ },
346
+ },
347
+ mounted() {
348
+ this.initializeOptions()
349
+ },
290
350
  methods: {
351
+ initializeOptions() {
352
+ this.limitedOptions = this.optionsList
353
+ .map((item) => {
354
+ return { ...item, open: false }
355
+ })
356
+ .filter((item) => !item.component)
357
+ .slice(0, this.optionLimit)
358
+ },
291
359
  toggleElement(type) {
292
360
  this.limitedOptions = this.optionsList.map((item) => {
293
361
  if (item.type === type) {
@@ -302,30 +370,5 @@
302
370
  this.limitedOptions = this.optionsList
303
371
  },
304
372
  },
305
- props: {
306
- optionsList: {
307
- required: true,
308
- },
309
- numberSelected: {
310
- required: true,
311
- default: 0,
312
- },
313
- },
314
- mounted() {
315
- this.limitedOptions = this.optionsList
316
- .map((item) => {
317
- return { ...item, open: false }
318
- })
319
- .filter((item) => !item.component)
320
- .slice(0, this.optionLimit)
321
- },
322
- data() {
323
- return {
324
- //maximum number of options to display, if more than 4, display a 'more' option
325
- optionLimit: 4,
326
- expanded: false,
327
- limitedOptions: [],
328
- }
329
- },
330
373
  }
331
374
  </script>