@@ -12,34 +12,23 @@ import {property, query, queryAssignedElements} from 'lit/decorators.js';
1212
1313import { ARIAMixinStrict } from '../../internal/aria/aria.js' ;
1414import { mixinDelegatesAria } from '../../internal/aria/delegate.js' ;
15- import {
16- FormSubmitter ,
17- setupFormSubmitter ,
18- type FormSubmitterType ,
19- } from '../../internal/controller/form-submitter.js' ;
2015import {
2116 dispatchActivationClick ,
2217 isActivationClick ,
2318} from '../../internal/events/form-label-activation.js' ;
24- import {
25- internals ,
26- mixinElementInternals ,
27- } from '../../labs/behaviors/element-internals.js' ;
19+ import { mixinElementInternals } from '../../labs/behaviors/element-internals.js' ;
20+ import { mixinFormAssociated } from '../../labs/behaviors/form-associated.js' ;
21+ import { mixinFormSubmitter } from '../../labs/behaviors/form-submitter.js' ;
2822
2923// Separate variable needed for closure.
30- const buttonBaseClass = mixinDelegatesAria ( mixinElementInternals ( LitElement ) ) ;
24+ const buttonBaseClass = mixinDelegatesAria (
25+ mixinFormSubmitter ( mixinFormAssociated ( mixinElementInternals ( LitElement ) ) ) ,
26+ ) ;
3127
3228/**
3329 * A button component.
3430 */
35- export abstract class Button extends buttonBaseClass implements FormSubmitter {
36- static {
37- setupFormSubmitter ( Button ) ;
38- }
39-
40- /** @nocollapse */
41- static readonly formAssociated = true ;
42-
31+ export abstract class Button extends buttonBaseClass {
4332 /** @nocollapse */
4433 static override shadowRootOptions : ShadowRootInit = {
4534 mode : 'open' ,
@@ -49,7 +38,7 @@ export abstract class Button extends buttonBaseClass implements FormSubmitter {
4938 /**
5039 * Whether or not the button is disabled.
5140 */
52- @ property ( { type : Boolean , reflect : true } ) disabled = false ;
41+ declare disabled : boolean ; // for jsdoc until lit-analyzer is updated
5342
5443 /**
5544 * Whether or not the button is "soft-disabled" (disabled but still
@@ -95,32 +84,6 @@ export abstract class Button extends buttonBaseClass implements FormSubmitter {
9584 @property ( { type : Boolean , attribute : 'has-icon' , reflect : true } ) hasIcon =
9685 false ;
9786
98- /**
99- * The default behavior of the button. May be "button", "reset", or "submit"
100- * (default).
101- */
102- @property ( ) type : FormSubmitterType = 'submit' ;
103-
104- /**
105- * The value added to a form with the button's name when the button submits a
106- * form.
107- */
108- @property ( { reflect : true } ) value = '' ;
109-
110- get name ( ) {
111- return this . getAttribute ( 'name' ) ?? '' ;
112- }
113- set name ( name : string ) {
114- this . setAttribute ( 'name' , name ) ;
115- }
116-
117- /**
118- * The associated form element with which this element's value will submit.
119- */
120- get form ( ) {
121- return this [ internals ] . form ;
122- }
123-
12487 @query ( '.button' ) private readonly buttonElement ! : HTMLElement | null ;
12588
12689 @queryAssignedElements ( { slot : 'icon' , flatten : true } )
0 commit comments