@watermarkinsights/ripple 3.8.0 → 3.8.2
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/cjs/{global-0eb4b183.js → global-cf9485c4.js} +6 -11
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/priv-datepicker.cjs.entry.js +96 -111
- package/dist/cjs/ripple.cjs.js +2 -2
- package/dist/cjs/wm-chart.cjs.entry.js +7 -10
- package/dist/cjs/wm-datepicker.cjs.entry.js +1 -7
- package/dist/cjs/wm-navigation_3.cjs.entry.js +6 -2
- package/dist/cjs/wm-network-uploader.cjs.entry.js +1 -1
- package/dist/cjs/wm-option_2.cjs.entry.js +12 -22
- package/dist/cjs/wm-snackbar.cjs.entry.js +2 -2
- package/dist/cjs/wm-uploader.cjs.entry.js +1 -1
- package/dist/collection/components/wm-chart/wm-chart.js +7 -10
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +96 -111
- package/dist/collection/components/wm-datepicker/wm-datepicker.js +1 -13
- package/dist/collection/components/wm-navigation/wm-navigation-hamburger.css +5 -5
- package/dist/collection/components/wm-navigation/wm-navigation-item.js +18 -2
- package/dist/collection/components/wm-navigation/wm-navigation.js +9 -0
- package/dist/collection/components/wm-option/wm-option.js +9 -17
- package/dist/collection/components/wm-select/wm-select.js +3 -5
- package/dist/collection/components/wm-snackbar/wm-snackbar.js +2 -2
- package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +1 -1
- package/dist/collection/components/wm-uploader/wm-uploader.js +1 -1
- package/dist/collection/global/global.js +5 -10
- package/dist/esm/{global-01afc908.js → global-d1d68bab.js} +6 -11
- package/dist/esm/loader.js +2 -2
- package/dist/esm/priv-datepicker.entry.js +96 -111
- package/dist/esm/ripple.js +2 -2
- package/dist/esm/wm-chart.entry.js +7 -10
- package/dist/esm/wm-datepicker.entry.js +1 -7
- package/dist/esm/wm-navigation_3.entry.js +6 -2
- package/dist/esm/wm-network-uploader.entry.js +1 -1
- package/dist/esm/wm-option_2.entry.js +12 -22
- package/dist/esm/wm-snackbar.entry.js +2 -2
- package/dist/esm/wm-uploader.entry.js +1 -1
- package/dist/esm-es5/global-d1d68bab.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/priv-datepicker.entry.js +1 -1
- package/dist/esm-es5/ripple.js +1 -1
- package/dist/esm-es5/wm-chart.entry.js +1 -1
- package/dist/esm-es5/wm-datepicker.entry.js +1 -1
- package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
- package/dist/esm-es5/wm-network-uploader.entry.js +1 -1
- package/dist/esm-es5/wm-option_2.entry.js +1 -1
- package/dist/esm-es5/wm-snackbar.entry.js +1 -1
- package/dist/esm-es5/wm-uploader.entry.js +1 -1
- package/dist/ripple/p-0a916c6e.entry.js +1 -0
- package/dist/ripple/p-11a9ce3f.system.js +1 -0
- package/dist/ripple/{p-a605a78b.system.entry.js → p-268622b5.system.entry.js} +1 -1
- package/dist/ripple/p-29d3ca15.system.entry.js +1 -0
- package/dist/ripple/p-2a27dba5.entry.js +1 -0
- package/dist/ripple/p-2b209cf3.js +1 -0
- package/dist/ripple/p-4de0799d.entry.js +1 -0
- package/dist/ripple/p-69735b23.system.entry.js +1 -0
- package/dist/ripple/p-81c023a7.entry.js +1 -0
- package/dist/ripple/p-991abdb9.system.entry.js +1 -0
- package/dist/ripple/p-b53962af.entry.js +1 -0
- package/dist/ripple/{p-5bc67a90.system.entry.js → p-b53cecad.system.entry.js} +1 -1
- package/dist/ripple/{p-142d292c.system.entry.js → p-bdbc14ee.system.entry.js} +1 -1
- package/dist/ripple/p-c58520e4.entry.js +1 -0
- package/dist/ripple/p-c7660ed9.entry.js +1 -0
- package/dist/ripple/p-e597d7bb.system.entry.js +1 -0
- package/dist/ripple/p-e6bcfdd5.entry.js +1 -0
- package/dist/ripple/p-e8761ba1.system.js +1 -0
- package/dist/ripple/{p-c043d040.system.entry.js → p-fc254870.system.entry.js} +1 -1
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +1 -1
- package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +12 -12
- package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +0 -1
- package/dist/types/components/wm-navigation/wm-navigation-item.d.ts +2 -0
- package/dist/types/components/wm-navigation/wm-navigation.d.ts +1 -0
- package/dist/types/components.d.ts +1 -0
- package/package.json +1 -1
- package/dist/esm-es5/global-01afc908.js +0 -1
- package/dist/ripple/p-0019a53b.entry.js +0 -1
- package/dist/ripple/p-1aea9937.system.entry.js +0 -1
- package/dist/ripple/p-2041fb68.entry.js +0 -1
- package/dist/ripple/p-44342459.system.entry.js +0 -1
- package/dist/ripple/p-453dcff5.system.js +0 -1
- package/dist/ripple/p-71a400fd.entry.js +0 -1
- package/dist/ripple/p-8af7c223.entry.js +0 -1
- package/dist/ripple/p-9de1bcc5.system.entry.js +0 -1
- package/dist/ripple/p-adde97b9.entry.js +0 -1
- package/dist/ripple/p-bb796d63.system.js +0 -1
- package/dist/ripple/p-bd449bb6.entry.js +0 -1
- package/dist/ripple/p-bdd8caf1.entry.js +0 -1
- package/dist/ripple/p-d59b3b74.js +0 -1
- package/dist/ripple/p-dd6b9aee.entry.js +0 -1
- package/dist/ripple/p-f6b0fd8d.system.entry.js +0 -1
|
@@ -59,6 +59,9 @@ let Navigation = class {
|
|
|
59
59
|
handleHamburgerClicked() {
|
|
60
60
|
this.open = !this.open;
|
|
61
61
|
}
|
|
62
|
+
handleClickOnItem() {
|
|
63
|
+
this.open = false;
|
|
64
|
+
}
|
|
62
65
|
handleStateChange() {
|
|
63
66
|
if (this.isCollapsible) {
|
|
64
67
|
this.wmNavigationStateChanged.emit();
|
|
@@ -124,7 +127,7 @@ let Navigation = class {
|
|
|
124
127
|
};
|
|
125
128
|
Navigation.style = wmNavigationCss;
|
|
126
129
|
|
|
127
|
-
const wmNavigationHamburgerCss = "
|
|
130
|
+
const wmNavigationHamburgerCss = "button{display:none;width:100%;height:100%;border:none;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1);transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1);background-color:transparent;outline:none;padding:0}button.user-is-tabbing:focus{-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e}button.user-is-tabbing:focus::-moz-focus-inner{border:0}button:hover{background-color:#d7d6d9}.icon:before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f35c\";font-size:1.5rem;color:#575195}@media screen and (max-width: 1023px){:host{width:3.75rem;height:3.75rem}button{display:initial}}";
|
|
128
131
|
|
|
129
132
|
let NavigationHamburger = class {
|
|
130
133
|
constructor(hostRef) {
|
|
@@ -209,6 +212,7 @@ const wmNavigationItemCss = ".link{display:-ms-flexbox;display:flex;-ms-flex-dir
|
|
|
209
212
|
let NavigationItem = class {
|
|
210
213
|
constructor(hostRef) {
|
|
211
214
|
index.registerInstance(this, hostRef);
|
|
215
|
+
this.wmNavigationItemClicked = index.createEvent(this, "wmNavigationItemClicked", 7);
|
|
212
216
|
this.isTabbing = false;
|
|
213
217
|
}
|
|
214
218
|
toggleTabbingOn() {
|
|
@@ -226,7 +230,7 @@ let NavigationItem = class {
|
|
|
226
230
|
}
|
|
227
231
|
}
|
|
228
232
|
render() {
|
|
229
|
-
return (index.h(index.Host, { role: "listitem" }, index.h("a", { class: `link ${this.active ? "active" : ""} ${this.isTabbing ? "user-is-tabbing" : ""}`, href: this.href }, index.h("div", { class: "icon", "aria-hidden": "true" }, index.h("slot", null)), index.h("div", { class: "text" }, this.text))));
|
|
233
|
+
return (index.h(index.Host, { role: "listitem" }, index.h("a", { class: `link ${this.active ? "active" : ""} ${this.isTabbing ? "user-is-tabbing" : ""}`, href: this.href, onClick: () => this.wmNavigationItemClicked.emit() }, index.h("div", { class: "icon", "aria-hidden": "true" }, index.h("slot", null)), index.h("div", { class: "text" }, this.text))));
|
|
230
234
|
}
|
|
231
235
|
get el() { return index.getElement(this); }
|
|
232
236
|
};
|
|
@@ -362,7 +362,7 @@ let NetworkUploader = class {
|
|
|
362
362
|
// then add an even listener to force a click event when Enter key is pressed
|
|
363
363
|
this.inputEl &&
|
|
364
364
|
this.inputEl.addEventListener("keydown", (ev) => {
|
|
365
|
-
if (this.inputEl && ev.
|
|
365
|
+
if (this.inputEl && ev.key === "Enter") {
|
|
366
366
|
this.inputEl.click();
|
|
367
367
|
}
|
|
368
368
|
});
|
|
@@ -30,48 +30,40 @@ let Option = class {
|
|
|
30
30
|
return (_a = this.el.parentElement) === null || _a === void 0 ? void 0 : _a.multiple;
|
|
31
31
|
}
|
|
32
32
|
handleKeydown(ev) {
|
|
33
|
-
switch (ev.
|
|
34
|
-
|
|
35
|
-
case 38:
|
|
33
|
+
switch (ev.key) {
|
|
34
|
+
case "ArrowUp":
|
|
36
35
|
ev.preventDefault();
|
|
37
36
|
this.wmKeyUpPressed.emit();
|
|
38
37
|
break;
|
|
39
|
-
|
|
40
|
-
case 40:
|
|
38
|
+
case "ArrowDown":
|
|
41
39
|
ev.preventDefault();
|
|
42
40
|
this.wmKeyDownPressed.emit(this.el);
|
|
43
41
|
break;
|
|
44
|
-
|
|
45
|
-
case 13:
|
|
42
|
+
case "Enter":
|
|
46
43
|
ev.preventDefault();
|
|
47
44
|
if (!this.disabled) {
|
|
48
45
|
this.el.click();
|
|
49
46
|
this.wmEnterKeyPressed.emit(this.el);
|
|
50
47
|
}
|
|
51
48
|
break;
|
|
52
|
-
|
|
53
|
-
case 32:
|
|
49
|
+
case " ":
|
|
54
50
|
ev.preventDefault();
|
|
55
51
|
this.el.click();
|
|
56
52
|
break;
|
|
57
|
-
|
|
58
|
-
case 27:
|
|
53
|
+
case "Escape":
|
|
59
54
|
ev.preventDefault();
|
|
60
55
|
ev.stopPropagation(); // for instance if select is in a modal, esc should close the select but not the modal
|
|
61
56
|
this.wmEscKeyPressed.emit();
|
|
62
57
|
break;
|
|
63
|
-
|
|
64
|
-
case 36:
|
|
58
|
+
case "Home":
|
|
65
59
|
ev.preventDefault();
|
|
66
60
|
this.wmHomeKeyPressed.emit();
|
|
67
61
|
break;
|
|
68
|
-
|
|
69
|
-
case 35:
|
|
62
|
+
case "End":
|
|
70
63
|
ev.preventDefault();
|
|
71
64
|
this.wmEndKeyPressed.emit();
|
|
72
65
|
break;
|
|
73
|
-
|
|
74
|
-
case 9:
|
|
66
|
+
case "Tab":
|
|
75
67
|
this.wmTabKeyPressed.emit();
|
|
76
68
|
break;
|
|
77
69
|
default:
|
|
@@ -237,16 +229,14 @@ let Select = class {
|
|
|
237
229
|
}
|
|
238
230
|
}
|
|
239
231
|
handleKey(ev) {
|
|
240
|
-
switch (ev.
|
|
241
|
-
|
|
242
|
-
case 40:
|
|
232
|
+
switch (ev.key) {
|
|
233
|
+
case "ArrowDown":
|
|
243
234
|
if (this.isExpanded === false) {
|
|
244
235
|
ev.preventDefault();
|
|
245
236
|
this.open("next");
|
|
246
237
|
}
|
|
247
238
|
break;
|
|
248
|
-
|
|
249
|
-
case 38:
|
|
239
|
+
case "ArrowUp":
|
|
250
240
|
if (this.isExpanded === false) {
|
|
251
241
|
ev.preventDefault();
|
|
252
242
|
this.open("previous");
|
|
@@ -61,7 +61,7 @@ let Snackbar = class {
|
|
|
61
61
|
this.newNotification = false;
|
|
62
62
|
}
|
|
63
63
|
checkForTabbing(ev) {
|
|
64
|
-
if (ev.
|
|
64
|
+
if (ev.key === "Tab") {
|
|
65
65
|
this.toggleTabbingOn();
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -151,7 +151,7 @@ let Snackbar = class {
|
|
|
151
151
|
renderSnackbars() {
|
|
152
152
|
return this.parsedNotifications.map((notification) => (index.h("div", { class: "wm-snack-wrapper" }, index.h("div", { id: `snack-${this.uid}`, class: "wm-snackbar active neutral" }, index.h("div", { class: "sr-only", tabindex: notification.link ? 0 : -1, onFocus: () => notification.link && this.snackDismissed(notification) }), index.h("div", { class: "wm-snackbarmsg" }, index.h("div", { class: "msgtext" }, index.h("span", null, notification.message), notification.link && (index.h("a", { id: `action-${notification.id}`, class: `link ${notification.newWindow ? "new-window" : ""}`, "aria-label": `Click to ${notification.link}...${notification.newWindow ? " " + this.newWindowMessage : ""}`, tabindex: 0, onClick: () => {
|
|
153
153
|
this.snackLinkClicked(notification);
|
|
154
|
-
}, onKeyDown: (ev) => ev.
|
|
154
|
+
}, onKeyDown: (ev) => ev.key === "Enter" && this.snackLinkClicked(notification) }, index.h("span", { "aria-hidden": "true" }, notification.link)))), index.h("button", { id: `close-button-${notification.id}`, "aria-label": "Close this notification", class: "closesnack", tabindex: notification.link ? 0 : -1, onClick: () => this.snackDismissed(notification) }, index.h("span", { class: "tooltip", "aria-hidden": "true" }, "Close"))), index.h("div", { class: "sr-only", tabindex: notification.link ? 0 : -1, onFocus: () => notification.link && this.snackDismissed(notification) })))));
|
|
155
155
|
}
|
|
156
156
|
renderLiveRegion() {
|
|
157
157
|
const latestNotification = this.parsedNotifications[0];
|
|
@@ -271,7 +271,7 @@ let Uploader = class {
|
|
|
271
271
|
// then add an even listener to force a click event when Enter key is pressed
|
|
272
272
|
this.inputEl &&
|
|
273
273
|
this.inputEl.addEventListener("keydown", (ev) => {
|
|
274
|
-
if (this.inputEl && ev.
|
|
274
|
+
if (this.inputEl && ev.key === "Enter") {
|
|
275
275
|
this.inputEl.click();
|
|
276
276
|
}
|
|
277
277
|
});
|
|
@@ -123,26 +123,23 @@ export class Chart {
|
|
|
123
123
|
this.isTabbing = false;
|
|
124
124
|
}
|
|
125
125
|
handleKeydown(ev) {
|
|
126
|
-
switch (ev.
|
|
127
|
-
|
|
128
|
-
case
|
|
129
|
-
case 38:
|
|
126
|
+
switch (ev.key) {
|
|
127
|
+
case "ArrowUp":
|
|
128
|
+
case "ArrowLeft":
|
|
130
129
|
ev.preventDefault();
|
|
131
130
|
this.isTabbing = true; // shd already be true. just in case user clicked on chart then pressed an arrow key
|
|
132
131
|
this.focusPrevious();
|
|
133
132
|
break;
|
|
134
|
-
|
|
135
|
-
case
|
|
136
|
-
case 40:
|
|
133
|
+
case "ArrowRight":
|
|
134
|
+
case "ArrowDown":
|
|
137
135
|
ev.preventDefault();
|
|
138
136
|
this.isTabbing = true; // shd already be true. just in case user clicked on chart then pressed an arrow key
|
|
139
137
|
this.focusNext();
|
|
140
138
|
break;
|
|
141
|
-
|
|
142
|
-
case 9:
|
|
139
|
+
case "Tab":
|
|
143
140
|
this.exitChart();
|
|
144
141
|
break;
|
|
145
|
-
case
|
|
142
|
+
case "Escape":
|
|
146
143
|
this.popoverEl.open = false;
|
|
147
144
|
break;
|
|
148
145
|
}
|
|
@@ -112,47 +112,40 @@ export class PrivDatepicker {
|
|
|
112
112
|
handleKey(ev) {
|
|
113
113
|
this.prevClicked = false;
|
|
114
114
|
this.nextClicked = false;
|
|
115
|
-
switch (ev.
|
|
116
|
-
|
|
117
|
-
case 13:
|
|
115
|
+
switch (ev.key) {
|
|
116
|
+
case "Enter":
|
|
118
117
|
ev.preventDefault();
|
|
119
118
|
//Clunky exception for blur validation. Remove when blur reworked.
|
|
120
119
|
!ev.target.id.includes("popup-title") && ev.target.click();
|
|
121
120
|
break;
|
|
122
|
-
|
|
123
|
-
case 27:
|
|
121
|
+
case "Escape":
|
|
124
122
|
ev.preventDefault();
|
|
125
123
|
if (this.isExpanded) {
|
|
126
124
|
ev.stopPropagation(); // prevents closing of parent modal
|
|
127
|
-
this.closePopup();
|
|
125
|
+
this.closePopup(true);
|
|
128
126
|
}
|
|
129
127
|
break;
|
|
130
|
-
|
|
131
|
-
case 33:
|
|
128
|
+
case "PageUp":
|
|
132
129
|
ev.preventDefault();
|
|
133
130
|
this.backOneMonth();
|
|
134
131
|
break;
|
|
135
|
-
|
|
136
|
-
case 34:
|
|
132
|
+
case "PageDown":
|
|
137
133
|
ev.preventDefault();
|
|
138
134
|
this.forwardOneMonth();
|
|
139
135
|
break;
|
|
140
|
-
|
|
141
|
-
case 36:
|
|
136
|
+
case "Home":
|
|
142
137
|
ev.preventDefault();
|
|
143
138
|
this.unfocusCell();
|
|
144
139
|
this.dayInFocus = 1;
|
|
145
140
|
forceUpdate(this.el);
|
|
146
141
|
break;
|
|
147
|
-
|
|
148
|
-
case 35:
|
|
142
|
+
case "End":
|
|
149
143
|
ev.preventDefault();
|
|
150
144
|
this.unfocusCell();
|
|
151
145
|
this.dayInFocus = this.getMonthDays(this.monthInFocus, this.yearInFocus);
|
|
152
146
|
forceUpdate(this.el);
|
|
153
147
|
break;
|
|
154
|
-
|
|
155
|
-
case 37:
|
|
148
|
+
case "ArrowLeft":
|
|
156
149
|
ev.preventDefault();
|
|
157
150
|
if (this.view === "day") {
|
|
158
151
|
this.unfocusCell();
|
|
@@ -176,8 +169,7 @@ export class PrivDatepicker {
|
|
|
176
169
|
}
|
|
177
170
|
}
|
|
178
171
|
break;
|
|
179
|
-
|
|
180
|
-
case 39:
|
|
172
|
+
case "ArrowRight":
|
|
181
173
|
ev.preventDefault();
|
|
182
174
|
if (this.view === "day") {
|
|
183
175
|
this.unfocusCell();
|
|
@@ -201,8 +193,7 @@ export class PrivDatepicker {
|
|
|
201
193
|
}
|
|
202
194
|
}
|
|
203
195
|
break;
|
|
204
|
-
|
|
205
|
-
case 38:
|
|
196
|
+
case "ArrowUp":
|
|
206
197
|
ev.preventDefault();
|
|
207
198
|
if (this.view === "day") {
|
|
208
199
|
this.unfocusCell();
|
|
@@ -227,8 +218,7 @@ export class PrivDatepicker {
|
|
|
227
218
|
}
|
|
228
219
|
}
|
|
229
220
|
break;
|
|
230
|
-
|
|
231
|
-
case 40:
|
|
221
|
+
case "ArrowDown":
|
|
232
222
|
ev.preventDefault();
|
|
233
223
|
if (!this.isExpanded) {
|
|
234
224
|
this.openPopup();
|
|
@@ -297,24 +287,52 @@ export class PrivDatepicker {
|
|
|
297
287
|
this.popupBlurred.emit({ relatedTarget: ev.target });
|
|
298
288
|
}
|
|
299
289
|
}
|
|
300
|
-
|
|
301
|
-
this.
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
290
|
+
componentDidUpdate() {
|
|
291
|
+
this.handleSelectedDate();
|
|
292
|
+
if (this.isExpanded) {
|
|
293
|
+
this.prevClicked
|
|
294
|
+
? this.prevButton.focus()
|
|
295
|
+
: this.nextClicked
|
|
296
|
+
? this.nextButton.focus()
|
|
297
|
+
: this.view === "day"
|
|
298
|
+
? this.focusCell()
|
|
299
|
+
: this.focusMonth();
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
componentDidLoad() {
|
|
303
|
+
this.handleSelectedDate();
|
|
304
|
+
this.setDateValuesForView();
|
|
305
|
+
}
|
|
306
|
+
zeroPad(value, length) {
|
|
307
|
+
if (!String.prototype.padStart) {
|
|
308
|
+
String.prototype.padStart = function padStart(targetLength, padString) {
|
|
309
|
+
targetLength = targetLength - this.length;
|
|
310
|
+
if (targetLength > padString.length) {
|
|
311
|
+
padString += padString.repeat(targetLength / padString.length);
|
|
312
|
+
}
|
|
313
|
+
return padString.slice(0, targetLength) + String(this);
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
return `${value.toString()}`.padStart(length, "0");
|
|
317
|
+
}
|
|
318
|
+
removeZeroes(date) {
|
|
319
|
+
return +date < 10 ? +date.slice(1) : +date;
|
|
320
|
+
}
|
|
321
|
+
isDateToday(date) {
|
|
322
|
+
const today = new Date();
|
|
323
|
+
const todayDateArray = [
|
|
324
|
+
today.getFullYear().toString(),
|
|
325
|
+
(today.getMonth() + 1).toString(),
|
|
326
|
+
today.getDate().toString(),
|
|
327
|
+
];
|
|
328
|
+
//Compare today's date to date and return true if they match
|
|
329
|
+
return todayDateArray.reduce((result, val, index) => result && this.removeZeroes(date[index]).toString() === val, true);
|
|
308
330
|
}
|
|
309
331
|
togglePopup() {
|
|
310
332
|
this.isExpanded ? this.closePopup() : this.openPopup();
|
|
311
333
|
this.buttonClicked = true;
|
|
312
334
|
}
|
|
313
|
-
|
|
314
|
-
let liveRegion = this.el.querySelector("#live-region");
|
|
315
|
-
liveRegion.innerHTML = text;
|
|
316
|
-
}
|
|
317
|
-
closePopup() {
|
|
335
|
+
closePopup(returnFocus = false) {
|
|
318
336
|
this.isExpanded = false;
|
|
319
337
|
this.popupEl.classList.remove("open");
|
|
320
338
|
window.setTimeout(() => {
|
|
@@ -329,14 +347,9 @@ export class PrivDatepicker {
|
|
|
329
347
|
this.yearInFocus = this.selectedYear;
|
|
330
348
|
this.dayInFocus = this.selectedDay;
|
|
331
349
|
this.changeView("day");
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
if (this.isTabbing) {
|
|
336
|
-
this.popupClosed.emit();
|
|
337
|
-
this.buttonEl.focus();
|
|
338
|
-
}
|
|
339
|
-
});
|
|
350
|
+
if (returnFocus) {
|
|
351
|
+
this.buttonEl.focus();
|
|
352
|
+
}
|
|
340
353
|
}
|
|
341
354
|
openPopup() {
|
|
342
355
|
this.panelPosition();
|
|
@@ -350,42 +363,11 @@ export class PrivDatepicker {
|
|
|
350
363
|
this.isExpanded = true;
|
|
351
364
|
this.focusCell();
|
|
352
365
|
}
|
|
353
|
-
panelPosition() {
|
|
354
|
-
// getting a ref to the input el (in datepicker.tsx)
|
|
355
|
-
let host = document.getElementById(this.parentId);
|
|
356
|
-
const labelHeight = host.shadowRoot.querySelector(".label-wrapper").clientHeight;
|
|
357
|
-
this.openUp = shouldOpenUp(host, this.popupEl, labelHeight);
|
|
358
|
-
if (hasRoomRight(host, 336)) {
|
|
359
|
-
this.popupEl.style.left = "0";
|
|
360
|
-
this.popupEl.style.right = "auto";
|
|
361
|
-
}
|
|
362
|
-
else {
|
|
363
|
-
this.popupEl.style.right = "0";
|
|
364
|
-
this.popupEl.style.left = "auto";
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
changeView(newView) {
|
|
368
|
-
this.view = newView;
|
|
369
|
-
//Ensure month view always opens to the month last visited in date view
|
|
370
|
-
this.monthNumInFocus = this.monthInFocus - 1;
|
|
371
|
-
}
|
|
372
366
|
getMonthDays(month, year) {
|
|
373
367
|
const months30 = [4, 6, 9, 11];
|
|
374
368
|
const leapYear = year % 4 === 0;
|
|
375
369
|
return month === 2 ? (leapYear ? 29 : 28) : months30.includes(month) ? 30 : 31;
|
|
376
370
|
}
|
|
377
|
-
zeroPad(value, length) {
|
|
378
|
-
if (!String.prototype.padStart) {
|
|
379
|
-
String.prototype.padStart = function padStart(targetLength, padString) {
|
|
380
|
-
targetLength = targetLength - this.length;
|
|
381
|
-
if (targetLength > padString.length) {
|
|
382
|
-
padString += padString.repeat(targetLength / padString.length);
|
|
383
|
-
}
|
|
384
|
-
return padString.slice(0, targetLength) + String(this);
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
return `${value.toString()}`.padStart(length, "0");
|
|
388
|
-
}
|
|
389
371
|
// 1 => Sunday, 7 => Saturday
|
|
390
372
|
getMonthFirstDay(month, year) {
|
|
391
373
|
return +new Date(year, month - 1, 1, 12, 0, 0).getDay() + 1;
|
|
@@ -457,7 +439,7 @@ export class PrivDatepicker {
|
|
|
457
439
|
handleTriggeredDate(el) {
|
|
458
440
|
this.cellTriggered.emit(el);
|
|
459
441
|
// change of input value will trigger the function updating selectedDate
|
|
460
|
-
this.closePopup();
|
|
442
|
+
this.closePopup(true);
|
|
461
443
|
}
|
|
462
444
|
handleSelectedDate() {
|
|
463
445
|
//Remove old selection status
|
|
@@ -497,25 +479,6 @@ export class PrivDatepicker {
|
|
|
497
479
|
monthToFocus.tabIndex = 0;
|
|
498
480
|
monthToFocus.focus();
|
|
499
481
|
}
|
|
500
|
-
removeZeroes(date) {
|
|
501
|
-
return +date < 10 ? +date.slice(1) : +date;
|
|
502
|
-
}
|
|
503
|
-
isDateToday(date) {
|
|
504
|
-
const today = new Date();
|
|
505
|
-
const todayDateArray = [
|
|
506
|
-
today.getFullYear().toString(),
|
|
507
|
-
(today.getMonth() + 1).toString(),
|
|
508
|
-
today.getDate().toString(),
|
|
509
|
-
];
|
|
510
|
-
//Compare today's date to date and return true if they match
|
|
511
|
-
return todayDateArray.reduce((result, val, index) => result && this.removeZeroes(date[index]).toString() === val, true);
|
|
512
|
-
}
|
|
513
|
-
renderMonths(month, index) {
|
|
514
|
-
return (h("div", { id: `month-${index}-${this.parentId}`, class: `month ${this.selectedMonth - 1 === index ? "selected" : ""}`, role: "gridcell", tabindex: index + 1 === this.monthInFocus ? 0 : -1, onKeyDown: (ev) => this.trapFocusEnd(ev), onBlur: (ev) => ev.stopPropagation(), onClick: () => {
|
|
515
|
-
this.monthInFocus = index + 1;
|
|
516
|
-
this.changeView("day");
|
|
517
|
-
} }, month));
|
|
518
|
-
}
|
|
519
482
|
trapFocusLeft(ev) {
|
|
520
483
|
if (ev.shiftKey && ev.key === "Tab") {
|
|
521
484
|
ev.preventDefault();
|
|
@@ -542,24 +505,46 @@ export class PrivDatepicker {
|
|
|
542
505
|
this.focusMonth();
|
|
543
506
|
}
|
|
544
507
|
}
|
|
545
|
-
|
|
546
|
-
this.
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
508
|
+
toggleBusyAttribute(state) {
|
|
509
|
+
this.el.querySelector("#wm-container").setAttribute("aria-busy", state);
|
|
510
|
+
}
|
|
511
|
+
setDateValuesForView() {
|
|
512
|
+
this.selectedYear = this.date.getUTCFullYear();
|
|
513
|
+
this.selectedMonth = this.date.getUTCMonth() + 1;
|
|
514
|
+
this.selectedDay = this.date.getUTCDate();
|
|
515
|
+
this.monthInFocus = this.selectedMonth;
|
|
516
|
+
this.yearInFocus = this.selectedYear;
|
|
517
|
+
this.dayInFocus = this.selectedDay;
|
|
518
|
+
this.monthNumInFocus = this.selectedMonth - 1;
|
|
519
|
+
}
|
|
520
|
+
updateLiveRegion(text) {
|
|
521
|
+
let liveRegion = this.el.querySelector("#live-region");
|
|
522
|
+
liveRegion.innerHTML = text;
|
|
523
|
+
}
|
|
524
|
+
panelPosition() {
|
|
525
|
+
// getting a ref to the input el (in datepicker.tsx)
|
|
526
|
+
let host = document.getElementById(this.parentId);
|
|
527
|
+
const labelHeight = host.shadowRoot.querySelector(".label-wrapper").clientHeight;
|
|
528
|
+
this.openUp = shouldOpenUp(host, this.popupEl, labelHeight);
|
|
529
|
+
if (hasRoomRight(host, 336)) {
|
|
530
|
+
this.popupEl.style.left = "0";
|
|
531
|
+
this.popupEl.style.right = "auto";
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
this.popupEl.style.right = "0";
|
|
535
|
+
this.popupEl.style.left = "auto";
|
|
555
536
|
}
|
|
556
537
|
}
|
|
557
|
-
|
|
558
|
-
this.
|
|
559
|
-
|
|
538
|
+
changeView(newView) {
|
|
539
|
+
this.view = newView;
|
|
540
|
+
//Ensure month view always opens to the month last visited in date view
|
|
541
|
+
this.monthNumInFocus = this.monthInFocus - 1;
|
|
560
542
|
}
|
|
561
|
-
|
|
562
|
-
this.
|
|
543
|
+
renderMonths(month, index) {
|
|
544
|
+
return (h("div", { id: `month-${index}-${this.parentId}`, class: `month ${this.selectedMonth - 1 === index ? "selected" : ""}`, role: "gridcell", tabindex: index + 1 === this.monthInFocus ? 0 : -1, onKeyDown: (ev) => this.trapFocusEnd(ev), onBlur: (ev) => ev.stopPropagation(), onClick: () => {
|
|
545
|
+
this.monthInFocus = index + 1;
|
|
546
|
+
this.changeView("day");
|
|
547
|
+
} }, month));
|
|
563
548
|
}
|
|
564
549
|
render() {
|
|
565
550
|
const dates = this.getCalendarDates(this.monthInFocus, this.yearInFocus);
|
|
@@ -583,7 +568,7 @@ export class PrivDatepicker {
|
|
|
583
568
|
}) },
|
|
584
569
|
h("span", { class: "mdi" }, "\uF141")),
|
|
585
570
|
h("div", { id: `popup-title-month-${this.parentId}`, class: "title-box", tabindex: 0, role: "button", onKeyDown: (ev) => {
|
|
586
|
-
if (ev.
|
|
571
|
+
if (ev.key === "Enter" || ev.key === " ") {
|
|
587
572
|
ev.preventDefault();
|
|
588
573
|
this.changeView("month");
|
|
589
574
|
}
|
|
@@ -672,7 +657,7 @@ export class PrivDatepicker {
|
|
|
672
657
|
}), ref: (el) => (this.prevButton = el), class: "arw-btn" },
|
|
673
658
|
h("span", { class: "mdi" }, "\uF141")),
|
|
674
659
|
h("div", { id: `popup-title-year-${this.parentId}`, tabindex: 0, class: "title-box year", role: "button", onClick: this.changeView.bind(this, "day"), onKeyDown: (ev) => {
|
|
675
|
-
if (ev.
|
|
660
|
+
if (ev.key === "Enter" || ev.key === " ") {
|
|
676
661
|
ev.preventDefault();
|
|
677
662
|
this.changeView("day");
|
|
678
663
|
}
|
|
@@ -66,10 +66,6 @@ export class DatePicker {
|
|
|
66
66
|
focusHandler() {
|
|
67
67
|
this.dpWrapper.classList.add("focus");
|
|
68
68
|
}
|
|
69
|
-
handlePopupClosed() {
|
|
70
|
-
this.el.tabIndex = 0;
|
|
71
|
-
this.el.focus();
|
|
72
|
-
}
|
|
73
69
|
handlePopupBlurred(ev) {
|
|
74
70
|
// emit blur event when leaving component from priv-datepicker
|
|
75
71
|
if (ev.detail.relatedTarget !== this.el) {
|
|
@@ -259,9 +255,7 @@ export class DatePicker {
|
|
|
259
255
|
id: "date.format",
|
|
260
256
|
defaultMessage: "{dateFormat, select, us {mm/dd/yyyy} int {dd/mm/yyyy} other {yyyy/mm/dd}}",
|
|
261
257
|
}, { dateFormat: this.dateFormat.toLowerCase() });
|
|
262
|
-
return (h(Host, { id: this.uid,
|
|
263
|
-
this.el.removeAttribute("tabindex");
|
|
264
|
-
}, "aria-busy": "false", class: `${this.displayError ? "invalid" : ""}`, invalid: this.displayError ? "true" : null },
|
|
258
|
+
return (h(Host, { id: this.uid, "aria-busy": "false", class: `${this.displayError ? "invalid" : ""}`, invalid: this.displayError ? "true" : null },
|
|
265
259
|
h("div", { ref: (d) => (this.dpWrapper = d), class: `wrapper label-${this.labelPosition} ${this.displayError ? "invalid" : ""}` },
|
|
266
260
|
h("div", { class: "label-wrapper" }, this.labelPosition !== "none" && (h("label", { id: `datepickerLabel-${this.uid}`, htmlFor: `date-input-${this.uid}`, class: "label", title: `${this.label} (${dateFormat})` },
|
|
267
261
|
this.label,
|
|
@@ -461,12 +455,6 @@ export class DatePicker {
|
|
|
461
455
|
"target": undefined,
|
|
462
456
|
"capture": false,
|
|
463
457
|
"passive": false
|
|
464
|
-
}, {
|
|
465
|
-
"name": "popupClosed",
|
|
466
|
-
"method": "handlePopupClosed",
|
|
467
|
-
"target": undefined,
|
|
468
|
-
"capture": false,
|
|
469
|
-
"passive": false
|
|
470
458
|
}, {
|
|
471
459
|
"name": "popupBlurred",
|
|
472
460
|
"method": "handlePopupBlurred",
|
|
@@ -39,11 +39,6 @@
|
|
|
39
39
|
/* TODO: replace with vars above whenever possible */
|
|
40
40
|
/* Buttons */
|
|
41
41
|
/* VIA */
|
|
42
|
-
:host {
|
|
43
|
-
width: 3.75rem;
|
|
44
|
-
height: 3.75rem;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
42
|
button {
|
|
48
43
|
display: none;
|
|
49
44
|
width: 100%;
|
|
@@ -81,6 +76,11 @@ button:hover {
|
|
|
81
76
|
}
|
|
82
77
|
|
|
83
78
|
@media screen and (max-width: 1023px) {
|
|
79
|
+
:host {
|
|
80
|
+
width: 3.75rem;
|
|
81
|
+
height: 3.75rem;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
84
|
button {
|
|
85
85
|
display: initial;
|
|
86
86
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, Component, Prop, Element, Host, State, Listen } from "@stencil/core";
|
|
1
|
+
import { h, Component, Prop, Element, Host, State, Listen, Event } from "@stencil/core";
|
|
2
2
|
export class NavigationItem {
|
|
3
3
|
constructor() {
|
|
4
4
|
this.isTabbing = false;
|
|
@@ -19,7 +19,7 @@ export class NavigationItem {
|
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
21
|
return (h(Host, { role: "listitem" },
|
|
22
|
-
h("a", { class: `link ${this.active ? "active" : ""} ${this.isTabbing ? "user-is-tabbing" : ""}`, href: this.href },
|
|
22
|
+
h("a", { class: `link ${this.active ? "active" : ""} ${this.isTabbing ? "user-is-tabbing" : ""}`, href: this.href, onClick: () => this.wmNavigationItemClicked.emit() },
|
|
23
23
|
h("div", { class: "icon", "aria-hidden": "true" },
|
|
24
24
|
h("slot", null)),
|
|
25
25
|
h("div", { class: "text" }, this.text))));
|
|
@@ -88,6 +88,22 @@ export class NavigationItem {
|
|
|
88
88
|
static get states() { return {
|
|
89
89
|
"isTabbing": {}
|
|
90
90
|
}; }
|
|
91
|
+
static get events() { return [{
|
|
92
|
+
"method": "wmNavigationItemClicked",
|
|
93
|
+
"name": "wmNavigationItemClicked",
|
|
94
|
+
"bubbles": true,
|
|
95
|
+
"cancelable": true,
|
|
96
|
+
"composed": true,
|
|
97
|
+
"docs": {
|
|
98
|
+
"tags": [],
|
|
99
|
+
"text": ""
|
|
100
|
+
},
|
|
101
|
+
"complexType": {
|
|
102
|
+
"original": "any",
|
|
103
|
+
"resolved": "any",
|
|
104
|
+
"references": {}
|
|
105
|
+
}
|
|
106
|
+
}]; }
|
|
91
107
|
static get elementRef() { return "el"; }
|
|
92
108
|
static get listeners() { return [{
|
|
93
109
|
"name": "wmUserIsTabbing",
|
|
@@ -50,6 +50,9 @@ export class Navigation {
|
|
|
50
50
|
handleHamburgerClicked() {
|
|
51
51
|
this.open = !this.open;
|
|
52
52
|
}
|
|
53
|
+
handleClickOnItem() {
|
|
54
|
+
this.open = false;
|
|
55
|
+
}
|
|
53
56
|
handleStateChange() {
|
|
54
57
|
if (this.isCollapsible) {
|
|
55
58
|
this.wmNavigationStateChanged.emit();
|
|
@@ -198,5 +201,11 @@ export class Navigation {
|
|
|
198
201
|
"target": "window",
|
|
199
202
|
"capture": false,
|
|
200
203
|
"passive": false
|
|
204
|
+
}, {
|
|
205
|
+
"name": "wmNavigationItemClicked",
|
|
206
|
+
"method": "handleClickOnItem",
|
|
207
|
+
"target": undefined,
|
|
208
|
+
"capture": false,
|
|
209
|
+
"passive": false
|
|
201
210
|
}]; }
|
|
202
211
|
}
|