@eturnity/eturnity_reusable_components 7.48.0 → 7.48.1-EPDM-12680.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.0",
3
+ "version": "7.48.1-EPDM-12680.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none">
2
+ <path d="M3 2L7 5L11 2" stroke="white" stroke-width="1.27273" class="fix"/>
3
+ <path d="M3 12L7 9L11 12" stroke="white" stroke-width="1.27273" class="fix"/>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M4.22998 11.8962H10.5006H12.2505V10.1463V8.97906H14.0004V5.47917H12.2505V4.31283V2.56289V2.55151H10.5006V2.56289H8.58218L7.76617 4.31283H10.5006V10.1463H5.04599L4.22998 11.8962Z" fill="white"/>
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M7.2622 4.79738C6.91629 4.63687 6.53076 4.54729 6.12431 4.54729C4.63054 4.54729 3.41919 5.75796 3.41919 7.25241C3.41919 8.33588 4.05591 9.26984 4.97534 9.70158L7.2622 4.79738ZM5.44786 3.11681C5.44786 3.49042 5.7507 3.79326 6.12431 3.79326C6.49793 3.79326 6.80077 3.49042 6.80077 3.11681V1.76459C6.80077 1.39097 6.49793 1.08813 6.12431 1.08813C5.7507 1.08813 5.44786 1.39097 5.44786 1.76459V3.11681ZM2.02818 7.88939H0.675962C0.302349 7.88939 -0.000488281 7.58655 -0.000488281 7.21294C-0.000488281 6.83932 0.302349 6.53649 0.675962 6.53649H2.02818C2.4018 6.53649 2.70463 6.83932 2.70463 7.21294C2.70463 7.58655 2.4018 7.88939 2.02818 7.88939ZM3.7057 10.5877L2.74955 11.5439C2.4855 11.8079 2.05745 11.8079 1.7934 11.5439C1.52935 11.2798 1.52935 10.8518 1.7934 10.5877L2.74955 9.63155C3.0136 9.36751 3.44165 9.36751 3.7057 9.63155C3.96975 9.8956 3.96975 10.3237 3.7057 10.5877ZM2.74955 4.79432L1.7934 3.83817C1.52935 3.57412 1.52935 3.14607 1.7934 2.88202C2.05745 2.61797 2.4855 2.61797 2.74955 2.88202L3.7057 3.83817C3.96975 4.10222 3.96975 4.53027 3.7057 4.79432C3.44165 5.05837 3.0136 5.05837 2.74955 4.79432Z" fill="white"/>
4
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M11.0722 3.6H1.6V10.4H11.0722L7.87332 7.60217L7.18484 7L7.87332 6.39783L11.0722 3.6ZM12.4 9.43572V4.56428L9.61516 7L12.4 9.43572ZM0 2H1.6H12.4H14V3.6V10.4V12H12.4H1.6H0V10.4V3.6V2Z" fill="white"/>
3
+ </svg>
@@ -0,0 +1,6 @@
1
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect x="3.11079" y="3.10981" width="7.77778" height="7.77778" stroke="white" stroke-width="1.55556"/>
3
+ <line x1="3.72749" y1="10.3387" x2="10.7275" y2="3.3387" stroke="white" stroke-width="1.55556"/>
4
+ <line x1="-0.000366211" y1="7.05425" x2="2.99963" y2="7.05425" stroke="white" stroke-width="1.55556"/>
5
+ <line x1="10.9994" y1="6.99957" x2="13.9994" y2="6.99957" stroke="white" stroke-width="1.55556"/>
6
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg width="10" height="11" viewBox="0 0 10 11" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M2.85714 1.92857C2.85714 2.71755 2.21755 3.35714 1.42857 3.35714C0.639593 3.35714 0 2.71755 0 1.92857C0 1.13959 0.639593 0.5 1.42857 0.5C2.21755 0.5 2.85714 1.13959 2.85714 1.92857Z" fill="white"/>
3
+ <path d="M10 9.07143C10 9.86041 9.36041 10.5 8.57143 10.5C7.78245 10.5 7.14286 9.86041 7.14286 9.07143C7.14286 8.28245 7.78245 7.64286 8.57143 7.64286C9.36041 7.64286 10 8.28245 10 9.07143Z" fill="white"/>
4
+ <path d="M5.71429 3C5.71429 2.40827 6.19398 1.92857 6.78571 1.92857C7.37745 1.92857 7.85714 2.40827 7.85714 3V6.21429H9.28571V3C9.28571 1.61929 8.16643 0.5 6.78571 0.5C5.405 0.5 4.28571 1.61929 4.28571 3V8C4.28571 8.59173 3.80602 9.07143 3.21429 9.07143C2.62255 9.07143 2.14286 8.59173 2.14286 8V4.78571H0.714286V8C0.714286 9.38071 1.83357 10.5 3.21429 10.5C4.595 10.5 5.71429 9.38071 5.71429 8V3Z" fill="white"/>
5
+ </svg>
@@ -52,7 +52,9 @@
52
52
  props.isDisabled
53
53
  ? props.theme.colors.disabled
54
54
  : props.customColor
55
- ? props.customColor
55
+ ? props.theme.colors[props.customColor]
56
+ ? props.theme.colors[props.customColor]
57
+ : props.customColor
56
58
  : props.theme.colors.yellow};
57
59
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
58
60
  user-select: none;
@@ -35,6 +35,7 @@
35
35
  },
36
36
  name: {
37
37
  required: true,
38
+ type: String,
38
39
  },
39
40
  color: {
40
41
  required: false,
@@ -28,11 +28,14 @@
28
28
  v-bind="$attrs"
29
29
  ref="inputField1"
30
30
  :align-items="alignItems"
31
- :background-color="backgroundColor"
32
- :border-color="borderColor"
31
+ :background-color="
32
+ colorMode === 'transparent' ? 'transparent' : backgroundColor
33
+ "
34
+ :border-color="colorMode === 'transparent' ? 'white' : borderColor"
35
+ :color-mode="colorMode"
33
36
  :data-id="inputDataId"
34
37
  :disabled="disabled"
35
- :font-color="fontColor"
38
+ :font-color="colorMode === 'transparent' ? 'white' : fontColor"
36
39
  :font-size="fontSize"
37
40
  :has-label-slot="hasLabelSlot"
38
41
  :has-slot="hasSlot"
@@ -51,6 +54,8 @@
51
54
  @blur="onInputBlur($event)"
52
55
  @focus="focusInput()"
53
56
  @input="onInput($event)"
57
+ @keydown.down="decrementValue"
58
+ @keydown.up="incrementValue"
54
59
  @keyup.enter="onEnterPress"
55
60
  />
56
61
  <SlotContainer v-if="hasSlot" :is-error="isError" :slot-size="slotSize">
@@ -92,6 +97,31 @@
92
97
  </template>
93
98
  </RCSelect>
94
99
  </SelectWrapper>
100
+
101
+ <ArrowControls
102
+ v-if="!disabled && showArrowControls"
103
+ :color-mode="colorMode"
104
+ >
105
+ <ArrowButton @click="incrementValue">
106
+ <Icon
107
+ :color="colorMode === 'transparent' ? 'white' : undefined"
108
+ name="arrow_up"
109
+ size="8px"
110
+ />
111
+ </ArrowButton>
112
+ <ArrowDivider :color-mode="colorMode" />
113
+ <ArrowButton
114
+ :is-disabled="textInput <= minNumber"
115
+ @click="decrementValue"
116
+ >
117
+ <Icon
118
+ :color="colorMode === 'transparent' ? 'white' : undefined"
119
+ :disabled="textInput <= minNumber"
120
+ name="arrow_down"
121
+ size="8px"
122
+ />
123
+ </ArrowButton>
124
+ </ArrowControls>
95
125
  </InputWrapper>
96
126
  <ErrorMessage v-if="isError">{{ errorMessage }}</ErrorMessage>
97
127
  </Container>
@@ -123,6 +153,7 @@
123
153
  // labelInfoAlign="left"
124
154
  // :minNumber="0"
125
155
  // fontColor="blue"
156
+ // colorMode="transparent" // Makes background transparent, border white, and font white
126
157
  // >
127
158
  //<template name=label><img>....</template>
128
159
  //</inputNumber>
@@ -158,6 +189,7 @@
158
189
  labelFontColor: String,
159
190
  borderColor: String,
160
191
  showLinearUnitName: Boolean,
192
+ colorMode: String,
161
193
  }
162
194
 
163
195
  const Container = styled('div', inputProps)`
@@ -181,15 +213,18 @@
181
213
  : '1px solid ' + props.theme.colors.grey4};
182
214
  height: ${(props) => props.inputHeight};
183
215
  max-height: ${(props) => props.inputHeight};
184
- padding: 0 10px;
185
- padding-right: ${({ slotSize, isError, showLinearUnitName }) =>
186
- slotSize
216
+ padding: ${({ colorMode }) =>
217
+ colorMode === 'transparent' ? '10px 15px' : '0 10px'};
218
+ padding-right: ${({ slotSize, isError, showLinearUnitName, colorMode }) =>
219
+ colorMode === 'transparent'
220
+ ? '0'
221
+ : slotSize
187
222
  ? isError && !showLinearUnitName
188
223
  ? 'calc(' + slotSize + ' + 24px)'
189
224
  : 'calc(' + slotSize + ' + 10px)'
190
225
  : isError && !showLinearUnitName
191
226
  ? '24px'
192
- : '5px'};
227
+ : '40px'};
193
228
  border-radius: ${(props) =>
194
229
  props.isInteractive && props.alignItems != 'vertical'
195
230
  ? '0 4px 4px 0'
@@ -213,7 +248,7 @@
213
248
  props.inputWidth && !props.hasLabelSlot ? props.inputWidth : '100%'};
214
249
  min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
215
250
  background-color: ${(props) =>
216
- props.isDisabled ? props.theme.colors.grey5 : '#fff'};
251
+ props.isDisabled ? props.theme.colors.grey5 : props.theme.colors.white};
217
252
  box-sizing: border-box;
218
253
 
219
254
  &::placeholder {
@@ -225,6 +260,55 @@
225
260
  }
226
261
  `
227
262
 
263
+ const ArrowControlsProps = {
264
+ colorMode: String,
265
+ }
266
+ const ArrowControls = styled('div', ArrowControlsProps)`
267
+ position: absolute;
268
+ right: 0;
269
+ top: 0;
270
+ bottom: 0;
271
+ display: grid;
272
+ grid-template-rows: 1fr auto 1fr;
273
+ align-items: center;
274
+ justify-items: center;
275
+ cursor: pointer;
276
+ width: 30px;
277
+ background-color: ${(props) =>
278
+ props.colorMode === 'transparent'
279
+ ? 'transparent'
280
+ : props.theme.colors.white};
281
+ border-left: 1px solid
282
+ ${(props) =>
283
+ props.colorMode === 'transparent'
284
+ ? props.theme.colors.white
285
+ : props.theme.colors.black};
286
+ `
287
+
288
+ const ArrowButtonProps = {
289
+ isDisabled: Boolean,
290
+ }
291
+ const ArrowButton = styled('button', ArrowButtonProps)`
292
+ background: ${(props) =>
293
+ props.isDisabled ? props.theme.colors.disabled : 'transparent'};
294
+ cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
295
+ display: flex;
296
+ align-items: center;
297
+ justify-content: center;
298
+ padding: 0;
299
+ width: 100%;
300
+ height: 100%;
301
+ `
302
+
303
+ const ArrowDivider = styled('div', ArrowControlsProps)`
304
+ width: 100%;
305
+ height: 1px;
306
+ background-color: ${(props) =>
307
+ props.colorMode === 'transparent'
308
+ ? props.theme.colors.white
309
+ : props.theme.colors.black};
310
+ `
311
+
228
312
  const InputWrapper = styled.span`
229
313
  position: relative;
230
314
  `
@@ -359,140 +443,179 @@
359
443
  SelectWrapper,
360
444
  SelectText,
361
445
  Divider,
446
+ ArrowControls,
447
+ ArrowButton,
448
+ ArrowDivider,
362
449
  },
363
450
  inheritAttrs: false,
364
451
  props: {
365
452
  placeholder: {
453
+ type: String,
366
454
  required: false,
367
455
  default: '',
368
456
  },
369
457
  isError: {
458
+ type: Boolean,
370
459
  required: false,
371
460
  default: false,
372
461
  },
373
462
  inputWidth: {
463
+ type: String,
374
464
  required: false,
375
465
  default: null,
376
466
  },
377
467
  minWidth: {
468
+ type: String,
378
469
  required: false,
379
470
  default: null,
380
471
  },
381
472
  inputHeight: {
473
+ type: String,
382
474
  required: false,
383
475
  default: '40px',
384
476
  },
385
477
  value: {
478
+ type: [String, Number],
386
479
  required: true,
387
480
  default: null,
388
481
  },
389
482
  clearInput: {
483
+ type: Boolean,
390
484
  required: false,
391
485
  default: false,
392
486
  },
393
487
  alignItems: {
488
+ type: String,
394
489
  required: false,
395
490
  default: 'vertical',
396
491
  },
397
492
  errorMessage: {
493
+ type: String,
398
494
  required: false,
399
495
  default: 'Please insert a correct number',
400
496
  },
401
497
  numberPrecision: {
498
+ type: Number,
402
499
  required: false,
403
500
  default: 0,
404
501
  },
405
502
  minDecimals: {
503
+ type: Number,
406
504
  required: false,
407
505
  default: 0,
408
506
  },
409
507
  unitName: {
508
+ type: String,
410
509
  required: false,
411
510
  default: '',
412
511
  },
413
512
  showLinearUnitName: {
513
+ type: Boolean,
414
514
  required: false,
415
515
  default: false,
416
516
  },
417
517
  disabled: {
518
+ type: Boolean,
418
519
  required: false,
419
520
  default: false,
420
521
  },
421
522
  noBorder: {
523
+ type: Boolean,
422
524
  required: false,
423
525
  default: false,
424
526
  },
425
527
  borderColor: {
528
+ type: String,
426
529
  required: false,
530
+ default: null,
427
531
  },
428
532
  textAlign: {
533
+ type: String,
429
534
  required: false,
430
535
  default: 'left',
431
536
  },
432
537
  fontSize: {
538
+ type: String,
433
539
  required: false,
434
540
  default: '13px',
435
541
  },
436
542
  isInteractive: {
543
+ type: Boolean,
437
544
  required: false,
438
545
  default: false,
439
546
  },
440
547
  interactionStep: {
548
+ type: Number,
441
549
  required: false,
442
550
  default: 1,
443
551
  },
444
552
  labelText: {
553
+ type: String,
445
554
  required: false,
446
555
  default: null,
447
556
  },
448
557
  labelInfoText: {
558
+ type: String,
449
559
  required: false,
450
560
  default: null,
451
561
  },
452
562
  labelInfoAlign: {
563
+ type: String,
453
564
  required: false,
454
565
  default: 'left',
455
566
  },
456
567
  defaultNumber: {
568
+ type: Number,
457
569
  required: false,
458
570
  default: null,
459
571
  },
460
572
  minNumber: {
573
+ type: Number,
461
574
  required: false,
462
575
  default: null,
463
576
  },
464
577
  fontColor: {
578
+ type: String,
465
579
  required: false,
466
580
  default: null,
467
581
  },
468
582
  backgroundColor: {
583
+ type: String,
469
584
  required: false,
470
585
  default: null,
471
586
  },
472
587
  numberToStringEnabled: {
588
+ type: Boolean,
473
589
  required: false,
474
590
  default: true,
475
591
  },
476
592
  allowNegative: {
593
+ type: Boolean,
477
594
  required: false,
478
595
  default: true,
479
596
  },
480
597
  slotSize: {
598
+ type: String,
481
599
  required: false,
600
+ default: null,
482
601
  },
483
602
  labelFontColor: {
603
+ type: String,
484
604
  required: false,
485
605
  default: 'eturnityGrey',
486
606
  },
487
607
  focus: {
608
+ type: Boolean,
488
609
  required: false,
489
610
  default: false,
490
611
  },
491
612
  labelDataId: {
613
+ type: String,
492
614
  required: false,
493
615
  default: '',
494
616
  },
495
617
  inputDataId: {
618
+ type: String,
496
619
  required: false,
497
620
  default: '',
498
621
  },
@@ -516,6 +639,14 @@
516
639
  type: Boolean,
517
640
  default: false,
518
641
  },
642
+ colorMode: {
643
+ type: String,
644
+ default: '',
645
+ },
646
+ showArrowControls: {
647
+ type: Boolean,
648
+ default: false,
649
+ },
519
650
  },
520
651
  data() {
521
652
  return {
@@ -585,6 +716,36 @@
585
716
  }
586
717
  },
587
718
  methods: {
719
+ incrementValue() {
720
+ const currentValue = Math.max(
721
+ parseFloat(this.textInput || 0),
722
+ this.minNumber || 0
723
+ )
724
+ const newValue = currentValue + this.interactionStep
725
+ this.textInput = numberToString({
726
+ value: newValue,
727
+ numberPrecision: this.numberPrecision,
728
+ minDecimals: this.minDecimals,
729
+ })
730
+ this.$emit('on-input', newValue)
731
+ this.$emit('input-change', newValue)
732
+ },
733
+ decrementValue() {
734
+ const currentValue = Math.max(
735
+ parseFloat(this.textInput || 0),
736
+ this.minNumber || 0
737
+ )
738
+ const newValue = currentValue - this.interactionStep
739
+ if (this.allowNegative || newValue >= 0) {
740
+ this.textInput = numberToString({
741
+ value: newValue,
742
+ numberPrecision: this.numberPrecision,
743
+ minDecimals: this.minDecimals,
744
+ })
745
+ this.$emit('on-input', newValue)
746
+ this.$emit('input-change', newValue)
747
+ }
748
+ },
588
749
  onEnterPress() {
589
750
  this.$emit('on-enter-click')
590
751
  this.$refs.inputField1.$el.blur()
@@ -680,6 +841,7 @@
680
841
  this.$emit('on-input', evaluatedVal)
681
842
  }
682
843
  }
844
+ this.textInput = evaluatedVal
683
845
  },
684
846
  onInputBlur(e) {
685
847
  this.isFocused = false
@@ -3,73 +3,68 @@ import InputText from './index.vue'
3
3
  export default {
4
4
  title: 'InputText',
5
5
  component: InputText,
6
- // argTypes: {},
6
+ tags: ['autodocs'],
7
7
  }
8
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" />',
9
+ // import InputText from "@eturnity/eturnity_reusable_components/src/components/inputs/inputText"
10
+ // To use:
11
+ // <input-text
12
+ // placeholder="Company name"
13
+ // :value="companyName"
14
+ // @input-change="onInputChange({ value: $event, type: 'companyName' })"
15
+ // :isError="checkErrors()"
16
+ // :errorMessage="This is my error message"
17
+ // infoTextAlign="right" // left by default
18
+ // infoTextMessage="My info message"
19
+ // label="Question 5"
20
+ // alignItems="horizontal" // horizontal, vertical
21
+ // inputWidth="250px"
22
+ // minWidth="100px"
23
+ // />
15
24
 
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
- // minWidth="100px"
30
- // />
31
- })
32
-
33
- export const Default = Template.bind({})
34
- Default.args = {
35
- placeholder: 'Company name',
36
- disabled: false,
37
- value: '',
38
- inputWidth: '200px',
39
- minWidth: '10ch',
40
- unitName: 'pc',
41
- isError: false,
42
- textAlign: 'left',
25
+ export const Default = {
26
+ args: {
27
+ placeholder: 'Company name',
28
+ disabled: false,
29
+ value: '',
30
+ inputWidth: '200px',
31
+ minWidth: '10ch',
32
+ isError: false,
33
+ label: 'label test',
34
+ labelOptional: true,
35
+ },
43
36
  }
44
37
 
45
- export const hasError = Template.bind({})
46
- hasError.args = {
47
- placeholder: 'Enter Value',
48
- errorMessage: 'This field is required',
49
- isError: true,
50
- disabled: false,
51
- inputWidth: '200px',
38
+ export const HasError = {
39
+ args: {
40
+ placeholder: 'Enter Value',
41
+ errorMessage: 'This field is required',
42
+ isError: true,
43
+ disabled: false,
44
+ inputWidth: '200px',
45
+ },
52
46
  }
53
47
 
54
- export const Disabled = Template.bind({})
55
- Disabled.args = {
56
- placeholder: 'Enter Value',
57
- disabled: true,
58
- value: '',
59
- inputWidth: '200px',
60
- isError: false,
48
+ export const Disabled = {
49
+ args: {
50
+ placeholder: 'Enter Value',
51
+ disabled: true,
52
+ value: '',
53
+ inputWidth: '200px',
54
+ isError: false,
55
+ },
61
56
  }
62
57
 
63
- export const WithLabel = Template.bind({})
64
- WithLabel.args = {
65
- placeholder: 'Company name',
66
- disabled: false,
67
- label: 'What is the best company in Switzerland?',
68
- value: 'Eturnity',
69
- inputWidth: '200px',
70
- unitName: 'pc',
71
- isError: false,
72
- errorMessage: 'Maximum 5 characters',
73
- textAlign: 'left',
74
- alignItems: 'vertical',
58
+ export const WithLabel = {
59
+ args: {
60
+ placeholder: 'Company name',
61
+ disabled: false,
62
+ label: 'What is the best company in Switzerland?',
63
+ value: 'Eturnity',
64
+ inputWidth: '200px',
65
+ unitName: 'pc',
66
+ isError: false,
67
+ errorMessage: 'Maximum 5 characters',
68
+ alignItems: 'vertical',
69
+ },
75
70
  }