Skip to content

Commit

Permalink
fix: update rtl css variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenesius committed Nov 18, 2023
1 parent 66e47cd commit 9b7e497
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 20 deletions.
10 changes: 9 additions & 1 deletion examples/all-inputs/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<template>
<div>

<div>
<button @click = "handleRTL">Make RTL</button>
</div>

<h2>Input Text</h2>
<input-field name = "username"/>
<input-field name = "username" label = "With label"/>
Expand All @@ -20,7 +25,7 @@
<input-field name = "description" type = "textarea" label = "Placeholder" placeholder = "Add information about user." />
<input-field name = "description" type = "textarea" label = "Auto resize" autoresize />

<h2>Input Tel</h2>
<h2>Input Date</h2>
<input-field name = "birthday" type = "date"/>
<input-field name = "birthday" type = "date" label = "With label"/>
<input-field name = "birthday" type = "date" label = "Disabled" disabled/>
Expand Down Expand Up @@ -141,6 +146,9 @@ function prettyUnit(unit: string) {
}
}
function handleRTL() {
document.body.dir = (document.body.dir === 'rtl') ? "ltr" : "rtl"
}
const optionsCheckbox = [
{
Expand Down
22 changes: 11 additions & 11 deletions src/widgets/inputs/input-date/input-date.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
:disabled="disabled"
>
</div>
<div class="input-date-icon"
<div class="input-date-icon vf-grid-center"
@click="changeCalendarStatus(!calendarStatus)"
:class="{
'input-date-icon_active': calendarStatus
Expand Down Expand Up @@ -155,7 +155,7 @@ watch(() => props.modelValue, v => insideValue.value = v, {immediate: true})
}

.input-date {
padding: 0 4px;
padding-inline: 4px;
color: var(--vf-input-color);
font-size: var(--vf-input-font-size);
position: relative;
Expand All @@ -171,25 +171,25 @@ watch(() => props.modelValue, v => insideValue.value = v, {immediate: true})
.input-date-mask {
display: flex;
align-items: center;
height: 100%;

position: absolute;
inset-inline-start: 0;
inset-block-start: 0;
z-index: 0;
top: 0;
height: 100%;
left: 0;
margin: 0;
padding: 0 4px;

padding-inline: 4px;
user-select: none;
font-size: var(--vf-input-font-size);
color: var(--vf-input-gray-dark);
}

.input-date-icon {
cursor: pointer;
display: grid;
place-content: center;
stroke: var(--vf-input-gray-deep);
transition: var(--vf-input-transtion-fast);
padding: 0 6px;
padding-inline: 6px;
}

.input-date-icon_active {
Expand All @@ -201,9 +201,9 @@ watch(() => props.modelValue, v => insideValue.value = v, {immediate: true})

.input-date-calendar {
position: absolute;
right: 0;
margin-top: 10px;
z-index: 2;
inset-inline-end: 0;
inset-block-start: 10px;
}
.container-date-calendar {
position: relative;
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/inputs/input-number/widget-input-number.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function onStep(v: boolean) {
outline: none;
padding: 0 4px;
color: var(--vf-input-color);
text-align: right;
background-color: transparent;
}
Expand All @@ -120,6 +120,6 @@ function onStep(v: boolean) {
color: var(--vf-input-black-light);
line-height: var(--vf-input-height);
font-size: var(--vf-input-font-size);
padding: 0 5px 0 0;
padding-inline-end: 5px;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ defineProps<{
}
.container-input-select-current-label {
padding: 0 6px;
padding-inline: 6px;
color: var(--vf-input-color);
font-size: var(--vf-input-font-size);
flex-grow: 1;
}
.container-input-select-current > .vf-arrow {
margin: 0 10px 0 0;
margin-inline-end: 10px;
}
</style>
10 changes: 9 additions & 1 deletion src/widgets/inputs/input-switch/widget-input-switch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ function onInput(v = props.values ? getNextFormToggleValues(props.values, props.
<style scoped>
.container-input-switch {
display: flex;
gap: 12px;
align-items: center;
gap: 12px;
}
.input-switch {
Expand Down Expand Up @@ -87,6 +88,13 @@ function onInput(v = props.values ? getNextFormToggleValues(props.values, props.
background-color: var(--vf-input-active);
transform: translateX(18px);
}
[dir="rtl"] .input-switch-button {
transform: translateX(-3px);
}
[dir="rtl"] .input-switch-button_active {
transform: translateX(-18px);
}
.vf-input-switch_error {
border: var(--vf-input-border-error);
}
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/inputs/input-tel/widget-input-tel-code.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<style scoped>
.container-input-tel-code{
padding: 0 10px;
padding-inline: 10px;
}
.input-tel-code{
user-select: none;
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/inputs/input-text/input-text.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ watch(() => props.maxLength, () => onInput(props.modelValue));
color: var(--vf-input-black-light);
line-height: var(--vf-input-height);
font-size: var(--vf-input-font-size);
padding: 0 0 0 4px;
padding-inline: 4px 0;
}
.input-text {
flex-grow: 1;
padding: 0 4px;
padding-inline: 4px;
color: var(--vf-input-color);
font-size: var(--vf-input-font-size);
}
Expand Down

0 comments on commit 9b7e497

Please sign in to comment.