-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Radoslav Karaivanov <rkaraivanov@infragistics.com> Co-authored-by: sivanova <sivanova@infragistics.com> Co-authored-by: Silvia Ivanova <59446295+SisIvanova@users.noreply.github.com> Co-authored-by: Simeon Simeonoff <sim.simeonoff@gmail.com>
- Loading branch information
1 parent
841674b
commit 6fa846c
Showing
23 changed files
with
1,844 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { html, LitElement } from 'lit'; | ||
import { createCounter } from '../common/util.js'; | ||
import { styles } from './themes/light/tab-panel.base.css.js'; | ||
|
||
/** | ||
* Represents the content of a tab | ||
* | ||
* @element igc-tab-panel | ||
* | ||
* @slot - Renders the content. | ||
*/ | ||
export default class IgcTabPanelComponent extends LitElement { | ||
public static readonly tagName = 'igc-tab-panel'; | ||
|
||
public static override styles = styles; | ||
|
||
private static readonly increment = createCounter(); | ||
|
||
public override connectedCallback() { | ||
this.setAttribute('role', 'tabpanel'); | ||
this.tabIndex = this.hasAttribute('tabindex') ? this.tabIndex : 0; | ||
this.slot = this.slot.length > 0 ? this.slot : 'panel'; | ||
this.id = | ||
this.id.length > 0 | ||
? this.id | ||
: `igc-tab-panel-${IgcTabPanelComponent.increment()}`; | ||
} | ||
|
||
protected override render() { | ||
return html`<slot></slot>`; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'igc-tab-panel': IgcTabPanelComponent; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { html, LitElement } from 'lit'; | ||
import { property, query } from 'lit/decorators.js'; | ||
import { themes } from '../../theming/theming-decorator.js'; | ||
import { createCounter } from '../common/util.js'; | ||
import { styles } from './themes/light/tab.base.css.js'; | ||
import { styles as bootstrap } from './themes/light/tab.bootstrap.css.js'; | ||
import { styles as fluent } from './themes/light/tab.fluent.css.js'; | ||
import { styles as indigo } from './themes/light/tab.indigo.css.js'; | ||
|
||
/** | ||
* Represents the tab header. | ||
* | ||
* @element igc-tab | ||
* | ||
* @slot prefix - Renders before the tab header content. | ||
* @slot - Renders the tab header content. | ||
* @slot suffix - Renders after the tab header content. | ||
* | ||
* @csspart content - The content wrapper. | ||
* @csspart prefix - The prefix wrapper. | ||
* @csspart suffix - The suffix wrapper. | ||
*/ | ||
@themes({ bootstrap, fluent, indigo }) | ||
export default class IgcTabComponent extends LitElement { | ||
public static readonly tagName = 'igc-tab'; | ||
|
||
public static override styles = styles; | ||
|
||
private static readonly increment = createCounter(); | ||
|
||
@query('[part="base"]', true) | ||
private tab!: HTMLElement; | ||
|
||
/** The id of the tab panel which will be controlled by the tab. */ | ||
@property({ type: String }) | ||
public panel = ''; | ||
|
||
/** Determines whether the tab is selected. */ | ||
@property({ type: Boolean, reflect: true }) | ||
public selected = false; | ||
|
||
/** Determines whether the tab is disabled. */ | ||
@property({ type: Boolean, reflect: true }) | ||
public disabled = false; | ||
|
||
public override connectedCallback(): void { | ||
super.connectedCallback(); | ||
this.id = | ||
this.id.length > 0 ? this.id : `igc-tab-${IgcTabComponent.increment()}`; | ||
} | ||
|
||
/** Sets focus to the tab. */ | ||
public override focus(options?: FocusOptions) { | ||
this.tab.focus(options); | ||
} | ||
|
||
/** Removes focus from the tab. */ | ||
public override blur() { | ||
this.tab.blur(); | ||
} | ||
|
||
protected override render() { | ||
return html` | ||
<div | ||
part="base" | ||
role="tab" | ||
aria-disabled=${this.disabled ? 'true' : 'false'} | ||
aria-selected=${this.selected ? 'true' : 'false'} | ||
tabindex=${this.disabled || !this.selected ? -1 : 0} | ||
> | ||
<slot name="prefix" part="prefix"></slot> | ||
<div part="content"> | ||
<slot></slot> | ||
</div> | ||
<slot name="suffix" part="suffix"></slot> | ||
</div> | ||
`; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'igc-tab': IgcTabComponent; | ||
} | ||
} |
Oops, something went wrong.