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.
Files changed (96) hide show
  1. package/dist/components/feedback/Drawer.cjs.map +1 -1
  2. package/dist/components/feedback/Drawer.mjs.map +1 -1
  3. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.cjs +11 -7
  4. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  5. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs +12 -8
  6. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  7. package/dist/components/feedback/Modal.cjs.map +1 -1
  8. package/dist/components/feedback/Modal.mjs.map +1 -1
  9. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.cjs +10 -3
  10. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  11. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs +11 -4
  12. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  13. package/dist/components/feedback/Toast.cjs +1 -1
  14. package/dist/components/feedback/Toast.cjs.map +1 -1
  15. package/dist/components/feedback/Toast.mjs +1 -1
  16. package/dist/components/feedback/Toast.mjs.map +1 -1
  17. package/dist/components/feedback/Toast.vue_vue_type_script_setup_true_lang.cjs +4 -2
  18. package/dist/components/feedback/Toast.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  19. package/dist/components/feedback/Toast.vue_vue_type_script_setup_true_lang.mjs +5 -3
  20. package/dist/components/feedback/Toast.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  21. package/dist/components/feedback/ToastContainer.cjs +1 -1
  22. package/dist/components/feedback/ToastContainer.cjs.map +1 -1
  23. package/dist/components/feedback/ToastContainer.mjs +1 -1
  24. package/dist/components/feedback/ToastContainer.mjs.map +1 -1
  25. package/dist/components/feedback/ToastContainer.vue_vue_type_script_setup_true_lang.cjs +4 -2
  26. package/dist/components/feedback/ToastContainer.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  27. package/dist/components/feedback/ToastContainer.vue_vue_type_script_setup_true_lang.mjs +6 -4
  28. package/dist/components/feedback/ToastContainer.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  29. package/dist/components/feedback/dialog/DialogTrigger.cjs.map +1 -1
  30. package/dist/components/feedback/dialog/DialogTrigger.mjs.map +1 -1
  31. package/dist/components/feedback/dialog/DialogTrigger.vue_vue_type_script_setup_true_lang.cjs +10 -2
  32. package/dist/components/feedback/dialog/DialogTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  33. package/dist/components/feedback/dialog/DialogTrigger.vue_vue_type_script_setup_true_lang.mjs +10 -2
  34. package/dist/components/feedback/dialog/DialogTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  35. package/dist/components/feedback/sheet/SheetTrigger.cjs.map +1 -1
  36. package/dist/components/feedback/sheet/SheetTrigger.mjs.map +1 -1
  37. package/dist/components/feedback/sheet/SheetTrigger.vue_vue_type_script_setup_true_lang.cjs +10 -2
  38. package/dist/components/feedback/sheet/SheetTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  39. package/dist/components/feedback/sheet/SheetTrigger.vue_vue_type_script_setup_true_lang.mjs +10 -2
  40. package/dist/components/feedback/sheet/SheetTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  41. package/dist/components/forms/morph-select/MorphSelect.cjs.map +1 -1
  42. package/dist/components/forms/morph-select/MorphSelect.mjs.map +1 -1
  43. package/dist/components/forms/morph-select/MorphSelect.vue_vue_type_script_setup_true_lang.cjs +53 -6
  44. package/dist/components/forms/morph-select/MorphSelect.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  45. package/dist/components/forms/morph-select/MorphSelect.vue_vue_type_script_setup_true_lang.mjs +54 -7
  46. package/dist/components/forms/morph-select/MorphSelect.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  47. package/dist/components/forms/morph-select/MorphSelectContent.cjs.map +1 -1
  48. package/dist/components/forms/morph-select/MorphSelectContent.mjs.map +1 -1
  49. package/dist/components/forms/morph-select/MorphSelectContent.vue_vue_type_script_setup_true_lang.cjs +33 -8
  50. package/dist/components/forms/morph-select/MorphSelectContent.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  51. package/dist/components/forms/morph-select/MorphSelectContent.vue_vue_type_script_setup_true_lang.mjs +34 -9
  52. package/dist/components/forms/morph-select/MorphSelectContent.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  53. package/dist/components/forms/morph-select/MorphSelectContext.cjs.map +1 -1
  54. package/dist/components/forms/morph-select/MorphSelectContext.mjs.map +1 -1
  55. package/dist/components/forms/morph-select/MorphSelectTrigger.cjs.map +1 -1
  56. package/dist/components/forms/morph-select/MorphSelectTrigger.mjs.map +1 -1
  57. package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs +33 -16
  58. package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  59. package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.mjs +34 -17
  60. package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  61. package/dist/components/layout/popover/PopoverTrigger.cjs.map +1 -1
  62. package/dist/components/layout/popover/PopoverTrigger.mjs.map +1 -1
  63. package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.cjs +10 -2
  64. package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  65. package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.mjs +10 -2
  66. package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  67. package/dist/components/navigation/menu/MenuTrigger.cjs.map +1 -1
  68. package/dist/components/navigation/menu/MenuTrigger.mjs.map +1 -1
  69. package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.cjs +7 -0
  70. package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  71. package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.mjs +7 -0
  72. package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  73. package/dist/config/ModoLocale.cjs +4 -0
  74. package/dist/config/ModoLocale.cjs.map +1 -1
  75. package/dist/config/ModoLocale.mjs +4 -0
  76. package/dist/config/ModoLocale.mjs.map +1 -1
  77. package/dist/config/locales/es.cjs +4 -0
  78. package/dist/config/locales/es.cjs.map +1 -1
  79. package/dist/config/locales/es.mjs +4 -0
  80. package/dist/config/locales/es.mjs.map +1 -1
  81. package/dist/mood-ui.css +39 -41
  82. package/dist/types/components/forms/morph-select/MorphSelect.vue.d.ts +8 -7
  83. package/dist/types/components/forms/morph-select/MorphSelectContext.d.ts +6 -1
  84. package/dist/types/components/forms/morph-select/MorphSelectTrigger.vue.d.ts +6 -3
  85. package/dist/types/components/forms/morph-select/index.d.ts +24 -18
  86. package/dist/types/config/ModoLocale.d.ts +6 -0
  87. package/dist/types/interfaces/feedback/Drawer.interface.d.ts +2 -0
  88. package/dist/types/interfaces/feedback/Modal.interface.d.ts +2 -0
  89. package/dist/types/interfaces/forms/ModeOrb.interface.d.ts +3 -3
  90. package/dist/types/interfaces/forms/MorphSelect.interface.d.ts +13 -5
  91. package/dist/types/utils/morph/morphHelpers.d.ts +6 -0
  92. package/dist/utils/morph/morphHelpers.cjs +16 -0
  93. package/dist/utils/morph/morphHelpers.cjs.map +1 -1
  94. package/dist/utils/morph/morphHelpers.mjs +16 -1
  95. package/dist/utils/morph/morphHelpers.mjs.map +1 -1
  96. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.cjs","names":[],"sources":["../../../src/components/feedback/Drawer.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-drawer-overlay fixed inset-0 z-1200 flex opacity-0', \n inset ? 'p-2.5' : '', \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-drawer-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-drawer modo-drawer-glass relative flex flex-col text-foreground overflow-hidden', \n 'outline-none focus:outline-none focus-visible:outline-none', \n sideBorderClass, \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 --> \n <div v-if=\"showClose\" class=\"absolute top-3 right-3.5 z-10\"> \n <button\n type=\"button\"\n class=\"modo-drawer__x\"\n aria-label=\"Close\"\n @click=\"close\"\n >\n <svg viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M4 4l8 8m0-8l-8 8\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" />\n </svg>\n </button>\n </div> \n \n <!-- Content wrapper --> \n <div ref=\"contentRef\" data-modo-drawer-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-5 pt-5', \n showClose ? 'pr-14' : '', \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-5', \n ($slots.header || title || description) ? '' : 'pt-5', \n $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"body\"> \n <slot /> \n </slot> \n </div> \n \n <!-- Footer --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-5 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, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Drawer } from '../../interfaces/feedback/Drawer.interface'; \nimport { \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 { ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Drawer>(), { \n modelValue: false, \n side: 'right', \n size: 'medium', \n inset: true,\n closeOnOverlay: true, \n closeOnEscape: true, \n showClose: true, \n lockScroll: true, \n color: 'default', \n overlay: 'blur', \n innerBorder: 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-drawer-${autoId}-title`); \nconst descriptionId = computed(() => `modo-drawer-${autoId}-desc`); \n \nconst overlayRef = ref<HTMLElement | null>(null); \nconst panelRef = ref<HTMLElement | null>(null); \nconst contentRef = ref<HTMLElement | null>(null); \n \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 (slide from edge) ---------- */ \n \nfunction prefersReducedMotion() { \n return typeof window !== 'undefined' \n && window.matchMedia('(prefers-reduced-motion: reduce)').matches; \n} \n \nlet activeTimeline: gsap.core.Timeline | null = null; \n \nfunction getEnterTransform() { \n const marginOffset = props.inset ? 28 : 0;\n switch (props.side) { \n case 'left': return { xPercent: -100, x: -marginOffset, yPercent: 0, y: 0 }; \n case 'right': return { xPercent: 100, x: marginOffset, yPercent: 0, y: 0 }; \n case 'top': return { xPercent: 0, x: 0, yPercent: -100, y: -marginOffset }; \n case 'bottom': return { xPercent: 0, x: 0, yPercent: 100, y: marginOffset }; \n default: return { xPercent: 100, x: marginOffset, yPercent: 0, y: 0 }; \n } \n} \n \nfunction onOverlayEnter(el: Element, done: () => void) { \n const overlay = (el as HTMLElement) ?? overlayRef.value; \n const panel = \n overlay?.querySelector<HTMLElement>('[data-modo-drawer-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 enter = getEnterTransform(); \n const tl = gsap.timeline({ onComplete: () => { activeTimeline = null; done(); } }); \n activeTimeline = tl; \n \n tl.fromTo(overlay, { opacity: 0 }, { opacity: 1, duration: 0.24, ease: 'power2.out' }, 0); \n \n tl.fromTo( \n panel, \n { xPercent: enter.xPercent, x: enter.x, yPercent: enter.yPercent, y: enter.y, opacity: 1 }, \n { xPercent: 0, x: 0, yPercent: 0, y: 0, opacity: 1, duration: 0.38, ease: 'power4.out' }, \n 0, \n ); \n} \n \nfunction onOverlayLeave(el: Element, done: () => void) { \n const overlay = el as HTMLElement; \n const panel = \n overlay.querySelector<HTMLElement>('[data-modo-drawer-panel]') \n ?? panelRef.value; \n // Bail out without animating, but never without releasing the lock.\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 enter = getEnterTransform(); \n const tl = gsap.timeline({ \n onComplete: () => { \n activeTimeline = null; \n releaseScrollLock(); \n done(); \n }, \n }); \n activeTimeline = tl; \n \n tl.to( \n panel, \n { xPercent: enter.xPercent, x: enter.x, yPercent: enter.yPercent, y: enter.y, duration: 0.28, ease: 'power3.in' }, \n 0, \n ); \n tl.to(overlay, { opacity: 0, duration: 0.24, ease: 'power2.in' }, 0.04); \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\nwatch( \n () => props.modelValue, \n (open) => { \n if (open) { \n const active = document.activeElement as HTMLElement | null; \n previouslyFocused = active; \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 if (previouslyFocused && typeof previouslyFocused.focus === 'function') { \n previouslyFocused.focus(); \n } \n previouslyFocused = null; \n emit('afterLeave'); \n } \n }, \n); \n \nonBeforeUnmount(() => { \n activeTimeline?.kill(); \n releaseScrollLock(); \n}); \n \n/* ---------- Style maps ---------- */ \n \nconst isHorizontal = computed(() => props.side === 'left' || props.side === 'right'); \n \nconst positionClasses = computed(() => { \n switch (props.side) { \n case 'left': return 'flex-row items-stretch justify-start'; \n case 'right': return 'flex-row items-stretch justify-end'; \n case 'top': return 'flex-col items-stretch justify-start'; \n case 'bottom': return 'flex-col items-stretch justify-end'; \n default: return 'flex-row items-stretch justify-end'; \n } \n}); \n \nconst sizeClasses = computed(() => { \n if (isHorizontal.value) { \n if (props.inset) {\n const baseCls = 'h-full max-h-full max-w-full';\n switch (props.size) { \n case 'xsmall': return `${baseCls} w-[16rem]`; \n case 'small': return `${baseCls} w-[18rem]`; \n case 'large': return `${baseCls} w-[28rem]`; \n case 'full': return `${baseCls} w-full`; \n default: return `${baseCls} w-[22rem]`; \n }\n }\n const heightCls = 'h-full'; \n switch (props.size) { \n case 'xsmall': return `${heightCls} w-[17rem] max-w-[88vw]`; \n case 'small': return `${heightCls} w-[20rem] max-w-[90vw]`; \n case 'large': return `${heightCls} w-[36rem] max-w-[95vw]`; \n case 'full': return `${heightCls} w-screen`; \n default: return `${heightCls} w-[28rem] max-w-[92vw]`; \n } \n } else { \n if (props.inset) {\n const baseCls = 'w-full max-w-full max-h-full';\n switch (props.size) { \n case 'xsmall': return `${baseCls} h-[14rem]`; \n case 'small': return `${baseCls} h-[18rem]`; \n case 'large': return `${baseCls} h-[32rem] sm:max-h-[88dvh]`; \n case 'full': return `${baseCls} h-full`; \n default: return `${baseCls} h-[24rem] sm:max-h-[85dvh]`; \n }\n }\n const widthCls = 'w-full'; \n switch (props.size) { \n case 'xsmall': return `${widthCls} h-[14rem] max-h-[75vh]`; \n case 'small': return `${widthCls} h-[18rem] max-h-[80vh]`; \n case 'large': return `${widthCls} h-[32rem] max-h-[90vh]`; \n case 'full': return `${widthCls} h-screen`; \n default: return `${widthCls} h-[24rem] max-h-[85vh]`; \n } \n } \n}); \n \nconst sideBorderClass = computed(() => { \n if (props.inset) return 'border';\n switch (props.side) { \n case 'left': return 'border-r'; \n case 'right': return 'border-l'; \n case 'top': return 'border-b'; \n case 'bottom': return 'border-t'; \n default: return 'border-l'; \n } \n}); \n \n/** \n * Cuando `inset` está activo (default), el panel flota despegado en sus 4 lados\n * y redondea las 4 esquinas respetando `radius`. Si `inset=false`, solo redondea\n * las dos esquinas internas al viewport.\n */ \nconst radiusClasses = computed(() => { \n if (props.inset) {\n // Same radius scale as Sheet / Dialog (--modo-dialog-radius).\n switch (resolvedRadius.value) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded-[0.5rem]';\n case 'large': return 'rounded-[1.25rem]';\n case 'full': return 'rounded-[1.75rem]';\n default: return 'rounded-[0.875rem]';\n }\n }\n if (props.size === 'full') return 'rounded-none'; \n const map = { \n none: { \n left: 'rounded-none', right: 'rounded-none', \n top: 'rounded-none', bottom: 'rounded-none', \n }, \n small: { \n left: 'rounded-r-md', right: 'rounded-l-md', \n top: 'rounded-b-md', bottom: 'rounded-t-md', \n }, \n medium: { \n left: 'rounded-r-xl', right: 'rounded-l-xl', \n top: 'rounded-b-xl', bottom: 'rounded-t-xl', \n }, \n large: { \n left: 'rounded-r-2xl', right: 'rounded-l-2xl', \n top: 'rounded-b-2xl', bottom: 'rounded-t-2xl', \n }, \n full: { \n left: 'rounded-r-3xl', right: 'rounded-l-3xl', \n top: 'rounded-b-3xl', bottom: 'rounded-t-3xl', \n }, \n } as const; \n const r = (resolvedRadius.value ?? 'medium') as keyof typeof map; \n const safeR = map[r] ? r : 'medium'; \n return map[safeR][props.side]; \n}); \n \nconst innerBorderRadiusClass = computed(() => { \n if (!props.inset && props.size === 'full') return 'rounded-none'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-[calc(0.5rem-4px)]';\n case 'large': return 'rounded-[calc(1.25rem-4px)]';\n case 'full': return 'rounded-[calc(1.75rem-4px)]';\n default: return 'rounded-[calc(0.875rem-4px)]'; \n } \n}); \n \nconst scrimVariant = computed(() => props.overlay ?? 'blur'); \n</script>\n"],"mappings":""}
1
+ {"version":3,"file":"Drawer.cjs","names":[],"sources":["../../../src/components/feedback/Drawer.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-drawer-overlay fixed inset-0 z-1200 flex opacity-0', \n inset ? 'p-2.5' : '', \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-drawer-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-drawer modo-drawer-glass relative flex flex-col text-foreground overflow-hidden', \n 'outline-none focus:outline-none focus-visible:outline-none', \n sideBorderClass, \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 --> \n <div v-if=\"showClose\" class=\"absolute top-3 right-3.5 z-10\"> \n <button\n type=\"button\"\n class=\"modo-drawer__x\"\n :aria-label=\"closeLabelText\"\n @click=\"close\"\n >\n <svg viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M4 4l8 8m0-8l-8 8\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" />\n </svg>\n </button>\n </div> \n \n <!-- Content wrapper --> \n <div ref=\"contentRef\" data-modo-drawer-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-5 pt-5', \n showClose ? 'pr-14' : '', \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-5', \n ($slots.header || title || description) ? '' : 'pt-5', \n $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"body\"> \n <slot /> \n </slot> \n </div> \n \n <!-- Footer --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-5 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, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Drawer } from '../../interfaces/feedback/Drawer.interface'; \nimport { \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 { ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Drawer>(), { \n modelValue: false, \n side: 'right', \n size: 'medium', \n inset: true,\n closeOnOverlay: true, \n closeOnEscape: true, \n showClose: true, \n lockScroll: true, \n color: 'default', \n overlay: 'blur', \n innerBorder: 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-drawer-${autoId}-title`); \nconst descriptionId = computed(() => `modo-drawer-${autoId}-desc`); \n \nconst overlayRef = ref<HTMLElement | null>(null); \nconst panelRef = ref<HTMLElement | null>(null); \nconst contentRef = ref<HTMLElement | null>(null); \n \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 (slide from edge) ---------- */ \n \nfunction prefersReducedMotion() { \n return typeof window !== 'undefined' \n && window.matchMedia('(prefers-reduced-motion: reduce)').matches; \n} \n \nlet activeTimeline: gsap.core.Timeline | null = null; \n \nfunction getEnterTransform() { \n const marginOffset = props.inset ? 28 : 0;\n switch (props.side) { \n case 'left': return { xPercent: -100, x: -marginOffset, yPercent: 0, y: 0 }; \n case 'right': return { xPercent: 100, x: marginOffset, yPercent: 0, y: 0 }; \n case 'top': return { xPercent: 0, x: 0, yPercent: -100, y: -marginOffset }; \n case 'bottom': return { xPercent: 0, x: 0, yPercent: 100, y: marginOffset }; \n default: return { xPercent: 100, x: marginOffset, yPercent: 0, y: 0 }; \n } \n} \n \nfunction onOverlayEnter(el: Element, done: () => void) { \n const overlay = (el as HTMLElement) ?? overlayRef.value; \n const panel = \n overlay?.querySelector<HTMLElement>('[data-modo-drawer-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 enter = getEnterTransform(); \n const tl = gsap.timeline({ onComplete: () => { activeTimeline = null; done(); } }); \n activeTimeline = tl; \n \n tl.fromTo(overlay, { opacity: 0 }, { opacity: 1, duration: 0.24, ease: 'power2.out' }, 0); \n \n tl.fromTo( \n panel, \n { xPercent: enter.xPercent, x: enter.x, yPercent: enter.yPercent, y: enter.y, opacity: 1 }, \n { xPercent: 0, x: 0, yPercent: 0, y: 0, opacity: 1, duration: 0.38, ease: 'power4.out' }, \n 0, \n ); \n} \n \nfunction onOverlayLeave(el: Element, done: () => void) { \n const overlay = el as HTMLElement; \n const panel = \n overlay.querySelector<HTMLElement>('[data-modo-drawer-panel]') \n ?? panelRef.value; \n // Bail out without animating, but never without releasing the lock.\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 enter = getEnterTransform(); \n const tl = gsap.timeline({ \n onComplete: () => { \n activeTimeline = null; \n releaseScrollLock(); \n done(); \n }, \n }); \n activeTimeline = tl; \n \n tl.to( \n panel, \n { xPercent: enter.xPercent, x: enter.x, yPercent: enter.yPercent, y: enter.y, duration: 0.28, ease: 'power3.in' }, \n 0, \n ); \n tl.to(overlay, { opacity: 0, duration: 0.24, ease: 'power2.in' }, 0.04); \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\nwatch( \n () => props.modelValue, \n (open) => { \n if (open) { \n const active = document.activeElement as HTMLElement | null; \n previouslyFocused = active; \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 if (previouslyFocused && typeof previouslyFocused.focus === 'function') { \n previouslyFocused.focus(); \n } \n previouslyFocused = null; \n emit('afterLeave'); \n } \n }, \n); \n \nonBeforeUnmount(() => { \n activeTimeline?.kill(); \n releaseScrollLock(); \n}); \n \n/* ---------- Style maps ---------- */ \n \nconst isHorizontal = computed(() => props.side === 'left' || props.side === 'right'); \n \nconst positionClasses = computed(() => { \n switch (props.side) { \n case 'left': return 'flex-row items-stretch justify-start'; \n case 'right': return 'flex-row items-stretch justify-end'; \n case 'top': return 'flex-col items-stretch justify-start'; \n case 'bottom': return 'flex-col items-stretch justify-end'; \n default: return 'flex-row items-stretch justify-end'; \n } \n}); \n \nconst sizeClasses = computed(() => { \n if (isHorizontal.value) { \n if (props.inset) {\n const baseCls = 'h-full max-h-full max-w-full';\n switch (props.size) { \n case 'xsmall': return `${baseCls} w-[16rem]`; \n case 'small': return `${baseCls} w-[18rem]`; \n case 'large': return `${baseCls} w-[28rem]`; \n case 'full': return `${baseCls} w-full`; \n default: return `${baseCls} w-[22rem]`; \n }\n }\n const heightCls = 'h-full'; \n switch (props.size) { \n case 'xsmall': return `${heightCls} w-[17rem] max-w-[88vw]`; \n case 'small': return `${heightCls} w-[20rem] max-w-[90vw]`; \n case 'large': return `${heightCls} w-[36rem] max-w-[95vw]`; \n case 'full': return `${heightCls} w-screen`; \n default: return `${heightCls} w-[28rem] max-w-[92vw]`; \n } \n } else { \n if (props.inset) {\n const baseCls = 'w-full max-w-full max-h-full';\n switch (props.size) { \n case 'xsmall': return `${baseCls} h-[14rem]`; \n case 'small': return `${baseCls} h-[18rem]`; \n case 'large': return `${baseCls} h-[32rem] sm:max-h-[88dvh]`; \n case 'full': return `${baseCls} h-full`; \n default: return `${baseCls} h-[24rem] sm:max-h-[85dvh]`; \n }\n }\n const widthCls = 'w-full'; \n switch (props.size) { \n case 'xsmall': return `${widthCls} h-[14rem] max-h-[75vh]`; \n case 'small': return `${widthCls} h-[18rem] max-h-[80vh]`; \n case 'large': return `${widthCls} h-[32rem] max-h-[90vh]`; \n case 'full': return `${widthCls} h-screen`; \n default: return `${widthCls} h-[24rem] max-h-[85vh]`; \n } \n } \n}); \n \nconst sideBorderClass = computed(() => { \n if (props.inset) return 'border';\n switch (props.side) { \n case 'left': return 'border-r'; \n case 'right': return 'border-l'; \n case 'top': return 'border-b'; \n case 'bottom': return 'border-t'; \n default: return 'border-l'; \n } \n}); \n \n/** \n * Cuando `inset` está activo (default), el panel flota despegado en sus 4 lados\n * y redondea las 4 esquinas respetando `radius`. Si `inset=false`, solo redondea\n * las dos esquinas internas al viewport.\n */ \nconst radiusClasses = computed(() => { \n if (props.inset) {\n // Same radius scale as Sheet / Dialog (--modo-dialog-radius).\n switch (resolvedRadius.value) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded-[0.5rem]';\n case 'large': return 'rounded-[1.25rem]';\n case 'full': return 'rounded-[1.75rem]';\n default: return 'rounded-[0.875rem]';\n }\n }\n if (props.size === 'full') return 'rounded-none'; \n const map = { \n none: { \n left: 'rounded-none', right: 'rounded-none', \n top: 'rounded-none', bottom: 'rounded-none', \n }, \n small: { \n left: 'rounded-r-md', right: 'rounded-l-md', \n top: 'rounded-b-md', bottom: 'rounded-t-md', \n }, \n medium: { \n left: 'rounded-r-xl', right: 'rounded-l-xl', \n top: 'rounded-b-xl', bottom: 'rounded-t-xl', \n }, \n large: { \n left: 'rounded-r-2xl', right: 'rounded-l-2xl', \n top: 'rounded-b-2xl', bottom: 'rounded-t-2xl', \n }, \n full: { \n left: 'rounded-r-3xl', right: 'rounded-l-3xl', \n top: 'rounded-b-3xl', bottom: 'rounded-t-3xl', \n }, \n } as const; \n const r = (resolvedRadius.value ?? 'medium') as keyof typeof map; \n const safeR = map[r] ? r : 'medium'; \n return map[safeR][props.side]; \n}); \n \nconst innerBorderRadiusClass = computed(() => { \n if (!props.inset && props.size === 'full') return 'rounded-none'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-[calc(0.5rem-4px)]';\n case 'large': return 'rounded-[calc(1.25rem-4px)]';\n case 'full': return 'rounded-[calc(1.75rem-4px)]';\n default: return 'rounded-[calc(0.875rem-4px)]'; \n } \n}); \n \nconst scrimVariant = computed(() => props.overlay ?? 'blur'); \n</script>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.mjs","names":[],"sources":["../../../src/components/feedback/Drawer.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-drawer-overlay fixed inset-0 z-1200 flex opacity-0', \n inset ? 'p-2.5' : '', \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-drawer-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-drawer modo-drawer-glass relative flex flex-col text-foreground overflow-hidden', \n 'outline-none focus:outline-none focus-visible:outline-none', \n sideBorderClass, \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 --> \n <div v-if=\"showClose\" class=\"absolute top-3 right-3.5 z-10\"> \n <button\n type=\"button\"\n class=\"modo-drawer__x\"\n aria-label=\"Close\"\n @click=\"close\"\n >\n <svg viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M4 4l8 8m0-8l-8 8\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" />\n </svg>\n </button>\n </div> \n \n <!-- Content wrapper --> \n <div ref=\"contentRef\" data-modo-drawer-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-5 pt-5', \n showClose ? 'pr-14' : '', \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-5', \n ($slots.header || title || description) ? '' : 'pt-5', \n $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"body\"> \n <slot /> \n </slot> \n </div> \n \n <!-- Footer --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-5 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, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Drawer } from '../../interfaces/feedback/Drawer.interface'; \nimport { \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 { ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Drawer>(), { \n modelValue: false, \n side: 'right', \n size: 'medium', \n inset: true,\n closeOnOverlay: true, \n closeOnEscape: true, \n showClose: true, \n lockScroll: true, \n color: 'default', \n overlay: 'blur', \n innerBorder: 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-drawer-${autoId}-title`); \nconst descriptionId = computed(() => `modo-drawer-${autoId}-desc`); \n \nconst overlayRef = ref<HTMLElement | null>(null); \nconst panelRef = ref<HTMLElement | null>(null); \nconst contentRef = ref<HTMLElement | null>(null); \n \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 (slide from edge) ---------- */ \n \nfunction prefersReducedMotion() { \n return typeof window !== 'undefined' \n && window.matchMedia('(prefers-reduced-motion: reduce)').matches; \n} \n \nlet activeTimeline: gsap.core.Timeline | null = null; \n \nfunction getEnterTransform() { \n const marginOffset = props.inset ? 28 : 0;\n switch (props.side) { \n case 'left': return { xPercent: -100, x: -marginOffset, yPercent: 0, y: 0 }; \n case 'right': return { xPercent: 100, x: marginOffset, yPercent: 0, y: 0 }; \n case 'top': return { xPercent: 0, x: 0, yPercent: -100, y: -marginOffset }; \n case 'bottom': return { xPercent: 0, x: 0, yPercent: 100, y: marginOffset }; \n default: return { xPercent: 100, x: marginOffset, yPercent: 0, y: 0 }; \n } \n} \n \nfunction onOverlayEnter(el: Element, done: () => void) { \n const overlay = (el as HTMLElement) ?? overlayRef.value; \n const panel = \n overlay?.querySelector<HTMLElement>('[data-modo-drawer-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 enter = getEnterTransform(); \n const tl = gsap.timeline({ onComplete: () => { activeTimeline = null; done(); } }); \n activeTimeline = tl; \n \n tl.fromTo(overlay, { opacity: 0 }, { opacity: 1, duration: 0.24, ease: 'power2.out' }, 0); \n \n tl.fromTo( \n panel, \n { xPercent: enter.xPercent, x: enter.x, yPercent: enter.yPercent, y: enter.y, opacity: 1 }, \n { xPercent: 0, x: 0, yPercent: 0, y: 0, opacity: 1, duration: 0.38, ease: 'power4.out' }, \n 0, \n ); \n} \n \nfunction onOverlayLeave(el: Element, done: () => void) { \n const overlay = el as HTMLElement; \n const panel = \n overlay.querySelector<HTMLElement>('[data-modo-drawer-panel]') \n ?? panelRef.value; \n // Bail out without animating, but never without releasing the lock.\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 enter = getEnterTransform(); \n const tl = gsap.timeline({ \n onComplete: () => { \n activeTimeline = null; \n releaseScrollLock(); \n done(); \n }, \n }); \n activeTimeline = tl; \n \n tl.to( \n panel, \n { xPercent: enter.xPercent, x: enter.x, yPercent: enter.yPercent, y: enter.y, duration: 0.28, ease: 'power3.in' }, \n 0, \n ); \n tl.to(overlay, { opacity: 0, duration: 0.24, ease: 'power2.in' }, 0.04); \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\nwatch( \n () => props.modelValue, \n (open) => { \n if (open) { \n const active = document.activeElement as HTMLElement | null; \n previouslyFocused = active; \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 if (previouslyFocused && typeof previouslyFocused.focus === 'function') { \n previouslyFocused.focus(); \n } \n previouslyFocused = null; \n emit('afterLeave'); \n } \n }, \n); \n \nonBeforeUnmount(() => { \n activeTimeline?.kill(); \n releaseScrollLock(); \n}); \n \n/* ---------- Style maps ---------- */ \n \nconst isHorizontal = computed(() => props.side === 'left' || props.side === 'right'); \n \nconst positionClasses = computed(() => { \n switch (props.side) { \n case 'left': return 'flex-row items-stretch justify-start'; \n case 'right': return 'flex-row items-stretch justify-end'; \n case 'top': return 'flex-col items-stretch justify-start'; \n case 'bottom': return 'flex-col items-stretch justify-end'; \n default: return 'flex-row items-stretch justify-end'; \n } \n}); \n \nconst sizeClasses = computed(() => { \n if (isHorizontal.value) { \n if (props.inset) {\n const baseCls = 'h-full max-h-full max-w-full';\n switch (props.size) { \n case 'xsmall': return `${baseCls} w-[16rem]`; \n case 'small': return `${baseCls} w-[18rem]`; \n case 'large': return `${baseCls} w-[28rem]`; \n case 'full': return `${baseCls} w-full`; \n default: return `${baseCls} w-[22rem]`; \n }\n }\n const heightCls = 'h-full'; \n switch (props.size) { \n case 'xsmall': return `${heightCls} w-[17rem] max-w-[88vw]`; \n case 'small': return `${heightCls} w-[20rem] max-w-[90vw]`; \n case 'large': return `${heightCls} w-[36rem] max-w-[95vw]`; \n case 'full': return `${heightCls} w-screen`; \n default: return `${heightCls} w-[28rem] max-w-[92vw]`; \n } \n } else { \n if (props.inset) {\n const baseCls = 'w-full max-w-full max-h-full';\n switch (props.size) { \n case 'xsmall': return `${baseCls} h-[14rem]`; \n case 'small': return `${baseCls} h-[18rem]`; \n case 'large': return `${baseCls} h-[32rem] sm:max-h-[88dvh]`; \n case 'full': return `${baseCls} h-full`; \n default: return `${baseCls} h-[24rem] sm:max-h-[85dvh]`; \n }\n }\n const widthCls = 'w-full'; \n switch (props.size) { \n case 'xsmall': return `${widthCls} h-[14rem] max-h-[75vh]`; \n case 'small': return `${widthCls} h-[18rem] max-h-[80vh]`; \n case 'large': return `${widthCls} h-[32rem] max-h-[90vh]`; \n case 'full': return `${widthCls} h-screen`; \n default: return `${widthCls} h-[24rem] max-h-[85vh]`; \n } \n } \n}); \n \nconst sideBorderClass = computed(() => { \n if (props.inset) return 'border';\n switch (props.side) { \n case 'left': return 'border-r'; \n case 'right': return 'border-l'; \n case 'top': return 'border-b'; \n case 'bottom': return 'border-t'; \n default: return 'border-l'; \n } \n}); \n \n/** \n * Cuando `inset` está activo (default), el panel flota despegado en sus 4 lados\n * y redondea las 4 esquinas respetando `radius`. Si `inset=false`, solo redondea\n * las dos esquinas internas al viewport.\n */ \nconst radiusClasses = computed(() => { \n if (props.inset) {\n // Same radius scale as Sheet / Dialog (--modo-dialog-radius).\n switch (resolvedRadius.value) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded-[0.5rem]';\n case 'large': return 'rounded-[1.25rem]';\n case 'full': return 'rounded-[1.75rem]';\n default: return 'rounded-[0.875rem]';\n }\n }\n if (props.size === 'full') return 'rounded-none'; \n const map = { \n none: { \n left: 'rounded-none', right: 'rounded-none', \n top: 'rounded-none', bottom: 'rounded-none', \n }, \n small: { \n left: 'rounded-r-md', right: 'rounded-l-md', \n top: 'rounded-b-md', bottom: 'rounded-t-md', \n }, \n medium: { \n left: 'rounded-r-xl', right: 'rounded-l-xl', \n top: 'rounded-b-xl', bottom: 'rounded-t-xl', \n }, \n large: { \n left: 'rounded-r-2xl', right: 'rounded-l-2xl', \n top: 'rounded-b-2xl', bottom: 'rounded-t-2xl', \n }, \n full: { \n left: 'rounded-r-3xl', right: 'rounded-l-3xl', \n top: 'rounded-b-3xl', bottom: 'rounded-t-3xl', \n }, \n } as const; \n const r = (resolvedRadius.value ?? 'medium') as keyof typeof map; \n const safeR = map[r] ? r : 'medium'; \n return map[safeR][props.side]; \n}); \n \nconst innerBorderRadiusClass = computed(() => { \n if (!props.inset && props.size === 'full') return 'rounded-none'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-[calc(0.5rem-4px)]';\n case 'large': return 'rounded-[calc(1.25rem-4px)]';\n case 'full': return 'rounded-[calc(1.75rem-4px)]';\n default: return 'rounded-[calc(0.875rem-4px)]'; \n } \n}); \n \nconst scrimVariant = computed(() => props.overlay ?? 'blur'); \n</script>\n"],"mappings":""}
1
+ {"version":3,"file":"Drawer.mjs","names":[],"sources":["../../../src/components/feedback/Drawer.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-drawer-overlay fixed inset-0 z-1200 flex opacity-0', \n inset ? 'p-2.5' : '', \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-drawer-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-drawer modo-drawer-glass relative flex flex-col text-foreground overflow-hidden', \n 'outline-none focus:outline-none focus-visible:outline-none', \n sideBorderClass, \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 --> \n <div v-if=\"showClose\" class=\"absolute top-3 right-3.5 z-10\"> \n <button\n type=\"button\"\n class=\"modo-drawer__x\"\n :aria-label=\"closeLabelText\"\n @click=\"close\"\n >\n <svg viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M4 4l8 8m0-8l-8 8\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" />\n </svg>\n </button>\n </div> \n \n <!-- Content wrapper --> \n <div ref=\"contentRef\" data-modo-drawer-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-5 pt-5', \n showClose ? 'pr-14' : '', \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-5', \n ($slots.header || title || description) ? '' : 'pt-5', \n $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"body\"> \n <slot /> \n </slot> \n </div> \n \n <!-- Footer --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-5 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, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Drawer } from '../../interfaces/feedback/Drawer.interface'; \nimport { \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 { ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Drawer>(), { \n modelValue: false, \n side: 'right', \n size: 'medium', \n inset: true,\n closeOnOverlay: true, \n closeOnEscape: true, \n showClose: true, \n lockScroll: true, \n color: 'default', \n overlay: 'blur', \n innerBorder: 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-drawer-${autoId}-title`); \nconst descriptionId = computed(() => `modo-drawer-${autoId}-desc`); \n \nconst overlayRef = ref<HTMLElement | null>(null); \nconst panelRef = ref<HTMLElement | null>(null); \nconst contentRef = ref<HTMLElement | null>(null); \n \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 (slide from edge) ---------- */ \n \nfunction prefersReducedMotion() { \n return typeof window !== 'undefined' \n && window.matchMedia('(prefers-reduced-motion: reduce)').matches; \n} \n \nlet activeTimeline: gsap.core.Timeline | null = null; \n \nfunction getEnterTransform() { \n const marginOffset = props.inset ? 28 : 0;\n switch (props.side) { \n case 'left': return { xPercent: -100, x: -marginOffset, yPercent: 0, y: 0 }; \n case 'right': return { xPercent: 100, x: marginOffset, yPercent: 0, y: 0 }; \n case 'top': return { xPercent: 0, x: 0, yPercent: -100, y: -marginOffset }; \n case 'bottom': return { xPercent: 0, x: 0, yPercent: 100, y: marginOffset }; \n default: return { xPercent: 100, x: marginOffset, yPercent: 0, y: 0 }; \n } \n} \n \nfunction onOverlayEnter(el: Element, done: () => void) { \n const overlay = (el as HTMLElement) ?? overlayRef.value; \n const panel = \n overlay?.querySelector<HTMLElement>('[data-modo-drawer-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 enter = getEnterTransform(); \n const tl = gsap.timeline({ onComplete: () => { activeTimeline = null; done(); } }); \n activeTimeline = tl; \n \n tl.fromTo(overlay, { opacity: 0 }, { opacity: 1, duration: 0.24, ease: 'power2.out' }, 0); \n \n tl.fromTo( \n panel, \n { xPercent: enter.xPercent, x: enter.x, yPercent: enter.yPercent, y: enter.y, opacity: 1 }, \n { xPercent: 0, x: 0, yPercent: 0, y: 0, opacity: 1, duration: 0.38, ease: 'power4.out' }, \n 0, \n ); \n} \n \nfunction onOverlayLeave(el: Element, done: () => void) { \n const overlay = el as HTMLElement; \n const panel = \n overlay.querySelector<HTMLElement>('[data-modo-drawer-panel]') \n ?? panelRef.value; \n // Bail out without animating, but never without releasing the lock.\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 enter = getEnterTransform(); \n const tl = gsap.timeline({ \n onComplete: () => { \n activeTimeline = null; \n releaseScrollLock(); \n done(); \n }, \n }); \n activeTimeline = tl; \n \n tl.to( \n panel, \n { xPercent: enter.xPercent, x: enter.x, yPercent: enter.yPercent, y: enter.y, duration: 0.28, ease: 'power3.in' }, \n 0, \n ); \n tl.to(overlay, { opacity: 0, duration: 0.24, ease: 'power2.in' }, 0.04); \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\nwatch( \n () => props.modelValue, \n (open) => { \n if (open) { \n const active = document.activeElement as HTMLElement | null; \n previouslyFocused = active; \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 if (previouslyFocused && typeof previouslyFocused.focus === 'function') { \n previouslyFocused.focus(); \n } \n previouslyFocused = null; \n emit('afterLeave'); \n } \n }, \n); \n \nonBeforeUnmount(() => { \n activeTimeline?.kill(); \n releaseScrollLock(); \n}); \n \n/* ---------- Style maps ---------- */ \n \nconst isHorizontal = computed(() => props.side === 'left' || props.side === 'right'); \n \nconst positionClasses = computed(() => { \n switch (props.side) { \n case 'left': return 'flex-row items-stretch justify-start'; \n case 'right': return 'flex-row items-stretch justify-end'; \n case 'top': return 'flex-col items-stretch justify-start'; \n case 'bottom': return 'flex-col items-stretch justify-end'; \n default: return 'flex-row items-stretch justify-end'; \n } \n}); \n \nconst sizeClasses = computed(() => { \n if (isHorizontal.value) { \n if (props.inset) {\n const baseCls = 'h-full max-h-full max-w-full';\n switch (props.size) { \n case 'xsmall': return `${baseCls} w-[16rem]`; \n case 'small': return `${baseCls} w-[18rem]`; \n case 'large': return `${baseCls} w-[28rem]`; \n case 'full': return `${baseCls} w-full`; \n default: return `${baseCls} w-[22rem]`; \n }\n }\n const heightCls = 'h-full'; \n switch (props.size) { \n case 'xsmall': return `${heightCls} w-[17rem] max-w-[88vw]`; \n case 'small': return `${heightCls} w-[20rem] max-w-[90vw]`; \n case 'large': return `${heightCls} w-[36rem] max-w-[95vw]`; \n case 'full': return `${heightCls} w-screen`; \n default: return `${heightCls} w-[28rem] max-w-[92vw]`; \n } \n } else { \n if (props.inset) {\n const baseCls = 'w-full max-w-full max-h-full';\n switch (props.size) { \n case 'xsmall': return `${baseCls} h-[14rem]`; \n case 'small': return `${baseCls} h-[18rem]`; \n case 'large': return `${baseCls} h-[32rem] sm:max-h-[88dvh]`; \n case 'full': return `${baseCls} h-full`; \n default: return `${baseCls} h-[24rem] sm:max-h-[85dvh]`; \n }\n }\n const widthCls = 'w-full'; \n switch (props.size) { \n case 'xsmall': return `${widthCls} h-[14rem] max-h-[75vh]`; \n case 'small': return `${widthCls} h-[18rem] max-h-[80vh]`; \n case 'large': return `${widthCls} h-[32rem] max-h-[90vh]`; \n case 'full': return `${widthCls} h-screen`; \n default: return `${widthCls} h-[24rem] max-h-[85vh]`; \n } \n } \n}); \n \nconst sideBorderClass = computed(() => { \n if (props.inset) return 'border';\n switch (props.side) { \n case 'left': return 'border-r'; \n case 'right': return 'border-l'; \n case 'top': return 'border-b'; \n case 'bottom': return 'border-t'; \n default: return 'border-l'; \n } \n}); \n \n/** \n * Cuando `inset` está activo (default), el panel flota despegado en sus 4 lados\n * y redondea las 4 esquinas respetando `radius`. Si `inset=false`, solo redondea\n * las dos esquinas internas al viewport.\n */ \nconst radiusClasses = computed(() => { \n if (props.inset) {\n // Same radius scale as Sheet / Dialog (--modo-dialog-radius).\n switch (resolvedRadius.value) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded-[0.5rem]';\n case 'large': return 'rounded-[1.25rem]';\n case 'full': return 'rounded-[1.75rem]';\n default: return 'rounded-[0.875rem]';\n }\n }\n if (props.size === 'full') return 'rounded-none'; \n const map = { \n none: { \n left: 'rounded-none', right: 'rounded-none', \n top: 'rounded-none', bottom: 'rounded-none', \n }, \n small: { \n left: 'rounded-r-md', right: 'rounded-l-md', \n top: 'rounded-b-md', bottom: 'rounded-t-md', \n }, \n medium: { \n left: 'rounded-r-xl', right: 'rounded-l-xl', \n top: 'rounded-b-xl', bottom: 'rounded-t-xl', \n }, \n large: { \n left: 'rounded-r-2xl', right: 'rounded-l-2xl', \n top: 'rounded-b-2xl', bottom: 'rounded-t-2xl', \n }, \n full: { \n left: 'rounded-r-3xl', right: 'rounded-l-3xl', \n top: 'rounded-b-3xl', bottom: 'rounded-t-3xl', \n }, \n } as const; \n const r = (resolvedRadius.value ?? 'medium') as keyof typeof map; \n const safeR = map[r] ? r : 'medium'; \n return map[safeR][props.side]; \n}); \n \nconst innerBorderRadiusClass = computed(() => { \n if (!props.inset && props.size === 'full') return 'rounded-none'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-[calc(0.5rem-4px)]';\n case 'large': return 'rounded-[calc(1.25rem-4px)]';\n case 'full': return 'rounded-[calc(1.75rem-4px)]';\n default: return 'rounded-[calc(0.875rem-4px)]'; \n } \n}); \n \nconst scrimVariant = computed(() => props.overlay ?? 'blur'); \n</script>\n"],"mappings":""}
@@ -20,16 +20,17 @@ var _hoisted_4 = {
20
20
  key: 1,
21
21
  class: "absolute top-3 right-3.5 z-10"
22
22
  };
23
- var _hoisted_5 = {
23
+ var _hoisted_5 = ["aria-label"];
24
+ var _hoisted_6 = {
24
25
  key: 2,
25
26
  class: "relative flex items-center justify-end gap-2 px-5 py-4"
26
27
  };
27
- var _hoisted_6 = {
28
+ var _hoisted_7 = {
28
29
  key: 0,
29
30
  "aria-hidden": "true",
30
31
  class: "pointer-events-none absolute top-0 left-1 right-1 h-px bg-border/40"
31
32
  };
32
- var _hoisted_7 = {
33
+ var _hoisted_8 = {
33
34
  key: 1,
34
35
  "aria-hidden": "true",
35
36
  class: "pointer-events-none absolute top-0 left-0 right-0 h-px bg-border"
@@ -74,7 +75,8 @@ var Drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue
74
75
  default: false
75
76
  },
76
77
  id: {},
77
- ariaLabel: {}
78
+ ariaLabel: {},
79
+ closeLabel: {}
78
80
  },
79
81
  emits: [
80
82
  "update:modelValue",
@@ -84,6 +86,8 @@ var Drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue
84
86
  ],
85
87
  setup(__props, { emit: __emit }) {
86
88
  const props = __props;
89
+ const loc = require_useModoConfig.useModoLocale();
90
+ const closeLabelText = (0, vue.computed)(() => props.closeLabel ?? loc.value.common.close);
87
91
  const emit = __emit;
88
92
  const autoId = (0, vue.useId)();
89
93
  const titleId = (0, vue.computed)(() => `modo-drawer-${autoId}-title`);
@@ -475,7 +479,7 @@ var Drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue
475
479
  __props.showClose ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_4, [(0, vue.createElementVNode)("button", {
476
480
  type: "button",
477
481
  class: "modo-drawer__x",
478
- "aria-label": "Close",
482
+ "aria-label": closeLabelText.value,
479
483
  onClick: close
480
484
  }, [..._cache[1] || (_cache[1] = [(0, vue.createElementVNode)("svg", {
481
485
  viewBox: "0 0 16 16",
@@ -487,7 +491,7 @@ var Drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue
487
491
  stroke: "currentColor",
488
492
  "stroke-width": "1.6",
489
493
  "stroke-linecap": "round"
490
- })], -1)])])])) : (0, vue.createCommentVNode)("", true),
494
+ })], -1)])], 8, _hoisted_5)])) : (0, vue.createCommentVNode)("", true),
491
495
  (0, vue.createElementVNode)("div", {
492
496
  ref_key: "contentRef",
493
497
  ref: contentRef,
@@ -529,7 +533,7 @@ var Drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue
529
533
  _ctx.$slots.footer ? "pb-4" : "pb-6"
530
534
  ])
531
535
  }, [(0, vue.renderSlot)(_ctx.$slots, "body", {}, () => [(0, vue.renderSlot)(_ctx.$slots, "default")])], 2)) : (0, vue.createCommentVNode)("", true),
532
- _ctx.$slots.footer ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("footer", _hoisted_5, [__props.innerBorder ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_6)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_7)), (0, vue.renderSlot)(_ctx.$slots, "footer", { close })])) : (0, vue.createCommentVNode)("", true)
536
+ _ctx.$slots.footer ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("footer", _hoisted_6, [__props.innerBorder ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_7)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_8)), (0, vue.renderSlot)(_ctx.$slots, "footer", { close })])) : (0, vue.createCommentVNode)("", true)
533
537
  ], 512)
534
538
  ], 42, _hoisted_3)], 46, _hoisted_1)) : (0, vue.createCommentVNode)("", true)]),
535
539
  _: 3
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.vue_vue_type_script_setup_true_lang.cjs","names":["$slots"],"sources":["../../../src/components/feedback/Drawer.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-drawer-overlay fixed inset-0 z-1200 flex opacity-0', \n inset ? 'p-2.5' : '', \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-drawer-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-drawer modo-drawer-glass relative flex flex-col text-foreground overflow-hidden', \n 'outline-none focus:outline-none focus-visible:outline-none', \n sideBorderClass, \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 --> \n <div v-if=\"showClose\" class=\"absolute top-3 right-3.5 z-10\"> \n <button\n type=\"button\"\n class=\"modo-drawer__x\"\n aria-label=\"Close\"\n @click=\"close\"\n >\n <svg viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M4 4l8 8m0-8l-8 8\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" />\n </svg>\n </button>\n </div> \n \n <!-- Content wrapper --> \n <div ref=\"contentRef\" data-modo-drawer-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-5 pt-5', \n showClose ? 'pr-14' : '', \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-5', \n ($slots.header || title || description) ? '' : 'pt-5', \n $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"body\"> \n <slot /> \n </slot> \n </div> \n \n <!-- Footer --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-5 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, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Drawer } from '../../interfaces/feedback/Drawer.interface'; \nimport { \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 { ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Drawer>(), { \n modelValue: false, \n side: 'right', \n size: 'medium', \n inset: true,\n closeOnOverlay: true, \n closeOnEscape: true, \n showClose: true, \n lockScroll: true, \n color: 'default', \n overlay: 'blur', \n innerBorder: 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-drawer-${autoId}-title`); \nconst descriptionId = computed(() => `modo-drawer-${autoId}-desc`); \n \nconst overlayRef = ref<HTMLElement | null>(null); \nconst panelRef = ref<HTMLElement | null>(null); \nconst contentRef = ref<HTMLElement | null>(null); \n \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 (slide from edge) ---------- */ \n \nfunction prefersReducedMotion() { \n return typeof window !== 'undefined' \n && window.matchMedia('(prefers-reduced-motion: reduce)').matches; \n} \n \nlet activeTimeline: gsap.core.Timeline | null = null; \n \nfunction getEnterTransform() { \n const marginOffset = props.inset ? 28 : 0;\n switch (props.side) { \n case 'left': return { xPercent: -100, x: -marginOffset, yPercent: 0, y: 0 }; \n case 'right': return { xPercent: 100, x: marginOffset, yPercent: 0, y: 0 }; \n case 'top': return { xPercent: 0, x: 0, yPercent: -100, y: -marginOffset }; \n case 'bottom': return { xPercent: 0, x: 0, yPercent: 100, y: marginOffset }; \n default: return { xPercent: 100, x: marginOffset, yPercent: 0, y: 0 }; \n } \n} \n \nfunction onOverlayEnter(el: Element, done: () => void) { \n const overlay = (el as HTMLElement) ?? overlayRef.value; \n const panel = \n overlay?.querySelector<HTMLElement>('[data-modo-drawer-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 enter = getEnterTransform(); \n const tl = gsap.timeline({ onComplete: () => { activeTimeline = null; done(); } }); \n activeTimeline = tl; \n \n tl.fromTo(overlay, { opacity: 0 }, { opacity: 1, duration: 0.24, ease: 'power2.out' }, 0); \n \n tl.fromTo( \n panel, \n { xPercent: enter.xPercent, x: enter.x, yPercent: enter.yPercent, y: enter.y, opacity: 1 }, \n { xPercent: 0, x: 0, yPercent: 0, y: 0, opacity: 1, duration: 0.38, ease: 'power4.out' }, \n 0, \n ); \n} \n \nfunction onOverlayLeave(el: Element, done: () => void) { \n const overlay = el as HTMLElement; \n const panel = \n overlay.querySelector<HTMLElement>('[data-modo-drawer-panel]') \n ?? panelRef.value; \n // Bail out without animating, but never without releasing the lock.\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 enter = getEnterTransform(); \n const tl = gsap.timeline({ \n onComplete: () => { \n activeTimeline = null; \n releaseScrollLock(); \n done(); \n }, \n }); \n activeTimeline = tl; \n \n tl.to( \n panel, \n { xPercent: enter.xPercent, x: enter.x, yPercent: enter.yPercent, y: enter.y, duration: 0.28, ease: 'power3.in' }, \n 0, \n ); \n tl.to(overlay, { opacity: 0, duration: 0.24, ease: 'power2.in' }, 0.04); \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\nwatch( \n () => props.modelValue, \n (open) => { \n if (open) { \n const active = document.activeElement as HTMLElement | null; \n previouslyFocused = active; \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 if (previouslyFocused && typeof previouslyFocused.focus === 'function') { \n previouslyFocused.focus(); \n } \n previouslyFocused = null; \n emit('afterLeave'); \n } \n }, \n); \n \nonBeforeUnmount(() => { \n activeTimeline?.kill(); \n releaseScrollLock(); \n}); \n \n/* ---------- Style maps ---------- */ \n \nconst isHorizontal = computed(() => props.side === 'left' || props.side === 'right'); \n \nconst positionClasses = computed(() => { \n switch (props.side) { \n case 'left': return 'flex-row items-stretch justify-start'; \n case 'right': return 'flex-row items-stretch justify-end'; \n case 'top': return 'flex-col items-stretch justify-start'; \n case 'bottom': return 'flex-col items-stretch justify-end'; \n default: return 'flex-row items-stretch justify-end'; \n } \n}); \n \nconst sizeClasses = computed(() => { \n if (isHorizontal.value) { \n if (props.inset) {\n const baseCls = 'h-full max-h-full max-w-full';\n switch (props.size) { \n case 'xsmall': return `${baseCls} w-[16rem]`; \n case 'small': return `${baseCls} w-[18rem]`; \n case 'large': return `${baseCls} w-[28rem]`; \n case 'full': return `${baseCls} w-full`; \n default: return `${baseCls} w-[22rem]`; \n }\n }\n const heightCls = 'h-full'; \n switch (props.size) { \n case 'xsmall': return `${heightCls} w-[17rem] max-w-[88vw]`; \n case 'small': return `${heightCls} w-[20rem] max-w-[90vw]`; \n case 'large': return `${heightCls} w-[36rem] max-w-[95vw]`; \n case 'full': return `${heightCls} w-screen`; \n default: return `${heightCls} w-[28rem] max-w-[92vw]`; \n } \n } else { \n if (props.inset) {\n const baseCls = 'w-full max-w-full max-h-full';\n switch (props.size) { \n case 'xsmall': return `${baseCls} h-[14rem]`; \n case 'small': return `${baseCls} h-[18rem]`; \n case 'large': return `${baseCls} h-[32rem] sm:max-h-[88dvh]`; \n case 'full': return `${baseCls} h-full`; \n default: return `${baseCls} h-[24rem] sm:max-h-[85dvh]`; \n }\n }\n const widthCls = 'w-full'; \n switch (props.size) { \n case 'xsmall': return `${widthCls} h-[14rem] max-h-[75vh]`; \n case 'small': return `${widthCls} h-[18rem] max-h-[80vh]`; \n case 'large': return `${widthCls} h-[32rem] max-h-[90vh]`; \n case 'full': return `${widthCls} h-screen`; \n default: return `${widthCls} h-[24rem] max-h-[85vh]`; \n } \n } \n}); \n \nconst sideBorderClass = computed(() => { \n if (props.inset) return 'border';\n switch (props.side) { \n case 'left': return 'border-r'; \n case 'right': return 'border-l'; \n case 'top': return 'border-b'; \n case 'bottom': return 'border-t'; \n default: return 'border-l'; \n } \n}); \n \n/** \n * Cuando `inset` está activo (default), el panel flota despegado en sus 4 lados\n * y redondea las 4 esquinas respetando `radius`. Si `inset=false`, solo redondea\n * las dos esquinas internas al viewport.\n */ \nconst radiusClasses = computed(() => { \n if (props.inset) {\n // Same radius scale as Sheet / Dialog (--modo-dialog-radius).\n switch (resolvedRadius.value) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded-[0.5rem]';\n case 'large': return 'rounded-[1.25rem]';\n case 'full': return 'rounded-[1.75rem]';\n default: return 'rounded-[0.875rem]';\n }\n }\n if (props.size === 'full') return 'rounded-none'; \n const map = { \n none: { \n left: 'rounded-none', right: 'rounded-none', \n top: 'rounded-none', bottom: 'rounded-none', \n }, \n small: { \n left: 'rounded-r-md', right: 'rounded-l-md', \n top: 'rounded-b-md', bottom: 'rounded-t-md', \n }, \n medium: { \n left: 'rounded-r-xl', right: 'rounded-l-xl', \n top: 'rounded-b-xl', bottom: 'rounded-t-xl', \n }, \n large: { \n left: 'rounded-r-2xl', right: 'rounded-l-2xl', \n top: 'rounded-b-2xl', bottom: 'rounded-t-2xl', \n }, \n full: { \n left: 'rounded-r-3xl', right: 'rounded-l-3xl', \n top: 'rounded-b-3xl', bottom: 'rounded-t-3xl', \n }, \n } as const; \n const r = (resolvedRadius.value ?? 'medium') as keyof typeof map; \n const safeR = map[r] ? r : 'medium'; \n return map[safeR][props.side]; \n}); \n \nconst innerBorderRadiusClass = computed(() => { \n if (!props.inset && props.size === 'full') return 'rounded-none'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-[calc(0.5rem-4px)]';\n case 'large': return 'rounded-[calc(1.25rem-4px)]';\n case 'full': return 'rounded-[calc(1.75rem-4px)]';\n default: return 'rounded-[calc(0.875rem-4px)]'; \n } \n}); \n \nconst scrimVariant = computed(() => props.overlay ?? 'blur'); \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyPA,IAAM,qBACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAhGJ,MAAM,QAAQ;EAcd,MAAM,OAAO;EAOb,MAAM,UAAA,GAAA,IAAA,QAAgB;EACtB,MAAM,WAAA,GAAA,IAAA,gBAAyB,eAAe,OAAO,QAAQ;EAC7D,MAAM,iBAAA,GAAA,IAAA,gBAA+B,eAAe,OAAO,OAAO;EAElE,MAAM,cAAA,GAAA,IAAA,KAAqC,KAAK;EAChD,MAAM,YAAA,GAAA,IAAA,KAAmC,KAAK;EAC9C,MAAM,cAAA,GAAA,IAAA,KAAqC,KAAK;EAEhD,MAAM,iBAAiB,sBAAA,wBAAwB,MAAM,OAAiC;EAEtF,MAAM,MAAM,sBAAA,eAAe;EAC3B,MAAM,QAAQ,sBAAA,kBAAkB;EAChC,MAAM,eAAA,GAAA,IAAA,gBAA6B,qBAAA,iBAAiB,MAAM,MAAM,CAAC;EAEjE,MAAM,gBAAA,GAAA,IAAA,gBAA8B;GAChC,MAAM,eAAe,KAAK,MAAM,WAC1B;IACE,GAAG,iBAAA,kBAAkB,IAAI,MAAM,SAAS;IACxC,GAAG,iBAAA,2BAA2B,IAAI,MAAM,UAAU,wBAAA,kBAAkB,wBAAA,oBAAoB;IAC3F,GACC,EAAE;GACR,MAAM,cAAc,KAAK,MAAM,WACzB,iBAAA,kBAAkB,IAAI,MAAM,SAAQ,GACpC,EAAE;GACR,MAAM,kBAAmB,YAAY,UAAU,UAAU,KAAK,MAAM,eAC9D,iBAAA,kBAAkB,IAAI,MAAM,aAAY,GACxC,EAAE;GACR,OAAO;IAAE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,OAAO,WAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAcR,UAfT,YAeS,CAVK,QAAA,gBAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAGR,QAJF,WAIE,MAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAKA,QAJF,WAIE,IAAA,GAAA,IAAA,YACmC,KAAA,QAAA,UAAA,EAAT,OAAK,CAAA,CAAA,CAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA"}
1
+ {"version":3,"file":"Drawer.vue_vue_type_script_setup_true_lang.cjs","names":["$slots"],"sources":["../../../src/components/feedback/Drawer.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-drawer-overlay fixed inset-0 z-1200 flex opacity-0', \n inset ? 'p-2.5' : '', \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-drawer-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-drawer modo-drawer-glass relative flex flex-col text-foreground overflow-hidden', \n 'outline-none focus:outline-none focus-visible:outline-none', \n sideBorderClass, \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 --> \n <div v-if=\"showClose\" class=\"absolute top-3 right-3.5 z-10\"> \n <button\n type=\"button\"\n class=\"modo-drawer__x\"\n :aria-label=\"closeLabelText\"\n @click=\"close\"\n >\n <svg viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M4 4l8 8m0-8l-8 8\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" />\n </svg>\n </button>\n </div> \n \n <!-- Content wrapper --> \n <div ref=\"contentRef\" data-modo-drawer-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-5 pt-5', \n showClose ? 'pr-14' : '', \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-5', \n ($slots.header || title || description) ? '' : 'pt-5', \n $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"body\"> \n <slot /> \n </slot> \n </div> \n \n <!-- Footer --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-5 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, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Drawer } from '../../interfaces/feedback/Drawer.interface'; \nimport { \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 { ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Drawer>(), { \n modelValue: false, \n side: 'right', \n size: 'medium', \n inset: true,\n closeOnOverlay: true, \n closeOnEscape: true, \n showClose: true, \n lockScroll: true, \n color: 'default', \n overlay: 'blur', \n innerBorder: 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-drawer-${autoId}-title`); \nconst descriptionId = computed(() => `modo-drawer-${autoId}-desc`); \n \nconst overlayRef = ref<HTMLElement | null>(null); \nconst panelRef = ref<HTMLElement | null>(null); \nconst contentRef = ref<HTMLElement | null>(null); \n \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 (slide from edge) ---------- */ \n \nfunction prefersReducedMotion() { \n return typeof window !== 'undefined' \n && window.matchMedia('(prefers-reduced-motion: reduce)').matches; \n} \n \nlet activeTimeline: gsap.core.Timeline | null = null; \n \nfunction getEnterTransform() { \n const marginOffset = props.inset ? 28 : 0;\n switch (props.side) { \n case 'left': return { xPercent: -100, x: -marginOffset, yPercent: 0, y: 0 }; \n case 'right': return { xPercent: 100, x: marginOffset, yPercent: 0, y: 0 }; \n case 'top': return { xPercent: 0, x: 0, yPercent: -100, y: -marginOffset }; \n case 'bottom': return { xPercent: 0, x: 0, yPercent: 100, y: marginOffset }; \n default: return { xPercent: 100, x: marginOffset, yPercent: 0, y: 0 }; \n } \n} \n \nfunction onOverlayEnter(el: Element, done: () => void) { \n const overlay = (el as HTMLElement) ?? overlayRef.value; \n const panel = \n overlay?.querySelector<HTMLElement>('[data-modo-drawer-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 enter = getEnterTransform(); \n const tl = gsap.timeline({ onComplete: () => { activeTimeline = null; done(); } }); \n activeTimeline = tl; \n \n tl.fromTo(overlay, { opacity: 0 }, { opacity: 1, duration: 0.24, ease: 'power2.out' }, 0); \n \n tl.fromTo( \n panel, \n { xPercent: enter.xPercent, x: enter.x, yPercent: enter.yPercent, y: enter.y, opacity: 1 }, \n { xPercent: 0, x: 0, yPercent: 0, y: 0, opacity: 1, duration: 0.38, ease: 'power4.out' }, \n 0, \n ); \n} \n \nfunction onOverlayLeave(el: Element, done: () => void) { \n const overlay = el as HTMLElement; \n const panel = \n overlay.querySelector<HTMLElement>('[data-modo-drawer-panel]') \n ?? panelRef.value; \n // Bail out without animating, but never without releasing the lock.\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 enter = getEnterTransform(); \n const tl = gsap.timeline({ \n onComplete: () => { \n activeTimeline = null; \n releaseScrollLock(); \n done(); \n }, \n }); \n activeTimeline = tl; \n \n tl.to( \n panel, \n { xPercent: enter.xPercent, x: enter.x, yPercent: enter.yPercent, y: enter.y, duration: 0.28, ease: 'power3.in' }, \n 0, \n ); \n tl.to(overlay, { opacity: 0, duration: 0.24, ease: 'power2.in' }, 0.04); \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\nwatch( \n () => props.modelValue, \n (open) => { \n if (open) { \n const active = document.activeElement as HTMLElement | null; \n previouslyFocused = active; \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 if (previouslyFocused && typeof previouslyFocused.focus === 'function') { \n previouslyFocused.focus(); \n } \n previouslyFocused = null; \n emit('afterLeave'); \n } \n }, \n); \n \nonBeforeUnmount(() => { \n activeTimeline?.kill(); \n releaseScrollLock(); \n}); \n \n/* ---------- Style maps ---------- */ \n \nconst isHorizontal = computed(() => props.side === 'left' || props.side === 'right'); \n \nconst positionClasses = computed(() => { \n switch (props.side) { \n case 'left': return 'flex-row items-stretch justify-start'; \n case 'right': return 'flex-row items-stretch justify-end'; \n case 'top': return 'flex-col items-stretch justify-start'; \n case 'bottom': return 'flex-col items-stretch justify-end'; \n default: return 'flex-row items-stretch justify-end'; \n } \n}); \n \nconst sizeClasses = computed(() => { \n if (isHorizontal.value) { \n if (props.inset) {\n const baseCls = 'h-full max-h-full max-w-full';\n switch (props.size) { \n case 'xsmall': return `${baseCls} w-[16rem]`; \n case 'small': return `${baseCls} w-[18rem]`; \n case 'large': return `${baseCls} w-[28rem]`; \n case 'full': return `${baseCls} w-full`; \n default: return `${baseCls} w-[22rem]`; \n }\n }\n const heightCls = 'h-full'; \n switch (props.size) { \n case 'xsmall': return `${heightCls} w-[17rem] max-w-[88vw]`; \n case 'small': return `${heightCls} w-[20rem] max-w-[90vw]`; \n case 'large': return `${heightCls} w-[36rem] max-w-[95vw]`; \n case 'full': return `${heightCls} w-screen`; \n default: return `${heightCls} w-[28rem] max-w-[92vw]`; \n } \n } else { \n if (props.inset) {\n const baseCls = 'w-full max-w-full max-h-full';\n switch (props.size) { \n case 'xsmall': return `${baseCls} h-[14rem]`; \n case 'small': return `${baseCls} h-[18rem]`; \n case 'large': return `${baseCls} h-[32rem] sm:max-h-[88dvh]`; \n case 'full': return `${baseCls} h-full`; \n default: return `${baseCls} h-[24rem] sm:max-h-[85dvh]`; \n }\n }\n const widthCls = 'w-full'; \n switch (props.size) { \n case 'xsmall': return `${widthCls} h-[14rem] max-h-[75vh]`; \n case 'small': return `${widthCls} h-[18rem] max-h-[80vh]`; \n case 'large': return `${widthCls} h-[32rem] max-h-[90vh]`; \n case 'full': return `${widthCls} h-screen`; \n default: return `${widthCls} h-[24rem] max-h-[85vh]`; \n } \n } \n}); \n \nconst sideBorderClass = computed(() => { \n if (props.inset) return 'border';\n switch (props.side) { \n case 'left': return 'border-r'; \n case 'right': return 'border-l'; \n case 'top': return 'border-b'; \n case 'bottom': return 'border-t'; \n default: return 'border-l'; \n } \n}); \n \n/** \n * Cuando `inset` está activo (default), el panel flota despegado en sus 4 lados\n * y redondea las 4 esquinas respetando `radius`. Si `inset=false`, solo redondea\n * las dos esquinas internas al viewport.\n */ \nconst radiusClasses = computed(() => { \n if (props.inset) {\n // Same radius scale as Sheet / Dialog (--modo-dialog-radius).\n switch (resolvedRadius.value) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded-[0.5rem]';\n case 'large': return 'rounded-[1.25rem]';\n case 'full': return 'rounded-[1.75rem]';\n default: return 'rounded-[0.875rem]';\n }\n }\n if (props.size === 'full') return 'rounded-none'; \n const map = { \n none: { \n left: 'rounded-none', right: 'rounded-none', \n top: 'rounded-none', bottom: 'rounded-none', \n }, \n small: { \n left: 'rounded-r-md', right: 'rounded-l-md', \n top: 'rounded-b-md', bottom: 'rounded-t-md', \n }, \n medium: { \n left: 'rounded-r-xl', right: 'rounded-l-xl', \n top: 'rounded-b-xl', bottom: 'rounded-t-xl', \n }, \n large: { \n left: 'rounded-r-2xl', right: 'rounded-l-2xl', \n top: 'rounded-b-2xl', bottom: 'rounded-t-2xl', \n }, \n full: { \n left: 'rounded-r-3xl', right: 'rounded-l-3xl', \n top: 'rounded-b-3xl', bottom: 'rounded-t-3xl', \n }, \n } as const; \n const r = (resolvedRadius.value ?? 'medium') as keyof typeof map; \n const safeR = map[r] ? r : 'medium'; \n return map[safeR][props.side]; \n}); \n \nconst innerBorderRadiusClass = computed(() => { \n if (!props.inset && props.size === 'full') return 'rounded-none'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-[calc(0.5rem-4px)]';\n case 'large': return 'rounded-[calc(1.25rem-4px)]';\n case 'full': return 'rounded-[calc(1.75rem-4px)]';\n default: return 'rounded-[calc(0.875rem-4px)]'; \n } \n}); \n \nconst scrimVariant = computed(() => props.overlay ?? 'blur'); \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8PA,IAAM,qBACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EApGJ,MAAM,QAAQ;EAcd,MAAM,MAAM,sBAAA,eAAe;EAC3B,MAAM,kBAAA,GAAA,IAAA,gBAAgC,MAAM,cAAc,IAAI,MAAM,OAAO,MAAM;EAGjF,MAAM,OAAO;EAOb,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import { palettesToCssVars, semanticTokensFromPalettes } from "../../config/pale
2
2
  import { surfacesToCssVars } from "../../config/surfaces.mjs";
3
3
  import { hexToOklchString, pickForegroundOklch } from "../../config/colorPrimitives.mjs";
4
4
  import { resolveColorMode } from "../../composables/useColorMode.mjs";
5
- import { useModoConfig, useResolvedRadius, useResolvedTheme } from "../../composables/useModoConfig.mjs";
5
+ import { useModoConfig, useModoLocale, useResolvedRadius, useResolvedTheme } from "../../composables/useModoConfig.mjs";
6
6
  import Typography_default from "../data-display/Typography.mjs";
7
7
  import { lockBodyScroll, unlockBodyScroll } from "../../composables/useBodyScrollLock.mjs";
8
8
  import { Teleport, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, openBlock, ref, renderSlot, toDisplayString, useId, watch, withCtx, withModifiers } from "vue";
@@ -19,16 +19,17 @@ var _hoisted_4 = {
19
19
  key: 1,
20
20
  class: "absolute top-3 right-3.5 z-10"
21
21
  };
22
- var _hoisted_5 = {
22
+ var _hoisted_5 = ["aria-label"];
23
+ var _hoisted_6 = {
23
24
  key: 2,
24
25
  class: "relative flex items-center justify-end gap-2 px-5 py-4"
25
26
  };
26
- var _hoisted_6 = {
27
+ var _hoisted_7 = {
27
28
  key: 0,
28
29
  "aria-hidden": "true",
29
30
  class: "pointer-events-none absolute top-0 left-1 right-1 h-px bg-border/40"
30
31
  };
31
- var _hoisted_7 = {
32
+ var _hoisted_8 = {
32
33
  key: 1,
33
34
  "aria-hidden": "true",
34
35
  class: "pointer-events-none absolute top-0 left-0 right-0 h-px bg-border"
@@ -73,7 +74,8 @@ var Drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
73
74
  default: false
74
75
  },
75
76
  id: {},
76
- ariaLabel: {}
77
+ ariaLabel: {},
78
+ closeLabel: {}
77
79
  },
78
80
  emits: [
79
81
  "update:modelValue",
@@ -83,6 +85,8 @@ var Drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
83
85
  ],
84
86
  setup(__props, { emit: __emit }) {
85
87
  const props = __props;
88
+ const loc = useModoLocale();
89
+ const closeLabelText = computed(() => props.closeLabel ?? loc.value.common.close);
86
90
  const emit = __emit;
87
91
  const autoId = useId();
88
92
  const titleId = computed(() => `modo-drawer-${autoId}-title`);
@@ -474,7 +478,7 @@ var Drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
474
478
  __props.showClose ? (openBlock(), createElementBlock("div", _hoisted_4, [createElementVNode("button", {
475
479
  type: "button",
476
480
  class: "modo-drawer__x",
477
- "aria-label": "Close",
481
+ "aria-label": closeLabelText.value,
478
482
  onClick: close
479
483
  }, [..._cache[1] || (_cache[1] = [createElementVNode("svg", {
480
484
  viewBox: "0 0 16 16",
@@ -486,7 +490,7 @@ var Drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
486
490
  stroke: "currentColor",
487
491
  "stroke-width": "1.6",
488
492
  "stroke-linecap": "round"
489
- })], -1)])])])) : createCommentVNode("", true),
493
+ })], -1)])], 8, _hoisted_5)])) : createCommentVNode("", true),
490
494
  createElementVNode("div", {
491
495
  ref_key: "contentRef",
492
496
  ref: contentRef,
@@ -528,7 +532,7 @@ var Drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
528
532
  _ctx.$slots.footer ? "pb-4" : "pb-6"
529
533
  ])
530
534
  }, [renderSlot(_ctx.$slots, "body", {}, () => [renderSlot(_ctx.$slots, "default")])], 2)) : createCommentVNode("", true),
531
- _ctx.$slots.footer ? (openBlock(), createElementBlock("footer", _hoisted_5, [__props.innerBorder ? (openBlock(), createElementBlock("span", _hoisted_6)) : (openBlock(), createElementBlock("span", _hoisted_7)), renderSlot(_ctx.$slots, "footer", { close })])) : createCommentVNode("", true)
535
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("footer", _hoisted_6, [__props.innerBorder ? (openBlock(), createElementBlock("span", _hoisted_7)) : (openBlock(), createElementBlock("span", _hoisted_8)), renderSlot(_ctx.$slots, "footer", { close })])) : createCommentVNode("", true)
532
536
  ], 512)
533
537
  ], 42, _hoisted_3)], 46, _hoisted_1)) : createCommentVNode("", true)]),
534
538
  _: 3