edvoyui-component-library-test-flight 0.0.107 → 0.0.109

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.
Files changed (106) hide show
  1. package/dist/EUIButton.vue.d.ts +5 -0
  2. package/dist/EUIButton.vue.d.ts.map +1 -0
  3. package/dist/accordion/EUIAccordion.vue.d.ts +2 -2
  4. package/dist/accordion/EUIAccordion.vue.d.ts.map +1 -1
  5. package/dist/alerts/EUIAlerts.vue.d.ts +4 -0
  6. package/dist/alerts/EUIAlerts.vue.d.ts.map +1 -0
  7. package/dist/avatar/EUIAvatar.vue.d.ts +2 -2
  8. package/dist/avatar/EUIAvatar.vue.d.ts.map +1 -1
  9. package/dist/breadcrumb/EUIBreadcrumb.vue.d.ts +2 -2
  10. package/dist/breadcrumb/EUIBreadcrumb.vue.d.ts.map +1 -1
  11. package/dist/checkbox/EUICheckbox.vue.d.ts +3 -3
  12. package/dist/checkbox/EUICheckbox.vue.d.ts.map +1 -1
  13. package/dist/datepicker/EUIDatepicker.vue.d.ts +3 -3
  14. package/dist/datepicker/EUIDatepicker.vue.d.ts.map +1 -1
  15. package/dist/dropdown/EUIMultiDropdown.vue.d.ts +2 -2
  16. package/dist/dropdown/EUIMultiDropdown.vue.d.ts.map +1 -1
  17. package/dist/errorMessage/EUIErrorMessage.vue.d.ts +2 -2
  18. package/dist/errorMessage/EUIErrorMessage.vue.d.ts.map +1 -1
  19. package/dist/input/EUIInput.vue.d.ts +2 -2
  20. package/dist/input/EUIInput.vue.d.ts.map +1 -1
  21. package/dist/library-vue-ts.cjs.js +31 -31
  22. package/dist/library-vue-ts.css +1 -1
  23. package/dist/library-vue-ts.es.js +6147 -5834
  24. package/dist/library-vue-ts.umd.js +32 -32
  25. package/dist/loader/EUICircleLoader.vue.d.ts +1 -1
  26. package/dist/loader/EUICircleLoader.vue.d.ts.map +1 -1
  27. package/dist/loader/EUICubeLoader.vue.d.ts +1 -1
  28. package/dist/loader/EUICubeLoader.vue.d.ts.map +1 -1
  29. package/dist/loader/EUILoader.vue.d.ts +2 -2
  30. package/dist/loader/EUILoader.vue.d.ts.map +1 -1
  31. package/dist/loader/EUISquareLoader.vue.d.ts +1 -1
  32. package/dist/loader/EUISquareLoader.vue.d.ts.map +1 -1
  33. package/dist/modal/EUIModal.vue.d.ts +2 -2
  34. package/dist/modal/EUIModal.vue.d.ts.map +1 -1
  35. package/dist/pillSelect/EUIPillSelect.vue.d.ts +2 -2
  36. package/dist/pillSelect/EUIPillSelect.vue.d.ts.map +1 -1
  37. package/dist/popover/EUIPopover.vue.d.ts +2 -2
  38. package/dist/popover/EUIPopover.vue.d.ts.map +1 -1
  39. package/dist/radio/EUIRadio.vue.d.ts +2 -2
  40. package/dist/radio/EUIRadio.vue.d.ts.map +1 -1
  41. package/dist/searchInput/EUISearch.vue.d.ts +2 -2
  42. package/dist/searchInput/EUISearch.vue.d.ts.map +1 -1
  43. package/dist/searchexpand/EUISearchExpand.vue.d.ts +2 -2
  44. package/dist/searchexpand/EUISearchExpand.vue.d.ts.map +1 -1
  45. package/dist/searchexpand/EUISearchToggle.vue.d.ts +2 -2
  46. package/dist/searchexpand/EUISearchToggle.vue.d.ts.map +1 -1
  47. package/dist/select/EUISelect.vue.d.ts +3 -3
  48. package/dist/select/EUISelect.vue.d.ts.map +1 -1
  49. package/dist/selectSearch/EUISelectSearch.vue.d.ts +4 -0
  50. package/dist/selectSearch/EUISelectSearch.vue.d.ts.map +1 -0
  51. package/dist/slideover/EUISlideover.vue.d.ts +2 -2
  52. package/dist/slideover/EUISlideover.vue.d.ts.map +1 -1
  53. package/dist/stepperTimeline/EUIStepperHorizontal.vue.d.ts +2 -2
  54. package/dist/stepperTimeline/EUIStepperHorizontal.vue.d.ts.map +1 -1
  55. package/dist/stepperTimeline/EUIStepperTimeline.vue.d.ts +2 -2
  56. package/dist/stepperTimeline/EUIStepperTimeline.vue.d.ts.map +1 -1
  57. package/dist/stepperTimeline/EUIStepperVertical.vue.d.ts +2 -2
  58. package/dist/stepperTimeline/EUIStepperVertical.vue.d.ts.map +1 -1
  59. package/dist/table/EUIDashboardTable.vue.d.ts +2 -2
  60. package/dist/table/EUIDashboardTable.vue.d.ts.map +1 -1
  61. package/dist/table/EUIPageLimit.vue.d.ts +2 -2
  62. package/dist/table/EUIPageLimit.vue.d.ts.map +1 -1
  63. package/dist/table/EUIPagination.vue.d.ts +2 -2
  64. package/dist/table/EUIPagination.vue.d.ts.map +1 -1
  65. package/dist/table/EUIStudentPagination.vue.d.ts +2 -2
  66. package/dist/table/EUIStudentPagination.vue.d.ts.map +1 -1
  67. package/dist/table/EUITable.vue.d.ts +2 -2
  68. package/dist/table/EUITable.vue.d.ts.map +1 -1
  69. package/dist/table/EUITableCheckbox.vue.d.ts +3 -3
  70. package/dist/table/EUITableCheckbox.vue.d.ts.map +1 -1
  71. package/dist/table/GrowthTable.vue.d.ts +2 -2
  72. package/dist/table/GrowthTable.vue.d.ts.map +1 -1
  73. package/dist/table/UCheckbox.vue.d.ts +2 -2
  74. package/dist/table/UCheckbox.vue.d.ts.map +1 -1
  75. package/dist/table/UTable.vue.d.ts +2 -2
  76. package/dist/table/UTable.vue.d.ts.map +1 -1
  77. package/dist/tabs/EUITabs.vue.d.ts +2 -2
  78. package/dist/tabs/EUITabs.vue.d.ts.map +1 -1
  79. package/dist/tag/EUITag.vue.d.ts +2 -2
  80. package/dist/tag/EUITag.vue.d.ts.map +1 -1
  81. package/dist/telephone/EUITelephone.vue.d.ts +3 -3
  82. package/dist/telephone/EUITelephone.vue.d.ts.map +1 -1
  83. package/dist/textArea/EUITextArea.vue.d.ts +2 -2
  84. package/dist/textArea/EUITextArea.vue.d.ts.map +1 -1
  85. package/dist/timeLine/EUITimeLine.vue.d.ts +2 -2
  86. package/dist/timeLine/EUITimeLine.vue.d.ts.map +1 -1
  87. package/dist/timeLine/EUITimeLineItem.vue.d.ts +2 -2
  88. package/dist/timeLine/EUITimeLineItem.vue.d.ts.map +1 -1
  89. package/dist/toggle/EUIToggle.vue.d.ts +2 -2
  90. package/dist/toggle/EUIToggle.vue.d.ts.map +1 -1
  91. package/dist/tooltip/EUITooltip.vue.d.ts +2 -2
  92. package/dist/tooltip/EUITooltip.vue.d.ts.map +1 -1
  93. package/package.json +1 -1
  94. package/src/components/HelloWorld.vue +309 -166
  95. package/src/components/alerts/EUIAlerts.stories.ts +217 -0
  96. package/src/components/alerts/EUIAlerts.vue +194 -0
  97. package/src/components/index.ts +1 -0
  98. package/src/components/searchexpand/EUISearchExpand.vue +47 -8
  99. package/src/components/select/EUISelect.vue +54 -19
  100. package/src/components/tabs/EUITabs.vue +6 -0
  101. package/dist/EUISelectSearch.vue.d.ts +0 -4
  102. package/dist/EUISelectSearch.vue.d.ts.map +0 -1
  103. package/dist/button/EUIButton.vue.d.ts +0 -5
  104. package/dist/button/EUIButton.vue.d.ts.map +0 -1
  105. /package/src/components/checkbox/{EUICheckbox.stories.ts → EUIcheckbox.stories.ts} +0 -0
  106. /package/src/components/modal/{EUIModal.stories.ts → EUImodal.stories.ts} +0 -0
@@ -0,0 +1,217 @@
1
+ import type { Meta, StoryObj } from "@storybook/vue3";
2
+ import EUIAlerts from "./EUIAlerts.vue"; // Adjust the path if necessary
3
+ import { CalendarDaysIcon } from "@heroicons/vue/24/outline";
4
+
5
+ const meta = {
6
+ title: "Components/Alerts",
7
+ component: EUIAlerts,
8
+ tags: ["autodocs"],
9
+ argTypes: {
10
+ ...{
11
+ showAlert: {
12
+ control: "boolean",
13
+ description: "Controls the visibility of the alert.",
14
+ defaultValue: true,
15
+ },
16
+ alertType: {
17
+ control: {
18
+ type: "select",
19
+ options: ["Default", "Warning", "Success", "Error"],
20
+ },
21
+ description:
22
+ 'Determines the style and icon of the alert. Options are "Default", "Warning", "Success", and "Error".',
23
+ },
24
+ heading: {
25
+ control: "text",
26
+ description: "The title text displayed in the alert header.",
27
+ },
28
+ textMessage: {
29
+ control: "text",
30
+ description:
31
+ "Additional information about the alert. This text appears below the title.",
32
+ },
33
+ alertIcon: {
34
+ control: "text",
35
+ description:
36
+ "An optional custom icon to display. This can be a Vue component, a string, or a function.",
37
+ },
38
+ closeIcon: {
39
+ control: "boolean",
40
+ description:
41
+ "If set to true, shows a close icon to allow dismissing the alert.",
42
+ },
43
+ actionItems: {
44
+ control: "boolean",
45
+ description:
46
+ 'If set to true, displays action buttons (e.g., "View status" and "Dismiss") within the alert.',
47
+ },
48
+ "update:showAlert": {
49
+ action: "update:showAlert",
50
+ description: "Emitted to update the visibility of the alert.",
51
+ },
52
+ alertAction: {
53
+ action: "alertAction",
54
+ description: "Emitted when the action button is clicked.",
55
+ },
56
+ alertDismiss: {
57
+ action: "alertDismiss",
58
+ description: "Emitted when the alert is dismissed.",
59
+ },
60
+ },
61
+ },
62
+ parameters: {
63
+ docs: {
64
+ description: {
65
+ component:
66
+ "An alert component that displays messages with various styles (Default, Warning, Success, Error). It supports custom titles, descriptions, icons, and optional action buttons.",
67
+ },
68
+ },
69
+ },
70
+ } satisfies Meta<typeof EUIAlerts>;
71
+
72
+ export default meta;
73
+ type Story = StoryObj<typeof meta>;
74
+
75
+ // Default button story with default slot content
76
+ export const Default: Story = {
77
+ argTypes: {
78
+ alertType: {
79
+ control: "select",
80
+ options: ["Default", "Warning", "Success", "Error"],
81
+ },
82
+ alertIcon: {
83
+ control: "text",
84
+ },
85
+ },
86
+ args: {
87
+ alertType: "Default",
88
+ showAlert: true,
89
+ heading: "Default Alert",
90
+ textMessage: "This is a default alert message.",
91
+ },
92
+ render: (args) => ({
93
+ components: { EUIAlerts },
94
+ setup() {
95
+ return { args };
96
+ },
97
+ template: `<EUIAlerts v-bind="args"></EUIAlerts>`,
98
+ }),
99
+ };
100
+
101
+ export const onlyTitle: Story = {
102
+ args: {
103
+ alertType: "Success",
104
+ heading: "Your account activated",
105
+ },
106
+ render: (args) => ({
107
+ components: { EUIAlerts },
108
+ setup() {
109
+ return { args };
110
+ },
111
+ template: `<EUIAlerts v-bind="args"></EUIAlerts>`,
112
+ }),
113
+ };
114
+
115
+ export const UseCustomIcon: Story = {
116
+ args: {
117
+ alertType: "Success",
118
+ heading: "Send Icon here",
119
+ alertIcon: CalendarDaysIcon,
120
+ },
121
+ render: (args) => ({
122
+ components: { EUIAlerts, CalendarDaysIcon },
123
+ setup() {
124
+ return { args };
125
+ },
126
+ template: `<EUIAlerts v-bind="args"></EUIAlerts>`,
127
+ }),
128
+ parameters: {
129
+ docs: {
130
+ source: {
131
+ code: `<template>
132
+ <EUIAlerts
133
+ alertType="Success"
134
+ heading="Send Icon here"
135
+ :alertIcon="CalendarDaysIcon"
136
+ >
137
+ </EUIAlerts>
138
+ </template>`,
139
+ },
140
+ },
141
+ },
142
+ };
143
+
144
+ export const EnableClose: Story = {
145
+ args: {
146
+ alertType: "Default",
147
+ heading: "Close Icon Boolean enabled",
148
+ closeIcon: true,
149
+ },
150
+ render: (args) => ({
151
+ components: { EUIAlerts },
152
+ setup() {
153
+ return { args };
154
+ },
155
+ template: `<EUIAlerts v-bind="args"></EUIAlerts>`,
156
+ }),
157
+ };
158
+
159
+ export const UseSlots: Story = {
160
+ args: {
161
+ alertType: "Warning",
162
+ alertIcon: CalendarDaysIcon,
163
+ },
164
+ render: (args) => ({
165
+ components: { EUIAlerts },
166
+ setup() {
167
+ return { args };
168
+ },
169
+ template: `<EUIAlerts v-bind="args">
170
+ <template #title> Custom Header here</template>
171
+ <template #content><p class="text-sm font-normal"> Custom message here Are you sure you want to deactivate your account?.</p></template>
172
+ <template #actionButtons>
173
+ <div class="mt-4">
174
+ <button type="button"
175
+ class="rounded-md px-3 py-1.5 text-sm font-medium bg-black text-white focus:outline-none focus:ring-2 focus:ring-offset-2"
176
+ >
177
+ View status
178
+ </button>
179
+ <button
180
+ type="button"
181
+ class="ml-3 rounded-md px-3 py-1.5 bg-white text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2"
182
+ >
183
+ Dismiss
184
+ </button>
185
+ </div>
186
+ </template>
187
+ </EUIAlerts>`,
188
+ }),
189
+ parameters: {
190
+ docs: {
191
+ source: {
192
+ code: `<template>
193
+ <EUIAlerts>
194
+ <template #icon> <CalendarDaysIcon class="text-current size-5" aria-hidden="true" /></template>
195
+ <template #title> Custom Header here</template>
196
+ <template #content><p class="text-sm font-normal"> Custom message here Are you sure you want to deactivate your account?.</p></template>
197
+ <template #actionButtons>
198
+ <div>
199
+ <button type="button"
200
+ class="rounded-md px-3 py-1.5 text-sm font-medium bg-black text-white focus:outline-none focus:ring-2 focus:ring-offset-2"
201
+ >
202
+ View status
203
+ </button>
204
+ <button
205
+ type="button"
206
+ class="ml-3 rounded-md px-3 py-1.5 bg-white text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2"
207
+ >
208
+ Dismiss
209
+ </button>
210
+ </div>
211
+ </template>
212
+ </EUIAlerts>
213
+ </template>`,
214
+ },
215
+ },
216
+ },
217
+ };
@@ -0,0 +1,194 @@
1
+ <template>
2
+ <transition
3
+ enter-active-class="transition duration-300 ease-out transform"
4
+ enter-from-class="translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2"
5
+ enter-to-class="translate-y-0 opacity-100 sm:translate-x-0"
6
+ leave-active-class="transition duration-100 ease-in"
7
+ leave-from-class="opacity-100"
8
+ leave-to-class="opacity-0"
9
+ >
10
+ <div v-if="showAlert" :class="['p-4 rounded-md', alertsClass.bgColor]">
11
+ <div
12
+ :class="[closeIcon && !textMessage ? 'items-center pr-2 flex' : 'flex']"
13
+ >
14
+ <div class="shrink-0">
15
+ <slot name="icon">
16
+ <component
17
+ :is="alertIcon || alertsClass.leftIcon?.icon"
18
+ :class="['size-5', alertsClass.leftIcon?.color]"
19
+ aria-hidden="true"
20
+ />
21
+ </slot>
22
+ </div>
23
+ <div class="ml-3">
24
+ <h3 :class="['text-sm font-medium', alertsClass.titleColor]">
25
+ <slot name="title">{{ heading || "Alert Title" }}</slot>
26
+ </h3>
27
+
28
+ <slot name="content">
29
+ <div v-if="textMessage" :class="['mt-2 text-sm', alertsClass.textColor]">
30
+ {{ textMessage || "your description here..." }}
31
+ </div>
32
+ </slot>
33
+
34
+ <slot name="actionButtons">
35
+ <div v-if="actionItems" class="mt-4">
36
+ <div class="-mx-2 -my-1.5 flex">
37
+ <button
38
+ type="button"
39
+ :class="[
40
+ 'rounded-md px-3 py-1.5 text-sm font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2',
41
+ alertsClass.btnPrimary,
42
+ ]"
43
+ @click="onAction"
44
+ >
45
+ View status
46
+ </button>
47
+ <button
48
+ type="button"
49
+ :class="[
50
+ 'ml-3 rounded-md px-3 py-1.5 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2',
51
+ alertsClass.btnTertiary,
52
+ ]"
53
+ @click="onClose"
54
+ >
55
+ Dismiss
56
+ </button>
57
+ </div>
58
+ </div>
59
+ </slot>
60
+ </div>
61
+ <div class="pl-3 ml-auto">
62
+ <slot name="xclose">
63
+ <div v-if="closeIcon" class="-mx-1.5 -my-1.5 pt-1">
64
+ <button
65
+ type="button"
66
+ :class="[
67
+ 'inline-flex rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2',
68
+ alertsClass.btnClose,
69
+ ]"
70
+ @click="onClose()"
71
+ >
72
+ <span class="sr-only">Dismiss</span>
73
+ <XMarkIcon class="size-5" aria-hidden="true" />
74
+ </button>
75
+ </div>
76
+ </slot>
77
+ </div>
78
+ </div>
79
+ </div>
80
+ </transition>
81
+ </template>
82
+
83
+ <script setup lang="ts">
84
+ import { computed, toRefs, type PropType } from "vue";
85
+ import {
86
+ ExclamationTriangleIcon,
87
+ CheckCircleIcon,
88
+ XCircleIcon,
89
+ XMarkIcon,
90
+ } from "@heroicons/vue/24/solid";
91
+
92
+ const props = defineProps({
93
+ showAlert: {
94
+ type: Boolean,
95
+ default: true,
96
+ },
97
+ heading: {
98
+ type: String,
99
+ default: "",
100
+ },
101
+ textMessage: {
102
+ type: String,
103
+ default: "",
104
+ },
105
+ alertType: {
106
+ type: String as PropType<"Default" | "Warning" | "Success" | "Error">,
107
+ default: "Default",
108
+ },
109
+ alertIcon: {
110
+ type: [String, Object, Function],
111
+ default: "",
112
+ },
113
+ actionItems: Boolean,
114
+ closeIcon: Boolean,
115
+ });
116
+ const { showAlert } = toRefs(props);
117
+ const emits = defineEmits(["update:showAlert", "alertAction", "alertDismiss"]);
118
+ const onAction = () => {
119
+ emits("alertAction", true);
120
+ emits("update:showAlert", false);
121
+ };
122
+ const onClose = () => {
123
+ emits("alertDismiss", false);
124
+ emits("update:showAlert", false);
125
+ };
126
+
127
+ const alertsClass = computed(() => {
128
+ const iconClasses = {
129
+ Default: {
130
+ bgColor: "bg-blue-50",
131
+ leftIcon: {
132
+ icon: CheckCircleIcon,
133
+ color: "text-blue-400",
134
+ },
135
+ titleColor: "text-blue-800",
136
+ textColor: "text-blue-700",
137
+ btnPrimary:
138
+ "bg-blue-700 hover:bg-blue-800 focus:ring-blue-600 focus:ring-offset-blue-50",
139
+ btnTertiary:
140
+ "text-blue-500 bg-blue-50 hover:bg-blue-100 focus:ring-blue-600 focus:ring-offset-blue-50",
141
+ btnClose:
142
+ "bg-blue-50 text-blue-500 hover:bg-blue-100 focus:ring-blue-600 focus:ring-offset-blue-50",
143
+ },
144
+ Warning: {
145
+ bgColor: "bg-yellow-50",
146
+ leftIcon: {
147
+ icon: ExclamationTriangleIcon,
148
+ color: "text-yellow-400",
149
+ },
150
+ titleColor: "text-yellow-800",
151
+ textColor: "text-yellow-700",
152
+ btnPrimary:
153
+ "bg-yellow-700 hover:bg-yellow-800 focus:ring-yellow-600 focus:ring-offset-yellow-50",
154
+ btnTertiary:
155
+ "text-yellow-500 bg-yellow-50 hover:bg-yellow-100 focus:ring-yellow-600 focus:ring-offset-yellow-50",
156
+ btnClose:
157
+ "bg-yellow-50 text-yellow-500 hover:bg-yellow-100 focus:ring-yellow-600 focus:ring-offset-yellow-50",
158
+ },
159
+ Success: {
160
+ bgColor: "bg-green-50",
161
+ leftIcon: {
162
+ icon: CheckCircleIcon,
163
+ color: "text-green-400",
164
+ },
165
+ titleColor: "text-green-800",
166
+ textColor: "text-green-700",
167
+ btnPrimary:
168
+ "bg-green-700 hover:bg-green-800 focus:ring-green-600 focus:ring-offset-green-50",
169
+ btnTertiary:
170
+ "text-green-500 bg-green-50 hover:bg-green-100 focus:ring-green-600 focus:ring-offset-green-50",
171
+ btnClose:
172
+ "bg-green-50 text-green-500 hover:bg-green-100 focus:ring-green-600 focus:ring-offset-green-50",
173
+ },
174
+ Error: {
175
+ bgColor: "bg-red-50",
176
+ leftIcon: {
177
+ icon: XCircleIcon,
178
+ color: "text-red-400",
179
+ },
180
+ titleColor: "text-red-800",
181
+ textColor: "text-red-700",
182
+ btnPrimary:
183
+ "bg-red-700 hover:bg-red-800 focus:ring-red-600 focus:ring-offset-red-50",
184
+ btnTertiary:
185
+ "text-red-500 bg-red-50 hover:bg-red-100 focus:ring-red-600 focus:ring-offset-red-50",
186
+ btnClose:
187
+ "bg-red-50 text-red-500 hover:bg-red-100 focus:ring-red-600 focus:ring-offset-red-50",
188
+ },
189
+ };
190
+ return iconClasses[props.alertType] || "";
191
+ });
192
+ </script>
193
+
194
+ <style scoped></style>
@@ -50,3 +50,4 @@ export { default as EUISearchExpand } from "./searchexpand/EUISearchExpand.vue";
50
50
  export { default as EUISearchToggle } from "./searchexpand/EUISearchToggle.vue";
51
51
 
52
52
  export { default as EUIBreadcrumb } from "./breadcrumb/EUIBreadcrumb.vue";
53
+ export { default as EUIAlerts } from "./alerts/EUIAlerts.vue";
@@ -1,5 +1,4 @@
1
1
  <template>
2
-
3
2
  <div class="relative rounded-full size-10">
4
3
  <div class="absolute top-0 right-0">
5
4
  <div
@@ -19,11 +18,37 @@
19
18
  <SearchBigZoomIn
20
19
  class="absolute text-current size-6 top-2 left-2"
21
20
  />
21
+
22
+ <button
23
+ v-if="isExpanded"
24
+ :class="
25
+ inputValue ? ' absolute inset-y-0 right-3 ' : ' hidden '
26
+ "
27
+ @click="(searchQuery=''), emit('update:modelValue', '')"
28
+ >
29
+ <svg
30
+ xmlns="http://www.w3.org/2000/svg"
31
+ fill="none"
32
+ viewBox="0 0 24 24"
33
+ stroke-width="1.5"
34
+ stroke="currentColor"
35
+ class="size-5"
36
+ >
37
+ <!-- <path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
38
+ -->
39
+ <path
40
+ stroke-linecap="round"
41
+ stroke-linejoin="round"
42
+ d="M6 18 18 6M6 6l12 12"
43
+ />
44
+ </svg>
45
+ </button>
46
+
22
47
  <input
23
48
  v-if="isExpanded"
24
49
  v-model="searchQuery"
25
50
  ref="input"
26
- type="search"
51
+ :type="type === 'search' ? 'text' : type"
27
52
  placeholder="Search here..."
28
53
  class="h-10 text-sm font-medium text-gray-900 bg-transparent w-80 ps-10 pe-2 focus:outline-none"
29
54
  autocomplete="off"
@@ -38,7 +63,7 @@
38
63
  </template>
39
64
 
40
65
  <script lang="ts" setup>
41
- import { onBeforeUnmount, onMounted, ref, toRefs, watch } from "vue";
66
+ import { computed, onBeforeUnmount, onMounted, PropType, ref, toRefs, watch } from "vue";
42
67
  import SearchBigZoomIn from "../../assets/svg/SearchBigZoomIn.vue";
43
68
 
44
69
  const props = defineProps({
@@ -50,6 +75,12 @@ const props = defineProps({
50
75
  type: Boolean,
51
76
  default: false,
52
77
  },
78
+ type: {
79
+ type: String as PropType<
80
+ "text" | "number" | "email" | "password" | "search"
81
+ >,
82
+ default: "text",
83
+ },
53
84
  });
54
85
  const { searchSync } = toRefs(props);
55
86
  const emit = defineEmits(["update:modelValue"]);
@@ -64,6 +95,10 @@ function expandInput() {
64
95
  input?.value?.focus();
65
96
  }
66
97
 
98
+ const inputValue = computed(() => {
99
+ return props.modelValue === 0 ? true : !!props.modelValue;
100
+ });
101
+
67
102
  function closeInput() {
68
103
  if (!searchQuery.value) {
69
104
  isExpanded.value = false;
@@ -79,11 +114,15 @@ function handleOutsideClick(event: MouseEvent) {
79
114
  }
80
115
  }
81
116
 
82
- watch(searchSync, (newVal) => {
83
- if (!newVal) {
84
- closeInput();
85
- }
86
- }, {immediate: true, deep:true});
117
+ watch(
118
+ searchSync,
119
+ (newVal) => {
120
+ if (!newVal) {
121
+ closeInput();
122
+ }
123
+ },
124
+ { immediate: true, deep: true }
125
+ );
87
126
 
88
127
  onMounted(() => {
89
128
  document.addEventListener("click", handleOutsideClick);
@@ -45,7 +45,11 @@
45
45
  @open="open"
46
46
  >
47
47
  <!-- :clearable="isUseCustomSelect ? clearable : undefined" -->
48
- <template v-if="inputFilled" #header>
48
+ <!-- Allow parent to override header slot -->
49
+ <template v-if="$slots.header" #header>
50
+ <slot name="header"></slot>
51
+ </template>
52
+ <template v-if="inputFilled && !$slots.header" #header>
49
53
  <div
50
54
  :class="[
51
55
  inputValue
@@ -59,7 +63,14 @@
59
63
  {{ startCaseText(label) || "Select" }}
60
64
  </div>
61
65
  </template>
62
- <template #selected-option="item">
66
+
67
+
68
+ <!-- Allow parent to override selected-option slot -->
69
+ <template v-if="$slots['selected-option']" #selected-option="slotProps">
70
+ <slot name="selected-option" v-bind="slotProps as Record<string, any>"></slot>
71
+ </template>
72
+
73
+ <template v-if="!$slots['selected-option']" #selected-option="item">
63
74
  <div
64
75
  :class="
65
76
  isUseCustomSelect
@@ -77,10 +88,17 @@
77
88
  "
78
89
  :alt="item[fieldName]"
79
90
  />
80
- {{ isStartCaseText ? startCaseText(item[fieldName]) : item[fieldName] }}
91
+ {{
92
+ isStartCaseText ? startCaseText(item[fieldName]) : item[fieldName]
93
+ }}
81
94
  </div>
82
95
  </template>
83
- <template #option="item">
96
+
97
+ <!-- Allow parent to override option slot -->
98
+ <template v-if="$slots.option" #option="option">
99
+ <slot name="option" v-bind="option as Record<string, any>"></slot> <!-- Passing the 'option' data -->
100
+ </template>
101
+ <template v-else #option="item">
84
102
  <div class="flex items-center">
85
103
  <img
86
104
  v-if="(item as any).iconlink"
@@ -89,17 +107,30 @@
89
107
  :alt="item[fieldName]"
90
108
  />
91
109
 
92
- {{ isStartCaseText ? startCaseText(item[fieldName]) : item[fieldName] }}
110
+ {{
111
+ isStartCaseText ? startCaseText(item[fieldName]) : item[fieldName]
112
+ }}
93
113
  </div>
94
114
  </template>
95
- <template #spinner="{ loading: _loading }">
115
+
116
+ <!-- Allow parent to override spinner slot -->
117
+ <template v-if="$slots.spinner" #spinner="{ loading: _loading }">
118
+ <slot name="spinner" :loading="_loading || loading"></slot>
119
+ </template>
120
+ <template v-else #spinner="{ loading: _loading }">
96
121
  <div
97
122
  v-if="loading || _loading"
98
123
  style="border-left-color: rgba(107, 30, 190, 0.71)"
99
124
  class="vs__spinner"
100
125
  />
101
126
  </template>
102
- <template v-if="isSelectAll" #list-header>
127
+
128
+ <!-- Allow parent to override list-header slot -->
129
+ <template v-if="$slots['list-header']" #list-header>
130
+ <slot name="list-header"></slot>
131
+ </template>
132
+
133
+ <template v-else-if="isSelectAll" #list-header>
103
134
  <div v-if="items.length !== selected?.length">
104
135
  <button
105
136
  class="w-full px-6 py-2 text-sm font-medium text-gray-600 transition duration-75 hover:font-bold hover:text-gray-900 text-start"
@@ -109,7 +140,13 @@
109
140
  </button>
110
141
  </div>
111
142
  </template>
112
- <template #open-indicator="{ attributes }">
143
+
144
+ <!-- Allow parent to override open-indicator slot -->
145
+ <template v-if="$slots['open-indicator']" #open-indicator="attributes">
146
+ <slot name="open-indicator" v-bind="attributes as Record<string, any>"></slot>
147
+ </template>
148
+
149
+ <template v-else #open-indicator="{ attributes }">
113
150
  <span v-bind="attributes as Record<string, any>"
114
151
  ><ChevronBigDown class="text-current size-6"
115
152
  /></span>
@@ -280,10 +317,10 @@ const props = defineProps({
280
317
  type: Boolean,
281
318
  default: false,
282
319
  },
283
- fieldName:{
320
+ fieldName: {
284
321
  type: String,
285
- default: 'name',
286
- }
322
+ default: "name",
323
+ },
287
324
  });
288
325
 
289
326
  const {
@@ -298,7 +335,7 @@ const {
298
335
  isStartCaseText,
299
336
  isSelectAll,
300
337
  required,
301
- fieldName
338
+ fieldName,
302
339
  } = toRefs(props);
303
340
  const emit = defineEmits([
304
341
  "update:modelValue",
@@ -307,7 +344,8 @@ const emit = defineEmits([
307
344
  "deselected",
308
345
  "search",
309
346
  "tag",
310
- "selectedOption",'open'
347
+ "selectedOption",
348
+ "open",
311
349
  ]);
312
350
 
313
351
  const selectAll = (e: Event) => {
@@ -510,12 +548,9 @@ const selectedLimit = () => {
510
548
  }
511
549
  };
512
550
 
513
-
514
- const open=()=>{
515
- emit('open')
516
-
517
- }
518
-
551
+ const open = () => {
552
+ emit("open");
553
+ };
519
554
  </script>
520
555
  <style lang="scss">
521
556
  .scrollbar {