wj-elements 0.1.46 → 0.1.48
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.js +0 -45
- package/dist/popup.element-CWsSOxs2.js +0 -1072
- 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 -77
- 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 -207
- 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 -96
- 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 -114
- 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 -201
- package/dist/wje-inline-edit.js +0 -145
- package/dist/wje-input-file.js +0 -85
- package/dist/wje-input.js +0 -334
- 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 -423
- package/dist/wje-menu-button.js +0 -65
- package/dist/wje-menu-item.js +0 -230
- 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 -161
- package/dist/wje-qr-code.js +0 -2332
- 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-handle.js +0 -115
- package/dist/wje-reorder-item.js +0 -32
- package/dist/wje-reorder.js +0 -138
- package/dist/wje-route.js +0 -46
- 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 -242
- package/dist/wje-slider.js +0 -177
- package/dist/wje-sliding-container.js +0 -274
- package/dist/wje-split-view.js +0 -112
- package/dist/wje-status.js +0 -54
- package/dist/wje-store.js +0 -192
- package/dist/wje-tab-group.js +0 -107
- 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 -116
- package/dist/wje-visually-hidden.js +0 -56
package/dist/wje-input.js
DELETED
|
@@ -1,334 +0,0 @@
|
|
|
1
|
-
var x = Object.defineProperty;
|
|
2
|
-
var E = (l, n, t) => n in l ? x(l, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[n] = t;
|
|
3
|
-
var m = (l, n, t) => (E(l, typeof n != "symbol" ? n + "" : n, t), t);
|
|
4
|
-
import A, { event as j } from "./wje-element.js";
|
|
5
|
-
const k = ':host{--wje-input-font-family: var(--wje-font-family);--wje-input-background-color: var(--wje-background);--wje-input-color: var(--wje-color);--wje-input-color-invalid: var(--wje-color-danger);--wje-input-border-color: var(--wje-border-color);--wje-input-border-color-focus: var(--wje-color-primary);--wje-input-border-width: 1px;--wje-input-border-style: solid;--wje-input-border-radius: 4px;--wje-input-margin-bottom: .5rem;--wje-input-line-height: 20px;--wje-input-slot-padding-inline: .5rem;width:100%;margin-bottom:var(--wje-input-margin-bottom);display:block}:host .wrapper{display:flex;width:100%}:host .native-input .input-wrapper{width:100%;position:relative}:host .native-input.default{background-color:var(--wje-input-background-color);font-family:var(--wje-input-font-family);position:relative;border-radius:var(--wje-input-border-radius);border-width:var(--wje-input-border-width);border-style:var(--wje-input-border-style);border-color:var(--wje-input-border-color);padding-inline:0;padding-top:.25rem;padding-bottom:.25rem;transition:background-color .2s ease;cursor:text}:host .native-input.default .input-wrapper{margin-inline:.5rem}:host .native-input.default.focused{border-color:var(--wje-input-border-color-focus)!important}:host .native-input.default.focused label{opacity:.67;font-size:12px;letter-spacing:normal}:host .native-input.default input{border:none;height:25px;min-height:25px;padding:0;margin-top:-4px;background:none;box-shadow:none;width:100%}:host .native-input.default label{margin:0;display:block;opacity:1;cursor:text;transition:opacity .2s ease;line-height:var(--wje-input-line-height)}:host .native-input.default label.fade{opacity:.5;font-size:12px;letter-spacing:normal}:host .native-input.default ::slotted([slot="start"]){border-left:none;border-top:none;border-bottom:none}:host .native-input.default ::slotted([slot="end"]){border-right:none;border-top:none;border-bottom:none}:host .native-input.standard{background-color:var(--wje-input-background-color);font-family:var(--wje-input-font-family);position:relative;border-radius:var(--wje-input-border-radius);padding-inline:0;padding-top:0;padding-bottom:0;transition:background-color .2s ease;cursor:text}:host .native-input.standard.focused input{border-color:var(--wje-input-border-color-focus)!important}:host .native-input.standard input{display:block;min-height:32px;padding-inline:.5rem;padding-top:0;padding-bottom:0;background:none;box-shadow:none;width:100%;box-sizing:border-box;border-radius:var(--wje-input-border-radius);border-width:var(--wje-input-border-width);border-style:var(--wje-input-border-style);border-color:var(--wje-input-border-color)}:host .native-input.standard label{margin:0;display:inline-block;opacity:1;cursor:text;transition:opacity .2s ease;line-height:var(--wje-input-line-height)}:host .native-input.standard .input-wrapper:hover .clear{visibility:visible}:host .native-input.standard ::slotted([slot="start"]){border-right:none;border-radius:var(--wje-input-border-radius) 0 0 var(--wje-input-border-radius)}:host .native-input.standard ::slotted([slot="end"]){border-left:none;border-radius:0 var(--wje-input-border-radius) var(--wje-input-border-radius) 0}:host .native-input.standard.has-start input{border-top-left-radius:0;border-bottom-left-radius:0}:host .native-input.standard.has-end input{border-top-right-radius:0;border-bottom-right-radius:0}:host .native-input.standard .error-message{position:static;background:transparent;padding:.25rem 0;left:auto;transform:none;color:var(--wje-input-color-invalid);font-size:12px;line-height:normal}.clear{visibility:hidden;position:absolute;right:0;top:3px;--wje-padding-top: .25rem;--wje-padding-start: .25rem;--wje-padding-end: .25rem;--wje-padding-bottom: .25rem;--wje-button-margin-inline: 0 .25rem}:host([required]) .input-wrapper:after{color:var(--wje-input-color-invalid);content:"*";font-family:var(--wje-force-mac-font-family);font-size:20px;position:absolute;right:0;top:0}:host([required]) .standard .input-wrapper:after{top:0}:host([invalid]) .error-message{display:block}:host([invalid]) .default label{opacity:1!important;color:var(--wje-input-color-invalid)!important;animation-name:shake;animation-duration:.4s;animation-iteration-count:1}::slotted([slot="start"]),::slotted([slot="end"]){display:flex;align-items:center;border-width:var(--wje-input-border-width);border-style:var(--wje-input-border-style);border-color:var(--wje-input-border-color);padding-inline:var(--wje-input-slot-padding-inline)}slot[name=start],slot[name=end]{display:flex}slot[name=error]{display:none;margin-inline:.5rem}:host([invalid]) slot[name=error]{display:block}input{background-color:var(--wje-input-background-color);border-width:var(--wje-input-border-width);border-style:var(--wje-input-border-style);border-color:var(--wje-input-border-color);font-family:var(--wjinput-font-family);color:var(--wje-input-color);-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:0;padding:.25rem .5rem;line-height:var(--wje-input-line-height);font-size:14px;font-weight:400;vertical-align:middle;min-height:32px}.error-message{display:none;position:absolute;width:auto;max-width:100%;min-width:auto;border-radius:50px;background:#000;padding:.25rem .5rem;top:0;left:50%;transform:translate(-50%,-50%);color:#fff;font-size:12px;line-height:normal}@keyframes shake{8%,41%{transform:translate(-4px)}25%,58%{transform:translate(4px)}75%{transform:translate(-2px)}92%{transform:translate(2px)}0%,to{transform:translate(0)}}';
|
|
6
|
-
class f extends A {
|
|
7
|
-
/**
|
|
8
|
-
* Constructor for the Input class.
|
|
9
|
-
* @param {Object} options - The options for the Input class.
|
|
10
|
-
*/
|
|
11
|
-
constructor(t = {}) {
|
|
12
|
-
super();
|
|
13
|
-
/**
|
|
14
|
-
* The class name of the input.
|
|
15
|
-
* @type {string}
|
|
16
|
-
*/
|
|
17
|
-
m(this, "className", "Input");
|
|
18
|
-
this.invalid = !1, this.pristine = !0, this.internals = this.attachInternals();
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Setter for the value attribute.
|
|
22
|
-
* @param {string} value - The value to set.
|
|
23
|
-
*/
|
|
24
|
-
set value(t) {
|
|
25
|
-
this.internals.setFormValue(t), this.input && (this.input.value = t);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Getter for the value attribute.
|
|
29
|
-
* @returns {string} The value of the attribute.
|
|
30
|
-
*/
|
|
31
|
-
get value() {
|
|
32
|
-
var t;
|
|
33
|
-
return ((t = this.input) == null ? void 0 : t.value) || "";
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Getter for the customErrorDisplay attribute.
|
|
37
|
-
* @returns {boolean} Whether the attribute is present.
|
|
38
|
-
*/
|
|
39
|
-
get customErrorDisplay() {
|
|
40
|
-
return this.hasAttribute("custom-error-display");
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Getter for the validateOnChange attribute.
|
|
44
|
-
* @returns {boolean} Whether the attribute is present.
|
|
45
|
-
*/
|
|
46
|
-
get validateOnChange() {
|
|
47
|
-
return this.hasAttribute("validate-on-change");
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Getter for the invalid attribute.
|
|
51
|
-
* @returns {boolean} Whether the attribute is present.
|
|
52
|
-
*/
|
|
53
|
-
get invalid() {
|
|
54
|
-
return this.hasAttribute("invalid");
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Setter for the invalid attribute.
|
|
58
|
-
* @param {boolean} isInvalid - Whether the input is invalid.
|
|
59
|
-
*/
|
|
60
|
-
set invalid(t) {
|
|
61
|
-
t ? this.setAttribute("invalid", "") : this.removeAttribute("invalid");
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Getter for the form attribute.
|
|
65
|
-
* @returns {HTMLFormElement} The form the input is associated with.
|
|
66
|
-
*/
|
|
67
|
-
get form() {
|
|
68
|
-
return this.internals.form;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Getter for the name attribute.
|
|
72
|
-
* @returns {string} The name of the input.
|
|
73
|
-
*/
|
|
74
|
-
get name() {
|
|
75
|
-
return this.getAttribute("name");
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Getter for the type attribute.
|
|
79
|
-
* @returns {string} The type of the input.
|
|
80
|
-
*/
|
|
81
|
-
get type() {
|
|
82
|
-
return this.localName;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Getter for the validity attribute.
|
|
86
|
-
* @returns {ValidityState} The validity state of the input.
|
|
87
|
-
*/
|
|
88
|
-
get validity() {
|
|
89
|
-
return this.internals.validity;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Getter for the validationMessage attribute.
|
|
93
|
-
* @returns {string} The validation message of the input.
|
|
94
|
-
*/
|
|
95
|
-
get validationMessage() {
|
|
96
|
-
return this.internals.validationMessage;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Getter for the willValidate attribute.
|
|
100
|
-
* @returns {boolean} Whether the input will be validated.
|
|
101
|
-
*/
|
|
102
|
-
get willValidate() {
|
|
103
|
-
return this.internals.willValidate;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* @summary Getter for the defaultValue attribute.
|
|
107
|
-
* This method retrieves the 'value' attribute of the custom input element.
|
|
108
|
-
* The 'value' attribute represents the default value of the input element.
|
|
109
|
-
* If the 'value' attribute is not set, it returns an empty string.
|
|
110
|
-
* @returns {string} The default value of the input element.
|
|
111
|
-
*/
|
|
112
|
-
get defaultValue() {
|
|
113
|
-
return this.getAttribute("value") ?? "";
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* @summary Setter for the defaultValue attribute.
|
|
117
|
-
* This method sets the 'value' attribute of the custom input element to the provided value.
|
|
118
|
-
* The 'value' attribute represents the default value of the input element.
|
|
119
|
-
* @param {string} value - The value to set as the default value.
|
|
120
|
-
*/
|
|
121
|
-
set defaultValue(t) {
|
|
122
|
-
this.setAttribute("value", t);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Getter for the cssStyleSheet attribute.
|
|
126
|
-
* @returns {CSSStyleSheet} The CSS style sheet of the input.
|
|
127
|
-
*/
|
|
128
|
-
static get cssStyleSheet() {
|
|
129
|
-
return k;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Getter for the observedAttributes attribute.
|
|
133
|
-
* @returns {Array} The attributes to observe for changes.
|
|
134
|
-
*/
|
|
135
|
-
static get observedAttributes() {
|
|
136
|
-
return ["value"];
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Sets up the attributes for the input.
|
|
140
|
-
*/
|
|
141
|
-
setupAttributes() {
|
|
142
|
-
this.isShadowRoot = "open", this.value = this.defaultValue;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Draws the input.
|
|
146
|
-
* @param {CanvasRenderingContext2D} context - The context to draw on.
|
|
147
|
-
* @param {Object} store - The store to use.
|
|
148
|
-
* @param {Object} params - The parameters to use.
|
|
149
|
-
* @returns {DocumentFragment} The drawn input.
|
|
150
|
-
*/
|
|
151
|
-
draw(t, e, r) {
|
|
152
|
-
let a = this.hasSlot(this, "start"), g = this.hasSlot(this, "end"), y = this.hasSlot(this, "error"), w = document.createDocumentFragment(), i = document.createElement("div");
|
|
153
|
-
i.setAttribute("part", "native"), i.classList.add("native-input", this.variant || "default"), this.hasAttribute("invalid") && i.classList.add("has-error");
|
|
154
|
-
let s = document.createElement("div");
|
|
155
|
-
s.classList.add("wrapper");
|
|
156
|
-
let p = document.createElement("div");
|
|
157
|
-
p.classList.add("input-wrapper");
|
|
158
|
-
let h = document.createElement("label");
|
|
159
|
-
h.innerText = this.label, this.value && !this.hasAttribute("error") && h.classList.add("fade");
|
|
160
|
-
let o = document.createElement("input");
|
|
161
|
-
o.setAttribute("type", "text"), o.setAttribute("part", "input"), o.setAttribute("value", this.value || ""), o.classList.add("form-control"), ["placeholder", "multiple", "disabled", "readonly", "maxlength", "max", "min"].forEach((u) => {
|
|
162
|
-
this.hasAttribute(u) && o.setAttribute(u, this[u] || "");
|
|
163
|
-
});
|
|
164
|
-
let d = document.createElement("div");
|
|
165
|
-
d.classList.add("error-message"), d.setAttribute("part", "error");
|
|
166
|
-
let c = null;
|
|
167
|
-
y ? (c = document.createElement("slot"), c.setAttribute("name", "error"), this.hasAttribute("error-inline") ? i.appendChild(c) : (d.appendChild(c), s.appendChild(d))) : s.appendChild(d);
|
|
168
|
-
let b = null;
|
|
169
|
-
a && (b = document.createElement("slot"), b.setAttribute("name", "start"), b.setAttribute("part", "start"));
|
|
170
|
-
let v = null;
|
|
171
|
-
if (g && (v = document.createElement("slot"), v.setAttribute("name", "end"), v.setAttribute("part", "end")), a && (s.appendChild(b), i.classList.add("has-start")), this.variant === "standard" ? this.label && i.appendChild(h) : p.appendChild(h), p.appendChild(o), s.appendChild(p), i.appendChild(s), this.hasAttribute("clearable")) {
|
|
172
|
-
this.clear = document.createElement("wje-button"), this.clear.classList.add("clear"), this.clear.setAttribute("fill", "link"), this.clear.setAttribute("part", "clear");
|
|
173
|
-
let u = document.createElement("wje-icon");
|
|
174
|
-
u.setAttribute("name", "x"), this.clear.appendChild(u), p.appendChild(this.clear);
|
|
175
|
-
}
|
|
176
|
-
return g && (s.appendChild(v), i.classList.add("has-end")), w.appendChild(i), this.native = i, this.labelElement = h, this.input = o, this.errorMessage = d, w;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Runs after the input is drawn.
|
|
180
|
-
*/
|
|
181
|
-
afterDraw() {
|
|
182
|
-
[
|
|
183
|
-
"type",
|
|
184
|
-
"value",
|
|
185
|
-
"placeholder",
|
|
186
|
-
"required",
|
|
187
|
-
"min",
|
|
188
|
-
"max",
|
|
189
|
-
"minLength",
|
|
190
|
-
"maxLength",
|
|
191
|
-
"pattern"
|
|
192
|
-
].forEach((t) => {
|
|
193
|
-
const e = t === "required" ? this.hasAttribute(t) : this.getAttribute(t);
|
|
194
|
-
e != null && (this.input[t] = e);
|
|
195
|
-
}), this.input.addEventListener("focus", (t) => {
|
|
196
|
-
this.labelElement.classList.add("fade"), this.native.classList.add("focused");
|
|
197
|
-
}), this.input.addEventListener("blur", (t) => {
|
|
198
|
-
this.native.classList.remove("focused"), t.target.value || this.labelElement.classList.remove("fade");
|
|
199
|
-
}), this.input.addEventListener("input", (t) => {
|
|
200
|
-
this.validateInput(), this.validateOnChange && (this.pristine = !1, this.propagateValidation()), this.input.classList.remove("pristine"), this.labelElement.classList.add("fade");
|
|
201
|
-
const e = new t.constructor(t.type, t);
|
|
202
|
-
this.dispatchEvent(e), j.dispatchCustomEvent(this, "wje-input:input", {
|
|
203
|
-
value: this.input.value
|
|
204
|
-
}), this.value = this.input.value;
|
|
205
|
-
}), this.addEventListener("invalid", (t) => {
|
|
206
|
-
this.invalid = !0, this.pristine = !1, this.showInvalidMessage(), this.customErrorDisplay && t.preventDefault();
|
|
207
|
-
}), this.addEventListener("focus", () => this.input.focus()), this.clear && this.clear.addEventListener("wje-button:click", (t) => {
|
|
208
|
-
this.input.value = "", j.dispatchCustomEvent(this.clear, "wje-input:clear");
|
|
209
|
-
}), this.validateInput();
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* @summary Displays the validation message for the input.
|
|
213
|
-
* If the input has a slot named 'error', it sets the text content of the element with attribute 'error-message' inside the slot to the validation message.
|
|
214
|
-
* If the input does not have an 'error' slot, it sets the text content of the errorMessage property to the validation message.
|
|
215
|
-
*/
|
|
216
|
-
showInvalidMessage() {
|
|
217
|
-
if (this.hasSlot(this, "error")) {
|
|
218
|
-
const e = this.querySelector("[slot='error']");
|
|
219
|
-
let r = e.querySelector("[error-message]");
|
|
220
|
-
if (!r) {
|
|
221
|
-
const a = document.createElement("div");
|
|
222
|
-
a.setAttribute("error-message", ""), e.appendChild(a), r = a;
|
|
223
|
-
}
|
|
224
|
-
r.textContent = this.internals.validationMessage;
|
|
225
|
-
} else
|
|
226
|
-
this.errorMessage.textContent = this.internals.validationMessage;
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* @summary Validates the input.
|
|
230
|
-
* This method checks the validity state of the input. If the input is not valid, it iterates over the validity state object.
|
|
231
|
-
* For each invalid state, it constructs an attribute name and checks if the input has this attribute.
|
|
232
|
-
* If the input has the attribute, it sets the validation error to the state and the error message to the attribute value.
|
|
233
|
-
* If the input does not have the attribute, it sets the error message to the default validation message of the input.
|
|
234
|
-
* It then sets the validity in the form internals to an object with the validation error as key and true as value, and the error message.
|
|
235
|
-
* If the input is valid, it sets the validity in the form internals to an empty object.
|
|
236
|
-
*/
|
|
237
|
-
validateInput() {
|
|
238
|
-
const t = this.input.validity;
|
|
239
|
-
if (t.valid)
|
|
240
|
-
this.internals.setValidity({});
|
|
241
|
-
else
|
|
242
|
-
for (let e in t) {
|
|
243
|
-
const r = `message-${e.toString()}`;
|
|
244
|
-
if (t[e]) {
|
|
245
|
-
this.validationError = e.toString();
|
|
246
|
-
let a = this.message;
|
|
247
|
-
this.hasAttribute("message") || (a = this.hasAttribute(r) ? this.getAttribute(r) : this.input.validationMessage), this.internals.setValidity(
|
|
248
|
-
{ [this.validationError]: !0 },
|
|
249
|
-
a
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* @summary Propagates the validation state of the input.
|
|
256
|
-
* This method sets the 'invalid' property of the input based on its 'pristine' state and its internal validity state.
|
|
257
|
-
* If the input is invalid and the 'customErrorDisplay' property is true, it dispatches an 'invalid' event.
|
|
258
|
-
*/
|
|
259
|
-
propagateValidation() {
|
|
260
|
-
this.invalid = !this.pristine && !this.internals.validity.valid, this.invalid && this.customErrorDisplay && this.dispatchEvent(new Event("invalid"));
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Checks whether the input has a slot.
|
|
264
|
-
* @param {HTMLElement} el - The element to check.
|
|
265
|
-
* @param {string} slotName - The name of the slot to check for.
|
|
266
|
-
* @returns {boolean} Whether the input has the slot.
|
|
267
|
-
*/
|
|
268
|
-
hasSlot(t, e = null) {
|
|
269
|
-
let r = e ? `[slot="${e}"]` : "[slot]";
|
|
270
|
-
return t.querySelectorAll(r).length > 0;
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* @summary Callback function that is called when the custom element is associated with a form.
|
|
274
|
-
* This function adds an event listener to the form's submit event, which validates the input and propagates the validation.
|
|
275
|
-
* @param {HTMLFormElement} form - The form the custom element is associated with.
|
|
276
|
-
*/
|
|
277
|
-
formAssociatedCallback(t) {
|
|
278
|
-
t.addEventListener("submit", () => {
|
|
279
|
-
this.validateInput(), this.propagateValidation();
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* The formResetCallback method is a built-in lifecycle callback that gets called when a form gets reset.
|
|
284
|
-
* This method is responsible for resetting the value of the custom input element to its default value.
|
|
285
|
-
* It also resets the form value and validity state in the form internals.
|
|
286
|
-
*
|
|
287
|
-
* @method
|
|
288
|
-
*/
|
|
289
|
-
formResetCallback() {
|
|
290
|
-
this.value = this.defaultValue, this.internals.setFormValue(this.defaultValue), this.internals.setValidity({});
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* The formStateRestoreCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is restored.
|
|
294
|
-
* This method is responsible for restoring the value of the custom input element to its saved state.
|
|
295
|
-
* It also restores the form value and validity state in the form internals to their saved states.
|
|
296
|
-
*
|
|
297
|
-
* @param {Object} state - The saved state of the custom input element.
|
|
298
|
-
* @method
|
|
299
|
-
*/
|
|
300
|
-
formStateRestoreCallback(t) {
|
|
301
|
-
this.value = t.value, this.internals.setFormValue(t.value), this.internals.setValidity({});
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* The formStateSaveCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is saved.
|
|
305
|
-
* This method is responsible for saving the value of the custom input element.
|
|
306
|
-
*
|
|
307
|
-
* @returns {Object} The saved state of the custom input element.
|
|
308
|
-
* @method
|
|
309
|
-
*/
|
|
310
|
-
formStateSaveCallback() {
|
|
311
|
-
return {
|
|
312
|
-
value: this.value
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* The formDisabledCallback method is a built-in lifecycle callback that gets called when the disabled state of a form-associated custom element changes.
|
|
317
|
-
* This method is not implemented yet.
|
|
318
|
-
*
|
|
319
|
-
* @param {boolean} disabled - The new disabled state of the custom input element.
|
|
320
|
-
* @method
|
|
321
|
-
*/
|
|
322
|
-
formDisabledCallback(t) {
|
|
323
|
-
console.warn("formDisabledCallback not implemented yet");
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Whether the input is associated with a form.
|
|
328
|
-
* @type {boolean}
|
|
329
|
-
*/
|
|
330
|
-
m(f, "formAssociated", !0);
|
|
331
|
-
f.define("wje-input", f);
|
|
332
|
-
export {
|
|
333
|
-
f as default
|
|
334
|
-
};
|
package/dist/wje-item.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
var d = Object.defineProperty;
|
|
2
|
-
var l = (i, t, e) => t in i ? d(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
-
var r = (i, t, e) => (l(i, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
-
import m from "./wje-element.js";
|
|
5
|
-
const p = ':host{--wje-border-width: 0 0 1px 0;--wje-item-background: transparent;--wje-item-background-hover: var(--wje-color-contrast-3);--wje-item-padding-top: 0px;--wje-item-padding-bottom: 0px;--wje-item-padding-end: 0px;--wje-item-padding-start: 0px;--wje-item-inner-border-width: 0 0 1px 0;--wje-item-inner-padding-top: 0px;--wje-item-inner-padding-bottom: 0px;--wje-item-inner-padding-start: 0px;--wje-item-inner-padding-end: 0px;--wje-item-inner-box-shadow: none;--wje-item-min-height: 40px;--wje-item-transition: opacity 15ms linear, background-color 15ms linear;display:block;position:relative;align-items:center;justify-content:space-between;outline:none;color:var(--wje-item-color);text-align:initial;text-decoration:none;overflow:hidden;box-sizing:border-box;width:100%}.item-native{border-radius:var(--wje-item-border-radius);padding-top:var(--wje-item-padding-top);padding-bottom:var(--wje-item-padding-bottom);padding-inline:var(--wje-item-padding-start) var(--wje-item-padding-end);margin:0;display:flex;position:relative;align-items:inherit;justify-content:inherit;width:100%;min-height:var(--wje-item-min-height);transition:var(--wje-item-transition);outline:none;background:var(--wje-item-background);overflow:inherit;box-sizing:border-box;z-index:1;text-decoration:none;color:var(--wje-item-color)}.item-native .item-inner{margin:0;padding:var(--wje-item-inner-padding-top) var(--wje-item-inner-padding-end) var(--wje-item-inner-padding-bottom) var(--wje-item-inner-padding-start);display:flex;position:relative;flex:1 1 0;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border-width:var(--wje-border-width);border-style:var(--wje-border-style);border-color:var(--wje-border-color);box-shadow:var(--wje-item-inner-box-shadow);overflow:inherit;box-sizing:border-box}.item-native .item-inner .input-wrapper{display:flex;flex:1 1 0;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:inherit;box-sizing:border-box}.item-native .item-bottom{padding:0 var(--wje-item-inner-padding-end) 0 var(--wje-item-padding-start);display:flex;justify-content:space-between}@media (any-hover: hover){:host(:hover) .item-native{color:var(--wje-item-color)}:host(:hover) .item-native :after{transition:var(--wje-item-transition);z-index:-1;top:0;right:0;bottom:0;left:0;position:absolute;content:"";background:var(--wje-item-background-hover);opacity:.7}}button,a{cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}::slotted([slot="start"]){margin-inline:0 1rem}::slotted(wje-label:not([slot="end"])){flex:1 1 0}';
|
|
6
|
-
class a extends m {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
r(this, "className", "Item");
|
|
10
|
-
r(this, "hostContext", (e, n) => n.closest(e) !== null);
|
|
11
|
-
this.labelColorStyles = {}, this.itemStyles = /* @__PURE__ */ new Map(), this.inheritedAriaAttributes = {}, this.multipleInputs = !1, this.focusable = !0, this.button = !1, this.detailIcon = "", this.disabled = !1, this.counter = !1, this.routerDirection = "forward", this.type = "button";
|
|
12
|
-
}
|
|
13
|
-
isClickable() {
|
|
14
|
-
return this.hasAttribute("href") || this.button;
|
|
15
|
-
}
|
|
16
|
-
static get cssStyleSheet() {
|
|
17
|
-
return p;
|
|
18
|
-
}
|
|
19
|
-
setupAttributes() {
|
|
20
|
-
this.isShadowRoot = "open";
|
|
21
|
-
}
|
|
22
|
-
beforeDraw(e, n, s) {
|
|
23
|
-
}
|
|
24
|
-
draw(e, n, s) {
|
|
25
|
-
const o = this.isClickable() ? this.hasAttribute("href") === void 0 ? "button" : "a" : "div";
|
|
26
|
-
return this.hostContext("wje-list", this) && this.classList.add("wje-item-list"), `<${o} class="item-native" part="native">
|
|
27
|
-
<slot name="start"></slot>
|
|
28
|
-
<div class="item-inner">
|
|
29
|
-
<div class="input-wrapper" part="inner">
|
|
30
|
-
<slot></slot>
|
|
31
|
-
</div>
|
|
32
|
-
<slot name="end"></slot>
|
|
33
|
-
</div>
|
|
34
|
-
<div class="item-highlight"></div>
|
|
35
|
-
</${o}>
|
|
36
|
-
<div class="item-bottom">
|
|
37
|
-
<slot name="error"></slot>
|
|
38
|
-
<slot name="helper"></slot>
|
|
39
|
-
</div>`;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
a.define("wje-item", a);
|
|
43
|
-
export {
|
|
44
|
-
a as default
|
|
45
|
-
};
|
package/dist/wje-label.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
var i = Object.defineProperty;
|
|
2
|
-
var w = (e, o, t) => o in e ? i(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
|
|
3
|
-
var l = (e, o, t) => (w(e, typeof o != "symbol" ? o + "" : o, t), t);
|
|
4
|
-
import m from "./wje-element.js";
|
|
5
|
-
const h = ":host(.wje-color-primary){--wje-color: var(--wje-color-primary) !important}:host(.wje-color-complete){--wje-color: var(--wje-color-complete) !important}:host(.wje-color-success){--wje-color-base: var(--wje-color-success) !important;--wje-color-contrast: var(--wje-color-contrast-0) !important}:host(.wje-color-warning){--wje-color-base: var(--wje-color-warning) !important;--wje-color-contrast: var(--wje-color-contrast-11) !important}:host(.wje-color-danger){--wje-color-base: var(--wje-color-danger) !important;--wje-color-contrast: var(--wje-color-contrast-0) !important}:host(.wje-color-info){--wje-color-base: var(--wje-color-info) !important;--wje-color-contrast: var(--wje-color-contrast-0) !important}:host(.wje-color-menu){--wje-color-base: var(--wje-color-menu) !important;--wje-color-contrast: var(--wje-color-contrast-0) !important}:host{--wje-color: initial;display:block;font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;box-sizing:border-box}:host(.wje-color){color:current-color(base)}:host(.wje-text-wrap),:host([text-wrap]){white-space:normal!important}:host(.label-fixed){flex:0 0 100px;width:100px;min-width:100px;max-width:200px}:host(.label-stacked),:host(.label-floating){margin-bottom:0;align-self:stretch;width:auto;max-width:100%}:host(.label-no-animate.label-floating){transition:none}::slotted(*) h1,::slotted(*) h2,::slotted(*) h3,::slotted(*) h4,::slotted(*) h5,::slotted(*) h6{text-overflow:inherit;overflow:inherit}:host(.wje-color){color:var(--wje-color)}::slotted(*:first-child){margin-top:0!important}::slotted(*:last-child){margin-bottom:0!important}";
|
|
6
|
-
class s extends m {
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of Label.
|
|
9
|
-
*
|
|
10
|
-
* @constructor
|
|
11
|
-
*/
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
l(this, "className", "Label");
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Returns the CSS styles for the component.
|
|
18
|
-
*
|
|
19
|
-
* @static
|
|
20
|
-
* @returns {CSSStyleSheet}
|
|
21
|
-
*/
|
|
22
|
-
static get cssStyleSheet() {
|
|
23
|
-
return h;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Returns the list of attributes to observe for changes.
|
|
27
|
-
*
|
|
28
|
-
* @static
|
|
29
|
-
* @returns {Array<string>}
|
|
30
|
-
*/
|
|
31
|
-
static get observedAttributes() {
|
|
32
|
-
return [];
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Sets up the attributes for the component.
|
|
36
|
-
*/
|
|
37
|
-
setupAttributes() {
|
|
38
|
-
this.isShadowRoot = "open";
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Prepares the component before drawing.
|
|
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
|
-
*/
|
|
47
|
-
beforeDraw(t, c, r) {
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Draws the component.
|
|
51
|
-
*
|
|
52
|
-
* @param {Object} context - The context for drawing.
|
|
53
|
-
* @param {Object} store - The store for drawing.
|
|
54
|
-
* @param {Object} params - The parameters for drawing.
|
|
55
|
-
* @returns {DocumentFragment}
|
|
56
|
-
*/
|
|
57
|
-
draw(t, c, r) {
|
|
58
|
-
let a = document.createDocumentFragment();
|
|
59
|
-
this.color && this.classList.add("wje-color-" + r.color, "wje-color");
|
|
60
|
-
let n = document.createElement("slot");
|
|
61
|
-
return a.appendChild(n), a;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
s.define("wje-label", s);
|
|
65
|
-
export {
|
|
66
|
-
s as default
|
|
67
|
-
};
|
package/dist/wje-list.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
var o = Object.defineProperty;
|
|
2
|
-
var l = (e, t, s) => t in e ? o(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
|
|
3
|
-
var n = (e, t, s) => (l(e, typeof t != "symbol" ? t + "" : t, s), s);
|
|
4
|
-
import d from "./wje-element.js";
|
|
5
|
-
const c = ":host{margin:0;padding:0;display:block;contain:content;list-style-type:none}:host(.wje-inset){background:var(--wje-list-background);transform:translateZ(0);overflow:hidden;padding:var(--wje-list-inset-padding);border-radius:var(--wje-list-border-radius)}:host(.wje-lines-none) ::slotted(wje-item){--wje-border-width: 0 !important}";
|
|
6
|
-
class r extends d {
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of List.
|
|
9
|
-
*
|
|
10
|
-
* @constructor
|
|
11
|
-
*/
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
n(this, "className", "List");
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Returns the CSS styles for the component.
|
|
18
|
-
*
|
|
19
|
-
* @static
|
|
20
|
-
* @returns {CSSStyleSheet}
|
|
21
|
-
*/
|
|
22
|
-
static get cssStyleSheet() {
|
|
23
|
-
return c;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Sets up the attributes for the component.
|
|
27
|
-
*/
|
|
28
|
-
setupAttributes() {
|
|
29
|
-
this.isShadowRoot = "open";
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Draws the component.
|
|
33
|
-
*
|
|
34
|
-
* @param {Object} context - The context for drawing.
|
|
35
|
-
* @param {Object} store - The store for drawing.
|
|
36
|
-
* @param {Object} params - The parameters for drawing.
|
|
37
|
-
* @returns {DocumentFragment}
|
|
38
|
-
*/
|
|
39
|
-
draw(s, h, m) {
|
|
40
|
-
let i = document.createDocumentFragment(), a = document.createElement("slot");
|
|
41
|
-
return i.appendChild(a), i;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Called after the component has been drawn.
|
|
45
|
-
*/
|
|
46
|
-
afterDraw() {
|
|
47
|
-
this.classList.toggle("wje-lines-" + this.lines, this.hasAttribute("lines")), this.classList.toggle("wje-inset", this.hasAttribute("inset"));
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
r.define("wje-list", r);
|
|
51
|
-
export {
|
|
52
|
-
r as default
|
|
53
|
-
};
|
package/dist/wje-main.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
var i = Object.defineProperty;
|
|
2
|
-
var l = (t, e, s) => e in t ? i(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
|
-
var a = (t, e, s) => (l(t, typeof e != "symbol" ? e + "" : e, s), s);
|
|
4
|
-
import c from "./wje-element.js";
|
|
5
|
-
const d = ":host{display:block;flex:1;flex-basis:auto;padding:1.5rem;box-sizing:border-box}";
|
|
6
|
-
class n extends c {
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of Main.
|
|
9
|
-
*
|
|
10
|
-
* @constructor
|
|
11
|
-
*/
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
a(this, "className", "Main");
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Returns the CSS styles for the component.
|
|
18
|
-
*
|
|
19
|
-
* @static
|
|
20
|
-
* @returns {CSSStyleSheet}
|
|
21
|
-
*/
|
|
22
|
-
static get cssStyleSheet() {
|
|
23
|
-
return d;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Returns the list of attributes to observe for changes.
|
|
27
|
-
*
|
|
28
|
-
* @static
|
|
29
|
-
* @returns {Array<string>}
|
|
30
|
-
*/
|
|
31
|
-
static get observedAttributes() {
|
|
32
|
-
return [];
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Sets up the attributes for the component.
|
|
36
|
-
*/
|
|
37
|
-
setupAttributes() {
|
|
38
|
-
this.isShadowRoot = "open";
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Draws the component.
|
|
42
|
-
*
|
|
43
|
-
* @param {Object} context - The context for drawing.
|
|
44
|
-
* @param {Object} store - The store for drawing.
|
|
45
|
-
* @param {Object} params - The parameters for drawing.
|
|
46
|
-
* @returns {DocumentFragment}
|
|
47
|
-
*/
|
|
48
|
-
draw(s, m, u) {
|
|
49
|
-
let r = document.createDocumentFragment(), o = document.createElement("slot");
|
|
50
|
-
return r.appendChild(o), r;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
n.define("wje-main", n);
|
|
54
|
-
export {
|
|
55
|
-
n as default
|
|
56
|
-
};
|