@aurodesignsystem-dev/auro-dialog 0.0.0-pr87.1 → 0.0.0-pr87.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/demo/api.md
CHANGED
|
@@ -30,12 +30,12 @@ The auro-dialog appears above the page and requires the user's attention.
|
|
|
30
30
|
|
|
31
31
|
## Slots
|
|
32
32
|
|
|
33
|
-
| Name
|
|
34
|
-
|
|
35
|
-
| `ariaLabel.
|
|
36
|
-
| [content](#content)
|
|
37
|
-
| [footer](#footer)
|
|
38
|
-
| [header](#header)
|
|
33
|
+
| Name | Description |
|
|
34
|
+
|--------------------------|--------------------------------------------------|
|
|
35
|
+
| `ariaLabel.dialog.close` | Text to describe the "x" icon close button for screen readers. Default: "Close". |
|
|
36
|
+
| [content](#content) | Injects content into the body of the modal |
|
|
37
|
+
| [footer](#footer) | Used for action options, e.g. buttons |
|
|
38
|
+
| [header](#header) | Text to display as the header of the modal |
|
|
39
39
|
|
|
40
40
|
## CSS Shadow Parts
|
|
41
41
|
|
|
@@ -724,7 +724,7 @@ When using the dialog with the `unformatted` attribute, some may want to adjust
|
|
|
724
724
|
|
|
725
725
|
### Close button aria-label slot
|
|
726
726
|
|
|
727
|
-
To customize the aria-label text for the close button, use the `ariaLabel.
|
|
727
|
+
To customize the aria-label text for the close button, use the `ariaLabel.dialog.close` slot to provide custom text. If no text is provided, the default text `"Close"` will be used.
|
|
728
728
|
|
|
729
729
|
<div class="exampleWrapper">
|
|
730
730
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/ariaLabelSlot.html) -->
|
|
@@ -733,7 +733,7 @@ To customize the aria-label text for the close button, use the `ariaLabel.closeB
|
|
|
733
733
|
<auro-button id="openAriaLabelSlot">Unformatted Dialog w/ custom close button aria-label</auro-button>
|
|
734
734
|
</div>
|
|
735
735
|
<auro-dialog id="ariaLabelMdDialog" unformatted md lg ondark>
|
|
736
|
-
<span slot="ariaLabel.
|
|
736
|
+
<span slot="ariaLabel.dialog.close">This will be the new aria label for the close button</span>
|
|
737
737
|
<span slot="content">
|
|
738
738
|
<img style="display: block; width: 100%" src="https://blog.alaskaair.com/wp-content/uploads/2020/11/111-psp-blog-img-guide.jpg" alt="alaska airlines pride lights" />
|
|
739
739
|
<div class="unformattedWrapper">
|
|
@@ -754,7 +754,7 @@ To customize the aria-label text for the close button, use the `ariaLabel.closeB
|
|
|
754
754
|
<auro-button id="openAriaLabelSlot">Unformatted Dialog w/ custom close button aria-label</auro-button>
|
|
755
755
|
</div>
|
|
756
756
|
<auro-dialog id="ariaLabelMdDialog" unformatted md lg ondark>
|
|
757
|
-
<span slot="ariaLabel.
|
|
757
|
+
<span slot="ariaLabel.dialog.close">This will be the new aria label for the close button</span>
|
|
758
758
|
<span slot="content">
|
|
759
759
|
<img style="display: block; width: 100%" src="https://blog.alaskaair.com/wp-content/uploads/2020/11/111-psp-blog-img-guide.jpg" alt="alaska airlines pride lights" />
|
|
760
760
|
<div class="unformattedWrapper">
|
package/demo/auro-dialog.min.js
CHANGED
|
@@ -569,7 +569,7 @@ const ESCAPE_KEYCODE = 27;
|
|
|
569
569
|
* @slot header - Text to display as the header of the modal
|
|
570
570
|
* @slot content - Injects content into the body of the modal
|
|
571
571
|
* @slot footer - Used for action options, e.g. buttons
|
|
572
|
-
* @slot ariaLabel.
|
|
572
|
+
* @slot ariaLabel.dialog.close - Text to describe the "x" icon close button for screen readers. Default: "Close".
|
|
573
573
|
* @function toggleViewable - toggles the 'open' property on the element
|
|
574
574
|
* @event toggle - Event fires when the element is closed
|
|
575
575
|
* @csspart close-button - adjust position of the close X icon in the dialog window
|
|
@@ -789,7 +789,7 @@ getCloseButton() {
|
|
|
789
789
|
? u$2``
|
|
790
790
|
: u$2`
|
|
791
791
|
<${this.buttonTag}
|
|
792
|
-
aria-label="${this.runtimeUtils.getSlotText(this, 'ariaLabel.
|
|
792
|
+
aria-label="${this.runtimeUtils.getSlotText(this, 'ariaLabel.dialog.close') || 'Close'}"
|
|
793
793
|
variant="ghost"
|
|
794
794
|
shape="circle"
|
|
795
795
|
size="sm"
|
|
@@ -818,7 +818,7 @@ getCloseButton() {
|
|
|
818
818
|
|
|
819
819
|
return u$2`
|
|
820
820
|
<!-- Hidden slot for close button aria-label -->
|
|
821
|
-
<slot name="ariaLabel.
|
|
821
|
+
<slot name="ariaLabel.dialog.close" hidden @slotchange=${this.requestUpdate}></slot>
|
|
822
822
|
|
|
823
823
|
<div class="${e(classes)}" id="dialog-overlay" part="dialog-overlay" @click=${this.handleOverlayClick}></div>
|
|
824
824
|
|
|
@@ -81,7 +81,7 @@ import{css as e,LitElement as t,html as s}from"lit";import{classMap as a}from"li
|
|
|
81
81
|
`,Y=e`:host{--ds-auro-dialog-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dialog-boxshadow-color: var(--ds-elevation-300, 0px 0px 15px rgba(0, 0, 0, .2));--ds-auro-dialog-overlay-modal-background-color: var(--ds-advanced-color-shared-scrim, rgba(0, 0, 0, .5));--ds-auro-dialog-overlay-open-background-color: var(--ds-advanced-color-shared-scrim, rgba(0, 0, 0, .5));--ds-auro-dialog-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}
|
|
82
82
|
`;class Z extends t{constructor(){super(),this.modal=!1,this.unformatted=!1;const e=new d;this.buttonTag=e.generateTag("auro-button","12.2.0",L),this.iconTag=e.generateTag("auro-icon","9.1.0",V),this.runtimeUtils=new l}static get properties(){return{modal:{type:Boolean},unformatted:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},triggerElement:{attribute:!1}}}firstUpdated(){this.runtimeUtils.handleComponentTagRename(this,"auro-dialog");const e=this.shadowRoot.querySelector("#footer"),t=this.shadowRoot.querySelector("#footerWrapper");this.dialog=this.shadowRoot.getElementById("dialog"),this.unformatted||0!==e.assignedNodes().length||t.classList.remove("dialog-footer")}updated(e){e.has("open")&&(this.open?this.openDialog():this.closeDialog())}connectedCallback(){super.connectedCallback(),this.keydownEventHandler=this.handleKeydown.bind(this),window.addEventListener("keydown",this.keydownEventHandler)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.keydownEventHandler)}openDialog(){this.defaultTrigger=document.activeElement,this.focusTrap=new p(this.dialog)}onDialogTransitionEnd(){this.open&&this.focusTrap&&this.focusTrap.focusFirstElement()}closeDialog(){this.focusTrap&&(this.focusTrap.disconnect(),this.focusTrap=void 0),this.defaultTrigger&&(this.defaultTrigger.focus(),this.defaultTrigger=void 0),this.dispatchToggleEvent()}dispatchToggleEvent(){const e=document.createEvent("HTMLEvents");e.initEvent("toggle",!0,!1),this.dispatchEvent(e)}handleOverlayClick(){if(this.open&&!this.modal){const e=[...this.querySelectorAll("auro-combobox, [auro-combobox], auro-select, [auro-select], auro-datepicker, [auro-datepicker]")];[...this.querySelectorAll("auro-dropdown, [auro-dropdown]"),...e.map(e=>e.dropdown)].some(e=>e.isPopoverVisible)||this.handleCloseButtonClick()}}handleCloseButtonClick(){this.open=!1}handleKeydown({key:e,keyCode:t}){!this.open||this.modal||"Escape"!==e&&27!==t||(this.open=!1)}focus(){this.open&&this.dialog.focus()}static get styles(){return[J,Q,K,Y]}getCloseButton(){return this.modal?i``:i`
|
|
83
83
|
<${this.buttonTag}
|
|
84
|
-
aria-label="${this.runtimeUtils.getSlotText(this,"ariaLabel.
|
|
84
|
+
aria-label="${this.runtimeUtils.getSlotText(this,"ariaLabel.dialog.close")||"Close"}"
|
|
85
85
|
variant="ghost"
|
|
86
86
|
shape="circle"
|
|
87
87
|
size="sm"
|
|
@@ -95,7 +95,7 @@ import{css as e,LitElement as t,html as s}from"lit";import{classMap as a}from"li
|
|
|
95
95
|
</${this.buttonTag}>
|
|
96
96
|
`}render(){const e={dialogOverlay:!0,"dialogOverlay--modal":this.modal&&this.open,"dialogOverlay--open":this.open,util_displayHidden:!this.open},t={dialog:!0,"dialog--open":this.open};return i`
|
|
97
97
|
<!-- Hidden slot for close button aria-label -->
|
|
98
|
-
<slot name="ariaLabel.
|
|
98
|
+
<slot name="ariaLabel.dialog.close" hidden @slotchange=${this.requestUpdate}></slot>
|
|
99
99
|
|
|
100
100
|
<div class="${a(e)}" id="dialog-overlay" part="dialog-overlay" @click=${this.handleOverlayClick}></div>
|
|
101
101
|
|
package/dist/index.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ class l{registerComponent(e,t){customElements.get(e)||customElements.define(e,cl
|
|
|
86
86
|
`,Y=css`:host{--ds-auro-dialog-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dialog-boxshadow-color: var(--ds-elevation-300, 0px 0px 15px rgba(0, 0, 0, .2));--ds-auro-dialog-overlay-modal-background-color: var(--ds-advanced-color-shared-scrim, rgba(0, 0, 0, .5));--ds-auro-dialog-overlay-open-background-color: var(--ds-advanced-color-shared-scrim, rgba(0, 0, 0, .5));--ds-auro-dialog-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}
|
|
87
87
|
`;class Z extends LitElement{constructor(){super(),this.modal=false,this.unformatted=false;const e=new d;this.buttonTag=e.generateTag("auro-button","12.2.0",L),this.iconTag=e.generateTag("auro-icon","9.1.0",V),this.runtimeUtils=new l;}static get properties(){return {modal:{type:Boolean},unformatted:{type:Boolean,reflect:true},open:{type:Boolean,reflect:true},triggerElement:{attribute:false}}}firstUpdated(){this.runtimeUtils.handleComponentTagRename(this,"auro-dialog");const e=this.shadowRoot.querySelector("#footer"),t=this.shadowRoot.querySelector("#footerWrapper");this.dialog=this.shadowRoot.getElementById("dialog"),this.unformatted||0!==e.assignedNodes().length||t.classList.remove("dialog-footer");}updated(e){e.has("open")&&(this.open?this.openDialog():this.closeDialog());}connectedCallback(){super.connectedCallback(),this.keydownEventHandler=this.handleKeydown.bind(this),window.addEventListener("keydown",this.keydownEventHandler);}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.keydownEventHandler);}openDialog(){this.defaultTrigger=document.activeElement,this.focusTrap=new p(this.dialog);}onDialogTransitionEnd(){this.open&&this.focusTrap&&this.focusTrap.focusFirstElement();}closeDialog(){this.focusTrap&&(this.focusTrap.disconnect(),this.focusTrap=void 0),this.defaultTrigger&&(this.defaultTrigger.focus(),this.defaultTrigger=void 0),this.dispatchToggleEvent();}dispatchToggleEvent(){const e=document.createEvent("HTMLEvents");e.initEvent("toggle",true,false),this.dispatchEvent(e);}handleOverlayClick(){if(this.open&&!this.modal){const e=[...this.querySelectorAll("auro-combobox, [auro-combobox], auro-select, [auro-select], auro-datepicker, [auro-datepicker]")];[...this.querySelectorAll("auro-dropdown, [auro-dropdown]"),...e.map(e=>e.dropdown)].some(e=>e.isPopoverVisible)||this.handleCloseButtonClick();}}handleCloseButtonClick(){this.open=false;}handleKeydown({key:e,keyCode:t}){!this.open||this.modal||"Escape"!==e&&27!==t||(this.open=false);}focus(){this.open&&this.dialog.focus();}static get styles(){return [J,Q,K,Y]}getCloseButton(){return this.modal?html``:html`
|
|
88
88
|
<${this.buttonTag}
|
|
89
|
-
aria-label="${this.runtimeUtils.getSlotText(this,"ariaLabel.
|
|
89
|
+
aria-label="${this.runtimeUtils.getSlotText(this,"ariaLabel.dialog.close")||"Close"}"
|
|
90
90
|
variant="ghost"
|
|
91
91
|
shape="circle"
|
|
92
92
|
size="sm"
|
|
@@ -100,7 +100,7 @@ class l{registerComponent(e,t){customElements.get(e)||customElements.define(e,cl
|
|
|
100
100
|
</${this.buttonTag}>
|
|
101
101
|
`}render(){const e={dialogOverlay:true,"dialogOverlay--modal":this.modal&&this.open,"dialogOverlay--open":this.open,util_displayHidden:!this.open},t={dialog:true,"dialog--open":this.open};return html`
|
|
102
102
|
<!-- Hidden slot for close button aria-label -->
|
|
103
|
-
<slot name="ariaLabel.
|
|
103
|
+
<slot name="ariaLabel.dialog.close" hidden @slotchange=${this.requestUpdate}></slot>
|
|
104
104
|
|
|
105
105
|
<div class="${classMap(e)}" id="dialog-overlay" part="dialog-overlay" @click=${this.handleOverlayClick}></div>
|
|
106
106
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{A as AuroDialog}from"./auro-dialog-
|
|
1
|
+
export{A as AuroDialog}from"./auro-dialog-CccN7rFW.js";import"lit";import"lit/directives/class-map.js";import"lit/static-html.js";import"lit/directives/if-defined.js";
|
package/dist/registered.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as i}from"./auro-dialog-
|
|
1
|
+
import{A as i}from"./auro-dialog-CccN7rFW.js";import"lit";import"lit/directives/class-map.js";import"lit/static-html.js";import"lit/directives/if-defined.js";i.register();
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"================================================================================"
|
|
8
8
|
],
|
|
9
9
|
"name": "@aurodesignsystem-dev/auro-dialog",
|
|
10
|
-
"version": "0.0.0-pr87.
|
|
10
|
+
"version": "0.0.0-pr87.2",
|
|
11
11
|
"description": "auro-dialog HTML custom element",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|