igniteui-webcomponents
Version:
Ignite UI for Web Components is a complete library of UI components, giving you the ability to build modern web applications using encapsulation and the concept of reusable components in a dependency-free approach.
78 lines • 3.12 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var IgcComboItemComponent_1;
import { LitElement, html, nothing } from 'lit';
import { property } from 'lit/decorators.js';
import { themes } from '../../theming/theming-decorator.js';
import IgcCheckboxComponent from '../checkbox/checkbox.js';
import { registerComponent } from '../common/definitions/register.js';
import { all } from '../dropdown/themes/item.js';
import { styles as shared } from '../dropdown/themes/shared/item/dropdown-item.common.css.js';
import { styles } from './themes/combo-item.base.css.js';
let IgcComboItemComponent = IgcComboItemComponent_1 = class IgcComboItemComponent extends LitElement {
static register() {
registerComponent(IgcComboItemComponent_1, IgcCheckboxComponent);
}
set selected(value) {
this._selected = value;
this._internals.ariaSelected = this._selected.toString();
}
get selected() {
return this._selected;
}
constructor() {
super();
this._selected = false;
this.active = false;
this.hideCheckbox = false;
this._internals = this.attachInternals();
this._internals.role = 'option';
this._internals.ariaSelected = 'false';
}
connectedCallback() {
super.connectedCallback();
this.setAttribute('role', 'option');
}
renderCheckbox() {
return html `
<section part="prefix">
<igc-checkbox
.inert=${true}
?checked=${this.selected}
exportparts="control: checkbox, indicator: checkbox-indicator, checked"
></igc-checkbox>
</section>
`;
}
render() {
return html `
${!this.hideCheckbox ? this.renderCheckbox() : nothing}
<section id="content" part="content">
<slot></slot>
</section>
`;
}
};
IgcComboItemComponent.tagName = 'igc-combo-item';
IgcComboItemComponent.styles = [styles, shared];
__decorate([
property({ attribute: false })
], IgcComboItemComponent.prototype, "index", void 0);
__decorate([
property({ type: Boolean, reflect: true })
], IgcComboItemComponent.prototype, "selected", null);
__decorate([
property({ type: Boolean, reflect: true })
], IgcComboItemComponent.prototype, "active", void 0);
__decorate([
property({ type: Boolean, attribute: 'hide-checkbox' })
], IgcComboItemComponent.prototype, "hideCheckbox", void 0);
IgcComboItemComponent = IgcComboItemComponent_1 = __decorate([
themes(all)
], IgcComboItemComponent);
export default IgcComboItemComponent;
//# sourceMappingURL=combo-item.js.map