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,161 @@
|
|
|
1
|
+
var A = Object.defineProperty;
|
|
2
|
+
var j = (c, o, e) => o in c ? A(c, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[o] = e;
|
|
3
|
+
var g = (c, o, e) => (j(c, typeof o != "symbol" ? o + "" : o, e), e);
|
|
4
|
+
import k from "./wje-element.js";
|
|
5
|
+
const v = ':host([color="primary"]){--wje-progress-bar-background-color: var(--wje-color-primary-2);--wje-progress-bar-color: var(--wje-color-primary-9)}:host([color="complete"]){--wje-progress-bar-background-color: var(--wje-color-complete-2);--wje-progress-bar-color: var(--wje-color-complete-9)}:host([color="success"]){--wje-progress-bar-background-color: var(--wje-color-success-2);--wje-progress-bar-color: var(--wje-color-success-9)}:host([color="warning"]){--wje-progress-bar-background-color: var(--wje-color-warning-2);--wje-progress-bar-color: var(--wje-color-warning-9)}:host([color="danger"]){--wje-progress-bar-background-color: var(--wje-color-danger-2);--wje-progress-bar-color: var(--wje-color-danger-9)}:host([color="info"]){--wje-progress-bar-background-color: var(--wje-color-info-2);--wje-progress-bar-color: var(--wje-color-info-9)}:host{--wje-progress-bar-background-color: var(--wje-color-contrast-2);--wje-progress-bar-color: var(--wje-color-contrast-6);--wje-progress-bar-text-size: .75rem;--wje-progress-bar-text-color: var(--wje-color);fill:var(--wje-progress-bar-background-color)}: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{fill: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{fill: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;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Gets the diameter of the progress bar.
|
|
42
|
+
*
|
|
43
|
+
* @returns {number} The value of the diameter.
|
|
44
|
+
*/
|
|
45
|
+
get containerSize() {
|
|
46
|
+
return this.diameter + 2 * this.stroke;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Sets the stroke of the progress bar.
|
|
50
|
+
*
|
|
51
|
+
* @param {number} value - The value to set.
|
|
52
|
+
*/
|
|
53
|
+
set stroke(e) {
|
|
54
|
+
this.setAttribute("stroke", e);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Gets the stroke of the progress bar.
|
|
58
|
+
*
|
|
59
|
+
* @returns {number} The value of the stroke.
|
|
60
|
+
*/
|
|
61
|
+
get stroke() {
|
|
62
|
+
return +this.getAttribute("stroke") || 6;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Gets the linecap of the progress bar.
|
|
66
|
+
*
|
|
67
|
+
* @returns {string} The value of the linecap.
|
|
68
|
+
*/
|
|
69
|
+
get linecap() {
|
|
70
|
+
return this.getAttribute("linecap") || "square";
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Returns the CSS styles for the component.
|
|
74
|
+
*
|
|
75
|
+
* @static
|
|
76
|
+
* @returns {CSSStyleSheet}
|
|
77
|
+
*/
|
|
78
|
+
static get cssStyleSheet() {
|
|
79
|
+
return v;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Returns the list of attributes to observe for changes.
|
|
83
|
+
*
|
|
84
|
+
* @static
|
|
85
|
+
* @returns {Array<string>}
|
|
86
|
+
*/
|
|
87
|
+
static get observedAttributes() {
|
|
88
|
+
return ["progress"];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Sets up the attributes for the component.
|
|
92
|
+
*/
|
|
93
|
+
setupAttributes() {
|
|
94
|
+
this.isShadowRoot = "open";
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Draws the component.
|
|
98
|
+
*
|
|
99
|
+
* @param {Object} context - The context for drawing.
|
|
100
|
+
* @param {Object} store - The store for drawing.
|
|
101
|
+
* @param {Object} params - The parameters for drawing.
|
|
102
|
+
* @returns {DocumentFragment}
|
|
103
|
+
*/
|
|
104
|
+
draw(e, a, u) {
|
|
105
|
+
this.radius + this.stroke / 2;
|
|
106
|
+
let n = document.createDocumentFragment();
|
|
107
|
+
u.color && this.classList.add("wje-color");
|
|
108
|
+
let i = document.createElement("div");
|
|
109
|
+
i.classList.add("progress");
|
|
110
|
+
let m = document.createElement("slot"), h = document.createElement("div");
|
|
111
|
+
h.classList.add("slot-wrapper");
|
|
112
|
+
let b = document.createElement("slot");
|
|
113
|
+
b.setAttribute("name", "start");
|
|
114
|
+
let p = document.createElement("slot");
|
|
115
|
+
p.setAttribute("name", "end");
|
|
116
|
+
const l = "http://www.w3.org/2000/svg";
|
|
117
|
+
let s = document.createElementNS(l, "svg"), r, t;
|
|
118
|
+
if ((this == null ? void 0 : this.type) === "circle") {
|
|
119
|
+
s.setAttribute("width", this.containerSize), s.setAttribute("height", this.containerSize), s.setAttribute("viewBox", `0 0 ${this.containerSize} ${this.containerSize}`), s.setAttribute("style", "transform: rotate(-90deg)"), r = document.createElementNS(l, "circle"), r.setAttribute("stroke", "var(--wje-progress-bar-background-color)"), r.setAttribute("stroke-width", this.stroke), r.setAttribute("fill", "transparent"), r.setAttribute("r", this.radius), r.setAttribute("cx", this.containerSize / 2), r.setAttribute("cy", this.containerSize / 2), t = document.createElementNS(l, "circle"), t.setAttribute("stroke", "var(--wje-progress-bar-color)"), t.setAttribute("stroke-width", this.stroke), t.setAttribute("fill", "transparent"), t.setAttribute("r", this.radius), t.setAttribute("cx", this.containerSize / 2), t.setAttribute("cy", this.containerSize / 2), t.setAttribute("stroke-linecap", this.linecap);
|
|
120
|
+
let d = document.createElementNS(l, "text");
|
|
121
|
+
d.setAttribute("x", "50%"), d.setAttribute("y", "50%"), d.innerHTML = this.progress + "%", s.appendChild(d);
|
|
122
|
+
} else
|
|
123
|
+
s.setAttribute("width", "100%"), s.setAttribute("height", this.stroke), s.setAttribute("preserveAspectRatio", "none"), r = document.createElementNS(l, "rect"), r.setAttribute("x", 0), r.setAttribute("y", 0), r.setAttribute("width", "100%"), r.setAttribute("height", this.stroke), this.linecap === "round" && (r.setAttribute("rx", this.stroke / 2), r.setAttribute("ry", this.stroke / 2)), t = document.createElementNS(l, "rect"), t.setAttribute("x", 0), t.setAttribute("y", 0), t.setAttribute("width", this.progress + "%"), t.setAttribute("height", this.stroke), t.setAttribute("id", "bar"), this.linecap === "round" && (t.setAttribute("rx", this.stroke / 2), t.setAttribute("ry", this.stroke / 2));
|
|
124
|
+
return s.appendChild(r), s.appendChild(t), h.appendChild(m), i.appendChild(b), i.appendChild(h), i.appendChild(s), i.appendChild(p), n.appendChild(i), this.background = r, this.bar = t, n;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Adds event listeners after the component is drawn.
|
|
128
|
+
*/
|
|
129
|
+
afterDraw(e, a, u) {
|
|
130
|
+
this.type === "circle" && this.setCircleProgress(this.progress);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Returns the dasharray for a circle with the given radius.
|
|
134
|
+
*
|
|
135
|
+
* @param {number} radius - The radius of the circle.
|
|
136
|
+
* @returns {number} The dasharray value.
|
|
137
|
+
*/
|
|
138
|
+
getCircleDasharray(e = 70) {
|
|
139
|
+
return 2 * Math.PI * e;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Returns the dashoffset for a circle with the given progress and radius.
|
|
143
|
+
*
|
|
144
|
+
* @param {number} progress - The progress of the circle.
|
|
145
|
+
* @param {number} radius - The radius of the circle.
|
|
146
|
+
* @returns {number} The dashoffset value.
|
|
147
|
+
*/
|
|
148
|
+
getCircleDashoffset(e = 0, a) {
|
|
149
|
+
return this.getCircleDasharray(a) * ((100 - e) / 100);
|
|
150
|
+
}
|
|
151
|
+
setCircleProgress(e) {
|
|
152
|
+
const a = this.bar, u = a.r.baseVal.value, n = 2 * Math.PI * u;
|
|
153
|
+
a.style.strokeDasharray = `${n}`;
|
|
154
|
+
const i = n - e / 100 * n;
|
|
155
|
+
a.style.strokeDashoffset = i;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
w.define("wje-progress-bar", w);
|
|
159
|
+
export {
|
|
160
|
+
w as default
|
|
161
|
+
};
|