wj-elements 0.1.128 → 0.1.130
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/README.md +8 -4
- package/dist/assets/tags.json +3252 -22012
- package/dist/dark.css +211 -203
- package/dist/{infinite-scroll.element-DcO1E5Es.js → infinite-scroll.element-BmojLp3Z.js} +54 -44
- package/dist/light.css +511 -496
- package/dist/{list.element-TZXMx1rt.js → list.element-Ce1vIm1O.js} +3 -9
- package/dist/localize.js +4 -4
- package/dist/{popup.element-l8v-dMoK.js → popup.element-4DNn6DjX.js} +44 -53
- package/dist/{router-links-I2vcmVCs.js → router-links-CJnOdbas.js} +30 -77
- package/dist/styles.css +485 -473
- package/dist/wje-accordion-item.js +13 -11
- package/dist/wje-accordion.js +51 -14
- package/dist/wje-animation.js +149 -25
- package/dist/wje-aside.js +7 -12
- package/dist/wje-avatar.js +12 -15
- package/dist/wje-badge.js +24 -19
- package/dist/wje-breadcrumb.js +36 -44
- package/dist/wje-breadcrumbs.js +84 -27
- package/dist/wje-button-group.js +17 -23
- package/dist/wje-button.js +117 -66
- package/dist/wje-card-content.js +10 -13
- package/dist/wje-card-controls.js +10 -13
- package/dist/wje-card-header.js +5 -9
- package/dist/wje-card-subtitle.js +5 -8
- package/dist/wje-card-title.js +5 -8
- package/dist/wje-card.js +13 -14
- package/dist/wje-carousel-item.js +26 -1
- package/dist/wje-carousel.js +141 -24
- package/dist/wje-checkbox.js +300 -51
- package/dist/wje-chip.js +31 -12
- package/dist/wje-col.js +11 -15
- package/dist/wje-color-picker.js +92 -64
- package/dist/wje-container.js +6 -10
- package/dist/wje-copy-button.js +14 -18
- package/dist/wje-dialog.js +89 -5
- package/dist/wje-divider.js +2 -5
- package/dist/wje-dropdown.js +57 -24
- package/dist/wje-element.js +393 -218
- package/dist/wje-fetchAndParseCSS.js +2 -1
- package/dist/wje-file-upload-item.js +12 -19
- package/dist/wje-file-upload.js +117 -68
- package/dist/wje-footer.js +3 -10
- package/dist/wje-form.js +23 -1
- package/dist/wje-format-digital.js +5 -13
- package/dist/wje-grid.js +24 -3
- package/dist/wje-header.js +3 -10
- package/dist/wje-icon-picker.js +15 -31
- package/dist/wje-icon.js +10 -10
- package/dist/wje-img-comparer.js +8 -18
- package/dist/wje-img.js +5 -11
- package/dist/wje-infinite-scroll.js +1 -1
- package/dist/wje-input-file.js +20 -17
- package/dist/wje-input.js +51 -62
- package/dist/wje-item.js +31 -4
- package/dist/wje-kanban.js +37 -53
- package/dist/wje-label.js +4 -21
- package/dist/wje-list.js +1 -1
- package/dist/wje-main.js +4 -11
- package/dist/wje-masonry.js +21 -26
- package/dist/wje-master.js +201 -348
- package/dist/wje-menu-button.js +5 -13
- package/dist/wje-menu-item.js +211 -30
- package/dist/wje-menu-label.js +4 -11
- package/dist/wje-menu.js +6 -15
- package/dist/wje-option.js +19 -26
- package/dist/wje-options.js +148 -48
- package/dist/wje-orgchart-group.js +10 -17
- package/dist/wje-orgchart-item.js +13 -157
- package/dist/wje-orgchart.js +4 -10
- package/dist/wje-popup.js +1 -1
- package/dist/wje-progress-bar.js +17 -27
- package/dist/wje-qr-code.js +29 -13
- package/dist/wje-radio-group.js +21 -43
- package/dist/wje-radio.js +46 -8
- package/dist/wje-rate.js +38 -58
- package/dist/wje-relative-time.js +51 -43
- package/dist/wje-reorder-dropzone.js +20 -2
- package/dist/wje-reorder-handle.js +62 -3
- package/dist/wje-reorder-item.js +20 -2
- package/dist/wje-reorder.js +93 -36
- package/dist/wje-route.js +3 -9
- package/dist/wje-router-link.js +10 -14
- package/dist/wje-router-outlet.js +35 -37
- package/dist/wje-routerx.js +231 -338
- package/dist/wje-row.js +8 -20
- package/dist/wje-select.js +80 -104
- package/dist/wje-slider.js +17 -33
- package/dist/wje-sliding-container.js +127 -55
- package/dist/wje-split-view.js +15 -21
- package/dist/wje-status.js +9 -13
- package/dist/wje-step.js +18 -0
- package/dist/wje-stepper.js +65 -4734
- package/dist/wje-store.js +193 -90
- package/dist/wje-tab-group.js +7 -16
- package/dist/wje-tab-panel.js +4 -13
- package/dist/wje-tab.js +6 -14
- package/dist/wje-textarea.js +128 -42
- package/dist/wje-thumbnail.js +10 -23
- package/dist/wje-toast.js +38 -74
- package/dist/wje-toggle.js +24 -29
- package/dist/wje-toolbar-action.js +11 -15
- package/dist/wje-toolbar.js +11 -16
- package/dist/wje-tooltip.js +35 -23
- package/dist/wje-visually-hidden.js +10 -14
- package/package.json +22 -4
package/dist/wje-toast.js
CHANGED
|
@@ -2,43 +2,40 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import WJElement, { WjElementUtils, event } from "./wje-element.js";
|
|
5
|
-
const styles =
|
|
5
|
+
const styles = "/*\n[ WJ Toast ]\n*/\n\n:host {\n position: relative;\n z-index: 9999;\n width: 300px;\n margin: 0.5rem 0;\n display: none;\n}\n\n:host([open]) {\n display: block;\n}\n\n.native-toast {\n display: flex;\n align-items: center;\n padding: 1rem;\n overflow: hidden;\n margin: 0;\n border-width: 1px;\n border-style: solid;\n border-radius: var(--wje-border-radius-large);\n position: relative;\n\n &.has-media slot[name='media'] {\n flex: 0 0 1.5rem;\n width: 1.5rem;\n display: flex;\n margin-right: 0.5rem;\n justify-content: center;\n }\n\n .content {\n font-size: var(--wje-font-size-small);\n .headline {\n font-size: var(--wje-font-size);\n font-weight: var(--wje-font-weight-bold);\n }\n }\n\n wje-button {\n --wje-button-margin-inline: auto 0;\n margin-left: auto !important;\n }\n\n .countdown {\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n height: 4px;\n .countdown-bar {\n height: 100%;\n }\n }\n}\n\n:host([position='top']) {\n animation: slideDown 0.3s ease-out forwards;\n top: 1rem;\n left: auto;\n right: auto;\n}\n\n:host::part(icon) {\n margin-right: 0.5rem;\n}\n\n@keyframes slideDown {\n 0% {\n transform: translateY(-100%);\n }\n 100% {\n transform: translateY(0);\n }\n}\n\n/*PRIMARY*/\n:host([color='primary']) .native-toast {\n background-color: var(--wje-color-primary-1);\n color: var(--wje-color-primary-9);\n border-color: var(--wje-color-primary-3);\n}\n\n/*COMPLETE*/\n:host([color='complete']) .native-toast {\n background-color: var(--wje-color-complete-1);\n color: var(--wje-color-complete-9);\n border-color: var(--wje-color-complete-3);\n}\n\n/*SUCCESS*/\n:host([color='success']) .native-toast {\n background-color: var(--wje-color-success-1);\n color: var(--wje-color-success-9);\n border-color: var(--wje-color-success-3);\n}\n\n/*WARNING*/\n:host([color='warning']) .native-toast {\n background-color: var(--wje-color-warning-1);\n color: var(--wje-color-warning-11);\n border-color: var(--wje-color-warning-3);\n}\n\n/*DANGER*/\n:host([color='danger']) .native-toast {\n background-color: var(--wje-color-danger-1);\n color: var(--wje-color-danger-9);\n border-color: var(--wje-color-danger-3);\n}\n\n/*INFO*/\n:host([color='info']) .native-toast {\n background-color: var(--wje-color-info-1);\n color: var(--wje-color-info-11);\n border-color: var(--wje-color-info-4);\n}\n\n/*CONTRAST*/\n:host([color='contrast']) .native-toast {\n background-color: var(--wje-color-contrast-2);\n color: var(--wje-color-contrast-9);\n border-color: var(--wje-color-contrast-3);\n}\n\n/*PRIMARY*/\n:host([color='primary']) .countdown-bar {\n background-color: var(--wje-color-primary-9);\n}\n\n/*COMPLETE*/\n:host([color='complete']) .countdown-bar {\n background-color: var(--wje-color-complete-9);\n}\n\n/*SUCCESS*/\n:host([color='success']) .countdown-bar {\n background-color: var(--wje-color-success-9);\n}\n\n/*WARNING*/\n:host([color='warning']) .countdown-bar {\n background-color: var(--wje-color-warning-9);\n}\n\n/*DANGER*/\n:host([color='danger']) .countdown-bar {\n background-color: var(--wje-color-danger-9);\n}\n\n/*INFO*/\n:host([color='info']) .countdown-bar {\n background-color: var(--wje-color-info-9);\n}\n\n/*CONTRAST*/\n:host([color='contrast']) .countdown-bar {\n background-color: var(--wje-color-contrast-9);\n}\n";
|
|
6
6
|
class Toast extends WJElement {
|
|
7
7
|
/**
|
|
8
|
-
* Toast
|
|
9
|
-
* @constructor
|
|
8
|
+
* Creates an instance of Toast.
|
|
10
9
|
*/
|
|
11
10
|
constructor() {
|
|
12
11
|
super();
|
|
13
12
|
/**
|
|
14
|
-
*
|
|
13
|
+
* The class name for the component.
|
|
15
14
|
* @type {string}
|
|
16
15
|
*/
|
|
17
16
|
__publicField(this, "className", "Toast");
|
|
18
17
|
/**
|
|
19
18
|
* Asynchronously shows the toast notification.
|
|
20
|
-
*
|
|
21
19
|
* This method sets the `open` property to `true` and dispatches the
|
|
22
20
|
* `wje-toast:after-show` custom event. If the toast is already open,
|
|
23
21
|
* the method returns `undefined`.
|
|
24
22
|
*/
|
|
25
23
|
__publicField(this, "show", () => {
|
|
26
24
|
if (this.open) {
|
|
27
|
-
return
|
|
25
|
+
return;
|
|
28
26
|
}
|
|
29
27
|
this.open = true;
|
|
30
28
|
event.dispatchCustomEvent(this, "wje-toast:after-show");
|
|
31
29
|
});
|
|
32
30
|
/**
|
|
33
31
|
* Asynchronously hides the toast notification.
|
|
34
|
-
*
|
|
35
32
|
* This method sets the `open` property to `false` and dispatches the
|
|
36
33
|
* `wje-toast:after-hide` custom event. If the toast is already hidden,
|
|
37
34
|
* the method returns `undefined`.
|
|
38
35
|
*/
|
|
39
36
|
__publicField(this, "hide", () => {
|
|
40
37
|
if (!this.open) {
|
|
41
|
-
return
|
|
38
|
+
return;
|
|
42
39
|
}
|
|
43
40
|
this.open = false;
|
|
44
41
|
event.dispatchCustomEvent(this, "wje-toast:after-hide");
|
|
@@ -46,7 +43,7 @@ class Toast extends WJElement {
|
|
|
46
43
|
/**
|
|
47
44
|
* Pauses the countdown animation and stops the timer.
|
|
48
45
|
*/
|
|
49
|
-
__publicField(this, "pause",
|
|
46
|
+
__publicField(this, "pause", () => {
|
|
50
47
|
var _a;
|
|
51
48
|
(_a = this.countdownAnimation) == null ? void 0 : _a.pause();
|
|
52
49
|
this.stopTimer();
|
|
@@ -54,18 +51,16 @@ class Toast extends WJElement {
|
|
|
54
51
|
/**
|
|
55
52
|
* Resumes the countdown animation and resumes the timer.
|
|
56
53
|
*/
|
|
57
|
-
__publicField(this, "resume",
|
|
54
|
+
__publicField(this, "resume", () => {
|
|
58
55
|
var _a;
|
|
59
56
|
(_a = this.countdownAnimation) == null ? void 0 : _a.play();
|
|
60
57
|
this.resumeTimer();
|
|
61
58
|
});
|
|
62
59
|
/**
|
|
63
60
|
* Asynchronously starts the toast notification.
|
|
64
|
-
*
|
|
65
61
|
* This method appends the toast notification to the document body and
|
|
66
62
|
* shows the toast notification. The method returns a promise that
|
|
67
63
|
* resolves when the toast notification is shown.
|
|
68
|
-
*
|
|
69
64
|
* @returns {Promise<unknown>}
|
|
70
65
|
*/
|
|
71
66
|
__publicField(this, "start", () => {
|
|
@@ -85,145 +80,123 @@ class Toast extends WJElement {
|
|
|
85
80
|
this.toastStack = Object.assign(document.createElement("div"), { className: "wje-toast-stack" });
|
|
86
81
|
}
|
|
87
82
|
/**
|
|
88
|
-
* Set headline
|
|
83
|
+
* Set headline value of the toast.
|
|
89
84
|
* @param value
|
|
90
85
|
*/
|
|
91
86
|
set headline(value) {
|
|
92
87
|
this.setAttribute("headline", value);
|
|
93
88
|
}
|
|
94
89
|
/**
|
|
95
|
-
* Get headline
|
|
90
|
+
* Get headline value of the toast.
|
|
96
91
|
* @returns {string}
|
|
97
92
|
*/
|
|
98
93
|
get headline() {
|
|
99
94
|
return this.getAttribute("headline");
|
|
100
95
|
}
|
|
101
96
|
/**
|
|
102
|
-
* Set open
|
|
97
|
+
* Set open value of the toast.
|
|
103
98
|
* @param value
|
|
104
99
|
*/
|
|
105
100
|
set open(value) {
|
|
106
|
-
this.
|
|
101
|
+
this.removeAttribute("open");
|
|
102
|
+
if (WjElementUtils.stringToBoolean(value)) this.setAttribute("open", value);
|
|
107
103
|
}
|
|
108
104
|
/**
|
|
109
|
-
* Get open
|
|
110
|
-
* @returns {
|
|
105
|
+
* Get open value of the toast.
|
|
106
|
+
* @returns {boolean}
|
|
111
107
|
*/
|
|
112
108
|
get open() {
|
|
113
|
-
return this.
|
|
109
|
+
return this.hasAttribute("open");
|
|
114
110
|
}
|
|
115
111
|
/**
|
|
116
|
-
* Set duration
|
|
112
|
+
* Set duration value of the toast.
|
|
117
113
|
* @param value
|
|
118
114
|
*/
|
|
119
115
|
set duration(value) {
|
|
120
116
|
this.setAttribute("duration", value);
|
|
121
117
|
}
|
|
122
118
|
/**
|
|
123
|
-
* Get duration
|
|
119
|
+
* Get duration value of the toast.
|
|
124
120
|
* @returns {number}
|
|
125
121
|
*/
|
|
126
122
|
get duration() {
|
|
127
123
|
return +this.getAttribute("duration");
|
|
128
124
|
}
|
|
129
125
|
/**
|
|
130
|
-
* Set closable
|
|
126
|
+
* Set closable value of the toast.
|
|
131
127
|
* @param value
|
|
132
128
|
*/
|
|
133
129
|
set closable(value) {
|
|
134
|
-
|
|
135
|
-
this.setAttribute("closable", value);
|
|
130
|
+
this.setAttribute("closable", value || "");
|
|
136
131
|
}
|
|
137
132
|
/**
|
|
138
|
-
* Get closable
|
|
139
|
-
* @returns {
|
|
133
|
+
* Get closable value of the toast.
|
|
134
|
+
* @returns {boolean}
|
|
140
135
|
*/
|
|
141
136
|
get closable() {
|
|
142
|
-
return this.
|
|
137
|
+
return this.hasAttribute("closable");
|
|
143
138
|
}
|
|
144
139
|
/**
|
|
145
|
-
* Set color
|
|
140
|
+
* Set color value of the toast.
|
|
146
141
|
* @param value
|
|
147
142
|
*/
|
|
148
143
|
set color(value) {
|
|
149
144
|
this.setAttribute("color", value);
|
|
150
145
|
}
|
|
151
146
|
/**
|
|
152
|
-
* Get color
|
|
147
|
+
* Get color value of the toast.
|
|
153
148
|
* @returns {string}
|
|
154
149
|
*/
|
|
155
150
|
get color() {
|
|
156
151
|
return this.getAttribute("color");
|
|
157
152
|
}
|
|
158
153
|
/**
|
|
159
|
-
* Set countdown
|
|
154
|
+
* Set countdown value of the toast.
|
|
160
155
|
* @param value
|
|
161
156
|
*/
|
|
162
157
|
set countdown(value) {
|
|
163
|
-
if (value)
|
|
164
|
-
this.setAttribute("countdown", value);
|
|
158
|
+
if (value) this.setAttribute("countdown", value);
|
|
165
159
|
}
|
|
166
160
|
/**
|
|
167
|
-
* Get countdown
|
|
161
|
+
* Get countdown value of the toast.
|
|
168
162
|
* @returns {boolean}
|
|
169
163
|
*/
|
|
170
164
|
get countdown() {
|
|
171
165
|
return this.hasAttribute("countdown");
|
|
172
166
|
}
|
|
173
167
|
/**
|
|
174
|
-
* Set icon
|
|
168
|
+
* Set icon value of the toast.
|
|
175
169
|
* @param value
|
|
176
170
|
*/
|
|
177
171
|
set icon(value) {
|
|
178
172
|
this.setAttribute("icon", value);
|
|
179
173
|
}
|
|
180
174
|
/**
|
|
181
|
-
* Get icon
|
|
175
|
+
* Get icon value of the toast.
|
|
182
176
|
* @returns {string}
|
|
183
177
|
*/
|
|
184
178
|
get icon() {
|
|
185
179
|
return this.getAttribute("icon");
|
|
186
180
|
}
|
|
187
181
|
/**
|
|
188
|
-
*
|
|
182
|
+
* Returns the CSS stylesheet for the component.
|
|
189
183
|
* @static
|
|
190
|
-
* @returns {
|
|
184
|
+
* @returns {CSSStyleSheet} The CSS stylesheet
|
|
191
185
|
*/
|
|
192
186
|
static get cssStyleSheet() {
|
|
193
187
|
return styles;
|
|
194
188
|
}
|
|
195
189
|
/**
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
* @static
|
|
199
|
-
* @returns {Array<string>}
|
|
200
|
-
*/
|
|
201
|
-
// static get observedAttributes() {
|
|
202
|
-
// return ["open", "color", "duration"];
|
|
203
|
-
// }
|
|
204
|
-
/**
|
|
205
|
-
* Called when an attribute changes.
|
|
206
|
-
*
|
|
207
|
-
* @param {string} name - The name of the attribute.
|
|
208
|
-
* @param {string} old - The old value of the attribute.
|
|
209
|
-
* @param {string} newName - The new value of the attribute.
|
|
210
|
-
*/
|
|
211
|
-
attributeChangedCallback(name, old, newName) {
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Setup attributes
|
|
190
|
+
* Setup attributes for the Button element.
|
|
215
191
|
*/
|
|
216
192
|
setupAttributes() {
|
|
217
193
|
this.isShadowRoot = "open";
|
|
218
194
|
}
|
|
219
195
|
/**
|
|
220
|
-
* Draw method
|
|
221
|
-
* @
|
|
222
|
-
* @param {Object} store - The store
|
|
223
|
-
* @param {Object} params - The parameters
|
|
224
|
-
* @returns {Object} Document fragment
|
|
196
|
+
* Draw method for the toast notification.
|
|
197
|
+
* @returns {object} Document fragment
|
|
225
198
|
*/
|
|
226
|
-
draw(
|
|
199
|
+
draw() {
|
|
227
200
|
let fragment = document.createDocumentFragment();
|
|
228
201
|
let native = document.createElement("div");
|
|
229
202
|
native.setAttribute("part", "native");
|
|
@@ -264,20 +237,15 @@ class Toast extends WJElement {
|
|
|
264
237
|
}
|
|
265
238
|
native.appendChild(mediaSlot);
|
|
266
239
|
native.appendChild(content);
|
|
267
|
-
if (this.
|
|
268
|
-
|
|
269
|
-
if (this.hasAttribute("countdown"))
|
|
270
|
-
native.appendChild(countdownEl);
|
|
240
|
+
if (this.closable) native.appendChild(closeBtn);
|
|
241
|
+
if (this.hasAttribute("countdown")) native.appendChild(countdownEl);
|
|
271
242
|
fragment.appendChild(native);
|
|
272
243
|
this.closeBtn = closeBtn;
|
|
273
244
|
this.countdownBar = countdownBar;
|
|
274
245
|
return fragment;
|
|
275
246
|
}
|
|
276
247
|
/**
|
|
277
|
-
* After draw method
|
|
278
|
-
* @param {Object} context - The context
|
|
279
|
-
* @param {Object} store - The store
|
|
280
|
-
* @param {Object} params - The parameters
|
|
248
|
+
* After draw method for the toast notification.
|
|
281
249
|
*/
|
|
282
250
|
afterDraw() {
|
|
283
251
|
this.closeBtn.addEventListener("wje-button:click", this.hide);
|
|
@@ -298,7 +266,6 @@ class Toast extends WJElement {
|
|
|
298
266
|
}
|
|
299
267
|
/**
|
|
300
268
|
* Before disconnect method
|
|
301
|
-
*
|
|
302
269
|
* This method is called before the element is disconnected from the document.
|
|
303
270
|
*/
|
|
304
271
|
beforeDisconnect() {
|
|
@@ -310,7 +277,6 @@ class Toast extends WJElement {
|
|
|
310
277
|
}
|
|
311
278
|
/**
|
|
312
279
|
* Starts the timer.
|
|
313
|
-
*
|
|
314
280
|
* This method sets the `startTime` property to the current time and sets
|
|
315
281
|
* the `timeoutID` property to the ID of the timeout. The method also
|
|
316
282
|
* dispatches the `wje-toast:after-hide` custom event when the timeout
|
|
@@ -327,7 +293,6 @@ class Toast extends WJElement {
|
|
|
327
293
|
}
|
|
328
294
|
/**
|
|
329
295
|
* Stops the timer.
|
|
330
|
-
*
|
|
331
296
|
* This method clears the timeout and calculates the remaining time.
|
|
332
297
|
* The method is called when the toast notification is paused.
|
|
333
298
|
*/
|
|
@@ -340,7 +305,6 @@ class Toast extends WJElement {
|
|
|
340
305
|
}
|
|
341
306
|
/**
|
|
342
307
|
* Resumes the timer.
|
|
343
|
-
*
|
|
344
308
|
* This method resumes the timer if the remaining time is greater
|
|
345
309
|
* than zero. The method is called when the toast notification is resumed.
|
|
346
310
|
*/
|
package/dist/wje-toggle.js
CHANGED
|
@@ -2,79 +2,72 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import WJElement, { event } from "./wje-element.js";
|
|
5
|
-
const styles =
|
|
5
|
+
const styles = "/*\n[ WJ Toggle ]\n*/\n\n:host {\n --wje-toggle-color-base: var(--wje-color-contrast-3);\n --wje-toggle-width: 30px;\n --wje-toggle-height: 18px;\n --wje-toggle-border-radius: 50px;\n --wje-toggle-handle-width: 13px;\n --wje-toggle-handle-height: 13px;\n --wje-toggle-handle-border-radius: 9px;\n --wje-toggle-handle-color: #fff;\n --wje-toggle-handle-shadow: 1px 0 1px 0.5px rgba(0, 0, 0, 0.12), 2px 4px 6px rgba(0, 0, 0, 0.2);\n --wje-toggle-handle-shadow-checked: 1px 1px 0 rgba(0, 0, 0, 0.08), -3px 3px 6px rgba(0, 0, 0, 0.3);\n --wje-toggle-duration: 250ms;\n --wje-toggle-curve: cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n:host([color='primary']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-primary-9) !important;\n}\n\n:host([color='complete']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-complete-9);\n}\n\n:host([color='success']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-success-9) !important;\n}\n\n:host([color='warning']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-warning-9);\n}\n\n:host([color='danger']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-danger-9);\n}\n\n:host([color='info']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-info-9);\n}\n\n.native-toggle {\n display: flex;\n}\n\nlabel {\n display: flex;\n cursor: pointer;\n align-items: center;\n user-select: none;\n .label-wrapper {\n width: var(--wje-toggle-width) !important;\n min-width: var(--wje-toggle-width);\n height: var(--wje-toggle-height);\n position: relative;\n display: flex;\n align-items: center;\n &:before {\n content: '';\n position: absolute;\n cursor: pointer;\n width: 100%;\n height: 100%;\n top: auto;\n left: 0;\n background: var(--wje-toggle-color-base);\n background-size: 300%;\n background-position: right;\n border-radius: var(--wje-toggle-border-radius);\n border: none;\n box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);\n transition:\n background calc(var(--wje-toggle-duration) + (var(--wje-toggle-duration) * 0.24)),\n box-shadow var(--wje-toggle-duration);\n transition-timing-function: var(--wje-toggle-curve);\n }\n &:after {\n content: '';\n position: absolute;\n transform: translateX(0%);\n background: var(--wje-toggle-handle-color);\n width: var(--wje-toggle-handle-width);\n height: var(--wje-toggle-handle-height);\n border-radius: var(--wje-toggle-handle-border-radius);\n top: auto;\n left: 2px;\n box-shadow: var(--wje-toggle-handle-shadow);\n transition: transform, box-shadow;\n transition-duration: var(--wje-toggle-duration);\n transition-timing-function: var(--wje-toggle-curve);\n }\n }\n}\ninput[type='checkbox'][disabled] {\n & + label {\n cursor: not-allowed !important;\n color: var(--wje-color-contrast-9);\n opacity: 0.58;\n\n &:before {\n cursor: not-allowed !important;\n }\n }\n}\n\ninput[type='checkbox'] {\n position: absolute;\n z-index: -1;\n opacity: 0;\n &:checked {\n & + label {\n .label-wrapper:before {\n background-position: left;\n box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);\n }\n .label-wrapper:after {\n transform: translateX(calc(var(--wje-toggle-width) - var(--wje-toggle-handle-width) - 4px));\n box-shadow: var(--wje-toggle-handle-shadow-checked);\n }\n }\n }\n &:focus {\n & + label {\n .label-wrapper:before {\n outline: none !important;\n box-shadow:\n inset 0 0 0 1px rgba(0, 0, 0, 0.12),\n 0 0 0 0 #78c8fe;\n }\n }\n }\n &[disabled]:active {\n & + label {\n .label-wrapper:after {\n transform: scaleX(1.1);\n transform-origin: center left;\n transition: transform step-start;\n }\n }\n }\n &:checked {\n &[disabled]:active {\n & + label {\n .label-wrapper:after {\n transform: translateX(calc(100% - 6px)) scaleX(1.1);\n transform-origin: center right;\n }\n }\n }\n }\n &:hover {\n &:active {\n & + label {\n .label-wrapper:before {\n background-color: transparent;\n }\n }\n }\n }\n}\n\n:host .text {\n margin-inline: 0.5rem 0;\n}\n\n/*Placememt*/\n:host([placement='end']) {\n label {\n width: 100%;\n }\n .text {\n margin-inline: 0 0.5rem;\n width: 100%;\n }\n}\n\nslot {\n display: flex;\n align-items: center;\n width: 100%;\n}\n";
|
|
6
6
|
class Toggle extends WJElement {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* @summary Toggle constructor
|
|
8
|
+
* Creates an instance of Toggle.
|
|
10
9
|
*/
|
|
11
10
|
constructor() {
|
|
12
11
|
super();
|
|
13
12
|
/**
|
|
14
|
-
*
|
|
13
|
+
* Set color attribute for the toggle element.
|
|
15
14
|
* @type {string}
|
|
16
15
|
*/
|
|
17
16
|
__publicField(this, "className", "Toggle");
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @returns {boolean} true if the toggle is checked, false otherwise
|
|
19
|
+
* Set checked attribute for the toggle element.
|
|
22
20
|
*/
|
|
23
21
|
set disabled(value) {
|
|
24
|
-
if (value)
|
|
25
|
-
|
|
26
|
-
else
|
|
27
|
-
this.removeAttribute("disabled");
|
|
22
|
+
if (value) this.setAttribute("disabled", "");
|
|
23
|
+
else this.removeAttribute("disabled");
|
|
28
24
|
}
|
|
29
25
|
/**
|
|
30
|
-
*
|
|
26
|
+
* Get checked attribute for the toggle element.
|
|
31
27
|
* @returns {boolean} true if the toggle is disabled, false otherwise
|
|
32
28
|
*/
|
|
33
29
|
get disabled() {
|
|
34
30
|
return this.hasAttribute("disabled");
|
|
35
31
|
}
|
|
36
32
|
/**
|
|
37
|
-
*
|
|
38
|
-
* @returns {boolean} true if the toggle is checked, false otherwise
|
|
33
|
+
* Set checked attribute for the toggle element.
|
|
39
34
|
*/
|
|
40
35
|
set checked(value) {
|
|
41
|
-
if (value)
|
|
42
|
-
|
|
43
|
-
else
|
|
44
|
-
this.removeAttribute("checked");
|
|
36
|
+
if (value) this.setAttribute("checked", "");
|
|
37
|
+
else this.removeAttribute("checked");
|
|
45
38
|
}
|
|
46
39
|
/**
|
|
47
|
-
*
|
|
40
|
+
* Get checked attribute for the toggle element.
|
|
48
41
|
* @returns {boolean} true if the toggle is checked, false otherwise
|
|
49
42
|
*/
|
|
50
43
|
get checked() {
|
|
51
44
|
return this.hasAttribute("checked");
|
|
52
45
|
}
|
|
53
46
|
/**
|
|
54
|
-
*
|
|
47
|
+
* Get CSS stylesheet for the Button element.
|
|
55
48
|
* @static
|
|
56
|
-
* @returns {
|
|
49
|
+
* @returns {CSSStyleSheet} styles - The CSS stylesheet for the Button element.
|
|
57
50
|
*/
|
|
58
51
|
static get cssStyleSheet() {
|
|
59
52
|
return styles;
|
|
60
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Get observed attributes for the toggle element.
|
|
56
|
+
* @returns {string[]}
|
|
57
|
+
*/
|
|
61
58
|
static get observedAttributes() {
|
|
62
59
|
return ["checked", "disabled"];
|
|
63
60
|
}
|
|
64
61
|
/**
|
|
65
|
-
*
|
|
62
|
+
* Set up the attributes for the toggle element.
|
|
66
63
|
*/
|
|
67
64
|
setupAttributes() {
|
|
68
65
|
this.isShadowRoot = "open";
|
|
69
66
|
}
|
|
70
67
|
/**
|
|
71
|
-
*
|
|
72
|
-
* @param {Object} context - The context
|
|
73
|
-
* @param {Object} store - The store
|
|
74
|
-
* @param {Object} params - The parameters
|
|
75
|
-
* @returns {Object} Document fragment
|
|
68
|
+
* Draw the toggle element for the component.
|
|
76
69
|
*/
|
|
77
|
-
draw(
|
|
70
|
+
draw() {
|
|
78
71
|
let fragment = document.createDocumentFragment();
|
|
79
72
|
let element = document.createElement("div");
|
|
80
73
|
element.setAttribute("part", "native");
|
|
@@ -94,8 +87,7 @@ class Toggle extends WJElement {
|
|
|
94
87
|
let text = document.createElement("div");
|
|
95
88
|
text.classList.add("text");
|
|
96
89
|
text.innerHTML = "<slot></slot>";
|
|
97
|
-
if (this.color)
|
|
98
|
-
this.classList.add("wje-color-" + this.color, "wje-color");
|
|
90
|
+
if (this.color) this.classList.add("wje-color-" + this.color, "wje-color");
|
|
99
91
|
element.appendChild(input);
|
|
100
92
|
element.appendChild(label);
|
|
101
93
|
if (this.placement === "end") {
|
|
@@ -110,6 +102,9 @@ class Toggle extends WJElement {
|
|
|
110
102
|
this.input = input;
|
|
111
103
|
return fragment;
|
|
112
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* After draw method for the toggle element to add event listeners for the input element after the element is drawn.
|
|
107
|
+
*/
|
|
113
108
|
afterDraw() {
|
|
114
109
|
if (!this.disabled) {
|
|
115
110
|
this.input.addEventListener("input", (e) => {
|
|
@@ -2,30 +2,29 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import WJElement from "./wje-element.js";
|
|
5
|
-
const styles = "/*\n[ WJ Toolbar Action ]\n*/\n\n:host {\n
|
|
5
|
+
const styles = "/*\n[ WJ Toolbar Action ]\n*/\n\n:host {\n .native-toolbar-action {\n display: flex;\n }\n}\n";
|
|
6
6
|
class ToolbarAction extends WJElement {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* @summary ToolbarAction constructor
|
|
8
|
+
* Creates an instance of ToolbarAction.
|
|
10
9
|
*/
|
|
11
10
|
constructor() {
|
|
12
11
|
super();
|
|
13
12
|
/**
|
|
14
|
-
*
|
|
13
|
+
* The class name for the component.
|
|
15
14
|
* @type {string}
|
|
16
15
|
*/
|
|
17
16
|
__publicField(this, "className", "ToolbarAction");
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
|
-
*
|
|
19
|
+
* Returns the CSS stylesheet for the component.
|
|
21
20
|
* @static
|
|
22
|
-
* @returns {
|
|
21
|
+
* @returns {CSSStyleSheet} The CSS stylesheet
|
|
23
22
|
*/
|
|
24
23
|
static get cssStyleSheet() {
|
|
25
24
|
return styles;
|
|
26
25
|
}
|
|
27
26
|
/**
|
|
28
|
-
*
|
|
27
|
+
* Returns the list of observed attributes.
|
|
29
28
|
* @static
|
|
30
29
|
* @returns {Array} An empty array
|
|
31
30
|
*/
|
|
@@ -33,19 +32,16 @@ class ToolbarAction extends WJElement {
|
|
|
33
32
|
return [];
|
|
34
33
|
}
|
|
35
34
|
/**
|
|
36
|
-
*
|
|
35
|
+
* Sets up the attributes for the component.
|
|
37
36
|
*/
|
|
38
37
|
setupAttributes() {
|
|
39
38
|
this.isShadowRoot = "open";
|
|
40
39
|
}
|
|
41
40
|
/**
|
|
42
|
-
*
|
|
43
|
-
* @
|
|
44
|
-
* @param {Object} store - The store
|
|
45
|
-
* @param {Object} params - The parameters
|
|
46
|
-
* @returns {Object} Document fragment
|
|
41
|
+
* Draws the component for the toolbar action.
|
|
42
|
+
* @returns {object} Document fragment
|
|
47
43
|
*/
|
|
48
|
-
draw(
|
|
44
|
+
draw() {
|
|
49
45
|
let fragment = document.createDocumentFragment();
|
|
50
46
|
let maxItems = +this.maxItems || 0;
|
|
51
47
|
let actions = this.getActions();
|
|
@@ -62,7 +58,7 @@ class ToolbarAction extends WJElement {
|
|
|
62
58
|
return fragment;
|
|
63
59
|
}
|
|
64
60
|
/**
|
|
65
|
-
*
|
|
61
|
+
* Returns the actions for the toolbar action.
|
|
66
62
|
* @returns {Array} An array of wje-button elements
|
|
67
63
|
*/
|
|
68
64
|
getActions() {
|
package/dist/wje-toolbar.js
CHANGED
|
@@ -2,31 +2,29 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import WJElement from "./wje-element.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Toolbar extends withRouterLinks(WJElement) {
|
|
5
|
+
const styles = "/*\n[ WJ Toolbar ]\n*/\n\n:host {\n --wje-toolbar-background: var(--wje-background);\n --wje-toolbar-height: auto;\n --wje-toolbar-min-height: 70px;\n --wje-toolbar-padding-top: 1rem;\n --wje-toolbar-padding-bottom: 1rem;\n --wje-toolbar-padding-inline: 1.5rem;\n --wje-toolbar-border-color: var(--wje-border-color);\n --wje-toolbar-top: 0;\n width: 100%;\n height: var(--wje-toolbar-height);\n}\n\n.native-toolbar {\n background-color: var(--wje-toolbar-background);\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n justify-content: flex-start;\n border-bottom: 1px solid var(--wje-toolbar-border-color);\n padding-inline: var(--wje-toolbar-padding-inline);\n padding-top: var(--wje-toolbar-padding-top);\n padding-bottom: var(--wje-toolbar-padding-bottom);\n box-shadow: 0 10px 30px 0 rgba(82, 63, 105, 0.05);\n}\n\n::slotted {\n grid-column: span 4;\n}\n\n::slotted([slot='start']) {\n margin-right: auto;\n}\n\n:host([sticky]) {\n position: sticky;\n top: var(--wje-toolbar-top);\n z-index: 99;\n}\n";
|
|
6
|
+
class Toolbar extends WJElement {
|
|
8
7
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @summary Toolbar constructor
|
|
8
|
+
* Creates an instance of Toolbar.
|
|
11
9
|
*/
|
|
12
10
|
constructor() {
|
|
13
11
|
super();
|
|
14
12
|
/**
|
|
15
|
-
*
|
|
13
|
+
* The class name for the component.
|
|
16
14
|
* @type {string}
|
|
17
15
|
*/
|
|
18
16
|
__publicField(this, "className", "Toolbar");
|
|
19
17
|
}
|
|
20
18
|
/**
|
|
21
|
-
*
|
|
19
|
+
* Returns the CSS stylesheet for the component.
|
|
22
20
|
* @static
|
|
23
|
-
* @returns {
|
|
21
|
+
* @returns {CSSStyleSheet} The CSS stylesheet
|
|
24
22
|
*/
|
|
25
23
|
static get cssStyleSheet() {
|
|
26
24
|
return styles;
|
|
27
25
|
}
|
|
28
26
|
/**
|
|
29
|
-
*
|
|
27
|
+
* Returns the list of observed attributes.
|
|
30
28
|
* @static
|
|
31
29
|
* @returns {Array} An empty array
|
|
32
30
|
*/
|
|
@@ -34,19 +32,16 @@ class Toolbar extends withRouterLinks(WJElement) {
|
|
|
34
32
|
return [];
|
|
35
33
|
}
|
|
36
34
|
/**
|
|
37
|
-
*
|
|
35
|
+
* Sets up the attributes for the component.
|
|
38
36
|
*/
|
|
39
37
|
setupAttributes() {
|
|
40
38
|
this.isShadowRoot = "open";
|
|
41
39
|
}
|
|
42
40
|
/**
|
|
43
|
-
*
|
|
44
|
-
* @
|
|
45
|
-
* @param {Object} store - The store
|
|
46
|
-
* @param {Object} params - The parameters
|
|
47
|
-
* @returns {Object} Document fragment
|
|
41
|
+
* Draws the component for the toolbar.
|
|
42
|
+
* @returns {object} Document fragment
|
|
48
43
|
*/
|
|
49
|
-
draw(
|
|
44
|
+
draw() {
|
|
50
45
|
let fragment = document.createDocumentFragment();
|
|
51
46
|
let native = document.createElement("div");
|
|
52
47
|
native.setAttribute("part", "native");
|