{"version":3,"sources":["../src/elements/fab.ts","../src/styles/elements/fab.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { stylesBase } from '../styles/elements/fab';\n\n/**\n * @since 1.2.0\n * @status stable\n *\n * @tagname kemet-fab\n * @summary The FAB, or Floating Action Button, performs a primary action on a page.\n *\n * @prop {boolean} expanded - The expanded state of the button.\n * @prop {boolean} outlined - Outline style for a button.\n * @prop {boolean} disabled - Determines whether not a button is disabled.\n * @prop {boolean} pill - Displays the fab with rounded corners.\n * @prop {number} expandPoint - The distance, in pixels, where the fab should automatically expand.\n * @prop {number} collapsePoint - The distance, in pixels, where the fab should automatically collapse.\n *\n * @slot Icon - A slot for an icon to display.\n * @slot default - The text for the FAB.\n *\n * @cssproperty --kemet-fab-size - The width and height of the fab.\n * @cssproperty --kemet-fab-color - The text color of the fab.\n * @cssproperty --kemet-fab-background-color - The bg color of the tab.\n * @cssproperty --kemet-fab-outlined-color - The text color of an outlined fab.\n * @cssproperty --kemet-fab-outlined-border - The border of an outlined fab.\n * @cssproperty --kemet-fab-pill-radius - The border radius of a pill fab.\n *\n * @csspart button - The button's container.\n * @csspart icon -  The FAB icon.\n * @csspart text - The text in the FAB.\n *\n */\n\n@customElement('kemet-fab')\nexport default class KemetFAB extends LitElement {\n  static styles = [stylesBase];\n\n  @property({ type: Boolean, reflect: true })\n  expanded: boolean = false;\n\n  @property({ type: Boolean, reflect: true })\n  outlined: boolean = false;\n\n  @property({ type: Boolean, reflect: true })\n  disabled: boolean = false;\n\n  @property({ type: Boolean, reflect: true })\n  pill: boolean;\n\n  @property({ type: Number, attribute: 'expand-point' })\n  expandPoint: number;\n\n  @property({ type: Number, attribute: 'collapse-point' })\n  collapsePoint: number;\n\n  firstUpdated() {\n    // events\n    window.addEventListener('scroll', this.handleScroll.bind(this));\n    this.addEventListener('mouseover', this.handleMouseOver.bind(this));\n    this.addEventListener('mouseout', this.handleMouseOut.bind(this));\n  }\n\n  render() {\n    return html`\n      <button class=\"button\" part=\"button\" ?disabled=${this.disabled}>\n        <span class=\"icon\" part=\"icon\">\n          <slot name=\"icon\"></slot>\n        </span>\n        <span class=\"text\" part=\"text\">\n          <slot></slot>\n        </span>\n      </button>\n    `;\n  }\n\n  handleMouseOver() {\n    if (!this.disabled) {\n      this.expanded = true;\n    }\n  }\n\n  handleMouseOut() {\n    if (!this.disabled) {\n      this.expanded = false;\n    }\n  }\n\n  handleScroll() {\n    if (window.scrollY > this.expandPoint && window.scrollY < this.collapsePoint) {\n      this.expanded = true;\n    } else {\n      this.expanded = false;\n    }\n  }\n}\n\ndeclare global {\n  interface HTMLElementTagNameMap {\n    'kemet-fab': KemetFAB\n  }\n}\n","import { css } from 'lit';\n\nexport const stylesBase = css`\n  :host {\n    --kemet-fab-size: 50px;\n    --kemet-fab-color: rgb(var(--kemet-color-white));\n    --kemet-fab-background-color: rgb(var(--kemet-color-primary));\n    --kemet-fab-outlined-color: rgb(var(--kemet-color-foreground));\n    --kemet-fab-outlined-border: 1px solid rgb(var(--kemet-color-foreground));\n    --kemet-fab-pill-radius: 10rem;\n    --kemet-fab-background-color: rgb(var(--kemet-color-primary));\n    --kemet-fab-outline-border: 1px solid rgb(var(--kemet-color-primary));\n    --kemet-fab-color: rgb(var(--kemet-color-white));\n    --kemet-fab-outlined-color: rgb(var(--kemet-color-foreground));\n\n    display: inline-block;\n    position: relative;\n  }\n\n  button {\n    color: var(--kemet-fab-color);\n    font-size: inherit;\n    display: inline-flex;\n    padding: 0;\n    position: relative;\n    min-height: var(--kemet-fab-size);\n    min-width: var(--kemet-fab-size);\n    max-width: var(--kemet-fab-size);\n    align-items: center;\n    justify-content: flex-start;\n    transition: all 0.4s ease;\n    border: none;\n    background-color: var(--kemet-fab-background-color);\n  }\n\n  :host([outlined]) button {\n    color: var(--kemet-fab-outlined-color);\n    border: var(--kemet-fab-outlined-border);\n    background-color: transparent;\n  }\n\n  :host([pill]) button {\n    border-radius: var(--kemet-fab-pill-radius);\n  }\n\n  button::before {\n    content: '';\n    position: absolute;\n    top: 0;\n    left: 0;\n    right: 0;\n    bottom: 0;\n    z-index: -1;\n    width: 100%;\n    height: 100%;\n    transition: background-color 0.3s ease-in-out;\n    background-color: var(--kemet-fab-background-color);\n  }\n\n  :host([pill]) button::before {\n    border-radius: var(--kemet-fab-pill-radius);\n  }\n\n  :host([outlined]) button::before {\n    border: var(--kemet-fab-outline-border);\n    background-color: transparent;\n  }\n\n  :host([expanded]) button {\n    max-width: 99rem;\n    padding: 0 1.35rem 0 0.25rem;\n  }\n\n  :host([disabled]) button {\n    opacity: 0.5;\n    cursor: not-allowed;\n  }\n\n  .icon {\n    width: var(--kemet-fab-size);\n    height: var(--kemet-fab-size);\n    display: flex;\n    flex: 0 0 auto;\n    align-items: center;\n    justify-content: center;\n  }\n\n  .text {\n    color: var(--kemet-fab-color);\n    z-index: 1;\n    white-space: nowrap;\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity 0.2s ease-in-out;\n  }\n\n  :host([outlined]) .text {\n    color: var(--kemet-fab-outlined-color);\n  }\n\n  :host([expanded]) .text {\n    opacity: 1;\n  }\n`;\n"],"mappings":";;;;;AAAA,SAAS,MAAM,kBAAkB;AACjC,SAAS,eAAe,gBAAgB;;;ACDxC,SAAS,WAAW;AAEb,IAAM,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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