@eturnity/eturnity_reusable_components 9.22.2 → 9.25.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/dist/index.es3.js +268 -156
- package/package.json +3 -3
- 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 +216 -80
- 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 +98 -44
- 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/inputNumber/InputNumber.stories.js +1 -1
- package/src/components/inputs/inputNumber/index.vue +15 -5
- 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 +37 -10
- package/src/components/inputs/switchField/switchField.stories.js +71 -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/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
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ref, watch } from 'vue'
|
|
2
|
+
import RcSlider from './index.vue'
|
|
3
|
+
import theme from '@/assets/theme'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Inputs/Slider',
|
|
7
|
+
component: RcSlider,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component:
|
|
14
|
+
'Wrapper around `@vueform/slider` with Eturnity styling. The inner control is registered as `VueformSlider` so it cannot recurse into the host component.',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
argTypes: {
|
|
19
|
+
value: { control: { type: 'range', min: 0, max: 100 } },
|
|
20
|
+
minValue: { control: 'number' },
|
|
21
|
+
maxValue: { control: 'number' },
|
|
22
|
+
unit: { control: 'text' },
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const Template = (args) => ({
|
|
27
|
+
components: { RcSlider },
|
|
28
|
+
setup() {
|
|
29
|
+
const innerValue = ref(args.value)
|
|
30
|
+
watch(
|
|
31
|
+
() => args.value,
|
|
32
|
+
(v) => {
|
|
33
|
+
innerValue.value = v
|
|
34
|
+
},
|
|
35
|
+
)
|
|
36
|
+
const onSliderChange = (v) => {
|
|
37
|
+
innerValue.value = v
|
|
38
|
+
}
|
|
39
|
+
return { args, innerValue, onSliderChange }
|
|
40
|
+
},
|
|
41
|
+
template: `
|
|
42
|
+
<div data-test-id="slider-story" style="min-width: 320px; padding: 16px;">
|
|
43
|
+
<RcSlider
|
|
44
|
+
:value="innerValue"
|
|
45
|
+
:min-value="args.minValue"
|
|
46
|
+
:max-value="args.maxValue"
|
|
47
|
+
:unit="args.unit"
|
|
48
|
+
@change="onSliderChange"
|
|
49
|
+
/>
|
|
50
|
+
</div>
|
|
51
|
+
`,
|
|
52
|
+
provide: {
|
|
53
|
+
theme,
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
export const Default = Template.bind({})
|
|
58
|
+
Default.args = {
|
|
59
|
+
value: 35,
|
|
60
|
+
minValue: 0,
|
|
61
|
+
maxValue: 100,
|
|
62
|
+
unit: '%',
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const MetersRange = Template.bind({})
|
|
66
|
+
MetersRange.args = {
|
|
67
|
+
value: 120,
|
|
68
|
+
minValue: 10,
|
|
69
|
+
maxValue: 500,
|
|
70
|
+
unit: 'm',
|
|
71
|
+
}
|
|
@@ -28,8 +28,11 @@
|
|
|
28
28
|
<SwitchOption
|
|
29
29
|
v-for="(item, index) in options"
|
|
30
30
|
:key="index"
|
|
31
|
+
:border-color="borderColor"
|
|
31
32
|
:color-mode="colorMode"
|
|
32
33
|
:data-id="item.hasOwnProperty('dataId') ? item.dataId : ''"
|
|
34
|
+
:height="height"
|
|
35
|
+
:inactive-border-color="inactiveBorderColor"
|
|
33
36
|
:inactive-color="inactiveColor"
|
|
34
37
|
:is-active="value == item.value"
|
|
35
38
|
:primary-color="primaryColor"
|
|
@@ -82,6 +85,12 @@
|
|
|
82
85
|
import theme from '../../../assets/theme'
|
|
83
86
|
import RCIcon from '../../icon'
|
|
84
87
|
import IsRequiredLabelStar from '../isRequiredLabelStar'
|
|
88
|
+
import {
|
|
89
|
+
inputLabelFontSize,
|
|
90
|
+
inputLabelFontWeight,
|
|
91
|
+
inputLabelLetterSpacing,
|
|
92
|
+
inputLabelLineHeight,
|
|
93
|
+
} from '../shared/inputLabelTypography'
|
|
85
94
|
const OptionIconContainer = styled.div`
|
|
86
95
|
display: flex;
|
|
87
96
|
align-items: center;
|
|
@@ -114,8 +123,10 @@
|
|
|
114
123
|
}
|
|
115
124
|
const LabelText = styled('div', toggleAttrs)`
|
|
116
125
|
color: ${(props) => props.primaryColor};
|
|
117
|
-
font-size:
|
|
118
|
-
font-weight:
|
|
126
|
+
font-size: ${inputLabelFontSize};
|
|
127
|
+
font-weight: ${inputLabelFontWeight};
|
|
128
|
+
line-height: ${inputLabelLineHeight};
|
|
129
|
+
letter-spacing: ${inputLabelLetterSpacing};
|
|
119
130
|
`
|
|
120
131
|
|
|
121
132
|
const SwitchWrapper = styled('span', toggleAttrs)`
|
|
@@ -131,6 +142,9 @@
|
|
|
131
142
|
inactiveColor: String,
|
|
132
143
|
size: String,
|
|
133
144
|
width: String,
|
|
145
|
+
height: String,
|
|
146
|
+
borderColor: String,
|
|
147
|
+
inactiveBorderColor: String,
|
|
134
148
|
}
|
|
135
149
|
const SwitchOption = styled('div', optionAttrs)`
|
|
136
150
|
color: ${(props) =>
|
|
@@ -139,7 +153,7 @@
|
|
|
139
153
|
props.isActive ? props.secondaryColor : 'transparent'};
|
|
140
154
|
border: 1px solid
|
|
141
155
|
${(props) =>
|
|
142
|
-
props.isActive ? props.
|
|
156
|
+
props.isActive ? props.borderColor : props.inactiveBorderColor};
|
|
143
157
|
display: flex;
|
|
144
158
|
width: ${({ width }) => width};
|
|
145
159
|
word-break: break-word;
|
|
@@ -150,7 +164,9 @@
|
|
|
150
164
|
line-height: 1;
|
|
151
165
|
text-align: center;
|
|
152
166
|
height: ${(props) =>
|
|
153
|
-
props.
|
|
167
|
+
props.height
|
|
168
|
+
? props.height
|
|
169
|
+
: props.size === 'medium'
|
|
154
170
|
? '24px'
|
|
155
171
|
: props.size === 'small'
|
|
156
172
|
? '16px'
|
|
@@ -209,6 +225,11 @@
|
|
|
209
225
|
required: false,
|
|
210
226
|
default: 'small',
|
|
211
227
|
},
|
|
228
|
+
height: {
|
|
229
|
+
required: false,
|
|
230
|
+
default: null,
|
|
231
|
+
type: String,
|
|
232
|
+
},
|
|
212
233
|
labelAlign: {
|
|
213
234
|
required: false,
|
|
214
235
|
default: 'left',
|
|
@@ -249,17 +270,23 @@
|
|
|
249
270
|
primaryColor: 'white',
|
|
250
271
|
secondaryColor: 'black',
|
|
251
272
|
inactiveColor: 'grey6',
|
|
273
|
+
borderColor: 'grey6',
|
|
274
|
+
inactiveBorderColor: 'grey6',
|
|
252
275
|
}
|
|
253
276
|
},
|
|
254
277
|
created() {
|
|
255
278
|
if (this.colorMode == 'dark') {
|
|
256
|
-
this.primaryColor = theme.
|
|
257
|
-
this.secondaryColor = theme.
|
|
258
|
-
this.inactiveColor = theme.
|
|
279
|
+
this.primaryColor = theme.semanticColors.teal[800]
|
|
280
|
+
this.secondaryColor = theme.semanticColors.teal[50]
|
|
281
|
+
this.inactiveColor = theme.semanticColors.teal[50]
|
|
282
|
+
this.borderColor = this.secondaryColor
|
|
283
|
+
this.inactiveBorderColor = theme.semanticColors.teal[600]
|
|
259
284
|
} else {
|
|
260
|
-
this.primaryColor = theme.
|
|
261
|
-
this.secondaryColor = theme.
|
|
262
|
-
this.inactiveColor = theme.
|
|
285
|
+
this.primaryColor = theme.semanticColors.teal[50]
|
|
286
|
+
this.secondaryColor = theme.semanticColors.teal[800]
|
|
287
|
+
this.inactiveColor = theme.semanticColors.teal[50]
|
|
288
|
+
this.borderColor = this.secondaryColor
|
|
289
|
+
this.inactiveBorderColor = theme.semanticColors.teal[50]
|
|
263
290
|
}
|
|
264
291
|
},
|
|
265
292
|
methods: {
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ref } from 'vue'
|
|
2
|
+
import SwitchField from './index.vue'
|
|
3
|
+
import theme from '@/assets/theme'
|
|
4
|
+
|
|
5
|
+
const demoOptions = [
|
|
6
|
+
{ value: 0, content: 'Off' },
|
|
7
|
+
{ value: 1, content: 'Auto' },
|
|
8
|
+
{ value: 2, content: 'On' },
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: 'Components/Inputs/SwitchField',
|
|
13
|
+
component: SwitchField,
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
parameters: {
|
|
16
|
+
layout: 'centered',
|
|
17
|
+
},
|
|
18
|
+
argTypes: {
|
|
19
|
+
label: { control: 'text' },
|
|
20
|
+
size: { control: 'select', options: ['small', 'medium'] },
|
|
21
|
+
disabled: { control: 'boolean' },
|
|
22
|
+
colorMode: { control: 'select', options: ['light', 'dark'] },
|
|
23
|
+
alignItems: { control: 'select', options: ['horizontal', 'vertical'] },
|
|
24
|
+
infoTextMessage: { control: 'text' },
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const Template = (args) => ({
|
|
29
|
+
components: { SwitchField },
|
|
30
|
+
setup() {
|
|
31
|
+
const value = ref(args.value)
|
|
32
|
+
return { args, value, demoOptions }
|
|
33
|
+
},
|
|
34
|
+
template: `
|
|
35
|
+
<div data-test-id="switch-field-story" style="padding: 16px; min-width: 280px;">
|
|
36
|
+
<SwitchField
|
|
37
|
+
v-bind="args"
|
|
38
|
+
:options="demoOptions"
|
|
39
|
+
:value="value"
|
|
40
|
+
@on-switch-change="value = $event"
|
|
41
|
+
/>
|
|
42
|
+
<p style="margin-top: 12px; font-size: 12px; color: #666;">Selected value: {{ value }}</p>
|
|
43
|
+
</div>
|
|
44
|
+
`,
|
|
45
|
+
provide: {
|
|
46
|
+
theme,
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
export const ThreeWaySwitch = Template.bind({})
|
|
51
|
+
ThreeWaySwitch.args = {
|
|
52
|
+
label: 'Fan speed',
|
|
53
|
+
value: 1,
|
|
54
|
+
size: 'small',
|
|
55
|
+
disabled: false,
|
|
56
|
+
colorMode: 'light',
|
|
57
|
+
alignItems: 'horizontal',
|
|
58
|
+
infoTextMessage: '',
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const WithInfoText = Template.bind({})
|
|
62
|
+
WithInfoText.args = {
|
|
63
|
+
...ThreeWaySwitch.args,
|
|
64
|
+
infoTextMessage: 'Applies to this location only.',
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const Disabled = Template.bind({})
|
|
68
|
+
Disabled.args = {
|
|
69
|
+
...ThreeWaySwitch.args,
|
|
70
|
+
disabled: true,
|
|
71
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
:has-label="label && label.length > 0"
|
|
6
6
|
>
|
|
7
7
|
<LabelWrapper v-if="label">
|
|
8
|
-
<InputLabel :data-id="labelDataId"
|
|
8
|
+
<InputLabel :data-id="labelDataId">
|
|
9
9
|
{{ label }}
|
|
10
10
|
<IsRequiredLabelStar v-if="isRequiredLabel" />
|
|
11
11
|
</InputLabel>
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
:app-theme="appTheme"
|
|
16
16
|
:disabled="isDisabled"
|
|
17
17
|
:font-size="fontSize"
|
|
18
|
+
:input-padding="inputPadding"
|
|
18
19
|
:input-width="inputWidth"
|
|
19
20
|
:is-error="isError"
|
|
20
21
|
>
|
|
@@ -58,12 +59,17 @@
|
|
|
58
59
|
import InfoText from '../../infoText'
|
|
59
60
|
import ErrorMessage from '../../errorMessage'
|
|
60
61
|
import IsRequiredLabelStar from '../isRequiredLabelStar'
|
|
62
|
+
import {
|
|
63
|
+
inputLabelFontSize,
|
|
64
|
+
inputLabelFontWeight,
|
|
65
|
+
inputLabelLetterSpacing,
|
|
66
|
+
inputLabelLineHeight,
|
|
67
|
+
} from '../shared/inputLabelTypography'
|
|
61
68
|
|
|
62
69
|
const containerProps = { inputWidth: String }
|
|
63
70
|
const Container = styled('div', containerProps)`
|
|
64
71
|
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
|
65
72
|
position: relative;
|
|
66
|
-
margin-bottom: 20px;
|
|
67
73
|
`
|
|
68
74
|
|
|
69
75
|
const LabelWrapper = styled.div`
|
|
@@ -80,6 +86,7 @@
|
|
|
80
86
|
fontSize: String,
|
|
81
87
|
inputWidth: String,
|
|
82
88
|
appTheme: String,
|
|
89
|
+
inputPadding: String,
|
|
83
90
|
}
|
|
84
91
|
|
|
85
92
|
const InputContainer = styled('div', inputProps)`
|
|
@@ -88,8 +95,7 @@
|
|
|
88
95
|
props.isError
|
|
89
96
|
? `1px solid ${props.theme.colors.red} !important`
|
|
90
97
|
: `1px solid ${props.theme.colors.grey4} !important`};
|
|
91
|
-
padding: ${(props) =>
|
|
92
|
-
props.hasUnit ? '11px 40px 11px 10px !important' : '15px !important'};
|
|
98
|
+
padding: ${(props) => props.inputPadding + ' !important'};
|
|
93
99
|
border-radius: 4px !important;
|
|
94
100
|
font-size: ${(props) => `${props.fontSize} !important`};
|
|
95
101
|
color: ${({ appTheme, theme }) =>
|
|
@@ -129,8 +135,11 @@
|
|
|
129
135
|
|
|
130
136
|
const labelAttrs = { fontSize: String }
|
|
131
137
|
const InputLabel = styled('div', labelAttrs)`
|
|
132
|
-
font-
|
|
133
|
-
|
|
138
|
+
font-size: ${(props) =>
|
|
139
|
+
props.fontSize ? props.fontSize : inputLabelFontSize};
|
|
140
|
+
font-weight: ${inputLabelFontWeight};
|
|
141
|
+
line-height: ${inputLabelLineHeight};
|
|
142
|
+
letter-spacing: ${inputLabelLetterSpacing};
|
|
134
143
|
`
|
|
135
144
|
|
|
136
145
|
export default {
|
|
@@ -218,6 +227,10 @@
|
|
|
218
227
|
type: String,
|
|
219
228
|
default: 'light',
|
|
220
229
|
},
|
|
230
|
+
inputPadding: {
|
|
231
|
+
required: false,
|
|
232
|
+
default: '15px',
|
|
233
|
+
},
|
|
221
234
|
},
|
|
222
235
|
methods: {
|
|
223
236
|
onChangeHandler($event) {
|
|
@@ -94,6 +94,12 @@
|
|
|
94
94
|
import styled from 'vue3-styled-components'
|
|
95
95
|
import InfoText from '../../infoText'
|
|
96
96
|
import IsRequiredLabelStar from '../isRequiredLabelStar'
|
|
97
|
+
import {
|
|
98
|
+
inputLabelFontSize,
|
|
99
|
+
inputLabelFontWeight,
|
|
100
|
+
inputLabelLetterSpacing,
|
|
101
|
+
inputLabelLineHeight,
|
|
102
|
+
} from '../shared/inputLabelTypography'
|
|
97
103
|
|
|
98
104
|
const Container = styled.div`
|
|
99
105
|
display: inline-block;
|
|
@@ -123,12 +129,10 @@
|
|
|
123
129
|
const LabelText = styled('div', toggleAttrs)`
|
|
124
130
|
color: ${(props) =>
|
|
125
131
|
props.fontColor ? props.fontColor : props.theme.colors.darkGray};
|
|
126
|
-
font-size: ${
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
? '13px'
|
|
131
|
-
: '16px'};
|
|
132
|
+
font-size: ${inputLabelFontSize};
|
|
133
|
+
font-weight: ${inputLabelFontWeight};
|
|
134
|
+
line-height: ${inputLabelLineHeight};
|
|
135
|
+
letter-spacing: ${inputLabelLetterSpacing};
|
|
132
136
|
`
|
|
133
137
|
|
|
134
138
|
const ToggleWrapper = styled('span', toggleAttrs)`
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<LabelWrapper :label-align="labelAlign">
|
|
3
|
-
<InputLabel
|
|
3
|
+
<InputLabel
|
|
4
|
+
:app-theme="appTheme"
|
|
5
|
+
:font-size="fontSize"
|
|
6
|
+
:label-font-color="labelFontColor"
|
|
7
|
+
>
|
|
4
8
|
<slot></slot>
|
|
5
9
|
<IsRequiredLabelStar v-if="isRequiredLabel" />
|
|
6
10
|
<OptionalLabel v-if="labelOptional">
|
|
@@ -10,6 +14,7 @@
|
|
|
10
14
|
<InfoText
|
|
11
15
|
v-if="infoTextMessage"
|
|
12
16
|
:align-arrow="infoTextAlign"
|
|
17
|
+
:app-theme="appTheme"
|
|
13
18
|
:size="fontSize ? fontSize : '14px'"
|
|
14
19
|
:text="infoTextMessage"
|
|
15
20
|
/>
|
|
@@ -20,18 +25,36 @@
|
|
|
20
25
|
import styled from 'vue3-styled-components'
|
|
21
26
|
import InfoText from '../infoText'
|
|
22
27
|
import IsRequiredLabelStar from '../inputs/isRequiredLabelStar'
|
|
28
|
+
import {
|
|
29
|
+
inputLabelFontSize,
|
|
30
|
+
inputLabelFontWeight,
|
|
31
|
+
inputLabelLetterSpacing,
|
|
32
|
+
inputLabelLineHeight,
|
|
33
|
+
} from '../inputs/shared/inputLabelTypography'
|
|
23
34
|
|
|
24
|
-
const labelAttrs = {
|
|
35
|
+
const labelAttrs = {
|
|
36
|
+
appTheme: String,
|
|
37
|
+
fontSize: String,
|
|
38
|
+
labelFontColor: String,
|
|
39
|
+
}
|
|
25
40
|
const InputLabel = styled('div', labelAttrs)`
|
|
26
|
-
color: ${(props) =>
|
|
27
|
-
props.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
41
|
+
color: ${(props) => {
|
|
42
|
+
if (props.labelFontColor) {
|
|
43
|
+
return props.theme.colors[props.labelFontColor]
|
|
44
|
+
? props.theme.colors[props.labelFontColor]
|
|
45
|
+
: props.labelFontColor
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return props.appTheme === 'dark'
|
|
49
|
+
? props.theme.colors.white
|
|
50
|
+
: props.theme.colors.black
|
|
51
|
+
}};
|
|
32
52
|
|
|
33
|
-
font-size: ${(props) =>
|
|
34
|
-
|
|
53
|
+
font-size: ${(props) =>
|
|
54
|
+
props.fontSize ? props.fontSize : inputLabelFontSize};
|
|
55
|
+
font-weight: ${inputLabelFontWeight};
|
|
56
|
+
line-height: ${inputLabelLineHeight};
|
|
57
|
+
letter-spacing: ${inputLabelLetterSpacing};
|
|
35
58
|
`
|
|
36
59
|
const OptionalLabel = styled.span`
|
|
37
60
|
font-weight: 300;
|
|
@@ -83,9 +106,14 @@
|
|
|
83
106
|
required: false,
|
|
84
107
|
default: null,
|
|
85
108
|
},
|
|
109
|
+
appTheme: {
|
|
110
|
+
type: String,
|
|
111
|
+
required: false,
|
|
112
|
+
default: 'light',
|
|
113
|
+
},
|
|
86
114
|
labelFontColor: {
|
|
87
115
|
required: false,
|
|
88
|
-
default:
|
|
116
|
+
default: null,
|
|
89
117
|
},
|
|
90
118
|
labelAlign: {
|
|
91
119
|
required: false,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import LabelText from './index.vue'
|
|
2
|
+
import theme from '@/assets/theme'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Components/Label/Label',
|
|
6
|
+
component: LabelText,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: {
|
|
9
|
+
labelAlign: {
|
|
10
|
+
control: 'select',
|
|
11
|
+
options: ['vertical', 'horizontal'],
|
|
12
|
+
},
|
|
13
|
+
labelFontColor: { control: 'text' },
|
|
14
|
+
fontSize: { control: 'text' },
|
|
15
|
+
isRequiredLabel: { control: 'boolean' },
|
|
16
|
+
labelOptional: { control: 'boolean' },
|
|
17
|
+
infoTextMessage: { control: 'text' },
|
|
18
|
+
infoTextAlign: { control: 'select', options: ['left', 'right'] },
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const Template = (args) => ({
|
|
23
|
+
components: { LabelText },
|
|
24
|
+
setup() {
|
|
25
|
+
return { args }
|
|
26
|
+
},
|
|
27
|
+
template: `
|
|
28
|
+
<div data-test-id="label-story" style="padding: 16px; max-width: 420px;">
|
|
29
|
+
<LabelText v-bind="args">
|
|
30
|
+
{{ args.slotLabel }}
|
|
31
|
+
</LabelText>
|
|
32
|
+
</div>
|
|
33
|
+
`,
|
|
34
|
+
provide: {
|
|
35
|
+
theme,
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
export const Default = Template.bind({})
|
|
40
|
+
Default.args = {
|
|
41
|
+
slotLabel: 'Project name',
|
|
42
|
+
labelAlign: 'vertical',
|
|
43
|
+
isRequiredLabel: false,
|
|
44
|
+
labelOptional: false,
|
|
45
|
+
infoTextMessage: '',
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const RequiredField = Template.bind({})
|
|
49
|
+
RequiredField.args = {
|
|
50
|
+
...Default.args,
|
|
51
|
+
slotLabel: 'Legal entity',
|
|
52
|
+
isRequiredLabel: true,
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const OptionalWithHint = Template.bind({})
|
|
56
|
+
OptionalWithHint.args = {
|
|
57
|
+
...Default.args,
|
|
58
|
+
slotLabel: 'Nickname',
|
|
59
|
+
labelOptional: true,
|
|
60
|
+
infoTextMessage: 'Shown on invoices only.',
|
|
61
|
+
infoTextAlign: 'left',
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const HorizontalLayout = Template.bind({})
|
|
65
|
+
HorizontalLayout.args = {
|
|
66
|
+
...Default.args,
|
|
67
|
+
slotLabel: 'Budget (CHF)',
|
|
68
|
+
labelAlign: 'horizontal',
|
|
69
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import MarkerItem from './index.vue'
|
|
2
|
+
import theme from '@/assets/theme'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Components/MarkerItem/MarkerItem',
|
|
6
|
+
component: MarkerItem,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
label: { control: 'text' },
|
|
13
|
+
iconName: { control: 'text' },
|
|
14
|
+
backgroundColor: { control: 'text' },
|
|
15
|
+
cursor: { control: 'text' },
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const Template = (args) => ({
|
|
20
|
+
components: { MarkerItem },
|
|
21
|
+
setup() {
|
|
22
|
+
return { args }
|
|
23
|
+
},
|
|
24
|
+
template: `
|
|
25
|
+
<div data-test-id="marker-item-story" style="padding: 16px;">
|
|
26
|
+
<MarkerItem v-bind="args" />
|
|
27
|
+
</div>
|
|
28
|
+
`,
|
|
29
|
+
provide: {
|
|
30
|
+
theme,
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
export const Default = Template.bind({})
|
|
35
|
+
Default.args = {
|
|
36
|
+
label: 'Highlights',
|
|
37
|
+
iconName: 'House',
|
|
38
|
+
backgroundColor: 'blue4',
|
|
39
|
+
cursor: 'pointer',
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const TextOnly = Template.bind({})
|
|
43
|
+
TextOnly.args = {
|
|
44
|
+
label: 'No icon variant',
|
|
45
|
+
cursor: 'default',
|
|
46
|
+
}
|
|
@@ -22,21 +22,12 @@
|
|
|
22
22
|
import styled from 'vue3-styled-components'
|
|
23
23
|
import RCModal from '../modal'
|
|
24
24
|
import RCMainButton from '../../buttons/mainButton'
|
|
25
|
-
|
|
25
|
+
import ModalTitle from '../modalTitle'
|
|
26
26
|
const ModalContainer = styled.div`
|
|
27
27
|
width: 450px;
|
|
28
28
|
min-height: 205px;
|
|
29
29
|
padding: 40px 40px 30px 40px;
|
|
30
30
|
`
|
|
31
|
-
const ModalTitle = styled.div`
|
|
32
|
-
color: ${(props) => props.theme.colors.black};
|
|
33
|
-
font-family: inherit;
|
|
34
|
-
font-size: 18px;
|
|
35
|
-
font-style: normal;
|
|
36
|
-
font-weight: 700;
|
|
37
|
-
line-height: 120%;
|
|
38
|
-
text-transform: uppercase;
|
|
39
|
-
`
|
|
40
31
|
const ButtonContainer = styled.div`
|
|
41
32
|
display: inline-flex;
|
|
42
33
|
align-items: flex-start;
|