cornet-ui 0.1.0-beta.4 → 0.1.0-beta.5
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/plugin-vite.js +1 -1
- package/package.json +2 -27
- package/components/Actions/du-button/du-button.types.ts +0 -14
- package/components/Actions/du-button/du-button.vue +0 -149
- package/components/Actions/du-dropdown/du-dropdown.types.ts +0 -15
- package/components/Actions/du-dropdown/du-dropdown.vue +0 -75
- package/components/Actions/du-fab/du-fab.types.ts +0 -28
- package/components/Actions/du-fab/du-fab.vue +0 -270
- package/components/Actions/du-modal/du-modal.types.ts +0 -10
- package/components/Actions/du-modal/du-modal.vue +0 -123
- package/components/Actions/du-swap/du-swap.types.ts +0 -3
- package/components/Actions/du-swap/du-swap.vue +0 -68
- package/components/DataDisplay/du-accordion/du-accordion-item.vue +0 -37
- package/components/DataDisplay/du-accordion/du-accordion.types.ts +0 -15
- package/components/DataDisplay/du-accordion/du-accordion.vue +0 -73
- package/components/DataDisplay/du-avatar/du-avatar.types.ts +0 -59
- package/components/DataDisplay/du-avatar/du-avatar.vue +0 -139
- package/components/DataDisplay/du-badge/du-badge.types.ts +0 -21
- package/components/DataDisplay/du-badge/du-badge.vue +0 -81
- package/components/DataDisplay/du-card/du-card.types.ts +0 -18
- package/components/DataDisplay/du-card/du-card.vue +0 -86
- package/components/DataDisplay/du-carousel/du-carousel-item.vue +0 -11
- package/components/DataDisplay/du-carousel/du-carousel.types.ts +0 -15
- package/components/DataDisplay/du-carousel/du-carousel.vue +0 -46
- package/components/DataDisplay/du-chat/du-chat-item.vue +0 -56
- package/components/DataDisplay/du-chat/du-chat.types.ts +0 -31
- package/components/DataDisplay/du-chat/du-chat.vue +0 -71
- package/components/DataDisplay/du-collapse/du-collapse.types.ts +0 -15
- package/components/DataDisplay/du-collapse/du-collapse.vue +0 -59
- package/components/DataDisplay/du-countdown/du-countdown-group.vue +0 -88
- package/components/DataDisplay/du-countdown/du-countdown.types.ts +0 -15
- package/components/DataDisplay/du-countdown/du-countdown.vue +0 -180
- package/components/DataDisplay/du-diff/du-diff.types.ts +0 -9
- package/components/DataDisplay/du-diff/du-diff.vue +0 -44
- package/components/DataDisplay/du-kbd/du-kbd.types.ts +0 -9
- package/components/DataDisplay/du-kbd/du-kbd.vue +0 -21
- package/components/DataDisplay/du-list/du-list-row.vue +0 -12
- package/components/DataDisplay/du-list/du-list.types.ts +0 -3
- package/components/DataDisplay/du-list/du-list.vue +0 -11
- package/components/DataDisplay/du-stat/du-stat.types.ts +0 -12
- package/components/DataDisplay/du-stat/du-stat.vue +0 -28
- package/components/DataDisplay/du-stats/du-stats.types.ts +0 -3
- package/components/DataDisplay/du-stats/du-stats.vue +0 -91
- package/components/DataDisplay/du-status/du-status.types.ts +0 -21
- package/components/DataDisplay/du-status/du-status.vue +0 -51
- package/components/DataDisplay/du-table/du-table-item.types.ts +0 -6
- package/components/DataDisplay/du-table/du-table-item.vue +0 -24
- package/components/DataDisplay/du-table/du-table.types.ts +0 -26
- package/components/DataDisplay/du-table/du-table.vue +0 -125
- package/components/DataDisplay/du-timeline/du-timeline-item.vue +0 -85
- package/components/DataDisplay/du-timeline/du-timeline.types.ts +0 -22
- package/components/DataDisplay/du-timeline/du-timeline.vue +0 -138
- package/components/DataInput/du-checkbox/du-checkbox.types.ts +0 -17
- package/components/DataInput/du-checkbox/du-checkbox.vue +0 -40
- package/components/DataInput/du-fieldset/du-fieldset.types.ts +0 -4
- package/components/DataInput/du-fieldset/du-fieldset.vue +0 -16
- package/components/DataInput/du-file-input/du-file-input.types.ts +0 -29
- package/components/DataInput/du-file-input/du-file-input.vue +0 -31
- package/components/DataInput/du-filter/du-filter.types.ts +0 -30
- package/components/DataInput/du-filter/du-filter.vue +0 -47
- package/components/DataInput/du-input-field/du-input-field.types.ts +0 -43
- package/components/DataInput/du-input-field/du-input-field.vue +0 -47
- package/components/DataInput/du-label/du-label.types.ts +0 -3
- package/components/DataInput/du-label/du-label.vue +0 -28
- package/components/DataInput/du-label-input-validator/du-label-input-validator.types.ts +0 -7
- package/components/DataInput/du-label-input-validator/du-label-input-validator.vue +0 -51
- package/components/DataInput/du-radio/du-radio.types.ts +0 -15
- package/components/DataInput/du-radio/du-radio.vue +0 -27
- package/components/DataInput/du-range/du-range.types.ts +0 -18
- package/components/DataInput/du-range/du-range.vue +0 -60
- package/components/DataInput/du-rating/du-rating-item.vue +0 -65
- package/components/DataInput/du-rating/du-rating.types.ts +0 -46
- package/components/DataInput/du-rating/du-rating.vue +0 -127
- package/components/DataInput/du-search/du-search.types.ts +0 -44
- package/components/DataInput/du-search/du-search.vue +0 -425
- package/components/DataInput/du-select/du-select.types.ts +0 -31
- package/components/DataInput/du-select/du-select.vue +0 -384
- package/components/DataInput/du-text-area/du-text-area.types.ts +0 -11
- package/components/DataInput/du-text-area/du-text-area.vue +0 -41
- package/components/Feedback/du-alert/du-alert.types.ts +0 -16
- package/components/Feedback/du-alert/du-alert.vue +0 -113
- package/components/Feedback/du-loading/du-loading.types.ts +0 -11
- package/components/Feedback/du-loading/du-loading.vue +0 -33
- package/components/Feedback/du-progress/du-progress.types.ts +0 -8
- package/components/Feedback/du-progress/du-progress.vue +0 -23
- package/components/Feedback/du-radial-progress/du-radial-progress.types.ts +0 -9
- package/components/Feedback/du-radial-progress/du-radial-progress.vue +0 -64
- package/components/Feedback/du-skeleton/du-skeleton.types.ts +0 -3
- package/components/Feedback/du-skeleton/du-skeleton.vue +0 -11
- package/components/Feedback/du-toast/du-toast.types.ts +0 -11
- package/components/Feedback/du-toast/du-toast.vue +0 -54
- package/components/Feedback/du-tooltip/du-tooltip.types.ts +0 -12
- package/components/Feedback/du-tooltip/du-tooltip.vue +0 -55
- package/components/Layout/du-drawer/du-drawer.types.ts +0 -27
- package/components/Layout/du-drawer/du-drawer.vue +0 -224
- package/components/Layout/du-join/du-join.types.ts +0 -7
- package/components/Layout/du-join/du-join.vue +0 -31
- package/components/Navigation/du-breadcrumbs/du-breadcrumbs.types.ts +0 -13
- package/components/Navigation/du-breadcrumbs/du-breadcrumbs.vue +0 -79
- package/components/Navigation/du-button-link/du-button-link.types.ts +0 -17
- package/components/Navigation/du-button-link/du-button-link.vue +0 -77
- package/components/Navigation/du-dock/du-dock.types.ts +0 -19
- package/components/Navigation/du-dock/du-dock.vue +0 -73
- package/components/Navigation/du-link/du-link.types.ts +0 -7
- package/components/Navigation/du-link/du-link.vue +0 -25
- package/components/Navigation/du-menu/du-menu-item.vue +0 -160
- package/components/Navigation/du-menu/du-menu.types.ts +0 -33
- package/components/Navigation/du-menu/du-menu.vue +0 -87
- package/components/Navigation/du-navbar/du-navbar.types.ts +0 -3
- package/components/Navigation/du-navbar/du-navbar.vue +0 -21
- package/components/Navigation/du-pagination/du-pagination.types.ts +0 -30
- package/components/Navigation/du-pagination/du-pagination.vue +0 -186
- package/components/Navigation/du-step-item/du-step-item.types.ts +0 -9
- package/components/Navigation/du-step-item/du-step-item.vue +0 -46
- package/components/Navigation/du-steps/du-steps.types.ts +0 -20
- package/components/Navigation/du-steps/du-steps.vue +0 -85
- package/components/Navigation/du-tabs/du-tabs.types.ts +0 -25
- package/components/Navigation/du-tabs/du-tabs.vue +0 -96
- package/composables/useSizeProps.ts +0 -26
- package/composables/useVariantProps.ts +0 -18
- package/index.ts +0 -69
- package/plugin-vite.ts +0 -286
- package/types/index.ts +0 -59
- package/types/types.sh +0 -80
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, ref, onMounted, watch } from 'vue'
|
|
3
|
-
|
|
4
|
-
const props = withDefaults(
|
|
5
|
-
defineProps<{
|
|
6
|
-
id?: string
|
|
7
|
-
open?: boolean
|
|
8
|
-
closeButton?: boolean
|
|
9
|
-
closeOnEscape?: boolean
|
|
10
|
-
closeBackdrop?: boolean
|
|
11
|
-
placement?: 'top' | 'middle' | 'bottom' | 'start' | 'end' | 'responsive'
|
|
12
|
-
classBox?: string
|
|
13
|
-
/** Accessible name of the dialog (use when there is no visible title). */
|
|
14
|
-
ariaLabel?: string
|
|
15
|
-
/** id of the element naming the dialog (e.g. your title element). */
|
|
16
|
-
ariaLabelledby?: string
|
|
17
|
-
/** Accessible label of the close button and backdrop. */
|
|
18
|
-
closeLabel?: string
|
|
19
|
-
}>(),
|
|
20
|
-
{
|
|
21
|
-
id: undefined,
|
|
22
|
-
open: false,
|
|
23
|
-
closeButton: false,
|
|
24
|
-
closeOnEscape: true,
|
|
25
|
-
closeBackdrop: true,
|
|
26
|
-
placement: 'middle',
|
|
27
|
-
classBox: '',
|
|
28
|
-
ariaLabel: undefined,
|
|
29
|
-
ariaLabelledby: undefined,
|
|
30
|
-
closeLabel: 'Close',
|
|
31
|
-
},
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
const dialogRef = ref<HTMLDialogElement | null>(null)
|
|
35
|
-
|
|
36
|
-
const placementClass = computed(() => {
|
|
37
|
-
switch (props.placement) {
|
|
38
|
-
case 'top':
|
|
39
|
-
return 'modal-top'
|
|
40
|
-
case 'middle':
|
|
41
|
-
return 'modal-middle'
|
|
42
|
-
case 'bottom':
|
|
43
|
-
return 'modal-bottom'
|
|
44
|
-
case 'start':
|
|
45
|
-
return 'modal-start'
|
|
46
|
-
case 'end':
|
|
47
|
-
return 'modal-end'
|
|
48
|
-
case 'responsive':
|
|
49
|
-
return 'modal-bottom sm:modal-middle'
|
|
50
|
-
default:
|
|
51
|
-
return ''
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
const showModal = () => {
|
|
56
|
-
if (dialogRef.value) {
|
|
57
|
-
dialogRef.value.showModal()
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const closeModal = () => {
|
|
62
|
-
if (dialogRef.value) {
|
|
63
|
-
dialogRef.value.close()
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const emit = defineEmits<{
|
|
68
|
-
'update:open': [value: boolean]
|
|
69
|
-
}>()
|
|
70
|
-
|
|
71
|
-
defineExpose({
|
|
72
|
-
showModal,
|
|
73
|
-
closeModal,
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
onMounted(() => {
|
|
77
|
-
if (props.open && dialogRef.value) {
|
|
78
|
-
showModal()
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
watch(
|
|
83
|
-
() => props.open,
|
|
84
|
-
(newValue: boolean) => {
|
|
85
|
-
if (newValue && dialogRef.value) {
|
|
86
|
-
showModal()
|
|
87
|
-
} else if (!newValue && dialogRef.value) {
|
|
88
|
-
closeModal()
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
function handleEscapeKey(_event: KeyboardEvent) {
|
|
94
|
-
if (props.closeOnEscape) {
|
|
95
|
-
closeModal()
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
</script>
|
|
99
|
-
|
|
100
|
-
<template>
|
|
101
|
-
<dialog
|
|
102
|
-
ref="dialogRef"
|
|
103
|
-
:id="id"
|
|
104
|
-
:class="['modal', placementClass]"
|
|
105
|
-
:aria-label="ariaLabel"
|
|
106
|
-
:aria-labelledby="ariaLabelledby"
|
|
107
|
-
@keydown.esc.prevent="handleEscapeKey"
|
|
108
|
-
@close="emit('update:open', false)"
|
|
109
|
-
>
|
|
110
|
-
<div :class="['modal-box', classBox]">
|
|
111
|
-
<form v-if="closeButton" method="dialog">
|
|
112
|
-
<button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2" :aria-label="closeLabel">
|
|
113
|
-
✕
|
|
114
|
-
</button>
|
|
115
|
-
</form>
|
|
116
|
-
<slot></slot>
|
|
117
|
-
<div class="modal-action" v-if="$slots.actions"><slot name="actions"> </slot></div>
|
|
118
|
-
</div>
|
|
119
|
-
<form v-if="closeBackdrop" method="dialog" class="modal-backdrop">
|
|
120
|
-
<button>{{ closeLabel }}</button>
|
|
121
|
-
</form>
|
|
122
|
-
</dialog>
|
|
123
|
-
</template>
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, ref, watch } from 'vue'
|
|
3
|
-
|
|
4
|
-
const props = withDefaults(
|
|
5
|
-
defineProps<{
|
|
6
|
-
modelValue?: boolean
|
|
7
|
-
rotate?: boolean
|
|
8
|
-
flip?: boolean
|
|
9
|
-
useCheckbox?: boolean
|
|
10
|
-
}>(),
|
|
11
|
-
{
|
|
12
|
-
modelValue: false,
|
|
13
|
-
rotate: false,
|
|
14
|
-
flip: false,
|
|
15
|
-
useCheckbox: true,
|
|
16
|
-
},
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
const emit = defineEmits<{
|
|
20
|
-
'update:modelValue': [value: boolean]
|
|
21
|
-
}>()
|
|
22
|
-
|
|
23
|
-
const internalActive = ref(props.modelValue)
|
|
24
|
-
|
|
25
|
-
watch(() => props.modelValue, (val) => {
|
|
26
|
-
internalActive.value = val
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
const isActive = computed({
|
|
30
|
-
get: () => internalActive.value,
|
|
31
|
-
set: (value) => {
|
|
32
|
-
internalActive.value = value
|
|
33
|
-
emit('update:modelValue', value)
|
|
34
|
-
},
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
const classes = computed(() => ({
|
|
38
|
-
'swap-rotate': props.rotate,
|
|
39
|
-
'swap-flip': props.flip,
|
|
40
|
-
}))
|
|
41
|
-
</script>
|
|
42
|
-
|
|
43
|
-
<template>
|
|
44
|
-
<label v-if="useCheckbox" class="swap" :class="classes">
|
|
45
|
-
<input
|
|
46
|
-
type="checkbox"
|
|
47
|
-
v-model="isActive"
|
|
48
|
-
:indeterminate="$slots.indeterminate ? true : false"
|
|
49
|
-
/>
|
|
50
|
-
<div class="swap-on">
|
|
51
|
-
<slot name="on" />
|
|
52
|
-
</div>
|
|
53
|
-
<div class="swap-off">
|
|
54
|
-
<slot name="off" />
|
|
55
|
-
</div>
|
|
56
|
-
<div v-if="$slots.indeterminate" class="swap-indeterminate">
|
|
57
|
-
<slot name="indeterminate" />
|
|
58
|
-
</div>
|
|
59
|
-
</label>
|
|
60
|
-
<div v-else class="swap" :class="[classes, { 'swap-active': isActive }]" @click="isActive = !isActive">
|
|
61
|
-
<div class="swap-on">
|
|
62
|
-
<slot name="on" />
|
|
63
|
-
</div>
|
|
64
|
-
<div class="swap-off">
|
|
65
|
-
<slot name="off" />
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
</template>
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { inject } from 'vue'
|
|
3
|
-
|
|
4
|
-
withDefaults(
|
|
5
|
-
defineProps<{
|
|
6
|
-
checked?: boolean
|
|
7
|
-
customClass?: string
|
|
8
|
-
title?: string
|
|
9
|
-
}>(),
|
|
10
|
-
{
|
|
11
|
-
checked: false,
|
|
12
|
-
customClass: '',
|
|
13
|
-
title: '',
|
|
14
|
-
},
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
// Get the accordion name from parent
|
|
18
|
-
const accordionName = inject('accordionName', '')
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<template>
|
|
22
|
-
<div :class="['collapse', 'bg-base-100 border border-base-300', customClass]">
|
|
23
|
-
<input
|
|
24
|
-
type="radio"
|
|
25
|
-
:name="accordionName"
|
|
26
|
-
:checked="checked ? true : undefined"
|
|
27
|
-
/>
|
|
28
|
-
<div class="collapse-title">
|
|
29
|
-
<slot name="title">
|
|
30
|
-
{{ title }}
|
|
31
|
-
</slot>
|
|
32
|
-
</div>
|
|
33
|
-
<div class="collapse-content">
|
|
34
|
-
<slot></slot>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
</template>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const ACCORDION_MODIFIERS = [
|
|
2
|
-
'collapse-arrow',
|
|
3
|
-
'collapse-plus',
|
|
4
|
-
'collapse-open',
|
|
5
|
-
'collapse-close',
|
|
6
|
-
] as const
|
|
7
|
-
|
|
8
|
-
export interface ACCORDIONItem {
|
|
9
|
-
title?: string
|
|
10
|
-
content?: string
|
|
11
|
-
checked?: boolean
|
|
12
|
-
customClass?: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type ACCORDIONModifier = (typeof ACCORDION_MODIFIERS)[number]
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, provide } from 'vue'
|
|
3
|
-
import { type ACCORDIONItem } from './du-accordion.types'
|
|
4
|
-
|
|
5
|
-
const props = withDefaults(
|
|
6
|
-
defineProps<{
|
|
7
|
-
items?: ACCORDIONItem[]
|
|
8
|
-
name?: string
|
|
9
|
-
modifier?:
|
|
10
|
-
| 'collapse-arrow'
|
|
11
|
-
| 'collapse-plus'
|
|
12
|
-
| 'collapse-open'
|
|
13
|
-
| 'collapse-close'
|
|
14
|
-
customClass?: string
|
|
15
|
-
}>(),
|
|
16
|
-
{
|
|
17
|
-
items: undefined,
|
|
18
|
-
name: 'accordion',
|
|
19
|
-
modifier: undefined,
|
|
20
|
-
customClass: '',
|
|
21
|
-
},
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
const accordionName = computed(() => {
|
|
25
|
-
return (
|
|
26
|
-
props.name || `accordion-${Math.random().toString(36).substring(2, 9)}`
|
|
27
|
-
)
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
// Provide the accordion name to child components
|
|
31
|
-
provide('accordionName', accordionName.value)
|
|
32
|
-
</script>
|
|
33
|
-
|
|
34
|
-
<template>
|
|
35
|
-
<!-- Dynamic items mode -->
|
|
36
|
-
<template v-if="items">
|
|
37
|
-
<div
|
|
38
|
-
v-for="(item, index) in items"
|
|
39
|
-
:key="index"
|
|
40
|
-
:class="[
|
|
41
|
-
'collapse',
|
|
42
|
-
'bg-base-100 border border-base-300',
|
|
43
|
-
modifier,
|
|
44
|
-
item.customClass || customClass,
|
|
45
|
-
]"
|
|
46
|
-
>
|
|
47
|
-
<input
|
|
48
|
-
type="radio"
|
|
49
|
-
:name="accordionName"
|
|
50
|
-
:checked="item.checked ? true : undefined"
|
|
51
|
-
/>
|
|
52
|
-
<div class="collapse-title">
|
|
53
|
-
<slot name="title" :item="item" :index="index">
|
|
54
|
-
<slot :name="`title-${index}`" :item="item" :index="index">
|
|
55
|
-
{{ item.title }}
|
|
56
|
-
</slot>
|
|
57
|
-
</slot>
|
|
58
|
-
</div>
|
|
59
|
-
<div class="collapse-content">
|
|
60
|
-
<slot name="content" :item="item" :index="index">
|
|
61
|
-
<slot :name="`content-${index}`" :item="item" :index="index">
|
|
62
|
-
{{ item.content }}
|
|
63
|
-
</slot>
|
|
64
|
-
</slot>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
</template>
|
|
68
|
-
|
|
69
|
-
<!-- Manual mode -->
|
|
70
|
-
<template v-else>
|
|
71
|
-
<slot></slot>
|
|
72
|
-
</template>
|
|
73
|
-
</template>
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
export const AVATAR_SIZES = ['avatar-xs', 'avatar-sm', 'avatar-md', 'avatar-lg', 'avatar-xl'] as const
|
|
2
|
-
export const AVATAR_ROUNDED = [
|
|
3
|
-
'rounded',
|
|
4
|
-
'rounded-full',
|
|
5
|
-
'rounded-xs',
|
|
6
|
-
'rounded-sm',
|
|
7
|
-
'rounded-md',
|
|
8
|
-
'rounded-lg',
|
|
9
|
-
'rounded-xl',
|
|
10
|
-
] as const
|
|
11
|
-
|
|
12
|
-
export const AVATAR_RING_COLORS = [
|
|
13
|
-
'ring-primary',
|
|
14
|
-
'ring-secondary',
|
|
15
|
-
'ring-accent',
|
|
16
|
-
'ring-neutral',
|
|
17
|
-
'ring-info',
|
|
18
|
-
'ring-success',
|
|
19
|
-
'ring-warning',
|
|
20
|
-
'ring-error',
|
|
21
|
-
] as const
|
|
22
|
-
|
|
23
|
-
export const AVATAR_COLORS = [
|
|
24
|
-
'avatar-primary',
|
|
25
|
-
'avatar-secondary',
|
|
26
|
-
'avatar-accent',
|
|
27
|
-
'avatar-neutral',
|
|
28
|
-
'avatar-info',
|
|
29
|
-
'avatar-success',
|
|
30
|
-
'avatar-warning',
|
|
31
|
-
'avatar-error',
|
|
32
|
-
]
|
|
33
|
-
|
|
34
|
-
export type Rounded = 'default' | 'rounded' | 'full' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
35
|
-
export type Mask = 'default' | 'heart' | 'squircle' | 'hexagon' | 'hexagon-2' | 'decagon' | 'pentagon' | 'diamond' | 'square' | 'circle' | 'parallelogram' | 'parallelogram-2' | 'star' | 'star-2'
|
|
36
|
-
|
|
37
|
-
export type AVATARSize = (typeof AVATAR_SIZES)[number]
|
|
38
|
-
export type AVATARRounded = (typeof AVATAR_ROUNDED)[number]
|
|
39
|
-
export type AVATARRingColor = (typeof AVATAR_RING_COLORS)[number]
|
|
40
|
-
export type AVATARColor = (typeof AVATAR_COLORS)[number]
|
|
41
|
-
|
|
42
|
-
// Types pour les masques
|
|
43
|
-
export const AVATAR_MASK = [
|
|
44
|
-
'mask-heart',
|
|
45
|
-
'mask-squircle',
|
|
46
|
-
'mask-hexagon',
|
|
47
|
-
'mask-hexagon-2',
|
|
48
|
-
'mask-decagon',
|
|
49
|
-
'mask-pentagon',
|
|
50
|
-
'mask-diamond',
|
|
51
|
-
'mask-square',
|
|
52
|
-
'mask-circle',
|
|
53
|
-
'mask-parallelogram',
|
|
54
|
-
'mask-parallelogram-2',
|
|
55
|
-
'mask-star',
|
|
56
|
-
'mask-star-2',
|
|
57
|
-
] as const
|
|
58
|
-
|
|
59
|
-
export type AVATARMask = (typeof AVATAR_MASK)[number]
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { type Size, useSizeMapping} from '../../../composables/useSizeProps'
|
|
3
|
-
import { useVariantMapping, type Variant } from '../../../composables/useVariantProps'
|
|
4
|
-
import { computed } from 'vue'
|
|
5
|
-
import { type AVATARRounded, type Rounded, type AVATARMask, type Mask } from './du-avatar.types'
|
|
6
|
-
|
|
7
|
-
const props = withDefaults(
|
|
8
|
-
defineProps<{
|
|
9
|
-
size?: Size
|
|
10
|
-
variant?: Variant
|
|
11
|
-
rounded?: Rounded
|
|
12
|
-
offline?: boolean
|
|
13
|
-
online?: boolean
|
|
14
|
-
placeholder?: boolean
|
|
15
|
-
ring?: boolean
|
|
16
|
-
ringColor?: string
|
|
17
|
-
ringOffset?: number
|
|
18
|
-
mask?: Mask
|
|
19
|
-
}>(),
|
|
20
|
-
{
|
|
21
|
-
size: 'default',
|
|
22
|
-
variant: 'default',
|
|
23
|
-
rounded: 'default',
|
|
24
|
-
offline: false,
|
|
25
|
-
online: false,
|
|
26
|
-
placeholder: false,
|
|
27
|
-
ring: false,
|
|
28
|
-
ringColor: 'primary',
|
|
29
|
-
ringOffset: 2
|
|
30
|
-
},
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
const { sizeClass } = useSizeMapping(props, 'avatar')
|
|
34
|
-
const { colorClass } = useVariantMapping(props, 'avatar')
|
|
35
|
-
|
|
36
|
-
const roundedClass = computed(() => {
|
|
37
|
-
return {
|
|
38
|
-
default: '',
|
|
39
|
-
rounded: 'rounded',
|
|
40
|
-
full: 'rounded-full',
|
|
41
|
-
xs: 'rounded-xs',
|
|
42
|
-
sm: 'rounded-sm',
|
|
43
|
-
md: 'rounded-md',
|
|
44
|
-
lg: 'rounded-lg',
|
|
45
|
-
xl: 'rounded-xl',
|
|
46
|
-
}[props.rounded] as AVATARRounded
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
const maskClass = computed(() => {
|
|
50
|
-
if (!props.mask) return ''
|
|
51
|
-
return 'mask ' + `mask-${props.mask}` as AVATARMask
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
const ringClass = computed(() => {
|
|
55
|
-
if (!props.ring) return ''
|
|
56
|
-
return `ring-${props.ringOffset} ring-${props.ringColor} ring-offset-base-100 ring-offset-2 ring-2`
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
const statusClass = computed(() => {
|
|
60
|
-
if (props.online) return 'avatar-online'
|
|
61
|
-
if (props.offline) return 'avatar-offline'
|
|
62
|
-
return ''
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
const placeholderClass = computed(() => {
|
|
66
|
-
return props.placeholder ? 'avatar-placeholder' : ''
|
|
67
|
-
})
|
|
68
|
-
</script>
|
|
69
|
-
|
|
70
|
-
<template>
|
|
71
|
-
<div :class="['avatar', statusClass, placeholderClass]">
|
|
72
|
-
<div :class="['bg-base-300', sizeClass, roundedClass, maskClass, ringClass, colorClass]">
|
|
73
|
-
<slot />
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
</template>
|
|
77
|
-
|
|
78
|
-
<style scoped>
|
|
79
|
-
|
|
80
|
-
.avatar-xs {
|
|
81
|
-
width: calc(var(--spacing)*8);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.avatar-sm {
|
|
85
|
-
width: calc(var(--spacing)*12);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.avatar-md {
|
|
89
|
-
width: calc(var(--spacing)*16);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.avatar-lg {
|
|
93
|
-
width: calc(var(--spacing)*24);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.avatar-xl {
|
|
97
|
-
width: calc(var(--spacing)*28);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.avatar-primary {
|
|
101
|
-
background-color: var(--color-primary);
|
|
102
|
-
color: var(--color-primary-content);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.avatar-secondary {
|
|
106
|
-
background-color: var(--color-secondary);
|
|
107
|
-
color: var(--color-secondary-content);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.avatar-accent {
|
|
111
|
-
background-color: var(--color-accent);
|
|
112
|
-
color: var(--color-accent-content);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.avatar-neutral {
|
|
116
|
-
background-color: var(--color-neutral);
|
|
117
|
-
color: var(--color-neutral-content);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.avatar-info {
|
|
121
|
-
background-color: var(--color-info);
|
|
122
|
-
color: var(--color-info-content);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.avatar-success {
|
|
126
|
-
background-color: var(--color-success);
|
|
127
|
-
color: var(--color-success-content);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.avatar-warning {
|
|
131
|
-
background-color: var(--color-warning);
|
|
132
|
-
color: var(--color-warning-content);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.avatar-error {
|
|
136
|
-
background-color: var(--color-error);
|
|
137
|
-
color: var(--color-error-content);
|
|
138
|
-
}
|
|
139
|
-
</style>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export const BADGE_SIZES = [
|
|
2
|
-
'badge-xs',
|
|
3
|
-
'badge-sm',
|
|
4
|
-
'badge-md',
|
|
5
|
-
'badge-lg',
|
|
6
|
-
'badge-xl',
|
|
7
|
-
] as const
|
|
8
|
-
|
|
9
|
-
export const BADGE_VARIANTS = [
|
|
10
|
-
'badge-primary',
|
|
11
|
-
'badge-secondary',
|
|
12
|
-
'badge-accent',
|
|
13
|
-
'badge-neutral',
|
|
14
|
-
'badge-info',
|
|
15
|
-
'badge-success',
|
|
16
|
-
'badge-warning',
|
|
17
|
-
'badge-error',
|
|
18
|
-
] as const
|
|
19
|
-
|
|
20
|
-
export type BADGESize = (typeof BADGE_SIZES)[number]
|
|
21
|
-
export type BADGEVariant = (typeof BADGE_VARIANTS)[number]
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue'
|
|
3
|
-
import { type Variant, useVariantMapping } from '../../../composables/useVariantProps'
|
|
4
|
-
import { type Size, useSizeMapping } from '../../../composables/useSizeProps'
|
|
5
|
-
|
|
6
|
-
// Définition des types pour les props
|
|
7
|
-
const props = withDefaults(
|
|
8
|
-
defineProps<{
|
|
9
|
-
size?: Size
|
|
10
|
-
variant?: Variant
|
|
11
|
-
outline?: boolean
|
|
12
|
-
dash?: boolean
|
|
13
|
-
soft?: boolean
|
|
14
|
-
ghost?: boolean
|
|
15
|
-
icon?: boolean
|
|
16
|
-
}>(),
|
|
17
|
-
{
|
|
18
|
-
size: 'default',
|
|
19
|
-
variant: 'default',
|
|
20
|
-
outline: false,
|
|
21
|
-
dash: false,
|
|
22
|
-
soft: false,
|
|
23
|
-
ghost: false,
|
|
24
|
-
icon: false,
|
|
25
|
-
},
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
const { sizeClass } = useSizeMapping(props, 'badge')
|
|
29
|
-
const { colorClass } = useVariantMapping(props, 'badge')
|
|
30
|
-
const softClass = computed(() => {
|
|
31
|
-
return props.soft ? 'badge-soft' : ''
|
|
32
|
-
})
|
|
33
|
-
const outlineClass = computed(() => {
|
|
34
|
-
return props.outline ? 'badge-outline' : ''
|
|
35
|
-
})
|
|
36
|
-
const dashClass = computed(() => {
|
|
37
|
-
return props.dash ? 'badge-dash' : ''
|
|
38
|
-
})
|
|
39
|
-
const ghostClass = computed(() => {
|
|
40
|
-
return props.ghost ? 'badge-ghost' : ''
|
|
41
|
-
})
|
|
42
|
-
// SVG en fonction du type d'alerte
|
|
43
|
-
const svgIcons = {
|
|
44
|
-
default: '',
|
|
45
|
-
success: `<svg class="size-[1em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g fill="currentColor" stroke-linejoin="miter" stroke-linecap="butt"><circle cx="12" cy="12" r="10" fill="none" stroke="currentColor" stroke-linecap="square" stroke-miterlimit="10" stroke-width="2"></circle><polyline points="7 13 10 16 17 8" fill="none" stroke="currentColor" stroke-linecap="square" stroke-miterlimit="10" stroke-width="2"></polyline></g></svg>`,
|
|
46
|
-
error: `<svg class="size-[1em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18"><g fill="currentColor"><path d="M7.638,3.495L2.213,12.891c-.605,1.048,.151,2.359,1.362,2.359H14.425c1.211,0,1.967-1.31,1.362-2.359L10.362,3.495c-.605-1.048-2.119-1.048-2.724,0Z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><line x1="9" y1="6.5" x2="9" y2="10" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></line></g></svg>`,
|
|
47
|
-
warning: `<svg class="size-[1em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g fill="currentColor"><rect x="1.972" y="11" width="20.056" height="2" transform="translate(-4.971 12) rotate(-45)" fill="currentColor" stroke-width="0"></rect><path d="m12,23c-6.065,0-11-4.935-11-11S5.935,1,12,1s11,4.935,11,11-4.935,11-11,11Zm0-20C7.038,3,3,7.037,3,12s4.038,9,9,9,9-4.037,9-9S16.962,3,12,3Z" stroke-width="0" fill="currentColor"></path></g></svg>`,
|
|
48
|
-
info: `<svg class="size-[1em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g fill="currentColor" stroke-linejoin="miter" stroke-linecap="butt"><circle cx="12" cy="12" r="10" fill="none" stroke="currentColor" stroke-linecap="square" stroke-miterlimit="10" stroke-width="2"></circle><path d="m12,17v-5.5c0-.276-.224-.5-.5-.5h-1.5" fill="none" stroke="currentColor" stroke-linecap="square" stroke-miterlimit="10" stroke-width="2"></path><circle cx="12" cy="7.25" r="1.25" fill="currentColor" stroke-width="2"></circle></g></svg>`,
|
|
49
|
-
}
|
|
50
|
-
const svgIcon = computed(() => {
|
|
51
|
-
if (props.icon) {
|
|
52
|
-
if (
|
|
53
|
-
props.variant === 'default' ||
|
|
54
|
-
props.variant === 'success' ||
|
|
55
|
-
props.variant === 'error' ||
|
|
56
|
-
props.variant === 'warning' ||
|
|
57
|
-
props.variant === 'info'
|
|
58
|
-
) {
|
|
59
|
-
return svgIcons[props.variant]
|
|
60
|
-
}
|
|
61
|
-
return ''
|
|
62
|
-
}
|
|
63
|
-
return ''
|
|
64
|
-
})
|
|
65
|
-
</script>
|
|
66
|
-
<template>
|
|
67
|
-
<div
|
|
68
|
-
:class="[
|
|
69
|
-
'badge',
|
|
70
|
-
sizeClass,
|
|
71
|
-
colorClass,
|
|
72
|
-
softClass,
|
|
73
|
-
outlineClass,
|
|
74
|
-
dashClass,
|
|
75
|
-
ghostClass,
|
|
76
|
-
]"
|
|
77
|
-
>
|
|
78
|
-
<template v-if="svgIcon"><span v-html="svgIcon"></span></template>
|
|
79
|
-
<slot></slot>
|
|
80
|
-
</div>
|
|
81
|
-
</template>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export const CARD_SIZES = [
|
|
2
|
-
'card-xs',
|
|
3
|
-
'card-sm',
|
|
4
|
-
'card-md',
|
|
5
|
-
'card-lg',
|
|
6
|
-
'card-xl',
|
|
7
|
-
] as const
|
|
8
|
-
|
|
9
|
-
export const CARD_PROPERTIES = [
|
|
10
|
-
'card-border',
|
|
11
|
-
'card-dash',
|
|
12
|
-
'card-side',
|
|
13
|
-
'lg:card-side',
|
|
14
|
-
'image-full',
|
|
15
|
-
] as const
|
|
16
|
-
|
|
17
|
-
export type CARDSize = (typeof CARD_SIZES)[number]
|
|
18
|
-
export type CARDProperty = (typeof CARD_PROPERTIES)[number]
|