wj-elements 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/dist/dark.css +0 -1
- package/dist/light.css +0 -1
- package/dist/localize-DVuO3S17.js +0 -43
- package/dist/popup.element-CpEjis9f.js +0 -1068
- package/dist/router-links-FtZbFUto.js +0 -146
- package/dist/styles.css +0 -1
- package/dist/wje-accordion-item.js +0 -88
- package/dist/wje-accordion.js +0 -79
- package/dist/wje-animation.js +0 -121
- package/dist/wje-aside.js +0 -55
- package/dist/wje-avatar.js +0 -74
- package/dist/wje-badge.js +0 -50
- package/dist/wje-breadcrumb.js +0 -148
- package/dist/wje-breadcrumbs.js +0 -67
- package/dist/wje-button-group.js +0 -78
- package/dist/wje-button.js +0 -175
- package/dist/wje-card-content.js +0 -48
- package/dist/wje-card-controls.js +0 -48
- package/dist/wje-card-header.js +0 -47
- package/dist/wje-card-subtitle.js +0 -55
- package/dist/wje-card-title.js +0 -55
- package/dist/wje-card.js +0 -50
- package/dist/wje-carousel-item.js +0 -33
- package/dist/wje-carousel.js +0 -177
- package/dist/wje-checkbox.js +0 -104
- package/dist/wje-chip.js +0 -32
- package/dist/wje-col.js +0 -27
- package/dist/wje-color-picker.js +0 -953
- package/dist/wje-container.js +0 -57
- package/dist/wje-copy-button.js +0 -164
- package/dist/wje-dialog.js +0 -86
- package/dist/wje-divider.js +0 -53
- package/dist/wje-dropdown.js +0 -68
- package/dist/wje-element.js +0 -453
- package/dist/wje-fetchAndParseCSS.js +0 -40
- package/dist/wje-file-upload-item.js +0 -115
- package/dist/wje-file-upload.js +0 -297
- package/dist/wje-footer.js +0 -56
- package/dist/wje-form.js +0 -28
- package/dist/wje-format-digital.js +0 -85
- package/dist/wje-grid.js +0 -28
- package/dist/wje-header.js +0 -58
- package/dist/wje-icon-picker.js +0 -221
- package/dist/wje-icon.js +0 -119
- package/dist/wje-img-comparer.js +0 -111
- package/dist/wje-img.js +0 -58
- package/dist/wje-infinite-scroll.js +0 -193
- package/dist/wje-inline-edit.js +0 -120
- package/dist/wje-input-file.js +0 -85
- package/dist/wje-input.js +0 -240
- package/dist/wje-item.js +0 -45
- package/dist/wje-label.js +0 -67
- package/dist/wje-list.js +0 -53
- package/dist/wje-main.js +0 -56
- package/dist/wje-masonry.js +0 -218
- package/dist/wje-master.js +0 -196
- package/dist/wje-menu-button.js +0 -65
- package/dist/wje-menu-item.js +0 -192
- package/dist/wje-menu-label.js +0 -57
- package/dist/wje-menu.js +0 -74
- package/dist/wje-option.js +0 -99
- package/dist/wje-options.js +0 -63
- package/dist/wje-popup.js +0 -5
- package/dist/wje-progress-bar.js +0 -145
- package/dist/wje-radio-group.js +0 -101
- package/dist/wje-radio.js +0 -46
- package/dist/wje-rate.js +0 -260
- package/dist/wje-relative-time.js +0 -85
- package/dist/wje-reorder-dropzone.js +0 -27
- package/dist/wje-reorder-item.js +0 -32
- package/dist/wje-reorder.js +0 -132
- package/dist/wje-route.js +0 -28
- package/dist/wje-router-link.js +0 -64
- package/dist/wje-router-outlet.js +0 -127
- package/dist/wje-routerx.js +0 -1088
- package/dist/wje-row.js +0 -58
- package/dist/wje-select.js +0 -240
- package/dist/wje-slider.js +0 -177
- package/dist/wje-split-view.js +0 -112
- package/dist/wje-store.js +0 -192
- package/dist/wje-tab-group.js +0 -105
- package/dist/wje-tab-panel.js +0 -52
- package/dist/wje-tab.js +0 -59
- package/dist/wje-textarea.js +0 -116
- package/dist/wje-thumbnail.js +0 -64
- package/dist/wje-toast.js +0 -76
- package/dist/wje-toggle.js +0 -94
- package/dist/wje-toolbar-action.js +0 -63
- package/dist/wje-toolbar.js +0 -61
- package/dist/wje-tooltip.js +0 -105
- package/dist/wje-visually-hidden.js +0 -56
package/dist/wje-row.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
var w = Object.defineProperty;
|
|
2
|
-
var l = (g, t, e) => t in g ? w(g, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : g[t] = e;
|
|
3
|
-
var o = (g, t, e) => (l(g, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
-
import u from "./wje-element.js";
|
|
5
|
-
const j = ":host{display:flex;flex-wrap:wrap}:host(.wje-wrap){flex-wrap:wrap!important}:host{--wje-gutter-x: 1.5rem;--wje-gutter-y: 0;display:flex;flex-wrap:nowrap;margin-top:calc(var(--wje-gutter-y) * -1);margin-right:calc(var(--wje-gutter-x) * -.5);margin-left:calc(var(--wje-gutter-x) * -.5)}:host(.g-0),:host(.gx-0){--wje-gutter-x: 0}:host(.g-0),:host(.gy-0){--wje-gutter-y: 0}:host(.g-1),:host(.gx-1){--wje-gutter-x: .25rem}:host(.g-1),:host(.gy-1){--wje-gutter-y: .25rem}:host(.g-2),:host(.gx-2){--wje-gutter-x: .5rem}:host(.g-2),:host(.gy-2){--wje-gutter-y: .5rem}:host(.g-3),:host(.gx-3){--wje-gutter-x: 1rem}:host(.g-3),:host(.gy-3){--wje-gutter-y: 1rem}:host(.g-4),:host(.gx-4){--wje-gutter-x: 1.5rem}:host(.g-4),:host(.gy-4){--wje-gutter-y: 1.5rem}:host(.g-5),:host(.gx-5){--wje-gutter-x: 3rem}:host(.g-5),:host(.gy-5){--wje-gutter-y: 3rem}@media (min-width: 576px){:host(.g-sm-0),:host(.gx-sm-0){--wje-gutter-x: 0}:host(.g-sm-0),:host(.gy-sm-0){--wje-gutter-y: 0}:host(.g-sm-1),:host(.gx-sm-1){--wje-gutter-x: .25rem}:host(.g-sm-1),:host(.gy-sm-1){--wje-gutter-y: .25rem}:host(.g-sm-2),:host(.gx-sm-2){--wje-gutter-x: .5rem}:host(.g-sm-2),:host(.gy-sm-2){--wje-gutter-y: .5rem}:host(.g-sm-3),:host(.gx-sm-3){--wje-gutter-x: 1rem}:host(.g-sm-3),:host(.gy-sm-3){--wje-gutter-y: 1rem}:host(.g-sm-4),:host(.gx-sm-4){--wje-gutter-x: 1.5rem}:host(.g-sm-4),:host(.gy-sm-4){--wje-gutter-y: 1.5rem}:host(.g-sm-5),:host(.gx-sm-5){--wje-gutter-x: 3rem}:host(.g-sm-5),:host(.gy-sm-5){--wje-gutter-y: 3rem}}@media (min-width: 768px){:host(.g-md-0),:host(.gx-md-0){--wje-gutter-x: 0}:host(.g-md-0),:host(.gy-md-0){--wje-gutter-y: 0}:host(.g-md-1),:host(.gx-md-1){--wje-gutter-x: .25rem}:host(.g-md-1),:host(.gy-md-1){--wje-gutter-y: .25rem}:host(.g-md-2),:host(.gx-md-2){--wje-gutter-x: .5rem}:host(.g-md-2),:host(.gy-md-2){--wje-gutter-y: .5rem}:host(.g-md-3),:host(.gx-md-3){--wje-gutter-x: 1rem}:host(.g-md-3),:host(.gy-md-3){--wje-gutter-y: 1rem}:host(.g-md-4),:host(.gx-md-4){--wje-gutter-x: 1.5rem}:host(.g-md-4),:host(.gy-md-4){--wje-gutter-y: 1.5rem}:host(.g-md-5),:host(.gx-md-5){--wje-gutter-x: 3rem}:host(.g-md-5),:host(.gy-md-5){--wje-gutter-y: 3rem}}@media (min-width: 992px){:host(.g-lg-0),:host(.gx-lg-0){--wje-gutter-x: 0}:host(.g-lg-0),:host(.gy-lg-0){--wje-gutter-y: 0}:host(.g-lg-1),:host(.gx-lg-1){--wje-gutter-x: .25rem}:host(.g-lg-1),:host(.gy-lg-1){--wje-gutter-y: .25rem}:host(.g-lg-2),:host(.gx-lg-2){--wje-gutter-x: .5rem}:host(.g-lg-2),:host(.gy-lg-2){--wje-gutter-y: .5rem}:host(.g-lg-3),:host(.gx-lg-3){--wje-gutter-x: 1rem}:host(.g-lg-3),:host(.gy-lg-3){--wje-gutter-y: 1rem}:host(.g-lg-4),:host(.gx-lg-4){--wje-gutter-x: 1.5rem}:host(.g-lg-4),:host(.gy-lg-4){--wje-gutter-y: 1.5rem}:host(.g-lg-5),:host(.gx-lg-5){--wje-gutter-x: 3rem}:host(.g-lg-5),:host(.gy-lg-5){--wje-gutter-y: 3rem}}@media (min-width: 1200px){:host(.g-xl-0),:host(.gx-xl-0){--wje-gutter-x: 0}:host(.g-xl-0),:host(.gy-xl-0){--wje-gutter-y: 0}:host(.g-xl-1),:host(.gx-xl-1){--wje-gutter-x: .25rem}:host(.g-xl-1),:host(.gy-xl-1){--wje-gutter-y: .25rem}:host(.g-xl-2),:host(.gx-xl-2){--wje-gutter-x: .5rem}:host(.g-xl-2),:host(.gy-xl-2){--wje-gutter-y: .5rem}:host(.g-xl-3),:host(.gx-xl-3){--wje-gutter-x: 1rem}:host(.g-xl-3),:host(.gy-xl-3){--wje-gutter-y: 1rem}:host(.g-xl-4),:host(.gx-xl-4){--wje-gutter-x: 1.5rem}:host(.g-xl-4),:host(.gy-xl-4){--wje-gutter-y: 1.5rem}:host(.g-xl-5),:host(.gx-xl-5){--wje-gutter-x: 3rem}:host(.g-xl-5),:host(.gy-xl-5){--wje-gutter-y: 3rem}}@media (min-width: 1400px){:host(.g-xxl-0),:host(.gx-xxl-0){--wje-gutter-x: 0}:host(.g-xxl-0),:host(.gy-xxl-0){--wje-gutter-y: 0}:host(.g-xxl-1),:host(.gx-xxl-1){--wje-gutter-x: .25rem}:host(.g-xxl-1),:host(.gy-xxl-1){--wje-gutter-y: .25rem}:host(.g-xxl-2),:host(.gx-xxl-2){--wje-gutter-x: .5rem}:host(.g-xxl-2),:host(.gy-xxl-2){--wje-gutter-y: .5rem}:host(.g-xxl-3),:host(.gx-xxl-3){--wje-gutter-x: 1rem}:host(.g-xxl-3),:host(.gy-xxl-3){--wje-gutter-y: 1rem}:host(.g-xxl-4),:host(.gx-xxl-4){--wje-gutter-x: 1.5rem}:host(.g-xxl-4),:host(.gy-xxl-4){--wje-gutter-y: 1.5rem}:host(.g-xxl-5),:host(.gx-xxl-5){--wje-gutter-x: 3rem}:host(.g-xxl-5),:host(.gy-xxl-5){--wje-gutter-y: 3rem}}:host(.wje-justify-content-center){justify-content:center!important}:host(.wje-justify-content-end){justify-content:flex-end!important}:host(.wje-justify-content-between){justify-content:space-between!important}:host(.wje-justify-content-around){justify-content:space-around!important}:host(.wje-align-items-start){align-items:baseline!important}:host(.wje-align-items-center){align-items:center!important}:host(.wje-align-items-end){align-items:flex-end!important}";
|
|
6
|
-
class r extends u {
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of Row.
|
|
9
|
-
*
|
|
10
|
-
* @constructor
|
|
11
|
-
*/
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
o(this, "className", "Row");
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Returns the CSS styles for the component.
|
|
18
|
-
*
|
|
19
|
-
* @static
|
|
20
|
-
* @returns {CSSStyleSheet}
|
|
21
|
-
*/
|
|
22
|
-
static get cssStyleSheet() {
|
|
23
|
-
return j;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Sets up the attributes for the component.
|
|
27
|
-
*/
|
|
28
|
-
setupAttributes() {
|
|
29
|
-
this.isShadowRoot = "open";
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Executes before the component is drawn.
|
|
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
|
-
*/
|
|
38
|
-
beforeDraw(e, h, x) {
|
|
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, h, x) {
|
|
49
|
-
let s = document.createDocumentFragment();
|
|
50
|
-
this.hasAttribute("wrap") && this.classList.add("wje-wrap");
|
|
51
|
-
let m = document.createElement("slot");
|
|
52
|
-
return s.appendChild(m), s;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
r.define("wje-row", r);
|
|
56
|
-
export {
|
|
57
|
-
r as default
|
|
58
|
-
};
|
package/dist/wje-select.js
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
var f = Object.defineProperty;
|
|
2
|
-
var A = (n, a, e) => a in n ? f(n, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[a] = e;
|
|
3
|
-
var u = (n, a, e) => (A(n, typeof a != "symbol" ? a + "" : a, e), e);
|
|
4
|
-
import E from "./wje-element.js";
|
|
5
|
-
import x from "./wje-button.js";
|
|
6
|
-
import "./wje-popup.js";
|
|
7
|
-
import y from "./wje-icon.js";
|
|
8
|
-
import C from "./wje-label.js";
|
|
9
|
-
import L from "./wje-chip.js";
|
|
10
|
-
import { P as O } from "./popup.element-CpEjis9f.js";
|
|
11
|
-
const k = ":host{--wje-select-border-width: 1px;--wje-select-border-style: solid;--wje-select-border-color: var(--wje-border-color);--wje-select-options-border-width: 1px;--wje-select-options-border-style: var(--wje-border-style);--wje-select-options-border-color: var(--wje-border-color);--wje-select-background: var(--wje-background);--wje-select-line-height: 20px;--wje-select-color: var(--wje-color);--wje-select-border-radius: var(--wje-border-radius-medium);width:100%;display:block}:host [slot=arrow]{transform:rotate(0);transition:all .2s ease-in}.native-select.default .wrapper{display:block;border-width:var(--wje-select-border-width);border-style:var(--wje-select-border-style);border-color:var(--wje-select-border-color);border-radius:var(--wje-select-border-radius);padding-inline:.5rem;padding-top:.25rem;padding-bottom:.25rem}.native-select.default .input-wrapper{padding:0;min-height:25px;margin-top:-4px}.native-select.default.focused wje-label{opacity:.67;font-size:12px;letter-spacing:normal}.native-select.default wje-label{margin:0;display:block;opacity:1;cursor:text;transition:opacity .2s ease 0s;line-height:var(--wje-select-line-height)}.native-select.default wje-label.fade{opacity:.5;font-size:12px;letter-spacing:normal}.native-select.standard .wrapper{border-width:var(--wje-select-border-width);border-style:var(--wje-select-border-style);border-color:var(--wje-select-border-color);border-radius:var(--wje-select-border-radius)}.native-select.standard .input-wrapper{background:transparent;width:100%}.wrapper{display:flex;width:100%}.input-wrapper{display:grid;grid-template-columns:1fr auto auto;align-items:center;background-color:var(--wje-select-background);min-height:28px;color:var(--wje-select-color);line-height:var(--wje-select-line-height);-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:2px .5rem;font-size:14px;font-weight:400;vertical-align:middle}input{border:medium;height:25px;min-height:25px;padding:0;background:none;box-shadow:none;width:100%;outline:0}::placeholder{opacity:1}:host [active] .wrapper{border-radius:var(--wje-select-border-radius) var(--wje-select-border-radius) 0 0}:host [active] [slot=arrow]{transform:rotate(180deg);transition:all .2s ease-in}.option-wrapper{border-width:var(--wje-select-options-border-width);border-style:var(--wje-select-options-border-style);border-color:var(--wje-select-options-border-color);border-radius:0 0 var(--wje-select-border-radius) var(--wje-select-border-radius);margin-top:-1px;background:var(--wje-select-background);overflow:auto}:host([multiple]) input{position:absolute;z-index:-1;top:0;left:0;width:0;height:0;opacity:0}:host([multiple]) .chips{display:flex;flex:1;align-items:center;flex-wrap:wrap}:host([disabled]) .input-wrapper{opacity:.5;pointer-events:none;cursor:not-allowed}.counter{padding-inline:.5rem}wje-chip{--wje-chip-margin: 0 .25rem 0 0}wje-button{--wje-padding-top: .25rem;--wje-padding-start: .25rem;--wje-padding-end: .25rem;--wje-padding-bottom: .25rem;--wje-button-margin-inline: 0 .25rem}";
|
|
12
|
-
class v extends E {
|
|
13
|
-
/**
|
|
14
|
-
* Creates an instance of Select.
|
|
15
|
-
*
|
|
16
|
-
* @constructor
|
|
17
|
-
*/
|
|
18
|
-
constructor() {
|
|
19
|
-
super();
|
|
20
|
-
u(this, "depandencies", {
|
|
21
|
-
"wje-button": x,
|
|
22
|
-
"wje-popup": O,
|
|
23
|
-
"wje-icon": y,
|
|
24
|
-
"wje-label": C,
|
|
25
|
-
"wje-chip": L
|
|
26
|
-
});
|
|
27
|
-
u(this, "className", "Select");
|
|
28
|
-
/**
|
|
29
|
-
* Handles the option change event.
|
|
30
|
-
*
|
|
31
|
-
* @param {Event} e - The event.
|
|
32
|
-
*/
|
|
33
|
-
u(this, "optionChange", (e) => {
|
|
34
|
-
let t = this.getAllOptions();
|
|
35
|
-
this.hasAttribute("multiple") || (t.forEach((r) => {
|
|
36
|
-
r.selected = !1, r.removeAttribute("selected");
|
|
37
|
-
}), this.popup.removeAttribute("active")), e.target.selected = !e.target.hasAttribute("selected"), this.selections(e.target);
|
|
38
|
-
});
|
|
39
|
-
/**
|
|
40
|
-
* Handles the chip remove event.
|
|
41
|
-
*
|
|
42
|
-
* @param {Event} e - The event.
|
|
43
|
-
*/
|
|
44
|
-
u(this, "removeChip", (e) => {
|
|
45
|
-
let t = e.target.option;
|
|
46
|
-
t.selected = !1, t.removeAttribute("selected"), e.target.parentNode.removeChild(e.target), this.selections(null, 0);
|
|
47
|
-
});
|
|
48
|
-
this._selected = [], this.counterEl = null;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Sets the selected value.
|
|
52
|
-
*
|
|
53
|
-
* @param {Array} value - The selected value.
|
|
54
|
-
*/
|
|
55
|
-
set selected(e) {
|
|
56
|
-
this._selected = e;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Returns the selected value.
|
|
60
|
-
*
|
|
61
|
-
* @returns {Array} The selected value.
|
|
62
|
-
*/
|
|
63
|
-
get selected() {
|
|
64
|
-
return this.getSelected();
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Sets the trigger value.
|
|
68
|
-
*
|
|
69
|
-
* @param {string} value - The trigger value.
|
|
70
|
-
*/
|
|
71
|
-
set trigger(e) {
|
|
72
|
-
this.setAttribute("trigger", e);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Returns the trigger value.
|
|
76
|
-
*
|
|
77
|
-
* @returns {string} The trigger value.
|
|
78
|
-
*/
|
|
79
|
-
get trigger() {
|
|
80
|
-
return this.getAttribute("trigger") || "click";
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Returns the CSS styles for the component.
|
|
84
|
-
*
|
|
85
|
-
* @static
|
|
86
|
-
* @returns {CSSStyleSheet}
|
|
87
|
-
*/
|
|
88
|
-
static get cssStyleSheet() {
|
|
89
|
-
return k;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Returns the list of attributes to observe for changes.
|
|
93
|
-
*
|
|
94
|
-
* @static
|
|
95
|
-
* @returns {Array<string>}
|
|
96
|
-
*/
|
|
97
|
-
static get observedAttributes() {
|
|
98
|
-
return ["active", "value"];
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Sets up the attributes for the component.
|
|
102
|
-
*/
|
|
103
|
-
setupAttributes() {
|
|
104
|
-
this.isShadowRoot = "open";
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Draws the component.
|
|
108
|
-
*
|
|
109
|
-
* @param {Object} context - The context for drawing.
|
|
110
|
-
* @param {Object} store - The store for drawing.
|
|
111
|
-
* @param {Object} params - The parameters for drawing.
|
|
112
|
-
* @returns {DocumentFragment}
|
|
113
|
-
*/
|
|
114
|
-
draw(e, t, r) {
|
|
115
|
-
let i = document.createDocumentFragment();
|
|
116
|
-
this.classList.add("wje-placement", "wje-" + this.placement || "wje-start");
|
|
117
|
-
let s = document.createElement("div");
|
|
118
|
-
s.setAttribute("part", "native"), s.classList.add("native-select", this.variant || "default");
|
|
119
|
-
let p = document.createElement("div");
|
|
120
|
-
p.classList.add("wrapper"), p.setAttribute("slot", "anchor");
|
|
121
|
-
let m = document.createElement("wje-label");
|
|
122
|
-
m.innerText = this.label || "";
|
|
123
|
-
let d = document.createElement("div");
|
|
124
|
-
d.classList.add("input-wrapper");
|
|
125
|
-
let o = document.createElement("input");
|
|
126
|
-
o.setAttribute("type", "text"), o.setAttribute("part", "input"), o.setAttribute("autocomplete", "off"), o.setAttribute("readonly", ""), o.setAttribute("placeholder", this.placeholder || "");
|
|
127
|
-
let w = document.createElement("wje-icon");
|
|
128
|
-
w.setAttribute("name", "chevron-down"), w.setAttribute("slot", "arrow");
|
|
129
|
-
let b = document.createElement("div");
|
|
130
|
-
b.classList.add("chips"), b.innerText = this.placeholder || "";
|
|
131
|
-
let c = document.createElement("div");
|
|
132
|
-
c.classList.add("option-wrapper"), c.style.setProperty("height", this.maxHeight || "auto");
|
|
133
|
-
let j = document.createElement("slot"), h = document.createElement("wje-button");
|
|
134
|
-
h.setAttribute("fill", "link"), h.setAttribute("part", "clear");
|
|
135
|
-
let g = document.createElement("wje-icon");
|
|
136
|
-
g.setAttribute("name", "x"), h.appendChild(g);
|
|
137
|
-
let l = document.createElement("wje-popup");
|
|
138
|
-
return l.setAttribute("placement", "bottom-start"), l.setAttribute("manual", ""), l.setAttribute("size", ""), this.hasAttribute("disabled") && l.setAttribute("disabled", ""), this.variant === "standard" ? this.hasAttribute("label") && s.appendChild(m) : p.appendChild(m), d.appendChild(o), this.hasAttribute("multiple") && d.appendChild(b), this.hasAttribute("clearable") && d.appendChild(h), d.appendChild(w), c.appendChild(j), p.appendChild(d), l.appendChild(p), l.appendChild(c), this.trigger === "click" && l.setAttribute("manual", ""), s.appendChild(l), this.native = s, this.popup = l, this.labelElement = m, this.input = o, this.optionsWrapper = c, this.chips = b, this.clear = h, i.appendChild(s), i;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Sets up the event listeners after the component is drawn.
|
|
142
|
-
*
|
|
143
|
-
* @param {Object} context - The context for drawing.
|
|
144
|
-
* @param {Object} store - The store for drawing.
|
|
145
|
-
* @param {Object} params - The parameters for drawing.
|
|
146
|
-
*/
|
|
147
|
-
afterDraw(e, t, r) {
|
|
148
|
-
this.input.addEventListener("focus", (i) => {
|
|
149
|
-
this.labelElement.classList.add("fade"), this.native.classList.add("focused");
|
|
150
|
-
}), this.input.addEventListener("blur", (i) => {
|
|
151
|
-
this.native.classList.remove("focused"), i.target.value || this.labelElement.classList.remove("fade");
|
|
152
|
-
}), this.addEventListener("wje:option-change", this.optionChange), this.clear.addEventListener("wje-button:click", (i) => {
|
|
153
|
-
this.getAllOptions().forEach((s) => {
|
|
154
|
-
s.selected = !1, s.removeAttribute("selected");
|
|
155
|
-
}), this.selections(), i.stopPropagation();
|
|
156
|
-
}), this.selections(), this.optionsWrapper.addEventListener("wje:options-load", (i) => {
|
|
157
|
-
this.optionsWrapper.scrollTo(0, 0);
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Returns all the options.
|
|
162
|
-
*
|
|
163
|
-
* @returns {NodeList} The options.
|
|
164
|
-
*/
|
|
165
|
-
getAllOptions() {
|
|
166
|
-
return this.querySelectorAll("wje-option");
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Returns the selected options.
|
|
170
|
-
*
|
|
171
|
-
* @returns {NodeList} The selected options.
|
|
172
|
-
*/
|
|
173
|
-
getSelectedOptions() {
|
|
174
|
-
return this.querySelectorAll("wje-option[selected]");
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Returns the selected options.
|
|
178
|
-
*
|
|
179
|
-
* @param {Element} option - The option to get.
|
|
180
|
-
* @returns {Array} The selected options.
|
|
181
|
-
*/
|
|
182
|
-
getSelected(e) {
|
|
183
|
-
let t = this.getSelectedOptions();
|
|
184
|
-
return t = Array.isArray(t) ? t : Array.from(t), t = t.map((r) => ({
|
|
185
|
-
value: r.value,
|
|
186
|
-
text: r.textContent.trim()
|
|
187
|
-
})), t;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Handles the selection change.
|
|
191
|
-
*
|
|
192
|
-
* @param {Element} option - The option that changed.
|
|
193
|
-
* @param {number} length - The length of the selected options.
|
|
194
|
-
*/
|
|
195
|
-
selectionChanged(e = null, t = 0) {
|
|
196
|
-
if (this.hasAttribute("multiple"))
|
|
197
|
-
this.value = this.selectedOptions.map((r) => r).reverse(), this.placeholder && t === 0 ? (this.chips.innerHTML = this.placeholder, this.input.value = "") : this.counterEl instanceof HTMLElement || t > +this.maxOptions ? this.counter() : e != null && this.chips.appendChild(this.getChip(e));
|
|
198
|
-
else {
|
|
199
|
-
let r = (e == null ? void 0 : e.textContent.trim()) || "";
|
|
200
|
-
this.value = r, this.input.value = r;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Handles the selections.
|
|
205
|
-
*
|
|
206
|
-
* @param {Element} option - The option to select.
|
|
207
|
-
*/
|
|
208
|
-
selections(e) {
|
|
209
|
-
let t = this.getSelectedOptions();
|
|
210
|
-
this.selectedOptions = Array.isArray(t) ? t : Array.from(t), this.selectedOptions.length >= +this.maxOptions && (this.counterEl = null), this.chips.innerHTML = "", this.selectedOptions.length > 0 ? this.selectedOptions.forEach((r, i) => {
|
|
211
|
-
this.selectionChanged(r, ++i);
|
|
212
|
-
}) : this.selectionChanged();
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Handles the counter.
|
|
216
|
-
*/
|
|
217
|
-
counter() {
|
|
218
|
-
if (this.counterEl && this.value.length === +this.maxOptions) {
|
|
219
|
-
this.counterEl.remove(), this.counterEl = null;
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
this.counterEl || (this.counterEl = document.createElement("span"), this.counterEl.classList.add("counter"), this.chips.appendChild(this.counterEl)), this.counterEl.innerText = `+${this.value.length - +this.maxOptions}`;
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Returns a chip element.
|
|
226
|
-
*
|
|
227
|
-
* @param {Element} option - The option to get the chip for.
|
|
228
|
-
* @returns {Element} The chip element.
|
|
229
|
-
*/
|
|
230
|
-
getChip(e) {
|
|
231
|
-
let t = document.createElement("wje-chip");
|
|
232
|
-
t.setAttribute("removable", ""), t.addEventListener("wje:chip-remove", this.removeChip), t.option = e;
|
|
233
|
-
let r = document.createElement("wje-label");
|
|
234
|
-
return r.innerText = e.textContent.trim(), t.appendChild(r), t;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
v.define("wje-select", v);
|
|
238
|
-
export {
|
|
239
|
-
v as default
|
|
240
|
-
};
|
package/dist/wje-slider.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
var p = Object.defineProperty;
|
|
2
|
-
var j = (t, o, r) => o in t ? p(t, o, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[o] = r;
|
|
3
|
-
var c = (t, o, r) => (j(t, typeof o != "symbol" ? o + "" : o, r), r);
|
|
4
|
-
import g, { event as s } from "./wje-element.js";
|
|
5
|
-
const k = ':host{--wje-slider-track-height: .25rem;position:relative;display:flex;align-items:center;max-width:100%}:host .native-slider{display:flex;position:relative;flex-grow:1;align-items:center;height:inherit}:host .slider{display:flex;align-items:center;position:relative;flex:1 1 0%;width:100%;height:var(--height);contain:size layout style;cursor:grab;touch-action:pan-y}input[type=range]{-webkit-appearance:none;width:100%;height:var(--wje-slider-track-height);margin:0;border-radius:5px;background-size:70% 100%;background-repeat:no-repeat;--wje-slider-color: var(--wje-color-primary);--wje-slider-thumb-color: var(--wje-color-primary);--wje-slider-thumb-shadow: none;--wje-slider-thumb-shadow-active: color-mix(in hsl, var(--wje-color-contrast-2) 60%, white) 0 0 0 7px;--wje-slider-track-color: var(--wje-color-contrast-2);background-color:var(--wje-slider-track-color, var(--wje-color-contrast-2));background-image:linear-gradient(var(--wje-slider-color, var(--wje-color-primary)),var(--wje-slider-color, var(--wje-color-primary)))}input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;height:18px;width:18px;border-radius:50%;cursor:ew-resize;transition:background .3s ease-in-out}input[type=range]::-moz-range-thumb{-webkit-appearance:none;height:18px;width:18px;border-radius:50%;cursor:pointer;transition:background .3s ease-in-out;border:0}input[type=range]::-ms-thumb{-webkit-appearance:none;height:18px;width:18px;border-radius:50%;cursor:ew-resize;transition:background .3s ease-in-out}input[type=range]::-webkit-slider-runnable-track{-webkit-appearance:none;box-shadow:none;border:none;background:transparent}input[type=range]::-moz-range-track{-webkit-appearance:none;box-shadow:none;border:none;background:transparent}input[type=range]::-ms-track{-webkit-appearance:none;box-shadow:none;border:none;background:transparent}input[type=range][color=primary]{--wje-slider-color: var(--wje-color-primary);--wje-slider-thumb-color: var(--wje-color-primary);--wje-slider-thumb-shadow: none;--wje-slider-thumb-shadow-active: color-mix(in hsl, var(--wje-color-contrast-2) 60%, white) 0 0 0 7px;--wje-slider-track-color: var(--wje-color-contrast-2);background-color:var(--wje-slider-track-color, var(--wje-color-contrast-2));background-image:linear-gradient(var(--wje-slider-color, var(--wje-color-primary)),var(--wje-slider-color, var(--wje-color-primary)))}input[type=range][color=primary]::-webkit-slider-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=primary]::-moz-range-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=primary]::-ms-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=primary]::-webkit-slider-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=primary]::-moz-range-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=primary]::-ms-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=primary]::-webkit-slider-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=primary]::-moz-range-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=primary]::-ms-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=success]{--wje-slider-color: var(--wje-color-success);--wje-slider-thumb-color: var(--wje-color-success);--wje-slider-thumb-shadow: none;--wje-slider-thumb-shadow-active: color-mix(in hsl, var(--wje-color-contrast-2) 60%, white) 0 0 0 7px;--wje-slider-track-color: var(--wje-color-contrast-2);background-color:var(--wje-slider-track-color, var(--wje-color-contrast-2));background-image:linear-gradient(var(--wje-slider-color, var(--wje-color-success)),var(--wje-slider-color, var(--wje-color-success)))}input[type=range][color=success]::-webkit-slider-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-success));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=success]::-moz-range-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-success));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=success]::-ms-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-success));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=success]::-webkit-slider-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-success));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=success]::-moz-range-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-success));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=success]::-ms-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-success));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=success]::-webkit-slider-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-success));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=success]::-moz-range-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-success));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=success]::-ms-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-success));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=complete]{--wje-slider-color: var(--wje-color-complete);--wje-slider-thumb-color: var(--wje-color-complete);--wje-slider-thumb-shadow: none;--wje-slider-thumb-shadow-active: color-mix(in hsl, var(--wje-color-contrast-2) 60%, white) 0 0 0 7px;--wje-slider-track-color: var(--wje-color-contrast-2);background-color:var(--wje-slider-track-color, var(--wje-color-contrast-2));background-image:linear-gradient(var(--wje-slider-color, var(--wje-color-complete)),var(--wje-slider-color, var(--wje-color-complete)))}input[type=range][color=complete]::-webkit-slider-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-complete));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=complete]::-moz-range-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-complete));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=complete]::-ms-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-complete));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=complete]::-webkit-slider-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-complete));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=complete]::-moz-range-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-complete));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=complete]::-ms-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-complete));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=complete]::-webkit-slider-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-complete));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=complete]::-moz-range-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-complete));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=complete]::-ms-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-complete));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=danger]{--wje-slider-color: var(--wje-color-danger);--wje-slider-thumb-color: var(--wje-color-danger);--wje-slider-thumb-shadow: none;--wje-slider-thumb-shadow-active: color-mix(in hsl, var(--wje-color-contrast-2) 60%, white) 0 0 0 7px;--wje-slider-track-color: var(--wje-color-contrast-2);background-color:var(--wje-slider-track-color, var(--wje-color-contrast-2));background-image:linear-gradient(var(--wje-slider-color, var(--wje-color-danger)),var(--wje-slider-color, var(--wje-color-danger)))}input[type=range][color=danger]::-webkit-slider-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-danger));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=danger]::-moz-range-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-danger));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=danger]::-ms-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-danger));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=danger]::-webkit-slider-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-danger));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=danger]::-moz-range-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-danger));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=danger]::-ms-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-danger));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=danger]::-webkit-slider-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-danger));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=danger]::-moz-range-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-danger));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=danger]::-ms-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-danger));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=warning]{--wje-slider-color: var(--wje-color-warning);--wje-slider-thumb-color: var(--wje-color-warning);--wje-slider-thumb-shadow: none;--wje-slider-thumb-shadow-active: color-mix(in hsl, var(--wje-color-contrast-2) 60%, white) 0 0 0 7px;--wje-slider-track-color: var(--wje-color-contrast-2);background-color:var(--wje-slider-track-color, var(--wje-color-contrast-2));background-image:linear-gradient(var(--wje-slider-color, var(--wje-color-warning)),var(--wje-slider-color, var(--wje-color-warning)))}input[type=range][color=warning]::-webkit-slider-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-warning));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=warning]::-moz-range-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-warning));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=warning]::-ms-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-warning));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=warning]::-webkit-slider-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-warning));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=warning]::-moz-range-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-warning));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=warning]::-ms-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-warning));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=warning]::-webkit-slider-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-warning));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=warning]::-moz-range-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-warning));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=warning]::-ms-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-warning));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=dark]{--wje-slider-color: var(--wje-color-contrast-10);--wje-slider-thumb-color: var(--wje-color-contrast-10);--wje-slider-thumb-shadow: none;--wje-slider-thumb-shadow-active: color-mix(in hsl, var(--wje-color-contrast-6) 60%, white) 0 0 0 7px;--wje-slider-track-color: var(--wje-color-contrast-6);background-color:var(--wje-slider-track-color, var(--wje-color-contrast-6));background-image:linear-gradient(var(--wje-slider-color, var(--wje-color-contrast-10)),var(--wje-slider-color, var(--wje-color-contrast-10)))}input[type=range][color=dark]::-webkit-slider-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-contrast-10));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=dark]::-moz-range-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-contrast-10));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=dark]::-ms-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-contrast-10));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range][color=dark]::-webkit-slider-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-contrast-10));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=dark]::-moz-range-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-contrast-10));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=dark]::-ms-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-contrast-10));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=dark]::-webkit-slider-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-contrast-10));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=dark]::-moz-range-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-contrast-10));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range][color=dark]::-ms-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-contrast-10));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range]::-webkit-slider-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range]::-moz-range-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range]::-ms-thumb{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow)}input[type=range]::-webkit-slider-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range]::-moz-range-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range]::-ms-thumb:active{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range]::-webkit-slider-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range]::-moz-range-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow-active)}input[type=range]::-ms-thumb:hover{background:var(--wje-slider-thumb-color, var(--wje-color-primary));box-shadow:var(--wje-slider-thumb-shadow-active)}datalist{display:flex;justify-content:space-between;height:auto;overflow:hidden;margin-top:16px}datalist option:before{content:"";display:block;width:0;height:auto;padding-left:3px;text-indent:0}output{position:absolute;background:var(--wje-color-contrast-11);color:var(--wje-color-contrast-0);top:-46px;padding:4px 8px;border-radius:4px}::slotted([slot=label]){margin-inline:0 1rem;font-size:var(--wje-font-size)}::slotted([slot=start]){margin-inline:0 1rem}::slotted([slot=end]){margin-inline:1rem 0}';
|
|
6
|
-
class m extends g {
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of Slider.
|
|
9
|
-
*
|
|
10
|
-
* @constructor
|
|
11
|
-
*/
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
c(this, "className", "Slider");
|
|
15
|
-
/**
|
|
16
|
-
* Sets the handle position of the slider.
|
|
17
|
-
*/
|
|
18
|
-
c(this, "setHandlePosition", () => {
|
|
19
|
-
this.input.style.backgroundSize = this.getPercentage(this.input.value, this.input.min, this.input.max) + "% 100%";
|
|
20
|
-
});
|
|
21
|
-
/**
|
|
22
|
-
* Sets the bubble of the slider.
|
|
23
|
-
*/
|
|
24
|
-
c(this, "setBubble", () => {
|
|
25
|
-
let r = this.getPercentage(this.input.value, this.input.min, this.input.max);
|
|
26
|
-
this.output.style.left = `calc(${r}% + (${8 - r * 0.15}px) - ${this.output.offsetWidth / 2}px)`, this.output.innerHTML = this.input.value;
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Sets the value of the slider.
|
|
31
|
-
*
|
|
32
|
-
* @param {number} value - The value to set.
|
|
33
|
-
*/
|
|
34
|
-
set value(r) {
|
|
35
|
-
this.setAttribute("value", r), this.input && (this.input.value = r, this.setHandlePosition());
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Returns the value of the slider.
|
|
39
|
-
*
|
|
40
|
-
* @returns {number} The value of the slider.
|
|
41
|
-
*/
|
|
42
|
-
get value() {
|
|
43
|
-
return this.getAttribute("value") || 0;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Sets the minimum value of the slider.
|
|
47
|
-
*
|
|
48
|
-
* @param {number} value - The minimum value to set.
|
|
49
|
-
*/
|
|
50
|
-
set min(r) {
|
|
51
|
-
this.setAttribute("min", r);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Returns the minimum value of the slider.
|
|
55
|
-
*
|
|
56
|
-
* @returns {number} The minimum value of the slider.
|
|
57
|
-
*/
|
|
58
|
-
get min() {
|
|
59
|
-
return this.getAttribute("min") || 0;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Sets the maximum value of the slider.
|
|
63
|
-
*
|
|
64
|
-
* @param {number} value - The maximum value to set.
|
|
65
|
-
*/
|
|
66
|
-
set max(r) {
|
|
67
|
-
this.setAttribute("max", r);
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Returns the maximum value of the slider.
|
|
71
|
-
*
|
|
72
|
-
* @returns {number} The maximum value of the slider.
|
|
73
|
-
*/
|
|
74
|
-
get max() {
|
|
75
|
-
return this.getAttribute("max") || 100;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Sets the step value of the slider.
|
|
79
|
-
*
|
|
80
|
-
* @param {number} value - The step value to set.
|
|
81
|
-
*/
|
|
82
|
-
set step(r) {
|
|
83
|
-
this.setAttribute("step", r);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Returns the step value of the slider.
|
|
87
|
-
*
|
|
88
|
-
* @returns {number} The step value of the slider.
|
|
89
|
-
*/
|
|
90
|
-
get step() {
|
|
91
|
-
return this.getAttribute("step") || 1;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Returns the CSS styles for the component.
|
|
95
|
-
*
|
|
96
|
-
* @static
|
|
97
|
-
* @returns {CSSStyleSheet}
|
|
98
|
-
*/
|
|
99
|
-
static get cssStyleSheet() {
|
|
100
|
-
return k;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Returns the list of attributes to observe for changes.
|
|
104
|
-
*
|
|
105
|
-
* @static
|
|
106
|
-
* @returns {Array<string>}
|
|
107
|
-
*/
|
|
108
|
-
static get observedAttributes() {
|
|
109
|
-
return ["max"];
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Sets up the attributes for the component.
|
|
113
|
-
*/
|
|
114
|
-
setupAttributes() {
|
|
115
|
-
this.isShadowRoot = "open";
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Draws the component.
|
|
119
|
-
*
|
|
120
|
-
* @param {Object} context - The context for drawing.
|
|
121
|
-
* @param {Object} store - The store for drawing.
|
|
122
|
-
* @param {Object} params - The parameters for drawing.
|
|
123
|
-
* @returns {DocumentFragment}
|
|
124
|
-
*/
|
|
125
|
-
draw(r, n, d) {
|
|
126
|
-
let u = document.createDocumentFragment(), a = document.createElement("div");
|
|
127
|
-
a.className = "native-slider", a.setAttribute("part", "native");
|
|
128
|
-
let l = document.createElement("div");
|
|
129
|
-
l.className = "slider";
|
|
130
|
-
let w = document.createElement("slot");
|
|
131
|
-
w.name = "label";
|
|
132
|
-
let h = document.createElement("slot");
|
|
133
|
-
h.name = "start";
|
|
134
|
-
let b = document.createElement("slot");
|
|
135
|
-
b.name = "end";
|
|
136
|
-
let i = document.createElement("output");
|
|
137
|
-
i.setAttribute("for", "slider"), i.id = "output", i.setAttribute("hidden", "");
|
|
138
|
-
let e = document.createElement("input");
|
|
139
|
-
return e.type = "range", e.min = this.min, e.max = this.max, e.step = this.step, e.value = this.value, e.id = "slider", e.name = "slider", e.part = "slider", e.setAttribute("autocomplete", "off"), e.setAttribute("color", this.color || ""), e.addEventListener("input", null, (v) => {
|
|
140
|
-
this.setHandlePosition(v.target);
|
|
141
|
-
}), l.appendChild(e), this.hasAttribute("bubble") && l.appendChild(i), a.appendChild(w), a.appendChild(h), a.appendChild(l), a.appendChild(b), u.appendChild(a), this.input = e, this.output = i, u;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Sets up the event listeners after the component is drawn.
|
|
145
|
-
*/
|
|
146
|
-
afterDraw() {
|
|
147
|
-
this.setHandlePosition(), this.hasAttribute("bubble") && (this.output.innerHTML = this.input.value, this.output.removeAttribute("hidden"), setTimeout(this.setBubble, 50)), s.dispatchCustomEvent(this.input, "wje-slider:init", {
|
|
148
|
-
value: this.input.value,
|
|
149
|
-
output: this.output
|
|
150
|
-
}), s.addListener(this.input, "input", null, (r) => {
|
|
151
|
-
this.value = r.target.value, s.dispatchCustomEvent(this.input, "wje-slider:move", {
|
|
152
|
-
value: r.target.value,
|
|
153
|
-
output: this.output
|
|
154
|
-
}), this.hasAttribute("bubble") && this.setBubble();
|
|
155
|
-
}), s.addListener(this.input, "change", null, (r) => {
|
|
156
|
-
s.dispatchCustomEvent(this.input, "wje-slider:change", {
|
|
157
|
-
value: r.target.value,
|
|
158
|
-
output: this.output
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Returns the percentage of the slider value.
|
|
164
|
-
*
|
|
165
|
-
* @param {number} value - The value of the slider.
|
|
166
|
-
* @param {number} min - The minimum value of the slider.
|
|
167
|
-
* @param {number} max - The maximum value of the slider.
|
|
168
|
-
* @returns {number} The percentage of the slider value.
|
|
169
|
-
*/
|
|
170
|
-
getPercentage(r = 0, n, d) {
|
|
171
|
-
return Number((r - n) * 100 / (d - n)) || 0;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
m.define("wje-slider", m);
|
|
175
|
-
export {
|
|
176
|
-
m as default
|
|
177
|
-
};
|
package/dist/wje-split-view.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
var h = Object.defineProperty;
|
|
2
|
-
var p = (s, e, t) => e in s ? h(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
-
var c = (s, e, t) => (p(s, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
-
import m from "./wje-element.js";
|
|
5
|
-
function u(s, e) {
|
|
6
|
-
function t(n) {
|
|
7
|
-
const r = s.getBoundingClientRect(), i = s.ownerDocument.defaultView, d = r.left + i.pageXOffset, v = r.top + i.pageYOffset, w = n.pageX - d, a = n.pageY - v;
|
|
8
|
-
e != null && e.onMove && e.onMove(w, a);
|
|
9
|
-
}
|
|
10
|
-
function l() {
|
|
11
|
-
document.removeEventListener("pointermove", t), document.removeEventListener("pointerup", l), e != null && e.onStop && e.onStop();
|
|
12
|
-
}
|
|
13
|
-
document.addEventListener("pointermove", t, { passive: !0 }), document.addEventListener("pointerup", l), (e == null ? void 0 : e.initialEvent) instanceof PointerEvent && t(e.initialEvent);
|
|
14
|
-
}
|
|
15
|
-
const j = ':host{--wje-split-view-divider-area: 12px;--wje-split-view-divider-width: 4px;--wje-split-view-min: 0%;--wje-split-view-max: 100%;--wje-split-view-calc-a: 50%;--wje-split-view-calc-b: 50%;--wje-split-view-clamp-a: clamp(var(--wje-split-view-min), var(--wje-split-view-calc-a), var(--wje-split-view-max));--wje-split-view-clamp-b: clamp(var(--wje-split-view-min), var(--wje-split-view-calc-b), var(--wje-split-view-max));--wje-split-view-divider-background: var(--wje-border-color);--wje-split-view-divider-size: 4px;height:100%;width:100%}::slotted([slot=start]),::slotted([slot=end]){width:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}:host(:not([vertical])) ::slotted([slot=start]){width:var(--wje-split-view-clamp-a)}:host(:not([vertical])) ::slotted([slot=end]){width:var(--wje-split-view-clamp-b)}:host([vertical]) ::slotted([slot=start]){height:var(--wje-split-view-clamp-a);width:100%}:host([vertical]) ::slotted([slot=end]){height:var(--wje-split-view-clamp-b);width:100%}.native-split-view{height:100%;width:100%;display:flex;flex-direction:row;overflow:hidden;position:relative}:host([vertical]) .native-split-view{flex-direction:column}.wje-divider{display:flex;position:relative;align-items:center;justify-content:center;z-index:1;background-color:var(--wje-split-view-divider-background);height:100%;width:var(--wje-split-view-divider-size);cursor:col-resize}.wje-divider:after{display:flex;content:"";position:absolute;height:100%;left:calc(var(--wje-split-view-divider-area) / -2 + var(--wje-split-view-divider-width) / 2);width:var(--wje-split-view-divider-area)}:host([vertical]) .wje-divider{height:var(--wje-split-view-divider-size);width:100%;cursor:row-resize}:host([vertical]) .wje-divider:after{width:100%;top:calc(var(--wje-split-view-divider-area) / -2 + var(--wje-split-view-divider-width) / 2);height:var(--wje-split-view-divider-area)}';
|
|
16
|
-
class o extends m {
|
|
17
|
-
/**
|
|
18
|
-
* Creates an instance of SplitView.
|
|
19
|
-
*
|
|
20
|
-
* @constructor
|
|
21
|
-
*/
|
|
22
|
-
constructor() {
|
|
23
|
-
super();
|
|
24
|
-
c(this, "className", "SplitView");
|
|
25
|
-
/**
|
|
26
|
-
* Handles the drag event.
|
|
27
|
-
*
|
|
28
|
-
* @param {Event} e - The event object.
|
|
29
|
-
*/
|
|
30
|
-
c(this, "handleDrag", (t) => {
|
|
31
|
-
if (this.hasAttribute("disabled"))
|
|
32
|
-
return !1;
|
|
33
|
-
u(this, {
|
|
34
|
-
onMove: (l, n) => {
|
|
35
|
-
let r = this.hasAttribute("vertical") ? n : l, i = this.pixelsToPercentage(r), d = 100 - this.pixelsToPercentage(r);
|
|
36
|
-
this.style.setProperty("--wje-split-view-calc-a", i + "%"), this.style.setProperty("--wje-split-view-calc-b", d + "%");
|
|
37
|
-
},
|
|
38
|
-
initialEvent: t
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Returns the CSS styles for the component.
|
|
44
|
-
*
|
|
45
|
-
* @static
|
|
46
|
-
* @returns {CSSStyleSheet}
|
|
47
|
-
*/
|
|
48
|
-
static get cssStyleSheet() {
|
|
49
|
-
return j;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Returns the list of attributes to observe for changes.
|
|
53
|
-
*
|
|
54
|
-
* @static
|
|
55
|
-
* @returns {Array<string>}
|
|
56
|
-
*/
|
|
57
|
-
static get observedAttributes() {
|
|
58
|
-
return [];
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Sets up the attributes for the component.
|
|
62
|
-
*/
|
|
63
|
-
setupAttributes() {
|
|
64
|
-
this.isShadowRoot = "open";
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Draws the component.
|
|
68
|
-
*
|
|
69
|
-
* @param {Object} context - The context for drawing.
|
|
70
|
-
* @param {Object} store - The store for drawing.
|
|
71
|
-
* @param {Object} params - The parameters for drawing.
|
|
72
|
-
* @returns {DocumentFragment}
|
|
73
|
-
*/
|
|
74
|
-
draw(t, l, n) {
|
|
75
|
-
let r = document.createDocumentFragment(), i = document.createElement("div");
|
|
76
|
-
i.classList.add("native-split-view");
|
|
77
|
-
let d = document.createElement("slot");
|
|
78
|
-
d.setAttribute("name", "start");
|
|
79
|
-
let v = document.createElement("slot");
|
|
80
|
-
v.setAttribute("name", "end");
|
|
81
|
-
let w = document.createElement("slot");
|
|
82
|
-
w.setAttribute("name", "divider");
|
|
83
|
-
let a = document.createElement("div");
|
|
84
|
-
return a.classList.add("wje-divider"), a.setAttribute("part", "divider"), a.appendChild(w), a.addEventListener("mousedown", this.handleDrag, !1), i.appendChild(d), i.appendChild(a), i.appendChild(v), r.appendChild(i), r;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Sets up the event listeners after the component is drawn.
|
|
88
|
-
*/
|
|
89
|
-
afterDraw() {
|
|
90
|
-
this.detectSize(), this.min && this.style.setProperty("--wje-split-view-min", this.pixelsToPercentage(this.min) + "%"), this.max && this.style.setProperty("--wje-split-view-max", 100 - this.pixelsToPercentage(this.max) + "%"), this.initial && (this.style.setProperty("--wje-split-view-calc-a", this.pixelsToPercentage(this.initial) + "%"), this.style.setProperty("--wje-split-view-calc-b", 100 - this.pixelsToPercentage(this.initial) + "%")), this.resizeObserver = new ResizeObserver((t) => this.handleResize(t));
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Detects the size of the split view.
|
|
94
|
-
*/
|
|
95
|
-
detectSize() {
|
|
96
|
-
const { width: t, height: l } = this.getBoundingClientRect();
|
|
97
|
-
this.size = this.hasAttribute("vertical") ? l : t;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Converts pixels to a percentage.
|
|
101
|
-
*
|
|
102
|
-
* @param {number} value - The pixel value.
|
|
103
|
-
* @returns {number} The percentage value.
|
|
104
|
-
*/
|
|
105
|
-
pixelsToPercentage(t) {
|
|
106
|
-
return t / this.size * 100;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
o.define("wje-split-view", o);
|
|
110
|
-
export {
|
|
111
|
-
o as default
|
|
112
|
-
};
|