@raclettejs/workbench 0.1.32 → 0.1.33-canary.0

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.
@@ -1,140 +0,0 @@
1
- <template>
2
- <!-- Dialog overlay -->
3
- <div
4
- v-if="dialog"
5
- class="tw:fixed tw:inset-0 tw:flex tw:items-center tw:justify-center tw:bg-black/50 tw:z-50"
6
- >
7
- <!-- Dialog panel -->
8
- <div
9
- class="tw:bg-white tw:rounded-lg tw:shadow-xl tw:max-w-md tw:w-full tw:overflow-auto tw:h-[80%]"
10
- >
11
- <!-- Title bar -->
12
- <div
13
- class="tw:flex tw:justify-between tw:items-center tw:px-4 tw:py-3 tw:border-b tw:border-gray-200"
14
- >
15
- <span class="tw:text-lg tw:font-semibold">{{ title }}</span>
16
-
17
- <button
18
- @click="close"
19
- class="tw:text-gray-500 hover:tw:text-gray-700 tw:p-1 tw:rounded tw:hover:bg-gray-100"
20
- >
21
- <i class="mdi mdi-close tw:text-xl"></i>
22
- </button>
23
- </div>
24
-
25
- <!-- Content -->
26
- <div class="tw:px-4 tw:py-4">
27
- <!-- Alert -->
28
- <div
29
- :class="[
30
- 'tw:rounded tw:p-4 tw:mb-4',
31
- type === 'error' && 'tw:bg-red-50 tw:text-red-700',
32
- type === 'warning' && 'tw:bg-yellow-50 tw:text-yellow-700',
33
- type === 'info' && 'tw:bg-blue-50 tw:text-blue-700',
34
- type === 'success' && 'tw:bg-green-50 tw:text-green-700',
35
- ]"
36
- >
37
- <div class="tw:text-lg tw:font-medium tw:mb-2">
38
- {{ message }}
39
- </div>
40
-
41
- <div class="tw:text-sm">
42
- {{ $t("core.itemsCount") }}:
43
- <strong>{{ itemCount }}</strong>
44
- </div>
45
- </div>
46
-
47
- <!-- List -->
48
- <div v-if="showItems && items.length > 0" class="tw:mt-4">
49
- <div
50
- class="tw:text-xs tw:uppercase tw:font-semibold tw:text-gray-500 tw:mb-2"
51
- >
52
- {{ $t("core.selectedItems") }}
53
- </div>
54
-
55
- <ul class="tw:space-y-1">
56
- <li
57
- v-for="item in items"
58
- :key="item._id"
59
- class="tw:px-3 tw:py-2 tw:bg-gray-50 tw:rounded tw:text-sm tw:text-gray-700"
60
- >
61
- {{ getDisplayValue(item) }}
62
- </li>
63
- </ul>
64
- </div>
65
- </div>
66
-
67
- <!-- Actions -->
68
- <div
69
- class="tw:flex tw:justify-end tw:space-x-2 tw:px-4 tw:py-3 tw:border-t tw:border-gray-200"
70
- >
71
- <button
72
- @click="close"
73
- class="tw:px-4 tw:py-2 tw:text-sm tw:text-gray-700 hover:tw:bg-gray-100 tw:rounded"
74
- >
75
- {{ cancelText || $t("core.close") }}
76
- </button>
77
-
78
- <button
79
- v-if="showConfirm"
80
- @click="confirm"
81
- :class="[
82
- 'tw:px-4 tw:py-2 tw:text-sm tw:rounded tw:text-white',
83
- type === 'error' && 'tw:bg-red-600 hover:tw:bg-red-700',
84
- type === 'warning' && 'tw:bg-yellow-600 hover:tw:bg-yellow-700',
85
- type === 'info' && 'tw:bg-blue-600 hover:tw:bg-blue-700',
86
- type === 'success' && 'tw:bg-green-600 hover:tw:bg-green-700',
87
- ]"
88
- >
89
- {{ confirmText }}
90
- </button>
91
- </div>
92
- </div>
93
- </div>
94
- </template>
95
-
96
- <script setup lang="ts">
97
- import { computed } from "vue"
98
-
99
- interface Props {
100
- modelValue: boolean
101
- items: any[]
102
- title: string
103
- message: string
104
- type?: "info" | "success" | "warning" | "error"
105
- showItems?: boolean
106
- showConfirm?: boolean
107
- displayAttribute: string
108
- confirmText?: string
109
- cancelText?: string
110
- }
111
-
112
- const props = withDefaults(defineProps<Props>(), {
113
- type: "info",
114
- showItems: true,
115
- showConfirm: false,
116
- })
117
-
118
- const emit = defineEmits<{
119
- "update:modelValue": [value: boolean]
120
- confirm: []
121
- }>()
122
-
123
- const dialog = computed({
124
- get: () => props.modelValue,
125
- set: (value) => emit("update:modelValue", value),
126
- })
127
-
128
- const itemCount = computed(() => props.items.length)
129
-
130
- const close = () => {
131
- dialog.value = false
132
- }
133
- const getDisplayValue = (item: any) => {
134
- return item[props.displayAttribute] || item._id
135
- }
136
- const confirm = () => {
137
- emit("confirm")
138
- close()
139
- }
140
- </script>