wj-elements 0.1.54 → 0.1.55

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.
@@ -1,8 +1,8 @@
1
- var u = Object.defineProperty;
2
- var d = (r, s, t) => s in r ? u(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
3
- var i = (r, s, t) => (d(r, typeof s != "symbol" ? s + "" : s, t), t);
1
+ var d = Object.defineProperty;
2
+ var u = (r, s, t) => s in r ? d(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
3
+ var o = (r, s, t) => (u(r, typeof s != "symbol" ? s + "" : s, t), t);
4
4
  import m, { event as e } from "./wje-element.js";
5
- import { P as g } from "./popup.element-CWsSOxs2.js";
5
+ import { P as w } from "./popup.element-CWsSOxs2.js";
6
6
  class h extends m {
7
7
  /**
8
8
  * Creates an instance of Dropdown.
@@ -11,16 +11,16 @@ class h extends m {
11
11
  * */
12
12
  constructor() {
13
13
  super();
14
- i(this, "depandencies", {
15
- "wje-popup": g
14
+ o(this, "depandencies", {
15
+ "wje-popup": w
16
16
  });
17
- i(this, "className", "Dropdown");
17
+ o(this, "className", "Dropdown");
18
18
  /**
19
19
  * Callback function to handle other dropdowns being opened. Close the dropdown if it is not the target and collapse is enabled.
20
20
  *
21
21
  * @param {Event} e - The event object.
22
22
  */
23
- i(this, "otherDropdownOpennedCallback", (t) => {
23
+ o(this, "otherDropdownOpennedCallback", (t) => {
24
24
  t.detail.detail.target !== this && (this.classList.remove("active"), this.popup.hide());
25
25
  });
26
26
  /**
@@ -30,14 +30,14 @@ class h extends m {
30
30
  *
31
31
  * @param {Event} e - The event object.
32
32
  */
33
- i(this, "toggleCallback", (t) => {
33
+ o(this, "toggleCallback", (t) => {
34
34
  this.classList.contains("active") ? this.onClose(t) : this.onOpen(t);
35
35
  });
36
36
  /**
37
37
  * @summary Open the popup
38
38
  * @param e
39
39
  */
40
- i(this, "onOpen", async (t) => {
40
+ o(this, "onOpen", async (t) => {
41
41
  t.stopPropagation(), this.classList.add("active"), Promise.resolve(this.beforeShow(this)).then((l) => {
42
42
  if (!this.classList.contains("active"))
43
43
  throw new Error(
@@ -55,15 +55,12 @@ class h extends m {
55
55
  * @summary Close the popup
56
56
  * @param e
57
57
  */
58
- i(this, "onClose", async (t) => {
58
+ o(this, "onClose", async (t) => {
59
59
  t.stopPropagation(), this.classList.remove("active"), this.popup.hide(), e.dispatchCustomEvent(this, "wje-dropdown:close", {
60
60
  bubbles: !0,
61
61
  detail: { target: this }
62
62
  });
63
63
  });
64
- i(this, "myFunction", (t) => {
65
- console.log("myFunction", t);
66
- });
67
64
  }
68
65
  set trigger(t) {
69
66
  this.setAttribute("trigger", t);
@@ -77,7 +74,7 @@ class h extends m {
77
74
  setupAttributes() {
78
75
  this.isShadowRoot = "open";
79
76
  }
80
- draw(t, l, w) {
77
+ draw(t, l, g) {
81
78
  let c = document.createDocumentFragment();
82
79
  this.classList.add(
83
80
  "wje-placement",
@@ -87,8 +84,8 @@ class h extends m {
87
84
  n.setAttribute("part", "native"), n.classList.add("native-dropdown"), document.createElement("wje-tooltip").setAttribute("content", this.tooltip);
88
85
  let a = document.createElement("slot");
89
86
  a.setAttribute("name", "trigger"), a.setAttribute("slot", "anchor");
90
- let p = document.createElement("slot"), o = document.createElement("wje-popup");
91
- return o.setAttribute("placement", this.placement), o.setAttribute("offset", this.offset), o.appendChild(a), o.appendChild(p), o.setAttribute("manual", ""), n.appendChild(o), c.appendChild(n), this.popup = o, this.anchorSlot = a, c;
87
+ let p = document.createElement("slot"), i = document.createElement("wje-popup");
88
+ return i.setAttribute("placement", this.placement), i.setAttribute("offset", this.offset), i.appendChild(a), i.appendChild(p), i.setAttribute("manual", ""), n.appendChild(i), c.appendChild(n), this.popup = i, this.anchorSlot = a, c;
92
89
  }
93
90
  afterDisconnect() {
94
91
  e.removeListener(this, "mouseenter", null, this.onOpen), e.removeListener(this, "mouseleave", null, this.onClose), e.removeListener(this.anchorSlot, "click", null, this.toggleCallback, { capture: !0 });
@@ -93,7 +93,32 @@ import { default as Qr } from "./wje-tooltip.js";
93
93
  import { default as Kr } from "./wje-visually-hidden.js";
94
94
  import { default as Zr } from "./wje-sliding-container.js";
95
95
  import { P as ea } from "./popup.element-CWsSOxs2.js";
96
- const A = {
96
+ function A(o, l) {
97
+ let e;
98
+ if (typeof o == "string")
99
+ e = new Date(o);
100
+ else if (typeof o == "number")
101
+ e = new Date(o);
102
+ else if (o instanceof Date)
103
+ e = o;
104
+ else
105
+ throw new Error("Invalid date input");
106
+ const r = {
107
+ yyyy: e.getFullYear(),
108
+ MM: String(e.getMonth() + 1).padStart(2, "0"),
109
+ // Mesiace sú indexované od 0
110
+ dd: String(e.getDate()).padStart(2, "0"),
111
+ HH: String(e.getHours()).padStart(2, "0"),
112
+ mm: String(e.getMinutes()).padStart(2, "0"),
113
+ ss: String(e.getSeconds()).padStart(2, "0"),
114
+ MMMM: e.toLocaleString("en-US", { month: "long" }),
115
+ // Full month name
116
+ MMM: e.toLocaleString("en-US", { month: "short" })
117
+ // Short month name
118
+ };
119
+ return l.replace(/yyyy|MM|dd|HH|mm|ss|MMMM|MMM/g, (s) => r[s]);
120
+ }
121
+ const E = {
97
122
  code: "sk",
98
123
  name: "Slovak",
99
124
  dir: "ltr",
@@ -102,8 +127,8 @@ const A = {
102
127
  "wj.file.upload.uploaded": "Nahraných: ",
103
128
  "wj.file.upload.from": "z"
104
129
  };
105
- j.registerTranslation(A);
106
- const E = {
130
+ j.registerTranslation(E);
131
+ const L = {
107
132
  code: "en",
108
133
  name: "English",
109
134
  dir: "ltr",
@@ -112,15 +137,15 @@ const E = {
112
137
  "wj.file.upload.uploaded": "Uploaded: ",
113
138
  "wj.file.upload.from": "from"
114
139
  };
115
- j.registerTranslation(E);
116
- const L = "";
140
+ j.registerTranslation(L);
141
+ const M = "";
117
142
  class v extends g {
118
143
  constructor() {
119
144
  super();
120
145
  f(this, "className", "Step");
121
146
  }
122
147
  static get cssStyleSheet() {
123
- return L;
148
+ return M;
124
149
  }
125
150
  setupAttributes() {
126
151
  this.isShadowRoot = "open";
@@ -132,7 +157,7 @@ class v extends g {
132
157
  }
133
158
  }
134
159
  v.define("wje-step", v);
135
- const M = ".stepper-container{display:flex;flex-direction:column}.step-headers{display:flex;justify-content:space-between;margin-bottom:var(--wje-spacing-medium)}.step-header{display:flex;padding:var(--wje-spacing-medium);gap:var(--wje-spacing-x-small);color:var(--wje-color-contrast-5);flex-grow:1;text-align:center}.pointer{cursor:pointer}.active{color:var(--wje-color-contrast-11)}.steps-content{margin-bottom:var(--wje-spacing-medium)}.arrow-icon{margin-top:var(--wje-stepper-margin)}.step{padding:var(--wje-spacing-medium);text-align:center}.done{color:var(--wje-color-contrast-11)}.nav-buttons{display:flex;justify-content:space-between}";
160
+ const R = ".stepper-container{display:flex;flex-direction:column}.step-headers{display:flex;justify-content:space-between;margin-bottom:var(--wje-spacing-medium)}.step-header{display:flex;padding:var(--wje-spacing-medium);gap:var(--wje-spacing-x-small);color:var(--wje-color-contrast-5);flex-grow:1;text-align:center}.pointer{cursor:pointer}.active{color:var(--wje-color-contrast-11)}.steps-content{margin-bottom:var(--wje-spacing-medium)}.arrow-icon{margin-top:var(--wje-stepper-margin)}.step{padding:var(--wje-spacing-medium);text-align:center}.done{color:var(--wje-color-contrast-11)}.nav-buttons{display:flex;justify-content:space-between}";
136
161
  class w extends g {
137
162
  constructor() {
138
163
  super();
@@ -140,7 +165,7 @@ class w extends g {
140
165
  this.currentStep = 0, this.completedSteps = [];
141
166
  }
142
167
  static get cssStyleSheet() {
143
- return M;
168
+ return R;
144
169
  }
145
170
  setupAttributes() {
146
171
  this.isShadowRoot = "open";
@@ -204,7 +229,7 @@ class w extends g {
204
229
  }
205
230
  }
206
231
  w.define("wje-stepper", w);
207
- const R = ".native-timeline{position:relative}.vertical-line{position:absolute;margin-left:calc(var(--wje-spacing-x-large) + 1px);top:0;bottom:0;width:1px;background-color:var(--wje-color-info-3)}";
232
+ const T = ".native-timeline{position:relative}.vertical-line{position:absolute;margin-left:calc(var(--wje-spacing-x-large) + 1px);top:0;bottom:0;width:1px;background-color:var(--wje-color-info-3)}";
208
233
  class b extends g {
209
234
  constructor() {
210
235
  super();
@@ -222,7 +247,7 @@ class b extends g {
222
247
  * @returns {CSSStyleSheet}
223
248
  */
224
249
  static get cssStyleSheet() {
225
- return R;
250
+ return T;
226
251
  }
227
252
  /**
228
253
  * Sets up the attributes for the component.
@@ -249,31 +274,6 @@ class b extends g {
249
274
  }
250
275
  }
251
276
  b.define("wje-timeline", b);
252
- function T(o, l) {
253
- let e;
254
- if (typeof o == "string")
255
- e = new Date(o);
256
- else if (typeof o == "number")
257
- e = new Date(o);
258
- else if (o instanceof Date)
259
- e = o;
260
- else
261
- throw new Error("Invalid date input");
262
- const r = {
263
- yyyy: e.getFullYear(),
264
- MM: String(e.getMonth() + 1).padStart(2, "0"),
265
- // Mesiace sú indexované od 0
266
- dd: String(e.getDate()).padStart(2, "0"),
267
- HH: String(e.getHours()).padStart(2, "0"),
268
- mm: String(e.getMinutes()).padStart(2, "0"),
269
- ss: String(e.getSeconds()).padStart(2, "0"),
270
- MMMM: e.toLocaleString("en-US", { month: "long" }),
271
- // Full month name
272
- MMM: e.toLocaleString("en-US", { month: "short" })
273
- // Short month name
274
- };
275
- return l.replace(/yyyy|MM|dd|HH|mm|ss|MMMM|MMM/g, (s) => r[s]);
276
- }
277
277
  const k = ":host{--wje-card-content-padding: var(--wje-spacing-medium);margin-bottom:.5rem;display:block}.native-timeline-item>wje-icon{color:var(--wje-color-contrast-5)!important}.timeline-items{display:flex;flex-direction:column}.native-timeline-item{display:flex;position:relative;padding:var(--wje-spacing-medium) var(--wje-spacing-medium) var(--wje-spacing-medium) var(--wje-spacing-large);gap:var(--wje-spacing-medium);border-width:1px;border-style:solid;border-color:transparent;border-radius:var(--wje-border-radius-large)}:host .native-timeline-item:hover{background-color:var(--wje-color-contrast-1);border-color:var(--wje-color-contrast-3)}:host([active]) .native-timeline-item{background-color:var(--wje-color-primary-1);border-color:var(--wje-color-primary-3)}:host([active]) .native-timeline-item:hover{background-color:var(--wje-color-primary-2)}.icon-container{position:absolute;display:flex;width:var(--wje-size-small);height:var(--wje-size-small);padding:var(--wje-spacing-2x-small);border-radius:var(--wje-border-radius-circle);opacity:0}.content-container{height:fit-content;gap:var(--wje-spacing-small)}.event{margin:0;font-size:var(--wje-font-size-large);font-weight:var(--wje-font-weight-bold);line-height:var(--wje-line-height-dense);letter-spacing:var(--wje-spacing-4x-small)}.additional-content{font-size:var(--wje-font-size-medium);margin-top:1rem}wje-status{position:relative;z-index:1}wje-relative-time{display:block;margin-bottom:var(--wje-spacing-2x-small)}";
278
278
  class S extends g {
279
279
  constructor() {
@@ -314,7 +314,7 @@ class S extends g {
314
314
  let i = document.createElement("div");
315
315
  i.classList.add("content-container");
316
316
  let d = document.createElement("wje-tooltip");
317
- d.setAttribute("text", this.getAttribute("tooltip") || ""), d.setAttribute("position", "top"), d.setAttribute("content", T(this.datetime, "dd.MM.yyyy HH:mm"));
317
+ d.setAttribute("text", this.getAttribute("tooltip") || ""), d.setAttribute("position", "top"), d.setAttribute("content", A(this.datetime, "dd.MM.yyyy HH:mm"));
318
318
  let p = document.createElement("wje-relative-time");
319
319
  p.setAttribute("date", this.datetime || ""), p.setAttribute("format", this.getAttribute("format") || ""), d.appendChild(p);
320
320
  let c = document.createElement("h3");
@@ -420,6 +420,7 @@ export {
420
420
  P as defaultStoreActions,
421
421
  q as event,
422
422
  W as fetchAndParseCSS,
423
+ A as formatDate,
423
424
  O as store,
424
425
  V as withRouterLinks
425
426
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wj-elements",
3
3
  "description": "WebJET Elements is a modern set of user interface tools harnessing the power of web components designed to simplify web application development.",
4
- "version": "0.1.54",
4
+ "version": "0.1.55",
5
5
  "homepage": "https://github.com/lencys/wj-elements",
6
6
  "author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
7
7
  "license": "MIT",
@@ -1,4 +0,0 @@
1
- import { default as o } from "./wje-orgchart-item.js";
2
- export {
3
- o as default
4
- };