@eturnity/eturnity_reusable_components 7.45.3 → 7.45.5-EPDM-11711.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "7.45.3",
3
+ "version": "7.45.5-EPDM-11711.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" fill="#333" viewBox="0 0 29 29"><path d="m10.5 14 4-8 4 8z"/><path class='fix' fill="#ccc" d="m10.5 16 4 8 4-8z"/></svg>
@@ -0,0 +1,6 @@
1
+ <svg fill="#000000" height="800px" width="800px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
2
+ viewBox="0 0 512 512" xml:space="preserve">
3
+ <path d="M256,0C114.617,0,0,114.615,0,256s114.617,256,256,256s256-114.615,256-256S397.383,0,256,0z M224,320
4
+ c0,8.836-7.164,16-16,16h-32c-8.836,0-16-7.164-16-16V192c0-8.836,7.164-16,16-16h32c8.836,0,16,7.164,16,16V320z M352,320
5
+ c0,8.836-7.164,16-16,16h-32c-8.836,0-16-7.164-16-16V192c0-8.836,7.164-16,16-16h32c8.836,0,16,7.164,16,16V320z"/>
6
+ </svg>
@@ -35,6 +35,9 @@ const theme = {
35
35
  tablet: '768px',
36
36
  tabletLarge: '950px',
37
37
  },
38
+ fonts: {
39
+ mainFont: '"Figtree", sans-serif',
40
+ },
38
41
  borderRadius: '4px',
39
42
  }
40
43
 
@@ -0,0 +1,66 @@
1
+ import { mount } from '@vue/test-utils'
2
+ import RCIcon from '@/components/icon'
3
+ import theme from '@/assets/theme'
4
+ import 'jest-styled-components'
5
+ jest.mock('@/components/icon/iconCache.mjs', () => ({
6
+ fetchIcon: jest.fn(() => Promise.resolve('mocked-icon-url.svg')),
7
+ }))
8
+
9
+ describe('RCIcon.vue', () => {
10
+ it('renders icon with default props', async () => {
11
+ const wrapper = mount(RCIcon, {
12
+ props: { name: 'House' },
13
+ global: {
14
+ provide: {
15
+ theme,
16
+ },
17
+ },
18
+ })
19
+
20
+ const iconWrapper = wrapper.find('[data-test-id="icon_wrapper"]')
21
+ const iconImage = wrapper.find('[data-test-id="icon_image"]')
22
+
23
+ expect(iconWrapper.exists()).toBe(true)
24
+ expect(iconImage.exists()).toBe(true)
25
+ expect(wrapper.props('size')).toBe('30px')
26
+ })
27
+
28
+ it('renders striked line when isStriked is true', async () => {
29
+ const wrapper = mount(RCIcon, {
30
+ props: {
31
+ name: 'House',
32
+ isStriked: true,
33
+ color: 'red',
34
+ },
35
+ global: {
36
+ provide: {
37
+ theme,
38
+ },
39
+ },
40
+ })
41
+
42
+ const strikedLine = wrapper.find('[data-test-id="icon_striked_line"]')
43
+ expect(strikedLine.exists()).toBe(true)
44
+ })
45
+
46
+ it('applies correct styling based on props', async () => {
47
+ const wrapper = mount(RCIcon, {
48
+ props: {
49
+ name: 'House',
50
+ size: '60px',
51
+ color: 'red',
52
+ hoveredColor: 'blue',
53
+ backgroundColor: 'yellow',
54
+ },
55
+ global: {
56
+ provide: {
57
+ theme,
58
+ },
59
+ },
60
+ })
61
+
62
+ const iconImage = wrapper.find('[data-test-id="icon_image"]')
63
+ expect(iconImage.exists()).toBe(true)
64
+ // Add assertions for styling if needed
65
+ })
66
+ })
@@ -1,14 +1,24 @@
1
1
  <template>
2
- <Wrapper :cursor="cursor" :disabled="disabled" :size="size">
2
+ <Wrapper
3
+ :cursor="cursor"
4
+ data-test-id="icon_wrapper"
5
+ :disabled="disabled"
6
+ :size="size"
7
+ >
3
8
  <IconImage
4
9
  :animation="animation"
5
10
  :background-color="backgroundColor"
6
11
  :color="color"
12
+ data-test-id="icon_image"
7
13
  :hovered-color="hoveredColor"
8
14
  >
9
- <i v-html="icon.html"></i>
15
+ <i data-test-id="icon_svg" v-html="icon.html"></i>
10
16
  </IconImage>
11
- <StrikedLine v-if="isStriked" :color="color" />
17
+ <StrikedLine
18
+ v-if="isStriked"
19
+ :color="color"
20
+ data-test-id="icon_striked_line"
21
+ />
12
22
  </Wrapper>
13
23
  </template>
14
24
 
@@ -111,10 +121,10 @@
111
121
  props.backgroundColor ? props.backgroundColor : 'transparent'};
112
122
  padding: ${(props) => (props.backgroundColor ? '3px' : '0')};
113
123
  }
114
- svg path {
124
+ svg path:not(.fix) {
115
125
  ${({ theme, color }) => color && `fill: ${theme.colors[color] || color};`}
116
126
  }
117
- &:hover svg path {
127
+ &:hover svg path:not(.fix) {
118
128
  ${({ theme, hoveredColor }) =>
119
129
  hoveredColor && `fill: ${theme.colors[hoveredColor] || hoveredColor};`}
120
130
  }
@@ -19,10 +19,11 @@
19
19
  :align-arrow="alignArrow"
20
20
  :half-computed-text-info-width="halfComputedTextInfoWidth"
21
21
  :icon-size="size"
22
+ :info-position="infoPosition"
22
23
  :max-width="maxWidth"
23
24
  :width="width"
24
25
  ><slot></slot>
25
- <span v-html="text"></span>
26
+ <span v-if="text.length > 0" v-html="text"></span>
26
27
  </TextOverlay>
27
28
  </IconWrapper>
28
29
  </ComponentWrapper>
@@ -45,10 +46,14 @@
45
46
  alignArrow: String,
46
47
  width: String,
47
48
  halfComputedTextInfoWidth: Number,
49
+ infoPosition: String,
48
50
  }
49
51
  const TextOverlay = styled('div', textAttrs)`
50
52
  position: absolute;
51
- top: ${(props) => 'calc(' + props.iconSize + ' + 15px)'};
53
+ ${(props) =>
54
+ props.infoPosition == 'top'
55
+ ? 'bottom : calc(' + props.iconSize + ' + 15px)'
56
+ : 'top : calc(' + props.iconSize + ' + 15px)'};
52
57
  ${(props) =>
53
58
  props.alignArrow === 'left'
54
59
  ? 'left: calc(' + props.iconSize + ' /2 - 18px)'
@@ -64,14 +69,17 @@
64
69
  font-weight: 400;
65
70
  line-height: normal;
66
71
  border-radius: 4px;
67
- z-index: 99;
72
+ z-index: 999;
68
73
  color: ${(props) => props.theme.colors.white};
69
74
 
70
75
  :before {
71
76
  content: '';
72
77
  background-color: ${(props) => props.theme.colors.black};
73
78
  position: absolute;
74
- top: 2px;
79
+
80
+ ${(props) =>
81
+ props.infoPosition == 'top' ? 'bottom : -10px' : 'top: 2px'};
82
+
75
83
  ${(props) =>
76
84
  props.alignArrow === 'left'
77
85
  ? 'left:40px;'
@@ -115,26 +123,37 @@
115
123
  props: {
116
124
  text: {
117
125
  required: false,
126
+ default: '',
127
+ type: String,
118
128
  },
119
129
  size: {
120
130
  required: false,
121
131
  default: '14px',
132
+ type: String,
133
+ },
134
+ infoPosition: {
135
+ required: false,
136
+ default: 'bottom',
137
+ type: String,
122
138
  },
123
139
  alignArrow: {
124
140
  required: false,
125
141
  default: 'center',
142
+ type: String,
126
143
  },
127
144
  openTrigger: {
128
145
  required: false,
129
146
  default: 'onHover', // onHover, onClick
147
+ type: String,
130
148
  },
131
149
  width: {
132
150
  required: false,
133
- default: '200px',
151
+ default: '165px',
152
+ type: String,
134
153
  },
135
154
  maxWidth: {
136
- type: String,
137
155
  default: '400px',
156
+ type: String,
138
157
  },
139
158
  },
140
159
  data() {
@@ -44,6 +44,7 @@
44
44
  :type="inputTypeData"
45
45
  :value="value"
46
46
  @blur="onInputBlur"
47
+ @focus="onInputFocus"
47
48
  @input="onChangeHandler"
48
49
  @keyup.enter="onEnterPress"
49
50
  />
@@ -367,6 +368,9 @@
367
368
  this.validateInput($event.target.value)
368
369
  this.$emit('input-blur', $event.target.value)
369
370
  },
371
+ onInputFocus($event) {
372
+ this.$emit('input-focus', $event.target.value)
373
+ },
370
374
  toggleShowPassword() {
371
375
  this.inputTypeData =
372
376
  this.inputTypeData === 'password' ? 'text' : 'password'
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <ContainerComponent>
3
+ <RoundedTabLeft
4
+ :background-color="backgroundColor"
5
+ :border-radius="borderRadius"
6
+ />
7
+ <TabComponent
8
+ :background-color="backgroundColor"
9
+ :border-radius="borderRadius"
10
+ :height="height"
11
+ :width="width"
12
+ >
13
+ <slot></slot>
14
+ </TabComponent>
15
+ <RoundedTabRight
16
+ :background-color="backgroundColor"
17
+ :border-radius="borderRadius"
18
+ />
19
+ </ContainerComponent>
20
+ </template>
21
+ <script>
22
+ import styled from 'vue3-styled-components'
23
+
24
+ const ContainerComponent = styled.div`
25
+ position: relative;
26
+ display: flex;
27
+ align-items: center;
28
+ justify-content: center;
29
+ `
30
+ const RoundedTabLeft = styled('div', {
31
+ backgroundColor: String,
32
+ borderRadius: String,
33
+ })`
34
+ position:absolute;
35
+ bottom:0;
36
+ left:-${(prop) => prop.borderRadius}
37
+ background-color: ${(prop) => prop.backgroundColor};
38
+ width: ${(prop) => prop.borderRadius};
39
+ height: ${(prop) => prop.borderRadius};
40
+ -webkit-mask-image: radial-gradient(
41
+ circle at top left,
42
+ transparent 71%,
43
+ black 71%
44
+ );
45
+ `
46
+ const RoundedTabRight = styled('div', {
47
+ backgroundColor: String,
48
+ borderRadius: String,
49
+ })`
50
+ position:absolute;
51
+ bottom:0;
52
+ right:-${(prop) => prop.borderRadius}
53
+ background-color: ${(prop) => prop.backgroundColor};
54
+ width: ${(prop) => prop.borderRadius};
55
+ height: ${(prop) => prop.borderRadius};
56
+ -webkit-mask-image: radial-gradient(
57
+ circle at top right,
58
+ transparent 71%,
59
+ black 71%
60
+ );`
61
+ const TabComponent = styled('div', {
62
+ width: String,
63
+ height: String,
64
+ backgroundColor: String,
65
+ borderRadius: String,
66
+ })`
67
+ display: flex;
68
+ align-items: center;
69
+ justify-content: center;
70
+ background-color: ${(prop) => prop.backgroundColor};
71
+ width: ${(prop) => prop.width};
72
+ height: ${(prop) => prop.height};
73
+ border-radius: ${(prop) => prop.borderRadius} ${(prop) => prop.borderRadius}
74
+ 0 0;
75
+ `
76
+ export default {
77
+ name: 'RoundTabs',
78
+ components: {
79
+ ContainerComponent,
80
+ TabComponent,
81
+ RoundedTabLeft,
82
+ RoundedTabRight,
83
+ },
84
+ props: {
85
+ height: {
86
+ required: false,
87
+ default: '40px',
88
+ type: String,
89
+ },
90
+ width: {
91
+ required: false,
92
+ default: '200px',
93
+ type: String,
94
+ },
95
+ backgroundColor: {
96
+ required: false,
97
+ default: 'white',
98
+ type: String,
99
+ },
100
+ borderRadius: {
101
+ required: false,
102
+ default: '20px',
103
+ type: String,
104
+ },
105
+ },
106
+ }
107
+ </script>