Skip to content

Commit

Permalink
Merge pull request #566 from IgniteUI/simeonoff/combo
Browse files Browse the repository at this point in the history
Feat: Combo Component
  • Loading branch information
kdinev authored Dec 7, 2022
2 parents 303cef9 + 49be5a6 commit bf62c37
Show file tree
Hide file tree
Showing 47 changed files with 2,924 additions and 98 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Added
- Stepper Component [#219](https://github.com/IgniteUI/igniteui-webcomponents/issues/219)
- Combo Component [#411](https://github.com/IgniteUI/igniteui-webcomponents/issues/411)

## [4.0.0] - 2022-11-02
### Changed
Expand Down
25 changes: 23 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
},
"dependencies": {
"@floating-ui/dom": "^1.0.7",
"@lit-labs/virtualizer": "^0.7.2",
"lit": "^2.4.1"
},
"devDependencies": {
Expand Down
4 changes: 3 additions & 1 deletion scripts/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"circular progress",
"checkbox",
"chip",
"combo",
"date input",
"dropdown",
"expansion panel",
Expand All @@ -55,6 +56,7 @@
],
"dependencies": {
"@floating-ui/dom": "^1.0.7",
"lit": "^2.4.1"
"lit": "^2.4.1",
"@lit-labs/virtualizer": "^0.7.2"
}
}
20 changes: 20 additions & 0 deletions src/components/combo/combo-header.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { html, LitElement } from 'lit';
import { themes } from '../../theming/theming-decorator.js';
import { styles } from './themes/light/header/combo-header.base.css.js';
import { styles as bootstrap } from '../dropdown/themes/light/dropdown-header.bootstrap.css.js';
import { styles as fluent } from '../dropdown/themes/light/dropdown-header.fluent.css.js';

@themes({ bootstrap, fluent })
export default class IgcComboHeaderComponent extends LitElement {
public static readonly tagName: string = 'igc-combo-header';
public static override styles = styles;

protected override render() {
return html`<slot></slot>`;
}
}
declare global {
interface HTMLElementTagNameMap {
'igc-combo-header': IgcComboHeaderComponent;
}
}
67 changes: 67 additions & 0 deletions src/components/combo/combo-item.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { html, LitElement } from 'lit';
import { themes } from '../../theming/theming-decorator.js';
import { styles } from './themes/light/item/combo-item.base.css.js';
import { styles as bootstrap } from '../dropdown/themes/light/dropdown-item.bootstrap.css.js';
import { styles as fluent } from '../dropdown/themes/light/dropdown-item.fluent.css.js';
import { styles as indigo } from '../dropdown/themes/light/dropdown-item.indigo.css.js';
import { property } from 'lit/decorators.js';
import { watch } from '../common/decorators/watch.js';
import IgcCheckboxComopnent from '../checkbox/checkbox.js';
import { defineComponents } from '../common/definitions/defineComponents.js';

defineComponents(IgcCheckboxComopnent);

@themes({ bootstrap, fluent, indigo })
export default class IgcComboItemComponent extends LitElement {
public static readonly tagName: string = 'igc-combo-item';
public static override styles = styles;

@property({ attribute: false })
public index!: number;

/**
* Determines whether the item is selected.
*/
@property({ type: Boolean, reflect: true })
public selected = false;

/**
* Determines whether the item is active.
*/
@property({ type: Boolean, reflect: true })
public active = false;

@watch('selected')
protected selectedChange() {
this.selected
? this.setAttribute('aria-selected', 'true')
: this.removeAttribute('aria-selected');
}

public override connectedCallback() {
super.connectedCallback();
this.setAttribute('role', 'option');
}

protected override render() {
return html`
<section part="prefix">
<igc-checkbox
aria-hidden="true"
?checked=${this.selected}
tabindex="-1"
exportparts="control: checkbox, indicator: checkbox-indicator, checked"
></igc-checkbox>
</section>
<section id="content" part="content">
<slot></slot>
</section>
`;
}
}

declare global {
interface HTMLElementTagNameMap {
'igc-combo-item': IgcComboItemComponent;
}
}
18 changes: 18 additions & 0 deletions src/components/combo/combo-list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { LitVirtualizer } from '@lit-labs/virtualizer';

export default class IgcComboListComponent extends LitVirtualizer {
public static readonly tagName = 'igc-combo-list';
public override scroller = true;

public override connectedCallback() {
super.connectedCallback();
this.setAttribute('tabindex', '0');
this.setAttribute('role', 'listbox');
}
}

declare global {
interface HTMLElementTagNameMap {
'igc-combo-list': IgcComboListComponent;
}
}
Loading

0 comments on commit bf62c37

Please sign in to comment.