kopia lustrzana https://github.com/shoelace-style/shoelace
Fix event names
rodzic
2d393c0499
commit
9b4fdbe16a
|
@ -26,7 +26,7 @@ Use the `disable` attribute to prevent the details from expanding.
|
|||
|
||||
### Grouping Details
|
||||
|
||||
Details are designed to function independently, but you can simulate a group or "accordion" where only one is shown at a time by listening for the `slShow` event.
|
||||
Details are designed to function independently, but you can simulate a group or "accordion" where only one is shown at a time by listening for the `sl-show` event.
|
||||
|
||||
```html preview
|
||||
<div class="details-group-example">
|
||||
|
|
|
@ -84,7 +84,7 @@ By design, a dialog's height will never exceed that of the viewport. As such, di
|
|||
|
||||
### Ignoring Clicks on the Overlay
|
||||
|
||||
By default, dialogs are closed when the user clicks or taps on the overlay. To prevent this behavior, cancel the `slOverlayDismiss` event.
|
||||
By default, dialogs are closed when the user clicks or taps on the overlay. To prevent this behavior, cancel the `sl-overlay-dismiss` event.
|
||||
|
||||
```html preview
|
||||
<sl-dialog label="Dialog" class="dialog-no-overlay-dismiss">
|
||||
|
|
|
@ -180,7 +180,7 @@ By design, a drawer's height will never exceed 100% of its container. As such, d
|
|||
|
||||
### Ignoring Clicks on the Overlay
|
||||
|
||||
By default, drawers are closed when the user clicks or taps on the overlay. To prevent this behavior, cancel the `slOverlayDismiss` event.
|
||||
By default, drawers are closed when the user clicks or taps on the overlay. To prevent this behavior, cancel the `sl-overlay-dismiss` event.
|
||||
|
||||
```html preview
|
||||
<sl-drawer label="Drawer" class="drawer-no-overlay-dismiss">
|
||||
|
|
|
@ -123,7 +123,7 @@ Dropdown panels will be clipped if they're inside a container that has `overflow
|
|||
|
||||
### Getting the Selected Item
|
||||
|
||||
When dropdowns are used with [menus](/components/menu.md), you can listen for the `slSelect` event to determine which menu item was selected. The menu item element will be exposed in `event.detail.item`. You can set `value` props to make it easier to identify commands.
|
||||
When dropdowns are used with [menus](/components/menu.md), you can listen for the `sl-select` event to determine which menu item was selected. The menu item element will be exposed in `event.detail.item`. You can set `value` props to make it easier to identify commands.
|
||||
|
||||
```html preview
|
||||
<div class="dropdown-selection">
|
||||
|
|
|
@ -6,9 +6,9 @@ Forms collect data that can easily be processed and sent to a server.
|
|||
|
||||
All Shoelace components make use of a [shadow DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM) to encapsulate markup, styles, and behavior. One caveat of this approach is that native `<form>` elements will not recognize Shoelace form controls.
|
||||
|
||||
This component solves that problem by serializing _both_ Shoelace form controls and native form controls when the form is submitted. The resulting form data is exposed in the `slSubmit` event as a [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) object in `event.detail.formData`. You can also find an array of form controls in `event.detail.formControls`.
|
||||
This component solves that problem by serializing _both_ Shoelace form controls and native form controls when the form is submitted. The resulting form data is exposed in the `sl-submit` event as a [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) object in `event.detail.formData`. You can also find an array of form controls in `event.detail.formControls`.
|
||||
|
||||
Shoelace forms don't make use of `action` and `method` attributes and they don't submit the same was as native forms. To handle submission, you need to listen for the `slSubmit` event as shown in the example below and make an XHR request with the resulting form data.
|
||||
Shoelace forms don't make use of `action` and `method` attributes and they don't submit the same was as native forms. To handle submission, you need to listen for the `sl-submit` event as shown in the example below and make an XHR request with the resulting form data.
|
||||
|
||||
```html preview
|
||||
<sl-form class="form-overview">
|
||||
|
|
|
@ -450,7 +450,7 @@ export namespace Components {
|
|||
*/
|
||||
"novalidate": boolean;
|
||||
/**
|
||||
* Submits the form. If all controls are valid, the `slSubmit` event will be emitted and the promise will resolve with `true`. If any form control is invalid, the promise will resolve with `false` and no event will be emitted.
|
||||
* Submits the form. If all controls are valid, the `sl-submit` event will be emitted and the promise will resolve with `true`. If any form control is invalid, the promise will resolve with `false` and no event will be emitted.
|
||||
*/
|
||||
"submit": () => Promise<boolean>;
|
||||
}
|
||||
|
|
|
@ -202,8 +202,8 @@ export class Form {
|
|||
}
|
||||
|
||||
/**
|
||||
* Submits the form. If all controls are valid, the `slSubmit` event will be emitted and the promise will resolve with
|
||||
* `true`. If any form control is invalid, the promise will resolve with `false` and no event will be emitted.
|
||||
* Submits the form. If all controls are valid, the `sl-submit` event will be emitted and the promise will resolve
|
||||
* with `true`. If any form control is invalid, the promise will resolve with `false` and no event will be emitted.
|
||||
*/
|
||||
@Method()
|
||||
async submit() {
|
||||
|
|
Ładowanie…
Reference in New Issue