wj-elements 0.1.128 → 0.1.129

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 (94) hide show
  1. package/dist/dark.css +6 -1
  2. package/dist/{infinite-scroll.element-DcO1E5Es.js → infinite-scroll.element-R3y_ZQj6.js} +42 -14
  3. package/dist/light.css +5 -0
  4. package/dist/{list.element-TZXMx1rt.js → list.element-syl98NWS.js} +4 -1
  5. package/dist/localize.js +4 -3
  6. package/dist/{popup.element-l8v-dMoK.js → popup.element-C0a1z1y2.js} +191 -78
  7. package/dist/wje-accordion-item.js +1 -1
  8. package/dist/wje-animation.js +141 -13
  9. package/dist/wje-aside.js +1 -1
  10. package/dist/wje-avatar.js +5 -5
  11. package/dist/wje-badge.js +1 -1
  12. package/dist/wje-breadcrumb.js +16 -6
  13. package/dist/wje-breadcrumbs.js +4 -4
  14. package/dist/wje-button-group.js +2 -2
  15. package/dist/wje-button.js +64 -6
  16. package/dist/wje-card-content.js +1 -1
  17. package/dist/wje-card-controls.js +1 -1
  18. package/dist/wje-card-header.js +1 -1
  19. package/dist/wje-card-subtitle.js +1 -1
  20. package/dist/wje-card-title.js +1 -1
  21. package/dist/wje-carousel-item.js +1 -1
  22. package/dist/wje-carousel.js +1 -1
  23. package/dist/wje-checkbox.js +14 -11
  24. package/dist/wje-chip.js +1 -1
  25. package/dist/wje-col.js +9 -3
  26. package/dist/wje-color-picker.js +72 -42
  27. package/dist/wje-container.js +1 -1
  28. package/dist/wje-copy-button.js +3 -3
  29. package/dist/wje-dialog.js +89 -0
  30. package/dist/wje-divider.js +1 -1
  31. package/dist/wje-dropdown.js +21 -6
  32. package/dist/wje-element.js +284 -127
  33. package/dist/wje-fetchAndParseCSS.js +2 -1
  34. package/dist/wje-file-upload-item.js +5 -2
  35. package/dist/wje-file-upload.js +57 -13
  36. package/dist/wje-footer.js +1 -1
  37. package/dist/wje-form.js +1 -1
  38. package/dist/wje-format-digital.js +1 -1
  39. package/dist/wje-grid.js +1 -1
  40. package/dist/wje-header.js +1 -1
  41. package/dist/wje-icon-picker.js +6 -3
  42. package/dist/wje-icon.js +4 -1
  43. package/dist/wje-img-comparer.js +1 -3
  44. package/dist/wje-img.js +5 -2
  45. package/dist/wje-infinite-scroll.js +1 -1
  46. package/dist/wje-input-file.js +4 -1
  47. package/dist/wje-input.js +9 -4
  48. package/dist/wje-item.js +34 -3
  49. package/dist/wje-kanban.js +16 -31
  50. package/dist/wje-label.js +1 -10
  51. package/dist/wje-list.js +1 -1
  52. package/dist/wje-main.js +1 -1
  53. package/dist/wje-masonry.js +9 -9
  54. package/dist/wje-master.js +9 -117
  55. package/dist/wje-menu-button.js +4 -1
  56. package/dist/wje-menu-item.js +13 -4
  57. package/dist/wje-menu-label.js +1 -1
  58. package/dist/wje-menu.js +4 -1
  59. package/dist/wje-option.js +8 -4
  60. package/dist/wje-options.js +25 -11
  61. package/dist/wje-orgchart-group.js +2 -2
  62. package/dist/wje-orgchart-item.js +7 -4
  63. package/dist/wje-orgchart.js +1 -1
  64. package/dist/wje-popup.js +1 -1
  65. package/dist/wje-progress-bar.js +6 -2
  66. package/dist/wje-qr-code.js +2 -2
  67. package/dist/wje-radio-group.js +4 -1
  68. package/dist/wje-radio.js +1 -1
  69. package/dist/wje-rate.js +6 -3
  70. package/dist/wje-relative-time.js +37 -19
  71. package/dist/wje-reorder.js +73 -10
  72. package/dist/wje-route.js +1 -1
  73. package/dist/wje-router-link.js +1 -2
  74. package/dist/wje-routerx.js +3 -1
  75. package/dist/wje-row.js +1 -11
  76. package/dist/wje-select.js +15 -12
  77. package/dist/wje-slider.js +7 -4
  78. package/dist/wje-sliding-container.js +125 -49
  79. package/dist/wje-split-view.js +10 -2
  80. package/dist/wje-status.js +1 -1
  81. package/dist/wje-stepper.js +879 -766
  82. package/dist/wje-store.js +17 -18
  83. package/dist/wje-tab-group.js +4 -1
  84. package/dist/wje-tab-panel.js +1 -1
  85. package/dist/wje-tab.js +4 -1
  86. package/dist/wje-textarea.js +8 -2
  87. package/dist/wje-thumbnail.js +1 -9
  88. package/dist/wje-toast.js +24 -23
  89. package/dist/wje-toggle.js +7 -1
  90. package/dist/wje-toolbar-action.js +1 -1
  91. package/dist/wje-toolbar.js +1 -1
  92. package/dist/wje-tooltip.js +5 -1
  93. package/dist/wje-visually-hidden.js +1 -1
  94. package/package.json +16 -5
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import WJElement from "./wje-element.js";
5
- const styles = "\n:host \n {\n display: block;\n /* make css property for width height position and if it is on top lef bottom right */\n }\n\n.sliding-container-wrapper{\n height: 100%;\n position: relative;\n overflow: hidden;\n}\n\n.native-sliding-container {\n overflow: auto;\n}\n\n";
5
+ const styles = ":host {\n display: block;\n z-index: 1000;\n /* make css property for width height position and if it is on top lef bottom right */\n}\n\n.sliding-container-wrapper {\n height: 100%;\n position: relative;\n overflow: hidden;\n}\n\n.native-sliding-container {\n overflow: auto;\n}";
6
6
  class SlidingContainer extends WJElement {
7
7
  /**
8
8
  * Creates an instance of SlidingContainer.
@@ -18,16 +18,37 @@ class SlidingContainer extends WJElement {
18
18
  * If the target element is the same as the last caller, it toggles the state by calling the `toggle` method.
19
19
  * @param {Event} e - The event object.
20
20
  */
21
- __publicField(this, "triggerEvent", (e) => {
21
+ __publicField(this, "triggerEvent", async (e) => {
22
22
  if (this._lastCaller && this._lastCaller !== e.composedPath()[0]) {
23
- this.open(e);
23
+ await this.open(e);
24
24
  } else {
25
- this.toggle(e);
25
+ await this.toggle(e);
26
26
  }
27
27
  this._lastCaller = e.composedPath()[0];
28
28
  });
29
29
  this._isOpen = false;
30
30
  this._lastCaller = null;
31
+ this._resizeObserver = new ResizeObserver((entries) => {
32
+ for (let entry of entries) {
33
+ if (entry.contentBoxSize) {
34
+ if (this.drawingStatus < 3) return;
35
+ if (this.screenBreakPoint && window.innerWidth <= this.screenBreakPoint) {
36
+ if (this.variant !== "over") {
37
+ this.variant = "over";
38
+ } else {
39
+ this.checkForVariant(this.variant);
40
+ }
41
+ } else {
42
+ if (this.variant !== "in-place") {
43
+ this.variant = "in-place";
44
+ } else {
45
+ this.checkForVariant(this.variant);
46
+ }
47
+ }
48
+ }
49
+ }
50
+ });
51
+ this._resizeObserver.observe(document.documentElement);
31
52
  }
32
53
  set maxWidth(value) {
33
54
  this.setAttribute("max-width", value);
@@ -137,16 +158,27 @@ class SlidingContainer extends WJElement {
137
158
  let fragment = document.createDocumentFragment();
138
159
  this.style.position = "relative";
139
160
  this.style.height = "100%";
161
+ this.style.right = "unset";
162
+ this.style.left = "unset";
140
163
  this.wrapperDiv = document.createElement("div");
141
164
  this.wrapperDiv.classList.add("sliding-container-wrapper");
142
165
  this.transparentDiv = document.createElement("div");
143
166
  this.transparentDiv.classList.add("sliding-container-transparent");
167
+ if (this._isOpen) {
168
+ this.transparentDiv.style.width = this.maxWidth;
169
+ }
144
170
  let native = document.createElement("div");
145
171
  native.style.position = "absolute";
146
172
  native.style.width = 0;
147
173
  if (this.hasOpacity) {
148
174
  native.style.opacity = 0;
149
175
  }
176
+ if (this._isOpen) {
177
+ native.style.width = this.maxWidth;
178
+ if (this.hasOpacity) {
179
+ native.style.opacity = 1;
180
+ }
181
+ }
150
182
  native.style.height = "100%";
151
183
  native.classList.add("native-sliding-container");
152
184
  native.setAttribute("part", "sliding-container");
@@ -194,6 +226,9 @@ class SlidingContainer extends WJElement {
194
226
  * Executes before drawing the element.
195
227
  */
196
228
  beforeDraw() {
229
+ var _a, _b;
230
+ (_a = this.animation) == null ? void 0 : _a.cancel();
231
+ (_b = this.nativeAnimation) == null ? void 0 : _b.cancel();
197
232
  document.removeEventListener(this.trigger, this.triggerEvent);
198
233
  }
199
234
  /**
@@ -203,9 +238,9 @@ class SlidingContainer extends WJElement {
203
238
  * Calls the checkForVariant method with the current variant.
204
239
  * @returns {Promise<void>} A promise that resolves after the actions are completed.
205
240
  */
206
- async afterDraw() {
241
+ afterDraw() {
207
242
  document.addEventListener(this.trigger, this.triggerEvent);
208
- if (this.screenBreakPoint && window.innerWidth < this.screenBreakPoint) {
243
+ if (this.screenBreakPoint && window.innerWidth <= this.screenBreakPoint) {
209
244
  this.variant = "over";
210
245
  }
211
246
  this.checkForVariant(this.variant);
@@ -223,7 +258,6 @@ class SlidingContainer extends WJElement {
223
258
  * @param {string} variant - The variant to check for.
224
259
  */
225
260
  checkForVariant(variant) {
226
- var _a, _b;
227
261
  if (variant === "over") {
228
262
  this.style.position = "fixed";
229
263
  let computentStyleOfParent = window.getComputedStyle(
@@ -233,23 +267,26 @@ class SlidingContainer extends WJElement {
233
267
  let heightOfParrentElement = parseFloat(
234
268
  computentStyleOfParent.height
235
269
  );
236
- let widthOfParrentElement = parseFloat(
237
- computentStyleOfParent.width
238
- );
239
270
  let topOfParrentElement = parseFloat(computentStyleOfParent.top);
240
271
  this.style.height = heightOfParrentElement + +this.addToHeight + "px";
241
272
  this.wrapperDiv.style.height = heightOfParrentElement + +this.addToHeight + "px";
242
273
  this.style.top = topOfParrentElement + "px";
243
- let isFirstChildInContainer = this.getParentElement().firstElementChild === this || ((_a = this.getParentElement().shadowRoot) == null ? void 0 : _a.firstElementChild) === this;
244
- let isLastChildInContainer = this.getParentElement().lastElementChild === this || ((_b = this.getParentElement().shadowRoot) == null ? void 0 : _b.lastElementChild) === this;
245
- if (isFirstChildInContainer) {
246
- if (this.direction === "right") {
274
+ const leftSibling = this.previousElementSibling;
275
+ const rightSibling = this.nextElementSibling;
276
+ const leftSiblingBoundingbox = leftSibling == null ? void 0 : leftSibling.getBoundingClientRect();
277
+ const rightSiblingBoundingbox = rightSibling == null ? void 0 : rightSibling.getBoundingClientRect();
278
+ if (this.direction === "right") {
279
+ if (leftSiblingBoundingbox) {
280
+ this.style.left = leftSiblingBoundingbox.left + leftSiblingBoundingbox.width + "px";
281
+ } else {
247
282
  this.style.left = parentElementBoundingbox.left + "px";
283
+ }
284
+ } else {
285
+ if (rightSiblingBoundingbox) {
286
+ this.style.right = window.innerWidth - rightSiblingBoundingbox.left + "px";
248
287
  } else {
249
- this.style.right = window.innerWidth - (parentElementBoundingbox.left + parentElementBoundingbox.width) + widthOfParrentElement + "px";
288
+ this.style.right = window.innerWidth - (parentElementBoundingbox.left + parentElementBoundingbox.width) + "px";
250
289
  }
251
- } else if (isLastChildInContainer) {
252
- this.style.right = window.innerWidth - (parentElementBoundingbox.left + parentElementBoundingbox.width) + "px";
253
290
  }
254
291
  }
255
292
  }
@@ -275,55 +312,92 @@ class SlidingContainer extends WJElement {
275
312
  }
276
313
  /**
277
314
  * Animates the transition of the element's width from 0 to the maximum width or vice versa.
278
- * @returns {Promise<void>} A promise that resolves when the animation finishes.
315
+ * @returns {Promise<void>} A promise that resolves when the animation is complete.
279
316
  */
280
317
  doAnimateTransition() {
318
+ var _a, _b, _c, _d;
281
319
  const options = {
282
320
  delay: 0,
283
321
  endDelay: 0,
284
- fill: "both",
322
+ fill: "forwards",
285
323
  duration: +this.animationDuration,
286
324
  iterationStart: 0,
287
325
  iterations: 1,
288
326
  direction: "normal",
289
327
  easing: this.animationEasing
290
328
  };
329
+ if (this.animation && ((_b = (_a = this.animation) == null ? void 0 : _a.effect) == null ? void 0 : _b.target) !== this.transparentDiv) {
330
+ this.animation.cancel();
331
+ this.animation = null;
332
+ }
333
+ if (this.nativeAnimation && ((_d = (_c = this.nativeAnimation) == null ? void 0 : _c.effect) == null ? void 0 : _d.target) !== this.nativeElement) {
334
+ this.nativeAnimation.cancel();
335
+ this.nativeAnimation = null;
336
+ }
291
337
  if (!this._isOpen) {
292
- if (this.animation) {
338
+ if (this.animation && this.nativeAnimation) {
293
339
  this.animation.reverse();
294
340
  this.nativeAnimation.reverse();
295
- return;
341
+ } else {
342
+ this.animation = this.transparentDiv.animate(
343
+ [
344
+ {
345
+ width: 0
346
+ },
347
+ {
348
+ width: this.maxWidth
349
+ }
350
+ ],
351
+ options
352
+ );
353
+ this.nativeAnimation = this.nativeElement.animate(
354
+ [
355
+ {
356
+ ...this.hasOpacity ? { opacity: 0 } : {},
357
+ width: 0
358
+ },
359
+ {
360
+ ...this.hasOpacity ? { opacity: 1 } : {},
361
+ width: this.maxWidth
362
+ }
363
+ ],
364
+ options
365
+ );
296
366
  }
297
- this.animation = this.transparentDiv.animate(
298
- [
299
- {
300
- width: 0
301
- },
302
- {
303
- width: this.maxWidth
304
- }
305
- ],
306
- options
307
- );
308
- this.nativeAnimation = this.nativeElement.animate(
309
- [
310
- {
311
- ...this.hasOpacity ? { opacity: 0 } : {},
312
- width: 0
313
- },
314
- {
315
- ...this.hasOpacity ? { opacity: 1 } : {},
316
- width: this.maxWidth
317
- }
318
- ],
319
- options
320
- );
321
367
  } else {
322
- this.animation.reverse();
323
- this.nativeAnimation.reverse();
368
+ if (this.animation && this.nativeAnimation) {
369
+ this.animation.reverse();
370
+ this.nativeAnimation.reverse();
371
+ } else {
372
+ this.animation = this.transparentDiv.animate(
373
+ [
374
+ {
375
+ width: this.maxWidth
376
+ },
377
+ {
378
+ width: 0
379
+ }
380
+ ],
381
+ options
382
+ );
383
+ this.nativeAnimation = this.nativeElement.animate(
384
+ [
385
+ {
386
+ ...this.hasOpacity ? { opacity: 1 } : {},
387
+ width: this.maxWidth
388
+ },
389
+ {
390
+ ...this.hasOpacity ? { opacity: 0 } : {},
391
+ width: 0
392
+ }
393
+ ],
394
+ options
395
+ );
396
+ }
324
397
  }
325
398
  return new Promise((resolve, reject) => {
326
399
  this.animation.onfinish = () => {
400
+ this._isOpen = !this._isOpen;
327
401
  resolve();
328
402
  };
329
403
  });
@@ -343,7 +417,6 @@ class SlidingContainer extends WJElement {
343
417
  );
344
418
  await this.doAnimateTransition();
345
419
  await Promise.resolve(this.afterOpen(event)).then(() => {
346
- this._isOpen = true;
347
420
  this.dispatchEvent(
348
421
  new CustomEvent("wje-sliding-container:open", {
349
422
  bubbles: true,
@@ -375,7 +448,6 @@ class SlidingContainer extends WJElement {
375
448
  child.remove();
376
449
  });
377
450
  }
378
- this._isOpen = false;
379
451
  this.dispatchEvent(
380
452
  new CustomEvent("wje-sliding-container:close", {
381
453
  bubbles: true,
@@ -398,6 +470,10 @@ class SlidingContainer extends WJElement {
398
470
  await this.open(event);
399
471
  }
400
472
  }
473
+ componentCleanup() {
474
+ this._resizeObserver.disconnect();
475
+ this._resizeObserver = null;
476
+ }
401
477
  }
402
478
  SlidingContainer.define("wje-sliding-container", SlidingContainer);
403
479
  export {
@@ -44,7 +44,7 @@ class SplitView extends WJElement {
44
44
  */
45
45
  __publicField(this, "handleDrag", (e) => {
46
46
  if (this.hasAttribute("disabled"))
47
- return false;
47
+ return;
48
48
  drag(this, {
49
49
  onMove: (x, y) => {
50
50
  let newPositionInPixels = this.hasAttribute("vertical") ? y : x;
@@ -57,6 +57,12 @@ class SplitView extends WJElement {
57
57
  });
58
58
  });
59
59
  }
60
+ set initial(value) {
61
+ this.setAttribute("initial", value);
62
+ }
63
+ get initial() {
64
+ return +this.getAttribute("initial") || 50;
65
+ }
60
66
  /**
61
67
  * Returns the CSS styles for the component.
62
68
  *
@@ -89,7 +95,7 @@ class SplitView extends WJElement {
89
95
  * @param {Object} params - The parameters for drawing.
90
96
  * @returns {DocumentFragment}
91
97
  */
92
- draw(context, store, params) {
98
+ draw() {
93
99
  let fragment = document.createDocumentFragment();
94
100
  let native = document.createElement("div");
95
101
  native.classList.add("native-split-view");
@@ -130,7 +136,9 @@ class SplitView extends WJElement {
130
136
  */
131
137
  detectSize() {
132
138
  const { width, height } = this.getBoundingClientRect();
139
+ console.log(this, this.getBoundingClientRect());
133
140
  this.size = this.hasAttribute("vertical") ? height : width;
141
+ console.log("detectSize:", this.hasAttribute("vertical"), this.size);
134
142
  }
135
143
  /**
136
144
  * Converts pixels to a percentage.
@@ -37,7 +37,7 @@ class Status extends WJElement {
37
37
  * @param {Object} params - The parameters
38
38
  * @returns {Object} fragment - The document fragment
39
39
  */
40
- draw(context, store, params) {
40
+ draw() {
41
41
  let fragment = document.createDocumentFragment();
42
42
  let native = document.createElement("div");
43
43
  native.setAttribute("part", "native");