@giv-igniteui/react 2.0.0
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/.eslintrc.json +3 -0
- package/.turbo/turbo-build.log +18 -0
- package/CHANGELOG.md +7 -0
- package/dist/index.d.mts +1682 -0
- package/dist/index.d.ts +1682 -0
- package/dist/index.js +546 -0
- package/dist/index.mjs +504 -0
- package/package.json +32 -0
- package/src/components/Avatar/index.tsx +18 -0
- package/src/components/Avatar/styles.ts +29 -0
- package/src/components/Box.tsx +12 -0
- package/src/components/Button.tsx +84 -0
- package/src/components/Checkbox/index.tsx +20 -0
- package/src/components/Checkbox/styles.ts +55 -0
- package/src/components/Heading.tsx +27 -0
- package/src/components/MultiStep/index.tsx +23 -0
- package/src/components/MultiStep/styles.ts +33 -0
- package/src/components/Text.tsx +32 -0
- package/src/components/TextArea.tsx +34 -0
- package/src/components/TextInput/index.tsx +17 -0
- package/src/components/TextInput/styles.ts +43 -0
- package/src/index.tsx +9 -0
- package/src/styles/index.ts +36 -0
- package/tsconfig.json +6 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
import * as Checkbox from '@radix-ui/react-checkbox'
|
2
|
+
import { keyframes, styled } from '../../styles'
|
3
|
+
|
4
|
+
export const CheckboxContainer = styled(Checkbox.Root, {
|
5
|
+
all: 'unset', // Como é um botão, all unset tirará borda, background, etc
|
6
|
+
width: '$6',
|
7
|
+
height: '$6',
|
8
|
+
backgroundColor: '$gray900',
|
9
|
+
borderRadius: '$xs',
|
10
|
+
cursor: 'pointer',
|
11
|
+
overflow: 'hidden',
|
12
|
+
boxSizing: 'border-box',
|
13
|
+
display: 'flex',
|
14
|
+
justifyContent: 'center',
|
15
|
+
alignItems: 'center',
|
16
|
+
border: '2px solid $gray900',
|
17
|
+
|
18
|
+
'&[data-state="checked"]': {
|
19
|
+
backgroundColor: '$ignite300',
|
20
|
+
},
|
21
|
+
|
22
|
+
'&:focus': {
|
23
|
+
border: '2px solid $ignite300',
|
24
|
+
},
|
25
|
+
})
|
26
|
+
|
27
|
+
const slideIn = keyframes({
|
28
|
+
from: {
|
29
|
+
transform: 'translateY(-100%)',
|
30
|
+
},
|
31
|
+
to: {
|
32
|
+
transform: 'translateY(0)',
|
33
|
+
},
|
34
|
+
})
|
35
|
+
|
36
|
+
const slideOut = keyframes({
|
37
|
+
from: {
|
38
|
+
transform: 'translateY(0)',
|
39
|
+
},
|
40
|
+
to: {
|
41
|
+
transform: 'translateY(-100%)',
|
42
|
+
},
|
43
|
+
})
|
44
|
+
|
45
|
+
export const CheckboxIndicator = styled(Checkbox.Indicator, {
|
46
|
+
color: 'white',
|
47
|
+
width: '$4',
|
48
|
+
height: '$4',
|
49
|
+
'&[data-state="checked"]': {
|
50
|
+
animation: `${slideIn} 200ms ease-out`,
|
51
|
+
},
|
52
|
+
'&[data-state="unchecked"]': {
|
53
|
+
animation: `${slideOut} 200ms ease-out`,
|
54
|
+
},
|
55
|
+
})
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { ComponentProps } from 'react'
|
2
|
+
import { styled } from '../styles'
|
3
|
+
|
4
|
+
export const Heading = styled('h2', {
|
5
|
+
fontFamily: '$default',
|
6
|
+
lineHeight: '$shorter',
|
7
|
+
margin: 0,
|
8
|
+
color: '$gray100',
|
9
|
+
variants: {
|
10
|
+
size: {
|
11
|
+
sm: { fontSize: '$xl' },
|
12
|
+
md: { fontSize: '$2xl' },
|
13
|
+
lg: { fontSize: '$4xl' },
|
14
|
+
'2xl': { fontSize: '$5xl' },
|
15
|
+
'3xl': { fontSize: '$6xl' },
|
16
|
+
'4xl': { fontSize: '$7xl' },
|
17
|
+
'5xl': { fontSize: '$8xl' },
|
18
|
+
'6xl': { fontSize: '$9xl' },
|
19
|
+
},
|
20
|
+
},
|
21
|
+
defaultVariants: {
|
22
|
+
size: 'md',
|
23
|
+
},
|
24
|
+
})
|
25
|
+
|
26
|
+
export interface HeadingProps extends ComponentProps<typeof Heading> {}
|
27
|
+
Heading.displayName = 'Heading'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { Label, MultistepContainer, Step, Steps } from './styles'
|
2
|
+
|
3
|
+
export interface MultiStepProps {
|
4
|
+
size: number
|
5
|
+
currentStep?: number
|
6
|
+
}
|
7
|
+
|
8
|
+
export function MultiStep({ size, currentStep = 1 }: MultiStepProps) {
|
9
|
+
return (
|
10
|
+
<MultistepContainer>
|
11
|
+
<Label>
|
12
|
+
Passo {currentStep} de {size}
|
13
|
+
</Label>
|
14
|
+
<Steps css={{ '--steps-size': size }}>
|
15
|
+
{Array.from({ length: size }, (_, i) => i + 1).map((step) => {
|
16
|
+
return <Step key={step} active={currentStep >= step} />
|
17
|
+
})}
|
18
|
+
</Steps>
|
19
|
+
</MultistepContainer>
|
20
|
+
)
|
21
|
+
}
|
22
|
+
|
23
|
+
MultiStep.displayName = 'MultiStep'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { styled } from '../../styles'
|
2
|
+
import { Text } from '../Text'
|
3
|
+
|
4
|
+
export const MultistepContainer = styled('div', {})
|
5
|
+
export const Label = styled(Text, {
|
6
|
+
color: '$gray200',
|
7
|
+
|
8
|
+
defaultVariants: {
|
9
|
+
size: 'xs',
|
10
|
+
},
|
11
|
+
})
|
12
|
+
|
13
|
+
export const Steps = styled('div', {
|
14
|
+
display: 'grid',
|
15
|
+
gap: '$2',
|
16
|
+
marginTop: '$1',
|
17
|
+
gridTemplateColumns: 'repeat(var(--steps-size), 1fr)',
|
18
|
+
})
|
19
|
+
|
20
|
+
export const Step = styled('div', {
|
21
|
+
height: '$1',
|
22
|
+
borderRadius: '$px',
|
23
|
+
backgroundColor: '$gray600',
|
24
|
+
variants: {
|
25
|
+
active: {
|
26
|
+
true: {
|
27
|
+
backgroundColor: '$gray100',
|
28
|
+
},
|
29
|
+
},
|
30
|
+
},
|
31
|
+
})
|
32
|
+
|
33
|
+
export const Full = styled('div', {})
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { ComponentProps } 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: '$gray100',
|
9
|
+
variants: {
|
10
|
+
size: {
|
11
|
+
xxs: { fontSize: '$xxs' },
|
12
|
+
xs: { fontSize: '$xs' },
|
13
|
+
sm: { fontSize: '$sm' },
|
14
|
+
md: { fontSize: '$md' },
|
15
|
+
lg: { fontSize: '$lg' },
|
16
|
+
xl: { fontSize: '$xl' },
|
17
|
+
'2xl': { fontSize: '$2xl' },
|
18
|
+
'4xl': { fontSize: '$4xl' },
|
19
|
+
'5xl': { fontSize: '$5xl' },
|
20
|
+
'6xl': { fontSize: '$6xl' },
|
21
|
+
'7xl': { fontSize: '$7xl' },
|
22
|
+
'8xl': { fontSize: '$8xl' },
|
23
|
+
'9xl': { fontSize: '$9xl' },
|
24
|
+
},
|
25
|
+
},
|
26
|
+
defaultVariants: {
|
27
|
+
size: 'md',
|
28
|
+
},
|
29
|
+
})
|
30
|
+
|
31
|
+
export interface TextProps extends ComponentProps<typeof Text> {}
|
32
|
+
Text.displayName = 'Text'
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { ComponentProps } from 'react'
|
2
|
+
import { styled } from '../styles'
|
3
|
+
|
4
|
+
export const TextArea = styled('textarea', {
|
5
|
+
backgroundColor: '$gray900',
|
6
|
+
padding: '$4',
|
7
|
+
borderRadius: '$sm',
|
8
|
+
boxSizing: 'border-box',
|
9
|
+
border: '2px solid $gray900',
|
10
|
+
fontFamily: '$default',
|
11
|
+
fontSize: '$sm',
|
12
|
+
color: '$white',
|
13
|
+
fontWeight: '$regular',
|
14
|
+
resize: 'vertical',
|
15
|
+
minHeight: 80,
|
16
|
+
|
17
|
+
'&:focus': {
|
18
|
+
outline: 'none',
|
19
|
+
borderColor: '$ignite300',
|
20
|
+
},
|
21
|
+
|
22
|
+
'&:disabled': {
|
23
|
+
opacity: 0.5,
|
24
|
+
cursor: 'not-allowed',
|
25
|
+
},
|
26
|
+
|
27
|
+
'&:placeholder': {
|
28
|
+
color: '$gray400',
|
29
|
+
},
|
30
|
+
})
|
31
|
+
|
32
|
+
export interface TextAreaProps extends ComponentProps<typeof TextArea> {}
|
33
|
+
|
34
|
+
TextArea.displayName = 'TextArea'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { ComponentProps } from 'react'
|
2
|
+
import { Input, Prefix, TextInputContainer } from './styles'
|
3
|
+
|
4
|
+
export interface TextInputProps extends ComponentProps<typeof Input> {
|
5
|
+
prefix?: string
|
6
|
+
}
|
7
|
+
|
8
|
+
export function TextInput({ prefix, ...props }: TextInputProps) {
|
9
|
+
return (
|
10
|
+
<TextInputContainer>
|
11
|
+
{!!prefix && <Prefix>{prefix}</Prefix>}
|
12
|
+
<Input {...props} />
|
13
|
+
</TextInputContainer>
|
14
|
+
)
|
15
|
+
}
|
16
|
+
|
17
|
+
TextInput.displayName = 'TextInput'
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { styled } from '../../styles'
|
2
|
+
|
3
|
+
export const TextInputContainer = styled('div', {
|
4
|
+
backgroundColor: '$gray900',
|
5
|
+
padding: '$4',
|
6
|
+
borderRadius: '$sm',
|
7
|
+
boxSizing: 'border-box',
|
8
|
+
border: '2px solid $gray900',
|
9
|
+
display: 'flex',
|
10
|
+
alignItems: 'baseline',
|
11
|
+
|
12
|
+
'&:has(input:focus)': {
|
13
|
+
borderColor: '$ignite300',
|
14
|
+
},
|
15
|
+
'&:has(input:disabled)': {
|
16
|
+
opacity: 0.5,
|
17
|
+
cursor: 'not-allowed',
|
18
|
+
},
|
19
|
+
})
|
20
|
+
export const Prefix = styled('span', {
|
21
|
+
fontFamily: '$default',
|
22
|
+
fontSize: '$sm',
|
23
|
+
color: '$gray400',
|
24
|
+
fontWeight: 'regular',
|
25
|
+
})
|
26
|
+
export const Input = styled('input', {
|
27
|
+
fontFamily: '$default',
|
28
|
+
fontSize: '$sm',
|
29
|
+
color: '$white',
|
30
|
+
fontWeight: 'regular',
|
31
|
+
background: 'transparent',
|
32
|
+
border: 0,
|
33
|
+
width: '100%',
|
34
|
+
'&:focus': {
|
35
|
+
outline: 0,
|
36
|
+
},
|
37
|
+
'&:disabled': {
|
38
|
+
cursor: 'not-allowed',
|
39
|
+
},
|
40
|
+
'&:placeholder': {
|
41
|
+
color: '$gray400',
|
42
|
+
},
|
43
|
+
})
|
package/src/index.tsx
ADDED
@@ -0,0 +1,9 @@
|
|
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/MultiStep'
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import {
|
2
|
+
colors,
|
3
|
+
fontSizes,
|
4
|
+
fontWeights,
|
5
|
+
fonts,
|
6
|
+
lineHeights,
|
7
|
+
radii,
|
8
|
+
space,
|
9
|
+
} from '@giv-igniteui/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, // borderRadius
|
34
|
+
space,
|
35
|
+
},
|
36
|
+
})
|