Socket
Socket
Sign inDemoInstall

@odopod/odo-dropdown

Package Overview
Dependencies
5
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 2.0.0

dist/odo-dropdown.esm.js

14

dist/odo-dropdown.js

@@ -116,3 +116,3 @@ (function (global, factory) {

// Give the select an id if it doesn't have one.
odoHelpers.dom.giveId(_this._select, _this.id);
odoHelpers.giveId(_this._select, _this.id);

@@ -209,3 +209,3 @@ /**

if (this._label) {
odoHelpers.dom.giveId(this._label, this.id + '-label');
odoHelpers.giveId(this._label, this.id + '-label');
var _id = this._label.id;

@@ -402,3 +402,3 @@

// Clear any pending transition ends.
odoHelpers.animation.cancelTransitionEnd(this._transitionId);
odoHelpers.cancelTransitionEnd(this._transitionId);

@@ -412,5 +412,5 @@ // Remove click listener on button.

this._button.tabIndex = -1;
odoHelpers.style.causeLayout(this._optionsContainer);
odoHelpers.causeLayout(this._optionsContainer);
this._optionsContainer.classList.add(Dropdown.Classes.OPTIONS_CONTAINER_OPEN);
this._transitionId = odoHelpers.animation.onTransitionEnd(this._optionsContainer, this._handleOptionsShown, this);
this._transitionId = odoHelpers.onTransitionEnd(this._optionsContainer, this._handleOptionsShown, this);
};

@@ -441,3 +441,3 @@

// Clear any pending transition ends.
odoHelpers.animation.cancelTransitionEnd(this._transitionId);
odoHelpers.cancelTransitionEnd(this._transitionId);

@@ -449,3 +449,3 @@ document.body.removeEventListener('click', this._onPageClick);

this._optionsContainer.classList.remove(Dropdown.Classes.OPTIONS_CONTAINER_OPEN);
this._transitionId = odoHelpers.animation.onTransitionEnd(this._optionsContainer, this._handleOptionsHidden, this);
this._transitionId = odoHelpers.onTransitionEnd(this._optionsContainer, this._handleOptionsHidden, this);
};

@@ -452,0 +452,0 @@

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@odopod/odo-device"),require("@odopod/odo-helpers"),require("@odopod/odo-base-component")):"function"==typeof define&&define.amd?define(["@odopod/odo-device","@odopod/odo-helpers","@odopod/odo-base-component"],e):t.OdoDropdown=e(t.OdoDevice,t.OdoHelpers,t.OdoBaseComponent)}(this,function(t,e,i){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t,i=i&&i.hasOwnProperty("default")?i.default:i;var n=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),s=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},a=0;var r=function(t){function i(o){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n(this,i);var l=s(this,t.call(this,o));return l.options=Object.assign({},i.Defaults,r),l.id="ododropdown-"+(a+=1),l._isOpen=!1,l._select=l.getElementByClass(i.Classes.SELECT),e.dom.giveId(l._select,l.id),l._label=document.querySelector('label[for="'+l._select.id+'"]'),l.options.insertMarkup&&l._insertMarkup(),l._optionsContainer=l.getElementByClass(i.Classes.OPTIONS_CONTAINER),l._button=l.getElementByClass(i.Classes.BUTTON),l._placeholder=l.getElementByClass(i.Classes.DEFAULT),l._valueContainer=l.getElementByClass(i.Classes.VALUE),l._selectedOption=l._getCustomSelectedOption(),l._onSelectChange=l._handleSelectChange.bind(l),l._onPageClick=l._handlePageClick.bind(l),l._onButtonClick=l._showOptions.bind(l),l._onKey=l._handleKey.bind(l),l._transitionId=null,l._initialize(),l}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(i,t),i.prototype._initialize=function(){this._valueContainer.setAttribute("aria-hidden",!0),this.options.useNative?this._initializeNativeDropdown():this._initializeCustomDropdown()},i.prototype._getCustomSelectedOption=function(){return this.getCustomOptions()[this._select.selectedIndex]},i.prototype._insertMarkup=function(){var t=this.getCustomOptionsHtml();this._select.insertAdjacentHTML("beforebegin",t)},i.prototype._initializeNativeDropdown=function(){this.element.classList.add(i.Classes.BASE_NATIVE),this._select.addEventListener("change",this._onSelectChange),this._button.setAttribute("aria-hidden",!0),this._button.tabIndex=-1},i.prototype._initializeCustomDropdown=function(){if(this._label){e.dom.giveId(this._label,this.id+"-label");var t=this._label.id;this._optionsContainer.setAttribute("aria-labelledby",t)}this._select.tabIndex=-1,this._select.setAttribute("aria-hidden",!0),this._button.setAttribute("aria-haspopup","true"),this._button.setAttribute("aria-controls",this._select.id),this._button.setAttribute("aria-expanded",!1),this._toggleButtonListener(!0),this.element.addEventListener("keydown",this._onKey)},i.prototype._handleKey=function(t){var e=t.which;if(this._isOpen)switch(e){case i.Key.ESC:case i.Key.TAB:this._hideOptions();break;case i.Key.DOWN:case i.Key.UP:t.preventDefault(),i._moveFocus(e===i.Key.DOWN);break;case i.Key.SPACE:case i.Key.ENTER:t.preventDefault(),this._selectOption(t.target)}else switch(e){case i.Key.SPACE:case i.Key.DOWN:case i.Key.UP:case i.Key.ENTER:t.preventDefault(),this._showOptions()}},i._moveFocus=function(t){var e=i.Selector.ENABLED_OPTION,n=t?i._nextMatch(document.activeElement,e):i._prevMatch(document.activeElement,e);n&&n.focus()},i._nextMatch=function(t,e){for(;t=t.nextElementSibling;)if(t.matches(e))return t;return null},i._prevMatch=function(t,e){for(;t=t.previousElementSibling;)if(t.matches(e))return t;return null},i.prototype._handlePageClick=function(t){var e=t.target.closest("."+i.Classes.OPTION);e?this._selectOption(e):this._hideOptions()},i.prototype._selectOption=function(t){if(!t.classList.contains(i.Classes.OPTION_DISABLED)&&t.classList.contains(i.Classes.OPTION)){var e=t.getAttribute("data-value");this.value=e,this._hideOptions(),this.emit(i.EventType.CHANGE,{name:this.select.name,value:this.value})}},i.prototype._handleSelectChange=function(){this.value=this._select.value,this.emit(i.EventType.CHANGE,{name:this.select.name,value:this.value})},i.prototype._toggleButtonListener=function(t){t?this._button.addEventListener("click",this._onButtonClick):this._button.removeEventListener("click",this._onButtonClick)},i.prototype._showOptions=function(){this._isOpen=!0,e.animation.cancelTransitionEnd(this._transitionId),this._toggleButtonListener(!1),this.element.classList.add(i.Classes.OPEN),this._optionsContainer.setAttribute("aria-hidden",!1),this._button.setAttribute("aria-expanded",!0),this._button.tabIndex=-1,e.style.causeLayout(this._optionsContainer),this._optionsContainer.classList.add(i.Classes.OPTIONS_CONTAINER_OPEN),this._transitionId=e.animation.onTransitionEnd(this._optionsContainer,this._handleOptionsShown,this)},i.prototype._handleOptionsShown=function(){document.body.addEventListener("click",this._onPageClick),this._selectedOption&&this._selectedOption.focus()},i.prototype._hideOptions=function(){this._isOpen=!1,e.animation.cancelTransitionEnd(this._transitionId),document.body.removeEventListener("click",this._onPageClick),this._optionsContainer.setAttribute("aria-hidden",!0),this._button.tabIndex=0,this._button.setAttribute("aria-expanded",!1),this._optionsContainer.classList.remove(i.Classes.OPTIONS_CONTAINER_OPEN),this._transitionId=e.animation.onTransitionEnd(this._optionsContainer,this._handleOptionsHidden,this)},i.prototype._handleOptionsHidden=function(){this.element.classList.remove(i.Classes.OPEN),this._button.focus(),this._toggleButtonListener(!0)},i.prototype.getCustomOptionsHtml=function(){return'<div class="'+i.Classes.OPTIONS_CONTAINER+'" role="menu" aria-hidden="true">'+this.getOptionsMarkup()+"</div>"},i.prototype.getOptionsMarkup=function(){var t=this;return this.getNativeOptions().reduce(function(e,i){return e+t.getOptionMarkup(i)},"")},i.prototype.getOptionMarkup=function(t){var e=t.selected?" "+i.Classes.OPTION_SELECTED:"",n=t.disabled?" "+i.Classes.OPTION_DISABLED:"";return'<div class="'+(i.Classes.OPTION+e+n)+'" data-value="'+t.value+'" tabindex="-1" role="menuitem">'+t.text+"</div>"},i.prototype.getCustomOptions=function(){return this.getElementsByClass(i.Classes.OPTION)},i.prototype.getNativeOptions=function(){return Array.from(this.select.options)},i.prototype.getDisplayText=function(t){return this.select.options[t].text},i.prototype.toggleOptionByValue=function(t,e){var n=this._optionsContainer.querySelector('[data-value="'+t+'"]'),o=this._select.querySelector('[value="'+t+'"]');return n.classList.toggle(i.Classes.OPTION_DISABLED,e),e?n.setAttribute("aria-disabled",!0):n.removeAttribute("aria-disabled"),o.disabled=e,this},i.prototype.disableOptionByValue=function(t){return this.toggleOptionByValue(t,!0)},i.prototype.enableOptionByValue=function(t){return this.toggleOptionByValue(t,!1)},i.prototype.dispose=function(){this._select.removeEventListener("change",this._onSelectChange),this._button.removeEventListener("click",this._onButtonClick),document.body.removeEventListener("click",this._onPageClick),this._optionsContainer.parentNode.removeChild(this._optionsContainer),this._select.removeAttribute("tabindex"),this._select.removeAttribute("aria-hidden"),this._button.removeAttribute("tabindex"),this._button.removeAttribute("aria-hidden"),this._button.removeAttribute("aria-haspopup"),this._button.removeAttribute("aria-controls"),this._button.removeAttribute("aria-expanded"),this._selectedOption=null,this._optionsContainer=null,this._button=null,this._placeholder=null,this._valueContainer=null,this._select=null,t.prototype.dispose.call(this)},o(i,[{key:"selectedIndex",get:function(){return this._select.selectedIndex},set:function(t){this.value=this._select.options[t].value}},{key:"select",get:function(){return this._select}},{key:"button",get:function(){return this._button}},{key:"selectedText",get:function(){return this._select.options[this._select.selectedIndex].text}},{key:"value",get:function(){return this._select.value},set:function(t){if(this._selectedOption&&this._selectedOption.classList.remove(i.Classes.OPTION_SELECTED),this._select.value=t,this._selectedOption=this._getCustomSelectedOption(),this._selectedOption){var e=this.getDisplayText(this.selectedIndex);this._selectedOption.classList.add(i.Classes.OPTION_SELECTED),this._placeholder.style.display="none",this._placeholder.setAttribute("aria-hidden",!0),this._valueContainer.textContent=e,this._valueContainer.removeAttribute("aria-hidden")}else this._placeholder.style.display="",this._placeholder.removeAttribute("aria-hidden"),this._valueContainer.textContent="",this._valueContainer.setAttribute("aria-hidden",!0)}},{key:"disabled",get:function(){return this.select.disabled},set:function(t){this.select.disabled=t,this.button.disabled=t}}]),i}(i);return r.Classes={BASE:"odo-dropdown",OPEN:"odo-dropdown--open",BUTTON:"odo-dropdown__button",OPTIONS_CONTAINER_OPEN:"odo-dropdown__options--open",OPTIONS_CONTAINER:"odo-dropdown__options",OPTION:"odo-dropdown__option",OPTION_SELECTED:"odo-dropdown__option--active",OPTION_DISABLED:"odo-dropdown__option--disabled",SELECT:"odo-dropdown__select",VALUE:"odo-dropdown__value",DEFAULT:"odo-dropdown__default",BASE_NATIVE:"odo-dropdown--native"},r.Key={TAB:9,ENTER:13,ESC:27,SPACE:32,UP:38,DOWN:40},r.EventType={CHANGE:"ododropdown:change"},r.Selector={ENABLED_OPTION:"."+r.Classes.OPTION+":not(."+r.Classes.OPTION_DISABLED+")"},r.Defaults={insertMarkup:!0,useNative:t.HAS_TOUCH_EVENTS},r});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@odopod/odo-device"),require("@odopod/odo-helpers"),require("@odopod/odo-base-component")):"function"==typeof define&&define.amd?define(["@odopod/odo-device","@odopod/odo-helpers","@odopod/odo-base-component"],e):t.OdoDropdown=e(t.OdoDevice,t.OdoHelpers,t.OdoBaseComponent)}(this,function(t,e,i){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t,i=i&&i.hasOwnProperty("default")?i.default:i;var n=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),s=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},a=0;var r=function(t){function i(o){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n(this,i);var l=s(this,t.call(this,o));return l.options=Object.assign({},i.Defaults,r),l.id="ododropdown-"+(a+=1),l._isOpen=!1,l._select=l.getElementByClass(i.Classes.SELECT),e.giveId(l._select,l.id),l._label=document.querySelector('label[for="'+l._select.id+'"]'),l.options.insertMarkup&&l._insertMarkup(),l._optionsContainer=l.getElementByClass(i.Classes.OPTIONS_CONTAINER),l._button=l.getElementByClass(i.Classes.BUTTON),l._placeholder=l.getElementByClass(i.Classes.DEFAULT),l._valueContainer=l.getElementByClass(i.Classes.VALUE),l._selectedOption=l._getCustomSelectedOption(),l._onSelectChange=l._handleSelectChange.bind(l),l._onPageClick=l._handlePageClick.bind(l),l._onButtonClick=l._showOptions.bind(l),l._onKey=l._handleKey.bind(l),l._transitionId=null,l._initialize(),l}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(i,t),i.prototype._initialize=function(){this._valueContainer.setAttribute("aria-hidden",!0),this.options.useNative?this._initializeNativeDropdown():this._initializeCustomDropdown()},i.prototype._getCustomSelectedOption=function(){return this.getCustomOptions()[this._select.selectedIndex]},i.prototype._insertMarkup=function(){var t=this.getCustomOptionsHtml();this._select.insertAdjacentHTML("beforebegin",t)},i.prototype._initializeNativeDropdown=function(){this.element.classList.add(i.Classes.BASE_NATIVE),this._select.addEventListener("change",this._onSelectChange),this._button.setAttribute("aria-hidden",!0),this._button.tabIndex=-1},i.prototype._initializeCustomDropdown=function(){if(this._label){e.giveId(this._label,this.id+"-label");var t=this._label.id;this._optionsContainer.setAttribute("aria-labelledby",t)}this._select.tabIndex=-1,this._select.setAttribute("aria-hidden",!0),this._button.setAttribute("aria-haspopup","true"),this._button.setAttribute("aria-controls",this._select.id),this._button.setAttribute("aria-expanded",!1),this._toggleButtonListener(!0),this.element.addEventListener("keydown",this._onKey)},i.prototype._handleKey=function(t){var e=t.which;if(this._isOpen)switch(e){case i.Key.ESC:case i.Key.TAB:this._hideOptions();break;case i.Key.DOWN:case i.Key.UP:t.preventDefault(),i._moveFocus(e===i.Key.DOWN);break;case i.Key.SPACE:case i.Key.ENTER:t.preventDefault(),this._selectOption(t.target)}else switch(e){case i.Key.SPACE:case i.Key.DOWN:case i.Key.UP:case i.Key.ENTER:t.preventDefault(),this._showOptions()}},i._moveFocus=function(t){var e=i.Selector.ENABLED_OPTION,n=t?i._nextMatch(document.activeElement,e):i._prevMatch(document.activeElement,e);n&&n.focus()},i._nextMatch=function(t,e){for(;t=t.nextElementSibling;)if(t.matches(e))return t;return null},i._prevMatch=function(t,e){for(;t=t.previousElementSibling;)if(t.matches(e))return t;return null},i.prototype._handlePageClick=function(t){var e=t.target.closest("."+i.Classes.OPTION);e?this._selectOption(e):this._hideOptions()},i.prototype._selectOption=function(t){if(!t.classList.contains(i.Classes.OPTION_DISABLED)&&t.classList.contains(i.Classes.OPTION)){var e=t.getAttribute("data-value");this.value=e,this._hideOptions(),this.emit(i.EventType.CHANGE,{name:this.select.name,value:this.value})}},i.prototype._handleSelectChange=function(){this.value=this._select.value,this.emit(i.EventType.CHANGE,{name:this.select.name,value:this.value})},i.prototype._toggleButtonListener=function(t){t?this._button.addEventListener("click",this._onButtonClick):this._button.removeEventListener("click",this._onButtonClick)},i.prototype._showOptions=function(){this._isOpen=!0,e.cancelTransitionEnd(this._transitionId),this._toggleButtonListener(!1),this.element.classList.add(i.Classes.OPEN),this._optionsContainer.setAttribute("aria-hidden",!1),this._button.setAttribute("aria-expanded",!0),this._button.tabIndex=-1,e.causeLayout(this._optionsContainer),this._optionsContainer.classList.add(i.Classes.OPTIONS_CONTAINER_OPEN),this._transitionId=e.onTransitionEnd(this._optionsContainer,this._handleOptionsShown,this)},i.prototype._handleOptionsShown=function(){document.body.addEventListener("click",this._onPageClick),this._selectedOption&&this._selectedOption.focus()},i.prototype._hideOptions=function(){this._isOpen=!1,e.cancelTransitionEnd(this._transitionId),document.body.removeEventListener("click",this._onPageClick),this._optionsContainer.setAttribute("aria-hidden",!0),this._button.tabIndex=0,this._button.setAttribute("aria-expanded",!1),this._optionsContainer.classList.remove(i.Classes.OPTIONS_CONTAINER_OPEN),this._transitionId=e.onTransitionEnd(this._optionsContainer,this._handleOptionsHidden,this)},i.prototype._handleOptionsHidden=function(){this.element.classList.remove(i.Classes.OPEN),this._button.focus(),this._toggleButtonListener(!0)},i.prototype.getCustomOptionsHtml=function(){return'<div class="'+i.Classes.OPTIONS_CONTAINER+'" role="menu" aria-hidden="true">'+this.getOptionsMarkup()+"</div>"},i.prototype.getOptionsMarkup=function(){var t=this;return this.getNativeOptions().reduce(function(e,i){return e+t.getOptionMarkup(i)},"")},i.prototype.getOptionMarkup=function(t){var e=t.selected?" "+i.Classes.OPTION_SELECTED:"",n=t.disabled?" "+i.Classes.OPTION_DISABLED:"";return'<div class="'+(i.Classes.OPTION+e+n)+'" data-value="'+t.value+'" tabindex="-1" role="menuitem">'+t.text+"</div>"},i.prototype.getCustomOptions=function(){return this.getElementsByClass(i.Classes.OPTION)},i.prototype.getNativeOptions=function(){return Array.from(this.select.options)},i.prototype.getDisplayText=function(t){return this.select.options[t].text},i.prototype.toggleOptionByValue=function(t,e){var n=this._optionsContainer.querySelector('[data-value="'+t+'"]'),o=this._select.querySelector('[value="'+t+'"]');return n.classList.toggle(i.Classes.OPTION_DISABLED,e),e?n.setAttribute("aria-disabled",!0):n.removeAttribute("aria-disabled"),o.disabled=e,this},i.prototype.disableOptionByValue=function(t){return this.toggleOptionByValue(t,!0)},i.prototype.enableOptionByValue=function(t){return this.toggleOptionByValue(t,!1)},i.prototype.dispose=function(){this._select.removeEventListener("change",this._onSelectChange),this._button.removeEventListener("click",this._onButtonClick),document.body.removeEventListener("click",this._onPageClick),this._optionsContainer.parentNode.removeChild(this._optionsContainer),this._select.removeAttribute("tabindex"),this._select.removeAttribute("aria-hidden"),this._button.removeAttribute("tabindex"),this._button.removeAttribute("aria-hidden"),this._button.removeAttribute("aria-haspopup"),this._button.removeAttribute("aria-controls"),this._button.removeAttribute("aria-expanded"),this._selectedOption=null,this._optionsContainer=null,this._button=null,this._placeholder=null,this._valueContainer=null,this._select=null,t.prototype.dispose.call(this)},o(i,[{key:"selectedIndex",get:function(){return this._select.selectedIndex},set:function(t){this.value=this._select.options[t].value}},{key:"select",get:function(){return this._select}},{key:"button",get:function(){return this._button}},{key:"selectedText",get:function(){return this._select.options[this._select.selectedIndex].text}},{key:"value",get:function(){return this._select.value},set:function(t){if(this._selectedOption&&this._selectedOption.classList.remove(i.Classes.OPTION_SELECTED),this._select.value=t,this._selectedOption=this._getCustomSelectedOption(),this._selectedOption){var e=this.getDisplayText(this.selectedIndex);this._selectedOption.classList.add(i.Classes.OPTION_SELECTED),this._placeholder.style.display="none",this._placeholder.setAttribute("aria-hidden",!0),this._valueContainer.textContent=e,this._valueContainer.removeAttribute("aria-hidden")}else this._placeholder.style.display="",this._placeholder.removeAttribute("aria-hidden"),this._valueContainer.textContent="",this._valueContainer.setAttribute("aria-hidden",!0)}},{key:"disabled",get:function(){return this.select.disabled},set:function(t){this.select.disabled=t,this.button.disabled=t}}]),i}(i);return r.Classes={BASE:"odo-dropdown",OPEN:"odo-dropdown--open",BUTTON:"odo-dropdown__button",OPTIONS_CONTAINER_OPEN:"odo-dropdown__options--open",OPTIONS_CONTAINER:"odo-dropdown__options",OPTION:"odo-dropdown__option",OPTION_SELECTED:"odo-dropdown__option--active",OPTION_DISABLED:"odo-dropdown__option--disabled",SELECT:"odo-dropdown__select",VALUE:"odo-dropdown__value",DEFAULT:"odo-dropdown__default",BASE_NATIVE:"odo-dropdown--native"},r.Key={TAB:9,ENTER:13,ESC:27,SPACE:32,UP:38,DOWN:40},r.EventType={CHANGE:"ododropdown:change"},r.Selector={ENABLED_OPTION:"."+r.Classes.OPTION+":not(."+r.Classes.OPTION_DISABLED+")"},r.Defaults={insertMarkup:!0,useNative:t.HAS_TOUCH_EVENTS},r});
//# sourceMappingURL=odo-dropdown.min.js.map
{
"name": "@odopod/odo-dropdown",
"description": "Custom dropdown component that defaults to native select elements on touch devices.",
"version": "1.0.3",
"version": "2.0.0",
"main": "dist/odo-dropdown.js",
"module": "dist/odo-dropdown.esm.js",
"style": "css/odo-dropdown.css",
"odoModule": "src/dropdown.js",
"sideEffects": false,
"author": "Odopod",

@@ -19,5 +21,5 @@ "contributors": [

"dependencies": {
"@odopod/odo-base-component": "^1.1.4",
"@odopod/odo-device": "^1.0.3",
"@odopod/odo-helpers": "^1.0.3"
"@odopod/odo-base-component": "^1.2.0",
"@odopod/odo-device": "^1.1.0",
"@odopod/odo-helpers": "^2.0.0"
},

@@ -28,4 +30,3 @@ "homepage": "https://github.com/odopod/code-library/tree/master/packages/odo-dropdown",

"dist",
"src",
"index.js"
"src"
],

@@ -32,0 +33,0 @@ "odoKeywords": [

import OdoDevice from '@odopod/odo-device';
import { animation, dom, style } from '@odopod/odo-helpers';
import {
cancelTransitionEnd,
causeLayout,
giveId,
onTransitionEnd,
} from '@odopod/odo-helpers';
import OdoBaseComponent from '@odopod/odo-base-component';

@@ -40,3 +45,3 @@

// Give the select an id if it doesn't have one.
dom.giveId(this._select, this.id);
giveId(this._select, this.id);

@@ -122,3 +127,3 @@ /**

if (this._label) {
dom.giveId(this._label, this.id + '-label');
giveId(this._label, this.id + '-label');
const { id } = this._label;

@@ -297,3 +302,3 @@ this._optionsContainer.setAttribute('aria-labelledby', id);

// Clear any pending transition ends.
animation.cancelTransitionEnd(this._transitionId);
cancelTransitionEnd(this._transitionId);

@@ -307,5 +312,5 @@ // Remove click listener on button.

this._button.tabIndex = -1;
style.causeLayout(this._optionsContainer);
causeLayout(this._optionsContainer);
this._optionsContainer.classList.add(Dropdown.Classes.OPTIONS_CONTAINER_OPEN);
this._transitionId = animation.onTransitionEnd(
this._transitionId = onTransitionEnd(
this._optionsContainer,

@@ -335,3 +340,3 @@ this._handleOptionsShown, this,

// Clear any pending transition ends.
animation.cancelTransitionEnd(this._transitionId);
cancelTransitionEnd(this._transitionId);

@@ -343,3 +348,3 @@ document.body.removeEventListener('click', this._onPageClick);

this._optionsContainer.classList.remove(Dropdown.Classes.OPTIONS_CONTAINER_OPEN);
this._transitionId = animation.onTransitionEnd(
this._transitionId = onTransitionEnd(
this._optionsContainer,

@@ -346,0 +351,0 @@ this._handleOptionsHidden, this,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc