wj-elements 0.1.48 → 0.1.49
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/custom-elements.json +14058 -0
- package/dist/dark.css +1 -0
- package/dist/light.css +1 -0
- package/dist/localize.js +45 -0
- package/dist/popup.element-CWsSOxs2.js +1072 -0
- package/dist/router-links-FtZbFUto.js +146 -0
- package/dist/styles.css +1 -0
- package/dist/web-types.json +3122 -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 +77 -0
- package/dist/wje-badge.js +50 -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 +207 -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 +50 -0
- package/dist/wje-carousel-item.js +33 -0
- package/dist/wje-carousel.js +177 -0
- package/dist/wje-checkbox.js +96 -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 +170 -0
- package/dist/wje-dialog.js +86 -0
- package/dist/wje-divider.js +53 -0
- package/dist/wje-dropdown.js +114 -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 +119 -0
- package/dist/wje-img-comparer.js +111 -0
- package/dist/wje-img.js +58 -0
- package/dist/wje-infinite-scroll.js +201 -0
- package/dist/wje-inline-edit.js +145 -0
- package/dist/wje-input-file.js +85 -0
- package/dist/wje-input.js +334 -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 +423 -0
- package/dist/wje-menu-button.js +65 -0
- package/dist/wje-menu-item.js +230 -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 +161 -0
- package/dist/wje-qr-code.js +2332 -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-reorder-dropzone.js +27 -0
- package/dist/wje-reorder-handle.js +115 -0
- package/dist/wje-reorder-item.js +32 -0
- package/dist/wje-reorder.js +138 -0
- package/dist/wje-route.js +46 -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 +242 -0
- package/dist/wje-slider.js +177 -0
- package/dist/wje-sliding-container.js +277 -0
- package/dist/wje-split-view.js +112 -0
- package/dist/wje-status.js +54 -0
- package/dist/wje-store.js +192 -0
- package/dist/wje-tab-group.js +107 -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 +116 -0
- package/dist/wje-visually-hidden.js +56 -0
- package/package.json +1 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var m = (a, e, t) => e in a ? u(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
|
+
var v = (a, e, t) => (m(a, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import h from "./wje-element.js";
|
|
5
|
+
const g = ":host{--wje-tab-top: 0;--wje-tab-start: 0;--wje-tab-end: 0;--wje-tab-bottom: 0}.native-tab-group{display:flex;flex-direction:column;overflow:hidden;position:relative}.native-tab-group>header{display:flex;flex-direction:column}.native-tab-group>header>nav{display:flex}.native-tab-group>section{width:100%}.native-tab-group>section>article{scroll-snap-align:start;overflow-y:auto;overscroll-behavior-y:contain}:host([variant=top]){--wje-tab-top: auto !important;--wje-tab-writing-mode: horizontal-tb}:host([variant=top]) .native-tab-group{flex-direction:column}:host([variant=top]) nav{border-bottom:1px solid var(--wje-border-color)}:host([variant=start]){--wje-tab-start: auto !important;--wje-tab-writing-mode: vertical-rl}:host([variant=start]) .native-tab-group{flex-direction:row}:host([variant=start]) nav{flex-direction:column;border-right:1px solid var(--wje-border-color)}:host([variant=end]){--wje-tab-writing-mode: vertical-rl}:host([variant=end]) .native-tab-group{flex-direction:row-reverse}:host([variant=end]) nav{flex-direction:column;border-left:1px solid var(--wje-border-color)}:host([variant=bottom]){--wje-tab-bottom: auto !important;--wje-tab-writing-mode: horizontal-tb}:host([variant=bottom]) .native-tab-group{flex-direction:column-reverse}:host([variant=bottom]) nav{border-top:1px solid var(--wje-border-color)}";
|
|
6
|
+
class b extends h {
|
|
7
|
+
/**
|
|
8
|
+
* Creates an instance of TabGroup.
|
|
9
|
+
*
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
v(this, "className", "TabGroup");
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Returns the CSS styles for the component.
|
|
18
|
+
*
|
|
19
|
+
* @static
|
|
20
|
+
* @returns {CSSStyleSheet}
|
|
21
|
+
*/
|
|
22
|
+
static get cssStyleSheet() {
|
|
23
|
+
return g;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Sets up the attributes for the component.
|
|
27
|
+
*/
|
|
28
|
+
setupAttributes() {
|
|
29
|
+
this.isShadowRoot = "open";
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Draws the component.
|
|
33
|
+
*
|
|
34
|
+
* @param {Object} context - The context for drawing.
|
|
35
|
+
* @param {Object} store - The store for drawing.
|
|
36
|
+
* @param {Object} params - The parameters for drawing.
|
|
37
|
+
* @returns {DocumentFragment}
|
|
38
|
+
*/
|
|
39
|
+
draw(t, l, i) {
|
|
40
|
+
let s = document.createDocumentFragment(), r = document.createElement("div");
|
|
41
|
+
r.setAttribute("part", "native"), r.classList.add("native-tab-group");
|
|
42
|
+
let o = document.createElement("header");
|
|
43
|
+
o.setAttribute("part", "tabs"), o.classList.add("scroll-snap-x");
|
|
44
|
+
let c = document.createElement("nav"), n = document.createElement("section");
|
|
45
|
+
n.setAttribute("part", "panels");
|
|
46
|
+
let p = document.createElement("slot"), d = document.createElement("slot");
|
|
47
|
+
return d.setAttribute("name", "nav"), o.appendChild(c), c.appendChild(d), n.appendChild(p), r.appendChild(o), r.appendChild(n), s.appendChild(r), s;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Sets up the event listeners after the component is drawn.
|
|
51
|
+
*/
|
|
52
|
+
afterDraw() {
|
|
53
|
+
let t = this.getActiveTab(), l = t ? t[0].name : this.getTabAll()[0].panel;
|
|
54
|
+
this.setActiveTab(l), this.addEventListener("wje:tab-change", (i) => {
|
|
55
|
+
if (i.detail.context.hasAttribute("disabled"))
|
|
56
|
+
return !1;
|
|
57
|
+
this.setActiveTab(i.detail.context.panel);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Removes the active attribute from all tabs and panels.
|
|
62
|
+
*/
|
|
63
|
+
removeActiveTab() {
|
|
64
|
+
this.getPanelAll().forEach((t) => {
|
|
65
|
+
t.removeAttribute("active");
|
|
66
|
+
}), this.getTabAll().forEach((t) => {
|
|
67
|
+
t.removeAttribute("active");
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Sets the active tab and panel.
|
|
72
|
+
*
|
|
73
|
+
* @param {string} tab - The name of the tab to set as active.
|
|
74
|
+
*/
|
|
75
|
+
setActiveTab(t) {
|
|
76
|
+
this.removeActiveTab(), this.querySelector(`[panel="${t}"]`).setAttribute("active", ""), this.querySelector(`[name="${t}"]`).setAttribute("active", "");
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns the currently active tab.
|
|
80
|
+
*
|
|
81
|
+
* @returns {Element|null} The active tab, or null if no tab is active.
|
|
82
|
+
*/
|
|
83
|
+
getActiveTab() {
|
|
84
|
+
let t = Array.from(this.context.querySelectorAll("[active]"));
|
|
85
|
+
return t.length > 0 ? t[0] : null;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Returns all tabs.
|
|
89
|
+
*
|
|
90
|
+
* @returns {Array<Element>} An array of all tabs.
|
|
91
|
+
*/
|
|
92
|
+
getTabAll() {
|
|
93
|
+
return this.context.querySelector('[name="nav"]').assignedElements();
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Returns all panels.
|
|
97
|
+
*
|
|
98
|
+
* @returns {Array<Element>} An array of all panels.
|
|
99
|
+
*/
|
|
100
|
+
getPanelAll() {
|
|
101
|
+
return Array.from(this.querySelectorAll("wje-tab-panel"));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
b.define("wje-tab-group", b);
|
|
105
|
+
export {
|
|
106
|
+
b as default
|
|
107
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var o = Object.defineProperty;
|
|
2
|
+
var c = (t, e, a) => e in t ? o(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
|
|
3
|
+
var n = (t, e, a) => (c(t, typeof e != "symbol" ? e + "" : e, a), a);
|
|
4
|
+
import m from "./wje-element.js";
|
|
5
|
+
const p = ":host{display:none;flex-wrap:wrap;align-items:center;padding:1rem}:host([active]){display:block}";
|
|
6
|
+
class r extends m {
|
|
7
|
+
/**
|
|
8
|
+
* Creates an instance of TabPanel.
|
|
9
|
+
*
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
/**
|
|
15
|
+
* Returns the class name of the tab panel.
|
|
16
|
+
*
|
|
17
|
+
* @returns {string} The class name of the tab panel.
|
|
18
|
+
*/
|
|
19
|
+
n(this, "className", "TabPanel");
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Returns the CSS styles for the component.
|
|
23
|
+
*
|
|
24
|
+
* @static
|
|
25
|
+
* @returns {CSSStyleSheet}
|
|
26
|
+
*/
|
|
27
|
+
static get cssStyleSheet() {
|
|
28
|
+
return p;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Sets up the attributes for the component.
|
|
32
|
+
*/
|
|
33
|
+
setupAttributes() {
|
|
34
|
+
this.isShadowRoot = "open";
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Draws the component.
|
|
38
|
+
*
|
|
39
|
+
* @param {Object} context - The context for drawing.
|
|
40
|
+
* @param {Object} store - The store for drawing.
|
|
41
|
+
* @param {Object} params - The parameters for drawing.
|
|
42
|
+
* @returns {DocumentFragment}
|
|
43
|
+
*/
|
|
44
|
+
draw(a, d, i) {
|
|
45
|
+
let s = document.createDocumentFragment(), l = document.createElement("slot");
|
|
46
|
+
return s.appendChild(l), s;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
r.define("wje-tab-panel", r);
|
|
50
|
+
export {
|
|
51
|
+
r as default
|
|
52
|
+
};
|
package/dist/wje-tab.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var l = Object.defineProperty;
|
|
2
|
+
var d = (e, t, a) => t in e ? l(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
|
|
3
|
+
var n = (e, t, a) => (d(e, typeof t != "symbol" ? t + "" : t, a), a);
|
|
4
|
+
import b, { event as c } from "./wje-element.js";
|
|
5
|
+
const p = ':host{display:block;position:relative}:host .native-tab{display:flex;align-items:center;white-space:nowrap;font-family:var(--wje-tab-font-family);font-size:var(--wje-tab-font-size);letter-spacing:var(--wje-tab-letter-spacing);text-transform:var(--wje-tab-text-transfrom);font-weight:var(--wje-tab-font-weight);text-decoration:none;padding-inline:var(--wje-tab-padding-inline);padding-top:var(--wje-tab-padding-top);padding-bottom:var(--wje-tab-padding-bottom);border-radius:var(--wje-tab-border-radius);color:var(--wje-color);line-height:var(--wje-tab-line-height)}:host .native-tab>svg{inline-size:1.5em;pointer-events:none}:host .native-tab:hover{background:var(--wje-tab-color-hover)}:host .native-tab:hover:after{display:block}:host .native-tab:after{content:" ";display:none;block-size:.15rem;writing-mode:var(--wje-tab-writing-mode);background:var(--wje-tab-color-active);position:absolute;bottom:var(--wje-tab-bottom);left:var(--wje-tab-start);right:var(--wje-tab-end);top:var(--wje-tab-top)}:host([disabled]) a{opacity:.5;cursor:not-allowed;background:inherit}:host([disabled]) a:after{display:none}:host([active]) a:after{display:block}';
|
|
6
|
+
class i extends b {
|
|
7
|
+
/**
|
|
8
|
+
* Creates an instance of Tab.
|
|
9
|
+
*
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
/**
|
|
15
|
+
* Returns the class name of the tab.
|
|
16
|
+
*
|
|
17
|
+
* @returns {string} The class name of the tab.
|
|
18
|
+
*/
|
|
19
|
+
n(this, "className", "Tab");
|
|
20
|
+
this.last = !1;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns the CSS styles for the component.
|
|
24
|
+
*
|
|
25
|
+
* @static
|
|
26
|
+
* @returns {CSSStyleSheet}
|
|
27
|
+
*/
|
|
28
|
+
static get cssStyleSheet() {
|
|
29
|
+
return p;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Sets up the attributes for the component.
|
|
33
|
+
*/
|
|
34
|
+
setupAttributes() {
|
|
35
|
+
this.isShadowRoot = "open";
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Draws the component.
|
|
39
|
+
*
|
|
40
|
+
* @param {Object} context - The context for drawing.
|
|
41
|
+
* @param {Object} store - The store for drawing.
|
|
42
|
+
* @param {Object} params - The parameters for drawing.
|
|
43
|
+
* @returns {DocumentFragment}
|
|
44
|
+
*/
|
|
45
|
+
draw(a, v, h) {
|
|
46
|
+
let r = document.createDocumentFragment(), s = document.createElement("slot"), o = document.createElement("a");
|
|
47
|
+
return o.setAttribute("href", "#" + this.panel), o.setAttribute("part", "native"), o.classList.add("native-tab"), o.appendChild(s), r.appendChild(o), r;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Sets up the event listeners after the component is drawn.
|
|
51
|
+
*/
|
|
52
|
+
afterDraw() {
|
|
53
|
+
c.addListener(this, "click", "wje:tab-change");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
i.define("wje-tab", i);
|
|
57
|
+
export {
|
|
58
|
+
i as default
|
|
59
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var b = (i, a, t) => a in i ? p(i, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[a] = t;
|
|
3
|
+
var d = (i, a, t) => (b(i, typeof a != "symbol" ? a + "" : a, t), t);
|
|
4
|
+
import x, { event as h } from "./wje-element.js";
|
|
5
|
+
const v = ':host{width:100%;margin-bottom:var(--wje-textarea-margin-bottom);display:block}:host .wrapper{display:flex;width:100%;border-width:var(--wje-textarea-border-width);border-style:var(--wje-textarea-border-style);border-color:var(--wje-textarea-border-color);border-radius:var(--wje-textarea-border-radius)}:host textarea{font-family:var(--wje-textarea-font-family);color:var(--wje-textarea-color);font-size:14px;border:0 none;padding:0 var(--wje-textarea-padding)}:host textarea:focus{outline:none}:host([resize="auto"]) textarea,:host([resize="none"]) textarea{resize:none}.native-textarea .input-wrapper{width:100%;line-height:normal}.native-textarea.default{background-color:var(--wje-textarea-background-color);font-family:var(--wje-textarea-font-family);position:relative;padding-inline:0;padding-top:0;transition:background-color .2s ease;cursor:text}.native-textarea.default.focused .wrapper{border-color:var(--wje-textarea-border-color-focus)!important}.native-textarea.default.focused label{opacity:.67;font-size:12px;letter-spacing:normal}.native-textarea.default textarea{border:none;padding-top:0;background:none;box-shadow:none;width:calc(100% - var(--wje-textarea-padding) * 2);max-width:calc(100% - var(--wje-textarea-padding) * 2);min-width:calc(100% - var(--wje-textarea-padding) * 2)}.native-textarea.default label{padding:0 var(--wje-textarea-padding);display:block;opacity:1;cursor:text;transition:opacity .2s ease;line-height:var(--wje-textarea-line-height);padding-top:.25rem}.native-textarea.default label.fade{opacity:.5;font-size:12px;letter-spacing:normal}.native-textarea.default ::slotted([slot="start"]){border-left:none;border-top:none;border-bottom:none}.native-textarea.default ::slotted([slot="end"]){border-right:none;border-top:none;border-bottom:none}.native-textarea.standard{background-color:var(--wje-textarea-background-color);font-family:var(--wje-textarea-font-family);position:relative;border-radius:var(--wje-textarea-border-radius);padding:0;transition:background-color .2s ease;cursor:text}.native-textarea.standard.focused .wrapper{border-color:var(--wje-textarea-border-color-focus)!important}.native-textarea.standard textarea{display:block;min-height:32px;background:none;box-shadow:none;width:100%;box-sizing:border-box;border-radius:var(--wje-textarea-border-radius)}.native-textarea.standard label{margin:0;display:inline-block;opacity:1;cursor:text;transition:opacity .2s ease;line-height:var(--wje-textarea-line-height)}.native-textarea.standard ::slotted([slot="start"]){border-right:none;border-radius:var(--wje-textarea-border-radius) 0 0 var(--wje-textarea-border-radius)}.native-textarea.standard ::slotted([slot="end"]){border-left:none;border-radius:0 var(--wje-textarea-border-radius) var(--wje-textarea-border-radius) 0}.native-textarea.standard.has-start textarea{border-top-left-radius:0;border-bottom-left-radius:0}.native-textarea.standard.has-end textarea{border-top-right-radius:0;border-bottom-right-radius:0}.native-textarea.standard .error-message{position:static;background:transparent;padding:.25rem 0;left:auto;transform:none;color:var(--wje-textarea-color-invalid);font-size:12px;line-height:normal}.counter{float:right}';
|
|
6
|
+
class u extends x {
|
|
7
|
+
/**
|
|
8
|
+
* Creates an instance of Textarea.
|
|
9
|
+
*
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
d(this, "className", "Textarea");
|
|
15
|
+
/**
|
|
16
|
+
* Sets the height of the textarea.
|
|
17
|
+
*/
|
|
18
|
+
d(this, "setTextareaHeight", () => {
|
|
19
|
+
this.getAttribute("resize") === "auto" && (this.input.style.height = "auto", this.input.style.height = this.input.scrollHeight + "px");
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Updates the counter for the textarea.
|
|
23
|
+
*
|
|
24
|
+
* @param {Event} e - The event object.
|
|
25
|
+
*/
|
|
26
|
+
d(this, "counter", (t) => {
|
|
27
|
+
this.counterElement.innerText = t.target.value.length + "/" + this.input.maxLength;
|
|
28
|
+
});
|
|
29
|
+
this._checked = !1;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Sets the checked state of the textarea.
|
|
33
|
+
*
|
|
34
|
+
* @param {boolean} value - The checked state.
|
|
35
|
+
*/
|
|
36
|
+
set checked(t) {
|
|
37
|
+
this._checked = t, t ? this.setAttribute("checked", "") : this.removeAttribute("checked");
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Returns the checked state of the textarea.
|
|
41
|
+
*
|
|
42
|
+
* @returns {boolean} The checked state.
|
|
43
|
+
*/
|
|
44
|
+
get checked() {
|
|
45
|
+
return this._checked;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Returns the CSS styles for the component.
|
|
49
|
+
*
|
|
50
|
+
* @static
|
|
51
|
+
* @returns {CSSStyleSheet}
|
|
52
|
+
*/
|
|
53
|
+
static get cssStyleSheet() {
|
|
54
|
+
return v;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Returns the list of attributes to observe for changes.
|
|
58
|
+
*
|
|
59
|
+
* @static
|
|
60
|
+
* @returns {Array<string>}
|
|
61
|
+
*/
|
|
62
|
+
static get observedAttributes() {
|
|
63
|
+
return ["checked"];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Sets up the attributes for the component.
|
|
67
|
+
*/
|
|
68
|
+
setupAttributes() {
|
|
69
|
+
this.isShadowRoot = "open";
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Draws the component.
|
|
73
|
+
*
|
|
74
|
+
* @param {Object} context - The context for drawing.
|
|
75
|
+
* @param {Object} store - The store for drawing.
|
|
76
|
+
* @param {Object} params - The parameters for drawing.
|
|
77
|
+
* @returns {DocumentFragment}
|
|
78
|
+
*/
|
|
79
|
+
draw(t, m, f) {
|
|
80
|
+
let l = document.createDocumentFragment(), r = document.createElement("div");
|
|
81
|
+
r.classList.add("native-textarea", this.variant || "default"), r.setAttribute("part", "native"), this.hasAttribute("invalid") && r.classList.add("has-error");
|
|
82
|
+
let c = document.createElement("div");
|
|
83
|
+
c.classList.add("wrapper");
|
|
84
|
+
let o = document.createElement("div");
|
|
85
|
+
o.classList.add("input-wrapper");
|
|
86
|
+
let n = document.createElement("label");
|
|
87
|
+
n.htmlFor = "textarea", n.innerHTML = this.label || "";
|
|
88
|
+
let e = document.createElement("textarea");
|
|
89
|
+
if (e.id = "textarea", e.name = this.name, e.disabled = this.hasAttribute("disabled"), e.innerText = this.innerText, e.classList.add("form-control"), e.setAttribute("part", "input"), e.setAttribute("rows", this.rows || 3), e.setAttribute("spellcheck", !1), this.resize === "auto" && e.addEventListener("input", this.setTextareaHeight), this.variant === "standard" ? this.label && r.appendChild(n) : o.appendChild(n), o.appendChild(e), c.appendChild(o), r.appendChild(c), l.appendChild(r), this.hasAttribute("counter")) {
|
|
90
|
+
e.maxLength = this.maxLength || 1e3, e.addEventListener("input", this.counter);
|
|
91
|
+
let s = document.createElement("div");
|
|
92
|
+
s.classList.add("counter"), s.innerText = `${e.value.length}/${e.maxLength}`, this.counterElement = s, l.appendChild(s);
|
|
93
|
+
}
|
|
94
|
+
return this.native = r, this.labelElement = n, this.input = e, l;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Sets up the event listeners after the component is drawn.
|
|
98
|
+
*/
|
|
99
|
+
afterDraw() {
|
|
100
|
+
this.resizeObserver = new ResizeObserver(() => this.setTextareaHeight), this.hasAttribute("disabled") || (h.addListener(this, "click", "wje:textarea:change"), h.addListener(this, "click", "wje:textarea:input")), this.input.addEventListener("focus", (t) => {
|
|
101
|
+
this.labelElement.classList.add("fade"), this.native.classList.add("focused");
|
|
102
|
+
}), this.input.addEventListener("blur", (t) => {
|
|
103
|
+
this.native.classList.remove("focused"), t.target.value || this.labelElement.classList.remove("fade");
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Disconnects the component.
|
|
108
|
+
*/
|
|
109
|
+
disconnectedCallback() {
|
|
110
|
+
this.resizeObserver.unobserve(this.input);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
u.define("wje-textarea", u);
|
|
114
|
+
export {
|
|
115
|
+
u as default
|
|
116
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
var l = Object.defineProperty;
|
|
2
|
+
var u = (r, e, t) => e in r ? l(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var a = (r, e, t) => (u(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import h from "./wje-element.js";
|
|
5
|
+
const m = ":host{width:var(--wje-thumbnail-width);height:var(--wje-thumbnail-height);display:block;border-radius:var(--wje-border-radius)}:host([circle]) ::slotted(img){border-radius:50%}::slotted(wje-img),::slotted(img){border-radius:var(--wje-thumbnail-border-radius);width:100%;height:100%;object-fit:cover;overflow:hidden}";
|
|
6
|
+
class o extends h {
|
|
7
|
+
/**
|
|
8
|
+
* Thumbnail constructor
|
|
9
|
+
* @constructor
|
|
10
|
+
*/
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
/**
|
|
14
|
+
* Class name
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
a(this, "className", "Thumbnail");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get CSS stylesheet
|
|
21
|
+
* @static
|
|
22
|
+
* @returns {Object} styles
|
|
23
|
+
*/
|
|
24
|
+
static get cssStyleSheet() {
|
|
25
|
+
return m;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get observed attributes
|
|
29
|
+
* @static
|
|
30
|
+
* @returns {Array} An empty array
|
|
31
|
+
*/
|
|
32
|
+
static get observedAttributes() {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Setup attributes
|
|
37
|
+
*/
|
|
38
|
+
setupAttributes() {
|
|
39
|
+
this.isShadowRoot = "open";
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Before draw method
|
|
43
|
+
* @param {Object} context - The context
|
|
44
|
+
* @param {Object} store - The store
|
|
45
|
+
* @param {Object} params - The parameters
|
|
46
|
+
*/
|
|
47
|
+
beforeDraw(t, i, d) {
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Draw method
|
|
51
|
+
* @param {Object} context - The context
|
|
52
|
+
* @param {Object} store - The store
|
|
53
|
+
* @param {Object} params - The parameters
|
|
54
|
+
* @returns {Object} Document fragment
|
|
55
|
+
*/
|
|
56
|
+
draw(t, i, d) {
|
|
57
|
+
let s = document.createDocumentFragment(), n = document.createElement("slot");
|
|
58
|
+
return s.appendChild(n), s;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
o.define("wje-thumbnail", o);
|
|
62
|
+
export {
|
|
63
|
+
o as default
|
|
64
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var c = Object.defineProperty;
|
|
2
|
+
var m = (e, t, i) => t in e ? c(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
|
|
3
|
+
var p = (e, t, i) => (m(e, typeof t != "symbol" ? t + "" : t, i), i);
|
|
4
|
+
import f from "./wje-element.js";
|
|
5
|
+
const l = (e, t, i) => {
|
|
6
|
+
e.classList.add("pgn-simple"), t.innerHTML = "<div>" + i.message + "</div>", t.appendChild(a());
|
|
7
|
+
}, b = (e, t, i) => {
|
|
8
|
+
e.classList.add("pgn-flip"), t.innerHTML = "<span>" + i.message + "</span>", t.appendChild(a());
|
|
9
|
+
}, g = (e, t, i) => {
|
|
10
|
+
e.classList.add("pgn-circle");
|
|
11
|
+
let r = "", n = "";
|
|
12
|
+
i.title && (r = `<p><b>${i.title}</b></p>`), i.message && (n = `<p>${i.message}</p>`), t.innerHTML = `<wje-avatar>
|
|
13
|
+
<img alt="Silhouette of a person's head" src="/assets/img/avatar.svg" />
|
|
14
|
+
</wje-avatar>
|
|
15
|
+
<div>
|
|
16
|
+
${r + n}
|
|
17
|
+
</div>`, t.appendChild(a());
|
|
18
|
+
}, w = (e, t, i) => {
|
|
19
|
+
e.classList.add("pgn-bar"), t.classList.add("alert-" + i.type), t.innerHTML = "<div>" + i.message + "</div>", t.appendChild(a());
|
|
20
|
+
}, a = () => {
|
|
21
|
+
let e = document.createElement("wje-icon");
|
|
22
|
+
e.setAttribute("name", "x"), e.setAttribute("slot", "icon-only");
|
|
23
|
+
let t = document.createElement("wje-button");
|
|
24
|
+
return t.setAttribute("fill", "link"), t.setAttribute("size", "small"), t.classList.add("close"), t.appendChild(e), t;
|
|
25
|
+
}, h = ':host{position:fixed;z-index:999}:host([data-position$="-left"]){left:0}:host([data-position$="-right"]){right:0}:host([data-position^="top-"]){top:0}:host([data-position^="bottom-"]){bottom:0}:host([data-position="top"]){top:0;left:0;right:0}:host([data-position="bottom"]){bottom:0;left:0;right:0}.pgn{position:relative;margin:10px}.pgn .alert{margin:0 0 4px}.pgn-simple .alert{padding-top:13px;padding-bottom:13px;max-width:500px;animation:fadeIn .3s cubic-bezier(.05,.74,.27,.99) forwards;-webkit-animation:fadeIn .3s cubic-bezier(.05,.74,.27,.99) forwards;max-height:250px;overflow:hidden}.pgn-bar{overflow:hidden;margin:0}.pgn-bar .alert{border-radius:0;padding-top:13px;padding-bottom:13px;max-height:91px}:host([data-position="top"]) .pgn-bar .alert{animation:slideInFromTop .5s cubic-bezier(.05,.74,.27,.99) forwards;-webkit-animation:slideInFromTop .5s cubic-bezier(.05,.74,.27,.99) forwards;transform-origin:top left;-webkit-transform-origin:top left}:host([data-position="bottom"]) .pgn-bar .alert{animation:slideInFromBottom .5s cubic-bezier(.05,.74,.27,.99) forwards;-webkit-animation:slideInFromBottom .5s cubic-bezier(.05,.74,.27,.99) forwards;transform-origin:bottom left;-webkit-transform-origin:bottom left}.pgn-bar .alert span{opacity:0;animation:fadeIn .3s cubic-bezier(.05,.74,.27,.99) forwards;-webkit-animation:fadeIn .3s cubic-bezier(.05,.74,.27,.99) forwards}@keyframes slideInFromTop{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@-webkit-keyframes slideInFromTop{0%{-webkit-transform:translateY(-100%)}to{-webkit-transform:translateY(0)}}@keyframes slideInFromBottom{0%{transform:translateY(100%)}to{transform:translateY(0)}}@-webkit-keyframes slideInFromBottom{0%{-webkit-transform:translateY(100%)}to{-webkit-transform:translateY(0)}}.pgn-circle .alert{margin-bottom:10px;border-radius:300px;animation:fadeInCircle .3s ease forwards,resizeCircle .3s .4s cubic-bezier(.25,.25,.4,1.6) forwards;-webkit-animation:fadeInCircle .3s ease forwards,resizeCircle .3s .4s cubic-bezier(.25,.25,.4,1.6) forwards;height:48px;overflow:hidden;padding:6px 55px 6px 6px;-webkit-transform:translateZ(0);position:relative;display:flex}:host[data-position$=-right] .pgn-circle .alert{float:right}:host[data-position$=-left] .pgn-circle .alert{float:left}:host[data-position^=bottom-] .pgn-circle .alert{margin-bottom:20px}wje-avatar:first-child{margin-right:8px}.pgn-circle .alert .close{margin-top:-12px;position:absolute;right:18px;top:50%;opacity:0;animation:fadeIn .3s .5s ease forwards;-webkit-animation:fadeIn .3s .5s ease forwards}.pgn-circle .alert p{margin:0}.pgn-circle .alert>div{display:flex;flex-direction:column;justify-content:center}.pgn-circle .alert>div>div{display:table-cell;vertical-align:middle}@keyframes fadeInCircle{0%{opacity:0;width:60px}to{opacity:1;width:60px}}@-webkit-keyframes fadeInCircle{0%{opacity:0;width:60px}to{opacity:1;width:60px}}@keyframes resizeCircle{0%{width:60px}to{width:300px}}@-webkit-keyframes resizeCircle{0%{width:60px}to{width:300px}}:host[data-position^=bottom-] .pgn-flip .alert{-webkit-transform-origin:50% 100%;transform-origin:50% 100%}.pgn-flip .alert{-webkit-transform-origin:50% 0%;transform-origin:50% 0%;-webkit-animation-name:flipInX;animation-name:flipInX;-webkit-animation-duration:.8s;animation-duration:.8s;border-radius:0;padding:25px 35px;max-width:500px;max-height:250px;overflow:hidden}@-webkit-keyframes flipInX{0%{-webkit-transform:perspective(400px) rotate3d(1,0,0,-90deg);-webkit-transition-timing-function:ease-in}40%{-webkit-transform:perspective(400px) rotate3d(1,0,0,20deg);-webkit-transition-timing-function:ease-out}60%{-webkit-transform:perspective(400px) rotate3d(1,0,0,-10deg);-webkit-transition-timing-function:ease-in;opacity:1}80%{-webkit-transform:perspective(400px) rotate3d(1,0,0,5deg);-webkit-transition-timing-function:ease-out}to{-webkit-transform:perspective(400px)}}@keyframes flipInX{0%{-webkit-transform:perspective(400px) rotate3d(1,0,0,-90deg);transform:perspective(400px) rotateX(-90deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in}40%{-webkit-transform:perspective(400px) rotate3d(1,0,0,20deg);transform:perspective(400px) rotateX(20deg);-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out}60%{-webkit-transform:perspective(400px) rotate3d(1,0,0,-10deg);transform:perspective(400px) rotateX(-10deg);-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in;opacity:1}80%{-webkit-transform:perspective(400px) rotate3d(1,0,0,5deg);transform:perspective(400px) rotateX(5deg);-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out}to{-webkit-transform:perspective(400px);transform:perspective(400px)}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-webkit-keyframes fadeIn{0%{opacity:0}to{opacity:1}}:host([data-position="top"]){top:60px;left:0}:host([data-position="bottom"]){left:0}:host([data-position$="-left"]){left:0;right:auto}:host([data-position^="top-"]){bottom:auto}:host{z-index:999}@media (max-width: 979px){body .pgn-wrapper[data-position=top],body .pgn-wrapper[data-position=bottom]{left:0!important}}@media (max-width: 767px){body .pgn-wrapper[data-position$=-left],body .pgn-wrapper[data-position$=-right]{left:10px!important;right:10px!important}body .pgn-wrapper[data-position$=-right] .alert,body .pgn-wrapper[data-position$=-left] .alert{max-width:100%;width:100%}}.alert{background-image:none;box-shadow:none;text-shadow:none;padding:9px 19px 9px 15px;border-radius:3px;font-size:13px;border-width:0;transition:all .2s linear 0s;display:flex;align-items:center}.alert.bordered{border-width:1px}.alert .link{color:#ce8f22;font-weight:700}.alert .alert-heading{color:#ce8f22!important;margin-bottom:5px;font-weight:600}.alert .btn-small{position:relative;top:-3.5px}.alert .button-set .btn{position:relative;top:8px}.alert-danger,.alert-error,.alert-danger.btn,.alert-error.btn{background-color:var(--wje-color-primary-2)!important;color:var(--wje-color-primary-11)!important;border-color:var(--wje-color-primary-9)!important}.alert-danger .close,.alert-error .close,.alert-danger.btn .close,.alert-error.btn .close{background-position:-95px -10px!important}.alert-warning{background-color:var(--wje-color-warning-2)!important;color:var(--wje-color-warning-11)!important;border-color:var(--wje-color-warning-9)!important}.alert-info{background-color:var(--wje-color-complete-2)!important;color:var(--wje-color-complete-11)!important;border-color:var(--wje-color-complete-9)!important}.alert-info .close{background-position:-67px -10px!important}.alert-success,.alert-success.btn{background-color:var(--wje-color-success-2)!important;color:var(--wje-color-success-11)!important;border-color:var(--wje-color-success-9)!important}.alert-success .close,.alert-success.btn .close{background-position:-38px -10px!important}.alert-default{background-color:var(--wje-color-contrast-2)!important;color:var(--wje-color-contrast-11)!important;border-color:var(--wje-color-contrast-9)!important}.alert-default .close{background-position:-67px -10px!important}';
|
|
26
|
+
class d extends f {
|
|
27
|
+
/**
|
|
28
|
+
* Toast constructor
|
|
29
|
+
* @constructor
|
|
30
|
+
*/
|
|
31
|
+
constructor() {
|
|
32
|
+
super();
|
|
33
|
+
/**
|
|
34
|
+
* Class name
|
|
35
|
+
* @type {string}
|
|
36
|
+
*/
|
|
37
|
+
p(this, "className", "Toast");
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get CSS stylesheet
|
|
41
|
+
* @static
|
|
42
|
+
* @returns {Object} styles
|
|
43
|
+
*/
|
|
44
|
+
static get cssStyleSheet() {
|
|
45
|
+
return h;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Setup attributes
|
|
49
|
+
*/
|
|
50
|
+
setupAttributes() {
|
|
51
|
+
this.isShadowRoot = "open";
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Draw method
|
|
55
|
+
* @param {Object} context - The context
|
|
56
|
+
* @param {Object} store - The store
|
|
57
|
+
* @param {Object} params - The parameters
|
|
58
|
+
* @returns {Object} Document fragment
|
|
59
|
+
*/
|
|
60
|
+
draw(i, r, n) {
|
|
61
|
+
let s = document.createDocumentFragment(), o = {
|
|
62
|
+
message: "Záznam bol úspešne uložený.",
|
|
63
|
+
position: this.position,
|
|
64
|
+
showClose: !0,
|
|
65
|
+
style: this.design || "simple",
|
|
66
|
+
timeout: this.duration || 4e3,
|
|
67
|
+
type: this.type || "success",
|
|
68
|
+
title: this.title || "John Doe"
|
|
69
|
+
};
|
|
70
|
+
return this.container = document.querySelector("body"), this.notification = document.createElement("div"), this.notification.classList.add("pgn", "push-on-sidebar-open"), this.classList.add("pgn-wrapper"), this.setAttribute("data-position", o.position), this.alert = document.createElement("div"), this.alert.classList.add("alert"), this.alert.classList.add("alert-" + o.type), o.style == "bar" ? w(this.notification, this.alert, o) : o.style == "flip" ? b(this.notification, this.alert, o) : o.style == "circle" ? g(this.notification, this.alert, o) : o.style == "simple" ? l(this.notification, this.alert, o) : l(this.notification, this.alert, o), this.notification.appendChild(this.alert), s.appendChild(this.notification), s;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
d.define("wje-toast", d);
|
|
74
|
+
export {
|
|
75
|
+
d as default
|
|
76
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var g = (r, t, e) => t in r ? h(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var c = (r, t, e) => (g(r, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
+
import b, { event as d } from "./wje-element.js";
|
|
5
|
+
const u = ':host{--wje-toggle-color-base: var(--wje-color-contrast-3);--wje-toggle-width: 30px;--wje-toggle-height: 18px;--wje-toggle-border-radius: 50px;--wje-toggle-handle-width: 13px;--wje-toggle-handle-height: 13px;--wje-toggle-handle-border-radius: 9px;--wje-toggle-handle-color: #fff;--wje-toggle-handle-shadow: 1px 0 1px .5px rgba(0,0,0,.12), 2px 4px 6px rgba(0,0,0,.2);--wje-toggle-handle-shadow-checked: 1px 1px 0 rgba(0,0,0,.08), -3px 3px 6px rgba(0,0,0,.3);--wje-toggle-duration: .25s;--wje-toggle-curve: cubic-bezier(.4,0,.2,1)}:host([color=primary]) input:checked+label>.label-wrapper{--wje-toggle-color-base: var(--wje-color-primary-9) !important}:host([color=complete]) input:checked+label>.label-wrapper{--wje-toggle-color-base: var(--wje-color-complete-9)}:host([color=success]) input:checked+label>.label-wrapper{--wje-toggle-color-base: var(--wje-color-success-9) !important}:host([color=warning]) input:checked+label>.label-wrapper{--wje-toggle-color-base: var(--wje-color-warning-9)}:host([color=danger]) input:checked+label>.label-wrapper{--wje-toggle-color-base: var(--wje-color-danger-9)}:host([color=info]) input:checked+label>.label-wrapper{--wje-toggle-color-base: var(--wje-color-info-9)}.native-toggle{display:flex}label{display:flex;cursor:pointer;align-items:center;-webkit-user-select:none;user-select:none}label .label-wrapper{width:var(--wje-toggle-width)!important;min-width:var(--wje-toggle-width);height:var(--wje-toggle-height);position:relative;display:flex;align-items:center}label .label-wrapper:before{content:"";position:absolute;cursor:pointer;width:100%;height:100%;top:auto;left:0;background:var(--wje-toggle-color-base);background-size:300%;background-position:right;border-radius:var(--wje-toggle-border-radius);border:none;box-shadow:inset 0 0 0 1px #0000001f;transition:background calc(var(--wje-toggle-duration) + (var(--wje-toggle-duration) * .24)),box-shadow var(--wje-toggle-duration);transition-timing-function:var(--wje-toggle-curve)}label .label-wrapper:after{content:"";position:absolute;transform:translate(0);background:var(--wje-toggle-handle-color);width:var(--wje-toggle-handle-width);height:var(--wje-toggle-handle-height);border-radius:var(--wje-toggle-handle-border-radius);top:auto;left:2px;box-shadow:var(--wje-toggle-handle-shadow);transition:transform,box-shadow;transition-duration:var(--wje-toggle-duration);transition-timing-function:var(--wje-toggle-curve)}input[type=checkbox][disabled]+label{cursor:not-allowed!important;color:var(--wje-color-contrast-9);opacity:.58}input[type=checkbox][disabled]+label:before{cursor:not-allowed!important}input[type=checkbox]{position:absolute;z-index:-1;opacity:0}input[type=checkbox]:checked+label .label-wrapper:before{background-position:left;box-shadow:inset 0 0 0 1px #0000001f}input[type=checkbox]:checked+label .label-wrapper:after{transform:translate(calc(var(--wje-toggle-width) - var(--wje-toggle-handle-width) - 4px));box-shadow:var(--wje-toggle-handle-shadow-checked)}input[type=checkbox]:focus+label .label-wrapper:before{outline:none!important;box-shadow:inset 0 0 0 1px #0000001f,0 0 #78c8fe}input[type=checkbox][disabled]:active+label .label-wrapper:after{transform:scaleX(1.1);transform-origin:center left;transition:transform step-start}input[type=checkbox]:checked[disabled]:active+label .label-wrapper:after{transform:translate(calc(100% - 6px)) scaleX(1.1);transform-origin:center right}input[type=checkbox]:hover:active+label .label-wrapper:before{background-color:transparent}:host .text{margin-inline:.5rem 0}:host([placement=end]) label{width:100%}:host([placement=end]) .text{margin-inline:0 .5rem;width:100%}slot{display:flex;align-items:center;width:100%}';
|
|
6
|
+
class p extends b {
|
|
7
|
+
/**
|
|
8
|
+
* @constructor
|
|
9
|
+
* @summary Toggle constructor
|
|
10
|
+
*/
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
/**
|
|
14
|
+
* @summary Class name
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
c(this, "className", "Toggle");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @summary Set checked attribute
|
|
21
|
+
* @returns {boolean} true if the toggle is checked, false otherwise
|
|
22
|
+
*/
|
|
23
|
+
set disabled(e) {
|
|
24
|
+
e ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @summary Get disabled attribute
|
|
28
|
+
* @returns {boolean} true if the toggle is disabled, false otherwise
|
|
29
|
+
*/
|
|
30
|
+
get disabled() {
|
|
31
|
+
return this.hasAttribute("disabled");
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @summary Set checked attribute
|
|
35
|
+
* @returns {boolean} true if the toggle is checked, false otherwise
|
|
36
|
+
*/
|
|
37
|
+
set checked(e) {
|
|
38
|
+
e ? this.setAttribute("checked", "") : this.removeAttribute("checked");
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @summary Get checked attribute
|
|
42
|
+
* @returns {boolean} true if the toggle is checked, false otherwise
|
|
43
|
+
*/
|
|
44
|
+
get checked() {
|
|
45
|
+
return this.hasAttribute("checked");
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @summary Get CSS stylesheet
|
|
49
|
+
* @static
|
|
50
|
+
* @returns {Object} styles
|
|
51
|
+
*/
|
|
52
|
+
static get cssStyleSheet() {
|
|
53
|
+
return u;
|
|
54
|
+
}
|
|
55
|
+
static get observedAttributes() {
|
|
56
|
+
return ["checked", "disabled"];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @summary Setup attributes
|
|
60
|
+
*/
|
|
61
|
+
setupAttributes() {
|
|
62
|
+
this.isShadowRoot = "open";
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @summary Draw method
|
|
66
|
+
* @param {Object} context - The context
|
|
67
|
+
* @param {Object} store - The store
|
|
68
|
+
* @param {Object} params - The parameters
|
|
69
|
+
* @returns {Object} Document fragment
|
|
70
|
+
*/
|
|
71
|
+
draw(e, w, m) {
|
|
72
|
+
let s = document.createDocumentFragment(), o = document.createElement("div");
|
|
73
|
+
o.setAttribute("part", "native"), o.classList.add("native-toggle");
|
|
74
|
+
let a = document.createElement("input");
|
|
75
|
+
a.setAttribute("part", "input"), a.setAttribute("type", "checkbox"), a.setAttribute("name", this.name), a.setAttribute("id", "input"), a.checked = this.hasAttribute("checked"), a.disabled = this.hasAttribute("disabled");
|
|
76
|
+
let l = document.createElement("label");
|
|
77
|
+
l.setAttribute("for", "input");
|
|
78
|
+
let i = document.createElement("div");
|
|
79
|
+
i.setAttribute("part", "toggle"), i.classList.add("label-wrapper");
|
|
80
|
+
let n = document.createElement("div");
|
|
81
|
+
return n.classList.add("text"), n.innerHTML = "<slot></slot>", this.color && this.classList.add("wje-color-" + this.color, "wje-color"), o.appendChild(a), o.appendChild(l), this.placement === "end" ? (o.classList.add("end"), l.appendChild(n), l.appendChild(i)) : (l.appendChild(i), l.appendChild(n)), s.appendChild(o), this.input = a, s;
|
|
82
|
+
}
|
|
83
|
+
afterDraw() {
|
|
84
|
+
this.disabled || (this.input.addEventListener("input", (e) => {
|
|
85
|
+
this.checked = e.target.checked, d.dispatchCustomEvent(this, "wje-toggle:input");
|
|
86
|
+
}), this.input.addEventListener("change", (e) => {
|
|
87
|
+
this.checked = e.target.checked, d.dispatchCustomEvent(this, "wje-toggle:change");
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
p.define("wje-toggle", p);
|
|
92
|
+
export {
|
|
93
|
+
p as default
|
|
94
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var m = (e, t, o) => t in e ? d(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
|
+
var r = (e, t, o) => (m(e, typeof t != "symbol" ? t + "" : t, o), o);
|
|
4
|
+
import u from "./wje-element.js";
|
|
5
|
+
const p = ":host .native-toolbar-action{display:flex}";
|
|
6
|
+
class l extends u {
|
|
7
|
+
/**
|
|
8
|
+
* @constructor
|
|
9
|
+
* @summary ToolbarAction constructor
|
|
10
|
+
*/
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
/**
|
|
14
|
+
* @summary Class name
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
r(this, "className", "ToolbarAction");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @summary Get CSS stylesheet
|
|
21
|
+
* @static
|
|
22
|
+
* @returns {Object} styles
|
|
23
|
+
*/
|
|
24
|
+
static get cssStyleSheet() {
|
|
25
|
+
return p;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @summary Get observed attributes
|
|
29
|
+
* @static
|
|
30
|
+
* @returns {Array} An empty array
|
|
31
|
+
*/
|
|
32
|
+
static get observedAttributes() {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @summary Setup attributes
|
|
37
|
+
*/
|
|
38
|
+
setupAttributes() {
|
|
39
|
+
this.isShadowRoot = "open";
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @summary Draw method
|
|
43
|
+
* @param {Object} context - The context
|
|
44
|
+
* @param {Object} store - The store
|
|
45
|
+
* @param {Object} params - The parameters
|
|
46
|
+
* @returns {Object} Document fragment
|
|
47
|
+
*/
|
|
48
|
+
draw(o, h, b) {
|
|
49
|
+
let a = document.createDocumentFragment(), n = +this.maxItems || 0, c = this.getActions(), i = document.createElement("slot"), s = document.createElement("div");
|
|
50
|
+
return s.setAttribute("part", "native"), s.classList.add("native-toolbar-action"), n !== 0 && c.length > n && (s = document.createElement("wje-dropdown")), s.appendChild(i), a.appendChild(s), a;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @summary Get actions
|
|
54
|
+
* @returns {Array} An array of wje-button elements
|
|
55
|
+
*/
|
|
56
|
+
getActions() {
|
|
57
|
+
return Array.from(this.querySelectorAll("wje-button"));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
l.define("wje-toolbar-action", l);
|
|
61
|
+
export {
|
|
62
|
+
l as default
|
|
63
|
+
};
|