@eturnity/eturnity_reusable_components 8.26.2 → 8.26.4--EPDM-15979.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/main.es2.js +4 -4
- package/dist/main.es21.js +1 -1
- package/dist/main.es9.js +23 -5
- package/package.json +1 -1
- package/src/App.vue +3 -3
- package/src/components/buttons/buttonIcon/index.vue +26 -1
- package/src/components/infoText/index.vue +1 -1
- package/src/components/inputs/inputNumber/index.vue +3 -2
- package/src/components/progressStep/index.vue +129 -0
- package/src/components/progressStep/progressStep.stories.js +58 -0
- package/src/components/tag/conversionTag/index.vue +37 -0
- package/src/components/tag/{proTag → freeTrialTag}/index.vue +10 -4
- package/src/helpers/numberConverter.js +10 -1
package/dist/main.es2.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ThemeProvider } from "./main.es7.js";
|
2
2
|
import theme from "./main.es8.js";
|
3
|
-
import
|
3
|
+
import ConversionTag from "./main.es9.js";
|
4
4
|
import "./main.es3.js";
|
5
5
|
import "./main.es10.js";
|
6
6
|
import _export_sfc from "./main.es11.js";
|
@@ -9,7 +9,7 @@ const _sfc_main = {
|
|
9
9
|
name: "App",
|
10
10
|
components: {
|
11
11
|
ThemeProvider,
|
12
|
-
|
12
|
+
ConversionTag
|
13
13
|
},
|
14
14
|
setup() {
|
15
15
|
return {
|
@@ -19,7 +19,7 @@ const _sfc_main = {
|
|
19
19
|
};
|
20
20
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
21
21
|
const _component_RouterView = resolveComponent("RouterView");
|
22
|
-
const
|
22
|
+
const _component_ConversionTag = resolveComponent("ConversionTag");
|
23
23
|
const _component_ThemeProvider = resolveComponent("ThemeProvider");
|
24
24
|
return openBlock(), createBlock(_component_ThemeProvider, {
|
25
25
|
style: {
|
@@ -27,7 +27,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
27
27
|
},
|
28
28
|
theme: $setup.theme
|
29
29
|
}, {
|
30
|
-
default: withCtx(() => [createVNode(_component_RouterView), createTextVNode(), createVNode(
|
30
|
+
default: withCtx(() => [createVNode(_component_RouterView), createTextVNode(), createVNode(_component_ConversionTag)]),
|
31
31
|
_: 1
|
32
32
|
}, 8, ["theme"]);
|
33
33
|
}
|
package/dist/main.es21.js
CHANGED
package/dist/main.es9.js
CHANGED
@@ -3,9 +3,27 @@ import "./main.es3.js";
|
|
3
3
|
import _export_sfc from "./main.es11.js";
|
4
4
|
import { resolveComponent, openBlock, createBlock } from "./main.es6.js";
|
5
5
|
const _sfc_main = {
|
6
|
-
name: "
|
6
|
+
name: "ConversionTag",
|
7
7
|
components: {
|
8
8
|
RCButton
|
9
|
+
},
|
10
|
+
props: {
|
11
|
+
text: {
|
12
|
+
type: String,
|
13
|
+
default: "PRO"
|
14
|
+
},
|
15
|
+
isUpperCase: {
|
16
|
+
type: Boolean,
|
17
|
+
default: true
|
18
|
+
}
|
19
|
+
},
|
20
|
+
computed: {
|
21
|
+
textToDisplay() {
|
22
|
+
if (this.isUpperCase) {
|
23
|
+
return this.text.toUpperCase();
|
24
|
+
}
|
25
|
+
return this.text;
|
26
|
+
}
|
9
27
|
}
|
10
28
|
};
|
11
29
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
@@ -14,12 +32,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
14
32
|
"button-size": "tiny",
|
15
33
|
icon: "star",
|
16
34
|
"icon-color": "yellow",
|
17
|
-
text:
|
35
|
+
text: $options.textToDisplay,
|
18
36
|
type: "protag",
|
19
37
|
variant: "main"
|
20
|
-
});
|
38
|
+
}, null, 8, ["text"]);
|
21
39
|
}
|
22
|
-
const
|
40
|
+
const ConversionTag = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
23
41
|
export {
|
24
|
-
|
42
|
+
ConversionTag as default
|
25
43
|
};
|
package/package.json
CHANGED
package/src/App.vue
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
<template>
|
2
2
|
<ThemeProvider :style="{ height: '100%' }" :theme="theme">
|
3
3
|
<RouterView />
|
4
|
-
<
|
4
|
+
<ConversionTag />
|
5
5
|
</ThemeProvider>
|
6
6
|
</template>
|
7
7
|
|
8
8
|
<script>
|
9
9
|
import { ThemeProvider } from 'vue3-styled-components'
|
10
10
|
import theme from '@/assets/theme.js'
|
11
|
-
import
|
11
|
+
import ConversionTag from '@/components/tag/conversionTag'
|
12
12
|
export default {
|
13
13
|
name: 'App',
|
14
14
|
components: {
|
15
15
|
ThemeProvider,
|
16
|
-
|
16
|
+
ConversionTag,
|
17
17
|
},
|
18
18
|
setup() {
|
19
19
|
return {
|
@@ -50,6 +50,7 @@
|
|
50
50
|
numberCount
|
51
51
|
}}</NumberText>
|
52
52
|
</NumberContainer>
|
53
|
+
<BetaTag v-if="isBeta" :is-disabled="isDisabled"> Beta </BetaTag>
|
53
54
|
</ButtonWrapper>
|
54
55
|
</PageContainer>
|
55
56
|
</template>
|
@@ -70,7 +71,9 @@
|
|
70
71
|
import styled from 'vue3-styled-components'
|
71
72
|
import Theme from '@/assets/theme'
|
72
73
|
|
73
|
-
const PageContainer = styled.div
|
74
|
+
const PageContainer = styled.div`
|
75
|
+
position: relative;
|
76
|
+
`
|
74
77
|
|
75
78
|
const ButtonAttrs = {
|
76
79
|
type: String,
|
@@ -200,6 +203,23 @@
|
|
200
203
|
background-color: ${(props) => props.theme.semanticColors.purple[50]};
|
201
204
|
`
|
202
205
|
|
206
|
+
const BetaTag = styled('div', { isDisabled: Boolean })`
|
207
|
+
position: absolute;
|
208
|
+
top: -5px;
|
209
|
+
right: -8px;
|
210
|
+
padding: 4px;
|
211
|
+
border-radius: 4px;
|
212
|
+
font-size: 10px;
|
213
|
+
background-color: ${(props) =>
|
214
|
+
props.isDisabled
|
215
|
+
? props.theme.colors.disabled
|
216
|
+
: props.theme.semanticColors.red[500]};
|
217
|
+
color: ${(props) => props.theme.colors.white};
|
218
|
+
font-weight: 700;
|
219
|
+
transform: rotate(20deg);
|
220
|
+
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
|
221
|
+
`
|
222
|
+
|
203
223
|
export default {
|
204
224
|
name: 'ButtonIcon',
|
205
225
|
components: {
|
@@ -210,6 +230,7 @@
|
|
210
230
|
Icon,
|
211
231
|
NumberContainer,
|
212
232
|
NumberText,
|
233
|
+
BetaTag,
|
213
234
|
},
|
214
235
|
props: {
|
215
236
|
type: {
|
@@ -293,6 +314,10 @@
|
|
293
314
|
type: String,
|
294
315
|
default: 'auto',
|
295
316
|
},
|
317
|
+
isBeta: {
|
318
|
+
type: Boolean,
|
319
|
+
default: false,
|
320
|
+
},
|
296
321
|
},
|
297
322
|
data() {
|
298
323
|
return {
|
@@ -230,6 +230,7 @@
|
|
230
230
|
//</inputNumber>
|
231
231
|
import styled from 'vue3-styled-components'
|
232
232
|
import {
|
233
|
+
roundViaInteger,
|
233
234
|
stringToNumber,
|
234
235
|
numberToString,
|
235
236
|
} from '../../../helpers/numberConverter'
|
@@ -861,7 +862,7 @@
|
|
861
862
|
this.inputValue = this.value
|
862
863
|
this.enteredValue =
|
863
864
|
typeof this.value === 'number' && !isNaN(this.value)
|
864
|
-
?
|
865
|
+
? roundViaInteger(this.value, this.numberPrecision)
|
865
866
|
: this.value
|
866
867
|
}
|
867
868
|
},
|
@@ -965,7 +966,7 @@
|
|
965
966
|
minDecimals: this.minDecimals,
|
966
967
|
})
|
967
968
|
} else if (typeof evaluated === 'number') {
|
968
|
-
evaluated = evaluated
|
969
|
+
evaluated = roundViaInteger(evaluated, this.numberPrecision)
|
969
970
|
}
|
970
971
|
return evaluated
|
971
972
|
},
|
@@ -0,0 +1,129 @@
|
|
1
|
+
<template>
|
2
|
+
<ProgressionStepContainer :number-of-steps="progressionSteps.length">
|
3
|
+
<template v-for="(step, stepIndex) in progressionSteps" :key="step.index">
|
4
|
+
<ProgressionStepItem>
|
5
|
+
<BoxContainer
|
6
|
+
:is-active="stepIndex == currentStepIndex"
|
7
|
+
:is-valid="stepIndex < currentStepIndex"
|
8
|
+
@click="
|
9
|
+
stepIndex < currentStepIndex ? $emit('on-step-click', step) : null
|
10
|
+
"
|
11
|
+
>
|
12
|
+
<RcIcon
|
13
|
+
v-if="stepIndex < currentStepIndex"
|
14
|
+
color="white"
|
15
|
+
hovered-color="white"
|
16
|
+
name="all_good"
|
17
|
+
:size="'20px'"
|
18
|
+
/>
|
19
|
+
<NumberContainer
|
20
|
+
v-else
|
21
|
+
:is-active="stepIndex === currentStepIndex"
|
22
|
+
:is-valid="stepIndex < currentStepIndex"
|
23
|
+
>
|
24
|
+
{{ step.number }}
|
25
|
+
</NumberContainer>
|
26
|
+
</BoxContainer>
|
27
|
+
<StepLabel>{{ step.label }}</StepLabel>
|
28
|
+
</ProgressionStepItem>
|
29
|
+
<StepIntermediateLine
|
30
|
+
v-if="stepIndex < progressionSteps.length - 1"
|
31
|
+
:is-valid="stepIndex < currentStepIndex"
|
32
|
+
/>
|
33
|
+
</template>
|
34
|
+
</ProgressionStepContainer>
|
35
|
+
</template>
|
36
|
+
|
37
|
+
<script>
|
38
|
+
// import progressStep from "@eturnity/eturnity_reusable_components/src/components/progressStep"
|
39
|
+
//To use:
|
40
|
+
// <ProgressionSteps
|
41
|
+
// :current-step="ProgressionStep"
|
42
|
+
// :progression-steps="ProgressionSteps" [{label,value,number}]
|
43
|
+
// @on-step-click="onStepClick"
|
44
|
+
// />
|
45
|
+
import styled from 'vue3-styled-components'
|
46
|
+
import RcIcon from '../icon'
|
47
|
+
|
48
|
+
const StyledComponents = {
|
49
|
+
ProgressionStepContainer: styled('div', { numberOfSteps: Number })`
|
50
|
+
display: grid;
|
51
|
+
grid-template-columns:
|
52
|
+
repeat(${({ numberOfSteps }) => numberOfSteps - 1}, auto 1fr)
|
53
|
+
auto;
|
54
|
+
justify-content: center;
|
55
|
+
align-items: center;
|
56
|
+
width: 100%;
|
57
|
+
`,
|
58
|
+
ProgressionStepItem: styled.div`
|
59
|
+
display: flex;
|
60
|
+
flex-direction: row;
|
61
|
+
align-items: center;
|
62
|
+
`,
|
63
|
+
BoxContainer: styled('div', {
|
64
|
+
isActive: Boolean,
|
65
|
+
isValid: Boolean,
|
66
|
+
})`
|
67
|
+
display: flex;
|
68
|
+
justify-content: center;
|
69
|
+
align-items: center;
|
70
|
+
width: 32px;
|
71
|
+
height: 32px;
|
72
|
+
font-size: 16px;
|
73
|
+
background-color: ${({ theme, isValid, isActive }) =>
|
74
|
+
isActive
|
75
|
+
? theme.semanticColors.purple[500]
|
76
|
+
: isValid
|
77
|
+
? theme.semanticColors.purple[200]
|
78
|
+
: theme.semanticColors.purple[100]};
|
79
|
+
color: ${({ theme, isValid, isActive }) =>
|
80
|
+
isActive ? theme.colors.white : theme.semanticColors.teal[800]};
|
81
|
+
margin: 0 10px;
|
82
|
+
border-radius: 5px;
|
83
|
+
cursor: ${({ isValid }) => (isValid ? 'pointer' : 'default')};
|
84
|
+
&:hover {
|
85
|
+
${({ theme, isValid, isActive }) =>
|
86
|
+
isValid
|
87
|
+
? 'background-color:' + theme.semanticColors.purple[100] + ';'
|
88
|
+
: ''}
|
89
|
+
}
|
90
|
+
`,
|
91
|
+
StepIntermediateLine: styled('div', { isValid: Boolean })`
|
92
|
+
height: 2px;
|
93
|
+
margin: 0 10px;
|
94
|
+
background-color: ${({ theme, isValid }) =>
|
95
|
+
isValid
|
96
|
+
? theme.semanticColors.purple[500]
|
97
|
+
: theme.semanticColors.teal[200]};
|
98
|
+
`,
|
99
|
+
StepLabel: styled.div`
|
100
|
+
max-width: 220px;
|
101
|
+
margin: 0 10px;
|
102
|
+
`,
|
103
|
+
NumberContainer: styled.div``,
|
104
|
+
}
|
105
|
+
export default {
|
106
|
+
name: 'ProgressionSteps',
|
107
|
+
components: {
|
108
|
+
...StyledComponents,
|
109
|
+
RcIcon,
|
110
|
+
},
|
111
|
+
props: {
|
112
|
+
progressionSteps: {
|
113
|
+
type: Array,
|
114
|
+
required: true,
|
115
|
+
},
|
116
|
+
currentStep: {
|
117
|
+
type: String,
|
118
|
+
required: true,
|
119
|
+
},
|
120
|
+
},
|
121
|
+
computed: {
|
122
|
+
currentStepIndex() {
|
123
|
+
return this.progressionSteps.findIndex(
|
124
|
+
(step) => step.value === this.currentStep
|
125
|
+
)
|
126
|
+
},
|
127
|
+
},
|
128
|
+
}
|
129
|
+
</script>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import progressStep from './index.vue'
|
2
|
+
|
3
|
+
export default {
|
4
|
+
title: 'progressStep',
|
5
|
+
component: progressStep,
|
6
|
+
tags: ['autodocs'],
|
7
|
+
parameters: {
|
8
|
+
layout: 'centered',
|
9
|
+
},
|
10
|
+
}
|
11
|
+
|
12
|
+
// import progressStep from "@eturnity/eturnity_reusable_components/src/components/progressStep"
|
13
|
+
//To use:
|
14
|
+
// <ProgressionSteps
|
15
|
+
// :current-step="ProgressionStep"
|
16
|
+
// :progression-steps="ProgressionSteps" [{label,value,number}]
|
17
|
+
// @on-step-click="onStepClick"
|
18
|
+
// />
|
19
|
+
|
20
|
+
const PROGRESSION_STEP_LIST = [
|
21
|
+
{
|
22
|
+
label: 'progression step label 1',
|
23
|
+
value: 'step1',
|
24
|
+
number: 1,
|
25
|
+
},
|
26
|
+
{
|
27
|
+
label: 'progression step label 2',
|
28
|
+
value: 'step2',
|
29
|
+
number: 2,
|
30
|
+
},
|
31
|
+
{
|
32
|
+
label: 'progression step label 3',
|
33
|
+
value: 'step3',
|
34
|
+
number: 3,
|
35
|
+
},
|
36
|
+
]
|
37
|
+
|
38
|
+
export const Default = {
|
39
|
+
args: {
|
40
|
+
'current-step': 'step1',
|
41
|
+
'progression-steps': PROGRESSION_STEP_LIST,
|
42
|
+
},
|
43
|
+
}
|
44
|
+
|
45
|
+
export const Template = {
|
46
|
+
args: {
|
47
|
+
...Default.args,
|
48
|
+
},
|
49
|
+
render: (args) => ({
|
50
|
+
components: { progressStep },
|
51
|
+
setup() {
|
52
|
+
return { args }
|
53
|
+
},
|
54
|
+
template: `
|
55
|
+
<progressStep v-bind="args"/>
|
56
|
+
`,
|
57
|
+
}),
|
58
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<template>
|
2
|
+
<RCButton
|
3
|
+
button-size="tiny"
|
4
|
+
icon="star"
|
5
|
+
icon-color="yellow"
|
6
|
+
:text="textToDisplay"
|
7
|
+
type="protag"
|
8
|
+
variant="main"
|
9
|
+
/>
|
10
|
+
</template>
|
11
|
+
<script>
|
12
|
+
import RCButton from '../../buttons/mainButton'
|
13
|
+
export default {
|
14
|
+
name: 'ConversionTag',
|
15
|
+
components: {
|
16
|
+
RCButton,
|
17
|
+
},
|
18
|
+
props: {
|
19
|
+
text: {
|
20
|
+
type: String,
|
21
|
+
default: 'PRO',
|
22
|
+
},
|
23
|
+
isUpperCase: {
|
24
|
+
type: Boolean,
|
25
|
+
default: true,
|
26
|
+
},
|
27
|
+
},
|
28
|
+
computed: {
|
29
|
+
textToDisplay() {
|
30
|
+
if (this.isUpperCase) {
|
31
|
+
return this.text.toUpperCase()
|
32
|
+
}
|
33
|
+
return this.text
|
34
|
+
},
|
35
|
+
},
|
36
|
+
}
|
37
|
+
</script>
|
@@ -2,18 +2,24 @@
|
|
2
2
|
<RCButton
|
3
3
|
button-size="tiny"
|
4
4
|
icon="star"
|
5
|
-
icon-color="
|
6
|
-
text="
|
7
|
-
type="
|
5
|
+
icon-color="blue"
|
6
|
+
:text="text || $gettext('free_trial')"
|
7
|
+
type="freeTrialTag"
|
8
8
|
variant="main"
|
9
9
|
/>
|
10
10
|
</template>
|
11
11
|
<script>
|
12
12
|
import RCButton from '../../buttons/mainButton'
|
13
13
|
export default {
|
14
|
-
name: '
|
14
|
+
name: 'FreeTrialTag',
|
15
15
|
components: {
|
16
16
|
RCButton,
|
17
17
|
},
|
18
|
+
props: {
|
19
|
+
text: {
|
20
|
+
type: String,
|
21
|
+
default: '',
|
22
|
+
},
|
23
|
+
},
|
18
24
|
}
|
19
25
|
</script>
|
@@ -87,11 +87,20 @@ export const stringToNumber = ({
|
|
87
87
|
}
|
88
88
|
newVal = parseFloat(newVal)
|
89
89
|
if (numberPrecision !== false) {
|
90
|
-
newVal = newVal
|
90
|
+
newVal = roundViaInteger(newVal, numberPrecision)
|
91
91
|
}
|
92
92
|
return parseFloat(newVal)
|
93
93
|
}
|
94
94
|
|
95
|
+
export const roundViaInteger = (value, numberPrecision) => {
|
96
|
+
if (typeof value === 'string') {
|
97
|
+
value = parseFloat(value)
|
98
|
+
}
|
99
|
+
const factor = Math.pow(10, numberPrecision)
|
100
|
+
const roundedValue = Math.round(value * factor) / factor
|
101
|
+
return roundedValue
|
102
|
+
}
|
103
|
+
|
95
104
|
export const numberToString = ({ value, numberPrecision, minDecimals }) => {
|
96
105
|
const minimumRounding = minDecimals ? minDecimals : 0
|
97
106
|
value = !Number.isNaN(parseFloat(value)) ? parseFloat(value) : 0
|