-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d1e923
commit 4c94ac5
Showing
6 changed files
with
107 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { css, html, LitElement } from "lit"; | ||
import { customElement, property } from "lit/decorators"; | ||
import { CountrySelector } from "../../data/selector"; | ||
import { HomeAssistant } from "../../types"; | ||
import "../ha-country-picker"; | ||
|
||
@customElement("ha-selector-country") | ||
export class HaCountrySelector extends LitElement { | ||
@property() public hass!: HomeAssistant; | ||
|
||
@property() public selector!: CountrySelector; | ||
|
||
@property() public value?: any; | ||
|
||
@property() public label?: string; | ||
|
||
@property() public helper?: string; | ||
|
||
@property({ type: Boolean }) public disabled = false; | ||
|
||
@property({ type: Boolean }) public required = true; | ||
|
||
protected render() { | ||
return html` | ||
<ha-country-picker | ||
.hass=${this.hass} | ||
.value=${this.value} | ||
.label=${this.label} | ||
.helper=${this.helper} | ||
.countries=${this.selector.country?.countries} | ||
.noSort=${this.selector.country?.no_sort} | ||
.disabled=${this.disabled} | ||
.required=${this.required} | ||
></ha-country-picker> | ||
`; | ||
} | ||
|
||
static styles = css` | ||
ha-country-picker { | ||
width: 100%; | ||
} | ||
`; | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"ha-selector-country": HaCountrySelector; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters