Skip to content

Commit 1e5c84c

Browse files
authored
Merge pull request #184 from Jenesius/issue_180
fix: update `rtl` css variables.
2 parents 66e47cd + 9b7e497 commit 1e5c84c

File tree

7 files changed

+36
-20
lines changed

7 files changed

+36
-20
lines changed

examples/all-inputs/App.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<template>
22
<div>
3+
4+
<div>
5+
<button @click = "handleRTL">Make RTL</button>
6+
</div>
7+
38
<h2>Input Text</h2>
49
<input-field name = "username"/>
510
<input-field name = "username" label = "With label"/>
@@ -20,7 +25,7 @@
2025
<input-field name = "description" type = "textarea" label = "Placeholder" placeholder = "Add information about user." />
2126
<input-field name = "description" type = "textarea" label = "Auto resize" autoresize />
2227

23-
<h2>Input Tel</h2>
28+
<h2>Input Date</h2>
2429
<input-field name = "birthday" type = "date"/>
2530
<input-field name = "birthday" type = "date" label = "With label"/>
2631
<input-field name = "birthday" type = "date" label = "Disabled" disabled/>
@@ -141,6 +146,9 @@ function prettyUnit(unit: string) {
141146
}
142147
}
143148
149+
function handleRTL() {
150+
document.body.dir = (document.body.dir === 'rtl') ? "ltr" : "rtl"
151+
}
144152
145153
const optionsCheckbox = [
146154
{

src/widgets/inputs/input-date/input-date.vue

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
:disabled="disabled"
1414
>
1515
</div>
16-
<div class="input-date-icon"
16+
<div class="input-date-icon vf-grid-center"
1717
@click="changeCalendarStatus(!calendarStatus)"
1818
:class="{
1919
'input-date-icon_active': calendarStatus
@@ -155,7 +155,7 @@ watch(() => props.modelValue, v => insideValue.value = v, {immediate: true})
155155
}
156156
157157
.input-date {
158-
padding: 0 4px;
158+
padding-inline: 4px;
159159
color: var(--vf-input-color);
160160
font-size: var(--vf-input-font-size);
161161
position: relative;
@@ -171,25 +171,25 @@ watch(() => props.modelValue, v => insideValue.value = v, {immediate: true})
171171
.input-date-mask {
172172
display: flex;
173173
align-items: center;
174+
height: 100%;
175+
174176
position: absolute;
177+
inset-inline-start: 0;
178+
inset-block-start: 0;
175179
z-index: 0;
176-
top: 0;
177-
height: 100%;
178-
left: 0;
179180
margin: 0;
180-
padding: 0 4px;
181+
182+
padding-inline: 4px;
181183
user-select: none;
182184
font-size: var(--vf-input-font-size);
183185
color: var(--vf-input-gray-dark);
184186
}
185187
186188
.input-date-icon {
187189
cursor: pointer;
188-
display: grid;
189-
place-content: center;
190190
stroke: var(--vf-input-gray-deep);
191191
transition: var(--vf-input-transtion-fast);
192-
padding: 0 6px;
192+
padding-inline: 6px;
193193
}
194194
195195
.input-date-icon_active {
@@ -201,9 +201,9 @@ watch(() => props.modelValue, v => insideValue.value = v, {immediate: true})
201201
202202
.input-date-calendar {
203203
position: absolute;
204-
right: 0;
205-
margin-top: 10px;
206204
z-index: 2;
205+
inset-inline-end: 0;
206+
inset-block-start: 10px;
207207
}
208208
.container-date-calendar {
209209
position: relative;

src/widgets/inputs/input-number/widget-input-number.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function onStep(v: boolean) {
9999
outline: none;
100100
padding: 0 4px;
101101
color: var(--vf-input-color);
102-
text-align: right;
102+
103103
background-color: transparent;
104104
}
105105
@@ -120,6 +120,6 @@ function onStep(v: boolean) {
120120
color: var(--vf-input-black-light);
121121
line-height: var(--vf-input-height);
122122
font-size: var(--vf-input-font-size);
123-
padding: 0 5px 0 0;
123+
padding-inline-end: 5px;
124124
}
125125
</style>

src/widgets/inputs/input-select/widget-input-select-current.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ defineProps<{
3030
}
3131
3232
.container-input-select-current-label {
33-
padding: 0 6px;
33+
padding-inline: 6px;
3434
color: var(--vf-input-color);
3535
font-size: var(--vf-input-font-size);
3636
3737
flex-grow: 1;
3838
}
3939
4040
.container-input-select-current > .vf-arrow {
41-
margin: 0 10px 0 0;
41+
margin-inline-end: 10px;
4242
}
4343
</style>

src/widgets/inputs/input-switch/widget-input-switch.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ function onInput(v = props.values ? getNextFormToggleValues(props.values, props.
5454
<style scoped>
5555
.container-input-switch {
5656
display: flex;
57-
gap: 12px;
5857
align-items: center;
58+
59+
gap: 12px;
5960
}
6061
6162
.input-switch {
@@ -87,6 +88,13 @@ function onInput(v = props.values ? getNextFormToggleValues(props.values, props.
8788
background-color: var(--vf-input-active);
8889
transform: translateX(18px);
8990
}
91+
[dir="rtl"] .input-switch-button {
92+
transform: translateX(-3px);
93+
}
94+
[dir="rtl"] .input-switch-button_active {
95+
transform: translateX(-18px);
96+
}
97+
9098
.vf-input-switch_error {
9199
border: var(--vf-input-border-error);
92100
}

src/widgets/inputs/input-tel/widget-input-tel-code.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<style scoped>
1919
.container-input-tel-code{
20-
padding: 0 10px;
20+
padding-inline: 10px;
2121
}
2222
.input-tel-code{
2323
user-select: none;

src/widgets/inputs/input-text/input-text.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ watch(() => props.maxLength, () => onInput(props.modelValue));
101101
color: var(--vf-input-black-light);
102102
line-height: var(--vf-input-height);
103103
font-size: var(--vf-input-font-size);
104-
padding: 0 0 0 4px;
104+
padding-inline: 4px 0;
105105
}
106106
.input-text {
107107
flex-grow: 1;
108-
padding: 0 4px;
108+
padding-inline: 4px;
109109
color: var(--vf-input-color);
110110
font-size: var(--vf-input-font-size);
111111
}

0 commit comments

Comments
 (0)