mgv-backoffice 1.0.13 → 1.2.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.
- package/README.md +735 -70
- package/dist/index.d.ts +1 -27
- package/dist/{components → src/components}/BaseAlert.vue.d.ts +2 -2
- package/dist/src/components/BaseAppLayout.vue.d.ts +31 -0
- package/dist/{components → src/components}/BaseButton.vue.d.ts +5 -2
- package/dist/src/components/BaseCollapsibleSection.vue.d.ts +35 -0
- package/dist/src/components/BaseConfirmModal.vue.d.ts +23 -0
- package/dist/src/components/BaseEntityPickerModal.vue.d.ts +58 -0
- package/dist/{components → src/components}/BaseLogo.vue.d.ts +3 -3
- package/dist/{components → src/components}/BaseModal.vue.d.ts +4 -3
- package/dist/src/components/BaseModalShell.vue.d.ts +43 -0
- package/dist/src/components/BaseNotFoundPage.vue.d.ts +17 -0
- package/dist/src/components/BaseSidebar.vue.d.ts +46 -0
- package/dist/src/components/BaseTextInputModal.vue.d.ts +46 -0
- package/dist/{components → src/components}/BaseToast.vue.d.ts +14 -2
- package/dist/{components → src/components}/Pagination.vue.d.ts +0 -3
- package/dist/src/composables/useDebounce.d.ts +10 -0
- package/dist/src/composables/useEscapeKey.d.ts +6 -0
- package/dist/src/composables/useMobileSidebar.d.ts +6 -0
- package/dist/src/composables/useTheme.d.ts +19 -0
- package/dist/src/composables/useThemeClasses.d.ts +62 -0
- package/dist/src/composables/useToast.d.ts +19 -0
- package/dist/{enums → src/enums}/AlertEnum.d.ts +1 -1
- package/dist/{enums → src/enums}/BaseButtonSizeEnum.d.ts +1 -1
- package/dist/src/enums/BaseLogoEnum.d.ts +7 -0
- package/dist/src/index.d.ts +46 -0
- package/dist/src/types/entityPicker.d.ts +11 -0
- package/dist/src/types/sidebar.d.ts +22 -0
- package/dist/src/utils/httpColors.d.ts +19 -0
- package/dist/ui-lib.css +3 -0
- package/dist/ui-lib.js +1624 -1011
- package/dist/ui-lib.umd.cjs +1 -1
- package/package.json +14 -14
- package/src/components/BaseAlert.vue +2 -2
- package/src/components/BaseAppLayout.vue +65 -0
- package/src/components/BaseBreadcrumb.vue +2 -1
- package/src/components/BaseButton.vue +152 -132
- package/src/components/BaseCollapsibleSection.vue +107 -0
- package/src/components/BaseConfirmModal.vue +110 -0
- package/src/components/BaseEntityPickerModal.vue +330 -0
- package/src/components/BaseLogo.vue +5 -5
- package/src/components/BaseModal.vue +95 -75
- package/src/components/BaseModalShell.vue +115 -0
- package/src/components/BaseNotFoundPage.vue +51 -0
- package/src/components/BaseSidebar.vue +223 -0
- package/src/components/BaseTextInputModal.vue +144 -0
- package/src/components/BaseToast.vue +41 -20
- package/src/components/ColoredSquares.vue +2 -4
- package/src/components/Pagination.vue +137 -136
- package/src/components/TrendArrow.vue +1 -1
- package/src/composables/useDebounce.ts +32 -0
- package/src/composables/useEscapeKey.ts +15 -0
- package/src/composables/useMobileSidebar.ts +23 -0
- package/src/composables/useTheme.ts +69 -0
- package/src/composables/useThemeClasses.ts +133 -0
- package/src/composables/useToast.ts +56 -0
- package/src/enums/AlertEnum.ts +1 -1
- package/src/enums/BaseButtonSizeEnum.ts +1 -1
- package/src/enums/BaseLogoEnum.ts +4 -1
- package/src/index.ts +64 -36
- package/src/types/entityPicker.ts +11 -0
- package/src/types/sidebar.ts +24 -0
- package/src/utils/httpColors.ts +68 -0
- package/src/utils/util.ts +61 -53
- package/dist/enums/BaseLogoEnum.d.ts +0 -5
- package/dist/style.css +0 -1
- /package/dist/{components → src/components}/BaseBadge.vue.d.ts +0 -0
- /package/dist/{components → src/components}/BaseBreadcrumb.vue.d.ts +0 -0
- /package/dist/{components → src/components}/BaseLine.vue.d.ts +0 -0
- /package/dist/{components → src/components}/BaseRow.vue.d.ts +0 -0
- /package/dist/{components → src/components}/BaseSpinner.vue.d.ts +0 -0
- /package/dist/{components → src/components}/ColoredSquares.vue.d.ts +0 -0
- /package/dist/{components → src/components}/EarningsCard.vue.d.ts +0 -0
- /package/dist/{components → src/components}/EuroAmount.vue.d.ts +0 -0
- /package/dist/{components → src/components}/TrendArrow.vue.d.ts +0 -0
- /package/dist/{enums → src/enums}/BaseBadgeEnum.d.ts +0 -0
- /package/dist/{enums → src/enums}/BaseButtonEnum.d.ts +0 -0
- /package/dist/{enums → src/enums}/BaseModalEnum.d.ts +0 -0
- /package/dist/{enums → src/enums}/BaseToastEnum.d.ts +0 -0
- /package/dist/{enums → src/enums}/ColorsEnums.d.ts +0 -0
- /package/dist/{enums → src/enums}/LineEnum.d.ts +0 -0
- /package/dist/{enums → src/enums}/PositioningEnum.d.ts +0 -0
- /package/dist/{utils → src/utils}/util.d.ts +0 -0
|
@@ -1,132 +1,152 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<router-link v-if="to" :to="to">
|
|
3
|
-
<button :type="props.type" :class="computeCss()" :disabled="isDisable">
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
</
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
case BaseButtonEnum.
|
|
100
|
-
css =
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<router-link v-if="to" :to="to" custom v-slot="{ navigate }">
|
|
3
|
+
<button :type="props.type" :class="computeCss()" :disabled="isDisable || isLoading" @click="navigate">
|
|
4
|
+
<div v-if="isLoading" class="inline-flex items-center">
|
|
5
|
+
<svg aria-hidden="true" role="status" class="inline w-4 h-4 me-3 text-white animate-spin" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6
|
+
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="#E5E7EB"/>
|
|
7
|
+
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentColor"/>
|
|
8
|
+
</svg>
|
|
9
|
+
</div>
|
|
10
|
+
<span v-if="!iconLeft">{{ description }}</span>
|
|
11
|
+
<slot></slot>
|
|
12
|
+
<span v-if="iconLeft">{{ description }}</span>
|
|
13
|
+
</button>
|
|
14
|
+
</router-link>
|
|
15
|
+
<button v-else :type="props.type" :class="computeCss()" :disabled="isDisable || isLoading">
|
|
16
|
+
<div v-if="isLoading" class="inline-flex items-center">
|
|
17
|
+
<svg aria-hidden="true" role="status" class="inline w-4 h-4 me-3 text-white animate-spin" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
18
|
+
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="#E5E7EB"/>
|
|
19
|
+
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentColor"/>
|
|
20
|
+
</svg>
|
|
21
|
+
</div>
|
|
22
|
+
<span v-if="!iconLeft">{{ description }}</span>
|
|
23
|
+
<slot></slot>
|
|
24
|
+
<span v-if="iconLeft">{{ description }}</span>
|
|
25
|
+
</button>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script lang="ts" setup>
|
|
29
|
+
import { BaseButtonEnum } from "../enums/BaseButtonEnum";
|
|
30
|
+
import { BaseButtonSizeEnum } from "../enums/BaseButtonSizeEnum";
|
|
31
|
+
|
|
32
|
+
const props = defineProps({
|
|
33
|
+
description: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: true
|
|
36
|
+
},
|
|
37
|
+
color: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: false,
|
|
40
|
+
default: BaseButtonEnum.BLUE
|
|
41
|
+
},
|
|
42
|
+
to: {
|
|
43
|
+
type: String,
|
|
44
|
+
required: false
|
|
45
|
+
},
|
|
46
|
+
type: {
|
|
47
|
+
type: String as () => 'button' | 'submit' | 'reset',
|
|
48
|
+
required: false,
|
|
49
|
+
default: 'button'
|
|
50
|
+
},
|
|
51
|
+
icon: {
|
|
52
|
+
type: String,
|
|
53
|
+
required: false
|
|
54
|
+
},
|
|
55
|
+
iconSize: {
|
|
56
|
+
type: String,
|
|
57
|
+
required: false
|
|
58
|
+
},
|
|
59
|
+
iconLeft: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
required: false,
|
|
62
|
+
default: false
|
|
63
|
+
},
|
|
64
|
+
isRounded: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
required: false
|
|
67
|
+
},
|
|
68
|
+
isDisable: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
required: false
|
|
71
|
+
},
|
|
72
|
+
size: {
|
|
73
|
+
type: String,
|
|
74
|
+
required: false
|
|
75
|
+
},
|
|
76
|
+
isLoading: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
required: false
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
function computeCss() {
|
|
83
|
+
const isDisabled = props.isDisable || props.isLoading;
|
|
84
|
+
let commonCss = "inline-flex items-center";
|
|
85
|
+
let css;
|
|
86
|
+
switch (props.color) {
|
|
87
|
+
case BaseButtonEnum.BLUE: {
|
|
88
|
+
css = isDisabled
|
|
89
|
+
? 'text-white bg-blue-400 cursor-not-allowed'
|
|
90
|
+
: 'focus:outline-none text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300';
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
case BaseButtonEnum.WHITE: {
|
|
94
|
+
css = isDisabled
|
|
95
|
+
? 'text-gray-900 bg-gray-200 border border-gray-200 cursor-not-allowed'
|
|
96
|
+
: 'focus:outline-none text-gray-900 bg-white border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-200';
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
case BaseButtonEnum.DARK: {
|
|
100
|
+
css = isDisabled
|
|
101
|
+
? 'text-white bg-gray-400 cursor-not-allowed'
|
|
102
|
+
: 'focus:outline-none text-white bg-gray-800 hover:bg-gray-900 focus:ring-4 focus:ring-gray-300';
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
case BaseButtonEnum.GREEN: {
|
|
106
|
+
css = isDisabled
|
|
107
|
+
? 'text-white bg-green-400 cursor-not-allowed'
|
|
108
|
+
: 'focus:outline-none text-white bg-green-700 hover:bg-green-800 focus:ring-4 focus:ring-green-300';
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
case BaseButtonEnum.RED: {
|
|
112
|
+
css = isDisabled
|
|
113
|
+
? 'text-white bg-red-400 cursor-not-allowed'
|
|
114
|
+
: 'focus:outline-none text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300';
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
case BaseButtonEnum.YELLOW: {
|
|
118
|
+
css = isDisabled
|
|
119
|
+
? 'text-white bg-yellow-300 cursor-not-allowed'
|
|
120
|
+
: 'focus:outline-none text-white bg-yellow-400 hover:bg-yellow-500 focus:ring-4 focus:ring-yellow-300';
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
case BaseButtonEnum.PURPLE: {
|
|
124
|
+
css = isDisabled
|
|
125
|
+
? 'text-white bg-purple-400 cursor-not-allowed'
|
|
126
|
+
: 'focus:outline-none text-white bg-purple-700 hover:bg-purple-800 focus:ring-4 focus:ring-purple-300 px-5 py-2.5 mb-2';
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
default: {
|
|
130
|
+
css = isDisabled
|
|
131
|
+
? 'text-white bg-blue-400 cursor-not-allowed'
|
|
132
|
+
: 'focus:outline-none text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300';
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
let size = "px-5 py-2.5 mr-2 mb-2 text-sm";
|
|
138
|
+
switch (props.size) {
|
|
139
|
+
case BaseButtonSizeEnum.EXTRA_SMALL: { size = 'px-3 py-2 text-xs'; break; }
|
|
140
|
+
case BaseButtonSizeEnum.SMALL: { size = 'px-3 py-2 text-sm'; break; }
|
|
141
|
+
case BaseButtonSizeEnum.BASE: { size = 'px-5 py-2.5 text-sm'; break; }
|
|
142
|
+
case BaseButtonSizeEnum.LARGE: { size = 'px-5 py-3 text-base'; break; }
|
|
143
|
+
case BaseButtonSizeEnum.EXTRA_LARGE: { size = 'px-6 py-3.5 text-base'; break; }
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
let rounded = "rounded-lg";
|
|
147
|
+
if (props.isRounded) { rounded = "rounded-full"; }
|
|
148
|
+
|
|
149
|
+
let fontSize = "font-medium";
|
|
150
|
+
return commonCss + " " + size + " " + css + " " + fontSize + " " + rounded;
|
|
151
|
+
}
|
|
152
|
+
</script>
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!--
|
|
3
|
+
Collapsible section wrapper. Parent owns the `collapsed` state so
|
|
4
|
+
callers can persist it across edits or batch-collapse many sections
|
|
5
|
+
at once.
|
|
6
|
+
|
|
7
|
+
Slots:
|
|
8
|
+
• default — the section body (only rendered when expanded)
|
|
9
|
+
|
|
10
|
+
Props:
|
|
11
|
+
• title — heading text
|
|
12
|
+
• collapsed — current collapsed state
|
|
13
|
+
• badge — optional pill next to the heading (label or count)
|
|
14
|
+
• bodyClass — override classes for the body container. Defaults
|
|
15
|
+
to a theme-aware white/gray-800 surface.
|
|
16
|
+
|
|
17
|
+
Emits:
|
|
18
|
+
• toggle — fired when the user clicks the header. The parent
|
|
19
|
+
flips its own collapsed state in response.
|
|
20
|
+
-->
|
|
21
|
+
<section class="rounded-xl border overflow-hidden transition-colors" :class="t.cardAlt">
|
|
22
|
+
<button
|
|
23
|
+
type="button"
|
|
24
|
+
class="w-full flex items-center justify-between p-4 text-left transition-colors"
|
|
25
|
+
:class="headerClasses"
|
|
26
|
+
:aria-expanded="!collapsed"
|
|
27
|
+
@click="emit('toggle')"
|
|
28
|
+
>
|
|
29
|
+
<div class="flex items-center gap-3">
|
|
30
|
+
<h2 class="text-base font-semibold" :class="headingClasses">{{ title }}</h2>
|
|
31
|
+
<span
|
|
32
|
+
v-if="badge"
|
|
33
|
+
class="text-xs px-2 py-0.5 rounded-full"
|
|
34
|
+
:class="badgeClasses"
|
|
35
|
+
>
|
|
36
|
+
{{ badge }}
|
|
37
|
+
</span>
|
|
38
|
+
</div>
|
|
39
|
+
<svg
|
|
40
|
+
class="w-5 h-5 transition-transform"
|
|
41
|
+
:class="[collapsed ? '' : 'rotate-180', t.dimTextAlt]"
|
|
42
|
+
fill="none"
|
|
43
|
+
viewBox="0 0 24 24"
|
|
44
|
+
stroke="currentColor"
|
|
45
|
+
stroke-width="2"
|
|
46
|
+
aria-hidden="true"
|
|
47
|
+
>
|
|
48
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7" />
|
|
49
|
+
</svg>
|
|
50
|
+
</button>
|
|
51
|
+
<div
|
|
52
|
+
v-show="!collapsed"
|
|
53
|
+
class="p-6 border-t"
|
|
54
|
+
:class="[t.border, resolvedBodyClass]"
|
|
55
|
+
>
|
|
56
|
+
<slot />
|
|
57
|
+
</div>
|
|
58
|
+
</section>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script setup lang="ts">
|
|
62
|
+
import { computed } from 'vue'
|
|
63
|
+
import { useTheme } from '../composables/useTheme'
|
|
64
|
+
import { useThemeClasses } from '../composables/useThemeClasses'
|
|
65
|
+
|
|
66
|
+
interface Props {
|
|
67
|
+
title: string
|
|
68
|
+
collapsed: boolean
|
|
69
|
+
/**
|
|
70
|
+
* Optional pill next to the title. String so callers can pass either
|
|
71
|
+
* a label ('Active') or a count ('3'). Null/undefined hides the pill.
|
|
72
|
+
*/
|
|
73
|
+
badge?: string | null
|
|
74
|
+
/**
|
|
75
|
+
* Override the body container's background classes. Defaults to a
|
|
76
|
+
* theme-aware surface: bg-white in light, bg-gray-800 in dark.
|
|
77
|
+
*/
|
|
78
|
+
bodyClass?: string
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const props = defineProps<Props>()
|
|
82
|
+
const emit = defineEmits<{ toggle: [] }>()
|
|
83
|
+
|
|
84
|
+
const { isDark } = useTheme()
|
|
85
|
+
const t = useThemeClasses()
|
|
86
|
+
|
|
87
|
+
const headingClasses = computed(() =>
|
|
88
|
+
isDark.value ? 'text-gray-100' : 'text-gray-700',
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
const headerClasses = computed(() =>
|
|
92
|
+
isDark.value
|
|
93
|
+
? 'bg-gray-800/50 hover:bg-gray-800 border-gray-700'
|
|
94
|
+
: 'bg-gray-50 hover:bg-gray-100 border-gray-200',
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
const badgeClasses = computed(() =>
|
|
98
|
+
isDark.value
|
|
99
|
+
? 'bg-emerald-500/15 text-emerald-400'
|
|
100
|
+
: 'bg-emerald-50 text-emerald-700',
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
const resolvedBodyClass = computed(() => {
|
|
104
|
+
if (props.bodyClass !== undefined) return props.bodyClass
|
|
105
|
+
return isDark.value ? 'bg-gray-800' : 'bg-white'
|
|
106
|
+
})
|
|
107
|
+
</script>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<BaseModalShell
|
|
3
|
+
:title="title"
|
|
4
|
+
:manual-close="submitting"
|
|
5
|
+
@cancel="handleCancel"
|
|
6
|
+
>
|
|
7
|
+
<template #icon>
|
|
8
|
+
<div
|
|
9
|
+
class="flex-shrink-0 flex h-12 w-12 items-center justify-center rounded-full"
|
|
10
|
+
:class="[
|
|
11
|
+
variant === 'danger'
|
|
12
|
+
? isDark ? 'bg-red-900/30' : 'bg-red-50'
|
|
13
|
+
: isDark ? 'bg-amber-900/30' : 'bg-amber-50'
|
|
14
|
+
]"
|
|
15
|
+
>
|
|
16
|
+
<ExclamationTriangleIcon
|
|
17
|
+
class="h-6 w-6"
|
|
18
|
+
:class="variant === 'danger' ? 'text-red-600' : 'text-amber-600'"
|
|
19
|
+
aria-hidden="true"
|
|
20
|
+
/>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<p class="text-sm" :class="isDark ? 'text-gray-300' : 'text-gray-600'">
|
|
25
|
+
{{ message }}
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
<template #footer>
|
|
29
|
+
<button
|
|
30
|
+
type="button"
|
|
31
|
+
:disabled="submitting"
|
|
32
|
+
class="inline-flex items-center justify-center px-4 py-2 border rounded-md shadow-sm text-sm font-medium transition-colors duration-150"
|
|
33
|
+
:class="[
|
|
34
|
+
t.ghostButton,
|
|
35
|
+
submitting ? 'opacity-60 cursor-not-allowed' : 'cursor-pointer',
|
|
36
|
+
]"
|
|
37
|
+
@click="handleCancel"
|
|
38
|
+
>
|
|
39
|
+
{{ cancelText }}
|
|
40
|
+
</button>
|
|
41
|
+
|
|
42
|
+
<button
|
|
43
|
+
type="button"
|
|
44
|
+
:disabled="submitting"
|
|
45
|
+
class="inline-flex items-center justify-center gap-2 px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white transition-colors duration-150"
|
|
46
|
+
:class="[
|
|
47
|
+
variant === 'danger'
|
|
48
|
+
? submitting ? 'bg-red-400 cursor-not-allowed' : 'bg-red-600 hover:bg-red-700 cursor-pointer'
|
|
49
|
+
: submitting ? 'bg-emerald-400 cursor-not-allowed' : 'bg-emerald-600 hover:bg-emerald-700 cursor-pointer',
|
|
50
|
+
]"
|
|
51
|
+
@click="handleConfirm"
|
|
52
|
+
>
|
|
53
|
+
<svg
|
|
54
|
+
v-if="submitting"
|
|
55
|
+
class="w-4 h-4 animate-spin"
|
|
56
|
+
fill="none"
|
|
57
|
+
viewBox="0 0 24 24"
|
|
58
|
+
aria-hidden="true"
|
|
59
|
+
>
|
|
60
|
+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
|
61
|
+
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z" />
|
|
62
|
+
</svg>
|
|
63
|
+
{{ submitting ? submittingText : confirmText }}
|
|
64
|
+
</button>
|
|
65
|
+
</template>
|
|
66
|
+
</BaseModalShell>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script setup lang="ts">
|
|
70
|
+
import { ExclamationTriangleIcon } from '@heroicons/vue/24/outline'
|
|
71
|
+
import BaseModalShell from './BaseModalShell.vue'
|
|
72
|
+
import { useTheme } from '../composables/useTheme'
|
|
73
|
+
import { useThemeClasses } from '../composables/useThemeClasses'
|
|
74
|
+
|
|
75
|
+
interface Props {
|
|
76
|
+
title: string
|
|
77
|
+
message: string
|
|
78
|
+
confirmText?: string
|
|
79
|
+
cancelText?: string
|
|
80
|
+
submittingText?: string
|
|
81
|
+
variant?: 'danger' | 'warning'
|
|
82
|
+
submitting?: boolean
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
86
|
+
confirmText: "Yes, I'm sure",
|
|
87
|
+
cancelText: 'No, cancel',
|
|
88
|
+
submittingText: 'Working...',
|
|
89
|
+
variant: 'danger',
|
|
90
|
+
submitting: false,
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
const emit = defineEmits<{
|
|
94
|
+
confirm: []
|
|
95
|
+
cancel: []
|
|
96
|
+
}>()
|
|
97
|
+
|
|
98
|
+
const { isDark } = useTheme()
|
|
99
|
+
const t = useThemeClasses()
|
|
100
|
+
|
|
101
|
+
function handleConfirm() {
|
|
102
|
+
if (props.submitting) return
|
|
103
|
+
emit('confirm')
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function handleCancel() {
|
|
107
|
+
if (props.submitting) return
|
|
108
|
+
emit('cancel')
|
|
109
|
+
}
|
|
110
|
+
</script>
|