@coffic/cosy-ui 0.9.60 → 0.9.62

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.
@@ -28,7 +28,7 @@ export function getContainerMinHeightClass(headerHeight: HeaderHeight = 'md'): s
28
28
  }
29
29
 
30
30
  /**
31
- * 计算Sidebar的top
31
+ * 计算Sidebar的top值,防止被头部遮挡
32
32
  * @param headerHeight 头部高度
33
33
  * @returns CSS 类名字符串
34
34
  */
@@ -46,7 +46,7 @@ export function getSidebarTopClass(headerHeight: HeaderHeight = 'md'): string {
46
46
  }
47
47
 
48
48
  /**
49
- * 计算Sidebar的高度值
49
+ * 计算Sidebar的高度值,防止被头部遮挡
50
50
  * @param headerHeight 头部高度
51
51
  * @returns CSS 类名字符串
52
52
  */
@@ -60,8 +60,5 @@ export function getSidebarHeightClass(headerHeight: HeaderHeight = 'md'): string
60
60
  lg: 'cosy:h-[calc(100vh-4rem)]',
61
61
  xl: 'cosy:h-[calc(100vh-5rem)]',
62
62
  };
63
- return (
64
- heightValueMap[headerHeight] ||
65
- 'cosy:h-[calc(100vh-3rem)]'
66
- );
63
+ return heightValueMap[headerHeight]
67
64
  }
@@ -277,10 +277,6 @@ const {
277
277
  enableClientRouter = true,
278
278
  }: Props = Astro.props as Props;
279
279
 
280
- const containerMinHeightClass = getContainerMinHeightClass(
281
- headerConfig?.height as HeaderHeight
282
- );
283
-
284
280
  const sidebarTopClass = getSidebarTopClass(
285
281
  headerConfig?.height as HeaderHeight
286
282
  );
@@ -315,21 +311,24 @@ const sidebarHeightClass = getSidebarHeightClass(
315
311
  .padding('none')
316
312
  .width('full')
317
313
  .centered(true)
318
- .class(containerMinHeightClass)
314
+ .class('cosy:min-h-screen')
319
315
  .build()}>
320
316
  <!-- 侧边栏容器 -->
321
317
  {
322
318
  showSidebar && (
323
- <Sidebar
324
- {...sidebarConfig}
325
- topClass={sidebarTopClass}
326
- heightClass={sidebarHeightClass}
327
- />
319
+ <div
320
+ aria-label="AppLayout-Sidebar-Container"
321
+ class:list={['cosy:sticky', sidebarTopClass, sidebarHeightClass]}>
322
+ <Sidebar {...sidebarConfig} />
323
+ </div>
328
324
  )
329
325
  }
330
326
 
331
327
  <!-- 主内容区域 -->
332
- <Main {...mainContentConfig} class="cosy:flex-1 cosy:min-w-xs">
328
+ <Main
329
+ aria-label="AppLayout-Main-Container"
330
+ {...mainContentConfig}
331
+ class="cosy:flex-1 cosy:min-w-xs">
333
332
  <Skeleton
334
333
  showLoading={true}
335
334
  loadingSize="xl"
@@ -343,7 +342,10 @@ const sidebarHeightClass = getSidebarHeightClass(
343
342
  <!-- Footer -->
344
343
  {
345
344
  showFooter && (
346
- <Container width="full" padding="none">
345
+ <Container
346
+ aria-label="AppLayout-Footer-Container"
347
+ width="full"
348
+ padding="none">
347
349
  <Footer {...footerConfig} />
348
350
  </Container>
349
351
  )
@@ -23,7 +23,6 @@
23
23
 
24
24
  import '../../style.ts';
25
25
  import { SidebarNav } from '../../index-astro';
26
- import { getMarginTopClass, getMarginBottomClass } from './utils.ts';
27
26
  import type { ISidebarProps } from '../../index-astro';
28
27
 
29
28
  export interface Props extends ISidebarProps {
@@ -37,41 +36,9 @@ export interface Props extends ISidebarProps {
37
36
  * @default false
38
37
  */
39
38
  debug?: boolean;
40
-
41
- /**
42
- * 顶部外边距
43
- * @default 'none'
44
- */
45
- marginTop?: string;
46
-
47
- /**
48
- * 底部外边距
49
- * @default 'none'
50
- */
51
- marginBottom?: string;
52
-
53
- /**
54
- * 顶部定位类名
55
- * @default 'cosy:top-12'
56
- */
57
- topClass?: string;
58
-
59
- /**
60
- * 高度类名
61
- * @default 'cosy:h-[calc(100vh-3rem)]'
62
- */
63
- heightClass?: string;
64
39
  }
65
40
 
66
- const {
67
- sidebarItems,
68
- class: className,
69
- debug = false,
70
- marginTop = 'none',
71
- marginBottom = 'none',
72
- topClass = 'cosy:top-12',
73
- heightClass = 'cosy:h-[calc(100vh-3rem)]',
74
- } = Astro.props;
41
+ const { sidebarItems, class: className, debug = false } = Astro.props;
75
42
 
76
43
  // 自动获取当前路径
77
44
  const currentPath = Astro.url.pathname;
@@ -83,16 +50,10 @@ const debugClass = debug ? 'cosy:border cosy:border-red-500' : '';
83
50
  <aside
84
51
  data-desktop-sidebar
85
52
  data-current-path={currentPath}
86
- data-margin-top={marginTop}
87
- data-margin-bottom={marginBottom}
88
53
  class:list={[
89
54
  className,
90
55
  debugClass,
91
- 'cosy:hidden cosy:w-60 cosy:lg:block cosy:bg-base-200 cosy:px-4 cosy:overflow-y-auto cosy:sticky',
92
- topClass,
93
- heightClass,
94
- getMarginTopClass(marginTop),
95
- getMarginBottomClass(marginBottom),
56
+ 'cosy:hidden cosy:w-60 cosy:lg:block cosy:bg-base-200 cosy:px-4 cosy:overflow-y-auto cosy:h-full',
96
57
  ]}>
97
58
  <SidebarNav
98
59
  sidebarItems={sidebarItems}
@@ -37,53 +37,13 @@ export interface Props extends ISidebarProps {
37
37
  * @default false
38
38
  */
39
39
  debug?: boolean;
40
-
41
- /**
42
- * 顶部外边距
43
- * @default 'none'
44
- */
45
- marginTop?: string;
46
-
47
- /**
48
- * 底部外边距
49
- * @default 'none'
50
- */
51
- marginBottom?: string;
52
-
53
- /**
54
- * 顶部定位类名
55
- * @default 'cosy:top-12'
56
- */
57
- topClass?: string;
58
-
59
- /**
60
- * 高度类名
61
- * @default 'cosy:h-[calc(100vh-3rem)]'
62
- */
63
- heightClass?: string;
64
40
  }
65
41
 
66
- const {
67
- sidebarItems,
68
- class: className,
69
- debug = false,
70
- marginTop = 'none',
71
- marginBottom = 'none',
72
- topClass = 'cosy:top-12',
73
- heightClass = 'cosy:h-[calc(100vh-3rem)]',
74
- } = Astro.props;
42
+ const { sidebarItems, class: className, debug = false } = Astro.props;
75
43
  ---
76
44
 
77
45
  {/* 移动端侧边栏 */}
78
46
  <MobileSidebar sidebarItems={sidebarItems} debug={debug} />
79
47
 
80
48
  {/* 桌面端侧边栏 */}
81
- <DesktopSidebar
82
- sidebarItems={sidebarItems}
83
- class={className}
84
- debug={debug}
85
- marginTop={marginTop}
86
- marginBottom={marginBottom}
87
- topClass={topClass}
88
- heightClass={heightClass}
89
- />
49
+ <DesktopSidebar sidebarItems={sidebarItems} class={className} debug={debug} />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coffic/cosy-ui",
3
- "version": "0.9.60",
3
+ "version": "0.9.62",
4
4
  "description": "An astro component library",
5
5
  "author": {
6
6
  "name": "nookery",