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
package/dist/wje-menu.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var m = Object.defineProperty;
|
|
2
|
+
var d = (n, t, e) => t in n ? m(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var o = (n, t, e) => (d(n, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
+
import l from "./wje-element.js";
|
|
5
|
+
const u = ":host{display:none;background:var(--wje-menu-background);position:relative;border-width:var(--wje-menu-border-width);border-style:var(--wje-menu-border-style);border-color:var(--wje-menu-border-color);z-index:var(--wje-menu-z-index, 8);border-radius:var(--wje-menu-border-radius);padding-top:var(--wje-menu-padding-top);padding-bottom:var(--wje-menu-padding-bottom);padding-inline:var(--wje-menu-padding-inline);margin-top:var(--wje-menu-margin-top);margin-bottom:var(--wje-menu-margin-bottom);margin-inline:var(--wje-menu-margin-inline);overflow:auto;overscroll-behavior:none}:host .native-menu{display:flex;flex-direction:column;width:100%}:host .native-menu ::slotted(wje-button){margin:0}:host(.wje-menu-collapse){width:var(--wje-menu-collapse-width)}:host([variant=context]){display:block!important;margin-left:var(--wje-menu-submenu-offset)}:host([variant=megamenu]) .native-menu{flex-direction:row;align-items:end;flex-wrap:nowrap}:host([variant=megamenu]) .native-menu .check-icon{display:none}:host([active]){display:flex!important}";
|
|
6
|
+
class i extends l {
|
|
7
|
+
/**
|
|
8
|
+
* Creates an instance of Menu.
|
|
9
|
+
*
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
o(this, "className", "Menu");
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Returns the CSS styles for the component.
|
|
18
|
+
*
|
|
19
|
+
* @static
|
|
20
|
+
* @returns {CSSStyleSheet}
|
|
21
|
+
*/
|
|
22
|
+
static get cssStyleSheet() {
|
|
23
|
+
return u;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns the list of attributes to observe for changes.
|
|
27
|
+
*
|
|
28
|
+
* @static
|
|
29
|
+
* @returns {Array<string>}
|
|
30
|
+
*/
|
|
31
|
+
static get observedAttributes() {
|
|
32
|
+
return ["active", "collapse"];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Sets up the attributes for the component.
|
|
36
|
+
*/
|
|
37
|
+
setupAttributes() {
|
|
38
|
+
this.isShadowRoot = "open";
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Draws the component.
|
|
42
|
+
*
|
|
43
|
+
* @param {Object} context - The context for drawing.
|
|
44
|
+
* @param {Object} store - The store for drawing.
|
|
45
|
+
* @param {Object} params - The parameters for drawing.
|
|
46
|
+
* @returns {DocumentFragment}
|
|
47
|
+
*/
|
|
48
|
+
draw(e, c, p) {
|
|
49
|
+
let r = document.createDocumentFragment();
|
|
50
|
+
this.classList.remove("wje-menu-collapse"), this.hasAttribute("collapse") && this.classList.add("wje-menu-collapse");
|
|
51
|
+
let a = document.createElement("div");
|
|
52
|
+
a.setAttribute("part", "native"), a.classList.add("native-menu");
|
|
53
|
+
let s = document.createElement("slot");
|
|
54
|
+
return a.appendChild(s), r.appendChild(a), r;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Refreshes the component after drawing.
|
|
58
|
+
*/
|
|
59
|
+
afterDraw() {
|
|
60
|
+
Array.from(this.children).forEach((e) => {
|
|
61
|
+
e.tagName.includes("-") && e.refresh();
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Cleans up the component before disconnecting.
|
|
66
|
+
*/
|
|
67
|
+
beforeDisconnect() {
|
|
68
|
+
this.context.innerHTML = "";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
i.define("wje-menu", i);
|
|
72
|
+
export {
|
|
73
|
+
i as default
|
|
74
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var m = (n, t, e) => t in n ? p(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var o = (n, t, e) => (m(n, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
+
import u, { event as h } from "./wje-element.js";
|
|
5
|
+
import g from "./wje-icon.js";
|
|
6
|
+
const b = ':host{--wje-option-padding-top: .5rem;--wje-option-padding-bottom: .5rem;--wje-option-highlighted: var(--wje-color-contrast-3);display:block}:host wje-icon{visibility:hidden;margin-inline:.5rem}:host([selected]) wje-icon{visibility:visible}.native-option{display:flex;align-items:center;padding-top:var(--wje-option-padding-top);padding-bottom:var(--wje-option-padding-bottom)}.native-option:hover{background-color:var(--wje-option-highlighted)}::slotted([slot="start"]){flex:0 0 auto;display:flex;align-items:center;margin-inline-end:.5rem}::slotted([slot="end"]){flex:0 0 auto;display:flex;align-items:center;margin-inline:auto .5rem}';
|
|
7
|
+
class d extends u {
|
|
8
|
+
/**
|
|
9
|
+
* Creates an instance of Option.
|
|
10
|
+
*
|
|
11
|
+
* @constructor
|
|
12
|
+
*/
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
/**
|
|
16
|
+
* Dependencies of the Option component.
|
|
17
|
+
*/
|
|
18
|
+
o(this, "depandencies", {
|
|
19
|
+
"wje-icon": g
|
|
20
|
+
});
|
|
21
|
+
o(this, "className", "Option");
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Sets the selected attribute of the option.
|
|
25
|
+
*
|
|
26
|
+
* @param {boolean} value - The value to set.
|
|
27
|
+
*/
|
|
28
|
+
set selected(e) {
|
|
29
|
+
return e ? this.setAttribute("selected", "") : this.removeAttribute("selected");
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Sets the value attribute of the option.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} value - The value to set.
|
|
35
|
+
*/
|
|
36
|
+
set value(e) {
|
|
37
|
+
this.setAttribute("value", e);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Sets the text content of the option.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} value - The text to set.
|
|
43
|
+
*/
|
|
44
|
+
set text(e) {
|
|
45
|
+
this.innerText = e;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Returns the CSS styles for the component.
|
|
49
|
+
*
|
|
50
|
+
* @static
|
|
51
|
+
* @returns {CSSStyleSheet}
|
|
52
|
+
*/
|
|
53
|
+
static get cssStyleSheet() {
|
|
54
|
+
return b;
|
|
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 [];
|
|
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(e, v, w) {
|
|
80
|
+
let s = document.createDocumentFragment(), i = document.createElement("div");
|
|
81
|
+
i.classList.add("native-option"), i.setAttribute("part", "native");
|
|
82
|
+
let a = document.createElement("wje-icon");
|
|
83
|
+
a.setAttribute("name", "check");
|
|
84
|
+
let r = document.createElement("slot");
|
|
85
|
+
r.setAttribute("name", "start");
|
|
86
|
+
let c = document.createElement("slot"), l = document.createElement("slot");
|
|
87
|
+
return l.setAttribute("name", "end"), i.appendChild(a), i.appendChild(r), i.appendChild(c), i.appendChild(l), s.appendChild(i), s;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Adds event listeners after the component is drawn.
|
|
91
|
+
*/
|
|
92
|
+
afterDraw() {
|
|
93
|
+
h.addListener(this, "click", "wje:option-change");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
d.define("wje-option", d);
|
|
97
|
+
export {
|
|
98
|
+
d as default
|
|
99
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var c = (o, e, t) => e in o ? p(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var a = (o, e, t) => (c(o, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import d, { event as u } from "./wje-element.js";
|
|
5
|
+
import h from "./wje-option.js";
|
|
6
|
+
class r extends d {
|
|
7
|
+
/**
|
|
8
|
+
* Creates an instance of Options.
|
|
9
|
+
*
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
a(this, "depandencies", {
|
|
15
|
+
"wje-option": h
|
|
16
|
+
});
|
|
17
|
+
a(this, "className", "Options");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns the list of attributes to observe for changes.
|
|
21
|
+
*
|
|
22
|
+
* @static
|
|
23
|
+
* @returns {Array<string>}
|
|
24
|
+
*/
|
|
25
|
+
static get observedAttributes() {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Sets up the attributes for the component.
|
|
30
|
+
*/
|
|
31
|
+
setupAttributes() {
|
|
32
|
+
this.isShadowRoot = "open";
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Prepares the component before drawing.
|
|
36
|
+
* Fetches the pages and creates the options elements.
|
|
37
|
+
*/
|
|
38
|
+
async beforeDraw() {
|
|
39
|
+
this.response = await this.getPages();
|
|
40
|
+
let t = document.createDocumentFragment();
|
|
41
|
+
this.response.forEach((s, i) => {
|
|
42
|
+
let n = document.createElement("wje-option");
|
|
43
|
+
n.setAttribute("value", s[this.itemValue] || s.value), n.innerText = s[this.itemText] || s.text, t.appendChild(n);
|
|
44
|
+
}), this.parentElement.appendChild(t), u.dispatchCustomEvent(this, "wje-options:load", {});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Fetches the pages from the provided URL.
|
|
48
|
+
*
|
|
49
|
+
* @param {number} page - The page number to fetch.
|
|
50
|
+
* @returns {Promise<Object>} The fetched data.
|
|
51
|
+
* @throws Will throw an error if the response is not ok.
|
|
52
|
+
*/
|
|
53
|
+
async getPages(t) {
|
|
54
|
+
const s = await fetch(this.url);
|
|
55
|
+
if (!s.ok)
|
|
56
|
+
throw new Error(`An error occurred: ${s.status}`);
|
|
57
|
+
return await s.json();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
r.define("wje-options", r);
|
|
61
|
+
export {
|
|
62
|
+
r as default
|
|
63
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
var A = Object.defineProperty;
|
|
2
|
+
var j = (i, o, e) => o in i ? A(i, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[o] = e;
|
|
3
|
+
var g = (i, o, e) => (j(i, typeof o != "symbol" ? o + "" : o, e), e);
|
|
4
|
+
import k from "./wje-element.js";
|
|
5
|
+
const f = ':host(.wje-color-primary) #bar{--wje-progress-bar-color: var(--wje-color-primary)}:host(.wje-color-complete) #bar{--wje-progress-bar-color: var(--wje-color-complete)}:host(.wje-color-success) #bar{--wje-progress-bar-color: var(--wje-color-success)}:host(.wje-color-warning) #bar{--wje-progress-bar-color: var(--wje-color-warning)}:host(.wje-color-danger) #bar{--wje-progress-bar-color: var(--wje-color-danger)}:host(.wje-color-dark) #bar{--wje-progress-bar-color: var(--wje-color-contrast-0)}:host(.wje-color-light) #bar{--wje-progress-bar-color: var(--wje-color-contrast-11)}:host{--wje-progress-bar-color: var(--wje-color-contrast-6);--wje-progress-bar-text-size: .75rem;--wje-progress-bar-text-color: var(--wje-color);--wje-progress-bar-stroke: var(--wje-color-contrast-3);stroke:var(--wje-progress-bar-stroke)}:host .progress{position:relative;display:flex;align-items:center}:host .slot-wrapper{display:flex;position:absolute;top:0;align-items:center;width:100%;height:100%;justify-content:center}:host #bar{stroke:var(--wje-progress-bar-color)}:host text{transform:rotate(90deg);transform-origin:center;text-anchor:middle;dominant-baseline:middle;font-size:var(--wje-progress-bar-text-size);fill:var(--wje-progress-bar-text-color);stroke:var(--wje-progress-bar-text-color)}:host(.wje-color) #bar{stroke:var(--wje-progress-bar-color)}::slotted([slot="start"]){margin-inline:0 1rem}::slotted([slot="end"]){margin-inline:1rem 0}';
|
|
6
|
+
class w extends k {
|
|
7
|
+
/**
|
|
8
|
+
* Creates an instance of ProgressBar.
|
|
9
|
+
*
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
g(this, "className", "ProgressBar");
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Sets the radius of the progress bar.
|
|
18
|
+
*
|
|
19
|
+
* @param {number} value - The value to set.
|
|
20
|
+
*/
|
|
21
|
+
set radius(e) {
|
|
22
|
+
this.setAttribute("radius", e);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Gets the radius of the progress bar.
|
|
26
|
+
*
|
|
27
|
+
* @returns {number} The value of the radius.
|
|
28
|
+
*/
|
|
29
|
+
get radius() {
|
|
30
|
+
return +this.getAttribute("radius") || 70;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Gets the diameter of the progress bar.
|
|
34
|
+
*
|
|
35
|
+
* @returns {number} The value of the diameter.
|
|
36
|
+
*/
|
|
37
|
+
get diameter() {
|
|
38
|
+
return this.radius * 2 + this.stroke;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Sets the stroke of the progress bar.
|
|
42
|
+
*
|
|
43
|
+
* @param {number} value - The value to set.
|
|
44
|
+
*/
|
|
45
|
+
set stroke(e) {
|
|
46
|
+
this.setAttribute("stroke", e);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Gets the stroke of the progress bar.
|
|
50
|
+
*
|
|
51
|
+
* @returns {number} The value of the stroke.
|
|
52
|
+
*/
|
|
53
|
+
get stroke() {
|
|
54
|
+
return +this.getAttribute("stroke") || 6;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Gets the linecap of the progress bar.
|
|
58
|
+
*
|
|
59
|
+
* @returns {string} The value of the linecap.
|
|
60
|
+
*/
|
|
61
|
+
get linecap() {
|
|
62
|
+
return this.getAttribute("linecap") || "square";
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Returns the CSS styles for the component.
|
|
66
|
+
*
|
|
67
|
+
* @static
|
|
68
|
+
* @returns {CSSStyleSheet}
|
|
69
|
+
*/
|
|
70
|
+
static get cssStyleSheet() {
|
|
71
|
+
return f;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Returns the list of attributes to observe for changes.
|
|
75
|
+
*
|
|
76
|
+
* @static
|
|
77
|
+
* @returns {Array<string>}
|
|
78
|
+
*/
|
|
79
|
+
static get observedAttributes() {
|
|
80
|
+
return ["progress"];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Sets up the attributes for the component.
|
|
84
|
+
*/
|
|
85
|
+
setupAttributes() {
|
|
86
|
+
this.isShadowRoot = "open";
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Draws the component.
|
|
90
|
+
*
|
|
91
|
+
* @param {Object} context - The context for drawing.
|
|
92
|
+
* @param {Object} store - The store for drawing.
|
|
93
|
+
* @param {Object} params - The parameters for drawing.
|
|
94
|
+
* @returns {DocumentFragment}
|
|
95
|
+
*/
|
|
96
|
+
draw(e, h, l) {
|
|
97
|
+
let c = this.radius + this.stroke / 2, u = document.createDocumentFragment();
|
|
98
|
+
l.color && this.classList.add("wje-color-" + l.color, "wje-color");
|
|
99
|
+
let a = document.createElement("div");
|
|
100
|
+
a.classList.add("progress");
|
|
101
|
+
let m = document.createElement("slot"), d = document.createElement("div");
|
|
102
|
+
d.classList.add("slot-wrapper");
|
|
103
|
+
let p = document.createElement("slot");
|
|
104
|
+
p.setAttribute("name", "start");
|
|
105
|
+
let b = document.createElement("slot");
|
|
106
|
+
b.setAttribute("name", "end");
|
|
107
|
+
let s = document.createElementNS("http://www.w3.org/2000/svg", "svg"), r, t;
|
|
108
|
+
if ((this == null ? void 0 : this.type) === "circle") {
|
|
109
|
+
s.setAttribute("width", this.diameter), s.setAttribute("height", this.diameter), s.setAttribute("viewBox", `0 0 ${this.diameter} ${this.diameter}`), s.setAttribute("style", "transform: rotate(-90deg)"), r = document.createElementNS("http://www.w3.org/2000/svg", "circle"), r.setAttribute("r", this.radius), r.setAttribute("cx", c), r.setAttribute("cy", c), r.setAttribute("fill", "transparent"), t = document.createElementNS("http://www.w3.org/2000/svg", "circle"), t.setAttribute("r", this.radius), t.setAttribute("cx", c), t.setAttribute("cy", c), t.setAttribute("fill", "transparent"), t.setAttribute("stroke-dasharray", "0"), t.setAttribute("stroke-dashoffset", "0");
|
|
110
|
+
let n = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
111
|
+
n.setAttribute("x", "50%"), n.setAttribute("y", "50%"), n.innerHTML = this.progress + "%", s.appendChild(n);
|
|
112
|
+
} else
|
|
113
|
+
s.setAttribute("width", "100%"), s.setAttribute("height", this.stroke), s.setAttribute("preserveAspectRatio", "none"), r = document.createElementNS("http://www.w3.org/2000/svg", "line"), r.setAttribute("x1", 0), r.setAttribute("y1", this.stroke / 2), r.setAttribute("x2", "100%"), r.setAttribute("y2", this.stroke / 2), t = document.createElementNS("http://www.w3.org/2000/svg", "line"), t.setAttribute("x1", 0), t.setAttribute("y1", this.stroke / 2), t.setAttribute("x2", this.progress + "%"), t.setAttribute("y2", this.stroke / 2);
|
|
114
|
+
return r.setAttribute("stroke-linecap", this.linecap), r.setAttribute("stroke-width", this.stroke + "px"), t.setAttribute("stroke-linecap", this.linecap), t.setAttribute("stroke-width", this.stroke + "px"), t.setAttribute("id", "bar"), s.appendChild(r), s.appendChild(t), d.appendChild(m), a.appendChild(p), a.appendChild(d), a.appendChild(s), a.appendChild(b), u.appendChild(a), this.background = r, this.bar = t, u;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Adds event listeners after the component is drawn.
|
|
118
|
+
*/
|
|
119
|
+
afterDraw(e, h, l) {
|
|
120
|
+
this.type === "circle" && (this.background.setAttribute("stroke-dasharray", this.getCircleDashoffset(100) + "px"), this.background.setAttribute("stroke-dashoffset", "0px"), this.bar.setAttribute("stroke-dasharray", this.getCircleDasharray(this.radius) + "px"), this.bar.setAttribute("stroke-dashoffset", this.getCircleDashoffset(l.progress, this.radius) + "px"));
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Returns the dasharray for a circle with the given radius.
|
|
124
|
+
*
|
|
125
|
+
* @param {number} radius - The radius of the circle.
|
|
126
|
+
* @returns {number} The dasharray value.
|
|
127
|
+
*/
|
|
128
|
+
getCircleDasharray(e = 70) {
|
|
129
|
+
return 2 * Math.PI * e;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Returns the dashoffset for a circle with the given progress and radius.
|
|
133
|
+
*
|
|
134
|
+
* @param {number} progress - The progress of the circle.
|
|
135
|
+
* @param {number} radius - The radius of the circle.
|
|
136
|
+
* @returns {number} The dashoffset value.
|
|
137
|
+
*/
|
|
138
|
+
getCircleDashoffset(e = 0, h) {
|
|
139
|
+
return this.getCircleDasharray(h) * ((100 - e) / 100);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
w.define("wje-progress-bar", w);
|
|
143
|
+
export {
|
|
144
|
+
w as default
|
|
145
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
var c = Object.defineProperty;
|
|
2
|
+
var u = (i, t, e) => t in i ? c(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
+
var n = (i, t, e) => (u(i, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
+
import h from "./wje-element.js";
|
|
5
|
+
import r from "./wje-radio.js";
|
|
6
|
+
const m = ".wje-inline{display:flex;flex-direction:row;flex-wrap:wrap;gap:.5rem}";
|
|
7
|
+
class l extends h {
|
|
8
|
+
/**
|
|
9
|
+
* Creates an instance of RadioGroup.
|
|
10
|
+
*
|
|
11
|
+
* @constructor
|
|
12
|
+
*/
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
n(this, "className", "RadioGroup");
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Returns the CSS styles for the component.
|
|
19
|
+
*
|
|
20
|
+
* @static
|
|
21
|
+
* @returns {CSSStyleSheet}
|
|
22
|
+
*/
|
|
23
|
+
static get cssStyleSheet() {
|
|
24
|
+
return m;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns the list of attributes to observe for changes.
|
|
28
|
+
*
|
|
29
|
+
* @static
|
|
30
|
+
* @returns {Array<string>}
|
|
31
|
+
*/
|
|
32
|
+
static get observedAttributes() {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Sets up the attributes for the component.
|
|
37
|
+
*/
|
|
38
|
+
setupAttributes() {
|
|
39
|
+
this.isShadowRoot = "open";
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Draws the component.
|
|
43
|
+
*
|
|
44
|
+
* @param {Object} context - The context for drawing.
|
|
45
|
+
* @param {Object} store - The store for drawing.
|
|
46
|
+
* @param {Object} params - The parameters for drawing.
|
|
47
|
+
* @returns {DocumentFragment}
|
|
48
|
+
*/
|
|
49
|
+
draw(e, s, p) {
|
|
50
|
+
let o = document.createDocumentFragment(), a = document.createElement("div");
|
|
51
|
+
a.classList.add("native-radio-group", this.hasAttribute("inline") ? "wje-inline" : "ddd");
|
|
52
|
+
let d = document.createElement("slot");
|
|
53
|
+
return a.appendChild(d), o.appendChild(a), o;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Adds event listeners after the component is drawn.
|
|
57
|
+
* Handles the selection of radio buttons.
|
|
58
|
+
*/
|
|
59
|
+
afterDraw() {
|
|
60
|
+
this.value && this.setRadioToChekced(this.getRadioByValue(this.value)), this.addEventListener("wje-radio:input", (e) => {
|
|
61
|
+
this.removeCheck(), this.setRadioToChekced(e.detail.context);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Returns the radio button with the given value.
|
|
66
|
+
*
|
|
67
|
+
* @param {string} value - The value of the radio button.
|
|
68
|
+
* @returns {Radio} The radio button.
|
|
69
|
+
*/
|
|
70
|
+
getRadioByValue(e) {
|
|
71
|
+
return this.getAllElements().filter((s) => s instanceof r && s.value === e)[0];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Removes the check from all radio buttons.
|
|
75
|
+
*/
|
|
76
|
+
removeCheck() {
|
|
77
|
+
this.getAllElements().forEach((e) => {
|
|
78
|
+
e instanceof r && (e.checked = !1);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Sets the given radio button to checked.
|
|
83
|
+
*
|
|
84
|
+
* @param {Radio} radio - The radio button to check.
|
|
85
|
+
*/
|
|
86
|
+
setRadioToChekced(e) {
|
|
87
|
+
e instanceof r && (this.setAttribute("value", e.value), e.checked = !0);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Returns all the elements in the radio group.
|
|
91
|
+
*
|
|
92
|
+
* @returns {Array<Element>} The elements.
|
|
93
|
+
*/
|
|
94
|
+
getAllElements() {
|
|
95
|
+
return Array.from(this.childNodes);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
l.define("wje-radio-group", l);
|
|
99
|
+
export {
|
|
100
|
+
l as default
|
|
101
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
var l = Object.defineProperty;
|
|
2
|
+
var s = (i, t, e) => t in i ? l(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
+
var a = (i, t, e) => (s(i, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
+
import p, { event as n } from "./wje-element.js";
|
|
5
|
+
const h = ':host{--wje-radio-margin-top: 0;--wje-radio-margin-bottom: .5rem;--wje-radio-margin-inline: 0;display:block;margin-top:var(--wje-radio-margin-top);margin-bottom:var(--wje-radio-margin-bottom);margin-inline:var(--wje-radio-margin-inline);line-height:100%;padding-left:0}:host label{display:inline-flex;cursor:pointer;position:relative;padding-left:1.5rem;min-width:16px;min-height:16px;margin-bottom:0;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;align-items:center}: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-1);border:1px solid var(--wje-color-contrast-4)}.native-radio input[type=radio]+label:before{border-radius:var(--wje-border-radius-circle);transition:border .3s 0s cubic-bezier(.455,.03,.215,1.33)}.native-radio input[type=radio]:checked+label:before{border-color:var(--wje-color-contrast-6);border-width:5px}.native-radio input[type=radio]:focus+label{color:var(--wje-color)}.native-radio input[type=radio]:focus+label:before{outline:none!important;box-shadow:0 0 #78c8fe}.native-radio input[type=radio]{opacity:0;position:absolute;top:3px;width:16px;height:16px}.native-radio input[type=radio][disabled]+label{cursor:not-allowed!important;color:var(--wje-color-contrast-9);opacity:.5}.native-radio input[type=radio][disabled]+label:before{cursor:not-allowed!important}.success input[type=radio]:checked+label:before{border-color:var(--wje-color-success)}.primary input[type=radio]:checked+label:before{border-color:var(--wje-color-primary)}.complete input[type=radio]:checked+label:before{border-color:var(--wje-color-complete)}.warning input[type=radio]:checked+label:before{border-color:var(--wje-color-warning)}.danger input[type=radio]:checked+label:before{border-color:var(--wje-color-danger)}.neutral input[type=radio]:checked+label:before{border-color:var(--wje-color-info)}';
|
|
6
|
+
class c extends p {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
a(this, "className", "Radio");
|
|
10
|
+
a(this, "inputEvent", (e) => {
|
|
11
|
+
this.checked = e.target.checked;
|
|
12
|
+
});
|
|
13
|
+
this._checked = !1;
|
|
14
|
+
}
|
|
15
|
+
set checked(e) {
|
|
16
|
+
this._checked = e, e ? this.setAttribute("checked", "") : this.removeAttribute("checked");
|
|
17
|
+
}
|
|
18
|
+
get checked() {
|
|
19
|
+
return this._checked;
|
|
20
|
+
}
|
|
21
|
+
static get cssStyleSheet() {
|
|
22
|
+
return h;
|
|
23
|
+
}
|
|
24
|
+
static get observedAttributes() {
|
|
25
|
+
return ["checked"];
|
|
26
|
+
}
|
|
27
|
+
setupAttributes() {
|
|
28
|
+
this.isShadowRoot = "open";
|
|
29
|
+
}
|
|
30
|
+
draw(e, b, u) {
|
|
31
|
+
let d = document.createDocumentFragment(), r = document.createElement("div");
|
|
32
|
+
r.classList.add("native-radio"), this.color && r.classList.add(this.color), this.input = document.createElement("input"), this.input.type = "radio", this.input.id = "radio", this.input.name = this.name + "-radio", this.input.checked = this.hasAttribute("checked"), this.input.disabled = this.hasAttribute("disabled"), this.input.indeterminate = this.hasAttribute("indeterminate");
|
|
33
|
+
let o = document.createElement("label");
|
|
34
|
+
return o.htmlFor = "radio", o.innerHTML = "<slot></slot>", r.appendChild(this.input), r.appendChild(o), d.appendChild(r), d;
|
|
35
|
+
}
|
|
36
|
+
afterDraw() {
|
|
37
|
+
this.hasAttribute("disabled") || (n.addListener(this, "click", "wje-radio:change"), n.addListener(this, "click", "wje-radio:input"));
|
|
38
|
+
}
|
|
39
|
+
disconnectedCallback() {
|
|
40
|
+
n.removeElement(this);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
c.define("wje-radio", c);
|
|
44
|
+
export {
|
|
45
|
+
c as default
|
|
46
|
+
};
|