@eturnity/eturnity_reusable_components 1.0.12 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "1.0.12",
3
+ "version": "1.0.16",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -1,13 +1,7 @@
1
1
  <template>
2
2
  <ThemeProvider :theme="getTheme()" :style="{ height: '100%' }">
3
3
  <page-container>
4
- <slider
5
- :value="inputValue"
6
- unit="m"
7
- @change="onChangeSlider($event)"
8
- :minValue="10"
9
- :maxValue="500"
10
- />
4
+ <page-subtitle text="My Page Title" />
11
5
  </page-container>
12
6
  </ThemeProvider>
13
7
  </template>
@@ -16,7 +10,7 @@
16
10
  import { ThemeProvider } from "vue-styled-components"
17
11
  import theme from "./assets/theme"
18
12
  import styled from "vue-styled-components"
19
- import slider from "@/components/inputs/slider"
13
+ import PageSubtitle from "@/components/pageSubtitle"
20
14
 
21
15
  const PageContainer = styled.div`
22
16
  padding: 40px;
@@ -27,11 +21,11 @@ export default {
27
21
  components: {
28
22
  ThemeProvider,
29
23
  PageContainer,
30
- slider,
24
+ PageSubtitle,
31
25
  },
32
26
  data() {
33
27
  return {
34
- inputValue: 50,
28
+ inputValue: false,
35
29
  checkedOption: "button_1",
36
30
  question: {
37
31
  number_format_precision: 4,
@@ -45,7 +39,7 @@ export default {
45
39
  getTheme() {
46
40
  return theme
47
41
  },
48
- onChangeSlider(event) {
42
+ onInputChange(event) {
49
43
  this.inputValue = event
50
44
  },
51
45
  },
@@ -0,0 +1,3 @@
1
+ <svg width="8" height="4" viewBox="0 0 8 4" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M4 4L8 0H0L4 4Z" fill="#263238"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="8" height="4" viewBox="0 0 8 4" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M4 0L8 4H0L4 0Z" fill="#FF5656"/>
3
+ </svg>
@@ -0,0 +1,11 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40">
2
+ <defs>
3
+ <style>
4
+ .cls-1 {
5
+ fill: #ff5656;
6
+ fill-rule: evenodd;
7
+ }
8
+ </style>
9
+ </defs>
10
+ <path id="delete_icon" class="cls-1" d="M15.44,27.225a0.8,0.8,0,0,0,.8.771h7.512a0.8,0.8,0,0,0,.8-0.771L25.1,15.9H14.9ZM21.7,18.711a0.327,0.327,0,0,1,.327-0.327h0.523a0.327,0.327,0,0,1,.327.327v6.472a0.327,0.327,0,0,1-.327.327H22.026a0.327,0.327,0,0,1-.327-0.327V18.711Zm-2.288,0a0.327,0.327,0,0,1,.327-0.327h0.523a0.327,0.327,0,0,1,.327.327v6.472a0.327,0.327,0,0,1-.327.327H19.739a0.327,0.327,0,0,1-.327-0.327V18.711h0Zm-2.287,0a0.327,0.327,0,0,1,.327-0.327h0.523a0.327,0.327,0,0,1,.327.327v6.472a0.327,0.327,0,0,1-.327.327H17.451a0.327,0.327,0,0,1-.327-0.327V18.711Zm8.329-5.884H21.988V12.172A0.169,0.169,0,0,0,21.819,12H18.18a0.168,0.168,0,0,0-.168.168v0.656H14.546a0.505,0.505,0,0,0-.505.505v1.587H25.958V13.332A0.505,0.505,0,0,0,25.453,12.827Z"/>
11
+ </svg>
@@ -0,0 +1,11 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40">
2
+ <defs>
3
+ <style>
4
+ .cls-1 {
5
+ fill: #DEE2EB;
6
+ fill-rule: evenodd;
7
+ }
8
+ </style>
9
+ </defs>
10
+ <path id="delete_icon" class="cls-1" d="M15.44,27.225a0.8,0.8,0,0,0,.8.771h7.512a0.8,0.8,0,0,0,.8-0.771L25.1,15.9H14.9ZM21.7,18.711a0.327,0.327,0,0,1,.327-0.327h0.523a0.327,0.327,0,0,1,.327.327v6.472a0.327,0.327,0,0,1-.327.327H22.026a0.327,0.327,0,0,1-.327-0.327V18.711Zm-2.288,0a0.327,0.327,0,0,1,.327-0.327h0.523a0.327,0.327,0,0,1,.327.327v6.472a0.327,0.327,0,0,1-.327.327H19.739a0.327,0.327,0,0,1-.327-0.327V18.711h0Zm-2.287,0a0.327,0.327,0,0,1,.327-0.327h0.523a0.327,0.327,0,0,1,.327.327v6.472a0.327,0.327,0,0,1-.327.327H17.451a0.327,0.327,0,0,1-.327-0.327V18.711Zm8.329-5.884H21.988V12.172A0.169,0.169,0,0,0,21.819,12H18.18a0.168,0.168,0,0,0-.168.168v0.656H14.546a0.505,0.505,0,0,0-.505.505v1.587H25.958V13.332A0.505,0.505,0,0,0,25.453,12.827Z"/>
11
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="7" height="11" viewBox="0 0 7 11" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M1 0V10H7" stroke="#B2B9C5"/>
3
+ </svg>
@@ -6,12 +6,18 @@ const theme = {
6
6
  black: "#353535",
7
7
  yellow: "#fdb813",
8
8
  darkGray: "#818181",
9
+ gray1: "#666",
9
10
  mediumGray: "#d5d5d5",
10
11
  lightGray: "#f2f2f2",
11
12
  white: "#fff",
12
13
  blue: "#48a2d0",
13
14
  red: "#ff7e7e",
14
15
  disabled: "#c4c4c4",
16
+ blue1: "#e4efff",
17
+ grey3: "#b2b9c5",
18
+ grey4: "#ebeef4",
19
+ grey5: "#fafafa",
20
+ green: "#99db0c",
15
21
  },
16
22
  screen: {
17
23
  mobileSmall: "345px",
@@ -0,0 +1,57 @@
1
+ <template>
2
+ <wrapper>
3
+ <icon :color="color" />
4
+ </wrapper>
5
+ </template>
6
+
7
+ <script>
8
+ // To use:
9
+ // <delete-icon
10
+ // color="gray" // red is default
11
+ // />
12
+ import styled from "vue-styled-components"
13
+
14
+ const Wrapper = styled.div`
15
+ width: 100%;
16
+ height: 100%;
17
+ min-height: 40px;
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ `
22
+
23
+ const iconAttrs = { color: String }
24
+ const Icon = styled("span", iconAttrs)`
25
+ width: 30px;
26
+ height: 30px;
27
+ background-position: center;
28
+ cursor: pointer;
29
+ background-image: ${(props) =>
30
+ props.color === "red"
31
+ ? `url(${require("../../assets/images/delete_icon.svg")})`
32
+ : props.color === "gray"
33
+ ? `url(${require("../../assets/images/delete_icon_gray.svg")})`
34
+ : `url(${require("../../assets/images/delete_icon.svg")})`};
35
+
36
+ &:hover {
37
+ box-shadow: 0px 4px 9px 1px rgb(0 0 0 / 20%);
38
+ border-radius: 4px;
39
+ background-image: ${() =>
40
+ `url(${require("../../assets/images/delete_icon.svg")})`};
41
+ }
42
+ `
43
+
44
+ export default {
45
+ name: "delete-icon",
46
+ components: {
47
+ Icon,
48
+ Wrapper,
49
+ },
50
+ props: {
51
+ color: {
52
+ required: false,
53
+ default: "red", // red, gray
54
+ },
55
+ },
56
+ }
57
+ </script>
@@ -12,6 +12,7 @@
12
12
  </template>
13
13
 
14
14
  <script>
15
+ // import Slider from "@eturnity/eturnity_reusable_components/src/components/inputs/slider"
15
16
  //To use:
16
17
  // <slider
17
18
  // :value="sliderValue" //required from parent
@@ -0,0 +1,106 @@
1
+ <template>
2
+ <container>
3
+ <input-wrapper>
4
+ <input-container
5
+ :placeholder="placeholder"
6
+ :isError="isError"
7
+ :rows="rowHeight"
8
+ :value="value"
9
+ @input="onChangeHandler"
10
+ />
11
+ </input-wrapper>
12
+ <error-message v-if="isError && errorText">{{ errorText }}</error-message>
13
+ </container>
14
+ </template>
15
+
16
+ <script>
17
+ // import TextAreaInput from "@eturnity/eturnity_reusable_components/src/components/inputs/textAreaInput"
18
+ // To use:
19
+ // <text-area-input
20
+ // placeholder="Comments"
21
+ // @input-change="onInputChange({ value: $event, type: 'note' })"
22
+ // :value="form.note"
23
+ // rowHeight="4" //optional
24
+ // :isError="false"
25
+ // :errorText="$gettext('field_required')"
26
+ // />
27
+ import styled from "vue-styled-components"
28
+
29
+ const Container = styled.div`
30
+ width: 100%;
31
+ position: relative;
32
+ margin-bottom: 20px;
33
+ `
34
+
35
+ const inputProps = { isError: Boolean }
36
+ const InputContainer = styled("textarea", inputProps)`
37
+ border: ${(props) =>
38
+ props.isError
39
+ ? "1px solid " + props.theme.colors.red
40
+ : "1px solid " + props.theme.colors.mediumGray};
41
+ padding: ${(props) =>
42
+ props.hasUnit ? "11px 40px 11px 10px" : "11px 5px 11px 10px"};
43
+ border-radius: 4px;
44
+ font-size: 16px;
45
+ color: ${(props) => props.theme.colors.black};
46
+ width: 100%;
47
+ max-width: 100%;
48
+ box-sizing: border-box; // to allow width of 100% with padding
49
+
50
+ &::placeholder {
51
+ color: ${(props) =>
52
+ props.isError ? props.theme.colors.red : props.theme.colors.darkGray};
53
+ }
54
+
55
+ &:focus {
56
+ outline: none;
57
+ }
58
+ `
59
+
60
+ const InputWrapper = styled.span`
61
+ position: relative;,
62
+ `
63
+
64
+ const ErrorMessage = styled.div`
65
+ font-size: 14px;
66
+ color: ${(props) => props.theme.colors.red};
67
+ position: absolute;
68
+ bottom: -18px;
69
+ `
70
+
71
+ export default {
72
+ name: "text-area-input",
73
+ components: {
74
+ Container,
75
+ InputContainer,
76
+ InputWrapper,
77
+ ErrorMessage,
78
+ },
79
+ props: {
80
+ placeholder: {
81
+ required: false,
82
+ default: "",
83
+ },
84
+ isError: {
85
+ required: false,
86
+ default: false,
87
+ },
88
+ rowHeight: {
89
+ required: false,
90
+ default: "2",
91
+ },
92
+ value: {
93
+ required: true,
94
+ default: null,
95
+ },
96
+ errorText: {
97
+ required: false,
98
+ },
99
+ },
100
+ methods: {
101
+ onChangeHandler($event) {
102
+ this.$emit("input-change", $event)
103
+ },
104
+ },
105
+ }
106
+ </script>
@@ -0,0 +1,129 @@
1
+ <template>
2
+ <container>
3
+ <flex-wrapper>
4
+ <toggle-wrapper
5
+ role="checkbox"
6
+ :checked="isChecked"
7
+ tabindex="0"
8
+ @click="onToggleChange"
9
+ @keydown.space.prevent="onToggleChange"
10
+ >
11
+ <toggle-background />
12
+ <toggle-dot :isChecked="isChecked" :toggleColor="toggleColor" />
13
+ </toggle-wrapper>
14
+ <label-text>{{ label }}</label-text>
15
+ </flex-wrapper>
16
+ </container>
17
+ </template>
18
+
19
+ <script>
20
+ // import Toggle from "@eturnity/eturnity_reusable_components/src/components/inputs/toggle"
21
+ // To use:
22
+ // <toggle
23
+ // @on-toggle-change="onInputChange($event)"
24
+ // :isChecked="toggleValue" // Boolean
25
+ // label="My Label Text"
26
+ // toggleColor="red"
27
+ // />
28
+
29
+ import styled from "vue-styled-components"
30
+
31
+ const Container = styled.div`
32
+ display: inline-block;
33
+ `
34
+
35
+ const FlexWrapper = styled.div`
36
+ display: grid;
37
+ grid-template-columns: auto 1fr;
38
+ grid-gap: 20px;
39
+ align-items: center;
40
+ `
41
+
42
+ const LabelText = styled.div`
43
+ color: ${(props) => props.theme.colors.darkGray};
44
+ `
45
+
46
+ const ToggleWrapper = styled.span`
47
+ display: inline-block;
48
+ position: relative;
49
+ cursor: pointer;
50
+ width: 50px;
51
+ height: 24px;
52
+ border-radius: 9px;
53
+
54
+ &:focus {
55
+ outline: 0;
56
+ }
57
+
58
+ @media (max-width: ${(props) => props.theme.screen.mobile}) {
59
+ width: 80px;
60
+ height: 40px;
61
+ }
62
+ `
63
+
64
+ const ToggleBackground = styled.span`
65
+ display: inline-block;
66
+ border-radius: 100px;
67
+ height: 100%;
68
+ width: 100%;
69
+ background-color: ${(props) => props.theme.colors.lightGray};
70
+ transition: 0.4s ease;
71
+ `
72
+
73
+ const toggleProps = { isChecked: Boolean, toggleColor: String }
74
+ const ToggleDot = styled("span", toggleProps)`
75
+ position: absolute;
76
+ height: 14px;
77
+ width: 14px;
78
+ left: 5px;
79
+ bottom: 5px;
80
+ background-color: ${(props) =>
81
+ props.isChecked
82
+ ? props.toggleColor
83
+ ? props.toggleColor
84
+ : props.theme.colors.primary
85
+ : props.theme.colors.mediumGray};
86
+ border-radius: 100%;
87
+ transition: transform 0.4s ease;
88
+ transform: ${(props) =>
89
+ props.isChecked ? "translateX(26px)" : "translateX(0)"};
90
+
91
+ @media (max-width: ${(props) => props.theme.screen.mobile}) {
92
+ height: 24px;
93
+ width: 24px;
94
+ transform: ${(props) =>
95
+ props.isChecked ? "translateX(45px)" : "translateX(0)"};
96
+ bottom: 8px;
97
+ }
98
+ `
99
+
100
+ export default {
101
+ name: "toggle",
102
+ components: {
103
+ Container,
104
+ ToggleBackground,
105
+ ToggleDot,
106
+ ToggleWrapper,
107
+ FlexWrapper,
108
+ LabelText,
109
+ },
110
+ props: {
111
+ label: {
112
+ required: false,
113
+ default: "",
114
+ },
115
+ isChecked: {
116
+ required: true,
117
+ default: false,
118
+ },
119
+ toggleColor: {
120
+ required: false,
121
+ },
122
+ },
123
+ methods: {
124
+ onToggleChange() {
125
+ this.$emit("on-toggle-change", !this.isChecked)
126
+ },
127
+ },
128
+ }
129
+ </script>
@@ -0,0 +1,36 @@
1
+ <template>
2
+ <subtitle-text :color="color">{{ text }}</subtitle-text>
3
+ </template>
4
+
5
+ <script>
6
+ // import PageSubtitle from "@eturnity/eturnity_reusable_components/src/components/pageSubtitle"
7
+ // To use:
8
+ // <page-subtitle
9
+ // text="My Page Subitle"
10
+ // color="red"
11
+ // />
12
+ import styled from "vue-styled-components"
13
+
14
+ const textAttrs = { color: String }
15
+ const SubtitleText = styled("div", textAttrs)`
16
+ color: ${(props) => (props.color ? props.color : props.theme.colors.gray1)};
17
+ font-size: 13px;
18
+ margin-bottom: 30px;
19
+ line-height: 1.5;
20
+ `
21
+
22
+ export default {
23
+ name: "page-subtitle",
24
+ components: {
25
+ SubtitleText,
26
+ },
27
+ props: {
28
+ text: {
29
+ required: true,
30
+ },
31
+ color: {
32
+ required: false,
33
+ },
34
+ },
35
+ }
36
+ </script>
@@ -0,0 +1,37 @@
1
+ <template>
2
+ <title-text :color="color">{{ text }}</title-text>
3
+ </template>
4
+
5
+ <script>
6
+ // import PageTitle from "@eturnity/eturnity_reusable_components/src/components/pageTitle"
7
+ // To use:
8
+ // <page-title
9
+ // text="My Page Title"
10
+ // color="red"
11
+ // />
12
+ import styled from "vue-styled-components"
13
+
14
+ const textAttrs = { color: String }
15
+ const TitleText = styled("div", textAttrs)`
16
+ color: ${(props) => (props.color ? props.color : props.theme.colors.black)};
17
+ font-weight: bold;
18
+ font-size: 16px;
19
+ text-transform: uppercase;
20
+ margin-bottom: 20px;
21
+ `
22
+
23
+ export default {
24
+ name: "page-title",
25
+ components: {
26
+ TitleText,
27
+ },
28
+ props: {
29
+ text: {
30
+ required: true,
31
+ },
32
+ color: {
33
+ required: false,
34
+ },
35
+ },
36
+ }
37
+ </script>
@@ -0,0 +1,125 @@
1
+ <template>
2
+ <container>
3
+ <progress-container
4
+ :backgroundColor="backgroundColor"
5
+ :maxWidth="maxWidth"
6
+ :minWidth="minWidth"
7
+ class="progress-container"
8
+ >
9
+ <progress-fill
10
+ class="progress-bar"
11
+ :fillProgress="fillProgress"
12
+ :fillColor="fillColor"
13
+ />
14
+ </progress-container>
15
+ <label-text class="progress-text" v-if="stepNumber || labelText"
16
+ >{{ labelText ? labelText : "" }}
17
+ {{ stepNumber ? stepNumber : "" }}</label-text
18
+ >
19
+ </container>
20
+ </template>
21
+
22
+ <script>
23
+ // import ProgressBar from "@eturnity/eturnity_reusable_components/src/components/progressBar"
24
+ //To Use:
25
+ // <progress-bar
26
+ // fillColor="#000"
27
+ // backgroundColor="#888"
28
+ // minWidth="150px"
29
+ // maxWidth="100%"
30
+ // :fillProgress="50" //should be a number for percent
31
+ // stepNumber="4"
32
+ // :labelText="translate('step')"
33
+ // />
34
+ import styled from "vue-styled-components"
35
+
36
+ const Container = styled.div`
37
+ display: grid;
38
+ grid-template-columns: 1fr;
39
+ grid-row-gap: 16px;
40
+ @media (max-width: ${(props) => props.theme.screen.tablet}) {
41
+ grid-row-gap: 20px;
42
+ grid-template-rows: auto 1fr;
43
+ }
44
+ `
45
+
46
+ const containerProps = {
47
+ backgroundColor: String,
48
+ maxWidth: String,
49
+ minWidth: String,
50
+ }
51
+ const ProgressContainer = styled("div", containerProps)`
52
+ width: 100%;
53
+ min-width: ${(props) => (props.minWidth ? props.minWidth : "auto")};
54
+ max-width: ${(props) => (props.maxWidth ? props.maxWidth : "none")};
55
+ height: 6px;
56
+ background-color: ${(props) =>
57
+ props.backgroundColor
58
+ ? props.backgroundColor
59
+ : props.theme.colors.lightGray};
60
+ @media (max-width: ${(props) => props.theme.screen.mobile}) {
61
+ height: 4px;
62
+ }
63
+ `
64
+
65
+ const fillProps = { fillColor: String, fillProgress: String | Number }
66
+ const ProgressFill = styled("div", fillProps)`
67
+ height: 100%;
68
+ width: ${(props) => props.fillProgress + "%"};
69
+ background-color: ${(props) =>
70
+ props.fillColor ? props.fillColor : props.theme.colors.secondary};
71
+ `
72
+
73
+ const labelText = styled.div`
74
+ color: ${(props) => props.theme.colors.darkGray};
75
+ font-size: 16px;
76
+
77
+ @media (max-width: ${(props) => props.theme.screen.tablet}) {
78
+ padding-left: 16px;
79
+ }
80
+ `
81
+
82
+ export default {
83
+ name: "progress-bar",
84
+ components: {
85
+ Container,
86
+ ProgressContainer,
87
+ ProgressFill,
88
+ labelText,
89
+ },
90
+ props: {
91
+ fillColor: {
92
+ required: false,
93
+ type: String,
94
+ default: null,
95
+ },
96
+ backgroundColor: {
97
+ required: false,
98
+ type: String,
99
+ default: null,
100
+ },
101
+ minWidth: {
102
+ required: false,
103
+ type: String,
104
+ default: null,
105
+ },
106
+ maxWidth: {
107
+ required: false,
108
+ type: String,
109
+ default: null,
110
+ },
111
+ fillProgress: {
112
+ required: false,
113
+ default: 0,
114
+ },
115
+ labelText: {
116
+ required: false,
117
+ default: null,
118
+ },
119
+ stepNumber: {
120
+ required: false,
121
+ default: null,
122
+ },
123
+ },
124
+ }
125
+ </script>
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <spinner-container v-if="fullWidth">
3
+ <container>
4
+ <spinner-wrapper :src="require('../../assets/icons/black-spinner.svg')" />
5
+ </container>
6
+ </spinner-container>
7
+ <container v-else>
8
+ <spinner-wrapper :src="require('../../assets/icons/black-spinner.svg')" />
9
+ </container>
10
+ </template>
11
+
12
+ <script>
13
+ import styled from "vue-styled-components"
14
+
15
+ const SpinnerContainer = styled.div`
16
+ position: fixed;
17
+ top: 0;
18
+ left: 0;
19
+ width: 100%;
20
+ height: 100%;
21
+ background: rgba(255, 255, 255, 0.8);
22
+ display: grid;
23
+ align-items: center;
24
+ justify-items: center;
25
+ z-index: 100;
26
+ `
27
+
28
+ const Container = styled.div`
29
+ display: grid;
30
+ align-items: center;
31
+ justify-items: center;
32
+ `
33
+
34
+ const SpinnerWrapper = styled.img`
35
+ width: 60px;
36
+ `
37
+
38
+ export default {
39
+ name: "spinner",
40
+ components: {
41
+ Container,
42
+ SpinnerWrapper,
43
+ SpinnerContainer,
44
+ },
45
+ props: {
46
+ fullWidth: {
47
+ required: false,
48
+ default: false,
49
+ },
50
+ },
51
+ }
52
+ </script>