From ccaaedfd3d1266a711ec9e01b82ab4f450f01b42 Mon Sep 17 00:00:00 2001 From: Maxime GRANDCOLAS Date: Tue, 17 Sep 2024 12:45:13 +0200 Subject: [PATCH] [MS] Adds a popover option to search input --- lib/components/ms-input/MsSearchInput.vue | 87 ++++++++++++++++++----- src/views/HomePage.vue | 6 +- 2 files changed, 74 insertions(+), 19 deletions(-) diff --git a/lib/components/ms-input/MsSearchInput.vue b/lib/components/ms-input/MsSearchInput.vue index b20d614..1805c69 100644 --- a/lib/components/ms-input/MsSearchInput.vue +++ b/lib/components/ms-input/MsSearchInput.vue @@ -5,22 +5,54 @@ class="input-content ms-search-input" id="ms-search-input" > - - - +
+
+ + {{ $msTranslate(placeholder) }} +
+
+ +
+
+ +
+ + + +
@@ -28,14 +60,16 @@ import { Translatable } from '@lib/services'; import { IonIcon, IonInput } from '@ionic/vue'; import { search } from 'ionicons/icons'; -import { ref } from 'vue'; +import { ref, nextTick } from 'vue'; const props = defineProps<{ modelValue?: string; placeholder?: Translatable; + asPopover?: boolean; }>(); const inputRef = ref(); +const showPopover = ref(false); const emits = defineEmits<{ (e: 'change', value: string): void; @@ -48,6 +82,12 @@ defineExpose({ selectText, }); +async function openPopover(): Promise { + showPopover.value = true; + await nextTick(); + await inputRef.value.$el.setFocus(); +} + function setFocus(): void { setTimeout(() => { if (inputRef.value && inputRef.value.$el) { @@ -99,4 +139,17 @@ function onChange(value: any): void { color: var(--parsec-color-light-secondary-light); } } + +.popover-container { + padding: 0.5rem 0; + display: flex; + flex-direction: column; + position: absolute; + width: 100%; + border: 1px solid var(--parsec-color-light-secondary-light); + background: var(--parsec-color-light-secondary-white); + border-radius: var(--parsec-radius-8); + margin-top: 0.5rem; + z-index: 12; +} diff --git a/src/views/HomePage.vue b/src/views/HomePage.vue index edcbbaf..bf08223 100644 --- a/src/views/HomePage.vue +++ b/src/views/HomePage.vue @@ -167,9 +167,11 @@ {{ $msTranslate('usage.components.inputs.msSearchInput.title') }} + {{ searchInputExample }}
{{ $msTranslate('usage.components.inputs.msPasswordInput.title') }} @@ -515,7 +517,7 @@ const inputExample = ref(''); const msInputRef = ref(); const textareaExample = ref(''); const passwordInputExample = ref(''); -const searchIInputExample = ref(''); +const searchInputExample = ref(''); const msReportTheme = ref(MsReportTheme.Info); const toastOffset = ref('0'); const toastManager = new ToastManager();