@taprootio/espalier 6.13.1 → 6.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/custom-elements.json +2243 -2239
- package/dist/button/esp-button.d.ts +3 -0
- package/dist/button/esp-button.js +6 -6
- package/package.json +1 -1
|
@@ -85,6 +85,9 @@ export type ButtonIconPosition = "left" | "right";
|
|
|
85
85
|
* @attr aria-pressed - Forwards a toggle's pressed state to the inner native
|
|
86
86
|
* button. Use `"true"` while the controlled content is active and `"false"`
|
|
87
87
|
* otherwise.
|
|
88
|
+
* @attr aria-label - Forwards an accessible name to the inner native control.
|
|
89
|
+
* An icon-only button falls back to `label` when it is absent. When the button
|
|
90
|
+
* shows text, keep the name containing the visible label.
|
|
88
91
|
* @docPageTitle Button
|
|
89
92
|
* @docUrl /components/button
|
|
90
93
|
* @menuGroup Interaction
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var i=function(h,t,r,
|
|
1
|
+
var i=function(h,t,r,o){var l=arguments.length,n=l<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,r):o,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(h,t,r,o);else for(var p=h.length-1;p>=0;p--)(d=h[p])&&(n=(l<3?d(n):l>3?d(t,r,n):d(t,r))||n);return l>3&&n&&Object.defineProperty(t,r,n),n};import{css as g,html as c,nothing as s}from"lit";import{customElement as v,eventOptions as y,property as a,state as w}from"lit/decorators.js";import{classMap as b}from"lit/directives/class-map.js";import{EspalierElementBase as f}from"../shared/esp-element-base.js";import{ESP_EVENTS as x}from"../shared/events.js";import{ref as T}from"lit/directives/ref.js";import{getIconHrefForHost as k}from"../shared/intent-values.js";import{SlottedIconController as $}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as S}from"../shared/svgs/render-sprite-icon.js";import{DEFAULT_NEW_TAB_LABEL as E,newTabSuffix as C,renderNewTabCue as z}from"../shared/new-tab-cue.js";import{srOnly as N}from"../shared/style-fragments.js";import{BUTTON_INTERACTION_LIGHTNESS_FACTOR as B}from"./action-state-lightness.js";const m=g`var(--esp-button-padding, var(--_esp-button-default-padding, var(--esp-size-padding)))`,_=c`<svg
|
|
2
2
|
xmlns="http://www.w3.org/2000/svg"
|
|
3
3
|
viewBox="0 0 24 24"
|
|
4
4
|
fill="none"
|
|
@@ -10,13 +10,13 @@ var i=function(h,t,r,n){var l=arguments.length,o=l<3?t:n===null?n=Object.getOwnP
|
|
|
10
10
|
>
|
|
11
11
|
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
12
12
|
<path d="M4.05 11a8 8 0 1 1 .5 4m-.5 5v-5h5" />
|
|
13
|
-
</svg>`;let e=class extends f{constructor(){super(...arguments),this.iconSlot=new $(this),this.innerTabindex=null,this.neutralizingTabindex=!1,this.buttonType="button",this.collapsed=!1,this.disabled=!1,this.href="",this.current=!1,this.iconOnly=!1,this.incognito=!1,this.icon="",this.iconPosition="right",this.label="",this.loading=!1,this.target="",this.rel="",this.newTabLabel=E,this.formNoValidate=!1,this.buildIcon=(t,r=!1)=>this.loading&&!r?c` <span>${
|
|
13
|
+
</svg>`;let e=class extends f{constructor(){super(...arguments),this.iconSlot=new $(this),this.innerTabindex=null,this.neutralizingTabindex=!1,this.buttonType="button",this.collapsed=!1,this.disabled=!1,this.href="",this.current=!1,this.iconOnly=!1,this.incognito=!1,this.icon="",this.iconPosition="right",this.label="",this.loading=!1,this.target="",this.rel="",this.newTabLabel=E,this.formNoValidate=!1,this.buildIcon=(t,r=!1)=>this.loading&&!r?c` <span>${_}</span> `:c`
|
|
14
14
|
<span>
|
|
15
15
|
<slot ${T(this.iconSlot.slotRef)} @slotchange=${this.iconSlot.handleSlotChange}></slot>
|
|
16
16
|
${!this.iconSlot.hasSlottedIcon(":scope > :not(slot)")&&t?S(t):s}
|
|
17
17
|
</span>
|
|
18
|
-
`}static get observedAttributes(){return[...super.observedAttributes,"tabindex","aria-pressed"]}attributeChangedCallback(t,r,
|
|
19
|
-
<span part="control" class="current-page" aria-current="page" aria-label=${d}>
|
|
18
|
+
`}static get observedAttributes(){return[...super.observedAttributes,"tabindex","aria-pressed","aria-label"]}attributeChangedCallback(t,r,o){if(super.attributeChangedCallback(t,r,o),t==="aria-pressed"||t==="aria-label"){this.requestUpdate();return}if(t!=="tabindex"||this.neutralizingTabindex)return;const l=o===null?null:Number(o),n=l===null||Number.isNaN(l)?null:l;n!==null&&n>=0?(this.innerTabindex=n,this.writeHostTabindex(null)):n===null&&o!==null?(this.innerTabindex=null,this.writeHostTabindex(null)):this.innerTabindex=n}writeHostTabindex(t){this.getAttribute("tabindex")!==t&&(this.neutralizingTabindex=!0,t===null?this.removeAttribute("tabindex"):this.setAttribute("tabindex",t),this.neutralizingTabindex=!1)}removeAttribute(t){super.removeAttribute(t),t==="tabindex"&&!this.neutralizingTabindex&&(this.innerTabindex=null)}focus(t){this.focusShadowElementAfterUpdate("button, a",t)}handleClick(t){if(this.dispatchEvent(new CustomEvent(x.CLICKED,{detail:{},bubbles:!0,composed:!0})),this.buttonType==="submit"){const r=this.closest("form");if(r){const o=document.createElement("button");o.type="submit",o.hidden=!0,this.formNoValidate&&(o.formNoValidate=!0),r.appendChild(o),r.requestSubmit(o),o.remove()}}else this.buttonType==="reset"&&this.closest("form")?.reset()}render(){const t=k(this.icon,this),r=this.current&&this.href.length>0,o=this.loading&&!r||this.iconSlot.hasSlottedIcon(":scope > :not(slot)")||t.length>0,{collapsed:l,iconOnly:n}=this,d=this.getAttribute("aria-label")||(n?this.label:"")||s,p=this.getAttribute("aria-pressed")||s,u={"esp-field":!0,"icon-only":n,incognito:this.incognito,"is-collapsed":l,"has-icon":o,"icon-left":o&&!n&&this.iconPosition==="left"};return r?c`<div part="wrapper" class=${b(u)}>
|
|
19
|
+
<span part="control" class="current-page" aria-current="page" aria-label=${n?d:s}>
|
|
20
20
|
<span part="label">${this.label??""}</span>${this.buildIcon(t,!0)}
|
|
21
21
|
</span>
|
|
22
22
|
</div>`:this.href.length?c`
|
|
@@ -32,7 +32,7 @@ var i=function(h,t,r,n){var l=arguments.length,o=l<3?t:n===null?n=Object.getOwnP
|
|
|
32
32
|
>
|
|
33
33
|
<span part="label">${this.label??""}</span>
|
|
34
34
|
${this.buildIcon(t)}
|
|
35
|
-
${
|
|
35
|
+
${n?s:z(this.target,this.newTabLabel)}
|
|
36
36
|
</a>
|
|
37
37
|
</div>
|
|
38
38
|
`:c`
|
|
@@ -184,7 +184,7 @@ var i=function(h,t,r,n){var l=arguments.length,o=l<3?t:n===null?n=Object.getOwnP
|
|
|
184
184
|
&:hover,
|
|
185
185
|
&:focus-within {
|
|
186
186
|
background-color: oklch(
|
|
187
|
-
from var(--esp-color-action-background) calc(l * ${
|
|
187
|
+
from var(--esp-color-action-background) calc(l * ${B})
|
|
188
188
|
c h
|
|
189
189
|
);
|
|
190
190
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taprootio/espalier",
|
|
3
|
-
"version": "6.13.
|
|
3
|
+
"version": "6.13.2",
|
|
4
4
|
"packageManager": "bun@1.3.12",
|
|
5
5
|
"description": "Espalier — a themeable, accessible, framework-agnostic, enterprise-grade design system built on web standards and love.",
|
|
6
6
|
"customElements": "custom-elements.json",
|