@watermarkinsights/ripple 5.29.0-alpha.9 → 5.29.0
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/{app-globals-3f72d25c.js → app-globals-24691a79.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/ripple.cjs.js +2 -2
- package/dist/cjs/wm-date-range.cjs.entry.js +35 -30
- package/dist/cjs/wm-datepicker.cjs.entry.js +35 -30
- package/dist/collection/components/datepickers/wm-date-range.js +47 -30
- package/dist/collection/components/datepickers/wm-datepicker.js +47 -30
- package/dist/esm/{app-globals-d586ffcf.js → app-globals-930d901f.js} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/ripple.js +2 -2
- package/dist/esm/wm-date-range.entry.js +35 -30
- package/dist/esm/wm-datepicker.entry.js +35 -30
- package/dist/esm-es5/app-globals-930d901f.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/ripple.js +1 -1
- package/dist/esm-es5/wm-date-range.entry.js +1 -1
- package/dist/esm-es5/wm-datepicker.entry.js +1 -1
- package/dist/ripple/{p-a951445f.system.entry.js → p-29aec813.system.entry.js} +1 -1
- package/dist/ripple/{p-c106b6cc.system.entry.js → p-5034eb64.system.entry.js} +1 -1
- package/dist/ripple/p-64b6f989.entry.js +1 -0
- package/dist/ripple/p-8d5cccd1.entry.js +1 -0
- package/dist/ripple/p-a23643db.system.js +1 -0
- package/dist/ripple/p-c7d2bf2a.js +1 -0
- package/dist/ripple/p-ee102ccb.system.js +1 -0
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +1 -1
- package/dist/types/components/datepickers/wm-date-range.d.ts +3 -2
- package/dist/types/components/datepickers/wm-datepicker.d.ts +3 -2
- package/package.json +2 -3
- package/dist/esm-es5/app-globals-d586ffcf.js +0 -1
- package/dist/ripple/p-5d872c60.system.js +0 -1
- package/dist/ripple/p-6711165b.entry.js +0 -1
- package/dist/ripple/p-821f2384.entry.js +0 -1
- package/dist/ripple/p-abbc4bfe.js +0 -1
- package/dist/ripple/p-d7cc59a7.system.js +0 -1
|
@@ -24,16 +24,6 @@ const DatePicker = class {
|
|
|
24
24
|
this.canOpen = this.measureFit() !== null;
|
|
25
25
|
}, 100);
|
|
26
26
|
this.pf_repositionRAF = null;
|
|
27
|
-
this.pf_reposition = () => {
|
|
28
|
-
// rAF-throttle: native anchor() re-resolves on every frame; this matches that cadence
|
|
29
|
-
// without thrashing layout when scroll fires many times per frame.
|
|
30
|
-
if (this.pf_repositionRAF !== null)
|
|
31
|
-
return;
|
|
32
|
-
this.pf_repositionRAF = requestAnimationFrame(() => {
|
|
33
|
-
this.pf_repositionRAF = null;
|
|
34
|
-
this.pf_positionDropdown();
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
27
|
this.value = "";
|
|
38
28
|
this.disabled = false;
|
|
39
29
|
this.dateFormat = "mm/dd/yyyy";
|
|
@@ -45,6 +35,18 @@ const DatePicker = class {
|
|
|
45
35
|
this.isExpanded = false;
|
|
46
36
|
this.canOpen = true;
|
|
47
37
|
}
|
|
38
|
+
pf_reposition() {
|
|
39
|
+
if (this.hasAnchor || !this.isExpanded)
|
|
40
|
+
return;
|
|
41
|
+
// rAF-throttle: native anchor() re-resolves on every frame; this matches that cadence
|
|
42
|
+
// without thrashing layout when scroll fires many times per frame.
|
|
43
|
+
if (this.pf_repositionRAF !== null)
|
|
44
|
+
return;
|
|
45
|
+
this.pf_repositionRAF = requestAnimationFrame(() => {
|
|
46
|
+
this.pf_repositionRAF = null;
|
|
47
|
+
this.pf_positionDropdown();
|
|
48
|
+
});
|
|
49
|
+
}
|
|
48
50
|
// Returns the closest scrollable ancestor that can yield at least `neededScroll` of additional scroll.
|
|
49
51
|
findScrollable(neededScroll) {
|
|
50
52
|
// Scrolling an ancestor above the positioning boundary (e.g. a scrollable container behind
|
|
@@ -85,14 +87,18 @@ const DatePicker = class {
|
|
|
85
87
|
return null;
|
|
86
88
|
const fitsLeftAligned = rect.left + this.calWidth <= vw; // (a) left edge aligns to input's left edge
|
|
87
89
|
const fitsRightAligned = rect.right - this.calWidth >= 0; // (b) right edge aligns to input's right edge
|
|
88
|
-
// (a) left-align; (b) right-align; (c) snap to the viewport edge with the most room
|
|
90
|
+
// (a) left-align; (b) right-align; (c) snap to the viewport edge with the most room; (d) no placement works → caller hides the toggle
|
|
89
91
|
const horizontal = fitsLeftAligned
|
|
90
92
|
? "left"
|
|
91
93
|
: fitsRightAligned
|
|
92
94
|
? "right"
|
|
93
|
-
:
|
|
94
|
-
?
|
|
95
|
-
|
|
95
|
+
: vw >= this.calWidth
|
|
96
|
+
? rect.left > vw - rect.right
|
|
97
|
+
? "clip-left"
|
|
98
|
+
: "clip-right"
|
|
99
|
+
: null;
|
|
100
|
+
if (!horizontal)
|
|
101
|
+
return null;
|
|
96
102
|
return { vertical, horizontal };
|
|
97
103
|
}
|
|
98
104
|
checkCanOpen() {
|
|
@@ -175,9 +181,6 @@ const DatePicker = class {
|
|
|
175
181
|
}
|
|
176
182
|
if (!this.hasAnchor) {
|
|
177
183
|
this.pf_positionDropdown();
|
|
178
|
-
// capture: true catches scroll from any ancestor (scroll events don't bubble).
|
|
179
|
-
window.addEventListener("scroll", this.pf_reposition, { passive: true, capture: true });
|
|
180
|
-
window.addEventListener("resize", this.pf_reposition, { passive: true });
|
|
181
184
|
}
|
|
182
185
|
requestAnimationFrame(() => {
|
|
183
186
|
var _a, _b;
|
|
@@ -193,13 +196,9 @@ const DatePicker = class {
|
|
|
193
196
|
});
|
|
194
197
|
}
|
|
195
198
|
else {
|
|
196
|
-
if (
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (this.pf_repositionRAF !== null) {
|
|
200
|
-
cancelAnimationFrame(this.pf_repositionRAF);
|
|
201
|
-
this.pf_repositionRAF = null;
|
|
202
|
-
}
|
|
199
|
+
if (this.pf_repositionRAF !== null) {
|
|
200
|
+
cancelAnimationFrame(this.pf_repositionRAF);
|
|
201
|
+
this.pf_repositionRAF = null;
|
|
203
202
|
}
|
|
204
203
|
this.fit = null;
|
|
205
204
|
this.isExpanded = false;
|
|
@@ -326,6 +325,12 @@ const DatePicker = class {
|
|
|
326
325
|
componentDidLoad() {
|
|
327
326
|
this.checkCanOpen();
|
|
328
327
|
}
|
|
328
|
+
disconnectedCallback() {
|
|
329
|
+
if (this.pf_repositionRAF !== null) {
|
|
330
|
+
cancelAnimationFrame(this.pf_repositionRAF);
|
|
331
|
+
this.pf_repositionRAF = null;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
329
334
|
announce(message) {
|
|
330
335
|
// \u00A0 is a non-breaking space character, which causes the message to be read as a new one
|
|
331
336
|
if (this.liveRegionEl.textContent === message) {
|
|
@@ -335,25 +340,25 @@ const DatePicker = class {
|
|
|
335
340
|
}
|
|
336
341
|
render() {
|
|
337
342
|
var _a, _b, _c, _d;
|
|
338
|
-
return (index.h(index.Host, { key: '
|
|
343
|
+
return (index.h(index.Host, { key: '75edb60af8b727174c9e906ea4fd5655610ddd00', "aria-busy": "false", class: `${this.errorMessage ? "invalid" : ""}` }, index.h("div", { key: '30cf18c6bdd8d2904bac07075eb7f1278a1dfadc', ref: (d) => (this.dpWrapperEl = d), class: `wrapper label-${this.labelPosition} ${this.errorMessage ? "invalid" : ""}` }, index.h("div", { key: 'f52d76ff9670902582cff2c266804b138246137a', class: "label-wrapper" }, this.labelPosition !== "none" && (index.h("label", { key: '8eaad53d13c5300efcc5f2a8f0c06fb997ba2f80', id: "datepickerLabel", htmlFor: "date-input", class: "label", title: `${this.label} (${this.dateFormat})`, onMouseEnter: (ev) => this.handleLabelMouseEnter(ev), onMouseLeave: () => functions.hideTooltip() }, this.label)), this.labelPosition !== "none" && this.requiredField && (index.h("div", { key: 'bd29520e03f51baec0adc4be0a16c2c04651ea4a', "aria-hidden": "true", class: "required" }, "*"))), index.h("div", { key: '997f09274b7f85aa1d2d258e09802fe38c95a062' }, index.h("div", { key: '127816619a523254ccf63c9e3e26b7d3a8929516', class: "single-wrapper input", ref: (el) => (this.anchorEl = el) }, index.h("input", { key: 'b714f2bcb4e4fd8072ed1a61d5c3b9df5cd1de40', disabled: this.isDisabled, type: "text", id: "single-date-input", class: "date-input", name: "date", placeholder: this.dateFormat, value: this.value, onFocus: () => this.handleInputFocus(), onInput: (ev) => this.handleInput(ev), onBlur: () => this.handleInputBlur(), onChange: () => this.handleInputChange(), ref: (input) => (this.inputEl = input), "aria-describedby": "error", "aria-label": this.label, "aria-required": this.requiredField ? "true" : null }), index.h("div", { key: 'cecb3d7adf4bf0401fce82b131de4767837d52a2', class: "container", id: "wm-container" }, this.canOpen && (index.h("button", { key: '9da230049feebb37f2f087e760c2671669716e92', disabled: this.disabled, "aria-label": functions.intl.formatMessage({
|
|
339
344
|
id: "date.selectDate",
|
|
340
345
|
defaultMessage: "Select date",
|
|
341
346
|
description: "Button text for screen readers.",
|
|
342
|
-
}), "aria-describedby": "single-date-input", ref: (el) => (this.toggleEl = el), "aria-expanded": `${this.isExpanded}`, class: "toggle", id: "toggle", popoverTarget: "popup-wrapper", popoverTargetAction: "toggle" }, index.h("span", { key: '
|
|
347
|
+
}), "aria-describedby": "single-date-input", ref: (el) => (this.toggleEl = el), "aria-expanded": `${this.isExpanded}`, class: "toggle", id: "toggle", popoverTarget: "popup-wrapper", popoverTargetAction: "toggle" }, index.h("span", { key: 'b1c40c5c3e63e1096b9e8bcbac78cc5a2beebfd0', class: "svg-icon svg-date" }), index.h("span", { key: '01675fedff80453c8a8a02360dddf3658fb842c6', class: "calendar", title: functions.intl.formatMessage({
|
|
343
348
|
id: "date.calendarView",
|
|
344
349
|
defaultMessage: "Calendar View",
|
|
345
350
|
description: "Calendar button",
|
|
346
|
-
}) }))), index.h("div", { key: '
|
|
351
|
+
}) }))), index.h("div", { key: 'f0fc896b98dbdfb8ec5a9d3783c52ee324847d5e', class: `popup-wrapper ${this.calEl && this.calEl.view}-view ${this.isExpanded ? "is-open" : ""} ${!this.hasAnchor && !this.isExpanded ? "hidden" : ""} ${(_b = (_a = this.fit) === null || _a === void 0 ? void 0 : _a.vertical) !== null && _b !== void 0 ? _b : ""} ${(_d = (_c = this.fit) === null || _c === void 0 ? void 0 : _c.horizontal) !== null && _d !== void 0 ? _d : ""}`, id: "popup-wrapper", ref: (el) => (this.popupEl = el), popover: "auto",
|
|
347
352
|
// @ts-ignore -- onToggle is a valid ToggleEvent listener for popover elements
|
|
348
|
-
onToggle: (ev) => this.handleToggle(ev) }, index.h("div", { key: '
|
|
353
|
+
onToggle: (ev) => this.handleToggle(ev) }, index.h("div", { key: '34543b5a222d7875938fc545751d33cd25ecf2c3', tabIndex: 0, onFocus: () => this.calEl.focusLastFocusable() }), index.h("priv-calendar", { key: '7e548bdcc7bccc30dbbc20b32bd594cc0d27128f', ref: (el) => (this.calEl = el), startDate: this.calendarDate, focusDate: this.calendarDate, class: "inside" }), index.h("div", { key: '07ba79155102bcc5af7a7d3ff8e3252412ea816f', tabIndex: 0, onFocus: () => this.calEl.focusFirstFocusable() })), index.h("div", { key: '4ff2e5951eabde88a2d2efe46c671e5f87764359', id: "live-region", "aria-live": "polite", "aria-relevant": "text", class: "sr-only" }), index.h("div", { key: '8fd50c0d7b5d7f21aa215e71c41a4d071f76e971', id: "month-title", class: "sr-only" }, functions.intl.formatMessage({
|
|
349
354
|
id: "date.selectMonth",
|
|
350
355
|
defaultMessage: "Activate to select a month.",
|
|
351
356
|
description: "Calendar button",
|
|
352
|
-
})), index.h("div", { key: '
|
|
357
|
+
})), index.h("div", { key: 'f82d186d8f2053f13389c9de24a317bd3673a0fc', id: "year-title", class: "sr-only" }, functions.intl.formatMessage({
|
|
353
358
|
id: "date.selectYear",
|
|
354
359
|
defaultMessage: "Activate to select a year.",
|
|
355
360
|
description: "Calendar button",
|
|
356
|
-
})))), index.h("div", { key: '
|
|
361
|
+
})))), index.h("div", { key: 'bcf3f6665c8fa0bb4e21b8ba92f756aa8570b5c4', id: "error", class: "error" }, this.errorMessage), index.h("div", { key: '2b249282c6a469e6d91ecae8ac681f4ebc5816b6', ref: (el) => (this.liveRegionEl = el), class: "sr-only", "aria-live": "polite", "aria-atomic": "true" })))));
|
|
357
362
|
}
|
|
358
363
|
static get delegatesFocus() { return true; }
|
|
359
364
|
get el() { return index.getElement(this); }
|
|
@@ -13,16 +13,6 @@ export class DateRange {
|
|
|
13
13
|
this.canOpen = this.measureFit() !== null;
|
|
14
14
|
}, 100);
|
|
15
15
|
this.pf_repositionRAF = null;
|
|
16
|
-
this.pf_reposition = () => {
|
|
17
|
-
// rAF-throttle: native anchor() re-resolves on every frame; this matches that cadence
|
|
18
|
-
// without thrashing layout when scroll fires many times per frame.
|
|
19
|
-
if (this.pf_repositionRAF !== null)
|
|
20
|
-
return;
|
|
21
|
-
this.pf_repositionRAF = requestAnimationFrame(() => {
|
|
22
|
-
this.pf_repositionRAF = null;
|
|
23
|
-
this.pf_positionDropdown();
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
16
|
this.formats = { "mm/dd/yyyy": "US", "dd/mm/yyyy": "INT", "yyyy/mm/dd": "ISO" };
|
|
27
17
|
this.dateFormat = "mm/dd/yyyy";
|
|
28
18
|
this.disabled = false;
|
|
@@ -38,6 +28,18 @@ export class DateRange {
|
|
|
38
28
|
this.isExpanded = false;
|
|
39
29
|
this.canOpen = true;
|
|
40
30
|
}
|
|
31
|
+
pf_reposition() {
|
|
32
|
+
if (this.hasAnchor || !this.isExpanded)
|
|
33
|
+
return;
|
|
34
|
+
// rAF-throttle: native anchor() re-resolves on every frame; this matches that cadence
|
|
35
|
+
// without thrashing layout when scroll fires many times per frame.
|
|
36
|
+
if (this.pf_repositionRAF !== null)
|
|
37
|
+
return;
|
|
38
|
+
this.pf_repositionRAF = requestAnimationFrame(() => {
|
|
39
|
+
this.pf_repositionRAF = null;
|
|
40
|
+
this.pf_positionDropdown();
|
|
41
|
+
});
|
|
42
|
+
}
|
|
41
43
|
// Returns the closest scrollable ancestor that can yield at least `neededScroll` of additional scroll.
|
|
42
44
|
findScrollable(neededScroll) {
|
|
43
45
|
// Scrolling an ancestor above the positioning boundary (e.g. a scrollable container behind
|
|
@@ -78,14 +80,18 @@ export class DateRange {
|
|
|
78
80
|
return null;
|
|
79
81
|
const fitsLeftAligned = rect.left + this.calWidth <= vw; // (a) left edge aligns to input's left edge
|
|
80
82
|
const fitsRightAligned = rect.right - this.calWidth >= 0; // (b) right edge aligns to input's right edge
|
|
81
|
-
// (a) left-align; (b) right-align; (c) snap to the viewport edge with the most room
|
|
83
|
+
// (a) left-align; (b) right-align; (c) snap to the viewport edge with the most room; (d) no placement works → caller hides the toggle
|
|
82
84
|
const horizontal = fitsLeftAligned
|
|
83
85
|
? "left"
|
|
84
86
|
: fitsRightAligned
|
|
85
87
|
? "right"
|
|
86
|
-
:
|
|
87
|
-
?
|
|
88
|
-
|
|
88
|
+
: vw >= this.calWidth
|
|
89
|
+
? rect.left > vw - rect.right
|
|
90
|
+
? "clip-left"
|
|
91
|
+
: "clip-right"
|
|
92
|
+
: null;
|
|
93
|
+
if (!horizontal)
|
|
94
|
+
return null;
|
|
89
95
|
return { vertical, horizontal };
|
|
90
96
|
}
|
|
91
97
|
checkCanOpen() {
|
|
@@ -222,9 +228,6 @@ export class DateRange {
|
|
|
222
228
|
}
|
|
223
229
|
if (!this.hasAnchor) {
|
|
224
230
|
this.pf_positionDropdown();
|
|
225
|
-
// capture: true catches scroll from any ancestor (scroll events don't bubble).
|
|
226
|
-
window.addEventListener("scroll", this.pf_reposition, { passive: true, capture: true });
|
|
227
|
-
window.addEventListener("resize", this.pf_reposition, { passive: true });
|
|
228
231
|
}
|
|
229
232
|
requestAnimationFrame(() => {
|
|
230
233
|
var _a, _b;
|
|
@@ -258,13 +261,9 @@ export class DateRange {
|
|
|
258
261
|
});
|
|
259
262
|
}
|
|
260
263
|
else {
|
|
261
|
-
if (
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
if (this.pf_repositionRAF !== null) {
|
|
265
|
-
cancelAnimationFrame(this.pf_repositionRAF);
|
|
266
|
-
this.pf_repositionRAF = null;
|
|
267
|
-
}
|
|
264
|
+
if (this.pf_repositionRAF !== null) {
|
|
265
|
+
cancelAnimationFrame(this.pf_repositionRAF);
|
|
266
|
+
this.pf_repositionRAF = null;
|
|
268
267
|
}
|
|
269
268
|
this.fit = null;
|
|
270
269
|
// reset
|
|
@@ -515,6 +514,12 @@ export class DateRange {
|
|
|
515
514
|
componentDidLoad() {
|
|
516
515
|
this.checkCanOpen();
|
|
517
516
|
}
|
|
517
|
+
disconnectedCallback() {
|
|
518
|
+
if (this.pf_repositionRAF !== null) {
|
|
519
|
+
cancelAnimationFrame(this.pf_repositionRAF);
|
|
520
|
+
this.pf_repositionRAF = null;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
518
523
|
announce(message) {
|
|
519
524
|
// \u00A0 is a non-breaking space character, which causes the message to be read as a new one
|
|
520
525
|
if (this.liveRegionEl.textContent === message) {
|
|
@@ -524,25 +529,25 @@ export class DateRange {
|
|
|
524
529
|
}
|
|
525
530
|
render() {
|
|
526
531
|
var _a, _b, _c, _d;
|
|
527
|
-
return (h(Host, { key: '
|
|
532
|
+
return (h(Host, { key: '9840d0cb5b3aff858d939fbe2d67dc1d51535c05', "aria-busy": "false" }, h("div", { key: '71e3eb8f71812140abc538cbfec3111c2e2b9cba', ref: (d) => (this.wrapperEl = d), class: "wrapper" }, h("div", { key: '094295f1471f1ba0eaea5c65617447efc5dca770', class: "range-wrapper cal", ref: (el) => (this.anchorEl = el) }, h("div", { key: '00bcfac555be41fe8b2f885e2a0335c8d41efd28', class: "label-wrapper", id: "start-label-wrapper" }, h("label", { key: 'fa7a7f25eb9156ad8de4d3c243f41e974084e35b', id: "startlabel", htmlFor: "start-date-input", class: "label", title: `${this.labelStart} (${this.dateFormat})` }, this.labelStart, this.requiredField && (h("span", { key: '146abd4001789c1020eeb27c154004376a39e4e3', "aria-hidden": "true", class: "required" }, "*")))), h("div", { key: 'a112e25addb7a17cf497728a4d4d72018228a706', class: "label-wrapper", id: "end-label-wrapper" }, h("label", { key: '29834ad29b391967f6313e7a72775f1647f61084', id: "endlabel", htmlFor: "end-date-input", class: "label", title: `${this.labelEnd} (${this.dateFormat})` }, this.labelEnd, this.requiredField && (h("span", { key: 'b3c0b90c040a0552db1e01b8f8aa38725a98357a', "aria-hidden": "true", class: "required" }, "*")))), h("input", { key: '1a6b2881f11d9700fd5895ca49b72672d2c903aa', disabled: this._disabled, type: "text", id: "start-date-input", class: `date-input input ${this.invalidStart ? "invalid" : ""}`, name: "start-date", placeholder: this.dateFormat, value: this.valueStart, onFocus: () => this.handleFocus(), onInput: (ev) => this.handleStartInput(ev), onBlur: () => this.handleStartInputBlur(), ref: (input) => (this.startInputEl = input), "aria-describedby": "error", "aria-label": this.labelStart, "aria-required": this.requiredField ? "true" : null }), h("div", { key: '4ab993f81a4af844b51b66acefef64ecbf3c6be3', id: "hyphen" }, "\u00A0-\u00A0"), h("input", { key: '5ef90c128cc642ad23102f752838b2a2c5d30688', disabled: this._disabled, type: "text", id: "end-date-input", class: `date-input input ${this.invalidEnd ? "invalid" : ""}`, name: "end-date", placeholder: this.dateFormat, value: this.valueEnd, onFocus: () => this.handleFocus(), onInput: (ev) => this.handleEndInput(ev), onBlur: () => this.handleEndInputBlur(), ref: (input) => (this.endInputEl = input), "aria-describedby": "error", "aria-label": this.labelEnd, "aria-required": this.requiredField ? "true" : null }), h("div", { key: '43a4820ce51afc316b96e09aa8581c4791d06aaf', class: "toggle-wrapper", id: "toggle-wrapper" }, this.canOpen && (h("button", { key: '7a39be01375c1406021c8c2015f746710db313b6', disabled: this.disabled, "aria-describedby": "start-date-input end-date-input", "aria-label": intl.formatMessage({
|
|
528
533
|
id: "date.selectRange",
|
|
529
534
|
defaultMessage: "Select range",
|
|
530
535
|
description: "Button text for screen readers.",
|
|
531
|
-
}), ref: (el) => (this.toggleEl = el), "aria-expanded": `${this.isExpanded}`, class: "toggle", id: "toggle", popoverTarget: "popup-wrapper", popoverTargetAction: "toggle" }, h("span", { key: '
|
|
536
|
+
}), ref: (el) => (this.toggleEl = el), "aria-expanded": `${this.isExpanded}`, class: "toggle", id: "toggle", popoverTarget: "popup-wrapper", popoverTargetAction: "toggle" }, h("span", { key: 'd58a8a11fc19a77da89af41ac82c877acb4a0012', class: "svg-icon svg-date" }), h("span", { key: 'c0c3d305723275782e0e97db7a5feb3777de2c1b', class: "calendar", title: intl.formatMessage({
|
|
532
537
|
id: "date.calendarView",
|
|
533
538
|
defaultMessage: "Calendar View",
|
|
534
539
|
description: "Calendar button",
|
|
535
|
-
}) })))), h("div", { key: '
|
|
540
|
+
}) })))), h("div", { key: 'de44f23903d4656c215b10a070dc262057a70a5f', class: `popup-wrapper popup-range ${this.startCalEl && this.startCalEl.view}-view ${this.isExpanded ? "is-open" : ""} ${!this.hasAnchor && !this.isExpanded ? "hidden" : ""} ${(_b = (_a = this.fit) === null || _a === void 0 ? void 0 : _a.vertical) !== null && _b !== void 0 ? _b : ""} ${(_d = (_c = this.fit) === null || _c === void 0 ? void 0 : _c.horizontal) !== null && _d !== void 0 ? _d : ""}`, id: "popup-wrapper", ref: (el) => (this.popupEl = el), popover: "auto",
|
|
536
541
|
// @ts-ignore -- onToggle is a valid ToggleEvent listener for popover elements
|
|
537
|
-
onToggle: (ev) => this.handleToggle(ev) }, h("div", { key: '
|
|
542
|
+
onToggle: (ev) => this.handleToggle(ev) }, h("div", { key: '0f9e61c2aead0ad0587c99061e43b601b456de51', class: "trapfocus", tabIndex: this.isExpanded ? 0 : undefined, onFocus: () => this.endCalEl.focusLastFocusable() }), h("priv-calendar", { key: 'de148d250b5a9d58eeb186196b8db7ac09e3e111', ref: (el) => (this.startCalEl = el), onDateFocus: (ev) => this.handleDateFocus(ev) }), h("priv-calendar", { key: 'f9522d0f4d4f5a9d6790604aebeba53fc18753e5', ref: (el) => (this.endCalEl = el), onDateFocus: (ev) => this.handleDateFocus(ev) }), h("div", { key: 'ef7e0bd324e44a0fdab74c5ac90c50533c3c6f65', class: "trapfocus", tabIndex: this.isExpanded ? 0 : undefined, onFocus: () => this.startCalEl.focusFirstFocusable() }))), h("div", { key: '02a384909982487064ee8618783ad89f632effae' }, h("div", { key: '4cbd7f056e57b6cc52d70ec998aa9534f0d8e091', id: "live-region", "aria-live": "polite", "aria-relevant": "text", class: "sr-only" }), h("div", { key: '27d4adf2fb5da73fc1b0bf1da84a941400dfe75a', id: "month-title", class: "sr-only" }, intl.formatMessage({
|
|
538
543
|
id: "date.selectMonth",
|
|
539
544
|
defaultMessage: "Activate to select a month.",
|
|
540
545
|
description: "Calendar button",
|
|
541
|
-
})), h("div", { key: '
|
|
546
|
+
})), h("div", { key: '15de6f6698170ed70687516e4a15abbca041fde5', id: "year-title", class: "sr-only" }, intl.formatMessage({
|
|
542
547
|
id: "date.selectYear",
|
|
543
548
|
defaultMessage: "Activate to select a year.",
|
|
544
549
|
description: "Calendar button",
|
|
545
|
-
}))), h("div", { key: '
|
|
550
|
+
}))), h("div", { key: '47f6c2dd3072e95927d32910d1bf30cce0bde3f7', id: "error", class: "error" }, this.errorMessage), h("div", { key: '0cbdb396f7422cd1e47b299c7037f495b28ad317', ref: (el) => (this.liveRegionEl = el), class: "sr-only", "aria-live": "polite", "aria-atomic": "true" }))));
|
|
546
551
|
}
|
|
547
552
|
static get is() { return "wm-date-range"; }
|
|
548
553
|
static get encapsulation() { return "shadow"; }
|
|
@@ -883,6 +888,18 @@ export class DateRange {
|
|
|
883
888
|
}
|
|
884
889
|
static get listeners() {
|
|
885
890
|
return [{
|
|
891
|
+
"name": "scroll",
|
|
892
|
+
"method": "pf_reposition",
|
|
893
|
+
"target": "window",
|
|
894
|
+
"capture": true,
|
|
895
|
+
"passive": true
|
|
896
|
+
}, {
|
|
897
|
+
"name": "resize",
|
|
898
|
+
"method": "pf_reposition",
|
|
899
|
+
"target": "window",
|
|
900
|
+
"capture": false,
|
|
901
|
+
"passive": true
|
|
902
|
+
}, {
|
|
886
903
|
"name": "resize",
|
|
887
904
|
"method": "checkCanOpen",
|
|
888
905
|
"target": "window",
|
|
@@ -13,16 +13,6 @@ export class DatePicker {
|
|
|
13
13
|
this.canOpen = this.measureFit() !== null;
|
|
14
14
|
}, 100);
|
|
15
15
|
this.pf_repositionRAF = null;
|
|
16
|
-
this.pf_reposition = () => {
|
|
17
|
-
// rAF-throttle: native anchor() re-resolves on every frame; this matches that cadence
|
|
18
|
-
// without thrashing layout when scroll fires many times per frame.
|
|
19
|
-
if (this.pf_repositionRAF !== null)
|
|
20
|
-
return;
|
|
21
|
-
this.pf_repositionRAF = requestAnimationFrame(() => {
|
|
22
|
-
this.pf_repositionRAF = null;
|
|
23
|
-
this.pf_positionDropdown();
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
16
|
this.value = "";
|
|
27
17
|
this.disabled = false;
|
|
28
18
|
this.dateFormat = "mm/dd/yyyy";
|
|
@@ -34,6 +24,18 @@ export class DatePicker {
|
|
|
34
24
|
this.isExpanded = false;
|
|
35
25
|
this.canOpen = true;
|
|
36
26
|
}
|
|
27
|
+
pf_reposition() {
|
|
28
|
+
if (this.hasAnchor || !this.isExpanded)
|
|
29
|
+
return;
|
|
30
|
+
// rAF-throttle: native anchor() re-resolves on every frame; this matches that cadence
|
|
31
|
+
// without thrashing layout when scroll fires many times per frame.
|
|
32
|
+
if (this.pf_repositionRAF !== null)
|
|
33
|
+
return;
|
|
34
|
+
this.pf_repositionRAF = requestAnimationFrame(() => {
|
|
35
|
+
this.pf_repositionRAF = null;
|
|
36
|
+
this.pf_positionDropdown();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
37
39
|
// Returns the closest scrollable ancestor that can yield at least `neededScroll` of additional scroll.
|
|
38
40
|
findScrollable(neededScroll) {
|
|
39
41
|
// Scrolling an ancestor above the positioning boundary (e.g. a scrollable container behind
|
|
@@ -74,14 +76,18 @@ export class DatePicker {
|
|
|
74
76
|
return null;
|
|
75
77
|
const fitsLeftAligned = rect.left + this.calWidth <= vw; // (a) left edge aligns to input's left edge
|
|
76
78
|
const fitsRightAligned = rect.right - this.calWidth >= 0; // (b) right edge aligns to input's right edge
|
|
77
|
-
// (a) left-align; (b) right-align; (c) snap to the viewport edge with the most room
|
|
79
|
+
// (a) left-align; (b) right-align; (c) snap to the viewport edge with the most room; (d) no placement works → caller hides the toggle
|
|
78
80
|
const horizontal = fitsLeftAligned
|
|
79
81
|
? "left"
|
|
80
82
|
: fitsRightAligned
|
|
81
83
|
? "right"
|
|
82
|
-
:
|
|
83
|
-
?
|
|
84
|
-
|
|
84
|
+
: vw >= this.calWidth
|
|
85
|
+
? rect.left > vw - rect.right
|
|
86
|
+
? "clip-left"
|
|
87
|
+
: "clip-right"
|
|
88
|
+
: null;
|
|
89
|
+
if (!horizontal)
|
|
90
|
+
return null;
|
|
85
91
|
return { vertical, horizontal };
|
|
86
92
|
}
|
|
87
93
|
checkCanOpen() {
|
|
@@ -164,9 +170,6 @@ export class DatePicker {
|
|
|
164
170
|
}
|
|
165
171
|
if (!this.hasAnchor) {
|
|
166
172
|
this.pf_positionDropdown();
|
|
167
|
-
// capture: true catches scroll from any ancestor (scroll events don't bubble).
|
|
168
|
-
window.addEventListener("scroll", this.pf_reposition, { passive: true, capture: true });
|
|
169
|
-
window.addEventListener("resize", this.pf_reposition, { passive: true });
|
|
170
173
|
}
|
|
171
174
|
requestAnimationFrame(() => {
|
|
172
175
|
var _a, _b;
|
|
@@ -182,13 +185,9 @@ export class DatePicker {
|
|
|
182
185
|
});
|
|
183
186
|
}
|
|
184
187
|
else {
|
|
185
|
-
if (
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
if (this.pf_repositionRAF !== null) {
|
|
189
|
-
cancelAnimationFrame(this.pf_repositionRAF);
|
|
190
|
-
this.pf_repositionRAF = null;
|
|
191
|
-
}
|
|
188
|
+
if (this.pf_repositionRAF !== null) {
|
|
189
|
+
cancelAnimationFrame(this.pf_repositionRAF);
|
|
190
|
+
this.pf_repositionRAF = null;
|
|
192
191
|
}
|
|
193
192
|
this.fit = null;
|
|
194
193
|
this.isExpanded = false;
|
|
@@ -315,6 +314,12 @@ export class DatePicker {
|
|
|
315
314
|
componentDidLoad() {
|
|
316
315
|
this.checkCanOpen();
|
|
317
316
|
}
|
|
317
|
+
disconnectedCallback() {
|
|
318
|
+
if (this.pf_repositionRAF !== null) {
|
|
319
|
+
cancelAnimationFrame(this.pf_repositionRAF);
|
|
320
|
+
this.pf_repositionRAF = null;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
318
323
|
announce(message) {
|
|
319
324
|
// \u00A0 is a non-breaking space character, which causes the message to be read as a new one
|
|
320
325
|
if (this.liveRegionEl.textContent === message) {
|
|
@@ -324,25 +329,25 @@ export class DatePicker {
|
|
|
324
329
|
}
|
|
325
330
|
render() {
|
|
326
331
|
var _a, _b, _c, _d;
|
|
327
|
-
return (h(Host, { key: '
|
|
332
|
+
return (h(Host, { key: '75edb60af8b727174c9e906ea4fd5655610ddd00', "aria-busy": "false", class: `${this.errorMessage ? "invalid" : ""}` }, h("div", { key: '30cf18c6bdd8d2904bac07075eb7f1278a1dfadc', ref: (d) => (this.dpWrapperEl = d), class: `wrapper label-${this.labelPosition} ${this.errorMessage ? "invalid" : ""}` }, h("div", { key: 'f52d76ff9670902582cff2c266804b138246137a', class: "label-wrapper" }, this.labelPosition !== "none" && (h("label", { key: '8eaad53d13c5300efcc5f2a8f0c06fb997ba2f80', id: "datepickerLabel", htmlFor: "date-input", class: "label", title: `${this.label} (${this.dateFormat})`, onMouseEnter: (ev) => this.handleLabelMouseEnter(ev), onMouseLeave: () => hideTooltip() }, this.label)), this.labelPosition !== "none" && this.requiredField && (h("div", { key: 'bd29520e03f51baec0adc4be0a16c2c04651ea4a', "aria-hidden": "true", class: "required" }, "*"))), h("div", { key: '997f09274b7f85aa1d2d258e09802fe38c95a062' }, h("div", { key: '127816619a523254ccf63c9e3e26b7d3a8929516', class: "single-wrapper input", ref: (el) => (this.anchorEl = el) }, h("input", { key: 'b714f2bcb4e4fd8072ed1a61d5c3b9df5cd1de40', disabled: this.isDisabled, type: "text", id: "single-date-input", class: "date-input", name: "date", placeholder: this.dateFormat, value: this.value, onFocus: () => this.handleInputFocus(), onInput: (ev) => this.handleInput(ev), onBlur: () => this.handleInputBlur(), onChange: () => this.handleInputChange(), ref: (input) => (this.inputEl = input), "aria-describedby": "error", "aria-label": this.label, "aria-required": this.requiredField ? "true" : null }), h("div", { key: 'cecb3d7adf4bf0401fce82b131de4767837d52a2', class: "container", id: "wm-container" }, this.canOpen && (h("button", { key: '9da230049feebb37f2f087e760c2671669716e92', disabled: this.disabled, "aria-label": intl.formatMessage({
|
|
328
333
|
id: "date.selectDate",
|
|
329
334
|
defaultMessage: "Select date",
|
|
330
335
|
description: "Button text for screen readers.",
|
|
331
|
-
}), "aria-describedby": "single-date-input", ref: (el) => (this.toggleEl = el), "aria-expanded": `${this.isExpanded}`, class: "toggle", id: "toggle", popoverTarget: "popup-wrapper", popoverTargetAction: "toggle" }, h("span", { key: '
|
|
336
|
+
}), "aria-describedby": "single-date-input", ref: (el) => (this.toggleEl = el), "aria-expanded": `${this.isExpanded}`, class: "toggle", id: "toggle", popoverTarget: "popup-wrapper", popoverTargetAction: "toggle" }, h("span", { key: 'b1c40c5c3e63e1096b9e8bcbac78cc5a2beebfd0', class: "svg-icon svg-date" }), h("span", { key: '01675fedff80453c8a8a02360dddf3658fb842c6', class: "calendar", title: intl.formatMessage({
|
|
332
337
|
id: "date.calendarView",
|
|
333
338
|
defaultMessage: "Calendar View",
|
|
334
339
|
description: "Calendar button",
|
|
335
|
-
}) }))), h("div", { key: '
|
|
340
|
+
}) }))), h("div", { key: 'f0fc896b98dbdfb8ec5a9d3783c52ee324847d5e', class: `popup-wrapper ${this.calEl && this.calEl.view}-view ${this.isExpanded ? "is-open" : ""} ${!this.hasAnchor && !this.isExpanded ? "hidden" : ""} ${(_b = (_a = this.fit) === null || _a === void 0 ? void 0 : _a.vertical) !== null && _b !== void 0 ? _b : ""} ${(_d = (_c = this.fit) === null || _c === void 0 ? void 0 : _c.horizontal) !== null && _d !== void 0 ? _d : ""}`, id: "popup-wrapper", ref: (el) => (this.popupEl = el), popover: "auto",
|
|
336
341
|
// @ts-ignore -- onToggle is a valid ToggleEvent listener for popover elements
|
|
337
|
-
onToggle: (ev) => this.handleToggle(ev) }, h("div", { key: '
|
|
342
|
+
onToggle: (ev) => this.handleToggle(ev) }, h("div", { key: '34543b5a222d7875938fc545751d33cd25ecf2c3', tabIndex: 0, onFocus: () => this.calEl.focusLastFocusable() }), h("priv-calendar", { key: '7e548bdcc7bccc30dbbc20b32bd594cc0d27128f', ref: (el) => (this.calEl = el), startDate: this.calendarDate, focusDate: this.calendarDate, class: "inside" }), h("div", { key: '07ba79155102bcc5af7a7d3ff8e3252412ea816f', tabIndex: 0, onFocus: () => this.calEl.focusFirstFocusable() })), h("div", { key: '4ff2e5951eabde88a2d2efe46c671e5f87764359', id: "live-region", "aria-live": "polite", "aria-relevant": "text", class: "sr-only" }), h("div", { key: '8fd50c0d7b5d7f21aa215e71c41a4d071f76e971', id: "month-title", class: "sr-only" }, intl.formatMessage({
|
|
338
343
|
id: "date.selectMonth",
|
|
339
344
|
defaultMessage: "Activate to select a month.",
|
|
340
345
|
description: "Calendar button",
|
|
341
|
-
})), h("div", { key: '
|
|
346
|
+
})), h("div", { key: 'f82d186d8f2053f13389c9de24a317bd3673a0fc', id: "year-title", class: "sr-only" }, intl.formatMessage({
|
|
342
347
|
id: "date.selectYear",
|
|
343
348
|
defaultMessage: "Activate to select a year.",
|
|
344
349
|
description: "Calendar button",
|
|
345
|
-
})))), h("div", { key: '
|
|
350
|
+
})))), h("div", { key: 'bcf3f6665c8fa0bb4e21b8ba92f756aa8570b5c4', id: "error", class: "error" }, this.errorMessage), h("div", { key: '2b249282c6a469e6d91ecae8ac681f4ebc5816b6', ref: (el) => (this.liveRegionEl = el), class: "sr-only", "aria-live": "polite", "aria-atomic": "true" })))));
|
|
346
351
|
}
|
|
347
352
|
static get is() { return "wm-datepicker"; }
|
|
348
353
|
static get encapsulation() { return "shadow"; }
|
|
@@ -611,6 +616,18 @@ export class DatePicker {
|
|
|
611
616
|
}
|
|
612
617
|
static get listeners() {
|
|
613
618
|
return [{
|
|
619
|
+
"name": "scroll",
|
|
620
|
+
"method": "pf_reposition",
|
|
621
|
+
"target": "window",
|
|
622
|
+
"capture": true,
|
|
623
|
+
"passive": true
|
|
624
|
+
}, {
|
|
625
|
+
"name": "resize",
|
|
626
|
+
"method": "pf_reposition",
|
|
627
|
+
"target": "window",
|
|
628
|
+
"capture": false,
|
|
629
|
+
"passive": true
|
|
630
|
+
}, {
|
|
614
631
|
"name": "resize",
|
|
615
632
|
"method": "checkCanOpen",
|
|
616
633
|
"target": "window",
|