@eturnity/eturnity_reusable_components 7.45.5 → 7.48.1-EPDM-12680.0
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 +1 -1
- package/src/assets/svgIcons/collapse_all.svg +4 -0
- package/src/assets/svgIcons/hybrid.svg +4 -0
- package/src/assets/svgIcons/module.svg +3 -0
- package/src/assets/svgIcons/optimizer.svg +6 -0
- package/src/assets/svgIcons/string_design.svg +5 -0
- package/src/components/buttons/buttonIcon/index.vue +3 -1
- package/src/components/icon/index.vue +1 -0
- package/src/components/inputs/inputNumber/index.vue +170 -8
- package/src/components/inputs/inputText/InputText.stories.js +55 -60
- package/src/components/inputs/inputText/index.vue +68 -10
- package/src/components/inputs/inputText/inputText.spec.js +588 -0
- package/src/components/inputs/radioButton/index.vue +1 -0
- package/src/components/inputs/searchInput/SearchInput.stories.js +51 -24
- package/src/components/inputs/searchInput/defaultProps.js +12 -0
- package/src/components/inputs/searchInput/index.vue +15 -7
- package/src/components/inputs/searchInput/searchInput.spec.js +65 -0
- package/src/components/inputs/select/index.vue +57 -17
- package/src/components/inputs/select/option/index.vue +11 -2
- package/src/components/spinner/index.vue +11 -0
- package/src/components/stringDesign/DropdownMenu/index.vue +533 -0
@@ -22,15 +22,16 @@
|
|
22
22
|
// import SearchInput from "@eturnity/eturnity_reusable_components/src/components/inputs/searchInput"
|
23
23
|
// To use:
|
24
24
|
// <search-input
|
25
|
-
//
|
26
|
-
// :value="companyName"
|
25
|
+
// data-id='search_input_id'
|
27
26
|
// :disabled="true"
|
28
|
-
//
|
27
|
+
// :has-focus="true"
|
28
|
+
// icon-color="grey2" // colors only from theme
|
29
|
+
// icon-position="left"
|
30
|
+
// input-width="250px"
|
31
|
+
// :is-filter="true" // to set the height at 30px
|
32
|
+
// placeholder="Search by company name"
|
33
|
+
// :value="companyName"
|
29
34
|
// @on-change="function($event)"
|
30
|
-
// :isFilter="true" // to set the height at 30px
|
31
|
-
// data-id="test-data-id"
|
32
|
-
// iconPosition="left"
|
33
|
-
// iconColor="grey2"
|
34
35
|
// />
|
35
36
|
import styled from 'vue3-styled-components'
|
36
37
|
import SearchIconSvg from '../../../assets/icons/search_icon_black.svg'
|
@@ -94,31 +95,38 @@
|
|
94
95
|
},
|
95
96
|
props: {
|
96
97
|
value: {
|
98
|
+
type: [String, Number],
|
97
99
|
required: true,
|
98
100
|
},
|
99
101
|
disabled: {
|
100
102
|
required: false,
|
101
103
|
default: false,
|
104
|
+
type: Boolean,
|
102
105
|
},
|
103
106
|
placeholder: {
|
104
107
|
required: false,
|
105
108
|
default: '',
|
109
|
+
type: String,
|
106
110
|
},
|
107
111
|
inputWidth: {
|
108
112
|
required: false,
|
109
113
|
default: null,
|
114
|
+
type: String,
|
110
115
|
},
|
111
116
|
isFilter: {
|
112
117
|
required: false,
|
113
118
|
default: false,
|
119
|
+
type: Boolean,
|
114
120
|
},
|
115
121
|
hasFocus: {
|
116
122
|
required: false,
|
117
123
|
default: false,
|
124
|
+
type: Boolean,
|
118
125
|
},
|
119
126
|
dataId: {
|
120
127
|
required: false,
|
121
128
|
default: '',
|
129
|
+
type: [String, Number],
|
122
130
|
},
|
123
131
|
iconPosition: {
|
124
132
|
type: String,
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
2
|
+
import SearchInput from '@/components/inputs/searchInput'
|
3
|
+
import defaultSearchInputProps from './defaultProps'
|
4
|
+
import theme from '@/assets/theme'
|
5
|
+
|
6
|
+
describe('SearchInput.vue', () => {
|
7
|
+
let searchInput
|
8
|
+
let searchInputWrapper
|
9
|
+
|
10
|
+
beforeEach(() => {
|
11
|
+
searchInput = mount(SearchInput, {
|
12
|
+
props: defaultSearchInputProps,
|
13
|
+
global: {
|
14
|
+
provide: {
|
15
|
+
theme,
|
16
|
+
},
|
17
|
+
},
|
18
|
+
})
|
19
|
+
|
20
|
+
const defaultDataId = searchInput.props('dataId')
|
21
|
+
searchInputWrapper = searchInput.find(`[data-id="${defaultDataId}"]`)
|
22
|
+
})
|
23
|
+
|
24
|
+
it('Search input is rendered and displays the correct placeholder', async () => {
|
25
|
+
// Check that Search input has been rendered
|
26
|
+
expect(searchInputWrapper.exists()).toBe(true)
|
27
|
+
|
28
|
+
// Set the placeholder
|
29
|
+
const placeholderText = 'Search by company name'
|
30
|
+
await searchInput.setProps({ placeholder: placeholderText })
|
31
|
+
await searchInput.vm.$nextTick()
|
32
|
+
|
33
|
+
// Check that the input displays the correct placeholder
|
34
|
+
expect(searchInputWrapper.attributes('placeholder')).toBe(placeholderText)
|
35
|
+
})
|
36
|
+
|
37
|
+
it('Search input emits correct payload on change', async () => {
|
38
|
+
// Simulate user input
|
39
|
+
const inputValue = 'test input'
|
40
|
+
await searchInputWrapper.setValue(inputValue)
|
41
|
+
|
42
|
+
// Check that the component emitted the 'on-change' event with correct payload
|
43
|
+
expect(searchInput.emitted('on-change')).toBeTruthy()
|
44
|
+
expect(searchInput.emitted('on-change')[0]).toEqual([inputValue])
|
45
|
+
})
|
46
|
+
|
47
|
+
it('test disabled prop', async () => {
|
48
|
+
await searchInput.setProps({ disabled: true })
|
49
|
+
await searchInput.vm.$nextTick()
|
50
|
+
|
51
|
+
expect(searchInputWrapper.attributes()).toHaveProperty('disabled')
|
52
|
+
expect(searchInputWrapper.element.disabled).toBe(true)
|
53
|
+
})
|
54
|
+
|
55
|
+
it('test hasFocus prop', async () => {
|
56
|
+
// Spy on the focus method
|
57
|
+
const focusSpy = jest.spyOn(searchInputWrapper.element, 'focus')
|
58
|
+
|
59
|
+
await searchInput.setProps({ hasFocus: true })
|
60
|
+
await searchInput.vm.$nextTick()
|
61
|
+
|
62
|
+
// Check that the focus method was called
|
63
|
+
expect(focusSpy).toHaveBeenCalled()
|
64
|
+
})
|
65
|
+
})
|
@@ -17,7 +17,9 @@
|
|
17
17
|
>
|
18
18
|
<InputLabel
|
19
19
|
:font-color="
|
20
|
-
labelFontColor || colorMode == 'dark'
|
20
|
+
labelFontColor || colorMode == 'dark' || colorMode == 'transparent'
|
21
|
+
? 'white'
|
22
|
+
: 'eturnityGrey'
|
21
23
|
"
|
22
24
|
:font-size="fontSize"
|
23
25
|
>{{ label }}
|
@@ -40,18 +42,26 @@
|
|
40
42
|
<SelectButton
|
41
43
|
ref="select"
|
42
44
|
:bg-color="
|
43
|
-
buttonBgColor || colorMode == 'dark'
|
45
|
+
buttonBgColor || colorMode == 'dark'
|
46
|
+
? 'transparentBlack1'
|
47
|
+
: colorMode == 'transparent'
|
48
|
+
? 'transparent'
|
49
|
+
: 'white'
|
44
50
|
"
|
45
51
|
class="select-button"
|
52
|
+
:color-mode="colorMode"
|
46
53
|
:data-id="dataId"
|
47
54
|
:disabled="disabled"
|
48
55
|
:font-color="
|
49
|
-
buttonFontColor || colorMode == 'dark'
|
56
|
+
buttonFontColor || colorMode == 'dark' || colorMode == 'transparent'
|
57
|
+
? 'white'
|
58
|
+
: 'black'
|
50
59
|
"
|
51
60
|
:font-size="fontSize"
|
52
61
|
:has-error="hasError"
|
53
62
|
:has-no-padding="isSearchBarVisible || !hasSelectButtonPadding"
|
54
63
|
:height="height"
|
64
|
+
:is-search-bar-visible="isSearchBarVisible"
|
55
65
|
:no-relative="noRelative"
|
56
66
|
:padding-left="paddingLeft"
|
57
67
|
:select-height="selectHeight"
|
@@ -72,7 +82,11 @@
|
|
72
82
|
ref="searchInput"
|
73
83
|
background-color="transparent"
|
74
84
|
:font-color="
|
75
|
-
buttonFontColor ||
|
85
|
+
buttonFontColor ||
|
86
|
+
colorMode == 'dark' ||
|
87
|
+
colorMode == 'transparent'
|
88
|
+
? 'white'
|
89
|
+
: 'black'
|
76
90
|
"
|
77
91
|
:font-size="fontSize"
|
78
92
|
input-height="34px"
|
@@ -92,26 +106,30 @@
|
|
92
106
|
>
|
93
107
|
<slot name="selector" :selected-value="selectedValue"></slot>
|
94
108
|
</Selector>
|
95
|
-
<Caret
|
109
|
+
<Caret
|
110
|
+
class="caret_dropdown"
|
111
|
+
:color-mode="colorMode"
|
112
|
+
@click.stop="toggleCaretDropdown"
|
113
|
+
>
|
96
114
|
<Icon
|
97
115
|
v-if="isDropdownOpen"
|
98
116
|
:color="
|
99
|
-
caretColor || colorMode == 'dark'
|
117
|
+
caretColor || colorMode == 'dark' || colorMode == 'transparent'
|
100
118
|
? 'white'
|
101
119
|
: 'transparentBlack1'
|
102
120
|
"
|
103
121
|
name="arrow_up"
|
104
|
-
size="12px"
|
122
|
+
:size="colorMode === 'transparent' ? '8px' : '12px'"
|
105
123
|
/>
|
106
124
|
<Icon
|
107
125
|
v-else
|
108
126
|
:color="
|
109
|
-
caretColor || colorMode == 'dark'
|
127
|
+
caretColor || colorMode == 'dark' || colorMode == 'transparent'
|
110
128
|
? 'white'
|
111
129
|
: 'transparentBlack1'
|
112
130
|
"
|
113
131
|
name="arrow_down"
|
114
|
-
size="12px"
|
132
|
+
:size="colorMode === 'transparent' ? '8px' : '12px'"
|
115
133
|
/>
|
116
134
|
</Caret>
|
117
135
|
</SelectButton>
|
@@ -121,15 +139,27 @@
|
|
121
139
|
v-show="isSelectDropdownShown"
|
122
140
|
ref="dropdown"
|
123
141
|
:bg-color="
|
124
|
-
dropdownBgColor ||
|
142
|
+
dropdownBgColor ||
|
143
|
+
colorMode == 'dark' ||
|
144
|
+
colorMode == 'transparent'
|
145
|
+
? 'black'
|
146
|
+
: 'white'
|
125
147
|
"
|
126
148
|
:dropdown-position="dropdownPosition"
|
127
149
|
:font-color="
|
128
|
-
dropdownFontColor ||
|
150
|
+
dropdownFontColor ||
|
151
|
+
colorMode == 'dark' ||
|
152
|
+
colorMode == 'transparent'
|
153
|
+
? 'white'
|
154
|
+
: 'black'
|
129
155
|
"
|
130
156
|
:font-size="fontSize"
|
131
157
|
:hovered-bg-color="
|
132
|
-
colorMode == 'dark'
|
158
|
+
colorMode == 'dark'
|
159
|
+
? '#000000'
|
160
|
+
: colorMode == 'transparent'
|
161
|
+
? 'grey6'
|
162
|
+
: dropdownBgColor
|
133
163
|
"
|
134
164
|
:hovered-index="hoveredIndex"
|
135
165
|
:hovered-value="hoveredValue"
|
@@ -186,12 +216,15 @@
|
|
186
216
|
const CARET_WIDTH = '30px'
|
187
217
|
const BORDER_WIDTH = '1px'
|
188
218
|
|
189
|
-
const
|
219
|
+
const CaretAttrs = { colorMode: String }
|
220
|
+
const Caret = styled('div', CaretAttrs)`
|
190
221
|
display: flex;
|
191
222
|
align-items: center;
|
192
223
|
justify-content: center;
|
193
|
-
width: ${
|
194
|
-
|
224
|
+
width: ${(props) =>
|
225
|
+
props.colorMode === 'transparent' ? '15px' : CARET_WIDTH};
|
226
|
+
min-width: ${(props) =>
|
227
|
+
props.colorMode === 'transparent' ? '15px' : CARET_WIDTH};
|
195
228
|
height: 100%;
|
196
229
|
align-items: center;
|
197
230
|
cursor: pointer;
|
@@ -230,6 +263,7 @@
|
|
230
263
|
`
|
231
264
|
const OptionalLabel = styled.span`
|
232
265
|
font-weight: 300;
|
266
|
+
text-transform: lowercase;
|
233
267
|
`
|
234
268
|
const inputProps = {
|
235
269
|
selectWidth: String,
|
@@ -274,6 +308,8 @@
|
|
274
308
|
noRelative: Boolean,
|
275
309
|
tablePaddingLeft: String,
|
276
310
|
showDisabledBackground: Boolean,
|
311
|
+
colorMode: String,
|
312
|
+
isSearchBarVisible: Boolean,
|
277
313
|
}
|
278
314
|
const SelectButton = styled('div', selectButtonAttrs)`
|
279
315
|
position: ${(props) => (props.noRelative ? 'static' : 'relative')};
|
@@ -281,7 +317,11 @@
|
|
281
317
|
border-radius: 4px;
|
282
318
|
max-width: ${(props) => (props.selectWidth ? props.selectWidth : '100%')};
|
283
319
|
${(props) =>
|
284
|
-
props.
|
320
|
+
props.colorMode === 'transparent'
|
321
|
+
? props.isSearchBarVisible
|
322
|
+
? 'padding: 10px 15px 10px 5px;'
|
323
|
+
: 'padding: 10px 15px;'
|
324
|
+
: props.isSearchBarVisible
|
285
325
|
? ''
|
286
326
|
: `padding-left: ${
|
287
327
|
props.hasNoPadding
|
@@ -613,7 +653,7 @@
|
|
613
653
|
if (this.isDropdownOpen) {
|
614
654
|
return this.$refs.dropdown.$el.childElementCount > 1
|
615
655
|
? this.$refs.dropdown.$el.childElementCount
|
616
|
-
:
|
656
|
+
: this.$refs.dropdown.$el.children[0]
|
617
657
|
? this.$refs.dropdown.$el.children[0].childElementCount
|
618
658
|
: 0
|
619
659
|
}
|
@@ -1,6 +1,12 @@
|
|
1
1
|
<template>
|
2
2
|
<OptionContainer
|
3
|
-
:background-color="
|
3
|
+
:background-color="
|
4
|
+
colorMode == 'dark'
|
5
|
+
? '#000000'
|
6
|
+
: colorMode == 'transparent'
|
7
|
+
? 'black'
|
8
|
+
: backgroundColor
|
9
|
+
"
|
4
10
|
:cursor-type="cursorType"
|
5
11
|
:data-value="value"
|
6
12
|
:disabled-bg-color="disabledBgColor"
|
@@ -8,6 +14,8 @@
|
|
8
14
|
:hovered-bg-color="
|
9
15
|
colorMode == 'dark'
|
10
16
|
? '#000000'
|
17
|
+
: colorMode == 'transparent'
|
18
|
+
? 'grey6'
|
11
19
|
: hoveredBgColor
|
12
20
|
? hoveredBgColor
|
13
21
|
: 'grey5'
|
@@ -130,7 +138,8 @@
|
|
130
138
|
default: '12px 10px',
|
131
139
|
},
|
132
140
|
textColor: {
|
133
|
-
type:
|
141
|
+
type: String,
|
142
|
+
required: false,
|
134
143
|
default: 'inherit',
|
135
144
|
},
|
136
145
|
},
|
@@ -3,6 +3,7 @@
|
|
3
3
|
<Container>
|
4
4
|
<SpinnerWrapper data-test-id="spinner_full_wrapper">
|
5
5
|
<SpinnerSvg
|
6
|
+
:class="{ white: isWhite }"
|
6
7
|
data-test-id="spinner_full_icon"
|
7
8
|
:style="{ width: size, height: size }"
|
8
9
|
/>
|
@@ -16,6 +17,7 @@
|
|
16
17
|
>
|
17
18
|
<SpinnerWrapper data-test-id="spinner_wrapper">
|
18
19
|
<SpinnerSvg
|
20
|
+
:class="{ white: isWhite }"
|
19
21
|
data-test-id="spinner_icon"
|
20
22
|
:style="{ width: size, height: size }"
|
21
23
|
/>
|
@@ -54,6 +56,10 @@
|
|
54
56
|
const SpinnerWrapper = styled.div`
|
55
57
|
width: ${(props) => (props.size ? props.size : '60px')};
|
56
58
|
height: auto;
|
59
|
+
|
60
|
+
.white {
|
61
|
+
filter: brightness(0) invert(1);
|
62
|
+
}
|
57
63
|
`
|
58
64
|
|
59
65
|
export default {
|
@@ -80,6 +86,11 @@
|
|
80
86
|
default: '60px',
|
81
87
|
type: String,
|
82
88
|
},
|
89
|
+
isWhite: {
|
90
|
+
required: false,
|
91
|
+
default: false,
|
92
|
+
type: Boolean,
|
93
|
+
},
|
83
94
|
},
|
84
95
|
}
|
85
96
|
</script>
|