-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from sippy-platform/0.13
Mellow UI 0.13
- Loading branch information
Showing
20 changed files
with
1,631 additions
and
408 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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,35 @@ | ||
import React, { ReactNode } from 'react'; | ||
|
||
import clsx from 'clsx'; | ||
|
||
export interface DialogFooterProps { | ||
/** | ||
* Custom classes for the dialog header | ||
*/ | ||
className?: string; | ||
/** | ||
* Contents of the dialog header | ||
*/ | ||
children?: ReactNode; | ||
} | ||
|
||
/** | ||
* Primary UI component for user interaction | ||
*/ | ||
export const DialogFooter = ({ | ||
className, | ||
children | ||
}: DialogFooterProps) => { | ||
return ( | ||
<div | ||
className={clsx( | ||
'dialog-footer', | ||
className | ||
)} | ||
> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
export default DialogFooter; |
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 { default } from './DialogFooter'; | ||
export type { DialogFooterProps } from './DialogFooter'; |
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,53 @@ | ||
import { Menu } from '@headlessui/react'; | ||
import clsx from 'clsx'; | ||
import React, { ReactNode } from 'react'; | ||
|
||
export interface DropdownProps { | ||
/** | ||
* The color of the button, only works when the variant is `color` or `hover` | ||
*/ | ||
color?: 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'teal' | 'cyan' | 'blue' | 'indigo' | 'violet' | 'purple' | 'pink' | 'rose' | 'brown' | 'grey' | 'accent'; | ||
/** | ||
* Value of the textarea | ||
*/ | ||
trigger: ReactNode; | ||
/** | ||
* Custom classes for the label | ||
*/ | ||
className?: string; | ||
/** | ||
* Custom classes for the label | ||
*/ | ||
children?: ReactNode; | ||
} | ||
|
||
/** | ||
* Primary UI component for user interaction | ||
*/ | ||
export const Dropdown = ({ | ||
className, | ||
color, | ||
trigger, | ||
children, | ||
...props | ||
}: DropdownProps) => { | ||
return ( | ||
<div className="dropdown"> | ||
<Menu> | ||
<Menu.Button as={React.Fragment}>{trigger}</Menu.Button> | ||
<Menu.Items | ||
className={clsx( | ||
'dropdown-menu', | ||
color, | ||
className | ||
)} | ||
{...props} | ||
> | ||
{children} | ||
</Menu.Items> | ||
</Menu> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Dropdown; |
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 { default } from './Dropdown'; | ||
export type { DropdownProps } from './Dropdown'; |
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,70 @@ | ||
import { Menu } from '@headlessui/react'; | ||
import clsx from 'clsx'; | ||
import React, { ElementType, ReactNode, useMemo } from 'react'; | ||
|
||
export interface DropdownItemProps<T> { | ||
/** | ||
* The color of the button, only works when the variant is `color` or `hover` | ||
*/ | ||
color?: 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'teal' | 'cyan' | 'blue' | 'indigo' | 'violet' | 'purple' | 'pink' | 'rose' | 'brown' | 'grey' | 'accent'; | ||
/** | ||
* Button disabled state. | ||
*/ | ||
disabled?: boolean; | ||
/** | ||
* If we have a href, it's an anchor. | ||
*/ | ||
href?: string; | ||
/** | ||
* Custom classes for the label | ||
*/ | ||
className?: string; | ||
/** | ||
* As what the component should be rendered | ||
*/ | ||
as?: T; | ||
/** | ||
* Custom classes for the label | ||
*/ | ||
children?: ReactNode; | ||
} | ||
|
||
/** | ||
* Primary UI component for user interaction | ||
*/ | ||
export function Dropdown<T>({ | ||
href, | ||
className, | ||
as, | ||
color, | ||
disabled = false, | ||
children, | ||
...props | ||
}: DropdownItemProps<T>) { | ||
const Component = useMemo(() => (as ? as : (href ? 'a' : 'button')) as ElementType, [as, href]); | ||
|
||
return ( | ||
<Menu.Item> | ||
{({ active }) => ( | ||
<Component | ||
type="button" | ||
className={clsx( | ||
'dropdown-item', | ||
{ | ||
'active': active, | ||
}, | ||
color, | ||
className | ||
)} | ||
href={href} | ||
disabled={disabled} | ||
{...props} | ||
> | ||
{children} | ||
</Component> | ||
)} | ||
</Menu.Item> | ||
); | ||
}; | ||
|
||
export default Dropdown; |
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 { default } from './DropdownItem'; | ||
export type { DropdownItemProps } from './DropdownItem'; |
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,37 @@ | ||
import React, { ReactNode } from 'react'; | ||
|
||
import { Dialog } from '@headlessui/react'; | ||
|
||
import clsx from 'clsx'; | ||
|
||
export interface PlaceholderProps { | ||
/** | ||
* Custom classes for the placeholder | ||
*/ | ||
className?: string; | ||
/** | ||
* The width of the placeholder | ||
*/ | ||
width?: 0 | 1 | 2 | 3 | 4 | 5 | 25 | 50 | 75 | 100 | 'auto'; | ||
} | ||
|
||
/** | ||
* Primary UI component for user interaction | ||
*/ | ||
export const Placeholder = ({ | ||
width, | ||
className | ||
}: PlaceholderProps) => { | ||
return ( | ||
<span | ||
className={clsx( | ||
'placeholder', | ||
'me-1', | ||
`w-${width}`, | ||
className | ||
)} | ||
/> | ||
); | ||
}; | ||
|
||
export default Placeholder; |
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 { default } from './Placeholder'; | ||
export type { PlaceholderProps } from './Placeholder'; |
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
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.