feat: a little bit new structure
This commit is contained in:
@@ -27,10 +27,10 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { useAlertClasses } from './useAlertClasses'
|
import { useAlertClasses } from './composables/useAlertClasses'
|
||||||
import { onBeforeUnmount, ref, toRefs } from 'vue'
|
import { onBeforeUnmount, ref, toRefs } from 'vue'
|
||||||
|
import type { AlertType } from './types'
|
||||||
|
|
||||||
export type AlertType = 'info' | 'danger' | 'success' | 'warning' | 'dark'
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
type: {
|
type: {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { AlertType } from './Alert.vue'
|
import type { AlertType } from '../types'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import type { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
1
src/components/Alert/types.d.ts
vendored
Normal file
1
src/components/Alert/types.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export type AlertType = 'info' | 'danger' | 'success' | 'warning' | 'dark'
|
||||||
@@ -31,15 +31,9 @@
|
|||||||
import { computed, toRefs } from 'vue'
|
import { computed, toRefs } from 'vue'
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import Spinner from '../Spinner/Spinner.vue'
|
import Spinner from '../Spinner/Spinner.vue'
|
||||||
import { useButtonClasses } from './useButtonClasses'
|
import { useButtonClasses } from './composables/useButtonClasses'
|
||||||
import { useButtonSpinner } from './useButtonSpinner'
|
import { useButtonSpinner } from './composables/useButtonSpinner'
|
||||||
|
import type { ButtonGradient, ButtonMonochromeGradient, ButtonSize, ButtonVariant } from './types'
|
||||||
export type ButtonMonochromeGradient = 'blue' | 'green' | 'cyan' | 'teal' | 'lime' | 'red' | 'pink' | 'purple'
|
|
||||||
export type ButtonDuotoneGradient = 'purple-blue' | 'cyan-blue' | 'green-blue' | 'purple-pink' | 'pink-orange' | 'teal-lime' | 'red-yellow'
|
|
||||||
export type ButtonGradient = ButtonDuotoneGradient | ButtonMonochromeGradient
|
|
||||||
|
|
||||||
export type ButtonVariant = 'default' | 'alternative' | 'dark' | 'light' | 'green' | 'red' | 'yellow' | 'purple'
|
|
||||||
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
color: {
|
color: {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
import { computed, useSlots } from 'vue'
|
import { computed, useSlots } from 'vue'
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
import type { ButtonDuotoneGradient, ButtonGradient, ButtonMonochromeGradient, ButtonSize, ButtonVariant } from './Button.vue'
|
import type { ButtonDuotoneGradient, ButtonGradient, ButtonMonochromeGradient, ButtonSize, ButtonVariant } from '../types'
|
||||||
|
|
||||||
|
|
||||||
export type ButtonClassMap<T extends string> = { hover: Record<T, string>, default: Record<T, string> }
|
export type ButtonClassMap<T extends string> = { hover: Record<T, string>, default: Record<T, string> }
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { ButtonGradient, ButtonSize, ButtonVariant } from './Button.vue'
|
import type { ButtonGradient, ButtonSize, ButtonVariant } from '../types'
|
||||||
import type { SpinnerColor, SpinnerSize } from '../Spinner/Spinner.vue'
|
import type { SpinnerColor, SpinnerSize } from '../../Spinner/types'
|
||||||
import type { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
|
||||||
5
src/components/Button/types.d.ts
vendored
Normal file
5
src/components/Button/types.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export type ButtonMonochromeGradient = 'blue' | 'green' | 'cyan' | 'teal' | 'lime' | 'red' | 'pink' | 'purple'
|
||||||
|
export type ButtonDuotoneGradient = 'purple-blue' | 'cyan-blue' | 'green-blue' | 'purple-pink' | 'pink-orange' | 'teal-lime' | 'red-yellow'
|
||||||
|
export type ButtonGradient = ButtonDuotoneGradient | ButtonMonochromeGradient
|
||||||
|
export type ButtonVariant = 'default' | 'alternative' | 'dark' | 'light' | 'green' | 'red' | 'yellow' | 'purple'
|
||||||
|
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
||||||
@@ -9,13 +9,13 @@
|
|||||||
|
|
||||||
@layer components {
|
@layer components {
|
||||||
.btn-group > button {
|
.btn-group > button {
|
||||||
@apply rounded-none
|
@apply rounded-none;
|
||||||
}
|
}
|
||||||
.btn-group > button:first-child {
|
.btn-group > button:first-child {
|
||||||
@apply rounded-l-lg
|
@apply rounded-l-lg;
|
||||||
}
|
}
|
||||||
.btn-group > button:last-child {
|
.btn-group > button:last-child {
|
||||||
@apply rounded-r-lg
|
@apply rounded-r-lg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -6,11 +6,9 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { useSpinnerClasses } from './useSpinnerClasses'
|
import { useSpinnerClasses } from './composables/useSpinnerClasses'
|
||||||
import { toRefs } from 'vue'
|
import { toRefs } from 'vue'
|
||||||
|
import type { SpinnerColor, SpinnerSize } from './types'
|
||||||
export type SpinnerSize = '0' | 'px' | '0.5' | '1' | '1.5' | '2' | '2.5' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12'
|
|
||||||
export type SpinnerColor = 'blue' | 'gray' | 'green' | 'red' | 'yellow' | 'pink' | 'purple' | 'white'
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
size: {
|
size: {
|
||||||
|
|||||||
2
src/components/Spinner/types.d.ts
vendored
Normal file
2
src/components/Spinner/types.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export type SpinnerSize = '0' | 'px' | '0.5' | '1' | '1.5' | '2' | '2.5' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12'
|
||||||
|
export type SpinnerColor = 'blue' | 'gray' | 'green' | 'red' | 'yellow' | 'pink' | 'purple' | 'white'
|
||||||
@@ -23,12 +23,13 @@ import {
|
|||||||
TAB_ACTIVE_NAME_INJECTION_KEY,
|
TAB_ACTIVE_NAME_INJECTION_KEY,
|
||||||
TAB_STYLE_INJECTION_KEY,
|
TAB_STYLE_INJECTION_KEY,
|
||||||
TAB_VISIBILITY_DIRECTIVE_INJECTION_KEY,
|
TAB_VISIBILITY_DIRECTIVE_INJECTION_KEY,
|
||||||
} from './config'
|
} from './injection/config'
|
||||||
import { useTabsClasses } from './useTabsClasses'
|
import { useTabsClasses } from './composables/useTabsClasses'
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { computed, provide, toRef, useSlots } from 'vue'
|
import { computed, provide, toRef, useSlots } from 'vue'
|
||||||
import { flatten } from '../../utils/flatten'
|
import { flatten } from '../../utils/flatten'
|
||||||
import TabPane from './components/TabPane/TabPane.vue'
|
import TabPane from './components/TabPane/TabPane.vue'
|
||||||
|
import type { TabsVariant } from './types'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
variant: {
|
variant: {
|
||||||
@@ -82,6 +83,4 @@ provide(TAB_ACTIVATE_INJECTION_KEY, onActivate)
|
|||||||
export default {
|
export default {
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TabsVariant = 'default' | 'underline' | 'pills'
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { inject } from 'vue'
|
import { inject } from 'vue'
|
||||||
import { TAB_ACTIVE_NAME_INJECTION_KEY, TAB_VISIBILITY_DIRECTIVE_INJECTION_KEY } from '../../config'
|
import { TAB_ACTIVE_NAME_INJECTION_KEY, TAB_VISIBILITY_DIRECTIVE_INJECTION_KEY } from '../../injection/config'
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
name: {
|
name: {
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { inject, toRefs } from 'vue'
|
import { inject, toRefs } from 'vue'
|
||||||
import { TAB_ACTIVATE_INJECTION_KEY, TAB_STYLE_INJECTION_KEY } from '../../config'
|
import { TAB_ACTIVATE_INJECTION_KEY, TAB_STYLE_INJECTION_KEY } from '../../injection/config'
|
||||||
import type { TabsVariant } from '../../Tabs.vue'
|
import type { TabsVariant } from '../../types'
|
||||||
import { useTabClasses } from './useTabClasses'
|
import { useTabClasses } from './composables/useTabClasses'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
name: {
|
name: {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import type { TabsVariant } from './Tabs.vue'
|
import type { TabsVariant } from '../types'
|
||||||
|
|
||||||
export type UseTabsClassesProps = {
|
export type UseTabsClassesProps = {
|
||||||
variant: TabsVariant
|
variant: TabsVariant
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// dependency injection config for tabs
|
||||||
|
|
||||||
export const TAB_STYLE_INJECTION_KEY = 'flowbite-tab-style-injection'
|
export const TAB_STYLE_INJECTION_KEY = 'flowbite-tab-style-injection'
|
||||||
export const TAB_ACTIVE_NAME_INJECTION_KEY = 'flowbite-tab-active-name-injection'
|
export const TAB_ACTIVE_NAME_INJECTION_KEY = 'flowbite-tab-active-name-injection'
|
||||||
export const TAB_VISIBILITY_DIRECTIVE_INJECTION_KEY = 'flowbite-tab-visibility-directive-injection'
|
export const TAB_VISIBILITY_DIRECTIVE_INJECTION_KEY = 'flowbite-tab-visibility-directive-injection'
|
||||||
1
src/components/Tabs/types.d.ts
vendored
Normal file
1
src/components/Tabs/types.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export type TabsVariant = 'default' | 'underline' | 'pills'
|
||||||
3
src/composables/useClasses.ts
Normal file
3
src/composables/useClasses.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export function useClasses() {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ export default defineConfig({
|
|||||||
plugins: [vue()],
|
plugins: [vue()],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': resolve(__dirname, 'src'),
|
'@': resolve(__dirname, './src'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
|
|||||||
Reference in New Issue
Block a user