|
5 | 5 | >
|
6 | 6 | <slot name="trigger"></slot>
|
7 | 7 | </div>
|
8 |
| - <div ref="modalEl" tabindex="-1" aria-hidden="true" class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-[calc(100%-1rem)] max-h-full"> |
9 |
| - <div v-bind="$attrs" class="relative p-4 max-w-2xl max-h-full" :class="$attrs.class?.includes('w-') ? '' : 'w-full'"> |
10 |
| - <!-- Modal content --> |
11 |
| - <div class="relative bg-white rounded-lg shadow-sm dark:bg-gray-700"> |
12 |
| - <!-- Modal header --> |
13 |
| - <div |
14 |
| - v-if="header" |
15 |
| - class="flex items-center justify-between p-4 md:p-5 border-b rounded-t dark:border-gray-600 border-gray-200" |
16 |
| - > |
17 |
| - <h3 class="text-xl font-semibold text-gray-900 dark:text-white"> |
18 |
| - {{ header }} |
19 |
| - </h3> |
20 |
| - <button |
21 |
| - v-if="headerCloseButton" |
22 |
| - type="button" |
23 |
| - class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white" |
24 |
| - @click="modal?.hide()" |
| 8 | + <Teleport to="body"> |
| 9 | + <div ref="modalEl" tabindex="-1" aria-hidden="true" class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-[calc(100%-1rem)] max-h-full"> |
| 10 | + <div v-bind="$attrs" class="relative p-4 max-w-2xl max-h-full" :class="$attrs.class?.includes('w-') ? '' : 'w-full'"> |
| 11 | + <!-- Modal content --> |
| 12 | + <div class="relative bg-white rounded-lg shadow-sm dark:bg-gray-700"> |
| 13 | + <!-- Modal header --> |
| 14 | + <div |
| 15 | + v-if="header" |
| 16 | + class="flex items-center justify-between p-4 md:p-5 border-b rounded-t dark:border-gray-600 border-gray-200" |
25 | 17 | >
|
26 |
| - <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14"> |
27 |
| - <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"/> |
28 |
| - </svg> |
29 |
| - <span class="sr-only">Close modal</span> |
30 |
| - </button> |
31 |
| - </div> |
32 |
| - <!-- Modal body --> |
33 |
| - <div class="p-4 md:p-5 space-y-4 text-gray-700 dark:text-gray-400"> |
34 |
| - <slot></slot> |
35 |
| - </div> |
36 |
| - <!-- Modal footer --> |
37 |
| - <div |
38 |
| - v-if="buttons.length" |
39 |
| - class="flex items-center p-4 md:p-5 border-t border-gray-200 rounded-b dark:border-gray-600" |
40 |
| - > |
41 |
| - <Button |
42 |
| - v-for="(button, buttonIndex) in buttons" |
43 |
| - :key="buttonIndex" |
44 |
| - v-bind="button.options" |
45 |
| - :class="{ 'ms-3': buttonIndex > 0 }" |
46 |
| - @click="button.onclick(modal)" |
| 18 | + <h3 class="text-xl font-semibold text-gray-900 dark:text-white"> |
| 19 | + {{ header }} |
| 20 | + </h3> |
| 21 | + <button |
| 22 | + v-if="headerCloseButton" |
| 23 | + type="button" |
| 24 | + class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white" |
| 25 | + @click="modal?.hide()" |
| 26 | + > |
| 27 | + <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14"> |
| 28 | + <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"/> |
| 29 | + </svg> |
| 30 | + <span class="sr-only">Close modal</span> |
| 31 | + </button> |
| 32 | + </div> |
| 33 | + <!-- Modal body --> |
| 34 | + <div class="p-4 md:p-5 space-y-4 text-gray-700 dark:text-gray-400"> |
| 35 | + <slot></slot> |
| 36 | + </div> |
| 37 | + <!-- Modal footer --> |
| 38 | + <div |
| 39 | + v-if="buttons.length" |
| 40 | + class="flex items-center p-4 md:p-5 border-t border-gray-200 rounded-b dark:border-gray-600" |
47 | 41 | >
|
48 |
| - {{ button.label }} |
49 |
| - </Button> |
| 42 | + <Button |
| 43 | + v-for="(button, buttonIndex) in buttons" |
| 44 | + :key="buttonIndex" |
| 45 | + v-bind="button.options" |
| 46 | + :class="{ 'ms-3': buttonIndex > 0 }" |
| 47 | + @click="button.onclick(modal)" |
| 48 | + > |
| 49 | + {{ button.label }} |
| 50 | + </Button> |
| 51 | + </div> |
50 | 52 | </div>
|
51 | 53 | </div>
|
52 | 54 | </div>
|
53 |
| - </div> |
| 55 | + </Teleport> |
54 | 56 | </template>
|
55 | 57 |
|
56 | 58 | <script setup lang="ts">
|
|
0 commit comments