wj-elements 0.1.48 → 0.1.49

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/custom-elements.json +14058 -0
  2. package/dist/dark.css +1 -0
  3. package/dist/light.css +1 -0
  4. package/dist/localize.js +45 -0
  5. package/dist/popup.element-CWsSOxs2.js +1072 -0
  6. package/dist/router-links-FtZbFUto.js +146 -0
  7. package/dist/styles.css +1 -0
  8. package/dist/web-types.json +3122 -0
  9. package/dist/wje-accordion-item.js +88 -0
  10. package/dist/wje-accordion.js +79 -0
  11. package/dist/wje-animation.js +121 -0
  12. package/dist/wje-aside.js +55 -0
  13. package/dist/wje-avatar.js +77 -0
  14. package/dist/wje-badge.js +50 -0
  15. package/dist/wje-breadcrumb.js +148 -0
  16. package/dist/wje-breadcrumbs.js +67 -0
  17. package/dist/wje-button-group.js +78 -0
  18. package/dist/wje-button.js +207 -0
  19. package/dist/wje-card-content.js +48 -0
  20. package/dist/wje-card-controls.js +48 -0
  21. package/dist/wje-card-header.js +47 -0
  22. package/dist/wje-card-subtitle.js +55 -0
  23. package/dist/wje-card-title.js +55 -0
  24. package/dist/wje-card.js +50 -0
  25. package/dist/wje-carousel-item.js +33 -0
  26. package/dist/wje-carousel.js +177 -0
  27. package/dist/wje-checkbox.js +96 -0
  28. package/dist/wje-chip.js +32 -0
  29. package/dist/wje-col.js +27 -0
  30. package/dist/wje-color-picker.js +953 -0
  31. package/dist/wje-container.js +57 -0
  32. package/dist/wje-copy-button.js +170 -0
  33. package/dist/wje-dialog.js +86 -0
  34. package/dist/wje-divider.js +53 -0
  35. package/dist/wje-dropdown.js +114 -0
  36. package/dist/wje-element.js +453 -0
  37. package/dist/wje-fetchAndParseCSS.js +40 -0
  38. package/dist/wje-file-upload-item.js +115 -0
  39. package/dist/wje-file-upload.js +297 -0
  40. package/dist/wje-footer.js +56 -0
  41. package/dist/wje-form.js +28 -0
  42. package/dist/wje-format-digital.js +85 -0
  43. package/dist/wje-grid.js +28 -0
  44. package/dist/wje-header.js +58 -0
  45. package/dist/wje-icon-picker.js +221 -0
  46. package/dist/wje-icon.js +119 -0
  47. package/dist/wje-img-comparer.js +111 -0
  48. package/dist/wje-img.js +58 -0
  49. package/dist/wje-infinite-scroll.js +201 -0
  50. package/dist/wje-inline-edit.js +145 -0
  51. package/dist/wje-input-file.js +85 -0
  52. package/dist/wje-input.js +334 -0
  53. package/dist/wje-item.js +45 -0
  54. package/dist/wje-label.js +67 -0
  55. package/dist/wje-list.js +53 -0
  56. package/dist/wje-main.js +56 -0
  57. package/dist/wje-masonry.js +218 -0
  58. package/dist/wje-master.js +423 -0
  59. package/dist/wje-menu-button.js +65 -0
  60. package/dist/wje-menu-item.js +230 -0
  61. package/dist/wje-menu-label.js +57 -0
  62. package/dist/wje-menu.js +74 -0
  63. package/dist/wje-option.js +99 -0
  64. package/dist/wje-options.js +63 -0
  65. package/dist/wje-popup.js +5 -0
  66. package/dist/wje-progress-bar.js +161 -0
  67. package/dist/wje-qr-code.js +2332 -0
  68. package/dist/wje-radio-group.js +101 -0
  69. package/dist/wje-radio.js +46 -0
  70. package/dist/wje-rate.js +260 -0
  71. package/dist/wje-relative-time.js +85 -0
  72. package/dist/wje-reorder-dropzone.js +27 -0
  73. package/dist/wje-reorder-handle.js +115 -0
  74. package/dist/wje-reorder-item.js +32 -0
  75. package/dist/wje-reorder.js +138 -0
  76. package/dist/wje-route.js +46 -0
  77. package/dist/wje-router-link.js +64 -0
  78. package/dist/wje-router-outlet.js +127 -0
  79. package/dist/wje-routerx.js +1088 -0
  80. package/dist/wje-row.js +58 -0
  81. package/dist/wje-select.js +242 -0
  82. package/dist/wje-slider.js +177 -0
  83. package/dist/wje-sliding-container.js +277 -0
  84. package/dist/wje-split-view.js +112 -0
  85. package/dist/wje-status.js +54 -0
  86. package/dist/wje-store.js +192 -0
  87. package/dist/wje-tab-group.js +107 -0
  88. package/dist/wje-tab-panel.js +52 -0
  89. package/dist/wje-tab.js +59 -0
  90. package/dist/wje-textarea.js +116 -0
  91. package/dist/wje-thumbnail.js +64 -0
  92. package/dist/wje-toast.js +76 -0
  93. package/dist/wje-toggle.js +94 -0
  94. package/dist/wje-toolbar-action.js +63 -0
  95. package/dist/wje-toolbar.js +61 -0
  96. package/dist/wje-tooltip.js +116 -0
  97. package/dist/wje-visually-hidden.js +56 -0
  98. package/package.json +1 -1
@@ -0,0 +1,201 @@
1
+ var p = Object.defineProperty;
2
+ var g = (h, a, e) => a in h ? p(h, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[a] = e;
3
+ var o = (h, a, e) => (g(h, typeof a != "symbol" ? a + "" : a, e), e);
4
+ import f, { WjElementUtils as w, event as d } from "./wje-element.js";
5
+ const y = ":host{overflow-x:auto;width:var(--wje-infinite-scroll-width);height:var(--wje-infinite-scroll-height);display:block}.loading{position:sticky;display:none;justify-content:center;align-items:center;width:100%;height:100%;top:0;left:0;z-index:9999;background-color:var(--wje-infinite-scroll-loading-bg)}.loading.show{display:flex}[name=ending]{display:none;margin-top:1rem;text-align:center}[name=ending].show{display:block}";
6
+ class u extends f {
7
+ /**
8
+ * Creates an instance of InfiniteScroll.
9
+ *
10
+ * @constructor
11
+ * @param {Object} options - The options for the InfiniteScroll.
12
+ */
13
+ constructor(e = {}) {
14
+ super();
15
+ o(this, "className", "InfiniteScroll");
16
+ /**
17
+ * Adds the scroll event listener.
18
+ */
19
+ o(this, "scrollEvent", () => {
20
+ this.addEventListener("scroll", this.onScroll);
21
+ });
22
+ /**
23
+ * Removes the scroll event listener.
24
+ */
25
+ o(this, "unScrollEvent", () => {
26
+ this.removeEventListener("scroll", this.onScroll);
27
+ });
28
+ /**
29
+ * Handles the scroll event.
30
+ *
31
+ * @param {Event} e - The event.
32
+ */
33
+ o(this, "onScroll", (e) => {
34
+ const { scrollTop: t, scrollHeight: i, clientHeight: s } = e.target;
35
+ t + s >= i - 300 && this.currentPage <= this.totalPages && this.isLoading.includes(this.currentPage) && (this.currentPage++, this.loadPages(this.currentPage));
36
+ });
37
+ /**
38
+ * Sets the custom data.
39
+ *
40
+ */
41
+ o(this, "dataToHtml", (e) => {
42
+ let t = this.infiniteScrollTemplate.interpolate(e);
43
+ return this.parser.parseFromString(t, "text/html").activeElement.firstElementChild;
44
+ });
45
+ o(this, "customForeach", (e) => {
46
+ e.forEach((t) => {
47
+ let i = this.dataToHtml(t);
48
+ d.addListener(i, "click", "wje-infinite-scroll:click-item", null), this.placementObj.insertAdjacentElement("beforeend", i);
49
+ });
50
+ });
51
+ this.totalPages = 0, this.isLoading = [], this._response = {}, this.iterate = null, this._infiniteScrollTemplate = null, String.prototype.interpolate = function(t) {
52
+ let i = this, s = i.match(/\{{.*?\}}/g);
53
+ if (s)
54
+ for (let l of s) {
55
+ let c = l.replace("{{", "").replace("}}", ""), n = "";
56
+ c.split(".").forEach((r) => {
57
+ n = n == "" ? t[r] : n[r];
58
+ }), i = i.replace(l, n);
59
+ }
60
+ return i;
61
+ };
62
+ }
63
+ set infiniteScrollTemplate(e) {
64
+ this._infiniteScrollTemplate = e;
65
+ }
66
+ get infiniteScrollTemplate() {
67
+ return this._infiniteScrollTemplate;
68
+ }
69
+ set response(e) {
70
+ this._response = e;
71
+ }
72
+ get response() {
73
+ return this._response;
74
+ }
75
+ set objectName(e) {
76
+ this.setAttribute("object-name", e);
77
+ }
78
+ get objectName() {
79
+ return this.getAttribute("object-name") || "data";
80
+ }
81
+ /**
82
+ * Returns the CSS styles for the component.
83
+ *
84
+ * @static
85
+ * @returns {CSSStyleSheet}
86
+ */
87
+ static get cssStyleSheet() {
88
+ return y;
89
+ }
90
+ /**
91
+ * Returns the list of attributes to observe for changes.
92
+ *
93
+ * @static
94
+ * @returns {Array<string>}
95
+ */
96
+ static get observedAttributes() {
97
+ return [];
98
+ }
99
+ /**
100
+ * Sets up the attributes for the component.
101
+ */
102
+ setupAttributes() {
103
+ this.isShadowRoot = "open";
104
+ }
105
+ /**
106
+ * Prepares the component before drawing.
107
+ *
108
+ * @param {Object} context - The context for drawing.
109
+ * @param {Object} store - The store for drawing.
110
+ * @param {Object} params - The parameters for drawing.
111
+ */
112
+ beforeDraw(e, t, i) {
113
+ var s, l;
114
+ this.iterate = this.querySelector("[iterate]"), this.infiniteScrollTemplate = (s = this.iterate) == null ? void 0 : s.outerHTML, (l = this.iterate) == null || l.remove(), this.setAttribute("style", "height: " + this.height);
115
+ }
116
+ /**
117
+ * Draws the component.
118
+ *
119
+ * @param {Object} context - The context for drawing.
120
+ * @param {Object} store - The store for drawing.
121
+ * @param {Object} params - The parameters for drawing.
122
+ * @returns {DocumentFragment}
123
+ */
124
+ draw(e, t, i) {
125
+ let s = document.createDocumentFragment(), l = document.createElement("div");
126
+ l.classList.add("native"), l.setAttribute("part", "native-infinite-scroll");
127
+ let c = document.createElement("slot"), n = document.createElement("slot");
128
+ if (n.setAttribute("name", "ending"), w.hasSlot(this, "loader")) {
129
+ let r = document.createElement("div");
130
+ r.classList.add("loading");
131
+ let m = document.createElement("slot");
132
+ m.setAttribute("name", "loader"), r.appendChild(m), this.loadingEl = r, s.appendChild(r);
133
+ }
134
+ return l.appendChild(c), l.appendChild(n), s.appendChild(l), this.endingEl = n, s;
135
+ }
136
+ /**
137
+ * Called after the component has been drawn.
138
+ */
139
+ async afterDraw() {
140
+ this.queryParams = this.queryParams || "", this.size = +this.size || 10, this.currentPage = 0, this.scrollEvent(), await this.loadPages(this.currentPage);
141
+ }
142
+ /**
143
+ * Fetches the pages from the server.
144
+ *
145
+ * @param {number} page - The page number.
146
+ * @returns {Promise<Object>} The response from the server.
147
+ */
148
+ async getPages(e) {
149
+ let t = this.url.includes("?");
150
+ const i = await fetch(`${this.url}${t ? "&" : "?"}page=${e}&size=${this.size}${this == null ? void 0 : this.queryParams}`);
151
+ if (!i.ok)
152
+ throw new Error(`An error occurred: ${i.status}`);
153
+ return await i.json();
154
+ }
155
+ /**
156
+ * Hides the loader.
157
+ */
158
+ hideLoader() {
159
+ var e;
160
+ (e = this == null ? void 0 : this.loadingEl) == null || e.classList.remove("show");
161
+ }
162
+ /**
163
+ * Shows the loader.
164
+ */
165
+ showLoader() {
166
+ var e;
167
+ (e = this == null ? void 0 : this.loadingEl) == null || e.classList.add("show");
168
+ }
169
+ /**
170
+ * Checks if there are more pages to load.
171
+ *
172
+ * @param {number} page - The page number.
173
+ * @returns {boolean} Whether there are more pages to load.
174
+ */
175
+ hasMorePages(e) {
176
+ return this.totalPages === 0 || e < this.totalPages;
177
+ }
178
+ /**
179
+ * Loads the pages.
180
+ *
181
+ * @param {number} page - The page number.
182
+ */
183
+ async loadPages(e) {
184
+ this.showLoader();
185
+ try {
186
+ if (this.hasMorePages(e)) {
187
+ let t;
188
+ this.parser = new DOMParser(), typeof this.setCustomData == "function" ? t = await this.setCustomData(e) : t = await this.getPages(e), this.totalPages = t.totalPages, this.currentPage = e, this.placementObj = this, this.hasAttribute("placement") && (this.placementObj = this.querySelector(this.placement)), d.dispatchCustomEvent(this, "wje-infinite-scroll:load", t), this.response = t, this.customForeach(t[this.objectName]), this.isLoading.push(e);
189
+ } else
190
+ d.dispatchCustomEvent(this, "wje-infinite-scroll:complete"), this.endingEl.classList.add("show");
191
+ } catch (t) {
192
+ console.log(t.message);
193
+ } finally {
194
+ this.hideLoader();
195
+ }
196
+ }
197
+ }
198
+ u.define("wje-infinite-scroll", u);
199
+ export {
200
+ u as default
201
+ };
@@ -0,0 +1,145 @@
1
+ var u = Object.defineProperty;
2
+ var p = (s, n, t) => n in s ? u(s, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[n] = t;
3
+ var r = (s, n, t) => (p(s, typeof n != "symbol" ? n + "" : n, t), t);
4
+ import c from "./wje-element.js";
5
+ import m from "./wje-format-digital.js";
6
+ import b from "./wje-button.js";
7
+ import v from "./wje-input.js";
8
+ import f from "./wje-icon.js";
9
+ const g = ":host{cursor:pointer;overflow:hidden;@keyframes wjFade{0%{display:flex}to{display:none}}}:host .heading{z-index:1;display:flex;align-items:center;position:relative;min-height:34px}:host .heading .edit{margin-left:.5rem;opacity:0}:host .heading:hover .edit{opacity:1}:host .heading h5{margin:0;width:calc(100% - 50px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host .native-inline-edit{align-items:center;border-radius:3px!important;margin:0 1rem 0 0;display:flex}:host .native-inline-edit.open{z-index:9}:host .native-inline-edit .buttons{display:flex;margin:0 0 0 .5rem}:host .fade-out{display:none}:host .fade-in{display:flex}";
10
+ class l extends c {
11
+ constructor() {
12
+ super();
13
+ /**
14
+ * Dependencies
15
+ * @type {Object}
16
+ */
17
+ r(this, "depandencies", {
18
+ "wje-format-digital": m,
19
+ "wje-button": b,
20
+ "wje-input": v,
21
+ "wje-icon": f
22
+ });
23
+ /**
24
+ * The class name.
25
+ */
26
+ r(this, "className", "InlineEdit");
27
+ }
28
+ get title() {
29
+ return this.getAttribute("title");
30
+ }
31
+ set title(t) {
32
+ return this.setAttribute("title", t);
33
+ }
34
+ get notEditable() {
35
+ return this.hasAttribute("not-editable");
36
+ }
37
+ set notEditable(t) {
38
+ return this.setAttribute("not-editable", "");
39
+ }
40
+ get endpoint() {
41
+ return this.getAttribute("endpoint");
42
+ }
43
+ set endpoint(t) {
44
+ return this.setAttribute("endpoint", t);
45
+ }
46
+ /**
47
+ * Getter for the CSS stylesheet.
48
+ * @returns {string} The CSS stylesheet.
49
+ */
50
+ static get cssStyleSheet() {
51
+ return g;
52
+ }
53
+ static get observedAttributes() {
54
+ return ["checked", "disabled"];
55
+ }
56
+ /**
57
+ * Sets up the attributes for the checkbox.
58
+ */
59
+ setupAttributes() {
60
+ this.isShadowRoot = "open";
61
+ }
62
+ /**
63
+ * Draws the checkbox.
64
+ * @param {object} context - The context.
65
+ * @param {object} store - The store.
66
+ * @param {object} params - The parameters.
67
+ * @returns {DocumentFragment} The created fragment.
68
+ */
69
+ draw(t, e, h) {
70
+ let i = document.createDocumentFragment();
71
+ if (this.heading = document.createElement("div"), this.heading.classList.add("heading"), this.h5 = document.createElement("h5"), this.h5.innerHTML = this.textContent || this.title || "Názov", this.heading.appendChild(this.h5), i.appendChild(this.heading), !this.notEditable) {
72
+ this.span = document.createElement("span"), this.span.innerHTML = '<wje-icon name="pencil"></wje-icon>';
73
+ let a = document.createElement("div");
74
+ a.setAttribute("part", "native"), a.classList.add("native-inline-edit"), this.input = this.inputElement(), this.buttons = document.createElement("div"), this.buttons.classList.add("buttons", "btn-group");
75
+ let d = document.createElement("wje-button");
76
+ d.setAttribute("fill", "outline"), d.setAttribute("color", "success"), d.innerHTML = '<wje-icon name="check"></wje-icon>';
77
+ let o = document.createElement("wje-button");
78
+ o.setAttribute("fill", "outline"), o.setAttribute("color", "danger"), o.innerHTML = '<wje-icon name="x"></wje-icon>', this.heading.appendChild(this.span), this.buttons.appendChild(d), this.buttons.appendChild(o), a.appendChild(this.input), a.appendChild(this.buttons), this.save = d, this.close = o, i.appendChild(a);
79
+ }
80
+ return i;
81
+ }
82
+ afterDraw(t, e, h) {
83
+ this.notEditable || (this.heading.addEventListener("click", (i) => {
84
+ this.heading.classList.remove("fade-in"), this.heading.classList.add("fade-out");
85
+ }), this.close.addEventListener("click", (i) => {
86
+ i.preventDefault(), i.stopImmediatePropagation(), i.stopPropagation(), native.classList.remove("open", "fade-in"), this.heading.classList.remove("fade-out"), this.heading.classList.add("fade-in");
87
+ }), this.save.addEventListener("click", (i) => {
88
+ this.endpoint === null ? this.dispatchEdit(this.input.value) : this.save(this.input.value);
89
+ }));
90
+ }
91
+ inputElement() {
92
+ let t = document.createElement("wje-input");
93
+ return t.setAttribute("variant", "standard"), t.setAttribute("type", "text"), t.setAttribute("placeholder", this.placelhoder), t.setAttribute("value", this.textContent), t;
94
+ }
95
+ save(t) {
96
+ return fetch(this.endpoint, {
97
+ method: "PUT",
98
+ headers: {
99
+ "Content-Type": "application/json"
100
+ },
101
+ body: t
102
+ }).then((e) => e.ok ? e.json() : e.text).then((e) => {
103
+ this.title = e.data, this.refresh(), intranet.notification(e), this.dispatchResponse(e.data);
104
+ }).catch((e) => {
105
+ intranet.notification(e), this.dispatchError(e);
106
+ });
107
+ }
108
+ dispatchEdit(t) {
109
+ document.dispatchEvent(
110
+ new CustomEvent("wje-inline-edit-save", {
111
+ bubbles: !0,
112
+ detail: {
113
+ value: t,
114
+ element: this
115
+ }
116
+ })
117
+ );
118
+ }
119
+ dispatchResponse(t) {
120
+ document.dispatchEvent(
121
+ new CustomEvent("wje-inline-edit-response", {
122
+ bubbles: !0,
123
+ detail: {
124
+ value: t,
125
+ element: this
126
+ }
127
+ })
128
+ );
129
+ }
130
+ dispatchError(t) {
131
+ document.dispatchEvent(
132
+ new CustomEvent("wje-inline-edit-error", {
133
+ bubbles: !0,
134
+ detail: {
135
+ value: t,
136
+ element: this
137
+ }
138
+ })
139
+ );
140
+ }
141
+ }
142
+ l.define("wje-inline-edit", l);
143
+ export {
144
+ l as default
145
+ };
@@ -0,0 +1,85 @@
1
+ var b = Object.defineProperty;
2
+ var h = (i, e, t) => e in i ? b(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var u = (i, e, t) => (h(i, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import m, { event as v } from "./wje-element.js";
5
+ const w = ':host{--wje-input-font-family: var(--wje-font-family);--wje-input-background-color: var(--wje-background);--wje-input-color: var(--wje-color);--wje-input-color-invalid: var(--wje-color-danger);--wje-input-border-color: var(--wje-border-color);--wje-input-border-color-focus: var(--wje-color-primary);--wje-input-border-width: 1px;--wje-input-border-style: solid;--wje-input-border-radius: 4px;--wje-input-margin-bottom: .5rem;--wje-input-line-height: 20px;--wje-input-slot-padding-inline: .5rem;width:100%;margin-bottom:var(--wje-input-margin-bottom);display:block}:host .wrapper{display:flex;width:100%}:host .native-input .input-wrapper{width:100%;position:relative}:host .native-input.default{background-color:var(--wje-input-background-color);font-family:var(--wje-input-font-family);position:relative;border-radius:var(--wje-input-border-radius);border-width:var(--wje-input-border-width);border-style:var(--wje-input-border-style);border-color:var(--wje-input-border-color);padding-inline:0;padding-top:.25rem;padding-bottom:.25rem;transition:background-color .2s ease;cursor:text}:host .native-input.default .input-wrapper{margin-inline:.5rem}:host .native-input.default.focused{border-color:var(--wje-input-border-color-focus)!important}:host .native-input.default.focused label{opacity:.67;font-size:12px;letter-spacing:normal}:host .native-input.default input{border:none;height:25px;min-height:25px;padding:0;margin-top:-4px;background:none;box-shadow:none;width:100%}:host .native-input.default label{margin:0;display:block;opacity:1;cursor:text;transition:opacity .2s ease;line-height:var(--wje-input-line-height)}:host .native-input.default label.fade{opacity:.5;font-size:12px;letter-spacing:normal}:host .native-input.default ::slotted([slot="start"]){border-left:none;border-top:none;border-bottom:none}:host .native-input.default ::slotted([slot="end"]){border-right:none;border-top:none;border-bottom:none}:host .native-input.standard{background-color:var(--wje-input-background-color);font-family:var(--wje-input-font-family);position:relative;border-radius:var(--wje-input-border-radius);padding-inline:0;padding-top:0;padding-bottom:0;transition:background-color .2s ease;cursor:text}:host .native-input.standard.focused input{border-color:var(--wje-input-border-color-focus)!important}:host .native-input.standard input{display:block;min-height:32px;padding-inline:.5rem;padding-top:0;padding-bottom:0;background:none;box-shadow:none;width:100%;box-sizing:border-box;border-radius:var(--wje-input-border-radius);border-width:var(--wje-input-border-width);border-style:var(--wje-input-border-style);border-color:var(--wje-input-border-color)}:host .native-input.standard label{margin:0;display:inline-block;opacity:1;cursor:text;transition:opacity .2s ease;line-height:var(--wje-input-line-height)}:host .native-input.standard .input-wrapper:hover .clear{visibility:visible}:host .native-input.standard ::slotted([slot="start"]){border-right:none;border-radius:var(--wje-input-border-radius) 0 0 var(--wje-input-border-radius)}:host .native-input.standard ::slotted([slot="end"]){border-left:none;border-radius:0 var(--wje-input-border-radius) var(--wje-input-border-radius) 0}:host .native-input.standard.has-start input{border-top-left-radius:0;border-bottom-left-radius:0}:host .native-input.standard.has-end input{border-top-right-radius:0;border-bottom-right-radius:0}:host .native-input.standard .error-message{position:static;background:transparent;padding:.25rem 0;left:auto;transform:none;color:var(--wje-input-color-invalid);font-size:12px;line-height:normal}.clear{visibility:hidden;position:absolute;right:0;top:3px;--wje-padding-top: .25rem;--wje-padding-start: .25rem;--wje-padding-end: .25rem;--wje-padding-bottom: .25rem;--wje-button-margin-inline: 0 .25rem}:host([required]) .input-wrapper:after{color:var(--wje-input-color-invalid);content:"*";font-family:var(--wje-force-mac-font-family);font-size:20px;position:absolute;right:10px;top:2px}:host([required]) .standard .input-wrapper:after{top:0}:host([invalid]) .error-message{display:block}:host([invalid]) .default label{opacity:1!important;color:var(--wje-input-color-invalid)!important;animation-name:shake;animation-duration:.4s;animation-iteration-count:1}::slotted([slot="start"]),::slotted([slot="end"]){display:flex;align-items:center;border-width:var(--wje-input-border-width);border-style:var(--wje-input-border-style);border-color:var(--wje-input-border-color);padding-inline:var(--wje-input-slot-padding-inline)}slot[name=start],slot[name=end]{display:flex}input{background-color:var(--wje-input-background-color);border-width:var(--wje-input-border-width);border-style:var(--wje-input-border-style);border-color:var(--wje-input-border-color);font-family:var(--wje-input-font-family);color:var(--wje-input-color);-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:0;padding:.25rem .5rem;line-height:var(--wje-input-line-height);font-size:14px;font-weight:400;vertical-align:middle;min-height:32px}.error-message{display:none;position:absolute;width:auto;max-width:100%;min-width:auto;border-radius:50px;background:#000;padding:.25rem .5rem;top:0;left:50%;transform:translate(-50%,-50%);color:#fff;font-size:12px;line-height:normal}@keyframes shake{8%,41%{transform:translate(-4px)}25%,58%{transform:translate(4px)}75%{transform:translate(-2px)}92%{transform:translate(2px)}0%,to{transform:translate(0)}}';
6
+ class c extends m {
7
+ /**
8
+ * @constructor
9
+ * @summary InputFile constructor
10
+ * @param {Object} options - The options
11
+ */
12
+ constructor(t = {}) {
13
+ super();
14
+ /**
15
+ * @summary Class name
16
+ * @type {string}
17
+ */
18
+ u(this, "className", "Input");
19
+ this._value = "";
20
+ }
21
+ set value(t) {
22
+ this._value = t;
23
+ }
24
+ get value() {
25
+ return this._value;
26
+ }
27
+ /**
28
+ * @summary Get CSS stylesheet
29
+ * @static
30
+ * @returns {Object} styles
31
+ */
32
+ static get cssStyleSheet() {
33
+ return w;
34
+ }
35
+ /**
36
+ * @summary Get observed attributes
37
+ * @static
38
+ * @returns {Array} An empty array
39
+ */
40
+ static get observedAttributes() {
41
+ return [];
42
+ }
43
+ /**
44
+ * @summary Setup attributes
45
+ */
46
+ setupAttributes() {
47
+ this.isShadowRoot = "open";
48
+ }
49
+ /**
50
+ * @summary Draw method
51
+ * @param {Object} context - The context
52
+ * @param {Object} store - The store
53
+ * @param {Object} params - The parameters
54
+ * @returns {Object} Document fragment
55
+ */
56
+ draw(t, a, s) {
57
+ let n = document.createDocumentFragment(), o = document.createElement("div");
58
+ o.setAttribute("part", "native"), o.classList.add("native-input-file", this.variant || "default");
59
+ let d = document.createElement("input");
60
+ d.setAttribute("type", "file"), d.setAttribute("multiple", ""), d.setAttribute("hidden", "");
61
+ let r = document.createElement("wje-input");
62
+ r.setAttribute("variant", "standard"), r.setAttribute("type", "text"), r.setAttribute("placeholder", "Click to upload"), r.setAttribute("readonly", "");
63
+ let l = document.createElement("span");
64
+ l.setAttribute("slot", "start");
65
+ let p = document.createElement("wje-icon");
66
+ return p.setAttribute("slot", "icon-only"), p.setAttribute("name", "cloud-upload"), l.appendChild(p), r.appendChild(l), o.appendChild(r), o.appendChild(d), n.appendChild(o), this.native = o, this.input = r, this.fileInput = d, n;
67
+ }
68
+ /**
69
+ * @summary After draw method
70
+ */
71
+ afterDraw() {
72
+ this.input.addEventListener("click", () => {
73
+ this.fileInput.click();
74
+ }), this.fileInput.addEventListener("change", (t) => {
75
+ let a = t.target.files, s = [];
76
+ for (let n = 0; n < a.length; n++)
77
+ s.push(a[n].name);
78
+ this.input.value = s.join(", "), this.value = a, v.dispatchCustomEvent(this, "wje-input-file:change", { files: a });
79
+ });
80
+ }
81
+ }
82
+ c.define("wje-input-file", c);
83
+ export {
84
+ c as default
85
+ };