@taprootio/espalier 6.2.0 → 6.3.0
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 +8 -0
- package/README.md +5 -5
- package/custom-elements.json +945 -241
- package/dist/action-menu/esp-action-menu-item.js +1 -0
- package/dist/action-menu/esp-action-menu.js +4 -3
- package/dist/box/esp-box.d.ts +14 -3
- package/dist/box/esp-box.js +5 -5
- package/dist/button/esp-button.d.ts +4 -4
- package/dist/date-picker/helpers/styles.js +1 -0
- package/dist/details/esp-details.d.ts +3 -0
- package/dist/details/esp-details.js +13 -6
- package/dist/dialog/esp-dialog.d.ts +6 -2
- package/dist/dialog/esp-dialog.js +62 -62
- package/dist/flyout/esp-flyout.d.ts +2 -2
- package/dist/flyout/esp-flyout.js +6 -5
- package/dist/focus-picker/esp-focus-picker.js +3 -2
- package/dist/footer/esp-footer.d.ts +3 -3
- package/dist/footer/esp-footer.js +10 -10
- package/dist/grid/esp-grid.d.ts +3 -0
- package/dist/grid/esp-grid.js +25 -17
- package/dist/header/esp-header-button.d.ts +6 -15
- package/dist/header/esp-header.d.ts +4 -2
- package/dist/header/esp-header.js +8 -7
- package/dist/image-picker/esp-image-picker.js +1 -0
- package/dist/image-upload/esp-image-upload.js +1 -0
- package/dist/info/esp-info.d.ts +3 -1
- package/dist/info/esp-info.js +8 -8
- package/dist/lightbox/esp-lightbox.d.ts +3 -0
- package/dist/lightbox/esp-lightbox.js +12 -9
- package/dist/menu/esp-menu-group.js +6 -2
- package/dist/menu/esp-menu-item.js +7 -3
- package/dist/menu/esp-menu.js +4 -2
- package/dist/page/esp-page.d.ts +1 -1
- package/dist/page/esp-page.styles.js +1 -0
- package/dist/pickers/esp-pick-one.d.ts +1 -2
- package/dist/pickers/esp-pick-some.d.ts +1 -1
- package/dist/pickers/esp-picker-item.js +9 -5
- package/dist/pickers/esp-picker-menu.js +2 -0
- package/dist/popover/esp-popover.d.ts +2 -4
- package/dist/repeater/esp-repeater.js +1 -0
- package/dist/root/esp-root.d.ts +4 -4
- package/dist/root/esp-root.js +5 -3
- package/dist/row/esp-row.d.ts +1 -2
- package/dist/search/esp-search.js +2 -0
- package/dist/section/esp-section.d.ts +1 -1
- package/dist/section/esp-section.js +2 -1
- package/dist/shared/configured-brand.d.ts +11 -37
- package/dist/shared/esp-element-base.d.ts +4 -1
- package/dist/shared/esp-element-base.js +27 -30
- package/dist/shared/justified-layout.d.ts +6 -18
- package/dist/shared/surface-layer.d.ts +12 -0
- package/dist/shared/surface-layer.js +10 -0
- package/dist/shared/theme.d.ts +7 -18
- package/dist/slider/esp-slider.d.ts +2 -4
- package/dist/stack/esp-stack.d.ts +1 -2
- package/dist/switch/esp-switch.d.ts +2 -4
- package/dist/tabs/esp-tab-group.d.ts +3 -0
- package/dist/tabs/esp-tab-group.js +7 -7
- package/dist/tooltip/esp-tooltip.js +1 -0
- package/dist/tree/esp-tree.d.ts +0 -5
- package/dist/tree/esp-tree.js +3 -0
- package/espalier.css-data.json +1 -1
- package/espalier.token-manifest.json +1 -1
- package/licenses/README.md +18 -15
- package/package.json +5 -1
|
@@ -84,6 +84,7 @@ var s=function(r,i,t,n){var a=arguments.length,e=a<3?i:n===null?n=Object.getOwnP
|
|
|
84
84
|
|
|
85
85
|
:host(:not([disabled]):hover) .item,
|
|
86
86
|
:host(:not([disabled]):focus-visible) .item {
|
|
87
|
+
--_esp-surface-layer: 2;
|
|
87
88
|
background: var(--esp-action-menu-item-hover-background, var(--esp-color-layer-2));
|
|
88
89
|
}
|
|
89
90
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var l=function(
|
|
1
|
+
var l=function(c,e,t,s){var o=arguments.length,r=o<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(c,e,t,s);else for(var i=c.length-1;i>=0;i--)(a=c[i])&&(r=(o<3?a(r):o>3?a(e,t,r):a(e,t))||r);return o>3&&r&&Object.defineProperty(e,t,r),r};import{css as v,html as p}from"lit";import{customElement as I,property as u,state as g}from"lit/decorators.js";import{createRef as d,ref as h}from"lit/directives/ref.js";import"../button/esp-button.js";import"../popover/esp-popover.js";import{EspalierElementBase as f}from"../shared/esp-element-base.js";import{ESP_EVENTS as y}from"../shared/events.js";import"./esp-action-menu-item.js";const w=p` <svg
|
|
2
2
|
xmlns="http://www.w3.org/2000/svg"
|
|
3
3
|
viewBox="0 0 24 24"
|
|
4
4
|
fill="currentColor"
|
|
@@ -7,7 +7,7 @@ var l=function(d,e,t,s){var o=arguments.length,i=o<3?e:s===null?s=Object.getOwnP
|
|
|
7
7
|
<circle cx="5" cy="12" r="2" />
|
|
8
8
|
<circle cx="12" cy="12" r="2" />
|
|
9
9
|
<circle cx="19" cy="12" r="2" />
|
|
10
|
-
</svg>`;let n=class extends f{constructor(){super(...arguments),this.popoverRef=
|
|
10
|
+
</svg>`;let n=class extends f{constructor(){super(...arguments),this.popoverRef=d(),this.itemsSlot=d(),this.triggerSlot=d(),this.triggerShell=d(),this.handledTriggerEvents=new WeakSet,this.wiredTriggerControls=new WeakSet,this.open=!1,this.focusedIndex=-1,this.placement="bottom-end",this.disabled=!1,this.iconPosition="left",this.handleTriggerSlotChange=()=>{this.syncTriggerAttributes()},this.syncItems=()=>{const e=this.items,t=this.enabledItems;for(const s of e)s.inheritIconPosition(this.iconPosition),s.setAttribute("role","menuitem"),s.tabIndex=t[0]===s&&this.focusedIndex<0?0:-1,s.setAttribute("aria-disabled",String(s.disabled));if(this.focusedIndex>=0){const s=t[this.focusedIndex];for(const o of t)o.tabIndex=o===s?0:-1}},this.handleTriggerClick=e=>{this.handledTriggerEvents.has(e)||(this.handledTriggerEvents.add(e),this.toggleMenu(e))},this.toggleMenu=e=>{e.preventDefault(),!this.disabled&&(this.open?this.closeMenu({restoreFocus:!0}):this.openMenu())},this.handleTriggerKeydown=async e=>{if(!this.disabled)switch(e.key){case"Enter":case" ":e.preventDefault(),e.stopPropagation(),this.openMenu(),await this.updateComplete,this.focusFirstItem();break;case"ArrowDown":e.preventDefault(),e.stopPropagation(),this.openMenu(),await this.updateComplete,this.focusFirstItem();break;case"ArrowUp":e.preventDefault(),e.stopPropagation(),this.openMenu(),await this.updateComplete,this.focusLastItem();break}},this.handleMenuKeydown=e=>{if(this.open)switch(e.key){case"ArrowDown":e.preventDefault(),this.focusNextItem(1);break;case"ArrowUp":e.preventDefault(),this.focusNextItem(-1);break;case"Home":e.preventDefault(),this.focusFirstItem();break;case"End":e.preventDefault(),this.focusLastItem();break;case"Enter":case" ":e.preventDefault(),this.activeItemForEvent(e)?.activate();break;case"Escape":e.preventDefault(),this.closeMenu({restoreFocus:!0});break}},this.handleItemActivate=e=>{const{item:t}=e.detail;this.selectItem(t)},this.handlePopoverOpened=()=>{this.open=!0,this.syncItems()},this.handlePopoverClosed=()=>{this.open=!1,this.focusedIndex=-1,this.syncItems()}}connectedCallback(){super.connectedCallback(),this.addEventListener("esp-internal-action-menu-item-activate",this.handleItemActivate),this.addEventListener("keydown",this.handleMenuKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("esp-internal-action-menu-item-activate",this.handleItemActivate),this.removeEventListener("keydown",this.handleMenuKeydown)}firstUpdated(e){super.firstUpdated(e),this.syncTriggerAttributes(),this.syncItems()}updated(e){super.updated(e),(e.has("open")||e.has("disabled"))&&this.syncTriggerAttributes(),e.has("iconPosition")&&this.syncItems()}openMenu(){this.disabled||this.open||(this.popoverRef.value?.openPopover(),this.open=!0)}closeMenu(e={}){this.open&&(this.popoverRef.value?.closePopover(),this.open=!1,this.focusedIndex=-1,this.syncItems(),e.restoreFocus&&this.focusTrigger())}get placementParts(){const[e,t]=this.placement.split("-"),s=t==="start"||t==="end"?t:"center";switch(e){case"top":return{attach:"above",align:s};case"right":return{attach:"right",align:s};case"left":return{attach:"left",align:s};case"bottom":default:return{attach:"below",align:s}}}get items(){return Array.from(this.querySelectorAll("esp-action-menu-item"))}get enabledItems(){return this.items.filter(e=>!e.disabled)}get defaultTrigger(){return this.shadowRoot?.querySelector(".default-trigger")}get slottedTrigger(){return this.triggerSlot.value?.assignedElements({flatten:!0})[0]}getTriggerControl(e){return e?.shadowRoot?.querySelector("button, a, [tabindex]")??null}wireTriggerControl(e){!e||this.wiredTriggerControls.has(e)||(e.addEventListener("click",this.handleTriggerClick),this.wiredTriggerControls.add(e))}syncTriggerAttributes(){const e={"aria-haspopup":"menu","aria-expanded":String(this.open),"aria-disabled":String(this.disabled)},t=i=>{if(i){for(const[m,b]of Object.entries(e))i.setAttribute(m,b);"disabled"in i&&(i.disabled=this.disabled)}};t(this.triggerShell.value);const s=this.slottedTrigger;t(s);const o=this.getTriggerControl(s);t(o),this.wireTriggerControl(o);const r=this.defaultTrigger;r?.setAttribute("aria-label","Actions"),t(r);const a=this.getTriggerControl(r);t(a),this.wireTriggerControl(a),r&&r.updateComplete.then(()=>{const i=this.getTriggerControl(r);t(i),i?.setAttribute("aria-label","Actions"),this.wireTriggerControl(i)}),s&&"updateComplete"in s&&s.updateComplete.then(()=>{const i=this.getTriggerControl(s);t(i),this.wireTriggerControl(i)})}activeItemForEvent(e){const t=this.enabledItems;return t[this.focusedIndex]??t.find(s=>e.composedPath().includes(s))??t.find(s=>s.matches(":focus"))}selectItem(e){e.disabled||(this.dispatchEvent(new CustomEvent(y.ACTION_MENU_SELECT,{detail:{value:e.value,item:e},bubbles:!0,composed:!0})),this.closeMenu({restoreFocus:!0}))}focusFirstItem(){this.focusItem(0)}focusLastItem(){this.focusItem(this.enabledItems.length-1)}focusNextItem(e){const t=this.enabledItems;if(t.length===0)return;const o=((this.focusedIndex<0?0:this.focusedIndex)+e+t.length)%t.length;this.focusItem(o)}focusItem(e){const t=this.enabledItems;e<0||e>=t.length||(this.focusedIndex=e,this.syncItems(),t[e].focus())}focusTrigger(){const e=this.slottedTrigger;if(e){(this.getTriggerControl(e)??e).focus();return}const t=this.defaultTrigger;(this.getTriggerControl(t)??t??this.triggerShell.value)?.focus()}render(){const{attach:e,align:t}=this.placementParts;return p`
|
|
11
11
|
<esp-popover
|
|
12
12
|
${h(this.popoverRef)}
|
|
13
13
|
.trigger=${"none"}
|
|
@@ -33,7 +33,7 @@ var l=function(d,e,t,s){var o=arguments.length,i=o<3?e:s===null?s=Object.getOwnP
|
|
|
33
33
|
.disabled=${this.disabled}
|
|
34
34
|
label="Actions"
|
|
35
35
|
>
|
|
36
|
-
${
|
|
36
|
+
${w}
|
|
37
37
|
</esp-button>
|
|
38
38
|
</slot>
|
|
39
39
|
</span>
|
|
@@ -58,6 +58,7 @@ var l=function(d,e,t,s){var o=arguments.length,i=o<3?e:s===null?s=Object.getOwnP
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
.menu {
|
|
61
|
+
--_esp-surface-layer: 1;
|
|
61
62
|
display: grid;
|
|
62
63
|
min-width: var(--esp-action-menu-min-width, 12rem);
|
|
63
64
|
padding: 0;
|
package/dist/box/esp-box.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { EspalierElementBase } from "../shared/esp-element-base.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Groups related content in a themed container. Style its `box` CSS part
|
|
4
|
+
* to create cards, forms, or other grouped regions.
|
|
5
|
+
*
|
|
6
|
+
* A field fills one layer above the surface it sits on.
|
|
7
|
+
* Use `surface-layer="1|2|3|4"` to select the default painted layer.
|
|
6
8
|
*
|
|
7
9
|
* ```html
|
|
8
10
|
* <esp-box>
|
|
@@ -20,6 +22,15 @@ import { EspalierElementBase } from "../shared/esp-element-base.js";
|
|
|
20
22
|
* panels, and form surfaces — and replace any pre-3.2 "neutralized box"
|
|
21
23
|
* band with a bare section.
|
|
22
24
|
*
|
|
25
|
+
* Select a raised form surface with `surface-layer`; fields follow it automatically.
|
|
26
|
+
*
|
|
27
|
+
* ```html
|
|
28
|
+
* <esp-box surface-layer="2">
|
|
29
|
+
* <esp-input placeholder="Search"></esp-input>
|
|
30
|
+
* <esp-input readonly value="A read-only value"></esp-input>
|
|
31
|
+
* </esp-box>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
23
34
|
* @customElement esp-box
|
|
24
35
|
* @slot - The default slot holds elements to display in the box.
|
|
25
36
|
*
|
package/dist/box/esp-box.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var n=function(t,e,r,i){var a=arguments.length,o=a<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,r,i);else for(var p=t.length-1;p>=0;p--)(l=t[p])&&(o=(a<3?l(o):a>3?l(e,r,o):l(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o};import{css as
|
|
2
|
-
<div class=${
|
|
1
|
+
var n=function(t,e,r,i){var a=arguments.length,o=a<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,r,i);else for(var p=t.length-1;p>=0;p--)(l=t[p])&&(o=(a<3?l(o):a>3?l(e,r,o):l(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o};import{paintedSurface as c}from"../shared/surface-layer.js";import{css as b,html as v}from"lit";import{customElement as h,property as f}from"lit/decorators.js";import{classMap as u}from"lit/directives/class-map.js";import{EspalierElementBase as d}from"../shared/esp-element-base.js";let s=class extends d{constructor(){super(...arguments),this.fullScreen=!1}render(){const{fullScreen:e}=this;return v`
|
|
2
|
+
<div class=${u({"esp-box":!0,"full-screen":e})}>
|
|
3
3
|
<div part="box">
|
|
4
4
|
<slot></slot>
|
|
5
5
|
</div>
|
|
6
6
|
</div>
|
|
7
|
-
`}};s.styles=[...d.styles,c`
|
|
7
|
+
`}};s.styles=[...d.styles,c(1),b`
|
|
8
8
|
:host {
|
|
9
9
|
display: block;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.esp-box {
|
|
13
|
-
background-color: var(--esp-color-box-background, var(--
|
|
13
|
+
background-color: var(--esp-color-box-background, var(--_esp-surface-background));
|
|
14
14
|
border-radius: var(--esp-size-border-radius);
|
|
15
15
|
box-shadow: var(--esp-box-shadow, var(--esp-shadow-1, 1px 1px 4px var(--esp-color-shadow)));
|
|
16
16
|
overflow: visible;
|
|
@@ -61,4 +61,4 @@ var n=function(t,e,r,i){var a=arguments.length,o=a<3?e:i===null?i=Object.getOwnP
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
`],n([
|
|
64
|
+
`],n([f({attribute:"full-screen",type:Boolean})],s.prototype,"fullScreen",void 0),s=n([h("esp-box")],s);export{s as EspalierBox};
|
|
@@ -2,7 +2,7 @@ import { type TemplateResult } from "lit";
|
|
|
2
2
|
import { EspalierElementBase } from "../shared/esp-element-base.js";
|
|
3
3
|
export type ButtonIconPosition = "left" | "right";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Triggers an action or links to another page.
|
|
6
6
|
*
|
|
7
7
|
* ```html
|
|
8
8
|
* <esp-button label="Hello there!"></esp-button>
|
|
@@ -18,7 +18,7 @@ export type ButtonIconPosition = "left" | "right";
|
|
|
18
18
|
* </script>
|
|
19
19
|
* ```
|
|
20
20
|
*
|
|
21
|
-
*
|
|
21
|
+
* Choose an intent to express the action's status:
|
|
22
22
|
*
|
|
23
23
|
* ```html
|
|
24
24
|
* <div style="display: flex; flex-wrap: wrap; gap: var(--esp-size-padding);">
|
|
@@ -145,7 +145,7 @@ export declare class EspalierButton extends EspalierElementBase {
|
|
|
145
145
|
*/
|
|
146
146
|
collapsed: boolean;
|
|
147
147
|
/**
|
|
148
|
-
*
|
|
148
|
+
* Disables the button.
|
|
149
149
|
*
|
|
150
150
|
* ```html
|
|
151
151
|
* <esp-button disabled label="Disabled"></esp-button>
|
|
@@ -225,7 +225,7 @@ export declare class EspalierButton extends EspalierElementBase {
|
|
|
225
225
|
*/
|
|
226
226
|
label: string;
|
|
227
227
|
/**
|
|
228
|
-
*
|
|
228
|
+
* Shows the button's loading state.
|
|
229
229
|
* The button will be disabled and show a spinner while loading
|
|
230
230
|
* is true.
|
|
231
231
|
*
|
|
@@ -6,6 +6,9 @@ import { EspalierElementBase } from "../shared/esp-element-base.js";
|
|
|
6
6
|
* [esp-details-group](/components/details/group) to create an
|
|
7
7
|
* accordion where only one item is open at a time.
|
|
8
8
|
*
|
|
9
|
+
* A field fills one layer above the surface it sits on.
|
|
10
|
+
* Use `surface-layer="1|2|3|4"` to select the default painted layer.
|
|
11
|
+
*
|
|
9
12
|
* ```html
|
|
10
13
|
* <esp-details summary="What is Espalier?">
|
|
11
14
|
* <p>Espalier is a design system and component library
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var d=function(i,e,o,s){var t=arguments.length,r=t<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,o):s,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(i,e,o,s);else for(var l=i.length-1;l>=0;l--)(n=i[l])&&(r=(t<3?n(r):t>3?n(e,o,r):n(e,o))||r);return t>3&&r&&Object.defineProperty(e,o,r),r};import{css as
|
|
1
|
+
var d=function(i,e,o,s){var t=arguments.length,r=t<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,o):s,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(i,e,o,s);else for(var l=i.length-1;l>=0;l--)(n=i[l])&&(r=(t<3?n(r):t>3?n(e,o,r):n(e,o))||r);return t>3&&r&&Object.defineProperty(e,o,r),r};import{paintedSurface as h}from"../shared/surface-layer.js";import{css as f,html as b}from"lit";import{customElement as v,property as p}from"lit/decorators.js";import{EspalierElementBase as m}from"../shared/esp-element-base.js";import{ESP_EVENTS as u}from"../shared/events.js";import{disabledControl as g}from"../shared/style-fragments.js";let a=class extends m{constructor(){super(...arguments),this.summary="",this.open=!1,this.disabled=!1,this._toggleFromClick=!1}close(){this.open=!1}getScrollParent(){let e=this.assignedSlot?.parentElement??(this.parentNode instanceof ShadowRoot?this.parentNode.host:this.parentElement);for(;e&&e!==document.documentElement;){const s=getComputedStyle(e).overflowY;if((s==="auto"||s==="scroll")&&e.scrollHeight>e.clientHeight)return e;e=e.assignedSlot?.parentElement??(e.parentNode instanceof ShadowRoot?e.parentNode.host:e.parentElement)}return null}handleToggle(e){const o=e.target;if(this.disabled){o.open=this.open;return}if(this._toggleFromClick){this._toggleFromClick=!1;return}this.open=o.open,this.dispatchEvent(new CustomEvent(u.DETAILS_TOGGLE,{detail:{open:this.open},bubbles:!0,composed:!0}))}handleSummaryClick(e){if(e.preventDefault(),this.disabled)return;const o=e.currentTarget,s=o.getBoundingClientRect().top,t=this.getScrollParent(),r=t?t.scrollTop:window.scrollY;this._toggleFromClick=!0,this.open=!this.open,this.updateComplete.then(()=>{this._toggleFromClick=!1,this.dispatchEvent(new CustomEvent(u.DETAILS_TOGGLE,{detail:{open:this.open},bubbles:!0,composed:!0}));const l=o.getBoundingClientRect().top-s;if(Math.abs(l)>1)if(t){const c=t.scrollTop;Math.abs(c-r)>1&&(t.scrollTop=r)}else{const c=window.scrollY;Math.abs(c-r)>1&&window.scrollBy(0,l)}})}render(){return b`
|
|
2
2
|
<details ?open=${this.open} @toggle=${this.handleToggle}>
|
|
3
3
|
<summary @click=${this.handleSummaryClick}>
|
|
4
4
|
<span class="indicator"></span>
|
|
@@ -8,7 +8,7 @@ var d=function(i,e,o,s){var t=arguments.length,r=t<3?e:s===null?s=Object.getOwnP
|
|
|
8
8
|
<slot></slot>
|
|
9
9
|
</div>
|
|
10
10
|
</details>
|
|
11
|
-
`}};a.styles=[...m.styles,
|
|
11
|
+
`}};a.styles=[...m.styles,h(1),g(":host([disabled]) summary"),f`
|
|
12
12
|
:host {
|
|
13
13
|
display: block;
|
|
14
14
|
|
|
@@ -28,7 +28,7 @@ var d=function(i,e,o,s){var t=arguments.length,r=t<3?e:s===null?s=Object.getOwnP
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
details {
|
|
31
|
-
background-color: var(--esp-details-color-background, var(--
|
|
31
|
+
background-color: var(--esp-details-color-background, var(--_esp-surface-background));
|
|
32
32
|
border-radius: var(--esp-size-border-radius);
|
|
33
33
|
box-shadow: 1px 1px 4px var(--esp-color-shadow);
|
|
34
34
|
border: 1px solid var(--esp-details-color-border, var(--esp-color-border));
|
|
@@ -50,7 +50,10 @@ var d=function(i,e,o,s){var t=arguments.length,r=t<3?e:s===null?s=Object.getOwnP
|
|
|
50
50
|
font-size: var(--esp-size-font);
|
|
51
51
|
font-weight: 600;
|
|
52
52
|
color: var(--esp-color-headings);
|
|
53
|
-
background-color: var(
|
|
53
|
+
background-color: var(
|
|
54
|
+
--esp-details-color-summary-background,
|
|
55
|
+
var(--_esp-surface-background)
|
|
56
|
+
);
|
|
54
57
|
transition: background-color cubic-bezier(0.075, 0.82, 0.165, 1) 0.5s;
|
|
55
58
|
}
|
|
56
59
|
|
|
@@ -67,6 +70,7 @@ var d=function(i,e,o,s){var t=arguments.length,r=t<3?e:s===null?s=Object.getOwnP
|
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
details[open] > summary {
|
|
73
|
+
--_esp-surface-layer: 2;
|
|
70
74
|
background-color: var(
|
|
71
75
|
--esp-details-color-summary-background-active,
|
|
72
76
|
var(--esp-color-layer-2)
|
|
@@ -108,7 +112,10 @@ var d=function(i,e,o,s){var t=arguments.length,r=t<3?e:s===null?s=Object.getOwnP
|
|
|
108
112
|
}
|
|
109
113
|
|
|
110
114
|
:host([disabled]) summary:hover {
|
|
111
|
-
background-color: var(
|
|
115
|
+
background-color: var(
|
|
116
|
+
--esp-details-color-summary-background,
|
|
117
|
+
var(--_esp-surface-background)
|
|
118
|
+
);
|
|
112
119
|
}
|
|
113
120
|
|
|
114
121
|
|
|
@@ -125,4 +132,4 @@ var d=function(i,e,o,s){var t=arguments.length,r=t<3?e:s===null?s=Object.getOwnP
|
|
|
125
132
|
:host([in-group]:last-of-type) details {
|
|
126
133
|
border-bottom: none;
|
|
127
134
|
}
|
|
128
|
-
`],d([p({type:String})],a.prototype,"summary",void 0),d([p({type:Boolean,reflect:!0})],a.prototype,"open",void 0),d([p({type:Boolean,reflect:!0})],a.prototype,"disabled",void 0),a=d([
|
|
135
|
+
`],d([p({type:String})],a.prototype,"summary",void 0),d([p({type:Boolean,reflect:!0})],a.prototype,"open",void 0),d([p({type:Boolean,reflect:!0})],a.prototype,"disabled",void 0),a=d([v("esp-details")],a);export{a as EspalierDetails};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Shows content in a modal dialog. By default, on large screens the
|
|
4
4
|
* dialog content is centered horizontally near the top of the
|
|
5
5
|
* screen. On small screens, the content always tries to take up
|
|
6
6
|
* the full screen width.
|
|
7
7
|
*
|
|
8
|
+
* A field fills one layer above the surface it sits on.
|
|
9
|
+
* Use `surface-layer="1|2|3|4"` to select the default painted layer.
|
|
10
|
+
*
|
|
8
11
|
* When opened, the dialog:
|
|
9
12
|
* - Moves focus to the first `[autofocus]` element inside the slotted
|
|
10
13
|
* content, then the first focusable element (or the dialog container
|
|
@@ -102,6 +105,7 @@ import { LitElement } from "lit";
|
|
|
102
105
|
*
|
|
103
106
|
* @cssprop --esp-color-dialog-bg - The background color of the dialog overlay.
|
|
104
107
|
* @cssprop --esp-dialog-bg-opacity - The opacity of the dialog overlay background.
|
|
108
|
+
* @attr {"1"|"2"|"3"|"4"} surface-layer - Declares the painted surface depth; defaults to layer 3.
|
|
105
109
|
* @customElement esp-dialog
|
|
106
110
|
* @docPageTitle Dialog
|
|
107
111
|
* @docUrl /components/dialog
|
|
@@ -155,7 +159,7 @@ export declare class EspalierDialog extends LitElement {
|
|
|
155
159
|
protected firstUpdated(): void;
|
|
156
160
|
disconnectedCallback(): void;
|
|
157
161
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
158
|
-
static styles: import("lit").CSSResult;
|
|
162
|
+
static styles: import("lit").CSSResult[];
|
|
159
163
|
}
|
|
160
164
|
declare global {
|
|
161
165
|
interface HTMLElementTagNameMap {
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
var c=function(l,e,t,o){var n=arguments.length,i=n<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(l,e,t,o);else for(var a=l.length-1;a>=0;a--)(r=l[a])&&(i=(n<3?r(i):n>3?r(e,t,i):r(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i};import{
|
|
1
|
+
var c=function(l,e,t,o){var n=arguments.length,i=n<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(l,e,t,o);else for(var a=l.length-1;a>=0;a--)(r=l[a])&&(i=(n<3?r(i):n>3?r(e,t,i):r(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i};import{paintedSurface as f,surfaceLayerAttributes as v}from"../shared/surface-layer.js";import{LitElement as m,css as b,html as g,nothing as u}from"lit";import{customElement as y,property as _,state as O}from"lit/decorators.js";import{classMap as k}from"lit/directives/class-map.js";import{createRef as d,ref as h}from"lit/directives/ref.js";import{OverlayController as E}from"../shared/overlay-controller.js";import{ESP_EVENTS as p}from"../shared/events.js";let s=class extends m{constructor(){super(...arguments),this.dialogSlot=d(),this.vellumRef=d(),this.isOpen=!1,this._overlay=new E({host:this,getFocusTrapContainer:()=>this.vellumRef.value??null,getFocusFallback:()=>this.vellumRef.value??null}),this._closeReason="api",this._lifecycleToken=0,this.fullScreen=!1}toggleOpen(){if(this.isOpen){const e=this._closeReason;this._closeReason="api";const t=new CustomEvent(p.DIALOG_CLOSING,{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(t))return;const o=++this._lifecycleToken;this.removeAttribute("is-open"),this.isOpen=!1,this._overlay.close(),this.updateComplete.then(()=>{this.isOpen||this._lifecycleToken!==o||this.dispatchEvent(new CustomEvent(p.DIALOG_CLOSED,{detail:{reason:e},bubbles:!0,composed:!0}))})}else{const e=++this._lifecycleToken;this.setAttribute("is-open","true"),this.isOpen=!0,this._overlay.open(),this.updateComplete.then(()=>{!this.isOpen||this._lifecycleToken!==e||(this._moveFocusIntoDialog(),this.dispatchEvent(new CustomEvent(p.DIALOG_OPENED,{detail:{},bubbles:!0,composed:!0})))})}}_handleKeyDown(e){if(this.isOpen){if(e.key==="Escape"){e.preventDefault(),this._closeReason="escape",this.toggleOpen();return}e.key==="Tab"&&this._overlay.trapFocus(e)}}_moveFocusIntoDialog(){this._overlay.moveFocusInto()}firstUpdated(){this.dialogSlot.value&&this.dialogSlot.value.addEventListener("esp-form-dialog-close-requested",e=>{this._closeReason="close-dialog",this.toggleOpen(),e.preventDefault()})}disconnectedCallback(){super.disconnectedCallback()}render(){const{isOpen:e,fullScreen:t}=this,o={"is-open":e,"full-screen":t};return g`<div
|
|
2
2
|
${h(this.vellumRef)}
|
|
3
|
-
class="vellum ${
|
|
3
|
+
class="vellum ${k(o)}"
|
|
4
4
|
data-no-swipe
|
|
5
|
-
role=${e?"dialog":
|
|
6
|
-
aria-modal=${e?"true":
|
|
5
|
+
role=${e?"dialog":u}
|
|
6
|
+
aria-modal=${e?"true":u}
|
|
7
7
|
tabindex="-1"
|
|
8
8
|
@keydown=${this._handleKeyDown}
|
|
9
9
|
>
|
|
10
10
|
<slot ${h(this.dialogSlot)}></slot>
|
|
11
|
-
</div>`}};s.styles=v`
|
|
12
|
-
|
|
13
|
-
display: block;
|
|
14
|
-
}
|
|
15
|
-
.vellum {
|
|
16
|
-
display: grid;
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
justify-content: center;
|
|
19
|
-
padding: 0;
|
|
20
|
-
visibility: hidden;
|
|
21
|
-
position: fixed;
|
|
22
|
-
z-index: 10000;
|
|
23
|
-
left: 0;
|
|
24
|
-
top: 0;
|
|
25
|
-
|
|
26
|
-
height: 100vh;
|
|
27
|
-
height: 100dvh;
|
|
28
|
-
width: 100vw;
|
|
29
|
-
overflow-y: auto;
|
|
30
|
-
outline: none;
|
|
31
|
-
|
|
32
|
-
::slotted(*) {
|
|
33
|
-
z-index: 10;
|
|
34
|
-
position: relative;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
&::before {
|
|
38
|
-
content: "";
|
|
11
|
+
</div>`}};s.styles=[f(3),v(":host"),b`
|
|
12
|
+
:host {
|
|
39
13
|
display: block;
|
|
40
|
-
position: fixed;
|
|
41
|
-
inset: 0;
|
|
42
|
-
opacity: var(--esp-dialog-bg-opacity, var(--esp-vellum-opacity, 0.85));
|
|
43
|
-
background: var(
|
|
44
|
-
--esp-color-dialog-bg,
|
|
45
|
-
var(--esp-vellum-background, var(--esp-color-layer-3))
|
|
46
|
-
);
|
|
47
|
-
z-index: 1;
|
|
48
14
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
15
|
+
.vellum {
|
|
16
|
+
display: grid;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
padding: 0;
|
|
20
|
+
visibility: hidden;
|
|
53
21
|
position: fixed;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
22
|
+
z-index: 10000;
|
|
23
|
+
left: 0;
|
|
24
|
+
top: 0;
|
|
25
|
+
|
|
26
|
+
height: 100vh;
|
|
27
|
+
height: 100dvh;
|
|
28
|
+
width: 100vw;
|
|
29
|
+
overflow-y: auto;
|
|
30
|
+
outline: none;
|
|
61
31
|
|
|
62
|
-
|
|
63
|
-
|
|
32
|
+
::slotted(*) {
|
|
33
|
+
z-index: 10;
|
|
34
|
+
position: relative;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&::before {
|
|
38
|
+
content: "";
|
|
39
|
+
display: block;
|
|
40
|
+
position: fixed;
|
|
41
|
+
inset: 0;
|
|
42
|
+
opacity: var(--esp-dialog-bg-opacity, var(--esp-vellum-opacity, 0.85));
|
|
43
|
+
background: var(
|
|
44
|
+
--esp-color-dialog-bg,
|
|
45
|
+
var(--esp-vellum-background, var(--_esp-surface-background))
|
|
46
|
+
);
|
|
47
|
+
z-index: 1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&::after {
|
|
51
|
+
content: "";
|
|
52
|
+
display: block;
|
|
53
|
+
position: fixed;
|
|
54
|
+
inset: 0;
|
|
55
|
+
background-image: var(--esp-vellum-background-image, none);
|
|
56
|
+
background-repeat: repeat;
|
|
57
|
+
opacity: var(--esp-vellum-background-image-opacity, 0.3);
|
|
58
|
+
z-index: 2;
|
|
59
|
+
pointer-events: none;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&.is-open {
|
|
63
|
+
visibility: visible;
|
|
64
|
+
}
|
|
64
65
|
}
|
|
65
|
-
}
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
@media screen and (min-width: 400px) {
|
|
68
|
+
.vellum {
|
|
69
|
+
grid-template-columns: auto auto;
|
|
70
|
+
padding: var(--esp-size-big-to-large) 0;
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
&.full-screen {
|
|
73
|
+
padding: 0;
|
|
74
|
+
}
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
|
-
}
|
|
77
|
-
`,c([y()],s.prototype,"isOpen",void 0),c([g({attribute:"full-screen",type:Boolean})],s.prototype,"fullScreen",void 0),s=c([b("esp-dialog")],s);export{s as EspalierDialog};
|
|
77
|
+
`],c([O()],s.prototype,"isOpen",void 0),c([_({attribute:"full-screen",type:Boolean})],s.prototype,"fullScreen",void 0),s=c([y("esp-dialog")],s);export{s as EspalierDialog};
|
|
@@ -2,8 +2,8 @@ import { type PropertyValues } from "lit";
|
|
|
2
2
|
import { EspalierElementBase } from "../shared/esp-element-base.js";
|
|
3
3
|
import { type FlyoutCloseReason } from "../shared/flyout-events.js";
|
|
4
4
|
/**
|
|
5
|
-
* A
|
|
6
|
-
*
|
|
5
|
+
* A panel for help and additional information. Uses spare page width when
|
|
6
|
+
* available and switches to an overlay when the workspace cannot fit it.
|
|
7
7
|
*
|
|
8
8
|
* Place one `esp-flyout` in an `esp-page`'s `flyout` slot. The panel
|
|
9
9
|
* lives on the canvas after any persistent preview, outside the content
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var l=function(u,e,t,s){var o=arguments.length,r=o<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(u,e,t,s);else for(var i=u.length-1;i>=0;i--)(n=u[i])&&(r=(o<3?n(r):o>3?n(e,t,r):n(e,t))||r);return o>3&&r&&Object.defineProperty(e,t,r),r};import{css as p,html as w,nothing as S,unsafeCSS as F}from"lit";import{customElement as L,property as h}from"lit/decorators.js";import{classMap as G}from"lit/directives/class-map.js";import{createRef as M,ref as q}from"lit/directives/ref.js";import{EspalierElementBase as A}from"../shared/esp-element-base.js";import{ESP_EVENTS as f}from"../shared/events.js";import{getEspBus as
|
|
1
|
+
var l=function(u,e,t,s){var o=arguments.length,r=o<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(u,e,t,s);else for(var i=u.length-1;i>=0;i--)(n=u[i])&&(r=(o<3?n(r):o>3?n(e,t,r):n(e,t))||r);return o>3&&r&&Object.defineProperty(e,t,r),r};import{css as p,html as w,nothing as S,unsafeCSS as F}from"lit";import{customElement as L,property as h}from"lit/decorators.js";import{classMap as G}from"lit/directives/class-map.js";import{createRef as M,ref as q}from"lit/directives/ref.js";import{EspalierElementBase as A}from"../shared/esp-element-base.js";import{ESP_EVENTS as f}from"../shared/events.js";import{getEspBus as y}from"../shared/bus-events.js";import{FLYOUT_FULL_HEIGHT_REQUEST_EVENT as k,markFlyoutRequestServiced as H}from"../shared/flyout-events.js";import{OverlayController as B}from"../shared/overlay-controller.js";import{cancelSVG as V}from"../shared/svgs/cancel.js";import{traverseToClosest as v}from"../shared/utilities.js";import{RafThrottle as $}from"../shared/raf-throttle.js";import{COMPACT_VIEWPORT_MEDIA_QUERY as R}from"../shared/responsive.js";import{focusRing as I,quietCloseButton as Y}from"../shared/style-fragments.js";const D=R,U="Flyout",E=p`
|
|
2
2
|
position: fixed;
|
|
3
3
|
inset: 0;
|
|
4
4
|
margin-block-start: 0;
|
|
@@ -13,7 +13,7 @@ var l=function(u,e,t,s){var o=arguments.length,r=o<3?e:s===null?s=Object.getOwnP
|
|
|
13
13
|
inset: 0;
|
|
14
14
|
background-color: var(--esp-vellum-background, var(--esp-color-layer-3));
|
|
15
15
|
opacity: var(--esp-vellum-opacity, 0.85);
|
|
16
|
-
`,
|
|
16
|
+
`,_=p`
|
|
17
17
|
position: absolute;
|
|
18
18
|
inset-block: 0;
|
|
19
19
|
inset-inline-end: 0;
|
|
@@ -31,7 +31,7 @@ var l=function(u,e,t,s){var o=arguments.length,r=o<3?e:s===null?s=Object.getOwnP
|
|
|
31
31
|
@starting-style {
|
|
32
32
|
translate: 100% 0;
|
|
33
33
|
}
|
|
34
|
-
`;let a=class extends A{constructor(){super(...arguments),this.open=!1,this.heading="",this.mode="auto",this.pageOverlayRequested=!1,this.fullHeight=!1,this.matchSurface=!1,this.standalone=!1,this.scope="outermost",this.lastGeneratedAriaLabel=null,this.boundKeydown=e=>this.handleKeydown(e),this.boundShowRequest=e=>this.handleShowRequest(e),this.boundCloseRequest=()=>this.close(),this.boundOverlayMediaChange=()=>{this.syncOverlayModal(),this.syncAnchorTracking(),this.syncAnchorGeometry(),this.dispatchEvent(new CustomEvent(f.FLYOUT_STATE_CHANGED,{detail:{},bubbles:!0,composed:!0}))},this.boundAnchorViewportChange=()=>this.scheduleAnchorGeometrySync(),this.boundFullHeightRequest=e=>{e.stopPropagation(),this.fullHeight=!0},this.anchorGeometryFrame=new $(()=>this.syncAnchorGeometry()),this.trackingAnchorPosition=!1,this.busSubscribed=!1,this.panelRef=M(),this.overlay=new B({host:this,getFocusTrapContainer:()=>this.panelRef.value??null,getFocusFallback:()=>this.panelRef.value??null,promote:!1}),this.overlayActive=!1,this.baseRole="complementary"}get effectiveOverlay(){return this.mode==="overlay"||this.pageOverlayRequested||(this.overlayMediaQuery?.matches??!1)}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","complementary"),this.baseRole=this.getAttribute("role")??"complementary",!this.overlayMediaQuery&&typeof window<"u"&&"matchMedia"in window&&(this.overlayMediaQuery=window.matchMedia(D)),this.overlayMediaQuery?.addEventListener("change",this.boundOverlayMediaChange),this.syncBusSubscription(),document.addEventListener("keydown",this.boundKeydown),this.addEventListener(k,this.boundFullHeightRequest),this.syncOverlayModal(),this.syncAnchorTracking(),this.syncAnchorGeometry()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeBus(),this.overlayMediaQuery?.removeEventListener("change",this.boundOverlayMediaChange),document.removeEventListener("keydown",this.boundKeydown),this.removeEventListener(k,this.boundFullHeightRequest),this.stopAnchorTracking(),this.overlayActive&&(this.overlayActive=!1,this.setAttribute("role",this.baseRole),this.removeAttribute("aria-modal"),this.updateGeneratedAriaLabel()),this.overlayReturnFocusTo=void 0}syncBusSubscription(){if(this.standalone||!this.isConnected){this.unsubscribeBus();return}this.busSubscribed||(
|
|
34
|
+
`;let a=class extends A{constructor(){super(...arguments),this.open=!1,this.heading="",this.mode="auto",this.pageOverlayRequested=!1,this.fullHeight=!1,this.matchSurface=!1,this.standalone=!1,this.scope="outermost",this.lastGeneratedAriaLabel=null,this.boundKeydown=e=>this.handleKeydown(e),this.boundShowRequest=e=>this.handleShowRequest(e),this.boundCloseRequest=()=>this.close(),this.boundOverlayMediaChange=()=>{this.syncOverlayModal(),this.syncAnchorTracking(),this.syncAnchorGeometry(),this.dispatchEvent(new CustomEvent(f.FLYOUT_STATE_CHANGED,{detail:{},bubbles:!0,composed:!0}))},this.boundAnchorViewportChange=()=>this.scheduleAnchorGeometrySync(),this.boundFullHeightRequest=e=>{e.stopPropagation(),this.fullHeight=!0},this.anchorGeometryFrame=new $(()=>this.syncAnchorGeometry()),this.trackingAnchorPosition=!1,this.busSubscribed=!1,this.panelRef=M(),this.overlay=new B({host:this,getFocusTrapContainer:()=>this.panelRef.value??null,getFocusFallback:()=>this.panelRef.value??null,promote:!1}),this.overlayActive=!1,this.baseRole="complementary"}get effectiveOverlay(){return this.mode==="overlay"||this.pageOverlayRequested||(this.overlayMediaQuery?.matches??!1)}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","complementary"),this.baseRole=this.getAttribute("role")??"complementary",!this.overlayMediaQuery&&typeof window<"u"&&"matchMedia"in window&&(this.overlayMediaQuery=window.matchMedia(D)),this.overlayMediaQuery?.addEventListener("change",this.boundOverlayMediaChange),this.syncBusSubscription(),document.addEventListener("keydown",this.boundKeydown),this.addEventListener(k,this.boundFullHeightRequest),this.syncOverlayModal(),this.syncAnchorTracking(),this.syncAnchorGeometry()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeBus(),this.overlayMediaQuery?.removeEventListener("change",this.boundOverlayMediaChange),document.removeEventListener("keydown",this.boundKeydown),this.removeEventListener(k,this.boundFullHeightRequest),this.stopAnchorTracking(),this.overlayActive&&(this.overlayActive=!1,this.setAttribute("role",this.baseRole),this.removeAttribute("aria-modal"),this.updateGeneratedAriaLabel()),this.overlayReturnFocusTo=void 0}syncBusSubscription(){if(this.standalone||!this.isConnected){this.unsubscribeBus();return}this.busSubscribed||(y().subscribe("show-flyout",this.boundShowRequest),y().subscribe("close-flyout",this.boundCloseRequest),this.busSubscribed=!0)}unsubscribeBus(){this.busSubscribed&&(y().unsubscribe("show-flyout",this.boundShowRequest),y().unsubscribe("close-flyout",this.boundCloseRequest),this.busSubscribed=!1)}show(){this.open||(this.open=!0,this.dispatchEvent(new CustomEvent(f.FLYOUT_OPENED,{detail:{},bubbles:!0,composed:!0})))}close(e="programmatic"){if(this.open){if(this.open=!1,this.overlayActive)this.overlayReturnFocusTo=this.returnFocusTo;else{const t=this.focusIsInside();this.overlay.close(),t&&this.returnFocusTo?.focus()}this.returnFocusTo=void 0,this.dispatchEvent(new CustomEvent(f.FLYOUT_CLOSED,{detail:{reason:e},bubbles:!0,composed:!0}))}}toggle(){this.open?this.close():this.show()}handleShowRequest(e){this.shouldHandleShowRequest(e)&&(H(e),e.heading!==void 0&&(this.heading=e.heading),e.content!==void 0&&this.replaceChildren(typeof e.content=="string"?document.createTextNode(e.content):e.content),this.anchor=e.anchor,this.fullHeight=e.fullHeight??!1,this.returnFocusTo=e.returnFocusTo,this.show())}shouldHandleShowRequest(e){const t=v(this,"esp-page"),s=e.anchor??e.returnFocusTo;if(!s){if(!t)return!0;const i=this.getPageChain(t);return this.scope==="outermost"&&i[i.length-1]===t}const o=this.getPageChain(s);if(o.length===0)return t===null;const r=o.find(i=>this.hasNearestScopeFlyout(i)),n=r??o[o.length-1];return t!==n?!1:r?this.scope==="nearest":this.scope==="outermost"}getPageChain(e){const t=[];let s=e;for(;s;){const o=v(s,"esp-page");if(!o||t.includes(o))break;t.push(o),s=this.composedParent(o)}return t}hasNearestScopeFlyout(e){return Array.from(e.querySelectorAll("esp-flyout")).some(t=>!t.standalone&&t.scope==="nearest"&&v(t,"esp-page")===e)}handleKeydown(e){if(this.open){if(this.overlayActive&&e.key==="Tab"){this.overlay.trapFocus(e);return}e.key!=="Escape"||e.defaultPrevented||(e.preventDefault(),this.close("escape"))}}focusIsInside(){const e=document.activeElement;return e&&this.contains(e)?!0:this.shadowRoot?.activeElement!=null}updated(e){super.updated(e),e.has("standalone")&&this.syncBusSubscription(),e.has("heading")&&this.updateGeneratedAriaLabel(),(e.has("anchor")||e.has("fullHeight")||e.has("open")||e.has("mode")||e.has("pageOverlayRequested"))&&(this.syncAnchorTracking(),this.syncAnchorGeometry()),(e.has("open")||e.has("mode")||e.has("pageOverlayRequested"))&&this.syncOverlayModal(),(e.has("open")||e.has("mode")||e.has("anchor")||e.has("fullHeight")||e.has("pageOverlayRequested"))&&this.dispatchEvent(new CustomEvent(f.FLYOUT_STATE_CHANGED,{detail:{},bubbles:!0,composed:!0}))}syncAnchorGeometry(){const e=v(this,"esp-page"),t=this.anchor?this.getPageChain(this.anchor):[],s=e?.shadowRoot?.querySelector(".esp-page-main"),o=this.panelRef.value;if(!this.open||this.effectiveOverlay||!o){this.clearAnchorGeometry();return}const r=this.getVisibleBlockBounds(),n=Math.max(0,r.bottom-r.top);if(this.setGeometryProperty("--_esp-flyout-max-block-size",`${n}px`),this.fullHeight){this.clearAnchorPlacementGeometry();return}if(!this.anchor||!e||!t.includes(e)||!s){this.clearAnchorGeometry();return}const i=this.anchor.getBoundingClientRect(),d=Math.max(0,i.top-s.getBoundingClientRect().top),c=Number.isFinite(i.height)?i.height:0;this.setGeometryProperty("--_esp-flyout-anchor-offset",`${d}px`),this.setGeometryProperty("--_esp-flyout-anchor-block-size",`${c}px`);const m=o.getBoundingClientRect().height||n,C=Math.max(0,i.top+m-r.bottom),T=Math.max(0,m-c),g=Math.min(C,T);this.setGeometryProperty("--_esp-flyout-viewport-shift",`${g}px`);const P=i.top-g,b=8,O=i.top+c/2,z=Math.min(Math.max(b,m-b),Math.max(b,O-P));this.setGeometryProperty("--_esp-flyout-anchor-marker-offset",`${z}px`)}getVisibleBlockBounds(){const e=window.visualViewport;let t=e?.offsetTop??0,s=t+(e?.height??window.innerHeight);for(let o=this.composedParent(this);o;o=this.composedParent(o)){const r=getComputedStyle(o).overflowY;if(r!=="auto"&&r!=="scroll")continue;const n=o.getBoundingClientRect(),i=o instanceof HTMLElement?o.clientTop:0,d=o instanceof HTMLElement?o.clientHeight:n.height;if(d<=0)continue;const c=n.top+i;t=Math.max(t,c),s=Math.min(s,c+d)}return{top:t,bottom:Math.max(t,s)}}composedParent(e){if(e.parentElement)return e.parentElement;const t=e.getRootNode();return t instanceof ShadowRoot?t.host:null}setGeometryProperty(e,t){this.style.getPropertyValue(e)!==t&&this.style.setProperty(e,t)}clearAnchorGeometry(){this.clearAnchorPlacementGeometry(),this.style.removeProperty("--_esp-flyout-max-block-size")}clearAnchorPlacementGeometry(){this.style.removeProperty("--_esp-flyout-anchor-offset"),this.style.removeProperty("--_esp-flyout-viewport-shift"),this.style.removeProperty("--_esp-flyout-anchor-block-size"),this.style.removeProperty("--_esp-flyout-anchor-marker-offset")}scheduleAnchorGeometrySync(){this.isConnected&&this.anchorGeometryFrame.schedule()}syncAnchorTracking(){if(!(this.isConnected&&this.open&&(!!this.anchor||this.fullHeight)&&!this.effectiveOverlay)){this.stopAnchorTracking();return}this.trackingAnchorPosition||(this.trackingAnchorPosition=!0,window.addEventListener("scroll",this.boundAnchorViewportChange,{capture:!0,passive:!0}),window.addEventListener("resize",this.boundAnchorViewportChange,{passive:!0}));const t=this.panelRef.value;t&&t!==this.observedAnchorPanel&&typeof ResizeObserver<"u"&&(this.anchorResizeObserver??=new ResizeObserver(this.boundAnchorViewportChange),this.anchorResizeObserver.disconnect(),this.anchorResizeObserver.observe(t),this.observedAnchorPanel=t)}stopAnchorTracking(){this.trackingAnchorPosition&&(window.removeEventListener("scroll",this.boundAnchorViewportChange,{capture:!0}),window.removeEventListener("resize",this.boundAnchorViewportChange),this.trackingAnchorPosition=!1),this.anchorGeometryFrame.cancel(),this.anchorResizeObserver?.disconnect(),this.observedAnchorPanel=void 0}syncOverlayModal(){const e=this.isConnected&&this.open&&this.effectiveOverlay;if(e===this.overlayActive){!e&&!this.open&&this.overlay.close();return}e?(this.overlayActive=!0,this.setAttribute("role","dialog"),this.setAttribute("aria-modal","true"),this.updateGeneratedAriaLabel(),this.overlay.open(),this.updateComplete.then(()=>{this.overlayActive&&this.overlay.moveFocusInto()})):(this.overlayActive=!1,this.overlay.close(),this.overlayReturnFocusTo&&(this.overlayReturnFocusTo.focus(),this.overlayReturnFocusTo=void 0),this.setAttribute("role",this.baseRole),this.removeAttribute("aria-modal"),this.updateGeneratedAriaLabel())}updateGeneratedAriaLabel(){const e=this.getAttribute("aria-label");if(e!==null&&e!==this.lastGeneratedAriaLabel)return;const t=this.heading||(this.overlayActive?U:"");t?(this.setAttribute("aria-label",t),this.lastGeneratedAriaLabel=t):(this.removeAttribute("aria-label"),this.lastGeneratedAriaLabel=null)}render(){return w`
|
|
35
35
|
<div class="vellum" aria-hidden="true" @click=${()=>this.close("vellum")}></div>
|
|
36
36
|
<div
|
|
37
37
|
class=${G({panel:!0,anchored:!!this.anchor,"full-height":this.fullHeight})}
|
|
@@ -53,6 +53,7 @@ var l=function(u,e,t,s){var o=arguments.length,r=o<3?e:s===null?s=Object.getOwnP
|
|
|
53
53
|
`}};a.styles=[...A.styles,...Y(".panel > header > .close","1.25em"),I(".panel > header > .close:focus-visible","--esp-color-link","0 0 0 3px","inset"),p`
|
|
54
54
|
:host {
|
|
55
55
|
display: none;
|
|
56
|
+
--_esp-surface-layer: initial;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
:host([open]) {
|
|
@@ -197,7 +198,7 @@ var l=function(u,e,t,s){var o=arguments.length,r=o<3?e:s===null?s=Object.getOwnP
|
|
|
197
198
|
|
|
198
199
|
:host([open][mode="overlay"]) .panel,
|
|
199
200
|
:host([open][data-page-overlay]) .panel {
|
|
200
|
-
${
|
|
201
|
+
${_}
|
|
201
202
|
}
|
|
202
203
|
|
|
203
204
|
:host([open][mode="overlay"]) .panel.anchored::before,
|
|
@@ -220,7 +221,7 @@ var l=function(u,e,t,s){var o=arguments.length,r=o<3?e:s===null?s=Object.getOwnP
|
|
|
220
221
|
}
|
|
221
222
|
|
|
222
223
|
.panel {
|
|
223
|
-
${
|
|
224
|
+
${_}
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
.panel.anchored::before,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var s=function(n,e,r,i){var c=arguments.length,o=c<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,r,i);else for(var l=n.length-1;l>=0;l--)(p=n[l])&&(o=(c<3?p(o):c>3?p(e,r,o):p(e,r))||o);return c>3&&o&&Object.defineProperty(e,r,o),o};import{css as f,html as m}from"lit";import{customElement as h,property as a}from"lit/decorators.js";import{styleMap as g}from"lit/directives/style-map.js";import{EspalierElementBase as u}from"../shared/esp-element-base.js";import{clampFocus as v,focusConverter as b,normalizeFocus as y}from"../image/image-focus.js";import"../image/esp-image.js";import{ESP_EVENTS as d}from"../shared/events.js";const
|
|
1
|
+
var s=function(n,e,r,i){var c=arguments.length,o=c<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,r,i);else for(var l=n.length-1;l>=0;l--)(p=n[l])&&(o=(c<3?p(o):c>3?p(e,r,o):p(e,r))||o);return c>3&&o&&Object.defineProperty(e,r,o),o};import{css as f,html as m}from"lit";import{customElement as h,property as a}from"lit/decorators.js";import{styleMap as g}from"lit/directives/style-map.js";import{EspalierElementBase as u}from"../shared/esp-element-base.js";import{clampFocus as v,focusConverter as b,normalizeFocus as y}from"../image/image-focus.js";import"../image/esp-image.js";import{ESP_EVENTS as d}from"../shared/events.js";const _=d.FOCUS_PICKER_CHANGED;let t=class extends u{constructor(){super(...arguments),this.src="",this.alt="",this.focusPoint={x:.5,y:.5},this.ratio="3/1",this.compactRatio="3/2",this.activePointer=null,this.handlePointerDown=e=>{e.button===0&&(e.preventDefault(),this.activePointer=e.pointerId,e.currentTarget.setPointerCapture?.(e.pointerId),this.updateFromPointer(e))},this.handlePointerMove=e=>{e.pointerId===this.activePointer&&this.updateFromPointer(e)},this.handlePointerEnd=e=>{e.pointerId===this.activePointer&&(e.currentTarget.releasePointerCapture?.(e.pointerId),this.activePointer=null)},this.handleKeyDown=e=>{const r=e.shiftKey?.01:.05,i={};if(e.key==="ArrowLeft")i.x=-r;else if(e.key==="ArrowRight")i.x=r;else if(e.key==="ArrowUp")i.y=-r;else if(e.key==="ArrowDown")i.y=r;else return;e.preventDefault(),this.updateFocus({x:this.focusPoint.x+(i.x??0),y:this.focusPoint.y+(i.y??0)})}}willUpdate(e){if(super.willUpdate(e),e.has("focusPoint")){const r=this.focusPoint,i=y(r);(i.x!==r?.x||i.y!==r?.y)&&(this.focusPoint=i)}}updateFocus(e){const r=v(e),i={x:Number(r.x.toFixed(4)),y:Number(r.y.toFixed(4))};i.x===this.focusPoint.x&&i.y===this.focusPoint.y||(this.focusPoint=i,this.dispatchEvent(new CustomEvent(d.FOCUS_PICKER_CHANGED,{detail:{...i},bubbles:!0,composed:!0})))}updateFromPointer(e){const i=e.currentTarget.getBoundingClientRect();i.width<=0||i.height<=0||this.updateFocus({x:(e.clientX-i.left)/i.width,y:(e.clientY-i.top)/i.height})}render(){const e=Math.round(this.focusPoint.x*100),r=Math.round(this.focusPoint.y*100),i={"--_esp-focus-picker-x":`${this.focusPoint.x*100}%`,"--_esp-focus-picker-y":`${this.focusPoint.y*100}%`};return m`
|
|
2
2
|
<div part="picker" class="picker">
|
|
3
3
|
<div
|
|
4
4
|
part="stage"
|
|
@@ -63,6 +63,7 @@ var s=function(n,e,r,i){var c=arguments.length,o=c<3?e:i===null?i=Object.getOwnP
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
.stage {
|
|
66
|
+
--_esp-surface-layer: 2;
|
|
66
67
|
position: relative;
|
|
67
68
|
overflow: hidden;
|
|
68
69
|
min-block-size: var(--esp-size-big);
|
|
@@ -126,4 +127,4 @@ var s=function(n,e,r,i){var c=arguments.length,o=c<3?e:i===null?i=Object.getOwnP
|
|
|
126
127
|
transition: none;
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
|
-
`],s([a({type:String})],t.prototype,"src",void 0),s([a({type:String})],t.prototype,"alt",void 0),s([a({attribute:"focus",converter:b,reflect:!0})],t.prototype,"focusPoint",void 0),s([a({type:String})],t.prototype,"ratio",void 0),s([a({attribute:"compact-ratio",type:String})],t.prototype,"compactRatio",void 0),t=s([h("esp-focus-picker")],t);export{t as EspalierFocusPicker,
|
|
130
|
+
`],s([a({type:String})],t.prototype,"src",void 0),s([a({type:String})],t.prototype,"alt",void 0),s([a({attribute:"focus",converter:b,reflect:!0})],t.prototype,"focusPoint",void 0),s([a({type:String})],t.prototype,"ratio",void 0),s([a({attribute:"compact-ratio",type:String})],t.prototype,"compactRatio",void 0),t=s([h("esp-focus-picker")],t);export{t as EspalierFocusPicker,_ as FOCUS_CHANGED_EVENT};
|
|
@@ -8,13 +8,13 @@ export type FooterColumns = "auto" | "1" | "2" | "3" | "4" | "5" | "6";
|
|
|
8
8
|
* artwork, link groups, supporting actions, and legal or utility content.
|
|
9
9
|
* Its background remains full-bleed while its content automatically aligns
|
|
10
10
|
* to the surface of a containing [`<esp-page>`](/components/page/).
|
|
11
|
-
* The decorative background uses the same internal visual-layer primitive as
|
|
12
|
-
* `esp-image` banners; the footer's public background tokens are unchanged.
|
|
13
|
-
*
|
|
14
11
|
* Use bare [`<esp-footer-link-group>`](/components/footer/link-group/) children
|
|
15
12
|
* when navigation groups should auto-flow independently through the grid.
|
|
16
13
|
* `columns` is a maximum: the grid always drops columns when they no longer fit.
|
|
17
14
|
*
|
|
15
|
+
* A field fills one layer above the surface it sits on.
|
|
16
|
+
* Use `surface-layer="1|2|3|4"` to select the default painted layer.
|
|
17
|
+
*
|
|
18
18
|
* ```html
|
|
19
19
|
* <esp-footer
|
|
20
20
|
* light-brand-logo="/assets/logo-light.svg"
|