@taprootio/espalier 3.9.0 → 4.1.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 +17 -0
- package/custom-elements.json +24428 -25047
- package/dist/action-menu/esp-action-menu-item.d.ts +4 -4
- package/dist/action-menu/esp-action-menu-item.js +1 -1
- package/dist/action-menu/esp-action-menu.d.ts +2 -2
- package/dist/action-menu/esp-action-menu.js +6 -6
- package/dist/box/esp-box.d.ts +1 -1
- package/dist/burger/esp-burger.d.ts +4 -4
- package/dist/burger/esp-burger.js +4 -4
- package/dist/button/esp-button.d.ts +5 -5
- package/dist/button/esp-button.js +9 -9
- package/dist/checkbox/esp-checkbox-group.d.ts +4 -2
- package/dist/checkbox/esp-checkbox-group.js +1 -1
- package/dist/checkbox/esp-checkbox.d.ts +4 -2
- package/dist/color-picker/esp-color-picker.d.ts +2 -2
- package/dist/color-picker/esp-color-picker.js +4 -4
- package/dist/date-picker/esp-date-picker.d.ts +5 -3
- package/dist/date-picker/esp-date-picker.js +7 -7
- package/dist/details/esp-details-group.d.ts +1 -1
- package/dist/details/esp-details-group.js +3 -3
- package/dist/details/esp-details.d.ts +2 -2
- package/dist/details/esp-details.js +3 -3
- package/dist/dialog/esp-dialog.d.ts +7 -7
- package/dist/dialog/esp-dialog.js +7 -7
- package/dist/file-upload/esp-file-upload.d.ts +5 -2
- package/dist/file-upload/esp-file-upload.js +3 -3
- package/dist/flyout/esp-flyout.d.ts +10 -10
- package/dist/flyout/esp-flyout.js +14 -14
- package/dist/focus-picker/esp-focus-picker.d.ts +4 -4
- package/dist/focus-picker/esp-focus-picker.js +4 -4
- package/dist/font-picker/esp-font-picker.d.ts +1 -1
- package/dist/font-picker/esp-font-picker.js +2 -2
- package/dist/form/esp-form.d.ts +9 -9
- package/dist/form/esp-form.js +1 -1
- package/dist/grid/esp-grid.d.ts +10 -10
- package/dist/grid/esp-grid.js +13 -11
- package/dist/header/esp-header-button.d.ts +2 -2
- package/dist/header/esp-header-button.js +1 -1
- package/dist/header/esp-header.d.ts +5 -5
- package/dist/header/esp-header.js +4 -4
- package/dist/help/esp-help-provider.js +1 -1
- package/dist/help/help-document.js +1 -1
- package/dist/image-upload/esp-image-preview.js +8 -8
- package/dist/image-upload/esp-image-upload.d.ts +14 -14
- package/dist/image-upload/esp-image-upload.js +10 -10
- package/dist/image-upload/image-helpers.d.ts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/info/esp-info.d.ts +2 -2
- package/dist/info/esp-info.js +6 -6
- package/dist/input/esp-input.d.ts +8 -7
- package/dist/input/esp-input.js +2 -2
- package/dist/lightbox/esp-lightbox.js +6 -6
- package/dist/menu/esp-menu-group.d.ts +1 -1
- package/dist/menu/esp-menu-group.js +1 -1
- package/dist/menu/esp-menu-item.d.ts +2 -2
- package/dist/menu/esp-menu-item.js +2 -2
- package/dist/menu/esp-menu.d.ts +2 -2
- package/dist/menu/esp-menu.js +9 -9
- package/dist/page/esp-page.d.ts +4 -4
- package/dist/page/esp-page.js +1 -1
- package/dist/pickers/esp-pick-one.d.ts +3 -1
- package/dist/pickers/esp-pick-one.js +2 -2
- package/dist/pickers/esp-pick-some.d.ts +3 -1
- package/dist/pickers/esp-pick-some.js +1 -1
- package/dist/pickers/esp-picker-base.d.ts +1 -1
- package/dist/pickers/esp-picker-menu.d.ts +4 -4
- package/dist/pickers/esp-picker-menu.js +7 -7
- package/dist/popover/esp-popover.d.ts +2 -2
- package/dist/popover/esp-popover.js +3 -3
- package/dist/progress/esp-progress.d.ts +4 -4
- package/dist/radio-button/esp-radio-button-group.d.ts +4 -2
- package/dist/radio-button/esp-radio-button-group.js +4 -4
- package/dist/radio-button/esp-radio-button.d.ts +1 -1
- package/dist/repeater/esp-repeater.d.ts +2 -12
- package/dist/search/esp-search.d.ts +4 -4
- package/dist/search/esp-search.js +3 -3
- package/dist/shared/esp-element-base.js +1 -1
- package/dist/shared/events.d.ts +151 -70
- package/dist/shared/events.js +1 -1
- package/dist/shared/flyout-events.d.ts +1 -1
- package/dist/shared/flyout-events.js +1 -1
- package/dist/shared/form-field-controller.d.ts +3 -3
- package/dist/shared/intent-values.d.ts +0 -12
- package/dist/shared/intent-values.js +1 -1
- package/dist/shared/theme.d.ts +13 -4
- package/dist/shared/theme.js +1 -1
- package/dist/shared/utilities.d.ts +0 -31
- package/dist/shared/utilities.js +1 -1
- package/dist/shared/validation.d.ts +2 -2
- package/dist/shared/validation.js +1 -1
- package/dist/slider/esp-slider.d.ts +4 -2
- package/dist/status-indicator/esp-status-indicator.js +2 -2
- package/dist/switch/esp-switch.d.ts +4 -2
- package/dist/tabs/esp-tab-group.d.ts +2 -2
- package/dist/tabs/esp-tab-group.js +4 -4
- package/dist/tabs/esp-tab.d.ts +2 -1
- package/dist/tabs/esp-tab.js +2 -2
- package/dist/textarea/esp-textarea.d.ts +6 -5
- package/dist/textarea/esp-textarea.js +1 -1
- package/dist/toaster/esp-toaster.d.ts +4 -4
- package/dist/toaster/esp-toaster.js +1 -1
- package/dist/tree/esp-tree.d.ts +2 -1
- package/dist/tree/esp-tree.js +26 -26
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ export type ActionMenuItemIconPosition = "left" | "right";
|
|
|
9
9
|
*
|
|
10
10
|
* Use the optional `icon` slot for a leading visual cue. Link-style
|
|
11
11
|
* action items are intentionally not part of this API yet; use the
|
|
12
|
-
* parent menu's `select` event and handle navigation in application
|
|
12
|
+
* parent menu's `esp-action-menu-select` event and handle navigation in application
|
|
13
13
|
* code until the href behavior is reviewed.
|
|
14
14
|
*
|
|
15
15
|
* ```html
|
|
@@ -30,8 +30,8 @@ export type ActionMenuItemIconPosition = "left" | "right";
|
|
|
30
30
|
* @slot icon - Optional custom leading icon. Slotted icons override
|
|
31
31
|
* the generated SVG from the `icon` attribute.
|
|
32
32
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
33
|
+
* Activation is reported through a private coordination event consumed by
|
|
34
|
+
* the parent action menu.
|
|
35
35
|
*
|
|
36
36
|
* @cssprop --esp-action-menu-item-padding - Padding inside each
|
|
37
37
|
* menu item. Defaults to `var(--esp-size-tiny) var(--esp-size-small)`.
|
|
@@ -68,7 +68,7 @@ export declare class EspalierActionMenuItem extends EspalierElementBase {
|
|
|
68
68
|
*/
|
|
69
69
|
icon: string;
|
|
70
70
|
/**
|
|
71
|
-
* Value included in the parent menu's `select` event detail.
|
|
71
|
+
* Value included in the parent menu's `esp-action-menu-select` event detail.
|
|
72
72
|
*/
|
|
73
73
|
value: string;
|
|
74
74
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var s=function(r,i,t,n){var a=arguments.length,e=a<3?i:n===null?n=Object.getOwnPropertyDescriptor(i,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(r,i,t,n);else for(var p=r.length-1;p>=0;p--)(c=r[p])&&(e=(a<3?c(e):a>3?c(i,t,e):c(i,t))||e);return a>3&&e&&Object.defineProperty(i,t,e),e};import{css as h,html as m,nothing as u}from"lit";import{customElement as f,property as l}from"lit/decorators.js";import{classMap as g}from"lit/directives/class-map.js";import{ref as v}from"lit/directives/ref.js";import{EspalierElementBase as d}from"../shared/esp-element-base.js";import{getIconHrefForHost as b}from"../shared/intent-values.js";import{SlottedIconController as y}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as P}from"../shared/svgs/render-sprite-icon.js";let o=class extends d{constructor(){super(...arguments),this.iconSlot=new y(this),this.iconPositionExplicit=!1,this.inheritingIconPosition=!1,this._iconPosition="left",this.icon="",this.value="",this.disabled=!1,this.handleClick=i=>{if(this.disabled){i.preventDefault();return}this.activate()}}get iconPosition(){return this._iconPosition}set iconPosition(i){const t=this._iconPosition;this._iconPosition=i,this.inheritingIconPosition||(this.iconPositionExplicit=!0),this.requestUpdate("iconPosition",t)}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.handleClick)}updated(i){super.updated(i),this.setAttribute("role","menuitem"),this.setAttribute("aria-disabled",String(this.disabled))}activate(){this.disabled||this.dispatchEvent(new CustomEvent("esp-action-menu-item-activate",{detail:{item:this},bubbles:!0,composed:!0}))}inheritIconPosition(i){this.iconPositionExplicit||(this.inheritingIconPosition=!0,this.iconPosition=i,this.inheritingIconPosition=!1)}render(){const i=b(this.icon,this),t=this.iconSlot.hasSlottedIcon(),n={item:!0,"has-icon":t||i.length>0,"icon-right":this.iconPosition==="right"};return m`
|
|
1
|
+
var s=function(r,i,t,n){var a=arguments.length,e=a<3?i:n===null?n=Object.getOwnPropertyDescriptor(i,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(r,i,t,n);else for(var p=r.length-1;p>=0;p--)(c=r[p])&&(e=(a<3?c(e):a>3?c(i,t,e):c(i,t))||e);return a>3&&e&&Object.defineProperty(i,t,e),e};import{css as h,html as m,nothing as u}from"lit";import{customElement as f,property as l}from"lit/decorators.js";import{classMap as g}from"lit/directives/class-map.js";import{ref as v}from"lit/directives/ref.js";import{EspalierElementBase as d}from"../shared/esp-element-base.js";import{getIconHrefForHost as b}from"../shared/intent-values.js";import{SlottedIconController as y}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as P}from"../shared/svgs/render-sprite-icon.js";let o=class extends d{constructor(){super(...arguments),this.iconSlot=new y(this),this.iconPositionExplicit=!1,this.inheritingIconPosition=!1,this._iconPosition="left",this.icon="",this.value="",this.disabled=!1,this.handleClick=i=>{if(this.disabled){i.preventDefault();return}this.activate()}}get iconPosition(){return this._iconPosition}set iconPosition(i){const t=this._iconPosition;this._iconPosition=i,this.inheritingIconPosition||(this.iconPositionExplicit=!0),this.requestUpdate("iconPosition",t)}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.handleClick)}updated(i){super.updated(i),this.setAttribute("role","menuitem"),this.setAttribute("aria-disabled",String(this.disabled))}activate(){this.disabled||this.dispatchEvent(new CustomEvent("esp-internal-action-menu-item-activate",{detail:{item:this},bubbles:!0,composed:!0}))}inheritIconPosition(i){this.iconPositionExplicit||(this.inheritingIconPosition=!0,this.iconPosition=i,this.inheritingIconPosition=!1)}render(){const i=b(this.icon,this),t=this.iconSlot.hasSlottedIcon(),n={item:!0,"has-icon":t||i.length>0,"icon-right":this.iconPosition==="right"};return m`
|
|
2
2
|
<span part="item" class=${g(n)}>
|
|
3
3
|
<span part="icon" class="icon">
|
|
4
4
|
<slot
|
|
@@ -35,7 +35,7 @@ export type ActionMenuSelectDetail = {
|
|
|
35
35
|
* </esp-action-menu-item>
|
|
36
36
|
* </esp-action-menu>
|
|
37
37
|
* <script>
|
|
38
|
-
* findById("demo-actions").addEventListener("select", (event) => {
|
|
38
|
+
* findById("demo-actions").addEventListener("esp-action-menu-select", (event) => {
|
|
39
39
|
* showToast({
|
|
40
40
|
* message: `Selected ${event.detail.value}`,
|
|
41
41
|
* icon: "info-i",
|
|
@@ -70,7 +70,7 @@ export type ActionMenuSelectDetail = {
|
|
|
70
70
|
* @slot - Place `esp-action-menu-item` children here.
|
|
71
71
|
* @slot trigger - Optional custom trigger element.
|
|
72
72
|
*
|
|
73
|
-
* @event {CustomEvent<ActionMenuSelectDetail>} select - Emitted from
|
|
73
|
+
* @event {CustomEvent<ActionMenuSelectDetail>} esp-action-menu-select - Emitted from
|
|
74
74
|
* the menu when an enabled item is activated.
|
|
75
75
|
*
|
|
76
76
|
* @cssprop --esp-action-menu-background - Menu surface background.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var l=function(
|
|
1
|
+
var l=function(d,e,t,s){var o=arguments.length,i=o<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(d,e,t,s);else for(var r=d.length-1;r>=0;r--)(a=d[r])&&(i=(o<3?a(i):o>3?a(e,t,i):a(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i};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 c,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 w}from"../shared/events.js";import"./esp-action-menu-item.js";const y=p` <svg
|
|
2
2
|
xmlns="http://www.w3.org/2000/svg"
|
|
3
3
|
viewBox="0 0 24 24"
|
|
4
4
|
fill="currentColor"
|
|
@@ -7,15 +7,15 @@ var l=function(c,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=c(),this.itemsSlot=c(),this.triggerSlot=c(),this.triggerShell=c(),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=r=>{if(r){for(const[m,b]of Object.entries(e))r.setAttribute(m,b);"disabled"in r&&(r.disabled=this.disabled)}};t(this.triggerShell.value);const s=this.slottedTrigger;t(s);const o=this.getTriggerControl(s);t(o),this.wireTriggerControl(o);const i=this.defaultTrigger;i?.setAttribute("aria-label","Actions"),t(i);const a=this.getTriggerControl(i);t(a),this.wireTriggerControl(a),i&&i.updateComplete.then(()=>{const r=this.getTriggerControl(i);t(r),r?.setAttribute("aria-label","Actions"),this.wireTriggerControl(r)}),s&&"updateComplete"in s&&s.updateComplete.then(()=>{const r=this.getTriggerControl(s);t(r),this.wireTriggerControl(r)})}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(w.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"}
|
|
14
14
|
attach=${e}
|
|
15
15
|
align=${t}
|
|
16
16
|
offset="2px"
|
|
17
|
-
@popover-opened=${this.handlePopoverOpened}
|
|
18
|
-
@popover-closed=${this.handlePopoverClosed}
|
|
17
|
+
@esp-popover-opened=${this.handlePopoverOpened}
|
|
18
|
+
@esp-popover-closed=${this.handlePopoverClosed}
|
|
19
19
|
>
|
|
20
20
|
<span
|
|
21
21
|
${h(this.triggerShell)}
|
|
@@ -33,7 +33,7 @@ var l=function(c,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
|
+
${y}
|
|
37
37
|
</esp-button>
|
|
38
38
|
</slot>
|
|
39
39
|
</span>
|
|
@@ -72,4 +72,4 @@ var l=function(c,e,t,s){var o=arguments.length,i=o<3?e:s===null?s=Object.getOwnP
|
|
|
72
72
|
::slotted(esp-action-menu-item + esp-action-menu-item) {
|
|
73
73
|
border-top: 1px dotted var(--esp-color-border);
|
|
74
74
|
}
|
|
75
|
-
`],l([
|
|
75
|
+
`],l([g()],n.prototype,"open",void 0),l([g()],n.prototype,"focusedIndex",void 0),l([u({type:String})],n.prototype,"placement",void 0),l([u({type:Boolean,reflect:!0})],n.prototype,"disabled",void 0),l([u({attribute:"icon-position",type:String})],n.prototype,"iconPosition",void 0),n=l([I("esp-action-menu")],n);export{n as EspalierActionMenu};
|
package/dist/box/esp-box.d.ts
CHANGED
|
@@ -113,7 +113,7 @@ export declare class EspalierBox extends EspalierElementBase {
|
|
|
113
113
|
* let fullScreen = false;
|
|
114
114
|
* const theBox = findByTagName("esp-box")[0];
|
|
115
115
|
* const theButton = findByTagName("esp-button")[0];
|
|
116
|
-
* theButton.addEventListener("clicked", () => {
|
|
116
|
+
* theButton.addEventListener("esp-clicked", () => {
|
|
117
117
|
* fullScreen = !fullScreen;
|
|
118
118
|
*
|
|
119
119
|
* if(fullScreen) {
|
|
@@ -12,22 +12,22 @@ import { LitElement } from "lit";
|
|
|
12
12
|
* @cssprop --esp-color-burger-opened - The color of the burger lines when open.
|
|
13
13
|
* @cssprop --esp-color-burger-opened-hover - The hover color of the burger lines when open.
|
|
14
14
|
* @cssprop --esp-size-burger-stroke - The stroke width of the burger lines.
|
|
15
|
-
* @event {CustomEvent} opened - Emitted when the button is clicked and the image changes from a burger to an X.
|
|
16
|
-
* @event {CustomEvent} closed - Emitted when the button is clicked and the image changes from an X to a burger.
|
|
15
|
+
* @event {CustomEvent} esp-burger-opened - Emitted when the button is clicked and the image changes from a burger to an X.
|
|
16
|
+
* @event {CustomEvent} esp-burger-closed - Emitted when the button is clicked and the image changes from an X to a burger.
|
|
17
17
|
*
|
|
18
18
|
* ```html
|
|
19
19
|
* <esp-burger></esp-burger>
|
|
20
20
|
* <script>
|
|
21
21
|
* const theBurger = findByTagName("esp-burger")[0];
|
|
22
22
|
*
|
|
23
|
-
* theBurger.addEventListener("opened", () => {
|
|
23
|
+
* theBurger.addEventListener("esp-burger-opened", () => {
|
|
24
24
|
* showToast({
|
|
25
25
|
* message: "It would be a good time to show the menu. This message will self-destruct in 4 seconds...",
|
|
26
26
|
* icon: "info-i",
|
|
27
27
|
* duration: 4
|
|
28
28
|
* });
|
|
29
29
|
* });
|
|
30
|
-
* theBurger.addEventListener("closed", () => {
|
|
30
|
+
* theBurger.addEventListener("esp-burger-closed", () => {
|
|
31
31
|
* showToast({
|
|
32
32
|
* message: "It would be a good time to hide the menu. This message will self-destruct in 4 seconds...",
|
|
33
33
|
* icon: "info-i",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var p=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s};import{LitElement as
|
|
1
|
+
var p=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s};import{LitElement as m,css as C,html as c}from"lit";import{classMap as u}from"lit/directives/class-map.js";import{customElement as v,property as h}from"lit/decorators.js";import{ESP_EVENTS as d}from"../shared/events.js";let a=class extends m{constructor(){super(...arguments),this.menuOpen=!1,this.presentationOnly=!1}render(){const{menuOpen:e}=this,t=e?"Close menu":"Open menu",r=c`
|
|
2
2
|
<svg>
|
|
3
3
|
<defs>
|
|
4
4
|
<filter id="animate-button">
|
|
@@ -13,7 +13,7 @@ var p=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnP
|
|
|
13
13
|
</filter>
|
|
14
14
|
</defs>
|
|
15
15
|
</svg>
|
|
16
|
-
<div class=${
|
|
16
|
+
<div class=${u({plate:!0,active:e})}>
|
|
17
17
|
<svg class="esp-burger" version="1.1" viewBox="0 0 100 100">
|
|
18
18
|
<path
|
|
19
19
|
class="line line1"
|
|
@@ -47,7 +47,7 @@ var p=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnP
|
|
|
47
47
|
</div>
|
|
48
48
|
`;return this.presentationOnly?c`<div class="animated-mb" aria-hidden="true">${r}</div>`:c`<button class="animated-mb" @click=${this.toggleMenu} aria-label=${t}>
|
|
49
49
|
${r}
|
|
50
|
-
</button>`}toggleMenu(){this.menuOpen=!this.menuOpen,this.menuOpen?this.dispatchEvent(new CustomEvent(
|
|
50
|
+
</button>`}toggleMenu(){this.menuOpen=!this.menuOpen,this.menuOpen?this.dispatchEvent(new CustomEvent(d.BURGER_OPENED,{bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent(d.BURGER_CLOSED,{bubbles:!0,composed:!0}))}};a.styles=C`
|
|
51
51
|
:host {
|
|
52
52
|
height: var(--esp-header-height, calc(4.5 * var(--esp-size-small)));
|
|
53
53
|
width: var(--esp-header-height, calc(4.5 * var(--esp-size-small)));
|
|
@@ -200,4 +200,4 @@ var p=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnP
|
|
|
200
200
|
transition: transform 400ms 50ms;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
`,p([
|
|
203
|
+
`,p([h({attribute:"menu-open",type:Boolean})],a.prototype,"menuOpen",void 0),p([h({attribute:"presentation-only",type:Boolean})],a.prototype,"presentationOnly",void 0),a=p([v("esp-burger")],a);export{a as EspalierBurger};
|
|
@@ -8,7 +8,7 @@ export type ButtonIconPosition = "left" | "right";
|
|
|
8
8
|
* <esp-button label="Hello there!"></esp-button>
|
|
9
9
|
* <script>
|
|
10
10
|
* const theButton = findByTagName("esp-button")[0];
|
|
11
|
-
* theButton.addEventListener("clicked", () => {
|
|
11
|
+
* theButton.addEventListener("esp-clicked", () => {
|
|
12
12
|
* showToast({
|
|
13
13
|
* message: `You clicked the button!`,
|
|
14
14
|
* icon: "info-i",
|
|
@@ -59,13 +59,13 @@ export type ButtonIconPosition = "left" | "right";
|
|
|
59
59
|
* <esp-button label="Profile" icon="user-circle"></esp-button>
|
|
60
60
|
* ```
|
|
61
61
|
*
|
|
62
|
-
* @event {CustomEvent} clicked - Emitted when the button is clicked.
|
|
62
|
+
* @event {CustomEvent} esp-clicked - Emitted when the button is clicked.
|
|
63
63
|
*
|
|
64
64
|
* ```html
|
|
65
65
|
* <esp-button label="Click me!"></esp-button>
|
|
66
66
|
* <script>
|
|
67
67
|
* const theButton = findByTagName("esp-button")[0];
|
|
68
|
-
* theButton.addEventListener("clicked", () => {
|
|
68
|
+
* theButton.addEventListener("esp-clicked", () => {
|
|
69
69
|
* showToast({
|
|
70
70
|
* message: `Hi! You clicked the button. This message will self-destruct in 4 seconds...`,
|
|
71
71
|
* icon: "info-i",
|
|
@@ -151,7 +151,7 @@ export declare class EspalierButton extends EspalierElementBase {
|
|
|
151
151
|
* <esp-button disabled label="Disabled"></esp-button>
|
|
152
152
|
* <script>
|
|
153
153
|
* const theButton = findByTagName("esp-button")[0];
|
|
154
|
-
* theButton.addEventListener("clicked", () => {
|
|
154
|
+
* theButton.addEventListener("esp-clicked", () => {
|
|
155
155
|
* alert("We will not get here...");
|
|
156
156
|
* });
|
|
157
157
|
* </script>
|
|
@@ -233,7 +233,7 @@ export declare class EspalierButton extends EspalierElementBase {
|
|
|
233
233
|
* <esp-button label="Click me..." icon="save"></esp-button>
|
|
234
234
|
* <script>
|
|
235
235
|
* const theButton = findByTagName("esp-button")[0];
|
|
236
|
-
* theButton.addEventListener("clicked", async () => {
|
|
236
|
+
* theButton.addEventListener("esp-clicked", async () => {
|
|
237
237
|
* theButton.loading = true;
|
|
238
238
|
* setTimeout(function() {
|
|
239
239
|
* theButton.loading = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var n=function(h,t,r,o){var a=arguments.length,i=a<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,r):o,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(h,t,r,o);else for(var
|
|
1
|
+
var n=function(h,t,r,o){var a=arguments.length,i=a<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,r):o,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(h,t,r,o);else for(var p=h.length-1;p>=0;p--)(d=h[p])&&(i=(a<3?d(i):a>3?d(t,r,i):d(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i};import{css as f,html as c,nothing as l}from"lit";import{customElement as g,eventOptions as m,property as s,state as v}from"lit/decorators.js";import{classMap as u}from"lit/directives/class-map.js";import{EspalierElementBase as b}from"../shared/esp-element-base.js";import{ESP_EVENTS as y}from"../shared/events.js";import{ref as w}from"lit/directives/ref.js";import{getIconHrefForHost as x}from"../shared/intent-values.js";import{SlottedIconController as k}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as T}from"../shared/svgs/render-sprite-icon.js";import{BUTTON_INTERACTION_LIGHTNESS_FACTOR as S}from"./action-state-lightness.js";const $=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 n=function(h,t,r,o){var a=arguments.length,i=a<3?t:o===null?o=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 b{constructor(){super(...arguments),this.iconSlot=new
|
|
13
|
+
</svg>`;let e=class extends b{constructor(){super(...arguments),this.iconSlot=new k(this),this.innerTabindex=null,this.neutralizingTabindex=!1,this.buttonType="button",this.collapsed=!1,this.disabled=!1,this.href="",this.iconOnly=!1,this.incognito=!1,this.icon="",this.iconPosition="right",this.label="",this.loading=!1,this.target="",this.rel="",this.formNoValidate=!1,this.buildIcon=t=>this.loading?c` <span>${$}</span> `:c`
|
|
14
14
|
<span>
|
|
15
|
-
<slot ${
|
|
16
|
-
${!this.iconSlot.hasSlottedIcon(":scope > *")&&t?
|
|
15
|
+
<slot ${w(this.iconSlot.slotRef)} @slotchange=${this.iconSlot.handleSlotChange}></slot>
|
|
16
|
+
${!this.iconSlot.hasSlottedIcon(":scope > *")&&t?T(t):l}
|
|
17
17
|
</span>
|
|
18
|
-
`}static get observedAttributes(){return[...super.observedAttributes,"tabindex","aria-pressed"]}attributeChangedCallback(t,r,o){if(super.attributeChangedCallback(t,r,o),t==="aria-pressed"){this.requestUpdate();return}if(t!=="tabindex"||this.neutralizingTabindex)return;const a=o===null?null:Number(o),i=a===null||Number.isNaN(a)?null:a;i!==null&&i>=0?(this.innerTabindex=i,this.writeHostTabindex(null)):i===null&&o!==null?(this.innerTabindex=null,this.writeHostTabindex(null)):this.innerTabindex=i}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(
|
|
19
|
-
<div part="wrapper" class=${u(
|
|
18
|
+
`}static get observedAttributes(){return[...super.observedAttributes,"tabindex","aria-pressed"]}attributeChangedCallback(t,r,o){if(super.attributeChangedCallback(t,r,o),t==="aria-pressed"){this.requestUpdate();return}if(t!=="tabindex"||this.neutralizingTabindex)return;const a=o===null?null:Number(o),i=a===null||Number.isNaN(a)?null:a;i!==null&&i>=0?(this.innerTabindex=i,this.writeHostTabindex(null)):i===null&&o!==null?(this.innerTabindex=null,this.writeHostTabindex(null)):this.innerTabindex=i}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(y.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=x(this.icon,this),r=this.loading||this.iconSlot.hasSlottedIcon(":scope > *")||t.length>0,{collapsed:o,iconOnly:a}=this,i=a?this.getAttribute("aria-label")||this.label||l:l,d=this.getAttribute("aria-pressed")||l,p={"esp-field":!0,"icon-only":a,incognito:this.incognito,"is-collapsed":o,"has-icon":r,"icon-left":r&&!a&&this.iconPosition==="left"};return this.href.length?c`
|
|
19
|
+
<div part="wrapper" class=${u(p)}>
|
|
20
20
|
<a
|
|
21
21
|
?disabled=${this.disabled}
|
|
22
22
|
href=${this.href}
|
|
@@ -29,8 +29,8 @@ var n=function(h,t,r,o){var a=arguments.length,i=a<3?t:o===null?o=Object.getOwnP
|
|
|
29
29
|
${this.buildIcon(t)}
|
|
30
30
|
</a>
|
|
31
31
|
</div>
|
|
32
|
-
`:
|
|
33
|
-
<div part="wrapper" class=${u(
|
|
32
|
+
`:c`
|
|
33
|
+
<div part="wrapper" class=${u(p)}>
|
|
34
34
|
<button
|
|
35
35
|
?disabled=${this.disabled||this.loading}
|
|
36
36
|
@click=${this.handleClick}
|
|
@@ -139,7 +139,7 @@ var n=function(h,t,r,o){var a=arguments.length,i=a<3?t:o===null?o=Object.getOwnP
|
|
|
139
139
|
&:hover,
|
|
140
140
|
&:focus-within {
|
|
141
141
|
background-color: oklch(
|
|
142
|
-
from var(--esp-color-action-background) calc(l * ${
|
|
142
|
+
from var(--esp-color-action-background) calc(l * ${S})
|
|
143
143
|
c h
|
|
144
144
|
);
|
|
145
145
|
}
|
|
@@ -33,9 +33,11 @@ import { type EspalierFormField } from "../form-item/esp-form-item.js";
|
|
|
33
33
|
*
|
|
34
34
|
* @slot - Place `esp-checkbox` elements in the default slot.
|
|
35
35
|
*
|
|
36
|
-
* @event {CustomEvent<string[]>} value-changed - Fired when any
|
|
36
|
+
* @event {CustomEvent<string[]>} esp-value-changed - Fired when any
|
|
37
37
|
* child checkbox state changes. The detail is an array of the
|
|
38
38
|
* values of all currently checked checkboxes.
|
|
39
|
+
* @event {CustomEvent<{ valid: boolean; message: string }>} esp-validity-changed -
|
|
40
|
+
* Fired whenever constraint validation runs.
|
|
39
41
|
*
|
|
40
42
|
* @docPageTitle Checkbox Group
|
|
41
43
|
* @docUrl /components/checkbox/group
|
|
@@ -77,7 +79,7 @@ export declare class EspalierCheckboxGroup extends EspalierElementBase implement
|
|
|
77
79
|
* Focus the first non-disabled checkbox in the group.
|
|
78
80
|
*/
|
|
79
81
|
focus(options?: FocusOptions): void;
|
|
80
|
-
/** Re-run constraint validation and dispatch `validity-changed`. */
|
|
82
|
+
/** Re-run constraint validation and dispatch `esp-validity-changed`. */
|
|
81
83
|
validate(): void;
|
|
82
84
|
/** Check whether the current state is valid (delegates to ElementInternals). */
|
|
83
85
|
checkValidity(): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var o=function(l,e,t,r){var a=arguments.length,i=a<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(l,e,t,r);else for(var c=l.length-1;c>=0;c--)(h=l[c])&&(i=(a<3?h(i):a>3?h(e,t,i):h(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i};import{css as p,html as m}from"lit";import{customElement as f,property as n}from"lit/decorators.js";import{EspalierElementBase as d}from"../shared/esp-element-base.js";import{createRef as u,ref as b}from"lit/directives/ref.js";import{EspalierCheckbox as g}from"./esp-checkbox.js";import{FormFieldController as C}from"../shared/form-field-controller.js";let s=class extends d{constructor(){super(...arguments),this.internals=this.attachInternals(),this.formCtrl=new C({host:this,internals:this.internals,getFormValue:()=>{const e=this.values;return e.length>0?e.join(","):null},getValidity:()=>this.required&&this.values.length===0?{flags:{valueMissing:!0},message:this.requiredMessage||"Please select at least one option."}:null,onReset:()=>{for(const e of this.getCheckboxes())e.checked=!1},onRestore:e=>{const t=e.split(",");for(const r of this.getCheckboxes())r.checked=t.includes(r.value)},onDisabled:e=>{this.disabled=e}}),this.itemsSlot=u(),this.formItemDescription=null,this.describedCheckboxes=new Set,this.name="",this.required=!1,this.requiredMessage="",this.disabled=!1,this.handleItemsSlotChange=()=>{this.applyDisabledState(),this.applyFormItemDescription()}}get values(){return this.getCheckboxes().filter(e=>e.checked).map(e=>e.value)}focus(e){this.focusResolvedElementAfterUpdate(()=>this.getCheckboxes().find(t=>!t.disabled),e)}setFormItemDescription(e){this.formItemDescription=e,this.applyFormItemDescription()}validate(){this.formCtrl.validate()}checkValidity(){return this.formCtrl.checkValidity()}getCheckboxes(){return this.itemsSlot.value?Array.from(this.itemsSlot.value.assignedElements()).filter(e=>e instanceof g):[]}applyDisabledState(){for(const e of this.getCheckboxes())e.disabled=this.disabled}applyFormItemDescription(){const e=new Set(this.getCheckboxes());for(const t of this.describedCheckboxes)e.has(t)||t.setFormItemDescription(null);for(const t of e)t.setFormItemDescription(this.formItemDescription);this.describedCheckboxes=e}handleChildChanged(e){e.stopPropagation(),this.formCtrl.syncValue(),this.emitValueChanged(this.values)}formResetCallback(){this.formCtrl.handleFormReset()}formStateRestoreCallback(e){this.formCtrl.handleFormStateRestore(e)}formDisabledCallback(e){this.formCtrl.handleFormDisabled(e)}firstUpdated(e){super.firstUpdated(e),this.applyDisabledState(),this.applyFormItemDescription()}updated(e){super.updated(e),e.has("disabled")&&this.applyDisabledState()}render(){return m`
|
|
2
|
-
<div class="checkbox-group" role="group" @value-changed=${this.handleChildChanged}>
|
|
2
|
+
<div class="checkbox-group" role="group" @esp-value-changed=${this.handleChildChanged}>
|
|
3
3
|
<slot ${b(this.itemsSlot)} @slotchange=${this.handleItemsSlotChange}></slot>
|
|
4
4
|
</div>
|
|
5
5
|
`}};s.formAssociated=!0,s.styles=[...d.styles,p`
|
|
@@ -33,9 +33,11 @@ import { type EspalierFormField } from "../form-item/esp-form-item.js";
|
|
|
33
33
|
*
|
|
34
34
|
* @slot - The label text for the checkbox.
|
|
35
35
|
*
|
|
36
|
-
* @event {CustomEvent<{ checked: boolean; value: string }>} value-changed -
|
|
36
|
+
* @event {CustomEvent<{ checked: boolean; value: string }>} esp-value-changed -
|
|
37
37
|
* Fired when the checkbox is toggled. The detail contains the new
|
|
38
38
|
* `checked` state and the checkbox `value`.
|
|
39
|
+
* @event {CustomEvent<{ valid: boolean; message: string }>} esp-validity-changed -
|
|
40
|
+
* Fired whenever constraint validation runs.
|
|
39
41
|
*
|
|
40
42
|
* @cssprop --esp-checkbox-size - The width and height of the
|
|
41
43
|
* checkbox icon. Defaults to `var(--esp-size-normal-to-medium)`.
|
|
@@ -102,7 +104,7 @@ export declare class EspalierCheckbox extends EspalierElementBase implements Esp
|
|
|
102
104
|
* Focus the checkbox control.
|
|
103
105
|
*/
|
|
104
106
|
focus(options?: FocusOptions): void;
|
|
105
|
-
/** Re-run constraint validation and dispatch `validity-changed`. */
|
|
107
|
+
/** Re-run constraint validation and dispatch `esp-validity-changed`. */
|
|
106
108
|
validate(): void;
|
|
107
109
|
/** Check whether the current state is valid (delegates to ElementInternals). */
|
|
108
110
|
checkValidity(): boolean;
|
|
@@ -9,7 +9,7 @@ export type ColorPickerMode = "hc" | "hcl";
|
|
|
9
9
|
* needs to tune hue, chroma, and lightness directly.
|
|
10
10
|
*
|
|
11
11
|
* @customElement esp-color-picker
|
|
12
|
-
* @event {CustomEvent<{ seedColor: string, hue: number, chroma: number, lightness: number }>} value-changed - Fired
|
|
12
|
+
* @event {CustomEvent<{ seedColor: string, hue: number, chroma: number, lightness: number }>} esp-value-changed - Fired
|
|
13
13
|
* when the user changes the color. The event detail contains the seed
|
|
14
14
|
* color OKLCH string, plus raw hue, chroma, and lightness values.
|
|
15
15
|
*
|
|
@@ -30,7 +30,7 @@ export type ColorPickerMode = "hc" | "hcl";
|
|
|
30
30
|
* colorPicker.chroma = Math.round(+parts[2] * 100);
|
|
31
31
|
* }
|
|
32
32
|
*
|
|
33
|
-
* colorPicker.addEventListener("value-changed", (event) => {
|
|
33
|
+
* colorPicker.addEventListener("esp-value-changed", (event) => {
|
|
34
34
|
* const { seedColor } = event.detail;
|
|
35
35
|
* localStorage.setItem("esp-seed-color", seedColor);
|
|
36
36
|
* espRoot.setAttribute("seed-color", seedColor);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var a=function(r,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,i);else for(var d=r.length-1;d>=0;d--)(h=r[d])&&(o=(s<3?h(o):s>3?h(e,t,o):h(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o};import{LitElement as g,css as b,html as m,nothing as f,unsafeCSS as $}from"lit";import{customElement as y,property as n}from"lit/decorators.js";import{classMap as w}from"lit/directives/class-map.js";import{createRef as
|
|
1
|
+
var a=function(r,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,i);else for(var d=r.length-1;d>=0;d--)(h=r[d])&&(o=(s<3?h(o):s>3?h(e,t,o):h(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o};import{LitElement as g,css as b,html as m,nothing as f,unsafeCSS as $}from"lit";import{customElement as y,property as n}from"lit/decorators.js";import{classMap as w}from"lit/directives/class-map.js";import{createRef as p,ref as u}from"lit/directives/ref.js";import{styleMap as k}from"lit/directives/style-map.js";import{ESP_EVENTS as x}from"../shared/events.js";const v=70;let c="linear-gradient(to right,";for(let r=0;r<361;r++)c+=`oklch(${v}% 0.25 ${r}),`;c=c.slice(0,-1)+")";const E=r=>Number((r/100).toFixed(4)).toString();let l=class extends g{constructor(){super(...arguments),this.hueInput=p(),this.chromaInput=p(),this.lightnessInput=p(),this.mode="hc",this.chroma=25,this.hue=180,this.lightness=v,this.changed=()=>{const{hue:e,chroma:t,lightness:i}=this,s=`oklch(${E(i)} ${(t/100).toFixed(4)} ${e})`;this.dispatchEvent(new CustomEvent(x.VALUE_CHANGED,{detail:{seedColor:s,hue:e,chroma:t,lightness:i},bubbles:!0,composed:!0}))}}render(){const{hue:e,chroma:t,lightness:i}=this,s={"--selected-hue":e,"--selected-chroma":t,"--selected-lightness":`${i}%`};return m`
|
|
2
2
|
<div
|
|
3
3
|
class=${w({"esp-color-picker":!0,hcl:this.mode==="hcl"})}
|
|
4
4
|
style=${k(s)}
|
|
@@ -7,7 +7,7 @@ var a=function(r,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnP
|
|
|
7
7
|
<div class="hue">
|
|
8
8
|
<label for="hue-slider">Hue <span class="value">${this.hue}°</span></label>
|
|
9
9
|
<input
|
|
10
|
-
${
|
|
10
|
+
${u(this.hueInput)}
|
|
11
11
|
id="hue-slider"
|
|
12
12
|
type="range"
|
|
13
13
|
min="0"
|
|
@@ -21,7 +21,7 @@ var a=function(r,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnP
|
|
|
21
21
|
>Chroma <span class="value">${(this.chroma/100).toFixed(3)}</span></label
|
|
22
22
|
>
|
|
23
23
|
<input
|
|
24
|
-
${
|
|
24
|
+
${u(this.chromaInput)}
|
|
25
25
|
id="chroma-slider"
|
|
26
26
|
type="range"
|
|
27
27
|
min="0"
|
|
@@ -35,7 +35,7 @@ var a=function(r,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnP
|
|
|
35
35
|
>Lightness <span class="value">${this.lightness}%</span></label
|
|
36
36
|
>
|
|
37
37
|
<input
|
|
38
|
-
${
|
|
38
|
+
${u(this.lightnessInput)}
|
|
39
39
|
id="lightness-slider"
|
|
40
40
|
type="range"
|
|
41
41
|
min="0"
|
|
@@ -74,7 +74,7 @@ export type { CalendarDay, DatePickerMode, ParsedValue } from "./helpers/types.j
|
|
|
74
74
|
* <script>
|
|
75
75
|
* const form = document.getElementById("booking-form");
|
|
76
76
|
* const picker = findByTagName("esp-date-picker")[0];
|
|
77
|
-
* picker.addEventListener("value-changed", (event) => {
|
|
77
|
+
* picker.addEventListener("esp-value-changed", (event) => {
|
|
78
78
|
* console.log("Selected:", event.detail);
|
|
79
79
|
* });
|
|
80
80
|
* </script>
|
|
@@ -85,9 +85,11 @@ export type { CalendarDay, DatePickerMode, ParsedValue } from "./helpers/types.j
|
|
|
85
85
|
* > as `temporal-polyfill` in the document `<head>` before using this
|
|
86
86
|
* > component.
|
|
87
87
|
*
|
|
88
|
-
* @event {CustomEvent<string>} value-changed - Emitted when the
|
|
88
|
+
* @event {CustomEvent<string>} esp-value-changed - Emitted when the
|
|
89
89
|
* user picks a date, time, or range. The event detail is the new
|
|
90
90
|
* ISO 8601 value string.
|
|
91
|
+
* @event {CustomEvent<{ valid: boolean; message: string }>} esp-validity-changed -
|
|
92
|
+
* Fired whenever constraint validation runs.
|
|
91
93
|
*
|
|
92
94
|
* @customElement esp-date-picker
|
|
93
95
|
* @docPageTitle Date Picker
|
|
@@ -250,7 +252,7 @@ export declare class EspalierDatePicker extends EspalierElementBase implements E
|
|
|
250
252
|
* Focus the date picker's text input.
|
|
251
253
|
*/
|
|
252
254
|
focus(options?: FocusOptions): void;
|
|
253
|
-
/** Re-run constraint validation and dispatch `validity-changed`. */
|
|
255
|
+
/** Re-run constraint validation and dispatch `esp-validity-changed`. */
|
|
254
256
|
validate(): void;
|
|
255
257
|
/** Check whether the current state is valid (delegates to ElementInternals). */
|
|
256
258
|
checkValidity(): boolean;
|
|
@@ -95,7 +95,7 @@ var n=function(m,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnP
|
|
|
95
95
|
placeholder="Hour"
|
|
96
96
|
width="3.25em"
|
|
97
97
|
.value=${String(this._hour)}
|
|
98
|
-
@value-changed=${e=>{e.stopPropagation(),e.detail?.value&&(this._hour=Number(e.detail.value),this._commitTime())}}
|
|
98
|
+
@esp-value-changed=${e=>{e.stopPropagation(),e.detail?.value&&(this._hour=Number(e.detail.value),this._commitTime())}}
|
|
99
99
|
>
|
|
100
100
|
${I.map(e=>c`
|
|
101
101
|
<esp-picker-item
|
|
@@ -113,7 +113,7 @@ var n=function(m,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnP
|
|
|
113
113
|
placeholder="Min"
|
|
114
114
|
width="3.25em"
|
|
115
115
|
.value=${String(this._minute)}
|
|
116
|
-
@value-changed=${e=>{e.stopPropagation(),e.detail?.value&&(this._minute=Number(e.detail.value),this._commitTime())}}
|
|
116
|
+
@esp-value-changed=${e=>{e.stopPropagation(),e.detail?.value&&(this._minute=Number(e.detail.value),this._commitTime())}}
|
|
117
117
|
>
|
|
118
118
|
${B.map(e=>c`
|
|
119
119
|
<esp-picker-item
|
|
@@ -129,7 +129,7 @@ var n=function(m,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnP
|
|
|
129
129
|
placeholder="AM/PM"
|
|
130
130
|
width="3.75em"
|
|
131
131
|
.value=${this._period}
|
|
132
|
-
@value-changed=${e=>{e.stopPropagation(),e.detail?.value&&(this._period=e.detail.value,this._commitTime())}}
|
|
132
|
+
@esp-value-changed=${e=>{e.stopPropagation(),e.detail?.value&&(this._period=e.detail.value,this._commitTime())}}
|
|
133
133
|
>
|
|
134
134
|
<esp-picker-item
|
|
135
135
|
text="AM"
|
|
@@ -145,14 +145,14 @@ var n=function(m,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnP
|
|
|
145
145
|
|
|
146
146
|
<esp-button
|
|
147
147
|
icon-only
|
|
148
|
-
@clicked=${()=>{this._closePopover(),this.inputRef.value?.focus()}}
|
|
148
|
+
@esp-clicked=${()=>{this._closePopover(),this.inputRef.value?.focus()}}
|
|
149
149
|
>
|
|
150
150
|
${b}
|
|
151
151
|
</esp-button>
|
|
152
152
|
<esp-button
|
|
153
153
|
icon-only
|
|
154
154
|
intent="danger"
|
|
155
|
-
@clicked=${()=>{this.value=this._valueOnOpen,this._closePopover(),this.inputRef.value?.focus()}}
|
|
155
|
+
@esp-clicked=${()=>{this.value=this._valueOnOpen,this._closePopover(),this.inputRef.value?.focus()}}
|
|
156
156
|
>
|
|
157
157
|
${S}
|
|
158
158
|
</esp-button>
|
|
@@ -161,14 +161,14 @@ var n=function(m,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnP
|
|
|
161
161
|
<div class="popover-actions">
|
|
162
162
|
<esp-button
|
|
163
163
|
icon-only
|
|
164
|
-
@clicked=${()=>{this._closePopover(),this.inputRef.value?.focus()}}
|
|
164
|
+
@esp-clicked=${()=>{this._closePopover(),this.inputRef.value?.focus()}}
|
|
165
165
|
>
|
|
166
166
|
${b}
|
|
167
167
|
</esp-button>
|
|
168
168
|
<esp-button
|
|
169
169
|
icon-only
|
|
170
170
|
intent="danger"
|
|
171
|
-
@clicked=${()=>{this.value=this._valueOnOpen,this._closePopover(),this.inputRef.value?.focus()}}
|
|
171
|
+
@esp-clicked=${()=>{this.value=this._valueOnOpen,this._closePopover(),this.inputRef.value?.focus()}}
|
|
172
172
|
>
|
|
173
173
|
${S}
|
|
174
174
|
</esp-button>
|
|
@@ -45,7 +45,7 @@ import { EspalierElementBase } from "../shared/esp-element-base.js";
|
|
|
45
45
|
* @cssprop --esp-details-group-color-border - The border color
|
|
46
46
|
* of the group container.
|
|
47
47
|
*
|
|
48
|
-
* @event {CustomEvent<{ openItem: EspalierDetails | null }>} esp-
|
|
48
|
+
* @event {CustomEvent<{ openItem: EspalierDetails | null }>} esp-details-group-change -
|
|
49
49
|
* Fired when the currently open item changes.
|
|
50
50
|
*
|
|
51
51
|
* @docPageTitle Details Group
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var n=function(l,e,s,r){var t=arguments.length,o=t<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,s):r,p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(l,e,s,r);else for(var a=l.length-1;a>=0;a--)(p=l[a])&&(o=(t<3?p(o):t>3?p(e,s,o):p(e,s))||o);return t>3&&o&&Object.defineProperty(e,s,o),o};import{css as
|
|
2
|
-
<div class="details-group" role="group" @esp-toggle=${this.handleChildToggle}>
|
|
1
|
+
var n=function(l,e,s,r){var t=arguments.length,o=t<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,s):r,p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(l,e,s,r);else for(var a=l.length-1;a>=0;a--)(p=l[a])&&(o=(t<3?p(o):t>3?p(e,s,o):p(e,s))||o);return t>3&&o&&Object.defineProperty(e,s,o),o};import{css as f,html as c}from"lit";import{customElement as h,property as m}from"lit/decorators.js";import{createRef as g,ref as v}from"lit/directives/ref.js";import{EspalierElementBase as u}from"../shared/esp-element-base.js";import{ESP_EVENTS as b}from"../shared/events.js";import{EspalierDetails as d}from"./esp-details.js";let i=class extends u{constructor(){super(...arguments),this.itemsSlot=g(),this.exclusive=!0}getDetails(){return this.itemsSlot.value?Array.from(this.itemsSlot.value.assignedElements()).filter(e=>e instanceof d):[]}applyGroupAttributes(){for(const e of this.getDetails())e.setAttribute("in-group","")}handleChildToggle(e){const s=e,r=e.composedPath().find(t=>t instanceof d);if(r&&s.detail.open&&this.exclusive){for(const t of this.getDetails())t!==r&&t.open&&t.close();this.dispatchEvent(new CustomEvent(b.DETAILS_GROUP_CHANGE,{detail:{openItem:r},bubbles:!0,composed:!0}))}}handleSlotChange(){this.applyGroupAttributes()}firstUpdated(e){super.firstUpdated(e),this.applyGroupAttributes()}render(){return c`
|
|
2
|
+
<div class="details-group" role="group" @esp-details-toggle=${this.handleChildToggle}>
|
|
3
3
|
<slot ${v(this.itemsSlot)} @slotchange=${this.handleSlotChange}></slot>
|
|
4
4
|
</div>
|
|
5
|
-
`}};i.styles=[...u.styles,
|
|
5
|
+
`}};i.styles=[...u.styles,f`
|
|
6
6
|
:host {
|
|
7
7
|
display: block;
|
|
8
8
|
}
|
|
@@ -60,7 +60,7 @@ import { EspalierElementBase } from "../shared/esp-element-base.js";
|
|
|
60
60
|
* @cssprop --esp-details-size-padding - The padding inside the
|
|
61
61
|
* content area and summary row.
|
|
62
62
|
*
|
|
63
|
-
* @event {CustomEvent<{ open: boolean }>} esp-toggle - Fired when
|
|
63
|
+
* @event {CustomEvent<{ open: boolean }>} esp-details-toggle - Fired when
|
|
64
64
|
* the details element is opened or closed.
|
|
65
65
|
*
|
|
66
66
|
* ```html
|
|
@@ -69,7 +69,7 @@ import { EspalierElementBase } from "../shared/esp-element-base.js";
|
|
|
69
69
|
* </esp-details>
|
|
70
70
|
* <script>
|
|
71
71
|
* const details = findByTagName("esp-details")[0];
|
|
72
|
-
* details.addEventListener("esp-toggle", (ev) => {
|
|
72
|
+
* details.addEventListener("esp-details-toggle", (ev) => {
|
|
73
73
|
* console.log("Open:", ev.detail.open);
|
|
74
74
|
* });
|
|
75
75
|
* </script>
|
|
@@ -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
|
|
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 h,html as b}from"lit";import{customElement as f,property as c}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 p=t.scrollTop;Math.abs(p-r)>1&&(t.scrollTop=r)}else{const p=window.scrollY;Math.abs(p-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
|
-
`}};
|
|
11
|
+
`}};a.styles=[...m.styles,g(":host([disabled]) summary"),h`
|
|
12
12
|
:host {
|
|
13
13
|
display: block;
|
|
14
14
|
overflow-anchor: none;
|
|
@@ -113,4 +113,4 @@ var d=function(i,e,o,s){var t=arguments.length,r=t<3?e:s===null?s=Object.getOwnP
|
|
|
113
113
|
:host([in-group]:last-of-type) details {
|
|
114
114
|
border-bottom: none;
|
|
115
115
|
}
|
|
116
|
-
`],d([c({type:String})],
|
|
116
|
+
`],d([c({type:String})],a.prototype,"summary",void 0),d([c({type:Boolean,reflect:!0})],a.prototype,"open",void 0),d([c({type:Boolean,reflect:!0})],a.prototype,"disabled",void 0),a=d([f("esp-details")],a);export{a as EspalierDetails};
|