Merge pull request #12772 from yosilevy/RTL-switch

Various RTL fixes
This commit is contained in:
Yosi Levy 2022-05-26 21:04:50 +03:00 committed by GitHub
commit b7cdd9a22f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 9 deletions

View File

@ -28,10 +28,15 @@ export class HaFormfield extends FormfieldBase {
css` css`
:host(:not([alignEnd])) ::slotted(ha-switch) { :host(:not([alignEnd])) ::slotted(ha-switch) {
margin-right: 10px; margin-right: 10px;
margin-inline-end: 10px;
margin-inline-start: inline;
} }
:host([dir="rtl"]:not([alignEnd])) ::slotted(ha-switch) { .mdc-form-field > label {
margin-left: 10px; direction: var(--direction);
margin-right: auto; margin-inline-start: 0;
margin-inline-end: auto;
padding-inline-start: 4px;
padding-inline-end: 0;
} }
`, `,
]; ];

View File

@ -1,4 +1,3 @@
import "@material/mwc-formfield/mwc-formfield";
import "@material/mwc-list/mwc-list-item"; import "@material/mwc-list/mwc-list-item";
import { mdiClose } from "@mdi/js"; import { mdiClose } from "@mdi/js";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
@ -47,14 +46,14 @@ export class HaSelectSelector extends LitElement {
${this.label} ${this.label}
${options.map( ${options.map(
(item: SelectOption) => html` (item: SelectOption) => html`
<mwc-formfield .label=${item.label}> <ha-formfield .label=${item.label}>
<ha-radio <ha-radio
.checked=${item.value === this.value} .checked=${item.value === this.value}
.value=${item.value} .value=${item.value}
.disabled=${this.disabled} .disabled=${this.disabled}
@change=${this._valueChanged} @change=${this._valueChanged}
></ha-radio> ></ha-radio>
</mwc-formfield> </ha-formfield>
` `
)} )}
</div> </div>

View File

@ -2,7 +2,6 @@ import "@material/mwc-button";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { property, state } from "lit/decorators"; import { property, state } from "lit/decorators";
import memoizeOne from "memoize-one"; import memoizeOne from "memoize-one";
import { computeRTLDirection } from "../../../common/util/compute_rtl";
import "../../../components/entity/ha-entities-picker"; import "../../../components/entity/ha-entities-picker";
import { createCloseHeading } from "../../../components/ha-dialog"; import { createCloseHeading } from "../../../components/ha-dialog";
import "../../../components/ha-formfield"; import "../../../components/ha-formfield";
@ -159,7 +158,6 @@ class DialogPersonDetail extends LitElement {
.label=${this.hass.localize( .label=${this.hass.localize(
"ui.panel.config.person.detail.local_only" "ui.panel.config.person.detail.local_only"
)} )}
.dir=${computeRTLDirection(this.hass)}
> >
<ha-switch <ha-switch
.checked=${this._localOnly} .checked=${this._localOnly}
@ -171,7 +169,6 @@ class DialogPersonDetail extends LitElement {
.label=${this.hass.localize( .label=${this.hass.localize(
"ui.panel.config.person.detail.admin" "ui.panel.config.person.detail.admin"
)} )}
.dir=${computeRTLDirection(this.hass)}
> >
<ha-switch <ha-switch
.disabled=${this._user.system_generated || .disabled=${this._user.system_generated ||

View File

@ -193,6 +193,9 @@ export class HuiEntityEditor extends LitElement {
.add-entity { .add-entity {
display: block; display: block;
margin-left: 31px; margin-left: 31px;
margin-inline-start: 31px;
margin-inline-end: initial;
direction: var(--direction);
} }
.entity { .entity {
display: flex; display: flex;

View File

@ -261,6 +261,9 @@ export class HuiEntitiesCardRowEditor extends LitElement {
display: block; display: block;
margin-left: 31px; margin-left: 31px;
margin-right: 71px; margin-right: 71px;
margin-inline-start: 31px;
margin-inline-end: 71px;
direction: var(--direction);
} }
.entity { .entity {
display: flex; display: flex;
@ -270,6 +273,9 @@ export class HuiEntitiesCardRowEditor extends LitElement {
.entity .handle { .entity .handle {
padding-right: 8px; padding-right: 8px;
cursor: move; cursor: move;
padding-inline-end: 8px;
padding-inline-start: initial;
direction: var(--direction);
} }
.entity ha-entity-picker { .entity ha-entity-picker {