@datametria/vue-components 2.0.1 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +43 -23
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.es.js +1687 -1539
  4. package/dist/index.umd.js +9 -9
  5. package/dist/src/components/DatametriaAlert.vue.d.ts +33 -0
  6. package/dist/src/components/DatametriaAutocomplete.vue.d.ts +28 -0
  7. package/dist/src/components/DatametriaAvatar.vue.d.ts +25 -0
  8. package/dist/src/components/DatametriaBadge.vue.d.ts +26 -0
  9. package/dist/src/components/DatametriaBreadcrumb.vue.d.ts +16 -0
  10. package/dist/src/components/DatametriaButton.vue.d.ts +37 -0
  11. package/dist/src/components/DatametriaCard.vue.d.ts +25 -0
  12. package/dist/src/components/DatametriaCheckbox.vue.d.ts +14 -0
  13. package/dist/src/components/DatametriaChip.vue.d.ts +34 -0
  14. package/dist/src/components/DatametriaContainer.vue.d.ts +24 -0
  15. package/dist/src/components/DatametriaDatePicker.vue.d.ts +55 -0
  16. package/dist/src/components/DatametriaDivider.vue.d.ts +25 -0
  17. package/dist/src/components/DatametriaFileUpload.vue.d.ts +28 -0
  18. package/dist/src/components/DatametriaFloatingBar.vue.d.ts +32 -0
  19. package/dist/src/components/DatametriaGrid.vue.d.ts +24 -0
  20. package/dist/src/components/DatametriaInput.vue.d.ts +18 -0
  21. package/dist/src/components/DatametriaMenu.vue.d.ts +71 -0
  22. package/dist/src/components/DatametriaModal.vue.d.ts +34 -0
  23. package/dist/src/components/DatametriaNavbar.vue.d.ts +34 -0
  24. package/dist/src/components/DatametriaPasswordInput.vue.d.ts +29 -0
  25. package/dist/src/components/DatametriaProgress.vue.d.ts +12 -0
  26. package/dist/src/components/DatametriaRadio.vue.d.ts +17 -0
  27. package/dist/src/components/DatametriaSelect.vue.d.ts +23 -0
  28. package/dist/src/components/DatametriaSidebar.vue.d.ts +45 -0
  29. package/dist/src/components/DatametriaSkeleton.vue.d.ts +18 -0
  30. package/dist/src/components/DatametriaSlider.vue.d.ts +41 -0
  31. package/dist/src/components/DatametriaSortableTable.vue.d.ts +32 -0
  32. package/dist/src/components/DatametriaSpinner.vue.d.ts +12 -0
  33. package/dist/src/components/DatametriaSwitch.vue.d.ts +16 -0
  34. package/dist/src/components/DatametriaTable.vue.d.ts +29 -0
  35. package/dist/src/components/DatametriaTabs.vue.d.ts +41 -0
  36. package/dist/src/components/DatametriaTextarea.vue.d.ts +22 -0
  37. package/dist/src/components/DatametriaTimePicker.vue.d.ts +36 -0
  38. package/dist/src/components/DatametriaToast.vue.d.ts +20 -0
  39. package/dist/src/components/DatametriaTooltip.vue.d.ts +58 -0
  40. package/dist/src/composables/useAPI.d.ts +14 -0
  41. package/dist/src/composables/useAccessibilityScale.d.ts +14 -0
  42. package/dist/src/composables/useBreakpoints.d.ts +33 -0
  43. package/dist/src/composables/useClipboard.d.ts +6 -0
  44. package/dist/src/composables/useDebounce.d.ts +2 -0
  45. package/dist/src/composables/useHapticFeedback.d.ts +34 -0
  46. package/dist/src/composables/useLocalStorage.d.ts +2 -0
  47. package/dist/src/composables/useRipple.d.ts +49 -0
  48. package/dist/src/composables/useTheme.d.ts +10 -0
  49. package/dist/src/composables/useValidation.d.ts +14 -0
  50. package/dist/src/index.d.ts +53 -0
  51. package/dist/src/theme/ThemeProvider.vue.d.ts +24 -0
  52. package/dist/src/theme/constants.d.ts +5 -0
  53. package/dist/src/theme/index.d.ts +11 -0
  54. package/dist/src/theme/presets/datametria.d.ts +2 -0
  55. package/dist/src/theme/presets/default.d.ts +2 -0
  56. package/dist/src/theme/presets/index.d.ts +7 -0
  57. package/dist/src/theme/tokens/colors.d.ts +2 -0
  58. package/dist/src/theme/tokens/index.d.ts +8 -0
  59. package/dist/src/theme/tokens/spacing.d.ts +2 -0
  60. package/dist/src/theme/tokens/typography.d.ts +2 -0
  61. package/dist/src/theme/types.d.ts +102 -0
  62. package/dist/src/theme/useTheme.d.ts +8 -0
  63. package/dist/src/types/index.d.ts +47 -0
  64. package/dist/vue-components.css +1 -1
  65. package/package.json +5 -3
  66. package/src/components/DatametriaFloatingBar.vue +126 -0
  67. package/src/components/DatametriaSidebar.vue +230 -0
  68. package/src/components/DatametriaTabs.vue +150 -29
  69. package/src/components/__tests__/DatametriaFloatingBar.test.ts +137 -0
  70. package/src/components/__tests__/DatametriaSidebar.test.ts +169 -0
  71. package/src/components/__tests__/DatametriaTabs.test.ts +232 -0
  72. package/src/index.ts +2 -0
@@ -0,0 +1,137 @@
1
+ import { describe, it, expect } from 'vitest'
2
+ import { mount } from '@vue/test-utils'
3
+ import DatametriaFloatingBar from '../DatametriaFloatingBar.vue'
4
+
5
+ describe('DatametriaFloatingBar', () => {
6
+ it('renders correctly', () => {
7
+ const wrapper = mount(DatametriaFloatingBar)
8
+ expect(wrapper.find('.dm-floating-bar').exists()).toBe(true)
9
+ })
10
+
11
+ it('applies position classes', () => {
12
+ const positions = ['top', 'bottom', 'left', 'right'] as const
13
+ positions.forEach(position => {
14
+ const wrapper = mount(DatametriaFloatingBar, { props: { position } })
15
+ expect(wrapper.find(`.dm-floating-bar--${position}`).exists()).toBe(true)
16
+ })
17
+ })
18
+
19
+ it('applies variant classes', () => {
20
+ const variants = ['light', 'dark', 'primary'] as const
21
+ variants.forEach(variant => {
22
+ const wrapper = mount(DatametriaFloatingBar, { props: { variant } })
23
+ expect(wrapper.find(`.dm-floating-bar--${variant}`).exists()).toBe(true)
24
+ })
25
+ })
26
+
27
+ it('applies shadow class when shadow is true', () => {
28
+ const wrapper = mount(DatametriaFloatingBar, { props: { shadow: true } })
29
+ expect(wrapper.find('.dm-floating-bar--shadow').exists()).toBe(true)
30
+ })
31
+
32
+ it('does not apply shadow class when shadow is false', () => {
33
+ const wrapper = mount(DatametriaFloatingBar, { props: { shadow: false } })
34
+ expect(wrapper.find('.dm-floating-bar--shadow').exists()).toBe(false)
35
+ })
36
+
37
+ it('applies rounded class when rounded is true', () => {
38
+ const wrapper = mount(DatametriaFloatingBar, { props: { rounded: true } })
39
+ expect(wrapper.find('.dm-floating-bar--rounded').exists()).toBe(true)
40
+ })
41
+
42
+ it('does not apply rounded class when rounded is false', () => {
43
+ const wrapper = mount(DatametriaFloatingBar, { props: { rounded: false } })
44
+ expect(wrapper.find('.dm-floating-bar--rounded').exists()).toBe(false)
45
+ })
46
+
47
+ it('renders slot content', () => {
48
+ const wrapper = mount(DatametriaFloatingBar, {
49
+ slots: { default: '<button class="test-button">Action</button>' }
50
+ })
51
+ expect(wrapper.find('.test-button').exists()).toBe(true)
52
+ expect(wrapper.text()).toContain('Action')
53
+ })
54
+
55
+ it('applies correct position style for top', () => {
56
+ const wrapper = mount(DatametriaFloatingBar, {
57
+ props: { position: 'top', offset: '20px' }
58
+ })
59
+ const style = wrapper.find('.dm-floating-bar').attributes('style')
60
+ expect(style).toContain('top: 20px')
61
+ })
62
+
63
+ it('applies correct position style for bottom', () => {
64
+ const wrapper = mount(DatametriaFloatingBar, {
65
+ props: { position: 'bottom', offset: '24px' }
66
+ })
67
+ const style = wrapper.find('.dm-floating-bar').attributes('style')
68
+ expect(style).toContain('bottom: 24px')
69
+ })
70
+
71
+ it('applies correct position style for left', () => {
72
+ const wrapper = mount(DatametriaFloatingBar, {
73
+ props: { position: 'left', offset: '32px' }
74
+ })
75
+ const style = wrapper.find('.dm-floating-bar').attributes('style')
76
+ expect(style).toContain('left: 32px')
77
+ })
78
+
79
+ it('applies correct position style for right', () => {
80
+ const wrapper = mount(DatametriaFloatingBar, {
81
+ props: { position: 'right', offset: '40px' }
82
+ })
83
+ const style = wrapper.find('.dm-floating-bar').attributes('style')
84
+ expect(style).toContain('right: 40px')
85
+ })
86
+
87
+ it('uses default offset when not provided', () => {
88
+ const wrapper = mount(DatametriaFloatingBar, { props: { position: 'bottom' } })
89
+ const style = wrapper.find('.dm-floating-bar').attributes('style')
90
+ expect(style).toContain('bottom: 16px')
91
+ })
92
+
93
+ it('has correct aria attributes', () => {
94
+ const wrapper = mount(DatametriaFloatingBar, {
95
+ props: { ariaLabel: 'Floating toolbar' }
96
+ })
97
+ const bar = wrapper.find('.dm-floating-bar')
98
+ expect(bar.attributes('role')).toBe('toolbar')
99
+ expect(bar.attributes('aria-label')).toBe('Floating toolbar')
100
+ })
101
+
102
+ it('renders content wrapper', () => {
103
+ const wrapper = mount(DatametriaFloatingBar)
104
+ expect(wrapper.find('.dm-floating-bar__content').exists()).toBe(true)
105
+ })
106
+
107
+ it('applies all classes correctly', () => {
108
+ const wrapper = mount(DatametriaFloatingBar, {
109
+ props: {
110
+ position: 'top',
111
+ variant: 'primary',
112
+ shadow: true,
113
+ rounded: true
114
+ }
115
+ })
116
+ const bar = wrapper.find('.dm-floating-bar')
117
+ expect(bar.classes()).toContain('dm-floating-bar--top')
118
+ expect(bar.classes()).toContain('dm-floating-bar--primary')
119
+ expect(bar.classes()).toContain('dm-floating-bar--shadow')
120
+ expect(bar.classes()).toContain('dm-floating-bar--rounded')
121
+ })
122
+
123
+ it('renders multiple action buttons', () => {
124
+ const wrapper = mount(DatametriaFloatingBar, {
125
+ slots: {
126
+ default: `
127
+ <button class="btn-1">Action 1</button>
128
+ <button class="btn-2">Action 2</button>
129
+ <button class="btn-3">Action 3</button>
130
+ `
131
+ }
132
+ })
133
+ expect(wrapper.find('.btn-1').exists()).toBe(true)
134
+ expect(wrapper.find('.btn-2').exists()).toBe(true)
135
+ expect(wrapper.find('.btn-3').exists()).toBe(true)
136
+ })
137
+ })
@@ -0,0 +1,169 @@
1
+ import { describe, it, expect, vi } from 'vitest'
2
+ import { mount } from '@vue/test-utils'
3
+ import DatametriaSidebar from '../DatametriaSidebar.vue'
4
+
5
+ describe('DatametriaSidebar', () => {
6
+ it('renders correctly', () => {
7
+ const wrapper = mount(DatametriaSidebar)
8
+ expect(wrapper.find('.dm-sidebar').exists()).toBe(true)
9
+ })
10
+
11
+ it('applies position classes', () => {
12
+ const wrapperLeft = mount(DatametriaSidebar, { props: { position: 'left' } })
13
+ expect(wrapperLeft.find('.dm-sidebar--left').exists()).toBe(true)
14
+
15
+ const wrapperRight = mount(DatametriaSidebar, { props: { position: 'right' } })
16
+ expect(wrapperRight.find('.dm-sidebar--right').exists()).toBe(true)
17
+ })
18
+
19
+ it('applies variant classes', () => {
20
+ const variants = ['light', 'dark', 'primary'] as const
21
+ variants.forEach(variant => {
22
+ const wrapper = mount(DatametriaSidebar, { props: { variant } })
23
+ expect(wrapper.find(`.dm-sidebar--${variant}`).exists()).toBe(true)
24
+ })
25
+ })
26
+
27
+ it('renders header slot', () => {
28
+ const wrapper = mount(DatametriaSidebar, {
29
+ slots: { header: '<div class="test-header">Header</div>' }
30
+ })
31
+ expect(wrapper.find('.test-header').exists()).toBe(true)
32
+ expect(wrapper.find('.dm-sidebar__header').exists()).toBe(true)
33
+ })
34
+
35
+ it('renders default slot content', () => {
36
+ const wrapper = mount(DatametriaSidebar, {
37
+ slots: { default: '<div class="test-content">Content</div>' }
38
+ })
39
+ expect(wrapper.find('.test-content').exists()).toBe(true)
40
+ expect(wrapper.find('.dm-sidebar__content').exists()).toBe(true)
41
+ })
42
+
43
+ it('renders footer slot', () => {
44
+ const wrapper = mount(DatametriaSidebar, {
45
+ slots: { footer: '<div class="test-footer">Footer</div>' }
46
+ })
47
+ expect(wrapper.find('.test-footer').exists()).toBe(true)
48
+ expect(wrapper.find('.dm-sidebar__footer').exists()).toBe(true)
49
+ })
50
+
51
+ it('shows toggle button when collapsible', () => {
52
+ const wrapper = mount(DatametriaSidebar, {
53
+ props: { collapsible: true },
54
+ slots: { header: 'Header' }
55
+ })
56
+ expect(wrapper.find('.dm-sidebar__toggle').exists()).toBe(true)
57
+ })
58
+
59
+ it('hides toggle button when not collapsible', () => {
60
+ const wrapper = mount(DatametriaSidebar, {
61
+ props: { collapsible: false },
62
+ slots: { header: 'Header' }
63
+ })
64
+ expect(wrapper.find('.dm-sidebar__toggle').exists()).toBe(false)
65
+ })
66
+
67
+ it('toggles open state when toggle button clicked', async () => {
68
+ const wrapper = mount(DatametriaSidebar, {
69
+ props: { collapsible: true, defaultOpen: true },
70
+ slots: { header: 'Header' }
71
+ })
72
+
73
+ expect(wrapper.vm.isOpen).toBe(true)
74
+ expect(wrapper.find('.dm-sidebar--collapsed').exists()).toBe(false)
75
+
76
+ await wrapper.find('.dm-sidebar__toggle').trigger('click')
77
+ expect(wrapper.vm.isOpen).toBe(false)
78
+ expect(wrapper.find('.dm-sidebar--collapsed').exists()).toBe(true)
79
+
80
+ await wrapper.find('.dm-sidebar__toggle').trigger('click')
81
+ expect(wrapper.vm.isOpen).toBe(true)
82
+ })
83
+
84
+ it('emits toggle event with correct value', async () => {
85
+ const wrapper = mount(DatametriaSidebar, {
86
+ props: { collapsible: true, defaultOpen: true },
87
+ slots: { header: 'Header' }
88
+ })
89
+
90
+ await wrapper.find('.dm-sidebar__toggle').trigger('click')
91
+ expect(wrapper.emitted('toggle')).toBeTruthy()
92
+ expect(wrapper.emitted('toggle')?.[0]).toEqual([false])
93
+
94
+ await wrapper.find('.dm-sidebar__toggle').trigger('click')
95
+ expect(wrapper.emitted('toggle')?.[1]).toEqual([true])
96
+ })
97
+
98
+ it('emits open event when opening', async () => {
99
+ const wrapper = mount(DatametriaSidebar, {
100
+ props: { collapsible: true, defaultOpen: false },
101
+ slots: { header: 'Header' }
102
+ })
103
+
104
+ await wrapper.find('.dm-sidebar__toggle').trigger('click')
105
+ expect(wrapper.emitted('open')).toBeTruthy()
106
+ })
107
+
108
+ it('emits close event when closing', async () => {
109
+ const wrapper = mount(DatametriaSidebar, {
110
+ props: { collapsible: true, defaultOpen: true },
111
+ slots: { header: 'Header' }
112
+ })
113
+
114
+ await wrapper.find('.dm-sidebar__toggle').trigger('click')
115
+ expect(wrapper.emitted('close')).toBeTruthy()
116
+ })
117
+
118
+ it('respects defaultOpen prop', () => {
119
+ const wrapperOpen = mount(DatametriaSidebar, { props: { defaultOpen: true } })
120
+ expect(wrapperOpen.vm.isOpen).toBe(true)
121
+
122
+ const wrapperClosed = mount(DatametriaSidebar, { props: { defaultOpen: false } })
123
+ expect(wrapperClosed.vm.isOpen).toBe(false)
124
+ })
125
+
126
+ it('updates isOpen when defaultOpen prop changes', async () => {
127
+ const wrapper = mount(DatametriaSidebar, { props: { defaultOpen: true } })
128
+ expect(wrapper.vm.isOpen).toBe(true)
129
+
130
+ await wrapper.setProps({ defaultOpen: false })
131
+ expect(wrapper.vm.isOpen).toBe(false)
132
+ })
133
+
134
+ it('has correct aria attributes', () => {
135
+ const wrapper = mount(DatametriaSidebar, {
136
+ props: { ariaLabel: 'Test sidebar', defaultOpen: true }
137
+ })
138
+ const sidebar = wrapper.find('.dm-sidebar')
139
+ expect(sidebar.attributes('role')).toBe('complementary')
140
+ expect(sidebar.attributes('aria-label')).toBe('Test sidebar')
141
+ expect(sidebar.attributes('aria-expanded')).toBe('true')
142
+ })
143
+
144
+ it('exposes toggle method', () => {
145
+ const wrapper = mount(DatametriaSidebar, {
146
+ props: { collapsible: true, defaultOpen: true }
147
+ })
148
+
149
+ expect(wrapper.vm.isOpen).toBe(true)
150
+ wrapper.vm.toggle()
151
+ expect(wrapper.vm.isOpen).toBe(false)
152
+ wrapper.vm.toggle()
153
+ expect(wrapper.vm.isOpen).toBe(true)
154
+ })
155
+
156
+ it('applies collapsed class when closed and collapsible', () => {
157
+ const wrapper = mount(DatametriaSidebar, {
158
+ props: { collapsible: true, defaultOpen: false }
159
+ })
160
+ expect(wrapper.find('.dm-sidebar--collapsed').exists()).toBe(true)
161
+ })
162
+
163
+ it('does not apply collapsed class when open', () => {
164
+ const wrapper = mount(DatametriaSidebar, {
165
+ props: { collapsible: true, defaultOpen: true }
166
+ })
167
+ expect(wrapper.find('.dm-sidebar--collapsed').exists()).toBe(false)
168
+ })
169
+ })
@@ -0,0 +1,232 @@
1
+ import { describe, it, expect } from 'vitest'
2
+ import { mount } from '@vue/test-utils'
3
+ import DatametriaTabs from '../DatametriaTabs.vue'
4
+
5
+ describe('DatametriaTabs', () => {
6
+ const tabs = ['Tab 1', 'Tab 2', 'Tab 3']
7
+
8
+ it('renders correctly', () => {
9
+ const wrapper = mount(DatametriaTabs, { props: { tabs } })
10
+ expect(wrapper.find('.dm-tabs').exists()).toBe(true)
11
+ })
12
+
13
+ it('renders all tabs', () => {
14
+ const wrapper = mount(DatametriaTabs, { props: { tabs } })
15
+ const tabButtons = wrapper.findAll('.dm-tabs__tab')
16
+ expect(tabButtons).toHaveLength(3)
17
+ expect(tabButtons[0].text()).toBe('Tab 1')
18
+ expect(tabButtons[1].text()).toBe('Tab 2')
19
+ expect(tabButtons[2].text()).toBe('Tab 3')
20
+ })
21
+
22
+ it('applies variant classes', () => {
23
+ const variants = ['default', 'pills', 'underline'] as const
24
+ variants.forEach(variant => {
25
+ const wrapper = mount(DatametriaTabs, { props: { tabs, variant } })
26
+ expect(wrapper.find(`.dm-tabs--${variant}`).exists()).toBe(true)
27
+ })
28
+ })
29
+
30
+ it('applies orientation classes', () => {
31
+ const horizontal = mount(DatametriaTabs, { props: { tabs, orientation: 'horizontal' } })
32
+ expect(horizontal.find('.dm-tabs--horizontal').exists()).toBe(true)
33
+
34
+ const vertical = mount(DatametriaTabs, { props: { tabs, orientation: 'vertical' } })
35
+ expect(vertical.find('.dm-tabs--vertical').exists()).toBe(true)
36
+ })
37
+
38
+ it('sets first tab as active by default', () => {
39
+ const wrapper = mount(DatametriaTabs, { props: { tabs } })
40
+ expect(wrapper.findAll('.dm-tabs__tab')[0].classes()).toContain('dm-tabs__tab--active')
41
+ })
42
+
43
+ it('respects modelValue prop', () => {
44
+ const wrapper = mount(DatametriaTabs, { props: { tabs, modelValue: 1 } })
45
+ expect(wrapper.findAll('.dm-tabs__tab')[1].classes()).toContain('dm-tabs__tab--active')
46
+ })
47
+
48
+ it('changes active tab on click', async () => {
49
+ const wrapper = mount(DatametriaTabs, { props: { tabs } })
50
+ await wrapper.findAll('.dm-tabs__tab')[1].trigger('click')
51
+ expect(wrapper.findAll('.dm-tabs__tab')[1].classes()).toContain('dm-tabs__tab--active')
52
+ })
53
+
54
+ it('emits update:modelValue on tab click', async () => {
55
+ const wrapper = mount(DatametriaTabs, { props: { tabs } })
56
+ await wrapper.findAll('.dm-tabs__tab')[2].trigger('click')
57
+ expect(wrapper.emitted('update:modelValue')).toBeTruthy()
58
+ expect(wrapper.emitted('update:modelValue')?.[0]).toEqual([2])
59
+ })
60
+
61
+ it('emits change event on tab click', async () => {
62
+ const wrapper = mount(DatametriaTabs, { props: { tabs } })
63
+ await wrapper.findAll('.dm-tabs__tab')[1].trigger('click')
64
+ expect(wrapper.emitted('change')).toBeTruthy()
65
+ expect(wrapper.emitted('change')?.[0]).toEqual([1])
66
+ })
67
+
68
+ it('renders tab panels', () => {
69
+ const wrapper = mount(DatametriaTabs, {
70
+ props: { tabs },
71
+ slots: {
72
+ 'panel-0': '<div class="panel-0">Panel 1</div>',
73
+ 'panel-1': '<div class="panel-1">Panel 2</div>',
74
+ 'panel-2': '<div class="panel-2">Panel 3</div>'
75
+ }
76
+ })
77
+ expect(wrapper.find('.panel-0').exists()).toBe(true)
78
+ expect(wrapper.find('.panel-1').exists()).toBe(true)
79
+ expect(wrapper.find('.panel-2').exists()).toBe(true)
80
+ })
81
+
82
+ it('shows only active panel', () => {
83
+ const wrapper = mount(DatametriaTabs, {
84
+ props: { tabs, modelValue: 1 },
85
+ slots: {
86
+ 'panel-0': '<div class="panel-0">Panel 1</div>',
87
+ 'panel-1': '<div class="panel-1">Panel 2</div>',
88
+ 'panel-2': '<div class="panel-2">Panel 3</div>'
89
+ }
90
+ })
91
+ const panels = wrapper.findAll('.dm-tabs__panel')
92
+ expect(panels[0].classes()).not.toContain('dm-tabs__panel--active')
93
+ expect(panels[1].classes()).toContain('dm-tabs__panel--active')
94
+ expect(panels[2].classes()).not.toContain('dm-tabs__panel--active')
95
+ })
96
+
97
+ it('handles keyboard navigation - ArrowRight', async () => {
98
+ const wrapper = mount(DatametriaTabs, { props: { tabs } })
99
+ const tabButtons = wrapper.findAll('.dm-tabs__tab')
100
+
101
+ await tabButtons[0].trigger('keydown', { key: 'ArrowRight' })
102
+ expect(wrapper.emitted('update:modelValue')?.[0]).toEqual([1])
103
+ })
104
+
105
+ it('handles keyboard navigation - ArrowLeft', async () => {
106
+ const wrapper = mount(DatametriaTabs, { props: { tabs, modelValue: 1 } })
107
+ const tabButtons = wrapper.findAll('.dm-tabs__tab')
108
+
109
+ await tabButtons[1].trigger('keydown', { key: 'ArrowLeft' })
110
+ expect(wrapper.emitted('update:modelValue')?.[0]).toEqual([0])
111
+ })
112
+
113
+ it('handles keyboard navigation - Home', async () => {
114
+ const wrapper = mount(DatametriaTabs, { props: { tabs, modelValue: 2 } })
115
+ const tabButtons = wrapper.findAll('.dm-tabs__tab')
116
+
117
+ await tabButtons[2].trigger('keydown', { key: 'Home' })
118
+ expect(wrapper.emitted('update:modelValue')?.[0]).toEqual([0])
119
+ })
120
+
121
+ it('handles keyboard navigation - End', async () => {
122
+ const wrapper = mount(DatametriaTabs, { props: { tabs, modelValue: 0 } })
123
+ const tabButtons = wrapper.findAll('.dm-tabs__tab')
124
+
125
+ await tabButtons[0].trigger('keydown', { key: 'End' })
126
+ expect(wrapper.emitted('update:modelValue')?.[0]).toEqual([2])
127
+ })
128
+
129
+ it('wraps around with ArrowRight at last tab', async () => {
130
+ const wrapper = mount(DatametriaTabs, { props: { tabs, modelValue: 2 } })
131
+ const tabButtons = wrapper.findAll('.dm-tabs__tab')
132
+
133
+ await tabButtons[2].trigger('keydown', { key: 'ArrowRight' })
134
+ expect(wrapper.emitted('update:modelValue')?.[0]).toEqual([0])
135
+ })
136
+
137
+ it('wraps around with ArrowLeft at first tab', async () => {
138
+ const wrapper = mount(DatametriaTabs, { props: { tabs, modelValue: 0 } })
139
+ const tabButtons = wrapper.findAll('.dm-tabs__tab')
140
+
141
+ await tabButtons[0].trigger('keydown', { key: 'ArrowLeft' })
142
+ expect(wrapper.emitted('update:modelValue')?.[0]).toEqual([2])
143
+ })
144
+
145
+ it('renders tabs with icons', () => {
146
+ const tabsWithIcons = [
147
+ { label: 'Home', icon: '🏠' },
148
+ { label: 'Settings', icon: '⚙️' }
149
+ ]
150
+ const wrapper = mount(DatametriaTabs, { props: { tabs: tabsWithIcons } })
151
+ expect(wrapper.findAll('.dm-tabs__icon')).toHaveLength(2)
152
+ expect(wrapper.findAll('.dm-tabs__icon')[0].text()).toBe('🏠')
153
+ })
154
+
155
+ it('renders tabs with badges', () => {
156
+ const tabsWithBadges = [
157
+ { label: 'Messages', badge: '5' },
158
+ { label: 'Notifications', badge: 10 }
159
+ ]
160
+ const wrapper = mount(DatametriaTabs, { props: { tabs: tabsWithBadges } })
161
+ expect(wrapper.findAll('.dm-tabs__badge')).toHaveLength(2)
162
+ expect(wrapper.findAll('.dm-tabs__badge')[0].text()).toBe('5')
163
+ expect(wrapper.findAll('.dm-tabs__badge')[1].text()).toBe('10')
164
+ })
165
+
166
+ it('handles disabled tabs', async () => {
167
+ const tabsWithDisabled = [
168
+ { label: 'Tab 1' },
169
+ { label: 'Tab 2', disabled: true },
170
+ { label: 'Tab 3' }
171
+ ]
172
+ const wrapper = mount(DatametriaTabs, { props: { tabs: tabsWithDisabled } })
173
+
174
+ const disabledTab = wrapper.findAll('.dm-tabs__tab')[1]
175
+ expect(disabledTab.classes()).toContain('dm-tabs__tab--disabled')
176
+ expect(disabledTab.attributes('disabled')).toBeDefined()
177
+
178
+ await disabledTab.trigger('click')
179
+ expect(wrapper.emitted('update:modelValue')).toBeFalsy()
180
+ })
181
+
182
+ it('shows indicator by default', () => {
183
+ const wrapper = mount(DatametriaTabs, { props: { tabs } })
184
+ expect(wrapper.find('.dm-tabs__indicator').exists()).toBe(true)
185
+ })
186
+
187
+ it('hides indicator when showIndicator is false', () => {
188
+ const wrapper = mount(DatametriaTabs, { props: { tabs, showIndicator: false } })
189
+ expect(wrapper.find('.dm-tabs__indicator').exists()).toBe(false)
190
+ })
191
+
192
+ it('has correct aria attributes', () => {
193
+ const wrapper = mount(DatametriaTabs, { props: { tabs, ariaLabel: 'Main tabs' } })
194
+ const header = wrapper.find('.dm-tabs__header')
195
+ expect(header.attributes('role')).toBe('tablist')
196
+ expect(header.attributes('aria-label')).toBe('Main tabs')
197
+ expect(header.attributes('aria-orientation')).toBe('horizontal')
198
+ })
199
+
200
+ it('updates aria-orientation for vertical tabs', () => {
201
+ const wrapper = mount(DatametriaTabs, { props: { tabs, orientation: 'vertical' } })
202
+ const header = wrapper.find('.dm-tabs__header')
203
+ expect(header.attributes('aria-orientation')).toBe('vertical')
204
+ })
205
+
206
+ it('handles vertical keyboard navigation', async () => {
207
+ const wrapper = mount(DatametriaTabs, { props: { tabs, orientation: 'vertical' } })
208
+ const tabButtons = wrapper.findAll('.dm-tabs__tab')
209
+
210
+ await tabButtons[0].trigger('keydown', { key: 'ArrowDown' })
211
+ expect(wrapper.emitted('update:modelValue')?.[0]).toEqual([1])
212
+
213
+ await tabButtons[1].trigger('keydown', { key: 'ArrowUp' })
214
+ expect(wrapper.emitted('update:modelValue')?.[1]).toEqual([0])
215
+ })
216
+
217
+ it('ignores horizontal keys in vertical mode', async () => {
218
+ const wrapper = mount(DatametriaTabs, { props: { tabs, orientation: 'vertical' } })
219
+ const tabButtons = wrapper.findAll('.dm-tabs__tab')
220
+
221
+ await tabButtons[0].trigger('keydown', { key: 'ArrowRight' })
222
+ expect(wrapper.emitted('update:modelValue')).toBeFalsy()
223
+ })
224
+
225
+ it('updates when modelValue prop changes', async () => {
226
+ const wrapper = mount(DatametriaTabs, { props: { tabs, modelValue: 0 } })
227
+ expect(wrapper.findAll('.dm-tabs__tab')[0].classes()).toContain('dm-tabs__tab--active')
228
+
229
+ await wrapper.setProps({ modelValue: 2 })
230
+ expect(wrapper.findAll('.dm-tabs__tab')[2].classes()).toContain('dm-tabs__tab--active')
231
+ })
232
+ })
package/src/index.ts CHANGED
@@ -37,6 +37,8 @@ export { default as DatametriaChip } from './components/DatametriaChip.vue'
37
37
 
38
38
  // Components - Navigation
39
39
  export { default as DatametriaNavbar } from './components/DatametriaNavbar.vue'
40
+ export { default as DatametriaSidebar } from './components/DatametriaSidebar.vue'
41
+ export { default as DatametriaFloatingBar } from './components/DatametriaFloatingBar.vue'
40
42
  export { default as DatametriaMenu } from './components/DatametriaMenu.vue'
41
43
  export { default as DatametriaBreadcrumb } from './components/DatametriaBreadcrumb.vue'
42
44
  export { default as DatametriaTabs } from './components/DatametriaTabs.vue'