@watermarkinsights/ripple 5.22.1 → 5.22.2-alpha.1
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-4987f41b.js → app-globals-a8d426a3.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/ripple.cjs.js +1 -1
- package/dist/cjs/wm-option_2.cjs.entry.js +46 -35
- package/dist/collection/components/selects/wm-select/wm-select.js +46 -35
- package/dist/esm/{app-globals-92dbbc0c.js → app-globals-bb7ed51c.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/ripple.js +1 -1
- package/dist/esm/wm-option_2.entry.js +46 -35
- package/dist/esm-es5/app-globals-bb7ed51c.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/ripple.js +1 -1
- package/dist/esm-es5/wm-option_2.entry.js +1 -1
- package/dist/ripple/p-009288d4.system.js +1 -0
- package/dist/ripple/{p-ee713fcf.system.entry.js → p-1c744646.system.entry.js} +1 -1
- package/dist/ripple/{p-d6b55e49.system.js → p-3043f53e.system.js} +1 -1
- package/dist/ripple/{p-c7b4db4e.entry.js → p-5e53aa54.entry.js} +1 -1
- package/dist/ripple/p-deac7edd.js +1 -0
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +1 -1
- package/dist/types/components/selects/wm-select/wm-select.d.ts +3 -2
- package/package.json +3 -3
- package/dist/esm-es5/app-globals-92dbbc0c.js +0 -1
- package/dist/ripple/p-082c8dc1.system.js +0 -1
- package/dist/ripple/p-9d2ed715.js +0 -1
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-788526f5.js');
|
|
6
|
-
const appGlobals = require('./app-globals-
|
|
6
|
+
const appGlobals = require('./app-globals-a8d426a3.js');
|
|
7
7
|
|
|
8
8
|
const defineCustomElements = async (win, options) => {
|
|
9
9
|
if (typeof window === 'undefined') return undefined;
|
package/dist/cjs/ripple.cjs.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-788526f5.js');
|
|
6
|
-
const appGlobals = require('./app-globals-
|
|
6
|
+
const appGlobals = require('./app-globals-a8d426a3.js');
|
|
7
7
|
|
|
8
8
|
/*
|
|
9
9
|
Stencil Client Patch Browser v4.21.0 | MIT Licensed | https://stenciljs.com
|
|
@@ -189,11 +189,8 @@ const Select = class {
|
|
|
189
189
|
this.scrollableParents = [];
|
|
190
190
|
this.returnFocus = false;
|
|
191
191
|
this.hasAnchor = CSS.supports("top", "anchor(bottom)"); // for FF polyfill
|
|
192
|
-
//////////////////////////////////////
|
|
193
|
-
// for multiselect button text
|
|
194
|
-
this.overflowCount = 0;
|
|
195
192
|
this.displayedOptions = [];
|
|
196
|
-
this.
|
|
193
|
+
this.oldDisplayText = "";
|
|
197
194
|
this.debouncedReposition = functions.debounce(() => {
|
|
198
195
|
this.dropdownPosition();
|
|
199
196
|
}, 100);
|
|
@@ -221,6 +218,9 @@ const Select = class {
|
|
|
221
218
|
// string "false" needs to be treated as bool False because react wrappers convert bool to string.
|
|
222
219
|
return functions.toBool(this.disabled);
|
|
223
220
|
}
|
|
221
|
+
get displayText() {
|
|
222
|
+
return this.displayedOptions.map((x) => x.textContent).join(", ");
|
|
223
|
+
}
|
|
224
224
|
get selectedOptions() {
|
|
225
225
|
return Array.from(this.el.querySelectorAll("wm-option")).filter((x) => x.selected);
|
|
226
226
|
}
|
|
@@ -456,22 +456,27 @@ const Select = class {
|
|
|
456
456
|
this.announcement = message;
|
|
457
457
|
}
|
|
458
458
|
handleOverflow() {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
this.overflowCount
|
|
472
|
-
this.
|
|
473
|
-
|
|
474
|
-
optionsTotalWidth
|
|
459
|
+
if (!this.buttonEl) {
|
|
460
|
+
index.forceUpdate(this.el);
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
// handle overflow + counter for multiselect
|
|
464
|
+
// this is a fixed measurement accounting for the max width of a 3 character overflow counter
|
|
465
|
+
const overflowCounterWidth = 38;
|
|
466
|
+
const computedStyle = window.getComputedStyle(this.buttonEl);
|
|
467
|
+
// there seems to be no quick way to get an elements width without padding, except for subtracting padding manually
|
|
468
|
+
const paddingLeft = parseInt(computedStyle.getPropertyValue("padding-left").slice(0, -2));
|
|
469
|
+
const paddingRight = parseInt(computedStyle.getPropertyValue("padding-right").slice(0, -2));
|
|
470
|
+
const availableSpace = this.buttonEl.clientWidth - paddingLeft - paddingRight - overflowCounterWidth;
|
|
471
|
+
this.overflowCount = 0;
|
|
472
|
+
this.measurementAreaEl.textContent = this.displayText;
|
|
473
|
+
let optionsTotalWidth = this.measurementAreaEl.clientWidth;
|
|
474
|
+
while (optionsTotalWidth > availableSpace && this.displayedOptions.length > 1) {
|
|
475
|
+
this.overflowCount++;
|
|
476
|
+
this.displayedOptions.pop();
|
|
477
|
+
this.measurementAreaEl.textContent = this.displayText;
|
|
478
|
+
optionsTotalWidth = this.measurementAreaEl.clientWidth;
|
|
479
|
+
}
|
|
475
480
|
}
|
|
476
481
|
}
|
|
477
482
|
setButtonText() {
|
|
@@ -481,28 +486,34 @@ const Select = class {
|
|
|
481
486
|
}
|
|
482
487
|
else {
|
|
483
488
|
this.displayedOptions = this.childOptions.filter((x) => x.selected);
|
|
484
|
-
const hasChanged = this.
|
|
489
|
+
const hasChanged = this.displayText !== this.oldDisplayText;
|
|
485
490
|
const noDisplayedOptions = this.displayedOptions.length < 1;
|
|
486
491
|
if (noDisplayedOptions) {
|
|
492
|
+
this.overflowCount = 0;
|
|
487
493
|
return this.placeholder;
|
|
488
494
|
}
|
|
489
|
-
else if (!this.buttonEl) {
|
|
490
|
-
index.forceUpdate(this.el);
|
|
491
|
-
return "";
|
|
492
|
-
}
|
|
493
495
|
else if (hasChanged) {
|
|
494
496
|
this.handleOverflow();
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
497
|
+
if (this.allSelected) {
|
|
498
|
+
// we want all selected message only if there's an overflow.
|
|
499
|
+
if (!this.overflowCount) {
|
|
500
|
+
// but on first render we don't know: handleOverflow can't calculate measurements
|
|
501
|
+
// in that case, display all selected message even if there's a chance options could have been shown
|
|
502
|
+
this.buttonText = this.allSelectedMessage;
|
|
503
|
+
}
|
|
504
|
+
else if (this.overflowCount > 0)
|
|
505
|
+
// if calc could be made and there is an overflow, reset it as it shouldn't be shown
|
|
506
|
+
this.overflowCount = 0;
|
|
507
|
+
// then display all selected message
|
|
499
508
|
this.buttonText = this.allSelectedMessage;
|
|
500
509
|
}
|
|
501
510
|
else {
|
|
502
|
-
|
|
511
|
+
// otherwise, if handleOverflow was able to calculate, it set the count and the display text
|
|
512
|
+
// if it wasn't able to calculate, the text of all the selected options will be displayed and may truncate (acceptable as fallback)
|
|
513
|
+
this.buttonText = this.displayText;
|
|
503
514
|
}
|
|
504
515
|
}
|
|
505
|
-
this.
|
|
516
|
+
this.oldDisplayText = this.displayText;
|
|
506
517
|
// the reason for setting a global variable and returning it
|
|
507
518
|
// is that we need the stored value when displayedOptions haven't changed.
|
|
508
519
|
return this.buttonText; // multiselect value
|
|
@@ -515,14 +526,14 @@ const Select = class {
|
|
|
515
526
|
}
|
|
516
527
|
render() {
|
|
517
528
|
const showSubinfo = !this.multiple && this.selectedOptions.length > 0 && this.selectedOptions[0].subinfo;
|
|
518
|
-
return (index.h(index.Host, { key: '
|
|
529
|
+
return (index.h(index.Host, { key: 'c79e7d62c63f5609264fe2f5abbbcb7f5bee40cf', onBlur: (ev) => this.handleComponentBlur(ev) }, index.h("div", { key: '3c7f3b82cf3c7b81226d376e15b0ad5dd5a0a3f9', class: `wrapper ${functions.getTextDir()} label-${this.labelPosition} ${this.errorMessage ? "invalid" : ""}` }, index.h("div", { key: '3a0f1bbcbc40a66979dfaf91e0c8d73547d3d387', class: "label-wrapper" }, index.h("label", { key: '6c540fb5f76d12047b52fecb40cda9b921466107', class: "label", id: "label", htmlFor: "selectbtn", onMouseEnter: (ev) => this.handleLabelMouseEnter(ev), onMouseLeave: () => functions.hideTooltip() }, this.label),
|
|
519
530
|
// we can't use aria-required because the listbox is in a sub-component and it is not announced
|
|
520
|
-
this.requiredField && (index.h("span", { key: '
|
|
531
|
+
this.requiredField && (index.h("span", { key: '10cc3db35973cce6dae99075f28cadf2641ad0e9', class: "required" }, index.h("span", { key: '35695584a1e99e803e4567c0fc86b8b41c0ea2f6', class: "sr-only" }, intl.globalMessages.requiredField), index.h("span", { key: 'b33b35b401f7ee745e10b98c79e46beabeea2aa1', "aria-hidden": "true" }, "*")))), index.h("div", { key: '58ab503b8b998103345197b559c7fb94ebc9c8b3', class: "button-wrapper" }, index.h("button", { key: 'ad0144669cf6569d2edd9e64a3847a8072cb1992', id: "selectbtn", disabled: this.isDisabled, "aria-labelledby": "label selectbtn", "aria-describedby": "error", popoverTarget: "dropdown", popoverTargetAction: "toggle", class: "displayedoption", ref: (el) => (this.buttonEl = el) }, index.h("span", { key: '9b5473e206d14b7be2549df81b0a76d908f35ae3', class: `overflowcontrol ${showSubinfo ? "hassubinfo" : ""}` }, index.h("span", { key: '262679aec8e736332fc0426d24e392fb9c492652', class: "button-text" }, this.setButtonText()), showSubinfo && index.h("span", { key: 'f974e802692149bbf20214224883aa1f1abe4b74', class: "subinfo" }, this.selectedOptions[0].subinfo)), index.h("div", { key: '711281e38df46a26363354effb9cfd6bf78008ae', class: `expand-icon svg-icon ${this.isExpanded ? "svg-expand-less" : "svg-expand-more"}` }), this.renderOverflowCount(), index.h("div", { key: '23f428d49ea0616bef93af1b53654c1ca8b05e4c', ref: (el) => (this.measurementAreaEl = el), class: "measurement-area", "aria-hidden": "true" })), index.h("div", { key: 'e1f1e61655445d0a899699e246eb48971a50ce09',
|
|
521
532
|
// is-open is for the CSS transition in modern browsers
|
|
522
533
|
// hidden is to wait for position calculations in Firefox
|
|
523
534
|
class: `dropdown ${this.isExpanded ? "is-open" : ""} ${this.isHidden ? "hidden" : ""} ${this.openUp ? "upward" : ""}`, id: "dropdown", popover: "auto", ref: (el) => (this.dropdownEl = el),
|
|
524
535
|
// @ts-ignore -- don't tell typescript but we're in the future
|
|
525
|
-
onToggle: (ev) => this.handleToggle(ev) }, index.h("priv-option-list", { key: '
|
|
536
|
+
onToggle: (ev) => this.handleToggle(ev) }, index.h("priv-option-list", { key: '20f87f661c84f9f3930a9de5f8fcf754c5a8154d', ref: (el) => (this.optionListEl = el), multiple: this.multiple, search: this.search, selectAll: this.selectAll, maxHeight: this.maxHeight, searchPlaceholder: this.searchPlaceholder, onOptionListCloseRequested: () => {
|
|
526
537
|
this.dropdownEl.hidePopover();
|
|
527
538
|
}, onOptionListAllSelected: () => {
|
|
528
539
|
this.returnFocus = true;
|
|
@@ -530,7 +541,7 @@ const Select = class {
|
|
|
530
541
|
}, onOptionListAllDeselected: () => {
|
|
531
542
|
this.returnFocus = true;
|
|
532
543
|
this.wmSelectAllDeselected.emit();
|
|
533
|
-
} }, index.h("slot", { key: '
|
|
544
|
+
} }, index.h("slot", { key: 'b354ca4112920d8b8b576282632fa86b32873adb' }))), index.h("div", { key: '04ba1a31fcf01e718a3476759b9d3f6a61b561d4', id: "error", class: this.errorMessage ? "error-message" : "" }, this.errorMessage), index.h("div", { key: 'f5751cc60a9f124044a0fb4795ab53969813775b', id: "announcement", "aria-live": "polite", "aria-atomic": "true", class: "sr-only", ref: (el) => (this.liveRegionEl = el) }, this.announcement)))));
|
|
534
545
|
}
|
|
535
546
|
static get delegatesFocus() { return true; }
|
|
536
547
|
get el() { return index.getElement(this); }
|
|
@@ -7,11 +7,8 @@ export class Select {
|
|
|
7
7
|
this.scrollableParents = [];
|
|
8
8
|
this.returnFocus = false;
|
|
9
9
|
this.hasAnchor = CSS.supports("top", "anchor(bottom)"); // for FF polyfill
|
|
10
|
-
//////////////////////////////////////
|
|
11
|
-
// for multiselect button text
|
|
12
|
-
this.overflowCount = 0;
|
|
13
10
|
this.displayedOptions = [];
|
|
14
|
-
this.
|
|
11
|
+
this.oldDisplayText = "";
|
|
15
12
|
this.debouncedReposition = debounce(() => {
|
|
16
13
|
this.dropdownPosition();
|
|
17
14
|
}, 100);
|
|
@@ -39,6 +36,9 @@ export class Select {
|
|
|
39
36
|
// string "false" needs to be treated as bool False because react wrappers convert bool to string.
|
|
40
37
|
return toBool(this.disabled);
|
|
41
38
|
}
|
|
39
|
+
get displayText() {
|
|
40
|
+
return this.displayedOptions.map((x) => x.textContent).join(", ");
|
|
41
|
+
}
|
|
42
42
|
get selectedOptions() {
|
|
43
43
|
return Array.from(this.el.querySelectorAll("wm-option")).filter((x) => x.selected);
|
|
44
44
|
}
|
|
@@ -274,22 +274,27 @@ export class Select {
|
|
|
274
274
|
this.announcement = message;
|
|
275
275
|
}
|
|
276
276
|
handleOverflow() {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
this.overflowCount
|
|
290
|
-
this.
|
|
291
|
-
|
|
292
|
-
optionsTotalWidth
|
|
277
|
+
if (!this.buttonEl) {
|
|
278
|
+
forceUpdate(this.el);
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
// handle overflow + counter for multiselect
|
|
282
|
+
// this is a fixed measurement accounting for the max width of a 3 character overflow counter
|
|
283
|
+
const overflowCounterWidth = 38;
|
|
284
|
+
const computedStyle = window.getComputedStyle(this.buttonEl);
|
|
285
|
+
// there seems to be no quick way to get an elements width without padding, except for subtracting padding manually
|
|
286
|
+
const paddingLeft = parseInt(computedStyle.getPropertyValue("padding-left").slice(0, -2));
|
|
287
|
+
const paddingRight = parseInt(computedStyle.getPropertyValue("padding-right").slice(0, -2));
|
|
288
|
+
const availableSpace = this.buttonEl.clientWidth - paddingLeft - paddingRight - overflowCounterWidth;
|
|
289
|
+
this.overflowCount = 0;
|
|
290
|
+
this.measurementAreaEl.textContent = this.displayText;
|
|
291
|
+
let optionsTotalWidth = this.measurementAreaEl.clientWidth;
|
|
292
|
+
while (optionsTotalWidth > availableSpace && this.displayedOptions.length > 1) {
|
|
293
|
+
this.overflowCount++;
|
|
294
|
+
this.displayedOptions.pop();
|
|
295
|
+
this.measurementAreaEl.textContent = this.displayText;
|
|
296
|
+
optionsTotalWidth = this.measurementAreaEl.clientWidth;
|
|
297
|
+
}
|
|
293
298
|
}
|
|
294
299
|
}
|
|
295
300
|
setButtonText() {
|
|
@@ -299,28 +304,34 @@ export class Select {
|
|
|
299
304
|
}
|
|
300
305
|
else {
|
|
301
306
|
this.displayedOptions = this.childOptions.filter((x) => x.selected);
|
|
302
|
-
const hasChanged = this.
|
|
307
|
+
const hasChanged = this.displayText !== this.oldDisplayText;
|
|
303
308
|
const noDisplayedOptions = this.displayedOptions.length < 1;
|
|
304
309
|
if (noDisplayedOptions) {
|
|
310
|
+
this.overflowCount = 0;
|
|
305
311
|
return this.placeholder;
|
|
306
312
|
}
|
|
307
|
-
else if (!this.buttonEl) {
|
|
308
|
-
forceUpdate(this.el);
|
|
309
|
-
return "";
|
|
310
|
-
}
|
|
311
313
|
else if (hasChanged) {
|
|
312
314
|
this.handleOverflow();
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
if (this.allSelected) {
|
|
316
|
+
// we want all selected message only if there's an overflow.
|
|
317
|
+
if (!this.overflowCount) {
|
|
318
|
+
// but on first render we don't know: handleOverflow can't calculate measurements
|
|
319
|
+
// in that case, display all selected message even if there's a chance options could have been shown
|
|
320
|
+
this.buttonText = this.allSelectedMessage;
|
|
321
|
+
}
|
|
322
|
+
else if (this.overflowCount > 0)
|
|
323
|
+
// if calc could be made and there is an overflow, reset it as it shouldn't be shown
|
|
324
|
+
this.overflowCount = 0;
|
|
325
|
+
// then display all selected message
|
|
317
326
|
this.buttonText = this.allSelectedMessage;
|
|
318
327
|
}
|
|
319
328
|
else {
|
|
320
|
-
|
|
329
|
+
// otherwise, if handleOverflow was able to calculate, it set the count and the display text
|
|
330
|
+
// if it wasn't able to calculate, the text of all the selected options will be displayed and may truncate (acceptable as fallback)
|
|
331
|
+
this.buttonText = this.displayText;
|
|
321
332
|
}
|
|
322
333
|
}
|
|
323
|
-
this.
|
|
334
|
+
this.oldDisplayText = this.displayText;
|
|
324
335
|
// the reason for setting a global variable and returning it
|
|
325
336
|
// is that we need the stored value when displayedOptions haven't changed.
|
|
326
337
|
return this.buttonText; // multiselect value
|
|
@@ -333,14 +344,14 @@ export class Select {
|
|
|
333
344
|
}
|
|
334
345
|
render() {
|
|
335
346
|
const showSubinfo = !this.multiple && this.selectedOptions.length > 0 && this.selectedOptions[0].subinfo;
|
|
336
|
-
return (h(Host, { key: '
|
|
347
|
+
return (h(Host, { key: 'c79e7d62c63f5609264fe2f5abbbcb7f5bee40cf', onBlur: (ev) => this.handleComponentBlur(ev) }, h("div", { key: '3c7f3b82cf3c7b81226d376e15b0ad5dd5a0a3f9', class: `wrapper ${getTextDir()} label-${this.labelPosition} ${this.errorMessage ? "invalid" : ""}` }, h("div", { key: '3a0f1bbcbc40a66979dfaf91e0c8d73547d3d387', class: "label-wrapper" }, h("label", { key: '6c540fb5f76d12047b52fecb40cda9b921466107', class: "label", id: "label", htmlFor: "selectbtn", onMouseEnter: (ev) => this.handleLabelMouseEnter(ev), onMouseLeave: () => hideTooltip() }, this.label),
|
|
337
348
|
// we can't use aria-required because the listbox is in a sub-component and it is not announced
|
|
338
|
-
this.requiredField && (h("span", { key: '
|
|
349
|
+
this.requiredField && (h("span", { key: '10cc3db35973cce6dae99075f28cadf2641ad0e9', class: "required" }, h("span", { key: '35695584a1e99e803e4567c0fc86b8b41c0ea2f6', class: "sr-only" }, globalMessages.requiredField), h("span", { key: 'b33b35b401f7ee745e10b98c79e46beabeea2aa1', "aria-hidden": "true" }, "*")))), h("div", { key: '58ab503b8b998103345197b559c7fb94ebc9c8b3', class: "button-wrapper" }, h("button", { key: 'ad0144669cf6569d2edd9e64a3847a8072cb1992', id: "selectbtn", disabled: this.isDisabled, "aria-labelledby": "label selectbtn", "aria-describedby": "error", popoverTarget: "dropdown", popoverTargetAction: "toggle", class: "displayedoption", ref: (el) => (this.buttonEl = el) }, h("span", { key: '9b5473e206d14b7be2549df81b0a76d908f35ae3', class: `overflowcontrol ${showSubinfo ? "hassubinfo" : ""}` }, h("span", { key: '262679aec8e736332fc0426d24e392fb9c492652', class: "button-text" }, this.setButtonText()), showSubinfo && h("span", { key: 'f974e802692149bbf20214224883aa1f1abe4b74', class: "subinfo" }, this.selectedOptions[0].subinfo)), h("div", { key: '711281e38df46a26363354effb9cfd6bf78008ae', class: `expand-icon svg-icon ${this.isExpanded ? "svg-expand-less" : "svg-expand-more"}` }), this.renderOverflowCount(), h("div", { key: '23f428d49ea0616bef93af1b53654c1ca8b05e4c', ref: (el) => (this.measurementAreaEl = el), class: "measurement-area", "aria-hidden": "true" })), h("div", { key: 'e1f1e61655445d0a899699e246eb48971a50ce09',
|
|
339
350
|
// is-open is for the CSS transition in modern browsers
|
|
340
351
|
// hidden is to wait for position calculations in Firefox
|
|
341
352
|
class: `dropdown ${this.isExpanded ? "is-open" : ""} ${this.isHidden ? "hidden" : ""} ${this.openUp ? "upward" : ""}`, id: "dropdown", popover: "auto", ref: (el) => (this.dropdownEl = el),
|
|
342
353
|
// @ts-ignore -- don't tell typescript but we're in the future
|
|
343
|
-
onToggle: (ev) => this.handleToggle(ev) }, h("priv-option-list", { key: '
|
|
354
|
+
onToggle: (ev) => this.handleToggle(ev) }, h("priv-option-list", { key: '20f87f661c84f9f3930a9de5f8fcf754c5a8154d', ref: (el) => (this.optionListEl = el), multiple: this.multiple, search: this.search, selectAll: this.selectAll, maxHeight: this.maxHeight, searchPlaceholder: this.searchPlaceholder, onOptionListCloseRequested: () => {
|
|
344
355
|
this.dropdownEl.hidePopover();
|
|
345
356
|
}, onOptionListAllSelected: () => {
|
|
346
357
|
this.returnFocus = true;
|
|
@@ -348,7 +359,7 @@ export class Select {
|
|
|
348
359
|
}, onOptionListAllDeselected: () => {
|
|
349
360
|
this.returnFocus = true;
|
|
350
361
|
this.wmSelectAllDeselected.emit();
|
|
351
|
-
} }, h("slot", { key: '
|
|
362
|
+
} }, h("slot", { key: 'b354ca4112920d8b8b576282632fa86b32873adb' }))), h("div", { key: '04ba1a31fcf01e718a3476759b9d3f6a61b561d4', id: "error", class: this.errorMessage ? "error-message" : "" }, this.errorMessage), h("div", { key: 'f5751cc60a9f124044a0fb4795ab53969813775b', id: "announcement", "aria-live": "polite", "aria-atomic": "true", class: "sr-only", ref: (el) => (this.liveRegionEl = el) }, this.announcement)))));
|
|
352
363
|
}
|
|
353
364
|
static get is() { return "wm-select"; }
|
|
354
365
|
static get encapsulation() { return "shadow"; }
|
package/dist/esm/loader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { b as bootstrapLazy } from './index-130e07bb.js';
|
|
2
2
|
export { s as setNonce } from './index-130e07bb.js';
|
|
3
|
-
import { g as globalScripts } from './app-globals-
|
|
3
|
+
import { g as globalScripts } from './app-globals-bb7ed51c.js';
|
|
4
4
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
package/dist/esm/ripple.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { p as promiseResolve, b as bootstrapLazy } from './index-130e07bb.js';
|
|
2
2
|
export { s as setNonce } from './index-130e07bb.js';
|
|
3
|
-
import { g as globalScripts } from './app-globals-
|
|
3
|
+
import { g as globalScripts } from './app-globals-bb7ed51c.js';
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
Stencil Client Patch Browser v4.21.0 | MIT Licensed | https://stenciljs.com
|
|
@@ -185,11 +185,8 @@ const Select = class {
|
|
|
185
185
|
this.scrollableParents = [];
|
|
186
186
|
this.returnFocus = false;
|
|
187
187
|
this.hasAnchor = CSS.supports("top", "anchor(bottom)"); // for FF polyfill
|
|
188
|
-
//////////////////////////////////////
|
|
189
|
-
// for multiselect button text
|
|
190
|
-
this.overflowCount = 0;
|
|
191
188
|
this.displayedOptions = [];
|
|
192
|
-
this.
|
|
189
|
+
this.oldDisplayText = "";
|
|
193
190
|
this.debouncedReposition = debounce(() => {
|
|
194
191
|
this.dropdownPosition();
|
|
195
192
|
}, 100);
|
|
@@ -217,6 +214,9 @@ const Select = class {
|
|
|
217
214
|
// string "false" needs to be treated as bool False because react wrappers convert bool to string.
|
|
218
215
|
return toBool(this.disabled);
|
|
219
216
|
}
|
|
217
|
+
get displayText() {
|
|
218
|
+
return this.displayedOptions.map((x) => x.textContent).join(", ");
|
|
219
|
+
}
|
|
220
220
|
get selectedOptions() {
|
|
221
221
|
return Array.from(this.el.querySelectorAll("wm-option")).filter((x) => x.selected);
|
|
222
222
|
}
|
|
@@ -452,22 +452,27 @@ const Select = class {
|
|
|
452
452
|
this.announcement = message;
|
|
453
453
|
}
|
|
454
454
|
handleOverflow() {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
this.overflowCount
|
|
468
|
-
this.
|
|
469
|
-
|
|
470
|
-
optionsTotalWidth
|
|
455
|
+
if (!this.buttonEl) {
|
|
456
|
+
forceUpdate(this.el);
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
// handle overflow + counter for multiselect
|
|
460
|
+
// this is a fixed measurement accounting for the max width of a 3 character overflow counter
|
|
461
|
+
const overflowCounterWidth = 38;
|
|
462
|
+
const computedStyle = window.getComputedStyle(this.buttonEl);
|
|
463
|
+
// there seems to be no quick way to get an elements width without padding, except for subtracting padding manually
|
|
464
|
+
const paddingLeft = parseInt(computedStyle.getPropertyValue("padding-left").slice(0, -2));
|
|
465
|
+
const paddingRight = parseInt(computedStyle.getPropertyValue("padding-right").slice(0, -2));
|
|
466
|
+
const availableSpace = this.buttonEl.clientWidth - paddingLeft - paddingRight - overflowCounterWidth;
|
|
467
|
+
this.overflowCount = 0;
|
|
468
|
+
this.measurementAreaEl.textContent = this.displayText;
|
|
469
|
+
let optionsTotalWidth = this.measurementAreaEl.clientWidth;
|
|
470
|
+
while (optionsTotalWidth > availableSpace && this.displayedOptions.length > 1) {
|
|
471
|
+
this.overflowCount++;
|
|
472
|
+
this.displayedOptions.pop();
|
|
473
|
+
this.measurementAreaEl.textContent = this.displayText;
|
|
474
|
+
optionsTotalWidth = this.measurementAreaEl.clientWidth;
|
|
475
|
+
}
|
|
471
476
|
}
|
|
472
477
|
}
|
|
473
478
|
setButtonText() {
|
|
@@ -477,28 +482,34 @@ const Select = class {
|
|
|
477
482
|
}
|
|
478
483
|
else {
|
|
479
484
|
this.displayedOptions = this.childOptions.filter((x) => x.selected);
|
|
480
|
-
const hasChanged = this.
|
|
485
|
+
const hasChanged = this.displayText !== this.oldDisplayText;
|
|
481
486
|
const noDisplayedOptions = this.displayedOptions.length < 1;
|
|
482
487
|
if (noDisplayedOptions) {
|
|
488
|
+
this.overflowCount = 0;
|
|
483
489
|
return this.placeholder;
|
|
484
490
|
}
|
|
485
|
-
else if (!this.buttonEl) {
|
|
486
|
-
forceUpdate(this.el);
|
|
487
|
-
return "";
|
|
488
|
-
}
|
|
489
491
|
else if (hasChanged) {
|
|
490
492
|
this.handleOverflow();
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
493
|
+
if (this.allSelected) {
|
|
494
|
+
// we want all selected message only if there's an overflow.
|
|
495
|
+
if (!this.overflowCount) {
|
|
496
|
+
// but on first render we don't know: handleOverflow can't calculate measurements
|
|
497
|
+
// in that case, display all selected message even if there's a chance options could have been shown
|
|
498
|
+
this.buttonText = this.allSelectedMessage;
|
|
499
|
+
}
|
|
500
|
+
else if (this.overflowCount > 0)
|
|
501
|
+
// if calc could be made and there is an overflow, reset it as it shouldn't be shown
|
|
502
|
+
this.overflowCount = 0;
|
|
503
|
+
// then display all selected message
|
|
495
504
|
this.buttonText = this.allSelectedMessage;
|
|
496
505
|
}
|
|
497
506
|
else {
|
|
498
|
-
|
|
507
|
+
// otherwise, if handleOverflow was able to calculate, it set the count and the display text
|
|
508
|
+
// if it wasn't able to calculate, the text of all the selected options will be displayed and may truncate (acceptable as fallback)
|
|
509
|
+
this.buttonText = this.displayText;
|
|
499
510
|
}
|
|
500
511
|
}
|
|
501
|
-
this.
|
|
512
|
+
this.oldDisplayText = this.displayText;
|
|
502
513
|
// the reason for setting a global variable and returning it
|
|
503
514
|
// is that we need the stored value when displayedOptions haven't changed.
|
|
504
515
|
return this.buttonText; // multiselect value
|
|
@@ -511,14 +522,14 @@ const Select = class {
|
|
|
511
522
|
}
|
|
512
523
|
render() {
|
|
513
524
|
const showSubinfo = !this.multiple && this.selectedOptions.length > 0 && this.selectedOptions[0].subinfo;
|
|
514
|
-
return (h(Host, { key: '
|
|
525
|
+
return (h(Host, { key: 'c79e7d62c63f5609264fe2f5abbbcb7f5bee40cf', onBlur: (ev) => this.handleComponentBlur(ev) }, h("div", { key: '3c7f3b82cf3c7b81226d376e15b0ad5dd5a0a3f9', class: `wrapper ${getTextDir()} label-${this.labelPosition} ${this.errorMessage ? "invalid" : ""}` }, h("div", { key: '3a0f1bbcbc40a66979dfaf91e0c8d73547d3d387', class: "label-wrapper" }, h("label", { key: '6c540fb5f76d12047b52fecb40cda9b921466107', class: "label", id: "label", htmlFor: "selectbtn", onMouseEnter: (ev) => this.handleLabelMouseEnter(ev), onMouseLeave: () => hideTooltip() }, this.label),
|
|
515
526
|
// we can't use aria-required because the listbox is in a sub-component and it is not announced
|
|
516
|
-
this.requiredField && (h("span", { key: '
|
|
527
|
+
this.requiredField && (h("span", { key: '10cc3db35973cce6dae99075f28cadf2641ad0e9', class: "required" }, h("span", { key: '35695584a1e99e803e4567c0fc86b8b41c0ea2f6', class: "sr-only" }, globalMessages.requiredField), h("span", { key: 'b33b35b401f7ee745e10b98c79e46beabeea2aa1', "aria-hidden": "true" }, "*")))), h("div", { key: '58ab503b8b998103345197b559c7fb94ebc9c8b3', class: "button-wrapper" }, h("button", { key: 'ad0144669cf6569d2edd9e64a3847a8072cb1992', id: "selectbtn", disabled: this.isDisabled, "aria-labelledby": "label selectbtn", "aria-describedby": "error", popoverTarget: "dropdown", popoverTargetAction: "toggle", class: "displayedoption", ref: (el) => (this.buttonEl = el) }, h("span", { key: '9b5473e206d14b7be2549df81b0a76d908f35ae3', class: `overflowcontrol ${showSubinfo ? "hassubinfo" : ""}` }, h("span", { key: '262679aec8e736332fc0426d24e392fb9c492652', class: "button-text" }, this.setButtonText()), showSubinfo && h("span", { key: 'f974e802692149bbf20214224883aa1f1abe4b74', class: "subinfo" }, this.selectedOptions[0].subinfo)), h("div", { key: '711281e38df46a26363354effb9cfd6bf78008ae', class: `expand-icon svg-icon ${this.isExpanded ? "svg-expand-less" : "svg-expand-more"}` }), this.renderOverflowCount(), h("div", { key: '23f428d49ea0616bef93af1b53654c1ca8b05e4c', ref: (el) => (this.measurementAreaEl = el), class: "measurement-area", "aria-hidden": "true" })), h("div", { key: 'e1f1e61655445d0a899699e246eb48971a50ce09',
|
|
517
528
|
// is-open is for the CSS transition in modern browsers
|
|
518
529
|
// hidden is to wait for position calculations in Firefox
|
|
519
530
|
class: `dropdown ${this.isExpanded ? "is-open" : ""} ${this.isHidden ? "hidden" : ""} ${this.openUp ? "upward" : ""}`, id: "dropdown", popover: "auto", ref: (el) => (this.dropdownEl = el),
|
|
520
531
|
// @ts-ignore -- don't tell typescript but we're in the future
|
|
521
|
-
onToggle: (ev) => this.handleToggle(ev) }, h("priv-option-list", { key: '
|
|
532
|
+
onToggle: (ev) => this.handleToggle(ev) }, h("priv-option-list", { key: '20f87f661c84f9f3930a9de5f8fcf754c5a8154d', ref: (el) => (this.optionListEl = el), multiple: this.multiple, search: this.search, selectAll: this.selectAll, maxHeight: this.maxHeight, searchPlaceholder: this.searchPlaceholder, onOptionListCloseRequested: () => {
|
|
522
533
|
this.dropdownEl.hidePopover();
|
|
523
534
|
}, onOptionListAllSelected: () => {
|
|
524
535
|
this.returnFocus = true;
|
|
@@ -526,7 +537,7 @@ const Select = class {
|
|
|
526
537
|
}, onOptionListAllDeselected: () => {
|
|
527
538
|
this.returnFocus = true;
|
|
528
539
|
this.wmSelectAllDeselected.emit();
|
|
529
|
-
} }, h("slot", { key: '
|
|
540
|
+
} }, h("slot", { key: 'b354ca4112920d8b8b576282632fa86b32873adb' }))), h("div", { key: '04ba1a31fcf01e718a3476759b9d3f6a61b561d4', id: "error", class: this.errorMessage ? "error-message" : "" }, this.errorMessage), h("div", { key: 'f5751cc60a9f124044a0fb4795ab53969813775b', id: "announcement", "aria-live": "polite", "aria-atomic": "true", class: "sr-only", ref: (el) => (this.liveRegionEl = el) }, this.announcement)))));
|
|
530
541
|
}
|
|
531
542
|
static get delegatesFocus() { return true; }
|
|
532
543
|
get el() { return getElement(this); }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./index-130e07bb.js";var version="5.22.2-alpha.1";if(window.navigator.plugins.length>0){console.log("%cRipple component library %c%s","color: #575195; font-weight: bold","font-weight: bold",version)}function wmComponentKeys(n){if(n.key=="Tab"){var o=new Event("wmUserIsTabbing");window.dispatchEvent(o);document.querySelector("body").classList.add("wmcl-user-is-tabbing")}if(n.key=="ArrowLeft"||n.key=="ArrowUp"||n.key=="ArrowRight"||n.key=="ArrowDown"){var o=new Event("wmUserIsKeying");window.dispatchEvent(o);document.querySelector("body").classList.add("wmcl-user-is-keying")}}function wmComponentMouseDownOnce(){var n=new Event("wmUserIsNotTabbing");window.dispatchEvent(n);document.querySelector("body").classList.remove("wmcl-user-is-tabbing");document.querySelector("body").classList.remove("wmcl-user-is-keying")}window.addEventListener("keydown",wmComponentKeys);window.addEventListener("mousedown",wmComponentMouseDownOnce);document.addEventListener("DOMContentLoaded",(function(){var n=document.createElement("div");n.id="wm-tooltip-container";var o=document.createElement("div");o.id="wm-tooltip";o.classList.add("wm-tooltip");o.setAttribute("popover","manual");o.setAttribute("aria-hidden","true");var t=document.createElement("style");t.textContent="\n.wm-tooltip {\n position: fixed;\n overflow: hidden;\n pointer-events: none;\n line-height: normal;\n font-family: inherit;\n font-size: 0.875rem;\n text-transform: none;\n font-weight: normal;\n background: var(--wmcolor-tooltip-background);\n color: var(--wmcolor-tooltip-text);\n z-index: 999999;\n max-width: var(--wmTooltipMaxWidth, 13.75rem);\n margin-right: 1.5rem;\n padding: 0.375rem;\n transition-property: opacity;\n transition-delay: 0s;\n opacity: 0;\n inset: unset;\n top: 0;\n left: 0;\n transform: translateZ(0);\n will-change: transform;\n transform: translate(var(--wmTooltipLeft), var(--wmTooltipTop));\n border: none;\n}\n\n.wm-tooltip:popover-open {\n opacity: 0;\n}\n\n.wm-tooltip.show {\n transition-delay: 500ms;\n opacity: 1;\n}\n";document.head.appendChild(t);n.appendChild(o);document.querySelector("body").appendChild(n)}));var globalFn=function(){};var globalScripts=globalFn;export{globalScripts as g};
|