-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
ce8c247
commit 15e093e
Showing
36 changed files
with
480 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@saas-ui/react': minor | ||
--- | ||
|
||
Added new components, Accordion, Alert, Checkbox, HoverCard |
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
54 changes: 54 additions & 0 deletions
54
packages/saas-ui-react/src/components/accordion/accordion.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
'use client' | ||
|
||
import * as React from 'react' | ||
|
||
import { Accordion } from '@chakra-ui/react' | ||
|
||
import { ChevronRightIcon } from '../icons/icons.tsx' | ||
|
||
export interface ItemTriggerProps extends Accordion.ItemTriggerProps { | ||
indicatorIcon?: React.ReactNode | ||
indicatorPlacement?: 'start' | 'end' | ||
} | ||
|
||
export const ItemTrigger = React.forwardRef< | ||
HTMLButtonElement, | ||
ItemTriggerProps | ||
>(function AccordionItemTrigger(props, ref) { | ||
const { | ||
children, | ||
indicatorPlacement = 'end', | ||
indicatorIcon = <ChevronRightIcon />, | ||
...rest | ||
} = props | ||
|
||
const indicator = ( | ||
<Accordion.ItemIndicator>{indicatorIcon}</Accordion.ItemIndicator> | ||
) | ||
|
||
return ( | ||
<Accordion.ItemTrigger {...rest} ref={ref}> | ||
{indicatorPlacement === 'start' && indicator} | ||
{children} | ||
{indicatorPlacement === 'end' && indicator} | ||
</Accordion.ItemTrigger> | ||
) | ||
}) | ||
|
||
export interface ItemContentProps extends Accordion.ItemContentProps {} | ||
|
||
export const ItemContent = React.forwardRef<HTMLDivElement, ItemContentProps>( | ||
function AccordionItemContent(props, ref) { | ||
return ( | ||
<Accordion.ItemContent> | ||
<Accordion.ItemBody {...props} ref={ref} /> | ||
</Accordion.ItemContent> | ||
) | ||
}, | ||
) | ||
|
||
export const Root = Accordion.Root | ||
export const Item = Accordion.Item | ||
|
||
export type RootProps = Accordion.RootProps | ||
export type ItemProps = Accordion.ItemProps |
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 @@ | ||
export * as Accordion from './accordion.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
'use client' | ||
|
||
import { forwardRef } from 'react' | ||
|
||
import { Alert as AlertPrimitive } from '@chakra-ui/react' | ||
|
||
import { CloseButton } from '../close-button' | ||
|
||
export interface AlertProps extends Omit<AlertPrimitive.RootProps, 'title'> { | ||
startElement?: React.ReactNode | ||
endElement?: React.ReactNode | ||
title?: React.ReactNode | ||
icon?: React.ReactElement | ||
closable?: boolean | ||
onClose?: () => void | ||
} | ||
|
||
export const Alert = forwardRef<HTMLDivElement, AlertProps>( | ||
function Alert(props, ref) { | ||
const { | ||
title, | ||
children, | ||
icon, | ||
closable, | ||
onClose, | ||
startElement, | ||
endElement, | ||
...rest | ||
} = props | ||
return ( | ||
<AlertPrimitive.Root ref={ref} {...rest}> | ||
{startElement || ( | ||
<AlertPrimitive.Indicator>{icon}</AlertPrimitive.Indicator> | ||
)} | ||
{children ? ( | ||
<AlertPrimitive.Content> | ||
<AlertPrimitive.Title>{title}</AlertPrimitive.Title> | ||
<AlertPrimitive.Description>{children}</AlertPrimitive.Description> | ||
</AlertPrimitive.Content> | ||
) : ( | ||
<AlertPrimitive.Title flex="1">{title}</AlertPrimitive.Title> | ||
)} | ||
{endElement} | ||
{closable && ( | ||
<CloseButton | ||
size="sm" | ||
pos="relative" | ||
top="-2" | ||
insetEnd="-2" | ||
alignSelf="flex-start" | ||
onClick={onClose} | ||
/> | ||
)} | ||
</AlertPrimitive.Root> | ||
) | ||
}, | ||
) |
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 @@ | ||
export { Alert, type AlertProps } from './alert.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { Badge, type BadgeProps } from '@chakra-ui/react' | ||
export { Badge, BadgePropsProvider, type BadgeProps } from '@chakra-ui/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
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,2 @@ | ||
export { ButtonGroup } from '@chakra-ui/react/button' | ||
export type { ButtonGroupProps } from '@chakra-ui/react/button' |
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 +1,3 @@ | ||
'use client' | ||
|
||
export { Card } from '@chakra-ui/react' |
3 changes: 2 additions & 1 deletion
3
...eact/src/theme/recipes/chakra/checkbox.ts → ...rc/components/checkbox/checkbox.recipe.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
File renamed without changes.
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 @@ | ||
export { Checkmark, type CheckmarkProps } from '@chakra-ui/react' |
97 changes: 97 additions & 0 deletions
97
packages/saas-ui-react/src/components/clipboard/clipboard.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import * as React from 'react' | ||
|
||
import { Clipboard as ChakraClipboard } from '@chakra-ui/react' | ||
|
||
import { Button, type ButtonProps } from '../button' | ||
import { IconButton, type IconButtonProps } from '../icon-button' | ||
import { CheckIcon, CopyIcon } from '../icons' | ||
import { Input, type InputProps } from '../input' | ||
|
||
const ClipboardIcon = React.forwardRef< | ||
HTMLDivElement, | ||
ChakraClipboard.IndicatorProps | ||
>(function ClipboardIndicator(props, ref) { | ||
const { children = <CopyIcon />, copied = <CheckIcon />, ...rest } = props | ||
return ( | ||
<ChakraClipboard.Indicator copied={copied} {...rest} ref={ref}> | ||
{children} | ||
</ChakraClipboard.Indicator> | ||
) | ||
}) | ||
|
||
const ClipboardCopyText = React.forwardRef< | ||
HTMLDivElement, | ||
ChakraClipboard.IndicatorProps | ||
>(function ClipboardCopyText(props, ref) { | ||
const { children = 'Copy', copied = 'Copied', ...rest } = props | ||
return ( | ||
<ChakraClipboard.Indicator copied={copied} {...rest} ref={ref}> | ||
{children} | ||
</ChakraClipboard.Indicator> | ||
) | ||
}) | ||
|
||
interface ClipboardButtonProps extends ButtonProps { | ||
icon?: React.ReactNode | ||
copiedIcon?: React.ReactNode | ||
copied?: string | ||
} | ||
|
||
const ClipboardButton = React.forwardRef< | ||
HTMLButtonElement, | ||
ClipboardButtonProps | ||
>(function ClipboardButton(props, ref) { | ||
const { icon, copiedIcon, copied, children, ...rest } = props | ||
return ( | ||
<ChakraClipboard.Trigger asChild> | ||
<Button ref={ref} {...rest}> | ||
<ClipboardIcon copied={copiedIcon}>{icon}</ClipboardIcon> | ||
<ClipboardCopyText copied={copied}>{children}</ClipboardCopyText> | ||
</Button> | ||
</ChakraClipboard.Trigger> | ||
) | ||
}) | ||
|
||
interface ClipboardIconButtonProps extends IconButtonProps { | ||
icon?: React.ReactNode | ||
copiedIcon?: React.ReactNode | ||
} | ||
|
||
const ClipboardIconButton = React.forwardRef< | ||
HTMLButtonElement, | ||
ClipboardIconButtonProps | ||
>(function ClipboardIconButton(props, ref) { | ||
const { icon, copiedIcon, ...rest } = props | ||
return ( | ||
<ChakraClipboard.Trigger asChild> | ||
<IconButton ref={ref} size="xs" {...rest}> | ||
<ClipboardIcon copied={copiedIcon}>{icon}</ClipboardIcon> | ||
</IconButton> | ||
</ChakraClipboard.Trigger> | ||
) | ||
}) | ||
|
||
const ClipboardInput = React.forwardRef<HTMLInputElement, InputProps>( | ||
function ClipboardInputElement(props, ref) { | ||
return ( | ||
<ChakraClipboard.Input asChild> | ||
<Input ref={ref} {...props} /> | ||
</ChakraClipboard.Input> | ||
) | ||
}, | ||
) | ||
|
||
const ClipboardRoot = ChakraClipboard.Root | ||
const ClipboardLabel = ChakraClipboard.Label | ||
|
||
export { | ||
ClipboardButton as Button, | ||
ClipboardIconButton as IconButton, | ||
ClipboardInput as Input, | ||
ClipboardLabel as Label, | ||
ClipboardRoot as Root, | ||
} | ||
|
||
type ClipboardRootProps = ChakraClipboard.RootProps | ||
|
||
export type { ClipboardRootProps as RootProps } |
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 @@ | ||
export * as Clipboard from './clipboard' |
Oops, something went wrong.