wj-elements 0.1.0 → 0.1.2

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 (49) hide show
  1. package/dist/dark.css +1 -1
  2. package/dist/light.css +1 -1
  3. package/dist/{localize-7fxVJArK.js → localize-DVuO3S17.js} +1 -1
  4. package/dist/{popup.element-BXak-Fgc.js → popup.element-Dj9j__Dh.js} +329 -350
  5. package/dist/styles.css +1 -1
  6. package/dist/wje-accordion-item.js +88 -0
  7. package/dist/wje-accordion.js +79 -0
  8. package/dist/wje-animation.js +10 -11
  9. package/dist/wje-avatar.js +31 -29
  10. package/dist/wje-badge.js +7 -7
  11. package/dist/wje-breadcrumb.js +11 -11
  12. package/dist/wje-button.js +22 -29
  13. package/dist/wje-carousel.js +8 -9
  14. package/dist/wje-checkbox.js +81 -23
  15. package/dist/wje-dialog.js +53 -25
  16. package/dist/wje-dropdown.js +36 -23
  17. package/dist/wje-element.js +100 -89
  18. package/dist/wje-file-upload-item.js +3 -4
  19. package/dist/wje-file-upload.js +40 -43
  20. package/dist/wje-format-digital.js +1 -1
  21. package/dist/wje-icon-picker.js +1 -1
  22. package/dist/wje-icon.js +115 -3
  23. package/dist/wje-img-comparer.js +1 -2
  24. package/dist/wje-infinite-scroll.js +71 -41
  25. package/dist/wje-inline-edit.js +1 -2
  26. package/dist/wje-input-file.js +26 -18
  27. package/dist/wje-input.js +1 -1
  28. package/dist/wje-master.js +323 -168
  29. package/dist/wje-menu-item.js +33 -31
  30. package/dist/wje-menu.js +7 -7
  31. package/dist/wje-option.js +97 -3
  32. package/dist/wje-options.js +1 -1
  33. package/dist/wje-popup.js +1 -1
  34. package/dist/wje-progress-bar.js +5 -5
  35. package/dist/wje-radio-group.js +1 -1
  36. package/dist/wje-radio.js +1 -1
  37. package/dist/wje-relative-time.js +4 -13
  38. package/dist/wje-select.js +9 -10
  39. package/dist/wje-slider.js +40 -79
  40. package/dist/wje-tab.js +9 -9
  41. package/dist/wje-toast.js +16 -16
  42. package/dist/wje-toggle.js +39 -15
  43. package/dist/wje-tooltip.js +47 -23
  44. package/package.json +2 -1
  45. package/dist/custom-elements.json +0 -12216
  46. package/dist/icon.element-DOiXP3pi.js +0 -115
  47. package/dist/option.element-CpeafIM-.js +0 -98
  48. package/dist/styles-4vJ2wdTZ.js +0 -4
  49. package/dist/web-types.json +0 -2756
package/dist/wje-icon.js CHANGED
@@ -1,5 +1,117 @@
1
- import { I as e } from "./icon.element-DOiXP3pi.js";
2
- e.define("wje-icon", e);
1
+ var u = Object.defineProperty;
2
+ var g = (e, t, r) => t in e ? u(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var h = (e, t, r) => (g(e, typeof t != "symbol" ? t + "" : t, r), r);
4
+ import m from "./wje-element.js";
5
+ const n = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
6
+ let a;
7
+ const j = (e) => c(e) && (e = e.trim(), v(e)) ? e : null, v = (e) => e.length > 0 && /(\/|\.)/.test(e), p = (e) => e.startsWith("data:image/svg+xml"), z = (e) => e.indexOf(";utf8,") !== -1, c = (e) => typeof e == "string", b = (e) => {
8
+ const t = document.createElement("div");
9
+ t.innerHTML = e;
10
+ const r = t.firstElementChild;
11
+ return r && r.nodeName.toLowerCase() === "svg" && (r.getAttribute("class"), f(r)) ? t.innerHTML : "";
12
+ }, f = (e) => {
13
+ if (e.nodeType === 1) {
14
+ if (e.nodeName.toLowerCase() === "script")
15
+ return !1;
16
+ for (let t = 0; t < e.attributes.length; t++) {
17
+ const r = e.attributes[t].name;
18
+ if (c(r) && r.toLowerCase().indexOf("on") === 0)
19
+ return !1;
20
+ }
21
+ for (let t = 0; t < e.childNodes.length; t++)
22
+ if (!f(e.childNodes[t]))
23
+ return !1;
24
+ }
25
+ return !0;
26
+ }, y = (e, t) => {
27
+ let r = d.get(e);
28
+ if (!r)
29
+ if (typeof fetch < "u" && typeof document < "u")
30
+ if (p(e) && z(e)) {
31
+ a || (a = new DOMParser());
32
+ const s = a.parseFromString(e, "text/html").querySelector("svg");
33
+ return s && n.set(e, s.outerHTML), Promise.resolve();
34
+ } else
35
+ r = fetch(e).then((o) => {
36
+ if (o.ok)
37
+ return o.text().then((s) => {
38
+ s && t !== !1 && (s = b(s)), n.set(e, s || "");
39
+ });
40
+ n.set(e, "");
41
+ }), d.set(e, r);
42
+ else
43
+ return n.set(e, ""), Promise.resolve();
44
+ return r;
45
+ }, L = (e) => {
46
+ let t = j(e.src);
47
+ return t || (t = x(e.name), t ? S(t, e.hasAttribute("filled")) : null);
48
+ }, x = (e) => !c(e) || e.trim() === "" || e.replace(/[a-z]|-|\d/gi, "") !== "" ? null : e, S = (e, t = !1) => {
49
+ const r = `/assets/img/icons/${t ? "filled" : "outline"}/${e}.svg`;
50
+ let o = new URL(import.meta.url), s = o.pathname, i = s.substring(0, s.lastIndexOf("/"));
51
+ return new URL(o.origin + i + r).href;
52
+ }, C = ":host(.wje-color-primary){--wje-icon-color: var(--wje-color-primary)}:host(.wje-color-complete){--wje-icon-color: var(--wje-color-complete)}:host(.wje-color-success){--wje-icon-color: var(--wje-color-success)}:host(.wje-color-warning){--wje-icon-color: var(--wje-color-warning)}:host(.wje-color-danger){--wje-icon-color: var(--wje-color-danger)}:host(.wje-color-info){--wje-icon-color: var(--wje-color-info)}:host{--wje-icon-size: 1rem;--wje-icon-width: var(--wje-icon-size, 100%);--wje-icon-height: var(--wje-icon-size, 100%);//background: transparent !important;display:inline-block;width:var(--wje-icon-width);height:var(--wje-icon-height);contain:strict;fill:currentColor;box-sizing:content-box!important}.icon-inner,svg{display:block;width:var(--wje-icon-width);height:var(--wje-icon-height)}:host(.wje-size-small){--wje-icon-size: 18px}:host(.wje-size-large){--wje-icon-size: 32px}:host(.wje-size){font-size:var(--wje-icon-size)}:host(.wje-color){color:var(--wje-icon-color)!important}";
53
+ class w extends m {
54
+ /**
55
+ * Creates an instance of IconElement.
56
+ *
57
+ * @constructor
58
+ */
59
+ constructor() {
60
+ super();
61
+ h(this, "className", "Icon");
62
+ }
63
+ /**
64
+ * Returns the CSS styles for the component.
65
+ *
66
+ * @static
67
+ * @returns {CSSStyleSheet}
68
+ */
69
+ static get cssStyleSheet() {
70
+ return C;
71
+ }
72
+ /**
73
+ * Returns the list of attributes to observe for changes.
74
+ *
75
+ * @static
76
+ * @returns {Array<string>}
77
+ */
78
+ static get observedAttributes() {
79
+ return ["name"];
80
+ }
81
+ /**
82
+ * Sets up the attributes for the component.
83
+ */
84
+ setupAttributes() {
85
+ this.isShadowRoot = "open";
86
+ }
87
+ /**
88
+ * Draws the component.
89
+ *
90
+ * @param {Object} context - The context for drawing.
91
+ * @param {Object} store - The store for drawing.
92
+ * @param {Object} params - The parameters for drawing.
93
+ * @returns {DocumentFragment}
94
+ */
95
+ draw(r, o, s) {
96
+ let i = document.createDocumentFragment();
97
+ return this.classList.add("lazy-loaded-image", "lazy"), this.element = document.createElement("div"), this.element.classList.add("icon-inner"), this.url = L(this), this.classList.add("wje-size"), this.color && this.classList.add("wje-color-" + this.color, "wje-color"), this.size && this.classList.add("wje-size-" + this.size), i.appendChild(this.element), i;
98
+ }
99
+ /**
100
+ * Called after the component has been drawn.
101
+ */
102
+ afterDraw() {
103
+ let r = new IntersectionObserver((o, s) => {
104
+ o.forEach((i) => {
105
+ i.isIntersecting && (y(this.url).then((E) => {
106
+ var l;
107
+ this.element.innerHTML = n == null ? void 0 : n.get(this.url), (l = this.element.querySelector("svg")) == null || l.setAttribute("part", "svg");
108
+ }), this.classList.remove("lazy"), r.unobserve(i.target));
109
+ });
110
+ });
111
+ r.observe(this.element);
112
+ }
113
+ }
114
+ w.define("wje-icon", w);
3
115
  export {
4
- e as default
116
+ w as default
5
117
  };
@@ -2,8 +2,7 @@ var u = Object.defineProperty;
2
2
  var f = (i, e, t) => e in i ? u(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
3
  var l = (i, e, t) => (f(i, typeof e != "symbol" ? e + "" : e, t), t);
4
4
  import h from "./wje-element.js";
5
- import "./wje-icon.js";
6
- import { I as g } from "./icon.element-DOiXP3pi.js";
5
+ import g from "./wje-icon.js";
7
6
  function j(i, e) {
8
7
  function t(o) {
9
8
  const d = i.getBoundingClientRect(), r = i.ownerDocument.defaultView, n = d.left + r.pageXOffset, m = d.top + r.pageYOffset, c = o.pageX - n, p = o.pageY - m;
@@ -1,9 +1,9 @@
1
- var g = Object.defineProperty;
2
- var m = (l, r, t) => r in l ? g(l, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[r] = t;
3
- var h = (l, r, t) => (m(l, typeof r != "symbol" ? r + "" : r, t), t);
4
- import p, { event as f } from "./wje-element.js";
5
- const w = ":host{--wje-infinite-scroll-width: 100%;--wje-infinite-scroll-height: 300px;overflow-x:auto;width:var(--wje-infinite-scroll-width);height:var(--wje-infinite-scroll-height);display:block}";
6
- class u extends p {
1
+ var u = Object.defineProperty;
2
+ var p = (o, r, t) => r in o ? u(o, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[r] = t;
3
+ var h = (o, r, t) => (p(o, typeof r != "symbol" ? r + "" : r, t), t);
4
+ import f, { WjElementUtils as w, event as d } from "./wje-element.js";
5
+ const y = ":host{--wje-infinite-scroll-width: 100%;--wje-infinite-scroll-height: 300px;--wje-infinite-scroll-loading-bg: rgba(0, 0, 0, 0);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 g extends f {
7
7
  /**
8
8
  * Creates an instance of InfiniteScroll.
9
9
  *
@@ -31,21 +31,39 @@ class u extends p {
31
31
  * @param {Event} e - The event.
32
32
  */
33
33
  h(this, "onScroll", (t) => {
34
- const { scrollTop: s, scrollHeight: e, clientHeight: i } = t.target;
35
- s + i >= e - 300 && this.currentPage <= this.totalPages && this.isLoading.includes(this.currentPage) && (this.currentPage++, this.loadPages(this.currentPage));
34
+ const { scrollTop: e, scrollHeight: i, clientHeight: s } = t.target;
35
+ e + s >= i - 300 && this.currentPage <= this.totalPages && this.isLoading.includes(this.currentPage) && (this.currentPage++, this.loadPages(this.currentPage));
36
36
  });
37
- this.totalPages = 0, this.isLoading = [], String.prototype.interpolate = function(s) {
38
- let e = this, i = e.match(/\{{.*?\}}/g);
39
- if (i)
40
- for (let a of i) {
41
- let o = a.replace("{{", "").replace("}}", ""), n = "";
42
- o.split(".").forEach((c) => {
43
- n = n == "" ? s[c] : n[c];
44
- }), e = e.replace(a, n);
37
+ this.totalPages = 0, this.isLoading = [], this._response = {}, this.iterate = null, this._infiniteScrollTemplate = null, String.prototype.interpolate = function(e) {
38
+ let i = this, s = i.match(/\{{.*?\}}/g);
39
+ if (s)
40
+ for (let n of s) {
41
+ let c = n.replace("{{", "").replace("}}", ""), a = "";
42
+ c.split(".").forEach((l) => {
43
+ a = a == "" ? e[l] : a[l];
44
+ }), i = i.replace(n, a);
45
45
  }
46
- return e;
46
+ return i;
47
47
  };
48
48
  }
49
+ set infiniteScrollTemplate(t) {
50
+ this._infiniteScrollTemplate = t;
51
+ }
52
+ get infiniteScrollTemplate() {
53
+ return this._infiniteScrollTemplate;
54
+ }
55
+ set response(t) {
56
+ this._response = t;
57
+ }
58
+ get response() {
59
+ return this._response;
60
+ }
61
+ set objectName(t) {
62
+ this.setAttribute("object-name", t);
63
+ }
64
+ get objectName() {
65
+ return this.getAttribute("object-name") || "data";
66
+ }
49
67
  /**
50
68
  * Returns the CSS styles for the component.
51
69
  *
@@ -53,7 +71,7 @@ class u extends p {
53
71
  * @returns {CSSStyleSheet}
54
72
  */
55
73
  static get cssStyleSheet() {
56
- return w;
74
+ return y;
57
75
  }
58
76
  /**
59
77
  * Returns the list of attributes to observe for changes.
@@ -77,8 +95,9 @@ class u extends p {
77
95
  * @param {Object} store - The store for drawing.
78
96
  * @param {Object} params - The parameters for drawing.
79
97
  */
80
- beforeDraw(t, s, e) {
81
- this.iterate = this.querySelector("[iterate]"), this.infiniteScrollTemplate = this.iterate.outerHTML, this.iterate.remove(), this.setAttribute("style", "height: " + this.height);
98
+ beforeDraw(t, e, i) {
99
+ var s, n;
100
+ this.iterate = this.querySelector("[iterate]"), this.infiniteScrollTemplate = (s = this.iterate) == null ? void 0 : s.outerHTML, (n = this.iterate) == null || n.remove(), this.setAttribute("style", "height: " + this.height);
82
101
  }
83
102
  /**
84
103
  * Draws the component.
@@ -88,9 +107,17 @@ class u extends p {
88
107
  * @param {Object} params - The parameters for drawing.
89
108
  * @returns {DocumentFragment}
90
109
  */
91
- draw(t, s, e) {
92
- let i = document.createDocumentFragment(), a = document.createElement("slot"), o = document.createElement("div");
93
- return o.classList.add("loader"), i.appendChild(o), i.appendChild(a), this.loaderEl = o, i;
110
+ draw(t, e, i) {
111
+ let s = document.createDocumentFragment(), n = document.createElement("div");
112
+ n.classList.add("native"), n.setAttribute("part", "native-infinite-scroll");
113
+ let c = document.createElement("slot"), a = document.createElement("slot");
114
+ if (a.setAttribute("name", "ending"), w.hasSlot(this, "loader")) {
115
+ let l = document.createElement("div");
116
+ l.classList.add("loading");
117
+ let m = document.createElement("slot");
118
+ m.setAttribute("name", "loader"), l.appendChild(m), this.loadingEl = l, s.appendChild(l);
119
+ }
120
+ return n.appendChild(c), n.appendChild(a), s.appendChild(n), this.endingEl = a, s;
94
121
  }
95
122
  /**
96
123
  * Called after the component has been drawn.
@@ -105,23 +132,25 @@ class u extends p {
105
132
  * @returns {Promise<Object>} The response from the server.
106
133
  */
107
134
  async getPages(t) {
108
- let s = this.url.includes("?");
109
- const e = await fetch(`${this.url}${s ? "&" : "?"}page=${t}&size=${this.size}${this == null ? void 0 : this.queryParams}`);
110
- if (!e.ok)
111
- throw new Error(`An error occurred: ${e.status}`);
112
- return await e.json();
135
+ let e = this.url.includes("?");
136
+ const i = await fetch(`${this.url}${e ? "&" : "?"}page=${t}&size=${this.size}${this == null ? void 0 : this.queryParams}`);
137
+ if (!i.ok)
138
+ throw new Error(`An error occurred: ${i.status}`);
139
+ return await i.json();
113
140
  }
114
141
  /**
115
142
  * Hides the loader.
116
143
  */
117
144
  hideLoader() {
118
- this.loaderEl.classList.remove("show");
145
+ var t;
146
+ (t = this == null ? void 0 : this.loadingEl) == null || t.classList.remove("show");
119
147
  }
120
148
  /**
121
149
  * Shows the loader.
122
150
  */
123
151
  showLoader() {
124
- this.loaderEl.classList.add("show");
152
+ var t;
153
+ (t = this == null ? void 0 : this.loadingEl) == null || t.classList.add("show");
125
154
  }
126
155
  /**
127
156
  * Checks if there are more pages to load.
@@ -130,7 +159,7 @@ class u extends p {
130
159
  * @returns {boolean} Whether there are more pages to load.
131
160
  */
132
161
  hasMorePages(t) {
133
- return this.totalPages === 0 || t <= this.totalPages;
162
+ return this.totalPages === 0 || t < this.totalPages;
134
163
  }
135
164
  /**
136
165
  * Loads the pages.
@@ -141,23 +170,24 @@ class u extends p {
141
170
  this.showLoader();
142
171
  try {
143
172
  if (this.hasMorePages(t) || typeof this.setCustomData == "function") {
144
- let s, e;
173
+ let e;
145
174
  typeof this.setCustomData == "function" ? e = await this.setCustomData(t) : e = await this.getPages(t), this.totalPages = e.totalPages, this.currentPage = t;
146
175
  const i = new DOMParser();
147
- let a = this;
148
- this.hasAttribute("placement") && (a = this.querySelector(this.placement)), e.data.forEach((o) => {
149
- const n = this.infiniteScrollTemplate.interpolate(o), d = i.parseFromString(n, "text/html").querySelector(this.iterate.tagName.toLowerCase());
150
- f.addListener(d, "click", "wje-infinite-scroll:click-item", null, { stopPropagation: !0 }), a.insertAdjacentElement("beforeend", d);
176
+ let s = this;
177
+ this.hasAttribute("placement") && (s = this.querySelector(this.placement)), d.dispatchCustomEvent(this, "wje-infinite-scroll:load", e), this.response = e, e[this.objectName].forEach((n) => {
178
+ const c = this.infiniteScrollTemplate.interpolate(n), l = i.parseFromString(c, "text/html").activeElement.firstElementChild;
179
+ d.addListener(l, "click", "wje-infinite-scroll:click-item", null), s.insertAdjacentElement("beforeend", l);
151
180
  }), this.isLoading.push(t);
152
- }
153
- } catch (s) {
154
- console.log(s.message);
181
+ } else
182
+ d.dispatchCustomEvent(this, "wje-infinite-scroll:complete"), this.endingEl.classList.add("show");
183
+ } catch (e) {
184
+ console.log(e.message);
155
185
  } finally {
156
186
  this.hideLoader();
157
187
  }
158
188
  }
159
189
  }
160
- u.define("wje-infinite-scroll", u);
190
+ g.define("wje-infinite-scroll", g);
161
191
  export {
162
- u as default
192
+ g as default
163
193
  };
@@ -51,9 +51,8 @@ class o extends l {
51
51
  this.isShadowRoot = "open";
52
52
  }
53
53
  draw(t, e, d) {
54
- console.log("Draw", this.notEditable, !this.notEditable);
55
54
  let i = document.createDocumentFragment();
56
- return this.heading = document.createElement("div"), this.heading.classList.add("heading"), this.h5 = document.createElement("h5"), this.h5.innerHTML = this.title, this.heading.appendChild(this.h5), i.appendChild(this.heading), this.notEditable || (console.log("VOJDEM TU"), this.span = document.createElement("span"), this.span.classList.add("edit", "text-primary"), this.span.innerHTML = "Upraviť", this.form = document.createElement("form"), this.form.classList.add("fade-out"), this.input = this.inputElement(), this.buttons = document.createElement("div"), this.buttons.classList.add("buttons", "btn-group"), this.buttonSave = document.createElement("button"), this.buttonSave.classList.add("btn", "btn-primary"), this.buttonSave.setAttribute("type", "button"), this.buttonSave.innerHTML = '<i class="fa-light fa-check"></i>', this.buttonClose = document.createElement("button"), this.buttonClose.classList.add("btn", "btn-default", "btn-close"), this.buttonClose.setAttribute("type", "button"), this.buttonClose.innerHTML = '<i class="fa-light fa-xmark"></i>', this.heading.appendChild(this.span), this.buttons.appendChild(this.buttonSave), this.buttons.appendChild(this.buttonClose), this.form.appendChild(this.input), this.form.appendChild(this.buttons), i.appendChild(this.form)), i;
55
+ return this.heading = document.createElement("div"), this.heading.classList.add("heading"), this.h5 = document.createElement("h5"), this.h5.innerHTML = this.title, this.heading.appendChild(this.h5), i.appendChild(this.heading), this.notEditable || (this.span = document.createElement("span"), this.span.classList.add("edit", "text-primary"), this.span.innerHTML = "Upraviť", this.form = document.createElement("form"), this.form.classList.add("fade-out"), this.input = this.inputElement(), this.buttons = document.createElement("div"), this.buttons.classList.add("buttons", "btn-group"), this.buttonSave = document.createElement("button"), this.buttonSave.classList.add("btn", "btn-primary"), this.buttonSave.setAttribute("type", "button"), this.buttonSave.innerHTML = '<i class="fa-light fa-check"></i>', this.buttonClose = document.createElement("button"), this.buttonClose.classList.add("btn", "btn-default", "btn-close"), this.buttonClose.setAttribute("type", "button"), this.buttonClose.innerHTML = '<i class="fa-light fa-xmark"></i>', this.heading.appendChild(this.span), this.buttons.appendChild(this.buttonSave), this.buttons.appendChild(this.buttonClose), this.form.appendChild(this.input), this.form.appendChild(this.buttons), i.appendChild(this.form)), i;
57
56
  }
58
57
  afterDraw(t, e, d) {
59
58
  this.notEditable || (this.heading.addEventListener("click", (i) => {
@@ -1,9 +1,9 @@
1
- var c = Object.defineProperty;
2
- var h = (i, e, t) => e in i ? c(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
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
3
  var u = (i, e, t) => (h(i, typeof e != "symbol" ? e + "" : e, t), t);
4
- import m from "./wje-element.js";
4
+ import m, { event as v } from "./wje-element.js";
5
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 b extends m {
6
+ class c extends m {
7
7
  /**
8
8
  * @constructor
9
9
  * @summary InputFile constructor
@@ -16,6 +16,13 @@ class b extends m {
16
16
  * @type {string}
17
17
  */
18
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;
19
26
  }
20
27
  /**
21
28
  * @summary Get CSS stylesheet
@@ -46,17 +53,17 @@ class b extends m {
46
53
  * @param {Object} params - The parameters
47
54
  * @returns {Object} Document fragment
48
55
  */
49
- draw(t, d, s) {
50
- let o = document.createDocumentFragment(), n = document.createElement("div");
51
- n.setAttribute("part", "native"), n.classList.add("native-input-file", this.variant || "default");
52
- let a = document.createElement("input");
53
- a.setAttribute("type", "file"), a.setAttribute("multiple", ""), a.setAttribute("hidden", "");
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", "");
54
61
  let r = document.createElement("wje-input");
55
62
  r.setAttribute("variant", "standard"), r.setAttribute("type", "text"), r.setAttribute("placeholder", "Click to upload"), r.setAttribute("readonly", "");
56
- let p = document.createElement("span");
57
- p.setAttribute("slot", "start");
58
- let l = document.createElement("wje-icon");
59
- return l.setAttribute("slot", "icon-only"), l.setAttribute("name", "cloud-upload"), p.appendChild(l), r.appendChild(p), n.appendChild(r), n.appendChild(a), o.appendChild(n), this.native = n, this.input = r, this.fileInput = a, o;
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;
60
67
  }
61
68
  /**
62
69
  * @summary After draw method
@@ -65,13 +72,14 @@ class b extends m {
65
72
  this.input.addEventListener("click", () => {
66
73
  this.fileInput.click();
67
74
  }), this.fileInput.addEventListener("change", (t) => {
68
- for (var d = t.target.files, s = [], o = 0; o < d.length; o++)
69
- s.push(d[o].name);
70
- this.input.value = s.join(", ");
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 });
71
79
  });
72
80
  }
73
81
  }
74
- b.define("wje-input-file", b);
82
+ c.define("wje-input-file", c);
75
83
  export {
76
- b as default
84
+ c as default
77
85
  };
package/dist/wje-input.js CHANGED
@@ -194,7 +194,7 @@ class m extends x {
194
194
  });
195
195
  }), this.addEventListener("invalid", (t) => {
196
196
  this.invalid = !0, this.pristine = !1, this.errorMessage.textContent = this.internals.validationMessage, this.customErrorDisplay && t.preventDefault();
197
- }), this.addEventListener("focus", () => this.input.focus()), this.clear && this.clear.addEventListener("wje:button-click", (t) => {
197
+ }), this.addEventListener("focus", () => this.input.focus()), this.clear && this.clear.addEventListener("wje-button:click", (t) => {
198
198
  this.input.value = "", w.dispatchCustomEvent(this.clear, "wje-input:clear");
199
199
  });
200
200
  }