diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 706803f4..2e9889c1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -41,6 +41,8 @@ jobs: pnpm build pnpm lint pnpm test + - name: Benchmark + run: pnpm benchmark - name: Build Landing run: | pnpm -F components build-storybook diff --git a/README.md b/README.md index cbe9ff7a..54270788 100644 --- a/README.md +++ b/README.md @@ -72,10 +72,10 @@ Next.js Build Time and Build Size (AMD Ryzen 9 9950X, 128GB RAM, Windows 11) | Library | Version | Build Time | Build Size | |--------------|----------|------------|-----------------| -| kuma-ui | 1.5.9 | 13.948s | 61,910,524b | -| chakra-ui | 3.22.0 | 20.557s | 189,541,604b | -| mui | 7.2.0 | 20.002s | 218,204,592b | -| devup-ui | 1.0.10 | 10.583s | 53,111,181b | +| kuma-ui | 1.5.9 | 12.350s | 61,934,146b | +| chakra-ui | 3.22.0 | 18.536s | 189,585,521b | +| mui | 7.2.0 | 14.434s | 86,186,191b | +| devup-ui | 1.0.20 | 11.302s | 53,232,399b | ## How it works diff --git a/benchmark/next-chakra-ui/src/components/ui/avatar.tsx b/benchmark/next-chakra-ui/src/components/ui/avatar.tsx deleted file mode 100644 index dae6074f..00000000 --- a/benchmark/next-chakra-ui/src/components/ui/avatar.tsx +++ /dev/null @@ -1,74 +0,0 @@ -'use client' - -import type { GroupProps, SlotRecipeProps } from '@chakra-ui/react' -import { Avatar as ChakraAvatar, Group } from '@chakra-ui/react' -import * as React from 'react' - -type ImageProps = React.ImgHTMLAttributes - -export interface AvatarProps extends ChakraAvatar.RootProps { - name?: string - src?: string - srcSet?: string - loading?: ImageProps['loading'] - icon?: React.ReactElement - fallback?: React.ReactNode -} - -export const Avatar = React.forwardRef( - function Avatar(props, ref) { - const { name, src, srcSet, loading, icon, fallback, children, ...rest } = - props - return ( - - - {fallback} - - - {children} - - ) - }, -) - -interface AvatarFallbackProps extends ChakraAvatar.FallbackProps { - name?: string - icon?: React.ReactElement -} - -const AvatarFallback = React.forwardRef( - function AvatarFallback(props, ref) { - const { name, icon, children, ...rest } = props - return ( - - {children} - {name != null && children == null && <>{getInitials(name)}} - {name == null && children == null && ( - {icon} - )} - - ) - }, -) - -function getInitials(name: string) { - const names = name.trim().split(' ') - const firstName = names[0] != null ? names[0] : '' - const lastName = names.length > 1 ? names[names.length - 1] : '' - return firstName && lastName - ? `${firstName.charAt(0)}${lastName.charAt(0)}` - : firstName.charAt(0) -} - -interface AvatarGroupProps extends GroupProps, SlotRecipeProps<'avatar'> {} - -export const AvatarGroup = React.forwardRef( - function AvatarGroup(props, ref) { - const { size, variant, borderless, ...rest } = props - return ( - - - - ) - }, -) diff --git a/benchmark/next-chakra-ui/src/components/ui/button.tsx b/benchmark/next-chakra-ui/src/components/ui/button.tsx deleted file mode 100644 index 1f64de87..00000000 --- a/benchmark/next-chakra-ui/src/components/ui/button.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import type { ButtonProps as ChakraButtonProps } from '@chakra-ui/react' -import { - AbsoluteCenter, - Button as ChakraButton, - Span, - Spinner, -} from '@chakra-ui/react' -import * as React from 'react' - -interface ButtonLoadingProps { - loading?: boolean - loadingText?: React.ReactNode -} - -export interface ButtonProps extends ChakraButtonProps, ButtonLoadingProps {} - -export const Button = React.forwardRef( - function Button(props, ref) { - const { loading, disabled, loadingText, children, ...rest } = props - return ( - - {loading && !loadingText ? ( - <> - - - - {children} - - ) : loading && loadingText ? ( - <> - - {loadingText} - - ) : ( - children - )} - - ) - }, -) diff --git a/benchmark/next-chakra-ui/src/components/ui/checkbox.tsx b/benchmark/next-chakra-ui/src/components/ui/checkbox.tsx deleted file mode 100644 index 966fa5e2..00000000 --- a/benchmark/next-chakra-ui/src/components/ui/checkbox.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { Checkbox as ChakraCheckbox } from '@chakra-ui/react' -import * as React from 'react' - -export interface CheckboxProps extends ChakraCheckbox.RootProps { - icon?: React.ReactNode - inputProps?: React.InputHTMLAttributes - rootRef?: React.Ref -} - -export const Checkbox = React.forwardRef( - function Checkbox(props, ref) { - const { icon, children, inputProps, rootRef, ...rest } = props - return ( - - - - {icon || } - - {children != null && ( - {children} - )} - - ) - }, -) diff --git a/benchmark/next-chakra-ui/src/components/ui/close-button.tsx b/benchmark/next-chakra-ui/src/components/ui/close-button.tsx deleted file mode 100644 index d1740dde..00000000 --- a/benchmark/next-chakra-ui/src/components/ui/close-button.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import type { ButtonProps } from '@chakra-ui/react' -import { IconButton as ChakraIconButton } from '@chakra-ui/react' -import * as React from 'react' -import { LuX } from 'react-icons/lu' - -export type CloseButtonProps = ButtonProps - -export const CloseButton = React.forwardRef< - HTMLButtonElement, - CloseButtonProps ->(function CloseButton(props, ref) { - return ( - - {props.children ?? } - - ) -}) diff --git a/benchmark/next-chakra-ui/src/components/ui/dialog.tsx b/benchmark/next-chakra-ui/src/components/ui/dialog.tsx deleted file mode 100644 index 4acb4988..00000000 --- a/benchmark/next-chakra-ui/src/components/ui/dialog.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { Dialog as ChakraDialog, Portal } from '@chakra-ui/react' -import * as React from 'react' - -import { CloseButton } from './close-button' - -interface DialogContentProps extends ChakraDialog.ContentProps { - portalled?: boolean - portalRef?: React.RefObject - backdrop?: boolean -} - -export const DialogContent = React.forwardRef< - HTMLDivElement, - DialogContentProps ->(function DialogContent(props, ref) { - const { - children, - portalled = true, - portalRef, - backdrop = true, - ...rest - } = props - - return ( - - {backdrop && } - - - {children} - - - - ) -}) - -export const DialogCloseTrigger = React.forwardRef< - HTMLButtonElement, - ChakraDialog.CloseTriggerProps ->(function DialogCloseTrigger(props, ref) { - return ( - - - {props.children} - - - ) -}) - -export const DialogRoot = ChakraDialog.Root -export const DialogFooter = ChakraDialog.Footer -export const DialogHeader = ChakraDialog.Header -export const DialogBody = ChakraDialog.Body -export const DialogBackdrop = ChakraDialog.Backdrop -export const DialogTitle = ChakraDialog.Title -export const DialogDescription = ChakraDialog.Description -export const DialogTrigger = ChakraDialog.Trigger -export const DialogActionTrigger = ChakraDialog.ActionTrigger - -export function Dialog() { - return <> -} diff --git a/benchmark/next-chakra-ui/src/components/ui/drawer.tsx b/benchmark/next-chakra-ui/src/components/ui/drawer.tsx deleted file mode 100644 index fac17981..00000000 --- a/benchmark/next-chakra-ui/src/components/ui/drawer.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import { Drawer as ChakraDrawer, Portal } from '@chakra-ui/react' -import * as React from 'react' - -import { CloseButton } from './close-button' - -interface DrawerContentProps extends ChakraDrawer.ContentProps { - portalled?: boolean - portalRef?: React.RefObject - offset?: ChakraDrawer.ContentProps['padding'] -} - -export const DrawerContent = React.forwardRef< - HTMLDivElement, - DrawerContentProps ->(function DrawerContent(props, ref) { - const { children, portalled = true, portalRef, offset, ...rest } = props - return ( - - - - {children} - - - - ) -}) - -export const DrawerCloseTrigger = React.forwardRef< - HTMLButtonElement, - ChakraDrawer.CloseTriggerProps ->(function DrawerCloseTrigger(props, ref) { - return ( - - - - ) -}) - -export const DrawerTrigger = ChakraDrawer.Trigger -export const DrawerRoot = ChakraDrawer.Root -export const DrawerFooter = ChakraDrawer.Footer -export const DrawerHeader = ChakraDrawer.Header -export const DrawerBody = ChakraDrawer.Body -export const DrawerBackdrop = ChakraDrawer.Backdrop -export const DrawerDescription = ChakraDrawer.Description -export const DrawerTitle = ChakraDrawer.Title -export const DrawerActionTrigger = ChakraDrawer.ActionTrigger - -export function Drawer() { - return <> -} diff --git a/benchmark/next-chakra-ui/src/components/ui/field.tsx b/benchmark/next-chakra-ui/src/components/ui/field.tsx deleted file mode 100644 index f99747be..00000000 --- a/benchmark/next-chakra-ui/src/components/ui/field.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { Field as ChakraField } from '@chakra-ui/react' -import * as React from 'react' - -export interface FieldProps extends Omit { - label?: React.ReactNode - helperText?: React.ReactNode - errorText?: React.ReactNode - optionalText?: React.ReactNode -} - -export const Field = React.forwardRef( - function Field(props, ref) { - const { label, children, helperText, errorText, optionalText, ...rest } = - props - return ( - - {label && ( - - {label} - - - )} - {children} - {helperText && ( - {helperText} - )} - {errorText && ( - {errorText} - )} - - ) - }, -) diff --git a/benchmark/next-chakra-ui/src/components/ui/input-group.tsx b/benchmark/next-chakra-ui/src/components/ui/input-group.tsx deleted file mode 100644 index 55bf0d18..00000000 --- a/benchmark/next-chakra-ui/src/components/ui/input-group.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import type { BoxProps, InputElementProps } from '@chakra-ui/react' -import { Group, InputElement } from '@chakra-ui/react' -import * as React from 'react' - -export interface InputGroupProps extends BoxProps { - startElementProps?: InputElementProps - endElementProps?: InputElementProps - startElement?: React.ReactNode - endElement?: React.ReactNode - children: React.ReactElement - startOffset?: InputElementProps['paddingStart'] - endOffset?: InputElementProps['paddingEnd'] -} - -export const InputGroup = React.forwardRef( - function InputGroup(props, ref) { - const { - startElement, - startElementProps, - endElement, - endElementProps, - children, - startOffset = '6px', - endOffset = '6px', - ...rest - } = props - - const child = - React.Children.only>(children) - - return ( - - {startElement && ( - - {startElement} - - )} - {React.cloneElement(child, { - ...(startElement && { - ps: `calc(var(--input-height) - ${startOffset})`, - }), - ...(endElement && { pe: `calc(var(--input-height) - ${endOffset})` }), - ...children.props, - })} - {endElement && ( - - {endElement} - - )} - - ) - }, -) diff --git a/benchmark/next-chakra-ui/src/components/ui/popover.tsx b/benchmark/next-chakra-ui/src/components/ui/popover.tsx deleted file mode 100644 index 8613b609..00000000 --- a/benchmark/next-chakra-ui/src/components/ui/popover.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import { Popover as ChakraPopover, Portal } from '@chakra-ui/react' -import * as React from 'react' - -import { CloseButton } from './close-button' - -interface PopoverContentProps extends ChakraPopover.ContentProps { - portalled?: boolean - portalRef?: React.RefObject -} - -export const PopoverContent = React.forwardRef< - HTMLDivElement, - PopoverContentProps ->(function PopoverContent(props, ref) { - const { portalled = true, portalRef, ...rest } = props - return ( - - - - - - ) -}) - -export const PopoverArrow = React.forwardRef< - HTMLDivElement, - ChakraPopover.ArrowProps ->(function PopoverArrow(props, ref) { - return ( - - - - ) -}) - -export const PopoverCloseTrigger = React.forwardRef< - HTMLButtonElement, - ChakraPopover.CloseTriggerProps ->(function PopoverCloseTrigger(props, ref) { - return ( - - - - ) -}) - -export const PopoverTitle = ChakraPopover.Title -export const PopoverDescription = ChakraPopover.Description -export const PopoverFooter = ChakraPopover.Footer -export const PopoverHeader = ChakraPopover.Header -export const PopoverRoot = ChakraPopover.Root -export const PopoverBody = ChakraPopover.Body -export const PopoverTrigger = ChakraPopover.Trigger - -export function Popover() { - return <> -} diff --git a/benchmark/next-chakra-ui/src/components/ui/radio.tsx b/benchmark/next-chakra-ui/src/components/ui/radio.tsx deleted file mode 100644 index c5d5c85b..00000000 --- a/benchmark/next-chakra-ui/src/components/ui/radio.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { RadioGroup as ChakraRadioGroup } from '@chakra-ui/react' -import * as React from 'react' - -export interface RadioProps extends ChakraRadioGroup.ItemProps { - rootRef?: React.Ref - inputProps?: React.InputHTMLAttributes -} - -export const Radio = React.forwardRef( - function Radio(props, ref) { - const { children, inputProps, rootRef, ...rest } = props - return ( - - - - {children && ( - {children} - )} - - ) - }, -) - -export const RadioGroup = ChakraRadioGroup.Root diff --git a/benchmark/next-chakra-ui/src/components/ui/slider.tsx b/benchmark/next-chakra-ui/src/components/ui/slider.tsx deleted file mode 100644 index 113d1363..00000000 --- a/benchmark/next-chakra-ui/src/components/ui/slider.tsx +++ /dev/null @@ -1,82 +0,0 @@ -import { For, HStack, Slider as ChakraSlider } from '@chakra-ui/react' -import * as React from 'react' - -export interface SliderProps extends ChakraSlider.RootProps { - marks?: Array - label?: React.ReactNode - showValue?: boolean -} - -export const Slider = React.forwardRef( - function Slider(props, ref) { - const { marks: marksProp, label, showValue, ...rest } = props - const value = props.defaultValue ?? props.value - - const marks = marksProp?.map((mark) => { - if (typeof mark === 'number') return { value: mark, label: undefined } - return mark - }) - - const hasMarkLabel = !!marks?.some((mark) => mark.label) - - return ( - - {label && !showValue && ( - {label} - )} - {label && showValue && ( - - {label} - - - )} - - - - - - - - - ) - }, -) - -function SliderThumbs(props: { value?: number[] }) { - const { value } = props - return ( - - {(_, index) => ( - - - - )} - - ) -} - -interface SliderMarksProps { - marks?: Array -} - -const SliderMarks = React.forwardRef( - function SliderMarks(props, ref) { - const { marks } = props - if (!marks?.length) return null - - return ( - - {marks.map((mark, index) => { - const value = typeof mark === 'number' ? mark : mark.value - const label = typeof mark === 'number' ? undefined : mark.label - return ( - - - {label} - - ) - })} - - ) - }, -) diff --git a/benchmark/next-chakra-ui/src/components/ui/tooltip.tsx b/benchmark/next-chakra-ui/src/components/ui/tooltip.tsx deleted file mode 100644 index 1d91a73b..00000000 --- a/benchmark/next-chakra-ui/src/components/ui/tooltip.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { Portal, Tooltip as ChakraTooltip } from '@chakra-ui/react' -import * as React from 'react' - -export interface TooltipProps extends ChakraTooltip.RootProps { - showArrow?: boolean - portalled?: boolean - portalRef?: React.RefObject - content: React.ReactNode - contentProps?: ChakraTooltip.ContentProps - disabled?: boolean -} - -export const Tooltip = React.forwardRef( - function Tooltip(props, ref) { - const { - showArrow, - children, - disabled, - portalled, - content, - contentProps, - portalRef, - ...rest - } = props - - if (disabled) return children - - return ( - - {children} - - - - {showArrow && ( - - - - )} - {content} - - - - - ) - }, -) diff --git a/benchmark/next-kuma-ui/src/app/page.tsx b/benchmark/next-kuma-ui/src/app/page.tsx index 83a3cc40..ad0b0bcd 100644 --- a/benchmark/next-kuma-ui/src/app/page.tsx +++ b/benchmark/next-kuma-ui/src/app/page.tsx @@ -1,6 +1,6 @@ 'use client' -import { Box, Text } from '@kuma-ui/Core' +import { Box, Text } from '@kuma-ui/core' import { useState } from 'react' export default function HomePage() { diff --git a/benchmark/next-mui/src/app/layout.tsx b/benchmark/next-mui/src/app/layout.tsx index 5b39c286..6b8b4518 100644 --- a/benchmark/next-mui/src/app/layout.tsx +++ b/benchmark/next-mui/src/app/layout.tsx @@ -1,7 +1,5 @@ import type { Metadata } from 'next' -import { Provider } from '../components/ui/provider' - export const metadata: Metadata = { title: 'Create Next App', description: 'Generated by create next app', @@ -14,9 +12,7 @@ export default function RootLayout({ }>) { return ( - - {children} - + {children} ) } diff --git a/benchmark/next-mui/src/components/ui/avatar.tsx b/benchmark/next-mui/src/components/ui/avatar.tsx deleted file mode 100644 index dae6074f..00000000 --- a/benchmark/next-mui/src/components/ui/avatar.tsx +++ /dev/null @@ -1,74 +0,0 @@ -'use client' - -import type { GroupProps, SlotRecipeProps } from '@chakra-ui/react' -import { Avatar as ChakraAvatar, Group } from '@chakra-ui/react' -import * as React from 'react' - -type ImageProps = React.ImgHTMLAttributes - -export interface AvatarProps extends ChakraAvatar.RootProps { - name?: string - src?: string - srcSet?: string - loading?: ImageProps['loading'] - icon?: React.ReactElement - fallback?: React.ReactNode -} - -export const Avatar = React.forwardRef( - function Avatar(props, ref) { - const { name, src, srcSet, loading, icon, fallback, children, ...rest } = - props - return ( - - - {fallback} - - - {children} - - ) - }, -) - -interface AvatarFallbackProps extends ChakraAvatar.FallbackProps { - name?: string - icon?: React.ReactElement -} - -const AvatarFallback = React.forwardRef( - function AvatarFallback(props, ref) { - const { name, icon, children, ...rest } = props - return ( - - {children} - {name != null && children == null && <>{getInitials(name)}} - {name == null && children == null && ( - {icon} - )} - - ) - }, -) - -function getInitials(name: string) { - const names = name.trim().split(' ') - const firstName = names[0] != null ? names[0] : '' - const lastName = names.length > 1 ? names[names.length - 1] : '' - return firstName && lastName - ? `${firstName.charAt(0)}${lastName.charAt(0)}` - : firstName.charAt(0) -} - -interface AvatarGroupProps extends GroupProps, SlotRecipeProps<'avatar'> {} - -export const AvatarGroup = React.forwardRef( - function AvatarGroup(props, ref) { - const { size, variant, borderless, ...rest } = props - return ( - - - - ) - }, -) diff --git a/benchmark/next-mui/src/components/ui/button.tsx b/benchmark/next-mui/src/components/ui/button.tsx deleted file mode 100644 index 1f64de87..00000000 --- a/benchmark/next-mui/src/components/ui/button.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import type { ButtonProps as ChakraButtonProps } from '@chakra-ui/react' -import { - AbsoluteCenter, - Button as ChakraButton, - Span, - Spinner, -} from '@chakra-ui/react' -import * as React from 'react' - -interface ButtonLoadingProps { - loading?: boolean - loadingText?: React.ReactNode -} - -export interface ButtonProps extends ChakraButtonProps, ButtonLoadingProps {} - -export const Button = React.forwardRef( - function Button(props, ref) { - const { loading, disabled, loadingText, children, ...rest } = props - return ( - - {loading && !loadingText ? ( - <> - - - - {children} - - ) : loading && loadingText ? ( - <> - - {loadingText} - - ) : ( - children - )} - - ) - }, -) diff --git a/benchmark/next-mui/src/components/ui/checkbox.tsx b/benchmark/next-mui/src/components/ui/checkbox.tsx deleted file mode 100644 index 966fa5e2..00000000 --- a/benchmark/next-mui/src/components/ui/checkbox.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { Checkbox as ChakraCheckbox } from '@chakra-ui/react' -import * as React from 'react' - -export interface CheckboxProps extends ChakraCheckbox.RootProps { - icon?: React.ReactNode - inputProps?: React.InputHTMLAttributes - rootRef?: React.Ref -} - -export const Checkbox = React.forwardRef( - function Checkbox(props, ref) { - const { icon, children, inputProps, rootRef, ...rest } = props - return ( - - - - {icon || } - - {children != null && ( - {children} - )} - - ) - }, -) diff --git a/benchmark/next-mui/src/components/ui/close-button.tsx b/benchmark/next-mui/src/components/ui/close-button.tsx deleted file mode 100644 index d1740dde..00000000 --- a/benchmark/next-mui/src/components/ui/close-button.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import type { ButtonProps } from '@chakra-ui/react' -import { IconButton as ChakraIconButton } from '@chakra-ui/react' -import * as React from 'react' -import { LuX } from 'react-icons/lu' - -export type CloseButtonProps = ButtonProps - -export const CloseButton = React.forwardRef< - HTMLButtonElement, - CloseButtonProps ->(function CloseButton(props, ref) { - return ( - - {props.children ?? } - - ) -}) diff --git a/benchmark/next-mui/src/components/ui/color-mode.tsx b/benchmark/next-mui/src/components/ui/color-mode.tsx deleted file mode 100644 index 09868064..00000000 --- a/benchmark/next-mui/src/components/ui/color-mode.tsx +++ /dev/null @@ -1,62 +0,0 @@ -'use client' - -import type { IconButtonProps } from '@chakra-ui/react' -import { ClientOnly, IconButton, Skeleton } from '@chakra-ui/react' -import type { ThemeProviderProps } from 'next-themes' -import { ThemeProvider, useTheme } from 'next-themes' -import * as React from 'react' -import { LuMoon, LuSun } from 'react-icons/lu' - -export type ColorModeProviderProps = ThemeProviderProps - -export function ColorMode(props: ColorModeProviderProps) { - return ( - - ) -} - -export function useColorMode() { - const { resolvedTheme, setTheme } = useTheme() - const toggleColorMode = () => { - setTheme(resolvedTheme === 'light' ? 'dark' : 'light') - } - return { - colorMode: resolvedTheme, - setColorMode: setTheme, - toggleColorMode, - } -} - -export function ColorModeIcon() { - const { colorMode } = useColorMode() - return colorMode === 'light' ? : -} - -type ColorModeButtonProps = Omit - -export const ColorModeButton = React.forwardRef< - HTMLButtonElement, - ColorModeButtonProps ->(function ColorModeButton(props, ref) { - const { toggleColorMode } = useColorMode() - return ( - }> - - - - - ) -}) diff --git a/benchmark/next-mui/src/components/ui/dialog.tsx b/benchmark/next-mui/src/components/ui/dialog.tsx deleted file mode 100644 index 4acb4988..00000000 --- a/benchmark/next-mui/src/components/ui/dialog.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { Dialog as ChakraDialog, Portal } from '@chakra-ui/react' -import * as React from 'react' - -import { CloseButton } from './close-button' - -interface DialogContentProps extends ChakraDialog.ContentProps { - portalled?: boolean - portalRef?: React.RefObject - backdrop?: boolean -} - -export const DialogContent = React.forwardRef< - HTMLDivElement, - DialogContentProps ->(function DialogContent(props, ref) { - const { - children, - portalled = true, - portalRef, - backdrop = true, - ...rest - } = props - - return ( - - {backdrop && } - - - {children} - - - - ) -}) - -export const DialogCloseTrigger = React.forwardRef< - HTMLButtonElement, - ChakraDialog.CloseTriggerProps ->(function DialogCloseTrigger(props, ref) { - return ( - - - {props.children} - - - ) -}) - -export const DialogRoot = ChakraDialog.Root -export const DialogFooter = ChakraDialog.Footer -export const DialogHeader = ChakraDialog.Header -export const DialogBody = ChakraDialog.Body -export const DialogBackdrop = ChakraDialog.Backdrop -export const DialogTitle = ChakraDialog.Title -export const DialogDescription = ChakraDialog.Description -export const DialogTrigger = ChakraDialog.Trigger -export const DialogActionTrigger = ChakraDialog.ActionTrigger - -export function Dialog() { - return <> -} diff --git a/benchmark/next-mui/src/components/ui/drawer.tsx b/benchmark/next-mui/src/components/ui/drawer.tsx deleted file mode 100644 index fac17981..00000000 --- a/benchmark/next-mui/src/components/ui/drawer.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import { Drawer as ChakraDrawer, Portal } from '@chakra-ui/react' -import * as React from 'react' - -import { CloseButton } from './close-button' - -interface DrawerContentProps extends ChakraDrawer.ContentProps { - portalled?: boolean - portalRef?: React.RefObject - offset?: ChakraDrawer.ContentProps['padding'] -} - -export const DrawerContent = React.forwardRef< - HTMLDivElement, - DrawerContentProps ->(function DrawerContent(props, ref) { - const { children, portalled = true, portalRef, offset, ...rest } = props - return ( - - - - {children} - - - - ) -}) - -export const DrawerCloseTrigger = React.forwardRef< - HTMLButtonElement, - ChakraDrawer.CloseTriggerProps ->(function DrawerCloseTrigger(props, ref) { - return ( - - - - ) -}) - -export const DrawerTrigger = ChakraDrawer.Trigger -export const DrawerRoot = ChakraDrawer.Root -export const DrawerFooter = ChakraDrawer.Footer -export const DrawerHeader = ChakraDrawer.Header -export const DrawerBody = ChakraDrawer.Body -export const DrawerBackdrop = ChakraDrawer.Backdrop -export const DrawerDescription = ChakraDrawer.Description -export const DrawerTitle = ChakraDrawer.Title -export const DrawerActionTrigger = ChakraDrawer.ActionTrigger - -export function Drawer() { - return <> -} diff --git a/benchmark/next-mui/src/components/ui/field.tsx b/benchmark/next-mui/src/components/ui/field.tsx deleted file mode 100644 index f99747be..00000000 --- a/benchmark/next-mui/src/components/ui/field.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { Field as ChakraField } from '@chakra-ui/react' -import * as React from 'react' - -export interface FieldProps extends Omit { - label?: React.ReactNode - helperText?: React.ReactNode - errorText?: React.ReactNode - optionalText?: React.ReactNode -} - -export const Field = React.forwardRef( - function Field(props, ref) { - const { label, children, helperText, errorText, optionalText, ...rest } = - props - return ( - - {label && ( - - {label} - - - )} - {children} - {helperText && ( - {helperText} - )} - {errorText && ( - {errorText} - )} - - ) - }, -) diff --git a/benchmark/next-mui/src/components/ui/input-group.tsx b/benchmark/next-mui/src/components/ui/input-group.tsx deleted file mode 100644 index 55bf0d18..00000000 --- a/benchmark/next-mui/src/components/ui/input-group.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import type { BoxProps, InputElementProps } from '@chakra-ui/react' -import { Group, InputElement } from '@chakra-ui/react' -import * as React from 'react' - -export interface InputGroupProps extends BoxProps { - startElementProps?: InputElementProps - endElementProps?: InputElementProps - startElement?: React.ReactNode - endElement?: React.ReactNode - children: React.ReactElement - startOffset?: InputElementProps['paddingStart'] - endOffset?: InputElementProps['paddingEnd'] -} - -export const InputGroup = React.forwardRef( - function InputGroup(props, ref) { - const { - startElement, - startElementProps, - endElement, - endElementProps, - children, - startOffset = '6px', - endOffset = '6px', - ...rest - } = props - - const child = - React.Children.only>(children) - - return ( - - {startElement && ( - - {startElement} - - )} - {React.cloneElement(child, { - ...(startElement && { - ps: `calc(var(--input-height) - ${startOffset})`, - }), - ...(endElement && { pe: `calc(var(--input-height) - ${endOffset})` }), - ...children.props, - })} - {endElement && ( - - {endElement} - - )} - - ) - }, -) diff --git a/benchmark/next-mui/src/components/ui/popover.tsx b/benchmark/next-mui/src/components/ui/popover.tsx deleted file mode 100644 index 8613b609..00000000 --- a/benchmark/next-mui/src/components/ui/popover.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import { Popover as ChakraPopover, Portal } from '@chakra-ui/react' -import * as React from 'react' - -import { CloseButton } from './close-button' - -interface PopoverContentProps extends ChakraPopover.ContentProps { - portalled?: boolean - portalRef?: React.RefObject -} - -export const PopoverContent = React.forwardRef< - HTMLDivElement, - PopoverContentProps ->(function PopoverContent(props, ref) { - const { portalled = true, portalRef, ...rest } = props - return ( - - - - - - ) -}) - -export const PopoverArrow = React.forwardRef< - HTMLDivElement, - ChakraPopover.ArrowProps ->(function PopoverArrow(props, ref) { - return ( - - - - ) -}) - -export const PopoverCloseTrigger = React.forwardRef< - HTMLButtonElement, - ChakraPopover.CloseTriggerProps ->(function PopoverCloseTrigger(props, ref) { - return ( - - - - ) -}) - -export const PopoverTitle = ChakraPopover.Title -export const PopoverDescription = ChakraPopover.Description -export const PopoverFooter = ChakraPopover.Footer -export const PopoverHeader = ChakraPopover.Header -export const PopoverRoot = ChakraPopover.Root -export const PopoverBody = ChakraPopover.Body -export const PopoverTrigger = ChakraPopover.Trigger - -export function Popover() { - return <> -} diff --git a/benchmark/next-mui/src/components/ui/provider.tsx b/benchmark/next-mui/src/components/ui/provider.tsx deleted file mode 100644 index 6a918af4..00000000 --- a/benchmark/next-mui/src/components/ui/provider.tsx +++ /dev/null @@ -1,13 +0,0 @@ -'use client' - -import { ChakraProvider, defaultSystem } from '@chakra-ui/react' - -import { ColorMode, type ColorModeProviderProps } from './color-mode' - -export function Provider(props: ColorModeProviderProps) { - return ( - - - - ) -} diff --git a/benchmark/next-mui/src/components/ui/radio.tsx b/benchmark/next-mui/src/components/ui/radio.tsx deleted file mode 100644 index c5d5c85b..00000000 --- a/benchmark/next-mui/src/components/ui/radio.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { RadioGroup as ChakraRadioGroup } from '@chakra-ui/react' -import * as React from 'react' - -export interface RadioProps extends ChakraRadioGroup.ItemProps { - rootRef?: React.Ref - inputProps?: React.InputHTMLAttributes -} - -export const Radio = React.forwardRef( - function Radio(props, ref) { - const { children, inputProps, rootRef, ...rest } = props - return ( - - - - {children && ( - {children} - )} - - ) - }, -) - -export const RadioGroup = ChakraRadioGroup.Root diff --git a/benchmark/next-mui/src/components/ui/slider.tsx b/benchmark/next-mui/src/components/ui/slider.tsx deleted file mode 100644 index 113d1363..00000000 --- a/benchmark/next-mui/src/components/ui/slider.tsx +++ /dev/null @@ -1,82 +0,0 @@ -import { For, HStack, Slider as ChakraSlider } from '@chakra-ui/react' -import * as React from 'react' - -export interface SliderProps extends ChakraSlider.RootProps { - marks?: Array - label?: React.ReactNode - showValue?: boolean -} - -export const Slider = React.forwardRef( - function Slider(props, ref) { - const { marks: marksProp, label, showValue, ...rest } = props - const value = props.defaultValue ?? props.value - - const marks = marksProp?.map((mark) => { - if (typeof mark === 'number') return { value: mark, label: undefined } - return mark - }) - - const hasMarkLabel = !!marks?.some((mark) => mark.label) - - return ( - - {label && !showValue && ( - {label} - )} - {label && showValue && ( - - {label} - - - )} - - - - - - - - - ) - }, -) - -function SliderThumbs(props: { value?: number[] }) { - const { value } = props - return ( - - {(_, index) => ( - - - - )} - - ) -} - -interface SliderMarksProps { - marks?: Array -} - -const SliderMarks = React.forwardRef( - function SliderMarks(props, ref) { - const { marks } = props - if (!marks?.length) return null - - return ( - - {marks.map((mark, index) => { - const value = typeof mark === 'number' ? mark : mark.value - const label = typeof mark === 'number' ? undefined : mark.label - return ( - - - {label} - - ) - })} - - ) - }, -) diff --git a/benchmark/next-mui/src/components/ui/tooltip.tsx b/benchmark/next-mui/src/components/ui/tooltip.tsx deleted file mode 100644 index 1d91a73b..00000000 --- a/benchmark/next-mui/src/components/ui/tooltip.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { Portal, Tooltip as ChakraTooltip } from '@chakra-ui/react' -import * as React from 'react' - -export interface TooltipProps extends ChakraTooltip.RootProps { - showArrow?: boolean - portalled?: boolean - portalRef?: React.RefObject - content: React.ReactNode - contentProps?: ChakraTooltip.ContentProps - disabled?: boolean -} - -export const Tooltip = React.forwardRef( - function Tooltip(props, ref) { - const { - showArrow, - children, - disabled, - portalled, - content, - contentProps, - portalRef, - ...rest - } = props - - if (disabled) return children - - return ( - - {children} - - - - {showArrow && ( - - - - )} - {content} - - - - - ) - }, -)