xv-webcomponents 0.1.44 → 0.1.46

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 (98) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/xv-accordion-v2_34.cjs.entry.js +121 -89
  3. package/dist/cjs/xv-accordion-v2_34.cjs.entry.js.map +1 -1
  4. package/dist/cjs/xv-breadcrumbs-v2.cjs.entry.js +1 -1
  5. package/dist/cjs/xv-breadcrumbs-v2.cjs.entry.js.map +1 -1
  6. package/dist/cjs/xv-breadcrumbs-v2.entry.cjs.js.map +1 -1
  7. package/dist/cjs/xv-webcomponents.cjs.js +1 -1
  8. package/dist/collection/components/xv-accordion/xv-accordion.css +95 -0
  9. package/dist/collection/components/xv-accordion-item/xv-accordion-item.css +95 -0
  10. package/dist/collection/components/xv-breadcrumbs/xv-breadcrumbs.css +95 -0
  11. package/dist/collection/components/xv-button/xv-button-v2.css +95 -0
  12. package/dist/collection/components/xv-card/xv-card.css +95 -0
  13. package/dist/collection/components/xv-checkbox/xv-checkbox.css +95 -0
  14. package/dist/collection/components/xv-data-table/xv-data-table-cell/xv-data-table-cell.css +95 -0
  15. package/dist/collection/components/xv-data-table/xv-data-table-cell/xv-data-table-cell.js +29 -5
  16. package/dist/collection/components/xv-data-table/xv-data-table-cell/xv-data-table-cell.js.map +1 -1
  17. package/dist/collection/components/xv-data-table/xv-data-table-collapse/xv-data-table-collapse.css +95 -0
  18. package/dist/collection/components/xv-data-table/xv-data-table-collapse/xv-data-table-collapse.js +1 -1
  19. package/dist/collection/components/xv-data-table/xv-data-table-row/xv-data-table-row.css +104 -7
  20. package/dist/collection/components/xv-data-table/xv-data-table-row/xv-data-table-row.js +9 -3
  21. package/dist/collection/components/xv-data-table/xv-data-table-row/xv-data-table-row.js.map +1 -1
  22. package/dist/collection/components/xv-data-table/xv-data-table.css +112 -2
  23. package/dist/collection/components/xv-data-table/xv-data-table.js +20 -1
  24. package/dist/collection/components/xv-data-table/xv-data-table.js.map +1 -1
  25. package/dist/collection/components/xv-dropdown/xv-dropdown-item/xv-dropdown-item.css +95 -0
  26. package/dist/collection/components/xv-dropdown/xv-dropdown-item/xv-dropdown-item.js +1 -1
  27. package/dist/collection/components/xv-dropdown/xv-dropdown.css +95 -0
  28. package/dist/collection/components/xv-dropdown/xv-dropdown.js +1 -1
  29. package/dist/collection/components/xv-file-uploader/xv-file-uploader.css +98 -1
  30. package/dist/collection/components/xv-file-uploader/xv-file-uploader.js +76 -10
  31. package/dist/collection/components/xv-file-uploader/xv-file-uploader.js.map +1 -1
  32. package/dist/collection/components/xv-footer/xv-footer.css +95 -0
  33. package/dist/collection/components/xv-footer/xv-footer.js +1 -1
  34. package/dist/collection/components/xv-header/xv-header.css +95 -0
  35. package/dist/collection/components/xv-header/xv-header.js +1 -1
  36. package/dist/collection/components/xv-link/xv-link.css +95 -0
  37. package/dist/collection/components/xv-link/xv-link.js +1 -1
  38. package/dist/collection/components/xv-loader/xv-loader.css +95 -0
  39. package/dist/collection/components/xv-login-modal/xv-login-modal.css +95 -0
  40. package/dist/collection/components/xv-modal/xv-modal.css +108 -0
  41. package/dist/collection/components/xv-modal/xv-modal.js +20 -1
  42. package/dist/collection/components/xv-modal/xv-modal.js.map +1 -1
  43. package/dist/collection/components/xv-notification/xv-notification.css +95 -0
  44. package/dist/collection/components/xv-notification/xv-notification.js +1 -1
  45. package/dist/collection/components/xv-number-input/xv-number-input.css +95 -0
  46. package/dist/collection/components/xv-number-input/xv-number-input.js +2 -2
  47. package/dist/collection/components/xv-overflow-menu/xv-overflow-menu-item/xv-overflow-menu-item.css +95 -0
  48. package/dist/collection/components/xv-overflow-menu/xv-overflow-menu-item/xv-overflow-menu-item.js +1 -1
  49. package/dist/collection/components/xv-overflow-menu/xv-overflow-menu.css +95 -0
  50. package/dist/collection/components/xv-overflow-menu/xv-overflow-menu.js +1 -1
  51. package/dist/collection/components/xv-progress-indicator/xv-progress-indicator-item/xv-progress-indicator-item.css +96 -1
  52. package/dist/collection/components/xv-progress-indicator/xv-progress-indicator-item/xv-progress-indicator-item.js +1 -1
  53. package/dist/collection/components/xv-progress-indicator/xv-progress-indicator.css +95 -0
  54. package/dist/collection/components/xv-progress-indicator/xv-progress-indicator.js +1 -1
  55. package/dist/collection/components/xv-table/xv-table-cell/xv-table-cell.css +95 -0
  56. package/dist/collection/components/xv-table/xv-table-cell/xv-table-cell.js +1 -1
  57. package/dist/collection/components/xv-table/xv-table-expand/xv-table-expand.css +95 -0
  58. package/dist/collection/components/xv-table/xv-table-expand/xv-table-expand.js +1 -1
  59. package/dist/collection/components/xv-table/xv-table-row/xv-table-row.css +95 -0
  60. package/dist/collection/components/xv-table/xv-table-row/xv-table-row.js +1 -1
  61. package/dist/collection/components/xv-table/xv-table.css +95 -0
  62. package/dist/collection/components/xv-table/xv-table.js +1 -1
  63. package/dist/collection/components/xv-tabs/xv-tab/xv-tab.css +95 -0
  64. package/dist/collection/components/xv-tabs/xv-tab/xv-tab.js +1 -1
  65. package/dist/collection/components/xv-tabs/xv-tabs.css +100 -11
  66. package/dist/collection/components/xv-tag/xv-tag.css +95 -0
  67. package/dist/collection/components/xv-tag/xv-tag.js +1 -1
  68. package/dist/collection/components/xv-text-input/xv-text-input.css +98 -0
  69. package/dist/collection/components/xv-text-input/xv-text-input.js +21 -2
  70. package/dist/collection/components/xv-text-input/xv-text-input.js.map +1 -1
  71. package/dist/collection/components/xv-toggle-tip/xv-toggle-tip.css +95 -0
  72. package/dist/collection/components/xv-toggle-tip/xv-toggle-tip.js +1 -1
  73. package/dist/collection/components/xv-tooltip/xv-tooltip.css +92 -28
  74. package/dist/collection/components/xv-tooltip/xv-tooltip.js +66 -18
  75. package/dist/collection/components/xv-tooltip/xv-tooltip.js.map +1 -1
  76. package/dist/esm/loader.js +1 -1
  77. package/dist/esm/xv-accordion-v2_34.entry.js +121 -89
  78. package/dist/esm/xv-accordion-v2_34.entry.js.map +1 -1
  79. package/dist/esm/xv-breadcrumbs-v2.entry.js +1 -1
  80. package/dist/esm/xv-breadcrumbs-v2.entry.js.map +1 -1
  81. package/dist/esm/xv-webcomponents.js +1 -1
  82. package/dist/types/components/xv-data-table/xv-data-table-cell/xv-data-table-cell.d.ts +2 -0
  83. package/dist/types/components/xv-data-table/xv-data-table.d.ts +1 -0
  84. package/dist/types/components/xv-file-uploader/xv-file-uploader.d.ts +3 -0
  85. package/dist/types/components/xv-modal/xv-modal.d.ts +4 -0
  86. package/dist/types/components/xv-text-input/xv-text-input.d.ts +1 -0
  87. package/dist/types/components/xv-tooltip/xv-tooltip.d.ts +5 -3
  88. package/dist/types/components.d.ts +29 -0
  89. package/dist/xv-webcomponents/p-851c4716.entry.js +2 -0
  90. package/dist/xv-webcomponents/{p-5b63a259.entry.js.map → p-851c4716.entry.js.map} +1 -1
  91. package/dist/xv-webcomponents/p-d96c1b6a.entry.js +2 -0
  92. package/dist/xv-webcomponents/p-d96c1b6a.entry.js.map +1 -0
  93. package/dist/xv-webcomponents/xv-breadcrumbs-v2.entry.esm.js.map +1 -1
  94. package/dist/xv-webcomponents/xv-webcomponents.esm.js +1 -1
  95. package/package.json +1 -1
  96. package/dist/xv-webcomponents/p-5b63a259.entry.js +0 -2
  97. package/dist/xv-webcomponents/p-9c06f44c.entry.js +0 -2
  98. package/dist/xv-webcomponents/p-9c06f44c.entry.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"xv-data-table.js","sourceRoot":"","sources":["../../../src/components/xv-data-table/xv-data-table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAO5C,MAAM,OAAO,WAAW;IALxB;QAOU,SAAI,GAAa,QAAQ,CAAC,EAAE,CAAC;QAE7B,iBAAY,GAAsB,EAAE,CAAC;QACrC,UAAK,GAAY,KAAK,CAAC;KA4BhC;IA1BC,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,qDAAC,KAAK,EAAC,eAAe;YACzB;gBACE,6DAAM,IAAI,EAAC,OAAO,GAAG,CACb;YACV,4DAAK,KAAK,EAAC,KAAK;gBACd,4DAAK,KAAK,EAAC,WAAW;oBACpB,6DAAM,IAAI,EAAC,OAAO,GAAG,CACjB;gBACN,4DAAK,KAAK,EAAC,aAAa;oBACtB,6DAAM,IAAI,EAAC,SAAS,GAAG,CACnB,CACF;YACN,8DAAO,IAAI,EAAC,OAAO;gBAChB,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,CAC/B,mEACG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,MAAM,EAAE,EAAE,CAAC,WAAK,KAAK,EAAE,EAAE,KAAK,EAAE,GAAI,CAAC,CAC5D,CACZ;gBAED,8DAAQ,CACF,CACH,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Host, Prop, Element } from '@stencil/core';\nimport { SIZE_VAR } from '../../types/enum';\n\n@Component({\n tag: 'xv-data-table',\n styleUrl: 'xv-data-table.scss',\n shadow: true,\n})\nexport class XvDataTable {\n @Element() el: HTMLElement;\n @Prop() size: SIZE_VAR = SIZE_VAR.MD;\n @Prop() block?: boolean;\n @Prop() columnWidths: (string | null)[] = [];\n @Prop() hover: boolean = false;\n\n render() {\n return (\n <Host class=\"xv-data-table\">\n <caption>\n <slot name=\"title\" />\n </caption>\n <div class=\"bar\">\n <div class=\"bar_batch\">\n <slot name=\"batch\" />\n </div>\n <div class=\"bar_toolbar\">\n <slot name=\"toolbar\" />\n </div>\n </div>\n <table role=\"table\">\n {this.columnWidths.length > 0 && (\n <colgroup>\n {this.columnWidths.map((width = 'auto') => <col style={{ width }} />)}\n </colgroup>\n )}\n\n <slot />\n </table>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"xv-data-table.js","sourceRoot":"","sources":["../../../src/components/xv-data-table/xv-data-table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAO5C,MAAM,OAAO,WAAW;IALxB;QAOU,SAAI,GAAa,QAAQ,CAAC,EAAE,CAAC;QAG7B,iBAAY,GAAsB,EAAE,CAAC;QACrC,UAAK,GAAY,KAAK,CAAC;KAmChC;IAjCC,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,qDAAC,KAAK,EAAC,eAAe;YACzB;gBACE,6DAAM,IAAI,EAAC,OAAO,GAAG,CACb;YACV,4DAAK,KAAK,EAAC,KAAK;gBACd,4DAAK,KAAK,EAAC,WAAW;oBACpB,6DAAM,IAAI,EAAC,OAAO,GAAG,CACjB;gBACN,4DAAK,KAAK,EAAC,aAAa;oBACtB,6DAAM,IAAI,EAAC,SAAS,GAAG,CACnB,CACF;YACN,8DAAO,IAAI,EAAC,OAAO;gBAChB,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,CAC/B,mEACG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,MAAM,EAAE,EAAE,CAAC,WAAK,KAAK,EAAE,EAAE,KAAK,EAAE,GAAI,CAAC,CAC5D,CACZ;gBACD;oBAAO,6DAAM,IAAI,EAAC,QAAQ,GAAG,CAAQ;gBACrC;oBAAO,8DAAQ,CAAQ;gBACvB;oBAAO,6DAAM,IAAI,EAAC,QAAQ,GAAG,CAAQ,CAC/B;YAEP,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,CACjB,4DAAK,KAAK,EAAC,SAAS;gBAClB,qEAAc,IAAI,EAAE,QAAQ,CAAC,EAAE,GAAI,CAC/B,CACP,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Host, Prop, Element } from '@stencil/core';\nimport { SIZE_VAR } from '../../types/enum';\n\n@Component({\n tag: 'xv-data-table',\n styleUrl: 'xv-data-table.scss',\n shadow: true,\n})\nexport class XvDataTable {\n @Element() el: HTMLElement;\n @Prop() size: SIZE_VAR = SIZE_VAR.MD;\n @Prop() block?: boolean;\n @Prop() loading?: boolean;\n @Prop() columnWidths: (string | null)[] = [];\n @Prop() hover: boolean = false;\n\n render() {\n return (\n <Host class=\"xv-data-table\">\n <caption>\n <slot name=\"title\" />\n </caption>\n <div class=\"bar\">\n <div class=\"bar_batch\">\n <slot name=\"batch\" />\n </div>\n <div class=\"bar_toolbar\">\n <slot name=\"toolbar\" />\n </div>\n </div>\n <table role=\"table\">\n {this.columnWidths.length > 0 && (\n <colgroup>\n {this.columnWidths.map((width = 'auto') => <col style={{ width }} />)}\n </colgroup>\n )}\n <thead><slot name=\"header\" /></thead>\n <tbody><slot /></tbody>\n <tfoot><slot name=\"footer\" /></tfoot>\n </table>\n\n {!!this.loading && (\n <div class=\"loading\">\n <xv-loader-v2 size={SIZE_VAR.LG} />\n </div>\n )}\n </Host>\n );\n }\n}\n"]}
@@ -1,3 +1,98 @@
1
+ .xv-tooltip[role=tooltip] {
2
+ position: absolute;
3
+ background-color: var(--background-inverse, #333333);
4
+ color: var(--text-on-color);
5
+ padding: var(--spacing-03) var(--spacing-04);
6
+ border-radius: 3px;
7
+ font-size: var(--fz-sm);
8
+ z-index: 999;
9
+ min-width: min(150px, 90vw);
10
+ max-width: min(400px, 90vw);
11
+ }
12
+ .xv-tooltip[role=tooltip]::after {
13
+ content: "";
14
+ position: absolute;
15
+ width: 0;
16
+ height: 0;
17
+ border-style: solid;
18
+ }
19
+ .xv-tooltip[role=tooltip][data-popper-placement=top]::after {
20
+ bottom: -5px;
21
+ left: 50%;
22
+ transform: translateX(-50%);
23
+ border-width: 5px 5px 0 5px;
24
+ border-color: var(--background-inverse, black) transparent transparent transparent;
25
+ }
26
+ .xv-tooltip[role=tooltip][data-popper-placement=top-start]::after {
27
+ bottom: -5px;
28
+ left: 12px;
29
+ border-width: 5px 5px 0 5px;
30
+ border-color: var(--background-inverse, black) transparent transparent transparent;
31
+ }
32
+ .xv-tooltip[role=tooltip][data-popper-placement=top-end]::after {
33
+ bottom: -5px;
34
+ right: 12px;
35
+ border-width: 5px 5px 0 5px;
36
+ border-color: var(--background-inverse, black) transparent transparent transparent;
37
+ }
38
+ .xv-tooltip[role=tooltip][data-popper-placement=bottom]::after {
39
+ top: -5px;
40
+ left: 50%;
41
+ transform: translateX(-50%);
42
+ border-width: 0 5px 5px 5px;
43
+ border-color: transparent transparent var(--background-inverse, black) transparent;
44
+ }
45
+ .xv-tooltip[role=tooltip][data-popper-placement=bottom-start]::after {
46
+ top: -5px;
47
+ left: 12px;
48
+ border-width: 0 5px 5px 5px;
49
+ border-color: transparent transparent var(--background-inverse, black) transparent;
50
+ }
51
+ .xv-tooltip[role=tooltip][data-popper-placement=bottom-end]::after {
52
+ top: -5px;
53
+ right: 12px;
54
+ border-width: 0 5px 5px 5px;
55
+ border-color: transparent transparent var(--background-inverse, black) transparent;
56
+ }
57
+ .xv-tooltip[role=tooltip][data-popper-placement=left]::after {
58
+ top: 50%;
59
+ right: -5px;
60
+ transform: translateY(-50%);
61
+ border-width: 5px 0 5px 5px;
62
+ border-color: transparent transparent transparent var(--background-inverse, black);
63
+ }
64
+ .xv-tooltip[role=tooltip][data-popper-placement=left-start]::after {
65
+ top: 12px;
66
+ right: -5px;
67
+ border-width: 5px 0 5px 5px;
68
+ border-color: transparent transparent transparent var(--background-inverse, black);
69
+ }
70
+ .xv-tooltip[role=tooltip][data-popper-placement=left-end]::after {
71
+ bottom: 12px;
72
+ right: -5px;
73
+ border-width: 5px 0 5px 5px;
74
+ border-color: transparent transparent transparent var(--background-inverse, black);
75
+ }
76
+ .xv-tooltip[role=tooltip][data-popper-placement=right]::after {
77
+ top: 50%;
78
+ left: -5px;
79
+ transform: translateY(-50%);
80
+ border-width: 5px 5px 5px 0;
81
+ border-color: transparent var(--background-inverse, black) transparent transparent;
82
+ }
83
+ .xv-tooltip[role=tooltip][data-popper-placement=right-start]::after {
84
+ top: 12px;
85
+ left: -5px;
86
+ border-width: 5px 5px 5px 0;
87
+ border-color: transparent var(--background-inverse, black) transparent transparent;
88
+ }
89
+ .xv-tooltip[role=tooltip][data-popper-placement=right-end]::after {
90
+ bottom: 12px;
91
+ left: -5px;
92
+ border-width: 5px 5px 5px 0;
93
+ border-color: transparent var(--background-inverse, black) transparent transparent;
94
+ }
95
+
1
96
  :host {
2
97
  display: block;
3
98
  }
@@ -21,7 +21,7 @@ export class XvDropdownItem {
21
21
  });
22
22
  }
23
23
  render() {
24
- return (h(Host, { key: '85ba648d8281168521c1ed8c4b0b861fb428ce8e', class: "xv-dropdown-item", value: this.value, role: "option", tabindex: this.disabled ? -1 : false }, h("slot", { key: '6c303d085e23e1ecfa433aefa22f02be1cd5711f' }), this.selected && h("span", { key: 'c555912f9727a0e42b09279b31fe3b3b740bf7eb', class: "checkmark" })));
24
+ return (h(Host, { key: 'a0748e38180cfbd7697e5a4b2069168f77e6917e', class: "xv-dropdown-item", value: this.value, role: "option", tabindex: this.disabled ? -1 : false }, h("slot", { key: '3add18db3c3a0e3eabbc31f4e405620e4086b37a' }), this.selected && h("span", { key: '64d4731e8b3a9896ca92787421d66ac3a495c605', class: "checkmark" })));
25
25
  }
26
26
  componentWillLoad() {
27
27
  if (!this.value)
@@ -1,3 +1,98 @@
1
+ .xv-tooltip[role=tooltip] {
2
+ position: absolute;
3
+ background-color: var(--background-inverse, #333333);
4
+ color: var(--text-on-color);
5
+ padding: var(--spacing-03) var(--spacing-04);
6
+ border-radius: 3px;
7
+ font-size: var(--fz-sm);
8
+ z-index: 999;
9
+ min-width: min(150px, 90vw);
10
+ max-width: min(400px, 90vw);
11
+ }
12
+ .xv-tooltip[role=tooltip]::after {
13
+ content: "";
14
+ position: absolute;
15
+ width: 0;
16
+ height: 0;
17
+ border-style: solid;
18
+ }
19
+ .xv-tooltip[role=tooltip][data-popper-placement=top]::after {
20
+ bottom: -5px;
21
+ left: 50%;
22
+ transform: translateX(-50%);
23
+ border-width: 5px 5px 0 5px;
24
+ border-color: var(--background-inverse, black) transparent transparent transparent;
25
+ }
26
+ .xv-tooltip[role=tooltip][data-popper-placement=top-start]::after {
27
+ bottom: -5px;
28
+ left: 12px;
29
+ border-width: 5px 5px 0 5px;
30
+ border-color: var(--background-inverse, black) transparent transparent transparent;
31
+ }
32
+ .xv-tooltip[role=tooltip][data-popper-placement=top-end]::after {
33
+ bottom: -5px;
34
+ right: 12px;
35
+ border-width: 5px 5px 0 5px;
36
+ border-color: var(--background-inverse, black) transparent transparent transparent;
37
+ }
38
+ .xv-tooltip[role=tooltip][data-popper-placement=bottom]::after {
39
+ top: -5px;
40
+ left: 50%;
41
+ transform: translateX(-50%);
42
+ border-width: 0 5px 5px 5px;
43
+ border-color: transparent transparent var(--background-inverse, black) transparent;
44
+ }
45
+ .xv-tooltip[role=tooltip][data-popper-placement=bottom-start]::after {
46
+ top: -5px;
47
+ left: 12px;
48
+ border-width: 0 5px 5px 5px;
49
+ border-color: transparent transparent var(--background-inverse, black) transparent;
50
+ }
51
+ .xv-tooltip[role=tooltip][data-popper-placement=bottom-end]::after {
52
+ top: -5px;
53
+ right: 12px;
54
+ border-width: 0 5px 5px 5px;
55
+ border-color: transparent transparent var(--background-inverse, black) transparent;
56
+ }
57
+ .xv-tooltip[role=tooltip][data-popper-placement=left]::after {
58
+ top: 50%;
59
+ right: -5px;
60
+ transform: translateY(-50%);
61
+ border-width: 5px 0 5px 5px;
62
+ border-color: transparent transparent transparent var(--background-inverse, black);
63
+ }
64
+ .xv-tooltip[role=tooltip][data-popper-placement=left-start]::after {
65
+ top: 12px;
66
+ right: -5px;
67
+ border-width: 5px 0 5px 5px;
68
+ border-color: transparent transparent transparent var(--background-inverse, black);
69
+ }
70
+ .xv-tooltip[role=tooltip][data-popper-placement=left-end]::after {
71
+ bottom: 12px;
72
+ right: -5px;
73
+ border-width: 5px 0 5px 5px;
74
+ border-color: transparent transparent transparent var(--background-inverse, black);
75
+ }
76
+ .xv-tooltip[role=tooltip][data-popper-placement=right]::after {
77
+ top: 50%;
78
+ left: -5px;
79
+ transform: translateY(-50%);
80
+ border-width: 5px 5px 5px 0;
81
+ border-color: transparent var(--background-inverse, black) transparent transparent;
82
+ }
83
+ .xv-tooltip[role=tooltip][data-popper-placement=right-start]::after {
84
+ top: 12px;
85
+ left: -5px;
86
+ border-width: 5px 5px 5px 0;
87
+ border-color: transparent var(--background-inverse, black) transparent transparent;
88
+ }
89
+ .xv-tooltip[role=tooltip][data-popper-placement=right-end]::after {
90
+ bottom: 12px;
91
+ left: -5px;
92
+ border-width: 5px 5px 5px 0;
93
+ border-color: transparent var(--background-inverse, black) transparent transparent;
94
+ }
95
+
1
96
  :host {
2
97
  --dropdown-padding-x: 16px;
3
98
  --dropdown-padding-y: 11px;
@@ -94,7 +94,7 @@ export class XvDropdown {
94
94
  this.changeSelection.emit(this.setSelected(this.selectedMap, optionElements));
95
95
  }
96
96
  render() {
97
- return (h(Host, { key: '556a488d40dfcf1510f183fefbbf9d9bd1d0be80', class: "xv-dropdown", role: "combobox", size: this.size, open: this.open, error: this.error, disabled: this.disabled, tabindex: this.disabled ? -1 : false }, h("label", { key: '54550cb9b8a26cc4df4a55abc677bd3f5bb9730d', class: "label" }, h("slot", { key: '46270d1b0e6b5ee26a07aeaf318617c73e82cfdb', name: "label" }, this.label), this.info && h("xv-tooltip-v2", { key: 'f3b7c09e3346dbaeb0fd720e20e4bbcd58bde7eb', class: "label_info", message: this.info })), h("div", { key: '4b4a2794ba78378cd89b3b2ad67bc66edbf4c52f', class: "xv-dropdown-control control", onClick: this.handleOpen }, this.selected.length ? (h("p", { class: "control_value" }, this.selected.join(', '))) : (h("p", { class: "control_placeholder" }, this.placeholder || '')), this.renderIcon(), h("svg", { key: '7c79ee0d976229090c0c0a25d01d7beb9a0c3afc', class: "control_arrow", focusable: "false", preserveAspectRatio: "xMidYMid meet", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", "aria-hidden": "true", width: "16", height: "16", viewBox: "0 0 16 16" }, h("path", { key: 'a895b585e7750cf4a01f7bd0dff390e70f2c482c', d: "M8 11L3 6 3.7 5.3 8 9.6 12.3 5.3 13 6z" }))), this.open && h("div", { key: '846792bfd1683daeb3223fb68c3559543b540787', class: "options" }, h("slot", { key: "xv-dropdown-options" })), (this.helper || this.error || this.warning) && (h("p", { key: '741d4636d86a44091e4a4b275806f745ded156f7', class: "helper" }, this.error || this.warning || this.helper))));
97
+ return (h(Host, { key: '2c5ea06ed7caeb3eb112f0421439d83666c71c0f', class: "xv-dropdown", role: "combobox", size: this.size, open: this.open, error: this.error, disabled: this.disabled, tabindex: this.disabled ? -1 : false }, h("label", { key: '1c57d5005bbf6e4419f5b4b55ea76a97d0bd6223', class: "label" }, h("slot", { key: '2ce3f332265b9e4dfa1b884d3bb869640d78b25f', name: "label" }, this.label), this.info && h("xv-tooltip-v2", { key: 'a46c73b62c3a2074a64ceeb0334ac0c55eef60fd', class: "label_info", message: this.info })), h("div", { key: '6711f988978aa4c1773f905c974aeadd3d23eba2', class: "xv-dropdown-control control", onClick: this.handleOpen }, this.selected.length ? (h("p", { class: "control_value" }, this.selected.join(', '))) : (h("p", { class: "control_placeholder" }, this.placeholder || '')), this.renderIcon(), h("svg", { key: 'dbd8ac8a724266322bf6a69c3b51aa0e653fce82', class: "control_arrow", focusable: "false", preserveAspectRatio: "xMidYMid meet", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", "aria-hidden": "true", width: "16", height: "16", viewBox: "0 0 16 16" }, h("path", { key: '9d41c7560755d88a502e3ea0024d021fcb467e6e', d: "M8 11L3 6 3.7 5.3 8 9.6 12.3 5.3 13 6z" }))), this.open && h("div", { key: '2fbd336e60ad52321b571b2e369dfd0b0a14925f', class: "options" }, h("slot", { key: "xv-dropdown-options" })), (this.helper || this.error || this.warning) && (h("p", { key: '89dac505b3b1617eed4fe4ddfd2a088efb88ebbc', class: "helper" }, this.error || this.warning || this.helper))));
98
98
  }
99
99
  componentWillLoad() {
100
100
  this.setDefaultValues();
@@ -1,3 +1,98 @@
1
+ .xv-tooltip[role=tooltip] {
2
+ position: absolute;
3
+ background-color: var(--background-inverse, #333333);
4
+ color: var(--text-on-color);
5
+ padding: var(--spacing-03) var(--spacing-04);
6
+ border-radius: 3px;
7
+ font-size: var(--fz-sm);
8
+ z-index: 999;
9
+ min-width: min(150px, 90vw);
10
+ max-width: min(400px, 90vw);
11
+ }
12
+ .xv-tooltip[role=tooltip]::after {
13
+ content: "";
14
+ position: absolute;
15
+ width: 0;
16
+ height: 0;
17
+ border-style: solid;
18
+ }
19
+ .xv-tooltip[role=tooltip][data-popper-placement=top]::after {
20
+ bottom: -5px;
21
+ left: 50%;
22
+ transform: translateX(-50%);
23
+ border-width: 5px 5px 0 5px;
24
+ border-color: var(--background-inverse, black) transparent transparent transparent;
25
+ }
26
+ .xv-tooltip[role=tooltip][data-popper-placement=top-start]::after {
27
+ bottom: -5px;
28
+ left: 12px;
29
+ border-width: 5px 5px 0 5px;
30
+ border-color: var(--background-inverse, black) transparent transparent transparent;
31
+ }
32
+ .xv-tooltip[role=tooltip][data-popper-placement=top-end]::after {
33
+ bottom: -5px;
34
+ right: 12px;
35
+ border-width: 5px 5px 0 5px;
36
+ border-color: var(--background-inverse, black) transparent transparent transparent;
37
+ }
38
+ .xv-tooltip[role=tooltip][data-popper-placement=bottom]::after {
39
+ top: -5px;
40
+ left: 50%;
41
+ transform: translateX(-50%);
42
+ border-width: 0 5px 5px 5px;
43
+ border-color: transparent transparent var(--background-inverse, black) transparent;
44
+ }
45
+ .xv-tooltip[role=tooltip][data-popper-placement=bottom-start]::after {
46
+ top: -5px;
47
+ left: 12px;
48
+ border-width: 0 5px 5px 5px;
49
+ border-color: transparent transparent var(--background-inverse, black) transparent;
50
+ }
51
+ .xv-tooltip[role=tooltip][data-popper-placement=bottom-end]::after {
52
+ top: -5px;
53
+ right: 12px;
54
+ border-width: 0 5px 5px 5px;
55
+ border-color: transparent transparent var(--background-inverse, black) transparent;
56
+ }
57
+ .xv-tooltip[role=tooltip][data-popper-placement=left]::after {
58
+ top: 50%;
59
+ right: -5px;
60
+ transform: translateY(-50%);
61
+ border-width: 5px 0 5px 5px;
62
+ border-color: transparent transparent transparent var(--background-inverse, black);
63
+ }
64
+ .xv-tooltip[role=tooltip][data-popper-placement=left-start]::after {
65
+ top: 12px;
66
+ right: -5px;
67
+ border-width: 5px 0 5px 5px;
68
+ border-color: transparent transparent transparent var(--background-inverse, black);
69
+ }
70
+ .xv-tooltip[role=tooltip][data-popper-placement=left-end]::after {
71
+ bottom: 12px;
72
+ right: -5px;
73
+ border-width: 5px 0 5px 5px;
74
+ border-color: transparent transparent transparent var(--background-inverse, black);
75
+ }
76
+ .xv-tooltip[role=tooltip][data-popper-placement=right]::after {
77
+ top: 50%;
78
+ left: -5px;
79
+ transform: translateY(-50%);
80
+ border-width: 5px 5px 5px 0;
81
+ border-color: transparent var(--background-inverse, black) transparent transparent;
82
+ }
83
+ .xv-tooltip[role=tooltip][data-popper-placement=right-start]::after {
84
+ top: 12px;
85
+ left: -5px;
86
+ border-width: 5px 5px 5px 0;
87
+ border-color: transparent var(--background-inverse, black) transparent transparent;
88
+ }
89
+ .xv-tooltip[role=tooltip][data-popper-placement=right-end]::after {
90
+ bottom: 12px;
91
+ left: -5px;
92
+ border-width: 5px 5px 5px 0;
93
+ border-color: transparent var(--background-inverse, black) transparent transparent;
94
+ }
95
+
1
96
  :host {
2
97
  font-family: inherit;
3
98
  display: flex;
@@ -30,6 +125,7 @@
30
125
  background-color: var(--background-inverse-hover);
31
126
  }
32
127
  :host .drop-zone {
128
+ min-height: 90px;
33
129
  border: 1px dashed var(--border-strong-01);
34
130
  background-color: transparent;
35
131
  padding: 1.14em;
@@ -96,8 +192,9 @@
96
192
  margin: 0;
97
193
  padding: 0;
98
194
  }
99
- :host .error-container__secondary {
195
+ :host .error-container_secondary {
100
196
  color: var(--text-secondary, #515151);
197
+ white-space: pre-line;
101
198
  }
102
199
 
103
200
  :host(.disabled) {
@@ -6,6 +6,7 @@ export class XvFileUploader {
6
6
  this.variant = XvFileUploaderVariants.BUTTON;
7
7
  this.size = SIZE_VAR.MD;
8
8
  this.accept = [];
9
+ this.buttonVariant = 'primary';
9
10
  this.maxFileSizeMB = 5;
10
11
  this.maxFiles = 20;
11
12
  this.multiple = true;
@@ -38,8 +39,13 @@ export class XvFileUploader {
38
39
  this.dragActive = false;
39
40
  };
40
41
  }
42
+ async clearFiles() {
43
+ this.files = [];
44
+ if (this.fileInput) {
45
+ this.fileInput.value = '';
46
+ }
47
+ }
41
48
  validation(files) {
42
- var _a;
43
49
  const maxSize = this.maxFileSizeMB * 1024 * 1024;
44
50
  const seenFileNames = new Set();
45
51
  const errorMessages = [];
@@ -50,12 +56,9 @@ export class XvFileUploader {
50
56
  seenFileNames.add(file.name);
51
57
  uniqueFiles.push(file);
52
58
  }
53
- const extension = (_a = file.name.split('.').pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
54
- const isAccepted = this.accept.length === 0 ||
55
- this.accept.some(type => {
56
- const normalized = type.toLowerCase().replace(/^\./, '');
57
- return normalized === extension;
58
- });
59
+ const dotIndex = file.name.lastIndexOf('.');
60
+ const extension = file.name.substring(dotIndex).toLowerCase();
61
+ const isAccepted = this.accept.length === 0 || this.accept.some(type => type.toLowerCase() === extension);
59
62
  if (!isAccepted) {
60
63
  error = 'Unsupported file type.';
61
64
  }
@@ -71,6 +74,8 @@ export class XvFileUploader {
71
74
  return uniqueFiles;
72
75
  }
73
76
  removeFile(index) {
77
+ if (this.files[index])
78
+ this.fileRemoved.emit(this.files[index]);
74
79
  this.files = this.validation([...this.files.slice(0, index), ...this.files.slice(index + 1)]);
75
80
  this.filesChange.emit(this.files);
76
81
  if (this.fileInput) {
@@ -79,10 +84,10 @@ export class XvFileUploader {
79
84
  }
80
85
  render() {
81
86
  var _a;
82
- return (h(Host, { key: '1105dfa28937f83f3508498ecf3b00b181f3f062', class: { 'upload-wrapper': true, [`uploader-${this.size}`]: true, disabled: !!this.disabled } }, this.label && h("label", { key: 'bb7aeb7744325dc15cee88e63672ab2f1cac48fa', class: "label" }, this.label), this.description && h("p", { key: '17d6076cf70f1d69b9d760992739f5f8ae571711', class: "description" }, this.description), this.variant === 'button' ? (h("button", { disabled: this.disabled, class: "upload-btn", onClick: () => this.fileInput.click() }, this.addText || 'Dateien auswählen')) : (h("div", { class: { 'drop-zone': true, active: this.dragActive }, onDrop: this.onDrop, onDragOver: this.onDragOver, onDragLeave: this.onDragLeave, onClick: () => this.fileInput.click() }, this.addText || 'Dateien hierher ziehen oder darauf klicken, um eine Datei auszuwählen.', ((_a = this.accept) === null || _a === void 0 ? void 0 : _a.length) > 0 && h("span", null, " (", this.accept.join(', '), ")"))), h("input", { key: 'bc25da9c977df0452fd8946b160d7b89487a5aee', ref: el => (this.fileInput = el), type: "file", hidden: true, onChange: this.onFileSelect, multiple: this.multiple, accept: this.accept.map(type => `.${type}`).join(',') }), h("ul", { key: '3d2b5a6505a70c4a14004f0e0f3c6da7213b0007', class: "file-list" }, this.files.map((file, index) => {
87
+ return (h(Host, { key: 'cca5e29c47f1272eb20ce505f824bf0fee264d79', class: { 'upload-wrapper': true, [`uploader-${this.size}`]: true, disabled: !!this.disabled } }, this.label && h("label", { key: '83b6b040877e31d98485f8216923613dca2a8bdc', class: "label" }, this.label), this.description && h("p", { key: 'c5fee7ad8b3b000bf07436dbaa875c072e1e0169', class: "description" }, this.description), this.variant === 'button' ? (h("xv-button-v2", { variant: this.buttonVariant, disabled: this.disabled, onClick: () => this.fileInput.click() }, this.addText || 'Dateien auswählen')) : (h("div", { class: { 'drop-zone': true, active: this.dragActive }, onDrop: this.onDrop, onDragOver: this.onDragOver, onDragLeave: this.onDragLeave, onClick: () => this.fileInput.click() }, this.addText || 'Dateien hierher ziehen oder darauf klicken, um eine Datei auszuwählen.', ((_a = this.accept) === null || _a === void 0 ? void 0 : _a.length) > 0 && h("span", null, " (", this.accept.join(', '), ")"))), h("input", { key: 'a3ccac67e702ea3d3e900b90fdb5fe0a2f8dd220', ref: el => (this.fileInput = el), type: "file", hidden: true, onChange: this.onFileSelect, multiple: this.multiple, accept: this.accept.join(',') }), h("ul", { key: 'c9ac4dce2a161863836af7c13c71783a9b51cdf0', class: "file-list" }, this.files.map((file, index) => {
83
88
  var _a, _b;
84
89
  return (h("li", { class: { file: true, withError: !!(((_a = this.errors) === null || _a === void 0 ? void 0 : _a[index]) || ((_b = this.errorMessages) === null || _b === void 0 ? void 0 : _b[index])) } }, h("div", { class: "file_container" }, h("span", { class: "file_container_name" }, file.name), this._renderLoaderState(index)), this._renderError(index)));
85
- })), this.error && (h("div", { key: '3918fcaf5c5660eb2a5553886e191e2969d81cb4', class: "error-container" }, h("p", { key: '26fcb672d89ec14e99b83dfc78712b72d9042d72', class: "error-container_primary" }, this.error)))));
90
+ })), this.error && (h("div", { key: '642650576c9019fb3e90ff2306a4ba2bc57ca6f7', class: "error-container" }, h("p", { key: '5ec4fe02693c4aa160d57721b2a44814c2081662', class: "error-container_primary" }, this.error)))));
86
91
  }
87
92
  _renderLoaderState(index) {
88
93
  var _a, _b, _c;
@@ -92,7 +97,7 @@ export class XvFileUploader {
92
97
  case 'loading':
93
98
  return (h(Fragment, null, errorIcon, h("xv-loader-v2", { size: SIZE_VAR.XS })));
94
99
  case 'success':
95
- return (h(Fragment, null, errorIcon, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 18 16", fill: "none" }, h("path", { d: "M9 16C6.125 16 3.5 14.5 2.0625 12C0.625 9.53125 0.625 6.5 2.0625 4C3.5 1.53125 6.125 0 9 0C11.8438 0 14.4688 1.53125 15.9062 4C17.3438 6.5 17.3438 9.53125 15.9062 12C14.4688 14.5 11.8438 16 9 16ZM12.5312 6.53125H12.5C12.8125 6.25 12.8125 5.78125 12.5 5.46875C12.2188 5.1875 11.75 5.1875 11.4688 5.46875L8 8.96875L6.53125 7.5C6.21875 7.1875 5.75 7.1875 5.46875 7.5C5.15625 7.78125 5.15625 8.25 5.46875 8.53125L7.46875 10.5312C7.75 10.8438 8.21875 10.8438 8.53125 10.5312L12.5312 6.53125Z", fill: "#97BF0D" }))));
100
+ return (h(Fragment, null, errorIcon, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 18 16", fill: "none" }, h("path", { d: "M9 16C6.125 16 3.5 14.5 2.0625 12C0.625 9.53125 0.625 6.5 2.0625 4C3.5 1.53125 6.125 0 9 0C11.8438 0 14.4688 1.53125 15.9062 4C17.3438 6.5 17.3438 9.53125 15.9062 12C14.4688 14.5 11.8438 16 9 16ZM12.5312 6.53125H12.5C12.8125 6.25 12.8125 5.78125 12.5 5.46875C12.2188 5.1875 11.75 5.1875 11.4688 5.46875L8 8.96875L6.53125 7.5C6.21875 7.1875 5.75 7.1875 5.46875 7.5C5.15625 7.78125 5.15625 8.25 5.46875 8.53125L7.46875 10.5312C7.75 10.8438 8.21875 10.8438 8.53125 10.5312L12.5312 6.53125Z", fill: "#97BF0D" })), h("xv-button-v2", { variant: "ghost", size: SIZE_VAR.XS, onClick: () => this.removeFile(index) }, h("span", { slot: "icon-left" }, "\u00D7"))));
96
101
  case 'uploaded':
97
102
  default:
98
103
  return (h(Fragment, null, errorIcon, h("xv-button-v2", { variant: "ghost", size: SIZE_VAR.XS, onClick: () => this.removeFile(index) }, h("span", { slot: "icon-left" }, "\u00D7"))));
@@ -253,6 +258,26 @@ export class XvFileUploader {
253
258
  "setter": false,
254
259
  "defaultValue": "[]"
255
260
  },
261
+ "buttonVariant": {
262
+ "type": "string",
263
+ "attribute": "button-variant",
264
+ "mutable": false,
265
+ "complexType": {
266
+ "original": "'primary' | 'secondary' | 'ghost' | 'danger' | 'tertiary'",
267
+ "resolved": "\"danger\" | \"ghost\" | \"primary\" | \"secondary\" | \"tertiary\"",
268
+ "references": {}
269
+ },
270
+ "required": false,
271
+ "optional": false,
272
+ "docs": {
273
+ "tags": [],
274
+ "text": ""
275
+ },
276
+ "getter": false,
277
+ "setter": false,
278
+ "reflect": false,
279
+ "defaultValue": "'primary'"
280
+ },
256
281
  "maxFileSizeMB": {
257
282
  "type": "number",
258
283
  "attribute": "max-file-size-mb",
@@ -442,7 +467,48 @@ export class XvFileUploader {
442
467
  }
443
468
  }
444
469
  }
470
+ }, {
471
+ "method": "fileRemoved",
472
+ "name": "fileRemoved",
473
+ "bubbles": true,
474
+ "cancelable": true,
475
+ "composed": true,
476
+ "docs": {
477
+ "tags": [],
478
+ "text": ""
479
+ },
480
+ "complexType": {
481
+ "original": "File",
482
+ "resolved": "File",
483
+ "references": {
484
+ "File": {
485
+ "location": "global",
486
+ "id": "global::File"
487
+ }
488
+ }
489
+ }
445
490
  }];
446
491
  }
492
+ static get methods() {
493
+ return {
494
+ "clearFiles": {
495
+ "complexType": {
496
+ "signature": "() => Promise<void>",
497
+ "parameters": [],
498
+ "references": {
499
+ "Promise": {
500
+ "location": "global",
501
+ "id": "global::Promise"
502
+ }
503
+ },
504
+ "return": "Promise<void>"
505
+ },
506
+ "docs": {
507
+ "text": "",
508
+ "tags": []
509
+ }
510
+ }
511
+ };
512
+ }
447
513
  }
448
514
  //# sourceMappingURL=xv-file-uploader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"xv-file-uploader.js","sourceRoot":"","sources":["../../../src/components/xv-file-uploader/xv-file-uploader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI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K,QAAQ,EAAE,CAAC;YAC9B,OAAO,CACL,WAAK,KAAK,EAAC,iBAAiB;gBAC1B,SAAG,KAAK,EAAC,yBAAyB,IAAE,KAAK,CAAK,CAC1C,CACP,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, EventEmitter, Event, h, Host, Prop, State, Fragment } from '@stencil/core';\nimport { SIZE_VAR } from '../../types/enum';\nimport { XvFileUploaderVariants } from './_vars';\n\n@Component({\n tag: 'xv-file-uploader',\n styleUrl: 'xv-file-uploader.scss',\n shadow: true,\n})\nexport class XvFileUploader {\n @Prop() label?: string;\n @Prop() description?: string;\n @Prop({ attribute: 'add-text' }) addText?: string;\n @Prop() variant: XvFileUploaderVariants = XvFileUploaderVariants.BUTTON;\n @Prop() size: SIZE_VAR = SIZE_VAR.MD;\n @Prop() accept: string[] = [];\n @Prop({ attribute: 'max-file-size-mb' }) maxFileSizeMB: number = 5;\n @Prop({ attribute: 'max-files' }) maxFiles: number = 20;\n @Prop() multiple: boolean = true;\n @Prop({ reflect: true }) disabled?: boolean;\n @Prop({ reflect: true, mutable: true }) files: File[] = [];\n @Prop({ reflect: true, mutable: true, attribute: 'loading-states' }) loadingStates: ('loading' | 'success' | 'uploaded')[] = [];\n @Prop({ reflect: true, mutable: true }) error?: string;\n @Prop({ reflect: true, mutable: true }) errors: string[] | { primary: string; secondary: string; }[] = [];\n\n @State() dragActive = false;\n @State() errorMessages: string[] = [];\n\n @Event() filesChange: EventEmitter<File[]>;\n\n private fileInput: HTMLInputElement;\n\n private onFileSelect = (event: Event) => {\n const input = event.target as HTMLInputElement;\n const selectedFiles = Array.from(input.files || []);\n this.handleFiles(selectedFiles);\n };\n\n private onDrop = (event: DragEvent) => {\n event.preventDefault();\n this.dragActive = false;\n const droppedFiles = Array.from(event.dataTransfer?.files || []);\n this.handleFiles(droppedFiles);\n };\n\n private handleFiles = (files: File[]) => {\n this.files = this.validation(this.multiple ? [...this.files, ...files] : files);\n this.filesChange.emit(this.files);\n };\n\n private validation(files: File[]): File[] {\n const maxSize = this.maxFileSizeMB * 1024 * 1024;\n const seenFileNames = new Set<string>();\n const errorMessages: (string | null)[] = [];\n const uniqueFiles: File[] = [];\n\n for (const file of files) {\n let error: string | undefined = null;\n\n if (!seenFileNames.has(file.name)) {\n seenFileNames.add(file.name);\n uniqueFiles.push(file);\n }\n\n const extension = file.name.split('.').pop()?.toLowerCase();\n const isAccepted =\n this.accept.length === 0 ||\n this.accept.some(type => {\n const normalized = type.toLowerCase().replace(/^\\./, '');\n return normalized === extension;\n });\n\n if (!isAccepted) {\n error = 'Unsupported file type.';\n } else if (file.size > maxSize) {\n error = `File ${file.name} is too large.`;\n }\n\n errorMessages.push(error);\n }\n\n this.error = uniqueFiles.length > this.maxFiles\n ? `Only ${this.maxFiles} file(s) allowed.`\n : null;\n\n this.errorMessages = errorMessages;\n\n return uniqueFiles;\n }\n\n private removeFile(index: number) {\n this.files = this.validation([...this.files.slice(0, index), ...this.files.slice(index + 1)]);\n this.filesChange.emit(this.files);\n if (this.fileInput) {\n this.fileInput.value = '';\n }\n }\n\n private onDragOver = (event: DragEvent) => {\n event.preventDefault();\n this.dragActive = true;\n };\n\n private onDragLeave = () => {\n this.dragActive = false;\n };\n\n render() {\n return (\n <Host class={{ 'upload-wrapper': true, [`uploader-${this.size}`]: true, disabled: !!this.disabled }}>\n {this.label && <label class=\"label\">{this.label}</label>}\n {this.description && <p class=\"description\">{this.description}</p>}\n {this.variant === 'button' ? (\n <button disabled={this.disabled} class=\"upload-btn\" onClick={() => this.fileInput.click()}>\n {this.addText || 'Dateien auswählen'}\n </button>\n ) : (\n <div\n class={{ 'drop-zone': true, active: this.dragActive }}\n onDrop={this.onDrop}\n onDragOver={this.onDragOver}\n onDragLeave={this.onDragLeave}\n onClick={() => this.fileInput.click()}\n >\n {this.addText || 'Dateien hierher ziehen oder darauf klicken, um eine Datei auszuwählen.'}\n {this.accept?.length > 0 && <span> ({this.accept.join(', ')})</span>}\n </div>\n )}\n\n <input\n ref={el => (this.fileInput = el)}\n type=\"file\"\n hidden\n onChange={this.onFileSelect}\n multiple={this.multiple}\n accept={this.accept.map(type => `.${type}`).join(',')}\n />\n\n <ul class=\"file-list\">\n {this.files.map((file, index) => (\n <li class={{ file: true, withError: !!(this.errors?.[index] || this.errorMessages?.[index]) }}>\n <div class=\"file_container\">\n <span class=\"file_container_name\">{file.name}</span>\n {this._renderLoaderState(index)}\n </div>\n {this._renderError(index)}\n </li>\n ))}\n </ul>\n {this.error && (\n <div class=\"error-container\">\n <p class=\"error-container_primary\">{this.error}</p>\n </div>\n )}\n </Host>\n );\n }\n\n private _renderLoaderState(index: number) {\n const state = this.loadingStates?.[index] || null;\n\n const errorIcon = this.errors?.[index] || this.errorMessages?.[index] ? (\n <svg class=\"file_container_errorIcon\" width=\"16\" height=\"16\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path fill=\"currentColor\"\n d=\"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24l0 112c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-112c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z\" />\n </svg>\n ) : null;\n\n switch (state) {\n case 'loading':\n return (\n <Fragment>\n {errorIcon}\n <xv-loader-v2 size={SIZE_VAR.XS} />\n </Fragment>\n );\n case 'success':\n return (\n <Fragment>\n {errorIcon}\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 18 16\" fill=\"none\">\n <path\n d=\"M9 16C6.125 16 3.5 14.5 2.0625 12C0.625 9.53125 0.625 6.5 2.0625 4C3.5 1.53125 6.125 0 9 0C11.8438 0 14.4688 1.53125 15.9062 4C17.3438 6.5 17.3438 9.53125 15.9062 12C14.4688 14.5 11.8438 16 9 16ZM12.5312 6.53125H12.5C12.8125 6.25 12.8125 5.78125 12.5 5.46875C12.2188 5.1875 11.75 5.1875 11.4688 5.46875L8 8.96875L6.53125 7.5C6.21875 7.1875 5.75 7.1875 5.46875 7.5C5.15625 7.78125 5.15625 8.25 5.46875 8.53125L7.46875 10.5312C7.75 10.8438 8.21875 10.8438 8.53125 10.5312L12.5312 6.53125Z\"\n fill=\"#97BF0D\" />\n </svg>\n </Fragment>\n );\n case 'uploaded':\n default:\n return (\n <Fragment>\n {errorIcon}\n <xv-button-v2 variant=\"ghost\" size={SIZE_VAR.XS} onClick={() => this.removeFile(index)}>\n <span slot=\"icon-left\">×</span>\n </xv-button-v2>\n </Fragment>\n );\n }\n }\n\n private _renderError(index: number) {\n const error = this.errors?.[index] || this.errorMessages?.[index];\n\n if (!error) return;\n\n if (typeof error === 'object') {\n return (\n <div class=\"error-container\">\n <p class=\"error-container_primary\">{error.primary}</p>\n <p class=\"error-container_secondary\">{error.secondary}</p>\n </div>\n );\n }\n\n if (typeof error === 'string') {\n return (\n <div class=\"error-container\">\n <p class=\"error-container_primary\">{error}</p>\n </div>\n );\n }\n\n return null;\n }\n}\n"]}
1
+ {"version":3,"file":"xv-file-uploader.js","sourceRoot":"","sources":["../../../src/components/xv-file-uploader/xv-file-uploader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,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MAAM,KAAK,GAAG,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAG,KAAK,CAAC,MAAI,MAAA,IAAI,CAAC,aAAa,0CAAG,KAAK,CAAC,CAAA,CAAC;QAElE,IAAI,CAAC,KAAK;YAAE,OAAO;QAEnB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,CACL,WAAK,KAAK,EAAC,iBAAiB;gBAC1B,SAAG,KAAK,EAAC,yBAAyB,IAAE,KAAK,CAAC,OAAO,CAAK;gBACtD,SAAG,KAAK,EAAC,2BAA2B,IAAE,KAAK,CAAC,SAAS,CAAK,CACtD,CACP,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,CACL,WAAK,KAAK,EAAC,iBAAiB;gBAC1B,SAAG,KAAK,EAAC,yBAAyB,IAAE,KAAK,CAAK,CAC1C,CACP,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, EventEmitter, Event, h, Host, Prop, State, Fragment, Method } from '@stencil/core';\nimport { SIZE_VAR } from '../../types/enum';\nimport { XvFileUploaderVariants } from './_vars';\n\n@Component({\n tag: 'xv-file-uploader',\n styleUrl: 'xv-file-uploader.scss',\n shadow: true,\n})\nexport class XvFileUploader {\n @Prop() label?: string;\n @Prop() description?: string;\n @Prop({ attribute: 'add-text' }) addText?: string;\n @Prop() variant: XvFileUploaderVariants = XvFileUploaderVariants.BUTTON;\n @Prop() size: SIZE_VAR = SIZE_VAR.MD;\n @Prop() accept: string[] = [];\n @Prop() buttonVariant: 'primary' | 'secondary' | 'ghost' | 'danger' | 'tertiary' = 'primary';\n @Prop({ attribute: 'max-file-size-mb' }) maxFileSizeMB: number = 5;\n @Prop({ attribute: 'max-files' }) maxFiles: number = 20;\n @Prop() multiple: boolean = true;\n @Prop({ reflect: true }) disabled?: boolean;\n @Prop({ reflect: true, mutable: true }) files: File[] = [];\n @Prop({ reflect: true, mutable: true, attribute: 'loading-states' }) loadingStates: ('loading' | 'success' | 'uploaded')[] = [];\n @Prop({ reflect: true, mutable: true }) error?: string;\n @Prop({ reflect: true, mutable: true }) errors: string[] | { primary: string; secondary: string; }[] = [];\n\n @State() dragActive = false;\n @State() errorMessages: string[] = [];\n\n @Event() filesChange: EventEmitter<File[]>;\n @Event() fileRemoved: EventEmitter<File>;\n\n private fileInput: HTMLInputElement;\n\n @Method()\n async clearFiles() {\n this.files = [];\n if (this.fileInput) {\n this.fileInput.value = '';\n }\n }\n\n private onFileSelect = (event: Event) => {\n const input = event.target as HTMLInputElement;\n const selectedFiles = Array.from(input.files || []);\n this.handleFiles(selectedFiles);\n };\n\n private onDrop = (event: DragEvent) => {\n event.preventDefault();\n this.dragActive = false;\n const droppedFiles = Array.from(event.dataTransfer?.files || []);\n this.handleFiles(droppedFiles);\n };\n\n private handleFiles = (files: File[]) => {\n this.files = this.validation(this.multiple ? [...this.files, ...files] : files);\n this.filesChange.emit(this.files);\n };\n\n private validation(files: File[]): File[] {\n const maxSize = this.maxFileSizeMB * 1024 * 1024;\n const seenFileNames = new Set<string>();\n const errorMessages: (string | null)[] = [];\n const uniqueFiles: File[] = [];\n\n for (const file of files) {\n let error: string | undefined = null;\n\n if (!seenFileNames.has(file.name)) {\n seenFileNames.add(file.name);\n uniqueFiles.push(file);\n }\n\n const dotIndex = file.name.lastIndexOf('.');\n const extension = file.name.substring(dotIndex).toLowerCase();\n const isAccepted = this.accept.length === 0 || this.accept.some(type => type.toLowerCase() === extension);\n\n if (!isAccepted) {\n error = 'Unsupported file type.';\n } else if (file.size > maxSize) {\n error = `File ${file.name} is too large.`;\n }\n\n errorMessages.push(error);\n }\n\n this.error = uniqueFiles.length > this.maxFiles\n ? `Only ${this.maxFiles} file(s) allowed.`\n : null;\n\n this.errorMessages = errorMessages;\n\n return uniqueFiles;\n }\n\n private removeFile(index: number) {\n if (this.files[index]) this.fileRemoved.emit(this.files[index]);\n this.files = this.validation([...this.files.slice(0, index), ...this.files.slice(index + 1)]);\n this.filesChange.emit(this.files);\n if (this.fileInput) {\n this.fileInput.value = '';\n }\n }\n\n private onDragOver = (event: DragEvent) => {\n event.preventDefault();\n this.dragActive = true;\n };\n\n private onDragLeave = () => {\n this.dragActive = false;\n };\n\n render() {\n return (\n <Host class={{ 'upload-wrapper': true, [`uploader-${this.size}`]: true, disabled: !!this.disabled }}>\n {this.label && <label class=\"label\">{this.label}</label>}\n {this.description && <p class=\"description\">{this.description}</p>}\n {this.variant === 'button' ? (\n <xv-button-v2 variant={this.buttonVariant} disabled={this.disabled} onClick={() => this.fileInput.click()}>\n {this.addText || 'Dateien auswählen'}\n </xv-button-v2>\n ) : (\n <div\n class={{ 'drop-zone': true, active: this.dragActive }}\n onDrop={this.onDrop}\n onDragOver={this.onDragOver}\n onDragLeave={this.onDragLeave}\n onClick={() => this.fileInput.click()}\n >\n {this.addText || 'Dateien hierher ziehen oder darauf klicken, um eine Datei auszuwählen.'}\n {this.accept?.length > 0 && <span> ({this.accept.join(', ')})</span>}\n </div>\n )}\n\n <input\n ref={el => (this.fileInput = el)}\n type=\"file\"\n hidden\n onChange={this.onFileSelect}\n multiple={this.multiple}\n accept={this.accept.join(',')}\n />\n\n <ul class=\"file-list\">\n {this.files.map((file, index) => (\n <li class={{ file: true, withError: !!(this.errors?.[index] || this.errorMessages?.[index]) }}>\n <div class=\"file_container\">\n <span class=\"file_container_name\">{file.name}</span>\n {this._renderLoaderState(index)}\n </div>\n {this._renderError(index)}\n </li>\n ))}\n </ul>\n {this.error && (\n <div class=\"error-container\">\n <p class=\"error-container_primary\">{this.error}</p>\n </div>\n )}\n </Host>\n );\n }\n\n private _renderLoaderState(index: number) {\n const state = this.loadingStates?.[index] || null;\n\n const errorIcon = this.errors?.[index] || this.errorMessages?.[index] ? (\n <svg class=\"file_container_errorIcon\" width=\"16\" height=\"16\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path fill=\"currentColor\"\n d=\"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24l0 112c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-112c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z\" />\n </svg>\n ) : null;\n\n switch (state) {\n case 'loading':\n return (\n <Fragment>\n {errorIcon}\n <xv-loader-v2 size={SIZE_VAR.XS} />\n </Fragment>\n );\n case 'success':\n return (\n <Fragment>\n {errorIcon}\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 18 16\" fill=\"none\">\n <path\n d=\"M9 16C6.125 16 3.5 14.5 2.0625 12C0.625 9.53125 0.625 6.5 2.0625 4C3.5 1.53125 6.125 0 9 0C11.8438 0 14.4688 1.53125 15.9062 4C17.3438 6.5 17.3438 9.53125 15.9062 12C14.4688 14.5 11.8438 16 9 16ZM12.5312 6.53125H12.5C12.8125 6.25 12.8125 5.78125 12.5 5.46875C12.2188 5.1875 11.75 5.1875 11.4688 5.46875L8 8.96875L6.53125 7.5C6.21875 7.1875 5.75 7.1875 5.46875 7.5C5.15625 7.78125 5.15625 8.25 5.46875 8.53125L7.46875 10.5312C7.75 10.8438 8.21875 10.8438 8.53125 10.5312L12.5312 6.53125Z\"\n fill=\"#97BF0D\" />\n </svg>\n <xv-button-v2 variant=\"ghost\" size={SIZE_VAR.XS} onClick={() => this.removeFile(index)}>\n <span slot=\"icon-left\">×</span>\n </xv-button-v2>\n </Fragment>\n );\n case 'uploaded':\n default:\n return (\n <Fragment>\n {errorIcon}\n <xv-button-v2 variant=\"ghost\" size={SIZE_VAR.XS} onClick={() => this.removeFile(index)}>\n <span slot=\"icon-left\">×</span>\n </xv-button-v2>\n </Fragment>\n );\n }\n }\n\n private _renderError(index: number) {\n const error = this.errors?.[index] || this.errorMessages?.[index];\n\n if (!error) return;\n\n if (typeof error === 'object') {\n return (\n <div class=\"error-container\">\n <p class=\"error-container_primary\">{error.primary}</p>\n <p class=\"error-container_secondary\">{error.secondary}</p>\n </div>\n );\n }\n\n if (typeof error === 'string') {\n return (\n <div class=\"error-container\">\n <p class=\"error-container_primary\">{error}</p>\n </div>\n );\n }\n\n return null;\n }\n}\n"]}