@iamproperty/components 3.7.8--beta-2 → 3.7.8

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.
Files changed (50) hide show
  1. package/assets/css/components/dialog.css +1 -1
  2. package/assets/css/components/dialog.css.map +1 -1
  3. package/assets/css/components/fileupload.css +1 -0
  4. package/assets/css/components/fileupload.css.map +1 -0
  5. package/assets/css/components/forms.css +1 -1
  6. package/assets/css/components/forms.css.map +1 -1
  7. package/assets/css/core.min.css +1 -1
  8. package/assets/css/core.min.css.map +1 -1
  9. package/assets/css/style.min.css +1 -1
  10. package/assets/css/style.min.css.map +1 -1
  11. package/assets/js/components/accordion/accordion.component.min.js +1 -1
  12. package/assets/js/components/applied-filters/applied-filters.component.min.js +1 -1
  13. package/assets/js/components/card/card.component.min.js +1 -1
  14. package/assets/js/components/fileupload/fileupload.component.js +44 -0
  15. package/assets/js/components/filterlist/filterlist.component.min.js +1 -1
  16. package/assets/js/components/header/header.component.min.js +1 -1
  17. package/assets/js/components/notification/notification.component.min.js +1 -1
  18. package/assets/js/components/pagination/pagination.component.min.js +1 -1
  19. package/assets/js/components/table/table.component.min.js +1 -1
  20. package/assets/js/components/tabs/tabs.component.min.js +1 -1
  21. package/assets/js/dynamic.min.js +5 -5
  22. package/assets/js/dynamic.min.js.map +1 -1
  23. package/assets/js/modules/data-layer.js +32 -34
  24. package/assets/js/modules/dialogs.js +1 -1
  25. package/assets/js/modules/fileupload.js +70 -0
  26. package/assets/js/modules/inputs.js +10 -0
  27. package/assets/js/scripts.bundle.js +20 -20
  28. package/assets/js/scripts.bundle.js.map +1 -1
  29. package/assets/js/scripts.bundle.min.js +2 -2
  30. package/assets/js/scripts.bundle.min.js.map +1 -1
  31. package/assets/sass/_forms.scss +1 -1
  32. package/assets/sass/components/dialog.scss +3 -1
  33. package/assets/sass/components/fileupload.scss +156 -0
  34. package/assets/sass/components/forms.scss +98 -135
  35. package/assets/ts/components/fileupload/README.md +13 -0
  36. package/assets/ts/components/fileupload/fileupload.component.ts +55 -0
  37. package/assets/ts/modules/data-layer.md +72 -0
  38. package/assets/ts/modules/data-layer.ts +37 -41
  39. package/assets/ts/modules/dialogs.ts +1 -1
  40. package/assets/ts/modules/fileupload.ts +106 -0
  41. package/assets/ts/modules/inputs.ts +14 -0
  42. package/assets/ts/tests/data-layer.spec.js +69 -0
  43. package/dist/components.es.js +782 -746
  44. package/dist/components.umd.js +40 -25
  45. package/package.json +1 -1
  46. package/src/components/FileUpload/FileUpload.vue +29 -0
  47. package/src/components/FileUpload/README.md +13 -0
  48. package/src/index.js +1 -1
  49. package/src/components/FileUploads/FileUploads.vue +0 -48
  50. package/src/components/FileUploads/README.md +0 -24
@@ -2,7 +2,7 @@
2
2
 
3
3
  //@import "../bootstrap/scss/forms/_labels";
4
4
  //@import "../bootstrap/scss/forms/_form-control";
5
- @import "../bootstrap/scss/forms/_form-select";
5
+ //@import "../bootstrap/scss/forms/_form-select";
6
6
  @import "../bootstrap/scss/forms/_form-check";
7
7
  @import "../bootstrap/scss/forms/_form-range";
8
8
  @import "../bootstrap/scss/forms/_input-group";
@@ -156,6 +156,8 @@ dialog[open] {
156
156
  }
157
157
 
158
158
  .mh-lg {
159
+ padding-left: 1rem;
160
+ margin-left: -1rem;
159
161
  padding-right: calc(var(--dialog-padding) - 10px);
160
162
  margin-right: calc((var(--dialog-padding) * -1) + 10px);
161
163
  margin-bottom: calc(var(--dialog-padding) * -1);
@@ -439,7 +441,7 @@ dialog::backdrop {
439
441
 
440
442
  margin-bottom: 0.25rem;
441
443
 
442
- &:after {
444
+ &:not(.btn-compact):after {
443
445
  content: "";
444
446
 
445
447
  display: inline-block;
@@ -0,0 +1,156 @@
1
+ @use "../_func" as *;
2
+ // #region file upload field
3
+
4
+ .file-upload {
5
+ max-width: rem(400)!important;
6
+ padding-bottom: rem(16);
7
+
8
+ .drop-area > input {
9
+ display: none;
10
+ }
11
+
12
+ .file-upload__title {
13
+ margin-top: 0; // 1
14
+ margin-bottom: $headings-margin-bottom;
15
+ font-family: $headings-font-family;
16
+ font-style: $headings-font-style;
17
+ font-weight: $headings-font-weight;
18
+ line-height: $headings-line-height;
19
+ color: $headings-color;
20
+ clear: both;
21
+ display: block;
22
+ padding-bottom: 2rem;
23
+
24
+ font-size: rem(map-get($heading-sizes,"h4_fs"));
25
+ line-height: rem(map-get($heading-sizes,"h4_lh"));
26
+ padding-bottom: rem(map-get($heading-sizes,"h4_pb"));
27
+ max-width: var(--content-max-width);
28
+ }
29
+
30
+ .helper-text {
31
+ max-width: rem(270);
32
+ }
33
+ }
34
+
35
+ .files {
36
+
37
+ span {
38
+ display: block;
39
+ width: 100%;
40
+ padding: var(--input-padding-block, #{rem(12)}) var(--input-padding-inline, #{rem(16)});
41
+ font-size: var(--input-fs, #{rem(16)});
42
+ line-height: var(--input-lh, #{rem(20)});
43
+ border: 2px solid var(--colour-primary-theme);
44
+ appearance: none; // Fix appearance for date inputs in Safari
45
+ border-radius: rem(8);
46
+ margin-bottom: rem(16);
47
+ color: var(--colour-primary);
48
+ border-color: #D8D8D8;
49
+ background: #D8D8D8;
50
+ max-width: rem(400)!important;
51
+ position: relative;
52
+
53
+
54
+
55
+
56
+ @media screen and (prefers-color-scheme: dark) {
57
+
58
+ background: var(--colour-canvas-2);
59
+ border-color: var(--colour-canvas-2);
60
+ color: var(--colour-white);
61
+ }
62
+
63
+
64
+ @media (forced-colors: active) {
65
+
66
+ padding-right: 5rem;
67
+
68
+ button {
69
+ padding: 0;
70
+ width: 3.7rem!important;
71
+ text-indent: 0% !important;
72
+
73
+ &:after {
74
+ display: none!important;
75
+ }
76
+ }
77
+ }
78
+
79
+ button {
80
+ position: absolute;
81
+ top: calc(50% - #{rem(9)});
82
+ right: rem(14);
83
+ z-index: var(--index-floating);
84
+ text-indent: 300%;
85
+ overflow: hidden;
86
+ border: none;
87
+ height: rem(18);
88
+ width: rem(18);
89
+ background: transparent;
90
+
91
+ &:after {
92
+ content: "";
93
+ top: 0;
94
+ left: 0;
95
+ position: absolute;
96
+ display: block;
97
+ height: rem(18);
98
+ width: rem(18);
99
+ z-index: var(--index-focus);
100
+ background: currentColor;
101
+ mask-image: var(--icon-close);
102
+ mask-size: 100%;
103
+ mask-repeat: no-repeat;
104
+ mask-position: 50% 50%;
105
+ -webkit-mask-image: var(--icon-close);
106
+ -webkit-mask-size: 100%;
107
+ -webkit-mask-repeat: no-repeat;
108
+ -webkit-mask-position: 50% 50%;
109
+ }
110
+ }
111
+ }
112
+ }
113
+
114
+ :host(.fileupload--drag-drop) .file-upload {
115
+
116
+ max-width: rem(800)!important;
117
+
118
+ .helper-text {
119
+
120
+ max-width: rem(800)!important;
121
+ }
122
+
123
+ .drop-area > input {
124
+ display: block;
125
+ min-height: rem(200);
126
+ border: 2px dashed var(--colour-primary-theme);
127
+ color: transparent;
128
+ position: relative;
129
+ padding: rem(24) rem(32) rem(24) rem(32);
130
+ user-select: none;
131
+
132
+ &.focus {
133
+
134
+ border: 2px solid var(--colour-info);
135
+ }
136
+ }
137
+
138
+ .drop-area {
139
+ position: relative;
140
+ }
141
+
142
+ .drop-area::before {
143
+ content: "Drag and drop files here or click to upload";
144
+ position: absolute;
145
+ inset: rem(24) rem(32) rem(24) rem(32);
146
+ z-index: 1;
147
+ pointer-events: none;
148
+ }
149
+
150
+ ::file-selector-button {
151
+ position: absolute;
152
+ inset: 0;
153
+ opacity: 0;
154
+ }
155
+ }
156
+ // #endregion
@@ -9,14 +9,14 @@ label {
9
9
  color: var(--colour-heading);
10
10
  display: block;
11
11
 
12
- &:has(+ input:not(:disabled):not([readonly]):not(:required):not([type='radio'])):after {
12
+ &:has(+ input:not(:disabled):not([readonly]):not(:required):not([type='radio']):not([type='file'])):after {
13
13
  content: " (Optional)";
14
14
  }
15
15
  }
16
16
  // #endregion
17
17
 
18
18
  // #region input field
19
- :is(input,textarea,output) {
19
+ :is(input,textarea,output,select) {
20
20
  display: block;
21
21
  width: 100%;
22
22
  max-width: $content-max-width;
@@ -35,15 +35,6 @@ label {
35
35
  min-height: calc(var(--input-padding-block, #{rem(12)}) + var(--input-padding-block, #{rem(12)}) + var(--input-lh, #{rem(20)}) + 4px);
36
36
  max-height: calc(var(--input-padding-block, #{rem(12)}) + var(--input-padding-block, #{rem(12)}) + var(--input-lh, #{rem(20)}) + 4px);
37
37
 
38
- // TODO: review later
39
- &[type="file"] {
40
- overflow: hidden; // prevent pseudo element button overlap
41
-
42
- &:not(:disabled):not([readonly]) {
43
- cursor: pointer;
44
- }
45
- }
46
-
47
38
  // Customize the `:focus` state to imitate native WebKit styles.
48
39
  &:is(:focus,.focus):not(:disabled) {
49
40
  border-color: var(--colour-info);
@@ -66,26 +57,6 @@ label {
66
57
  cursor: not-allowed;
67
58
  }
68
59
 
69
- // File input buttons theming
70
- &::file-selector-button {
71
- padding: $input-padding-y $input-padding-x;
72
- margin: (-$input-padding-y) (-$input-padding-x);
73
- margin-inline-end: $input-padding-x;
74
- color: $form-file-button-color;
75
- @include gradient-bg($form-file-button-bg);
76
- pointer-events: none;
77
- border-color: inherit;
78
- border-style: solid;
79
- border-width: 0;
80
- border-inline-end-width: $input-border-width;
81
- border-radius: 0; // stylelint-disable-line property-disallowed-list
82
- @include transition($btn-transition);
83
- }
84
-
85
- &:hover:not(:disabled):not([readonly])::file-selector-button {
86
- background-color: $form-file-button-hover-bg;
87
- }
88
-
89
60
  }
90
61
 
91
62
  textarea {
@@ -374,9 +345,7 @@ $icon-tick: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' view
374
345
  // #endregion
375
346
 
376
347
  // #region radio field
377
-
378
-
379
- input[type="radio"] {
348
+ input:is([type="radio"],[type="checkbox"]) {
380
349
  position: absolute;
381
350
  top: 0;
382
351
  left: 0;
@@ -386,11 +355,22 @@ input[type="radio"] {
386
355
  margin: 0;
387
356
  }
388
357
 
389
- div:has(> input[type="radio"]) {
358
+ div:has(> input:is([type="radio"],[type="checkbox"])) {
390
359
  position: relative;
391
360
  }
392
361
 
393
- input[type="radio"] + label:not(:has(> iam-card)) {
362
+ div:has( > input[type="radio"]){
363
+
364
+ --border-radius: 50%;
365
+ --outline-width: #{rem(8)};
366
+ }
367
+ div:has( > input[type="checkbox"]) {
368
+
369
+ --border-radius: #{rem(6)};
370
+ --outline-width: #{rem(4)};
371
+ }
372
+
373
+ input:is([type="radio"],[type="checkbox"]) + label:not(:has(> iam-card)) {
394
374
 
395
375
  --tick-colour: transparent;
396
376
 
@@ -408,7 +388,7 @@ input[type="radio"] + label:not(:has(> iam-card)) {
408
388
  &:before {
409
389
  content: "";
410
390
  border: 2px solid var(--colour-primary);
411
- border-radius: 50%;
391
+ border-radius: var(--border-radius);
412
392
  height: rem(24);
413
393
  width: rem(24);
414
394
  display: inline-block;
@@ -416,11 +396,14 @@ input[type="radio"] + label:not(:has(> iam-card)) {
416
396
  top: rem(10 - 2);
417
397
  left: 0;
418
398
  }
419
-
399
+ }
400
+
401
+ input[type="radio"] + label:not(:has(> iam-card)) {
402
+
420
403
  &:after {
421
404
  content: ""!important;
422
405
  background: var(--colour-info);
423
- border-radius: 50%;
406
+ border-radius: var(--border-radius);
424
407
  height: rem(14);
425
408
  width: rem(14);
426
409
  display: none;
@@ -444,18 +427,15 @@ input[type="radio"] + label:not(:has(> iam-card)) {
444
427
  outline: none!important;
445
428
  left: 0.25rem;
446
429
  }
447
-
448
-
449
430
  &:after {
450
431
  display: none;
451
432
  }
452
433
  }
453
434
  }
454
435
 
455
-
456
436
  @media (forced-colors: active) {
457
437
 
458
- input[type="radio"]:not(:checked) + label.radio--tick:not(:has(> iam-card)) {
438
+ input:is([type="radio"],[type="checkbox"]):not(:checked) + label.radio--tick:not(:has(> iam-card)) {
459
439
 
460
440
  &:before {
461
441
 
@@ -464,14 +444,13 @@ input[type="radio"] + label:not(:has(> iam-card)) {
464
444
  }
465
445
  }
466
446
 
467
- div:has(> input[type="radio"]:nth-of-type(2)) {
468
- label {
447
+ div:has(> :is(input[type="radio"],input[type="checkbox"]):nth-of-type(2)) {
448
+ label:not(:has(> iam-card)):not(:last-of-type) {
469
449
  margin-bottom: 0rem;
470
450
  }
471
- margin-bottom: rem(24);
472
451
  }
473
452
 
474
- input[type="radio"]:checked + label {
453
+ input:is([type="radio"],[type="checkbox"]):checked + label {
475
454
 
476
455
  --tick-colour: var(--colour-info);
477
456
 
@@ -488,31 +467,59 @@ input[type="radio"]:checked + label {
488
467
  }
489
468
  }
490
469
 
491
- input[type="radio"]:checked:is(:focus,:hover,.focus) + label {
470
+ input[type="checkbox"]:not([disabled]):checked + label {
471
+
472
+ &:before {
473
+ background: var(--colour-info)!important;
474
+ }
475
+ }
476
+ input[type="checkbox"]:checked + label {
477
+
478
+ &:after {
479
+ content: "\f00c";
480
+ position: absolute;
481
+ font-size: 1em;
482
+ line-height: 1;
483
+ color: var(--colour-primary-theme);
484
+ font-family: "Font Awesome 6 Pro";
485
+ font-weight: bold;
486
+ height: rem(24);
487
+ width: rem(24);
488
+ line-height: rem(26);
489
+ background: none !important;
490
+ border: none!important;
491
+ outline: none!important;
492
+ top: rem(10 - 2);
493
+ left: 0;
494
+ text-align: center;
495
+ }
496
+ }
497
+
498
+ input:is([type="radio"],[type="checkbox"]):checked:is(:focus,:hover,.focus) + label {
492
499
 
493
500
  --tick-colour: var(--colour-info);
494
501
  }
495
- input[type="radio"]:is(:focus,:hover,.focus) + label {
502
+ input:is([type="radio"],[type="checkbox"]):is(:focus,:hover,.focus) + label {
496
503
 
497
504
  --tick-colour: var(--colour-muted);
498
505
 
499
506
  &:before {
500
507
  background: var(--colour-light);
501
- outline: rem(8) solid var(--colour-light);
508
+ outline: var(--outline-width) solid var(--colour-light);
502
509
  }
503
510
  }
504
- input[type="radio"]:is(:active,.active) + label {
511
+ input:is([type="radio"],[type="checkbox"]):is(:active,.active) + label {
505
512
 
506
513
  --tick-colour: var(--colour-light);
507
514
 
508
515
  &:before {
509
516
  background: #E0E0E0;
510
- outline: rem(8) solid #E0E0E0;
517
+ outline: var(--outline-width) solid #E0E0E0;
511
518
  }
512
519
  }
513
520
 
514
521
  // Disabled
515
- input[type="radio"]:disabled + label {
522
+ input:is([type="radio"],[type="checkbox"]):disabled + label {
516
523
 
517
524
  opacity: 0.4;
518
525
  cursor: not-allowed;
@@ -526,44 +533,26 @@ input[type="radio"]:disabled + label {
526
533
  outline: none!important;
527
534
  border-color: var(--colour-primary)!important;
528
535
  }
536
+ }
537
+
538
+ input[type="radio"][disabled]:checked + label {
529
539
 
530
540
  &:after {
531
541
  background-color: var(--colour-primary)!important;
532
542
  }
533
543
  }
534
- // #endregion
535
-
536
- // #region checkbox
537
- .form-check {
538
-
539
- overflow: hidden;
540
-
541
- input,
542
- label {
543
- cursor: pointer;
544
- }
545
544
 
546
- input:not([disabled]) + label:hover,
547
- input:not([disabled]):hover + label,
548
- input:not([disabled]):focus + label {
545
+ input[type="checkbox"][disabled]:checked + label {
549
546
 
550
- color: var(--colour-hover);
551
- border-color: var(--colour-hover);
547
+ &:before {
548
+ background: #E0E0E0!important;
549
+ border-color: #E0E0E0!important;
552
550
  }
553
551
  }
554
- .form-check + .form-check {
555
- margin-top: -0.5rem;
556
- }
557
-
558
- .form-check-label {
559
- float: left;
560
- }
552
+ // #endregion
561
553
 
562
- .form-check-label + .form-check-input {
554
+ // #region checkbox
563
555
 
564
- margin-left: 1rem;
565
- margin-right: 0.5rem;
566
- }
567
556
 
568
557
  // #endregion
569
558
 
@@ -610,71 +599,45 @@ select[multiple]::-webkit-scrollbar-thumb {
610
599
  }
611
600
  // #endregion
612
601
 
602
+ // #region Select
613
603
 
604
+ select {
605
+ $form-select-indicator-new: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m2 5 6 6 6-6'/></svg>") !default;
614
606
 
615
- // #region large upload field
616
-
617
- .form-control__wrapper.form-control--lrg-file {
618
- aspect-ratio: 4/2;
619
- border: 1px dashed var(--colour-selected);
620
- position: relative;
621
-
622
- .icon {
623
- position: absolute;
624
- top: 50%;
625
- left:50%;
626
- transform: translate(-50%,calc(-50% - 1rem));
627
- color: var(--colour-muted);
628
- font-size: 5rem;
629
- height: 1em;
630
- width: 1em;
631
- pointer-events: none;
632
- }
607
+ background: escape-svg($form-select-indicator-new) right var(--input-padding-block, 0.75rem) top var(--input-padding-block, 0.75rem)/var(--input-lh, 1.25rem) var(--input-lh, 1.25rem) no-repeat,
608
+ linear-gradient(to left, var(--colour-primary-theme), var(--colour-primary-theme) 100%) right top/calc(var(--input-padding-block, 0.75rem) + var(--input-padding-block, 0.75rem) + var(--input-lh, 1.25rem)) calc(var(--input-padding-block, 0.75rem) + var(--input-padding-block, 0.75rem) + var(--input-lh, 1.25rem)) no-repeat;
609
+
610
+ padding-right: calc(var(--input-padding-inline, #{rem(16)}) + var(--input-padding-inline, #{rem(16)}) + var(--input-lh, 1.25rem));
611
+
612
+ option {font-size: 1.2em;}
633
613
 
634
- > label {
635
-
636
- position: absolute;
637
- top: calc(50% + 2rem);
638
- left:50%;
639
- transform: translate(-50%,-50%);
640
- width: 100%;
641
- text-align: center;
614
+ &[multiple],
615
+ &[size]:not([size="1"]) {
616
+ background: none;
617
+ max-height: none!important;
642
618
  }
643
619
 
644
- > input {
645
- position: absolute;
646
- top: 0;
647
- left: 0;
648
- height: 100%;
649
- width: 100%;
650
- opacity: 0;
620
+ &:disabled {
621
+ color: $form-select-disabled-color;
622
+ background-color: $form-select-disabled-bg;
623
+ border-color: $form-select-disabled-border-color;
651
624
  }
652
625
 
653
- .file-uploaded & {
654
- border: 3px solid var(--colour-success);
655
- border-radius: 50%;
656
- aspect-ratio: 1;
657
- margin-inline: auto;
658
- max-width: 10rem;
659
-
660
- > label {
661
- content: "File uploaded";
662
- }
626
+ // Remove outline from select box in FF
627
+ &:-moz-focusring {
628
+ color: transparent;
629
+ text-shadow: 0 0 0 $form-select-color;
663
630
  }
664
631
  }
632
+ // #endregion
665
633
 
666
- .file-upload__add {
667
- display: none;
668
-
669
- .file-uploaded & {
670
- display: block;
671
- margin-inline: auto;
672
- color: var(--colour-muted);
673
- font-size: rem(14);
674
- text-align: center;
675
- margin-top: -1rem;
676
- margin-bottom: 1rem;
677
- cursor: pointer;
634
+ // #region file upload
635
+ iam-fileupload {
636
+
637
+ input {
638
+ display: none;
678
639
  }
640
+
679
641
  }
642
+
680
643
  // #endregion
@@ -0,0 +1,13 @@
1
+ ```
2
+ <iam-fileupload data-maxsize="500"><input type="file" name="files[]" multiple="multiple" accept=".pdf, .csv, .jpg, .png" /></iam-fileupload>
3
+ ```
4
+
5
+ **Properties**
6
+
7
+ | Option | Type | Default Value | Description |
8
+ | ------ | ---- | ------------- | ----------- |
9
+ | data-maxsize | Int | - | Blocks files from being added that is larger than the max size given in kb's |
10
+
11
+ **Class modifiers**
12
+
13
+ - Adding a class of **.fileupload--drag-drop** will add a droppable area for the user to drag files into and drop.
@@ -0,0 +1,55 @@
1
+ // @ts-nocheck
2
+ import fileupload from "../../modules/fileupload";
3
+
4
+ // Data layer Web component created
5
+ window.dataLayer = window.dataLayer || [];
6
+ window.dataLayer.push({
7
+ "event": "customElementRegistered",
8
+ "element": "fileupload"
9
+ });
10
+
11
+ class iamFileupload extends HTMLElement {
12
+
13
+ constructor(){
14
+ super();
15
+ this.attachShadow({ mode: 'open'});
16
+
17
+ const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets'
18
+ const coreCSS = document.body.hasAttribute('data-core-css') ? document.body.getAttribute('data-core-css') : `${assetLocation}/css/core.min.css`;
19
+ const loadCSS = `@import "${assetLocation}/css/components/fileupload.css";`;
20
+
21
+ const template = document.createElement('template');
22
+ template.innerHTML = `
23
+ <style>
24
+ @import "${coreCSS}";
25
+ ${loadCSS}
26
+ ${this.hasAttribute('css') ? `@import "${this.getAttribute('css')}";` : ``}
27
+ </style>
28
+ <div class="file-upload">
29
+ <span class="file-upload__title">Upload file</span>
30
+ <p class="helper-text"></p>
31
+ <button class="btn btn-primary"><slot name="btn"></slot> Upload document</button>
32
+ <div class="drop-area"></div>
33
+ <hr/>
34
+ <slot></slot>
35
+ <div class="files"></div>
36
+ </div>
37
+ `;
38
+ this.shadowRoot.appendChild(template.content.cloneNode(true));
39
+ }
40
+
41
+ connectedCallback() {
42
+
43
+ this.innerHTML += '<i class="fa-regular fa-arrow-up-from-bracket me-2" aria-hidden="true" slot="btn"></i>';
44
+
45
+ const wrapper = this.shadowRoot.querySelector('.file-upload');
46
+ const input = this.querySelector('input');
47
+ const helperText = this.shadowRoot.querySelector('.helper-text');
48
+
49
+ helperText.innerHTML = `${this.hasAttribute('data-maxsize') ? `Max file size is ${this.getAttribute('data-maxsize')}kb. ` : '' }${ input.hasAttribute('accept') ? `Supported file types are ${input.getAttribute('accept')}` : '' }`;
50
+
51
+ fileupload(this,wrapper);
52
+ }
53
+ }
54
+
55
+ export default iamFileupload;