@ansiversa/components 0.0.41 → 0.0.42

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ansiversa/components",
3
- "version": "0.0.41",
3
+ "version": "0.0.42",
4
4
  "description": "Shared UI components and layouts for the Ansiversa ecosystem",
5
5
  "type": "module",
6
6
  "exports": {
@@ -3,23 +3,56 @@ import AvButton from "./AvButton.astro";
3
3
  import AvCard from "./AvCard.astro";
4
4
 
5
5
  interface Props {
6
- title: string;
6
+ // preferred Ansiversa naming
7
+ headline?: string;
8
+
9
+ // current naming (keep for backward compatibility)
10
+ title?: string;
11
+
7
12
  description?: string;
13
+
14
+ // CTA
8
15
  ctaLabel?: string;
9
- ctaHref?: string;
16
+ ctaHref?: string; // if provided => link CTA
17
+ ctaDisabled?: boolean; // if button CTA
18
+ className?: string;
10
19
  }
11
20
 
12
- const { title, description, ctaLabel, ctaHref } = Astro.props as Props;
21
+ const {
22
+ headline,
23
+ title,
24
+ description,
25
+ ctaLabel,
26
+ ctaHref,
27
+ ctaDisabled = false,
28
+ className = "",
29
+ ...attrs
30
+ } = Astro.props as Props & Record<string, any>;
31
+
32
+ const resolvedTitle = headline ?? title ?? "Empty";
13
33
  ---
14
34
 
15
- <AvCard className="av-empty-state">
35
+ <AvCard className={`av-empty-state ${className}`.trim()} {...attrs}>
16
36
  <div class="av-empty-state__body">
17
- <h3 class="av-empty-state__title">{title}</h3>
37
+ <h3 class="av-empty-state__title">{resolvedTitle}</h3>
38
+
18
39
  {description && <p class="av-empty-state__description">{description}</p>}
19
- {ctaLabel && ctaHref && (
20
- <AvButton href={ctaHref} variant="primary">
21
- {ctaLabel}
22
- </AvButton>
23
- )}
40
+
41
+ {ctaLabel ? (
42
+ ctaHref ? (
43
+ <AvButton href={ctaHref} variant="primary">
44
+ {ctaLabel}
45
+ </AvButton>
46
+ ) : (
47
+ <AvButton
48
+ type="button"
49
+ variant="primary"
50
+ disabled={ctaDisabled}
51
+ onclick="this.dispatchEvent(new CustomEvent('cta', { bubbles: true }))"
52
+ >
53
+ {ctaLabel}
54
+ </AvButton>
55
+ )
56
+ ) : null}
24
57
  </div>
25
58
  </AvCard>