@eturnity/eturnity_reusable_components 9.22.2 → 9.25.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/dist/index.es3.js +268 -156
- package/package.json +3 -3
- package/src/assets/svgIcons/add_thin_icon.svg +3 -0
- package/src/assets/svgIcons/delete.svg +2 -3
- package/src/assets/svgIcons/location_outline.svg +3 -0
- package/src/assets/svgIcons/redo.svg +2 -5
- package/src/assets/svgIcons/save.svg +2 -2
- package/src/assets/svgIcons/subtract_thin_icon.svg +3 -0
- package/src/assets/svgIcons/undo.svg +2 -5
- package/src/assets/theme.js +202 -90
- package/src/components/accordion/Accordion.stories.js +1 -1
- package/src/components/addNewButton/AddNewButton.stories.js +40 -8
- package/src/components/banner/actionBanner/ActionBanner.stories.js +1 -1
- package/src/components/banner/actionBanner/index.vue +4 -2
- package/src/components/banner/banner/Banner.stories.js +1 -1
- package/src/components/banner/infoBanner/InfoBanner.stories.js +1 -1
- package/src/components/banner/infoBanner/index.vue +4 -2
- package/src/components/banner/notificationBanner/notificationBanner.stories.js +81 -0
- package/src/components/buttons/buttonIcon/index.vue +213 -81
- package/src/components/buttons/closeButton/CloseButton.stories.js +1 -1
- package/src/components/buttons/collection/index.vue +1 -3
- package/src/components/buttons/mainButton/index.vue +99 -45
- package/src/components/buttons/splitButtons/splitButtons.stories.js +70 -0
- package/src/components/card/Card.stories.js +16 -4
- package/src/components/card/index.vue +1 -1
- package/src/components/collapsableInfoText/collapsableInfoText.stories.js +52 -0
- package/src/components/deleteIcon/DeleteIcon.stories.js +1 -1
- package/src/components/draggableCard/draggableCard.stories.js +1 -1
- package/src/components/draggableInputHandle/draggableInputHandle.stories.js +43 -0
- package/src/components/dropdown/Dropdown.stories.js +1 -1
- package/src/components/errorMessage/errorMessage.stories.js +31 -17
- package/src/components/filter/filterSettings.vue +1 -1
- package/src/components/icon/Icon.stories.js +1 -1
- package/src/components/iconWrapper/iconWrapper.stories.js +78 -0
- package/src/components/infoCard/InfoCard.stories.js +1 -1
- package/src/components/infoLabel/infoLabel.stories.js +61 -0
- package/src/components/infoText/infoText.stories.js +1 -1
- package/src/components/inputs/checkbox/Checkbox.stories.js +1 -1
- package/src/components/inputs/checkbox/index.vue +10 -1
- package/src/components/inputs/colorSelector/ColorSelector.stories.js +78 -0
- package/src/components/inputs/colorSelector/colorSelector.spec.js +73 -0
- package/src/components/inputs/colorSelector/defaultProps.js +11 -0
- package/src/components/inputs/colorSelector/index.vue +224 -0
- package/src/components/inputs/inputNumber/InputNumber.stories.js +1 -1
- package/src/components/inputs/inputNumber/index.vue +69 -59
- package/src/components/inputs/inputNumberQuestion/inputNumberQuestion.stories.js +77 -0
- package/src/components/inputs/inputText/InputText.stories.js +1 -1
- package/src/components/inputs/inputText/index.vue +29 -20
- package/src/components/inputs/isRequiredLabelStar/isRequiredLabelStar.stories.js +26 -0
- package/src/components/inputs/radioButton/RadioButton.stories.js +1 -1
- package/src/components/inputs/radioButton/index.vue +21 -7
- package/src/components/inputs/searchInput/SearchInput.stories.js +1 -1
- package/src/components/inputs/select/index.vue +33 -21
- package/src/components/inputs/select/option/index.vue +1 -1
- package/src/components/inputs/select/select.stories.js +4 -25
- package/src/components/inputs/shared/inputLabelTypography.js +7 -0
- package/src/components/inputs/slider/index.vue +9 -12
- package/src/components/inputs/slider/slider.stories.js +71 -0
- package/src/components/inputs/switchField/index.vue +38 -10
- package/src/components/inputs/switchField/switchField.stories.js +72 -0
- package/src/components/inputs/textAreaInput/TextAreaInput.stories.js +1 -1
- package/src/components/inputs/textAreaInput/index.vue +19 -6
- package/src/components/inputs/toggle/Toggle.stories.js +1 -1
- package/src/components/inputs/toggle/index.vue +10 -6
- package/src/components/label/index.vue +39 -11
- package/src/components/label/label.stories.js +69 -0
- package/src/components/markerItem/markerItem.stories.js +46 -0
- package/src/components/modals/actionModal/actionModal.stories.js +1 -1
- package/src/components/modals/actionModal/index.vue +1 -1
- package/src/components/modals/infoModal/index.vue +1 -10
- package/src/components/modals/infoModal/infoModal.stories.js +1 -1
- package/src/components/modals/modal/modal.spec.js +168 -0
- package/src/components/modals/modal/modal.stories.js +287 -26
- package/src/components/modals/modalBody/index.vue +30 -0
- package/src/components/modals/modalButtonContainer/index.vue +42 -0
- package/src/components/modals/modalButtonContainer/modalButtonContainer.stories.js +59 -0
- package/src/components/modals/modalContent/index.vue +125 -0
- package/src/components/modals/modalTitle/index.vue +34 -0
- package/src/components/navigationTabs/navigationTabs.stories.js +58 -0
- package/src/components/pageSubtitle/PageSubtitle.stories.js +1 -1
- package/src/components/pageTitle/PageTitle.stories.js +1 -1
- package/src/components/pagination/pagination.stories.js +79 -0
- package/src/components/paginationV2/paginationV2.spec.js +132 -0
- package/src/components/paginationV2/paginationV2.stories.js +68 -0
- package/src/components/panelRangeInfo/panelRangeInfo.stories.js +60 -0
- package/src/components/progressBar/ProgressBar.stories.js +1 -1
- package/src/components/progressStep/progressStep.stories.js +1 -1
- package/src/components/projectMarker/ProjectMarker.stories.js +1 -1
- package/src/components/rangeSlider/RangeSlider.stories.js +1 -1
- package/src/components/roundTabs/roundTabs.stories.js +54 -0
- package/src/components/selectedOptions/selectedOptions.stories.js +1 -1
- package/src/components/sideMenu/sideMenu.stories.js +53 -0
- package/src/components/spinner/Spinner.stories.js +1 -1
- package/src/components/spinnerGif/SpinnerGif.stories.js +1 -1
- package/src/components/statusIndicator/statusIndicator.stories.js +101 -0
- package/src/components/tableDropdown/TableDropdown.stories.js +1 -1
- package/src/components/tables/viewTable/viewTable.stories.js +85 -0
- package/src/components/tabsHeader/TabsHeader.stories.js +1 -1
- package/src/components/tag/conversionTag/conversionTag.stories.js +47 -0
- package/src/components/tag/conversionTag/index.vue +1 -1
- package/src/components/tag/freeTrialTag/freeTrialTag.stories.js +42 -0
- package/src/components/threeDots/index.vue +20 -3
- package/src/components/threeDots/threeDots.stories.js +59 -0
- package/src/components/videoThumbnail/videoThumbnail.stories.js +1 -1
- package/src/constants/colorPalettes.js +71 -0
|
@@ -45,6 +45,12 @@
|
|
|
45
45
|
// />
|
|
46
46
|
import styled from 'vue3-styled-components'
|
|
47
47
|
import IsRequiredLabelStar from '../isRequiredLabelStar'
|
|
48
|
+
import {
|
|
49
|
+
inputLabelFontSize,
|
|
50
|
+
inputLabelFontWeight,
|
|
51
|
+
inputLabelLetterSpacing,
|
|
52
|
+
inputLabelLineHeight,
|
|
53
|
+
} from '../shared/inputLabelTypography'
|
|
48
54
|
const ComponentWrapper = styled.div`
|
|
49
55
|
min-height: 16px;
|
|
50
56
|
`
|
|
@@ -178,7 +184,10 @@
|
|
|
178
184
|
isDisabled: Boolean,
|
|
179
185
|
}
|
|
180
186
|
const LabelText = styled('div', LabelTextAttrs)`
|
|
181
|
-
font-size:
|
|
187
|
+
font-size: ${inputLabelFontSize};
|
|
188
|
+
font-weight: ${inputLabelFontWeight};
|
|
189
|
+
line-height: ${inputLabelLineHeight};
|
|
190
|
+
letter-spacing: ${inputLabelLetterSpacing};
|
|
182
191
|
display: flex;
|
|
183
192
|
align-items: center;
|
|
184
193
|
min-height: 16px;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { useArgs } from '@storybook/preview-api'
|
|
2
|
+
import { action } from '@storybook/addon-actions'
|
|
3
|
+
import defaultProps from './defaultProps'
|
|
4
|
+
import ColorSelector from './index.vue'
|
|
5
|
+
import {
|
|
6
|
+
PANEL_FILL_COLORS,
|
|
7
|
+
TRANSPARENT_COLOR,
|
|
8
|
+
} from '@/constants/colorPalettes.js'
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: 'Components/Inputs/ColorSelector',
|
|
12
|
+
component: ColorSelector,
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
argTypes: {
|
|
15
|
+
size: {
|
|
16
|
+
control: 'select',
|
|
17
|
+
options: ['default', 'compact'],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// import ColorSelector from "@eturnity/eturnity_reusable_components/src/components/inputs/colorSelector"
|
|
23
|
+
// <ColorSelector
|
|
24
|
+
// :colors="colors"
|
|
25
|
+
// :selected-color="selectedColor"
|
|
26
|
+
// data-id="my_color_selector"
|
|
27
|
+
// label="Color"
|
|
28
|
+
// size="default"
|
|
29
|
+
// @color-change="onColorChange"
|
|
30
|
+
// />
|
|
31
|
+
|
|
32
|
+
const Template = (args) => {
|
|
33
|
+
const [currentArgs, updateArgs] = useArgs()
|
|
34
|
+
|
|
35
|
+
const handleColorChange = (color) => {
|
|
36
|
+
action('color-change')(color)
|
|
37
|
+
updateArgs({ selectedColor: color })
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
components: { ColorSelector },
|
|
42
|
+
setup() {
|
|
43
|
+
return { args: currentArgs, handleColorChange }
|
|
44
|
+
},
|
|
45
|
+
template: `
|
|
46
|
+
<div style="padding: 16px; background: #263238;">
|
|
47
|
+
<ColorSelector
|
|
48
|
+
v-bind="args"
|
|
49
|
+
@color-change="handleColorChange"
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
`,
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const Default = Template.bind({})
|
|
57
|
+
Default.args = {
|
|
58
|
+
...defaultProps,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const WithTransparent = Template.bind({})
|
|
62
|
+
WithTransparent.args = {
|
|
63
|
+
...defaultProps,
|
|
64
|
+
colors: PANEL_FILL_COLORS,
|
|
65
|
+
selectedColor: TRANSPARENT_COLOR,
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const Compact = Template.bind({})
|
|
69
|
+
Compact.args = {
|
|
70
|
+
...defaultProps,
|
|
71
|
+
size: 'compact',
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const WithoutCustomPicker = Template.bind({})
|
|
75
|
+
WithoutCustomPicker.args = {
|
|
76
|
+
...defaultProps,
|
|
77
|
+
showCustomPicker: false,
|
|
78
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
|
2
|
+
import ColorSelector from './index.vue'
|
|
3
|
+
import defaultProps from './defaultProps'
|
|
4
|
+
import theme from '@/assets/theme'
|
|
5
|
+
import { TRANSPARENT_COLOR } from '@/constants/colorPalettes.js'
|
|
6
|
+
|
|
7
|
+
jest.mock('@/components/icon/iconCache.mjs', () => ({
|
|
8
|
+
fetchIcon: jest.fn(() => Promise.resolve('mocked-icon-url.svg')),
|
|
9
|
+
}))
|
|
10
|
+
|
|
11
|
+
jest.mock('@/components/icon', () => ({
|
|
12
|
+
name: 'Icon',
|
|
13
|
+
template: '<div class="mock-icon" />',
|
|
14
|
+
props: ['name', 'color', 'size', 'cursor'],
|
|
15
|
+
}))
|
|
16
|
+
|
|
17
|
+
describe('ColorSelector', () => {
|
|
18
|
+
const colors = ['#000000', '#ff0000', TRANSPARENT_COLOR]
|
|
19
|
+
|
|
20
|
+
const mountSelector = (props = {}) =>
|
|
21
|
+
mount(ColorSelector, {
|
|
22
|
+
props: {
|
|
23
|
+
colors,
|
|
24
|
+
selectedColor: colors[0],
|
|
25
|
+
dataId: 'test_color_selector',
|
|
26
|
+
...props,
|
|
27
|
+
},
|
|
28
|
+
global: {
|
|
29
|
+
provide: { theme },
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it('renders a swatch per color and the custom picker by default', () => {
|
|
34
|
+
const wrapper = mountSelector()
|
|
35
|
+
expect(wrapper.findAll('[data-test-id^="color_selector_swatch_"]')).toHaveLength(
|
|
36
|
+
colors.length
|
|
37
|
+
)
|
|
38
|
+
expect(wrapper.find('[data-test-id="color_selector_custom"]').exists()).toBe(
|
|
39
|
+
true
|
|
40
|
+
)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('emits color-change when a preset swatch is clicked', async () => {
|
|
44
|
+
const wrapper = mountSelector()
|
|
45
|
+
await wrapper.find('[data-test-id="color_selector_swatch_1"]').trigger('click')
|
|
46
|
+
expect(wrapper.emitted('color-change')).toBeTruthy()
|
|
47
|
+
expect(wrapper.emitted('color-change')[0]).toEqual([colors[1]])
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('emits color-change when the native color input changes', async () => {
|
|
51
|
+
const wrapper = mountSelector({ selectedColor: '#123456' })
|
|
52
|
+
const input = wrapper.find('[data-test-id="color_selector_native_input"]')
|
|
53
|
+
await input.setValue('#abcdef')
|
|
54
|
+
expect(wrapper.emitted('color-change')).toBeTruthy()
|
|
55
|
+
expect(wrapper.emitted('color-change').at(-1)).toEqual(['#abcdef'])
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('hides the custom picker when showCustomPicker is false', () => {
|
|
59
|
+
const wrapper = mountSelector({ showCustomPicker: false })
|
|
60
|
+
expect(wrapper.find('[data-test-id="color_selector_custom"]').exists()).toBe(
|
|
61
|
+
false
|
|
62
|
+
)
|
|
63
|
+
expect(
|
|
64
|
+
wrapper.find('[data-test-id="color_selector_native_input"]').exists()
|
|
65
|
+
).toBe(false)
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
it('sets data-id on swatches when dataId is provided', () => {
|
|
69
|
+
const wrapper = mountSelector()
|
|
70
|
+
const swatch = wrapper.find('[data-test-id="color_selector_swatch_0"]')
|
|
71
|
+
expect(swatch.attributes('data-id')).toBe('test_color_selector_color_0')
|
|
72
|
+
})
|
|
73
|
+
})
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ColorContainer>
|
|
3
|
+
<LabelContainer v-if="label">
|
|
4
|
+
<label>{{ label }}</label>
|
|
5
|
+
</LabelContainer>
|
|
6
|
+
<ColorsWrapper>
|
|
7
|
+
<ColorRadio
|
|
8
|
+
v-for="(color, index) in colors"
|
|
9
|
+
:key="index"
|
|
10
|
+
:color="color"
|
|
11
|
+
:data-id="swatchDataId(index)"
|
|
12
|
+
:data-qa-id="swatchDataQaId(index)"
|
|
13
|
+
:data-test-id="`color_selector_swatch_${index}`"
|
|
14
|
+
:is-selected="index === colorIndex"
|
|
15
|
+
:size="size"
|
|
16
|
+
@click="changeColorIndex(index)"
|
|
17
|
+
>
|
|
18
|
+
<CrossedIcon v-if="color === TRANSPARENT_COLOR" :size="size">
|
|
19
|
+
<Icon
|
|
20
|
+
:color="colorIndex === index ? 'white' : 'grey1'"
|
|
21
|
+
cursor="default"
|
|
22
|
+
name="cross"
|
|
23
|
+
size="14px"
|
|
24
|
+
/>
|
|
25
|
+
</CrossedIcon>
|
|
26
|
+
</ColorRadio>
|
|
27
|
+
<ColorRadioCustom
|
|
28
|
+
v-if="showCustomPicker"
|
|
29
|
+
:color="colorIndex >= 0 ? 'transparent' : selectedColor"
|
|
30
|
+
:data-id="customDataId"
|
|
31
|
+
:data-qa-id="customDataQaId"
|
|
32
|
+
data-test-id="color_selector_custom"
|
|
33
|
+
:is-selected="colorIndex < 0"
|
|
34
|
+
:size="size"
|
|
35
|
+
@click="openColorPicker"
|
|
36
|
+
>
|
|
37
|
+
<Icon
|
|
38
|
+
:color="colorIndex < 0 ? 'white' : 'grey1'"
|
|
39
|
+
cursor="default"
|
|
40
|
+
name="add_icon"
|
|
41
|
+
size="14px"
|
|
42
|
+
/>
|
|
43
|
+
</ColorRadioCustom>
|
|
44
|
+
<input
|
|
45
|
+
v-if="showCustomPicker"
|
|
46
|
+
ref="colorPicker"
|
|
47
|
+
data-test-id="color_selector_native_input"
|
|
48
|
+
:style="nativeInputStyle"
|
|
49
|
+
type="color"
|
|
50
|
+
:value="selectedColor"
|
|
51
|
+
@change="defineCustomColor"
|
|
52
|
+
/>
|
|
53
|
+
</ColorsWrapper>
|
|
54
|
+
</ColorContainer>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<script>
|
|
58
|
+
import styled from 'vue3-styled-components'
|
|
59
|
+
import Icon from '../../../components/icon'
|
|
60
|
+
import { TRANSPARENT_COLOR } from '../../../constants/colorPalettes.js'
|
|
61
|
+
|
|
62
|
+
const swatchProps = { isSelected: Boolean, color: String, size: String }
|
|
63
|
+
|
|
64
|
+
const swatchSize = (size) => (size === 'compact' ? '24px' : '34px')
|
|
65
|
+
|
|
66
|
+
const CrossedIcon = styled('div', { size: String })`
|
|
67
|
+
position: absolute;
|
|
68
|
+
top: 50%;
|
|
69
|
+
left: 50%;
|
|
70
|
+
transform: translate(-50%, -50%);
|
|
71
|
+
`
|
|
72
|
+
|
|
73
|
+
const ColorRadio = styled('div', swatchProps)`
|
|
74
|
+
position: relative;
|
|
75
|
+
width: ${(props) => swatchSize(props.size)};
|
|
76
|
+
height: ${(props) => swatchSize(props.size)};
|
|
77
|
+
display: inline-flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
border: 2px solid
|
|
81
|
+
${(props) =>
|
|
82
|
+
props.isSelected
|
|
83
|
+
? 'white'
|
|
84
|
+
: props.size === 'compact'
|
|
85
|
+
? props.theme.colors.grey2
|
|
86
|
+
: 'transparent'};
|
|
87
|
+
border-radius: 4px;
|
|
88
|
+
background-color: ${(props) => props.color};
|
|
89
|
+
color: white;
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
|
|
92
|
+
&:hover {
|
|
93
|
+
border-color: white;
|
|
94
|
+
}
|
|
95
|
+
`
|
|
96
|
+
|
|
97
|
+
const ColorRadioCustom = styled('div', swatchProps)`
|
|
98
|
+
border: 2px solid
|
|
99
|
+
${(props) => (props.isSelected ? 'white' : props.theme.colors.grey1)};
|
|
100
|
+
border-radius: 4px;
|
|
101
|
+
background-color: ${(props) => props.color};
|
|
102
|
+
color: ${(props) =>
|
|
103
|
+
props.isSelected ? 'white' : props.theme.colors.grey1};
|
|
104
|
+
display: inline-flex;
|
|
105
|
+
width: ${(props) => swatchSize(props.size)};
|
|
106
|
+
height: ${(props) => swatchSize(props.size)};
|
|
107
|
+
justify-content: center;
|
|
108
|
+
vertical-align: top;
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
align-items: center;
|
|
111
|
+
`
|
|
112
|
+
|
|
113
|
+
const ColorContainer = styled('div')`
|
|
114
|
+
display: flex;
|
|
115
|
+
flex-direction: column;
|
|
116
|
+
gap: 8px;
|
|
117
|
+
`
|
|
118
|
+
|
|
119
|
+
const ColorsWrapper = styled('div')`
|
|
120
|
+
display: flex;
|
|
121
|
+
flex-wrap: wrap;
|
|
122
|
+
gap: 8px;
|
|
123
|
+
position: relative;
|
|
124
|
+
`
|
|
125
|
+
|
|
126
|
+
const LabelContainer = styled('div')`
|
|
127
|
+
font-size: 13px;
|
|
128
|
+
font-weight: 500;
|
|
129
|
+
`
|
|
130
|
+
|
|
131
|
+
const nativeInputStyle = {
|
|
132
|
+
width: 0,
|
|
133
|
+
height: 0,
|
|
134
|
+
opacity: 0,
|
|
135
|
+
position: 'absolute',
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export default {
|
|
139
|
+
name: 'ColorSelector',
|
|
140
|
+
|
|
141
|
+
components: {
|
|
142
|
+
ColorRadio,
|
|
143
|
+
ColorRadioCustom,
|
|
144
|
+
ColorContainer,
|
|
145
|
+
ColorsWrapper,
|
|
146
|
+
CrossedIcon,
|
|
147
|
+
Icon,
|
|
148
|
+
LabelContainer,
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
props: {
|
|
152
|
+
colors: {
|
|
153
|
+
type: Array,
|
|
154
|
+
required: true,
|
|
155
|
+
},
|
|
156
|
+
selectedColor: {
|
|
157
|
+
type: String,
|
|
158
|
+
default: '',
|
|
159
|
+
},
|
|
160
|
+
label: {
|
|
161
|
+
type: String,
|
|
162
|
+
default: '',
|
|
163
|
+
},
|
|
164
|
+
dataId: {
|
|
165
|
+
type: String,
|
|
166
|
+
default: '',
|
|
167
|
+
},
|
|
168
|
+
dataQaId: {
|
|
169
|
+
type: String,
|
|
170
|
+
default: '',
|
|
171
|
+
},
|
|
172
|
+
size: {
|
|
173
|
+
type: String,
|
|
174
|
+
default: 'default',
|
|
175
|
+
validator: (value) => ['default', 'compact'].includes(value),
|
|
176
|
+
},
|
|
177
|
+
showCustomPicker: {
|
|
178
|
+
type: Boolean,
|
|
179
|
+
default: true,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
emits: ['color-change'],
|
|
184
|
+
|
|
185
|
+
data() {
|
|
186
|
+
return {
|
|
187
|
+
TRANSPARENT_COLOR,
|
|
188
|
+
nativeInputStyle,
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
computed: {
|
|
193
|
+
colorIndex() {
|
|
194
|
+
return this.colors.findIndex((color) => color === this.selectedColor)
|
|
195
|
+
},
|
|
196
|
+
customDataId() {
|
|
197
|
+
return this.dataId ? `${this.dataId}_custom` : undefined
|
|
198
|
+
},
|
|
199
|
+
customDataQaId() {
|
|
200
|
+
const id = this.dataQaId || this.dataId
|
|
201
|
+
return id ? `${id}_custom` : undefined
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
methods: {
|
|
206
|
+
swatchDataId(index) {
|
|
207
|
+
return this.dataId ? `${this.dataId}_color_${index}` : undefined
|
|
208
|
+
},
|
|
209
|
+
swatchDataQaId(index) {
|
|
210
|
+
const id = this.dataQaId || this.dataId
|
|
211
|
+
return id ? `${id}_color_${index}` : undefined
|
|
212
|
+
},
|
|
213
|
+
changeColorIndex(index) {
|
|
214
|
+
this.$emit('color-change', this.colors[index])
|
|
215
|
+
},
|
|
216
|
+
defineCustomColor(event) {
|
|
217
|
+
this.$emit('color-change', event.target.value)
|
|
218
|
+
},
|
|
219
|
+
openColorPicker() {
|
|
220
|
+
this.$refs.colorPicker?.click()
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
}
|
|
224
|
+
</script>
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"
|
|
51
51
|
:border-color="
|
|
52
52
|
colorMode === 'transparent' && !borderColor
|
|
53
|
-
? '
|
|
53
|
+
? 'grey4'
|
|
54
54
|
: borderColor
|
|
55
55
|
"
|
|
56
56
|
:color-mode="colorMode"
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
colorMode === 'transparent' ? 'transparent' : backgroundColor
|
|
98
98
|
"
|
|
99
99
|
:border-color="
|
|
100
|
-
colorMode === 'transparent' && !borderColor ? '
|
|
100
|
+
colorMode === 'transparent' && !borderColor ? 'grey4' : borderColor
|
|
101
101
|
"
|
|
102
102
|
:color-mode="colorMode"
|
|
103
103
|
:data-id="inputDataId"
|
|
@@ -250,6 +250,12 @@
|
|
|
250
250
|
import IsRequiredLabelStar from '../isRequiredLabelStar'
|
|
251
251
|
import warningIcon from '../../../assets/icons/error_icon.png'
|
|
252
252
|
import Icon from '../../icon'
|
|
253
|
+
import {
|
|
254
|
+
inputLabelFontSize,
|
|
255
|
+
inputLabelFontWeight,
|
|
256
|
+
inputLabelLetterSpacing,
|
|
257
|
+
inputLabelLineHeight,
|
|
258
|
+
} from '../shared/inputLabelTypography'
|
|
253
259
|
|
|
254
260
|
const inputProps = {
|
|
255
261
|
isError: Boolean,
|
|
@@ -293,14 +299,14 @@
|
|
|
293
299
|
props.isInfoBorder
|
|
294
300
|
? '1px solid ' + props.theme.semanticColors.blue[500]
|
|
295
301
|
: props.isError
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
302
|
+
? '1px solid ' + props.theme.colors.red
|
|
303
|
+
: props.noBorder
|
|
304
|
+
? 'none'
|
|
305
|
+
: props.borderColor
|
|
306
|
+
? props.theme.colors[props.borderColor]
|
|
307
|
+
? '1px solid ' + props.theme.colors[props.borderColor]
|
|
308
|
+
: '1px solid ' + props.borderColor
|
|
309
|
+
: '1px solid ' + props.theme.colors.grey4};
|
|
304
310
|
height: ${(props) => props.inputHeight};
|
|
305
311
|
max-height: ${(props) => props.inputHeight};
|
|
306
312
|
padding: ${({ colorMode }) =>
|
|
@@ -316,14 +322,14 @@
|
|
|
316
322
|
showArrowControls
|
|
317
323
|
? '40px'
|
|
318
324
|
: colorMode === 'transparent'
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
? '0'
|
|
326
|
+
: slotSize
|
|
327
|
+
? isError && !showLinearUnitName && !isBorderErrorOnly
|
|
328
|
+
? 'calc(' + slotSize + ' + 24px)'
|
|
329
|
+
: 'calc(' + slotSize + ' + 10px)'
|
|
330
|
+
: isError && !showLinearUnitName && !isBorderErrorOnly
|
|
331
|
+
? '24px'
|
|
332
|
+
: '5px'};
|
|
327
333
|
border-radius: ${(props) =>
|
|
328
334
|
props.isInteractive && props.alignItems != 'vertical'
|
|
329
335
|
? '0 4px 4px 0'
|
|
@@ -336,22 +342,22 @@
|
|
|
336
342
|
props.isError
|
|
337
343
|
? props.theme.colors.grey6
|
|
338
344
|
: props.isDisabled
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
+
? props.colorMode === 'transparent'
|
|
346
|
+
? props.theme.colors.white
|
|
347
|
+
: props.theme.colors.grey2
|
|
348
|
+
: props.fontColor
|
|
349
|
+
? props.fontColor + ' !important'
|
|
350
|
+
: props.theme.colors.black};
|
|
345
351
|
background-color: ${(props) =>
|
|
346
352
|
props.readOnly
|
|
347
353
|
? props.theme.semanticColors.grey[300]
|
|
348
354
|
: props.isDisabled
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
+
? props.colorMode === 'transparent'
|
|
356
|
+
? 'transparent'
|
|
357
|
+
: props.theme.colors.grey5
|
|
358
|
+
: props.backgroundColor
|
|
359
|
+
? props.backgroundColor + ' !important'
|
|
360
|
+
: props.theme.colors.white};
|
|
355
361
|
width: ${(props) =>
|
|
356
362
|
props.inputWidth && !props.hasLabelSlot ? props.inputWidth : '100%'};
|
|
357
363
|
min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
|
|
@@ -429,8 +435,8 @@
|
|
|
429
435
|
props.isError
|
|
430
436
|
? props.theme.colors.red
|
|
431
437
|
: props.hasLength
|
|
432
|
-
|
|
433
|
-
|
|
438
|
+
? props.theme.colors.black
|
|
439
|
+
: props.theme.colors.mediumGray};
|
|
434
440
|
position: absolute;
|
|
435
441
|
right: 10px;
|
|
436
442
|
top: 10px;
|
|
@@ -440,8 +446,8 @@
|
|
|
440
446
|
props.isError
|
|
441
447
|
? props.theme.colors.red
|
|
442
448
|
: props.hasLength
|
|
443
|
-
|
|
444
|
-
|
|
449
|
+
? props.theme.colors.black
|
|
450
|
+
: props.theme.colors.mediumGray};
|
|
445
451
|
`
|
|
446
452
|
|
|
447
453
|
const SlotContainer = styled('span', inputProps)`
|
|
@@ -451,8 +457,8 @@
|
|
|
451
457
|
props.isError
|
|
452
458
|
? props.theme.colors.red
|
|
453
459
|
: props.hasLength
|
|
454
|
-
|
|
455
|
-
|
|
460
|
+
? props.theme.colors.black
|
|
461
|
+
: props.theme.colors.mediumGray};
|
|
456
462
|
position: absolute;
|
|
457
463
|
width: ${(props) =>
|
|
458
464
|
props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
|
|
@@ -463,8 +469,8 @@
|
|
|
463
469
|
props.isError
|
|
464
470
|
? props.theme.colors.red
|
|
465
471
|
: props.hasLength
|
|
466
|
-
|
|
467
|
-
|
|
472
|
+
? props.theme.colors.black
|
|
473
|
+
: props.theme.colors.mediumGray};
|
|
468
474
|
`
|
|
469
475
|
|
|
470
476
|
const LabelWrapper = styled('div', inputProps)`
|
|
@@ -483,25 +489,29 @@
|
|
|
483
489
|
props.alignItems == 'vertical'
|
|
484
490
|
? 'none'
|
|
485
491
|
: props.isError
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
492
|
+
? '1px solid ' + props.theme.colors.red
|
|
493
|
+
: props.noBorder
|
|
494
|
+
? 'none'
|
|
495
|
+
: props.borderColor
|
|
496
|
+
? props.theme.colors[props.borderColor]
|
|
497
|
+
? '1px solid ' + props.theme.colors[props.borderColor]
|
|
498
|
+
: '1px solid ' + props.borderColor
|
|
499
|
+
: '1px solid ' + props.theme.colors.grey4};
|
|
494
500
|
border-radius: 4px 0 0 4px;
|
|
495
501
|
border-right: none;
|
|
496
502
|
`
|
|
497
503
|
|
|
498
504
|
const LabelText = styled('div', inputProps)`
|
|
499
|
-
font-size:
|
|
505
|
+
font-size: ${(props) =>
|
|
506
|
+
props.fontSize ? props.fontSize : inputLabelFontSize};
|
|
507
|
+
font-weight: ${(props) =>
|
|
508
|
+
props.labelFontWeight ? props.labelFontWeight : inputLabelFontWeight};
|
|
509
|
+
line-height: ${inputLabelLineHeight};
|
|
510
|
+
letter-spacing: ${inputLabelLetterSpacing};
|
|
500
511
|
color: ${(props) =>
|
|
501
512
|
props.theme.colors[props.labelFontColor]
|
|
502
513
|
? props.theme.colors[props.labelFontColor]
|
|
503
514
|
: props.labelFontColor};
|
|
504
|
-
font-weight: ${(props) => props.labelFontWeight};
|
|
505
515
|
`
|
|
506
516
|
|
|
507
517
|
const IconAttrs = { size: String, marginRight: Number }
|
|
@@ -737,7 +747,7 @@
|
|
|
737
747
|
labelFontWeight: {
|
|
738
748
|
type: String,
|
|
739
749
|
required: false,
|
|
740
|
-
default: '
|
|
750
|
+
default: '500',
|
|
741
751
|
},
|
|
742
752
|
focus: {
|
|
743
753
|
type: Boolean,
|
|
@@ -942,8 +952,8 @@
|
|
|
942
952
|
this.defaultNumber || this.defaultNumber === 0
|
|
943
953
|
? this.defaultNumber
|
|
944
954
|
: this.minNumber || this.minNumber === 0
|
|
945
|
-
|
|
946
|
-
|
|
955
|
+
? this.minNumber
|
|
956
|
+
: value
|
|
947
957
|
}
|
|
948
958
|
if (!this.allowNegative) {
|
|
949
959
|
value = Math.abs(value)
|
|
@@ -1083,10 +1093,10 @@
|
|
|
1083
1093
|
value || value === 0
|
|
1084
1094
|
? value
|
|
1085
1095
|
: this.defaultNumber
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1096
|
+
? this.defaultNumber
|
|
1097
|
+
: this.minNumber || this.minNumber === 0
|
|
1098
|
+
? this.minNumber
|
|
1099
|
+
: ''
|
|
1090
1100
|
if (adjustedMinValue || adjustedMinValue === 0) {
|
|
1091
1101
|
let input = this.numberToStringEnabled
|
|
1092
1102
|
? numberToString({
|
|
@@ -1115,10 +1125,10 @@
|
|
|
1115
1125
|
value || value === 0
|
|
1116
1126
|
? value
|
|
1117
1127
|
: this.defaultNumber
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1128
|
+
? this.defaultNumber
|
|
1129
|
+
: this.minNumber || this.minNumber === 0
|
|
1130
|
+
? this.minNumber
|
|
1131
|
+
: ''
|
|
1122
1132
|
if (adjustedMinValue || adjustedMinValue === 0) {
|
|
1123
1133
|
let input = this.numberToStringEnabled
|
|
1124
1134
|
? numberToString({
|