Files
manolia-alpha/node_modules/buetify/lib/composables/toast/useToast.js
Robin COuret e0e50af706 init component
2026-02-16 17:28:37 +01:00

22 lines
941 B
JavaScript
Executable File

import { constant } from 'fp-ts/lib/function';
import { h, shallowRef } from 'vue';
import { constEmptyArray } from '../../utils/helpers';
import { DEFAULT_USE_NOTICE_PROPS, useNoticeController } from '../noticeController';
export function useToast(props = DEFAULT_USE_NOTICE_PROPS, slots = {}) {
const renderNotification = shallowRef(constant(constEmptyArray));
const noticeController = useNoticeController(props, renderNotification);
renderNotification.value = options => () => {
return [slots.message ? h('div', {
class: ['toast', options.variant ?? props.variant, options.position ?? props.position],
role: 'alert'
}, slots.message && slots.message()) : h('div', {
class: ['toast', options.variant ?? props.variant, options.position ?? props.position],
role: 'alert',
innerHTML: options.message ?? props.message
})];
};
return noticeController;
}
//# sourceMappingURL=useToast.js.map