Merge branch 'main' into feat_timeline
# Conflicts: # docs/.vitepress/config.ts
This commit is contained in:
@@ -12,11 +12,10 @@
|
||||
<script lang="ts" setup>
|
||||
import { useAccordionContentClasses } from '@/components/Accordion/composables/useAccordionContentClasses'
|
||||
import { onMounted, ref } from 'vue'
|
||||
|
||||
import type { ComputedRef } from 'vue'
|
||||
const isLoaded = ref(false)
|
||||
const content = ref()
|
||||
|
||||
let contentClasses
|
||||
let contentClasses: ComputedRef
|
||||
|
||||
onMounted(() => {
|
||||
const accordionHeaderClasses = useAccordionContentClasses(content)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { useAccordionState } from '@/components/Accordion/composables/useAccordionState'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import type { ComputedRef } from 'vue'
|
||||
import { useAccordionHeaderClasses } from '@/components/Accordion/composables/useAccordionHeaderClasses'
|
||||
|
||||
const isLoaded = ref(false)
|
||||
@@ -34,7 +35,7 @@ const { accordionsStates } = useAccordionState()
|
||||
const accordionState = computed(() => accordionsStates[accordionId.value])
|
||||
const panelState = computed(() => accordionState.value.panels[panelId.value])
|
||||
|
||||
let headerClasses, arrowClasses
|
||||
let headerClasses: ComputedRef, arrowClasses: ComputedRef
|
||||
function commonToggleItem() {
|
||||
const isSelectedVisible = panelState.value.isVisible
|
||||
for (const panelIndex in accordionState.value.panels) {
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
<!-- Item 1 -->
|
||||
<!-- duration-700 ease-in-out-->
|
||||
<div :class="index === currentPicture ? 'z-30' : 'z-0'"
|
||||
v-for="(picture, index) in pictures" :key="picture" class="absolute inset-0 -translate-y-0">
|
||||
v-for="(picture, index) in pictures" :key="index" class="absolute inset-0 -translate-y-0">
|
||||
<img :src="picture.src" class="block absolute top-1/2 left-1/2 w-full -translate-x-1/2 -translate-y-1/2" :alt="picture.alt">
|
||||
</div>
|
||||
</div>
|
||||
<!-- Slider indicators -->
|
||||
<div v-if="indicators" class="flex absolute bottom-5 left-1/2 z-30 space-x-3 -translate-x-1/2">
|
||||
<button v-for="(picture, index) in pictures" :key="picture" type="button" :class="index === currentPicture ? 'bg-white' : 'bg-white/50'" class="w-3 h-3 rounded-full bg-white" aria-current="false" :aria-label="'Slide ' + index" @click.prevent="slideTo(index)"></button>
|
||||
<button v-for="(picture, index) in pictures" :key="index" type="button" :class="index === currentPicture ? 'bg-white' : 'bg-white/50'" class="w-3 h-3 rounded-full bg-white" aria-current="false" :aria-label="'Slide ' + index" @click.prevent="slideTo(index)"></button>
|
||||
</div>
|
||||
<!-- Slider controls -->
|
||||
<button v-if="controls" @click.prevent="previousPicture" type="button" class="flex absolute top-0 left-0 z-30 justify-center items-center px-4 h-full cursor-pointer group focus:outline-none" data-carousel-prev>
|
||||
@@ -30,10 +30,12 @@
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import type { PropType } from 'vue'
|
||||
import type { PictureItem } from '@/components/Carousel/types'
|
||||
|
||||
const props = defineProps({
|
||||
pictures: {
|
||||
type: Array,
|
||||
type: Array as PropType<PictureItem[]>,
|
||||
default() {
|
||||
return [
|
||||
{
|
||||
|
||||
4
src/components/Carousel/types.ts
Normal file
4
src/components/Carousel/types.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export type PictureItem = {
|
||||
src: string,
|
||||
alt?: string
|
||||
}
|
||||
@@ -1,104 +1,29 @@
|
||||
<template>
|
||||
<div class="relative overflow-x-auto shadow-md sm:rounded-lg">
|
||||
<table class="w-full text-sm text-left text-gray-500 dark:text-gray-400">
|
||||
<thead class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400">
|
||||
<tr>
|
||||
<th scope="col" class="px-6 py-3">
|
||||
Product name
|
||||
</th>
|
||||
<th scope="col" class="px-6 py-3">
|
||||
Color
|
||||
</th>
|
||||
<th scope="col" class="px-6 py-3">
|
||||
Category
|
||||
</th>
|
||||
<th scope="col" class="px-6 py-3">
|
||||
Price
|
||||
</th>
|
||||
<th scope="col" class="px-6 py-3">
|
||||
<span class="sr-only">Edit</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
|
||||
<th scope="row" class="px-6 py-4 font-medium text-gray-900 dark:text-white whitespace-nowrap">
|
||||
Apple MacBook Pro 17"
|
||||
</th>
|
||||
<td class="px-6 py-4">
|
||||
Sliver
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
Laptop
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
$2999
|
||||
</td>
|
||||
<td class="px-6 py-4 text-right">
|
||||
<a href="#" class="font-medium text-blue-600 dark:text-blue-500 hover:underline">Edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
|
||||
<th scope="row" class="px-6 py-4 font-medium text-gray-900 dark:text-white whitespace-nowrap">
|
||||
Microsoft Surface Pro
|
||||
</th>
|
||||
<td class="px-6 py-4">
|
||||
White
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
Laptop PC
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
$1999
|
||||
</td>
|
||||
<td class="px-6 py-4 text-right">
|
||||
<a href="#" class="font-medium text-blue-600 dark:text-blue-500 hover:underline">Edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="bg-white dark:bg-gray-800">
|
||||
<th scope="row" class="px-6 py-4 font-medium text-gray-900 dark:text-white whitespace-nowrap">
|
||||
Magic Mouse 2
|
||||
</th>
|
||||
<td class="px-6 py-4">
|
||||
Black
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
Accessories
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
$99
|
||||
</td>
|
||||
<td class="px-6 py-4 text-right">
|
||||
<a href="#" class="font-medium text-blue-600 dark:text-blue-500 hover:underline">Edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<slot></slot>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { computed, toRefs } from 'vue'
|
||||
import type { PropType } from 'vue'
|
||||
import { provide } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
children: {
|
||||
type: Array,
|
||||
default() {
|
||||
return []
|
||||
},
|
||||
},
|
||||
striped: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
stripedColumns: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
hoverable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
className: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
})
|
||||
|
||||
provide('striped', props.striped)
|
||||
provide('hoverable', props.hoverable)
|
||||
provide('stripedColumns', props.stripedColumns)
|
||||
</script>
|
||||
|
||||
7
src/components/Table/TableBody.vue
Normal file
7
src/components/Table/TableBody.vue
Normal file
@@ -0,0 +1,7 @@
|
||||
<template>
|
||||
<tbody>
|
||||
<slot></slot>
|
||||
</tbody>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
</script>
|
||||
11
src/components/Table/TableCell.vue
Normal file
11
src/components/Table/TableCell.vue
Normal file
@@ -0,0 +1,11 @@
|
||||
<template>
|
||||
<td :class="tableCellClasses">
|
||||
<slot></slot>
|
||||
</td>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
|
||||
import { useTableCellClasses } from '@/components/Table/composables/useTableCellClasses'
|
||||
|
||||
const { tableCellClasses } = useTableCellClasses()
|
||||
</script>
|
||||
9
src/components/Table/TableHead.vue
Normal file
9
src/components/Table/TableHead.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<thead class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400">
|
||||
<tr>
|
||||
<slot></slot>
|
||||
</tr>
|
||||
</thead>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
</script>
|
||||
10
src/components/Table/TableHeadCell.vue
Normal file
10
src/components/Table/TableHeadCell.vue
Normal file
@@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<th scope="col" :class="tableHeadCellClasses">
|
||||
<slot></slot>
|
||||
</th>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { useTableHeadCellClasses } from '@/components/Table/composables/useTableHeadCellClasses'
|
||||
|
||||
const { tableHeadCellClasses } = useTableHeadCellClasses()
|
||||
</script>
|
||||
10
src/components/Table/TableRow.vue
Normal file
10
src/components/Table/TableRow.vue
Normal file
@@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<tr :class="tableRowClasses">
|
||||
<slot></slot>
|
||||
</tr>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { useTableRowClasses } from '@/components/Table/composables/useTableRowClasses'
|
||||
|
||||
const { tableRowClasses } = useTableRowClasses()
|
||||
</script>
|
||||
20
src/components/Table/composables/useTableCellClasses.ts
Normal file
20
src/components/Table/composables/useTableCellClasses.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { computed, inject } from 'vue'
|
||||
import type { Ref } from 'vue'
|
||||
import classNames from 'classnames'
|
||||
|
||||
const baseClasses = 'px-6 py-4 first:font-medium first:text-gray-900 first:dark:text-white first:whitespace-nowrap last:text-right'
|
||||
const stripedCellClasses = 'even:bg-gray-white even:dark:bg-gray-900 odd:dark:bg-gray-800 odd:bg-gray-50'
|
||||
|
||||
export function useTableCellClasses(): { tableCellClasses: Ref<string> } {
|
||||
const isColumnsStriped = inject('stripedColumns')
|
||||
|
||||
const tableCellClasses = computed(() => {
|
||||
return classNames(baseClasses, {
|
||||
[stripedCellClasses]: isColumnsStriped,
|
||||
})
|
||||
})
|
||||
|
||||
return {
|
||||
tableCellClasses,
|
||||
}
|
||||
}
|
||||
20
src/components/Table/composables/useTableHeadCellClasses.ts
Normal file
20
src/components/Table/composables/useTableHeadCellClasses.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { computed, inject } from 'vue'
|
||||
import type { Ref } from 'vue'
|
||||
import classNames from 'classnames'
|
||||
|
||||
const baseClasses = 'px-6 py-3 text-xs uppercase'
|
||||
const stripedHeadCellClasses = 'even:bg-white even:dark:bg-gray-900 odd:dark:bg-gray-800 odd:bg-gray-50'
|
||||
|
||||
export function useTableHeadCellClasses(): { tableHeadCellClasses: Ref<string> } {
|
||||
const isColumnsStriped = inject('stripedColumns')
|
||||
|
||||
const tableHeadCellClasses = computed(() => {
|
||||
return classNames(baseClasses, {
|
||||
[stripedHeadCellClasses]: isColumnsStriped,
|
||||
})
|
||||
})
|
||||
|
||||
return {
|
||||
tableHeadCellClasses,
|
||||
}
|
||||
}
|
||||
23
src/components/Table/composables/useTableRowClasses.ts
Normal file
23
src/components/Table/composables/useTableRowClasses.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { computed, inject } from 'vue'
|
||||
import type { Ref } from 'vue'
|
||||
import classNames from 'classnames'
|
||||
|
||||
const baseClasses = 'bg-white dark:bg-gray-800 [&:not(:last-child)]:border-b [&:not(:last-child)]:dark:border-gray-700'
|
||||
const stripedClasses = 'odd:bg-white even:bg-gray-50 odd:dark:bg-gray-800 even:dark:bg-gray-700'
|
||||
const hoverableClasses = 'hover:bg-gray-50 dark:hover:bg-gray-600'
|
||||
|
||||
export function useTableRowClasses(): { tableRowClasses: Ref<string> } {
|
||||
const isStriped = inject('striped')
|
||||
const isHoverable = inject('hoverable')
|
||||
|
||||
const tableRowClasses = computed(() => {
|
||||
return classNames(baseClasses, {
|
||||
[stripedClasses]: isStriped,
|
||||
[hoverableClasses]: isHoverable,
|
||||
})
|
||||
})
|
||||
|
||||
return {
|
||||
tableRowClasses,
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,11 @@ export { default as Progress } from './components/Progress/Progress.vue'
|
||||
export { default as Rating } from './components/Rating/Rating.vue'
|
||||
export { default as Sidebar } from './components/Sidebar/Sidebar.vue'
|
||||
export { default as Table } from './components/Table/Table.vue'
|
||||
export { default as TableHead } from './components/Table/TableHead.vue'
|
||||
export { default as TableBody } from './components/Table/TableBody.vue'
|
||||
export { default as TableHeadCell } from './components/Table/TableHeadCell.vue'
|
||||
export { default as TableRow } from './components/Table/TableRow.vue'
|
||||
export { default as TableCell } from './components/Table/TableCell.vue'
|
||||
export { default as Timeline } from './components/Timeline/Timeline.vue'
|
||||
export { default as TimelineItem } from './components/Timeline/TimelineItem.vue'
|
||||
export { default as TimelinePoint } from './components/Timeline/TimelinePoint.vue'
|
||||
|
||||
Reference in New Issue
Block a user