@stevederico/skateboard-ui 3.11.0 → 3.12.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ 3.12.0
4
+
5
+ Fix asChild button
6
+ Infer nativeButton semantics
7
+
3
8
  3.11.0
4
9
 
5
10
  Restore spinner animation
@@ -41,7 +41,12 @@ function Button({ className, variant = "default", size = "default", asChild = fa
41
41
  // `asChild` API so `<Button asChild><a .../></Button>` renders the child element
42
42
  // (merged with button props) instead of leaking `asChild` onto the DOM <button>.
43
43
  if (asChild) {
44
- return (_jsx(ButtonPrimitive, { "data-slot": "button", className: classes, render: Children.only(children), ...props }));
44
+ const child = Children.only(children);
45
+ // Base UI defaults `nativeButton` to true and warns when the rendered element
46
+ // isn't a real <button>. Infer it from the child so `<Button asChild><a/></Button>`
47
+ // reports the correct semantics; an explicit `nativeButton` in props still wins.
48
+ const isNativeButton = child.type === "button";
49
+ return (_jsx(ButtonPrimitive, { "data-slot": "button", className: classes, nativeButton: isNativeButton, render: child, ...props }));
45
50
  }
46
51
  return (_jsx(ButtonPrimitive, { "data-slot": "button", className: classes, ...props, children: children }));
47
52
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stevederico/skateboard-ui",
3
3
  "private": false,
4
- "version": "3.11.0",
4
+ "version": "3.12.0",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {