@eturnity/eturnity_reusable_components 1.2.19-v.5.45.0 → 1.2.20-3d-master.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.
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <component-wrapper :layout="layout">
3
3
  <radio-wrapper v-for="(item, index) in options" :key="item.value">
4
- <label-container :size="size" :isDisabled="item.disabled" :isChecked="selectedOption === item.value">
4
+ <label-container :size="size" :isDisabled="item.disabled">
5
5
  <radio
6
6
  type="radio"
7
7
  :value="selectedOption"
@@ -12,7 +12,7 @@
12
12
  />
13
13
  <span class="checkmark"></span>
14
14
  <label-text :isDisabled="item.disabled">{{ item.label }}</label-text>
15
- <info-text v-if="item.infoText" :text="item.infoText" size="16" />
15
+ <info-text v-if="item.infoText" :text="item.infoText" size="16px" />
16
16
  </label-container>
17
17
  <image-container v-if="item.img">
18
18
  <radio-image :src="item.img" />
@@ -76,6 +76,14 @@ const Radio = styled.input`
76
76
  cursor: pointer;
77
77
  height: 0;
78
78
  width: 0;
79
+
80
+ &:checked ~ .checkmark {
81
+ background-color: white;
82
+
83
+ &:after {
84
+ display: block;
85
+ }
86
+ }
79
87
  `
80
88
 
81
89
  const RadioWrapper = styled.div`
@@ -83,22 +91,22 @@ const RadioWrapper = styled.div`
83
91
  grid-gap: 10px;
84
92
  `
85
93
 
86
- const containerProps = { size: String, isDisabled: Boolean, isChecked: Boolean }
94
+ const containerProps = { size: String, isDisabled: Boolean }
87
95
  const LabelContainer = styled("label", containerProps)`
88
96
  display: grid;
89
97
  grid-template-columns: auto 1fr auto;
90
98
  grid-gap: 15px;
91
99
  align-items: center;
92
100
  color: ${(props) =>
93
- props.isDisabled ? props.theme.colors.grey2 : props.theme.colors.black};
101
+ props.isDisabled ? props.theme.colors.disabled : props.theme.colors.black};
94
102
  position: relative;
95
103
  cursor: ${(props) => (props.isDisabled ? "not-allowed" : "pointer")};
96
104
  font-size: ${(props) =>
97
105
  props.size === "large"
98
106
  ? "16px"
99
107
  : props.size === "medium"
100
- ? "13px"
101
- : "10px"};
108
+ ? "13px"
109
+ : "10px"};
102
110
  user-select: none;
103
111
  flex: auto;
104
112
  align-self: baseline;
@@ -108,14 +116,14 @@ const LabelContainer = styled("label", containerProps)`
108
116
  props.size === "large"
109
117
  ? "23px"
110
118
  : props.size === "medium"
111
- ? "16px"
112
- : "12px"};
119
+ ? "16px"
120
+ : "12px"};
113
121
  width: ${(props) =>
114
122
  props.size === "large"
115
123
  ? "23px"
116
124
  : props.size === "medium"
117
- ? "16px"
118
- : "12px"};
125
+ ? "16px"
126
+ : "12px"};
119
127
  background-color: #fff;
120
128
  border-radius: 100%;
121
129
  border: 1px solid ${(props) => props.theme.colors.mediumGray};
@@ -125,29 +133,32 @@ const LabelContainer = styled("label", containerProps)`
125
133
 
126
134
  &:after {
127
135
  content: "";
128
- display: ${(props) => props.isChecked ? 'block' : 'none'};
129
- width: ${(props) =>
130
- props.size === "large"
131
- ? "10px"
132
- : props.size === "medium"
133
- ? "8px"
134
- : "6px"};
135
- height: ${(props) =>
136
- props.size === "large"
137
- ? "10px"
138
- : props.size === "medium"
139
- ? "8px"
140
- : "6px"};
141
- border-radius: 100%;
142
- background: ${(props) => props.theme.colors.primary};
136
+ display: none;
143
137
  }
144
138
  }
139
+
140
+ .checkmark:after {
141
+ width: ${(props) =>
142
+ props.size === "large"
143
+ ? "10px"
144
+ : props.size === "medium"
145
+ ? "8px"
146
+ : "6px"};
147
+ height: ${(props) =>
148
+ props.size === "large"
149
+ ? "10px"
150
+ : props.size === "medium"
151
+ ? "8px"
152
+ : "6px"};
153
+ border-radius: 100%;
154
+ background: ${(props) => props.theme.colors.primary};
155
+ }
145
156
  `
146
157
 
147
158
  const textAttrs = { isDisabled: Boolean }
148
159
  const LabelText = styled("div", textAttrs)`
149
160
  color: ${(props) =>
150
- props.isDisabled ? props.theme.colors.grey2 : props.theme.colors.black};
161
+ props.isDisabled ? props.theme.colors.disabled : props.theme.colors.black};
151
162
  `
152
163
 
153
164
  const RadioImage = styled.img`
@@ -217,15 +228,11 @@ export default {
217
228
  required: false,
218
229
  default: "medium", // small, medium, large
219
230
  },
220
- name: {
221
- required: false,
222
- default: ''
223
- }
224
231
  },
225
232
  data() {
226
233
  return {
234
+ radioName: "",
227
235
  selectedImage: null,
228
- radioName: ''
229
236
  }
230
237
  },
231
238
  methods: {
@@ -240,7 +247,7 @@ export default {
240
247
  },
241
248
  },
242
249
  created() {
243
- this.radioName = this.name.length === 0 ? Math.round(Math.random() * 10000) : this.name
250
+ this.radioName = Math.round(Math.random() * 10000)
244
251
  },
245
252
  }
246
253
  </script>
@@ -59,8 +59,7 @@ const InputWrapper = styled.span`
59
59
  img {
60
60
  position: absolute;
61
61
  right: 10px;
62
- top: 50%;
63
- transform: translateY(-50%);
62
+ top: 0;
64
63
  }
65
64
  `
66
65
 
@@ -10,7 +10,7 @@
10
10
  v-if="infoTextMessage"
11
11
  :text="infoTextMessage"
12
12
  borderColor="#ccc"
13
- size="16"
13
+ size="16px"
14
14
  :alignText="infoTextAlign"
15
15
  />
16
16
  </label-wrapper>
@@ -23,6 +23,7 @@
23
23
  :disabled="isDisabled"
24
24
  :fontSize="fontSize"
25
25
  @input="onChangeHandler"
26
+ :resize="resize"
26
27
  />
27
28
  </input-wrapper>
28
29
  <error-message v-if="isError && errorText">{{ errorText }}</error-message>
@@ -174,7 +175,11 @@ export default {
174
175
  },
175
176
  inputWidth: {
176
177
  required: false,
177
- default: null
178
+ default: null,
179
+ },
180
+ resize:{
181
+ required:false,
182
+ default: "none"
178
183
  }
179
184
  },
180
185
  methods: {
@@ -10,7 +10,7 @@
10
10
  v-if="infoTextMessage"
11
11
  :text="infoTextMessage"
12
12
  borderColor="#ccc"
13
- size="14"
13
+ size="14px"
14
14
  :alignText="infoTextAlign"
15
15
  />
16
16
  </label-container>
@@ -46,7 +46,7 @@
46
46
  v-if="infoTextMessage"
47
47
  :text="infoTextMessage"
48
48
  borderColor="#ccc"
49
- size="14"
49
+ size="14px"
50
50
  :alignText="infoTextAlign"
51
51
  />
52
52
  </label-container>
@@ -1,12 +1,12 @@
1
1
  <template>
2
- <subtitle-text :color="color" :marginBottom="marginBottom" :hasInfoText="!!infoText">
2
+ <subtitle-text :color="color" :hasInfoText="!!infoText">
3
3
  <span>
4
4
  {{ text }}
5
5
  </span>
6
6
  <info-text
7
7
  :text="infoText"
8
8
  v-if="!!infoText"
9
- size="14"
9
+ size="14px"
10
10
  borderColor="#ccc"
11
11
  :alignText="alignInfoText"
12
12
  />
@@ -24,7 +24,7 @@
24
24
  import styled from "vue-styled-components"
25
25
  import InfoText from "../infoText"
26
26
 
27
- const textAttrs = { color: String, hasInfoText: Boolean, marginBottom: String }
27
+ const textAttrs = { color: String, hasInfoText: Boolean }
28
28
  const SubtitleText = styled("div", textAttrs)`
29
29
  display: grid;
30
30
  align-items: center;
@@ -33,7 +33,7 @@ const SubtitleText = styled("div", textAttrs)`
33
33
  props.hasInfoText ? "auto auto 1fr" : "1fr"};
34
34
  color: ${(props) => (props.color ? props.color : props.theme.colors.gray1)};
35
35
  font-size: 13px;
36
- margin-bottom: ${(props) => (props.marginBottom ? props.marginBottom : '30px')};
36
+ margin-bottom: 30px;
37
37
  line-height: 1.5;
38
38
  position: relative;
39
39
  `
@@ -59,10 +59,6 @@ export default {
59
59
  required: false,
60
60
  default: "left",
61
61
  },
62
- marginBottom: {
63
- required: false,
64
- default: "30px",
65
- }
66
62
  },
67
63
  }
68
64
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <title-text :color="color" :fontSize="fontSize" :uppercase="uppercase">{{ text }}</title-text>
2
+ <title-text :color="color">{{ text }}</title-text>
3
3
  </template>
4
4
 
5
5
  <script>
@@ -11,12 +11,12 @@
11
11
  // />
12
12
  import styled from "vue-styled-components"
13
13
 
14
- const textAttrs = { color: String, fontSize: String, uppercase: Boolean }
14
+ const textAttrs = { color: String }
15
15
  const TitleText = styled("div", textAttrs)`
16
16
  color: ${(props) => (props.color ? props.color : props.theme.colors.black)};
17
17
  font-weight: bold;
18
- font-size: ${(props) => (props.fontSize ? props.fontSize : '16px')};
19
- text-transform: ${(props) => (props.uppercase ? 'uppercase' : 'none')};
18
+ font-size: 16px;
19
+ text-transform: uppercase;
20
20
  margin-bottom: 20px;
21
21
  `
22
22
 
@@ -32,14 +32,6 @@ export default {
32
32
  color: {
33
33
  required: false,
34
34
  },
35
- fontSize: {
36
- required: false,
37
- default: '16px'
38
- },
39
- uppercase: {
40
- required: false,
41
- default: true
42
- }
43
35
  },
44
36
  }
45
37
  </script>
@@ -8,7 +8,7 @@
8
8
  <spinner-wrapper v-if="isLoading">
9
9
  <spinner />
10
10
  </spinner-wrapper>
11
- <table-container v-else :cellPaddings="cellPaddings">
11
+ <table-container v-else>
12
12
  <slot />
13
13
  </table-container>
14
14
  </table-wrapper>
@@ -63,8 +63,7 @@ const SpinnerWrapper = styled.div`
63
63
  justify-items: center;
64
64
  `
65
65
 
66
- const containerAttrs = { cellPaddings: String }
67
- const TableContainer = styled("table", containerAttrs)`
66
+ const TableContainer = styled.table`
68
67
  width: 100%;
69
68
  border-collapse: collapse;
70
69
  border: none;
@@ -115,7 +114,7 @@ const TableContainer = styled("table", containerAttrs)`
115
114
  }
116
115
 
117
116
  td {
118
- padding: ${(props) => props.cellPaddings ? props.cellPaddings : "6px 6px 7px 4px" };
117
+ padding: 6px 6px 7px 4px;
119
118
  border-bottom: 1px solid ${(props) => props.theme.colors.grey4};
120
119
 
121
120
  &.empty {
@@ -353,10 +352,6 @@ export default {
353
352
  required: false,
354
353
  default: true,
355
354
  },
356
- cellPaddings: {
357
- required: false,
358
- default: '',
359
- },
360
355
  isLoading: {
361
356
  required: false,
362
357
  default: false,
@@ -4,6 +4,9 @@ export const stringToNumber = ({
4
4
  allowNegative
5
5
  }) => {
6
6
  // This is for saving. It converts our input string to a readable number
7
+ if (value === undefined) {
8
+ value = ''
9
+ }
7
10
  let newVal = value.toString()
8
11
  const selectedLang = localStorage.getItem('lang')
9
12
  // The first replace will replace not allowed characters with a blank
@@ -91,6 +94,7 @@ export const numberToString = ({ value, numberPrecision }) => {
91
94
  ? 'fr-fr'
92
95
  : localStorage.getItem('lang')
93
96
  : 'en-US'
97
+ value=parseFloat(value)
94
98
  return value.toLocaleString(selectedLang, {
95
99
  minimumFractionDigits: numberPrecision,
96
100
  maximumFractionDigits: numberPrecision
package/src/main.js CHANGED
@@ -1,12 +1,10 @@
1
1
  import Vue from "vue"
2
2
  import App from "./App.vue"
3
3
  import VueCompositionAPI from "@vue/composition-api"
4
- import vClickOutside from 'v-click-outside'
5
4
 
6
5
  Vue.config.productionTip = false
7
6
 
8
7
  Vue.use(VueCompositionAPI)
9
- Vue.use(vClickOutside)
10
8
 
11
9
  new Vue({
12
10
  render: (h) => h(App),
@@ -1,4 +0,0 @@
1
- <svg fill="none" height="10" viewBox="0 0 10 10" width="10" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M9.87865 8.47868L8.47865 9.87868L0.121287 1.52132L1.52129 0.121318L5.69997 4.3L9.87865 8.47868Z" fill="black"/>
3
- <path d="M1.5213 9.87868L0.121302 8.47868L8.47866 0.12132L9.87866 1.52132L1.5213 9.87868Z" fill="black"/>
4
- </svg>
@@ -1,4 +0,0 @@
1
- <svg fill="none" height="10" viewBox="0 0 10 10" width="10" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M3 9.98993L3.47934e-07 6.01003L10 6.01003V7.98993L3 7.98993L3 9.98993Z" fill="black"/>
3
- <path d="M7 0.0100708L10 3.98997H0L1.19209e-07 2.01007L7 2.01007V0.0100708Z" fill="black"/>
4
- </svg>
@@ -1,285 +0,0 @@
1
- <template>
2
- <page-container :withDate="!!date">
3
- <marker-container
4
- v-if="markerData"
5
- :backgroundColor="markerData.color"
6
- :hasIcon="!!iconName"
7
- :isEditionAllowed="editionAllowed"
8
- :isActive="activated"
9
- :cursor="cursor"
10
- @click.native="editionAllowed
11
- ? activated = !activated
12
- : ''
13
- "
14
- >
15
- <icon
16
- v-if="!!iconName"
17
- :name="iconName"
18
- color="white"
19
- size="10px"
20
- :cursor="cursor"
21
- />
22
- <span>{{ markerData.translations[activeLanguage].name }}</span>
23
- <dot-wrapper
24
- v-if="editionAllowed"
25
- class="dotContainer"
26
- >
27
- <dot-icon />
28
- <dot-icon />
29
- <dot-icon />
30
- </dot-wrapper>
31
- <edit-container
32
- v-if="activated"
33
- v-click-outside="clickOutsideActionHandler"
34
- >
35
- <edit-item @click.native="deleteModalOpened = !deleteModalOpened">
36
- <delete-icon />
37
- <div>{{ $gettext('Delete') }}</div>
38
- </edit-item>
39
- <edit-item @click.native="onEditClick">
40
- <icon-container>
41
- <icon
42
- name="edit_button"
43
- size="14px"
44
- />
45
- </icon-container>
46
- <div>{{ $gettext('Edit') }}</div>
47
- </edit-item>
48
- </edit-container>
49
- </marker-container>
50
- <date v-if="!!date">
51
- {{ date }}
52
- </date>
53
- <modal
54
- :isOpen="deleteModalOpened"
55
- @on-close="closeDeleteModal"
56
- :preventOutsideClose="true"
57
- >
58
- <modal-container>
59
- <page-title :text="$gettext('delete_confirm_text')" />
60
- <page-subtitle :text="$gettext('delete_confirm_subtext')" />
61
- <cta-container>
62
- <main-button
63
- @click.native="onDelete"
64
- :text="$gettext('Delete')"
65
- />
66
- <main-button
67
- type="cancel"
68
- @click.native="closeDeleteModal"
69
- :text="$gettext('Cancel')"
70
- />
71
- </cta-container>
72
- </modal-container>
73
- </modal>
74
- </page-container>
75
- </template>
76
-
77
- <script>
78
- // import ThreeDots from "@eturnity/eturnity_reusable_components/src/components/projectMarker"
79
- // To use:
80
- // <project-marker
81
- // :activeLanguage="'en-us'"
82
- // :markerData="{"choice":"sold","translations":{"en-us":{"name":"Sold"}}","color":"#000"}"
83
- // :isLimitedPartner="false"
84
- // :isGroupSupport="false"
85
- // :isEditable='false'
86
- // :date="'23.07.2022'"
87
- // @editHandler="onMarkerEdit($event)"
88
- // @deleteHandler="onMarkerDelete($event)"
89
- // />
90
-
91
- import styled from "vue-styled-components"
92
- import Icon from "../icon"
93
- import Modal from '../modals/modal'
94
- import PageTitle from '../pageTitle'
95
- import DeleteIcon from '../deleteIcon'
96
- import PageSubtitle from '../pageSubtitle'
97
- import MainButton from '../buttons/mainButton'
98
-
99
- const PageContainerAttrs = {
100
- withDate: Boolean
101
- }
102
- const PageContainer = styled('div', PageContainerAttrs)`
103
- display: flex;
104
- align-items: center;
105
- gap: 10px;
106
- font-size: 12px;
107
- line-height: 14px;
108
- `
109
-
110
- const ModalContainer = styled.div`
111
- padding: 40px;
112
- min-width: 500px;
113
- `
114
-
115
- const CtaContainer = styled.div`
116
- display: flex;
117
- gap: 20px;
118
- margin-top: 30px;
119
- `
120
-
121
- const MarkerAttrs = {
122
- backgroundColor: String,
123
- hasIcon: Boolean,
124
- isEditionAllowed: Boolean,
125
- isActive: Boolean,
126
- cursor: String
127
- }
128
- const MarkerContainer = styled('div', MarkerAttrs)`
129
- display: grid;
130
- grid-template-columns: ${(props) =>
131
- props.hasIcon || props.isEditionAllowed ? 'auto 1fr' : '1fr'};
132
- grid-gap: 5px;
133
- position: relative;
134
- align-items: center;
135
- padding: 2px 7px;
136
- color: ${(props) => props.theme.colors.white};
137
- background-color: ${(props) =>
138
- props.backgroundColor ? props.backgroundColor : props.theme.colors.grey3};
139
- border-radius: 4px;
140
- white-space: nowrap;
141
- cursor: ${(props) => props.isEditionAllowed ? 'pointer' : props.cursor};
142
-
143
- .dotContainer {
144
- display: ${(props) => (props.isActive ? 'flex' : 'none')};
145
- }
146
-
147
- &:hover {
148
- .dotContainer {
149
- display: flex;
150
- }
151
- }
152
- `
153
-
154
- const DotWrapper = styled.div`
155
- display: flex;
156
- gap: 2px;
157
- cursor: pointer;
158
- `
159
-
160
- const DotIcon = styled.div`
161
- width: 4px;
162
- height: 4px;
163
- border-radius: 100%;
164
- background-color: ${(props) => props.theme.colors.white};
165
- `
166
-
167
- const EditContainer = styled.div`
168
- position: absolute;
169
- z-index: 99;
170
- top: 22px;
171
- display: grid;
172
- background-color: ${(props) => props.theme.colors.white};
173
- border: 1px solid ${(props) => props.theme.colors.grey4};
174
- border-radius: 4px;
175
- cursor: pointer;
176
- overflow: hidden;
177
- `
178
-
179
- const EditItem = styled.div`
180
- display: flex;
181
- align-items: center;
182
- gap: 12px;
183
- color: ${(props) => props.theme.colors.black};
184
- font-size: 13px;
185
- padding: 4px 18px;
186
-
187
- &:hover {
188
- background-color: ${(props) => props.theme.colors.grey5};
189
- }
190
- `
191
-
192
- const IconContainer = styled.div`
193
- padding: 8px;
194
- line-height: 0;
195
- `
196
-
197
- const Date = styled.div``
198
-
199
- export default {
200
- name: "project-marker",
201
- components: {
202
- PageContainer,
203
- MarkerContainer,
204
- DotWrapper,
205
- DotIcon,
206
- EditContainer,
207
- EditItem,
208
- DeleteIcon,
209
- IconContainer,
210
- Icon,
211
- Modal,
212
- ModalContainer,
213
- CtaContainer,
214
- PageTitle,
215
- PageSubtitle,
216
- MainButton,
217
- Date
218
- },
219
- props: {
220
- markerData: {
221
- required: true
222
- },
223
- activeLanguage: {
224
- required: true
225
- },
226
- date: {
227
- required: false,
228
- default: null
229
- },
230
- isEditable: {
231
- required: false,
232
- default: false
233
- },
234
- isGroupSupport: {
235
- required: false,
236
- default: false
237
- },
238
- isLimitedPartner: {
239
- required: false,
240
- default: false
241
- },
242
- cursor: {
243
- required: false,
244
- default: 'default'
245
- }
246
- },
247
- data() {
248
- return {
249
- activated: false,
250
- deleteModalOpened: false
251
- }
252
- },
253
- computed: {
254
- editionAllowed() {
255
- return (this.markerData.can_be_deleted && (!this.isLimitedPartner || this.isGroupSupport)) && this.isEditable
256
- },
257
- iconName() {
258
- if (this.markerData.choice === 'sold') {
259
- return 'all_good'
260
- } else if (this.markerData.choice === 'lost') {
261
- return 'cross'
262
- } else if (this.markerData.choice === 'transferred') {
263
- return 'transfer'
264
- } else {
265
- return ''
266
- }
267
- }
268
- },
269
- methods: {
270
- clickOutsideActionHandler() {
271
- this.activated = false
272
- },
273
- closeDeleteModal() {
274
- this.deleteModalOpened = false
275
- },
276
- onEditClick() {
277
- this.$emit("editHandler")
278
- },
279
- onDelete() {
280
- this.closeDeleteModal()
281
- this.$emit("deleteHandler")
282
- }
283
- }
284
- }
285
- </script>