@eturnity/eturnity_reusable_components 8.34.0-EPDM-13618.2 → 8.34.0-EPDM-16204.1

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.
@@ -15,7 +15,7 @@
15
15
  :variant="variant"
16
16
  :width="width"
17
17
  >
18
- <LabelComponent :has-icon="Boolean(icon)" :reverse-direction="iconLast">
18
+ <LabelComponent :has-icon="Boolean(icon)">
19
19
  <Icon
20
20
  v-if="icon"
21
21
  :color="getIconColor"
@@ -146,13 +146,10 @@
146
146
 
147
147
  const LabelAttrs = {
148
148
  hasIcon: Boolean,
149
- reverseDirection: Boolean,
150
149
  }
151
150
 
152
151
  const LabelComponent = styled('span', LabelAttrs)`
153
152
  display: flex;
154
- flex-direction: ${(props) =>
155
- props.reverseDirection ? 'row-reverse' : 'row'};
156
153
  align-items: center;
157
154
  justify-content: center;
158
155
  gap: ${(props) => (props.hasIcon ? '5px' : '0')};
@@ -215,11 +212,6 @@
215
212
  default: '',
216
213
  type: String,
217
214
  },
218
- iconLast: {
219
- required: false,
220
- default: false,
221
- type: Boolean,
222
- },
223
215
  iconAltStyle: {
224
216
  required: false,
225
217
  default: false,
@@ -1,125 +1,53 @@
1
- import defaultDropdownProps from './defaultProps'
2
1
  import Dropdown from './index.vue'
3
- import theme from '@/assets/theme'
4
2
 
5
3
  export default {
6
4
  title: 'Dropdown',
7
5
  component: Dropdown,
8
- tags: ['autodocs'],
9
- argTypes: {
10
- width: {
11
- description: '',
12
- },
13
- gap: {
14
- description: 'Gap between trigger and dropdown content',
15
- },
16
- justify: {
17
- description:
18
- 'Rule to allign the dropdown content relatively to the trigger',
19
- control: 'select',
20
- options: ['right', 'left'],
21
- },
22
- openingMode: {
23
- description:
24
- 'Way to open the dropdown content: eigther by clicking on trigger or hovering it',
25
- control: 'select',
26
- options: ['hover', 'click'],
27
- },
28
- backgroundColor: {
29
- description: 'Backbround color of dropdown content',
30
- control: {
31
- type: 'color',
32
- presetColors: [
33
- theme.colors.white,
34
- theme.colors.grey3,
35
- theme.colors.grey4,
36
- theme.colors.red,
37
- ],
38
- },
39
- },
40
-
41
- // slots
42
- trigger: {
43
- description: 'Trigger button slot',
44
- },
45
- dropdown: {
46
- description: 'Dropdown content slot',
47
- },
48
- },
49
- }
50
-
51
- // To use:
52
- // import Dropdown from '@eturnity/eturnity_reusable_components/src/components/dropdown'
53
- // <Dropdown
54
- // width="fit-content"
55
- // gap="20px"
56
- // justify="right"
57
- // opening-mode="click"
58
- // background-color="red"
59
- // >
60
- // <template #trigger>
61
- // TRIGGER BUTTON
62
- // </template>
63
- // <template #dropdown>
64
- // <div>
65
- // <div>OPTION 1</div>
66
- // <div>OPTION 2</div>
67
- // </div>
68
- // </template>
69
- // <Dropdown/>
70
-
71
- const Template = (args) => {
72
- return {
73
- components: { Dropdown },
74
- setup() {
75
- return { args }
76
- },
77
- template: `
78
- <div style="margin-left: 30px;">
79
- <Dropdown v-bind="args">
80
- <template #trigger>
81
- {{ args.trigger }}
82
- </template>
83
- <template #dropdown>
84
- <div v-html="args.dropdown"></div>
85
- </template>
86
- </Dropdown>
6
+ // argTypes: {},
7
+ }
8
+
9
+ const Template = (args, { argTypes }) => ({
10
+ // Components used in your story `template` are defined in the `components` object
11
+ components: { Dropdown },
12
+ // The story's `args` need to be mapped into the template through the `setup()` method
13
+ props: Object.keys(argTypes),
14
+ template: `<Dropdown v-bind="$props">
15
+ <template #trigger>
16
+ trigger button
17
+ </template>
18
+ <template #dropdown>
19
+ <div>
20
+ <h3>fully customizable dropdown</h3>
21
+ <ul>
22
+ <li>item</li>
23
+ <li>item</li>
24
+ <li>item</li>
25
+ </ul>
87
26
  </div>
88
- `,
89
- }
90
- }
27
+ </template>
28
+ </Dropdown>`,
29
+ // import Icon from "@eturnity/eturnity_reusable_components/src/components/icon"
30
+ // How to use:
31
+ //<icon
32
+ // name="House" //required. a svg file named [name].svg should be present in /assets/svgIcons
33
+ // color="red"
34
+ // hoveredColor="blue"
35
+ // size="60px" by default, this is 30px
36
+ // />
37
+ })
91
38
 
92
39
  export const Default = Template.bind({})
93
40
  Default.args = {
94
- ...defaultDropdownProps,
95
- }
96
-
97
- export const DropdownWidth = Template.bind({})
98
- DropdownWidth.args = {
99
- ...defaultDropdownProps,
100
- width: 'max-content',
101
- }
102
-
103
- export const DropdownGap = Template.bind({})
104
- DropdownGap.args = {
105
- ...defaultDropdownProps,
41
+ openingMode: 'click',
106
42
  gap: '0px',
43
+ justify: 'left',
44
+ width: '150px',
107
45
  }
108
46
 
109
- export const DropdownJustifyRight = Template.bind({})
110
- DropdownJustifyRight.args = {
111
- ...defaultDropdownProps,
47
+ export const withHover = Template.bind({})
48
+ withHover.args = {
49
+ openingMode: 'hover',
50
+ gap: '20px',
112
51
  justify: 'right',
113
- }
114
-
115
- export const DropdownOpeningModeClick = Template.bind({})
116
- DropdownOpeningModeClick.args = {
117
- ...defaultDropdownProps,
118
- openingMode: 'click',
119
- }
120
-
121
- export const DropdownBackgroundColor = Template.bind({})
122
- DropdownBackgroundColor.args = {
123
- ...defaultDropdownProps,
124
- backgroundColor: theme.colors.red,
52
+ width: '250px',
125
53
  }
@@ -1,26 +1,18 @@
1
1
  <template>
2
- <Wrapper
3
- data-test-id="dropdown_wrapper"
4
- ref="dropdown"
5
- :opening-mode="openingMode"
6
- >
7
- <WrapperButton
8
- data-test-id="dropdown_trigger"
9
- @click="toggleIsOpenByClick(!isOpenByClick)"
10
- >
2
+ <Wrapper ref="dropdown" :opening-mode="openingMode">
3
+ <WrapperButton @click="isOpenByClick = !isOpenByClick">
11
4
  <slot name="trigger"></slot>
12
5
  </WrapperButton>
13
6
  <WrapperDropdown
14
7
  :background-color="backgroundColor"
15
8
  class="dropdown-content"
16
- :class="{ openDropdown: isOpenByClick && openingMode === 'click' }"
17
- data-test-id="dropdown_dropdown_wrapper"
9
+ :class="{ openDropdown: isOpenByClick && openingMode == 'click' }"
18
10
  :justify="justify"
11
+ :position="position"
19
12
  :width="width"
20
13
  >
21
14
  <DropdownWindow
22
15
  :background-color="backgroundColor"
23
- data-test-id="dropdown_dropdown_content"
24
16
  :gap="gap"
25
17
  :width="width"
26
18
  >
@@ -31,6 +23,14 @@
31
23
  </template>
32
24
 
33
25
  <script>
26
+ // import Icon from "@eturnity/eturnity_reusable_components/src/components/icon"
27
+ // How to use:
28
+ //<DropdownComponent
29
+ // width="300px"
30
+ // backgroundColor="red">
31
+
32
+ // <DropdownComponent/>
33
+
34
34
  import styled from 'vue3-styled-components'
35
35
 
36
36
  const wrapperAttrs = {
@@ -45,11 +45,11 @@
45
45
  position: relative;
46
46
 
47
47
  &:hover .dropdown-content {
48
- ${(props) => (props.openingMode === 'hover' ? 'display: block;' : '')}
48
+ ${(props) => (props.openingMode == 'hover' ? 'display:block' : '')}
49
49
  }
50
50
  & .openDropdown {
51
51
  ${(props) =>
52
- props.openingMode === 'click' ? 'display: block !important;' : ''}
52
+ props.openingMode == 'click' ? 'display:block !important' : ''}
53
53
  }
54
54
  `
55
55
  const WrapperDropdown = styled('div', wrapperAttrs)`
@@ -57,7 +57,7 @@
57
57
  display: none;
58
58
  position: absolute;
59
59
  z-index: 1;
60
- ${(props) => (props.justify === 'right' ? 'right: 0;' : '')}
60
+ ${(props) => (props.justify == 'right' ? 'right:0;' : '')}
61
61
  `
62
62
  const DropdownWindow = styled('div', wrapperAttrs)`
63
63
  width: ${(props) => props.width};
@@ -86,27 +86,26 @@
86
86
  props: {
87
87
  width: {
88
88
  required: false,
89
- type: String,
90
89
  default: '300px',
91
90
  },
92
91
  gap: {
93
92
  required: false,
94
- type: String,
95
93
  default: '10px',
96
94
  },
95
+ position: {
96
+ required: false,
97
+ default: 'bottom',
98
+ },
97
99
  justify: {
98
100
  required: false,
99
- type: String,
100
101
  default: 'left',
101
102
  },
102
103
  openingMode: {
103
104
  required: false,
104
- type: String,
105
105
  default: 'hover',
106
106
  },
107
107
  backgroundColor: {
108
108
  required: false,
109
- type: String,
110
109
  default: 'white',
111
110
  },
112
111
  },
@@ -122,26 +121,18 @@
122
121
  document.removeEventListener('click', this.clickOutside)
123
122
  },
124
123
  methods: {
125
- toggleIsOpenByClick(value) {
126
- this.isOpenByClick = value
127
- },
128
124
  clickOutside(event) {
129
125
  if (this.openingMode != 'click') return
130
126
  if (
131
127
  this.$refs.dropdown &&
132
- (this.$refs.dropdown.$el === event.target ||
128
+ (this.$refs.dropdown.$el == event.target ||
133
129
  this.$refs.dropdown.$el.contains(event.target))
134
130
  ) {
135
131
  return
136
132
  } else {
137
- this.toggleIsOpenByClick(false)
133
+ this.isOpenByClick = false
138
134
  }
139
135
  },
140
136
  },
141
- watch: {
142
- isOpenByClick(newVal) {
143
- this.$emit('on-dropdown-toggle', newVal)
144
- },
145
- },
146
137
  }
147
138
  </script>
@@ -1,26 +1,36 @@
1
1
  <template>
2
2
  <Container>
3
3
  <ProgressContainer
4
- :app-theme="appTheme"
5
- data-test-id="progress_bar_container"
4
+ :background-color="backgroundColor"
5
+ class="progress-container"
6
+ :max-width="maxWidth"
7
+ :min-width="minWidth"
6
8
  >
7
9
  <ProgressFill
8
- :app-theme="appTheme"
9
- data-test-id="progress_bar_progress"
10
+ class="progress-bar"
11
+ :fill-color="fillColor"
10
12
  :fill-progress="fillProgress"
11
13
  />
12
14
  </ProgressContainer>
13
- <LabelText
14
- v-if="labelText"
15
- :app-theme="appTheme"
16
- data-test-id="progress_bar_label"
17
- >
18
- {{ labelText }}
15
+ <LabelText v-if="stepNumber || labelText" class="progress-text">
16
+ {{ labelText ? labelText : '' }}
17
+ {{ stepNumber ? stepNumber : '' }}
19
18
  </LabelText>
20
19
  </Container>
21
20
  </template>
22
21
 
23
22
  <script>
23
+ // import ProgressBar from "@eturnity/eturnity_reusable_components/src/components/progressBar"
24
+ //To Use:
25
+ // <progress-bar
26
+ // fillColor="#000"
27
+ // backgroundColor="#888"
28
+ // minWidth="150px"
29
+ // maxWidth="100%"
30
+ // :fillProgress="50" //should be a number for percent
31
+ // stepNumber="4"
32
+ // :labelText="translate('step')"
33
+ // />
24
34
  import styled from 'vue3-styled-components'
25
35
 
26
36
  const Container = styled.div`
@@ -34,34 +44,34 @@
34
44
  `
35
45
 
36
46
  const containerProps = {
37
- appTheme: String,
47
+ backgroundColor: String,
48
+ maxWidth: String,
49
+ minWidth: String,
38
50
  }
39
51
  const ProgressContainer = styled('div', containerProps)`
40
52
  width: 100%;
53
+ min-width: ${(props) => (props.minWidth ? props.minWidth : 'auto')};
54
+ max-width: ${(props) => (props.maxWidth ? props.maxWidth : 'none')};
41
55
  height: 6px;
42
56
  background-color: ${(props) =>
43
- props.theme.progressBar[props.appTheme].backgroundColor};
57
+ props.backgroundColor
58
+ ? props.backgroundColor
59
+ : props.theme.colors.lightGray};
44
60
  @media (max-width: ${(props) => props.theme.screen.mobile}) {
45
61
  height: 4px;
46
62
  }
47
63
  `
48
64
 
49
- const fillProps = {
50
- appTheme: String,
51
- fillProgress: String | Number,
52
- }
65
+ const fillProps = { fillColor: String, fillProgress: String | Number }
53
66
  const ProgressFill = styled('div', fillProps)`
54
67
  height: 100%;
55
68
  width: ${(props) => props.fillProgress + '%'};
56
69
  background-color: ${(props) =>
57
- props.theme.progressBar[props.appTheme].fillColor};
70
+ props.fillColor ? props.fillColor : props.theme.colors.secondary};
58
71
  `
59
72
 
60
- const labelTextProps = {
61
- appTheme: String,
62
- }
63
- const LabelText = styled('div', labelTextProps)`
64
- color: ${(props) => props.theme.progressBar[props.appTheme].labelColor};
73
+ const LabelText = styled.div`
74
+ color: ${(props) => props.theme.colors.darkGray};
65
75
  font-size: 16px;
66
76
 
67
77
  @media (max-width: ${(props) => props.theme.screen.tablet}) {
@@ -78,19 +88,37 @@
78
88
  LabelText,
79
89
  },
80
90
  props: {
91
+ fillColor: {
92
+ required: false,
93
+ type: String,
94
+ default: null,
95
+ },
96
+ backgroundColor: {
97
+ required: false,
98
+ type: String,
99
+ default: null,
100
+ },
101
+ minWidth: {
102
+ required: false,
103
+ type: String,
104
+ default: null,
105
+ },
106
+ maxWidth: {
107
+ required: false,
108
+ type: String,
109
+ default: null,
110
+ },
81
111
  fillProgress: {
82
112
  required: false,
83
- type: [String, Number],
84
113
  default: 0,
85
114
  },
86
115
  labelText: {
87
116
  required: false,
88
- type: String,
89
- default: '',
117
+ default: null,
90
118
  },
91
- appTheme: {
92
- type: String,
93
- default: 'light',
119
+ stepNumber: {
120
+ required: false,
121
+ default: null,
94
122
  },
95
123
  },
96
124
  }
@@ -8,6 +8,9 @@
8
8
  <ListItem
9
9
  v-if="!item.children"
10
10
  :key="idx"
11
+ :data-active="
12
+ (activeTab === item.key || activeParentTab === item.key).toString()
13
+ "
11
14
  :data-id="`sub_menu_settings_${item.key}`"
12
15
  :fill-type="item.icon === 'free_technology' ? 'stroke' : 'fill'"
13
16
  :is-active="activeTab === item.key || activeParentTab === item.key"
@@ -30,6 +33,7 @@
30
33
  </ListItem>
31
34
  <CollapseWrapper v-else :key="idx + item.key">
32
35
  <CollapseContainer
36
+ :data-active="activeParentTab === item.key"
33
37
  :data-id="`sub_menu_settings_${item.key}`"
34
38
  :is-active="activeParentTab === item.key"
35
39
  @click="toggleActiveDropdown(item.key)"
@@ -51,7 +55,11 @@
51
55
  }}</ListText>
52
56
  <ArrowContainer>
53
57
  <Icon
54
- :color="theme.semanticColors.grey[800]"
58
+ :color="
59
+ activeParentTab === item.key
60
+ ? theme.semanticColors.purple[500]
61
+ : theme.semanticColors.teal[800]
62
+ "
55
63
  :name="
56
64
  activeDropdown === item.key
57
65
  ? 'arrow_up_unfilled'
@@ -65,6 +73,7 @@
65
73
  <SubRouter
66
74
  v-for="subItem in item.children"
67
75
  :key="subItem.key"
76
+ :data-active="activeTab === subItem.key"
68
77
  :data-id="`sub_menu_settings_${subItem.key}`"
69
78
  :is-active="activeTab === subItem.key"
70
79
  @click="
@@ -81,19 +90,14 @@
81
90
  </template>
82
91
  </ListContainer>
83
92
  <BottomSection v-if="hasLogout">
84
- <IconContainer
93
+ <ButtonIcon
85
94
  data-id="button_settings_logout"
86
- :is-active="false"
87
- :is-button="true"
95
+ icon-name="logout"
96
+ text="Logout"
97
+ type="ghost"
98
+ variant="tertiary"
88
99
  @click="$emit('on-logout')"
89
- >
90
- <RotateIcon
91
- :color="theme.semanticColors.teal[800]"
92
- cursor="pointer"
93
- name="initial_situation"
94
- size="18px"
95
- />
96
- </IconContainer>
100
+ />
97
101
  <AppVersion>{{ appVersion }}</AppVersion>
98
102
  </BottomSection>
99
103
  </PageContainer>
@@ -104,6 +108,7 @@
104
108
  import Icon from '../icon'
105
109
  import Spinner from '../spinner'
106
110
  import theme from '@/assets/theme.js'
111
+ import ButtonIcon from '../buttons/buttonIcon'
107
112
 
108
113
  const PageAttrs = { isLoading: Boolean }
109
114
  const PageContainer = styled('div', PageAttrs)`
@@ -131,13 +136,13 @@
131
136
  padding: 4px;
132
137
  border-radius: 4px;
133
138
  background-color: ${(props) =>
134
- props.isActive ? props.theme.semanticColors.purple[50] : ''};
139
+ props.isActive ? props.theme.semanticColors.purple[100] : ''};
135
140
  color: ${(props) =>
136
141
  props.isActive
137
142
  ? props.theme.semanticColors.purple[500]
138
143
  : props.theme.semanticColors.teal[800]};
139
144
 
140
- :hover {
145
+ &:hover:not([data-active='true']) {
141
146
  background-color: ${(props) => props.theme.semanticColors.purple[100]};
142
147
  color: ${(props) => props.theme.semanticColors.purple[500]};
143
148
  svg path:not(.fix) {
@@ -166,8 +171,7 @@
166
171
  `
167
172
  cursor: pointer;
168
173
  &:hover {
169
- background-color: ${(props) =>
170
- props.theme.semanticColors.purple[100]};
174
+ background-color: ${(props) => props.theme.semanticColors.purple[50]};
171
175
  `}
172
176
  `
173
177
 
@@ -209,10 +213,10 @@
209
213
  font-weight: 400;
210
214
  font-size: 14px;
211
215
  background: ${(props) =>
212
- props.isActive ? props.theme.semanticColors.purple[50] : ''};
216
+ props.isActive ? props.theme.semanticColors.purple[100] : ''};
213
217
 
214
- &:hover {
215
- background: ${(props) => props.theme.semanticColors.purple[100]};
218
+ &:hover:not([data-active='true']) {
219
+ background: ${(props) => props.theme.semanticColors.purple[50]};
216
220
  color: ${(props) => props.theme.semanticColors.purple[500]} !important;
217
221
  }
218
222
  `
@@ -228,15 +232,15 @@
228
232
  align-items: center;
229
233
  cursor: pointer;
230
234
  background: ${(props) =>
231
- props.isActive ? props.theme.semanticColors.purple[50] : ''};
235
+ props.isActive ? props.theme.semanticColors.purple[100] : ''};
232
236
 
233
237
  div {
234
238
  color: ${(props) =>
235
239
  props.isActive ? props.theme.semanticColors.purple[500] : ''};
236
240
  }
237
241
 
238
- &:hover {
239
- background: ${(props) => props.theme.semanticColors.purple[100]};
242
+ &:hover:not([data-active='true']) {
243
+ background: ${(props) => props.theme.semanticColors.purple[50]};
240
244
  color: ${(props) => props.theme.semanticColors.purple[500]};
241
245
  svg path:not(.fix) {
242
246
  fill: ${(props) => props.theme.semanticColors.purple[500]};
@@ -268,12 +272,12 @@
268
272
  Spinner,
269
273
  SpinnerContainer,
270
274
  BottomSection,
271
- RotateIcon,
272
275
  AppVersion,
273
276
  CollapseWrapper,
274
277
  CollapseContainer,
275
278
  SubRouter,
276
279
  ArrowContainer,
280
+ ButtonIcon,
277
281
  },
278
282
  props: {
279
283
  tabsData: {
@@ -251,8 +251,7 @@
251
251
  visibility: hidden;
252
252
  }
253
253
 
254
- &.footer,
255
- &.total-row {
254
+ &.footer {
256
255
  td {
257
256
  background-color: ${(props) => props.theme.colors.grey5};
258
257
  }
@@ -1,7 +0,0 @@
1
- const defaultProps = {
2
- // info card content slot
3
- trigger: 'TRIGGER BUTTON',
4
- dropdown: `<div>DROPDOWN OPTION 1</div><div>DROPDOWN OPTION 2</div>`,
5
- }
6
-
7
- export default defaultProps
@@ -1,55 +0,0 @@
1
- import { mount } from '@vue/test-utils'
2
- import RCDropdown from '@/components/dropdown'
3
- import defaultProps from './defaultProps'
4
- import theme from '@/assets/theme'
5
-
6
- jest.mock('@/components/icon/iconCache.mjs', () => ({
7
- // need to mock this due to how jest handles import.meta
8
- fetchIcon: jest.fn(() => Promise.resolve('mocked-icon-url.svg')),
9
- }))
10
-
11
- describe('dropdown/index.vue', () => {
12
- it('dropdown is rendered with correct trigger text', async () => {
13
- const wrapper = mount(RCDropdown, {
14
- props: { ...defaultProps },
15
- slots: { ...defaultProps },
16
- global: {
17
- provide: {
18
- theme,
19
- },
20
- },
21
- })
22
-
23
- const dropdownTrigger = wrapper.find('[data-test-id="dropdown_trigger"]')
24
-
25
- expect(dropdownTrigger.exists()).toBe(true)
26
- expect(dropdownTrigger.text()).toContain(defaultProps.trigger)
27
- })
28
-
29
- it('dropdown opens on click only', async () => {
30
- const wrapper = mount(RCDropdown, {
31
- props: { ...defaultProps, openingMode: 'click' },
32
- slots: { ...defaultProps },
33
- global: {
34
- provide: {
35
- theme,
36
- },
37
- },
38
- })
39
-
40
- const dropdownTrigger = wrapper.find('[data-test-id="dropdown_trigger"]')
41
- const dropdownDropdownWrapper = wrapper.find(
42
- '[data-test-id="dropdown_dropdown_wrapper"]'
43
- )
44
-
45
- expect(dropdownDropdownWrapper.classes('openDropdown')).toBe(false)
46
-
47
- await dropdownTrigger.trigger('hover')
48
-
49
- expect(dropdownDropdownWrapper.classes('openDropdown')).toBe(false)
50
-
51
- await dropdownTrigger.trigger('click')
52
-
53
- expect(dropdownDropdownWrapper.classes('openDropdown')).toBe(true)
54
- })
55
- })