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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.mjs","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.mjs","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":""}
|
|
@@ -230,15 +230,7 @@ var Tabs_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.d
|
|
|
230
230
|
default: return "rounded-lg";
|
|
231
231
|
}
|
|
232
232
|
});
|
|
233
|
-
const focusRingClass = (0, vue.computed)(() =>
|
|
234
|
-
switch (resolvedColor.value) {
|
|
235
|
-
case "primary": return "focus-visible:ring-primary";
|
|
236
|
-
case "danger": return "focus-visible:ring-destructive";
|
|
237
|
-
case "success": return "focus-visible:ring-success";
|
|
238
|
-
case "warning": return "focus-visible:ring-warning";
|
|
239
|
-
default: return "focus-visible:ring-ring";
|
|
240
|
-
}
|
|
241
|
-
});
|
|
233
|
+
const focusRingClass = (0, vue.computed)(() => "focus-visible:ring-ring/60");
|
|
242
234
|
function activeBrandText() {
|
|
243
235
|
switch (resolvedColor.value) {
|
|
244
236
|
case "primary": return "text-primary";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.vue_vue_type_script_setup_true_lang.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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgHA,MAAM,QAAQ;EAQd,MAAM,OAAO;EAEb,MAAM,gBAAgB,sBAAA,uBAAuB,MAAM,MAAM;EACzD,MAAM,iBAAiB,sBAAA,wBAAwB,MAAM,OAAO;EAC5D,MAAM,eAAe,sBAAA,sBAAsB,MAAM,KAAK;EACtD,MAAM,KAAK,sBAAA,oBAAoB,MAAM,KAAK;EAG1C,IAAI,MAAM;EACV,MAAM,SAAS,aAAa,EAAE,IAAI,GAAG,KAAK,QAAQ,CA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BAgBvC,IAAA,UAAA,OAAA,GAAA,IAAA,YAfc,QAAA,QAAR,SAAI;2FAA0B,KAAK,SAAA,EAAA,CAEtC,kBAAkB,KAAI,IAAA,GAAA,IAAA,kBAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAY1B,OAAA;;KAVF,MAAK;KACJ,IAAE,GAAK,OAAM,SAAU,KAAK;KAC5B,mBAAe,GAAK,OAAM,OAAQ,KAAK;KACvC,QAAM,CAAG,SAAS,KAAI,IAAK,KAAA;KAC3B,UAAU;KACX,OAAM;4BAIC,KAAA,QAAA,SAFe,KAAK,SAAK;KAAW;KAAO,QAAQ,SAAS,KAAI;aAEhE,EAAA,GAAA,IAAA,YADwD,KAAA,QAAA,SAAA;KAAjC;KAAO,QAAQ,SAAS,KAAI;8DATjD,QAAA,eAAe,SAAS,KAAI,CAAA,CAAA,CAAA,IAAA,GAAA,IAAA,oBAAA,IAAA,KAAA,CAAA,EAAA,GAAA"}
|
|
1
|
+
{"version":3,"file":"Tabs.vue_vue_type_script_setup_true_lang.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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgHA,MAAM,QAAQ;EAQd,MAAM,OAAO;EAEb,MAAM,gBAAgB,sBAAA,uBAAuB,MAAM,MAAM;EACzD,MAAM,iBAAiB,sBAAA,wBAAwB,MAAM,OAAO;EAC5D,MAAM,eAAe,sBAAA,sBAAsB,MAAM,KAAK;EACtD,MAAM,KAAK,sBAAA,oBAAoB,MAAM,KAAK;EAG1C,IAAI,MAAM;EACV,MAAM,SAAS,aAAa,EAAE,IAAI,GAAG,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE;EAE3E,MAAM,UAAA,GAAA,IAAA,gBAAwB,MAAM,YAAY,OAAO;EACvD,MAAM,UAAA,GAAA,IAAA,gBAAwB,MAAM,YAAY,OAAO;EACvD,MAAM,eAAA,GAAA,IAAA,gBAA6B,MAAM,YAAY,YAAY;EAEjE,MAAM,kBAAA,GAAA,IAAA,KACF,MAAM,cAAc,MAAM,MAAM,MAAK,MAAK,CAAC,EAAE,SAAS,EAAE,SAAS,KACpE;EAED,CAAA,GAAA,IAAA,aACU,MAAM,aACZ,MAAK;GACD,IAAI,MAAM,KAAA,KAAa,MAAM,eAAe,OAAO,eAAe,QAAQ;IAEjF;EAED,SAAS,SAAS,MAAe;GAC7B,OAAO,eAAe,UAAU,KAAK;;EAIzC,MAAM,WAAA,GAAA,IAAA,qBAAoC,IAAI,KAAK,CAAC;EACpD,SAAS,kBAAkB,MAAe;GACtC,IAAI,CAAC,MAAM,MAAM,OAAO;GACxB,IAAI,SAAS,KAAK,EAAE;IAChB,IAAI,CAAC,QAAQ,MAAM,IAAI,KAAK,MAAM,EAAE,QAAQ,MAAM,IAAI,KAAK,MAAM;IACjE,OAAO;;GAEX,OAAO,MAAM,eAAe,QAA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C,QAAA;;OALnB,QAAA,GAAA,IAAA,gBAAK,CAAA,oGAAkK,gBAAgB,KAAI,CAAA,CAAA;OAI5L,eAAY;kCACZ,KAAK,MAAK,EAAA,EAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA;;;;;;;;;;;;;;;;iEAuBpB,OAAA,EAjBA,QAAA,GAAA,IAAA,gBAAK,CAAA,oBAAuB,qBAAA,MAAoB,CAAA,EAAA,EAAA,GAAA,GAAA,IAAA,WAAA,KAAA,GAAA,GAAA,IAAA,oBAgBvC,IAAA,UAAA,OAAA,GAAA,IAAA,YAfc,QAAA,QAAR,SAAI;2FAA0B,KAAK,SAAA,EAAA,CAEtC,kBAAkB,KAAI,IAAA,GAAA,IAAA,kBAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAY1B,OAAA;;KAVF,MAAK;KACJ,IAAE,GAAK,OAAM,SAAU,KAAK;KAC5B,mBAAe,GAAK,OAAM,OAAQ,KAAK;KACvC,QAAM,CAAG,SAAS,KAAI,IAAK,KAAA;KAC3B,UAAU;KACX,OAAM;4BAIC,KAAA,QAAA,SAFe,KAAK,SAAK;KAAW;KAAO,QAAQ,SAAS,KAAI;aAEhE,EAAA,GAAA,IAAA,YADwD,KAAA,QAAA,SAAA;KAAjC;KAAO,QAAQ,SAAS,KAAI;8DATjD,QAAA,eAAe,SAAS,KAAI,CAAA,CAAA,CAAA,IAAA,GAAA,IAAA,oBAAA,IAAA,KAAA,CAAA,EAAA,GAAA"}
|
|
@@ -229,15 +229,7 @@ var Tabs_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
229
229
|
default: return "rounded-lg";
|
|
230
230
|
}
|
|
231
231
|
});
|
|
232
|
-
const focusRingClass = computed(() =>
|
|
233
|
-
switch (resolvedColor.value) {
|
|
234
|
-
case "primary": return "focus-visible:ring-primary";
|
|
235
|
-
case "danger": return "focus-visible:ring-destructive";
|
|
236
|
-
case "success": return "focus-visible:ring-success";
|
|
237
|
-
case "warning": return "focus-visible:ring-warning";
|
|
238
|
-
default: return "focus-visible:ring-ring";
|
|
239
|
-
}
|
|
240
|
-
});
|
|
232
|
+
const focusRingClass = computed(() => "focus-visible:ring-ring/60");
|
|
241
233
|
function activeBrandText() {
|
|
242
234
|
switch (resolvedColor.value) {
|
|
243
235
|
case "primary": return "text-primary";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.vue_vue_type_script_setup_true_lang.mjs","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgHA,MAAM,QAAQ;EAQd,MAAM,OAAO;EAEb,MAAM,gBAAgB,uBAAuB,MAA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,KAAI;aAEhE,CADH,WAA2D,KAAA,QAAA,SAAA;KAAjC;KAAO,QAAQ,SAAS,KAAI;0DATjD,QAAA,eAAe,SAAS,KAAI,CAAA,CAAA,CAAA,GAAA,mBAAA,IAAA,KAAA,CAAA,EAAA,GAAA"}
|
|
1
|
+
{"version":3,"file":"Tabs.vue_vue_type_script_setup_true_lang.mjs","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgHA,MAAM,QAAQ;EAQd,MAAM,OAAO;EAEb,MAAM,gBAAgB,uBAAuB,MAAM,MAAM;EACzD,MAAM,iBAAiB,wBAAwB,MAAM,OAAO;EAC5D,MAAM,eAAe,sBAAsB,MAAM,KAAK;EACtD,MAAM,KAAK,oBAAoB,MAAM,KAAK;EAG1C,IAAI,MAAM;EACV,MAAM,SAAS,aAAa,EAAE,IAAI,GAAG,KAAK,Q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LOR = {
|
|
80
|
-
default: "focus-within:ring-ring/10",
|
|
81
|
-
primary: "focus-within:ring-primary/12",
|
|
82
|
-
danger: "focus-within:ring-destructive/12",
|
|
83
|
-
success: "focus-within:ring-success/12",
|
|
84
|
-
warning: "focus-within:ring-warning/12"
|
|
85
|
-
};
|
|
86
|
-
var FORCED_RING_BY_COLOR = {
|
|
87
|
-
default: "ring-ring/10",
|
|
88
|
-
primary: "ring-primary/12",
|
|
89
|
-
danger: "ring-destructive/12",
|
|
90
|
-
success: "ring-success/12",
|
|
91
|
-
warning: "ring-warning/12"
|
|
92
|
-
};
|
|
93
79
|
var FOCUS_BORDER_BY_COLOR = {
|
|
94
80
|
default: "focus-within:border-foreground/50",
|
|
95
81
|
primary: "focus-within:border-primary/60",
|
|
@@ -104,9 +90,19 @@ var FORCED_BORDER_BY_COLOR = {
|
|
|
104
90
|
success: "border-success/60",
|
|
105
91
|
warning: "border-warning/60"
|
|
106
92
|
};
|
|
107
|
-
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
93
|
+
/**
|
|
94
|
+
* THE single focus indicator for the whole system. Every interactive component
|
|
95
|
+
* uses this exact ring so tabbing through a form/toolbar shows one consistent
|
|
96
|
+
* focus — a soft ring, no offset gap. `FIELD_FOCUS_RING` is the `focus-within`
|
|
97
|
+
* variant for field wrappers; `CONTROL_FOCUS_RING` is the `focus-visible`
|
|
98
|
+
* variant for buttons and other single-element controls.
|
|
99
|
+
*/
|
|
100
|
+
var MODO_FOCUS_RING = "ring-2 ring-ring/60";
|
|
101
|
+
var FIELD_FOCUS_RING = "focus-within:ring-2 focus-within:ring-ring/60";
|
|
102
|
+
var CONTROL_FOCUS_RING = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60";
|
|
103
|
+
/**
|
|
104
|
+
* Resuelve las clases de wrapper (variante + halo + error) y el radius
|
|
105
|
+
* para cualquier campo de formulario que siga el patrón Input/Textarea.
|
|
110
106
|
*/
|
|
111
107
|
function useFieldClasses(source) {
|
|
112
108
|
const resolvedHalo = require_useModoConfig.useResolvedHalo(() => {
|
|
@@ -120,21 +116,20 @@ function useFieldClasses(source) {
|
|
|
120
116
|
const forceFocus = source.forceFocus ? (0, vue.toValue)(source.forceFocus) : false;
|
|
121
117
|
const halo = resolvedHalo.value;
|
|
122
118
|
const errBorder = hasError ? "border-destructive" : "";
|
|
123
|
-
const focusRing = halo === "neutral" ? "focus-within:ring-ring/12" : FOCUS_RING_BY_COLOR[stateColor];
|
|
124
119
|
const focusBorder = FOCUS_BORDER_BY_COLOR[stateColor];
|
|
125
|
-
const forcedRing = forceFocus ? halo === "neutral" ? "ring-ring/12" : FORCED_RING_BY_COLOR[stateColor] : "";
|
|
126
120
|
const forcedBorder = forceFocus ? FORCED_BORDER_BY_COLOR[stateColor] : "";
|
|
127
121
|
const forcedBg = forceFocus ? "bg-background" : "";
|
|
128
122
|
const idleRing = halo === "off" ? "" : "ring-4 ring-border/25";
|
|
129
|
-
const focusRingUtil =
|
|
130
|
-
const forcedRingUtil =
|
|
123
|
+
const focusRingUtil = FIELD_FOCUS_RING;
|
|
124
|
+
const forcedRingUtil = forceFocus ? MODO_FOCUS_RING : "";
|
|
131
125
|
switch (variant) {
|
|
132
126
|
case "filled": return [
|
|
133
127
|
"bg-muted border border-transparent",
|
|
134
128
|
idleRing,
|
|
135
129
|
"focus-within:bg-background",
|
|
130
|
+
focusBorder,
|
|
136
131
|
focusRingUtil,
|
|
137
|
-
forceFocus ? `${forcedRingUtil} ${forcedBg}` : forcedBg,
|
|
132
|
+
forceFocus ? `${forcedRingUtil} ${forcedBorder} ${forcedBg}` : forcedBg,
|
|
138
133
|
errBorder
|
|
139
134
|
].join(" ");
|
|
140
135
|
case "ghost": return [
|
|
@@ -146,8 +141,10 @@ function useFieldClasses(source) {
|
|
|
146
141
|
default: return [
|
|
147
142
|
"bg-background border border-input",
|
|
148
143
|
idleRing,
|
|
144
|
+
focusBorder,
|
|
149
145
|
focusRingUtil,
|
|
150
146
|
forcedRingUtil,
|
|
147
|
+
forcedBorder,
|
|
151
148
|
errBorder
|
|
152
149
|
].join(" ");
|
|
153
150
|
}
|
|
@@ -158,13 +155,14 @@ function useFieldClasses(source) {
|
|
|
158
155
|
case "none": return "rounded-none";
|
|
159
156
|
case "small": return "rounded-sm";
|
|
160
157
|
case "large": return "rounded-xl";
|
|
161
|
-
case "full": return source.fullRadiusClass ?? "rounded-
|
|
158
|
+
case "full": return source.fullRadiusClass ?? "rounded-[999px]";
|
|
162
159
|
default: return "rounded-md";
|
|
163
160
|
}
|
|
164
161
|
})
|
|
165
162
|
};
|
|
166
163
|
}
|
|
167
164
|
//#endregion
|
|
165
|
+
exports.CONTROL_FOCUS_RING = CONTROL_FOCUS_RING;
|
|
168
166
|
exports.FIELD_AFFORDANCE_ACTION_BY_COLOR = FIELD_AFFORDANCE_ACTION_BY_COLOR;
|
|
169
167
|
exports.FIELD_AFFORDANCE_ICON_BY_COLOR = FIELD_AFFORDANCE_ICON_BY_COLOR;
|
|
170
168
|
exports.FORM_FIELD_ID_KEY = FORM_FIELD_ID_KEY;
|