@ansiversa/components 0.0.17 → 0.0.18

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/AvButton.astro +11 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ansiversa/components",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "Shared UI components and layouts for the Ansiversa ecosystem",
5
5
  "type": "module",
6
6
  "exports": {
@@ -14,6 +14,10 @@ interface Props {
14
14
  disabled?: boolean;
15
15
  /** extra classes if ever needed */
16
16
  className?: string;
17
+ /** allow plain class attribute passthrough */
18
+ class?: string;
19
+ /** forward any other HTML attributes (e.g., Alpine x-*) */
20
+ [key: string]: any;
17
21
  }
18
22
 
19
23
  const {
@@ -24,6 +28,8 @@ const {
24
28
  type = "button",
25
29
  disabled = false,
26
30
  className,
31
+ class: extraClass,
32
+ ...rest
27
33
  } = Astro.props;
28
34
 
29
35
  // Build class list based on our global.css system
@@ -54,16 +60,19 @@ if (block) {
54
60
  if (className) {
55
61
  classes.push(className);
56
62
  }
63
+ if (extraClass) {
64
+ classes.push(extraClass as string);
65
+ }
57
66
 
58
67
  const classAttr = classes.join(" ");
59
68
  ---
60
69
 
61
70
  {href ? (
62
- <a href={href} class={classAttr}>
71
+ <a href={href} class={classAttr} {...rest}>
63
72
  <slot />
64
73
  </a>
65
74
  ) : (
66
- <button type={type} class={classAttr} disabled={disabled}>
75
+ <button type={type} class={classAttr} disabled={disabled} {...rest}>
67
76
  <slot />
68
77
  </button>
69
78
  )}