-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f72fdb
commit dcc6fce
Showing
17 changed files
with
239 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useId } from "@salt-ds/core"; | ||
import { type ComponentPropsWithoutRef, forwardRef } from "react"; | ||
|
||
export interface TabNextPanelProps extends ComponentPropsWithoutRef<"div"> {} | ||
|
||
export const TabNextPanel = forwardRef<HTMLDivElement, TabNextPanelProps>( | ||
function TabNextPanel(props, ref) { | ||
const { children, id: idProp, ...rest } = props; | ||
const id = useId(idProp); | ||
|
||
return ( | ||
<div id={id} ref={ref} role="tabpanel" {...rest}> | ||
{children} | ||
</div> | ||
); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { ReactNode } from "react"; | ||
|
||
import { TabsNextContext } from "./TabsNextContext"; | ||
|
||
export interface TabsNextProps { | ||
children: ReactNode; | ||
} | ||
|
||
export function TabsNext({ children }: TabsNextProps) { | ||
return ( | ||
<TabsNextContext.Provider value={{}}>{children}</TabsNextContext.Provider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { createContext } from "@salt-ds/core"; | ||
import { useContext } from "react"; | ||
|
||
// biome-ignore lint/complexity/noBannedTypes: <explanation> | ||
export type TabsNextContextValue = {}; | ||
|
||
export const TabsNextContext = createContext<TabsNextContextValue>( | ||
"TabsNextContext", | ||
{}, | ||
); | ||
|
||
export function useTabsNext() { | ||
return useContext(TabsNextContext); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { createContext } from "@salt-ds/core"; | ||
import { type SyntheticEvent, useContext } from "react"; | ||
|
||
interface TabValue { | ||
id: string; | ||
element: HTMLElement; | ||
} | ||
|
||
export interface TabstripNextContextValue { | ||
registerItem: (tab: TabValue) => void; | ||
variant: "main" | "inline"; | ||
setSelected: (event: SyntheticEvent, id: string) => void; | ||
setActive: (id: string) => void; | ||
handleClose: (event: SyntheticEvent, id: string) => void; | ||
selected?: string; | ||
focusInside: boolean; | ||
} | ||
|
||
export const TabstripNextContext = createContext<TabstripNextContextValue>( | ||
"TabstripNextContext", | ||
{ | ||
registerItem: () => undefined, | ||
variant: "main", | ||
setSelected: () => undefined, | ||
setActive: () => undefined, | ||
handleClose: () => undefined, | ||
selected: undefined, | ||
focusInside: false, | ||
}, | ||
); | ||
|
||
export function useTabstrip() { | ||
return useContext(TabstripNextContext); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.