edvoyui-component-library-test-flight 0.0.51 → 0.0.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,109 @@
1
+ <template>
2
+
3
+ <div class="relative rounded-full size-12">
4
+ <div class="absolute top-0 right-0">
5
+ <div
6
+ ref="componentWrapper"
7
+ class="cursor-pointer group"
8
+ @click="expandInput"
9
+ >
10
+ <div class="relative max-w-80 z-[calc(infinity)]">
11
+ <div
12
+ :class="[
13
+ 'relative flex items-center py-1 duration-300 ease-linear bg-gray-100 border border-gray-200 rounded-full pe-1 group-focus-within:ring-2 ring-purple-200 group-focus-within:border-gray-300 transition-all delay-100',
14
+ isExpanded
15
+ ? 'group-focus-within:w-80 text-gray-300'
16
+ : 'size-[2.875rem] text-gray-500',
17
+ ]"
18
+ >
19
+ <SearchBigZoomIn
20
+ class="absolute text-current size-6 top-2.5 left-2.5 transition-colors duration-100"
21
+ />
22
+ <input
23
+ v-if="isExpanded"
24
+ v-model="searchQuery"
25
+ ref="input"
26
+ type="search"
27
+ placeholder="Search here..."
28
+ class="text-sm font-medium text-gray-900 bg-transparent w-80 ps-10 pe-2 focus:outline-none min-h-9"
29
+ autocomplete="off"
30
+ @input="handleSearch"
31
+ @blur="closeInput"
32
+ />
33
+ </div>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </template>
39
+
40
+ <script lang="ts" setup>
41
+ import { onBeforeUnmount, onMounted, ref, toRefs, watch } from "vue";
42
+ import SearchBigZoomIn from "../../assets/svg/SearchBigZoomIn.vue";
43
+
44
+ const props = defineProps({
45
+ modelValue: {
46
+ type: [String, Number],
47
+ default: "",
48
+ },
49
+ searchSync: {
50
+ type: Boolean,
51
+ default: false,
52
+ },
53
+ });
54
+ const { searchSync } = toRefs(props);
55
+ const emit = defineEmits(["update:modelValue"]);
56
+
57
+ const input = ref<HTMLInputElement>();
58
+ const isExpanded = ref(true);
59
+ const searchQuery = ref();
60
+ const componentWrapper = ref<HTMLElement | null>(null);
61
+
62
+ function expandInput() {
63
+ isExpanded.value = true;
64
+ input?.value?.focus();
65
+ }
66
+
67
+ function closeInput() {
68
+ if (!searchQuery.value) {
69
+ isExpanded.value = false;
70
+ }
71
+ }
72
+
73
+ function handleOutsideClick(event: MouseEvent) {
74
+ if (
75
+ componentWrapper.value &&
76
+ !componentWrapper.value.contains(event.target as Node)
77
+ ) {
78
+ closeInput();
79
+ }
80
+ }
81
+
82
+ watch(searchSync, (newVal) => {
83
+ if (!newVal) {
84
+ closeInput();
85
+ }
86
+ }, {immediate: true, deep:true});
87
+
88
+ onMounted(() => {
89
+ document.addEventListener("click", handleOutsideClick);
90
+ if (searchQuery.value) {
91
+ searchQuery.value?.focus();
92
+ }
93
+ });
94
+
95
+ onBeforeUnmount(() => {
96
+ document.removeEventListener("click", handleOutsideClick);
97
+ });
98
+
99
+ function handleSearch(event: Event) {
100
+ const newValue = (event?.target as HTMLInputElement)?.value;
101
+ if (newValue !== undefined) {
102
+ emit("update:modelValue", newValue);
103
+ }
104
+ }
105
+ </script>
106
+
107
+ <style scoped>
108
+ /* Add custom styles here */
109
+ </style>
@@ -0,0 +1,90 @@
1
+ <template>
2
+ <div class="relative rounded-full size-12">
3
+ <span class="text-[0.625rem] absolute -top-4 left-0 space-x-4">
4
+ <span>{{ "searchSync:" + searchSync}}</span>
5
+ <span>{{ "isExpanded:" + isExpanded }}</span>
6
+ </span>
7
+ <div class="absolute top-0 right-0">
8
+ <div
9
+ ref="componentWrapper"
10
+ class="cursor-pointer group"
11
+ @click="expandInput"
12
+ >
13
+ <div class="relative max-w-80 z-[calc(infinity)]">
14
+ <div
15
+ :class="[
16
+ 'relative flex items-center py-1 duration-300 ease-linear bg-gray-100 border border-gray-200 rounded-full pe-1 group-focus-within:ring-2 ring-purple-200 group-focus-within:border-gray-300 transition-all delay-100',
17
+ isExpanded
18
+ ? 'group-focus-within:w-80 text-gray-300'
19
+ : 'size-[2.875rem] text-gray-500',
20
+ ]"
21
+ >
22
+ <SearchBigZoomIn
23
+ class="absolute text-current size-6 top-2.5 left-2.5 transition-colors duration-100"
24
+ />
25
+ <input
26
+ v-if="isExpanded"
27
+ v-model="searchQuery"
28
+ ref="input"
29
+ type="search"
30
+ placeholder="Search here..."
31
+ class="text-sm font-medium text-gray-900 bg-transparent w-80 ps-10 pe-2 focus:outline-none min-h-9"
32
+ autocomplete="off"
33
+ @input="handleSearch"
34
+ @blur="handleSearch"
35
+ />
36
+ </div>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ </div>
41
+ </template>
42
+
43
+ <script lang="ts" setup>
44
+ import { ref, toRefs, watch } from "vue";
45
+ import SearchBigZoomIn from "../../assets/svg/SearchBigZoomIn.vue";
46
+
47
+ const props = defineProps({
48
+ modelValue: {
49
+ type: [String, Number],
50
+ default: "",
51
+ },
52
+ searchSync: {
53
+ type: Boolean,
54
+ default: true,
55
+ },
56
+ });
57
+ const { searchSync } = toRefs(props);
58
+ const emit = defineEmits(["update:modelValue", "update:searchSync"]);
59
+
60
+ const input = ref<HTMLInputElement>();
61
+ const isExpanded = ref(true);
62
+ const searchQuery = ref(null);
63
+ const componentWrapper = ref<HTMLElement | null>(null);
64
+
65
+ function handleSearch(event: Event) {
66
+ const newValue = (event?.target as HTMLInputElement)?.value;
67
+ if (newValue !== undefined) {
68
+ emit("update:modelValue", newValue);
69
+ }
70
+ }
71
+
72
+ function expandInput() {
73
+ isExpanded.value = true;
74
+ input?.value?.focus();
75
+ emit("update:searchSync", true);
76
+ }
77
+
78
+ watch(
79
+ searchSync,
80
+ (newVal) => {
81
+ isExpanded.value = newVal;
82
+ emit("update:searchSync", newVal);
83
+ },
84
+ { immediate: true, deep: true }
85
+ );
86
+ </script>
87
+
88
+ <style scoped>
89
+ /* Add custom styles here */
90
+ </style>