Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

butane-combobox

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

butane-combobox - npm Package Compare versions

Comparing version 1.0.0-3 to 1.0.0-4

43

dist/butane-combobox.cjs.js

@@ -7,4 +7,2 @@ 'use strict';

// https://davidwalsh.name/javascript-debounce-function
function setAttributes(el, attrs) {

@@ -67,11 +65,32 @@ for (var key in attrs) {

this.wrapper.appendChild(this.status);
this.handleClicks = this.handleClicks.bind(this);
this.handleKeydown = this.handleKeydown.bind(this);
this.handleInput = this.handleInput.bind(this);
this.addEventListeners();
}
dispose() {
this.removeEventListeners();
this.wrapper.removeChild(this.input);
this.wrapper.removeChild(this.list);
this.wrapper.removeChild(this.status);
this.container.removeChild(this.wrapper);
this.select.removeAttribute('style');
this.select.removeAttribute('aria-hidden');
this.select.removeAttribute('tabindex');
this.select.setAttribute('id', this.id);
}
addEventListeners() {
document.addEventListener('click', e => this.handleClicks(e), false);
document.addEventListener('keydown', e => this.handleKeydown(e), false);
document.addEventListener('input', e => this.handleInput(e), false);
document.addEventListener('click', this.handleClicks, false);
document.addEventListener('keydown', this.handleKeydown, false);
document.addEventListener('input', this.handleInput, false);
}
removeEventListeners() {
document.removeEventListener('click', this.handleClicks, false);
document.removeEventListener('keydown', this.handleKeydown, false);
document.removeEventListener('input', this.handleInput, false);
}
handleClicks(e) {

@@ -147,3 +166,3 @@ if (!e.target.closest('[data-butane-combobox]') && this.menuIsVisible) {

if (this.menuIsVisible) {
this.renderMenuItems(e);
this.renderMenuItems();
} else {

@@ -282,11 +301,7 @@ this.showMenu();

renderMenuItems(event) {
renderMenuItems() {
this.filteredOptions = this.defaultOptions;
this.filteredOptions = matchSorter(
this.defaultOptions,
event ? event.target.value : '',
{
keys: ['label'],
},
);
this.filteredOptions = matchSorter(this.defaultOptions, this.input.value, {
keys: ['label'],
});
if (this.filteredOptions.length) {

@@ -293,0 +308,0 @@ this.list.innerHTML = this.filteredOptions

import matchSorter from 'match-sorter';
// https://davidwalsh.name/javascript-debounce-function
function setAttributes(el, attrs) {

@@ -62,11 +60,32 @@ for (var key in attrs) {

this.wrapper.appendChild(this.status);
this.handleClicks = this.handleClicks.bind(this);
this.handleKeydown = this.handleKeydown.bind(this);
this.handleInput = this.handleInput.bind(this);
this.addEventListeners();
}
dispose() {
this.removeEventListeners();
this.wrapper.removeChild(this.input);
this.wrapper.removeChild(this.list);
this.wrapper.removeChild(this.status);
this.container.removeChild(this.wrapper);
this.select.removeAttribute('style');
this.select.removeAttribute('aria-hidden');
this.select.removeAttribute('tabindex');
this.select.setAttribute('id', this.id);
}
addEventListeners() {
document.addEventListener('click', e => this.handleClicks(e), false);
document.addEventListener('keydown', e => this.handleKeydown(e), false);
document.addEventListener('input', e => this.handleInput(e), false);
document.addEventListener('click', this.handleClicks, false);
document.addEventListener('keydown', this.handleKeydown, false);
document.addEventListener('input', this.handleInput, false);
}
removeEventListeners() {
document.removeEventListener('click', this.handleClicks, false);
document.removeEventListener('keydown', this.handleKeydown, false);
document.removeEventListener('input', this.handleInput, false);
}
handleClicks(e) {

@@ -142,3 +161,3 @@ if (!e.target.closest('[data-butane-combobox]') && this.menuIsVisible) {

if (this.menuIsVisible) {
this.renderMenuItems(e);
this.renderMenuItems();
} else {

@@ -277,11 +296,7 @@ this.showMenu();

renderMenuItems(event) {
renderMenuItems() {
this.filteredOptions = this.defaultOptions;
this.filteredOptions = matchSorter(
this.defaultOptions,
event ? event.target.value : '',
{
keys: ['label'],
},
);
this.filteredOptions = matchSorter(this.defaultOptions, this.input.value, {
keys: ['label'],
});
if (this.filteredOptions.length) {

@@ -288,0 +303,0 @@ this.list.innerHTML = this.filteredOptions

@@ -950,4 +950,2 @@ (function (global, factory) {

// https://davidwalsh.name/javascript-debounce-function
function setAttributes(el, attrs) {

@@ -1010,11 +1008,32 @@ for (var key in attrs) {

this.wrapper.appendChild(this.status);
this.handleClicks = this.handleClicks.bind(this);
this.handleKeydown = this.handleKeydown.bind(this);
this.handleInput = this.handleInput.bind(this);
this.addEventListeners();
}
dispose() {
this.removeEventListeners();
this.wrapper.removeChild(this.input);
this.wrapper.removeChild(this.list);
this.wrapper.removeChild(this.status);
this.container.removeChild(this.wrapper);
this.select.removeAttribute('style');
this.select.removeAttribute('aria-hidden');
this.select.removeAttribute('tabindex');
this.select.setAttribute('id', this.id);
}
addEventListeners() {
document.addEventListener('click', e => this.handleClicks(e), false);
document.addEventListener('keydown', e => this.handleKeydown(e), false);
document.addEventListener('input', e => this.handleInput(e), false);
document.addEventListener('click', this.handleClicks, false);
document.addEventListener('keydown', this.handleKeydown, false);
document.addEventListener('input', this.handleInput, false);
}
removeEventListeners() {
document.removeEventListener('click', this.handleClicks, false);
document.removeEventListener('keydown', this.handleKeydown, false);
document.removeEventListener('input', this.handleInput, false);
}
handleClicks(e) {

@@ -1090,3 +1109,3 @@ if (!e.target.closest('[data-butane-combobox]') && this.menuIsVisible) {

if (this.menuIsVisible) {
this.renderMenuItems(e);
this.renderMenuItems();
} else {

@@ -1225,11 +1244,7 @@ this.showMenu();

renderMenuItems(event) {
renderMenuItems() {
this.filteredOptions = this.defaultOptions;
this.filteredOptions = matchSorter(
this.defaultOptions,
event ? event.target.value : '',
{
keys: ['label'],
},
);
this.filteredOptions = matchSorter(this.defaultOptions, this.input.value, {
keys: ['label'],
});
if (this.filteredOptions.length) {

@@ -1236,0 +1251,0 @@ this.list.innerHTML = this.filteredOptions

{
"name": "butane-combobox",
"version": "1.0.0-3",
"version": "1.0.0-4",
"description": "An accessible combobox/autocomplete library",

@@ -5,0 +5,0 @@ "main": "dist/butane-combobox.cjs.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc