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.
- package/dist/localize-20081fd1.js +55 -0
- package/dist/router-links-26e4a166.js +204 -0
- package/dist/style.css +2243 -2
- package/dist/wj-animation.js +35 -23
- package/dist/wj-aside.js +22 -16
- package/dist/wj-avatar.js +49 -30
- package/dist/wj-badge.js +22 -18
- package/dist/wj-breadcrumb.js +102 -50
- package/dist/wj-breadcrumbs.js +36 -19
- package/dist/wj-button-group.js +36 -22
- package/dist/wj-button.js +104 -39
- package/dist/wj-card-content.js +18 -14
- package/dist/wj-card-controls.js +18 -14
- package/dist/wj-card-header.js +20 -14
- package/dist/wj-card-subtitle.js +19 -15
- package/dist/wj-card-title.js +18 -14
- package/dist/wj-card.js +20 -14
- package/dist/wj-carousel-item.js +22 -16
- package/dist/wj-carousel.js +169 -92
- package/dist/wj-checkbox.js +46 -24
- package/dist/wj-chip.js +39 -21
- package/dist/wj-col.js +31 -17
- package/dist/wj-color-picker.js +877 -509
- package/dist/wj-container.js +20 -16
- package/dist/wj-copy-button.js +112 -64
- package/dist/wj-dialog.js +68 -42
- package/dist/wj-divider.js +20 -14
- package/dist/wj-dropdown.js +29 -17
- package/dist/wj-element.js +415 -241
- package/dist/wj-fetchAndParseCSS.js +49 -32
- package/dist/wj-file-upload-item.js +64 -38
- package/dist/wj-file-upload.js +237 -137
- package/dist/wj-footer.js +18 -14
- package/dist/wj-form.js +18 -14
- package/dist/wj-format-digital.js +40 -25
- package/dist/wj-grid.js +20 -16
- package/dist/wj-header.js +22 -16
- package/dist/wj-icon-picker.js +122 -68
- package/dist/wj-icon.js +144 -64
- package/dist/wj-img-comparer.js +72 -41
- package/dist/wj-img.js +31 -19
- package/dist/wj-infinite-scroll.js +90 -52
- package/dist/wj-input-file.js +50 -27
- package/dist/wj-input.js +169 -70
- package/dist/wj-item.js +34 -17
- package/dist/wj-label.js +21 -19
- package/dist/wj-list.js +20 -15
- package/dist/wj-main.js +18 -14
- package/dist/wj-masonry.js +140 -83
- package/dist/wj-master.js +492 -350
- package/dist/wj-menu-button.js +19 -15
- package/dist/wj-menu-item.js +150 -64
- package/dist/wj-menu-label.js +21 -17
- package/dist/wj-menu.js +24 -18
- package/dist/wj-popup.js +1140 -712
- package/dist/wj-progress-bar.js +100 -40
- package/dist/wj-radio-group.js +38 -25
- package/dist/wj-radio.js +46 -22
- package/dist/wj-rate.js +121 -71
- package/dist/wj-relative-time.js +48 -24
- package/dist/wj-route.js +11 -8
- package/dist/wj-router-link.js +22 -17
- package/dist/wj-router-outlet.js +135 -71
- package/dist/wj-routerx.js +1124 -641
- package/dist/wj-row.js +21 -19
- package/dist/wj-slider.js +97 -55
- package/dist/wj-split-view.js +81 -43
- package/dist/wj-store.js +195 -110
- package/dist/wj-textarea.js +86 -37
- package/dist/wj-thumbnail.js +19 -15
- package/dist/wj-toast.js +87 -34
- package/dist/wj-toggle.js +42 -24
- package/dist/wj-toolbar-action.js +27 -16
- package/dist/wj-toolbar.js +26 -19
- package/dist/wj-tooltip.js +40 -24
- package/dist/wj-visually-hidden.js +18 -14
- package/package.json +1 -1
- package/dist/localize-762a9f0f.js +0 -43
- package/dist/router-links-e0087f84.js +0 -146
package/dist/wj-card.js
CHANGED
|
@@ -1,27 +1,33 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
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
|
|
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
|
-
|
|
13
|
+
__publicField(this, "className", "Card");
|
|
12
14
|
}
|
|
13
15
|
static get cssStyleSheet() {
|
|
14
|
-
return
|
|
16
|
+
return styles;
|
|
15
17
|
}
|
|
16
18
|
setupAttributes() {
|
|
17
19
|
this.isShadowRoot = "open";
|
|
18
20
|
}
|
|
19
|
-
draw(
|
|
20
|
-
let
|
|
21
|
-
|
|
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",
|
|
30
|
+
customElements.get("wj-card") || window.customElements.define("wj-card", Card);
|
|
25
31
|
export {
|
|
26
|
-
|
|
32
|
+
Card
|
|
27
33
|
};
|
package/dist/wj-carousel-item.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
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
|
|
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
|
-
|
|
13
|
+
__publicField(this, "className", "CarouselItem");
|
|
12
14
|
}
|
|
13
15
|
static get cssStyleSheet() {
|
|
14
|
-
return
|
|
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(
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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",
|
|
35
|
+
customElements.get("wj-carousel-item") || window.customElements.define("wj-carousel-item", CarouselItem);
|
|
30
36
|
export {
|
|
31
|
-
|
|
37
|
+
CarouselItem
|
|
32
38
|
};
|
package/dist/wj-carousel.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
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
|
|
7
|
-
|
|
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
|
-
|
|
14
|
-
this.activeSlide = 0
|
|
13
|
+
__publicField(this, "className", "Carousel");
|
|
14
|
+
this.activeSlide = 0;
|
|
15
|
+
this.slidePerPage = 1;
|
|
15
16
|
}
|
|
16
|
-
set activeSlide(
|
|
17
|
-
this.setAttribute("active-slide",
|
|
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
|
|
36
|
+
return styles;
|
|
36
37
|
}
|
|
37
38
|
static get observedAttributes() {
|
|
38
39
|
return ["active-slide"];
|
|
39
40
|
}
|
|
40
|
-
attributeChangedCallback(
|
|
41
|
-
|
|
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(
|
|
47
|
-
let
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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((
|
|
56
|
-
|
|
57
|
-
this.entriesMap.set(
|
|
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
|
-
})
|
|
63
|
-
|
|
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()
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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(
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
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
|
|
88
|
-
this.activeSlide =
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
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:
|
|
94
|
-
top:
|
|
95
|
-
behavior:
|
|
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
|
|
100
|
-
if (
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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((
|
|
109
|
-
|
|
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
|
-
|
|
118
|
-
|
|
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
|
-
|
|
123
|
-
|
|
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
|
|
128
|
-
|
|
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
|
-
})
|
|
187
|
+
});
|
|
188
|
+
return nextButton;
|
|
131
189
|
}
|
|
132
190
|
createPreviousButton() {
|
|
133
|
-
const
|
|
134
|
-
|
|
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
|
-
})
|
|
198
|
+
});
|
|
199
|
+
return previousButton;
|
|
137
200
|
}
|
|
138
201
|
createPagination() {
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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",
|
|
252
|
+
customElements.get("wj-carousel") || window.customElements.define("wj-carousel", Carousel);
|
|
176
253
|
export {
|
|
177
|
-
|
|
254
|
+
Carousel
|
|
178
255
|
};
|
package/dist/wj-checkbox.js
CHANGED
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
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
|
|
7
|
-
|
|
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
|
-
|
|
14
|
-
|
|
13
|
+
__publicField(this, "className", "Checkbox");
|
|
14
|
+
__publicField(this, "inputEvent", (e) => {
|
|
15
15
|
this.checked = e.target.checked;
|
|
16
16
|
});
|
|
17
|
-
this._checked =
|
|
17
|
+
this._checked = false;
|
|
18
18
|
}
|
|
19
|
-
set checked(
|
|
20
|
-
this._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
|
|
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(
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
62
|
+
event.addListener(this, "click", "wj:checkbox:change");
|
|
63
|
+
event.addListener(this, "click", "wj:checkbox:input");
|
|
42
64
|
}
|
|
43
65
|
disconnectedCallback() {
|
|
44
|
-
|
|
66
|
+
event.removeElement(this);
|
|
45
67
|
}
|
|
46
68
|
}
|
|
47
|
-
customElements.get("wj-checkbox") || window.customElements.define("wj-checkbox",
|
|
69
|
+
customElements.get("wj-checkbox") || window.customElements.define("wj-checkbox", Checkbox);
|
|
48
70
|
export {
|
|
49
|
-
|
|
71
|
+
Checkbox
|
|
50
72
|
};
|