@coffic/cosy-ui 0.8.28 → 0.9.1

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.
@@ -1,87 +1,82 @@
1
1
  import type { INavItem } from './nav';
2
2
 
3
3
  export interface IHeaderProps {
4
- /**
5
- * 侧边栏是否默认展开
6
- * @default false
7
- */
8
- defaultSidebarOpen?: boolean;
4
+ /**
5
+ * 侧边栏是否默认展开
6
+ * @default false
7
+ */
8
+ defaultSidebarOpen?: boolean;
9
9
 
10
- /**
11
- * 导航栏高度
12
- * @default "md"
13
- */
14
- height?: '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
10
+ /**
11
+ * 导航栏高度
12
+ * @default "md"
13
+ */
14
+ height?: '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
15
15
 
16
- /**
17
- * 语言选项列表
18
- */
19
- languages?: string[];
16
+ /**
17
+ * Logo图片元数据
18
+ */
19
+ logo?: ImageMetadata;
20
20
 
21
- /**
22
- * Logo图片元数据
23
- */
24
- logo?: ImageMetadata;
21
+ /**
22
+ * Logo 链接地址
23
+ * @default "/"
24
+ */
25
+ logoHref?: string;
25
26
 
26
- /**
27
- * Logo 链接地址
28
- * @default "/"
29
- */
30
- logoHref?: string;
27
+ /**
28
+ * 导航菜单项
29
+ */
30
+ navItems?: INavItem[];
31
31
 
32
- /**
33
- * 导航菜单项
34
- */
35
- navItems?: INavItem[];
32
+ /**
33
+ * 导航栏位置
34
+ * @default "start"
35
+ */
36
+ navPosition?: 'start' | 'center' | 'end';
36
37
 
37
- /**
38
- * 导航栏位置
39
- * @default "start"
40
- */
41
- navPosition?: 'start' | 'center' | 'end';
38
+ /**
39
+ * 水平内边距
40
+ * @default "md"
41
+ */
42
+ paddingHorizontal?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
42
43
 
43
- /**
44
- * 水平内边距
45
- * @default "md"
46
- */
47
- paddingHorizontal?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
44
+ /**
45
+ * 垂直内边距
46
+ * @default "md"
47
+ */
48
+ paddingVertical?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
48
49
 
49
- /**
50
- * 垂直内边距
51
- * @default "md"
52
- */
53
- paddingVertical?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
50
+ /**
51
+ * 圆角大小
52
+ * @default "md"
53
+ */
54
+ rounded?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
54
55
 
55
- /**
56
- * 圆角大小
57
- * @default "md"
58
- */
59
- rounded?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
56
+ /**
57
+ * 是否显示侧边栏切换按钮
58
+ * @default false
59
+ */
60
+ showSidebarToggle?: boolean;
60
61
 
61
- /**
62
- * 是否显示侧边栏切换按钮
63
- * @default false
64
- */
65
- showSidebarToggle?: boolean;
62
+ /**
63
+ * 是否显示主题切换按钮
64
+ * @default false
65
+ */
66
+ showThemeSwitcher?: boolean;
66
67
 
67
- /**
68
- * 是否显示主题切换按钮
69
- * @default false
70
- */
71
- showThemeSwitcher?: boolean;
68
+ /**
69
+ * 社交媒体链接列表
70
+ */
71
+ socialLinks?: Array<{
72
+ name: string;
73
+ url: string;
74
+ icon: any;
75
+ }>;
72
76
 
73
- /**
74
- * 社交媒体链接列表
75
- */
76
- socialLinks?: Array<{
77
- name: string;
78
- url: string;
79
- icon: any;
80
- }>;
81
-
82
- /**
83
- * 是否固定在顶部
84
- * @default true
85
- */
86
- sticky?: boolean;
77
+ /**
78
+ * 是否固定在顶部
79
+ * @default true
80
+ */
81
+ sticky?: boolean;
87
82
  }
@@ -2,35 +2,39 @@
2
2
  * 侧边栏项目
3
3
  */
4
4
  export interface ISidebarItem {
5
- href: string;
6
- text: string;
7
- items?: ISidebarItem[];
5
+ href: string;
6
+ text: string;
7
+ items?: ISidebarItem[];
8
+ /**
9
+ * 可选徽标内容
10
+ */
11
+ badge?: string | number;
8
12
  }
9
13
 
10
14
  /**
11
15
  * 侧边栏配置
12
16
  */
13
17
  export interface ISidebarProps {
14
- /**
15
- * 侧边栏项目
16
- */
17
- sidebarItems: ISidebarItem[];
18
+ /**
19
+ * 侧边栏项目
20
+ */
21
+ sidebarItems: ISidebarItem[];
18
22
 
19
- /**
20
- * 桌面端类名
21
- */
22
- class?: string;
23
+ /**
24
+ * 桌面端类名
25
+ */
26
+ class?: string;
23
27
 
24
- /**
25
- * 是否开启调试模式,显示边框
26
- * @default false
27
- */
28
- debug?: boolean;
28
+ /**
29
+ * 是否开启调试模式,显示边框
30
+ * @default false
31
+ */
32
+ debug?: boolean;
29
33
 
30
- /**
31
- * 侧边栏顶部外边距
32
- */
33
- marginTop?:
34
+ /**
35
+ * 侧边栏顶部外边距
36
+ */
37
+ marginTop?:
34
38
  | 'xs'
35
39
  | 'sm'
36
40
  | 'md'
@@ -42,10 +46,10 @@ export interface ISidebarProps {
42
46
  | '5xl'
43
47
  | string;
44
48
 
45
- /**
46
- * 侧边栏底部外边距
47
- */
48
- marginBottom?:
49
+ /**
50
+ * 侧边栏底部外边距
51
+ */
52
+ marginBottom?:
49
53
  | 'xs'
50
54
  | 'sm'
51
55
  | 'md'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coffic/cosy-ui",
3
- "version": "0.8.28",
3
+ "version": "0.9.1",
4
4
  "description": "An astro component library",
5
5
  "author": {
6
6
  "name": "nookery",
@@ -1,7 +0,0 @@
1
- ---
2
- import LanguageSwitcher from './LanguageSwitcher.astro';
3
- ---
4
-
5
- <div class="cosy:flex cosy:justify-center">
6
- <LanguageSwitcher languages={['zh-cn', 'en']} />
7
- </div>
File without changes
@@ -1,32 +0,0 @@
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>
@@ -1,11 +0,0 @@
1
- import SidebarNav from './SidebarNav.astro';
2
- import SidebarNavBasic from './SidebarNavBasic.astro';
3
- import BasicSourceCode from './SidebarNavBasic.astro?raw';
4
- import { extractSimpleExample } from '../../src/utils/component';
5
-
6
- export { SidebarNav, SidebarNavBasic };
7
-
8
- // 导出示例源代码
9
- export const SidebarNavExampleCodes = {
10
- Basic: extractSimpleExample(BasicSourceCode, 'SidebarNav'),
11
- };