mood-ui 0.11.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/data-display/calendar/AgendaView.cjs.map +1 -1
- package/dist/components/data-display/calendar/AgendaView.mjs.map +1 -1
- package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.cjs +11 -6
- package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs +18 -13
- package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/Calendar.vue_vue_type_script_setup_true_lang.mjs +4 -4
- package/dist/components/data-display/calendar/Calendar.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/DayView.cjs.map +1 -1
- package/dist/components/data-display/calendar/DayView.mjs.map +1 -1
- package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.cjs +14 -9
- package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs +22 -17
- package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/MonthView.cjs +1 -1
- package/dist/components/data-display/calendar/MonthView.cjs.map +1 -1
- package/dist/components/data-display/calendar/MonthView.mjs +1 -1
- package/dist/components/data-display/calendar/MonthView.mjs.map +1 -1
- package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.cjs +15 -17
- package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs +18 -20
- package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/Scheduler.cjs.map +1 -1
- package/dist/components/data-display/calendar/Scheduler.mjs.map +1 -1
- package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.cjs +14 -9
- package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs +22 -17
- package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/WeekView.cjs.map +1 -1
- package/dist/components/data-display/calendar/WeekView.mjs.map +1 -1
- package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.cjs +14 -9
- package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs +22 -17
- package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.mjs +3 -3
- package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/date-picker/DateTimePicker.cjs.map +1 -1
- package/dist/components/data-display/date-picker/DateTimePicker.mjs.map +1 -1
- package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs +3 -3
- package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Banner.vue_vue_type_script_setup_true_lang.mjs +4 -4
- package/dist/components/feedback/Banner.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Drawer.cjs.map +1 -1
- package/dist/components/feedback/Drawer.mjs.map +1 -1
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.cjs +4 -9
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs +9 -14
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Modal.cjs.map +1 -1
- package/dist/components/feedback/Modal.mjs.map +1 -1
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.cjs +4 -9
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs +9 -14
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Tooltip.cjs.map +1 -1
- package/dist/components/feedback/Tooltip.mjs.map +1 -1
- package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.cjs +44 -17
- package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.mjs +44 -17
- package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/Combobox.cjs.map +1 -1
- package/dist/components/forms/Combobox.mjs.map +1 -1
- package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.cjs +2 -2
- package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/PhoneInput.cjs.map +1 -1
- package/dist/components/forms/PhoneInput.mjs.map +1 -1
- package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.cjs +6 -1
- package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.mjs +6 -1
- package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/SearchInput.cjs.map +1 -1
- package/dist/components/forms/SearchInput.mjs.map +1 -1
- package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.cjs +8 -6
- package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.mjs +8 -6
- package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/layout/PopoverPanel.cjs +1 -1
- package/dist/components/layout/PopoverPanel.cjs.map +1 -1
- package/dist/components/layout/PopoverPanel.mjs +1 -1
- package/dist/components/layout/PopoverPanel.mjs.map +1 -1
- package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs +2 -2
- package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/navigation/Switcher.cjs.map +1 -1
- package/dist/components/navigation/Switcher.mjs.map +1 -1
- package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs +38 -40
- package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs +38 -40
- package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/composables/eventColors.cjs +51 -27
- package/dist/composables/eventColors.cjs.map +1 -1
- package/dist/composables/eventColors.mjs +51 -27
- package/dist/composables/eventColors.mjs.map +1 -1
- package/dist/composables/useBodyScrollLock.cjs +44 -0
- package/dist/composables/useBodyScrollLock.cjs.map +1 -0
- package/dist/composables/useBodyScrollLock.mjs +43 -0
- package/dist/composables/useBodyScrollLock.mjs.map +1 -0
- package/dist/composables/useCalendarTheme.cjs +29 -8
- package/dist/composables/useCalendarTheme.cjs.map +1 -1
- package/dist/composables/useCalendarTheme.mjs +29 -8
- package/dist/composables/useCalendarTheme.mjs.map +1 -1
- package/dist/composables/usePopover.cjs +44 -12
- package/dist/composables/usePopover.cjs.map +1 -1
- package/dist/composables/usePopover.mjs +44 -12
- package/dist/composables/usePopover.mjs.map +1 -1
- package/dist/mood-ui.css +9 -9
- package/dist/types/composables/eventColors.d.ts +2 -2
- package/dist/types/composables/useBodyScrollLock.d.ts +19 -0
- package/dist/types/composables/useCalendarTheme.d.ts +2 -0
- package/dist/types/interfaces/data-display/calendar/AgendaView.interface.d.ts +5 -0
- package/dist/types/interfaces/data-display/calendar/DayView.interface.d.ts +5 -0
- package/dist/types/interfaces/data-display/calendar/MonthView.interface.d.ts +5 -0
- package/dist/types/interfaces/data-display/calendar/Scheduler.interface.d.ts +5 -0
- package/dist/types/interfaces/data-display/calendar/WeekView.interface.d.ts +5 -0
- package/dist/types/utils/calendarTooltip.d.ts +13 -0
- package/dist/types/utils/cssLength.d.ts +5 -0
- package/dist/types/utils/tooltipArrow.d.ts +34 -0
- package/dist/utils/calendarTooltip.cjs +18 -0
- package/dist/utils/calendarTooltip.cjs.map +1 -0
- package/dist/utils/calendarTooltip.mjs +18 -0
- package/dist/utils/calendarTooltip.mjs.map +1 -0
- package/dist/utils/cssLength.cjs +13 -0
- package/dist/utils/cssLength.cjs.map +1 -0
- package/dist/utils/cssLength.mjs +13 -0
- package/dist/utils/cssLength.mjs.map +1 -0
- package/dist/utils/tooltipArrow.cjs +37 -0
- package/dist/utils/tooltipArrow.cjs.map +1 -0
- package/dist/utils/tooltipArrow.mjs +36 -0
- package/dist/utils/tooltipArrow.mjs.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../src/components/feedback/Banner.vue"],"sourcesContent":["<template> \n <div \n v-if=\"visible\" \n ref=\"bannerRef\" \n :role=\"liveRole\" \n :aria-live=\"liveness\" \n :class=\"['overflow-hidden', baseClasses, colorClasses, positionClasses, fullWidth ? 'rounded-none' : radiusClasses]\" \n > \n <div v-if=\"showIcon\" :class=\"['shrink-0', iconColorClasses]\"> \n <component :is=\"icon\" v-if=\"icon\" class=\"w-5 h-5\" /> \n <svg v-else-if=\"color === 'info'\" class=\"w-5 h-5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"> \n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z\" /> \n </svg> \n <svg v-else-if=\"color === 'warning'\" class=\"w-5 h-5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"> \n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z\" /> \n </svg> \n <svg v-else-if=\"color === 'danger'\" class=\"w-5 h-5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"> \n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z\" /> \n </svg> \n <svg v-else class=\"w-5 h-5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"> \n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z\" /> \n </svg> \n </div> \n \n <div class=\"flex-1 min-w-0\"> \n <p v-if=\"title\" :class=\"['font-semibold', titleColorClasses]\">{{ title }}</p> \n <div v-if=\"description || $slots.default\" :class=\"[title ? 'mt-1' : '', bodyColorClasses]\"> \n <slot>{{ description }}</slot> \n </div> \n </div> \n \n <div v-if=\"$slots.actions\" class=\"shrink-0 ml-4\"> \n <slot name=\"actions\" /> \n </div> \n \n <Button \n v-if=\"dismissable\" \n ref=\"dismissBtnRef\" \n variant=\"text\" \n size=\"small\" \n radius=\"medium\" \n :icon=\"XMarkIcon\" \n :ariaLabel=\"loc.banner.dismiss\" \n :class=\"['shrink-0 ml-2', dismissClasses]\" \n @click=\"dismiss\" \n /> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { ref, computed, onMounted, nextTick } from 'vue'; \nimport gsap from 'gsap'; \nimport type { Banner } from '../../interfaces/feedback/Banner.interface'; \nimport { useResolvedRadius, useModoLocale } from '../../composables/useModoConfig'; \nimport Button from '../forms/Button.vue'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \n \nconst loc = useModoLocale(); \n \nconst emit = defineEmits<{ dismiss: [] }>(); \n \nconst props = withDefaults(defineProps<Banner>(), { \n color: 'info', \n variant: 'subtle', \n dismissable: false, \n dismissAnimation: 'collapse', \n showIcon: true, \n position: 'inline', \n fullWidth: false, \n}); \n \nconst radius = useResolvedRadius(() => props.radius); \nconst radiusClasses = computed(() => { \n switch (radius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-3xl'; \n default: return 'rounded-lg'; \n } \n}); \n \nconst visible = ref(true); \nconst bannerRef = ref<HTMLElement | null>(null); \nconst dismissBtnRef = ref<{ $el: HTMLElement } | null>(null); \n \n/** \n * Intro animation: collapsed height + fade-in + small translate-y. \n * Mirrors the reverse of the default `collapse` dismiss so entry and exit \n * feel symmetrical. Skipped under `prefers-reduced-motion`. \n */ \nonMounted(async () => { \n await nextTick(); \n if (!bannerRef.value) return; \n const mql = typeof window !== 'undefined' && window.matchMedia \n ? window.matchMedia('(prefers-reduced-motion: reduce)') \n : null; \n if (mql?.matches) return; \n \n const el = bannerRef.value; \n gsap.fromTo( \n el, \n { opacity: 0, height: 0, paddingTop: 0, paddingBottom: 0, marginBottom: 0, y: -4 }, \n { \n opacity: 1, \n height: 'auto', \n paddingTop: '', \n paddingBottom: '', \n marginBottom: '', \n y: 0, \n duration: 0.32, \n ease: 'power2.out', \n clearProps: 'height,paddingTop,paddingBottom,marginBottom,transform', \n }, \n ); \n}); \n \n/** \n * Accessibility: \n * - `danger`/`warning` → `role=\"alert\"` + `aria-live=\"assertive\"` (interrupts). \n * - `info`/`success` → `role=\"status\"` + `aria-live=\"polite\"` (queued). \n * This matches WAI-ARIA guidance: assertive only for time-critical or error \n * messages; polite for informative updates. \n */ \nconst liveRole = computed(() => (props.color === 'danger' || props.color === 'warning' ? 'alert' : 'status')); \nconst liveness = computed<'assertive' | 'polite'>(() => (props.color === 'danger' || props.color === 'warning' ? 'assertive' : 'polite')); \n \nconst dismiss = () => { \n if (!bannerRef.value) return; \n \n if (props.dismissAnimation === 'shrink' && dismissBtnRef.value?.$el) { \n const bannerRect = bannerRef.value.getBoundingClientRect(); \n const btnRect = dismissBtnRef.value.$el.getBoundingClientRect(); \n \n const originX = btnRect.left + btnRect.width / 2 - bannerRect.left; \n const originY = btnRect.top + btnRect.height / 2 - bannerRect.top; \n bannerRef.value.style.transformOrigin = `${originX}px ${originY}px`; \n \n const tl = gsap.timeline({ \n onComplete: () => { \n visible.value = false; \n emit('dismiss'); \n }, \n }); \n \n tl.to(bannerRef.value, { \n scale: 0, \n opacity: 0, \n duration: 0.6, \n ease: 'power1.in', \n }); \n } else { \n gsap.to(bannerRef.value, { \n opacity: 0, \n height: 0, \n paddingTop: 0, \n paddingBottom: 0, \n marginBottom: 0, \n duration: 0.3, \n ease: 'power2.inOut', \n onComplete: () => { \n visible.value = false; \n emit('dismiss'); \n }, \n }); \n } \n}; \n \nconst baseClasses = 'flex items-start gap-3 px-4 py-3 text-sm'; \n \nconst positionClasses = computed(() => { \n switch (props.position) { \n case 'sticky-top': return 'sticky top-0 z-50'; \n case 'sticky-bottom': return 'sticky bottom-0 z-50'; \n default: return ''; \n } \n}); \n \nconst colorClasses = computed(() => { \n const map: Record<string, Record<string, string>> = { \n info: { \n filled: 'bg-info text-info-foreground', \n subtle: 'bg-info-subtle', \n outline: 'border border-info/30 bg-card', \n }, \n warning: { \n filled: 'bg-warning text-warning-foreground', \n subtle: 'bg-warning-subtle', \n outline: 'border border-warning/30 bg-card', \n }, \n danger: { \n filled: 'bg-destructive text-destructive-foreground', \n subtle: 'bg-destructive-subtle', \n outline: 'border border-destructive/30 bg-card', \n }, \n success: { \n filled: 'bg-success text-success-foreground', \n subtle: 'bg-success-subtle', \n outline: 'border border-success/30 bg-card', \n }, \n }; \n return map[props.color]?.[props.variant] ?? map.info.subtle; \n}); \n \nconst iconColorClasses = computed(() => { \n if (props.variant === 'filled') return 'text-current/80'; \n const map: Record<string, string> = { \n info: 'text-info', \n warning: 'text-warning', \n danger: 'text-destructive', \n success: 'text-success', \n }; \n return map[props.color] ?? 'text-info'; \n}); \n \nconst titleColorClasses = computed(() => { \n if (props.variant === 'filled') return ''; \n const map: Record<string, string> = { \n info: 'text-info', \n warning: 'text-warning', \n danger: 'text-destructive', \n success: 'text-success', \n }; \n return map[props.color] ?? 'text-info'; \n}); \n \nconst bodyColorClasses = computed(() => { \n if (props.variant === 'filled') return 'text-current/90'; \n const map: Record<string, string> = { \n info: 'text-info/90', \n warning: 'text-warning/90', \n danger: 'text-destructive/90', \n success: 'text-success/90', \n }; \n return map[props.color] ?? 'text-info/90'; \n}); \n \nconst dismissClasses = computed(() => { \n if (props.variant === 'filled') return 'text-current/70 hover:text-current hover:bg-current/10'; \n const map: Record<string, string> = { \n info: 'text-info/60 hover:text-info hover:bg-info/10', \n warning: 'text-warning/60 hover:text-warning hover:bg-warning/10', \n danger: 'text-destructive/60 hover:text-destructive hover:bg-destructive/10', \n success: 'text-success/60 hover:text-success hover:bg-success/10', \n }; \n return map[props.color] ?? 'text-info/60 hover:text-info hover:bg-info/10'; \n}); \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwKA,IAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;EA/GpB,MAAM,MAAM,eAAe;EAE3B,MAAM,OAAO;EAEb,MAAM,QAAQ;EAUd,MAAM,SAAS,wBAAwB,MAAM,OAAO;EACpD,MAAM,gBAAgB,eAAe;GACjC,QAAQ,OAAO,OAAf;IACI,KAAK,QAAQ,OAAO;IACpB,KAAK,SAAS,OAAO;IACrB,KAAK,SAAS,OAAO;IACrB,KAAK,QAAQ,OAAO;IACpB,SAAS,OAAO;;IAEtB;EAEF,MAAM,UAAU,IAAI,KAAK;EACzB,MAAM,YAAY,IAAwB,KAAK;EAC/C,MAAM,gBAAgB,IAAiC,KAAK;;;;;;EAO5D,UAAU,YAAY;GAClB,MAAM,UAAU;GAChB,IAAI,CAAC,UAAU,OAAO;GAItB,KAHY,OAAO,WAAW,eAAe,OAAO,aAC9C,OAAO,WAAW,mCAAmC,GACrD,OACG,SAAS;GAElB,MAAM,KAAK,UAAU;GACrB,KAAK,OACD,IACA;IAAE,SAAS;IAAG,QAAQ;IAAG,YAAY;IAAG,eAAe;IAAG,cAAc;IAAG,GAAG;IAAI,EAClF;IACI,SAAS;IACT,QAAQ;IACR,YAAY;IACZ,eAAe;IACf,cAAc;IACd,GAAG;IACH,UAAU;IACV,MAAM;IACN,YAAY;IACf,CACJ;IACH;;;;;;;;EASF,MAAM,WAAW,eAAgB,MAAM,UAAU,YAAY,MAAM,UAAU,YAAY,UAAU,SAAU;EAC7G,MAAM,WAAW,eAAwC,MAAM,UAAU,YAAY,MAAM,UAAU,YAAY,cAAc,SA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UAAK,YAAA,WAAA,EAArB,mBAEM,OAFN,YAEM,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CADF,mBAAoI,QAAA;KAA9H,kBAAe;KAAQ,mBAAgB;KAAQ,GAAE;sCAE3D,mBAEM,OAFN,YAEM,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CADF,mBAAuH,QAAA;KAAjH,kBAAe;KAAQ,mBAAgB;KAAQ,GAAE;;IAI/D,mBAKM,OALN,YAKM,CAJO,QAAA,SAAA,WAAA,EAAT,mBAA6E,KAAA;;KAA5D,OAAK,eAAA,CAAA,iBAAoB,kBAAA,MAAiB,CAAA;uBAAM,QAAA,MAAK,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA,EAC3D,QAAA,eAAeA,KAAAA,OAAO,WAAA,WAAA,EAAjC,mBAEM,OAAA;;KAFqC,OAAK,eAAA,CAAG,QAAA,QAAK,SAAA,IAAgB,iBAAA,MAAgB,CAAA;QACpF,WAA8B,KAAA,QAAA,WAAA,EAAA,QAAA,CAAA,gBAAA,gBAArB,QAAA,YAAW,EAAA,EAAA,CAAA,CAAA,CAAA,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA;IAIjBA,KAAAA,OAAO,WAAA,WAAA,EAAlB,mBAEM,OAFN,YAEM,CADF,WAAuB,KAAA,QAAA,UAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA;IAIjB,QAAA,eAAA,WAAA,EADV,YAUE,gBAAA;;cARM;KAAJ,KAAI;KACJ,SAAQ;KACR,MAAK;KACL,QAAO;KACN,MAAM,MAAA,UAAS;KACf,WAAW,MAAA,IAAG,CAAC,OAAO;KACtB,OAAK,eAAA,CAAA,iBAAoB,eAAA,MAAc,CAAA;KACvC,SAAO"}
|
|
1
|
+
{"version":3,"file":"Banner.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../src/components/feedback/Banner.vue"],"sourcesContent":["<template> \n <div \n v-if=\"visible\" \n ref=\"bannerRef\" \n :role=\"liveRole\" \n :aria-live=\"liveness\" \n :class=\"['overflow-hidden', baseClasses, colorClasses, positionClasses, fullWidth ? 'rounded-none' : radiusClasses]\" \n > \n <div v-if=\"showIcon\" :class=\"['shrink-0', iconColorClasses]\"> \n <component :is=\"icon\" v-if=\"icon\" class=\"w-5 h-5\" /> \n <svg v-else-if=\"color === 'info'\" class=\"w-5 h-5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"> \n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z\" /> \n </svg> \n <svg v-else-if=\"color === 'warning'\" class=\"w-5 h-5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"> \n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z\" /> \n </svg> \n <svg v-else-if=\"color === 'danger'\" class=\"w-5 h-5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"> \n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z\" /> \n </svg> \n <svg v-else class=\"w-5 h-5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"> \n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z\" /> \n </svg> \n </div> \n \n <div class=\"flex-1 min-w-0\"> \n <p v-if=\"title\" :class=\"['font-semibold', titleColorClasses]\">{{ title }}</p> \n <div v-if=\"description || $slots.default\" :class=\"[title ? 'mt-1' : '', bodyColorClasses]\"> \n <slot>{{ description }}</slot> \n </div> \n </div> \n \n <div v-if=\"$slots.actions\" class=\"shrink-0 ml-4\"> \n <slot name=\"actions\" /> \n </div> \n \n <Button \n v-if=\"dismissable\" \n ref=\"dismissBtnRef\" \n variant=\"text\" \n size=\"small\" \n radius=\"medium\" \n :icon=\"XMarkIcon\" \n :ariaLabel=\"loc.banner.dismiss\" \n :class=\"['shrink-0 ml-2', dismissClasses]\" \n @click=\"dismiss\" \n /> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { ref, computed, onMounted, nextTick } from 'vue'; \nimport gsap from 'gsap'; \nimport type { Banner } from '../../interfaces/feedback/Banner.interface'; \nimport { useResolvedRadius, useModoLocale } from '../../composables/useModoConfig'; \nimport Button from '../forms/Button.vue'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \n \nconst loc = useModoLocale(); \n \nconst emit = defineEmits<{ dismiss: [] }>(); \n \nconst props = withDefaults(defineProps<Banner>(), { \n color: 'info', \n variant: 'subtle', \n dismissable: false, \n dismissAnimation: 'collapse', \n showIcon: true, \n position: 'inline', \n fullWidth: false, \n}); \n \nconst radius = useResolvedRadius(() => props.radius); \nconst radiusClasses = computed(() => { \n switch (radius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-3xl'; \n default: return 'rounded-lg'; \n } \n}); \n \nconst visible = ref(true); \nconst bannerRef = ref<HTMLElement | null>(null); \nconst dismissBtnRef = ref<{ $el: HTMLElement } | null>(null); \n \n/** \n * Intro animation: collapsed height + fade-in + small translate-y. \n * Mirrors the reverse of the default `collapse` dismiss so entry and exit \n * feel symmetrical. Skipped under `prefers-reduced-motion`. \n */ \nonMounted(async () => { \n await nextTick(); \n if (!bannerRef.value) return; \n const mql = typeof window !== 'undefined' && window.matchMedia \n ? window.matchMedia('(prefers-reduced-motion: reduce)') \n : null; \n if (mql?.matches) return; \n \n const el = bannerRef.value; \n gsap.fromTo( \n el, \n { opacity: 0, height: 0, paddingTop: 0, paddingBottom: 0, marginBottom: 0, y: -4 }, \n { \n opacity: 1, \n height: 'auto', \n paddingTop: '', \n paddingBottom: '', \n marginBottom: '', \n y: 0, \n duration: 0.32, \n ease: 'power2.out', \n clearProps: 'height,paddingTop,paddingBottom,marginBottom,transform', \n }, \n ); \n}); \n \n/** \n * Accessibility: \n * - `danger`/`warning` → `role=\"alert\"` + `aria-live=\"assertive\"` (interrupts). \n * - `info`/`success` → `role=\"status\"` + `aria-live=\"polite\"` (queued). \n * This matches WAI-ARIA guidance: assertive only for time-critical or error \n * messages; polite for informative updates. \n */ \nconst liveRole = computed(() => (props.color === 'danger' || props.color === 'warning' ? 'alert' : 'status')); \nconst liveness = computed<'assertive' | 'polite'>(() => (props.color === 'danger' || props.color === 'warning' ? 'assertive' : 'polite')); \n \nconst dismiss = () => { \n if (!bannerRef.value) return; \n \n if (props.dismissAnimation === 'shrink' && dismissBtnRef.value?.$el) { \n const bannerRect = bannerRef.value.getBoundingClientRect(); \n const btnRect = dismissBtnRef.value.$el.getBoundingClientRect(); \n \n const originX = btnRect.left + btnRect.width / 2 - bannerRect.left; \n const originY = btnRect.top + btnRect.height / 2 - bannerRect.top; \n bannerRef.value.style.transformOrigin = `${originX}px ${originY}px`; \n \n const tl = gsap.timeline({ \n onComplete: () => { \n visible.value = false; \n emit('dismiss'); \n }, \n }); \n \n tl.to(bannerRef.value, { \n scale: 0, \n opacity: 0, \n duration: 0.6, \n ease: 'power1.in', \n }); \n } else { \n gsap.to(bannerRef.value, { \n opacity: 0, \n height: 0, \n paddingTop: 0, \n paddingBottom: 0, \n marginBottom: 0, \n duration: 0.3, \n ease: 'power2.inOut', \n onComplete: () => { \n visible.value = false; \n emit('dismiss'); \n }, \n }); \n } \n}; \n \nconst baseClasses = 'flex items-start gap-3 px-4 py-3 text-sm'; \n \nconst positionClasses = computed(() => { \n switch (props.position) { \n case 'sticky-top': return 'sticky top-0 z-50'; \n case 'sticky-bottom': return 'sticky bottom-0 z-50'; \n default: return ''; \n } \n}); \n \nconst colorClasses = computed(() => { \n const map: Record<string, Record<string, string>> = { \n info: { \n filled: 'bg-info text-info-foreground', \n subtle: 'bg-info-subtle', \n outline: 'border border-info/30 bg-card', \n }, \n warning: { \n filled: 'bg-warning text-warning-foreground', \n subtle: 'bg-warning-subtle', \n outline: 'border border-warning/30 bg-card', \n }, \n danger: { \n filled: 'bg-destructive text-destructive-foreground', \n subtle: 'bg-destructive-subtle', \n outline: 'border border-destructive/30 bg-card', \n }, \n success: { \n filled: 'bg-success text-success-foreground', \n subtle: 'bg-success-subtle', \n outline: 'border border-success/30 bg-card', \n }, \n }; \n return map[props.color]?.[props.variant] ?? map.info.subtle; \n}); \n \nconst iconColorClasses = computed(() => { \n if (props.variant === 'filled') return 'text-current/80'; \n const map: Record<string, string> = { \n info: 'text-info', \n warning: 'text-warning', \n danger: 'text-destructive', \n success: 'text-success', \n }; \n return map[props.color] ?? 'text-info'; \n}); \n \nconst titleColorClasses = computed(() => { \n if (props.variant === 'filled') return ''; \n const map: Record<string, string> = { \n info: 'text-info', \n warning: 'text-warning', \n danger: 'text-destructive', \n success: 'text-success', \n }; \n return map[props.color] ?? 'text-info'; \n}); \n \nconst bodyColorClasses = computed(() => { \n if (props.variant === 'filled') return 'text-current/90'; \n const map: Record<string, string> = { \n info: 'text-info/90', \n warning: 'text-warning/90', \n danger: 'text-destructive/90', \n success: 'text-success/90', \n }; \n return map[props.color] ?? 'text-info/90'; \n}); \n \nconst dismissClasses = computed(() => { \n if (props.variant === 'filled') return 'text-current/70 hover:text-current hover:bg-current/10'; \n const map: Record<string, string> = { \n info: 'text-info/60 hover:text-info hover:bg-info/10', \n warning: 'text-warning/60 hover:text-warning hover:bg-warning/10', \n danger: 'text-destructive/60 hover:text-destructive hover:bg-destructive/10', \n success: 'text-success/60 hover:text-success hover:bg-success/10', \n }; \n return map[props.color] ?? 'text-info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M,OAFN,YAEM,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CADF,mBAAuH,QAAA;KAAjH,kBAAe;KAAQ,mBAAgB;KAAQ,GAAE;;IAI/D,mBAKM,OALN,YAKM,CAJO,QAAA,SAAA,WAAA,EAAT,mBAA6E,KAAA;;KAA5D,OAAK,eAAA,CAAA,iBAAoB,kBAAA,MAAiB,CAAA;uBAAM,QAAA,MAAK,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA,EAC3D,QAAA,eAAeA,KAAAA,OAAO,WAAA,WAAA,EAAjC,mBAEM,OAAA;;KAFqC,OAAK,eAAA,CAAG,QAAA,QAAK,SAAA,IAAgB,iBAAA,MAAgB,CAAA;QACpF,WAA8B,KAAA,QAAA,WAAA,EAAA,QAAA,CAAA,gBAAA,gBAArB,QAAA,YAAW,EAAA,EAAA,CAAA,CAAA,CAAA,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA;IAIjBA,KAAAA,OAAO,WAAA,WAAA,EAAlB,mBAEM,OAFN,YAEM,CADF,WAAuB,KAAA,QAAA,UAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA;IAIjB,QAAA,eAAA,WAAA,EADV,YAUE,gBAAA;;cARM;KAAJ,KAAI;KACJ,SAAQ;KACR,MAAK;KACL,QAAO;KACN,MAAM,MAAA,UAAS;KACf,WAAW,MAAA,IAAG,CAAC,OAAO;KACtB,OAAK,eAAA,CAAA,iBAAoB,eAAA,MAAc,CAAA;KACvC,SAAO"}
|
|
@@ -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 positionClasses, \n overlayClasses, \n ]\" \n :style=\"overlayStyle\" \n :data-modo-theme=\"scopedTheme || undefined\" \n @mousedown=\"onOverlayMouseDown\" \n @click=\"onOverlayClick\" \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 relative flex flex-col bg-card text-foreground', \n 'dark:bg-card/85 dark:backdrop-blur-xl', \n 'border-border shadow-xl', \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 z-10\"> \n <Button \n variant=\"text\" \n size=\"small\" \n :color=\"resolvedColor\" \n :icon=\"XMarkIcon\" \n ariaLabel=\"Close\" \n @click=\"close\" \n /> \n </div> \n \n <!-- Content wrapper --> \n <div ref=\"contentRef\" data-modo-drawer-content class=\"flex flex-col min-h-0 flex-1 opacity-0\"> \n <!-- Header --> \n <header \n v-if=\"$slots.header || title || description\" \n :class=\"[ \n 'relative flex flex-col gap-1 px-6 pt-6', \n showClose ? 'pr-12' : '', \n $slots.default || $slots.body || $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"header\"> \n <Typography \n v-if=\"title\" \n :id=\"titleId\" \n variant=\"title\" \n size=\"medium\" \n as=\"h2\" \n weight=\"semibold\" \n > \n {{ title }} \n </Typography> \n <Typography \n v-if=\"description\" \n :id=\"descriptionId\" \n variant=\"body\" \n size=\"small\" \n color=\"muted\" \n > \n {{ description }} \n </Typography> \n </slot> \n </header> \n \n <!-- Body --> \n <div \n v-if=\"$slots.default || $slots.body\" \n :class=\"[ \n 'relative flex-1 overflow-auto px-6', \n ($slots.header || title || description) ? '' : 'pt-6', \n $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"body\"> \n <slot /> \n </slot> \n </div> \n \n <!-- Footer --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-6 py-4\" \n > \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-1 right-1 h-px bg-border/40\" \n /> \n <span \n v-else \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-0 right-0 h-px bg-border\" \n /> \n <slot name=\"footer\" :close=\"close\" /> \n </footer> \n </div> \n </div> \n </div> \n </Transition> \n </Teleport> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Button from '../forms/Button.vue'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Drawer } from '../../interfaces/feedback/Drawer.interface'; \nimport { \n useResolvedColor, \n useResolvedRadius, \n useResolvedTheme, \n useModoConfig, \n} from '../../composables/useModoConfig'; \nimport { resolveColorMode } from '../../composables/useColorMode'; \nimport { palettesToCssVars, semanticTokensFromPalettes } from '../../config/palettes'; \nimport { hexToOklchString, pickForegroundOklch } from '../../config/colorPrimitives'; \nimport { surfacesToCssVars } from '../../config/surfaces';\nimport type { ModoColor, ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Drawer>(), { \n modelValue: false, \n side: 'right', \n size: 'medium', \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 resolvedColor = useResolvedColor(() => props.color as ModoColor | undefined); \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \nconst cfg = useModoConfig(); \nconst theme = useResolvedTheme(); \nconst scopedTheme = computed(() => resolveColorMode(theme.value)); \n \nconst overlayStyle = computed(() => { \n const providerVars = cfg?.value.palettes \n ? { \n ...palettesToCssVars(cfg.value.palettes), \n ...semanticTokensFromPalettes(cfg.value.palettes, hexToOklchString, pickForegroundOklch), \n } \n : {};\n const surfaceVars = cfg?.value.surfaces\n ? surfacesToCssVars(cfg.value.surfaces)\n : {};\n const darkSurfaceVars = (scopedTheme.value === 'dark' && cfg?.value.darkSurfaces)\n ? surfacesToCssVars(cfg.value.darkSurfaces)\n : {};\n return { ...providerVars, ...surfaceVars, ...darkSurfaceVars }; \n}); \n \nfunction close() { \n if (!props.modelValue) return; \n emit('update:modelValue', false); \n emit('close'); \n} \n \n/* ---------- Click outside ---------- */ \nlet mouseDownOnOverlay = false; \nfunction onOverlayMouseDown(e: MouseEvent) { \n mouseDownOnOverlay = e.target === overlayRef.value; \n} \nfunction onOverlayClick(e: MouseEvent) { \n if (!props.closeOnOverlay) return; \n if (e.target !== overlayRef.value) return; \n if (!mouseDownOnOverlay) return; \n close(); \n} \n \n/* ---------- Keydown (Escape + focus trap) ---------- */ \nfunction onPanelKeydown(e: KeyboardEvent) { \n if (props.closeOnEscape && e.key === 'Escape') { \n e.preventDefault(); \n close(); \n return; \n } \n if (e.key === 'Tab' && panelRef.value) { \n const focusables = getFocusable(panelRef.value); \n if (focusables.length === 0) { \n e.preventDefault(); \n return; \n } \n const first = focusables[0]; \n const last = focusables[focusables.length - 1]; \n const active = document.activeElement as HTMLElement | null; \n if (e.shiftKey && active === first) { \n e.preventDefault(); \n last.focus(); \n } else if (!e.shiftKey && active === last) { \n e.preventDefault(); \n first.focus(); \n } \n } \n} \n \nconst FOCUSABLE_SELECTOR = \n 'a[href], area[href], input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]'; \n \nfunction getFocusable(container: HTMLElement): HTMLElement[] { \n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)) \n .filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null); \n} \n \n/* ---------- Animations (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 switch (props.side) { \n case 'left': return { x: '-100%', y: 0 }; \n case 'right': return { x: '100%', y: 0 }; \n case 'top': return { x: 0, y: '-100%' }; \n case 'bottom': return { x: 0, y: '100%' }; \n default: return { x: '100%', 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 const content = \n overlay?.querySelector<HTMLElement>('[data-modo-drawer-content]') \n ?? contentRef.value; \n if (!overlay || !panel || !content) { done(); return; } \n \n activeTimeline?.kill(); \n \n if (prefersReducedMotion()) { \n gsap.set([overlay, panel, content], { 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.25, ease: 'power2.out' }, 0); \n \n tl.fromTo( \n panel, \n { x: enter.x, y: enter.y, opacity: 1 }, \n { x: 0, y: 0, opacity: 1, duration: 0.4, ease: 'power3.out' }, \n 0, \n ); \n \n tl.fromTo( \n content, \n { opacity: 0 }, \n { opacity: 1, duration: 0.22, ease: 'power2.out' }, \n 0.18, \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 const content = \n overlay.querySelector<HTMLElement>('[data-modo-drawer-content]') \n ?? contentRef.value; \n if (!overlay || !panel || !content) { 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(content, { opacity: 0, duration: 0.14, ease: 'power1.in' }, 0); \n tl.to( \n panel, \n { x: enter.x, y: enter.y, duration: 0.32, ease: 'power3.in' }, \n 0.08, \n ); \n tl.to(overlay, { opacity: 0, duration: 0.28, ease: 'power2.in' }, 0.12); \n} \n \n/* ---------- Scroll lock + focus management ---------- */ \nlet previousOverflow = ''; \nlet previousPaddingRight = ''; \nlet previouslyFocused: HTMLElement | null = null; \nlet scrollLocked = false; \n \nfunction releaseScrollLock() { \n if (!scrollLocked) return; \n document.body.style.overflow = previousOverflow; \n document.body.style.paddingRight = previousPaddingRight; \n scrollLocked = false; \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 const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth; \n previousOverflow = document.body.style.overflow; \n previousPaddingRight = document.body.style.paddingRight; \n document.body.style.overflow = 'hidden'; \n if (scrollBarWidth > 0) { \n document.body.style.paddingRight = `${scrollBarWidth}px`; \n } \n scrollLocked = true; \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 // Width + full height \n const heightCls = 'h-full'; \n switch (props.size) { \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 // Height + full width \n const widthCls = 'w-full'; \n switch (props.size) { \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 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 * El radius se aplica solo a las dos esquinas opuestas al borde de entrada \n * (las que quedan visibles dentro del viewport). El lado pegado al borde \n * queda recto. \n */ \nconst radiusClasses = computed(() => { \n if (props.size === 'full') return 'rounded-none'; \n // Mapeo explícito (Tailwind JIT requiere class names literales). \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.size === 'full') return 'rounded-none'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-[calc(1.5rem-4px)]'; \n default: return 'rounded-lg'; \n } \n}); \n \nconst overlayClasses = computed(() => { \n switch (props.overlay) { \n case 'solid': return 'bg-foreground/60'; \n case 'transparent': return 'bg-transparent'; \n case 'dark': return 'bg-foreground/80'; \n case 'dim': return 'bg-foreground/20'; \n case 'glass': return 'bg-background/50 backdrop-blur-md'; \n case 'blur': \n default: return 'bg-foreground/40 backdrop-blur-sm'; \n } \n}); \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 positionClasses, \n overlayClasses, \n ]\" \n :style=\"overlayStyle\" \n :data-modo-theme=\"scopedTheme || undefined\" \n @mousedown=\"onOverlayMouseDown\" \n @click=\"onOverlayClick\" \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 relative flex flex-col bg-card text-foreground', \n 'dark:bg-card/85 dark:backdrop-blur-xl', \n 'border-border shadow-xl', \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 z-10\"> \n <Button \n variant=\"text\" \n size=\"small\" \n :color=\"resolvedColor\" \n :icon=\"XMarkIcon\" \n ariaLabel=\"Close\" \n @click=\"close\" \n /> \n </div> \n \n <!-- Content wrapper --> \n <div ref=\"contentRef\" data-modo-drawer-content class=\"flex flex-col min-h-0 flex-1 opacity-0\"> \n <!-- Header --> \n <header \n v-if=\"$slots.header || title || description\" \n :class=\"[ \n 'relative flex flex-col gap-1 px-6 pt-6', \n showClose ? 'pr-12' : '', \n $slots.default || $slots.body || $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"header\"> \n <Typography \n v-if=\"title\" \n :id=\"titleId\" \n variant=\"title\" \n size=\"medium\" \n as=\"h2\" \n weight=\"semibold\" \n > \n {{ title }} \n </Typography> \n <Typography \n v-if=\"description\" \n :id=\"descriptionId\" \n variant=\"body\" \n size=\"small\" \n color=\"muted\" \n > \n {{ description }} \n </Typography> \n </slot> \n </header> \n \n <!-- Body --> \n <div \n v-if=\"$slots.default || $slots.body\" \n :class=\"[ \n 'relative flex-1 overflow-auto px-6', \n ($slots.header || title || description) ? '' : 'pt-6', \n $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"body\"> \n <slot /> \n </slot> \n </div> \n \n <!-- Footer --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-6 py-4\" \n > \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-1 right-1 h-px bg-border/40\" \n /> \n <span \n v-else \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-0 right-0 h-px bg-border\" \n /> \n <slot name=\"footer\" :close=\"close\" /> \n </footer> \n </div> \n </div> \n </div> \n </Transition> \n </Teleport> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Button from '../forms/Button.vue'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Drawer } from '../../interfaces/feedback/Drawer.interface'; \nimport { \n useResolvedColor, \n useResolvedRadius, \n useResolvedTheme, \n useModoConfig, \n} from '../../composables/useModoConfig'; \nimport { resolveColorMode } from '../../composables/useColorMode';\nimport { lockBodyScroll, unlockBodyScroll } from '../../composables/useBodyScrollLock';\nimport { palettesToCssVars, semanticTokensFromPalettes } from '../../config/palettes'; \nimport { hexToOklchString, pickForegroundOklch } from '../../config/colorPrimitives'; \nimport { surfacesToCssVars } from '../../config/surfaces';\nimport type { ModoColor, ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Drawer>(), { \n modelValue: false, \n side: 'right', \n size: 'medium', \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 resolvedColor = useResolvedColor(() => props.color as ModoColor | undefined); \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \nconst cfg = useModoConfig(); \nconst theme = useResolvedTheme(); \nconst scopedTheme = computed(() => resolveColorMode(theme.value)); \n \nconst overlayStyle = computed(() => { \n const providerVars = cfg?.value.palettes \n ? { \n ...palettesToCssVars(cfg.value.palettes), \n ...semanticTokensFromPalettes(cfg.value.palettes, hexToOklchString, pickForegroundOklch), \n } \n : {};\n const surfaceVars = cfg?.value.surfaces\n ? surfacesToCssVars(cfg.value.surfaces)\n : {};\n const darkSurfaceVars = (scopedTheme.value === 'dark' && cfg?.value.darkSurfaces)\n ? surfacesToCssVars(cfg.value.darkSurfaces)\n : {};\n return { ...providerVars, ...surfaceVars, ...darkSurfaceVars }; \n}); \n \nfunction close() { \n if (!props.modelValue) return; \n emit('update:modelValue', false); \n emit('close'); \n} \n \n/* ---------- Click outside ---------- */ \nlet mouseDownOnOverlay = false; \nfunction onOverlayMouseDown(e: MouseEvent) { \n mouseDownOnOverlay = e.target === overlayRef.value; \n} \nfunction onOverlayClick(e: MouseEvent) { \n if (!props.closeOnOverlay) return; \n if (e.target !== overlayRef.value) return; \n if (!mouseDownOnOverlay) return; \n close(); \n} \n \n/* ---------- Keydown (Escape + focus trap) ---------- */ \nfunction onPanelKeydown(e: KeyboardEvent) { \n if (props.closeOnEscape && e.key === 'Escape') { \n e.preventDefault(); \n close(); \n return; \n } \n if (e.key === 'Tab' && panelRef.value) { \n const focusables = getFocusable(panelRef.value); \n if (focusables.length === 0) { \n e.preventDefault(); \n return; \n } \n const first = focusables[0]; \n const last = focusables[focusables.length - 1]; \n const active = document.activeElement as HTMLElement | null; \n if (e.shiftKey && active === first) { \n e.preventDefault(); \n last.focus(); \n } else if (!e.shiftKey && active === last) { \n e.preventDefault(); \n first.focus(); \n } \n } \n} \n \nconst FOCUSABLE_SELECTOR = \n 'a[href], area[href], input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]'; \n \nfunction getFocusable(container: HTMLElement): HTMLElement[] { \n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)) \n .filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null); \n} \n \n/* ---------- Animations (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 switch (props.side) { \n case 'left': return { x: '-100%', y: 0 }; \n case 'right': return { x: '100%', y: 0 }; \n case 'top': return { x: 0, y: '-100%' }; \n case 'bottom': return { x: 0, y: '100%' }; \n default: return { x: '100%', 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 const content = \n overlay?.querySelector<HTMLElement>('[data-modo-drawer-content]') \n ?? contentRef.value; \n if (!overlay || !panel || !content) { done(); return; } \n \n activeTimeline?.kill(); \n \n if (prefersReducedMotion()) { \n gsap.set([overlay, panel, content], { 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.25, ease: 'power2.out' }, 0); \n \n tl.fromTo( \n panel, \n { x: enter.x, y: enter.y, opacity: 1 }, \n { x: 0, y: 0, opacity: 1, duration: 0.4, ease: 'power3.out' }, \n 0, \n ); \n \n tl.fromTo( \n content, \n { opacity: 0 }, \n { opacity: 1, duration: 0.22, ease: 'power2.out' }, \n 0.18, \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 const content = \n overlay.querySelector<HTMLElement>('[data-modo-drawer-content]')\n ?? contentRef.value;\n // Bail out without animating, but never without releasing the lock.\n if (!overlay || !panel || !content) { 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(content, { opacity: 0, duration: 0.14, ease: 'power1.in' }, 0); \n tl.to( \n panel, \n { x: enter.x, y: enter.y, duration: 0.32, ease: 'power3.in' }, \n 0.08, \n ); \n tl.to(overlay, { opacity: 0, duration: 0.28, ease: 'power2.in' }, 0.12); \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 // Width + full height \n const heightCls = 'h-full'; \n switch (props.size) { \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 // Height + full width \n const widthCls = 'w-full'; \n switch (props.size) { \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 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 * El radius se aplica solo a las dos esquinas opuestas al borde de entrada \n * (las que quedan visibles dentro del viewport). El lado pegado al borde \n * queda recto. \n */ \nconst radiusClasses = computed(() => { \n if (props.size === 'full') return 'rounded-none'; \n // Mapeo explícito (Tailwind JIT requiere class names literales). \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.size === 'full') return 'rounded-none'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-[calc(1.5rem-4px)]'; \n default: return 'rounded-lg'; \n } \n}); \n \nconst overlayClasses = computed(() => { \n switch (props.overlay) { \n case 'solid': return 'bg-foreground/60'; \n case 'transparent': return 'bg-transparent'; \n case 'dark': return 'bg-foreground/80'; \n case 'dim': return 'bg-foreground/20'; \n case 'glass': return 'bg-background/50 backdrop-blur-md'; \n case 'blur': \n default: return 'bg-foreground/40 backdrop-blur-sm'; \n } \n}); \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 positionClasses, \n overlayClasses, \n ]\" \n :style=\"overlayStyle\" \n :data-modo-theme=\"scopedTheme || undefined\" \n @mousedown=\"onOverlayMouseDown\" \n @click=\"onOverlayClick\" \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 relative flex flex-col bg-card text-foreground', \n 'dark:bg-card/85 dark:backdrop-blur-xl', \n 'border-border shadow-xl', \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 z-10\"> \n <Button \n variant=\"text\" \n size=\"small\" \n :color=\"resolvedColor\" \n :icon=\"XMarkIcon\" \n ariaLabel=\"Close\" \n @click=\"close\" \n /> \n </div> \n \n <!-- Content wrapper --> \n <div ref=\"contentRef\" data-modo-drawer-content class=\"flex flex-col min-h-0 flex-1 opacity-0\"> \n <!-- Header --> \n <header \n v-if=\"$slots.header || title || description\" \n :class=\"[ \n 'relative flex flex-col gap-1 px-6 pt-6', \n showClose ? 'pr-12' : '', \n $slots.default || $slots.body || $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"header\"> \n <Typography \n v-if=\"title\" \n :id=\"titleId\" \n variant=\"title\" \n size=\"medium\" \n as=\"h2\" \n weight=\"semibold\" \n > \n {{ title }} \n </Typography> \n <Typography \n v-if=\"description\" \n :id=\"descriptionId\" \n variant=\"body\" \n size=\"small\" \n color=\"muted\" \n > \n {{ description }} \n </Typography> \n </slot> \n </header> \n \n <!-- Body --> \n <div \n v-if=\"$slots.default || $slots.body\" \n :class=\"[ \n 'relative flex-1 overflow-auto px-6', \n ($slots.header || title || description) ? '' : 'pt-6', \n $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"body\"> \n <slot /> \n </slot> \n </div> \n \n <!-- Footer --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-6 py-4\" \n > \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-1 right-1 h-px bg-border/40\" \n /> \n <span \n v-else \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-0 right-0 h-px bg-border\" \n /> \n <slot name=\"footer\" :close=\"close\" /> \n </footer> \n </div> \n </div> \n </div> \n </Transition> \n </Teleport> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Button from '../forms/Button.vue'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Drawer } from '../../interfaces/feedback/Drawer.interface'; \nimport { \n useResolvedColor, \n useResolvedRadius, \n useResolvedTheme, \n useModoConfig, \n} from '../../composables/useModoConfig'; \nimport { resolveColorMode } from '../../composables/useColorMode'; \nimport { palettesToCssVars, semanticTokensFromPalettes } from '../../config/palettes'; \nimport { hexToOklchString, pickForegroundOklch } from '../../config/colorPrimitives'; \nimport { surfacesToCssVars } from '../../config/surfaces';\nimport type { ModoColor, ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Drawer>(), { \n modelValue: false, \n side: 'right', \n size: 'medium', \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 resolvedColor = useResolvedColor(() => props.color as ModoColor | undefined); \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \nconst cfg = useModoConfig(); \nconst theme = useResolvedTheme(); \nconst scopedTheme = computed(() => resolveColorMode(theme.value)); \n \nconst overlayStyle = computed(() => { \n const providerVars = cfg?.value.palettes \n ? { \n ...palettesToCssVars(cfg.value.palettes), \n ...semanticTokensFromPalettes(cfg.value.palettes, hexToOklchString, pickForegroundOklch), \n } \n : {};\n const surfaceVars = cfg?.value.surfaces\n ? surfacesToCssVars(cfg.value.surfaces)\n : {};\n const darkSurfaceVars = (scopedTheme.value === 'dark' && cfg?.value.darkSurfaces)\n ? surfacesToCssVars(cfg.value.darkSurfaces)\n : {};\n return { ...providerVars, ...surfaceVars, ...darkSurfaceVars }; \n}); \n \nfunction close() { \n if (!props.modelValue) return; \n emit('update:modelValue', false); \n emit('close'); \n} \n \n/* ---------- Click outside ---------- */ \nlet mouseDownOnOverlay = false; \nfunction onOverlayMouseDown(e: MouseEvent) { \n mouseDownOnOverlay = e.target === overlayRef.value; \n} \nfunction onOverlayClick(e: MouseEvent) { \n if (!props.closeOnOverlay) return; \n if (e.target !== overlayRef.value) return; \n if (!mouseDownOnOverlay) return; \n close(); \n} \n \n/* ---------- Keydown (Escape + focus trap) ---------- */ \nfunction onPanelKeydown(e: KeyboardEvent) { \n if (props.closeOnEscape && e.key === 'Escape') { \n e.preventDefault(); \n close(); \n return; \n } \n if (e.key === 'Tab' && panelRef.value) { \n const focusables = getFocusable(panelRef.value); \n if (focusables.length === 0) { \n e.preventDefault(); \n return; \n } \n const first = focusables[0]; \n const last = focusables[focusables.length - 1]; \n const active = document.activeElement as HTMLElement | null; \n if (e.shiftKey && active === first) { \n e.preventDefault(); \n last.focus(); \n } else if (!e.shiftKey && active === last) { \n e.preventDefault(); \n first.focus(); \n } \n } \n} \n \nconst FOCUSABLE_SELECTOR = \n 'a[href], area[href], input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]'; \n \nfunction getFocusable(container: HTMLElement): HTMLElement[] { \n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)) \n .filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null); \n} \n \n/* ---------- Animations (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 switch (props.side) { \n case 'left': return { x: '-100%', y: 0 }; \n case 'right': return { x: '100%', y: 0 }; \n case 'top': return { x: 0, y: '-100%' }; \n case 'bottom': return { x: 0, y: '100%' }; \n default: return { x: '100%', 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 const content = \n overlay?.querySelector<HTMLElement>('[data-modo-drawer-content]') \n ?? contentRef.value; \n if (!overlay || !panel || !content) { done(); return; } \n \n activeTimeline?.kill(); \n \n if (prefersReducedMotion()) { \n gsap.set([overlay, panel, content], { 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.25, ease: 'power2.out' }, 0); \n \n tl.fromTo( \n panel, \n { x: enter.x, y: enter.y, opacity: 1 }, \n { x: 0, y: 0, opacity: 1, duration: 0.4, ease: 'power3.out' }, \n 0, \n ); \n \n tl.fromTo( \n content, \n { opacity: 0 }, \n { opacity: 1, duration: 0.22, ease: 'power2.out' }, \n 0.18, \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 const content = \n overlay.querySelector<HTMLElement>('[data-modo-drawer-content]') \n ?? contentRef.value; \n if (!overlay || !panel || !content) { 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(content, { opacity: 0, duration: 0.14, ease: 'power1.in' }, 0); \n tl.to( \n panel, \n { x: enter.x, y: enter.y, duration: 0.32, ease: 'power3.in' }, \n 0.08, \n ); \n tl.to(overlay, { opacity: 0, duration: 0.28, ease: 'power2.in' }, 0.12); \n} \n \n/* ---------- Scroll lock + focus management ---------- */ \nlet previousOverflow = ''; \nlet previousPaddingRight = ''; \nlet previouslyFocused: HTMLElement | null = null; \nlet scrollLocked = false; \n \nfunction releaseScrollLock() { \n if (!scrollLocked) return; \n document.body.style.overflow = previousOverflow; \n document.body.style.paddingRight = previousPaddingRight; \n scrollLocked = false; \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 const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth; \n previousOverflow = document.body.style.overflow; \n previousPaddingRight = document.body.style.paddingRight; \n document.body.style.overflow = 'hidden'; \n if (scrollBarWidth > 0) { \n document.body.style.paddingRight = `${scrollBarWidth}px`; \n } \n scrollLocked = true; \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 // Width + full height \n const heightCls = 'h-full'; \n switch (props.size) { \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 // Height + full width \n const widthCls = 'w-full'; \n switch (props.size) { \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 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 * El radius se aplica solo a las dos esquinas opuestas al borde de entrada \n * (las que quedan visibles dentro del viewport). El lado pegado al borde \n * queda recto. \n */ \nconst radiusClasses = computed(() => { \n if (props.size === 'full') return 'rounded-none'; \n // Mapeo explícito (Tailwind JIT requiere class names literales). \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.size === 'full') return 'rounded-none'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-[calc(1.5rem-4px)]'; \n default: return 'rounded-lg'; \n } \n}); \n \nconst overlayClasses = computed(() => { \n switch (props.overlay) { \n case 'solid': return 'bg-foreground/60'; \n case 'transparent': return 'bg-transparent'; \n case 'dark': return 'bg-foreground/80'; \n case 'dim': return 'bg-foreground/20'; \n case 'glass': return 'bg-background/50 backdrop-blur-md'; \n case 'blur': \n default: return 'bg-foreground/40 backdrop-blur-sm'; \n } \n}); \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 positionClasses, \n overlayClasses, \n ]\" \n :style=\"overlayStyle\" \n :data-modo-theme=\"scopedTheme || undefined\" \n @mousedown=\"onOverlayMouseDown\" \n @click=\"onOverlayClick\" \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 relative flex flex-col bg-card text-foreground', \n 'dark:bg-card/85 dark:backdrop-blur-xl', \n 'border-border shadow-xl', \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 z-10\"> \n <Button \n variant=\"text\" \n size=\"small\" \n :color=\"resolvedColor\" \n :icon=\"XMarkIcon\" \n ariaLabel=\"Close\" \n @click=\"close\" \n /> \n </div> \n \n <!-- Content wrapper --> \n <div ref=\"contentRef\" data-modo-drawer-content class=\"flex flex-col min-h-0 flex-1 opacity-0\"> \n <!-- Header --> \n <header \n v-if=\"$slots.header || title || description\" \n :class=\"[ \n 'relative flex flex-col gap-1 px-6 pt-6', \n showClose ? 'pr-12' : '', \n $slots.default || $slots.body || $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"header\"> \n <Typography \n v-if=\"title\" \n :id=\"titleId\" \n variant=\"title\" \n size=\"medium\" \n as=\"h2\" \n weight=\"semibold\" \n > \n {{ title }} \n </Typography> \n <Typography \n v-if=\"description\" \n :id=\"descriptionId\" \n variant=\"body\" \n size=\"small\" \n color=\"muted\" \n > \n {{ description }} \n </Typography> \n </slot> \n </header> \n \n <!-- Body --> \n <div \n v-if=\"$slots.default || $slots.body\" \n :class=\"[ \n 'relative flex-1 overflow-auto px-6', \n ($slots.header || title || description) ? '' : 'pt-6', \n $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"body\"> \n <slot /> \n </slot> \n </div> \n \n <!-- Footer --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-6 py-4\" \n > \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-1 right-1 h-px bg-border/40\" \n /> \n <span \n v-else \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-0 right-0 h-px bg-border\" \n /> \n <slot name=\"footer\" :close=\"close\" /> \n </footer> \n </div> \n </div> \n </div> \n </Transition> \n </Teleport> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Button from '../forms/Button.vue'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Drawer } from '../../interfaces/feedback/Drawer.interface'; \nimport { \n useResolvedColor, \n useResolvedRadius, \n useResolvedTheme, \n useModoConfig, \n} from '../../composables/useModoConfig'; \nimport { resolveColorMode } from '../../composables/useColorMode';\nimport { lockBodyScroll, unlockBodyScroll } from '../../composables/useBodyScrollLock';\nimport { palettesToCssVars, semanticTokensFromPalettes } from '../../config/palettes'; \nimport { hexToOklchString, pickForegroundOklch } from '../../config/colorPrimitives'; \nimport { surfacesToCssVars } from '../../config/surfaces';\nimport type { ModoColor, ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Drawer>(), { \n modelValue: false, \n side: 'right', \n size: 'medium', \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 resolvedColor = useResolvedColor(() => props.color as ModoColor | undefined); \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \nconst cfg = useModoConfig(); \nconst theme = useResolvedTheme(); \nconst scopedTheme = computed(() => resolveColorMode(theme.value)); \n \nconst overlayStyle = computed(() => { \n const providerVars = cfg?.value.palettes \n ? { \n ...palettesToCssVars(cfg.value.palettes), \n ...semanticTokensFromPalettes(cfg.value.palettes, hexToOklchString, pickForegroundOklch), \n } \n : {};\n const surfaceVars = cfg?.value.surfaces\n ? surfacesToCssVars(cfg.value.surfaces)\n : {};\n const darkSurfaceVars = (scopedTheme.value === 'dark' && cfg?.value.darkSurfaces)\n ? surfacesToCssVars(cfg.value.darkSurfaces)\n : {};\n return { ...providerVars, ...surfaceVars, ...darkSurfaceVars }; \n}); \n \nfunction close() { \n if (!props.modelValue) return; \n emit('update:modelValue', false); \n emit('close'); \n} \n \n/* ---------- Click outside ---------- */ \nlet mouseDownOnOverlay = false; \nfunction onOverlayMouseDown(e: MouseEvent) { \n mouseDownOnOverlay = e.target === overlayRef.value; \n} \nfunction onOverlayClick(e: MouseEvent) { \n if (!props.closeOnOverlay) return; \n if (e.target !== overlayRef.value) return; \n if (!mouseDownOnOverlay) return; \n close(); \n} \n \n/* ---------- Keydown (Escape + focus trap) ---------- */ \nfunction onPanelKeydown(e: KeyboardEvent) { \n if (props.closeOnEscape && e.key === 'Escape') { \n e.preventDefault(); \n close(); \n return; \n } \n if (e.key === 'Tab' && panelRef.value) { \n const focusables = getFocusable(panelRef.value); \n if (focusables.length === 0) { \n e.preventDefault(); \n return; \n } \n const first = focusables[0]; \n const last = focusables[focusables.length - 1]; \n const active = document.activeElement as HTMLElement | null; \n if (e.shiftKey && active === first) { \n e.preventDefault(); \n last.focus(); \n } else if (!e.shiftKey && active === last) { \n e.preventDefault(); \n first.focus(); \n } \n } \n} \n \nconst FOCUSABLE_SELECTOR = \n 'a[href], area[href], input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]'; \n \nfunction getFocusable(container: HTMLElement): HTMLElement[] { \n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)) \n .filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null); \n} \n \n/* ---------- Animations (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 switch (props.side) { \n case 'left': return { x: '-100%', y: 0 }; \n case 'right': return { x: '100%', y: 0 }; \n case 'top': return { x: 0, y: '-100%' }; \n case 'bottom': return { x: 0, y: '100%' }; \n default: return { x: '100%', 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 const content = \n overlay?.querySelector<HTMLElement>('[data-modo-drawer-content]') \n ?? contentRef.value; \n if (!overlay || !panel || !content) { done(); return; } \n \n activeTimeline?.kill(); \n \n if (prefersReducedMotion()) { \n gsap.set([overlay, panel, content], { 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.25, ease: 'power2.out' }, 0); \n \n tl.fromTo( \n panel, \n { x: enter.x, y: enter.y, opacity: 1 }, \n { x: 0, y: 0, opacity: 1, duration: 0.4, ease: 'power3.out' }, \n 0, \n ); \n \n tl.fromTo( \n content, \n { opacity: 0 }, \n { opacity: 1, duration: 0.22, ease: 'power2.out' }, \n 0.18, \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 const content = \n overlay.querySelector<HTMLElement>('[data-modo-drawer-content]')\n ?? contentRef.value;\n // Bail out without animating, but never without releasing the lock.\n if (!overlay || !panel || !content) { 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(content, { opacity: 0, duration: 0.14, ease: 'power1.in' }, 0); \n tl.to( \n panel, \n { x: enter.x, y: enter.y, duration: 0.32, ease: 'power3.in' }, \n 0.08, \n ); \n tl.to(overlay, { opacity: 0, duration: 0.28, ease: 'power2.in' }, 0.12); \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 // Width + full height \n const heightCls = 'h-full'; \n switch (props.size) { \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 // Height + full width \n const widthCls = 'w-full'; \n switch (props.size) { \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 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 * El radius se aplica solo a las dos esquinas opuestas al borde de entrada \n * (las que quedan visibles dentro del viewport). El lado pegado al borde \n * queda recto. \n */ \nconst radiusClasses = computed(() => { \n if (props.size === 'full') return 'rounded-none'; \n // Mapeo explícito (Tailwind JIT requiere class names literales). \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.size === 'full') return 'rounded-none'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-[calc(1.5rem-4px)]'; \n default: return 'rounded-lg'; \n } \n}); \n \nconst overlayClasses = computed(() => { \n switch (props.overlay) { \n case 'solid': return 'bg-foreground/60'; \n case 'transparent': return 'bg-transparent'; \n case 'dark': return 'bg-foreground/80'; \n case 'dim': return 'bg-foreground/20'; \n case 'glass': return 'bg-background/50 backdrop-blur-md'; \n case 'blur': \n default: return 'bg-foreground/40 backdrop-blur-sm'; \n } \n}); \n</script>\n"],"mappings":""}
|
|
@@ -6,6 +6,7 @@ const require_useColorMode = require("../../composables/useColorMode.cjs");
|
|
|
6
6
|
const require_useModoConfig = require("../../composables/useModoConfig.cjs");
|
|
7
7
|
const require_Button = require("../forms/Button.cjs");
|
|
8
8
|
const require_Typography = require("../data-display/Typography.cjs");
|
|
9
|
+
const require_useBodyScrollLock = require("../../composables/useBodyScrollLock.cjs");
|
|
9
10
|
let vue = require("vue");
|
|
10
11
|
let _heroicons_vue_24_outline = require("@heroicons/vue/24/outline");
|
|
11
12
|
let gsap = require("gsap");
|
|
@@ -229,6 +230,7 @@ var Drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue
|
|
|
229
230
|
const panel = overlay.querySelector("[data-modo-drawer-panel]") ?? panelRef.value;
|
|
230
231
|
const content = overlay.querySelector("[data-modo-drawer-content]") ?? contentRef.value;
|
|
231
232
|
if (!overlay || !panel || !content) {
|
|
233
|
+
releaseScrollLock();
|
|
232
234
|
done();
|
|
233
235
|
return;
|
|
234
236
|
}
|
|
@@ -268,26 +270,19 @@ var Drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue
|
|
|
268
270
|
ease: "power2.in"
|
|
269
271
|
}, .12);
|
|
270
272
|
}
|
|
271
|
-
let previousOverflow = "";
|
|
272
|
-
let previousPaddingRight = "";
|
|
273
273
|
let previouslyFocused = null;
|
|
274
274
|
let scrollLocked = false;
|
|
275
275
|
function releaseScrollLock() {
|
|
276
276
|
if (!scrollLocked) return;
|
|
277
|
-
document.body.style.overflow = previousOverflow;
|
|
278
|
-
document.body.style.paddingRight = previousPaddingRight;
|
|
279
277
|
scrollLocked = false;
|
|
278
|
+
require_useBodyScrollLock.unlockBodyScroll();
|
|
280
279
|
}
|
|
281
280
|
(0, vue.watch)(() => props.modelValue, (open) => {
|
|
282
281
|
if (open) {
|
|
283
282
|
previouslyFocused = document.activeElement;
|
|
284
283
|
if (props.lockScroll && !scrollLocked) {
|
|
285
|
-
const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
286
|
-
previousOverflow = document.body.style.overflow;
|
|
287
|
-
previousPaddingRight = document.body.style.paddingRight;
|
|
288
|
-
document.body.style.overflow = "hidden";
|
|
289
|
-
if (scrollBarWidth > 0) document.body.style.paddingRight = `${scrollBarWidth}px`;
|
|
290
284
|
scrollLocked = true;
|
|
285
|
+
require_useBodyScrollLock.lockBodyScroll();
|
|
291
286
|
}
|
|
292
287
|
emit("open");
|
|
293
288
|
(0, vue.nextTick)(() => {
|
|
@@ -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 positionClasses, \n overlayClasses, \n ]\" \n :style=\"overlayStyle\" \n :data-modo-theme=\"scopedTheme || undefined\" \n @mousedown=\"onOverlayMouseDown\" \n @click=\"onOverlayClick\" \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 relative flex flex-col bg-card text-foreground', \n 'dark:bg-card/85 dark:backdrop-blur-xl', \n 'border-border shadow-xl', \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 z-10\"> \n <Button \n variant=\"text\" \n size=\"small\" \n :color=\"resolvedColor\" \n :icon=\"XMarkIcon\" \n ariaLabel=\"Close\" \n @click=\"close\" \n /> \n </div> \n \n <!-- Content wrapper --> \n <div ref=\"contentRef\" data-modo-drawer-content class=\"flex flex-col min-h-0 flex-1 opacity-0\"> \n <!-- Header --> \n <header \n v-if=\"$slots.header || title || description\" \n :class=\"[ \n 'relative flex flex-col gap-1 px-6 pt-6', \n showClose ? 'pr-12' : '', \n $slots.default || $slots.body || $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"header\"> \n <Typography \n v-if=\"title\" \n :id=\"titleId\" \n variant=\"title\" \n size=\"medium\" \n as=\"h2\" \n weight=\"semibold\" \n > \n {{ title }} \n </Typography> \n <Typography \n v-if=\"description\" \n :id=\"descriptionId\" \n variant=\"body\" \n size=\"small\" \n color=\"muted\" \n > \n {{ description }} \n </Typography> \n </slot> \n </header> \n \n <!-- Body --> \n <div \n v-if=\"$slots.default || $slots.body\" \n :class=\"[ \n 'relative flex-1 overflow-auto px-6', \n ($slots.header || title || description) ? '' : 'pt-6', \n $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"body\"> \n <slot /> \n </slot> \n </div> \n \n <!-- Footer --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-6 py-4\" \n > \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-1 right-1 h-px bg-border/40\" \n /> \n <span \n v-else \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-0 right-0 h-px bg-border\" \n /> \n <slot name=\"footer\" :close=\"close\" /> \n </footer> \n </div> \n </div> \n </div> \n </Transition> \n </Teleport> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Button from '../forms/Button.vue'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Drawer } from '../../interfaces/feedback/Drawer.interface'; \nimport { \n useResolvedColor, \n useResolvedRadius, \n useResolvedTheme, \n useModoConfig, \n} from '../../composables/useModoConfig'; \nimport { resolveColorMode } from '../../composables/useColorMode'; \nimport { palettesToCssVars, semanticTokensFromPalettes } from '../../config/palettes'; \nimport { hexToOklchString, pickForegroundOklch } from '../../config/colorPrimitives'; \nimport { surfacesToCssVars } from '../../config/surfaces';\nimport type { ModoColor, ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Drawer>(), { \n modelValue: false, \n side: 'right', \n size: 'medium', \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 resolvedColor = useResolvedColor(() => props.color as ModoColor | undefined); \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \nconst cfg = useModoConfig(); \nconst theme = useResolvedTheme(); \nconst scopedTheme = computed(() => resolveColorMode(theme.value)); \n \nconst overlayStyle = computed(() => { \n const providerVars = cfg?.value.palettes \n ? { \n ...palettesToCssVars(cfg.value.palettes), \n ...semanticTokensFromPalettes(cfg.value.palettes, hexToOklchString, pickForegroundOklch), \n } \n : {};\n const surfaceVars = cfg?.value.surfaces\n ? surfacesToCssVars(cfg.value.surfaces)\n : {};\n const darkSurfaceVars = (scopedTheme.value === 'dark' && cfg?.value.darkSurfaces)\n ? surfacesToCssVars(cfg.value.darkSurfaces)\n : {};\n return { ...providerVars, ...surfaceVars, ...darkSurfaceVars }; \n}); \n \nfunction close() { \n if (!props.modelValue) return; \n emit('update:modelValue', false); \n emit('close'); \n} \n \n/* ---------- Click outside ---------- */ \nlet mouseDownOnOverlay = false; \nfunction onOverlayMouseDown(e: MouseEvent) { \n mouseDownOnOverlay = e.target === overlayRef.value; \n} \nfunction onOverlayClick(e: MouseEvent) { \n if (!props.closeOnOverlay) return; \n if (e.target !== overlayRef.value) return; \n if (!mouseDownOnOverlay) return; \n close(); \n} \n \n/* ---------- Keydown (Escape + focus trap) ---------- */ \nfunction onPanelKeydown(e: KeyboardEvent) { \n if (props.closeOnEscape && e.key === 'Escape') { \n e.preventDefault(); \n close(); \n return; \n } \n if (e.key === 'Tab' && panelRef.value) { \n const focusables = getFocusable(panelRef.value); \n if (focusables.length === 0) { \n e.preventDefault(); \n return; \n } \n const first = focusables[0]; \n const last = focusables[focusables.length - 1]; \n const active = document.activeElement as HTMLElement | null; \n if (e.shiftKey && active === first) { \n e.preventDefault(); \n last.focus(); \n } else if (!e.shiftKey && active === last) { \n e.preventDefault(); \n first.focus(); \n } \n } \n} \n \nconst FOCUSABLE_SELECTOR = \n 'a[href], area[href], input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]'; \n \nfunction getFocusable(container: HTMLElement): HTMLElement[] { \n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)) \n .filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null); \n} \n \n/* ---------- Animations (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 switch (props.side) { \n case 'left': return { x: '-100%', y: 0 }; \n case 'right': return { x: '100%', y: 0 }; \n case 'top': return { x: 0, y: '-100%' }; \n case 'bottom': return { x: 0, y: '100%' }; \n default: return { x: '100%', 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 const content = \n overlay?.querySelector<HTMLElement>('[data-modo-drawer-content]') \n ?? contentRef.value; \n if (!overlay || !panel || !content) { done(); return; } \n \n activeTimeline?.kill(); \n \n if (prefersReducedMotion()) { \n gsap.set([overlay, panel, content], { 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.25, ease: 'power2.out' }, 0); \n \n tl.fromTo( \n panel, \n { x: enter.x, y: enter.y, opacity: 1 }, \n { x: 0, y: 0, opacity: 1, duration: 0.4, ease: 'power3.out' }, \n 0, \n ); \n \n tl.fromTo( \n content, \n { opacity: 0 }, \n { opacity: 1, duration: 0.22, ease: 'power2.out' }, \n 0.18, \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 const content = \n overlay.querySelector<HTMLElement>('[data-modo-drawer-content]') \n ?? contentRef.value; \n if (!overlay || !panel || !content) { 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(content, { opacity: 0, duration: 0.14, ease: 'power1.in' }, 0); \n tl.to( \n panel, \n { x: enter.x, y: enter.y, duration: 0.32, ease: 'power3.in' }, \n 0.08, \n ); \n tl.to(overlay, { opacity: 0, duration: 0.28, ease: 'power2.in' }, 0.12); \n} \n \n/* ---------- Scroll lock + focus management ---------- */ \nlet previousOverflow = ''; \nlet previousPaddingRight = ''; \nlet previouslyFocused: HTMLElement | null = null; \nlet scrollLocked = false; \n \nfunction releaseScrollLock() { \n if (!scrollLocked) return; \n document.body.style.overflow = previousOverflow; \n document.body.style.paddingRight = previousPaddingRight; \n scrollLocked = false; \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 const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth; \n previousOverflow = document.body.style.overflow; \n previousPaddingRight = document.body.style.paddingRight; \n document.body.style.overflow = 'hidden'; \n if (scrollBarWidth > 0) { \n document.body.style.paddingRight = `${scrollBarWidth}px`; \n } \n scrollLocked = true; \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 // Width + full height \n const heightCls = 'h-full'; \n switch (props.size) { \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 // Height + full width \n const widthCls = 'w-full'; \n switch (props.size) { \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 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 * El radius se aplica solo a las dos esquinas opuestas al borde de entrada \n * (las que quedan visibles dentro del viewport). El lado pegado al borde \n * queda recto. \n */ \nconst radiusClasses = computed(() => { \n if (props.size === 'full') return 'rounded-none'; \n // Mapeo explícito (Tailwind JIT requiere class names literales). \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.size === 'full') return 'rounded-none'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-[calc(1.5rem-4px)]'; \n default: return 'rounded-lg'; \n } \n}); \n \nconst overlayClasses = computed(() => { \n switch (props.overlay) { \n case 'solid': return 'bg-foreground/60'; \n case 'transparent': return 'bg-transparent'; \n case 'dark': return 'bg-foreground/80'; \n case 'dim': return 'bg-foreground/20'; \n case 'glass': return 'bg-background/50 backdrop-blur-md'; \n case 'blur': \n default: return 'bg-foreground/40 backdrop-blur-sm'; \n } \n}); \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoPA,IAAM,qBACF;;;;;;;;;;;;;;;;;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A,IAAA,YAAA,GAAA,GAAA,IAAA,aAOG,mBAAA,SAAA;;OANR,IAAI,cAAA;OACL,SAAQ;OACR,MAAK;OACL,OAAM;;uCAEW,EAAA,GAAA,IAAA,kBAAA,GAAA,IAAA,iBAAd,QAAA,YAAW,EAAA,EAAA,CAAA,CAAA;;;MAOhBA,KAAAA,OAAO,WAAWA,KAAAA,OAAO,SAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAU7B,OAAA;;OATD,QAAA,GAAA,IAAA,gBAAK;;QAA6GA,KAAAA,OAAO,UAAU,QAAA,SAAS,QAAA,cAAW,KAAA;QAAkDA,KAAAA,OAAO,SAAM,SAAA;;8BAQhN,KAAA,QAAA,QAAA,EAAA,QAAA,EAAA,GAAA,IAAA,YADK,KAAA,QAAA,UAAA,CAAA,CAAA,CAAA,EAAA,EAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA;MAMNA,KAAAA,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 positionClasses, \n overlayClasses, \n ]\" \n :style=\"overlayStyle\" \n :data-modo-theme=\"scopedTheme || undefined\" \n @mousedown=\"onOverlayMouseDown\" \n @click=\"onOverlayClick\" \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 relative flex flex-col bg-card text-foreground', \n 'dark:bg-card/85 dark:backdrop-blur-xl', \n 'border-border shadow-xl', \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 z-10\"> \n <Button \n variant=\"text\" \n size=\"small\" \n :color=\"resolvedColor\" \n :icon=\"XMarkIcon\" \n ariaLabel=\"Close\" \n @click=\"close\" \n /> \n </div> \n \n <!-- Content wrapper --> \n <div ref=\"contentRef\" data-modo-drawer-content class=\"flex flex-col min-h-0 flex-1 opacity-0\"> \n <!-- Header --> \n <header \n v-if=\"$slots.header || title || description\" \n :class=\"[ \n 'relative flex flex-col gap-1 px-6 pt-6', \n showClose ? 'pr-12' : '', \n $slots.default || $slots.body || $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"header\"> \n <Typography \n v-if=\"title\" \n :id=\"titleId\" \n variant=\"title\" \n size=\"medium\" \n as=\"h2\" \n weight=\"semibold\" \n > \n {{ title }} \n </Typography> \n <Typography \n v-if=\"description\" \n :id=\"descriptionId\" \n variant=\"body\" \n size=\"small\" \n color=\"muted\" \n > \n {{ description }} \n </Typography> \n </slot> \n </header> \n \n <!-- Body --> \n <div \n v-if=\"$slots.default || $slots.body\" \n :class=\"[ \n 'relative flex-1 overflow-auto px-6', \n ($slots.header || title || description) ? '' : 'pt-6', \n $slots.footer ? 'pb-4' : 'pb-6', \n ]\" \n > \n <slot name=\"body\"> \n <slot /> \n </slot> \n </div> \n \n <!-- Footer --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-6 py-4\" \n > \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-1 right-1 h-px bg-border/40\" \n /> \n <span \n v-else \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-0 right-0 h-px bg-border\" \n /> \n <slot name=\"footer\" :close=\"close\" /> \n </footer> \n </div> \n </div> \n </div> \n </Transition> \n </Teleport> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Button from '../forms/Button.vue'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Drawer } from '../../interfaces/feedback/Drawer.interface'; \nimport { \n useResolvedColor, \n useResolvedRadius, \n useResolvedTheme, \n useModoConfig, \n} from '../../composables/useModoConfig'; \nimport { resolveColorMode } from '../../composables/useColorMode';\nimport { lockBodyScroll, unlockBodyScroll } from '../../composables/useBodyScrollLock';\nimport { palettesToCssVars, semanticTokensFromPalettes } from '../../config/palettes'; \nimport { hexToOklchString, pickForegroundOklch } from '../../config/colorPrimitives'; \nimport { surfacesToCssVars } from '../../config/surfaces';\nimport type { ModoColor, ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Drawer>(), { \n modelValue: false, \n side: 'right', \n size: 'medium', \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 resolvedColor = useResolvedColor(() => props.color as ModoColor | undefined); \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \nconst cfg = useModoConfig(); \nconst theme = useResolvedTheme(); \nconst scopedTheme = computed(() => resolveColorMode(theme.value)); \n \nconst overlayStyle = computed(() => { \n const providerVars = cfg?.value.palettes \n ? { \n ...palettesToCssVars(cfg.value.palettes), \n ...semanticTokensFromPalettes(cfg.value.palettes, hexToOklchString, pickForegroundOklch), \n } \n : {};\n const surfaceVars = cfg?.value.surfaces\n ? surfacesToCssVars(cfg.value.surfaces)\n : {};\n const darkSurfaceVars = (scopedTheme.value === 'dark' && cfg?.value.darkSurfaces)\n ? surfacesToCssVars(cfg.value.darkSurfaces)\n : {};\n return { ...providerVars, ...surfaceVars, ...darkSurfaceVars }; \n}); \n \nfunction close() { \n if (!props.modelValue) return; \n emit('update:modelValue', false); \n emit('close'); \n} \n \n/* ---------- Click outside ---------- */ \nlet mouseDownOnOverlay = false; \nfunction onOverlayMouseDown(e: MouseEvent) { \n mouseDownOnOverlay = e.target === overlayRef.value; \n} \nfunction onOverlayClick(e: MouseEvent) { \n if (!props.closeOnOverlay) return; \n if (e.target !== overlayRef.value) return; \n if (!mouseDownOnOverlay) return; \n close(); \n} \n \n/* ---------- Keydown (Escape + focus trap) ---------- */ \nfunction onPanelKeydown(e: KeyboardEvent) { \n if (props.closeOnEscape && e.key === 'Escape') { \n e.preventDefault(); \n close(); \n return; \n } \n if (e.key === 'Tab' && panelRef.value) { \n const focusables = getFocusable(panelRef.value); \n if (focusables.length === 0) { \n e.preventDefault(); \n return; \n } \n const first = focusables[0]; \n const last = focusables[focusables.length - 1]; \n const active = document.activeElement as HTMLElement | null; \n if (e.shiftKey && active === first) { \n e.preventDefault(); \n last.focus(); \n } else if (!e.shiftKey && active === last) { \n e.preventDefault(); \n first.focus(); \n } \n } \n} \n \nconst FOCUSABLE_SELECTOR = \n 'a[href], area[href], input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]'; \n \nfunction getFocusable(container: HTMLElement): HTMLElement[] { \n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)) \n .filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null); \n} \n \n/* ---------- Animations (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 switch (props.side) { \n case 'left': return { x: '-100%', y: 0 }; \n case 'right': return { x: '100%', y: 0 }; \n case 'top': return { x: 0, y: '-100%' }; \n case 'bottom': return { x: 0, y: '100%' }; \n default: return { x: '100%', 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 const content = \n overlay?.querySelector<HTMLElement>('[data-modo-drawer-content]') \n ?? contentRef.value; \n if (!overlay || !panel || !content) { done(); return; } \n \n activeTimeline?.kill(); \n \n if (prefersReducedMotion()) { \n gsap.set([overlay, panel, content], { 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.25, ease: 'power2.out' }, 0); \n \n tl.fromTo( \n panel, \n { x: enter.x, y: enter.y, opacity: 1 }, \n { x: 0, y: 0, opacity: 1, duration: 0.4, ease: 'power3.out' }, \n 0, \n ); \n \n tl.fromTo( \n content, \n { opacity: 0 }, \n { opacity: 1, duration: 0.22, ease: 'power2.out' }, \n 0.18, \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 const content = \n overlay.querySelector<HTMLElement>('[data-modo-drawer-content]')\n ?? contentRef.value;\n // Bail out without animating, but never without releasing the lock.\n if (!overlay || !panel || !content) { 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(content, { opacity: 0, duration: 0.14, ease: 'power1.in' }, 0); \n tl.to( \n panel, \n { x: enter.x, y: enter.y, duration: 0.32, ease: 'power3.in' }, \n 0.08, \n ); \n tl.to(overlay, { opacity: 0, duration: 0.28, ease: 'power2.in' }, 0.12); \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 // Width + full height \n const heightCls = 'h-full'; \n switch (props.size) { \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 // Height + full width \n const widthCls = 'w-full'; \n switch (props.size) { \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 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 * El radius se aplica solo a las dos esquinas opuestas al borde de entrada \n * (las que quedan visibles dentro del viewport). El lado pegado al borde \n * queda recto. \n */ \nconst radiusClasses = computed(() => { \n if (props.size === 'full') return 'rounded-none'; \n // Mapeo explícito (Tailwind JIT requiere class names literales). \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.size === 'full') return 'rounded-none'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-[calc(1.5rem-4px)]'; \n default: return 'rounded-lg'; \n } \n}); \n \nconst overlayClasses = computed(() => { \n switch (props.overlay) { \n case 'solid': return 'bg-foreground/60'; \n case 'transparent': return 'bg-transparent'; \n case 'dark': return 'bg-foreground/80'; \n case 'dim': return 'bg-foreground/20'; \n case 'glass': return 'bg-background/50 backdrop-blur-md'; \n case 'blur': \n default: return 'bg-foreground/40 backdrop-blur-sm'; \n } \n}); \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqPA,IAAM,qBACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAhGJ,MAAM,QAAQ;EAad,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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AA,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"}
|
|
@@ -5,9 +5,10 @@ import { resolveColorMode } from "../../composables/useColorMode.mjs";
|
|
|
5
5
|
import { useModoConfig, useResolvedColor, useResolvedRadius, useResolvedTheme } from "../../composables/useModoConfig.mjs";
|
|
6
6
|
import Button_default from "../forms/Button.mjs";
|
|
7
7
|
import Typography_default from "../data-display/Typography.mjs";
|
|
8
|
+
import { lockBodyScroll, unlockBodyScroll } from "../../composables/useBodyScrollLock.mjs";
|
|
8
9
|
import { Teleport, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, openBlock, ref, renderSlot, toDisplayString, unref, useId, watch, withCtx, withModifiers } from "vue";
|
|
9
10
|
import { XMarkIcon } from "@heroicons/vue/24/outline";
|
|
10
|
-
import { gsap
|
|
11
|
+
import { gsap } from "gsap";
|
|
11
12
|
//#region src/components/feedback/Drawer.vue?vue&type=script&setup=true&lang.ts
|
|
12
13
|
var _hoisted_1 = ["data-modo-theme"];
|
|
13
14
|
var _hoisted_2 = [
|
|
@@ -184,7 +185,7 @@ var Drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
184
185
|
}
|
|
185
186
|
activeTimeline?.kill();
|
|
186
187
|
if (prefersReducedMotion()) {
|
|
187
|
-
gsap
|
|
188
|
+
gsap.set([
|
|
188
189
|
overlay,
|
|
189
190
|
panel,
|
|
190
191
|
content
|
|
@@ -196,7 +197,7 @@ var Drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
196
197
|
return;
|
|
197
198
|
}
|
|
198
199
|
const enter = getEnterTransform();
|
|
199
|
-
const tl = gsap
|
|
200
|
+
const tl = gsap.timeline({ onComplete: () => {
|
|
200
201
|
activeTimeline = null;
|
|
201
202
|
done();
|
|
202
203
|
} });
|
|
@@ -228,12 +229,13 @@ var Drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
228
229
|
const panel = overlay.querySelector("[data-modo-drawer-panel]") ?? panelRef.value;
|
|
229
230
|
const content = overlay.querySelector("[data-modo-drawer-content]") ?? contentRef.value;
|
|
230
231
|
if (!overlay || !panel || !content) {
|
|
232
|
+
releaseScrollLock();
|
|
231
233
|
done();
|
|
232
234
|
return;
|
|
233
235
|
}
|
|
234
236
|
activeTimeline?.kill();
|
|
235
237
|
if (prefersReducedMotion()) {
|
|
236
|
-
gsap
|
|
238
|
+
gsap.to(overlay, {
|
|
237
239
|
opacity: 0,
|
|
238
240
|
duration: .12,
|
|
239
241
|
onComplete: () => {
|
|
@@ -244,7 +246,7 @@ var Drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
244
246
|
return;
|
|
245
247
|
}
|
|
246
248
|
const enter = getEnterTransform();
|
|
247
|
-
const tl = gsap
|
|
249
|
+
const tl = gsap.timeline({ onComplete: () => {
|
|
248
250
|
activeTimeline = null;
|
|
249
251
|
releaseScrollLock();
|
|
250
252
|
done();
|
|
@@ -267,26 +269,19 @@ var Drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
267
269
|
ease: "power2.in"
|
|
268
270
|
}, .12);
|
|
269
271
|
}
|
|
270
|
-
let previousOverflow = "";
|
|
271
|
-
let previousPaddingRight = "";
|
|
272
272
|
let previouslyFocused = null;
|
|
273
273
|
let scrollLocked = false;
|
|
274
274
|
function releaseScrollLock() {
|
|
275
275
|
if (!scrollLocked) return;
|
|
276
|
-
document.body.style.overflow = previousOverflow;
|
|
277
|
-
document.body.style.paddingRight = previousPaddingRight;
|
|
278
276
|
scrollLocked = false;
|
|
277
|
+
unlockBodyScroll();
|
|
279
278
|
}
|
|
280
279
|
watch(() => props.modelValue, (open) => {
|
|
281
280
|
if (open) {
|
|
282
281
|
previouslyFocused = document.activeElement;
|
|
283
282
|
if (props.lockScroll && !scrollLocked) {
|
|
284
|
-
const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
285
|
-
previousOverflow = document.body.style.overflow;
|
|
286
|
-
previousPaddingRight = document.body.style.paddingRight;
|
|
287
|
-
document.body.style.overflow = "hidden";
|
|
288
|
-
if (scrollBarWidth > 0) document.body.style.paddingRight = `${scrollBarWidth}px`;
|
|
289
283
|
scrollLocked = true;
|
|
284
|
+
lockBodyScroll();
|
|
290
285
|
}
|
|
291
286
|
emit("open");
|
|
292
287
|
nextTick(() => {
|