-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(examples): prepare v3 + next 14 app dir
- Loading branch information
1 parent
65575d9
commit e516332
Showing
340 changed files
with
856 additions
and
115 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,67 @@ | ||
import { Box, Text } from "@chakra-ui/react" | ||
import { | ||
Box, | ||
Button, | ||
Checkbox, | ||
ClientOnly, | ||
HStack, | ||
Heading, | ||
Progress, | ||
RadioGroup, | ||
Skeleton, | ||
VStack, | ||
} from "@chakra-ui/react" | ||
import Image from "next/image" | ||
import { ColorModeToggle } from "../components/color-mode-toggle" | ||
|
||
export default async function Page() { | ||
return ( | ||
<Box textAlign="center" fontSize="xl"> | ||
<Text>Welcome to Chakra UI + Next.js</Text> | ||
<ColorModeToggle /> | ||
<Box textAlign="center" fontSize="xl" pt="30vh"> | ||
<VStack gap="8"> | ||
<Image | ||
alt="chakra logo" | ||
src="/static/logo.svg" | ||
width="80" | ||
height="80" | ||
/> | ||
<Heading size="2xl" letterSpacing="tight"> | ||
Welcome to Chakra UI v3 + Next.js (App) | ||
</Heading> | ||
|
||
<HStack gap="10"> | ||
<Checkbox.Root defaultChecked> | ||
<Checkbox.Control /> | ||
<Checkbox.Label>Checkbox</Checkbox.Label> | ||
</Checkbox.Root> | ||
|
||
<RadioGroup.Root display="inline-flex" defaultValue="1"> | ||
<RadioGroup.Item value="1" mr="2"> | ||
<RadioGroup.ItemControl /> | ||
<RadioGroup.ItemText lineHeight="1">Radio</RadioGroup.ItemText> | ||
</RadioGroup.Item> | ||
<RadioGroup.Item value="2"> | ||
<RadioGroup.ItemControl /> | ||
<RadioGroup.ItemText lineHeight="1">Radio</RadioGroup.ItemText> | ||
</RadioGroup.Item> | ||
</RadioGroup.Root> | ||
</HStack> | ||
|
||
<Progress.Root width="300px" value={65} hasStripe> | ||
<Progress.Track> | ||
<Progress.FilledTrack /> | ||
</Progress.Track> | ||
</Progress.Root> | ||
|
||
<HStack> | ||
<Button>Let's go!</Button> | ||
<Button variant="outline">bun install @chakra-ui/react</Button> | ||
</HStack> | ||
</VStack> | ||
|
||
<Box pos="absolute" top="4" right="4"> | ||
<ClientOnly fallback={<Skeleton w="10" h="10" rounded="md" />}> | ||
<ColorModeToggle /> | ||
</ClientOnly> | ||
</Box> | ||
</Box> | ||
) | ||
} |
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 |
---|---|---|
@@ -1,15 +1,14 @@ | ||
"use client" | ||
|
||
import { ChakraProvider, cookieStorageManager } from "@chakra-ui/react" | ||
import { ChakraProvider, defaultSystem } from "@chakra-ui/react" | ||
import { ThemeProvider } from "next-themes" | ||
|
||
export default function RootLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode | ||
}) { | ||
export default function RootLayout(props: { children: React.ReactNode }) { | ||
return ( | ||
<ChakraProvider colorModeManager={cookieStorageManager}> | ||
{children} | ||
<ChakraProvider value={defaultSystem}> | ||
<ThemeProvider attribute="class" disableTransitionOnChange> | ||
{props.children} | ||
</ThemeProvider> | ||
</ChakraProvider> | ||
) | ||
} |
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 |
---|---|---|
@@ -1,7 +1,17 @@ | ||
"use client" | ||
import { Button, useColorMode } from "@chakra-ui/react" | ||
|
||
import { IconButton } from "@chakra-ui/react" | ||
import { Moon, Sun } from "lucide-react" | ||
import { useTheme } from "next-themes" | ||
|
||
export function ColorModeToggle() { | ||
const { toggleColorMode } = useColorMode() | ||
return <Button onClick={toggleColorMode}>Click me</Button> | ||
const { theme, setTheme } = useTheme() | ||
const toggleColorMode = () => { | ||
setTheme(theme === "light" ? "dark" : "light") | ||
} | ||
return ( | ||
<IconButton aria-label="toggle color mode" onClick={toggleColorMode}> | ||
{theme === "light" ? <Moon /> : <Sun />} | ||
</IconButton> | ||
) | ||
} |
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,25 @@ | ||
import { createContext, useContext } from "react" | ||
|
||
type ColorMode = "light" | "dark" | ||
|
||
interface ColorModeContextType { | ||
forced?: boolean | ||
colorMode: ColorMode | ||
toggleColorMode: () => void | ||
setColorMode: (value: any) => void | ||
} | ||
|
||
const ColorModeContext = createContext({} as ColorModeContextType) | ||
ColorModeContext.displayName = "ColorModeContext" | ||
|
||
export function useColorMode() { | ||
return useContext(ColorModeContext) | ||
} | ||
|
||
export function useColorModeValue<TLight = unknown, TDark = unknown>( | ||
light: TLight, | ||
dark: TDark, | ||
) { | ||
const { colorMode } = useColorMode() | ||
return colorMode === "dark" ? dark : light | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
"use client" | ||
|
||
import { useMemo, useState } from "react" | ||
|
||
type InitialState = boolean | (() => boolean) | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
"use client" | ||
|
||
import copy from "copy-to-clipboard" | ||
import { useCallback, useEffect, useState } from "react" | ||
|
||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
"use client" | ||
|
||
import { useMemo, useState } from "react" | ||
import { useCallbackRef } from "./use-callback-ref" | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
"use client" | ||
|
||
import { useEffect } from "react" | ||
import { useCallbackRef } from "./use-callback-ref" | ||
|
||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
"use client" | ||
|
||
import { | ||
FocusableElement, | ||
getActiveElement, | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
"use client" | ||
|
||
import { useEffect } from "react" | ||
import { useCallbackRef } from "./use-callback-ref" | ||
|
||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
"use client" | ||
|
||
import { useRef } from "react" | ||
|
||
/** | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
"use client" | ||
|
||
import { useEffect, useState } from "react" | ||
import { useCallbackRef } from "./use-callback-ref" | ||
|
||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
"use client" | ||
|
||
import { useEffect, useRef } from "react" | ||
import { useCallbackRef } from "./use-callback-ref" | ||
|
||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
"use client" | ||
|
||
import { useEffect, useRef } from "react" | ||
|
||
export function usePrevious<T>(value: T) { | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
"use client" | ||
|
||
import { useEffect } from "react" | ||
import { useCallbackRef } from "./use-callback-ref" | ||
|
||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
"use client" | ||
|
||
import { useEffect, useRef } from "react" | ||
|
||
/** | ||
|
2 changes: 2 additions & 0 deletions
2
packages/react/src/components/accordion/accordion-content.tsx
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
2 changes: 2 additions & 0 deletions
2
packages/react/src/components/accordion/accordion-indicator.tsx
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
2 changes: 2 additions & 0 deletions
2
packages/react/src/components/accordion/accordion-trigger.tsx
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
5 changes: 2 additions & 3 deletions
5
packages/react/src/components/accordion/use-accordion-item-state.ts
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
2 changes: 2 additions & 0 deletions
2
packages/react/src/components/accordion/use-accordion-item.ts
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.