@eturnity/eturnity_reusable_components 7.48.1-EPDM-12680.26 → 7.48.1-EPDM-4900.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "7.48.1-EPDM-12680.26",
3
+ "version": "7.48.1-EPDM-4900.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -16,7 +16,8 @@
16
16
  "build-storybook": "storybook build",
17
17
  "prettier": "prettier --write 'src/**/*.{js,vue}'",
18
18
  "test": "jest",
19
- "test-coverage": "jest --coverage"
19
+ "test-coverage": "jest --coverage",
20
+ "prepublishOnly": "npm run test"
20
21
  },
21
22
  "dependencies": {
22
23
  "@originjs/vite-plugin-commonjs": "1.0.3",
@@ -52,9 +52,7 @@
52
52
  props.isDisabled
53
53
  ? props.theme.colors.disabled
54
54
  : props.customColor
55
- ? props.theme.colors[props.customColor]
56
- ? props.theme.colors[props.customColor]
57
- : props.customColor
55
+ ? props.customColor
58
56
  : props.theme.colors.yellow};
59
57
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
60
58
  user-select: none;
@@ -5,7 +5,6 @@
5
5
  :custom-color="customColor"
6
6
  :data-id="dataId"
7
7
  :font-color="fontColor"
8
- :height="height"
9
8
  :is-disabled="isDisabled"
10
9
  :min-width="minWidth"
11
10
  :no-wrap="noWrap"
@@ -44,19 +43,12 @@
44
43
  customColor: String,
45
44
  fontColor: String,
46
45
  noWrap: Boolean,
47
- height: String,
48
46
  }
49
47
  const ButtonContainer = styled('div', ButtonAttrs)`
50
- display: flex;
51
- justify-content: center;
52
48
  padding: 7px 15px;
53
49
  font-size: 13px;
54
50
  color: ${(props) =>
55
- props.isDisabled
56
- ? props.theme.colors.white
57
- : props.fontColor
58
- ? props.fontColor
59
- : props.theme.colors.white};
51
+ props.fontColor ? props.fontColor : props.theme.colors.white};
60
52
  background-color: ${(props) =>
61
53
  props.isDisabled
62
54
  ? props.theme.colors.disabled
@@ -75,7 +67,6 @@
75
67
  user-select: none;
76
68
  ${(props) => (props.minWidth ? `min-width: ${props.minWidth};` : '')};
77
69
  ${(props) => (props.noWrap ? `white-space: nowrap;` : '')};
78
- height: ${(props) => props.height};
79
70
 
80
71
  &:hover {
81
72
  opacity: ${(props) => (props.isDisabled ? '1' : '0.8')};
@@ -145,11 +136,6 @@
145
136
  default: null,
146
137
  type: String,
147
138
  },
148
- height: {
149
- required: false,
150
- default: 'auto',
151
- type: String,
152
- },
153
139
  id: {
154
140
  required: false,
155
141
  default: null,
@@ -35,7 +35,6 @@
35
35
  },
36
36
  name: {
37
37
  required: true,
38
- type: String,
39
38
  },
40
39
  color: {
41
40
  required: false,
@@ -2,16 +2,14 @@
2
2
  <PageContainer ref="container">
3
3
  <div
4
4
  ref="icon"
5
- data-test-id="infoText_trigger"
6
- @click=";(isMobile || openTrigger === 'onClick') && toggleInfo()"
7
- @mouseenter="!isMobile && openTrigger === 'onHover' && showInfo()"
8
- @mouseleave="!isMobile && openTrigger === 'onHover' && hideInfo()"
5
+ @click="openTrigger === 'onClick' && toggleInfo()"
6
+ @mouseenter="openTrigger === 'onHover' && showInfo()"
7
+ @mouseleave="openTrigger === 'onHover' && hideInfo()"
9
8
  >
10
9
  <IconComponent
11
- :color="iconColor || computedIconColor"
12
- :cursor="isDisabled ? 'not-allowed' : 'pointer'"
13
- :disabled="isDisabled"
14
- :name="iconName"
10
+ :color="iconColor"
11
+ cursor="pointer"
12
+ name="info"
15
13
  :size="size"
16
14
  />
17
15
  </div>
@@ -113,9 +111,8 @@
113
111
  },
114
112
  props: {
115
113
  text: {
116
- required: false,
117
- default: '',
118
114
  type: String,
115
+ default: '',
119
116
  },
120
117
  size: {
121
118
  type: String,
@@ -145,20 +142,6 @@
145
142
  type: String,
146
143
  default: '',
147
144
  },
148
- iconName: {
149
- type: String,
150
- default: 'info',
151
- },
152
- iconColor: {
153
- type: String,
154
- default: null,
155
- required: false,
156
- },
157
- isDisabled: {
158
- type: Boolean,
159
- default: false,
160
- required: false,
161
- },
162
145
  },
163
146
  setup(props) {
164
147
  const isVisible = ref(false)
@@ -172,7 +155,6 @@
172
155
  const boxStyle = ref({})
173
156
  const arrowStyle = ref({})
174
157
  const wrapperStyle = ref({})
175
- const isMobile = ref(window.innerWidth <= 768)
176
158
 
177
159
  const textStyle = computed(() => ({
178
160
  fontSize: props.image ? '12px' : '13px',
@@ -305,10 +287,7 @@
305
287
  }
306
288
 
307
289
  const handleClickOutside = (event) => {
308
- if (
309
- (props.openTrigger === 'onClick' || isMobile.value) &&
310
- isVisible.value
311
- ) {
290
+ if (props.openTrigger === 'onClick' && isVisible.value) {
312
291
  const clickedElement = event.target
313
292
  if (
314
293
  infoBox.value &&
@@ -320,14 +299,9 @@
320
299
  }
321
300
  }
322
301
 
323
- const handleResize = () => {
324
- isMobile.value = window.innerWidth <= 768
325
- updatePosition()
326
- }
327
-
328
302
  onMounted(() => {
329
303
  window.addEventListener('scroll', handleScroll, { passive: true })
330
- window.addEventListener('resize', handleResize)
304
+ window.addEventListener('resize', updatePosition)
331
305
  document.addEventListener('scroll', handleScroll, {
332
306
  passive: true,
333
307
  capture: true,
@@ -337,7 +311,7 @@
337
311
 
338
312
  onUnmounted(() => {
339
313
  window.removeEventListener('scroll', handleScroll)
340
- window.removeEventListener('resize', handleResize)
314
+ window.removeEventListener('resize', updatePosition)
341
315
  document.removeEventListener('scroll', handleScroll, { capture: true })
342
316
  document.removeEventListener('click', handleClickOutside)
343
317
  })
@@ -365,11 +339,10 @@
365
339
  wrapperStyle,
366
340
  textStyle,
367
341
  onImageLoad,
368
- isMobile,
369
342
  }
370
343
  },
371
344
  computed: {
372
- computedIconColor() {
345
+ iconColor() {
373
346
  return this.buttonType === 'error'
374
347
  ? theme.colors.red
375
348
  : theme.colors.mediumGray
@@ -163,7 +163,7 @@
163
163
  const LabelText = styled.div`
164
164
  font-size: 13px;
165
165
  display: grid;
166
- align-items: center;
166
+ align-items: flex-start;
167
167
  min-height: 18px;
168
168
  `
169
169
 
@@ -13,11 +13,7 @@
13
13
  </LabelSlotWrapper>
14
14
 
15
15
  <LabelWrapper v-if="labelText">
16
- <LabelText
17
- :data-id="labelDataId"
18
- :label-font-color="labelFontColor"
19
- :label-font-weight="labelFontWeight"
20
- >
16
+ <LabelText :data-id="labelDataId" :label-font-color="labelFontColor">
21
17
  {{ labelText }}
22
18
  </LabelText>
23
19
 
@@ -32,14 +28,11 @@
32
28
  v-bind="$attrs"
33
29
  ref="inputField1"
34
30
  :align-items="alignItems"
35
- :background-color="
36
- colorMode === 'transparent' ? 'transparent' : backgroundColor
37
- "
38
- :border-color="colorMode === 'transparent' ? 'white' : borderColor"
39
- :color-mode="colorMode"
31
+ :background-color="backgroundColor"
32
+ :border-color="borderColor"
40
33
  :data-id="inputDataId"
41
34
  :disabled="disabled"
42
- :font-color="colorMode === 'transparent' ? 'white' : fontColor"
35
+ :font-color="fontColor"
43
36
  :font-size="fontSize"
44
37
  :has-label-slot="hasLabelSlot"
45
38
  :has-slot="hasSlot"
@@ -51,7 +44,6 @@
51
44
  :min-width="minWidth"
52
45
  :no-border="noBorder"
53
46
  :placeholder="displayedPlaceholder"
54
- :show-arrow-controls="showArrowControls"
55
47
  :show-linear-unit-name="showLinearUnitName"
56
48
  :slot-size="slotSize"
57
49
  :text-align="textAlign"
@@ -59,8 +51,6 @@
59
51
  @blur="onInputBlur($event)"
60
52
  @focus="focusInput()"
61
53
  @input="onInput($event)"
62
- @keydown.down="decrementValue"
63
- @keydown.up="incrementValue"
64
54
  @keyup.enter="onEnterPress"
65
55
  />
66
56
  <SlotContainer v-if="hasSlot" :is-error="isError" :slot-size="slotSize">
@@ -102,31 +92,6 @@
102
92
  </template>
103
93
  </RCSelect>
104
94
  </SelectWrapper>
105
-
106
- <ArrowControls
107
- v-if="!disabled && showArrowControls"
108
- :color-mode="colorMode"
109
- >
110
- <ArrowButton @click="incrementValue">
111
- <Icon
112
- :color="colorMode === 'transparent' ? 'white' : undefined"
113
- name="arrow_up"
114
- size="8px"
115
- />
116
- </ArrowButton>
117
- <ArrowDivider :color-mode="colorMode" />
118
- <ArrowButton
119
- :is-disabled="textInput <= minNumber"
120
- @click="decrementValue"
121
- >
122
- <Icon
123
- :color="colorMode === 'transparent' ? 'white' : undefined"
124
- :disabled="textInput <= minNumber"
125
- name="arrow_down"
126
- size="8px"
127
- />
128
- </ArrowButton>
129
- </ArrowControls>
130
95
  </InputWrapper>
131
96
  <ErrorMessage v-if="isError">{{ errorMessage }}</ErrorMessage>
132
97
  </Container>
@@ -158,7 +123,6 @@
158
123
  // labelInfoAlign="left"
159
124
  // :minNumber="0"
160
125
  // fontColor="blue"
161
- // colorMode="transparent" // Makes background transparent, border white, and font white
162
126
  // >
163
127
  //<template name=label><img>....</template>
164
128
  //</inputNumber>
@@ -192,11 +156,8 @@
192
156
  isInteractive: Boolean,
193
157
  alignItems: String,
194
158
  labelFontColor: String,
195
- labelFontWeight: String,
196
159
  borderColor: String,
197
160
  showLinearUnitName: Boolean,
198
- colorMode: String,
199
- showArrowControls: Boolean,
200
161
  }
201
162
 
202
163
  const Container = styled('div', inputProps)`
@@ -220,20 +181,9 @@
220
181
  : '1px solid ' + props.theme.colors.grey4};
221
182
  height: ${(props) => props.inputHeight};
222
183
  max-height: ${(props) => props.inputHeight};
223
- padding: ${({ colorMode }) =>
224
- colorMode === 'transparent' ? '10px 15px' : '0 10px'};
225
- padding-right: ${({
226
- slotSize,
227
- isError,
228
- showLinearUnitName,
229
- colorMode,
230
- showArrowControls,
231
- }) =>
232
- showArrowControls
233
- ? '40px'
234
- : colorMode === 'transparent'
235
- ? '0'
236
- : slotSize
184
+ padding: 0 10px;
185
+ padding-right: ${({ slotSize, isError, showLinearUnitName }) =>
186
+ slotSize
237
187
  ? isError && !showLinearUnitName
238
188
  ? 'calc(' + slotSize + ' + 24px)'
239
189
  : 'calc(' + slotSize + ' + 10px)'
@@ -251,26 +201,20 @@
251
201
  props.isError
252
202
  ? props.theme.colors.grey6
253
203
  : props.isDisabled
254
- ? props.colorMode === 'transparent'
255
- ? props.theme.colors.white
256
- : props.theme.colors.grey2
204
+ ? props.theme.colors.grey2
257
205
  : props.fontColor
258
206
  ? props.fontColor + ' !important'
259
207
  : props.theme.colors.black};
260
208
  background-color: ${(props) =>
261
- props.isDisabled
262
- ? props.colorMode === 'transparent'
263
- ? 'transparent'
264
- : props.theme.colors.disabled
265
- : props.backgroundColor
209
+ props.backgroundColor
266
210
  ? props.backgroundColor + ' !important'
267
211
  : props.theme.colors.white};
268
212
  width: ${(props) =>
269
213
  props.inputWidth && !props.hasLabelSlot ? props.inputWidth : '100%'};
270
214
  min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
215
+ background-color: ${(props) =>
216
+ props.isDisabled ? props.theme.colors.grey5 : '#fff'};
271
217
  box-sizing: border-box;
272
- opacity: ${(props) =>
273
- props.isDisabled && props.colorMode === 'transparent' ? '0.4' : '1'};
274
218
 
275
219
  &::placeholder {
276
220
  color: ${(props) => props.theme.colors.grey2};
@@ -281,55 +225,6 @@
281
225
  }
282
226
  `
283
227
 
284
- const ArrowControlsProps = {
285
- colorMode: String,
286
- }
287
- const ArrowControls = styled('div', ArrowControlsProps)`
288
- position: absolute;
289
- right: 0;
290
- top: 0;
291
- bottom: 0;
292
- display: grid;
293
- grid-template-rows: 1fr auto 1fr;
294
- align-items: center;
295
- justify-items: center;
296
- cursor: pointer;
297
- width: 30px;
298
- background-color: ${(props) =>
299
- props.colorMode === 'transparent'
300
- ? 'transparent'
301
- : props.theme.colors.white};
302
- border-left: 1px solid
303
- ${(props) =>
304
- props.colorMode === 'transparent'
305
- ? props.theme.colors.white
306
- : props.theme.colors.black};
307
- `
308
-
309
- const ArrowButtonProps = {
310
- isDisabled: Boolean,
311
- }
312
- const ArrowButton = styled('button', ArrowButtonProps)`
313
- background: transparent;
314
- opacity: ${(props) => (props.isDisabled ? '0.2' : '1')};
315
- cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
316
- display: flex;
317
- align-items: center;
318
- justify-content: center;
319
- padding: 0;
320
- width: 100%;
321
- height: 100%;
322
- `
323
-
324
- const ArrowDivider = styled('div', ArrowControlsProps)`
325
- width: 100%;
326
- height: 1px;
327
- background-color: ${(props) =>
328
- props.colorMode === 'transparent'
329
- ? props.theme.colors.white
330
- : props.theme.colors.black};
331
- `
332
-
333
228
  const InputWrapper = styled.span`
334
229
  position: relative;
335
230
  `
@@ -412,7 +307,7 @@
412
307
  props.theme.colors[props.labelFontColor]
413
308
  ? props.theme.colors[props.labelFontColor]
414
309
  : props.labelFontColor};
415
- font-weight: ${(props) => props.labelFontWeight};
310
+ font-weight: 700;
416
311
  `
417
312
 
418
313
  const IconAttrs = { size: String, marginRight: Number }
@@ -464,184 +359,140 @@
464
359
  SelectWrapper,
465
360
  SelectText,
466
361
  Divider,
467
- ArrowControls,
468
- ArrowButton,
469
- ArrowDivider,
470
362
  },
471
363
  inheritAttrs: false,
472
364
  props: {
473
365
  placeholder: {
474
- type: String,
475
366
  required: false,
476
367
  default: '',
477
368
  },
478
369
  isError: {
479
- type: Boolean,
480
370
  required: false,
481
371
  default: false,
482
372
  },
483
373
  inputWidth: {
484
- type: String,
485
374
  required: false,
486
375
  default: null,
487
376
  },
488
377
  minWidth: {
489
- type: String,
490
378
  required: false,
491
379
  default: null,
492
380
  },
493
381
  inputHeight: {
494
- type: String,
495
382
  required: false,
496
383
  default: '40px',
497
384
  },
498
385
  value: {
499
- type: [String, Number],
500
386
  required: true,
501
387
  default: null,
502
388
  },
503
389
  clearInput: {
504
- type: Boolean,
505
390
  required: false,
506
391
  default: false,
507
392
  },
508
393
  alignItems: {
509
- type: String,
510
394
  required: false,
511
395
  default: 'vertical',
512
396
  },
513
397
  errorMessage: {
514
- type: String,
515
398
  required: false,
516
399
  default: 'Please insert a correct number',
517
400
  },
518
401
  numberPrecision: {
519
- type: Number,
520
402
  required: false,
521
403
  default: 0,
522
404
  },
523
405
  minDecimals: {
524
- type: Number,
525
406
  required: false,
526
407
  default: 0,
527
408
  },
528
409
  unitName: {
529
- type: String,
530
410
  required: false,
531
411
  default: '',
532
412
  },
533
413
  showLinearUnitName: {
534
- type: Boolean,
535
414
  required: false,
536
415
  default: false,
537
416
  },
538
417
  disabled: {
539
- type: Boolean,
540
418
  required: false,
541
419
  default: false,
542
420
  },
543
421
  noBorder: {
544
- type: Boolean,
545
422
  required: false,
546
423
  default: false,
547
424
  },
548
425
  borderColor: {
549
- type: String,
550
426
  required: false,
551
- default: null,
552
427
  },
553
428
  textAlign: {
554
- type: String,
555
429
  required: false,
556
430
  default: 'left',
557
431
  },
558
432
  fontSize: {
559
- type: String,
560
433
  required: false,
561
434
  default: '13px',
562
435
  },
563
436
  isInteractive: {
564
- type: Boolean,
565
437
  required: false,
566
438
  default: false,
567
439
  },
568
440
  interactionStep: {
569
- type: Number,
570
441
  required: false,
571
442
  default: 1,
572
443
  },
573
444
  labelText: {
574
- type: String,
575
445
  required: false,
576
446
  default: null,
577
447
  },
578
448
  labelInfoText: {
579
- type: String,
580
449
  required: false,
581
450
  default: null,
582
451
  },
583
452
  labelInfoAlign: {
584
- type: String,
585
453
  required: false,
586
454
  default: 'left',
587
455
  },
588
456
  defaultNumber: {
589
- type: Number,
590
457
  required: false,
591
458
  default: null,
592
459
  },
593
460
  minNumber: {
594
- type: Number,
595
461
  required: false,
596
462
  default: null,
597
463
  },
598
464
  fontColor: {
599
- type: String,
600
465
  required: false,
601
466
  default: null,
602
467
  },
603
468
  backgroundColor: {
604
- type: String,
605
469
  required: false,
606
470
  default: null,
607
471
  },
608
472
  numberToStringEnabled: {
609
- type: Boolean,
610
473
  required: false,
611
474
  default: true,
612
475
  },
613
476
  allowNegative: {
614
- type: Boolean,
615
477
  required: false,
616
478
  default: true,
617
479
  },
618
480
  slotSize: {
619
- type: String,
620
481
  required: false,
621
- default: null,
622
482
  },
623
483
  labelFontColor: {
624
- type: String,
625
484
  required: false,
626
485
  default: 'eturnityGrey',
627
486
  },
628
- labelFontWeight: {
629
- type: String,
630
- required: false,
631
- default: '700',
632
- },
633
487
  focus: {
634
- type: Boolean,
635
488
  required: false,
636
489
  default: false,
637
490
  },
638
491
  labelDataId: {
639
- type: String,
640
492
  required: false,
641
493
  default: '',
642
494
  },
643
495
  inputDataId: {
644
- type: String,
645
496
  required: false,
646
497
  default: '',
647
498
  },
@@ -665,14 +516,6 @@
665
516
  type: Boolean,
666
517
  default: false,
667
518
  },
668
- colorMode: {
669
- type: String,
670
- default: '',
671
- },
672
- showArrowControls: {
673
- type: Boolean,
674
- default: false,
675
- },
676
519
  },
677
520
  data() {
678
521
  return {
@@ -742,36 +585,6 @@
742
585
  }
743
586
  },
744
587
  methods: {
745
- incrementValue() {
746
- const currentValue = Math.max(
747
- parseFloat(this.textInput || 0),
748
- this.minNumber || 0
749
- )
750
- const newValue = currentValue + this.interactionStep
751
- this.textInput = numberToString({
752
- value: newValue,
753
- numberPrecision: this.numberPrecision,
754
- minDecimals: this.minDecimals,
755
- })
756
- this.$emit('on-input', newValue)
757
- this.$emit('input-change', newValue)
758
- },
759
- decrementValue() {
760
- const currentValue = Math.max(
761
- parseFloat(this.textInput || 0),
762
- this.minNumber || 0
763
- )
764
- const newValue = currentValue - this.interactionStep
765
- if (this.allowNegative || newValue >= 0) {
766
- this.textInput = numberToString({
767
- value: newValue,
768
- numberPrecision: this.numberPrecision,
769
- minDecimals: this.minDecimals,
770
- })
771
- this.$emit('on-input', newValue)
772
- this.$emit('input-change', newValue)
773
- }
774
- },
775
588
  onEnterPress() {
776
589
  this.$emit('on-enter-click')
777
590
  this.$refs.inputField1.$el.blur()
@@ -867,7 +680,6 @@
867
680
  this.$emit('on-input', evaluatedVal)
868
681
  }
869
682
  }
870
- this.textInput = evaluatedVal
871
683
  },
872
684
  onInputBlur(e) {
873
685
  this.isFocused = false