-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make input work from left-to-right in RTL
- Create a new text-field component extending vaadin-text-field - Add styles to make text-field behave as in LTR on RTL - Add visual tests for RTL - Fix styles for Lumo theme Fix vaadin/vaadin-date-picker-flow#235
- Loading branch information
1 parent
e610aae
commit 290f762
Showing
11 changed files
with
93 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<!-- | ||
@license | ||
Copyright (c) 2019 Vaadin Ltd. | ||
This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
--> | ||
|
||
<link rel="import" href="../../vaadin-text-field/src/vaadin-text-field.html"> | ||
|
||
<dom-module id="vaadin-date-picker-text-field-styless" theme-for="vaadin-date-picker-text-field"> | ||
<template> | ||
<style> | ||
:host([dir="rtl"]) [part="input-field"] { | ||
direction: ltr; | ||
} | ||
|
||
:host([dir="rtl"]) [part="value"]::placeholder { | ||
direction: rtl; | ||
text-align: left; | ||
} | ||
|
||
:host([dir="rtl"]) [part="input-field"] ::slotted(input)::placeholder { | ||
direction: rtl; | ||
text-align: left; | ||
} | ||
|
||
:host([dir="rtl"]) [part="value"]:-ms-input-placeholder, | ||
:host([dir="rtl"]) [part="input-field"] ::slotted(input):-ms-input-placeholder { | ||
direction: rtl; | ||
text-align: left; | ||
} | ||
</style> | ||
</template> | ||
</dom-module> | ||
|
||
<script> | ||
(function() { | ||
/** | ||
* The text-field element for date input. | ||
* | ||
* ### Styling | ||
* | ||
* See [`<vaadin-text-field>` documentation](https://github.com/vaadin/vaadin-text-field/blob/master/src/vaadin-text-field.html) | ||
* for `<vaadin-date-picker-text-field>` parts and available slots (prefix, suffix etc.) | ||
* | ||
* See [ThemableMixin – how to apply styles for shadow parts](https://github.com/vaadin/vaadin-themable-mixin/wiki) | ||
* | ||
* @memberof Vaadin | ||
* @extends Vaadin.TextFieldElement | ||
*/ | ||
class DatePickerTextFieldElement extends Vaadin.TextFieldElement { | ||
static get is() { | ||
return 'vaadin-date-picker-text-field'; | ||
} | ||
} | ||
|
||
customElements.define(DatePickerTextFieldElement.is, DatePickerTextFieldElement); | ||
})(); | ||
</script> |
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
Binary file added
BIN
+17.5 KB
test/visual/screens/vaadin-date-picker/default-tests-lumo/rtl/chrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.3 KB
test/visual/screens/vaadin-date-picker/default-tests-material/rtl/chrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,18 @@ | ||
<link rel="import" href="../../../vaadin-text-field/theme/lumo/vaadin-text-field.html"> | ||
|
||
<dom-module id="lumo-date-picker-text-field" theme-for="vaadin-date-picker-text-field"> | ||
<template> | ||
<style> | ||
:not(*):placeholder-shown, /* to prevent broken styles on IE */ | ||
:host([dir="rtl"]) [part="value"]:placeholder-shown, | ||
:host([dir="rtl"]) [part="input-field"] ::slotted(input:placeholder-shown) { | ||
--_lumo-text-field-overflow-mask-image: none; | ||
} | ||
|
||
:host([dir="rtl"]) [part="value"], | ||
:host([dir="rtl"]) [part="input-field"] ::slotted(input) { | ||
--_lumo-text-field-overflow-mask-image: linear-gradient(to left, transparent, #000 1.25em); | ||
} | ||
</style> | ||
</template> | ||
</dom-module> |
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,3 @@ | ||
<link rel="import" href="vaadin-date-picker-text-field-styles.html"> | ||
|
||
<link rel="import" href="../../src/vaadin-date-picker-text-field.html"> |
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,3 @@ | ||
<link rel="import" href="../../../vaadin-text-field/theme/material/vaadin-text-field.html"> | ||
|
||
<link rel="import" href="../../src/vaadin-date-picker-text-field.html"> |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
<link rel="import" href="vaadin-date-picker-styles.html"> | ||
<link rel="import" href="vaadin-date-picker-text-field.html"> | ||
<link rel="import" href="../../src/vaadin-date-picker.html"> |