@justeattakeaway/pie-button
Advanced tools
Comparing version 0.0.0-snapshot-release-20240411081540 to 0.0.0-snapshot-release-20240412121709
@@ -320,2 +320,9 @@ { | ||
{ | ||
"kind": "field", | ||
"name": "_iconSlotElement", | ||
"type": { | ||
"text": "Array<HTMLElement>" | ||
} | ||
}, | ||
{ | ||
"kind": "method", | ||
@@ -322,0 +329,0 @@ "name": "_simulateNativeButtonClick", |
@@ -118,2 +118,3 @@ import type { CSSResult } from 'lit'; | ||
responsiveSize?: ButtonProps['responsiveSize']; | ||
_iconSlotElement: Array<HTMLElement>; | ||
/** | ||
@@ -120,0 +121,0 @@ * This method creates an invisible button of the same type as pie-button. It is then clicked, and immediately removed from the DOM. |
@@ -1,7 +0,7 @@ | ||
import { LitElement as zt, html as N, nothing as B, unsafeCSS as Ct } from "lit"; | ||
import { property as m } from "lit/decorators.js"; | ||
import { ifDefined as St } from "lit/directives/if-defined.js"; | ||
import { LitElement as Mt, html as N, nothing as B, unsafeCSS as Ct } from "lit"; | ||
import { property as p, queryAssignedElements as St } from "lit/decorators.js"; | ||
import { ifDefined as At } from "lit/directives/if-defined.js"; | ||
import { FormControlMixin as Ft, validPropertyValues as P, defineCustomElement as Lt } from "@justeattakeaway/pie-webc-core"; | ||
import "@justeattakeaway/pie-spinner"; | ||
const At = ["xsmall", "small-productive", "small-expressive", "medium", "large"], Bt = ["productive", "expressive"], It = ["submit", "button", "reset"], Tt = [ | ||
const It = ["xsmall", "small-productive", "small-expressive", "medium", "large"], Kt = ["productive", "expressive"], Tt = ["submit", "button", "reset"], Vt = [ | ||
"primary", | ||
@@ -16,7 +16,7 @@ "secondary", | ||
"destructive-ghost" | ||
], Vt = ["leading", "trailing"], Kt = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], Ut = ["post", "get", "dialog"], qt = ["_self", "_blank", "_parent", "_top"], Nt = `*,*:after,*:before{box-sizing:inherit}.o-btn{--btn-border-radius: var(--dt-radius-rounded-e);--btn-font-family: var(--dt-font-interactive-l-family);--btn-font-weight: var(--dt-font-interactive-l-weight);--btn-bg-color: var(--dt-color-interactive-brand);--btn-text-color: var(--dt-color-content-interactive-primary);--btn-height--xsmall: 32px;--btn-height--small: 40px;--btn-height--medium: 48px;--btn-height--large: 56px;--icon-display-override: block;position:relative;display:flex;gap:var(--dt-spacing-b);align-items:center;justify-content:center;height:var(--btn-height);padding:var(--btn-padding);border:none;border-radius:var(--btn-border-radius);outline:none;background-color:var(--btn-bg-color);font-family:var(--btn-font-family);font-size:var(--btn-font-size);font-weight:var(--btn-font-weight);color:var(--btn-text-color);line-height:var(--btn-line-height);cursor:pointer;-webkit-user-select:none;user-select:none;inline-size:var(--btn-inline-size)}.o-btn[variant=primary]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--btn-bg-color: hsl(var(--dt-color-interactive-brand-h), var(--dt-color-interactive-brand-s), calc(var(--dt-color-interactive-brand-l) + var(--hover-modifier)))}.o-btn[variant=primary]:active:not(:disabled),.o-btn[variant=primary][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--btn-bg-color: hsl(var(--dt-color-interactive-brand-h), var(--dt-color-interactive-brand-s), calc(var(--dt-color-interactive-brand-l) + var(--active-modifier)))}.o-btn[variant=primary][size=xsmall],.o-btn[variant=primary][size=small-productive]{--btn-bg-color: var(--dt-color-interactive-primary)}.o-btn[variant=primary][size=xsmall]:hover:not(:disabled),.o-btn[variant=primary][size=small-productive]:hover:not(:disabled){--hover-modifier: var(--dt-color-hover-02);--btn-bg-color: hsl(var(--dt-color-interactive-primary-h), var(--dt-color-interactive-primary-s), calc(var(--dt-color-interactive-primary-l) + var(--hover-modifier)))}.o-btn[variant=primary][size=xsmall]:active:not(:disabled),.o-btn[variant=primary][size=xsmall][isLoading]:not(:disabled),.o-btn[variant=primary][size=small-productive]:active:not(:disabled),.o-btn[variant=primary][size=small-productive][isLoading]:not(:disabled){--active-modifier: var(--dt-color-active-02);--btn-bg-color: hsl(var(--dt-color-interactive-primary-h), var(--dt-color-interactive-primary-s), calc(var(--dt-color-interactive-primary-l) + var(--active-modifier)))}.o-btn[variant=secondary]{--btn-bg-color: var(--dt-color-interactive-secondary);--btn-text-color: var(--dt-color-content-interactive-secondary)}.o-btn[variant=secondary]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--btn-bg-color: hsl(var(--dt-color-interactive-secondary-h), var(--dt-color-interactive-secondary-s), calc(var(--dt-color-interactive-secondary-l) + var(--hover-modifier)))}.o-btn[variant=secondary]:active:not(:disabled),.o-btn[variant=secondary][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--btn-bg-color: hsl(var(--dt-color-interactive-secondary-h), var(--dt-color-interactive-secondary-s), calc(var(--dt-color-interactive-secondary-l) + var(--active-modifier)))}.o-btn[variant=outline]{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-interactive-secondary);border:1px solid var(--dt-color-border-strong)}.o-btn[variant=outline]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--hover-modifier: var(--dt-color-hover-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--hover-modifier))}.o-btn[variant=outline]:active:not(:disabled),.o-btn[variant=outline][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--active-modifier: var(--dt-color-active-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--active-modifier))}.o-btn[variant=ghost]{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-link)}.o-btn[variant=ghost]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--hover-modifier: var(--dt-color-hover-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--hover-modifier))}.o-btn[variant=ghost]:active:not(:disabled),.o-btn[variant=ghost][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--active-modifier: var(--dt-color-active-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--active-modifier))}.o-btn[variant=inverse]{--btn-bg-color: var(--dt-color-interactive-inverse);--btn-text-color: var(--dt-color-content-interactive-secondary)}.o-btn[variant=inverse]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--btn-bg-color: hsl(var(--dt-color-interactive-inverse-h), var(--dt-color-interactive-inverse-s), calc(var(--dt-color-interactive-inverse-l) + var(--hover-modifier)))}.o-btn[variant=inverse]:active:not(:disabled),.o-btn[variant=inverse][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--btn-bg-color: hsl(var(--dt-color-interactive-inverse-h), var(--dt-color-interactive-inverse-s), calc(var(--dt-color-interactive-inverse-l) + var(--active-modifier)))}.o-btn[variant=ghost-inverse],.o-btn[variant=outline-inverse]{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-interactive-primary)}.o-btn[variant=ghost-inverse]:hover:not(:disabled),.o-btn[variant=outline-inverse]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--hover-modifier: var(--dt-color-hover-01);--btn-bg-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), var(--dt-color-container-default-l), var(--hover-modifier))}.o-btn[variant=ghost-inverse]:active:not(:disabled),.o-btn[variant=ghost-inverse][isLoading]:not(:disabled),.o-btn[variant=outline-inverse]:active:not(:disabled),.o-btn[variant=outline-inverse][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--active-modifier: var(--dt-color-active-01);--btn-bg-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), var(--dt-color-container-default-l), var(--active-modifier))}.o-btn[variant=outline-inverse]:not([disabled]){border:1px solid var(--dt-color-border-strong)}.o-btn[variant=destructive]{--btn-bg-color: var(--dt-color-support-error)}.o-btn[variant=destructive]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--btn-bg-color: hsl(var(--dt-color-support-error-h), var(--dt-color-support-error-s), calc(var(--dt-color-support-error-l) + var(--hover-modifier)))}.o-btn[variant=destructive]:active:not(:disabled),.o-btn[variant=destructive][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--btn-bg-color: hsl(var(--dt-color-support-error-h), var(--dt-color-support-error-s), calc(var(--dt-color-support-error-l) + var(--active-modifier)))}.o-btn[variant=destructive-ghost]{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-interactive-error)}.o-btn[variant=destructive-ghost]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--hover-modifier: var(--dt-color-hover-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--hover-modifier))}.o-btn[variant=destructive-ghost]:active:not(:disabled),.o-btn[variant=destructive-ghost][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--active-modifier: var(--dt-color-active-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--active-modifier))}.o-btn[isFullWidth]{--btn-inline-size: 100%}.o-btn[disabled]{--btn-text-color: var(--dt-color-content-disabled) !important;cursor:not-allowed}.o-btn[disabled]:not([variant=ghost],[variant=ghost-inverse],[variant=destructive-ghost]){--btn-bg-color: var(--dt-color-disabled-01) !important}.o-btn[disabled][variant=outline]{border-color:var(--dt-color-disabled-01)!important}.o-btn[size=xsmall]{--btn-height: var(--btn-height--xsmall);--btn-padding: 6px var(--dt-spacing-b);--btn-font-size: calc(var(--dt-font-size-14) * 1px);--btn-line-height: calc(var(--dt-font-size-14-line-height) * 1px);--icon-size-override: 16px}@media (min-width: 768px){.o-btn[size=xsmall][isResponsive]{--btn-height: var(--btn-height--small);--btn-padding: 8px var(--dt-spacing-d);--btn-font-size: calc(var(--dt-font-size-16) * 1px);--btn-line-height: calc(var(--dt-font-size-16-line-height) * 1px);--icon-size-override: 20px}.o-btn[size=xsmall][isResponsive][responsiveSize=expressive]{--btn-height: var(--btn-height--small);--btn-padding: 6px var(--dt-spacing-d);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--icon-size-override: 20px}}.o-btn[size=small-expressive]{--btn-height: var(--btn-height--small);--btn-padding: 6px var(--dt-spacing-d);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--icon-size-override: 20px}@media (min-width: 768px){.o-btn[size=small-expressive][isResponsive]{--btn-height: var(--btn-height--medium);--btn-padding: 10px var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--icon-size-override: 24px}}.o-btn[size=small-productive]{--btn-height: var(--btn-height--small);--btn-padding: 8px var(--dt-spacing-d);--btn-font-size: calc(var(--dt-font-size-16) * 1px);--btn-line-height: calc(var(--dt-font-size-16-line-height) * 1px);--icon-size-override: 20px}@media (min-width: 768px){.o-btn[size=small-productive][isResponsive]{--btn-height: var(--btn-height--medium);--btn-padding: 10px var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--icon-size-override: 24px}}.o-btn[size=medium]{--btn-height: var(--btn-height--medium);--btn-padding: 10px var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--icon-size-override: 24px}@media (min-width: 768px){.o-btn[size=medium][isResponsive]{--btn-height: var(--btn-height--large);--btn-padding: 14px var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--icon-size-override: 24px}}.o-btn[size=large]{--btn-height: var(--btn-height--large);--btn-padding: 14px var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--icon-size-override: 24px}.o-btn[isLoading]>*:not(pie-spinner){visibility:hidden}.o-btn[isLoading] pie-spinner{position:absolute}.o-btn:focus-visible{box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}::slotted(svg){height:var(--icon-size-override);width:var(--icon-size-override)} | ||
], Nt = ["leading", "trailing"], qt = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], Ut = ["post", "get", "dialog"], jt = ["_self", "_blank", "_parent", "_top"], Pt = `*,*:after,*:before{box-sizing:inherit}.o-btn{--btn-border-radius: var(--dt-radius-rounded-e);--btn-font-family: var(--dt-font-interactive-l-family);--btn-font-weight: var(--dt-font-interactive-l-weight);--btn-bg-color: var(--dt-color-interactive-brand);--btn-text-color: var(--dt-color-content-interactive-primary);--btn-height--xsmall: 32px;--btn-height--small: 40px;--btn-height--medium: 48px;--btn-height--large: 56px;--icon-display-override: block;position:relative;display:flex;gap:var(--dt-spacing-b);align-items:center;justify-content:center;height:var(--btn-height);padding:var(--btn-padding);border:none;border-radius:var(--btn-border-radius);outline:none;background-color:var(--btn-bg-color);font-family:var(--btn-font-family);font-size:var(--btn-font-size);font-weight:var(--btn-font-weight);color:var(--btn-text-color);line-height:var(--btn-line-height);cursor:pointer;-webkit-user-select:none;user-select:none;inline-size:var(--btn-inline-size)}.o-btn[variant=primary]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--btn-bg-color: hsl(var(--dt-color-interactive-brand-h), var(--dt-color-interactive-brand-s), calc(var(--dt-color-interactive-brand-l) + var(--hover-modifier)))}.o-btn[variant=primary]:active:not(:disabled),.o-btn[variant=primary][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--btn-bg-color: hsl(var(--dt-color-interactive-brand-h), var(--dt-color-interactive-brand-s), calc(var(--dt-color-interactive-brand-l) + var(--active-modifier)))}.o-btn[variant=primary][size=xsmall],.o-btn[variant=primary][size=small-productive]{--btn-bg-color: var(--dt-color-interactive-primary)}.o-btn[variant=primary][size=xsmall]:hover:not(:disabled),.o-btn[variant=primary][size=small-productive]:hover:not(:disabled){--hover-modifier: var(--dt-color-hover-02);--btn-bg-color: hsl(var(--dt-color-interactive-primary-h), var(--dt-color-interactive-primary-s), calc(var(--dt-color-interactive-primary-l) + var(--hover-modifier)))}.o-btn[variant=primary][size=xsmall]:active:not(:disabled),.o-btn[variant=primary][size=xsmall][isLoading]:not(:disabled),.o-btn[variant=primary][size=small-productive]:active:not(:disabled),.o-btn[variant=primary][size=small-productive][isLoading]:not(:disabled){--active-modifier: var(--dt-color-active-02);--btn-bg-color: hsl(var(--dt-color-interactive-primary-h), var(--dt-color-interactive-primary-s), calc(var(--dt-color-interactive-primary-l) + var(--active-modifier)))}.o-btn[variant=secondary]{--btn-bg-color: var(--dt-color-interactive-secondary);--btn-text-color: var(--dt-color-content-interactive-secondary)}.o-btn[variant=secondary]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--btn-bg-color: hsl(var(--dt-color-interactive-secondary-h), var(--dt-color-interactive-secondary-s), calc(var(--dt-color-interactive-secondary-l) + var(--hover-modifier)))}.o-btn[variant=secondary]:active:not(:disabled),.o-btn[variant=secondary][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--btn-bg-color: hsl(var(--dt-color-interactive-secondary-h), var(--dt-color-interactive-secondary-s), calc(var(--dt-color-interactive-secondary-l) + var(--active-modifier)))}.o-btn[variant=outline]{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-interactive-secondary);border:1px solid var(--dt-color-border-strong)}.o-btn[variant=outline]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--hover-modifier: var(--dt-color-hover-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--hover-modifier))}.o-btn[variant=outline]:active:not(:disabled),.o-btn[variant=outline][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--active-modifier: var(--dt-color-active-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--active-modifier))}.o-btn[variant=ghost]{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-link)}.o-btn[variant=ghost]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--hover-modifier: var(--dt-color-hover-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--hover-modifier))}.o-btn[variant=ghost]:active:not(:disabled),.o-btn[variant=ghost][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--active-modifier: var(--dt-color-active-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--active-modifier))}.o-btn[variant=inverse]{--btn-bg-color: var(--dt-color-interactive-inverse);--btn-text-color: var(--dt-color-content-interactive-secondary)}.o-btn[variant=inverse]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--btn-bg-color: hsl(var(--dt-color-interactive-inverse-h), var(--dt-color-interactive-inverse-s), calc(var(--dt-color-interactive-inverse-l) + var(--hover-modifier)))}.o-btn[variant=inverse]:active:not(:disabled),.o-btn[variant=inverse][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--btn-bg-color: hsl(var(--dt-color-interactive-inverse-h), var(--dt-color-interactive-inverse-s), calc(var(--dt-color-interactive-inverse-l) + var(--active-modifier)))}.o-btn[variant=ghost-inverse],.o-btn[variant=outline-inverse]{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-interactive-primary)}.o-btn[variant=ghost-inverse]:hover:not(:disabled),.o-btn[variant=outline-inverse]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--hover-modifier: var(--dt-color-hover-01);--btn-bg-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), var(--dt-color-container-default-l), var(--hover-modifier))}.o-btn[variant=ghost-inverse]:active:not(:disabled),.o-btn[variant=ghost-inverse][isLoading]:not(:disabled),.o-btn[variant=outline-inverse]:active:not(:disabled),.o-btn[variant=outline-inverse][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--active-modifier: var(--dt-color-active-01);--btn-bg-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), var(--dt-color-container-default-l), var(--active-modifier))}.o-btn[variant=outline-inverse]:not([disabled]){border:1px solid var(--dt-color-border-strong)}.o-btn[variant=destructive]{--btn-bg-color: var(--dt-color-support-error)}.o-btn[variant=destructive]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--btn-bg-color: hsl(var(--dt-color-support-error-h), var(--dt-color-support-error-s), calc(var(--dt-color-support-error-l) + var(--hover-modifier)))}.o-btn[variant=destructive]:active:not(:disabled),.o-btn[variant=destructive][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--btn-bg-color: hsl(var(--dt-color-support-error-h), var(--dt-color-support-error-s), calc(var(--dt-color-support-error-l) + var(--active-modifier)))}.o-btn[variant=destructive-ghost]{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-interactive-error)}.o-btn[variant=destructive-ghost]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--hover-modifier: var(--dt-color-hover-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--hover-modifier))}.o-btn[variant=destructive-ghost]:active:not(:disabled),.o-btn[variant=destructive-ghost][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--active-modifier: var(--dt-color-active-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--active-modifier))}.o-btn[isFullWidth]{--btn-inline-size: 100%}.o-btn[disabled]{--btn-text-color: var(--dt-color-content-disabled) !important;cursor:not-allowed}.o-btn[disabled]:not([variant=ghost],[variant=ghost-inverse],[variant=destructive-ghost]){--btn-bg-color: var(--dt-color-disabled-01) !important}.o-btn[disabled][variant=outline]{border-color:var(--dt-color-disabled-01)!important}.o-btn[size=xsmall]{--btn-height: var(--btn-height--xsmall);--btn-padding: 6px var(--dt-spacing-b);--btn-font-size: calc(var(--dt-font-size-14) * 1px);--btn-line-height: calc(var(--dt-font-size-14-line-height) * 1px);--icon-size-override: 16px}@media (min-width: 768px){.o-btn[size=xsmall][isResponsive]{--btn-height: var(--btn-height--small);--btn-padding: 8px var(--dt-spacing-d);--btn-font-size: calc(var(--dt-font-size-16) * 1px);--btn-line-height: calc(var(--dt-font-size-16-line-height) * 1px);--icon-size-override: 20px}.o-btn[size=xsmall][isResponsive][responsiveSize=expressive]{--btn-height: var(--btn-height--small);--btn-padding: 6px var(--dt-spacing-d);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--icon-size-override: 20px}}.o-btn[size=small-expressive]{--btn-height: var(--btn-height--small);--btn-padding: 6px var(--dt-spacing-d);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--icon-size-override: 20px}@media (min-width: 768px){.o-btn[size=small-expressive][isResponsive]{--btn-height: var(--btn-height--medium);--btn-padding: 10px var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--icon-size-override: 24px}}.o-btn[size=small-productive]{--btn-height: var(--btn-height--small);--btn-padding: 8px var(--dt-spacing-d);--btn-font-size: calc(var(--dt-font-size-16) * 1px);--btn-line-height: calc(var(--dt-font-size-16-line-height) * 1px);--icon-size-override: 20px}@media (min-width: 768px){.o-btn[size=small-productive][isResponsive]{--btn-height: var(--btn-height--medium);--btn-padding: 10px var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--icon-size-override: 24px}}.o-btn[size=medium]{--btn-height: var(--btn-height--medium);--btn-padding: 10px var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--icon-size-override: 24px}@media (min-width: 768px){.o-btn[size=medium][isResponsive]{--btn-height: var(--btn-height--large);--btn-padding: 14px var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--icon-size-override: 24px}}.o-btn[size=large]{--btn-height: var(--btn-height--large);--btn-padding: 14px var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--icon-size-override: 24px}.o-btn[isLoading]>*:not(pie-spinner){visibility:hidden}.o-btn[isLoading] pie-spinner{position:absolute}.o-btn:focus-visible{box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}::slotted(svg){height:var(--icon-size-override);width:var(--icon-size-override)} | ||
`; | ||
(function() { | ||
(function(E) { | ||
const a = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), A = { | ||
const n = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), L = { | ||
ariaAtomic: "aria-atomic", | ||
@@ -64,6 +64,6 @@ ariaAutoComplete: "aria-autocomplete", | ||
}, ct = (e, t) => { | ||
for (let i in A) { | ||
for (let i in L) { | ||
t[i] = null; | ||
let r = null; | ||
const o = A[i]; | ||
const o = L[i]; | ||
Object.defineProperty(t, i, { | ||
@@ -74,3 +74,3 @@ get() { | ||
set(s) { | ||
r = s, e.isConnected ? e.setAttribute(o, s) : F.set(e, t); | ||
r = s, e.isConnected ? e.setAttribute(o, s) : A.set(e, t); | ||
} | ||
@@ -94,3 +94,3 @@ }); | ||
r.formDisabledCallback && o && D(r, e.disabled), r = i.nextNode(); | ||
}, Q = { attributes: !0, attributeFilter: ["disabled", "name"] }, k = V() ? new MutationObserver((e) => { | ||
}, Q = { attributes: !0, attributeFilter: ["disabled", "name"] }, z = V() ? new MutationObserver((e) => { | ||
for (const t of e) { | ||
@@ -109,12 +109,12 @@ const i = t.target; | ||
var u; | ||
if (c.has(l) && l.constructor.formAssociated && G(l), F.has(l)) { | ||
if (c.has(l) && l.constructor.formAssociated && G(l), A.has(l)) { | ||
const d = A.get(l); | ||
Object.keys(L).filter((g) => d[g] !== null).forEach((g) => { | ||
l.setAttribute(L[g], d[g]); | ||
}), A.delete(l); | ||
} | ||
if (F.has(l)) { | ||
const d = F.get(l); | ||
Object.keys(A).filter((g) => d[g] !== null).forEach((g) => { | ||
l.setAttribute(A[g], d[g]); | ||
}), F.delete(l); | ||
l.setAttribute("internals-valid", d.validity.valid.toString()), l.setAttribute("internals-invalid", (!d.validity.valid).toString()), l.setAttribute("aria-invalid", (!d.validity.valid).toString()), F.delete(l); | ||
} | ||
if (L.has(l)) { | ||
const d = L.get(l); | ||
l.setAttribute("internals-valid", d.validity.valid.toString()), l.setAttribute("internals-invalid", (!d.validity.valid).toString()), l.setAttribute("aria-invalid", (!d.validity.valid).toString()), L.delete(l); | ||
} | ||
if (l.localName === "form") { | ||
@@ -130,6 +130,6 @@ const d = b.get(l), x = document.createTreeWalker(l, NodeFilter.SHOW_ELEMENT, { | ||
} | ||
l.localName === "fieldset" && ((u = k.observe) == null || u.call(k, l, Q), J(l, !0)); | ||
l.localName === "fieldset" && ((u = z.observe) == null || u.call(z, l, Q), J(l, !0)); | ||
}), s.forEach((l) => { | ||
const u = c.get(l); | ||
u && h.get(u) && X(u), M.has(l) && M.get(l).disconnect(); | ||
u && h.get(u) && X(u), k.has(l) && k.get(l).disconnect(); | ||
}); | ||
@@ -142,3 +142,3 @@ }); | ||
i.forEach((r) => { | ||
const o = q.get(t.target); | ||
const o = U.get(t.target); | ||
c.has(r) && it(r), o.disconnect(); | ||
@@ -151,3 +151,3 @@ }); | ||
const t = new MutationObserver(dt); | ||
(i = window == null ? void 0 : window.ShadyDOM) != null && i.inUse && e.mode && e.host && (e = e.host), (r = t.observe) == null || r.call(t, e, { childList: !0 }), q.set(e, t); | ||
(i = window == null ? void 0 : window.ShadyDOM) != null && i.inUse && e.mode && e.host && (e = e.host), (r = t.observe) == null || r.call(t, e, { childList: !0 }), U.set(e, t); | ||
}; | ||
@@ -169,3 +169,3 @@ V() && new MutationObserver(R); | ||
var i; | ||
h.set(t, []), (i = k.observe) == null || i.call(k, e, Q); | ||
h.set(t, []), (i = z.observe) == null || i.call(z, e, Q); | ||
}, Z = (e, t) => { | ||
@@ -291,6 +291,6 @@ if (t.length) { | ||
} | ||
var z; | ||
var M; | ||
class Et { | ||
constructor(t) { | ||
z.set(this, void 0), xt(this, z, t, "f"); | ||
M.set(this, void 0), xt(this, M, t, "f"); | ||
for (let i = 0; i < t.length; i++) { | ||
@@ -303,6 +303,6 @@ let r = t[i]; | ||
get length() { | ||
return ot(this, z, "f").length; | ||
return ot(this, M, "f").length; | ||
} | ||
[(z = /* @__PURE__ */ new WeakMap(), Symbol.iterator)]() { | ||
return ot(this, z, "f")[Symbol.iterator](); | ||
[(M = /* @__PURE__ */ new WeakMap(), Symbol.iterator)]() { | ||
return ot(this, M, "f")[Symbol.iterator](); | ||
} | ||
@@ -316,3 +316,3 @@ item(t) { | ||
} | ||
function kt() { | ||
function zt() { | ||
const e = HTMLFormElement.prototype.checkValidity; | ||
@@ -349,9 +349,9 @@ HTMLFormElement.prototype.checkValidity = i; | ||
const i = t.getRootNode(), r = new bt(); | ||
this.states = new $(t), a.set(this, t), n.set(this, r), c.set(t, this), ct(t, this), ht(t, this), Object.seal(this), i instanceof DocumentFragment && vt(i); | ||
this.states = new $(t), n.set(this, t), a.set(this, r), c.set(t, this), ct(t, this), ht(t, this), Object.seal(this), i instanceof DocumentFragment && vt(i); | ||
} | ||
checkValidity() { | ||
const t = a.get(this); | ||
const t = n.get(this); | ||
if (w(t, "Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate) | ||
return !0; | ||
const i = n.get(this); | ||
const i = a.get(this); | ||
if (!i.valid) { | ||
@@ -368,3 +368,3 @@ const r = new Event("invalid", { | ||
get form() { | ||
const t = a.get(this); | ||
const t = n.get(this); | ||
w(t, "Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element."); | ||
@@ -375,3 +375,3 @@ let i; | ||
get labels() { | ||
const t = a.get(this); | ||
const t = n.get(this); | ||
w(t, "Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element."); | ||
@@ -382,6 +382,6 @@ const i = t.getAttribute("id"), r = t.getRootNode(); | ||
reportValidity() { | ||
const t = a.get(this); | ||
const t = n.get(this); | ||
if (w(t, "Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate) | ||
return !0; | ||
const i = this.checkValidity(), r = U.get(this); | ||
const i = this.checkValidity(), r = q.get(this); | ||
if (r && !t.constructor.formAssociated) | ||
@@ -392,3 +392,3 @@ throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."); | ||
setFormValue(t) { | ||
const i = a.get(this); | ||
const i = n.get(this); | ||
if (w(i, "Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."), X(this), t != null && !(t instanceof FormData)) { | ||
@@ -409,7 +409,7 @@ if (i.getAttribute("name")) { | ||
setValidity(t, i, r) { | ||
const o = a.get(this); | ||
const o = n.get(this); | ||
if (w(o, "Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !t) | ||
throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present."); | ||
U.set(this, r); | ||
const s = n.get(this), l = {}; | ||
q.set(this, r); | ||
const s = a.get(this), l = {}; | ||
for (const x in t) | ||
@@ -423,22 +423,22 @@ l[x] = t[x]; | ||
throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true."); | ||
f.set(this, d ? "" : i), o.isConnected ? (o.toggleAttribute("internals-invalid", !d), o.toggleAttribute("internals-valid", d), o.setAttribute("aria-invalid", `${!d}`)) : L.set(o, this); | ||
f.set(this, d ? "" : i), o.isConnected ? (o.toggleAttribute("internals-invalid", !d), o.toggleAttribute("internals-valid", d), o.setAttribute("aria-invalid", `${!d}`)) : F.set(o, this); | ||
} | ||
get shadowRoot() { | ||
const t = a.get(this), i = K.get(t); | ||
const t = n.get(this), i = K.get(t); | ||
return i || null; | ||
} | ||
get validationMessage() { | ||
const t = a.get(this); | ||
const t = n.get(this); | ||
return w(t, "Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."), f.get(this); | ||
} | ||
get validity() { | ||
const t = a.get(this); | ||
return w(t, "Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."), n.get(this); | ||
const t = n.get(this); | ||
return w(t, "Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."), a.get(this); | ||
} | ||
get willValidate() { | ||
const t = a.get(this); | ||
const t = n.get(this); | ||
return w(t, "Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."), !(t.disabled || t.hasAttribute("disabled") || t.hasAttribute("readonly")); | ||
} | ||
} | ||
function Mt() { | ||
function kt() { | ||
if (typeof window > "u" || !window.ElementInternals || !HTMLElement.prototype.attachInternals) | ||
@@ -502,3 +502,3 @@ return !1; | ||
const s = new MutationObserver(R); | ||
window.ShadyDOM ? s.observe(this, _) : s.observe(o, _), M.set(this, s); | ||
window.ShadyDOM ? s.observe(this, _) : s.observe(o, _), k.set(this, s); | ||
} | ||
@@ -510,24 +510,24 @@ return o; | ||
} | ||
V() && typeof document < "u" && new MutationObserver(R).observe(document.documentElement, _), typeof HTMLFormElement < "u" && kt(), (e || typeof window < "u" && !window.CustomStateSet) && W(); | ||
V() && typeof document < "u" && new MutationObserver(R).observe(document.documentElement, _), typeof HTMLFormElement < "u" && zt(), (e || typeof window < "u" && !window.CustomStateSet) && W(); | ||
} | ||
} | ||
return !!customElements.polyfillWrapFlushCallback || (Mt() ? typeof window < "u" && !window.CustomStateSet && W(HTMLElement.prototype.attachInternals) : lt(!1)), E.forceCustomStateSetPolyfill = W, E.forceElementInternalsPolyfill = lt, Object.defineProperty(E, "__esModule", { value: !0 }), E; | ||
return !!customElements.polyfillWrapFlushCallback || (kt() ? typeof window < "u" && !window.CustomStateSet && W(HTMLElement.prototype.attachInternals) : lt(!1)), E.forceCustomStateSetPolyfill = W, E.forceElementInternalsPolyfill = lt, Object.defineProperty(E, "__esModule", { value: !0 }), E; | ||
})({}); | ||
})(); | ||
var Pt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, p = (E, a, n, h) => { | ||
for (var c = h > 1 ? void 0 : h ? Rt(a, n) : a, f = E.length - 1, y; f >= 0; f--) | ||
(y = E[f]) && (c = (h ? y(a, n, c) : y(c)) || c); | ||
return h && c && Pt(a, n, c), c; | ||
var Rt = Object.defineProperty, _t = Object.getOwnPropertyDescriptor, m = (E, n, a, h) => { | ||
for (var c = h > 1 ? void 0 : h ? _t(n, a) : n, f = E.length - 1, y; f >= 0; f--) | ||
(y = E[f]) && (c = (h ? y(n, a, c) : y(c)) || c); | ||
return h && c && Rt(n, a, c), c; | ||
}; | ||
const C = "pie-button"; | ||
class v extends Ft(zt) { | ||
class v extends Ft(Mt) { | ||
constructor() { | ||
super(...arguments), this.size = "medium", this.type = "submit", this.variant = "primary", this.iconPlacement = "leading", this.disabled = !1, this.isLoading = !1, this.isFullWidth = !1, this.isResponsive = !1, this._handleFormKeyDown = (a) => { | ||
if (!(a.key !== "Enter" || this.type !== "submit" || this.disabled)) { | ||
if (a.target instanceof HTMLElement) { | ||
const n = a.target.tagName.toLowerCase(); | ||
if (n === "button" || n === "pie-button") | ||
super(...arguments), this.size = "medium", this.type = "submit", this.variant = "primary", this.iconPlacement = "leading", this.disabled = !1, this.isLoading = !1, this.isFullWidth = !1, this.isResponsive = !1, this._handleFormKeyDown = (n) => { | ||
if (!(n.key !== "Enter" || this.type !== "submit" || this.disabled)) { | ||
if (n.target instanceof HTMLElement) { | ||
const a = n.target.tagName.toLowerCase(); | ||
if (a === "button" || a === "pie-button") | ||
return; | ||
} | ||
a.preventDefault(), this._handleClick(); | ||
n.preventDefault(), this._handleClick(); | ||
} | ||
@@ -537,12 +537,14 @@ }; | ||
connectedCallback() { | ||
var a; | ||
super.connectedCallback(), this.type === "submit" && ((a = this.form) == null || a.addEventListener("keydown", this._handleFormKeyDown)); | ||
var n; | ||
super.connectedCallback(), this.type === "submit" && ((n = this.form) == null || n.addEventListener("keydown", this._handleFormKeyDown)); | ||
} | ||
disconnectedCallback() { | ||
var a; | ||
super.disconnectedCallback(), this.type === "submit" && ((a = this.form) == null || a.removeEventListener("keydown", this._handleFormKeyDown)); | ||
var n; | ||
super.disconnectedCallback(), this.type === "submit" && ((n = this.form) == null || n.removeEventListener("keydown", this._handleFormKeyDown)); | ||
} | ||
updated(a) { | ||
var n, h; | ||
super.updated(a), a.has("type") && (this.type === "submit" ? (n = this.form) == null || n.addEventListener("keydown", this._handleFormKeyDown) : (h = this.form) == null || h.removeEventListener("keydown", this._handleFormKeyDown)); | ||
updated(n) { | ||
var h, c; | ||
super.updated(n); | ||
const [a] = this._iconSlotElement; | ||
a && (this.size === "xsmall" && a.setAttribute("size", "xs"), (this.size === "small-expressive" || this.size === "small-productive") && a.setAttribute("size", "s"), (this.size === "medium" || this.size === "large") && a.setAttribute("size", "m")), n.has("type") && (this.type === "submit" ? (h = this.form) == null || h.addEventListener("keydown", this._handleFormKeyDown) : (c = this.form) == null || c.removeEventListener("keydown", this._handleFormKeyDown)); | ||
} | ||
@@ -557,7 +559,7 @@ /** | ||
*/ | ||
_simulateNativeButtonClick(a) { | ||
_simulateNativeButtonClick(n) { | ||
if (!this.form) | ||
return; | ||
const n = document.createElement("button"); | ||
n.type = a, n.style.position = "absolute", n.style.width = "1px", n.style.height = "1px", n.style.padding = "0", n.style.margin = "-1px", n.style.overflow = "hidden", n.style.border = "0", n.style.whiteSpace = "nowrap", a === "submit" && (this.name && (n.name = this.name), this.value && (n.value = this.value), this.formaction && n.setAttribute("formaction", this.formaction), this.formenctype && n.setAttribute("formenctype", this.formenctype), this.formmethod && n.setAttribute("formmethod", this.formmethod), this.formnovalidate && n.setAttribute("formnovalidate", "formnovalidate"), this.formtarget && n.setAttribute("formtarget", this.formtarget)), this.form.append(n), n.click(), n.remove(); | ||
const a = document.createElement("button"); | ||
a.type = n, a.style.position = "absolute", a.style.width = "1px", a.style.height = "1px", a.style.padding = "0", a.style.margin = "-1px", a.style.overflow = "hidden", a.style.border = "0", a.style.whiteSpace = "nowrap", n === "submit" && (this.name && (a.name = this.name), this.value && (a.value = this.value), this.formaction && a.setAttribute("formaction", this.formaction), this.formenctype && a.setAttribute("formenctype", this.formenctype), this.formmethod && a.setAttribute("formmethod", this.formmethod), this.formnovalidate && a.setAttribute("formnovalidate", "formnovalidate"), this.formtarget && a.setAttribute("formtarget", this.formtarget)), this.form.append(a), a.click(), a.remove(); | ||
} | ||
@@ -573,5 +575,5 @@ _handleClick() { | ||
renderSpinner() { | ||
const { size: a, variant: n, disabled: h } = this, c = a && a.includes("small") ? "small" : "medium"; | ||
const { size: n, variant: a, disabled: h } = this, c = n && n.includes("small") ? "small" : "medium"; | ||
let f; | ||
return h ? f = n === "ghost-inverse" ? "inverse" : "secondary" : f = ["primary", "destructive", "outline-inverse", "ghost-inverse"].includes(this.variant) ? "inverse" : "secondary", N` | ||
return h ? f = a === "ghost-inverse" ? "inverse" : "secondary" : f = ["primary", "destructive", "outline-inverse", "ghost-inverse"].includes(this.variant) ? "inverse" : "secondary", N` | ||
<pie-spinner | ||
@@ -584,4 +586,4 @@ size="${c}" | ||
const { | ||
type: a, | ||
disabled: n, | ||
type: n, | ||
disabled: a, | ||
isFullWidth: h, | ||
@@ -591,3 +593,3 @@ variant: c, | ||
isLoading: y, | ||
isResponsive: M, | ||
isResponsive: k, | ||
iconPlacement: b, | ||
@@ -600,9 +602,9 @@ responsiveSize: S | ||
class="o-btn" | ||
type=${a || "submit"} | ||
type=${n || "submit"} | ||
variant=${c || "primary"} | ||
size=${f || "medium"} | ||
responsiveSize=${St(S)} | ||
?disabled=${n} | ||
responsiveSize=${At(S)} | ||
?disabled=${a} | ||
?isFullWidth=${h} | ||
?isResponsive=${M} | ||
?isResponsive=${k} | ||
?isLoading=${y}> | ||
@@ -616,70 +618,73 @@ ${y ? this.renderSpinner() : B} | ||
focus() { | ||
var a, n; | ||
(n = (a = this.shadowRoot) == null ? void 0 : a.querySelector("button")) == null || n.focus(); | ||
var n, a; | ||
(a = (n = this.shadowRoot) == null ? void 0 : n.querySelector("button")) == null || a.focus(); | ||
} | ||
} | ||
v.styles = Ct(Nt); | ||
p([ | ||
m(), | ||
P(C, At, "medium") | ||
v.styles = Ct(Pt); | ||
m([ | ||
p(), | ||
P(C, It, "medium") | ||
], v.prototype, "size", 2); | ||
p([ | ||
m(), | ||
P(C, It, "submit") | ||
m([ | ||
p(), | ||
P(C, Tt, "submit") | ||
], v.prototype, "type", 2); | ||
p([ | ||
m(), | ||
P(C, Tt, "primary") | ||
m([ | ||
p(), | ||
P(C, Vt, "primary") | ||
], v.prototype, "variant", 2); | ||
p([ | ||
m({ type: String }), | ||
P(C, Vt, "leading") | ||
m([ | ||
p({ type: String }), | ||
P(C, Nt, "leading") | ||
], v.prototype, "iconPlacement", 2); | ||
p([ | ||
m({ type: Boolean }) | ||
m([ | ||
p({ type: Boolean }) | ||
], v.prototype, "disabled", 2); | ||
p([ | ||
m({ type: Boolean, reflect: !0 }) | ||
m([ | ||
p({ type: Boolean, reflect: !0 }) | ||
], v.prototype, "isLoading", 2); | ||
p([ | ||
m({ type: Boolean }) | ||
m([ | ||
p({ type: Boolean }) | ||
], v.prototype, "isFullWidth", 2); | ||
p([ | ||
m({ type: Boolean }) | ||
m([ | ||
p({ type: Boolean }) | ||
], v.prototype, "isResponsive", 2); | ||
p([ | ||
m({ type: String }) | ||
m([ | ||
p({ type: String }) | ||
], v.prototype, "name", 2); | ||
p([ | ||
m({ type: String }) | ||
m([ | ||
p({ type: String }) | ||
], v.prototype, "value", 2); | ||
p([ | ||
m() | ||
m([ | ||
p() | ||
], v.prototype, "formaction", 2); | ||
p([ | ||
m() | ||
m([ | ||
p() | ||
], v.prototype, "formenctype", 2); | ||
p([ | ||
m() | ||
m([ | ||
p() | ||
], v.prototype, "formmethod", 2); | ||
p([ | ||
m({ type: Boolean }) | ||
m([ | ||
p({ type: Boolean }) | ||
], v.prototype, "formnovalidate", 2); | ||
p([ | ||
m() | ||
m([ | ||
p() | ||
], v.prototype, "formtarget", 2); | ||
p([ | ||
m({ type: String }) | ||
m([ | ||
p({ type: String }) | ||
], v.prototype, "responsiveSize", 2); | ||
m([ | ||
St({ slot: "icon" }) | ||
], v.prototype, "_iconSlotElement", 2); | ||
Lt(C, v); | ||
export { | ||
v as PieButton, | ||
Kt as formEncodingtypes, | ||
qt as formEncodingtypes, | ||
Ut as formMethodTypes, | ||
qt as formTargetTypes, | ||
Vt as iconPlacements, | ||
Bt as responsiveSizes, | ||
At as sizes, | ||
It as types, | ||
Tt as variants | ||
jt as formTargetTypes, | ||
Nt as iconPlacements, | ||
Kt as responsiveSizes, | ||
It as sizes, | ||
Tt as types, | ||
Vt as variants | ||
}; |
@@ -121,2 +121,3 @@ import type { CSSResult } from 'lit'; | ||
responsiveSize?: ButtonProps['responsiveSize']; | ||
_iconSlotElement: Array<HTMLElement>; | ||
/** | ||
@@ -123,0 +124,0 @@ * This method creates an invisible button of the same type as pie-button. It is then clicked, and immediately removed from the DOM. |
{ | ||
"name": "@justeattakeaway/pie-button", | ||
"version": "0.0.0-snapshot-release-20240411081540", | ||
"version": "0.0.0-snapshot-release-20240412121709", | ||
"description": "PIE design system button built using web components", | ||
@@ -39,3 +39,3 @@ "type": "module", | ||
"@custom-elements-manifest/analyzer": "0.9.0", | ||
"@justeattakeaway/pie-components-config": "0.14.0", | ||
"@justeattakeaway/pie-components-config": "0.15.0", | ||
"@justeattakeaway/pie-wrapper-react": "0.14.0", | ||
@@ -52,6 +52,6 @@ "cem-plugin-module-file-extensions": "0.0.5" | ||
"dependencies": { | ||
"@justeattakeaway/pie-spinner": "0.0.0-snapshot-release-20240411081540", | ||
"@justeattakeaway/pie-webc-core": "0.0.0-snapshot-release-20240411081540", | ||
"@justeattakeaway/pie-spinner": "0.6.2", | ||
"@justeattakeaway/pie-webc-core": "0.21.0", | ||
"element-internals-polyfill": "1.3.10" | ||
} | ||
} |
import { | ||
LitElement, html, unsafeCSS, nothing, PropertyValues, TemplateResult, | ||
} from 'lit'; | ||
import { property } from 'lit/decorators.js'; | ||
import { property, queryAssignedElements } from 'lit/decorators.js'; | ||
import { ifDefined } from 'lit/directives/if-defined.js'; | ||
@@ -44,2 +44,18 @@ import { validPropertyValues, defineCustomElement, FormControlMixin } from '@justeattakeaway/pie-webc-core'; | ||
// Making sure that icon passed in a slot has the correct icon size | ||
const [iconElement] = this._iconSlotElement; | ||
if (iconElement) { | ||
if (this.size === 'xsmall') { | ||
iconElement.setAttribute('size', 'xs'); | ||
} | ||
if (this.size === 'small-expressive' || this.size === 'small-productive') { | ||
iconElement.setAttribute('size', 's'); | ||
} | ||
if (this.size === 'medium' || this.size === 'large') { | ||
iconElement.setAttribute('size', 'm'); | ||
} | ||
} | ||
if (changedProperties.has('type')) { | ||
@@ -107,2 +123,5 @@ // If the new type is "submit", add the keydown event listener | ||
@queryAssignedElements({ slot: 'icon' }) | ||
_iconSlotElement!: Array<HTMLElement>; | ||
/** | ||
@@ -109,0 +128,0 @@ * This method creates an invisible button of the same type as pie-button. It is then clicked, and immediately removed from the DOM. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95558
1892
+ Added@justeattakeaway/pie-spinner@0.6.2(transitive)
+ Added@justeattakeaway/pie-webc-core@0.21.0(transitive)
- Removed@justeattakeaway/pie-spinner@0.0.0-snapshot-release-20240411081540(transitive)
- Removed@justeattakeaway/pie-webc-core@0.0.0-snapshot-release-20240411081540(transitive)