@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 +5 -0
- package/dist/shadcn/ui/button.js +6 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/shadcn/ui/button.js
CHANGED
|
@@ -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
|
-
|
|
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
|
}
|