@coffic/cosy-ui 0.9.14 → 0.9.15

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.
@@ -16,6 +16,11 @@
16
16
  * <Alert type="success" title="操作成功">您的操作已成功完成</Alert>
17
17
  * ```
18
18
  *
19
+ * 不显示图标:
20
+ * ```astro
21
+ * <Alert type="warning" showIcon={false}>不显示图标的警告</Alert>
22
+ * ```
23
+ *
19
24
  * 组合使用:
20
25
  * ```astro
21
26
  * <Alert
@@ -42,6 +47,7 @@
42
47
  * @prop {string} [title] - 提示标题,可选
43
48
  * @prop {string} [class] - 自定义 CSS 类名
44
49
  * @prop {boolean} [closable=true] - 是否可关闭
50
+ * @prop {boolean} [showIcon=true] - 是否显示图标
45
51
  * @prop {number} [bgOpacity=1] - 背景色透明度,取值范围 0~1,1 为不透明
46
52
  *
47
53
  * @slots
@@ -64,6 +70,7 @@ export interface AlertProps {
64
70
  description?: string;
65
71
  class?: string;
66
72
  closable?: boolean;
73
+ showIcon?: boolean;
67
74
  variant?: 'solid' | 'outline' | 'dash' | 'soft';
68
75
  }
69
76
 
@@ -73,6 +80,7 @@ const {
73
80
  description,
74
81
  class: className = '',
75
82
  closable = true,
83
+ showIcon = true,
76
84
  variant = 'solid',
77
85
  } = Astro.props as AlertProps;
78
86
 
@@ -99,9 +107,11 @@ const IconComponent = {
99
107
  role="alert">
100
108
  <div
101
109
  class="cosy:flex cosy:flex-row cosy:items-center cosy:gap-4 cosy:justify-between cosy:w-full">
102
- <IconComponent
103
- class="cosy:btn cosy:btn-sm cosy:btn-ghost cosy:btn-circle"
104
- />
110
+ {
111
+ showIcon && (
112
+ <IconComponent class="cosy:btn cosy:btn-sm cosy:btn-ghost cosy:btn-circle" />
113
+ )
114
+ }
105
115
  <div
106
116
  class="cosy:flex cosy:flex-col cosy:items-start cosy:h-full cosy:flex-1">
107
117
  {
@@ -25,4 +25,4 @@ const {
25
25
  } = Astro.props;
26
26
  ---
27
27
 
28
- <AstroIcon name="error" size={size} stroke={color} class={className} />
28
+ <AstroIcon name="xCircle" size={size} stroke={color} class={className} />
@@ -25,4 +25,4 @@ const {
25
25
  } = Astro.props;
26
26
  ---
27
27
 
28
- <AstroIcon name="success" size={size} stroke={color} class={className} />
28
+ <AstroIcon name="checkCircle" size={size} stroke={color} class={className} />
@@ -28,4 +28,4 @@ const {
28
28
  } = Astro.props;
29
29
  ---
30
30
 
31
- <AstroIcon name="warning" size={size} stroke={color} class={className} />
31
+ <AstroIcon name="alertTriangle" size={size} stroke={color} class={className} />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coffic/cosy-ui",
3
- "version": "0.9.14",
3
+ "version": "0.9.15",
4
4
  "description": "An astro component library",
5
5
  "author": {
6
6
  "name": "nookery",