@spies-ui/react 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +4 -1
- package/.eslintrc.json +0 -3
- package/.turbo/turbo-build.log +0 -18
- package/CHANGELOG.md +0 -13
- package/src/components/Avatar/index.tsx +0 -19
- package/src/components/Avatar/styles.ts +0 -31
- package/src/components/Box.tsx +0 -32
- package/src/components/Button.tsx +0 -102
- package/src/components/Checkbox/index.tsx +0 -28
- package/src/components/Checkbox/styles.ts +0 -84
- package/src/components/Dropdown/index.tsx +0 -98
- package/src/components/Dropdown/styles.ts +0 -75
- package/src/components/Heading.tsx +0 -32
- package/src/components/InputBox/index.tsx +0 -24
- package/src/components/InputBox/styles.ts +0 -7
- package/src/components/Text.tsx +0 -45
- package/src/components/TextArea/index.tsx +0 -21
- package/src/components/TextArea/styles.ts +0 -42
- package/src/components/TextInput/index.tsx +0 -26
- package/src/components/TextInput/styles.ts +0 -69
- package/src/index.tsx +0 -10
- package/src/styles/index.ts +0 -36
- package/tsconfig.json +0 -4
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spies-ui/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
8
11
|
"scripts": {
|
|
9
12
|
"build": "tsup src/index.tsx --format esm,cjs --dts --external react",
|
|
10
13
|
"dev": "tsup src/index.tsx --format esm,cjs --dts --external react --watch",
|
package/.eslintrc.json
DELETED
package/.turbo/turbo-build.log
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @spies-ui/react@1.0.2 build
|
|
3
|
-
> tsup src/index.tsx --format esm,cjs --dts --external react
|
|
4
|
-
|
|
5
|
-
[34mCLI[39m Building entry: src/index.tsx
|
|
6
|
-
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
-
[34mCLI[39m tsup v8.0.2
|
|
8
|
-
[34mCLI[39m Target: es6
|
|
9
|
-
[34mESM[39m Build start
|
|
10
|
-
[34mCJS[39m Build start
|
|
11
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m19.94 KB[39m
|
|
12
|
-
[32mESM[39m ⚡️ Build success in 42ms
|
|
13
|
-
[32mCJS[39m [1mdist/index.js [22m[32m21.52 KB[39m
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in 41ms
|
|
15
|
-
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in 3984ms
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m104.63 KB[39m
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m104.63 KB[39m
|
package/CHANGELOG.md
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from 'react'
|
|
2
|
-
import { AvatarContainer, AvatarFallback, AvatarImage } from './styles'
|
|
3
|
-
import { User } from 'phosphor-react'
|
|
4
|
-
|
|
5
|
-
export interface AvatarProps extends ComponentProps<typeof AvatarImage> {}
|
|
6
|
-
|
|
7
|
-
export function Avatar(props: AvatarProps) {
|
|
8
|
-
return (
|
|
9
|
-
<AvatarContainer>
|
|
10
|
-
<AvatarImage {...props} />
|
|
11
|
-
|
|
12
|
-
<AvatarFallback delayMs={600}>
|
|
13
|
-
<User />
|
|
14
|
-
</AvatarFallback>
|
|
15
|
-
</AvatarContainer>
|
|
16
|
-
)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
Avatar.displayName = 'Avatar'
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as Avatar from '@radix-ui/react-avatar'
|
|
2
|
-
import { styled } from '../../styles'
|
|
3
|
-
|
|
4
|
-
export const AvatarContainer = styled(Avatar.Root, {
|
|
5
|
-
borderRadius: '$full',
|
|
6
|
-
display: 'inline-block',
|
|
7
|
-
width: '$12',
|
|
8
|
-
height: '$12',
|
|
9
|
-
overflow: 'hidden',
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
export const AvatarImage = styled(Avatar.Image, {
|
|
13
|
-
width: '100%',
|
|
14
|
-
height: '100%',
|
|
15
|
-
objectFix: 'cover',
|
|
16
|
-
borderRadius: 'inherit',
|
|
17
|
-
})
|
|
18
|
-
export const AvatarFallback = styled(Avatar.Fallback, {
|
|
19
|
-
width: '100%',
|
|
20
|
-
height: '100%',
|
|
21
|
-
display: 'flex',
|
|
22
|
-
alignItems: 'center',
|
|
23
|
-
justifyContent: 'center',
|
|
24
|
-
backgroundColor: '$gray600',
|
|
25
|
-
color: '$gray800',
|
|
26
|
-
|
|
27
|
-
svg: {
|
|
28
|
-
width: '$6',
|
|
29
|
-
height: '$6',
|
|
30
|
-
},
|
|
31
|
-
})
|
package/src/components/Box.tsx
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ComponentProps, ElementType } from 'react'
|
|
2
|
-
import { styled } from '../styles'
|
|
3
|
-
|
|
4
|
-
export const Box = styled('div', {
|
|
5
|
-
padding: '$6',
|
|
6
|
-
borderRadius: '$md',
|
|
7
|
-
variants: {
|
|
8
|
-
background: {
|
|
9
|
-
default: {
|
|
10
|
-
backgroundColor: 'transparent',
|
|
11
|
-
},
|
|
12
|
-
gray600: {
|
|
13
|
-
backgroundColor: '$gray600',
|
|
14
|
-
},
|
|
15
|
-
gray700: {
|
|
16
|
-
backgroundColor: '$gray700',
|
|
17
|
-
},
|
|
18
|
-
gray800: {
|
|
19
|
-
backgroundColor: '$gray800',
|
|
20
|
-
},
|
|
21
|
-
gray900: {
|
|
22
|
-
backgroundColor: '$gray900',
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
export interface BoxProps extends ComponentProps<typeof Box> {
|
|
29
|
-
as?: ElementType
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
Box.displayName = 'Box'
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { ComponentProps, ElementType } from 'react'
|
|
2
|
-
import { styled } from '../styles'
|
|
3
|
-
|
|
4
|
-
export const Button = styled('button', {
|
|
5
|
-
all: 'unset',
|
|
6
|
-
fontFamily: '$default',
|
|
7
|
-
fontWeight: '$medium',
|
|
8
|
-
fontSize: '$sm',
|
|
9
|
-
textAlign: 'center',
|
|
10
|
-
minWidth: 0,
|
|
11
|
-
boxSizing: 'border-box',
|
|
12
|
-
|
|
13
|
-
display: 'flex',
|
|
14
|
-
alignItems: 'center',
|
|
15
|
-
justifyContent: 'center',
|
|
16
|
-
gap: '$2',
|
|
17
|
-
|
|
18
|
-
cursor: 'pointer',
|
|
19
|
-
|
|
20
|
-
transition: '0.2s',
|
|
21
|
-
|
|
22
|
-
svg: {
|
|
23
|
-
width: '$4',
|
|
24
|
-
height: '$4',
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
'&:disabled': {
|
|
28
|
-
cursor: 'not-allowed',
|
|
29
|
-
backgroundColor: '$gray200',
|
|
30
|
-
borderColor: '$gray200',
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
variants: {
|
|
34
|
-
variant: {
|
|
35
|
-
default: {
|
|
36
|
-
backgroundColor: 'transparent',
|
|
37
|
-
border: '2px solid $gray500',
|
|
38
|
-
color: '$smokedWhite',
|
|
39
|
-
|
|
40
|
-
'&:not(:disabled):hover': {
|
|
41
|
-
borderColor: '$gray600',
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
'&:focus': {
|
|
45
|
-
borderColor: '$primary',
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
primary: {
|
|
49
|
-
backgroundColor: '$primary',
|
|
50
|
-
border: '2px solid $primary',
|
|
51
|
-
color: '$smokedWhite',
|
|
52
|
-
|
|
53
|
-
'&:not(:disabled):hover': {
|
|
54
|
-
backgroundColor: '$primaryLight',
|
|
55
|
-
borderColor: '$primaryLight',
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
'&:focus': {
|
|
59
|
-
borderColor: '$smokedWhite',
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
size: {
|
|
65
|
-
default: {
|
|
66
|
-
padding: '$3 $6',
|
|
67
|
-
},
|
|
68
|
-
fit: {
|
|
69
|
-
width: '100%',
|
|
70
|
-
paddingTop: '$3',
|
|
71
|
-
paddingBottom: '$3',
|
|
72
|
-
},
|
|
73
|
-
small: {
|
|
74
|
-
padding: '$3 $4',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
radius: {
|
|
79
|
-
small: {
|
|
80
|
-
borderRadius: '$sm',
|
|
81
|
-
},
|
|
82
|
-
default: {
|
|
83
|
-
borderRadius: '$lg',
|
|
84
|
-
},
|
|
85
|
-
full: {
|
|
86
|
-
borderRadius: '$full',
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
defaultVariants: {
|
|
92
|
-
size: 'default',
|
|
93
|
-
radius: 'default',
|
|
94
|
-
variant: 'default',
|
|
95
|
-
},
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
export interface ButtonProps extends ComponentProps<typeof Button> {
|
|
99
|
-
as?: ElementType
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
Button.displayName = 'Button'
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Check } from 'phosphor-react'
|
|
2
|
-
import { CheckboxContainer, CheckboxIndicator, CheckboxBox } from './styles'
|
|
3
|
-
import { Text } from '../Text'
|
|
4
|
-
import { InputBox } from '../InputBox'
|
|
5
|
-
import { ComponentProps } from 'react'
|
|
6
|
-
|
|
7
|
-
export interface CheckboxProps
|
|
8
|
-
extends ComponentProps<typeof CheckboxContainer> {
|
|
9
|
-
label?: string
|
|
10
|
-
error?: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function Checkbox({ label, error, ...props }: CheckboxProps) {
|
|
14
|
-
return (
|
|
15
|
-
<InputBox error={error}>
|
|
16
|
-
<CheckboxBox>
|
|
17
|
-
<CheckboxContainer {...props} errored={!!error}>
|
|
18
|
-
<CheckboxIndicator asChild>
|
|
19
|
-
<Check weight="bold" />
|
|
20
|
-
</CheckboxIndicator>
|
|
21
|
-
</CheckboxContainer>
|
|
22
|
-
{!!label && <Text size="sm">{label}</Text>}
|
|
23
|
-
</CheckboxBox>
|
|
24
|
-
</InputBox>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
Checkbox.displayName = 'Checkbox'
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { styled, keyframes } from '../../styles'
|
|
2
|
-
import * as Checkbox from '@radix-ui/react-checkbox'
|
|
3
|
-
|
|
4
|
-
export const CheckboxBox = styled('div', {
|
|
5
|
-
display: 'flex',
|
|
6
|
-
gap: '$2',
|
|
7
|
-
|
|
8
|
-
'&:has(button:disabled)': {
|
|
9
|
-
opacity: 0.5,
|
|
10
|
-
},
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
export const CheckboxContainer = styled(Checkbox.Root, {
|
|
14
|
-
all: 'unset',
|
|
15
|
-
width: '$6',
|
|
16
|
-
height: '$6',
|
|
17
|
-
backgroundColor: '$gray900',
|
|
18
|
-
borderRadius: '$xs',
|
|
19
|
-
lineHeight: 0,
|
|
20
|
-
cursor: 'pointer',
|
|
21
|
-
overflow: 'hidden',
|
|
22
|
-
boxSizing: 'border-box',
|
|
23
|
-
display: 'flex',
|
|
24
|
-
justifyContent: 'center',
|
|
25
|
-
alignItems: 'center',
|
|
26
|
-
border: '2px solid $gray900',
|
|
27
|
-
|
|
28
|
-
'&[data-state="checked"]': {
|
|
29
|
-
backgroundColor: '$primary',
|
|
30
|
-
borderColor: '$primary',
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
'&:focus': {
|
|
34
|
-
border: '2px solid $primary',
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
'&:disabled': {
|
|
38
|
-
cursor: 'not-allowed',
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
variants: {
|
|
42
|
-
errored: {
|
|
43
|
-
true: {
|
|
44
|
-
borderColor: '$danger',
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
defaultVariants: {
|
|
50
|
-
errored: false,
|
|
51
|
-
},
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
const slideIn = keyframes({
|
|
55
|
-
from: {
|
|
56
|
-
transform: 'translateX(-100%)',
|
|
57
|
-
},
|
|
58
|
-
to: {
|
|
59
|
-
transform: 'translateX(0)',
|
|
60
|
-
},
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
const slideOut = keyframes({
|
|
64
|
-
from: {
|
|
65
|
-
transform: 'translateX(0)',
|
|
66
|
-
},
|
|
67
|
-
to: {
|
|
68
|
-
transform: 'translateX(100%)',
|
|
69
|
-
},
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
export const CheckboxIndicator = styled(Checkbox.Indicator, {
|
|
73
|
-
color: '$smokedWhite',
|
|
74
|
-
width: '$4',
|
|
75
|
-
height: '$4',
|
|
76
|
-
|
|
77
|
-
'&[data-state="checked"]': {
|
|
78
|
-
animation: `${slideIn} 100ms ease-out`,
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
'&[data-state="unchecked"]': {
|
|
82
|
-
animation: `${slideOut} 100ms ease-out`,
|
|
83
|
-
},
|
|
84
|
-
})
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { useRef, useState, useEffect } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
DropdownContainer,
|
|
4
|
-
DropdownList,
|
|
5
|
-
DropdownItem,
|
|
6
|
-
DropdownTrigger,
|
|
7
|
-
} from './styles'
|
|
8
|
-
import { Button } from './../Button'
|
|
9
|
-
|
|
10
|
-
export interface Option {
|
|
11
|
-
text: string
|
|
12
|
-
variant?: 'default' | 'danger'
|
|
13
|
-
onSelect: () => void
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface DropdownProps {
|
|
17
|
-
options: Option[]
|
|
18
|
-
name?: string
|
|
19
|
-
children?: React.ReactElement
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function Dropdown({ options, children, name }: DropdownProps) {
|
|
23
|
-
const [isOpen, setIsOpen] = useState(false)
|
|
24
|
-
const dropdownRef = useRef<HTMLUListElement>(null)
|
|
25
|
-
const buttonRef = useRef<HTMLButtonElement>(null)
|
|
26
|
-
|
|
27
|
-
const toggleDropdown = () => {
|
|
28
|
-
setIsOpen(!isOpen)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const handleSelectOption = (option: Option) => {
|
|
32
|
-
option.onSelect()
|
|
33
|
-
setIsOpen(false)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const handleClickOutside = (event: MouseEvent) => {
|
|
37
|
-
if (
|
|
38
|
-
dropdownRef.current &&
|
|
39
|
-
buttonRef.current &&
|
|
40
|
-
!dropdownRef.current.contains(event.target as Node) &&
|
|
41
|
-
!buttonRef.current.contains(event.target as Node)
|
|
42
|
-
) {
|
|
43
|
-
setIsOpen(false)
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
document.addEventListener('mousedown', handleClickOutside)
|
|
49
|
-
return () => {
|
|
50
|
-
document.removeEventListener('mousedown', handleClickOutside)
|
|
51
|
-
}
|
|
52
|
-
}, [])
|
|
53
|
-
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
const handleReposition = () => {
|
|
56
|
-
if (isOpen && buttonRef.current && dropdownRef.current) {
|
|
57
|
-
const buttonRect = buttonRef.current.getBoundingClientRect()
|
|
58
|
-
const dropdownRect = dropdownRef.current.getBoundingClientRect()
|
|
59
|
-
const buttonTop = buttonRect.top
|
|
60
|
-
const buttonHeight = buttonRect.height
|
|
61
|
-
const dropdownHeight = dropdownRect.height
|
|
62
|
-
|
|
63
|
-
const spaceBelow = window.innerHeight - buttonTop - buttonHeight
|
|
64
|
-
if (spaceBelow < dropdownHeight) {
|
|
65
|
-
dropdownRef.current.style.bottom = `${buttonHeight + 6}px`
|
|
66
|
-
} else {
|
|
67
|
-
dropdownRef.current.style.top = `${buttonHeight + 6}px`
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
handleReposition()
|
|
73
|
-
}, [isOpen])
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<DropdownContainer>
|
|
77
|
-
<DropdownTrigger ref={buttonRef} onClick={toggleDropdown}>
|
|
78
|
-
{name && children === undefined && <Button>{name}</Button>}
|
|
79
|
-
{children && name === undefined && children}
|
|
80
|
-
</DropdownTrigger>
|
|
81
|
-
{isOpen && (
|
|
82
|
-
<DropdownList ref={dropdownRef}>
|
|
83
|
-
{options.map((option, index) => (
|
|
84
|
-
<DropdownItem
|
|
85
|
-
key={index}
|
|
86
|
-
onClick={() => handleSelectOption(option)}
|
|
87
|
-
variant={option.variant}
|
|
88
|
-
>
|
|
89
|
-
{option.text}
|
|
90
|
-
</DropdownItem>
|
|
91
|
-
))}
|
|
92
|
-
</DropdownList>
|
|
93
|
-
)}
|
|
94
|
-
</DropdownContainer>
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
Dropdown.displayName = 'Dropdown'
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { styled, keyframes } from '../../styles'
|
|
2
|
-
|
|
3
|
-
export const DropdownContainer = styled('div', {
|
|
4
|
-
position: 'relative',
|
|
5
|
-
display: 'inline-block',
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
export const DropdownTrigger = styled('span', {})
|
|
9
|
-
|
|
10
|
-
const fadeIn = keyframes({
|
|
11
|
-
'0%': { opacity: '0' },
|
|
12
|
-
'100%': { opacity: '1' },
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
export const DropdownList = styled('ul', {
|
|
16
|
-
position: 'absolute',
|
|
17
|
-
// top: '100%',
|
|
18
|
-
// left: 0,
|
|
19
|
-
backgroundColor: '#18181B',
|
|
20
|
-
borderRadius: '$lg',
|
|
21
|
-
padding: 0,
|
|
22
|
-
// margin: '$1 0',
|
|
23
|
-
margin: 0,
|
|
24
|
-
listStyle: 'none',
|
|
25
|
-
zIndex: 9999,
|
|
26
|
-
minWidth: '100%', // ensures the dropdown list as wide as the container
|
|
27
|
-
|
|
28
|
-
left: '50%',
|
|
29
|
-
transform: 'translateX(-50%)',
|
|
30
|
-
|
|
31
|
-
animation: `${fadeIn} 100ms ease-out`,
|
|
32
|
-
|
|
33
|
-
'& li:first-child': {
|
|
34
|
-
marginTop: '$2',
|
|
35
|
-
},
|
|
36
|
-
'& li:last-child': {
|
|
37
|
-
marginBottom: '$2',
|
|
38
|
-
},
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
export const DropdownItem = styled('li', {
|
|
42
|
-
fontFamily: '$default',
|
|
43
|
-
fontSize: '$sm',
|
|
44
|
-
color: '$smokedWhite',
|
|
45
|
-
padding: '$2 $2',
|
|
46
|
-
marginLeft: '$2',
|
|
47
|
-
marginRight: '$2',
|
|
48
|
-
width: '$40',
|
|
49
|
-
borderRadius: '$md',
|
|
50
|
-
cursor: 'pointer',
|
|
51
|
-
|
|
52
|
-
variants: {
|
|
53
|
-
variant: {
|
|
54
|
-
default: {
|
|
55
|
-
color: '$smokedWhite',
|
|
56
|
-
|
|
57
|
-
'&:hover': {
|
|
58
|
-
backgroundColor: '$gray700',
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
danger: {
|
|
62
|
-
color: '$danger',
|
|
63
|
-
|
|
64
|
-
'&:hover': {
|
|
65
|
-
backgroundColor: '$danger',
|
|
66
|
-
color: '$smokedWhite',
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
defaultVariants: {
|
|
73
|
-
variant: 'default',
|
|
74
|
-
},
|
|
75
|
-
})
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ComponentProps, ElementType } from 'react'
|
|
2
|
-
import { styled } from '../styles'
|
|
3
|
-
|
|
4
|
-
export const Heading = styled('h2', {
|
|
5
|
-
fontFamily: '$heading',
|
|
6
|
-
lineHeight: '$shorter',
|
|
7
|
-
margin: 0,
|
|
8
|
-
color: '$smokedWhite',
|
|
9
|
-
|
|
10
|
-
variants: {
|
|
11
|
-
size: {
|
|
12
|
-
sm: { fontSize: '$xl' },
|
|
13
|
-
md: { fontSize: '$2xl' },
|
|
14
|
-
lg: { fontSize: '$4xl' },
|
|
15
|
-
'2xl': { fontSize: '$5xl' },
|
|
16
|
-
'3xl': { fontSize: '$5xl' },
|
|
17
|
-
'4xl': { fontSize: '$6xl' },
|
|
18
|
-
'5xl': { fontSize: '$7xl' },
|
|
19
|
-
'6xl': { fontSize: '$8xl' },
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
defaultVariants: {
|
|
24
|
-
size: 'md',
|
|
25
|
-
},
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
export interface HeadingProps extends ComponentProps<typeof Heading> {
|
|
29
|
-
as?: ElementType
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
Heading.displayName = 'Heading'
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Text } from '../Text'
|
|
2
|
-
import { InputContainer } from './styles'
|
|
3
|
-
|
|
4
|
-
export interface InputProps {
|
|
5
|
-
label?: string
|
|
6
|
-
children: React.ReactElement
|
|
7
|
-
error?: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function InputBox({ label, error, children }: InputProps) {
|
|
11
|
-
return (
|
|
12
|
-
<InputContainer>
|
|
13
|
-
{!!label && <Text size={'sm'}>{label}</Text>}
|
|
14
|
-
{children}
|
|
15
|
-
{!!error && (
|
|
16
|
-
<Text size="xs" variant="danger">
|
|
17
|
-
{error}
|
|
18
|
-
</Text>
|
|
19
|
-
)}
|
|
20
|
-
</InputContainer>
|
|
21
|
-
)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
InputBox.displayName = 'InputBox'
|
package/src/components/Text.tsx
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ComponentProps, ElementType } from 'react'
|
|
2
|
-
import { styled } from '../styles'
|
|
3
|
-
|
|
4
|
-
export const Text = styled('p', {
|
|
5
|
-
fontFamily: '$default',
|
|
6
|
-
lineHeight: '$base',
|
|
7
|
-
margin: 0,
|
|
8
|
-
color: '$smokedWhite',
|
|
9
|
-
|
|
10
|
-
variants: {
|
|
11
|
-
size: {
|
|
12
|
-
xxs: { fontSize: '$xxs' },
|
|
13
|
-
xs: { fontSize: '$xs' },
|
|
14
|
-
sm: { fontSize: '$sm' },
|
|
15
|
-
md: { fontSize: '$md' },
|
|
16
|
-
lg: { fontSize: '$lg' },
|
|
17
|
-
xl: { fontSize: '$xl' },
|
|
18
|
-
'2xl': { fontSize: '$2xl' },
|
|
19
|
-
'4xl': { fontSize: '$4xl' },
|
|
20
|
-
'5xl': { fontSize: '$5xl' },
|
|
21
|
-
'6xl': { fontSize: '$6xl' },
|
|
22
|
-
'7xl': { fontSize: '$7xl' },
|
|
23
|
-
'8xl': { fontSize: '$8xl' },
|
|
24
|
-
'9xl': { fontSize: '$9xl' },
|
|
25
|
-
},
|
|
26
|
-
variant: {
|
|
27
|
-
default: { color: '$smokedWhite' },
|
|
28
|
-
primary: { color: '$primary' },
|
|
29
|
-
danger: { color: '$danger' },
|
|
30
|
-
success: { color: '$success' },
|
|
31
|
-
warning: { color: '$warning' },
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
defaultVariants: {
|
|
36
|
-
size: 'md',
|
|
37
|
-
variant: 'default',
|
|
38
|
-
},
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
export interface TextProps extends ComponentProps<typeof Text> {
|
|
42
|
-
as?: ElementType
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
Text.displayName = 'Text'
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentProps, forwardRef, ElementRef } from 'react'
|
|
2
|
-
import { InputBox } from '../InputBox'
|
|
3
|
-
import { TextAreaInput } from './styles'
|
|
4
|
-
|
|
5
|
-
export interface TextAreaProps extends ComponentProps<typeof TextAreaInput> {
|
|
6
|
-
label?: string
|
|
7
|
-
error?: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const TextArea = forwardRef<
|
|
11
|
-
ElementRef<typeof TextAreaInput>,
|
|
12
|
-
TextAreaProps
|
|
13
|
-
>(({ label, error, ...props }: TextAreaProps, ref) => {
|
|
14
|
-
return (
|
|
15
|
-
<InputBox label={label} error={error}>
|
|
16
|
-
<TextAreaInput ref={ref} {...props} errored={!!error} />
|
|
17
|
-
</InputBox>
|
|
18
|
-
)
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
TextArea.displayName = 'TextArea'
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { styled } from '../../styles'
|
|
2
|
-
|
|
3
|
-
export const TextAreaInput = styled('textarea', {
|
|
4
|
-
backgroundColor: '$gray900',
|
|
5
|
-
padding: '$3 $4',
|
|
6
|
-
borderRadius: '$sm',
|
|
7
|
-
boxSizing: 'border-box',
|
|
8
|
-
border: '2px solid $gray900',
|
|
9
|
-
|
|
10
|
-
fontFamily: '$default',
|
|
11
|
-
fontSize: '$sm',
|
|
12
|
-
color: '$white',
|
|
13
|
-
fontWeight: '$regular',
|
|
14
|
-
resize: 'vertical',
|
|
15
|
-
minHeight: 80,
|
|
16
|
-
|
|
17
|
-
'&:focus': {
|
|
18
|
-
outline: 0,
|
|
19
|
-
borderColor: '$primary',
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
'&:disabled': {
|
|
23
|
-
opacity: 0.5,
|
|
24
|
-
cursor: 'not-allowed',
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
'&::placeholder': {
|
|
28
|
-
color: '$gray400',
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
variants: {
|
|
32
|
-
errored: {
|
|
33
|
-
true: {
|
|
34
|
-
borderColor: '$danger',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
defaultVariants: {
|
|
40
|
-
errored: false,
|
|
41
|
-
},
|
|
42
|
-
})
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ComponentProps, ElementRef, forwardRef } from 'react'
|
|
2
|
-
import { Input, Prefix, TextInputContainer } from './styles'
|
|
3
|
-
import { InputBox } from '../InputBox'
|
|
4
|
-
|
|
5
|
-
export interface TextInputProps
|
|
6
|
-
extends Omit<ComponentProps<typeof Input>, 'size'> {
|
|
7
|
-
label?: string
|
|
8
|
-
prefix?: string
|
|
9
|
-
error?: string
|
|
10
|
-
size?: 'default' | 'small'
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const TextInput = forwardRef<ElementRef<typeof Input>, TextInputProps>(
|
|
14
|
-
({ label, prefix, error, size, ...props }: TextInputProps, ref) => {
|
|
15
|
-
return (
|
|
16
|
-
<InputBox label={label} error={error}>
|
|
17
|
-
<TextInputContainer errored={!!error} size={size}>
|
|
18
|
-
{!!prefix && <Prefix>{prefix}</Prefix>}
|
|
19
|
-
<Input ref={ref} {...props} />
|
|
20
|
-
</TextInputContainer>
|
|
21
|
-
</InputBox>
|
|
22
|
-
)
|
|
23
|
-
},
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
TextInput.displayName = 'TextInput'
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { styled } from '../../styles'
|
|
2
|
-
|
|
3
|
-
export const TextInputContainer = styled('div', {
|
|
4
|
-
backgroundColor: '$gray900',
|
|
5
|
-
borderRadius: '$sm',
|
|
6
|
-
boxSizing: 'border-box',
|
|
7
|
-
border: '2px solid $gray900',
|
|
8
|
-
display: 'flex',
|
|
9
|
-
alignItems: 'center',
|
|
10
|
-
|
|
11
|
-
'&:has(input:focus)': {
|
|
12
|
-
borderColor: '$primary',
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
'&:has(input:disabled)': {
|
|
16
|
-
opacity: 0.5,
|
|
17
|
-
cursor: 'not-alowed',
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
variants: {
|
|
21
|
-
size: {
|
|
22
|
-
small: {
|
|
23
|
-
padding: '$2 $3',
|
|
24
|
-
},
|
|
25
|
-
default: {
|
|
26
|
-
padding: '$3 $4',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
errored: {
|
|
30
|
-
true: {
|
|
31
|
-
borderColor: '$danger',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
defaultVariants: {
|
|
37
|
-
size: 'default',
|
|
38
|
-
errored: false,
|
|
39
|
-
},
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
export const Prefix = styled('span', {
|
|
43
|
-
fontFamily: '$default',
|
|
44
|
-
fontSize: '$sm',
|
|
45
|
-
color: '$gray400',
|
|
46
|
-
fontWeight: 'regular',
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
export const Input = styled('input', {
|
|
50
|
-
fontFamily: '$default',
|
|
51
|
-
fontSize: '$sm',
|
|
52
|
-
color: '$smokedWhite',
|
|
53
|
-
fontWeight: 'regular',
|
|
54
|
-
background: 'transparent',
|
|
55
|
-
border: 0,
|
|
56
|
-
width: '100%',
|
|
57
|
-
|
|
58
|
-
'&:focus': {
|
|
59
|
-
outline: 0,
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
'&:disabled': {
|
|
63
|
-
cursor: 'not-allowed',
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
'&::placeholder': {
|
|
67
|
-
color: '$gray400',
|
|
68
|
-
},
|
|
69
|
-
})
|
package/src/index.tsx
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './components/Box'
|
|
2
|
-
export * from './components/Text'
|
|
3
|
-
export * from './components/Heading'
|
|
4
|
-
export * from './components/Avatar'
|
|
5
|
-
export * from './components/Button'
|
|
6
|
-
export * from './components/TextInput'
|
|
7
|
-
export * from './components/TextArea'
|
|
8
|
-
export * from './components/Checkbox'
|
|
9
|
-
export * from './components/Dropdown'
|
|
10
|
-
export * from './styles'
|
package/src/styles/index.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
colors,
|
|
3
|
-
fontSizes,
|
|
4
|
-
fontWeights,
|
|
5
|
-
fonts,
|
|
6
|
-
lineHeights,
|
|
7
|
-
radii,
|
|
8
|
-
space,
|
|
9
|
-
} from '@spies-ui/tokens'
|
|
10
|
-
import { createStitches, defaultThemeMap } from '@stitches/react'
|
|
11
|
-
|
|
12
|
-
export const {
|
|
13
|
-
styled,
|
|
14
|
-
css,
|
|
15
|
-
globalCss,
|
|
16
|
-
keyframes,
|
|
17
|
-
getCssText,
|
|
18
|
-
theme,
|
|
19
|
-
createTheme,
|
|
20
|
-
config,
|
|
21
|
-
} = createStitches({
|
|
22
|
-
themeMap: {
|
|
23
|
-
...defaultThemeMap,
|
|
24
|
-
height: 'space',
|
|
25
|
-
width: 'space',
|
|
26
|
-
},
|
|
27
|
-
theme: {
|
|
28
|
-
colors,
|
|
29
|
-
fontSizes,
|
|
30
|
-
fontWeights,
|
|
31
|
-
fonts,
|
|
32
|
-
lineHeights,
|
|
33
|
-
radii,
|
|
34
|
-
space,
|
|
35
|
-
},
|
|
36
|
-
})
|
package/tsconfig.json
DELETED