wj-elements 0.1.6 → 0.1.7
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/dark.css +1 -0
- package/dist/light.css +1 -0
- package/dist/localize-DVuO3S17.js +43 -0
- package/dist/popup.element-Dj9j__Dh.js +1068 -0
- package/dist/router-links-FtZbFUto.js +146 -0
- package/dist/styles.css +1 -0
- package/dist/wje-accordion-item.js +88 -0
- package/dist/wje-accordion.js +79 -0
- package/dist/wje-animation.js +121 -0
- package/dist/wje-aside.js +55 -0
- package/dist/wje-avatar.js +74 -0
- package/dist/wje-badge.js +48 -0
- package/dist/wje-breadcrumb.js +148 -0
- package/dist/wje-breadcrumbs.js +67 -0
- package/dist/wje-button-group.js +78 -0
- package/dist/wje-button.js +177 -0
- package/dist/wje-card-content.js +48 -0
- package/dist/wje-card-controls.js +48 -0
- package/dist/wje-card-header.js +47 -0
- package/dist/wje-card-subtitle.js +55 -0
- package/dist/wje-card-title.js +55 -0
- package/dist/wje-card.js +48 -0
- package/dist/wje-carousel-item.js +33 -0
- package/dist/wje-carousel.js +177 -0
- package/dist/wje-checkbox.js +104 -0
- package/dist/wje-chip.js +32 -0
- package/dist/wje-col.js +27 -0
- package/dist/wje-color-picker.js +953 -0
- package/dist/wje-container.js +57 -0
- package/dist/wje-copy-button.js +164 -0
- package/dist/wje-dialog.js +86 -0
- package/dist/wje-divider.js +53 -0
- package/dist/wje-dropdown.js +68 -0
- package/dist/wje-element.js +453 -0
- package/dist/wje-fetchAndParseCSS.js +40 -0
- package/dist/wje-file-upload-item.js +115 -0
- package/dist/wje-file-upload.js +297 -0
- package/dist/wje-footer.js +56 -0
- package/dist/wje-form.js +28 -0
- package/dist/wje-format-digital.js +85 -0
- package/dist/wje-grid.js +28 -0
- package/dist/wje-header.js +58 -0
- package/dist/wje-icon-picker.js +221 -0
- package/dist/wje-icon.js +117 -0
- package/dist/wje-img-comparer.js +111 -0
- package/dist/wje-img.js +58 -0
- package/dist/wje-infinite-scroll.js +193 -0
- package/dist/wje-inline-edit.js +120 -0
- package/dist/wje-input-file.js +85 -0
- package/dist/wje-input.js +240 -0
- package/dist/wje-item.js +45 -0
- package/dist/wje-label.js +67 -0
- package/dist/wje-list.js +53 -0
- package/dist/wje-main.js +56 -0
- package/dist/wje-masonry.js +218 -0
- package/dist/wje-master.js +342 -0
- package/dist/wje-menu-button.js +65 -0
- package/dist/wje-menu-item.js +192 -0
- package/dist/wje-menu-label.js +57 -0
- package/dist/wje-menu.js +74 -0
- package/dist/wje-option.js +99 -0
- package/dist/wje-options.js +63 -0
- package/dist/wje-popup.js +5 -0
- package/dist/wje-progress-bar.js +145 -0
- package/dist/wje-radio-group.js +101 -0
- package/dist/wje-radio.js +46 -0
- package/dist/wje-rate.js +260 -0
- package/dist/wje-relative-time.js +85 -0
- package/dist/wje-route.js +28 -0
- package/dist/wje-router-link.js +64 -0
- package/dist/wje-router-outlet.js +127 -0
- package/dist/wje-routerx.js +1088 -0
- package/dist/wje-row.js +58 -0
- package/dist/wje-select.js +240 -0
- package/dist/wje-slider.js +177 -0
- package/dist/wje-split-view.js +112 -0
- package/dist/wje-store.js +192 -0
- package/dist/wje-tab-group.js +105 -0
- package/dist/wje-tab-panel.js +52 -0
- package/dist/wje-tab.js +59 -0
- package/dist/wje-textarea.js +116 -0
- package/dist/wje-thumbnail.js +64 -0
- package/dist/wje-toast.js +76 -0
- package/dist/wje-toggle.js +94 -0
- package/dist/wje-toolbar-action.js +63 -0
- package/dist/wje-toolbar.js +61 -0
- package/dist/wje-tooltip.js +105 -0
- package/dist/wje-visually-hidden.js +56 -0
- package/package.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var s = Object.defineProperty;
|
|
2
|
+
var i = (e, t, o) => t in e ? s(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
|
+
var a = (e, t, o) => (i(e, typeof t != "symbol" ? t + "" : t, o), o);
|
|
4
|
+
import r from "./wje-element.js";
|
|
5
|
+
const p = ":host{--wje-card-padding: 0 1rem 1rem;display:block;padding:var(--wje-card-padding)}:host.no-padding .row{margin-left:0;margin-right:0}:host.no-bottom-padding{padding-bottom:0}:host.no-top-padding{padding-top:0}:host .title{margin-top:0}:host.scrollable{margin-bottom:20px}:host h3{line-height:34px;font-size:26px}";
|
|
6
|
+
class m extends r {
|
|
7
|
+
/**
|
|
8
|
+
* CardContent constructor
|
|
9
|
+
* @constructor
|
|
10
|
+
*/
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
/**
|
|
14
|
+
* Class name
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
a(this, "className", "CardContent");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get CSS stylesheet
|
|
21
|
+
* @static
|
|
22
|
+
* @returns {Object} styles - The CSS styles
|
|
23
|
+
*/
|
|
24
|
+
static get cssStyleSheet() {
|
|
25
|
+
return p;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Setup attributes
|
|
29
|
+
*/
|
|
30
|
+
setupAttributes() {
|
|
31
|
+
this.isShadowRoot = "open";
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Draw method
|
|
35
|
+
* @param {Object} context - The context
|
|
36
|
+
* @param {Object} store - The store
|
|
37
|
+
* @param {Object} params - The parameters
|
|
38
|
+
* @returns {Object} fragment - The document fragment
|
|
39
|
+
*/
|
|
40
|
+
draw(o, l, c) {
|
|
41
|
+
let n = document.createDocumentFragment(), d = document.createElement("slot");
|
|
42
|
+
return n.appendChild(d), n;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
r.define("wje-card-content", m);
|
|
46
|
+
export {
|
|
47
|
+
m as default
|
|
48
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var l = Object.defineProperty;
|
|
2
|
+
var i = (e, t, o) => t in e ? l(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
|
+
var n = (e, t, o) => (i(e, typeof t != "symbol" ? t + "" : t, o), o);
|
|
4
|
+
import a from "./wje-element.js";
|
|
5
|
+
const c = ":host{--wje-card-controls-font-size: 11px;--wje-card-controls-font-family: var(--wje-font-family-secondary);font-family:var(--wje-card-controls-font-family);text-transform:uppercase;display:inline-block;letter-spacing:.06em;font-size:var(--wje-card-controls-font-size);font-weight:500;margin:0;padding:0;line-height:normal;overflow:hidden;text-overflow:ellipsis;filter:alpha(opacity=40);transition:opacity .3s ease;position:absolute;right:1rem;top:.5rem}";
|
|
6
|
+
class d extends a {
|
|
7
|
+
/**
|
|
8
|
+
* CardControls constructor
|
|
9
|
+
* @constructor
|
|
10
|
+
*/
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
/**
|
|
14
|
+
* Class name
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
n(this, "className", "CardControls");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get CSS stylesheet
|
|
21
|
+
* @static
|
|
22
|
+
* @returns {Object} styles - The CSS styles
|
|
23
|
+
*/
|
|
24
|
+
static get cssStyleSheet() {
|
|
25
|
+
return c;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Setup attributes
|
|
29
|
+
*/
|
|
30
|
+
setupAttributes() {
|
|
31
|
+
this.isShadowRoot = "open";
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Draw method
|
|
35
|
+
* @param {Object} context - The context
|
|
36
|
+
* @param {Object} store - The store
|
|
37
|
+
* @param {Object} params - The parameters
|
|
38
|
+
* @returns {Object} fragment - The document fragment
|
|
39
|
+
*/
|
|
40
|
+
draw(o, m, f) {
|
|
41
|
+
let r = document.createDocumentFragment(), s = document.createElement("slot");
|
|
42
|
+
return r.appendChild(s), r;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
a.define("wje-card-controls", d);
|
|
46
|
+
export {
|
|
47
|
+
d as default
|
|
48
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var n = Object.defineProperty;
|
|
2
|
+
var i = (t, e, r) => e in t ? n(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var s = (t, e, r) => (i(t, typeof e != "symbol" ? e + "" : e, r), r);
|
|
4
|
+
import d from "./wje-element.js";
|
|
5
|
+
const c = ':host{--wje-card-header-padding: 1rem 1rem .5rem;background:transparent;border-radius:0;border-bottom:0;padding:var(--wje-card-header-padding);position:relative;display:flex;flex-direction:column}:host(.wje-separator):after{content:"";height:1px;background:#00000014;margin-top:.5rem}';
|
|
6
|
+
class m extends d {
|
|
7
|
+
/**
|
|
8
|
+
* CardHeader constructor.
|
|
9
|
+
*/
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
/**
|
|
13
|
+
* Class name for the CardHeader.
|
|
14
|
+
* @type {string}
|
|
15
|
+
*/
|
|
16
|
+
s(this, "className", "CardHeader");
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Getter for the CSS stylesheet.
|
|
20
|
+
* @returns {Object} The styles object.
|
|
21
|
+
* @static
|
|
22
|
+
*/
|
|
23
|
+
static get cssStyleSheet() {
|
|
24
|
+
return c;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Sets up the attributes for the CardHeader.
|
|
28
|
+
*/
|
|
29
|
+
setupAttributes() {
|
|
30
|
+
this.isShadowRoot = "open";
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Draws the CardHeader.
|
|
34
|
+
* @param {Object} context - The context to draw in.
|
|
35
|
+
* @param {Object} store - The store to use.
|
|
36
|
+
* @param {Object} params - The parameters to use.
|
|
37
|
+
* @returns {DocumentFragment} The created document fragment.
|
|
38
|
+
*/
|
|
39
|
+
draw(r, p, l) {
|
|
40
|
+
let a = document.createDocumentFragment(), o = document.createElement("slot");
|
|
41
|
+
return this.hasAttribute("separator") && this.classList.add("wje-separator"), a.appendChild(o), a;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
d.define("wje-card-header", m);
|
|
45
|
+
export {
|
|
46
|
+
m as default
|
|
47
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var l = Object.defineProperty;
|
|
2
|
+
var o = (e, t, a) => t in e ? l(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
|
|
3
|
+
var s = (e, t, a) => (o(e, typeof t != "symbol" ? t + "" : t, a), a);
|
|
4
|
+
import i from "./wje-element.js";
|
|
5
|
+
const d = ":host{--wje-card-subtitle-font-size: 11px;--wje-card-subtitle-font-family: var(--wje-font-family-secondary);--wje-card-subtitle-padding: 0;transition:opacity .3s ease;font-family:var(--wje-card-subtitle-font-family);font-size:var(--wje-card-subtitle-font-size);text-transform:uppercase;display:inline-block;letter-spacing:.06em;font-weight:500;margin:0;padding:var(--wje-card-subtitle-padding);line-height:normal;overflow:hidden;text-overflow:ellipsis;filter:alpha(opacity=40)}";
|
|
6
|
+
class c extends i {
|
|
7
|
+
/**
|
|
8
|
+
* CardSubtitle constructor.
|
|
9
|
+
*/
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
/**
|
|
13
|
+
* Class name for the CardSubtitle.
|
|
14
|
+
* @type {string}
|
|
15
|
+
*/
|
|
16
|
+
s(this, "className", "CardTitle");
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Getter for the CSS stylesheet.
|
|
20
|
+
* @returns {Object} The styles object.
|
|
21
|
+
* @static
|
|
22
|
+
*/
|
|
23
|
+
static get cssStyleSheet() {
|
|
24
|
+
return d;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Getter for the observed attributes.
|
|
28
|
+
* @returns {Array} An empty array.
|
|
29
|
+
* @static
|
|
30
|
+
*/
|
|
31
|
+
static get observedAttributes() {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Sets up the attributes for the CardSubtitle.
|
|
36
|
+
*/
|
|
37
|
+
setupAttributes() {
|
|
38
|
+
this.isShadowRoot = "open";
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Draws the CardSubtitle.
|
|
42
|
+
* @param {Object} context - The context to draw in.
|
|
43
|
+
* @param {Object} store - The store to use.
|
|
44
|
+
* @param {Object} params - The parameters to use.
|
|
45
|
+
* @returns {DocumentFragment} The created document fragment.
|
|
46
|
+
*/
|
|
47
|
+
draw(a, u, f) {
|
|
48
|
+
let r = document.createDocumentFragment(), n = document.createElement("slot");
|
|
49
|
+
return r.appendChild(n), r;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
i.define("wje-card-subtitle", c);
|
|
53
|
+
export {
|
|
54
|
+
c as default
|
|
55
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var s = (e, t, i) => t in e ? d(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
|
|
3
|
+
var a = (e, t, i) => (s(e, typeof t != "symbol" ? t + "" : t, i), i);
|
|
4
|
+
import n from "./wje-element.js";
|
|
5
|
+
const o = ":host{--wje-card-title-font-size: 24px;--wje-card-title-font-weight: 500;--wje-card-title-margin: 0;--wje-card-title-padding: 0;--wje-card-title-line-height: 1.2;font-size:var(--wje-card-title-font-size);font-weight:var(--wje-card-title-font-weight);margin:var(--wje-card-title-margin);padding:var(--wje-card-title-padding);line-height:var(--wje-card-title-line-height);display:block;position:relative}";
|
|
6
|
+
class c extends n {
|
|
7
|
+
/**
|
|
8
|
+
* CardTitle constructor.
|
|
9
|
+
*/
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
/**
|
|
13
|
+
* Class name for the CardTitle.
|
|
14
|
+
* @type {string}
|
|
15
|
+
*/
|
|
16
|
+
a(this, "className", "CardTitle");
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Getter for the CSS stylesheet.
|
|
20
|
+
* @returns {Object} The styles object.
|
|
21
|
+
* @static
|
|
22
|
+
*/
|
|
23
|
+
static get cssStyleSheet() {
|
|
24
|
+
return o;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Getter for the observed attributes.
|
|
28
|
+
* @returns {Array} An empty array.
|
|
29
|
+
* @static
|
|
30
|
+
*/
|
|
31
|
+
static get observedAttributes() {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Sets up the attributes for the CardTitle.
|
|
36
|
+
*/
|
|
37
|
+
setupAttributes() {
|
|
38
|
+
this.isShadowRoot = "open";
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Draws the CardTitle.
|
|
42
|
+
* @param {Object} context - The context to draw in.
|
|
43
|
+
* @param {Object} store - The store to use.
|
|
44
|
+
* @param {Object} params - The parameters to use.
|
|
45
|
+
* @returns {DocumentFragment} The created document fragment.
|
|
46
|
+
*/
|
|
47
|
+
draw(i, g, w) {
|
|
48
|
+
let r = document.createDocumentFragment(), l = document.createElement("slot");
|
|
49
|
+
return r.appendChild(l), r;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
n.define("wje-card-title", c);
|
|
53
|
+
export {
|
|
54
|
+
c as default
|
|
55
|
+
};
|
package/dist/wje-card.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var n = Object.defineProperty;
|
|
2
|
+
var d = (r, o, e) => o in r ? n(r, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[o] = e;
|
|
3
|
+
var t = (r, o, e) => (d(r, typeof o != "symbol" ? o + "" : o, e), e);
|
|
4
|
+
import l from "./wje-element.js";
|
|
5
|
+
const i = ":host{--wje-card-margin-top: 0;--wje-card-margin-bottom: 1rem;--wje-card-margin-inline: 0;--wje-card-border-color: transparent}:host(.wje-color-primary){--wje-card-background: var(--wje-color-primary)}:host(.wje-color-complete){--wje-card-background: var(--wje-color-complete)}:host(.wje-color-success){--wje-card-background: var(--wje-color-success)}:host(.wje-color-warning){--wje-card-background: var(--wje-color-warning)}:host(.wje-color-danger){--wje-card-background: var(--wje-color-danger)}:host(.wje-color-info){--wje-card-background: var(--wje-color-info)}:host(.wje-color-menu){--wje-card-background: var(--wje-color-menu)}:host(.wje-color-primary){--wje-card-color: var(--wje-color-white)}:host(.wje-color-complete){--wje-card-color: var(--wje-color-white)}:host(.wje-color-success){--wje-card-color: var(--wje-color-white)}:host(.wje-color-warning){--wje-card-color: var(--wje-color)}:host(.wje-color-danger){--wje-card-color: var(--wje-color-white)}:host(.wje-color-info){--wje-card-color: var(--wje-color-white)}:host(.wje-color-menu){--wje-card-color: var(--wje-color-white) !important}:host{background-color:var(--wje-card-background);color:var(--wje-card-color)!important;margin-top:var(--wje-card-margin-top);margin-bottom:var(--wje-card-margin-bottom);margin-inline:var(--wje-card-margin-inline);box-shadow:var(--wje-box-shadow-large);border-color:var(--wje-border-color);border-style:var(--wje-border-style);border-width:var(--wje-border-size);border-radius:var(--wje-border-radius-medium);font-family:var(--wje-font-family);font-size:var(--wje-font-size);line-height:var(--wje-line-height);position:relative;width:100%;word-wrap:normal;display:flex;flex-direction:column;overflow:hidden;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host(.wje-color){background-color:var(--wje-card-background, #fff);color:var(--wje-card-color)}";
|
|
6
|
+
class s extends l {
|
|
7
|
+
/**
|
|
8
|
+
* Card constructor
|
|
9
|
+
* @constructor
|
|
10
|
+
*/
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
/**
|
|
14
|
+
* Class name
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
t(this, "className", "Card");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get CSS stylesheet
|
|
21
|
+
* @static
|
|
22
|
+
* @returns {Object} styles - The CSS styles
|
|
23
|
+
*/
|
|
24
|
+
static get cssStyleSheet() {
|
|
25
|
+
return i;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Setup attributes
|
|
29
|
+
*/
|
|
30
|
+
setupAttributes() {
|
|
31
|
+
this.isShadowRoot = "open";
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Draw method
|
|
35
|
+
* @param {Object} context - The context
|
|
36
|
+
* @param {Object} store - The store
|
|
37
|
+
* @param {Object} params - The parameters
|
|
38
|
+
* @returns {Object} fragment - The document fragment
|
|
39
|
+
*/
|
|
40
|
+
draw(e, j, a) {
|
|
41
|
+
let c = document.createDocumentFragment(), w = document.createElement("slot");
|
|
42
|
+
return a.color && this.classList.add("wje-color-" + a.color, "wje-color"), c.appendChild(w), c;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
l.define("wje-card", s);
|
|
46
|
+
export {
|
|
47
|
+
s as default
|
|
48
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var o = Object.defineProperty;
|
|
2
|
+
var c = (e, t, a) => t in e ? o(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
|
|
3
|
+
var r = (e, t, a) => (c(e, typeof t != "symbol" ? t + "" : t, a), a);
|
|
4
|
+
import n, { event as d } from "./wje-element.js";
|
|
5
|
+
const m = ":host{--aspect-ratio: inherit;display:flex;align-items:center;justify-content:center;flex-direction:column;width:var(--wje-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(wje-img){width:100%!important;height:100%!important;object-fit:contain;display:flex}";
|
|
6
|
+
class u extends n {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
r(this, "className", "CarouselItem");
|
|
10
|
+
}
|
|
11
|
+
static get cssStyleSheet() {
|
|
12
|
+
return m;
|
|
13
|
+
}
|
|
14
|
+
static get observedAttributes() {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
setupAttributes() {
|
|
18
|
+
this.isShadowRoot = "open";
|
|
19
|
+
}
|
|
20
|
+
draw(a, p, h) {
|
|
21
|
+
let i = document.createDocumentFragment(), s = document.createElement("div");
|
|
22
|
+
s.classList.add("native-carousel-item"), s.setAttribute("part", "native");
|
|
23
|
+
let l = document.createElement("slot");
|
|
24
|
+
return s.appendChild(l), i.appendChild(s), i;
|
|
25
|
+
}
|
|
26
|
+
afterDraw() {
|
|
27
|
+
d.addListener(this, "click", "wje-carousel-item:click");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
n.define("wje-carousel-item", u);
|
|
31
|
+
export {
|
|
32
|
+
u as default
|
|
33
|
+
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
var v = Object.defineProperty;
|
|
2
|
+
var p = (o, a, e) => a in o ? v(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 m from "./wje-element.js";
|
|
5
|
+
const b = ":host{--wje-scroll-hint: 0px;--wje-carousel-width: 100%;--wje-carousel-height: auto;--wje-carousel-size: 100% }.native-carousel{position:relative;width:var(--wje-carousel-width, 100%);height:var(--wje-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(--wje-aspect-ratio, 4 / 3);scroll-snap-type:x mandatory;scroll-padding-inline:0;overflow-y:hidden;padding-inline:var(--wje-spacing-inline, 0);gap:.5rem}.carousel-slides::-webkit-scrollbar{display:none}::slotted(wje-carousel-item){flex:0 0 var(--wje-carousel-size);height:100%}wje-button{position:absolute;top:50%;border:none;cursor:pointer;z-index:2}.prev{left:-1rem;transform:translate(-100%,-50%)}.next{right:-1rem;transform:translate(100%,-50%)}.pagination{position:relative;bottom:-.5rem;left:50%;transform:translate(-50%,100%);display:flex;z-index:2;justify-content:center}.pagination-item{cursor:pointer;height:15px;width:15px;margin:0 2px;background-color:var(--wje-color-contrast-4);display:inline-block;border-radius:50%}.pagination-item.active{background-color:var(--wje-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 wje-thumbnail{--wje-thumbnail-width: 48px;--wje-thumbnail-height: 48px;--wje-thumbnail-border-radius: 0;cursor:pointer;border:1px solid transparent}.thumbnails .active{border:1px solid var(--wje-color-primary-11)}";
|
|
6
|
+
class f extends m {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
u(this, "className", "Carousel");
|
|
10
|
+
this.slidePerPage = 1;
|
|
11
|
+
}
|
|
12
|
+
set activeSlide(e) {
|
|
13
|
+
this.setAttribute("active-slide", e);
|
|
14
|
+
}
|
|
15
|
+
get activeSlide() {
|
|
16
|
+
return +this.getAttribute("active-slide") || 0;
|
|
17
|
+
}
|
|
18
|
+
get pagination() {
|
|
19
|
+
return this.hasAttribute("pagination");
|
|
20
|
+
}
|
|
21
|
+
get navigation() {
|
|
22
|
+
return this.hasAttribute("navigation");
|
|
23
|
+
}
|
|
24
|
+
get thumbnails() {
|
|
25
|
+
return this.hasAttribute("thumbnails");
|
|
26
|
+
}
|
|
27
|
+
get loop() {
|
|
28
|
+
return this.hasAttribute("loop");
|
|
29
|
+
}
|
|
30
|
+
static get cssStyleSheet() {
|
|
31
|
+
return b;
|
|
32
|
+
}
|
|
33
|
+
static get observedAttributes() {
|
|
34
|
+
return ["active-slide"];
|
|
35
|
+
}
|
|
36
|
+
attributeChangedCallback(e, i, n) {
|
|
37
|
+
e === "active-slide" && (this.pagination && this.changePagination(), this.thumbnails && this.changeThumbnails());
|
|
38
|
+
}
|
|
39
|
+
setupAttributes() {
|
|
40
|
+
this.isShadowRoot = "open";
|
|
41
|
+
}
|
|
42
|
+
beforeDraw(e, i, n) {
|
|
43
|
+
this.cloneFirstAndLastItems();
|
|
44
|
+
}
|
|
45
|
+
draw(e, i, n) {
|
|
46
|
+
let r = document.createDocumentFragment(), t = document.createElement("div");
|
|
47
|
+
t.classList.add("native-carousel");
|
|
48
|
+
let s = document.createElement("div");
|
|
49
|
+
s.classList.add("carousel-slides");
|
|
50
|
+
let l = document.createElement("slot");
|
|
51
|
+
return s.appendChild(l), t.appendChild(s), this.navigation && (this.prevButton = this.createPreviousButton(), this.nextButton = this.createNextButton(), t.appendChild(this.prevButton), t.appendChild(this.nextButton)), this.pagination && t.appendChild(this.createPagination()), this.thumbnails && t.appendChild(this.createThumbnails()), r.appendChild(t), this.slides = s, r;
|
|
52
|
+
}
|
|
53
|
+
afterDraw() {
|
|
54
|
+
this.setIntersectionObserver(), this.getSlidesWithClones().forEach((i, n) => {
|
|
55
|
+
this.intersectionObserver.observe(i);
|
|
56
|
+
}), this.slidePerPage = this.getAttribute("slide-per-page") || 1;
|
|
57
|
+
let e = 100 / +this.slidePerPage;
|
|
58
|
+
this.style.setProperty("--wje-carousel-size", e + "%"), this.goToSlide(this.activeSlide, "auto"), this.slides.addEventListener("scrollend", (i) => {
|
|
59
|
+
const n = this.getSlides(), t = [...this.entriesMap.values()].find((s) => s.isIntersecting);
|
|
60
|
+
if (t != null && t.target.classList.contains("clone")) {
|
|
61
|
+
const s = +t.target.getAttribute("clone-index");
|
|
62
|
+
this.goToSlide(s, "auto"), this.activeSlide = s;
|
|
63
|
+
} else if (t) {
|
|
64
|
+
let s = n.indexOf(t.target);
|
|
65
|
+
this.activeSlide = s;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
setIntersectionObserver() {
|
|
70
|
+
this.intersectionObserver = new IntersectionObserver((e) => {
|
|
71
|
+
e.forEach((i) => {
|
|
72
|
+
this.entriesMap.set(i.target, i);
|
|
73
|
+
});
|
|
74
|
+
}, {
|
|
75
|
+
root: this.context.querySelector(".carousel-slides"),
|
|
76
|
+
threshold: 0.5
|
|
77
|
+
}), this.entriesMap = /* @__PURE__ */ new Map(), this.records = this.intersectionObserver.takeRecords(), this.records.forEach((e) => {
|
|
78
|
+
this.entriesMap.set(e.target, e);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
goToSlide(e, i = "smooth", n = !0) {
|
|
82
|
+
const r = this.getSlides(), t = this.getSlidesWithClones();
|
|
83
|
+
t.forEach((g, S) => {
|
|
84
|
+
g.classList.remove("active");
|
|
85
|
+
});
|
|
86
|
+
let s = this.loop ? (e + r.length) % r.length : Math.min(Math.max(e, 0), r.length - 1);
|
|
87
|
+
this.activeSlide = s;
|
|
88
|
+
const l = Math.min(Math.max(e + (this.loop ? this.slidePerPage : 0), 0), t.length - 1), c = this.getSlidesWithClones()[l];
|
|
89
|
+
c.classList.add("active");
|
|
90
|
+
let d = c.getBoundingClientRect(), h = this.slides.getBoundingClientRect();
|
|
91
|
+
this.slides.scrollTo({
|
|
92
|
+
left: d.left - h.left + this.slides.scrollLeft,
|
|
93
|
+
top: d.top - h.top + this.slides.scrollTop,
|
|
94
|
+
behavior: i === "smooth" ? "smooth" : "auto"
|
|
95
|
+
}), this.navigation && !this.loop && (this.nextButton.removeAttribute("disabled"), this.prevButton.removeAttribute("disabled"), this.activeSlide === r.length - 1 && this.nextButton.setAttribute("disabled", ""), this.activeSlide === 0 && this.prevButton.setAttribute("disabled", ""));
|
|
96
|
+
}
|
|
97
|
+
cloneFirstAndLastItems() {
|
|
98
|
+
const e = this.getSlides();
|
|
99
|
+
if (e.length && this.loop) {
|
|
100
|
+
const i = e[0].cloneNode(!0);
|
|
101
|
+
i.classList.add("clone"), i.setAttribute("clone-index", 0), this.appendChild(i);
|
|
102
|
+
const n = e[e.length - 1].cloneNode(!0);
|
|
103
|
+
n.classList.add("clone"), n.setAttribute("clone-index", e.length - 1), this.insertBefore(n, this.firstChild);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
removeActiveSlide() {
|
|
107
|
+
this.getSlidesWithClones().forEach((e, i) => {
|
|
108
|
+
e.classList.remove("active");
|
|
109
|
+
}), this.pagination && this.context.querySelectorAll(".pagination-item").forEach((e) => {
|
|
110
|
+
e.classList.remove("active");
|
|
111
|
+
}), this.thumbnails && this.context.querySelectorAll("wje-thumbnail").forEach((e) => {
|
|
112
|
+
e.classList.remove("active");
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
changePagination() {
|
|
116
|
+
this.pagination && (this.removeActiveSlide(), this.context.querySelectorAll(".pagination-item").forEach((e, i) => {
|
|
117
|
+
i === this.activeSlide && e.classList.add("active");
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
120
|
+
changeThumbnails() {
|
|
121
|
+
this.thumbnails && (this.removeActiveSlide(), this.context.querySelectorAll("wje-thumbnail").forEach((e, i) => {
|
|
122
|
+
i === this.activeSlide && e.classList.add("active");
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
createNextButton() {
|
|
126
|
+
const e = document.createElement("wje-button");
|
|
127
|
+
return e.classList.add("next"), e.innerHTML = '<wje-icon name="chevron-right" size="large"></wje-icon>', e.setAttribute("circle", ""), e.setAttribute("fill", "link"), e.addEventListener("click", (i) => {
|
|
128
|
+
this.nextSlide();
|
|
129
|
+
}), e;
|
|
130
|
+
}
|
|
131
|
+
createPreviousButton() {
|
|
132
|
+
const e = document.createElement("wje-button");
|
|
133
|
+
return e.classList.add("prev"), e.innerHTML = '<wje-icon name="chevron-left" size="large"></wje-icon>', e.setAttribute("circle", ""), e.setAttribute("fill", "link"), e.addEventListener("click", (i) => {
|
|
134
|
+
this.previousSlide();
|
|
135
|
+
}), e;
|
|
136
|
+
}
|
|
137
|
+
createPagination() {
|
|
138
|
+
const e = document.createElement("div");
|
|
139
|
+
return e.classList.add("pagination"), this.getSlides().forEach((n, r) => {
|
|
140
|
+
const t = document.createElement("div");
|
|
141
|
+
t.classList.add("pagination-item"), t.addEventListener("click", (s) => {
|
|
142
|
+
this.removeActiveSlide(), s.target.classList.add("active"), this.goToSlide(r);
|
|
143
|
+
}), e.appendChild(t);
|
|
144
|
+
}), e;
|
|
145
|
+
}
|
|
146
|
+
createThumbnails() {
|
|
147
|
+
const e = document.createElement("div");
|
|
148
|
+
return e.classList.add("thumbnails"), this.getSlides().forEach((n, r) => {
|
|
149
|
+
const t = document.createElement("wje-thumbnail");
|
|
150
|
+
t.innerHTML = `<img src="${n.querySelector("wje-img").getAttribute("src")}"></img>`, t.addEventListener("click", (s) => {
|
|
151
|
+
this.removeActiveSlide(), s.target.closest("wje-thumbnail").classList.add("active"), this.goToSlide(r);
|
|
152
|
+
}), e.appendChild(t);
|
|
153
|
+
}), e;
|
|
154
|
+
}
|
|
155
|
+
nextSlide() {
|
|
156
|
+
this.goToSlide(this.activeSlide + this.slidePerPage);
|
|
157
|
+
}
|
|
158
|
+
previousSlide() {
|
|
159
|
+
this.goToSlide(this.activeSlide - this.slidePerPage);
|
|
160
|
+
}
|
|
161
|
+
getSlides() {
|
|
162
|
+
return Array.from(this.querySelectorAll("wje-carousel-item:not(.clone)"));
|
|
163
|
+
}
|
|
164
|
+
getSlidesWithClones() {
|
|
165
|
+
return Array.from(this.querySelectorAll("wje-carousel-item"));
|
|
166
|
+
}
|
|
167
|
+
canGoNext() {
|
|
168
|
+
return this.querySelector(".native-carousel").scrollLeft < this.querySelector(".native-carousel").scrollWidth;
|
|
169
|
+
}
|
|
170
|
+
canGoPrevious() {
|
|
171
|
+
return this.querySelector(".native-carousel").scrollLeft > 0;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
m.define("wje-carousel", f);
|
|
175
|
+
export {
|
|
176
|
+
f as default
|
|
177
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
var s = Object.defineProperty;
|
|
2
|
+
var h = (c, t, e) => t in c ? s(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
|
|
3
|
+
var l = (c, t, e) => (h(c, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
+
import b, { event as a } from "./wje-element.js";
|
|
5
|
+
const d = ':host{--wje-grey-check-icon: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAAQAgMAAADsa5zLAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAMUExURUdwTHBwcG9vb3BwcBFjhIYAAAAEdFJOUwBG9tQE3MceAAAAVUlEQVQoz2NgGLKA0QGIDwDxBSCeAMEYgAWI2YCK2CagYgwgDcRSDhgYbAkKzsSKGdgakCyY6ADES7BiiCkgJ4PYyybgxAhQAsRZDrgxCpDEg4cAAAAp2ibhZRGLHgAAAABJRU5ErkJggg==) left center;--wje-white-check-icon: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAAQAgMAAADsa5zLAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAMUExURUdwTP///////////waf0AoAAAAEdFJOUwBG9tQE3MceAAAAVUlEQVQoz2NgGLKA0QGIDwDxBSCeAMEYgAWI2YCK2CagYgwgDcRSDhgYbAkKzsSKGdgakCyY6ADES7BiiCkgJ4PYyybgxAhQAsRZDrgxCpDEg4cAAAAp2ibhZRGLHgAAAABJRU5ErkJggg==) left center;--wje-checkbox-margin-top: 0;--wje-checkbox-margin-bottom: .5rem;--wje-checkbox-margin-inline: 0;--wje-checkbox-width: 16px;--wje-checkbox-height: 16px;display:block;margin-top:var(--wje-checkbox-margin-top);margin-bottom:var(--wje-checkbox-margin-bottom);margin-inline:var(--wje-checkbox-margin-inline);line-height:100%;padding-left:0}:host label{display:inline-block;cursor:pointer;position:relative;padding-left:25px;min-width:var(--wje-checkbox-width);min-height:var(--wje-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(--wje-color-contrast-lowest);border:1px solid var(--wje-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(--wje-color-contrast-highest)}.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(--wje-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(--wje-color-contrast-highest)}.native-checkbox input[type=checkbox]:focus+label:before{outline:none!important;box-shadow:#78c8fe 0 0}.native-checkbox input[type=checkbox][disabled]+label{cursor:not-allowed!important;color:var(--wje-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(--wje-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 :is(input[type=checkbox]:checked+label):before,.success :is(input[type=checkbox]:indeterminate+label):before{border-color:var(--wje-color-success);background-color:var(--wje-color-success)}.primary :is(input[type=checkbox]:checked+label):before,.primary :is(input[type=checkbox]:indeterminate+label):before{border-color:var(--wje-color-primary);background-color:var(--wje-color-primary)}.complete :is(input[type=checkbox]:checked+label):before,.complete :is(input[type=checkbox]:indeterminate+label):before{border-color:var(--wje-color-complete);background-color:var(--wje-color-complete)}.warning :is(input[type=checkbox]:checked+label):before,.warning :is(input[type=checkbox]:indeterminate+label):before{border-color:var(--wje-color-warning);background-color:var(--wje-color-warning)}.danger :is(input[type=checkbox]:checked+label):before,.danger :is(input[type=checkbox]:indeterminate+label):before{border-color:var(--wje-color-danger);background-color:var(--wje-color-danger)}.info :is(input[type=checkbox]:checked+label):before,.info :is(input[type=checkbox]:indeterminate+label):before{border-color:var(--wje-color-info);background-color:var(--wje-color-info)}.info :is(input[type=checkbox]:checked+label):after,.danger :is(input[type=checkbox]:checked+label):after,.complete :is(input[type=checkbox]:checked+label):after,.primary :is(input[type=checkbox]:checked+label):after,.success :is(input[type=checkbox]:checked+label):after{background:var(--wje-white-check-icon)}.info :is(input[type=checkbox]:indeterminate+label):after,.danger :is(input[type=checkbox]:indeterminate+label):after,.complete :is(input[type=checkbox]:indeterminate+label):after,.primary :is(input[type=checkbox]:indeterminate+label):after,.success :is(input[type=checkbox]:indeterminate+label):after{background-color:var(--wje-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(--wje-color-primary)!important;font-size:50px}';
|
|
6
|
+
class p extends b {
|
|
7
|
+
/**
|
|
8
|
+
* Checkbox constructor.
|
|
9
|
+
*/
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
/**
|
|
13
|
+
* The class name.
|
|
14
|
+
*/
|
|
15
|
+
l(this, "className", "Checkbox");
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @summary Set checked attribute
|
|
19
|
+
* @returns {boolean} true if the toggle is checked, false otherwise
|
|
20
|
+
*/
|
|
21
|
+
set disabled(e) {
|
|
22
|
+
e ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @summary Get disabled attribute
|
|
26
|
+
* @returns {boolean} true if the toggle is disabled, false otherwise
|
|
27
|
+
*/
|
|
28
|
+
get disabled() {
|
|
29
|
+
return this.hasAttribute("disabled");
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @summary Set checked attribute
|
|
33
|
+
* @returns {boolean} true if the toggle is checked, false otherwise
|
|
34
|
+
*/
|
|
35
|
+
set checked(e) {
|
|
36
|
+
e ? this.setAttribute("checked", "") : this.removeAttribute("checked");
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @summary Get checked attribute
|
|
40
|
+
* @returns {boolean} true if the toggle is checked, false otherwise
|
|
41
|
+
*/
|
|
42
|
+
get checked() {
|
|
43
|
+
return this.hasAttribute("checked");
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Getter for the CSS stylesheet.
|
|
47
|
+
* @returns {string} The CSS stylesheet.
|
|
48
|
+
*/
|
|
49
|
+
static get cssStyleSheet() {
|
|
50
|
+
return d;
|
|
51
|
+
}
|
|
52
|
+
static get observedAttributes() {
|
|
53
|
+
return ["checked", "disabled"];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Sets up the attributes for the checkbox.
|
|
57
|
+
*/
|
|
58
|
+
setupAttributes() {
|
|
59
|
+
this.isShadowRoot = "open";
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Draws the checkbox.
|
|
63
|
+
* @param {object} context - The context.
|
|
64
|
+
* @param {object} store - The store.
|
|
65
|
+
* @param {object} params - The parameters.
|
|
66
|
+
* @returns {DocumentFragment} The created fragment.
|
|
67
|
+
*/
|
|
68
|
+
draw(e, k, u) {
|
|
69
|
+
let n = document.createDocumentFragment(), i = document.createElement("div");
|
|
70
|
+
i.classList.add("native-checkbox"), this.variant === "circle" && i.classList.add("checkbox-circle"), this.color && i.classList.add(this.color);
|
|
71
|
+
let o = document.createElement("input");
|
|
72
|
+
o.type = "checkbox", o.id = "checkbox", o.name = this.name = "checkbox", o.checked = this.hasAttribute("checked"), o.disabled = this.hasAttribute("disabled"), o.indeterminate = this.hasAttribute("indeterminate");
|
|
73
|
+
let r = document.createElement("label");
|
|
74
|
+
return r.htmlFor = "checkbox", r.innerHTML = "<slot></slot>", i.appendChild(o), i.appendChild(r), this.input = o, n.appendChild(i), n;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Adds an event listener after drawing the checkbox.
|
|
78
|
+
*/
|
|
79
|
+
afterDraw() {
|
|
80
|
+
this.disabled || (this.input.addEventListener("input", (e) => {
|
|
81
|
+
this.checked = e.target.checked, a.dispatchCustomEvent(this, "wje-toggle:input");
|
|
82
|
+
}), this.input.addEventListener("change", (e) => {
|
|
83
|
+
this.checked = e.target.checked, a.dispatchCustomEvent(this, "wje-toggle:change");
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Handles the input event.
|
|
88
|
+
* @param {Event} e - The event.
|
|
89
|
+
*/
|
|
90
|
+
// inputEvent = (e) => {
|
|
91
|
+
// this.checked = this.input.checked;
|
|
92
|
+
// event.dispatchCustomEvent(this, "wje-checkbox:change");
|
|
93
|
+
// }
|
|
94
|
+
/**
|
|
95
|
+
* Removes the event listener when the checkbox is disconnected.
|
|
96
|
+
*/
|
|
97
|
+
disconnectedCallback() {
|
|
98
|
+
a.removeElement(this.input);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
b.define("wje-checkbox", p);
|
|
102
|
+
export {
|
|
103
|
+
p as default
|
|
104
|
+
};
|
package/dist/wje-chip.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var w = (o, e, t) => e in o ? h(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var n = (o, e, t) => (w(o, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import s, { event as d } from "./wje-element.js";
|
|
5
|
+
const p = ":host{--wje-chip-border-radius: 100px;--wje-chip-background: var(--wje-color-contrast-2);--wje-chip-color: var(--wje-color-contrast-6);--wje-chip-margin: 0;margin:var(--wje-chip-margin)}:host(.wje-color-primary){--wje-chip-background: var(--wje-color-primary)}:host(.wje-color-complete){--wje-chip-background: var(--wje-color-complete)}:host(.wje-color-success){--wje-chip-background: var(--wje-color-success)}:host(.wje-color-warning){--wje-chip-background: var(--wje-color-warning)}:host(.wje-color-danger){--wje-chip-background: var(--wje-color-danger)}:host(.wje-color-info){--wje-chip-background: var(--wje-color-info)}:host(.wje-color-menu){--wje-chip-background: var(--wje-color-menu)}:host(.wje-color-primary){--wje-chip-color: var(--wje-color-white)}:host(.wje-color-complete){--wje-chip-color: var(--wje-color-white)}:host(.wje-color-success){--wje-chip-color: var(--wje-color-white)}:host(.wje-color-warning){--wje-chip-color: var(--wje-color)}:host(.wje-color-danger){--wje-chip-color: var(--wje-color-white)}:host(.wje-color-info){--wje-chip-color: var(--wje-color-white)}:host(.wje-color-menu){--wje-chip-color: var(--wje-color-white) !important}.native-chip{display:inline-flex;justify-content:center;align-items:center;font-size:14px;letter-spacing:-.006em;margin:0;padding:.5rem .75rem;text-align:center;cursor:pointer;white-space:nowrap;background:var(--wje-chip-background);color:var(--wje-chip-color);text-shadow:none;box-shadow:none;border:0 none;line-height:14px;min-height:28px;height:28px;width:100%;max-width:fit-content;min-width:28px;position:relative;transition:width .15s cubic-bezier(.4,0,.2,1);border-radius:var(--wje-chip-border-radius);overflow:hidden;vertical-align:middle;box-sizing:border-box}:host(.focus){box-shadow:none}:host(:hover:not(.wje-active)) .native-chip{background:var(--wje-color-contrast-3);color:var(--wje-color)}:host(.wje-active) .native-chip{border:1px solid var(--wje-color-primary-11)}:host(:focus,:active:focus,.wje-active:focus){outline:none!important}.check{display:none}:host([active]) .check{display:block;margin-inline:4px 0}:host([disabled]){opacity:.5;border:0;pointer-events:none;cursor:not-allowed}::slotted(wje-avatar){width:22px;height:22px}::slotted(wje-avatar:first-child){margin-inline:-8px 8px;margin-top:-4px;margin-bottom:-4px}:host .native-chip{background-color:var(--wje-chip-background, #fff);color:var(--wje-chip-color)}::slotted(wje-icon:first-child){margin:-4px 8px -4px -4px}::slotted(wje-icon:last-child){margin:-4px -4px -4px 8px}wje-button{--wje-button-border-radius: 50%;--wje-button-margin-inline: .25rem -.5rem;--wje-padding-top: .15rem;--wje-padding-start: .15rem;--wje-padding-end: .15rem;--wje-padding-bottom: .15rem}";
|
|
6
|
+
class j extends s {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
n(this, "className", "Chip");
|
|
10
|
+
}
|
|
11
|
+
static get cssStyleSheet() {
|
|
12
|
+
return p;
|
|
13
|
+
}
|
|
14
|
+
setupAttributes() {
|
|
15
|
+
this.isShadowRoot = "open";
|
|
16
|
+
}
|
|
17
|
+
draw(t, m, u) {
|
|
18
|
+
let a = document.createDocumentFragment(), r = document.createElement("div");
|
|
19
|
+
r.classList.add("native-chip");
|
|
20
|
+
let l = document.createElement("slot"), i = document.createElement("wje-button");
|
|
21
|
+
i.setAttribute("part", "remove"), i.setAttribute("fill", "link"), i.innerHTML = '<wje-icon name="x"></wje-icon>';
|
|
22
|
+
let c = document.createElement("wje-icon");
|
|
23
|
+
return c.setAttribute("name", "check"), c.classList.add("check"), this.color && this.classList.add("wje-color-" + this.color, "wje-color"), this.disabled && this.classList.add("wje-disabled"), this.outline && this.classList.add("wje-outline"), r.appendChild(l), r.appendChild(c), this.hasAttribute("removable") && r.appendChild(i), a.appendChild(r), this.remove = i, a;
|
|
24
|
+
}
|
|
25
|
+
afterDraw() {
|
|
26
|
+
d.addListener(this.remove, "click", "wje:chip-remove", null, { stopPropagation: !0 });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
s.define("wje-chip", j);
|
|
30
|
+
export {
|
|
31
|
+
j as default
|
|
32
|
+
};
|