@eturnity/eturnity_reusable_components 9.37.0 → 9.37.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.
- package/package.json +1 -1
- package/src/components/inputs/select/option/index.vue +6 -9
- package/src/components/inputs/select/option/option.spec.js +39 -0
- package/src/components/tableDropdown/index.vue +2 -2
- package/src/components/tables/mainTable/index.vue +7 -5
- package/src/components/threeDots/index.vue +5 -5
- package/src/components/threeDots/threeDots.spec.js +25 -0
package/package.json
CHANGED
|
@@ -14,15 +14,7 @@
|
|
|
14
14
|
:data-value="domDataValue"
|
|
15
15
|
:disabled-bg-color="disabledBgColor"
|
|
16
16
|
:disabled-text-color="disabledTextColor"
|
|
17
|
-
:hovered-bg-color="
|
|
18
|
-
colorMode == 'dark'
|
|
19
|
-
? theme.semanticColors.teal[800]
|
|
20
|
-
: colorMode == 'transparent'
|
|
21
|
-
? 'grey6'
|
|
22
|
-
: hoveredBgColor
|
|
23
|
-
? hoveredBgColor
|
|
24
|
-
: 'grey5'
|
|
25
|
-
"
|
|
17
|
+
:hovered-bg-color="hoveredBackgroundColor"
|
|
26
18
|
:is-disabled="isDisabled"
|
|
27
19
|
:min-width="minWidth"
|
|
28
20
|
:padding="padding"
|
|
@@ -172,6 +164,11 @@
|
|
|
172
164
|
}
|
|
173
165
|
},
|
|
174
166
|
computed: {
|
|
167
|
+
hoveredBackgroundColor() {
|
|
168
|
+
if (this.colorMode == 'dark') return theme.semanticColors.teal[800]
|
|
169
|
+
if (this.colorMode == 'transparent') return 'grey6'
|
|
170
|
+
return this.hoveredBgColor || theme.semanticColors.grey[300]
|
|
171
|
+
},
|
|
175
172
|
/** Vue omits `data-value` when bound to null, so the parent select cannot find this row for search filtering. */
|
|
176
173
|
domDataValue() {
|
|
177
174
|
const v = this.value
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { mount } from '@vue/test-utils'
|
|
3
|
+
import Option from '@/components/inputs/select/option'
|
|
4
|
+
import theme from '@/assets/theme'
|
|
5
|
+
|
|
6
|
+
// jsdom never receives the stylesheet vue3-styled-components generates, so the
|
|
7
|
+
// hashed class on the rendered option is the observable: two mounts share a
|
|
8
|
+
// class only when they resolve to the same styles.
|
|
9
|
+
describe('RCoption', () => {
|
|
10
|
+
const styleClass = (props = {}) =>
|
|
11
|
+
mount(Option, {
|
|
12
|
+
props: { value: 'a', ...props },
|
|
13
|
+
slots: { default: 'Option A' },
|
|
14
|
+
})
|
|
15
|
+
.classes()
|
|
16
|
+
.join(' ')
|
|
17
|
+
|
|
18
|
+
it('hovers on grey 300 by default', () => {
|
|
19
|
+
expect(styleClass()).toBe(
|
|
20
|
+
styleClass({ hoveredBgColor: theme.semanticColors.grey[300] })
|
|
21
|
+
)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it('lets an explicit hoveredBgColor win over the default', () => {
|
|
25
|
+
expect(styleClass({ hoveredBgColor: 'grey4' })).not.toBe(styleClass())
|
|
26
|
+
expect(styleClass({ hoveredBgColor: 'grey4' })).toBe(
|
|
27
|
+
styleClass({ hoveredBgColor: theme.colors.grey4 })
|
|
28
|
+
)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it('keeps its own hover colours in dark and transparent colour modes', () => {
|
|
32
|
+
expect(styleClass({ colorMode: 'dark', hoveredBgColor: 'grey4' })).toBe(
|
|
33
|
+
styleClass({ colorMode: 'dark' })
|
|
34
|
+
)
|
|
35
|
+
expect(
|
|
36
|
+
styleClass({ colorMode: 'transparent', hoveredBgColor: 'grey4' })
|
|
37
|
+
).toBe(styleClass({ colorMode: 'transparent' }))
|
|
38
|
+
})
|
|
39
|
+
})
|
|
@@ -365,7 +365,7 @@
|
|
|
365
365
|
}
|
|
366
366
|
|
|
367
367
|
&:hover {
|
|
368
|
-
background-color: ${(props) => props.theme.
|
|
368
|
+
background-color: ${(props) => props.theme.semanticColors.grey[300]};
|
|
369
369
|
}
|
|
370
370
|
`
|
|
371
371
|
|
|
@@ -420,7 +420,7 @@
|
|
|
420
420
|
height: 37px;
|
|
421
421
|
|
|
422
422
|
&:hover {
|
|
423
|
-
background-color: ${(props) => props.theme.
|
|
423
|
+
background-color: ${(props) => props.theme.semanticColors.grey[300]};
|
|
424
424
|
}
|
|
425
425
|
`
|
|
426
426
|
|
|
@@ -143,11 +143,13 @@
|
|
|
143
143
|
.arrow-container,
|
|
144
144
|
.input-placeholder,
|
|
145
145
|
.table-dropdown-item {
|
|
146
|
-
background-color: ${(props) =>
|
|
146
|
+
background-color: ${(props) =>
|
|
147
|
+
props.theme.semanticColors.grey[300]};
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
input {
|
|
150
|
-
background-color: ${(props) =>
|
|
151
|
+
background-color: ${(props) =>
|
|
152
|
+
props.theme.semanticColors.grey[300]};
|
|
151
153
|
}
|
|
152
154
|
}
|
|
153
155
|
|
|
@@ -337,7 +339,7 @@
|
|
|
337
339
|
&:hover {
|
|
338
340
|
input:disabled {
|
|
339
341
|
background-color: ${(props) =>
|
|
340
|
-
props.theme.
|
|
342
|
+
props.theme.semanticColors.grey[300] + '!important'};
|
|
341
343
|
}
|
|
342
344
|
|
|
343
345
|
.drag-icon {
|
|
@@ -345,7 +347,7 @@
|
|
|
345
347
|
}
|
|
346
348
|
|
|
347
349
|
.drag-wrapper {
|
|
348
|
-
background-color: ${(props) => props.theme.
|
|
350
|
+
background-color: ${(props) => props.theme.semanticColors.grey[300]};
|
|
349
351
|
}
|
|
350
352
|
|
|
351
353
|
.arrow-dropdown {
|
|
@@ -416,7 +418,7 @@
|
|
|
416
418
|
height: unset;
|
|
417
419
|
|
|
418
420
|
&:focus {
|
|
419
|
-
background: ${(props) => props.theme.
|
|
421
|
+
background: ${(props) => props.theme.semanticColors.grey[300]};
|
|
420
422
|
}
|
|
421
423
|
}
|
|
422
424
|
|
|
@@ -254,12 +254,12 @@
|
|
|
254
254
|
background-color: ${(props) =>
|
|
255
255
|
props.colorTheme == 'dark'
|
|
256
256
|
? theme.semanticColors.teal[700]
|
|
257
|
-
:
|
|
257
|
+
: theme.semanticColors.grey[300]};
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
&:focus-visible {
|
|
261
261
|
outline: none;
|
|
262
|
-
background-color:
|
|
262
|
+
background-color: ${theme.semanticColors.grey[300]};
|
|
263
263
|
}
|
|
264
264
|
`
|
|
265
265
|
const OptionChild = styled('div', { colorTheme: String })`
|
|
@@ -272,12 +272,12 @@
|
|
|
272
272
|
background-color: ${(props) =>
|
|
273
273
|
props.colorTheme == 'dark'
|
|
274
274
|
? theme.semanticColors.teal[600]
|
|
275
|
-
:
|
|
275
|
+
: theme.semanticColors.grey[300]};
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
&:focus-visible {
|
|
279
279
|
outline: none;
|
|
280
|
-
background-color:
|
|
280
|
+
background-color: ${theme.semanticColors.grey[300]};
|
|
281
281
|
}
|
|
282
282
|
`
|
|
283
283
|
|
|
@@ -358,7 +358,7 @@
|
|
|
358
358
|
},
|
|
359
359
|
hoveredBackgroundColor: {
|
|
360
360
|
type: String,
|
|
361
|
-
default: theme.
|
|
361
|
+
default: theme.semanticColors.grey[300],
|
|
362
362
|
},
|
|
363
363
|
dataId: {
|
|
364
364
|
required: false,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import { mount, DOMWrapper } from '@vue/test-utils'
|
|
3
3
|
import ThreeDots from './index.vue'
|
|
4
|
+
import theme from '@/assets/theme'
|
|
4
5
|
|
|
5
6
|
jest.mock('@/components/icon/iconCache.mjs', () => ({
|
|
6
7
|
fetchIcon: jest.fn(() => Promise.resolve('')),
|
|
@@ -118,4 +119,28 @@ describe('ThreeDots', () => {
|
|
|
118
119
|
expect(w.emitted('on-select')).toHaveLength(1)
|
|
119
120
|
expect(w.emitted('on-select')[0][0]).toMatchObject({ value: 'c1' })
|
|
120
121
|
})
|
|
122
|
+
|
|
123
|
+
// jsdom never receives the stylesheet vue3-styled-components generates, so the
|
|
124
|
+
// hashed class on the trigger is the observable: two mounts share a class only
|
|
125
|
+
// when they resolve to the same styles.
|
|
126
|
+
describe('hovered background colour', () => {
|
|
127
|
+
const styleClass = (props = {}) => {
|
|
128
|
+
const w = mount(ThreeDots, { props: { options, ...props } })
|
|
129
|
+
const classes = w.classes().join(' ')
|
|
130
|
+
w.unmount()
|
|
131
|
+
return classes
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
it('hovers on grey 300 by default', () => {
|
|
135
|
+
expect(styleClass()).toBe(
|
|
136
|
+
styleClass({ hoveredBackgroundColor: theme.semanticColors.grey[300] })
|
|
137
|
+
)
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
it('lets an explicit hoveredBackgroundColor win over the default', () => {
|
|
141
|
+
expect(
|
|
142
|
+
styleClass({ hoveredBackgroundColor: theme.colors.grey5 })
|
|
143
|
+
).not.toBe(styleClass())
|
|
144
|
+
})
|
|
145
|
+
})
|
|
121
146
|
})
|