import { SlotController } from '@roenlie/mimic-lit/controllers'; import { customElement, MimicElement } from '@roenlie/mimic-lit/element'; import { sharedStyles } from '@roenlie/mimic-lit/styles'; import { css, html } from 'lit'; import { property, query } from 'lit/decorators.js'; import { ifDefined } from 'lit/directives/if-defined.js'; import { when } from 'lit/directives/when.js'; import { MMRipple } from '../ripple/ripple-element.js'; MMRipple.register(); /** * @property href - sets the href of the base anchor wrapper inside the component. * @property target - sets the target of the base anchor wrapper inside the component. * @property active - sets the item to active state, changing the component styling. * @property type - changes the styling of the component between the bare and outlined style. * @property role - by default makes the component generate an anchor tag as the base element. * If set to `button` a `, () => html` ${ this.itemContent() } `) } `; } //#endregion //#region style public static override styles = [ sharedStyles, css` :host { display: block; --mm-nav-item-height-default: 80px; height: var(--mm-nav-item-height, var(--mm-nav-item-height-default)); } :host(:focus-visible) { outline: var(--mm-focus-ring); outline-offset: var(--mm-focus-offset); transition: var(--mm-focus-transition); z-index: var(--mm-focus-index); border-radius: var(--mm-border-radius-m); } .wrapper { position: relative; display: flex; flex-flow: column nowrap; align-items: stretch; justify-content: center; height: 100%; width: 72px; gap: 4px; } .interact { content: ''; position: absolute; inset: 0; } .icon { align-self: center; cursor: pointer; position: relative; display: grid; place-items: center; width: 56px; height: 32px; border-radius: 32px; overflow: hidden; } .icon::before { content: ''; position: absolute; inset: 0; border-radius: inherit; } :host mm-ripple { --ripple-bg: var(--mm-on-primary-press); } :host([active]) .icon { background-color: var(--mm-primary); color: var(--mm-on-primary); } @media (pointer: fine) { .interact:hover ~ .icon, .icon:hover { color: var(--mm-on-primary); } .interact:hover ~ .icon::before, .icon:hover::before { background-color: var(--mm-primary-hover); } :host([active]) .interact:hover ~ .icon::before, :host([active]) .icon:hover::before { background-color: var(--mm-primary-hover); } } :host([type="outlined"]) .icon { border: 2px solid var(--mm-outline-variant); } .text { color: var(--mm-on-background); display: grid; text-align: center; } `, ]; //#endregion } declare global { interface HTMLElementTagNameMap { 'mm-nav-rail-item': MMNavRailItem; } }