/** * Copyright Aquera Inc 2023 * * This source code is licensed under the BSD-3-Clause license found in the * LICENSE file in the root directory of this source tree. */ import { LitElement, CSSResultArray, TemplateResult, html, } from 'lit'; import { customElement, property } from 'lit/decorators.js'; import { styles } from './nile-icon-button.css'; import '../nile-icon'; import { classMap } from 'lit/directives/class-map.js'; import { query, state } from 'lit/decorators.js'; import { literal } from 'lit/static-html.js'; import { ifDefined } from 'lit/directives/if-defined.js'; import type { CSSResultGroup } from 'lit'; import NileElement from '../internal/nile-element'; /** * @summary Icons buttons are simple, icon-only buttons that can be used for actions and in toolbars. * @status stable * @since 2.0 * * @dependency nile-icon * * @event nile-blur - Emitted when the icon button loses focus. * @event nile-focus - Emitted when the icon button gains focus. * * @csspart base - The component's base wrapper. */ /** * Nile icon component. * * @tag nile-icon-button * */ @customElement('nile-icon-button') export class NileIconButton extends NileElement { static styles: CSSResultGroup = styles; @query('.icon-button') button: HTMLButtonElement | HTMLLinkElement; @state() private hasFocus = false; /** The name of the icon to draw. Available names depend on the icon library being used. */ @property() name?: string; /** The name of a registered custom icon library. */ @property() library?: string; /** * An external URL of an SVG file. Be sure you trust the content you are including, as it will be executed as code and * can result in XSS attacks. */ @property() src?: string; /** When set, the underlying button will be rendered as an `` with this `href` instead of a ` `; } } } export default NileIconButton; declare global { interface HTMLElementTagNameMap { 'nile-icon-button': NileIconButton; } }