From cd0a135d893b5e86da1f73ce77c1eaa6f69dcd47 Mon Sep 17 00:00:00 2001 From: LeoTiTo Date: Wed, 14 May 2025 17:06:21 +0200 Subject: [PATCH 1/4] feat: update border color for filled input fields in AInput, ASelect, and ATextarea components --- components/AInput.vue | 21 ++++++++++++++++++++- components/ASelect.vue | 23 +++++++++++++++++++++-- components/ATextarea.vue | 25 ++++++++++++++++++++++--- 3 files changed, 63 insertions(+), 6 deletions(-) diff --git a/components/AInput.vue b/components/AInput.vue index 8a4dd12..0d53280 100644 --- a/components/AInput.vue +++ b/components/AInput.vue @@ -67,6 +67,20 @@ const onInputChange = (newValue: string[]) => { inputValue.value = newValue; }; +const isInputFilledToChangeBorderColor = computed(() => { + const currentValue = model.value; + if (currentValue === null || currentValue === undefined) { + return false; + } + if (typeof currentValue === 'string') { + return currentValue.length > 0; + } + if (Array.isArray(currentValue)) { + return currentValue.length > 0; + } + return true; +}); + //LISTEN KEYDOWN const handleKeydown = (event: KeyboardEvent) => { if (props.type === "time") { @@ -88,6 +102,7 @@ const preventClear = (event: KeyboardEvent) => { :class="[ type === 'phone' && 'a-input-phone', state !== 'default' && `a-input-${state}`, + { 'is-not-empty': isInputFilledToChangeBorderColor }, ]" :style="{ width: full && '100%', @@ -256,7 +271,11 @@ const preventClear = (event: KeyboardEvent) => { display: flex; background: var(--a-white); overflow: visible; - border: 1px solid var(--a-grey-light); + border: 1px solid var(--a-grey-lighter); + + &.is-not-empty { + border-color: var(--a-grey-light); + } &:focus-within { border-color: #0969da; diff --git a/components/ASelect.vue b/components/ASelect.vue index 34c3c38..92028e0 100644 --- a/components/ASelect.vue +++ b/components/ASelect.vue @@ -34,7 +34,7 @@ const props = withDefaults(defineProps(), { noResults: "No results found", noOptions: "The list is empty", placeholder: "Type your tag..", - color: "grey-light", + color: "grey-lighter", tagColor: "primary", arrowColor: "grey", mode: "tags", @@ -75,12 +75,27 @@ const isInputFilled = computed(() => inputValue?.value?.length > 0); const onInputChange = (newValue: string[]) => { inputValue.value = newValue; }; + +const isInputFilledToChangeBorderColor = computed(() => { + const currentValue = value.value; + if (currentValue === null || currentValue === undefined) { + return false; + } + if (typeof currentValue === 'string') { + return currentValue.length > 0; + } + if (Array.isArray(currentValue)) { + return currentValue.length > 0; + } + return true; +}); +