Skip to content

Commit

Permalink
refactor: set customEvent's detail correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
sun-mota committed Dec 18, 2024
1 parent 1b7b32d commit a9b8e64
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 69 deletions.
13 changes: 7 additions & 6 deletions components/combobox/demo/api.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -8187,12 +8187,13 @@ class AuroMenu extends r$6 {
}

if (changedProperties.has('loading')) {
const event = new CustomEvent("auroMenu-loadingChange");
event.detail = {
loading: this.loading,
hasLoadingPlaceholder:
this.hasLoadingPlaceholder
};
const event = new CustomEvent("auroMenu-loadingChange", {
detail: {
loading: this.loading,
hasLoadingPlaceholder:
this.hasLoadingPlaceholder
}
});
this.setAttribute("aria-busy", this.hasAttribute("loading"));
this.dispatchEvent(event);
}
Expand Down
13 changes: 7 additions & 6 deletions components/combobox/demo/index.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -8053,12 +8053,13 @@ class AuroMenu extends r$6 {
}

if (changedProperties.has('loading')) {
const event = new CustomEvent("auroMenu-loadingChange");
event.detail = {
loading: this.loading,
hasLoadingPlaceholder:
this.hasLoadingPlaceholder
};
const event = new CustomEvent("auroMenu-loadingChange", {
detail: {
loading: this.loading,
hasLoadingPlaceholder:
this.hasLoadingPlaceholder
}
});
this.setAttribute("aria-busy", this.hasAttribute("loading"));
this.dispatchEvent(event);
}
Expand Down
24 changes: 12 additions & 12 deletions components/menu/demo/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ The auro-menu element provides users a way to select from a list of options.

## Events

| Event | Type | Description |
|-------------------------------|------------------------|--------------------------------------------------|
| `auroMenu-activatedOption` | `CustomEvent<Element>` | Notifies that a menuoption has been made `active`. |
| `auroMenu-customEventFired` | `CustomEvent<any>` | Notifies that a custom event has been fired. |
| `auroMenu-loadingChange` | `CustomEvent<any>` | Notifies when the loading attribute is changed. |
| `auroMenu-selectValueFailure` | `CustomEvent<any>` | Notifies that a an attempt to select a menuoption by matching a value has failed. |
| `auroMenu-selectValueReset` | `CustomEvent<any>` | Notifies that the component value has been reset. |
| `auroMenu-selectedOption` | `CustomEvent<any>` | Notifies that a new menuoption selection has been made. |
| [auroMenuActivatedOption](#auroMenuActivatedOption) | `CustomEvent<Element>` | (DEPRECATED) Notifies that a menuoption has been made `active`. |
| [auroMenuCustomEventFired](#auroMenuCustomEventFired) | `CustomEvent<any>` | (DEPRECATED) Notifies that a custom event has been fired. |
| [auroMenuSelectValueFailure](#auroMenuSelectValueFailure) | `CustomEvent<any>` | (DEPRECATED) Notifies that a an attempt to select a menuoption by matching a value has failed. |
| [selectedOption](#selectedOption) | `CustomEvent<any>` | (DEPRECATED) Notifies that a new menuoption selection has been made. |
| Event | Type | Description |
|-------------------------------|--------------------------------------------------|--------------------------------------------------|
| `auroMenu-activatedOption` | `CustomEvent<Element>` | Notifies that a menuoption has been made `active`. |
| `auroMenu-customEventFired` | `CustomEvent<any>` | Notifies that a custom event has been fired. |
| `auroMenu-loadingChange` | `CustomEvent<{ loading: boolean; hasLoadingPlaceholder: boolean; }>` | Notifies when the loading attribute is changed. |
| `auroMenu-selectValueFailure` | `CustomEvent<any>` | Notifies that a an attempt to select a menuoption by matching a value has failed. |
| `auroMenu-selectValueReset` | `CustomEvent<any>` | Notifies that the component value has been reset. |
| `auroMenu-selectedOption` | `CustomEvent<any>` | Notifies that a new menuoption selection has been made. |
| [auroMenuActivatedOption](#auroMenuActivatedOption) | `CustomEvent<Element>` | (DEPRECATED) Notifies that a menuoption has been made `active`. |
| [auroMenuCustomEventFired](#auroMenuCustomEventFired) | `CustomEvent<any>` | (DEPRECATED) Notifies that a custom event has been fired. |
| [auroMenuSelectValueFailure](#auroMenuSelectValueFailure) | `CustomEvent<any>` | (DEPRECATED) Notifies that a an attempt to select a menuoption by matching a value has failed. |
| [selectedOption](#selectedOption) | `CustomEvent<any>` | (DEPRECATED) Notifies that a new menuoption selection has been made. |

## Slots

Expand Down
13 changes: 7 additions & 6 deletions components/menu/demo/api.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,13 @@ class AuroMenu extends r {
}

if (changedProperties.has('loading')) {
const event = new CustomEvent("auroMenu-loadingChange");
event.detail = {
loading: this.loading,
hasLoadingPlaceholder:
this.hasLoadingPlaceholder
};
const event = new CustomEvent("auroMenu-loadingChange", {
detail: {
loading: this.loading,
hasLoadingPlaceholder:
this.hasLoadingPlaceholder
}
});
this.setAttribute("aria-busy", this.hasAttribute("loading"));
this.dispatchEvent(event);
}
Expand Down
13 changes: 7 additions & 6 deletions components/menu/demo/index.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,13 @@ class AuroMenu extends r {
}

if (changedProperties.has('loading')) {
const event = new CustomEvent("auroMenu-loadingChange");
event.detail = {
loading: this.loading,
hasLoadingPlaceholder:
this.hasLoadingPlaceholder
};
const event = new CustomEvent("auroMenu-loadingChange", {
detail: {
loading: this.loading,
hasLoadingPlaceholder:
this.hasLoadingPlaceholder
}
});
this.setAttribute("aria-busy", this.hasAttribute("loading"));
this.dispatchEvent(event);
}
Expand Down
24 changes: 12 additions & 12 deletions components/menu/docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ The auro-menu element provides users a way to select from a list of options.

## Events

| Event | Type | Description |
|-------------------------------|------------------------|--------------------------------------------------|
| `auroMenu-activatedOption` | `CustomEvent<Element>` | Notifies that a menuoption has been made `active`. |
| `auroMenu-customEventFired` | `CustomEvent<any>` | Notifies that a custom event has been fired. |
| `auroMenu-loadingChange` | `CustomEvent<any>` | Notifies when the loading attribute is changed. |
| `auroMenu-selectValueFailure` | `CustomEvent<any>` | Notifies that a an attempt to select a menuoption by matching a value has failed. |
| `auroMenu-selectValueReset` | `CustomEvent<any>` | Notifies that the component value has been reset. |
| `auroMenu-selectedOption` | `CustomEvent<any>` | Notifies that a new menuoption selection has been made. |
| `auroMenuActivatedOption` | `CustomEvent<Element>` | (DEPRECATED) Notifies that a menuoption has been made `active`. |
| `auroMenuCustomEventFired` | `CustomEvent<any>` | (DEPRECATED) Notifies that a custom event has been fired. |
| `auroMenuSelectValueFailure` | `CustomEvent<any>` | (DEPRECATED) Notifies that a an attempt to select a menuoption by matching a value has failed. |
| `selectedOption` | `CustomEvent<any>` | (DEPRECATED) Notifies that a new menuoption selection has been made. |
| Event | Type | Description |
|-------------------------------|--------------------------------------------------|--------------------------------------------------|
| `auroMenu-activatedOption` | `CustomEvent<Element>` | Notifies that a menuoption has been made `active`. |
| `auroMenu-customEventFired` | `CustomEvent<any>` | Notifies that a custom event has been fired. |
| `auroMenu-loadingChange` | `CustomEvent<{ loading: boolean; hasLoadingPlaceholder: boolean; }>` | Notifies when the loading attribute is changed. |
| `auroMenu-selectValueFailure` | `CustomEvent<any>` | Notifies that a an attempt to select a menuoption by matching a value has failed. |
| `auroMenu-selectValueReset` | `CustomEvent<any>` | Notifies that the component value has been reset. |
| `auroMenu-selectedOption` | `CustomEvent<any>` | Notifies that a new menuoption selection has been made. |
| `auroMenuActivatedOption` | `CustomEvent<Element>` | (DEPRECATED) Notifies that a menuoption has been made `active`. |
| `auroMenuCustomEventFired` | `CustomEvent<any>` | (DEPRECATED) Notifies that a custom event has been fired. |
| `auroMenuSelectValueFailure` | `CustomEvent<any>` | (DEPRECATED) Notifies that a an attempt to select a menuoption by matching a value has failed. |
| `selectedOption` | `CustomEvent<any>` | (DEPRECATED) Notifies that a new menuoption selection has been made. |

## Slots

Expand Down
13 changes: 7 additions & 6 deletions components/menu/src/auro-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,13 @@ export class AuroMenu extends LitElement {
}

if (changedProperties.has('loading')) {
const event = new CustomEvent("auroMenu-loadingChange");
event.detail = {
loading: this.loading,
hasLoadingPlaceholder:
this.hasLoadingPlaceholder
};
const event = new CustomEvent("auroMenu-loadingChange", {
detail: {
loading: this.loading,
hasLoadingPlaceholder:
this.hasLoadingPlaceholder
}
});
this.setAttribute("aria-busy", this.hasAttribute("loading"));
this.dispatchEvent(event);
}
Expand Down
2 changes: 1 addition & 1 deletion components/select/apiExamples/loading.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<auro-select id="loadingExample">
<span slot="label">Please select a preference</span>
<auro-menu id="loadingExampleSelectMenu">
<!-- <auro-loader slot="loadingIcon" orbit xs></auro-loader><span slot="loadingText">Loading...</span> -->
<auro-loader slot="loadingIcon" orbit xs></auro-loader><span slot="loadingText">Loading...</span>
</auro-menu>
</auro-select>
4 changes: 2 additions & 2 deletions components/select/demo/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ While content is loading, the menu can either remain empty or display a loading
<auro-select id="loadingExample">
<span slot="label">Please select a preference</span>
<auro-menu id="loadingExampleSelectMenu">
<!-- <auro-loader slot="loadingIcon" orbit xs></auro-loader><span slot="loadingText">Loading...</span> -->
<auro-loader slot="loadingIcon" orbit xs></auro-loader><span slot="loadingText">Loading...</span>
</auro-menu>
</auro-select>
<!-- AURO-GENERATED-CONTENT:END -->
Expand Down Expand Up @@ -721,7 +721,7 @@ export function auroMenuLoadingExample() {
<auro-select id="loadingExample">
<span slot="label">Please select a preference</span>
<auro-menu id="loadingExampleSelectMenu">
<!-- <auro-loader slot="loadingIcon" orbit xs></auro-loader><span slot="loadingText">Loading...</span> -->
<auro-loader slot="loadingIcon" orbit xs></auro-loader><span slot="loadingText">Loading...</span>
</auro-menu>
</auro-select>
```
Expand Down
13 changes: 7 additions & 6 deletions components/select/demo/api.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -4006,12 +4006,13 @@ class AuroMenu extends r$4 {
}

if (changedProperties.has('loading')) {
const event = new CustomEvent("auroMenu-loadingChange");
event.detail = {
loading: this.loading,
hasLoadingPlaceholder:
this.hasLoadingPlaceholder
};
const event = new CustomEvent("auroMenu-loadingChange", {
detail: {
loading: this.loading,
hasLoadingPlaceholder:
this.hasLoadingPlaceholder
}
});
this.setAttribute("aria-busy", this.hasAttribute("loading"));
this.dispatchEvent(event);
}
Expand Down
13 changes: 7 additions & 6 deletions components/select/demo/index.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -3916,12 +3916,13 @@ class AuroMenu extends r$4 {
}

if (changedProperties.has('loading')) {
const event = new CustomEvent("auroMenu-loadingChange");
event.detail = {
loading: this.loading,
hasLoadingPlaceholder:
this.hasLoadingPlaceholder
};
const event = new CustomEvent("auroMenu-loadingChange", {
detail: {
loading: this.loading,
hasLoadingPlaceholder:
this.hasLoadingPlaceholder
}
});
this.setAttribute("aria-busy", this.hasAttribute("loading"));
this.dispatchEvent(event);
}
Expand Down

0 comments on commit a9b8e64

Please sign in to comment.