@coffic/cosy-ui 0.7.2 → 0.7.4
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/alert-dialog-vue/AlertDialog.vue +120 -0
- package/dist/alert-dialog-vue/Basic.vue +38 -0
- package/dist/alert-dialog-vue/Multilang.vue +48 -0
- package/dist/alert-dialog-vue/index.ts +20 -0
- package/dist/app.css +1 -1
- package/dist/banner-box-vue/BannerBox.vue +296 -0
- package/dist/banner-box-vue/DownloadButton.vue +202 -0
- package/dist/banner-box-vue/ExampleBasic.vue +32 -0
- package/dist/banner-box-vue/ExampleCustomBg.vue +32 -0
- package/dist/banner-box-vue/ExampleDisplayModeAlways.vue +34 -0
- package/dist/banner-box-vue/ExampleDisplayModeHover.vue +34 -0
- package/dist/banner-box-vue/ExampleDisplayModeNever.vue +34 -0
- package/dist/banner-box-vue/ExampleImageExport.vue +37 -0
- package/dist/banner-box-vue/ExampleSizePreset.vue +35 -0
- package/dist/banner-box-vue/FeatureCard.vue +190 -0
- package/dist/banner-box-vue/SmartBanner.vue +44 -0
- package/dist/banner-box-vue/bgStyles.ts +55 -0
- package/dist/banner-box-vue/index.ts +48 -0
- package/dist/banner-box-vue/sizePresets.ts +23 -0
- package/dist/blog-vue/Basic.vue +30 -0
- package/dist/blog-vue/BlogList.vue +100 -0
- package/dist/blog-vue/Empty.vue +8 -0
- package/dist/blog-vue/EmptyEnglish.vue +8 -0
- package/dist/blog-vue/English.vue +24 -0
- package/dist/blog-vue/index.ts +29 -0
- package/dist/buttons-vue/Button.vue +105 -0
- package/dist/buttons-vue/ButtonBasic.vue +11 -0
- package/dist/buttons-vue/ButtonFeature.vue +91 -0
- package/dist/buttons-vue/ButtonFeatureBasic.vue +8 -0
- package/dist/buttons-vue/ButtonFeatureWithTips.vue +7 -0
- package/dist/buttons-vue/ButtonLink.vue +13 -0
- package/dist/buttons-vue/ButtonSizes.vue +12 -0
- package/dist/buttons-vue/ButtonWithIcons.vue +21 -0
- package/dist/buttons-vue/index.ts +1 -0
- package/dist/card/Card.astro +59 -10
- package/dist/card/ECardBasic.astro +11 -0
- package/dist/card/ECardBasicContainer.astro +11 -0
- package/dist/card/ECardClickable.astro +13 -0
- package/dist/card/ECardClickableContainer.astro +11 -0
- package/dist/card/ECardCompact.astro +13 -0
- package/dist/card/ECardCompactContainer.astro +11 -0
- package/dist/card/ECardCustomStyle.astro +17 -0
- package/dist/card/ECardCustomStyleContainer.astro +11 -0
- package/dist/card/ECardWithImage.astro +16 -0
- package/dist/card/ECardWithImageContainer.astro +11 -0
- package/dist/card/ECardWithSubtitle.astro +13 -0
- package/dist/card/ECardWithSubtitleContainer.astro +11 -0
- package/dist/card/index.ts +32 -6
- package/dist/confirm-dialog-vue/Basic.vue +57 -0
- package/dist/confirm-dialog-vue/ConfirmDialog.vue +134 -0
- package/dist/confirm-dialog-vue/CustomButtons.vue +69 -0
- package/dist/confirm-dialog-vue/index.ts +20 -0
- package/dist/contact/Contact.astro +279 -0
- package/dist/contact/EContactBasic.astro +15 -0
- package/dist/contact/EContactBasicContainer.astro +12 -0
- package/dist/contact/EContactCompact.astro +12 -0
- package/dist/contact/EContactCompactContainer.astro +12 -0
- package/dist/contact/EContactCustomStyle.astro +22 -0
- package/dist/contact/EContactCustomStyleContainer.astro +12 -0
- package/dist/contact/EContactSocial.astro +21 -0
- package/dist/contact/EContactSocialContainer.astro +12 -0
- package/dist/contact/EContactWithTitle.astro +18 -0
- package/dist/contact/EContactWithTitleContainer.astro +12 -0
- package/dist/contact/index.ts +21 -0
- package/dist/counter-vue/VueCounter.vue +29 -0
- package/dist/counter-vue/index.ts +1 -0
- package/dist/iPhone-vue/Basic.vue +33 -0
- package/dist/iPhone-vue/CustomBackground.vue +33 -0
- package/dist/iPhone-vue/NoFrame.vue +33 -0
- package/dist/iPhone-vue/WeatherApp.vue +97 -0
- package/dist/iPhone-vue/assets/iPhone 14 Pro - Deep Purple - Landscape.png +0 -0
- package/dist/iPhone-vue/assets/iPhone 14 Pro - Deep Purple - Portrait.png +0 -0
- package/dist/iPhone-vue/assets/iPhone 14 Pro - Gold - Landscape.png +0 -0
- package/dist/iPhone-vue/assets/iPhone 14 Pro - Gold - Portrait.png +0 -0
- package/dist/iPhone-vue/assets/iPhone 14 Pro - Silver - Landscape.png +0 -0
- package/dist/iPhone-vue/assets/iPhone 14 Pro - Silver - Portrait.png +0 -0
- package/dist/iPhone-vue/assets/iPhone 14 Pro - Space Black - Landscape.png +0 -0
- package/dist/iPhone-vue/assets/iPhone 14 Pro - Space Black - Portrait.png +0 -0
- package/dist/iPhone-vue/iPhoneWindow.vue +193 -0
- package/dist/iPhone-vue/index.ts +28 -0
- package/dist/icons-vue/AlertTriangleIcon.vue +30 -0
- package/dist/icons-vue/CalendarIcon.vue +30 -0
- package/dist/icons-vue/CheckCircleIcon.vue +30 -0
- package/dist/icons-vue/CheckIcon.vue +30 -0
- package/dist/icons-vue/ChevronDownIcon.vue +30 -0
- package/dist/icons-vue/ClipboardIcon.vue +30 -0
- package/dist/icons-vue/CloseIcon.vue +30 -0
- package/dist/icons-vue/InboxArchiveIcon.vue +30 -0
- package/dist/icons-vue/InfoCircleIcon.vue +30 -0
- package/dist/icons-vue/InfoIcon.vue +30 -0
- package/dist/icons-vue/LinkIcon.vue +30 -0
- package/dist/icons-vue/MenuIcon.vue +30 -0
- package/dist/icons-vue/SearchIcon.vue +30 -0
- package/dist/icons-vue/SettingsIcon.vue +30 -0
- package/dist/icons-vue/UserIcon.vue +30 -0
- package/dist/icons-vue/VueIcon.vue +76 -0
- package/dist/icons-vue/XCircleIcon.vue +30 -0
- package/dist/icons-vue/index.ts +1 -0
- package/dist/index_astro.ts +42 -33
- package/dist/index_vue.ts +12 -23
- package/dist/list-vue/ListItem.vue +5 -0
- package/dist/list-vue/index.ts +1 -0
- package/dist/mac-window-vue/Basic.vue +11 -0
- package/dist/mac-window-vue/CustomHeight.vue +13 -0
- package/dist/mac-window-vue/MacWindow.vue +262 -0
- package/dist/mac-window-vue/WithEvents.vue +34 -0
- package/dist/mac-window-vue/WithSidebar.vue +21 -0
- package/dist/mac-window-vue/WithTabs.vue +21 -0
- package/dist/mac-window-vue/WithToolbar.vue +43 -0
- package/dist/mac-window-vue/index.ts +36 -0
- package/package.json +2 -2
- /package/dist/{button → buttons-vue}/ButtonVariants.vue +0 -0
@@ -0,0 +1,105 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
import { computed } from 'vue'
|
3
|
+
|
4
|
+
interface Props {
|
5
|
+
variant?:
|
6
|
+
| 'primary'
|
7
|
+
| 'secondary'
|
8
|
+
| 'accent'
|
9
|
+
| 'info'
|
10
|
+
| 'success'
|
11
|
+
| 'warning'
|
12
|
+
| 'error'
|
13
|
+
| 'ghost'
|
14
|
+
| 'link'
|
15
|
+
| 'outline'
|
16
|
+
| 'neutral'
|
17
|
+
size?: 'lg' | 'md' | 'sm' | 'xs'
|
18
|
+
shape?: 'circle' | 'square'
|
19
|
+
wide?: boolean
|
20
|
+
block?: boolean
|
21
|
+
loading?: boolean
|
22
|
+
disabled?: boolean
|
23
|
+
type?: 'button' | 'submit' | 'reset'
|
24
|
+
href?: string
|
25
|
+
target?: string
|
26
|
+
}
|
27
|
+
|
28
|
+
const props = withDefaults(defineProps<Props>(), {
|
29
|
+
variant: 'primary',
|
30
|
+
size: 'md',
|
31
|
+
wide: false,
|
32
|
+
block: false,
|
33
|
+
loading: false,
|
34
|
+
disabled: false,
|
35
|
+
type: 'button'
|
36
|
+
})
|
37
|
+
|
38
|
+
const buttonClasses = computed(() => {
|
39
|
+
const classes = ['cosy:btn']
|
40
|
+
|
41
|
+
// Variant classes
|
42
|
+
const variantClasses = {
|
43
|
+
primary: 'cosy:btn-primary',
|
44
|
+
secondary: 'cosy:btn-secondary',
|
45
|
+
accent: 'cosy:btn-accent',
|
46
|
+
info: 'cosy:btn-info',
|
47
|
+
success: 'cosy:btn-success',
|
48
|
+
warning: 'cosy:btn-warning',
|
49
|
+
error: 'cosy:btn-error',
|
50
|
+
ghost: 'cosy:btn-ghost',
|
51
|
+
link: 'cosy:btn-link',
|
52
|
+
outline: 'cosy:btn-outline',
|
53
|
+
neutral: 'cosy:btn-neutral',
|
54
|
+
}
|
55
|
+
|
56
|
+
// Size classes
|
57
|
+
const sizeClasses = {
|
58
|
+
lg: 'cosy:btn-lg',
|
59
|
+
md: 'cosy:btn-md',
|
60
|
+
sm: 'cosy:btn-sm',
|
61
|
+
xs: 'cosy:btn-xs',
|
62
|
+
}
|
63
|
+
|
64
|
+
// Shape classes
|
65
|
+
const shapeClasses = {
|
66
|
+
circle: 'cosy:btn-circle',
|
67
|
+
square: 'cosy:btn-square',
|
68
|
+
}
|
69
|
+
|
70
|
+
if (variantClasses[props.variant]) {
|
71
|
+
classes.push(variantClasses[props.variant])
|
72
|
+
}
|
73
|
+
|
74
|
+
if (sizeClasses[props.size]) {
|
75
|
+
classes.push(sizeClasses[props.size])
|
76
|
+
}
|
77
|
+
|
78
|
+
if (props.shape && shapeClasses[props.shape]) {
|
79
|
+
classes.push(shapeClasses[props.shape])
|
80
|
+
}
|
81
|
+
|
82
|
+
if (props.wide) classes.push('cosy:btn-wide')
|
83
|
+
if (props.block) classes.push('cosy:btn-block')
|
84
|
+
if (props.loading) classes.push('cosy:loading')
|
85
|
+
|
86
|
+
return classes
|
87
|
+
})
|
88
|
+
</script>
|
89
|
+
|
90
|
+
<template>
|
91
|
+
<component
|
92
|
+
:is="props.href ? 'a' : 'button'"
|
93
|
+
:class="buttonClasses"
|
94
|
+
:type="props.href ? undefined : props.type"
|
95
|
+
:disabled="props.disabled"
|
96
|
+
:href="props.href"
|
97
|
+
:target="props.target"
|
98
|
+
>
|
99
|
+
<span class="cosy:flex cosy:items-center cosy:gap-2">
|
100
|
+
<slot name="icon-left" />
|
101
|
+
<slot />
|
102
|
+
<slot name="icon-right" />
|
103
|
+
</span>
|
104
|
+
</component>
|
105
|
+
</template>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
import Button from './Button.vue'
|
3
|
+
</script>
|
4
|
+
|
5
|
+
<template>
|
6
|
+
<div class="cosy:flex cosy:gap-2">
|
7
|
+
<Button>默认按钮</Button>
|
8
|
+
<Button variant="primary">主要按钮</Button>
|
9
|
+
<Button variant="secondary">次要按钮</Button>
|
10
|
+
</div>
|
11
|
+
</template>
|
@@ -0,0 +1,91 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
<script setup lang="ts">
|
4
|
+
import { ref } from 'vue'
|
5
|
+
|
6
|
+
const props = defineProps({
|
7
|
+
title: {
|
8
|
+
type: String,
|
9
|
+
required: false,
|
10
|
+
default: 'Feature Button'
|
11
|
+
},
|
12
|
+
size: {
|
13
|
+
type: String,
|
14
|
+
default: 'w-64',
|
15
|
+
validator: (value: string) => ['w-64', 'w-32', 'w-16', 'w-12', 'w-8'].includes(value)
|
16
|
+
},
|
17
|
+
lang: {
|
18
|
+
type: String,
|
19
|
+
default: 'en',
|
20
|
+
validator: (value: string) => ['en', 'zh'].includes(value)
|
21
|
+
},
|
22
|
+
showTips: {
|
23
|
+
type: Boolean,
|
24
|
+
default: false
|
25
|
+
}
|
26
|
+
})
|
27
|
+
|
28
|
+
const isPopupVisible = ref(false)
|
29
|
+
|
30
|
+
const showPopup = () => {
|
31
|
+
if (props.showTips) {
|
32
|
+
isPopupVisible.value = true
|
33
|
+
setTimeout(hidePopup, 2000) // Auto-hide after 2 seconds
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
const hidePopup = () => {
|
38
|
+
isPopupVisible.value = false
|
39
|
+
}
|
40
|
+
</script>
|
41
|
+
<template>
|
42
|
+
<div>
|
43
|
+
<!-- Button with hover effects -->
|
44
|
+
<button :class="[
|
45
|
+
'cosy:bg-cyan-500/20 cosy:text-cyan-500 cosy:border-cyan-500 cosy:border-2 cosy:hover:bg-cyan-500/30 cosy:hover:text-white cosy:hover:border-cyan-500/30 cosy:hover:scale-105 cosy:transition-all cosy:duration-300 cosy:rounded-2xl cosy:text-center cosy:backdrop-blur-lg cosy:text-2xl',
|
46
|
+
props.size
|
47
|
+
]" @click="showPopup">
|
48
|
+
<slot />
|
49
|
+
{{ props.title }}
|
50
|
+
</button>
|
51
|
+
|
52
|
+
<!-- Popup message -->
|
53
|
+
<Transition name="fade">
|
54
|
+
<div v-if="isPopupVisible"
|
55
|
+
class="cosy:fixed cosy:inset-0 cosy:flex cosy:items-center cosy:justify-center cosy:z-50"
|
56
|
+
@click="hidePopup">
|
57
|
+
<div
|
58
|
+
class="cosy:bg-black/80 cosy:backdrop-blur-sm cosy:p-6 cosy:rounded-xl cosy:text-white cosy:animate-popup">
|
59
|
+
{{ lang === 'zh' ? '这是展示图,不支持操作' : 'This is a preview image, no operation is supported' }}
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
</Transition>
|
63
|
+
</div>
|
64
|
+
</template>
|
65
|
+
<style scoped>
|
66
|
+
.fade-enter-active,
|
67
|
+
.fade-leave-active {
|
68
|
+
transition: opacity 0.3s ease;
|
69
|
+
}
|
70
|
+
|
71
|
+
.fade-enter-from,
|
72
|
+
.fade-leave-to {
|
73
|
+
opacity: 0;
|
74
|
+
}
|
75
|
+
|
76
|
+
.animate-popup {
|
77
|
+
animation: popup 0.3s ease-out;
|
78
|
+
}
|
79
|
+
|
80
|
+
@keyframes popup {
|
81
|
+
from {
|
82
|
+
transform: scale(0.95);
|
83
|
+
opacity: 0;
|
84
|
+
}
|
85
|
+
|
86
|
+
to {
|
87
|
+
transform: scale(1);
|
88
|
+
opacity: 1;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
</style>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
import VueButton from './Button.vue'
|
3
|
+
</script>
|
4
|
+
|
5
|
+
<template>
|
6
|
+
<div class="cosy:flex cosy:gap-2">
|
7
|
+
<VueButton href="#" variant="primary">内部链接</VueButton>
|
8
|
+
<VueButton href="https://example.com" target="_blank" variant="primary">
|
9
|
+
外部链接
|
10
|
+
<template #icon-right>↗</template>
|
11
|
+
</VueButton>
|
12
|
+
</div>
|
13
|
+
</template>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
import VueButton from './Button.vue'
|
3
|
+
</script>
|
4
|
+
|
5
|
+
<template>
|
6
|
+
<div class="cosy:flex cosy:items-center cosy:gap-2">
|
7
|
+
<VueButton size="xs">超小按钮</VueButton>
|
8
|
+
<VueButton size="sm">小型按钮</VueButton>
|
9
|
+
<VueButton size="md">中等按钮</VueButton>
|
10
|
+
<VueButton size="lg">大型按钮</VueButton>
|
11
|
+
</div>
|
12
|
+
</template>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
import VueButton from './Button.vue'
|
3
|
+
</script>
|
4
|
+
|
5
|
+
<template>
|
6
|
+
<div class="cosy:flex cosy:gap-2">
|
7
|
+
<VueButton>
|
8
|
+
<template #icon-left>👈</template>
|
9
|
+
左侧图标
|
10
|
+
</VueButton>
|
11
|
+
<VueButton>
|
12
|
+
右侧图标
|
13
|
+
<template #icon-right>👉</template>
|
14
|
+
</VueButton>
|
15
|
+
<VueButton>
|
16
|
+
<template #icon-left>👈</template>
|
17
|
+
两侧图标
|
18
|
+
<template #icon-right>👉</template>
|
19
|
+
</VueButton>
|
20
|
+
</div>
|
21
|
+
</template>
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as Button } from './Button.vue'
|
package/dist/card/Card.astro
CHANGED
@@ -57,7 +57,7 @@
|
|
57
57
|
* ```
|
58
58
|
*
|
59
59
|
* @props
|
60
|
-
* @prop {string}
|
60
|
+
* @prop {string} title - 卡片标题
|
61
61
|
* @prop {string} [subtitle] - 卡片副标题或描述
|
62
62
|
* @prop {string} [imageUrl] - 卡片顶部图片的URL
|
63
63
|
* @prop {string} [href] - 如果提供,卡片将变成可点击的链接
|
@@ -73,19 +73,68 @@ import '../style.ts';
|
|
73
73
|
interface Props {
|
74
74
|
title: string;
|
75
75
|
subtitle?: string;
|
76
|
+
imageUrl?: string;
|
77
|
+
href?: string;
|
78
|
+
compact?: boolean;
|
76
79
|
class?: string;
|
77
80
|
}
|
78
81
|
|
79
|
-
const { title, subtitle, class: className } = Astro.props;
|
82
|
+
const { title, subtitle, imageUrl, href, compact, class: className = '' } = Astro.props;
|
83
|
+
|
84
|
+
// 构建卡片样式类
|
85
|
+
const cardClasses = [
|
86
|
+
'cosy:card',
|
87
|
+
'cosy:w-full',
|
88
|
+
'cosy:bg-base-100',
|
89
|
+
'cosy:shadow-xl',
|
90
|
+
'cosy:hover:shadow-2xl',
|
91
|
+
'cosy:transition-all',
|
92
|
+
'cosy:duration-300',
|
93
|
+
'cosy:ease-in-out',
|
94
|
+
compact ? 'cosy:card-compact' : '',
|
95
|
+
href ? 'cosy:cursor-pointer cosy:hover:scale-105 cosy:transform cosy:no-underline' : '',
|
96
|
+
className,
|
97
|
+
]
|
98
|
+
.filter(Boolean)
|
99
|
+
.join(' ');
|
100
|
+
|
101
|
+
// 内容区域的padding类
|
102
|
+
const contentPadding = compact ? 'cosy:p-4' : 'cosy:p-6';
|
103
|
+
|
104
|
+
// 如果是链接卡片,使用a标签,否则使用article标签
|
105
|
+
const Tag = href ? 'a' : 'article';
|
80
106
|
---
|
81
107
|
|
82
|
-
<
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
108
|
+
<Tag class={cardClasses} href={href} {...href && { target: '_self' }}>
|
109
|
+
{
|
110
|
+
imageUrl && (
|
111
|
+
<figure class="not-prose cosy:m-0 cosy:p-0">
|
112
|
+
<img
|
113
|
+
src={imageUrl}
|
114
|
+
alt={title}
|
115
|
+
class="cosy:w-full cosy:h-48 cosy:object-cover cosy:rounded-t-lg"
|
116
|
+
/>
|
117
|
+
</figure>
|
118
|
+
)
|
119
|
+
}
|
120
|
+
|
121
|
+
<div class={`cosy:card-body ${contentPadding}`}>
|
122
|
+
<h2 class="cosy:card-title cosy:text-xl cosy:font-bold">
|
123
|
+
{title}
|
124
|
+
</h2>
|
125
|
+
|
126
|
+
{
|
127
|
+
subtitle && (
|
128
|
+
<p class="cosy:text-base-content/70 cosy:text-sm cosy:leading-relaxed">{subtitle}</p>
|
129
|
+
)
|
130
|
+
}
|
87
131
|
|
88
|
-
|
89
|
-
|
132
|
+
{
|
133
|
+
Astro.slots.has('default') && (
|
134
|
+
<div class="cosy:mt-4">
|
135
|
+
<slot />
|
136
|
+
</div>
|
137
|
+
)
|
138
|
+
}
|
90
139
|
</div>
|
91
|
-
</
|
140
|
+
</Tag>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import CardBasic from './ECardBasic.astro';
|
4
|
+
import CardBasicSourceCode from './ECardBasic.astro?raw';
|
5
|
+
---
|
6
|
+
|
7
|
+
<CodeContainer codes={[CardBasicSourceCode]}>
|
8
|
+
<div id="tab-1">
|
9
|
+
<CardBasic />
|
10
|
+
</div>
|
11
|
+
</CodeContainer>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* @component Card.Clickable
|
4
|
+
*
|
5
|
+
* @description
|
6
|
+
* 可点击的Card组件示例,展示如何使用href属性创建链接卡片。
|
7
|
+
*/
|
8
|
+
import { Card } from '../index';
|
9
|
+
---
|
10
|
+
|
11
|
+
<Card title="可点击的卡片" subtitle="点击整个卡片区域可以跳转到指定链接" href="#">
|
12
|
+
这是一个可点击的卡片,鼠标悬停时会有缩放效果,点击可以跳转到指定页面。
|
13
|
+
</Card>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import CardClickable from './ECardClickable.astro';
|
4
|
+
import CardClickableSourceCode from './ECardClickable.astro?raw';
|
5
|
+
---
|
6
|
+
|
7
|
+
<CodeContainer codes={[CardClickableSourceCode]}>
|
8
|
+
<div id="tab-1">
|
9
|
+
<CardClickable />
|
10
|
+
</div>
|
11
|
+
</CodeContainer>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import CardCompact from './ECardCompact.astro';
|
4
|
+
import CardCompactSourceCode from './ECardCompact.astro?raw';
|
5
|
+
---
|
6
|
+
|
7
|
+
<CodeContainer codes={[CardCompactSourceCode]}>
|
8
|
+
<div id="tab-1">
|
9
|
+
<CardCompact />
|
10
|
+
</div>
|
11
|
+
</CodeContainer>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* @component Card.CustomStyle
|
4
|
+
*
|
5
|
+
* @description
|
6
|
+
* 展示如何使用class属性自定义Card组件的样式。
|
7
|
+
*/
|
8
|
+
import '../style.ts';
|
9
|
+
import { Card } from '../index';
|
10
|
+
---
|
11
|
+
|
12
|
+
<Card
|
13
|
+
title="自定义样式卡片"
|
14
|
+
subtitle="这个卡片使用了自定义的背景色和边框"
|
15
|
+
class="cosy:bg-gradient-to-r cosy:from-blue-50 cosy:to-indigo-100 cosy:border-2 cosy:border-blue-200">
|
16
|
+
这是一个自定义样式的卡片,展示了如何通过class属性来覆盖默认样式。
|
17
|
+
</Card>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import CardCustomStyle from './ECardCustomStyle.astro';
|
4
|
+
import CardCustomStyleSourceCode from './ECardCustomStyle.astro?raw';
|
5
|
+
---
|
6
|
+
|
7
|
+
<CodeContainer codes={[CardCustomStyleSourceCode]}>
|
8
|
+
<div id="tab-1">
|
9
|
+
<CardCustomStyle />
|
10
|
+
</div>
|
11
|
+
</CodeContainer>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* @component Card.WithImage
|
4
|
+
*
|
5
|
+
* @description
|
6
|
+
* 带图片的Card组件示例,展示如何使用imageUrl属性。
|
7
|
+
*/
|
8
|
+
import { Card } from '../index';
|
9
|
+
---
|
10
|
+
|
11
|
+
<Card
|
12
|
+
title="带图片的卡片"
|
13
|
+
subtitle="这张卡片展示了如何添加顶部图片"
|
14
|
+
imageUrl="https://picsum.photos/400/200?random=1">
|
15
|
+
这是一个带有图片的卡片,图片会自动显示在卡片顶部,并适配卡片宽度。
|
16
|
+
</Card>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import CardWithImage from './ECardWithImage.astro';
|
4
|
+
import CardWithImageSourceCode from './ECardWithImage.astro?raw';
|
5
|
+
---
|
6
|
+
|
7
|
+
<CodeContainer codes={[CardWithImageSourceCode]}>
|
8
|
+
<div id="tab-1">
|
9
|
+
<CardWithImage />
|
10
|
+
</div>
|
11
|
+
</CodeContainer>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import CardWithSubtitle from './ECardWithSubtitle.astro';
|
4
|
+
import CardWithSubtitleSourceCode from './ECardWithSubtitle.astro?raw';
|
5
|
+
---
|
6
|
+
|
7
|
+
<CodeContainer codes={[CardWithSubtitleSourceCode]}>
|
8
|
+
<div id="tab-1">
|
9
|
+
<CardWithSubtitle />
|
10
|
+
</div>
|
11
|
+
</CodeContainer>
|
package/dist/card/index.ts
CHANGED
@@ -1,7 +1,33 @@
|
|
1
|
+
import Card from './Card.astro';
|
2
|
+
import CardCourse from './CardCourse.astro';
|
3
|
+
import CardBasic from './CardBasic.astro';
|
4
|
+
import CardWithImage from './CardWithImage.astro';
|
5
|
+
import CardLink from './CardLink.astro';
|
6
|
+
import CardCompact from './CardCompact.astro';
|
1
7
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
+
// Container components
|
9
|
+
import CardBasicContainer from './ECardBasicContainer.astro';
|
10
|
+
import CardWithSubtitleContainer from './ECardWithSubtitleContainer.astro';
|
11
|
+
import CardWithImageContainer from './ECardWithImageContainer.astro';
|
12
|
+
import CardClickableContainer from './ECardClickableContainer.astro';
|
13
|
+
import CardCompactContainer from './ECardCompactContainer.astro';
|
14
|
+
import CardCustomStyleContainer from './ECardCustomStyleContainer.astro';
|
15
|
+
|
16
|
+
export { Card };
|
17
|
+
export { CardCourse };
|
18
|
+
export { CardBasic };
|
19
|
+
export { CardWithImage };
|
20
|
+
export { CardLink };
|
21
|
+
export { CardCompact };
|
22
|
+
|
23
|
+
export const CardPackage = {
|
24
|
+
Card,
|
25
|
+
CardContainers: {
|
26
|
+
Basic: CardBasicContainer,
|
27
|
+
WithSubtitle: CardWithSubtitleContainer,
|
28
|
+
WithImage: CardWithImageContainer,
|
29
|
+
Clickable: CardClickableContainer,
|
30
|
+
Compact: CardCompactContainer,
|
31
|
+
CustomStyle: CardCustomStyleContainer,
|
32
|
+
},
|
33
|
+
};
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<!--
|
2
|
+
@component ConfirmDialog.Basic
|
3
|
+
|
4
|
+
@description
|
5
|
+
ConfirmDialog 组件的基础示例,展示最基本的确认对话框用法。
|
6
|
+
|
7
|
+
@usage
|
8
|
+
```vue
|
9
|
+
<ConfirmDialogExamples.Basic />
|
10
|
+
```
|
11
|
+
-->
|
12
|
+
|
13
|
+
<script lang="ts">
|
14
|
+
import '../../app.css'
|
15
|
+
import { ref, defineComponent } from 'vue'
|
16
|
+
import ConfirmDialog from './ConfirmDialog.vue'
|
17
|
+
|
18
|
+
export default defineComponent({
|
19
|
+
name: 'ConfirmDialogBasicExample',
|
20
|
+
components: {
|
21
|
+
ConfirmDialog
|
22
|
+
},
|
23
|
+
setup() {
|
24
|
+
const isShow = ref(false)
|
25
|
+
const result = ref('')
|
26
|
+
|
27
|
+
const handleConfirm = () => {
|
28
|
+
result.value = '用户已确认操作'
|
29
|
+
|
30
|
+
// 3秒后清除结果
|
31
|
+
setTimeout(() => {
|
32
|
+
result.value = ''
|
33
|
+
}, 3000)
|
34
|
+
}
|
35
|
+
|
36
|
+
return {
|
37
|
+
isShow,
|
38
|
+
result,
|
39
|
+
handleConfirm
|
40
|
+
}
|
41
|
+
}
|
42
|
+
})
|
43
|
+
</script>
|
44
|
+
|
45
|
+
<template>
|
46
|
+
<div class="cosy:flex cosy:flex-col cosy:gap-4">
|
47
|
+
<button @click="isShow = true" class="cosy:btn cosy:btn-primary">
|
48
|
+
显示确认对话框
|
49
|
+
</button>
|
50
|
+
|
51
|
+
<div v-if="result" class="cosy:alert cosy:alert-success cosy:shadow-lg">
|
52
|
+
<span>{{ result }}</span>
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
<ConfirmDialog v-model="isShow" title="确认操作" message="您确定要执行此操作吗?此操作无法撤销。" @confirm="handleConfirm" />
|
57
|
+
</template>
|