wj-elements 0.0.11 → 0.0.13

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 (79) hide show
  1. package/dist/localize-20081fd1.js +55 -0
  2. package/dist/router-links-26e4a166.js +204 -0
  3. package/dist/style.css +2243 -2
  4. package/dist/wj-animation.js +35 -23
  5. package/dist/wj-aside.js +22 -16
  6. package/dist/wj-avatar.js +49 -30
  7. package/dist/wj-badge.js +22 -18
  8. package/dist/wj-breadcrumb.js +102 -50
  9. package/dist/wj-breadcrumbs.js +36 -19
  10. package/dist/wj-button-group.js +36 -22
  11. package/dist/wj-button.js +104 -39
  12. package/dist/wj-card-content.js +18 -14
  13. package/dist/wj-card-controls.js +18 -14
  14. package/dist/wj-card-header.js +20 -14
  15. package/dist/wj-card-subtitle.js +19 -15
  16. package/dist/wj-card-title.js +18 -14
  17. package/dist/wj-card.js +20 -14
  18. package/dist/wj-carousel-item.js +22 -16
  19. package/dist/wj-carousel.js +169 -92
  20. package/dist/wj-checkbox.js +46 -24
  21. package/dist/wj-chip.js +39 -21
  22. package/dist/wj-col.js +31 -17
  23. package/dist/wj-color-picker.js +877 -509
  24. package/dist/wj-container.js +20 -16
  25. package/dist/wj-copy-button.js +112 -64
  26. package/dist/wj-dialog.js +68 -42
  27. package/dist/wj-divider.js +20 -14
  28. package/dist/wj-dropdown.js +29 -17
  29. package/dist/wj-element.js +415 -241
  30. package/dist/wj-fetchAndParseCSS.js +49 -32
  31. package/dist/wj-file-upload-item.js +64 -38
  32. package/dist/wj-file-upload.js +237 -137
  33. package/dist/wj-footer.js +18 -14
  34. package/dist/wj-form.js +18 -14
  35. package/dist/wj-format-digital.js +40 -25
  36. package/dist/wj-grid.js +20 -16
  37. package/dist/wj-header.js +22 -16
  38. package/dist/wj-icon-picker.js +122 -68
  39. package/dist/wj-icon.js +144 -64
  40. package/dist/wj-img-comparer.js +72 -41
  41. package/dist/wj-img.js +31 -19
  42. package/dist/wj-infinite-scroll.js +90 -52
  43. package/dist/wj-input-file.js +50 -27
  44. package/dist/wj-input.js +169 -70
  45. package/dist/wj-item.js +34 -17
  46. package/dist/wj-label.js +21 -19
  47. package/dist/wj-list.js +20 -15
  48. package/dist/wj-main.js +18 -14
  49. package/dist/wj-masonry.js +140 -83
  50. package/dist/wj-master.js +492 -350
  51. package/dist/wj-menu-button.js +19 -15
  52. package/dist/wj-menu-item.js +150 -64
  53. package/dist/wj-menu-label.js +21 -17
  54. package/dist/wj-menu.js +24 -18
  55. package/dist/wj-popup.js +1140 -712
  56. package/dist/wj-progress-bar.js +100 -40
  57. package/dist/wj-radio-group.js +38 -25
  58. package/dist/wj-radio.js +46 -22
  59. package/dist/wj-rate.js +121 -71
  60. package/dist/wj-relative-time.js +48 -24
  61. package/dist/wj-route.js +11 -8
  62. package/dist/wj-router-link.js +22 -17
  63. package/dist/wj-router-outlet.js +135 -71
  64. package/dist/wj-routerx.js +1124 -641
  65. package/dist/wj-row.js +21 -19
  66. package/dist/wj-slider.js +97 -55
  67. package/dist/wj-split-view.js +81 -43
  68. package/dist/wj-store.js +195 -110
  69. package/dist/wj-textarea.js +86 -37
  70. package/dist/wj-thumbnail.js +19 -15
  71. package/dist/wj-toast.js +87 -34
  72. package/dist/wj-toggle.js +42 -24
  73. package/dist/wj-toolbar-action.js +27 -16
  74. package/dist/wj-toolbar.js +26 -19
  75. package/dist/wj-tooltip.js +40 -24
  76. package/dist/wj-visually-hidden.js +18 -14
  77. package/package.json +1 -1
  78. package/dist/localize-762a9f0f.js +0 -43
  79. package/dist/router-links-e0087f84.js +0 -146
package/dist/wj-card.js CHANGED
@@ -1,27 +1,33 @@
1
- var n = Object.defineProperty;
2
- var l = (r, o, a) => o in r ? n(r, o, { enumerable: !0, configurable: !0, writable: !0, value: a }) : r[o] = a;
3
- var e = (r, o, a) => (l(r, typeof o != "symbol" ? o + "" : o, a), a);
4
- import d from "./wj-element.js";
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import WJElement from "./wj-element.js";
5
8
  import "./wj-store.js";
6
- const i = `:host{--wj-card-margin-top: 0;--wj-card-margin-bottom: 1rem;--wj-card-margin-inline: 0;--wj-card-border-color: transparent}:host(.wj-color-primary){--wj-card-background: var(--wj-color-primary)}:host(.wj-color-complete){--wj-card-background: var(--wj-color-complete)}:host(.wj-color-success){--wj-card-background: var(--wj-color-success)}:host(.wj-color-warning){--wj-card-background: var(--wj-color-warning)}:host(.wj-color-danger){--wj-card-background: var(--wj-color-danger)}:host(.wj-color-info){--wj-card-background: var(--wj-color-info)}:host(.wj-color-menu){--wj-card-background: var(--wj-color-menu)}:host(.wj-color-primary){--wj-card-color: var(--wj-color-white)}:host(.wj-color-complete){--wj-card-color: var(--wj-color-white)}:host(.wj-color-success){--wj-card-color: var(--wj-color-white)}:host(.wj-color-warning){--wj-card-color: var(--wj-color)}:host(.wj-color-danger){--wj-card-color: var(--wj-color-white)}:host(.wj-color-info){--wj-card-color: var(--wj-color-white)}:host(.wj-color-menu){--wj-card-color: var(--wj-color-white) !important}:host{background-color:var(--wj-card-background);color:var(--wj-card-color)!important;margin-top:var(--wj-card-margin-top);margin-bottom:var(--wj-card-margin-bottom);margin-inline:var(--wj-card-margin-inline);box-shadow:var(--wj-box-shadow-large);border-color:var(--wj-border-color);border-style:var(--wj-border-style);border-width:var(--wj-border-size);border-radius:var(--wj-border-radius-medium);font-family:var(--wj-font-family);font-size:var(--wj-font-size);line-height:var(--wj-line-height);position:relative;width:100%;word-wrap:normal;display:flex;flex-direction:column;contain:content;overflow:hidden;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host(.wj-color){background-color:var(--wj-card-background, #fff);color:var(--wj-card-color)}
7
- `;
8
- class s extends d {
9
+ const styles = "/*\n[ WJ Card ]\n*/\n:host {\n --wj-card-margin-top: 0;\n --wj-card-margin-bottom: 1rem;\n --wj-card-margin-inline: 0;\n --wj-card-border-color: transparent;\n}\n\n:host(.wj-color-primary) {\n --wj-card-background: var(--wj-color-primary);\n}\n\n:host(.wj-color-complete) {\n --wj-card-background: var(--wj-color-complete);\n}\n\n:host(.wj-color-success) {\n --wj-card-background: var(--wj-color-success);\n}\n\n:host(.wj-color-warning) {\n --wj-card-background: var(--wj-color-warning);\n}\n\n:host(.wj-color-danger) {\n --wj-card-background: var(--wj-color-danger);\n}\n\n:host(.wj-color-info) {\n --wj-card-background: var(--wj-color-info);\n}\n\n:host(.wj-color-menu) {\n --wj-card-background: var(--wj-color-menu);\n}\n\n:host(.wj-color-primary) {\n --wj-card-color: var(--wj-color-white);\n}\n\n:host(.wj-color-complete) {\n --wj-card-color: var(--wj-color-white);\n}\n\n:host(.wj-color-success) {\n --wj-card-color: var(--wj-color-white);\n}\n\n:host(.wj-color-warning) {\n --wj-card-color: var(--wj-color);\n}\n\n:host(.wj-color-danger) {\n --wj-card-color: var(--wj-color-white);\n}\n\n:host(.wj-color-info) {\n --wj-card-color: var(--wj-color-white);\n}\n\n:host(.wj-color-menu) {\n --wj-card-color: var(--wj-color-white) !important;\n}\n\n:host {\n background-color: var(--wj-card-background);\n color: var(--wj-card-color) !important;\n margin-top: var(--wj-card-margin-top);\n margin-bottom: var(--wj-card-margin-bottom);\n margin-inline: var(--wj-card-margin-inline);\n box-shadow: var(--wj-box-shadow-large);\n border-color: var(--wj-border-color);\n border-style: var(--wj-border-style);\n border-width: var(--wj-border-size);\n border-radius: var(--wj-border-radius-medium);\n font-family: var(--wj-font-family);\n font-size: var(--wj-font-size);\n line-height: var(--wj-line-height);\n position: relative;\n width: 100%;\n word-wrap: normal;\n display: flex;\n flex-direction: column;\n contain: content;\n overflow: hidden;\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n}\n\n:host(.wj-color) {\n background-color: var(--wj-card-background, #fff);\n color: var(--wj-card-color);\n}";
10
+ class Card extends WJElement {
9
11
  constructor() {
10
12
  super();
11
- e(this, "className", "Card");
13
+ __publicField(this, "className", "Card");
12
14
  }
13
15
  static get cssStyleSheet() {
14
- return i;
16
+ return styles;
15
17
  }
16
18
  setupAttributes() {
17
19
  this.isShadowRoot = "open";
18
20
  }
19
- draw(a, j, c) {
20
- let t = document.createDocumentFragment(), w = document.createElement("slot");
21
- return c.color && this.classList.add("wj-color-" + c.color, "wj-color"), t.appendChild(w), t;
21
+ draw(context, store, params) {
22
+ let fragment = document.createDocumentFragment();
23
+ let element = document.createElement("slot");
24
+ if (params.color)
25
+ this.classList.add("wj-color-" + params.color, "wj-color");
26
+ fragment.appendChild(element);
27
+ return fragment;
22
28
  }
23
29
  }
24
- customElements.get("wj-card") || window.customElements.define("wj-card", s);
30
+ customElements.get("wj-card") || window.customElements.define("wj-card", Card);
25
31
  export {
26
- s as Card
32
+ Card
27
33
  };
@@ -1,17 +1,19 @@
1
- var n = Object.defineProperty;
2
- var l = (e, t, s) => t in e ? n(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
- var r = (e, t, s) => (l(e, typeof t != "symbol" ? t + "" : t, s), s);
4
- import c from "./wj-element.js";
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import WJElement from "./wj-element.js";
5
8
  import "./wj-store.js";
6
- const m = `:host{--aspect-ratio: inherit;display:flex;align-items:center;justify-content:center;flex-direction:column;width:var(--wj-carousel-size, 100%);max-height:100%;aspect-ratio:var(--aspect-ratio);scroll-snap-align:center;scroll-snap-stop:always}.native-carousel-item{width:100%;height:100%;display:flex}::slotted(wj-img){width:100%!important;height:100%!important;object-fit:contain;display:flex}
7
- `;
8
- class d extends c {
9
+ const styles = "/*\n[ WJ Carousel Item ]\n*/\n:host {\n --aspect-ratio: inherit;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n width: var(--wj-carousel-size, 100%);\n max-height: 100%;\n aspect-ratio: var(--aspect-ratio);\n scroll-snap-align: center;\n scroll-snap-stop: always;\n}\n\n.native-carousel-item {\n width: 100%;\n height: 100%;\n display: flex;\n}\n\n::slotted(wj-img) {\n width: 100% !important;\n height: 100% !important;\n object-fit: contain;\n display: flex;\n}";
10
+ class CarouselItem extends WJElement {
9
11
  constructor() {
10
12
  super();
11
- r(this, "className", "CarouselItem");
13
+ __publicField(this, "className", "CarouselItem");
12
14
  }
13
15
  static get cssStyleSheet() {
14
- return m;
16
+ return styles;
15
17
  }
16
18
  static get observedAttributes() {
17
19
  return [];
@@ -19,14 +21,18 @@ class d extends c {
19
21
  setupAttributes() {
20
22
  this.isShadowRoot = "open";
21
23
  }
22
- draw(s, u, p) {
23
- let i = document.createDocumentFragment(), a = document.createElement("div");
24
- a.classList.add("native-carousel-item"), a.setAttribute("part", "native");
25
- let o = document.createElement("slot");
26
- return a.appendChild(o), i.appendChild(a), i;
24
+ draw(context, store, params) {
25
+ let fragment = document.createDocumentFragment();
26
+ let native = document.createElement("div");
27
+ native.classList.add("native-carousel-item");
28
+ native.setAttribute("part", "native");
29
+ let slot = document.createElement("slot");
30
+ native.appendChild(slot);
31
+ fragment.appendChild(native);
32
+ return fragment;
27
33
  }
28
34
  }
29
- customElements.get("wj-carousel-item") || window.customElements.define("wj-carousel-item", d);
35
+ customElements.get("wj-carousel-item") || window.customElements.define("wj-carousel-item", CarouselItem);
30
36
  export {
31
- d as CarouselItem
37
+ CarouselItem
32
38
  };
@@ -1,20 +1,21 @@
1
- var g = Object.defineProperty;
2
- var p = (o, a, e) => a in o ? g(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e;
3
- var u = (o, a, e) => (p(o, typeof a != "symbol" ? a + "" : a, e), e);
4
- import v from "./wj-element.js";
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import WJElement from "./wj-element.js";
5
8
  import "./wj-store.js";
6
- const b = `/*!
7
- * direction.scss
8
- */:host{--wj-scroll-hint: 0px;--wj-carousel-width: 100%;--wj-carousel-height: auto}.native-carousel{position:relative;width:var(--wj-carousel-width, 100%);height:var(--wj-carousel-height, 300px);scroll-behavior:smooth}.carousel-slides{display:flex;transition:transform .5s ease;align-items:center;justify-items:center;overflow:auto;overscroll-behavior-x:contain;scrollbar-width:none;-ms-overflow-style:none;aspect-ratio:var(--wj-aspect-ratio, 4/3);scroll-snap-type:x mandatory;scroll-padding-inline:0;overflow-y:hidden;padding-inline:var(--wj-spacing-inline, 0);gap:.5rem}.carousel-slides::-webkit-scrollbar{display:none}::slotted(wj-carousel-item){flex:0 0 var(--wj-carousel-size, 100%);height:100%}wj-button{position:absolute;top:50%;border:none;cursor:pointer;z-index:2}.prev{left:-1rem;transform:translate(-100%,-50%)}.next{right:-.5rem;transform:translate(100%,-50%)}.pagination{position:absolute;bottom:-.5rem;left:50%;transform:translate(-50%,100%);display:flex;z-index:2}.pagination-item{cursor:pointer;height:15px;width:15px;margin:0 2px;background-color:var(--wj-color-contrast-4);display:inline-block;border-radius:50%}.pagination-item.active{background-color:var(--wj-color)}.thumbnails{display:flex;justify-content:center;align-items:center;overflow-x:auto;gap:.5rem;padding:0 .5rem;margin-top:.5rem;margin-bottom:.5rem;box-sizing:border-box;overflow-y:hidden}.thumbnails wj-thumbnail{--wj-thumbnail-width: 48px;--wj-thumbnail-height: 48px;--wj-thumbnail-border-radius: 0;cursor:pointer;border:1px solid transparent}.thumbnails .active{border:1px solid var(--wj-color-primary-11)}
9
- `;
10
- class f extends v {
9
+ const styles = "/*!\n* direction.scss\n*/\n/* Skeleton Variables */\n/*\n[ Carousel ]\n*/\n:host {\n --wj-scroll-hint: 0px;\n --wj-carousel-width: 100%;\n --wj-carousel-height: auto;\n}\n.native-carousel {\n position: relative;\n width: var(--wj-carousel-width, 100%);\n height: var(--wj-carousel-height, 300px);\n scroll-behavior: smooth;\n}\n.carousel-slides {\n display: flex;\n transition: transform 0.5s ease;\n align-items: center;\n justify-items: center;\n overflow: auto;\n overscroll-behavior-x: contain;\n scrollbar-width: none;\n -ms-overflow-style: none;\n aspect-ratio: var(--wj-aspect-ratio, 4/3);\n scroll-snap-type: x mandatory;\n scroll-padding-inline: 0;\n overflow-y: hidden;\n padding-inline: var(--wj-spacing-inline, 0);\n gap: 0.5rem;\n}\n.carousel-slides::-webkit-scrollbar {\n display: none;\n}\n::slotted(wj-carousel-item) {\n flex: 0 0 var(--wj-carousel-size, 100%);\n height: 100%;\n}\nwj-button {\n position: absolute;\n top: 50%;\n border: none;\n cursor: pointer;\n z-index: 2;\n}\n.prev {\n left: -1rem;\n transform: translate(-100%, -50%);\n}\n.next {\n right: -0.5rem;\n transform: translate(100%, -50%);\n}\n.pagination {\n position: absolute;\n bottom: -0.5rem;\n left: 50%;\n transform: translate(-50%, 100%);\n display: flex;\n z-index: 2;\n}\n.pagination-item {\n cursor: pointer;\n height: 15px;\n width: 15px;\n margin: 0 2px;\n background-color: var(--wj-color-contrast-4);\n display: inline-block;\n border-radius: 50%;\n}\n.pagination-item.active {\n background-color: var(--wj-color);\n}\n.thumbnails {\n display: flex;\n justify-content: center;\n align-items: center;\n overflow-x: auto;\n gap: 0.5rem;\n padding: 0 0.5rem;\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n box-sizing: border-box;\n overflow-y: hidden;\n}\n.thumbnails wj-thumbnail {\n --wj-thumbnail-width: 48px;\n --wj-thumbnail-height: 48px;\n --wj-thumbnail-border-radius: 0;\n cursor: pointer;\n border: 1px solid transparent;\n}\n.thumbnails .active {\n border: 1px solid var(--wj-color-primary-11);\n}";
10
+ class Carousel extends WJElement {
11
11
  constructor() {
12
12
  super();
13
- u(this, "className", "Carousel");
14
- this.activeSlide = 0, this.slidePerPage = 1;
13
+ __publicField(this, "className", "Carousel");
14
+ this.activeSlide = 0;
15
+ this.slidePerPage = 1;
15
16
  }
16
- set activeSlide(e) {
17
- this.setAttribute("active-slide", e);
17
+ set activeSlide(value) {
18
+ this.setAttribute("active-slide", value);
18
19
  }
19
20
  get activeSlide() {
20
21
  return +this.getAttribute("active-slide") || 0;
@@ -32,126 +33,202 @@ class f extends v {
32
33
  return this.hasAttribute("loop");
33
34
  }
34
35
  static get cssStyleSheet() {
35
- return b;
36
+ return styles;
36
37
  }
37
38
  static get observedAttributes() {
38
39
  return ["active-slide"];
39
40
  }
40
- attributeChangedCallback(e, i, n) {
41
- e === "active-slide" && (this.pagination && this.changePagination(), this.thumbnails && this.changeThumbnails());
41
+ attributeChangedCallback(name, old, newName) {
42
+ if (name === "active-slide") {
43
+ if (this.pagination)
44
+ this.changePagination();
45
+ if (this.thumbnails)
46
+ this.changeThumbnails();
47
+ }
42
48
  }
43
49
  setupAttributes() {
44
50
  this.isShadowRoot = "open";
45
51
  }
46
- draw(e, i, n) {
47
- let r = document.createDocumentFragment(), t = document.createElement("div");
48
- t.classList.add("native-carousel");
49
- let s = document.createElement("div");
50
- s.classList.add("carousel-slides");
51
- let l = document.createElement("slot");
52
- return s.appendChild(l), t.appendChild(s), this.navigation && (t.appendChild(this.createPreviousButton()), t.appendChild(this.createNextButton())), this.pagination && t.appendChild(this.createPagination()), this.thumbnails && t.appendChild(this.createThumbnails()), r.appendChild(t), this.slides = s, this.cloneFirstAndLastItems(), r;
52
+ draw(context, store, params) {
53
+ let fragment = document.createDocumentFragment();
54
+ let native = document.createElement("div");
55
+ native.classList.add("native-carousel");
56
+ let slides = document.createElement("div");
57
+ slides.classList.add("carousel-slides");
58
+ let slot = document.createElement("slot");
59
+ slides.appendChild(slot);
60
+ native.appendChild(slides);
61
+ if (this.navigation) {
62
+ native.appendChild(this.createPreviousButton());
63
+ native.appendChild(this.createNextButton());
64
+ }
65
+ if (this.pagination)
66
+ native.appendChild(this.createPagination());
67
+ if (this.thumbnails)
68
+ native.appendChild(this.createThumbnails());
69
+ fragment.appendChild(native);
70
+ this.slides = slides;
71
+ this.cloneFirstAndLastItems();
72
+ return fragment;
53
73
  }
54
74
  setIntersectionObserver() {
55
- this.intersectionObserver = new IntersectionObserver((e) => {
56
- e.forEach((i) => {
57
- this.entriesMap.set(i.target, i);
75
+ this.intersectionObserver = new IntersectionObserver((entries) => {
76
+ entries.forEach((entry) => {
77
+ this.entriesMap.set(entry.target, entry);
58
78
  });
59
79
  }, {
60
80
  root: this.context.querySelector(".carousel-slides"),
61
81
  threshold: 0.5
62
- }), this.entriesMap = /* @__PURE__ */ new Map(), this.records = this.intersectionObserver.takeRecords(), this.records.forEach((e) => {
63
- this.entriesMap.set(e.target, e);
82
+ });
83
+ this.entriesMap = /* @__PURE__ */ new Map();
84
+ this.records = this.intersectionObserver.takeRecords();
85
+ this.records.forEach((entry) => {
86
+ this.entriesMap.set(entry.target, entry);
64
87
  });
65
88
  }
66
89
  afterDraw() {
67
- this.setIntersectionObserver(), this.getSlidesWithClones().forEach((i, n) => {
68
- this.intersectionObserver.observe(i);
69
- }), this.slidePerPage = this.getAttribute("slide-per-page") || 1;
70
- let e = 100 / +this.slidePerPage;
71
- this.style.setProperty("--wj-carousel-size", e + "%"), this.goToSlide(this.activeSlide, "auto"), this.slides.addEventListener("scrollend", (i) => {
72
- const n = this.getSlides(), t = [...this.entriesMap.values()].find((s) => s.isIntersecting);
73
- if (t != null && t.target.classList.contains("clone")) {
74
- const s = t.target.getAttribute("clone-index");
75
- this.activeSlide = s, this.goToSlide(+s, "auto");
76
- } else if (t) {
77
- let s = n.indexOf(t.target);
78
- this.activeSlide = s;
90
+ this.setIntersectionObserver();
91
+ this.getSlidesWithClones().forEach((slide, i) => {
92
+ this.intersectionObserver.observe(slide);
93
+ });
94
+ this.slidePerPage = this.getAttribute("slide-per-page") || 1;
95
+ let carouselSize = 100 / +this.slidePerPage;
96
+ this.style.setProperty("--wj-carousel-size", carouselSize + "%");
97
+ this.goToSlide(this.activeSlide, "auto");
98
+ this.slides.addEventListener("scrollend", (e) => {
99
+ const slides = this.getSlides();
100
+ const entries = [...this.entriesMap.values()];
101
+ const visibleEntries = entries.find((entry) => entry.isIntersecting);
102
+ if (visibleEntries == null ? void 0 : visibleEntries.target.classList.contains("clone")) {
103
+ const cloneIndex = visibleEntries.target.getAttribute("clone-index");
104
+ this.activeSlide = cloneIndex;
105
+ this.goToSlide(+cloneIndex, "auto");
106
+ } else if (visibleEntries) {
107
+ let slideIndex = slides.indexOf(visibleEntries.target);
108
+ this.activeSlide = slideIndex;
79
109
  }
80
110
  });
81
111
  }
82
- goToSlide(e, i = "smooth", n = !0) {
83
- const r = this.getSlides(), t = this.getSlidesWithClones();
84
- t.forEach((m, S) => {
85
- m.classList.remove("active");
112
+ goToSlide(index, behavior = "smooth", next = true) {
113
+ const slides = this.getSlides();
114
+ const slideWithClones = this.getSlidesWithClones();
115
+ slideWithClones.forEach((slide, i) => {
116
+ slide.classList.remove("active");
86
117
  });
87
- let s = this.loop ? (e + r.length) % r.length : Math.min(Math.max(e, 0), r.length - 1);
88
- this.activeSlide = s;
89
- const l = Math.min(Math.max(e + (this.loop ? this.slidePerPage : 0), 0), t.length - 1), c = this.getSlidesWithClones()[l];
90
- c.classList.add("active");
91
- let d = c.getBoundingClientRect(), h = this.slides.getBoundingClientRect();
118
+ let newActiveSlide = this.loop ? (index + slides.length) % slides.length : Math.min(Math.max(index, 0), slides.length - 1);
119
+ this.activeSlide = newActiveSlide;
120
+ const nextSlideIndex = Math.min(Math.max(index + (this.loop ? this.slidePerPage : 0), 0), slideWithClones.length - 1);
121
+ const nextSlideEl = this.getSlidesWithClones()[nextSlideIndex];
122
+ nextSlideEl.classList.add("active");
123
+ let nextSlideRect = nextSlideEl.getBoundingClientRect();
124
+ let slidesContainerRect = this.slides.getBoundingClientRect();
92
125
  this.slides.scrollTo({
93
- left: d.left - h.left + this.slides.scrollLeft,
94
- top: d.top - h.top + this.slides.scrollTop,
95
- behavior: i === "smooth" ? "smooth" : "auto"
126
+ left: nextSlideRect.left - slidesContainerRect.left + this.slides.scrollLeft,
127
+ top: nextSlideRect.top - slidesContainerRect.top + this.slides.scrollTop,
128
+ behavior: behavior === "smooth" ? "smooth" : "auto"
96
129
  });
97
130
  }
98
131
  cloneFirstAndLastItems() {
99
- const e = this.getSlides();
100
- if (e.length && this.loop) {
101
- const i = e[0].cloneNode(!0);
102
- i.classList.add("clone"), i.setAttribute("clone-index", 0), this.appendChild(i);
103
- const n = e[e.length - 1].cloneNode(!0);
104
- n.classList.add("clone"), n.setAttribute("clone-index", e.length - 1), this.insertBefore(n, this.firstChild);
132
+ const items = this.getSlides();
133
+ if (items.length && this.loop) {
134
+ const firstItemClone = items[0].cloneNode(true);
135
+ firstItemClone.classList.add("clone");
136
+ firstItemClone.setAttribute("clone-index", 0);
137
+ this.appendChild(firstItemClone);
138
+ const lastItemClone = items[items.length - 1].cloneNode(true);
139
+ lastItemClone.classList.add("clone");
140
+ lastItemClone.setAttribute("clone-index", items.length - 1);
141
+ this.insertBefore(lastItemClone, this.firstChild);
105
142
  }
106
143
  }
107
144
  removeActiveSlide() {
108
- this.getSlidesWithClones().forEach((e, i) => {
109
- e.classList.remove("active");
110
- }), this.pagination && this.context.querySelectorAll(".pagination-item").forEach((e) => {
111
- e.classList.remove("active");
112
- }), this.thumbnails && this.context.querySelectorAll("wj-thumbnail").forEach((e) => {
113
- e.classList.remove("active");
145
+ this.getSlidesWithClones().forEach((slide, i) => {
146
+ slide.classList.remove("active");
114
147
  });
148
+ if (this.pagination) {
149
+ this.context.querySelectorAll(".pagination-item").forEach((item) => {
150
+ item.classList.remove("active");
151
+ });
152
+ }
153
+ if (this.thumbnails) {
154
+ this.context.querySelectorAll("wj-thumbnail").forEach((item) => {
155
+ item.classList.remove("active");
156
+ });
157
+ }
115
158
  }
116
159
  changePagination() {
117
- this.pagination && (this.removeActiveSlide(), this.context.querySelectorAll(".pagination-item").forEach((e, i) => {
118
- i === this.activeSlide && e.classList.add("active");
119
- }));
160
+ if (this.pagination) {
161
+ this.removeActiveSlide();
162
+ this.context.querySelectorAll(".pagination-item").forEach((item, i) => {
163
+ if (i === this.activeSlide) {
164
+ item.classList.add("active");
165
+ }
166
+ });
167
+ }
120
168
  }
121
169
  changeThumbnails() {
122
- this.thumbnails && (this.removeActiveSlide(), this.context.querySelectorAll("wj-thumbnail").forEach((e, i) => {
123
- i === this.activeSlide && e.classList.add("active");
124
- }));
170
+ if (this.thumbnails) {
171
+ this.removeActiveSlide();
172
+ this.context.querySelectorAll("wj-thumbnail").forEach((item, i) => {
173
+ if (i === this.activeSlide) {
174
+ item.classList.add("active");
175
+ }
176
+ });
177
+ }
125
178
  }
126
179
  createNextButton() {
127
- const e = document.createElement("wj-button");
128
- return e.classList.add("next"), e.innerHTML = '<wj-icon name="chevron-right" size="large"></wj-icon', e.setAttribute("circle", ""), e.setAttribute("fill", "link"), e.addEventListener("click", (i) => {
180
+ const nextButton = document.createElement("wj-button");
181
+ nextButton.classList.add("next");
182
+ nextButton.innerHTML = '<wj-icon name="chevron-right" size="large"></wj-icon';
183
+ nextButton.setAttribute("circle", "");
184
+ nextButton.setAttribute("fill", "link");
185
+ nextButton.addEventListener("click", (e) => {
129
186
  this.nextSlide();
130
- }), e;
187
+ });
188
+ return nextButton;
131
189
  }
132
190
  createPreviousButton() {
133
- const e = document.createElement("wj-button");
134
- return e.classList.add("prev"), e.innerHTML = '<wj-icon name="chevron-left" size="large"></wj-icon', e.setAttribute("circle", ""), e.setAttribute("fill", "link"), e.addEventListener("click", (i) => {
191
+ const previousButton = document.createElement("wj-button");
192
+ previousButton.classList.add("prev");
193
+ previousButton.innerHTML = '<wj-icon name="chevron-left" size="large"></wj-icon';
194
+ previousButton.setAttribute("circle", "");
195
+ previousButton.setAttribute("fill", "link");
196
+ previousButton.addEventListener("click", (e) => {
135
197
  this.previousSlide();
136
- }), e;
198
+ });
199
+ return previousButton;
137
200
  }
138
201
  createPagination() {
139
- const e = document.createElement("div");
140
- return e.classList.add("pagination"), this.getSlides().forEach((n, r) => {
141
- const t = document.createElement("div");
142
- t.classList.add("pagination-item"), t.addEventListener("click", (s) => {
143
- this.removeActiveSlide(), s.target.classList.add("active"), this.goToSlide(r);
144
- }), e.appendChild(t);
145
- }), e;
202
+ const pagination = document.createElement("div");
203
+ pagination.classList.add("pagination");
204
+ const slides = this.getSlides();
205
+ slides.forEach((slide, i) => {
206
+ const paginationItem = document.createElement("div");
207
+ paginationItem.classList.add("pagination-item");
208
+ paginationItem.addEventListener("click", (e) => {
209
+ this.removeActiveSlide();
210
+ e.target.classList.add("active");
211
+ this.goToSlide(i);
212
+ });
213
+ pagination.appendChild(paginationItem);
214
+ });
215
+ return pagination;
146
216
  }
147
217
  createThumbnails() {
148
- const e = document.createElement("div");
149
- return e.classList.add("thumbnails"), this.getSlides().forEach((n, r) => {
150
- const t = document.createElement("wj-thumbnail");
151
- t.innerHTML = `<img src="${n.querySelector("wj-img").getAttribute("src")}"></img>`, t.addEventListener("click", (s) => {
152
- this.removeActiveSlide(), s.target.closest("wj-thumbnail").classList.add("active"), this.goToSlide(r);
153
- }), e.appendChild(t);
154
- }), e;
218
+ const thumbnails = document.createElement("div");
219
+ thumbnails.classList.add("thumbnails");
220
+ const slides = this.getSlides();
221
+ slides.forEach((slide, i) => {
222
+ const thumbnail = document.createElement("wj-thumbnail");
223
+ thumbnail.innerHTML = `<img src="${slide.querySelector("wj-img").getAttribute("src")}"></img>`;
224
+ thumbnail.addEventListener("click", (e) => {
225
+ this.removeActiveSlide();
226
+ e.target.closest("wj-thumbnail").classList.add("active");
227
+ this.goToSlide(i);
228
+ });
229
+ thumbnails.appendChild(thumbnail);
230
+ });
231
+ return thumbnails;
155
232
  }
156
233
  nextSlide() {
157
234
  this.goToSlide(this.activeSlide + this.slidePerPage);
@@ -172,7 +249,7 @@ class f extends v {
172
249
  return this.querySelector(".native-carousel").scrollLeft > 0;
173
250
  }
174
251
  }
175
- customElements.get("wj-carousel") || window.customElements.define("wj-carousel", f);
252
+ customElements.get("wj-carousel") || window.customElements.define("wj-carousel", Carousel);
176
253
  export {
177
- f as Carousel
254
+ Carousel
178
255
  };
@@ -1,29 +1,33 @@
1
- var l = Object.defineProperty;
2
- var b = (c, t, e) => t in c ? l(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
3
- var i = (c, t, e) => (b(c, typeof t != "symbol" ? t + "" : t, e), e);
4
- import h, { event as n } from "./wj-element.js";
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import WJElement, { event } from "./wj-element.js";
5
8
  import "./wj-store.js";
6
- const s = `/*!
7
- * direction.scss
8
- */:host{--wj-grey-check-icon: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAAQAgMAAADsa5zLAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAMUExURUdwTHBwcG9vb3BwcBFjhIYAAAAEdFJOUwBG9tQE3MceAAAAVUlEQVQoz2NgGLKA0QGIDwDxBSCeAMEYgAWI2YCK2CagYgwgDcRSDhgYbAkKzsSKGdgakCyY6ADES7BiiCkgJ4PYyybgxAhQAsRZDrgxCpDEg4cAAAAp2ibhZRGLHgAAAABJRU5ErkJggg==) left center;--wj-white-check-icon: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAAQAgMAAADsa5zLAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAMUExURUdwTP///////////waf0AoAAAAEdFJOUwBG9tQE3MceAAAAVUlEQVQoz2NgGLKA0QGIDwDxBSCeAMEYgAWI2YCK2CagYgwgDcRSDhgYbAkKzsSKGdgakCyY6ADES7BiiCkgJ4PYyybgxAhQAsRZDrgxCpDEg4cAAAAp2ibhZRGLHgAAAABJRU5ErkJggg==) left center;--wj-checkbox-margin-top: 0;--wj-checkbox-margin-bottom: .5rem;--wj-checkbox-margin-inline: 0;--wj-checkbox-width: 16px;--wj-checkbox-height: 16px;display:block;margin-top:var(--wj-checkbox-margin-top);margin-bottom:var(--wj-checkbox-margin-bottom);margin-inline:var(--wj-checkbox-margin-inline);line-height:100%;padding-left:0}:host label{display:inline-block;cursor:pointer;position:relative;padding-left:25px;min-width:var(--wj-checkbox-width);min-height:var(--wj-checkbox-height);margin-bottom:0;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host label:before{content:"";position:absolute;width:16px;height:16px;left:0;-webkit-box-sizing:inherit;box-sizing:border-box;background-color:var(--wj-color-contrast-lowest);border:1px solid var(--wj-border-color)}.native-checkbox label{transition:border .14s linear 0s,color .14s linear 0s,background-color .14s linear 0s}.native-checkbox label:hover{color:var(--wj-color-contrast-higher)}.native-checkbox label:before{border-radius:3px;transition:border .14s linear 0s,color .14s linear 0s,background-color .14s linear 0s}.native-checkbox input[type=checkbox]{position:absolute;margin:0;z-index:-1;width:16px;height:16px;opacity:0;display:none}.native-checkbox input[type=checkbox]+label:after{content:"";position:absolute;left:0;border-right:0 solid transparent;border-bottom:0 solid transparent;width:16px;height:16px;overflow:hidden}.native-checkbox.checkbox-circle label:after{border-radius:99px}.native-checkbox.checkbox-circle label:before{border-radius:99px}.native-checkbox input[type=checkbox]:checked+label:after{content:"";background:var(--wj-grey-check-icon);background-size:160px 16px;background-repeat:no-repeat;animation-name:checkbox-check;animation-duration:.32s;animation-timing-function:steps(9);animation-fill-mode:forwards;animation-iteration-count:1}.native-checkbox input[type=checkbox]:hover:active:not(:checked)+label:before{background-color:#00000014}.native-checkbox input[type=checkbox]:focus+label{color:var(--wj-color-contrast-higher)}.native-checkbox input[type=checkbox]:focus+label:before{outline:none!important;box-shadow:0 0 #78c8fe}.native-checkbox input[type=checkbox][disabled]+label{cursor:not-allowed!important;color:var(--wj-color-contrast-high);opacity:.58}.native-checkbox input[type=checkbox][disabled]+label:before{cursor:not-allowed!important;background:#ececec}.native-checkbox input[type=checkbox]:indeterminate+label:after{background:none;background-color:var(--wj-color-contrast-high);width:10px;height:2px;top:6px;margin:3px;border-radius:2px}.native-checkbox.right label{padding-left:0;padding-right:26px}.native-checkbox.right label:before{right:0;left:auto}.native-checkbox.right input[type=checkbox]:checked+label{position:relative}.native-checkbox.right input[type=checkbox]:checked+label:after{position:absolute;right:0;left:auto}.success input[type=checkbox]:checked+label:before,.success input[type=checkbox]:indeterminate+label:before{border-color:var(--wj-color-success);background-color:var(--wj-color-success)}.primary input[type=checkbox]:checked+label:before,.primary input[type=checkbox]:indeterminate+label:before{border-color:var(--wj-color-primary);background-color:var(--wj-color-primary)}.complete input[type=checkbox]:checked+label:before,.complete input[type=checkbox]:indeterminate+label:before{border-color:var(--wj-color-complete);background-color:var(--wj-color-complete)}.warning input[type=checkbox]:checked+label:before,.warning input[type=checkbox]:indeterminate+label:before{border-color:var(--wj-color-warning);background-color:var(--wj-color-warning)}.danger input[type=checkbox]:checked+label:before,.danger input[type=checkbox]:indeterminate+label:before{border-color:var(--wj-color-danger);background-color:var(--wj-color-danger)}.info input[type=checkbox]:checked+label:before,.info input[type=checkbox]:indeterminate+label:before{border-color:var(--wj-color-info);background-color:var(--wj-color-info)}.info input[type=checkbox]:checked+label:after,.danger input[type=checkbox]:checked+label:after,.complete input[type=checkbox]:checked+label:after,.primary input[type=checkbox]:checked+label:after,.success input[type=checkbox]:checked+label:after{background:var(--wj-white-check-icon)}.info input[type=checkbox]:indeterminate+label:after,.danger input[type=checkbox]:indeterminate+label:after,.complete input[type=checkbox]:indeterminate+label:after,.primary input[type=checkbox]:indeterminate+label:after,.success input[type=checkbox]:indeterminate+label:after{background-color:var(--wj-color-contrast-lowest)}@keyframes shrink-bounce{0%{transform:scale(1)}33%{transform:scale(.85)}to{transform:scale(1)}}@keyframes checkbox-check{0%{background-position:0}to{background-position:-144px}}.js-focus-visible .native-checkbox input[type=checkbox]:focus:not(.focus-visible)+label:before{box-shadow:none}input[type=checkbox]{accent-color:var(--wj-color-primary)!important;font-size:50px}
9
- `;
10
- class d extends h {
9
+ const styles = '/*!\n* direction.scss\n*/\n/* Skeleton Variables */\n/*\n[ Checkbox ]\n*/\n:host {\n --wj-grey-check-icon: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAAQAgMAAADsa5zLAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAMUExURUdwTHBwcG9vb3BwcBFjhIYAAAAEdFJOUwBG9tQE3MceAAAAVUlEQVQoz2NgGLKA0QGIDwDxBSCeAMEYgAWI2YCK2CagYgwgDcRSDhgYbAkKzsSKGdgakCyY6ADES7BiiCkgJ4PYyybgxAhQAsRZDrgxCpDEg4cAAAAp2ibhZRGLHgAAAABJRU5ErkJggg==") left center;\n --wj-white-check-icon: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAAQAgMAAADsa5zLAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAMUExURUdwTP///////////waf0AoAAAAEdFJOUwBG9tQE3MceAAAAVUlEQVQoz2NgGLKA0QGIDwDxBSCeAMEYgAWI2YCK2CagYgwgDcRSDhgYbAkKzsSKGdgakCyY6ADES7BiiCkgJ4PYyybgxAhQAsRZDrgxCpDEg4cAAAAp2ibhZRGLHgAAAABJRU5ErkJggg==") left center;\n --wj-checkbox-margin-top: 0;\n --wj-checkbox-margin-bottom: .5rem;\n --wj-checkbox-margin-inline: 0;\n --wj-checkbox-width: 16px;\n --wj-checkbox-height: 16px;\n display: block;\n margin-top: var(--wj-checkbox-margin-top);\n margin-bottom: var(--wj-checkbox-margin-bottom);\n margin-inline: var(--wj-checkbox-margin-inline);\n line-height: 100%;\n padding-left: 0px;\n}\n:host label {\n display: inline-block;\n cursor: pointer;\n position: relative;\n padding-left: 25px;\n min-width: var(--wj-checkbox-width);\n min-height: var(--wj-checkbox-height);\n margin-bottom: 0;\n -webkit-touch-callout: none; /* iOS Safari */\n -webkit-user-select: none; /* Safari */\n -khtml-user-select: none; /* Konqueror HTML */\n -moz-user-select: none; /* Old versions of Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n user-select: none; /* Non-prefixed version, currently supported by Chrome, Opera and Firefox */\n}\n:host label:before {\n content: "";\n position: absolute;\n width: 16px;\n height: 16px;\n left: 0;\n -webkit-box-sizing: inherit;\n box-sizing: border-box;\n background-color: var(--wj-color-contrast-lowest);\n border: 1px solid var(--wj-border-color);\n}\n.native-checkbox label {\n transition: border 140ms linear 0s, color 140ms linear 0s, background-color 140ms linear 0s;\n}\n.native-checkbox label:hover {\n color: var(--wj-color-contrast-higher);\n}\n.native-checkbox label:before {\n border-radius: 3px;\n transition: border 140ms linear 0s, color 140ms linear 0s, background-color 140ms linear 0s;\n}\n.native-checkbox input[type=checkbox] {\n position: absolute;\n margin: 0;\n z-index: -1;\n width: 16px;\n height: 16px;\n opacity: 0;\n display: none;\n}\n.native-checkbox input[type=checkbox] + label::after {\n content: "";\n position: absolute;\n left: 0;\n border-right: 0 solid transparent;\n border-bottom: 0 solid transparent;\n width: 16px;\n height: 16px;\n overflow: hidden;\n}\n.native-checkbox.checkbox-circle label:after {\n border-radius: 99px;\n}\n.native-checkbox.checkbox-circle label:before {\n border-radius: 99px;\n}\n.native-checkbox input[type=checkbox]:checked + label::after {\n content: "";\n background: var(--wj-grey-check-icon);\n background-size: 160px 16px;\n background-repeat: no-repeat;\n animation-name: checkbox-check;\n animation-duration: 320ms;\n animation-timing-function: steps(9);\n animation-fill-mode: forwards;\n animation-iteration-count: 1;\n}\n.native-checkbox input[type=checkbox]:hover:active:not(:checked) + label:before {\n background-color: rgba(0, 0, 0, 0.08);\n}\n.native-checkbox input[type=checkbox]:focus + label {\n color: var(--wj-color-contrast-higher);\n}\n.native-checkbox input[type=checkbox]:focus + label:before {\n outline: none !important;\n box-shadow: 0 0 0 0px #78c8fe;\n}\n.native-checkbox input[type=checkbox][disabled] + label {\n cursor: not-allowed !important;\n color: var(--wj-color-contrast-high);\n opacity: 0.58;\n}\n.native-checkbox input[type=checkbox][disabled] + label:before {\n cursor: not-allowed !important;\n background: #ececec;\n}\n.native-checkbox input[type=checkbox]:indeterminate + label:after {\n background: none;\n background-color: var(--wj-color-contrast-high);\n width: 10px;\n height: 2px;\n top: 6px;\n margin: 3px;\n border-radius: 2px;\n}\n.native-checkbox.right label {\n padding-left: 0;\n padding-right: 26px;\n}\n.native-checkbox.right label:before {\n right: 0;\n left: auto;\n}\n.native-checkbox.right input[type=checkbox]:checked + label {\n position: relative;\n}\n.native-checkbox.right input[type=checkbox]:checked + label::after {\n position: absolute;\n right: 0px;\n left: auto;\n}\n.success input[type=checkbox]:checked + label:before, .success input[type=checkbox]:indeterminate + label:before {\n border-color: var(--wj-color-success);\n background-color: var(--wj-color-success);\n}\n.primary input[type=checkbox]:checked + label:before, .primary input[type=checkbox]:indeterminate + label:before {\n border-color: var(--wj-color-primary);\n background-color: var(--wj-color-primary);\n}\n.complete input[type=checkbox]:checked + label:before, .complete input[type=checkbox]:indeterminate + label:before {\n border-color: var(--wj-color-complete);\n background-color: var(--wj-color-complete);\n}\n.warning input[type=checkbox]:checked + label:before, .warning input[type=checkbox]:indeterminate + label:before {\n border-color: var(--wj-color-warning);\n background-color: var(--wj-color-warning);\n}\n.danger input[type=checkbox]:checked + label:before, .danger input[type=checkbox]:indeterminate + label:before {\n border-color: var(--wj-color-danger);\n background-color: var(--wj-color-danger);\n}\n.info input[type=checkbox]:checked + label:before, .info input[type=checkbox]:indeterminate + label:before {\n border-color: var(--wj-color-info);\n background-color: var(--wj-color-info);\n}\n.info input[type=checkbox]:checked + label::after, .danger input[type=checkbox]:checked + label::after, .complete input[type=checkbox]:checked + label::after, .primary input[type=checkbox]:checked + label::after, .success input[type=checkbox]:checked + label::after {\n background: var(--wj-white-check-icon);\n}\n.info input[type=checkbox]:indeterminate + label::after, .danger input[type=checkbox]:indeterminate + label::after, .complete input[type=checkbox]:indeterminate + label::after, .primary input[type=checkbox]:indeterminate + label::after, .success input[type=checkbox]:indeterminate + label::after {\n background-color: var(--wj-color-contrast-lowest);\n}\n@keyframes shrink-bounce {\n 0% {\n transform: scale(1);\n }\n 33% {\n transform: scale(0.85);\n }\n 100% {\n transform: scale(1);\n }\n}\n@keyframes checkbox-check {\n 0% {\n background-position: 0;\n }\n 100% {\n background-position: -144px;\n }\n}\n/* hide focus style if not from keyboard navigation */\n.js-focus-visible .native-checkbox input[type=checkbox]:focus:not(.focus-visible) + label:before {\n box-shadow: none;\n}\ninput[type=checkbox] {\n accent-color: var(--wj-color-primary) !important;\n font-size: 50px;\n}';
10
+ class Checkbox extends WJElement {
11
11
  constructor() {
12
12
  super();
13
- i(this, "className", "Checkbox");
14
- i(this, "inputEvent", (e) => {
13
+ __publicField(this, "className", "Checkbox");
14
+ __publicField(this, "inputEvent", (e) => {
15
15
  this.checked = e.target.checked;
16
16
  });
17
- this._checked = !1;
17
+ this._checked = false;
18
18
  }
19
- set checked(e) {
20
- this._checked = e, e ? this.setAttribute("checked", "") : this.removeAttribute("checked");
19
+ set checked(value) {
20
+ this._checked = value;
21
+ if (value)
22
+ this.setAttribute("checked", "");
23
+ else
24
+ this.removeAttribute("checked");
21
25
  }
22
26
  get checked() {
23
27
  return this._checked;
24
28
  }
25
29
  static get cssStyleSheet() {
26
- return s;
30
+ return styles;
27
31
  }
28
32
  static get observedAttributes() {
29
33
  return ["checked"];
@@ -31,20 +35,38 @@ class d extends h {
31
35
  setupAttributes() {
32
36
  this.isShadowRoot = "open";
33
37
  }
34
- draw(e, p, k) {
35
- let a = document.createDocumentFragment(), o = document.createElement("div");
36
- o.classList.add("native-checkbox"), this.variant === "circle" && o.classList.add("checkbox-circle"), this.color && o.classList.add(this.color), this.input = document.createElement("input"), this.input.type = "checkbox", this.input.id = "checkbox", this.input.name = this.name = "checkbox", this.input.checked = this.hasAttribute("checked"), this.input.disabled = this.hasAttribute("disabled"), this.input.indeterminate = this.hasAttribute("indeterminate");
37
- let r = document.createElement("label");
38
- return r.htmlFor = "checkbox", r.innerHTML = "<slot></slot>", o.appendChild(this.input), o.appendChild(r), a.appendChild(o), a;
38
+ draw(context, store, params) {
39
+ let fragment = document.createDocumentFragment();
40
+ let native = document.createElement("div");
41
+ native.classList.add("native-checkbox");
42
+ if (this.variant === "circle")
43
+ native.classList.add("checkbox-circle");
44
+ if (this.color)
45
+ native.classList.add(this.color);
46
+ this.input = document.createElement("input");
47
+ this.input.type = "checkbox";
48
+ this.input.id = "checkbox";
49
+ this.input.name = this.name = "checkbox";
50
+ this.input.checked = this.hasAttribute("checked");
51
+ this.input.disabled = this.hasAttribute("disabled");
52
+ this.input.indeterminate = this.hasAttribute("indeterminate");
53
+ let label = document.createElement("label");
54
+ label.htmlFor = "checkbox";
55
+ label.innerHTML = "<slot></slot>";
56
+ native.appendChild(this.input);
57
+ native.appendChild(label);
58
+ fragment.appendChild(native);
59
+ return fragment;
39
60
  }
40
61
  afterDraw() {
41
- n.addListener(this, "click", "wj:checkbox:change"), n.addListener(this, "click", "wj:checkbox:input");
62
+ event.addListener(this, "click", "wj:checkbox:change");
63
+ event.addListener(this, "click", "wj:checkbox:input");
42
64
  }
43
65
  disconnectedCallback() {
44
- n.removeElement(this);
66
+ event.removeElement(this);
45
67
  }
46
68
  }
47
- customElements.get("wj-checkbox") || window.customElements.define("wj-checkbox", d);
69
+ customElements.get("wj-checkbox") || window.customElements.define("wj-checkbox", Checkbox);
48
70
  export {
49
- d as Checkbox
71
+ Checkbox
50
72
  };