@eturnity/eturnity_reusable_components 1.1.22 → 1.1.25
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/.storybook/main.js +6 -2
- package/.storybook/preview.js +30 -3
- package/package.json +3 -2
- package/src/components/addNewButton/AddNewButton.stories.js +24 -0
- package/src/components/buttons/closeButton/CloseButton.stories.js +29 -0
- package/src/components/deleteIcon/DeleteIcon.stories.js +29 -0
- package/src/components/deleteIcon/index.vue +1 -1
- package/src/components/inputs/checkbox/Checkbox.stories.js +57 -0
- package/src/components/inputs/inputNumber/InputNumber.stories.js +149 -0
- package/src/components/inputs/inputNumber/index.vue +1 -1
- package/src/components/inputs/inputText/InputText.stories.js +73 -0
- package/src/components/inputs/inputText/index.vue +2 -1
- package/src/components/inputs/radioButton/RadioButton.stories.js +58 -0
- package/src/components/inputs/searchInput/SearchInput.stories.js +40 -0
- package/src/components/inputs/searchInput/index.vue +14 -2
- package/src/components/inputs/textAreaInput/TextAreaInput.stories.js +135 -0
- package/src/components/inputs/textAreaInput/index.vue +16 -2
- package/src/components/inputs/toggle/Toggle.stories.js +77 -0
- package/src/components/inputs/toggle/index.vue +1 -1
- package/src/components/tables/mainTable/index.vue +1 -0
- package/src/helpers/numberConverter.js +11 -2
package/.storybook/main.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
stories: ["../src/components/**/*.stories
|
|
3
|
-
addons: [
|
|
2
|
+
stories: ["../src/components/**/*.stories.@(js|mdx)"],
|
|
3
|
+
addons: [
|
|
4
|
+
"@storybook/addon-links",
|
|
5
|
+
"@storybook/addon-essentials",
|
|
6
|
+
"@storybook/addon-docs",
|
|
7
|
+
],
|
|
4
8
|
}
|
package/.storybook/preview.js
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
import { ThemeProvider } from "vue-styled-components"
|
|
2
2
|
|
|
3
3
|
const theme = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
colors: {
|
|
5
|
+
primary: "#48a2d0",
|
|
6
|
+
secondary: "#fdb813",
|
|
7
|
+
tertiary: "#d5d5d5",
|
|
8
|
+
black: "#353535",
|
|
9
|
+
yellow: "#fdb813",
|
|
10
|
+
darkGray: "#818181",
|
|
11
|
+
gray1: "#666",
|
|
12
|
+
mediumGray: "#d5d5d5",
|
|
13
|
+
lightGray: "#f2f2f2",
|
|
14
|
+
white: "#fff",
|
|
15
|
+
blue: "#48a2d0",
|
|
16
|
+
red: "#ff7e7e",
|
|
17
|
+
blue1: "#e4efff",
|
|
18
|
+
grey1: "#666",
|
|
19
|
+
grey2: "#c4c4c4",
|
|
20
|
+
grey3: "#b2b9c5",
|
|
21
|
+
grey4: "#ebeef4",
|
|
22
|
+
grey5: "#fafafa",
|
|
23
|
+
green: "#99db0c",
|
|
24
|
+
disabled: "#dfe1e1",
|
|
25
|
+
},
|
|
26
|
+
screen: {
|
|
27
|
+
mobileSmall: "345px",
|
|
28
|
+
mobile: "425px",
|
|
29
|
+
mobileLarge: "530px",
|
|
30
|
+
tablet: "768px",
|
|
31
|
+
tabletLarge: "950px",
|
|
32
|
+
},
|
|
33
|
+
borderRadius: "4px",
|
|
7
34
|
}
|
|
8
35
|
|
|
9
36
|
export const decorators = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eturnity/eturnity_reusable_components",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.25",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vue-cli-service serve",
|
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@storybook/addon-actions": "^6.2.8",
|
|
20
|
+
"@storybook/addon-docs": "^6.4.19",
|
|
20
21
|
"@storybook/addon-essentials": "^6.2.8",
|
|
21
22
|
"@storybook/addon-links": "^6.2.8",
|
|
22
|
-
"@storybook/
|
|
23
|
+
"@storybook/vue": "^6.4.19",
|
|
23
24
|
"@vue/cli-plugin-babel": "~4.5.0",
|
|
24
25
|
"@vue/cli-plugin-eslint": "~4.5.0",
|
|
25
26
|
"@vue/cli-service": "~4.5.0",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import AddNewButton from "./index.vue"
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "AddNewButton",
|
|
5
|
+
component: AddNewButton,
|
|
6
|
+
// argTypes: {},
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Template = (args, { argTypes }) => ({
|
|
10
|
+
// Components used in your story `template` are defined in the `components` object
|
|
11
|
+
components: { AddNewButton },
|
|
12
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
13
|
+
props: Object.keys(argTypes),
|
|
14
|
+
template: '<add-new-button v-bind="$props" />',
|
|
15
|
+
|
|
16
|
+
// import AddNewButton from "@eturnity/eturnity_reusable_components/src/components/addNewButton"
|
|
17
|
+
// To use:
|
|
18
|
+
// <add-new-button :shouldPosition="true" />
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
export const Default = Template.bind({})
|
|
22
|
+
Default.args = {
|
|
23
|
+
shouldPosition: true,
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import CloseButton from "./index.vue"
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "CloseButton",
|
|
5
|
+
component: CloseButton,
|
|
6
|
+
// argTypes: {},
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Template = (args, { argTypes }) => ({
|
|
10
|
+
// Components used in your story `template` are defined in the `components` object
|
|
11
|
+
components: { CloseButton },
|
|
12
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
13
|
+
props: Object.keys(argTypes),
|
|
14
|
+
template: '<close-button v-bind="$props" />',
|
|
15
|
+
|
|
16
|
+
// To use:
|
|
17
|
+
// import CloseButton from "@eturnity/eturnity_reusable_components/src/components/buttons/closeButton"
|
|
18
|
+
// <close-button
|
|
19
|
+
// color="#fff"
|
|
20
|
+
// />
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export const Default = Template.bind({})
|
|
24
|
+
Default.args = {}
|
|
25
|
+
|
|
26
|
+
export const ColorButton = Template.bind({})
|
|
27
|
+
ColorButton.args = {
|
|
28
|
+
color: "orange",
|
|
29
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import DeleteIcon from "./index.vue"
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "DeleteIcon",
|
|
5
|
+
component: DeleteIcon,
|
|
6
|
+
// argTypes: {},
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Template = (args, { argTypes }) => ({
|
|
10
|
+
// Components used in your story `template` are defined in the `components` object
|
|
11
|
+
components: { DeleteIcon },
|
|
12
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
13
|
+
props: Object.keys(argTypes),
|
|
14
|
+
template: '<delete-icon v-bind="$props" />',
|
|
15
|
+
|
|
16
|
+
// import DeleteIcon from "@eturnity/eturnity_reusable_components/src/components/deleteIcon"
|
|
17
|
+
// To use:
|
|
18
|
+
// <delete-icon color="gray" @click.native="onDeleteItem(item)" :isDisabled="true" />
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
export const Default = Template.bind({})
|
|
22
|
+
Default.args = {
|
|
23
|
+
isDisabled: false,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const Disabled = Template.bind({})
|
|
27
|
+
Disabled.args = {
|
|
28
|
+
isDisabled: true,
|
|
29
|
+
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
<script>
|
|
19
19
|
// To use:
|
|
20
|
-
// <delete-icon
|
|
20
|
+
// <delete-icon @click.native="onDeleteItem(item)" :isDisabled="true" />
|
|
21
21
|
import styled from "vue-styled-components"
|
|
22
22
|
|
|
23
23
|
const wrapperAttrs = { isDisabled: Boolean }
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import Checkbox from "./index.vue"
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Checkbox",
|
|
5
|
+
component: Checkbox,
|
|
6
|
+
// argTypes: {},
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Template = (args, { argTypes }) => ({
|
|
10
|
+
// Components used in your story `template` are defined in the `components` object
|
|
11
|
+
components: { Checkbox },
|
|
12
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
13
|
+
props: Object.keys(argTypes),
|
|
14
|
+
template: '<checkbox v-bind="$props" />',
|
|
15
|
+
|
|
16
|
+
// import Checkbox from "@eturnity/eturnity_reusable_components/src/components/inputs/checkbox"
|
|
17
|
+
//To use:
|
|
18
|
+
// <checkbox
|
|
19
|
+
// label="Do you accept the Terms?"
|
|
20
|
+
// :isChecked="isChecked" //required
|
|
21
|
+
// @on-event-handler="onInputChange($event)" //required
|
|
22
|
+
// checkColor="blue"
|
|
23
|
+
// size="small"
|
|
24
|
+
// backgroundColor="red"
|
|
25
|
+
// :isDisabled="true"
|
|
26
|
+
// />
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export const Default = Template.bind({})
|
|
30
|
+
Default.args = {
|
|
31
|
+
isChecked: true,
|
|
32
|
+
size: "medium", // "small" or "medium"
|
|
33
|
+
isDisabled: false,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const Small = Template.bind({})
|
|
37
|
+
Small.args = {
|
|
38
|
+
isChecked: true,
|
|
39
|
+
size: "small", // "small" or "medium"
|
|
40
|
+
isDisabled: false,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const CustomColor = Template.bind({})
|
|
44
|
+
CustomColor.args = {
|
|
45
|
+
isChecked: true,
|
|
46
|
+
size: "medium", // "small" or "medium"
|
|
47
|
+
checkColor: "blue",
|
|
48
|
+
backgroundColor: "red",
|
|
49
|
+
isDisabled: false,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const Disabled = Template.bind({})
|
|
53
|
+
Disabled.args = {
|
|
54
|
+
isChecked: false,
|
|
55
|
+
size: "medium", // "small" or "medium"
|
|
56
|
+
isDisabled: true,
|
|
57
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import InputNumber from "./index.vue"
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "InputNumber",
|
|
5
|
+
component: InputNumber,
|
|
6
|
+
// argTypes: {},
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Template = (args, { argTypes }) => ({
|
|
10
|
+
// Components used in your story `template` are defined in the `components` object
|
|
11
|
+
components: { InputNumber },
|
|
12
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
13
|
+
props: Object.keys(argTypes),
|
|
14
|
+
template: '<input-number v-bind="$props" />',
|
|
15
|
+
|
|
16
|
+
// import InputNumber from "@eturnity/eturnity_reusable_components/src/components/inputs/inputNumber"
|
|
17
|
+
// How to use:
|
|
18
|
+
// <input-number
|
|
19
|
+
// placeholder="Enter distance"
|
|
20
|
+
// :isError="false" //default is false
|
|
21
|
+
// inputWidth="150px" //by default, this is 100%
|
|
22
|
+
// :numberPrecision="3"
|
|
23
|
+
// unitName="pc"
|
|
24
|
+
// :value="inputValue" //required -- String
|
|
25
|
+
// @input-change="onInputChange($event)" //required
|
|
26
|
+
// @on-enter-click="onInputSubmit()"
|
|
27
|
+
// :errorMessage="Enter a number between 1 and 10"
|
|
28
|
+
// :disabled="false"
|
|
29
|
+
// :noBorder="true"
|
|
30
|
+
// textAlign="left" // "left, right, center"
|
|
31
|
+
// :showLinearUnitName="true"
|
|
32
|
+
// fontSize="13px"
|
|
33
|
+
// labelText="Number of Modules"
|
|
34
|
+
// labelInfoText="Here is some information for you..."
|
|
35
|
+
// labelInfoAlign="left"
|
|
36
|
+
// />
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
export const Default = Template.bind({})
|
|
40
|
+
Default.args = {
|
|
41
|
+
placeholder: "Enter Value",
|
|
42
|
+
disabled: false,
|
|
43
|
+
value: "",
|
|
44
|
+
inputWidth: "200px",
|
|
45
|
+
unitName: "pc",
|
|
46
|
+
isError: false,
|
|
47
|
+
numberPrecision: 0,
|
|
48
|
+
noBorder: false,
|
|
49
|
+
textAlign: "left",
|
|
50
|
+
showLinearUnitName: false,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const hasError = Template.bind({})
|
|
54
|
+
hasError.args = {
|
|
55
|
+
placeholder: "Enter Value",
|
|
56
|
+
errorMessage: "This field is required",
|
|
57
|
+
isError: true,
|
|
58
|
+
disabled: false,
|
|
59
|
+
inputWidth: "200px",
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const Disabled = Template.bind({})
|
|
63
|
+
Disabled.args = {
|
|
64
|
+
placeholder: "Enter Value",
|
|
65
|
+
disabled: true,
|
|
66
|
+
value: "",
|
|
67
|
+
inputWidth: "200px",
|
|
68
|
+
isError: false,
|
|
69
|
+
numberPrecision: 0,
|
|
70
|
+
noBorder: false,
|
|
71
|
+
textAlign: "left",
|
|
72
|
+
showLinearUnitName: false,
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const LinearUnit = Template.bind({})
|
|
76
|
+
LinearUnit.args = {
|
|
77
|
+
placeholder: "Enter Value",
|
|
78
|
+
disabled: false,
|
|
79
|
+
value: 10,
|
|
80
|
+
inputWidth: "200px",
|
|
81
|
+
unitName: "pc",
|
|
82
|
+
isError: false,
|
|
83
|
+
numberPrecision: 2,
|
|
84
|
+
noBorder: false,
|
|
85
|
+
textAlign: "left",
|
|
86
|
+
showLinearUnitName: true,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const NormalUnit = Template.bind({})
|
|
90
|
+
NormalUnit.args = {
|
|
91
|
+
placeholder: "Enter Value",
|
|
92
|
+
disabled: false,
|
|
93
|
+
value: 10,
|
|
94
|
+
inputWidth: "200px",
|
|
95
|
+
unitName: "pc",
|
|
96
|
+
isError: false,
|
|
97
|
+
numberPrecision: 2,
|
|
98
|
+
noBorder: false,
|
|
99
|
+
textAlign: "left",
|
|
100
|
+
showLinearUnitName: false,
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export const WithLabel = Template.bind({})
|
|
104
|
+
WithLabel.args = {
|
|
105
|
+
placeholder: "Enter Value",
|
|
106
|
+
disabled: false,
|
|
107
|
+
value: 10,
|
|
108
|
+
inputWidth: "200px",
|
|
109
|
+
unitName: "pc",
|
|
110
|
+
isError: false,
|
|
111
|
+
numberPrecision: 2,
|
|
112
|
+
noBorder: false,
|
|
113
|
+
textAlign: "left",
|
|
114
|
+
showLinearUnitName: false,
|
|
115
|
+
labelText: "Number Input",
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export const WithLabelInfo = Template.bind({})
|
|
119
|
+
WithLabelInfo.args = {
|
|
120
|
+
placeholder: "Enter Value",
|
|
121
|
+
disabled: false,
|
|
122
|
+
value: 10,
|
|
123
|
+
inputWidth: "200px",
|
|
124
|
+
unitName: "pc",
|
|
125
|
+
isError: false,
|
|
126
|
+
numberPrecision: 2,
|
|
127
|
+
noBorder: false,
|
|
128
|
+
textAlign: "left",
|
|
129
|
+
showLinearUnitName: false,
|
|
130
|
+
labelText: "Number Input",
|
|
131
|
+
labelInfoText: "Here is some information for you...",
|
|
132
|
+
labelInfoAlign: "right",
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export const LargerFont = Template.bind({})
|
|
136
|
+
LargerFont.args = {
|
|
137
|
+
placeholder: "Enter Value",
|
|
138
|
+
disabled: false,
|
|
139
|
+
value: 10,
|
|
140
|
+
inputWidth: "200px",
|
|
141
|
+
unitName: "pc",
|
|
142
|
+
isError: false,
|
|
143
|
+
numberPrecision: 2,
|
|
144
|
+
noBorder: false,
|
|
145
|
+
textAlign: "left",
|
|
146
|
+
showLinearUnitName: false,
|
|
147
|
+
labelText: "Number Input",
|
|
148
|
+
fontSize: "16px",
|
|
149
|
+
}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
:isError="isError"
|
|
20
20
|
:inputWidth="inputWidth"
|
|
21
21
|
:value="formatWithCurrency(value)"
|
|
22
|
-
:hasLength="value && !!value.length"
|
|
22
|
+
:hasLength="!!value && !!value.length"
|
|
23
23
|
@blur="onInputBlur($event)"
|
|
24
24
|
@focus="focusInput()"
|
|
25
25
|
@keyup.enter="$emit('on-enter-click')"
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import InputText from "./index.vue"
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "InputText",
|
|
5
|
+
component: InputText,
|
|
6
|
+
// argTypes: {},
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Template = (args, { argTypes }) => ({
|
|
10
|
+
// Components used in your story `template` are defined in the `components` object
|
|
11
|
+
components: { InputText },
|
|
12
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
13
|
+
props: Object.keys(argTypes),
|
|
14
|
+
template: '<input-text v-bind="$props" />',
|
|
15
|
+
|
|
16
|
+
// import InputText from "@eturnity/eturnity_reusable_components/src/components/inputs/inputText"
|
|
17
|
+
// To use:
|
|
18
|
+
// <input-text
|
|
19
|
+
// placeholder="Company name"
|
|
20
|
+
// :value="companyName"
|
|
21
|
+
// @input-change="onInputChange({ value: $event, type: 'companyName' })"
|
|
22
|
+
// :isError="checkErrors()"
|
|
23
|
+
// :errorMessage="This is my error message"
|
|
24
|
+
// infoTextAlign="right" // left by default
|
|
25
|
+
// infoTextMessage="My info message"
|
|
26
|
+
// label="Question 5"
|
|
27
|
+
// alignItems="horizontal" // horizontal, vertical
|
|
28
|
+
// inputWidth="250px"
|
|
29
|
+
// />
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
export const Default = Template.bind({})
|
|
33
|
+
Default.args = {
|
|
34
|
+
placeholder: "Company name",
|
|
35
|
+
disabled: false,
|
|
36
|
+
value: "",
|
|
37
|
+
inputWidth: "200px",
|
|
38
|
+
unitName: "pc",
|
|
39
|
+
isError: false,
|
|
40
|
+
textAlign: "left",
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const hasError = Template.bind({})
|
|
44
|
+
hasError.args = {
|
|
45
|
+
placeholder: "Enter Value",
|
|
46
|
+
errorMessage: "This field is required",
|
|
47
|
+
isError: true,
|
|
48
|
+
disabled: false,
|
|
49
|
+
inputWidth: "200px",
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const Disabled = Template.bind({})
|
|
53
|
+
Disabled.args = {
|
|
54
|
+
placeholder: "Enter Value",
|
|
55
|
+
disabled: true,
|
|
56
|
+
value: "",
|
|
57
|
+
inputWidth: "200px",
|
|
58
|
+
isError: false,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const WithLabel = Template.bind({})
|
|
62
|
+
WithLabel.args = {
|
|
63
|
+
placeholder: "Company name",
|
|
64
|
+
disabled: false,
|
|
65
|
+
label: "What is the best company in Switzerland?",
|
|
66
|
+
value: "Eturnity",
|
|
67
|
+
inputWidth: "200px",
|
|
68
|
+
unitName: "pc",
|
|
69
|
+
isError: false,
|
|
70
|
+
errorMessage: "Maximum 5 characters",
|
|
71
|
+
textAlign: "left",
|
|
72
|
+
alignItems: "vertical",
|
|
73
|
+
}
|
|
@@ -68,7 +68,7 @@ const InputContainer = styled("input", inputProps)`
|
|
|
68
68
|
font-size: 16px;
|
|
69
69
|
color: ${(props) =>
|
|
70
70
|
props.isError ? props.theme.colors.red : props.theme.colors.black};
|
|
71
|
-
width: 100
|
|
71
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : "100%")};
|
|
72
72
|
box-sizing: border-box; // to allow width of 100% with padding
|
|
73
73
|
font-weight: 500;
|
|
74
74
|
cursor: ${(props) => (props.isDisabled ? "not-allowed" : "auto")};
|
|
@@ -115,6 +115,7 @@ export default {
|
|
|
115
115
|
// infoTextMessage="My info message"
|
|
116
116
|
// label="Question 5"
|
|
117
117
|
// alignItems="horizontal" // horizontal, vertical
|
|
118
|
+
// inputWidth="250px"
|
|
118
119
|
// />
|
|
119
120
|
name: "input-text",
|
|
120
121
|
components: {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import RadioButton from "./index.vue"
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "RadioButton",
|
|
5
|
+
component: RadioButton,
|
|
6
|
+
// argTypes: {},
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Template = (args, { argTypes }) => ({
|
|
10
|
+
// Components used in your story `template` are defined in the `components` object
|
|
11
|
+
components: { RadioButton },
|
|
12
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
13
|
+
props: Object.keys(argTypes),
|
|
14
|
+
template: '<radio-button v-bind="$props" />',
|
|
15
|
+
|
|
16
|
+
// import RadioButton from "@eturnity/eturnity_reusable_components/src/components/inputs/radioButton"
|
|
17
|
+
// To use:
|
|
18
|
+
// <radio-button
|
|
19
|
+
// :options="radioOptions"
|
|
20
|
+
// :selectedOption="checkedOption"
|
|
21
|
+
// @on-radio-change="onInputChange($event)"
|
|
22
|
+
// layout="vertical"
|
|
23
|
+
// size="large"
|
|
24
|
+
// />
|
|
25
|
+
// Data being passed should look like:
|
|
26
|
+
// radioOptions: [
|
|
27
|
+
// { label: 'Button 1', value: 'button_1', img: 'www.imagesrc.com', infoText: 'my info text' },
|
|
28
|
+
// { label: 'Button 2', value: 'button_2', img: 'www.imagesrc.com', infoText: 'my info text 2' },
|
|
29
|
+
// { label: 'Button 3', value: 'button_3', img: 'www.imagesrc.com', disabled: true },
|
|
30
|
+
// { label: 'Button 4', value: 'button_4', disabled: true }
|
|
31
|
+
// ]
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
export const Default = Template.bind({})
|
|
35
|
+
Default.args = {
|
|
36
|
+
options: [
|
|
37
|
+
{ label: "Button 1", value: "button_1", infoText: "my info text" },
|
|
38
|
+
{ label: "Button 2", value: "button_2", infoText: "my info text 2" },
|
|
39
|
+
{ label: "Button 3", value: "button_3", disabled: true },
|
|
40
|
+
{ label: "Button 4", value: "button_4", disabled: true },
|
|
41
|
+
],
|
|
42
|
+
selectedOption: "button_2",
|
|
43
|
+
layout: "horizontal",
|
|
44
|
+
size: "medium",
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const VerticalLayout = Template.bind({})
|
|
48
|
+
VerticalLayout.args = {
|
|
49
|
+
options: [
|
|
50
|
+
{ label: "Button 1", value: "button_1" },
|
|
51
|
+
{ label: "Button 2", value: "button_2" },
|
|
52
|
+
{ label: "Button 3", value: "button_3" },
|
|
53
|
+
{ label: "Button 4", value: "button_4", disabled: true },
|
|
54
|
+
],
|
|
55
|
+
selectedOption: "button_2",
|
|
56
|
+
layout: "vertical",
|
|
57
|
+
size: "medium",
|
|
58
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import SearchInput from "./index.vue"
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "SearchInput",
|
|
5
|
+
component: SearchInput,
|
|
6
|
+
// argTypes: {},
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Template = (args, { argTypes }) => ({
|
|
10
|
+
// Components used in your story `template` are defined in the `components` object
|
|
11
|
+
components: { SearchInput },
|
|
12
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
13
|
+
props: Object.keys(argTypes),
|
|
14
|
+
template: '<search-input v-bind="$props" />',
|
|
15
|
+
|
|
16
|
+
// import SearchInput from "@eturnity/eturnity_reusable_components/src/components/inputs/searchInput"
|
|
17
|
+
// To use:
|
|
18
|
+
// <search-input
|
|
19
|
+
// placeholder="Company name"
|
|
20
|
+
// :value="companyName"
|
|
21
|
+
// :disabled="true"
|
|
22
|
+
// inputWidth="250px"
|
|
23
|
+
// />
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
export const Default = Template.bind({})
|
|
27
|
+
Default.args = {
|
|
28
|
+
placeholder: "Search...",
|
|
29
|
+
disabled: false,
|
|
30
|
+
value: "",
|
|
31
|
+
inputWidth: "250px",
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const Disabled = Template.bind({})
|
|
35
|
+
Disabled.args = {
|
|
36
|
+
placeholder: "Search...",
|
|
37
|
+
disabled: true,
|
|
38
|
+
value: "",
|
|
39
|
+
inputWidth: "250px",
|
|
40
|
+
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
@input="onChangeHandler($event)"
|
|
8
8
|
:disabled="disabled"
|
|
9
9
|
:isDisabled="disabled"
|
|
10
|
+
:inputWidth="inputWidth"
|
|
10
11
|
/>
|
|
11
12
|
<img
|
|
12
13
|
class="search-icn"
|
|
@@ -18,6 +19,13 @@
|
|
|
18
19
|
|
|
19
20
|
<script>
|
|
20
21
|
// import SearchInput from "@eturnity/eturnity_reusable_components/src/components/inputs/searchInput"
|
|
22
|
+
// To use:
|
|
23
|
+
// <search-input
|
|
24
|
+
// placeholder="Company name"
|
|
25
|
+
// :value="companyName"
|
|
26
|
+
// :disabled="true"
|
|
27
|
+
// inputWidth="250px"
|
|
28
|
+
// />
|
|
21
29
|
import styled from "vue-styled-components"
|
|
22
30
|
|
|
23
31
|
const Container = styled.div`
|
|
@@ -25,14 +33,14 @@ const Container = styled.div`
|
|
|
25
33
|
position: relative;
|
|
26
34
|
`
|
|
27
35
|
|
|
28
|
-
const inputAttrs = { isDisabled: Boolean }
|
|
36
|
+
const inputAttrs = { isDisabled: Boolean, inputWidth: String }
|
|
29
37
|
const InputContainer = styled("input", inputAttrs)`
|
|
30
38
|
border: 1px solid ${(props) => props.theme.colors.mediumGray};
|
|
31
39
|
padding: 11px 30px 11px 10px;
|
|
32
40
|
border-radius: 4px;
|
|
33
41
|
font-size: 16px;
|
|
34
42
|
color: ${(props) => props.theme.colors.black};
|
|
35
|
-
width: 100
|
|
43
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : "100%")};
|
|
36
44
|
box-sizing: border-box;
|
|
37
45
|
cursor: ${(props) => (props.isDisabled ? "not-allowed" : "auto")};
|
|
38
46
|
background: ${(props) => props.theme.colors.white} !important;
|
|
@@ -74,6 +82,10 @@ export default {
|
|
|
74
82
|
required: false,
|
|
75
83
|
default: "",
|
|
76
84
|
},
|
|
85
|
+
inputWidth: {
|
|
86
|
+
required: false,
|
|
87
|
+
default: null,
|
|
88
|
+
},
|
|
77
89
|
},
|
|
78
90
|
methods: {
|
|
79
91
|
onChangeHandler(event) {
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import TextAreaInput from "./index.vue"
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "TextAreaInput",
|
|
5
|
+
component: TextAreaInput,
|
|
6
|
+
// argTypes: {},
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Template = (args, { argTypes }) => ({
|
|
10
|
+
// Components used in your story `template` are defined in the `components` object
|
|
11
|
+
components: { TextAreaInput },
|
|
12
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
13
|
+
props: Object.keys(argTypes),
|
|
14
|
+
template: '<text-area-input v-bind="$props" />',
|
|
15
|
+
|
|
16
|
+
// import TextAreaInput from "@eturnity/eturnity_reusable_components/src/components/inputs/textAreaInput"
|
|
17
|
+
// To use:
|
|
18
|
+
// <text-area-input
|
|
19
|
+
// placeholder="Comments"
|
|
20
|
+
// @input-change="onInputChange({ value: $event, type: 'note' })"
|
|
21
|
+
// :value="form.note"
|
|
22
|
+
// rowHeight="4" //optional
|
|
23
|
+
// :isError="false"
|
|
24
|
+
// :errorText="$gettext('field_required')"
|
|
25
|
+
// infoTextAlign="right" // left by default
|
|
26
|
+
// infoTextMessage="My info message"
|
|
27
|
+
// label="Question 5"
|
|
28
|
+
// alignItems="horizontal" // horizontal, vertical
|
|
29
|
+
// :isDisabled="true"
|
|
30
|
+
// />
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
export const Default = Template.bind({})
|
|
34
|
+
Default.args = {
|
|
35
|
+
placeholder: "Enter a comment",
|
|
36
|
+
isDisabled: false,
|
|
37
|
+
rowHeight: "2",
|
|
38
|
+
isError: false,
|
|
39
|
+
errorText: "This field is required",
|
|
40
|
+
infoTextAlign: "right",
|
|
41
|
+
infoTextMessage: "",
|
|
42
|
+
label: "",
|
|
43
|
+
value: "",
|
|
44
|
+
alignItems: "vertical",
|
|
45
|
+
inputWidth: "350px",
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const Disabled = Template.bind({})
|
|
49
|
+
Disabled.args = {
|
|
50
|
+
placeholder: "Enter a comment",
|
|
51
|
+
isDisabled: true,
|
|
52
|
+
rowHeight: "2",
|
|
53
|
+
isError: false,
|
|
54
|
+
errorText: "This field is required",
|
|
55
|
+
infoTextAlign: "right",
|
|
56
|
+
infoTextMessage: "",
|
|
57
|
+
label: "",
|
|
58
|
+
value: "",
|
|
59
|
+
alignItems: "vertical",
|
|
60
|
+
inputWidth: "350px",
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const Error = Template.bind({})
|
|
64
|
+
Error.args = {
|
|
65
|
+
placeholder: "Enter a comment",
|
|
66
|
+
isDisabled: false,
|
|
67
|
+
rowHeight: "2",
|
|
68
|
+
isError: true,
|
|
69
|
+
errorText: "This field is required",
|
|
70
|
+
infoTextAlign: "right",
|
|
71
|
+
infoTextMessage: "",
|
|
72
|
+
label: "",
|
|
73
|
+
value: "",
|
|
74
|
+
alignItems: "vertical",
|
|
75
|
+
inputWidth: "350px",
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const WithLabel = Template.bind({})
|
|
79
|
+
WithLabel.args = {
|
|
80
|
+
placeholder: "Enter a comment",
|
|
81
|
+
isDisabled: false,
|
|
82
|
+
rowHeight: "2",
|
|
83
|
+
isError: false,
|
|
84
|
+
errorText: "This field is required",
|
|
85
|
+
infoTextAlign: "right",
|
|
86
|
+
infoTextMessage: "Here is some information",
|
|
87
|
+
label: "Description",
|
|
88
|
+
value: "Here is my description!",
|
|
89
|
+
alignItems: "vertical",
|
|
90
|
+
inputWidth: "350px",
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export const HorizontalLabel = Template.bind({})
|
|
94
|
+
HorizontalLabel.args = {
|
|
95
|
+
placeholder: "Enter a comment",
|
|
96
|
+
isDisabled: false,
|
|
97
|
+
rowHeight: "2",
|
|
98
|
+
isError: false,
|
|
99
|
+
errorText: "This field is required",
|
|
100
|
+
infoTextAlign: "right",
|
|
101
|
+
infoTextMessage: "Here is some information",
|
|
102
|
+
label: "Description",
|
|
103
|
+
value: "Here is my description!",
|
|
104
|
+
alignItems: "horizontal",
|
|
105
|
+
inputWidth: "350px",
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export const LargerTextArea = Template.bind({})
|
|
109
|
+
LargerTextArea.args = {
|
|
110
|
+
placeholder: "Enter a comment",
|
|
111
|
+
isDisabled: false,
|
|
112
|
+
rowHeight: "5",
|
|
113
|
+
isError: false,
|
|
114
|
+
errorText: "This field is required",
|
|
115
|
+
infoTextAlign: "right",
|
|
116
|
+
infoTextMessage: "Here is some information",
|
|
117
|
+
label: "Description",
|
|
118
|
+
value: "Here is my description!",
|
|
119
|
+
alignItems: "vertical",
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export const LargerFontSize = Template.bind({})
|
|
123
|
+
LargerFontSize.args = {
|
|
124
|
+
placeholder: "Enter a comment",
|
|
125
|
+
isDisabled: false,
|
|
126
|
+
rowHeight: "5",
|
|
127
|
+
fontSize: "24px",
|
|
128
|
+
isError: false,
|
|
129
|
+
errorText: "This field is required",
|
|
130
|
+
infoTextAlign: "right",
|
|
131
|
+
infoTextMessage: "Here is some information",
|
|
132
|
+
label: "Description",
|
|
133
|
+
value: "Here is my description!",
|
|
134
|
+
alignItems: "vertical",
|
|
135
|
+
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
:isError="isError"
|
|
17
17
|
:rows="rowHeight"
|
|
18
18
|
:value="value"
|
|
19
|
+
:inputWidth="inputWidth"
|
|
19
20
|
:disabled="isDisabled"
|
|
20
21
|
:fontSize="fontSize"
|
|
21
22
|
@input="onChangeHandler"
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
// infoTextMessage="My info message"
|
|
40
41
|
// label="Question 5"
|
|
41
42
|
// alignItems="horizontal" // horizontal, vertical
|
|
43
|
+
// :isDisabled="true"
|
|
42
44
|
// />
|
|
43
45
|
import styled from "vue-styled-components"
|
|
44
46
|
import InfoText from "../../infoText"
|
|
@@ -57,7 +59,12 @@ const LabelWrapper = styled.div`
|
|
|
57
59
|
margin-bottom: 12px;
|
|
58
60
|
`
|
|
59
61
|
|
|
60
|
-
const inputProps = {
|
|
62
|
+
const inputProps = {
|
|
63
|
+
isError: Boolean,
|
|
64
|
+
disabled: Boolean,
|
|
65
|
+
fontSize: String,
|
|
66
|
+
inputWidth: String,
|
|
67
|
+
}
|
|
61
68
|
const InputContainer = styled("textarea", inputProps)`
|
|
62
69
|
border: ${(props) =>
|
|
63
70
|
props.isError
|
|
@@ -68,7 +75,7 @@ const InputContainer = styled("textarea", inputProps)`
|
|
|
68
75
|
border-radius: 4px;
|
|
69
76
|
font-size: ${(props) => (props.fontSize ? props.fontSize : "16px")};
|
|
70
77
|
color: ${(props) => props.theme.colors.black};
|
|
71
|
-
width: 100
|
|
78
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : "100%")};
|
|
72
79
|
max-width: 100%;
|
|
73
80
|
box-sizing: border-box; // to allow width of 100% with padding
|
|
74
81
|
cursor: ${(props) => (props.disabled ? "not-allowed" : "inherit")};
|
|
@@ -160,9 +167,16 @@ export default {
|
|
|
160
167
|
required: false,
|
|
161
168
|
default: "16px",
|
|
162
169
|
},
|
|
170
|
+
inputWidth: {
|
|
171
|
+
required: false,
|
|
172
|
+
default: null,
|
|
173
|
+
},
|
|
163
174
|
},
|
|
164
175
|
methods: {
|
|
165
176
|
onChangeHandler($event) {
|
|
177
|
+
if (this.isDisabled) {
|
|
178
|
+
return
|
|
179
|
+
}
|
|
166
180
|
this.$emit("input-change", $event)
|
|
167
181
|
},
|
|
168
182
|
},
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import Toggle from "./index.vue"
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Toggle",
|
|
5
|
+
component: Toggle,
|
|
6
|
+
// argTypes: {},
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Template = (args, { argTypes }) => ({
|
|
10
|
+
// Components used in your story `template` are defined in the `components` object
|
|
11
|
+
components: { Toggle },
|
|
12
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
13
|
+
props: Object.keys(argTypes),
|
|
14
|
+
template: '<toggle v-bind="$props" />',
|
|
15
|
+
|
|
16
|
+
// import Toggle from "@eturnity/eturnity_reusable_components/src/components/inputs/toggle"
|
|
17
|
+
//To use:
|
|
18
|
+
// <toggle
|
|
19
|
+
// @on-toggle-change="onInputChange($event)"
|
|
20
|
+
// :isChecked="toggleValue" // Boolean
|
|
21
|
+
// label="My Label Text"
|
|
22
|
+
// toggleColor="red"
|
|
23
|
+
// size="small" // small, medium
|
|
24
|
+
// backgroundColor="blue"
|
|
25
|
+
// labelAlign="right"
|
|
26
|
+
// fontColor="black"
|
|
27
|
+
// :disabled="true"
|
|
28
|
+
// />
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
export const Default = Template.bind({})
|
|
32
|
+
Default.args = {
|
|
33
|
+
isChecked: true,
|
|
34
|
+
size: "small", // "small" or "medium"
|
|
35
|
+
disabled: false,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const Medium = Template.bind({})
|
|
39
|
+
Medium.args = {
|
|
40
|
+
isChecked: true,
|
|
41
|
+
size: "medium", // "small" or "medium"
|
|
42
|
+
disabled: false,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const CustomColor = Template.bind({})
|
|
46
|
+
CustomColor.args = {
|
|
47
|
+
isChecked: true,
|
|
48
|
+
size: "small", // "small" or "medium"
|
|
49
|
+
disabled: false,
|
|
50
|
+
toggleColor: "red",
|
|
51
|
+
backgroundColor: "blue",
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const LabelLeft = Template.bind({})
|
|
55
|
+
LabelLeft.args = {
|
|
56
|
+
isChecked: true,
|
|
57
|
+
size: "small", // "small" or "medium"
|
|
58
|
+
label: "My Label Text",
|
|
59
|
+
disabled: false,
|
|
60
|
+
labelAlign: "left",
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const LabelRight = Template.bind({})
|
|
64
|
+
LabelRight.args = {
|
|
65
|
+
isChecked: true,
|
|
66
|
+
size: "small", // "small" or "medium"
|
|
67
|
+
label: "My Label Text",
|
|
68
|
+
disabled: false,
|
|
69
|
+
labelAlign: "right",
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const Disabled = Template.bind({})
|
|
73
|
+
Disabled.args = {
|
|
74
|
+
isChecked: false,
|
|
75
|
+
size: "small", // "small" or "medium"
|
|
76
|
+
disabled: true,
|
|
77
|
+
}
|
|
@@ -3,7 +3,12 @@ export const stringToNumber = ({ value, numberPrecision }) => {
|
|
|
3
3
|
let newVal = value.toString()
|
|
4
4
|
const selectedLang = localStorage.getItem("lang")
|
|
5
5
|
// The first replace will replace not allowed characters with a blank
|
|
6
|
-
if (
|
|
6
|
+
if (
|
|
7
|
+
selectedLang === "de-DE" ||
|
|
8
|
+
selectedLang === "it-CH" ||
|
|
9
|
+
selectedLang === "no-no" ||
|
|
10
|
+
selectedLang === "da-dk"
|
|
11
|
+
) {
|
|
7
12
|
// replace commas with a dot, and dots with blank
|
|
8
13
|
newVal = newVal
|
|
9
14
|
.replace(/[^\d.,']/g, "")
|
|
@@ -19,7 +24,11 @@ export const stringToNumber = ({ value, numberPrecision }) => {
|
|
|
19
24
|
) {
|
|
20
25
|
// replace ' with blank
|
|
21
26
|
newVal = newVal.replace(/[^\d.,']/g, "").replace(/['\s]/g, "")
|
|
22
|
-
} else if (
|
|
27
|
+
} else if (
|
|
28
|
+
selectedLang === "fr-fr" ||
|
|
29
|
+
selectedLang === "fr" ||
|
|
30
|
+
selectedLang === "sv-se"
|
|
31
|
+
) {
|
|
23
32
|
// replace space with blank, and commas with dot
|
|
24
33
|
newVal = newVal.replace(/[^\d.,']/g, "").replace(/[,\s]/g, ".")
|
|
25
34
|
} else {
|