-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Tabs): add new Headless UI's version tabs
- Loading branch information
Showing
14 changed files
with
271 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
module.exports = { | ||
stories: [ | ||
'../packages/*/src/**/*.stories.@(js|jsx|ts|tsx|mdx)', | ||
'../stories/**/*.stories.@(js|jsx|ts|tsx|mdx)', | ||
], | ||
addons: ['@storybook/addon-links', '@storybook/addon-essentials'], | ||
framework: '@storybook/vue3', | ||
core: { | ||
builder: '@storybook/builder-vite', | ||
}, | ||
features: { | ||
storyStoreV7: true, | ||
}, | ||
viteFinal: (config) => { | ||
return { | ||
...config, | ||
build: { | ||
...config.build, | ||
sourcemap: false, | ||
// target: ['es2020'], | ||
}, | ||
}; | ||
}, | ||
}; | ||
module.exports = { | ||
stories: [ | ||
'../packages/*/src/**/*.stories.@(js|jsx|ts|tsx|mdx)', | ||
'../stories/**/*.stories.@(js|jsx|ts|tsx|mdx)', | ||
], | ||
addons: ['@storybook/addon-links', '@storybook/addon-essentials'], | ||
framework: '@storybook/vue3', | ||
core: { | ||
builder: '@storybook/builder-vite', | ||
}, | ||
features: { | ||
storyStoreV7: true, | ||
}, | ||
// viteFinal: (config) => { | ||
// return { | ||
// ...config, | ||
// build: { | ||
// ...config.build, | ||
// sourcemap: false, | ||
// // target: ['es2020'], | ||
// }, | ||
// }; | ||
// }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<script setup lang="ts"> | ||
import {TabGroup} from '@headlessui/vue'; | ||
import type {TabVariants} from './variants'; | ||
import type {DefaultColors} from '@morpheme/theme/defaultTheme'; | ||
import {computed} from 'vue'; | ||
const props = withDefaults( | ||
defineProps<{ | ||
modelValue?: number; | ||
variant?: TabVariants; | ||
vertical?: boolean; | ||
centerActive?: boolean; | ||
color?: DefaultColors; | ||
}>(), | ||
{ | ||
variant: 'underline', | ||
color: 'primary', | ||
}, | ||
); | ||
const emit = | ||
defineEmits<{ | ||
(e: 'update:modelValue', value: number): void; | ||
}>(); | ||
const modelValue = computed({ | ||
get() { | ||
return props.modelValue; | ||
}, | ||
set(value: number) { | ||
emit('update:modelValue', value); | ||
}, | ||
}); | ||
function onTabChange(value: number) { | ||
modelValue.value = value; | ||
} | ||
</script> | ||
|
||
<template> | ||
<TabGroup | ||
class="v-tabs v-tabs--group" | ||
:class="[ | ||
`v-tabs-${color}`, | ||
`v-tabs--${variant}`, | ||
{ | ||
'v-tabs--vertical': vertical, | ||
'v-tabs--center-active': centerActive, | ||
}, | ||
]" | ||
as="div" | ||
:selectedIndex="modelValue" | ||
:vertical="vertical" | ||
@change="onTabChange" | ||
> | ||
<slot /> | ||
</TabGroup> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<script setup lang="ts"> | ||
import {Tab} from '@headlessui/vue'; | ||
</script> | ||
|
||
<template> | ||
<Tab as="template" v-slot="{selected}"> | ||
<button | ||
class="v-tabs-item" | ||
:class="[ | ||
{ | ||
'v-tabs-item--active': selected, | ||
}, | ||
]" | ||
> | ||
<slot /> | ||
</button> | ||
</Tab> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<script setup lang="ts"> | ||
import {TabList} from '@headlessui/vue'; | ||
</script> | ||
|
||
<template> | ||
<TabList class="v-tabs-items"> | ||
<slot /> | ||
</TabList> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<script setup lang="ts"> | ||
import {TabPanel} from '@headlessui/vue'; | ||
</script> | ||
|
||
<template> | ||
<TabPanel class="v-tabs-panel"> | ||
<slot /> | ||
</TabPanel> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<script setup lang="ts"> | ||
import {TabPanels} from '@headlessui/vue'; | ||
</script> | ||
|
||
<template> | ||
<TabPanels class="v-tabs-panels"> | ||
<slot /> | ||
</TabPanels> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const VTabsApiSymbol = Symbol('VTabs'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
import './VTabs.dark.scss'; | ||
export * from './types'; | ||
export * from './variants'; | ||
export * from './api'; | ||
export {default} from './VTabs.vue'; | ||
export {default as VTabs} from './VTabs.vue'; | ||
export {default as VTab} from './VTab.vue'; | ||
export {default as VTabsSlider} from './VTabsSlider.vue'; | ||
export * from './types'; | ||
export * from './variants'; | ||
export {default as VTabGroup} from './VTabGroup.vue'; | ||
export {default as VTabItem} from './VTabItem.vue'; | ||
export {default as VTabList} from './VTabList.vue'; | ||
export {default as VTabPanel} from './VTabPanel.vue'; | ||
export {default as VTabPanels} from './VTabPanels.vue'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.