123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314 |
- import * as DropdownMenu from '@radix-ui/react-dropdown-menu'
- import * as RadioGroup from '@radix-ui/react-radio-group'
- import * as Panel from './panel'
- import styled from 'styles'
-
- export const breakpoints: any = { '@initial': 'mobile', '@sm': 'small' }
-
- export const IconButton = styled('button', {
- height: '32px',
- width: '32px',
- backgroundColor: '$panel',
- borderRadius: '4px',
- padding: '0',
- margin: '0',
- display: 'grid',
- alignItems: 'center',
- justifyContent: 'center',
- outline: 'none',
- border: 'none',
- pointerEvents: 'all',
- cursor: 'pointer',
-
- '& > *': {
- gridRow: 1,
- gridColumn: 1,
- },
-
- '&:disabled': {
- opacity: '0.5',
- },
-
- '& > span': {
- width: '100%',
- height: '100%',
- display: 'flex',
- alignItems: 'center',
- },
-
- variants: {
- bp: {
- mobile: {},
- small: {
- '&:hover:not(:disabled)': {
- backgroundColor: '$hover',
- },
- },
- },
- size: {
- small: {
- '& svg': {
- height: '16px',
- width: '16px',
- },
- },
- medium: {
- height: 44,
- width: 44,
- '& svg': {
- height: '20px',
- width: '20px',
- },
- },
- large: {
- height: 44,
- width: 44,
- '& svg': {
- height: '24px',
- width: '24px',
- },
- },
- },
- isActive: {
- true: {
- color: '$selected',
- },
- },
- },
- })
-
- export const RowButton = styled('button', {
- position: 'relative',
- display: 'flex',
- width: '100%',
- background: 'none',
- height: '32px',
- border: 'none',
- cursor: 'pointer',
- outline: 'none',
- alignItems: 'center',
- fontFamily: '$ui',
- fontWeight: 400,
- fontSize: '$1',
- justifyContent: 'space-between',
- padding: '4px 6px 4px 12px',
- borderRadius: 4,
-
- '& label': {
- fontWeight: '$1',
- margin: 0,
- padding: 0,
- },
-
- '& svg': {
- position: 'relative',
- stroke: 'rgba(0,0,0,.2)',
- strokeWidth: 1,
- zIndex: 1,
- },
-
- '& :disabled': {
- opacity: 0.5,
- },
-
- variants: {
- bp: {
- mobile: {},
- small: {
- '&:hover:not(:disabled)': {
- backgroundColor: '$hover',
- },
- },
- },
- size: {
- icon: {
- padding: '4px ',
- width: 'auto',
- },
- },
- variant: {
- pageButton: {
- paddingRight: 12,
- },
- },
- },
- })
-
- export const StylePanelRoot = styled(Panel.Root, {
- minWidth: 1,
- width: 184,
- maxWidth: 184,
- overflow: 'hidden',
- position: 'relative',
- border: '1px solid $panel',
- boxShadow: '0px 2px 4px rgba(0,0,0,.12)',
-
- variants: {
- isOpen: {
- true: {},
- false: {
- padding: 2,
- height: 38,
- width: 38,
- },
- },
- },
- })
-
- export const Group = styled(RadioGroup.Root, {
- display: 'flex',
- })
-
- export const Item = styled('button', {
- height: '32px',
- width: '32px',
- backgroundColor: '$panel',
- borderRadius: '4px',
- padding: '0',
- margin: '0',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- outline: 'none',
- border: 'none',
- pointerEvents: 'all',
- cursor: 'pointer',
-
- '&:hover:not(:disabled)': {
- backgroundColor: '$hover',
- '& svg': {
- stroke: '$text',
- fill: '$text',
- strokeWidth: '0',
- },
- },
-
- '&:disabled': {
- opacity: '0.5',
- },
-
- variants: {
- isActive: {
- true: {
- '& svg': {
- fill: '$text',
- stroke: '$text',
- },
- },
- false: {
- '& svg': {
- fill: '$inactive',
- stroke: '$inactive',
- },
- },
- },
- },
- })
-
- export const IconWrapper = styled('div', {
- height: '100%',
- borderRadius: '4px',
- marginRight: '1px',
- display: 'grid',
- alignItems: 'center',
- justifyContent: 'center',
- outline: 'none',
- border: 'none',
- pointerEvents: 'all',
- cursor: 'pointer',
-
- '& svg': {
- height: 22,
- width: 22,
- strokeWidth: 1,
- },
-
- '& > *': {
- gridRow: 1,
- gridColumn: 1,
- },
-
- variants: {
- size: {
- small: {
- '& svg': {
- height: '16px',
- width: '16px',
- },
- },
- medium: {
- '& svg': {
- height: '22px',
- width: '22px',
- },
- },
- },
- },
- })
-
- export const DropdownContent = styled(DropdownMenu.Content, {
- display: 'grid',
- padding: 4,
- gridTemplateColumns: 'repeat(4, 1fr)',
- backgroundColor: '$panel',
- borderRadius: 4,
- border: '1px solid $panel',
- boxShadow: '0px 2px 4px rgba(0,0,0,.28)',
-
- variants: {
- direction: {
- vertical: {
- gridTemplateColumns: '1fr',
- },
- },
- },
- })
-
- export function DashSolidIcon(): JSX.Element {
- return (
- <svg width="24" height="24" stroke="currentColor">
- <circle
- cx={12}
- cy={12}
- r={8}
- fill="none"
- strokeWidth={2}
- strokeLinecap="round"
- />
- </svg>
- )
- }
-
- export function DashDashedIcon(): JSX.Element {
- return (
- <svg width="24" height="24" stroke="currentColor">
- <circle
- cx={12}
- cy={12}
- r={8}
- fill="none"
- strokeWidth={2.5}
- strokeLinecap="round"
- strokeDasharray={50.26548 * 0.1}
- />
- </svg>
- )
- }
-
- const dottedDasharray = `${50.26548 * 0.025} ${50.26548 * 0.1}`
-
- export function DashDottedIcon(): JSX.Element {
- return (
- <svg width="24" height="24" stroke="currentColor">
- <circle
- cx={12}
- cy={12}
- r={8}
- fill="none"
- strokeWidth={2.5}
- strokeLinecap="round"
- strokeDasharray={dottedDasharray}
- />
- </svg>
- )
- }
|