discourse/app/assets/javascripts/float-kit/addon/lib/constants.js
Joffrey JAFFEUX 2e4076f586
DEV: standardise toasts duration (#32741)
Toasts can now have two durations:
- `short` -> 3000ms
- `long` -> 5000ms

For backwards compatibility integer values still work but will display a deprecation message in the browser console.
2025-05-15 14:59:37 +02:00

92 lines
1.9 KiB
JavaScript

export const FLOAT_UI_PLACEMENTS = [
"top",
"top-start",
"top-end",
"right",
"right-start",
"right-end",
"bottom",
"bottom-start",
"bottom-end",
"left",
"left-start",
"left-end",
];
export const TOOLTIP = {
options: {
animated: true,
arrow: true,
beforeTrigger: null,
closeOnClickOutside: true,
closeOnEscape: true,
closeOnScroll: true,
component: null,
content: null,
identifier: null,
interactive: false,
listeners: false,
maxWidth: 350,
data: null,
offset: 10,
triggers: { mobile: ["click"], desktop: ["hover", "click"] },
untriggers: { mobile: ["click"], desktop: ["hover", "click"] },
placement: "top",
fallbackPlacements: FLOAT_UI_PLACEMENTS,
autoUpdate: true,
trapTab: true,
onClose: null,
onShow: null,
onRegisterApi: null,
},
portalOutletId: "d-tooltip-portal-outlet",
};
export const MENU = {
options: {
animated: true,
arrow: false,
autofocus: false,
beforeTrigger: null,
closeOnEscape: true,
closeOnClickOutside: true,
closeOnScroll: false,
component: null,
content: null,
identifier: null,
interactive: true,
listeners: false,
maxWidth: 400,
data: null,
offset: 10,
triggers: ["click"],
untriggers: ["click"],
placement: "bottom-start",
fallbackPlacements: FLOAT_UI_PLACEMENTS,
autoUpdate: true,
trapTab: true,
onClose: null,
onShow: null,
onRegisterApi: null,
modalForMobile: false,
inline: null,
groupIdentifier: null,
parentIdentifier: null,
triggerClass: null,
contentClass: null,
class: null,
},
portalOutletId: "d-menu-portal-outlet",
};
import DDefaultToast from "float-kit/components/d-default-toast";
export const TOAST = {
options: {
autoClose: true,
duration: "short",
component: DDefaultToast,
showProgressBar: false,
views: ["desktop", "mobile"],
},
};