mood-ui 0.13.1 → 0.14.1
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/dist/components/feedback/Drawer.cjs.map +1 -1
- package/dist/components/feedback/Drawer.mjs.map +1 -1
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.cjs +11 -7
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs +12 -8
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Modal.cjs.map +1 -1
- package/dist/components/feedback/Modal.mjs.map +1 -1
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.cjs +10 -3
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs +11 -4
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Toast.cjs +1 -1
- package/dist/components/feedback/Toast.cjs.map +1 -1
- package/dist/components/feedback/Toast.mjs +1 -1
- package/dist/components/feedback/Toast.mjs.map +1 -1
- package/dist/components/feedback/Toast.vue_vue_type_script_setup_true_lang.cjs +4 -2
- package/dist/components/feedback/Toast.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/Toast.vue_vue_type_script_setup_true_lang.mjs +5 -3
- package/dist/components/feedback/Toast.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/ToastContainer.cjs +1 -1
- package/dist/components/feedback/ToastContainer.cjs.map +1 -1
- package/dist/components/feedback/ToastContainer.mjs +1 -1
- package/dist/components/feedback/ToastContainer.mjs.map +1 -1
- package/dist/components/feedback/ToastContainer.vue_vue_type_script_setup_true_lang.cjs +4 -2
- package/dist/components/feedback/ToastContainer.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/ToastContainer.vue_vue_type_script_setup_true_lang.mjs +6 -4
- package/dist/components/feedback/ToastContainer.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/dialog/DialogTrigger.cjs.map +1 -1
- package/dist/components/feedback/dialog/DialogTrigger.mjs.map +1 -1
- package/dist/components/feedback/dialog/DialogTrigger.vue_vue_type_script_setup_true_lang.cjs +10 -2
- package/dist/components/feedback/dialog/DialogTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/dialog/DialogTrigger.vue_vue_type_script_setup_true_lang.mjs +10 -2
- package/dist/components/feedback/dialog/DialogTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/sheet/SheetTrigger.cjs.map +1 -1
- package/dist/components/feedback/sheet/SheetTrigger.mjs.map +1 -1
- package/dist/components/feedback/sheet/SheetTrigger.vue_vue_type_script_setup_true_lang.cjs +10 -2
- package/dist/components/feedback/sheet/SheetTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/sheet/SheetTrigger.vue_vue_type_script_setup_true_lang.mjs +10 -2
- package/dist/components/feedback/sheet/SheetTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelect.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelect.mjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelect.vue_vue_type_script_setup_true_lang.cjs +53 -6
- package/dist/components/forms/morph-select/MorphSelect.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelect.vue_vue_type_script_setup_true_lang.mjs +54 -7
- package/dist/components/forms/morph-select/MorphSelect.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectContent.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectContent.mjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectContent.vue_vue_type_script_setup_true_lang.cjs +33 -8
- package/dist/components/forms/morph-select/MorphSelectContent.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectContent.vue_vue_type_script_setup_true_lang.mjs +34 -9
- package/dist/components/forms/morph-select/MorphSelectContent.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectContext.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectContext.mjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectTrigger.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectTrigger.mjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs +33 -16
- package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.mjs +34 -17
- package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.cjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.mjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.cjs +10 -2
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.mjs +10 -2
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.cjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.mjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.cjs +7 -0
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.mjs +7 -0
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/config/ModoLocale.cjs +4 -0
- package/dist/config/ModoLocale.cjs.map +1 -1
- package/dist/config/ModoLocale.mjs +4 -0
- package/dist/config/ModoLocale.mjs.map +1 -1
- package/dist/config/locales/es.cjs +4 -0
- package/dist/config/locales/es.cjs.map +1 -1
- package/dist/config/locales/es.mjs +4 -0
- package/dist/config/locales/es.mjs.map +1 -1
- package/dist/mood-ui.css +39 -41
- package/dist/types/components/forms/morph-select/MorphSelect.vue.d.ts +8 -7
- package/dist/types/components/forms/morph-select/MorphSelectContext.d.ts +6 -1
- package/dist/types/components/forms/morph-select/MorphSelectTrigger.vue.d.ts +6 -3
- package/dist/types/components/forms/morph-select/index.d.ts +24 -18
- package/dist/types/config/ModoLocale.d.ts +6 -0
- package/dist/types/interfaces/feedback/Drawer.interface.d.ts +2 -0
- package/dist/types/interfaces/feedback/Modal.interface.d.ts +2 -0
- package/dist/types/interfaces/forms/ModeOrb.interface.d.ts +3 -3
- package/dist/types/interfaces/forms/MorphSelect.interface.d.ts +13 -5
- package/dist/types/utils/morph/morphHelpers.d.ts +6 -0
- package/dist/utils/morph/morphHelpers.cjs +16 -0
- package/dist/utils/morph/morphHelpers.cjs.map +1 -1
- package/dist/utils/morph/morphHelpers.mjs +16 -1
- package/dist/utils/morph/morphHelpers.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../src/components/feedback/Modal.vue"],"sourcesContent":["<template> \n <Teleport to=\"body\"> \n <Transition :css=\"false\" @enter=\"onOverlayEnter\" @leave=\"onOverlayLeave\" appear> \n <div \n v-if=\"modelValue\" \n ref=\"overlayRef\" \n :class=\"[ \n 'modo-modal-overlay fixed inset-0 z-1200 flex opacity-0', \n positionClasses, \n ]\" \n :style=\"overlayStyle\" \n :data-modo-theme=\"scopedTheme || undefined\" \n @mousedown=\"onOverlayMouseDown\" \n @click=\"onOverlayClick\" \n > \n <!-- Scrim (shared Valux material, dark veil in both modes) -->\n <div\n aria-hidden=\"true\"\n class=\"modo-scrim pointer-events-none absolute inset-0\"\n :data-modo-scrim=\"scrimVariant\"\n />\n <div \n ref=\"panelRef\" \n data-modo-modal-panel \n role=\"dialog\" \n aria-modal=\"true\" \n :aria-labelledby=\"title ? titleId : undefined\" \n :aria-describedby=\"description ? descriptionId : undefined\" \n :aria-label=\"!title ? ariaLabel : undefined\" \n :class=\"[ \n 'modo-modal relative flex flex-col w-full bg-card text-foreground overflow-hidden', \n 'dark:bg-card/85 dark:backdrop-blur-xl', \n 'border border-border shadow-xl outline-none focus:outline-none focus-visible:outline-none', \n sizeClasses, \n radiusClasses, \n ]\" \n tabindex=\"-1\" \n @click.stop \n @keydown=\"onPanelKeydown\" \n > \n <!-- Inner border layer --> \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n :class=\"[ \n 'pointer-events-none absolute inset-1 border border-border/40', \n innerBorderRadiusClass, \n ]\" \n /> \n \n <!-- Close button (usa nuestro Button en modo icono) --> \n <div v-if=\"showClose\" class=\"absolute top-3 right-3 z-10\"> \n <Button \n variant=\"text\" \n size=\"small\" \n :color=\"resolvedColor\" \n :icon=\"XMarkIcon\" \n ariaLabel=\"Close\" \n @click=\"close\" \n /> \n </div> \n \n <!-- Content wrapper --> \n <div ref=\"contentRef\" data-modo-modal-content class=\"flex flex-col min-h-0 flex-1\"> \n <!-- Header --> \n <header \n v-if=\"$slots.header || title || description\" \n :class=\"[ \n 'relative flex flex-col gap-1 px-6 pt-6', \n showClose ? 'pr-12' : '', \n $slots.default || $slots.body || $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"header\"> \n <Typography \n v-if=\"title\" \n :id=\"titleId\" \n variant=\"title\" \n size=\"medium\" \n as=\"h2\" \n weight=\"semibold\" \n > \n {{ title }} \n </Typography> \n <Typography \n v-if=\"description\" \n :id=\"descriptionId\" \n variant=\"body\" \n size=\"small\" \n color=\"muted\" \n > \n {{ description }} \n </Typography> \n </slot> \n </header> \n \n <!-- Body --> \n <div \n v-if=\"$slots.default || $slots.body\" \n :class=\"[ \n 'relative flex-1 overflow-auto px-6', \n ($slots.header || title || description) ? '' : 'pt-6', \n $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"body\"> \n <slot /> \n </slot> \n </div> \n \n <!-- Footer (divider respeta inner border con inset) --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-6 py-4\" \n > \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-1 right-1 h-px bg-border/40\" \n /> \n <span \n v-else \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-0 right-0 h-px bg-border\" \n /> \n <slot name=\"footer\" :close=\"close\" /> \n </footer> \n </div> \n </div> \n </div> \n </Transition> \n </Teleport> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onBeforeUnmount, onMounted, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Button from '../forms/Button.vue'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Modal } from '../../interfaces/feedback/Modal.interface'; \nimport { \n useResolvedColor, \n useResolvedRadius, \n useResolvedTheme, \n useModoConfig, \n} from '../../composables/useModoConfig'; \nimport { resolveColorMode } from '../../composables/useColorMode';\nimport { lockBodyScroll, unlockBodyScroll } from '../../composables/useBodyScrollLock';\nimport { palettesToCssVars, semanticTokensFromPalettes } from '../../config/palettes';\nimport { hexToOklchString, pickForegroundOklch } from '../../config/colorPrimitives';\nimport { surfacesToCssVars } from '../../config/surfaces'; \nimport type { ModoColor, ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Modal>(), { \n modelValue: false, \n size: 'medium', \n position: 'center', \n closeOnOverlay: true, \n closeOnEscape: true, \n showClose: true, \n lockScroll: true, \n color: 'default', \n overlay: 'blur', \n innerBorder: true, \n disableOriginAnimation: false, \n}); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [value: boolean]; \n open: []; \n close: []; \n afterLeave: []; \n}>(); \n \nconst autoId = useId(); \nconst titleId = computed(() => `modo-modal-${autoId}-title`); \nconst descriptionId = computed(() => `modo-modal-${autoId}-desc`); \n \nconst overlayRef = ref<HTMLElement | null>(null); \nconst panelRef = ref<HTMLElement | null>(null); \nconst contentRef = ref<HTMLElement | null>(null); \n \nconst resolvedColor = useResolvedColor(() => props.color as ModoColor | undefined); \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \nconst cfg = useModoConfig(); \nconst theme = useResolvedTheme(); \nconst scopedTheme = computed(() => resolveColorMode(theme.value)); \n \nconst overlayStyle = computed(() => { \n const providerVars = cfg?.value.palettes \n ? { \n ...palettesToCssVars(cfg.value.palettes), \n ...semanticTokensFromPalettes(cfg.value.palettes, hexToOklchString, pickForegroundOklch), \n } \n : {};\n const surfaceVars = cfg?.value.surfaces\n ? surfacesToCssVars(cfg.value.surfaces)\n : {};\n const darkSurfaceVars = (scopedTheme.value === 'dark' && cfg?.value.darkSurfaces)\n ? surfacesToCssVars(cfg.value.darkSurfaces)\n : {};\n return { ...providerVars, ...surfaceVars, ...darkSurfaceVars };\n}); \n \nfunction close() { \n if (!props.modelValue) return; \n emit('update:modelValue', false); \n emit('close'); \n} \n \n/* ---------- Click outside ---------- */ \nlet mouseDownOnOverlay = false; \nfunction onOverlayMouseDown(e: MouseEvent) { \n mouseDownOnOverlay = e.target === overlayRef.value; \n} \nfunction onOverlayClick(e: MouseEvent) { \n if (!props.closeOnOverlay) return; \n if (e.target !== overlayRef.value) return; \n if (!mouseDownOnOverlay) return; \n close(); \n} \n \n/* ---------- Keydown (Escape + focus trap) ---------- */ \nfunction onPanelKeydown(e: KeyboardEvent) { \n if (props.closeOnEscape && e.key === 'Escape') { \n e.preventDefault(); \n close(); \n return; \n } \n if (e.key === 'Tab' && panelRef.value) { \n const focusables = getFocusable(panelRef.value); \n if (focusables.length === 0) { \n e.preventDefault(); \n return; \n } \n const first = focusables[0]; \n const last = focusables[focusables.length - 1]; \n const active = document.activeElement as HTMLElement | null; \n if (e.shiftKey && active === first) { \n e.preventDefault(); \n last.focus(); \n } else if (!e.shiftKey && active === last) { \n e.preventDefault(); \n first.focus(); \n } \n } \n} \n \nconst FOCUSABLE_SELECTOR = \n 'a[href], area[href], input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]'; \n \nfunction getFocusable(container: HTMLElement): HTMLElement[] { \n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)) \n .filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null); \n} \n \n/* ---------- Animations (staged open/close) ---------- */ \n \nfunction prefersReducedMotion() { \n return typeof window !== 'undefined' \n && window.matchMedia('(prefers-reduced-motion: reduce)').matches; \n} \n \nlet capturedOrigin: HTMLElement | null = null; \nlet lastPointerTrigger: { el: HTMLElement; time: number } | null = null;\n\nfunction onWindowPointerDown(e: PointerEvent) {\n const target = e.target as Element | null;\n const trigger = target?.closest?.('button, a, [role=\"button\"], [tabindex]') as HTMLElement | null;\n if (trigger) {\n lastPointerTrigger = { el: trigger, time: Date.now() };\n }\n}\n\nfunction getOriginEl(): HTMLElement | null { \n if (props.origin) return props.origin; \n return capturedOrigin; \n} \n \nlet activeTimeline: gsap.core.Timeline | null = null; \n \nfunction onOverlayEnter(el: Element, done: () => void) { \n const overlay = (el as HTMLElement) ?? overlayRef.value; \n const panel = \n overlay?.querySelector<HTMLElement>('[data-modo-modal-panel]') \n ?? panelRef.value; \n if (!overlay || !panel) { done(); return; } \n \n activeTimeline?.kill(); \n \n if (prefersReducedMotion()) { \n gsap.set([overlay, panel], { opacity: 1, clearProps: 'transform' }); \n done(); \n return; \n } \n \n const origin = !props.disableOriginAnimation ? getOriginEl() : null; \n const pRect = panel.getBoundingClientRect(); \n \n const tl = gsap.timeline({ onComplete: () => { activeTimeline = null; done(); } }); \n activeTimeline = tl; \n \n // 1. Overlay fade in \n tl.fromTo(overlay, { opacity: 0 }, { opacity: 1, duration: 0.25, ease: 'power2.out' }, 0); \n \n // 2. Panel + contenido emergen juntos desde el trigger hasta su tamaño real\n if (origin && document.body.contains(origin)) { \n const oRect = origin.getBoundingClientRect(); \n const dx = oRect.left + oRect.width / 2 - (pRect.left + pRect.width / 2); \n const dy = oRect.top + oRect.height / 2 - (pRect.top + pRect.height / 2); \n const scaleX = Math.max(oRect.width / pRect.width, 0.05); \n const scaleY = Math.max(oRect.height / pRect.height, 0.05); \n tl.fromTo( \n panel, \n { x: dx, y: dy, scaleX, scaleY, opacity: 0.85, transformOrigin: 'center center' }, \n { x: 0, y: 0, scaleX: 1, scaleY: 1, opacity: 1, duration: 0.5, ease: 'power3.out' }, \n 0.05, \n ); \n } else { \n tl.fromTo( \n panel, \n { y: 16, scale: 0.95, opacity: 0 }, \n { y: 0, scale: 1, opacity: 1, duration: 0.35, ease: 'power2.out' }, \n 0, \n ); \n } \n} \n \nfunction onOverlayLeave(el: Element, done: () => void) { \n // Durante el leave, los template refs de Vue ya fueron desvinculados, \n // así que resolvemos los nodos desde el elemento que Transition nos entrega. \n const overlay = el as HTMLElement; \n const panel = \n overlay.querySelector<HTMLElement>('[data-modo-modal-panel]') \n ?? panelRef.value; \n // Bail out without animating, but never without releasing the lock — this\n // path is the one that used to strand `overflow: hidden` on <body>.\n if (!overlay || !panel) { releaseScrollLock(); done(); return; }\n\n activeTimeline?.kill();\n\n if (prefersReducedMotion()) {\n gsap.to(overlay, {\n opacity: 0,\n duration: 0.12,\n onComplete: () => { releaseScrollLock(); done(); },\n });\n return;\n }\n\n const origin = !props.disableOriginAnimation ? getOriginEl() : null; \n const pRect = panel.getBoundingClientRect(); \n \n const tl = gsap.timeline({ \n onComplete: () => { \n activeTimeline = null; \n releaseScrollLock(); \n done(); \n }, \n }); \n activeTimeline = tl; \n \n // El panel regresa con todo su contenido visible hacia su lugar de origen;\n // el overlay (padre del panel) solo cae en opacidad al final del recorrido\n // para no ocultar el vuelo de regreso antes de llegar al trigger.\n if (origin && document.body.contains(origin)) { \n const oRect = origin.getBoundingClientRect(); \n const dx = oRect.left + oRect.width / 2 - (pRect.left + pRect.width / 2); \n const dy = oRect.top + oRect.height / 2 - (pRect.top + pRect.height / 2); \n const scaleX = Math.max(oRect.width / pRect.width, 0.05); \n const scaleY = Math.max(oRect.height / pRect.height, 0.05); \n tl.to( \n panel, \n { x: dx, y: dy, scaleX, scaleY, transformOrigin: 'center center', duration: 0.38, ease: 'power3.in' }, \n 0, \n ); \n tl.to(overlay, { opacity: 0, duration: 0.28, ease: 'power3.in' }, 0.1); \n } else { \n tl.to( \n panel, \n { y: 10, scale: 0.95, opacity: 0, duration: 0.24, ease: 'power2.in' }, \n 0, \n ); \n tl.to(overlay, { opacity: 0, duration: 0.24, ease: 'power2.in' }, 0.04); \n } \n} \n \n/* ---------- Scroll lock + focus management ---------- */\nlet previouslyFocused: HTMLElement | null = null;\nlet scrollLocked = false;\n\nfunction releaseScrollLock() {\n if (!scrollLocked) return;\n scrollLocked = false;\n unlockBodyScroll();\n}\n\nonMounted(() => {\n if (typeof window !== 'undefined') {\n window.addEventListener('pointerdown', onWindowPointerDown, { capture: true, passive: true });\n }\n});\n\nwatch( \n () => props.modelValue, \n (open) => { \n if (open) { \n const active = document.activeElement as HTMLElement | null; \n const recentPointer =\n lastPointerTrigger\n && Date.now() - lastPointerTrigger.time < 600\n && document.body.contains(lastPointerTrigger.el)\n ? lastPointerTrigger.el\n : null;\n const triggerEl =\n active && active !== document.body && active !== document.documentElement\n ? active\n : recentPointer;\n previouslyFocused = triggerEl; \n capturedOrigin = triggerEl; \n \n if (props.lockScroll && !scrollLocked) {\n scrollLocked = true;\n lockBodyScroll();\n }\n emit('open'); \n nextTick(() => { \n if (!panelRef.value) return; \n const focusables = getFocusable(panelRef.value); \n (focusables[0] ?? panelRef.value).focus(); \n }); \n } else { \n // El scroll lock se libera en onOverlayLeave cuando termina la \n // animación, para evitar que aparezca el scrollbar y empuje el \n // modal antes de que desaparezca. \n if (previouslyFocused && typeof previouslyFocused.focus === 'function') { \n previouslyFocused.focus(); \n } \n previouslyFocused = null; \n emit('afterLeave'); \n } \n }, \n); \n \nonBeforeUnmount(() => { \n if (typeof window !== 'undefined') {\n window.removeEventListener('pointerdown', onWindowPointerDown, { capture: true });\n }\n activeTimeline?.kill(); \n releaseScrollLock(); \n}); \n \n/* ---------- Style maps ---------- */ \nconst sizeClasses = computed(() => { \n switch (props.size) { \n case 'xsmall': return 'max-w-xs';\n case 'small': return 'max-w-sm'; \n case 'large': return 'max-w-2xl'; \n case 'xlarge': return 'max-w-4xl'; \n case 'full': return 'max-w-none w-[calc(100vw-2rem)] h-[calc(100vh-2rem)]'; \n default: return 'max-w-md'; \n } \n}); \n \nconst radiusClasses = computed(() => { \n if (props.size === 'full') return 'rounded-xl'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-md'; \n case 'large': return 'rounded-2xl'; \n case 'full': return 'rounded-3xl'; \n default: return 'rounded-xl'; \n } \n}); \n \nconst innerBorderRadiusClass = computed(() => { \n if (props.size === 'full') return 'rounded-lg'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-[calc(1.5rem-4px)]'; \n default: return 'rounded-lg'; \n } \n}); \n \nconst positionClasses = computed(() => { \n if (props.position === 'top') return 'items-start justify-center p-4 sm:p-6 pt-[10vh]'; \n return 'items-center justify-center p-4 sm:p-6'; \n}); \n \nconst scrimVariant = computed(() => props.overlay ?? 'blur'); \n</script>\n"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,QAJF,WAIE,KAAA,WAAA,EACF,mBAIE,QAJF,WAIE,GACF,WAAqC,KAAA,QAAA,UAAA,EAAT,OAAK,CAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
|
|
1
|
+
{"version":3,"file":"Modal.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../src/components/feedback/Modal.vue"],"sourcesContent":["<template> \n <Teleport to=\"body\"> \n <Transition :css=\"false\" @enter=\"onOverlayEnter\" @leave=\"onOverlayLeave\" appear> \n <div \n v-if=\"modelValue\" \n ref=\"overlayRef\" \n :class=\"[ \n 'modo-modal-overlay fixed inset-0 z-1200 flex opacity-0', \n positionClasses, \n ]\" \n :style=\"overlayStyle\" \n :data-modo-theme=\"scopedTheme || undefined\" \n @mousedown=\"onOverlayMouseDown\" \n @click=\"onOverlayClick\" \n > \n <!-- Scrim (shared Valux material, dark veil in both modes) -->\n <div\n aria-hidden=\"true\"\n class=\"modo-scrim pointer-events-none absolute inset-0\"\n :data-modo-scrim=\"scrimVariant\"\n />\n <div \n ref=\"panelRef\" \n data-modo-modal-panel \n role=\"dialog\" \n aria-modal=\"true\" \n :aria-labelledby=\"title ? titleId : undefined\" \n :aria-describedby=\"description ? descriptionId : undefined\" \n :aria-label=\"!title ? ariaLabel : undefined\" \n :class=\"[ \n 'modo-modal relative flex flex-col w-full bg-card text-foreground overflow-hidden', \n 'dark:bg-card/85 dark:backdrop-blur-xl', \n 'border border-border shadow-xl outline-none focus:outline-none focus-visible:outline-none', \n sizeClasses, \n radiusClasses, \n ]\" \n tabindex=\"-1\" \n @click.stop \n @keydown=\"onPanelKeydown\" \n > \n <!-- Inner border layer --> \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n :class=\"[ \n 'pointer-events-none absolute inset-1 border border-border/40', \n innerBorderRadiusClass, \n ]\" \n /> \n \n <!-- Close button (usa nuestro Button en modo icono) --> \n <div v-if=\"showClose\" class=\"absolute top-3 right-3 z-10\"> \n <Button \n variant=\"text\" \n size=\"small\" \n :color=\"resolvedColor\" \n :icon=\"XMarkIcon\" \n :ariaLabel=\"closeLabelText\" \n @click=\"close\" \n /> \n </div> \n \n <!-- Content wrapper --> \n <div ref=\"contentRef\" data-modo-modal-content class=\"flex flex-col min-h-0 flex-1\"> \n <!-- Header --> \n <header \n v-if=\"$slots.header || title || description\" \n :class=\"[ \n 'relative flex flex-col gap-1 px-6 pt-6', \n showClose ? 'pr-12' : '', \n $slots.default || $slots.body || $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"header\"> \n <Typography \n v-if=\"title\" \n :id=\"titleId\" \n variant=\"title\" \n size=\"medium\" \n as=\"h2\" \n weight=\"semibold\" \n > \n {{ title }} \n </Typography> \n <Typography \n v-if=\"description\" \n :id=\"descriptionId\" \n variant=\"body\" \n size=\"small\" \n color=\"muted\" \n > \n {{ description }} \n </Typography> \n </slot> \n </header> \n \n <!-- Body --> \n <div \n v-if=\"$slots.default || $slots.body\" \n :class=\"[ \n 'relative flex-1 overflow-auto px-6', \n ($slots.header || title || description) ? '' : 'pt-6', \n $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"body\"> \n <slot /> \n </slot> \n </div> \n \n <!-- Footer (divider respeta inner border con inset) --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-6 py-4\" \n > \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-1 right-1 h-px bg-border/40\" \n /> \n <span \n v-else \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-0 right-0 h-px bg-border\" \n /> \n <slot name=\"footer\" :close=\"close\" /> \n </footer> \n </div> \n </div> \n </div> \n </Transition> \n </Teleport> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onBeforeUnmount, onMounted, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Button from '../forms/Button.vue'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Modal } from '../../interfaces/feedback/Modal.interface'; \nimport { \n useResolvedColor, \n useResolvedRadius, \n useResolvedTheme, \n useModoConfig, \n useModoLocale,\n} from '../../composables/useModoConfig'; \nimport { resolveColorMode } from '../../composables/useColorMode';\nimport { lockBodyScroll, unlockBodyScroll } from '../../composables/useBodyScrollLock';\nimport { palettesToCssVars, semanticTokensFromPalettes } from '../../config/palettes';\nimport { hexToOklchString, pickForegroundOklch } from '../../config/colorPrimitives';\nimport { surfacesToCssVars } from '../../config/surfaces'; \nimport type { ModoColor, ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Modal>(), { \n modelValue: false, \n size: 'medium', \n position: 'center', \n closeOnOverlay: true, \n closeOnEscape: true, \n showClose: true, \n lockScroll: true, \n color: 'default', \n overlay: 'blur', \n innerBorder: true, \n disableOriginAnimation: false, \n});\n// Close button label: prop wins, then the provider locale (`common.close`).\nconst loc = useModoLocale();\nconst closeLabelText = computed(() => props.closeLabel ?? loc.value.common.close);\n \n \nconst emit = defineEmits<{ \n 'update:modelValue': [value: boolean]; \n open: []; \n close: []; \n afterLeave: []; \n}>(); \n \nconst autoId = useId(); \nconst titleId = computed(() => `modo-modal-${autoId}-title`); \nconst descriptionId = computed(() => `modo-modal-${autoId}-desc`); \n \nconst overlayRef = ref<HTMLElement | null>(null); \nconst panelRef = ref<HTMLElement | null>(null); \nconst contentRef = ref<HTMLElement | null>(null); \n \nconst resolvedColor = useResolvedColor(() => props.color as ModoColor | undefined); \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \nconst cfg = useModoConfig(); \nconst theme = useResolvedTheme(); \nconst scopedTheme = computed(() => resolveColorMode(theme.value)); \n \nconst overlayStyle = computed(() => { \n const providerVars = cfg?.value.palettes \n ? { \n ...palettesToCssVars(cfg.value.palettes), \n ...semanticTokensFromPalettes(cfg.value.palettes, hexToOklchString, pickForegroundOklch), \n } \n : {};\n const surfaceVars = cfg?.value.surfaces\n ? surfacesToCssVars(cfg.value.surfaces)\n : {};\n const darkSurfaceVars = (scopedTheme.value === 'dark' && cfg?.value.darkSurfaces)\n ? surfacesToCssVars(cfg.value.darkSurfaces)\n : {};\n return { ...providerVars, ...surfaceVars, ...darkSurfaceVars };\n}); \n \nfunction close() { \n if (!props.modelValue) return; \n emit('update:modelValue', false); \n emit('close'); \n} \n \n/* ---------- Click outside ---------- */ \nlet mouseDownOnOverlay = false; \nfunction onOverlayMouseDown(e: MouseEvent) { \n mouseDownOnOverlay = e.target === overlayRef.value; \n} \nfunction onOverlayClick(e: MouseEvent) { \n if (!props.closeOnOverlay) return; \n if (e.target !== overlayRef.value) return; \n if (!mouseDownOnOverlay) return; \n close(); \n} \n \n/* ---------- Keydown (Escape + focus trap) ---------- */ \nfunction onPanelKeydown(e: KeyboardEvent) { \n if (props.closeOnEscape && e.key === 'Escape') { \n e.preventDefault(); \n close(); \n return; \n } \n if (e.key === 'Tab' && panelRef.value) { \n const focusables = getFocusable(panelRef.value); \n if (focusables.length === 0) { \n e.preventDefault(); \n return; \n } \n const first = focusables[0]; \n const last = focusables[focusables.length - 1]; \n const active = document.activeElement as HTMLElement | null; \n if (e.shiftKey && active === first) { \n e.preventDefault(); \n last.focus(); \n } else if (!e.shiftKey && active === last) { \n e.preventDefault(); \n first.focus(); \n } \n } \n} \n \nconst FOCUSABLE_SELECTOR = \n 'a[href], area[href], input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]'; \n \nfunction getFocusable(container: HTMLElement): HTMLElement[] { \n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)) \n .filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null); \n} \n \n/* ---------- Animations (staged open/close) ---------- */ \n \nfunction prefersReducedMotion() { \n return typeof window !== 'undefined' \n && window.matchMedia('(prefers-reduced-motion: reduce)').matches; \n} \n \nlet capturedOrigin: HTMLElement | null = null; \nlet lastPointerTrigger: { el: HTMLElement; time: number } | null = null;\n\nfunction onWindowPointerDown(e: PointerEvent) {\n const target = e.target as Element | null;\n const trigger = target?.closest?.('button, a, [role=\"button\"], [tabindex]') as HTMLElement | null;\n if (trigger) {\n lastPointerTrigger = { el: trigger, time: Date.now() };\n }\n}\n\nfunction getOriginEl(): HTMLElement | null { \n if (props.origin) return props.origin; \n return capturedOrigin; \n} \n \nlet activeTimeline: gsap.core.Timeline | null = null; \n \nfunction onOverlayEnter(el: Element, done: () => void) { \n const overlay = (el as HTMLElement) ?? overlayRef.value; \n const panel = \n overlay?.querySelector<HTMLElement>('[data-modo-modal-panel]') \n ?? panelRef.value; \n if (!overlay || !panel) { done(); return; } \n \n activeTimeline?.kill(); \n \n if (prefersReducedMotion()) { \n gsap.set([overlay, panel], { opacity: 1, clearProps: 'transform' }); \n done(); \n return; \n } \n \n const origin = !props.disableOriginAnimation ? getOriginEl() : null; \n const pRect = panel.getBoundingClientRect(); \n \n const tl = gsap.timeline({ onComplete: () => { activeTimeline = null; done(); } }); \n activeTimeline = tl; \n \n // 1. Overlay fade in \n tl.fromTo(overlay, { opacity: 0 }, { opacity: 1, duration: 0.25, ease: 'power2.out' }, 0); \n \n // 2. Panel + contenido emergen juntos desde el trigger hasta su tamaño real\n if (origin && document.body.contains(origin)) { \n const oRect = origin.getBoundingClientRect(); \n const dx = oRect.left + oRect.width / 2 - (pRect.left + pRect.width / 2); \n const dy = oRect.top + oRect.height / 2 - (pRect.top + pRect.height / 2); \n const scaleX = Math.max(oRect.width / pRect.width, 0.05); \n const scaleY = Math.max(oRect.height / pRect.height, 0.05); \n tl.fromTo( \n panel, \n { x: dx, y: dy, scaleX, scaleY, opacity: 0.85, transformOrigin: 'center center' }, \n { x: 0, y: 0, scaleX: 1, scaleY: 1, opacity: 1, duration: 0.5, ease: 'power3.out' }, \n 0.05, \n ); \n } else { \n tl.fromTo( \n panel, \n { y: 16, scale: 0.95, opacity: 0 }, \n { y: 0, scale: 1, opacity: 1, duration: 0.35, ease: 'power2.out' }, \n 0, \n ); \n } \n} \n \nfunction onOverlayLeave(el: Element, done: () => void) { \n // Durante el leave, los template refs de Vue ya fueron desvinculados, \n // así que resolvemos los nodos desde el elemento que Transition nos entrega. \n const overlay = el as HTMLElement; \n const panel = \n overlay.querySelector<HTMLElement>('[data-modo-modal-panel]') \n ?? panelRef.value; \n // Bail out without animating, but never without releasing the lock — this\n // path is the one that used to strand `overflow: hidden` on <body>.\n if (!overlay || !panel) { releaseScrollLock(); done(); return; }\n\n activeTimeline?.kill();\n\n if (prefersReducedMotion()) {\n gsap.to(overlay, {\n opacity: 0,\n duration: 0.12,\n onComplete: () => { releaseScrollLock(); done(); },\n });\n return;\n }\n\n const origin = !props.disableOriginAnimation ? getOriginEl() : null; \n const pRect = panel.getBoundingClientRect(); \n \n const tl = gsap.timeline({ \n onComplete: () => { \n activeTimeline = null; \n releaseScrollLock(); \n done(); \n }, \n }); \n activeTimeline = tl; \n \n // El panel regresa con todo su contenido visible hacia su lugar de origen;\n // el overlay (padre del panel) solo cae en opacidad al final del recorrido\n // para no ocultar el vuelo de regreso antes de llegar al trigger.\n if (origin && document.body.contains(origin)) { \n const oRect = origin.getBoundingClientRect(); \n const dx = oRect.left + oRect.width / 2 - (pRect.left + pRect.width / 2); \n const dy = oRect.top + oRect.height / 2 - (pRect.top + pRect.height / 2); \n const scaleX = Math.max(oRect.width / pRect.width, 0.05); \n const scaleY = Math.max(oRect.height / pRect.height, 0.05); \n tl.to( \n panel, \n { x: dx, y: dy, scaleX, scaleY, transformOrigin: 'center center', duration: 0.38, ease: 'power3.in' }, \n 0, \n ); \n tl.to(overlay, { opacity: 0, duration: 0.28, ease: 'power3.in' }, 0.1); \n } else { \n tl.to( \n panel, \n { y: 10, scale: 0.95, opacity: 0, duration: 0.24, ease: 'power2.in' }, \n 0, \n ); \n tl.to(overlay, { opacity: 0, duration: 0.24, ease: 'power2.in' }, 0.04); \n } \n} \n \n/* ---------- Scroll lock + focus management ---------- */\nlet previouslyFocused: HTMLElement | null = null;\nlet scrollLocked = false;\n\nfunction releaseScrollLock() {\n if (!scrollLocked) return;\n scrollLocked = false;\n unlockBodyScroll();\n}\n\nonMounted(() => {\n if (typeof window !== 'undefined') {\n window.addEventListener('pointerdown', onWindowPointerDown, { capture: true, passive: true });\n }\n});\n\nwatch( \n () => props.modelValue, \n (open) => { \n if (open) { \n const active = document.activeElement as HTMLElement | null; \n const recentPointer =\n lastPointerTrigger\n && Date.now() - lastPointerTrigger.time < 600\n && document.body.contains(lastPointerTrigger.el)\n ? lastPointerTrigger.el\n : null;\n const triggerEl =\n active && active !== document.body && active !== document.documentElement\n ? active\n : recentPointer;\n previouslyFocused = triggerEl; \n capturedOrigin = triggerEl; \n \n if (props.lockScroll && !scrollLocked) {\n scrollLocked = true;\n lockBodyScroll();\n }\n emit('open'); \n nextTick(() => { \n if (!panelRef.value) return; \n const focusables = getFocusable(panelRef.value); \n (focusables[0] ?? panelRef.value).focus(); \n }); \n } else { \n // El scroll lock se libera en onOverlayLeave cuando termina la \n // animación, para evitar que aparezca el scrollbar y empuje el \n // modal antes de que desaparezca. \n if (previouslyFocused && typeof previouslyFocused.focus === 'function') { \n previouslyFocused.focus(); \n } \n previouslyFocused = null; \n emit('afterLeave'); \n } \n }, \n); \n \nonBeforeUnmount(() => { \n if (typeof window !== 'undefined') {\n window.removeEventListener('pointerdown', onWindowPointerDown, { capture: true });\n }\n activeTimeline?.kill(); \n releaseScrollLock(); \n}); \n \n/* ---------- Style maps ---------- */ \nconst sizeClasses = computed(() => { \n switch (props.size) { \n case 'xsmall': return 'max-w-xs';\n case 'small': return 'max-w-sm'; \n case 'large': return 'max-w-2xl'; \n case 'xlarge': return 'max-w-4xl'; \n case 'full': return 'max-w-none w-[calc(100vw-2rem)] h-[calc(100vh-2rem)]'; \n default: return 'max-w-md'; \n } \n}); \n \nconst radiusClasses = computed(() => { \n if (props.size === 'full') return 'rounded-xl'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-md'; \n case 'large': return 'rounded-2xl'; \n case 'full': return 'rounded-3xl'; \n default: return 'rounded-xl'; \n } \n}); \n \nconst innerBorderRadiusClass = computed(() => { \n if (props.size === 'full') return 'rounded-lg'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-[calc(1.5rem-4px)]'; \n default: return 'rounded-lg'; \n } \n}); \n \nconst positionClasses = computed(() => { \n if (props.position === 'top') return 'items-start justify-center p-4 sm:p-6 pt-[10vh]'; \n return 'items-center justify-center p-4 sm:p-6'; \n}); \n \nconst scrimVariant = computed(() => props.overlay ?? 'blur'); \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+PA,IAAM,qBACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EArGJ,MAAM,QAAQ;EAcd,MAAM,MAAM,eAAe;EAC3B,MAAM,iBAAiB,eAAe,MAAM,cAAc,IAAI,MAAM,OAAO,MAAM;EAGjF,MAAM,OAAO;EAOb,MAAM,SAAS,OAAO;EACtB,MAAM,UAAU,eAAe,cAAc,OAAO,QAAQ;EAC5D,MAAM,gBAAgB,eAAe,cAAc,OAAO,OAAO;EAEjE,MAAM,aAAa,IAAwB,KAAK;EAChD,MAAM,WAAW,IAAwB,KAAK;EAC9C,MAAM,aAAa,IAAwB,KAAK;EAEhD,MAAM,gBAAgB,uBAAuB,MAAM,MAA+B;EAClF,MAAM,iBAAiB,wBAAwB,MAAM,OAAiC;EAEtF,MAAM,MAAM,eAAe;EAC3B,MAAM,QAAQ,kBAAkB;EAChC,MAAM,cAAc,eAAe,iBAAiB,MAAM,MAAM,CAAC;EAEjE,MAAM,eAAe,eAAe;GAChC,MAAM,eAAe,KAAK,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AA,gBAAA,gBAAR,QAAA,MAAK,EAAA,EAAA,CAAA,CAAA;;qDAGF,QAAA,eAAA,WAAA,EADV,YAQa,oBAAA;;OANR,IAAI,cAAA;OACL,SAAQ;OACR,MAAK;OACL,OAAM;;8BAEW,CAAA,gBAAA,gBAAd,QAAA,YAAW,EAAA,EAAA,CAAA,CAAA;;;MAOhBA,KAAAA,OAAO,WAAWA,KAAAA,OAAO,QAAA,WAAA,EADnC,mBAWM,OAAA;;OATD,OAAK,eAAA;;QAA6GA,KAAAA,OAAO,UAAU,QAAA,SAAS,QAAA,cAAW,KAAA;QAAkDA,KAAAA,OAAO,SAAM,SAAA;;UAMvN,WAEO,KAAA,QAAA,QAAA,EAAA,QAAA,CADH,WAAQ,KAAA,QAAA,UAAA,CAAA,CAAA,CAAA,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;MAMNA,KAAAA,OAAO,UAAA,WAAA,EADjB,mBAeS,UAfT,YAeS,CAVK,QAAA,eAAA,WAAA,EADV,mBAIE,QAJF,WAIE,KAAA,WAAA,EACF,mBAIE,QAJF,WAIE,GACF,WAAqC,KAAA,QAAA,UAAA,EAAT,OAAK,CAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
|
|
@@ -2,7 +2,7 @@ const require__plugin_vue_export_helper = require("../../_virtual/_plugin-vue_ex
|
|
|
2
2
|
const require_Toast_vue_vue_type_script_setup_true_lang = require("./Toast.vue_vue_type_script_setup_true_lang.cjs");
|
|
3
3
|
;/* empty css */
|
|
4
4
|
//#region src/components/feedback/Toast.vue
|
|
5
|
-
var Toast_default = /* @__PURE__ */ require__plugin_vue_export_helper.default(require_Toast_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-
|
|
5
|
+
var Toast_default = /* @__PURE__ */ require__plugin_vue_export_helper.default(require_Toast_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-75a66e0b"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
exports.default = Toast_default;
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.cjs","names":[],"sources":["../../../src/components/feedback/Toast.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n 'modo-toast pointer-events-auto relative flex items-start gap-3 p-3.5 shadow-md',\n colorClasses,\n radiusClasses,\n 'min-w-72 max-w-sm w-full pb-4',\n ]\"\n role=\"status\"\n aria-live=\"polite\"\n @mouseenter=\"$emit('pointer-enter')\"\n @mouseleave=\"$emit('pointer-leave')\"\n >\n <!-- Icon badge -->\n <div\n v-if=\"!entry.hideIcon\"\n :class=\"[\n 'shrink-0 flex items-center justify-center w-8 h-8 rounded-full',\n iconBadgeClasses,\n iconTextClasses,\n ]\"\n >\n <component\n :is=\"resolvedIcon\"\n class=\"w-5 h-5\"\n aria-hidden=\"true\"\n />\n </div>\n\n <!-- Content -->\n <div class=\"flex-1 min-w-0 pt-0.5\">\n <p v-if=\"entry.title\" :class=\"['text-[13px] font-semibold leading-snug break-words', titleColorClasses]\">\n {{ entry.title }}\n </p>\n <p\n v-if=\"entry.description\"\n :class=\"[\n entry.title ? 'mt-0.5' : '',\n 'text-[13px] leading-snug break-words',\n descriptionColorClasses,\n ]\"\n >\n {{ entry.description }}\n </p>\n\n <div v-if=\"entry.action\" class=\"mt-2\">\n <button\n type=\"button\"\n :class=\"['text-xs font-semibold underline-offset-2 hover:underline focus:outline-none focus-visible:underline transition-colors', actionColorClasses]\"\n @click=\"onAction\"\n >\n {{ entry.action.label }}\n </button>\n </div>\n </div>\n\n <!-- Dismiss -->\n <button\n v-if=\"entry.dismissable\"\n type=\"button\"\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center w-6 h-6 rounded-md',\n 'transition-colors duration-fast ease-standard',\n 'focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1',\n dismissClasses,\n ]\"\n aria-label=\"
|
|
1
|
+
{"version":3,"file":"Toast.cjs","names":[],"sources":["../../../src/components/feedback/Toast.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n 'modo-toast pointer-events-auto relative flex items-start gap-3 p-3.5 shadow-md',\n colorClasses,\n radiusClasses,\n 'min-w-72 max-w-sm w-full pb-4',\n ]\"\n role=\"status\"\n aria-live=\"polite\"\n @mouseenter=\"$emit('pointer-enter')\"\n @mouseleave=\"$emit('pointer-leave')\"\n >\n <!-- Icon badge -->\n <div\n v-if=\"!entry.hideIcon\"\n :class=\"[\n 'shrink-0 flex items-center justify-center w-8 h-8 rounded-full',\n iconBadgeClasses,\n iconTextClasses,\n ]\"\n >\n <component\n :is=\"resolvedIcon\"\n class=\"w-5 h-5\"\n aria-hidden=\"true\"\n />\n </div>\n\n <!-- Content -->\n <div class=\"flex-1 min-w-0 pt-0.5\">\n <p v-if=\"entry.title\" :class=\"['text-[13px] font-semibold leading-snug break-words', titleColorClasses]\">\n {{ entry.title }}\n </p>\n <p\n v-if=\"entry.description\"\n :class=\"[\n entry.title ? 'mt-0.5' : '',\n 'text-[13px] leading-snug break-words',\n descriptionColorClasses,\n ]\"\n >\n {{ entry.description }}\n </p>\n\n <div v-if=\"entry.action\" class=\"mt-2\">\n <button\n type=\"button\"\n :class=\"['text-xs font-semibold underline-offset-2 hover:underline focus:outline-none focus-visible:underline transition-colors', actionColorClasses]\"\n @click=\"onAction\"\n >\n {{ entry.action.label }}\n </button>\n </div>\n </div>\n\n <!-- Dismiss -->\n <button\n v-if=\"entry.dismissable\"\n type=\"button\"\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center w-6 h-6 rounded-md',\n 'transition-colors duration-fast ease-standard',\n 'focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1',\n dismissClasses,\n ]\"\n :aria-label=\"loc.toast.dismiss\"\n @click=\"$emit('dismiss')\"\n >\n <XMarkIcon class=\"w-3.5 h-3.5\" aria-hidden=\"true\" />\n </button>\n\n <!-- Bottom progress bar (auto-dismiss countdown) -->\n <div\n v-if=\"entry.duration > 0\"\n class=\"absolute left-2 right-2 bottom-1.5 h-0.5 rounded-full overflow-hidden\"\n :class=\"trackClasses\"\n >\n <div\n class=\"h-full rounded-full origin-left\"\n :class=\"barClasses\"\n :style=\"progressStyle\"\n />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport {\n XMarkIcon,\n CheckCircleIcon,\n ExclamationTriangleIcon,\n XCircleIcon,\n InformationCircleIcon,\n} from '@heroicons/vue/24/outline';\nimport type { ToastEntry } from '../../interfaces/feedback/Toast.interface';\nimport { useModoLocale, useResolvedRadius } from '../../composables/useModoConfig';\n\nconst props = defineProps<{\n entry: ToastEntry;\n /** Time elapsed in ms since push (driven by the container). */\n elapsed: number;\n /** Whether the auto-dismiss timer is currently paused. */\n paused: boolean;\n}>();\n\nconst loc = useModoLocale();\n\nconst emit = defineEmits<{\n dismiss: [];\n 'pointer-enter': [];\n 'pointer-leave': [];\n}>();\n\nconst resolvedRadius = useResolvedRadius(() => props.entry.radius);\n\nconst radiusClasses = computed(() => {\n switch (resolvedRadius.value) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded-sm';\n case 'large': return 'rounded-xl';\n case 'full': return 'rounded-2xl';\n case 'medium':\n default: return 'rounded-lg';\n }\n});\n\nconst resolvedIcon = computed(() => {\n if (props.entry.icon) return props.entry.icon;\n switch (props.entry.color) {\n case 'success': return CheckCircleIcon;\n case 'warning': return ExclamationTriangleIcon;\n case 'danger': return XCircleIcon;\n case 'info':\n default: return InformationCircleIcon;\n }\n});\n\n/* ── Card background & border ── */\nconst colorClasses = computed(() => {\n const { color, variant } = props.entry;\n const map: Record<string, Record<string, string>> = {\n info: {\n filled: 'bg-info text-info-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-info/40',\n },\n success: {\n filled: 'bg-success text-success-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-success/40',\n },\n warning: {\n filled: 'bg-warning text-warning-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-warning/40',\n },\n danger: {\n filled: 'bg-destructive text-destructive-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-destructive/40',\n },\n };\n return map[color][variant];\n});\n\n/* ── Icon container — sets currentColor for SVG ring + icon ── */\nconst iconTextClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'text-current/90';\n const map: Record<string, string> = {\n info: 'text-info',\n success: 'text-success',\n warning: 'text-warning',\n danger: 'text-destructive',\n };\n return map[props.entry.color];\n});\n\n/* ── Icon badge background ── */\nconst iconBadgeClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/15';\n const map: Record<string, string> = {\n info: 'bg-info/10',\n success: 'bg-success/10',\n warning: 'bg-warning/10',\n danger: 'bg-destructive/10',\n };\n return map[props.entry.color];\n});\n\n/* ── Text ── */\nconst titleColorClasses = computed(() =>\n props.entry.variant === 'filled' ? '' : 'text-foreground',\n);\n\nconst descriptionColorClasses = computed(() =>\n props.entry.variant === 'filled' ? 'opacity-85' : 'text-muted-foreground',\n);\n\nconst actionColorClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'text-current/90 hover:text-current';\n const map: Record<string, string> = {\n info: 'text-info',\n success: 'text-success',\n warning: 'text-warning',\n danger: 'text-destructive',\n };\n return map[props.entry.color];\n});\n\nconst dismissClasses = computed(() =>\n props.entry.variant === 'filled'\n ? 'text-current/70 hover:text-current hover:bg-current/10'\n : 'text-muted-foreground hover:text-foreground hover:bg-muted',\n);\n\n/* ── Bottom progress bar ── */\nconst trackClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/20';\n const map: Record<string, string> = {\n info: 'bg-info/15',\n success: 'bg-success/15',\n warning: 'bg-warning/15',\n danger: 'bg-destructive/15',\n };\n return map[props.entry.color];\n});\n\nconst barClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/60';\n const map: Record<string, string> = {\n info: 'bg-info/70',\n success: 'bg-success/70',\n warning: 'bg-warning/70',\n danger: 'bg-destructive/70',\n };\n return map[props.entry.color];\n});\n\nconst progressStyle = computed(() => {\n const total = props.entry.duration;\n if (!total) return { transform: 'scaleX(1)' };\n const remaining = Math.max(0, total - props.elapsed) / total;\n return {\n transform: `scaleX(${remaining})`,\n transition: props.paused ? 'none' : 'transform 100ms linear',\n };\n});\n\nfunction onAction() {\n const action = props.entry.action;\n if (!action) return;\n const close = () => emit('dismiss');\n action.onClick?.(close);\n if (!action.keepOpen) close();\n}\n</script>\n\n<style scoped>\n@media (prefers-reduced-motion: reduce) {\n .modo-toast {\n transition: none !important;\n }\n}\n</style>\n\n"],"mappings":""}
|
|
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export
|
|
|
2
2
|
import Toast_vue_vue_type_script_setup_true_lang_default from "./Toast.vue_vue_type_script_setup_true_lang.mjs";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/components/feedback/Toast.vue
|
|
5
|
-
var Toast_default = /* @__PURE__ */ _plugin_vue_export_helper_default(Toast_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var Toast_default = /* @__PURE__ */ _plugin_vue_export_helper_default(Toast_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-75a66e0b"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Toast_default as default };
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.mjs","names":[],"sources":["../../../src/components/feedback/Toast.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n 'modo-toast pointer-events-auto relative flex items-start gap-3 p-3.5 shadow-md',\n colorClasses,\n radiusClasses,\n 'min-w-72 max-w-sm w-full pb-4',\n ]\"\n role=\"status\"\n aria-live=\"polite\"\n @mouseenter=\"$emit('pointer-enter')\"\n @mouseleave=\"$emit('pointer-leave')\"\n >\n <!-- Icon badge -->\n <div\n v-if=\"!entry.hideIcon\"\n :class=\"[\n 'shrink-0 flex items-center justify-center w-8 h-8 rounded-full',\n iconBadgeClasses,\n iconTextClasses,\n ]\"\n >\n <component\n :is=\"resolvedIcon\"\n class=\"w-5 h-5\"\n aria-hidden=\"true\"\n />\n </div>\n\n <!-- Content -->\n <div class=\"flex-1 min-w-0 pt-0.5\">\n <p v-if=\"entry.title\" :class=\"['text-[13px] font-semibold leading-snug break-words', titleColorClasses]\">\n {{ entry.title }}\n </p>\n <p\n v-if=\"entry.description\"\n :class=\"[\n entry.title ? 'mt-0.5' : '',\n 'text-[13px] leading-snug break-words',\n descriptionColorClasses,\n ]\"\n >\n {{ entry.description }}\n </p>\n\n <div v-if=\"entry.action\" class=\"mt-2\">\n <button\n type=\"button\"\n :class=\"['text-xs font-semibold underline-offset-2 hover:underline focus:outline-none focus-visible:underline transition-colors', actionColorClasses]\"\n @click=\"onAction\"\n >\n {{ entry.action.label }}\n </button>\n </div>\n </div>\n\n <!-- Dismiss -->\n <button\n v-if=\"entry.dismissable\"\n type=\"button\"\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center w-6 h-6 rounded-md',\n 'transition-colors duration-fast ease-standard',\n 'focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1',\n dismissClasses,\n ]\"\n aria-label=\"
|
|
1
|
+
{"version":3,"file":"Toast.mjs","names":[],"sources":["../../../src/components/feedback/Toast.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n 'modo-toast pointer-events-auto relative flex items-start gap-3 p-3.5 shadow-md',\n colorClasses,\n radiusClasses,\n 'min-w-72 max-w-sm w-full pb-4',\n ]\"\n role=\"status\"\n aria-live=\"polite\"\n @mouseenter=\"$emit('pointer-enter')\"\n @mouseleave=\"$emit('pointer-leave')\"\n >\n <!-- Icon badge -->\n <div\n v-if=\"!entry.hideIcon\"\n :class=\"[\n 'shrink-0 flex items-center justify-center w-8 h-8 rounded-full',\n iconBadgeClasses,\n iconTextClasses,\n ]\"\n >\n <component\n :is=\"resolvedIcon\"\n class=\"w-5 h-5\"\n aria-hidden=\"true\"\n />\n </div>\n\n <!-- Content -->\n <div class=\"flex-1 min-w-0 pt-0.5\">\n <p v-if=\"entry.title\" :class=\"['text-[13px] font-semibold leading-snug break-words', titleColorClasses]\">\n {{ entry.title }}\n </p>\n <p\n v-if=\"entry.description\"\n :class=\"[\n entry.title ? 'mt-0.5' : '',\n 'text-[13px] leading-snug break-words',\n descriptionColorClasses,\n ]\"\n >\n {{ entry.description }}\n </p>\n\n <div v-if=\"entry.action\" class=\"mt-2\">\n <button\n type=\"button\"\n :class=\"['text-xs font-semibold underline-offset-2 hover:underline focus:outline-none focus-visible:underline transition-colors', actionColorClasses]\"\n @click=\"onAction\"\n >\n {{ entry.action.label }}\n </button>\n </div>\n </div>\n\n <!-- Dismiss -->\n <button\n v-if=\"entry.dismissable\"\n type=\"button\"\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center w-6 h-6 rounded-md',\n 'transition-colors duration-fast ease-standard',\n 'focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1',\n dismissClasses,\n ]\"\n :aria-label=\"loc.toast.dismiss\"\n @click=\"$emit('dismiss')\"\n >\n <XMarkIcon class=\"w-3.5 h-3.5\" aria-hidden=\"true\" />\n </button>\n\n <!-- Bottom progress bar (auto-dismiss countdown) -->\n <div\n v-if=\"entry.duration > 0\"\n class=\"absolute left-2 right-2 bottom-1.5 h-0.5 rounded-full overflow-hidden\"\n :class=\"trackClasses\"\n >\n <div\n class=\"h-full rounded-full origin-left\"\n :class=\"barClasses\"\n :style=\"progressStyle\"\n />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport {\n XMarkIcon,\n CheckCircleIcon,\n ExclamationTriangleIcon,\n XCircleIcon,\n InformationCircleIcon,\n} from '@heroicons/vue/24/outline';\nimport type { ToastEntry } from '../../interfaces/feedback/Toast.interface';\nimport { useModoLocale, useResolvedRadius } from '../../composables/useModoConfig';\n\nconst props = defineProps<{\n entry: ToastEntry;\n /** Time elapsed in ms since push (driven by the container). */\n elapsed: number;\n /** Whether the auto-dismiss timer is currently paused. */\n paused: boolean;\n}>();\n\nconst loc = useModoLocale();\n\nconst emit = defineEmits<{\n dismiss: [];\n 'pointer-enter': [];\n 'pointer-leave': [];\n}>();\n\nconst resolvedRadius = useResolvedRadius(() => props.entry.radius);\n\nconst radiusClasses = computed(() => {\n switch (resolvedRadius.value) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded-sm';\n case 'large': return 'rounded-xl';\n case 'full': return 'rounded-2xl';\n case 'medium':\n default: return 'rounded-lg';\n }\n});\n\nconst resolvedIcon = computed(() => {\n if (props.entry.icon) return props.entry.icon;\n switch (props.entry.color) {\n case 'success': return CheckCircleIcon;\n case 'warning': return ExclamationTriangleIcon;\n case 'danger': return XCircleIcon;\n case 'info':\n default: return InformationCircleIcon;\n }\n});\n\n/* ── Card background & border ── */\nconst colorClasses = computed(() => {\n const { color, variant } = props.entry;\n const map: Record<string, Record<string, string>> = {\n info: {\n filled: 'bg-info text-info-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-info/40',\n },\n success: {\n filled: 'bg-success text-success-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-success/40',\n },\n warning: {\n filled: 'bg-warning text-warning-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-warning/40',\n },\n danger: {\n filled: 'bg-destructive text-destructive-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-destructive/40',\n },\n };\n return map[color][variant];\n});\n\n/* ── Icon container — sets currentColor for SVG ring + icon ── */\nconst iconTextClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'text-current/90';\n const map: Record<string, string> = {\n info: 'text-info',\n success: 'text-success',\n warning: 'text-warning',\n danger: 'text-destructive',\n };\n return map[props.entry.color];\n});\n\n/* ── Icon badge background ── */\nconst iconBadgeClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/15';\n const map: Record<string, string> = {\n info: 'bg-info/10',\n success: 'bg-success/10',\n warning: 'bg-warning/10',\n danger: 'bg-destructive/10',\n };\n return map[props.entry.color];\n});\n\n/* ── Text ── */\nconst titleColorClasses = computed(() =>\n props.entry.variant === 'filled' ? '' : 'text-foreground',\n);\n\nconst descriptionColorClasses = computed(() =>\n props.entry.variant === 'filled' ? 'opacity-85' : 'text-muted-foreground',\n);\n\nconst actionColorClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'text-current/90 hover:text-current';\n const map: Record<string, string> = {\n info: 'text-info',\n success: 'text-success',\n warning: 'text-warning',\n danger: 'text-destructive',\n };\n return map[props.entry.color];\n});\n\nconst dismissClasses = computed(() =>\n props.entry.variant === 'filled'\n ? 'text-current/70 hover:text-current hover:bg-current/10'\n : 'text-muted-foreground hover:text-foreground hover:bg-muted',\n);\n\n/* ── Bottom progress bar ── */\nconst trackClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/20';\n const map: Record<string, string> = {\n info: 'bg-info/15',\n success: 'bg-success/15',\n warning: 'bg-warning/15',\n danger: 'bg-destructive/15',\n };\n return map[props.entry.color];\n});\n\nconst barClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/60';\n const map: Record<string, string> = {\n info: 'bg-info/70',\n success: 'bg-success/70',\n warning: 'bg-warning/70',\n danger: 'bg-destructive/70',\n };\n return map[props.entry.color];\n});\n\nconst progressStyle = computed(() => {\n const total = props.entry.duration;\n if (!total) return { transform: 'scaleX(1)' };\n const remaining = Math.max(0, total - props.elapsed) / total;\n return {\n transform: `scaleX(${remaining})`,\n transition: props.paused ? 'none' : 'transform 100ms linear',\n };\n});\n\nfunction onAction() {\n const action = props.entry.action;\n if (!action) return;\n const close = () => emit('dismiss');\n action.onClick?.(close);\n if (!action.keepOpen) close();\n}\n</script>\n\n<style scoped>\n@media (prefers-reduced-motion: reduce) {\n .modo-toast {\n transition: none !important;\n }\n}\n</style>\n\n"],"mappings":""}
|
|
@@ -8,6 +8,7 @@ var _hoisted_2 = {
|
|
|
8
8
|
key: 2,
|
|
9
9
|
class: "mt-2"
|
|
10
10
|
};
|
|
11
|
+
var _hoisted_3 = ["aria-label"];
|
|
11
12
|
var Toast_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
12
13
|
__name: "Toast",
|
|
13
14
|
props: {
|
|
@@ -22,6 +23,7 @@ var Toast_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.
|
|
|
22
23
|
],
|
|
23
24
|
setup(__props, { emit: __emit }) {
|
|
24
25
|
const props = __props;
|
|
26
|
+
const loc = require_useModoConfig.useModoLocale();
|
|
25
27
|
const emit = __emit;
|
|
26
28
|
const resolvedRadius = require_useModoConfig.useResolvedRadius(() => props.entry.radius);
|
|
27
29
|
const radiusClasses = (0, vue.computed)(() => {
|
|
@@ -182,12 +184,12 @@ var Toast_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.
|
|
|
182
184
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",
|
|
183
185
|
dismissClasses.value
|
|
184
186
|
]),
|
|
185
|
-
"aria-label":
|
|
187
|
+
"aria-label": (0, vue.unref)(loc).toast.dismiss,
|
|
186
188
|
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("dismiss"))
|
|
187
189
|
}, [(0, vue.createVNode)((0, vue.unref)(_heroicons_vue_24_outline.XMarkIcon), {
|
|
188
190
|
class: "w-3.5 h-3.5",
|
|
189
191
|
"aria-hidden": "true"
|
|
190
|
-
})],
|
|
192
|
+
})], 10, _hoisted_3)) : (0, vue.createCommentVNode)("", true),
|
|
191
193
|
__props.entry.duration > 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
192
194
|
key: 2,
|
|
193
195
|
class: (0, vue.normalizeClass)(["absolute left-2 right-2 bottom-1.5 h-0.5 rounded-full overflow-hidden", trackClasses.value])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.vue_vue_type_script_setup_true_lang.cjs","names":["$emit"],"sources":["../../../src/components/feedback/Toast.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n 'modo-toast pointer-events-auto relative flex items-start gap-3 p-3.5 shadow-md',\n colorClasses,\n radiusClasses,\n 'min-w-72 max-w-sm w-full pb-4',\n ]\"\n role=\"status\"\n aria-live=\"polite\"\n @mouseenter=\"$emit('pointer-enter')\"\n @mouseleave=\"$emit('pointer-leave')\"\n >\n <!-- Icon badge -->\n <div\n v-if=\"!entry.hideIcon\"\n :class=\"[\n 'shrink-0 flex items-center justify-center w-8 h-8 rounded-full',\n iconBadgeClasses,\n iconTextClasses,\n ]\"\n >\n <component\n :is=\"resolvedIcon\"\n class=\"w-5 h-5\"\n aria-hidden=\"true\"\n />\n </div>\n\n <!-- Content -->\n <div class=\"flex-1 min-w-0 pt-0.5\">\n <p v-if=\"entry.title\" :class=\"['text-[13px] font-semibold leading-snug break-words', titleColorClasses]\">\n {{ entry.title }}\n </p>\n <p\n v-if=\"entry.description\"\n :class=\"[\n entry.title ? 'mt-0.5' : '',\n 'text-[13px] leading-snug break-words',\n descriptionColorClasses,\n ]\"\n >\n {{ entry.description }}\n </p>\n\n <div v-if=\"entry.action\" class=\"mt-2\">\n <button\n type=\"button\"\n :class=\"['text-xs font-semibold underline-offset-2 hover:underline focus:outline-none focus-visible:underline transition-colors', actionColorClasses]\"\n @click=\"onAction\"\n >\n {{ entry.action.label }}\n </button>\n </div>\n </div>\n\n <!-- Dismiss -->\n <button\n v-if=\"entry.dismissable\"\n type=\"button\"\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center w-6 h-6 rounded-md',\n 'transition-colors duration-fast ease-standard',\n 'focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1',\n dismissClasses,\n ]\"\n aria-label=\"Dismiss notification\"\n @click=\"$emit('dismiss')\"\n >\n <XMarkIcon class=\"w-3.5 h-3.5\" aria-hidden=\"true\" />\n </button>\n\n <!-- Bottom progress bar (auto-dismiss countdown) -->\n <div\n v-if=\"entry.duration > 0\"\n class=\"absolute left-2 right-2 bottom-1.5 h-0.5 rounded-full overflow-hidden\"\n :class=\"trackClasses\"\n >\n <div\n class=\"h-full rounded-full origin-left\"\n :class=\"barClasses\"\n :style=\"progressStyle\"\n />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport {\n XMarkIcon,\n CheckCircleIcon,\n ExclamationTriangleIcon,\n XCircleIcon,\n InformationCircleIcon,\n} from '@heroicons/vue/24/outline';\nimport type { ToastEntry } from '../../interfaces/feedback/Toast.interface';\nimport { useResolvedRadius } from '../../composables/useModoConfig';\n\nconst props = defineProps<{\n entry: ToastEntry;\n /** Time elapsed in ms since push (driven by the container). */\n elapsed: number;\n /** Whether the auto-dismiss timer is currently paused. */\n paused: boolean;\n}>();\n\nconst emit = defineEmits<{\n dismiss: [];\n 'pointer-enter': [];\n 'pointer-leave': [];\n}>();\n\nconst resolvedRadius = useResolvedRadius(() => props.entry.radius);\n\nconst radiusClasses = computed(() => {\n switch (resolvedRadius.value) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded-sm';\n case 'large': return 'rounded-xl';\n case 'full': return 'rounded-2xl';\n case 'medium':\n default: return 'rounded-lg';\n }\n});\n\nconst resolvedIcon = computed(() => {\n if (props.entry.icon) return props.entry.icon;\n switch (props.entry.color) {\n case 'success': return CheckCircleIcon;\n case 'warning': return ExclamationTriangleIcon;\n case 'danger': return XCircleIcon;\n case 'info':\n default: return InformationCircleIcon;\n }\n});\n\n/* ── Card background & border ── */\nconst colorClasses = computed(() => {\n const { color, variant } = props.entry;\n const map: Record<string, Record<string, string>> = {\n info: {\n filled: 'bg-info text-info-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-info/40',\n },\n success: {\n filled: 'bg-success text-success-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-success/40',\n },\n warning: {\n filled: 'bg-warning text-warning-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-warning/40',\n },\n danger: {\n filled: 'bg-destructive text-destructive-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-destructive/40',\n },\n };\n return map[color][variant];\n});\n\n/* ── Icon container — sets currentColor for SVG ring + icon ── */\nconst iconTextClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'text-current/90';\n const map: Record<string, string> = {\n info: 'text-info',\n success: 'text-success',\n warning: 'text-warning',\n danger: 'text-destructive',\n };\n return map[props.entry.color];\n});\n\n/* ── Icon badge background ── */\nconst iconBadgeClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/15';\n const map: Record<string, string> = {\n info: 'bg-info/10',\n success: 'bg-success/10',\n warning: 'bg-warning/10',\n danger: 'bg-destructive/10',\n };\n return map[props.entry.color];\n});\n\n/* ── Text ── */\nconst titleColorClasses = computed(() =>\n props.entry.variant === 'filled' ? '' : 'text-foreground',\n);\n\nconst descriptionColorClasses = computed(() =>\n props.entry.variant === 'filled' ? 'opacity-85' : 'text-muted-foreground',\n);\n\nconst actionColorClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'text-current/90 hover:text-current';\n const map: Record<string, string> = {\n info: 'text-info',\n success: 'text-success',\n warning: 'text-warning',\n danger: 'text-destructive',\n };\n return map[props.entry.color];\n});\n\nconst dismissClasses = computed(() =>\n props.entry.variant === 'filled'\n ? 'text-current/70 hover:text-current hover:bg-current/10'\n : 'text-muted-foreground hover:text-foreground hover:bg-muted',\n);\n\n/* ── Bottom progress bar ── */\nconst trackClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/20';\n const map: Record<string, string> = {\n info: 'bg-info/15',\n success: 'bg-success/15',\n warning: 'bg-warning/15',\n danger: 'bg-destructive/15',\n };\n return map[props.entry.color];\n});\n\nconst barClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/60';\n const map: Record<string, string> = {\n info: 'bg-info/70',\n success: 'bg-success/70',\n warning: 'bg-warning/70',\n danger: 'bg-destructive/70',\n };\n return map[props.entry.color];\n});\n\nconst progressStyle = computed(() => {\n const total = props.entry.duration;\n if (!total) return { transform: 'scaleX(1)' };\n const remaining = Math.max(0, total - props.elapsed) / total;\n return {\n transform: `scaleX(${remaining})`,\n transition: props.paused ? 'none' : 'transform 100ms linear',\n };\n});\n\nfunction onAction() {\n const action = props.entry.action;\n if (!action) return;\n const close = () => emit('dismiss');\n action.onClick?.(close);\n if (!action.keepOpen) close();\n}\n</script>\n\n<style scoped>\n@media (prefers-reduced-motion: reduce) {\n .modo-toast {\n transition: none !important;\n }\n}\n</style>\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EAmGA,MAAM,QAAQ;EAQd,MAAM,OAAO;EAMb,MAAM,iBAAiB,sBAAA,wBAAwB,MAAM,MAAM,OAAO;EAElE,MAAM,iBAAA,GAAA,IAAA,gBAA+B;GACjC,QAAQ,eAAe,OAAvB;IACI,KAAK,QAAU,OAAO;IACtB,KAAK,SAAU,OAAO;IACtB,KAAK,SAAU,OAAO;IACtB,KAAK,QAAU,OAAO;IAEtB,SAAe,OAAO;;IAE5B;EAEF,MAAM,gBAAA,GAAA,IAAA,gBAA8B;GAChC,IAAI,MAAM,MAAM,MAAM,OAAO,MAAM,MAAM;GACzC,QAAQ,MAAM,MAAM,OAApB;IACI,KAAK,WAAW,OAAO,0BAAA;IACvB,KAAK,WAAW,OAAO,0BAAA;IACvB,KAAK,UAAW,OAAO,0BAAA;IAEvB,SAAgB,OAAO,0BAAA;;IAE7B;EAGF,MAAM,gBAAA,GAAA,IAAA,gBAA8B;GAChC,MAAM,EAAE,OAAO,YAAY,MAAM;GAuBjC,OAAO;IArBH,MAAM;KACF,QAAS;KACT,QAAS;KACT,SAAS;KACZ;IACD,SAAS;KACL,QAAS;KACT,QAAS;KACT,SAAS;KACZ;IACD,SAAS;KACL,QAAS;KACT,QAAS;KACT,SAAS;KACZ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AAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAQX,OARN,YAQM,EAAA,GAAA,IAAA,oBADO,UAAA;MALL,MAAK;MACJ,QAAA,GAAA,IAAA,gBAAK,CAAA,yHAA4H,mBAAA,MAAkB,CAAA;MACnJ,SAAO;iCAEL,QAAA,MAAM,OAAO,MAAK,EAAA,EAAA,CAAA,CAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA;;IAOvB,QAAA,MAAM,gBAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAYP,UAAA;;KAXL,MAAK;KACJ,QAAA,GAAA,IAAA,gBAAK;;;;MAA2R,eAAA;;KAMjS,cAAW;KACV,SAAK,OAAA,OAAA,OAAA,MAAA,WAAEA,KAAAA,MAAK,UAAA;4CAEuC,0BAAA,UAAA,EAAA;KAAzC,OAAM;KAAc,eAAY;;IAKrC,QAAA,MAAM,WAAQ,MAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBASlB,OAAA;;KARF,QAAA,GAAA,IAAA,gBAAK,CAAC,yEACE,aAAA,MAAY,CAAA;oCAMlB,OAAA;KAHE,QAAA,GAAA,IAAA,gBAAK,CAAC,mCACE,WAAA,MAAU,CAAA;KACjB,QAAA,GAAA,IAAA,gBAAO,cAAA,MAAa"}
|
|
1
|
+
{"version":3,"file":"Toast.vue_vue_type_script_setup_true_lang.cjs","names":["$emit"],"sources":["../../../src/components/feedback/Toast.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n 'modo-toast pointer-events-auto relative flex items-start gap-3 p-3.5 shadow-md',\n colorClasses,\n radiusClasses,\n 'min-w-72 max-w-sm w-full pb-4',\n ]\"\n role=\"status\"\n aria-live=\"polite\"\n @mouseenter=\"$emit('pointer-enter')\"\n @mouseleave=\"$emit('pointer-leave')\"\n >\n <!-- Icon badge -->\n <div\n v-if=\"!entry.hideIcon\"\n :class=\"[\n 'shrink-0 flex items-center justify-center w-8 h-8 rounded-full',\n iconBadgeClasses,\n iconTextClasses,\n ]\"\n >\n <component\n :is=\"resolvedIcon\"\n class=\"w-5 h-5\"\n aria-hidden=\"true\"\n />\n </div>\n\n <!-- Content -->\n <div class=\"flex-1 min-w-0 pt-0.5\">\n <p v-if=\"entry.title\" :class=\"['text-[13px] font-semibold leading-snug break-words', titleColorClasses]\">\n {{ entry.title }}\n </p>\n <p\n v-if=\"entry.description\"\n :class=\"[\n entry.title ? 'mt-0.5' : '',\n 'text-[13px] leading-snug break-words',\n descriptionColorClasses,\n ]\"\n >\n {{ entry.description }}\n </p>\n\n <div v-if=\"entry.action\" class=\"mt-2\">\n <button\n type=\"button\"\n :class=\"['text-xs font-semibold underline-offset-2 hover:underline focus:outline-none focus-visible:underline transition-colors', actionColorClasses]\"\n @click=\"onAction\"\n >\n {{ entry.action.label }}\n </button>\n </div>\n </div>\n\n <!-- Dismiss -->\n <button\n v-if=\"entry.dismissable\"\n type=\"button\"\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center w-6 h-6 rounded-md',\n 'transition-colors duration-fast ease-standard',\n 'focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1',\n dismissClasses,\n ]\"\n :aria-label=\"loc.toast.dismiss\"\n @click=\"$emit('dismiss')\"\n >\n <XMarkIcon class=\"w-3.5 h-3.5\" aria-hidden=\"true\" />\n </button>\n\n <!-- Bottom progress bar (auto-dismiss countdown) -->\n <div\n v-if=\"entry.duration > 0\"\n class=\"absolute left-2 right-2 bottom-1.5 h-0.5 rounded-full overflow-hidden\"\n :class=\"trackClasses\"\n >\n <div\n class=\"h-full rounded-full origin-left\"\n :class=\"barClasses\"\n :style=\"progressStyle\"\n />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport {\n XMarkIcon,\n CheckCircleIcon,\n ExclamationTriangleIcon,\n XCircleIcon,\n InformationCircleIcon,\n} from '@heroicons/vue/24/outline';\nimport type { ToastEntry } from '../../interfaces/feedback/Toast.interface';\nimport { useModoLocale, useResolvedRadius } from '../../composables/useModoConfig';\n\nconst props = defineProps<{\n entry: ToastEntry;\n /** Time elapsed in ms since push (driven by the container). */\n elapsed: number;\n /** Whether the auto-dismiss timer is currently paused. */\n paused: boolean;\n}>();\n\nconst loc = useModoLocale();\n\nconst emit = defineEmits<{\n dismiss: [];\n 'pointer-enter': [];\n 'pointer-leave': [];\n}>();\n\nconst resolvedRadius = useResolvedRadius(() => props.entry.radius);\n\nconst radiusClasses = computed(() => {\n switch (resolvedRadius.value) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded-sm';\n case 'large': return 'rounded-xl';\n case 'full': return 'rounded-2xl';\n case 'medium':\n default: return 'rounded-lg';\n }\n});\n\nconst resolvedIcon = computed(() => {\n if (props.entry.icon) return props.entry.icon;\n switch (props.entry.color) {\n case 'success': return CheckCircleIcon;\n case 'warning': return ExclamationTriangleIcon;\n case 'danger': return XCircleIcon;\n case 'info':\n default: return InformationCircleIcon;\n }\n});\n\n/* ── Card background & border ── */\nconst colorClasses = computed(() => {\n const { color, variant } = props.entry;\n const map: Record<string, Record<string, string>> = {\n info: {\n filled: 'bg-info text-info-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-info/40',\n },\n success: {\n filled: 'bg-success text-success-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-success/40',\n },\n warning: {\n filled: 'bg-warning text-warning-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-warning/40',\n },\n danger: {\n filled: 'bg-destructive text-destructive-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-destructive/40',\n },\n };\n return map[color][variant];\n});\n\n/* ── Icon container — sets currentColor for SVG ring + icon ── */\nconst iconTextClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'text-current/90';\n const map: Record<string, string> = {\n info: 'text-info',\n success: 'text-success',\n warning: 'text-warning',\n danger: 'text-destructive',\n };\n return map[props.entry.color];\n});\n\n/* ── Icon badge background ── */\nconst iconBadgeClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/15';\n const map: Record<string, string> = {\n info: 'bg-info/10',\n success: 'bg-success/10',\n warning: 'bg-warning/10',\n danger: 'bg-destructive/10',\n };\n return map[props.entry.color];\n});\n\n/* ── Text ── */\nconst titleColorClasses = computed(() =>\n props.entry.variant === 'filled' ? '' : 'text-foreground',\n);\n\nconst descriptionColorClasses = computed(() =>\n props.entry.variant === 'filled' ? 'opacity-85' : 'text-muted-foreground',\n);\n\nconst actionColorClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'text-current/90 hover:text-current';\n const map: Record<string, string> = {\n info: 'text-info',\n success: 'text-success',\n warning: 'text-warning',\n danger: 'text-destructive',\n };\n return map[props.entry.color];\n});\n\nconst dismissClasses = computed(() =>\n props.entry.variant === 'filled'\n ? 'text-current/70 hover:text-current hover:bg-current/10'\n : 'text-muted-foreground hover:text-foreground hover:bg-muted',\n);\n\n/* ── Bottom progress bar ── */\nconst trackClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/20';\n const map: Record<string, string> = {\n info: 'bg-info/15',\n success: 'bg-success/15',\n warning: 'bg-warning/15',\n danger: 'bg-destructive/15',\n };\n return map[props.entry.color];\n});\n\nconst barClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/60';\n const map: Record<string, string> = {\n info: 'bg-info/70',\n success: 'bg-success/70',\n warning: 'bg-warning/70',\n danger: 'bg-destructive/70',\n };\n return map[props.entry.color];\n});\n\nconst progressStyle = computed(() => {\n const total = props.entry.duration;\n if (!total) return { transform: 'scaleX(1)' };\n const remaining = Math.max(0, total - props.elapsed) / total;\n return {\n transform: `scaleX(${remaining})`,\n transition: props.paused ? 'none' : 'transform 100ms linear',\n };\n});\n\nfunction onAction() {\n const action = props.entry.action;\n if (!action) return;\n const close = () => emit('dismiss');\n action.onClick?.(close);\n if (!action.keepOpen) close();\n}\n</script>\n\n<style scoped>\n@media (prefers-reduced-motion: reduce) {\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AAK;KACJ,QAAA,GAAA,IAAA,gBAAK;;;;MAA2R,eAAA;;KAMhS,eAAA,GAAA,IAAA,OAAY,IAAG,CAAC,MAAM;KACtB,SAAK,OAAA,OAAA,OAAA,MAAA,WAAEA,KAAAA,MAAK,UAAA;4CAEuC,0BAAA,UAAA,EAAA;KAAzC,OAAM;KAAc,eAAY;;IAKrC,QAAA,MAAM,WAAQ,MAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBASlB,OAAA;;KARF,QAAA,GAAA,IAAA,gBAAK,CAAC,yEACE,aAAA,MAAY,CAAA;oCAMlB,OAAA;KAHE,QAAA,GAAA,IAAA,gBAAK,CAAC,mCACE,WAAA,MAAU,CAAA;KACjB,QAAA,GAAA,IAAA,gBAAO,cAAA,MAAa"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useResolvedRadius } from "../../composables/useModoConfig.mjs";
|
|
1
|
+
import { useModoLocale, useResolvedRadius } from "../../composables/useModoConfig.mjs";
|
|
2
2
|
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, resolveDynamicComponent, toDisplayString, unref } from "vue";
|
|
3
3
|
import { CheckCircleIcon, ExclamationTriangleIcon, InformationCircleIcon, XCircleIcon, XMarkIcon } from "@heroicons/vue/24/outline";
|
|
4
4
|
//#region src/components/feedback/Toast.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -7,6 +7,7 @@ var _hoisted_2 = {
|
|
|
7
7
|
key: 2,
|
|
8
8
|
class: "mt-2"
|
|
9
9
|
};
|
|
10
|
+
var _hoisted_3 = ["aria-label"];
|
|
10
11
|
var Toast_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
11
12
|
__name: "Toast",
|
|
12
13
|
props: {
|
|
@@ -21,6 +22,7 @@ var Toast_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
21
22
|
],
|
|
22
23
|
setup(__props, { emit: __emit }) {
|
|
23
24
|
const props = __props;
|
|
25
|
+
const loc = useModoLocale();
|
|
24
26
|
const emit = __emit;
|
|
25
27
|
const resolvedRadius = useResolvedRadius(() => props.entry.radius);
|
|
26
28
|
const radiusClasses = computed(() => {
|
|
@@ -181,12 +183,12 @@ var Toast_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
181
183
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",
|
|
182
184
|
dismissClasses.value
|
|
183
185
|
]),
|
|
184
|
-
"aria-label":
|
|
186
|
+
"aria-label": unref(loc).toast.dismiss,
|
|
185
187
|
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("dismiss"))
|
|
186
188
|
}, [createVNode(unref(XMarkIcon), {
|
|
187
189
|
class: "w-3.5 h-3.5",
|
|
188
190
|
"aria-hidden": "true"
|
|
189
|
-
})],
|
|
191
|
+
})], 10, _hoisted_3)) : createCommentVNode("", true),
|
|
190
192
|
__props.entry.duration > 0 ? (openBlock(), createElementBlock("div", {
|
|
191
193
|
key: 2,
|
|
192
194
|
class: normalizeClass(["absolute left-2 right-2 bottom-1.5 h-0.5 rounded-full overflow-hidden", trackClasses.value])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.vue_vue_type_script_setup_true_lang.mjs","names":["$emit"],"sources":["../../../src/components/feedback/Toast.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n 'modo-toast pointer-events-auto relative flex items-start gap-3 p-3.5 shadow-md',\n colorClasses,\n radiusClasses,\n 'min-w-72 max-w-sm w-full pb-4',\n ]\"\n role=\"status\"\n aria-live=\"polite\"\n @mouseenter=\"$emit('pointer-enter')\"\n @mouseleave=\"$emit('pointer-leave')\"\n >\n <!-- Icon badge -->\n <div\n v-if=\"!entry.hideIcon\"\n :class=\"[\n 'shrink-0 flex items-center justify-center w-8 h-8 rounded-full',\n iconBadgeClasses,\n iconTextClasses,\n ]\"\n >\n <component\n :is=\"resolvedIcon\"\n class=\"w-5 h-5\"\n aria-hidden=\"true\"\n />\n </div>\n\n <!-- Content -->\n <div class=\"flex-1 min-w-0 pt-0.5\">\n <p v-if=\"entry.title\" :class=\"['text-[13px] font-semibold leading-snug break-words', titleColorClasses]\">\n {{ entry.title }}\n </p>\n <p\n v-if=\"entry.description\"\n :class=\"[\n entry.title ? 'mt-0.5' : '',\n 'text-[13px] leading-snug break-words',\n descriptionColorClasses,\n ]\"\n >\n {{ entry.description }}\n </p>\n\n <div v-if=\"entry.action\" class=\"mt-2\">\n <button\n type=\"button\"\n :class=\"['text-xs font-semibold underline-offset-2 hover:underline focus:outline-none focus-visible:underline transition-colors', actionColorClasses]\"\n @click=\"onAction\"\n >\n {{ entry.action.label }}\n </button>\n </div>\n </div>\n\n <!-- Dismiss -->\n <button\n v-if=\"entry.dismissable\"\n type=\"button\"\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center w-6 h-6 rounded-md',\n 'transition-colors duration-fast ease-standard',\n 'focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1',\n dismissClasses,\n ]\"\n aria-label=\"Dismiss notification\"\n @click=\"$emit('dismiss')\"\n >\n <XMarkIcon class=\"w-3.5 h-3.5\" aria-hidden=\"true\" />\n </button>\n\n <!-- Bottom progress bar (auto-dismiss countdown) -->\n <div\n v-if=\"entry.duration > 0\"\n class=\"absolute left-2 right-2 bottom-1.5 h-0.5 rounded-full overflow-hidden\"\n :class=\"trackClasses\"\n >\n <div\n class=\"h-full rounded-full origin-left\"\n :class=\"barClasses\"\n :style=\"progressStyle\"\n />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport {\n XMarkIcon,\n CheckCircleIcon,\n ExclamationTriangleIcon,\n XCircleIcon,\n InformationCircleIcon,\n} from '@heroicons/vue/24/outline';\nimport type { ToastEntry } from '../../interfaces/feedback/Toast.interface';\nimport { useResolvedRadius } from '../../composables/useModoConfig';\n\nconst props = defineProps<{\n entry: ToastEntry;\n /** Time elapsed in ms since push (driven by the container). */\n elapsed: number;\n /** Whether the auto-dismiss timer is currently paused. */\n paused: boolean;\n}>();\n\nconst emit = defineEmits<{\n dismiss: [];\n 'pointer-enter': [];\n 'pointer-leave': [];\n}>();\n\nconst resolvedRadius = useResolvedRadius(() => props.entry.radius);\n\nconst radiusClasses = computed(() => {\n switch (resolvedRadius.value) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded-sm';\n case 'large': return 'rounded-xl';\n case 'full': return 'rounded-2xl';\n case 'medium':\n default: return 'rounded-lg';\n }\n});\n\nconst resolvedIcon = computed(() => {\n if (props.entry.icon) return props.entry.icon;\n switch (props.entry.color) {\n case 'success': return CheckCircleIcon;\n case 'warning': return ExclamationTriangleIcon;\n case 'danger': return XCircleIcon;\n case 'info':\n default: return InformationCircleIcon;\n }\n});\n\n/* ── Card background & border ── */\nconst colorClasses = computed(() => {\n const { color, variant } = props.entry;\n const map: Record<string, Record<string, string>> = {\n info: {\n filled: 'bg-info text-info-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-info/40',\n },\n success: {\n filled: 'bg-success text-success-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-success/40',\n },\n warning: {\n filled: 'bg-warning text-warning-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-warning/40',\n },\n danger: {\n filled: 'bg-destructive text-destructive-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-destructive/40',\n },\n };\n return map[color][variant];\n});\n\n/* ── Icon container — sets currentColor for SVG ring + icon ── */\nconst iconTextClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'text-current/90';\n const map: Record<string, string> = {\n info: 'text-info',\n success: 'text-success',\n warning: 'text-warning',\n danger: 'text-destructive',\n };\n return map[props.entry.color];\n});\n\n/* ── Icon badge background ── */\nconst iconBadgeClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/15';\n const map: Record<string, string> = {\n info: 'bg-info/10',\n success: 'bg-success/10',\n warning: 'bg-warning/10',\n danger: 'bg-destructive/10',\n };\n return map[props.entry.color];\n});\n\n/* ── Text ── */\nconst titleColorClasses = computed(() =>\n props.entry.variant === 'filled' ? '' : 'text-foreground',\n);\n\nconst descriptionColorClasses = computed(() =>\n props.entry.variant === 'filled' ? 'opacity-85' : 'text-muted-foreground',\n);\n\nconst actionColorClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'text-current/90 hover:text-current';\n const map: Record<string, string> = {\n info: 'text-info',\n success: 'text-success',\n warning: 'text-warning',\n danger: 'text-destructive',\n };\n return map[props.entry.color];\n});\n\nconst dismissClasses = computed(() =>\n props.entry.variant === 'filled'\n ? 'text-current/70 hover:text-current hover:bg-current/10'\n : 'text-muted-foreground hover:text-foreground hover:bg-muted',\n);\n\n/* ── Bottom progress bar ── */\nconst trackClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/20';\n const map: Record<string, string> = {\n info: 'bg-info/15',\n success: 'bg-success/15',\n warning: 'bg-warning/15',\n danger: 'bg-destructive/15',\n };\n return map[props.entry.color];\n});\n\nconst barClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/60';\n const map: Record<string, string> = {\n info: 'bg-info/70',\n success: 'bg-success/70',\n warning: 'bg-warning/70',\n danger: 'bg-destructive/70',\n };\n return map[props.entry.color];\n});\n\nconst progressStyle = computed(() => {\n const total = props.entry.duration;\n if (!total) return { transform: 'scaleX(1)' };\n const remaining = Math.max(0, total - props.elapsed) / total;\n return {\n transform: `scaleX(${remaining})`,\n transition: props.paused ? 'none' : 'transform 100ms linear',\n };\n});\n\nfunction onAction() {\n const action = props.entry.action;\n if (!action) return;\n const close = () => emit('dismiss');\n action.onClick?.(close);\n if (!action.keepOpen) close();\n}\n</script>\n\n<style scoped>\n@media (prefers-reduced-motion: reduce) {\n .modo-toast {\n transition: none !important;\n }\n}\n</style>\n\n"],"mappings":";;;;;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AA;;sBAM9I,YAIE,wBAHO,aAAA,MAAY,EAAA;KACjB,OAAM;KACN,eAAY;;IAKpB,mBAwBM,OAxBN,YAwBM;KAvBO,QAAA,MAAM,SAAA,WAAA,EAAf,mBAEI,KAAA;;MAFmB,OAAK,eAAA,CAAA,sDAAyD,kBAAA,MAAiB,CAAA;wBAC/F,QAAA,MAAM,MAAK,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;KAGR,QAAA,MAAM,eAAA,WAAA,EADhB,mBASI,KAAA;;MAPC,OAAK,eAAA;OAAwB,QAAA,MAAM,QAAK,WAAA;;OAAkG,wBAAA;;wBAMxI,QAAA,MAAM,YAAW,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;KAGb,QAAA,MAAM,UAAA,WAAA,EAAjB,mBAQM,OARN,YAQM,CAPF,mBAMS,UAAA;MALL,MAAK;MACJ,OAAK,eAAA,CAAA,yHAA4H,mBAAA,MAAkB,CAAA;MACnJ,SAAO;wBAEL,QAAA,MAAM,OAAO,MAAK,EAAA,EAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA;;IAOvB,QAAA,MAAM,eAAA,WAAA,EADhB,mBAaS,UAAA;;KAXL,MAAK;KACJ,OAAK,eAAA;;;;MAA2R,eAAA;;KAMjS,cAAW;KACV,SAAK,OAAA,OAAA,OAAA,MAAA,WAAEA,KAAAA,MAAK,UAAA;QAEb,YAAoD,MAAA,UAAA,EAAA;KAAzC,OAAM;KAAc,eAAY;;IAKrC,QAAA,MAAM,WAAQ,KAAA,WAAA,EADxB,mBAUM,OAAA;;KARF,OAAK,eAAA,CAAC,yEACE,aAAA,MAAY,CAAA;QAEpB,mBAIE,OAAA;KAHE,OAAK,eAAA,CAAC,mCACE,WAAA,MAAU,CAAA;KACjB,OAAK,eAAE,cAAA,MAAa"}
|
|
1
|
+
{"version":3,"file":"Toast.vue_vue_type_script_setup_true_lang.mjs","names":["$emit"],"sources":["../../../src/components/feedback/Toast.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n 'modo-toast pointer-events-auto relative flex items-start gap-3 p-3.5 shadow-md',\n colorClasses,\n radiusClasses,\n 'min-w-72 max-w-sm w-full pb-4',\n ]\"\n role=\"status\"\n aria-live=\"polite\"\n @mouseenter=\"$emit('pointer-enter')\"\n @mouseleave=\"$emit('pointer-leave')\"\n >\n <!-- Icon badge -->\n <div\n v-if=\"!entry.hideIcon\"\n :class=\"[\n 'shrink-0 flex items-center justify-center w-8 h-8 rounded-full',\n iconBadgeClasses,\n iconTextClasses,\n ]\"\n >\n <component\n :is=\"resolvedIcon\"\n class=\"w-5 h-5\"\n aria-hidden=\"true\"\n />\n </div>\n\n <!-- Content -->\n <div class=\"flex-1 min-w-0 pt-0.5\">\n <p v-if=\"entry.title\" :class=\"['text-[13px] font-semibold leading-snug break-words', titleColorClasses]\">\n {{ entry.title }}\n </p>\n <p\n v-if=\"entry.description\"\n :class=\"[\n entry.title ? 'mt-0.5' : '',\n 'text-[13px] leading-snug break-words',\n descriptionColorClasses,\n ]\"\n >\n {{ entry.description }}\n </p>\n\n <div v-if=\"entry.action\" class=\"mt-2\">\n <button\n type=\"button\"\n :class=\"['text-xs font-semibold underline-offset-2 hover:underline focus:outline-none focus-visible:underline transition-colors', actionColorClasses]\"\n @click=\"onAction\"\n >\n {{ entry.action.label }}\n </button>\n </div>\n </div>\n\n <!-- Dismiss -->\n <button\n v-if=\"entry.dismissable\"\n type=\"button\"\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center w-6 h-6 rounded-md',\n 'transition-colors duration-fast ease-standard',\n 'focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1',\n dismissClasses,\n ]\"\n :aria-label=\"loc.toast.dismiss\"\n @click=\"$emit('dismiss')\"\n >\n <XMarkIcon class=\"w-3.5 h-3.5\" aria-hidden=\"true\" />\n </button>\n\n <!-- Bottom progress bar (auto-dismiss countdown) -->\n <div\n v-if=\"entry.duration > 0\"\n class=\"absolute left-2 right-2 bottom-1.5 h-0.5 rounded-full overflow-hidden\"\n :class=\"trackClasses\"\n >\n <div\n class=\"h-full rounded-full origin-left\"\n :class=\"barClasses\"\n :style=\"progressStyle\"\n />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport {\n XMarkIcon,\n CheckCircleIcon,\n ExclamationTriangleIcon,\n XCircleIcon,\n InformationCircleIcon,\n} from '@heroicons/vue/24/outline';\nimport type { ToastEntry } from '../../interfaces/feedback/Toast.interface';\nimport { useModoLocale, useResolvedRadius } from '../../composables/useModoConfig';\n\nconst props = defineProps<{\n entry: ToastEntry;\n /** Time elapsed in ms since push (driven by the container). */\n elapsed: number;\n /** Whether the auto-dismiss timer is currently paused. */\n paused: boolean;\n}>();\n\nconst loc = useModoLocale();\n\nconst emit = defineEmits<{\n dismiss: [];\n 'pointer-enter': [];\n 'pointer-leave': [];\n}>();\n\nconst resolvedRadius = useResolvedRadius(() => props.entry.radius);\n\nconst radiusClasses = computed(() => {\n switch (resolvedRadius.value) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded-sm';\n case 'large': return 'rounded-xl';\n case 'full': return 'rounded-2xl';\n case 'medium':\n default: return 'rounded-lg';\n }\n});\n\nconst resolvedIcon = computed(() => {\n if (props.entry.icon) return props.entry.icon;\n switch (props.entry.color) {\n case 'success': return CheckCircleIcon;\n case 'warning': return ExclamationTriangleIcon;\n case 'danger': return XCircleIcon;\n case 'info':\n default: return InformationCircleIcon;\n }\n});\n\n/* ── Card background & border ── */\nconst colorClasses = computed(() => {\n const { color, variant } = props.entry;\n const map: Record<string, Record<string, string>> = {\n info: {\n filled: 'bg-info text-info-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-info/40',\n },\n success: {\n filled: 'bg-success text-success-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-success/40',\n },\n warning: {\n filled: 'bg-warning text-warning-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-warning/40',\n },\n danger: {\n filled: 'bg-destructive text-destructive-foreground',\n subtle: 'bg-card border border-border/80',\n outline: 'bg-card border-2 border-destructive/40',\n },\n };\n return map[color][variant];\n});\n\n/* ── Icon container — sets currentColor for SVG ring + icon ── */\nconst iconTextClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'text-current/90';\n const map: Record<string, string> = {\n info: 'text-info',\n success: 'text-success',\n warning: 'text-warning',\n danger: 'text-destructive',\n };\n return map[props.entry.color];\n});\n\n/* ── Icon badge background ── */\nconst iconBadgeClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/15';\n const map: Record<string, string> = {\n info: 'bg-info/10',\n success: 'bg-success/10',\n warning: 'bg-warning/10',\n danger: 'bg-destructive/10',\n };\n return map[props.entry.color];\n});\n\n/* ── Text ── */\nconst titleColorClasses = computed(() =>\n props.entry.variant === 'filled' ? '' : 'text-foreground',\n);\n\nconst descriptionColorClasses = computed(() =>\n props.entry.variant === 'filled' ? 'opacity-85' : 'text-muted-foreground',\n);\n\nconst actionColorClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'text-current/90 hover:text-current';\n const map: Record<string, string> = {\n info: 'text-info',\n success: 'text-success',\n warning: 'text-warning',\n danger: 'text-destructive',\n };\n return map[props.entry.color];\n});\n\nconst dismissClasses = computed(() =>\n props.entry.variant === 'filled'\n ? 'text-current/70 hover:text-current hover:bg-current/10'\n : 'text-muted-foreground hover:text-foreground hover:bg-muted',\n);\n\n/* ── Bottom progress bar ── */\nconst trackClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/20';\n const map: Record<string, string> = {\n info: 'bg-info/15',\n success: 'bg-success/15',\n warning: 'bg-warning/15',\n danger: 'bg-destructive/15',\n };\n return map[props.entry.color];\n});\n\nconst barClasses = computed(() => {\n if (props.entry.variant === 'filled') return 'bg-current/60';\n const map: Record<string, string> = {\n info: 'bg-info/70',\n success: 'bg-success/70',\n warning: 'bg-warning/70',\n danger: 'bg-destructive/70',\n };\n return map[props.entry.color];\n});\n\nconst progressStyle = computed(() => {\n const total = props.entry.duration;\n if (!total) return { transform: 'scaleX(1)' };\n const remaining = Math.max(0, total - props.elapsed) / total;\n return {\n transform: `scaleX(${remaining})`,\n transition: props.paused ? 'none' : 'transform 100ms linear',\n };\n});\n\nfunction onAction() {\n const action = props.entry.action;\n if (!action) return;\n const close = () => emit('dismiss');\n action.onClick?.(close);\n if (!action.keepOpen) close();\n}\n</script>\n\n<style scoped>\n@media (prefers-reduced-motion: reduce) {\n .modo-toast {\n transition: none !important;\n }\n}\n</style>\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EAmGA,MAAM,QAAQ;EAQd,MAAM,MAAM,eAAe;EAE3B,MAAM,OAAO;EAMb,MAAM,iBAAiB,wBAAwB,MAAM,MAAM,OAAO;EAElE,MAAM,gBAAgB,eAAe;GACjC,QAAQ,eAAe,OAAvB;IACI,KAAK,QAAU,OAAO;IACtB,KAAK,SAAU,OAAO;IACtB,KAAK,SAAU,OAAO;IACtB,KAAK,QAAU,OAAO;IAEtB,SAAe,OAAO;;IAE5B;EAEF,MAAM,eAAe,eAAe;GAChC,IAAI,MAAM,MAAM,MAAM,OAAO,MAAM,MAAM;GACzC,QAAQ,MAAM,MAAM,OAApB;IACI,KAAK,WAAW,OAAO;IACvB,KAAK,WAAW,OAAO;IACvB,KAAK,UAAW,OAAO;IAEvB,SAAgB,OAAO;;IAE7B;EAGF,MAAM,eAAe,eAAe;GAChC,MAAM,EAAE,OAAO,YAAY,MAAM;GAuBjC,OAAO;IArBH,MAAM;KACF,QAAS;KACT,QAAS;KACT,SAAS;KACZ;IACD,SAAS;KACL,QAAS;KACT,QAAS;KACT,SAAS;KACZ;IACD,SAAS;KACL,QAAS;KACT,QAAS;KACT,SAAS;KACZ;IACD,QAAQ;KACJ,QAAS;KACT,QAAS;KACT,SAAS;KACZ;IAEE,CAAI,OAAO;IACpB;EAGF,MAAM,kBAAkB,eAAe;GACnC,IAAI,MAAM,MAAM,YA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AAA,OAAA,MAAA,WAAEA,KAAAA,MAAK,UAAA;QAEb,YAAoD,MAAA,UAAA,EAAA;KAAzC,OAAM;KAAc,eAAY;;IAKrC,QAAA,MAAM,WAAQ,KAAA,WAAA,EADxB,mBAUM,OAAA;;KARF,OAAK,eAAA,CAAC,yEACE,aAAA,MAAY,CAAA;QAEpB,mBAIE,OAAA;KAHE,OAAK,eAAA,CAAC,mCACE,WAAA,MAAU,CAAA;KACjB,OAAK,eAAE,cAAA,MAAa"}
|
|
@@ -2,7 +2,7 @@ const require__plugin_vue_export_helper = require("../../_virtual/_plugin-vue_ex
|
|
|
2
2
|
const require_ToastContainer_vue_vue_type_script_setup_true_lang = require("./ToastContainer.vue_vue_type_script_setup_true_lang.cjs");
|
|
3
3
|
;/* empty css */
|
|
4
4
|
//#region src/components/feedback/ToastContainer.vue
|
|
5
|
-
var ToastContainer_default = /* @__PURE__ */ require__plugin_vue_export_helper.default(require_ToastContainer_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-
|
|
5
|
+
var ToastContainer_default = /* @__PURE__ */ require__plugin_vue_export_helper.default(require_ToastContainer_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-43c0c7e8"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
exports.default = ToastContainer_default;
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastContainer.cjs","names":[],"sources":["../../../src/components/feedback/ToastContainer.vue"],"sourcesContent":["<template> \n <Teleport to=\"body\"> \n <!-- One zone per placement. Empty zones still render an empty wrapper \n but the `pointer-events-none` keeps them inert. --> \n <div\n v-for=\"zone in zones\"\n :key=\"zone.placement\"\n :class=\"['modo-toast-container fixed z-[9999] flex flex-col gap-2 pointer-events-none', zone.classes]\"\n :style=\"{ ...zone.style, ...cssVarStyle }\"\n role=\"region\"\n aria-label=\"
|
|
1
|
+
{"version":3,"file":"ToastContainer.cjs","names":[],"sources":["../../../src/components/feedback/ToastContainer.vue"],"sourcesContent":["<template> \n <Teleport to=\"body\"> \n <!-- One zone per placement. Empty zones still render an empty wrapper \n but the `pointer-events-none` keeps them inert. --> \n <div\n v-for=\"zone in zones\"\n :key=\"zone.placement\"\n :class=\"['modo-toast-container fixed z-[9999] flex flex-col gap-2 pointer-events-none', zone.classes]\"\n :style=\"{ ...zone.style, ...cssVarStyle }\"\n role=\"region\"\n :aria-label=\"loc.toast.region\"\n aria-live=\"polite\"\n > \n <TransitionGroup \n :name=\"zone.transition\" \n tag=\"div\" \n class=\"flex flex-col gap-2\" \n > \n <Toast \n v-for=\"entry in zone.entries\" \n :key=\"String(entry.id)\" \n :entry=\"entry\" \n :elapsed=\"elapsedFor(entry.id)\" \n :paused=\"pausedSet.has(entry.id)\" \n class=\"pointer-events-auto\" \n @dismiss=\"onDismiss(entry.id)\" \n @pointer-enter=\"onEnter(entry.id)\" \n @pointer-leave=\"onLeave(entry.id)\" \n /> \n </TransitionGroup> \n </div> \n </Teleport> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';\nimport Toast from './Toast.vue';\nimport { useToast, useToastQueue } from '../../composables/useToast';\nimport type {\n ToastContainer,\n ToastEntry,\n ToastPlacement,\n} from '../../interfaces/feedback/Toast.interface';\nimport { useModoConfig, useModoLocale, useResolvedTheme } from '../../composables/useModoConfig';\nimport { resolveColorMode } from '../../composables/useColorMode';\nimport { palettesToCssVars, semanticTokensFromPalettes } from '../../config/palettes';\nimport { surfacesToCssVars } from '../../config/surfaces';\nimport { hexToOklchString, pickForegroundOklch } from '../../config/colorPrimitives'; \n \nconst props = withDefaults(defineProps<ToastContainer>(), { \n placement: 'top-right', \n max: 5, \n defaultDuration: 4500, \n defaultVariant: 'subtle', \n offset: 16, \n reducedMotion: 'auto', \n});\nconst loc = useModoLocale();\n \n \nconst queue = useToastQueue();\nconst { dismiss } = useToast();\n\nconst cfg = useModoConfig();\nconst theme = useResolvedTheme();\nconst scopedTheme = computed(() => resolveColorMode(theme.value));\n\nconst cssVarStyle = computed(() => {\n const paletteVars = cfg?.value.palettes\n ? {\n ...palettesToCssVars(cfg.value.palettes),\n ...semanticTokensFromPalettes(cfg.value.palettes, hexToOklchString, pickForegroundOklch),\n }\n : {};\n const surfaceVars = cfg?.value.surfaces ? surfacesToCssVars(cfg.value.surfaces) : {};\n const darkSurfaceVars =\n scopedTheme.value === 'dark' && cfg?.value.darkSurfaces\n ? surfacesToCssVars(cfg.value.darkSurfaces)\n : {};\n return { ...paletteVars, ...surfaceVars, ...darkSurfaceVars };\n}); \n \n/* ------------------------------------------------------------------ */ \n/* Per-toast timer state */ \n/* ------------------------------------------------------------------ */ \n \nconst elapsedById = ref<Map<string | number, number>>(new Map()); \nconst pausedSet = ref<Set<string | number>>(new Set()); \n \nlet _raf: number | null = null; \nlet _lastFrame = 0; \n \nfunction tick(now: number) { \n const dt = _lastFrame ? now - _lastFrame : 0; \n _lastFrame = now; \n for (const entry of queue.queue) { \n if (entry.duration <= 0) continue; \n if (pausedSet.value.has(entry.id)) continue; \n const cur = elapsedById.value.get(entry.id) ?? 0; \n const next = cur + dt; \n elapsedById.value.set(entry.id, next); \n if (next >= entry.duration) { \n dismiss(entry.id); \n elapsedById.value.delete(entry.id); \n } \n } \n _raf = requestAnimationFrame(tick); \n} \n \nonMounted(() => { \n _lastFrame = 0; \n _raf = requestAnimationFrame(tick); \n}); \n \nonBeforeUnmount(() => { \n if (_raf !== null) cancelAnimationFrame(_raf); \n _raf = null; \n}); \n \nwatch( \n () => queue.queue.map((t) => t.id), \n (currentIds) => { \n const set = new Set(currentIds); \n for (const id of [...elapsedById.value.keys()]) { \n if (!set.has(id)) elapsedById.value.delete(id); \n } \n for (const id of [...pausedSet.value]) { \n if (!set.has(id)) pausedSet.value.delete(id); \n } \n }, \n); \n \nfunction elapsedFor(id: string | number) { \n return elapsedById.value.get(id) ?? 0; \n} \nfunction onEnter(id: string | number) { \n const entry = queue.queue.find((t) => t.id === id); \n if (entry?.pauseOnHover) pausedSet.value.add(id); \n} \nfunction onLeave(id: string | number) { \n pausedSet.value.delete(id); \n} \nfunction onDismiss(id: string | number) { \n dismiss(id); \n} \n \n/* ------------------------------------------------------------------ */ \n/* Placement zones */ \n/* ------------------------------------------------------------------ */ \n \nconst ALL_PLACEMENTS: ToastPlacement[] = [ \n 'top-right', \n 'top-left', \n 'top-center', \n 'bottom-right', \n 'bottom-left', \n 'bottom-center', \n]; \n \nfunction classesFor(p: ToastPlacement): string { \n switch (p) { \n case 'top-left': return 'top-0 left-0 items-start'; \n case 'top-center': return 'top-0 left-1/2 -translate-x-1/2 items-center'; \n case 'bottom-right': return 'bottom-0 right-0 items-end'; \n case 'bottom-left': return 'bottom-0 left-0 items-start'; \n case 'bottom-center': return 'bottom-0 left-1/2 -translate-x-1/2 items-center'; \n case 'top-right': \n default: return 'top-0 right-0 items-end'; \n } \n} \n \nfunction styleFor(p: ToastPlacement): Record<string, string> { \n const o = `${props.offset}px`; \n const style: Record<string, string> = {}; \n if (p.startsWith('top')) style.paddingTop = o; \n else style.paddingBottom = o; \n if (p.endsWith('right')) style.paddingRight = o; \n else if (p.endsWith('left')) style.paddingLeft = o; \n return style; \n} \n \nfunction transitionFor(p: ToastPlacement): string { \n if (props.reducedMotion === 'force') return 'modo-toast-fade'; \n if (p.endsWith('right')) return 'modo-toast-slide-right'; \n if (p.endsWith('left')) return 'modo-toast-slide-left'; \n return 'modo-toast-slide-vertical'; \n} \n \nconst zones = computed(() => { \n return ALL_PLACEMENTS.map((placement) => { \n // Each toast is grouped under its own placement, falling back to \n // the container's `placement` prop when the push didn't specify one. \n const matching = queue.queue.filter( \n (t: ToastEntry) => (t.placement ?? props.placement) === placement, \n ); \n const capped = matching.slice(-props.max); \n // Newest closest to the viewport edge: reverse for top placements. \n const ordered = placement.startsWith('top') ? [...capped].reverse() : capped; \n return { \n placement, \n entries: ordered, \n classes: classesFor(placement), \n style: styleFor(placement), \n transition: transitionFor(placement), \n }; \n }); \n}); \n</script> \n \n<style scoped> \n.modo-toast-slide-right-enter-from { transform: translateX(110%); opacity: 0; } \n.modo-toast-slide-right-leave-to { transform: translateX(110%); opacity: 0; } \n.modo-toast-slide-right-enter-active, \n.modo-toast-slide-right-leave-active { transition: transform 200ms cubic-bezier(0.2, 0, 0, 1), opacity 200ms ease; } \n \n.modo-toast-slide-left-enter-from { transform: translateX(-110%); opacity: 0; } \n.modo-toast-slide-left-leave-to { transform: translateX(-110%); opacity: 0; } \n.modo-toast-slide-left-enter-active, \n.modo-toast-slide-left-leave-active { transition: transform 200ms cubic-bezier(0.2, 0, 0, 1), opacity 200ms ease; } \n \n.modo-toast-slide-vertical-enter-from { transform: translateY(-30%); opacity: 0; } \n.modo-toast-slide-vertical-leave-to { transform: translateY(-30%); opacity: 0; } \n.modo-toast-slide-vertical-enter-active, \n.modo-toast-slide-vertical-leave-active { transition: transform 200ms cubic-bezier(0.2, 0, 0, 1), opacity 200ms ease; } \n \n.modo-toast-fade-enter-from, \n.modo-toast-fade-leave-to { opacity: 0; } \n.modo-toast-fade-enter-active, \n.modo-toast-fade-leave-active { transition: opacity 150ms ease; } \n \n@media (prefers-reduced-motion: reduce) { \n .modo-toast-slide-right-enter-from, \n .modo-toast-slide-left-enter-from, \n .modo-toast-slide-vertical-enter-from, \n .modo-toast-slide-right-leave-to, \n .modo-toast-slide-left-leave-to, \n .modo-toast-slide-vertical-leave-to { \n transform: none; \n } \n} \n</style>\n"],"mappings":""}
|
|
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export
|
|
|
2
2
|
import ToastContainer_vue_vue_type_script_setup_true_lang_default from "./ToastContainer.vue_vue_type_script_setup_true_lang.mjs";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/components/feedback/ToastContainer.vue
|
|
5
|
-
var ToastContainer_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ToastContainer_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var ToastContainer_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ToastContainer_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-43c0c7e8"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { ToastContainer_default as default };
|
|
8
8
|
|