fix: rename wrapper to tab wrapper (#4636)

* fix: rename wrapper to tab wrapper

* docs: update

* docs: update

* docs: update

* fix: rename wrapper to tab wrapper
This commit is contained in:
winches 2025-01-30 22:25:51 +08:00 committed by GitHub
parent 1965b8406a
commit 06d6f08d8e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 6 deletions

View File

@ -0,0 +1,5 @@
---
"@heroui/theme": patch
---
Fix tabs slots "wrapper" rename to "tabWrapper" -- Breaking Change (#4552)

View File

@ -199,6 +199,7 @@ function AppTabs() {
- **tabContent**: The tab content slot, it wraps the tab content. - **tabContent**: The tab content slot, it wraps the tab content.
- **cursor**: The cursor slot, it wraps the cursor. This is only visible when `disableAnimation=false` - **cursor**: The cursor slot, it wraps the cursor. This is only visible when `disableAnimation=false`
- **panel**: The panel slot, it wraps the tab panel (content). - **panel**: The panel slot, it wraps the tab panel (content).
- **tabWrapper**: The tab wrapper slot, it wraps the tab and the tab content.
### Custom Styles ### Custom Styles
@ -343,7 +344,7 @@ You can customize the `Tabs` component by passing custom Tailwind CSS classes to
}, },
{ {
attribute: "classNames", attribute: "classNames",
type: "Partial<Record<\"base\" \"tabList\" \"tab\" \"tabContent\" \"cursor\" \"panel\", string>>", type: "Partial<Record<\"base\" \"tabList\" \"tab\" \"tabContent\" \"cursor\" \"panel\" \"tabWrapper\", string>>",
description: "Allows to set custom class names for the card slots.", description: "Allows to set custom class names for the card slots.",
default: "-" default: "-"
}, },

View File

@ -171,7 +171,7 @@ export function useTabs<T extends object>(originalProps: UseTabsProps<T>) {
const getWrapperProps: PropGetter = useCallback( const getWrapperProps: PropGetter = useCallback(
(props) => ({ (props) => ({
"data-slot": "tabWrapper", "data-slot": "tabWrapper",
className: slots.wrapper({class: clsx(classNames?.wrapper, props?.className)}), className: slots.tabWrapper({class: clsx(classNames?.tabWrapper, props?.className)}),
"data-placement": placement, "data-placement": placement,
"data-vertical": "data-vertical":
isVertical || placement === "start" || placement === "end" ? "vertical" : "horizontal", isVertical || placement === "start" || placement === "end" ? "vertical" : "horizontal",

View File

@ -72,7 +72,7 @@ const tabs = tv({
// focus ring // focus ring
...dataFocusVisibleClasses, ...dataFocusVisibleClasses,
], ],
wrapper: [], tabWrapper: [],
}, },
variants: { variants: {
variant: { variant: {
@ -166,15 +166,15 @@ const tabs = tv({
start: { start: {
tabList: "flex-col", tabList: "flex-col",
panel: "py-0 px-3", panel: "py-0 px-3",
wrapper: "flex", tabWrapper: "flex",
}, },
end: { end: {
tabList: "flex-col", tabList: "flex-col",
panel: "py-0 px-3", panel: "py-0 px-3",
wrapper: "flex flex-row-reverse", tabWrapper: "flex flex-row-reverse",
}, },
bottom: { bottom: {
wrapper: "flex flex-col-reverse", tabWrapper: "flex flex-col-reverse",
}, },
}, },
}, },