@watermarkinsights/ripple 5.20.0-alpha.12 → 5.20.0-alpha.13

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.
@@ -68,7 +68,7 @@ export class Select {
68
68
  }
69
69
  }
70
70
  handleToggle(ev) {
71
- ev.newState === "open" ? this.open() : this.close();
71
+ ev.newState === "open" ? this.onOpen() : this.onClose();
72
72
  }
73
73
  dropdownPosition() {
74
74
  // polyfill for opening up or down + positioning according to screen
@@ -108,7 +108,7 @@ export class Select {
108
108
  }
109
109
  this.isHidden = false;
110
110
  }
111
- open() {
111
+ onOpen() {
112
112
  if (!this.isExpanded && !this.isDisabled) {
113
113
  // polyfill for browsers without anchor() support (FF)
114
114
  if (!this.hasAnchor) {
@@ -119,18 +119,31 @@ export class Select {
119
119
  const hasSpaceBelow = this.dropdownEl.offsetHeight <= document.documentElement.clientHeight - anchorRect.bottom;
120
120
  const hasSpaceAbove = this.dropdownEl.offsetHeight <= anchorRect.top;
121
121
  this.openUp = !hasSpaceBelow && hasSpaceAbove;
122
+ if (!hasSpaceBelow && !hasSpaceAbove) {
123
+ // dropdown will open downwards but doesn't have enough space
124
+ // it needs to be absolutely positioned + html has to have overflow-y auto
125
+ // (the default, but could have been overriden)
126
+ // in order to ensure the options can be scrolled to
127
+ // (would already be possible if the page has content below. this is in case select was at bottom of page)
128
+ this.initialHtmlOverflowY = document.documentElement.style.overflowY;
129
+ document.documentElement.style.overflowY = "auto";
130
+ this.dropdownEl.style.position = "absolute";
131
+ }
122
132
  this.isExpanded = true;
123
133
  });
124
134
  setTimeout(() => {
125
135
  // focusing doesn't work when within requestAnimationFrame
126
136
  this.optionListEl.handleInitialFocus(this.elToFocus);
127
137
  this.elToFocus = undefined;
128
- }, 50);
138
+ }, 100);
129
139
  }
130
140
  }
131
- close() {
141
+ onClose() {
132
142
  if (this.isExpanded) {
133
143
  this.optionListEl.unfocusAll();
144
+ // see onOpen
145
+ document.documentElement.style.overflowY = this.initialHtmlOverflowY || "";
146
+ this.dropdownEl.style.position = "fixed";
134
147
  window.setTimeout(() => {
135
148
  if (!this.hasAnchor) {
136
149
  this.isHidden = true;
@@ -301,14 +314,14 @@ export class Select {
301
314
  }
302
315
  render() {
303
316
  const showSubinfo = !this.multiple && this.selectedOptions.length > 0 && this.selectedOptions[0].subinfo;
304
- return (h(Host, { key: '4ec7d687b40ffcef80fbce21e6880680c72d03a7', onBlur: (ev) => this.handleComponentBlur(ev) }, h("div", { key: 'c400196d862a763af6f4f5d4663a8f3e805a9ddd', class: `wrapper ${getTextDir()} label-${this.labelPosition} ${this.errorMessage ? "invalid" : ""}` }, h("div", { key: '1c7df9eee5ebc62a12bd36e97918e144c7e4dc72', class: "label-wrapper" }, h("label", { key: '752c9ce6491c959afda2105a5e2c6063ce4ee52e', class: "label", id: "label", htmlFor: "selectbtn", onMouseEnter: (ev) => this.handleLabelMouseEnter(ev), onMouseLeave: () => hideTooltip() }, this.label),
317
+ return (h(Host, { key: '3fcd03885fbfcc151122eeaa6b2ea5d66bca8087', onBlur: (ev) => this.handleComponentBlur(ev) }, h("div", { key: 'c2d9380b84acfe546c93be0aeabab2b26f0e8679', class: `wrapper ${getTextDir()} label-${this.labelPosition} ${this.errorMessage ? "invalid" : ""}` }, h("div", { key: 'bec7ca8c61ecfab6a3ffddda763afca1a33feb05', class: "label-wrapper" }, h("label", { key: '15da16525dcd6ac3920fc04c7cb1bef5a5538c4b', class: "label", id: "label", htmlFor: "selectbtn", onMouseEnter: (ev) => this.handleLabelMouseEnter(ev), onMouseLeave: () => hideTooltip() }, this.label),
305
318
  // we can't use aria-required because the listbox is in a sub-component and it is not announced
306
- this.requiredField && (h("span", { key: 'c0b4660ed16129c1a3aaf5252aa5e7c71eb42f20', class: "required" }, h("span", { key: '8c4a41df3473c88021f8d73f09fdfd33e3ad1c48', class: "sr-only" }, globalMessages.requiredField), h("span", { key: '303e6f18bef3d30b32508c6192ac363bbc8fb80c', "aria-hidden": "true" }, "*")))), h("div", { key: '7acc269a0e60042549cbc3fc6879b3e471f1b016', class: "button-wrapper" }, h("button", { key: 'd1e7751c22951130f92ca6fdc2c9f253e4e63b5b', 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: '6236a027968e849c873e1d09bf89910ca627b760', class: `overflowcontrol ${showSubinfo ? "hassubinfo" : ""}` }, h("span", { key: '3af139e809e636873cd53dfb53141c0c606e4963', class: "button-text" }, this.renderButtonText()), showSubinfo && h("span", { key: '5894b37ef490101b0ba38547745f450c0521a8ea', class: "subinfo" }, this.selectedOptions[0].subinfo)), h("div", { key: '6bce5cbddd6160c0d2eeb8de27ed7f0d46fffb38', class: `expand-icon svg-icon ${this.isExpanded ? "svg-expand-less" : "svg-expand-more"}` }), this.renderOverflowCount(), h("div", { key: 'a0d9da60b818f8a576f6fcaab422b9ec31d42fd4', ref: (el) => (this.measurementAreaEl = el), class: "measurement-area", "aria-hidden": "true" })), h("div", { key: 'dc70db1f203700702cf3586412eef64ab108b86f',
319
+ this.requiredField && (h("span", { key: 'a9beeb0b4ef38862af732f158021855bd78cef42', class: "required" }, h("span", { key: '9ff60a2e20dc60549318f867d4b7a6c10d541f8b', class: "sr-only" }, globalMessages.requiredField), h("span", { key: 'e2cf635fb00b871d990629a1607221ea7c2e1f88', "aria-hidden": "true" }, "*")))), h("div", { key: 'c5605786b12c33cddb06cedff0c994478d4acff4', class: "button-wrapper" }, h("button", { key: 'd1712c1d8069766f0228ffd85247685f3bafa540', 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: '38fd12103e1da0037d9b3c845cfd1cd6e4a64a32', class: `overflowcontrol ${showSubinfo ? "hassubinfo" : ""}` }, h("span", { key: 'd5708f71ce4610455d0eecda4d3e5f1e39ff625b', class: "button-text" }, this.renderButtonText()), showSubinfo && h("span", { key: '0c4c7d045c687672248ca9346a9d6d51ef0d7989', class: "subinfo" }, this.selectedOptions[0].subinfo)), h("div", { key: 'cc1ba9b5123efd0e29004d9837dc9856d229416b', class: `expand-icon svg-icon ${this.isExpanded ? "svg-expand-less" : "svg-expand-more"}` }), this.renderOverflowCount(), h("div", { key: 'd97730b3fd77457642d81704fde92929d818f842', ref: (el) => (this.measurementAreaEl = el), class: "measurement-area", "aria-hidden": "true" })), h("div", { key: 'dd8ee12a983657908640c38c981a76735b0e211e',
307
320
  // is-open is for the CSS transition in modern browsers
308
321
  // hidden is to wait for position calculations in Firefox
309
322
  class: `dropdown ${this.isExpanded ? "is-open" : ""} ${this.isHidden ? "hidden" : ""} ${this.openUp ? "upward" : ""}`, id: "dropdown", popover: "auto", ref: (el) => (this.dropdownEl = el),
310
323
  // @ts-ignore -- don't tell typescript but we're in the future
311
- onToggle: (ev) => this.handleToggle(ev) }, h("priv-option-list", { key: '09db81570f9990ec4cf87f16b52320ec82701a04', ref: (el) => (this.optionListEl = el), multiple: this.multiple, search: this.search, selectAll: this.selectAll, maxHeight: this.maxHeight, searchPlaceholder: this.searchPlaceholder, onOptionListCloseRequested: () => {
324
+ onToggle: (ev) => this.handleToggle(ev) }, h("priv-option-list", { key: '9706c17c9e999007f196e631e75684dbde28964e', ref: (el) => (this.optionListEl = el), multiple: this.multiple, search: this.search, selectAll: this.selectAll, maxHeight: this.maxHeight, searchPlaceholder: this.searchPlaceholder, onOptionListCloseRequested: () => {
312
325
  this.dropdownEl.hidePopover();
313
326
  }, onOptionListAllSelected: () => {
314
327
  this.returnFocus = true;
@@ -316,7 +329,7 @@ export class Select {
316
329
  }, onOptionListAllDeselected: () => {
317
330
  this.returnFocus = true;
318
331
  this.wmSelectAllDeselected.emit();
319
- } }, h("slot", { key: '420515d805ad1039ed3b72bd2968a0a29c27a5fc' }))), h("div", { key: '3bda216f90f3d6b10b92034996d3bdc90a4ffd60', id: "error", class: this.errorMessage ? "error-message" : "" }, this.errorMessage), h("div", { key: '032fb47f7c64c04d518740dbcb31efcd761baed6', id: "announcement", "aria-live": "polite", "aria-atomic": "true", class: "sr-only", ref: (el) => (this.liveRegionEl = el) }, this.announcement)))));
332
+ } }, h("slot", { key: 'd828427ecec9469efbf4b18343b966800c8b54dd' }))), h("div", { key: '6cecc516bbd4b0be21604d76bf4ffc5b073f1b45', id: "error", class: this.errorMessage ? "error-message" : "" }, this.errorMessage), h("div", { key: '3579651121bb56282663827993aaf11de1d09d32', id: "announcement", "aria-live": "polite", "aria-atomic": "true", class: "sr-only", ref: (el) => (this.liveRegionEl = el) }, this.announcement)))));
320
333
  }
321
334
  static get is() { return "wm-select"; }
322
335
  static get encapsulation() { return "shadow"; }
@@ -1,6 +1,6 @@
1
1
  import './index-130e07bb.js';
2
2
 
3
- const version = "5.20.0-alpha.12";
3
+ const version = "5.20.0-alpha.13";
4
4
 
5
5
  // PRINT RIPPLE VERSION IN CONSOLE
6
6
  // test envs return 0 for plugin.length
@@ -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-289e89c8.js';
3
+ import { g as globalScripts } from './app-globals-f4e5a389.js';
4
4
 
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
@@ -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-289e89c8.js';
3
+ import { g as globalScripts } from './app-globals-f4e5a389.js';
4
4
 
5
5
  /*
6
6
  Stencil Client Patch Browser v4.21.0 | MIT Licensed | https://stenciljs.com