@primevue/mcp 4.5.5 → 5.0.0-rc.2
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/LICENSE.md +45 -21
- package/README.md +48 -250
- package/data/components.json +47269 -0
- package/data/llms/components/accordion.md +629 -0
- package/data/llms/components/animateonscroll.md +165 -0
- package/data/llms/components/autocomplete.md +995 -0
- package/data/llms/components/avatar.md +264 -0
- package/data/llms/components/badge.md +200 -0
- package/data/llms/components/blockui.md +99 -0
- package/data/llms/components/breadcrumb.md +269 -0
- package/data/llms/components/button.md +902 -0
- package/data/llms/components/card.md +209 -0
- package/data/llms/components/carousel.md +506 -0
- package/data/llms/components/cascadeselect.md +1207 -0
- package/data/llms/components/chart.md +1022 -0
- package/data/llms/components/checkbox.md +401 -0
- package/data/llms/components/chip.md +206 -0
- package/data/llms/components/colorpicker.md +213 -0
- package/data/llms/components/commandmenu.md +660 -0
- package/data/llms/components/compare.md +407 -0
- package/data/llms/components/confirmdialog.md +343 -0
- package/data/llms/components/confirmpopup.md +252 -0
- package/data/llms/components/contextmenu.md +522 -0
- package/data/llms/components/datatable.md +5266 -0
- package/data/llms/components/dataview.md +569 -0
- package/data/llms/components/datepicker.md +964 -0
- package/data/llms/components/deferredcontent.md +96 -0
- package/data/llms/components/dialog.md +702 -0
- package/data/llms/components/divider.md +152 -0
- package/data/llms/components/dock.md +488 -0
- package/data/llms/components/drawer.md +469 -0
- package/data/llms/components/dynamicdialog.md +214 -0
- package/data/llms/components/editor.md +205 -0
- package/data/llms/components/fieldset.md +253 -0
- package/data/llms/components/fileupload.md +459 -0
- package/data/llms/components/floatlabel.md +144 -0
- package/data/llms/components/fluid.md +104 -0
- package/data/llms/components/focustrap.md +59 -0
- package/data/llms/components/forms.md +344 -0
- package/data/llms/components/galleria.md +1119 -0
- package/data/llms/components/gallery.md +1003 -0
- package/data/llms/components/iconfield.md +283 -0
- package/data/llms/components/iftalabel.md +96 -0
- package/data/llms/components/image.md +179 -0
- package/data/llms/components/imagecompare.md +108 -0
- package/data/llms/components/inplace.md +183 -0
- package/data/llms/components/inputcolor.md +869 -0
- package/data/llms/components/inputgroup.md +419 -0
- package/data/llms/components/inputmask.md +345 -0
- package/data/llms/components/inputnumber.md +551 -0
- package/data/llms/components/inputotp.md +345 -0
- package/data/llms/components/inputpassword.md +738 -0
- package/data/llms/components/inputtags.md +432 -0
- package/data/llms/components/inputtext.md +569 -0
- package/data/llms/components/installation.md +1 -0
- package/data/llms/components/keyfilter.md +116 -0
- package/data/llms/components/knob.md +318 -0
- package/data/llms/components/label.md +151 -0
- package/data/llms/components/laravel.md +53 -0
- package/data/llms/components/listbox.md +636 -0
- package/data/llms/components/mask.md +203 -0
- package/data/llms/components/mcp.md +39 -0
- package/data/llms/components/megamenu.md +563 -0
- package/data/llms/components/menu.md +651 -0
- package/data/llms/components/menubar.md +446 -0
- package/data/llms/components/message.md +497 -0
- package/data/llms/components/metergroup.md +281 -0
- package/data/llms/components/multiselect.md +752 -0
- package/data/llms/components/orderlist.md +224 -0
- package/data/llms/components/organizationchart.md +418 -0
- package/data/llms/components/paginator.md +221 -0
- package/data/llms/components/panel.md +321 -0
- package/data/llms/components/panelmenu.md +703 -0
- package/data/llms/components/password.md +657 -0
- package/data/llms/components/picklist.md +286 -0
- package/data/llms/components/popover.md +145 -0
- package/data/llms/components/progressbar.md +242 -0
- package/data/llms/components/progressspinner.md +104 -0
- package/data/llms/components/radiobutton.md +427 -0
- package/data/llms/components/rating.md +312 -0
- package/data/llms/components/ripple.md +91 -0
- package/data/llms/components/scrollarea.md +700 -0
- package/data/llms/components/scrollpanel.md +131 -0
- package/data/llms/components/scrolltop.md +87 -0
- package/data/llms/components/select.md +1251 -0
- package/data/llms/components/selectbutton.md +268 -0
- package/data/llms/components/sidebar.md +2232 -0
- package/data/llms/components/skeleton.md +302 -0
- package/data/llms/components/slider.md +416 -0
- package/data/llms/components/speeddial.md +402 -0
- package/data/llms/components/splitbutton.md +840 -0
- package/data/llms/components/splitter.md +447 -0
- package/data/llms/components/stepper.md +551 -0
- package/data/llms/components/styleclass.md +226 -0
- package/data/llms/components/tabs.md +609 -0
- package/data/llms/components/tag.md +178 -0
- package/data/llms/components/terminal.md +123 -0
- package/data/llms/components/textarea.md +519 -0
- package/data/llms/components/tieredmenu.md +578 -0
- package/data/llms/components/timeline.md +494 -0
- package/data/llms/components/toast.md +472 -0
- package/data/llms/components/togglebutton.md +276 -0
- package/data/llms/components/toggleswitch.md +271 -0
- package/data/llms/components/toolbar.md +140 -0
- package/data/llms/components/tooltip.md +160 -0
- package/data/llms/components/tree.md +1076 -0
- package/data/llms/components/treeselect.md +660 -0
- package/data/llms/components/treetable.md +2493 -0
- package/data/llms/components/virtualscroller.md +265 -0
- package/data/llms/guides/autoimport.md +28 -0
- package/data/llms/guides/cdn.md +72 -0
- package/data/llms/guides/configuration.md +158 -0
- package/data/llms/guides/customicons.md +67 -0
- package/data/llms/guides/guides/accessibility.md +27 -0
- package/data/llms/guides/guides/animations.md +119 -0
- package/data/llms/guides/guides/rtl.md +7 -0
- package/data/llms/guides/icons.md +136 -0
- package/data/llms/guides/installation.md +3 -0
- package/data/llms/guides/laravel.md +66 -0
- package/data/llms/guides/llms.md +15 -0
- package/data/llms/guides/mcp.md +104 -0
- package/data/llms/guides/migration/v4.md +15 -0
- package/data/llms/guides/migration/v5.md +15 -0
- package/data/llms/guides/nuxt.md +141 -0
- package/data/llms/guides/passthrough.md +137 -0
- package/data/llms/guides/primeclt.md +43 -0
- package/data/llms/guides/tailwind.md +151 -0
- package/data/llms/guides/theming/styled.md +497 -0
- package/data/llms/guides/theming/unstyled.md +57 -0
- package/data/llms/guides/uikit.md +3 -0
- package/data/llms/guides/vite.md +90 -0
- package/data/llms/llms-full.txt +54465 -0
- package/data/llms/llms.txt +132 -0
- package/data/llms/pages/accessibility.md +27 -0
- package/data/llms/pages/animations.md +119 -0
- package/data/llms/pages/autoimport.md +28 -0
- package/data/llms/pages/cdn.md +72 -0
- package/data/llms/pages/configuration.md +158 -0
- package/data/llms/pages/contribution.md +31 -0
- package/data/llms/pages/customicons.md +67 -0
- package/data/llms/pages/designer.md +79 -0
- package/data/llms/pages/dynamicimports.md +7 -0
- package/data/llms/pages/forms.md +63 -0
- package/data/llms/pages/guides/accessibility.md +27 -0
- package/data/llms/pages/guides/animations.md +119 -0
- package/data/llms/pages/guides/rtl.md +7 -0
- package/data/llms/pages/icons.md +136 -0
- package/data/llms/pages/installation.md +3 -0
- package/data/llms/pages/introduction.md +23 -0
- package/data/llms/pages/laravel.md +66 -0
- package/data/llms/pages/llms.md +15 -0
- package/data/llms/pages/mcp.md +104 -0
- package/data/llms/pages/migration/v4.md +15 -0
- package/data/llms/pages/migration/v5.md +15 -0
- package/data/llms/pages/nuxt.md +141 -0
- package/data/llms/pages/passthrough.md +137 -0
- package/data/llms/pages/primeclt.md +43 -0
- package/data/llms/pages/rtl.md +7 -0
- package/data/llms/pages/setup.md +3 -0
- package/data/llms/pages/styled.md +497 -0
- package/data/llms/pages/tailwind.md +151 -0
- package/data/llms/pages/theming/styled.md +497 -0
- package/data/llms/pages/theming/unstyled.md +57 -0
- package/data/llms/pages/uikit.md +3 -0
- package/data/llms/pages/unstyled.md +57 -0
- package/data/llms/pages/v4.md +15 -0
- package/data/llms/pages/v5.md +15 -0
- package/data/llms/pages/vite.md +90 -0
- package/data/manifest.json +11117 -0
- package/data/mcp-data.json +55940 -0
- package/dist/index.d.ts +17 -1
- package/dist/index.js +66066 -72541
- package/package.json +10 -12
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
# ConfirmDialog
|
|
2
|
+
|
|
3
|
+
ConfirmDialog is backed by a service utilizing Observables to display confirmation windows easily that can be shared by multiple actions on the same component.
|
|
4
|
+
|
|
5
|
+
## Service
|
|
6
|
+
|
|
7
|
+
ConfirmDialog is controlled via the ConfirmationService that needs to be installed as an application plugin. The service is available with the useConfirm function for Composition API or using the $confirm property of the application for Options API.
|
|
8
|
+
|
|
9
|
+
## Basic
|
|
10
|
+
|
|
11
|
+
ConfirmDialog is defined using the ConfirmDialog component and an instance of ConfirmationService is required to display it by calling the require method.
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<template>
|
|
15
|
+
<Toast />
|
|
16
|
+
<ConfirmDialog></ConfirmDialog>
|
|
17
|
+
<div class="flex flex-wrap gap-2 justify-center">
|
|
18
|
+
<Button @click="confirm1()" variant="outlined">Save</Button>
|
|
19
|
+
<Button @click="confirm2()" severity="danger" variant="outlined">Delete</Button>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup>
|
|
24
|
+
import ExclamationTriangle from '@primeicons/vue/exclamation-triangle';
|
|
25
|
+
import InfoCircle from '@primeicons/vue/info-circle';
|
|
26
|
+
import { useConfirm } from "primevue/useconfirm";
|
|
27
|
+
import { useToast } from "primevue/usetoast";
|
|
28
|
+
|
|
29
|
+
const confirm = useConfirm();
|
|
30
|
+
const toast = useToast();
|
|
31
|
+
|
|
32
|
+
const confirm1 = () => {
|
|
33
|
+
confirm.require({
|
|
34
|
+
message: 'Are you sure that you want to proceed?',
|
|
35
|
+
header: 'Confirmation',
|
|
36
|
+
icon: ExclamationTriangle,
|
|
37
|
+
rejectProps: {
|
|
38
|
+
label: 'Cancel',
|
|
39
|
+
severity: 'secondary',
|
|
40
|
+
outlined: true
|
|
41
|
+
},
|
|
42
|
+
acceptProps: {
|
|
43
|
+
label: 'Save'
|
|
44
|
+
},
|
|
45
|
+
accept: () => {
|
|
46
|
+
toast.add({ severity: 'info', summary: 'Confirmed', detail: 'You have accepted', life: 3000 });
|
|
47
|
+
},
|
|
48
|
+
reject: () => {
|
|
49
|
+
toast.add({ severity: 'error', summary: 'Rejected', detail: 'You have rejected', life: 3000 });
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const confirm2 = () => {
|
|
55
|
+
confirm.require({
|
|
56
|
+
message: 'Do you want to delete this record?',
|
|
57
|
+
header: 'Danger Zone',
|
|
58
|
+
icon: InfoCircle,
|
|
59
|
+
rejectProps: {
|
|
60
|
+
label: 'Cancel',
|
|
61
|
+
severity: 'secondary',
|
|
62
|
+
outlined: true
|
|
63
|
+
},
|
|
64
|
+
acceptProps: {
|
|
65
|
+
label: 'Delete',
|
|
66
|
+
severity: 'danger'
|
|
67
|
+
},
|
|
68
|
+
accept: () => {
|
|
69
|
+
toast.add({ severity: 'info', summary: 'Confirmed', detail: 'Record deleted', life: 3000 });
|
|
70
|
+
},
|
|
71
|
+
reject: () => {
|
|
72
|
+
toast.add({ severity: 'error', summary: 'Rejected', detail: 'You have rejected', life: 3000 });
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
<\/script>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Position
|
|
80
|
+
|
|
81
|
+
The position property of the confirm options is used to display a Dialog at all edges and corners of the screen.
|
|
82
|
+
|
|
83
|
+
```vue
|
|
84
|
+
<template>
|
|
85
|
+
<Toast />
|
|
86
|
+
<ConfirmDialog group="positioned"></ConfirmDialog>
|
|
87
|
+
<div>
|
|
88
|
+
<div class="flex flex-wrap justify-center gap-2 mb-4">
|
|
89
|
+
<Button @click="confirmPosition('left')" severity="secondary" class="min-w-40">
|
|
90
|
+
<ArrowRight />
|
|
91
|
+
Left
|
|
92
|
+
</Button>
|
|
93
|
+
<Button @click="confirmPosition('right')" severity="secondary" class="min-w-40">
|
|
94
|
+
<ArrowLeft />
|
|
95
|
+
Right
|
|
96
|
+
</Button>
|
|
97
|
+
</div>
|
|
98
|
+
<div class="flex flex-wrap justify-center gap-2 mb-4">
|
|
99
|
+
<Button @click="confirmPosition('topleft')" severity="secondary" class="min-w-40">
|
|
100
|
+
<ArrowDown />
|
|
101
|
+
TopLeft
|
|
102
|
+
</Button>
|
|
103
|
+
<Button @click="confirmPosition('top')" severity="secondary" class="min-w-40">
|
|
104
|
+
<ArrowDown />
|
|
105
|
+
Top
|
|
106
|
+
</Button>
|
|
107
|
+
<Button @click="confirmPosition('topright')" severity="secondary" class="min-w-40">
|
|
108
|
+
<ArrowDown />
|
|
109
|
+
TopRight
|
|
110
|
+
</Button>
|
|
111
|
+
</div>
|
|
112
|
+
<div class="flex flex-wrap justify-center gap-2">
|
|
113
|
+
<Button @click="confirmPosition('bottomleft')" severity="secondary" class="min-w-40">
|
|
114
|
+
<ArrowUp />
|
|
115
|
+
BottomLeft
|
|
116
|
+
</Button>
|
|
117
|
+
<Button @click="confirmPosition('bottom')" severity="secondary" class="min-w-40">
|
|
118
|
+
<ArrowUp />
|
|
119
|
+
Bottom
|
|
120
|
+
</Button>
|
|
121
|
+
<Button @click="confirmPosition('bottomright')" severity="secondary" class="min-w-40">
|
|
122
|
+
<ArrowUp />
|
|
123
|
+
BottomRight
|
|
124
|
+
</Button>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</template>
|
|
128
|
+
|
|
129
|
+
<script setup>
|
|
130
|
+
import ArrowDown from '@primeicons/vue/arrow-down';
|
|
131
|
+
import ArrowLeft from '@primeicons/vue/arrow-left';
|
|
132
|
+
import ArrowRight from '@primeicons/vue/arrow-right';
|
|
133
|
+
import ArrowUp from '@primeicons/vue/arrow-up';
|
|
134
|
+
import InfoCircle from '@primeicons/vue/info-circle';
|
|
135
|
+
import { useConfirm } from "primevue/useconfirm";
|
|
136
|
+
import { useToast } from "primevue/usetoast";
|
|
137
|
+
|
|
138
|
+
const confirm = useConfirm();
|
|
139
|
+
const toast = useToast();
|
|
140
|
+
|
|
141
|
+
const confirmPosition = (position) => {
|
|
142
|
+
confirm.require({
|
|
143
|
+
group: 'positioned',
|
|
144
|
+
message: 'Are you sure you want to proceed?',
|
|
145
|
+
header: 'Confirmation',
|
|
146
|
+
icon: InfoCircle,
|
|
147
|
+
position: position,
|
|
148
|
+
rejectProps: {
|
|
149
|
+
label: 'Cancel',
|
|
150
|
+
severity: 'secondary',
|
|
151
|
+
text: true
|
|
152
|
+
},
|
|
153
|
+
acceptProps: {
|
|
154
|
+
label: 'Save',
|
|
155
|
+
text: true
|
|
156
|
+
},
|
|
157
|
+
accept: () => {
|
|
158
|
+
toast.add({ severity: 'info', summary: 'Confirmed', detail: 'Request submitted', life: 3000 });
|
|
159
|
+
},
|
|
160
|
+
reject: () => {
|
|
161
|
+
toast.add({ severity: 'error', summary: 'Rejected', detail: 'Process incomplete', life: 3000 });
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
<\/script>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Template
|
|
169
|
+
|
|
170
|
+
Properties of the dialog are defined in two ways, message , icon and header properties can either be defined using the require method or declaratively with the message and icon slots. If these values are unlikely to change then the declarative approach would be useful, still properties defined with the require method call would override the slot values. In addition, the footer section can be customized by passing your own UI via the container slot, an important note to make confirmation work with a custom UI is assigning the accept and reject callbacks to your own buttons.
|
|
171
|
+
|
|
172
|
+
```vue
|
|
173
|
+
<template>
|
|
174
|
+
<ConfirmDialog group="templating">
|
|
175
|
+
<template #message="{ message, icon }">
|
|
176
|
+
<div class="flex flex-col items-center w-full gap-4 border-b border-surface-200 dark:border-surface-700">
|
|
177
|
+
<component :is="icon" :size="60" class="text-primary-500" />
|
|
178
|
+
<p class="text-sm">{{ message.message }}</p>
|
|
179
|
+
</div>
|
|
180
|
+
</template>
|
|
181
|
+
<template #rejecticon>
|
|
182
|
+
<Times />
|
|
183
|
+
</template>
|
|
184
|
+
<template #accepticon>
|
|
185
|
+
<Check />
|
|
186
|
+
</template>
|
|
187
|
+
</ConfirmDialog>
|
|
188
|
+
<div class="flex justify-center">
|
|
189
|
+
<Button @click="showTemplate()">Save</Button>
|
|
190
|
+
</div>
|
|
191
|
+
<Toast />
|
|
192
|
+
</template>
|
|
193
|
+
|
|
194
|
+
<script setup>
|
|
195
|
+
import Check from '@primeicons/vue/check';
|
|
196
|
+
import ExclamationCircle from '@primeicons/vue/exclamation-circle';
|
|
197
|
+
import Times from '@primeicons/vue/times';
|
|
198
|
+
import { useConfirm } from "primevue/useconfirm";
|
|
199
|
+
import { useToast } from "primevue/usetoast";
|
|
200
|
+
|
|
201
|
+
const confirm = useConfirm();
|
|
202
|
+
const toast = useToast();
|
|
203
|
+
|
|
204
|
+
const showTemplate = () => {
|
|
205
|
+
confirm.require({
|
|
206
|
+
group: 'templating',
|
|
207
|
+
header: 'Confirmation',
|
|
208
|
+
message: 'Please confirm to proceed moving forward.',
|
|
209
|
+
icon: ExclamationCircle,
|
|
210
|
+
rejectProps: {
|
|
211
|
+
label: 'Cancel',
|
|
212
|
+
outlined: true,
|
|
213
|
+
size: 'small'
|
|
214
|
+
},
|
|
215
|
+
acceptProps: {
|
|
216
|
+
label: 'Save',
|
|
217
|
+
size: 'small'
|
|
218
|
+
},
|
|
219
|
+
accept: () => {
|
|
220
|
+
toast.add({ severity: 'info', summary: 'Confirmed', detail: 'You have accepted', life: 3000 });
|
|
221
|
+
},
|
|
222
|
+
reject: () => {
|
|
223
|
+
toast.add({ severity: 'error', summary: 'Rejected', detail: 'You have rejected', life: 3000 });
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
<\/script>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Headless
|
|
231
|
+
|
|
232
|
+
Headless mode is enabled by defining a container slot that lets you implement entire confirmation UI instead of the default elements.
|
|
233
|
+
|
|
234
|
+
```vue
|
|
235
|
+
<template>
|
|
236
|
+
<ConfirmDialog group="headless">
|
|
237
|
+
<template #container="{ message, acceptCallback, rejectCallback }">
|
|
238
|
+
<div class="flex flex-col items-center p-7 bg-surface-0 dark:bg-surface-900 rounded-sm">
|
|
239
|
+
<div class="rounded-full bg-primary text-primary-contrast inline-flex justify-center items-center h-24 w-24 -mt-20">
|
|
240
|
+
<Question :size="48" />
|
|
241
|
+
</div>
|
|
242
|
+
<span class="font-bold text-xl block mb-2 mt-5">{{ message.header }}</span>
|
|
243
|
+
<p class="mb-0 text-sm">{{ message.message }}</p>
|
|
244
|
+
<div class="flex items-center gap-2 mt-5">
|
|
245
|
+
<Button @click="acceptCallback" class="w-32">Save</Button>
|
|
246
|
+
<Button variant="outlined" @click="rejectCallback" class="w-32">Cancel</Button>
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
</template>
|
|
250
|
+
</ConfirmDialog>
|
|
251
|
+
<div class="flex justify-center">
|
|
252
|
+
<Button @click="requireConfirmation()">Save</Button>
|
|
253
|
+
</div>
|
|
254
|
+
<Toast />
|
|
255
|
+
</template>
|
|
256
|
+
|
|
257
|
+
<script setup>
|
|
258
|
+
import Question from '@primeicons/vue/question';
|
|
259
|
+
import { useConfirm } from "primevue/useconfirm";
|
|
260
|
+
import { useToast } from "primevue/usetoast";
|
|
261
|
+
|
|
262
|
+
const confirm = useConfirm();
|
|
263
|
+
const toast = useToast();
|
|
264
|
+
|
|
265
|
+
const requireConfirmation = () => {
|
|
266
|
+
confirm.require({
|
|
267
|
+
group: 'headless',
|
|
268
|
+
header: 'Are you sure?',
|
|
269
|
+
message: 'Please confirm to proceed.',
|
|
270
|
+
accept: () => {
|
|
271
|
+
toast.add({ severity: 'info', summary: 'Confirmed', detail: 'You have accepted', life: 3000 });
|
|
272
|
+
},
|
|
273
|
+
reject: () => {
|
|
274
|
+
toast.add({ severity: 'error', summary: 'Rejected', detail: 'You have rejected', life: 3000 });
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
<\/script>
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Accessibility
|
|
282
|
+
|
|
283
|
+
Screen Reader ConfirmDialog component uses alertdialog role along with aria-labelledby referring to the header element however any attribute is passed to the root element so you may use aria-labelledby to override this default behavior. In addition aria-modal is added since focus is kept within the popup. It is recommended to use a trigger component that can be accessed with keyboard such as a button, if not adding tabIndex would be necessary. When require method of the $confirm instance is used and a trigger is passed as a parameter, ConfirmDialog adds aria-expanded state attribute and aria-controls to the trigger so that the relation between the trigger and the dialog is defined. If the dialog is controlled with the visible property aria-expanded and aria-controls need to be handled explicitly. Overlay Keyboard Support Key Function tab Moves focus to the next the focusable element within the dialog. shift + tab Moves focus to the previous the focusable element within the dialog. escape Closes the dialog. Buttons Keyboard Support Key Function enter Closes the dialog. space Closes the dialog.
|
|
284
|
+
|
|
285
|
+
## Confirm Dialog API
|
|
286
|
+
|
|
287
|
+
### Props
|
|
288
|
+
|
|
289
|
+
| Name |Type |Default |Description |
|
|
290
|
+
| --- | --- | --- | --- |
|
|
291
|
+
| group | string | - | Optional key to match the key of the confirmation, useful to target a specific confirm dialog instance. |
|
|
292
|
+
| breakpoints | ConfirmDialogBreakpoints | - | Object literal to define widths per screen size. |
|
|
293
|
+
| draggable | boolean | true | Enables dragging to change the position using header. |
|
|
294
|
+
| dt | any | - | It generates scoped CSS variables using design tokens for the component. |
|
|
295
|
+
| pt | PassThrough<ConfirmDialogPassThroughOptions> | - | Used to pass attributes to DOM elements inside the component. |
|
|
296
|
+
| ptOptions | any | - | Used to configure passthrough(pt) options of the component. |
|
|
297
|
+
| unstyled | boolean | false | When enabled, it removes component related styles in the core. |
|
|
298
|
+
|
|
299
|
+
### Pass Through Options
|
|
300
|
+
|
|
301
|
+
| Name |Type |Description |
|
|
302
|
+
| --- | --- | --- |
|
|
303
|
+
| root | ConfirmDialogPassThroughOptionType | Used to pass attributes to the root's DOM element. |
|
|
304
|
+
| header | ConfirmDialogPassThroughOptionType | Used to pass attributes to the header's DOM element. |
|
|
305
|
+
| title | ConfirmDialogPassThroughOptionType | Used to pass attributes to the header title's DOM element. |
|
|
306
|
+
| headerActions | ConfirmDialogPassThroughOptionType | Used to pass attributes to the header actions' DOM element. |
|
|
307
|
+
| pcCloseButton | ConfirmDialogPassThroughOptionType | Used to pass attributes to the close button's component. |
|
|
308
|
+
| content | ConfirmDialogPassThroughOptionType | Used to pass attributes to the content's DOM element. |
|
|
309
|
+
| icon | ConfirmDialogPassThroughOptionType | Used to pass attributes to the icon's DOM element. |
|
|
310
|
+
| message | ConfirmDialogPassThroughOptionType | Used to pass attributes to the message's DOM element. |
|
|
311
|
+
| footer | ConfirmDialogPassThroughOptionType | Used to pass attributes to the footer's DOM element. |
|
|
312
|
+
| mask | ConfirmDialogPassThroughOptionType | Used to pass attributes to the mask's DOM element. |
|
|
313
|
+
| pcRejectButton | any | Used to pass attributes to the Button component. |
|
|
314
|
+
| pcAcceptButton | any | Used to pass attributes to the Button component. |
|
|
315
|
+
| hooks | any | Used to manage all lifecycle hooks. |
|
|
316
|
+
| transition | ConfirmDialogPassThroughOptionType | Used to control Vue Transition API. |
|
|
317
|
+
|
|
318
|
+
### Theming
|
|
319
|
+
|
|
320
|
+
### CSS Classes
|
|
321
|
+
|
|
322
|
+
| Class |Description |
|
|
323
|
+
| --- | --- |
|
|
324
|
+
| p-confirmdialog | Class name of the root element |
|
|
325
|
+
| p-confirmdialog-icon | Class name of the icon element |
|
|
326
|
+
| p-confirmdialog-message | Class name of the message element |
|
|
327
|
+
| p-confirmdialog-reject-button | Class name of the reject button element |
|
|
328
|
+
| p-confirmdialog-accept-button | Class name of the accept button element |
|
|
329
|
+
|
|
330
|
+
### Design Tokens
|
|
331
|
+
|
|
332
|
+
| Token |CSS Variable |Description |
|
|
333
|
+
| --- | --- | --- |
|
|
334
|
+
| confirmdialog.icon.size | --p-confirmdialog-icon-size | Size of icon |
|
|
335
|
+
| confirmdialog.icon.color | --p-confirmdialog-icon-color | Color of icon |
|
|
336
|
+
| confirmdialog.content.gap | --p-confirmdialog-content-gap | Gap of content |
|
|
337
|
+
| confirmdialog.message.color | --p-confirmdialog-message-color | Color of message |
|
|
338
|
+
| confirmdialog.message.font.weight | --p-confirmdialog-message-font-weight | Font weight of message |
|
|
339
|
+
| confirmdialog.message.font.size | --p-confirmdialog-message-font-size | Font size of message |
|
|
340
|
+
|
|
341
|
+
## Confirmation Service Use Confirm API
|
|
342
|
+
|
|
343
|
+
## Confirmation Options API
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# ConfirmPopup
|
|
2
|
+
|
|
3
|
+
ConfirmPopup displays a confirmation overlay displayed relatively to its target.
|
|
4
|
+
|
|
5
|
+
## Service
|
|
6
|
+
|
|
7
|
+
ConfirmPopup is controlled via the ConfirmationService that needs to be installed as an application plugin. The service is available with the useConfirm function for Composition API or using the $confirm property of the application for Options API.
|
|
8
|
+
|
|
9
|
+
## Basic
|
|
10
|
+
|
|
11
|
+
ConfirmPopup is displayed by calling the require method of the $confirm instance by passing the options to customize the Popup. The target attribute is mandatory to align the popup to its referrer.
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<template>
|
|
15
|
+
<Toast />
|
|
16
|
+
<ConfirmPopup></ConfirmPopup>
|
|
17
|
+
<div class="flex justify-center gap-2">
|
|
18
|
+
<Button @click="confirm1($event)" variant="outlined">Save</Button>
|
|
19
|
+
<Button @click="confirm2($event)" severity="danger" variant="outlined">Delete</Button>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup>
|
|
24
|
+
import ExclamationTriangle from '@primeicons/vue/exclamation-triangle';
|
|
25
|
+
import InfoCircle from '@primeicons/vue/info-circle';
|
|
26
|
+
import { useConfirm } from "primevue/useconfirm";
|
|
27
|
+
import { useToast } from "primevue/usetoast";
|
|
28
|
+
|
|
29
|
+
const confirm = useConfirm();
|
|
30
|
+
const toast = useToast();
|
|
31
|
+
|
|
32
|
+
const confirm1 = (event) => {
|
|
33
|
+
confirm.require({
|
|
34
|
+
target: event.currentTarget,
|
|
35
|
+
message: 'Are you sure you want to proceed?',
|
|
36
|
+
icon: ExclamationTriangle,
|
|
37
|
+
rejectProps: {
|
|
38
|
+
label: 'Cancel',
|
|
39
|
+
severity: 'secondary',
|
|
40
|
+
outlined: true
|
|
41
|
+
},
|
|
42
|
+
acceptProps: {
|
|
43
|
+
label: 'Save'
|
|
44
|
+
},
|
|
45
|
+
accept: () => {
|
|
46
|
+
toast.add({ severity: 'info', summary: 'Confirmed', detail: 'You have accepted', life: 3000 });
|
|
47
|
+
},
|
|
48
|
+
reject: () => {
|
|
49
|
+
toast.add({ severity: 'error', summary: 'Rejected', detail: 'You have rejected', life: 3000 });
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const confirm2 = (event) => {
|
|
55
|
+
confirm.require({
|
|
56
|
+
target: event.currentTarget,
|
|
57
|
+
message: 'Do you want to delete this record?',
|
|
58
|
+
icon: InfoCircle,
|
|
59
|
+
rejectProps: {
|
|
60
|
+
label: 'Cancel',
|
|
61
|
+
severity: 'secondary',
|
|
62
|
+
outlined: true
|
|
63
|
+
},
|
|
64
|
+
acceptProps: {
|
|
65
|
+
label: 'Delete',
|
|
66
|
+
severity: 'danger'
|
|
67
|
+
},
|
|
68
|
+
accept: () => {
|
|
69
|
+
toast.add({ severity: 'info', summary: 'Confirmed', detail: 'Record deleted', life: 3000 });
|
|
70
|
+
},
|
|
71
|
+
reject: () => {
|
|
72
|
+
toast.add({ severity: 'error', summary: 'Rejected', detail: 'You have rejected', life: 3000 });
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
<\/script>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Template
|
|
80
|
+
|
|
81
|
+
The message section can be customized using the message template.
|
|
82
|
+
|
|
83
|
+
```vue
|
|
84
|
+
<template>
|
|
85
|
+
<Toast />
|
|
86
|
+
<ConfirmPopup group="templating">
|
|
87
|
+
<template #message="{ message, icon }">
|
|
88
|
+
<div class="flex flex-col items-center w-full gap-4 border-b border-surface-200 dark:border-surface-700 p-4 mb-4 pb-0">
|
|
89
|
+
<component :is="icon" :size="60" class="text-primary-500" />
|
|
90
|
+
<p class="text-sm">{{ message.message }}</p>
|
|
91
|
+
</div>
|
|
92
|
+
</template>
|
|
93
|
+
<template #rejecticon>
|
|
94
|
+
<Times />
|
|
95
|
+
</template>
|
|
96
|
+
<template #accepticon>
|
|
97
|
+
<Check />
|
|
98
|
+
</template>
|
|
99
|
+
</ConfirmPopup>
|
|
100
|
+
<div class="flex justify-center">
|
|
101
|
+
<Button @click="showTemplate($event)">Save</Button>
|
|
102
|
+
</div>
|
|
103
|
+
</template>
|
|
104
|
+
|
|
105
|
+
<script setup>
|
|
106
|
+
import Check from '@primeicons/vue/check';
|
|
107
|
+
import ExclamationCircle from '@primeicons/vue/exclamation-circle';
|
|
108
|
+
import Times from '@primeicons/vue/times';
|
|
109
|
+
import { useConfirm } from "primevue/useconfirm";
|
|
110
|
+
import { useToast } from "primevue/usetoast";
|
|
111
|
+
|
|
112
|
+
const confirm = useConfirm();
|
|
113
|
+
const toast = useToast();
|
|
114
|
+
|
|
115
|
+
const showTemplate = (event) => {
|
|
116
|
+
confirm.require({
|
|
117
|
+
target: event.currentTarget,
|
|
118
|
+
group: 'templating',
|
|
119
|
+
message: 'Please confirm to proceed moving forward.',
|
|
120
|
+
icon: ExclamationCircle,
|
|
121
|
+
rejectProps: {
|
|
122
|
+
label: 'Cancel',
|
|
123
|
+
outlined: true
|
|
124
|
+
},
|
|
125
|
+
acceptProps: {
|
|
126
|
+
label: 'Confirm'
|
|
127
|
+
},
|
|
128
|
+
accept: () => {
|
|
129
|
+
toast.add({severity:'info', summary:'Confirmed', detail:'You have accepted', life: 3000});
|
|
130
|
+
},
|
|
131
|
+
reject: () => {
|
|
132
|
+
toast.add({severity:'error', summary:'Rejected', detail:'You have rejected', life: 3000});
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
<\/script>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Headless
|
|
140
|
+
|
|
141
|
+
Headless mode is enabled by defining a container slot that lets you implement entire confirmation UI instead of the default elements.
|
|
142
|
+
|
|
143
|
+
```vue
|
|
144
|
+
<template>
|
|
145
|
+
<Toast />
|
|
146
|
+
<ConfirmPopup group="headless">
|
|
147
|
+
<template #container="{ message, acceptCallback, rejectCallback }">
|
|
148
|
+
<div class="rounded-sm p-4">
|
|
149
|
+
<span class="text-sm">{{ message.message }}</span>
|
|
150
|
+
<div class="flex items-center gap-2 mt-4">
|
|
151
|
+
<Button @click="acceptCallback" size="small">Save</Button>
|
|
152
|
+
<Button variant="outlined" @click="rejectCallback" severity="secondary" size="small" text>Cancel</Button>
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
</template>
|
|
156
|
+
</ConfirmPopup>
|
|
157
|
+
<div class="flex justify-center">
|
|
158
|
+
<Button @click="requireConfirmation($event)">Save</Button>
|
|
159
|
+
</div>
|
|
160
|
+
</template>
|
|
161
|
+
|
|
162
|
+
<script setup>
|
|
163
|
+
import { useConfirm } from "primevue/useconfirm";
|
|
164
|
+
import { useToast } from "primevue/usetoast";
|
|
165
|
+
|
|
166
|
+
const confirm = useConfirm();
|
|
167
|
+
const toast = useToast();
|
|
168
|
+
|
|
169
|
+
const requireConfirmation = (event) => {
|
|
170
|
+
confirm.require({
|
|
171
|
+
target: event.currentTarget,
|
|
172
|
+
group: 'headless',
|
|
173
|
+
message: 'Save your current process?',
|
|
174
|
+
accept: () => {
|
|
175
|
+
toast.add({severity:'info', summary:'Confirmed', detail:'You have accepted', life: 3000});
|
|
176
|
+
},
|
|
177
|
+
reject: () => {
|
|
178
|
+
toast.add({severity:'error', summary:'Rejected', detail:'You have rejected', life: 3000});
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
<\/script>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Accessibility
|
|
186
|
+
|
|
187
|
+
Screen Reader ConfirmPopup component uses alertdialog role and since any attribute is passed to the root element you may define attributes like aria-label or aria-labelledby to describe the popup contents. In addition aria-modal is added since focus is kept within the popup. When require method of the $confirm instance is used and a trigger is passed as a parameter, ConfirmPopup adds aria-expanded state attribute and aria-controls to the trigger so that the relation between the trigger and the dialog is defined. Overlay Keyboard Support Key Function tab Moves focus to the next the focusable element within the popup. shift + tab Moves focus to the previous the focusable element within the popup. escape Closes the popup and moves focus to the trigger. Buttons Keyboard Support Key Function enter Triggers the action, closes the popup and moves focus to the trigger. space Triggers the action, closes the popup and moves focus to the trigger.
|
|
188
|
+
|
|
189
|
+
## Confirm Popup API
|
|
190
|
+
|
|
191
|
+
### Props
|
|
192
|
+
|
|
193
|
+
| Name |Type |Default |Description |
|
|
194
|
+
| --- | --- | --- | --- |
|
|
195
|
+
| group | string | - | Optional key to match the key of the confirmation, useful to target a specific confirm dialog instance. |
|
|
196
|
+
| dt | any | - | It generates scoped CSS variables using design tokens for the component. |
|
|
197
|
+
| pt | PassThrough<ConfirmPopupPassThroughOptions> | - | Used to pass attributes to DOM elements inside the component. |
|
|
198
|
+
| ptOptions | any | - | Used to configure passthrough(pt) options of the component. |
|
|
199
|
+
| unstyled | boolean | false | When enabled, it removes component related styles in the core. |
|
|
200
|
+
|
|
201
|
+
### Pass Through Options
|
|
202
|
+
|
|
203
|
+
| Name |Type |Description |
|
|
204
|
+
| --- | --- | --- |
|
|
205
|
+
| root | ConfirmPopupPassThroughOptionType | Used to pass attributes to the root's DOM element. |
|
|
206
|
+
| content | ConfirmPopupPassThroughOptionType | Used to pass attributes to the content's DOM element. |
|
|
207
|
+
| icon | ConfirmPopupPassThroughOptionType | Used to pass attributes to the icon's DOM element. |
|
|
208
|
+
| message | ConfirmPopupPassThroughOptionType | Used to pass attributes to the message's DOM element. |
|
|
209
|
+
| footer | ConfirmPopupPassThroughOptionType | Used to pass attributes to the footer's DOM element. |
|
|
210
|
+
| pcRejectButton | any | Used to pass attributes to the Button component. |
|
|
211
|
+
| pcAcceptButton | any | Used to pass attributes to the Button component. |
|
|
212
|
+
| hooks | any | Used to manage all lifecycle hooks. |
|
|
213
|
+
| transition | ConfirmPopupPassThroughTransitionType | Used to control Vue Transition API. |
|
|
214
|
+
|
|
215
|
+
### Theming
|
|
216
|
+
|
|
217
|
+
### CSS Classes
|
|
218
|
+
|
|
219
|
+
| Class |Description |
|
|
220
|
+
| --- | --- |
|
|
221
|
+
| p-confirmpopup | Class name of the root element |
|
|
222
|
+
| p-confirmpopup-content | Class name of the content element |
|
|
223
|
+
| p-confirmpopup-icon | Class name of the icon element |
|
|
224
|
+
| p-confirmpopup-message | Class name of the message element |
|
|
225
|
+
| p-confirmpopup-footer | Class name of the footer element |
|
|
226
|
+
| p-confirmpopup-reject-button | Class name of the reject button element |
|
|
227
|
+
| p-confirmpopup-accept-button | Class name of the accept button element |
|
|
228
|
+
|
|
229
|
+
### Design Tokens
|
|
230
|
+
|
|
231
|
+
| Token |CSS Variable |Description |
|
|
232
|
+
| --- | --- | --- |
|
|
233
|
+
| confirmpopup.background | --p-confirmpopup-background | Background of root |
|
|
234
|
+
| confirmpopup.border.color | --p-confirmpopup-border-color | Border color of root |
|
|
235
|
+
| confirmpopup.color | --p-confirmpopup-color | Color of root |
|
|
236
|
+
| confirmpopup.border.radius | --p-confirmpopup-border-radius | Border radius of root |
|
|
237
|
+
| confirmpopup.shadow | --p-confirmpopup-shadow | Shadow of root |
|
|
238
|
+
| confirmpopup.gutter | --p-confirmpopup-gutter | Gutter of root |
|
|
239
|
+
| confirmpopup.arrow.offset | --p-confirmpopup-arrow-offset | Arrow offset of root |
|
|
240
|
+
| confirmpopup.content.padding | --p-confirmpopup-content-padding | Padding of content |
|
|
241
|
+
| confirmpopup.content.gap | --p-confirmpopup-content-gap | Gap of content |
|
|
242
|
+
| confirmpopup.icon.size | --p-confirmpopup-icon-size | Size of icon |
|
|
243
|
+
| confirmpopup.icon.color | --p-confirmpopup-icon-color | Color of icon |
|
|
244
|
+
| confirmpopup.message.color | --p-confirmpopup-message-color | Color of message |
|
|
245
|
+
| confirmpopup.message.font.weight | --p-confirmpopup-message-font-weight | Font weight of message |
|
|
246
|
+
| confirmpopup.message.font.size | --p-confirmpopup-message-font-size | Font size of message |
|
|
247
|
+
| confirmpopup.footer.gap | --p-confirmpopup-footer-gap | Gap of footer |
|
|
248
|
+
| confirmpopup.footer.padding | --p-confirmpopup-footer-padding | Padding of footer |
|
|
249
|
+
|
|
250
|
+
## Confirmation Service Use Confirm API
|
|
251
|
+
|
|
252
|
+
## Confirmation Options API
|