@watermarkinsights/ripple 5.32.0-alpha.9 → 5.32.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-b72b9127.js → app-globals-5a9e2484.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/ripple.cjs.js +1 -1
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +1 -1
- package/dist/cjs/wm-button.cjs.entry.js +1 -1
- package/dist/cjs/wm-option_2.cjs.entry.js +1 -1
- package/dist/cjs/wm-tag-input.cjs.entry.js +46 -22
- package/dist/cjs/wm-uploader.cjs.entry.js +1 -1
- package/dist/collection/components/selects/wm-select/wm-select.js +1 -1
- package/dist/collection/components/wm-action-menu/wm-action-menu.css +1 -1
- package/dist/collection/components/wm-button/wm-button.css +1 -1
- package/dist/collection/components/wm-tag-input/wm-tag-input.js +47 -23
- package/dist/collection/components/wm-uploader/wm-uploader.css +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/esm/{app-globals-11e2d8e5.js → app-globals-e9a97ede.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/ripple.js +1 -1
- package/dist/esm/wm-action-menu_2.entry.js +1 -1
- package/dist/esm/wm-button.entry.js +1 -1
- package/dist/esm/wm-option_2.entry.js +1 -1
- package/dist/esm/wm-tag-input.entry.js +47 -23
- package/dist/esm/wm-uploader.entry.js +1 -1
- package/dist/ripple/{p-54ff1220.entry.js → p-5c2fc42a.entry.js} +1 -1
- package/dist/ripple/p-7799953c.entry.js +1 -0
- package/dist/ripple/p-87ef0cfa.entry.js +1 -0
- package/dist/ripple/p-d7a1be0b.entry.js +1 -0
- package/dist/ripple/p-f6f92d2a.js +1 -0
- package/dist/ripple/p-fc843bb8.entry.js +1 -0
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +5 -2
- package/package.json +2 -2
- package/dist/ripple/p-27b90777.entry.js +0 -1
- package/dist/ripple/p-2e78fa0f.entry.js +0 -1
- package/dist/ripple/p-a82ad01f.entry.js +0 -1
- package/dist/ripple/p-d43d7f88.js +0 -1
- package/dist/ripple/p-ea02567a.entry.js +0 -1
|
@@ -109,6 +109,14 @@ const TagInput = class {
|
|
|
109
109
|
});
|
|
110
110
|
return list;
|
|
111
111
|
}
|
|
112
|
+
// internal representations (dropdown li or table tr) of the options matching the user query.
|
|
113
|
+
// An option has no such element until the render that follows its insertion, so the list can be
|
|
114
|
+
// shorter than filteredOptionEls.
|
|
115
|
+
get filteredOptionRowEls() {
|
|
116
|
+
return this.filteredOptionEls
|
|
117
|
+
.map((o) => this.elFromTagOption(o))
|
|
118
|
+
.filter((el) => !!el);
|
|
119
|
+
}
|
|
112
120
|
// the ones that should be rendered as tags
|
|
113
121
|
get taggedOptions() {
|
|
114
122
|
return this.optionEls.filter((o) => o.selected || o.locked);
|
|
@@ -122,18 +130,23 @@ const TagInput = class {
|
|
|
122
130
|
return this._tagEls[this.focusedTagIndex];
|
|
123
131
|
}
|
|
124
132
|
}
|
|
133
|
+
// an empty id would make querySelector throw on the "#" selector
|
|
134
|
+
optionById(id) {
|
|
135
|
+
return id ? this.el.querySelector("#" + id) : undefined;
|
|
136
|
+
}
|
|
125
137
|
// get the wm-tag-option, given the internal representation (dropdown li or table tr)
|
|
126
138
|
tagOptionFromEl(el) {
|
|
127
|
-
return el.id === "add-new-btn" ? undefined : this.
|
|
139
|
+
return el.id === "add-new-btn" ? undefined : this.optionById(el.id);
|
|
128
140
|
}
|
|
129
141
|
// get the wm-tag-option, given the internal representation of a tag
|
|
130
142
|
tagOptionFromTag(el) {
|
|
131
|
-
|
|
132
|
-
return this.el.querySelector("#" + id);
|
|
143
|
+
return this.optionById(el.id.replace("tag-", ""));
|
|
133
144
|
}
|
|
134
145
|
// get the internal representation of a wm-tag-option
|
|
135
146
|
elFromTagOption(el) {
|
|
136
|
-
return
|
|
147
|
+
return el.id
|
|
148
|
+
? this.el.shadowRoot.querySelector("#" + el.id)
|
|
149
|
+
: undefined;
|
|
137
150
|
}
|
|
138
151
|
// focusedOption state refers to the wm-tag-option. This gets the corresponding element in the shadow DOM, or the "Add New" button.
|
|
139
152
|
get _focusedOption() {
|
|
@@ -222,7 +235,18 @@ const TagInput = class {
|
|
|
222
235
|
isElOrChild(el) {
|
|
223
236
|
return el === this.el || this.el.shadowRoot.contains(el) || this.el.contains(el);
|
|
224
237
|
}
|
|
238
|
+
// Rows and tags are rendered with the id of their wm-tag-option, and that id is the only link
|
|
239
|
+
// back from a row or a tag to its option. wm-tag-option assigns its own id when it loads, which
|
|
240
|
+
// happens after this component renders, so any missing id is assigned here instead.
|
|
241
|
+
assignOptionIds() {
|
|
242
|
+
this.optionEls.forEach((o) => {
|
|
243
|
+
if (!o.id) {
|
|
244
|
+
o.id = functions.generateId();
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
225
248
|
componentWillLoad() {
|
|
249
|
+
this.assignOptionIds();
|
|
226
250
|
if (!this.placeholder) {
|
|
227
251
|
this.placeholder = this.createPlaceholderDefault(this.addNew, this.optionEls.length > 0);
|
|
228
252
|
}
|
|
@@ -254,7 +278,6 @@ const TagInput = class {
|
|
|
254
278
|
this.tagsList = [...lockedTags, ...regularTags];
|
|
255
279
|
}
|
|
256
280
|
componentDidLoad() {
|
|
257
|
-
this.handleLayoutChange();
|
|
258
281
|
// Set up observer to announce changes in selected tags, or removed user-added tags
|
|
259
282
|
const observerAnnouncer = new MutationObserver((optionListMutations) => optionListMutations.forEach((mutationRecord) => this.handleChangeAnnouncement(mutationRecord)));
|
|
260
283
|
observerAnnouncer.observe(this.el, {
|
|
@@ -305,6 +328,7 @@ const TagInput = class {
|
|
|
305
328
|
handleOptionListChange(record) {
|
|
306
329
|
const addedNodes = Array.from(record.addedNodes);
|
|
307
330
|
if (addedNodes.length > 0) {
|
|
331
|
+
this.assignOptionIds();
|
|
308
332
|
addedNodes.forEach((n) => !this.tagsList.includes(n) && this.tagsList.push(n));
|
|
309
333
|
}
|
|
310
334
|
const removedNodes = Array.from(record.removedNodes);
|
|
@@ -360,8 +384,7 @@ const TagInput = class {
|
|
|
360
384
|
const leftBound = textEl.getBoundingClientRect().left;
|
|
361
385
|
// the numbers represent spacing values for padding, margin, and delete icon
|
|
362
386
|
const rightBound = wrapper.getBoundingClientRect().right - 10 - 8 - 28;
|
|
363
|
-
const
|
|
364
|
-
const optionEl = id && this.el.querySelector("#" + id);
|
|
387
|
+
const optionEl = this.tagOptionFromTag(tag);
|
|
365
388
|
if (optionEl) {
|
|
366
389
|
// tag text for table variant is first column text
|
|
367
390
|
textEl.textContent = functions.truncateText(textEl, this.getTagName(optionEl), rightBound - leftBound, 5);
|
|
@@ -413,12 +436,15 @@ const TagInput = class {
|
|
|
413
436
|
this.resetInput();
|
|
414
437
|
let option;
|
|
415
438
|
if (this.isTable) {
|
|
416
|
-
|
|
417
|
-
option = this.tagOptionFromEl(
|
|
439
|
+
const target = ev.target;
|
|
440
|
+
option = this.tagOptionFromEl(target.closest("tr"));
|
|
418
441
|
}
|
|
419
442
|
else {
|
|
420
443
|
option = this.tagOptionFromEl(ev.target);
|
|
421
444
|
}
|
|
445
|
+
if (!option) {
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
422
448
|
// if someone wants to attach a click event listener on wm-tag-option
|
|
423
449
|
option.click();
|
|
424
450
|
if (option.locked) {
|
|
@@ -539,15 +565,13 @@ const TagInput = class {
|
|
|
539
565
|
if (this.addNewButton && this.addNewButton.id === "add-new-btn") {
|
|
540
566
|
items.push(this.addNewButton);
|
|
541
567
|
}
|
|
542
|
-
this.
|
|
543
|
-
items.push(this.elFromTagOption(o));
|
|
544
|
-
});
|
|
568
|
+
items.push(...this.filteredOptionRowEls);
|
|
545
569
|
const next = functions.findNext(items, this._focusedOption, true);
|
|
546
570
|
this.focusOption(next);
|
|
547
571
|
}
|
|
548
572
|
}
|
|
549
573
|
else {
|
|
550
|
-
const items = this.
|
|
574
|
+
const items = this.filteredOptionRowEls;
|
|
551
575
|
const next = functions.findNext(items, this._focusedOption, true);
|
|
552
576
|
this.focusOption(next);
|
|
553
577
|
}
|
|
@@ -562,15 +586,13 @@ const TagInput = class {
|
|
|
562
586
|
if (this.addNewButton) {
|
|
563
587
|
items.push(this.addNewButton);
|
|
564
588
|
}
|
|
565
|
-
this.
|
|
566
|
-
items.push(this.elFromTagOption(o));
|
|
567
|
-
});
|
|
589
|
+
items.push(...this.filteredOptionRowEls);
|
|
568
590
|
const prev = functions.findPrev(items, this._focusedOption, true);
|
|
569
591
|
this.focusOption(prev);
|
|
570
592
|
}
|
|
571
593
|
}
|
|
572
594
|
else {
|
|
573
|
-
const items = this.
|
|
595
|
+
const items = this.filteredOptionRowEls;
|
|
574
596
|
const prev = functions.findPrev(items, this._focusedOption, true);
|
|
575
597
|
this.focusOption(prev);
|
|
576
598
|
}
|
|
@@ -608,6 +630,9 @@ const TagInput = class {
|
|
|
608
630
|
case "Delete":
|
|
609
631
|
if (this.focusedTag) {
|
|
610
632
|
const option = this.tagOptionFromTag(this.focusedTag);
|
|
633
|
+
if (!option) {
|
|
634
|
+
break;
|
|
635
|
+
}
|
|
611
636
|
if (option.locked) {
|
|
612
637
|
this.announce(this.tagLockedMessage(this.getTagName(option)));
|
|
613
638
|
}
|
|
@@ -748,9 +773,8 @@ const TagInput = class {
|
|
|
748
773
|
}
|
|
749
774
|
showTooltipIfTruncated(el) {
|
|
750
775
|
const displayedText = el.querySelector(".tag-text").textContent;
|
|
751
|
-
const
|
|
752
|
-
if (
|
|
753
|
-
const tagEl = this.el.querySelector("#" + id);
|
|
776
|
+
const tagEl = this.tagOptionFromTag(el);
|
|
777
|
+
if (tagEl) {
|
|
754
778
|
const fullText = this.getTagName(tagEl);
|
|
755
779
|
if (displayedText !== fullText && displayedText.includes("...")) {
|
|
756
780
|
functions.showTooltip("bottom", el, fullText);
|
|
@@ -944,10 +968,10 @@ const TagInput = class {
|
|
|
944
968
|
}
|
|
945
969
|
}
|
|
946
970
|
render() {
|
|
947
|
-
return (index.h("div", { key: '
|
|
971
|
+
return (index.h("div", { key: '3320626934db9d58503b2964530e0bac1126775e', class: `wrapper label-${this.labelPosition} ${this.errorMessage ? "invalid" : ""}` }, index.h("div", { key: '9342d3b7db294e8c6c791bb0b4debfa537ab4029', class: "label-wrapper" }, index.h("label", { key: '48f8454c94c26ee09d69221d5985d9bc6d14ad90', class: "label", htmlFor: "input", onMouseEnter: (ev) => this.handleLabelMouseEnter(ev), onMouseLeave: () => functions.hideTooltip() }, this.label), this.labelPosition !== "none" && this.requiredField && (index.h("div", { key: '533458abd912ff8608419c53560baf6ff3e8ecb2', class: "required", "aria-hidden": "true" }, "*"))), index.h("div", { key: '8581fb8e727570200a2a024db5b3c767d79fb433', class: `field-wrapper ${this.el.shadowRoot.activeElement === this.inputEl ? "focused" : ""} ${this.errorMessage ? "invalid" : ""}`, ref: (el) => (this.fieldWrapperEl = el) }, index.h("div", { key: 'dc8aa608d413c1ccf2ce686d78ac14944f200421', class: "upper-row" }, index.h("div", { key: '8c076d96f42b6ce47d6ca49068fae2e51bbba705', class: "svg-icon svg-search" }), index.h("div", { key: '7dba4a97ab9435c4cd2f930e91922247349f0269', class: `tags-and-input-wrapper` }, index.h("ul", { key: '96f539b009fdc8cf9b267b8b7d9f9d110c00a24b', ref: (el) => (this.tagAreaEl = el), class: `tag-area ${this.taggedOptions.length === 0 && "empty"} ${this.isKeying ? "user-is-keying" : ""}`, role: "listbox", "aria-activedescendant": this.focusedTag ? this.focusedTag.id : null, "aria-orientation": "horizontal", "aria-labelledby": "sr-instructions", tabindex: this._tagEls.length > 0 ? 0 : -1, "aria-describedby": `info max-tags`, onFocus: (ev) => this.handleTagAreaFocus(ev), onBlur: (ev) => {
|
|
948
972
|
this.focusedTagIndex = undefined;
|
|
949
973
|
this.handleBlur(ev);
|
|
950
|
-
}, onKeyDown: (ev) => this.handleTagAreaKeyDown(ev) }, this.renderTags()), index.h("div", { key: '
|
|
974
|
+
}, onKeyDown: (ev) => this.handleTagAreaKeyDown(ev) }, this.renderTags()), index.h("div", { key: '85c5677a7c97baf49906f90d0a2e20af3853b3d7', class: "sr-only", id: "sr-instructions" }, this.label, ". ", this.tagAreaInstructions), this.isDropdown && this.renderDropdownInput(), this.isTable && this.renderTableInput()), this.isDropdown && (index.h("div", { key: 'a60ae5ab37b6a973127ef0dbc73fdd25defa2b00', class: "character-count" }, this.charCount, "/", this.characterLimit))), this.renderTagCounter(), this.isDropdown && this.renderDropdown()), this.info && (index.h("div", { key: 'f66a9b7ab8687707e271dc606c54486e799a2dcc', id: "info", class: "info-text" }, this.info)), index.h("div", { key: '0e644fd0b06345ff5bb459e2dc46f7f6601bc92d', id: "error" }, this.errorMessage), index.h("div", { key: '94bea1eb5b48bd5a669d0f8a4ae98cc1ddde7692', class: "sr-only", "aria-live": "polite", ref: (el) => (this.liveRegionEl = el), "aria-atomic": "true" }, this.liveRegionMessage), this.isTable && this.renderTable()));
|
|
951
975
|
}
|
|
952
976
|
static get delegatesFocus() { return true; }
|
|
953
977
|
get el() { return index.getElement(this); }
|