mood-ui 0.10.0 → 0.12.0
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/Chart.cjs +6 -0
- package/dist/components/data-display/Chart.cjs.map +1 -0
- package/dist/components/data-display/Chart.mjs +7 -0
- package/dist/components/data-display/Chart.mjs.map +1 -0
- package/dist/components/data-display/Chart.vue_vue_type_script_setup_true_lang.cjs +48 -0
- package/dist/components/data-display/Chart.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/components/data-display/Chart.vue_vue_type_script_setup_true_lang.mjs +47 -0
- package/dist/components/data-display/Chart.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/data-display/Stat.cjs.map +1 -1
- package/dist/components/data-display/Stat.mjs.map +1 -1
- package/dist/components/data-display/Stat.vue_vue_type_script_setup_true_lang.cjs +88 -75
- package/dist/components/data-display/Stat.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/Stat.vue_vue_type_script_setup_true_lang.mjs +90 -77
- package/dist/components/data-display/Stat.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- 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 +4 -1
- 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 +4 -1
- package/dist/components/data-display/calendar/AgendaView.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 +7 -4
- 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 +7 -4
- 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 +8 -12
- 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 +8 -12
- 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 +7 -4
- 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 +7 -4
- 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 +7 -4
- 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 +7 -4
- package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/chart/Cartesian.cjs +6 -0
- package/dist/components/data-display/chart/Cartesian.cjs.map +1 -0
- package/dist/components/data-display/chart/Cartesian.mjs +7 -0
- package/dist/components/data-display/chart/Cartesian.mjs.map +1 -0
- package/dist/components/data-display/chart/Cartesian.vue_vue_type_script_setup_true_lang.cjs +573 -0
- package/dist/components/data-display/chart/Cartesian.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/components/data-display/chart/Cartesian.vue_vue_type_script_setup_true_lang.mjs +572 -0
- package/dist/components/data-display/chart/Cartesian.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/data-display/chart/Heatmap.cjs +6 -0
- package/dist/components/data-display/chart/Heatmap.cjs.map +1 -0
- package/dist/components/data-display/chart/Heatmap.mjs +7 -0
- package/dist/components/data-display/chart/Heatmap.mjs.map +1 -0
- package/dist/components/data-display/chart/Heatmap.vue_vue_type_script_setup_true_lang.cjs +332 -0
- package/dist/components/data-display/chart/Heatmap.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/components/data-display/chart/Heatmap.vue_vue_type_script_setup_true_lang.mjs +331 -0
- package/dist/components/data-display/chart/Heatmap.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/data-display/chart/Polar.cjs +6 -0
- package/dist/components/data-display/chart/Polar.cjs.map +1 -0
- package/dist/components/data-display/chart/Polar.mjs +7 -0
- package/dist/components/data-display/chart/Polar.mjs.map +1 -0
- package/dist/components/data-display/chart/Polar.vue_vue_type_script_setup_true_lang.cjs +361 -0
- package/dist/components/data-display/chart/Polar.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/components/data-display/chart/Polar.vue_vue_type_script_setup_true_lang.mjs +360 -0
- package/dist/components/data-display/chart/Polar.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/data-display/chart/Radar.cjs +6 -0
- package/dist/components/data-display/chart/Radar.cjs.map +1 -0
- package/dist/components/data-display/chart/Radar.mjs +7 -0
- package/dist/components/data-display/chart/Radar.mjs.map +1 -0
- package/dist/components/data-display/chart/Radar.vue_vue_type_script_setup_true_lang.cjs +347 -0
- package/dist/components/data-display/chart/Radar.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/components/data-display/chart/Radar.vue_vue_type_script_setup_true_lang.mjs +346 -0
- package/dist/components/data-display/chart/Radar.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/data-display/chart/Sparkline.cjs +6 -0
- package/dist/components/data-display/chart/Sparkline.cjs.map +1 -0
- package/dist/components/data-display/chart/Sparkline.mjs +7 -0
- package/dist/components/data-display/chart/Sparkline.mjs.map +1 -0
- package/dist/components/data-display/chart/Sparkline.vue_vue_type_script_setup_true_lang.cjs +293 -0
- package/dist/components/data-display/chart/Sparkline.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/components/data-display/chart/Sparkline.vue_vue_type_script_setup_true_lang.mjs +292 -0
- package/dist/components/data-display/chart/Sparkline.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/data-display/chart/useChart.cjs +189 -0
- package/dist/components/data-display/chart/useChart.cjs.map +1 -0
- package/dist/components/data-display/chart/useChart.mjs +182 -0
- package/dist/components/data-display/chart/useChart.mjs.map +1 -0
- package/dist/components/data-display/date-picker/DateRangePicker.cjs.map +1 -1
- package/dist/components/data-display/date-picker/DateRangePicker.mjs.map +1 -1
- package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.cjs +1 -7
- package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.mjs +1 -7
- 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 +1 -1
- package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.mjs +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 +4 -9
- 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 +4 -9
- 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 +64 -20
- 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 +64 -20
- package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/Button.cjs +1 -1
- package/dist/components/forms/Button.cjs.map +1 -1
- package/dist/components/forms/Button.mjs +1 -1
- package/dist/components/forms/Button.mjs.map +1 -1
- package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.cjs +76 -63
- package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.mjs +77 -64
- package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/ButtonGroup.cjs +1 -1
- package/dist/components/forms/ButtonGroup.cjs.map +1 -1
- package/dist/components/forms/ButtonGroup.mjs +1 -1
- package/dist/components/forms/ButtonGroup.mjs.map +1 -1
- package/dist/components/forms/ButtonGroup.vue_vue_type_script_setup_true_lang.cjs +2 -2
- package/dist/components/forms/ButtonGroup.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/ButtonGroup.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/forms/ButtonGroup.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/Checkbox.cjs +1 -1
- package/dist/components/forms/Checkbox.cjs.map +1 -1
- package/dist/components/forms/Checkbox.mjs +1 -1
- package/dist/components/forms/Checkbox.mjs.map +1 -1
- package/dist/components/forms/Checkbox.vue_vue_type_script_setup_true_lang.cjs +7 -7
- package/dist/components/forms/Checkbox.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/Checkbox.vue_vue_type_script_setup_true_lang.mjs +7 -7
- package/dist/components/forms/Checkbox.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/ColorPicker.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/forms/ColorPicker.vue_vue_type_script_setup_true_lang.mjs +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 +4 -4
- 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 +4 -4
- package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/DateField.vue_vue_type_script_setup_true_lang.cjs +2 -2
- package/dist/components/forms/DateField.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/forms/DateRangeField.vue_vue_type_script_setup_true_lang.cjs +2 -2
- package/dist/components/forms/DateRangeField.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/forms/DateTimeField.vue_vue_type_script_setup_true_lang.cjs +2 -2
- package/dist/components/forms/DateTimeField.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/forms/FormField.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/forms/FormField.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/forms/Input.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/forms/Input.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/forms/MenuButton.cjs +6 -0
- package/dist/components/forms/MenuButton.cjs.map +1 -0
- package/dist/components/forms/MenuButton.mjs +7 -0
- package/dist/components/forms/MenuButton.mjs.map +1 -0
- package/dist/components/forms/MenuButton.vue_vue_type_script_setup_true_lang.cjs +270 -0
- package/dist/components/forms/MenuButton.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/components/forms/MenuButton.vue_vue_type_script_setup_true_lang.mjs +269 -0
- package/dist/components/forms/MenuButton.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.cjs +2 -2
- package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/forms/NumberInput.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/forms/NumberInput.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/forms/OTPInput.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/forms/OTPInput.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/forms/PasswordInput.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/forms/PasswordInput.vue_vue_type_script_setup_true_lang.mjs +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 +8 -3
- 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 +8 -3
- package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/Radio.cjs +1 -1
- package/dist/components/forms/Radio.cjs.map +1 -1
- package/dist/components/forms/Radio.mjs +1 -1
- package/dist/components/forms/Radio.mjs.map +1 -1
- package/dist/components/forms/Radio.vue_vue_type_script_setup_true_lang.cjs +6 -6
- package/dist/components/forms/Radio.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/Radio.vue_vue_type_script_setup_true_lang.mjs +6 -6
- package/dist/components/forms/Radio.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/RangeSlider.cjs.map +1 -1
- package/dist/components/forms/RangeSlider.mjs.map +1 -1
- package/dist/components/forms/RangeSlider.vue_vue_type_script_setup_true_lang.cjs +6 -6
- package/dist/components/forms/RangeSlider.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/RangeSlider.vue_vue_type_script_setup_true_lang.mjs +6 -6
- package/dist/components/forms/RangeSlider.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 +230 -23
- 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 +232 -25
- package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/Segmented.cjs +1 -1
- package/dist/components/forms/Segmented.cjs.map +1 -1
- package/dist/components/forms/Segmented.mjs +1 -1
- package/dist/components/forms/Segmented.mjs.map +1 -1
- package/dist/components/forms/Segmented.vue_vue_type_script_setup_true_lang.cjs +4 -12
- package/dist/components/forms/Segmented.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/Segmented.vue_vue_type_script_setup_true_lang.mjs +4 -12
- package/dist/components/forms/Segmented.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/Select.vue_vue_type_script_setup_true_lang.cjs +2 -2
- package/dist/components/forms/Select.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/forms/Slider.cjs.map +1 -1
- package/dist/components/forms/Slider.mjs.map +1 -1
- package/dist/components/forms/Slider.vue_vue_type_script_setup_true_lang.cjs +6 -6
- package/dist/components/forms/Slider.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/Slider.vue_vue_type_script_setup_true_lang.mjs +6 -6
- package/dist/components/forms/Slider.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/Switch.cjs +1 -1
- package/dist/components/forms/Switch.cjs.map +1 -1
- package/dist/components/forms/Switch.mjs +1 -1
- package/dist/components/forms/Switch.mjs.map +1 -1
- package/dist/components/forms/Switch.vue_vue_type_script_setup_true_lang.cjs +7 -7
- package/dist/components/forms/Switch.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/Switch.vue_vue_type_script_setup_true_lang.mjs +7 -7
- package/dist/components/forms/Switch.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/layout/AppShell.cjs.map +1 -1
- package/dist/components/layout/AppShell.mjs.map +1 -1
- package/dist/components/layout/AppShell.vue_vue_type_script_setup_true_lang.cjs +8 -8
- package/dist/components/layout/AppShell.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/layout/AppShell.vue_vue_type_script_setup_true_lang.mjs +8 -8
- package/dist/components/layout/AppShell.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/layout/Sidebar.cjs.map +1 -1
- package/dist/components/layout/Sidebar.mjs.map +1 -1
- package/dist/components/layout/Sidebar.vue_vue_type_script_setup_true_lang.cjs +36 -21
- package/dist/components/layout/Sidebar.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/layout/Sidebar.vue_vue_type_script_setup_true_lang.mjs +36 -21
- package/dist/components/layout/Sidebar.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/layout/Topbar.cjs.map +1 -1
- package/dist/components/layout/Topbar.mjs.map +1 -1
- package/dist/components/layout/Topbar.vue_vue_type_script_setup_true_lang.cjs +2 -2
- package/dist/components/layout/Topbar.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/layout/Topbar.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/layout/Topbar.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 +42 -44
- 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 +42 -44
- package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/navigation/Tabs.cjs +1 -1
- package/dist/components/navigation/Tabs.cjs.map +1 -1
- package/dist/components/navigation/Tabs.mjs +1 -1
- package/dist/components/navigation/Tabs.mjs.map +1 -1
- package/dist/components/navigation/Tabs.vue_vue_type_script_setup_true_lang.cjs +1 -9
- package/dist/components/navigation/Tabs.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/navigation/Tabs.vue_vue_type_script_setup_true_lang.mjs +1 -9
- package/dist/components/navigation/Tabs.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/useField.cjs +21 -23
- package/dist/composables/useField.cjs.map +1 -1
- package/dist/composables/useField.mjs +21 -24
- package/dist/composables/useField.mjs.map +1 -1
- package/dist/composables/usePopover.cjs +49 -13
- package/dist/composables/usePopover.cjs.map +1 -1
- package/dist/composables/usePopover.mjs +49 -13
- package/dist/composables/usePopover.mjs.map +1 -1
- package/dist/index.cjs +5 -1
- package/dist/index.mjs +4 -2
- package/dist/mood-ui.css +116 -482
- package/dist/types/components/data-display/Chart.vue.d.ts +8 -0
- package/dist/types/components/data-display/Stat.vue.d.ts +12 -2
- package/dist/types/components/data-display/chart/Cartesian.vue.d.ts +17 -0
- package/dist/types/components/data-display/chart/Heatmap.vue.d.ts +10 -0
- package/dist/types/components/data-display/chart/Polar.vue.d.ts +9 -0
- package/dist/types/components/data-display/chart/Radar.vue.d.ts +10 -0
- package/dist/types/components/data-display/chart/Sparkline.vue.d.ts +13 -0
- package/dist/types/components/data-display/chart/useChart.d.ts +49 -0
- package/dist/types/components/feedback/Drawer.vue.d.ts +2 -2
- package/dist/types/components/feedback/Modal.vue.d.ts +2 -2
- package/dist/types/components/feedback/Tooltip.vue.d.ts +1 -1
- package/dist/types/components/forms/Button.vue.d.ts +3 -2
- package/dist/types/components/forms/Combobox.vue.d.ts +3 -3
- package/dist/types/components/forms/DateField.vue.d.ts +3 -3
- package/dist/types/components/forms/DateRangeField.vue.d.ts +3 -3
- package/dist/types/components/forms/DateTimeField.vue.d.ts +3 -3
- package/dist/types/components/forms/MenuButton.vue.d.ts +23 -0
- package/dist/types/components/forms/MultiSelect.vue.d.ts +3 -3
- package/dist/types/components/forms/SearchInput.vue.d.ts +33 -2
- package/dist/types/components/forms/Select.vue.d.ts +2 -2
- package/dist/types/components/layout/AppShell.vue.d.ts +1 -1
- package/dist/types/components/layout/PageHeader.vue.d.ts +1 -1
- package/dist/types/components/layout/Sidebar.vue.d.ts +4 -4
- package/dist/types/components/layout/Stack.vue.d.ts +1 -1
- package/dist/types/components/layout/Topbar.vue.d.ts +1 -1
- package/dist/types/components/navigation/Breadcrumbs.vue.d.ts +1 -1
- package/dist/types/components/navigation/Switcher.vue.d.ts +3 -3
- 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/composables/useField.d.ts +10 -0
- package/dist/types/composables/usePopover.d.ts +7 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/interfaces/data-display/Chart.interface.d.ts +97 -0
- package/dist/types/interfaces/data-display/Stat.interface.d.ts +17 -6
- 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/interfaces/feedback/Tooltip.interface.d.ts +11 -0
- package/dist/types/interfaces/forms/MenuButton.interface.d.ts +38 -0
- package/dist/types/interfaces/forms/SearchInput.interface.d.ts +36 -0
- package/dist/types/utils/cssLength.d.ts +5 -0
- package/dist/types/utils/tooltipArrow.d.ts +34 -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":"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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAhGJ,MAAM,QAAQ;EAad,MAAM,OAAO;EAOb,MAAM,UAAA,GAAA,IAAA,QAAgB;EACtB,MAAM,WAAA,GAAA,IAAA,gBAAyB,eAAe,OAAO,QAAQ;EAC7D,MAAM,iBA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A,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;EAEhD,MAAM,gBAAgB,sBAAA,uBAAuB,MAAM,MAA+B;EAClF,MAAM,iBAAiB,sBAAA,wBAAwB,MAAM,OAAiC;EAEtF,MAAM,MAAM,sBAAA,eAAe;EAC3B,MAAM,QAAQ,sBAAA,kBAAkB;EAChC,MAAM,eA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AAA,YACmC,KAAA,QAAA,UAAA,EAAT,OAAK,CAAA,CAAA,CAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA"}
|
|
@@ -5,6 +5,7 @@ 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
11
|
import { gsap as gsap$1 } from "gsap";
|
|
@@ -228,6 +229,7 @@ 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
|
}
|
|
@@ -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(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.vue_vue_type_script_setup_true_lang.mjs","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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAhGJ,MAAM,QAAQ;EAad,MAAM,OAAO;EAOb,MAAM,SAAS,OAAO;EACtB,MAAM,UAAU,eAAe,eAAe,OAAO,QAAQ;EAC7D,MAAM,gBAAgB,eAAe,eAAe,OAAO,OAAO;EAElE,MAAM,aAAa,IAAwB,KAAK;EAChD,MAAM,WAAW,IAAwB,KAAK;EAC9C,MAAM,aAAa,IAAwB,KAAK;EAEhD,MAAM,gBAAgB,uBAAuB,MAAM,MAA+B;EAClF,MAAM,iBAAiB,wBAAwB,MAAM,OAAiC;EAEtF,MAAM,MAAM,eAAe;EAC3B,MAAM,QAAQ,kBAAkB;EAChC,MAAM,cAAc,eAAe,iBAAiB,MAAM,MAAM,CAAC;EAEjE,MAAM,eAAe,eAAe;GAChC,MAAM,eAAe,KAAK,MAAM,WAC1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AK,EAAA,EAAA,CAAA,CAAA;;qDAGF,QAAA,eAAA,WAAA,EADV,YAQa,oBAAA;;OANR,IAAI,cAAA;OACL,SAAQ;OACR,MAAK;OACL,OAAM;;8BAEW,CAAA,gBAAA,gBAAd,QAAA,YAAW,EAAA,EAAA,CAAA,CAAA;;;MAOhBA,KAAAA,OAAO,WAAWA,KAAAA,OAAO,QAAA,WAAA,EADnC,mBAWM,OAAA;;OATD,OAAK,eAAA;;QAA6GA,KAAAA,OAAO,UAAU,QAAA,SAAS,QAAA,cAAW,KAAA;QAAkDA,KAAAA,OAAO,SAAM,SAAA;;UAMvN,WAEO,KAAA,QAAA,QAAA,EAAA,QAAA,CADH,WAAQ,KAAA,QAAA,UAAA,CAAA,CAAA,CAAA,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;MAMNA,KAAAA,OAAO,UAAA,WAAA,EADjB,mBAeS,UAfT,YAeS,CAVK,QAAA,eAAA,WAAA,EADV,mBAIE,QAJF,WAIE,KAAA,WAAA,EACF,mBAIE,QAJF,WAIE,GACF,WAAqC,KAAA,QAAA,UAAA,EAAT,OAAK,CAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
|
|
1
|
+
{"version":3,"file":"Drawer.vue_vue_type_script_setup_true_lang.mjs","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,SAAS,OAAO;EACtB,MAAM,UAAU,eAAe,eAAe,OAAO,QAAQ;EAC7D,MAAM,gBAAgB,eAAe,eAAe,OAAO,OAAO;EAElE,MAAM,aAAa,IAAwB,KAAK;EAChD,MAAM,WAAW,IAAwB,KAAK;EAC9C,MAAM,aAAa,IAAwB,KAAK;EAEhD,MAAM,gBAAgB,uBAAuB,MAAM,MAA+B;EAClF,MAAM,iBAAiB,wBAAwB,MAAM,OAAiC;EAEtF,MAAM,MAAM,eAAe;EAC3B,MAAM,QAAQ,kBAAkB;EAChC,MAAM,cAAc,eAAe,iBAAiB,MAAM,MAAM,CAAC;EAEjE,MAAM,eAAe,eAAe;GAChC,MAAM,eAAe,KAA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,OAAA;;OATD,OAAK,eAAA;;QAA6GA,KAAAA,OAAO,UAAU,QAAA,SAAS,QAAA,cAAW,KAAA;QAAkDA,KAAAA,OAAO,SAAM,SAAA;;UAMvN,WAEO,KAAA,QAAA,QAAA,EAAA,QAAA,CADH,WAAQ,KAAA,QAAA,UAAA,CAAA,CAAA,CAAA,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;MAMNA,KAAAA,OAAO,UAAA,WAAA,EADjB,mBAeS,UAfT,YAeS,CAVK,QAAA,eAAA,WAAA,EADV,mBAIE,QAJF,WAIE,KAAA,WAAA,EACF,mBAIE,QAJF,WAIE,GACF,WAAqC,KAAA,QAAA,UAAA,EAAT,OAAK,CAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.cjs","names":[],"sources":["../../../src/components/feedback/Modal.vue"],"sourcesContent":["<template> \n <Teleport to=\"body\"> \n <Transition :css=\"false\" @enter=\"onOverlayEnter\" @leave=\"onOverlayLeave\" appear> \n <div \n v-if=\"modelValue\" \n ref=\"overlayRef\" \n :class=\"[ \n 'modo-modal-overlay fixed inset-0 z-1200 flex opacity-0', \n positionClasses, \n 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-modal-panel \n role=\"dialog\" \n aria-modal=\"true\" \n :aria-labelledby=\"title ? titleId : undefined\" \n :aria-describedby=\"description ? descriptionId : undefined\" \n :aria-label=\"!title ? ariaLabel : undefined\" \n :class=\"[ \n 'modo-modal relative flex flex-col w-full bg-card text-foreground', \n 'dark:bg-card/85 dark:backdrop-blur-xl', \n 'border border-border shadow-xl', \n sizeClasses, \n radiusClasses, \n ]\" \n tabindex=\"-1\" \n @click.stop \n @keydown=\"onPanelKeydown\" \n > \n <!-- Inner border layer --> \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n :class=\"[ \n 'pointer-events-none absolute inset-1 border border-border/40', \n innerBorderRadiusClass, \n ]\" \n /> \n \n <!-- Close button (usa nuestro Button en modo icono) --> \n <div v-if=\"showClose\" class=\"absolute top-3 right-3 z-10\"> \n <Button \n variant=\"text\" \n size=\"small\" \n :color=\"resolvedColor\" \n :icon=\"XMarkIcon\" \n ariaLabel=\"Close\" \n @click=\"close\" \n /> \n </div> \n \n <!-- Content wrapper (animado en etapa 2) --> \n <div ref=\"contentRef\" data-modo-modal-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 (divider respeta inner border con inset) --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-6 py-4\" \n > \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-1 right-1 h-px bg-border/40\" \n /> \n <span \n v-else \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-0 right-0 h-px bg-border\" \n /> \n <slot name=\"footer\" :close=\"close\" /> \n </footer> \n </div> \n </div> \n </div> \n </Transition> \n </Teleport> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Button from '../forms/Button.vue'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Modal } from '../../interfaces/feedback/Modal.interface'; \nimport { \n useResolvedColor, \n useResolvedRadius, \n useResolvedTheme, \n useModoConfig, \n} from '../../composables/useModoConfig'; \nimport { resolveColorMode } from '../../composables/useColorMode'; \nimport { palettesToCssVars, semanticTokensFromPalettes } from '../../config/palettes'; \nimport { hexToOklchString, pickForegroundOklch } from '../../config/colorPrimitives'; \nimport { surfacesToCssVars } from '../../config/surfaces'; \nimport type { ModoColor, ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Modal>(), { \n modelValue: false, \n size: 'medium', \n position: 'center', \n closeOnOverlay: true, \n closeOnEscape: true, \n showClose: true, \n lockScroll: true, \n color: 'default', \n overlay: 'blur', \n innerBorder: true, \n disableOriginAnimation: false, \n}); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [value: boolean]; \n open: []; \n close: []; \n afterLeave: []; \n}>(); \n \nconst autoId = useId(); \nconst titleId = computed(() => `modo-modal-${autoId}-title`); \nconst descriptionId = computed(() => `modo-modal-${autoId}-desc`); \n \nconst overlayRef = ref<HTMLElement | null>(null); \nconst panelRef = ref<HTMLElement | null>(null); \nconst contentRef = ref<HTMLElement | null>(null); \n \nconst resolvedColor = useResolvedColor(() => props.color as ModoColor | undefined); \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \nconst cfg = useModoConfig(); \nconst theme = useResolvedTheme(); \nconst scopedTheme = computed(() => resolveColorMode(theme.value)); \n \nconst overlayStyle = computed(() => { \n const providerVars = cfg?.value.palettes \n ? { \n ...palettesToCssVars(cfg.value.palettes), \n ...semanticTokensFromPalettes(cfg.value.palettes, hexToOklchString, pickForegroundOklch), \n } \n : {};\n const surfaceVars = cfg?.value.surfaces\n ? surfacesToCssVars(cfg.value.surfaces)\n : {};\n const darkSurfaceVars = (scopedTheme.value === 'dark' && cfg?.value.darkSurfaces)\n ? surfacesToCssVars(cfg.value.darkSurfaces)\n : {};\n return { ...providerVars, ...surfaceVars, ...darkSurfaceVars };\n}); \n \nfunction close() { \n if (!props.modelValue) return; \n emit('update:modelValue', false); \n emit('close'); \n} \n \n/* ---------- Click outside ---------- */ \nlet mouseDownOnOverlay = false; \nfunction onOverlayMouseDown(e: MouseEvent) { \n mouseDownOnOverlay = e.target === overlayRef.value; \n} \nfunction onOverlayClick(e: MouseEvent) { \n if (!props.closeOnOverlay) return; \n if (e.target !== overlayRef.value) return; \n if (!mouseDownOnOverlay) return; \n close(); \n} \n \n/* ---------- Keydown (Escape + focus trap) ---------- */ \nfunction onPanelKeydown(e: KeyboardEvent) { \n if (props.closeOnEscape && e.key === 'Escape') { \n e.preventDefault(); \n close(); \n return; \n } \n if (e.key === 'Tab' && panelRef.value) { \n const focusables = getFocusable(panelRef.value); \n if (focusables.length === 0) { \n e.preventDefault(); \n return; \n } \n const first = focusables[0]; \n const last = focusables[focusables.length - 1]; \n const active = document.activeElement as HTMLElement | null; \n if (e.shiftKey && active === first) { \n e.preventDefault(); \n last.focus(); \n } else if (!e.shiftKey && active === last) { \n e.preventDefault(); \n first.focus(); \n } \n } \n} \n \nconst FOCUSABLE_SELECTOR = \n 'a[href], area[href], input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]'; \n \nfunction getFocusable(container: HTMLElement): HTMLElement[] { \n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)) \n .filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null); \n} \n \n/* ---------- Animations (staged open/close) ---------- */ \n \nfunction prefersReducedMotion() { \n return typeof window !== 'undefined' \n && window.matchMedia('(prefers-reduced-motion: reduce)').matches; \n} \n \nlet capturedOrigin: HTMLElement | null = null; \nfunction getOriginEl(): HTMLElement | null { \n if (props.origin) return props.origin; \n return capturedOrigin; \n} \n \nlet activeTimeline: gsap.core.Timeline | null = null; \n \nfunction onOverlayEnter(el: Element, done: () => void) { \n const overlay = (el as HTMLElement) ?? overlayRef.value; \n const panel = \n overlay?.querySelector<HTMLElement>('[data-modo-modal-panel]') \n ?? panelRef.value; \n const content = \n overlay?.querySelector<HTMLElement>('[data-modo-modal-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 origin = !props.disableOriginAnimation ? getOriginEl() : null; \n const pRect = panel.getBoundingClientRect(); \n \n const tl = gsap.timeline({ onComplete: () => { activeTimeline = null; done(); } }); \n activeTimeline = tl; \n \n // 1. Overlay fade in \n tl.fromTo(overlay, { opacity: 0 }, { opacity: 1, duration: 0.25, ease: 'power2.out' }, 0); \n \n // 2. Panel emerge from trigger (small) → grows to full size \n if (origin && document.body.contains(origin)) { \n const oRect = origin.getBoundingClientRect(); \n const dx = oRect.left + oRect.width / 2 - (pRect.left + pRect.width / 2); \n const dy = oRect.top + oRect.height / 2 - (pRect.top + pRect.height / 2); \n const scaleX = Math.max(oRect.width / pRect.width, 0.05); \n const scaleY = Math.max(oRect.height / pRect.height, 0.05); \n tl.fromTo( \n panel, \n { x: dx, y: dy, scaleX, scaleY, opacity: 0.85, transformOrigin: 'center center' }, \n { x: 0, y: 0, scaleX: 1, scaleY: 1, opacity: 1, duration: 0.5, ease: 'power3.out' }, \n 0.05, \n ); \n } else { \n tl.fromTo( \n panel, \n { y: 16, scale: 0.95, opacity: 0 }, \n { y: 0, scale: 1, opacity: 1, duration: 0.35, ease: 'power2.out' }, \n 0, \n ); \n } \n \n // 3. Contenido fade in una vez el panel tiene tamaño real \n tl.fromTo( \n content, \n { opacity: 0, y: 8 }, \n { opacity: 1, y: 0, duration: 0.28, ease: 'power2.out' }, \n 0.38, \n ); \n} \n \nfunction onOverlayLeave(el: Element, done: () => void) { \n // Durante el leave, los template refs de Vue ya fueron desvinculados, \n // así que resolvemos los nodos desde el elemento que Transition nos entrega. \n const overlay = el as HTMLElement; \n const panel = \n overlay.querySelector<HTMLElement>('[data-modo-modal-panel]') \n ?? panelRef.value; \n const content = \n overlay.querySelector<HTMLElement>('[data-modo-modal-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 origin = !props.disableOriginAnimation ? getOriginEl() : null; \n const pRect = panel.getBoundingClientRect(); \n \n const tl = gsap.timeline({ \n onComplete: () => { \n activeTimeline = null; \n releaseScrollLock(); \n done(); \n }, \n }); \n activeTimeline = tl; \n \n // 1. Contenido desaparece (solo opacidad, sin movimiento) \n tl.to(content, { opacity: 0, duration: 0.18, ease: 'power1.in' }, 0); \n \n // 2. Panel se encoge hacia el trigger (inmediatamente despues de que \n // el contenido ya es invisible, no solapado con el fade). \n if (origin && document.body.contains(origin)) { \n const oRect = origin.getBoundingClientRect(); \n const dx = oRect.left + oRect.width / 2 - (pRect.left + pRect.width / 2); \n const dy = oRect.top + oRect.height / 2 - (pRect.top + pRect.height / 2); \n const scaleX = Math.max(oRect.width / pRect.width, 0.05); \n const scaleY = Math.max(oRect.height / pRect.height, 0.05); \n tl.to( \n panel, \n { x: dx, y: dy, scaleX, scaleY, opacity: 0, duration: 0.38, ease: 'power3.in' }, \n 0.18, \n ); \n } else { \n tl.to( \n panel, \n { y: 10, scale: 0.95, opacity: 0, duration: 0.24, ease: 'power2.in' }, \n 0.18, \n ); \n } \n \n // 3. Overlay fade out junto al panel \n tl.to(overlay, { opacity: 0, duration: 0.28, ease: 'power2.in' }, 0.22); \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 capturedOrigin = active && active !== document.body ? active : null; \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 // El scroll lock se libera en onOverlayLeave cuando termina la \n // animación, para evitar que aparezca el scrollbar y empuje el \n // modal antes de que desaparezca. \n if (previouslyFocused && typeof previouslyFocused.focus === 'function') { \n previouslyFocused.focus(); \n } \n previouslyFocused = null; \n emit('afterLeave'); \n } \n }, \n); \n \nonBeforeUnmount(() => { \n activeTimeline?.kill(); \n releaseScrollLock(); \n}); \n \n/* ---------- Style maps ---------- */ \nconst sizeClasses = computed(() => { \n switch (props.size) { \n case 'small': return 'max-w-sm'; \n case 'large': return 'max-w-2xl'; \n case 'xlarge': return 'max-w-4xl'; \n case 'full': return 'max-w-none w-[calc(100vw-2rem)] h-[calc(100vh-2rem)]'; \n default: return 'max-w-md'; \n } \n}); \n \nconst radiusClasses = computed(() => { \n if (props.size === 'full') return 'rounded-xl'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-md'; \n case 'large': return 'rounded-2xl'; \n case 'full': return 'rounded-3xl'; \n default: return 'rounded-xl'; \n } \n}); \n \nconst innerBorderRadiusClass = computed(() => { \n if (props.size === 'full') return 'rounded-lg'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-[calc(1.5rem-4px)]'; \n default: return 'rounded-lg'; \n } \n}); \n \nconst positionClasses = computed(() => { \n if (props.position === 'top') return 'items-start justify-center p-4 sm:p-6 pt-[10vh]'; \n return 'items-center justify-center p-4 sm:p-6'; \n}); \n \nconst 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":"Modal.cjs","names":[],"sources":["../../../src/components/feedback/Modal.vue"],"sourcesContent":["<template> \n <Teleport to=\"body\"> \n <Transition :css=\"false\" @enter=\"onOverlayEnter\" @leave=\"onOverlayLeave\" appear> \n <div \n v-if=\"modelValue\" \n ref=\"overlayRef\" \n :class=\"[ \n 'modo-modal-overlay fixed inset-0 z-1200 flex opacity-0', \n positionClasses, \n 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-modal-panel \n role=\"dialog\" \n aria-modal=\"true\" \n :aria-labelledby=\"title ? titleId : undefined\" \n :aria-describedby=\"description ? descriptionId : undefined\" \n :aria-label=\"!title ? ariaLabel : undefined\" \n :class=\"[ \n 'modo-modal relative flex flex-col w-full bg-card text-foreground', \n 'dark:bg-card/85 dark:backdrop-blur-xl', \n 'border border-border shadow-xl', \n sizeClasses, \n radiusClasses, \n ]\" \n tabindex=\"-1\" \n @click.stop \n @keydown=\"onPanelKeydown\" \n > \n <!-- Inner border layer --> \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n :class=\"[ \n 'pointer-events-none absolute inset-1 border border-border/40', \n innerBorderRadiusClass, \n ]\" \n /> \n \n <!-- Close button (usa nuestro Button en modo icono) --> \n <div v-if=\"showClose\" class=\"absolute top-3 right-3 z-10\"> \n <Button \n variant=\"text\" \n size=\"small\" \n :color=\"resolvedColor\" \n :icon=\"XMarkIcon\" \n ariaLabel=\"Close\" \n @click=\"close\" \n /> \n </div> \n \n <!-- Content wrapper (animado en etapa 2) --> \n <div ref=\"contentRef\" data-modo-modal-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 (divider respeta inner border con inset) --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-6 py-4\" \n > \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-1 right-1 h-px bg-border/40\" \n /> \n <span \n v-else \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-0 right-0 h-px bg-border\" \n /> \n <slot name=\"footer\" :close=\"close\" /> \n </footer> \n </div> \n </div> \n </div> \n </Transition> \n </Teleport> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Button from '../forms/Button.vue'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Modal } from '../../interfaces/feedback/Modal.interface'; \nimport { \n useResolvedColor, \n useResolvedRadius, \n useResolvedTheme, \n useModoConfig, \n} from '../../composables/useModoConfig'; \nimport { resolveColorMode } from '../../composables/useColorMode';\nimport { lockBodyScroll, unlockBodyScroll } from '../../composables/useBodyScrollLock';\nimport { palettesToCssVars, semanticTokensFromPalettes } from '../../config/palettes';\nimport { hexToOklchString, pickForegroundOklch } from '../../config/colorPrimitives';\nimport { surfacesToCssVars } from '../../config/surfaces'; \nimport type { ModoColor, ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Modal>(), { \n modelValue: false, \n size: 'medium', \n position: 'center', \n closeOnOverlay: true, \n closeOnEscape: true, \n showClose: true, \n lockScroll: true, \n color: 'default', \n overlay: 'blur', \n innerBorder: true, \n disableOriginAnimation: false, \n}); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [value: boolean]; \n open: []; \n close: []; \n afterLeave: []; \n}>(); \n \nconst autoId = useId(); \nconst titleId = computed(() => `modo-modal-${autoId}-title`); \nconst descriptionId = computed(() => `modo-modal-${autoId}-desc`); \n \nconst overlayRef = ref<HTMLElement | null>(null); \nconst panelRef = ref<HTMLElement | null>(null); \nconst contentRef = ref<HTMLElement | null>(null); \n \nconst resolvedColor = useResolvedColor(() => props.color as ModoColor | undefined); \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \nconst cfg = useModoConfig(); \nconst theme = useResolvedTheme(); \nconst scopedTheme = computed(() => resolveColorMode(theme.value)); \n \nconst overlayStyle = computed(() => { \n const providerVars = cfg?.value.palettes \n ? { \n ...palettesToCssVars(cfg.value.palettes), \n ...semanticTokensFromPalettes(cfg.value.palettes, hexToOklchString, pickForegroundOklch), \n } \n : {};\n const surfaceVars = cfg?.value.surfaces\n ? surfacesToCssVars(cfg.value.surfaces)\n : {};\n const darkSurfaceVars = (scopedTheme.value === 'dark' && cfg?.value.darkSurfaces)\n ? surfacesToCssVars(cfg.value.darkSurfaces)\n : {};\n return { ...providerVars, ...surfaceVars, ...darkSurfaceVars };\n}); \n \nfunction close() { \n if (!props.modelValue) return; \n emit('update:modelValue', false); \n emit('close'); \n} \n \n/* ---------- Click outside ---------- */ \nlet mouseDownOnOverlay = false; \nfunction onOverlayMouseDown(e: MouseEvent) { \n mouseDownOnOverlay = e.target === overlayRef.value; \n} \nfunction onOverlayClick(e: MouseEvent) { \n if (!props.closeOnOverlay) return; \n if (e.target !== overlayRef.value) return; \n if (!mouseDownOnOverlay) return; \n close(); \n} \n \n/* ---------- Keydown (Escape + focus trap) ---------- */ \nfunction onPanelKeydown(e: KeyboardEvent) { \n if (props.closeOnEscape && e.key === 'Escape') { \n e.preventDefault(); \n close(); \n return; \n } \n if (e.key === 'Tab' && panelRef.value) { \n const focusables = getFocusable(panelRef.value); \n if (focusables.length === 0) { \n e.preventDefault(); \n return; \n } \n const first = focusables[0]; \n const last = focusables[focusables.length - 1]; \n const active = document.activeElement as HTMLElement | null; \n if (e.shiftKey && active === first) { \n e.preventDefault(); \n last.focus(); \n } else if (!e.shiftKey && active === last) { \n e.preventDefault(); \n first.focus(); \n } \n } \n} \n \nconst FOCUSABLE_SELECTOR = \n 'a[href], area[href], input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]'; \n \nfunction getFocusable(container: HTMLElement): HTMLElement[] { \n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)) \n .filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null); \n} \n \n/* ---------- Animations (staged open/close) ---------- */ \n \nfunction prefersReducedMotion() { \n return typeof window !== 'undefined' \n && window.matchMedia('(prefers-reduced-motion: reduce)').matches; \n} \n \nlet capturedOrigin: HTMLElement | null = null; \nfunction getOriginEl(): HTMLElement | null { \n if (props.origin) return props.origin; \n return capturedOrigin; \n} \n \nlet activeTimeline: gsap.core.Timeline | null = null; \n \nfunction onOverlayEnter(el: Element, done: () => void) { \n const overlay = (el as HTMLElement) ?? overlayRef.value; \n const panel = \n overlay?.querySelector<HTMLElement>('[data-modo-modal-panel]') \n ?? panelRef.value; \n const content = \n overlay?.querySelector<HTMLElement>('[data-modo-modal-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 origin = !props.disableOriginAnimation ? getOriginEl() : null; \n const pRect = panel.getBoundingClientRect(); \n \n const tl = gsap.timeline({ onComplete: () => { activeTimeline = null; done(); } }); \n activeTimeline = tl; \n \n // 1. Overlay fade in \n tl.fromTo(overlay, { opacity: 0 }, { opacity: 1, duration: 0.25, ease: 'power2.out' }, 0); \n \n // 2. Panel emerge from trigger (small) → grows to full size \n if (origin && document.body.contains(origin)) { \n const oRect = origin.getBoundingClientRect(); \n const dx = oRect.left + oRect.width / 2 - (pRect.left + pRect.width / 2); \n const dy = oRect.top + oRect.height / 2 - (pRect.top + pRect.height / 2); \n const scaleX = Math.max(oRect.width / pRect.width, 0.05); \n const scaleY = Math.max(oRect.height / pRect.height, 0.05); \n tl.fromTo( \n panel, \n { x: dx, y: dy, scaleX, scaleY, opacity: 0.85, transformOrigin: 'center center' }, \n { x: 0, y: 0, scaleX: 1, scaleY: 1, opacity: 1, duration: 0.5, ease: 'power3.out' }, \n 0.05, \n ); \n } else { \n tl.fromTo( \n panel, \n { y: 16, scale: 0.95, opacity: 0 }, \n { y: 0, scale: 1, opacity: 1, duration: 0.35, ease: 'power2.out' }, \n 0, \n ); \n } \n \n // 3. Contenido fade in una vez el panel tiene tamaño real \n tl.fromTo( \n content, \n { opacity: 0, y: 8 }, \n { opacity: 1, y: 0, duration: 0.28, ease: 'power2.out' }, \n 0.38, \n ); \n} \n \nfunction onOverlayLeave(el: Element, done: () => void) { \n // Durante el leave, los template refs de Vue ya fueron desvinculados, \n // así que resolvemos los nodos desde el elemento que Transition nos entrega. \n const overlay = el as HTMLElement; \n const panel = \n overlay.querySelector<HTMLElement>('[data-modo-modal-panel]') \n ?? panelRef.value; \n const content =\n overlay.querySelector<HTMLElement>('[data-modo-modal-content]')\n ?? contentRef.value;\n // Bail out without animating, but never without releasing the lock — this\n // path is the one that used to strand `overflow: hidden` on <body>.\n if (!overlay || !panel || !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 origin = !props.disableOriginAnimation ? getOriginEl() : null; \n const pRect = panel.getBoundingClientRect(); \n \n const tl = gsap.timeline({ \n onComplete: () => { \n activeTimeline = null; \n releaseScrollLock(); \n done(); \n }, \n }); \n activeTimeline = tl; \n \n // 1. Contenido desaparece (solo opacidad, sin movimiento) \n tl.to(content, { opacity: 0, duration: 0.18, ease: 'power1.in' }, 0); \n \n // 2. Panel se encoge hacia el trigger (inmediatamente despues de que \n // el contenido ya es invisible, no solapado con el fade). \n if (origin && document.body.contains(origin)) { \n const oRect = origin.getBoundingClientRect(); \n const dx = oRect.left + oRect.width / 2 - (pRect.left + pRect.width / 2); \n const dy = oRect.top + oRect.height / 2 - (pRect.top + pRect.height / 2); \n const scaleX = Math.max(oRect.width / pRect.width, 0.05); \n const scaleY = Math.max(oRect.height / pRect.height, 0.05); \n tl.to( \n panel, \n { x: dx, y: dy, scaleX, scaleY, opacity: 0, duration: 0.38, ease: 'power3.in' }, \n 0.18, \n ); \n } else { \n tl.to( \n panel, \n { y: 10, scale: 0.95, opacity: 0, duration: 0.24, ease: 'power2.in' }, \n 0.18, \n ); \n } \n \n // 3. Overlay fade out junto al panel \n tl.to(overlay, { opacity: 0, duration: 0.28, ease: 'power2.in' }, 0.22); \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 capturedOrigin = active && active !== document.body ? active : null; \n \n if (props.lockScroll && !scrollLocked) {\n scrollLocked = true;\n lockBodyScroll();\n }\n emit('open'); \n nextTick(() => { \n if (!panelRef.value) return; \n const focusables = getFocusable(panelRef.value); \n (focusables[0] ?? panelRef.value).focus(); \n }); \n } else { \n // El scroll lock se libera en onOverlayLeave cuando termina la \n // animación, para evitar que aparezca el scrollbar y empuje el \n // modal antes de que desaparezca. \n if (previouslyFocused && typeof previouslyFocused.focus === 'function') { \n previouslyFocused.focus(); \n } \n previouslyFocused = null; \n emit('afterLeave'); \n } \n }, \n); \n \nonBeforeUnmount(() => { \n activeTimeline?.kill(); \n releaseScrollLock(); \n}); \n \n/* ---------- Style maps ---------- */ \nconst sizeClasses = computed(() => { \n switch (props.size) { \n case 'small': return 'max-w-sm'; \n case 'large': return 'max-w-2xl'; \n case 'xlarge': return 'max-w-4xl'; \n case 'full': return 'max-w-none w-[calc(100vw-2rem)] h-[calc(100vh-2rem)]'; \n default: return 'max-w-md'; \n } \n}); \n \nconst radiusClasses = computed(() => { \n if (props.size === 'full') return 'rounded-xl'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-md'; \n case 'large': return 'rounded-2xl'; \n case 'full': return 'rounded-3xl'; \n default: return 'rounded-xl'; \n } \n}); \n \nconst innerBorderRadiusClass = computed(() => { \n if (props.size === 'full') return 'rounded-lg'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-[calc(1.5rem-4px)]'; \n default: return 'rounded-lg'; \n } \n}); \n \nconst positionClasses = computed(() => { \n if (props.position === 'top') return 'items-start justify-center p-4 sm:p-6 pt-[10vh]'; \n return 'items-center justify-center p-4 sm:p-6'; \n}); \n \nconst 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":"Modal.mjs","names":[],"sources":["../../../src/components/feedback/Modal.vue"],"sourcesContent":["<template> \n <Teleport to=\"body\"> \n <Transition :css=\"false\" @enter=\"onOverlayEnter\" @leave=\"onOverlayLeave\" appear> \n <div \n v-if=\"modelValue\" \n ref=\"overlayRef\" \n :class=\"[ \n 'modo-modal-overlay fixed inset-0 z-1200 flex opacity-0', \n positionClasses, \n 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-modal-panel \n role=\"dialog\" \n aria-modal=\"true\" \n :aria-labelledby=\"title ? titleId : undefined\" \n :aria-describedby=\"description ? descriptionId : undefined\" \n :aria-label=\"!title ? ariaLabel : undefined\" \n :class=\"[ \n 'modo-modal relative flex flex-col w-full bg-card text-foreground', \n 'dark:bg-card/85 dark:backdrop-blur-xl', \n 'border border-border shadow-xl', \n sizeClasses, \n radiusClasses, \n ]\" \n tabindex=\"-1\" \n @click.stop \n @keydown=\"onPanelKeydown\" \n > \n <!-- Inner border layer --> \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n :class=\"[ \n 'pointer-events-none absolute inset-1 border border-border/40', \n innerBorderRadiusClass, \n ]\" \n /> \n \n <!-- Close button (usa nuestro Button en modo icono) --> \n <div v-if=\"showClose\" class=\"absolute top-3 right-3 z-10\"> \n <Button \n variant=\"text\" \n size=\"small\" \n :color=\"resolvedColor\" \n :icon=\"XMarkIcon\" \n ariaLabel=\"Close\" \n @click=\"close\" \n /> \n </div> \n \n <!-- Content wrapper (animado en etapa 2) --> \n <div ref=\"contentRef\" data-modo-modal-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 (divider respeta inner border con inset) --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-6 py-4\" \n > \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-1 right-1 h-px bg-border/40\" \n /> \n <span \n v-else \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-0 right-0 h-px bg-border\" \n /> \n <slot name=\"footer\" :close=\"close\" /> \n </footer> \n </div> \n </div> \n </div> \n </Transition> \n </Teleport> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Button from '../forms/Button.vue'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Modal } from '../../interfaces/feedback/Modal.interface'; \nimport { \n useResolvedColor, \n useResolvedRadius, \n useResolvedTheme, \n useModoConfig, \n} from '../../composables/useModoConfig'; \nimport { resolveColorMode } from '../../composables/useColorMode'; \nimport { palettesToCssVars, semanticTokensFromPalettes } from '../../config/palettes'; \nimport { hexToOklchString, pickForegroundOklch } from '../../config/colorPrimitives'; \nimport { surfacesToCssVars } from '../../config/surfaces'; \nimport type { ModoColor, ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Modal>(), { \n modelValue: false, \n size: 'medium', \n position: 'center', \n closeOnOverlay: true, \n closeOnEscape: true, \n showClose: true, \n lockScroll: true, \n color: 'default', \n overlay: 'blur', \n innerBorder: true, \n disableOriginAnimation: false, \n}); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [value: boolean]; \n open: []; \n close: []; \n afterLeave: []; \n}>(); \n \nconst autoId = useId(); \nconst titleId = computed(() => `modo-modal-${autoId}-title`); \nconst descriptionId = computed(() => `modo-modal-${autoId}-desc`); \n \nconst overlayRef = ref<HTMLElement | null>(null); \nconst panelRef = ref<HTMLElement | null>(null); \nconst contentRef = ref<HTMLElement | null>(null); \n \nconst resolvedColor = useResolvedColor(() => props.color as ModoColor | undefined); \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \nconst cfg = useModoConfig(); \nconst theme = useResolvedTheme(); \nconst scopedTheme = computed(() => resolveColorMode(theme.value)); \n \nconst overlayStyle = computed(() => { \n const providerVars = cfg?.value.palettes \n ? { \n ...palettesToCssVars(cfg.value.palettes), \n ...semanticTokensFromPalettes(cfg.value.palettes, hexToOklchString, pickForegroundOklch), \n } \n : {};\n const surfaceVars = cfg?.value.surfaces\n ? surfacesToCssVars(cfg.value.surfaces)\n : {};\n const darkSurfaceVars = (scopedTheme.value === 'dark' && cfg?.value.darkSurfaces)\n ? surfacesToCssVars(cfg.value.darkSurfaces)\n : {};\n return { ...providerVars, ...surfaceVars, ...darkSurfaceVars };\n}); \n \nfunction close() { \n if (!props.modelValue) return; \n emit('update:modelValue', false); \n emit('close'); \n} \n \n/* ---------- Click outside ---------- */ \nlet mouseDownOnOverlay = false; \nfunction onOverlayMouseDown(e: MouseEvent) { \n mouseDownOnOverlay = e.target === overlayRef.value; \n} \nfunction onOverlayClick(e: MouseEvent) { \n if (!props.closeOnOverlay) return; \n if (e.target !== overlayRef.value) return; \n if (!mouseDownOnOverlay) return; \n close(); \n} \n \n/* ---------- Keydown (Escape + focus trap) ---------- */ \nfunction onPanelKeydown(e: KeyboardEvent) { \n if (props.closeOnEscape && e.key === 'Escape') { \n e.preventDefault(); \n close(); \n return; \n } \n if (e.key === 'Tab' && panelRef.value) { \n const focusables = getFocusable(panelRef.value); \n if (focusables.length === 0) { \n e.preventDefault(); \n return; \n } \n const first = focusables[0]; \n const last = focusables[focusables.length - 1]; \n const active = document.activeElement as HTMLElement | null; \n if (e.shiftKey && active === first) { \n e.preventDefault(); \n last.focus(); \n } else if (!e.shiftKey && active === last) { \n e.preventDefault(); \n first.focus(); \n } \n } \n} \n \nconst FOCUSABLE_SELECTOR = \n 'a[href], area[href], input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]'; \n \nfunction getFocusable(container: HTMLElement): HTMLElement[] { \n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)) \n .filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null); \n} \n \n/* ---------- Animations (staged open/close) ---------- */ \n \nfunction prefersReducedMotion() { \n return typeof window !== 'undefined' \n && window.matchMedia('(prefers-reduced-motion: reduce)').matches; \n} \n \nlet capturedOrigin: HTMLElement | null = null; \nfunction getOriginEl(): HTMLElement | null { \n if (props.origin) return props.origin; \n return capturedOrigin; \n} \n \nlet activeTimeline: gsap.core.Timeline | null = null; \n \nfunction onOverlayEnter(el: Element, done: () => void) { \n const overlay = (el as HTMLElement) ?? overlayRef.value; \n const panel = \n overlay?.querySelector<HTMLElement>('[data-modo-modal-panel]') \n ?? panelRef.value; \n const content = \n overlay?.querySelector<HTMLElement>('[data-modo-modal-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 origin = !props.disableOriginAnimation ? getOriginEl() : null; \n const pRect = panel.getBoundingClientRect(); \n \n const tl = gsap.timeline({ onComplete: () => { activeTimeline = null; done(); } }); \n activeTimeline = tl; \n \n // 1. Overlay fade in \n tl.fromTo(overlay, { opacity: 0 }, { opacity: 1, duration: 0.25, ease: 'power2.out' }, 0); \n \n // 2. Panel emerge from trigger (small) → grows to full size \n if (origin && document.body.contains(origin)) { \n const oRect = origin.getBoundingClientRect(); \n const dx = oRect.left + oRect.width / 2 - (pRect.left + pRect.width / 2); \n const dy = oRect.top + oRect.height / 2 - (pRect.top + pRect.height / 2); \n const scaleX = Math.max(oRect.width / pRect.width, 0.05); \n const scaleY = Math.max(oRect.height / pRect.height, 0.05); \n tl.fromTo( \n panel, \n { x: dx, y: dy, scaleX, scaleY, opacity: 0.85, transformOrigin: 'center center' }, \n { x: 0, y: 0, scaleX: 1, scaleY: 1, opacity: 1, duration: 0.5, ease: 'power3.out' }, \n 0.05, \n ); \n } else { \n tl.fromTo( \n panel, \n { y: 16, scale: 0.95, opacity: 0 }, \n { y: 0, scale: 1, opacity: 1, duration: 0.35, ease: 'power2.out' }, \n 0, \n ); \n } \n \n // 3. Contenido fade in una vez el panel tiene tamaño real \n tl.fromTo( \n content, \n { opacity: 0, y: 8 }, \n { opacity: 1, y: 0, duration: 0.28, ease: 'power2.out' }, \n 0.38, \n ); \n} \n \nfunction onOverlayLeave(el: Element, done: () => void) { \n // Durante el leave, los template refs de Vue ya fueron desvinculados, \n // así que resolvemos los nodos desde el elemento que Transition nos entrega. \n const overlay = el as HTMLElement; \n const panel = \n overlay.querySelector<HTMLElement>('[data-modo-modal-panel]') \n ?? panelRef.value; \n const content = \n overlay.querySelector<HTMLElement>('[data-modo-modal-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 origin = !props.disableOriginAnimation ? getOriginEl() : null; \n const pRect = panel.getBoundingClientRect(); \n \n const tl = gsap.timeline({ \n onComplete: () => { \n activeTimeline = null; \n releaseScrollLock(); \n done(); \n }, \n }); \n activeTimeline = tl; \n \n // 1. Contenido desaparece (solo opacidad, sin movimiento) \n tl.to(content, { opacity: 0, duration: 0.18, ease: 'power1.in' }, 0); \n \n // 2. Panel se encoge hacia el trigger (inmediatamente despues de que \n // el contenido ya es invisible, no solapado con el fade). \n if (origin && document.body.contains(origin)) { \n const oRect = origin.getBoundingClientRect(); \n const dx = oRect.left + oRect.width / 2 - (pRect.left + pRect.width / 2); \n const dy = oRect.top + oRect.height / 2 - (pRect.top + pRect.height / 2); \n const scaleX = Math.max(oRect.width / pRect.width, 0.05); \n const scaleY = Math.max(oRect.height / pRect.height, 0.05); \n tl.to( \n panel, \n { x: dx, y: dy, scaleX, scaleY, opacity: 0, duration: 0.38, ease: 'power3.in' }, \n 0.18, \n ); \n } else { \n tl.to( \n panel, \n { y: 10, scale: 0.95, opacity: 0, duration: 0.24, ease: 'power2.in' }, \n 0.18, \n ); \n } \n \n // 3. Overlay fade out junto al panel \n tl.to(overlay, { opacity: 0, duration: 0.28, ease: 'power2.in' }, 0.22); \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 capturedOrigin = active && active !== document.body ? active : null; \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 // El scroll lock se libera en onOverlayLeave cuando termina la \n // animación, para evitar que aparezca el scrollbar y empuje el \n // modal antes de que desaparezca. \n if (previouslyFocused && typeof previouslyFocused.focus === 'function') { \n previouslyFocused.focus(); \n } \n previouslyFocused = null; \n emit('afterLeave'); \n } \n }, \n); \n \nonBeforeUnmount(() => { \n activeTimeline?.kill(); \n releaseScrollLock(); \n}); \n \n/* ---------- Style maps ---------- */ \nconst sizeClasses = computed(() => { \n switch (props.size) { \n case 'small': return 'max-w-sm'; \n case 'large': return 'max-w-2xl'; \n case 'xlarge': return 'max-w-4xl'; \n case 'full': return 'max-w-none w-[calc(100vw-2rem)] h-[calc(100vh-2rem)]'; \n default: return 'max-w-md'; \n } \n}); \n \nconst radiusClasses = computed(() => { \n if (props.size === 'full') return 'rounded-xl'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-md'; \n case 'large': return 'rounded-2xl'; \n case 'full': return 'rounded-3xl'; \n default: return 'rounded-xl'; \n } \n}); \n \nconst innerBorderRadiusClass = computed(() => { \n if (props.size === 'full') return 'rounded-lg'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-[calc(1.5rem-4px)]'; \n default: return 'rounded-lg'; \n } \n}); \n \nconst positionClasses = computed(() => { \n if (props.position === 'top') return 'items-start justify-center p-4 sm:p-6 pt-[10vh]'; \n return 'items-center justify-center p-4 sm:p-6'; \n}); \n \nconst 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":"Modal.mjs","names":[],"sources":["../../../src/components/feedback/Modal.vue"],"sourcesContent":["<template> \n <Teleport to=\"body\"> \n <Transition :css=\"false\" @enter=\"onOverlayEnter\" @leave=\"onOverlayLeave\" appear> \n <div \n v-if=\"modelValue\" \n ref=\"overlayRef\" \n :class=\"[ \n 'modo-modal-overlay fixed inset-0 z-1200 flex opacity-0', \n positionClasses, \n 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-modal-panel \n role=\"dialog\" \n aria-modal=\"true\" \n :aria-labelledby=\"title ? titleId : undefined\" \n :aria-describedby=\"description ? descriptionId : undefined\" \n :aria-label=\"!title ? ariaLabel : undefined\" \n :class=\"[ \n 'modo-modal relative flex flex-col w-full bg-card text-foreground', \n 'dark:bg-card/85 dark:backdrop-blur-xl', \n 'border border-border shadow-xl', \n sizeClasses, \n radiusClasses, \n ]\" \n tabindex=\"-1\" \n @click.stop \n @keydown=\"onPanelKeydown\" \n > \n <!-- Inner border layer --> \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n :class=\"[ \n 'pointer-events-none absolute inset-1 border border-border/40', \n innerBorderRadiusClass, \n ]\" \n /> \n \n <!-- Close button (usa nuestro Button en modo icono) --> \n <div v-if=\"showClose\" class=\"absolute top-3 right-3 z-10\"> \n <Button \n variant=\"text\" \n size=\"small\" \n :color=\"resolvedColor\" \n :icon=\"XMarkIcon\" \n ariaLabel=\"Close\" \n @click=\"close\" \n /> \n </div> \n \n <!-- Content wrapper (animado en etapa 2) --> \n <div ref=\"contentRef\" data-modo-modal-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 (divider respeta inner border con inset) --> \n <footer \n v-if=\"$slots.footer\" \n class=\"relative flex items-center justify-end gap-2 px-6 py-4\" \n > \n <span \n v-if=\"innerBorder\" \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-1 right-1 h-px bg-border/40\" \n /> \n <span \n v-else \n aria-hidden=\"true\" \n class=\"pointer-events-none absolute top-0 left-0 right-0 h-px bg-border\" \n /> \n <slot name=\"footer\" :close=\"close\" /> \n </footer> \n </div> \n </div> \n </div> \n </Transition> \n </Teleport> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'; \nimport { gsap } from 'gsap'; \nimport { XMarkIcon } from '@heroicons/vue/24/outline'; \nimport Button from '../forms/Button.vue'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { Modal } from '../../interfaces/feedback/Modal.interface'; \nimport { \n useResolvedColor, \n useResolvedRadius, \n useResolvedTheme, \n useModoConfig, \n} from '../../composables/useModoConfig'; \nimport { resolveColorMode } from '../../composables/useColorMode';\nimport { lockBodyScroll, unlockBodyScroll } from '../../composables/useBodyScrollLock';\nimport { palettesToCssVars, semanticTokensFromPalettes } from '../../config/palettes';\nimport { hexToOklchString, pickForegroundOklch } from '../../config/colorPrimitives';\nimport { surfacesToCssVars } from '../../config/surfaces'; \nimport type { ModoColor, ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<Modal>(), { \n modelValue: false, \n size: 'medium', \n position: 'center', \n closeOnOverlay: true, \n closeOnEscape: true, \n showClose: true, \n lockScroll: true, \n color: 'default', \n overlay: 'blur', \n innerBorder: true, \n disableOriginAnimation: false, \n}); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [value: boolean]; \n open: []; \n close: []; \n afterLeave: []; \n}>(); \n \nconst autoId = useId(); \nconst titleId = computed(() => `modo-modal-${autoId}-title`); \nconst descriptionId = computed(() => `modo-modal-${autoId}-desc`); \n \nconst overlayRef = ref<HTMLElement | null>(null); \nconst panelRef = ref<HTMLElement | null>(null); \nconst contentRef = ref<HTMLElement | null>(null); \n \nconst resolvedColor = useResolvedColor(() => props.color as ModoColor | undefined); \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \nconst cfg = useModoConfig(); \nconst theme = useResolvedTheme(); \nconst scopedTheme = computed(() => resolveColorMode(theme.value)); \n \nconst overlayStyle = computed(() => { \n const providerVars = cfg?.value.palettes \n ? { \n ...palettesToCssVars(cfg.value.palettes), \n ...semanticTokensFromPalettes(cfg.value.palettes, hexToOklchString, pickForegroundOklch), \n } \n : {};\n const surfaceVars = cfg?.value.surfaces\n ? surfacesToCssVars(cfg.value.surfaces)\n : {};\n const darkSurfaceVars = (scopedTheme.value === 'dark' && cfg?.value.darkSurfaces)\n ? surfacesToCssVars(cfg.value.darkSurfaces)\n : {};\n return { ...providerVars, ...surfaceVars, ...darkSurfaceVars };\n}); \n \nfunction close() { \n if (!props.modelValue) return; \n emit('update:modelValue', false); \n emit('close'); \n} \n \n/* ---------- Click outside ---------- */ \nlet mouseDownOnOverlay = false; \nfunction onOverlayMouseDown(e: MouseEvent) { \n mouseDownOnOverlay = e.target === overlayRef.value; \n} \nfunction onOverlayClick(e: MouseEvent) { \n if (!props.closeOnOverlay) return; \n if (e.target !== overlayRef.value) return; \n if (!mouseDownOnOverlay) return; \n close(); \n} \n \n/* ---------- Keydown (Escape + focus trap) ---------- */ \nfunction onPanelKeydown(e: KeyboardEvent) { \n if (props.closeOnEscape && e.key === 'Escape') { \n e.preventDefault(); \n close(); \n return; \n } \n if (e.key === 'Tab' && panelRef.value) { \n const focusables = getFocusable(panelRef.value); \n if (focusables.length === 0) { \n e.preventDefault(); \n return; \n } \n const first = focusables[0]; \n const last = focusables[focusables.length - 1]; \n const active = document.activeElement as HTMLElement | null; \n if (e.shiftKey && active === first) { \n e.preventDefault(); \n last.focus(); \n } else if (!e.shiftKey && active === last) { \n e.preventDefault(); \n first.focus(); \n } \n } \n} \n \nconst FOCUSABLE_SELECTOR = \n 'a[href], area[href], input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]'; \n \nfunction getFocusable(container: HTMLElement): HTMLElement[] { \n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)) \n .filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null); \n} \n \n/* ---------- Animations (staged open/close) ---------- */ \n \nfunction prefersReducedMotion() { \n return typeof window !== 'undefined' \n && window.matchMedia('(prefers-reduced-motion: reduce)').matches; \n} \n \nlet capturedOrigin: HTMLElement | null = null; \nfunction getOriginEl(): HTMLElement | null { \n if (props.origin) return props.origin; \n return capturedOrigin; \n} \n \nlet activeTimeline: gsap.core.Timeline | null = null; \n \nfunction onOverlayEnter(el: Element, done: () => void) { \n const overlay = (el as HTMLElement) ?? overlayRef.value; \n const panel = \n overlay?.querySelector<HTMLElement>('[data-modo-modal-panel]') \n ?? panelRef.value; \n const content = \n overlay?.querySelector<HTMLElement>('[data-modo-modal-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 origin = !props.disableOriginAnimation ? getOriginEl() : null; \n const pRect = panel.getBoundingClientRect(); \n \n const tl = gsap.timeline({ onComplete: () => { activeTimeline = null; done(); } }); \n activeTimeline = tl; \n \n // 1. Overlay fade in \n tl.fromTo(overlay, { opacity: 0 }, { opacity: 1, duration: 0.25, ease: 'power2.out' }, 0); \n \n // 2. Panel emerge from trigger (small) → grows to full size \n if (origin && document.body.contains(origin)) { \n const oRect = origin.getBoundingClientRect(); \n const dx = oRect.left + oRect.width / 2 - (pRect.left + pRect.width / 2); \n const dy = oRect.top + oRect.height / 2 - (pRect.top + pRect.height / 2); \n const scaleX = Math.max(oRect.width / pRect.width, 0.05); \n const scaleY = Math.max(oRect.height / pRect.height, 0.05); \n tl.fromTo( \n panel, \n { x: dx, y: dy, scaleX, scaleY, opacity: 0.85, transformOrigin: 'center center' }, \n { x: 0, y: 0, scaleX: 1, scaleY: 1, opacity: 1, duration: 0.5, ease: 'power3.out' }, \n 0.05, \n ); \n } else { \n tl.fromTo( \n panel, \n { y: 16, scale: 0.95, opacity: 0 }, \n { y: 0, scale: 1, opacity: 1, duration: 0.35, ease: 'power2.out' }, \n 0, \n ); \n } \n \n // 3. Contenido fade in una vez el panel tiene tamaño real \n tl.fromTo( \n content, \n { opacity: 0, y: 8 }, \n { opacity: 1, y: 0, duration: 0.28, ease: 'power2.out' }, \n 0.38, \n ); \n} \n \nfunction onOverlayLeave(el: Element, done: () => void) { \n // Durante el leave, los template refs de Vue ya fueron desvinculados, \n // así que resolvemos los nodos desde el elemento que Transition nos entrega. \n const overlay = el as HTMLElement; \n const panel = \n overlay.querySelector<HTMLElement>('[data-modo-modal-panel]') \n ?? panelRef.value; \n const content =\n overlay.querySelector<HTMLElement>('[data-modo-modal-content]')\n ?? contentRef.value;\n // Bail out without animating, but never without releasing the lock — this\n // path is the one that used to strand `overflow: hidden` on <body>.\n if (!overlay || !panel || !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 origin = !props.disableOriginAnimation ? getOriginEl() : null; \n const pRect = panel.getBoundingClientRect(); \n \n const tl = gsap.timeline({ \n onComplete: () => { \n activeTimeline = null; \n releaseScrollLock(); \n done(); \n }, \n }); \n activeTimeline = tl; \n \n // 1. Contenido desaparece (solo opacidad, sin movimiento) \n tl.to(content, { opacity: 0, duration: 0.18, ease: 'power1.in' }, 0); \n \n // 2. Panel se encoge hacia el trigger (inmediatamente despues de que \n // el contenido ya es invisible, no solapado con el fade). \n if (origin && document.body.contains(origin)) { \n const oRect = origin.getBoundingClientRect(); \n const dx = oRect.left + oRect.width / 2 - (pRect.left + pRect.width / 2); \n const dy = oRect.top + oRect.height / 2 - (pRect.top + pRect.height / 2); \n const scaleX = Math.max(oRect.width / pRect.width, 0.05); \n const scaleY = Math.max(oRect.height / pRect.height, 0.05); \n tl.to( \n panel, \n { x: dx, y: dy, scaleX, scaleY, opacity: 0, duration: 0.38, ease: 'power3.in' }, \n 0.18, \n ); \n } else { \n tl.to( \n panel, \n { y: 10, scale: 0.95, opacity: 0, duration: 0.24, ease: 'power2.in' }, \n 0.18, \n ); \n } \n \n // 3. Overlay fade out junto al panel \n tl.to(overlay, { opacity: 0, duration: 0.28, ease: 'power2.in' }, 0.22); \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 capturedOrigin = active && active !== document.body ? active : null; \n \n if (props.lockScroll && !scrollLocked) {\n scrollLocked = true;\n lockBodyScroll();\n }\n emit('open'); \n nextTick(() => { \n if (!panelRef.value) return; \n const focusables = getFocusable(panelRef.value); \n (focusables[0] ?? panelRef.value).focus(); \n }); \n } else { \n // El scroll lock se libera en onOverlayLeave cuando termina la \n // animación, para evitar que aparezca el scrollbar y empuje el \n // modal antes de que desaparezca. \n if (previouslyFocused && typeof previouslyFocused.focus === 'function') { \n previouslyFocused.focus(); \n } \n previouslyFocused = null; \n emit('afterLeave'); \n } \n }, \n); \n \nonBeforeUnmount(() => { \n activeTimeline?.kill(); \n releaseScrollLock(); \n}); \n \n/* ---------- Style maps ---------- */ \nconst sizeClasses = computed(() => { \n switch (props.size) { \n case 'small': return 'max-w-sm'; \n case 'large': return 'max-w-2xl'; \n case 'xlarge': return 'max-w-4xl'; \n case 'full': return 'max-w-none w-[calc(100vw-2rem)] h-[calc(100vh-2rem)]'; \n default: return 'max-w-md'; \n } \n}); \n \nconst radiusClasses = computed(() => { \n if (props.size === 'full') return 'rounded-xl'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-md'; \n case 'large': return 'rounded-2xl'; \n case 'full': return 'rounded-3xl'; \n default: return 'rounded-xl'; \n } \n}); \n \nconst innerBorderRadiusClass = computed(() => { \n if (props.size === 'full') return 'rounded-lg'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-[calc(1.5rem-4px)]'; \n default: return 'rounded-lg'; \n } \n}); \n \nconst positionClasses = computed(() => { \n if (props.position === 'top') return 'items-start justify-center p-4 sm:p-6 pt-[10vh]'; \n return 'items-center justify-center p-4 sm:p-6'; \n}); \n \nconst 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");
|
|
@@ -242,6 +243,7 @@ var Modal_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.
|
|
|
242
243
|
const panel = overlay.querySelector("[data-modo-modal-panel]") ?? panelRef.value;
|
|
243
244
|
const content = overlay.querySelector("[data-modo-modal-content]") ?? contentRef.value;
|
|
244
245
|
if (!overlay || !panel || !content) {
|
|
246
|
+
releaseScrollLock();
|
|
245
247
|
done();
|
|
246
248
|
return;
|
|
247
249
|
}
|
|
@@ -298,15 +300,12 @@ var Modal_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.
|
|
|
298
300
|
ease: "power2.in"
|
|
299
301
|
}, .22);
|
|
300
302
|
}
|
|
301
|
-
let previousOverflow = "";
|
|
302
|
-
let previousPaddingRight = "";
|
|
303
303
|
let previouslyFocused = null;
|
|
304
304
|
let scrollLocked = false;
|
|
305
305
|
function releaseScrollLock() {
|
|
306
306
|
if (!scrollLocked) return;
|
|
307
|
-
document.body.style.overflow = previousOverflow;
|
|
308
|
-
document.body.style.paddingRight = previousPaddingRight;
|
|
309
307
|
scrollLocked = false;
|
|
308
|
+
require_useBodyScrollLock.unlockBodyScroll();
|
|
310
309
|
}
|
|
311
310
|
(0, vue.watch)(() => props.modelValue, (open) => {
|
|
312
311
|
if (open) {
|
|
@@ -314,12 +313,8 @@ var Modal_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.
|
|
|
314
313
|
previouslyFocused = active;
|
|
315
314
|
capturedOrigin = active && active !== document.body ? active : null;
|
|
316
315
|
if (props.lockScroll && !scrollLocked) {
|
|
317
|
-
const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
318
|
-
previousOverflow = document.body.style.overflow;
|
|
319
|
-
previousPaddingRight = document.body.style.paddingRight;
|
|
320
|
-
document.body.style.overflow = "hidden";
|
|
321
|
-
if (scrollBarWidth > 0) document.body.style.paddingRight = `${scrollBarWidth}px`;
|
|
322
316
|
scrollLocked = true;
|
|
317
|
+
require_useBodyScrollLock.lockBodyScroll();
|
|
323
318
|
}
|
|
324
319
|
emit("open");
|
|
325
320
|
(0, vue.nextTick)(() => {
|