discourse/app/assets/javascripts/float-kit/addon/lib/constants.js
Sam 5b05cee720
FIX: filter UI overlapping with INPUT on small screens (#34426)
Additionally there is a new option to hide a floating UI automatically
if it is
too small.

---------

Co-authored-by: Martin Brennan <martin@discourse.org>
2025-08-20 16:32:01 +10:00

104 lines
2.2 KiB
JavaScript
Vendored

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 VISIBILITY_OPTIMIZERS = {
FLIP: "flip",
AUTO_PLACEMENT: "autoPlacement",
NONE: "none",
};
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",
visibilityOptimizer: VISIBILITY_OPTIMIZERS.FLIP,
fallbackPlacements: FLOAT_UI_PLACEMENTS,
autoUpdate: true,
trapTab: true,
onClose: null,
onShow: null,
onRegisterApi: null,
updateOnScroll: true,
},
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",
visibilityOptimizer: VISIBILITY_OPTIMIZERS.FLIP,
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,
updateOnScroll: true,
matchTriggerMinWidth: false,
matchTriggerWidth: false,
},
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"],
},
};