@eturnity/eturnity_reusable_components 8.22.23-EPDM-15023.0 → 8.22.23-EPDM-15888.1

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.es15.js CHANGED
@@ -10,13 +10,11 @@ const ButtonAttrs = {
10
10
  type: String,
11
11
  isDisabled: Boolean,
12
12
  minWidth: String,
13
- width: String,
14
13
  noWrap: Boolean,
15
14
  height: String,
16
15
  variant: String,
17
16
  buttonSize: String,
18
- appTheme: String,
19
- isActive: Boolean
17
+ appTheme: String
20
18
  };
21
19
  const ButtonContainer = styled("div", ButtonAttrs)`
22
20
  display: flex;
@@ -30,7 +28,7 @@ const ButtonContainer = styled("div", ButtonAttrs)`
30
28
  return (_d = (_c = (_b = (_a = props.theme) == null ? void 0 : _a.mainButton) == null ? void 0 : _b.size) == null ? void 0 : _c[props.buttonSize]) == null ? void 0 : _d.fontSize;
31
29
  }};
32
30
  color: ${(props) => props.isDisabled ? props.theme.mainButton[props.appTheme][props.type][props.variant].disabled.textColor : props.theme.mainButton[props.appTheme][props.type][props.variant].default.textColor};
33
- background-color: ${(props) => props.isDisabled ? props.theme.mainButton[props.appTheme][props.type][props.variant].disabled.backgroundColor : props.isActive ? props.theme.mainButton[props.appTheme][props.type][props.variant].active.backgroundColor : props.theme.mainButton[props.appTheme][props.type][props.variant].default.backgroundColor};
31
+ background-color: ${(props) => props.isDisabled ? props.theme.mainButton[props.appTheme][props.type][props.variant].disabled.backgroundColor : props.theme.mainButton[props.appTheme][props.type][props.variant].default.backgroundColor};
34
32
  border: ${(props) => {
35
33
  const borderValue = props.isDisabled ? props.theme.mainButton[props.appTheme][props.type][props.variant].disabled.borderColor : props.theme.mainButton[props.appTheme][props.type][props.variant].default.borderColor;
36
34
  return borderValue ? "1px solid " + borderValue : "none";
@@ -43,7 +41,7 @@ const ButtonContainer = styled("div", ButtonAttrs)`
43
41
  ${(props) => props.noWrap ? `white-space: nowrap;` : ""};
44
42
  height: ${(props) => props.height};
45
43
  line-height: 1;
46
- width: ${(props) => props.width};
44
+
47
45
  &:hover {
48
46
  background-color: ${(props) => props.isDisabled ? props.theme.mainButton[props.appTheme][props.type][props.variant].disabled.backgroundColor : props.theme.mainButton[props.appTheme][props.type][props.variant].hover.backgroundColor};
49
47
  }
@@ -107,11 +105,6 @@ const _sfc_main = {
107
105
  default: false,
108
106
  type: Boolean
109
107
  },
110
- isActive: {
111
- required: false,
112
- default: false,
113
- type: Boolean
114
- },
115
108
  icon: {
116
109
  required: false,
117
110
  default: null,
@@ -146,11 +139,6 @@ const _sfc_main = {
146
139
  default: null,
147
140
  type: String
148
141
  },
149
- width: {
150
- required: false,
151
- default: "auto",
152
- type: String
153
- },
154
142
  height: {
155
143
  required: false,
156
144
  default: "auto",
@@ -201,13 +189,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
201
189
  "data-id": $props.dataId,
202
190
  "data-qa-id": $props.dataQaId,
203
191
  height: $props.height,
204
- "is-active": $props.isActive,
205
192
  "is-disabled": $props.isDisabled,
206
193
  "min-width": $props.minWidth,
207
194
  "no-wrap": $props.noWrap,
208
195
  type: $props.type,
209
- variant: $props.variant,
210
- width: $props.width
196
+ variant: $props.variant
211
197
  }, {
212
198
  default: withCtx(() => [createVNode(_component_LabelComponent, {
213
199
  "has-icon": Boolean($props.icon)
@@ -222,7 +208,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
222
208
  _: 1
223
209
  }, 8, ["has-icon"])]),
224
210
  _: 1
225
- }, 8, ["id", "app-theme", "button-size", "data-id", "data-qa-id", "height", "is-active", "is-disabled", "min-width", "no-wrap", "type", "variant", "width"])]),
211
+ }, 8, ["id", "app-theme", "button-size", "data-id", "data-qa-id", "height", "is-disabled", "min-width", "no-wrap", "type", "variant"])]),
226
212
  _: 1
227
213
  });
228
214
  }
package/dist/main.es21.js CHANGED
@@ -503,7 +503,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
503
503
  _: 1
504
504
  }, 8, ["color", "size"])) : createCommentVNode("", true)], 64)) : createCommentVNode("", true), createTextVNode(), renderSlot(_ctx.$slots, "trigger")]),
505
505
  _: 3
506
- }, 8, ["background-color", "border-radius", "hovered-icon", "is-active", "is-disabled", "padding"])], 512), createTextVNode(), !$props.hideInfoText && $setup.isVisible && (!!$props.text || _ctx.$slots.default) ? (openBlock(), createBlock(Teleport, {
506
+ }, 8, ["background-color", "border-radius", "hovered-icon", "is-active", "is-disabled", "padding"])], 512), createTextVNode(), $setup.isVisible && (!!$props.text || _ctx.$slots.default) ? (openBlock(), createBlock(Teleport, {
507
507
  key: 0,
508
508
  to: "body"
509
509
  }, [createVNode(_component_TextWrapper, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "8.22.23-EPDM-15023.0",
3
+ "version": "8.22.23-EPDM-15888.1",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -7,13 +7,11 @@
7
7
  :data-id="dataId"
8
8
  :data-qa-id="dataQaId"
9
9
  :height="height"
10
- :is-active="isActive"
11
10
  :is-disabled="isDisabled"
12
11
  :min-width="minWidth"
13
12
  :no-wrap="noWrap"
14
13
  :type="type"
15
14
  :variant="variant"
16
- :width="width"
17
15
  >
18
16
  <LabelComponent :has-icon="Boolean(icon)">
19
17
  <Icon
@@ -52,13 +50,11 @@
52
50
  type: String,
53
51
  isDisabled: Boolean,
54
52
  minWidth: String,
55
- width: String,
56
53
  noWrap: Boolean,
57
54
  height: String,
58
55
  variant: String,
59
56
  buttonSize: String,
60
57
  appTheme: String,
61
- isActive: Boolean,
62
58
  }
63
59
  const ButtonContainer = styled('div', ButtonAttrs)`
64
60
  display: flex;
@@ -77,9 +73,6 @@
77
73
  props.isDisabled
78
74
  ? props.theme.mainButton[props.appTheme][props.type][props.variant]
79
75
  .disabled.backgroundColor
80
- : props.isActive
81
- ? props.theme.mainButton[props.appTheme][props.type][props.variant]
82
- .active.backgroundColor
83
76
  : props.theme.mainButton[props.appTheme][props.type][props.variant]
84
77
  .default.backgroundColor};
85
78
  border: ${(props) => {
@@ -98,7 +91,7 @@
98
91
  ${(props) => (props.noWrap ? `white-space: nowrap;` : '')};
99
92
  height: ${(props) => props.height};
100
93
  line-height: 1;
101
- width: ${(props) => props.width};
94
+
102
95
  &:hover {
103
96
  background-color: ${(props) =>
104
97
  props.isDisabled
@@ -177,11 +170,6 @@
177
170
  default: false,
178
171
  type: Boolean,
179
172
  },
180
- isActive: {
181
- required: false,
182
- default: false,
183
- type: Boolean,
184
- },
185
173
  icon: {
186
174
  required: false,
187
175
  default: null,
@@ -216,11 +204,6 @@
216
204
  default: null,
217
205
  type: String,
218
206
  },
219
- width: {
220
- required: false,
221
- default: 'auto',
222
- type: String,
223
- },
224
207
  height: {
225
208
  required: false,
226
209
  default: 'auto',
@@ -49,10 +49,7 @@
49
49
  <slot name="trigger"></slot>
50
50
  </IconWrapper>
51
51
  </div>
52
- <Teleport
53
- v-if="!hideInfoText && isVisible && (!!text || $slots.default)"
54
- to="body"
55
- >
52
+ <Teleport v-if="isVisible && (!!text || $slots.default)" to="body">
56
53
  <TextWrapper data-test-id="info_text_wrapper" :style="wrapperStyle">
57
54
  <TextOverlay
58
55
  ref="infoBox"
@@ -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'
@@ -798,10 +799,6 @@
798
799
  type: Boolean,
799
800
  default: false,
800
801
  },
801
- hasSpaceBetweenUnit: {
802
- type: Boolean,
803
- default: true,
804
- },
805
802
  },
806
803
  data() {
807
804
  return {
@@ -815,12 +812,8 @@
815
812
  displayedPlaceholder() {
816
813
  if (this.placeholder) return this.placeholder
817
814
  if (this.defaultNumber)
818
- return `${this.defaultNumber}${this.hasSpaceBetweenUnit ? ' ' : ''}${
819
- this.unitName ? this.unitName : ''
820
- }`
821
- return `${this.minNumber || 0}${this.hasSpaceBetweenUnit ? ' ' : ''}${
822
- this.unitName ? this.unitName : ''
823
- }`
815
+ return `${this.defaultNumber} ${this.unitName ? this.unitName : ''}`
816
+ return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
824
817
  },
825
818
  hasSlot() {
826
819
  return !!this.$slots.default
@@ -869,7 +862,7 @@
869
862
  this.inputValue = this.value
870
863
  this.enteredValue =
871
864
  typeof this.value === 'number' && !isNaN(this.value)
872
- ? Number(this.value.toFixed(this.numberPrecision))
865
+ ? roundViaInteger(this.value, this.numberPrecision)
873
866
  : this.value
874
867
  }
875
868
  },
@@ -973,7 +966,7 @@
973
966
  minDecimals: this.minDecimals,
974
967
  })
975
968
  } else if (typeof evaluated === 'number') {
976
- evaluated = evaluated.toFixed(this.numberPrecision)
969
+ evaluated = roundViaInteger(evaluated, this.numberPrecision)
977
970
  }
978
971
  return evaluated
979
972
  },
@@ -1034,9 +1027,8 @@
1034
1027
  return
1035
1028
  }
1036
1029
  this.textInput = this.formatWithCurrency(this.value)
1037
- const textInputWithoutUnit = this.formatWithoutUnit(this.value)
1038
1030
  this.enteredValue = stringToNumber({
1039
- value: textInputWithoutUnit,
1031
+ value: this.textInput,
1040
1032
  numberPrecision: this.numberPrecision,
1041
1033
  minDecimals: this.minDecimals,
1042
1034
  })
@@ -1057,38 +1049,6 @@
1057
1049
  this.$refs.inputField1.$el.blur()
1058
1050
  })
1059
1051
  },
1060
- formatWithoutUnit(value) {
1061
- let adjustedMinValue =
1062
- value || value === 0
1063
- ? value
1064
- : this.defaultNumber
1065
- ? this.defaultNumber
1066
- : this.minNumber || this.minNumber === 0
1067
- ? this.minNumber
1068
- : ''
1069
- if (adjustedMinValue || adjustedMinValue === 0) {
1070
- let input = this.numberToStringEnabled
1071
- ? numberToString({
1072
- value: adjustedMinValue,
1073
- numberPrecision: this.numberPrecision,
1074
- minDecimals: this.minDecimals,
1075
- })
1076
- : adjustedMinValue
1077
- return input
1078
- } else if (!adjustedMinValue && adjustedMinValue !== 0) {
1079
- return ''
1080
- } else if (this.isFocused) {
1081
- return value
1082
- } else {
1083
- return this.numberToStringEnabled
1084
- ? numberToString({
1085
- value: adjustedMinValue,
1086
- numberPrecision: this.numberPrecision,
1087
- minDecimals: this.minDecimals,
1088
- })
1089
- : adjustedMinValue
1090
- }
1091
- },
1092
1052
  formatWithCurrency(value) {
1093
1053
  let adjustedMinValue =
1094
1054
  value || value === 0
@@ -1109,7 +1069,7 @@
1109
1069
  let unit = this.showLinearUnitName ? '' : this.unitName
1110
1070
  //return input + ' ' + unit
1111
1071
  if (unit) {
1112
- return `${input}${this.hasSpaceBetweenUnit ? ' ' : ''}${unit}`
1072
+ return input + ' ' + unit
1113
1073
  }
1114
1074
  return input
1115
1075
  } else if (!adjustedMinValue && adjustedMinValue !== 0) {
@@ -87,11 +87,20 @@ export const stringToNumber = ({
87
87
  }
88
88
  newVal = parseFloat(newVal)
89
89
  if (numberPrecision !== false) {
90
- newVal = newVal.toFixed(numberPrecision)
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