wj-elements 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dark.css +1 -0
- package/dist/light.css +1 -0
- package/dist/localize-DVuO3S17.js +43 -0
- package/dist/popup.element-Dj9j__Dh.js +1068 -0
- package/dist/router-links-FtZbFUto.js +146 -0
- package/dist/styles.css +1 -0
- package/dist/wje-accordion-item.js +88 -0
- package/dist/wje-accordion.js +79 -0
- package/dist/wje-animation.js +121 -0
- package/dist/wje-aside.js +55 -0
- package/dist/wje-avatar.js +74 -0
- package/dist/wje-badge.js +48 -0
- package/dist/wje-breadcrumb.js +148 -0
- package/dist/wje-breadcrumbs.js +67 -0
- package/dist/wje-button-group.js +78 -0
- package/dist/wje-button.js +177 -0
- package/dist/wje-card-content.js +48 -0
- package/dist/wje-card-controls.js +48 -0
- package/dist/wje-card-header.js +47 -0
- package/dist/wje-card-subtitle.js +55 -0
- package/dist/wje-card-title.js +55 -0
- package/dist/wje-card.js +48 -0
- package/dist/wje-carousel-item.js +33 -0
- package/dist/wje-carousel.js +177 -0
- package/dist/wje-checkbox.js +104 -0
- package/dist/wje-chip.js +32 -0
- package/dist/wje-col.js +27 -0
- package/dist/wje-color-picker.js +953 -0
- package/dist/wje-container.js +57 -0
- package/dist/wje-copy-button.js +164 -0
- package/dist/wje-dialog.js +86 -0
- package/dist/wje-divider.js +53 -0
- package/dist/wje-dropdown.js +68 -0
- package/dist/wje-element.js +453 -0
- package/dist/wje-fetchAndParseCSS.js +40 -0
- package/dist/wje-file-upload-item.js +115 -0
- package/dist/wje-file-upload.js +297 -0
- package/dist/wje-footer.js +56 -0
- package/dist/wje-form.js +28 -0
- package/dist/wje-format-digital.js +85 -0
- package/dist/wje-grid.js +28 -0
- package/dist/wje-header.js +58 -0
- package/dist/wje-icon-picker.js +221 -0
- package/dist/wje-icon.js +117 -0
- package/dist/wje-img-comparer.js +111 -0
- package/dist/wje-img.js +58 -0
- package/dist/wje-infinite-scroll.js +193 -0
- package/dist/wje-inline-edit.js +120 -0
- package/dist/wje-input-file.js +85 -0
- package/dist/wje-input.js +240 -0
- package/dist/wje-item.js +45 -0
- package/dist/wje-label.js +67 -0
- package/dist/wje-list.js +53 -0
- package/dist/wje-main.js +56 -0
- package/dist/wje-masonry.js +218 -0
- package/dist/wje-master.js +342 -0
- package/dist/wje-menu-button.js +65 -0
- package/dist/wje-menu-item.js +192 -0
- package/dist/wje-menu-label.js +57 -0
- package/dist/wje-menu.js +74 -0
- package/dist/wje-option.js +99 -0
- package/dist/wje-options.js +63 -0
- package/dist/wje-popup.js +5 -0
- package/dist/wje-progress-bar.js +145 -0
- package/dist/wje-radio-group.js +101 -0
- package/dist/wje-radio.js +46 -0
- package/dist/wje-rate.js +260 -0
- package/dist/wje-relative-time.js +85 -0
- package/dist/wje-route.js +28 -0
- package/dist/wje-router-link.js +64 -0
- package/dist/wje-router-outlet.js +127 -0
- package/dist/wje-routerx.js +1088 -0
- package/dist/wje-row.js +58 -0
- package/dist/wje-select.js +240 -0
- package/dist/wje-slider.js +177 -0
- package/dist/wje-split-view.js +112 -0
- package/dist/wje-store.js +192 -0
- package/dist/wje-tab-group.js +105 -0
- package/dist/wje-tab-panel.js +52 -0
- package/dist/wje-tab.js +59 -0
- package/dist/wje-textarea.js +116 -0
- package/dist/wje-thumbnail.js +64 -0
- package/dist/wje-toast.js +76 -0
- package/dist/wje-toggle.js +94 -0
- package/dist/wje-toolbar-action.js +63 -0
- package/dist/wje-toolbar.js +61 -0
- package/dist/wje-tooltip.js +105 -0
- package/dist/wje-visually-hidden.js +56 -0
- package/package.json +1 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var a = Object.defineProperty;
|
|
2
|
+
var h = (t, e, i) => e in t ? a(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
3
|
+
var s = (t, e, i) => (h(t, typeof e != "symbol" ? e + "" : e, i), i);
|
|
4
|
+
import l from "./wje-element.js";
|
|
5
|
+
const n = ':host{--wje-aside-width: "100px";--wje-aside-top: 0;--wje-aside-border-color: var(--wje-border-color);--wje-aside-border-width: 0 1px 0 0;--wje-aside-border-style: solid;box-sizing:border-box;flex-shrink:0;overflow:auto;border-color:var(--wje-aside-border-color);border-width:var(--wje-aside-border-width);border-style:var(--wje-aside-border-style)}:host(.open){display:block!important}@media (min-width: 768px){:host([fixed]){position:fixed;width:var(--wje-aside-width);top:var(--wje-aside-top);height:calc(100% - var(--wje-aside-top))}}@media (max-width: 768px){:host{display:none}:host([variant=top-start]){position:fixed;top:0;left:0;width:80%;height:100%;z-index:9999;background-color:#fff}}';
|
|
6
|
+
class r extends l {
|
|
7
|
+
/**
|
|
8
|
+
* Constructor for the Aside class.
|
|
9
|
+
*/
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
/**
|
|
13
|
+
* The class name for the Aside element ddddd.
|
|
14
|
+
* @type {string}
|
|
15
|
+
*/
|
|
16
|
+
s(this, "className", "Aside");
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Getter for the CSS stylesheet.
|
|
20
|
+
* @return {Object} The styles for the Aside element.
|
|
21
|
+
*/
|
|
22
|
+
static get cssStyleSheet() {
|
|
23
|
+
return n;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Getter for the observed attributes.
|
|
27
|
+
* @return {Array} An empty array as there are no observed attributes.
|
|
28
|
+
*/
|
|
29
|
+
static get observedAttributes() {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Method to setup attributes for the Aside element.
|
|
34
|
+
*/
|
|
35
|
+
setupAttributes() {
|
|
36
|
+
this.isShadowRoot = "open";
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Method to draw the Aside element.
|
|
40
|
+
* @param {Object} context - The context in which the element is drawn.
|
|
41
|
+
* @param {Object} store - The store containing the state of the element.
|
|
42
|
+
* @param {Object} params - The parameters for drawing the element.
|
|
43
|
+
* @return {Object} The document fragment containing the drawn element.
|
|
44
|
+
*/
|
|
45
|
+
draw(i, w, p) {
|
|
46
|
+
let o = document.createDocumentFragment();
|
|
47
|
+
this.width && this.style.setProperty("--wje-aside-width", this.width), this.top && this.hasAttribute("fixed") && this.style.setProperty("--wje-aside-top", this.top);
|
|
48
|
+
let d = document.createElement("slot");
|
|
49
|
+
return o.appendChild(d), o;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
r.define("wje-aside", r);
|
|
53
|
+
export {
|
|
54
|
+
r as default
|
|
55
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var w = (a, e, t) => e in a ? u(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
|
+
var c = (a, e, t) => (w(a, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import p from "./wje-element.js";
|
|
5
|
+
function m(a, e = 30, t = 80) {
|
|
6
|
+
let s = a, i = 0;
|
|
7
|
+
for (let o = 0; o < (s == null ? void 0 : s.length); o++)
|
|
8
|
+
i = s.charCodeAt(o) + ((i << 5) - i);
|
|
9
|
+
return "hsl(" + i % 360 + ", " + e + "%, " + t + "%)";
|
|
10
|
+
}
|
|
11
|
+
function g(a, e = 2) {
|
|
12
|
+
let t = a.split(" "), s = t[0].substring(0, 1).toUpperCase();
|
|
13
|
+
return t.length > 1 && e > 1 && (s += t[t.length - 1].substring(0, 1).toUpperCase()), s;
|
|
14
|
+
}
|
|
15
|
+
const b = ":host{display:inline-block;width:var(--wje-avatar-width);height:var(--wje-avatar-height);font-size:var(--wje-avatar-font-size);font-weight:var(--wje-avatar-font-weight);color:var(--wje-avatar-color)}:host .native-avatar{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:100%;border-radius:var(--wje-avatar-border-radius);background-color:var(--wje-avatar-background-color)}::slotted([slot=status]){display:flex;position:absolute;bottom:-4px;right:-4px}::slotted(wje-img),::slotted(img){border-radius:var(--wje-avatar-border-radius);width:100%;height:100%;object-fit:cover;overflow:hidden}:host(.wje-avatar-border){border-color:var(--wje-avatar-border-color);border-width:var(--wje-avatar-border-width);border-style:var(--wje-avatar-border-style)}:host(.wje-avatar-small){--wje-avatar-width: 24px;--wje-avatar-height: 24px}:host(.wje-avatar-large){--wje-avatar-width: 48px;--wje-avatar-height: 48px}";
|
|
16
|
+
class v extends p {
|
|
17
|
+
/**
|
|
18
|
+
* Avatar class constructor
|
|
19
|
+
*/
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
/**
|
|
23
|
+
* Class name
|
|
24
|
+
*/
|
|
25
|
+
c(this, "className", "Avatar");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Getter for cssStyleSheet
|
|
29
|
+
* @returns {string} styles
|
|
30
|
+
*/
|
|
31
|
+
static get cssStyleSheet() {
|
|
32
|
+
return b;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Method to setup attributes
|
|
36
|
+
*/
|
|
37
|
+
setupAttributes() {
|
|
38
|
+
this.isShadowRoot = "open";
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Method to draw the avatar
|
|
42
|
+
* @param {object} context - The context
|
|
43
|
+
* @param {object} store - The store
|
|
44
|
+
* @param {object} params - The parameters
|
|
45
|
+
* @returns {object} fragment - The document fragment
|
|
46
|
+
*/
|
|
47
|
+
draw(t, s, i) {
|
|
48
|
+
let n = document.createDocumentFragment(), r = document.createElement("div");
|
|
49
|
+
r.setAttribute("part", "native"), r.classList.add("native-avatar"), this.size && this.classList.add("wje-avatar-" + this.size);
|
|
50
|
+
let o = document.createElement("slot");
|
|
51
|
+
if (r.appendChild(o), this.hasAttribute("initials")) {
|
|
52
|
+
let l = g(this.label);
|
|
53
|
+
this.setAttribute("style", `--wje-avatar-background-color: ${m(l)}`), r.innerText = l;
|
|
54
|
+
} else {
|
|
55
|
+
let l = document.createElement("slot");
|
|
56
|
+
l.setAttribute("name", "icon"), r.appendChild(l);
|
|
57
|
+
}
|
|
58
|
+
let d = document.createElement("slot");
|
|
59
|
+
d.setAttribute("name", "status"), d.setAttribute("part", "status");
|
|
60
|
+
let h = document.createElement("slot");
|
|
61
|
+
return h.setAttribute("name", "secondary"), h.setAttribute("part", "secondary"), r.appendChild(d), r.appendChild(h), n.appendChild(r), n;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Method to check if the avatar is an image
|
|
65
|
+
* @returns {boolean} - True if the avatar is an image, false otherwise
|
|
66
|
+
*/
|
|
67
|
+
isImage() {
|
|
68
|
+
return this.getElementsByTagName("wje-img").length > 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
v.define("wje-avatar", v);
|
|
72
|
+
export {
|
|
73
|
+
v as default
|
|
74
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var l = Object.defineProperty;
|
|
2
|
+
var n = (e, o, r) => o in e ? l(e, o, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[o] = r;
|
|
3
|
+
var a = (e, o, r) => (n(e, typeof o != "symbol" ? o + "" : o, r), r);
|
|
4
|
+
import w from "./wje-element.js";
|
|
5
|
+
const j = ":host(.wje-color-primary){--wje-color-base: var(--wje-color-primary);--wje-color-contrast: var(--wje-color-contrast-lowest)}:host(.wje-color-complete){--wje-color-base: var(--wje-color-complete);--wje-color-contrast: var(--wje-color-contrast-lowest)}:host(.wje-color-success){--wje-color-base: var(--wje-color-success);--wje-color-contrast: var(--wje-color-contrast-lowest)}:host(.wje-color-warning){--wje-color-base: var(--wje-color-warning);--wje-color-contrast: var(--wje-color-contrast-high)}:host(.wje-color-danger){--wje-color-base: var(--wje-color-danger);--wje-color-contrast: var(--wje-color-contrast-lowest)}:host(.wje-color-info){--wje-color-base: var(--wje-color-info);--wje-color-contrast: var(--wje-color-contrast-lowest)}:host(.wje-color-contrast){--wje-color-base: var(--wje-color-contrast-lower);--wje-color-contrast: var(--wje-color-contrast-high)}:host{display:inline-block;text-shadow:none;font-family:var(--wje-font-family);font-weight:600;background-color:var(--wje-color-contrast-low);font-size:11px;line-height:1;padding-top:var(--wje-badge-padding-top);padding-bottom:var(--wje-badge-padding-bottom);padding-inline:var(--wje-badge-padding-inline);color:var(--wje-color-contrast-high);border-radius:var(--wje-badge-border-radius)}:host(.wje-color){background-color:var(--wje-color-base);color:var(--wje-color-contrast)}";
|
|
6
|
+
class c extends w {
|
|
7
|
+
/**
|
|
8
|
+
* Badge constructor
|
|
9
|
+
* @constructor
|
|
10
|
+
*/
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
/**
|
|
14
|
+
* Class name
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
a(this, "className", "Badge");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get CSS stylesheet
|
|
21
|
+
* @static
|
|
22
|
+
* @returns {Object} styles - The CSS styles
|
|
23
|
+
*/
|
|
24
|
+
static get cssStyleSheet() {
|
|
25
|
+
return j;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Setup attributes
|
|
29
|
+
*/
|
|
30
|
+
setupAttributes() {
|
|
31
|
+
this.isShadowRoot = "open";
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Draw method
|
|
35
|
+
* @param {Object} context - The context
|
|
36
|
+
* @param {Object} store - The store
|
|
37
|
+
* @param {Object} params - The parameters
|
|
38
|
+
* @returns {Object} fragment - The document fragment
|
|
39
|
+
*/
|
|
40
|
+
draw(r, i, d) {
|
|
41
|
+
let t = document.createDocumentFragment(), s = document.createElement("slot");
|
|
42
|
+
return this.color && this.classList.add("wje-color-" + this.color, "wje-color"), t.appendChild(s), t;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
c.define("wje-badge", c);
|
|
46
|
+
export {
|
|
47
|
+
c as default
|
|
48
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
var b = Object.defineProperty;
|
|
2
|
+
var w = (s, r, e) => r in s ? b(s, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[r] = e;
|
|
3
|
+
var m = (s, r, e) => (w(s, typeof r != "symbol" ? r + "" : r, e), e);
|
|
4
|
+
import j, { WjElementUtils as l, event as f } from "./wje-element.js";
|
|
5
|
+
const g = ':host{--wje-breadcrumb-a: var(--wje-color-contrast-high);--wje-breadcrumb-a-hover: var(--wje-color-contrast-medium);display:flex;flex:0 0 auto;align-items:center;line-height:1.5}:host(.collapsed){display:none}.native-breadcrumb{display:flex;align-items:center;width:100%;outline:none;background:inherit;padding:.25rem .75rem;color:var(--wje-breadcrumb-a);text-decoration:none}.native-breadcrumb.hidden{display:none}.native-breadcrumb.active{font-weight:700}.native-breadcrumb:hover{color:var(--wje-breadcrumb-a-hover)}button{margin-inline:.75rem;border:0 solid transparent;border-radius:3px;background-color:transparent;display:flex;align-items:center;justify-content:center;cursor:pointer}.separator{display:inline-flex;align-items:center}::slotted([slot="start"]){margin-inline:0 .5rem}::slotted([slot="end"]){margin-inline:.5rem 0}';
|
|
6
|
+
class u extends j {
|
|
7
|
+
/**
|
|
8
|
+
* Breadcrumb constructor
|
|
9
|
+
*/
|
|
10
|
+
constructor() {
|
|
11
|
+
var e;
|
|
12
|
+
super();
|
|
13
|
+
/**
|
|
14
|
+
* Class name
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
m(this, "className", "Breadcrumb");
|
|
18
|
+
this._showSeparator = !0, this._collapsedVariant = ((e = this.parentElement) == null ? void 0 : e.collapsedVariant) || "BUTTON";
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get show separator flag
|
|
22
|
+
* @returns {boolean} showSeparator - The show separator flag
|
|
23
|
+
*/
|
|
24
|
+
get showSeparator() {
|
|
25
|
+
return this._showSeparator;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Set show separator flag
|
|
29
|
+
* @param {boolean} value - The value to set
|
|
30
|
+
*/
|
|
31
|
+
set showSeparator(e) {
|
|
32
|
+
this._showSeparator = e;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get collapsed variant
|
|
36
|
+
* @returns {string} collapsedVariant - The collapsed variant
|
|
37
|
+
*/
|
|
38
|
+
get collapsedVariant() {
|
|
39
|
+
return this._collapsedVariant.toUpperCase();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Set collapsed variant
|
|
43
|
+
* @param {string} value - The value to set
|
|
44
|
+
*/
|
|
45
|
+
set collapsedVariant(e) {
|
|
46
|
+
this._collapsedVariant = e || this.parentElement.collapsedVariant;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get CSS stylesheet
|
|
50
|
+
* @static
|
|
51
|
+
* @returns {Object} styles - The CSS styles
|
|
52
|
+
*/
|
|
53
|
+
static get cssStyleSheet() {
|
|
54
|
+
return g;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get observed attributes
|
|
58
|
+
* @static
|
|
59
|
+
* @returns {Array<string>} observedAttributes - The observed attributes
|
|
60
|
+
*/
|
|
61
|
+
static get observedAttributes() {
|
|
62
|
+
return ["show-collapsed-indicator", "collapsed", "last"];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Attribute changed callback
|
|
66
|
+
* @param {string} name - The attribute name
|
|
67
|
+
* @param {string} oldValue - The old value
|
|
68
|
+
* @param {string} newValue - The new value
|
|
69
|
+
* @returns {boolean} false - Always returns false
|
|
70
|
+
*/
|
|
71
|
+
attributeChangedCallback(e, n, t) {
|
|
72
|
+
return e === "collapsed" ? l.stringToBoolean(t) && this.classList.add("collapsed") : e === "show-collapsed-indicator" ? l.stringToBoolean(t) && (this.showCollapsedIndicator = !0, this.refresh()) : e === "last" && (this.active = l.stringToBoolean(t), this.showSeparator = !l.stringToBoolean(t), this.refresh()), !1;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Setup attributes
|
|
76
|
+
*/
|
|
77
|
+
setupAttributes() {
|
|
78
|
+
this.isShadowRoot = "open";
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Draw method
|
|
82
|
+
* @param {Object} context - The context
|
|
83
|
+
* @param {Object} store - The store
|
|
84
|
+
* @param {Object} params - The parameters
|
|
85
|
+
* @returns {Object} fragment - The document fragment
|
|
86
|
+
*/
|
|
87
|
+
draw(e, n, t) {
|
|
88
|
+
let o = document.createDocumentFragment(), a = document.createElement("a");
|
|
89
|
+
a.classList.add("native-breadcrumb"), a.setAttribute("part", "native"), this.active && a.classList.add("active");
|
|
90
|
+
let h = document.createElement("slot"), d = document.createElement("slot");
|
|
91
|
+
d.setAttribute("name", "start");
|
|
92
|
+
let c = document.createElement("slot");
|
|
93
|
+
if (c.setAttribute("name", "end"), a.appendChild(d), a.appendChild(h), a.appendChild(c), o.appendChild(a), this.showCollapsedIndicator && (o.appendChild(this.drawCollapsedIndicator()), this.classList.remove("collapsed"), a.classList.add("hidden")), this.showSeparator) {
|
|
94
|
+
let i = document.createElement("span");
|
|
95
|
+
if (i.classList.add("separator"), i.setAttribute("part", "separator"), l.hasSlot(this, "separator")) {
|
|
96
|
+
let p = document.createElement("slot");
|
|
97
|
+
p.setAttribute("name", "separator"), i.appendChild(p);
|
|
98
|
+
} else
|
|
99
|
+
i.innerHTML = `<wje-icon name=${this.separator || "chevron-right"}></wje-icon>`;
|
|
100
|
+
o.appendChild(i);
|
|
101
|
+
}
|
|
102
|
+
return this.native = a, o;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Draw collapsed indicator
|
|
106
|
+
* @returns {Object} collapsedIndicator - The collapsed indicator
|
|
107
|
+
*/
|
|
108
|
+
drawCollapsedIndicator() {
|
|
109
|
+
let e = null;
|
|
110
|
+
return this.collapsedVariant === "DROPDOWN" ? e = this.collapseDropdown() : e = this.collapseButton(), e;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Collapse dropdown
|
|
114
|
+
* @returns {Object} dropdown - The dropdown
|
|
115
|
+
*/
|
|
116
|
+
collapseDropdown() {
|
|
117
|
+
let e = document.createElement("wje-dropdown");
|
|
118
|
+
e.setAttribute("placement", "bottom"), e.setAttribute("offset", "10");
|
|
119
|
+
let n = document.createElement("wje-button");
|
|
120
|
+
n.setAttribute("slot", "trigger"), n.setAttribute("fill", "link"), n.innerHTML = '<wje-icon name="dots"></wje-icon>';
|
|
121
|
+
let t = document.createElement("wje-menu");
|
|
122
|
+
return t.setAttribute("variant", "context"), e.appendChild(n), e.appendChild(t), e.innerHTML = `<wje-button slot="trigger" fill="link">
|
|
123
|
+
<wje-icon name="dots"></wje-icon>
|
|
124
|
+
</wje-button>
|
|
125
|
+
<wje-menu variant="context">
|
|
126
|
+
<wje-menu-item>Test 0</wje-menu-item>
|
|
127
|
+
<wje-menu-item>Test 1</wje-menu-item>
|
|
128
|
+
<wje-menu-item>Test 2</wje-menu-item>
|
|
129
|
+
</wje-menu>`, this.parentElement.querySelectorAll("wje-breadcrumb").forEach((o) => {
|
|
130
|
+
}), e;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Collapse button
|
|
134
|
+
* @returns {Object} button - The button
|
|
135
|
+
*/
|
|
136
|
+
collapseButton() {
|
|
137
|
+
let e = document.createElement("button");
|
|
138
|
+
return e.setAttribute("aria-label", "Show more breadcrumbs"), e.setAttribute("part", "collapsed-indicator"), e.innerHTML = '<wje-icon name="dots"></wje-icon>', f.addListener(e, "click", null, (n) => {
|
|
139
|
+
this.native.classList.remove("hidden"), e.remove(), this.parentElement.querySelectorAll("wje-breadcrumb").forEach((t) => {
|
|
140
|
+
t.classList.remove("collapsed");
|
|
141
|
+
}), n.stopPropagation();
|
|
142
|
+
}), e;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
u.define("wje-breadcrumb", u);
|
|
146
|
+
export {
|
|
147
|
+
u as default
|
|
148
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var n = Object.defineProperty;
|
|
2
|
+
var d = (r, t, e) => t in r ? n(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var i = (r, t, e) => (d(r, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
+
import f from "./wje-element.js";
|
|
5
|
+
const p = ":host{display:flex;flex-wrap:wrap;align-items:center}";
|
|
6
|
+
class c extends f {
|
|
7
|
+
/**
|
|
8
|
+
* Breadcrumbs constructor
|
|
9
|
+
* @constructor
|
|
10
|
+
*/
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
/**
|
|
14
|
+
* Class name
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
i(this, "className", "Breadcrumbs");
|
|
18
|
+
this.last = !1;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get CSS stylesheet
|
|
22
|
+
* @static
|
|
23
|
+
* @returns {Object} styles - The CSS styles
|
|
24
|
+
*/
|
|
25
|
+
static get cssStyleSheet() {
|
|
26
|
+
return p;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Setup attributes
|
|
30
|
+
*/
|
|
31
|
+
setupAttributes() {
|
|
32
|
+
this.isShadowRoot = "open";
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Draw method
|
|
36
|
+
* @param {Object} context - The context
|
|
37
|
+
* @param {Object} store - The store
|
|
38
|
+
* @param {Object} params - The parameters
|
|
39
|
+
* @returns {Object} fragment - The document fragment
|
|
40
|
+
*/
|
|
41
|
+
draw(e, l, o) {
|
|
42
|
+
let s = document.createDocumentFragment(), u = document.createElement("slot");
|
|
43
|
+
return s.appendChild(u), s;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* After draw method
|
|
47
|
+
*/
|
|
48
|
+
afterDraw() {
|
|
49
|
+
let e = +this.maxItems || 0, l = +this.itemsBeforeCollapse || 1, o = +this.itemsAfterCollapse || 1, s = this.getBreadcrumbs();
|
|
50
|
+
if (s.length === 0)
|
|
51
|
+
return;
|
|
52
|
+
s.findLast((a) => a).setAttribute("last", !0), e !== void 0 && s.length > e && l + o <= e && s.forEach((a, m) => {
|
|
53
|
+
m === l && a.setAttribute("show-collapsed-indicator", !0), m >= l && m < s.length - o && a.setAttribute("collapsed", !0);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get breadcrumbs
|
|
58
|
+
* @returns {Array} breadcrumbs - The breadcrumbs
|
|
59
|
+
*/
|
|
60
|
+
getBreadcrumbs() {
|
|
61
|
+
return Array.from(this.querySelectorAll("wje-breadcrumb")) || [];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
c.define("wje-breadcrumbs", c);
|
|
65
|
+
export {
|
|
66
|
+
c as default
|
|
67
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var p = (o, e, t) => e in o ? d(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var i = (o, e, t) => (p(o, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import u from "./wje-element.js";
|
|
5
|
+
const g = ":host{display:inline-block}:host .native-button-group{display:flex;flex-wrap:nowrap;line-height:1}:host slot{display:contents}::slotted(wje-button){margin:0!important}";
|
|
6
|
+
class m extends u {
|
|
7
|
+
/**
|
|
8
|
+
* ButtonGroup constructor
|
|
9
|
+
* @constructor
|
|
10
|
+
*/
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
/**
|
|
14
|
+
* Class name
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
i(this, "className", "ButtonGroup");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get CSS stylesheet
|
|
21
|
+
* @static
|
|
22
|
+
* @returns {Object} styles - The CSS styles
|
|
23
|
+
*/
|
|
24
|
+
static get cssStyleSheet() {
|
|
25
|
+
return g;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get observed attributes
|
|
29
|
+
* @static
|
|
30
|
+
* @returns {Array<string>} observedAttributes - The observed attributes
|
|
31
|
+
*/
|
|
32
|
+
static get observedAttributes() {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Setup attributes
|
|
37
|
+
*/
|
|
38
|
+
setupAttributes() {
|
|
39
|
+
this.isShadowRoot = "open";
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Draw method
|
|
43
|
+
* @param {Object} context - The context
|
|
44
|
+
* @param {Object} store - The store
|
|
45
|
+
* @param {Object} params - The parameters
|
|
46
|
+
* @returns {Object} fragment - The document fragment
|
|
47
|
+
*/
|
|
48
|
+
draw(t, l, c) {
|
|
49
|
+
let s = document.createDocumentFragment(), n = document.createElement("div");
|
|
50
|
+
return n.classList.add("native-button-group"), n.setAttribute("part", "native"), this.slotElement = document.createElement("slot"), n.appendChild(this.slotElement), s.appendChild(n), s;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* After draw method
|
|
54
|
+
* @param {Object} context - The context
|
|
55
|
+
* @param {Object} store - The store
|
|
56
|
+
* @param {Object} params - The parameters
|
|
57
|
+
*/
|
|
58
|
+
afterDraw(t, l, c) {
|
|
59
|
+
const s = [...this.slotElement.assignedElements({ flatten: !0 })];
|
|
60
|
+
s.forEach((n) => {
|
|
61
|
+
let a = s.indexOf(n), r = this.findButton(n);
|
|
62
|
+
r && (r.classList.add("wje-button-group-button"), r.classList.toggle("wje-button-group-first", a === 0), r.classList.toggle("wje-button-group-inner", a > 0 && a < s.length - 1), r.classList.toggle("wje-button-group-last", a === s.length - 1));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Find button method
|
|
67
|
+
* @param {Object} el - The element
|
|
68
|
+
* @returns {Object} button - The button
|
|
69
|
+
*/
|
|
70
|
+
findButton(t) {
|
|
71
|
+
const l = "wje-button";
|
|
72
|
+
return t.closest(l) ?? t.querySelector(l);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
u.define("wje-button-group", m);
|
|
76
|
+
export {
|
|
77
|
+
m as default
|
|
78
|
+
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
var b = Object.defineProperty;
|
|
2
|
+
var j = (t, r, o) => r in t ? b(t, r, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[r] = o;
|
|
3
|
+
var s = (t, r, o) => (j(t, typeof r != "symbol" ? r + "" : r, o), o);
|
|
4
|
+
import h, { WjElementUtils as g, event as i } from "./wje-element.js";
|
|
5
|
+
import v from "./wje-icon.js";
|
|
6
|
+
const w = (t) => t === "false" || t === "null" || t === "NaN" || t === "undefined" || t === "0" ? !1 : !!t, p = ':host(.wje-button-solid.wje-color-primary){--wje-button-background-color: var(--wje-color-primary-10);--wje-button-border-color: var(--wje-color-primary-11);--wje-button-color: var(--wje-color-contrast-0)}:host(.wje-button-outline.wje-color-primary){--wje-button-border-color: var(--wje-color-primary-6);--wje-button-color: var(--wje-color-primary-6)}:host(.wje-button-solid.wje-color-complete){--wje-button-background-color: var(--wje-color-complete-10);--wje-button-border-color: var(--wje-color-complete-11);--wje-button-color: var(--wje-color-contrast-0)}:host(.wje-button-outline.wje-color-complete){--wje-button-border-color: var(--wje-color-complete-6);--wje-button-color: var(--wje-color-complete-6)}:host(.wje-button-solid.wje-color-success){--wje-button-background-color: var(--wje-color-success-10);--wje-button-border-color: var(--wje-color-success-11);--wje-button-color: var(--wje-color-contrast-0)}:host(.wje-button-outline.wje-color-success){--wje-button-border-color: var(--wje-color-success-6);--wje-button-color: var(--wje-color-success-6)}:host(.wje-button-solid.wje-color-warning){--wje-button-background-color: var(--wje-color-warning-10);--wje-button-border-color: var(--wje-color-warning-11);--wje-button-color: var(--wje-color-black)}:host(.wje-button-outline.wje-color-warning){--wje-button-border-color: var(--wje-color-warning-6);--wje-button-color: var(--wje-color-warning-6)}:host(.wje-button-solid.wje-color-danger){--wje-button-background-color: var(--wje-color-danger-10);--wje-button-border-color: var(--wje-color-danger-11);--wje-button-color: var(--wje-color-contrast-0)}:host(.wje-button-outline.wje-color-danger){--wje-button-border-color: var(--wje-color-danger-6);--wje-button-color: var(--wje-color-danger-6)}:host(.wje-button-solid.wje-color-neutral){--wje-button-background-color: var(--wje-color-contrast-10);--wje-button-border-color: var(--wje-color-contrast-11);--wje-button-color: var(--wje-color-contrast-0)}:host(.wje-button-outline.wje-color-neutral){--wje-button-border-color: var(--wje-color-contrast-6);--wje-button-color: var(--wje-color-contrast-6)}:host(.wje-button-solid.wje-color-default){--wje-button-background-color: transparent;--wje-button-border-color: var(--wje-color-contrast-4);--wje-button-color: var(--wje-color-contrast-11)}:host(.wje-button-outline.wje-color-default){--wje-button-border-color: var(--wje-color-contrast-4);--wje-button-color: var(--wje-color-contrast-11)}:host{--wje-button-border-radius: var(--wje-border-radius-medium);--wje-button-border-width: 1px;--wje-button-border-style: solid;--wje-button-border-color: var(--wje-color-contrast-1);--wje-button-margin-inline: 0;--wje-padding-top: .4rem;--wje-padding-start: .5rem;--wje-padding-end: .5rem;--wje-padding-bottom: .4rem;display:inline-flex;position:relative;width:auto;cursor:pointer;margin-inline:var(--wje-button-margin-inline)}:host(.wje-button-group-button){display:block}.button-native{font-family:var(--wje-font-family);font-size:var(--wje-font-size);display:flex;position:relative;align-items:center;width:100%;height:100%;min-height:inherit;overflow:hidden;border-width:var(--wje-button-border-width);border-style:var(--wje-button-border-style);border-color:var(--wje-button-border-color);outline:none;background-color:var(--wje-button-background-color);color:var(--wje-button-color);line-height:1;contain:layout style;cursor:pointer;z-index:0;box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;margin:0;border-radius:var(--wje-button-border-radius);padding-top:var(--wje-padding-top);padding-bottom:var(--wje-padding-bottom);padding-inline:var(--wje-padding-start) var(--wje-padding-end)}@media (any-hover: hover){:host(.wje-button-solid.wje-color-primary:hover){--wje-button-background-color: var(--wje-color-primary-9);--wje-button-border-color: var(--wje-color-primary-10);--wje-button-color: var(--wje-color-contrast-0)}:host(.wje-button-outline.wje-color-primary:hover){--wje-button-background-color: var(--wje-color-primary-1);--wje-button-border-color: var(--wje-color-primary-11);--wje-button-color: var(--wje-color-primary-11)}:host(.wje-button-solid.wje-color-complete:hover){--wje-button-background-color: var(--wje-color-complete-9);--wje-button-border-color: var(--wje-color-complete-10);--wje-button-color: var(--wje-color-contrast-0)}:host(.wje-button-outline.wje-color-complete:hover){--wje-button-background-color: var(--wje-color-complete-1);--wje-button-border-color: var(--wje-color-complete-11);--wje-button-color: var(--wje-color-complete-11)}:host(.wje-button-solid.wje-color-success:hover){--wje-button-background-color: var(--wje-color-success-9);--wje-button-border-color: var(--wje-color-success-10);--wje-button-color: var(--wje-color-contrast-0)}:host(.wje-button-outline.wje-color-success:hover){--wje-button-background-color: var(--wje-color-success-1);--wje-button-border-color: var(--wje-color-success-11);--wje-button-color: var(--wje-color-success-11)}:host(.wje-button-solid.wje-color-warning:hover){--wje-button-background-color: var(--wje-color-warning-9);--wje-button-border-color: var(--wje-color-warning-10);--wje-button-color: var(--wje-color-black)}:host(.wje-button-outline.wje-color-warning:hover){--wje-button-background-color: var(--wje-color-warning-1);--wje-button-border-color: var(--wje-color-warning-11);--wje-button-color: var(--wje-color-warning-11)}:host(.wje-button-solid.wje-color-danger:hover){--wje-button-background-color: var(--wje-color-danger-9);--wje-button-border-color: var(--wje-color-danger-10);--wje-button-color: var(--wje-color-contrast-0)}:host(.wje-button-outline.wje-color-danger:hover){--wje-button-background-color: var(--wje-color-danger-1);--wje-button-border-color: var(--wje-color-danger-11);--wje-button-color: var(--wje-color-danger-11)}:host(.wje-button-solid.wje-color-neutral:hover){--wje-button-background-color: var(--wje-color-contrast-9);--wje-button-border-color: var(--wje-color-contrast-10);--wje-button-color: var(--wje-color-contrast-0)}:host(.wje-button-outline.wje-color-neutral:hover){--wje-button-background-color: var(--wje-color-contrast-1);--wje-button-border-color: var(--wje-color-contrast-11);--wje-button-color: var(--wje-color-contrast-11)}:host(.wje-button-solid.wje-color-default:hover){--wje-button-background-color: var(--wje-color-contrast-1);--wje-button-border-color: var(--wje-color-contrast-2);--wje-button-color: var(--wje-color-contrast-9)}:host(.wje-button-outline.wje-color-default:hover){--wje-button-background-color: var(--wje-color-contrast-1);--wje-button-border-color: var(--wje-color-contrast-2);--wje-button-color: var(--wje-color-contrast-9)}:host(.wje-button-link:hover){--wje-button-background-color: var(--wje-color-contrast-1);--wje-button-border-color: transparent;color:var(--wje-color-contrast-9)}}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.button-solid.wje-color){background-color:var(--wje-button-background-color);color:var(--wje-button-color)}:host(.wje-button-link){--wje-button-border-width: 1px;--wje-button-border-color: transparent;--wje-button-background-color: transparent}:host(.wje-button-disabled){cursor:default;opacity:.5;pointer-events:none}:host(.wje-button-round){--wje-button-border-radius: var(--wje-border-radius-pill)}:host(.wje-button-circle){--wje-button-border-radius: var(--wje-border-radius-circle);aspect-ratio:1/1}:host(.wje-button-large){--wje-padding-top: .6rem;--wje-padding-start: .7rem;--wje-padding-end: .7rem;--wje-padding-bottom: .6rem}:host(.wje-button-small){--wje-padding-top: .25rem;--wje-padding-start: .25rem;--wje-padding-end: .25rem;--wje-padding-bottom: .25rem}::slotted(wje-icon[slot="start"]){margin:0 .3rem 0 -.3rem}::slotted(wje-icon[slot="end"]){margin:0 -.2rem 0 .3rem}:host(:not([only-caret])) slot[name=caret]{padding:0 0 0 .3rem}:host([only-caret]) slot[name=caret]{padding:0;display:block}:host(.wje-button-group-first:not(.wje-button-group-last)) .button-native{border-start-end-radius:0;border-end-end-radius:0}:host(.wje-button-group-inner) .button-native{border-radius:0}:host(.wje-button-group-last:not(.wje-button-group-first)) .button-native{border-start-start-radius:0;border-end-start-radius:0}:host(.wje-button-group-button:not(.wje-button-group-first)){margin-inline-start:calc(-1 * var(--wje-button-border-width))!important}::slotted([slot="toggle"]){display:none}::slotted([slot="toggle"].show){display:block}';
|
|
7
|
+
class d extends h {
|
|
8
|
+
/**
|
|
9
|
+
* Button constructor
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
/**
|
|
15
|
+
* Dependencies
|
|
16
|
+
* @type {Object}
|
|
17
|
+
*/
|
|
18
|
+
s(this, "depandencies", {
|
|
19
|
+
"wje-icon": v
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Class name
|
|
23
|
+
* @type {string}
|
|
24
|
+
*/
|
|
25
|
+
s(this, "className", "Button");
|
|
26
|
+
/**
|
|
27
|
+
* Event dialog open method
|
|
28
|
+
* @param {Event} e - The event
|
|
29
|
+
*/
|
|
30
|
+
s(this, "eventDialogOpen", (o) => {
|
|
31
|
+
i.dispatchCustomEvent(this, this.dialog, {
|
|
32
|
+
bubbles: !0
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Toggle states method
|
|
37
|
+
*/
|
|
38
|
+
s(this, "toggleStates", () => {
|
|
39
|
+
this.slotToggle.assignedNodes().filter((a) => a.nodeType === Node.ELEMENT_NODE).forEach((a) => {
|
|
40
|
+
a.classList.contains("show") ? a.classList.remove("show") : a.classList.add("show");
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Set active state
|
|
46
|
+
* @param {boolean} value - The value to set
|
|
47
|
+
*/
|
|
48
|
+
set active(o) {
|
|
49
|
+
this.setAttribute("active", "");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get active state
|
|
53
|
+
* @returns {boolean} active - The active state
|
|
54
|
+
*/
|
|
55
|
+
get active() {
|
|
56
|
+
return this.hasAttribute("active");
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Set disabled state
|
|
60
|
+
* @param {boolean} value - The value to set
|
|
61
|
+
*/
|
|
62
|
+
set disabled(o) {
|
|
63
|
+
o ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get disabled state
|
|
67
|
+
* @returns {boolean} disabled - The disabled state
|
|
68
|
+
*/
|
|
69
|
+
get disabled() {
|
|
70
|
+
return this.hasAttribute("disabled");
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Set fill
|
|
74
|
+
* @param {string} value - The value to set
|
|
75
|
+
*/
|
|
76
|
+
set fill(o) {
|
|
77
|
+
this.setAttribute("fill", o);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get fill
|
|
81
|
+
* @returns {string} fill - The fill
|
|
82
|
+
*/
|
|
83
|
+
get fill() {
|
|
84
|
+
return this.getAttribute("fill") || "solid";
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Set outline
|
|
88
|
+
* @param {boolean} value - The value to set
|
|
89
|
+
*/
|
|
90
|
+
set outline(o) {
|
|
91
|
+
this.setAttribute("outline", "");
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get outline
|
|
95
|
+
* @returns {boolean} outline - The outline
|
|
96
|
+
*/
|
|
97
|
+
get outline() {
|
|
98
|
+
return this.hasAttribute("outline");
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Set stop propagation
|
|
102
|
+
* @param {boolean} value - The value to set
|
|
103
|
+
*/
|
|
104
|
+
set stopPropagation(o) {
|
|
105
|
+
this.setAttribute("stop-propagation", w(o));
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get stop propagation
|
|
109
|
+
* @returns {boolean} stopPropagation - The stop propagation
|
|
110
|
+
*/
|
|
111
|
+
get stopPropagation() {
|
|
112
|
+
return w(this.getAttribute("stop-propagation"));
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Get CSS stylesheet
|
|
116
|
+
* @static
|
|
117
|
+
* @returns {Object} styles - The CSS styles
|
|
118
|
+
*/
|
|
119
|
+
static get cssStyleSheet() {
|
|
120
|
+
return p;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Get observed attributes
|
|
124
|
+
* @static
|
|
125
|
+
* @returns {Array<string>} observedAttributes - The observed attributes
|
|
126
|
+
*/
|
|
127
|
+
static get observedAttributes() {
|
|
128
|
+
return ["disabled"];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Setup attributes
|
|
132
|
+
*/
|
|
133
|
+
setupAttributes() {
|
|
134
|
+
this.isShadowRoot = "open";
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Draw method
|
|
138
|
+
* @param {Object} context - The context
|
|
139
|
+
* @param {Object} store - The store
|
|
140
|
+
* @param {Object} params - The parameters
|
|
141
|
+
* @returns {Object} fragment - The document fragment
|
|
142
|
+
*/
|
|
143
|
+
draw(o, a, m) {
|
|
144
|
+
let u = document.createDocumentFragment();
|
|
145
|
+
if (this.classList.remove("wje-button-disabled"), this.disabled && this.classList.add("wje-button-disabled"), this.variant && this.classList.add("wje-button-" + this.variant), this.hasAttribute("round") && this.classList.add("wje-button-round"), this.hasAttribute("circle") && this.classList.add("wje-button-circle"), this.outline && this.classList.add("wje-outline"), this.fill && this.classList.add("wje-button-" + this.fill), this.size && this.classList.add("wje-button-" + this.size), this.hasAttribute("color") ? this.classList.add("wje-color-" + this.color, "wje-color") : this.classList.add("wje-color-default", "wje-color"), this.querySelectorAll("[slot=caret]").length < 1 && this.hasAttribute("caret") || this.hasAttribute("only-caret")) {
|
|
146
|
+
let l = document.createElement("wje-icon");
|
|
147
|
+
l.style.setProperty("--wje-icon-size", "14px"), l.setAttribute("slot", "caret"), l.setAttribute("name", "chevron-down"), this.appendChild(l);
|
|
148
|
+
}
|
|
149
|
+
if (this.active) {
|
|
150
|
+
this.classList.add("wje-active");
|
|
151
|
+
let l = document.createElement("wje-icon");
|
|
152
|
+
l.setAttribute("name", "check"), this.appendChild(l);
|
|
153
|
+
}
|
|
154
|
+
let c = document.createElement(this.hasAttribute("href") ? "a" : "button");
|
|
155
|
+
c.classList.add("button-native"), c.setAttribute("part", "native");
|
|
156
|
+
let n = document.createElement("span");
|
|
157
|
+
n.classList.add("button-inner");
|
|
158
|
+
let e = document.createElement("slot");
|
|
159
|
+
return e.setAttribute("name", "icon-only"), n.appendChild(e), e = document.createElement("slot"), e.setAttribute("name", "start"), n.appendChild(e), e = document.createElement("slot"), n.appendChild(e), e = document.createElement("slot"), e.setAttribute("name", "end"), n.appendChild(e), e = document.createElement("slot"), e.setAttribute("name", "caret"), n.appendChild(e), this.hasToggle = g.hasSlot(this, "toggle"), this.hasToggle && (this.slotToggle = document.createElement("slot"), this.slotToggle.setAttribute("name", "toggle"), n.appendChild(this.slotToggle)), c.appendChild(n), u.appendChild(c), u;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* After draw method
|
|
163
|
+
*/
|
|
164
|
+
afterDraw() {
|
|
165
|
+
this.hasToggle && (this.toggle === "off" ? this.slotToggle.assignedNodes()[1].classList.add("show") : this.slotToggle.assignedNodes()[0].classList.add("show")), this.hasAttribute("dialog") ? i.addListener(this, "click", null, this.eventDialogOpen) : i.addListener(this, "click", "wje-button:click", null), this.hasToggle && i.addListener(this, "click", "wje-button:toggle", this.toggleStates, { stopPropagation: this.stopPropagation });
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Before disconnect method
|
|
169
|
+
*/
|
|
170
|
+
beforeDisconnect() {
|
|
171
|
+
this.removeEventListener("click", this.eventDialogOpen);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
d.define("wje-button", d);
|
|
175
|
+
export {
|
|
176
|
+
d as default
|
|
177
|
+
};
|