Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/components/ha-clickable-list-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,18 @@ export class HaClickableListItem extends ListItemBase {
padding-right: var(--mdc-list-side-padding, 20px);
overflow: hidden;
}
:host-context([style*="direction: rtl;"])
span.material-icons:first-of-type {
margin-left: var(--mdc-list-item-graphic-margin, 16px) !important;
margin-right: 0px !important;
span.material-icons:first-of-type {
margin-inline-start: 0px !important;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need important?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes because otherwise margin-right overwrites it with 16 from

:host([graphic=avatar]) .mdc-deprecated-list-item__graphic, :host([graphic=medium]) .mdc-deprecated-list-item__graphic, :host([graphic=large]) .mdc-deprecated-list-item__graphic, :host([graphic=control]) .mdc-deprecated-list-item__graphic {
    margin-left: 0;
    margin-right: var(--mdc-list-item-graphic-margin, 16px);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should try to use the exact same selector used as you want to override, then you dont need important.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

margin-inline-end: var(
--mdc-list-item-graphic-margin,
16px
) !important;
direction: var(--direction);
}
:host-context([style*="direction: rtl;"])
span.material-icons:last-of-type {
margin-left: 0px !important;
margin-right: auto !important;
span.material-icons:last-of-type {
margin-inline-start: auto !important;
margin-inline-end: 0px !important;
direction: var(--direction);
}
`,
];
Expand Down
18 changes: 6 additions & 12 deletions src/components/ha-combo-box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ export class HaComboBox extends LitElement {
.toggle-button {
right: 12px;
top: -10px;
inset-inline-start: initial;
inset-inline-end: 12px;
direction: var(--direction);
}
:host([opened]) .toggle-button {
color: var(--primary-color);
Expand All @@ -249,18 +252,9 @@ export class HaComboBox extends LitElement {
--mdc-icon-size: 20px;
top: -7px;
right: 36px;
}

:host-context([style*="direction: rtl;"]) .toggle-button {
left: 12px;
right: auto;
top: -10px;
}
:host-context([style*="direction: rtl;"]) .clear-button {
--mdc-icon-size: 20px;
top: -7px;
left: 36px;
right: auto;
inset-inline-start: initial;
inset-inline-end: 36px;
direction: var(--direction);
}
`;
}
Expand Down
22 changes: 10 additions & 12 deletions src/components/ha-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { styles } from "@material/mwc-dialog/mwc-dialog.css";
import { mdiClose } from "@mdi/js";
import { css, html, TemplateResult } from "lit";
import { customElement } from "lit/decorators";
import { computeRTLDirection } from "../common/util/compute_rtl";
import type { HomeAssistant } from "../types";
import "./ha-icon-button";

Expand All @@ -17,7 +16,6 @@ export const createCloseHeading = (
.path=${mdiClose}
dialogAction="close"
class="header_button"
dir=${computeRTLDirection(hass)}
></ha-icon-button>
`;

Expand Down Expand Up @@ -89,18 +87,18 @@ export class HaDialog extends DialogBase {
}
.header_title {
margin-right: 40px;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Done

margin-inline-end: 40px;
direction: var(--direction);
}
[dir="rtl"].header_button {
right: auto;
left: 16px;
}
[dir="rtl"].header_title {
margin-left: 40px;
margin-right: 0px;
.header_button {
inset-inline-start: initial;
inset-inline-end: 16px;
direction: var(--direction);
}
:host-context([style*="direction: rtl;"]) .dialog-actions {
left: 0px !important;
right: auto !important;
.dialog-actions {
inset-inline-start: initial !important;
inset-inline-end: 0px !important;
direction: var(--direction);
}
`,
];
Expand Down
23 changes: 11 additions & 12 deletions src/components/ha-file-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,24 +175,23 @@ export class HaFileUpload extends LitElement {
}
.mdc-text-field__icon--leading {
margin-bottom: 12px;
}
:host-context([style*="direction: rtl;"])
.mdc-text-field__icon--leading {
margin-right: 0px;
inset-inline-start: initial;
inset-inline-end: 0px;
direction: var(--direction);
}
.mdc-text-field--filled .mdc-floating-label--float-above {
transform: scale(0.75);
top: 8px;
}
:host-context([style*="direction: rtl;"]) .mdc-floating-label {
left: initial;
right: 16px;
.mdc-floating-label {
inset-inline-start: 16px !important;
inset-inline-end: initial !important;
Comment on lines +187 to +188
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need important?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes otherwise overruled by:

.mdc-text-field--with-leading-icon.mdc-text-field--filled .mdc-floating-label {
    max-width: calc(100% - 48px);
    left: 48px;
    right: initial;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

direction: var(--direction);
}
:host-context([style*="direction: rtl;"])
.mdc-text-field--filled
.mdc-floating-label {
left: initial;
right: 48px;
.mdc-text-field--filled .mdc-floating-label {
inset-inline-start: 48px !important;
inset-inline-end: initial !important;
direction: var(--direction);
}
.dragged:before {
position: var(--layout-fit_-_position);
Expand Down
7 changes: 4 additions & 3 deletions src/components/ha-form/ha-form-string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ export class HaFormString extends LitElement implements HaFormElement {
color: var(--secondary-text-color);
}

:host-context([style*="direction: rtl;"]) ha-icon-button {
right: auto;
left: 12px;
ha-icon-button {
inset-inline-start: initial;
inset-inline-end: 12px;
direction: var(--direction);
}
`;
}
Expand Down
7 changes: 4 additions & 3 deletions src/components/ha-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ export class HaSelect extends SelectBase {
.mdc-select__anchor {
width: var(--ha-select-min-width, 200px);
}
:host-context([style*="direction: rtl;"]) .mdc-floating-label {
right: 16px !important;
left: initial !important;
.mdc-floating-label {
inset-inline-start: 16px !important;
inset-inline-end: initial !important;
direction: var(--direction);
}
`,
];
Expand Down
7 changes: 4 additions & 3 deletions src/components/ha-target-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,10 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {
opacity: var(--light-disabled-opacity);
pointer-events: none;
}
:host-context([style*="direction: rtl;"]) .mdc-chip__icon {
margin-right: -14px !important;
margin-left: 4px !important;
.mdc-chip__icon {
margin-inline-start: -14px !important;
margin-inline-end: 4px !important;
direction: var(--direction);
}
`;
}
Expand Down
15 changes: 8 additions & 7 deletions src/components/ha-textfield.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,18 @@ export class HaTextField extends TextFieldBase {
overflow: var(--text-field-overflow);
}

:host-context([style*="direction: rtl;"]) .mdc-floating-label {
right: 10px !important;
left: initial !important;
.mdc-floating-label {
inset-inline-start: 16px !important;
inset-inline-end: initial !important;
direction: var(--direction);
}

:host-context([style*="direction: rtl;"])
.mdc-text-field--with-leading-icon.mdc-text-field--filled
.mdc-text-field--with-leading-icon.mdc-text-field--filled
.mdc-floating-label {
max-width: calc(100% - 48px);
right: 48px !important;
left: initial !important;
inset-inline-start: 48px !important;
inset-inline-end: initial !important;
direction: var(--direction);
}
`,
];
Expand Down
7 changes: 4 additions & 3 deletions src/components/media-player/dialog-media-manage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,10 @@ class DialogMediaManage extends LitElement {
vertical-align: middle;
}

:host-context([style*="direction: rtl;"]) ha-svg-icon[slot="icon"] {
margin-left: 8px !important;
margin-right: 0px !important;
ha-svg-icon[slot="icon"] {
margin-inline-start: 0px !important;
margin-inline-end: 8px !important;
direction: var(--direction);
}

.refresh {
Expand Down
7 changes: 4 additions & 3 deletions src/components/media-player/ha-media-manage-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ class MediaManageButton extends LitElement {
vertical-align: middle;
}

:host-context([style*="direction: rtl;"]) ha-svg-icon[slot="icon"] {
margin-left: 8px;
margin-right: 0px;
ha-svg-icon[slot="icon"] {
margin-inline-start: 0px;
margin-inline-end: 8px;
direction: var(--direction);
}
`;
}
Expand Down
7 changes: 4 additions & 3 deletions src/components/media-player/ha-media-upload-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,10 @@ class MediaUploadButton extends LitElement {
vertical-align: middle;
}

:host-context([style*="direction: rtl;"]) ha-svg-icon[slot="icon"] {
margin-left: 8px;
margin-right: 0px;
ha-svg-icon[slot="icon"] {
margin-inline-start: 0px;
margin-inline-end: 8px;
direction: var(--direction);
}
`;
}
Expand Down
7 changes: 3 additions & 4 deletions src/dialogs/config-flow/dialog-data-entry-flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,10 +518,9 @@ class DataEntryFlowDialog extends LitElement {
position: absolute;
top: 0;
right: 0;
}
:host-context([style*="direction: rtl;"]) .dialog-actions {
right: auto;
left: 0;
inset-inline-start: initial;
inset-inline-end: 0px;
direction: var(--direction);
}
.dialog-actions > * {
color: var(--secondary-text-color);
Expand Down
7 changes: 2 additions & 5 deletions src/dialogs/config-flow/step-flow-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,8 @@ class StepFlowForm extends LitElement {
}
h2 {
word-break: break-word;
padding-right: 72px;
}
:host-context([style*="direction: rtl;"]) h2 {
padding-right: auto !important;
padding-left: 72px !important;
padding-inline-end: 72px;
direction: var(--direction);
}
`,
];
Expand Down
7 changes: 2 additions & 5 deletions src/dialogs/config-flow/step-flow-pick-flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,8 @@ class StepFlowPickFlow extends LitElement {
margin: 16px 0;
}
h2 {
padding-right: 66px;
}
:host-context([style*="direction: rtl;"]) h2 {
padding-right: auto !important;
padding-left: 66px !important;
padding-inline-end: 66px;
direction: var(--direction);
}
@media all and (max-height: 900px) {
div {
Expand Down
7 changes: 2 additions & 5 deletions src/dialogs/config-flow/step-flow-pick-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,8 @@ class StepFlowPickHandler extends LitElement {
border-bottom-color: var(--divider-color);
}
h2 {
padding-right: 66px;
}
:host-context([style*="direction: rtl;"]) h2 {
padding-right: auto !important;
padding-left: 66px !important;
padding-inline-end: 66px;
direction: var(--direction);
}
@media all and (max-height: 900px) {
mwc-list {
Expand Down
4 changes: 4 additions & 0 deletions src/dialogs/config-flow/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { css } from "lit";
export const configFlowContentStyles = css`
h2 {
margin: 24px 38px 0 0;
margin-inline-start: 0px;
margin-inline-end: 38px;
padding: 0 24px;
padding-inline-start: 24px;
padding-inline-end: 24px;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-family: var(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,17 +460,13 @@ export default class HaAutomationActionRow extends LitElement {
border-top-left-radius: var(--ha-card-border-radius);
}
.card-menu {
float: right;
float: var(--float-end, right);
Copy link
Copy Markdown
Member

@balloob balloob May 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

z-index: 3;
margin: 4px;
--mdc-theme-text-primary-on-background: var(--primary-text-color);
display: flex;
align-items: center;
}
:host-context([style*="direction: rtl;"]) .card-menu {
right: initial;
left: 16px;
}
mwc-list-item[disabled] {
--mdc-theme-text-primary-on-background: var(--disabled-text-color);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,16 +288,13 @@ export default class HaAutomationConditionRow extends LitElement {
border-top-left-radius: var(--ha-card-border-radius);
}
.card-menu {
float: right;
float: var(--float-end, right);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

z-index: 3;
margin: 4px;
--mdc-theme-text-primary-on-background: var(--primary-text-color);
display: flex;
align-items: center;
}
:host-context([style*="direction: rtl;"]) .card-menu {
float: left;
}
mwc-list-item[disabled] {
--mdc-theme-text-primary-on-background: var(--disabled-text-color);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,16 +487,13 @@ export default class HaAutomationTriggerRow extends LitElement {
border-top-left-radius: var(--ha-card-border-radius);
}
.card-menu {
float: right;
float: var(--float-end, right);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

z-index: 3;
margin: 4px;
--mdc-theme-text-primary-on-background: var(--primary-text-color);
display: flex;
align-items: center;
}
:host-context([style*="direction: rtl;"]) .card-menu {
float: left;
}
.triggered {
cursor: pointer;
position: absolute;
Expand Down
14 changes: 8 additions & 6 deletions src/panels/config/integrations/ha-integration-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,19 @@ export class HaIntegrationHeader extends LitElement {
.header {
display: flex;
position: relative;
padding: 0 8px 8px 16px;
padding-top: 0px;
padding-bottom: 8px;
padding-inline-start: 16px;
padding-inline-end: 8px;
direction: var(--direction);
}
.header img {
margin-right: 16px;
margin-top: 16px;
margin-inline-start: initial;
margin-inline-end: 16px;
width: 40px;
height: 40px;
}
:host-context([style*="direction: rtl;"]) .header img {
margin-right: auto !important;
margin-left: 16px;
direction: var(--direction);
}
.header .info {
flex: 1;
Expand Down
Loading