@coffic/cosy-ui 0.6.24 → 0.6.28

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.
Files changed (124) hide show
  1. package/README.md +5 -1
  2. package/dist/{components/base → alert}/Alert.astro +2 -2
  3. package/dist/alert/AlertBasic.astro +5 -0
  4. package/dist/alert/AlertCustomStyle.astro +7 -0
  5. package/dist/alert/AlertTypes.astro +13 -0
  6. package/dist/alert/AlertWithTitle.astro +5 -0
  7. package/dist/alert/index.ts +20 -0
  8. package/dist/app.css +1 -1
  9. package/dist/{components/typography → article}/Article.astro +2 -2
  10. package/dist/article/ArticleBasic.astro +31 -0
  11. package/dist/article/index.ts +11 -0
  12. package/dist/{components/base → button}/Button.astro +1 -2
  13. package/dist/button/ButtonBasic.astro +18 -0
  14. package/dist/button/ButtonShapes.astro +23 -0
  15. package/dist/button/ButtonSizes.astro +15 -0
  16. package/dist/button/ButtonStates.astro +12 -0
  17. package/dist/button/ButtonWithIcons.astro +25 -0
  18. package/dist/button/index.ts +23 -0
  19. package/dist/components/containers/Main.astro +1 -2
  20. package/dist/components/data-display/ProductCard.astro +2 -1
  21. package/dist/components/data-display/TeamMember.astro +2 -1
  22. package/dist/components/data-display/TeamMembers.astro +2 -1
  23. package/dist/components/display/Hero.astro +1 -1
  24. package/dist/components/display/Modal.astro +1 -1
  25. package/dist/{components/errors → errors}/404.astro +1 -1
  26. package/dist/errors/404Basic.astro +5 -0
  27. package/dist/errors/index.ts +11 -0
  28. package/dist/flex/FlexBasic.astro +9 -0
  29. package/dist/flex/index.ts +11 -0
  30. package/dist/{components/layouts → footer}/Footer.astro +8 -8
  31. package/dist/footer/FooterBasic.astro +12 -0
  32. package/dist/footer/FooterSection.astro +46 -0
  33. package/dist/footer/index.ts +11 -0
  34. package/dist/{components/layouts → grid}/Grid.astro +1 -1
  35. package/dist/grid/GridBasic.astro +9 -0
  36. package/dist/grid/index.ts +11 -0
  37. package/dist/{components/layouts → header}/Header.astro +14 -51
  38. package/dist/header/HeaderBasic.astro +14 -0
  39. package/dist/header/HeaderCustomNavbarEnd.astro +20 -0
  40. package/dist/header/HeaderCustomPosition.astro +23 -0
  41. package/dist/header/HeaderWithNavigation.astro +22 -0
  42. package/dist/header/index.ts +20 -0
  43. package/dist/{components/typography → heading}/Heading.astro +2 -2
  44. package/dist/heading/HeadingBasic.astro +10 -0
  45. package/dist/heading/index.ts +11 -0
  46. package/dist/{components/base → image}/Image.astro +9 -7
  47. package/dist/image/ImageBasic.astro +1 -0
  48. package/dist/image/ImageEffects.astro +32 -0
  49. package/dist/image/ImageLoading.astro +35 -0
  50. package/dist/image/index.ts +17 -0
  51. package/dist/index.ts +2 -95
  52. package/dist/index_astro.ts +78 -0
  53. package/dist/index_utils.ts +8 -0
  54. package/dist/{components/navigation → language-switcher}/LanguageSwitcher.astro +3 -3
  55. package/dist/language-switcher/LanguageSwitcherBasic.astro +7 -0
  56. package/dist/language-switcher/index.ts +11 -0
  57. package/dist/{components/layouts → layout-app}/AppLayout.astro +10 -4
  58. package/dist/layout-app/AppLayoutBasic.astro +53 -0
  59. package/dist/layout-app/index.ts +11 -0
  60. package/dist/{components/layouts → layout-basic}/BaseLayout.astro +2 -2
  61. package/dist/layout-basic/BaseLayoutBasic.astro +16 -0
  62. package/dist/layout-basic/index.ts +11 -0
  63. package/dist/{components/layouts → layout-dashboard}/DashboardLayout.astro +2 -2
  64. package/dist/layout-dashboard/DashboardLayoutBasic.astro +48 -0
  65. package/dist/layout-dashboard/index.ts +11 -0
  66. package/dist/{components/base → link}/Link.astro +1 -1
  67. package/dist/link/LinkAnimations.astro +21 -0
  68. package/dist/link/LinkBasic.astro +17 -0
  69. package/dist/link/LinkVariants.astro +20 -0
  70. package/dist/link/index.ts +17 -0
  71. package/dist/module/Module.astro +61 -0
  72. package/dist/module/ModuleBasic.astro +12 -0
  73. package/dist/module/ModuleCustom.astro +14 -0
  74. package/dist/module/ModuleGrid.astro +26 -0
  75. package/dist/module/index.ts +17 -0
  76. package/dist/{components/layouts → nav-item}/NavItems.astro +2 -3
  77. package/dist/nav-item/NavItemsBasic.astro +27 -0
  78. package/dist/nav-item/index.ts +11 -0
  79. package/dist/nav-section/NavSection.astro +42 -0
  80. package/dist/nav-section/NavSectionBasic.astro +12 -0
  81. package/dist/nav-section/index.ts +11 -0
  82. package/dist/{components/layouts → sidebar}/Sidebar.astro +5 -6
  83. package/dist/sidebar/SidebarBasic.astro +1 -0
  84. package/dist/sidebar/index.ts +11 -0
  85. package/dist/{components/layouts → sidebar-nav}/SidebarNav.astro +3 -3
  86. package/dist/sidebar-nav/SidebarNavBasic.astro +32 -0
  87. package/dist/sidebar-nav/index.ts +11 -0
  88. package/dist/speak/Speak.astro +65 -0
  89. package/dist/speak/SpeakBasic.astro +13 -0
  90. package/dist/speak/SpeakGrid.astro +29 -0
  91. package/dist/speak/index.ts +14 -0
  92. package/dist/{components/layouts → stack}/Stack.astro +1 -1
  93. package/dist/stack/StackBasic.astro +15 -0
  94. package/dist/stack/index.ts +11 -0
  95. package/dist/{components/typography → text}/Text.astro +1 -1
  96. package/dist/text/TextBasic.astro +12 -0
  97. package/dist/text/TextSizes.astro +11 -0
  98. package/dist/text/index.ts +11 -0
  99. package/dist/theme-item/ThemeItem.astro +45 -0
  100. package/dist/theme-item/ThemeItemBasic.astro +10 -0
  101. package/dist/theme-item/index.ts +11 -0
  102. package/dist/{components/navigation → theme-switcher}/ThemeSwitcher.astro +4 -4
  103. package/dist/theme-switcher/ThemeSwitcherBasic.astro +7 -0
  104. package/dist/theme-switcher/index.ts +11 -0
  105. package/dist/{components/navigation → toc}/TableOfContents.astro +3 -3
  106. package/dist/toc/TableOfContentsBasic.astro +25 -0
  107. package/dist/toc/index.ts +11 -0
  108. package/dist/types/image.ts +16 -0
  109. package/dist/types/menu.ts +24 -0
  110. package/dist/utils/component.ts +39 -0
  111. package/dist/vue/AlertDialog/index.ts +3 -41
  112. package/dist/vue/BannerBox/index.ts +9 -44
  113. package/dist/vue/BlogList/index.ts +5 -27
  114. package/dist/vue/Buttons/index.ts +5 -27
  115. package/dist/vue/ConfirmDialog/index.ts +3 -41
  116. package/dist/vue/MacWindow/index.ts +7 -21
  117. package/dist/vue/SmartHero/index.ts +4 -26
  118. package/dist/vue/iPhone/index.ts +5 -18
  119. package/package.json +7 -7
  120. package/dist/components/base/Module.astro +0 -18
  121. package/dist/components/base/Speak.astro +0 -22
  122. package/dist/components/base/ThemeItem.astro +0 -21
  123. package/dist/components/layouts/NavSection.astro +0 -32
  124. /package/dist/{components/layouts → flex}/Flex.astro +0 -0
@@ -0,0 +1,20 @@
1
+ ---
2
+ import Link from './Link.astro';
3
+ ---
4
+
5
+ <div class="cosy:space-y-4">
6
+ <div class="cosy:flex cosy:gap-4">
7
+ <Link href="/signup" variant="primary">主要链接</Link>
8
+ <Link href="/learn-more" variant="secondary">次要链接</Link>
9
+ <Link href="/docs" variant="text">文本链接</Link>
10
+ <Link href="/get-started" variant="cta">行动号召</Link>
11
+ <Link href="/preview" variant="ghost">幽灵链接</Link>
12
+ <Link href="/help" variant="light">浅色链接</Link>
13
+ </div>
14
+
15
+ <div class="cosy:flex cosy:gap-4">
16
+ <Link href="/small" size="sm">小型链接</Link>
17
+ <Link href="/medium" size="md">中型链接</Link>
18
+ <Link href="/large" size="lg">大型链接</Link>
19
+ </div>
20
+ </div>
@@ -0,0 +1,17 @@
1
+ import Link from './Link.astro';
2
+ import LinkBasic from './LinkBasic.astro';
3
+ import LinkVariants from './LinkVariants.astro';
4
+ import LinkAnimations from './LinkAnimations.astro';
5
+ import BasicSourceCode from './LinkBasic.astro?raw';
6
+ import VariantsSourceCode from './LinkVariants.astro?raw';
7
+ import AnimationsSourceCode from './LinkAnimations.astro?raw';
8
+ import { extractSimpleExample } from '../utils/component';
9
+
10
+ export { Link, LinkBasic, LinkVariants, LinkAnimations };
11
+
12
+ // 导出示例源代码
13
+ export const LinkExampleCodes = {
14
+ Basic: extractSimpleExample(BasicSourceCode, 'Link'),
15
+ Variants: extractSimpleExample(VariantsSourceCode, 'Link'),
16
+ Animations: extractSimpleExample(AnimationsSourceCode, 'Link'),
17
+ };
@@ -0,0 +1,61 @@
1
+ ---
2
+ /**
3
+ * @component Module
4
+ *
5
+ * @description
6
+ * Module 组件用于展示包含图片、标题和描述的内容模块。
7
+ * 适用于特性展示、产品介绍等场景。
8
+ *
9
+ * @usage
10
+ * 基本用法:
11
+ * ```astro
12
+ * <Module
13
+ * title="模块标题"
14
+ * description="模块描述文本"
15
+ * image={moduleImage}
16
+ * />
17
+ * ```
18
+ *
19
+ * 在网格中使用:
20
+ * ```astro
21
+ * <div class="cosy:grid cosy:grid-cols-3 cosy:gap-8">
22
+ * <Module title="特性一" description="描述" image={image1} />
23
+ * <Module title="特性二" description="描述" image={image2} />
24
+ * <Module title="特性三" description="描述" image={image3} />
25
+ * </div>
26
+ * ```
27
+ */
28
+
29
+ import { Image } from 'astro:assets';
30
+ import type { ImageMetadata } from 'astro';
31
+ import '../style.ts';
32
+
33
+ interface Props {
34
+ /**
35
+ * 模块标题
36
+ */
37
+ title: string;
38
+ /**
39
+ * 模块描述
40
+ */
41
+ description: string;
42
+ /**
43
+ * 模块图片
44
+ */
45
+ image: ImageMetadata;
46
+ /**
47
+ * 自定义类名
48
+ */
49
+ class?: string;
50
+ }
51
+
52
+ const { title, description, image, class: className = '' } = Astro.props;
53
+ ---
54
+
55
+ <div class={`cosy:flex cosy:flex-col cosy:items-center cosy:gap-4 ${className}`}>
56
+ <div class="cosy:w-48 cosy:h-48 cosy:relative">
57
+ <Image src={image} alt={title} class="cosy:w-full cosy:h-full cosy:object-contain" />
58
+ </div>
59
+ <h3 class="cosy:text-xl cosy:font-semibold cosy:text-center">{title}</h3>
60
+ <p class="cosy:text-base-content/70 cosy:text-center cosy:max-w-sm">{description}</p>
61
+ </div>
@@ -0,0 +1,12 @@
1
+ ---
2
+ import { Module } from '../index';
3
+ import demoImage from '../assets/logo-rounded.png';
4
+ ---
5
+
6
+ <div class="cosy:grid cosy:grid-cols-1 cosy:gap-8 cosy:max-w-xl">
7
+ <Module
8
+ title="基础模块示例"
9
+ description="这是一个基础的模块示例,展示了标题、描述和图片的基本布局。"
10
+ image={demoImage}
11
+ />
12
+ </div>
@@ -0,0 +1,14 @@
1
+ ---
2
+ import Module from './Module.astro';
3
+ import customImage from '../assets/logo-rounded.png';
4
+ ---
5
+
6
+ <div class="cosy:bg-base-200 cosy:p-8 cosy:rounded-xl">
7
+ <div class="cosy:max-w-2xl cosy:mx-auto">
8
+ <Module
9
+ title="自定义样式模块"
10
+ description="这个模块展示了如何通过容器添加自定义样式,比如背景色、内边距和圆角等。"
11
+ image={customImage}
12
+ />
13
+ </div>
14
+ </div>
@@ -0,0 +1,26 @@
1
+ ---
2
+ import { Module } from '../index';
3
+ import featureImage1 from '../assets/logo-rounded.png';
4
+ import featureImage2 from '../assets/logo-rounded.png';
5
+ import featureImage3 from '../assets/logo-rounded.png';
6
+ ---
7
+
8
+ <div class="cosy:grid cosy:grid-cols-1 md:cosy:grid-cols-2 lg:cosy:grid-cols-3 cosy:gap-8">
9
+ <Module
10
+ title="特性一"
11
+ description="这是第一个特性的详细描述,介绍了该功能的主要优点和使用场景。"
12
+ image={featureImage1}
13
+ />
14
+
15
+ <Module
16
+ title="特性二"
17
+ description="这是第二个特性的详细描述,展示了该功能如何帮助用户解决问题。"
18
+ image={featureImage2}
19
+ />
20
+
21
+ <Module
22
+ title="特性三"
23
+ description="这是第三个特性的详细描述,说明了该功能带来的独特价值。"
24
+ image={featureImage3}
25
+ />
26
+ </div>
@@ -0,0 +1,17 @@
1
+ import Module from './Module.astro';
2
+ import ModuleBasic from './ModuleBasic.astro';
3
+ import ModuleGrid from './ModuleGrid.astro';
4
+ import ModuleCustom from './ModuleCustom.astro';
5
+ import BasicSourceCode from './ModuleBasic.astro?raw';
6
+ import GridSourceCode from './ModuleGrid.astro?raw';
7
+ import CustomSourceCode from './ModuleCustom.astro?raw';
8
+ import { extractSimpleExample } from '../utils/component';
9
+
10
+ export { Module, ModuleBasic, ModuleGrid, ModuleCustom };
11
+
12
+ // 导出示例源代码
13
+ export const ModuleExampleCodes = {
14
+ Basic: extractSimpleExample(BasicSourceCode, 'Module'),
15
+ Grid: extractSimpleExample(GridSourceCode, 'Module'),
16
+ Custom: extractSimpleExample(CustomSourceCode, 'Module'),
17
+ };
@@ -14,9 +14,8 @@
14
14
  * />
15
15
  * ```
16
16
  */
17
- import '../../style.ts';
18
- import Link from '../base/Link.astro';
19
- import type { INavItem } from '../../index';
17
+ import '../style.ts';
18
+ import { type INavItem, Link } from '../index';
20
19
 
21
20
  interface Props {
22
21
  navItems: INavItem[];
@@ -0,0 +1,27 @@
1
+ ---
2
+ import NavItems from './NavItems.astro';
3
+
4
+ const navItems = [
5
+ {
6
+ label: '首页',
7
+ href: '/',
8
+ },
9
+ {
10
+ label: '文档',
11
+ href: '/docs',
12
+ },
13
+ {
14
+ label: '组件',
15
+ href: '/components',
16
+ },
17
+ {
18
+ label: '博客',
19
+ href: '/blog',
20
+ },
21
+ ];
22
+ ---
23
+
24
+ <div class="cosy:bg-base-100 cosy:p-4">
25
+ <NavItems navItems={navItems} activeLink="/docs" linkHeightClass="cosy:h-10" />
26
+ </div>
27
+
@@ -0,0 +1,11 @@
1
+ import NavItems from './NavItems.astro';
2
+ import NavItemsBasic from './NavItemsBasic.astro';
3
+ import BasicSourceCode from './NavItemsBasic.astro?raw';
4
+ import { extractSimpleExample } from '../utils/component';
5
+
6
+ export { NavItems, NavItemsBasic };
7
+
8
+ // 导出示例源代码
9
+ export const NavItemsExampleCodes = {
10
+ Basic: extractSimpleExample(BasicSourceCode, 'NavItems'),
11
+ };
@@ -0,0 +1,42 @@
1
+ ---
2
+ /**
3
+ * @component NavSection
4
+ *
5
+ * @description
6
+ * NavSection 组件用于在页脚中创建一个导航部分。
7
+ *
8
+ * @props
9
+ * @prop {string} title - 导航部分的标题
10
+ * @prop {Array<Object>} links - 链接数组,每个对象包含name、href和可选的external属性
11
+ *
12
+ */
13
+
14
+ import { Link } from '../index';
15
+
16
+ interface NavSectionProps {
17
+ title: string;
18
+ links: Array<{ name: string; href: string; external?: boolean }>;
19
+ }
20
+
21
+ const props = Astro.props as NavSectionProps;
22
+ const { title, links } = props;
23
+ ---
24
+
25
+ <nav
26
+ class="cosy:flex cosy:flex-col cosy:items-center cosy:gap-3 cosy:hover:bg-base-300 cosy:hover:shadow-lg cosy:p-4 cosy:rounded cosy:h-full! cosy:hover:scale-105 cosy:transition-transform cosy:duration-300">
27
+ <h6 class="cosy:footer-title">{title}</h6>
28
+ {
29
+ links.map((link) => (
30
+ <Link
31
+ href={link.href}
32
+ external={link.external}
33
+ size="sm"
34
+ block
35
+ animation="hover-lift"
36
+ centerText>
37
+ {link.name}
38
+ </Link>
39
+ ))
40
+ }
41
+ </nav>
42
+
@@ -0,0 +1,12 @@
1
+ ---
2
+ import NavSection from './NavSection.astro';
3
+ ---
4
+
5
+ <NavSection
6
+ title="产品"
7
+ links={[
8
+ { name: '首页', href: '/' },
9
+ { name: '文档', href: '/docs' },
10
+ { name: '组件', href: '/components', external: true },
11
+ ]}
12
+ />
@@ -0,0 +1,11 @@
1
+ import NavSection from './NavSection.astro';
2
+ import NavSectionBasic from './NavSectionBasic.astro';
3
+ import BasicSourceCode from './NavSectionBasic.astro?raw';
4
+ import { extractSimpleExample } from '../utils/component';
5
+
6
+ export { NavSection, NavSectionBasic };
7
+
8
+ // 导出示例源代码
9
+ export const NavSectionExampleCodes = {
10
+ Basic: extractSimpleExample(BasicSourceCode, 'NavSection'),
11
+ };
@@ -21,12 +21,11 @@
21
21
  * ```
22
22
  */
23
23
 
24
- import '../../style.ts';
25
- import { isPathMatch } from '../../utils/path';
26
- import Modal from '../display/Modal.astro';
27
- import SidebarNav from './SidebarNav.astro';
28
- import { MenuIcon } from '../../index';
29
- import type { ISidebarProps } from '../../index';
24
+ import '../style.ts';
25
+ import { isPathMatch } from '../utils/path';
26
+ import Modal from '../components/display/Modal.astro';
27
+ import { MenuIcon, SidebarNav } from '../index';
28
+ import type { ISidebarProps } from '../index';
30
29
 
31
30
  export interface Props extends ISidebarProps {}
32
31
 
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,11 @@
1
+ import Sidebar from './Sidebar.astro';
2
+ import SidebarBasic from './SidebarBasic.astro';
3
+ import BasicSourceCode from './SidebarBasic.astro?raw';
4
+ import { extractSimpleExample } from '../utils/component';
5
+
6
+ export { Sidebar, SidebarBasic };
7
+
8
+ // 导出示例源代码
9
+ export const SidebarExampleCodes = {
10
+ Basic: extractSimpleExample(BasicSourceCode, 'Sidebar'),
11
+ };
@@ -5,9 +5,9 @@
5
5
  * 用于渲染侧边栏的导航内容
6
6
  */
7
7
 
8
- import { isPathMatch } from '../../utils/path';
9
- import '../../style.ts';
10
- import type { ISidebarItem } from '../../types/sidebar';
8
+ import { isPathMatch } from '../utils/path';
9
+ import '../style.ts';
10
+ import type { ISidebarItem } from '../types/sidebar';
11
11
 
12
12
  interface Props {
13
13
  /**
@@ -0,0 +1,32 @@
1
+ ---
2
+ import SidebarNav from './SidebarNav.astro';
3
+ import type { ISidebarItem } from '../types/sidebar';
4
+
5
+ const sidebarItems: ISidebarItem[] = [
6
+ {
7
+ text: '入门指南',
8
+ href: '/docs/getting-started',
9
+ items: [
10
+ { href: '/docs/getting-started/installation', text: '安装' },
11
+ { href: '/docs/getting-started/quick-start', text: '快速开始' },
12
+ ],
13
+ },
14
+ {
15
+ text: '基础组件',
16
+ href: '/docs/components',
17
+ items: [
18
+ { href: '/docs/components/button', text: 'Button 按钮' },
19
+ { href: '/docs/components/alert', text: 'Alert 提示' },
20
+ { href: '/docs/components/card', text: 'Card 卡片' },
21
+ ],
22
+ },
23
+ ];
24
+ ---
25
+
26
+ <div class="cosy:w-64 cosy:bg-base-100">
27
+ <SidebarNav
28
+ sidebarItems={sidebarItems}
29
+ currentPath="/docs/getting-started/installation"
30
+ debug={false}
31
+ />
32
+ </div>
@@ -0,0 +1,11 @@
1
+ import SidebarNav from './SidebarNav.astro';
2
+ import SidebarNavBasic from './SidebarNavBasic.astro';
3
+ import BasicSourceCode from './SidebarNavBasic.astro?raw';
4
+ import { extractSimpleExample } from '../utils/component';
5
+
6
+ export { SidebarNav, SidebarNavBasic };
7
+
8
+ // 导出示例源代码
9
+ export const SidebarNavExampleCodes = {
10
+ Basic: extractSimpleExample(BasicSourceCode, 'SidebarNav'),
11
+ };
@@ -0,0 +1,65 @@
1
+ ---
2
+ /**
3
+ * @component Speak
4
+ *
5
+ * @description
6
+ * Speak 组件用于展示人物语录或评价,包含说话者的头像、姓名、头衔和言论。
7
+ * 适用于用户评价、团队介绍等场景。
8
+ *
9
+ * @usage
10
+ * 基本用法:
11
+ * ```astro
12
+ * <Speak
13
+ * speakerName="张三"
14
+ * speakerTitle="产品经理"
15
+ * image={avatar}
16
+ * words="这是一个非常棒的产品!"
17
+ * />
18
+ * ```
19
+ */
20
+
21
+ import { Image } from 'astro:assets';
22
+ import type { ImageMetadata } from 'astro';
23
+ import '../style.ts';
24
+
25
+ interface Props {
26
+ /**
27
+ * 说话者姓名
28
+ */
29
+ speakerName: string;
30
+ /**
31
+ * 说话者头衔
32
+ */
33
+ speakerTitle: string;
34
+ /**
35
+ * 说话者头像
36
+ */
37
+ image: ImageMetadata;
38
+ /**
39
+ * 说话内容
40
+ */
41
+ words: string;
42
+ /**
43
+ * 自定义类名
44
+ */
45
+ class?: string;
46
+ }
47
+
48
+ const { speakerName, speakerTitle, image, words, class: className = '' } = Astro.props;
49
+ ---
50
+
51
+ <div
52
+ class={`cosy:flex cosy:flex-col cosy:items-center cosy:gap-4 cosy:p-6 cosy:bg-base-100 cosy:rounded-lg cosy:shadow-lg ${className}`}>
53
+ <Image
54
+ src={image}
55
+ alt={speakerName}
56
+ class="cosy:w-32 cosy:h-32 cosy:rounded-full cosy:object-cover"
57
+ width={128}
58
+ height={128}
59
+ />
60
+ <div class="cosy:text-center">
61
+ <h3 class="cosy:text-xl cosy:font-semibold cosy:text-base-content">{speakerName}</h3>
62
+ <p class="cosy:text-base-content/70">{speakerTitle}</p>
63
+ </div>
64
+ <p class="cosy:text-base-content/80 cosy:italic cosy:text-center">{words}</p>
65
+ </div>
@@ -0,0 +1,13 @@
1
+ ---
2
+ import { Speak } from '../index';
3
+ import avatar from '../assets/logo-rounded.png';
4
+ ---
5
+
6
+ <div class="cosy:max-w-md">
7
+ <Speak
8
+ speakerName="张三"
9
+ speakerTitle="产品经理"
10
+ image={avatar}
11
+ words="这个组件库的设计非常优雅,使用起来非常方便,完全满足了我们的需求!"
12
+ />
13
+ </div>
@@ -0,0 +1,29 @@
1
+ ---
2
+ import { Speak } from '../index';
3
+ import avatar1 from '../assets/logo-rounded.png';
4
+ import avatar2 from '../assets/logo-rounded.png';
5
+ import avatar3 from '../assets/logo-rounded.png';
6
+ ---
7
+
8
+ <div class="cosy:grid cosy:grid-cols-1 md:cosy:grid-cols-2 lg:cosy:grid-cols-3 cosy:gap-6">
9
+ <Speak
10
+ speakerName="李四"
11
+ speakerTitle="前端开发"
12
+ image={avatar1}
13
+ words="组件的代码结构非常清晰,文档详尽,对开发者非常友好。"
14
+ />
15
+
16
+ <Speak
17
+ speakerName="王五"
18
+ speakerTitle="UI 设计师"
19
+ image={avatar2}
20
+ words="设计系统的一致性很好,主题切换功能也很实用。"
21
+ />
22
+
23
+ <Speak
24
+ speakerName="赵六"
25
+ speakerTitle="技术总监"
26
+ image={avatar3}
27
+ words="这个组件库的性能和可维护性都很出色,是一个值得信赖的选择。"
28
+ />
29
+ </div>
@@ -0,0 +1,14 @@
1
+ import Speak from './Speak.astro';
2
+ import SpeakBasic from './SpeakBasic.astro';
3
+ import SpeakGrid from './SpeakGrid.astro';
4
+ import BasicSourceCode from './SpeakBasic.astro?raw';
5
+ import GridSourceCode from './SpeakGrid.astro?raw';
6
+ import { extractSimpleExample } from '../utils/component';
7
+
8
+ export { Speak, SpeakBasic, SpeakGrid };
9
+
10
+ // 导出示例源代码
11
+ export const SpeakExampleCodes = {
12
+ Basic: extractSimpleExample(BasicSourceCode, 'Speak'),
13
+ Grid: extractSimpleExample(GridSourceCode, 'Speak'),
14
+ };
@@ -49,7 +49,7 @@
49
49
  */
50
50
 
51
51
  // 导入样式
52
- import '../../style.ts';
52
+ import '../style.ts';
53
53
 
54
54
  // 定义间距类型
55
55
  type GapSize = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
@@ -0,0 +1,15 @@
1
+ ---
2
+ import Stack from './Stack.astro';
3
+ ---
4
+
5
+ <Stack gap="md" align="center">
6
+ <div style="background: #60a5fa; color: white; padding: 16px; border-radius: 8px;">
7
+ 第一个元素
8
+ </div>
9
+ <div style="background: #34d399; color: white; padding: 16px; border-radius: 8px;">
10
+ 第二个元素
11
+ </div>
12
+ <div style="background: #f59e42; color: white; padding: 16px; border-radius: 8px;">
13
+ 第三个元素
14
+ </div>
15
+ </Stack>
@@ -0,0 +1,11 @@
1
+ import Stack from './Stack.astro';
2
+ import StackBasic from './StackBasic.astro';
3
+ import BasicSourceCode from './StackBasic.astro?raw';
4
+ import { extractSimpleExample } from '../utils/component';
5
+
6
+ export { Stack, StackBasic };
7
+
8
+ // 导出示例源代码
9
+ export const StackExampleCodes = {
10
+ Basic: extractSimpleExample(BasicSourceCode, 'Stack'),
11
+ };
@@ -95,7 +95,7 @@
95
95
  * - 确保文本颜色与背景色的对比度符合WCAG标准
96
96
  */
97
97
 
98
- import '../../style.ts';
98
+ import '../style.ts';
99
99
 
100
100
  export interface Props {
101
101
  as?: string;
@@ -0,0 +1,12 @@
1
+ ---
2
+ import Text from './Text.astro';
3
+ ---
4
+
5
+ <Text>这是一段普通文本</Text>
6
+ <Text size="xl" color="primary" weight="bold">超大主色粗体文本</Text>
7
+ <Text size="sm" color="secondary" italic>小号次色斜体文本</Text>
8
+ <Text size="lg" align="center" underline>居中大号带下划线文本</Text>
9
+ <Text size="md" weight="light" color="muted">中号柔和色细体文本</Text>
10
+ <Text truncate style="max-width: 120px; display: block;"
11
+ >这是一段很长的文本,将会被截断并显示省略号...</Text
12
+ >
@@ -0,0 +1,11 @@
1
+ ---
2
+ import Text from './Text.astro';
3
+ ---
4
+
5
+ <div class="cosy:space-y-4">
6
+ <Text size="xs">超小号文本 (xs)</Text>
7
+ <Text size="sm">小号文本 (sm)</Text>
8
+ <Text size="md">中号文本 (md)</Text>
9
+ <Text size="lg">大号文本 (lg)</Text>
10
+ <Text size="xl">超大号文本 (xl)</Text>
11
+ </div>
@@ -0,0 +1,11 @@
1
+ import Text from './Text.astro';
2
+ import TextBasic from './TextBasic.astro';
3
+ import BasicSourceCode from './TextBasic.astro?raw';
4
+ import { extractSimpleExample } from '../utils/component';
5
+
6
+ export { Text, TextBasic };
7
+
8
+ // 导出示例源代码
9
+ export const TextExampleCodes = {
10
+ Basic: extractSimpleExample(BasicSourceCode, 'Text'),
11
+ };
@@ -0,0 +1,45 @@
1
+ ---
2
+ /**
3
+ * @component ThemeItem
4
+ *
5
+ * @description
6
+ * ThemeItem 组件用于主题切换菜单中的单个主题项。
7
+ * 它基于 Button 组件,提供了主题切换的交互功能。
8
+ *
9
+ * @usage
10
+ * 基本用法:
11
+ * ```astro
12
+ * <ThemeItem theme="light" label="浅色主题" />
13
+ * <ThemeItem theme="dark" label="深色主题" />
14
+ * ```
15
+ */
16
+
17
+ import { Button } from '../index';
18
+ import '../style.ts';
19
+
20
+ interface Props {
21
+ /**
22
+ * 主题名称
23
+ */
24
+ theme: string;
25
+ /**
26
+ * 显示的标签文本
27
+ */
28
+ label: string;
29
+ /**
30
+ * 自定义类名
31
+ */
32
+ class?: string;
33
+ }
34
+
35
+ const { theme, label, class: className = '' } = Astro.props;
36
+ ---
37
+
38
+ <Button
39
+ variant="ghost"
40
+ size="sm"
41
+ block
42
+ class={`cosy:text-left cosy:justify-start ${className}`}
43
+ data-set-theme={theme}>
44
+ {label}
45
+ </Button>
@@ -0,0 +1,10 @@
1
+ ---
2
+ import ThemeItem from './ThemeItem.astro';
3
+ ---
4
+
5
+ <div class="cosy:w-48 cosy:space-y-2">
6
+ <ThemeItem theme="light" label="浅色主题" />
7
+ <ThemeItem theme="dark" label="深色主题" />
8
+ <ThemeItem theme="cupcake" label="糖果主题" />
9
+ <ThemeItem theme="dracula" label="德古拉主题" />
10
+ </div>