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,8 +1,28 @@
|
|
|
1
|
-
import { useResolvedColor,
|
|
2
|
-
import
|
|
1
|
+
import { useResolvedColor, useResolvedSize } from "../../composables/useModoConfig.mjs";
|
|
2
|
+
import Card_default from "./Card.mjs";
|
|
3
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, guardReactiveProps, normalizeClass, normalizeProps, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, unref, withCtx } from "vue";
|
|
3
4
|
import { ArrowDownIcon, ArrowUpIcon, MinusIcon } from "@heroicons/vue/20/solid";
|
|
4
5
|
//#region src/components/data-display/Stat.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var _hoisted_1 = {
|
|
6
|
+
var _hoisted_1 = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "flex items-center gap-2.5"
|
|
9
|
+
};
|
|
10
|
+
var _hoisted_2 = {
|
|
11
|
+
key: 1,
|
|
12
|
+
class: "flex items-center gap-4"
|
|
13
|
+
};
|
|
14
|
+
var _hoisted_3 = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "shrink-0"
|
|
17
|
+
};
|
|
18
|
+
var _hoisted_4 = {
|
|
19
|
+
key: 1,
|
|
20
|
+
class: "flex-1 min-w-0"
|
|
21
|
+
};
|
|
22
|
+
var _hoisted_5 = {
|
|
23
|
+
key: 2,
|
|
24
|
+
class: "flex items-center gap-2 flex-wrap"
|
|
25
|
+
};
|
|
6
26
|
var Stat_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
7
27
|
__name: "Stat",
|
|
8
28
|
props: {
|
|
@@ -12,6 +32,7 @@ var Stat_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
12
32
|
icon: {},
|
|
13
33
|
trend: {},
|
|
14
34
|
variant: { default: "plain" },
|
|
35
|
+
radius: {},
|
|
15
36
|
color: { default: "default" },
|
|
16
37
|
size: {},
|
|
17
38
|
loading: {
|
|
@@ -23,7 +44,12 @@ var Stat_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
23
44
|
const props = __props;
|
|
24
45
|
const resolvedSize = useResolvedSize(() => props.size);
|
|
25
46
|
const resolvedColor = useResolvedColor(() => props.color);
|
|
26
|
-
const
|
|
47
|
+
const isCard = computed(() => props.variant !== "plain");
|
|
48
|
+
const wrapperAttrs = computed(() => isCard.value ? {
|
|
49
|
+
variant: props.variant,
|
|
50
|
+
radius: props.radius,
|
|
51
|
+
padding: "none"
|
|
52
|
+
} : {});
|
|
27
53
|
const trendDirection = computed(() => {
|
|
28
54
|
if (!props.trend) return "neutral";
|
|
29
55
|
if (props.trend.direction) return props.trend.direction;
|
|
@@ -36,22 +62,6 @@ var Stat_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
36
62
|
if (props.trend.label) return props.trend.label;
|
|
37
63
|
return `${props.trend.value > 0 ? "+" : ""}${props.trend.value}%`;
|
|
38
64
|
});
|
|
39
|
-
const radiusClass = computed(() => {
|
|
40
|
-
switch (resolvedRadius.value) {
|
|
41
|
-
case "none": return "rounded-none";
|
|
42
|
-
case "small": return "rounded-sm";
|
|
43
|
-
case "large": return "rounded-xl";
|
|
44
|
-
case "full": return "rounded-3xl";
|
|
45
|
-
default: return "rounded-lg";
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
const cardClasses = computed(() => {
|
|
49
|
-
switch (props.variant) {
|
|
50
|
-
case "outlined": return `border border-border bg-card ${radiusClass.value} shadow-sm`;
|
|
51
|
-
case "filled": return `bg-muted/50 border border-border/60 ${radiusClass.value}`;
|
|
52
|
-
default: return "";
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
65
|
const paddingClasses = computed(() => {
|
|
56
66
|
if (props.variant === "plain") return "";
|
|
57
67
|
switch (resolvedSize.value) {
|
|
@@ -62,9 +72,9 @@ var Stat_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
62
72
|
});
|
|
63
73
|
const labelSizeClass = computed(() => {
|
|
64
74
|
switch (resolvedSize.value) {
|
|
65
|
-
case "small": return "text-
|
|
66
|
-
case "large": return "text-
|
|
67
|
-
default: return "text-
|
|
75
|
+
case "small": return "text-xs";
|
|
76
|
+
case "large": return "text-base";
|
|
77
|
+
default: return "text-sm";
|
|
68
78
|
}
|
|
69
79
|
});
|
|
70
80
|
const valueSizeClass = computed(() => {
|
|
@@ -74,11 +84,11 @@ var Stat_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
74
84
|
default: return "text-3xl";
|
|
75
85
|
}
|
|
76
86
|
});
|
|
77
|
-
const
|
|
87
|
+
const gapClass = computed(() => {
|
|
78
88
|
switch (resolvedSize.value) {
|
|
79
|
-
case "small": return "
|
|
80
|
-
case "large": return "
|
|
81
|
-
default: return "
|
|
89
|
+
case "small": return "gap-2.5";
|
|
90
|
+
case "large": return "gap-4";
|
|
91
|
+
default: return "gap-3";
|
|
82
92
|
}
|
|
83
93
|
});
|
|
84
94
|
const skeletonClass = computed(() => {
|
|
@@ -110,14 +120,14 @@ var Stat_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
110
120
|
const iconBoxClass = computed(() => {
|
|
111
121
|
switch (resolvedSize.value) {
|
|
112
122
|
case "small": return "w-7 h-7 rounded-lg";
|
|
113
|
-
case "large": return "w-
|
|
114
|
-
default: return "w-
|
|
123
|
+
case "large": return "w-10 h-10 rounded-xl";
|
|
124
|
+
default: return "w-8 h-8 rounded-lg";
|
|
115
125
|
}
|
|
116
126
|
});
|
|
117
127
|
const iconSizeClass = computed(() => {
|
|
118
128
|
switch (resolvedSize.value) {
|
|
119
129
|
case "small": return "w-3.5 h-3.5";
|
|
120
|
-
case "large": return "w-
|
|
130
|
+
case "large": return "w-5 h-5";
|
|
121
131
|
default: return "w-4 h-4";
|
|
122
132
|
}
|
|
123
133
|
});
|
|
@@ -136,53 +146,56 @@ var Stat_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
136
146
|
return "bg-muted text-muted-foreground";
|
|
137
147
|
});
|
|
138
148
|
return (_ctx, _cache) => {
|
|
139
|
-
return openBlock(),
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
149
|
+
return openBlock(), createBlock(resolveDynamicComponent(isCard.value ? Card_default : "div"), normalizeProps(guardReactiveProps(wrapperAttrs.value)), {
|
|
150
|
+
default: withCtx(() => [createElementVNode("div", { class: normalizeClass([
|
|
151
|
+
"relative flex flex-col",
|
|
152
|
+
gapClass.value,
|
|
153
|
+
paddingClasses.value
|
|
154
|
+
]) }, [
|
|
155
|
+
__props.icon || __props.label ? (openBlock(), createElementBlock("div", _hoisted_1, [__props.icon ? (openBlock(), createElementBlock("span", {
|
|
156
|
+
key: 0,
|
|
157
|
+
class: normalizeClass([
|
|
158
|
+
"shrink-0 inline-flex items-center justify-center rounded-xl",
|
|
159
|
+
iconBoxClass.value,
|
|
160
|
+
iconColorClasses.value
|
|
161
|
+
])
|
|
162
|
+
}, [(openBlock(), createBlock(resolveDynamicComponent(__props.icon), {
|
|
163
|
+
class: normalizeClass(iconSizeClass.value),
|
|
164
|
+
"aria-hidden": "true"
|
|
165
|
+
}, null, 8, ["class"]))], 2)) : createCommentVNode("", true), __props.label ? (openBlock(), createElementBlock("span", {
|
|
166
|
+
key: 1,
|
|
167
|
+
class: normalizeClass(["font-normal text-muted-foreground leading-none", labelSizeClass.value])
|
|
168
|
+
}, toDisplayString(__props.label), 3)) : createCommentVNode("", true)])) : createCommentVNode("", true),
|
|
169
|
+
__props.loading || __props.value !== void 0 || _ctx.$slots.chart ? (openBlock(), createElementBlock("div", _hoisted_2, [__props.loading || __props.value !== void 0 ? (openBlock(), createElementBlock("div", _hoisted_3, [__props.loading ? (openBlock(), createElementBlock("div", {
|
|
170
|
+
key: 0,
|
|
171
|
+
class: normalizeClass(["bg-muted animate-pulse rounded-lg", skeletonClass.value])
|
|
172
|
+
}, null, 2)) : (openBlock(), createElementBlock("span", {
|
|
173
|
+
key: 1,
|
|
174
|
+
class: normalizeClass(["font-semibold text-foreground tabular-nums leading-none", valueSizeClass.value])
|
|
175
|
+
}, toDisplayString(__props.value), 3))])) : createCommentVNode("", true), _ctx.$slots.chart ? (openBlock(), createElementBlock("div", _hoisted_4, [renderSlot(_ctx.$slots, "chart")])) : createCommentVNode("", true)])) : createCommentVNode("", true),
|
|
176
|
+
__props.trend || __props.description ? (openBlock(), createElementBlock("div", _hoisted_5, [__props.trend ? (openBlock(), createElementBlock("span", {
|
|
177
|
+
key: 0,
|
|
178
|
+
class: normalizeClass([
|
|
179
|
+
"inline-flex items-center gap-0.5 font-medium tabular-nums rounded-md px-1.5 py-0.5",
|
|
180
|
+
trendSizeClass.value,
|
|
181
|
+
trendBadgeClasses.value
|
|
182
|
+
])
|
|
183
|
+
}, [trendDirection.value === "up" ? (openBlock(), createBlock(unref(ArrowUpIcon), {
|
|
184
|
+
key: 0,
|
|
185
|
+
class: normalizeClass(trendIconClass.value)
|
|
186
|
+
}, null, 8, ["class"])) : trendDirection.value === "down" ? (openBlock(), createBlock(unref(ArrowDownIcon), {
|
|
187
|
+
key: 1,
|
|
188
|
+
class: normalizeClass(trendIconClass.value)
|
|
189
|
+
}, null, 8, ["class"])) : (openBlock(), createBlock(unref(MinusIcon), {
|
|
190
|
+
key: 2,
|
|
191
|
+
class: normalizeClass(trendIconClass.value)
|
|
192
|
+
}, null, 8, ["class"])), createTextVNode(" " + toDisplayString(trendLabel.value), 1)], 2)) : createCommentVNode("", true), __props.description ? (openBlock(), createElementBlock("span", {
|
|
193
|
+
key: 1,
|
|
194
|
+
class: normalizeClass(["text-muted-foreground", descSizeClass.value])
|
|
195
|
+
}, toDisplayString(__props.description), 3)) : createCommentVNode("", true)])) : createCommentVNode("", true)
|
|
196
|
+
], 2)]),
|
|
197
|
+
_: 3
|
|
198
|
+
}, 16);
|
|
186
199
|
};
|
|
187
200
|
}
|
|
188
201
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stat.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../src/components/data-display/Stat.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n 'relative flex flex-col',\n cardClasses,\n paddingClasses,\n ]\"\n >\n <!-- Header: label + icon -->\n <div class=\"flex items-start justify-between gap-3\">\n <span :class=\"['font-medium text-muted-foreground leading-none', labelSizeClass]\">{{ label }}</span>\n <span\n v-if=\"icon\"\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center rounded-xl',\n iconBoxClass,\n iconColorClasses,\n ]\"\n >\n <component :is=\"icon\" :class=\"iconSizeClass\" aria-hidden=\"true\" />\n </span>\n </div>\n\n <!-- Value -->\n <div :class=\"['mt-3', icon ? '' : '']\">\n <div v-if=\"loading\" :class=\"['bg-muted animate-pulse rounded-lg', skeletonClass]\" />\n <span v-else :class=\"['font-semibold text-foreground tabular-nums leading-none', valueSizeClass]\">\n {{ value }}\n </span>\n </div>\n\n <!-- Trend + description -->\n <div v-if=\"trend || description\" :class=\"['flex items-center gap-2 flex-wrap', trendGapClass]\">\n <span\n v-if=\"trend\"\n :class=\"[\n 'inline-flex items-center gap-0.5 font-medium tabular-nums rounded-md px-1.5 py-0.5',\n trendSizeClass,\n trendBadgeClasses,\n ]\"\n >\n <ArrowUpIcon v-if=\"trendDirection === 'up'\" :class=\"trendIconClass\" />\n <ArrowDownIcon v-else-if=\"trendDirection === 'down'\" :class=\"trendIconClass\" />\n <MinusIcon v-else :class=\"trendIconClass\" />\n {{ trendLabel }}\n </span>\n <span v-if=\"description\" :class=\"['text-muted-foreground', descSizeClass]\">{{ description }}</span>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { ArrowUpIcon, ArrowDownIcon, MinusIcon } from '@heroicons/vue/20/solid';\nimport type { Stat } from '../../interfaces/data-display/Stat.interface';\nimport { useResolvedColor, useResolvedSize, useResolvedRadius } from '../../composables/useModoConfig';\n\nconst props = withDefaults(defineProps<Stat>(), {\n variant: 'plain',\n color: 'default',\n loading: false,\n});\n\nconst resolvedSize = useResolvedSize(() => props.size);\nconst resolvedColor = useResolvedColor(() => props.color);\nconst resolvedRadius = useResolvedRadius(() => (props as any).radius);\n\nconst trendDirection = computed<'up' | 'down' | 'neutral'>(() => {\n if (!props.trend) return 'neutral';\n if (props.trend.direction) return props.trend.direction;\n if (props.trend.value > 0) return 'up';\n if (props.trend.value < 0) return 'down';\n return 'neutral';\n});\n\nconst trendLabel = computed(() => {\n if (!props.trend) return '';\n if (props.trend.label) return props.trend.label;\n const sign = props.trend.value > 0 ? '+' : '';\n return `${sign}${props.trend.value}%`;\n});\n\nconst radiusClass = computed(() => {\n switch (resolvedRadius.value) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded-sm';\n case 'large': return 'rounded-xl';\n case 'full': return 'rounded-3xl';\n case 'medium':\n default: return 'rounded-lg';\n }\n});\n\nconst cardClasses = computed(() => {\n switch (props.variant) {\n case 'outlined': return `border border-border bg-card ${radiusClass.value} shadow-sm`;\n case 'filled': return `bg-muted/50 border border-border/60 ${radiusClass.value}`;\n case 'plain':\n default: return '';\n }\n});\n\nconst paddingClasses = computed(() => {\n if (props.variant === 'plain') return '';\n switch (resolvedSize.value) {\n case 'small': return 'p-3.5';\n case 'large': return 'p-6';\n case 'medium':\n default: return 'p-5';\n }\n});\n\nconst labelSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case 'small': return 'text-[11px] tracking-wide uppercase';\n case 'large': return 'text-sm tracking-wide uppercase';\n case 'medium':\n default: return 'text-xs tracking-wide uppercase';\n }\n});\n\nconst valueSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case 'small': return 'text-2xl';\n case 'large': return 'text-4xl';\n case 'medium':\n default: return 'text-3xl';\n }\n});\n\nconst trendGapClass = computed(() => {\n switch (resolvedSize.value) {\n case 'small': return 'mt-2.5';\n case 'large': return 'mt-4';\n default: return 'mt-3';\n }\n});\n\nconst skeletonClass = computed(() => {\n switch (resolvedSize.value) {\n case 'small': return 'h-7 w-20 mt-3';\n case 'large': return 'h-10 w-32 mt-3';\n default: return 'h-8 w-24 mt-3';\n }\n});\n\nconst descSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case 'small': return 'text-[11px]';\n case 'large': return 'text-sm';\n case 'medium':\n default: return 'text-xs';\n }\n});\n\nconst trendSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case 'large': return 'text-xs';\n default: return 'text-[11px]';\n }\n});\n\nconst trendIconClass = computed(() => {\n switch (resolvedSize.value) {\n case 'large': return 'w-3.5 h-3.5';\n default: return 'w-3 h-3';\n }\n});\n\nconst iconBoxClass = computed(() => {\n switch (resolvedSize.value) {\n case 'small': return 'w-7 h-7 rounded-lg';\n case 'large': return 'w-12 h-12 rounded-xl';\n case 'medium':\n default: return 'w-9 h-9 rounded-xl';\n }\n});\n\nconst iconSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case 'small': return 'w-3.5 h-3.5';\n case 'large': return 'w-6 h-6';\n case 'medium':\n default: return 'w-4 h-4';\n }\n});\n\nconst iconColorClasses = computed(() => {\n switch (resolvedColor.value) {\n case 'primary': return 'bg-primary/10 text-primary';\n case 'danger': return 'bg-destructive/10 text-destructive';\n case 'success': return 'bg-success/10 text-success';\n case 'warning': return 'bg-warning/10 text-warning';\n case 'default':\n default: return 'bg-muted text-muted-foreground';\n }\n});\n\nconst trendBadgeClasses = computed(() => {\n if (trendDirection.value === 'up') return 'bg-success/10 text-success';\n if (trendDirection.value === 'down') return 'bg-destructive/10 text-destructive';\n return 'bg-muted text-muted-foreground';\n});\n</script>\n\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Stat.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../src/components/data-display/Stat.vue"],"sourcesContent":["<template>\n <!-- Card variants delegate to the shared <Card> so the surface/shadow/radius\n stay identical everywhere (no bespoke shadow on `outlined`). `plain`\n renders no container. -->\n <component\n :is=\"isCard ? Card : 'div'\"\n v-bind=\"wrapperAttrs\"\n >\n <div :class=\"['relative flex flex-col', gapClass, paddingClasses]\">\n <!-- Header: icon + label, left-aligned. Only when there's something to show. -->\n <div v-if=\"icon || label\" class=\"flex items-center gap-2.5\">\n <span\n v-if=\"icon\"\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center rounded-xl',\n iconBoxClass,\n iconColorClasses,\n ]\"\n >\n <component :is=\"icon\" :class=\"iconSizeClass\" aria-hidden=\"true\" />\n </span>\n <span v-if=\"label\" :class=\"['font-normal text-muted-foreground leading-none', labelSizeClass]\">{{ label }}</span>\n </div>\n\n <!-- Value (left) + optional chart (right). With no `value`, the chart\n fills the card — a \"chart-only\" stat. -->\n <div v-if=\"loading || value !== undefined || $slots.chart\" class=\"flex items-center gap-4\">\n <div v-if=\"loading || value !== undefined\" class=\"shrink-0\">\n <div v-if=\"loading\" :class=\"['bg-muted animate-pulse rounded-lg', skeletonClass]\" />\n <span v-else :class=\"['font-semibold text-foreground tabular-nums leading-none', valueSizeClass]\">\n {{ value }}\n </span>\n </div>\n <div v-if=\"$slots.chart\" class=\"flex-1 min-w-0\">\n <slot name=\"chart\" />\n </div>\n </div>\n\n <!-- Trend + description -->\n <div v-if=\"trend || description\" class=\"flex items-center gap-2 flex-wrap\">\n <span\n v-if=\"trend\"\n :class=\"[\n 'inline-flex items-center gap-0.5 font-medium tabular-nums rounded-md px-1.5 py-0.5',\n trendSizeClass,\n trendBadgeClasses,\n ]\"\n >\n <ArrowUpIcon v-if=\"trendDirection === 'up'\" :class=\"trendIconClass\" />\n <ArrowDownIcon v-else-if=\"trendDirection === 'down'\" :class=\"trendIconClass\" />\n <MinusIcon v-else :class=\"trendIconClass\" />\n {{ trendLabel }}\n </span>\n <span v-if=\"description\" :class=\"['text-muted-foreground', descSizeClass]\">{{ description }}</span>\n </div>\n </div>\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { ArrowUpIcon, ArrowDownIcon, MinusIcon } from '@heroicons/vue/20/solid';\nimport type { Stat } from '../../interfaces/data-display/Stat.interface';\nimport { useResolvedColor, useResolvedSize } from '../../composables/useModoConfig';\nimport Card from './Card.vue';\n\nconst props = withDefaults(defineProps<Stat>(), {\n variant: 'plain',\n color: 'default',\n loading: false,\n});\n\nconst resolvedSize = useResolvedSize(() => props.size);\nconst resolvedColor = useResolvedColor(() => props.color);\n\n// Card variants render through the shared <Card>; `plain` renders a bare div.\nconst isCard = computed(() => props.variant !== 'plain');\nconst wrapperAttrs = computed(() =>\n isCard.value\n ? { variant: props.variant, radius: props.radius, padding: 'none' as const }\n : {},\n);\n\nconst trendDirection = computed<'up' | 'down' | 'neutral'>(() => {\n if (!props.trend) return 'neutral';\n if (props.trend.direction) return props.trend.direction;\n if (props.trend.value > 0) return 'up';\n if (props.trend.value < 0) return 'down';\n return 'neutral';\n});\n\nconst trendLabel = computed(() => {\n if (!props.trend) return '';\n if (props.trend.label) return props.trend.label;\n const sign = props.trend.value > 0 ? '+' : '';\n return `${sign}${props.trend.value}%`;\n});\n\nconst paddingClasses = computed(() => {\n if (props.variant === 'plain') return '';\n switch (resolvedSize.value) {\n case 'small': return 'p-3.5';\n case 'large': return 'p-6';\n case 'medium':\n default: return 'p-5';\n }\n});\n\nconst labelSizeClass = computed(() => {\n // Normal case, no letter-spacing — reads like a plain label, not a caps eyebrow.\n switch (resolvedSize.value) {\n case 'small': return 'text-xs';\n case 'large': return 'text-base';\n case 'medium':\n default: return 'text-sm';\n }\n});\n\nconst valueSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case 'small': return 'text-2xl';\n case 'large': return 'text-4xl';\n case 'medium':\n default: return 'text-3xl';\n }\n});\n\n// Vertical rhythm between header / value+chart / trend (gap, so a missing row\n// never leaves a dangling margin).\nconst gapClass = computed(() => {\n switch (resolvedSize.value) {\n case 'small': return 'gap-2.5';\n case 'large': return 'gap-4';\n default: return 'gap-3';\n }\n});\n\nconst skeletonClass = computed(() => {\n switch (resolvedSize.value) {\n case 'small': return 'h-7 w-20 mt-3';\n case 'large': return 'h-10 w-32 mt-3';\n default: return 'h-8 w-24 mt-3';\n }\n});\n\nconst descSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case 'small': return 'text-[11px]';\n case 'large': return 'text-sm';\n case 'medium':\n default: return 'text-xs';\n }\n});\n\nconst trendSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case 'large': return 'text-xs';\n default: return 'text-[11px]';\n }\n});\n\nconst trendIconClass = computed(() => {\n switch (resolvedSize.value) {\n case 'large': return 'w-3.5 h-3.5';\n default: return 'w-3 h-3';\n }\n});\n\nconst iconBoxClass = computed(() => {\n // Kept modest so the icon never competes with the value, even at `large`.\n switch (resolvedSize.value) {\n case 'small': return 'w-7 h-7 rounded-lg';\n case 'large': return 'w-10 h-10 rounded-xl';\n case 'medium':\n default: return 'w-8 h-8 rounded-lg';\n }\n});\n\nconst iconSizeClass = computed(() => {\n switch (resolvedSize.value) {\n case 'small': return 'w-3.5 h-3.5';\n case 'large': return 'w-5 h-5';\n case 'medium':\n default: return 'w-4 h-4';\n }\n});\n\nconst iconColorClasses = computed(() => {\n switch (resolvedColor.value) {\n case 'primary': return 'bg-primary/10 text-primary';\n case 'danger': return 'bg-destructive/10 text-destructive';\n case 'success': return 'bg-success/10 text-success';\n case 'warning': return 'bg-warning/10 text-warning';\n case 'default':\n default: return 'bg-muted text-muted-foreground';\n }\n});\n\nconst trendBadgeClasses = computed(() => {\n if (trendDirection.value === 'up') return 'bg-success/10 text-success';\n if (trendDirection.value === 'down') return 'bg-destructive/10 text-destructive';\n return 'bg-muted text-muted-foreground';\n});\n</script>\n\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgendaView.cjs","names":[],"sources":["../../../../src/components/data-display/calendar/AgendaView.vue"],"sourcesContent":["<template> \n <div \n ref=\"rootRef\" \n tabindex=\"-1\" \n :class=\"['relative flex flex-col bg-card overflow-hidden focus:outline-none', containerRadiusClass, bordered ? 'border border-border' : '']\" \n @keydown=\"handleKeydown\" \n > \n <slot name=\"header\" :label=\"headerLabel\" :goToToday=\"handleToday\" :prev=\"handlePrev\" :next=\"handleNext\" :prevYear=\"handlePrevYear\" :nextYear=\"handleNextYear\"> \n <CalendarHeader \n :label=\"headerLabel\" \n :showHeader=\"showHeader\" \n :showYearJump=\"showYearNavigation\" \n :showTodayButton=\"showTodayButton\" \n :showMonthYearSelects=\"showMonthYearSelects\" \n :monthOptions=\"monthOptions\" \n :yearOptions=\"yearOptions\" \n v-model:selectedMonth=\"selectedMonth\" \n v-model:selectedYear=\"selectedYear\" \n :color=\"resolvedColor\" \n :focusRingColorClass=\"focusRingColorClass\" \n :todayTextClass=\"todayTextClass\" \n :todayRadiusClass=\"pillRadiusClass\" \n :dayNameCaseClass=\"dayNameCaseClass\" \n @prev=\"handlePrev\" \n @next=\"handleNext\" \n @prevYear=\"handlePrevYear\" \n @nextYear=\"handleNextYear\" \n @today=\"handleToday\" \n /> \n </slot> \n \n <div ref=\"scrollRef\" class=\"flex-1 overflow-y-auto\" @scroll=\"onScroll\"> \n <div v-if=\"!groups.length\" class=\"flex-1 flex items-center justify-center py-12 text-sm text-muted-foreground\"> \n <slot name=\"empty\">{{ emptyText ?? loc.agenda.empty }}</slot> \n </div> \n \n <template v-for=\"(g, gi) in groups\" :key=\"g.key\"> \n <div \n v-if=\"showMonthSeparator && g.showMonthHeader\" \n class=\"sticky top-0 z-20 bg-card/95 backdrop-blur px-4 py-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground border-b border-border\" \n > \n {{ g.monthLabel }} \n </div> \n \n <div \n :data-dkey=\"g.key\" \n :class=\"[ \n 'grid border-b border-border transition-colors', \n g.isToday ? 'bg-muted/40' : '', \n g.disabled ? 'opacity-60' : '', \n ]\" \n style=\"grid-template-columns: 5rem 1fr;\" \n > \n <div class=\"flex flex-col items-center justify-start py-4 border-r border-border\"> \n <slot name=\"day-header\" :date=\"g.date\" :isToday=\"g.isToday\" :events=\"g.events\"> \n <span :class=\"['text-[10px] font-medium tracking-wider text-muted-foreground', dayNameCaseClass]\">{{ g.weekdayLabel }}</span> \n <span \n :class=\"[ \n 'mt-1 inline-flex items-center justify-center text-base font-semibold w-9 h-9', \n pillRadiusClass, \n g.isToday ? [todayBgClass] : 'text-foreground', \n ]\" \n >{{ g.day }}</span> \n <span v-if=\"isHighlightedDate(g.date)\" :class=\"['mt-1 w-1 h-1 rounded-full', highlightDotClass]\"></span> \n </slot> \n </div> \n \n <div class=\"py-2 px-3\"> \n <div v-if=\"!g.events.length\" class=\"py-2 text-xs text-muted-foreground/60 italic\"> \n No events \n </div> \n <div v-else class=\"flex flex-col\"> \n <button \n v-for=\"ev in g.events\" \n :key=\"`${g.key}-${ev.id}`\" \n :data-eid=\"ev.id\" \n type=\"button\" \n @click=\"handleEventClick(ev, $event)\" \n @mouseenter=\"onEventEnter(ev, !!ev.allDay, $event)\" \n @mousemove=\"onEventMove\" \n @mouseleave=\"onEventLeave\" \n :class=\"['group flex items-start gap-3 py-2 px-2 -mx-2 cursor-pointer transition-colors hover:bg-muted/70 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-ring', eventRadiusClass]\" \n > \n <span class=\"shrink-0 w-16 pt-0.5 text-[11px] font-medium text-muted-foreground tabular-nums\"> \n <template v-if=\"ev.allDay\">All day</template> \n <template v-else>{{ formatEventTime(ev.start) }}</template> \n </span> \n <span \n class=\"shrink-0 mt-1.5 w-2 h-2\" \n :style=\"ev.colorHex ? { backgroundColor: ev.colorHex } : undefined\" \n :class=\"[pillRadiusClass, !ev.colorHex ? dotColorClass(ev.color) : '']\" \n ></span> \n <span class=\"flex-1 min-w-0\"> \n <slot name=\"event\" :event=\"ev\"> \n <span class=\"block text-sm font-medium text-foreground truncate\">{{ ev.title }}</span> \n <span v-if=\"!ev.allDay && ev.end\" class=\"block text-[11px] text-muted-foreground\"> \n {{ formatEventTime(ev.start) }} – {{ formatEventTime(ev.end) }} \n </span> \n <span v-if=\"ev.description\" class=\"block text-xs text-muted-foreground truncate mt-0.5\">{{ ev.description }}</span> \n </slot> \n </span> \n <span v-if=\"ev.readonly\" class=\"shrink-0 mt-0.5 text-[9px] uppercase tracking-wider text-muted-foreground border border-border px-1 rounded\">Locked</span> \n </button> \n </div> \n </div> \n </div> \n <div v-if=\"gi === groups.length - 1\" class=\"h-1\"></div> \n </template> \n </div> \n \n <CalendarEventTooltip :state=\"hoverState\" :style=\"tooltipStyle\" :formatTime=\"formatEventTime\"> \n <template #default=\"{ event, allDay }\"> \n <slot name=\"event-tooltip\" :event=\"event\" :allDay=\"allDay\" /> \n </template> \n </CalendarEventTooltip> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { ref, computed, watch, nextTick, onMounted } from 'vue'; \nimport gsap from 'gsap'; \nimport { isSameDay, startOfDay } from '../../../composables/useCalendar'; \nimport { useCalendarTheme } from '../../../composables/useCalendarTheme'; \nimport { useModoLocale } from '../../../composables/useModoConfig'; \n \nconst loc = useModoLocale(); \nimport { useEventHover } from '../../../composables/useEventHover'; \nimport CalendarEventTooltip from './CalendarEventTooltip.vue'; \nimport CalendarHeader from './CalendarHeader.vue'; \nimport type { AgendaView } from '../../../interfaces/data-display/calendar/AgendaView.interface'; \nimport type { CalendarEvent } from '../../../interfaces/data-display/calendar/MonthView.interface'; \n \nconst props = withDefaults(defineProps<AgendaView>(), { \n modelValue: () => new Date(), \n events: () => [], \n locale: 'default', \n color: 'default', \n bordered: true, \n daysToShow: 30, \n daysBefore: 0, \n showEmptyDays: false, \n showHeader: true, \n showMonthSeparator: true, \n showYearNavigation: false, \n showMonthYearSelects: false, \n showTodayButton: true, \n dayNameFormat: 'short', \n dayNameCase: 'upper', \n format: '24h', \n readonly: false, \n highlightedDates: () => [], \n disabledDates: () => [], \n disabledWeekdays: () => [], \n // emptyText resolves against locale when not provided. \n loadMoreChunk: 30, \n enableKeyboardNavigation: true, \n}); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [date: Date]; \n 'event-click': [event: CalendarEvent, nativeEvent: MouseEvent]; \n 'day-click': [date: Date, events: CalendarEvent[], nativeEvent: MouseEvent]; \n 'create-event': [date: Date, allDay: boolean, nativeEvent: MouseEvent | KeyboardEvent]; \n 'load-more': [direction: 'forward' | 'backward']; \n}>(); \n \nconst firstOfMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth(), 1); \nconst daysInMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate(); \n \nconst anchorDate = ref(firstOfMonth(new Date(props.modelValue))); \nconst daysForwardShown = ref(Math.max(props.daysToShow, daysInMonth(anchorDate.value))); \n \nwatch(() => props.modelValue, (v) => { \n if (!v) return; \n const f = firstOfMonth(new Date(v)); \n if (f.getTime() === anchorDate.value.getTime()) return; \n anchorDate.value = f; \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(f)); \n}); \nwatch(() => props.daysToShow, (n) => { daysForwardShown.value = Math.max(n, daysInMonth(anchorDate.value)); }); \n \nconst rootRef = ref<HTMLElement | null>(null); \nconst scrollRef = ref<HTMLElement | null>(null); \nconst today = new Date(); \n \nconst { hoverState, onEventEnter, onEventMove, onEventLeave, tooltipStyle } = useEventHover<CalendarEvent>(); \n \nconst formatEventTime = (d: Date) => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n return d.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', hour12: props.format === '12h' }); \n}; \n \nconst isHighlightedDate = (d: Date) => props.highlightedDates.some(h => isSameDay(h, d)); \nconst isDisabledDate = (d: Date) => props.disabledDates.some(x => isSameDay(x, d)); \nconst isDisabledWeekday = (d: Date) => props.disabledWeekdays.includes(d.getDay()); \nconst isDayDisabled = (d: Date) => { \n if (props.minDate && startOfDay(d) < startOfDay(props.minDate)) return true; \n if (props.maxDate && startOfDay(d) > startOfDay(props.maxDate)) return true; \n return isDisabledDate(d) || isDisabledWeekday(d); \n}; \n \ninterface DayGroup { \n key: string; \n date: Date; \n day: number; \n weekdayLabel: string; \n monthLabel: string; \n showMonthHeader: boolean; \n isToday: boolean; \n disabled: boolean; \n events: CalendarEvent[]; \n} \n \nconst rangeDates = computed<Date[]>(() => { \n const anchor = anchorDate.value; \n const list: Date[] = []; \n for (let i = 0; i < daysForwardShown.value; i++) { \n const d = new Date(anchor); \n d.setDate(d.getDate() + i); \n const sod = startOfDay(d); \n if (props.minDate && sod < startOfDay(props.minDate)) continue; \n if (props.maxDate && sod > startOfDay(props.maxDate)) continue; \n list.push(sod); \n } \n return list; \n}); \n \nconst eventsByDay = computed<Map<string, CalendarEvent[]>>(() => { \n const map = new Map<string, CalendarEvent[]>(); \n for (const ev of props.events) { \n const s = startOfDay(ev.start); \n const e = startOfDay(ev.end ?? ev.start); \n const d = new Date(s); \n while (d.getTime() <= e.getTime()) { \n const k = d.toDateString(); \n if (!map.has(k)) map.set(k, []); \n map.get(k)!.push(ev); \n d.setDate(d.getDate() + 1); \n } \n } \n for (const list of map.values()) { \n list.sort((a, b) => { \n if (a.allDay && !b.allDay) return -1; \n if (!a.allDay && b.allDay) return 1; \n return a.start.getTime() - b.start.getTime(); \n }); \n } \n return map; \n}); \n \nconst isoKey = (d: Date) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`; \nconst parseIsoKey = (s: string): Date | null => { \n const m = s.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/); \n if (!m) return null; \n return new Date(parseInt(m[1]), parseInt(m[2]) - 1, parseInt(m[3])); \n}; \n \nconst groups = computed<DayGroup[]>(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const result: DayGroup[] = []; \n let lastMonthKey = ''; \n for (const date of rangeDates.value) { \n const key = isoKey(date); \n const evts = eventsByDay.value.get(date.toDateString()) ?? []; \n if (!props.showEmptyDays && !evts.length) continue; \n const monthKey = `${date.getFullYear()}-${date.getMonth()}`; \n const showMonthHeader = monthKey !== lastMonthKey; \n lastMonthKey = monthKey; \n result.push({ \n key, \n date, \n day: date.getDate(), \n weekdayLabel: date.toLocaleDateString(locale, { weekday: props.dayNameFormat }), \n monthLabel: date.toLocaleDateString(locale, { month: 'long', year: 'numeric' }), \n showMonthHeader, \n isToday: isSameDay(date, today), \n disabled: isDayDisabled(date), \n events: evts, \n }); \n } \n return result; \n}); \n \nconst headerLabel = computed(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const d = visibleDate.value ?? anchorDate.value; \n return d.toLocaleDateString(locale, { month: 'long', year: 'numeric' }); \n}); \n \nconst handleEventClick = (ev: CalendarEvent, e: MouseEvent) => { \n emit('event-click', ev, e); \n}; \n \nconst afterNavigate = (scrollTarget?: Date, animateScroll = false) => { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) { animateIn(); return; } \n const scEl = scrollRef.value; \n let target = 0; \n if (scrollTarget) { \n const key = isoKey(startOfDay(scrollTarget)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n } \n } \n if (animateScroll && target > 0) { \n scEl.scrollTop = 0; \n animateIn(); \n gsap.to(scEl, { scrollTop: target, duration: 0.7, ease: 'power3.inOut', delay: 0.15 }); \n } else { \n scEl.scrollTop = target; \n animateIn(); \n } \n visibleDate.value = anchorDate.value; \n }); \n}; \nconst handlePrev = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNext = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleToday = () => { \n const n = new Date(); \n const wasCurrentMonth = firstOfMonth(n).getTime() === anchorDate.value.getTime(); \n anchorDate.value = firstOfMonth(n); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(n, !wasCurrentMonth); \n if (wasCurrentMonth && scrollRef.value && rootRef.value) { \n nextTick(() => { \n const key = isoKey(startOfDay(n)); \n const el = rootRef.value!.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value!.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value!.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value!, { scrollTop: target, duration: 0.6, ease: 'power3.inOut' }); \n }); \n } \n}; \nconst handlePrevYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNextYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \n \nconst animateIn = () => { \n if (!rootRef.value) return; \n const els = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n if (!els.length) return; \n gsap.fromTo( \n els, \n { opacity: 0, y: 8 }, \n { opacity: 1, y: 0, duration: 0.35, ease: 'power2.out', stagger: { amount: 0.2 } } \n ); \n}; \n \nlet loadingMore = false; \nconst visibleDate = ref<Date | null>(null); \nconst canExtend = () => { \n if (!props.maxDate) return true; \n const last = rangeDates.value[rangeDates.value.length - 1]; \n return !(last && startOfDay(last) >= startOfDay(props.maxDate)); \n}; \nconst onScroll = () => { \n if (!scrollRef.value) return; \n const el = scrollRef.value; \n if (rootRef.value) { \n const scRect = el.getBoundingClientRect(); \n const headers = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n let pick: Date | null = null; \n for (const h of headers) { \n const r = h.getBoundingClientRect(); \n if (r.bottom > scRect.top + 8) { \n const k = h.getAttribute('data-dkey'); \n if (k) pick = parseIsoKey(k); \n break; \n } \n } \n if (pick) visibleDate.value = pick; \n } \n if (loadingMore) return; \n const remaining = el.scrollHeight - (el.scrollTop + el.clientHeight); \n if (remaining < 120) { \n if (!canExtend()) return; \n loadingMore = true; \n daysForwardShown.value += props.loadMoreChunk; \n emit('load-more', 'forward'); \n setTimeout(() => { loadingMore = false; }, 120); \n } \n}; \n \nconst handleKeydown = (e: KeyboardEvent) => { \n if (!props.enableKeyboardNavigation) return; \n const target = e.target as HTMLElement; \n if (target.tagName === 'SELECT' || target.tagName === 'INPUT') return; \n if (e.key === 'ArrowLeft' || e.key === 'PageUp') { e.preventDefault(); handlePrev(); } \n else if (e.key === 'ArrowRight' || e.key === 'PageDown') { e.preventDefault(); handleNext(); } \n else if (e.key.toLowerCase() === 't') { e.preventDefault(); handleToday(); } \n}; \n \nonMounted(() => { \n nextTick(() => { \n visibleDate.value = anchorDate.value; \n animateIn(); \n if (scrollRef.value && rootRef.value) { \n const todayMonth = firstOfMonth(today); \n if (todayMonth.getTime() === anchorDate.value.getTime()) { \n const key = isoKey(startOfDay(today)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scEl = scrollRef.value; \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n if (target > 0) { \n gsap.to(scEl, { scrollTop: target, duration: 0.9, ease: 'power3.inOut', delay: 0.25 }); \n } \n } \n } \n } \n }); \n}); \n \ndefineExpose({ \n scrollToDate(date: Date) { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) return; \n const key = isoKey(startOfDay(date)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value, { scrollTop: target, duration: 0.45, ease: 'power3.inOut' }); \n }); \n }, \n}); \n \nconst { todayTextClass, dayNameCaseClass, focusRingColorClass, highlightDotClass, containerRadiusClass, eventRadiusClass, pillRadiusClass, todayBgClass, resolvedColor } = useCalendarTheme({ \n color: () => props.color, \n radius: () => props.radius, \n dayNameCase: () => props.dayNameCase, \n}); \n \nconst DOT_THEMED: Record<string, string> = { \n default: 'bg-muted-foreground', \n primary: 'bg-primary', \n danger: 'bg-destructive', \n success: 'bg-success', \n warning: 'bg-warning', \n}; \nconst DOT_SEMANTIC: Record<string, string> = { \n info: 'bg-info', \n purple: 'bg-purple', \n pink: 'bg-pink', \n}; \nconst dotColorClass = (c?: CalendarEvent['color']) => { \n if (!c) return DOT_THEMED.default; \n return DOT_THEMED[c] ?? DOT_SEMANTIC[c] ?? DOT_THEMED.default; \n}; \n \nconst localeValue = computed(() => (props.locale === 'default' ? undefined : props.locale)); \n \nconst monthOptions = computed(() => { \n const base = new Date(2024, 0, 1); \n return Array.from({ length: 12 }, (_, i) => { \n const d = new Date(base); \n d.setMonth(i); \n return d.toLocaleString(localeValue.value, { month: 'long' }); \n }); \n}); \n \nconst yearOptions = computed(() => { \n const min = props.minDate?.getFullYear() ?? anchorDate.value.getFullYear() - 10; \n const max = props.maxDate?.getFullYear() ?? anchorDate.value.getFullYear() + 10; \n const list: number[] = []; \n for (let y = min; y <= max; y++) list.push(y); \n return list; \n}); \n \nconst selectedMonth = computed({ \n get: () => anchorDate.value.getMonth(), \n set: (mm: number) => { \n const d = new Date(anchorDate.value); \n d.setDate(1); \n d.setMonth(mm); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n \nconst selectedYear = computed({ \n get: () => anchorDate.value.getFullYear(), \n set: (yy: number) => { \n const d = new Date(anchorDate.value); \n d.setFullYear(yy); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n</script>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"AgendaView.cjs","names":[],"sources":["../../../../src/components/data-display/calendar/AgendaView.vue"],"sourcesContent":["<template> \n <div \n ref=\"rootRef\" \n tabindex=\"-1\" \n :class=\"['relative flex flex-col bg-card overflow-hidden focus:outline-none', containerRadiusClass, bordered ? 'border border-border' : '']\" \n :style=\"{ maxHeight: toCssLength(maxHeight) }\"\n @keydown=\"handleKeydown\" \n > \n <slot name=\"header\" :label=\"headerLabel\" :goToToday=\"handleToday\" :prev=\"handlePrev\" :next=\"handleNext\" :prevYear=\"handlePrevYear\" :nextYear=\"handleNextYear\"> \n <CalendarHeader \n :label=\"headerLabel\" \n :showHeader=\"showHeader\" \n :showYearJump=\"showYearNavigation\" \n :showTodayButton=\"showTodayButton\" \n :showMonthYearSelects=\"showMonthYearSelects\" \n :monthOptions=\"monthOptions\" \n :yearOptions=\"yearOptions\" \n v-model:selectedMonth=\"selectedMonth\" \n v-model:selectedYear=\"selectedYear\" \n :color=\"resolvedColor\" \n :focusRingColorClass=\"focusRingColorClass\" \n :todayTextClass=\"todayTextClass\" \n :todayRadiusClass=\"pillRadiusClass\" \n :dayNameCaseClass=\"dayNameCaseClass\" \n @prev=\"handlePrev\" \n @next=\"handleNext\" \n @prevYear=\"handlePrevYear\" \n @nextYear=\"handleNextYear\" \n @today=\"handleToday\" \n /> \n </slot> \n \n <div ref=\"scrollRef\" class=\"flex-1 overflow-y-auto\" @scroll=\"onScroll\"> \n <div v-if=\"!groups.length\" class=\"flex-1 flex items-center justify-center py-12 text-sm text-muted-foreground\"> \n <slot name=\"empty\">{{ emptyText ?? loc.agenda.empty }}</slot> \n </div> \n \n <template v-for=\"(g, gi) in groups\" :key=\"g.key\"> \n <div \n v-if=\"showMonthSeparator && g.showMonthHeader\" \n class=\"sticky top-0 z-20 bg-card/95 backdrop-blur px-4 py-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground border-b border-border\" \n > \n {{ g.monthLabel }} \n </div> \n \n <div \n :data-dkey=\"g.key\" \n :class=\"[ \n 'grid border-b border-border transition-colors', \n g.isToday ? 'bg-muted/40' : '', \n g.disabled ? 'opacity-60' : '', \n ]\" \n style=\"grid-template-columns: 5rem 1fr;\" \n > \n <div class=\"flex flex-col items-center justify-start py-4 border-r border-border\"> \n <slot name=\"day-header\" :date=\"g.date\" :isToday=\"g.isToday\" :events=\"g.events\"> \n <span :class=\"['text-[10px] font-medium tracking-wider text-muted-foreground', dayNameCaseClass]\">{{ g.weekdayLabel }}</span> \n <span \n :class=\"[ \n 'mt-1 inline-flex items-center justify-center text-base font-semibold w-9 h-9', \n pillRadiusClass, \n g.isToday ? [todayBgClass] : 'text-foreground', \n ]\" \n >{{ g.day }}</span> \n <span v-if=\"isHighlightedDate(g.date)\" :class=\"['mt-1 w-1 h-1 rounded-full', highlightDotClass]\"></span> \n </slot> \n </div> \n \n <div class=\"py-2 px-3\"> \n <div v-if=\"!g.events.length\" class=\"py-2 text-xs text-muted-foreground/60 italic\"> \n No events \n </div> \n <div v-else class=\"flex flex-col\"> \n <button \n v-for=\"ev in g.events\" \n :key=\"`${g.key}-${ev.id}`\" \n :data-eid=\"ev.id\" \n type=\"button\" \n @click=\"handleEventClick(ev, $event)\" \n @mouseenter=\"onEventEnter(ev, !!ev.allDay, $event)\" \n @mousemove=\"onEventMove\" \n @mouseleave=\"onEventLeave\" \n :class=\"['group flex items-start gap-3 py-2 px-2 -mx-2 cursor-pointer transition-colors hover:bg-muted/70 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-ring', eventRadiusClass]\" \n > \n <span class=\"shrink-0 w-16 pt-0.5 text-[11px] font-medium text-muted-foreground tabular-nums\"> \n <template v-if=\"ev.allDay\">All day</template> \n <template v-else>{{ formatEventTime(ev.start) }}</template> \n </span> \n <span \n class=\"shrink-0 mt-1.5 w-2 h-2\" \n :style=\"ev.colorHex ? { backgroundColor: ev.colorHex } : undefined\" \n :class=\"[pillRadiusClass, !ev.colorHex ? dotColorClass(ev.color) : '']\" \n ></span> \n <span class=\"flex-1 min-w-0\"> \n <slot name=\"event\" :event=\"ev\"> \n <span class=\"block text-sm font-medium text-foreground truncate\">{{ ev.title }}</span> \n <span v-if=\"!ev.allDay && ev.end\" class=\"block text-[11px] text-muted-foreground\"> \n {{ formatEventTime(ev.start) }} – {{ formatEventTime(ev.end) }} \n </span> \n <span v-if=\"ev.description\" class=\"block text-xs text-muted-foreground truncate mt-0.5\">{{ ev.description }}</span> \n </slot> \n </span> \n <span v-if=\"ev.readonly\" class=\"shrink-0 mt-0.5 text-[9px] uppercase tracking-wider text-muted-foreground border border-border px-1 rounded\">Locked</span> \n </button> \n </div> \n </div> \n </div> \n <div v-if=\"gi === groups.length - 1\" class=\"h-1\"></div> \n </template> \n </div> \n \n <CalendarEventTooltip :state=\"hoverState\" :style=\"tooltipStyle\" :formatTime=\"formatEventTime\"> \n <template #default=\"{ event, allDay }\"> \n <slot name=\"event-tooltip\" :event=\"event\" :allDay=\"allDay\" /> \n </template> \n </CalendarEventTooltip> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { ref, computed, watch, nextTick, onMounted } from 'vue'; \nimport gsap from 'gsap'; \nimport { isSameDay, startOfDay } from '../../../composables/useCalendar'; \nimport { useCalendarTheme } from '../../../composables/useCalendarTheme'; \nimport { useModoLocale } from '../../../composables/useModoConfig'; \n \nconst loc = useModoLocale(); \nimport { useEventHover } from '../../../composables/useEventHover'; \nimport CalendarEventTooltip from './CalendarEventTooltip.vue'; \nimport CalendarHeader from './CalendarHeader.vue'; \nimport type { AgendaView } from '../../../interfaces/data-display/calendar/AgendaView.interface'; \nimport type { CalendarEvent } from '../../../interfaces/data-display/calendar/MonthView.interface'; \n \nimport { toCssLength } from '../../../utils/cssLength';\n\nconst props = withDefaults(defineProps<AgendaView>(), { \n modelValue: () => new Date(), \n events: () => [], \n locale: 'default', \n color: 'default', \n bordered: true, \n daysToShow: 30, \n daysBefore: 0, \n showEmptyDays: false, \n showHeader: true, \n showMonthSeparator: true, \n showYearNavigation: false, \n showMonthYearSelects: false, \n showTodayButton: true, \n dayNameFormat: 'short', \n dayNameCase: 'upper', \n format: '24h', \n readonly: false, \n highlightedDates: () => [], \n disabledDates: () => [], \n disabledWeekdays: () => [], \n // emptyText resolves against locale when not provided. \n loadMoreChunk: 30, \n enableKeyboardNavigation: true, \n}); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [date: Date]; \n 'event-click': [event: CalendarEvent, nativeEvent: MouseEvent]; \n 'day-click': [date: Date, events: CalendarEvent[], nativeEvent: MouseEvent]; \n 'create-event': [date: Date, allDay: boolean, nativeEvent: MouseEvent | KeyboardEvent]; \n 'load-more': [direction: 'forward' | 'backward']; \n}>(); \n \nconst firstOfMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth(), 1); \nconst daysInMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate(); \n \nconst anchorDate = ref(firstOfMonth(new Date(props.modelValue))); \nconst daysForwardShown = ref(Math.max(props.daysToShow, daysInMonth(anchorDate.value))); \n \nwatch(() => props.modelValue, (v) => { \n if (!v) return; \n const f = firstOfMonth(new Date(v)); \n if (f.getTime() === anchorDate.value.getTime()) return; \n anchorDate.value = f; \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(f)); \n}); \nwatch(() => props.daysToShow, (n) => { daysForwardShown.value = Math.max(n, daysInMonth(anchorDate.value)); }); \n \nconst rootRef = ref<HTMLElement | null>(null); \nconst scrollRef = ref<HTMLElement | null>(null); \nconst today = new Date(); \n \nconst { hoverState, onEventEnter, onEventMove, onEventLeave, tooltipStyle } = useEventHover<CalendarEvent>(); \n \nconst formatEventTime = (d: Date) => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n return d.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', hour12: props.format === '12h' }); \n}; \n \nconst isHighlightedDate = (d: Date) => props.highlightedDates.some(h => isSameDay(h, d)); \nconst isDisabledDate = (d: Date) => props.disabledDates.some(x => isSameDay(x, d)); \nconst isDisabledWeekday = (d: Date) => props.disabledWeekdays.includes(d.getDay()); \nconst isDayDisabled = (d: Date) => { \n if (props.minDate && startOfDay(d) < startOfDay(props.minDate)) return true; \n if (props.maxDate && startOfDay(d) > startOfDay(props.maxDate)) return true; \n return isDisabledDate(d) || isDisabledWeekday(d); \n}; \n \ninterface DayGroup { \n key: string; \n date: Date; \n day: number; \n weekdayLabel: string; \n monthLabel: string; \n showMonthHeader: boolean; \n isToday: boolean; \n disabled: boolean; \n events: CalendarEvent[]; \n} \n \nconst rangeDates = computed<Date[]>(() => { \n const anchor = anchorDate.value; \n const list: Date[] = []; \n for (let i = 0; i < daysForwardShown.value; i++) { \n const d = new Date(anchor); \n d.setDate(d.getDate() + i); \n const sod = startOfDay(d); \n if (props.minDate && sod < startOfDay(props.minDate)) continue; \n if (props.maxDate && sod > startOfDay(props.maxDate)) continue; \n list.push(sod); \n } \n return list; \n}); \n \nconst eventsByDay = computed<Map<string, CalendarEvent[]>>(() => { \n const map = new Map<string, CalendarEvent[]>(); \n for (const ev of props.events) { \n const s = startOfDay(ev.start); \n const e = startOfDay(ev.end ?? ev.start); \n const d = new Date(s); \n while (d.getTime() <= e.getTime()) { \n const k = d.toDateString(); \n if (!map.has(k)) map.set(k, []); \n map.get(k)!.push(ev); \n d.setDate(d.getDate() + 1); \n } \n } \n for (const list of map.values()) { \n list.sort((a, b) => { \n if (a.allDay && !b.allDay) return -1; \n if (!a.allDay && b.allDay) return 1; \n return a.start.getTime() - b.start.getTime(); \n }); \n } \n return map; \n}); \n \nconst isoKey = (d: Date) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`; \nconst parseIsoKey = (s: string): Date | null => { \n const m = s.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/); \n if (!m) return null; \n return new Date(parseInt(m[1]), parseInt(m[2]) - 1, parseInt(m[3])); \n}; \n \nconst groups = computed<DayGroup[]>(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const result: DayGroup[] = []; \n let lastMonthKey = ''; \n for (const date of rangeDates.value) { \n const key = isoKey(date); \n const evts = eventsByDay.value.get(date.toDateString()) ?? []; \n if (!props.showEmptyDays && !evts.length) continue; \n const monthKey = `${date.getFullYear()}-${date.getMonth()}`; \n const showMonthHeader = monthKey !== lastMonthKey; \n lastMonthKey = monthKey; \n result.push({ \n key, \n date, \n day: date.getDate(), \n weekdayLabel: date.toLocaleDateString(locale, { weekday: props.dayNameFormat }), \n monthLabel: date.toLocaleDateString(locale, { month: 'long', year: 'numeric' }), \n showMonthHeader, \n isToday: isSameDay(date, today), \n disabled: isDayDisabled(date), \n events: evts, \n }); \n } \n return result; \n}); \n \nconst headerLabel = computed(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const d = visibleDate.value ?? anchorDate.value; \n return d.toLocaleDateString(locale, { month: 'long', year: 'numeric' }); \n}); \n \nconst handleEventClick = (ev: CalendarEvent, e: MouseEvent) => { \n emit('event-click', ev, e); \n}; \n \nconst afterNavigate = (scrollTarget?: Date, animateScroll = false) => { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) { animateIn(); return; } \n const scEl = scrollRef.value; \n let target = 0; \n if (scrollTarget) { \n const key = isoKey(startOfDay(scrollTarget)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n } \n } \n if (animateScroll && target > 0) { \n scEl.scrollTop = 0; \n animateIn(); \n gsap.to(scEl, { scrollTop: target, duration: 0.7, ease: 'power3.inOut', delay: 0.15 }); \n } else { \n scEl.scrollTop = target; \n animateIn(); \n } \n visibleDate.value = anchorDate.value; \n }); \n}; \nconst handlePrev = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNext = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleToday = () => { \n const n = new Date(); \n const wasCurrentMonth = firstOfMonth(n).getTime() === anchorDate.value.getTime(); \n anchorDate.value = firstOfMonth(n); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(n, !wasCurrentMonth); \n if (wasCurrentMonth && scrollRef.value && rootRef.value) { \n nextTick(() => { \n const key = isoKey(startOfDay(n)); \n const el = rootRef.value!.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value!.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value!.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value!, { scrollTop: target, duration: 0.6, ease: 'power3.inOut' }); \n }); \n } \n}; \nconst handlePrevYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNextYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \n \nconst animateIn = () => { \n if (!rootRef.value) return; \n const els = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n if (!els.length) return; \n gsap.fromTo( \n els, \n { opacity: 0, y: 8 }, \n { opacity: 1, y: 0, duration: 0.35, ease: 'power2.out', stagger: { amount: 0.2 } } \n ); \n}; \n \nlet loadingMore = false; \nconst visibleDate = ref<Date | null>(null); \nconst canExtend = () => { \n if (!props.maxDate) return true; \n const last = rangeDates.value[rangeDates.value.length - 1]; \n return !(last && startOfDay(last) >= startOfDay(props.maxDate)); \n}; \nconst onScroll = () => { \n if (!scrollRef.value) return; \n const el = scrollRef.value; \n if (rootRef.value) { \n const scRect = el.getBoundingClientRect(); \n const headers = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n let pick: Date | null = null; \n for (const h of headers) { \n const r = h.getBoundingClientRect(); \n if (r.bottom > scRect.top + 8) { \n const k = h.getAttribute('data-dkey'); \n if (k) pick = parseIsoKey(k); \n break; \n } \n } \n if (pick) visibleDate.value = pick; \n } \n if (loadingMore) return; \n const remaining = el.scrollHeight - (el.scrollTop + el.clientHeight); \n if (remaining < 120) { \n if (!canExtend()) return; \n loadingMore = true; \n daysForwardShown.value += props.loadMoreChunk; \n emit('load-more', 'forward'); \n setTimeout(() => { loadingMore = false; }, 120); \n } \n}; \n \nconst handleKeydown = (e: KeyboardEvent) => { \n if (!props.enableKeyboardNavigation) return; \n const target = e.target as HTMLElement; \n if (target.tagName === 'SELECT' || target.tagName === 'INPUT') return; \n if (e.key === 'ArrowLeft' || e.key === 'PageUp') { e.preventDefault(); handlePrev(); } \n else if (e.key === 'ArrowRight' || e.key === 'PageDown') { e.preventDefault(); handleNext(); } \n else if (e.key.toLowerCase() === 't') { e.preventDefault(); handleToday(); } \n}; \n \nonMounted(() => { \n nextTick(() => { \n visibleDate.value = anchorDate.value; \n animateIn(); \n if (scrollRef.value && rootRef.value) { \n const todayMonth = firstOfMonth(today); \n if (todayMonth.getTime() === anchorDate.value.getTime()) { \n const key = isoKey(startOfDay(today)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scEl = scrollRef.value; \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n if (target > 0) { \n gsap.to(scEl, { scrollTop: target, duration: 0.9, ease: 'power3.inOut', delay: 0.25 }); \n } \n } \n } \n } \n }); \n}); \n \ndefineExpose({ \n scrollToDate(date: Date) { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) return; \n const key = isoKey(startOfDay(date)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value, { scrollTop: target, duration: 0.45, ease: 'power3.inOut' }); \n }); \n }, \n}); \n \nconst { todayTextClass, dayNameCaseClass, focusRingColorClass, highlightDotClass, containerRadiusClass, eventRadiusClass, pillRadiusClass, todayBgClass, resolvedColor } = useCalendarTheme({ \n color: () => props.color, \n radius: () => props.radius, \n dayNameCase: () => props.dayNameCase, \n}); \n \nconst DOT_THEMED: Record<string, string> = { \n default: 'bg-muted-foreground', \n primary: 'bg-primary', \n danger: 'bg-destructive', \n success: 'bg-success', \n warning: 'bg-warning', \n}; \nconst DOT_SEMANTIC: Record<string, string> = { \n info: 'bg-info', \n purple: 'bg-purple', \n pink: 'bg-pink', \n}; \nconst dotColorClass = (c?: CalendarEvent['color']) => { \n if (!c) return DOT_THEMED.default; \n return DOT_THEMED[c] ?? DOT_SEMANTIC[c] ?? DOT_THEMED.default; \n}; \n \nconst localeValue = computed(() => (props.locale === 'default' ? undefined : props.locale)); \n \nconst monthOptions = computed(() => { \n const base = new Date(2024, 0, 1); \n return Array.from({ length: 12 }, (_, i) => { \n const d = new Date(base); \n d.setMonth(i); \n return d.toLocaleString(localeValue.value, { month: 'long' }); \n }); \n}); \n \nconst yearOptions = computed(() => { \n const min = props.minDate?.getFullYear() ?? anchorDate.value.getFullYear() - 10; \n const max = props.maxDate?.getFullYear() ?? anchorDate.value.getFullYear() + 10; \n const list: number[] = []; \n for (let y = min; y <= max; y++) list.push(y); \n return list; \n}); \n \nconst selectedMonth = computed({ \n get: () => anchorDate.value.getMonth(), \n set: (mm: number) => { \n const d = new Date(anchorDate.value); \n d.setDate(1); \n d.setMonth(mm); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n \nconst selectedYear = computed({ \n get: () => anchorDate.value.getFullYear(), \n set: (yy: number) => { \n const d = new Date(anchorDate.value); \n d.setFullYear(yy); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n</script>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgendaView.mjs","names":[],"sources":["../../../../src/components/data-display/calendar/AgendaView.vue"],"sourcesContent":["<template> \n <div \n ref=\"rootRef\" \n tabindex=\"-1\" \n :class=\"['relative flex flex-col bg-card overflow-hidden focus:outline-none', containerRadiusClass, bordered ? 'border border-border' : '']\" \n @keydown=\"handleKeydown\" \n > \n <slot name=\"header\" :label=\"headerLabel\" :goToToday=\"handleToday\" :prev=\"handlePrev\" :next=\"handleNext\" :prevYear=\"handlePrevYear\" :nextYear=\"handleNextYear\"> \n <CalendarHeader \n :label=\"headerLabel\" \n :showHeader=\"showHeader\" \n :showYearJump=\"showYearNavigation\" \n :showTodayButton=\"showTodayButton\" \n :showMonthYearSelects=\"showMonthYearSelects\" \n :monthOptions=\"monthOptions\" \n :yearOptions=\"yearOptions\" \n v-model:selectedMonth=\"selectedMonth\" \n v-model:selectedYear=\"selectedYear\" \n :color=\"resolvedColor\" \n :focusRingColorClass=\"focusRingColorClass\" \n :todayTextClass=\"todayTextClass\" \n :todayRadiusClass=\"pillRadiusClass\" \n :dayNameCaseClass=\"dayNameCaseClass\" \n @prev=\"handlePrev\" \n @next=\"handleNext\" \n @prevYear=\"handlePrevYear\" \n @nextYear=\"handleNextYear\" \n @today=\"handleToday\" \n /> \n </slot> \n \n <div ref=\"scrollRef\" class=\"flex-1 overflow-y-auto\" @scroll=\"onScroll\"> \n <div v-if=\"!groups.length\" class=\"flex-1 flex items-center justify-center py-12 text-sm text-muted-foreground\"> \n <slot name=\"empty\">{{ emptyText ?? loc.agenda.empty }}</slot> \n </div> \n \n <template v-for=\"(g, gi) in groups\" :key=\"g.key\"> \n <div \n v-if=\"showMonthSeparator && g.showMonthHeader\" \n class=\"sticky top-0 z-20 bg-card/95 backdrop-blur px-4 py-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground border-b border-border\" \n > \n {{ g.monthLabel }} \n </div> \n \n <div \n :data-dkey=\"g.key\" \n :class=\"[ \n 'grid border-b border-border transition-colors', \n g.isToday ? 'bg-muted/40' : '', \n g.disabled ? 'opacity-60' : '', \n ]\" \n style=\"grid-template-columns: 5rem 1fr;\" \n > \n <div class=\"flex flex-col items-center justify-start py-4 border-r border-border\"> \n <slot name=\"day-header\" :date=\"g.date\" :isToday=\"g.isToday\" :events=\"g.events\"> \n <span :class=\"['text-[10px] font-medium tracking-wider text-muted-foreground', dayNameCaseClass]\">{{ g.weekdayLabel }}</span> \n <span \n :class=\"[ \n 'mt-1 inline-flex items-center justify-center text-base font-semibold w-9 h-9', \n pillRadiusClass, \n g.isToday ? [todayBgClass] : 'text-foreground', \n ]\" \n >{{ g.day }}</span> \n <span v-if=\"isHighlightedDate(g.date)\" :class=\"['mt-1 w-1 h-1 rounded-full', highlightDotClass]\"></span> \n </slot> \n </div> \n \n <div class=\"py-2 px-3\"> \n <div v-if=\"!g.events.length\" class=\"py-2 text-xs text-muted-foreground/60 italic\"> \n No events \n </div> \n <div v-else class=\"flex flex-col\"> \n <button \n v-for=\"ev in g.events\" \n :key=\"`${g.key}-${ev.id}`\" \n :data-eid=\"ev.id\" \n type=\"button\" \n @click=\"handleEventClick(ev, $event)\" \n @mouseenter=\"onEventEnter(ev, !!ev.allDay, $event)\" \n @mousemove=\"onEventMove\" \n @mouseleave=\"onEventLeave\" \n :class=\"['group flex items-start gap-3 py-2 px-2 -mx-2 cursor-pointer transition-colors hover:bg-muted/70 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-ring', eventRadiusClass]\" \n > \n <span class=\"shrink-0 w-16 pt-0.5 text-[11px] font-medium text-muted-foreground tabular-nums\"> \n <template v-if=\"ev.allDay\">All day</template> \n <template v-else>{{ formatEventTime(ev.start) }}</template> \n </span> \n <span \n class=\"shrink-0 mt-1.5 w-2 h-2\" \n :style=\"ev.colorHex ? { backgroundColor: ev.colorHex } : undefined\" \n :class=\"[pillRadiusClass, !ev.colorHex ? dotColorClass(ev.color) : '']\" \n ></span> \n <span class=\"flex-1 min-w-0\"> \n <slot name=\"event\" :event=\"ev\"> \n <span class=\"block text-sm font-medium text-foreground truncate\">{{ ev.title }}</span> \n <span v-if=\"!ev.allDay && ev.end\" class=\"block text-[11px] text-muted-foreground\"> \n {{ formatEventTime(ev.start) }} – {{ formatEventTime(ev.end) }} \n </span> \n <span v-if=\"ev.description\" class=\"block text-xs text-muted-foreground truncate mt-0.5\">{{ ev.description }}</span> \n </slot> \n </span> \n <span v-if=\"ev.readonly\" class=\"shrink-0 mt-0.5 text-[9px] uppercase tracking-wider text-muted-foreground border border-border px-1 rounded\">Locked</span> \n </button> \n </div> \n </div> \n </div> \n <div v-if=\"gi === groups.length - 1\" class=\"h-1\"></div> \n </template> \n </div> \n \n <CalendarEventTooltip :state=\"hoverState\" :style=\"tooltipStyle\" :formatTime=\"formatEventTime\"> \n <template #default=\"{ event, allDay }\"> \n <slot name=\"event-tooltip\" :event=\"event\" :allDay=\"allDay\" /> \n </template> \n </CalendarEventTooltip> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { ref, computed, watch, nextTick, onMounted } from 'vue'; \nimport gsap from 'gsap'; \nimport { isSameDay, startOfDay } from '../../../composables/useCalendar'; \nimport { useCalendarTheme } from '../../../composables/useCalendarTheme'; \nimport { useModoLocale } from '../../../composables/useModoConfig'; \n \nconst loc = useModoLocale(); \nimport { useEventHover } from '../../../composables/useEventHover'; \nimport CalendarEventTooltip from './CalendarEventTooltip.vue'; \nimport CalendarHeader from './CalendarHeader.vue'; \nimport type { AgendaView } from '../../../interfaces/data-display/calendar/AgendaView.interface'; \nimport type { CalendarEvent } from '../../../interfaces/data-display/calendar/MonthView.interface'; \n \nconst props = withDefaults(defineProps<AgendaView>(), { \n modelValue: () => new Date(), \n events: () => [], \n locale: 'default', \n color: 'default', \n bordered: true, \n daysToShow: 30, \n daysBefore: 0, \n showEmptyDays: false, \n showHeader: true, \n showMonthSeparator: true, \n showYearNavigation: false, \n showMonthYearSelects: false, \n showTodayButton: true, \n dayNameFormat: 'short', \n dayNameCase: 'upper', \n format: '24h', \n readonly: false, \n highlightedDates: () => [], \n disabledDates: () => [], \n disabledWeekdays: () => [], \n // emptyText resolves against locale when not provided. \n loadMoreChunk: 30, \n enableKeyboardNavigation: true, \n}); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [date: Date]; \n 'event-click': [event: CalendarEvent, nativeEvent: MouseEvent]; \n 'day-click': [date: Date, events: CalendarEvent[], nativeEvent: MouseEvent]; \n 'create-event': [date: Date, allDay: boolean, nativeEvent: MouseEvent | KeyboardEvent]; \n 'load-more': [direction: 'forward' | 'backward']; \n}>(); \n \nconst firstOfMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth(), 1); \nconst daysInMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate(); \n \nconst anchorDate = ref(firstOfMonth(new Date(props.modelValue))); \nconst daysForwardShown = ref(Math.max(props.daysToShow, daysInMonth(anchorDate.value))); \n \nwatch(() => props.modelValue, (v) => { \n if (!v) return; \n const f = firstOfMonth(new Date(v)); \n if (f.getTime() === anchorDate.value.getTime()) return; \n anchorDate.value = f; \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(f)); \n}); \nwatch(() => props.daysToShow, (n) => { daysForwardShown.value = Math.max(n, daysInMonth(anchorDate.value)); }); \n \nconst rootRef = ref<HTMLElement | null>(null); \nconst scrollRef = ref<HTMLElement | null>(null); \nconst today = new Date(); \n \nconst { hoverState, onEventEnter, onEventMove, onEventLeave, tooltipStyle } = useEventHover<CalendarEvent>(); \n \nconst formatEventTime = (d: Date) => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n return d.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', hour12: props.format === '12h' }); \n}; \n \nconst isHighlightedDate = (d: Date) => props.highlightedDates.some(h => isSameDay(h, d)); \nconst isDisabledDate = (d: Date) => props.disabledDates.some(x => isSameDay(x, d)); \nconst isDisabledWeekday = (d: Date) => props.disabledWeekdays.includes(d.getDay()); \nconst isDayDisabled = (d: Date) => { \n if (props.minDate && startOfDay(d) < startOfDay(props.minDate)) return true; \n if (props.maxDate && startOfDay(d) > startOfDay(props.maxDate)) return true; \n return isDisabledDate(d) || isDisabledWeekday(d); \n}; \n \ninterface DayGroup { \n key: string; \n date: Date; \n day: number; \n weekdayLabel: string; \n monthLabel: string; \n showMonthHeader: boolean; \n isToday: boolean; \n disabled: boolean; \n events: CalendarEvent[]; \n} \n \nconst rangeDates = computed<Date[]>(() => { \n const anchor = anchorDate.value; \n const list: Date[] = []; \n for (let i = 0; i < daysForwardShown.value; i++) { \n const d = new Date(anchor); \n d.setDate(d.getDate() + i); \n const sod = startOfDay(d); \n if (props.minDate && sod < startOfDay(props.minDate)) continue; \n if (props.maxDate && sod > startOfDay(props.maxDate)) continue; \n list.push(sod); \n } \n return list; \n}); \n \nconst eventsByDay = computed<Map<string, CalendarEvent[]>>(() => { \n const map = new Map<string, CalendarEvent[]>(); \n for (const ev of props.events) { \n const s = startOfDay(ev.start); \n const e = startOfDay(ev.end ?? ev.start); \n const d = new Date(s); \n while (d.getTime() <= e.getTime()) { \n const k = d.toDateString(); \n if (!map.has(k)) map.set(k, []); \n map.get(k)!.push(ev); \n d.setDate(d.getDate() + 1); \n } \n } \n for (const list of map.values()) { \n list.sort((a, b) => { \n if (a.allDay && !b.allDay) return -1; \n if (!a.allDay && b.allDay) return 1; \n return a.start.getTime() - b.start.getTime(); \n }); \n } \n return map; \n}); \n \nconst isoKey = (d: Date) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`; \nconst parseIsoKey = (s: string): Date | null => { \n const m = s.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/); \n if (!m) return null; \n return new Date(parseInt(m[1]), parseInt(m[2]) - 1, parseInt(m[3])); \n}; \n \nconst groups = computed<DayGroup[]>(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const result: DayGroup[] = []; \n let lastMonthKey = ''; \n for (const date of rangeDates.value) { \n const key = isoKey(date); \n const evts = eventsByDay.value.get(date.toDateString()) ?? []; \n if (!props.showEmptyDays && !evts.length) continue; \n const monthKey = `${date.getFullYear()}-${date.getMonth()}`; \n const showMonthHeader = monthKey !== lastMonthKey; \n lastMonthKey = monthKey; \n result.push({ \n key, \n date, \n day: date.getDate(), \n weekdayLabel: date.toLocaleDateString(locale, { weekday: props.dayNameFormat }), \n monthLabel: date.toLocaleDateString(locale, { month: 'long', year: 'numeric' }), \n showMonthHeader, \n isToday: isSameDay(date, today), \n disabled: isDayDisabled(date), \n events: evts, \n }); \n } \n return result; \n}); \n \nconst headerLabel = computed(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const d = visibleDate.value ?? anchorDate.value; \n return d.toLocaleDateString(locale, { month: 'long', year: 'numeric' }); \n}); \n \nconst handleEventClick = (ev: CalendarEvent, e: MouseEvent) => { \n emit('event-click', ev, e); \n}; \n \nconst afterNavigate = (scrollTarget?: Date, animateScroll = false) => { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) { animateIn(); return; } \n const scEl = scrollRef.value; \n let target = 0; \n if (scrollTarget) { \n const key = isoKey(startOfDay(scrollTarget)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n } \n } \n if (animateScroll && target > 0) { \n scEl.scrollTop = 0; \n animateIn(); \n gsap.to(scEl, { scrollTop: target, duration: 0.7, ease: 'power3.inOut', delay: 0.15 }); \n } else { \n scEl.scrollTop = target; \n animateIn(); \n } \n visibleDate.value = anchorDate.value; \n }); \n}; \nconst handlePrev = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNext = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleToday = () => { \n const n = new Date(); \n const wasCurrentMonth = firstOfMonth(n).getTime() === anchorDate.value.getTime(); \n anchorDate.value = firstOfMonth(n); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(n, !wasCurrentMonth); \n if (wasCurrentMonth && scrollRef.value && rootRef.value) { \n nextTick(() => { \n const key = isoKey(startOfDay(n)); \n const el = rootRef.value!.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value!.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value!.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value!, { scrollTop: target, duration: 0.6, ease: 'power3.inOut' }); \n }); \n } \n}; \nconst handlePrevYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNextYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \n \nconst animateIn = () => { \n if (!rootRef.value) return; \n const els = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n if (!els.length) return; \n gsap.fromTo( \n els, \n { opacity: 0, y: 8 }, \n { opacity: 1, y: 0, duration: 0.35, ease: 'power2.out', stagger: { amount: 0.2 } } \n ); \n}; \n \nlet loadingMore = false; \nconst visibleDate = ref<Date | null>(null); \nconst canExtend = () => { \n if (!props.maxDate) return true; \n const last = rangeDates.value[rangeDates.value.length - 1]; \n return !(last && startOfDay(last) >= startOfDay(props.maxDate)); \n}; \nconst onScroll = () => { \n if (!scrollRef.value) return; \n const el = scrollRef.value; \n if (rootRef.value) { \n const scRect = el.getBoundingClientRect(); \n const headers = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n let pick: Date | null = null; \n for (const h of headers) { \n const r = h.getBoundingClientRect(); \n if (r.bottom > scRect.top + 8) { \n const k = h.getAttribute('data-dkey'); \n if (k) pick = parseIsoKey(k); \n break; \n } \n } \n if (pick) visibleDate.value = pick; \n } \n if (loadingMore) return; \n const remaining = el.scrollHeight - (el.scrollTop + el.clientHeight); \n if (remaining < 120) { \n if (!canExtend()) return; \n loadingMore = true; \n daysForwardShown.value += props.loadMoreChunk; \n emit('load-more', 'forward'); \n setTimeout(() => { loadingMore = false; }, 120); \n } \n}; \n \nconst handleKeydown = (e: KeyboardEvent) => { \n if (!props.enableKeyboardNavigation) return; \n const target = e.target as HTMLElement; \n if (target.tagName === 'SELECT' || target.tagName === 'INPUT') return; \n if (e.key === 'ArrowLeft' || e.key === 'PageUp') { e.preventDefault(); handlePrev(); } \n else if (e.key === 'ArrowRight' || e.key === 'PageDown') { e.preventDefault(); handleNext(); } \n else if (e.key.toLowerCase() === 't') { e.preventDefault(); handleToday(); } \n}; \n \nonMounted(() => { \n nextTick(() => { \n visibleDate.value = anchorDate.value; \n animateIn(); \n if (scrollRef.value && rootRef.value) { \n const todayMonth = firstOfMonth(today); \n if (todayMonth.getTime() === anchorDate.value.getTime()) { \n const key = isoKey(startOfDay(today)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scEl = scrollRef.value; \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n if (target > 0) { \n gsap.to(scEl, { scrollTop: target, duration: 0.9, ease: 'power3.inOut', delay: 0.25 }); \n } \n } \n } \n } \n }); \n}); \n \ndefineExpose({ \n scrollToDate(date: Date) { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) return; \n const key = isoKey(startOfDay(date)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value, { scrollTop: target, duration: 0.45, ease: 'power3.inOut' }); \n }); \n }, \n}); \n \nconst { todayTextClass, dayNameCaseClass, focusRingColorClass, highlightDotClass, containerRadiusClass, eventRadiusClass, pillRadiusClass, todayBgClass, resolvedColor } = useCalendarTheme({ \n color: () => props.color, \n radius: () => props.radius, \n dayNameCase: () => props.dayNameCase, \n}); \n \nconst DOT_THEMED: Record<string, string> = { \n default: 'bg-muted-foreground', \n primary: 'bg-primary', \n danger: 'bg-destructive', \n success: 'bg-success', \n warning: 'bg-warning', \n}; \nconst DOT_SEMANTIC: Record<string, string> = { \n info: 'bg-info', \n purple: 'bg-purple', \n pink: 'bg-pink', \n}; \nconst dotColorClass = (c?: CalendarEvent['color']) => { \n if (!c) return DOT_THEMED.default; \n return DOT_THEMED[c] ?? DOT_SEMANTIC[c] ?? DOT_THEMED.default; \n}; \n \nconst localeValue = computed(() => (props.locale === 'default' ? undefined : props.locale)); \n \nconst monthOptions = computed(() => { \n const base = new Date(2024, 0, 1); \n return Array.from({ length: 12 }, (_, i) => { \n const d = new Date(base); \n d.setMonth(i); \n return d.toLocaleString(localeValue.value, { month: 'long' }); \n }); \n}); \n \nconst yearOptions = computed(() => { \n const min = props.minDate?.getFullYear() ?? anchorDate.value.getFullYear() - 10; \n const max = props.maxDate?.getFullYear() ?? anchorDate.value.getFullYear() + 10; \n const list: number[] = []; \n for (let y = min; y <= max; y++) list.push(y); \n return list; \n}); \n \nconst selectedMonth = computed({ \n get: () => anchorDate.value.getMonth(), \n set: (mm: number) => { \n const d = new Date(anchorDate.value); \n d.setDate(1); \n d.setMonth(mm); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n \nconst selectedYear = computed({ \n get: () => anchorDate.value.getFullYear(), \n set: (yy: number) => { \n const d = new Date(anchorDate.value); \n d.setFullYear(yy); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n</script>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"AgendaView.mjs","names":[],"sources":["../../../../src/components/data-display/calendar/AgendaView.vue"],"sourcesContent":["<template> \n <div \n ref=\"rootRef\" \n tabindex=\"-1\" \n :class=\"['relative flex flex-col bg-card overflow-hidden focus:outline-none', containerRadiusClass, bordered ? 'border border-border' : '']\" \n :style=\"{ maxHeight: toCssLength(maxHeight) }\"\n @keydown=\"handleKeydown\" \n > \n <slot name=\"header\" :label=\"headerLabel\" :goToToday=\"handleToday\" :prev=\"handlePrev\" :next=\"handleNext\" :prevYear=\"handlePrevYear\" :nextYear=\"handleNextYear\"> \n <CalendarHeader \n :label=\"headerLabel\" \n :showHeader=\"showHeader\" \n :showYearJump=\"showYearNavigation\" \n :showTodayButton=\"showTodayButton\" \n :showMonthYearSelects=\"showMonthYearSelects\" \n :monthOptions=\"monthOptions\" \n :yearOptions=\"yearOptions\" \n v-model:selectedMonth=\"selectedMonth\" \n v-model:selectedYear=\"selectedYear\" \n :color=\"resolvedColor\" \n :focusRingColorClass=\"focusRingColorClass\" \n :todayTextClass=\"todayTextClass\" \n :todayRadiusClass=\"pillRadiusClass\" \n :dayNameCaseClass=\"dayNameCaseClass\" \n @prev=\"handlePrev\" \n @next=\"handleNext\" \n @prevYear=\"handlePrevYear\" \n @nextYear=\"handleNextYear\" \n @today=\"handleToday\" \n /> \n </slot> \n \n <div ref=\"scrollRef\" class=\"flex-1 overflow-y-auto\" @scroll=\"onScroll\"> \n <div v-if=\"!groups.length\" class=\"flex-1 flex items-center justify-center py-12 text-sm text-muted-foreground\"> \n <slot name=\"empty\">{{ emptyText ?? loc.agenda.empty }}</slot> \n </div> \n \n <template v-for=\"(g, gi) in groups\" :key=\"g.key\"> \n <div \n v-if=\"showMonthSeparator && g.showMonthHeader\" \n class=\"sticky top-0 z-20 bg-card/95 backdrop-blur px-4 py-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground border-b border-border\" \n > \n {{ g.monthLabel }} \n </div> \n \n <div \n :data-dkey=\"g.key\" \n :class=\"[ \n 'grid border-b border-border transition-colors', \n g.isToday ? 'bg-muted/40' : '', \n g.disabled ? 'opacity-60' : '', \n ]\" \n style=\"grid-template-columns: 5rem 1fr;\" \n > \n <div class=\"flex flex-col items-center justify-start py-4 border-r border-border\"> \n <slot name=\"day-header\" :date=\"g.date\" :isToday=\"g.isToday\" :events=\"g.events\"> \n <span :class=\"['text-[10px] font-medium tracking-wider text-muted-foreground', dayNameCaseClass]\">{{ g.weekdayLabel }}</span> \n <span \n :class=\"[ \n 'mt-1 inline-flex items-center justify-center text-base font-semibold w-9 h-9', \n pillRadiusClass, \n g.isToday ? [todayBgClass] : 'text-foreground', \n ]\" \n >{{ g.day }}</span> \n <span v-if=\"isHighlightedDate(g.date)\" :class=\"['mt-1 w-1 h-1 rounded-full', highlightDotClass]\"></span> \n </slot> \n </div> \n \n <div class=\"py-2 px-3\"> \n <div v-if=\"!g.events.length\" class=\"py-2 text-xs text-muted-foreground/60 italic\"> \n No events \n </div> \n <div v-else class=\"flex flex-col\"> \n <button \n v-for=\"ev in g.events\" \n :key=\"`${g.key}-${ev.id}`\" \n :data-eid=\"ev.id\" \n type=\"button\" \n @click=\"handleEventClick(ev, $event)\" \n @mouseenter=\"onEventEnter(ev, !!ev.allDay, $event)\" \n @mousemove=\"onEventMove\" \n @mouseleave=\"onEventLeave\" \n :class=\"['group flex items-start gap-3 py-2 px-2 -mx-2 cursor-pointer transition-colors hover:bg-muted/70 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-ring', eventRadiusClass]\" \n > \n <span class=\"shrink-0 w-16 pt-0.5 text-[11px] font-medium text-muted-foreground tabular-nums\"> \n <template v-if=\"ev.allDay\">All day</template> \n <template v-else>{{ formatEventTime(ev.start) }}</template> \n </span> \n <span \n class=\"shrink-0 mt-1.5 w-2 h-2\" \n :style=\"ev.colorHex ? { backgroundColor: ev.colorHex } : undefined\" \n :class=\"[pillRadiusClass, !ev.colorHex ? dotColorClass(ev.color) : '']\" \n ></span> \n <span class=\"flex-1 min-w-0\"> \n <slot name=\"event\" :event=\"ev\"> \n <span class=\"block text-sm font-medium text-foreground truncate\">{{ ev.title }}</span> \n <span v-if=\"!ev.allDay && ev.end\" class=\"block text-[11px] text-muted-foreground\"> \n {{ formatEventTime(ev.start) }} – {{ formatEventTime(ev.end) }} \n </span> \n <span v-if=\"ev.description\" class=\"block text-xs text-muted-foreground truncate mt-0.5\">{{ ev.description }}</span> \n </slot> \n </span> \n <span v-if=\"ev.readonly\" class=\"shrink-0 mt-0.5 text-[9px] uppercase tracking-wider text-muted-foreground border border-border px-1 rounded\">Locked</span> \n </button> \n </div> \n </div> \n </div> \n <div v-if=\"gi === groups.length - 1\" class=\"h-1\"></div> \n </template> \n </div> \n \n <CalendarEventTooltip :state=\"hoverState\" :style=\"tooltipStyle\" :formatTime=\"formatEventTime\"> \n <template #default=\"{ event, allDay }\"> \n <slot name=\"event-tooltip\" :event=\"event\" :allDay=\"allDay\" /> \n </template> \n </CalendarEventTooltip> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { ref, computed, watch, nextTick, onMounted } from 'vue'; \nimport gsap from 'gsap'; \nimport { isSameDay, startOfDay } from '../../../composables/useCalendar'; \nimport { useCalendarTheme } from '../../../composables/useCalendarTheme'; \nimport { useModoLocale } from '../../../composables/useModoConfig'; \n \nconst loc = useModoLocale(); \nimport { useEventHover } from '../../../composables/useEventHover'; \nimport CalendarEventTooltip from './CalendarEventTooltip.vue'; \nimport CalendarHeader from './CalendarHeader.vue'; \nimport type { AgendaView } from '../../../interfaces/data-display/calendar/AgendaView.interface'; \nimport type { CalendarEvent } from '../../../interfaces/data-display/calendar/MonthView.interface'; \n \nimport { toCssLength } from '../../../utils/cssLength';\n\nconst props = withDefaults(defineProps<AgendaView>(), { \n modelValue: () => new Date(), \n events: () => [], \n locale: 'default', \n color: 'default', \n bordered: true, \n daysToShow: 30, \n daysBefore: 0, \n showEmptyDays: false, \n showHeader: true, \n showMonthSeparator: true, \n showYearNavigation: false, \n showMonthYearSelects: false, \n showTodayButton: true, \n dayNameFormat: 'short', \n dayNameCase: 'upper', \n format: '24h', \n readonly: false, \n highlightedDates: () => [], \n disabledDates: () => [], \n disabledWeekdays: () => [], \n // emptyText resolves against locale when not provided. \n loadMoreChunk: 30, \n enableKeyboardNavigation: true, \n}); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [date: Date]; \n 'event-click': [event: CalendarEvent, nativeEvent: MouseEvent]; \n 'day-click': [date: Date, events: CalendarEvent[], nativeEvent: MouseEvent]; \n 'create-event': [date: Date, allDay: boolean, nativeEvent: MouseEvent | KeyboardEvent]; \n 'load-more': [direction: 'forward' | 'backward']; \n}>(); \n \nconst firstOfMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth(), 1); \nconst daysInMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate(); \n \nconst anchorDate = ref(firstOfMonth(new Date(props.modelValue))); \nconst daysForwardShown = ref(Math.max(props.daysToShow, daysInMonth(anchorDate.value))); \n \nwatch(() => props.modelValue, (v) => { \n if (!v) return; \n const f = firstOfMonth(new Date(v)); \n if (f.getTime() === anchorDate.value.getTime()) return; \n anchorDate.value = f; \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(f)); \n}); \nwatch(() => props.daysToShow, (n) => { daysForwardShown.value = Math.max(n, daysInMonth(anchorDate.value)); }); \n \nconst rootRef = ref<HTMLElement | null>(null); \nconst scrollRef = ref<HTMLElement | null>(null); \nconst today = new Date(); \n \nconst { hoverState, onEventEnter, onEventMove, onEventLeave, tooltipStyle } = useEventHover<CalendarEvent>(); \n \nconst formatEventTime = (d: Date) => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n return d.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', hour12: props.format === '12h' }); \n}; \n \nconst isHighlightedDate = (d: Date) => props.highlightedDates.some(h => isSameDay(h, d)); \nconst isDisabledDate = (d: Date) => props.disabledDates.some(x => isSameDay(x, d)); \nconst isDisabledWeekday = (d: Date) => props.disabledWeekdays.includes(d.getDay()); \nconst isDayDisabled = (d: Date) => { \n if (props.minDate && startOfDay(d) < startOfDay(props.minDate)) return true; \n if (props.maxDate && startOfDay(d) > startOfDay(props.maxDate)) return true; \n return isDisabledDate(d) || isDisabledWeekday(d); \n}; \n \ninterface DayGroup { \n key: string; \n date: Date; \n day: number; \n weekdayLabel: string; \n monthLabel: string; \n showMonthHeader: boolean; \n isToday: boolean; \n disabled: boolean; \n events: CalendarEvent[]; \n} \n \nconst rangeDates = computed<Date[]>(() => { \n const anchor = anchorDate.value; \n const list: Date[] = []; \n for (let i = 0; i < daysForwardShown.value; i++) { \n const d = new Date(anchor); \n d.setDate(d.getDate() + i); \n const sod = startOfDay(d); \n if (props.minDate && sod < startOfDay(props.minDate)) continue; \n if (props.maxDate && sod > startOfDay(props.maxDate)) continue; \n list.push(sod); \n } \n return list; \n}); \n \nconst eventsByDay = computed<Map<string, CalendarEvent[]>>(() => { \n const map = new Map<string, CalendarEvent[]>(); \n for (const ev of props.events) { \n const s = startOfDay(ev.start); \n const e = startOfDay(ev.end ?? ev.start); \n const d = new Date(s); \n while (d.getTime() <= e.getTime()) { \n const k = d.toDateString(); \n if (!map.has(k)) map.set(k, []); \n map.get(k)!.push(ev); \n d.setDate(d.getDate() + 1); \n } \n } \n for (const list of map.values()) { \n list.sort((a, b) => { \n if (a.allDay && !b.allDay) return -1; \n if (!a.allDay && b.allDay) return 1; \n return a.start.getTime() - b.start.getTime(); \n }); \n } \n return map; \n}); \n \nconst isoKey = (d: Date) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`; \nconst parseIsoKey = (s: string): Date | null => { \n const m = s.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/); \n if (!m) return null; \n return new Date(parseInt(m[1]), parseInt(m[2]) - 1, parseInt(m[3])); \n}; \n \nconst groups = computed<DayGroup[]>(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const result: DayGroup[] = []; \n let lastMonthKey = ''; \n for (const date of rangeDates.value) { \n const key = isoKey(date); \n const evts = eventsByDay.value.get(date.toDateString()) ?? []; \n if (!props.showEmptyDays && !evts.length) continue; \n const monthKey = `${date.getFullYear()}-${date.getMonth()}`; \n const showMonthHeader = monthKey !== lastMonthKey; \n lastMonthKey = monthKey; \n result.push({ \n key, \n date, \n day: date.getDate(), \n weekdayLabel: date.toLocaleDateString(locale, { weekday: props.dayNameFormat }), \n monthLabel: date.toLocaleDateString(locale, { month: 'long', year: 'numeric' }), \n showMonthHeader, \n isToday: isSameDay(date, today), \n disabled: isDayDisabled(date), \n events: evts, \n }); \n } \n return result; \n}); \n \nconst headerLabel = computed(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const d = visibleDate.value ?? anchorDate.value; \n return d.toLocaleDateString(locale, { month: 'long', year: 'numeric' }); \n}); \n \nconst handleEventClick = (ev: CalendarEvent, e: MouseEvent) => { \n emit('event-click', ev, e); \n}; \n \nconst afterNavigate = (scrollTarget?: Date, animateScroll = false) => { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) { animateIn(); return; } \n const scEl = scrollRef.value; \n let target = 0; \n if (scrollTarget) { \n const key = isoKey(startOfDay(scrollTarget)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n } \n } \n if (animateScroll && target > 0) { \n scEl.scrollTop = 0; \n animateIn(); \n gsap.to(scEl, { scrollTop: target, duration: 0.7, ease: 'power3.inOut', delay: 0.15 }); \n } else { \n scEl.scrollTop = target; \n animateIn(); \n } \n visibleDate.value = anchorDate.value; \n }); \n}; \nconst handlePrev = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNext = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleToday = () => { \n const n = new Date(); \n const wasCurrentMonth = firstOfMonth(n).getTime() === anchorDate.value.getTime(); \n anchorDate.value = firstOfMonth(n); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(n, !wasCurrentMonth); \n if (wasCurrentMonth && scrollRef.value && rootRef.value) { \n nextTick(() => { \n const key = isoKey(startOfDay(n)); \n const el = rootRef.value!.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value!.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value!.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value!, { scrollTop: target, duration: 0.6, ease: 'power3.inOut' }); \n }); \n } \n}; \nconst handlePrevYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNextYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \n \nconst animateIn = () => { \n if (!rootRef.value) return; \n const els = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n if (!els.length) return; \n gsap.fromTo( \n els, \n { opacity: 0, y: 8 }, \n { opacity: 1, y: 0, duration: 0.35, ease: 'power2.out', stagger: { amount: 0.2 } } \n ); \n}; \n \nlet loadingMore = false; \nconst visibleDate = ref<Date | null>(null); \nconst canExtend = () => { \n if (!props.maxDate) return true; \n const last = rangeDates.value[rangeDates.value.length - 1]; \n return !(last && startOfDay(last) >= startOfDay(props.maxDate)); \n}; \nconst onScroll = () => { \n if (!scrollRef.value) return; \n const el = scrollRef.value; \n if (rootRef.value) { \n const scRect = el.getBoundingClientRect(); \n const headers = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n let pick: Date | null = null; \n for (const h of headers) { \n const r = h.getBoundingClientRect(); \n if (r.bottom > scRect.top + 8) { \n const k = h.getAttribute('data-dkey'); \n if (k) pick = parseIsoKey(k); \n break; \n } \n } \n if (pick) visibleDate.value = pick; \n } \n if (loadingMore) return; \n const remaining = el.scrollHeight - (el.scrollTop + el.clientHeight); \n if (remaining < 120) { \n if (!canExtend()) return; \n loadingMore = true; \n daysForwardShown.value += props.loadMoreChunk; \n emit('load-more', 'forward'); \n setTimeout(() => { loadingMore = false; }, 120); \n } \n}; \n \nconst handleKeydown = (e: KeyboardEvent) => { \n if (!props.enableKeyboardNavigation) return; \n const target = e.target as HTMLElement; \n if (target.tagName === 'SELECT' || target.tagName === 'INPUT') return; \n if (e.key === 'ArrowLeft' || e.key === 'PageUp') { e.preventDefault(); handlePrev(); } \n else if (e.key === 'ArrowRight' || e.key === 'PageDown') { e.preventDefault(); handleNext(); } \n else if (e.key.toLowerCase() === 't') { e.preventDefault(); handleToday(); } \n}; \n \nonMounted(() => { \n nextTick(() => { \n visibleDate.value = anchorDate.value; \n animateIn(); \n if (scrollRef.value && rootRef.value) { \n const todayMonth = firstOfMonth(today); \n if (todayMonth.getTime() === anchorDate.value.getTime()) { \n const key = isoKey(startOfDay(today)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scEl = scrollRef.value; \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n if (target > 0) { \n gsap.to(scEl, { scrollTop: target, duration: 0.9, ease: 'power3.inOut', delay: 0.25 }); \n } \n } \n } \n } \n }); \n}); \n \ndefineExpose({ \n scrollToDate(date: Date) { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) return; \n const key = isoKey(startOfDay(date)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value, { scrollTop: target, duration: 0.45, ease: 'power3.inOut' }); \n }); \n }, \n}); \n \nconst { todayTextClass, dayNameCaseClass, focusRingColorClass, highlightDotClass, containerRadiusClass, eventRadiusClass, pillRadiusClass, todayBgClass, resolvedColor } = useCalendarTheme({ \n color: () => props.color, \n radius: () => props.radius, \n dayNameCase: () => props.dayNameCase, \n}); \n \nconst DOT_THEMED: Record<string, string> = { \n default: 'bg-muted-foreground', \n primary: 'bg-primary', \n danger: 'bg-destructive', \n success: 'bg-success', \n warning: 'bg-warning', \n}; \nconst DOT_SEMANTIC: Record<string, string> = { \n info: 'bg-info', \n purple: 'bg-purple', \n pink: 'bg-pink', \n}; \nconst dotColorClass = (c?: CalendarEvent['color']) => { \n if (!c) return DOT_THEMED.default; \n return DOT_THEMED[c] ?? DOT_SEMANTIC[c] ?? DOT_THEMED.default; \n}; \n \nconst localeValue = computed(() => (props.locale === 'default' ? undefined : props.locale)); \n \nconst monthOptions = computed(() => { \n const base = new Date(2024, 0, 1); \n return Array.from({ length: 12 }, (_, i) => { \n const d = new Date(base); \n d.setMonth(i); \n return d.toLocaleString(localeValue.value, { month: 'long' }); \n }); \n}); \n \nconst yearOptions = computed(() => { \n const min = props.minDate?.getFullYear() ?? anchorDate.value.getFullYear() - 10; \n const max = props.maxDate?.getFullYear() ?? anchorDate.value.getFullYear() + 10; \n const list: number[] = []; \n for (let y = min; y <= max; y++) list.push(y); \n return list; \n}); \n \nconst selectedMonth = computed({ \n get: () => anchorDate.value.getMonth(), \n set: (mm: number) => { \n const d = new Date(anchorDate.value); \n d.setDate(1); \n d.setMonth(mm); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n \nconst selectedYear = computed({ \n get: () => anchorDate.value.getFullYear(), \n set: (yy: number) => { \n const d = new Date(anchorDate.value); \n d.setFullYear(yy); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n</script>\n"],"mappings":""}
|
package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.cjs
CHANGED
|
@@ -5,6 +5,7 @@ const require_useCalendarTheme = require("../../../composables/useCalendarTheme.
|
|
|
5
5
|
const require_useEventHover = require("../../../composables/useEventHover.cjs");
|
|
6
6
|
const require_CalendarEventTooltip = require("./CalendarEventTooltip.cjs");
|
|
7
7
|
const require_CalendarHeader = require("./CalendarHeader.cjs");
|
|
8
|
+
const require_cssLength = require("../../../utils/cssLength.cjs");
|
|
8
9
|
let vue = require("vue");
|
|
9
10
|
let gsap = require("gsap");
|
|
10
11
|
gsap = require_runtime.__toESM(gsap, 1);
|
|
@@ -64,6 +65,7 @@ var AgendaView_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
64
65
|
type: Boolean,
|
|
65
66
|
default: true
|
|
66
67
|
},
|
|
68
|
+
maxHeight: {},
|
|
67
69
|
minDate: {},
|
|
68
70
|
maxDate: {},
|
|
69
71
|
daysToShow: { default: 30 },
|
|
@@ -489,6 +491,7 @@ var AgendaView_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
489
491
|
(0, vue.unref)(containerRadiusClass),
|
|
490
492
|
__props.bordered ? "border border-border" : ""
|
|
491
493
|
]),
|
|
494
|
+
style: (0, vue.normalizeStyle)({ maxHeight: (0, vue.unref)(require_cssLength.toCssLength)(__props.maxHeight) }),
|
|
492
495
|
onKeydown: handleKeydown
|
|
493
496
|
}, [
|
|
494
497
|
(0, vue.renderSlot)(_ctx.$slots, "header", {
|
|
@@ -605,7 +608,7 @@ var AgendaView_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
605
608
|
})]),
|
|
606
609
|
_: 3
|
|
607
610
|
}, 8, ["state", "style"])
|
|
608
|
-
],
|
|
611
|
+
], 38);
|
|
609
612
|
};
|
|
610
613
|
}
|
|
611
614
|
});
|