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

@vaadin/combo-box

Package Overview
Dependencies
Maintainers
19
Versions
408
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vaadin/combo-box - npm Package Compare versions

Comparing version 22.0.0-beta1 to 22.0.0-beta2

27

package.json
{
"name": "@vaadin/combo-box",
"version": "22.0.0-beta1",
"version": "22.0.0-beta2",
"publishConfig": {

@@ -34,23 +34,24 @@ "access": "public"

"dependencies": {
"@open-wc/dedupe-mixin": "^1.3.0",
"@polymer/iron-resizable-behavior": "^3.0.0",
"@polymer/polymer": "^3.0.0",
"@vaadin/component-base": "22.0.0-beta1",
"@vaadin/field-base": "22.0.0-beta1",
"@vaadin/input-container": "22.0.0-beta1",
"@vaadin/item": "22.0.0-beta1",
"@vaadin/vaadin-lumo-styles": "22.0.0-beta1",
"@vaadin/vaadin-material-styles": "22.0.0-beta1",
"@vaadin/vaadin-overlay": "22.0.0-beta1",
"@vaadin/vaadin-themable-mixin": "22.0.0-beta1"
"@vaadin/component-base": "22.0.0-beta2",
"@vaadin/field-base": "22.0.0-beta2",
"@vaadin/input-container": "22.0.0-beta2",
"@vaadin/item": "22.0.0-beta2",
"@vaadin/vaadin-lumo-styles": "22.0.0-beta2",
"@vaadin/vaadin-material-styles": "22.0.0-beta2",
"@vaadin/vaadin-overlay": "22.0.0-beta2",
"@vaadin/vaadin-themable-mixin": "22.0.0-beta2"
},
"devDependencies": {
"@esm-bundle/chai": "^4.3.4",
"@vaadin/dialog": "22.0.0-beta1",
"@vaadin/polymer-legacy-adapter": "22.0.0-beta1",
"@vaadin/dialog": "22.0.0-beta2",
"@vaadin/polymer-legacy-adapter": "22.0.0-beta2",
"@vaadin/testing-helpers": "^0.3.0",
"@vaadin/text-field": "22.0.0-beta1",
"@vaadin/text-field": "22.0.0-beta2",
"lit": "^2.0.0",
"sinon": "^9.2.0"
},
"gitHead": "4cf8a9d0504994200c610e44b3676114fef49c1e"
"gitHead": "f13833683e6667f6ca6678452db14aa6b7eac4a4"
}

@@ -1,11 +0,8 @@

# <vaadin-combo-box>
# @vaadin/combo-box
[Live Demo ↗](https://vaadin.com/components/vaadin-combo-box/html-examples)
|
[API documentation ↗](https://vaadin.com/components/vaadin-combo-box/html-api)
A web component for choosing a value from a filterable list of options presented in an overlay.
[<vaadin-combo-box>](https://vaadin.com/components/vaadin-combo-box) is a Web Component combining a dropdown list with an input field for filtering the list of items, part of the [Vaadin components](https://vaadin.com/components).
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/ds/components/combo-box)
[![npm version](https://badgen.net/npm/v/@vaadin/combo-box)](https://www.npmjs.com/package/@vaadin/combo-box)
[![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0.svg)](https://vaadin.com/directory/component/vaadinvaadin-combo-box)
[![Discord](https://img.shields.io/discord/732335336448852018?label=discord)](https://discord.gg/PHmkCKC)

@@ -30,42 +27,41 @@

[<img src="https://raw.githubusercontent.com/vaadin/vaadin-combo-box/master/screenshot.png" width="208" alt="Screenshot of vaadin-combo-box" />](https://vaadin.com/components/vaadin-combo-box)
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/combo-box/screenshot.png" width="208" alt="Screenshot of vaadin-combo-box">](https://vaadin.com/docs/latest/ds/components/combo-box)
## Installation
Install `vaadin-combo-box`:
Install the component:
```sh
npm i @vaadin/combo-box --save
npm i @vaadin/combo-box
```
Once installed, import it in your application:
Once installed, import the component in your application:
```js
import '@vaadin/combo-box/vaadin-combo-box.js';
import '@vaadin/combo-box';
```
## Getting Started
## Themes
Vaadin components use the Lumo theme by default.
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/ds/customization/using-themes), Lumo and Material.
The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/combo-box/vaadin-combo-box.js) of the package uses the Lumo theme.
To use the Material theme, import the correspondent file from the `theme/material` folder.
To use the Material theme, import the component from the `theme/material` folder:
## Entry points
```js
import '@vaadin/combo-box/theme/material/vaadin-combo-box.js';
```
- The components with the Lumo theme:
You can also import the Lumo version of the component explicitly:
`theme/lumo/vaadin-combo-box.js`
`theme/lumo/vaadin-combo-box-light.js`
```js
import '@vaadin/combo-box/theme/lumo/vaadin-combo-box.js';
```
- The components with the Material theme:
Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
`theme/material/vaadin-combo-box.js`
`theme/material/vaadin-combo-box-light.js`
```js
import '@vaadin/combo-box/src/vaadin-combo-box.js';
```
- Alias for `theme/lumo/vaadin-combo-box.js`
`theme/lumo/vaadin-combo-box-light.js`
`vaadin-combo-box.js`
`vaadin-combo-box-light.js`
## Contributing

@@ -79,2 +75,3 @@

Vaadin collects development time usage statistics to improve this product. For details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.
Vaadin collects usage statistics at development time to improve this product.
For details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.

@@ -6,2 +6,3 @@ /**

*/
import { Constructor } from '@open-wc/dedupe-mixin';

@@ -21,11 +22,7 @@ export type ComboBoxDataProviderCallback<TItem> = (items: Array<TItem>, size: number) => void;

declare function ComboBoxDataProviderMixin<TItem, T extends new (...args: any[]) => {}>(
export declare function ComboBoxDataProviderMixin<TItem, T extends Constructor<HTMLElement>>(
base: T
): T & ComboBoxDataProviderMixinConstructor<TItem>;
): T & Constructor<ComboBoxDataProviderMixinClass<TItem>>;
interface ComboBoxDataProviderMixinConstructor<TItem> {
new (...args: any[]): ComboBoxDataProviderMixin<TItem>;
}
interface ComboBoxDataProviderMixin<TItem> {
export declare class ComboBoxDataProviderMixinClass<TItem> {
/**

@@ -62,3 +59,1 @@ * Number of items fetched at a time from the dataprovider.

}
export { ComboBoxDataProviderMixin, ComboBoxDataProviderMixinConstructor };

@@ -6,8 +6,8 @@ /**

*/
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
import { mixinBehaviors } from '@polymer/polymer/lib/legacy/class.js';
import { IronResizableBehavior } from '@polymer/iron-resizable-behavior/iron-resizable-behavior.js';
import './vaadin-combo-box-item.js';
import './vaadin-combo-box-overlay.js';
import './vaadin-combo-box-scroller.js';
import { IronResizableBehavior } from '@polymer/iron-resizable-behavior/iron-resizable-behavior.js';
import { mixinBehaviors } from '@polymer/polymer/lib/legacy/class.js';
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';

@@ -14,0 +14,0 @@ const TOUCH_DEVICE = (() => {

@@ -6,3 +6,3 @@ /**

*/
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';

@@ -9,0 +9,0 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';

@@ -6,5 +6,5 @@ /**

*/
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
import { ComboBoxDataProviderMixin } from './vaadin-combo-box-data-provider-mixin.js';
import { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import { ComboBoxDataProviderMixinClass } from './vaadin-combo-box-data-provider-mixin.js';
import { ComboBoxMixinClass } from './vaadin-combo-box-mixin.js';
import { ComboBoxDefaultItem } from './vaadin-combo-box-mixin.js';

@@ -129,5 +129,5 @@ export {

interface ComboBoxLight<TItem = ComboBoxDefaultItem>
extends ComboBoxDataProviderMixin<TItem>,
ComboBoxMixin<TItem>,
ThemableMixin {}
extends ComboBoxDataProviderMixinClass<TItem>,
ComboBoxMixinClass<TItem>,
ThemableMixinClass {}

@@ -134,0 +134,0 @@ declare global {

@@ -6,8 +6,8 @@ /**

*/
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
import './vaadin-combo-box-dropdown.js';
import { dashToCamelCase } from '@polymer/polymer/lib/utils/case-map.js';
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import { ComboBoxDataProviderMixin } from './vaadin-combo-box-data-provider-mixin.js';
import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
import { ComboBoxDataProviderMixin } from './vaadin-combo-box-data-provider-mixin.js';
import './vaadin-combo-box-dropdown.js';

@@ -14,0 +14,0 @@ /**

@@ -6,5 +6,6 @@ /**

*/
import { DisabledMixin } from '@vaadin/component-base/src/disabled-mixin.js';
import { KeyboardMixin } from '@vaadin/component-base/src/keyboard-mixin.js';
import { InputMixin } from '@vaadin/field-base/src/input-mixin.js';
import { Constructor } from '@open-wc/dedupe-mixin';
import { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
import { KeyboardMixinClass } from '@vaadin/component-base/src/keyboard-mixin.js';
import { InputMixinClass } from '@vaadin/field-base/src/input-mixin.js';
import { ComboBox } from './vaadin-combo-box.js';

@@ -25,13 +26,19 @@

declare function ComboBoxMixin<TItem, T extends new (...args: any[]) => {}>(
export declare function ComboBoxMixin<TItem, T extends Constructor<HTMLElement>>(
base: T
): T & ComboBoxMixinConstructor<TItem>;
): T &
Constructor<ComboBoxMixinClass<TItem>> &
Constructor<DisabledMixinClass> &
Constructor<InputMixinClass> &
Constructor<KeyboardMixinClass>;
interface ComboBoxMixinConstructor<TItem> {
new (...args: any[]): ComboBoxMixin<TItem>;
}
export declare class ComboBoxMixinClass<TItem> {
protected readonly _propertyForValue: string;
interface ComboBoxMixin<TItem> extends DisabledMixin, InputMixin, KeyboardMixin {
readonly _propertyForValue: string;
protected _inputElementValue: string | undefined;
protected _revertInputValue(): void;
protected _getItemElements(): HTMLElement[];
/**

@@ -178,3 +185,1 @@ * True if the dropdown is open, false otherwise.

}
export { ComboBoxMixin, ComboBoxMixinConstructor };

@@ -933,2 +933,10 @@ /**

: this._indexOfValue(this.value, this.filteredItems);
// see https://github.com/vaadin/web-components/issues/2615
if (this.selectedItem === null && this._focusedIndex >= 0) {
const filteredItem = this.filteredItems[this._focusedIndex];
if (this._getItemValue(filteredItem) === this.value) {
this._selectItemForValue(this.value);
}
}
}

@@ -935,0 +943,0 @@ }

@@ -7,4 +7,4 @@ /**

import { OverlayElement } from '@vaadin/vaadin-overlay/src/vaadin-overlay.js';
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
import { PositionMixin } from '@vaadin/vaadin-overlay/src/vaadin-overlay-position-mixin.js';
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';

@@ -11,0 +11,0 @@ registerStyles(

@@ -6,3 +6,3 @@ /**

*/
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
import { Virtualizer } from '@vaadin/component-base/src/virtualizer.js';

@@ -9,0 +9,0 @@ import { ComboBoxPlaceholder } from './vaadin-combo-box-placeholder.js';

@@ -6,8 +6,8 @@ /**

*/
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
import { InputControlMixin } from '@vaadin/field-base/src/input-control-mixin.js';
import { PatternMixin } from '@vaadin/field-base/src/pattern-mixin.js';
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import { ComboBoxDataProviderMixin } from './vaadin-combo-box-data-provider-mixin.js';
import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
import { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
import { InputControlMixinClass } from '@vaadin/field-base/src/input-control-mixin.js';
import { PatternMixinClass } from '@vaadin/field-base/src/pattern-mixin.js';
import { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import { ComboBoxDataProviderMixinClass } from './vaadin-combo-box-data-provider-mixin.js';
import { ComboBoxMixinClass } from './vaadin-combo-box-mixin.js';
import { ComboBoxDefaultItem } from './vaadin-combo-box-mixin.js';

@@ -224,8 +224,8 @@ export {

interface ComboBox<TItem = ComboBoxDefaultItem>
extends ComboBoxDataProviderMixin<TItem>,
ComboBoxMixin<TItem>,
PatternMixin,
InputControlMixin,
ThemableMixin,
ElementMixin {}
extends ComboBoxDataProviderMixinClass<TItem>,
ComboBoxMixinClass<TItem>,
PatternMixinClass,
InputControlMixinClass,
ThemableMixinClass,
ElementMixinClass {}

@@ -232,0 +232,0 @@ declare global {

@@ -6,15 +6,14 @@ /**

*/
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
import '@vaadin/input-container/src/vaadin-input-container.js';
import './vaadin-combo-box-dropdown.js';
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
import { AriaLabelController } from '@vaadin/field-base/src/aria-label-controller.js';
import { InputControlMixin } from '@vaadin/field-base/src/input-control-mixin.js';
import { InputController } from '@vaadin/field-base/src/input-controller.js';
import { InputControlMixin } from '@vaadin/field-base/src/input-control-mixin.js';
import { PatternMixin } from '@vaadin/field-base/src/pattern-mixin.js';
import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import { registerStyles } from '@vaadin/vaadin-themable-mixin/register-styles.js';
import '@vaadin/input-container/src/vaadin-input-container.js';
import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import { ComboBoxDataProviderMixin } from './vaadin-combo-box-data-provider-mixin.js';
import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
import './vaadin-combo-box-dropdown.js';

@@ -21,0 +20,0 @@ registerStyles('vaadin-combo-box', inputFieldShared, { moduleId: 'vaadin-combo-box-styles' });

@@ -1,8 +0,8 @@

import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
import '@vaadin/vaadin-lumo-styles/color.js';
import '@vaadin/vaadin-lumo-styles/spacing.js';
import '@vaadin/vaadin-lumo-styles/style.js';
import { overlay } from '@vaadin/vaadin-lumo-styles/mixins/overlay.js';
import '@vaadin/vaadin-overlay/theme/lumo/vaadin-overlay.js';
import { menuOverlayCore } from '@vaadin/vaadin-lumo-styles/mixins/menu-overlay.js';
import { overlay } from '@vaadin/vaadin-lumo-styles/mixins/overlay.js';
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';

@@ -9,0 +9,0 @@ const comboBoxOverlay = css`

@@ -1,16 +0,10 @@

import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
import { item } from '@vaadin/item/theme/lumo/vaadin-item-styles.js';
import '@vaadin/vaadin-lumo-styles/color.js';
import '@vaadin/vaadin-lumo-styles/spacing.js';
import '@vaadin/vaadin-lumo-styles/style.js';
import { item } from '@vaadin/item/theme/lumo/vaadin-item-styles.js';
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
/* TODO partly duplicated from vaadin-list-box styles. Should find a way to make it DRY */
const comboBoxItem = css`
:host {
cursor: default;
-webkit-tap-highlight-color: var(--lumo-primary-color-10pct);
padding-left: calc(var(--lumo-border-radius-m) / 4);
padding-right: calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4);
transition: background-color 100ms;
border-radius: var(--lumo-border-radius-m);
overflow: hidden;

@@ -20,25 +14,7 @@ --_lumo-item-selected-icon-display: block;

:host(:hover) {
background-color: var(--lumo-primary-color-10pct);
}
:host([focused]:not([disabled])) {
box-shadow: inset 0 0 0 2px var(--lumo-primary-color-50pct);
}
@media (pointer: coarse) {
:host(:hover) {
background-color: transparent;
}
@media (any-hover: hover) {
:host([focused]:not([disabled])) {
box-shadow: none;
box-shadow: inset 0 0 0 2px var(--lumo-primary-color-50pct);
}
}
/* RTL specific styles */
:host([dir='rtl']) {
padding-right: calc(var(--lumo-border-radius-m) / 4);
padding-left: calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4);
}
`;

@@ -45,0 +21,0 @@

@@ -1,4 +0,4 @@

import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
import '@vaadin/vaadin-lumo-styles/font-icons.js';
import { inputFieldShared } from '@vaadin/vaadin-lumo-styles/mixins/input-field-shared.js';
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';

@@ -5,0 +5,0 @@ const comboBox = css`

@@ -1,4 +0,4 @@

import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
import '@vaadin/vaadin-material-styles/color.js';
import { menuOverlay } from '@vaadin/vaadin-material-styles/mixins/menu-overlay.js';
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';

@@ -5,0 +5,0 @@ const comboBoxOverlay = css`

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

import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
import '@vaadin/vaadin-material-styles/color.js';

@@ -6,2 +5,3 @@ import '@vaadin/vaadin-material-styles/font-icons.js';

import { item } from '@vaadin/item/theme/material/vaadin-item-styles.js';
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';

@@ -13,21 +13,4 @@ const comboBoxItem = css`

padding: 4px 10px;
min-height: 36px;
font-size: var(--material-small-font-size);
--_material-item-selected-icon-display: block;
}
:host(:hover) {
background-color: var(--material-secondary-background-color);
}
:host([focused]) {
background-color: var(--material-divider-color);
}
@media (pointer: coarse) {
:host(:hover),
:host([focused]) {
background-color: transparent;
}
}
`;

@@ -34,0 +17,0 @@

@@ -1,5 +0,5 @@

import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
import '@vaadin/vaadin-material-styles/color.js';
import '@vaadin/vaadin-material-styles/font-icons.js';
import { inputFieldShared } from '@vaadin/vaadin-material-styles/mixins/input-field-shared.js';
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';

@@ -6,0 +6,0 @@ const comboBox = css`

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