11import { html , LitElement , nothing } from "lit" ;
22import { customElement , property , state } from "lit/decorators" ;
3+ import memoizeOne from "memoize-one" ;
4+ import type { LocalizeFunc } from "../../../../common/translations/localize" ;
5+ import "../../../../components/ha-form/ha-form" ;
36import type { HomeAssistant } from "../../../../types" ;
47import type { ButtonCardFeatureConfig } from "../../card-features/types" ;
58import type { LovelaceCardFeatureEditor } from "../../types" ;
6- import "../../../../components/ha-form/ha-form" ;
7- import type { HaFormSchema } from "../../../../components/ha-form/types" ;
89
910@customElement ( "hui-button-card-feature-editor" )
1011export class HuiButtonCardFeatureEditor
@@ -19,14 +20,15 @@ export class HuiButtonCardFeatureEditor
1920 this . _config = config ;
2021 }
2122
22- private _schema : HaFormSchema [ ] = [
23+ private _schema = memoizeOne ( ( localize : LocalizeFunc ) => [
2324 {
2425 name : "action_name" ,
26+ default : localize ( "ui.card.button.press" ) ,
2527 selector : {
2628 text : { } ,
2729 } ,
2830 } ,
29- ] ;
31+ ] ) ;
3032
3133 protected render ( ) {
3234 if ( ! this . hass || ! this . _config ) {
@@ -37,12 +39,15 @@ export class HuiButtonCardFeatureEditor
3739 < ha-form
3840 .hass =${ this . hass }
3941 .data =${ this . _config }
40- .schema=${ this . _schema }
42+ .schema=${ this . _schema ( this . hass . localize ) }
43+ .computeLabel=${ this . _computeLabel }
4144 @value-changed=${ this . _valueChanged }
4245 > </ ha-form >
4346 ` ;
4447 }
4548
49+ private _computeLabel = ( ) => this . hass . localize ( "ui.common.name" ) ;
50+
4651 private _valueChanged ( ev : CustomEvent ) {
4752 ev . stopPropagation ( ) ;
4853 this . dispatchEvent (
0 commit comments