mood-ui 0.10.0 → 0.11.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/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/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/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 +20 -3
- 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 +20 -3
- 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.vue_vue_type_script_setup_true_lang.cjs +2 -2
- package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.mjs +2 -2
- 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.vue_vue_type_script_setup_true_lang.cjs +2 -2
- package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.mjs +2 -2
- 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 +225 -20
- 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 +227 -22
- 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/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 +4 -4
- 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 +4 -4
- 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/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 +5 -1
- package/dist/composables/usePopover.cjs.map +1 -1
- package/dist/composables/usePopover.mjs +5 -1
- 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 +107 -473
- 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/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/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/package.json +1 -1
|
@@ -151,7 +151,7 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, v
|
|
|
151
151
|
case "none": return "rounded-none";
|
|
152
152
|
case "small": return "rounded-sm";
|
|
153
153
|
case "large": return "rounded-lg";
|
|
154
|
-
case "full": return "rounded-
|
|
154
|
+
case "full": return "rounded-[999px]";
|
|
155
155
|
default: return "rounded-md";
|
|
156
156
|
}
|
|
157
157
|
});
|
|
@@ -365,7 +365,7 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, v
|
|
|
365
365
|
class: (0, vue.normalizeClass)([
|
|
366
366
|
"inline-flex items-center gap-3 px-3 py-2 text-left transition-colors",
|
|
367
367
|
"border bg-card text-card-foreground border-border",
|
|
368
|
-
"hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
368
|
+
"hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",
|
|
369
369
|
radiusClass.value,
|
|
370
370
|
__props.fullWidth ? "w-full" : "",
|
|
371
371
|
__props.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
|
|
@@ -419,7 +419,7 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, v
|
|
|
419
419
|
placeholder: resolvedSearchPlaceholder.value,
|
|
420
420
|
"aria-controls": (0, vue.unref)(listboxId),
|
|
421
421
|
"aria-activedescendant": activeDescendantId.value,
|
|
422
|
-
class: "w-full px-2 py-1.5 text-body bg-background border border-border rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
422
|
+
class: "w-full px-2 py-1.5 text-body bg-background border border-border rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",
|
|
423
423
|
onKeydown: onSearchKeydown
|
|
424
424
|
}, null, 40, _hoisted_9), [[vue.vModelText, searchQuery.value]])])) : (0, vue.createCommentVNode)("", true),
|
|
425
425
|
__props.loading ? (0, vue.renderSlot)(_ctx.$slots, "loading", { key: 2 }, () => [(0, vue.createElementVNode)("div", _hoisted_10, [((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(3, (i) => {
|
|
@@ -431,7 +431,7 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, v
|
|
|
431
431
|
key: 5,
|
|
432
432
|
role: "listbox",
|
|
433
433
|
id: (0, vue.unref)(listboxId),
|
|
434
|
-
class: "flex flex-col
|
|
434
|
+
class: "flex flex-col",
|
|
435
435
|
onKeydown: onListKeydown
|
|
436
436
|
}, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(displayedItems.value, (item, idx) => {
|
|
437
437
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("li", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switcher.vue_vue_type_script_setup_true_lang.cjs","names":["$slots"],"sources":["../../../src/components/navigation/Switcher.vue"],"sourcesContent":["<template>\n <div class=\"modo-switcher inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <span ref=\"triggerWrapEl\" class=\"inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <slot\n name=\"trigger\"\n :activeItem=\"activeItem\"\n :isOpen=\"isOpen\"\n :toggle=\"onTriggerClick\"\n >\n <button\n ref=\"triggerEl\"\n type=\"button\"\n data-modo-switcher-trigger\n aria-haspopup=\"listbox\"\n :aria-expanded=\"isOpen\"\n :aria-label=\"resolvedAriaLabel\"\n :disabled=\"disabled\"\n :class=\"[\n 'inline-flex items-center gap-3 px-3 py-2 text-left transition-colors',\n 'border bg-card text-card-foreground border-border',\n 'hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n radiusClass,\n fullWidth ? 'w-full' : '',\n disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span v-if=\"activeItem?.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"activeItem.avatar.src\"\n :initials=\"activeItem.avatar.initials\"\n :name=\"activeItem.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"activeItem?.icon\"\n class=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\n >\n <component :is=\"activeItem.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">\n {{ activeItem ? activeItem.title : resolvedPlaceholder }}\n </span>\n <span\n v-if=\"!compactTrigger && activeItem?.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >\n {{ activeItem.subtitle }}\n </span>\n </span>\n <ChevronUpDownIcon\n v-if=\"chevron === 'updown'\"\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <ChevronDownIcon\n v-else-if=\"chevron === 'down'\"\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n </button>\n </slot>\n </span>\n\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"resolvedRadius\"\n role=\"dialog\"\n :aria-label=\"resolvedAriaLabel\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div\n data-modo-switcher-panel\n class=\"modo-switcher-panel overflow-y-auto\"\n :style=\"{ maxHeight: panelMaxHeightStyle }\"\n >\n <div\n v-if=\"panelTitle\"\n class=\"px-3 pt-3 pb-2 text-caption text-muted-foreground uppercase tracking-wider\"\n >\n {{ panelTitle }}\n </div>\n\n <div v-if=\"searchable\" class=\"px-2 pt-2 pb-1\">\n <input\n ref=\"searchInputEl\"\n v-model=\"searchQuery\"\n role=\"searchbox\"\n type=\"text\"\n :placeholder=\"resolvedSearchPlaceholder\"\n :aria-controls=\"listboxId\"\n :aria-activedescendant=\"activeDescendantId\"\n class=\"w-full px-2 py-1.5 text-body bg-background border border-border rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n @keydown=\"onSearchKeydown\"\n />\n </div>\n\n <template v-if=\"loading\">\n <slot name=\"loading\">\n <div class=\"p-2 flex flex-col gap-1\">\n <div\n v-for=\"i in 3\"\n :key=\"i\"\n data-modo-switcher-skeleton\n >\n <Skeleton height=\"44px\" />\n </div>\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"items.length === 0\">\n <slot name=\"empty\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedEmptyText }}\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"displayedItems.length === 0\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedNoResults }}\n </div>\n </template>\n\n <ul\n v-else\n role=\"listbox\"\n :id=\"listboxId\"\n class=\"flex flex-col py-1\"\n @keydown=\"onListKeydown\"\n >\n <li\n v-for=\"(item, idx) in displayedItems\"\n :key=\"item.value\"\n :ref=\"(el) => setOptionRef(el as HTMLElement | null, idx)\"\n role=\"option\"\n :id=\"`${listboxId}-opt-${idx}`\"\n :aria-selected=\"item.value === modelValue\"\n :aria-current=\"item.value === modelValue ? 'true' : undefined\"\n :aria-disabled=\"item.disabled || undefined\"\n :data-active=\"item.value === modelValue || undefined\"\n :tabindex=\"-1\"\n class=\"modo-switcher-item flex items-center gap-3 px-3 py-2 cursor-pointer\"\n :class=\"[\n item.value === modelValue ? 'bg-accent/40' : '',\n searchable && idx === highlightedIdx ? 'bg-accent' : 'hover:bg-accent',\n item.disabled ? 'opacity-50 cursor-not-allowed' : '',\n ]\"\n @click=\"selectItem(item)\"\n @mouseenter=\"searchable ? (highlightedIdx = idx) : null\"\n >\n <span v-if=\"item.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"item.avatar.src\"\n :initials=\"item.avatar.initials\"\n :name=\"item.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"item.icon\"\n data-modo-switcher-iconwrap\n class=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\n >\n <component :is=\"item.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">{{ item.title }}</span>\n <span\n v-if=\"item.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >{{ item.subtitle }}</span>\n </span>\n <slot\n name=\"item-trailing\"\n :item=\"item\"\n :active=\"item.value === modelValue\"\n :close=\"close\"\n >\n <CheckIcon\n v-if=\"item.value === modelValue\"\n class=\"w-4 h-4 shrink-0\"\n aria-hidden=\"true\"\n />\n </slot>\n </li>\n </ul>\n\n <template v-if=\"$slots.footer\">\n <hr\n data-modo-switcher-footer-sep\n role=\"separator\"\n class=\"my-1 border-t border-border\"\n />\n <div class=\"p-1\">\n <slot name=\"footer\" :close=\"close\" />\n </div>\n </template>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch, watchEffect } from \"vue\";\nimport { ChevronUpDownIcon, ChevronDownIcon, CheckIcon } from \"@heroicons/vue/24/outline\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Avatar from \"../data-display/avatar/Avatar.vue\";\nimport Skeleton from \"../feedback/Skeleton.vue\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport {\n useResolvedRadius,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport type {\n Switcher as SwitcherProps,\n SwitcherEmits,\n SwitcherItem,\n SwitcherValue,\n} from \"../../interfaces/navigation/Switcher.interface\";\n\nconst props = withDefaults(defineProps<SwitcherProps>(), {\n modelValue: null,\n chevron: \"updown\",\n triggerVariant: \"outline\",\n compactTrigger: false,\n fullWidth: false,\n panelWidth: \"trigger\",\n panelMinWidth: \"15rem\",\n panelMaxHeight: 320,\n placement: \"bottom-start\",\n searchable: false,\n loading: false,\n disabled: false,\n});\n\nconst emit = defineEmits<SwitcherEmits>();\n\nconst locale = useModoLocale();\nconst resolvedRadius = useResolvedRadius(() => props.radius);\nconst listboxId = useId();\n\nconst resolvedPlaceholder = computed(\n () => props.placeholder ?? locale.value.switcher.placeholder,\n);\nconst resolvedAriaLabel = computed(\n () => props.ariaLabel ?? locale.value.switcher.ariaLabel,\n);\nconst resolvedEmptyText = computed(\n () => props.emptyText ?? locale.value.switcher.empty,\n);\nconst resolvedSearchPlaceholder = computed(\n () => props.searchPlaceholder ?? locale.value.switcher.searchPlaceholder,\n);\nconst resolvedNoResults = computed(\n () => props.noResultsText ?? locale.value.switcher.noResults,\n);\n\nconst searchQuery = ref(\"\");\nconst searchInputEl = ref<HTMLInputElement | null>(null);\n\nconst displayedItems = computed<SwitcherItem[]>(() => {\n if (!props.searchable) return props.items;\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return props.items;\n const fields = props.searchFields ?? [\"title\", \"subtitle\"];\n return props.items.filter((it) =>\n fields.some((f) => {\n const v = it[f];\n return typeof v === \"string\" && v.toLowerCase().includes(q);\n }),\n );\n});\n\nwatch(searchQuery, (q) => {\n emit(\"search\", q);\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-lg\";\n case \"full\": return \"rounded-full\";\n default: return \"rounded-md\";\n }\n});\n\nconst panelMaxHeightStyle = computed(() => {\n const v = props.panelMaxHeight;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\nconst panelMinWidthStyle = computed(() => {\n const v = props.panelMinWidth;\n if (v == null) return undefined;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\n// The popover composable sizes the panel to the trigger width when\n// `panelWidth='trigger'`. A narrow trigger (e.g. an avatar-only custom\n// trigger) would otherwise crush the panel — `minWidth` floors it.\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(panelMinWidthStyle.value ? { minWidth: panelMinWidthStyle.value } : {}),\n}));\n\nconst activeItem = computed<SwitcherItem | null>(() => {\n if (props.modelValue == null) return null;\n return props.items.find((i) => i.value === props.modelValue) ?? null;\n});\n\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open,\n close,\n toggle,\n} = usePopover({\n placement: () => props.placement,\n matchTriggerWidth: () => props.panelWidth === \"trigger\",\n closeOnEscape: false,\n onOpen: () => emit(\"open\"),\n onClose: () => {\n searchQuery.value = \"\";\n emit(\"close\");\n },\n});\n\nconst triggerEl = ref<HTMLElement | null>(null);\nconst triggerWrapEl = ref<HTMLElement | null>(null);\nwatch([triggerEl, triggerWrapEl], ([btn, wrap]) => {\n triggerRef.value = (btn as HTMLElement | null) ?? (wrap as HTMLElement | null);\n});\n\nfunction focusTrigger() {\n const el = triggerEl.value ?? triggerWrapEl.value;\n el?.focus?.();\n}\n\nfunction onTriggerClick() {\n if (props.disabled) return;\n toggle();\n}\n\nfunction selectItem(item: SwitcherItem) {\n if (item.disabled || props.disabled) return;\n emit(\"update:modelValue\", item.value);\n emit(\"change\", item.value, item);\n close();\n}\n\nfunction focusableIndices(): number[] {\n return displayedItems.value\n .map((it, i) => (it.disabled ? -1 : i))\n .filter((i) => i !== -1);\n}\n\nconst optionRefs = new Map<number, HTMLElement>();\nfunction setOptionRef(el: HTMLElement | null, idx: number) {\n if (el) optionRefs.set(idx, el);\n else optionRefs.delete(idx);\n}\n\nfunction focusOptionByIdx(idx: number) {\n optionRefs.get(idx)?.focus();\n}\n\nasync function openAndFocusActive() {\n if (props.disabled) return;\n if (!isOpen.value) open();\n await nextTick();\n if (props.searchable) {\n searchInputEl.value?.focus();\n return;\n }\n const order = focusableIndices();\n if (!order.length) return;\n const activeIdx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue,\n );\n const usable =\n activeIdx >= 0 && !displayedItems.value[activeIdx].disabled\n ? activeIdx\n : order[0];\n focusOptionByIdx(usable);\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if ([\"ArrowDown\", \"ArrowUp\", \"Enter\", \" \"].includes(e.key)) {\n e.preventDefault();\n openAndFocusActive();\n } else if (e.key === \"Escape\" && isOpen.value) {\n e.preventDefault();\n close();\n }\n}\n\nfunction currentFocusedIdx(): number {\n const el = document.activeElement as HTMLElement | null;\n if (!el) return -1;\n for (const [idx, node] of optionRefs.entries()) {\n if (node === el) return idx;\n }\n return -1;\n}\n\nfunction moveFocus(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = currentFocusedIdx();\n let pos = order.indexOf(cur);\n if (pos === -1) {\n focusOptionByIdx(delta > 0 ? order[0] : order[order.length - 1]);\n return;\n }\n pos = (pos + delta + order.length) % order.length;\n focusOptionByIdx(order[pos]);\n}\n\nfunction onListKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveFocus(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveFocus(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[0]);\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[order.length - 1]);\n } else if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n const idx = currentFocusedIdx();\n if (idx >= 0) selectItem(displayedItems.value[idx]);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n } else if (\n !props.searchable &&\n e.key.length === 1 &&\n /^[a-zA-Z0-9]$/.test(e.key)\n ) {\n const order = focusableIndices();\n const letter = e.key.toLowerCase();\n const match = order.find((i) =>\n displayedItems.value[i].title.toLowerCase().startsWith(letter),\n );\n if (match !== undefined) focusOptionByIdx(match);\n }\n}\n\nwatch(isOpen, (open) => {\n if (!open) focusTrigger();\n});\n\nconst highlightedIdx = ref<number>(-1);\n\nconst activeDescendantId = computed(() =>\n highlightedIdx.value >= 0\n ? `${listboxId}-opt-${highlightedIdx.value}`\n : undefined,\n);\n\nwatch(displayedItems, () => {\n if (!props.searchable) return;\n const order = focusableIndices();\n highlightedIdx.value = order[0] ?? -1;\n});\n\nwatch(isOpen, (open) => {\n if (!open) {\n highlightedIdx.value = -1;\n return;\n }\n if (!props.searchable) return;\n const idx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue && !it.disabled,\n );\n const order = focusableIndices();\n highlightedIdx.value = idx >= 0 ? idx : order[0] ?? -1;\n});\n\nfunction moveHighlight(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = order.indexOf(highlightedIdx.value);\n if (cur === -1) {\n highlightedIdx.value = delta > 0 ? order[0] : order[order.length - 1];\n return;\n }\n const next = (cur + delta + order.length) % order.length;\n highlightedIdx.value = order[next];\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveHighlight(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveHighlight(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[0];\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[order.length - 1];\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n if (highlightedIdx.value >= 0) {\n selectItem(displayedItems.value[highlightedIdx.value]);\n }\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n }\n}\n\n// Dev-only: warn once per offending item when both icon and avatar are set.\nif (import.meta.env?.DEV ?? true) {\n const warned = new Set<SwitcherValue>();\n watchEffect(() => {\n for (const item of props.items) {\n if (item.icon && item.avatar && !warned.has(item.value)) {\n warned.add(item.value);\n console.warn(\n `[Switcher] item \"${item.value}\" declares both \\`icon\\` and \\`avatar\\`; \\`avatar\\` wins. Pick one.`,\n );\n }\n }\n });\n}\n\ndefineExpose({ open, close, toggle });\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkOA,MAAM,QAAQ;EAed,MAAM,OAAO;EAEb,MAAM,SAAS,sBAAA,eAAe;EAC9B,MAAM,iBAAiB,sBAAA,wBAAwB,MAAM,OAAO;EAC5D,MAAM,aAAA,GAAA,IAAA,QAAmB;EAEzB,MAAM,uBAAA,GAAA,IAAA,gBACE,MAAM,eAAe,OAAO,MAAM,SAAS,YAClD;EACD,MAAM,qBAAA,GAAA,IAAA,gBACE,MAAM,aAAa,OAAO,MAAM,SAAS,UAChD;EACD,MAAM,qBAAA,GAAA,IAAA,gBACE,MAAM,aAAa,OAAO,MAAM,SAAS,MAChD;EACD,MAAM,6BAAA,GAAA,IAAA,gBACE,MAAM,qBAAqB,OAAO,MAAM,SAAS,kBACxD;EACD,MAAM,qBAAA,GAAA,IAAA,gBACE,MAAM,iBAAiB,OAAO,MAAM,SAAS,UACpD;EAED,MAAM,eAAA,GAAA,IAAA,KAAkB,GAAG;EAC3B,MAAM,iBAAA,GAAA,IAAA,KAA6C,KAAK;EAExD,MAAM,kBAAA,GAAA,IAAA,gBAAgD;GACpD,IAAI,CAAC,MAAM,YAAY,OAAO,MAAM;GACpC,MAAM,IAAI,YAAY,MAAM,MAAM,CAAC,aAAa;GAChD,IAAI,CAAC,GAAG,OAAO,MAAM;GACrB,MAAM,SAAS,MAAM,gBAAgB,CAAC,SAAS,WAAW;GAC1D,OAAO,MAAM,MA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AgD,KAAK,MAAK,EAAA,EAAA,EAElD,KAAK,aAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAEc,QAH3B,cAAA,GAAA,IAAA,iBAGI,KAAK,SAAQ,EAAA,EAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA,CAAA,CAAA;2BAaZ,KAAA,QAAA,iBAAA;QATE;QACN,QAAQ,KAAK,UAAU,QAAA;QACvB,QAAA,GAAA,IAAA,OAAO,MAAK;gBAOR,CAJG,KAAK,UAAU,QAAA,eAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,cAAA,GAAA,IAAA,OAGrB,0BAAA,UAAA,EAAA;;QAFA,OAAM;QACN,eAAY;;;;KAMJA,KAAAA,OAAO,WAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBASZ,IAAA,UAAA,EAAA,KAAA,GAAA,EAAA,CAAA,OAAA,OAAA,OAAA,MAAA,GAAA,IAAA,oBAJP,MAAA;MAHA,iCAAA;MACA,MAAK;MACL,OAAM;gDAIF,OAFN,aAEM,EAAA,GAAA,IAAA,YADiC,KAAA,QAAA,UAAA,EAAhB,QAAA,GAAA,IAAA,OAAO,MAAK,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,GAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA"}
|
|
1
|
+
{"version":3,"file":"Switcher.vue_vue_type_script_setup_true_lang.cjs","names":["$slots"],"sources":["../../../src/components/navigation/Switcher.vue"],"sourcesContent":["<template>\n <div class=\"modo-switcher inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <span ref=\"triggerWrapEl\" class=\"inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <slot\n name=\"trigger\"\n :activeItem=\"activeItem\"\n :isOpen=\"isOpen\"\n :toggle=\"onTriggerClick\"\n >\n <button\n ref=\"triggerEl\"\n type=\"button\"\n data-modo-switcher-trigger\n aria-haspopup=\"listbox\"\n :aria-expanded=\"isOpen\"\n :aria-label=\"resolvedAriaLabel\"\n :disabled=\"disabled\"\n :class=\"[\n 'inline-flex items-center gap-3 px-3 py-2 text-left transition-colors',\n 'border bg-card text-card-foreground border-border',\n 'hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60',\n radiusClass,\n fullWidth ? 'w-full' : '',\n disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span v-if=\"activeItem?.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"activeItem.avatar.src\"\n :initials=\"activeItem.avatar.initials\"\n :name=\"activeItem.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"activeItem?.icon\"\n class=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\n >\n <component :is=\"activeItem.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">\n {{ activeItem ? activeItem.title : resolvedPlaceholder }}\n </span>\n <span\n v-if=\"!compactTrigger && activeItem?.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >\n {{ activeItem.subtitle }}\n </span>\n </span>\n <ChevronUpDownIcon\n v-if=\"chevron === 'updown'\"\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <ChevronDownIcon\n v-else-if=\"chevron === 'down'\"\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n </button>\n </slot>\n </span>\n\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"resolvedRadius\"\n role=\"dialog\"\n :aria-label=\"resolvedAriaLabel\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div\n data-modo-switcher-panel\n class=\"modo-switcher-panel overflow-y-auto\"\n :style=\"{ maxHeight: panelMaxHeightStyle }\"\n >\n <div\n v-if=\"panelTitle\"\n class=\"px-3 pt-3 pb-2 text-caption text-muted-foreground uppercase tracking-wider\"\n >\n {{ panelTitle }}\n </div>\n\n <div v-if=\"searchable\" class=\"px-2 pt-2 pb-1\">\n <input\n ref=\"searchInputEl\"\n v-model=\"searchQuery\"\n role=\"searchbox\"\n type=\"text\"\n :placeholder=\"resolvedSearchPlaceholder\"\n :aria-controls=\"listboxId\"\n :aria-activedescendant=\"activeDescendantId\"\n class=\"w-full px-2 py-1.5 text-body bg-background border border-border rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60\"\n @keydown=\"onSearchKeydown\"\n />\n </div>\n\n <template v-if=\"loading\">\n <slot name=\"loading\">\n <div class=\"p-2 flex flex-col gap-1\">\n <div\n v-for=\"i in 3\"\n :key=\"i\"\n data-modo-switcher-skeleton\n >\n <Skeleton height=\"44px\" />\n </div>\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"items.length === 0\">\n <slot name=\"empty\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedEmptyText }}\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"displayedItems.length === 0\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedNoResults }}\n </div>\n </template>\n\n <ul\n v-else\n role=\"listbox\"\n :id=\"listboxId\"\n class=\"flex flex-col\"\n @keydown=\"onListKeydown\"\n >\n <li\n v-for=\"(item, idx) in displayedItems\"\n :key=\"item.value\"\n :ref=\"(el) => setOptionRef(el as HTMLElement | null, idx)\"\n role=\"option\"\n :id=\"`${listboxId}-opt-${idx}`\"\n :aria-selected=\"item.value === modelValue\"\n :aria-current=\"item.value === modelValue ? 'true' : undefined\"\n :aria-disabled=\"item.disabled || undefined\"\n :data-active=\"item.value === modelValue || undefined\"\n :tabindex=\"-1\"\n class=\"modo-switcher-item flex items-center gap-3 px-3 py-2 cursor-pointer\"\n :class=\"[\n item.value === modelValue ? 'bg-accent/40' : '',\n searchable && idx === highlightedIdx ? 'bg-accent' : 'hover:bg-accent',\n item.disabled ? 'opacity-50 cursor-not-allowed' : '',\n ]\"\n @click=\"selectItem(item)\"\n @mouseenter=\"searchable ? (highlightedIdx = idx) : null\"\n >\n <span v-if=\"item.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"item.avatar.src\"\n :initials=\"item.avatar.initials\"\n :name=\"item.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"item.icon\"\n data-modo-switcher-iconwrap\n class=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\n >\n <component :is=\"item.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">{{ item.title }}</span>\n <span\n v-if=\"item.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >{{ item.subtitle }}</span>\n </span>\n <slot\n name=\"item-trailing\"\n :item=\"item\"\n :active=\"item.value === modelValue\"\n :close=\"close\"\n >\n <CheckIcon\n v-if=\"item.value === modelValue\"\n class=\"w-4 h-4 shrink-0\"\n aria-hidden=\"true\"\n />\n </slot>\n </li>\n </ul>\n\n <template v-if=\"$slots.footer\">\n <hr\n data-modo-switcher-footer-sep\n role=\"separator\"\n class=\"my-1 border-t border-border\"\n />\n <div class=\"p-1\">\n <slot name=\"footer\" :close=\"close\" />\n </div>\n </template>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch, watchEffect } from \"vue\";\nimport { ChevronUpDownIcon, ChevronDownIcon, CheckIcon } from \"@heroicons/vue/24/outline\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Avatar from \"../data-display/avatar/Avatar.vue\";\nimport Skeleton from \"../feedback/Skeleton.vue\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport {\n useResolvedRadius,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport type {\n Switcher as SwitcherProps,\n SwitcherEmits,\n SwitcherItem,\n SwitcherValue,\n} from \"../../interfaces/navigation/Switcher.interface\";\n\nconst props = withDefaults(defineProps<SwitcherProps>(), {\n modelValue: null,\n chevron: \"updown\",\n triggerVariant: \"outline\",\n compactTrigger: false,\n fullWidth: false,\n panelWidth: \"trigger\",\n panelMinWidth: \"15rem\",\n panelMaxHeight: 320,\n placement: \"bottom-start\",\n searchable: false,\n loading: false,\n disabled: false,\n});\n\nconst emit = defineEmits<SwitcherEmits>();\n\nconst locale = useModoLocale();\nconst resolvedRadius = useResolvedRadius(() => props.radius);\nconst listboxId = useId();\n\nconst resolvedPlaceholder = computed(\n () => props.placeholder ?? locale.value.switcher.placeholder,\n);\nconst resolvedAriaLabel = computed(\n () => props.ariaLabel ?? locale.value.switcher.ariaLabel,\n);\nconst resolvedEmptyText = computed(\n () => props.emptyText ?? locale.value.switcher.empty,\n);\nconst resolvedSearchPlaceholder = computed(\n () => props.searchPlaceholder ?? locale.value.switcher.searchPlaceholder,\n);\nconst resolvedNoResults = computed(\n () => props.noResultsText ?? locale.value.switcher.noResults,\n);\n\nconst searchQuery = ref(\"\");\nconst searchInputEl = ref<HTMLInputElement | null>(null);\n\nconst displayedItems = computed<SwitcherItem[]>(() => {\n if (!props.searchable) return props.items;\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return props.items;\n const fields = props.searchFields ?? [\"title\", \"subtitle\"];\n return props.items.filter((it) =>\n fields.some((f) => {\n const v = it[f];\n return typeof v === \"string\" && v.toLowerCase().includes(q);\n }),\n );\n});\n\nwatch(searchQuery, (q) => {\n emit(\"search\", q);\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-lg\";\n case \"full\": return \"rounded-[999px]\";\n default: return \"rounded-md\";\n }\n});\n\nconst panelMaxHeightStyle = computed(() => {\n const v = props.panelMaxHeight;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\nconst panelMinWidthStyle = computed(() => {\n const v = props.panelMinWidth;\n if (v == null) return undefined;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\n// The popover composable sizes the panel to the trigger width when\n// `panelWidth='trigger'`. A narrow trigger (e.g. an avatar-only custom\n// trigger) would otherwise crush the panel — `minWidth` floors it.\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(panelMinWidthStyle.value ? { minWidth: panelMinWidthStyle.value } : {}),\n}));\n\nconst activeItem = computed<SwitcherItem | null>(() => {\n if (props.modelValue == null) return null;\n return props.items.find((i) => i.value === props.modelValue) ?? null;\n});\n\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open,\n close,\n toggle,\n} = usePopover({\n placement: () => props.placement,\n matchTriggerWidth: () => props.panelWidth === \"trigger\",\n closeOnEscape: false,\n onOpen: () => emit(\"open\"),\n onClose: () => {\n searchQuery.value = \"\";\n emit(\"close\");\n },\n});\n\nconst triggerEl = ref<HTMLElement | null>(null);\nconst triggerWrapEl = ref<HTMLElement | null>(null);\nwatch([triggerEl, triggerWrapEl], ([btn, wrap]) => {\n triggerRef.value = (btn as HTMLElement | null) ?? (wrap as HTMLElement | null);\n});\n\nfunction focusTrigger() {\n const el = triggerEl.value ?? triggerWrapEl.value;\n el?.focus?.();\n}\n\nfunction onTriggerClick() {\n if (props.disabled) return;\n toggle();\n}\n\nfunction selectItem(item: SwitcherItem) {\n if (item.disabled || props.disabled) return;\n emit(\"update:modelValue\", item.value);\n emit(\"change\", item.value, item);\n close();\n}\n\nfunction focusableIndices(): number[] {\n return displayedItems.value\n .map((it, i) => (it.disabled ? -1 : i))\n .filter((i) => i !== -1);\n}\n\nconst optionRefs = new Map<number, HTMLElement>();\nfunction setOptionRef(el: HTMLElement | null, idx: number) {\n if (el) optionRefs.set(idx, el);\n else optionRefs.delete(idx);\n}\n\nfunction focusOptionByIdx(idx: number) {\n optionRefs.get(idx)?.focus();\n}\n\nasync function openAndFocusActive() {\n if (props.disabled) return;\n if (!isOpen.value) open();\n await nextTick();\n if (props.searchable) {\n searchInputEl.value?.focus();\n return;\n }\n const order = focusableIndices();\n if (!order.length) return;\n const activeIdx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue,\n );\n const usable =\n activeIdx >= 0 && !displayedItems.value[activeIdx].disabled\n ? activeIdx\n : order[0];\n focusOptionByIdx(usable);\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if ([\"ArrowDown\", \"ArrowUp\", \"Enter\", \" \"].includes(e.key)) {\n e.preventDefault();\n openAndFocusActive();\n } else if (e.key === \"Escape\" && isOpen.value) {\n e.preventDefault();\n close();\n }\n}\n\nfunction currentFocusedIdx(): number {\n const el = document.activeElement as HTMLElement | null;\n if (!el) return -1;\n for (const [idx, node] of optionRefs.entries()) {\n if (node === el) return idx;\n }\n return -1;\n}\n\nfunction moveFocus(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = currentFocusedIdx();\n let pos = order.indexOf(cur);\n if (pos === -1) {\n focusOptionByIdx(delta > 0 ? order[0] : order[order.length - 1]);\n return;\n }\n pos = (pos + delta + order.length) % order.length;\n focusOptionByIdx(order[pos]);\n}\n\nfunction onListKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveFocus(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveFocus(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[0]);\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[order.length - 1]);\n } else if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n const idx = currentFocusedIdx();\n if (idx >= 0) selectItem(displayedItems.value[idx]);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n } else if (\n !props.searchable &&\n e.key.length === 1 &&\n /^[a-zA-Z0-9]$/.test(e.key)\n ) {\n const order = focusableIndices();\n const letter = e.key.toLowerCase();\n const match = order.find((i) =>\n displayedItems.value[i].title.toLowerCase().startsWith(letter),\n );\n if (match !== undefined) focusOptionByIdx(match);\n }\n}\n\nwatch(isOpen, (open) => {\n if (!open) focusTrigger();\n});\n\nconst highlightedIdx = ref<number>(-1);\n\nconst activeDescendantId = computed(() =>\n highlightedIdx.value >= 0\n ? `${listboxId}-opt-${highlightedIdx.value}`\n : undefined,\n);\n\nwatch(displayedItems, () => {\n if (!props.searchable) return;\n const order = focusableIndices();\n highlightedIdx.value = order[0] ?? -1;\n});\n\nwatch(isOpen, (open) => {\n if (!open) {\n highlightedIdx.value = -1;\n return;\n }\n if (!props.searchable) return;\n const idx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue && !it.disabled,\n );\n const order = focusableIndices();\n highlightedIdx.value = idx >= 0 ? idx : order[0] ?? -1;\n});\n\nfunction moveHighlight(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = order.indexOf(highlightedIdx.value);\n if (cur === -1) {\n highlightedIdx.value = delta > 0 ? order[0] : order[order.length - 1];\n return;\n }\n const next = (cur + delta + order.length) % order.length;\n highlightedIdx.value = order[next];\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveHighlight(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveHighlight(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[0];\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[order.length - 1];\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n if (highlightedIdx.value >= 0) {\n selectItem(displayedItems.value[highlightedIdx.value]);\n }\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n }\n}\n\n// Dev-only: warn once per offending item when both icon and avatar are set.\nif (import.meta.env?.DEV ?? true) {\n const warned = new Set<SwitcherValue>();\n watchEffect(() => {\n for (const item of props.items) {\n if (item.icon && item.avatar && !warned.has(item.value)) {\n warned.add(item.value);\n console.warn(\n `[Switcher] item \"${item.value}\" declares both \\`icon\\` and \\`avatar\\`; \\`avatar\\` wins. Pick one.`,\n );\n }\n }\n });\n}\n\ndefineExpose({ open, close, toggle });\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkOA,MAAM,QAAQ;EAed,MAAM,OAAO;EAEb,MAAM,SAAS,sBAAA,eAAe;EAC9B,MAAM,iBAAiB,sBAAA,wBAAwB,MAAM,OAAO;EAC5D,MAAM,aAAA,GAAA,IAAA,QAAmB;EAEzB,MAAM,uBAAA,GAAA,IAAA,gBACE,MAAM,eAAe,OAAO,MAAM,SAAS,YAClD;EACD,MAAM,qBAAA,GAAA,IAAA,gBACE,MAAM,aAAa,OAAO,MAAM,SAAS,UAChD;EACD,MAAM,qBAAA,GAAA,IAAA,gBACE,MAAM,aAAa,OAAO,MAAM,SAAS,MAChD;EACD,MAAM,6BAAA,GAAA,IAAA,gBACE,MAAM,qBAAqB,OAAO,MAAM,SAAS,kBACxD;EACD,MAAM,qBAAA,GAAA,IAAA,gBACE,MAAM,iBAAiB,OAAO,MAAM,SAAS,UACpD;EAED,MAAM,eAAA,GAAA,IAAA,KAAkB,GAAG;EAC3B,MAAM,iBAAA,GAAA,IAAA,KAA6C,KAAK;EAExD,MAAM,kBAAA,GAAA,IAAA,gBAAgD;GACpD,IAAI,CAAC,MAAM,YAAY,OAAO,MAAM;GACpC,MAAM,IAAI,YAAY,MAAM,MAAM,CAAC,aAAa;GAChD,IAAI,CAAC,GAAG,OAAO,MAAM;GACrB,MAAM,SAAS,MAAM,gBAAgB,CAAC,SAAS,WAAW;GAC1D,OA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A,IAAA,iBAAgD,KAAK,MAAK,EAAA,EAAA,EAElD,KAAK,aAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAEc,QAH3B,cAAA,GAAA,IAAA,iBAGI,KAAK,SAAQ,EAAA,EAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA,CAAA,CAAA;2BAaZ,KAAA,QAAA,iBAAA;QATE;QACN,QAAQ,KAAK,UAAU,QAAA;QACvB,QAAA,GAAA,IAAA,OAAO,MAAK;gBAOR,CAJG,KAAK,UAAU,QAAA,eAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,cAAA,GAAA,IAAA,OAGrB,0BAAA,UAAA,EAAA;;QAFA,OAAM;QACN,eAAY;;;;KAMJA,KAAAA,OAAO,WAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBASZ,IAAA,UAAA,EAAA,KAAA,GAAA,EAAA,CAAA,OAAA,OAAA,OAAA,MAAA,GAAA,IAAA,oBAJP,MAAA;MAHA,iCAAA;MACA,MAAK;MACL,OAAM;gDAIF,OAFN,aAEM,EAAA,GAAA,IAAA,YADiC,KAAA,QAAA,UAAA,EAAhB,QAAA,GAAA,IAAA,OAAO,MAAK,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,GAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA"}
|
|
@@ -150,7 +150,7 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
150
150
|
case "none": return "rounded-none";
|
|
151
151
|
case "small": return "rounded-sm";
|
|
152
152
|
case "large": return "rounded-lg";
|
|
153
|
-
case "full": return "rounded-
|
|
153
|
+
case "full": return "rounded-[999px]";
|
|
154
154
|
default: return "rounded-md";
|
|
155
155
|
}
|
|
156
156
|
});
|
|
@@ -364,7 +364,7 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
364
364
|
class: normalizeClass([
|
|
365
365
|
"inline-flex items-center gap-3 px-3 py-2 text-left transition-colors",
|
|
366
366
|
"border bg-card text-card-foreground border-border",
|
|
367
|
-
"hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
367
|
+
"hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",
|
|
368
368
|
radiusClass.value,
|
|
369
369
|
__props.fullWidth ? "w-full" : "",
|
|
370
370
|
__props.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
|
|
@@ -418,7 +418,7 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
418
418
|
placeholder: resolvedSearchPlaceholder.value,
|
|
419
419
|
"aria-controls": unref(listboxId),
|
|
420
420
|
"aria-activedescendant": activeDescendantId.value,
|
|
421
|
-
class: "w-full px-2 py-1.5 text-body bg-background border border-border rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
421
|
+
class: "w-full px-2 py-1.5 text-body bg-background border border-border rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",
|
|
422
422
|
onKeydown: onSearchKeydown
|
|
423
423
|
}, null, 40, _hoisted_9), [[vModelText, searchQuery.value]])])) : createCommentVNode("", true),
|
|
424
424
|
__props.loading ? renderSlot(_ctx.$slots, "loading", { key: 2 }, () => [createElementVNode("div", _hoisted_10, [(openBlock(), createElementBlock(Fragment, null, renderList(3, (i) => {
|
|
@@ -430,7 +430,7 @@ var Switcher_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
430
430
|
key: 5,
|
|
431
431
|
role: "listbox",
|
|
432
432
|
id: unref(listboxId),
|
|
433
|
-
class: "flex flex-col
|
|
433
|
+
class: "flex flex-col",
|
|
434
434
|
onKeydown: onListKeydown
|
|
435
435
|
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(displayedItems.value, (item, idx) => {
|
|
436
436
|
return openBlock(), createElementBlock("li", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switcher.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../src/components/navigation/Switcher.vue"],"sourcesContent":["<template>\n <div class=\"modo-switcher inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <span ref=\"triggerWrapEl\" class=\"inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <slot\n name=\"trigger\"\n :activeItem=\"activeItem\"\n :isOpen=\"isOpen\"\n :toggle=\"onTriggerClick\"\n >\n <button\n ref=\"triggerEl\"\n type=\"button\"\n data-modo-switcher-trigger\n aria-haspopup=\"listbox\"\n :aria-expanded=\"isOpen\"\n :aria-label=\"resolvedAriaLabel\"\n :disabled=\"disabled\"\n :class=\"[\n 'inline-flex items-center gap-3 px-3 py-2 text-left transition-colors',\n 'border bg-card text-card-foreground border-border',\n 'hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n radiusClass,\n fullWidth ? 'w-full' : '',\n disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span v-if=\"activeItem?.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"activeItem.avatar.src\"\n :initials=\"activeItem.avatar.initials\"\n :name=\"activeItem.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"activeItem?.icon\"\n class=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\n >\n <component :is=\"activeItem.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">\n {{ activeItem ? activeItem.title : resolvedPlaceholder }}\n </span>\n <span\n v-if=\"!compactTrigger && activeItem?.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >\n {{ activeItem.subtitle }}\n </span>\n </span>\n <ChevronUpDownIcon\n v-if=\"chevron === 'updown'\"\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <ChevronDownIcon\n v-else-if=\"chevron === 'down'\"\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n </button>\n </slot>\n </span>\n\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"resolvedRadius\"\n role=\"dialog\"\n :aria-label=\"resolvedAriaLabel\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div\n data-modo-switcher-panel\n class=\"modo-switcher-panel overflow-y-auto\"\n :style=\"{ maxHeight: panelMaxHeightStyle }\"\n >\n <div\n v-if=\"panelTitle\"\n class=\"px-3 pt-3 pb-2 text-caption text-muted-foreground uppercase tracking-wider\"\n >\n {{ panelTitle }}\n </div>\n\n <div v-if=\"searchable\" class=\"px-2 pt-2 pb-1\">\n <input\n ref=\"searchInputEl\"\n v-model=\"searchQuery\"\n role=\"searchbox\"\n type=\"text\"\n :placeholder=\"resolvedSearchPlaceholder\"\n :aria-controls=\"listboxId\"\n :aria-activedescendant=\"activeDescendantId\"\n class=\"w-full px-2 py-1.5 text-body bg-background border border-border rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n @keydown=\"onSearchKeydown\"\n />\n </div>\n\n <template v-if=\"loading\">\n <slot name=\"loading\">\n <div class=\"p-2 flex flex-col gap-1\">\n <div\n v-for=\"i in 3\"\n :key=\"i\"\n data-modo-switcher-skeleton\n >\n <Skeleton height=\"44px\" />\n </div>\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"items.length === 0\">\n <slot name=\"empty\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedEmptyText }}\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"displayedItems.length === 0\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedNoResults }}\n </div>\n </template>\n\n <ul\n v-else\n role=\"listbox\"\n :id=\"listboxId\"\n class=\"flex flex-col py-1\"\n @keydown=\"onListKeydown\"\n >\n <li\n v-for=\"(item, idx) in displayedItems\"\n :key=\"item.value\"\n :ref=\"(el) => setOptionRef(el as HTMLElement | null, idx)\"\n role=\"option\"\n :id=\"`${listboxId}-opt-${idx}`\"\n :aria-selected=\"item.value === modelValue\"\n :aria-current=\"item.value === modelValue ? 'true' : undefined\"\n :aria-disabled=\"item.disabled || undefined\"\n :data-active=\"item.value === modelValue || undefined\"\n :tabindex=\"-1\"\n class=\"modo-switcher-item flex items-center gap-3 px-3 py-2 cursor-pointer\"\n :class=\"[\n item.value === modelValue ? 'bg-accent/40' : '',\n searchable && idx === highlightedIdx ? 'bg-accent' : 'hover:bg-accent',\n item.disabled ? 'opacity-50 cursor-not-allowed' : '',\n ]\"\n @click=\"selectItem(item)\"\n @mouseenter=\"searchable ? (highlightedIdx = idx) : null\"\n >\n <span v-if=\"item.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"item.avatar.src\"\n :initials=\"item.avatar.initials\"\n :name=\"item.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"item.icon\"\n data-modo-switcher-iconwrap\n class=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\n >\n <component :is=\"item.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">{{ item.title }}</span>\n <span\n v-if=\"item.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >{{ item.subtitle }}</span>\n </span>\n <slot\n name=\"item-trailing\"\n :item=\"item\"\n :active=\"item.value === modelValue\"\n :close=\"close\"\n >\n <CheckIcon\n v-if=\"item.value === modelValue\"\n class=\"w-4 h-4 shrink-0\"\n aria-hidden=\"true\"\n />\n </slot>\n </li>\n </ul>\n\n <template v-if=\"$slots.footer\">\n <hr\n data-modo-switcher-footer-sep\n role=\"separator\"\n class=\"my-1 border-t border-border\"\n />\n <div class=\"p-1\">\n <slot name=\"footer\" :close=\"close\" />\n </div>\n </template>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch, watchEffect } from \"vue\";\nimport { ChevronUpDownIcon, ChevronDownIcon, CheckIcon } from \"@heroicons/vue/24/outline\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Avatar from \"../data-display/avatar/Avatar.vue\";\nimport Skeleton from \"../feedback/Skeleton.vue\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport {\n useResolvedRadius,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport type {\n Switcher as SwitcherProps,\n SwitcherEmits,\n SwitcherItem,\n SwitcherValue,\n} from \"../../interfaces/navigation/Switcher.interface\";\n\nconst props = withDefaults(defineProps<SwitcherProps>(), {\n modelValue: null,\n chevron: \"updown\",\n triggerVariant: \"outline\",\n compactTrigger: false,\n fullWidth: false,\n panelWidth: \"trigger\",\n panelMinWidth: \"15rem\",\n panelMaxHeight: 320,\n placement: \"bottom-start\",\n searchable: false,\n loading: false,\n disabled: false,\n});\n\nconst emit = defineEmits<SwitcherEmits>();\n\nconst locale = useModoLocale();\nconst resolvedRadius = useResolvedRadius(() => props.radius);\nconst listboxId = useId();\n\nconst resolvedPlaceholder = computed(\n () => props.placeholder ?? locale.value.switcher.placeholder,\n);\nconst resolvedAriaLabel = computed(\n () => props.ariaLabel ?? locale.value.switcher.ariaLabel,\n);\nconst resolvedEmptyText = computed(\n () => props.emptyText ?? locale.value.switcher.empty,\n);\nconst resolvedSearchPlaceholder = computed(\n () => props.searchPlaceholder ?? locale.value.switcher.searchPlaceholder,\n);\nconst resolvedNoResults = computed(\n () => props.noResultsText ?? locale.value.switcher.noResults,\n);\n\nconst searchQuery = ref(\"\");\nconst searchInputEl = ref<HTMLInputElement | null>(null);\n\nconst displayedItems = computed<SwitcherItem[]>(() => {\n if (!props.searchable) return props.items;\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return props.items;\n const fields = props.searchFields ?? [\"title\", \"subtitle\"];\n return props.items.filter((it) =>\n fields.some((f) => {\n const v = it[f];\n return typeof v === \"string\" && v.toLowerCase().includes(q);\n }),\n );\n});\n\nwatch(searchQuery, (q) => {\n emit(\"search\", q);\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-lg\";\n case \"full\": return \"rounded-full\";\n default: return \"rounded-md\";\n }\n});\n\nconst panelMaxHeightStyle = computed(() => {\n const v = props.panelMaxHeight;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\nconst panelMinWidthStyle = computed(() => {\n const v = props.panelMinWidth;\n if (v == null) return undefined;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\n// The popover composable sizes the panel to the trigger width when\n// `panelWidth='trigger'`. A narrow trigger (e.g. an avatar-only custom\n// trigger) would otherwise crush the panel — `minWidth` floors it.\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(panelMinWidthStyle.value ? { minWidth: panelMinWidthStyle.value } : {}),\n}));\n\nconst activeItem = computed<SwitcherItem | null>(() => {\n if (props.modelValue == null) return null;\n return props.items.find((i) => i.value === props.modelValue) ?? null;\n});\n\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open,\n close,\n toggle,\n} = usePopover({\n placement: () => props.placement,\n matchTriggerWidth: () => props.panelWidth === \"trigger\",\n closeOnEscape: false,\n onOpen: () => emit(\"open\"),\n onClose: () => {\n searchQuery.value = \"\";\n emit(\"close\");\n },\n});\n\nconst triggerEl = ref<HTMLElement | null>(null);\nconst triggerWrapEl = ref<HTMLElement | null>(null);\nwatch([triggerEl, triggerWrapEl], ([btn, wrap]) => {\n triggerRef.value = (btn as HTMLElement | null) ?? (wrap as HTMLElement | null);\n});\n\nfunction focusTrigger() {\n const el = triggerEl.value ?? triggerWrapEl.value;\n el?.focus?.();\n}\n\nfunction onTriggerClick() {\n if (props.disabled) return;\n toggle();\n}\n\nfunction selectItem(item: SwitcherItem) {\n if (item.disabled || props.disabled) return;\n emit(\"update:modelValue\", item.value);\n emit(\"change\", item.value, item);\n close();\n}\n\nfunction focusableIndices(): number[] {\n return displayedItems.value\n .map((it, i) => (it.disabled ? -1 : i))\n .filter((i) => i !== -1);\n}\n\nconst optionRefs = new Map<number, HTMLElement>();\nfunction setOptionRef(el: HTMLElement | null, idx: number) {\n if (el) optionRefs.set(idx, el);\n else optionRefs.delete(idx);\n}\n\nfunction focusOptionByIdx(idx: number) {\n optionRefs.get(idx)?.focus();\n}\n\nasync function openAndFocusActive() {\n if (props.disabled) return;\n if (!isOpen.value) open();\n await nextTick();\n if (props.searchable) {\n searchInputEl.value?.focus();\n return;\n }\n const order = focusableIndices();\n if (!order.length) return;\n const activeIdx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue,\n );\n const usable =\n activeIdx >= 0 && !displayedItems.value[activeIdx].disabled\n ? activeIdx\n : order[0];\n focusOptionByIdx(usable);\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if ([\"ArrowDown\", \"ArrowUp\", \"Enter\", \" \"].includes(e.key)) {\n e.preventDefault();\n openAndFocusActive();\n } else if (e.key === \"Escape\" && isOpen.value) {\n e.preventDefault();\n close();\n }\n}\n\nfunction currentFocusedIdx(): number {\n const el = document.activeElement as HTMLElement | null;\n if (!el) return -1;\n for (const [idx, node] of optionRefs.entries()) {\n if (node === el) return idx;\n }\n return -1;\n}\n\nfunction moveFocus(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = currentFocusedIdx();\n let pos = order.indexOf(cur);\n if (pos === -1) {\n focusOptionByIdx(delta > 0 ? order[0] : order[order.length - 1]);\n return;\n }\n pos = (pos + delta + order.length) % order.length;\n focusOptionByIdx(order[pos]);\n}\n\nfunction onListKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveFocus(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveFocus(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[0]);\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[order.length - 1]);\n } else if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n const idx = currentFocusedIdx();\n if (idx >= 0) selectItem(displayedItems.value[idx]);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n } else if (\n !props.searchable &&\n e.key.length === 1 &&\n /^[a-zA-Z0-9]$/.test(e.key)\n ) {\n const order = focusableIndices();\n const letter = e.key.toLowerCase();\n const match = order.find((i) =>\n displayedItems.value[i].title.toLowerCase().startsWith(letter),\n );\n if (match !== undefined) focusOptionByIdx(match);\n }\n}\n\nwatch(isOpen, (open) => {\n if (!open) focusTrigger();\n});\n\nconst highlightedIdx = ref<number>(-1);\n\nconst activeDescendantId = computed(() =>\n highlightedIdx.value >= 0\n ? `${listboxId}-opt-${highlightedIdx.value}`\n : undefined,\n);\n\nwatch(displayedItems, () => {\n if (!props.searchable) return;\n const order = focusableIndices();\n highlightedIdx.value = order[0] ?? -1;\n});\n\nwatch(isOpen, (open) => {\n if (!open) {\n highlightedIdx.value = -1;\n return;\n }\n if (!props.searchable) return;\n const idx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue && !it.disabled,\n );\n const order = focusableIndices();\n highlightedIdx.value = idx >= 0 ? idx : order[0] ?? -1;\n});\n\nfunction moveHighlight(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = order.indexOf(highlightedIdx.value);\n if (cur === -1) {\n highlightedIdx.value = delta > 0 ? order[0] : order[order.length - 1];\n return;\n }\n const next = (cur + delta + order.length) % order.length;\n highlightedIdx.value = order[next];\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveHighlight(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveHighlight(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[0];\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[order.length - 1];\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n if (highlightedIdx.value >= 0) {\n selectItem(displayedItems.value[highlightedIdx.value]);\n }\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n }\n}\n\n// Dev-only: warn once per offending item when both icon and avatar are set.\nif (import.meta.env?.DEV ?? true) {\n const warned = new Set<SwitcherValue>();\n watchEffect(() => {\n for (const item of props.items) {\n if (item.icon && item.avatar && !warned.has(item.value)) {\n warned.add(item.value);\n console.warn(\n `[Switcher] item \"${item.value}\" declares both \\`icon\\` and \\`avatar\\`; \\`avatar\\` wins. Pick one.`,\n );\n }\n }\n });\n}\n\ndefineExpose({ open, close, toggle });\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkOA,MAAM,QAAQ;EAed,MAAM,OAAO;EAEb,MAAM,SAAS,eAAe;EAC9B,MAAM,iBAAiB,wBAAwB,MAAM,OAAO;EAC5D,MAAM,YAAY,OAAO;EAEzB,MAAM,sBAAsB,eACpB,MAAM,eAAe,OAAO,MAAM,SAAS,YAClD;EACD,MAAM,oBAAoB,eAClB,MAAM,aAAa,OAAO,MAAM,SAAS,UAChD;EACD,MAAM,oBAAoB,eAClB,MAAM,aAAa,OAAO,MAAM,SAAS,MAChD;EACD,MAAM,4BAA4B,eAC1B,MAAM,qBAAqB,OAAO,MAAM,SAAS,kBACxD;EACD,MAAM,oBAAoB,eAClB,MAAM,iBAAiB,OAAO,MAAM,SAAS,UACpD;E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AAc,QAAQ,eAAA,QAAc,cAAA;QAAkD,KAAK,WAAQ,kCAAA;;OAKzL,UAAK,WAAE,WAAW,KAAI;OACtB,eAAU,WAAE,QAAA,aAAc,eAAA,QAAiB,MAAG;;OAEnC,KAAK,UAAA,WAAA,EAAjB,mBAOO,QAPP,aAOO,CANL,YAKE,gBAAA;QAJC,KAAK,KAAK,OAAO;QACjB,UAAU,KAAK,OAAO;QACtB,MAAM,KAAK;QACZ,MAAK;;;;;eAII,KAAK,QAAA,WAAA,EADlB,mBAMO,QANP,aAMO,EAAA,WAAA,EADL,YAAgE,wBAAhD,KAAK,KAAI,EAAA;QAAE,OAAM;QAAU,eAAY;;OAEzD,mBAMO,QANP,aAMO,CALL,mBAAoE,QAApE,aAAoE,gBAApB,KAAK,MAAK,EAAA,EAAA,EAElD,KAAK,YAAA,WAAA,EADb,mBAG2B,QAH3B,aAG2B,gBAAvB,KAAK,SAAQ,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA;OAEnB,WAWO,KAAA,QAAA,iBAAA;QATE;QACN,QAAQ,KAAK,UAAU,QAAA;QACvB,OAAO,MAAA,MAAK;gBAOR,CAJG,KAAK,UAAU,QAAA,cAAA,WAAA,EADvB,YAIE,MAAA,UAAA,EAAA;;QAFA,OAAM;QACN,eAAY;;;;KAMJA,KAAAA,OAAO,UAAA,WAAA,EAAvB,mBASW,UAAA,EAAA,KAAA,GAAA,EAAA,CAAA,OAAA,OAAA,OAAA,KART,mBAIE,MAAA;MAHA,iCAAA;MACA,MAAK;MACL,OAAM;oBAER,mBAEM,OAFN,aAEM,CADJ,WAAqC,KAAA,QAAA,UAAA,EAAhB,OAAO,MAAA,MAAK,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,GAAA,IAAA,mBAAA,IAAA,KAAA"}
|
|
1
|
+
{"version":3,"file":"Switcher.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../src/components/navigation/Switcher.vue"],"sourcesContent":["<template>\n <div class=\"modo-switcher inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <span ref=\"triggerWrapEl\" class=\"inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <slot\n name=\"trigger\"\n :activeItem=\"activeItem\"\n :isOpen=\"isOpen\"\n :toggle=\"onTriggerClick\"\n >\n <button\n ref=\"triggerEl\"\n type=\"button\"\n data-modo-switcher-trigger\n aria-haspopup=\"listbox\"\n :aria-expanded=\"isOpen\"\n :aria-label=\"resolvedAriaLabel\"\n :disabled=\"disabled\"\n :class=\"[\n 'inline-flex items-center gap-3 px-3 py-2 text-left transition-colors',\n 'border bg-card text-card-foreground border-border',\n 'hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60',\n radiusClass,\n fullWidth ? 'w-full' : '',\n disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span v-if=\"activeItem?.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"activeItem.avatar.src\"\n :initials=\"activeItem.avatar.initials\"\n :name=\"activeItem.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"activeItem?.icon\"\n class=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\n >\n <component :is=\"activeItem.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">\n {{ activeItem ? activeItem.title : resolvedPlaceholder }}\n </span>\n <span\n v-if=\"!compactTrigger && activeItem?.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >\n {{ activeItem.subtitle }}\n </span>\n </span>\n <ChevronUpDownIcon\n v-if=\"chevron === 'updown'\"\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <ChevronDownIcon\n v-else-if=\"chevron === 'down'\"\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n </button>\n </slot>\n </span>\n\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"resolvedRadius\"\n role=\"dialog\"\n :aria-label=\"resolvedAriaLabel\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div\n data-modo-switcher-panel\n class=\"modo-switcher-panel overflow-y-auto\"\n :style=\"{ maxHeight: panelMaxHeightStyle }\"\n >\n <div\n v-if=\"panelTitle\"\n class=\"px-3 pt-3 pb-2 text-caption text-muted-foreground uppercase tracking-wider\"\n >\n {{ panelTitle }}\n </div>\n\n <div v-if=\"searchable\" class=\"px-2 pt-2 pb-1\">\n <input\n ref=\"searchInputEl\"\n v-model=\"searchQuery\"\n role=\"searchbox\"\n type=\"text\"\n :placeholder=\"resolvedSearchPlaceholder\"\n :aria-controls=\"listboxId\"\n :aria-activedescendant=\"activeDescendantId\"\n class=\"w-full px-2 py-1.5 text-body bg-background border border-border rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60\"\n @keydown=\"onSearchKeydown\"\n />\n </div>\n\n <template v-if=\"loading\">\n <slot name=\"loading\">\n <div class=\"p-2 flex flex-col gap-1\">\n <div\n v-for=\"i in 3\"\n :key=\"i\"\n data-modo-switcher-skeleton\n >\n <Skeleton height=\"44px\" />\n </div>\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"items.length === 0\">\n <slot name=\"empty\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedEmptyText }}\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"displayedItems.length === 0\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedNoResults }}\n </div>\n </template>\n\n <ul\n v-else\n role=\"listbox\"\n :id=\"listboxId\"\n class=\"flex flex-col\"\n @keydown=\"onListKeydown\"\n >\n <li\n v-for=\"(item, idx) in displayedItems\"\n :key=\"item.value\"\n :ref=\"(el) => setOptionRef(el as HTMLElement | null, idx)\"\n role=\"option\"\n :id=\"`${listboxId}-opt-${idx}`\"\n :aria-selected=\"item.value === modelValue\"\n :aria-current=\"item.value === modelValue ? 'true' : undefined\"\n :aria-disabled=\"item.disabled || undefined\"\n :data-active=\"item.value === modelValue || undefined\"\n :tabindex=\"-1\"\n class=\"modo-switcher-item flex items-center gap-3 px-3 py-2 cursor-pointer\"\n :class=\"[\n item.value === modelValue ? 'bg-accent/40' : '',\n searchable && idx === highlightedIdx ? 'bg-accent' : 'hover:bg-accent',\n item.disabled ? 'opacity-50 cursor-not-allowed' : '',\n ]\"\n @click=\"selectItem(item)\"\n @mouseenter=\"searchable ? (highlightedIdx = idx) : null\"\n >\n <span v-if=\"item.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"item.avatar.src\"\n :initials=\"item.avatar.initials\"\n :name=\"item.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"item.icon\"\n data-modo-switcher-iconwrap\n class=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\n >\n <component :is=\"item.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">{{ item.title }}</span>\n <span\n v-if=\"item.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >{{ item.subtitle }}</span>\n </span>\n <slot\n name=\"item-trailing\"\n :item=\"item\"\n :active=\"item.value === modelValue\"\n :close=\"close\"\n >\n <CheckIcon\n v-if=\"item.value === modelValue\"\n class=\"w-4 h-4 shrink-0\"\n aria-hidden=\"true\"\n />\n </slot>\n </li>\n </ul>\n\n <template v-if=\"$slots.footer\">\n <hr\n data-modo-switcher-footer-sep\n role=\"separator\"\n class=\"my-1 border-t border-border\"\n />\n <div class=\"p-1\">\n <slot name=\"footer\" :close=\"close\" />\n </div>\n </template>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch, watchEffect } from \"vue\";\nimport { ChevronUpDownIcon, ChevronDownIcon, CheckIcon } from \"@heroicons/vue/24/outline\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Avatar from \"../data-display/avatar/Avatar.vue\";\nimport Skeleton from \"../feedback/Skeleton.vue\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport {\n useResolvedRadius,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport type {\n Switcher as SwitcherProps,\n SwitcherEmits,\n SwitcherItem,\n SwitcherValue,\n} from \"../../interfaces/navigation/Switcher.interface\";\n\nconst props = withDefaults(defineProps<SwitcherProps>(), {\n modelValue: null,\n chevron: \"updown\",\n triggerVariant: \"outline\",\n compactTrigger: false,\n fullWidth: false,\n panelWidth: \"trigger\",\n panelMinWidth: \"15rem\",\n panelMaxHeight: 320,\n placement: \"bottom-start\",\n searchable: false,\n loading: false,\n disabled: false,\n});\n\nconst emit = defineEmits<SwitcherEmits>();\n\nconst locale = useModoLocale();\nconst resolvedRadius = useResolvedRadius(() => props.radius);\nconst listboxId = useId();\n\nconst resolvedPlaceholder = computed(\n () => props.placeholder ?? locale.value.switcher.placeholder,\n);\nconst resolvedAriaLabel = computed(\n () => props.ariaLabel ?? locale.value.switcher.ariaLabel,\n);\nconst resolvedEmptyText = computed(\n () => props.emptyText ?? locale.value.switcher.empty,\n);\nconst resolvedSearchPlaceholder = computed(\n () => props.searchPlaceholder ?? locale.value.switcher.searchPlaceholder,\n);\nconst resolvedNoResults = computed(\n () => props.noResultsText ?? locale.value.switcher.noResults,\n);\n\nconst searchQuery = ref(\"\");\nconst searchInputEl = ref<HTMLInputElement | null>(null);\n\nconst displayedItems = computed<SwitcherItem[]>(() => {\n if (!props.searchable) return props.items;\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return props.items;\n const fields = props.searchFields ?? [\"title\", \"subtitle\"];\n return props.items.filter((it) =>\n fields.some((f) => {\n const v = it[f];\n return typeof v === \"string\" && v.toLowerCase().includes(q);\n }),\n );\n});\n\nwatch(searchQuery, (q) => {\n emit(\"search\", q);\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-lg\";\n case \"full\": return \"rounded-[999px]\";\n default: return \"rounded-md\";\n }\n});\n\nconst panelMaxHeightStyle = computed(() => {\n const v = props.panelMaxHeight;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\nconst panelMinWidthStyle = computed(() => {\n const v = props.panelMinWidth;\n if (v == null) return undefined;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\n// The popover composable sizes the panel to the trigger width when\n// `panelWidth='trigger'`. A narrow trigger (e.g. an avatar-only custom\n// trigger) would otherwise crush the panel — `minWidth` floors it.\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(panelMinWidthStyle.value ? { minWidth: panelMinWidthStyle.value } : {}),\n}));\n\nconst activeItem = computed<SwitcherItem | null>(() => {\n if (props.modelValue == null) return null;\n return props.items.find((i) => i.value === props.modelValue) ?? null;\n});\n\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open,\n close,\n toggle,\n} = usePopover({\n placement: () => props.placement,\n matchTriggerWidth: () => props.panelWidth === \"trigger\",\n closeOnEscape: false,\n onOpen: () => emit(\"open\"),\n onClose: () => {\n searchQuery.value = \"\";\n emit(\"close\");\n },\n});\n\nconst triggerEl = ref<HTMLElement | null>(null);\nconst triggerWrapEl = ref<HTMLElement | null>(null);\nwatch([triggerEl, triggerWrapEl], ([btn, wrap]) => {\n triggerRef.value = (btn as HTMLElement | null) ?? (wrap as HTMLElement | null);\n});\n\nfunction focusTrigger() {\n const el = triggerEl.value ?? triggerWrapEl.value;\n el?.focus?.();\n}\n\nfunction onTriggerClick() {\n if (props.disabled) return;\n toggle();\n}\n\nfunction selectItem(item: SwitcherItem) {\n if (item.disabled || props.disabled) return;\n emit(\"update:modelValue\", item.value);\n emit(\"change\", item.value, item);\n close();\n}\n\nfunction focusableIndices(): number[] {\n return displayedItems.value\n .map((it, i) => (it.disabled ? -1 : i))\n .filter((i) => i !== -1);\n}\n\nconst optionRefs = new Map<number, HTMLElement>();\nfunction setOptionRef(el: HTMLElement | null, idx: number) {\n if (el) optionRefs.set(idx, el);\n else optionRefs.delete(idx);\n}\n\nfunction focusOptionByIdx(idx: number) {\n optionRefs.get(idx)?.focus();\n}\n\nasync function openAndFocusActive() {\n if (props.disabled) return;\n if (!isOpen.value) open();\n await nextTick();\n if (props.searchable) {\n searchInputEl.value?.focus();\n return;\n }\n const order = focusableIndices();\n if (!order.length) return;\n const activeIdx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue,\n );\n const usable =\n activeIdx >= 0 && !displayedItems.value[activeIdx].disabled\n ? activeIdx\n : order[0];\n focusOptionByIdx(usable);\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if ([\"ArrowDown\", \"ArrowUp\", \"Enter\", \" \"].includes(e.key)) {\n e.preventDefault();\n openAndFocusActive();\n } else if (e.key === \"Escape\" && isOpen.value) {\n e.preventDefault();\n close();\n }\n}\n\nfunction currentFocusedIdx(): number {\n const el = document.activeElement as HTMLElement | null;\n if (!el) return -1;\n for (const [idx, node] of optionRefs.entries()) {\n if (node === el) return idx;\n }\n return -1;\n}\n\nfunction moveFocus(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = currentFocusedIdx();\n let pos = order.indexOf(cur);\n if (pos === -1) {\n focusOptionByIdx(delta > 0 ? order[0] : order[order.length - 1]);\n return;\n }\n pos = (pos + delta + order.length) % order.length;\n focusOptionByIdx(order[pos]);\n}\n\nfunction onListKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveFocus(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveFocus(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[0]);\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[order.length - 1]);\n } else if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n const idx = currentFocusedIdx();\n if (idx >= 0) selectItem(displayedItems.value[idx]);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n } else if (\n !props.searchable &&\n e.key.length === 1 &&\n /^[a-zA-Z0-9]$/.test(e.key)\n ) {\n const order = focusableIndices();\n const letter = e.key.toLowerCase();\n const match = order.find((i) =>\n displayedItems.value[i].title.toLowerCase().startsWith(letter),\n );\n if (match !== undefined) focusOptionByIdx(match);\n }\n}\n\nwatch(isOpen, (open) => {\n if (!open) focusTrigger();\n});\n\nconst highlightedIdx = ref<number>(-1);\n\nconst activeDescendantId = computed(() =>\n highlightedIdx.value >= 0\n ? `${listboxId}-opt-${highlightedIdx.value}`\n : undefined,\n);\n\nwatch(displayedItems, () => {\n if (!props.searchable) return;\n const order = focusableIndices();\n highlightedIdx.value = order[0] ?? -1;\n});\n\nwatch(isOpen, (open) => {\n if (!open) {\n highlightedIdx.value = -1;\n return;\n }\n if (!props.searchable) return;\n const idx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue && !it.disabled,\n );\n const order = focusableIndices();\n highlightedIdx.value = idx >= 0 ? idx : order[0] ?? -1;\n});\n\nfunction moveHighlight(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = order.indexOf(highlightedIdx.value);\n if (cur === -1) {\n highlightedIdx.value = delta > 0 ? order[0] : order[order.length - 1];\n return;\n }\n const next = (cur + delta + order.length) % order.length;\n highlightedIdx.value = order[next];\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveHighlight(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveHighlight(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[0];\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[order.length - 1];\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n if (highlightedIdx.value >= 0) {\n selectItem(displayedItems.value[highlightedIdx.value]);\n }\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n }\n}\n\n// Dev-only: warn once per offending item when both icon and avatar are set.\nif (import.meta.env?.DEV ?? true) {\n const warned = new Set<SwitcherValue>();\n watchEffect(() => {\n for (const item of props.items) {\n if (item.icon && item.avatar && !warned.has(item.value)) {\n warned.add(item.value);\n console.warn(\n `[Switcher] item \"${item.value}\" declares both \\`icon\\` and \\`avatar\\`; \\`avatar\\` wins. Pick one.`,\n );\n }\n }\n });\n}\n\ndefineExpose({ open, close, toggle });\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkOA,MAAM,QAAQ;EAed,MAAM,OAAO;EAEb,MAAM,SAAS,eAAe;EAC9B,MAAM,iBAAiB,wBAAwB,MAAM,OAAO;EAC5D,MAAM,YAAY,OAAO;EAEzB,MAAM,sBAAsB,eACpB,MAAM,eAAe,OAAO,MAAM,SAAS,YAClD;EACD,MAAM,oBAAoB,eAClB,MAAM,aAAa,OAAO,MAAM,SAAS,UAChD;EACD,MAAM,oBAAoB,eAClB,MAAM,aAAa,OAAO,MAAM,SAAS,MAChD;EACD,MAAM,4BAA4B,eAC1B,MAAM,qBAAqB,OAAO,MAAM,SAAS,kBACxD;EACD,MAAM,oBAAoB,eAClB,MAAM,iBAAiB,OAAO,MAAM,SAAS,UACpD;EAED,MAAM,cAAc,IAAI,GAAG;EAC3B,MAAM,gBAAgB,IAA6B,KAAK;EAExD,MAAM,iBAAiB,eAA+B;GACpD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,eAAU,WAAE,QAAA,aAAc,eAAA,QAAiB,MAAG;;OAEnC,KAAK,UAAA,WAAA,EAAjB,mBAOO,QAPP,aAOO,CANL,YAKE,gBAAA;QAJC,KAAK,KAAK,OAAO;QACjB,UAAU,KAAK,OAAO;QACtB,MAAM,KAAK;QACZ,MAAK;;;;;eAII,KAAK,QAAA,WAAA,EADlB,mBAMO,QANP,aAMO,EAAA,WAAA,EADL,YAAgE,wBAAhD,KAAK,KAAI,EAAA;QAAE,OAAM;QAAU,eAAY;;OAEzD,mBAMO,QANP,aAMO,CALL,mBAAoE,QAApE,aAAoE,gBAApB,KAAK,MAAK,EAAA,EAAA,EAElD,KAAK,YAAA,WAAA,EADb,mBAG2B,QAH3B,aAG2B,gBAAvB,KAAK,SAAQ,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA;OAEnB,WAWO,KAAA,QAAA,iBAAA;QATE;QACN,QAAQ,KAAK,UAAU,QAAA;QACvB,OAAO,MAAA,MAAK;gBAOR,CAJG,KAAK,UAAU,QAAA,cAAA,WAAA,EADvB,YAIE,MAAA,UAAA,EAAA;;QAFA,OAAM;QACN,eAAY;;;;KAMJA,KAAAA,OAAO,UAAA,WAAA,EAAvB,mBASW,UAAA,EAAA,KAAA,GAAA,EAAA,CAAA,OAAA,OAAA,OAAA,KART,mBAIE,MAAA;MAHA,iCAAA;MACA,MAAK;MACL,OAAM;oBAER,mBAEM,OAFN,aAEM,CADJ,WAAqC,KAAA,QAAA,UAAA,EAAhB,OAAO,MAAA,MAAK,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,GAAA,IAAA,mBAAA,IAAA,KAAA"}
|
|
@@ -2,7 +2,7 @@ const require__plugin_vue_export_helper = require("../../_virtual/_plugin-vue_ex
|
|
|
2
2
|
const require_Tabs_vue_vue_type_script_setup_true_lang = require("./Tabs.vue_vue_type_script_setup_true_lang.cjs");
|
|
3
3
|
;/* empty css */
|
|
4
4
|
//#region src/components/navigation/Tabs.vue
|
|
5
|
-
var Tabs_default = /* @__PURE__ */ require__plugin_vue_export_helper.default(require_Tabs_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-
|
|
5
|
+
var Tabs_default = /* @__PURE__ */ require__plugin_vue_export_helper.default(require_Tabs_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-8d7840c0"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
exports.default = Tabs_default;
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.cjs","names":[],"sources":["../../../src/components/navigation/Tabs.vue"],"sourcesContent":["<template> \n <div :class=\"['flex flex-col', fullWidth ? 'w-full' : '']\"> \n <!-- Tablist --> \n <div \n :class=\"[ \n 'modo-tabs-scroll', \n 'relative flex', \n isSegmented ? '' : 'overflow-x-auto', \n isLine ? 'border-b border-border' : '', \n isSegmented ? `${segmentedTrackRadius} bg-muted p-1 gap-1` : '', \n isLine || isPill ? 'gap-1' : '', \n fullWidth ? 'w-full' : '', \n ]\" \n > \n <div \n ref=\"tablistEl\" \n role=\"tablist\" \n :aria-label=\"ariaLabel\" \n aria-orientation=\"horizontal\" \n :class=\"[ \n 'relative flex', \n isSegmented ? 'gap-1 w-full' : 'gap-1', \n fullWidth ? 'w-full' : '', \n ]\" \n > \n <!-- Sliding indicator --> \n <span \n ref=\"indicatorEl\" \n class=\"modo-tab-indicator absolute pointer-events-none\" \n :class=\"indicatorClasses\" \n :style=\"indicatorStyle\" \n aria-hidden=\"true\" \n /> \n \n <component \n :is=\"resolveItemTag(item)\" \n v-for=\"(item, idx) in items\" \n :key=\"item.value\" \n :ref=\"(el: any) => setItemRef(el, idx)\" \n role=\"tab\" \n :id=\"`${tabsId}-tab-${item.value}`\" \n :aria-controls=\"`${tabsId}-panel-${item.value}`\" \n :aria-selected=\"isActive(item) ? 'true' : 'false'\" \n :aria-disabled=\"item.disabled || undefined\" \n :aria-label=\"item.ariaLabel\" \n :tabindex=\"getTabIndex(item)\" \n :type=\"item.to ? undefined : 'button'\" \n :href=\"item.to && !item.disabled ? item.to : undefined\" \n :disabled=\"!item.to && item.disabled\" \n :class=\"[ \n 'modo-tab relative z-10', \n 'inline-flex items-center justify-center gap-2 select-none whitespace-nowrap', \n sizeClasses, \n itemRadiusClasses, \n fullWidth ? 'flex-1' : '', \n 'transition-colors duration-base ease-standard', \n 'focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2', \n focusRingClass, \n item.disabled \n ? 'opacity-50 cursor-not-allowed' \n : 'cursor-pointer', \n ...itemStateClasses(item), \n ]\" \n @click=\"onItemClick($event, item)\" \n @keydown=\"onKeydown\" \n > \n <component \n v-if=\"item.icon\" \n :is=\"item.icon\" \n aria-hidden=\"true\" \n :class=\"iconSizeClass\" \n /> \n <span class=\"text-inherit\">{{ item.label }}</span> \n <span \n v-if=\"item.badge !== undefined && item.badge !== null && item.badge !== ''\" \n :class=\"[ \n 'inline-flex items-center justify-center rounded-full text-caption font-medium px-1.5 min-w-5 h-5', \n badgeStateClass(item), \n ]\" \n aria-hidden=\"true\" \n >{{ item.badge }}</span> \n </component> \n </div> \n </div> \n \n <!-- Panels --> \n <div :class=\"['modo-tabs-panels', panelsContainerClass]\"> \n <template v-for=\"item in items\" :key=\"`panel-${item.value}`\"> \n <div \n v-if=\"shouldRenderPanel(item)\" \n v-show=\"!keepMounted || isActive(item)\" \n role=\"tabpanel\" \n :id=\"`${tabsId}-panel-${item.value}`\" \n :aria-labelledby=\"`${tabsId}-tab-${item.value}`\" \n :hidden=\"!isActive(item) || undefined\" \n :tabindex=\"0\" \n class=\"focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-md\" \n > \n <slot :name=\"`panel-${item.value}`\" :item=\"item\" :active=\"isActive(item)\"> \n <slot name=\"panel\" :item=\"item\" :active=\"isActive(item)\" /> \n </slot> \n </div> \n </template> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';\nimport type { Tabs as TabsProps, TabItem, TabsEmits } from '../../interfaces/navigation/Tabs.interface';\nimport { useResolvedColor, useResolvedRadius, useResolvedSize, useSizeTokens } from '../../composables/useModoConfig'; \n \nconst props = withDefaults(defineProps<TabsProps>(), { \n variant: 'line', \n fullWidth: false, \n lazy: false, \n keepMounted: true, \n linkComponent: 'a', \n}); \n \nconst emit = defineEmits<TabsEmits>(); \n \nconst resolvedColor = useResolvedColor(() => props.color);\nconst resolvedRadius = useResolvedRadius(() => props.radius);\nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size); \n \n// Stable id for ARIA wiring. \nlet _id = 0; \nconst tabsId = `modo-tabs-${++_id}-${Math.random().toString(36).slice(2, 7)}`; \n \nconst isLine = computed(() => props.variant === 'line'); \nconst isPill = computed(() => props.variant === 'pill'); \nconst isSegmented = computed(() => props.variant === 'segmented'); \n \nconst internalActive = ref<string | number | null>( \n props.modelValue ?? props.items.find(i => !i.disabled)?.value ?? null, \n); \n \nwatch( \n () => props.modelValue, \n v => { \n if (v !== undefined && v !== internalActive.value) internalActive.value = v; \n }, \n); \n \nfunction isActive(item: TabItem) { \n return internalActive.value === item.value; \n} \n \n// Track which panels have been mounted (for `lazy`). \nconst mounted = ref<Set<string | number>>(new Set()); \nfunction shouldRenderPanel(item: TabItem) { \n if (!props.lazy) return true; \n if (isActive(item)) { \n if (!mounted.value.has(item.value)) mounted.value.add(item.value); \n return true; \n } \n return props.keepMounted && mounted.value.has(item.value); \n} \n \n// --- DOM refs for keyboard navigation & scroll-into-view ---------------- \nconst tablistEl = ref<HTMLElement | null>(null); \nconst indicatorEl = ref<HTMLElement | null>(null); \nconst itemRefs = ref<(HTMLElement | null)[]>([]); \nfunction setItemRef(el: HTMLElement | null, idx: number) { \n itemRefs.value[idx] = el; \n} \n \n// --- Sliding indicator -------------------------------------------------- \n// A single absolutely-positioned element that travels between tabs and \n// morphs its width/height. Replaces the per-item bg/border for the active \n// state, so the change feels continuous instead of \"snapping\". \n// \n// Initial state is invisible (opacity 0) so it doesn't fly in from the \n// top-left on first render. After the first synchronous measurement we \n// flip opacity to 1 with the animation suppressed for that one frame. \nconst indicatorStyle = ref<Record<string, string>>({ \n transform: 'translate3d(0, 0, 0)', \n width: '0px', \n height: '0px', \n opacity: '0', \n}); \nlet _firstMeasureDone = false; \n \nfunction measureIndicator(animated = true) { \n const idx = props.items.findIndex(i => i.value === internalActive.value); \n const el = itemRefs.value[idx]; \n if (!el) return; \n \n const left = el.offsetLeft; \n const top = el.offsetTop; \n const width = el.offsetWidth; \n const height = el.offsetHeight; \n \n // Width === 0 means the layout isn't ready yet (e.g. measuring before \n // mount/paint). Bail; the next animation frame will retry. \n if (width === 0 && height === 0) return; \n \n const node = indicatorEl.value; \n if (!animated && node) { \n // Skip the transition for this one frame so the indicator can \n // \"appear\" at its measured position without flying in. \n node.classList.add('modo-tab-indicator--no-anim'); \n requestAnimationFrame(() => { \n requestAnimationFrame(() => { \n node.classList.remove('modo-tab-indicator--no-anim'); \n }); \n }); \n } \n \n if (isLine.value) { \n // Bottom 2px bar; sits on top of the wrapper's `border-b` line. \n indicatorStyle.value = { \n transform: `translate3d(${left}px, 0, 0)`, \n width: `${width}px`, \n height: '2px', \n bottom: '-1px', \n top: 'auto', \n opacity: '1', \n }; \n } else { \n // Pill / segmented: full footprint of the tab. \n indicatorStyle.value = { \n transform: `translate3d(${left}px, ${top}px, 0)`, \n width: `${width}px`, \n height: `${height}px`, \n top: '0', \n opacity: '1', \n }; \n } \n \n _firstMeasureDone = true; \n} \n \nlet _ro: ResizeObserver | null = null; \nonMounted(() => { \n // Wait two frames: one for Vue to commit DOM, one for layout/fonts. \n requestAnimationFrame(() => { \n requestAnimationFrame(() => measureIndicator(false)); \n }); \n if (typeof ResizeObserver !== 'undefined' && tablistEl.value) { \n _ro = new ResizeObserver(() => { \n // Animation off during resize, on after first measure. \n measureIndicator(_firstMeasureDone); \n }); \n _ro.observe(tablistEl.value); \n } \n if (typeof window !== 'undefined') { \n window.addEventListener('resize', onWindowResize); \n } \n}); \nonBeforeUnmount(() => { \n _ro?.disconnect(); \n _ro = null; \n if (typeof window !== 'undefined') { \n window.removeEventListener('resize', onWindowResize); \n } \n}); \nfunction onWindowResize() { \n measureIndicator(false); \n} \n \nwatch( \n () => [internalActive.value, props.variant, resolvedSize.value, props.fullWidth, props.items.length, resolvedRadius.value, resolvedColor.value], \n () => { \n nextTick(() => measureIndicator(_firstMeasureDone)); \n }, \n); \n \nwatch( \n () => internalActive.value, \n () => { \n nextTick(() => { \n const idx = props.items.findIndex(i => i.value === internalActive.value); \n const el = itemRefs.value[idx]; \n if (el && typeof el.scrollIntoView === 'function') { \n el.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest' }); \n } \n }); \n }, \n); \n \n// --- Interaction -------------------------------------------------------- \nfunction activate(item: TabItem) { \n if (item.disabled || isActive(item)) return; \n internalActive.value = item.value; \n emit('update:modelValue', item.value); \n emit('change', item.value, item); \n} \n \nfunction onItemClick(e: MouseEvent, item: TabItem) { \n if (item.disabled) { \n e.preventDefault(); \n return; \n } \n activate(item); \n} \n \nfunction onKeydown(e: KeyboardEvent) { \n const key = e.key; \n if (!['ArrowLeft', 'ArrowRight', 'Home', 'End', 'Enter', ' '].includes(key)) return; \n \n const enabled = props.items \n .map((it, i) => ({ it, i })) \n .filter(({ it }) => !it.disabled); \n if (enabled.length === 0) return; \n \n const currentIdx = enabled.findIndex(({ it }) => it.value === internalActive.value); \n \n if (key === 'Enter' || key === ' ') { \n e.preventDefault(); \n // Activate currently focused tab (already handled by click on Enter for buttons, \n // but we do it explicitly to support `<a>` rendering as well). \n const focused = document.activeElement; \n const idx = itemRefs.value.findIndex(r => r === focused); \n const item = idx >= 0 ? props.items[idx] : null; \n if (item) activate(item); \n return; \n } \n \n e.preventDefault(); \n let next = currentIdx; \n if (key === 'ArrowRight') next = (currentIdx + 1 + enabled.length) % enabled.length; \n else if (key === 'ArrowLeft') next = (currentIdx - 1 + enabled.length) % enabled.length; \n else if (key === 'Home') next = 0; \n else if (key === 'End') next = enabled.length - 1; \n \n const target = enabled[next]; \n if (!target) return; \n activate(target.it); \n nextTick(() => itemRefs.value[target.i]?.focus()); \n} \n \nfunction getTabIndex(item: TabItem) { \n if (item.disabled) return -1; \n // Roving tabindex: only the active tab is in the tab order. \n return isActive(item) ? 0 : -1; \n} \n \nfunction resolveItemTag(item: TabItem) { \n if (item.to) return props.linkComponent ?? 'a'; \n return 'button'; \n} \n \n// --- Class maps ---------------------------------------------------------\nconst sizeClasses = computed(() => `${sz.value.control} ${sz.value.padX} ${sz.value.text}`);\n\nconst iconSizeClass = computed(() => sz.value.icon); \n \nconst itemRadiusClasses = computed(() => { \n if (isLine.value) return 'rounded-none'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-full'; \n case 'medium': \n default: return 'rounded-md'; \n } \n}); \n \nconst segmentedTrackRadius = computed(() => { \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-md'; \n case 'large': return 'rounded-2xl'; \n case 'full': return 'rounded-full'; \n case 'medium': \n default: return 'rounded-lg'; \n } \n}); \n \nconst focusRingClass = computed(() => { \n switch (resolvedColor.value) { \n case 'primary': return 'focus-visible:ring-primary'; \n case 'danger': return 'focus-visible:ring-destructive'; \n case 'success': return 'focus-visible:ring-success'; \n case 'warning': return 'focus-visible:ring-warning'; \n case 'default': \n default: return 'focus-visible:ring-ring'; \n } \n}); \n \n// Active text/border color tokens by `color` prop. \nfunction activeBrandText() { \n switch (resolvedColor.value) { \n case 'primary': return 'text-primary'; \n case 'danger': return 'text-destructive'; \n case 'success': return 'text-success'; \n case 'warning': return 'text-warning'; \n case 'default': \n default: return 'text-foreground'; \n } \n} \n \nfunction pillActiveClasses() { \n // Item-level active classes for `pill`. The indicator paints the fill; \n // here we only set the foreground so text reads against it. \n switch (resolvedColor.value) { \n case 'primary': return 'text-primary-foreground'; \n case 'danger': return 'text-destructive-foreground'; \n case 'success': return 'text-success-foreground'; \n case 'warning': return 'text-warning-foreground'; \n case 'default': \n default: return 'text-accent-foreground'; \n } \n} \n \nfunction itemStateClasses(item: TabItem): string[] { \n const active = isActive(item); \n const disabled = !!item.disabled; \n \n if (isLine.value) { \n // Reserve 2px at the bottom on every item so heights stay aligned — \n // the indicator paints the colored bar. \n const base = 'border-b-2 border-transparent -mb-px'; \n if (active) { \n return [base, activeBrandText(), 'font-medium']; \n } \n return [ \n base, \n 'text-muted-foreground', \n !disabled ? 'hover:text-foreground' : '', \n ]; \n } \n \n if (isPill.value) { \n if (active) { \n return ['font-medium', pillActiveClasses()]; \n } \n return [ \n 'text-muted-foreground', \n !disabled ? `hover:text-foreground hover:bg-accent/50 ${itemRadiusClasses.value}` : '', \n ]; \n } \n \n // segmented \n if (active) { \n return [ \n 'font-medium', \n resolvedColor.value === 'default' ? 'text-card-foreground' : activeBrandText(), \n ]; \n } \n return [ \n 'text-muted-foreground', \n !disabled ? 'hover:text-foreground' : '', \n ]; \n} \n \n// Indicator visual (variant + color aware). Position/size come from \n// `indicatorStyle`; classes describe the \"skin\". \nconst indicatorClasses = computed(() => { \n if (isLine.value) { \n switch (resolvedColor.value) { \n case 'primary': return 'bg-primary rounded-full'; \n case 'danger': return 'bg-destructive rounded-full'; \n case 'success': return 'bg-success rounded-full'; \n case 'warning': return 'bg-warning rounded-full'; \n case 'default': \n default: return 'bg-foreground rounded-full'; \n } \n } \n if (isPill.value) { \n const radiusCls = itemRadiusClasses.value; \n switch (resolvedColor.value) { \n case 'primary': return `${radiusCls} bg-primary`; \n case 'danger': return `${radiusCls} bg-destructive`; \n case 'success': return `${radiusCls} bg-success`; \n case 'warning': return `${radiusCls} bg-warning`; \n case 'default': \n default: return `${radiusCls} bg-accent`; \n } \n } \n // segmented: card-style chip on the muted track. \n return `${itemRadiusClasses.value} bg-card shadow-xs`; \n}); \n \nfunction badgeStateClass(item: TabItem): string { \n const active = isActive(item); \n if (isPill.value && active && resolvedColor.value !== 'default') { \n // Inverted badge on a colored pill: alpha over the foreground. \n return 'bg-white/25 text-current'; \n } \n if (active && resolvedColor.value !== 'default') { \n return 'bg-current/15 text-current'; \n } \n return 'bg-muted text-muted-foreground'; \n} \n \nconst panelsContainerClass = computed(() => { \n return isLine.value || isPill.value || isSegmented.value ? 'pt-4' : ''; \n}); \n \n// DEV: warn when no items. \nif (import.meta.env.DEV) { \n if (!props.items || props.items.length === 0) { \n // eslint-disable-next-line no-console \n console.warn('[mood-ui][Tabs] `items` prop is empty — nothing to render.'); \n } \n} \n \ndefineExpose({ \n activate, \n}); \n</script> \n \n<style scoped> \n/* Hide scrollbar on the horizontal tablist scroll wrapper. */ \n.modo-tabs-scroll { \n scrollbar-width: none; \n -ms-overflow-style: none; \n} \n.modo-tabs-scroll::-webkit-scrollbar { \n display: none; \n} \n \n/* Smooth ring color transitions for focus-visible. */ \n.modo-tab { \n transition-property: color, --tw-ring-color, --tw-ring-shadow, box-shadow; \n transition-duration: 220ms; \n transition-timing-function: cubic-bezier(0.2, 0, 0, 1); \n} \n \n/* Reset native anchor styles when an item renders as <a href>. */ \n.modo-tab[href] { \n text-decoration: none; \n} \n \n/* Sliding indicator. Animates transform + width simultaneously so the \n * background \"travels\" between tabs, morphing its size to match the new \n * target instead of snapping. */ \n.modo-tab-indicator { \n top: 0; \n left: 0; \n will-change: transform, width; \n transition-property: transform, width, height, background-color, box-shadow, opacity; \n transition-duration: 320ms; \n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); \n} \n \n/* On first paint we measure & position without animating, then re-enable. */ \n.modo-tab-indicator--no-anim { \n transition: none !important; \n} \n \n@media (prefers-reduced-motion: reduce) { \n .modo-tab-indicator { \n transition: opacity 120ms linear !important; \n } \n} \n</style>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Tabs.cjs","names":[],"sources":["../../../src/components/navigation/Tabs.vue"],"sourcesContent":["<template> \n <div :class=\"['flex flex-col', fullWidth ? 'w-full' : '']\"> \n <!-- Tablist --> \n <div \n :class=\"[ \n 'modo-tabs-scroll', \n 'relative flex', \n isSegmented ? '' : 'overflow-x-auto', \n isLine ? 'border-b border-border' : '', \n isSegmented ? `${segmentedTrackRadius} bg-muted p-1 gap-1` : '', \n isLine || isPill ? 'gap-1' : '', \n fullWidth ? 'w-full' : '', \n ]\" \n > \n <div \n ref=\"tablistEl\" \n role=\"tablist\" \n :aria-label=\"ariaLabel\" \n aria-orientation=\"horizontal\" \n :class=\"[ \n 'relative flex', \n isSegmented ? 'gap-1 w-full' : 'gap-1', \n fullWidth ? 'w-full' : '', \n ]\" \n > \n <!-- Sliding indicator --> \n <span \n ref=\"indicatorEl\" \n class=\"modo-tab-indicator absolute pointer-events-none\" \n :class=\"indicatorClasses\" \n :style=\"indicatorStyle\" \n aria-hidden=\"true\" \n /> \n \n <component \n :is=\"resolveItemTag(item)\" \n v-for=\"(item, idx) in items\" \n :key=\"item.value\" \n :ref=\"(el: any) => setItemRef(el, idx)\" \n role=\"tab\" \n :id=\"`${tabsId}-tab-${item.value}`\" \n :aria-controls=\"`${tabsId}-panel-${item.value}`\" \n :aria-selected=\"isActive(item) ? 'true' : 'false'\" \n :aria-disabled=\"item.disabled || undefined\" \n :aria-label=\"item.ariaLabel\" \n :tabindex=\"getTabIndex(item)\" \n :type=\"item.to ? undefined : 'button'\" \n :href=\"item.to && !item.disabled ? item.to : undefined\" \n :disabled=\"!item.to && item.disabled\" \n :class=\"[ \n 'modo-tab relative z-10', \n 'inline-flex items-center justify-center gap-2 select-none whitespace-nowrap', \n sizeClasses, \n itemRadiusClasses, \n fullWidth ? 'flex-1' : '', \n 'transition-colors duration-base ease-standard', \n 'focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2', \n focusRingClass, \n item.disabled \n ? 'opacity-50 cursor-not-allowed' \n : 'cursor-pointer', \n ...itemStateClasses(item), \n ]\" \n @click=\"onItemClick($event, item)\" \n @keydown=\"onKeydown\" \n > \n <component \n v-if=\"item.icon\" \n :is=\"item.icon\" \n aria-hidden=\"true\" \n :class=\"iconSizeClass\" \n /> \n <span class=\"text-inherit\">{{ item.label }}</span> \n <span \n v-if=\"item.badge !== undefined && item.badge !== null && item.badge !== ''\" \n :class=\"[ \n 'inline-flex items-center justify-center rounded-full text-caption font-medium px-1.5 min-w-5 h-5', \n badgeStateClass(item), \n ]\" \n aria-hidden=\"true\" \n >{{ item.badge }}</span> \n </component> \n </div> \n </div> \n \n <!-- Panels --> \n <div :class=\"['modo-tabs-panels', panelsContainerClass]\"> \n <template v-for=\"item in items\" :key=\"`panel-${item.value}`\"> \n <div \n v-if=\"shouldRenderPanel(item)\" \n v-show=\"!keepMounted || isActive(item)\" \n role=\"tabpanel\" \n :id=\"`${tabsId}-panel-${item.value}`\" \n :aria-labelledby=\"`${tabsId}-tab-${item.value}`\" \n :hidden=\"!isActive(item) || undefined\" \n :tabindex=\"0\" \n class=\"focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-md\" \n > \n <slot :name=\"`panel-${item.value}`\" :item=\"item\" :active=\"isActive(item)\"> \n <slot name=\"panel\" :item=\"item\" :active=\"isActive(item)\" /> \n </slot> \n </div> \n </template> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';\nimport type { Tabs as TabsProps, TabItem, TabsEmits } from '../../interfaces/navigation/Tabs.interface';\nimport { useResolvedColor, useResolvedRadius, useResolvedSize, useSizeTokens } from '../../composables/useModoConfig'; \n \nconst props = withDefaults(defineProps<TabsProps>(), { \n variant: 'line', \n fullWidth: false, \n lazy: false, \n keepMounted: true, \n linkComponent: 'a', \n}); \n \nconst emit = defineEmits<TabsEmits>(); \n \nconst resolvedColor = useResolvedColor(() => props.color);\nconst resolvedRadius = useResolvedRadius(() => props.radius);\nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size); \n \n// Stable id for ARIA wiring. \nlet _id = 0; \nconst tabsId = `modo-tabs-${++_id}-${Math.random().toString(36).slice(2, 7)}`; \n \nconst isLine = computed(() => props.variant === 'line'); \nconst isPill = computed(() => props.variant === 'pill'); \nconst isSegmented = computed(() => props.variant === 'segmented'); \n \nconst internalActive = ref<string | number | null>( \n props.modelValue ?? props.items.find(i => !i.disabled)?.value ?? null, \n); \n \nwatch( \n () => props.modelValue, \n v => { \n if (v !== undefined && v !== internalActive.value) internalActive.value = v; \n }, \n); \n \nfunction isActive(item: TabItem) { \n return internalActive.value === item.value; \n} \n \n// Track which panels have been mounted (for `lazy`). \nconst mounted = ref<Set<string | number>>(new Set()); \nfunction shouldRenderPanel(item: TabItem) { \n if (!props.lazy) return true; \n if (isActive(item)) { \n if (!mounted.value.has(item.value)) mounted.value.add(item.value); \n return true; \n } \n return props.keepMounted && mounted.value.has(item.value); \n} \n \n// --- DOM refs for keyboard navigation & scroll-into-view ---------------- \nconst tablistEl = ref<HTMLElement | null>(null); \nconst indicatorEl = ref<HTMLElement | null>(null); \nconst itemRefs = ref<(HTMLElement | null)[]>([]); \nfunction setItemRef(el: HTMLElement | null, idx: number) { \n itemRefs.value[idx] = el; \n} \n \n// --- Sliding indicator -------------------------------------------------- \n// A single absolutely-positioned element that travels between tabs and \n// morphs its width/height. Replaces the per-item bg/border for the active \n// state, so the change feels continuous instead of \"snapping\". \n// \n// Initial state is invisible (opacity 0) so it doesn't fly in from the \n// top-left on first render. After the first synchronous measurement we \n// flip opacity to 1 with the animation suppressed for that one frame. \nconst indicatorStyle = ref<Record<string, string>>({ \n transform: 'translate3d(0, 0, 0)', \n width: '0px', \n height: '0px', \n opacity: '0', \n}); \nlet _firstMeasureDone = false; \n \nfunction measureIndicator(animated = true) { \n const idx = props.items.findIndex(i => i.value === internalActive.value); \n const el = itemRefs.value[idx]; \n if (!el) return; \n \n const left = el.offsetLeft; \n const top = el.offsetTop; \n const width = el.offsetWidth; \n const height = el.offsetHeight; \n \n // Width === 0 means the layout isn't ready yet (e.g. measuring before \n // mount/paint). Bail; the next animation frame will retry. \n if (width === 0 && height === 0) return; \n \n const node = indicatorEl.value; \n if (!animated && node) { \n // Skip the transition for this one frame so the indicator can \n // \"appear\" at its measured position without flying in. \n node.classList.add('modo-tab-indicator--no-anim'); \n requestAnimationFrame(() => { \n requestAnimationFrame(() => { \n node.classList.remove('modo-tab-indicator--no-anim'); \n }); \n }); \n } \n \n if (isLine.value) { \n // Bottom 2px bar; sits on top of the wrapper's `border-b` line. \n indicatorStyle.value = { \n transform: `translate3d(${left}px, 0, 0)`, \n width: `${width}px`, \n height: '2px', \n bottom: '-1px', \n top: 'auto', \n opacity: '1', \n }; \n } else { \n // Pill / segmented: full footprint of the tab. \n indicatorStyle.value = { \n transform: `translate3d(${left}px, ${top}px, 0)`, \n width: `${width}px`, \n height: `${height}px`, \n top: '0', \n opacity: '1', \n }; \n } \n \n _firstMeasureDone = true; \n} \n \nlet _ro: ResizeObserver | null = null; \nonMounted(() => { \n // Wait two frames: one for Vue to commit DOM, one for layout/fonts. \n requestAnimationFrame(() => { \n requestAnimationFrame(() => measureIndicator(false)); \n }); \n if (typeof ResizeObserver !== 'undefined' && tablistEl.value) { \n _ro = new ResizeObserver(() => { \n // Animation off during resize, on after first measure. \n measureIndicator(_firstMeasureDone); \n }); \n _ro.observe(tablistEl.value); \n } \n if (typeof window !== 'undefined') { \n window.addEventListener('resize', onWindowResize); \n } \n}); \nonBeforeUnmount(() => { \n _ro?.disconnect(); \n _ro = null; \n if (typeof window !== 'undefined') { \n window.removeEventListener('resize', onWindowResize); \n } \n}); \nfunction onWindowResize() { \n measureIndicator(false); \n} \n \nwatch( \n () => [internalActive.value, props.variant, resolvedSize.value, props.fullWidth, props.items.length, resolvedRadius.value, resolvedColor.value], \n () => { \n nextTick(() => measureIndicator(_firstMeasureDone)); \n }, \n); \n \nwatch( \n () => internalActive.value, \n () => { \n nextTick(() => { \n const idx = props.items.findIndex(i => i.value === internalActive.value); \n const el = itemRefs.value[idx]; \n if (el && typeof el.scrollIntoView === 'function') { \n el.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest' }); \n } \n }); \n }, \n); \n \n// --- Interaction -------------------------------------------------------- \nfunction activate(item: TabItem) { \n if (item.disabled || isActive(item)) return; \n internalActive.value = item.value; \n emit('update:modelValue', item.value); \n emit('change', item.value, item); \n} \n \nfunction onItemClick(e: MouseEvent, item: TabItem) { \n if (item.disabled) { \n e.preventDefault(); \n return; \n } \n activate(item); \n} \n \nfunction onKeydown(e: KeyboardEvent) { \n const key = e.key; \n if (!['ArrowLeft', 'ArrowRight', 'Home', 'End', 'Enter', ' '].includes(key)) return; \n \n const enabled = props.items \n .map((it, i) => ({ it, i })) \n .filter(({ it }) => !it.disabled); \n if (enabled.length === 0) return; \n \n const currentIdx = enabled.findIndex(({ it }) => it.value === internalActive.value); \n \n if (key === 'Enter' || key === ' ') { \n e.preventDefault(); \n // Activate currently focused tab (already handled by click on Enter for buttons, \n // but we do it explicitly to support `<a>` rendering as well). \n const focused = document.activeElement; \n const idx = itemRefs.value.findIndex(r => r === focused); \n const item = idx >= 0 ? props.items[idx] : null; \n if (item) activate(item); \n return; \n } \n \n e.preventDefault(); \n let next = currentIdx; \n if (key === 'ArrowRight') next = (currentIdx + 1 + enabled.length) % enabled.length; \n else if (key === 'ArrowLeft') next = (currentIdx - 1 + enabled.length) % enabled.length; \n else if (key === 'Home') next = 0; \n else if (key === 'End') next = enabled.length - 1; \n \n const target = enabled[next]; \n if (!target) return; \n activate(target.it); \n nextTick(() => itemRefs.value[target.i]?.focus()); \n} \n \nfunction getTabIndex(item: TabItem) { \n if (item.disabled) return -1; \n // Roving tabindex: only the active tab is in the tab order. \n return isActive(item) ? 0 : -1; \n} \n \nfunction resolveItemTag(item: TabItem) { \n if (item.to) return props.linkComponent ?? 'a'; \n return 'button'; \n} \n \n// --- Class maps ---------------------------------------------------------\nconst sizeClasses = computed(() => `${sz.value.control} ${sz.value.padX} ${sz.value.text}`);\n\nconst iconSizeClass = computed(() => sz.value.icon); \n \nconst itemRadiusClasses = computed(() => { \n if (isLine.value) return 'rounded-none'; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-full'; \n case 'medium': \n default: return 'rounded-md'; \n } \n}); \n \nconst segmentedTrackRadius = computed(() => { \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-md'; \n case 'large': return 'rounded-2xl'; \n case 'full': return 'rounded-full'; \n case 'medium': \n default: return 'rounded-lg'; \n } \n}); \n \n// Unified focus ring across the system — colour-agnostic.\nconst focusRingClass = computed(() => 'focus-visible:ring-ring/60');\n \n// Active text/border color tokens by `color` prop. \nfunction activeBrandText() { \n switch (resolvedColor.value) { \n case 'primary': return 'text-primary'; \n case 'danger': return 'text-destructive'; \n case 'success': return 'text-success'; \n case 'warning': return 'text-warning'; \n case 'default': \n default: return 'text-foreground'; \n } \n} \n \nfunction pillActiveClasses() { \n // Item-level active classes for `pill`. The indicator paints the fill; \n // here we only set the foreground so text reads against it. \n switch (resolvedColor.value) { \n case 'primary': return 'text-primary-foreground'; \n case 'danger': return 'text-destructive-foreground'; \n case 'success': return 'text-success-foreground'; \n case 'warning': return 'text-warning-foreground'; \n case 'default': \n default: return 'text-accent-foreground'; \n } \n} \n \nfunction itemStateClasses(item: TabItem): string[] { \n const active = isActive(item); \n const disabled = !!item.disabled; \n \n if (isLine.value) { \n // Reserve 2px at the bottom on every item so heights stay aligned — \n // the indicator paints the colored bar. \n const base = 'border-b-2 border-transparent -mb-px'; \n if (active) { \n return [base, activeBrandText(), 'font-medium']; \n } \n return [ \n base, \n 'text-muted-foreground', \n !disabled ? 'hover:text-foreground' : '', \n ]; \n } \n \n if (isPill.value) { \n if (active) { \n return ['font-medium', pillActiveClasses()]; \n } \n return [ \n 'text-muted-foreground', \n !disabled ? `hover:text-foreground hover:bg-accent/50 ${itemRadiusClasses.value}` : '', \n ]; \n } \n \n // segmented \n if (active) { \n return [ \n 'font-medium', \n resolvedColor.value === 'default' ? 'text-card-foreground' : activeBrandText(), \n ]; \n } \n return [ \n 'text-muted-foreground', \n !disabled ? 'hover:text-foreground' : '', \n ]; \n} \n \n// Indicator visual (variant + color aware). Position/size come from \n// `indicatorStyle`; classes describe the \"skin\". \nconst indicatorClasses = computed(() => { \n if (isLine.value) { \n switch (resolvedColor.value) { \n case 'primary': return 'bg-primary rounded-full'; \n case 'danger': return 'bg-destructive rounded-full'; \n case 'success': return 'bg-success rounded-full'; \n case 'warning': return 'bg-warning rounded-full'; \n case 'default': \n default: return 'bg-foreground rounded-full'; \n } \n } \n if (isPill.value) { \n const radiusCls = itemRadiusClasses.value; \n switch (resolvedColor.value) { \n case 'primary': return `${radiusCls} bg-primary`; \n case 'danger': return `${radiusCls} bg-destructive`; \n case 'success': return `${radiusCls} bg-success`; \n case 'warning': return `${radiusCls} bg-warning`; \n case 'default': \n default: return `${radiusCls} bg-accent`; \n } \n } \n // segmented: card-style chip on the muted track. \n return `${itemRadiusClasses.value} bg-card shadow-xs`; \n}); \n \nfunction badgeStateClass(item: TabItem): string { \n const active = isActive(item); \n if (isPill.value && active && resolvedColor.value !== 'default') { \n // Inverted badge on a colored pill: alpha over the foreground. \n return 'bg-white/25 text-current'; \n } \n if (active && resolvedColor.value !== 'default') { \n return 'bg-current/15 text-current'; \n } \n return 'bg-muted text-muted-foreground'; \n} \n \nconst panelsContainerClass = computed(() => { \n return isLine.value || isPill.value || isSegmented.value ? 'pt-4' : ''; \n}); \n \n// DEV: warn when no items. \nif (import.meta.env.DEV) { \n if (!props.items || props.items.length === 0) { \n // eslint-disable-next-line no-console \n console.warn('[mood-ui][Tabs] `items` prop is empty — nothing to render.'); \n } \n} \n \ndefineExpose({ \n activate, \n}); \n</script> \n \n<style scoped> \n/* Hide scrollbar on the horizontal tablist scroll wrapper. */ \n.modo-tabs-scroll { \n scrollbar-width: none; \n -ms-overflow-style: none; \n} \n.modo-tabs-scroll::-webkit-scrollbar { \n display: none; \n} \n \n/* Smooth ring color transitions for focus-visible. */ \n.modo-tab { \n transition-property: color, --tw-ring-color, --tw-ring-shadow, box-shadow; \n transition-duration: 220ms; \n transition-timing-function: cubic-bezier(0.2, 0, 0, 1); \n} \n \n/* Reset native anchor styles when an item renders as <a href>. */ \n.modo-tab[href] { \n text-decoration: none; \n} \n \n/* Sliding indicator. Animates transform + width simultaneously so the \n * background \"travels\" between tabs, morphing its size to match the new \n * target instead of snapping. */ \n.modo-tab-indicator { \n top: 0; \n left: 0; \n will-change: transform, width; \n transition-property: transform, width, height, background-color, box-shadow, opacity; \n transition-duration: 320ms; \n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); \n} \n \n/* On first paint we measure & position without animating, then re-enable. */ \n.modo-tab-indicator--no-anim { \n transition: none !important; \n} \n \n@media (prefers-reduced-motion: reduce) { \n .modo-tab-indicator { \n transition: opacity 120ms linear !important; \n } \n} \n</style>\n"],"mappings":""}
|
|
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export
|
|
|
2
2
|
import Tabs_vue_vue_type_script_setup_true_lang_default from "./Tabs.vue_vue_type_script_setup_true_lang.mjs";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/components/navigation/Tabs.vue
|
|
5
|
-
var Tabs_default = /* @__PURE__ */ _plugin_vue_export_helper_default(Tabs_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var Tabs_default = /* @__PURE__ */ _plugin_vue_export_helper_default(Tabs_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-8d7840c0"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Tabs_default as default };
|
|
8
8
|
|